@vielzeug/ore 2.1.1 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/define.cjs CHANGED
@@ -1,2 +1,2 @@
1
- const e=require("./errors.cjs"),t=require("./props.cjs"),n=require("./_component-class.cjs");function r(t,r){if(!t)throw new e.OreApiError(e.ORE_ERRORS.defineRequiresTag);if(customElements.get(t))throw new e.OreApiError(e.ORE_ERRORS.defineDuplicate(t));let i=n.createComponentClass(t,r);Object.defineProperty(i,"name",{value:t}),customElements.define(t,i)}exports.define=r,exports.prop=t.prop;
1
+ const e=require("./errors.cjs"),t=require("./_component-class.cjs");function n(n,r){if(!n)throw new e.OreApiError(e.ORE_ERRORS.defineRequiresTag);if(customElements.get(n))throw new e.OreApiError(e.ORE_ERRORS.defineDuplicate(n));let i=t.createComponentClass(n,r);Object.defineProperty(i,"name",{value:n}),customElements.define(n,i)}exports.define=n;
2
2
  //# sourceMappingURL=define.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"define.cjs","names":[],"sources":["../src/define.ts"],"sourcesContent":["import { createComponentClass } from './_component-class';\nimport type { ComponentDefinition } from './component-types';\nimport { ORE_ERRORS, OreApiError } from './errors';\nimport { type PropDef, prop } from './props';\n\nexport type { HostBindFn } from './host-bind';\nexport type { PropDef };\nexport { prop };\n\n/**\n * Define and register a web component.\n *\n * The `setup` function runs for each connection and returns an `HTMLResult`.\n * Disconnecting disposes its state; reconnecting rebuilds it. All reactive\n * behaviour within a connection is expressed through directives inside the\n * template — not by re-evaluating setup itself.\n *\n * Everything besides `props` — lifecycle hooks, host bindings, context, slots,\n * emit — is a free function imported from `@vielzeug/ore` and called directly\n * from inside `setup()` (or from a composable it calls):\n *\n * ```ts\n * import { define, html, prop, onMounted, useEmit, useSlots } from '@vielzeug/ore';\n *\n * define<{ count?: number }>('my-counter', {\n * props: { count: prop.number(0) },\n * setup(props) {\n * const emit = useEmit<{ increment: number }>();\n * const slots = useSlots<'header' | 'footer'>();\n *\n * onMounted(() => console.log('mounted'));\n *\n * return html`<button @click=${() => emit('increment', props.count.value + 1)}>${props.count}</button>`;\n * },\n * });\n * ```\n */\nexport function define<Props extends Record<string, unknown> = Record<never, never>>(\n tag: string,\n definition: ComponentDefinition<Props>,\n): void {\n if (!tag) throw new OreApiError(ORE_ERRORS.defineRequiresTag);\n\n if (customElements.get(tag)) throw new OreApiError(ORE_ERRORS.defineDuplicate(tag));\n\n const ComponentClass = createComponentClass(tag, definition);\n\n // Registration is intentionally the sole global side effect of define().\n Object.defineProperty(ComponentClass, 'name', { value: tag });\n customElements.define(tag, ComponentClass);\n}\n"],"mappings":"6FAqCA,SAAgB,EACd,EACA,EACM,CACN,GAAI,CAAC,EAAK,MAAM,IAAI,EAAA,YAAY,EAAA,WAAW,iBAAiB,EAE5D,GAAI,eAAe,IAAI,CAAG,EAAG,MAAM,IAAI,EAAA,YAAY,EAAA,WAAW,gBAAgB,CAAG,CAAC,EAElF,IAAM,EAAiB,EAAA,qBAAqB,EAAK,CAAU,EAG3D,OAAO,eAAe,EAAgB,OAAQ,CAAE,MAAO,CAAI,CAAC,EAC5D,eAAe,OAAO,EAAK,CAAc,CAC3C"}
1
+ {"version":3,"file":"define.cjs","names":[],"sources":["../src/define.ts"],"sourcesContent":["import { createComponentClass } from './_component-class';\nimport type { ComponentDefinition } from './component-types';\nimport { ORE_ERRORS, OreApiError } from './errors';\n\n/**\n * Define and register a web component.\n *\n * The `setup` function runs for each connection and returns an `HTMLResult`.\n * Disconnecting disposes its state; reconnecting rebuilds it. All reactive\n * behaviour within a connection is expressed through directives inside the\n * template — not by re-evaluating setup itself.\n *\n * Everything besides `props` — lifecycle hooks, host bindings, context, slots,\n * emit — is a free function imported from `@vielzeug/ore` and called directly\n * from inside `setup()` (or from a composable it calls):\n *\n * ```ts\n * import { define, html, prop, onMounted, useEmit, useSlots } from '@vielzeug/ore';\n *\n * define<{ count?: number }>('my-counter', {\n * props: { count: prop.number(0) },\n * setup(props) {\n * const emit = useEmit<{ increment: number }>();\n * const slots = useSlots<'header' | 'footer'>();\n *\n * onMounted(() => console.log('mounted'));\n *\n * return html`<button @click=${() => emit('increment', props.count.value + 1)}>${props.count}</button>`;\n * },\n * });\n * ```\n */\nexport function define<Props extends Record<string, unknown> = Record<never, never>>(\n tag: string,\n definition: ComponentDefinition<Props>,\n): void {\n if (!tag) throw new OreApiError(ORE_ERRORS.defineRequiresTag);\n\n if (customElements.get(tag)) throw new OreApiError(ORE_ERRORS.defineDuplicate(tag));\n\n const ComponentClass = createComponentClass(tag, definition);\n\n // Registration is intentionally the sole global side effect of define().\n Object.defineProperty(ComponentClass, 'name', { value: tag });\n customElements.define(tag, ComponentClass);\n}\n"],"mappings":"oEAgCA,SAAgB,EACd,EACA,EACM,CACN,GAAI,CAAC,EAAK,MAAM,IAAI,EAAA,YAAY,EAAA,WAAW,iBAAiB,EAE5D,GAAI,eAAe,IAAI,CAAG,EAAG,MAAM,IAAI,EAAA,YAAY,EAAA,WAAW,gBAAgB,CAAG,CAAC,EAElF,IAAM,EAAiB,EAAA,qBAAqB,EAAK,CAAU,EAG3D,OAAO,eAAe,EAAgB,OAAQ,CAAE,MAAO,CAAI,CAAC,EAC5D,eAAe,OAAO,EAAK,CAAc,CAC3C"}
package/dist/define.d.ts CHANGED
@@ -1,8 +1,4 @@
1
1
  import type { ComponentDefinition } from './component-types';
