@torpor/view 0.0.11 → 0.0.13
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/CHANGELOG.md +12 -0
- package/dist/{ServerSlotRender-AWF3bD5B.d.cts → ServerSlotRender-t1sOutne.d.cts} +1 -1
- package/dist/{ServerSlotRender-AWF3bD5B.d.ts → ServerSlotRender-t1sOutne.d.ts} +1 -1
- package/dist/{chunk-GO2L324Q.js → chunk-T6JGCJ5T.js} +5 -2
- package/dist/chunk-T6JGCJ5T.js.map +1 -0
- package/dist/compile.cjs +42 -31
- package/dist/compile.cjs.map +1 -1
- package/dist/compile.d.cts +1 -0
- package/dist/compile.d.ts +1 -0
- package/dist/compile.js +42 -31
- package/dist/compile.js.map +1 -1
- package/dist/index.cjs +4 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/metafile-cjs.json +1 -1
- package/dist/metafile-esm.json +1 -1
- package/dist/ssr.cjs +4 -1
- package/dist/ssr.cjs.map +1 -1
- package/dist/ssr.d.cts +2 -2
- package/dist/ssr.d.ts +2 -2
- package/dist/ssr.js +1 -1
- package/dist/ssr.js.map +1 -1
- package/package.json +6 -6
- package/scripts/buildTestOutput.ts +2 -121
- package/src/compile/build/client/buildAddFragment.ts +1 -1
- package/src/compile/build/client/buildAwaitNode.ts +1 -1
- package/src/compile/build/client/buildComponentNode.ts +1 -1
- package/src/compile/build/client/buildControlNode.ts +1 -1
- package/src/compile/build/client/buildElementNode.ts +7 -1
- package/src/compile/build/client/buildForNode.ts +1 -1
- package/src/compile/build/client/buildFragment.ts +1 -1
- package/src/compile/build/client/buildFragmentText.ts +7 -1
- package/src/compile/build/client/buildHeadNode.ts +1 -1
- package/src/compile/build/client/buildHtmlNode.ts +1 -1
- package/src/compile/build/client/buildIfNode.ts +1 -1
- package/src/compile/build/client/buildMount.ts +1 -1
- package/src/compile/build/client/buildNode.ts +1 -1
- package/src/compile/build/client/buildReplaceNode.ts +1 -1
- package/src/compile/build/client/buildRootNode.ts +1 -1
- package/src/compile/build/client/buildRun.ts +1 -1
- package/src/compile/build/client/buildScriptNode.ts +1 -1
- package/src/compile/build/client/buildSlotNode.ts +1 -1
- package/src/compile/build/client/buildSwitchNode.ts +1 -1
- package/src/compile/build/client/buildTextNode.ts +1 -1
- package/src/compile/build/client/replaceForVarNames.ts +1 -1
- package/src/compile/build/server/buildServerAwaitNode.ts +1 -1
- package/src/compile/build/server/buildServerComponentNode.ts +1 -1
- package/src/compile/build/server/buildServerControlNode.ts +1 -1
- package/src/compile/build/server/buildServerElementNode.ts +9 -1
- package/src/compile/build/server/buildServerForNode.ts +1 -1
- package/src/compile/build/server/buildServerHtmlNode.ts +1 -1
- package/src/compile/build/server/buildServerIfNode.ts +1 -1
- package/src/compile/build/server/buildServerNode.ts +5 -1
- package/src/compile/build/server/buildServerReplaceNode.ts +1 -1
- package/src/compile/build/server/buildServerRootNode.ts +5 -1
- package/src/compile/build/server/buildServerScriptNode.ts +1 -1
- package/src/compile/build/server/buildServerSlotNode.ts +1 -1
- package/src/compile/build/server/buildServerSpecialNode.ts +1 -1
- package/src/compile/build/server/buildServerSwitchNode.ts +1 -1
- package/src/compile/build/server/buildServerTextNode.ts +1 -1
- package/src/compile/build/utils/isFullyReactive.ts +1 -1
- package/src/compile/build/utils/isReactive.ts +1 -1
- package/src/compile/build/utils/isReactiveAttribute.ts +1 -1
- package/src/compile/parse/addSpaceElement.ts +4 -1
- package/src/compile/parse/parseCode.ts +4 -0
- package/src/compile/parse/parseControl.ts +4 -1
- package/src/compile/parse/parseImports.ts +1 -1
- package/src/compile/parse/parseMarkup.ts +1 -1
- package/src/compile/parse/parseStyles.ts +1 -1
- package/src/compile/parse/scopeStyles.ts +13 -21
- package/src/compile/parse/slottifyChildNodes.ts +1 -1
- package/src/compile/parse/utils/addError.ts +5 -1
- package/src/compile/parse/utils/consumeUntil.ts +1 -1
- package/src/compile/parse/utils/isAlphaNumeric.ts +1 -1
- package/src/compile/parse/utils/isAlphaNumericChar.ts +1 -1
- package/src/compile/parse/utils/isSpace.ts +1 -1
- package/src/compile/parse/utils/isSpaceChar.ts +1 -1
- package/src/compile/types/nodes/TemplateNode.ts +3 -0
- package/src/compile/utils/Builder.ts +3 -3
- package/src/compile/utils/trimEnd.ts +1 -1
- package/src/compile/utils/trimMatched.ts +1 -1
- package/src/compile/utils/trimQuotes.ts +1 -1
- package/src/compile/utils/trimStart.ts +1 -1
- package/src/compile/utils/trimStartAndEnd.ts +1 -1
- package/src/compile/utils/voidTags.ts +1 -1
- package/src/debug/printHtml.ts +1 -1
- package/src/motion/animate.ts +1 -1
- package/src/render/$mount.ts +1 -1
- package/src/render/$run.ts +1 -1
- package/src/render/$serverMount.ts +1 -1
- package/src/render/$serverRun.ts +1 -1
- package/src/render/$stream.ts +1 -1
- package/src/render/addAnimation.ts +1 -1
- package/src/render/addEvent.ts +1 -1
- package/src/render/addFragment.ts +1 -1
- package/src/render/applyProps.ts +1 -1
- package/src/render/clearRange.ts +1 -1
- package/src/render/createComment.ts +1 -1
- package/src/render/createElement.ts +1 -1
- package/src/render/createFragment.ts +1 -1
- package/src/render/createText.ts +1 -1
- package/src/render/flushMountEffects.ts +1 -1
- package/src/render/getClasses.ts +4 -1
- package/src/render/hydrate.ts +1 -1
- package/src/render/hydrateRoot.ts +1 -1
- package/src/render/mount.ts +1 -1
- package/src/render/moveRange.ts +1 -1
- package/src/render/popRange.ts +1 -1
- package/src/render/runControl.ts +1 -1
- package/src/render/runControlBranch.ts +1 -1
- package/src/render/runList.ts +1 -1
- package/src/render/runListItems.ts +1 -1
- package/src/render/setAttribute.ts +1 -1
- package/src/render/setDynamicElement.ts +1 -1
- package/src/watch/proxyGet.ts +1 -1
- package/src/watch/removeEffect.ts +1 -1
- package/src/watch/runEffect.ts +1 -1
- package/src/watch/symbols.ts +1 -1
- package/src/watch/trackEffect.ts +1 -1
- package/src/watch/transferEffects.ts +1 -1
- package/src/watch/triggerEffects.ts +1 -1
- package/test/bench/components/output/Bench-client.ts +0 -204
- package/test/bench/components/output/Bench-server.ts +0 -130
- package/test/bench/components/temp/Bench-client-5fee290225ae4771aa847360006123671e8f17f1.ts +208 -0
- package/test/bench/components/temp/Bench-server-00cefa588803c01ca4f2741c595e4f045cdd101e.ts +130 -0
- package/test/build-server/components/{output/IfNested-client.ts → temp/IfNested-client-979db97eea5b4595550b9b46f297f3fbc31796d2.ts} +11 -0
- package/test/buildHtml.ts +1 -1
- package/test/buildOutputFiles.ts +47 -12
- package/test/class/class.test.ts +29 -6
- package/test/class/components/Class.torp +15 -1
- package/test/class/components/output/Class-client.ts +10 -6
- package/test/class/components/output/Class-server.ts +1 -1
- package/test/class/components/temp/{Class-client-600bf865c14f1052d24e1c79242f837aaf5ae5e8.ts → Class-client-8c3f9e0257cc2b687e9bb7106cccbab94a4b5adf.ts} +10 -6
- package/test/class/components/temp/Class-server-2218c3284845fdab80d1a41ebace9a9e2ddd6fc1.ts +17 -0
- package/test/component/components/temp/Header-client-ac151eea86e3f6b058fab101661e13ae73864968.ts +34 -0
- package/test/component/components/temp/Header-server-4f10f2332f3ca7a097517cfb938ab1e6f31d68ac.ts +17 -0
- package/test/console/components/temp/{Console-client-254d7d4799471401334d698b1631ab1cb5b70558.ts → Console-client-2f206752ce59e59fba9bb91263b4102fd515951e.ts} +1 -1
- package/test/console/components/temp/Console-server-b4b15f7a0d1d2b50d87bad4870e1b8d368707c04.ts +17 -0
- package/test/globalSetup.ts +1 -1
- package/test/helpers.ts +6 -2
- package/test/hydrateComponent.ts +1 -1
- package/test/importComponent.ts +12 -40
- package/test/mountComponent.ts +5 -1
- package/test/party/components/temp/AnswerButton-client-243454cd7bf84c648f244b3587e60d01a0401039.ts +33 -0
- package/test/party/components/temp/AnswerButton-server-938e46c1d2510ea37454854ef527e4aa64eb8e52.ts +16 -0
- package/test/party/components/temp/FunnyButton-client-2e6bec8259065b5bc9ae16d1ca93dd1bd0c56b7c.ts +40 -0
- package/test/party/components/temp/FunnyButton-server-e8ab55e47c735f7e42c55d2b7504dfa4190a1b40.ts +32 -0
- package/test/party/components/temp/Time-client-7ba4ca9322af2cb88a873c812fc776760c337c64.ts +47 -0
- package/test/party/components/temp/Time-server-08f66c7f3f32b13de06d75fe679cf58b5727c473.ts +31 -0
- package/test/party/components/temp/UserProfile-client-938bcef20a2555de22aca939022a32742ac5e729.ts +51 -0
- package/test/party/components/temp/UserProfile-server-9df5c59b8797fa67c479bc76450104d45e6076f9.ts +22 -0
- package/test/party/components/temp/UserProfileContext-client-93211cdba795b8baf926f60f5b17da90701743b3.ts +44 -0
- package/test/party/components/temp/UserProfileContext-server-cf58767df1e2d1dde919f59de73cdd9764bbc006.ts +20 -0
- package/test/slots/components/temp/Article-client-741f94eab2e96655f4c9d69ccd7d9c7cc998f4ce.ts +41 -0
- package/test/slots/components/temp/Article-server-a6bd47a621cc213db4313eb775a52246541dd203.ts +28 -0
- package/test/slots/components/temp/Header-client-e2e1e7d60b48b0841cd0c20224f520330ca96458.ts +38 -0
- package/test/slots/components/temp/Header-server-1c195508a91c32822da22a08576c8a30c9070636.ts +22 -0
- package/test/slots/components/temp/List-client-0659d999cfb48b865fe5b8aaaf2a4ddac3a8a8b6.ts +76 -0
- package/test/slots/components/temp/List-server-4b76485a259d054187edad8aa691d80ac918ad86.ts +25 -0
- package/test/special-component/components/temp/BigTitle-client-881a9f84876fb3f6d994736edb253b96e71de926.ts +32 -0
- package/test/special-component/components/temp/BigTitle-server-9efc738f5eb131a4b859c4a99a8e255d93834e9a.ts +20 -0
- package/test/special-component/components/temp/SmallTitle-client-25b3097b7ae47848dd82967403faf7745fc43388.ts +32 -0
- package/test/special-component/components/temp/SmallTitle-server-fc105db9a91b83644d67e049ce583a3d1a61f50c.ts +20 -0
- package/tsconfig.json +1 -1
- package/tsup.config.ts +7 -2
- package/vitest.config.ts +2 -2
- package/dist/chunk-GO2L324Q.js.map +0 -1
- package/test/bench/components/temp/Bench-client-3efcd3b6c03c7a51368df3b8b1bdf2e7fa722432.ts +0 -126
- package/test/build-server/components/IfNested.d.ts +0 -18
- package/test/class/components/temp/Class-server-082505b03612c762384ffff329472db3f55b8097.ts +0 -17
- /package/test/build-server/components/{output/IfNested-server.ts → temp/IfNested-server-3c4e4b6f2162c0906cef685830219b9ea9ee985c.ts} +0 -0
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/render/context.ts","../src/render/$mount.ts","../src/watch/runEffect.ts","../src/render/$run.ts","../src/watch/symbols.ts","../src/render/$unwrap.ts","../src/watch/trackEffect.ts","../src/watch/removeEffect.ts","../src/watch/triggerEffects.ts","../src/watch/proxyGet.ts","../src/watch/transferEffects.ts","../src/watch/proxySet.ts","../src/render/$watch.ts","../src/render/addAnimation.ts","../src/render/addEvent.ts","../src/motion/animate.ts","../src/render/addFragment.ts","../src/render/applyProps.ts","../src/render/flushMountEffects.ts","../src/render/getFragment.ts","../src/render/hydrate.ts","../src/render/mount.ts","../src/render/newListItem.ts","../src/render/newRange.ts","../src/render/hydrationMarkers.ts","../src/render/isComment.ts","../src/render/nodeNext.ts","../src/render/nodeAnchor.ts","../src/render/nodeChild.ts","../src/render/nodeRoot.ts","../src/render/popRange.ts","../src/render/pushRange.ts","../src/render/runControl.ts","../src/render/clearRange.ts","../src/render/runControlBranch.ts","../src/render/moveRange.ts","../src/render/runListItems.ts","../src/render/runList.ts","../src/render/setAttribute.ts","../src/render/setDynamicElement.ts"],"sourcesContent":["import { type Animation } from \"../types/Animation\";\nimport { type Cleanup } from \"../types/Cleanup\";\nimport { type Effect } from \"../types/Effect\";\nimport { type Range } from \"../types/Range\";\n\n/**\n * The global context for setting up effects and updating subscriptions.\n */\ninterface Context {\n\t/** The effect that is currently being run. */\n\tactiveEffect: Effect | null;\n\n\t/** The range that is currently being created. */\n\tactiveRange: Range | null;\n\n\t/**\n\t * Functions that were run via $mount, which should be collected and flushed\n\t * when the component has been mounted in the DOM\n\t */\n\tmountEffects: (() => Cleanup | void)[];\n\n\t/**\n\t * Events which should be added when their element has been mounted in the\n\t * DOM\n\t */\n\tstashedEvents: {\n\t\trange: Range | null;\n\t\tel: Element;\n\t\ttype: string;\n\t\tlistener: (this: Element, ev: any) => any;\n\t}[];\n\n\t/**\n\t * Animations which should be added when their element has been mounted in\n\t * the DOM\n\t */\n\tstashedAnimations: {\n\t\trange: Range | null;\n\t\tel: HTMLElement;\n\t\tin?: Animation;\n\t\tout?: Animation;\n\t}[];\n\n\t/** The node that is actively being hydrated. */\n\thydrationNode: ChildNode | null;\n\t//hn: ChildNode | null;\n}\n\nconst context: Context = {\n\tactiveEffect: null,\n\tactiveRange: null,\n\tmountEffects: [],\n\tstashedEvents: [],\n\tstashedAnimations: [],\n\thydrationNode: null,\n\t//hn: null,\n\t//get hydrationNode() {\n\t//\treturn this.hn;\n\t//},\n\t//set hydrationNode(value) {\n\t//\tconsole.log(`set hydration ${printNode(value)}`);\n\t//\tthis.hn = value;\n\t//},\n};\n\nexport default context;\n","import { type Cleanup } from \"../types/Cleanup\";\nimport context from \"./context\";\n\n/**\n * Runs and re-runs a function on component mount\n *\n * @param fn The function to run, which may return a cleanup function\n */\nexport default function $mount(fn: () => Cleanup | void) {\n\tcontext.mountEffects.push(fn);\n}\n","import context from \"../render/context\";\nimport { type Effect } from \"../types/Effect\";\n\nexport default function runEffect(effect: Effect) {\n\t// Reactivate it in case it's been deactivated\n\teffect.active = true;\n\n\t// Set the active effect, so that any properties accessed while running it\n\t// will trigger it in future\n\tcontext.activeEffect = effect;\n\n\t// Run the effect to register its subscriptions and get its (optional)\n\t// cleanup function\n\tconst cleanup = effect.run();\n\n\tif (typeof cleanup === \"function\") {\n\t\teffect.cleanup = cleanup;\n\t}\n\n\tcontext.activeEffect = null;\n}\n","import { type Cleanup } from \"../types/Cleanup\";\nimport { type Effect } from \"../types/Effect\";\nimport runEffect from \"../watch/runEffect\";\nimport context from \"./context\";\n\n// TODO: Take a pipeline of operators e.g. debounce\n\n/**\n * Runs and re-runs a function that depends on a watched object\n *\n * @param fn The function to run, which may return a cleanup function\n */\nexport default function $run(fn: () => Cleanup | void) {\n\tlet effect: Effect = {\n\t\trun: fn,\n\t\tcleanup: null,\n\t\tprops: null,\n\t\tactive: true,\n\t};\n\n\tif (context.activeRange) {\n\t\t//console.log(\"the range is \", context.activeRange.id);\n\t\t(context.activeRange.effects ??= []).push(effect);\n\t}\n\n\trunEffect(effect);\n}\n","const proxyDataSymbol = Symbol(\"_proxy_data\");\n\nexport { proxyDataSymbol };\n","import { proxyDataSymbol } from \"../watch/symbols\";\n\n/**\n * Returns the target object of a proxy\n *\n * @param object The proxy object\n */\nexport default function $unwrap<T extends Record<PropertyKey, any>>(object: T): T {\n\treturn object[proxyDataSymbol].target || object;\n}\n","import context from \"../render/context\";\nimport { type ProxyData } from \"../types/ProxyData\";\n\nexport default function trackEffect(data: ProxyData, key: PropertyKey) {\n\t// If there's an active effect, register this target/prop with it, so that\n\t// it will be called when this prop is set\n\tif (context.activeEffect) {\n\t\t//let effectName = String(context.activeEffect.run).split(\"{\")[0].trim();\n\t\t//console.log(`tracking effect '${effectName}' for '${String(key)}'`);\n\n\t\tlet propState = data.propData.get(key);\n\t\tif (!propState) {\n\t\t\tpropState = { effects: [] };\n\t\t\tdata.propData.set(key, propState);\n\t\t}\n\n\t\tpropState.effects ||= [];\n\t\tpropState.effects.push(context.activeEffect);\n\n\t\tcontext.activeEffect.props ||= [];\n\t\tcontext.activeEffect.props.push(propState);\n\t}\n}\n","import { type Effect } from \"../types/Effect\";\n\nexport default function removeEffect(effect: Effect) {\n\t//let effectName = String(effect.run).split(\"{\")[0].trim();\n\t//console.log(`removing effect '${effectName}'`);\n\n\t// Run any cleanup function\n\tif (effect.cleanup) {\n\t\teffect.cleanup();\n\t}\n\n\t// Delete the effect from any props that are subscribed to it\n\tif (effect.props) {\n\t\tfor (let prop of effect.props) {\n\t\t\tif (prop.effects) {\n\t\t\t\tlet length = prop.effects.length;\n\t\t\t\tlet i = length;\n\t\t\t\twhile (i--) {\n\t\t\t\t\tif (prop.effects[i] === effect) {\n\t\t\t\t\t\tprop.effects[i] = prop.effects[length - 1];\n\t\t\t\t\t\tprop.effects.pop();\n\t\t\t\t\t\tlength -= 1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// TODO: should ideally delete the prop if there\n\t\t\t\t// are no more subscriptions??\n\t\t\t}\n\t\t}\n\t}\n\n\t// HACK: Set the effect to active = false for loops through sliced arrays\n\t// TODO: Proper signal tracking\n\teffect.active = false;\n}\n","import { type ProxyData } from \"../types/ProxyData\";\nimport removeEffect from \"./removeEffect\";\nimport runEffect from \"./runEffect\";\n\nexport default function triggerEffects(data: ProxyData, key: PropertyKey) {\n\t// Get the effects for the supplied property\n\tlet effects = data.propData.get(key)?.effects;\n\tif (effects) {\n\t\t// HACK: Slice the array to get a copy, so that we can remove effects from\n\t\t// the property in removeEffect without skipping any here\n\t\tfor (let effect of effects.slice()) {\n\t\t\tif (effect.active) {\n\t\t\t\t//let effectName = String(effect.run).split(\"{\")[0].trim();\n\t\t\t\t//console.log(`triggered effect '${effectName}' for '${String(key)}'`);\n\n\t\t\t\tremoveEffect(effect);\n\n\t\t\t\trunEffect(effect);\n\t\t\t}\n\t\t}\n\t}\n}\n","import $watch from \"../render/$watch\";\nimport context from \"../render/context\";\nimport { type ProxyData } from \"../types/ProxyData\";\nimport { proxyDataSymbol } from \"./symbols\";\nimport trackEffect from \"./trackEffect\";\nimport triggerEffects from \"./triggerEffects\";\n\nexport default function proxyGet(\n\ttarget: Record<PropertyKey, any>,\n\tkey: PropertyKey,\n\treceiver: any,\n\tdata: ProxyData,\n) {\n\tif (key === proxyDataSymbol) {\n\t\treturn data;\n\t}\n\n\t//console.log(`object get '${String(prop)}' on`, target);\n\n\t// Set the value to a new proxy if it's an object\n\t// But not if it's a Promise (i.e. has a `then` method)\n\tif (!data.propData.has(key)) {\n\t\tif (!data.shallow) {\n\t\t\tlet value = target[key];\n\t\t\tif (value && typeof value === \"object\" && !value[proxyDataSymbol] && !value.then) {\n\t\t\t\ttarget[key] = $watch(value);\n\t\t\t}\n\t\t}\n\t\tdata.propData.set(key, null);\n\t}\n\n\t// From https://stackoverflow.com/a/54136394\n\t// PERF: Because we know what methods are being called, we could potentially run them manually\n\t// on DOM nodes (i.e. if it's a splice, we know which to remove and add etc)\n\tif (data.isArray) {\n\t\tif (\n\t\t\tkey === \"pop\" ||\n\t\t\tkey === \"push\" ||\n\t\t\tkey === \"reverse\" ||\n\t\t\tkey === \"shift\" ||\n\t\t\tkey === \"sort\" ||\n\t\t\tkey === \"splice\" ||\n\t\t\tkey === \"unshift\"\n\t\t) {\n\t\t\t// Get the array method\n\t\t\tconst targetFunction: Function = target[key];\n\n\t\t\t// Run the array method\n\t\t\treturn function (...args: any[]) {\n\t\t\t\ttargetFunction.apply(target, args);\n\n\t\t\t\t// If this array has change functions, call them now via the\n\t\t\t\t// length property, which gets accessed in most functions\n\t\t\t\ttriggerEffects(data, \"length\");\n\t\t\t};\n\t\t} else if (key === Symbol.iterator) {\n\t\t\t// HACK: This prevents lists being re-run on every random property\n\t\t\t// access by disabling the active effect before properties get\n\t\t\t// accessed. I'm not sure if this is the best way to achieve this...\n\t\t\ttrackEffect(data, \"length\");\n\t\t\tcontext.activeEffect = null;\n\t\t} else {\n\t\t\t// If this property is being accessed in the course of setting up an effect, track it\n\t\t\t// TODO: Only if it's a property and not a function?\n\t\t\ttrackEffect(data, key);\n\t\t}\n\t} else {\n\t\t// If this property is being accessed in the course of setting up an effect, track it\n\t\t// TODO: Only if it's a property and not a function?\n\t\ttrackEffect(data, key);\n\t}\n\n\t// Return the property value\n\treturn Reflect.get(target, key, receiver);\n}\n","import $watch from \"../render/$watch\";\nimport { type ProxyData } from \"../types/ProxyData\";\nimport { proxyDataSymbol } from \"./symbols\";\n\n/**\n * Transfers property effect subscriptions from one object to another\n */\nexport default function transferEffects(\n\toldValue: Record<PropertyKey, any>,\n\tnewValue: Record<PropertyKey, any>,\n) {\n\tconst oldData = oldValue[proxyDataSymbol] as ProxyData;\n\tconst newData = newValue[proxyDataSymbol] as ProxyData;\n\tmoveChildEffects(oldValue, newValue, oldData, newData);\n}\n\nfunction moveChildEffects(\n\toldValue: Record<PropertyKey, any>,\n\tnewValue: Record<PropertyKey, any>,\n\toldData: ProxyData,\n\tnewData: ProxyData,\n) {\n\t// Recursively transfer and run effects for child properties\n\t// TODO: Top down or bottom up?? Doing top down for now...\n\tfor (let [key, props] of oldData.propData.entries()) {\n\t\tif (props) {\n\t\t\t// Transfer the prop data\n\t\t\tnewData.propData.set(key, props);\n\n\t\t\tlet oldPropValue = oldValue[key];\n\t\t\tlet oldPropData = oldPropValue[proxyDataSymbol];\n\n\t\t\t// If the old value was a proxy, make the new value one too\n\t\t\t// TODO: Make sure we aren't accidentally creating proxies for\n\t\t\t// things that weren't before...\n\t\t\tif (oldPropData) {\n\t\t\t\tnewValue[key] = $watch(newValue[key]);\n\t\t\t}\n\n\t\t\tlet newPropValue = newValue[key];\n\n\t\t\t// Run the effects for each property\n\t\t\tif (props.effects) {\n\t\t\t\tfor (let effect of props.effects) {\n\t\t\t\t\tif (effect.cleanup) {\n\t\t\t\t\t\teffect.cleanup();\n\t\t\t\t\t}\n\n\t\t\t\t\t// Only run the effect if there is a new value\n\t\t\t\t\tif (newPropValue) {\n\t\t\t\t\t\teffect.run();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Recurse\n\t\t\tif (oldPropData) {\n\t\t\t\tlet newPropData = newPropValue[proxyDataSymbol];\n\t\t\t\tmoveChildEffects(oldPropValue, newPropValue, oldPropData, newPropData);\n\t\t\t}\n\t\t}\n\t}\n}\n","import $watch from \"../render/$watch\";\nimport { type ProxyData } from \"../types/ProxyData\";\nimport { proxyDataSymbol } from \"./symbols\";\nimport transferEffects from \"./transferEffects\";\nimport triggerEffects from \"./triggerEffects\";\n\nexport default function proxySet(\n\ttarget: Record<PropertyKey, any>,\n\tkey: PropertyKey,\n\tvalue: any,\n\treceiver: any,\n\tdata: ProxyData,\n) {\n\t//console.log(`object set '${String(prop)}' to '`, value, `' on`, target);\n\n\t// Only do things if the value has changed\n\tconst oldValue = target[key];\n\tif (value !== oldValue) {\n\t\tlet newValue = value;\n\n\t\t// If the value was previously a proxy, watch the new value and update\n\t\t// its effect subscriptions\n\t\tif (oldValue && oldValue[proxyDataSymbol]) {\n\t\t\tnewValue = $watch(value);\n\t\t\ttransferEffects(oldValue, newValue);\n\t\t}\n\n\t\t// Set the property value on the target\n\t\tReflect.set(target, key, newValue, receiver);\n\n\t\t// Re-run effects\n\t\ttriggerEffects(data, key);\n\n\t\t// If an item in an array is being set directly, trigger the length to\n\t\t// cause any lists to be re-run and data re-bound\n\t\t// TODO: Can we update the single item's data directly somehow?\n\t\tif (data.isArray && !isNaN(+String(key))) {\n\t\t\ttriggerEffects(data, \"length\");\n\t\t}\n\t}\n\n\treturn true;\n}\n","import { type ProxyData } from \"../types/ProxyData\";\nimport { type WatchOptions } from \"../types/WatchOptions\";\nimport proxyGet from \"../watch/proxyGet\";\nimport proxySet from \"../watch/proxySet\";\nimport { proxyDataSymbol } from \"../watch/symbols\";\n\n/**\n * Watches an object and runs effects when its properties are changed\n *\n * @param object The object to watch\n */\nexport default function $watch<T extends Record<PropertyKey, any>>(\n\tobject: T,\n\toptions?: WatchOptions,\n): T {\n\t// Return the object itself if it is undefined or null, or if it is already a proxy\n\tif (object == null || object[proxyDataSymbol]) {\n\t\treturn object;\n\t}\n\n\t// Make sure we can proxy this value\n\t// TODO: In debug mode maybe?\n\t//if (typeof object !== \"object\") {\n\t//\tthrow new Error(`$watch can't be called with a ${typeof object}`);\n\t//}\n\n\t// Create a proxy handler for each object, and store some data for it here\n\tconst data: ProxyData = {\n\t\ttarget: object,\n\t\tisArray: Array.isArray(object),\n\t\tshallow: !!options?.shallow,\n\t\tpropData: new Map(),\n\t};\n\tconst handler: ProxyHandler<T> = {\n\t\tget: function (target, prop, receiver) {\n\t\t\treturn proxyGet(target, prop, receiver, data);\n\t\t},\n\t\tset: function (target, prop, value, receiver) {\n\t\t\treturn proxySet(target, prop, value, receiver, data);\n\t\t},\n\t};\n\n\treturn new Proxy(object, handler) as T;\n}\n","import { type Animation } from \"../types/Animation\";\nimport context from \"./context\";\n\nexport default function addAnimation(el: HTMLElement, entry?: Animation, exit?: Animation) {\n\t// Stash the event in context so that it can be added when the fragment is\n\t// added to the DOM\n\t// NOTE: We don't need to do this for hydration, but it's simpler to do it\n\t// the same way in both processes\n\tcontext.stashedAnimations.push({\n\t\trange: context.activeRange,\n\t\tel,\n\t\tin: entry,\n\t\tout: exit,\n\t});\n}\n","import context from \"./context\";\n\nexport default function addEvent(\n\tel: Element,\n\ttype: string,\n\tlistener: (this: Element, ev: any) => any,\n) {\n\t// Stash the event in context so that it can be added when the fragment is\n\t// added to the DOM\n\t// NOTE: We don't need to do this for hydration, but it's simpler to do it\n\t// the same way in both processes\n\tcontext.stashedEvents.push({ range: context.activeRange, el, type, listener });\n}\n","import context from \"../render/context\";\n\n/**\n * Adds an animation for an element\n * @param el The element to animate\n * @param enter Whether the animation is being run on enter\n * @param keyframes The Web Animation API keyframes\n * @param options The Web Animmation API options\n */\nexport default async function animate(\n\tel: HTMLElement,\n\tenter: boolean,\n\tkeyframes: Keyframe[] | PropertyIndexedKeyframes | null,\n\toptions?: number | KeyframeAnimationOptions,\n) {\n\t// This is quite simplistic\n\t// We might need to\n\t// - store the animation\n\t// - reverse it if it's running and the range appears/disappears\n\t// - transfer the animation to the new element\n\n\tlet animationOptions = Object.assign(\n\t\t{\n\t\t\tdirection: enter ? \"normal\" : \"reverse\",\n\t\t\t// TODO: Should probably have a global setting for this somewhere\n\t\t\t// And respect browser reduce motion settings\n\t\t\tduration: 1000,\n\t\t\tfill: \"forwards\",\n\t\t},\n\t\toptions,\n\t);\n\n\tconst animation = el.animate(keyframes, animationOptions);\n\n\t// HACK: I'm not entirely sure why this is needed, but without it,\n\t// animations never start\n\tanimation.timeline = el.ownerDocument.timeline;\n\n\t// Add the animation to the active range, so that the range won't be cleared\n\t// until the animation is completed\n\tlet activeRange = context.activeRange;\n\tif (activeRange) {\n\t\t// TODO: An option for whether to await or cancel events on range remove\n\t\t// e.g. if you are doing a client side navigation, you don't want to run animations\n\t\tactiveRange.animations ??= new Set();\n\t\tactiveRange.animations.add(animation);\n\t\tawait animation.finished;\n\t\tactiveRange.animations.delete(animation);\n\t}\n}\n","import animate from \"../motion/animate\";\nimport $run from \"./$run\";\nimport context from \"./context\";\n\nexport default function addFragment(\n\tfragment: DocumentFragment,\n\tparent: ParentNode,\n\tbefore: Node | null,\n) {\n\t//console.log(`adding fragment '${fragment.textContent}' to ${printNode(parent)}`);\n\t//console.log(\"before\", printNode(before));\n\n\tconst range = context.activeRange;\n\tconst hydrationNode = context.hydrationNode;\n\n\t// Set the active range's end node to the last node in the fragment\n\tif (range) {\n\t\tif (hydrationNode) {\n\t\t\trange.endNode = hydrationNode;\n\t\t} else {\n\t\t\trange.startNode = fragment.firstChild;\n\t\t\trange.endNode = fragment.lastChild;\n\t\t}\n\t}\n\n\tlet parentIsFragment = parent.nodeType === 11;\n\n\tif (!hydrationNode) {\n\t\t// HACK: We need to be able to add fragments to new fragments as well as\n\t\t// fragments that have already been added to the document. New fragments will\n\t\t// be ok, but fragments that have been added will not be parents of the before\n\t\t// element (because it's now in the document). In this case we will have to\n\t\t// use the before element's parent, which should work as long as we are always\n\t\t// passing a before element...\n\t\tif (parentIsFragment) {\n\t\t\tparent = before!.parentNode!;\n\t\t}\n\n\t\t// Add the fragment\n\t\tparent.insertBefore(fragment, before);\n\t}\n\n\t// If we're adding this fragment to the DOM, we can now add our stashed\n\t// events and play our stashed animations\n\tif (!parentIsFragment) {\n\t\t// Set the active range for each event and animation so it will get\n\t\t// attached to the right one and set it back afterwards\n\n\t\tfor (let event of context.stashedEvents) {\n\t\t\tcontext.activeRange = event.range;\n\t\t\t$run(function addFragmentEvent() {\n\t\t\t\tevent.el.addEventListener(event.type, event.listener);\n\t\t\t\treturn () => {\n\t\t\t\t\tevent.el.removeEventListener(event.type, event.listener);\n\t\t\t\t};\n\t\t\t});\n\t\t}\n\t\tcontext.stashedEvents.length = 0;\n\n\t\tfor (let animation of context.stashedAnimations) {\n\t\t\tcontext.activeRange = animation.range;\n\t\t\t$run(function addFragmentAnimation() {\n\t\t\t\tif (animation.in) {\n\t\t\t\t\tanimate(animation.el, true, animation.in.keyframes, animation.in.options);\n\t\t\t\t}\n\t\t\t\tif (animation.out) {\n\t\t\t\t\treturn () => {\n\t\t\t\t\t\tanimate(animation.el, false, animation.out!.keyframes, animation.out!.options);\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t\tcontext.stashedAnimations.length = 0;\n\n\t\t// Set the active range back\n\t\tcontext.activeRange = range;\n\t}\n}\n","import $run from \"./$run\";\n\nexport default function applyProps(\n\tel: Element,\n\tprops: Record<string, any> | undefined,\n\tpropNamesUsed: string[],\n) {\n\tif (props) {\n\t\tfor (let [name, value] of Object.entries(props)) {\n\t\t\tif (!propNamesUsed.includes(name)) {\n\t\t\t\tif (name.startsWith(\"on\")) {\n\t\t\t\t\tconst eventName = name.substring(2);\n\t\t\t\t\tel.addEventListener(eventName, value);\n\t\t\t\t} else {\n\t\t\t\t\t$run(function setAttribute() {\n\t\t\t\t\t\tel.setAttribute(name, value);\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n","import $run from \"./$run\";\nimport context from \"./context\";\n\nexport default function flushMountEffects() {\n\tfor (let fn of context.mountEffects) {\n\t\t$run(fn);\n\t}\n}\n","export default function getFragment(\n\tdocument: Document,\n\tarray: DocumentFragment[],\n\tindex: number,\n\thtml: string,\n\tns?: boolean,\n): DocumentFragment {\n\t// Create the fragment in the array if it hasn't yet been used\n\tif (array[index] === undefined) {\n\t\t// TODO: Should pass a string for the ns, when we support other element types\n\t\tif (ns) {\n\t\t\tconst template = document.createElementNS(\"http://www.w3.org/2000/svg\", \"template\");\n\t\t\ttemplate.innerHTML = html;\n\t\t\tconst fragment = new DocumentFragment();\n\t\t\tfragment.append(...template.childNodes);\n\t\t\tarray[index] = fragment;\n\t\t} else {\n\t\t\tconst template = document.createElement(\"template\");\n\t\t\ttemplate.innerHTML = html;\n\t\t\tarray[index] = template.content;\n\t\t}\n\t}\n\n\t// Get the fragment from the array\n\t// TODO: If we're hydrating we probably don't want to create and return a\n\t// fragment unless we really need to\n\tlet fragment = array[index].cloneNode(true) as DocumentFragment;\n\n\treturn fragment;\n}\n","import { type Component } from \"../types/Component\";\nimport { type SlotRender } from \"../types/SlotRender\";\nimport context from \"./context\";\n\n/**\n * Hydrates a component into an existing DOM tree\n * @param parent The parent node\n * @param component The component to mount\n * @param props An object containing component props\n */\nexport default function hydrate(\n\tparent: ParentNode,\n\tcomponent: Component,\n\tprops?: Record<string, any>,\n\tslots?: Record<string, SlotRender>,\n) {\n\t// When mounting, the parent must have no child elements, so we can just set\n\t// the hydration node to the first child node\n\tcontext.hydrationNode = parent.firstChild;\n\n\t// Call the component's render function\n\tcomponent(parent, null, props, undefined, slots);\n\n\tcontext.hydrationNode = null;\n}\n","import { type Component } from \"../types/Component\";\nimport { type SlotRender } from \"../types/SlotRender\";\n\n/**\n * Mounts a component into a DOM node\n *\n * @param parent The node to mount the component into\n * @param component The component to mount\n * @param props An object containing component props\n */\nexport default function mount(\n\tparent: ParentNode,\n\tcomponent: Component,\n\tprops?: Record<string, any>,\n\tslots?: Record<string, SlotRender>,\n) {\n\t// The parent node must have no child elements, so that we can hydrate\n\t// without worrying about where to start\n\tif (parent.childElementCount) {\n\t\tthrow new Error(\"The parent node must have no child elements\");\n\t}\n\n\t// Remove all text, commments, etc\n\twhile (parent.firstChild) {\n\t\tparent.firstChild.remove();\n\t}\n\n\t// Call the component's render function\n\tcomponent(parent, null, props, undefined, slots);\n}\n","import { type ListItem } from \"../types/ListItem\";\n\nexport default function newListItem(data: Record<PropertyKey, any>, key?: any): ListItem {\n\treturn {\n\t\tstartNode: null,\n\t\tendNode: null,\n\t\tchildren: null,\n\t\tindex: 0,\n\t\teffects: null,\n\t\tanimations: null,\n\t\tdata,\n\t\tkey,\n\t};\n}\n","import { type Range } from \"../types/Range\";\n\nexport default function newRange(): Range {\n\treturn {\n\t\tstartNode: null,\n\t\tendNode: null,\n\t\tchildren: null,\n\t\tindex: 0,\n\t\teffects: null,\n\t\tanimations: null,\n\t};\n}\n","const HYDRATION_START = \"[\";\nconst HYDRATION_END = \"]\";\nconst HYDRATION_BRANCH = \"^\";\n\nexport { HYDRATION_START, HYDRATION_END, HYDRATION_BRANCH };\n","export default function isComment(node: Node): node is Comment {\n\treturn node.nodeType === 8;\n}\n","import context from \"./context\";\nimport { HYDRATION_BRANCH } from \"./hydrationMarkers\";\nimport isComment from \"./isComment\";\n\n// TODO: Should have t_next(node, 3) to get the sibling 3 nodes along\n\n/**\n * Gets the next sibling of a node\n */\nexport default function nodeNext(node: Node): Node {\n\tlet nextNode = node.nextSibling;\n\n\tif (context.hydrationNode) {\n\t\t// Remove hydration comments that are inserted at the start of branches\n\t\t// They are just used to split up text nodes that would otherwise be joined in HTML\n\t\tif (nextNode && isComment(nextNode) && nextNode.data === HYDRATION_BRANCH) {\n\t\t\tlet comment = nextNode;\n\t\t\tnextNode = nextNode.nextSibling;\n\t\t\tcomment.remove();\n\t\t}\n\t\tcontext.hydrationNode = nextNode;\n\t}\n\n\t// NOTE: We know this is not null as it is being called from generated code\n\treturn nextNode!;\n}\n","import context from \"./context\";\nimport { HYDRATION_END, HYDRATION_START } from \"./hydrationMarkers\";\nimport isComment from \"./isComment\";\nimport nodeNext from \"./nodeNext\";\n\nexport default function nodeAnchor(node: Node): Node {\n\t// If we are hydrating, the anchor will be at the end of the paired <![> and\n\t// <!]> comments\n\tif (context.hydrationNode && isComment(node) && node.data === HYDRATION_START) {\n\t\t// Skip and remove the start node\n\t\tlet currentNode = nodeNext(node);\n\t\tnode.remove();\n\n\t\t// Go through siblings until we get to the end\n\t\tlet level = 1;\n\t\twhile (currentNode) {\n\t\t\tif (isComment(currentNode)) {\n\t\t\t\tif (currentNode.data === HYDRATION_START) {\n\t\t\t\t\tlevel += 1;\n\t\t\t\t} else if (currentNode.data === HYDRATION_END) {\n\t\t\t\t\tlevel -= 1;\n\t\t\t\t}\n\t\t\t\tif (level === 0) {\n\t\t\t\t\t// Remove the end node and return the next one\n\t\t\t\t\tconst endNode = currentNode.nextSibling;\n\t\t\t\t\tcurrentNode.remove();\n\t\t\t\t\t// NOTE: We know this is not null as it is being called from\n\t\t\t\t\t// generated code\n\t\t\t\t\treturn endNode!;\n\t\t\t\t}\n\t\t\t}\n\t\t\tcurrentNode = currentNode.nextSibling!;\n\t\t}\n\n\t\tif (!currentNode) {\n\t\t\tthrow new Error(\"End hydration comment not found\");\n\t\t}\n\t}\n\n\treturn node;\n}\n","import context from \"./context\";\n\n/**\n * Gets the first child of a node\n */\nexport default function nodeChild(parent: Node): Node {\n\tlet child = parent.firstChild;\n\tif (context.hydrationNode) {\n\t\t// The child may be null when hydrating the sole text child of an\n\t\t// element with no text\n\t\tif (!child) {\n\t\t\tchild = parent.appendChild(parent.ownerDocument!.createTextNode(\"\"));\n\t\t}\n\t\tcontext.hydrationNode = child;\n\t}\n\t// NOTE: We know this is not null as it is being called from generated code\n\treturn child!;\n}\n","import context from \"./context\";\n\n/**\n * Gets the first child in a fragment\n * */\nexport default function nodeRoot(parent: Node): Node {\n\tconst hydrationNode = context.hydrationNode;\n\tif (hydrationNode) {\n\t\t// If hydrating, set the active range's start node, while we have it\n\t\tconst range = context.activeRange;\n\t\tif (range && !range.startNode) {\n\t\t\trange.startNode = hydrationNode;\n\t\t}\n\t\treturn hydrationNode;\n\t} else {\n\t\t// NOTE: We know this is not null as it is being called from generated code\n\t\treturn parent.firstChild!;\n\t}\n}\n","import { type Range } from \"../types/Range\";\nimport context from \"./context\";\n\nexport default function popRange(oldRange: Range | null) {\n\tcontext.activeRange = oldRange;\n}\n","import { type Range } from \"../types/Range\";\nimport context from \"./context\";\n\nexport default function pushRange(range: Range, toParent = false): Range | null {\n\tconst activeRange = context.activeRange;\n\n\t// Add the new range to the currently active range's children, so that we\n\t// can delete the children with the parent\n\tif (toParent && activeRange) {\n\t\t(activeRange.children ??= []).push(range);\n\t}\n\n\t// Set the new active range\n\tcontext.activeRange = range;\n\n\t// Return the old active range, so that it can be reset when done\n\treturn activeRange;\n}\n","import { type Range } from \"../types/Range\";\nimport $run from \"./$run\";\nimport context from \"./context\";\nimport popRange from \"./popRange\";\nimport pushRange from \"./pushRange\";\n\n/**\n * Runs an`if`, `switch` or `await` control statement\n * @param create A function that creates the control statement's branches\n */\nexport default function runControl(\n\trange: Range,\n\tanchor: Node | null,\n\tcreate: (anchor: Node | null) => void,\n) {\n\t// Store the index in the range so that it can be accessed by the statement's\n\t// branches\n\trange.index = -1;\n\n\tconst oldRange = pushRange(range, true);\n\n\t// Run the control statement in an effect\n\t$run(function runControl() {\n\t\t// Push and pop the control statement on subsequent runs, so that new branch\n\t\t// ranges will be added to its children\n\t\tconst oldBranchRange = pushRange(range);\n\n\t\t// Run the function that creates the control statement's branches\n\t\tcreate(anchor);\n\n\t\tpopRange(oldBranchRange);\n\t});\n\n\t// If we're mounting, the anchor will be the one that is passed in, but if\n\t// we're hydrating it will be after the active branch's HTML elements, so we\n\t// need to update it after the branches have been hydrated\n\tif (context.hydrationNode) {\n\t\tanchor = context.hydrationNode.nextSibling;\n\t}\n\n\tpopRange(oldRange);\n}\n","import { type Range } from \"../types/Range\";\nimport removeEffect from \"../watch/removeEffect\";\nimport context from \"./context\";\n\nexport default function clearRange(range: Range) {\n\t//console.log(`clearing range ${printNode(range.startNode)} to ${printNode(range.endNode)}`);\n\n\t// Clear effects and collect animations that take place within this range and its children\n\tlet animations: Animation[] = [];\n\tclearEffects(range, animations);\n\n\t// Wait for animations, if any, then clear the range's nodes\n\tif (animations.length) {\n\t\tPromise.all(animations.map((a) => a.finished)).then(() => clearNodes(range));\n\t} else {\n\t\tclearNodes(range);\n\t}\n}\n\nfunction clearEffects(range: Range, animations: Animation[]) {\n\t// Delete the effects for this range\n\tif (range.effects) {\n\t\t// Set the active range to collect exit animations\n\t\t// We could instead have seperate entry and exit animation collections?\n\t\tconst oldRange = context.activeRange;\n\t\tcontext.activeRange = range;\n\n\t\tfor (let effect of range.effects) {\n\t\t\tremoveEffect(effect);\n\t\t}\n\n\t\tcontext.activeRange = oldRange;\n\t}\n\n\t// Collect any running animations, including ones from the effect cleanups\n\tif (range.animations) {\n\t\tfor (let animation of range.animations) {\n\t\t\tanimations.push(animation);\n\t\t}\n\t}\n\n\t// Recurse through the children\n\tif (range.children) {\n\t\tfor (let child of range.children) {\n\t\t\tclearEffects(child, animations);\n\t\t}\n\t\trange.children.length = 0;\n\t}\n}\n\nfunction clearNodes(range: Range) {\n\t// Clear the nodes for this range\n\tif (range.startNode) {\n\t\tlet currentNode = range.endNode || range.startNode;\n\t\t// DEBUG:\n\t\tif (range.startNode.parentNode !== currentNode.parentNode) {\n\t\t\tthrow new Error(\"range nodes have different parents\");\n\t\t}\n\t\twhile (currentNode !== range.startNode) {\n\t\t\tlet nextNode = currentNode.previousSibling;\n\t\t\tcurrentNode.remove();\n\t\t\tcurrentNode = nextNode!;\n\t\t}\n\t\tcurrentNode.remove();\n\n\t\t// Release the nodes\n\t\trange.startNode = null;\n\t\trange.endNode = null;\n\t}\n}\n","import { type Range } from \"../types/Range\";\nimport clearRange from \"./clearRange\";\nimport newRange from \"./newRange\";\nimport popRange from \"./popRange\";\nimport pushRange from \"./pushRange\";\n\nexport default function runControlBranch(range: Range, index: number, create: () => void) {\n\t// Only run the branch if it's not the current branch\n\tif (index >= 0 && range.index === index) {\n\t\treturn;\n\t}\n\n\tif (range.children?.length) {\n\t\t// Branching ranges have exactly one child\n\t\tclearRange(range.children[0]);\n\t\trange.children.length = 0;\n\t}\n\n\tconst oldRange = pushRange(newRange(), true);\n\n\t// Run the create function\n\tcreate();\n\n\tpopRange(oldRange);\n\n\t// Set the index on the branching range\n\trange.index = index;\n}\n","import { type Range } from \"../types/Range\";\n\nexport default function moveRange(parent: Node, range: Range, before: ChildNode | null) {\n\tconst endNode = range.endNode || range.startNode;\n\tlet currentNode = range.startNode;\n\twhile (currentNode) {\n\t\tconst nextNode = currentNode.nextSibling;\n\t\tparent.insertBefore(currentNode, before);\n\t\tif (currentNode === endNode) break;\n\t\tcurrentNode = nextNode;\n\t}\n}\n","// Adapted from https://github.com/snabbdom/snabbdom\n// With changes from https://github.com/luwes/js-diff-benchmark\n/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 Simon Friis Vindum\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\nimport { type ListItem } from \"../types/ListItem\";\nimport { type Range } from \"../types/Range\";\nimport $watch from \"./$watch\";\nimport clearRange from \"./clearRange\";\nimport context from \"./context\";\nimport moveRange from \"./moveRange\";\n\n/**\n * @param range The list's range\n * @param parent The parent DOM element\n * @param anchor The DOM element to create new items before\n * @param oldItems The list of current items\n * @param newItems The list of future items\n * @param create A function that creates the DOM elements for a new item\n */\nexport default function runListItems(\n\trange: Range,\n\tparent: ParentNode,\n\tanchor: Node | null,\n\toldItems: ListItem[],\n\tnewItems: ListItem[],\n\tcreate: (data: ListItem, before: Node | null) => void,\n) {\n\tlet oldStartIndex = 0;\n\tlet oldEndIndex = oldItems.length - 1;\n\tlet oldStartItem = oldItems[0];\n\tlet oldEndItem = oldItems[oldEndIndex];\n\n\tlet newStartIndex = 0;\n\tlet newEndIndex = newItems.length - 1;\n\tlet newStartItem = newItems[0];\n\tlet newEndItem = newItems[newEndIndex];\n\n\tlet oldKeyToIndex: Map<any, number> | undefined;\n\tlet newKeyToIndex: Map<any, number> | undefined;\n\n\twhile (oldStartIndex <= oldEndIndex && newStartIndex <= newEndIndex) {\n\t\tif (oldStartItem == null) {\n\t\t\toldStartItem = oldItems[++oldStartIndex];\n\t\t} else if (oldEndItem == null) {\n\t\t\toldEndItem = oldItems[--oldEndIndex];\n\t\t} else if (newStartItem == null) {\n\t\t\tnewStartItem = newItems[++newStartIndex];\n\t\t} else if (newEndItem == null) {\n\t\t\tnewEndItem = newItems[--newEndIndex];\n\t\t} else if (oldStartItem.key === newStartItem.key) {\n\t\t\ttransferRangeMarkers(oldStartItem, newStartItem);\n\t\t\toldStartItem = oldItems[++oldStartIndex];\n\t\t\tnewStartItem = newItems[++newStartIndex];\n\t\t} else if (oldEndItem.key === newEndItem.key) {\n\t\t\ttransferRangeMarkers(oldEndItem, newEndItem);\n\t\t\toldEndItem = oldItems[--oldEndIndex];\n\t\t\tnewEndItem = newItems[--newEndIndex];\n\t\t} else if (oldStartItem.key === newEndItem.key) {\n\t\t\t// Move to the end\n\t\t\t//console.log(\"move\", oldStartItem.key, \"to the end\");\n\t\t\tmoveRange(parent, oldStartItem, oldEndItem.endNode?.nextSibling!);\n\t\t\ttransferRangeMarkers(oldStartItem, newEndItem);\n\t\t\toldStartItem = oldItems[++oldStartIndex];\n\t\t\tnewEndItem = newItems[--newEndIndex];\n\t\t} else if (oldEndItem.key === newStartItem.key) {\n\t\t\t// Move to the start\n\t\t\t//console.log(\"move\", oldEndItem.key, \"to the start\");\n\t\t\tmoveRange(parent, oldEndItem, oldStartItem?.startNode);\n\t\t\ttransferRangeMarkers(oldEndItem, newStartItem);\n\t\t\toldEndItem = oldItems[--oldEndIndex];\n\t\t\tnewStartItem = newItems[++newStartIndex];\n\t\t} else {\n\t\t\t// Lazily build maps of keys to indexes here\n\t\t\t// They are relevant only if there has been a move, or a mid-list\n\t\t\t// insertion or deletion, and not if there has been an insertion\n\t\t\t// at the end or deletion from the front\n\t\t\tif (!oldKeyToIndex || !newKeyToIndex) {\n\t\t\t\toldKeyToIndex = new Map();\n\t\t\t\tfor (let i = oldStartIndex; i < oldEndIndex; i++) {\n\t\t\t\t\toldKeyToIndex.set(oldItems[i].key, i);\n\t\t\t\t}\n\t\t\t\tnewKeyToIndex = new Map();\n\t\t\t\tfor (let i = newStartIndex; i < newEndIndex; i++) {\n\t\t\t\t\tnewKeyToIndex.set(newItems[i].key, i);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tlet oldIndex = oldKeyToIndex.get(newStartItem.key);\n\t\t\tlet newIndex = newKeyToIndex.get(oldStartItem.key);\n\n\t\t\tif (oldIndex === undefined && newIndex === undefined) {\n\t\t\t\t// Replace\n\t\t\t\t//console.log(\"replace\", oldStartItem.key, \"with\", newStartItem.key);\n\t\t\t\tnewStartItem.data = $watch(newStartItem.data);\n\t\t\t\tcreate(newStartItem, oldStartItem.startNode);\n\t\t\t\tclearRange(oldStartItem);\n\t\t\t\t// @ts-ignore We know we have an active range (the for loop) and that it\n\t\t\t\t// has children (because we're replacing one)\n\t\t\t\tcontext.activeRange.children.splice(oldStartIndex, 1);\n\t\t\t\toldStartItem = oldItems[++oldStartIndex];\n\t\t\t\tnewStartItem = newItems[++newStartIndex];\n\t\t\t} else if (oldIndex === undefined) {\n\t\t\t\t// Insert\n\t\t\t\t//console.log(\"insert\", newStartItem.key);\n\t\t\t\tnewStartItem.data = $watch(newStartItem.data);\n\t\t\t\tcreate(newStartItem, oldStartItem.startNode);\n\t\t\t\tnewStartItem = newItems[++newStartIndex];\n\t\t\t} else if (newIndex === undefined) {\n\t\t\t\t// Delete\n\t\t\t\t//console.log(\"delete\", oldStartItem.key);\n\t\t\t\tclearRange(oldStartItem);\n\t\t\t\t// @ts-ignore We know we have an active range (the for loop) and that it\n\t\t\t\t// has children (because we're deleting one)\n\t\t\t\tcontext.activeRange.children.splice(oldStartIndex, 1);\n\t\t\t\toldStartItem = oldItems[++oldStartIndex];\n\t\t\t} else {\n\t\t\t\t// Move\n\t\t\t\t//console.log(\"move\", newStartItem.key, \"before\", oldStartItem.key);\n\t\t\t\tconst oldData = oldItems[oldIndex];\n\t\t\t\tmoveRange(parent, oldData, oldStartItem.startNode);\n\t\t\t\ttransferRangeMarkers(oldData, newStartItem);\n\t\t\t\t// @ts-ignore TODO: Set key null instead?\n\t\t\t\toldItems[oldIndex] = null;\n\t\t\t\tnewStartItem = newItems[++newStartIndex];\n\t\t\t}\n\t\t}\n\t}\n\n\tif (oldStartIndex <= oldEndIndex || newStartIndex <= newEndIndex) {\n\t\tif (oldStartIndex > oldEndIndex) {\n\t\t\t// The old list is exhausted; process new list additions\n\t\t\t// HACK: I think it would be better to move anchors to the end?\n\t\t\tlet before: Node | null =\n\t\t\t\toldStartItem?.startNode || oldItems[oldItems.length - 1]?.endNode?.nextSibling || anchor;\n\t\t\tfor (newStartIndex; newStartIndex <= newEndIndex; newStartItem = newItems[++newStartIndex]) {\n\t\t\t\t//console.log(\"create\", newStartItem.key);\n\t\t\t\tnewStartItem.data = $watch(newStartItem.data);\n\t\t\t\tcreate(newStartItem, before!);\n\t\t\t\tbefore = newStartItem.endNode?.nextSibling!;\n\t\t\t}\n\t\t} else {\n\t\t\t// The new list is exhausted; process old list removals\n\t\t\t// Just truncate the parent range's children collection\n\t\t\tif (range.children) {\n\t\t\t\trange.children.length = oldStartIndex;\n\t\t\t}\n\t\t\tfor (oldStartIndex; oldStartIndex <= oldEndIndex; oldStartItem = oldItems[++oldStartIndex]) {\n\t\t\t\t//console.log(\"clear\", oldStartItem.key);\n\t\t\t\tclearRange(oldStartItem);\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunction transferRangeMarkers(oldItem: ListItem, newItem: ListItem) {\n\tnewItem.startNode = oldItem.startNode;\n\tnewItem.endNode = oldItem.endNode;\n\n\t// Manually transfer the new data's props to the old ones (to run effects)\n\t// and then set the new data to the old one\n\tfor (let prop in oldItem.data) {\n\t\toldItem.data[prop] = newItem.data[prop];\n\t}\n\tnewItem.data = oldItem.data;\n}\n","import { type ListItem } from \"../types/ListItem\";\nimport { type Range } from \"../types/Range\";\nimport $run from \"./$run\";\nimport context from \"./context\";\nimport popRange from \"./popRange\";\nimport pushRange from \"./pushRange\";\nimport runListItems from \"./runListItems\";\n\n/**\n * Runs a `for` control statement\n * @param create A function that creates the control statement's branches\n */\nexport default function runList(\n\trange: Range,\n\tparent: ParentNode,\n\tanchor: Node | null,\n\tbuildItems: () => ListItem[],\n\tcreate: (item: ListItem, anchor: Node | null) => void,\n) {\n\tconst oldRange = pushRange(range, true);\n\n\tlet listItems: ListItem[] = [];\n\n\t// Run the list in an effect\n\t$run(function runList() {\n\t\t// Push and pop the control statement on subsequent runs, so that new item\n\t\t// ranges will be added to its children\n\t\tconst oldBranchRange = pushRange(range);\n\n\t\t// Build the array of items with keys and data\n\t\tconst newItems = buildItems();\n\n\t\t// Run the function that updates the list's items\n\t\trunListItems(range, parent, anchor, listItems, newItems, create);\n\n\t\tlistItems = newItems;\n\n\t\tpopRange(oldBranchRange);\n\t});\n\n\t// If we're mounting, the anchor will be the one that is passed in, but if\n\t// we're hydrating it will be after the items' HTML elements, so we need to\n\t// update it after all of the items have been hydrated\n\tif (context.hydrationNode) {\n\t\tanchor = context.hydrationNode.nextSibling;\n\t}\n\n\tpopRange(oldRange);\n}\n","export default function setAttribute(el: Element, name: string, value: any) {\n\tif (value === false || value == null) {\n\t\tel.removeAttribute(name);\n\t} else {\n\t\tel.setAttribute(name, value);\n\t}\n}\n","import context from \"./context\";\n\n// TODO: Should we @toggle this instead? That would call :onmount etc again for the new element\n\nexport default function setDynamicElement(el: HTMLElement, tag: string) {\n\t// If hydrating, it should already have been created as the correct element\n\tif (context.hydrationNode) {\n\t\treturn el;\n\t}\n\n\t// Replace the old element with the new element\n\tlet newElement = el.ownerDocument.createElement(tag);\n\tel.replaceWith(newElement);\n\n\treturn newElement;\n}\n"],"mappings":";;;;;;;;AAgDA,IAAM,UAAmB;AAAA,EACxB,cAAc;AAAA,EACd,aAAa;AAAA,EACb,cAAc,CAAC;AAAA,EACf,eAAe,CAAC;AAAA,EAChB,mBAAmB,CAAC;AAAA,EACpB,eAAe;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAShB;AAEA,IAAO,kBAAQ;;;ACzDA,SAAR,OAAwB,IAA0B;AACxD,kBAAQ,aAAa,KAAK,EAAE;AAC7B;;;ACPe,SAAR,UAA2B,QAAgB;AAEjD,SAAO,SAAS;AAIhB,kBAAQ,eAAe;AAIvB,QAAM,UAAU,OAAO,IAAI;AAE3B,MAAI,OAAO,YAAY,YAAY;AAClC,WAAO,UAAU;AAAA,EAClB;AAEA,kBAAQ,eAAe;AACxB;;;ACRe,SAAR,KAAsB,IAA0B;AACtD,MAAI,SAAiB;AAAA,IACpB,KAAK;AAAA,IACL,SAAS;AAAA,IACT,OAAO;AAAA,IACP,QAAQ;AAAA,EACT;AAEA,MAAI,gBAAQ,aAAa;AAExB,KAAC,gBAAQ,YAAY,YAAY,CAAC,GAAG,KAAK,MAAM;AAAA,EACjD;AAEA,YAAU,MAAM;AACjB;;;AC1BA,IAAM,kBAAkB,OAAO,aAAa;;;ACO7B,SAAR,QAA6D,QAAc;AACjF,SAAO,OAAO,eAAe,EAAE,UAAU;AAC1C;;;ACNe,SAAR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mB;AACnE,UAAQ,YAAY,QAAQ;AAC5B,UAAQ,UAAU,QAAQ;AAI1B,WAAS,QAAQ,QAAQ,MAAM;AAC9B,YAAQ,KAAK,IAAI,IAAI,QAAQ,KAAK,IAAI;AAAA,EACvC;AACA,UAAQ,OAAO,QAAQ;AACxB;;;AC7Ke,SAAR,QACN,OACA,QACA,QACA,YACA,QACC;AACD,QAAM,WAAW,UAAU,OAAO,IAAI;AAEtC,MAAI,YAAwB,CAAC;AAG7B,OAAK,SAASC,WAAU;AAGvB,UAAM,iBAAiB,UAAU,KAAK;AAGtC,UAAM,WAAW,WAAW;AAG5B,iBAAa,OAAO,QAAQ,QAAQ,WAAW,UAAU,MAAM;AAE/D,gBAAY;AAEZ,aAAS,cAAc;AAAA,EACxB,CAAC;AAKD,MAAI,gBAAQ,eAAe;AAC1B,aAAS,gBAAQ,cAAc;AAAA,EAChC;AAEA,WAAS,QAAQ;AAClB;;;AChDe,SAAR,aAA8B,IAAa,MAAc,OAAY;AAC3E,MAAI,UAAU,SAAS,SAAS,MAAM;AACrC,OAAG,gBAAgB,IAAI;AAAA,EACxB,OAAO;AACN,OAAG,aAAa,MAAM,KAAK;AAAA,EAC5B;AACD;;;ACFe,SAAR,kBAAmC,IAAiB,KAAa;AAEvE,MAAI,gBAAQ,eAAe;AAC1B,WAAO;AAAA,EACR;AAGA,MAAI,aAAa,GAAG,cAAc,cAAc,GAAG;AACnD,KAAG,YAAY,UAAU;AAEzB,SAAO;AACR;","names":["setAttribute","fragment","runControl","runList"]}
|
|
1
|
+
{"version":3,"sources":["../src/render/context.ts","../src/render/$mount.ts","../src/watch/runEffect.ts","../src/render/$run.ts","../src/watch/symbols.ts","../src/render/$unwrap.ts","../src/watch/trackEffect.ts","../src/watch/removeEffect.ts","../src/watch/triggerEffects.ts","../src/watch/proxyGet.ts","../src/watch/transferEffects.ts","../src/watch/proxySet.ts","../src/render/$watch.ts","../src/render/addAnimation.ts","../src/render/addEvent.ts","../src/motion/animate.ts","../src/render/addFragment.ts","../src/render/applyProps.ts","../src/render/flushMountEffects.ts","../src/render/getFragment.ts","../src/render/hydrate.ts","../src/render/mount.ts","../src/render/newListItem.ts","../src/render/newRange.ts","../src/render/hydrationMarkers.ts","../src/render/isComment.ts","../src/render/nodeNext.ts","../src/render/nodeAnchor.ts","../src/render/nodeChild.ts","../src/render/nodeRoot.ts","../src/render/popRange.ts","../src/render/pushRange.ts","../src/render/runControl.ts","../src/render/clearRange.ts","../src/render/runControlBranch.ts","../src/render/moveRange.ts","../src/render/runListItems.ts","../src/render/runList.ts","../src/render/setAttribute.ts","../src/render/setDynamicElement.ts"],"sourcesContent":["import { type Animation } from \"../types/Animation\";\nimport { type Cleanup } from \"../types/Cleanup\";\nimport { type Effect } from \"../types/Effect\";\nimport { type Range } from \"../types/Range\";\n\n/**\n * The global context for setting up effects and updating subscriptions.\n */\ninterface Context {\n\t/** The effect that is currently being run. */\n\tactiveEffect: Effect | null;\n\n\t/** The range that is currently being created. */\n\tactiveRange: Range | null;\n\n\t/**\n\t * Functions that were run via $mount, which should be collected and flushed\n\t * when the component has been mounted in the DOM\n\t */\n\tmountEffects: (() => Cleanup | void)[];\n\n\t/**\n\t * Events which should be added when their element has been mounted in the\n\t * DOM\n\t */\n\tstashedEvents: {\n\t\trange: Range | null;\n\t\tel: Element;\n\t\ttype: string;\n\t\tlistener: (this: Element, ev: any) => any;\n\t}[];\n\n\t/**\n\t * Animations which should be added when their element has been mounted in\n\t * the DOM\n\t */\n\tstashedAnimations: {\n\t\trange: Range | null;\n\t\tel: HTMLElement;\n\t\tin?: Animation;\n\t\tout?: Animation;\n\t}[];\n\n\t/** The node that is actively being hydrated. */\n\thydrationNode: ChildNode | null;\n\t//hn: ChildNode | null;\n}\n\nconst context: Context = {\n\tactiveEffect: null,\n\tactiveRange: null,\n\tmountEffects: [],\n\tstashedEvents: [],\n\tstashedAnimations: [],\n\thydrationNode: null,\n\t//hn: null,\n\t//get hydrationNode() {\n\t//\treturn this.hn;\n\t//},\n\t//set hydrationNode(value) {\n\t//\tconsole.log(`set hydration ${printNode(value)}`);\n\t//\tthis.hn = value;\n\t//},\n};\n\nexport default context;\n","import { type Cleanup } from \"../types/Cleanup\";\nimport context from \"./context\";\n\n/**\n * Runs and re-runs a function on component mount\n *\n * @param fn The function to run, which may return a cleanup function\n */\nexport default function $mount(fn: () => Cleanup | void): void {\n\tcontext.mountEffects.push(fn);\n}\n","import context from \"../render/context\";\nimport { type Effect } from \"../types/Effect\";\n\nexport default function runEffect(effect: Effect): void {\n\t// Reactivate it in case it's been deactivated\n\teffect.active = true;\n\n\t// Set the active effect, so that any properties accessed while running it\n\t// will trigger it in future\n\tcontext.activeEffect = effect;\n\n\t// Run the effect to register its subscriptions and get its (optional)\n\t// cleanup function\n\tconst cleanup = effect.run();\n\n\tif (typeof cleanup === \"function\") {\n\t\teffect.cleanup = cleanup;\n\t}\n\n\tcontext.activeEffect = null;\n}\n","import { type Cleanup } from \"../types/Cleanup\";\nimport { type Effect } from \"../types/Effect\";\nimport runEffect from \"../watch/runEffect\";\nimport context from \"./context\";\n\n// TODO: Take a pipeline of operators e.g. debounce\n\n/**\n * Runs and re-runs a function that depends on a watched object\n *\n * @param fn The function to run, which may return a cleanup function\n */\nexport default function $run(fn: () => Cleanup | void): void {\n\tlet effect: Effect = {\n\t\trun: fn,\n\t\tcleanup: null,\n\t\tprops: null,\n\t\tactive: true,\n\t};\n\n\tif (context.activeRange) {\n\t\t//console.log(\"the range is \", context.activeRange.id);\n\t\t(context.activeRange.effects ??= []).push(effect);\n\t}\n\n\trunEffect(effect);\n}\n","const proxyDataSymbol: unique symbol = Symbol(\"_proxy_data\");\n\nexport { proxyDataSymbol };\n","import { proxyDataSymbol } from \"../watch/symbols\";\n\n/**\n * Returns the target object of a proxy\n *\n * @param object The proxy object\n */\nexport default function $unwrap<T extends Record<PropertyKey, any>>(object: T): T {\n\treturn object[proxyDataSymbol].target || object;\n}\n","import context from \"../render/context\";\nimport { type ProxyData } from \"../types/ProxyData\";\n\nexport default function trackEffect(data: ProxyData, key: PropertyKey): void {\n\t// If there's an active effect, register this target/prop with it, so that\n\t// it will be called when this prop is set\n\tif (context.activeEffect) {\n\t\t//let effectName = String(context.activeEffect.run).split(\"{\")[0].trim();\n\t\t//console.log(`tracking effect '${effectName}' for '${String(key)}'`);\n\n\t\tlet propState = data.propData.get(key);\n\t\tif (!propState) {\n\t\t\tpropState = { effects: [] };\n\t\t\tdata.propData.set(key, propState);\n\t\t}\n\n\t\tpropState.effects ||= [];\n\t\tpropState.effects.push(context.activeEffect);\n\n\t\tcontext.activeEffect.props ||= [];\n\t\tcontext.activeEffect.props.push(propState);\n\t}\n}\n","import { type Effect } from \"../types/Effect\";\n\nexport default function removeEffect(effect: Effect): void {\n\t//let effectName = String(effect.run).split(\"{\")[0].trim();\n\t//console.log(`removing effect '${effectName}'`);\n\n\t// Run any cleanup function\n\tif (effect.cleanup) {\n\t\teffect.cleanup();\n\t}\n\n\t// Delete the effect from any props that are subscribed to it\n\tif (effect.props) {\n\t\tfor (let prop of effect.props) {\n\t\t\tif (prop.effects) {\n\t\t\t\tlet length = prop.effects.length;\n\t\t\t\tlet i = length;\n\t\t\t\twhile (i--) {\n\t\t\t\t\tif (prop.effects[i] === effect) {\n\t\t\t\t\t\tprop.effects[i] = prop.effects[length - 1];\n\t\t\t\t\t\tprop.effects.pop();\n\t\t\t\t\t\tlength -= 1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// TODO: should ideally delete the prop if there\n\t\t\t\t// are no more subscriptions??\n\t\t\t}\n\t\t}\n\t}\n\n\t// HACK: Set the effect to active = false for loops through sliced arrays\n\t// TODO: Proper signal tracking\n\teffect.active = false;\n}\n","import { type ProxyData } from \"../types/ProxyData\";\nimport removeEffect from \"./removeEffect\";\nimport runEffect from \"./runEffect\";\n\nexport default function triggerEffects(data: ProxyData, key: PropertyKey): void {\n\t// Get the effects for the supplied property\n\tlet effects = data.propData.get(key)?.effects;\n\tif (effects) {\n\t\t// HACK: Slice the array to get a copy, so that we can remove effects from\n\t\t// the property in removeEffect without skipping any here\n\t\tfor (let effect of effects.slice()) {\n\t\t\tif (effect.active) {\n\t\t\t\t//let effectName = String(effect.run).split(\"{\")[0].trim();\n\t\t\t\t//console.log(`triggered effect '${effectName}' for '${String(key)}'`);\n\n\t\t\t\tremoveEffect(effect);\n\n\t\t\t\trunEffect(effect);\n\t\t\t}\n\t\t}\n\t}\n}\n","import $watch from \"../render/$watch\";\nimport context from \"../render/context\";\nimport { type ProxyData } from \"../types/ProxyData\";\nimport { proxyDataSymbol } from \"./symbols\";\nimport trackEffect from \"./trackEffect\";\nimport triggerEffects from \"./triggerEffects\";\n\nexport default function proxyGet(\n\ttarget: Record<PropertyKey, any>,\n\tkey: PropertyKey,\n\treceiver: any,\n\tdata: ProxyData,\n): any {\n\tif (key === proxyDataSymbol) {\n\t\treturn data;\n\t}\n\n\t//console.log(`object get '${String(prop)}' on`, target);\n\n\t// Set the value to a new proxy if it's an object\n\t// But not if it's a Promise (i.e. has a `then` method)\n\tif (!data.propData.has(key)) {\n\t\tif (!data.shallow) {\n\t\t\tlet value = target[key];\n\t\t\tif (value && typeof value === \"object\" && !value[proxyDataSymbol] && !value.then) {\n\t\t\t\ttarget[key] = $watch(value);\n\t\t\t}\n\t\t}\n\t\tdata.propData.set(key, null);\n\t}\n\n\t// From https://stackoverflow.com/a/54136394\n\t// PERF: Because we know what methods are being called, we could potentially run them manually\n\t// on DOM nodes (i.e. if it's a splice, we know which to remove and add etc)\n\tif (data.isArray) {\n\t\tif (\n\t\t\tkey === \"pop\" ||\n\t\t\tkey === \"push\" ||\n\t\t\tkey === \"reverse\" ||\n\t\t\tkey === \"shift\" ||\n\t\t\tkey === \"sort\" ||\n\t\t\tkey === \"splice\" ||\n\t\t\tkey === \"unshift\"\n\t\t) {\n\t\t\t// Get the array method\n\t\t\tconst targetFunction: Function = target[key];\n\n\t\t\t// Run the array method\n\t\t\treturn function (...args: any[]) {\n\t\t\t\ttargetFunction.apply(target, args);\n\n\t\t\t\t// If this array has change functions, call them now via the\n\t\t\t\t// length property, which gets accessed in most functions\n\t\t\t\ttriggerEffects(data, \"length\");\n\t\t\t};\n\t\t} else if (key === Symbol.iterator) {\n\t\t\t// HACK: This prevents lists being re-run on every random property\n\t\t\t// access by disabling the active effect before properties get\n\t\t\t// accessed. I'm not sure if this is the best way to achieve this...\n\t\t\ttrackEffect(data, \"length\");\n\t\t\tcontext.activeEffect = null;\n\t\t} else {\n\t\t\t// If this property is being accessed in the course of setting up an effect, track it\n\t\t\t// TODO: Only if it's a property and not a function?\n\t\t\ttrackEffect(data, key);\n\t\t}\n\t} else {\n\t\t// If this property is being accessed in the course of setting up an effect, track it\n\t\t// TODO: Only if it's a property and not a function?\n\t\ttrackEffect(data, key);\n\t}\n\n\t// Return the property value\n\treturn Reflect.get(target, key, receiver);\n}\n","import $watch from \"../render/$watch\";\nimport { type ProxyData } from \"../types/ProxyData\";\nimport { proxyDataSymbol } from \"./symbols\";\n\n/**\n * Transfers property effect subscriptions from one object to another\n */\nexport default function transferEffects(\n\toldValue: Record<PropertyKey, any>,\n\tnewValue: Record<PropertyKey, any>,\n): void {\n\tconst oldData = oldValue[proxyDataSymbol] as ProxyData;\n\tconst newData = newValue[proxyDataSymbol] as ProxyData;\n\tmoveChildEffects(oldValue, newValue, oldData, newData);\n}\n\nfunction moveChildEffects(\n\toldValue: Record<PropertyKey, any>,\n\tnewValue: Record<PropertyKey, any>,\n\toldData: ProxyData,\n\tnewData: ProxyData,\n) {\n\t// Recursively transfer and run effects for child properties\n\t// TODO: Top down or bottom up?? Doing top down for now...\n\tfor (let [key, props] of oldData.propData.entries()) {\n\t\tif (props) {\n\t\t\t// Transfer the prop data\n\t\t\tnewData.propData.set(key, props);\n\n\t\t\tlet oldPropValue = oldValue[key];\n\t\t\tlet oldPropData = oldPropValue[proxyDataSymbol];\n\n\t\t\t// If the old value was a proxy, make the new value one too\n\t\t\t// TODO: Make sure we aren't accidentally creating proxies for\n\t\t\t// things that weren't before...\n\t\t\tif (oldPropData) {\n\t\t\t\tnewValue[key] = $watch(newValue[key]);\n\t\t\t}\n\n\t\t\tlet newPropValue = newValue[key];\n\n\t\t\t// Run the effects for each property\n\t\t\tif (props.effects) {\n\t\t\t\tfor (let effect of props.effects) {\n\t\t\t\t\tif (effect.cleanup) {\n\t\t\t\t\t\teffect.cleanup();\n\t\t\t\t\t}\n\n\t\t\t\t\t// Only run the effect if there is a new value\n\t\t\t\t\tif (newPropValue) {\n\t\t\t\t\t\teffect.run();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Recurse\n\t\t\tif (oldPropData) {\n\t\t\t\tlet newPropData = newPropValue[proxyDataSymbol];\n\t\t\t\tmoveChildEffects(oldPropValue, newPropValue, oldPropData, newPropData);\n\t\t\t}\n\t\t}\n\t}\n}\n","import $watch from \"../render/$watch\";\nimport { type ProxyData } from \"../types/ProxyData\";\nimport { proxyDataSymbol } from \"./symbols\";\nimport transferEffects from \"./transferEffects\";\nimport triggerEffects from \"./triggerEffects\";\n\nexport default function proxySet(\n\ttarget: Record<PropertyKey, any>,\n\tkey: PropertyKey,\n\tvalue: any,\n\treceiver: any,\n\tdata: ProxyData,\n) {\n\t//console.log(`object set '${String(prop)}' to '`, value, `' on`, target);\n\n\t// Only do things if the value has changed\n\tconst oldValue = target[key];\n\tif (value !== oldValue) {\n\t\tlet newValue = value;\n\n\t\t// If the value was previously a proxy, watch the new value and update\n\t\t// its effect subscriptions\n\t\tif (oldValue && oldValue[proxyDataSymbol]) {\n\t\t\tnewValue = $watch(value);\n\t\t\ttransferEffects(oldValue, newValue);\n\t\t}\n\n\t\t// Set the property value on the target\n\t\tReflect.set(target, key, newValue, receiver);\n\n\t\t// Re-run effects\n\t\ttriggerEffects(data, key);\n\n\t\t// If an item in an array is being set directly, trigger the length to\n\t\t// cause any lists to be re-run and data re-bound\n\t\t// TODO: Can we update the single item's data directly somehow?\n\t\tif (data.isArray && !isNaN(+String(key))) {\n\t\t\ttriggerEffects(data, \"length\");\n\t\t}\n\t}\n\n\treturn true;\n}\n","import { type ProxyData } from \"../types/ProxyData\";\nimport { type WatchOptions } from \"../types/WatchOptions\";\nimport proxyGet from \"../watch/proxyGet\";\nimport proxySet from \"../watch/proxySet\";\nimport { proxyDataSymbol } from \"../watch/symbols\";\n\n/**\n * Watches an object and runs effects when its properties are changed\n *\n * @param object The object to watch\n */\nexport default function $watch<T extends Record<PropertyKey, any>>(\n\tobject: T,\n\toptions?: WatchOptions,\n): T {\n\t// Return the object itself if it is undefined or null, or if it is already a proxy\n\tif (object == null || object[proxyDataSymbol]) {\n\t\treturn object;\n\t}\n\n\t// Make sure we can proxy this value\n\t// TODO: In debug mode maybe?\n\t//if (typeof object !== \"object\") {\n\t//\tthrow new Error(`$watch can't be called with a ${typeof object}`);\n\t//}\n\n\t// Create a proxy handler for each object, and store some data for it here\n\tconst data: ProxyData = {\n\t\ttarget: object,\n\t\tisArray: Array.isArray(object),\n\t\tshallow: !!options?.shallow,\n\t\tpropData: new Map(),\n\t};\n\tconst handler: ProxyHandler<T> = {\n\t\tget: function (target, prop, receiver) {\n\t\t\treturn proxyGet(target, prop, receiver, data);\n\t\t},\n\t\tset: function (target, prop, value, receiver) {\n\t\t\treturn proxySet(target, prop, value, receiver, data);\n\t\t},\n\t};\n\n\treturn new Proxy(object, handler) as T;\n}\n","import { type Animation } from \"../types/Animation\";\nimport context from \"./context\";\n\nexport default function addAnimation(el: HTMLElement, entry?: Animation, exit?: Animation): void {\n\t// Stash the event in context so that it can be added when the fragment is\n\t// added to the DOM\n\t// NOTE: We don't need to do this for hydration, but it's simpler to do it\n\t// the same way in both processes\n\tcontext.stashedAnimations.push({\n\t\trange: context.activeRange,\n\t\tel,\n\t\tin: entry,\n\t\tout: exit,\n\t});\n}\n","import context from \"./context\";\n\nexport default function addEvent(\n\tel: Element,\n\ttype: string,\n\tlistener: (this: Element, ev: any) => any,\n): void {\n\t// Stash the event in context so that it can be added when the fragment is\n\t// added to the DOM\n\t// NOTE: We don't need to do this for hydration, but it's simpler to do it\n\t// the same way in both processes\n\tcontext.stashedEvents.push({ range: context.activeRange, el, type, listener });\n}\n","import context from \"../render/context\";\n\n/**\n * Adds an animation for an element\n * @param el The element to animate\n * @param enter Whether the animation is being run on enter\n * @param keyframes The Web Animation API keyframes\n * @param options The Web Animmation API options\n */\nexport default async function animate(\n\tel: HTMLElement,\n\tenter: boolean,\n\tkeyframes: Keyframe[] | PropertyIndexedKeyframes | null,\n\toptions?: number | KeyframeAnimationOptions,\n): Promise<void> {\n\t// This is quite simplistic\n\t// We might need to\n\t// - store the animation\n\t// - reverse it if it's running and the range appears/disappears\n\t// - transfer the animation to the new element\n\n\tlet animationOptions = Object.assign(\n\t\t{\n\t\t\tdirection: enter ? \"normal\" : \"reverse\",\n\t\t\t// TODO: Should probably have a global setting for this somewhere\n\t\t\t// And respect browser reduce motion settings\n\t\t\tduration: 1000,\n\t\t\tfill: \"forwards\",\n\t\t},\n\t\toptions,\n\t);\n\n\tconst animation = el.animate(keyframes, animationOptions);\n\n\t// HACK: I'm not entirely sure why this is needed, but without it,\n\t// animations never start\n\tanimation.timeline = el.ownerDocument.timeline;\n\n\t// Add the animation to the active range, so that the range won't be cleared\n\t// until the animation is completed\n\tlet activeRange = context.activeRange;\n\tif (activeRange) {\n\t\t// TODO: An option for whether to await or cancel events on range remove\n\t\t// e.g. if you are doing a client side navigation, you don't want to run animations\n\t\tactiveRange.animations ??= new Set();\n\t\tactiveRange.animations.add(animation);\n\t\tawait animation.finished;\n\t\tactiveRange.animations.delete(animation);\n\t}\n}\n","import animate from \"../motion/animate\";\nimport $run from \"./$run\";\nimport context from \"./context\";\n\nexport default function addFragment(\n\tfragment: DocumentFragment,\n\tparent: ParentNode,\n\tbefore: Node | null,\n): void {\n\t//console.log(`adding fragment '${fragment.textContent}' to ${printNode(parent)}`);\n\t//console.log(\"before\", printNode(before));\n\n\tconst range = context.activeRange;\n\tconst hydrationNode = context.hydrationNode;\n\n\t// Set the active range's end node to the last node in the fragment\n\tif (range) {\n\t\tif (hydrationNode) {\n\t\t\trange.endNode = hydrationNode;\n\t\t} else {\n\t\t\trange.startNode = fragment.firstChild;\n\t\t\trange.endNode = fragment.lastChild;\n\t\t}\n\t}\n\n\tlet parentIsFragment = parent.nodeType === 11;\n\n\tif (!hydrationNode) {\n\t\t// HACK: We need to be able to add fragments to new fragments as well as\n\t\t// fragments that have already been added to the document. New fragments will\n\t\t// be ok, but fragments that have been added will not be parents of the before\n\t\t// element (because it's now in the document). In this case we will have to\n\t\t// use the before element's parent, which should work as long as we are always\n\t\t// passing a before element...\n\t\tif (parentIsFragment) {\n\t\t\tparent = before!.parentNode!;\n\t\t}\n\n\t\t// Add the fragment\n\t\tparent.insertBefore(fragment, before);\n\t}\n\n\t// If we're adding this fragment to the DOM, we can now add our stashed\n\t// events and play our stashed animations\n\tif (!parentIsFragment) {\n\t\t// Set the active range for each event and animation so it will get\n\t\t// attached to the right one and set it back afterwards\n\n\t\tfor (let event of context.stashedEvents) {\n\t\t\tcontext.activeRange = event.range;\n\t\t\t$run(function addFragmentEvent() {\n\t\t\t\tevent.el.addEventListener(event.type, event.listener);\n\t\t\t\treturn () => {\n\t\t\t\t\tevent.el.removeEventListener(event.type, event.listener);\n\t\t\t\t};\n\t\t\t});\n\t\t}\n\t\tcontext.stashedEvents.length = 0;\n\n\t\tfor (let animation of context.stashedAnimations) {\n\t\t\tcontext.activeRange = animation.range;\n\t\t\t$run(function addFragmentAnimation() {\n\t\t\t\tif (animation.in) {\n\t\t\t\t\tanimate(animation.el, true, animation.in.keyframes, animation.in.options);\n\t\t\t\t}\n\t\t\t\tif (animation.out) {\n\t\t\t\t\treturn () => {\n\t\t\t\t\t\tanimate(animation.el, false, animation.out!.keyframes, animation.out!.options);\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t\tcontext.stashedAnimations.length = 0;\n\n\t\t// Set the active range back\n\t\tcontext.activeRange = range;\n\t}\n}\n","import $run from \"./$run\";\n\nexport default function applyProps(\n\tel: Element,\n\tprops: Record<string, any> | undefined,\n\tpropNamesUsed: string[],\n): void {\n\tif (props) {\n\t\tfor (let [name, value] of Object.entries(props)) {\n\t\t\tif (!propNamesUsed.includes(name)) {\n\t\t\t\tif (name.startsWith(\"on\")) {\n\t\t\t\t\tconst eventName = name.substring(2);\n\t\t\t\t\tel.addEventListener(eventName, value);\n\t\t\t\t} else {\n\t\t\t\t\t$run(function setAttribute() {\n\t\t\t\t\t\tel.setAttribute(name, value);\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n","import $run from \"./$run\";\nimport context from \"./context\";\n\nexport default function flushMountEffects(): void {\n\tfor (let fn of context.mountEffects) {\n\t\t$run(fn);\n\t}\n}\n","export default function getFragment(\n\tdocument: Document,\n\tarray: DocumentFragment[],\n\tindex: number,\n\thtml: string,\n\tns?: boolean,\n): DocumentFragment {\n\t// Create the fragment in the array if it hasn't yet been used\n\tif (array[index] === undefined) {\n\t\t// TODO: Should pass a string for the ns, when we support other element types\n\t\tif (ns) {\n\t\t\tconst template = document.createElementNS(\"http://www.w3.org/2000/svg\", \"template\");\n\t\t\ttemplate.innerHTML = html;\n\t\t\tconst fragment = new DocumentFragment();\n\t\t\tfragment.append(...template.childNodes);\n\t\t\tarray[index] = fragment;\n\t\t} else {\n\t\t\tconst template = document.createElement(\"template\");\n\t\t\ttemplate.innerHTML = html;\n\t\t\tarray[index] = template.content;\n\t\t}\n\t}\n\n\t// Get the fragment from the array\n\t// TODO: If we're hydrating we probably don't want to create and return a\n\t// fragment unless we really need to\n\tlet fragment = array[index].cloneNode(true) as DocumentFragment;\n\n\treturn fragment;\n}\n","import { type Component } from \"../types/Component\";\nimport { type SlotRender } from \"../types/SlotRender\";\nimport context from \"./context\";\n\n/**\n * Hydrates a component into an existing DOM tree\n * @param parent The parent node\n * @param component The component to mount\n * @param props An object containing component props\n */\nexport default function hydrate(\n\tparent: ParentNode,\n\tcomponent: Component,\n\tprops?: Record<string, any>,\n\tslots?: Record<string, SlotRender>,\n): void {\n\t// When mounting, the parent must have no child elements, so we can just set\n\t// the hydration node to the first child node\n\tcontext.hydrationNode = parent.firstChild;\n\n\t// Call the component's render function\n\tcomponent(parent, null, props, undefined, slots);\n\n\tcontext.hydrationNode = null;\n}\n","import { type Component } from \"../types/Component\";\nimport { type SlotRender } from \"../types/SlotRender\";\n\n/**\n * Mounts a component into a DOM node\n *\n * @param parent The node to mount the component into\n * @param component The component to mount\n * @param props An object containing component props\n */\nexport default function mount(\n\tparent: ParentNode,\n\tcomponent: Component,\n\tprops?: Record<string, any>,\n\tslots?: Record<string, SlotRender>,\n): void {\n\t// The parent node must have no child elements, so that we can hydrate\n\t// without worrying about where to start\n\tif (parent.childElementCount) {\n\t\tthrow new Error(\"The parent node must have no child elements\");\n\t}\n\n\t// Remove all text, commments, etc\n\twhile (parent.firstChild) {\n\t\tparent.firstChild.remove();\n\t}\n\n\t// Call the component's render function\n\tcomponent(parent, null, props, undefined, slots);\n}\n","import { type ListItem } from \"../types/ListItem\";\n\nexport default function newListItem(data: Record<PropertyKey, any>, key?: any): ListItem {\n\treturn {\n\t\tstartNode: null,\n\t\tendNode: null,\n\t\tchildren: null,\n\t\tindex: 0,\n\t\teffects: null,\n\t\tanimations: null,\n\t\tdata,\n\t\tkey,\n\t};\n}\n","import { type Range } from \"../types/Range\";\n\nexport default function newRange(): Range {\n\treturn {\n\t\tstartNode: null,\n\t\tendNode: null,\n\t\tchildren: null,\n\t\tindex: 0,\n\t\teffects: null,\n\t\tanimations: null,\n\t};\n}\n","const HYDRATION_START = \"[\";\nconst HYDRATION_END = \"]\";\nconst HYDRATION_BRANCH = \"^\";\n\nexport { HYDRATION_START, HYDRATION_END, HYDRATION_BRANCH };\n","export default function isComment(node: Node): node is Comment {\n\treturn node.nodeType === 8;\n}\n","import context from \"./context\";\nimport { HYDRATION_BRANCH } from \"./hydrationMarkers\";\nimport isComment from \"./isComment\";\n\n// TODO: Should have t_next(node, 3) to get the sibling 3 nodes along\n\n/**\n * Gets the next sibling of a node\n */\nexport default function nodeNext(node: Node): Node {\n\tlet nextNode = node.nextSibling;\n\n\tif (context.hydrationNode) {\n\t\t// Remove hydration comments that are inserted at the start of branches\n\t\t// They are just used to split up text nodes that would otherwise be joined in HTML\n\t\tif (nextNode && isComment(nextNode) && nextNode.data === HYDRATION_BRANCH) {\n\t\t\tlet comment = nextNode;\n\t\t\tnextNode = nextNode.nextSibling;\n\t\t\tcomment.remove();\n\t\t}\n\t\tcontext.hydrationNode = nextNode;\n\t}\n\n\t// NOTE: We know this is not null as it is being called from generated code\n\treturn nextNode!;\n}\n","import context from \"./context\";\nimport { HYDRATION_END, HYDRATION_START } from \"./hydrationMarkers\";\nimport isComment from \"./isComment\";\nimport nodeNext from \"./nodeNext\";\n\nexport default function nodeAnchor(node: Node): Node {\n\t// If we are hydrating, the anchor will be at the end of the paired <![> and\n\t// <!]> comments\n\tif (context.hydrationNode && isComment(node) && node.data === HYDRATION_START) {\n\t\t// Skip and remove the start node\n\t\tlet currentNode = nodeNext(node);\n\t\tnode.remove();\n\n\t\t// Go through siblings until we get to the end\n\t\tlet level = 1;\n\t\twhile (currentNode) {\n\t\t\tif (isComment(currentNode)) {\n\t\t\t\tif (currentNode.data === HYDRATION_START) {\n\t\t\t\t\tlevel += 1;\n\t\t\t\t} else if (currentNode.data === HYDRATION_END) {\n\t\t\t\t\tlevel -= 1;\n\t\t\t\t}\n\t\t\t\tif (level === 0) {\n\t\t\t\t\t// Remove the end node and return the next one\n\t\t\t\t\tconst endNode = currentNode.nextSibling;\n\t\t\t\t\tcurrentNode.remove();\n\t\t\t\t\t// NOTE: We know this is not null as it is being called from\n\t\t\t\t\t// generated code\n\t\t\t\t\treturn endNode!;\n\t\t\t\t}\n\t\t\t}\n\t\t\tcurrentNode = currentNode.nextSibling!;\n\t\t}\n\n\t\tif (!currentNode) {\n\t\t\tthrow new Error(\"End hydration comment not found\");\n\t\t}\n\t}\n\n\treturn node;\n}\n","import context from \"./context\";\n\n/**\n * Gets the first child of a node\n */\nexport default function nodeChild(parent: Node): Node {\n\tlet child = parent.firstChild;\n\tif (context.hydrationNode) {\n\t\t// The child may be null when hydrating the sole text child of an\n\t\t// element with no text\n\t\tif (!child) {\n\t\t\tchild = parent.appendChild(parent.ownerDocument!.createTextNode(\"\"));\n\t\t}\n\t\tcontext.hydrationNode = child;\n\t}\n\t// NOTE: We know this is not null as it is being called from generated code\n\treturn child!;\n}\n","import context from \"./context\";\n\n/**\n * Gets the first child in a fragment\n * */\nexport default function nodeRoot(parent: Node): Node {\n\tconst hydrationNode = context.hydrationNode;\n\tif (hydrationNode) {\n\t\t// If hydrating, set the active range's start node, while we have it\n\t\tconst range = context.activeRange;\n\t\tif (range && !range.startNode) {\n\t\t\trange.startNode = hydrationNode;\n\t\t}\n\t\treturn hydrationNode;\n\t} else {\n\t\t// NOTE: We know this is not null as it is being called from generated code\n\t\treturn parent.firstChild!;\n\t}\n}\n","import { type Range } from \"../types/Range\";\nimport context from \"./context\";\n\nexport default function popRange(oldRange: Range | null): void {\n\tcontext.activeRange = oldRange;\n}\n","import { type Range } from \"../types/Range\";\nimport context from \"./context\";\n\nexport default function pushRange(range: Range, toParent = false): Range | null {\n\tconst activeRange = context.activeRange;\n\n\t// Add the new range to the currently active range's children, so that we\n\t// can delete the children with the parent\n\tif (toParent && activeRange) {\n\t\t(activeRange.children ??= []).push(range);\n\t}\n\n\t// Set the new active range\n\tcontext.activeRange = range;\n\n\t// Return the old active range, so that it can be reset when done\n\treturn activeRange;\n}\n","import { type Range } from \"../types/Range\";\nimport $run from \"./$run\";\nimport context from \"./context\";\nimport popRange from \"./popRange\";\nimport pushRange from \"./pushRange\";\n\n/**\n * Runs an`if`, `switch` or `await` control statement\n * @param create A function that creates the control statement's branches\n */\nexport default function runControl(\n\trange: Range,\n\tanchor: Node | null,\n\tcreate: (anchor: Node | null) => void,\n): void {\n\t// Store the index in the range so that it can be accessed by the statement's\n\t// branches\n\trange.index = -1;\n\n\tconst oldRange = pushRange(range, true);\n\n\t// Run the control statement in an effect\n\t$run(function runControl() {\n\t\t// Push and pop the control statement on subsequent runs, so that new branch\n\t\t// ranges will be added to its children\n\t\tconst oldBranchRange = pushRange(range);\n\n\t\t// Run the function that creates the control statement's branches\n\t\tcreate(anchor);\n\n\t\tpopRange(oldBranchRange);\n\t});\n\n\t// If we're mounting, the anchor will be the one that is passed in, but if\n\t// we're hydrating it will be after the active branch's HTML elements, so we\n\t// need to update it after the branches have been hydrated\n\tif (context.hydrationNode) {\n\t\tanchor = context.hydrationNode.nextSibling;\n\t}\n\n\tpopRange(oldRange);\n}\n","import { type Range } from \"../types/Range\";\nimport removeEffect from \"../watch/removeEffect\";\nimport context from \"./context\";\n\nexport default function clearRange(range: Range): void {\n\t//console.log(`clearing range ${printNode(range.startNode)} to ${printNode(range.endNode)}`);\n\n\t// Clear effects and collect animations that take place within this range and its children\n\tlet animations: Animation[] = [];\n\tclearEffects(range, animations);\n\n\t// Wait for animations, if any, then clear the range's nodes\n\tif (animations.length) {\n\t\tPromise.all(animations.map((a) => a.finished)).then(() => clearNodes(range));\n\t} else {\n\t\tclearNodes(range);\n\t}\n}\n\nfunction clearEffects(range: Range, animations: Animation[]) {\n\t// Delete the effects for this range\n\tif (range.effects) {\n\t\t// Set the active range to collect exit animations\n\t\t// We could instead have seperate entry and exit animation collections?\n\t\tconst oldRange = context.activeRange;\n\t\tcontext.activeRange = range;\n\n\t\tfor (let effect of range.effects) {\n\t\t\tremoveEffect(effect);\n\t\t}\n\n\t\tcontext.activeRange = oldRange;\n\t}\n\n\t// Collect any running animations, including ones from the effect cleanups\n\tif (range.animations) {\n\t\tfor (let animation of range.animations) {\n\t\t\tanimations.push(animation);\n\t\t}\n\t}\n\n\t// Recurse through the children\n\tif (range.children) {\n\t\tfor (let child of range.children) {\n\t\t\tclearEffects(child, animations);\n\t\t}\n\t\trange.children.length = 0;\n\t}\n}\n\nfunction clearNodes(range: Range) {\n\t// Clear the nodes for this range\n\tif (range.startNode) {\n\t\tlet currentNode = range.endNode || range.startNode;\n\t\t// DEBUG:\n\t\tif (range.startNode.parentNode !== currentNode.parentNode) {\n\t\t\tthrow new Error(\"range nodes have different parents\");\n\t\t}\n\t\twhile (currentNode !== range.startNode) {\n\t\t\tlet nextNode = currentNode.previousSibling;\n\t\t\tcurrentNode.remove();\n\t\t\tcurrentNode = nextNode!;\n\t\t}\n\t\tcurrentNode.remove();\n\n\t\t// Release the nodes\n\t\trange.startNode = null;\n\t\trange.endNode = null;\n\t}\n}\n","import { type Range } from \"../types/Range\";\nimport clearRange from \"./clearRange\";\nimport newRange from \"./newRange\";\nimport popRange from \"./popRange\";\nimport pushRange from \"./pushRange\";\n\nexport default function runControlBranch(range: Range, index: number, create: () => void): void {\n\t// Only run the branch if it's not the current branch\n\tif (index >= 0 && range.index === index) {\n\t\treturn;\n\t}\n\n\tif (range.children?.length) {\n\t\t// Branching ranges have exactly one child\n\t\tclearRange(range.children[0]);\n\t\trange.children.length = 0;\n\t}\n\n\tconst oldRange = pushRange(newRange(), true);\n\n\t// Run the create function\n\tcreate();\n\n\tpopRange(oldRange);\n\n\t// Set the index on the branching range\n\trange.index = index;\n}\n","import { type Range } from \"../types/Range\";\n\nexport default function moveRange(parent: Node, range: Range, before: ChildNode | null): void {\n\tconst endNode = range.endNode || range.startNode;\n\tlet currentNode = range.startNode;\n\twhile (currentNode) {\n\t\tconst nextNode = currentNode.nextSibling;\n\t\tparent.insertBefore(currentNode, before);\n\t\tif (currentNode === endNode) break;\n\t\tcurrentNode = nextNode;\n\t}\n}\n","// Adapted from https://github.com/snabbdom/snabbdom\n// With changes from https://github.com/luwes/js-diff-benchmark\n/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 Simon Friis Vindum\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\nimport { type ListItem } from \"../types/ListItem\";\nimport { type Range } from \"../types/Range\";\nimport $watch from \"./$watch\";\nimport clearRange from \"./clearRange\";\nimport context from \"./context\";\nimport moveRange from \"./moveRange\";\n\n/**\n * @param range The list's range\n * @param parent The parent DOM element\n * @param anchor The DOM element to create new items before\n * @param oldItems The list of current items\n * @param newItems The list of future items\n * @param create A function that creates the DOM elements for a new item\n */\nexport default function runListItems(\n\trange: Range,\n\tparent: ParentNode,\n\tanchor: Node | null,\n\toldItems: ListItem[],\n\tnewItems: ListItem[],\n\tcreate: (data: ListItem, before: Node | null) => void,\n): void {\n\tlet oldStartIndex = 0;\n\tlet oldEndIndex = oldItems.length - 1;\n\tlet oldStartItem = oldItems[0];\n\tlet oldEndItem = oldItems[oldEndIndex];\n\n\tlet newStartIndex = 0;\n\tlet newEndIndex = newItems.length - 1;\n\tlet newStartItem = newItems[0];\n\tlet newEndItem = newItems[newEndIndex];\n\n\tlet oldKeyToIndex: Map<any, number> | undefined;\n\tlet newKeyToIndex: Map<any, number> | undefined;\n\n\twhile (oldStartIndex <= oldEndIndex && newStartIndex <= newEndIndex) {\n\t\tif (oldStartItem == null) {\n\t\t\toldStartItem = oldItems[++oldStartIndex];\n\t\t} else if (oldEndItem == null) {\n\t\t\toldEndItem = oldItems[--oldEndIndex];\n\t\t} else if (newStartItem == null) {\n\t\t\tnewStartItem = newItems[++newStartIndex];\n\t\t} else if (newEndItem == null) {\n\t\t\tnewEndItem = newItems[--newEndIndex];\n\t\t} else if (oldStartItem.key === newStartItem.key) {\n\t\t\ttransferRangeMarkers(oldStartItem, newStartItem);\n\t\t\toldStartItem = oldItems[++oldStartIndex];\n\t\t\tnewStartItem = newItems[++newStartIndex];\n\t\t} else if (oldEndItem.key === newEndItem.key) {\n\t\t\ttransferRangeMarkers(oldEndItem, newEndItem);\n\t\t\toldEndItem = oldItems[--oldEndIndex];\n\t\t\tnewEndItem = newItems[--newEndIndex];\n\t\t} else if (oldStartItem.key === newEndItem.key) {\n\t\t\t// Move to the end\n\t\t\t//console.log(\"move\", oldStartItem.key, \"to the end\");\n\t\t\tmoveRange(parent, oldStartItem, oldEndItem.endNode?.nextSibling!);\n\t\t\ttransferRangeMarkers(oldStartItem, newEndItem);\n\t\t\toldStartItem = oldItems[++oldStartIndex];\n\t\t\tnewEndItem = newItems[--newEndIndex];\n\t\t} else if (oldEndItem.key === newStartItem.key) {\n\t\t\t// Move to the start\n\t\t\t//console.log(\"move\", oldEndItem.key, \"to the start\");\n\t\t\tmoveRange(parent, oldEndItem, oldStartItem?.startNode);\n\t\t\ttransferRangeMarkers(oldEndItem, newStartItem);\n\t\t\toldEndItem = oldItems[--oldEndIndex];\n\t\t\tnewStartItem = newItems[++newStartIndex];\n\t\t} else {\n\t\t\t// Lazily build maps of keys to indexes here\n\t\t\t// They are relevant only if there has been a move, or a mid-list\n\t\t\t// insertion or deletion, and not if there has been an insertion\n\t\t\t// at the end or deletion from the front\n\t\t\tif (!oldKeyToIndex || !newKeyToIndex) {\n\t\t\t\toldKeyToIndex = new Map();\n\t\t\t\tfor (let i = oldStartIndex; i < oldEndIndex; i++) {\n\t\t\t\t\toldKeyToIndex.set(oldItems[i].key, i);\n\t\t\t\t}\n\t\t\t\tnewKeyToIndex = new Map();\n\t\t\t\tfor (let i = newStartIndex; i < newEndIndex; i++) {\n\t\t\t\t\tnewKeyToIndex.set(newItems[i].key, i);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tlet oldIndex = oldKeyToIndex.get(newStartItem.key);\n\t\t\tlet newIndex = newKeyToIndex.get(oldStartItem.key);\n\n\t\t\tif (oldIndex === undefined && newIndex === undefined) {\n\t\t\t\t// Replace\n\t\t\t\t//console.log(\"replace\", oldStartItem.key, \"with\", newStartItem.key);\n\t\t\t\tnewStartItem.data = $watch(newStartItem.data);\n\t\t\t\tcreate(newStartItem, oldStartItem.startNode);\n\t\t\t\tclearRange(oldStartItem);\n\t\t\t\t// @ts-ignore We know we have an active range (the for loop) and that it\n\t\t\t\t// has children (because we're replacing one)\n\t\t\t\tcontext.activeRange.children.splice(oldStartIndex, 1);\n\t\t\t\toldStartItem = oldItems[++oldStartIndex];\n\t\t\t\tnewStartItem = newItems[++newStartIndex];\n\t\t\t} else if (oldIndex === undefined) {\n\t\t\t\t// Insert\n\t\t\t\t//console.log(\"insert\", newStartItem.key);\n\t\t\t\tnewStartItem.data = $watch(newStartItem.data);\n\t\t\t\tcreate(newStartItem, oldStartItem.startNode);\n\t\t\t\tnewStartItem = newItems[++newStartIndex];\n\t\t\t} else if (newIndex === undefined) {\n\t\t\t\t// Delete\n\t\t\t\t//console.log(\"delete\", oldStartItem.key);\n\t\t\t\tclearRange(oldStartItem);\n\t\t\t\t// @ts-ignore We know we have an active range (the for loop) and that it\n\t\t\t\t// has children (because we're deleting one)\n\t\t\t\tcontext.activeRange.children.splice(oldStartIndex, 1);\n\t\t\t\toldStartItem = oldItems[++oldStartIndex];\n\t\t\t} else {\n\t\t\t\t// Move\n\t\t\t\t//console.log(\"move\", newStartItem.key, \"before\", oldStartItem.key);\n\t\t\t\tconst oldData = oldItems[oldIndex];\n\t\t\t\tmoveRange(parent, oldData, oldStartItem.startNode);\n\t\t\t\ttransferRangeMarkers(oldData, newStartItem);\n\t\t\t\t// @ts-ignore TODO: Set key null instead?\n\t\t\t\toldItems[oldIndex] = null;\n\t\t\t\tnewStartItem = newItems[++newStartIndex];\n\t\t\t}\n\t\t}\n\t}\n\n\tif (oldStartIndex <= oldEndIndex || newStartIndex <= newEndIndex) {\n\t\tif (oldStartIndex > oldEndIndex) {\n\t\t\t// The old list is exhausted; process new list additions\n\t\t\t// HACK: I think it would be better to move anchors to the end?\n\t\t\tlet before: Node | null =\n\t\t\t\toldStartItem?.startNode || oldItems[oldItems.length - 1]?.endNode?.nextSibling || anchor;\n\t\t\tfor (newStartIndex; newStartIndex <= newEndIndex; newStartItem = newItems[++newStartIndex]) {\n\t\t\t\t//console.log(\"create\", newStartItem.key);\n\t\t\t\tnewStartItem.data = $watch(newStartItem.data);\n\t\t\t\tcreate(newStartItem, before!);\n\t\t\t\tbefore = newStartItem.endNode?.nextSibling!;\n\t\t\t}\n\t\t} else {\n\t\t\t// The new list is exhausted; process old list removals\n\t\t\t// Just truncate the parent range's children collection\n\t\t\tif (range.children) {\n\t\t\t\trange.children.length = oldStartIndex;\n\t\t\t}\n\t\t\tfor (oldStartIndex; oldStartIndex <= oldEndIndex; oldStartItem = oldItems[++oldStartIndex]) {\n\t\t\t\t//console.log(\"clear\", oldStartItem.key);\n\t\t\t\tclearRange(oldStartItem);\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunction transferRangeMarkers(oldItem: ListItem, newItem: ListItem) {\n\tnewItem.startNode = oldItem.startNode;\n\tnewItem.endNode = oldItem.endNode;\n\n\t// Manually transfer the new data's props to the old ones (to run effects)\n\t// and then set the new data to the old one\n\tfor (let prop in oldItem.data) {\n\t\toldItem.data[prop] = newItem.data[prop];\n\t}\n\tnewItem.data = oldItem.data;\n}\n","import { type ListItem } from \"../types/ListItem\";\nimport { type Range } from \"../types/Range\";\nimport $run from \"./$run\";\nimport context from \"./context\";\nimport popRange from \"./popRange\";\nimport pushRange from \"./pushRange\";\nimport runListItems from \"./runListItems\";\n\n/**\n * Runs a `for` control statement\n * @param create A function that creates the control statement's branches\n */\nexport default function runList(\n\trange: Range,\n\tparent: ParentNode,\n\tanchor: Node | null,\n\tbuildItems: () => ListItem[],\n\tcreate: (item: ListItem, anchor: Node | null) => void,\n): void {\n\tconst oldRange = pushRange(range, true);\n\n\tlet listItems: ListItem[] = [];\n\n\t// Run the list in an effect\n\t$run(function runList() {\n\t\t// Push and pop the control statement on subsequent runs, so that new item\n\t\t// ranges will be added to its children\n\t\tconst oldBranchRange = pushRange(range);\n\n\t\t// Build the array of items with keys and data\n\t\tconst newItems = buildItems();\n\n\t\t// Run the function that updates the list's items\n\t\trunListItems(range, parent, anchor, listItems, newItems, create);\n\n\t\tlistItems = newItems;\n\n\t\tpopRange(oldBranchRange);\n\t});\n\n\t// If we're mounting, the anchor will be the one that is passed in, but if\n\t// we're hydrating it will be after the items' HTML elements, so we need to\n\t// update it after all of the items have been hydrated\n\tif (context.hydrationNode) {\n\t\tanchor = context.hydrationNode.nextSibling;\n\t}\n\n\tpopRange(oldRange);\n}\n","export default function setAttribute(el: Element, name: string, value: any): void {\n\tif (value === false || value == null) {\n\t\tel.removeAttribute(name);\n\t} else {\n\t\tel.setAttribute(name, value);\n\t}\n}\n","import context from \"./context\";\n\n// TODO: Should we @toggle this instead? That would call :onmount etc again for the new element\n\nexport default function setDynamicElement(el: HTMLElement, tag: string): HTMLElement {\n\t// If hydrating, it should already have been created as the correct element\n\tif (context.hydrationNode) {\n\t\treturn el;\n\t}\n\n\t// Replace the old element with the new element\n\tlet newElement = el.ownerDocument.createElement(tag);\n\tel.replaceWith(newElement);\n\n\treturn newElement;\n}\n"],"mappings":";;;;;;;;AAgDA,IAAM,UAAmB;AAAA,EACxB,cAAc;AAAA,EACd,aAAa;AAAA,EACb,cAAc,CAAC;AAAA,EACf,eAAe,CAAC;AAAA,EAChB,mBAAmB,CAAC;AAAA,EACpB,eAAe;AAA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