{"version":3,"names":["createMemo","createRenderEffect","createSignal","onCleanup","untrack","CompositeListContext","eraseCompositeListContext","useCompositeListContext","sortByDocumentPosition","CompositeList","props","sources","Map","listeners","Set","tick","setTick","ownedWrite","bump","t","register","source","node","metadata","set","unregister","delete","subscribeMapChange","fn","add","sortedMap","out","nodes","meta","entry","values","isConnected","push","sort","forEach","index","m","get","map","MutationObserver","size","undefined","observer","entries","diff","update","has","removedNodes","addedNodes","parents","_","parentElement","parent","observe","childList","disconnect","elements","elementsRef","labels","labelsRef","length","i","onMapChange","contextValue","children","useCompositeListItem","params","ctx","Symbol","currentNode","setIndex","unsubscribe","paramsIndex","paramsLabel","label","paramsTextContent","textRef","current","textContent","nodeSignal","setNodeSignal","hasExplicitIndex","ref"],"sources":["composite-list.tsx"],"sourcesContent":["import type { JSX } from \"@solidjs/web\";\n/**\n * `<CompositeList>` provider + `useCompositeListItem` hook.\n *\n * Owns a per-item `Element → metadata` map, observes DOM mutations to\n * discover re-ordering, and exposes:\n *   1. a plain-array `elementsRef` (ordered by DOM position)\n *   2. a `subscribeMapChange` helper so items can learn their index\n *   3. a `mapTick` signal that bumps whenever `register`/`unregister` fire,\n *      driving the sorted-map memo in a Solid-idiomatic way\n *\n * Mirrors `packages/react/src/internals/composite/list/CompositeList.tsx` in\n * Base UI React. The Solid translation:\n *\n * - React's `useState(0)` counter becomes a `createSignal(0)` + a hidden\n *   `latestTick` integer (we write to it from `register`/`unregister` which\n *   are called from unowned event/effect scope; the signal uses\n *   `ownedWrite: true` so we don't trip `SIGNAL_WRITE_IN_OWNED_SCOPE` when an\n *   `onCleanup` removes an item).\n * - React's `useMemo` becomes `createMemo`. The memo re-reads on `tick`\n *   changes and walks the map in document order.\n * - React's `useIsoLayoutEffect` calls become split `createRenderEffect`s\n *   (for DOM-level sync) and `createEffect`s (for listener dispatch).\n * - The sibling-unit `MutationObserver` is hooked up in a render-effect\n *   keyed on the sorted map; when elements are re-ordered in the DOM, the\n *   observer bumps `tick` so consumers re-sort on the next microtask.\n *\n * `useCompositeListItem` takes a per-call `source` symbol (created once per\n * invocation) which is how we identify items across re-registrations — Solid\n * has no component-instance identity for refs to hang off of, so we use an\n * explicit token. The returned ref callback registers the element on first\n * call and unregisters via `onCleanup` when the owning scope disposes.\n */\n\nimport {\n\ttype Accessor,\n\tcreateMemo,\n\tcreateRenderEffect,\n\tcreateSignal,\n\tonCleanup,\n\tuntrack,\n} from \"solid-js\";\nimport {\n\tCompositeListContext,\n\ttype CompositeMapListener,\n\ttype CompositeMetadata,\n\teraseCompositeListContext,\n\tuseCompositeListContext,\n} from \"./composite-context\";\nimport { sortByDocumentPosition } from \"./composite-utils\";\n\nexport interface CompositeListProps<Metadata> {\n\tchildren: JSX.Element;\n\t/**\n\t * Plain array that the list keeps in DOM order. Consumers (notably the\n\t * composite root) read it inside event handlers, so it is NOT wrapped in\n\t * a signal — direct mutation is expected. Passing a pre-allocated array\n\t * is supported and matches Base UI React's `elementsRef` ergonomics.\n\t */\n\telementsRef: Array<HTMLElement | null>;\n\t/** Parallel labels array for typeahead; optional. */\n\tlabelsRef?: Array<string | null> | undefined;\n\t/**\n\t * Fired whenever the sorted map changes. Runs in an effect, so consumers\n\t * can read reactive values inside the callback body without warnings.\n\t */\n\tonMapChange?: CompositeMapListener<Metadata> | undefined;\n}\n\n/**\n * Internal entry for the per-item source registry. We keep the `source`\n * symbol as the primary key so re-registrations from the same item (e.g.\n * when its element is unmounted and a new one is mounted in the same\n * lifetime) replace the old entry cleanly.\n */\ninterface SourceEntry<Metadata> {\n\tnode: Element;\n\tmetadata: Metadata | null;\n}\n\nexport function CompositeList<Metadata>(\n\tprops: CompositeListProps<Metadata>,\n): JSX.Element {\n\t// Source-of-truth registry. Keyed by the per-item `source` symbol so\n\t// registration identity survives element swaps.\n\tconst sources = new Map<symbol, SourceEntry<Metadata>>();\n\n\t// Listener set for `subscribeMapChange`. We keep it off-signal since\n\t// subscription lifetimes are managed by disposer functions, not tracked.\n\tconst listeners = new Set<CompositeMapListener<Metadata>>();\n\n\t// Rerender tick. This is the \"re-read\" signal — every mutation bumps it\n\t// and the `sortedMap` memo re-runs. The signal uses `ownedWrite: true`\n\t// because we write to it from the unowned `register`/`unregister`\n\t// callbacks (and from the mutation observer's microtask), not from\n\t// owned reactive scope.\n\tconst [tick, setTick] = createSignal(0, { ownedWrite: true });\n\tconst bump = (): void => {\n\t\tsetTick((t) => t + 1);\n\t};\n\n\tconst register = (\n\t\tsource: symbol,\n\t\tnode: Element,\n\t\tmetadata: Metadata,\n\t): void => {\n\t\tsources.set(source, { node, metadata: metadata ?? null });\n\t\tbump();\n\t};\n\n\tconst unregister = (source: symbol): void => {\n\t\tsources.delete(source);\n\t\tbump();\n\t};\n\n\tconst subscribeMapChange = (\n\t\tfn: CompositeMapListener<Metadata>,\n\t): (() => void) => {\n\t\tlisteners.add(fn);\n\t\treturn () => {\n\t\t\tlisteners.delete(fn);\n\t\t};\n\t};\n\n\t// Sorted map. Recomputes on `tick` — filters disconnected elements (so\n\t// `compareDocumentPosition` doesn't return inconsistent results) and\n\t// stamps each entry with its `index` for consumers.\n\tconst sortedMap: Accessor<Map<Element, CompositeMetadata<Metadata> | null>> =\n\t\tcreateMemo(() => {\n\t\t\t// Track the tick signal so the memo re-runs on register/unregister.\n\t\t\ttick();\n\t\t\tconst out = new Map<Element, CompositeMetadata<Metadata> | null>();\n\t\t\tconst nodes: Element[] = [];\n\t\t\tconst meta = new Map<Element, Metadata | null>();\n\t\t\tfor (const entry of sources.values()) {\n\t\t\t\tif (!entry.node.isConnected) continue;\n\t\t\t\tnodes.push(entry.node);\n\t\t\t\tmeta.set(entry.node, entry.metadata);\n\t\t\t}\n\t\t\tnodes.sort(sortByDocumentPosition);\n\t\t\tnodes.forEach((node, index) => {\n\t\t\t\tconst m = meta.get(node);\n\t\t\t\tout.set(node, { ...(m ?? ({} as Metadata)), index });\n\t\t\t});\n\t\t\treturn out;\n\t\t});\n\n\t// Wire up the MutationObserver. Runs in a render effect so ordering\n\t// changes (e.g. a <For> re-ordering its rows) bump the tick before the\n\t// next flush. We re-bind the observer when the sorted map's node set\n\t// changes so we're always observing the current parents.\n\tcreateRenderEffect(\n\t\t() => {\n\t\t\t// Track sortedMap so re-attach happens on real ordering changes.\n\t\t\treturn sortedMap();\n\t\t},\n\t\t(map: Map<Element, CompositeMetadata<Metadata> | null>) => {\n\t\t\tif (typeof MutationObserver !== \"function\" || map.size === 0) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t\tconst observer = new MutationObserver((entries) => {\n\t\t\t\t// Count add/remove pairs: when the same node is both added and\n\t\t\t\t// removed (i.e. re-ordered), it cancels out. Only re-sort when\n\t\t\t\t// the churn set ends up *empty*, matching Base UI React.\n\t\t\t\tconst diff = new Set<Node>();\n\t\t\t\tconst update = (node: Node) => {\n\t\t\t\t\tif (diff.has(node)) diff.delete(node);\n\t\t\t\t\telse diff.add(node);\n\t\t\t\t};\n\t\t\t\tentries.forEach((entry) => {\n\t\t\t\t\tentry.removedNodes.forEach(update);\n\t\t\t\t\tentry.addedNodes.forEach(update);\n\t\t\t\t});\n\t\t\t\tif (diff.size === 0) bump();\n\t\t\t});\n\t\t\tconst parents = new Set<Element>();\n\t\t\tmap.forEach((_, node) => {\n\t\t\t\tif (node.parentElement) parents.add(node.parentElement);\n\t\t\t});\n\t\t\tparents.forEach((parent) => {\n\t\t\t\tobserver.observe(parent, { childList: true });\n\t\t\t});\n\t\t\treturn () => {\n\t\t\t\tobserver.disconnect();\n\t\t\t};\n\t\t},\n\t);\n\n\t// Sync the shared elementsRef + labelsRef arrays with the sorted map and\n\t// fan out map changes to subscribers + the optional `onMapChange` prop.\n\t// Runs as a render effect (layout-timing) so consumers that read the map\n\t// during the same flush — e.g. `<Tabs.Indicator>` measurements or the\n\t// composite root's keyboard handler — see registered items before paint.\n\t// Matches Base UI React's `useIsoLayoutEffect` dispatch in `CompositeList`.\n\tcreateRenderEffect(\n\t\t() => sortedMap(),\n\t\t(map: Map<Element, CompositeMetadata<Metadata> | null>) => {\n\t\t\tconst elements = props.elementsRef;\n\t\t\tconst labels = props.labelsRef;\n\t\t\telements.length = map.size;\n\t\t\tif (labels) labels.length = map.size;\n\t\t\tlet i = 0;\n\t\t\tfor (const [node] of map) {\n\t\t\t\telements[i] = node as HTMLElement;\n\t\t\t\ti += 1;\n\t\t\t}\n\t\t\tlisteners.forEach((fn) => {\n\t\t\t\tfn(map);\n\t\t\t});\n\t\t\tprops.onMapChange?.(map);\n\t\t\treturn undefined;\n\t\t},\n\t);\n\n\t// `props.elementsRef` / `props.labelsRef` are captured once at setup —\n\t// they're stable mutable refs from the consumer, not a value that needs\n\t// to track. Wrap in `untrack` so the reads don't trip\n\t// `[STRICT_READ_UNTRACKED]` from this list's component-body scope.\n\tconst contextValue = untrack(() =>\n\t\teraseCompositeListContext<Metadata>({\n\t\t\tregister,\n\t\t\tunregister,\n\t\t\tsubscribeMapChange,\n\t\t\telementsRef: props.elementsRef,\n\t\t\tlabelsRef: props.labelsRef,\n\t\t}),\n\t);\n\n\treturn (\n\t\t<CompositeListContext value={contextValue}>\n\t\t\t{props.children}\n\t\t</CompositeListContext>\n\t);\n}\n\nexport interface UseCompositeListItemParameters<Metadata> {\n\t/** Consumer-supplied metadata carried alongside the index. */\n\tmetadata?: Metadata | undefined;\n\t/** Label for typeahead (when the root opts into labels). */\n\tlabel?: string | null | undefined;\n\t/** Fallback label source — used when `label` is omitted. */\n\ttextRef?: { current: HTMLElement | null } | undefined;\n\t/**\n\t * Override the index the item reports (skips registration). Matches the\n\t * Base UI React \"externalIndex\" escape hatch for components that know\n\t * their index up front.\n\t */\n\tindex?: number | undefined;\n}\n\nexport interface UseCompositeListItemReturn {\n\t/** Stable ref callback. Composes with other refs via Solid's array form. */\n\tref: (node: HTMLElement | null) => void;\n\t/** Accessor returning the item's current index (or `-1` before register). */\n\tindex: Accessor<number>;\n}\n\n/**\n * Register the rendered element with the nearest `<CompositeList>`. Returns\n * a ref callback + an accessor for the item's current index.\n *\n * The `source` symbol is created once per call so re-registrations (e.g. the\n * owner scope re-running) stay identified across element swaps. Cleanup on\n * scope disposal unregisters automatically.\n */\nexport function useCompositeListItem<Metadata>(\n\tparams: UseCompositeListItemParameters<Metadata> = {},\n): UseCompositeListItemReturn {\n\tconst ctx = useCompositeListContext<Metadata>();\n\n\t// Per-call identity token. Using a symbol (DECISION) avoids React's\n\t// useRef-of-symbol dance and makes the registration entry unambiguous\n\t// across element swaps.\n\tconst source = Symbol(\"composite-list-item\");\n\n\t// Hold onto the registered node so we can keep our own index in sync\n\t// whenever the list re-sorts. We also need it for unregister.\n\tlet currentNode: Element | null = null;\n\n\t// `index` signal. `-1` means \"not yet registered\" (matches React). Uses\n\t// ownedWrite because the writes happen in the subscription callback /\n\t// register path, which runs from unowned scope. The `params.index` read\n\t// is one-shot setup (consumer-supplied initial index), so untrack it so\n\t// callers that invoke this hook from an effect-apply scope don't trip\n\t// `[STRICT_READ_UNTRACKED]` on the synchronous signal-init read.\n\tconst [index, setIndex] = createSignal(untrack(() => params.index) ?? -1, {\n\t\townedWrite: true,\n\t});\n\n\t// Subscribe to map changes so our index stays live. We need the cleanup\n\t// to fire on scope disposal and to deregister if we leave the list\n\t// entirely.\n\tconst unsubscribe = ctx.subscribeMapChange(\n\t\t(map: Map<Element, CompositeMetadata<Metadata> | null>) => {\n\t\t\t// Subscription fires from inside the list's `createEffect` apply\n\t\t\t// when items register/unregister. The `params.*` reads here are\n\t\t\t// snapshots driving a one-shot label-cache write, not\n\t\t\t// subscriptions. We pull each `params` access through its own\n\t\t\t// `untrack` call so any nested reactive accessors (props proxies\n\t\t\t// can wrap memos around getters) don't inherit the surrounding\n\t\t\t// effect-apply strict-read context.\n\t\t\tconst paramsIndex = untrack(() => params.index);\n\t\t\tif (paramsIndex != null) return;\n\t\t\tif (!currentNode) return;\n\t\t\tconst entry = map.get(currentNode);\n\t\t\tconst i = entry?.index;\n\t\t\tif (typeof i !== \"number\") return;\n\t\t\tsetIndex(i);\n\t\t\tconst labels = ctx.labelsRef;\n\t\t\tif (!labels) return;\n\t\t\tconst paramsLabel = untrack(() => params.label);\n\t\t\tconst paramsTextContent = untrack(\n\t\t\t\t() => params.textRef?.current?.textContent,\n\t\t\t);\n\t\t\tlabels[i] =\n\t\t\t\tparamsLabel !== undefined\n\t\t\t\t\t? (paramsLabel ?? null)\n\t\t\t\t\t: (paramsTextContent ?? currentNode.textContent ?? null);\n\t\t},\n\t);\n\n\tonCleanup(() => {\n\t\tunsubscribe();\n\t\tif (currentNode) {\n\t\t\tctx.unregister(source);\n\t\t\tcurrentNode = null;\n\t\t}\n\t});\n\n\t// Beta 8: ref callbacks fire *before* the element is inserted into the\n\t// DOM. If we called `ctx.register` directly from the ref, the\n\t// downstream `sortedMap` memo (which filters on `isConnected`) would\n\t// see the node as disconnected and drop it — and since the list's\n\t// MutationObserver only re-bumps on re-ordering, the subsequent\n\t// insertion never triggers a re-sort. We capture the node in the ref\n\t// but defer the `register` call to a render effect, which fires during\n\t// `flush()` after DOM insertion has completed.\n\tconst [nodeSignal, setNodeSignal] = createSignal<HTMLElement | null>(null, {\n\t\townedWrite: true,\n\t});\n\n\t// `params.index` and `params.metadata` are consumer inputs read here as\n\t// snapshots — index for the static-explicit branch, metadata for the\n\t// register call. Wrapping in `untrack` keeps the ref callback and\n\t// register-effect's apply scope from tripping\n\t// `[STRICT_READ_UNTRACKED]` on those reads.\n\tconst hasExplicitIndex = untrack(() => params.index) != null;\n\n\tconst ref = (node: HTMLElement | null): void => {\n\t\tif (hasExplicitIndex) {\n\t\t\tcurrentNode = node;\n\t\t\treturn;\n\t\t}\n\t\tsetNodeSignal(node);\n\t};\n\n\tif (!hasExplicitIndex) {\n\t\tcreateRenderEffect(\n\t\t\t() => nodeSignal(),\n\t\t\t(node) => {\n\t\t\t\tif (currentNode && currentNode !== node) {\n\t\t\t\t\tctx.unregister(source);\n\t\t\t\t}\n\t\t\t\tcurrentNode = node;\n\t\t\t\tif (node) {\n\t\t\t\t\tconst metadata = untrack(() => params.metadata);\n\t\t\t\t\tctx.register(source, node, (metadata ?? null) as Metadata);\n\t\t\t\t}\n\t\t\t},\n\t\t);\n\t}\n\n\treturn { ref, index };\n}\n"],"mappings":"AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAECA,UAAU,EACVC,kBAAkB,EAClBC,YAAY,EACZC,SAAS,EACTC,OAAO,QACD,UAAU;AACjB,SACCC,oBAAoB,EAGpBC,yBAAyB,EACzBC,uBAAuB,QACjB,qBAAqB;AAC5B,SAASC,sBAAsB,QAAQ,mBAAmB;;AAoB1D;AACA;AACA;AACA;AACA;AACA;;AAMA,OAAO,SAASC,aAAaA,CAC5BC,KAAmC,EACrB;EACd;EACA;EACA,MAAMC,OAAO,GAAG,IAAIC,GAAG,CAAgC,CAAC;;EAExD;EACA;EACA,MAAMC,SAAS,GAAG,IAAIC,GAAG,CAAiC,CAAC;;EAE3D;EACA;EACA;EACA;EACA;EACA,MAAM,CAACC,IAAI,EAAEC,OAAO,CAAC,GAAGd,YAAY,CAAC,CAAC,EAAE;IAAEe,UAAU,EAAE;EAAK,CAAC,CAAC;EAC7D,MAAMC,IAAI,GAAGA,CAAA,KAAY;IACxBF,OAAO,CAAEG,CAAC,IAAKA,CAAC,GAAG,CAAC,CAAC;EACtB,CAAC;EAED,MAAMC,QAAQ,GAAGA,CAChBC,MAAc,EACdC,IAAa,EACbC,QAAkB,KACR;IACVZ,OAAO,CAACa,GAAG,CAACH,MAAM,EAAE;MAAEC,IAAI;MAAEC,QAAQ,EAAEA,QAAQ,IAAI;IAAK,CAAC,CAAC;IACzDL,IAAI,CAAC,CAAC;EACP,CAAC;EAED,MAAMO,UAAU,GAAIJ,MAAc,IAAW;IAC5CV,OAAO,CAACe,MAAM,CAACL,MAAM,CAAC;IACtBH,IAAI,CAAC,C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