2
- import { type PropDef, prop } from './props';
3
- export type { HostBindFn } from './host-bind';
4
- export type { PropDef };
5
- export { prop };
6
2
  /**
7
3
  * Define and register a web component.
8
4
  *
@@ -1 +1 @@
1
- {"version":3,"file":"define.d.ts","sourceRoot":"","sources":["../src/define.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAE7D,OAAO,EAAE,KAAK,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAE7C,YAAY,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9C,YAAY,EAAE,OAAO,EAAE,CAAC;AACxB,OAAO,EAAE,IAAI,EAAE,CAAC;AAEhB;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,MAAM,CAAC,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,EACjF,GAAG,EAAE,MAAM,EACX,UAAU,EAAE,mBAAmB,CAAC,KAAK,CAAC,GACrC,IAAI,CAUN"}
1
+ {"version":3,"file":"define.d.ts","sourceRoot":"","sources":["../src/define.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAG7D;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,MAAM,CAAC,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,EACjF,GAAG,EAAE,MAAM,EACX,UAAU,EAAE,mBAAmB,CAAC,KAAK,CAAC,GACrC,IAAI,CAUN"}
package/dist/define.js CHANGED
@@ -1,2 +1,2 @@
1
- import{ORE_ERRORS as e,OreApiError as t}from"./errors.js";import{prop as n}from"./props.js";import{createComponentClass as r}from"./_component-class.js";function i(n,i){if(!n)throw new t(e.defineRequiresTag);if(customElements.get(n))throw new t(e.defineDuplicate(n));let a=r(n,i);Object.defineProperty(a,"name",{value:n}),customElements.define(n,a)}export{i as define,n as prop};
1
+ import{ORE_ERRORS as e,OreApiError as t}from"./errors.js";import{createComponentClass as n}from"./_component-class.js";function r(r,i){if(!r)throw new t(e.defineRequiresTag);if(customElements.get(r))throw new t(e.defineDuplicate(r));let a=n(r,i);Object.defineProperty(a,"name",{value:r}),customElements.define(r,a)}export{r as define};
2
2
  //# sourceMappingURL=define.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"define.js","names":[],"sources":["../src/define.ts"],"sourcesContent":["import { createComponentClass } from './_component-class';\nimport type { ComponentDefinition } from './component-types';\nimport { ORE_ERRORS, OreApiError } from './errors';\nimport { type PropDef, prop } from './props';\n\nexport type { HostBindFn } from './host-bind';\nexport type { PropDef };\nexport { prop };\n\n/**\n * Define and register a web component.\n *\n * The `setup` function runs for each connection and returns an `HTMLResult`.\n * Disconnecting disposes its state; reconnecting rebuilds it. All reactive\n * behaviour within a connection is expressed through directives inside the\n * template — not by re-evaluating setup itself.\n *\n * Everything besides `props` — lifecycle hooks, host bindings, context, slots,\n * emit — is a free function imported from `@vielzeug/ore` and called directly\n * from inside `setup()` (or from a composable it calls):\n *\n * ```ts\n * import { define, html, prop, onMounted, useEmit, useSlots } from '@vielzeug/ore';\n *\n * define<{ count?: number }>('my-counter', {\n * props: { count: prop.number(0) },\n * setup(props) {\n * const emit = useEmit<{ increment: number }>();\n * const slots = useSlots<'header' | 'footer'>();\n *\n * onMounted(() => console.log('mounted'));\n *\n * return html`<button @click=${() => emit('increment', props.count.value + 1)}>${props.count}</button>`;\n * },\n * });\n * ```\n */\nexport function define<Props extends Record<string, unknown> = Record<never, never>>(\n tag: string,\n definition: ComponentDefinition<Props>,\n): void {\n if (!tag) throw new OreApiError(ORE_ERRORS.defineRequiresTag);\n\n if (customElements.get(tag)) throw new OreApiError(ORE_ERRORS.defineDuplicate(tag));\n\n const ComponentClass = createComponentClass(tag, definition);\n\n // Registration is intentionally the sole global side effect of define().\n Object.defineProperty(ComponentClass, 'name', { value: tag });\n customElements.define(tag, ComponentClass);\n}\n"],"mappings":"yJAqCA,SAAgB,EACd,EACA,EACM,CACN,GAAI,CAAC,EAAK,MAAM,IAAI,EAAY,EAAW,iBAAiB,EAE5D,GAAI,eAAe,IAAI,CAAG,EAAG,MAAM,IAAI,EAAY,EAAW,gBAAgB,CAAG,CAAC,EAElF,IAAM,EAAiB,EAAqB,EAAK,CAAU,EAG3D,OAAO,eAAe,EAAgB,OAAQ,CAAE,MAAO,CAAI,CAAC,EAC5D,eAAe,OAAO,EAAK,CAAc,CAC3C"}
1
+ {"version":3,"file":"define.js","names":[],"sources":["../src/define.ts"],"sourcesContent":["import { createComponentClass } from './_component-class';\nimport type { ComponentDefinition } from './component-types';\nimport { ORE_ERRORS, OreApiError } from './errors';\n\n/**\n * Define and register a web component.\n *\n * The `setup` function runs for each connection and returns an `HTMLResult`.\n * Disconnecting disposes its state; reconnecting rebuilds it. All reactive\n * behaviour within a connection is expressed through directives inside the\n * template — not by re-evaluating setup itself.\n *\n * Everything besides `props` — lifecycle hooks, host bindings, context, slots,\n * emit — is a free function imported from `@vielzeug/ore` and called directly\n * from inside `setup()` (or from a composable it calls):\n *\n * ```ts\n * import { define, html, prop, onMounted, useEmit, useSlots } from '@vielzeug/ore';\n *\n * define<{ count?: number }>('my-counter', {\n * props: { count: prop.number(0) },\n * setup(props) {\n * const emit = useEmit<{ increment: number }>();\n * const slots = useSlots<'header' | 'footer'>();\n *\n * onMounted(() => console.log('mounted'));\n *\n * return html`<button @click=${() => emit('increment', props.count.value + 1)}>${props.count}</button>`;\n * },\n * });\n * ```\n */\nexport function define<Props extends Record<string, unknown> = Record<never, never>>(\n tag: string,\n definition: ComponentDefinition<Props>,\n): void {\n if (!tag) throw new OreApiError(ORE_ERRORS.defineRequiresTag);\n\n if (customElements.get(tag)) throw new OreApiError(ORE_ERRORS.defineDuplicate(tag));\n\n const ComponentClass = createComponentClass(tag, definition);\n\n // Registration is intentionally the sole global side effect of define().\n Object.defineProperty(ComponentClass, 'name', { value: tag });\n customElements.define(tag, ComponentClass);\n}\n"],"mappings":"uHAgCA,SAAgB,EACd,EACA,EACM,CACN,GAAI,CAAC,EAAK,MAAM,IAAI,EAAY,EAAW,iBAAiB,EAE5D,GAAI,eAAe,IAAI,CAAG,EAAG,MAAM,IAAI,EAAY,EAAW,gBAAgB,CAAG,CAAC,EAElF,IAAM,EAAiB,EAAqB,EAAK,CAAU,EAG3D,OAAO,eAAe,EAAgB,OAAQ,CAAE,MAAO,CAAI,CAAC,EAC5D,eAAe,OAAO,EAAK,CAAc,CAC3C"}
@@ -1,2 +1,2 @@
1
- const e=require("../errors.cjs"),t=require("../utils/dom.cjs"),n=require("../template/result.cjs");let r=require("@vielzeug/ripple");var i=(e,t,n)=>{let r=document.createElement(`template`);r.innerHTML=e;let i=Array.from(r.content.cloneNode(!0).childNodes);for(let e of i)t.insertBefore(e,n);return i};function a(o){if(typeof o==`function`){let e=(0,r.computed)(o);return n.createDirectiveResult((t,n)=>{a(e).mount(t,n)})}return n.createDirectiveResult((n,a)=>{let s=n.parentNode;e.invariant(s,`unsafeHtml() anchor comment has no parent node`);let c=document.createComment(`unsafe-html/end`);if(s.insertBefore(c,n.nextSibling),(0,r.isReactive)(o)){let e=t.createReplaceableSlot(),n=o,l=(0,r.effect)(()=>{e.clear(),e.setNodes(i(n.value,s,c))});a(()=>l.dispose()),a(()=>{e.clear(),c.remove()})}else i(o,s,c),a(()=>c.remove())})}exports.unsafeHtml=a;
1
+ const e=require("../errors.cjs"),t=require("../utils/dom.cjs"),n=require("../template/result.cjs");let r=require("@vielzeug/ripple");var i=(e,t,n)=>{let r=document.createElement(`template`);r.innerHTML=e;let i=Array.from(r.content.cloneNode(!0).childNodes);for(let e of i)t.insertBefore(e,n);return i};function a(a){let o=typeof a==`function`?(0,r.computed)(a):(0,r.isReactive)(a)?a:null;return n.createDirectiveResult((n,s)=>{let c=n.parentNode;e.invariant(c,`unsafeHtml() anchor comment has no parent node`);let l=document.createComment(`unsafe-html/end`);if(c.insertBefore(l,n.nextSibling),o){let e=t.createReplaceableSlot(),n=(0,r.effect)(()=>{e.clear(),e.setNodes(i(o.value,c,l))});s(()=>n.dispose()),s(()=>{e.clear(),l.remove()})}else i(a,c,l),s(()=>l.remove())})}exports.unsafeHtml=a;
2
2
  //# sourceMappingURL=unsafe-html.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"unsafe-html.cjs","names":[],"sources":["../../src/directives/unsafe-html.ts"],"sourcesContent":["import { computed, isReactive, type Readable, effect as rawEffect, type Signal } from '@vielzeug/ripple';\n\nimport { invariant } from '../errors';\nimport { createDirectiveResult, type DirectiveResult } from '../template/result';\nimport { createReplaceableSlot } from '../utils/dom';\n\nconst parseHtml = (html: string, parent: ParentNode, insertBefore: Node): Node[] => {\n const tpl = document.createElement('template');\n\n tpl.innerHTML = html;\n\n const nodes = Array.from(tpl.content.cloneNode(true).childNodes);\n\n for (const node of nodes) parent.insertBefore(node, insertBefore);\n\n return nodes;\n};\n\n/**\n * Renders HTML without escaping as a DirectiveResult.\n *\n * This is intentionally named `unsafeHtml`: sanitization is an application\n * boundary, not mutable process-wide framework configuration. Sanitize\n * untrusted content before passing it here.\n *\n * Supports static strings, signals, and getter functions `() => string`.\n * When reactive, the DOM is updated in-place whenever the value changes.\n */\nexport function unsafeHtml(value: (() => string) | string | Signal<string> | Readable<string>): DirectiveResult {\n if (typeof value === 'function') {\n const c = computed(value);\n\n return createDirectiveResult((anchor, registerCleanup) => {\n unsafeHtml(c).mount(anchor, registerCleanup);\n });\n }\n\n return createDirectiveResult((anchor, registerCleanup) => {\n const parent = anchor.parentNode;\n\n invariant(parent, 'unsafeHtml() anchor comment has no parent node');\n\n const endMarker = document.createComment('unsafe-html/end');\n\n parent.insertBefore(endMarker, anchor.nextSibling);\n\n if (isReactive(value)) {\n const slot = createReplaceableSlot();\n const src = value as Readable<string>;\n\n const stop = rawEffect(() => {\n slot.clear();\n slot.setNodes(parseHtml(src.value, parent, endMarker));\n });\n\n registerCleanup(() => stop.dispose());\n registerCleanup(() => {\n slot.clear();\n endMarker.remove();\n });\n } else {\n parseHtml(value, parent, endMarker);\n\n registerCleanup(() => endMarker.remove());\n }\n });\n}\n"],"mappings":"qIAMA,IAAM,GAAa,EAAc,EAAoB,IAA+B,CAClF,IAAM,EAAM,SAAS,cAAc,UAAU,EAE7C,EAAI,UAAY,EAEhB,IAAM,EAAQ,MAAM,KAAK,EAAI,QAAQ,UAAU,EAAI,CAAC,CAAC,UAAU,EAE/D,IAAK,IAAM,KAAQ,EAAO,EAAO,aAAa,EAAM,CAAY,EAEhE,OAAO,CACT,EAYA,SAAgB,EAAW,EAAqF,CAC9G,GAAI,OAAO,GAAU,WAAY,CAC/B,IAAM,GAAA,EAAI,EAAA,SAAA,CAAS,CAAK,EAExB,OAAO,EAAA,uBAAuB,EAAQ,IAAoB,CACxD,EAAW,CAAC,CAAC,CAAC,MAAM,EAAQ,CAAe,CAC7C,CAAC,CACH,CAEA,OAAO,EAAA,uBAAuB,EAAQ,IAAoB,CACxD,IAAM,EAAS,EAAO,WAEtB,EAAA,UAAU,EAAQ,gDAAgD,EAElE,IAAM,EAAY,SAAS,cAAc,iBAAiB,EAI1D,GAFA,EAAO,aAAa,EAAW,EAAO,WAAW,GAEjD,EAAI,EAAA,WAAA,CAAW,CAAK,EAAG,CACrB,IAAM,EAAO,EAAA,sBAAsB,EAC7B,EAAM,EAEN,GAAA,EAAO,EAAA,OAAA,KAAgB,CAC3B,EAAK,MAAM,EACX,EAAK,SAAS,EAAU,EAAI,MAAO,EAAQ,CAAS,CAAC,CACvD,CAAC,EAED,MAAsB,EAAK,QAAQ,CAAC,EACpC,MAAsB,CACpB,EAAK,MAAM,EACX,EAAU,OAAO,CACnB,CAAC,CACH,MACE,EAAU,EAAO,EAAQ,CAAS,EAElC,MAAsB,EAAU,OAAO,CAAC,CAE5C,CAAC,CACH"}
1
+ {"version":3,"file":"unsafe-html.cjs","names":[],"sources":["../../src/directives/unsafe-html.ts"],"sourcesContent":["import { computed, isReactive, type Readable, effect as rawEffect, type Signal } from '@vielzeug/ripple';\n\nimport { invariant } from '../errors';\nimport { createDirectiveResult, type DirectiveResult } from '../template/result';\nimport { createReplaceableSlot } from '../utils/dom';\n\nconst parseHtml = (html: string, parent: ParentNode, insertBefore: Node): Node[] => {\n const tpl = document.createElement('template');\n\n tpl.innerHTML = html;\n\n const nodes = Array.from(tpl.content.cloneNode(true).childNodes);\n\n for (const node of nodes) parent.insertBefore(node, insertBefore);\n\n return nodes;\n};\n\n/**\n * Renders HTML without escaping as a DirectiveResult.\n *\n * This is intentionally named `unsafeHtml`: sanitization is an application\n * boundary, not mutable process-wide framework configuration. Sanitize\n * untrusted content before passing it here.\n *\n * Supports static strings, signals, and getter functions `() => string`.\n * When reactive, the DOM is updated in-place whenever the value changes.\n */\nexport function unsafeHtml(value: (() => string) | string | Signal<string> | Readable<string>): DirectiveResult {\n const isFn = typeof value === 'function';\n const src: Readable<string> | null = isFn ? computed(value as () => string) : isReactive(value) ? value : null;\n\n return createDirectiveResult((anchor, registerCleanup) => {\n const parent = anchor.parentNode;\n\n invariant(parent, 'unsafeHtml() anchor comment has no parent node');\n\n const endMarker = document.createComment('unsafe-html/end');\n\n parent.insertBefore(endMarker, anchor.nextSibling);\n\n if (src) {\n const slot = createReplaceableSlot();\n\n const stop = rawEffect(() => {\n slot.clear();\n slot.setNodes(parseHtml(src.value, parent, endMarker));\n });\n\n registerCleanup(() => stop.dispose());\n registerCleanup(() => {\n slot.clear();\n endMarker.remove();\n });\n } else {\n parseHtml(value as string, parent, endMarker);\n\n registerCleanup(() => endMarker.remove());\n }\n });\n}\n"],"mappings":"qIAMA,IAAM,GAAa,EAAc,EAAoB,IAA+B,CAClF,IAAM,EAAM,SAAS,cAAc,UAAU,EAE7C,EAAI,UAAY,EAEhB,IAAM,EAAQ,MAAM,KAAK,EAAI,QAAQ,UAAU,EAAI,CAAC,CAAC,UAAU,EAE/D,IAAK,IAAM,KAAQ,EAAO,EAAO,aAAa,EAAM,CAAY,EAEhE,OAAO,CACT,EAYA,SAAgB,EAAW,EAAqF,CAE9G,IAAM,EADO,OAAO,GAAU,YAAA,EACc,EAAA,SAAA,CAAS,CAAqB,GAAA,EAAI,EAAA,WAAA,CAAW,CAAK,EAAI,EAAQ,KAE1G,OAAO,EAAA,uBAAuB,EAAQ,IAAoB,CACxD,IAAM,EAAS,EAAO,WAEtB,EAAA,UAAU,EAAQ,gDAAgD,EAElE,IAAM,EAAY,SAAS,cAAc,iBAAiB,EAI1D,GAFA,EAAO,aAAa,EAAW,EAAO,WAAW,EAE7C,EAAK,CACP,IAAM,EAAO,EAAA,sBAAsB,EAE7B,GAAA,EAAO,EAAA,OAAA,KAAgB,CAC3B,EAAK,MAAM,EACX,EAAK,SAAS,EAAU,EAAI,MAAO,EAAQ,CAAS,CAAC,CACvD,CAAC,EAED,MAAsB,EAAK,QAAQ,CAAC,EACpC,MAAsB,CACpB,EAAK,MAAM,EACX,EAAU,OAAO,CACnB,CAAC,CACH,MACE,EAAU,EAAiB,EAAQ,CAAS,EAE5C,MAAsB,EAAU,OAAO,CAAC,CAE5C,CAAC,CACH"}
@@ -1 +1 @@
1
- {"version":3,"file":"unsafe-html.d.ts","sourceRoot":"","sources":["../../src/directives/unsafe-html.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwB,KAAK,QAAQ,EAAuB,KAAK,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAGzG,OAAO,EAAyB,KAAK,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAejF;;;;;;;;;GASG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,CAAC,MAAM,MAAM,CAAC,GAAG,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,GAAG,QAAQ,CAAC,MAAM,CAAC,GAAG,eAAe,CAsC9G"}
1
+ {"version":3,"file":"unsafe-html.d.ts","sourceRoot":"","sources":["../../src/directives/unsafe-html.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwB,KAAK,QAAQ,EAAuB,KAAK,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAGzG,OAAO,EAAyB,KAAK,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAejF;;;;;;;;;GASG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,CAAC,MAAM,MAAM,CAAC,GAAG,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,GAAG,QAAQ,CAAC,MAAM,CAAC,GAAG,eAAe,CAgC9G"}
@@ -1,2 +1,2 @@
1
- import{invariant as e}from"../errors.js";import{createReplaceableSlot as t}from"../utils/dom.js";import{createDirectiveResult as n}from"../template/result.js";import{computed as r,effect as i,isReactive as a}from"@vielzeug/ripple";var o=(e,t,n)=>{let r=document.createElement(`template`);r.innerHTML=e;let i=Array.from(r.content.cloneNode(!0).childNodes);for(let e of i)t.insertBefore(e,n);return i};function s(c){if(typeof c==`function`){let e=r(c);return n((t,n)=>{s(e).mount(t,n)})}return n((n,r)=>{let s=n.parentNode;e(s,`unsafeHtml() anchor comment has no parent node`);let l=document.createComment(`unsafe-html/end`);if(s.insertBefore(l,n.nextSibling),a(c)){let e=t(),n=c,a=i(()=>{e.clear(),e.setNodes(o(n.value,s,l))});r(()=>a.dispose()),r(()=>{e.clear(),l.remove()})}else o(c,s,l),r(()=>l.remove())})}export{s as unsafeHtml};
1
+ import{invariant as e}from"../errors.js";import{createReplaceableSlot as t}from"../utils/dom.js";import{createDirectiveResult as n}from"../template/result.js";import{computed as r,effect as i,isReactive as a}from"@vielzeug/ripple";var o=(e,t,n)=>{let r=document.createElement(`template`);r.innerHTML=e;let i=Array.from(r.content.cloneNode(!0).childNodes);for(let e of i)t.insertBefore(e,n);return i};function s(s){let c=typeof s==`function`?r(s):a(s)?s:null;return n((n,r)=>{let a=n.parentNode;e(a,`unsafeHtml() anchor comment has no parent node`);let l=document.createComment(`unsafe-html/end`);if(a.insertBefore(l,n.nextSibling),c){let e=t(),n=i(()=>{e.clear(),e.setNodes(o(c.value,a,l))});r(()=>n.dispose()),r(()=>{e.clear(),l.remove()})}else o(s,a,l),r(()=>l.remove())})}export{s as unsafeHtml};
2
2
  //# sourceMappingURL=unsafe-html.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"unsafe-html.js","names":[],"sources":["../../src/directives/unsafe-html.ts"],"sourcesContent":["import { computed, isReactive, type Readable, effect as rawEffect, type Signal } from '@vielzeug/ripple';\n\nimport { invariant } from '../errors';\nimport { createDirectiveResult, type DirectiveResult } from '../template/result';\nimport { createReplaceableSlot } from '../utils/dom';\n\nconst parseHtml = (html: string, parent: ParentNode, insertBefore: Node): Node[] => {\n const tpl = document.createElement('template');\n\n tpl.innerHTML = html;\n\n const nodes = Array.from(tpl.content.cloneNode(true).childNodes);\n\n for (const node of nodes) parent.insertBefore(node, insertBefore);\n\n return nodes;\n};\n\n/**\n * Renders HTML without escaping as a DirectiveResult.\n *\n * This is intentionally named `unsafeHtml`: sanitization is an application\n * boundary, not mutable process-wide framework configuration. Sanitize\n * untrusted content before passing it here.\n *\n * Supports static strings, signals, and getter functions `() => string`.\n * When reactive, the DOM is updated in-place whenever the value changes.\n */\nexport function unsafeHtml(value: (() => string) | string | Signal<string> | Readable<string>): DirectiveResult {\n if (typeof value === 'function') {\n const c = computed(value);\n\n return createDirectiveResult((anchor, registerCleanup) => {\n unsafeHtml(c).mount(anchor, registerCleanup);\n });\n }\n\n return createDirectiveResult((anchor, registerCleanup) => {\n const parent = anchor.parentNode;\n\n invariant(parent, 'unsafeHtml() anchor comment has no parent node');\n\n const endMarker = document.createComment('unsafe-html/end');\n\n parent.insertBefore(endMarker, anchor.nextSibling);\n\n if (isReactive(value)) {\n const slot = createReplaceableSlot();\n const src = value as Readable<string>;\n\n const stop = rawEffect(() => {\n slot.clear();\n slot.setNodes(parseHtml(src.value, parent, endMarker));\n });\n\n registerCleanup(() => stop.dispose());\n registerCleanup(() => {\n slot.clear();\n endMarker.remove();\n });\n } else {\n parseHtml(value, parent, endMarker);\n\n registerCleanup(() => endMarker.remove());\n }\n });\n}\n"],"mappings":"uOAMA,IAAM,GAAa,EAAc,EAAoB,IAA+B,CAClF,IAAM,EAAM,SAAS,cAAc,UAAU,EAE7C,EAAI,UAAY,EAEhB,IAAM,EAAQ,MAAM,KAAK,EAAI,QAAQ,UAAU,EAAI,CAAC,CAAC,UAAU,EAE/D,IAAK,IAAM,KAAQ,EAAO,EAAO,aAAa,EAAM,CAAY,EAEhE,OAAO,CACT,EAYA,SAAgB,EAAW,EAAqF,CAC9G,GAAI,OAAO,GAAU,WAAY,CAC/B,IAAM,EAAI,EAAS,CAAK,EAExB,OAAO,GAAuB,EAAQ,IAAoB,CACxD,EAAW,CAAC,CAAC,CAAC,MAAM,EAAQ,CAAe,CAC7C,CAAC,CACH,CAEA,OAAO,GAAuB,EAAQ,IAAoB,CACxD,IAAM,EAAS,EAAO,WAEtB,EAAU,EAAQ,gDAAgD,EAElE,IAAM,EAAY,SAAS,cAAc,iBAAiB,EAI1D,GAFA,EAAO,aAAa,EAAW,EAAO,WAAW,EAE7C,EAAW,CAAK,EAAG,CACrB,IAAM,EAAO,EAAsB,EAC7B,EAAM,EAEN,EAAO,MAAgB,CAC3B,EAAK,MAAM,EACX,EAAK,SAAS,EAAU,EAAI,MAAO,EAAQ,CAAS,CAAC,CACvD,CAAC,EAED,MAAsB,EAAK,QAAQ,CAAC,EACpC,MAAsB,CACpB,EAAK,MAAM,EACX,EAAU,OAAO,CACnB,CAAC,CACH,MACE,EAAU,EAAO,EAAQ,CAAS,EAElC,MAAsB,EAAU,OAAO,CAAC,CAE5C,CAAC,CACH"}
1
+ {"version":3,"file":"unsafe-html.js","names":[],"sources":["../../src/directives/unsafe-html.ts"],"sourcesContent":["import { computed, isReactive, type Readable, effect as rawEffect, type Signal } from '@vielzeug/ripple';\n\nimport { invariant } from '../errors';\nimport { createDirectiveResult, type DirectiveResult } from '../template/result';\nimport { createReplaceableSlot } from '../utils/dom';\n\nconst parseHtml = (html: string, parent: ParentNode, insertBefore: Node): Node[] => {\n const tpl = document.createElement('template');\n\n tpl.innerHTML = html;\n\n const nodes = Array.from(tpl.content.cloneNode(true).childNodes);\n\n for (const node of nodes) parent.insertBefore(node, insertBefore);\n\n return nodes;\n};\n\n/**\n * Renders HTML without escaping as a DirectiveResult.\n *\n * This is intentionally named `unsafeHtml`: sanitization is an application\n * boundary, not mutable process-wide framework configuration. Sanitize\n * untrusted content before passing it here.\n *\n * Supports static strings, signals, and getter functions `() => string`.\n * When reactive, the DOM is updated in-place whenever the value changes.\n */\nexport function unsafeHtml(value: (() => string) | string | Signal<string> | Readable<string>): DirectiveResult {\n const isFn = typeof value === 'function';\n const src: Readable<string> | null = isFn ? computed(value as () => string) : isReactive(value) ? value : null;\n\n return createDirectiveResult((anchor, registerCleanup) => {\n const parent = anchor.parentNode;\n\n invariant(parent, 'unsafeHtml() anchor comment has no parent node');\n\n const endMarker = document.createComment('unsafe-html/end');\n\n parent.insertBefore(endMarker, anchor.nextSibling);\n\n if (src) {\n const slot = createReplaceableSlot();\n\n const stop = rawEffect(() => {\n slot.clear();\n slot.setNodes(parseHtml(src.value, parent, endMarker));\n });\n\n registerCleanup(() => stop.dispose());\n registerCleanup(() => {\n slot.clear();\n endMarker.remove();\n });\n } else {\n parseHtml(value as string, parent, endMarker);\n\n registerCleanup(() => endMarker.remove());\n }\n });\n}\n"],"mappings":"uOAMA,IAAM,GAAa,EAAc,EAAoB,IAA+B,CAClF,IAAM,EAAM,SAAS,cAAc,UAAU,EAE7C,EAAI,UAAY,EAEhB,IAAM,EAAQ,MAAM,KAAK,EAAI,QAAQ,UAAU,EAAI,CAAC,CAAC,UAAU,EAE/D,IAAK,IAAM,KAAQ,EAAO,EAAO,aAAa,EAAM,CAAY,EAEhE,OAAO,CACT,EAYA,SAAgB,EAAW,EAAqF,CAE9G,IAAM,EADO,OAAO,GAAU,WACc,EAAS,CAAqB,EAAI,EAAW,CAAK,EAAI,EAAQ,KAE1G,OAAO,GAAuB,EAAQ,IAAoB,CACxD,IAAM,EAAS,EAAO,WAEtB,EAAU,EAAQ,gDAAgD,EAElE,IAAM,EAAY,SAAS,cAAc,iBAAiB,EAI1D,GAFA,EAAO,aAAa,EAAW,EAAO,WAAW,EAE7C,EAAK,CACP,IAAM,EAAO,EAAsB,EAE7B,EAAO,MAAgB,CAC3B,EAAK,MAAM,EACX,EAAK,SAAS,EAAU,EAAI,MAAO,EAAQ,CAAS,CAAC,CACvD,CAAC,EAED,MAAsB,EAAK,QAAQ,CAAC,EACpC,MAAsB,CACpB,EAAK,MAAM,EACX,EAAU,OAAO,CACnB,CAAC,CACH,MACE,EAAU,EAAiB,EAAQ,CAAS,EAE5C,MAAsB,EAAU,OAAO,CAAC,CAE5C,CAAC,CACH"}
package/dist/errors.cjs CHANGED
@@ -1,3 +1,3 @@
1
- require("./_dev.cjs");var e=class extends Error{constructor(e,t){super(e,t),this.name=new.target.name,Object.setPrototypeOf(this,new.target.prototype)}},t=class extends e{},n=class extends e{},r=class extends e{component;phase;constructor(e,t){super(e,{cause:t.cause}),this.component=t.component,this.phase=t.phase}};function i(e,t){`${e.component}${e.phase}`,e.cause,t.dispatchEvent(new CustomEvent(`ore:error`,{bubbles:!0,composed:!0,detail:e}))}var a=class extends e{},o={asyncSetupUnsupported:`setup() must return an HTMLResult or null; use reactive state for asynchronous work`,defineDuplicate:e=>`define('${e}') called twice — custom element already registered`,defineFieldRequiresFormAssociated:e=>`useField() requires define('${e}', { formAssociated: true })`,defineRequiresTag:`define() requires a tag name`,eachDuplicateKey:(e,t)=>`each() received duplicate key "${e}" at index ${t}`,eventModifiersUnsupported:e=>`@${e}: event modifiers are unsupported; call native event methods in the handler instead`,injectStrictFailed:(e,t)=>`injectStrict() could not resolve key "${e}" in <${t}>`,invariantViolated:e=>`invariant violated: ${e}`,lifecycleOutsideSetup:`Lifecycle hooks must be called during component setup`,listenNullTarget:e=>`listen() called with a null/undefined target for event "${e}" — listener not attached`,propInvalidReflect:`Structured props cannot use reflect:true — use prop.json() with reflect:false`,templateInterpolationInTag:"html`...`: interpolations inside a tag must be named attributes, boolean attributes, events, or refs",useFieldAlreadyCalled:e=>`useField() was already called on <${e}>. Call it only once per component.`,validationFailed:(e,t)=>`Validation failed for <${e}>:\n${t.join(`
2
- `)}`};function s(e,t){if(!e)throw new n(o.invariantViolated(t))}exports.ORE_ERRORS=o,exports.OreApiError=t,exports.OreError=e,exports.OreInternalError=n,exports.OreLifecycleError=r,exports.OreTimeoutError=a,exports.invariant=s,exports.reportRuntimeError=i;
1
+ require("./_dev.cjs");var e=class extends Error{constructor(e,t){super(e,t),this.name=new.target.name,Object.setPrototypeOf(this,new.target.prototype)}},t=class extends e{},n=class extends e{},r=class extends e{component;phase;constructor(e,t){super(e,{cause:t.cause}),this.component=t.component,this.phase=t.phase}};function i(e,t){`${e.component}${e.phase}`,e.cause,t.dispatchEvent(new CustomEvent(`ore:error`,{bubbles:!0,composed:!0,detail:e}))}var a={asyncSetupUnsupported:`setup() must return an HTMLResult or null; use reactive state for asynchronous work`,defineDuplicate:e=>`define('${e}') called twice — custom element already registered`,defineFieldRequiresFormAssociated:e=>`useField() requires define('${e}', { formAssociated: true })`,defineRequiresTag:`define() requires a tag name`,eachDuplicateKey:(e,t)=>`each() received duplicate key "${e}" at index ${t}`,eventModifiersUnsupported:e=>`@${e}: event modifiers are unsupported; call native event methods in the handler instead`,injectStrictFailed:(e,t)=>`injectStrict() could not resolve key "${e}" in <${t}>`,invariantViolated:e=>`invariant violated: ${e}`,lifecycleOutsideSetup:`Lifecycle hooks must be called during component setup`,listenNullTarget:e=>`listen() called with a null/undefined target for event "${e}" — listener not attached`,propInvalidReflect:`Structured props cannot use reflect:true — use prop.json() with reflect:false`,templateInterpolationInTag:"html`...`: interpolations inside a tag must be named attributes, boolean attributes, events, or refs",useFieldAlreadyCalled:e=>`useField() was already called on <${e}>. Call it only once per component.`,validationFailed:(e,t)=>`Validation failed for <${e}>:\n${t.join(`
2
+ `)}`};function o(e,t){if(!e)throw new n(a.invariantViolated(t))}exports.ORE_ERRORS=a,exports.OreApiError=t,exports.OreError=e,exports.OreInternalError=n,exports.OreLifecycleError=r,exports.invariant=o,exports.reportRuntimeError=i;
3
3
  //# sourceMappingURL=errors.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"errors.cjs","names":[],"sources":["../src/errors.ts"],"sourcesContent":["import { error as logError } from './_dev';\n\n// ─── Error policy ─────────────────────────────────────────────────────────────\n// One rule for the whole package — decide by whose code failed and whether it\n// can continue, never ad hoc per call site:\n//\n// API misuse (wrong arguments, hook outside setup, duplicate define)\n// → throw `OreApiError`, immediately, every build.\n// User-authored code failing inside ore's execution (setup, onMounted,\n// onFormReset, each() reconciliation)\n// → wrap in `OreLifecycleError` and report via `reportRuntimeError()`\n// (`ore:error` DOM event + dev console) so other callbacks keep running.\n// Recoverable oddity (overwrite warnings, blocked attribute writes)\n// → dev `warn()`/`error()` and continue. Never swallow silently.\n// Internal impossibility (compiled template metadata out of sync)\n// → `invariant()` throws `OreInternalError`, every build.\n\n// ─── Structured error types ───────────────────────────────────────────────────\n\n/** Base class for all Ore errors. Use `instanceof OreError` to catch any Ore-originated error. */\nexport class OreError extends Error {\n constructor(message: string, opts?: ErrorOptions) {\n super(message, opts);\n this.name = new.target.name;\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\n/** Thrown when Ore API is called incorrectly (e.g. outside setup, duplicate define, invalid prop). */\nexport class OreApiError extends OreError {}\n\n/**\n * Thrown when an internal invariant fails — e.g. compiled template metadata no\n * longer matching the DOM it was cloned from. Distinct from `OreApiError`: this\n * is never the caller's fault, it signals a bug in ore itself. See `invariant()`.\n */\nexport class OreInternalError extends OreError {}\n\n/**\n * The phase in which a component error occurred.\n * - `'setup'` — synchronous setup() threw\n * - `'mounted'` — an onMounted callback threw\n * - `'form-reset'` — an onFormReset callback threw\n * - `'each-reconcile'` — `each()` failed to reconcile a list update (e.g. duplicate keys)\n */\nexport type OreErrorPhase = 'each-reconcile' | 'form-reset' | 'mounted' | 'setup';\n\n/**\n * Structured error thrown by the Ore runtime when component setup fails.\n * Provides component name and original cause for debugging.\n */\nexport class OreLifecycleError extends OreError {\n readonly component: string;\n readonly phase: OreErrorPhase;\n\n constructor(message: string, options: { cause: Error; component: string; phase: OreErrorPhase }) {\n super(message, { cause: options.cause });\n this.component = options.component;\n this.phase = options.phase;\n }\n}\n\n/**\n * Report a runtime error via the ore:error event and console.\n *\n * `target` only needs to be an `EventTarget` (not specifically an `HTMLElement`) — component\n * lifecycle errors dispatch on the host element, but non-lifecycle failures (e.g. `each()`\n * reconciliation, which has no single \"component\" to attribute the error to) dispatch on\n * whatever live DOM node is available, such as the directive's own anchor `Comment`. Either way\n * the event still bubbles and crosses shadow boundaries (`composed: true`), so a listener on\n * `document`/`window` observes every report regardless of where it originated.\n *\n * The console log (via `_dev.ts`'s `error()`) is still dev-gated like the rest of the package's\n * console diagnostics, but the `ore:error` DOM event dispatch below is **not** — it fires in\n * every build, so consumers always have a way to observe runtime failures programmatically even\n * when console output is stripped in production.\n */\nexport function reportRuntimeError(error: OreLifecycleError, target: EventTarget): void {\n logError(`<${error.component}> lifecycle error (phase: ${error.phase}):`, error.cause);\n\n target.dispatchEvent(\n new CustomEvent('ore:error', {\n bubbles: true,\n composed: true,\n detail: error,\n }),\n );\n}\n\n// ─── Error message constants ─────────────────────────────────────────────────\n\n/** Thrown by `flush()` in the testing sub-path when pending component work doesn't settle within the timeout. */\nexport class OreTimeoutError extends OreError {}\n\nexport const ORE_ERRORS = {\n asyncSetupUnsupported: 'setup() must return an HTMLResult or null; use reactive state for asynchronous work',\n defineDuplicate: (tag: string): string => `define('${tag}') called twice — custom element already registered`,\n defineFieldRequiresFormAssociated: (tag: string): string =>\n `useField() requires define('${tag}', { formAssociated: true })`,\n defineRequiresTag: 'define() requires a tag name',\n eachDuplicateKey: (key: string, index: number): string => `each() received duplicate key \"${key}\" at index ${index}`,\n eventModifiersUnsupported: (eventName: string): string =>\n `@${eventName}: event modifiers are unsupported; call native event methods in the handler instead`,\n injectStrictFailed: (key: string, tag: string): string => `injectStrict() could not resolve key \"${key}\" in <${tag}>`,\n invariantViolated: (message: string): string => `invariant violated: ${message}`,\n lifecycleOutsideSetup: 'Lifecycle hooks must be called during component setup',\n listenNullTarget: (eventName: string): string =>\n `listen() called with a null/undefined target for event \"${eventName}\" — listener not attached`,\n propInvalidReflect: 'Structured props cannot use reflect:true — use prop.json() with reflect:false',\n templateInterpolationInTag:\n 'html`...`: interpolations inside a tag must be named attributes, boolean attributes, events, or refs',\n useFieldAlreadyCalled: (tag: string): string =>\n `useField() was already called on <${tag}>. Call it only once per component.`,\n validationFailed: (tag: string, errors: string[]): string => `Validation failed for <${tag}>:\\n${errors.join('\\n')}`,\n} as const;\n\n/**\n * Assert an internal invariant that must always hold — e.g. compiled template\n * metadata staying in sync with the DOM it was cloned from. A failed invariant\n * means a bug in ore itself, never user input, so it throws `OreInternalError`\n * unconditionally (every build, never gated like `_dev.ts`'s `warn()`).\n *\n * Narrowing caveat: `asserts condition` only narrows the exact expression\n * passed in. Assign to a local `const` first — `invariant(el.parentNode, msg)`\n * does not narrow later reads of `el.parentNode`.\n */\nexport function invariant(condition: unknown, message: string): asserts condition {\n if (!condition) throw new OreInternalError(ORE_ERRORS.invariantViolated(message));\n}\n"],"mappings":"sBAoBA,IAAa,EAAb,cAA8B,KAAM,CAClC,YAAY,EAAiB,EAAqB,CAChD,MAAM,EAAS,CAAI,EACnB,KAAK,KAAO,WAAW,KACvB,OAAO,eAAe,KAAM,WAAW,SAAS,CAClD,CACF,EAGa,EAAb,cAAiC,CAAS,CAAC,EAO9B,EAAb,cAAsC,CAAS,CAAC,EAenC,EAAb,cAAuC,CAAS,CAC9C,UACA,MAEA,YAAY,EAAiB,EAAoE,CAC/F,MAAM,EAAS,CAAE,MAAO,EAAQ,KAAM,CAAC,EACvC,KAAK,UAAY,EAAQ,UACzB,KAAK,MAAQ,EAAQ,KACvB,CACF,EAiBA,SAAgB,EAAmB,EAA0B,EAA2B,CAC7E,GAAI,EAAM,UAAV,EAAgD,EAAM,MAAtD,EAAiE,EAAM,MAEhF,EAAO,cACL,IAAI,YAAY,YAAa,CAC3B,QAAS,GACT,SAAU,GACV,OAAQ,CACV,CAAC,CACH,CACF,CAKA,IAAa,EAAb,cAAqC,CAAS,CAAC,EAElC,EAAa,CACxB,sBAAuB,sFACvB,gBAAkB,GAAwB,WAAW,EAAI,qDACzD,kCAAoC,GAClC,+BAA+B,EAAI,8BACrC,kBAAmB,+BACnB,kBAAmB,EAAa,IAA0B,kCAAkC,EAAI,aAAa,IAC7G,0BAA4B,GAC1B,IAAI,EAAU,qFAChB,oBAAqB,EAAa,IAAwB,yCAAyC,EAAI,QAAQ,EAAI,GACnH,kBAAoB,GAA4B,uBAAuB,IACvE,sBAAuB,wDACvB,iBAAmB,GACjB,2DAA2D,EAAU,2BACvE,mBAAoB,gFACpB,2BACE,uGACF,sBAAwB,GACtB,qCAAqC,EAAI,qCAC3C,kBAAmB,EAAa,IAA6B,0BAA0B,EAAI,MAAM,EAAO,KAAK;CAAI,GACnH,EAYA,SAAgB,EAAU,EAAoB,EAAoC,CAChF,GAAI,CAAC,EAAW,MAAM,IAAI,EAAiB,EAAW,kBAAkB,CAAO,CAAC,CAClF"}
1
+ {"version":3,"file":"errors.cjs","names":[],"sources":["../src/errors.ts"],"sourcesContent":["import { error as logError } from './_dev';\n\n// ─── Error policy ─────────────────────────────────────────────────────────────\n// One rule for the whole package — decide by whose code failed and whether it\n// can continue, never ad hoc per call site:\n//\n// API misuse (wrong arguments, hook outside setup, duplicate define)\n// → throw `OreApiError`, immediately, every build.\n// User-authored code failing inside ore's execution (setup, onMounted,\n// onFormReset, each() reconciliation)\n// → wrap in `OreLifecycleError` and report via `reportRuntimeError()`\n// (`ore:error` DOM event + dev console) so other callbacks keep running.\n// Recoverable oddity (overwrite warnings, blocked attribute writes)\n// → dev `warn()`/`error()` and continue. Never swallow silently.\n// Internal impossibility (compiled template metadata out of sync)\n// → `invariant()` throws `OreInternalError`, every build.\n\n// ─── Structured error types ───────────────────────────────────────────────────\n\n/** Base class for all Ore errors. Use `instanceof OreError` to catch any Ore-originated error. */\nexport class OreError extends Error {\n constructor(message: string, opts?: ErrorOptions) {\n super(message, opts);\n this.name = new.target.name;\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\n/** Thrown when Ore API is called incorrectly (e.g. outside setup, duplicate define, invalid prop). */\nexport class OreApiError extends OreError {}\n\n/**\n * Thrown when an internal invariant fails — e.g. compiled template metadata no\n * longer matching the DOM it was cloned from. Distinct from `OreApiError`: this\n * is never the caller's fault, it signals a bug in ore itself. See `invariant()`.\n */\nexport class OreInternalError extends OreError {}\n\n/**\n * The phase in which a component error occurred.\n * - `'setup'` — synchronous setup() threw\n * - `'mounted'` — an onMounted callback threw\n * - `'form-reset'` — an onFormReset callback threw\n * - `'each-reconcile'` — `each()` failed to reconcile a list update (e.g. duplicate keys)\n */\nexport type OreErrorPhase = 'each-reconcile' | 'form-reset' | 'mounted' | 'setup';\n\n/**\n * Structured error thrown by the Ore runtime when component setup fails.\n * Provides component name and original cause for debugging.\n */\nexport class OreLifecycleError extends OreError {\n readonly component: string;\n readonly phase: OreErrorPhase;\n\n constructor(message: string, options: { cause: Error; component: string; phase: OreErrorPhase }) {\n super(message, { cause: options.cause });\n this.component = options.component;\n this.phase = options.phase;\n }\n}\n\n/**\n * Report a runtime error via the ore:error event and console.\n *\n * `target` only needs to be an `EventTarget` (not specifically an `HTMLElement`) — component\n * lifecycle errors dispatch on the host element, but non-lifecycle failures (e.g. `each()`\n * reconciliation, which has no single \"component\" to attribute the error to) dispatch on\n * whatever live DOM node is available, such as the directive's own anchor `Comment`. Either way\n * the event still bubbles and crosses shadow boundaries (`composed: true`), so a listener on\n * `document`/`window` observes every report regardless of where it originated.\n *\n * The console log (via `_dev.ts`'s `error()`) is still dev-gated like the rest of the package's\n * console diagnostics, but the `ore:error` DOM event dispatch below is **not** — it fires in\n * every build, so consumers always have a way to observe runtime failures programmatically even\n * when console output is stripped in production.\n */\nexport function reportRuntimeError(error: OreLifecycleError, target: EventTarget): void {\n logError(`<${error.component}> lifecycle error (phase: ${error.phase}):`, error.cause);\n\n target.dispatchEvent(\n new CustomEvent('ore:error', {\n bubbles: true,\n composed: true,\n detail: error,\n }),\n );\n}\n\n// ─── Error message constants ─────────────────────────────────────────────────\n\nexport const ORE_ERRORS = {\n asyncSetupUnsupported: 'setup() must return an HTMLResult or null; use reactive state for asynchronous work',\n defineDuplicate: (tag: string): string => `define('${tag}') called twice — custom element already registered`,\n defineFieldRequiresFormAssociated: (tag: string): string =>\n `useField() requires define('${tag}', { formAssociated: true })`,\n defineRequiresTag: 'define() requires a tag name',\n eachDuplicateKey: (key: string, index: number): string => `each() received duplicate key \"${key}\" at index ${index}`,\n eventModifiersUnsupported: (eventName: string): string =>\n `@${eventName}: event modifiers are unsupported; call native event methods in the handler instead`,\n injectStrictFailed: (key: string, tag: string): string => `injectStrict() could not resolve key \"${key}\" in <${tag}>`,\n invariantViolated: (message: string): string => `invariant violated: ${message}`,\n lifecycleOutsideSetup: 'Lifecycle hooks must be called during component setup',\n listenNullTarget: (eventName: string): string =>\n `listen() called with a null/undefined target for event \"${eventName}\" — listener not attached`,\n propInvalidReflect: 'Structured props cannot use reflect:true — use prop.json() with reflect:false',\n templateInterpolationInTag:\n 'html`...`: interpolations inside a tag must be named attributes, boolean attributes, events, or refs',\n useFieldAlreadyCalled: (tag: string): string =>\n `useField() was already called on <${tag}>. Call it only once per component.`,\n validationFailed: (tag: string, errors: string[]): string => `Validation failed for <${tag}>:\\n${errors.join('\\n')}`,\n} as const;\n\n/**\n * Assert an internal invariant that must always hold — e.g. compiled template\n * metadata staying in sync with the DOM it was cloned from. A failed invariant\n * means a bug in ore itself, never user input, so it throws `OreInternalError`\n * unconditionally (every build, never gated like `_dev.ts`'s `warn()`).\n *\n * Narrowing caveat: `asserts condition` only narrows the exact expression\n * passed in. Assign to a local `const` first — `invariant(el.parentNode, msg)`\n * does not narrow later reads of `el.parentNode`.\n */\nexport function invariant(condition: unknown, message: string): asserts condition {\n if (!condition) throw new OreInternalError(ORE_ERRORS.invariantViolated(message));\n}\n"],"mappings":"sBAoBA,IAAa,EAAb,cAA8B,KAAM,CAClC,YAAY,EAAiB,EAAqB,CAChD,MAAM,EAAS,CAAI,EACnB,KAAK,KAAO,WAAW,KACvB,OAAO,eAAe,KAAM,WAAW,SAAS,CAClD,CACF,EAGa,EAAb,cAAiC,CAAS,CAAC,EAO9B,EAAb,cAAsC,CAAS,CAAC,EAenC,EAAb,cAAuC,CAAS,CAC9C,UACA,MAEA,YAAY,EAAiB,EAAoE,CAC/F,MAAM,EAAS,CAAE,MAAO,EAAQ,KAAM,CAAC,EACvC,KAAK,UAAY,EAAQ,UACzB,KAAK,MAAQ,EAAQ,KACvB,CACF,EAiBA,SAAgB,EAAmB,EAA0B,EAA2B,CAC7E,GAAI,EAAM,UAAV,EAAgD,EAAM,MAAtD,EAAiE,EAAM,MAEhF,EAAO,cACL,IAAI,YAAY,YAAa,CAC3B,QAAS,GACT,SAAU,GACV,OAAQ,CACV,CAAC,CACH,CACF,CAIA,IAAa,EAAa,CACxB,sBAAuB,sFACvB,gBAAkB,GAAwB,WAAW,EAAI,qDACzD,kCAAoC,GAClC,+BAA+B,EAAI,8BACrC,kBAAmB,+BACnB,kBAAmB,EAAa,IAA0B,kCAAkC,EAAI,aAAa,IAC7G,0BAA4B,GAC1B,IAAI,EAAU,qFAChB,oBAAqB,EAAa,IAAwB,yCAAyC,EAAI,QAAQ,EAAI,GACnH,kBAAoB,GAA4B,uBAAuB,IACvE,sBAAuB,wDACvB,iBAAmB,GACjB,2DAA2D,EAAU,2BACvE,mBAAoB,gFACpB,2BACE,uGACF,sBAAwB,GACtB,qCAAqC,EAAI,qCAC3C,kBAAmB,EAAa,IAA6B,0BAA0B,EAAI,MAAM,EAAO,KAAK;CAAI,GACnH,EAYA,SAAgB,EAAU,EAAoB,EAAoC,CAChF,GAAI,CAAC,EAAW,MAAM,IAAI,EAAiB,EAAW,kBAAkB,CAAO,CAAC,CAClF"}
package/dist/errors.d.ts CHANGED
@@ -49,9 +49,6 @@ export declare class OreLifecycleError extends OreError {
49
49
  * when console output is stripped in production.
50
50
  */
51
51
  export declare function reportRuntimeError(error: OreLifecycleError, target: EventTarget): void;
52
- /** Thrown by `flush()` in the testing sub-path when pending component work doesn't settle within the timeout. */
53
- export declare class OreTimeoutError extends OreError {
54
- }
55
52
  export declare const ORE_ERRORS: {
56
53
  readonly asyncSetupUnsupported: "setup() must return an HTMLResult or null; use reactive state for asynchronous work";
57
54
  readonly defineDuplicate: (tag: string) => string;
@@ -1 +1 @@
1
- {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAmBA,kGAAkG;AAClG,qBAAa,QAAS,SAAQ,KAAK;gBACrB,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,YAAY;CAKjD;AAED,sGAAsG;AACtG,qBAAa,WAAY,SAAQ,QAAQ;CAAG;AAE5C;;;;GAIG;AACH,qBAAa,gBAAiB,SAAQ,QAAQ;CAAG;AAEjD;;;;;;GAMG;AACH,MAAM,MAAM,aAAa,GAAG,gBAAgB,GAAG,YAAY,GAAG,SAAS,GAAG,OAAO,CAAC;AAElF;;;GAGG;AACH,qBAAa,iBAAkB,SAAQ,QAAQ;IAC7C,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAC;gBAElB,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE;QAAE,KAAK,EAAE,KAAK,CAAC;QAAC,SAAS,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,aAAa,CAAA;KAAE;CAKhG;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,iBAAiB,EAAE,MAAM,EAAE,WAAW,GAAG,IAAI,CAUtF;AAID,iHAAiH;AACjH,qBAAa,eAAgB,SAAQ,QAAQ;CAAG;AAEhD,eAAO,MAAM,UAAU;;oCAEE,MAAM,KAAG,MAAM;sDACG,MAAM,KAAG,MAAM;;qCAGhC,MAAM,SAAS,MAAM,KAAG,MAAM;oDACf,MAAM,KAAG,MAAM;uCAE5B,MAAM,OAAO,MAAM,KAAG,MAAM;0CACzB,MAAM,KAAG,MAAM;;2CAEd,MAAM,KAAG,MAAM;;;0CAKhB,MAAM,KAAG,MAAM;qCAEpB,MAAM,UAAU,MAAM,EAAE,KAAG,MAAM;CACjD,CAAC;AAEX;;;;;;;;;GASG;AACH,wBAAgB,SAAS,CAAC,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAEhF"}
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAmBA,kGAAkG;AAClG,qBAAa,QAAS,SAAQ,KAAK;gBACrB,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,YAAY;CAKjD;AAED,sGAAsG;AACtG,qBAAa,WAAY,SAAQ,QAAQ;CAAG;AAE5C;;;;GAIG;AACH,qBAAa,gBAAiB,SAAQ,QAAQ;CAAG;AAEjD;;;;;;GAMG;AACH,MAAM,MAAM,aAAa,GAAG,gBAAgB,GAAG,YAAY,GAAG,SAAS,GAAG,OAAO,CAAC;AAElF;;;GAGG;AACH,qBAAa,iBAAkB,SAAQ,QAAQ;IAC7C,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAC;gBAElB,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE;QAAE,KAAK,EAAE,KAAK,CAAC;QAAC,SAAS,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,aAAa,CAAA;KAAE;CAKhG;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,iBAAiB,EAAE,MAAM,EAAE,WAAW,GAAG,IAAI,CAUtF;AAID,eAAO,MAAM,UAAU;;oCAEE,MAAM,KAAG,MAAM;sDACG,MAAM,KAAG,MAAM;;qCAGhC,MAAM,SAAS,MAAM,KAAG,MAAM;oDACf,MAAM,KAAG,MAAM;uCAE5B,MAAM,OAAO,MAAM,KAAG,MAAM;0CACzB,MAAM,KAAG,MAAM;;2CAEd,MAAM,KAAG,MAAM;;;0CAKhB,MAAM,KAAG,MAAM;qCAEpB,MAAM,UAAU,MAAM,EAAE,KAAG,MAAM;CACjD,CAAC;AAEX;;;;;;;;;GASG;AACH,wBAAgB,SAAS,CAAC,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAEhF"}
package/dist/errors.js CHANGED
@@ -1,3 +1,3 @@
1
- import"./_dev.js";var e=class extends Error{constructor(e,t){super(e,t),this.name=new.target.name,Object.setPrototypeOf(this,new.target.prototype)}},t=class extends e{},n=class extends e{},r=class extends e{component;phase;constructor(e,t){super(e,{cause:t.cause}),this.component=t.component,this.phase=t.phase}};function i(e,t){`${e.component}${e.phase}`,e.cause,t.dispatchEvent(new CustomEvent(`ore:error`,{bubbles:!0,composed:!0,detail:e}))}var a=class extends e{},o={asyncSetupUnsupported:`setup() must return an HTMLResult or null; use reactive state for asynchronous work`,defineDuplicate:e=>`define('${e}') called twice — custom element already registered`,defineFieldRequiresFormAssociated:e=>`useField() requires define('${e}', { formAssociated: true })`,defineRequiresTag:`define() requires a tag name`,eachDuplicateKey:(e,t)=>`each() received duplicate key "${e}" at index ${t}`,eventModifiersUnsupported:e=>`@${e}: event modifiers are unsupported; call native event methods in the handler instead`,injectStrictFailed:(e,t)=>`injectStrict() could not resolve key "${e}" in <${t}>`,invariantViolated:e=>`invariant violated: ${e}`,lifecycleOutsideSetup:`Lifecycle hooks must be called during component setup`,listenNullTarget:e=>`listen() called with a null/undefined target for event "${e}" — listener not attached`,propInvalidReflect:`Structured props cannot use reflect:true — use prop.json() with reflect:false`,templateInterpolationInTag:"html`...`: interpolations inside a tag must be named attributes, boolean attributes, events, or refs",useFieldAlreadyCalled:e=>`useField() was already called on <${e}>. Call it only once per component.`,validationFailed:(e,t)=>`Validation failed for <${e}>:\n${t.join(`
2
- `)}`};function s(e,t){if(!e)throw new n(o.invariantViolated(t))}export{o as ORE_ERRORS,t as OreApiError,e as OreError,n as OreInternalError,r as OreLifecycleError,a as OreTimeoutError,s as invariant,i as reportRuntimeError};
1
+ import"./_dev.js";var e=class extends Error{constructor(e,t){super(e,t),this.name=new.target.name,Object.setPrototypeOf(this,new.target.prototype)}},t=class extends e{},n=class extends e{},r=class extends e{component;phase;constructor(e,t){super(e,{cause:t.cause}),this.component=t.component,this.phase=t.phase}};function i(e,t){`${e.component}${e.phase}`,e.cause,t.dispatchEvent(new CustomEvent(`ore:error`,{bubbles:!0,composed:!0,detail:e}))}var a={asyncSetupUnsupported:`setup() must return an HTMLResult or null; use reactive state for asynchronous work`,defineDuplicate:e=>`define('${e}') called twice — custom element already registered`,defineFieldRequiresFormAssociated:e=>`useField() requires define('${e}', { formAssociated: true })`,defineRequiresTag:`define() requires a tag name`,eachDuplicateKey:(e,t)=>`each() received duplicate key "${e}" at index ${t}`,eventModifiersUnsupported:e=>`@${e}: event modifiers are unsupported; call native event methods in the handler instead`,injectStrictFailed:(e,t)=>`injectStrict() could not resolve key "${e}" in <${t}>`,invariantViolated:e=>`invariant violated: ${e}`,lifecycleOutsideSetup:`Lifecycle hooks must be called during component setup`,listenNullTarget:e=>`listen() called with a null/undefined target for event "${e}" — listener not attached`,propInvalidReflect:`Structured props cannot use reflect:true — use prop.json() with reflect:false`,templateInterpolationInTag:"html`...`: interpolations inside a tag must be named attributes, boolean attributes, events, or refs",useFieldAlreadyCalled:e=>`useField() was already called on <${e}>. Call it only once per component.`,validationFailed:(e,t)=>`Validation failed for <${e}>:\n${t.join(`
2
+ `)}`};function o(e,t){if(!e)throw new n(a.invariantViolated(t))}export{a as ORE_ERRORS,t as OreApiError,e as OreError,n as OreInternalError,r as OreLifecycleError,o as invariant,i as reportRuntimeError};
3
3
  //# sourceMappingURL=errors.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"errors.js","names":[],"sources":["../src/errors.ts"],"sourcesContent":["import { error as logError } from './_dev';\n\n// ─── Error policy ─────────────────────────────────────────────────────────────\n// One rule for the whole package — decide by whose code failed and whether it\n// can continue, never ad hoc per call site:\n//\n// API misuse (wrong arguments, hook outside setup, duplicate define)\n// → throw `OreApiError`, immediately, every build.\n// User-authored code failing inside ore's execution (setup, onMounted,\n// onFormReset, each() reconciliation)\n// → wrap in `OreLifecycleError` and report via `reportRuntimeError()`\n// (`ore:error` DOM event + dev console) so other callbacks keep running.\n// Recoverable oddity (overwrite warnings, blocked attribute writes)\n// → dev `warn()`/`error()` and continue. Never swallow silently.\n// Internal impossibility (compiled template metadata out of sync)\n// → `invariant()` throws `OreInternalError`, every build.\n\n// ─── Structured error types ───────────────────────────────────────────────────\n\n/** Base class for all Ore errors. Use `instanceof OreError` to catch any Ore-originated error. */\nexport class OreError extends Error {\n constructor(message: string, opts?: ErrorOptions) {\n super(message, opts);\n this.name = new.target.name;\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\n/** Thrown when Ore API is called incorrectly (e.g. outside setup, duplicate define, invalid prop). */\nexport class OreApiError extends OreError {}\n\n/**\n * Thrown when an internal invariant fails — e.g. compiled template metadata no\n * longer matching the DOM it was cloned from. Distinct from `OreApiError`: this\n * is never the caller's fault, it signals a bug in ore itself. See `invariant()`.\n */\nexport class OreInternalError extends OreError {}\n\n/**\n * The phase in which a component error occurred.\n * - `'setup'` — synchronous setup() threw\n * - `'mounted'` — an onMounted callback threw\n * - `'form-reset'` — an onFormReset callback threw\n * - `'each-reconcile'` — `each()` failed to reconcile a list update (e.g. duplicate keys)\n */\nexport type OreErrorPhase = 'each-reconcile' | 'form-reset' | 'mounted' | 'setup';\n\n/**\n * Structured error thrown by the Ore runtime when component setup fails.\n * Provides component name and original cause for debugging.\n */\nexport class OreLifecycleError extends OreError {\n readonly component: string;\n readonly phase: OreErrorPhase;\n\n constructor(message: string, options: { cause: Error; component: string; phase: OreErrorPhase }) {\n super(message, { cause: options.cause });\n this.component = options.component;\n this.phase = options.phase;\n }\n}\n\n/**\n * Report a runtime error via the ore:error event and console.\n *\n * `target` only needs to be an `EventTarget` (not specifically an `HTMLElement`) — component\n * lifecycle errors dispatch on the host element, but non-lifecycle failures (e.g. `each()`\n * reconciliation, which has no single \"component\" to attribute the error to) dispatch on\n * whatever live DOM node is available, such as the directive's own anchor `Comment`. Either way\n * the event still bubbles and crosses shadow boundaries (`composed: true`), so a listener on\n * `document`/`window` observes every report regardless of where it originated.\n *\n * The console log (via `_dev.ts`'s `error()`) is still dev-gated like the rest of the package's\n * console diagnostics, but the `ore:error` DOM event dispatch below is **not** — it fires in\n * every build, so consumers always have a way to observe runtime failures programmatically even\n * when console output is stripped in production.\n */\nexport function reportRuntimeError(error: OreLifecycleError, target: EventTarget): void {\n logError(`<${error.component}> lifecycle error (phase: ${error.phase}):`, error.cause);\n\n target.dispatchEvent(\n new CustomEvent('ore:error', {\n bubbles: true,\n composed: true,\n detail: error,\n }),\n );\n}\n\n// ─── Error message constants ─────────────────────────────────────────────────\n\n/** Thrown by `flush()` in the testing sub-path when pending component work doesn't settle within the timeout. */\nexport class OreTimeoutError extends OreError {}\n\nexport const ORE_ERRORS = {\n asyncSetupUnsupported: 'setup() must return an HTMLResult or null; use reactive state for asynchronous work',\n defineDuplicate: (tag: string): string => `define('${tag}') called twice — custom element already registered`,\n defineFieldRequiresFormAssociated: (tag: string): string =>\n `useField() requires define('${tag}', { formAssociated: true })`,\n defineRequiresTag: 'define() requires a tag name',\n eachDuplicateKey: (key: string, index: number): string => `each() received duplicate key \"${key}\" at index ${index}`,\n eventModifiersUnsupported: (eventName: string): string =>\n `@${eventName}: event modifiers are unsupported; call native event methods in the handler instead`,\n injectStrictFailed: (key: string, tag: string): string => `injectStrict() could not resolve key \"${key}\" in <${tag}>`,\n invariantViolated: (message: string): string => `invariant violated: ${message}`,\n lifecycleOutsideSetup: 'Lifecycle hooks must be called during component setup',\n listenNullTarget: (eventName: string): string =>\n `listen() called with a null/undefined target for event \"${eventName}\" — listener not attached`,\n propInvalidReflect: 'Structured props cannot use reflect:true — use prop.json() with reflect:false',\n templateInterpolationInTag:\n 'html`...`: interpolations inside a tag must be named attributes, boolean attributes, events, or refs',\n useFieldAlreadyCalled: (tag: string): string =>\n `useField() was already called on <${tag}>. Call it only once per component.`,\n validationFailed: (tag: string, errors: string[]): string => `Validation failed for <${tag}>:\\n${errors.join('\\n')}`,\n} as const;\n\n/**\n * Assert an internal invariant that must always hold — e.g. compiled template\n * metadata staying in sync with the DOM it was cloned from. A failed invariant\n * means a bug in ore itself, never user input, so it throws `OreInternalError`\n * unconditionally (every build, never gated like `_dev.ts`'s `warn()`).\n *\n * Narrowing caveat: `asserts condition` only narrows the exact expression\n * passed in. Assign to a local `const` first — `invariant(el.parentNode, msg)`\n * does not narrow later reads of `el.parentNode`.\n */\nexport function invariant(condition: unknown, message: string): asserts condition {\n if (!condition) throw new OreInternalError(ORE_ERRORS.invariantViolated(message));\n}\n"],"mappings":"kBAoBA,IAAa,EAAb,cAA8B,KAAM,CAClC,YAAY,EAAiB,EAAqB,CAChD,MAAM,EAAS,CAAI,EACnB,KAAK,KAAO,WAAW,KACvB,OAAO,eAAe,KAAM,WAAW,SAAS,CAClD,CACF,EAGa,EAAb,cAAiC,CAAS,CAAC,EAO9B,EAAb,cAAsC,CAAS,CAAC,EAenC,EAAb,cAAuC,CAAS,CAC9C,UACA,MAEA,YAAY,EAAiB,EAAoE,CAC/F,MAAM,EAAS,CAAE,MAAO,EAAQ,KAAM,CAAC,EACvC,KAAK,UAAY,EAAQ,UACzB,KAAK,MAAQ,EAAQ,KACvB,CACF,EAiBA,SAAgB,EAAmB,EAA0B,EAA2B,CAC7E,GAAI,EAAM,UAAV,EAAgD,EAAM,MAAtD,EAAiE,EAAM,MAEhF,EAAO,cACL,IAAI,YAAY,YAAa,CAC3B,QAAS,GACT,SAAU,GACV,OAAQ,CACV,CAAC,CACH,CACF,CAKA,IAAa,EAAb,cAAqC,CAAS,CAAC,EAElC,EAAa,CACxB,sBAAuB,sFACvB,gBAAkB,GAAwB,WAAW,EAAI,qDACzD,kCAAoC,GAClC,+BAA+B,EAAI,8BACrC,kBAAmB,+BACnB,kBAAmB,EAAa,IAA0B,kCAAkC,EAAI,aAAa,IAC7G,0BAA4B,GAC1B,IAAI,EAAU,qFAChB,oBAAqB,EAAa,IAAwB,yCAAyC,EAAI,QAAQ,EAAI,GACnH,kBAAoB,GAA4B,uBAAuB,IACvE,sBAAuB,wDACvB,iBAAmB,GACjB,2DAA2D,EAAU,2BACvE,mBAAoB,gFACpB,2BACE,uGACF,sBAAwB,GACtB,qCAAqC,EAAI,qCAC3C,kBAAmB,EAAa,IAA6B,0BAA0B,EAAI,MAAM,EAAO,KAAK;CAAI,GACnH,EAYA,SAAgB,EAAU,EAAoB,EAAoC,CAChF,GAAI,CAAC,EAAW,MAAM,IAAI,EAAiB,EAAW,kBAAkB,CAAO,CAAC,CAClF"}
1
+ {"version":3,"file":"errors.js","names":[],"sources":["../src/errors.ts"],"sourcesContent":["import { error as logError } from './_dev';\n\n// ─── Error policy ─────────────────────────────────────────────────────────────\n// One rule for the whole package — decide by whose code failed and whether it\n// can continue, never ad hoc per call site:\n//\n// API misuse (wrong arguments, hook outside setup, duplicate define)\n// → throw `OreApiError`, immediately, every build.\n// User-authored code failing inside ore's execution (setup, onMounted,\n// onFormReset, each() reconciliation)\n// → wrap in `OreLifecycleError` and report via `reportRuntimeError()`\n// (`ore:error` DOM event + dev console) so other callbacks keep running.\n// Recoverable oddity (overwrite warnings, blocked attribute writes)\n// → dev `warn()`/`error()` and continue. Never swallow silently.\n// Internal impossibility (compiled template metadata out of sync)\n// → `invariant()` throws `OreInternalError`, every build.\n\n// ─── Structured error types ───────────────────────────────────────────────────\n\n/** Base class for all Ore errors. Use `instanceof OreError` to catch any Ore-originated error. */\nexport class OreError extends Error {\n constructor(message: string, opts?: ErrorOptions) {\n super(message, opts);\n this.name = new.target.name;\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\n/** Thrown when Ore API is called incorrectly (e.g. outside setup, duplicate define, invalid prop). */\nexport class OreApiError extends OreError {}\n\n/**\n * Thrown when an internal invariant fails — e.g. compiled template metadata no\n * longer matching the DOM it was cloned from. Distinct from `OreApiError`: this\n * is never the caller's fault, it signals a bug in ore itself. See `invariant()`.\n */\nexport class OreInternalError extends OreError {}\n\n/**\n * The phase in which a component error occurred.\n * - `'setup'` — synchronous setup() threw\n * - `'mounted'` — an onMounted callback threw\n * - `'form-reset'` — an onFormReset callback threw\n * - `'each-reconcile'` — `each()` failed to reconcile a list update (e.g. duplicate keys)\n */\nexport type OreErrorPhase = 'each-reconcile' | 'form-reset' | 'mounted' | 'setup';\n\n/**\n * Structured error thrown by the Ore runtime when component setup fails.\n * Provides component name and original cause for debugging.\n */\nexport class OreLifecycleError extends OreError {\n readonly component: string;\n readonly phase: OreErrorPhase;\n\n constructor(message: string, options: { cause: Error; component: string; phase: OreErrorPhase }) {\n super(message, { cause: options.cause });\n this.component = options.component;\n this.phase = options.phase;\n }\n}\n\n/**\n * Report a runtime error via the ore:error event and console.\n *\n * `target` only needs to be an `EventTarget` (not specifically an `HTMLElement`) — component\n * lifecycle errors dispatch on the host element, but non-lifecycle failures (e.g. `each()`\n * reconciliation, which has no single \"component\" to attribute the error to) dispatch on\n * whatever live DOM node is available, such as the directive's own anchor `Comment`. Either way\n * the event still bubbles and crosses shadow boundaries (`composed: true`), so a listener on\n * `document`/`window` observes every report regardless of where it originated.\n *\n * The console log (via `_dev.ts`'s `error()`) is still dev-gated like the rest of the package's\n * console diagnostics, but the `ore:error` DOM event dispatch below is **not** — it fires in\n * every build, so consumers always have a way to observe runtime failures programmatically even\n * when console output is stripped in production.\n */\nexport function reportRuntimeError(error: OreLifecycleError, target: EventTarget): void {\n logError(`<${error.component}> lifecycle error (phase: ${error.phase}):`, error.cause);\n\n target.dispatchEvent(\n new CustomEvent('ore:error', {\n bubbles: true,\n composed: true,\n detail: error,\n }),\n );\n}\n\n// ─── Error message constants ─────────────────────────────────────────────────\n\nexport const ORE_ERRORS = {\n asyncSetupUnsupported: 'setup() must return an HTMLResult or null; use reactive state for asynchronous work',\n defineDuplicate: (tag: string): string => `define('${tag}') called twice — custom element already registered`,\n defineFieldRequiresFormAssociated: (tag: string): string =>\n `useField() requires define('${tag}', { formAssociated: true })`,\n defineRequiresTag: 'define() requires a tag name',\n eachDuplicateKey: (key: string, index: number): string => `each() received duplicate key \"${key}\" at index ${index}`,\n eventModifiersUnsupported: (eventName: string): string =>\n `@${eventName}: event modifiers are unsupported; call native event methods in the handler instead`,\n injectStrictFailed: (key: string, tag: string): string => `injectStrict() could not resolve key \"${key}\" in <${tag}>`,\n invariantViolated: (message: string): string => `invariant violated: ${message}`,\n lifecycleOutsideSetup: 'Lifecycle hooks must be called during component setup',\n listenNullTarget: (eventName: string): string =>\n `listen() called with a null/undefined target for event \"${eventName}\" — listener not attached`,\n propInvalidReflect: 'Structured props cannot use reflect:true — use prop.json() with reflect:false',\n templateInterpolationInTag:\n 'html`...`: interpolations inside a tag must be named attributes, boolean attributes, events, or refs',\n useFieldAlreadyCalled: (tag: string): string =>\n `useField() was already called on <${tag}>. Call it only once per component.`,\n validationFailed: (tag: string, errors: string[]): string => `Validation failed for <${tag}>:\\n${errors.join('\\n')}`,\n} as const;\n\n/**\n * Assert an internal invariant that must always hold — e.g. compiled template\n * metadata staying in sync with the DOM it was cloned from. A failed invariant\n * means a bug in ore itself, never user input, so it throws `OreInternalError`\n * unconditionally (every build, never gated like `_dev.ts`'s `warn()`).\n *\n * Narrowing caveat: `asserts condition` only narrows the exact expression\n * passed in. Assign to a local `const` first — `invariant(el.parentNode, msg)`\n * does not narrow later reads of `el.parentNode`.\n */\nexport function invariant(condition: unknown, message: string): asserts condition {\n if (!condition) throw new OreInternalError(ORE_ERRORS.invariantViolated(message));\n}\n"],"mappings":"kBAoBA,IAAa,EAAb,cAA8B,KAAM,CAClC,YAAY,EAAiB,EAAqB,CAChD,MAAM,EAAS,CAAI,EACnB,KAAK,KAAO,WAAW,KACvB,OAAO,eAAe,KAAM,WAAW,SAAS,CAClD,CACF,EAGa,EAAb,cAAiC,CAAS,CAAC,EAO9B,EAAb,cAAsC,CAAS,CAAC,EAenC,EAAb,cAAuC,CAAS,CAC9C,UACA,MAEA,YAAY,EAAiB,EAAoE,CAC/F,MAAM,EAAS,CAAE,MAAO,EAAQ,KAAM,CAAC,EACvC,KAAK,UAAY,EAAQ,UACzB,KAAK,MAAQ,EAAQ,KACvB,CACF,EAiBA,SAAgB,EAAmB,EAA0B,EAA2B,CAC7E,GAAI,EAAM,UAAV,EAAgD,EAAM,MAAtD,EAAiE,EAAM,MAEhF,EAAO,cACL,IAAI,YAAY,YAAa,CAC3B,QAAS,GACT,SAAU,GACV,OAAQ,CACV,CAAC,CACH,CACF,CAIA,IAAa,EAAa,CACxB,sBAAuB,sFACvB,gBAAkB,GAAwB,WAAW,EAAI,qDACzD,kCAAoC,GAClC,+BAA+B,EAAI,8BACrC,kBAAmB,+BACnB,kBAAmB,EAAa,IAA0B,kCAAkC,EAAI,aAAa,IAC7G,0BAA4B,GAC1B,IAAI,EAAU,qFAChB,oBAAqB,EAAa,IAAwB,yCAAyC,EAAI,QAAQ,EAAI,GACnH,kBAAoB,GAA4B,uBAAuB,IACvE,sBAAuB,wDACvB,iBAAmB,GACjB,2DAA2D,EAAU,2BACvE,mBAAoB,gFACpB,2BACE,uGACF,sBAAwB,GACtB,qCAAqC,EAAI,qCAC3C,kBAAmB,EAAa,IAA6B,0BAA0B,EAAI,MAAM,EAAO,KAAK;CAAI,GACnH,EAYA,SAAgB,EAAU,EAAoB,EAAoC,CAChF,GAAI,CAAC,EAAW,MAAM,IAAI,EAAiB,EAAW,kBAAkB,CAAO,CAAC,CAClF"}
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  export type { ComponentDefinition } from './component-types';
2
2
  export { createContext, type InjectionKey, inject, injectStrict, provide } from './context';
3
- export { define, prop } from './define';
3
+ export { define } from './define';
4
4
  export { classMap } from './directives/classMap';
5
5
  export { each } from './directives/each';
6
6
  export { type LiveBinding, live } from './directives/live';
@@ -11,6 +11,7 @@ export { OreApiError, OreError, type OreErrorPhase, OreInternalError, OreLifecyc
11
11
  export { type FormFieldHandle, type FormFieldOptions, useField } from './forms/field';
12
12
  export { type BindOptions, bind, type HostBindConfig, type HostBindFn, type HostBindingValue, type ReflectConfig, } from './host-bind';
13
13
  export type { InferProps, PropDef, PropInputDefs, PropsDef } from './props';
14
+ export { prop } from './props';
14
15
  export { getHost, type OnFormResetCallback, type OnMountedCallback, onCleanup, onElement, onEvent, onFormReset, onMounted, watchEffect, } from './runtime';
15
16
  export { type ComponentSlots, useSlots } from './slots';
16
17
  export { html } from './template/instantiator';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,KAAK,YAAY,EAAE,MAAM,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC5F,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAOxC,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,KAAK,WAAW,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,KAAK,aAAa,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAC1G,OAAO,EAAE,KAAK,eAAe,EAAE,KAAK,gBAAgB,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACtF,OAAO,EACL,KAAK,WAAW,EAChB,IAAI,EACJ,KAAK,cAAc,EACnB,KAAK,UAAU,EACf,KAAK,gBAAgB,EACrB,KAAK,aAAa,GACnB,MAAM,aAAa,CAAC;AACrB,YAAY,EAAE,UAAU,EAAE,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAE5E,OAAO,EACL,OAAO,EACP,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACtB,SAAS,EACT,SAAS,EACT,OAAO,EACP,WAAW,EACX,SAAS,EACT,WAAW,GACZ,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,KAAK,cAAc,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACxD,OAAO,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAC/C,OAAO,EAAE,KAAK,UAAU,EAAE,KAAK,GAAG,EAAE,KAAK,WAAW,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AACrF,OAAO,EAAE,KAAK,SAAS,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,KAAK,MAAM,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEpD,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,KAAK,YAAY,EAAE,MAAM,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC5F,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAOlC,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,KAAK,WAAW,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,KAAK,aAAa,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAC1G,OAAO,EAAE,KAAK,eAAe,EAAE,KAAK,gBAAgB,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACtF,OAAO,EACL,KAAK,WAAW,EAChB,IAAI,EACJ,KAAK,cAAc,EACnB,KAAK,UAAU,EACf,KAAK,gBAAgB,EACrB,KAAK,aAAa,GACnB,MAAM,aAAa,CAAC;AACrB,YAAY,EAAE,UAAU,EAAE,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC5E,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAE/B,OAAO,EACL,OAAO,EACP,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACtB,SAAS,EACT,SAAS,EACT,OAAO,EACP,WAAW,EACX,SAAS,EACT,WAAW,GACZ,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,KAAK,cAAc,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACxD,OAAO,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAC/C,OAAO,EAAE,KAAK,UAAU,EAAE,KAAK,GAAG,EAAE,KAAK,WAAW,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AACrF,OAAO,EAAE,KAAK,SAAS,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,KAAK,MAAM,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEpD,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC"}
package/dist/ore.cjs CHANGED
@@ -1,3 +1,3 @@
1
1
  Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require("@vielzeug/ripple");var t=class extends Error{constructor(e,t){super(e,t),this.name=new.target.name,Object.setPrototypeOf(this,new.target.prototype)}},n=class extends t{},r=class extends t{},i=class extends t{component;phase;constructor(e,t){super(e,{cause:t.cause}),this.component=t.component,this.phase=t.phase}};function a(e,t){`${e.component}${e.phase}`,e.cause,t.dispatchEvent(new CustomEvent(`ore:error`,{bubbles:!0,composed:!0,detail:e}))}var o={asyncSetupUnsupported:`setup() must return an HTMLResult or null; use reactive state for asynchronous work`,defineDuplicate:e=>`define('${e}') called twice — custom element already registered`,defineFieldRequiresFormAssociated:e=>`useField() requires define('${e}', { formAssociated: true })`,defineRequiresTag:`define() requires a tag name`,eachDuplicateKey:(e,t)=>`each() received duplicate key "${e}" at index ${t}`,eventModifiersUnsupported:e=>`@${e}: event modifiers are unsupported; call native event methods in the handler instead`,injectStrictFailed:(e,t)=>`injectStrict() could not resolve key "${e}" in <${t}>`,invariantViolated:e=>`invariant violated: ${e}`,lifecycleOutsideSetup:`Lifecycle hooks must be called during component setup`,listenNullTarget:e=>`listen() called with a null/undefined target for event "${e}" — listener not attached`,propInvalidReflect:`Structured props cannot use reflect:true — use prop.json() with reflect:false`,templateInterpolationInTag:"html`...`: interpolations inside a tag must be named attributes, boolean attributes, events, or refs",useFieldAlreadyCalled:e=>`useField() was already called on <${e}>. Call it only once per component.`,validationFailed:(e,t)=>`Validation failed for <${e}>:\n${t.join(`
2
- `)}`};function s(e,t){if(!e)throw new r(o.invariantViolated(t))}var c=t=>typeof t==`function`?t():(0,e.isReactive)(t)?t.value:t,l=/[;{}]/g,u=e=>e.replace(l,``),d=e=>{for(let t=e.length-1;t>=0;t--)e[t]?.()},f=e=>{for(let t of e)t.remove()},p=()=>{let e=[],t=[];return{clear(){d(t),f(e),t=[],e=[]},get nodes(){return e},registerCleanup(e){t.push(e)},setNodes(t){e=t}}},m=new Set([`action`,`cite`,`codebase`,`data`,`formaction`,`href`,`manifest`,`ping`,`poster`,`src`,`xlink:href`]),h=/^\s*(?:(?:javascript|vbscript|blob):|data:(?:[^,]*\/(?:html|svg\+xml)|application\/(?:xhtml|xml)))/i,g=(e,t,n)=>{let r=t.toLowerCase();if(/^on[a-z]/i.test(t)){`${t}${t.slice(2)}`,e.removeAttribute(t);return}if(r===`srcdoc`){e.removeAttribute(t);return}if(n==null||n===!1){e.removeAttribute(t);return}let i=n===!0?`true`:String(n);if(m.has(r)&&h.test(i)){`${t}`,e.removeAttribute(t);return}e.setAttribute(t,i)},_=(e,t,n,r)=>{if(!e)return o.listenNullTarget(t),()=>{};let i=n;return e.addEventListener(t,i,r),()=>e.removeEventListener(t,i,r)},v=e=>e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`),y=e=>Array.isArray(e)||typeof e==`object`&&!!e,b=null,x=e=>({element:e,formResetCallbacks:[],mountCallbacks:[]}),ee=0,te=()=>{ee++;let e=!1;return()=>{e||(e=!0,ee--)}},S=(e,t)=>{let n=b;b=e;try{return t()}finally{b=n}},C=e=>{if(b)return b;throw new n(`${e}: ${o.lifecycleOutsideSetup}`)},w=()=>C(`getHost`).element,T=t=>b?((0,e.effect)(()=>t),!0):!1,E=e=>{if(!T(e))throw new n(`onCleanup: ${o.lifecycleOutsideSetup}`)},D=e=>{C(`onMounted`).mountCallbacks.push(e)},O=e=>{C(`onFormReset`).formResetCallbacks.push(e)},k=t=>{let n=(0,e.effect)(t),r=()=>n.dispose();return T(r),r};function ne(e,t,n,r){if(C(`onEvent`),!e)return;let i=_(e,t,n,r);T(i)||i()}var re=(e,t)=>k(()=>{let n=e.value;if(n)return t(n)}),A=new WeakMap,ie=e=>{let t=[],n=e;for(;n;)n instanceof HTMLElement&&t.push(n),n=n.parentNode??(n instanceof ShadowRoot?n.host:null);return t},ae=(e,t,n)=>{let r=A.get(e)??new Map;r.has(t)&&`${e.localName}`,r.set(t,n),A.set(e,r)},oe=(e,t)=>{let n=C(`provide`).element;ae(n,e,t),E(()=>{let t=A.get(n);t&&(t.delete(e),t.size===0&&A.delete(n))})},j=Symbol(`inject.not_found`),M=new WeakMap,se=(e,t)=>{let n=ie(e);for(let e of n){let n=A.get(e);if(n?.has(t))return n.get(t)}return j},N=(e,t)=>{let n=M.get(e);n||(n=new Map,M.set(e,n));let r=t;return n.has(r)||n.set(r,se(e.element,t)),n.get(r)};function ce(e,...t){let n=N(C(`inject`),e);return n===j?t.length>0?t[0]:void 0:n}var le=e=>{let t=C(`injectStrict`),r=N(t,e);if(r!==j)return r;throw new n(o.injectStrictFailed(String(e),t.element.localName))},ue=0;function de(e){return Symbol.for(`ore:context:${e??`anonymous-${++ue}`}`)}function fe(e){return{default:e,parse:()=>e,reflect:!1}}var pe={bool(e){return{default:e??!1,parse:e=>e!==null&&e!==`false`,reflect:!0}},data(e){return fe(e)},json(e){return{default:e,parse:t=>{if(t==null||t===``)return e;try{return JSON.parse(t)}catch{return e}},reflect:!1}},number(e){let t=e===void 0?void 0:e;return{default:t,parse:e=>{if(e==null)return t;let n=Number(e);return Number.isNaN(n)?(`${e}${String(t)}`,t):n},reflect:!0}},oneOf(e,t){return{default:t,parse:n=>n!=null&&e.includes(n)?n:t,reflect:!0}},string(e){let t=e===void 0?void 0:e;return{default:t,parse:e=>e??t,reflect:!0}}},me=e=>typeof e==`object`&&!!e&&`default`in e&&`parse`in e;function P(e,t){if(!me(e))throw new n(`Prop "${t}" must use a prop.* helper (string/number/bool/json/oneOf). Received: ${typeof e}`);let r=e;if(!r.parse)throw new n(`Prop "${t}" must have a parse function. Use prop.* helpers.`);let i=r.reflect??!1;if(i&&y(r.default))throw new n(`Prop "${t}": ${o.propInvalidReflect}`);return{...r,reflect:i}}function he(e){let t=[];for(let[n,r]of Object.entries(e))try{P(r,n)}catch(e){t.push(e instanceof Error?e.message:String(e))}return t}var F=new WeakMap,ge=(e,t)=>F.get(e)?.get(t),I=(e,t)=>typeof e==`string`?t(e):e,_e=(t,n,r,i)=>{let a=F.get(t);a||(a=new Map,F.set(t,a));let{default:o,parse:s,reflect:c=!1}=i,l=(0,e.signal)(o),u=a.get(r),d=Object.hasOwn(t,n),f=d?t[n]:void 0,p={parse:s,reflect:c,signal:l};return u?l.value=u.signal.peek():d?(delete t[n],l.value=I(f,s)):t.hasAttribute(r)&&(l.value=s(t.getAttribute(r))),a.set(r,p),Object.defineProperty(t,n,{configurable:!0,enumerable:!0,get:()=>l.value,set:e=>{l.value=I(e,s)}}),c&&k(()=>{let e=l.value;e==null?t.removeAttribute(r):typeof e==`boolean`?t.toggleAttribute(r,e):g(t,r,e)}),l};function ve(e,t){let n={};for(let[r,i]of Object.entries(t))n[r]=_e(e,r,v(r),i);return n}var L=e=>{let t=Symbol.for(e);return{is:e=>typeof e==`object`&&!!e&&t in e,stamp:e=>Object.assign(e,{[t]:!0})}},ye=L(`ore:css-result`),be=ye.is,xe=function(){return this.content},Se=(e,...t)=>{let n=``;for(let r=0;r<e.length;r++)if(n+=e[r],r<t.length){let e=t[r];n+=be(e)?e.content:String(e)}return ye.stamp({content:n.trim(),toString:xe})},R=new Map,Ce=256,we=e=>{if(e instanceof CSSStyleSheet)return e;let t=typeof e==`string`?e:e.content,n=R.get(t);if(n)return R.delete(t),R.set(t,n),n;let r=new CSSStyleSheet;try{r.replaceSync(t)}catch{return r}if(R.set(t,r),R.size>Ce){let e=R.keys().next().value;e!==void 0&&R.delete(e)}return r},z={SETUP_DONE:`setup_done`,SETUP_RUNNING:`setup_running`,UNINITIALIZED:`uninitialized`,UNMOUNTED:`unmounted`},Te={CONNECT:`ore:connect`,DISCONNECT:`ore:disconnect`},Ee=()=>({formResetCallbacks:[],generation:0,mountCallbacks:[],phase:z.UNINITIALIZED,scope:(0,e.createScope)(),templateResult:null}),De=e=>(typeof e==`object`||typeof e==`function`)&&e!==null&&`then`in e&&typeof e.then==`function`,Oe=class extends HTMLElement{static _definition;static _normalizedPropDefs;static formAssociated=!1;static observedAttributes=[];_component;constructor(){super();let e=this.constructor._definition;e?.shadow!==!1&&this.attachShadow({mode:`open`,...e?.shadow}),this._component=Ee()}connectedCallback(){(0,e.untrack)(()=>{this._component.phase===z.UNINITIALIZED&&this._runSetup(),this._init()}),this.dispatchEvent(new CustomEvent(Te.CONNECT,{bubbles:!1,composed:!1}))}attributeChangedCallback(t,n,r){if(n===r)return;let i=ge(this,t);if(!i)return;let a=i.parse(r);Object.is((0,e.untrack)(()=>i.signal.value),a)||(i.signal.value=a)}disconnectedCallback(){this._component.generation++,this._component.phase=z.UNMOUNTED,this.dispatchEvent(new CustomEvent(Te.DISCONNECT,{bubbles:!1,composed:!1})),this._resetSetupState()}_resetSetupState(){this._component.scope.dispose(),this._component.formResetCallbacks=[],this._component.mountCallbacks=[],this._component.phase=z.UNINITIALIZED,this._component.scope=(0,e.createScope)(),this._component.templateResult=null}formResetCallback(){for(let e of this._component.formResetCallbacks)try{e()}catch(e){this._reportLifecycleError(e,`form-reset`)}}_reportLifecycleError(e,t){let n=e instanceof Error?e:Error(String(e));a(new i(`<${this.localName}> failed during ${this._component.phase} (${t})`,{cause:n,component:this.localName,phase:t}),this)}_runSetup(){this._component.phase=z.SETUP_RUNNING;let e=this.constructor._definition,t=this.constructor._normalizedPropDefs,r=x(this);try{let i;if(this._component.scope.run(()=>{i=S(r,()=>{let n=t?ve(this,t):{};return e.setup(n)})}),this._component.mountCallbacks.push(...r.mountCallbacks),this._component.formResetCallbacks.push(...r.formResetCallbacks),De(i))throw new n(o.asyncSetupUnsupported);this._component.templateResult=i??null,this._component.phase=z.SETUP_DONE}catch(e){throw this._reportLifecycleError(e,`setup`),this._resetSetupState(),e}}_isStale(e){return this._component.generation!==e||!this.isConnected}_applyResult(e){if(!e)return;let t=this.shadowRoot??this,n=x(this);t.replaceChildren(),this._component.scope.run(()=>{S(n,()=>{e.mount(t,null,E)})})}_init(){this._applyStyles(),this._mountTemplate(),this._component.phase===z.SETUP_DONE&&this._scheduleMountCallbacks()}_applyStyles(){let e=this.constructor._definition;this.shadowRoot&&e?.styles?.length&&(this.shadowRoot.adoptedStyleSheets=e.styles.map(we))}_mountTemplate(){let e=this._component.templateResult;e&&this._applyResult(e)}_scheduleMountCallbacks(){if(this._component.mountCallbacks.length===0)return;let e=this._component.generation,t=te();queueMicrotask(()=>{try{if(this._isStale(e))return;let t=this._component.mountCallbacks.splice(0);for(let e=0;e<t.length;e++){let n=t[e];try{let e=x(this);this._component.scope.run(()=>{S(e,()=>{let e=n();typeof e==`function`&&E(e)})}),e.mountCallbacks.length>0&&t.push(...e.mountCallbacks),e.formResetCallbacks.length>0&&this._component.formResetCallbacks.push(...e.formResetCallbacks)}catch(e){this._reportLifecycleError(e,`mounted`)}}}finally{t()}})}};function ke(e,t){let{props:r}=t,i=(()=>{if(!r)return;let t=he(r);if(t.length>0)throw new n(o.validationFailed(e,t));let i={};for(let[e,t]of Object.entries(r))i[e]=P(t,e);return i})(),a=i?Object.keys(i).map(v):[];return class extends Oe{static _definition=t;static _normalizedPropDefs=i;static formAssociated=t.formAssociated??!1;static observedAttributes=a}}function Ae(e,t){if(!e)throw new n(o.defineRequiresTag);if(customElements.get(e))throw new n(o.defineDuplicate(e));let r=ke(e,t);Object.defineProperty(r,"name",{value:e}),customElements.define(e,r)}var je=t=>(0,e.computed)(()=>Object.entries(t).filter(([,e])=>c(e)).map(([e])=>e.replace(/\s+/g,``)).filter(Boolean).join(` `));function Me(){return(0,e.signal)(null)}var Ne=L(`ore:directive`),B=e=>Ne.stamp({mount:e}),Pe=Ne.is,V=L(`ore:html-result`),H=V.is;function Fe(e,t){return V.stamp({apply:t,fragment:e,mount:(n,r,i)=>{let a=Array.from(e.childNodes);return n.insertBefore(e,r),t(i),a}})}var Ie=(t,n,r,i,a)=>{let o=(0,e.signal)(t),s=(0,e.signal)(n),c=(0,e.createScope)(),l=[],u=[];return c.run(()=>{u=r(o,s).mount(i,a,e=>l.push(e))}),{cleanups:l,data:o,index:s,key:``,nodes:u,scope:c}},U=e=>{e.scope.dispose(),d(e.cleanups),f(e.nodes)},Le=(t,r,i,a,s,c)=>{let l=[],u=new Set;for(let e=0;e<r.length;e++){let t=String(i(r[e],e));if(u.has(t))throw new n(o.eachDuplicateKey(t,e));u.add(t),l.push(t)}for(let[e,n]of t)u.has(e)||(U(n),t.delete(e));let d=[];for(let n=0;n<r.length;n++){let i=l[n],o=t.get(i);if(o)(0,e.batch)(()=>{o.data.value=r[n],o.index.value=n}),d.push(o);else{let o=(0,e.untrack)(()=>Ie(r[n],n,a,s,c));o.key=i,t.set(i,o),d.push(o)}}let f=c;for(let e=d.length-1;e>=0;e--){let t=d[e],n=t.nodes[0];if(n&&n!==f.previousSibling)for(let e of t.nodes)s.insertBefore(e,f);f=n??f}return d};function Re(t,n,r,o){let c=Array.isArray(t)?(0,e.signal)(t):typeof t==`function`?(0,e.computed)(t):t;return B((t,l)=>{let u=t.parentNode;s(u,`each() anchor comment has no parent node`);let p=document.createComment(`each/end`);u.insertBefore(p,t.nextSibling);let m=new Map,h=[],g=null,_=[],v=()=>{o&&(g=o().mount(u,p,e=>_.push(e)))},y=()=>{g&&(d(_),f(g),g=null,_=[])},b=(0,e.effect)(()=>{let o=c.value??[];if(o.length===0){for(let t of(0,e.untrack)(()=>h))U(t);m=new Map,h=[],g||(0,e.untrack)(v);return}y();try{h=(0,e.untrack)(()=>Le(m,o,n,r,u,p))}catch(e){let n=e instanceof Error?e:Error(String(e));a(new i(`each() failed to reconcile a list update: ${n.message}`,{cause:n,component:`each()`,phase:`each-reconcile`}),t);for(let e of m.values())U(e);m=new Map,h=[]}});l(()=>b.dispose()),l(()=>{y();for(let e of h)U(e);p.remove()})})}var W=L(`ore:live`),ze=e=>W.stamp({source:e}),Be=W.is,Ve=e=>{let t=c(e);return t==null||t===!1?``:u(String(t))},He=t=>(0,e.computed)(()=>{let e=[];for(let[n,r]of Object.entries(t)){let t=Ve(r);if(!t)continue;let i=u(v(n));i&&e.push(`${i}:${t}`)}return e.join(`;`)}),G=(e,t,n)=>{let r=document.createElement(`template`);r.innerHTML=e;let i=Array.from(r.content.cloneNode(!0).childNodes);for(let e of i)t.insertBefore(e,n);return i};function K(t){if(typeof t==`function`){let n=(0,e.computed)(t);return B((e,t)=>{K(n).mount(e,t)})}return B((n,r)=>{let i=n.parentNode;s(i,`unsafeHtml() anchor comment has no parent node`);let a=document.createComment(`unsafe-html/end`);if(i.insertBefore(a,n.nextSibling),(0,e.isReactive)(t)){let n=p(),o=t,s=(0,e.effect)(()=>{n.clear(),n.setNodes(G(o.value,i,a))});r(()=>s.dispose()),r(()=>{n.clear(),a.remove()})}else G(t,i,a),r(()=>a.remove())})}var q=`when() anchor comment has no parent node`;function Ue(t,n,r){return typeof t!=`function`&&!(0,e.isReactive)(t)?B((e,i)=>{let a=t?n():r?r():null;if(!a||!H(a))return;let o=e.parentNode;s(o,q);let c=a.mount(o,e,i);i(()=>f(c))}):B((i,a)=>{let o=(typeof t==`function`?(0,e.computed)(t):null)??t,c=i.parentNode;s(c,q);let l=document.createComment(`when/end`);c.insertBefore(l,i.nextSibling);let u=p(),d=(0,e.effect)(()=>{let t=o.value;u.clear();let i=t?n():r?r():null;!i||!H(i)||u.setNodes((0,e.untrack)(()=>i.mount(c,l,u.registerCleanup)))});a(()=>d.dispose()),a(()=>{u.clear(),l.remove()})})}var J=new WeakMap,Y=new WeakSet,We=e=>{let t=e.el??w();if(!t.constructor.formAssociated)throw new n(o.defineFieldRequiresFormAssociated(t.localName));if(Y.has(t))throw new n(o.useFieldAlreadyCalled(t.localName));let r=J.get(t)??t.attachInternals();J.set(t,r),Y.add(t),E(()=>Y.delete(t));let i=e.toFormValue??(t=>t==null?e.emptyStringForNull?``:null:t instanceof File||t instanceof FormData?t:String(t));k(()=>{r.setFormValue(i(e.value.value))});let a=e.disabled;if(a&&`states`in r){let e=r.states;k(()=>{a.value?e.add(`disabled`):e.delete(`disabled`)})}return e.validity&&k(()=>{let t=e.validity?.value??{},n=Object.values(t).some(Boolean),i=e.validationMessage?.value??``;if(n&&!i){r.setValidity(t,`Invalid value.`);return}r.setValidity(t,i)}),e.onReset&&O(e.onReset),{checkValidity:()=>r.checkValidity(),internals:r,reportValidity:()=>r.reportValidity(),setCustomValidity:e=>e?r.setValidity({customError:!0},e):r.setValidity({})}},Ge=e=>e===`role`||e.startsWith(`aria-`)?e:e.startsWith(`aria`)?`aria-${e.slice(4).toLowerCase()}`:`aria-${e}`,Ke=e=>e===`role`||e.startsWith(`aria-`)?e:e.startsWith(`aria`)?`aria-${e.slice(4).toLowerCase()}`:e,qe=(e,t)=>{let n=t?.target??w(),r=[];if(e.attr)for(let[t,i]of Object.entries(e.attr)){let e=Xe(n,Je(t),i);e&&r.push(e)}if(e.aria)for(let[t,i]of Object.entries(e.aria)){let e=Xe(n,Ge(t),i);e&&r.push(e)}if(e.class&&r.push(Qe(n,e.class)),e.style)for(let[t,i]of Object.entries(e.style)){let e=Ze(n,t,i);e&&r.push(e)}if(e.on){let{target:i,...a}=t??{};for(let t of Object.keys(e.on)){let i=e.on[t];i&&r.push(_(n,t,i,a))}}let i=()=>{for(let e of r)e()};return T(i),i},Je=Ke,Ye=(t,n)=>{if(typeof t==`function`)return k(()=>{n(t())});if((0,e.isReactive)(t))return k(()=>{n(t.value)});n(t)};function Xe(e,t,n){return Ye(n,n=>g(e,t,n))}function Ze(e,t,n){let r=u(t.startsWith(`--`)?t:v(t));if(!r)return;let i=!1;return Ye(n,t=>{t!=null&&t!==``?(i=!0,e.style.setProperty(r,u(String(t)))):i&&e.style.removeProperty(r)})}function Qe(e,t){let n=typeof t==`function`?t:()=>{let e={};for(let[n,r]of Object.entries(t))e[n]=c(r);return e},r=new Set;return k(()=>{let t=new Set;for(let[i,a]of Object.entries(n()))a&&(t.add(i),r.has(i)||e.classList.add(i));for(let n of r)t.has(n)||e.classList.remove(n);r=t})}var $e=`default`,X=e=>e||$e,et=t=>{let n=new Map,r=new Map,i=new Map,a=t=>{let r=n.get(t);return r||(r={elements:(0,e.signal)([]),presence:(0,e.signal)(!1)},n.set(t,r)),r},o=(e,t)=>{if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0},s=e=>{let t=X(e),n=r.get(t),i=[];if(n)for(let e of n)i.push(...e.assignedElements({flatten:!0}));let s=a(t);o(s.elements.value,i)||(s.elements.value=i);let c=i.length>0;s.presence.value!==c&&(s.presence.value=c)},c=e=>{if(i.has(e))return;let t=X(e.getAttribute(`name`)),n=r.get(t)??new Set;n.add(e),r.set(t,n);let a=()=>s(t);e.addEventListener(`slotchange`,a),i.set(e,()=>{e.removeEventListener(`slotchange`,a)}),s(t)},l=e=>{let t=i.get(e);if(!t)return;t(),i.delete(e);let n=X(e.getAttribute(`name`)),a=r.get(n);a&&(a.delete(e),a.size===0&&r.delete(n)),s(n)},u=()=>{t.shadowRoot?.querySelectorAll(`slot`).forEach(e=>{c(e)})},d=()=>{for(let e of r.keys())s(e)},f=null;return D(()=>{u(),d(),!f&&t.shadowRoot&&(f=new MutationObserver(e=>{for(let t of e)for(let e of t.removedNodes)e instanceof HTMLSlotElement&&l(e);u(),i.size>0&&d()}),f.observe(t.shadowRoot,{childList:!0,subtree:!0}))}),E(()=>{f?.disconnect(),f=null;for(let e of i.values())e();i.clear(),r.clear(),n.clear(),Z.delete(t)}),{elements:e=>a(X(e)).elements,has:e=>a(X(e)).presence}},Z=new WeakMap,tt=()=>{let e=C(`useSlots`),t=Z.get(e.element);return t||(t=et(e.element),Z.set(e.element,t)),t},nt=(t,n,r)=>{let i=(0,e.effect)(()=>{n(t.value)});r(()=>i.dispose())},rt=e=>e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement,it=e=>e instanceof HTMLInputElement&&(e.type===`checkbox`||e.type===`radio`),at=(e,t,n,r={last:void 0})=>{let i=it(e),a=i?!!t:t==null?``:String(t),o=i?e.checked:e.value;n&&r.last!==void 0&&!Object.is(o,r.last)&&!Object.is(o,a)||(i?e.checked=a:e.value=a,n&&(r.last=a))},ot=(t,n,r,i)=>{let a=y(i)?i:n.parse(r.mode===`bool`?i?``:null:i==null||i===!1?null:String(i));if(Object.is((0,e.untrack)(()=>n.signal.value),a)||(n.signal.value=a),!n.reflect){if(y(i))return;r.mode===`bool`?t.toggleAttribute(r.name,!!i):g(t,r.name,i)}},st=(t,n)=>{let{el:r,mode:i,name:a,propMeta:o}=t,s={last:void 0},c=n=>{if(o){ot(r,o,t,n);return}if(!(0,e.isReactive)(n)&&y(n)){a!==`__proto__`&&a!==`constructor`&&a!==`prototype`&&(r[a]=n);return}if(a===`value`&&rt(r)||a===`checked`&&r instanceof HTMLInputElement){at(r,n,t.live,s);return}i===`bool`?r.toggleAttribute(a,!!n):g(r,a,n)};`signal`in t?nt(t.signal,c,n):c(t.value)},ct=(e,t)=>{t(_(e.el,e.name,e.handler))},lt=(e,t)=>{let{el:n,ref:r}=e;if(typeof r==`function`){r(n),t(()=>r(null));return}r.value=n,t(()=>{r.value=null})},ut=(e,t,n)=>{let r=[],i=t.parentNode;s(i,`html binding anchor has no parent node`);for(let a of e)if(H(a)){let e=Array.from(a.fragment.childNodes);i.insertBefore(a.fragment,t),a.apply(n),r.push(...e)}else if(a!=null&&a!==!1){let e=document.createTextNode(String(a));i.insertBefore(e,t),r.push(e)}return r},dt=(t,n)=>{let{anchor:r,signal:i}=t,a=p(),o=(0,e.effect)(()=>{let t=i.value;a.clear(),t!=null&&t.length!==0&&(0,e.untrack)(()=>{a.setNodes(ut(t,r,a.registerCleanup))})});n(()=>{o.dispose(),a.clear()})},ft=(e,t)=>{e.directive.mount(e.anchor,t)},pt=(e,t)=>{switch(e.type){case`attr`:st(e,t);break;case`directive`:ft(e,t);break;case`event`:ct(e,t);break;case`html`:dt(e,t);break;case`ref`:lt(e,t)}},mt=(t,n,r,i)=>{let a=ge(t,r);return Be(i)?{el:t,live:!0,mode:n,name:r,propMeta:a,signal:i.source,type:`attr`}:typeof i==`function`?{el:t,mode:n,name:r,propMeta:a,signal:(0,e.computed)(i),type:`attr`}:(0,e.isReactive)(i)?{el:t,mode:n,name:r,propMeta:a,signal:i,type:`attr`}:{el:t,mode:n,name:r,propMeta:a,type:`attr`,value:i}},ht=e=>e==null?``:String(e),Q={ATTR:`attr`,BOOL_ATTR:`boolAttr`,EVENT:`event`,NODE:`node`,REF:`ref`},gt=/\s+@([a-zA-Z_][-a-zA-Z0-9_.-]*)\s*=\s*["']?$/,_t=/\s+ref\s*=\s*["']?$/,vt=/\s+\?([a-zA-Z_][-a-zA-Z0-9_]*)\s*=\s*["']?$/,yt=/\s+([a-zA-Z_][-a-zA-Z0-9_]*)\s*=\s*["']?$/,bt=e=>{let t;if(t=gt.exec(e)){let r=e.slice(0,-t[0].length),[i,...a]=t[1].split(`.`);if(a.length>0)throw new n(o.eventModifiersUnsupported(t[1]));return{kind:Q.EVENT,name:i,prefix:r}}if(t=_t.exec(e))return{kind:Q.REF,prefix:e.slice(0,-t[0].length)};if(t=vt.exec(e))return{kind:Q.BOOL_ATTR,name:t[1],prefix:e.slice(0,-t[0].length)};if(t=yt.exec(e))return{kind:Q.ATTR,name:t[1],prefix:e.slice(0,-t[0].length)};let r=e.lastIndexOf(`<`);if(r>e.lastIndexOf(`>`)&&e[r+1]!==`/`)throw new n(o.templateInterpolationInTag);return{kind:Q.NODE,prefix:e}},xt=new WeakMap,St=/[@?]?[a-zA-Z_][-a-zA-Z0-9_.]*\s*=\s*$/,Ct=e=>{let t=Array.from(e),n=!1;for(let e=0;e<t.length-1;e++){let r=t[e],i=r[r.length-1];for(let e of r)e===`<`?n=!0:e===`>`&&(n=!1);if((i===`"`||i===`'`)&&n&&St.test(r.slice(0,-1))){t[e]=r.slice(0,-1);let n=t[e+1];n.startsWith(i)&&(t[e+1]=n.slice(1))}}return t},$=`data-ore-b`,wt=/^ore:(\d+)$/,Tt=(e,t,n,r)=>{if(e.nodeType===Node.ELEMENT_NODE){let r=e,i=r.getAttribute($);i!==null&&(n.set(Number(i),[...t]),r.removeAttribute($))}else if(e.nodeType===Node.COMMENT_NODE){let n=e.nodeValue,i=n===null?null:wt.exec(n);i&&r.set(Number(i[1]),[...t])}let i=e.childNodes;for(let e=0;e<i.length;e++)Tt(i[e],[...t,e],n,r)},Et=e=>{let t=Ct(e),n=``,r,i=0,a=0,o=[];for(let e=0;e<t.length-1;e++){let s=t[e],c=bt(s);if(c.kind===Q.NODE)n+=`${c.prefix}<!--ore:${a}-->`,o.push({commentId:a,kind:Q.NODE}),a++,r=void 0;else{r===void 0||c.prefix.lastIndexOf(`<`)>c.prefix.lastIndexOf(`>`)?(r=i++,n+=`${c.prefix} ${$}="${r}"`):n+=c.prefix;let e=c.kind===Q.BOOL_ATTR?`bool`:c.kind===Q.ATTR?`attr`:void 0;o.push({elementId:r,kind:c.kind,mode:e,name:c.name})}}n+=t[t.length-1]??``;let s=document.createElement(`template`);s.innerHTML=n;let c=new Map,l=new Map,u=s.content.childNodes;for(let e=0;e<u.length;e++)Tt(u[e],[e],c,l);return{commentPaths:l,element:s,elementPaths:c,slots:o}},Dt=e=>{let t=xt.get(e);return t||(t=Et(e),xt.set(e,t)),t},Ot=(e,t)=>{let n=e;for(let e of t)n=n.childNodes[e];return n},kt="html`...`: node-slot comment anchor has no parent node",At=e=>Array.isArray(e)?e:[e],jt=(e,t,n)=>{let r=t.parentNode;for(s(r,kt);e.fragment.firstChild;)r.insertBefore(e.fragment.firstChild,t);n.push(e.apply.bind(e))},Mt=(t,n)=>{let r=Dt(t),i=r.element.content.cloneNode(!0),a=[],o=[],c=r.slots.map((e,t)=>{let a=n[t];if(e.kind===Q.NODE){let t=e.commentId===void 0?void 0:r.commentPaths.get(e.commentId);return s(t,`compiled template is missing a comment path for node slot ${e.commentId}`),{comment:Ot(i,t),slot:e,value:a}}let o=e.elementId===void 0?void 0:r.elementPaths.get(e.elementId);return s(o,`compiled template is missing an element path for slot ${e.elementId}`),{el:Ot(i,o),slot:e,value:a}});for(let{comment:t,el:n,slot:r,value:i}of c){if(r.kind===Q.NODE){let n=t;if(s(n,`compiled template produced a node slot without a comment anchor`),Pe(i)){a.push({anchor:n,directive:i,type:`directive`});continue}if(H(i)){jt(i,n,o),n.remove();continue}if(typeof i==`function`||(0,e.isReactive)(i)){let t=typeof i==`function`?(0,e.computed)(()=>At(i())):(0,e.computed)(()=>At(i.value));a.push({anchor:n,signal:t,type:`html`});continue}if(Array.isArray(i)){for(let e of i)if(H(e))jt(e,n,o);else{let t=n.parentNode;s(t,kt),t.insertBefore(document.createTextNode(ht(e)),n)}n.remove();continue}n.replaceWith(document.createTextNode(ht(i)));continue}if(s(n,`compiled template produced an element slot without an element`),r.kind===Q.EVENT){let t=r.name;if(s(t,`compiled template produced an event slot without an event name`),typeof i==`function`)a.push({el:n,handler:i,name:t,type:`event`});else if((0,e.isReactive)(i)){let e=i;a.push({el:n,handler:t=>{let n=e.value;typeof n==`function`&&n(t)},name:t,type:`event`})}continue}if(r.kind===Q.REF){i&&a.push({el:n,ref:i,type:`ref`});continue}s(r.name,`compiled template produced an attr slot without an attribute name`),a.push(mt(n,r.mode??`attr`,r.name,i))}return Fe(i,e=>{for(let t of a)pt(t,e);for(let t of o)t(e)})},Nt=(e,...t)=>Mt(e,t),Pt={bubbles:!0,cancelable:!0,composed:!1},Ft=()=>{let e=w();return((t,...n)=>{let r=n.length>0?{...Pt,detail:n[0]}:Pt;return e.dispatchEvent(new CustomEvent(String(t),r))})},It=0,Lt=0,Rt=Math.random().toString(36).slice(2,6),zt=(e=`id`)=>`${e}-${++It}`,Bt=(e=`id`)=>`${e}-${Rt}${++Lt}`,Vt=()=>{Lt=0};exports.OreApiError=n,exports.OreError=t,exports.OreInternalError=r,exports.OreLifecycleError=i,exports.bind=qe,exports.classMap=je,exports.createContext=de,exports.createId=zt,exports.createStableId=Bt,exports.css=Se,exports.define=Ae,exports.each=Re,exports.getHost=w,exports.html=Nt,exports.inject=ce,exports.injectStrict=le,exports.live=ze,exports.onCleanup=E,exports.onElement=re,exports.onEvent=ne,exports.onFormReset=O,exports.onMounted=D,exports.prop=pe,exports.provide=oe,exports.ref=Me,exports.resetStableIdCounter=Vt,exports.styleMap=He,exports.unsafeHtml=K,exports.useEmit=Ft,exports.useField=We,exports.useSlots=tt,exports.watchEffect=k,exports.when=Ue;
2
+ `)}`};function s(e,t){if(!e)throw new r(o.invariantViolated(t))}var c=t=>typeof t==`function`?t():(0,e.isReactive)(t)?t.value:t,l=/[;{}]/g,u=e=>e.replace(l,``),d=e=>{for(let t=e.length-1;t>=0;t--)e[t]?.()},f=e=>{for(let t of e)t.remove()},p=()=>{let e=[],t=[];return{clear(){d(t),f(e),t=[],e=[]},get nodes(){return e},registerCleanup(e){t.push(e)},setNodes(t){e=t}}},m=new Set([`action`,`cite`,`codebase`,`data`,`formaction`,`href`,`manifest`,`ping`,`poster`,`src`,`xlink:href`]),h=/^\s*(?:(?:javascript|vbscript|blob):|data:(?:[^,]*\/(?:html|svg\+xml)|application\/(?:xhtml|xml)))/i,g=(e,t,n)=>{let r=t.toLowerCase();if(/^on[a-z]/i.test(t)){`${t}${t.slice(2)}`,e.removeAttribute(t);return}if(r===`srcdoc`){e.removeAttribute(t);return}if(n==null||n===!1){e.removeAttribute(t);return}let i=n===!0?`true`:String(n);if(m.has(r)&&h.test(i)){`${t}`,e.removeAttribute(t);return}e.setAttribute(t,i)},_=(e,t,n,r)=>{if(!e)return o.listenNullTarget(t),()=>{};let i=n;return e.addEventListener(t,i,r),()=>e.removeEventListener(t,i,r)},v=e=>e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`),y=e=>Array.isArray(e)||typeof e==`object`&&!!e,b=null,x=e=>({element:e,formResetCallbacks:[],mountCallbacks:[]}),S=0,ee=()=>{S++;let e=!1;return()=>{e||(e=!0,S--)}},C=(e,t)=>{let n=b;b=e;try{return t()}finally{b=n}},w=e=>{if(b)return b;throw new n(`${e}: ${o.lifecycleOutsideSetup}`)},T=()=>w(`getHost`).element,E=t=>b?((0,e.effect)(()=>t),!0):!1,D=e=>{if(!E(e))throw new n(`onCleanup: ${o.lifecycleOutsideSetup}`)},O=e=>{w(`onMounted`).mountCallbacks.push(e)},k=e=>{w(`onFormReset`).formResetCallbacks.push(e)},A=t=>{let n=(0,e.effect)(t),r=()=>n.dispose();return E(r),r};function te(e,t,n,r){if(w(`onEvent`),!e)return;let i=_(e,t,n,r);E(i)||i()}var ne=(e,t)=>A(()=>{let n=e.value;if(n)return t(n)}),j=new WeakMap,re=e=>{let t=[],n=e;for(;n;)n instanceof HTMLElement&&t.push(n),n=n.parentNode??(n instanceof ShadowRoot?n.host:null);return t},ie=(e,t,n)=>{let r=j.get(e)??new Map;r.has(t)&&`${e.localName}`,r.set(t,n),j.set(e,r)},ae=(e,t)=>{let n=w(`provide`).element;ie(n,e,t),D(()=>{let t=j.get(n);t&&(t.delete(e),t.size===0&&j.delete(n))})},M=Symbol(`inject.not_found`),oe=new WeakMap,se=(e,t)=>{let n=re(e);for(let e of n){let n=j.get(e);if(n?.has(t))return n.get(t)}return M},ce=(e,t)=>{let n=oe.get(e);n||(n=new Map,oe.set(e,n));let r=t;return n.has(r)||n.set(r,se(e.element,t)),n.get(r)};function le(e,...t){let n=ce(w(`inject`),e);return n===M?t.length>0?t[0]:void 0:n}var ue=e=>{let t=w(`injectStrict`),r=ce(t,e);if(r!==M)return r;throw new n(o.injectStrictFailed(String(e),t.element.localName))},de=0;function fe(e){return Symbol.for(`ore:context:${e??`anonymous-${++de}`}`)}function pe(e){return{default:e,parse:()=>e,reflect:!1}}var me={bool(e){return{default:e??!1,parse:e=>e!==null&&e!==`false`,reflect:!0}},data(e){return pe(e)},json(e){return{default:e,parse:t=>{if(t==null||t===``)return e;try{return JSON.parse(t)}catch{return e}},reflect:!1}},number(e){let t=e===void 0?void 0:e;return{default:t,parse:e=>{if(e==null)return t;let n=Number(e);return Number.isNaN(n)?(`${e}${String(t)}`,t):n},reflect:!0}},oneOf(e,t){return{default:t,parse:n=>n!=null&&e.includes(n)?n:t,reflect:!0}},string(e){let t=e===void 0?void 0:e;return{default:t,parse:e=>e??t,reflect:!0}}},he=e=>typeof e==`object`&&!!e&&`default`in e&&`parse`in e;function ge(e,t){if(!he(e))throw new n(`Prop "${t}" must use a prop.* helper (string/number/bool/json/oneOf). Received: ${typeof e}`);let r=e;if(!r.parse)throw new n(`Prop "${t}" must have a parse function. Use prop.* helpers.`);let i=r.reflect??!1;if(i&&y(r.default))throw new n(`Prop "${t}": ${o.propInvalidReflect}`);return{...r,reflect:i}}function _e(e){let t=[];for(let[n,r]of Object.entries(e))try{ge(r,n)}catch(e){t.push(e instanceof Error?e.message:String(e))}return t}var N=new WeakMap,ve=(e,t)=>N.get(e)?.get(t),P=(e,t)=>typeof e==`string`?t(e):e,ye=(t,n,r,i)=>{let a=N.get(t);a||(a=new Map,N.set(t,a));let{default:o,parse:s,reflect:c=!1}=i,l=(0,e.signal)(o),u=a.get(r),d=Object.hasOwn(t,n),f=d?t[n]:void 0,p={parse:s,reflect:c,signal:l};return u?l.value=u.signal.peek():d?(delete t[n],l.value=P(f,s)):t.hasAttribute(r)&&(l.value=s(t.getAttribute(r))),a.set(r,p),Object.defineProperty(t,n,{configurable:!0,enumerable:!0,get:()=>l.value,set:e=>{l.value=P(e,s)}}),c&&A(()=>{let e=l.value;e==null?t.removeAttribute(r):typeof e==`boolean`?t.toggleAttribute(r,e):g(t,r,e)}),l};function be(e,t){let n={};for(let[r,i]of Object.entries(t))n[r]=ye(e,r,v(r),i);return n}var F=e=>{let t=Symbol.for(e);return{is:e=>typeof e==`object`&&!!e&&t in e,stamp:e=>Object.assign(e,{[t]:!0})}},I=F(`ore:css-result`),xe=I.is,Se=function(){return this.content},Ce=(e,...t)=>{let n=``;for(let r=0;r<e.length;r++)if(n+=e[r],r<t.length){let e=t[r];n+=xe(e)?e.content:String(e)}return I.stamp({content:n.trim(),toString:Se})},L=new Map,we=256,Te=e=>{if(e instanceof CSSStyleSheet)return e;let t=typeof e==`string`?e:e.content,n=L.get(t);if(n)return L.delete(t),L.set(t,n),n;let r=new CSSStyleSheet;try{r.replaceSync(t)}catch{return r}if(L.set(t,r),L.size>we){let e=L.keys().next().value;e!==void 0&&L.delete(e)}return r},R={SETUP_DONE:`setup_done`,SETUP_RUNNING:`setup_running`,UNINITIALIZED:`uninitialized`,UNMOUNTED:`unmounted`},Ee={CONNECT:`ore:connect`,DISCONNECT:`ore:disconnect`},De=()=>({formResetCallbacks:[],generation:0,mountCallbacks:[],phase:R.UNINITIALIZED,scope:(0,e.createScope)(),templateResult:null}),Oe=e=>(typeof e==`object`||typeof e==`function`)&&e!==null&&`then`in e&&typeof e.then==`function`,ke=class extends HTMLElement{static _definition;static _normalizedPropDefs;static formAssociated=!1;static observedAttributes=[];_component;constructor(){super();let e=this.constructor._definition;e?.shadow!==!1&&this.attachShadow({mode:`open`,...e?.shadow}),this._component=De()}connectedCallback(){(0,e.untrack)(()=>{this._component.phase===R.UNINITIALIZED&&this._runSetup(),this._init()}),this.dispatchEvent(new CustomEvent(Ee.CONNECT,{bubbles:!1,composed:!1}))}attributeChangedCallback(t,n,r){if(n===r)return;let i=ve(this,t);if(!i)return;let a=i.parse(r);Object.is((0,e.untrack)(()=>i.signal.value),a)||(i.signal.value=a)}disconnectedCallback(){this._component.generation++,this._component.phase=R.UNMOUNTED,this.dispatchEvent(new CustomEvent(Ee.DISCONNECT,{bubbles:!1,composed:!1})),this._resetSetupState()}_resetSetupState(){this._component.scope.dispose(),this._component.formResetCallbacks=[],this._component.mountCallbacks=[],this._component.phase=R.UNINITIALIZED,this._component.scope=(0,e.createScope)(),this._component.templateResult=null}formResetCallback(){for(let e of this._component.formResetCallbacks)try{e()}catch(e){this._reportLifecycleError(e,`form-reset`)}}_reportLifecycleError(e,t){let n=e instanceof Error?e:Error(String(e));a(new i(`<${this.localName}> failed during ${this._component.phase} (${t})`,{cause:n,component:this.localName,phase:t}),this)}_runSetup(){this._component.phase=R.SETUP_RUNNING;let e=this.constructor._definition,t=this.constructor._normalizedPropDefs,r=x(this);try{let i;if(this._component.scope.run(()=>{i=C(r,()=>{let n=t?be(this,t):{};return e.setup(n)})}),this._component.mountCallbacks.push(...r.mountCallbacks),this._component.formResetCallbacks.push(...r.formResetCallbacks),Oe(i))throw new n(o.asyncSetupUnsupported);this._component.templateResult=i??null,this._component.phase=R.SETUP_DONE}catch(e){throw this._reportLifecycleError(e,`setup`),this._resetSetupState(),e}}_isStale(e){return this._component.generation!==e||!this.isConnected}_applyResult(e){if(!e)return;let t=this.shadowRoot??this,n=x(this);t.replaceChildren(),this._component.scope.run(()=>{C(n,()=>{e.mount(t,null,D)})})}_init(){this._applyStyles(),this._mountTemplate(),this._component.phase===R.SETUP_DONE&&this._scheduleMountCallbacks()}_applyStyles(){let e=this.constructor._definition;this.shadowRoot&&e?.styles?.length&&(this.shadowRoot.adoptedStyleSheets=e.styles.map(Te))}_mountTemplate(){let e=this._component.templateResult;e&&this._applyResult(e)}_scheduleMountCallbacks(){if(this._component.mountCallbacks.length===0)return;let e=this._component.generation,t=ee();queueMicrotask(()=>{try{if(this._isStale(e))return;let t=this._component.mountCallbacks.splice(0);for(let e=0;e<t.length;e++){let n=t[e];try{let e=x(this);this._component.scope.run(()=>{C(e,()=>{let e=n();typeof e==`function`&&D(e)})}),e.mountCallbacks.length>0&&t.push(...e.mountCallbacks),e.formResetCallbacks.length>0&&this._component.formResetCallbacks.push(...e.formResetCallbacks)}catch(e){this._reportLifecycleError(e,`mounted`)}}}finally{t()}})}};function Ae(e,t){let{props:r}=t,i=(()=>{if(!r)return;let t=_e(r);if(t.length>0)throw new n(o.validationFailed(e,t));let i={};for(let[e,t]of Object.entries(r))i[e]=ge(t,e);return i})(),a=i?Object.keys(i).map(v):[];return class extends ke{static _definition=t;static _normalizedPropDefs=i;static formAssociated=t.formAssociated??!1;static observedAttributes=a}}function je(e,t){if(!e)throw new n(o.defineRequiresTag);if(customElements.get(e))throw new n(o.defineDuplicate(e));let r=Ae(e,t);Object.defineProperty(r,"name",{value:e}),customElements.define(e,r)}var Me=t=>(0,e.computed)(()=>Object.entries(t).filter(([,e])=>c(e)).map(([e])=>e.replace(/\s+/g,``)).filter(Boolean).join(` `));function Ne(){return(0,e.signal)(null)}var Pe=F(`ore:directive`),z=e=>Pe.stamp({mount:e}),Fe=Pe.is,B=F(`ore:html-result`),V=B.is;function Ie(e,t){return B.stamp({apply:t,fragment:e,mount:(n,r,i)=>{let a=Array.from(e.childNodes);return n.insertBefore(e,r),t(i),a}})}var Le=(t,n,r,i,a)=>{let o=(0,e.signal)(t),s=(0,e.signal)(n),c=(0,e.createScope)(),l=[],u=[];return c.run(()=>{u=r(o,s).mount(i,a,e=>l.push(e))}),{cleanups:l,data:o,index:s,key:``,nodes:u,scope:c}},H=e=>{e.scope.dispose(),d(e.cleanups),f(e.nodes)},Re=(t,r,i,a,s,c)=>{let l=[],u=new Set;for(let e=0;e<r.length;e++){let t=String(i(r[e],e));if(u.has(t))throw new n(o.eachDuplicateKey(t,e));u.add(t),l.push(t)}for(let[e,n]of t)u.has(e)||(H(n),t.delete(e));let d=[];for(let n=0;n<r.length;n++){let i=l[n],o=t.get(i);if(o)(0,e.batch)(()=>{o.data.value=r[n],o.index.value=n}),d.push(o);else{let o=(0,e.untrack)(()=>Le(r[n],n,a,s,c));o.key=i,t.set(i,o),d.push(o)}}let f=c;for(let e=d.length-1;e>=0;e--){let t=d[e],n=t.nodes[0];if(n&&n!==f.previousSibling)for(let e of t.nodes)s.insertBefore(e,f);f=n??f}return d};function ze(t,n,r,o){let c=Array.isArray(t)?(0,e.signal)(t):typeof t==`function`?(0,e.computed)(t):t;return z((t,l)=>{let u=t.parentNode;s(u,`each() anchor comment has no parent node`);let p=document.createComment(`each/end`);u.insertBefore(p,t.nextSibling);let m=new Map,h=[],g=null,_=[],v=()=>{o&&(g=o().mount(u,p,e=>_.push(e)))},y=()=>{g&&(d(_),f(g),g=null,_=[])},b=(0,e.effect)(()=>{let o=c.value??[];if(o.length===0){for(let t of(0,e.untrack)(()=>h))H(t);m=new Map,h=[],g||(0,e.untrack)(v);return}y();try{h=(0,e.untrack)(()=>Re(m,o,n,r,u,p))}catch(e){let n=e instanceof Error?e:Error(String(e));a(new i(`each() failed to reconcile a list update: ${n.message}`,{cause:n,component:`each()`,phase:`each-reconcile`}),t);for(let e of m.values())H(e);m=new Map,h=[]}});l(()=>b.dispose()),l(()=>{y();for(let e of h)H(e);p.remove()})})}var U=F(`ore:live`),Be=e=>U.stamp({source:e}),Ve=U.is,He=e=>{let t=c(e);return t==null||t===!1?``:u(String(t))},Ue=t=>(0,e.computed)(()=>{let e=[];for(let[n,r]of Object.entries(t)){let t=He(r);if(!t)continue;let i=u(v(n));i&&e.push(`${i}:${t}`)}return e.join(`;`)}),W=(e,t,n)=>{let r=document.createElement(`template`);r.innerHTML=e;let i=Array.from(r.content.cloneNode(!0).childNodes);for(let e of i)t.insertBefore(e,n);return i};function We(t){let n=typeof t==`function`?(0,e.computed)(t):(0,e.isReactive)(t)?t:null;return z((r,i)=>{let a=r.parentNode;s(a,`unsafeHtml() anchor comment has no parent node`);let o=document.createComment(`unsafe-html/end`);if(a.insertBefore(o,r.nextSibling),n){let t=p(),r=(0,e.effect)(()=>{t.clear(),t.setNodes(W(n.value,a,o))});i(()=>r.dispose()),i(()=>{t.clear(),o.remove()})}else W(t,a,o),i(()=>o.remove())})}var G=`when() anchor comment has no parent node`;function Ge(t,n,r){return typeof t!=`function`&&!(0,e.isReactive)(t)?z((e,i)=>{let a=t?n():r?r():null;if(!a||!V(a))return;let o=e.parentNode;s(o,G);let c=a.mount(o,e,i);i(()=>f(c))}):z((i,a)=>{let o=(typeof t==`function`?(0,e.computed)(t):null)??t,c=i.parentNode;s(c,G);let l=document.createComment(`when/end`);c.insertBefore(l,i.nextSibling);let u=p(),d=(0,e.effect)(()=>{let t=o.value;u.clear();let i=t?n():r?r():null;!i||!V(i)||u.setNodes((0,e.untrack)(()=>i.mount(c,l,u.registerCleanup)))});a(()=>d.dispose()),a(()=>{u.clear(),l.remove()})})}var K=new WeakMap,q=new WeakSet,Ke=e=>{let t=e.el??T();if(!t.constructor.formAssociated)throw new n(o.defineFieldRequiresFormAssociated(t.localName));if(q.has(t))throw new n(o.useFieldAlreadyCalled(t.localName));let r=K.get(t)??t.attachInternals();K.set(t,r),q.add(t),D(()=>q.delete(t));let i=e.toFormValue??(t=>t==null?e.emptyStringForNull?``:null:t instanceof File||t instanceof FormData?t:String(t));A(()=>{r.setFormValue(i(e.value.value))});let a=e.disabled;if(a&&`states`in r){let e=r.states;A(()=>{a.value?e.add(`disabled`):e.delete(`disabled`)})}return e.validity&&A(()=>{let t=e.validity?.value??{},n=Object.values(t).some(Boolean),i=e.validationMessage?.value??``;if(n&&!i){r.setValidity(t,`Invalid value.`);return}r.setValidity(t,i)}),e.onReset&&k(e.onReset),{checkValidity:()=>r.checkValidity(),internals:r,reportValidity:()=>r.reportValidity(),setCustomValidity:e=>e?r.setValidity({customError:!0},e):r.setValidity({})}},qe=e=>e===`role`||e.startsWith(`aria-`)?e:e.startsWith(`aria`)?`aria-${e.slice(4).toLowerCase()}`:`aria-${e}`,Je=e=>e===`role`||e.startsWith(`aria-`)?e:e.startsWith(`aria`)?`aria-${e.slice(4).toLowerCase()}`:e,Ye=(e,t)=>{let n=t?.target??T(),r=[];if(e.attr)for(let[t,i]of Object.entries(e.attr)){let e=Ze(n,Xe(t),i);e&&r.push(e)}if(e.aria)for(let[t,i]of Object.entries(e.aria)){let e=Ze(n,qe(t),i);e&&r.push(e)}if(e.class&&r.push($e(n,e.class)),e.style)for(let[t,i]of Object.entries(e.style)){let e=Qe(n,t,i);e&&r.push(e)}if(e.on){let{target:i,...a}=t??{};for(let t of Object.keys(e.on)){let i=e.on[t];i&&r.push(_(n,t,i,a))}}let i=()=>{for(let e of r)e()};return E(i),i},Xe=Je,J=(t,n)=>{if(typeof t==`function`)return A(()=>{n(t())});if((0,e.isReactive)(t))return A(()=>{n(t.value)});n(t)};function Ze(e,t,n){return J(n,n=>g(e,t,n))}function Qe(e,t,n){let r=u(t.startsWith(`--`)?t:v(t));if(!r)return;let i=!1;return J(n,t=>{t!=null&&t!==``?(i=!0,e.style.setProperty(r,u(String(t)))):i&&e.style.removeProperty(r)})}function $e(e,t){let n=typeof t==`function`?t:()=>{let e={};for(let[n,r]of Object.entries(t))e[n]=c(r);return e},r=new Set;return A(()=>{let t=new Set;for(let[i,a]of Object.entries(n()))a&&(t.add(i),r.has(i)||e.classList.add(i));for(let n of r)t.has(n)||e.classList.remove(n);r=t})}var et=`default`,Y=e=>e||et,tt=t=>{let n=new Map,r=new Map,i=new Map,a=t=>{let r=n.get(t);return r||(r={elements:(0,e.signal)([]),presence:(0,e.signal)(!1)},n.set(t,r)),r},o=(e,t)=>{if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0},s=e=>{let t=Y(e),n=r.get(t),i=[];if(n)for(let e of n)i.push(...e.assignedElements({flatten:!0}));let s=a(t);o(s.elements.value,i)||(s.elements.value=i);let c=i.length>0;s.presence.value!==c&&(s.presence.value=c)},c=e=>{if(i.has(e))return;let t=Y(e.getAttribute(`name`)),n=r.get(t)??new Set;n.add(e),r.set(t,n);let a=()=>s(t);e.addEventListener(`slotchange`,a),i.set(e,()=>{e.removeEventListener(`slotchange`,a)}),s(t)},l=e=>{let t=i.get(e);if(!t)return;t(),i.delete(e);let n=Y(e.getAttribute(`name`)),a=r.get(n);a&&(a.delete(e),a.size===0&&r.delete(n)),s(n)},u=()=>{t.shadowRoot?.querySelectorAll(`slot`).forEach(e=>{c(e)})},d=()=>{for(let e of r.keys())s(e)},f=null;return O(()=>{u(),d(),!f&&t.shadowRoot&&(f=new MutationObserver(e=>{for(let t of e)for(let e of t.removedNodes)e instanceof HTMLSlotElement&&l(e);u(),i.size>0&&d()}),f.observe(t.shadowRoot,{childList:!0,subtree:!0}))}),D(()=>{f?.disconnect(),f=null;for(let e of i.values())e();i.clear(),r.clear(),n.clear(),X.delete(t)}),{elements:e=>a(Y(e)).elements,has:e=>a(Y(e)).presence}},X=new WeakMap,nt=()=>{let e=w(`useSlots`),t=X.get(e.element);return t||(t=tt(e.element),X.set(e.element,t)),t},rt=(t,n,r)=>{let i=(0,e.effect)(()=>{n(t.value)});r(()=>i.dispose())},it=e=>e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement,at=e=>e instanceof HTMLInputElement&&(e.type===`checkbox`||e.type===`radio`),ot=(e,t,n,r={last:void 0})=>{let i=at(e),a=i?!!t:t==null?``:String(t),o=i?e.checked:e.value;n&&r.last!==void 0&&!Object.is(o,r.last)&&!Object.is(o,a)||(i?e.checked=a:e.value=a,n&&(r.last=a))},st=(t,n,r,i)=>{let a=y(i)?i:n.parse(r.mode===`bool`?i?``:null:i==null||i===!1?null:String(i));if(Object.is((0,e.untrack)(()=>n.signal.value),a)||(n.signal.value=a),!n.reflect){if(y(i))return;r.mode===`bool`?t.toggleAttribute(r.name,!!i):g(t,r.name,i)}},ct=(t,n)=>{let{el:r,mode:i,name:a,propMeta:o}=t,s={last:void 0},c=n=>{if(o){st(r,o,t,n);return}if(!(0,e.isReactive)(n)&&y(n)){a!==`__proto__`&&a!==`constructor`&&a!==`prototype`&&(r[a]=n);return}if(a===`value`&&it(r)||a===`checked`&&r instanceof HTMLInputElement){ot(r,n,t.live,s);return}i===`bool`?r.toggleAttribute(a,!!n):g(r,a,n)};`signal`in t?rt(t.signal,c,n):c(t.value)},lt=(e,t)=>{t(_(e.el,e.name,e.handler))},ut=(e,t)=>{let{el:n,ref:r}=e;if(typeof r==`function`){r(n),t(()=>r(null));return}r.value=n,t(()=>{r.value=null})},dt=(e,t,n)=>{let r=[],i=t.parentNode;s(i,`html binding anchor has no parent node`);for(let a of e)if(V(a)){let e=Array.from(a.fragment.childNodes);i.insertBefore(a.fragment,t),a.apply(n),r.push(...e)}else if(a!=null&&a!==!1){let e=document.createTextNode(String(a));i.insertBefore(e,t),r.push(e)}return r},ft=(t,n)=>{let{anchor:r,signal:i}=t,a=p(),o=(0,e.effect)(()=>{let t=i.value;a.clear(),t!=null&&t.length!==0&&(0,e.untrack)(()=>{a.setNodes(dt(t,r,a.registerCleanup))})});n(()=>{o.dispose(),a.clear()})},pt=(e,t)=>{e.directive.mount(e.anchor,t)},mt=(e,t)=>{switch(e.type){case`attr`:ct(e,t);break;case`directive`:pt(e,t);break;case`event`:lt(e,t);break;case`html`:ft(e,t);break;case`ref`:ut(e,t)}},ht=(t,n,r,i)=>{let a=ve(t,r);return Ve(i)?{el:t,live:!0,mode:n,name:r,propMeta:a,signal:i.source,type:`attr`}:typeof i==`function`?{el:t,mode:n,name:r,propMeta:a,signal:(0,e.computed)(i),type:`attr`}:(0,e.isReactive)(i)?{el:t,mode:n,name:r,propMeta:a,signal:i,type:`attr`}:{el:t,mode:n,name:r,propMeta:a,type:`attr`,value:i}},gt=e=>e==null?``:String(e),Z={ATTR:`attr`,BOOL_ATTR:`boolAttr`,EVENT:`event`,NODE:`node`,REF:`ref`},_t=/\s+@([a-zA-Z_][-a-zA-Z0-9_.-]*)\s*=\s*["']?$/,vt=/\s+ref\s*=\s*["']?$/,yt=/\s+\?([a-zA-Z_][-a-zA-Z0-9_]*)\s*=\s*["']?$/,bt=/\s+([a-zA-Z_][-a-zA-Z0-9_]*)\s*=\s*["']?$/,xt=e=>{let t;if(t=_t.exec(e)){let r=e.slice(0,-t[0].length),[i,...a]=t[1].split(`.`);if(a.length>0)throw new n(o.eventModifiersUnsupported(t[1]));return{kind:Z.EVENT,name:i,prefix:r}}if(t=vt.exec(e))return{kind:Z.REF,prefix:e.slice(0,-t[0].length)};if(t=yt.exec(e))return{kind:Z.BOOL_ATTR,name:t[1],prefix:e.slice(0,-t[0].length)};if(t=bt.exec(e))return{kind:Z.ATTR,name:t[1],prefix:e.slice(0,-t[0].length)};let r=e.lastIndexOf(`<`);if(r>e.lastIndexOf(`>`)&&e[r+1]!==`/`)throw new n(o.templateInterpolationInTag);return{kind:Z.NODE,prefix:e}},St=new WeakMap,Ct=/[@?]?[a-zA-Z_][-a-zA-Z0-9_.]*\s*=\s*$/,wt=e=>{let t=Array.from(e),n=!1;for(let e=0;e<t.length-1;e++){let r=t[e],i=r[r.length-1];for(let e of r)e===`<`?n=!0:e===`>`&&(n=!1);if((i===`"`||i===`'`)&&n&&Ct.test(r.slice(0,-1))){t[e]=r.slice(0,-1);let n=t[e+1];n.startsWith(i)&&(t[e+1]=n.slice(1))}}return t},Q=`data-ore-b`,Tt=/^ore:(\d+)$/,Et=(e,t,n,r)=>{if(e.nodeType===Node.ELEMENT_NODE){let r=e,i=r.getAttribute(Q);i!==null&&(n.set(Number(i),[...t]),r.removeAttribute(Q))}else if(e.nodeType===Node.COMMENT_NODE){let n=e.nodeValue,i=n===null?null:Tt.exec(n);i&&r.set(Number(i[1]),[...t])}let i=e.childNodes;for(let e=0;e<i.length;e++)Et(i[e],[...t,e],n,r)},Dt=e=>{let t=wt(e),n=``,r,i=0,a=0,o=[];for(let e=0;e<t.length-1;e++){let s=t[e],c=xt(s);if(c.kind===Z.NODE)n+=`${c.prefix}<!--ore:${a}-->`,o.push({commentId:a,kind:Z.NODE}),a++,r=void 0;else{r===void 0||c.prefix.lastIndexOf(`<`)>c.prefix.lastIndexOf(`>`)?(r=i++,n+=`${c.prefix} ${Q}="${r}"`):n+=c.prefix;let e=c.kind===Z.BOOL_ATTR?`bool`:c.kind===Z.ATTR?`attr`:void 0;o.push({elementId:r,kind:c.kind,mode:e,name:c.name})}}n+=t[t.length-1]??``;let s=document.createElement(`template`);s.innerHTML=n;let c=new Map,l=new Map,u=s.content.childNodes;for(let e=0;e<u.length;e++)Et(u[e],[e],c,l);return{commentPaths:l,element:s,elementPaths:c,slots:o}},Ot=e=>{let t=St.get(e);return t||(t=Dt(e),St.set(e,t)),t},kt=(e,t)=>{let n=e;for(let e of t)n=n.childNodes[e];return n},$="html`...`: node-slot comment anchor has no parent node",At=e=>Array.isArray(e)?e:[e],jt=(e,t,n)=>{let r=t.parentNode;for(s(r,$);e.fragment.firstChild;)r.insertBefore(e.fragment.firstChild,t);n.push(e.apply.bind(e))},Mt=(t,n)=>{let r=Ot(t),i=r.element.content.cloneNode(!0),a=[],o=[],c=r.slots.map((e,t)=>{let a=n[t];if(e.kind===Z.NODE){let t=e.commentId===void 0?void 0:r.commentPaths.get(e.commentId);return s(t,`compiled template is missing a comment path for node slot ${e.commentId}`),{comment:kt(i,t),slot:e,value:a}}let o=e.elementId===void 0?void 0:r.elementPaths.get(e.elementId);return s(o,`compiled template is missing an element path for slot ${e.elementId}`),{el:kt(i,o),slot:e,value:a}});for(let{comment:t,el:n,slot:r,value:i}of c){if(r.kind===Z.NODE){let n=t;if(s(n,`compiled template produced a node slot without a comment anchor`),Fe(i)){a.push({anchor:n,directive:i,type:`directive`});continue}if(V(i)){jt(i,n,o),n.remove();continue}if(typeof i==`function`||(0,e.isReactive)(i)){let t=typeof i==`function`?(0,e.computed)(()=>At(i())):(0,e.computed)(()=>At(i.value));a.push({anchor:n,signal:t,type:`html`});continue}if(Array.isArray(i)){for(let e of i)if(V(e))jt(e,n,o);else{let t=n.parentNode;s(t,$),t.insertBefore(document.createTextNode(gt(e)),n)}n.remove();continue}n.replaceWith(document.createTextNode(gt(i)));continue}if(s(n,`compiled template produced an element slot without an element`),r.kind===Z.EVENT){let t=r.name;if(s(t,`compiled template produced an event slot without an event name`),typeof i==`function`)a.push({el:n,handler:i,name:t,type:`event`});else if((0,e.isReactive)(i)){let e=i;a.push({el:n,handler:t=>{let n=e.value;typeof n==`function`&&n(t)},name:t,type:`event`})}continue}if(r.kind===Z.REF){i&&a.push({el:n,ref:i,type:`ref`});continue}s(r.name,`compiled template produced an attr slot without an attribute name`),a.push(ht(n,r.mode??`attr`,r.name,i))}return Ie(i,e=>{for(let t of a)mt(t,e);for(let t of o)t(e)})},Nt=(e,...t)=>Mt(e,t),Pt={bubbles:!0,cancelable:!0,composed:!1},Ft=()=>{let e=T();return((t,...n)=>{let r=n.length>0?{...Pt,detail:n[0]}:Pt;return e.dispatchEvent(new CustomEvent(String(t),r))})},It=0,Lt=0,Rt=Math.random().toString(36).slice(2,6),zt=(e=`id`)=>`${e}-${++It}`,Bt=(e=`id`)=>`${e}-${Rt}${++Lt}`,Vt=()=>{Lt=0};exports.OreApiError=n,exports.OreError=t,exports.OreInternalError=r,exports.OreLifecycleError=i,exports.bind=Ye,exports.classMap=Me,exports.createContext=fe,exports.createId=zt,exports.createStableId=Bt,exports.css=Ce,exports.define=je,exports.each=ze,exports.getHost=T,exports.html=Nt,exports.inject=le,exports.injectStrict=ue,exports.live=Be,exports.onCleanup=D,exports.onElement=ne,exports.onEvent=te,exports.onFormReset=k,exports.onMounted=O,exports.prop=me,exports.provide=ae,exports.ref=Ne,exports.resetStableIdCounter=Vt,exports.styleMap=Ue,exports.unsafeHtml=We,exports.useEmit=Ft,exports.useField=Ke,exports.useSlots=nt,exports.watchEffect=A,exports.when=Ge;
3
3
  //# sourceMappingURL=ore.cjs.map