{"version":3,"names":["spread","createRenderEffect","createRoot","createSignal","getOwner","runWithOwner","makeSlotRefDirective","getProps","el","setEl","name","ownedWrite","bound","owner","node"],"sources":["make-slot-ref-directive.ts"],"sourcesContent":["import { spread } from \"@solidjs/web\";\nimport {\n\tcreateRenderEffect,\n\tcreateRoot,\n\tcreateSignal,\n\tgetOwner,\n\trunWithOwner,\n} from \"solid-js\";\n\n/**\n * Build a directive-shaped ref callback that spreads a slot prop bag onto\n * an element exactly once on mount. Used by every compound primitive's\n * `c.triggerRef()` / `c.panelRef()` factories.\n *\n * RFC 07 apply-phase is unowned, so a slot-spreading directive can't create\n * signals at apply time. The captured `getProps` is invoked exactly once\n * inside an owned render-effect, then `spread()` writes the (still-reactive,\n * thanks to getter-bag semantics) attributes onto the node. Subsequent ref\n * callbacks on the same logical slot are no-ops — single binding per slot.\n *\n * Returned callback semantics:\n * - First non-null `el` value latches and runs `spread`. Subsequent values\n *   (mount → unmount → remount) do NOT re-bind; the original spread keeps\n *   its reactive subscriptions alive against the original node.\n *\n * If a slot needs to support remounting, use `c.<slot>(userProps)` from the\n * compound's own JSX instead — the slot factory builds a fresh getter-bag\n * per call and the wrapper's reactive scope handles the lifecycle.\n */\nexport function makeSlotRefDirective<E extends HTMLElement>(\n\tgetProps: () => object,\n): (el: E | null) => void {\n\tconst [el, setEl] = createSignal<E | null>(null, {\n\t\tname: \"slot-ref-directive.el\",\n\t\townedWrite: true,\n\t});\n\tlet bound = false;\n\t// The effect callback runs with no ambient owner, so capture the factory's\n\t// owner here and parent the spread root to it explicitly.\n\tconst owner = getOwner();\n\tcreateRenderEffect(\n\t\t() => el(),\n\t\t(node) => {\n\t\t\tif (!node || bound) return;\n\t\t\tbound = true;\n\t\t\t// `spread()` sets up per-key reactive bindings; the first\n\t\t\t// synchronous read pass would otherwise inherit our enclosing\n\t\t\t// effect-apply scope and trip `[STRICT_READ_UNTRACKED]` on\n\t\t\t// every getter on the prop bag. `createRoot` gives spread its\n\t\t\t// own owned scope so its internal effects' compute reads\n\t\t\t// subscribe correctly under their own tracking context, with\n\t\t\t// no strictRead inheritance from the outer apply. Running it\n\t\t\t// under the captured `owner` disposes the root along with the\n\t\t\t// directive's owning scope.\n\t\t\trunWithOwner(owner, () => createRoot(() => spread(node, getProps())));\n\t\t},\n\t);\n\treturn (node: E | null) => setEl(() => node);\n}\n"],"mappings":"AAAA,SAASA,MAAM,QAAQ,cAAc;AACrC,SACCC,kBAAkB,EAClBC,UAAU,EACVC,YAAY,EACZC,QAAQ,EACRC,YAAY,QACN,UAAU;;AAEjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,oBAAoBA,CACnCC,QAAsB,EACG;EACzB,MAAM,CAACC,EAAE,EAAEC,KAAK,CAAC,GAAGN,YAAY,CAAW,IAAI,EAAE;IAChDO,IAAI,EAAE,uBAAuB;IAC7BC,UAAU,EAAE;EACb,CAAC,CAAC;EACF,IAAIC,KAAK,GAAG,KAAK;EACjB;EACA;EACA,MAAMC,KAAK,GAAGT,QAAQ,CAAC,CAAC;EACxBH,kBAAkB,CACjB,MAAMO,EAAE,CAAC,CAAC,EACTM,IAAI,IAAK;IACT,IAAI,CAACA,IAAI,IAAIF,KAAK,EAAE;IACpBA,KAAK,GAAG,IAAI;IACZ;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACAP,YAAY,CAACQ,KAAK,EAAE,MAAMX,UAAU,CAAC,MAAMF,MAAM,CAACc,IAAI,EAAEP,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;EACtE,CACD,CAAC;EACD,OAAQO,IAAc,IAAKL,KAAK,CAAC,MAAMK,IAAI,CAAC;AAC7C","ignoreList":[]}