@ecopages/radiant 0.3.0-alpha.8 → 0.3.0-beta.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/README.md +315 -0
- package/dist/client/app-bootstrap.d.ts +19 -0
- package/dist/client/app-bootstrap.js +3 -0
- package/dist/client/app-bootstrap.js.map +10 -0
- package/dist/context/decorators/consume-context.js +2 -2
- package/dist/context/decorators/consume-context.js.map +4 -4
- package/dist/context/decorators/context-selector.js +2 -2
- package/dist/context/decorators/context-selector.js.map +8 -7
- package/dist/context/decorators/legacy/consume-context.js +2 -2
- package/dist/context/decorators/legacy/consume-context.js.map +4 -4
- package/dist/context/decorators/legacy/context-selector-field.js +2 -2
- package/dist/context/decorators/legacy/context-selector-field.js.map +4 -4
- package/dist/context/decorators/legacy/context-selector.js +2 -2
- package/dist/context/decorators/legacy/context-selector.js.map +4 -4
- package/dist/context/decorators/legacy/provide-context.js +2 -2
- package/dist/context/decorators/legacy/provide-context.js.map +4 -4
- package/dist/context/decorators/on-context-update.js +2 -2
- package/dist/context/decorators/on-context-update.js.map +4 -4
- package/dist/context/decorators/provide-context.js +2 -2
- package/dist/context/decorators/provide-context.js.map +4 -4
- package/dist/context/decorators/standard-legacy-dispatch.d.ts +6 -0
- package/dist/context/decorators/standard-legacy-dispatch.js +3 -0
- package/dist/context/decorators/standard-legacy-dispatch.js.map +10 -0
- package/dist/context/index.js +2 -2
- package/dist/context/index.js.map +11 -10
- package/dist/controller-registry.js +2 -2
- package/dist/controller-registry.js.map +3 -3
- package/dist/core/event-subscription-registry.d.ts +16 -0
- package/dist/core/event-subscription-registry.js +3 -0
- package/dist/core/event-subscription-registry.js.map +10 -0
- package/dist/core/host-ssr-registry.d.ts +13 -0
- package/dist/core/host-ssr-registry.js +3 -0
- package/dist/core/host-ssr-registry.js.map +10 -0
- package/dist/core/hydration-capable-host.d.ts +8 -0
- package/dist/core/hydration-capable-host.js +3 -0
- package/dist/core/hydration-capable-host.js.map +10 -0
- package/dist/core/radiant-controller.d.ts +36 -15
- package/dist/core/radiant-controller.js +2 -2
- package/dist/core/radiant-controller.js.map +13 -6
- package/dist/core/{radiant-component-ssr.d.ts → radiant-element-ssr-host.d.ts} +16 -16
- package/dist/core/radiant-element-ssr-host.js +3 -0
- package/dist/core/radiant-element-ssr-host.js.map +10 -0
- package/dist/core/radiant-element-ssr-registry.d.ts +18 -0
- package/dist/core/radiant-element-ssr-registry.js +3 -0
- package/dist/core/radiant-element-ssr-registry.js.map +10 -0
- package/dist/core/radiant-element.d.ts +38 -138
- package/dist/core/radiant-element.js +2 -2
- package/dist/core/radiant-element.js.map +21 -10
- package/dist/core/reactive-host.d.ts +3 -16
- package/dist/core/reactive-host.js +2 -2
- package/dist/core/reactive-host.js.map +7 -4
- package/dist/core/reactive-jsx-value.d.ts +2 -1
- package/dist/core/reactive-jsx-value.js.map +2 -2
- package/dist/core/reactive-prop-core.d.ts +44 -0
- package/dist/core/reactive-prop-core.js +3 -0
- package/dist/core/reactive-prop-core.js.map +11 -0
- package/dist/core/reactive-prop-metadata.d.ts +1 -1
- package/dist/core/reactive-prop-metadata.js +2 -2
- package/dist/core/reactive-prop-metadata.js.map +2 -2
- package/dist/core/reactive-property-state.d.ts +17 -0
- package/dist/core/reactive-property-state.js +3 -0
- package/dist/core/reactive-property-state.js.map +12 -0
- package/dist/core/reactivity-adapter.d.ts +8 -0
- package/dist/core/reactivity-adapter.js +3 -0
- package/dist/core/reactivity-adapter.js.map +12 -0
- package/dist/core/reactivity-contract.d.ts +39 -0
- package/dist/core/reactivity-contract.js +2 -0
- package/dist/core/reactivity-contract.js.map +9 -0
- package/dist/core/reactivity-runtime.d.ts +18 -0
- package/dist/core/reactivity-runtime.js +3 -0
- package/dist/core/reactivity-runtime.js.map +11 -0
- package/dist/core/reactivity-signals.d.ts +10 -0
- package/dist/core/reactivity-signals.js +3 -0
- package/dist/core/reactivity-signals.js.map +10 -0
- package/dist/core/render-runtime.d.ts +28 -0
- package/dist/core/render-runtime.js +3 -0
- package/dist/core/render-runtime.js.map +16 -0
- package/dist/core/render-scheduler.d.ts +22 -0
- package/dist/core/render-scheduler.js +3 -0
- package/dist/core/render-scheduler.js.map +10 -0
- package/dist/core/slot-projection-runtime.js +2 -2
- package/dist/core/slot-projection-runtime.js.map +3 -3
- package/dist/decorators/attr.js +2 -2
- package/dist/decorators/attr.js.map +6 -5
- package/dist/decorators/controller.js +2 -2
- package/dist/decorators/controller.js.map +3 -3
- package/dist/decorators/event.js +2 -2
- package/dist/decorators/event.js.map +3 -3
- package/dist/decorators/legacy/attr.js +2 -2
- package/dist/decorators/legacy/attr.js.map +6 -5
- package/dist/decorators/legacy/event.js +2 -2
- package/dist/decorators/legacy/event.js.map +3 -3
- package/dist/decorators/legacy/host-readiness.d.ts +8 -0
- package/dist/decorators/legacy/host-readiness.js +3 -0
- package/dist/decorators/legacy/host-readiness.js.map +11 -0
- package/dist/decorators/legacy/instance-initializers.d.ts +16 -0
- package/dist/decorators/legacy/instance-initializers.js +2 -2
- package/dist/decorators/legacy/instance-initializers.js.map +3 -3
- package/dist/decorators/legacy/on-event.js +2 -2
- package/dist/decorators/legacy/on-event.js.map +6 -5
- package/dist/decorators/legacy/on-updated.d.ts +1 -1
- package/dist/decorators/legacy/on-updated.js +2 -2
- package/dist/decorators/legacy/on-updated.js.map +4 -4
- package/dist/decorators/legacy/query-slot.js +2 -2
- package/dist/decorators/legacy/query-slot.js.map +5 -5
- package/dist/decorators/legacy/query.js +2 -2
- package/dist/decorators/legacy/query.js.map +3 -3
- package/dist/decorators/legacy/reactive-field.js +2 -2
- package/dist/decorators/legacy/reactive-field.js.map +3 -3
- package/dist/decorators/legacy/reactive-prop.d.ts +1 -1
- package/dist/decorators/legacy/reactive-prop.js +2 -2
- package/dist/decorators/legacy/reactive-prop.js.map +7 -6
- package/dist/decorators/legacy/signal.d.ts +1 -1
- package/dist/decorators/legacy/signal.js +2 -2
- package/dist/decorators/legacy/signal.js.map +6 -5
- package/dist/decorators/on-event.js +2 -2
- package/dist/decorators/on-event.js.map +6 -5
- package/dist/decorators/on-updated.js +2 -2
- package/dist/decorators/on-updated.js.map +4 -4
- package/dist/decorators/prop.d.ts +1 -1
- package/dist/decorators/prop.js +2 -2
- package/dist/decorators/prop.js.map +9 -8
- package/dist/decorators/query-slot.js +2 -2
- package/dist/decorators/query-slot.js.map +6 -6
- package/dist/decorators/query.js +2 -2
- package/dist/decorators/query.js.map +3 -3
- package/dist/decorators/shared/reactive-attr.d.ts +1 -1
- package/dist/decorators/shared/reactive-attr.js +2 -2
- package/dist/decorators/shared/reactive-attr.js.map +5 -4
- package/dist/decorators/signal.js +2 -2
- package/dist/decorators/signal.js.map +7 -6
- package/dist/decorators/standard/attr.js +2 -2
- package/dist/decorators/standard/attr.js.map +5 -4
- package/dist/decorators/standard/on-event.js +2 -2
- package/dist/decorators/standard/on-event.js.map +5 -4
- package/dist/decorators/standard/query-slot.d.ts +0 -1
- package/dist/decorators/standard/query-slot.js +2 -2
- package/dist/decorators/standard/query-slot.js.map +4 -4
- package/dist/decorators/standard/reactive-field.js +2 -2
- package/dist/decorators/standard/reactive-field.js.map +3 -3
- package/dist/decorators/standard/reactive-prop.d.ts +1 -1
- package/dist/decorators/standard/reactive-prop.js +2 -2
- package/dist/decorators/standard/reactive-prop.js.map +6 -5
- package/dist/decorators/standard/signal.d.ts +1 -1
- package/dist/decorators/standard/signal.js +2 -2
- package/dist/decorators/standard/signal.js.map +5 -4
- package/dist/decorators/state.js +2 -2
- package/dist/decorators/state.js.map +4 -4
- package/dist/helpers/create-event-listener.js +2 -2
- package/dist/helpers/create-event-listener.js.map +5 -4
- package/dist/helpers/create-query-slot.d.ts +0 -1
- package/dist/helpers/create-query-slot.js +2 -2
- package/dist/helpers/create-query-slot.js.map +3 -3
- package/dist/helpers/index.js +2 -2
- package/dist/helpers/index.js.map +6 -5
- package/dist/index.js +2 -2
- package/dist/index.js.map +37 -25
- package/dist/package.json +209 -0
- package/dist/server/host-attribute-serialization.d.ts +46 -0
- package/dist/server/host-attribute-serialization.js +3 -0
- package/dist/server/host-attribute-serialization.js.map +12 -0
- package/dist/server/host-script-composition.d.ts +42 -0
- package/dist/server/host-script-composition.js +3 -0
- package/dist/server/host-script-composition.js.map +10 -0
- package/dist/server/install-light-dom-shim.js +2 -2
- package/dist/server/install-light-dom-shim.js.map +3 -3
- package/dist/server/internal-radiant-host.d.ts +2 -0
- package/dist/server/internal-radiant-host.js +3 -0
- package/dist/server/internal-radiant-host.js.map +9 -0
- package/dist/server/light-dom-shim.d.ts +9 -0
- package/dist/server/light-dom-shim.js +2 -2
- package/dist/server/light-dom-shim.js.map +3 -3
- package/dist/server/radiant-element-ssr-bridge.d.ts +21 -0
- package/dist/server/radiant-element-ssr-bridge.js +3 -0
- package/dist/server/radiant-element-ssr-bridge.js.map +24 -0
- package/dist/server/radiant-element-ssr-extractor.d.ts +2 -0
- package/dist/server/radiant-element-ssr-extractor.js +3 -0
- package/dist/server/radiant-element-ssr-extractor.js.map +12 -0
- package/dist/server/radiant-element-ssr-service.d.ts +13 -0
- package/dist/server/radiant-element-ssr-service.js +3 -0
- package/dist/server/radiant-element-ssr-service.js.map +22 -0
- package/dist/server/radiant-element-ssr.d.ts +1 -0
- package/dist/server/radiant-element-ssr.js +3 -0
- package/dist/server/radiant-element-ssr.js.map +24 -0
- package/dist/server/render-component.d.ts +3 -9
- package/dist/server/render-component.js +2 -2
- package/dist/server/render-component.js.map +17 -9
- package/dist/server/render-controller.js +2 -2
- package/dist/server/render-controller.js.map +19 -11
- package/dist/server/render-fragment.d.ts +7 -0
- package/dist/server/render-fragment.js +3 -0
- package/dist/server/render-fragment.js.map +10 -0
- package/dist/server/slot-projection-html.js +2 -2
- package/dist/server/slot-projection-html.js.map +3 -3
- package/dist/tools/escape-css-identifier.d.ts +1 -0
- package/dist/tools/escape-css-identifier.js +3 -0
- package/dist/tools/escape-css-identifier.js.map +10 -0
- package/dist/tools/index.d.ts +1 -0
- package/dist/tools/index.js +2 -2
- package/dist/tools/index.js.map +4 -3
- package/dist/utils/escape-html-attribute.d.ts +2 -0
- package/dist/utils/escape-html-attribute.js +3 -0
- package/dist/utils/escape-html-attribute.js.map +10 -0
- package/package.json +12 -5
- package/dist/core/radiant-component-ssr-registry.d.ts +0 -54
- package/dist/core/radiant-component-ssr-registry.js +0 -3
- package/dist/core/radiant-component-ssr-registry.js.map +0 -10
- package/dist/core/radiant-component-ssr.js +0 -3
- package/dist/core/radiant-component-ssr.js.map +0 -14
- package/dist/server/radiant-component-ssr-runtime.d.ts +0 -9
- package/dist/server/radiant-component-ssr-runtime.js +0 -3
- package/dist/server/radiant-component-ssr-runtime.js.map +0 -17
- package/size-budget.json +0 -25
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../src/helpers/create-event-listener.ts"],
|
|
3
|
+
"sources": ["../src/tools/escape-css-identifier.ts", "../src/helpers/create-event-listener.ts"],
|
|
4
4
|
"sourcesContent": [
|
|
5
|
-
"
|
|
5
|
+
"export function escapeCssIdentifier(value: string): string {\n\tconst cssNamespace = globalThis.CSS as { escape?: (value: string) => string } | undefined;\n\n\tif (typeof cssNamespace?.escape === 'function') {\n\t\treturn cssNamespace.escape(value);\n\t}\n\n\tlet escaped = '';\n\n\tfor (let index = 0; index < value.length; index += 1) {\n\t\tconst character = value[index] ?? '';\n\t\tconst codePoint = character.codePointAt(0) ?? 0;\n\n\t\tif (codePoint === 0) {\n\t\t\tescaped += '\\uFFFD';\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst isControlCharacter = (codePoint >= 0x0001 && codePoint <= 0x001f) || codePoint === 0x007f;\n\t\tconst startsWithDigit = index === 0 && codePoint >= 0x0030 && codePoint <= 0x0039;\n\t\tconst startsWithHyphenDigit =\n\t\t\tindex === 1 && codePoint >= 0x0030 && codePoint <= 0x0039 && (value[0] ?? '') === '-';\n\t\tconst isSingleHyphen = index === 0 && character === '-' && value.length === 1;\n\n\t\tif (isControlCharacter || startsWithDigit || startsWithHyphenDigit) {\n\t\t\tescaped += `\\\\${codePoint.toString(16)} `;\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (\n\t\t\tcodePoint >= 0x0080 ||\n\t\t\tcharacter === '-' ||\n\t\t\tcharacter === '_' ||\n\t\t\t(codePoint >= 0x0030 && codePoint <= 0x0039) ||\n\t\t\t(codePoint >= 0x0041 && codePoint <= 0x005a) ||\n\t\t\t(codePoint >= 0x0061 && codePoint <= 0x007a)\n\t\t) {\n\t\t\tescaped += isSingleHyphen ? `\\\\${character}` : character;\n\t\t\tcontinue;\n\t\t}\n\n\t\tescaped += `\\\\${character}`;\n\t}\n\n\treturn escaped;\n}\n",
|
|
6
|
+
"import type { RadiantElementEventListener } from '../core/radiant-element';\nimport { escapeCssIdentifier } from '../tools/escape-css-identifier';\n\n/**\n * Selects which DOM tree delegated event listeners should observe.\n */\nexport type OnEventScope = 'light' | 'shadow' | 'both';\n\ntype BaseOnEventConfig = Pick<RadiantElementEventListener, 'type' | 'options'> & {\n\tscope?: OnEventScope;\n};\n\nexport type OnEventConfig = BaseOnEventConfig &\n\t(\n\t\t| {\n\t\t\t\tselector: string;\n\t\t }\n\t\t| {\n\t\t\t\tref: string;\n\t\t }\n\t\t| {\n\t\t\t\twindow: true;\n\t\t }\n\t\t| {\n\t\t\t\tdocument: true;\n\t\t }\n\t);\n\ntype DelegatedEventRoot = Element | ShadowRoot;\n\ntype EventListenerLifecycleHost = {\n\tregisterConnectedCallback(callback: () => void): void;\n\tregisterCleanupCallback(callback: () => void): void;\n\tisConnected: boolean;\n};\n\nexport type EventListenerHost =\n\t| (EventListenerLifecycleHost & Element)\n\t| (EventListenerLifecycleHost & { host: Element })\n\t| (EventListenerLifecycleHost & { element: Element });\n\nconst shadowRootListenerHooksKey = Symbol('radiant.shadowRootListenerHooks');\nconst patchedAttachShadowKey = Symbol('radiant.patchedAttachShadow');\n\ntype ShadowRootHookHost = Element & {\n\t[patchedAttachShadowKey]?: true;\n\t[shadowRootListenerHooksKey]?: Set<() => void>;\n};\n\nfunction resolveEventListenerHostElement(host: EventListenerHost): Element {\n\tif (host instanceof Element) {\n\t\treturn host;\n\t}\n\n\tif ('host' in host) {\n\t\treturn host.host;\n\t}\n\n\treturn host.element;\n}\n\nfunction isControllerEventHost(host: EventListenerHost): host is EventListenerLifecycleHost & { host: Element } {\n\treturn !(host instanceof Element);\n}\n\nfunction addDelegatedListener(\n\troot: DelegatedEventRoot,\n\tconfig: Pick<OnEventConfig, 'type' | 'options'>,\n\tselector: string,\n\tlistener: EventListener,\n): () => void {\n\tconst delegatedListener = (event: Event) => {\n\t\tif (event.target instanceof Element && event.target.matches(selector)) {\n\t\t\tlistener(event);\n\t\t}\n\t};\n\n\troot.addEventListener(config.type, delegatedListener, config.options);\n\n\treturn () => {\n\t\troot.removeEventListener(config.type, delegatedListener, config.options);\n\t};\n}\n\nfunction registerShadowRootHook(host: EventListenerHost, hook: () => void): void {\n\tconst shadowAwareHost = resolveEventListenerHostElement(host) as ShadowRootHookHost;\n\n\tif (!shadowAwareHost[shadowRootListenerHooksKey]) {\n\t\tshadowAwareHost[shadowRootListenerHooksKey] = new Set();\n\t}\n\n\tshadowAwareHost[shadowRootListenerHooksKey].add(hook);\n\n\tif (shadowAwareHost[patchedAttachShadowKey]) {\n\t\treturn;\n\t}\n\n\tconst originalAttachShadow = shadowAwareHost.attachShadow;\n\n\tshadowAwareHost.attachShadow = function patchedAttachShadow(init: ShadowRootInit): ShadowRoot {\n\t\tconst shadowRoot = originalAttachShadow.call(this, init);\n\t\tfor (const shadowRootHook of shadowAwareHost[shadowRootListenerHooksKey] ?? []) {\n\t\t\tshadowRootHook();\n\t\t}\n\t\treturn shadowRoot;\n\t};\n\n\tshadowAwareHost[patchedAttachShadowKey] = true;\n}\n\n/**\n * Subscribes to a DOM event with delegation, window, or document targeting.\n * Functional equivalent of the `@onEvent` decorator for vanilla JS usage.\n * Returns a cleanup function to remove the listener.\n * @param host The host RadiantElement.\n * @param config The event listener configuration.\n * @param callback The event handler function.\n */\nexport function createEventListener(\n\thost: EventListenerHost,\n\tconfig: OnEventConfig,\n\tcallback: (event: Event) => void,\n): () => void {\n\tif (isControllerEventHost(host) && 'scope' in config && config.scope && config.scope !== 'light') {\n\t\tthrow new Error('RadiantController event listeners only support light DOM scope.');\n\t}\n\n\tconst hostElement = resolveEventListenerHostElement(host);\n\tconst boundCallback = callback.bind(host);\n\tlet windowCleanup: (() => void) | null = null;\n\tlet documentCleanup: (() => void) | null = null;\n\tlet lightCleanup: (() => void) | null = null;\n\tlet shadowCleanup: (() => void) | null = null;\n\tlet disposed = false;\n\n\tconst detachListeners = () => {\n\t\twindowCleanup?.();\n\t\tdocumentCleanup?.();\n\t\tlightCleanup?.();\n\t\tshadowCleanup?.();\n\n\t\twindowCleanup = null;\n\t\tdocumentCleanup = null;\n\t\tlightCleanup = null;\n\t\tshadowCleanup = null;\n\t};\n\n\tconst attachListeners = () => {\n\t\tif (disposed) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ('window' in config && !windowCleanup) {\n\t\t\twindow.addEventListener(config.type, boundCallback, config.options);\n\t\t\twindowCleanup = () => {\n\t\t\t\twindow.removeEventListener(config.type, boundCallback, config.options);\n\t\t\t};\n\t\t}\n\n\t\tif ('document' in config && !documentCleanup) {\n\t\t\tdocument.addEventListener(config.type, boundCallback, config.options);\n\t\t\tdocumentCleanup = () => {\n\t\t\t\tdocument.removeEventListener(config.type, boundCallback, config.options);\n\t\t\t};\n\t\t}\n\n\t\tif ('selector' in config || 'ref' in config) {\n\t\t\tconst selector = 'selector' in config ? config.selector : `[data-ref='${escapeCssIdentifier(config.ref)}']`;\n\n\t\t\tif (config.scope !== 'shadow' && !lightCleanup) {\n\t\t\t\tlightCleanup = addDelegatedListener(hostElement, config, selector, boundCallback);\n\t\t\t}\n\n\t\t\tif (config.scope !== 'light' && hostElement.shadowRoot && !shadowCleanup) {\n\t\t\t\tshadowCleanup = addDelegatedListener(hostElement.shadowRoot, config, selector, boundCallback);\n\t\t\t}\n\t\t}\n\t};\n\n\tif ('selector' in config || 'ref' in config) {\n\t\tif (config.scope !== 'light') {\n\t\t\tregisterShadowRootHook(host, () => {\n\t\t\t\tif (host.isConnected) {\n\t\t\t\t\tattachListeners();\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t}\n\n\thost.registerConnectedCallback(attachListeners);\n\thost.registerCleanupCallback(detachListeners);\n\n\tif (host.isConnected) {\n\t\tattachListeners();\n\t}\n\n\treturn () => {\n\t\tdisposed = true;\n\t\tdetachListeners();\n\t};\n}\n"
|
|
6
7
|
],
|
|
7
|
-
"mappings": "
|
|
8
|
-
"debugId": "
|
|
8
|
+
"mappings": "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",
|
|
9
|
+
"debugId": "1456E78078AEC03264756E2164756E21",
|
|
9
10
|
"names": []
|
|
10
11
|
}
|
|
@@ -4,7 +4,6 @@ export type QuerySlotConfig = {
|
|
|
4
4
|
name?: string;
|
|
5
5
|
};
|
|
6
6
|
type SlotQueryHost = HTMLElement & {
|
|
7
|
-
getSlotElement<T extends Element = Element>(name?: string): T | null;
|
|
8
7
|
getSlotElements<T extends Element = Element>(name?: string): T[];
|
|
9
8
|
};
|
|
10
9
|
type QuerySlotResult<T extends Element | Element[] | null> = {
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var H=((j)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(j,{get:(A,B)=>(typeof require<"u"?require:A)[B]}):j)(function(j){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+j+'" is not supported')});function K(j,A={}){let B=null,D,E=()=>{if(A.all)return
|
|
1
|
+
var H=((j)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(j,{get:(A,B)=>(typeof require<"u"?require:A)[B]}):j)(function(j){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+j+'" is not supported')});function K(j,A={}){let B=null,D,E=()=>{if(A.all)return j.getSlotElements(A.name);return j.getSlotElements(A.name)[0]??null};return{get value(){if(A.cache===!1)return E();let G=j.slotProjectionVersion??0;if(D!==G)B=E(),D=G;return B}}}export{K as createQuerySlot};
|
|
2
2
|
|
|
3
|
-
//# debugId=
|
|
3
|
+
//# debugId=98BC31A3EEEC01AF64756E2164756E21
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/helpers/create-query-slot.ts"],
|
|
4
4
|
"sourcesContent": [
|
|
5
|
-
"export type QuerySlotConfig = {\n\tall?: boolean;\n\tcache?: boolean;\n\tname?: string;\n};\n\ntype SlotQueryHost = HTMLElement & {\n\
|
|
5
|
+
"export type QuerySlotConfig = {\n\tall?: boolean;\n\tcache?: boolean;\n\tname?: string;\n};\n\ntype SlotQueryHost = HTMLElement & {\n\tgetSlotElements<T extends Element = Element>(name?: string): T[];\n};\n\ntype QuerySlotResult<T extends Element | Element[] | null> = {\n\tget value(): T | null;\n};\n\n/**\n * Creates a lazy slot query accessor bound to a host element.\n * Functional equivalent of the `@querySlot` decorator for vanilla JS usage.\n * @param host The host element to query slots within.\n * @param options {@link QuerySlotConfig} The slot query configuration.\n */\nexport function createQuerySlot<T extends Element | Element[] | null = Element | null>(\n\thost: SlotQueryHost,\n\toptions: QuerySlotConfig = {},\n): QuerySlotResult<T> {\n\tlet cached: T | null = null;\n\tlet cachedVersion: number | undefined;\n\n\tconst executeQuery = (): T | null => {\n\t\tif (options.all) {\n\t\t\treturn host.getSlotElements(options.name) as T;\n\t\t}\n\t\treturn (host.getSlotElements(options.name)[0] ?? null) as T | null;\n\t};\n\n\treturn {\n\t\tget value(): T | null {\n\t\t\tif (options.cache === false) {\n\t\t\t\treturn executeQuery();\n\t\t\t}\n\n\t\t\tconst currentVersion = (host as unknown as Record<string, number | undefined>).slotProjectionVersion ?? 0;\n\n\t\t\tif (cachedVersion !== currentVersion) {\n\t\t\t\tcached = executeQuery();\n\t\t\t\tcachedVersion = currentVersion;\n\t\t\t}\n\n\t\t\treturn cached;\n\t\t},\n\t};\n}\n"
|
|
6
6
|
],
|
|
7
|
-
"mappings": "
|
|
8
|
-
"debugId": "
|
|
7
|
+
"mappings": "2PAoBO,SAAS,CAAsE,CACrF,EACA,EAA2B,CAAC,EACP,CACrB,IAAI,EAAmB,KACnB,EAEE,EAAe,IAAgB,CACpC,GAAI,EAAQ,IACX,OAAO,EAAK,gBAAgB,EAAQ,IAAI,EAEzC,OAAQ,EAAK,gBAAgB,EAAQ,IAAI,EAAE,IAAM,MAGlD,MAAO,IACF,MAAK,EAAa,CACrB,GAAI,EAAQ,QAAU,GACrB,OAAO,EAAa,EAGrB,IAAM,EAAkB,EAAuD,uBAAyB,EAExG,GAAI,IAAkB,EACrB,EAAS,EAAa,EACtB,EAAgB,EAGjB,OAAO,EAET",
|
|
8
|
+
"debugId": "98BC31A3EEEC01AF64756E2164756E21",
|
|
9
9
|
"names": []
|
|
10
10
|
}
|
package/dist/helpers/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var
|
|
1
|
+
var q=(($)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy($,{get:(x,W)=>(typeof require<"u"?require:x)[W]}):$)(function($){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+$+'" is not supported')});function T($,x){let W=null,B=null,_,N=()=>{if(W!==null)clearTimeout(W),W=null},U=()=>{if(B===null)return _;let X=B;return B=null,N(),_=X(),_},G=function(...X){B=()=>$.apply(this,X),N(),W=setTimeout(()=>{U()},x)};return G.cancel=()=>{N(),B=null},G.flush=()=>{if(B===null)return _;return U()},G.pending=()=>B!==null,G}class D{host;eventConfig;constructor($,x){this.host=$,this.eventConfig=x}emit($){let x=new CustomEvent(this.eventConfig.name,{detail:$,bubbles:this.eventConfig.bubbles,cancelable:this.eventConfig.cancelable,composed:this.eventConfig.composed});this.host.dispatchEvent(x)}}function y($,x){let W=new D($,x);return $.registerEventEmitter(x.name,W),W}function M($){let x=globalThis.CSS;if(typeof x?.escape==="function")return x.escape($);let W="";for(let B=0;B<$.length;B+=1){let _=$[B]??"",N=_.codePointAt(0)??0;if(N===0){W+="�";continue}let U=N>=1&&N<=31||N===127,G=B===0&&N>=48&&N<=57,X=B===1&&N>=48&&N<=57&&($[0]??"")==="-",Y=B===0&&_==="-"&&$.length===1;if(U||G||X){W+=`\\${N.toString(16)} `;continue}if(N>=128||_==="-"||_==="_"||N>=48&&N<=57||N>=65&&N<=90||N>=97&&N<=122){W+=Y?`\\${_}`:_;continue}W+=`\\${_}`}return W}var Z=Symbol("radiant.shadowRootListenerHooks"),O=Symbol("radiant.patchedAttachShadow");function J($){if($ instanceof Element)return $;if("host"in $)return $.host;return $.element}function V($){return!($ instanceof Element)}function P($,x,W,B){let _=(N)=>{if(N.target instanceof Element&&N.target.matches(W))B(N)};return $.addEventListener(x.type,_,x.options),()=>{$.removeEventListener(x.type,_,x.options)}}function K($,x){let W=J($);if(!W[Z])W[Z]=new Set;if(W[Z].add(x),W[O])return;let B=W.attachShadow;W.attachShadow=function(N){let U=B.call(this,N);for(let G of W[Z]??[])G();return U},W[O]=!0}function m($,x,W){if(V($)&&"scope"in x&&x.scope&&x.scope!=="light")throw Error("RadiantController event listeners only support light DOM scope.");let B=J($),_=W.bind($),N=null,U=null,G=null,X=null,Y=!1,F=()=>{N?.(),U?.(),G?.(),X?.(),N=null,U=null,G=null,X=null},j=()=>{if(Y)return;if("window"in x&&!N)window.addEventListener(x.type,_,x.options),N=()=>{window.removeEventListener(x.type,_,x.options)};if("document"in x&&!U)document.addEventListener(x.type,_,x.options),U=()=>{document.removeEventListener(x.type,_,x.options)};if("selector"in x||"ref"in x){let z="selector"in x?x.selector:`[data-ref='${M(x.ref)}']`;if(x.scope!=="shadow"&&!G)G=P(B,x,z,_);if(x.scope!=="light"&&B.shadowRoot&&!X)X=P(B.shadowRoot,x,z,_)}};if("selector"in x||"ref"in x){if(x.scope!=="light")K($,()=>{if($.isConnected)j()})}if($.registerConnectedCallback(j),$.registerCleanupCallback(F),$.isConnected)j();return()=>{Y=!0,F()}}function I($){return!($ instanceof Element)}function S($){return"shadowRoot"in $?$.shadowRoot??null:null}function Q($){return $ instanceof Element?$:$.host}function A($,x="light"){let W=S($);if(x==="shadow")return W?[W]:[];if(x==="both")return W?[$,W]:[$];return[$]}function w($,x){if(I($)&&x.scope&&x.scope!=="light")throw Error("RadiantController queries only support light DOM scope.");let W=Q($),B="selector"in x?x.selector:`[data-ref="${x.ref}"]`,_=null,N=()=>{let U=A(W,x.scope);if(x.all)return U.flatMap((G)=>Array.from(G.querySelectorAll(B)));for(let G of U){let X=G.querySelector(B);if(X)return X}return null};return{get value(){if(x.cache){if(_===null||x.all&&Array.isArray(_)&&!_.length)_=N();return _}return N()}}}function f($,x={}){let W=null,B,_=()=>{if(x.all)return $.getSlotElements(x.name);return $.getSlotElements(x.name)[0]??null};return{get value(){if(x.cache===!1)return _();let N=$.slotProjectionVersion??0;if(B!==N)W=_(),B=N;return W}}}export{Q as resolveQueryHost,T as debounce,f as createQuerySlot,w as createQuery,m as createEventListener,y as createEvent};
|
|
2
2
|
|
|
3
|
-
//# debugId=
|
|
3
|
+
//# debugId=A311FE0D377E2D4464756E2164756E21
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../src/helpers/debounce.ts", "../src/tools/event-emitter.ts", "../src/helpers/create-event.ts", "../src/helpers/create-event-listener.ts", "../src/helpers/create-query.ts", "../src/helpers/create-query-slot.ts"],
|
|
3
|
+
"sources": ["../src/helpers/debounce.ts", "../src/tools/event-emitter.ts", "../src/helpers/create-event.ts", "../src/tools/escape-css-identifier.ts", "../src/helpers/create-event-listener.ts", "../src/helpers/create-query.ts", "../src/helpers/create-query-slot.ts"],
|
|
4
4
|
"sourcesContent": [
|
|
5
5
|
"import type { Method } from '../types';\n\n/**\n * A debounced function with imperative helpers for controlling pending work.\n *\n * @typeParam T The wrapped callback type.\n */\nexport interface DebouncedFunction<T extends Method> {\n\t(...args: Parameters<T>): void;\n\n\t/**\n\t * Cancels the pending callback invocation, if one exists.\n\t */\n\tcancel(): void;\n\n\t/**\n\t * Immediately invokes the latest pending callback invocation.\n\t *\n\t * @returns The callback result when a call is pending, or the last completed\n\t * result when no call is pending.\n\t */\n\tflush(): ReturnType<T> | undefined;\n\n\t/**\n\t * Reports whether the callback currently has a scheduled invocation.\n\t *\n\t * @returns True when a call is pending.\n\t */\n\tpending(): boolean;\n}\n\n/**\n * Creates a debounced wrapper around a function.\n *\n * The returned function delays invocation until the configured timeout has\n * elapsed since the latest call. It also exposes helpers to cancel, flush,\n * and inspect pending work.\n *\n * @typeParam T The wrapped callback type.\n * @param callback The callback to debounce.\n * @param timeout The debounce timeout in milliseconds.\n * @returns A debounced wrapper around the callback.\n */\nexport function debounce<T extends Method>(callback: T, timeout: number): DebouncedFunction<T> {\n\tlet timeoutRef: ReturnType<typeof setTimeout> | null = null;\n\tlet pendingInvocation: (() => ReturnType<T>) | null = null;\n\tlet lastResult: ReturnType<T> | undefined;\n\n\tconst clearPendingCall = () => {\n\t\tif (timeoutRef !== null) {\n\t\t\tclearTimeout(timeoutRef);\n\t\t\ttimeoutRef = null;\n\t\t}\n\t};\n\n\tconst invoke = (): ReturnType<T> | undefined => {\n\t\tif (pendingInvocation === null) {\n\t\t\treturn lastResult;\n\t\t}\n\n\t\tconst invocation = pendingInvocation;\n\t\tpendingInvocation = null;\n\t\tclearPendingCall();\n\t\tlastResult = invocation();\n\n\t\treturn lastResult;\n\t};\n\n\tconst debounced = function (this: ThisParameterType<T>, ...args: Parameters<T>) {\n\t\tpendingInvocation = () => callback.apply(this, args) as ReturnType<T>;\n\t\tclearPendingCall();\n\t\ttimeoutRef = setTimeout(() => {\n\t\t\tinvoke();\n\t\t}, timeout);\n\t} as DebouncedFunction<T>;\n\n\tdebounced.cancel = () => {\n\t\tclearPendingCall();\n\t\tpendingInvocation = null;\n\t};\n\n\tdebounced.flush = () => {\n\t\tif (pendingInvocation === null) {\n\t\t\treturn lastResult;\n\t\t}\n\n\t\treturn invoke();\n\t};\n\n\tdebounced.pending = () => pendingInvocation !== null;\n\n\treturn debounced;\n}\n",
|
|
6
6
|
"import type { RadiantElement } from '../core/radiant-element';\n\nexport interface EventEmitterConfig {\n\tname: string;\n\tbubbles?: boolean;\n\tcancelable?: boolean;\n\tcomposed?: boolean;\n}\n\n/**\n * A generic event emitter class that allows emitting custom events.\n *\n * @template T - The type of the event detail.\n */\nexport class EventEmitter<T = unknown> {\n\tprivate host: RadiantElement;\n\tprivate eventConfig: EventEmitterConfig;\n\n\t/**\n\t * Constructs a new instance of the EventEmitter class.\n\t *\n\t * @param host - The host element on which the events will be dispatched.\n\t * @param eventConfig - The configuration for the event.\n\t */\n\tconstructor(host: RadiantElement, eventConfig: EventEmitterConfig) {\n\t\tthis.host = host;\n\t\tthis.eventConfig = eventConfig;\n\t}\n\n\t/**\n\t * Emits a custom event with the specified detail.\n\t *\n\t * @param detail - The detail object to be passed along with the event.\n\t */\n\temit(detail?: T) {\n\t\tconst event = new CustomEvent(this.eventConfig.name, {\n\t\t\tdetail: detail,\n\t\t\tbubbles: this.eventConfig.bubbles,\n\t\t\tcancelable: this.eventConfig.cancelable,\n\t\t\tcomposed: this.eventConfig.composed,\n\t\t});\n\t\tthis.host.dispatchEvent(event);\n\t}\n}\n",
|
|
7
7
|
"import type { RadiantElement } from '../core/radiant-element';\nimport { EventEmitter, type EventEmitterConfig } from '../tools/event-emitter';\n\n/**\n * Creates an EventEmitter bound to a host element and registers it on the host.\n * Functional equivalent of the `@event` decorator for vanilla JS usage.\n * @param host The host element that will dispatch the events.\n * @param config {@link EventEmitterConfig} The event emitter configuration.\n */\nexport function createEvent<T = unknown>(host: RadiantElement, config: EventEmitterConfig): EventEmitter<T> {\n\tconst emitter = new EventEmitter<T>(host, config);\n\thost.registerEventEmitter(config.name, emitter);\n\treturn emitter;\n}\n",
|
|
8
|
-
"
|
|
8
|
+
"export function escapeCssIdentifier(value: string): string {\n\tconst cssNamespace = globalThis.CSS as { escape?: (value: string) => string } | undefined;\n\n\tif (typeof cssNamespace?.escape === 'function') {\n\t\treturn cssNamespace.escape(value);\n\t}\n\n\tlet escaped = '';\n\n\tfor (let index = 0; index < value.length; index += 1) {\n\t\tconst character = value[index] ?? '';\n\t\tconst codePoint = character.codePointAt(0) ?? 0;\n\n\t\tif (codePoint === 0) {\n\t\t\tescaped += '\\uFFFD';\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst isControlCharacter = (codePoint >= 0x0001 && codePoint <= 0x001f) || codePoint === 0x007f;\n\t\tconst startsWithDigit = index === 0 && codePoint >= 0x0030 && codePoint <= 0x0039;\n\t\tconst startsWithHyphenDigit =\n\t\t\tindex === 1 && codePoint >= 0x0030 && codePoint <= 0x0039 && (value[0] ?? '') === '-';\n\t\tconst isSingleHyphen = index === 0 && character === '-' && value.length === 1;\n\n\t\tif (isControlCharacter || startsWithDigit || startsWithHyphenDigit) {\n\t\t\tescaped += `\\\\${codePoint.toString(16)} `;\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (\n\t\t\tcodePoint >= 0x0080 ||\n\t\t\tcharacter === '-' ||\n\t\t\tcharacter === '_' ||\n\t\t\t(codePoint >= 0x0030 && codePoint <= 0x0039) ||\n\t\t\t(codePoint >= 0x0041 && codePoint <= 0x005a) ||\n\t\t\t(codePoint >= 0x0061 && codePoint <= 0x007a)\n\t\t) {\n\t\t\tescaped += isSingleHyphen ? `\\\\${character}` : character;\n\t\t\tcontinue;\n\t\t}\n\n\t\tescaped += `\\\\${character}`;\n\t}\n\n\treturn escaped;\n}\n",
|
|
9
|
+
"import type { RadiantElementEventListener } from '../core/radiant-element';\nimport { escapeCssIdentifier } from '../tools/escape-css-identifier';\n\n/**\n * Selects which DOM tree delegated event listeners should observe.\n */\nexport type OnEventScope = 'light' | 'shadow' | 'both';\n\ntype BaseOnEventConfig = Pick<RadiantElementEventListener, 'type' | 'options'> & {\n\tscope?: OnEventScope;\n};\n\nexport type OnEventConfig = BaseOnEventConfig &\n\t(\n\t\t| {\n\t\t\t\tselector: string;\n\t\t }\n\t\t| {\n\t\t\t\tref: string;\n\t\t }\n\t\t| {\n\t\t\t\twindow: true;\n\t\t }\n\t\t| {\n\t\t\t\tdocument: true;\n\t\t }\n\t);\n\ntype DelegatedEventRoot = Element | ShadowRoot;\n\ntype EventListenerLifecycleHost = {\n\tregisterConnectedCallback(callback: () => void): void;\n\tregisterCleanupCallback(callback: () => void): void;\n\tisConnected: boolean;\n};\n\nexport type EventListenerHost =\n\t| (EventListenerLifecycleHost & Element)\n\t| (EventListenerLifecycleHost & { host: Element })\n\t| (EventListenerLifecycleHost & { element: Element });\n\nconst shadowRootListenerHooksKey = Symbol('radiant.shadowRootListenerHooks');\nconst patchedAttachShadowKey = Symbol('radiant.patchedAttachShadow');\n\ntype ShadowRootHookHost = Element & {\n\t[patchedAttachShadowKey]?: true;\n\t[shadowRootListenerHooksKey]?: Set<() => void>;\n};\n\nfunction resolveEventListenerHostElement(host: EventListenerHost): Element {\n\tif (host instanceof Element) {\n\t\treturn host;\n\t}\n\n\tif ('host' in host) {\n\t\treturn host.host;\n\t}\n\n\treturn host.element;\n}\n\nfunction isControllerEventHost(host: EventListenerHost): host is EventListenerLifecycleHost & { host: Element } {\n\treturn !(host instanceof Element);\n}\n\nfunction addDelegatedListener(\n\troot: DelegatedEventRoot,\n\tconfig: Pick<OnEventConfig, 'type' | 'options'>,\n\tselector: string,\n\tlistener: EventListener,\n): () => void {\n\tconst delegatedListener = (event: Event) => {\n\t\tif (event.target instanceof Element && event.target.matches(selector)) {\n\t\t\tlistener(event);\n\t\t}\n\t};\n\n\troot.addEventListener(config.type, delegatedListener, config.options);\n\n\treturn () => {\n\t\troot.removeEventListener(config.type, delegatedListener, config.options);\n\t};\n}\n\nfunction registerShadowRootHook(host: EventListenerHost, hook: () => void): void {\n\tconst shadowAwareHost = resolveEventListenerHostElement(host) as ShadowRootHookHost;\n\n\tif (!shadowAwareHost[shadowRootListenerHooksKey]) {\n\t\tshadowAwareHost[shadowRootListenerHooksKey] = new Set();\n\t}\n\n\tshadowAwareHost[shadowRootListenerHooksKey].add(hook);\n\n\tif (shadowAwareHost[patchedAttachShadowKey]) {\n\t\treturn;\n\t}\n\n\tconst originalAttachShadow = shadowAwareHost.attachShadow;\n\n\tshadowAwareHost.attachShadow = function patchedAttachShadow(init: ShadowRootInit): ShadowRoot {\n\t\tconst shadowRoot = originalAttachShadow.call(this, init);\n\t\tfor (const shadowRootHook of shadowAwareHost[shadowRootListenerHooksKey] ?? []) {\n\t\t\tshadowRootHook();\n\t\t}\n\t\treturn shadowRoot;\n\t};\n\n\tshadowAwareHost[patchedAttachShadowKey] = true;\n}\n\n/**\n * Subscribes to a DOM event with delegation, window, or document targeting.\n * Functional equivalent of the `@onEvent` decorator for vanilla JS usage.\n * Returns a cleanup function to remove the listener.\n * @param host The host RadiantElement.\n * @param config The event listener configuration.\n * @param callback The event handler function.\n */\nexport function createEventListener(\n\thost: EventListenerHost,\n\tconfig: OnEventConfig,\n\tcallback: (event: Event) => void,\n): () => void {\n\tif (isControllerEventHost(host) && 'scope' in config && config.scope && config.scope !== 'light') {\n\t\tthrow new Error('RadiantController event listeners only support light DOM scope.');\n\t}\n\n\tconst hostElement = resolveEventListenerHostElement(host);\n\tconst boundCallback = callback.bind(host);\n\tlet windowCleanup: (() => void) | null = null;\n\tlet documentCleanup: (() => void) | null = null;\n\tlet lightCleanup: (() => void) | null = null;\n\tlet shadowCleanup: (() => void) | null = null;\n\tlet disposed = false;\n\n\tconst detachListeners = () => {\n\t\twindowCleanup?.();\n\t\tdocumentCleanup?.();\n\t\tlightCleanup?.();\n\t\tshadowCleanup?.();\n\n\t\twindowCleanup = null;\n\t\tdocumentCleanup = null;\n\t\tlightCleanup = null;\n\t\tshadowCleanup = null;\n\t};\n\n\tconst attachListeners = () => {\n\t\tif (disposed) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ('window' in config && !windowCleanup) {\n\t\t\twindow.addEventListener(config.type, boundCallback, config.options);\n\t\t\twindowCleanup = () => {\n\t\t\t\twindow.removeEventListener(config.type, boundCallback, config.options);\n\t\t\t};\n\t\t}\n\n\t\tif ('document' in config && !documentCleanup) {\n\t\t\tdocument.addEventListener(config.type, boundCallback, config.options);\n\t\t\tdocumentCleanup = () => {\n\t\t\t\tdocument.removeEventListener(config.type, boundCallback, config.options);\n\t\t\t};\n\t\t}\n\n\t\tif ('selector' in config || 'ref' in config) {\n\t\t\tconst selector = 'selector' in config ? config.selector : `[data-ref='${escapeCssIdentifier(config.ref)}']`;\n\n\t\t\tif (config.scope !== 'shadow' && !lightCleanup) {\n\t\t\t\tlightCleanup = addDelegatedListener(hostElement, config, selector, boundCallback);\n\t\t\t}\n\n\t\t\tif (config.scope !== 'light' && hostElement.shadowRoot && !shadowCleanup) {\n\t\t\t\tshadowCleanup = addDelegatedListener(hostElement.shadowRoot, config, selector, boundCallback);\n\t\t\t}\n\t\t}\n\t};\n\n\tif ('selector' in config || 'ref' in config) {\n\t\tif (config.scope !== 'light') {\n\t\t\tregisterShadowRootHook(host, () => {\n\t\t\t\tif (host.isConnected) {\n\t\t\t\t\tattachListeners();\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t}\n\n\thost.registerConnectedCallback(attachListeners);\n\thost.registerCleanupCallback(detachListeners);\n\n\tif (host.isConnected) {\n\t\tattachListeners();\n\t}\n\n\treturn () => {\n\t\tdisposed = true;\n\t\tdetachListeners();\n\t};\n}\n",
|
|
9
10
|
"type BaseQueryConfig = {\n\tall?: boolean;\n\tcache?: boolean;\n\tscope?: QueryScope;\n};\n\ntype QueryBySelector = { selector: string };\n\ntype QueryByRef = { ref: string };\n\nexport type QueryHostTarget = Element | { host: Element };\n\n/**\n * Selects which DOM tree a query should read from.\n */\nexport type QueryScope = 'light' | 'shadow' | 'both';\n\nexport type QueryConfig = BaseQueryConfig & (QueryBySelector | QueryByRef);\n\ntype QueryRoot = Element | ShadowRoot;\n\ntype QueryResult<T extends Element | Element[]> = {\n\tget value(): T | null;\n};\n\nfunction isControllerQueryTarget(target: QueryHostTarget): target is { host: Element } {\n\treturn !(target instanceof Element);\n}\n\nfunction resolveShadowRoot(host: Element): ShadowRoot | null {\n\treturn 'shadowRoot' in host ? ((host as Element & { shadowRoot?: ShadowRoot | null }).shadowRoot ?? null) : null;\n}\n\n/**\n * Resolves the DOM element that should serve as the query root.\n *\n * `@query(...)` can run on both element hosts and controller instances. This\n * helper normalizes those call sites to the underlying element that actually\n * owns the DOM subtree.\n */\nexport function resolveQueryHost(target: QueryHostTarget): Element {\n\treturn target instanceof Element ? target : target.host;\n}\n\nfunction getQueryRoots(host: Element, scope: QueryScope = 'light'): QueryRoot[] {\n\tconst shadowRoot = resolveShadowRoot(host);\n\n\tif (scope === 'shadow') {\n\t\treturn shadowRoot ? [shadowRoot] : [];\n\t}\n\n\tif (scope === 'both') {\n\t\treturn shadowRoot ? [host, shadowRoot] : [host];\n\t}\n\n\treturn [host];\n}\n\n/**\n * Creates a lazy DOM query accessor bound to an element host or controller.\n * Functional equivalent of the `@query` decorator for vanilla JS usage.\n * @param target The element host or controller to query within.\n * @param options {@link QueryConfig} The query configuration.\n */\nexport function createQuery<T extends Element | Element[] = Element>(\n\ttarget: QueryHostTarget,\n\toptions: QueryConfig,\n): QueryResult<T> {\n\tif (isControllerQueryTarget(target) && options.scope && options.scope !== 'light') {\n\t\tthrow new Error('RadiantController queries only support light DOM scope.');\n\t}\n\n\tconst host = resolveQueryHost(target);\n\tconst selector = 'selector' in options ? options.selector : `[data-ref=\"${options.ref}\"]`;\n\tlet cached: T | null = null;\n\n\tconst executeQuery = (): T | null => {\n\t\tconst roots = getQueryRoots(host, options.scope);\n\n\t\tif (options.all) {\n\t\t\treturn roots.flatMap((root) => Array.from(root.querySelectorAll(selector))) as T;\n\t\t}\n\n\t\tfor (const root of roots) {\n\t\t\tconst match = root.querySelector(selector);\n\t\t\tif (match) {\n\t\t\t\treturn match as T;\n\t\t\t}\n\t\t}\n\n\t\treturn null;\n\t};\n\n\treturn {\n\t\tget value(): T | null {\n\t\t\tif (options.cache) {\n\t\t\t\tif (cached === null || (options.all && Array.isArray(cached) && !cached.length)) {\n\t\t\t\t\tcached = executeQuery();\n\t\t\t\t}\n\t\t\t\treturn cached;\n\t\t\t}\n\t\t\treturn executeQuery();\n\t\t},\n\t};\n}\n",
|
|
10
|
-
"export type QuerySlotConfig = {\n\tall?: boolean;\n\tcache?: boolean;\n\tname?: string;\n};\n\ntype SlotQueryHost = HTMLElement & {\n\
|
|
11
|
+
"export type QuerySlotConfig = {\n\tall?: boolean;\n\tcache?: boolean;\n\tname?: string;\n};\n\ntype SlotQueryHost = HTMLElement & {\n\tgetSlotElements<T extends Element = Element>(name?: string): T[];\n};\n\ntype QuerySlotResult<T extends Element | Element[] | null> = {\n\tget value(): T | null;\n};\n\n/**\n * Creates a lazy slot query accessor bound to a host element.\n * Functional equivalent of the `@querySlot` decorator for vanilla JS usage.\n * @param host The host element to query slots within.\n * @param options {@link QuerySlotConfig} The slot query configuration.\n */\nexport function createQuerySlot<T extends Element | Element[] | null = Element | null>(\n\thost: SlotQueryHost,\n\toptions: QuerySlotConfig = {},\n): QuerySlotResult<T> {\n\tlet cached: T | null = null;\n\tlet cachedVersion: number | undefined;\n\n\tconst executeQuery = (): T | null => {\n\t\tif (options.all) {\n\t\t\treturn host.getSlotElements(options.name) as T;\n\t\t}\n\t\treturn (host.getSlotElements(options.name)[0] ?? null) as T | null;\n\t};\n\n\treturn {\n\t\tget value(): T | null {\n\t\t\tif (options.cache === false) {\n\t\t\t\treturn executeQuery();\n\t\t\t}\n\n\t\t\tconst currentVersion = (host as unknown as Record<string, number | undefined>).slotProjectionVersion ?? 0;\n\n\t\t\tif (cachedVersion !== currentVersion) {\n\t\t\t\tcached = executeQuery();\n\t\t\t\tcachedVersion = currentVersion;\n\t\t\t}\n\n\t\t\treturn cached;\n\t\t},\n\t};\n}\n"
|
|
11
12
|
],
|
|
12
|
-
"mappings": "2PA2CO,SAAS,CAA0B,CAAC,EAAa,EAAuC,CAC9F,IAAI,EAAmD,KACnD,EAAkD,KAClD,EAEE,EAAmB,IAAM,CAC9B,GAAI,IAAe,KAClB,aAAa,CAAU,EACvB,EAAa,MAIT,EAAS,IAAiC,CAC/C,GAAI,IAAsB,KACzB,OAAO,EAGR,IAAM,EAAa,EAKnB,OAJA,EAAoB,KACpB,EAAiB,EACjB,EAAa,EAAW,EAEjB,GAGF,EAAY,QAAS,IAAgC,EAAqB,CAC/E,EAAoB,IAAM,EAAS,MAAM,KAAM,CAAI,EACnD,EAAiB,EACjB,EAAa,WAAW,IAAM,CAC7B,EAAO,GACL,CAAO,GAkBX,OAfA,EAAU,OAAS,IAAM,CACxB,EAAiB,EACjB,EAAoB,MAGrB,EAAU,MAAQ,IAAM,CACvB,GAAI,IAAsB,KACzB,OAAO,EAGR,OAAO,EAAO,GAGf,EAAU,QAAU,IAAM,IAAsB,KAEzC,EC7ED,MAAM,CAA0B,CAC9B,KACA,YAQR,WAAW,CAAC,EAAsB,EAAiC,CAClE,KAAK,KAAO,EACZ,KAAK,YAAc,EAQpB,IAAI,CAAC,EAAY,CAChB,IAAM,EAAQ,IAAI,YAAY,KAAK,YAAY,KAAM,CACpD,OAAQ,EACR,QAAS,KAAK,YAAY,QAC1B,WAAY,KAAK,YAAY,WAC7B,SAAU,KAAK,YAAY,QAC5B,CAAC,EACD,KAAK,KAAK,cAAc,CAAK,EAE/B,CClCO,SAAS,CAAwB,CAAC,EAAsB,EAA6C,CAC3G,IAAM,EAAU,IAAI,EAAgB,EAAM,CAAM,EAEhD,OADA,EAAK,qBAAqB,EAAO,KAAM,CAAO,EACvC,
|
|
13
|
-
"debugId": "
|
|
13
|
+
"mappings": "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",
|
|
14
|
+
"debugId": "A311FE0D377E2D4464756E2164756E21",
|
|
14
15
|
"names": []
|
|
15
16
|
}
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var B0=((F)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(F,{get:(M,$)=>(typeof require<"u"?require:M)[$]}):F)(function(F){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+F+'" is not supported')});var n=Symbol.for("@ecopages/radiant.legacy-instance-initializers");function q(F,M){let H=F[n];if(Array.isArray(H)){H.push(M);return}Object.defineProperty(F,n,{value:[M],configurable:!0})}function w(F){let M=[],$=Object.getPrototypeOf(F);while($&&$!==Object.prototype)M.push($),$=Object.getPrototypeOf($);for(let H=M.length-1;H>=0;H-=1){let P=M[H][n];if(!Array.isArray(P))continue;for(let W of P)W(F)}}import{createSubscribableJsxValue as xM}from"@ecopages/jsx";import{trackDependency as jF}from"@ecopages/signals";class ZF{read;subscribers=new Set;watcherListeners=new Set;version=0;constructor(F){this.read=F}get(){return jF(this),this.read()}subscribe(F){return this.subscribers.add(F),()=>{this.subscribers.delete(F)}}addWatcher(F){return this.watcherListeners.add(F),()=>{this.watcherListeners.delete(F)}}getVersion(){return this.version}notify(F){this.version+=1;let M;try{this.notifyWatchers()}catch($){M=$}if(this.publish(F),M)throw M}publish(F){for(let M of this.subscribers)M(F)}notifyWatchers(){let F=[];for(let M of this.watcherListeners)try{M()}catch($){F.push($)}if(F.length===1)throw F[0];if(F.length>1)throw AggregateError(F,"Multiple reactive dependency notifications failed.")}}function AM(F){return typeof F==="object"&&F!==null&&typeof F.get==="function"}class k{host;access;shouldAutoBind;bindings;$;reactiveFields=new Map;reactiveDependencies=new Map;reactiveDependencyReaders=new Map;reactiveBindings=new Map;updateCallbacks=new Map;onConnectedCallbacks=[];onDisconnectedCallback=[];constructor(F,M,$){this.host=F;this.access=M;this.shouldAutoBind=$;let H=this.createReactiveBindingNamespace();this.bindings=H,this.$=H}connectHost(){for(let F of this.onConnectedCallbacks)F()}disconnectHost(){for(let F of this.onDisconnectedCallback)F()}notifyUpdate(F,M,$){if(M===$)return;this.reactiveDependencies.get(F)?.notify($);let H=this.updateCallbacks.get(F);if(H)for(let P of H)P()}registerCleanupCallback(F){this.onDisconnectedCallback.push(F)}registerConnectedCallback(F){this.onConnectedCallbacks.push(F)}registerHydrationBinding(F,M){}registerReactiveDependencyReader(F,M){this.reactiveDependencyReaders.set(F,M)}registerUpdateCallback(F,M){if(!this.updateCallbacks.has(F))this.updateCallbacks.set(F,new Set);let $=this.updateCallbacks.get(F);return $.add(M),()=>{if($.delete(M),$.size===0)this.updateCallbacks.delete(F)}}getReactiveBinding(F){let M=this.reactiveBindings.get(F);if(M)return M;let $=xM({getValue:()=>this.readReactiveBindingValue(F),subscribe:(H)=>this.registerUpdateCallback(F,()=>{H(this.readReactiveBindingValue(F))})});return this.reactiveBindings.set(F,$),$}bind(F){return this.getReactiveBinding(F)}defineReactiveBinding(F,M=!0){let $=typeof M==="string"?M:M?`$${F}`:void 0,H=this.access.getBindingTarget?.(this.host)??this.host;if(!$||this.access.hasProperty(this.host,$))return;this.access.defineProperty(H,$,{get:()=>this.getReactiveBinding(F),enumerable:!1,configurable:!0})}trackReactiveRead(F){jF(this.getReactiveDependency(F))}defineReactiveAccessor(F,M){let $=M.bind??this.shouldAutoBind();if(this.defineReactiveBinding(F,$),this.registerReactiveDependencyReader(F,M.getValue),this.access.defineProperty(this.host,F,{get:()=>{return this.trackReactiveRead(F),M.getValue()},set:(H)=>{let P=M.getValue();if(P===H)return;M.setValue(H),this.notifyUpdate(F,P,H)},enumerable:!0,configurable:!0}),M.notifyInitialValue!==void 0)this.notifyUpdate(F,void 0,M.notifyInitialValue)}createReactiveField(F,M,$={}){let H={name:F,value:M,initialValue:M};this.reactiveFields.set(F,H),this.defineReactiveAccessor(F,{bind:$.bind,getValue:()=>this.reactiveFields.get(F)?.value,setValue:(P)=>{this.reactiveFields.set(F,{...H,value:P})},notifyInitialValue:M})}createReactiveBindingNamespace(){return new Proxy(Object.create(null),{get:(F,M)=>{if(typeof M!=="string")return;return this.getReactiveBinding(M)}})}getReactiveDependency(F){let M=this.reactiveDependencies.get(F);if(M)return M;let $=new ZF(()=>this.readReactiveDependencyValue(F));return this.reactiveDependencies.set(F,$),$}readReactiveDependencyValue(F){let M=this.reactiveDependencyReaders.get(F);if(M)return M();return this.readReactiveBindingValue(F)}readReactiveBindingValue(F){let M=this.access.readProperty(this.host,F);if(AM(M))return M.get();return M}}var r=Symbol.for("@ecopages/radiant.ssr-preparation-callbacks"),XF=Symbol.for("@ecopages/radiant.ssr-preparation-running");function GF(F,M){let H=F[r];if(Array.isArray(H)){H.push(M);return}Object.defineProperty(F,r,{value:[M],configurable:!0})}function BF(F){let M=F,$=M[r];if(!Array.isArray($))return;M[XF]=!0;try{for(let H of $)H()}finally{delete M[XF]}}function QF(F){return F.replace(/&/g,"\\u0026").replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}var x="data-hydration",UF="data-hydration-type",o="data-hydration-key";function RF(F){let M=F.hydrationKey?` ${o}="${YM(F.hydrationKey)}"`:"";return`<script type="application/json" ${x} ${UF}="${F.type}"${M}>${F.serializedValue}</script>`}function DF(F){return QF(F)}function LF(F,M){let $=F.textContent;if(!$)return M;try{return JSON.parse($)}catch{if(typeof console<"u")console.warn(`[@ecopages/radiant] Failed to parse hydration payload from <script ${x}>:`,$.slice(0,120));return M}}function JF(F,M,$){let H=F.children;if(!H||H.length===0){let P=F.childNodes;if(!P||P.length===0)return null;for(let W=0;W<P.length;W+=1){let j=P[W];if(j.nodeType!==1)continue;let Z=j;if(qF(Z,M,$))return Z}return null}for(let P=0;P<H.length;P+=1)if(qF(H[P],M,$))return H[P];return null}function qF(F,M,$){if(F.tagName!=="SCRIPT"||!F.hasAttribute(x)||F.getAttribute(UF)!==M)return!1;if($!==void 0)return F.getAttribute(o)===$;return!F.hasAttribute(o)}function YM(F){return F.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}import{createMarkupNodeLike as zM,isKeyedJsxValue as xF,isSlotJsxValue as _M}from"@ecopages/jsx";var z="",O="data-radiant-slot-projection";function AF(F){let M=new Map;for(let $ of Array.from(F.childNodes)){if(IM($))continue;TM(M,KM($),$)}return M}function YF(F){let M;try{M=JSON.parse(F)}catch{if(typeof console<"u")console.warn("[@ecopages/radiant] Failed to parse slot projection payload:",F.slice(0,120));return new Map}let $=new Map;for(let[H,P]of Object.entries(M)){if(!Array.isArray(P)||P.length===0)continue;$.set(a(H),P.map((W)=>zM(W)))}return $}function zF(F){let M=Array.from(F.childNodes).filter(($)=>EF($)).map(($)=>C($)??"").filter(($)=>$!=="");return M.length>0?M.join(""):void 0}function _F(F){let M={};for(let[$,H]of F.entries()){let P=H.map((W)=>C(W)).filter((W)=>W!==void 0&&W!=="");if(P.length>0)M[$]=P}return Object.keys(M).length>0?JSON.stringify(M):void 0}function TF(F,M){let $=!1,H=(W)=>{if(_M(W))return $=!0,wM(W,M,H);if(xF(W))return kM(W,H(W.value));if(EM(W))return{_$rType$:1,rootLocalName:W.rootLocalName,strings:W.strings,values:W.values.map((j)=>H(j))};if(KF(W))return Array.from(W,(j)=>H(j));return W},P=H(F);return{containsSlots:$,value:P}}function kF(F){for(let M of Array.from(F.childNodes)){if(!IF(M))continue;let $=M.textContent??void 0;return M.parentNode?.removeChild(M),$}return}function TM(F,M,$){let H=F.get(M);if(H){H.push($);return}F.set(M,[$])}function kM(F,M){return{...F,value:M}}function KM(F){if(F instanceof Element)return a(F.getAttribute("slot"));return z}function KF(F){return typeof F!=="string"&&typeof F==="object"&&F!==null&&Symbol.iterator in F}function IF(F){return F instanceof HTMLScriptElement&&F.hasAttribute(O)}function EF(F){return F instanceof HTMLScriptElement&&F.hasAttribute(x)}function IM(F){return IF(F)||EF(F)}function EM(F){return typeof F==="object"&&F!==null&&F._$rType$===1&&Array.isArray(F.strings)&&Array.isArray(F.values)}function a(F){return F??z}function C(F){if(F===void 0||F===null||F===!1||F===!0)return;if(typeof Node<"u"&&F instanceof Node){if(F.nodeType===Node.TEXT_NODE)return F.textContent??"";return F.outerHTML??F.textContent??void 0}if(xF(F))return C(F.value);if(typeof F==="string"||typeof F==="number"||typeof F==="bigint")return String(F);if(typeof F==="object"&&F!==null&&"outerHTML"in F)return typeof F.outerHTML==="string"?F.outerHTML:F.textContent??void 0;if(KF(F))return Array.from(F,(M)=>C(M)??"").join("");return}function wM(F,M,$){let H=M.get(a(F.name));if(H&&H.length>0)return H.length===1?H[0]:H;if(F.fallback===void 0)return"";return $(F.fallback)}var t=Symbol.for("@ecopages/radiant.hydrator-installed");function T0(){globalThis[t]=!0}function k0(){delete globalThis[t]}function wF(){return globalThis[t]===!0}var CF=Symbol.for("@ecopages/radiant.component-ssr-runtime");function OF(){return globalThis[CF]}function I0(F){globalThis[CF]=F}function VF(F){switch(F){case Array:return"array";case Boolean:return"boolean";case Number:return"number";case Object:return"object";case String:return"string"}}function CM(F){switch(typeof F){case"boolean":return"boolean";case"number":return"number";case"string":return"string"}if(Array.isArray(F))return"array";if(Object.prototype.toString.call(F)==="[object Object]")return"object"}function K(F){switch(F){case Number:return 0;case String:return"";case Boolean:return!1;default:return null}}function OM(F){try{return JSON.parse(F)}catch{throw TypeError("Invalid JSON string")}}var SM={array(F){let M=OM(F);if(!Array.isArray(M))throw TypeError(`Expected an array but got a value of type "${typeof M}"`);return M},boolean(F){return!(F==="0"||String(F).toLowerCase()==="false")},number(F){return Number(F.replace(/_/g,""))},object(F){let M=JSON.parse(F);if(M===null||typeof M!=="object"||Array.isArray(M))throw TypeError(`expected value of type "object" but instead got value "${F}" of type "${CM(M)}"`);return M},string(F){return F}},SF={default:bF,array:fF,object:fF};function fF(F){return JSON.stringify(F)}function bF(F){return`${F}`}function _(F,M){let $=VF(M);if(!$)throw TypeError(`[radiant-element] Unknown type "${M}"`);return SM[$](F)}function S(F,M){let $=VF(M);if(!$)throw TypeError(`[radiant-element] Unknown type "${M}"`);return(SF[$]??SF.default??bF)(F)}function fM(F){return typeof F==="boolean"}function VM(F){return typeof F==="number"}function bM(F){return typeof F==="string"}function NM(F){return Array.isArray(F)}function vM(F){return typeof F==="object"&&!Array.isArray(F)&&F!==null}function D(F,M){switch(F){case Boolean:return fM(M);case Number:return VM(M);case String:return bM(M);case Array:return NM(M);case Object:return vM(M);default:return!1}}var NF=(F,M,$,H)=>{if(M===Boolean){let W=F.getAttribute($);if(W===null)return H;return W===""?!0:_(W,M)}let P=F.getAttribute($);return P!==null?_(P,M):H??K(M)};import{hasHydrationMarkers as hM,hydrate as gM,jsx as uM,render as yM}from"@ecopages/jsx";import{Computed as mM,subtle as cM}from"@ecopages/signals";var dM=sM();function sM(){if(typeof HTMLElement<"u")return HTMLElement;throw Error("RadiantElement requires HTMLElement. Install '@ecopages/radiant/server/light-dom-shim' before importing Radiant components in SSR.")}class V extends dM{bindings;$;reactiveHost;reactiveProperties=new Map;contextProviders=new Map;hydrationBindings=new Map;eventSubscriptions=new Map;eventEmitters=new Map;elementReady=!1;isRendering=!1;isFirstConnectPending=!1;isRenderScheduled=!1;needsRender=!1;preUpgradePropertyValues=new Map;projectedSlotContent=new Map;renderSignal;renderWatcher=new cM.Watcher(()=>{this.requestUpdate()});slotProjectionObserver;slotProjectionVersion=0;constructor(){super();for(let F of Object.getOwnPropertyNames(this))this.preUpgradePropertyValues.set(F,this[F]);this.reactiveHost=new k(this,{defineProperty:(F,M,$)=>Object.defineProperty(F,M,$),getBindingTarget:(F)=>Object.getPrototypeOf(F)??F,hasProperty:(F,M)=>(M in F),readProperty:(F,M)=>F[M]},()=>this.shouldAutoBindReactiveMembers()),this.bindings=this.reactiveHost.bindings,this.$=this.reactiveHost.$,w(this)}connectedCallback(){let F=this.isFirstConnectPending;if(this.elementReady=!0,this.reactiveHost.connectHost(),F)return;this.isFirstConnectPending=!0,queueMicrotask(()=>{if(this.isFirstConnectPending=!1,!this.isConnected)return;if(!this.shouldRunRenderLifecycle())return;if(this.ensureSlotProjectionState(),this.observeSlotProjection(),vF(this)){if(this.needsRender=!1,this.hydrate(),this.needsRender)this.update();return}this.update()})}connectedContextCallback(F){}disconnectedCallback(){this.disconnectSlotProjectionObserver(),this.disconnectRenderWatcher(),this.removeAllSubscribedEvents(),this.reactiveHost.disconnectHost()}notifyUpdate(F,M,$){this.reactiveHost.notifyUpdate(F,M,$)}transformAttributeValue(F,M){return F!==null?M?.converter.fromAttribute(F):F}attributeChangedCallback(F,M,$){if(M===$||!this.elementReady)return;if(this.reactiveProperties.has(F)){let H=this.reactiveProperties.get(F),P=this.transformAttributeValue($,H),W=this.transformAttributeValue(M,H),j=H?H.attribute:F;this[j]=P,this.notifyUpdate(F,W,P)}}renderTemplate({target:F=this,template:M,insert:$="replace",sanitize:H}){let P=H?H(M):M;switch($){case"replace":F.innerHTML=P;break;case"beforeend":F.insertAdjacentHTML("beforeend",P);break;case"afterbegin":F.insertAdjacentHTML("afterbegin",P);break;case"beforebegin":F.insertAdjacentHTML("beforebegin",P);break;case"afterend":F.insertAdjacentHTML("afterend",P);break}}render(){return uM("slot",{})}renderToString(F={}){if(!this.shouldRunRenderLifecycle())return this.innerHTML;return this.prepareForSsr(),f().renderView(this,F)}renderHost(){return f().renderHost(this)}renderHostToString(F={}){return f().renderHostToString(this,F)}hydrate(){if(!this.shouldRunRenderLifecycle()||!this.isConnected||this.isRendering)return;this.isRendering=!0,this.disconnectSlotProjectionObserver();try{gM(this.resolveTrackedRenderOutput().value,this)}finally{this.isRendering=!1,this.observeSlotProjection()}}requestUpdate(){if(!this.shouldRunRenderLifecycle())return;if(this.needsRender=!0,this.isRenderScheduled)return;this.isRenderScheduled=!0,queueMicrotask(()=>{if(this.isRenderScheduled=!1,!this.needsRender)return;this.update()})}update(){if(!this.shouldRunRenderLifecycle())return;if(this.needsRender=!0,!this.isConnected||this.isRendering)return;if(this.isFirstConnectPending&&vF(this))return;while(this.needsRender&&this.isConnected){this.needsRender=!1,this.isRendering=!0,this.disconnectSlotProjectionObserver();try{yM(this.resolveTrackedRenderOutput().value,this)}finally{this.isRendering=!1,this.observeSlotProjection()}}}registerReactiveProperty(F){this.reactiveProperties.set(F.name,F)}getReactiveProperties(){return Array.from(this.reactiveProperties.values())}registerReactiveDependencyReader(F,M){this.reactiveHost.registerReactiveDependencyReader(F,M)}registerContextProvider(F,M){this.contextProviders.set(F,M),this.registerHydrationBinding(F,M)}registerHydrationBinding(F,M){this.hydrationBindings.set(F,M)}getContextProviders(){return Array.from(this.contextProviders.values())}getHydrationBindings(){return Array.from(this.hydrationBindings.values())}prepareForSsr(){BF(this)}shouldAutoBindReactiveMembers(){return!0}shouldRunRenderLifecycle(){return this.render!==V.prototype.render}getHostSsrAttributes(){return f().getHostAttributes(this)}resolveSsrRenderBridge(){let F={};if(this.renderHostToString===V.prototype.renderHostToString)F.renderHostToString=(M)=>this.renderHostToString(M);if(this.renderHost===V.prototype.renderHost)F.renderHost=()=>this.renderHost();return F}registerUpdateCallback(F,M){return this.reactiveHost.registerUpdateCallback(F,M)}getReactiveBinding(F){return this.reactiveHost.getReactiveBinding(F)}bind(F){return this.reactiveHost.bind(F)}defineReactiveBinding(F,M=!0){this.reactiveHost.defineReactiveBinding(F,M)}trackReactiveRead(F){this.reactiveHost.trackReactiveRead(F)}subscribeEvents(F){let M=[];for(let $ of F)M.push(this.subscribeEvent($));return M}subscribeEvent(F){let M=(H)=>{if(H.target&&H.target.matches(F.selector))F.listener.call(this,H)},$=`${F.type}:${F.selector}`;return this.addEventListener(F.type,M,F.options),this.eventSubscriptions.set($,{...F,listener:M}),this.unsubscribeEvent.bind(this,$)}unsubscribeEvent(F){let M=this.eventSubscriptions.get(F);if(M)this.removeEventListener(M.type,M.listener,M.options),this.eventSubscriptions.delete(F)}removeAllSubscribedEvents(){for(let F of this.eventSubscriptions.values())this.removeEventListener(F.type,F.listener,F.options);this.eventSubscriptions.clear()}registerCleanupCallback(F){this.reactiveHost.registerCleanupCallback(F)}registerConnectedCallback(F){this.reactiveHost.registerConnectedCallback(F)}registerEventEmitter(F,M){this.eventEmitters.set(F,M)}getRef(F,M=!1){let $=`[data-ref="${F}"]`;if(M)return Array.from(this.querySelectorAll($));return this.querySelector($)??null}getSlotElement(F){return this.getSlotElements(F)[0]??null}getSlotElements(F){return this.ensureSlotProjectionState(),(this.projectedSlotContent.get(F??z)??[]).filter((M)=>typeof Node<"u"&&M instanceof Element)}createReactiveField(F,M,$={}){this.reactiveHost.createReactiveField(F,M,$)}createReactiveProp(F,M){let{type:$,attribute:H,reflect:P,defaultValue:W}=M,j=H??F,Z=this.preUpgradePropertyValues.has(F),X=Z?this.preUpgradePropertyValues.get(F):void 0;if(W!==void 0&&!D($,W))throw Error(`defaultValue does not match the expected type for ${$.name}`);let G=Z?X:NF(this,$,j,W);if(this.hasAttribute(j)&&(!P||G==null||G===""))this.removeAttribute(j);if(Z&&Object.prototype.hasOwnProperty.call(this,F))Reflect.deleteProperty(this,F);let Q={type:$,name:F,value:G,initialValue:G,attribute:j,converter:{fromAttribute:(B)=>_(B,$),toAttribute:(B)=>S(B,$)}};this.registerReactiveProperty(Q);let U=(B)=>{if(P)if(B==null||B===""||B===!1)this.removeAttribute(j);else{let L=Q.converter.toAttribute(B);this.setAttribute(j,L)}};if(this.reactiveHost.defineReactiveAccessor(F,{bind:M.bind,getValue:()=>this.reactiveProperties.get(F)?.value,setValue:(B)=>{this.reactiveProperties.set(F,{...Q,value:B}),U(B)}}),G!==void 0)queueMicrotask(()=>{let B=this.reactiveProperties.get(F)?.value;if(B===void 0)return;U(B),this.notifyUpdate(F,void 0,B)})}ensureSlotProjectionState(){if(this.projectedSlotContent.size>0)return;let F=this.isConnected?kF(this):void 0;if(typeof F==="string"&&F!==""){this.projectedSlotContent=YF(F),this.slotProjectionVersion+=1;return}if(this.getHostChildNodeCount()>0)this.projectedSlotContent=AF(this),this.slotProjectionVersion+=1}getHostChildNodeCount(){return"childNodes"in this&&this.childNodes?this.childNodes.length:0}getSlotProjectionScriptTag(){this.ensureSlotProjectionState();let F=_F(this.projectedSlotContent);if(!F)return;return`<script type="application/json" ${O}>${pM(F)}</script>`}getAuthoredHydrationScriptMarkup(){let F=zF(this);if(F)return F;return}handleSlotProjectionMutations(F){let M=!1;for(let $ of F){for(let H of Array.from($.removedNodes))if(this.removeProjectedSlotNode(H))M=!0;for(let H of Array.from($.addedNodes)){if(H.parentNode!==this)continue;if(this.addProjectedSlotNode(H))M=!0}}if(M)this.slotProjectionVersion+=1,this.update()}addProjectedSlotNode(F){if(F instanceof HTMLScriptElement&&(F.hasAttribute(O)||F.hasAttribute(x)))return!1;let M=F instanceof Element?F.getAttribute("slot")??z:z,$=this.projectedSlotContent.get(M);if($){if($.includes(F))return!1;return $.push(F),!0}return this.projectedSlotContent.set(M,[F]),!0}removeProjectedSlotNode(F){for(let[M,$]of this.projectedSlotContent.entries()){let H=$.indexOf(F);if(H===-1)continue;if($.splice(H,1),$.length===0)this.projectedSlotContent.delete(M);return!0}return!1}observeSlotProjection(){if(typeof MutationObserver>"u"||this.slotProjectionObserver||!this.isConnected)return;this.slotProjectionObserver=new MutationObserver((F)=>this.handleSlotProjectionMutations(F)),this.slotProjectionObserver.observe(this,{childList:!0})}disconnectSlotProjectionObserver(){this.slotProjectionObserver?.disconnect(),this.slotProjectionObserver=void 0}disconnectRenderWatcher(){if(!this.renderSignal)return;this.renderWatcher.unwatch(this.renderSignal),this.renderSignal=void 0}resolveTrackedRenderOutput(){let F=new mM(()=>this.resolveRenderOutput()),M=F.get();if(!this.isConnected)return M;if(this.renderSignal)this.renderWatcher.unwatch(this.renderSignal);return this.renderSignal=F,this.renderWatcher.watch(F),M}resolveRenderOutput(){return this.ensureSlotProjectionState(),TF(this.render(),this.projectedSlotContent)}}function f(){let F=OF();if(!F)throw Error("Radiant SSR runtime is unavailable. Import `@ecopages/radiant/server/render-component` before using instance SSR methods.");return F}function vF(F){return wF()&&hM(F)}function pM(F){return F.replace(/</g,"\\u003c")}import{render as iM}from"@ecopages/jsx";import{Computed as lM,subtle as nM}from"@ecopages/signals";class hF{host;element;bindings;$;reactiveHost;connected=!1;isRendering=!1;isRenderScheduled=!1;needsRender=!1;renderSignal;renderWatcher=new nM.Watcher(()=>{this.requestUpdate()});constructor(F){this.host=F,this.element=F,this.reactiveHost=new k(this,{defineProperty:(M,$,H)=>Object.defineProperty(M,$,H),hasProperty:(M,$)=>($ in M),readProperty:(M,$)=>M[$]},()=>this.shouldAutoBindReactiveMembers()),this.bindings=this.reactiveHost.bindings,this.$=this.reactiveHost.$,w(this)}connect(){if(this.connected=!0,this.reactiveHost.connectHost(),this.shouldRunRenderLifecycle())this.update()}connectForSsrRender(){this.connected=!0,this.reactiveHost.connectHost()}disconnect(){this.connected=!1,this.disconnectRenderWatcher(),this.reactiveHost.disconnectHost()}disconnectForSsrRender(){this.disconnectRenderWatcher(),this.reactiveHost.disconnectHost(),this.connected=!1}get isConnected(){return this.connected}render(){return null}requestUpdate(){if(!this.shouldRunRenderLifecycle())return;if(this.needsRender=!0,this.isRenderScheduled)return;this.isRenderScheduled=!0,queueMicrotask(()=>{if(this.isRenderScheduled=!1,!this.needsRender)return;this.update()})}update(){if(!this.shouldRunRenderLifecycle())return;let F=this.getRenderTarget();if(!F)return;if(this.needsRender=!0,!this.connected||this.isRendering)return;while(this.needsRender){this.needsRender=!1,this.isRendering=!0;try{iM(this.resolveTrackedRenderOutput(),F)}finally{this.isRendering=!1}}}bind(F){return this.reactiveHost.bind(F)}getReactiveBinding(F){return this.reactiveHost.getReactiveBinding(F)}createReactiveField(F,M,$={}){this.reactiveHost.createReactiveField(F,M,$)}createReactiveProp(F,M){let{type:$,defaultValue:H,bind:P}=M;if(H!==void 0&&!D($,H))throw Error(`defaultValue does not match the expected type for ${$.name}`);let W=Object.getOwnPropertyDescriptor(this.host,F),j=this.host,X=j[F]??H??K($);this.reactiveHost.defineReactiveAccessor(F,{bind:P,getValue:()=>X,setValue:(G)=>{X=G},notifyInitialValue:X}),Object.defineProperty(this.host,F,{get:()=>this[F],set:(G)=>{this[F]=G},enumerable:W?.enumerable??!0,configurable:!0}),this.registerCleanupCallback(()=>{let G=this[F];if(W){if(Object.defineProperty(this.host,F,W),"value"in W&&W.writable)j[F]=G;return}delete j[F];try{j[F]=G}catch{Object.defineProperty(this.host,F,{value:G,writable:!0,enumerable:!0,configurable:!0})}})}defineReactiveBinding(F,M=!0){this.reactiveHost.defineReactiveBinding(F,M)}notifyUpdate(F,M,$){this.reactiveHost.notifyUpdate(F,M,$)}registerUpdateCallback(F,M){return this.reactiveHost.registerUpdateCallback(F,M)}connectedContextCallback(F){}registerContextProvider(F,M){}registerHydrationBinding(F,M){}registerCleanupCallback(F){this.reactiveHost.registerCleanupCallback(F)}registerConnectedCallback(F){this.reactiveHost.registerConnectedCallback(F)}registerReactiveDependencyReader(F,M){this.reactiveHost.registerReactiveDependencyReader(F,M)}trackReactiveRead(F){this.reactiveHost.trackReactiveRead(F)}addEventListener(F,M,$){this.host.addEventListener(F,M,$)}removeEventListener(F,M,$){this.host.removeEventListener(F,M,$)}dispatchEvent(F){return this.host.dispatchEvent(F)}getRef(F,M=!1){let $=`[data-ref="${F}"]`;if(M)return Array.from(this.host.querySelectorAll($));return this.host.querySelector($)??null}shouldAutoBindReactiveMembers(){return!0}shouldRunRenderLifecycle(){return this.render!==hF.prototype.render}getRenderTarget(){return this.host instanceof HTMLElement?this.host:null}disconnectRenderWatcher(){if(!this.renderSignal)return;this.renderWatcher.unwatch(this.renderSignal),this.renderSignal=void 0}resolveTrackedRenderOutput(){let F=new lM(()=>this.render()),M=F.get();if(!this.connected)return M;if(this.renderSignal)this.renderWatcher.unwatch(this.renderSignal);return this.renderSignal=F,this.renderWatcher.watch(F),M}}var gF=Symbol.for("@ecopages/radiant.controllerIdentifier");function e(F,M){F[gF]=M}function i0(F){return F[gF]}var N="data-controller",uF=Symbol.for("@ecopages/radiant.controller-registry-state");function rM(){let F=globalThis,M=F[uF];if(M)return M;let $={activeRuntimes:new Set,controllerRegistrationStrategy:"keep-current",controllerRegistry:new Map};return F[uF]=$,$}var v=rM(),A=v.controllerRegistry,T=v.activeRuntimes;function yF(F){let M=F.getAttribute(N);if(!M)return[];return M.split(/\s+/).map(($)=>$.trim()).filter(($)=>$.length>0)}function b(F,M){if(F instanceof Element&&F.hasAttribute(N))M(F);for(let $ of Array.from(F.querySelectorAll(`[${N}]`)))M($)}class mF{root;controllersByElement=new Map;observer;stopped=!1;constructor(F=document){this.root=F;this.start()}stop(){if(this.stopped)return;this.stopped=!0,this.observer?.disconnect(),this.observer=void 0;for(let[F,M]of this.controllersByElement)for(let[$]of M)this.disconnectController(F,$);T.delete(this)}reconcileRegisteredController(F){b(this.root,(M)=>{if(!yF(M).includes(F))return;this.connectController(M,F)})}replaceRegisteredController(F){for(let[M,$]of Array.from(this.controllersByElement.entries())){if(!$.has(F))continue;this.disconnectController(M,F)}this.reconcileRegisteredController(F)}start(){if(b(this.root,(M)=>{this.reconcileElement(M)}),typeof MutationObserver>"u"){T.add(this);return}this.observer=new MutationObserver((M)=>{for(let $ of M){if($.type==="attributes"&&$.target instanceof Element){this.reconcileElement($.target);continue}for(let H of Array.from($.removedNodes)){if(!(H instanceof Element))continue;b(H,(P)=>{this.disconnectElementControllers(P)})}for(let H of Array.from($.addedNodes)){if(!(H instanceof Element))continue;b(H,(P)=>{this.reconcileElement(P)})}}});let F=this.root instanceof Document?this.root.documentElement:this.root;this.observer.observe(F,{attributeFilter:[N],attributes:!0,childList:!0,subtree:!0}),T.add(this)}reconcileElement(F){let M=new Set(yF(F)),$=this.controllersByElement.get(F);if($){for(let H of $.keys())if(!M.has(H))this.disconnectController(F,H)}for(let H of M)this.connectController(F,H)}connectController(F,M){let $=A.get(M);if(!$)return;let H=this.controllersByElement.get(F);if(!H)H=new Map,this.controllersByElement.set(F,H);if(H.has(M))return;let P=new $(F);H.set(M,P),P.connect()}disconnectController(F,M){let $=this.controllersByElement.get(F);if(!$)return;let H=$.get(M);if(!H)return;if(H.disconnect(),$.delete(M),$.size===0)this.controllersByElement.delete(F)}disconnectElementControllers(F){let M=this.controllersByElement.get(F);if(!M)return;for(let $ of Array.from(M.keys()))this.disconnectController(F,$)}}function oM(F,M){let $=A.get(F);if($)return $;e(M,F),A.set(F,M);for(let H of Array.from(T))H.reconcileRegisteredController(F);return M}function r0(F){return A.has(F)}function o0(F){return A.get(F)}function aM(F,M){if(A.get(F)===M)return M;e(M,F),A.set(F,M);for(let H of Array.from(T))H.replaceRegisteredController(F);return M}function cF(F){v.controllerRegistrationStrategy=F}function a0(){cF("replace")}function t0(){cF("keep-current")}function dF(F,M){if(v.controllerRegistrationStrategy==="replace")return aM(F,M);return oM(F,M)}function e0(F=document){return new mF(F)}function F2(){for(let F of Array.from(T))F.stop()}function tM(F){return typeof F==="function"}function R(F,M,$,H){if(typeof H==="object")return F(void 0,H);return M($,H)}function J(F,M,$,H,P){if(typeof H==="object"){if(!tM($))throw TypeError("Standard method decorators require a method target");return F($,H)}if(!P)throw TypeError("Legacy method decorators require a property descriptor");return M($,H,P)}function FF(F){if(F instanceof Element)return F;if("host"in F)return F.host;return F.element}function eM(F){return F.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/_/g,"-").toLowerCase()}function F0(F,M){if(M.converter?.fromAttribute){let $=M.converter.fromAttribute(F);if(F===null&&$===void 0&&"defaultValue"in M)return M.defaultValue;return $}if(M.type){if(F===null)return M.defaultValue??K(M.type);if(M.type===Boolean&&F==="")return!0;return _(F,M.type)}if(F===null)return M.defaultValue;return F}function Y(F,M,$){return F0(FF(F).getAttribute(M),$)}function M0(F,M,$,H){let P=H.converter?.toAttribute?H.converter.toAttribute($):H.type?S($,H.type):$==null?null:String($);if(P===null){F.removeAttribute(M);return}F.setAttribute(M,P)}function h(F,M,$={}){if($.type&&$.defaultValue!==void 0&&!D($.type,$.defaultValue))throw Error(`defaultValue does not match the expected type for ${$.type.name}`);let H=F,P=$.source??eM(M),W=Symbol(`@ecopages/radiant/attr:${M}:observer`),j=Symbol(`@ecopages/radiant/attr:${M}:last-value`),Z=$.bind??F.shouldAutoBindReactiveMembers?.()??!1;F.defineReactiveBinding(M,Z),F.registerReactiveDependencyReader(M,()=>Y(F,P,$)),H[j]=Y(F,P,$),Object.defineProperty(F,M,{get(){return F.trackReactiveRead(M),Y(this,P,$)},set(Q){let U=FF(this),B=Y(this,P,$);M0(U,P,Q,$);let L=Y(this,P,$);if(Object.is(B,L))return;this[j]=L,F.notifyUpdate(M,B,L)},enumerable:!0,configurable:!0});let X=()=>{H[W]?.disconnect()},G=()=>{let Q=Y(F,P,$),U=H[j];if(!Object.is(U,Q))H[j]=Q,F.notifyUpdate(M,U,Q);if(typeof MutationObserver>"u")return;let B=FF(F);X();let L=new MutationObserver(()=>{let l=Y(F,P,$),WF=H[j];if(Object.is(WF,l))return;H[j]=l,F.notifyUpdate(M,WF,l)});L.observe(B,{attributeFilter:[P],attributes:!0}),H[W]=L};G(),F.registerConnectedCallback(G),F.registerCleanupCallback(X)}function sF(F={}){return(M,$)=>{let H=Symbol(`@ecopages/radiant/attr:${$}:installed`);q(M,(P)=>{P.registerConnectedCallback(()=>{if(P[H])return;let W=P[$],j=F.defaultValue===void 0?W:F.defaultValue;h(P,$,{...F,defaultValue:j}),P[H]=!0})})}}function pF(F={}){return function(M,$){let H=String($.name),P=Symbol(`@ecopages/radiant/attr:${H}:initializer`);return $.addInitializer(function(){let W=this[P],j=F.defaultValue===void 0?W:F.defaultValue;h(this,H,{...F,defaultValue:j})}),function(W){return this[P]=W,W}}}function U2(F={}){function M($,H){return R(pF(F),sF(F),$,H)}return M}function iF(F,M,$){let H=$.value;return{configurable:!0,get(){if(this===F.prototype||Object.prototype.hasOwnProperty.call(this,M))return H;let P=H.bind(this);return Object.defineProperty(this,M,{value:P,configurable:!0,writable:!0}),P}}}function lF(F,M){let $=String(M.name);if(M.private)throw Error(`'bound' cannot decorate private properties like ${$}.`);M.addInitializer(function(){this[$]=this[$].bind(this)})}function Y2(F,M,$){return J(lF,iF,F,M,$)}function T2(F){return function(M){return dF(F,M)}}var nF=Symbol.for("@ecopages/radiant.customElementTagName");function g(F,M){F[nF]=M}function K2(F){return F[nF]}function rF(F,M){return($)=>{if(g($,F),typeof customElements<"u"&&!customElements.get(F))customElements.define(F,$,M)}}function oF(F,M){return function($,H){H.addInitializer(function(){if(g(this,F),typeof customElements<"u"&&!customElements.get(F))customElements.define(F,this,M)})}}function V2(F,M){function $(H,P){if(typeof P<"u")return oF(F,M)(H,P);return rF(F,M)(H)}return $}function u(F,M){let $=null,H=null,P,W=()=>{if($!==null)clearTimeout($),$=null},j=()=>{if(H===null)return P;let X=H;return H=null,W(),P=X(),P},Z=function(...X){H=()=>F.apply(this,X),W(),$=setTimeout(()=>{j()},M)};return Z.cancel=()=>{W(),H=null},Z.flush=()=>{if(H===null)return P;return j()},Z.pending=()=>H!==null,Z}function aF(F){return(M,$,H)=>{let P=H.value,W=new WeakMap;return H.value=function(...Z){let X=W.get(this);if(!X)X=u((...G)=>{return P.apply(this,G)},F),W.set(this,X);X(...Z)},H}}function tF(F){return(M)=>{let $=new WeakMap;return function(...H){let P=$.get(this);if(!P)P=u((...W)=>{return M.apply(this,W)},F),$.set(this,P);P(...H)}}}function d2(F){function M($,H,P){return J(tF(F),aF(F),$,H,P)}return M}class MF{host;eventConfig;constructor(F,M){this.host=F,this.eventConfig=M}emit(F){let M=new CustomEvent(this.eventConfig.name,{detail:F,bubbles:this.eventConfig.bubbles,cancelable:this.eventConfig.cancelable,composed:this.eventConfig.composed});this.host.dispatchEvent(M)}}function y(F,M){let $=new MF(F,M);return F.registerEventEmitter(M.name,$),$}function eF(F){return(M,$)=>{q(M,(H)=>{let P=y(H,F);H.registerConnectedCallback(()=>{Object.defineProperty(H,$,{get(){return P},enumerable:!0,configurable:!0})})})}}function FM(F){return function(M,$){$.addInitializer(function(){let H=y(this,F);Object.defineProperty(this,$.name,{get(){return H},enumerable:!0,configurable:!0})})}}function $$(F){function M($,H){return R(FM(F),eF(F),$,H)}return M}var m=Symbol("radiant.shadowRootListenerHooks"),MM=Symbol("radiant.patchedAttachShadow");function HM(F){if(F instanceof Element)return F;if("host"in F)return F.host;return F.element}function $0(F){return!(F instanceof Element)}function $M(F,M,$,H){let P=(W)=>{if(W.target instanceof Element&&W.target.matches($))H(W)};return F.addEventListener(M.type,P,M.options),()=>{F.removeEventListener(M.type,P,M.options)}}function H0(F,M){let $=HM(F);if(!$[m])$[m]=new Set;if($[m].add(M),$[MM])return;let H=$.attachShadow;$.attachShadow=function(W){let j=H.call(this,W);for(let Z of $[m]??[])Z();return j},$[MM]=!0}function c(F,M,$){if($0(F)&&"scope"in M&&M.scope&&M.scope!=="light")throw Error("RadiantController event listeners only support light DOM scope.");let H=HM(F),P=$.bind(F),W=null,j=null,Z=null,X=null,G=!1,Q=()=>{W?.(),j?.(),Z?.(),X?.(),W=null,j=null,Z=null,X=null},U=()=>{if(G)return;if("window"in M&&!W)window.addEventListener(M.type,P,M.options),W=()=>{window.removeEventListener(M.type,P,M.options)};if("document"in M&&!j)document.addEventListener(M.type,P,M.options),j=()=>{document.removeEventListener(M.type,P,M.options)};if("selector"in M||"ref"in M){let B="selector"in M?M.selector:`[data-ref='${CSS.escape(M.ref)}']`;if(M.scope!=="shadow"&&!Z)Z=$M(H,M,B,P);if(M.scope!=="light"&&H.shadowRoot&&!X)X=$M(H.shadowRoot,M,B,P)}};if("selector"in M||"ref"in M){if(M.scope!=="light")H0(F,()=>{if(F.isConnected)U()})}if(F.registerConnectedCallback(U),F.registerCleanupCallback(Q),F.isConnected)U();return()=>{G=!0,Q()}}function PM(F){return(M,$,H)=>{let P=H.value;return q(M,(W)=>{c(W,F,P.bind(W))}),H}}function WM(F){return function(M,$){$.addInitializer(function(){c(this,F,M.bind(this))})}}function U$(F){function M($,H,P){return J(WM(F),PM(F),$,H,P)}return M}function jM(F){return(M,$)=>{let H=Symbol(`@ecopages/radiant/on-updated:${$}:cleanup`);q(M,(P)=>{P.registerConnectedCallback(()=>{let W=P[$].bind(P),j=[];if(Array.isArray(F))for(let Z of F)j.push(P.registerUpdateCallback(Z,W));else if(typeof F==="string")j.push(P.registerUpdateCallback(F,W));P[H]=()=>{for(let Z of j)Z()}}),P.registerCleanupCallback(()=>{let W=P[H];if(typeof W==="function")W(),delete P[H]})})}}function ZM(F){return function(M,$){$.addInitializer(function(){let H=M.bind(this);if(Object.defineProperty(this,$.name,{value:H,configurable:!0,writable:!0}),Array.isArray(F))for(let P of F)this.registerUpdateCallback(P,H);else if(typeof F==="string")this.registerUpdateCallback(F,H)})}}function z$(F){function M($,H,P){return J(ZM(F),jM(F),$,H,P)}return M}var $F=Symbol.for("@ecopages/radiant.reactivePropDefinitions");function d(F,M,$){let H=F.constructor,P=H[$F]??[];if(P.some((W)=>W.name===M))return;P.push({name:M,options:$}),H[$F]=P}function T$(F){return(F.constructor[$F]??[]).slice()}function XM({type:F,attribute:M,reflect:$,defaultValue:H,bind:P}){if(H!==void 0&&!D(F,H))throw Error(`defaultValue does not match the expected type for ${F.name}`);return(W,j)=>{let Z=M??j;d(W,j,{type:F,reflect:$,attribute:Z,defaultValue:H,bind:P});let X=Symbol.for(`@ecopages/radiant.ssr-prop:${j}`);Object.defineProperty(W,j,{get(){return this[X]??H},set(G){this[X]=G},configurable:!0,enumerable:!0}),q(W,(G)=>{G.registerConnectedCallback(()=>{let Q=G[j],U=H===void 0?Q:H;G.createReactiveProp(j,{type:F,reflect:$,attribute:Z,defaultValue:U,bind:P})})})}}function GM({type:F,attribute:M,reflect:$,defaultValue:H,bind:P}){if(H!==void 0&&!D(F,H))throw Error(`defaultValue does not match the expected type for ${F.name}`);return function(W,j){let Z=String(j.name),X=M??Z,G=Symbol(`@ecopages/radiant/reactive-prop:${Z}:initializer`);return j.addInitializer(function(){let Q=this[G],U=H===void 0?Q:H;d(this,Z,{type:F,reflect:$,attribute:X,defaultValue:H,bind:P}),this.createReactiveProp(Z,{type:F,reflect:$,attribute:X,defaultValue:U,bind:P})}),function(Q){return this[G]=Q,Q}}}function N$(F){function M($,H){return R(GM(F),XM(F),$,H)}return M}function P0(F){return!(F instanceof Element)}function W0(F){return"shadowRoot"in F?F.shadowRoot??null:null}function j0(F){return F instanceof Element?F:F.host}function Z0(F,M="light"){let $=W0(F);if(M==="shadow")return $?[$]:[];if(M==="both")return $?[F,$]:[F];return[F]}function s(F,M){if(P0(F)&&M.scope&&M.scope!=="light")throw Error("RadiantController queries only support light DOM scope.");let $=j0(F),H="selector"in M?M.selector:`[data-ref="${M.ref}"]`,P=null,W=()=>{let j=Z0($,M.scope);if(M.all)return j.flatMap((Z)=>Array.from(Z.querySelectorAll(H)));for(let Z of j){let X=Z.querySelector(H);if(X)return X}return null};return{get value(){if(M.cache){if(P===null||M.all&&Array.isArray(P)&&!P.length)P=W();return P}return W()}}}function BM({cache:F=!0,...M}){return($,H)=>{q($,(P)=>{P.registerConnectedCallback(()=>{let W=s(P,{cache:F,...M});Object.defineProperty(P,H,{get(){return W.value},enumerable:!0,configurable:!0})})})}}function QM(F){return function(M,$){let H=String($.name);$.addInitializer(function(){let P=s(this,F);Object.defineProperty(this,H,{get(){return P.value},enumerable:!0,configurable:!0})})}}function i$(F){function M($,H){return R(QM(F),BM(F),$,H)}return M}function I(F,M={}){let $=null,H,P=()=>{if(M.all)return typeof F.getSlotElements==="function"?F.getSlotElements(M.name):[];return typeof F.getSlotElement==="function"?F.getSlotElement(M.name):null};return{get value(){if(M.cache===!1)return P();let W=F.slotProjectionVersion??0;if(H!==W)$=P(),H=W;return $}}}function qM(F={}){return(M,$)=>{let H=(j)=>{return typeof Object.getOwnPropertyDescriptor(j,$)?.get==="function"},P=(j)=>{if(H(j))return;let Z=I(j,F);Object.defineProperty(j,$,{get(){return Z.value},enumerable:!0,configurable:!0})},W=new WeakMap;Object.defineProperty(M,$,{get(){let j=W.get(this);if(!j)j=I(this,F),W.set(this,j);return j.value},enumerable:!0,configurable:!0}),q(M,(j)=>{GF(j,()=>{P(j)}),j.registerConnectedCallback(()=>{P(j)})})}}function UM(F={}){return function(M,$){let H=String($.name);$.addInitializer(function(){let P=I(this,F);Object.defineProperty(this,H,{get(){return P.value},enumerable:!0,configurable:!0})})}}function PH(F={}){function M($,H){return R(UM(F),qM(F),$,H)}return M}function RM(F){return RF({type:"signal",...F})}function DM(F){return DF(F)}import{createMarkupNodeLike as X0}from"@ecopages/jsx";import{state as G0}from"@ecopages/signals";function p(F){return typeof F==="object"&&F!==null&&typeof F.get==="function"&&typeof F.set==="function"&&typeof F.subscribe==="function"&&typeof F.update==="function"}class E{host;hydrate;hydrationKey;property;source;currentValue;hasAppliedHostHydration=!1;sourceUnsubscribe;constructor(F){this.host=F.host,this.hydrate=F.hydrate,this.hydrationKey=F.hydrationKey,this.property=F.property,this.source=F.source??G0(this.resolveInitialValue(F.initialValue)),this.currentValue=this.source.get()}get(){return this.source.get()}set(F){this.source.set(F)}subscribe(F){return this.source.subscribe(F)}update(F){this.set(F(this.get()))}connectToSource(){if(this.sourceUnsubscribe)return;let F=this.source.get();if(!Object.is(this.currentValue,F)){let M=this.currentValue;this.currentValue=F,this.host.notifyUpdate(this.property,M,F)}this.sourceUnsubscribe=this.source.subscribe((M)=>{this.handleSourceChange(M)})}disconnectFromSource(){this.sourceUnsubscribe?.(),this.sourceUnsubscribe=void 0}hydrateFromHost(){if(!this.hydrate||this.hasAppliedHostHydration)return;this.hasAppliedHostHydration=!0;let F=this.source.get(),M=this.resolveInitialValue(F);if(!Object.is(F,M))this.source.set(M),this.currentValue=this.source.get(),this.host.notifyUpdate(this.property,F,this.currentValue)}renderHydrationScript(){let F=this.renderHydrationScriptTag();if(!F)return;return X0(F)}renderHydrationScriptTag(){let F=this.serializeHydrationValue();if(!F)return;return RM({hydrationKey:this.hydrationKey,serializedValue:F})}findHydrationScriptElement(){if(!(this.host instanceof Element))return null;return JF(this.host,"signal",this.hydrationKey)}isObject(F){return typeof F==="object"&&!Array.isArray(F)&&F!==null}resolveInitialValue(F){if(!this.hydrate)return F;let M=this.findHydrationScriptElement();if(!M)return F;let $=LF(M,F);if(this.hydrate===Object&&this.isObject($)&&this.isObject(F))return{...F,...$};return $}serializeHydrationValue(){if(!this.hydrate)return;let F=JSON.stringify(this.get());if(typeof F!=="string")return;return DM(F)}handleSourceChange(F){let M=this.currentValue;if(this.currentValue=F,!Object.is(M,F))this.host.notifyUpdate(this.property,M,F)}}function i(F){return new E(F)}function HF(F={}){return(M,$)=>{let H=(P)=>{let W=P[$];if(W instanceof E)return W;let j=typeof F.source==="function"?F.source(P):F.source??(p(W)?W:void 0),Z=F.bind??P.shouldAutoBindReactiveMembers?.()??!1,X=j!==void 0?F.initial:W===void 0?F.initial:W;P.defineReactiveBinding($,Z);let G=i({host:P,hydrate:F.hydrate,hydrationKey:$,initialValue:X,property:$,source:j});if(P.registerConnectedCallback(()=>{G.hydrateFromHost(),G.connectToSource()}),P.registerCleanupCallback(()=>{G.disconnectFromSource()}),F.hydrate)P.registerHydrationBinding($,G);return P[$]=G,G};q(M,(P)=>{let W=H(P);P.registerConnectedCallback(()=>{if(!(P[$]instanceof E))P[$]=W})})}}function PF(F={}){return function(M,$){let H=String($.name);return function(P){let W=typeof F.source==="function"?F.source(this):F.source??(p(P)?P:void 0),j=W!==void 0?F.initial:P===void 0?F.initial:P,Z=F.bind??this.shouldAutoBindReactiveMembers?.()??!1;this.defineReactiveBinding(H,Z);let X=i({host:this,hydrate:F.hydrate,hydrationKey:H,initialValue:j,property:H,source:W});if(this.registerConnectedCallback(()=>{X.hydrateFromHost(),X.connectToSource()}),this.registerCleanupCallback(()=>{X.disconnectFromSource()}),F.hydrate)this.registerHydrationBinding(H,X);return X}}}function YH(F,M){if(typeof M<"u"){if(typeof M==="object"){if(F!==void 0)throw TypeError("@signal standard decorators require an undefined target");return PF()(void 0,M)}if(F===void 0)throw TypeError("@signal legacy decorators require a host target");return HF()(F,M)}let $=F??{};function H(P,W){if(typeof W==="object"){if(P!==void 0)throw TypeError("@signal standard decorators require an undefined target");return PF($)(void 0,W)}if(P===void 0)throw TypeError("@signal legacy decorators require a host target");return HF($)(P,W)}return H}function LM(F,M){q(F,($)=>{$.registerConnectedCallback(()=>{$.createReactiveField(M,$[M],{bind:$.shouldAutoBindReactiveMembers?.()??!1})})})}function JM(F,M){let $=Symbol(`__${String(M.name)}__value`),H=String(M.name);return M.addInitializer(function(){this.defineReactiveBinding(H,this.shouldAutoBindReactiveMembers?.()??!1),this.registerReactiveDependencyReader(H,()=>this[$]),Object.defineProperty(this,M.name,{get(){return this.trackReactiveRead(H),this[$]},set(P){let W=this[$];if(W!==P)this[$]=P,this.notifyUpdate(H,W,P)},enumerable:!0,configurable:!0})}),function(P){return this[$]=P,P}}function wH(F,M){return R(JM,LM,F,M)}export{b as visitControllerElements,F2 as stopControllers,wH as state,e0 as startControllers,YH as signal,cF as setControllerRegistrationStrategy,o0 as resolveRegisteredController,aM as replaceController,dF as registerControllerWithConfiguredStrategy,oM as registerController,PH as querySlot,i$ as query,N$ as prop,yF as parseControllerIdentifiers,z$ as onUpdated,U$ as onEvent,r0 as hasRegisteredController,$$ as event,a0 as enableControllerReplacementForHmr,t0 as disableControllerReplacementForHmr,d2 as debounce,V2 as customElement,T2 as controller,Y2 as bound,U2 as attr,V as RadiantElement,hF as RadiantController,mF as ControllerRegistryRuntime,uF as CONTROLLER_REGISTRY_STATE_KEY,N as CONTROLLER_ATTRIBUTE};
|
|
1
|
+
var hM=((F)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(F,{get:(M,P)=>(typeof require<"u"?require:M)[P]}):F)(function(F){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+F+'" is not supported')});class K{contextProviders=new Map;hydrationBindings=new Map;registerContextProvider(F,M){this.contextProviders.set(F,M),this.hydrationBindings.set(F,M)}registerHydrationBinding(F,M){this.hydrationBindings.set(F,M)}getContextProviders(){return[...this.contextProviders.values()]}getHydrationBindings(){return[...this.hydrationBindings.values()]}}var a=Symbol.for("@ecopages/radiant.reactivePropDefinitions");function f(F,M,P){let $=F.constructor,Z=$[a]??[];if(Z.some((x)=>x.name===M))return;Z.push({name:M,options:P}),$[a]=Z}function D0(F){return(F.constructor[a]??[]).slice()}var q0=Symbol.for("@ecopages/radiant.legacy-instance-initializers"),L0=Symbol.for("@ecopages/radiant.legacy-post-construction-initializers"),yF=Symbol.for("@ecopages/radiant.legacy-executed-post-construction-initializers");function Q(F,M){R0(F,q0,M)}function j0(F,M){R0(F,L0,M)}function J0(F){e(F,q0)}function Y0(F){let M=F;e(F,L0,M[yF]??=new Set)}function R0(F,M,P){let $=F,Z=Object.prototype.hasOwnProperty.call($,M)?$[M]:void 0;if(Array.isArray(Z)){Z.push(P);return}Object.defineProperty($,M,{value:[P]})}function e(F,M,P,$=Object.getPrototypeOf(F)){if(!$||$===Object.prototype)return;e(F,M,P,Object.getPrototypeOf($));let Z=$[M];if(!Array.isArray(Z))return;for(let x of Z){if(P?.has(x))continue;x(F),P?.add(x)}}function J(F,M){switch(M){case"construct":J0(F);break;case"connect":case"ssr":Y0(F);break}}class F0{getInteractionTarget;getListenerContext;subscriptions=new Map;constructor(F,M){this.getInteractionTarget=F;this.getListenerContext=M}subscribe(F){let M=this.getInteractionTarget(),P=this.getListenerContext(),$=(x)=>{if(x.target&&x.target.matches(F.selector))F.listener.call(P,x)},Z=`${F.type}:${F.selector}`;return M.addEventListener(F.type,$,F.options),this.subscriptions.set(Z,{...F,listener:$,target:M}),()=>{this.unsubscribe(Z)}}hasEventSubscription(F){return this.subscriptions.has(F)}removeAll(){for(let F of this.subscriptions.values())F.target.removeEventListener(F.type,F.listener,F.options);this.subscriptions.clear()}unsubscribe(F){let M=this.subscriptions.get(F);if(M)M.target.removeEventListener(M.type,M.listener,M.options),this.subscriptions.delete(F)}}function _0(F){switch(F){case Array:return"array";case Boolean:return"boolean";case Number:return"number";case Object:return"object";case String:return"string"}}function mF(F){switch(typeof F){case"boolean":return"boolean";case"number":return"number";case"string":return"string"}if(Array.isArray(F))return"array";if(Object.prototype.toString.call(F)==="[object Object]")return"object"}function I(F){switch(F){case Number:return 0;case String:return"";case Boolean:return!1;default:return null}}function cF(F){try{return JSON.parse(F)}catch{throw TypeError("Invalid JSON string")}}var sF={array(F){let M=cF(F);if(!Array.isArray(M))throw TypeError(`Expected an array but got a value of type "${typeof M}"`);return M},boolean(F){return!(F==="0"||String(F).toLowerCase()==="false")},number(F){return Number(F.replace(/_/g,""))},object(F){let M=JSON.parse(F);if(M===null||typeof M!=="object"||Array.isArray(M))throw TypeError(`expected value of type "object" but instead got value "${F}" of type "${mF(M)}"`);return M},string(F){return F}},T0={default:E0,array:z0,object:z0};function z0(F){return JSON.stringify(F)}function E0(F){return`${F}`}function z(F,M){let P=_0(M);if(!P)throw TypeError(`[radiant-element] Unknown type "${M}"`);return sF[P](F)}function S(F,M){let P=_0(M);if(!P)throw TypeError(`[radiant-element] Unknown type "${M}"`);return(T0[P]??T0.default??E0)(F)}function dF(F){return typeof F==="boolean"}function pF(F){return typeof F==="number"}function iF(F){return typeof F==="string"}function lF(F){return Array.isArray(F)}function nF(F){return typeof F==="object"&&!Array.isArray(F)&&F!==null}function K0(F,M){switch(F){case Boolean:return dF(M);case Number:return pF(M);case String:return iF(M);case Array:return lF(M);case Object:return nF(M);default:return!1}}var I0=(F,M,P,$)=>{if(M===Boolean){let x=F.getAttribute(P);if(x===null)return $;return x===""?!0:z(x,M)}let Z=F.getAttribute(P);return Z!==null?z(Z,M):$??I(M)};function L(F,M){if(M!==void 0&&!K0(F,M))throw Error(`defaultValue does not match the expected type for ${F.name}`)}function k0(F,M,P,$){return{type:P,name:F,value:$,initialValue:$,attribute:M,converter:{fromAttribute:(Z)=>z(Z,P),toAttribute:(Z)=>S(Z,P)}}}class M0{host;properties=new Map;preUpgradePropertyValues=new Map;constructor(F){this.host=F;for(let M of Object.getOwnPropertyNames(F))this.preUpgradePropertyValues.set(M,Reflect.get(F,M))}register(F){this.properties.set(F.name,F)}getAll(){return Array.from(this.properties.values())}applyAttributeChange(F,M,P){let $=this.properties.get(F);if(!$)return;let Z=this.transformAttributeValue(P,$),x=this.transformAttributeValue(M,$);Reflect.set(this.host,$.attribute,Z),this.host.notifyUpdate(F,x,Z)}create(F,M,P,$){let{type:Z,attribute:x,reflect:A,defaultValue:H}=M,W=x??F,X=this.preUpgradePropertyValues.has(F),G=X?this.preUpgradePropertyValues.get(F):void 0;L(Z,H);let U=X?G:P(Z,W,H);if(this.host.hasAttribute(W)&&(!A||U==null||U===""))this.host.removeAttribute(W);if(X&&Object.prototype.hasOwnProperty.call(this.host,F))Reflect.deleteProperty(this.host,F);let D=k0(F,W,Z,U);if(this.register(D),$(F,{bind:M.bind,getValue:()=>this.properties.get(F)?.value,setValue:(B)=>{this.properties.set(F,{...D,value:B}),this.reflectValue(W,A,D,B)}}),U!==void 0)queueMicrotask(()=>{let B=this.properties.get(F)?.value;if(B===void 0)return;this.reflectValue(W,A,D,B),this.host.notifyUpdate(F,void 0,B)})}transformAttributeValue(F,M){return F!==null?M.converter.fromAttribute(F):F}reflectValue(F,M,P,$){if(!M)return;if($==null||$===""||$===!1){this.host.removeAttribute(F);return}let Z=P.converter.toAttribute($);this.host.setAttribute(F,Z)}}import{Computed as rF,subtle as oF,trackDependency as tF}from"@ecopages/signals";function aF(F){return F}function w0(F){return F}var C0={trackDependency(F){tF(aF(F))},createComputed(F){return new rF(F)},createWatcher(F){let M=new oF.Watcher(F);return{watch(P){M.watch(w0(P))},unwatch(P){M.unwatch(w0(P))}}}};var O0=C0;function V(){return O0}function eF(F){O0=F}function P0(F){V().trackDependency(F)}function b(F){return V().createComputed(F)}function v(F){return V().createWatcher(F)}function f0(F){return F.replace(/&/g,"\\u0026").replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}var Y="data-hydration",V0="data-hydration-type",$0="data-hydration-key";function b0(F){let M=F.hydrationKey?` ${$0}="${FM(F.hydrationKey)}"`:"";return`<script type="application/json" ${Y} ${V0}="${F.type}"${M}>${F.serializedValue}</script>`}function v0(F){return f0(F)}function N0(F,M){let P=F.textContent;if(!P)return M;try{return JSON.parse(P)}catch{if(typeof console<"u")console.warn(`[@ecopages/radiant] Failed to parse hydration payload from <script ${Y}>:`,P.slice(0,120));return M}}function h0(F,M,P){let $=F.children;if(!$||$.length===0){let Z=F.childNodes;if(!Z||Z.length===0)return null;for(let x=0;x<Z.length;x+=1){let A=Z[x];if(A.nodeType!==1)continue;let H=A;if(S0(H,M,P))return H}return null}for(let Z=0;Z<$.length;Z+=1)if(S0($[Z],M,P))return $[Z];return null}function S0(F,M,P){if(F.tagName!=="SCRIPT"||!F.hasAttribute(Y)||F.getAttribute(V0)!==M)return!1;if(P!==void 0)return F.getAttribute($0)===P;return!F.hasAttribute($0)}function FM(F){return F.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}import{createMarkupNodeLike as MM,isKeyedJsxValue as g0,isSlotJsxValue as PM}from"@ecopages/jsx";var _="",h="data-radiant-slot-projection";function u0(F){let M=new Map;for(let P of Array.from(F.childNodes)){if(AM(P))continue;$M(M,xM(P),P)}return M}function y0(F){let M;try{M=JSON.parse(F)}catch{if(typeof console<"u")console.warn("[@ecopages/radiant] Failed to parse slot projection payload:",F.slice(0,120));return new Map}let P=new Map;for(let[$,Z]of Object.entries(M)){if(!Array.isArray(Z)||Z.length===0)continue;P.set(Z0($),Z.map((x)=>MM(x)))}return P}function m0(F){let M=Array.from(F.childNodes).filter((P)=>l0(P)).map((P)=>N(P)??"").filter((P)=>P!=="");return M.length>0?M.join(""):void 0}function c0(F){let M={};for(let[P,$]of F.entries()){let Z=$.map((x)=>N(x)).filter((x)=>x!==void 0&&x!=="");if(Z.length>0)M[P]=Z}return Object.keys(M).length>0?JSON.stringify(M):void 0}function s0(F,M){let P=!1,$=(x)=>{if(PM(x))return P=!0,WM(x,M,$);if(g0(x))return ZM(x,$(x.value));if(HM(x))return{_$rType$:1,rootLocalName:x.rootLocalName,ssrIntrinsicProps:x.ssrIntrinsicProps,strings:x.strings,values:x.values.map((A)=>$(A))};if(p0(x))return Array.from(x,(A)=>$(A));return x},Z=$(F);return{containsSlots:P,value:Z}}function d0(F){for(let M of Array.from(F.childNodes)){if(!i0(M))continue;let P=M.textContent??void 0;return M.parentNode?.removeChild(M),P}return}function $M(F,M,P){let $=F.get(M);if($){$.push(P);return}F.set(M,[P])}function ZM(F,M){return{...F,value:M}}function xM(F){if(F instanceof Element)return Z0(F.getAttribute("slot"));return _}function p0(F){return typeof F!=="string"&&typeof F==="object"&&F!==null&&Symbol.iterator in F}function i0(F){return F instanceof HTMLScriptElement&&F.hasAttribute(h)}function l0(F){return F instanceof HTMLScriptElement&&F.hasAttribute(Y)}function AM(F){return i0(F)||l0(F)}function HM(F){return typeof F==="object"&&F!==null&&F._$rType$===1&&Array.isArray(F.strings)&&Array.isArray(F.values)}function Z0(F){return F??_}function N(F){if(F===void 0||F===null||F===!1||F===!0)return;if(typeof Node<"u"&&F instanceof Node){if(F.nodeType===Node.TEXT_NODE)return F.textContent??"";return F.outerHTML??F.textContent??void 0}if(g0(F))return N(F.value);if(typeof F==="string"||typeof F==="number"||typeof F==="bigint")return String(F);if(typeof F==="object"&&F!==null&&"outerHTML"in F)return typeof F.outerHTML==="string"?F.outerHTML:F.textContent??void 0;if(p0(F))return Array.from(F,(M)=>N(M)??"").join("");return}function WM(F,M,P){let $=M.get(Z0(F.name));if($&&$.length>0)return $.length===1?$[0]:$;if(F.fallback===void 0)return"";return P(F.fallback)}import{hydrate as XM,render as GM}from"@ecopages/jsx";class x0{#F;#M=new Map;#P;#Z;#$;#x=0;constructor(F){this.#F=F,this.#Z=v(()=>{this.#F.requestUpdate()})}get slotProjectionVersion(){return this.#x}getSlotElements(F){return this.ensureSlotProjectionState(),(this.#M.get(F??_)??[]).filter((M)=>typeof Node<"u"&&M instanceof Element)}getSlotProjectionScriptTag(){this.ensureSlotProjectionState();let F=c0(this.#M);if(!F)return;return`<script type="application/json" ${h}>${UM(F)}</script>`}getAuthoredHydrationScriptMarkup(){return m0(this.#F)??void 0}hydrate(F){this.disconnectSlotProjectionObserver();try{XM(this.resolveTrackedRenderOutput().value,F)}finally{this.observeSlotProjection()}}render(F){this.disconnectSlotProjectionObserver();try{GM(this.resolveTrackedRenderOutput().value,F)}finally{this.observeSlotProjection()}}observeSlotProjection(){if(typeof MutationObserver>"u"||this.#$||!this.#F.isConnected)return;this.#$=new MutationObserver((F)=>this.handleSlotProjectionMutations(F)),this.#$.observe(this.#F,{childList:!0})}disconnectSlotProjectionObserver(){this.#$?.disconnect(),this.#$=void 0}disconnectRenderWatcher(){if(!this.#P)return;this.#Z.unwatch(this.#P),this.#P=void 0}resolveTrackedRenderOutput(){let F=b(()=>this.resolveRenderOutput()),M=F.get();if(!this.#F.isConnected)return M;if(this.#P)this.#Z.unwatch(this.#P);return this.#P=F,this.#Z.watch(F),M}dispose(){this.disconnectSlotProjectionObserver(),this.disconnectRenderWatcher()}ensureSlotProjectionState(){if(this.#M.size>0)return;let F=this.#F.isConnected?d0(this.#F):void 0;if(typeof F==="string"&&F!==""){this.#M=y0(F),this.#x+=1;return}if(this.#F.childNodes.length>0)this.#M=u0(this.#F),this.#x+=1}handleSlotProjectionMutations(F){let M=!1;for(let P of F){for(let $ of Array.from(P.removedNodes))if(this.removeProjectedSlotNode($))M=!0;for(let $ of Array.from(P.addedNodes)){if($.parentNode!==this.#F)continue;if(this.addProjectedSlotNode($))M=!0}}if(M)this.#x+=1,this.#F.requestUpdate()}addProjectedSlotNode(F){if(F instanceof HTMLScriptElement&&(F.hasAttribute(h)||F.hasAttribute(Y)))return!1;let M=F instanceof Element?F.getAttribute("slot")??_:_,P=this.#M.get(M);if(P){if(P.includes(F))return!1;return P.push(F),!0}return this.#M.set(M,[F]),!0}removeProjectedSlotNode(F){for(let[M,P]of this.#M.entries()){let $=P.indexOf(F);if($===-1)continue;if(P.splice($,1),P.length===0)this.#M.delete(M);return!0}return!1}resolveRenderOutput(){return this.ensureSlotProjectionState(),s0(this.#F.render(),this.#M)}}function UM(F){return F.replace(/</g,"\\u003c")}class k{options;needsRender=!1;isRendering=!1;isRenderScheduled=!1;constructor(F){this.options=F}get rendering(){return this.isRendering}get pending(){return this.needsRender}markPending(){this.needsRender=!0}clearPending(){this.needsRender=!1}requestUpdate(){if(this.needsRender=!0,this.isRenderScheduled)return;this.isRenderScheduled=!0,queueMicrotask(()=>{if(this.isRenderScheduled=!1,!this.needsRender)return;this.flush()})}flush(){if(!this.options.canFlush())return;while(this.needsRender&&this.options.canFlush())this.needsRender=!1,this.runCommit()}runExclusive(F){this.isRendering=!0;try{return F()}finally{this.isRendering=!1}}runCommit(){this.isRendering=!0;try{this.options.commit()}finally{this.isRendering=!1}}}import{createSubscribableJsxValue as QM}from"@ecopages/jsx";class n0{read;subscribers=new Set;watcherListeners=new Set;version=0;constructor(F){this.read=F}get(){return P0(this),this.read()}subscribe(F){return this.subscribers.add(F),()=>{this.subscribers.delete(F)}}addWatcher(F){return this.watcherListeners.add(F),()=>{this.watcherListeners.delete(F)}}getVersion(){return this.version}notify(F){this.version+=1;let M;try{this.notifyWatchers()}catch(P){M=P}if(this.publish(F),M)throw M}publish(F){for(let M of this.subscribers)M(F)}notifyWatchers(){let F=[];for(let M of this.watcherListeners)try{M()}catch(P){F.push(P)}if(F.length===1)throw F[0];if(F.length>1)throw AggregateError(F,"Multiple reactive dependency notifications failed.")}}function BM(F){return typeof F==="object"&&F!==null&&typeof F.get==="function"}class w{host;access;shouldAutoBind;bindings;$;reactiveFields=new Map;reactiveDependencies=new Map;reactiveDependencyReaders=new Map;reactiveBindings=new Map;updateCallbacks=new Map;onConnectedCallbacks=[];onDisconnectedCallback=[];constructor(F,M,P){this.host=F;this.access=M;this.shouldAutoBind=P;let $=this.createReactiveBindingNamespace();this.bindings=$,this.$=$}connectHost(){for(let F of this.onConnectedCallbacks)F()}disconnectHost(){for(let F of this.onDisconnectedCallback)F()}notifyUpdate(F,M,P){if(M===P)return;this.reactiveDependencies.get(F)?.notify(P);let $=this.updateCallbacks.get(F);if($)for(let Z of $)Z()}registerCleanupCallback(F){this.onDisconnectedCallback.push(F)}registerConnectedCallback(F){this.onConnectedCallbacks.push(F)}registerReactiveDependencyReader(F,M){this.reactiveDependencyReaders.set(F,M)}registerUpdateCallback(F,M){if(!this.updateCallbacks.has(F))this.updateCallbacks.set(F,new Set);let P=this.updateCallbacks.get(F);return P.add(M),()=>{if(P.delete(M),P.size===0)this.updateCallbacks.delete(F)}}getReactiveBinding(F){let M=this.reactiveBindings.get(F);if(M)return M;let P=QM({getValue:()=>this.readReactiveBindingValue(F),subscribe:($)=>this.registerUpdateCallback(F,()=>{$(this.readReactiveBindingValue(F))})});return this.reactiveBindings.set(F,P),P}defineReactiveBinding(F,M=!0){let P=typeof M==="string"?M:M?`$${F}`:void 0,$=this.access.getBindingTarget?.(this.host)??this.host;if(!P||this.access.hasProperty(this.host,P))return;this.access.defineProperty($,P,{get:()=>this.getReactiveBinding(F),enumerable:!1,configurable:!0})}trackReactiveRead(F){P0(this.getReactiveDependency(F))}defineReactiveAccessor(F,M){let P=M.bind??this.shouldAutoBind();if(this.defineReactiveBinding(F,P),this.registerReactiveDependencyReader(F,M.getValue),this.access.defineProperty(this.host,F,{get:()=>{return this.trackReactiveRead(F),M.getValue()},set:($)=>{let Z=M.getValue();if(Z===$)return;M.setValue($),this.notifyUpdate(F,Z,$)},enumerable:!0,configurable:!0}),M.notifyInitialValue!==void 0)this.notifyUpdate(F,void 0,M.notifyInitialValue)}createReactiveField(F,M,P={}){let $={name:F,value:M,initialValue:M};this.reactiveFields.set(F,$),this.defineReactiveAccessor(F,{bind:P.bind,getValue:()=>this.reactiveFields.get(F)?.value,setValue:(Z)=>{this.reactiveFields.set(F,{...$,value:Z})},notifyInitialValue:P.suppressInitialNotify?void 0:M})}createReactiveBindingNamespace(){return new Proxy(Object.create(null),{get:(F,M)=>{if(typeof M!=="string")return;return this.getReactiveBinding(M)}})}getReactiveDependency(F){let M=this.reactiveDependencies.get(F);if(M)return M;let P=new n0(()=>this.readReactiveDependencyValue(F));return this.reactiveDependencies.set(F,P),P}readReactiveDependencyValue(F){let M=this.reactiveDependencyReaders.get(F);if(M)return M();return this.readReactiveBindingValue(F)}readReactiveBindingValue(F){let M=this.access.readProperty(this.host,F);if(BM(M))return M.get();return M}}var A0=Symbol.for("@ecopages/radiant.ssr-preparation-callbacks"),r0=Symbol.for("@ecopages/radiant.ssr-preparation-running");function o0(F,M){let $=F[A0];if(Array.isArray($)){$.push(M);return}Object.defineProperty(F,A0,{value:[M],configurable:!0})}function t0(F){let M=F,P=M[A0];if(!Array.isArray(P))return;M[r0]=!0;try{for(let $ of P)$()}finally{delete M[r0]}}var H0=Symbol.for("@ecopages/radiant.hydrator-installed");function YP(){globalThis[H0]=!0}function RP(){delete globalThis[H0]}function a0(){return globalThis[H0]===!0}import{getActiveSsrScopeValue as DM,withActiveSsrScopeValue as qM}from"@ecopages/jsx/server";var e0=Symbol.for("@ecopages/radiant.element-ssr-runtime");function FF(){return DM(e0)}function _P(F,M){return qM(e0,F,M)}import{hasHydrationMarkers as LM,jsx as jM}from"@ecopages/jsx";var JM=YM();function YM(){if(typeof HTMLElement<"u")return HTMLElement;throw Error("RadiantElement requires HTMLElement. Install '@ecopages/radiant/server/light-dom-shim' before SSR imports.")}class PF extends JM{renderRootMode="light";bindings;$;reactiveHost;reactivePropertyState;eventSubscriptionRegistry;hostSsrRegistry=new K;eventEmitters=new Map;elementReady=!1;isFirstConnectPending=!1;renderScheduler;renderRuntime;constructor(){super();this.reactivePropertyState=new M0(this),this.eventSubscriptionRegistry=new F0(()=>this.resolveRenderSurface().interactionTarget,()=>this),this.renderScheduler=new k({canFlush:()=>this.isConnected&&!this.renderScheduler.rendering&&!(this.isFirstConnectPending&&MF(this)),commit:()=>{let{renderTarget:F}=this.resolveRenderSurface();this.getOrCreateRenderRuntime().render(F)}}),this.reactiveHost=new w(this,{defineProperty:(F,M,P)=>Object.defineProperty(F,M,P),getBindingTarget:(F)=>Object.getPrototypeOf(F)??F,hasProperty:(F,M)=>(M in F),readProperty:(F,M)=>F[M]},()=>this.shouldAutoBindReactiveMembers()),this.bindings=this.reactiveHost.bindings,this.$=this.reactiveHost.$,J(this,"construct")}get slotProjectionVersion(){return this.renderRuntime?.slotProjectionVersion??0}connectedCallback(){J(this,"connect");let F=this.isFirstConnectPending;if(this.elementReady=!0,this.reactiveHost.connectHost(),F)return;this.isFirstConnectPending=!0,queueMicrotask(()=>{if(this.isFirstConnectPending=!1,!this.isConnected)return;if(!this.shouldRunRenderLifecycle())return;if(this.getOrCreateRenderRuntime().observeSlotProjection(),MF(this)){if(this.renderScheduler.clearPending(),this.hydrate(),this.renderScheduler.pending)this.update();return}this.update()})}connectedContextCallback(F){}disconnectedCallback(){this.renderRuntime?.dispose(),this.renderRuntime=void 0,this.eventSubscriptionRegistry.removeAll(),this.reactiveHost.disconnectHost()}notifyUpdate(F,M,P){this.reactiveHost.notifyUpdate(F,M,P)}attributeChangedCallback(F,M,P){if(M===P||!this.elementReady)return;this.reactivePropertyState.applyAttributeChange(F,M,P)}renderTemplate({target:F=this,template:M,insert:P="replace",sanitize:$}){let Z=$?$(M):M;switch(P){case"replace":F.innerHTML=Z;break;case"beforeend":F.insertAdjacentHTML("beforeend",Z);break;case"afterbegin":F.insertAdjacentHTML("afterbegin",Z);break;case"beforebegin":F.insertAdjacentHTML("beforebegin",Z);break;case"afterend":F.insertAdjacentHTML("afterend",Z);break}}render(){return jM("slot",{})}getReactivePropDefinitions(){return D0(this)}getPropertyValue(F){return Reflect.get(this,F)}renderViewToString(F={}){if(!this.shouldRunRenderLifecycle())return this.innerHTML;return J(this,"ssr"),this.prepareForSsr(),RM().renderView(this,F)}hydrate(){if(!this.shouldRunRenderLifecycle()||!this.isConnected||this.renderScheduler.rendering)return;let{renderTarget:F}=this.resolveRenderSurface(),M=this.getOrCreateRenderRuntime();this.renderScheduler.runExclusive(()=>{M.hydrate(F)})}requestUpdate(){if(!this.shouldRunRenderLifecycle())return;this.renderScheduler.requestUpdate()}update(){if(!this.shouldRunRenderLifecycle())return;this.renderScheduler.markPending(),this.renderScheduler.flush()}registerReactiveProperty(F){this.reactivePropertyState.register(F)}getReactiveProperties(){return this.reactivePropertyState.getAll()}registerReactiveDependencyReader(F,M){this.reactiveHost.registerReactiveDependencyReader(F,M)}registerContextProvider(F,M){this.hostSsrRegistry.registerContextProvider(F,M)}registerHydrationBinding(F,M){this.hostSsrRegistry.registerHydrationBinding(F,M)}getContextProviders(){return this.hostSsrRegistry.getContextProviders()}getHydrationBindings(){return this.hostSsrRegistry.getHydrationBindings()}prepareForSsr(){t0(this)}shouldAutoBindReactiveMembers(){return!0}shouldRunRenderLifecycle(){return this.render!==PF.prototype.render}getRenderTarget(){if(this.renderRootMode!=="shadow")return this;if(this.shadowRoot)return this.shadowRoot;if(typeof this.attachShadow!=="function")throw Error("RadiantElement shadow render mode requires attachShadow().");return this.attachShadow({mode:"open"})}registerUpdateCallback(F,M){return this.reactiveHost.registerUpdateCallback(F,M)}getReactiveBinding(F){return this.reactiveHost.getReactiveBinding(F)}bind(F){return this.reactiveHost.getReactiveBinding(F)}defineReactiveBinding(F,M=!0){this.reactiveHost.defineReactiveBinding(F,M)}trackReactiveRead(F){this.reactiveHost.trackReactiveRead(F)}subscribeEvents(F){let M=[];for(let P of F)M.push(this.subscribeEvent(P));return M}hasEventSubscription(F){return this.eventSubscriptionRegistry.hasEventSubscription(F)}subscribeEvent(F){return this.eventSubscriptionRegistry.subscribe(F)}registerCleanupCallback(F){this.reactiveHost.registerCleanupCallback(F)}registerConnectedCallback(F){this.reactiveHost.registerConnectedCallback(F)}registerEventEmitter(F,M){this.eventEmitters.set(F,M)}getRef(F,M=!1){let P=`[data-ref="${F}"]`,{queryRoot:$}=this.resolveRenderSurface();if(M)return Array.from($.querySelectorAll(P));return $.querySelector(P)??null}getSlotElement(F){return this.getSlotElements(F)[0]??null}getSlotElements(F){return this.getOrCreateRenderRuntime().getSlotElements(F)}createReactiveField(F,M,P={}){this.reactiveHost.createReactiveField(F,M,P)}createReactiveProp(F,M){this.reactivePropertyState.create(F,M,(P,$,Z)=>I0(this,P,$,Z),(P,$)=>{this.reactiveHost.defineReactiveAccessor(P,$)})}getSlotProjectionScriptTag(){return this.getOrCreateRenderRuntime().getSlotProjectionScriptTag()}getAuthoredHydrationScriptMarkup(){return this.getOrCreateRenderRuntime().getAuthoredHydrationScriptMarkup()}resolveTrackedRenderOutput(){return this.getOrCreateRenderRuntime().resolveTrackedRenderOutput()}getOrCreateRenderRuntime(){if(this.renderRuntime)return this.renderRuntime;return this.renderRuntime=new x0(this),this.renderRuntime}resolveRenderSurface(){let F=this.getRenderTarget(),M=typeof ShadowRoot<"u"&&F instanceof ShadowRoot?F:this;return{interactionTarget:M,queryRoot:M,renderTarget:F}}}function RM(){let F=FF();if(!F)throw Error("Radiant SSR runtime unavailable. Import `@ecopages/radiant/server/render-component` first.");return F}function MF(F){return a0()&&LM(F)}import{render as TM}from"@ecopages/jsx";class $F{host;element;bindings;$;reactiveHost;connected=!1;renderScheduler;isSsrLifecycle=!1;hostSsrRegistry=new K;renderSignal;renderWatcher=v(()=>{this.requestUpdate()});constructor(F){this.host=F,this.element=F,this.reactiveHost=new w(this,{defineProperty:(M,P,$)=>Object.defineProperty(M,P,$),hasProperty:(M,P)=>(P in M),readProperty:(M,P)=>M[P]},()=>this.shouldAutoBindReactiveMembers()),this.bindings=this.reactiveHost.bindings,this.$=this.reactiveHost.$,this.renderScheduler=new k({canFlush:()=>this.connected&&!this.renderScheduler.rendering,commit:()=>{let M=this.getRenderTarget();if(!M)return;TM(this.resolveTrackedRenderOutput(),M)}}),J(this,"construct")}connect(){if(J(this,"connect"),this.connected=!0,this.reactiveHost.connectHost(),this.shouldRunRenderLifecycle())this.update()}runWithSsrLifecycle(F){this.isSsrLifecycle=!0;try{return F()}finally{this.isSsrLifecycle=!1}}disconnect(){this.connected=!1,this.disconnectRenderWatcher(),this.reactiveHost.disconnectHost()}get isConnected(){return this.connected}render(){return null}requestUpdate(){if(!this.shouldRunRenderLifecycle())return;this.renderScheduler.requestUpdate()}update(){if(!this.shouldRunRenderLifecycle())return;if(!this.getRenderTarget())return;this.renderScheduler.markPending(),this.renderScheduler.flush()}bind(F){return this.reactiveHost.getReactiveBinding(F)}getReactiveBinding(F){return this.reactiveHost.getReactiveBinding(F)}createReactiveField(F,M,P={}){this.reactiveHost.createReactiveField(F,M,P)}createReactiveProp(F,M){let{type:P,defaultValue:$,bind:Z}=M;L(P,$);let x=new ZF(this.host,this,F),H=x.getInitialValue()??$??I(P);this.reactiveHost.defineReactiveAccessor(F,{bind:Z,getValue:()=>H,setValue:(W)=>{H=W},notifyInitialValue:H}),x.install(),this.registerCleanupCallback(()=>{x.restore()})}defineReactiveBinding(F,M=!0){this.reactiveHost.defineReactiveBinding(F,M)}notifyUpdate(F,M,P){this.reactiveHost.notifyUpdate(F,M,P)}registerUpdateCallback(F,M){return this.reactiveHost.registerUpdateCallback(F,M)}connectedContextCallback(F){}registerContextProvider(F,M){this.hostSsrRegistry.registerContextProvider(F,M)}registerHydrationBinding(F,M){this.hostSsrRegistry.registerHydrationBinding(F,M)}getSsrContextProviders(){return this.hostSsrRegistry.getContextProviders()}getSsrHydrationBindings(){return this.hostSsrRegistry.getHydrationBindings()}registerCleanupCallback(F){this.reactiveHost.registerCleanupCallback(F)}registerConnectedCallback(F){this.reactiveHost.registerConnectedCallback(F)}registerReactiveDependencyReader(F,M){this.reactiveHost.registerReactiveDependencyReader(F,M)}trackReactiveRead(F){this.reactiveHost.trackReactiveRead(F)}addEventListener(F,M,P){this.host.addEventListener(F,M,P)}removeEventListener(F,M,P){this.host.removeEventListener(F,M,P)}dispatchEvent(F){return this.host.dispatchEvent(F)}getRef(F,M=!1){let P=`[data-ref="${F}"]`;if(M)return Array.from(this.host.querySelectorAll(P));return this.host.querySelector(P)??null}shouldAutoBindReactiveMembers(){return!0}shouldRunRenderLifecycle(){return!this.isSsrLifecycle&&this.render!==$F.prototype.render}getRenderTarget(){return this.host instanceof HTMLElement?this.host:null}disconnectRenderWatcher(){if(!this.renderSignal)return;this.renderWatcher.unwatch(this.renderSignal),this.renderSignal=void 0}resolveTrackedRenderOutput(){let F=b(()=>this.render()),M=F.get();if(!this.connected)return M;if(this.renderSignal)this.renderWatcher.unwatch(this.renderSignal);return this.renderSignal=F,this.renderWatcher.watch(F),M}}class ZF{host;controller;propertyName;ownDescriptor;constructor(F,M,P){this.host=F;this.controller=M;this.propertyName=P;this.ownDescriptor=Object.getOwnPropertyDescriptor(this.host,this.propertyName)}getInitialValue(){return Reflect.get(this.host,this.propertyName)}install(){Object.defineProperty(this.host,this.propertyName,{get:()=>Reflect.get(this.controller,this.propertyName),set:(F)=>{Reflect.set(this.controller,this.propertyName,F)},enumerable:this.ownDescriptor?.enumerable??!0,configurable:!0})}restore(){let F=Reflect.get(this.controller,this.propertyName);if(this.ownDescriptor){if(Object.defineProperty(this.host,this.propertyName,this.ownDescriptor),"value"in this.ownDescriptor&&this.ownDescriptor.writable)Reflect.set(this.host,this.propertyName,F);return}Reflect.deleteProperty(this.host,this.propertyName);try{Reflect.set(this.host,this.propertyName,F)}catch{Object.defineProperty(this.host,this.propertyName,{value:F,writable:!0,enumerable:!0,configurable:!0})}}}var xF=Symbol.for("@ecopages/radiant.controllerIdentifier");function W0(F,M){F[xF]=M}function nP(F){return F[xF]}var u="data-controller",AF=Symbol.for("@ecopages/radiant.controller-registry-state");function zM(){let F=globalThis,M=F[AF];if(M)return M;let P={activeRuntimes:new Set,controllerRegistrationStrategy:"keep-current",controllerRegistry:new Map};return F[AF]=P,P}var y=zM(),R=y.controllerRegistry,E=y.activeRuntimes;function HF(F){let M=F.getAttribute(u);if(!M)return[];return M.split(/\s+/).map((P)=>P.trim()).filter((P)=>P.length>0)}function g(F,M){if(F instanceof Element&&F.hasAttribute(u))M(F);for(let P of Array.from(F.querySelectorAll(`[${u}]`)))M(P)}class WF{root;controllersByElement=new Map;observer;stopped=!1;constructor(F=document){this.root=F;this.start()}stop(){if(this.stopped)return;this.stopped=!0,this.observer?.disconnect(),this.observer=void 0;for(let[F,M]of this.controllersByElement)for(let[P]of M)this.disconnectController(F,P);E.delete(this)}reconcileRegisteredController(F){g(this.root,(M)=>{if(!HF(M).includes(F))return;this.connectController(M,F)})}replaceRegisteredController(F){for(let[M,P]of Array.from(this.controllersByElement.entries())){if(!P.has(F))continue;this.disconnectController(M,F)}this.reconcileRegisteredController(F)}start(){if(g(this.root,(M)=>{this.reconcileElement(M)}),typeof MutationObserver>"u"){E.add(this);return}this.observer=new MutationObserver((M)=>{for(let P of M){if(P.type==="attributes"&&P.target instanceof Element){this.reconcileElement(P.target);continue}for(let $ of Array.from(P.removedNodes)){if(!($ instanceof Element))continue;g($,(Z)=>{this.disconnectElementControllers(Z)})}for(let $ of Array.from(P.addedNodes)){if(!($ instanceof Element))continue;g($,(Z)=>{this.reconcileElement(Z)})}}});let F=this.root instanceof Document?this.root.documentElement:this.root;this.observer.observe(F,{attributeFilter:[u],attributes:!0,childList:!0,subtree:!0}),E.add(this)}reconcileElement(F){let M=new Set(HF(F)),P=this.controllersByElement.get(F);if(P){for(let $ of P.keys())if(!M.has($))this.disconnectController(F,$)}for(let $ of M)this.connectController(F,$)}connectController(F,M){let P=R.get(M);if(!P)return;let $=this.controllersByElement.get(F);if(!$)$=new Map,this.controllersByElement.set(F,$);if($.has(M))return;let Z=new P(F);$.set(M,Z),Z.connect()}disconnectController(F,M){let P=this.controllersByElement.get(F);if(!P)return;let $=P.get(M);if(!$)return;if($.disconnect(),P.delete(M),P.size===0)this.controllersByElement.delete(F)}disconnectElementControllers(F){let M=this.controllersByElement.get(F);if(!M)return;for(let P of Array.from(M.keys()))this.disconnectController(F,P)}}function _M(F,M){let P=R.get(F);if(P)return console.warn(`[radiant] Controller "${F}" is already registered. Keeping the existing constructor.`),P;W0(M,F),R.set(F,M);for(let $ of Array.from(E))$.reconcileRegisteredController(F);return M}function tP(F){return R.has(F)}function aP(F){return R.get(F)}function EM(F,M){if(R.get(F)===M)return M;W0(M,F),R.set(F,M);for(let $ of Array.from(E))$.replaceRegisteredController(F);return M}function XF(F){y.controllerRegistrationStrategy=F}function eP(){XF("replace")}function F$(){XF("keep-current")}function GF(F,M){if(y.controllerRegistrationStrategy==="replace")return EM(F,M);return _M(F,M)}function M$(F=document){return new WF(F)}function P$(){for(let F of Array.from(E))F.stop()}function KM(F){return typeof F==="function"}function q(F,M,P,$){if(typeof $==="object")return F(void 0,$);return M(P,$)}function j(F,M,P,$,Z){if(typeof $==="object"){if(!KM(P))throw TypeError("Standard method decorators require a method target");return F(P,$)}if(!Z)throw TypeError("Legacy method decorators require a property descriptor");return M(P,$,Z)}function X0(F){if(F instanceof Element)return F;if("host"in F)return F.host;return F.element}function IM(F){return F.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/_/g,"-").toLowerCase()}function kM(F,M){if(M.converter?.fromAttribute){let P=M.converter.fromAttribute(F);if(F===null&&P===void 0&&"defaultValue"in M)return M.defaultValue;return P}if(M.type){if(F===null)return M.defaultValue??I(M.type);if(M.type===Boolean&&F==="")return!0;return z(F,M.type)}if(F===null)return M.defaultValue;return F}function T(F,M,P){return kM(X0(F).getAttribute(M),P)}function wM(F,M,P,$){let Z=$.converter?.toAttribute?$.converter.toAttribute(P):$.type?S(P,$.type):P==null?null:String(P);if(Z===null){F.removeAttribute(M);return}F.setAttribute(M,Z)}function m(F,M,P={}){if(P.type)L(P.type,P.defaultValue);let $=F,Z=P.source??IM(M),x=Symbol(`@ecopages/radiant/attr:${M}:observer`),A=Symbol(`@ecopages/radiant/attr:${M}:last-value`),H=P.bind??F.shouldAutoBindReactiveMembers?.()??!1;F.defineReactiveBinding(M,H),F.registerReactiveDependencyReader(M,()=>T(F,Z,P)),$[A]=T(F,Z,P),Object.defineProperty(F,M,{get(){return F.trackReactiveRead(M),T(this,Z,P)},set(G){let U=X0(this),D=T(this,Z,P);wM(U,Z,G,P);let B=T(this,Z,P);if(Object.is(D,B))return;this[A]=B,F.notifyUpdate(M,D,B)},enumerable:!0,configurable:!0});let W=()=>{$[x]?.disconnect()},X=()=>{let G=T(F,Z,P),U=$[A];if(!Object.is(U,G))$[A]=G,F.notifyUpdate(M,U,G);if(typeof MutationObserver>"u")return;let D=X0(F);W();let B=new MutationObserver(()=>{let t=T(F,Z,P),B0=$[A];if(Object.is(B0,t))return;$[A]=t,F.notifyUpdate(M,B0,t)});B.observe(D,{attributeFilter:[Z],attributes:!0}),$[x]=B};X(),F.registerConnectedCallback(X),F.registerCleanupCallback(W)}function UF(F={}){return(M,P)=>{let $=Symbol(`@ecopages/radiant/attr:${P}:installed`);Q(M,(Z)=>{Z.registerConnectedCallback(()=>{if(Z[$])return;let x=Z[P],A=F.defaultValue===void 0?x:F.defaultValue;m(Z,P,{...F,defaultValue:A}),Z[$]=!0})})}}function QF(F={}){return function(M,P){let $=String(P.name),Z=Symbol(`@ecopages/radiant/attr:${$}:initializer`);return P.addInitializer(function(){let x=this[Z],A=F.defaultValue===void 0?x:F.defaultValue;m(this,$,{...F,defaultValue:A})}),function(x){return this[Z]=x,x}}}function L$(F={}){function M(P,$){return q(QF(F),UF(F),P,$)}return M}function BF(F,M,P){let $=P.value;return{configurable:!0,get(){if(this===F.prototype||Object.prototype.hasOwnProperty.call(this,M))return $;let Z=$.bind(this);return Object.defineProperty(this,M,{value:Z,configurable:!0,writable:!0}),Z}}}function DF(F,M){let P=String(M.name);if(M.private)throw Error(`'bound' cannot decorate private properties like ${P}.`);M.addInitializer(function(){this[P]=this[P].bind(this)})}function _$(F,M,P){return j(DF,BF,F,M,P)}function I$(F){return function(M){return GF(F,M)}}var qF=Symbol.for("@ecopages/radiant.customElementTagName");function c(F,M){F[qF]=M}function w$(F){return F[qF]}function LF(F,M){return(P)=>{if(c(P,F),typeof customElements<"u"&&!customElements.get(F))customElements.define(F,P,M)}}function jF(F,M){return function(P,$){$.addInitializer(function(){if(c(this,F),typeof customElements<"u"&&!customElements.get(F))customElements.define(F,this,M)})}}function N$(F,M){function P($,Z){if(typeof Z<"u")return jF(F,M)($,Z);return LF(F,M)($)}return P}function s(F,M){let P=null,$=null,Z,x=()=>{if(P!==null)clearTimeout(P),P=null},A=()=>{if($===null)return Z;let W=$;return $=null,x(),Z=W(),Z},H=function(...W){$=()=>F.apply(this,W),x(),P=setTimeout(()=>{A()},M)};return H.cancel=()=>{x(),$=null},H.flush=()=>{if($===null)return Z;return A()},H.pending=()=>$!==null,H}function JF(F){return(M,P,$)=>{let Z=$.value,x=new WeakMap;return $.value=function(...H){let W=x.get(this);if(!W)W=s((...X)=>{return Z.apply(this,X)},F),x.set(this,W);W(...H)},$}}function YF(F){return(M)=>{let P=new WeakMap;return function(...$){let Z=P.get(this);if(!Z)Z=s((...x)=>{return M.apply(this,x)},F),P.set(this,Z);Z(...$)}}}function i$(F){function M(P,$,Z){return j(YF(F),JF(F),P,$,Z)}return M}class G0{host;eventConfig;constructor(F,M){this.host=F,this.eventConfig=M}emit(F){let M=new CustomEvent(this.eventConfig.name,{detail:F,bubbles:this.eventConfig.bubbles,cancelable:this.eventConfig.cancelable,composed:this.eventConfig.composed});this.host.dispatchEvent(M)}}function d(F,M){let P=new G0(F,M);return F.registerEventEmitter(M.name,P),P}function RF(F){return(M,P)=>{Q(M,($)=>{let Z=d($,F);$.registerConnectedCallback(()=>{Object.defineProperty($,P,{get(){return Z},enumerable:!0,configurable:!0})})})}}function TF(F){return function(M,P){P.addInitializer(function(){let $=d(this,F);Object.defineProperty(this,P.name,{get(){return $},enumerable:!0,configurable:!0})})}}function x2(F){function M(P,$){return q(TF(F),RF(F),P,$)}return M}function zF(F){let M=globalThis.CSS;if(typeof M?.escape==="function")return M.escape(F);let P="";for(let $=0;$<F.length;$+=1){let Z=F[$]??"",x=Z.codePointAt(0)??0;if(x===0){P+="�";continue}let A=x>=1&&x<=31||x===127,H=$===0&&x>=48&&x<=57,W=$===1&&x>=48&&x<=57&&(F[0]??"")==="-",X=$===0&&Z==="-"&&F.length===1;if(A||H||W){P+=`\\${x.toString(16)} `;continue}if(x>=128||Z==="-"||Z==="_"||x>=48&&x<=57||x>=65&&x<=90||x>=97&&x<=122){P+=X?`\\${Z}`:Z;continue}P+=`\\${Z}`}return P}var p=Symbol("radiant.shadowRootListenerHooks"),_F=Symbol("radiant.patchedAttachShadow");function KF(F){if(F instanceof Element)return F;if("host"in F)return F.host;return F.element}function CM(F){return!(F instanceof Element)}function EF(F,M,P,$){let Z=(x)=>{if(x.target instanceof Element&&x.target.matches(P))$(x)};return F.addEventListener(M.type,Z,M.options),()=>{F.removeEventListener(M.type,Z,M.options)}}function OM(F,M){let P=KF(F);if(!P[p])P[p]=new Set;if(P[p].add(M),P[_F])return;let $=P.attachShadow;P.attachShadow=function(x){let A=$.call(this,x);for(let H of P[p]??[])H();return A},P[_F]=!0}function i(F,M,P){if(CM(F)&&"scope"in M&&M.scope&&M.scope!=="light")throw Error("RadiantController event listeners only support light DOM scope.");let $=KF(F),Z=P.bind(F),x=null,A=null,H=null,W=null,X=!1,G=()=>{x?.(),A?.(),H?.(),W?.(),x=null,A=null,H=null,W=null},U=()=>{if(X)return;if("window"in M&&!x)window.addEventListener(M.type,Z,M.options),x=()=>{window.removeEventListener(M.type,Z,M.options)};if("document"in M&&!A)document.addEventListener(M.type,Z,M.options),A=()=>{document.removeEventListener(M.type,Z,M.options)};if("selector"in M||"ref"in M){let D="selector"in M?M.selector:`[data-ref='${zF(M.ref)}']`;if(M.scope!=="shadow"&&!H)H=EF($,M,D,Z);if(M.scope!=="light"&&$.shadowRoot&&!W)W=EF($.shadowRoot,M,D,Z)}};if("selector"in M||"ref"in M){if(M.scope!=="light")OM(F,()=>{if(F.isConnected)U()})}if(F.registerConnectedCallback(U),F.registerCleanupCallback(G),F.isConnected)U();return()=>{X=!0,G()}}function IF(F){return(M,P,$)=>{let Z=$.value;return Q(M,(x)=>{i(x,F,Z.bind(x))}),$}}function kF(F){return function(M,P){P.addInitializer(function(){i(this,F,M.bind(this))})}}function J2(F){function M(P,$,Z){return j(kF(F),IF(F),P,$,Z)}return M}function wF(F){return(M,P)=>{let $=Symbol(`@ecopages/radiant/on-updated:${P}:cleanup`);Q(M,(Z)=>{Z.registerConnectedCallback(()=>{let x=Z[P].bind(Z),A=[];if(Array.isArray(F))for(let H of F)A.push(Z.registerUpdateCallback(H,x));else if(typeof F==="string")A.push(Z.registerUpdateCallback(F,x));Z[$]=()=>{for(let H of A)H()}}),Z.registerCleanupCallback(()=>{let x=Z[$];if(typeof x==="function")x(),delete Z[$]})})}}function CF(F){return function(M,P){P.addInitializer(function(){let $=M.bind(this);if(Object.defineProperty(this,P.name,{value:$,configurable:!0,writable:!0}),Array.isArray(F))for(let Z of F)this.registerUpdateCallback(Z,$);else if(typeof F==="string")this.registerUpdateCallback(F,$)})}}function I2(F){function M(P,$,Z){return j(CF(F),wF(F),P,$,Z)}return M}function OF({type:F,attribute:M,reflect:P,defaultValue:$,bind:Z}){return L(F,$),(x,A)=>{let H=M??A;f(x,A,{type:F,reflect:P,attribute:H,defaultValue:$,bind:Z});let W=Symbol.for(`@ecopages/radiant.ssr-prop:${A}`);Object.defineProperty(x,A,{get(){return this[W]??$},set(X){this[W]=X},configurable:!0,enumerable:!0}),Q(x,(X)=>{X.registerConnectedCallback(()=>{let G=X[A],U=$===void 0?G:$;X.createReactiveProp(A,{type:F,reflect:P,attribute:H,defaultValue:U,bind:Z})})})}}function fF({type:F,attribute:M,reflect:P,defaultValue:$,bind:Z}){return L(F,$),function(x,A){let H=String(A.name),W=M??H,X=Symbol(`@ecopages/radiant/reactive-prop:${H}:initializer`);return A.addInitializer(function(){let G=this[X],U=$===void 0?G:$;f(this,H,{type:F,reflect:P,attribute:W,defaultValue:$,bind:Z}),this.createReactiveProp(H,{type:F,reflect:P,attribute:W,defaultValue:U,bind:Z})}),function(G){return this[X]=G,G}}}function g2(F){function M(P,$){return q(fF(F),OF(F),P,$)}return M}function fM(F){return!(F instanceof Element)}function SM(F){return"shadowRoot"in F?F.shadowRoot??null:null}function VM(F){return F instanceof Element?F:F.host}function bM(F,M="light"){let P=SM(F);if(M==="shadow")return P?[P]:[];if(M==="both")return P?[F,P]:[F];return[F]}function l(F,M){if(fM(F)&&M.scope&&M.scope!=="light")throw Error("RadiantController queries only support light DOM scope.");let P=VM(F),$="selector"in M?M.selector:`[data-ref="${M.ref}"]`,Z=null,x=()=>{let A=bM(P,M.scope);if(M.all)return A.flatMap((H)=>Array.from(H.querySelectorAll($)));for(let H of A){let W=H.querySelector($);if(W)return W}return null};return{get value(){if(M.cache){if(Z===null||M.all&&Array.isArray(Z)&&!Z.length)Z=x();return Z}return x()}}}function SF({cache:F=!0,...M}){return(P,$)=>{Q(P,(Z)=>{Z.registerConnectedCallback(()=>{let x=l(Z,{cache:F,...M});Object.defineProperty(Z,$,{get(){return x.value},enumerable:!0,configurable:!0})})})}}function VF(F){return function(M,P){let $=String(P.name);P.addInitializer(function(){let Z=l(this,F);Object.defineProperty(this,$,{get(){return Z.value},enumerable:!0,configurable:!0})})}}function r2(F){function M(P,$){return q(VF(F),SF(F),P,$)}return M}function C(F,M={}){let P=null,$,Z=()=>{if(M.all)return F.getSlotElements(M.name);return F.getSlotElements(M.name)[0]??null};return{get value(){if(M.cache===!1)return Z();let x=F.slotProjectionVersion??0;if($!==x)P=Z(),$=x;return P}}}function bF(F={}){return(M,P)=>{let $=(A)=>{return typeof Object.getOwnPropertyDescriptor(A,P)?.get==="function"},Z=(A)=>{if($(A))return;let H=C(A,F);Object.defineProperty(A,P,{get(){return H.value},enumerable:!0,configurable:!0})},x=new WeakMap;Object.defineProperty(M,P,{get(){let A=x.get(this);if(!A)A=C(this,F),x.set(this,A);return A.value},enumerable:!0,configurable:!0}),Q(M,(A)=>{o0(A,()=>{Z(A)}),A.registerConnectedCallback(()=>{Z(A)})})}}function vF(F={}){return function(M,P){let $=String(P.name);P.addInitializer(function(){let Z=C(this,F);Object.defineProperty(this,$,{get(){return Z.value},enumerable:!0,configurable:!0})})}}function H1(F={}){function M(P,$){return q(vF(F),bF(F),P,$)}return M}function NF(F){return b0({type:"signal",...F})}function hF(F){return v0(F)}import{createMarkupNodeLike as vM}from"@ecopages/jsx";import{state as NM}from"@ecopages/signals";function n(F){return typeof F==="object"&&F!==null&&typeof F.get==="function"&&typeof F.set==="function"&&typeof F.subscribe==="function"&&typeof F.update==="function"}class O{host;hydrate;hydrationKey;property;source;currentValue;hasAppliedHostHydration=!1;sourceUnsubscribe;constructor(F){this.host=F.host,this.hydrate=F.hydrate,this.hydrationKey=F.hydrationKey,this.property=F.property,this.source=F.source??NM(this.resolveInitialValue(F.initialValue)),this.currentValue=this.source.get()}get(){return this.source.get()}set(F){this.source.set(F)}subscribe(F){return this.source.subscribe(F)}update(F){this.set(F(this.get()))}connectToSource(){if(this.sourceUnsubscribe)return;let F=this.source.get();if(!Object.is(this.currentValue,F)){let M=this.currentValue;this.currentValue=F,this.host.notifyUpdate(this.property,M,F)}this.sourceUnsubscribe=this.source.subscribe((M)=>{this.handleSourceChange(M)})}disconnectFromSource(){this.sourceUnsubscribe?.(),this.sourceUnsubscribe=void 0}hydrateFromHost(){if(!this.hydrate||this.hasAppliedHostHydration)return;this.hasAppliedHostHydration=!0;let F=this.source.get(),M=this.resolveInitialValue(F);if(!Object.is(F,M))this.source.set(M),this.currentValue=this.source.get(),this.host.notifyUpdate(this.property,F,this.currentValue)}renderHydrationScript(){let F=this.renderHydrationScriptTag();if(!F)return;return vM(F)}renderHydrationScriptTag(){let F=this.serializeHydrationValue();if(!F)return;return NF({hydrationKey:this.hydrationKey,serializedValue:F})}findHydrationScriptElement(){if(!(this.host instanceof Element))return null;return h0(this.host,"signal",this.hydrationKey)}isObject(F){return typeof F==="object"&&!Array.isArray(F)&&F!==null}resolveInitialValue(F){if(!this.hydrate)return F;let M=this.findHydrationScriptElement();if(!M)return F;let P=N0(M,F);if(this.hydrate===Object&&this.isObject(P)&&this.isObject(F))return{...F,...P};return P}serializeHydrationValue(){if(!this.hydrate)return;let F=JSON.stringify(this.get());if(typeof F!=="string")return;return hF(F)}handleSourceChange(F){let M=this.currentValue;if(this.currentValue=F,!Object.is(M,F))this.host.notifyUpdate(this.property,M,F)}}function r(F){return new O(F)}function o(F){return typeof F.registerHydrationBinding==="function"}function U0(F={}){return(M,P)=>{let $=(Z)=>{let x=Z[P];if(x instanceof O)return x;let A=typeof F.source==="function"?F.source(Z):F.source??(n(x)?x:void 0),H=F.bind??Z.shouldAutoBindReactiveMembers?.()??!1,W=A!==void 0?F.initial:x===void 0?F.initial:x;Z.defineReactiveBinding(P,H);let X=r({host:Z,hydrate:F.hydrate,hydrationKey:P,initialValue:W,property:P,source:A});if(Z.registerConnectedCallback(()=>{X.hydrateFromHost(),X.connectToSource()}),Z.registerCleanupCallback(()=>{X.disconnectFromSource()}),F.hydrate&&o(Z))Z.registerHydrationBinding(P,X);return Z[P]=X,X};j0(M,(Z)=>{let x=$(Z);Z.registerConnectedCallback(()=>{if(!(Z[P]instanceof O))Z[P]=x})})}}function Q0(F={}){return function(M,P){let $=String(P.name);return function(Z){let x=typeof F.source==="function"?F.source(this):F.source??(n(Z)?Z:void 0),A=x!==void 0?F.initial:Z===void 0?F.initial:Z,H=F.bind??this.shouldAutoBindReactiveMembers?.()??!1;this.defineReactiveBinding($,H);let W=r({host:this,hydrate:F.hydrate,hydrationKey:$,initialValue:A,property:$,source:x});if(this.registerConnectedCallback(()=>{W.hydrateFromHost(),W.connectToSource()}),this.registerCleanupCallback(()=>{W.disconnectFromSource()}),F.hydrate&&o(this))this.registerHydrationBinding($,W);return W}}}function I1(F,M){if(typeof M<"u"){if(typeof M==="object"){if(F!==void 0)throw TypeError("@signal standard decorators require an undefined target");return Q0()(void 0,M)}if(F===void 0)throw TypeError("@signal legacy decorators require a host target");return U0()(F,M)}let P=F??{};function $(Z,x){if(typeof x==="object"){if(Z!==void 0)throw TypeError("@signal standard decorators require an undefined target");return Q0(P)(void 0,x)}if(Z===void 0)throw TypeError("@signal legacy decorators require a host target");return U0(P)(Z,x)}return $}function gF(F,M){Q(F,(P)=>{P.registerConnectedCallback(()=>{P.createReactiveField(M,P[M],{bind:P.shouldAutoBindReactiveMembers?.()??!1})})})}function uF(F,M){let P=String(M.name),$=Symbol(`@ecopages/radiant/state:${P}:initializer`);return M.addInitializer(function(){let Z=this[$];this.createReactiveField(P,Z,{bind:this.shouldAutoBindReactiveMembers?.()??!1,suppressInitialNotify:!0})}),function(Z){return this[$]=Z,Z}}function b1(F,M){return q(uF,gF,F,M)}export{g as visitControllerElements,P$ as stopControllers,b1 as state,M$ as startControllers,I1 as signal,XF as setControllerRegistrationStrategy,aP as resolveRegisteredController,EM as replaceController,GF as registerControllerWithConfiguredStrategy,_M as registerController,H1 as querySlot,r2 as query,g2 as prop,HF as parseControllerIdentifiers,I2 as onUpdated,J2 as onEvent,tP as hasRegisteredController,x2 as event,eP as enableControllerReplacementForHmr,F$ as disableControllerReplacementForHmr,i$ as debounce,N$ as customElement,I$ as controller,_$ as bound,L$ as attr,PF as RadiantElement,$F as RadiantController,WF as ControllerRegistryRuntime,AF as CONTROLLER_REGISTRY_STATE_KEY,u as CONTROLLER_ATTRIBUTE};
|
|
2
2
|
|
|
3
|
-
//# debugId=
|
|
3
|
+
//# debugId=EE37FAABC977B6A964756E2164756E21
|