what-core 0.10.0 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-2IZMPODD.min.js +2 -0
- package/dist/chunk-2IZMPODD.min.js.map +7 -0
- package/dist/chunk-2P7OVL2L.js +1386 -0
- package/dist/chunk-2P7OVL2L.js.map +7 -0
- package/dist/chunk-5EQUBJWQ.js +1365 -0
- package/dist/chunk-5EQUBJWQ.js.map +7 -0
- package/dist/chunk-6DAIK77K.min.js +2 -0
- package/dist/chunk-6DAIK77K.min.js.map +7 -0
- package/dist/chunk-CCINITLW.js +1692 -0
- package/dist/chunk-CCINITLW.js.map +7 -0
- package/dist/chunk-GZRA4IAJ.js +1699 -0
- package/dist/chunk-GZRA4IAJ.js.map +7 -0
- package/dist/chunk-H3GA34JK.js +1384 -0
- package/dist/chunk-H3GA34JK.js.map +7 -0
- package/dist/chunk-MH7L756Y.min.js +2 -0
- package/dist/chunk-MH7L756Y.min.js.map +7 -0
- package/dist/chunk-RI7T5VFD.min.js +2 -0
- package/dist/chunk-RI7T5VFD.min.js.map +7 -0
- package/dist/chunk-VKCFJ4OT.min.js +2 -0
- package/dist/chunk-VKCFJ4OT.min.js.map +7 -0
- package/dist/index.js +3 -5
- package/dist/index.js.map +2 -2
- package/dist/index.min.js +6 -6
- package/dist/index.min.js.map +3 -3
- package/dist/render.js +14 -2
- package/dist/render.min.js +1 -1
- package/dist/testing.js +1 -1
- package/dist/testing.min.js +1 -1
- package/package.json +1 -1
- package/render.d.ts +18 -0
- package/src/agent-context.js +3 -2
- package/src/dom.js +16 -0
- package/src/guardrails.js +17 -46
- package/src/reactive.js +22 -0
- package/src/render.js +159 -55
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/render.js"],
|
|
4
|
+
"sourcesContent": ["// What Framework - Fine-Grained Rendering Primitives\n// Solid-style rendering: components run once, signals create individual DOM effects.\n// No VDOM diffing \u2014 direct DOM manipulation with surgical signal-driven updates.\n\nimport { effect, untrack, createRoot, _createItemScope, signal, memo, __DEV__ } from './reactive.js';\nimport { createDOM, disposeTree, getCurrentComponent, getComponentStack, _setSelectValue } from './dom.js';\nexport { effect, untrack };\n// Re-export memo for compiled output (branch memoization: the compiler emits\n// _$memo(() => cond) so conditional branches only re-create DOM when the\n// condition value actually changes, not on every dependency write).\nexport { memo };\n\n// --- Generic text insertion hook ---\n// External text engines (e.g., what-text) register a callback here via\n// _setTextInsertHook(). When null (default), zero cost \u2014 no module loaded,\n// no branch taken. The hook receives (parentElement, textString) on every\n// dynamic text insertion and update.\nlet _onTextInsert = null;\n\nexport function _setTextInsertHook(fn) {\n _onTextInsert = typeof fn === 'function' ? fn : null;\n}\n\n// --- _$createComponent(Component, props, children) ---\n// Internal compiler target for component instantiation. The compiler emits calls\n// to this function instead of h() \u2014 keeping h() out of compiled output entirely.\n// Merges children into props and delegates to createDOM which calls createComponent.\n\nexport function _$createComponent(Component, props, children) {\n if (children && children.length > 0) {\n const mergedChildren = children.length === 1 ? children[0] : children;\n // Mutate props in place when possible to avoid object spread allocation.\n // Compiled output creates a fresh props object per call, so mutation is safe.\n if (props) {\n props.children = mergedChildren;\n } else {\n props = { children: mergedChildren };\n }\n }\n // Build a VNode-like object and pass to createDOM which handles component execution\n return createDOM({ tag: Component, props: props || {}, children: children || [], key: null, _vnode: true });\n}\n\n// --- URL Sanitization for DOM attributes ---\n// Rejects javascript:, data:, vbscript: protocols (case-insensitive, trimmed).\n\nconst URL_ATTRS = new Set(['href', 'src', 'action', 'formaction', 'formAction']);\n\nfunction isSafeUrl(url) {\n if (typeof url !== 'string') return true; // non-string values are not URL-injection risks\n const normalized = url.trim().replace(/[\\s\\x00-\\x1f]/g, '').toLowerCase();\n if (normalized.startsWith('javascript:')) return false;\n if (normalized.startsWith('data:')) return false;\n if (normalized.startsWith('vbscript:')) return false;\n return true;\n}\n\n// --- template(html) ---\n// Pre-parse HTML string into a <template> element. Returns a factory function\n// that clones the DOM tree via cloneNode(true) \u2014 2-5x faster than createElement chains.\n// INTERNAL: Used by the compiler. Not intended for direct use by application code.\n// Exported as both `template` (for compiler output) and `_template` (to signal internal use).\n\n// Table child elements that need special parent wrapping for innerHTML parsing.\n// Browsers auto-correct bare <tr>, <td>, etc. when orphaned \u2014 wrapping prevents silent drops.\nconst TABLE_WRAPPERS = {\n tr: { depth: 2, wrap: '<table><tbody>', unwrap: '</tbody></table>' },\n td: { depth: 3, wrap: '<table><tbody><tr>', unwrap: '</tr></tbody></table>' },\n th: { depth: 3, wrap: '<table><tbody><tr>', unwrap: '</tr></tbody></table>' },\n thead: { depth: 1, wrap: '<table>', unwrap: '</table>' },\n tbody: { depth: 1, wrap: '<table>', unwrap: '</table>' },\n tfoot: { depth: 1, wrap: '<table>', unwrap: '</table>' },\n colgroup: { depth: 1, wrap: '<table>', unwrap: '</table>' },\n col: { depth: 1, wrap: '<table>', unwrap: '</table>' },\n caption: { depth: 1, wrap: '<table>', unwrap: '</table>' },\n};\n\n// SVG element tags that must be created in an SVG namespace context.\nconst SVG_ELEMENTS = new Set([\n 'svg', 'path', 'circle', 'rect', 'line', 'polyline', 'polygon', 'ellipse',\n 'g', 'defs', 'use', 'text', 'tspan', 'foreignObject', 'clipPath', 'mask',\n 'pattern', 'linearGradient', 'radialGradient', 'stop', 'marker', 'symbol',\n 'image', 'animate', 'animateTransform', 'animateMotion', 'set',\n 'filter', 'feGaussianBlur', 'feOffset', 'feMerge', 'feMergeNode',\n 'feBlend', 'feColorMatrix', 'feComponentTransfer', 'feComposite',\n 'feConvolveMatrix', 'feDiffuseLighting', 'feDisplacementMap',\n 'feFlood', 'feImage', 'feMorphology', 'feSpecularLighting',\n 'feTile', 'feTurbulence', 'feDistantLight', 'fePointLight', 'feSpotLight',\n]);\n\nfunction getLeadingTag(html) {\n const m = html.match(/^<([a-zA-Z][a-zA-Z0-9]*)/);\n return m ? m[1] : '';\n}\n\n// Internal implementation \u2014 no warnings. Used by compiler via _$template.\nfunction _$templateImpl(html) {\n const trimmed = html.trim();\n const tag = getLeadingTag(trimmed);\n\n // SVG namespace: parse inside an SVG container then extract\n if (SVG_ELEMENTS.has(tag)) {\n return svgTemplate(trimmed);\n }\n\n // Table element wrapping: parse inside proper table parent then extract\n const tableInfo = TABLE_WRAPPERS[tag];\n if (tableInfo) {\n const t = document.createElement('template');\n t.innerHTML = tableInfo.wrap + trimmed + tableInfo.unwrap;\n // Pre-navigate to the target element once \u2014 avoids per-clone traversal.\n let target = t.content.firstChild;\n for (let i = 0; i < tableInfo.depth; i++) target = target.firstChild;\n return () => target.cloneNode(true);\n }\n\n const t = document.createElement('template');\n t.innerHTML = trimmed;\n return () => t.content.firstChild.cloneNode(true);\n}\n\n// Public export \u2014 warns in dev mode that this is a compiler internal.\n// Application code should use JSX, which the compiler transforms into _$template calls.\nlet _templateWarned = false;\nexport function template(html) {\n if (__DEV__ && !_templateWarned) {\n _templateWarned = true;\n console.warn(\n '[what] template() is a compiler internal. Use JSX instead. ' +\n 'Direct calls with user input can lead to XSS vulnerabilities.'\n );\n }\n return _$templateImpl(html);\n}\n\n// Compiler-internal alias \u2014 preferred name for compiled output (no warning)\nexport { _$templateImpl as _$template };\n\n// Legacy alias kept for backwards compat\nexport { template as _template };\n\n// --- svgTemplate(html) ---\n// Parse SVG content inside an SVG namespace container. Without this, innerHTML on a\n// <template> element creates HTML-namespace nodes, making SVG elements invisible.\n// If the HTML is a complete <svg> tag, it is parsed inside a temporary <div> so the\n// browser uses the correct SVG namespace. For inner SVG elements (path, circle, etc.),\n// they are wrapped in an <svg> container for parsing and then extracted.\n\nexport function svgTemplate(html) {\n const trimmed = html.trim();\n const tag = getLeadingTag(trimmed);\n\n if (tag === 'svg') {\n // Complete <svg> element \u2014 parse in a div (browsers handle the namespace)\n const t = document.createElement('template');\n t.innerHTML = trimmed;\n return () => t.content.firstChild.cloneNode(true);\n }\n\n // Inner SVG element (path, circle, g, etc.) \u2014 wrap in <svg> for namespace context\n const t = document.createElement('template');\n t.innerHTML = `<svg xmlns=\"http://www.w3.org/2000/svg\">${trimmed}</svg>`;\n return () => t.content.firstChild.firstChild.cloneNode(true);\n}\n\n// --- insert(parent, child, marker?) ---\n// Reactive child insertion. Handles all child types:\n// - string/number \u2192 text node\n// - function \u2192 effect that updates text node reactively\n// - DOM node \u2192 append directly\n// - array \u2192 insert each element\n\nexport function insert(parent, child, marker) {\n // mapArray inserter: self-managing reactive list with its own effect\n if (typeof child === 'function' && child._mapArray) {\n return child(parent, marker || null);\n }\n\n if (typeof child === 'function') {\n // Single-evaluation mount: child() is evaluated exactly ONCE at mount,\n // inside the effect (so signal reads are tracked). The first run decides\n // between the text fast path (direct textNode.data updates, zero\n // allocations) and the general reconcile path. Previously the first\n // evaluation happened outside the effect to pick the path, then the\n // effect's first run re-evaluated child() \u2014 creating components twice\n // on mount for non-text children. (SPRINT v0.11 C3)\n const m = marker || null;\n let current = null;\n let textNode = null; // non-null while on the text fast path\n let mounted = false;\n effect(() => {\n const val = child();\n const vt = typeof val;\n if (!mounted) {\n // First run \u2014 mount\n mounted = true;\n if (vt === 'string' || vt === 'number') {\n textNode = document.createTextNode(String(val));\n if (m) parent.insertBefore(textNode, m);\n else parent.appendChild(textNode);\n if (_onTextInsert) _onTextInsert(parent, String(val));\n current = textNode;\n } else {\n current = reconcileInsert(parent, val, null, m);\n }\n return;\n }\n if (textNode !== null && (vt === 'string' || vt === 'number')) {\n // Fast path: still text \u2014 update data directly (no allocations)\n const str = String(val);\n if (textNode.data !== str) textNode.data = str;\n if (_onTextInsert) _onTextInsert(parent, str);\n return;\n }\n // Type changed (or never was text) \u2014 full reconcile\n textNode = null;\n current = reconcileInsert(parent, val, current, m);\n });\n return current;\n }\n\n // Static text: create text node directly, skip reconcileInsert overhead\n if (typeof child === 'string' || typeof child === 'number') {\n const textNode = document.createTextNode(String(child));\n if (marker) parent.insertBefore(textNode, marker);\n else parent.appendChild(textNode);\n return textNode;\n }\n\n // Static DOM node: insert directly, skip reconcileInsert overhead\n if (child != null && typeof child === 'object' && child.nodeType > 0) {\n if (marker) parent.insertBefore(child, marker);\n else parent.appendChild(child);\n return child;\n }\n\n return reconcileInsert(parent, child, null, marker || null);\n}\n\nfunction isDomNode(value) {\n if (!value || typeof value !== 'object') return false;\n if (typeof Node !== 'undefined' && value instanceof Node) return true;\n return typeof value.nodeType === 'number' && typeof value.nodeName === 'string';\n}\n\nfunction isVNode(value) {\n return !!value && typeof value === 'object' && (value._vnode === true || 'tag' in value);\n}\n\n// Check if parent is an SVG element. Cached typeof check avoids repeated lookups.\nconst _hasSVGElement = typeof SVGElement !== 'undefined';\nfunction isSvgParent(parent) {\n return _hasSVGElement\n && parent instanceof SVGElement\n && parent.tagName !== 'foreignObject';\n}\n\nfunction asNodeArray(value) {\n if (value == null) return [];\n return Array.isArray(value) ? value : [value];\n}\n\nfunction valuesToNodes(value, parent, out) {\n if (value == null || typeof value === 'boolean') return out;\n\n if (Array.isArray(value)) {\n for (let i = 0; i < value.length; i++) {\n valuesToNodes(value[i], parent, out);\n }\n return out;\n }\n\n // Resolve function values (reactive accessors passed through props)\n if (typeof value === 'function') {\n valuesToNodes(value(), parent, out);\n return out;\n }\n\n if (typeof value === 'string' || typeof value === 'number') {\n out.push(document.createTextNode(String(value)));\n return out;\n }\n\n if (isDomNode(value)) {\n // DocumentFragments lose their children on DOM insertion, making them\n // untrackable for reconciliation. Flatten to child nodes instead.\n if (value.nodeType === 11 && value.childNodes.length > 0) {\n const children = Array.from(value.childNodes);\n for (let i = 0; i < children.length; i++) {\n out.push(children[i]);\n }\n } else {\n out.push(value);\n }\n return out;\n }\n\n if (isVNode(value)) {\n out.push(createDOM(value, parent, isSvgParent(parent)));\n return out;\n }\n\n out.push(document.createTextNode(String(value)));\n return out;\n}\n\nfunction sameNodeArray(a, b) {\n if (a.length !== b.length) return false;\n for (let i = 0; i < a.length; i++) {\n if (a[i] !== b[i]) return false;\n }\n return true;\n}\n\nfunction reconcileInsert(parent, value, current, marker) {\n // Guard: parent must be a node that supports child operations.\n // This catches cases where a stale DOM reference (e.g., a comment node from\n // shifted childNodes indices) is mistakenly passed as the parent.\n if (!parent || typeof parent.insertBefore !== 'function') {\n if (__DEV__) {\n console.warn('[what] reconcileInsert called with invalid parent:', parent);\n }\n return current;\n }\n\n const targetMarker = marker || null;\n\n if (value == null || typeof value === 'boolean') {\n const oldNodes = asNodeArray(current);\n for (let i = 0; i < oldNodes.length; i++) {\n const oldNode = oldNodes[i];\n if (oldNode.parentNode === parent) {\n disposeTree(oldNode);\n parent.removeChild(oldNode);\n }\n }\n return null;\n }\n\n if ((typeof value === 'string' || typeof value === 'number')\n && current && !Array.isArray(current) && current.nodeType === 3) {\n const text = String(value);\n if (current.data !== text) current.data = text;\n return current;\n }\n\n // Fast path: single DOM node value with single current node \u2014 skip array allocations\n if (typeof value === 'object' && value !== null && value.nodeType > 0 && !Array.isArray(value)) {\n if (value === current) return current;\n if (current && !Array.isArray(current) && current.nodeType > 0) {\n // Replace single node with single node\n if (current.parentNode === parent) {\n disposeTree(current);\n parent.replaceChild(value, current);\n } else {\n if (targetMarker) parent.insertBefore(value, targetMarker);\n else parent.appendChild(value);\n }\n return value;\n }\n }\n\n const newNodes = valuesToNodes(value, parent, []);\n const oldNodes = asNodeArray(current);\n\n if (sameNodeArray(oldNodes, newNodes)) {\n return current;\n }\n\n // Remove old nodes not in the new set. For small arrays (typical case),\n // linear scan is faster than Set allocation + hashing.\n const newLen = newNodes.length;\n for (let i = 0; i < oldNodes.length; i++) {\n const oldNode = oldNodes[i];\n if (oldNode.parentNode !== parent) continue;\n let found = false;\n for (let j = 0; j < newLen; j++) {\n if (newNodes[j] === oldNode) { found = true; break; }\n }\n if (!found) {\n disposeTree(oldNode);\n parent.removeChild(oldNode);\n }\n }\n\n let ref = targetMarker;\n for (let i = newNodes.length - 1; i >= 0; i--) {\n const node = newNodes[i];\n if (node.parentNode !== parent || node.nextSibling !== ref) {\n // Guard against stale ref from nested reconciliation\n if (ref && ref.parentNode !== parent) ref = null;\n if (ref) parent.insertBefore(node, ref);\n else parent.appendChild(node);\n }\n ref = node;\n }\n\n if (newNodes.length === 0) return null;\n return newNodes.length === 1 ? newNodes[0] : newNodes;\n}\n\n// --- mapArray(source, mapFn, options?) ---\n// Reactive list rendering with per-item scopes.\n// Unkeyed: tracks items by reference. Keyed: tracks by key function.\n// With key + raw: mapFn receives (item, index) \u2014 raw item value. Items identified by key for\n// efficient DOM reuse/moves. Use when items have per-field signals (no wrapper needed).\n// With key (no raw): mapFn receives (itemAccessor, index) \u2014 accessor is a signal getter.\n// When item reference changes but key persists, the signal updates in place.\n// Without key: mapFn receives (item, index) \u2014 raw item value. New reference = new row.\n\nexport function mapArray(source, mapFn, options) {\n const keyFn = options?.key;\n const raw = options?.raw || false;\n\n const inserter = (parent, marker) => {\n let items = [];\n let mappedNodes = [];\n let disposeFns = [];\n // Keyed mode state: key \u2192 { itemSignal }. Null for raw/unkeyed modes.\n let keyedState = keyFn && !raw ? new Map() : null;\n\n const endMarker = document.createComment('/list');\n parent.insertBefore(endMarker, marker || null);\n\n effect(() => {\n const newItems = source() || [];\n if (keyFn) {\n reconcileKeyed(parent, endMarker, items, newItems, mappedNodes, disposeFns, mapFn, keyFn, keyedState);\n } else {\n reconcileList(parent, endMarker, items, newItems, mappedNodes, disposeFns, mapFn);\n }\n // Save a snapshot of items for next diff. Use slice() to defend against\n // in-place mutation, but skip for empty arrays (common clear case).\n items = newItems.length > 0 ? newItems.slice() : newItems;\n });\n\n return endMarker;\n };\n inserter._mapArray = true;\n return inserter;\n}\n\nfunction reconcileList(parent, endMarker, oldItems, newItems, mappedNodes, disposeFns, mapFn) {\n const newLen = newItems.length;\n const oldLen = oldItems.length;\n\n if (newLen === 0) {\n // Fast path: clear all \u2014 dispose reactive scopes first (handles effects/cleanups),\n // then remove DOM nodes. createRoot disposal handles all tracked effects; we only\n // need disposeTree for nodes with additional reactive bindings outside createRoot.\n if (oldLen > 0) {\n for (let i = 0; i < oldLen; i++) {\n if (disposeFns[i]) disposeFns[i]();\n }\n for (let i = oldLen - 1; i >= 0; i--) {\n const node = mappedNodes[i];\n if (node) {\n // disposeTree walks the subtree for nested component contexts\n // (c:start comments) and reactive bindings that the item-scope\n // dispose above does not cover. (AUDIT C5)\n disposeTree(node);\n if (node.parentNode === parent) parent.removeChild(node);\n }\n }\n mappedNodes.length = 0;\n disposeFns.length = 0;\n }\n return;\n }\n\n if (oldLen === 0) {\n // Fast path: all new\n const frag = document.createDocumentFragment();\n for (let i = 0; i < newLen; i++) {\n const item = newItems[i];\n const node = _createItemScope(dispose => {\n disposeFns[i] = dispose;\n return mapFn(item, i);\n });\n mappedNodes[i] = node;\n frag.appendChild(node);\n }\n parent.insertBefore(frag, endMarker);\n return;\n }\n\n // --- Common prefix/suffix skip ---\n let start = 0;\n const minLen = Math.min(oldLen, newLen);\n while (start < minLen && oldItems[start] === newItems[start]) start++;\n\n // If everything matches and same length, nothing changed\n if (start === oldLen && start === newLen) return;\n\n let oldEnd = oldLen - 1;\n let newEnd = newLen - 1;\n while (oldEnd >= start && newEnd >= start && oldItems[oldEnd] === newItems[newEnd]) {\n oldEnd--;\n newEnd--;\n }\n\n // Copy prefix/suffix into output arrays\n const newMapped = new Array(newLen);\n const newDispose = new Array(newLen);\n for (let i = 0; i < start; i++) {\n newMapped[i] = mappedNodes[i];\n newDispose[i] = disposeFns[i];\n }\n for (let i = newEnd + 1; i < newLen; i++) {\n // Suffix items: same item, possibly different index offset\n const oldI = oldEnd + 1 + (i - newEnd - 1);\n newMapped[i] = mappedNodes[oldI];\n newDispose[i] = disposeFns[oldI];\n }\n\n // Only reconcile the middle section: start..newEnd (new) vs start..oldEnd (old)\n const midNewLen = newEnd - start + 1;\n const midOldLen = oldEnd - start + 1;\n\n if (midNewLen === 0) {\n // Only removals in the middle\n for (let i = start; i <= oldEnd; i++) {\n disposeFns[i]?.();\n if (mappedNodes[i]) disposeTree(mappedNodes[i]); // dispose nested component ctx (AUDIT C5)\n if (mappedNodes[i]?.parentNode) mappedNodes[i].parentNode.removeChild(mappedNodes[i]);\n }\n } else if (midOldLen === 0) {\n // Only insertions in the middle\n const marker = start < newLen && newMapped[newEnd + 1] ? newMapped[newEnd + 1] : endMarker;\n const frag = document.createDocumentFragment();\n for (let i = start; i <= newEnd; i++) {\n const item = newItems[i];\n const idx = i;\n newMapped[i] = _createItemScope(dispose => {\n newDispose[idx] = dispose;\n return mapFn(item, idx);\n });\n frag.appendChild(newMapped[i]);\n }\n parent.insertBefore(frag, marker);\n } else {\n // General case: reconcile middle section with LIS\n _reconcileMiddle(parent, endMarker, oldItems, newItems, mappedNodes, disposeFns,\n mapFn, start, oldEnd, newEnd, newMapped, newDispose);\n }\n\n // Update arrays in place\n mappedNodes.length = newLen;\n disposeFns.length = newLen;\n for (let i = 0; i < newLen; i++) {\n mappedNodes[i] = newMapped[i];\n disposeFns[i] = newDispose[i];\n }\n}\n\nfunction _reconcileMiddle(parent, endMarker, oldItems, newItems, mappedNodes, disposeFns,\n mapFn, start, oldEnd, newEnd, newMapped, newDispose) {\n // Build index map only for the middle section\n const oldIdxMap = new Map();\n for (let i = start; i <= oldEnd; i++) {\n oldIdxMap.set(oldItems[i], i);\n }\n\n // Match old items to new positions, collect old indices for LIS\n const midLen = newEnd - start + 1;\n const oldIndices = new Int32Array(midLen); // -1 = new item\n oldIndices.fill(-1);\n\n for (let i = start; i <= newEnd; i++) {\n const oldIdx = oldIdxMap.get(newItems[i]);\n if (oldIdx !== undefined) {\n oldIdxMap.delete(newItems[i]);\n newMapped[i] = mappedNodes[oldIdx];\n newDispose[i] = disposeFns[oldIdx];\n oldIndices[i - start] = oldIdx;\n }\n }\n\n // Dispose removed items\n for (const [, oldIdx] of oldIdxMap) {\n disposeFns[oldIdx]?.();\n if (mappedNodes[oldIdx]) disposeTree(mappedNodes[oldIdx]); // dispose nested component ctx (AUDIT C5)\n if (mappedNodes[oldIdx]?.parentNode) mappedNodes[oldIdx].parentNode.removeChild(mappedNodes[oldIdx]);\n }\n\n // Compute LIS on old indices of reused items\n // Build the sequence of old indices for reused items only\n const reusedCount = midLen - _countNeg1(oldIndices, midLen);\n\n // Use a bitfield (via Uint8Array) to mark LIS positions \u2014 avoids Set overhead\n const inLIS = new Uint8Array(midLen);\n\n if (reusedCount > 1) {\n const seq = new Int32Array(reusedCount);\n const seqToMid = new Int32Array(reusedCount); // maps seq index \u2192 mid index\n let k = 0;\n for (let i = 0; i < midLen; i++) {\n if (oldIndices[i] !== -1) {\n seq[k] = oldIndices[i];\n seqToMid[k] = i;\n k++;\n }\n }\n const lisResult = _lis(seq, reusedCount);\n for (let i = 0; i < lisResult.length; i++) {\n inLIS[seqToMid[lisResult[i]]] = 1;\n }\n } else if (reusedCount === 1) {\n // Single reused item is trivially in LIS\n for (let i = 0; i < midLen; i++) {\n if (oldIndices[i] !== -1) { inLIS[i] = 1; break; }\n }\n }\n\n // Create new items\n for (let i = start; i <= newEnd; i++) {\n if (!newMapped[i]) {\n const item = newItems[i];\n const idx = i;\n newMapped[i] = _createItemScope(dispose => {\n newDispose[idx] = dispose;\n return mapFn(item, idx);\n });\n }\n }\n\n // Position: work backwards from the item after newEnd (suffix start or endMarker)\n let nextSibling = newEnd + 1 < newMapped.length && newMapped[newEnd + 1]\n ? newMapped[newEnd + 1] : endMarker;\n\n for (let i = newEnd; i >= start; i--) {\n const mi = i - start;\n if (oldIndices[mi] === -1 || !inLIS[mi]) {\n // New item or moved item \u2014 insert\n // Guard against stale nextSibling from nested reconciliation\n if (nextSibling && nextSibling.parentNode !== parent) nextSibling = endMarker;\n parent.insertBefore(newMapped[i], nextSibling);\n }\n nextSibling = newMapped[i];\n }\n}\n\nfunction _countNeg1(arr, len) {\n let c = 0;\n for (let i = 0; i < len; i++) if (arr[i] === -1) c++;\n return c;\n}\n\n// Longest Increasing Subsequence \u2014 returns indices into the input array.\n// O(n log n) using patience sorting. Uses typed arrays for performance.\nfunction _lis(arr, len) {\n if (len === 0) return [];\n if (len === 1) return [0];\n\n const tails = new Int32Array(len); // indices into arr\n const predecessors = new Int32Array(len);\n let tailLen = 1;\n tails[0] = 0;\n predecessors[0] = -1;\n\n for (let i = 1; i < len; i++) {\n if (arr[i] > arr[tails[tailLen - 1]]) {\n predecessors[i] = tails[tailLen - 1];\n tails[tailLen++] = i;\n } else {\n let lo = 0, hi = tailLen - 1;\n while (lo < hi) {\n const mid = (lo + hi) >> 1;\n if (arr[tails[mid]] < arr[i]) lo = mid + 1;\n else hi = mid;\n }\n tails[lo] = i;\n predecessors[i] = lo > 0 ? tails[lo - 1] : -1;\n }\n }\n\n const result = new Array(tailLen);\n let k = tails[tailLen - 1];\n for (let i = tailLen - 1; i >= 0; i--) {\n result[i] = k;\n k = predecessors[k];\n }\n return result;\n}\n\n// --- reconcileKeyed ---\n// Keyed reconciliation: tracks items by key function, not by reference.\n// When a key persists but its item reference changes, the item signal updates\n// in place \u2014 no DOM node destruction/creation. Only effects reading the\n// item accessor re-run (e.g., textContent update for changed label).\n//\n// Multi-node items: Components return DocumentFragments (c:start, content, c:end).\n// We track each item via a start-marker comment. Moving/removing an item moves\n// all nodes from its marker up to (but not including) the next item's marker.\n\nfunction _createItemMarker() {\n return document.createComment('i');\n}\n\n// Collect all DOM nodes belonging to one item (from its marker to beforeEnd).\nfunction _collectItemNodes(marker, beforeEnd) {\n const nodes = [];\n let n = marker;\n while (n && n !== beforeEnd) {\n nodes.push(n);\n n = n.nextSibling;\n }\n return nodes;\n}\n\n// Move all nodes for an item (starting at marker) before `ref` in `parent`.\nfunction _moveItem(parent, marker, beforeEnd, ref) {\n let n = marker;\n while (n && n !== beforeEnd) {\n const next = n.nextSibling;\n parent.insertBefore(n, ref);\n n = next;\n }\n}\n\n// Remove all nodes for an item from the DOM.\nfunction _removeItemNodes(parent, marker, beforeEnd) {\n let n = marker;\n while (n && n !== beforeEnd) {\n const next = n.nextSibling;\n // Always disposeTree: a component's context lives on its `c:start` comment\n // (nodeType 8, via _commentCtxMap) which carries none of the gate flags\n // below, so the old `_componentCtx || _dispose || _propEffects` guard\n // leaked every component's effects/cleanups/onCleanup/listeners on removal.\n // disposeTree is internally cheap-guarded and idempotent. (AUDIT C5)\n disposeTree(n);\n parent.removeChild(n);\n n = next;\n }\n}\n\n// Create a new item: wraps mapFn result in a marker + appends to target.\nfunction _createKeyedItem(target, item, idx, keyFn, keyedState, mapFn, mappedArr, disposeArr, signal_) {\n let accessor;\n if (keyedState) {\n const key = keyFn(item);\n const itemSig = signal_(item);\n accessor = itemSig;\n keyedState.set(key, { itemSig });\n } else {\n accessor = item;\n }\n const marker = _createItemMarker();\n target.appendChild(marker);\n const result = _createItemScope(dispose => {\n disposeArr[idx] = dispose;\n return mapFn(accessor, idx);\n });\n // result may be a DocumentFragment or a single node\n target.appendChild(result);\n mappedArr[idx] = marker;\n}\n\nfunction reconcileKeyed(parent, endMarker, oldItems, newItems, mappedNodes, disposeFns, mapFn, keyFn, keyedState) {\n const newLen = newItems.length;\n const oldLen = oldItems.length;\n\n // --- Fast path: clear all ---\n if (newLen === 0) {\n if (oldLen > 0) {\n for (let i = 0; i < oldLen; i++) {\n if (disposeFns[i]) disposeFns[i]();\n }\n // Remove all nodes between first item marker and endMarker\n if (mappedNodes[0]) {\n _removeItemNodes(parent, mappedNodes[0], endMarker);\n }\n mappedNodes.length = 0;\n disposeFns.length = 0;\n if (keyedState) keyedState.clear();\n }\n return;\n }\n\n // --- Fast path: all new ---\n if (oldLen === 0) {\n const frag = document.createDocumentFragment();\n for (let i = 0; i < newLen; i++) {\n _createKeyedItem(frag, newItems[i], i, keyFn, keyedState, mapFn, mappedNodes, disposeFns, signal);\n }\n parent.insertBefore(frag, endMarker);\n return;\n }\n\n // --- Common prefix: skip matching keys at the start ---\n let start = 0;\n const minLen = Math.min(oldLen, newLen);\n while (start < minLen) {\n if (oldItems[start] === newItems[start]) { start++; continue; }\n const oldKey = keyFn(oldItems[start]);\n const newKey = keyFn(newItems[start]);\n if (oldKey !== newKey) break;\n if (keyedState) keyedState.get(oldKey).itemSig.set(newItems[start]);\n start++;\n }\n\n // --- Common suffix: skip matching keys at the end ---\n let oldEnd = oldLen - 1;\n let newEnd = newLen - 1;\n while (oldEnd >= start && newEnd >= start) {\n if (oldItems[oldEnd] === newItems[newEnd]) { oldEnd--; newEnd--; continue; }\n const oldKey = keyFn(oldItems[oldEnd]);\n const newKey = keyFn(newItems[newEnd]);\n if (oldKey !== newKey) break;\n if (keyedState) keyedState.get(oldKey).itemSig.set(newItems[newEnd]);\n oldEnd--;\n newEnd--;\n }\n\n if (start > oldEnd && start > newEnd) return;\n\n const newMapped = new Array(newLen);\n const newDispose = new Array(newLen);\n for (let i = 0; i < start; i++) {\n newMapped[i] = mappedNodes[i];\n newDispose[i] = disposeFns[i];\n }\n for (let i = newEnd + 1; i < newLen; i++) {\n const oldI = oldEnd + 1 + (i - newEnd - 1);\n newMapped[i] = mappedNodes[oldI];\n newDispose[i] = disposeFns[oldI];\n }\n\n const midNewLen = newEnd - start + 1;\n const midOldLen = oldEnd - start + 1;\n\n // --- Only additions in middle ---\n if (midOldLen === 0) {\n const ref = newEnd + 1 < newLen && newMapped[newEnd + 1] ? newMapped[newEnd + 1] : endMarker;\n const frag = document.createDocumentFragment();\n for (let i = start; i <= newEnd; i++) {\n _createKeyedItem(frag, newItems[i], i, keyFn, keyedState, mapFn, newMapped, newDispose, signal);\n }\n parent.insertBefore(frag, ref);\n _copyBack(mappedNodes, disposeFns, newMapped, newDispose, newLen);\n return;\n }\n\n // --- Only removals in middle ---\n if (midNewLen === 0) {\n for (let i = start; i <= oldEnd; i++) {\n disposeFns[i]?.();\n // Compute the range boundary from the live DOM. Sibling markers in\n // mappedNodes may have been detached by earlier iterations of this loop;\n // walking the DOM finds the next surviving item marker (or endMarker).\n const rangeEnd = _findNextMarkerAfter(parent, mappedNodes[i], mappedNodes, i, endMarker);\n _removeItemNodes(parent, mappedNodes[i], rangeEnd);\n if (keyedState) keyedState.delete(keyFn(oldItems[i]));\n }\n _copyBack(mappedNodes, disposeFns, newMapped, newDispose, newLen);\n return;\n }\n\n // --- Fast paths for common small-move cases ---\n // Detect swap (2 mismatches) or single-move (contiguous shift) cheaply\n // before falling through to the expensive LIS + backward-walk general case.\n\n if (midNewLen === midOldLen && midNewLen >= 2 && midNewLen <= Math.max(midOldLen, 200)) {\n // Count positions where keys differ\n let mismatchCount = 0;\n let mm1 = -1, mm2 = -1; // first two mismatch indices (relative to start)\n for (let i = 0; i < midNewLen && mismatchCount <= 4; i++) {\n const oldKey = keyFn(oldItems[start + i]);\n const newKey = keyFn(newItems[start + i]);\n if (oldKey !== newKey) {\n if (mismatchCount === 0) mm1 = i;\n else if (mismatchCount === 1) mm2 = i;\n mismatchCount++;\n }\n }\n\n // --- Fast path A: Pure swap (exactly 2 key mismatches, keys exchanged) ---\n if (mismatchCount === 2) {\n const i1 = start + mm1, i2 = start + mm2;\n const oldKey1 = keyFn(oldItems[i1]), oldKey2 = keyFn(oldItems[i2]);\n const newKey1 = keyFn(newItems[i1]), newKey2 = keyFn(newItems[i2]);\n\n if (oldKey1 === newKey2 && oldKey2 === newKey1) {\n // Confirmed swap. Move item at i2's DOM position before item at i1's position,\n // then move i1's nodes to where i2 was.\n for (let i = 0; i < start; i++) {\n newMapped[i] = mappedNodes[i];\n newDispose[i] = disposeFns[i];\n }\n for (let i = start; i <= newEnd; i++) {\n newMapped[i] = mappedNodes[i];\n newDispose[i] = disposeFns[i];\n }\n for (let i = newEnd + 1; i < newLen; i++) {\n const oldI = oldEnd + 1 + (i - newEnd - 1);\n newMapped[i] = mappedNodes[oldI];\n newDispose[i] = disposeFns[oldI];\n }\n\n // Swap mapped entries\n const tmpM = newMapped[i1]; newMapped[i1] = newMapped[i2]; newMapped[i2] = tmpM;\n const tmpD = newDispose[i1]; newDispose[i1] = newDispose[i2]; newDispose[i2] = tmpD;\n\n // Update keyed state signals if item references differ\n if (keyedState) {\n if (newItems[i1] !== oldItems[i1]) {\n const k = keyFn(newItems[i1]);\n const entry = keyedState.get(k);\n if (entry) entry.itemSig.set(newItems[i1]);\n }\n if (newItems[i2] !== oldItems[i2]) {\n const k = keyFn(newItems[i2]);\n const entry = keyedState.get(k);\n if (entry) entry.itemSig.set(newItems[i2]);\n }\n }\n\n // DOM moves: swap the two items' DOM ranges.\n // Adjacent swaps need special handling because moving item2 before\n // item1 invalidates the pre-computed end boundary for item1 (it was\n // item2's marker, which has now moved). For adjacent items, a single\n // _moveItem suffices. For non-adjacent items, we recompute end1 after\n // the first move.\n const isAdjacent = (i2 === i1 + 1) || (i1 === i2 + 1);\n const lo = Math.min(i1, i2), hi = Math.max(i1, i2);\n\n if (isAdjacent) {\n // Adjacent: just move the later item's nodes before the earlier item's marker.\n const endHi = _findNextMarkerAfter(parent, mappedNodes[hi], mappedNodes, hi, endMarker);\n _moveItem(parent, mappedNodes[hi], endHi, mappedNodes[lo]);\n } else {\n // Non-adjacent: use a placeholder to remember i2's position, then\n // recompute end1 after the first move (since DOM has changed).\n const end2 = _findNextMarkerAfter(parent, mappedNodes[i2], mappedNodes, i2, endMarker);\n\n const placeholder = document.createComment('tmp');\n parent.insertBefore(placeholder, mappedNodes[i2]);\n\n // Move i2's nodes to before i1's current position\n _moveItem(parent, mappedNodes[i2], end2, mappedNodes[i1]);\n // Recompute end1 \u2014 the DOM has changed, so the pre-move boundary is stale\n const end1 = _findNextMarkerAfter(parent, mappedNodes[i1], mappedNodes, i1, endMarker);\n // Move i1's nodes to where i2 was (before placeholder)\n _moveItem(parent, mappedNodes[i1], end1, placeholder);\n parent.removeChild(placeholder);\n }\n\n _copyBack(mappedNodes, disposeFns, newMapped, newDispose, newLen);\n return;\n }\n }\n\n // --- Fast path B: Single item relocated ---\n // One item removed from position `from` and inserted at position `to`,\n // everything between shifted by one.\n if (mismatchCount >= 2 && mismatchCount <= midNewLen) {\n // Try to detect single-move pattern:\n // If we remove element at `from` in old and insert at `to` in new,\n // the rest should match.\n // Forward move: old[from] = new[to], old[from+1..to] = new[from..to-1]\n // Backward move: old[from] = new[to], old[to..from-1] = new[to+1..from]\n\n const fromRel = mm1; // first mismatch - the moved item was here in old OR went here in new\n let movedKey = null;\n let fromAbs = -1, toAbs = -1;\n let isMove = false;\n\n // Check forward move: item at old[start+fromRel] moved later\n const candidateKey = keyFn(oldItems[start + fromRel]);\n // Find where this key ended up in new\n let destRel = -1;\n for (let i = fromRel; i < midNewLen; i++) {\n if (keyFn(newItems[start + i]) === candidateKey) { destRel = i; break; }\n }\n if (destRel > fromRel) {\n // Verify: old[fromRel+1..destRel] should match new[fromRel..destRel-1]\n let match = true;\n for (let i = fromRel; i < destRel; i++) {\n if (keyFn(oldItems[start + i + 1]) !== keyFn(newItems[start + i])) { match = false; break; }\n }\n if (match) {\n // And everything after destRel should be the same\n let afterMatch = true;\n for (let i = destRel + 1; i < midNewLen; i++) {\n if (keyFn(oldItems[start + i]) !== keyFn(newItems[start + i])) { afterMatch = false; break; }\n }\n if (afterMatch) {\n isMove = true;\n fromAbs = start + fromRel;\n toAbs = start + destRel;\n movedKey = candidateKey;\n }\n }\n }\n\n if (!isMove) {\n // Check backward move: item from later in old moved to start+fromRel in new\n const candidateKey2 = keyFn(newItems[start + fromRel]);\n let srcRel = -1;\n for (let i = fromRel; i < midOldLen; i++) {\n if (keyFn(oldItems[start + i]) === candidateKey2) { srcRel = i; break; }\n }\n if (srcRel > fromRel) {\n // Verify: old[fromRel..srcRel-1] should match new[fromRel+1..srcRel]\n let match = true;\n for (let i = fromRel; i < srcRel; i++) {\n if (keyFn(oldItems[start + i]) !== keyFn(newItems[start + i + 1])) { match = false; break; }\n }\n if (match) {\n let afterMatch = true;\n for (let i = srcRel + 1; i < midNewLen; i++) {\n if (keyFn(oldItems[start + i]) !== keyFn(newItems[start + i])) { afterMatch = false; break; }\n }\n if (afterMatch) {\n isMove = true;\n fromAbs = start + srcRel;\n toAbs = start + fromRel;\n movedKey = candidateKey2;\n }\n }\n }\n }\n\n if (isMove) {\n // Copy all mapped/dispose to new arrays\n for (let i = start; i <= oldEnd; i++) {\n newMapped[i] = mappedNodes[i];\n newDispose[i] = disposeFns[i];\n }\n\n // Shift entries in newMapped/newDispose to reflect the move\n const movedMarker = newMapped[fromAbs];\n const movedDispose = newDispose[fromAbs];\n\n if (fromAbs < toAbs) {\n // Forward move: shift [from+1..to] left by 1\n for (let i = fromAbs; i < toAbs; i++) {\n newMapped[i] = newMapped[i + 1];\n newDispose[i] = newDispose[i + 1];\n }\n } else {\n // Backward move: shift [to..from-1] right by 1\n for (let i = fromAbs; i > toAbs; i--) {\n newMapped[i] = newMapped[i - 1];\n newDispose[i] = newDispose[i - 1];\n }\n }\n newMapped[toAbs] = movedMarker;\n newDispose[toAbs] = movedDispose;\n\n // Update keyed state signals for items whose references changed\n if (keyedState) {\n for (let i = start; i <= newEnd; i++) {\n const key = keyFn(newItems[i]);\n if (newItems[i] !== oldItems[i]) {\n // Only look up oldItems[i] by key if index is in old range\n const entry = keyedState.get(key);\n if (entry) entry.itemSig.set(newItems[i]);\n }\n }\n }\n\n // Single DOM move: move the item's nodes to its new position\n const movedEnd = _findNextMarkerAfter(parent, movedMarker, mappedNodes, fromAbs, endMarker);\n // Find the reference node: the marker of the item that should come AFTER the moved item\n let ref;\n if (toAbs + 1 < newLen) {\n ref = newMapped[toAbs + 1];\n } else {\n ref = endMarker;\n }\n // For suffix items, use the actual mapped marker\n if (toAbs >= newEnd + 1 || (ref && ref.parentNode !== parent)) {\n ref = endMarker;\n }\n _moveItem(parent, movedMarker, movedEnd, ref);\n\n _copyBack(mappedNodes, disposeFns, newMapped, newDispose, newLen);\n return;\n }\n }\n }\n\n // --- General case: reconcile middle section ---\n const oldKeyMap = new Map();\n for (let i = start; i <= oldEnd; i++) {\n oldKeyMap.set(keyFn(oldItems[i]), i);\n }\n\n const oldIndices = new Int32Array(midNewLen);\n oldIndices.fill(-1);\n\n for (let i = start; i <= newEnd; i++) {\n const key = keyFn(newItems[i]);\n const oldIdx = oldKeyMap.get(key);\n if (oldIdx !== undefined) {\n oldKeyMap.delete(key);\n newMapped[i] = mappedNodes[oldIdx];\n newDispose[i] = disposeFns[oldIdx];\n oldIndices[i - start] = oldIdx;\n if (keyedState && newItems[i] !== oldItems[oldIdx]) {\n keyedState.get(key).itemSig.set(newItems[i]);\n }\n }\n }\n\n // Dispose removed items (iterate in reverse to avoid shifting boundaries)\n const removedIndices = [...oldKeyMap.values()].sort((a, b) => b - a);\n for (const oldIdx of removedIndices) {\n disposeFns[oldIdx]?.();\n // Compute the range boundary from the live DOM. Adjacent removals can\n // detach mappedNodes[oldIdx + 1] before we get here, so we cannot trust\n // that reference \u2014 walk the DOM to find the next surviving item marker.\n const rangeEnd = _findNextMarkerAfter(parent, mappedNodes[oldIdx], mappedNodes, oldIdx, endMarker);\n _removeItemNodes(parent, mappedNodes[oldIdx], rangeEnd);\n if (keyedState) keyedState.delete(keyFn(oldItems[oldIdx]));\n }\n\n // Create new items (into a detached fragment, then positioned below)\n for (let i = start; i <= newEnd; i++) {\n if (!newMapped[i]) {\n const frag = document.createDocumentFragment();\n _createKeyedItem(frag, newItems[i], i, keyFn, keyedState, mapFn, newMapped, newDispose, signal);\n // Leave in frag for now \u2014 will be positioned in the move pass\n newMapped[i]._frag = frag;\n }\n }\n\n // Position using LIS\n let reusedCount = 0;\n let alreadySorted = true;\n let lastOldIdx = -1;\n for (let i = 0; i < midNewLen; i++) {\n if (oldIndices[i] !== -1) {\n reusedCount++;\n if (oldIndices[i] <= lastOldIdx) alreadySorted = false;\n lastOldIdx = oldIndices[i];\n }\n }\n\n const inLIS = new Uint8Array(midNewLen);\n\n if (alreadySorted) {\n for (let i = 0; i < midNewLen; i++) {\n if (oldIndices[i] !== -1) inLIS[i] = 1;\n }\n } else if (reusedCount > 1) {\n const seq = new Int32Array(reusedCount);\n const seqToMid = new Int32Array(reusedCount);\n let k = 0;\n for (let i = 0; i < midNewLen; i++) {\n if (oldIndices[i] !== -1) {\n seq[k] = oldIndices[i];\n seqToMid[k] = i;\n k++;\n }\n }\n const lisResult = _lis(seq, reusedCount);\n for (let i = 0; i < lisResult.length; i++) {\n inLIS[seqToMid[lisResult[i]]] = 1;\n }\n } else if (reusedCount === 1) {\n for (let i = 0; i < midNewLen; i++) {\n if (oldIndices[i] !== -1) { inLIS[i] = 1; break; }\n }\n }\n\n // Position: work backwards, move items not in LIS\n // For existing items: move all nodes from marker to next-item boundary.\n // For new items: insert from their detached fragment.\n // We rebuild the output array to reflect final positions.\n _copyBack(mappedNodes, disposeFns, newMapped, newDispose, newLen);\n\n // Start ref at the first suffix item's marker (not endMarker) so moved items\n // land before the suffix, not after it.\n let ref = newEnd + 1 < newLen && mappedNodes[newEnd + 1]\n ? mappedNodes[newEnd + 1] : endMarker;\n for (let i = newEnd; i >= start; i--) {\n const mi = i - start;\n const marker = mappedNodes[i];\n\n if (oldIndices[mi] === -1) {\n // New item \u2014 insert from detached fragment\n if (marker._frag) {\n parent.insertBefore(marker._frag, ref);\n delete marker._frag;\n }\n } else if (!inLIS[mi]) {\n // Existing item not in LIS \u2014 move all its nodes\n const nextItemMarker = _findNextMarkerAfter(parent, marker, mappedNodes, i, endMarker);\n _moveItem(parent, marker, nextItemMarker, ref);\n }\n ref = marker;\n }\n}\n\n// TODO(perf): cache item end boundary on marker if large keyed reorders show O(n\u00B2) hot paths.\n// Find the boundary end for an item's nodes in the current DOM.\n// Walks from the marker's nextSibling until we hit another item's marker or endMarker.\nfunction _findNextMarkerAfter(parent, marker, mappedNodes, idx, endMarker) {\n // The item's nodes end at the next sibling that is either:\n // - another item's marker comment (data === 'i')\n // - the list endMarker (data === '/list')\n let n = marker.nextSibling;\n while (n && n !== endMarker) {\n if (n.nodeType === 8 && n.data === 'i') return n;\n n = n.nextSibling;\n }\n return endMarker;\n}\n\nfunction _copyBack(mappedNodes, disposeFns, newMapped, newDispose, newLen) {\n mappedNodes.length = newLen;\n disposeFns.length = newLen;\n for (let i = 0; i < newLen; i++) {\n mappedNodes[i] = newMapped[i];\n disposeFns[i] = newDispose[i];\n }\n}\n\n// --- spread(el, props) ---\n// Fine-grained prop effects. Function props create individual effects.\n// Event props use direct assignment.\n\nexport function spread(el, props) {\n for (const key in props) {\n const value = props[key];\n\n if (key.startsWith('on') && key.length > 2) {\n // Event handler \u2014 direct assignment. Use $$name for delegated events.\n const event = key.slice(2).toLowerCase();\n el.addEventListener(event, value);\n continue;\n }\n\n if (typeof value === 'function' && !key.startsWith('on')) {\n // Reactive prop \u2014 create micro-effect. The disposer must be registered\n // on el._propEffects so disposeTree() (dom.js) tears it down when the\n // element unmounts; otherwise the effect keeps firing on signal writes\n // for a detached element. Mirror the setProp() pattern.\n if (!el._propEffects) el._propEffects = {};\n // If a previous spread/setProp already registered an effect for this\n // key, dispose it first to avoid double-tracking.\n if (el._propEffects[key]) {\n try { el._propEffects[key](); } catch (e) { /* already disposed */ }\n }\n if (key === 'class' || key === 'className') {\n el._propEffects[key] = effect(() => {\n const cls = value() || '';\n if (_hasSVGElement && el instanceof SVGElement) el.setAttribute('class', cls);\n else el.className = cls;\n });\n } else if (key === 'style' && typeof value() === 'object') {\n el._propEffects[key] = effect(() => {\n const styles = value();\n for (const prop in styles) {\n el.style[prop] = styles[prop] ?? '';\n }\n });\n } else {\n el._propEffects[key] = effect(() => { setProp(el, key, value()); });\n }\n } else {\n // Static prop\n setProp(el, key, value);\n }\n }\n}\n\n// NOTE: this is the fine-grained-compiler path's setProp. A second\n// implementation lives in dom.js (h()/diff path). See the longer note above\n// the dom.js version. Key differences vs. dom.js setProp:\n// - assumes events are handled by the compiler (delegation or direct\n// addEventListener) \u2014 no el._events bookkeeping here.\n// - sanitizes URL attributes (href/src) against javascript: protocol.\n// - enforces innerHTML must be { __html: ... } \u2014 plain strings are warned.\n// Both share the el._propEffects[key] disposer convention so disposeTree()\n// can tear down reactive prop effects on unmount.\nexport function setProp(el, key, value) {\n // Ref handling \u2014 assign element to ref object/callback (defense in depth)\n if (key === 'ref') {\n if (typeof value === 'function') value(el);\n else if (value && typeof value === 'object') value.current = el;\n return;\n }\n\n // Key prop \u2014 no-op, WhatFW has no virtual DOM (defense in depth, issue #6)\n if (key === 'key') return;\n\n // Reactive accessor: function values on non-event props are treated as\n // reactive getters. Wrap in an effect so the prop auto-updates. Track the\n // disposer on el._propEffects so disposeTree() tears it down on unmount \u2014\n // mirrors the pattern in dom.js setProp / spread().\n if (typeof value === 'function' && !key.startsWith('on')) {\n if (!el._propEffects) el._propEffects = {};\n if (el._propEffects[key]) {\n try { el._propEffects[key](); } catch (e) { /* already disposed */ }\n }\n el._propEffects[key] = effect(() => setProp(el, key, value()));\n return;\n }\n\n // Sanitize URL attributes \u2014 reject dangerous protocols\n if (URL_ATTRS.has(key) || URL_ATTRS.has(key.toLowerCase())) {\n if (!isSafeUrl(value)) {\n if (typeof console !== 'undefined') {\n console.warn(`[what] Blocked unsafe URL in \"${key}\" attribute: ${value}`);\n }\n return;\n }\n }\n\n const isSvg = _hasSVGElement && el instanceof SVGElement;\n\n if (key === 'class' || key === 'className') {\n if (isSvg) {\n el.setAttribute('class', value || '');\n } else {\n el.className = value || '';\n }\n } else if (key === 'dangerouslySetInnerHTML') {\n const html = value?.__html ?? '';\n if (typeof __DEV__ !== 'undefined' && __DEV__ && typeof html === 'string' && /(<script|onerror\\s*=|onload\\s*=|javascript:)/i.test(html)) {\n console.warn('[what] dangerouslySetInnerHTML contains potential XSS vectors. Ensure content is sanitized.');\n }\n el.innerHTML = html;\n } else if (key === 'innerHTML') {\n if (value && typeof value === 'object' && '__html' in value) {\n const html = value.__html ?? '';\n if (typeof __DEV__ !== 'undefined' && __DEV__ && typeof html === 'string' && /(<script|onerror\\s*=|onload\\s*=|javascript:)/i.test(html)) {\n console.warn('[what] dangerouslySetInnerHTML contains potential XSS vectors. Ensure content is sanitized.');\n }\n el.innerHTML = html;\n } else {\n if (typeof console !== 'undefined' && value != null && value !== '') {\n console.warn(\n '[what] Plain string innerHTML is not allowed. Use { __html: \"...\" } or dangerouslySetInnerHTML={{ __html: \"...\" }} instead.'\n );\n }\n }\n } else if (key === 'style') {\n if (typeof value === 'string') {\n el.style.cssText = value;\n } else if (typeof value === 'object') {\n for (const prop in value) {\n el.style[prop] = value[prop] ?? '';\n }\n }\n } else if (key.startsWith('data-') || key.startsWith('aria-')) {\n el.setAttribute(key, value);\n } else if (typeof value === 'boolean') {\n if (value) el.setAttribute(key, '');\n else el.removeAttribute(key);\n } else if (isSvg) {\n el.setAttribute(key, value);\n } else if (key === 'value' && el.tagName === 'SELECT') {\n _setSelectValue(el, value);\n } else if (key in el) {\n el[key] = value;\n } else {\n el.setAttribute(key, value);\n }\n}\n\n// --- Specialized attribute setters (SPRINT v0.11 C2) ---\n// The compiler statically knows most attribute names, so it emits direct calls\n// to these monomorphic helpers instead of routing everything through the\n// generic setProp() dispatcher (which re-checks ref/key/url/class/style/...\n// string-compares on every reactive update). setProp() remains the target for\n// spreads, URL attributes (href/src/action \u2014 sanitization lives there) and any\n// name the compiler can't classify.\n\n// class / className \u2014 hottest dynamic attribute in real apps.\nexport function setClass(el, value) {\n if (_hasSVGElement && el instanceof SVGElement) {\n el.setAttribute('class', value || '');\n } else {\n el.className = value || '';\n }\n}\n\n// style \u2014 string (cssText) or object form.\nexport function setStyle(el, value) {\n if (typeof value === 'string') {\n el.style.cssText = value;\n } else if (value && typeof value === 'object') {\n const style = el.style;\n for (const prop in value) {\n style[prop] = value[prop] ?? '';\n }\n } else if (value == null) {\n el.style.cssText = '';\n }\n}\n\n// Plain attribute set \u2014 used for data-*/aria-* (statically recognizable).\n// null/undefined removes the attribute (previously setProp stringified them\n// to \"null\"/\"undefined\" \u2014 removal is the correct semantic). Booleans are\n// stringified (\"true\"/\"false\") because aria-* boolean strings are meaningful.\nexport function setAttr(el, name, value) {\n if (value == null) el.removeAttribute(name);\n else el.setAttribute(name, value);\n}\n\n// value \u2014 controlled-input property set. <select> keeps multi/deferred-option\n// handling; other elements get a guarded property write (the !== guard avoids\n// resetting the caret position in focused inputs on unrelated re-runs).\nexport function setValue(el, value) {\n if (el.tagName === 'SELECT') {\n _setSelectValue(el, value);\n return;\n }\n const str = value == null ? '' : String(value);\n if (el.value !== str) el.value = str;\n}\n\n// --- delegateEvents(eventNames) ---\n// Event delegation: common events handled at document level.\n// Handlers stored as el.$$click, el.$$input, etc.\n// Single listener per event type on document \u2014 reduces listener count from N to 1.\n\nconst delegatedEvents = new Set();\n\nexport function delegateEvents(eventNames) {\n for (const name of eventNames) {\n if (delegatedEvents.has(name)) continue;\n delegatedEvents.add(name);\n\n document.addEventListener(name, (e) => {\n let node = e.target;\n const key = '$$' + name;\n\n // Shim e.currentTarget so handlers see the element the (virtual) listener\n // is attached to \u2014 not `document` \u2014 during the ancestor walk. Mirrors\n // Solid's delegation shim. configurable so nested dispatch can redefine.\n // (SPRINT v0.11 C9)\n Object.defineProperty(e, 'currentTarget', {\n configurable: true,\n get() { return node || document; },\n });\n\n // Walk up the DOM tree looking for handlers\n while (node) {\n const handler = node[key];\n if (handler) {\n handler(e);\n if (e.cancelBubble) return;\n }\n node = node.parentNode;\n }\n });\n }\n}\n\n// --- addEventListener helper for non-delegated events ---\nexport function on(el, event, handler) {\n el.addEventListener(event, handler);\n return () => el.removeEventListener(event, handler);\n}\n\n// --- className helper for conditional classes ---\nexport function classList(el, classes) {\n effect(() => {\n for (const name in classes) {\n const value = typeof classes[name] === 'function' ? classes[name]() : classes[name];\n el.classList.toggle(name, !!value);\n }\n });\n}\n\n// =========================================================================\n// DOM Hydration\n// =========================================================================\n// Reuses server-rendered DOM instead of creating new nodes.\n// After hydration is complete, switches to normal rendering for updates.\n\nlet _isHydrating = false;\nlet _hydrationCursor = null;\n\nexport function isHydrating() {\n return _isHydrating;\n}\n\n/**\n * hydrate(vnode, container)\n * Walk existing DOM nodes in `container`, match them against the vnode tree,\n * attach reactive bindings, and skip cloneNode. Once done, switch to normal rendering.\n */\nexport function hydrate(vnode, container) {\n _isHydrating = true;\n _hydrationCursor = { parent: container, index: 0 };\n\n try {\n const result = hydrateNode(vnode, container);\n return result;\n } finally {\n _isHydrating = false;\n _hydrationCursor = null;\n }\n}\n\n/**\n * Claim the next DOM node from the hydration cursor.\n * Returns the existing DOM node or null if none available.\n */\nfunction claimNode(parent) {\n const children = parent.childNodes;\n while (_hydrationCursor.index < children.length) {\n const node = children[_hydrationCursor.index];\n // Skip hydration comment markers\n if (node.nodeType === 8) { // Comment node\n const text = node.textContent;\n if (text === '$' || text === '/$' || text === '[]' || text === '/[]') {\n _hydrationCursor.index++;\n continue;\n }\n }\n _hydrationCursor.index++;\n return node;\n }\n return null;\n}\n\nfunction isDevMode() {\n return typeof process !== 'undefined' && process.env?.NODE_ENV !== 'production';\n}\n\nfunction hydrateNode(vnode, parent) {\n if (vnode == null || typeof vnode === 'boolean') {\n return null;\n }\n\n // Text node\n if (typeof vnode === 'string' || typeof vnode === 'number') {\n const existing = claimNode(parent);\n const text = String(vnode);\n\n if (existing && existing.nodeType === 3) {\n // Reuse text node \u2014 check for mismatch in dev\n if (isDevMode() && existing.textContent !== text) {\n console.warn(\n `[what] Hydration mismatch: expected text \"${text}\", got \"${existing.textContent}\"`\n );\n existing.textContent = text;\n }\n return existing;\n }\n\n // Mismatch: expected text node, got element or nothing\n if (isDevMode()) {\n console.warn(\n `[what] Hydration mismatch: expected text node \"${text}\", got ${existing ? existing.nodeName : 'nothing'}. Falling back to client render.`\n );\n }\n const textNode = document.createTextNode(text);\n if (existing) {\n parent.replaceChild(textNode, existing);\n } else {\n parent.appendChild(textNode);\n }\n return textNode;\n }\n\n // Reactive function child \u2014 attach effect to existing node\n if (typeof vnode === 'function') {\n // Unwrap to get the initial value for hydration\n const initialValue = vnode();\n let current = hydrateNode(initialValue, parent);\n\n // Set up reactive effect for future updates (normal rendering path)\n effect(() => {\n const value = vnode();\n // After hydration, this runs as normal insert\n if (!_isHydrating) {\n current = reconcileInsert(parent, value, current, null);\n }\n });\n return current;\n }\n\n // Array \u2014 hydrate each child\n if (Array.isArray(vnode)) {\n const nodes = [];\n for (const child of vnode) {\n const node = hydrateNode(child, parent);\n if (node) nodes.push(node);\n }\n return nodes.length === 1 ? nodes[0] : nodes;\n }\n\n // VNode \u2014 component or element\n if (typeof vnode === 'object' && vnode._vnode) {\n // Component \u2014 route through component context so hooks work during hydration\n if (typeof vnode.tag === 'function') {\n const componentStack = getComponentStack();\n const Component = vnode.tag;\n const props = vnode.props || {};\n const children = vnode.children || [];\n\n // Set up component context (mirrors createComponent in dom.js)\n const ctx = {\n hooks: [],\n hookIndex: 0,\n effects: [],\n cleanups: [],\n mounted: false,\n disposed: false,\n Component,\n _parentCtx: componentStack[componentStack.length - 1] || null,\n _errorBoundary: null,\n };\n\n // Push context so hooks can access it\n componentStack.push(ctx);\n\n let result;\n try {\n const propsChildren = children.length === 0 ? undefined\n : children.length === 1 ? children[0] : children;\n result = Component({ ...props, children: propsChildren });\n } catch (error) {\n componentStack.pop();\n console.error('[what] Error in component during hydration:', Component.name || 'Anonymous', error);\n return null;\n }\n\n componentStack.pop();\n ctx.mounted = true;\n\n // Run onMount callbacks after hydration\n if (ctx._mountCallbacks) {\n queueMicrotask(() => {\n if (ctx.disposed) return;\n for (const fn of ctx._mountCallbacks) {\n try { fn(); } catch (e) { console.error('[what] onMount error:', e); }\n }\n });\n }\n\n return hydrateNode(result, parent);\n }\n\n // Element \u2014 claim existing DOM element\n const existing = claimNode(parent);\n const expectedTag = vnode.tag.toUpperCase();\n\n if (existing && existing.nodeType === 1 && existing.nodeName === expectedTag) {\n // Match! Reuse this element. Apply props/bindings.\n hydrateElementProps(existing, vnode.props || {});\n\n // Hydrate children\n const savedCursor = _hydrationCursor;\n _hydrationCursor = { parent: existing, index: 0 };\n\n const rawInner = vnode.props?.dangerouslySetInnerHTML?.__html;\n if (rawInner == null) {\n for (const child of vnode.children) {\n hydrateNode(child, existing);\n }\n }\n\n _hydrationCursor = savedCursor;\n return existing;\n }\n\n // Mismatch \u2014 fall back to client render for this subtree\n if (isDevMode()) {\n console.warn(\n `[what] Hydration mismatch: expected <${vnode.tag}>, got ${existing ? existing.nodeName : 'nothing'}. Falling back to client render.`\n );\n }\n\n // Create the element from scratch\n const newEl = document.createElement(vnode.tag);\n for (const key in vnode.props || {}) {\n if (key === 'children' || key === 'key') continue;\n setProp(newEl, key, vnode.props[key]);\n }\n for (const child of vnode.children) {\n reconcileInsert(newEl, child, null, null);\n }\n if (existing) {\n parent.replaceChild(newEl, existing);\n } else {\n parent.appendChild(newEl);\n }\n return newEl;\n }\n\n // DOM node \u2014 use directly\n if (isDomNode(vnode)) {\n return vnode;\n }\n\n // Fallback \u2014 create text node\n const textNode = document.createTextNode(String(vnode));\n parent.appendChild(textNode);\n return textNode;\n}\n\n/**\n * Apply props to an existing hydrated element.\n * Attaches event handlers and reactive bindings without re-creating the element.\n */\nfunction hydrateElementProps(el, props) {\n for (const key in props) {\n if (key === 'children' || key === 'key' || key === 'ref') continue;\n if (key === 'dangerouslySetInnerHTML' || key === 'innerHTML') continue;\n\n const value = props[key];\n\n // Event handlers \u2014 always attach (they don't exist in SSR HTML)\n if (key.startsWith('on') && key.length > 2) {\n const event = key.slice(2).toLowerCase();\n el.addEventListener(event, value);\n continue;\n }\n\n // Delegated events ($$click etc.)\n if (key.startsWith('$$')) {\n el[key] = value;\n continue;\n }\n\n // Reactive props \u2014 set up effects\n if (typeof value === 'function' && !key.startsWith('on')) {\n if (key === 'class' || key === 'className') {\n effect(() => { el.className = value() || ''; });\n } else if (key === 'style' && typeof value() === 'object') {\n effect(() => {\n const styles = value();\n for (const prop in styles) {\n el.style[prop] = styles[prop] ?? '';\n }\n });\n } else {\n effect(() => { setProp(el, key, value()); });\n }\n continue;\n }\n\n // Static props \u2014 skip attributes already set from SSR\n // Only attach non-serializable props or ones that may differ\n if (key === 'data-hk') continue;\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;AAiBA,IAAI,gBAAgB;AAEb,SAAS,mBAAmB,IAAI;AACrC,kBAAgB,OAAO,OAAO,aAAa,KAAK;AAClD;AAOO,SAAS,kBAAkB,WAAW,OAAO,UAA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";var u=!(typeof process<"u"),d=null;function Me(e){u&&(d=e)}var _=null,w=null,E=null,P=!1,D=0,b=[],j=!1,q=Symbol("needs_upstream"),B=null;function S(e,t){let n=e,r=new Set,s=null,o=0;function c(f){u&&P&&console.warn("[what] Signal.set() called inside a computed function. This may cause infinite loops. Use effect() instead."+(t?` (signal: ${t})`:""));let l=typeof f=="function"?f(n):f;n===l||n!==n&&l!==l||(n=l,s=null,u&&d&&d.onSignalUpdate(i),r.size>0&&ee(r))}function i(f){if(arguments.length===0){let l=_;return l!==null&&(l!==s||l._epoch!==o)&&(s=l,o=l._epoch,r.add(l),l.deps.push(r)),n}c(f)}return i.set=c,i.peek=()=>n,i.subscribe=f=>v(()=>f(i())),i._signal=!0,u&&(i._subs=r,t&&(i._debugName=t)),u&&d&&d.onSignalCreate(i),i}function Ae(e){let t,n=!0,r=new Set,s=null,o=0,c=V(()=>{let f=P;u&&(P=!0);try{t=e(),n=!1}finally{u&&(P=f)}},!0);c._level=1,c._computed=!0,c._computedSubs=r,r._owner=c,c._markDirty=()=>{n=!0},c._isDirty=()=>n;function i(){let f=_;return f!==null&&(f!==s||f._epoch!==o)&&(s=f,o=f._epoch,r.add(f),f.deps.push(r)),n&&X(c),t}return c._onNotify=()=>{n=!0,s=null,r.size>0&&ee(r)},i._signal=!0,i.peek=()=>(n&&X(c),t),i}function X(e){if(B!==null)throw B.push(e),q;let t=[e];B=t;try{for(;t.length>0;){let n=t[t.length-1];if(!n._isDirty||!n._isDirty()){t.pop();continue}let r=!1,s=n.deps;for(let o=0;o<s.length;o++){let c=s[o]._owner;c&&c._computed&&c._isDirty&&c._isDirty()&&(t.push(c),r=!0)}if(!r)try{let o=n.deps.length;$(n),n.deps.length!==o&&H(n),t.pop()}catch(o){if(o===q)n._markDirty();else throw o}}}finally{B=null}}function H(e){let t=0,n=e.deps;for(let r=0;r<n.length;r++){let s=n[r]._owner;if(s){let o=s._level;o>t&&(t=o)}}e._level=t+1}var ge=()=>{};function v(e,t){let n=V(e);n._level=1;let r=_;_=n;try{let o=n.fn();typeof o=="function"&&(n._cleanup=o)}finally{_=r}if(H(n),t?.stable&&(n._stable=!0),n.deps.length===0&&n._cleanup===null)return n.disposed=!0,u&&d&&d.onEffectDispose(n),ge;let s=()=>Z(n);return w&&w.disposals.push(s),s}function Te(e){D++;try{e()}finally{D--,D===0&&G()}}function V(e,t){let n={fn:e,deps:[],lazy:t||!1,_onNotify:null,disposed:!1,_pending:!1,_stable:!1,_level:0,_computed:!1,_computedSubs:null,_isDirty:null,_markDirty:null,_cleanup:null,_epoch:0};return u&&d&&d.onEffectCreate(n),n}function $(e){if(e.disposed)return;if(e._stable){if(e._cleanup){try{e._cleanup()}catch(s){u&&console.warn("[what] Error in effect cleanup:",s)}e._cleanup=null}let r=_;_=null;try{let s=e.fn();typeof s=="function"&&(e._cleanup=s)}catch(s){d?.onError&&d.onError(s,{type:"effect",effect:e}),u&&console.warn("[what] Error in stable effect:",s)}finally{_=r}u&&d?.onEffectRun&&d.onEffectRun(e);return}let t=e.deps.length===1?e.deps[0]:null;if(Y(e),e._cleanup){try{e._cleanup()}catch(r){u&&d?.onError&&d.onError(r,{type:"effect-cleanup",effect:e}),u&&console.warn("[what] Error in effect cleanup:",r)}e._cleanup=null}let n=_;_=e;try{let r=e.fn();typeof r=="function"&&(e._cleanup=r)}catch(r){throw r===q||u&&d?.onError&&d.onError(r,{type:"effect",effect:e}),r}finally{_=n}t!==null&&e.deps.length===1&&e.deps[0]===t&&!e._cleanup&&!e._pending&&(e._stable=!0),u&&d?.onEffectRun&&d.onEffectRun(e)}function Z(e){if(e.disposed=!0,u&&d&&d.onEffectDispose(e),Y(e),e._cleanup){try{e._cleanup()}catch(t){u&&console.warn("[what] Error in effect cleanup on dispose:",t)}e._cleanup=null}}function Y(e){let t=e.deps;for(let n=0;n<t.length;n++)t[n].delete(e);t.length=0,e._epoch++}var F=0,L=null,M=0;function Q(e){if(!e.disposed){if(e._onNotify)e._onNotify();else if(!e._pending)if(D===0&&e._stable){let t=_;_=null;try{let n=e.fn();if(typeof n=="function"){if(e._cleanup)try{e._cleanup()}catch{}e._cleanup=n}}catch(n){u&&d?.onError&&d.onError(n,{type:"effect",effect:e}),u&&console.warn("[what] Error in stable effect:",n)}finally{_=t}}else{e._pending=!0;let t=e._level,n=b.length;n>0&&b[n-1]._level>t&&(j=!0),b.push(e)}}}function ee(e){if(F===0){F=1;try{for(let t of e)Q(t);if(M>0){let t=0;for(;t<M;){let n=L[t];L[t]=null,t++;for(let r of n)Q(r)}M=0}}finally{F=0}D===0&&b.length>0&&ye()}else L===null&&(L=[]),M>=L.length?L.push(e):L[M]=e,M++}var I=!1;function ye(){I||(I=!0,queueMicrotask(()=>{I=!1,G()}))}var R=!1;function G(){if(!R){R=!0;try{let e=0;for(;b.length>0&&e<25;){let t=b;b=[],t.length>1&&j&&t.sort((n,r)=>n._level-r._level),j=!1;for(let n=0;n<t.length;n++){let r=t[n];if(r._pending=!1,!r.disposed&&!r._onNotify){let s=r.deps.length;try{$(r)}catch(o){if(o===q)throw o;u&&d?.onError&&d.onError(o,{type:"effect",effect:r});try{console.error("[what] Uncaught error in effect during update:",o)}catch{}continue}!r._computed&&r.deps.length!==s&&H(r)}}e++}if(e>=25){if(u){let n=b.slice(0,3).map(r=>r.fn?.name||r.fn?.toString().slice(0,60)||"(anonymous)");console.warn(`[what] Possible infinite effect loop detected (25 iterations). Likely cause: an effect writes to a signal it also reads, creating a cycle. Use untrack() to read signals without subscribing. Looping effects: ${n.join(", ")}`)}else console.warn("[what] Possible infinite effect loop detected");for(let t=0;t<b.length;t++)b[t]._pending=!1;b.length=0}}finally{R=!1}}}function De(e){let t,n=new Set,r=V(()=>{let o=e();if(!Object.is(t,o)){t=o;for(let c of n)if(!c.disposed){if(c._onNotify)c._onNotify();else if(!c._pending){c._pending=!0;let i=c._level,f=b.length;f>0&&b[f-1]._level>i&&(j=!0),b.push(c)}}}});r._level=1,$(r),H(r),n._owner=r,w&&w.disposals.push(()=>Z(r));function s(){return _&&(n.add(_),_.deps.push(n)),t}return s._signal=!0,s.peek=()=>t,s}function Oe(){if(R){u&&console.warn("[what] flushSync() called during an active flush (e.g., inside a component render or effect). This is a no-op to prevent infinite loops. Move flushSync() to an event handler or onMount callback.");return}if(_){u&&console.warn("[what] flushSync() called during effect execution. This is a no-op to prevent infinite loops. Move flushSync() to an event handler or onMount callback.");return}I=!1,G()}function K(e){let t=_;_=null;try{return e()}finally{_=t}}function Be(){return E}function Pe(e,t){let n=E,r=w;E=e,w=e;try{return t()}finally{E=n,w=r}}function Ie(e){let t=w,n=E,r={disposals:[],owner:E,children:[],_disposed:!1};E&&E.children.push(r),w=r,E=r;try{return e(()=>{if(!r._disposed){r._disposed=!0;for(let o=r.children.length-1;o>=0;o--)J(r.children[o]);r.children.length=0;for(let o=r.disposals.length-1;o>=0;o--)r.disposals[o]();if(r.disposals.length=0,r.owner){let o=r.owner.children.indexOf(r);o>=0&&r.owner.children.splice(o,1)}}})}finally{w=t,E=n}}function J(e){if(!e._disposed){e._disposed=!0;for(let t=e.children.length-1;t>=0;t--)J(e.children[t]);e.children.length=0;for(let t=e.disposals.length-1;t>=0;t--)e.disposals[t]();e.disposals.length=0}}function Re(e){let t=w,n=E,r={disposals:[],owner:null,children:[],_disposed:!1};w=r,E=r;try{return e(()=>{if(!r._disposed){r._disposed=!0;for(let o=r.children.length-1;o>=0;o--)J(r.children[o]);r.children.length=0;for(let o=r.disposals.length-1;o>=0;o--)r.disposals[o]();r.disposals.length=0}})}finally{w=t,E=n}}function je(e){w&&w.disposals.push(e)}if(u&&typeof WeakRef<"u"){let t={signals:new Set,effects:new Set,components:[]};d={__isPreinstallBuffer:!0,onSignalCreate(n){t.signals.size<2e3&&t.signals.add(new WeakRef(n))},onSignalUpdate(){},onEffectCreate(n){t.effects.size<2e3&&t.effects.add(new WeakRef(n))},onEffectDispose(){},onEffectRun(){},onError(){},onComponentMount(n){t.components.length<2e3&&t.components.push(n)},onComponentUnmount(){},__buffer:t}}function qe(){if(!u)return{signals:[],effects:[],components:[]};let e={signals:[],effects:[],components:[]},t=typeof U<"u"?U:null;if(!t)return e;for(let n of t.signals){let r=n.deref?.();r&&e.signals.push(r)}for(let n of t.effects){let r=n.deref?.();r&&e.effects.push(r)}for(let n of t.components)e.components.push(n);return e}var U=null;u&&d?.__isPreinstallBuffer&&(U=d.__buffer);function $e(e,t){let n=function(s){return e(s)};return n.displayName=`Memo(${e.name||"Anonymous"})`,n}var te=null;function ne(e){te=e}function Ge(e){let t=null,n=null,r=null,s=new Set;function o(c){if(r)throw r;if(t)return T(t,c);throw n||(n=e().then(i=>{t=i.default||i,s.forEach(f=>f()),s.clear()}).catch(i=>{r=i})),n}return o.displayName="Lazy",o._lazy=!0,o._onLoad=c=>{t?c():s.add(c)},o}function Ke({fallback:e,children:t}){let n=S(!1),r=new Set;return{tag:"__suspense",props:{boundary:{_suspense:!0,onSuspend(o){n.set(!0),r.add(o),o.finally(()=>{r.delete(o),r.size===0&&n.set(!1)})}},fallback:e,loading:n},children:Array.isArray(t)?t:[t],_vnode:!0}}function Je({fallback:e,children:t,onError:n}){let r=S(null);return{tag:"__errorBoundary",props:{errorState:r,handleError:c=>{if(r.set(c),n)try{n(c)}catch(i){console.error("Error in onError handler:",i)}},fallback:e,reset:()=>r.set(null)},children:Array.isArray(t)?t:[t],_vnode:!0}}function re(e,t){let n=t||te?.();for(;n;){if(n._errorBoundary)return n._errorBoundary(e),!0;n=n._parentCtx}return!1}function Xe({when:e,fallback:t=null,children:n}){return(typeof e=="function"?e():e)?n:t}function Qe({each:e,fallback:t=null,children:n}){let r=typeof e=="function"?e():e;if(!r||r.length===0)return t;let s=Array.isArray(n)?n[0]:n;return typeof s!="function"?(console.warn("[what] For: children must be a render function, e.g. <For each={items}>{(item) => ...}</For>"),t):r.map((o,c)=>{let i=s(o,c);return i&&typeof i=="object"&&i.key==null&&(o!=null&&typeof o=="object"?o.id!=null?i.key=o.id:o.key!=null&&(i.key=o.key):(typeof o=="string"||typeof o=="number")&&(i.key=o)),i})}function Ze({fallback:e=null,children:t}){let n=Array.isArray(t)?t:[t];for(let r of n)if(r&&r.tag===oe&&(typeof r.props.when=="function"?r.props.when():r.props.when))return r.children;return e}function oe({when:e,children:t}){return{tag:oe,props:{when:e},children:t,_vnode:!0}}function Ye({component:e,mode:t,mediaQuery:n,...r}){let s=T("div",{"data-island":e.name||"Island","data-hydrate":t}),o=S(null),c=S(!1);function i(){c()||(c.set(!0),o.set(T(e,r)))}function f(p){switch(t){case"load":queueMicrotask(i);break;case"idle":typeof requestIdleCallback<"u"?requestIdleCallback(i):setTimeout(i,200);break;case"visible":{let a=new IntersectionObserver(h=>{h[0].isIntersecting&&(a.disconnect(),i())});a.observe(p);break}case"interaction":{let a=()=>{p.removeEventListener("click",a),p.removeEventListener("focus",a),p.removeEventListener("mouseenter",a),i()};p.addEventListener("click",a,{once:!0}),p.addEventListener("focus",a,{once:!0}),p.addEventListener("mouseenter",a,{once:!0});break}case"media":{if(!n){i();break}let a=window.matchMedia(n);if(a.matches)queueMicrotask(i);else{let h=()=>{a.matches&&(a.removeEventListener("change",h),i())};a.addEventListener("change",h)}break}default:queueMicrotask(i)}}let l=p=>{p&&f(p)};return T("div",{"data-island":e.name||"Island","data-hydrate":t,ref:l},c()?o():null)}var se=!1;function nt(e,t,n){return se||(se=!0,console.warn("[what] each() is deprecated. Use the <For> component or Array.map() instead.")),!e||e.length===0?[]:e.map((r,s)=>{let o=t(r,s);return n&&o&&typeof o=="object"&&(o.key=n(r,s)),o})}function rt(...e){let t=[];for(let n of e)if(n){if(typeof n=="string")t.push(n);else if(typeof n=="object")for(let[r,s]of Object.entries(n))s&&t.push(r)}return t.join(" ")}function ot(e){return typeof e=="string"?e:Object.entries(e).filter(([,t])=>t!=null&&t!=="").map(([t,n])=>`${Ce(t)}:${n}`).join(";")}function Ce(e){return e.replace(/([A-Z])/g,"-$1").toLowerCase()}function st(e,t){let n;return(...r)=>{clearTimeout(n),n=setTimeout(()=>e(...r),t)}}function it(e,t){let n=0;return(...r)=>{let s=Date.now();s-n>=t&&(n=s,e(...r))}}var W=null;function ie(e){W=e}function ct(e){if(typeof window>"u")return S(!1);let t=window.matchMedia(e),n=S(t.matches),r=o=>n.set(o.matches);t.addEventListener("change",r);let s=W?.();return s&&(s._cleanupCallbacks=s._cleanupCallbacks||[],s._cleanupCallbacks.push(()=>t.removeEventListener("change",r))),n}function ft(e,t){let n;try{let i=localStorage.getItem(e);n=i!==null?JSON.parse(i):t}catch{n=t}let r=S(n),s=v(()=>{try{localStorage.setItem(e,JSON.stringify(r()))}catch(i){u&&console.warn("[what] localStorage write failed (quota exceeded?):",i)}}),o=null;typeof window<"u"&&(o=i=>{if(i.key===e&&i.newValue!==null)try{r.set(JSON.parse(i.newValue))}catch(f){u&&console.warn("[what] localStorage parse failed:",f)}},window.addEventListener("storage",o));let c=W?.();return c&&(c._cleanupCallbacks=c._cleanupCallbacks||[],c._cleanupCallbacks.push(()=>{s(),o&&window.removeEventListener("storage",o)})),r}function lt({target:e,children:t}){if(typeof document>"u")return null;let n=typeof e=="string"?document.querySelector(e):e;return n?{tag:"__portal",props:{container:n},children:Array.isArray(t)?t:[t],_vnode:!0}:null}function at(e,t){if(typeof document>"u")return;let n=s=>{let o=e.current||e;!o||o.contains(s.target)||t(s)};document.addEventListener("mousedown",n),document.addEventListener("touchstart",n);let r=W?.();r&&(r._cleanupCallbacks=r._cleanupCallbacks||[],r._cleanupCallbacks.push(()=>{document.removeEventListener("mousedown",n),document.removeEventListener("touchstart",n)}))}function ut(e,t){return{class:t?`${e}-enter ${e}-enter-active`:`${e}-leave ${e}-leave-active`}}var we=new Set(["svg","path","circle","rect","line","polyline","polygon","ellipse","g","defs","use","symbol","clipPath","mask","pattern","image","text","tspan","textPath","foreignObject","linearGradient","radialGradient","stop","marker","animate","animateTransform","animateMotion","set","filter","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence"]),be="http://www.w3.org/2000/svg",le=new Set,z=new WeakMap;function Ee(e){return!e||typeof e!="object"?!1:typeof Node<"u"&&e instanceof Node?!0:typeof e.nodeType=="number"&&typeof e.nodeName=="string"}function ce(e){return!!e&&typeof e=="object"&&(e._vnode===!0||"tag"in e)}function fe(e){if(!e.disposed){if(e.disposed=!0,e.cleanups)for(let t of e.cleanups)try{t()}catch(n){console.error("[what] cleanup error:",n)}if(e.effects)for(let t of e.effects)try{t()}catch{}if(e.hooks){for(let t of e.hooks)if(t&&typeof t.cleanup=="function")try{t.cleanup()}catch(n){console.error("[what] hook cleanup error:",n)}}if(e._cleanupCallbacks)for(let t of e._cleanupCallbacks)try{t()}catch(n){console.error("[what] onCleanup error:",n)}u&&d?.onComponentUnmount&&d.onComponentUnmount(e),le.delete(e)}}function N(e){if(!e)return;if(e._componentCtx&&fe(e._componentCtx),e.nodeType===8){let n=z.get(e);n&&fe(n)}if(e._dispose)try{e._dispose()}catch{}if(e._propEffects)for(let n in e._propEffects)try{e._propEffects[n]()}catch{}let t=e.childNodes;if(t&&t.length>0)for(let n=0;n<t.length;n++)N(t[n])}function yt(e,t){typeof t=="string"&&(t=document.querySelector(t)),N(t),t.textContent="";let n=k(e,t);return n&&t.appendChild(n),()=>{N(t),t.textContent=""}}function k(e,t,n){if(e==null||e===!1||e===!0)return document.createComment("");if(typeof e=="string"||typeof e=="number")return document.createTextNode(String(e));if(Ee(e))return e;if(typeof e=="function"){let r=document.createComment("fn"),s=document.createComment("/fn"),o=[],c=document.createDocumentFragment();c.appendChild(r),c.appendChild(s);let i=v(()=>{let f=e(),l=f==null||f===!1||f===!0?[]:Array.isArray(f)?f:[f],p=s.parentNode;if(p){for(let a of o)N(a),a.parentNode===p&&p.removeChild(a);o=[];for(let a of l){let h=k(a,p,t?._isSvg);if(h)if(h.nodeType===11){let C=Array.from(h.childNodes);p.insertBefore(h,s);for(let y of C)o.push(y)}else p.insertBefore(h,s),o.push(h)}}});return r._dispose=i,s._dispose=i,c}if(Array.isArray(e)){let r=document.createDocumentFragment();for(let s of e){let o=k(s,t,n);o&&r.appendChild(o)}return r}return ce(e)&&typeof e.tag=="function"?xe(e,t,n):ce(e)&&typeof e.tag=="string"?e.tag==="__errorBoundary"?ue(e,t):e.tag==="__suspense"?pe(e,t):e.tag==="__portal"?de(e,t):ve(e,t,n):document.createTextNode(String(e))}var Se={get(e,t){if(t!=="_sig"&&!(t==="__proto__"||t==="constructor"||t==="prototype"))return e._sig()[t]},has(e,t){return t==="_sig"?!1:t in e._sig()},ownKeys(e){return Reflect.ownKeys(e._sig())},getOwnPropertyDescriptor(e,t){if(t==="_sig")return;let n=e._sig();if(t in n)return{value:n[t],writable:!1,enumerable:!0,configurable:!0}},set(e,t){return!1}},m=[];function ae(){return m[m.length-1]}ne(ae);ie(ae);function Ct(){return m}function xe(e,t,n){let{tag:r,props:s,children:o}=e;if(typeof r=="function"&&(r.prototype?.isReactComponent||r.prototype?.render)){let g=r;r=function(me){return new g(me).render()},r.displayName=g.displayName||g.name||"ClassComponent"}if(r==="__errorBoundary"||e.tag==="__errorBoundary")return ue(e,t);if(r==="__suspense"||e.tag==="__suspense")return pe(e,t);if(r==="__portal"||e.tag==="__portal")return de(e,t);let c=m[m.length-1]||null,i=null;if(c&&(i=c._errorBoundary||null,!i)){let g=c._parentCtx;for(;g;){if(g._errorBoundary){i=g._errorBoundary;break}g=g._parentCtx}}let f={hooks:[],hookIndex:0,effects:[],cleanups:[],mounted:!1,disposed:!1,Component:r,_parentCtx:c,_errorBoundary:i},l=document.createComment("c:start"),p=document.createComment("c:end");z.set(l,f),f._startComment=l,f._endComment=p;let a=document.createDocumentFragment();a._componentCtx=f,f._wrapper=l,le.add(f),u&&d?.onComponentMount&&d.onComponentMount(f);let h=o.length===0?void 0:o.length===1?o[0]:o,C;h!==void 0?C=s?Object.assign({},s,{children:h}):{children:h}:C=s?Object.assign({},s):{};let y=S(C);f._propsSignal=y;let x=new Proxy({_sig:y},Se);m.push(f);let O;try{O=K(()=>r(x))}catch(g){if(m.pop(),!re(g,f))throw console.error("[what] Uncaught error in component:",r.name||"Anonymous",g),g;return a.appendChild(l),a.appendChild(p),a}m.pop(),f.mounted=!0,f._mountCallbacks&&queueMicrotask(()=>{if(!f.disposed)for(let g of f._mountCallbacks)try{g()}catch(A){console.error("[what] onMount error:",A)}}),a.appendChild(l);let _e=Array.isArray(O)?O:[O];for(let g of _e){let A=k(g,a,n);A&&a.appendChild(A)}return a.appendChild(p),a}function ue(e,t){let{errorState:n,handleError:r,fallback:s,reset:o}=e.props,c=e.children,i=document.createComment("eb:start"),f=document.createComment("eb:end"),l={hooks:[],hookIndex:0,effects:[],cleanups:[],mounted:!1,disposed:!1,_parentCtx:m[m.length-1]||null,_errorBoundary:r,_startComment:i,_endComment:f};z.set(i,l);let p=document.createDocumentFragment();p._componentCtx=l,p.appendChild(i),p.appendChild(f);let a=v(()=>{let h=n();if(m.push(l),i.parentNode)for(;i.nextSibling&&i.nextSibling!==f;){let y=i.nextSibling;N(y),y.parentNode.removeChild(y)}let C;h?C=typeof s=="function"?[s({error:h,reset:o})]:[s]:C=c,C=Array.isArray(C)?C:[C];for(let y of C){let x=k(y,t);x&&(f.parentNode?f.parentNode.insertBefore(x,f):p.insertBefore(x,f))}m.pop()});return l.effects.push(a),p}function pe(e,t){let{boundary:n,fallback:r,loading:s}=e.props,o=e.children,c=document.createComment("sb:start"),i=document.createComment("sb:end"),f={hooks:[],hookIndex:0,effects:[],cleanups:[],mounted:!1,disposed:!1,_parentCtx:m[m.length-1]||null,_startComment:c,_endComment:i};z.set(c,f);let l=document.createDocumentFragment();l._componentCtx=f,l.appendChild(c),l.appendChild(i);let p=v(()=>{let h=s()?[r]:o,C=Array.isArray(h)?h:[h];if(m.push(f),c.parentNode)for(;c.nextSibling&&c.nextSibling!==i;){let y=c.nextSibling;N(y),y.parentNode.removeChild(y)}for(let y of C){let x=k(y,t);x&&(i.parentNode?i.parentNode.insertBefore(x,i):l.insertBefore(x,i))}m.pop()});return f.effects.push(p),l}function de(e,t){let{container:n}=e.props,r=e.children;if(!n)return console.warn("[what] Portal: target container not found"),document.createComment("portal:empty");let s={hooks:[],hookIndex:0,effects:[],cleanups:[],mounted:!1,disposed:!1,_parentCtx:m[m.length-1]||null},o=document.createComment("portal");o._componentCtx=s;let c=[];for(let i of r){let f=k(i,n);f&&(n.appendChild(f),c.push(f))}return s._cleanupCallbacks=[()=>{for(let i of c)N(i),i.parentNode&&i.parentNode.removeChild(i)}],o}function ve(e,t,n){let{tag:r,props:s,children:o}=e,c=n||we.has(r),i=c?document.createElementNS(be,r):document.createElement(r);s&&ke(i,s,{},c);let f=c&&r!=="foreignObject";for(let l=0;l<o.length;l++){let p=k(o[l],i,f);p&&i.appendChild(p)}return i._vnode=e,i}function ke(e,t,n,r){if(t){for(let s in t)if(!(s==="key"||s==="children")){if(s==="ref"){let o=t.ref;typeof o=="function"?o(e):o&&(o.current=e);continue}he(e,s,t[s],r)}}}function Le(e,t){e.value=t,e.value!==String(t)&&queueMicrotask(()=>{e.value=t})}function he(e,t,n,r){if(typeof n=="function"&&!(t.startsWith("on")&&t.length>2)&&t!=="ref"){if(e._propEffects||(e._propEffects={}),e._propEffects[t])try{e._propEffects[t]()}catch{}e._propEffects[t]=v(()=>{let s=n();he(e,t,s,r)});return}if(t.startsWith("on")&&t.length>2){let s=t.slice(2),o=!1;s.endsWith("Capture")&&(s=s.slice(0,-7),o=!0);let c=s.toLowerCase(),i=o?c+"_capture":c,f=e._events?.[i];if(f&&f._original===n||(f&&e.removeEventListener(c,f,o),n==null))return;e._events||(e._events={});let l=a=>(a.nativeEvent||(a.nativeEvent=a),K(()=>l._handler(a)));l._handler=n,l._original=n,e._events[i]=l;let p=n._eventOpts;e.addEventListener(c,l,p||o||void 0);return}if(t==="className"||t==="class"){r?e.setAttribute("class",n||""):e.className=n||"";return}if(t==="style"){if(typeof n=="string")e.style.cssText=n,e._prevStyle=null;else if(typeof n=="object"){let s=e._prevStyle||{};for(let o in s)o in n||(e.style[o]="");for(let o in n)e.style[o]=n[o]??"";e._prevStyle={...n}}return}if(t==="dangerouslySetInnerHTML"){let s=n?.__html??"";u&&typeof s=="string"&&/(<script|onerror\s*=|onload\s*=|javascript:)/i.test(s)&&console.warn("[what] dangerouslySetInnerHTML contains potential XSS vectors. Ensure content is sanitized."),e.innerHTML=s;return}if(t==="innerHTML"){if(n==null)return;if(n&&typeof n=="object"&&"__html"in n){let s=n.__html??"";u&&typeof s=="string"&&/(<script|onerror\s*=|onload\s*=|javascript:)/i.test(s)&&console.warn("[what] dangerouslySetInnerHTML contains potential XSS vectors. Ensure content is sanitized."),e.innerHTML=s}else{u&&console.warn("[what] innerHTML received a raw string. This is a security risk (XSS). Use innerHTML={{ __html: trustedString }} or dangerouslySetInnerHTML={{ __html: trustedString }} instead.");return}return}if(typeof n=="boolean"){n?e.setAttribute(t,""):e.removeAttribute(t);return}if(t.startsWith("data-")||t.startsWith("aria-")){e.setAttribute(t,n);return}if(r){n===!1||n==null?e.removeAttribute(t):e.setAttribute(t,n===!0?"":String(n));return}if(t==="value"&&e.tagName==="SELECT"){Le(e,n);return}t in e?e[t]=n:e.setAttribute(t,n)}export{u as a,Me as b,S as c,Ae as d,v as e,Te as f,De as g,Oe as h,K as i,Be as j,Pe as k,Ie as l,Re as m,je as n,qe as o,$e as p,Ge as q,Ke as r,Je as s,Xe as t,Qe as u,Ze as v,oe as w,Ye as x,nt as y,rt as z,ot as A,st as B,it as C,ct as D,ft as E,lt as F,at as G,ut as H,N as I,yt as J,k as K,ae as L,Ct as M,Le as N};
|
|
2
|
+
//# sourceMappingURL=chunk-6DAIK77K.min.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/reactive.js", "../src/components.js", "../src/helpers.js", "../src/dom.js"],
|
|
4
|
+
"sourcesContent": ["// What Framework - Reactive Primitives\n// Signals + Effects: fine-grained reactivity without virtual DOM overhead\n//\n// Upgrades:\n// - Topological ordering: computed/effects sorted by _level to prevent diamond glitches\n// - Iterative computed evaluation: no recursion, handles 10K+ depth chains\n// - Ownership tree: createRoot children auto-dispose when parent disposes\n// - Performance: cached levels, lazy sort, fast-path notify, minimal allocation\n\n// Dev-mode flag \u2014 build tools can dead-code-eliminate when false\nexport const __DEV__ = typeof process !== 'undefined'\n ? process.env?.NODE_ENV !== 'production'\n : true;\n\n// DevTools hooks \u2014 set by what-devtools when installed.\n// These are no-ops in production (dead-code eliminated with __DEV__).\nexport let __devtools = null;\n\n/** @internal Install devtools hooks. Called by what-devtools. */\nexport function __setDevToolsHooks(hooks) {\n if (__DEV__) __devtools = hooks;\n}\n\nlet currentEffect = null;\nlet currentRoot = null;\nlet currentOwner = null; // Ownership tree: tracks current owner context\nlet insideComputed = false; // Track whether we're inside a computed() callback (dev-mode warning)\nlet batchDepth = 0;\nlet pendingEffects = [];\nlet pendingNeedSort = false; // Track whether pendingEffects actually needs sorting\n\n// Instead of a WeakMap from subscriber Set \u2192 owning computed's inner effect,\n// we store the owner directly on the Set as ._owner (20x faster than WeakMap.get).\n// Signal subscriber Sets have ._owner = undefined (signals are level 0).\n\n// --- Iterative Computed Evaluation State ---\n// Uses a throw/catch trampoline to convert recursive computed evaluation\n// to iterative. When a computed fn() reads another dirty computed, instead\n// of recursing, we throw a sentinel that gets caught by the outer loop.\nconst NEEDS_UPSTREAM = Symbol('needs_upstream');\nlet iterativeEvalStack = null; // array when inside evaluation loop, null otherwise\n\n// --- Signal ---\n// A reactive value. Reading inside an effect auto-tracks the dependency.\n// Writing triggers only the effects that depend on this signal.\n//\n// Performance: signal read is the hottest path in any signal-based framework.\n// Key optimizations:\n// - No rest args (...args) \u2014 uses arguments.length for zero-alloc read path\n// - Subscriber tracking uses lastTracked to skip redundant Set.add/Array.push\n// when the same signal is read multiple times in one effect (common pattern)\n// - Write path uses === first (fast for primitives), falls back to Object.is\n// only for NaN detection\n// - subs.size check avoids notify() call when no subscribers\n\nexport function signal(initial, debugName) {\n let value = initial;\n const subs = new Set();\n // Track the last effect that subscribed \u2014 skip redundant tracking when the\n // same effect reads this signal multiple times (common in template bindings).\n // lastTrackedEpoch tracks the effect's cleanup epoch to detect stale caches.\n let lastTracked = null;\n let lastTrackedEpoch = 0;\n\n // Shared write logic \u2014 inlined via _sigWrite closure to avoid per-call overhead\n // while keeping the sig() function body minimal for V8 optimization.\n function _sigWrite(next) {\n if (__DEV__ && insideComputed) {\n console.warn(\n '[what] Signal.set() called inside a computed function. ' +\n 'This may cause infinite loops. Use effect() instead.' +\n (debugName ? ` (signal: ${debugName})` : '')\n );\n }\n const nextVal = typeof next === 'function' ? next(value) : next;\n // Fast equality: === handles all primitives except NaN.\n // Only fall through for the NaN !== NaN case.\n if (value === nextVal || (value !== value && nextVal !== nextVal)) return;\n value = nextVal;\n // Invalidate lastTracked since value changed \u2014 any effect that reads\n // this signal during re-run needs to re-track.\n lastTracked = null;\n if (__DEV__ && __devtools) __devtools.onSignalUpdate(sig);\n if (subs.size > 0) notify(subs);\n }\n\n // Unified getter/setter: sig() reads, sig(newVal) writes\n // Using arguments.length instead of rest args avoids array allocation on read\n function sig(newVal) {\n if (arguments.length === 0) {\n // Read \u2014 hot path, keep minimal\n const ce = currentEffect;\n if (ce !== null) {\n // Only track if this signal isn't already in the effect's deps.\n // lastTracked is a fast cache for the common case (single effect reading\n // this signal). It's reset to null on write and on cleanup epoch change.\n if (ce !== lastTracked || ce._epoch !== lastTrackedEpoch) {\n lastTracked = ce;\n lastTrackedEpoch = ce._epoch;\n subs.add(ce);\n ce.deps.push(subs);\n }\n }\n return value;\n }\n // Write via sig(newVal)\n _sigWrite(newVal);\n }\n\n sig.set = _sigWrite;\n\n sig.peek = () => value;\n\n sig.subscribe = (fn) => {\n return effect(() => fn(sig()));\n };\n\n sig._signal = true;\n if (__DEV__) {\n sig._subs = subs;\n if (debugName) sig._debugName = debugName;\n }\n\n // Notify devtools of signal creation\n if (__DEV__ && __devtools) __devtools.onSignalCreate(sig);\n\n return sig;\n}\n\n// --- Computed ---\n// Derived signal. Lazy: only recomputes when a dependency changes AND it's read.\n// Topological level: max(dependency levels) + 1, computed from source signals (level 0).\n\nexport function computed(fn) {\n let value, dirty = true;\n const subs = new Set();\n let lastTracked = null;\n let lastTrackedEpoch = 0;\n\n const inner = _createEffect(() => {\n const prevInsideComputed = insideComputed;\n if (__DEV__) insideComputed = true;\n try {\n value = fn();\n dirty = false;\n } finally {\n if (__DEV__) insideComputed = prevInsideComputed;\n }\n }, true);\n\n // Computed nodes start at level 1. Updated when graph structure changes.\n inner._level = 1;\n inner._computed = true;\n inner._computedSubs = subs;\n\n // Register this subscriber set as owned by this computed\n subs._owner = inner;\n\n // Store markDirty/isDirty closures on the inner effect for iterative eval\n inner._markDirty = () => { dirty = true; };\n inner._isDirty = () => dirty;\n\n function read() {\n const ce = currentEffect;\n if (ce !== null) {\n if (ce !== lastTracked || ce._epoch !== lastTrackedEpoch) {\n lastTracked = ce;\n lastTrackedEpoch = ce._epoch;\n subs.add(ce);\n ce.deps.push(subs);\n }\n }\n if (dirty) _evaluateComputed(inner);\n return value;\n }\n\n // When a dependency changes, mark dirty AND propagate to our subscribers.\n inner._onNotify = () => {\n dirty = true;\n lastTracked = null; // Invalidate tracking cache on value change\n if (subs.size > 0) notify(subs);\n };\n\n read._signal = true;\n read.peek = () => {\n if (dirty) _evaluateComputed(inner);\n return value;\n };\n\n return read;\n}\n\n// --- Iterative Computed Evaluation ---\n//\n// Problem: A chain of N dirty computeds causes O(N) recursive calls:\n// C_N.read() \u2192 eval \u2192 fn() \u2192 C_{N-1}.read() \u2192 eval \u2192 fn() \u2192 ... \u2192 C_1.read() \u2192 eval \u2192 fn()\n// This overflows the stack at ~3500 depth.\n//\n// Solution: Throw/catch trampoline. The outermost _evaluateComputed manages a\n// stack (array). When a computed's fn() reads another dirty computed during\n// evaluation, _evaluateComputed throws NEEDS_UPSTREAM. The outer loop catches\n// this, adds the upstream to the stack, and processes from the bottom up.\n// This converts O(N) call depth to O(1) per computed (just the outermost loop).\n\nfunction _evaluateComputed(computedEffect) {\n if (iterativeEvalStack !== null) {\n // We're inside the outermost evaluation loop, and a computed's fn()\n // is reading another dirty computed. Push it onto the stack and throw\n // to abort the current fn() so the outer loop can process it first.\n iterativeEvalStack.push(computedEffect);\n throw NEEDS_UPSTREAM;\n }\n\n // Outermost call \u2014 enter the iterative evaluation loop.\n // The stack grows as we discover dirty upstream computeds.\n const stack = [computedEffect];\n iterativeEvalStack = stack;\n\n try {\n while (stack.length > 0) {\n const current = stack[stack.length - 1];\n\n if (!current._isDirty || !current._isDirty()) {\n // Already clean \u2014 pop and continue\n stack.pop();\n continue;\n }\n\n // Pre-scan known deps: if any are dirty computeds, push them onto\n // the stack first (bottom-up). This avoids the O(N^2) worst case\n // where throw/catch restarts from the top on each dirty upstream.\n let pushedUpstream = false;\n const deps = current.deps;\n for (let i = 0; i < deps.length; i++) {\n const depOwner = deps[i]._owner;\n if (depOwner && depOwner._computed && depOwner._isDirty && depOwner._isDirty()) {\n stack.push(depOwner);\n pushedUpstream = true;\n }\n }\n if (pushedUpstream) {\n // Process dirty upstreams first before re-evaluating current\n continue;\n }\n\n // All known deps are clean \u2014 evaluate. throw/catch is fallback\n // for newly-discovered deps only.\n try {\n const prevDepsLen = current.deps.length;\n _runEffect(current);\n // Only recompute level when graph structure changes\n if (current.deps.length !== prevDepsLen) {\n _updateLevel(current);\n }\n stack.pop(); // Successfully evaluated\n } catch (err) {\n if (err === NEEDS_UPSTREAM) {\n // A dirty upstream was discovered and pushed onto the stack.\n // Re-mark this computed dirty since its fn() was aborted mid-execution.\n current._markDirty();\n // The upstream is now at stack[stack.length-1]. Loop continues.\n } else {\n throw err; // Re-throw real errors\n }\n }\n }\n } finally {\n iterativeEvalStack = null;\n }\n}\n\n// Update the topological level of a computed/effect based on its current dependencies.\nfunction _updateLevel(e) {\n let maxDepLevel = 0;\n const deps = e.deps;\n for (let i = 0; i < deps.length; i++) {\n const owner = deps[i]._owner;\n if (owner) {\n const depLevel = owner._level;\n if (depLevel > maxDepLevel) maxDepLevel = depLevel;\n }\n }\n e._level = maxDepLevel + 1;\n}\n\n// --- Effect ---\n// Runs a function, auto-tracking signal reads. Re-runs when deps change.\n// Returns a dispose function.\n\nconst _noopDispose = () => {};\n\nexport function effect(fn, opts) {\n const e = _createEffect(fn);\n e._level = 1;\n // First run: skip cleanup (deps is empty), just run and track\n const prev = currentEffect;\n currentEffect = e;\n try {\n const result = e.fn();\n if (typeof result === 'function') e._cleanup = result;\n } finally {\n currentEffect = prev;\n }\n // Compute level after first run based on actual dependencies (cached).\n _updateLevel(e);\n // Mark as stable after first run \u2014 subsequent re-runs skip cleanup/re-subscribe\n if (opts?.stable) e._stable = true;\n\n // Zero-dependency release (SPRINT v0.11 C4): an effect that tracked zero\n // signals on its first run can never be notified again \u2014 re-tracking only\n // happens during a re-run, and a re-run requires a notification from a\n // subscribed signal. The compiler conservatively wraps destructured props /\n // imported accessors in effects; when those turn out to be plain values the\n // effect is one-shot. If it also registered no cleanup, release it now:\n // no dispose closure, no owner registration, nothing retained.\n // - Effects that returned a cleanup keep full registration so the cleanup\n // still runs on owner disposal.\n // - onCleanup() callbacks register with currentRoot directly (not with the\n // effect), so they are unaffected by this release.\n // - untrack()/peek() reads inside the fn produce zero deps by design \u2014 the\n // effect could never re-fire anyway, so releasing is safe.\n if (e.deps.length === 0 && e._cleanup === null) {\n e.disposed = true;\n if (__DEV__ && __devtools) __devtools.onEffectDispose(e);\n return _noopDispose;\n }\n\n const dispose = () => _disposeEffect(e);\n // Register with current root for automatic cleanup\n if (currentRoot) {\n currentRoot.disposals.push(dispose);\n }\n return dispose;\n}\n\n// --- Batch ---\n// Group multiple signal writes; effects run once at the end.\n\nexport function batch(fn) {\n batchDepth++;\n try {\n fn();\n } finally {\n batchDepth--;\n if (batchDepth === 0) flush();\n }\n}\n\n// --- Internals ---\n\nfunction _createEffect(fn, lazy) {\n // Minimal object shape \u2014 computed() adds extra properties after creation.\n // IMPORTANT: V8 optimizes objects with a consistent \"hidden class\" (shape).\n // All properties must be declared upfront even if null \u2014 adding properties\n // later causes shape transitions which deoptimize property access globally.\n const e = {\n fn,\n deps: [], // array of subscriber sets (cheaper than Set for typical 1-3 deps)\n lazy: lazy || false,\n _onNotify: null,\n disposed: false,\n _pending: false,\n _stable: false, // stable effects skip cleanup/re-subscribe on re-run\n _level: 0, // topological depth: signals=0, computed/effects=max(deps)+1\n _computed: false, // true for computed inner effects\n _computedSubs: null, // reference to the computed's subscriber set\n _isDirty: null, // function to check if computed is dirty (set by computed())\n _markDirty: null, // function to mark computed dirty (set by computed())\n _cleanup: null, // cleanup function returned by effect fn (declared upfront for shape)\n _epoch: 0, // incremented on cleanup \u2014 used by signal lastTracked cache\n };\n if (__DEV__ && __devtools) __devtools.onEffectCreate(e);\n return e;\n}\n\nfunction _runEffect(e) {\n if (e.disposed) return;\n\n // Stable effect fast path: deps don't change, skip cleanup/re-subscribe.\n // This is critical for performance: effects like `() => el.className = sig() ? 'a' : ''`\n // always read the same signal(s). After auto-promotion, re-runs skip the O(deps)\n // cleanup + re-subscribe cycle entirely.\n if (e._stable) {\n if (e._cleanup) {\n try { e._cleanup(); } catch (err) {\n if (__DEV__) console.warn('[what] Error in effect cleanup:', err);\n }\n e._cleanup = null;\n }\n const prev = currentEffect;\n currentEffect = null; // Don't re-track deps (already subscribed)\n try {\n const result = e.fn();\n if (typeof result === 'function') e._cleanup = result;\n } catch (err) {\n if (__devtools?.onError) __devtools.onError(err, { type: 'effect', effect: e });\n if (__DEV__) console.warn('[what] Error in stable effect:', err);\n } finally {\n currentEffect = prev;\n }\n if (__DEV__ && __devtools?.onEffectRun) __devtools.onEffectRun(e);\n return;\n }\n\n // Save the single dep for auto-stable detection (safe: 1-dep effects\n // have deterministic dep sets \u2014 no conditional reads possible).\n const singleDep = e.deps.length === 1 ? e.deps[0] : null;\n\n cleanup(e);\n // Run effect cleanup from previous run\n if (e._cleanup) {\n try { e._cleanup(); } catch (err) {\n if (__DEV__ && __devtools?.onError) __devtools.onError(err, { type: 'effect-cleanup', effect: e });\n if (__DEV__) console.warn('[what] Error in effect cleanup:', err);\n }\n e._cleanup = null;\n }\n const prev = currentEffect;\n currentEffect = e;\n try {\n const result = e.fn();\n // Capture cleanup function if returned\n if (typeof result === 'function') {\n e._cleanup = result;\n }\n } catch (err) {\n if (err === NEEDS_UPSTREAM) throw err; // Iterative eval sentinel \u2014 not a real error\n if (__DEV__ && __devtools?.onError) __devtools.onError(err, { type: 'effect', effect: e });\n throw err;\n } finally {\n currentEffect = prev;\n }\n\n // Auto-promote to stable: effects with exactly 1 dep that remains the same\n // after re-run have a fixed dependency graph. Skip cleanup/re-subscribe\n // on future re-runs. This is safe because a single-dep effect can't have\n // conditional signal reads that change which signal is tracked.\n // Guard: don't promote self-triggering effects (those that write to the signal\n // they read, causing re-queuing). Check e._pending to detect this.\n if (singleDep !== null && e.deps.length === 1 && e.deps[0] === singleDep\n && !e._cleanup && !e._pending) {\n e._stable = true;\n }\n\n if (__DEV__ && __devtools?.onEffectRun) __devtools.onEffectRun(e);\n}\n\nfunction _disposeEffect(e) {\n e.disposed = true;\n if (__DEV__ && __devtools) __devtools.onEffectDispose(e);\n cleanup(e);\n // Run cleanup on dispose\n if (e._cleanup) {\n try { e._cleanup(); } catch (err) {\n if (__DEV__) console.warn('[what] Error in effect cleanup on dispose:', err);\n }\n e._cleanup = null;\n }\n}\n\nfunction cleanup(e) {\n const deps = e.deps;\n for (let i = 0; i < deps.length; i++) deps[i].delete(e);\n deps.length = 0;\n // Increment epoch so signals' lastTracked cache is invalidated.\n // This ensures a signal will re-track this effect after cleanup.\n e._epoch++;\n}\n\n// --- Notification ---\n// Iterative notification to prevent stack overflow on deep computed chains.\n// Uses a reusable queue to avoid per-call array allocation.\n// When notify() encounters _onNotify callbacks (from computeds), those may\n// call notify() recursively. The queue drains iteratively in the outermost call.\n\nlet notifyDepth = 0; // Tracks recursive notify depth\nlet notifyQueue = null; // Reusable queue, allocated on first recursive call\nlet notifyQueueLen = 0; // Length of the queue\n\n// Process a single subscriber during notification.\n// Extracted to avoid code duplication between outer and queue drain paths.\nfunction _processSubscriber(e) {\n if (e.disposed) return;\n if (e._onNotify) {\n // Computed subscriber: mark dirty and propagate.\n // _onNotify may call notify() recursively \u2014 tracked by notifyDepth.\n e._onNotify();\n } else if (!e._pending) {\n if (batchDepth === 0 && e._stable) {\n // Inline execution for stable effects \u2014 no pending queue needed\n const prev = currentEffect;\n currentEffect = null;\n try {\n const result = e.fn();\n if (typeof result === 'function') {\n if (e._cleanup) try { e._cleanup(); } catch (err) { /* ignore */ }\n e._cleanup = result;\n }\n } catch (err) {\n if (__DEV__ && __devtools?.onError) __devtools.onError(err, { type: 'effect', effect: e });\n if (__DEV__) console.warn('[what] Error in stable effect:', err);\n } finally {\n currentEffect = prev;\n }\n } else {\n e._pending = true;\n const level = e._level;\n const len = pendingEffects.length;\n if (len > 0 && pendingEffects[len - 1]._level > level) {\n pendingNeedSort = true;\n }\n pendingEffects.push(e);\n }\n }\n}\n\nfunction notify(subs) {\n // Fast path: no recursive notifications in progress \u2014 iterate directly.\n // This avoids array allocation for the common case (signal \u2192 effects).\n if (notifyDepth === 0) {\n notifyDepth = 1;\n try {\n for (const e of subs) {\n _processSubscriber(e);\n }\n // Drain any queued subscriber sets from recursive notify calls\n if (notifyQueueLen > 0) {\n let qi = 0;\n while (qi < notifyQueueLen) {\n const queuedSubs = notifyQueue[qi];\n notifyQueue[qi] = null; // Allow GC\n qi++;\n for (const e of queuedSubs) {\n _processSubscriber(e);\n }\n }\n notifyQueueLen = 0;\n }\n } finally {\n notifyDepth = 0;\n }\n if (batchDepth === 0 && pendingEffects.length > 0) scheduleMicrotask();\n } else {\n // Recursive call \u2014 queue the subscriber set for the outermost call to drain.\n if (notifyQueue === null) notifyQueue = [];\n if (notifyQueueLen >= notifyQueue.length) {\n notifyQueue.push(subs);\n } else {\n notifyQueue[notifyQueueLen] = subs;\n }\n notifyQueueLen++;\n }\n}\n\nlet microtaskScheduled = false;\nfunction scheduleMicrotask() {\n if (!microtaskScheduled) {\n microtaskScheduled = true;\n queueMicrotask(() => {\n microtaskScheduled = false;\n flush();\n });\n }\n}\n\nlet isFlushing = false;\n\nfunction flush() {\n // Re-entrancy guard: if flush() is called during an active flush (e.g., via\n // flushSync() inside a component render or effect), skip to prevent infinite\n // recursion. Pending effects will be picked up by the outer flush's while-loop.\n if (isFlushing) return;\n isFlushing = true;\n\n try {\n let iterations = 0;\n while (pendingEffects.length > 0 && iterations < 25) {\n const batch = pendingEffects;\n pendingEffects = [];\n\n // Topological sort: execute effects in level order (lowest first).\n // Fast paths:\n // 1. Single effect \u2014 no sort needed (most common case for microtask flush)\n // 2. Already sorted \u2014 skip sort (common when effects added in level order)\n // 3. Multiple effects at different levels \u2014 sort required\n if (batch.length > 1 && pendingNeedSort) {\n batch.sort((a, b) => a._level - b._level);\n }\n pendingNeedSort = false;\n\n for (let i = 0; i < batch.length; i++) {\n const e = batch[i];\n e._pending = false;\n if (!e.disposed && !e._onNotify) {\n const prevDepsLen = e.deps.length;\n // Isolate per-effect errors: one throwing effect must NOT abort the\n // rest of the batch (which would drop queued effects and leave the\n // graph half-updated). NEEDS_UPSTREAM is the iterative-eval sentinel\n // and must still propagate. (AUDIT-2026-06-06 H8)\n try {\n _runEffect(e);\n } catch (err) {\n if (err === NEEDS_UPSTREAM) throw err;\n if (__DEV__ && __devtools?.onError) __devtools.onError(err, { type: 'effect', effect: e });\n // Surface in production too \u2014 an uncaught reactive-update error is a\n // real bug; staying silent (as the old throw-out-of-flush did once it\n // escaped) hides it. console.error never aborts the batch.\n try { console.error('[what] Uncaught error in effect during update:', err); } catch { /* no console */ }\n continue;\n }\n // Update level only if deps changed (graph structure change)\n if (!e._computed && e.deps.length !== prevDepsLen) {\n _updateLevel(e);\n }\n }\n }\n iterations++;\n }\n if (iterations >= 25) {\n if (__DEV__) {\n const remaining = pendingEffects.slice(0, 3);\n const effectNames = remaining.map(e => e.fn?.name || e.fn?.toString().slice(0, 60) || '(anonymous)');\n console.warn(\n `[what] Possible infinite effect loop detected (25 iterations). ` +\n `Likely cause: an effect writes to a signal it also reads, creating a cycle. ` +\n `Use untrack() to read signals without subscribing. ` +\n `Looping effects: ${effectNames.join(', ')}`\n );\n } else {\n console.warn('[what] Possible infinite effect loop detected');\n }\n // Clear pending effects AFTER capturing debug info\n for (let i = 0; i < pendingEffects.length; i++) pendingEffects[i]._pending = false;\n pendingEffects.length = 0;\n }\n } finally {\n isFlushing = false;\n }\n}\n\n// --- Memo ---\n// Eager computed that only propagates when the value actually changes.\n// Fix: Instead of calling notify(subs) inline (which bypasses topological sort\n// and causes diamond-dependency glitches), push memo subscribers into\n// pendingEffects and let them go through the sorted flush() path.\nexport function memo(fn) {\n let value;\n const subs = new Set();\n\n const e = _createEffect(() => {\n const next = fn();\n if (!Object.is(value, next)) {\n value = next;\n // Push subscribers into pendingEffects for topological flush\n // instead of inline notify() which can cause diamond glitches\n for (const sub of subs) {\n if (sub.disposed) continue;\n if (sub._onNotify) {\n // Computed subscriber: mark dirty and propagate\n sub._onNotify();\n } else if (!sub._pending) {\n sub._pending = true;\n const level = sub._level;\n const len = pendingEffects.length;\n if (len > 0 && pendingEffects[len - 1]._level > level) {\n pendingNeedSort = true;\n }\n pendingEffects.push(sub);\n }\n }\n }\n });\n\n e._level = 1;\n\n _runEffect(e);\n _updateLevel(e);\n\n // Register subscriber set owner for level tracking\n subs._owner = e;\n\n // Register with current root\n if (currentRoot) {\n currentRoot.disposals.push(() => _disposeEffect(e));\n }\n\n function read() {\n if (currentEffect) {\n subs.add(currentEffect);\n currentEffect.deps.push(subs);\n }\n return value;\n }\n\n read._signal = true;\n read.peek = () => value;\n return read;\n}\n\n// --- flushSync ---\n// Force all pending effects to run synchronously. Use sparingly.\n// Calling during render or effect execution is a no-op (prevents infinite loops).\nexport function flushSync() {\n if (isFlushing) {\n // Re-entrant call \u2014 silently skip (Solid approach).\n // This prevents infinite loops when flushSync() is called during component\n // render or effect execution. Pending effects will be picked up by the\n // outer flush's while-loop.\n if (__DEV__) {\n console.warn(\n '[what] flushSync() called during an active flush (e.g., inside a component render or effect). ' +\n 'This is a no-op to prevent infinite loops. Move flushSync() to an event handler or onMount callback.'\n );\n }\n return;\n }\n if (currentEffect) {\n // Called inside an effect/render \u2014 skip with warning\n if (__DEV__) {\n console.warn(\n '[what] flushSync() called during effect execution. ' +\n 'This is a no-op to prevent infinite loops. Move flushSync() to an event handler or onMount callback.'\n );\n }\n return;\n }\n microtaskScheduled = false;\n flush();\n}\n\n// --- Untrack ---\n// Read signals without subscribing\nexport function untrack(fn) {\n const prev = currentEffect;\n currentEffect = null;\n try {\n return fn();\n } finally {\n currentEffect = prev;\n }\n}\n\n// --- getOwner / runWithOwner ---\n// Expose ownership context for advanced use cases (e.g., async operations\n// that need to register disposals with the correct owner).\n\nexport function getOwner() {\n return currentOwner;\n}\n\nexport function runWithOwner(owner, fn) {\n const prev = currentOwner;\n const prevRoot = currentRoot;\n currentOwner = owner;\n currentRoot = owner;\n try {\n return fn();\n } finally {\n currentOwner = prev;\n currentRoot = prevRoot;\n }\n}\n\n// --- createRoot ---\n// Isolated reactive scope with ownership tree.\n// All effects created inside are tracked and disposed together.\n// Child createRoot scopes register with parent owner \u2014 disposing parent\n// automatically disposes all children (prevents orphaned subscriptions).\nexport function createRoot(fn) {\n const prevRoot = currentRoot;\n const prevOwner = currentOwner;\n const root = {\n disposals: [],\n owner: currentOwner, // parent owner for ownership tree\n children: [], // child roots (ownership tree)\n _disposed: false,\n };\n\n // Register this root as a child of the parent owner\n if (currentOwner) {\n currentOwner.children.push(root);\n }\n\n currentRoot = root;\n currentOwner = root;\n\n try {\n const dispose = () => {\n if (root._disposed) return;\n root._disposed = true;\n\n // Dispose children first (depth-first, reverse order)\n for (let i = root.children.length - 1; i >= 0; i--) {\n _disposeRoot(root.children[i]);\n }\n root.children.length = 0;\n\n // Dispose own effects (reverse order for LIFO cleanup)\n for (let i = root.disposals.length - 1; i >= 0; i--) {\n root.disposals[i]();\n }\n root.disposals.length = 0;\n\n // Remove from parent's children list\n if (root.owner) {\n const idx = root.owner.children.indexOf(root);\n if (idx >= 0) root.owner.children.splice(idx, 1);\n }\n };\n return fn(dispose);\n } finally {\n currentRoot = prevRoot;\n currentOwner = prevOwner;\n }\n}\n\n// Internal: dispose a root and all its children\nfunction _disposeRoot(root) {\n if (root._disposed) return;\n root._disposed = true;\n\n // Dispose children first\n for (let i = root.children.length - 1; i >= 0; i--) {\n _disposeRoot(root.children[i]);\n }\n root.children.length = 0;\n\n // Dispose own effects\n for (let i = root.disposals.length - 1; i >= 0; i--) {\n root.disposals[i]();\n }\n root.disposals.length = 0;\n}\n\n// --- _createItemScope ---\n// Lightweight reactive scope for list items. Unlike createRoot, this does NOT\n// register with the parent ownership tree (saves ~40% allocation overhead).\n// Used by mapArray where disposal is managed explicitly by the list reconciler.\nexport function _createItemScope(fn) {\n const prevRoot = currentRoot;\n const prevOwner = currentOwner;\n const scope = {\n disposals: [],\n owner: null, // No parent registration\n children: [], // Kept for compat with effects that create sub-roots\n _disposed: false,\n };\n\n currentRoot = scope;\n currentOwner = scope;\n\n try {\n const dispose = () => {\n if (scope._disposed) return;\n scope._disposed = true;\n // Dispose children\n for (let i = scope.children.length - 1; i >= 0; i--) {\n _disposeRoot(scope.children[i]);\n }\n scope.children.length = 0;\n // Dispose own effects\n for (let i = scope.disposals.length - 1; i >= 0; i--) {\n scope.disposals[i]();\n }\n scope.disposals.length = 0;\n };\n return fn(dispose);\n } finally {\n currentRoot = prevRoot;\n currentOwner = prevOwner;\n }\n}\n\n// --- onCleanup ---\n// Register a cleanup function with the current owner/root.\n// Runs when the owner is disposed.\nexport function onCleanup(fn) {\n if (currentRoot) {\n currentRoot.disposals.push(fn);\n }\n}\n\n// devtools: registry-iterator export for P1-9 \u2014\n// Late-install replay buffer. When installDevTools() runs AFTER signals or\n// effects have already been created (the canonical example: a module-scope\n// `export const todos = signal([], 'todos')` in store.js, imported before\n// the devtools entry point), those signals were invisible to what_signals.\n//\n// We install a placeholder __devtools that ONLY buffers creations into weak\n// refs. When the real devtools install via __setDevToolsHooks, they call\n// __drainPreinstallBuffer() to register every buffered primitive.\n//\n// Cost in production: __DEV__ is false \u2192 __devtools stays null, no buffering.\n// Cost in dev: one WeakRef per signal/effect created before install.\nif (__DEV__ && typeof WeakRef !== 'undefined') {\n // Cap each buffer so an app that never installs devtools doesn't accumulate\n // refs unbounded. 2k is far more than any realistic component/signal count\n // needed before the devtools entry point runs; once devtools install, the\n // buffer is drained and subsequent creations flow through the real hooks.\n const PREINSTALL_CAP = 2000;\n const buffer = { signals: new Set(), effects: new Set(), components: [] };\n __devtools = {\n __isPreinstallBuffer: true,\n onSignalCreate(sig) {\n if (buffer.signals.size < PREINSTALL_CAP) buffer.signals.add(new WeakRef(sig));\n },\n onSignalUpdate() {},\n onEffectCreate(e) {\n if (buffer.effects.size < PREINSTALL_CAP) buffer.effects.add(new WeakRef(e));\n },\n onEffectDispose() {},\n onEffectRun() {},\n onError() {},\n onComponentMount(ctx) {\n if (buffer.components.length < PREINSTALL_CAP) buffer.components.push(ctx);\n },\n onComponentUnmount() {},\n __buffer: buffer,\n };\n}\n\n/**\n * Drain the pre-install buffer. Called by the real devtools hooks after\n * __setDevToolsHooks replaces the placeholder. Returns arrays of live refs.\n */\nexport function __drainPreinstallBuffer() {\n if (!__DEV__) return { signals: [], effects: [], components: [] };\n // If the current __devtools is the real one (no __isPreinstallBuffer), the\n // caller installed late and there is nothing to drain from this side.\n const out = { signals: [], effects: [], components: [] };\n const buf = (typeof __preinstallSnapshot !== 'undefined') ? __preinstallSnapshot : null;\n if (!buf) return out;\n for (const ref of buf.signals) { const v = ref.deref?.(); if (v) out.signals.push(v); }\n for (const ref of buf.effects) { const v = ref.deref?.(); if (v) out.effects.push(v); }\n for (const ctx of buf.components) out.components.push(ctx);\n return out;\n}\n\n// Capture the placeholder buffer at module load so __drainPreinstallBuffer\n// can return it AFTER __setDevToolsHooks has replaced __devtools.\nlet __preinstallSnapshot = null;\nif (__DEV__ && __devtools?.__isPreinstallBuffer) {\n __preinstallSnapshot = __devtools.__buffer;\n}\n", "// What Framework - Component Utilities\n// memo, lazy, Suspense, ErrorBoundary\n\nimport { h } from './h.js';\nimport { signal, effect, untrack, __DEV__ } from './reactive.js';\n\n// Legacy errorBoundaryStack removed \u2014 tree-based resolution via _parentCtx._errorBoundary\n// is now the only mechanism. See reportError() below.\n\n// --- memo ---\n// In the run-once model, components execute exactly once and never re-render.\n// Signals update the DOM directly via fine-grained effects. Therefore, memo()\n// is a no-op identity wrapper \u2014 there is no re-render to skip.\n// Kept for API compatibility with React-style code.\n\nexport function memo(Component, _areEqual) {\n // No-op in run-once model \u2014 just return the component as-is\n const MemoWrapper = function MemoWrapper(props) {\n return Component(props);\n };\n MemoWrapper.displayName = `Memo(${Component.name || 'Anonymous'})`;\n return MemoWrapper;\n}\n\n// Injected by dom.js\nlet _getCurrentComponent = null;\nexport function _injectGetCurrentComponent(fn) { _getCurrentComponent = fn; }\n\nexport function shallowEqual(a, b) {\n if (a === b) return true;\n const keysA = Object.keys(a);\n const keysB = Object.keys(b);\n if (keysA.length !== keysB.length) return false;\n for (const key of keysA) {\n if (!Object.is(a[key], b[key])) return false;\n }\n return true;\n}\n\n// --- lazy ---\n// Code-split a component. Returns a wrapper that loads on first render.\n\nexport function lazy(loader) {\n let Component = null;\n let loadPromise = null;\n let loadError = null;\n const listeners = new Set();\n\n function LazyWrapper(props) {\n if (loadError) throw loadError;\n if (Component) return h(Component, props);\n\n if (!loadPromise) {\n loadPromise = loader()\n .then(mod => {\n Component = mod.default || mod;\n // Notify all waiting instances\n listeners.forEach(fn => fn());\n listeners.clear();\n })\n .catch(err => { loadError = err; });\n }\n\n // Throw promise for Suspense to catch\n throw loadPromise;\n }\n\n LazyWrapper.displayName = 'Lazy';\n LazyWrapper._lazy = true;\n LazyWrapper._onLoad = (fn) => {\n if (Component) fn();\n else listeners.add(fn);\n };\n return LazyWrapper;\n}\n\n// --- Suspense ---\n// Show fallback while children are loading (lazy components).\n// Works with lazy() and async components.\n\nexport function Suspense({ fallback, children }) {\n const loading = signal(false);\n const pendingPromises = new Set();\n\n // Suspense boundary marker\n const boundary = {\n _suspense: true,\n onSuspend(promise) {\n loading.set(true);\n pendingPromises.add(promise);\n promise.finally(() => {\n pendingPromises.delete(promise);\n if (pendingPromises.size === 0) {\n loading.set(false);\n }\n });\n },\n };\n\n return {\n tag: '__suspense',\n props: { boundary, fallback, loading },\n children: Array.isArray(children) ? children : [children],\n _vnode: true,\n };\n}\n\n// --- ErrorBoundary ---\n// Catch errors in children and show fallback.\n// Uses a signal to track error state so it works with reactive rendering.\n\nexport function ErrorBoundary({ fallback, children, onError }) {\n const errorState = signal(null);\n\n // Error handler that will be registered with the component tree\n const handleError = (error) => {\n errorState.set(error);\n if (onError) {\n try {\n onError(error);\n } catch (e) {\n console.error('Error in onError handler:', e);\n }\n }\n };\n\n // Reset function to recover from error\n const reset = () => errorState.set(null);\n\n return {\n tag: '__errorBoundary',\n props: { errorState, handleError, fallback, reset },\n children: Array.isArray(children) ? children : [children],\n _vnode: true,\n };\n}\n\n// Helper to report error to nearest boundary\n// Walks the component context tree (not a runtime stack) so async errors are caught\nexport function reportError(error, startCtx) {\n // Walk up the _parentCtx chain to find the nearest _errorBoundary\n let ctx = startCtx || _getCurrentComponent?.();\n while (ctx) {\n if (ctx._errorBoundary) {\n ctx._errorBoundary(error);\n return true;\n }\n ctx = ctx._parentCtx;\n }\n return false;\n}\n\n// _getCurrentComponent is already declared above and injected via _injectGetCurrentComponent\n\n// --- Show ---\n// Conditional rendering component. Cleaner than ternaries.\n\nexport function Show({ when, fallback = null, children }) {\n // when can be a signal or a value\n const condition = typeof when === 'function' ? when() : when;\n return condition ? children : fallback;\n}\n\n// --- For ---\n// Efficient list rendering with keyed reconciliation.\n\nexport function For({ each, fallback = null, children }) {\n const list = typeof each === 'function' ? each() : each;\n if (!list || list.length === 0) return fallback;\n\n // children should be a function (item, index) => vnode\n const renderFn = Array.isArray(children) ? children[0] : children;\n if (typeof renderFn !== 'function') {\n console.warn('[what] For: children must be a render function, e.g. <For each={items}>{(item) => ...}</For>');\n return fallback;\n }\n\n return list.map((item, index) => {\n const vnode = renderFn(item, index);\n // Auto-detect keys for efficient keyed reconciliation\n if (vnode && typeof vnode === 'object' && vnode.key == null) {\n if (item != null && typeof item === 'object') {\n // Use item.id or item.key if available\n if (item.id != null) vnode.key = item.id;\n else if (item.key != null) vnode.key = item.key;\n } else if (typeof item === 'string' || typeof item === 'number') {\n // Primitive items can be their own key\n vnode.key = item;\n }\n }\n return vnode;\n });\n}\n\n// --- Switch / Match ---\n// Multi-condition rendering (like switch statement).\n\nexport function Switch({ fallback = null, children }) {\n const kids = Array.isArray(children) ? children : [children];\n\n for (const child of kids) {\n if (child && child.tag === Match) {\n const condition = typeof child.props.when === 'function'\n ? child.props.when()\n : child.props.when;\n if (condition) {\n return child.children;\n }\n }\n }\n\n return fallback;\n}\n\nexport function Match({ when, children }) {\n // Match is just a marker component, Switch handles the logic\n return { tag: Match, props: { when }, children, _vnode: true };\n}\n\n// --- Island ---\n// Deferred hydration component for islands architecture.\n// Usage: h(Island, { component: Counter, mode: 'idle' })\n// The babel plugin compiles <Counter client:idle /> into this.\n\nexport function Island({ component: Component, mode, mediaQuery, ...props }) {\n const placeholder = h('div', { 'data-island': Component.name || 'Island', 'data-hydrate': mode });\n\n // We need to return a vnode that the reconciler can handle.\n // The actual hydration scheduling happens after mount via an effect.\n const wrapper = signal(null);\n const hydrated = signal(false);\n\n function doHydrate() {\n if (hydrated()) return;\n hydrated.set(true);\n // Render the actual component\n wrapper.set(h(Component, props));\n }\n\n // Schedule hydration based on mode\n function scheduleHydration(el) {\n switch (mode) {\n case 'load':\n queueMicrotask(doHydrate);\n break;\n\n case 'idle':\n if (typeof requestIdleCallback !== 'undefined') {\n requestIdleCallback(doHydrate);\n } else {\n setTimeout(doHydrate, 200);\n }\n break;\n\n case 'visible': {\n const observer = new IntersectionObserver((entries) => {\n if (entries[0].isIntersecting) {\n observer.disconnect();\n doHydrate();\n }\n });\n observer.observe(el);\n break;\n }\n\n case 'interaction': {\n const hydrate = () => {\n el.removeEventListener('click', hydrate);\n el.removeEventListener('focus', hydrate);\n el.removeEventListener('mouseenter', hydrate);\n doHydrate();\n };\n el.addEventListener('click', hydrate, { once: true });\n el.addEventListener('focus', hydrate, { once: true });\n el.addEventListener('mouseenter', hydrate, { once: true });\n break;\n }\n\n case 'media': {\n if (!mediaQuery) { doHydrate(); break; }\n const mq = window.matchMedia(mediaQuery);\n if (mq.matches) {\n queueMicrotask(doHydrate);\n } else {\n const checkMedia = () => {\n if (mq.matches) {\n mq.removeEventListener('change', checkMedia);\n doHydrate();\n }\n };\n mq.addEventListener('change', checkMedia);\n }\n break;\n }\n\n default:\n // Unknown mode, hydrate immediately\n queueMicrotask(doHydrate);\n }\n }\n\n // Use ref callback to get the DOM element and schedule hydration\n const refCallback = (el) => {\n if (el) scheduleHydration(el);\n };\n\n // Return: show placeholder until hydrated, then show the real component\n return h('div', { 'data-island': Component.name || 'Island', 'data-hydrate': mode, ref: refCallback },\n hydrated() ? wrapper() : null\n );\n}\n", "// What Framework - Helpers & Utilities\n// Commonly needed patterns, zero overhead.\n\nimport { signal, effect, __DEV__ } from './reactive.js';\n\n// --- each(list, fn) --- [DEPRECATED: use <For> component or .map() instead]\n// Keyed list rendering. Optimized for reconciliation.\nlet _eachWarned = false;\nexport function each(list, fn, keyFn) {\n if (!_eachWarned) {\n _eachWarned = true;\n console.warn('[what] each() is deprecated. Use the <For> component or Array.map() instead.');\n }\n if (!list || list.length === 0) return [];\n return list.map((item, index) => {\n const vnode = fn(item, index);\n if (keyFn && vnode && typeof vnode === 'object') {\n vnode.key = keyFn(item, index);\n }\n return vnode;\n });\n}\n\n// --- cls(...args) ---\n// Conditional class names. Like clsx but tiny.\n// cls('base', condition && 'active', { hidden: isHidden, bold: isBold })\nexport function cls(...args) {\n const classes = [];\n for (const arg of args) {\n if (!arg) continue;\n if (typeof arg === 'string') {\n classes.push(arg);\n } else if (typeof arg === 'object') {\n for (const [key, val] of Object.entries(arg)) {\n if (val) classes.push(key);\n }\n }\n }\n return classes.join(' ');\n}\n\n// --- style(obj) ---\n// Convert a style object to a CSS string for SSR.\nexport function style(obj) {\n if (typeof obj === 'string') return obj;\n return Object.entries(obj)\n .filter(([, v]) => v != null && v !== '')\n .map(([k, v]) => `${camelToKebab(k)}:${v}`)\n .join(';');\n}\n\nfunction camelToKebab(str) {\n return str.replace(/([A-Z])/g, '-$1').toLowerCase();\n}\n\n// --- debounce ---\n// Debounced signal updates.\nexport function debounce(fn, ms) {\n let timer;\n return (...args) => {\n clearTimeout(timer);\n timer = setTimeout(() => fn(...args), ms);\n };\n}\n\n// --- throttle ---\nexport function throttle(fn, ms) {\n let last = 0;\n return (...args) => {\n const now = Date.now();\n if (now - last >= ms) {\n last = now;\n fn(...args);\n }\n };\n}\n\n// Component context ref \u2014 injected by dom.js to avoid circular imports\nlet _getCurrentComponentRef = null;\nexport function _setComponentRef(fn) { _getCurrentComponentRef = fn; }\n\n// --- useMediaQuery ---\n// Reactive media query. Returns a signal. Cleans up listener on component unmount.\nexport function useMediaQuery(query) {\n if (typeof window === 'undefined') return signal(false);\n const mq = window.matchMedia(query);\n const s = signal(mq.matches);\n const handler = (e) => s.set(e.matches);\n mq.addEventListener('change', handler);\n\n // Register cleanup if inside a component context\n const ctx = _getCurrentComponentRef?.();\n if (ctx) {\n ctx._cleanupCallbacks = ctx._cleanupCallbacks || [];\n ctx._cleanupCallbacks.push(() => mq.removeEventListener('change', handler));\n }\n\n return s;\n}\n\n// --- useLocalStorage ---\n// Signal synced with localStorage. Cleans up listeners on component unmount.\nexport function useLocalStorage(key, initial) {\n let stored;\n try {\n const raw = localStorage.getItem(key);\n stored = raw !== null ? JSON.parse(raw) : initial;\n } catch {\n stored = initial;\n }\n\n const s = signal(stored);\n\n // Sync to localStorage on changes\n const dispose = effect(() => {\n try {\n localStorage.setItem(key, JSON.stringify(s()));\n } catch (e) {\n if (__DEV__) console.warn('[what] localStorage write failed (quota exceeded?):', e);\n }\n });\n\n // Listen for changes from other tabs\n let storageHandler = null;\n if (typeof window !== 'undefined') {\n storageHandler = (e) => {\n if (e.key === key && e.newValue !== null) {\n try { s.set(JSON.parse(e.newValue)); } catch (err) {\n if (__DEV__) console.warn('[what] localStorage parse failed:', err);\n }\n }\n };\n window.addEventListener('storage', storageHandler);\n }\n\n // Register cleanup if inside a component context\n const ctx = _getCurrentComponentRef?.();\n if (ctx) {\n ctx._cleanupCallbacks = ctx._cleanupCallbacks || [];\n ctx._cleanupCallbacks.push(() => {\n dispose();\n if (storageHandler) window.removeEventListener('storage', storageHandler);\n });\n }\n\n return s;\n}\n\n// --- portal ---\n// Render children into a different DOM container.\nexport function Portal({ target, children }) {\n // In SSR, just return null (portals are client-only)\n if (typeof document === 'undefined') return null;\n const container = typeof target === 'string'\n ? document.querySelector(target)\n : target;\n if (!container) return null;\n // The DOM reconciler will mount children here\n return { tag: '__portal', props: { container }, children: Array.isArray(children) ? children : [children], _vnode: true };\n}\n\n// --- useClickOutside ---\n// Detect clicks outside a ref'd element. Essential for dropdowns, modals, popovers.\nexport function useClickOutside(ref, handler) {\n if (typeof document === 'undefined') return;\n\n const listener = (e) => {\n const el = ref.current || ref;\n if (!el || el.contains(e.target)) return;\n handler(e);\n };\n\n document.addEventListener('mousedown', listener);\n document.addEventListener('touchstart', listener);\n\n const ctx = _getCurrentComponentRef?.();\n if (ctx) {\n ctx._cleanupCallbacks = ctx._cleanupCallbacks || [];\n ctx._cleanupCallbacks.push(() => {\n document.removeEventListener('mousedown', listener);\n document.removeEventListener('touchstart', listener);\n });\n }\n}\n\n// --- Transition helper ---\n// Animate elements in/out. Returns props to spread on the element.\nexport function transition(name, active) {\n return {\n class: active ? `${name}-enter ${name}-enter-active` : `${name}-leave ${name}-leave-active`,\n };\n}\n", "// What Framework - Fine-Grained DOM Runtime\n// Components run ONCE. Signals create individual DOM effects.\n// No VDOM reconciler, no diffing \u2014 direct DOM manipulation driven by signals.\n\nimport { effect, batch, untrack, signal, __DEV__, __devtools } from './reactive.js';\nimport { reportError, _injectGetCurrentComponent, shallowEqual } from './components.js';\nimport { _setComponentRef } from './helpers.js';\n// SVG elements that need namespace\nconst SVG_ELEMENTS = new Set([\n 'svg', 'path', 'circle', 'rect', 'line', 'polyline', 'polygon', 'ellipse',\n 'g', 'defs', 'use', 'symbol', 'clipPath', 'mask', 'pattern', 'image',\n 'text', 'tspan', 'textPath', 'foreignObject', 'linearGradient', 'radialGradient', 'stop',\n 'marker', 'animate', 'animateTransform', 'animateMotion', 'set', 'filter',\n 'feBlend', 'feColorMatrix', 'feComponentTransfer', 'feComposite', 'feConvolveMatrix',\n 'feDiffuseLighting', 'feDisplacementMap', 'feFlood', 'feGaussianBlur', 'feImage',\n 'feMerge', 'feMergeNode', 'feMorphology', 'feOffset', 'feSpecularLighting',\n 'feTile', 'feTurbulence',\n]);\nconst SVG_NS = 'http://www.w3.org/2000/svg';\n\n// Track all mounted component contexts for disposal\nconst mountedComponents = new Set();\n\n// WeakMap: comment node \u2192 component context (for comment-node boundaries)\nconst _commentCtxMap = new WeakMap();\n\nfunction isDomNode(value) {\n if (!value || typeof value !== 'object') return false;\n if (typeof Node !== 'undefined' && value instanceof Node) return true;\n return typeof value.nodeType === 'number' && typeof value.nodeName === 'string';\n}\n\nfunction isVNode(value) {\n return !!value && typeof value === 'object' && (value._vnode === true || 'tag' in value);\n}\n\n// Dispose a component: run effect cleanups, hook cleanups, onCleanup callbacks\nfunction disposeComponent(ctx) {\n if (ctx.disposed) return;\n ctx.disposed = true;\n\n // Run cleanup callbacks\n if (ctx.cleanups) {\n for (const cleanup of ctx.cleanups) {\n try { cleanup(); } catch (e) { console.error('[what] cleanup error:', e); }\n }\n }\n\n // Run effect disposals\n if (ctx.effects) {\n for (const dispose of ctx.effects) {\n try { dispose(); } catch (e) { /* already disposed */ }\n }\n }\n\n // Run hook cleanups (useEffect return values)\n if (ctx.hooks) {\n for (const hook of ctx.hooks) {\n if (hook && typeof hook.cleanup === 'function') {\n try { hook.cleanup(); } catch (e) { console.error('[what] hook cleanup error:', e); }\n }\n }\n }\n\n // Run onCleanup callbacks\n if (ctx._cleanupCallbacks) {\n for (const fn of ctx._cleanupCallbacks) {\n try { fn(); } catch (e) { console.error('[what] onCleanup error:', e); }\n }\n }\n\n if (__DEV__ && __devtools?.onComponentUnmount) __devtools.onComponentUnmount(ctx);\n mountedComponents.delete(ctx);\n}\n\n// Dispose all components and reactive effects attached to a DOM subtree.\n// Performance: checks _componentCtx / _dispose / _propEffects before walking\n// children, and only checks _commentCtxMap for comment nodes (nodeType 8).\nexport function disposeTree(node) {\n if (!node) return;\n if (node._componentCtx) {\n disposeComponent(node._componentCtx);\n }\n // Check comment node WeakMap for component context \u2014 only for comment nodes\n if (node.nodeType === 8) {\n const commentCtx = _commentCtxMap.get(node);\n if (commentCtx) {\n disposeComponent(commentCtx);\n }\n }\n // Dispose reactive function child effects ({() => ...} wrappers)\n if (node._dispose) {\n try { node._dispose(); } catch (e) { /* already disposed */ }\n }\n // Dispose reactive prop effects (value: () => ..., class: () => ..., etc.)\n if (node._propEffects) {\n for (const key in node._propEffects) {\n try { node._propEffects[key](); } catch (e) { /* already disposed */ }\n }\n }\n // Recursively dispose children\n const children = node.childNodes;\n if (children && children.length > 0) {\n for (let i = 0; i < children.length; i++) {\n disposeTree(children[i]);\n }\n }\n}\n\n// Mount a component tree into a DOM container\nexport function mount(vnode, container) {\n if (typeof container === 'string') {\n container = document.querySelector(container);\n }\n disposeTree(container); // Clean up any previous mount\n container.textContent = '';\n const node = createDOM(vnode, container);\n if (node) container.appendChild(node);\n return () => {\n disposeTree(container);\n container.textContent = '';\n };\n}\n\n// --- Create DOM from VNode ---\n\nexport function createDOM(vnode, parent, isSvg) {\n // Null/false/true \u2192 placeholder comment (preserves child indices for reconciliation)\n if (vnode == null || vnode === false || vnode === true) {\n return document.createComment('');\n }\n\n // Text\n if (typeof vnode === 'string' || typeof vnode === 'number') {\n return document.createTextNode(String(vnode));\n }\n\n // DOM node passthrough (fine-grained components return real nodes)\n if (isDomNode(vnode)) {\n return vnode;\n }\n\n // Reactive function child \u2014 use comment markers (no wrapper element)\n // to avoid polluting the DOM and breaking CSS selectors like :first-child.\n if (typeof vnode === 'function') {\n const startMarker = document.createComment('fn');\n const endMarker = document.createComment('/fn');\n let currentNodes = [];\n // We need a parent to insert between markers. The caller (createElementFromVNode\n // or createComponent) will appendChild both markers and the content. We return\n // a document fragment containing start marker, then the effect will manage nodes\n // between start and end markers once they're in the real DOM.\n const frag = document.createDocumentFragment();\n frag.appendChild(startMarker);\n frag.appendChild(endMarker);\n\n const dispose = effect(() => {\n const val = vnode();\n const vnodes = (val == null || val === false || val === true)\n ? []\n : Array.isArray(val) ? val : [val];\n\n const realParent = endMarker.parentNode;\n if (!realParent) return; // not mounted yet \u2014 first run handled below\n\n // Remove old nodes between markers\n for (const old of currentNodes) {\n disposeTree(old);\n if (old.parentNode === realParent) realParent.removeChild(old);\n }\n currentNodes = [];\n\n // Add new nodes before endMarker\n for (const v of vnodes) {\n const node = createDOM(v, realParent, parent?._isSvg);\n if (node) {\n // If createDOM returned a DocumentFragment, track individual children\n // since fragment nodes get absorbed into the DOM on insertion.\n if (node.nodeType === 11 /* DOCUMENT_FRAGMENT_NODE */) {\n const children = Array.from(node.childNodes);\n realParent.insertBefore(node, endMarker);\n for (const child of children) currentNodes.push(child);\n } else {\n realParent.insertBefore(node, endMarker);\n currentNodes.push(node);\n }\n }\n }\n });\n\n startMarker._dispose = dispose;\n // Also store dispose on endMarker so disposeTree can find it from either marker\n endMarker._dispose = dispose;\n return frag;\n }\n\n // Array of vnodes\n if (Array.isArray(vnode)) {\n const frag = document.createDocumentFragment();\n for (const child of vnode) {\n const node = createDOM(child, parent, isSvg);\n if (node) frag.appendChild(node);\n }\n return frag;\n }\n\n // VNode with component tag \u2014 component runs ONCE\n if (isVNode(vnode) && typeof vnode.tag === 'function') {\n return createComponent(vnode, parent, isSvg);\n }\n\n // VNode with special boundary tags \u2014 route to boundary handlers\n if (isVNode(vnode) && typeof vnode.tag === 'string') {\n if (vnode.tag === '__errorBoundary') return createErrorBoundary(vnode, parent);\n if (vnode.tag === '__suspense') return createSuspenseBoundary(vnode, parent);\n if (vnode.tag === '__portal') return createPortalDOM(vnode, parent);\n return createElementFromVNode(vnode, parent, isSvg);\n }\n\n // Unknown \u2014 convert to text\n return document.createTextNode(String(vnode));\n}\n\n// --- Component Rendering ---\n// Components run ONCE. Props are passed as a signal for reactive access.\n\n// Shared Proxy handler for reactive props \u2014 defined once, reused by all components.\n// The Proxy target must be a plain object (not a function) so that ownKeys\n// invariants are satisfied. The propsSignal is stored as target._sig.\nconst _propsProxyHandler = {\n get(target, key) {\n if (key === '_sig') return undefined; // hide internal property\n if (key === '__proto__' || key === 'constructor' || key === 'prototype') return undefined;\n return target._sig()[key];\n },\n has(target, key) {\n if (key === '_sig') return false;\n return key in target._sig();\n },\n ownKeys(target) {\n return Reflect.ownKeys(target._sig());\n },\n getOwnPropertyDescriptor(target, key) {\n if (key === '_sig') return undefined;\n const current = target._sig();\n if (key in current) {\n return { value: current[key], writable: false, enumerable: true, configurable: true };\n }\n return undefined;\n },\n set(target, key) {\n // Props are read-only from the component's perspective.\n // Reject all writes \u2014 especially dangerous prototype-chain keys.\n return false;\n },\n};\n\nconst componentStack = [];\n\nexport function getCurrentComponent() {\n return componentStack[componentStack.length - 1];\n}\n\n// Inject into components.js and helpers.js to avoid circular imports\n_injectGetCurrentComponent(getCurrentComponent);\n_setComponentRef(getCurrentComponent);\n\nexport function getComponentStack() {\n return componentStack;\n}\n\nfunction createComponent(vnode, parent, isSvg) {\n let { tag: Component, props, children } = vnode;\n\n // Class component detection\n if (typeof Component === 'function' &&\n (Component.prototype?.isReactComponent || Component.prototype?.render)) {\n const ClassComp = Component;\n Component = function ClassComponentBridge(props) {\n const instance = new ClassComp(props);\n return instance.render();\n };\n Component.displayName = ClassComp.displayName || ClassComp.name || 'ClassComponent';\n }\n\n // Handle special boundary components\n if (Component === '__errorBoundary' || vnode.tag === '__errorBoundary') {\n return createErrorBoundary(vnode, parent);\n }\n if (Component === '__suspense' || vnode.tag === '__suspense') {\n return createSuspenseBoundary(vnode, parent);\n }\n if (Component === '__portal' || vnode.tag === '__portal') {\n return createPortalDOM(vnode, parent);\n }\n\n // Component context for hooks\n // Error boundary lookup: walk the parent chain once, cache the result.\n const parentCtx = componentStack[componentStack.length - 1] || null;\n let errorBoundary = null;\n if (parentCtx) {\n // Fast path: if parent has an error boundary, use it directly\n errorBoundary = parentCtx._errorBoundary || null;\n if (!errorBoundary) {\n let p = parentCtx._parentCtx;\n while (p) {\n if (p._errorBoundary) { errorBoundary = p._errorBoundary; break; }\n p = p._parentCtx;\n }\n }\n }\n const ctx = {\n hooks: [],\n hookIndex: 0,\n effects: [],\n cleanups: [],\n mounted: false,\n disposed: false,\n Component,\n _parentCtx: parentCtx,\n _errorBoundary: errorBoundary,\n };\n\n // Component boundaries: use comment nodes instead of <span style=\"display:contents\">\n // to avoid DOM pollution, CSS selector breakage, and a11y issues.\n const startComment = document.createComment('c:start');\n const endComment = document.createComment('c:end');\n _commentCtxMap.set(startComment, ctx);\n ctx._startComment = startComment;\n ctx._endComment = endComment;\n\n // Fragment to hold comment boundaries + component output\n const container = document.createDocumentFragment();\n container._componentCtx = ctx;\n ctx._wrapper = startComment; // Reference for context lookup\n\n // Track for disposal\n mountedComponents.add(ctx);\n if (__DEV__ && __devtools?.onComponentMount) __devtools.onComponentMount(ctx);\n\n // Props signal for reactive updates from parent\n const propsChildren = children.length === 0 ? undefined : children.length === 1 ? children[0] : children;\n // Merge children into props without spreading when possible\n let mergedProps;\n if (propsChildren !== undefined) {\n mergedProps = props ? Object.assign({}, props, { children: propsChildren }) : { children: propsChildren };\n } else {\n mergedProps = props ? Object.assign({}, props) : {};\n }\n const propsSignal = signal(mergedProps);\n ctx._propsSignal = propsSignal;\n\n // Create a reactive props proxy: reading any prop inside an effect\n // will auto-track the dependency on the propsSignal. This makes prop\n // access reactive across re-renders without requiring the component\n // to be re-executed.\n // Reuse shared trap handlers to minimize per-component allocation.\n // Store propsSignal on a plain object target (Proxy invariant: ownKeys must\n // match non-configurable own properties of target; functions have 'prototype').\n const reactiveProps = new Proxy({ _sig: propsSignal }, _propsProxyHandler);\n\n // Component runs ONCE \u2014 not inside an effect.\n // untrack() prevents the component's signal reads and effect creation\n // from being captured by any parent effect (e.g., reconcileInsert).\n // Without this, dynamically-rendered components leak their internal\n // reactivity into the parent, causing infinite re-creation loops.\n componentStack.push(ctx);\n\n let result;\n try {\n result = untrack(() => Component(reactiveProps));\n } catch (error) {\n componentStack.pop();\n if (!reportError(error, ctx)) {\n console.error('[what] Uncaught error in component:', Component.name || 'Anonymous', error);\n throw error;\n }\n // Return fragment with just comment boundaries on error\n container.appendChild(startComment);\n container.appendChild(endComment);\n return container;\n }\n\n componentStack.pop();\n ctx.mounted = true;\n\n // Run onMount callbacks after DOM is ready\n if (ctx._mountCallbacks) {\n queueMicrotask(() => {\n if (ctx.disposed) return;\n for (const fn of ctx._mountCallbacks) {\n try { fn(); } catch (e) { console.error('[what] onMount error:', e); }\n }\n });\n }\n\n // Build fragment: <!-- c:start --> [component output] <!-- c:end -->\n container.appendChild(startComment);\n const vnodes = Array.isArray(result) ? result : [result];\n for (const v of vnodes) {\n const node = createDOM(v, container, isSvg);\n if (node) container.appendChild(node);\n }\n container.appendChild(endComment);\n\n return container;\n}\n\n// Error boundary component handler\nfunction createErrorBoundary(vnode, parent) {\n const { errorState, handleError, fallback, reset } = vnode.props;\n const children = vnode.children;\n\n // Use comment node boundaries instead of <span style=\"display:contents\">\n // to avoid DOM pollution, CSS selector breakage, and a11y issues.\n const startComment = document.createComment('eb:start');\n const endComment = document.createComment('eb:end');\n\n const boundaryCtx = {\n hooks: [], hookIndex: 0, effects: [], cleanups: [],\n mounted: false, disposed: false,\n _parentCtx: componentStack[componentStack.length - 1] || null,\n _errorBoundary: handleError,\n _startComment: startComment,\n _endComment: endComment,\n };\n _commentCtxMap.set(startComment, boundaryCtx);\n\n const container = document.createDocumentFragment();\n container._componentCtx = boundaryCtx;\n container.appendChild(startComment);\n container.appendChild(endComment);\n\n const dispose = effect(() => {\n const error = errorState();\n\n componentStack.push(boundaryCtx);\n\n // Remove old content between comment boundaries\n if (startComment.parentNode) {\n while (startComment.nextSibling && startComment.nextSibling !== endComment) {\n const old = startComment.nextSibling;\n disposeTree(old);\n old.parentNode.removeChild(old);\n }\n }\n\n let vnodes;\n if (error) {\n vnodes = typeof fallback === 'function' ? [fallback({ error, reset })] : [fallback];\n } else {\n vnodes = children;\n }\n\n vnodes = Array.isArray(vnodes) ? vnodes : [vnodes];\n\n for (const v of vnodes) {\n const node = createDOM(v, parent);\n if (node) {\n // Insert before endComment\n if (endComment.parentNode) {\n endComment.parentNode.insertBefore(node, endComment);\n } else {\n // Still in fragment before first mount\n container.insertBefore(node, endComment);\n }\n }\n }\n\n componentStack.pop();\n });\n\n boundaryCtx.effects.push(dispose);\n return container;\n}\n\n// Suspense boundary component handler\nfunction createSuspenseBoundary(vnode, parent) {\n const { boundary, fallback, loading } = vnode.props;\n const children = vnode.children;\n\n // Use comment node boundaries instead of <span style=\"display:contents\">\n // to avoid DOM pollution, CSS selector breakage, and a11y issues.\n const startComment = document.createComment('sb:start');\n const endComment = document.createComment('sb:end');\n\n const boundaryCtx = {\n hooks: [], hookIndex: 0, effects: [], cleanups: [],\n mounted: false, disposed: false,\n _parentCtx: componentStack[componentStack.length - 1] || null,\n _startComment: startComment,\n _endComment: endComment,\n };\n _commentCtxMap.set(startComment, boundaryCtx);\n\n const container = document.createDocumentFragment();\n container._componentCtx = boundaryCtx;\n container.appendChild(startComment);\n container.appendChild(endComment);\n\n const dispose = effect(() => {\n const isLoading = loading();\n const vnodes = isLoading ? [fallback] : children;\n const normalized = Array.isArray(vnodes) ? vnodes : [vnodes];\n\n componentStack.push(boundaryCtx);\n\n // Remove old content between comment boundaries\n if (startComment.parentNode) {\n while (startComment.nextSibling && startComment.nextSibling !== endComment) {\n const old = startComment.nextSibling;\n disposeTree(old);\n old.parentNode.removeChild(old);\n }\n }\n\n for (const v of normalized) {\n const node = createDOM(v, parent);\n if (node) {\n // Insert before endComment\n if (endComment.parentNode) {\n endComment.parentNode.insertBefore(node, endComment);\n } else {\n // Still in fragment before first mount\n container.insertBefore(node, endComment);\n }\n }\n }\n\n componentStack.pop();\n });\n\n boundaryCtx.effects.push(dispose);\n return container;\n}\n\n// Portal component handler\nfunction createPortalDOM(vnode, parent) {\n const { container } = vnode.props;\n const children = vnode.children;\n\n if (!container) {\n console.warn('[what] Portal: target container not found');\n return document.createComment('portal:empty');\n }\n\n const portalCtx = {\n hooks: [], hookIndex: 0, effects: [], cleanups: [],\n mounted: false, disposed: false,\n _parentCtx: componentStack[componentStack.length - 1] || null,\n };\n\n const placeholder = document.createComment('portal');\n placeholder._componentCtx = portalCtx;\n\n const portalNodes = [];\n for (const child of children) {\n const node = createDOM(child, container);\n if (node) {\n container.appendChild(node);\n portalNodes.push(node);\n }\n }\n\n portalCtx._cleanupCallbacks = [() => {\n for (const node of portalNodes) {\n disposeTree(node);\n if (node.parentNode) node.parentNode.removeChild(node);\n }\n }];\n\n return placeholder;\n}\n\n// --- Create Element from VNode ---\n// For h()-based VNodes with string tags\n\nfunction createElementFromVNode(vnode, parent, isSvg) {\n const { tag, props, children } = vnode;\n\n const svgContext = isSvg || SVG_ELEMENTS.has(tag);\n const el = svgContext\n ? document.createElementNS(SVG_NS, tag)\n : document.createElement(tag);\n\n // Apply props\n if (props) {\n applyProps(el, props, {}, svgContext);\n }\n\n // Append children\n const isSvgChildren = svgContext && tag !== 'foreignObject';\n for (let i = 0; i < children.length; i++) {\n const node = createDOM(children[i], el, isSvgChildren);\n if (node) el.appendChild(node);\n }\n\n el._vnode = vnode;\n return el;\n}\n\n// --- Prop Application ---\n// Only applied once for fine-grained (no diffing). Reactive props use effects.\n\nfunction applyProps(el, newProps, oldProps, isSvg) {\n if (!newProps) return;\n\n for (const key in newProps) {\n if (key === 'key' || key === 'children') continue;\n\n // Handle ref\n if (key === 'ref') {\n const ref = newProps.ref;\n if (typeof ref === 'function') ref(el);\n else if (ref) ref.current = el;\n continue;\n }\n\n setProp(el, key, newProps[key], isSvg);\n }\n}\n\n// <select> needs its value set after <option> children mount. Setting it\n// immediately can fail if the matching <option> isn't in the DOM yet; the\n// microtask retry fixes up after the options are appended.\nexport function _setSelectValue(el, value) {\n el.value = value;\n if (el.value !== String(value)) {\n queueMicrotask(() => { el.value = value; });\n }\n}\n\n// NOTE: there are intentionally TWO `setProp` implementations in this codebase:\n// - dom.js setProp (this one) \u2014 h()/createDOM/diff-style path. Handles\n// addEventListener bookkeeping (el._events with capture variants and the\n// untrack wrapper), supports `isSvg` flag from the caller. Used by the\n// legacy diff-driven update path.\n// - render.js setProp \u2014 fine-grained-compiler output path. No event-handler\n// bookkeeping (events go through delegation / direct addEventListener at\n// compile time), but adds URL sanitization for href/src and the\n// innerHTML `{__html}` enforcement that the compiler relies on.\n// Both share the `el._propEffects[key]` disposer convention. Do not merge\n// without consolidating the event/listener model \u2014 they have different callers.\nfunction setProp(el, key, value, isSvg) {\n // Reactive function props \u2014 wrap in effect for fine-grained updates\n if (typeof value === 'function' && !(key.startsWith('on') && key.length > 2) && key !== 'ref') {\n if (!el._propEffects) el._propEffects = {};\n if (el._propEffects[key]) {\n try { el._propEffects[key](); } catch (e) { /* already disposed */ }\n }\n el._propEffects[key] = effect(() => {\n const resolved = value();\n setProp(el, key, resolved, isSvg);\n });\n return;\n }\n\n // Event handlers\n if (key.startsWith('on') && key.length > 2) {\n let eventName = key.slice(2);\n let useCapture = false;\n if (eventName.endsWith('Capture')) {\n eventName = eventName.slice(0, -7);\n useCapture = true;\n }\n const event = eventName.toLowerCase();\n const storageKey = useCapture ? event + '_capture' : event;\n const old = el._events?.[storageKey];\n if (old && old._original === value) return;\n if (old) el.removeEventListener(event, old, useCapture);\n if (value == null) return;\n if (!el._events) el._events = {};\n // Single closure per event listener. Uses untrack to prevent accidental\n // signal subscriptions inside event handlers.\n const wrappedHandler = (e) => {\n if (!e.nativeEvent) e.nativeEvent = e;\n return untrack(() => wrappedHandler._handler(e));\n };\n wrappedHandler._handler = value;\n wrappedHandler._original = value;\n el._events[storageKey] = wrappedHandler;\n const eventOpts = value._eventOpts;\n el.addEventListener(event, wrappedHandler, eventOpts || useCapture || undefined);\n return;\n }\n\n // className / class\n if (key === 'className' || key === 'class') {\n if (isSvg) {\n el.setAttribute('class', value || '');\n } else {\n el.className = value || '';\n }\n return;\n }\n\n // Style\n if (key === 'style') {\n if (typeof value === 'string') {\n el.style.cssText = value;\n el._prevStyle = null;\n } else if (typeof value === 'object') {\n const oldStyle = el._prevStyle || {};\n for (const prop in oldStyle) {\n if (!(prop in value)) el.style[prop] = '';\n }\n for (const prop in value) {\n el.style[prop] = value[prop] ?? '';\n }\n el._prevStyle = { ...value };\n }\n return;\n }\n\n // dangerouslySetInnerHTML\n if (key === 'dangerouslySetInnerHTML') {\n const html = value?.__html ?? '';\n if (__DEV__ && typeof html === 'string' && /(<script|onerror\\s*=|onload\\s*=|javascript:)/i.test(html)) {\n console.warn('[what] dangerouslySetInnerHTML contains potential XSS vectors. Ensure content is sanitized.');\n }\n el.innerHTML = html;\n return;\n }\n\n // innerHTML \u2014 require { __html: ... } wrapper to prevent XSS\n if (key === 'innerHTML') {\n if (value == null) return; // null/undefined \u2014 do nothing\n if (value && typeof value === 'object' && '__html' in value) {\n const html = value.__html ?? '';\n if (__DEV__ && typeof html === 'string' && /(<script|onerror\\s*=|onload\\s*=|javascript:)/i.test(html)) {\n console.warn('[what] dangerouslySetInnerHTML contains potential XSS vectors. Ensure content is sanitized.');\n }\n el.innerHTML = html;\n } else {\n if (__DEV__) {\n console.warn(\n '[what] innerHTML received a raw string. This is a security risk (XSS). ' +\n 'Use innerHTML={{ __html: trustedString }} or dangerouslySetInnerHTML={{ __html: trustedString }} instead.'\n );\n }\n // Refuse to set raw string innerHTML \u2014 prevent XSS\n return;\n }\n return;\n }\n\n // Boolean attributes\n if (typeof value === 'boolean') {\n if (value) el.setAttribute(key, '');\n else el.removeAttribute(key);\n return;\n }\n\n // data-* and aria-*\n if (key.startsWith('data-') || key.startsWith('aria-')) {\n el.setAttribute(key, value);\n return;\n }\n\n // SVG\n if (isSvg) {\n if (value === false || value == null) {\n el.removeAttribute(key);\n } else {\n el.setAttribute(key, value === true ? '' : String(value));\n }\n return;\n }\n\n // <select> value must be set after <option> children are in the DOM\n if (key === 'value' && el.tagName === 'SELECT') {\n _setSelectValue(el, value);\n return;\n }\n\n // Default: property if exists, otherwise attribute\n if (key in el) {\n el[key] = value;\n } else {\n el.setAttribute(key, value);\n }\n}\n"],
|
|
5
|
+
"mappings": "4CAUO,IAAMA,EAAU,SAAO,QAAY,KAM/BC,EAAa,KAGjB,SAASC,GAAmBC,EAAO,CACpCH,IAASC,EAAaE,EAC5B,CAEA,IAAIC,EAAgB,KAChBC,EAAc,KACdC,EAAe,KACfC,EAAiB,GACjBC,EAAa,EACbC,EAAiB,CAAC,EAClBC,EAAkB,GAUhBC,EAAiB,OAAO,gBAAgB,EAC1CC,EAAqB,KAelB,SAASC,EAAOC,EAASC,EAAW,CACzC,IAAIC,EAAQF,EACNG,EAAO,IAAI,IAIbC,EAAc,KACdC,EAAmB,EAIvB,SAASC,EAAUC,EAAM,CACnBrB,GAAWO,GACb,QAAQ,KACN,+GAECQ,EAAY,aAAaA,CAAS,IAAM,GAC3C,EAEF,IAAMO,EAAU,OAAOD,GAAS,WAAaA,EAAKL,CAAK,EAAIK,EAGvDL,IAAUM,GAAYN,IAAUA,GAASM,IAAYA,IACzDN,EAAQM,EAGRJ,EAAc,KACVlB,GAAWC,GAAYA,EAAW,eAAesB,CAAG,EACpDN,EAAK,KAAO,GAAGO,GAAOP,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AAQ,SAAW+D,EAAG,UAAY,SAAU,CAC9CO,GAAgBP,EAAI7E,CAAK,EACzB,MACF,CAGIc,KAAO+D,EACTA,EAAG/D,CAAG,EAAId,EAEV6E,EAAG,aAAa/D,EAAKd,CAAK,CAE9B",
|
|
6
|
+
"names": ["__DEV__", "__devtools", "__setDevToolsHooks", "hooks", "currentEffect", "currentRoot", "currentOwner", "insideComputed", "batchDepth", "pendingEffects", "pendingNeedSort", "NEEDS_UPSTREAM", "iterativeEvalStack", "signal", "initial", "debugName", "value", "subs", "lastTracked", "lastTrackedEpoch", "_sigWrite", "next", "nextVal", "sig", "notify", "newVal", "ce", "fn", "effect", "computed", "dirty", "inner", "_createEffect", "prevInsideComputed", "read", "_evaluateComputed", "computedEffect", "stack", "current", "pushedUpstream", "deps", "i", "depOwner", "prevDepsLen", "_runEffect", "_updateLevel", "err", "maxDepLevel", "owner", "depLevel", "_noopDispose", "opts", "e", "prev", "result", "dispose", "_disposeEffect", "batch", "flush", "lazy", "singleDep", "cleanup", "notifyDepth", "notifyQueue", "notifyQueueLen", "_processSubscriber", "level", "len", "qi", "queuedSubs", "scheduleMicrotask", "microtaskScheduled", "isFlushing", "iterations", "a", "b", "effectNames", "memo", "sub", "flushSync", "untrack", "getOwner", "runWithOwner", "prevRoot", "createRoot", "prevOwner", "root", "_disposeRoot", "idx", "_createItemScope", "scope", "onCleanup", "buffer", "ctx", "__drainPreinstallBuffer", "out", "buf", "__preinstallSnapshot", "ref", "v", "memo", "Component", "_areEqual", "MemoWrapper", "props", "_getCurrentComponent", "_injectGetCurrentComponent", "fn", "lazy", "loader", "Component", "loadPromise", "loadError", "listeners", "LazyWrapper", "props", "h", "mod", "fn", "err", "Suspense", "fallback", "children", "loading", "signal", "pendingPromises", "promise", "ErrorBoundary", "onError", "errorState", "error", "e", "reportError", "startCtx", "ctx", "_getCurrentComponent", "Show", "when", "For", "each", "list", "renderFn", "item", "index", "vnode", "Switch", "kids", "child", "Match", "Island", "mode", "mediaQuery", "placeholder", "wrapper", "hydrated", "doHydrate", "scheduleHydration", "el", "observer", "entries", "hydrate", "mq", "checkMedia", "refCallback", "_eachWarned", "each", "list", "fn", "keyFn", "item", "index", "vnode", "cls", "args", "classes", "arg", "key", "val", "style", "obj", "v", "k", "camelToKebab", "str", "debounce", "ms", "timer", "throttle", "last", "now", "_getCurrentComponentRef", "_setComponentRef", "useMediaQuery", "query", "signal", "mq", "s", "handler", "e", "ctx", "useLocalStorage", "initial", "stored", "raw", "dispose", "effect", "__DEV__", "storageHandler", "err", "Portal", "target", "children", "container", "useClickOutside", "ref", "listener", "el", "transition", "name", "active", "SVG_ELEMENTS", "SVG_NS", "mountedComponents", "_commentCtxMap", "isDomNode", "value", "isVNode", "disposeComponent", "ctx", "cleanup", "e", "dispose", "hook", "fn", "__DEV__", "__devtools", "disposeTree", "node", "commentCtx", "key", "children", "i", "mount", "vnode", "container", "createDOM", "parent", "isSvg", "startMarker", "endMarker", "currentNodes", "frag", "effect", "val", "vnodes", "realParent", "old", "v", "child", "createComponent", "createErrorBoundary", "createSuspenseBoundary", "createPortalDOM", "createElementFromVNode", "_propsProxyHandler", "target", "current", "componentStack", "getCurrentComponent", "_injectGetCurrentComponent", "_setComponentRef", "getComponentStack", "Component", "props", "ClassComp", "parentCtx", "errorBoundary", "p", "startComment", "endComment", "propsChildren", "mergedProps", "propsSignal", "signal", "reactiveProps", "result", "untrack", "error", "reportError", "errorState", "handleError", "fallback", "reset", "boundaryCtx", "boundary", "loading", "normalized", "portalCtx", "placeholder", "portalNodes", "tag", "svgContext", "el", "applyProps", "isSvgChildren", "newProps", "oldProps", "ref", "setProp", "_setSelectValue", "resolved", "eventName", "useCapture", "event", "storageKey", "wrappedHandler", "eventOpts", "oldStyle", "prop", "html"]
|
|
7
|
+
}
|