@manyducks.co/dolla 2.0.0-alpha.67 → 2.0.0-alpha.68
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/README.md +24 -75
- package/dist/core/context.d.ts +11 -25
- package/dist/{hooks/index.d.ts → core/hooks.d.ts} +19 -26
- package/dist/core/index.d.ts +5 -4
- package/dist/core/markup.d.ts +6 -31
- package/dist/core/nodes/dynamic.d.ts +1 -1
- package/dist/core/nodes/element.d.ts +0 -1
- package/dist/core/ref.d.ts +1 -0
- package/dist/core/signals.d.ts +18 -32
- package/dist/core/views/for.d.ts +2 -2
- package/dist/core/views/show.d.ts +3 -3
- package/dist/i18n.js +121 -122
- package/dist/i18n.js.map +1 -1
- package/dist/{index-DKMlSUEt.js → index-BLYt-mrI.js} +22 -23
- package/dist/index-BLYt-mrI.js.map +1 -0
- package/dist/index.js +145 -97
- package/dist/index.js.map +1 -1
- package/dist/jsx-dev-runtime.js +1 -1
- package/dist/jsx-runtime.js +1 -1
- package/dist/{signals-HNnDUJRQ.js → logger-IE5c3t-c.js} +250 -184
- package/dist/logger-IE5c3t-c.js.map +1 -0
- package/dist/markup-8Olu6qoy.js +1063 -0
- package/dist/markup-8Olu6qoy.js.map +1 -0
- package/dist/router.js +1 -1
- package/docs/hooks.md +17 -17
- package/docs/mixins.md +10 -7
- package/docs/ref.md +14 -14
- package/docs/router.md +8 -5
- package/package.json +1 -5
- package/vite.config.js +0 -1
- package/dist/core/scheduler.d.ts +0 -25
- package/dist/hooks.js +0 -68
- package/dist/hooks.js.map +0 -1
- package/dist/index-DKMlSUEt.js.map +0 -1
- package/dist/logger-BcgYqLUO.js +0 -82
- package/dist/logger-BcgYqLUO.js.map +0 -1
- package/dist/markup-BgNq6mZF.js +0 -1182
- package/dist/markup-BgNq6mZF.js.map +0 -1
- package/dist/ref-BD79iqlg.js +0 -15
- package/dist/ref-BD79iqlg.js.map +0 -1
- package/dist/signals-HNnDUJRQ.js.map +0 -1
- /package/dist/{hooks/index.test.d.ts → core/hooks.test.d.ts} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"markup-8Olu6qoy.js","sources":["../src/core/context.ts","../src/core/nodes/_markup.ts","../src/core/nodes/dom.ts","../src/core/nodes/dynamic.ts","../src/core/ref.ts","../src/core/nodes/view.ts","../src/core/nodes/element.ts","../src/core/nodes/portal.ts","../src/core/nodes/repeat.ts","../src/core/markup.ts"],"sourcesContent":["import { isFunction, typeOf } from \"../typeChecking\";\nimport type { Store } from \"../types\";\nimport { getUniqueId } from \"../utils\";\nimport { createLogger, type Logger, type LoggerOptions } from \"./logger\";\nimport {\n effect,\n type EffectFn,\n get,\n type MaybeSignal,\n setCurrentContext,\n type UnsubscribeFn,\n untracked,\n} from \"./signals\";\n\nexport enum LifecycleEvent {\n WILL_MOUNT = \"willMount\",\n DID_MOUNT = \"didMount\",\n WILL_UNMOUNT = \"willUnmount\",\n DID_UNMOUNT = \"didUnmount\",\n DISPOSE = \"dispose\",\n}\n\nexport type LifecycleEventName = \"willMount\" | \"didMount\" | \"willUnmount\" | \"didUnmount\" | \"dispose\";\n\ntype LifecycleListener = () => void;\n\nenum LifecycleState {\n Unmounted = 0,\n WillMount = 1,\n DidMount = 2,\n WillUnmount = 3,\n DidUnmount = 4,\n Disposed = 5,\n}\n\nconst NAME = Symbol(\"name\");\nconst LIFECYCLE = Symbol(\"lifecycle\");\nconst PARENT = Symbol(\"parent\");\nconst STORES = Symbol(\"stores\");\nconst STATE = Symbol(\"state\");\n\n/**\n * Manages lifecycle events for a Context.\n */\nclass ContextLifecycle {\n private context;\n\n state = LifecycleState.Unmounted;\n listeners = new Map<LifecycleEvent, Set<LifecycleListener>>();\n bound?: Set<Context>;\n\n constructor(context: Context) {\n this.context = context;\n }\n\n /**\n * Listen for a certain event to be emitted. Listeners are called when the event results in a state change.\n */\n on<E extends LifecycleEvent>(event: E, listener: LifecycleListener) {\n const listeners = this.listeners.get(event);\n if (!listeners) {\n this.listeners.set(event, new Set([listener]));\n } else {\n listeners.add(listener);\n }\n }\n\n /**\n * Stop a particular listener from being called when an event is emitted.\n */\n off<E extends LifecycleEvent>(event: E, listener: LifecycleListener) {\n const listeners = this.listeners.get(event);\n if (listeners) {\n listeners.delete(listener);\n if (listeners.size === 0) {\n this.listeners.delete(event);\n }\n }\n }\n\n /**\n * Advance the lifecycle state machine.\n */\n emit<E extends LifecycleEvent>(event: E) {\n switch (event) {\n case LifecycleEvent.WILL_MOUNT: {\n if (this.state < LifecycleState.WillMount) {\n this.state = LifecycleState.WillMount;\n this.notify(event);\n } else {\n this.context.crash(new Error(`Tried to WILL_MOUNT context at state ${this.state}`));\n }\n break;\n }\n case LifecycleEvent.DID_MOUNT: {\n if (this.state >= LifecycleState.WillMount && this.state < LifecycleState.DidMount) {\n this.state = LifecycleState.DidMount;\n this.notify(event);\n } else {\n this.context.crash(new Error(`Tried to WILL_UNMOUNT context at state ${this.state}`));\n }\n break;\n }\n case LifecycleEvent.WILL_UNMOUNT: {\n if (this.state >= LifecycleState.DidMount && this.state < LifecycleState.WillUnmount) {\n this.notify(event);\n this.state = LifecycleState.WillUnmount;\n } else {\n this.context.crash(new Error(`Tried to WILL_UNMOUNT context at state ${this.state}`));\n }\n break;\n }\n case LifecycleEvent.DID_UNMOUNT: {\n if (this.state >= LifecycleState.WillUnmount && this.state < LifecycleState.DidUnmount) {\n // Loop back to .Unmounted\n this.state = LifecycleState.DidUnmount % LifecycleState.DidUnmount;\n this.notify(event);\n } else {\n this.context.crash(new Error(`Tried to DID_UNMOUNT context at state ${this.state}`));\n }\n break;\n }\n case LifecycleEvent.DISPOSE: {\n if (this.state === LifecycleState.Unmounted) {\n this.notify(event);\n this.listeners.clear();\n this.bound = undefined;\n this.context[STATE] = undefined;\n this.context[STORES] = undefined;\n this.state = LifecycleState.Disposed;\n } else {\n this.context.crash(new Error(`Tried to DISPOSE context at state ${this.state}`));\n }\n break;\n }\n }\n }\n\n /**\n * Bind `context` to this lifecycle; when any event is emitted here it will be emitted for `context` as well.\n */\n bind(context: Context) {\n if (!this.bound) {\n this.bound = new Set([context]);\n } else {\n this.bound.add(context);\n }\n }\n\n /**\n * Call all the event's listeners and re-emit to bound contexts.\n */\n private notify<E extends LifecycleEvent>(event: E) {\n // Call listener functions.\n const listeners = this.listeners.get(event);\n if (listeners) {\n for (const listener of listeners) {\n listener();\n }\n }\n // Emit to bound contexts.\n if (this.bound) {\n for (const context of this.bound) {\n context[LIFECYCLE].emit(event);\n }\n }\n }\n}\n\nexport interface ContextGetStateOptions<T> {\n fallback?: T;\n\n /**\n * Only check this context; skip parent contexts.\n */\n immediate?: boolean;\n}\n\nexport interface ContextGetStateOptionsWithFallbackValue<T> extends ContextGetStateOptions<T> {\n fallback: T;\n}\n\nexport interface ContextGetStateMapOptions {\n /**\n * Only include state from this context; skip parent contexts.\n */\n immediate?: boolean;\n}\n\nexport interface ContextOptions {\n logger?: LoggerOptions;\n}\n\nexport interface LinkedContextOptions extends ContextOptions {\n bindLifecycleToParent?: boolean;\n}\n\nexport interface Context extends Logger {}\n\nexport class Context implements Logger {\n #name: MaybeSignal<string>;\n\n [NAME]: string;\n [LIFECYCLE] = new ContextLifecycle(this);\n [PARENT]?: Context;\n [STORES]?: Map<Store<any, any>, any>;\n [STATE]?: Map<any, any>;\n\n get isMounted() {\n const { state } = this[LIFECYCLE];\n return state >= LifecycleState.DidMount && state < LifecycleState.DidUnmount;\n }\n\n /**\n * Returns a new Context with this one as its parent.\n */\n static createChildOf(parent: Context, name: MaybeSignal<string>, options?: LinkedContextOptions): Context {\n const context = new Context(name, options);\n context[PARENT] = parent;\n if (options?.bindLifecycleToParent) parent[LIFECYCLE].bind(context);\n return context;\n }\n\n /**\n * Emit a lifecycle event to `context`.\n */\n static emit(context: Context, event: LifecycleEvent) {\n context[LIFECYCLE].emit(event);\n }\n\n constructor(name: MaybeSignal<string>, options?: ContextOptions) {\n this.#name = name;\n this[NAME] = untracked(name);\n\n // Add logger methods.\n const logger = createLogger(() => get(this.#name), options?.logger);\n const descriptors = Object.getOwnPropertyDescriptors(logger);\n for (const key in descriptors) {\n Object.defineProperty(this, key, descriptors[key]);\n }\n }\n\n /**\n * Returns the current name of this context.\n */\n getName(): string {\n return untracked(this.#name);\n }\n\n /**\n * Sets a new name for this context.\n */\n setName(name: MaybeSignal<string>) {\n this.#name = name;\n this[NAME] = untracked(name); // Try to store name as a readable string for debugging purposes.\n }\n\n /**\n * Creates an instance of a store and attaches it to this context.\n */\n addStore<T>(store: Store<any, T>, options?: any): this {\n if (this[STORES]?.get(store)) {\n let name = store.name ? `'${store.name}'` : \"this store\";\n throw this.crash(new Error(`An instance of ${name} was already added on this context.`));\n }\n\n const context = Context.createChildOf(this, store.name, {\n bindLifecycleToParent: true,\n logger: { tag: getUniqueId(), tagName: \"uid\" },\n });\n try {\n if (!this[STORES]) this[STORES] = new Map();\n const prevCtx = setCurrentContext(context);\n const result = store.call(context, options, context);\n setCurrentContext(prevCtx);\n this[STORES].set(store, result);\n } catch (error) {\n throw this.crash(error as Error);\n }\n\n return this;\n }\n\n /**\n * Retrieves the nearest instance of `store`. If this context doesn't have it, the parent context is checked. This process continues until either:\n * 1. An instance of the store is found and returned.\n * 2. No instance is found and an error is thrown.\n */\n getStore<T>(store: Store<any, T>): T {\n if (!isFunction(store)) {\n throw new Error(`Invalid store.`);\n }\n let context: Context = this;\n let result: unknown;\n while (true) {\n result = context[STORES]?.get(store);\n if (result == null && context[PARENT] != null) {\n context = context[PARENT];\n } else {\n break;\n }\n }\n if (result == null) {\n throw this.crash(new Error(`Store '${store.name}' is not provided by this context.`));\n }\n return result as T;\n }\n\n /**\n * Registers a `listener` to be called at a specific transition point during this context's lifecycle.\n *\n * Prefer `useMount` and `useUnmount` hooks for general usage.\n */\n onLifecycleTransition(event: LifecycleEventName, listener: LifecycleListener) {\n this[LIFECYCLE].on(event as LifecycleEvent, listener);\n return () => this[LIFECYCLE].off(event as LifecycleEvent, listener);\n }\n\n effect(callback: EffectFn) {\n const fn = () => {\n try {\n return callback(); // Return callback so cleanup function passes through to effect handler\n } catch (error) {\n this.error(error);\n if (error instanceof Error) {\n this.crash(error);\n } else if (typeof error === \"string\") {\n this.crash(new Error(error));\n } else {\n this.crash(new Error(`Unknown error thrown in effect callback`));\n }\n }\n };\n\n if (this[LIFECYCLE].state >= LifecycleState.WillMount) {\n // This code is probably in a lifecycle hook; run the effect immediately and trigger unsubscribe when context unmounts.\n const unsubscribe = effect(fn);\n this[LIFECYCLE].on(LifecycleEvent.DID_UNMOUNT, unsubscribe);\n return unsubscribe;\n } else {\n // Prime the effect to run when the context is mounted and unsubscribe when unmounted, unless unsubscribed before `willMount`.\n let unsubscribe: UnsubscribeFn | undefined;\n let disposed = false;\n this[LIFECYCLE].on(LifecycleEvent.WILL_MOUNT, () => {\n if (!disposed) {\n unsubscribe = effect(fn);\n this[LIFECYCLE].on(LifecycleEvent.DID_UNMOUNT, unsubscribe);\n }\n });\n return () => {\n if (unsubscribe != null) {\n disposed = true;\n unsubscribe();\n }\n };\n }\n }\n\n /**\n * Gets the value stored at `key`, or returns `options.fallback` if none is set.\n */\n getState<T>(key: any, options: ContextGetStateOptionsWithFallbackValue<T>): T;\n\n /**\n * Gets the value stored at `key`, or throws an error if none is set.\n */\n getState<T>(key: any, options?: ContextGetStateOptions<T>): T;\n\n getState<T>(key: any, options?: ContextGetStateOptions<T>): T {\n const immediate = options?.immediate ?? false;\n let context: Context = this;\n let value: any;\n while (true) {\n value = context[STATE]?.get(key);\n if (value === undefined && !immediate && context[PARENT] != null) {\n context = context[PARENT];\n } else {\n break;\n }\n }\n if (value === undefined) {\n if (options != null && Object.hasOwn(options, \"fallback\")) {\n return options.fallback!;\n } else {\n throw new Error(`Expected a value for '${String(key)}' but got undefined.`);\n }\n }\n return value;\n }\n\n /**\n * Returns a Map containing all state values available to this context.\n *\n * Pass `options.immediate` to only include state stored on this context.\n * By default all state stored on parent contexts is also included.\n */\n getStateMap(options?: ContextGetStateMapOptions): Map<any, any> {\n let context: Context = this;\n const immediate = options?.immediate ?? false;\n const entries: [any, any][] = [];\n while (true) {\n if (context[STATE]) {\n entries.push(...context[STATE].entries());\n }\n if (!immediate && context[PARENT] != null) {\n context = context[PARENT];\n } else {\n break;\n }\n }\n return new Map(entries.reverse());\n }\n\n /**\n * Stores `value` at `key` in this context's state.\n */\n setState<T>(key: any, value: T): void;\n\n /**\n * For each tuple in `entries`, stores `value` at `key` in this context's state.\n */\n setState(entries: [key: any, value: any][]): void;\n\n setState(...args: any[]) {\n if (!this[STATE]) {\n this[STATE] = new Map();\n }\n if (args.length === 2) {\n this[STATE].set(args[0], args[1]);\n } else if (typeOf(args[0]) === \"array\") {\n for (const [key, value] of args[0]) {\n if (value === undefined) {\n this[STATE].delete(key);\n } else {\n this[STATE].set(key, value);\n }\n }\n } else {\n throw new Error(`Invalid arguments.`);\n }\n\n return this;\n }\n}\n\nexport function createContext(name: MaybeSignal<string>, options?: ContextOptions) {\n return new Context(name, options);\n}\n","/**\n * A node that can be mounted by the Markup layout engine. Can be extended to create new custom node types.\n *\n * A `MarkupNode` instance can be passed anywhere a `Renderable` is required.\n */\nexport abstract class MarkupNode {\n /**\n * Returns a single DOM node to represent this MarkupNode's position in the DOM.\n * Usually the parent element, but it can be an empty Text node used as a marker.\n *\n * It only needs to be defined while the node is mounted, so it can be created in the `mount` function.\n */\n getRoot(): Node | undefined {\n throw new Error(\"getRoot method is not implemented\");\n }\n\n /**\n * Returns true while this node is mounted.\n */\n isMounted(): boolean {\n throw new Error(\"isMounted method is not implemented\");\n }\n\n /**\n * Mount this node to a `parent` element.\n * If passed, this node will be mounted as the next sibling of `after`.\n */\n mount(parent: Element, after?: Node): void {\n throw new Error(\"mount method is not implemented\");\n }\n\n /**\n * Unmount this MarkupNode from its parent element.\n *\n * The `skipDOM` option can be passed as an optimization when unmounting a parent node.\n * A value of `true` indicates that no DOM operations need to happen because the parent is already being unmounted.\n *\n * @param skipDOM - No DOM updates will be performed when true. Lifecycle methods will be called regardless.\n */\n unmount(skipDOM?: boolean): void {\n throw new Error(\"unmount method is not implemented\");\n }\n\n /**\n * Moves a node without unmounting and remounting (if the browser supports Element.moveBefore).\n */\n move(parent: Element, after?: Node): void {\n throw new Error(\"move method is not implemented\");\n }\n}\n","import { MarkupNode } from \"./_markup\";\n\n/**\n * A lightweight MarkupNode wrapper for a plain DOM node.\n */\nexport class DOMNode extends MarkupNode {\n private root: Node;\n\n constructor(node: Node) {\n super();\n this.root = node;\n }\n\n override getRoot() {\n return this.root;\n }\n\n override isMounted() {\n return this.root.parentNode != null;\n }\n\n override mount(parent: Element, after?: Node) {\n parent.insertBefore(this.root, after?.nextSibling ?? null);\n }\n\n override unmount(skipDOM = false) {\n if (!skipDOM && this.root.parentNode) {\n this.root.parentNode.removeChild(this.root);\n }\n }\n\n override move(parent: Element, after?: Node) {\n if (\"moveBefore\" in parent && this.root instanceof Element) {\n try {\n (parent as any).moveBefore(this.root, after?.nextSibling ?? null);\n } catch {\n this.mount(parent, after);\n }\n } else {\n this.mount(parent, after);\n }\n }\n}\n","import { moveBefore, toArray } from \"../../utils.js\";\nimport type { Context } from \"../context.js\";\nimport { toMarkupNodes } from \"../markup.js\";\nimport { effect, type Signal, type UnsubscribeFn, untracked } from \"../signals.js\";\nimport { MarkupNode } from \"./_markup.js\";\n\n/**\n * Renders any kind of content; markup, signals, DOM nodes, etc.\n * If it can be rendered by Dolla then Dynamic will do it.\n */\nexport class DynamicNode extends MarkupNode {\n private root = document.createTextNode(\"\");\n\n private children: MarkupNode[] = [];\n private context: Context;\n\n private $slot: Signal<any>;\n private unsubscribe?: UnsubscribeFn;\n\n constructor(context: Context, $slot: Signal<any>) {\n super();\n this.context = context;\n this.$slot = $slot;\n }\n\n override getRoot() {\n return this.root;\n }\n\n override isMounted() {\n return this.root.parentElement != null;\n }\n\n override mount(parent: Node, after?: Node) {\n if (!this.isMounted()) {\n parent.insertBefore(this.root, after?.nextSibling ?? null);\n\n this.unsubscribe = effect(() => {\n try {\n const content = this.$slot();\n untracked(() => {\n this.update(toArray(content));\n });\n } catch (error) {\n this.context.crash(error as Error);\n }\n });\n }\n }\n\n override unmount(skipDOM = false) {\n this.unsubscribe?.();\n\n if (this.isMounted()) {\n moveBefore(this.root.parentElement!, this.root, this.children[0]?.getRoot() ?? null);\n this.root.parentNode?.removeChild(this.root);\n this.cleanup(skipDOM);\n }\n }\n\n override move(parent: Element, after?: Node) {\n if (\"moveBefore\" in parent) {\n try {\n (parent as any).moveBefore(this.root, after?.nextSibling ?? null);\n for (let i = 0; i < this.children.length; i++) {\n this.children[i].move(parent, this.children[i - 1]?.getRoot() ?? this.root);\n }\n (parent as any).moveBefore(this.root, this.children.at(-1)?.getRoot()?.nextSibling ?? null);\n } catch {\n this.mount(parent, after);\n }\n } else {\n this.mount(parent, after);\n }\n }\n\n private cleanup(skipDOM: boolean) {\n for (const element of this.children) {\n if (element.isMounted()) element.unmount(skipDOM);\n }\n this.children.length = 0;\n }\n\n private update(content: any[]) {\n this.cleanup(false);\n\n if (content.length === 0 || !this.isMounted()) return;\n\n const nodes = toMarkupNodes(this.context, content);\n\n for (const node of nodes) {\n const previous = this.children.at(-1)?.getRoot() || this.root;\n node.mount(this.root.parentElement!, previous);\n this.children.push(node);\n }\n\n // Move marker after children\n const parent = this.root.parentElement!;\n const lastChildNextSibling = this.children.at(-1)?.getRoot()?.nextSibling ?? null;\n moveBefore(parent, this.root, lastChildNextSibling);\n }\n}\n","export const EMPTY_REF = Symbol(\"Ref.EMPTY\");\n\n/**\n * A hybrid getter/setter function that stores the last value it was called with.\n * Guarantees a value is held at runtime by throwing an error if no value is set.\n */\nexport interface Ref<T> {\n /**\n * Returns the currently stored value of the ref, or throws an error if no value has been set.\n */\n (): T;\n\n /**\n * Stores a new value to the ref and returns that value.\n */\n (value: T): T;\n}\n\n/**\n * Creates a Ref.\n */\nexport function ref<T>(value?: T): Ref<T>;\n\nexport function ref<T>(...value: [T]): Ref<T> {\n return _ref.bind({ current: value.length ? value[0] : EMPTY_REF }) as Ref<T>;\n}\n\n/*==================================*\\\n|| Implementation ||\n\\*==================================*/\n\ninterface RefValue<T> {\n current: T | typeof EMPTY_REF;\n}\n\nfunction _ref<T>(this: RefValue<T>, ...value: [T]): T {\n if (value.length) {\n this.current = value[0];\n } else {\n if (this.current === EMPTY_REF) {\n throw new Error(\"Ref getter was called, but ref has no value! Be sure to set your refs before accessing them.\");\n }\n }\n return this.current;\n}\n","import type { View } from \"../../types.js\";\nimport { getUniqueId } from \"../../utils.js\";\nimport { Context, LifecycleEvent } from \"../context.js\";\nimport { render } from \"../markup.js\";\nimport { setCurrentContext } from \"../signals.js\";\nimport { MarkupNode } from \"./_markup.js\";\n\nexport const VIEW = Symbol(\"ViewNode\");\n\n/**\n * Renders a View.\n */\nexport class ViewNode<P> extends MarkupNode {\n readonly id = getUniqueId();\n readonly props;\n readonly context: Context;\n readonly view;\n\n node?: MarkupNode;\n\n /**\n * @param context - Parent contenxt to link to.\n * @param view - View function to mount.\n * @param props - Props to pass to view function.\n */\n constructor(context: Context, view: View<P>, props: P) {\n super();\n this.context = Context.createChildOf(context, view.name ?? \"anonymous view\", {\n logger: {\n tag: this.id,\n tagName: \"uid\",\n },\n });\n this.context.setState(VIEW, this);\n this.props = props;\n this.view = view;\n }\n\n getRoot() {\n return this.node?.getRoot();\n }\n\n isMounted() {\n return this.context.isMounted;\n }\n\n mount(parent: Element, after?: Node) {\n // Don't run lifecycle hooks or initialize if already connected.\n // Calling connect again can be used to re-order elements that are already connected to the DOM.\n const wasMounted = this.isMounted();\n\n // TODO: Look into own state and find route controller.\n // If preload function exists, pass the route controller to it.\n // If no preload function exists, just call .next() on the route.\n // Preload function is added by useRoutePreload hook.\n\n // One problem is mounting and unmounting is entirely synchronous, but we need async and suspense.\n // While a view is in suspense, the nearest suspense boundary shows fallback content.\n // Routes are a suspense boundary of a sort where they don't unmount the previous view until the next leaves suspense.\n\n if (!wasMounted) {\n const { context, props, view } = this;\n try {\n const prevCtx = setCurrentContext(context);\n const result = view.call(context, props, context);\n setCurrentContext(prevCtx);\n if (result != null && result !== false) {\n this.node = render(result, context);\n }\n } catch (error) {\n if (error instanceof Error) {\n context.crash(error);\n }\n throw error;\n }\n\n Context.emit(this.context, LifecycleEvent.WILL_MOUNT);\n }\n\n if (this.node) {\n this.node.mount(parent, after);\n }\n\n if (!wasMounted) Context.emit(this.context, LifecycleEvent.DID_MOUNT);\n }\n\n unmount(skipDOM = false) {\n Context.emit(this.context, LifecycleEvent.WILL_UNMOUNT);\n\n if (this.node) {\n this.node.unmount(skipDOM);\n }\n\n Context.emit(this.context, LifecycleEvent.DID_UNMOUNT);\n Context.emit(this.context, LifecycleEvent.DISPOSE);\n }\n\n move(parent: Element, after?: Node) {\n this.node?.move(parent, after);\n }\n}\n","import { isFunction, isNumber, isObject, isString } from \"../../typeChecking.js\";\nimport { getIntegerId, omit, toArray, toCamelCase } from \"../../utils.js\";\nimport { Context, LifecycleEvent } from \"../context.js\";\nimport { getEnv } from \"../env.js\";\nimport { toMarkupNodes } from \"../markup.js\";\nimport { EMPTY_REF, Ref } from \"../ref.js\";\nimport { effect, get, setCurrentContext, type MaybeSignal, type Signal, type UnsubscribeFn } from \"../signals.js\";\n\nimport { MarkupNode } from \"./_markup.js\";\nimport { VIEW, ViewNode } from \"./view.js\";\n\nconst isCamelCaseEventName = (key: string) => /^on[A-Z]/.test(key);\n\nconst IS_SVG = Symbol(\"HTML.isSVG\");\n\n// Properties in this list will not be processed by applyProps because they are already handled elsewhere.\nconst ignoredProps = [\"class\", \"className\", \"ref\", \"mixin\", \"children\"];\n\n/**\n * Renders an HTML or SVG element.\n */\nexport class ElementNode extends MarkupNode {\n private root: HTMLElement | SVGElement;\n\n private id = getIntegerId();\n\n readonly tag;\n readonly props: Record<string, any>;\n\n private context: Context;\n private childNodes: MarkupNode[] = [];\n private unsubscribers: UnsubscribeFn[] = [];\n\n // Track the ref so we can nullify it on unmount.\n private ref?: Ref<any>;\n\n // Prevents 'onClickOutside' handlers from firing in the same cycle in which the element is connected.\n private canClickAway = false;\n\n constructor(context: Context, tag: string, props: Record<string, any>) {\n super();\n\n this.tag = tag;\n this.props = props;\n this.context = Context.createChildOf(context, getLoggerName.bind(this));\n\n // This and all nested views will be created as SVG elements.\n if (tag.toLowerCase() === \"svg\") {\n this.context.setState(IS_SVG, true);\n }\n\n // Create node with the appropriate constructor.\n if (this.context.getState(IS_SVG, { fallback: false })) {\n this.root = document.createElementNS(\"http://www.w3.org/2000/svg\", tag);\n } else {\n this.root = document.createElement(tag);\n }\n\n // Add view name as a data attribute in development mode for better debugging.\n if (getEnv() === \"development\") {\n const view = this.context.getState<ViewNode<any> | null>(VIEW, { fallback: null });\n if (view) {\n this.root.dataset.view = view.context.getName();\n }\n }\n\n if (props.ref) {\n if (isFunction(props.ref)) {\n this.ref = props.ref;\n this.ref(this.root);\n } else {\n throw new Error(\"Expected ref to be a function. Got: \" + props.ref);\n }\n }\n }\n\n override getRoot() {\n return this.root;\n }\n\n override isMounted() {\n return this.context.isMounted;\n }\n\n override mount(parent: Node, after?: Node) {\n const wasMounted = this.isMounted();\n\n if (!wasMounted) {\n const { props } = this;\n\n if (props.mixin) {\n for (const mixin of toArray(props.mixin)) {\n const context = Context.createChildOf(this.context, getLoggerName.bind(this), {\n bindLifecycleToParent: true,\n logger: { tagName: mixin.name === \"mixin\" ? undefined : \"mixin\", tag: mixin.name },\n });\n const prevCtx = setCurrentContext(context);\n mixin(this.root, context);\n setCurrentContext(prevCtx);\n }\n }\n\n Context.emit(this.context, LifecycleEvent.WILL_MOUNT);\n\n const classes = props.className ?? props.class;\n\n this.applyProps(this.root, props);\n if (props.style) this.applyStyles(this.root, props.style, this.unsubscribers);\n if (classes) this.applyClasses(this.root, classes, this.unsubscribers);\n\n if (props.children) {\n this.childNodes = toMarkupNodes(this.context, props.children);\n }\n }\n\n if (!wasMounted) {\n for (let i = 0; i < this.childNodes.length; i++) {\n const child = this.childNodes[i];\n const previous = i > 0 ? this.childNodes[i - 1].getRoot() : undefined;\n child.mount(this.root!, previous);\n }\n }\n\n if (this.root.parentNode === parent && \"moveBefore\" in parent) {\n (parent as any).moveBefore(this.root!, after?.nextSibling ?? null);\n } else {\n parent.insertBefore(this.root!, after?.nextSibling ?? null);\n }\n\n this.canClickAway = true;\n\n if (!wasMounted) Context.emit(this.context, LifecycleEvent.DID_MOUNT);\n }\n\n override unmount(skipDOM = false) {\n Context.emit(this.context, LifecycleEvent.WILL_UNMOUNT);\n\n if (!skipDOM) {\n this.root!.parentNode?.removeChild(this.root!);\n }\n\n for (const child of this.childNodes) {\n child.unmount(true);\n }\n\n this.canClickAway = false;\n\n for (const unsubscribe of this.unsubscribers) {\n unsubscribe();\n }\n this.unsubscribers.length = 0;\n\n Context.emit(this.context, LifecycleEvent.DID_UNMOUNT);\n Context.emit(this.context, LifecycleEvent.DISPOSE);\n\n // Free ref after all lifecycle hooks have completed.\n queueMicrotask(() => {\n if (this.ref) {\n this.ref(EMPTY_REF);\n }\n });\n }\n\n override move(parent: Element, after?: Node) {\n if (\"moveBefore\" in parent) {\n try {\n (parent as any).moveBefore(this.root!, after?.nextSibling ?? null);\n } catch {\n this.mount(parent, after);\n }\n } else {\n this.mount(parent, after);\n }\n }\n\n private attachProp<T>(value: MaybeSignal<T>, callback: (value: T) => void, key?: string) {\n if (isFunction(value)) {\n this.unsubscribers.push(\n effect(() => {\n try {\n callback((value as Signal<T>)());\n } catch (error) {\n this.context.error(error);\n this.context.crash(error as Error);\n }\n }),\n );\n } else {\n callback(value);\n }\n }\n\n private getKey(name: string) {\n return this.id + \":\" + name;\n }\n\n private applyProps(element: HTMLElement | SVGElement, props: Record<string, unknown>) {\n for (const key in omit(ignoredProps, props)) {\n const value = props[key];\n\n if (key === \"on:clickoutside\" || key === \"onClickOutside\" || key === \"onclickoutside\") {\n // Synthetic onclickoutside event.\n\n const listener = (e: Event) => {\n if (this.canClickAway && !element.contains(e.target as any)) {\n (value as (e: Event) => void)(e);\n }\n };\n\n // Capture is set to avoid intermediate elements cancelling this event before it gets to the window.\n const options = { capture: true };\n\n window.addEventListener(\"click\", listener, options);\n this.unsubscribers.push(() => {\n window.removeEventListener(\"click\", listener, options);\n });\n } else if (key.startsWith(\"prop:\")) {\n // Keys starting with `prop:` are set as props.\n\n const _key = key.substring(5);\n this.attachProp(\n value,\n (current) => {\n (element as any)[_key] = current;\n },\n this.getKey(_key),\n );\n } else if (key.startsWith(\"on:\")) {\n // Keys starting with `on:` are treated as event listeners.\n\n const _key = key.substring(3);\n let _prev: EventListener | undefined;\n if (isFunction(value)) {\n element.addEventListener(_key, value as EventListener);\n this.unsubscribers.push(() => {\n element.removeEventListener(_key, value as EventListener);\n });\n } else {\n this.attachProp(\n value as MaybeSignal<EventListener>,\n (current) => {\n if (!current && _prev) {\n element.removeEventListener(_key, _prev);\n } else if (current != null) {\n if (_prev && _prev !== current) {\n element.removeEventListener(_key, _prev);\n }\n element.addEventListener(_key, current);\n }\n _prev = current;\n },\n this.getKey(_key),\n );\n }\n } else if (key.startsWith(\"attr:\")) {\n // Keys starting with `attr:` are set as attributes.\n\n const _key = key.substring(5).toLowerCase();\n this.attachProp(\n value,\n (current) => {\n if (current != null) {\n element.setAttribute(_key, String(current));\n } else {\n element.removeAttribute(_key);\n }\n },\n this.getKey(_key),\n );\n } else if (isFunction(value) && isCamelCaseEventName(key)) {\n // camelCase event names are applied with addEventListener.\n\n const eventName = key.slice(2).toLowerCase();\n\n const listener: (e: Event) => void = value as (e: Event) => void;\n\n element.addEventListener(eventName, listener);\n this.unsubscribers.push(() => {\n element.removeEventListener(eventName, listener);\n });\n } else if (key.startsWith(\"on\") && isFunction(value) && knownEventNames.includes(key.substring(2))) {\n // Event handler properties (element.onsomething = function () {})\n\n (element as any)[key] = value;\n this.unsubscribers.push(() => {\n (element as any)[key] = undefined;\n });\n } else if (key.includes(\"-\")) {\n // Names with dashes in them are not valid prop names, so they are treated as attributes.\n\n this.attachProp(\n value,\n (current) => {\n if (current == null) {\n element.removeAttribute(key);\n } else {\n element.setAttribute(key, String(current));\n }\n },\n this.getKey(key),\n );\n } else if (this.context.getState(IS_SVG, { fallback: false })) {\n // SVG gets everything set as an attribute.\n\n // TODO: This isn't exactly right. SVGElement supports props as well.\n this.attachProp(\n value,\n (current) => {\n if (current != null) {\n element.setAttribute(key, String(props[key]));\n } else {\n element.removeAttribute(key);\n }\n },\n this.getKey(key),\n );\n } else {\n // Special handling for other props on a case by case basis.\n\n switch (key) {\n case \"contentEditable\":\n case \"value\":\n this.attachProp(\n value,\n (current) => {\n (element as any)[key] = String(current);\n },\n this.getKey(key),\n );\n break;\n\n case \"for\":\n this.attachProp(\n value,\n (current) => {\n (element as any).htmlFor = current;\n },\n this.getKey(key),\n );\n break;\n\n case \"innerHTML\":\n this.attachProp(\n value,\n (current) => {\n (element as any).innerHTML = current;\n },\n this.getKey(key),\n );\n break;\n\n case \"title\":\n this.attachProp(\n value,\n (current) => {\n if (current == null) {\n (element as any).removeAttribute(key);\n } else {\n (element as any).setAttribute(key, String(current));\n }\n },\n this.getKey(key),\n );\n\n case \"checked\":\n this.attachProp(\n value,\n (current) => {\n (element as any).checked = current;\n\n // Set attribute also or styles don't take effect.\n if (current) {\n element.setAttribute(\"checked\", \"\");\n } else {\n element.removeAttribute(\"checked\");\n }\n },\n this.getKey(key),\n );\n break;\n\n case \"dataset\":\n let applied: Record<string, string> = {};\n this.attachProp(\n value,\n (_next) => {\n if (isObject(_next)) {\n // Convert keys to camelCase and make sure values are strings.\n const next: Record<string, string> = {};\n for (const _key in _next) {\n next[toCamelCase(_key)] = String(_next[_key]);\n }\n\n for (const key in applied) {\n // Key removed.\n if (!Object.hasOwn(next, key)) {\n delete element.dataset[key];\n delete applied[key];\n }\n }\n\n for (const key in next) {\n // Value changed (or not set).\n if (applied[key] !== next[key]) {\n element.dataset[key] = next[key];\n applied[key] = next[key];\n }\n }\n } else {\n for (const key in applied) {\n delete element.dataset[key];\n }\n }\n },\n this.getKey(key),\n );\n break;\n\n case \"autocomplete\":\n case \"autocapitalize\":\n this.attachProp(\n value,\n (current) => {\n if (typeof current === \"string\") {\n (element as any)[key] = current;\n } else if (current) {\n (element as any)[key] = \"on\";\n } else {\n (element as any)[key] = \"off\";\n }\n },\n this.getKey(key),\n );\n break;\n\n default: {\n // Fall back to setting as a property.\n this.attachProp(\n value,\n (current) => {\n (element as any)[key] = current;\n },\n this.getKey(key),\n );\n break;\n }\n }\n }\n }\n }\n\n private applyStyles(element: HTMLElement | SVGElement, styles: unknown, unsubscribers: UnsubscribeFn[]) {\n const propUnsubscribers: UnsubscribeFn[] = [];\n\n if (isFunction(styles)) {\n let unapply: () => void;\n\n const unsubscribe = effect(() => {\n if (isFunction(unapply)) {\n unapply();\n }\n element.style.cssText = \"\";\n\n unapply = this.applyStyles(element, get(styles), unsubscribers);\n });\n\n unsubscribers.push(unsubscribe);\n propUnsubscribers.push(unsubscribe);\n } else {\n const mapped = getStyleMap(styles);\n\n for (const name in mapped) {\n const { value, priority } = mapped[name];\n\n if (isFunction(value)) {\n const unsubscribe = effect(() => {\n if (get(value)) {\n element.style.setProperty(name, String(asPixelsIfNumber(get(value))), priority);\n } else {\n element.style.removeProperty(name);\n }\n });\n\n unsubscribers.push(unsubscribe);\n propUnsubscribers.push(unsubscribe);\n } else if (value != undefined) {\n element.style.setProperty(name, String(asPixelsIfNumber(value)));\n }\n }\n }\n\n return function unapply() {\n for (const unsubscribe of propUnsubscribers) {\n unsubscribe();\n unsubscribers.splice(unsubscribers.indexOf(unsubscribe), 1);\n }\n };\n }\n\n private applyClasses(element: HTMLElement | SVGElement, classes: unknown, unsubscribers: UnsubscribeFn[]) {\n const classUnsubscribers: UnsubscribeFn[] = [];\n\n if (isFunction(classes)) {\n let unapply: () => void;\n\n const unsubscribe = effect(() => {\n if (isFunction(unapply)) {\n unapply();\n }\n element.removeAttribute(\"class\");\n unapply = this.applyClasses(element, get(classes), unsubscribers);\n });\n\n unsubscribers.push(unsubscribe);\n classUnsubscribers.push(unsubscribe);\n } else {\n const mapped = getClassMap(classes);\n\n for (const name in mapped) {\n const value = mapped[name];\n\n if (isFunction(value)) {\n const unsubscribe = effect(() => {\n if (get(value)) {\n element.classList.add(name);\n } else {\n element.classList.remove(name);\n }\n });\n\n unsubscribers.push(unsubscribe);\n classUnsubscribers.push(unsubscribe);\n } else if (value) {\n element.classList.add(name);\n }\n }\n }\n\n return function unapply() {\n for (const unsubscribe of classUnsubscribers) {\n unsubscribe();\n unsubscribers.splice(unsubscribers.indexOf(unsubscribe), 1);\n }\n };\n }\n}\n\n/**\n * Parse classes into a single object. Classes can be passed as a string, an object with class keys can boolean values, or an array with a mix of both.\n */\nfunction getClassMap(classes: unknown) {\n let mapped: Record<string, boolean> = {};\n\n if (isString(classes)) {\n // Support multiple classes in one string like HTML.\n const names = classes.split(\" \");\n for (const name of names) {\n mapped[name] = true;\n }\n } else if (isObject(classes)) {\n Object.assign(mapped, classes);\n } else if (Array.isArray(classes)) {\n Array.from(classes)\n .filter(Boolean)\n .forEach((item) => {\n Object.assign(mapped, getClassMap(item));\n });\n }\n\n // Delete undefined keys. These are usually the result of a class that is not specified in the stylesheet and would have no effect on appearance.\n delete mapped[\"undefined\"];\n\n return mapped;\n}\n\n/**\n * Parse styles into a single object.\n */\nfunction getStyleMap(styles: unknown) {\n let mapped: Record<string, { value: unknown; priority?: string }> = {};\n\n if (isString(styles)) {\n const lines = styles.split(\";\").filter((line) => line.trim() !== \"\");\n for (const line of lines) {\n const [key, _value] = line.split(\":\");\n const entry: { value: unknown; priority?: string } = {\n value: _value,\n };\n if (_value.includes(\"!important\")) {\n entry.priority = \"important\";\n entry.value = _value.replace(\"!important\", \"\").trim();\n } else {\n entry.value = _value.trim();\n }\n mapped[camelToKebab(key.trim())] = entry;\n }\n }\n if (isObject(styles)) {\n for (const key in styles) {\n if (key.startsWith(\"--\")) {\n // Pass through variable names without processing.\n mapped[key] = { value: styles[key] };\n } else {\n mapped[camelToKebab(key)] = { value: styles[key] };\n }\n }\n } else if (Array.isArray(styles)) {\n Array.from(styles)\n .filter((item) => item != null)\n .forEach((item) => {\n Object.assign(mapped, getStyleMap(item));\n });\n }\n\n return mapped;\n}\n\nfunction getLoggerName(this: ElementNode) {\n const root = this.getRoot();\n if (root == null) return this.tag;\n let name = this.getRoot().tagName.toLowerCase();\n if (root.id) {\n name += `#${root.id}`;\n }\n if (root.classList.length > 0) {\n for (const className of root.classList.values()) {\n name += `.${className}`;\n }\n }\n return name;\n}\n\n/**\n * Converts a camelCase string to kebab-case.\n */\nfunction camelToKebab(value: string): string {\n return value.replace(/[A-Z]+(?![a-z])|[A-Z]/g, ($, ofs) => (ofs ? \"-\" : \"\") + $.toLowerCase());\n}\n\nfunction asPixelsIfNumber(value: any): string {\n if (isNumber(value)) {\n return `${value}px`;\n } else {\n return value;\n }\n}\n\n// A list of all known event names. These will be handled as event listeners.\nconst knownEventNames = [\n // Element\n \"animationcancel\",\n \"animationend\",\n \"animationiteration\",\n \"animationstart\",\n \"auxclick\",\n \"beforeinput\",\n \"beforematch\",\n \"beforexrselect\",\n \"blur\",\n \"click\",\n \"compositionend\",\n \"compositionstart\",\n \"compositionupdate\",\n \"contentvisibilityautostatechange\",\n \"contextmenu\",\n \"copy\",\n \"cut\",\n \"dblclick\",\n \"focus\",\n \"focusin\",\n \"focusout\",\n \"fullscreenchange\",\n \"fullscreenerror\",\n \"gotpointercapture\",\n \"input\",\n \"keydown\",\n \"keyup\",\n \"lostpointercapture\",\n \"mousedown\",\n \"mouseenter\",\n \"mouseleave\",\n \"mousemove\",\n \"mouseout\",\n \"mouseover\",\n \"mouseup\",\n \"paste\",\n \"pointercancel\",\n \"pointerdown\",\n \"pointerenter\",\n \"pointerleave\",\n \"pointermove\",\n \"pointerout\",\n \"pointerover\",\n \"pointerrawupdate\",\n \"pointerup\",\n \"scroll\",\n \"scrollend\",\n \"scrollsnapchange\",\n \"scrollsnapchanging\",\n \"securitypolicyviolation\",\n \"touchcancel\",\n \"touchend\",\n \"touchmove\",\n \"touchstart\",\n \"transitioncancel\",\n \"transitionend\",\n \"transitionrun\",\n \"transitionstart\",\n \"webkitmouseforcechanged\",\n \"webkitmouseforcedown\",\n \"webkitmouseforceup\",\n \"webkimouseforcewillbegin\",\n \"wheel\",\n\n // HTMLElement\n \"beforetoggle\",\n \"change\",\n \"command\",\n \"drag\",\n \"dragend\",\n \"dragenter\",\n \"dragleave\",\n \"dragover\",\n \"dragstart\",\n \"drop\",\n \"error\",\n \"load\",\n \"toggle\",\n\n // HTMLInputElement\n \"cancel\",\n \"invalid\",\n \"search\",\n \"select\",\n \"selectionchange\",\n\n // HTMLFormElement\n \"formdata\",\n \"reset\",\n \"submit\",\n];\n","import type { Renderable } from \"../../types.js\";\nimport { Context } from \"../context.js\";\nimport { render } from \"../markup.js\";\nimport { MarkupNode } from \"./_markup.js\";\n\n/**\n * Renders content into a specified parent node.\n */\nexport class PortalNode extends MarkupNode {\n private context;\n private value;\n private parent;\n\n private node?: MarkupNode;\n\n constructor(context: Context, value: Renderable, parent: Element) {\n super();\n this.context = context;\n this.value = value;\n this.parent = parent;\n }\n\n override getRoot() {\n return this.node?.getRoot();\n }\n\n override isMounted() {\n if (!this.node) {\n return false;\n }\n return this.node.isMounted();\n }\n\n override mount(_parent: Element, _after?: Node) {\n const node = render(this.value, this.context);\n this.node = node;\n node.mount(this.parent);\n }\n\n override unmount(skipDOM = false) {\n if (this.node?.isMounted()) {\n // Portals must unmount DOM nodes because they won't be removed by parents unmounting.\n this.node.unmount(false);\n }\n }\n\n override move(_parent: Element, _after?: Node) {\n // Moving does not apply to portals.\n }\n}\n","import type { Renderable } from \"../../types.js\";\nimport { deepEqual } from \"../../utils.js\";\nimport type { Context } from \"../context.js\";\nimport { batch, effect, untracked, writable, type Signal, type UnsubscribeFn, type Writable } from \"../signals.js\";\nimport { MarkupNode } from \"./_markup.js\";\nimport { ViewNode } from \"./view.js\";\n\n// ----- Types ----- //\n\nexport type Key = any;\n\nexport type KeyFn<T> = (item: T, index: number) => Key;\nexport type RenderFn<T> = (item: Signal<T>, index: Signal<number>, ctx: Context) => Renderable;\n\ntype ConnectedItem<T> = {\n key: Key;\n item: Writable<T>;\n index: Writable<number>;\n node: MarkupNode;\n};\n\n// ----- Code ----- //\n\n/**\n * Renders a list of items.\n */\nexport class RepeatNode<T> extends MarkupNode {\n private root = document.createTextNode(\"\");\n\n private context;\n\n private items: Signal<T[]>;\n private key: KeyFn<T>;\n private render: RenderFn<T>;\n\n private unsubscribe: UnsubscribeFn | null = null;\n private connectedItems: Map<Key, ConnectedItem<T>> = new Map();\n\n constructor(context: Context, items: Signal<T[]>, key: KeyFn<T>, render: RenderFn<T>) {\n super();\n this.context = context;\n\n this.items = items;\n this.key = key;\n this.render = render;\n }\n\n override getRoot() {\n return this.root;\n }\n\n override isMounted() {\n return this.root.parentElement != null;\n }\n\n override mount(parent: Element, after?: Node) {\n if (!this.isMounted()) {\n parent.insertBefore(this.root, after?.nextSibling ?? null);\n\n this.unsubscribe = effect(() => {\n let value = this.items();\n\n if (value == null) {\n value = [];\n this.context.warn(\"repeat() received empty value for items\", value);\n }\n\n untracked(() => {\n this._update(Array.from(value));\n });\n });\n }\n }\n\n override unmount(skipDOM = false) {\n if (this.unsubscribe) {\n this.unsubscribe();\n this.unsubscribe = null;\n }\n\n if (!skipDOM && this.isMounted()) {\n this.root.parentNode?.removeChild(this.root);\n }\n\n this._cleanup(true);\n }\n\n override move(parent: Element, after?: Node) {\n // TODO: Implement move\n return this.mount(parent, after);\n }\n\n private _cleanup(skipDOM: boolean) {\n for (const item of this.connectedItems.values()) {\n item.node.unmount(skipDOM);\n }\n this.connectedItems.clear();\n }\n\n private _update(value: T[]) {\n if (value.length === 0 || !this.isMounted()) {\n return this._cleanup(false);\n }\n\n type UpdateItem = { key: Key; value: T; index: number };\n\n const potentialItems = new Map<Key, UpdateItem>();\n let index = 0;\n\n for (const item of value) {\n const key = this.key(item, index);\n potentialItems.set(key, {\n key,\n value: item,\n index: index++,\n });\n }\n\n const newItems: ConnectedItem<T>[] = [];\n\n // Remove views for items that no longer exist in the new list.\n for (const connected of this.connectedItems.values()) {\n if (!potentialItems.has(connected.key) && connected.node.isMounted()) {\n connected.node.unmount(false);\n }\n }\n\n batch(() => {\n // Add new views and update state for existing ones.\n for (const potential of potentialItems.values()) {\n const connected = this.connectedItems.get(potential.key);\n\n if (connected && connected.node.isMounted()) {\n connected.item.set(potential.value);\n connected.index.set(potential.index);\n\n newItems[potential.index] = connected;\n } else {\n // deepEqual avoids running update code again if the data is equivalent. In list updates this happens a lot.\n const item = writable(potential.value, { equals: deepEqual });\n const index = writable(potential.index);\n\n newItems[potential.index] = {\n key: potential.key,\n item,\n index,\n node: new ViewNode(this.context, RepeatItemView, {\n item: () => item(),\n index: () => index(),\n render: this.render,\n }),\n };\n }\n }\n });\n\n // Reconnect to ensure order. Lifecycle hooks won't be run again if the view is already connected.\n // TODO: Use a smarter inline reordering method. This causes scrollbars to jump.\n for (let i = 0; i < newItems.length; i++) {\n const item = newItems[i];\n const previous = newItems[i - 1]?.node.getRoot() ?? this.root;\n\n const connected = this.connectedItems.get(item.key);\n if (connected && connected.node.isMounted()) {\n item.node.move(this.root.parentElement!, previous);\n } else {\n item.node.mount(this.root.parentElement!, previous);\n }\n }\n\n this.connectedItems.clear();\n for (const item of newItems) {\n this.connectedItems.set(item.key, item);\n }\n\n // Move marker node to end.\n const lastItem = newItems.at(-1)?.node.getRoot() ?? this.root;\n this.root.parentNode?.insertBefore(this.root, lastItem.nextSibling);\n }\n}\n\ninterface ListItemProps {\n item: Signal<any>;\n index: Signal<number>;\n render: (item: Signal<any>, index: Signal<number>, context: Context) => Renderable;\n}\nconst contextName = \"dolla.RepeatItemView\";\nfunction RepeatItemView(props: ListItemProps, context: Context) {\n context.setName(contextName);\n return props.render.call(context, props.item, props.index, context);\n}\n","import { isFunction, isString } from \"../typeChecking.js\";\nimport type { IntrinsicElements, Renderable, View } from \"../types.js\";\nimport { Context } from \"./context.js\";\nimport { MarkupNode } from \"./nodes/_markup.js\";\nimport { DOMNode } from \"./nodes/dom.js\";\nimport { DynamicNode } from \"./nodes/dynamic.js\";\nimport { ElementNode } from \"./nodes/element.js\";\nimport { PortalNode } from \"./nodes/portal.js\";\nimport { KeyFn, RenderFn, RepeatNode } from \"./nodes/repeat.js\";\nimport { ViewNode } from \"./nodes/view.js\";\nimport { get, type MaybeSignal, memo, type Signal } from \"./signals.js\";\n\nexport { MarkupNode };\n\n/*===========================*\\\n|| Markup ||\n\\*===========================*/\n\ntype PropsOf<V extends string | View<any>> = V extends View<infer U> ? U : any;\n\n/**\n * `Markup` is a set of metadata that will be constructed into a `MarkupNode`.\n */\nexport class Markup<Type extends string | View<any> = string | View<any>> {\n /**\n * In the case of a view, type will be the View function itself. It can also hold an identifier for special nodes like \"$cond\", \"$repeat\", etc.\n * DOM nodes can be created by name, such as HTML elements like \"div\", \"ul\" or \"span\", SVG elements like \"\"\n */\n type;\n\n /**\n * Data that will be passed to a new MarkupNode instance when it is constructed.\n * Includes a `children` prop if children were passed.\n */\n props;\n\n constructor(type: Type, props: PropsOf<Type>) {\n this.type = type;\n this.props = props;\n }\n}\n\nexport enum MarkupType {\n DOM = \"$dom\",\n Dynamic = \"$dynamic\",\n Portal = \"$portal\",\n Repeat = \"$repeat\",\n}\n\nexport interface MarkupNodeProps {\n [MarkupType.DOM]: {\n value: Node;\n };\n [MarkupType.Dynamic]: {\n source: Signal<any>;\n };\n [MarkupType.Portal]: {\n content: Renderable;\n parent: Element;\n };\n [MarkupType.Repeat]: {\n items: Signal<any[]>;\n key: KeyFn<any>;\n render: RenderFn<any>;\n };\n}\n\nexport interface MarkupCustomElementProps {\n /**\n * Custom element tagName pattern (must include a hyphen).\n */\n [tag: `${string}-${string}`]: Record<string, any>;\n}\n\n/**\n * Creates a `Markup` element that defines an HTML element.\n */\nexport function createMarkup<T extends keyof IntrinsicElements>(\n tag: T,\n attrs: IntrinsicElements[T] & { children?: Renderable },\n): Markup;\n\n/**\n * Creates a `Markup` element that defines an HTML custom element.\n */\nexport function createMarkup<T extends keyof MarkupCustomElementProps>(\n type: T,\n props: MarkupCustomElementProps[T],\n): Markup;\n\n/**\n * Creates a `Markup` element that defines a `MarkupNode`.\n */\nexport function createMarkup<T extends keyof MarkupNodeProps>(type: T, props: MarkupNodeProps[T]): Markup;\n\n/**\n * Creates a `Markup` element that defines a view.\n */\nexport function createMarkup<P extends {}>(type: View<P>, props?: P): Markup;\n\n/**\n * Creates a `Markup` element that defines a view.\n */\nexport function createMarkup<P>(type: View<P>, props: P): Markup;\n\nexport function createMarkup(type: string | View<any>, props?: any) {\n return new Markup(type, props ?? {});\n}\n\n/*===========================*\\\n|| Render ||\n\\*===========================*/\n\n/**\n * Takes any `Renderable` value and returns a `MarkupNode` that will display it.\n */\nexport function render(content: Renderable, context = new Context(\"$\")): MarkupNode {\n const nodes = toMarkupNodes(context, content);\n if (nodes.length === 1) {\n return nodes[0];\n }\n return new DynamicNode(context, () => nodes);\n}\n\n/**\n * Convert basically anything into a set of `MarkupNode`s.\n */\nexport function toMarkupNodes(context: Context, ...content: any[]): MarkupNode[] {\n const items = content.flat(Infinity);\n const nodes: MarkupNode[] = [];\n\n for (const item of items) {\n if (item === null || item === undefined || item === false) {\n continue;\n }\n\n if (item instanceof Node) {\n nodes.push(new DOMNode(item));\n continue;\n }\n\n if (item instanceof Markup) {\n if (isFunction(item.type)) {\n nodes.push(new ViewNode(context, item.type as View<any>, item.props));\n continue;\n } else if (isString(item.type)) {\n switch (item.type) {\n case MarkupType.DOM: {\n const attrs = item.props! as MarkupNodeProps[MarkupType.DOM];\n nodes.push(new DOMNode(attrs.value));\n continue;\n }\n case MarkupType.Dynamic: {\n const attrs = item.props! as MarkupNodeProps[MarkupType.Dynamic];\n nodes.push(new DynamicNode(context, attrs.source));\n continue;\n }\n case MarkupType.Portal: {\n const attrs = item.props! as MarkupNodeProps[MarkupType.Portal];\n nodes.push(new PortalNode(context, attrs.content, attrs.parent));\n continue;\n }\n case MarkupType.Repeat: {\n const attrs = item.props! as MarkupNodeProps[MarkupType.Repeat];\n nodes.push(new RepeatNode(context, attrs.items, attrs.key, attrs.render));\n continue;\n }\n default:\n // Assume `type` is an HTML/SVG tag.\n nodes.push(new ElementNode(context, item.type, item.props));\n continue;\n }\n } else {\n throw new TypeError(`Expected a string or view function. Got: ${item.type}`);\n }\n }\n\n if (item instanceof MarkupNode) {\n nodes.push(item);\n continue;\n }\n\n if (isFunction(item)) {\n nodes.push(new DynamicNode(context, item));\n continue;\n }\n\n // fallback to displaying value as text\n nodes.push(new DOMNode(document.createTextNode(String(item))));\n }\n\n return nodes;\n}\n"],"names":["LifecycleEvent","NAME","LIFECYCLE","PARENT","STORES","STATE","ContextLifecycle","context","__publicField","event","listener","listeners","_e","_d","_c","_b","_a","_Context","name","options","__privateAdd","_name","__privateSet","untracked","logger","createLogger","get","__privateGet","descriptors","key","state","parent","store","getUniqueId","prevCtx","setCurrentContext","result","error","isFunction","callback","fn","unsubscribe","effect","disposed","immediate","value","entries","args","typeOf","Context","createContext","MarkupNode","after","skipDOM","DOMNode","node","DynamicNode","$slot","content","toArray","moveBefore","i","element","nodes","toMarkupNodes","previous","lastChildNextSibling","EMPTY_REF","ref","_ref","VIEW","ViewNode","view","props","wasMounted","render","isCamelCaseEventName","IS_SVG","ignoredProps","ElementNode","tag","getIntegerId","getLoggerName","getEnv","mixin","classes","child","omit","e","_key","current","_prev","eventName","knownEventNames","applied","_next","isObject","next","toCamelCase","styles","unsubscribers","propUnsubscribers","unapply","mapped","getStyleMap","priority","asPixelsIfNumber","classUnsubscribers","getClassMap","isString","names","item","lines","line","_value","entry","camelToKebab","root","className","$","ofs","isNumber","PortalNode","_parent","_after","RepeatNode","items","potentialItems","index","newItems","connected","batch","potential","writable","deepEqual","RepeatItemView","lastItem","contextName","Markup","type","MarkupType","createMarkup","attrs"],"mappings":";;;;;;;;;AAcY,IAAAA,sBAAAA,OACVA,EAAA,aAAa,aACbA,EAAA,YAAY,YACZA,EAAA,eAAe,eACfA,EAAA,cAA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IgB,GAAYxE,GAASwG,EAAK,MAAMA,EAAK,KAAK,CAAC;AAC1D;AAAA,UAAA;AAAA;AAGJ,gBAAM,IAAI,UAAU,4CAA4CA,EAAK,IAAI,EAAE;AAI/E,UAAIA,aAAgB5D,GAAY;AAC9B,QAAAY,EAAM,KAAKgD,CAAI;AACf;AAAA,MAAA;AAGE,UAAAzE,EAAWyE,CAAI,GAAG;AACpB,QAAAhD,EAAM,KAAK,IAAIP,EAAYjD,GAASwG,CAAI,CAAC;AACzC;AAAA,MAAA;AAII,MAAAhD,EAAA,KAAK,IAAIT,EAAQ,SAAS,eAAe,OAAOyD,CAAI,CAAC,CAAC,CAAC;AAAA;AAGxD,SAAAhD;AACT;"}
|
package/dist/router.js
CHANGED
package/docs/hooks.md
CHANGED
|
@@ -3,12 +3,11 @@
|
|
|
3
3
|
Dolla implements a React-style hooks API for use in Views, Stores and Mixins. Internally these hooks are still using signals, and view functions still only run once, but this API may be more fun and enjoyable for those familiar with React.
|
|
4
4
|
|
|
5
5
|
```js
|
|
6
|
-
import {
|
|
6
|
+
import { useSignal, useEffect, useLogger } from "@manyducks.co/dolla";
|
|
7
7
|
|
|
8
8
|
export function CounterView() {
|
|
9
|
-
const [$count, setCount] =
|
|
9
|
+
const [$count, setCount] = useSignal(0);
|
|
10
10
|
|
|
11
|
-
const logger = useLogger();
|
|
12
11
|
useEffect(() => {
|
|
13
12
|
// Effect is triggered each time count changes; calling its getter tracks it.
|
|
14
13
|
logger.info(`Count is now ${$count()}`);
|
|
@@ -26,7 +25,7 @@ export function CounterView() {
|
|
|
26
25
|
```
|
|
27
26
|
|
|
28
27
|
```js
|
|
29
|
-
import { useReducer } from "@manyducks.co/dolla
|
|
28
|
+
import { useReducer } from "@manyducks.co/dolla";
|
|
30
29
|
|
|
31
30
|
export function CounterView() {
|
|
32
31
|
const countReducer = (state, action) => {
|
|
@@ -56,12 +55,12 @@ export function CounterView() {
|
|
|
56
55
|
|
|
57
56
|
## All Hooks
|
|
58
57
|
|
|
59
|
-
### `
|
|
58
|
+
### `useSignal`
|
|
60
59
|
|
|
61
|
-
Creates a new
|
|
60
|
+
Creates a new signal and returns a getter and setter pair. Signals are functions that return the current value when called. If they are called within a tracking scope (such as a useMemo or useEffect function) they will _signal_ to that scope that they need to re-run when a new value is set.
|
|
62
61
|
|
|
63
62
|
```js
|
|
64
|
-
const [message, setMessage] =
|
|
63
|
+
const [message, setMessage] = useSignal("Hello World");
|
|
65
64
|
message(); // "Hello World"
|
|
66
65
|
setValue("different value");
|
|
67
66
|
setValue((current) => current.toUpperCase());
|
|
@@ -72,7 +71,7 @@ setValue((current) => current.toUpperCase());
|
|
|
72
71
|
Basic usage.
|
|
73
72
|
|
|
74
73
|
```js
|
|
75
|
-
const [count, setCount] =
|
|
74
|
+
const [count, setCount] = useSignal(5);
|
|
76
75
|
|
|
77
76
|
// Signals called within the body of the `useMemo` callback will be tracked.
|
|
78
77
|
// This means `doubled` will re-run and update its value when and only when its tracked dependencies do.
|
|
@@ -85,8 +84,8 @@ const quadrupled = useMemo(() => doubled() * 2);
|
|
|
85
84
|
#### Explicit Dependencies
|
|
86
85
|
|
|
87
86
|
```js
|
|
88
|
-
const [first, setFirst] =
|
|
89
|
-
const [second, setSecond] =
|
|
87
|
+
const [first, setFirst] = useSignal(10);
|
|
88
|
+
const [second, setSecond] = useSignal(20);
|
|
90
89
|
|
|
91
90
|
// You can alternatively pass an array of dependencies. When you do this your callback will be re-run whenever
|
|
92
91
|
// any of the provided dependencies change, regardless of what dependencies you actually call inside the callback;
|
|
@@ -127,16 +126,16 @@ function ExampleView() {
|
|
|
127
126
|
|
|
128
127
|
### `useContext`
|
|
129
128
|
|
|
130
|
-
|
|
129
|
+
Returns a reference to the `Context` object for the current component, be it a View, Store or Mixin.
|
|
131
130
|
|
|
132
131
|
```js
|
|
133
132
|
// `useContext` returns the currently active Context object for the View, Store or Mixin it's called in.
|
|
134
133
|
function ExampleView() {
|
|
135
|
-
const
|
|
134
|
+
const context = useContext();
|
|
135
|
+
context.log("Hello!");
|
|
136
|
+
context.addStore(ExampleStore);
|
|
136
137
|
|
|
137
|
-
|
|
138
|
-
/// ...
|
|
139
|
-
});
|
|
138
|
+
// ...
|
|
140
139
|
}
|
|
141
140
|
```
|
|
142
141
|
|
|
@@ -145,8 +144,9 @@ function ExampleView() {
|
|
|
145
144
|
Access an instance of a provided Store. Equivalent to `context.getStore(Store)`.
|
|
146
145
|
|
|
147
146
|
```jsx
|
|
147
|
+
// Define a store...
|
|
148
148
|
function CounterStore() {
|
|
149
|
-
const [value, setValue] =
|
|
149
|
+
const [value, setValue] = useSignal(0);
|
|
150
150
|
|
|
151
151
|
const increment = () => setValue((n) => n + 1);
|
|
152
152
|
const decrement = () => setValue((n) => n - 1);
|
|
@@ -166,7 +166,7 @@ function ParentView() {
|
|
|
166
166
|
return <ChildView />;
|
|
167
167
|
}
|
|
168
168
|
|
|
169
|
-
// Then
|
|
169
|
+
// Then access it with the hook.
|
|
170
170
|
function ChildView() {
|
|
171
171
|
const counter = useStore(CounterStore);
|
|
172
172
|
|
package/docs/mixins.md
CHANGED
|
@@ -2,17 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
Mixins are a way to add custom lifecycle handlers to plain DOM nodes without creating an entire view. You can encapsulate reusable logic in mixin functions and apply them like CSS classes.
|
|
4
4
|
|
|
5
|
-
Mixin functions take a reference to the
|
|
5
|
+
Mixin functions take a reference to the DOM node as their first argument.
|
|
6
6
|
|
|
7
7
|
```tsx
|
|
8
|
-
import { type Mixin } from "@manyducks.co/dolla";
|
|
8
|
+
import { type Mixin, useContext, useMount, useUnmount } from "@manyducks.co/dolla";
|
|
9
9
|
|
|
10
|
-
const logMe: Mixin = (element
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
const logMe: Mixin = (element) => {
|
|
11
|
+
const context = useContext();
|
|
12
|
+
|
|
13
|
+
useMount(() => {
|
|
14
|
+
context.log("element mounted");
|
|
13
15
|
});
|
|
14
|
-
|
|
15
|
-
|
|
16
|
+
|
|
17
|
+
useUnmount(() => {
|
|
18
|
+
context.log("element unmounted");
|
|
16
19
|
});
|
|
17
20
|
};
|
|
18
21
|
|
package/docs/ref.md
CHANGED
|
@@ -11,13 +11,13 @@ The main pattern for refs is as a DOM node reference. Markup elements take a `re
|
|
|
11
11
|
Once you have this reference you can manipulate the node outside the usual declarative template workflow.
|
|
12
12
|
|
|
13
13
|
```tsx
|
|
14
|
-
import {
|
|
14
|
+
import { useRef } from "@manyducks.co/dolla";
|
|
15
15
|
|
|
16
16
|
function ExampleView() {
|
|
17
|
-
const element =
|
|
17
|
+
const element = useRef<HTMLElement>();
|
|
18
18
|
|
|
19
19
|
ctx.onMount(() => {
|
|
20
|
-
element
|
|
20
|
+
element.current.innerText = "GOODBYE THERE";
|
|
21
21
|
});
|
|
22
22
|
|
|
23
23
|
return <div ref={element}>HELLO THERE</div>;
|
|
@@ -29,7 +29,7 @@ function ExampleView() {
|
|
|
29
29
|
Another useful pattern is to pass an API object from a child view to the parent, allowing the parent to call methods to control the child view in an imperative way.
|
|
30
30
|
|
|
31
31
|
```tsx
|
|
32
|
-
import {
|
|
32
|
+
import { useRef, useSignal } from "@manyducks.co/dolla";
|
|
33
33
|
|
|
34
34
|
// First we'll define the view to be controlled.
|
|
35
35
|
|
|
@@ -44,20 +44,20 @@ interface CounterViewProps {
|
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
function CounterView({ controls }: CounterViewProps) {
|
|
47
|
-
const $count =
|
|
47
|
+
const [$count, setCount] = useSignal(0);
|
|
48
48
|
|
|
49
49
|
// Passing a `controls` object to the ref whose methods reference internal state.
|
|
50
|
-
controls
|
|
50
|
+
controls.current = {
|
|
51
51
|
increment() {
|
|
52
|
-
|
|
52
|
+
setCount((current) => current + 1);
|
|
53
53
|
},
|
|
54
54
|
decrement() {
|
|
55
|
-
|
|
55
|
+
setCount((current) => current - 1);
|
|
56
56
|
},
|
|
57
57
|
reset() {
|
|
58
|
-
|
|
58
|
+
setCount(0);
|
|
59
59
|
},
|
|
60
|
-
}
|
|
60
|
+
};
|
|
61
61
|
|
|
62
62
|
return <span>Count: {$count}</span>;
|
|
63
63
|
}
|
|
@@ -66,7 +66,7 @@ function CounterView({ controls }: CounterViewProps) {
|
|
|
66
66
|
|
|
67
67
|
function ParentView() {
|
|
68
68
|
// Create a Ref to store the controls object.
|
|
69
|
-
const controls =
|
|
69
|
+
const controls = useRef<CounterViewControls>();
|
|
70
70
|
|
|
71
71
|
return (
|
|
72
72
|
<section>
|
|
@@ -76,9 +76,9 @@ function ParentView() {
|
|
|
76
76
|
<CounterView controls={controls} />
|
|
77
77
|
|
|
78
78
|
{/* Our buttons will call the methods on the controls object causing state changes within CounterView */}
|
|
79
|
-
<button onClick={() => controls.increment()}>+1</button>
|
|
80
|
-
<button onClick={() => controls.decrement()}>-1</button>
|
|
81
|
-
<button onClick={() => controls.reset()}>=0</button>
|
|
79
|
+
<button onClick={() => controls.current.increment()}>+1</button>
|
|
80
|
+
<button onClick={() => controls.current.decrement()}>-1</button>
|
|
81
|
+
<button onClick={() => controls.current.reset()}>=0</button>
|
|
82
82
|
</section>
|
|
83
83
|
);
|
|
84
84
|
}
|
package/docs/router.md
CHANGED
|
@@ -25,7 +25,8 @@ to your code (`router` store, `$params` readable). Below are some examples of pa
|
|
|
25
25
|
Now, here are some route examples in the context of an app:
|
|
26
26
|
|
|
27
27
|
```js
|
|
28
|
-
import
|
|
28
|
+
import { createApp } from "@manyducks.co/dolla";
|
|
29
|
+
import { createRouter } from "@manyducks.co/dolla/router";
|
|
29
30
|
import { ThingIndex, ThingDetails, ThingEdit, ThingDelete } from "./views.js";
|
|
30
31
|
|
|
31
32
|
const router = createRouter({
|
|
@@ -47,8 +48,10 @@ const router = createRouter({
|
|
|
47
48
|
],
|
|
48
49
|
});
|
|
49
50
|
|
|
50
|
-
//
|
|
51
|
-
|
|
51
|
+
// Pass the router in place of a root view.
|
|
52
|
+
const app = createApp(router);
|
|
53
|
+
|
|
54
|
+
app.mount(document.body);
|
|
52
55
|
```
|
|
53
56
|
|
|
54
57
|
When the URL matches a pattern the corresponding view is displayed. If we visit `/people/john`,
|
|
@@ -56,9 +59,9 @@ we will see the `PersonDetails` view and the params will be `{ name: "john" }`.
|
|
|
56
59
|
accessed from anywhere in the app through `Dolla.router`.
|
|
57
60
|
|
|
58
61
|
```js
|
|
59
|
-
|
|
62
|
+
const router = // ... //
|
|
60
63
|
|
|
61
|
-
// Info about the current route is exported as a set of
|
|
64
|
+
// Info about the current route is exported as a set of signals.
|
|
62
65
|
const { $path, $pattern, $params, $query } = router;
|
|
63
66
|
|
|
64
67
|
router.back(); // Step back in the history to the previous route, if any.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@manyducks.co/dolla",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.68",
|
|
4
4
|
"description": "Front-end components, routing and state management.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/core/index.d.ts",
|
|
@@ -34,10 +34,6 @@
|
|
|
34
34
|
"import": "./dist/router.js",
|
|
35
35
|
"types": "./dist/router/index.d.ts"
|
|
36
36
|
},
|
|
37
|
-
"./hooks": {
|
|
38
|
-
"import": "./dist/hooks.js",
|
|
39
|
-
"types": "./dist/hooks/index.d.ts"
|
|
40
|
-
},
|
|
41
37
|
"./http": {
|
|
42
38
|
"import": "./dist/http.js",
|
|
43
39
|
"types": "./dist/http/index.d.ts"
|
package/vite.config.js
CHANGED
|
@@ -9,7 +9,6 @@ export default defineConfig({
|
|
|
9
9
|
lib: {
|
|
10
10
|
entry: {
|
|
11
11
|
index: resolve(__dirname, "src/core/index.ts"),
|
|
12
|
-
hooks: resolve(__dirname, "src/hooks/index.ts"),
|
|
13
12
|
http: resolve(__dirname, "src/http/index.ts"),
|
|
14
13
|
i18n: resolve(__dirname, "src/i18n/index.ts"),
|
|
15
14
|
router: resolve(__dirname, "src/router/index.ts"),
|
package/dist/core/scheduler.d.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
export type Callback = () => void;
|
|
2
|
-
export interface Task {
|
|
3
|
-
id: number;
|
|
4
|
-
fn: ((didTimeout: boolean) => void) | null;
|
|
5
|
-
startTime: number;
|
|
6
|
-
expirationTime: number;
|
|
7
|
-
}
|
|
8
|
-
export declare function requestCallback(fn: () => void, options?: {
|
|
9
|
-
timeout: number;
|
|
10
|
-
}): Task;
|
|
11
|
-
export declare function cancelCallback(task: Task): void;
|
|
12
|
-
/**
|
|
13
|
-
* Centralized scheduling for DOM updates.
|
|
14
|
-
*/
|
|
15
|
-
declare class Scheduler {
|
|
16
|
-
#private;
|
|
17
|
-
scheduleNodeUpdate(nodeId: number, fn: Callback): void;
|
|
18
|
-
cancelNodeUpdates(nodeId: number): void;
|
|
19
|
-
/**
|
|
20
|
-
* Registers a callback to run after all processing has finished in the next tick.
|
|
21
|
-
*/
|
|
22
|
-
nextTick(callback: Callback): void;
|
|
23
|
-
}
|
|
24
|
-
declare const _default: Scheduler;
|
|
25
|
-
export default _default;
|
package/dist/hooks.js
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import { w as s, h as f, m as i, g as a, u as x, i as m } from "./signals-HNnDUJRQ.js";
|
|
2
|
-
import { r as g } from "./ref-BD79iqlg.js";
|
|
3
|
-
function o() {
|
|
4
|
-
const t = m();
|
|
5
|
-
if (!t)
|
|
6
|
-
throw new Error("No context found; hooks can only be called in the body of a View, Store or Mixin.");
|
|
7
|
-
return t;
|
|
8
|
-
}
|
|
9
|
-
function S(t) {
|
|
10
|
-
const e = o();
|
|
11
|
-
return t && e.setName(t), e;
|
|
12
|
-
}
|
|
13
|
-
function w(t, e) {
|
|
14
|
-
o();
|
|
15
|
-
const n = s(t, e);
|
|
16
|
-
return [() => n(), n.set];
|
|
17
|
-
}
|
|
18
|
-
function l(t, e) {
|
|
19
|
-
return o(), f(t, e);
|
|
20
|
-
}
|
|
21
|
-
function b(t, e, n) {
|
|
22
|
-
return o(), i(t, { ...n, deps: e });
|
|
23
|
-
}
|
|
24
|
-
function M(t, e) {
|
|
25
|
-
const n = o();
|
|
26
|
-
e ? n.effect(() => {
|
|
27
|
-
for (const r of e) a(r);
|
|
28
|
-
return x(t);
|
|
29
|
-
}) : n.effect(t);
|
|
30
|
-
}
|
|
31
|
-
function y(t, e) {
|
|
32
|
-
const [n, r] = l(e);
|
|
33
|
-
return [n, (u) => {
|
|
34
|
-
r((c) => t(c, u));
|
|
35
|
-
}];
|
|
36
|
-
}
|
|
37
|
-
function C(t) {
|
|
38
|
-
return o().getStore(t);
|
|
39
|
-
}
|
|
40
|
-
function R(...t) {
|
|
41
|
-
o();
|
|
42
|
-
const e = g(...t);
|
|
43
|
-
return Object.defineProperty(e, "current", { get: e, set: e }), e;
|
|
44
|
-
}
|
|
45
|
-
function U(t) {
|
|
46
|
-
const e = o();
|
|
47
|
-
e.onMount(() => {
|
|
48
|
-
const n = t();
|
|
49
|
-
n && e.onUnmount(n);
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
function k(t) {
|
|
53
|
-
o().onUnmount(t);
|
|
54
|
-
}
|
|
55
|
-
export {
|
|
56
|
-
o as useContext,
|
|
57
|
-
M as useEffect,
|
|
58
|
-
S as useLogger,
|
|
59
|
-
b as useMemo,
|
|
60
|
-
U as useMount,
|
|
61
|
-
y as useReducer,
|
|
62
|
-
R as useRef,
|
|
63
|
-
l as useSignal,
|
|
64
|
-
w as useState,
|
|
65
|
-
C as useStore,
|
|
66
|
-
k as useUnmount
|
|
67
|
-
};
|
|
68
|
-
//# sourceMappingURL=hooks.js.map
|
package/dist/hooks.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.js","sources":["../src/hooks/index.ts"],"sourcesContent":["import { type Context, type Logger, ref, type Ref, type Store } from \"../core\";\nimport {\n type EffectFn,\n get,\n getCurrentContext,\n type MaybeSignal,\n memo,\n type Setter,\n signal,\n type Signal,\n type SignalOptions,\n untracked,\n writable,\n} from \"../core/signals\";\n\n/**\n * Returns the Context object of the View, Store or Mixin this hook is called in.\n */\nexport function useContext(): Context {\n const context = getCurrentContext();\n if (!context) {\n throw new Error(`No context found; hooks can only be called in the body of a View, Store or Mixin.`);\n }\n return context;\n}\n\n/**\n * Returns a logger. If a name is passed it will be used as a prefix for all console messages.\n * Otherwise the default name of the context will be used.\n */\nexport function useLogger(name?: MaybeSignal<string>): Logger {\n const context = useContext();\n if (name) context.setName(name);\n return context;\n}\n\n/**\n * Creates a new read-only Getter and a bound Setter function.\n * @deprecated prefer useSignal\n */\nexport function useState<T>(value: T, options?: SignalOptions<T>): [Signal<T>, Setter<T>];\n\n/**\n * Creates a new read-only Signal and a bound Setter function.\n * @deprecated prefer useSignal\n */\nexport function useState<T>(\n value: undefined,\n options: SignalOptions<T>,\n): [Signal<T | undefined>, Setter<T | undefined>];\n\n/**\n * Creates a new read-only Signal and a bound Setter function.\n * @deprecated prefer useSignal\n */\nexport function useState<T>(): [Signal<T | undefined>, Setter<T | undefined>];\n\nexport function useState<T>(value?: T, options?: SignalOptions<T>): [Signal<T>, Setter<T>] {\n useContext(); // assert that we're in a valid context\n const state = writable(value as T, options);\n return [() => state(), state.set];\n}\n\n/**\n * Creates a new read-only Signal. Returns bound Getter and Setter functions.\n *\n * @example\n * const [$count, setCount] = useSignal(5);\n * $count(); // 5\n * setCount(6);\n * setCount((current) => current + 1);\n * $count(); // 7\n */\nexport function useSignal<T>(value: T, options?: SignalOptions<T>): [Signal<T>, Setter<T>];\n\nexport function useSignal<T>(\n value: undefined,\n options: SignalOptions<T>,\n): [Signal<T | undefined>, Setter<T | undefined>];\n\nexport function useSignal<T>(): [Signal<T | undefined>, Setter<T | undefined>];\n\nexport function useSignal<T>(value?: T, options?: SignalOptions<T>): [Signal<T>, Setter<T>] {\n useContext(); // assert that we're in a valid context\n return signal(value as T, options);\n}\n\nexport function useMemo<T>(\n compute: (current?: T) => MaybeSignal<T>,\n deps?: Signal<any>[],\n options?: SignalOptions<T>,\n): Signal<T> {\n useContext(); // assert that we're in a valid context\n return memo(compute, { ...options, deps });\n}\n\nexport function useEffect(fn: EffectFn, deps?: Signal<any>[]): void {\n const context = useContext();\n if (deps) {\n context.effect(() => {\n for (const dep of deps) get(dep);\n return untracked(fn);\n });\n } else {\n context.effect(fn);\n }\n}\n\n/**\n * Takes the current state and a dispatched action. Returns a new state based on the action.\n * Typically the body of this function will be a large switch statement.\n */\nexport type Reducer<State, Action> = (state: State, action: Action) => State;\n\n/**\n * Dispatches an action to this reducer, causing the state to update.\n */\nexport type Dispatcher<Action> = (action: Action) => void;\n\n/**\n *\n */\nexport function useReducer<State, Action>(\n reducer: Reducer<State, Action>,\n initialState: State,\n): [Signal<State>, Dispatcher<Action>] {\n const [$state, setState] = useSignal(initialState);\n const dispatch = (action: Action) => {\n setState((current) => reducer(current, action));\n };\n return [$state, dispatch];\n}\n\n/**\n * Uses a previously added Store. Takes the Store function itself and returns the nearest instance.\n */\nexport function useStore<T>(store: Store<any, T>): T {\n const context = useContext();\n return context.getStore(store);\n}\n\n/**\n * A hybrid Ref which is both a function ref and a React-style object ref with a `current` property.\n * Both the `current` property and the function syntax access the same value.\n */\nexport interface HybridRef<T> extends Ref<T> {\n current: T;\n}\n\n/**\n * Creates a Ref. Useful for getting references to DOM nodes.\n */\nexport function useRef<T>(initialValue?: T): HybridRef<T>;\n\nexport function useRef<T>(...value: [T]): HybridRef<T> {\n useContext(); // assert that we're in a valid context\n const valueRef = ref(...value);\n Object.defineProperty(valueRef, \"current\", { get: valueRef, set: valueRef });\n return valueRef as HybridRef<T>;\n}\n\n/**\n * Calls `callback` when the context is mounted. If `callback` returns a function, that function is called when the context is unmounted.\n */\nexport function useMount(callback: () => void | (() => void)): void {\n const context = useContext();\n context.onMount(() => {\n const result = callback();\n if (result) context.onUnmount(result);\n });\n}\n\n/**\n * Calls `callback` when the context is unmounted.\n */\nexport function useUnmount(callback: () => void): void {\n const context = useContext();\n context.onUnmount(callback);\n}\n"],"names":["useContext","context","getCurrentContext","useLogger","name","useState","value","options","state","writable","useSignal","signal","useMemo","compute","deps","memo","useEffect","fn","dep","get","untracked","useReducer","reducer","initialState","$state","setState","action","current","useStore","store","useRef","valueRef","ref","useMount","callback","result","useUnmount"],"mappings":";;AAkBO,SAASA,IAAsB;AACpC,QAAMC,IAAUC,EAAkB;AAClC,MAAI,CAACD;AACG,UAAA,IAAI,MAAM,mFAAmF;AAE9F,SAAAA;AACT;AAMO,SAASE,EAAUC,GAAoC;AAC5D,QAAMH,IAAUD,EAAW;AACvB,SAAAI,KAAcH,EAAA,QAAQG,CAAI,GACvBH;AACT;AAuBgB,SAAAI,EAAYC,GAAWC,GAAoD;AAC9E,EAAAP,EAAA;AACL,QAAAQ,IAAQC,EAASH,GAAYC,CAAO;AAC1C,SAAO,CAAC,MAAMC,KAASA,EAAM,GAAG;AAClC;AAqBgB,SAAAE,EAAaJ,GAAWC,GAAoD;AAC/E,SAAAP,EAAA,GACJW,EAAOL,GAAYC,CAAO;AACnC;AAEgB,SAAAK,EACdC,GACAC,GACAP,GACW;AACA,SAAAP,EAAA,GACJe,EAAKF,GAAS,EAAE,GAAGN,GAAS,MAAAO,GAAM;AAC3C;AAEgB,SAAAE,EAAUC,GAAcH,GAA4B;AAClE,QAAMb,IAAUD,EAAW;AAC3B,EAAIc,IACFb,EAAQ,OAAO,MAAM;AACR,eAAAiB,KAAOJ,EAAM,CAAAK,EAAID,CAAG;AAC/B,WAAOE,EAAUH,CAAE;AAAA,EAAA,CACpB,IAEDhB,EAAQ,OAAOgB,CAAE;AAErB;AAgBgB,SAAAI,EACdC,GACAC,GACqC;AACrC,QAAM,CAACC,GAAQC,CAAQ,IAAIf,EAAUa,CAAY;AAI1C,SAAA,CAACC,GAHS,CAACE,MAAmB;AACnC,IAAAD,EAAS,CAACE,MAAYL,EAAQK,GAASD,CAAM,CAAC;AAAA,EAChD,CACwB;AAC1B;AAKO,SAASE,EAAY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