eclipsa 0.1.7 → 0.1.9

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.
@@ -1 +0,0 @@
1
- {"version":3,"file":"client-DKPmN-wJ.mjs","names":[],"sources":["../core/client/dom.ts","../core/reactive/core.ts"],"sourcesContent":["import { jsxDEV } from '../../jsx/jsx-dev-runtime.ts'\nimport type { Component } from '../component.ts'\nimport { getComponentMeta } from '../internal.ts'\nimport {\n INSERT_MARKER_PREFIX,\n createInsertMarker,\n parseComponentBoundaryMarker,\n parseInsertMarker,\n} from '../runtime/markers.ts'\nimport {\n assignRuntimeRef,\n bindRuntimeEvent,\n captureClientInsertOwner,\n createDetachedClientInsertOwner,\n getRuntimeSignalId,\n getRuntimeContainer,\n preserveReusableContentInRoots,\n rememberManagedAttributesForNode,\n rememberManagedAttributesForNodes,\n rememberInsertMarkerRange,\n getRememberedInsertMarkerNodeCount,\n renderClientInsertable,\n renderClientInsertableForOwner,\n restoreSignalRefs,\n syncManagedAttributeSnapshot,\n syncRuntimeRefMarker,\n shouldReconnectDetachedInsertMarkers,\n tryPatchElementShellInPlace,\n tryPatchNodeSequenceInPlace,\n} from '../runtime.ts'\nimport { effect } from '../signal.ts'\nimport { isSuspenseType } from '../suspense.ts'\nimport { withSignalSnapshot } from '../snapshot.ts'\nimport type { ClientElementLike, Insertable } from './types.ts'\n\nconst EMPTY_INSERT_COMMENT = 'eclipsa-empty'\nconst ATTR_UNSET = Symbol('eclipsa.attr-unset')\n\nconst ensureInsertMarkerKey = (\n marker: Node | undefined,\n runtimeContainer: ReturnType<typeof getRuntimeContainer>,\n) => {\n if (!(marker instanceof Comment) || !runtimeContainer) {\n return null\n }\n\n if (marker.data.startsWith(INSERT_MARKER_PREFIX)) {\n return marker.data\n }\n\n const key = createInsertMarker(runtimeContainer.nextElementId++)\n marker.data = key\n return key\n}\n\nconst findLiveInsertMarker = (doc: Document | undefined, markerKey: string | null) => {\n if (!doc?.body || !markerKey || typeof doc.createTreeWalker !== 'function') {\n return null\n }\n\n const walker = doc.createTreeWalker(doc.body, NodeFilter.SHOW_COMMENT)\n let next = walker.nextNode()\n while (next) {\n if (next instanceof Comment && next.data === markerKey) {\n return next\n }\n next = walker.nextNode()\n }\n return null\n}\n\nconst isConnectedNode = (node: Node | null | undefined) =>\n !!node &&\n (!('isConnected' in node) ||\n (\n node as Node & {\n isConnected?: boolean\n }\n ).isConnected !== false)\n\nconst isUsableInsertParent = (\n candidate: Node | null | undefined,\n stableParents: Array<Node | null | undefined>,\n) => !!candidate && (isConnectedNode(candidate) || stableParents.includes(candidate))\n\nconst removeNodeFromParent = (node: Node, parent: Node) => {\n const removable = node as Node & {\n remove?: () => void\n }\n if (typeof removable.remove === 'function') {\n removable.remove()\n return\n }\n\n const parentWithRemoveChild = parent as Node & {\n removeChild?: (child: Node) => Node\n }\n if (typeof parentWithRemoveChild.removeChild === 'function') {\n parentWithRemoveChild.removeChild(node)\n }\n}\n\nconst hasUsableInsertParent = (\n node: Node | null | undefined,\n stableParents: Array<Node | null | undefined>,\n) => isUsableInsertParent(node?.parentNode, stableParents)\n\nconst collectNodesBeforeMarker = (marker: Node | null | undefined, count: number) => {\n if (!marker?.parentNode || count === 0) {\n return [] as Node[]\n }\n\n const nodes: Node[] = []\n let cursor = marker.previousSibling\n while (cursor && nodes.length < count) {\n nodes.unshift(cursor)\n cursor = cursor.previousSibling\n }\n\n return nodes.length === count ? nodes : []\n}\n\nconst getBoundaryMarker = (node: Node | null | undefined) => {\n if (!(node instanceof Comment)) {\n return null\n }\n\n return parseComponentBoundaryMarker(node.data)\n}\n\nconst canReconnectOwnerRange = (currentNodes: Node[], newNodes: Node[]) => {\n if (currentNodes.length === 0 || currentNodes.length !== newNodes.length) {\n return false\n }\n\n let sawBoundary = false\n\n for (let index = 0; index < newNodes.length; index += 1) {\n const currentNode = currentNodes[index]!\n const newNode = newNodes[index]!\n if (currentNode.nodeType !== newNode.nodeType) {\n return false\n }\n\n const currentBoundary = getBoundaryMarker(currentNode)\n const newBoundary = getBoundaryMarker(newNode)\n if (currentBoundary || newBoundary) {\n if (\n !currentBoundary ||\n !newBoundary ||\n currentBoundary.kind !== newBoundary.kind ||\n currentBoundary.id !== newBoundary.id\n ) {\n return false\n }\n sawBoundary = true\n continue\n }\n\n if (currentNode instanceof Element && newNode instanceof Element) {\n if (currentNode.tagName !== newNode.tagName) {\n return false\n }\n continue\n }\n\n if (currentNode.nodeType === Node.TEXT_NODE && newNode.nodeType === Node.TEXT_NODE) {\n continue\n }\n\n return false\n }\n\n return sawBoundary\n}\n\nconst resolveFastInsertValue = (value: unknown) => {\n let resolved = value\n while (typeof resolved === 'function') {\n resolved = resolved()\n }\n\n if (resolved === null || resolved === undefined || resolved === false) {\n return {\n kind: 'empty' as const,\n }\n }\n\n if (\n typeof resolved === 'string' ||\n typeof resolved === 'number' ||\n typeof resolved === 'boolean'\n ) {\n return {\n kind: 'text' as const,\n value: String(resolved),\n }\n }\n\n return null\n}\n\nconst isManagedEmptyInsertComment = (node: Node | null | undefined) =>\n node instanceof Comment && node.data === EMPTY_INSERT_COMMENT\n\nconst getElementStyleDeclaration = (elem: Element) => {\n const style = (\n elem as Element & {\n style?: {\n removeProperty?: (name: string) => string\n setProperty?: (name: string, value: string) => void\n }\n }\n ).style\n\n return style &&\n typeof style === 'object' &&\n typeof style.setProperty === 'function' &&\n typeof style.removeProperty === 'function'\n ? (style as {\n removeProperty: (name: string) => string\n setProperty: (name: string, value: string) => void\n })\n : null\n}\n\nconst serializeStyleValue = (resolved: unknown) =>\n resolved && typeof resolved === 'object'\n ? Object.entries(resolved as Record<string, string>)\n .map(([k, v]) => `${k}: ${v}`)\n .join('; ')\n : String(resolved ?? '')\n\nexport const createTemplate = (html: string): (() => Node) => {\n let template: HTMLTemplateElement | null = null\n\n return () => {\n if (!template) {\n template = document.createElement('template')\n template.innerHTML = html\n }\n const node = (template.cloneNode(true) as HTMLTemplateElement).content.firstChild as Node\n rememberManagedAttributesForNode(node)\n return node\n }\n}\n\nexport const insert = (value: Insertable, parent: Node, marker?: Node) => {\n let lastFirstNode = marker\n let lastNodeLength = 0\n const runtimeContainer = getRuntimeContainer()\n if (!runtimeContainer) {\n throw new Error('Client insertions require an active runtime container.')\n }\n const ownerSiteKey =\n marker instanceof Comment && !parseInsertMarker(marker.data) ? marker.data : null\n const owner =\n captureClientInsertOwner(runtimeContainer, ownerSiteKey) ??\n createDetachedClientInsertOwner(runtimeContainer)\n const markerKey = ensureInsertMarkerKey(marker, runtimeContainer)\n const collectCurrentNodes = (\n liveMarker: Node | undefined,\n stableParents: Array<Node | null | undefined>,\n ) => {\n if (\n !lastFirstNode ||\n lastNodeLength === 0 ||\n !hasUsableInsertParent(lastFirstNode, stableParents)\n ) {\n const liveNodes = collectNodesBeforeMarker(liveMarker, lastNodeLength)\n return liveNodes.every((node) => hasUsableInsertParent(node, stableParents)) ? liveNodes : []\n }\n const nodes = [lastFirstNode]\n let cursor = lastFirstNode\n while (nodes.length < lastNodeLength) {\n const next = cursor.nextSibling\n if (!next || !hasUsableInsertParent(next, stableParents)) {\n return [] as Node[]\n }\n cursor = next\n nodes.push(cursor)\n }\n return nodes\n }\n\n effect(() => {\n const shouldReconnect = shouldReconnectDetachedInsertMarkers(runtimeContainer)\n const liveMarker = !(marker instanceof Comment)\n ? marker\n : isConnectedNode(marker.parentNode)\n ? marker\n : shouldReconnect\n ? (findLiveInsertMarker(runtimeContainer.doc, markerKey) ?? marker)\n : marker\n const stableParents = liveMarker?.parentNode\n ? [liveMarker.parentNode, parent === liveMarker.parentNode ? parent : null]\n : [parent, marker?.parentNode]\n const liveLastParent = isUsableInsertParent(lastFirstNode?.parentNode, stableParents)\n ? lastFirstNode?.parentNode\n : null\n const liveMarkerParent = isUsableInsertParent(liveMarker?.parentNode, stableParents)\n ? liveMarker?.parentNode\n : null\n const resolvedParent = (liveLastParent ?? liveMarkerParent ?? parent) as ParentNode | null\n const targetParent = resolvedParent ?? (parent as ParentNode)\n const primitiveValue = resolveFastInsertValue(value)\n const seedCurrentNodes = (count: number) =>\n lastNodeLength === 0 &&\n liveMarker instanceof Comment &&\n getRememberedInsertMarkerNodeCount(liveMarker) === count\n ? collectNodesBeforeMarker(liveMarker, count)\n : []\n const replaceCurrentNodes = (currentNodes: Node[], replacementNode: Node) => {\n const insertReference =\n liveMarker?.parentNode === targetParent\n ? liveMarker\n : (currentNodes[currentNodes.length - 1]?.nextSibling ?? null)\n for (const node of currentNodes) {\n if (node.parentNode === targetParent) {\n removeNodeFromParent(node, targetParent)\n }\n }\n targetParent.insertBefore(replacementNode, insertReference)\n rememberInsertMarkerRange(liveMarker, [replacementNode])\n lastFirstNode = replacementNode\n lastNodeLength = 1\n }\n\n if (primitiveValue) {\n const seededCurrentNodes = seedCurrentNodes(1)\n const currentNodes =\n seededCurrentNodes.length !== 0 &&\n seededCurrentNodes.every((node) => hasUsableInsertParent(node, stableParents))\n ? seededCurrentNodes\n : collectCurrentNodes(liveMarker, stableParents)\n\n if (currentNodes.length !== 0 && lastNodeLength === 0) {\n lastFirstNode = currentNodes[0]\n lastNodeLength = currentNodes.length\n }\n\n if (primitiveValue.kind === 'text') {\n if (currentNodes.length === 1 && currentNodes[0] instanceof Text) {\n if (currentNodes[0].data !== primitiveValue.value) {\n currentNodes[0].data = primitiveValue.value\n }\n rememberInsertMarkerRange(liveMarker, currentNodes)\n lastFirstNode = currentNodes[0]\n lastNodeLength = 1\n return\n }\n\n const doc = runtimeContainer.doc ?? targetParent.ownerDocument\n if (!doc) {\n throw new Error('Client insertions require an active runtime document.')\n }\n\n replaceCurrentNodes(currentNodes, doc.createTextNode(primitiveValue.value))\n return\n }\n\n if (currentNodes.length === 1 && isManagedEmptyInsertComment(currentNodes[0])) {\n rememberInsertMarkerRange(liveMarker, currentNodes)\n lastFirstNode = currentNodes[0]\n lastNodeLength = 1\n return\n }\n\n const doc = runtimeContainer.doc ?? targetParent.ownerDocument\n if (!doc) {\n throw new Error('Client insertions require an active runtime document.')\n }\n\n replaceCurrentNodes(currentNodes, doc.createComment(EMPTY_INSERT_COMMENT))\n return\n }\n\n const newNodes = owner\n ? renderClientInsertableForOwner(value, runtimeContainer, owner)\n : renderClientInsertable(value, runtimeContainer)\n const seededCurrentNodes = seedCurrentNodes(newNodes.length)\n const currentNodes =\n seededCurrentNodes.length !== 0 &&\n seededCurrentNodes.every((node) => hasUsableInsertParent(node, stableParents)) &&\n canReconnectOwnerRange(seededCurrentNodes, newNodes)\n ? seededCurrentNodes\n : collectCurrentNodes(liveMarker, stableParents)\n\n if (currentNodes.length !== 0 && lastNodeLength === 0) {\n lastFirstNode = currentNodes[0]\n lastNodeLength = currentNodes.length\n }\n\n if (\n currentNodes.length === lastNodeLength &&\n currentNodes.length !== 0 &&\n newNodes.length !== 0 &&\n (tryPatchNodeSequenceInPlace(currentNodes, newNodes) ||\n tryPatchSingleElementShellInPlace(currentNodes, newNodes))\n ) {\n restoreSignalRefs(runtimeContainer, targetParent)\n rememberInsertMarkerRange(liveMarker, currentNodes)\n lastFirstNode = currentNodes[0]\n lastNodeLength = currentNodes.length\n return\n }\n\n let replacementNodes = newNodes\n if (currentNodes.length !== 0 && newNodes.length !== 0) {\n const doc = runtimeContainer.doc\n if (!doc) {\n throw new Error('Client insertions require an active runtime document.')\n }\n const stagingParent = doc.createElement('div')\n for (const node of newNodes) {\n stagingParent.appendChild(node)\n }\n preserveReusableContentInRoots(currentNodes, Array.from(stagingParent.childNodes))\n replacementNodes = Array.from(stagingParent.childNodes)\n }\n\n const insertReference = liveMarker?.parentNode === targetParent ? liveMarker : null\n for (const node of currentNodes) {\n if (node.parentNode === targetParent) {\n removeNodeFromParent(node, targetParent)\n }\n }\n for (const node of replacementNodes) {\n targetParent.insertBefore(node, insertReference)\n }\n\n rememberManagedAttributesForNodes(replacementNodes)\n rememberInsertMarkerRange(liveMarker, replacementNodes)\n\n lastFirstNode = replacementNodes[0] ?? liveMarker\n lastNodeLength = replacementNodes.length\n })\n}\n\nconst EVENT_ATTR_REGEX = /^on[A-Z].+$/\nconst DANGEROUSLY_SET_INNER_HTML_PROP = 'dangerouslySetInnerHTML'\nconst BIND_VALUE_PROP = 'bind:value'\nconst BIND_CHECKED_PROP = 'bind:checked'\nconst BIND_VALUE_ATTR = 'data-e-bind-value'\nconst BIND_CHECKED_ATTR = 'data-e-bind-checked'\nconst shouldUseAttributeAssignment = (elem: Element, name: string, isSVG: boolean) =>\n isSVG || name.startsWith('data-') || name.startsWith('aria-') || !(name in elem)\n\ntype BindableSignal<T> = {\n value: T\n}\n\nconst isBindableSignal = <T>(value: unknown): value is BindableSignal<T> =>\n !!value && (typeof value === 'object' || typeof value === 'function') && 'value' in value\n\nconst readValueBinding = (elem: Element, currentValue: unknown) => {\n if (\n elem instanceof HTMLInputElement &&\n typeof currentValue === 'number' &&\n (elem.type === 'number' || elem.type === 'range') &&\n !Number.isNaN(elem.valueAsNumber)\n ) {\n return elem.valueAsNumber\n }\n\n return (elem as HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement).value\n}\n\nconst tryPatchSingleElementShellInPlace = (currentNodes: Node[], nextNodes: Node[]) => {\n if (currentNodes.length !== 1 || nextNodes.length !== 1) {\n return false\n }\n\n const [current] = currentNodes\n const [next] = nextNodes\n if (\n !(current instanceof Element) ||\n !(next instanceof Element) ||\n current.tagName !== next.tagName\n ) {\n return false\n }\n return tryPatchElementShellInPlace(current, next)\n}\n\nexport const attr = (elem: Element, name: string, value: () => unknown) => {\n const isSVG = elem.namespaceURI === 'http://www.w3.org/2000/svg'\n\n if (name === BIND_VALUE_PROP) {\n let lastSignalId = ATTR_UNSET as string | symbol | null\n const readBinding = () => {\n const binding = value()\n const signalId = getRuntimeSignalId(binding)\n if (signalId !== lastSignalId) {\n if (signalId) {\n elem.setAttribute(BIND_VALUE_ATTR, signalId)\n } else {\n elem.removeAttribute(BIND_VALUE_ATTR)\n }\n syncManagedAttributeSnapshot(elem, BIND_VALUE_ATTR)\n lastSignalId = signalId\n }\n return binding\n }\n\n const syncSignalFromElement = () => {\n const binding = readBinding()\n if (!isBindableSignal(binding)) {\n return\n }\n binding.value = readValueBinding(elem, binding.value) as never\n }\n\n elem.addEventListener('input', syncSignalFromElement)\n elem.addEventListener('change', syncSignalFromElement)\n\n effect(() => {\n const binding = readBinding()\n if (!isBindableSignal(binding)) {\n return\n }\n const input = elem as HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement\n const nextValue = String(binding.value ?? '')\n if (input.value !== nextValue) {\n input.value = nextValue\n }\n })\n return\n }\n\n if (name === BIND_CHECKED_PROP) {\n if (!(elem instanceof HTMLInputElement)) {\n return\n }\n\n let lastSignalId = ATTR_UNSET as string | symbol | null\n const readBinding = () => {\n const binding = value()\n const signalId = getRuntimeSignalId(binding)\n if (signalId !== lastSignalId) {\n if (signalId) {\n elem.setAttribute(BIND_CHECKED_ATTR, signalId)\n } else {\n elem.removeAttribute(BIND_CHECKED_ATTR)\n }\n syncManagedAttributeSnapshot(elem, BIND_CHECKED_ATTR)\n lastSignalId = signalId\n }\n return binding\n }\n\n const syncSignalFromElement = () => {\n const binding = readBinding()\n if (!isBindableSignal(binding)) {\n return\n }\n binding.value = elem.checked as never\n }\n\n elem.addEventListener('input', syncSignalFromElement)\n elem.addEventListener('change', syncSignalFromElement)\n\n effect(() => {\n const binding = readBinding()\n if (!isBindableSignal(binding)) {\n return\n }\n const nextChecked = Boolean(binding.value)\n if (elem.checked !== nextChecked) {\n elem.checked = nextChecked\n }\n })\n return\n }\n\n if (EVENT_ATTR_REGEX.test(name)) {\n const eventName = name[2].toLowerCase() + name.slice(3)\n const resolved = value()\n if (bindRuntimeEvent(elem, eventName, resolved)) {\n return\n }\n if (typeof resolved !== 'function') {\n throw new Error('Resumable event bindings require an active runtime container.')\n }\n elem.addEventListener(eventName, resolved as () => void)\n return\n }\n\n if (name === 'style') {\n let lastStyleString = ATTR_UNSET as string | symbol\n let lastStyleMap: Map<string, string> | null = null\n const style = getElementStyleDeclaration(elem)\n\n effect(() => {\n const resolved = value()\n if (style && resolved && typeof resolved === 'object') {\n const nextStyleMap = new Map(\n Object.entries(resolved as Record<string, string>).map(([styleName, styleValue]) => [\n styleName,\n String(styleValue),\n ]),\n )\n\n for (const [styleName, styleValue] of nextStyleMap) {\n if (lastStyleMap?.get(styleName) !== styleValue) {\n style.setProperty(styleName, styleValue)\n }\n }\n\n if (lastStyleMap) {\n for (const styleName of lastStyleMap.keys()) {\n if (!nextStyleMap.has(styleName)) {\n style.removeProperty(styleName)\n }\n }\n }\n\n lastStyleMap = nextStyleMap\n lastStyleString = ATTR_UNSET\n syncManagedAttributeSnapshot(elem, 'style')\n return\n }\n\n lastStyleMap = null\n const styleValue = serializeStyleValue(resolved)\n if (lastStyleString === styleValue) {\n return\n }\n elem.setAttribute('style', styleValue)\n lastStyleString = styleValue\n syncManagedAttributeSnapshot(elem, 'style')\n })\n return\n }\n\n if (name === 'class') {\n let lastClassValue = ATTR_UNSET as string | symbol\n effect(() => {\n const nextClassValue = String(value())\n if (lastClassValue === nextClassValue) {\n return\n }\n if (isSVG) {\n elem.setAttribute('class', nextClassValue)\n syncManagedAttributeSnapshot(elem, 'class')\n } else {\n ;(elem as Element & { className: string }).className = nextClassValue\n syncManagedAttributeSnapshot(elem, 'class')\n }\n lastClassValue = nextClassValue\n })\n return\n }\n\n if (name === 'ref') {\n const resolved = value()\n syncRuntimeRefMarker(elem, resolved)\n assignRuntimeRef(resolved, elem, getRuntimeContainer())\n return\n }\n\n if (name === DANGEROUSLY_SET_INNER_HTML_PROP) {\n let lastHTML = ATTR_UNSET as string | symbol\n effect(() => {\n const html = value()\n const nextHTML = html === false || html === undefined || html === null ? '' : String(html)\n if (lastHTML === nextHTML) {\n return\n }\n ;(elem as Element & { innerHTML: string }).innerHTML = nextHTML\n lastHTML = nextHTML\n })\n return\n }\n\n let lastAssignedValue = ATTR_UNSET as string | symbol\n effect(() => {\n const nextValue = String(value())\n if (lastAssignedValue === nextValue) {\n return\n }\n if (shouldUseAttributeAssignment(elem, name, isSVG)) {\n elem.setAttribute(name, nextValue)\n syncManagedAttributeSnapshot(elem, name)\n } else {\n // @ts-expect-error DOM property assignment uses dynamic keys.\n elem[name] = nextValue\n syncManagedAttributeSnapshot(elem, name)\n }\n lastAssignedValue = nextValue\n })\n}\n\nexport const hydrate = (\n Component: Component,\n target: HTMLElement,\n options?: {\n snapshot?: unknown[]\n },\n) => {\n const elem = withSignalSnapshot(options?.snapshot ?? null, () => Component({}))\n .result as unknown as ClientElementLike\n\n while (target.childNodes.length > 0) {\n target.lastChild?.remove()\n }\n\n for (const entry of Array.isArray(elem) ? elem : [elem]) {\n insert(() => entry, target)\n }\n}\n\nexport const createComponent = (Component: Component, props: unknown) => {\n if (isSuspenseType(Component)) {\n return () => jsxDEV(Component, props as Record<string, unknown>, null, false, {})\n }\n if (!getComponentMeta(Component)) {\n const render = Component as (props: unknown) => unknown\n return () => render(props) as ClientElementLike\n }\n return () => jsxDEV(Component, props as Record<string, unknown>, null, false, {})\n}\n","export interface Signal<T> {\n get(): T\n set(newValue: T): T\n effects: Set<Effect>\n}\n\ninterface Effect {\n fn: () => void\n signals: Set<Signal<unknown>>\n}\nlet currentEffect: Effect | null = null\n\nconst isPrimitiveSignalValue = (value: unknown) =>\n value === null || (typeof value !== 'object' && typeof value !== 'function')\n\nconst didSignalValueChange = (previous: unknown, next: unknown) => {\n if (isPrimitiveSignalValue(previous) && isPrimitiveSignalValue(next)) {\n return !Object.is(previous, next)\n }\n\n return previous !== next\n}\n\nexport const signal = <T>(init: T): Signal<T> => {\n let value = init\n const signal: Signal<T> = {\n get() {\n if (currentEffect) {\n this.effects.add(currentEffect)\n }\n return value\n },\n set(newValue) {\n if (!didSignalValueChange(value, newValue)) {\n return value\n }\n value = newValue\n for (const effect of this.effects) {\n effect.fn()\n }\n return value\n },\n effects: new Set(),\n }\n return signal\n}\n\nconst registry = new FinalizationRegistry<Effect>((effect) => {\n for (const signal of effect.signals) {\n signal.effects.delete(effect)\n }\n})\n\nexport const effect = (fn: () => void) => {\n const newEffect: Effect = {\n fn() {\n fn()\n },\n signals: new Set(),\n }\n\n currentEffect = newEffect\n newEffect.fn()\n currentEffect = null\n\n registry.register(fn, newEffect)\n}\n"],"mappings":";;;;;AAmCA,MAAM,uBAAuB;AAC7B,MAAM,aAAa,OAAO,qBAAqB;AAE/C,MAAM,yBACJ,QACA,qBACG;AACH,KAAI,EAAE,kBAAkB,YAAY,CAAC,iBACnC,QAAO;AAGT,KAAI,OAAO,KAAK,WAAA,QAAgC,CAC9C,QAAO,OAAO;CAGhB,MAAM,MAAM,mBAAmB,iBAAiB,gBAAgB;AAChE,QAAO,OAAO;AACd,QAAO;;AAGT,MAAM,wBAAwB,KAA2B,cAA6B;AACpF,KAAI,CAAC,KAAK,QAAQ,CAAC,aAAa,OAAO,IAAI,qBAAqB,WAC9D,QAAO;CAGT,MAAM,SAAS,IAAI,iBAAiB,IAAI,MAAM,WAAW,aAAa;CACtE,IAAI,OAAO,OAAO,UAAU;AAC5B,QAAO,MAAM;AACX,MAAI,gBAAgB,WAAW,KAAK,SAAS,UAC3C,QAAO;AAET,SAAO,OAAO,UAAU;;AAE1B,QAAO;;AAGT,MAAM,mBAAmB,SACvB,CAAC,CAAC,SACD,EAAE,iBAAiB,SAEhB,KAGA,gBAAgB;AAEtB,MAAM,wBACJ,WACA,kBACG,CAAC,CAAC,cAAc,gBAAgB,UAAU,IAAI,cAAc,SAAS,UAAU;AAEpF,MAAM,wBAAwB,MAAY,WAAiB;CACzD,MAAM,YAAY;AAGlB,KAAI,OAAO,UAAU,WAAW,YAAY;AAC1C,YAAU,QAAQ;AAClB;;CAGF,MAAM,wBAAwB;AAG9B,KAAI,OAAO,sBAAsB,gBAAgB,WAC/C,uBAAsB,YAAY,KAAK;;AAI3C,MAAM,yBACJ,MACA,kBACG,qBAAqB,MAAM,YAAY,cAAc;AAE1D,MAAM,4BAA4B,QAAiC,UAAkB;AACnF,KAAI,CAAC,QAAQ,cAAc,UAAU,EACnC,QAAO,EAAE;CA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