@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
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/core/reactive-prop-metadata.ts", "../src/decorators/legacy/instance-initializers.ts", "../src/decorators/legacy/host-readiness.ts", "../src/utils/attribute-utils.ts", "../src/core/custom-element-metadata.ts", "../src/utils/escape-html-attribute.ts", "../src/server/host-attribute-serialization.ts", "../src/context/context-ssr-bridge.ts", "../src/server/context-ssr.ts", "../src/server/host-script-composition.ts", "../src/core/radiant-element-ssr-host.ts", "../src/server/radiant-element-ssr-extractor.ts", "../src/server/radiant-element-ssr-service.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"import type { ReactivePropertyOptions } from './reactive-prop-core';\n\nconst REACTIVE_PROP_DEFINITIONS = Symbol.for('@ecopages/radiant.reactivePropDefinitions');\n\nexport type ReactivePropDefinition = {\n\tname: string;\n\toptions: ReactivePropertyOptions<unknown>;\n};\n\ntype RadiantConstructorWithReactiveProps = CustomElementConstructor & {\n\t[REACTIVE_PROP_DEFINITIONS]?: ReactivePropDefinition[];\n};\n\nexport function registerReactivePropDefinition(\n\ttarget: object,\n\tpropertyName: string,\n\toptions: ReactivePropertyOptions<unknown>,\n): void {\n\tconst constructor = target.constructor as RadiantConstructorWithReactiveProps;\n\tconst definitions = constructor[REACTIVE_PROP_DEFINITIONS] ?? [];\n\n\tif (definitions.some((definition) => definition.name === propertyName)) {\n\t\treturn;\n\t}\n\n\tdefinitions.push({ name: propertyName, options });\n\tconstructor[REACTIVE_PROP_DEFINITIONS] = definitions;\n}\n\nexport function getReactivePropDefinitions(target: object): ReactivePropDefinition[] {\n\treturn ((target.constructor as RadiantConstructorWithReactiveProps)[REACTIVE_PROP_DEFINITIONS] ?? []).slice();\n}\n",
|
|
6
|
+
"type LegacyInstanceInitializer<T extends object = object> = (instance: T) => void;\n\nconst LEGACY_INSTANCE_INITIALIZERS = Symbol.for('@ecopages/radiant.legacy-instance-initializers');\nconst LEGACY_POST_CONSTRUCTION_INITIALIZERS = Symbol.for('@ecopages/radiant.legacy-post-construction-initializers');\nconst LEGACY_EXECUTED_POST_CONSTRUCTION_INITIALIZERS = Symbol.for(\n\t'@ecopages/radiant.legacy-executed-post-construction-initializers',\n);\n\n/**\n * Registers per-instance initialization work for a legacy decorator.\n *\n * Legacy decorators execute against the prototype, so any initialization that\n * needs the concrete element instance must be deferred until construction time.\n */\nexport function registerLegacyInstanceInitializer<T extends object>(\n\tproto: T,\n\tinitializer: LegacyInstanceInitializer<T>,\n): void {\n\tregisterInitializer(proto, LEGACY_INSTANCE_INITIALIZERS, initializer);\n}\n\n/**\n * Registers post-construction work for a legacy decorator.\n *\n * This phase exists for decorators that eagerly write instance fields. With\n * legacy decorators plus `useDefineForClassFields`, subclass field definition\n * can overwrite values written during the base-class constructor.\n */\nexport function registerLegacyPostConstructionInitializer<T extends object>(\n\tproto: T,\n\tinitializer: LegacyInstanceInitializer<T>,\n): void {\n\tregisterInitializer(proto, LEGACY_POST_CONSTRUCTION_INITIALIZERS, initializer);\n}\n\n/**\n * Runs all legacy decorator initializers for a newly constructed element.\n *\n * Initializers are collected from the prototype chain and executed from base to\n * derived class so inherited setup remains stable.\n */\nexport function runLegacyInstanceInitializers<T extends object>(instance: T): void {\n\trunLegacyInitializers(instance, LEGACY_INSTANCE_INITIALIZERS);\n}\n\n/**\n * Runs legacy decorator setup that must happen after subclass field\n * initialization has completed.\n *\n * Each initializer runs at most once per instance even if multiple lifecycle\n * entrypoints call this helper.\n */\nexport function runLegacyPostConstructionInitializers<T extends object>(instance: T): void {\n\tconst target = instance as Record<PropertyKey, unknown>;\n\n\trunLegacyInitializers(\n\t\tinstance,\n\t\tLEGACY_POST_CONSTRUCTION_INITIALIZERS,\n\t\t(target[LEGACY_EXECUTED_POST_CONSTRUCTION_INITIALIZERS] ??= new Set()) as Set<LegacyInstanceInitializer<T>>,\n\t);\n}\n\nfunction registerInitializer<T extends object>(proto: T, key: symbol, initializer: LegacyInstanceInitializer<T>): void {\n\tconst target = proto as Record<PropertyKey, unknown>;\n\tconst ownInitializers = Object.prototype.hasOwnProperty.call(target, key) ? target[key] : undefined;\n\n\tif (Array.isArray(ownInitializers)) {\n\t\townInitializers.push(initializer);\n\t\treturn;\n\t}\n\n\tObject.defineProperty(target, key, {\n\t\tvalue: [initializer],\n\t});\n}\n\nfunction runLegacyInitializers<T extends object>(\n\tinstance: T,\n\tkey: symbol,\n\texecutedInitializers?: Set<LegacyInstanceInitializer<T>>,\n\tprototype: object | null = Object.getPrototypeOf(instance),\n): void {\n\tif (!prototype || prototype === Object.prototype) {\n\t\treturn;\n\t}\n\n\trunLegacyInitializers(instance, key, executedInitializers, Object.getPrototypeOf(prototype));\n\n\tconst initializers = (prototype as Record<PropertyKey, unknown>)[key] as LegacyInstanceInitializer<T>[] | undefined;\n\n\tif (!Array.isArray(initializers)) {\n\t\treturn;\n\t}\n\n\tfor (const initializer of initializers) {\n\t\tif (executedInitializers?.has(initializer)) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tinitializer(instance);\n\t\texecutedInitializers?.add(initializer);\n\t}\n}\n",
|
|
7
|
+
"import {\n\trunLegacyInstanceInitializers,\n\trunLegacyPostConstructionInitializers,\n} from './instance-initializers';\n\nexport type LegacyHostReadinessPhase = 'construct' | 'connect' | 'ssr';\n\n/**\n * Runs legacy decorator initialization for the requested lifecycle phase.\n *\n * Post-construction work is idempotent — multiple calls with `connect` or `ssr`\n * only execute each registered initializer once per instance.\n */\nexport function ensureLegacyHostReady<T extends object>(host: T, phase: LegacyHostReadinessPhase): void {\n\tswitch (phase) {\n\t\tcase 'construct':\n\t\t\trunLegacyInstanceInitializers(host);\n\t\t\tbreak;\n\t\tcase 'connect':\n\t\tcase 'ssr':\n\t\t\trunLegacyPostConstructionInitializers(host);\n\t\t\tbreak;\n\t}\n}\n",
|
|
8
|
+
"import type { RadiantElement } from '../core/radiant-element';\n\nexport type AttributeTypeConstant = typeof Array | typeof Boolean | typeof Number | typeof Object | typeof String;\n\nexport type AttributeTypeDefault = Array<unknown> | boolean | number | Record<string, unknown> | string;\n\n/**\n * Parses the given attribute type constant and returns its corresponding string representation.\n *\n * @param constant - The attribute type constant to parse.\n * @returns The string representation of the attribute type constant.\n */\nexport function parseAttributeTypeConstant(constant?: AttributeTypeConstant) {\n\tswitch (constant) {\n\t\tcase Array:\n\t\t\treturn 'array';\n\t\tcase Boolean:\n\t\t\treturn 'boolean';\n\t\tcase Number:\n\t\t\treturn 'number';\n\t\tcase Object:\n\t\t\treturn 'object';\n\t\tcase String:\n\t\t\treturn 'string';\n\t}\n}\n\n/**\n * Parses the attribute type default value and returns its type as a string.\n *\n * @param defaultValue - The default value of the attribute type.\n * @returns The type of the default value as a string.\n */\nexport function parseAttributeTypeDefault(defaultValue?: AttributeTypeDefault) {\n\tswitch (typeof defaultValue) {\n\t\tcase 'boolean':\n\t\t\treturn 'boolean';\n\t\tcase 'number':\n\t\t\treturn 'number';\n\t\tcase 'string':\n\t\t\treturn 'string';\n\t}\n\n\tif (Array.isArray(defaultValue)) return 'array';\n\tif (Object.prototype.toString.call(defaultValue) === '[object Object]') return 'object';\n}\n\n/**\n * Returns the default value for a given attribute type.\n *\n * @param type - The attribute type constant.\n * @returns The default value for the specified attribute type.\n */\nexport function defaultValueForType(type: AttributeTypeConstant): unknown {\n\tswitch (type) {\n\t\tcase Number:\n\t\t\treturn 0;\n\t\tcase String:\n\t\t\treturn '';\n\t\tcase Boolean:\n\t\t\treturn false;\n\t\tdefault:\n\t\t\treturn null;\n\t}\n}\n\ntype Reader = (value: string) => number | string | boolean | object | unknown[];\n\n/**\n * Utility function to parse a JSON string safely\n */\nfunction parseJSON<T>(value: string): T {\n\ttry {\n\t\treturn JSON.parse(value);\n\t} catch {\n\t\tthrow new TypeError('Invalid JSON string');\n\t}\n}\n\n/**\n * Object that maps attribute types to reader functions.\n * @type {Object.<string, Reader>}\n */\nconst readers: { [type: string]: Reader } = {\n\tarray(value: string): unknown[] {\n\t\tconst array = parseJSON<unknown[]>(value);\n\t\tif (!Array.isArray(array)) {\n\t\t\tthrow new TypeError(`Expected an array but got a value of type \"${typeof array}\"`);\n\t\t}\n\t\treturn array;\n\t},\n\n\tboolean(value: string): boolean {\n\t\treturn !(value === '0' || String(value).toLowerCase() === 'false');\n\t},\n\n\tnumber(value: string): number {\n\t\tconst number = Number(value.replace(/_/g, ''));\n\t\treturn number;\n\t},\n\n\tobject(value: string): object {\n\t\tconst object = JSON.parse(value);\n\t\tif (object === null || typeof object !== 'object' || Array.isArray(object)) {\n\t\t\tthrow new TypeError(\n\t\t\t\t`expected value of type \"object\" but instead got value \"${value}\" of type \"${parseAttributeTypeDefault(\n\t\t\t\t\tobject,\n\t\t\t\t)}\"`,\n\t\t\t);\n\t\t}\n\t\treturn object;\n\t},\n\n\tstring(value: string): string {\n\t\treturn value;\n\t},\n};\n\ntype Writer = (value: unknown) => string;\n\n/**\n * Object that maps attribute types to writer functions.\n * @type {Object.<string, Writer>}\n */\nconst writers: { [type: string]: Writer } = {\n\tdefault: writeString,\n\tarray: writeJSON,\n\tobject: writeJSON,\n};\n\nfunction writeJSON(value: unknown) {\n\treturn JSON.stringify(value);\n}\n\nfunction writeString(value: unknown) {\n\treturn `${value}`;\n}\n\n/**\n * Reads the attribute value based on the provided type.\n * @param value - The attribute value to be read.\n * @param type - The type of the attribute.\n * @returns The parsed attribute value.\n * @throws {TypeError} If the provided type is unknown.\n */\nexport function readAttributeValue(value: string, type: AttributeTypeConstant) {\n\tconst readerType = parseAttributeTypeConstant(type);\n\tif (!readerType) throw new TypeError(`[radiant-element] Unknown type \"${type}\"`);\n\treturn readers[readerType]!(value);\n}\n\nexport type ReadAttributeValueReturnType = ReturnType<typeof readAttributeValue>;\n\n/**\n * Writes the attribute value based on the provided type.\n *\n * @param value - The value to be written.\n * @param type - The type of the attribute.\n * @returns The written attribute value.\n * @throws {TypeError} If the provided type is unknown.\n */\nexport function writeAttributeValue(value: unknown, type: AttributeTypeConstant) {\n\tconst writerType = parseAttributeTypeConstant(type);\n\tif (!writerType) throw new TypeError(`[radiant-element] Unknown type \"${type}\"`);\n\tconst writer: Writer = writers[writerType] ?? writers.default ?? writeString;\n\treturn writer(value);\n}\n\nexport type WriteAttributeValueReturnType = ReturnType<typeof writeAttributeValue>;\n\n/*\n * Type guard functions for each type in AttributeTypeConstant\n */\nfunction isBoolean(value: unknown): value is boolean {\n\treturn typeof value === 'boolean';\n}\n\nfunction isNumber(value: unknown): value is number {\n\treturn typeof value === 'number';\n}\n\nfunction isString(value: unknown): value is string {\n\treturn typeof value === 'string';\n}\n\nfunction isArray(value: unknown): value is Array<unknown> {\n\treturn Array.isArray(value);\n}\n\nfunction isObject(value: unknown): value is object {\n\treturn typeof value === 'object' && !Array.isArray(value) && value !== null;\n}\n\n/*\n * Check function to ensure defaultValue matches the type\n */\nexport function isValueOfType(type: AttributeTypeConstant, defaultValue: unknown): boolean {\n\tswitch (type) {\n\t\tcase Boolean:\n\t\t\treturn isBoolean(defaultValue);\n\t\tcase Number:\n\t\t\treturn isNumber(defaultValue);\n\t\tcase String:\n\t\t\treturn isString(defaultValue);\n\t\tcase Array:\n\t\t\treturn isArray(defaultValue);\n\t\tcase Object:\n\t\t\treturn isObject(defaultValue);\n\t\tdefault:\n\t\t\treturn false;\n\t}\n}\n\nexport const getInitialValue = (\n\ttarget: RadiantElement,\n\ttype: AttributeTypeConstant,\n\tattributeKey: string,\n\tdefaultValue: unknown,\n) => {\n\tif (type === Boolean) {\n\t\tconst attributeValue = target.getAttribute(attributeKey);\n\t\tif (attributeValue === null) {\n\t\t\treturn defaultValue;\n\t\t}\n\n\t\treturn attributeValue === '' ? true : readAttributeValue(attributeValue, type);\n\t}\n\n\tconst attributeValue = target.getAttribute(attributeKey);\n\treturn attributeValue !== null\n\t\t? readAttributeValue(attributeValue, type)\n\t\t: (defaultValue ?? (defaultValueForType(type) as typeof defaultValue));\n};\n",
|
|
9
|
+
"export const CUSTOM_ELEMENT_TAG_NAME = Symbol.for('@ecopages/radiant.customElementTagName');\n\ntype CustomElementConstructorWithMetadata = CustomElementConstructor & {\n\t[CUSTOM_ELEMENT_TAG_NAME]?: string;\n};\n\n/**\n * Sets the custom element tag name for a given constructor.\n * This is used internally to associate a class with its custom element tag, which is necessary for features like hydration and SSR support.\n * @param target The constructor of the custom element.\n * @param tagName The tag name to associate with the custom element.\n */\nexport function setCustomElementTagName(target: CustomElementConstructor, tagName: string): void {\n\t(target as CustomElementConstructorWithMetadata)[CUSTOM_ELEMENT_TAG_NAME] = tagName;\n}\n\n/**\n * Retrieves the custom element tag name associated with a given constructor.\n * @param target The constructor of the custom element.\n * @returns The tag name associated with the custom element, or `undefined` if not set.\n */\nexport function getCustomElementTagName(target: CustomElementConstructor): string | undefined {\n\treturn (target as CustomElementConstructorWithMetadata)[CUSTOM_ELEMENT_TAG_NAME];\n}\n",
|
|
10
|
+
"/** Escapes a string for safe interpolation inside a double-quoted HTML attribute value. */\nexport function escapeHtmlAttribute(value: string): string {\n\treturn value.replace(/&/g, '&').replace(/\"/g, '"').replace(/</g, '<').replace(/>/g, '>');\n}\n",
|
|
11
|
+
"import type { ReactiveProperty } from '../core/reactive-prop-core';\nimport type { ReactivePropDefinition } from '../core/reactive-prop-metadata';\nimport { writeAttributeValue } from '../utils/attribute-utils';\nimport { escapeHtmlAttribute } from '../utils/escape-html-attribute';\n\n/**\n * Minimal host shape needed by the attribute serialization policy.\n *\n * This interface defines the narrow contract that the serialization module\n * consumes, keeping it independent of the full {@link RadiantElementSsrHost}.\n */\nexport type HostAttributeSource = {\n\tgetReactiveProperties: () => ReactiveProperty[];\n\tgetReactivePropDefinitions: () => ReactivePropDefinition[];\n\tgetPropertyValue: (name: string) => unknown;\n\tgetAttributeNames: () => string[];\n\tgetAttribute: (name: string) => string | null;\n};\n\n/**\n * Resolves the final set of SSR host attributes from a Radiant Element Host.\n *\n * ## Source precedence (highest to lowest)\n *\n * 1. **Reactive properties** — legacy attribute reflection via `property.converter`.\n * These are already-registered reactive properties with established converters.\n * Falsy values (`undefined`, `null`, `false`) are omitted.\n *\n * 2. **Reactive prop definitions** — decorator-based definitions. Skipped when the\n * target attribute name was already emitted by source 1 (dedup via `seenAttributes`).\n * Uses `writeAttributeValue` for type-aware conversion.\n *\n * 3. **Authored attributes** — raw host-level attributes from the original markup.\n * These always win if present, regardless of whether sources 1 or 2 already\n * set the same name. This preserves explicit author intent in templates.\n *\n * @param host Host shape providing reactive state and attribute accessors.\n * @returns Flat record of attribute name → serialized value.\n */\nexport function resolveHostAttributes(host: HostAttributeSource): Record<string, string> {\n\tconst attributes: Record<string, string> = {};\n\tconst seenAttributes = new Set<string>();\n\n\tappendReactivePropertyAttributes(host, attributes, seenAttributes);\n\tappendReactivePropDefinitionAttributes(host, attributes, seenAttributes);\n\tappendAuthoredAttributes(host, attributes);\n\n\treturn attributes;\n}\n\n/**\n * Serializes a flat attribute record into an HTML attribute string.\n *\n * Each entry becomes ` name=\"escaped-value\"` with the leading space included.\n * The combined string is safe for direct interpolation into an opening tag.\n *\n * @param attributes Flat attribute record to serialize.\n * @returns HTML attribute string.\n */\nexport function stringifyHostAttributes(attributes: Record<string, string>): string {\n\treturn Object.entries(attributes)\n\t\t.map(([name, value]) => ` ${name}=\"${escapeHtmlAttribute(value)}\"`)\n\t\t.join('');\n}\n\n/**\n * Source 1: Reactive properties with established converters.\n *\n * Falsy runtime values are omitted — they should not appear as attributes\n * in SSR output.\n */\nfunction appendReactivePropertyAttributes(\n\thost: HostAttributeSource,\n\tattributes: Record<string, string>,\n\tseenAttributes: Set<string>,\n): void {\n\tfor (const property of host.getReactiveProperties()) {\n\t\tconst currentValue = host.getPropertyValue(property.name);\n\t\tif (currentValue === undefined || currentValue === null || currentValue === false) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tattributes[property.attribute] = String(property.converter.toAttribute(currentValue));\n\t\tseenAttributes.add(property.attribute);\n\t}\n}\n\n/**\n * Source 2: Decorator-based reactive prop definitions.\n *\n * Skipped when the attribute name was already emitted by source 1, preventing\n * duplicate or conflicting attribute values.\n */\nfunction appendReactivePropDefinitionAttributes(\n\thost: HostAttributeSource,\n\tattributes: Record<string, string>,\n\tseenAttributes: Set<string>,\n): void {\n\tfor (const definition of host.getReactivePropDefinitions()) {\n\t\tconst attributeName = definition.options.attribute ?? definition.name;\n\n\t\tif (seenAttributes.has(attributeName)) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst currentValue = host.getPropertyValue(definition.name);\n\n\t\tif (currentValue === undefined || currentValue === null || currentValue === false) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tattributes[attributeName] = String(writeAttributeValue(currentValue, definition.options.type));\n\t\tseenAttributes.add(attributeName);\n\t}\n}\n\n/**\n * Source 3: Authored attributes from the original markup.\n *\n * These always overwrite — when an author explicitly sets an attribute in\n * markup, that intent takes precedence over reactive property reflection.\n */\nfunction appendAuthoredAttributes(host: HostAttributeSource, attributes: Record<string, string>): void {\n\tfor (const attributeName of host.getAttributeNames()) {\n\t\tconst attributeValue = host.getAttribute(attributeName);\n\t\tif (attributeValue !== null) {\n\t\t\tattributes[attributeName] = attributeValue;\n\t\t}\n\t}\n}\n\n",
|
|
12
|
+
"import type { SsrSerializableContextProvider } from './context-provider';\nimport type { UnknownContext } from './types';\n\ntype SsrContextProviderResolver = (context: UnknownContext) => SsrSerializableContextProvider | undefined;\n\nconst SSR_CONTEXT_PROVIDER_RESOLVER_SYMBOL = Symbol.for('@ecopages/radiant.ssr-context-provider-resolver');\n\ntype GlobalResolverScope = typeof globalThis & {\n\t[SSR_CONTEXT_PROVIDER_RESOLVER_SYMBOL]?: SsrContextProviderResolver;\n};\n\nfunction getGlobalResolverScope(): GlobalResolverScope {\n\treturn globalThis as GlobalResolverScope;\n}\n\n/**\n * Installs the ambient SSR provider resolver used by shared context runtime helpers.\n *\n * Server-side rendering infrastructure owns the actual provider stack storage and\n * publishes a lookup function here so client/runtime code does not need to import\n * server-oriented modules.\n */\nexport function installSsrContextProviderResolver(resolver: SsrContextProviderResolver): void {\n\tgetGlobalResolverScope()[SSR_CONTEXT_PROVIDER_RESOLVER_SYMBOL] = resolver;\n}\n\n/**\n * Resolves an ambient SSR provider when a server render has published one.\n */\nexport function resolveAmbientSsrContextProvider(context: UnknownContext): SsrSerializableContextProvider | undefined {\n\treturn getGlobalResolverScope()[SSR_CONTEXT_PROVIDER_RESOLVER_SYMBOL]?.(context);\n}\n",
|
|
13
|
+
"import type { AsyncLocalStorage } from 'node:async_hooks';\nimport type { SsrSerializableContextProvider } from '../context/context-provider';\nimport { installSsrContextProviderResolver } from '../context/context-ssr-bridge';\nimport type { ContextType, UnknownContext } from '../context/types';\n\ntype ProviderFrame = Map<UnknownContext, SsrSerializableContextProvider>;\ntype ProviderStack = ProviderFrame[];\n\nlet resolvedAsyncLocalStorage: AsyncLocalStorage<ProviderStack> | null | undefined;\n\n/**\n * Lazily resolves `AsyncLocalStorage` from `node:async_hooks`.\n *\n * The dynamic `require` is necessary because browser-based SSR tests import\n * this server-oriented module directly. A top-level static import would break\n * those browser bundles even though normal application SSR runs on the server.\n *\n * On the server (Node.js, Bun, Cloudflare Workers) the import always succeeds.\n * In browser test environments where SSR rendering is exercised without a real\n * server, the fallback global stack is used instead.\n */\nfunction getAsyncLocalStorage(): AsyncLocalStorage<ProviderStack> | null {\n\tif (resolvedAsyncLocalStorage !== undefined) {\n\t\treturn resolvedAsyncLocalStorage;\n\t}\n\n\ttry {\n\t\tconst { AsyncLocalStorage: ALS } = require('node:async_hooks') as typeof import('node:async_hooks');\n\t\tresolvedAsyncLocalStorage = new ALS<ProviderStack>();\n\t\treturn resolvedAsyncLocalStorage;\n\t} catch {\n\t\tresolvedAsyncLocalStorage = null;\n\t\treturn null;\n\t}\n}\n\nconst SSR_CONTEXT_FALLBACK_STACK_SYMBOL = Symbol.for('@ecopages/radiant.ssr-context-fallback-stack');\n\nfunction getFallbackStack(): ProviderStack {\n\tconst g = globalThis as typeof globalThis & { [SSR_CONTEXT_FALLBACK_STACK_SYMBOL]?: ProviderStack };\n\tg[SSR_CONTEXT_FALLBACK_STACK_SYMBOL] ??= [];\n\treturn g[SSR_CONTEXT_FALLBACK_STACK_SYMBOL];\n}\n\n/**\n * Pushes a temporary provider frame onto the SSR context stack.\n *\n * On the server, each call creates an isolated `AsyncLocalStorage` context so\n * concurrent renders cannot corrupt each other.\n *\n * In browser test environments where `AsyncLocalStorage` is unavailable, a\n * synchronous global stack is used as a fallback.\n */\nexport function withSsrContextProviders(providers: readonly SsrSerializableContextProvider[]): () => void {\n\tif (providers.length === 0) {\n\t\treturn () => undefined;\n\t}\n\n\tconst frame = new Map<UnknownContext, SsrSerializableContextProvider>();\n\n\tfor (const provider of providers) {\n\t\tframe.set(provider.getContextKey(), provider);\n\t}\n\n\tconst als = getAsyncLocalStorage();\n\n\tif (als) {\n\t\tconst parentStack = als.getStore() ?? [];\n\t\tconst childStack = [...parentStack, frame];\n\t\tals.enterWith(childStack);\n\n\t\treturn () => {\n\t\t\tals.enterWith(parentStack);\n\t\t};\n\t}\n\n\tconst stack = getFallbackStack();\n\tstack.push(frame);\n\n\treturn () => {\n\t\tconst index = stack.lastIndexOf(frame);\n\t\tif (index >= 0) stack.splice(index, 1);\n\t};\n}\n\n/**\n * Resolves the nearest SSR-visible provider for a given context token.\n *\n * Lookup walks the provider frames from innermost to outermost so nested host\n * serialization behaves the same way as runtime context resolution in the DOM.\n */\nexport function resolveSsrContextProvider<T extends UnknownContext>(\n\tcontext: T,\n): SsrSerializableContextProvider | undefined {\n\tconst store = getAsyncLocalStorage()?.getStore() ?? getFallbackStack();\n\n\tfor (let index = store.length - 1; index >= 0; index -= 1) {\n\t\tconst provider = store[index]?.get(context);\n\n\t\tif (provider) {\n\t\t\treturn provider;\n\t\t}\n\t}\n\n\treturn undefined;\n}\n\n/**\n * Resolves the current SSR-visible value for a given context token.\n *\n * This is the ergonomic helper consumed by SSR-aware decorators and component\n * render paths when they only need the context payload instead of the full\n * provider instance.\n */\nexport function resolveSsrContextValue<T extends UnknownContext>(context: T): ContextType<T> | undefined {\n\tconst provider = resolveSsrContextProvider(context);\n\n\tif (!provider) {\n\t\treturn undefined;\n\t}\n\n\treturn provider.getContext() as ContextType<T>;\n}\n\ninstallSsrContextProviderResolver((context) => resolveSsrContextProvider(context));\n",
|
|
14
|
+
"/**\n * Host script composition for Radiant SSR.\n *\n * This module owns the mode-sensitive ordering and inclusion rules for the\n * script payloads that appear inside a server-rendered Element Host.\n *\n * ## Composition rules\n *\n * | Mode | Order |\n * |-----------|-----------------------------------------------------------------|\n * | `plain` | view content → authored hydration markup → slot projection |\n * | `hydrate` | view content → slot projection → hydration binding scripts |\n *\n * In **plain** mode, authored hydration markup (script tags pre-authored on the\n * host) is preserved because the component may rely on them for standalone\n * behavior. Hydration binding scripts are omitted because there is no client\n * hydrator to consume them.\n *\n * In **hydrate** mode, authored hydration markup is superseded by the formal\n * hydration binding scripts. Slot projection comes before hydration scripts so\n * the client can reconstruct projected content before binding recovery.\n */\n\n/** Individual content parts that make up a server-rendered host's inner HTML. */\nexport type HostContentParts = {\n\t/** The rendered view HTML from `renderViewToString`. */\n\thostContent: string;\n\t/** Authored hydration script markup pre-existing on the host, if any. */\n\tauthoredHydrationMarkup: string;\n\t/** Slot projection JSON payload script tag, if any. */\n\tslotProjectionScript: string;\n\t/** Hydration binding script tags for client-side recovery, if any. */\n\thydrationScripts: string;\n};\n\n/**\n * Assembles the inner HTML of a server-rendered Element Host from its\n * individual content parts, respecting the mode-sensitive ordering rules.\n *\n * @param parts Individual content parts to compose.\n * @param hydrate Whether the output targets client-side hydration.\n * @returns Assembled inner HTML string.\n */\nexport function composeHostContent(parts: HostContentParts, hydrate: boolean): string {\n\tif (!hydrate) {\n\t\treturn `${parts.hostContent}${parts.authoredHydrationMarkup}${parts.slotProjectionScript}`;\n\t}\n\n\treturn `${parts.hostContent}${parts.slotProjectionScript}${parts.hydrationScripts}`;\n}\n",
|
|
15
|
+
"import type { JsxRenderable } from '@ecopages/jsx';\nimport type { RenderToStringOptions } from '@ecopages/jsx/server';\nimport type { SsrSerializableContextProvider } from '../context/context-provider';\nimport type { ReactiveProperty } from './reactive-prop-core';\nimport type { ReactivePropDefinition } from './reactive-prop-metadata';\nimport type { SsrSerializableHydrationBinding } from './ssr-hydration-binding';\n\n/**\n * Unified SSR host shape shared by core resolution and server serialization.\n */\nexport type InternalRadiantSsrHost = {\n\tconstructor: CustomElementConstructor;\n\tgetAttribute(name: string): string | null;\n\tgetAttributeNames(): string[];\n\tgetAuthoredHydrationScriptMarkup?: () => string | undefined;\n\tgetContextProviders: () => SsrSerializableContextProvider[];\n\tgetHydrationBindings: () => SsrSerializableHydrationBinding[];\n\tgetReactiveProperties: () => ReactiveProperty[];\n\tgetReactivePropDefinitions: () => ReactivePropDefinition[];\n\tgetPropertyValue: (name: string) => unknown;\n\tgetSlotProjectionScriptTag?: () => string | undefined;\n\tresolveTrackedRenderOutput: () => { containsSlots: boolean; value: JsxRenderable };\n\trenderViewToString: (options?: RenderToStringOptions) => string;\n};\n\nexport type RadiantElementSsrHostSource = InternalRadiantSsrHost;\n\nexport function resolveRadiantElementSsrHostSource(component: object): InternalRadiantSsrHost | undefined {\n\tif (isInternalRadiantSsrHost(component)) {\n\t\treturn component;\n\t}\n\n\treturn undefined;\n}\n\nexport function isInternalRadiantSsrHost(component: object): component is InternalRadiantSsrHost {\n\treturn (\n\t\ttypeof component.constructor === 'function' &&\n\t\ttypeof (component as { getAttribute?: unknown }).getAttribute === 'function' &&\n\t\ttypeof (component as { getAttributeNames?: unknown }).getAttributeNames === 'function' &&\n\t\ttypeof (component as { getAuthoredHydrationScriptMarkup?: unknown }).getAuthoredHydrationScriptMarkup ===\n\t\t\t'function' &&\n\t\ttypeof (component as { getContextProviders?: unknown }).getContextProviders === 'function' &&\n\t\ttypeof (component as { getHydrationBindings?: unknown }).getHydrationBindings === 'function' &&\n\t\ttypeof (component as { getReactiveProperties?: unknown }).getReactiveProperties === 'function' &&\n\t\ttypeof (component as { getSlotProjectionScriptTag?: unknown }).getSlotProjectionScriptTag === 'function' &&\n\t\ttypeof (component as { resolveTrackedRenderOutput?: unknown }).resolveTrackedRenderOutput === 'function' &&\n\t\ttypeof (component as { renderViewToString?: unknown }).renderViewToString === 'function'\n\t);\n}\n",
|
|
16
|
+
"import { getReactivePropDefinitions } from '../core/reactive-prop-metadata';\nimport { resolveRadiantElementSsrHostSource } from '../core/radiant-element-ssr-host';\nimport type { InternalRadiantSsrHost } from './internal-radiant-host';\n\nexport function toInternalRadiantSsrHost(component: object): InternalRadiantSsrHost {\n\tconst source = resolveRadiantElementSsrHostSource(component);\n\n\tif (!source) {\n\t\tthrow new Error('Radiant SSR runtime requires a server extraction host shape on the component.');\n\t}\n\n\treturn {\n\t\tconstructor: source.constructor,\n\t\tgetAttribute: (name) => source.getAttribute(name),\n\t\tgetAttributeNames: () => source.getAttributeNames(),\n\t\tgetAuthoredHydrationScriptMarkup: () => source.getAuthoredHydrationScriptMarkup?.(),\n\t\tgetContextProviders: () => source.getContextProviders(),\n\t\tgetHydrationBindings: () => source.getHydrationBindings(),\n\t\tgetReactiveProperties: () => source.getReactiveProperties(),\n\t\tgetReactivePropDefinitions: () => getReactivePropDefinitions(component),\n\t\tgetPropertyValue: (name) => Reflect.get(component, name),\n\t\tgetSlotProjectionScriptTag: () => source.getSlotProjectionScriptTag?.(),\n\t\tresolveTrackedRenderOutput: () => source.resolveTrackedRenderOutput(),\n\t\trenderViewToString: (options) => source.renderViewToString(options),\n\t};\n}\n",
|
|
17
|
+
"import type { JsxRenderable } from '@ecopages/jsx';\nimport type { RenderToStringOptions } from '@ecopages/jsx/server';\nimport { getCustomElementTagName } from '../core/custom-element-metadata';\nimport { withSsrContextProviders } from './context-ssr';\nimport { composeHostContent } from './host-script-composition';\nimport { resolveHostAttributes, stringifyHostAttributes } from './host-attribute-serialization';\nimport { ensureLegacyHostReady } from '../decorators/legacy/host-readiness';\nimport { toInternalRadiantSsrHost } from './radiant-element-ssr-extractor';\nimport type { InternalRadiantSsrHost } from '../core/radiant-element-ssr-host';\n\nexport class RadiantElementSsrService {\n\tprivate readonly component: object;\n\tprivate readonly host: InternalRadiantSsrHost;\n\n\tconstructor(component: object) {\n\t\tthis.component = component;\n\t\tthis.host = toInternalRadiantSsrHost(component);\n\t}\n\n\tprivate ensureReady(): void {\n\t\tensureLegacyHostReady(this.component, 'ssr');\n\t}\n\n\tpublic renderHost(): JsxRenderable {\n\t\tthis.ensureReady();\n\n\t\treturn {\n\t\t\tnodeType: 1,\n\t\t\touterHTML: this.renderHostToString({ mode: 'hydrate' }),\n\t\t};\n\t}\n\n\tpublic renderHostToString(options: RenderToStringOptions = {}, attributes = this.getHostAttributes()): string {\n\t\tthis.ensureReady();\n\t\tconst tagName = this.getTagName();\n\t\tconst restoreSsrContexts = withSsrContextProviders(this.host.getContextProviders());\n\n\t\ttry {\n\t\t\treturn `<${tagName}${stringifyHostAttributes(attributes)}>${this.renderHostContent(options)}</${tagName}>`;\n\t\t} finally {\n\t\t\trestoreSsrContexts();\n\t\t}\n\t}\n\n\tpublic getHostAttributes(): Record<string, string> {\n\t\tthis.ensureReady();\n\t\treturn resolveHostAttributes(this.host);\n\t}\n\n\tprivate renderHostContent(options: RenderToStringOptions): string {\n\t\tconst hydrate = options.mode === 'hydrate' || (options.mode === undefined && options.hydrate === true);\n\n\t\tconst hydrationScripts = hydrate\n\t\t\t? this.host\n\t\t\t\t\t.getHydrationBindings()\n\t\t\t\t\t.map((binding) => binding.renderHydrationScriptTag())\n\t\t\t\t\t.filter((markup): markup is string => typeof markup === 'string')\n\t\t\t\t\t.join('')\n\t\t\t: '';\n\n\t\treturn composeHostContent(\n\t\t\t{\n\t\t\t\thostContent: this.host.renderViewToString(options),\n\t\t\t\tauthoredHydrationMarkup: this.host.getAuthoredHydrationScriptMarkup?.() ?? '',\n\t\t\t\tslotProjectionScript: this.host.getSlotProjectionScriptTag?.() ?? '',\n\t\t\t\thydrationScripts,\n\t\t\t},\n\t\t\thydrate,\n\t\t);\n\t}\n\n\tprivate getTagName(): string {\n\t\tconst tagName = getCustomElementTagName(this.host.constructor);\n\n\t\tif (!tagName) {\n\t\t\tthrow new Error(`${this.host.constructor.name} is missing @customElement metadata.`);\n\t\t}\n\n\t\treturn tagName;\n\t}\n}\n"
|
|
18
|
+
],
|
|
19
|
+
"mappings": "2PAEA,IAAM,EAA4B,OAAO,IAAI,2CAA2C,EAWjF,SAAS,EAA8B,CAC7C,EACA,EACA,EACO,CACP,IAAM,EAAc,EAAO,YACrB,EAAc,EAAY,IAA8B,CAAC,EAE/D,GAAI,EAAY,KAAK,CAAC,IAAe,EAAW,OAAS,CAAY,EACpE,OAGD,EAAY,KAAK,CAAE,KAAM,EAAc,SAAQ,CAAC,EAChD,EAAY,GAA6B,EAGnC,SAAS,CAA0B,CAAC,EAA0C,CACpF,OAAS,EAAO,YAAoD,IAA8B,CAAC,GAAG,MAAM,EC5B7G,IAAM,EAA+B,OAAO,IAAI,gDAAgD,EAC1F,EAAwC,OAAO,IAAI,yDAAyD,EAC5G,EAAiD,OAAO,IAC7D,kEACD,EAQO,SAAS,EAAmD,CAClE,EACA,EACO,CACP,EAAoB,EAAO,EAA8B,CAAW,EAU9D,SAAS,EAA2D,CAC1E,EACA,EACO,CACP,EAAoB,EAAO,EAAuC,CAAW,EASvE,SAAS,CAA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untime, getRadiantElementHostSsrAttributes, getRadiantElementTrackedRenderOutput, renderRadiantElementHost, renderRadiantElementHostToString, renderRadiantElementViewToString, renderRegisteredRadiantElementHost, renderRegisteredRadiantElementHostToString, resolveRadiantElementRenderBridge, resolveRadiantElementSsrHostBridge, resolveRegisteredRadiantElementPreview, withRadiantServerCustomElementRenderBridge, withServerRadiantElementSsrRuntime, } from './radiant-element-ssr-bridge';
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
var DP=((P)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(P,{get:(R,q)=>(typeof require<"u"?require:R)[q]}):P)(function(P){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+P+'" is not supported')});var G=Symbol.for("@ecopages/radiant.reactivePropDefinitions");function IP(P,R,q){let D=P.constructor,W=D[G]??[];if(W.some((Q)=>Q.name===R))return;W.push({name:R,options:q}),D[G]=W}function E(P){return(P.constructor[G]??[]).slice()}var C=Symbol.for("@ecopages/radiant.legacy-instance-initializers"),x=Symbol.for("@ecopages/radiant.legacy-post-construction-initializers"),WP=Symbol.for("@ecopages/radiant.legacy-executed-post-construction-initializers");function NP(P,R){k(P,C,R)}function TP(P,R){k(P,x,R)}function M(P){B(P,C)}function O(P){let R=P;B(P,x,R[WP]??=new Set)}function k(P,R,q){let D=P,W=Object.prototype.hasOwnProperty.call(D,R)?D[R]:void 0;if(Array.isArray(W)){W.push(q);return}Object.defineProperty(D,R,{value:[q]})}function B(P,R,q,D=Object.getPrototypeOf(P)){if(!D||D===Object.prototype)return;B(P,R,q,Object.getPrototypeOf(D));let W=D[R];if(!Array.isArray(W))return;for(let Q of W){if(q?.has(Q))continue;Q(P),q?.add(Q)}}function f(P,R){switch(R){case"construct":M(P);break;case"connect":case"ssr":O(P);break}}function I(P){switch(P){case Array:return"array";case Boolean:return"boolean";case Number:return"number";case Object:return"object";case String:return"string"}}function QP(P){switch(typeof P){case"boolean":return"boolean";case"number":return"number";case"string":return"string"}if(Array.isArray(P))return"array";if(Object.prototype.toString.call(P)==="[object Object]")return"object"}function $P(P){switch(P){case Number:return 0;case String:return"";case Boolean:return!1;default:return null}}function FP(P){try{return JSON.parse(P)}catch{throw TypeError("Invalid JSON string")}}var ZP={array(P){let R=FP(P);if(!Array.isArray(R))throw TypeError(`Expected an array but got a value of type "${typeof R}"`);return R},boolean(P){return!(P==="0"||String(P).toLowerCase()==="false")},number(P){return Number(P.replace(/_/g,""))},object(P){let R=JSON.parse(P);if(R===null||typeof R!=="object"||Array.isArray(R))throw TypeError(`expected value of type "object" but instead got value "${P}" of type "${QP(R)}"`);return R},string(P){return P}},g={default:_,array:L,object:L};function L(P){return JSON.stringify(P)}function _(P){return`${P}`}function z(P,R){let q=I(R);if(!q)throw TypeError(`[radiant-element] Unknown type "${R}"`);return ZP[q](P)}function N(P,R){let q=I(R);if(!q)throw TypeError(`[radiant-element] Unknown type "${R}"`);return(g[q]??g.default??_)(P)}function HP(P){return typeof P==="boolean"}function JP(P){return typeof P==="number"}function jP(P){return typeof P==="string"}function XP(P){return Array.isArray(P)}function GP(P){return typeof P==="object"&&!Array.isArray(P)&&P!==null}function vP(P,R){switch(P){case Boolean:return HP(R);case Number:return JP(R);case String:return jP(R);case Array:return XP(R);case Object:return GP(R);default:return!1}}var bP=(P,R,q,D)=>{if(R===Boolean){let Q=P.getAttribute(q);if(Q===null)return D;return Q===""?!0:z(Q,R)}let W=P.getAttribute(q);return W!==null?z(W,R):D??$P(R)};import{getActiveSsrScopeValue as BP,withActiveSsrScopeValue as UP}from"@ecopages/jsx/server";var T=Symbol.for("@ecopages/radiant.element-ssr-runtime");function yP(){return BP(T)}function A(P,R){return UP(T,P,R)}var S=Symbol.for("@ecopages/radiant.customElementTagName");function lP(P,R){P[S]=R}function V(P){return P[S]}function v(P){return P.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function b(P){let R={},q=new Set;return KP(P,R,q),YP(P,R,q),wP(P,R),R}function h(P){return Object.entries(P).map(([R,q])=>` ${R}="${v(q)}"`).join("")}function KP(P,R,q){for(let D of P.getReactiveProperties()){let W=P.getPropertyValue(D.name);if(W===void 0||W===null||W===!1)continue;R[D.attribute]=String(D.converter.toAttribute(W)),q.add(D.attribute)}}function YP(P,R,q){for(let D of P.getReactivePropDefinitions()){let W=D.options.attribute??D.name;if(q.has(W))continue;let Q=P.getPropertyValue(D.name);if(Q===void 0||Q===null||Q===!1)continue;R[W]=String(N(Q,D.options.type)),q.add(W)}}function wP(P,R){for(let q of P.getAttributeNames()){let D=P.getAttribute(q);if(D!==null)R[q]=D}}var d=Symbol.for("@ecopages/radiant.ssr-context-provider-resolver");function y(){return globalThis}function m(P){y()[d]=P}function rP(P){return y()[d]?.(P)}var Z;function c(){if(Z!==void 0)return Z;try{let{AsyncLocalStorage:P}=(()=>{throw new Error("Cannot require module "+"node:async_hooks");})();return Z=new P,Z}catch{return Z=null,null}}var l=Symbol.for("@ecopages/radiant.ssr-context-fallback-stack");function u(){let P=globalThis;return P[l]??=[],P[l]}function s(P){if(P.length===0)return()=>{return};let R=new Map;for(let W of P)R.set(W.getContextKey(),W);let q=c();if(q){let W=q.getStore()??[],Q=[...W,R];return q.enterWith(Q),()=>{q.enterWith(W)}}let D=u();return D.push(R),()=>{let W=D.lastIndexOf(R);if(W>=0)D.splice(W,1)}}function i(P){let R=c()?.getStore()??u();for(let q=R.length-1;q>=0;q-=1){let D=R[q]?.get(P);if(D)return D}return}function nP(P){let R=i(P);if(!R)return;return R.getContext()}m((P)=>i(P));function p(P,R){if(!R)return`${P.hostContent}${P.authoredHydrationMarkup}${P.slotProjectionScript}`;return`${P.hostContent}${P.slotProjectionScript}${P.hydrationScripts}`}function F(P){if(EP(P))return P;return}function EP(P){return typeof P.constructor==="function"&&typeof P.getAttribute==="function"&&typeof P.getAttributeNames==="function"&&typeof P.getAuthoredHydrationScriptMarkup==="function"&&typeof P.getContextProviders==="function"&&typeof P.getHydrationBindings==="function"&&typeof P.getReactiveProperties==="function"&&typeof P.getSlotProjectionScriptTag==="function"&&typeof P.resolveTrackedRenderOutput==="function"&&typeof P.renderViewToString==="function"}function r(P){let R=F(P);if(!R)throw Error("Radiant SSR runtime requires a server extraction host shape on the component.");return{constructor:R.constructor,getAttribute:(q)=>R.getAttribute(q),getAttributeNames:()=>R.getAttributeNames(),getAuthoredHydrationScriptMarkup:()=>R.getAuthoredHydrationScriptMarkup?.(),getContextProviders:()=>R.getContextProviders(),getHydrationBindings:()=>R.getHydrationBindings(),getReactiveProperties:()=>R.getReactiveProperties(),getReactivePropDefinitions:()=>E(P),getPropertyValue:(q)=>Reflect.get(P,q),getSlotProjectionScriptTag:()=>R.getSlotProjectionScriptTag?.(),resolveTrackedRenderOutput:()=>R.resolveTrackedRenderOutput(),renderViewToString:(q)=>R.renderViewToString(q)}}class U{component;host;constructor(P){this.component=P,this.host=r(P)}ensureReady(){f(this.component,"ssr")}renderHost(){return this.ensureReady(),{nodeType:1,outerHTML:this.renderHostToString({mode:"hydrate"})}}renderHostToString(P={},R=this.getHostAttributes()){this.ensureReady();let q=this.getTagName(),D=s(this.host.getContextProviders());try{return`<${q}${h(R)}>${this.renderHostContent(P)}</${q}>`}finally{D()}}getHostAttributes(){return this.ensureReady(),b(this.host)}renderHostContent(P){let R=P.mode==="hydrate"||P.mode===void 0&&P.hydrate===!0,q=R?this.host.getHydrationBindings().map((D)=>D.renderHydrationScriptTag()).filter((D)=>typeof D==="string").join(""):"";return p({hostContent:this.host.renderViewToString(P),authoredHydrationMarkup:this.host.getAuthoredHydrationScriptMarkup?.()??"",slotProjectionScript:this.host.getSlotProjectionScriptTag?.()??"",hydrationScripts:q},R)}getTagName(){let P=V(this.host.constructor);if(!P)throw Error(`${this.host.constructor.name} is missing @customElement metadata.`);return P}}import{renderToString as CP}from"@ecopages/jsx/server";import{createServerHydrationBindingState as a,isServerRenderHydrationActive as o,withForcedServerCustomElementRendering as xP,withServerCustomElementRenderHook as MP,withServerHydrationBindingState as n}from"@ecopages/jsx/server";var j;function K(P){return new U(P)}function H(P){return{nodeType:1,outerHTML:$(P,{mode:"hydrate"})}}function OP(P){if(J(P))return H(P);if(!X(P))return;return P.renderHost?.()??{nodeType:1,outerHTML:P.renderHostToString({mode:"hydrate"})}}function $(P,R={}){return w(()=>K(P).renderHostToString(R,Y(P)))}function kP(P,R={}){if(J(P))return $(P,R);if(!X(P))return;return P.renderHostToString(R)}function fP(P,R){if(J(P))return H(P);if(!X(P))return;return P.renderHost?.()??{nodeType:1,outerHTML:R}}function t(P,R={}){return w(()=>PP(()=>CP(RP(P).value,R)))}function Y(P){return K(P).getHostAttributes()}function e(P){if(!J(P))return;return{renderHost:()=>H(P),renderHostToString:(R)=>$(P,R)}}function gP(P){return F(P)}function PP(P){return xP(()=>MP(({instance:R})=>{if(J(R))return{nodeType:1,get outerHTML(){let D=o(),W={hydrate:D,mode:D?"hydrate":"plain"};if(!D)return $(R,W);return n(a(),()=>$(R,W))}};if(!X(R))return;let q=R;return{nodeType:1,get outerHTML(){let D=o();if(!D)return q.renderHostToString({hydrate:D,mode:D?"hydrate":"plain"});return n(a(),()=>q.renderHostToString({hydrate:D,mode:D?"hydrate":"plain"}))}}},P))}function RP(P){if(LP(P))return P.resolveTrackedRenderOutput();let R=F(P);if(!R)throw Error("Radiant SSR runtime requires tracked render output support on the component.");return R.resolveTrackedRenderOutput()}function J(P){if(typeof P!=="object"||P===null)return!1;return F(P)!==void 0}function X(P){if(typeof P!=="object"||P===null)return!1;return typeof P.renderHostToString==="function"}function LP(P){if(typeof P!=="object"||P===null)return!1;return typeof P.resolveTrackedRenderOutput==="function"}function qP(){if(j)return j;return j={getHostAttributes:Y,renderHost:H,renderHostToString:$,resolveRenderBridge:e,renderView:t},j}function w(P){return A(qP(),P)}export{w as withServerRadiantElementSsrRuntime,PP as withRadiantServerCustomElementRenderBridge,fP as resolveRegisteredRadiantElementPreview,gP as resolveRadiantElementSsrHostBridge,e as resolveRadiantElementRenderBridge,kP as renderRegisteredRadiantElementHostToString,OP as renderRegisteredRadiantElementHost,t as renderRadiantElementViewToString,$ as renderRadiantElementHostToString,H as renderRadiantElementHost,RP as getRadiantElementTrackedRenderOutput,Y as getRadiantElementHostSsrAttributes,qP as getOrCreateRadiantElementSsrRuntime,K as createRadiantElementSsrService};
|
|
2
|
+
|
|
3
|
+
//# debugId=ADB47060B6AE441B64756E2164756E21
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/core/reactive-prop-metadata.ts", "../src/decorators/legacy/instance-initializers.ts", "../src/decorators/legacy/host-readiness.ts", "../src/utils/attribute-utils.ts", "../src/core/radiant-element-ssr-registry.ts", "../src/core/custom-element-metadata.ts", "../src/utils/escape-html-attribute.ts", "../src/server/host-attribute-serialization.ts", "../src/context/context-ssr-bridge.ts", "../src/server/context-ssr.ts", "../src/server/host-script-composition.ts", "../src/core/radiant-element-ssr-host.ts", "../src/server/radiant-element-ssr-extractor.ts", "../src/server/radiant-element-ssr-service.ts", "../src/server/radiant-element-ssr-bridge.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"import type { ReactivePropertyOptions } from './reactive-prop-core';\n\nconst REACTIVE_PROP_DEFINITIONS = Symbol.for('@ecopages/radiant.reactivePropDefinitions');\n\nexport type ReactivePropDefinition = {\n\tname: string;\n\toptions: ReactivePropertyOptions<unknown>;\n};\n\ntype RadiantConstructorWithReactiveProps = CustomElementConstructor & {\n\t[REACTIVE_PROP_DEFINITIONS]?: ReactivePropDefinition[];\n};\n\nexport function registerReactivePropDefinition(\n\ttarget: object,\n\tpropertyName: string,\n\toptions: ReactivePropertyOptions<unknown>,\n): void {\n\tconst constructor = target.constructor as RadiantConstructorWithReactiveProps;\n\tconst definitions = constructor[REACTIVE_PROP_DEFINITIONS] ?? [];\n\n\tif (definitions.some((definition) => definition.name === propertyName)) {\n\t\treturn;\n\t}\n\n\tdefinitions.push({ name: propertyName, options });\n\tconstructor[REACTIVE_PROP_DEFINITIONS] = definitions;\n}\n\nexport function getReactivePropDefinitions(target: object): ReactivePropDefinition[] {\n\treturn ((target.constructor as RadiantConstructorWithReactiveProps)[REACTIVE_PROP_DEFINITIONS] ?? []).slice();\n}\n",
|
|
6
|
+
"type LegacyInstanceInitializer<T extends object = object> = (instance: T) => void;\n\nconst LEGACY_INSTANCE_INITIALIZERS = Symbol.for('@ecopages/radiant.legacy-instance-initializers');\nconst LEGACY_POST_CONSTRUCTION_INITIALIZERS = Symbol.for('@ecopages/radiant.legacy-post-construction-initializers');\nconst LEGACY_EXECUTED_POST_CONSTRUCTION_INITIALIZERS = Symbol.for(\n\t'@ecopages/radiant.legacy-executed-post-construction-initializers',\n);\n\n/**\n * Registers per-instance initialization work for a legacy decorator.\n *\n * Legacy decorators execute against the prototype, so any initialization that\n * needs the concrete element instance must be deferred until construction time.\n */\nexport function registerLegacyInstanceInitializer<T extends object>(\n\tproto: T,\n\tinitializer: LegacyInstanceInitializer<T>,\n): void {\n\tregisterInitializer(proto, LEGACY_INSTANCE_INITIALIZERS, initializer);\n}\n\n/**\n * Registers post-construction work for a legacy decorator.\n *\n * This phase exists for decorators that eagerly write instance fields. With\n * legacy decorators plus `useDefineForClassFields`, subclass field definition\n * can overwrite values written during the base-class constructor.\n */\nexport function registerLegacyPostConstructionInitializer<T extends object>(\n\tproto: T,\n\tinitializer: LegacyInstanceInitializer<T>,\n): void {\n\tregisterInitializer(proto, LEGACY_POST_CONSTRUCTION_INITIALIZERS, initializer);\n}\n\n/**\n * Runs all legacy decorator initializers for a newly constructed element.\n *\n * Initializers are collected from the prototype chain and executed from base to\n * derived class so inherited setup remains stable.\n */\nexport function runLegacyInstanceInitializers<T extends object>(instance: T): void {\n\trunLegacyInitializers(instance, LEGACY_INSTANCE_INITIALIZERS);\n}\n\n/**\n * Runs legacy decorator setup that must happen after subclass field\n * initialization has completed.\n *\n * Each initializer runs at most once per instance even if multiple lifecycle\n * entrypoints call this helper.\n */\nexport function runLegacyPostConstructionInitializers<T extends object>(instance: T): void {\n\tconst target = instance as Record<PropertyKey, unknown>;\n\n\trunLegacyInitializers(\n\t\tinstance,\n\t\tLEGACY_POST_CONSTRUCTION_INITIALIZERS,\n\t\t(target[LEGACY_EXECUTED_POST_CONSTRUCTION_INITIALIZERS] ??= new Set()) as Set<LegacyInstanceInitializer<T>>,\n\t);\n}\n\nfunction registerInitializer<T extends object>(proto: T, key: symbol, initializer: LegacyInstanceInitializer<T>): void {\n\tconst target = proto as Record<PropertyKey, unknown>;\n\tconst ownInitializers = Object.prototype.hasOwnProperty.call(target, key) ? target[key] : undefined;\n\n\tif (Array.isArray(ownInitializers)) {\n\t\townInitializers.push(initializer);\n\t\treturn;\n\t}\n\n\tObject.defineProperty(target, key, {\n\t\tvalue: [initializer],\n\t});\n}\n\nfunction runLegacyInitializers<T extends object>(\n\tinstance: T,\n\tkey: symbol,\n\texecutedInitializers?: Set<LegacyInstanceInitializer<T>>,\n\tprototype: object | null = Object.getPrototypeOf(instance),\n): void {\n\tif (!prototype || prototype === Object.prototype) {\n\t\treturn;\n\t}\n\n\trunLegacyInitializers(instance, key, executedInitializers, Object.getPrototypeOf(prototype));\n\n\tconst initializers = (prototype as Record<PropertyKey, unknown>)[key] as LegacyInstanceInitializer<T>[] | undefined;\n\n\tif (!Array.isArray(initializers)) {\n\t\treturn;\n\t}\n\n\tfor (const initializer of initializers) {\n\t\tif (executedInitializers?.has(initializer)) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tinitializer(instance);\n\t\texecutedInitializers?.add(initializer);\n\t}\n}\n",
|
|
7
|
+
"import {\n\trunLegacyInstanceInitializers,\n\trunLegacyPostConstructionInitializers,\n} from './instance-initializers';\n\nexport type LegacyHostReadinessPhase = 'construct' | 'connect' | 'ssr';\n\n/**\n * Runs legacy decorator initialization for the requested lifecycle phase.\n *\n * Post-construction work is idempotent — multiple calls with `connect` or `ssr`\n * only execute each registered initializer once per instance.\n */\nexport function ensureLegacyHostReady<T extends object>(host: T, phase: LegacyHostReadinessPhase): void {\n\tswitch (phase) {\n\t\tcase 'construct':\n\t\t\trunLegacyInstanceInitializers(host);\n\t\t\tbreak;\n\t\tcase 'connect':\n\t\tcase 'ssr':\n\t\t\trunLegacyPostConstructionInitializers(host);\n\t\t\tbreak;\n\t}\n}\n",
|
|
8
|
+
"import type { RadiantElement } from '../core/radiant-element';\n\nexport type AttributeTypeConstant = typeof Array | typeof Boolean | typeof Number | typeof Object | typeof String;\n\nexport type AttributeTypeDefault = Array<unknown> | boolean | number | Record<string, unknown> | string;\n\n/**\n * Parses the given attribute type constant and returns its corresponding string representation.\n *\n * @param constant - The attribute type constant to parse.\n * @returns The string representation of the attribute type constant.\n */\nexport function parseAttributeTypeConstant(constant?: AttributeTypeConstant) {\n\tswitch (constant) {\n\t\tcase Array:\n\t\t\treturn 'array';\n\t\tcase Boolean:\n\t\t\treturn 'boolean';\n\t\tcase Number:\n\t\t\treturn 'number';\n\t\tcase Object:\n\t\t\treturn 'object';\n\t\tcase String:\n\t\t\treturn 'string';\n\t}\n}\n\n/**\n * Parses the attribute type default value and returns its type as a string.\n *\n * @param defaultValue - The default value of the attribute type.\n * @returns The type of the default value as a string.\n */\nexport function parseAttributeTypeDefault(defaultValue?: AttributeTypeDefault) {\n\tswitch (typeof defaultValue) {\n\t\tcase 'boolean':\n\t\t\treturn 'boolean';\n\t\tcase 'number':\n\t\t\treturn 'number';\n\t\tcase 'string':\n\t\t\treturn 'string';\n\t}\n\n\tif (Array.isArray(defaultValue)) return 'array';\n\tif (Object.prototype.toString.call(defaultValue) === '[object Object]') return 'object';\n}\n\n/**\n * Returns the default value for a given attribute type.\n *\n * @param type - The attribute type constant.\n * @returns The default value for the specified attribute type.\n */\nexport function defaultValueForType(type: AttributeTypeConstant): unknown {\n\tswitch (type) {\n\t\tcase Number:\n\t\t\treturn 0;\n\t\tcase String:\n\t\t\treturn '';\n\t\tcase Boolean:\n\t\t\treturn false;\n\t\tdefault:\n\t\t\treturn null;\n\t}\n}\n\ntype Reader = (value: string) => number | string | boolean | object | unknown[];\n\n/**\n * Utility function to parse a JSON string safely\n */\nfunction parseJSON<T>(value: string): T {\n\ttry {\n\t\treturn JSON.parse(value);\n\t} catch {\n\t\tthrow new TypeError('Invalid JSON string');\n\t}\n}\n\n/**\n * Object that maps attribute types to reader functions.\n * @type {Object.<string, Reader>}\n */\nconst readers: { [type: string]: Reader } = {\n\tarray(value: string): unknown[] {\n\t\tconst array = parseJSON<unknown[]>(value);\n\t\tif (!Array.isArray(array)) {\n\t\t\tthrow new TypeError(`Expected an array but got a value of type \"${typeof array}\"`);\n\t\t}\n\t\treturn array;\n\t},\n\n\tboolean(value: string): boolean {\n\t\treturn !(value === '0' || String(value).toLowerCase() === 'false');\n\t},\n\n\tnumber(value: string): number {\n\t\tconst number = Number(value.replace(/_/g, ''));\n\t\treturn number;\n\t},\n\n\tobject(value: string): object {\n\t\tconst object = JSON.parse(value);\n\t\tif (object === null || typeof object !== 'object' || Array.isArray(object)) {\n\t\t\tthrow new TypeError(\n\t\t\t\t`expected value of type \"object\" but instead got value \"${value}\" of type \"${parseAttributeTypeDefault(\n\t\t\t\t\tobject,\n\t\t\t\t)}\"`,\n\t\t\t);\n\t\t}\n\t\treturn object;\n\t},\n\n\tstring(value: string): string {\n\t\treturn value;\n\t},\n};\n\ntype Writer = (value: unknown) => string;\n\n/**\n * Object that maps attribute types to writer functions.\n * @type {Object.<string, Writer>}\n */\nconst writers: { [type: string]: Writer } = {\n\tdefault: writeString,\n\tarray: writeJSON,\n\tobject: writeJSON,\n};\n\nfunction writeJSON(value: unknown) {\n\treturn JSON.stringify(value);\n}\n\nfunction writeString(value: unknown) {\n\treturn `${value}`;\n}\n\n/**\n * Reads the attribute value based on the provided type.\n * @param value - The attribute value to be read.\n * @param type - The type of the attribute.\n * @returns The parsed attribute value.\n * @throws {TypeError} If the provided type is unknown.\n */\nexport function readAttributeValue(value: string, type: AttributeTypeConstant) {\n\tconst readerType = parseAttributeTypeConstant(type);\n\tif (!readerType) throw new TypeError(`[radiant-element] Unknown type \"${type}\"`);\n\treturn readers[readerType]!(value);\n}\n\nexport type ReadAttributeValueReturnType = ReturnType<typeof readAttributeValue>;\n\n/**\n * Writes the attribute value based on the provided type.\n *\n * @param value - The value to be written.\n * @param type - The type of the attribute.\n * @returns The written attribute value.\n * @throws {TypeError} If the provided type is unknown.\n */\nexport function writeAttributeValue(value: unknown, type: AttributeTypeConstant) {\n\tconst writerType = parseAttributeTypeConstant(type);\n\tif (!writerType) throw new TypeError(`[radiant-element] Unknown type \"${type}\"`);\n\tconst writer: Writer = writers[writerType] ?? writers.default ?? writeString;\n\treturn writer(value);\n}\n\nexport type WriteAttributeValueReturnType = ReturnType<typeof writeAttributeValue>;\n\n/*\n * Type guard functions for each type in AttributeTypeConstant\n */\nfunction isBoolean(value: unknown): value is boolean {\n\treturn typeof value === 'boolean';\n}\n\nfunction isNumber(value: unknown): value is number {\n\treturn typeof value === 'number';\n}\n\nfunction isString(value: unknown): value is string {\n\treturn typeof value === 'string';\n}\n\nfunction isArray(value: unknown): value is Array<unknown> {\n\treturn Array.isArray(value);\n}\n\nfunction isObject(value: unknown): value is object {\n\treturn typeof value === 'object' && !Array.isArray(value) && value !== null;\n}\n\n/*\n * Check function to ensure defaultValue matches the type\n */\nexport function isValueOfType(type: AttributeTypeConstant, defaultValue: unknown): boolean {\n\tswitch (type) {\n\t\tcase Boolean:\n\t\t\treturn isBoolean(defaultValue);\n\t\tcase Number:\n\t\t\treturn isNumber(defaultValue);\n\t\tcase String:\n\t\t\treturn isString(defaultValue);\n\t\tcase Array:\n\t\t\treturn isArray(defaultValue);\n\t\tcase Object:\n\t\t\treturn isObject(defaultValue);\n\t\tdefault:\n\t\t\treturn false;\n\t}\n}\n\nexport const getInitialValue = (\n\ttarget: RadiantElement,\n\ttype: AttributeTypeConstant,\n\tattributeKey: string,\n\tdefaultValue: unknown,\n) => {\n\tif (type === Boolean) {\n\t\tconst attributeValue = target.getAttribute(attributeKey);\n\t\tif (attributeValue === null) {\n\t\t\treturn defaultValue;\n\t\t}\n\n\t\treturn attributeValue === '' ? true : readAttributeValue(attributeValue, type);\n\t}\n\n\tconst attributeValue = target.getAttribute(attributeKey);\n\treturn attributeValue !== null\n\t\t? readAttributeValue(attributeValue, type)\n\t\t: (defaultValue ?? (defaultValueForType(type) as typeof defaultValue));\n};\n",
|
|
9
|
+
"import type { JsxRenderable } from '@ecopages/jsx';\nimport { getActiveSsrScopeValue, type RenderToStringOptions, withActiveSsrScopeValue } from '@ecopages/jsx/server';\nimport type { InternalRadiantSsrHost } from './radiant-element-ssr-host';\n\nexport type RadiantElementRenderBridge = {\n\trenderHost?: () => JsxRenderable;\n\trenderHostToString?: (options?: RenderToStringOptions) => string;\n};\n\nexport type RadiantElementServerRenderSsrCapable = InternalRadiantSsrHost;\n\nexport type RadiantElementTrackedRenderSsrCapable = InternalRadiantSsrHost;\n\nexport type RadiantElementSsrRuntime = {\n\tgetHostAttributes(component: InternalRadiantSsrHost): Record<string, string>;\n\trenderHost(component: InternalRadiantSsrHost): JsxRenderable;\n\trenderHostToString(component: InternalRadiantSsrHost, options?: RenderToStringOptions): string;\n\tresolveRenderBridge(component: object): RadiantElementRenderBridge | undefined;\n\trenderView(component: InternalRadiantSsrHost, options?: RenderToStringOptions): string;\n};\n\nconst RADIANT_ELEMENT_SSR_RUNTIME_SYMBOL = Symbol.for('@ecopages/radiant.element-ssr-runtime');\n\nexport function getRadiantElementSsrRuntime(): RadiantElementSsrRuntime | undefined {\n\treturn getActiveSsrScopeValue<RadiantElementSsrRuntime>(RADIANT_ELEMENT_SSR_RUNTIME_SYMBOL);\n}\n\nexport function withRadiantElementSsrRuntime<T>(runtime: RadiantElementSsrRuntime, render: () => T): T {\n\treturn withActiveSsrScopeValue(RADIANT_ELEMENT_SSR_RUNTIME_SYMBOL, runtime, render);\n}\n",
|
|
10
|
+
"export const CUSTOM_ELEMENT_TAG_NAME = Symbol.for('@ecopages/radiant.customElementTagName');\n\ntype CustomElementConstructorWithMetadata = CustomElementConstructor & {\n\t[CUSTOM_ELEMENT_TAG_NAME]?: string;\n};\n\n/**\n * Sets the custom element tag name for a given constructor.\n * This is used internally to associate a class with its custom element tag, which is necessary for features like hydration and SSR support.\n * @param target The constructor of the custom element.\n * @param tagName The tag name to associate with the custom element.\n */\nexport function setCustomElementTagName(target: CustomElementConstructor, tagName: string): void {\n\t(target as CustomElementConstructorWithMetadata)[CUSTOM_ELEMENT_TAG_NAME] = tagName;\n}\n\n/**\n * Retrieves the custom element tag name associated with a given constructor.\n * @param target The constructor of the custom element.\n * @returns The tag name associated with the custom element, or `undefined` if not set.\n */\nexport function getCustomElementTagName(target: CustomElementConstructor): string | undefined {\n\treturn (target as CustomElementConstructorWithMetadata)[CUSTOM_ELEMENT_TAG_NAME];\n}\n",
|
|
11
|
+
"/** Escapes a string for safe interpolation inside a double-quoted HTML attribute value. */\nexport function escapeHtmlAttribute(value: string): string {\n\treturn value.replace(/&/g, '&').replace(/\"/g, '"').replace(/</g, '<').replace(/>/g, '>');\n}\n",
|
|
12
|
+
"import type { ReactiveProperty } from '../core/reactive-prop-core';\nimport type { ReactivePropDefinition } from '../core/reactive-prop-metadata';\nimport { writeAttributeValue } from '../utils/attribute-utils';\nimport { escapeHtmlAttribute } from '../utils/escape-html-attribute';\n\n/**\n * Minimal host shape needed by the attribute serialization policy.\n *\n * This interface defines the narrow contract that the serialization module\n * consumes, keeping it independent of the full {@link RadiantElementSsrHost}.\n */\nexport type HostAttributeSource = {\n\tgetReactiveProperties: () => ReactiveProperty[];\n\tgetReactivePropDefinitions: () => ReactivePropDefinition[];\n\tgetPropertyValue: (name: string) => unknown;\n\tgetAttributeNames: () => string[];\n\tgetAttribute: (name: string) => string | null;\n};\n\n/**\n * Resolves the final set of SSR host attributes from a Radiant Element Host.\n *\n * ## Source precedence (highest to lowest)\n *\n * 1. **Reactive properties** — legacy attribute reflection via `property.converter`.\n * These are already-registered reactive properties with established converters.\n * Falsy values (`undefined`, `null`, `false`) are omitted.\n *\n * 2. **Reactive prop definitions** — decorator-based definitions. Skipped when the\n * target attribute name was already emitted by source 1 (dedup via `seenAttributes`).\n * Uses `writeAttributeValue` for type-aware conversion.\n *\n * 3. **Authored attributes** — raw host-level attributes from the original markup.\n * These always win if present, regardless of whether sources 1 or 2 already\n * set the same name. This preserves explicit author intent in templates.\n *\n * @param host Host shape providing reactive state and attribute accessors.\n * @returns Flat record of attribute name → serialized value.\n */\nexport function resolveHostAttributes(host: HostAttributeSource): Record<string, string> {\n\tconst attributes: Record<string, string> = {};\n\tconst seenAttributes = new Set<string>();\n\n\tappendReactivePropertyAttributes(host, attributes, seenAttributes);\n\tappendReactivePropDefinitionAttributes(host, attributes, seenAttributes);\n\tappendAuthoredAttributes(host, attributes);\n\n\treturn attributes;\n}\n\n/**\n * Serializes a flat attribute record into an HTML attribute string.\n *\n * Each entry becomes ` name=\"escaped-value\"` with the leading space included.\n * The combined string is safe for direct interpolation into an opening tag.\n *\n * @param attributes Flat attribute record to serialize.\n * @returns HTML attribute string.\n */\nexport function stringifyHostAttributes(attributes: Record<string, string>): string {\n\treturn Object.entries(attributes)\n\t\t.map(([name, value]) => ` ${name}=\"${escapeHtmlAttribute(value)}\"`)\n\t\t.join('');\n}\n\n/**\n * Source 1: Reactive properties with established converters.\n *\n * Falsy runtime values are omitted — they should not appear as attributes\n * in SSR output.\n */\nfunction appendReactivePropertyAttributes(\n\thost: HostAttributeSource,\n\tattributes: Record<string, string>,\n\tseenAttributes: Set<string>,\n): void {\n\tfor (const property of host.getReactiveProperties()) {\n\t\tconst currentValue = host.getPropertyValue(property.name);\n\t\tif (currentValue === undefined || currentValue === null || currentValue === false) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tattributes[property.attribute] = String(property.converter.toAttribute(currentValue));\n\t\tseenAttributes.add(property.attribute);\n\t}\n}\n\n/**\n * Source 2: Decorator-based reactive prop definitions.\n *\n * Skipped when the attribute name was already emitted by source 1, preventing\n * duplicate or conflicting attribute values.\n */\nfunction appendReactivePropDefinitionAttributes(\n\thost: HostAttributeSource,\n\tattributes: Record<string, string>,\n\tseenAttributes: Set<string>,\n): void {\n\tfor (const definition of host.getReactivePropDefinitions()) {\n\t\tconst attributeName = definition.options.attribute ?? definition.name;\n\n\t\tif (seenAttributes.has(attributeName)) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst currentValue = host.getPropertyValue(definition.name);\n\n\t\tif (currentValue === undefined || currentValue === null || currentValue === false) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tattributes[attributeName] = String(writeAttributeValue(currentValue, definition.options.type));\n\t\tseenAttributes.add(attributeName);\n\t}\n}\n\n/**\n * Source 3: Authored attributes from the original markup.\n *\n * These always overwrite — when an author explicitly sets an attribute in\n * markup, that intent takes precedence over reactive property reflection.\n */\nfunction appendAuthoredAttributes(host: HostAttributeSource, attributes: Record<string, string>): void {\n\tfor (const attributeName of host.getAttributeNames()) {\n\t\tconst attributeValue = host.getAttribute(attributeName);\n\t\tif (attributeValue !== null) {\n\t\t\tattributes[attributeName] = attributeValue;\n\t\t}\n\t}\n}\n\n",
|
|
13
|
+
"import type { SsrSerializableContextProvider } from './context-provider';\nimport type { UnknownContext } from './types';\n\ntype SsrContextProviderResolver = (context: UnknownContext) => SsrSerializableContextProvider | undefined;\n\nconst SSR_CONTEXT_PROVIDER_RESOLVER_SYMBOL = Symbol.for('@ecopages/radiant.ssr-context-provider-resolver');\n\ntype GlobalResolverScope = typeof globalThis & {\n\t[SSR_CONTEXT_PROVIDER_RESOLVER_SYMBOL]?: SsrContextProviderResolver;\n};\n\nfunction getGlobalResolverScope(): GlobalResolverScope {\n\treturn globalThis as GlobalResolverScope;\n}\n\n/**\n * Installs the ambient SSR provider resolver used by shared context runtime helpers.\n *\n * Server-side rendering infrastructure owns the actual provider stack storage and\n * publishes a lookup function here so client/runtime code does not need to import\n * server-oriented modules.\n */\nexport function installSsrContextProviderResolver(resolver: SsrContextProviderResolver): void {\n\tgetGlobalResolverScope()[SSR_CONTEXT_PROVIDER_RESOLVER_SYMBOL] = resolver;\n}\n\n/**\n * Resolves an ambient SSR provider when a server render has published one.\n */\nexport function resolveAmbientSsrContextProvider(context: UnknownContext): SsrSerializableContextProvider | undefined {\n\treturn getGlobalResolverScope()[SSR_CONTEXT_PROVIDER_RESOLVER_SYMBOL]?.(context);\n}\n",
|
|
14
|
+
"import type { AsyncLocalStorage } from 'node:async_hooks';\nimport type { SsrSerializableContextProvider } from '../context/context-provider';\nimport { installSsrContextProviderResolver } from '../context/context-ssr-bridge';\nimport type { ContextType, UnknownContext } from '../context/types';\n\ntype ProviderFrame = Map<UnknownContext, SsrSerializableContextProvider>;\ntype ProviderStack = ProviderFrame[];\n\nlet resolvedAsyncLocalStorage: AsyncLocalStorage<ProviderStack> | null | undefined;\n\n/**\n * Lazily resolves `AsyncLocalStorage` from `node:async_hooks`.\n *\n * The dynamic `require` is necessary because browser-based SSR tests import\n * this server-oriented module directly. A top-level static import would break\n * those browser bundles even though normal application SSR runs on the server.\n *\n * On the server (Node.js, Bun, Cloudflare Workers) the import always succeeds.\n * In browser test environments where SSR rendering is exercised without a real\n * server, the fallback global stack is used instead.\n */\nfunction getAsyncLocalStorage(): AsyncLocalStorage<ProviderStack> | null {\n\tif (resolvedAsyncLocalStorage !== undefined) {\n\t\treturn resolvedAsyncLocalStorage;\n\t}\n\n\ttry {\n\t\tconst { AsyncLocalStorage: ALS } = require('node:async_hooks') as typeof import('node:async_hooks');\n\t\tresolvedAsyncLocalStorage = new ALS<ProviderStack>();\n\t\treturn resolvedAsyncLocalStorage;\n\t} catch {\n\t\tresolvedAsyncLocalStorage = null;\n\t\treturn null;\n\t}\n}\n\nconst SSR_CONTEXT_FALLBACK_STACK_SYMBOL = Symbol.for('@ecopages/radiant.ssr-context-fallback-stack');\n\nfunction getFallbackStack(): ProviderStack {\n\tconst g = globalThis as typeof globalThis & { [SSR_CONTEXT_FALLBACK_STACK_SYMBOL]?: ProviderStack };\n\tg[SSR_CONTEXT_FALLBACK_STACK_SYMBOL] ??= [];\n\treturn g[SSR_CONTEXT_FALLBACK_STACK_SYMBOL];\n}\n\n/**\n * Pushes a temporary provider frame onto the SSR context stack.\n *\n * On the server, each call creates an isolated `AsyncLocalStorage` context so\n * concurrent renders cannot corrupt each other.\n *\n * In browser test environments where `AsyncLocalStorage` is unavailable, a\n * synchronous global stack is used as a fallback.\n */\nexport function withSsrContextProviders(providers: readonly SsrSerializableContextProvider[]): () => void {\n\tif (providers.length === 0) {\n\t\treturn () => undefined;\n\t}\n\n\tconst frame = new Map<UnknownContext, SsrSerializableContextProvider>();\n\n\tfor (const provider of providers) {\n\t\tframe.set(provider.getContextKey(), provider);\n\t}\n\n\tconst als = getAsyncLocalStorage();\n\n\tif (als) {\n\t\tconst parentStack = als.getStore() ?? [];\n\t\tconst childStack = [...parentStack, frame];\n\t\tals.enterWith(childStack);\n\n\t\treturn () => {\n\t\t\tals.enterWith(parentStack);\n\t\t};\n\t}\n\n\tconst stack = getFallbackStack();\n\tstack.push(frame);\n\n\treturn () => {\n\t\tconst index = stack.lastIndexOf(frame);\n\t\tif (index >= 0) stack.splice(index, 1);\n\t};\n}\n\n/**\n * Resolves the nearest SSR-visible provider for a given context token.\n *\n * Lookup walks the provider frames from innermost to outermost so nested host\n * serialization behaves the same way as runtime context resolution in the DOM.\n */\nexport function resolveSsrContextProvider<T extends UnknownContext>(\n\tcontext: T,\n): SsrSerializableContextProvider | undefined {\n\tconst store = getAsyncLocalStorage()?.getStore() ?? getFallbackStack();\n\n\tfor (let index = store.length - 1; index >= 0; index -= 1) {\n\t\tconst provider = store[index]?.get(context);\n\n\t\tif (provider) {\n\t\t\treturn provider;\n\t\t}\n\t}\n\n\treturn undefined;\n}\n\n/**\n * Resolves the current SSR-visible value for a given context token.\n *\n * This is the ergonomic helper consumed by SSR-aware decorators and component\n * render paths when they only need the context payload instead of the full\n * provider instance.\n */\nexport function resolveSsrContextValue<T extends UnknownContext>(context: T): ContextType<T> | undefined {\n\tconst provider = resolveSsrContextProvider(context);\n\n\tif (!provider) {\n\t\treturn undefined;\n\t}\n\n\treturn provider.getContext() as ContextType<T>;\n}\n\ninstallSsrContextProviderResolver((context) => resolveSsrContextProvider(context));\n",
|
|
15
|
+
"/**\n * Host script composition for Radiant SSR.\n *\n * This module owns the mode-sensitive ordering and inclusion rules for the\n * script payloads that appear inside a server-rendered Element Host.\n *\n * ## Composition rules\n *\n * | Mode | Order |\n * |-----------|-----------------------------------------------------------------|\n * | `plain` | view content → authored hydration markup → slot projection |\n * | `hydrate` | view content → slot projection → hydration binding scripts |\n *\n * In **plain** mode, authored hydration markup (script tags pre-authored on the\n * host) is preserved because the component may rely on them for standalone\n * behavior. Hydration binding scripts are omitted because there is no client\n * hydrator to consume them.\n *\n * In **hydrate** mode, authored hydration markup is superseded by the formal\n * hydration binding scripts. Slot projection comes before hydration scripts so\n * the client can reconstruct projected content before binding recovery.\n */\n\n/** Individual content parts that make up a server-rendered host's inner HTML. */\nexport type HostContentParts = {\n\t/** The rendered view HTML from `renderViewToString`. */\n\thostContent: string;\n\t/** Authored hydration script markup pre-existing on the host, if any. */\n\tauthoredHydrationMarkup: string;\n\t/** Slot projection JSON payload script tag, if any. */\n\tslotProjectionScript: string;\n\t/** Hydration binding script tags for client-side recovery, if any. */\n\thydrationScripts: string;\n};\n\n/**\n * Assembles the inner HTML of a server-rendered Element Host from its\n * individual content parts, respecting the mode-sensitive ordering rules.\n *\n * @param parts Individual content parts to compose.\n * @param hydrate Whether the output targets client-side hydration.\n * @returns Assembled inner HTML string.\n */\nexport function composeHostContent(parts: HostContentParts, hydrate: boolean): string {\n\tif (!hydrate) {\n\t\treturn `${parts.hostContent}${parts.authoredHydrationMarkup}${parts.slotProjectionScript}`;\n\t}\n\n\treturn `${parts.hostContent}${parts.slotProjectionScript}${parts.hydrationScripts}`;\n}\n",
|
|
16
|
+
"import type { JsxRenderable } from '@ecopages/jsx';\nimport type { RenderToStringOptions } from '@ecopages/jsx/server';\nimport type { SsrSerializableContextProvider } from '../context/context-provider';\nimport type { ReactiveProperty } from './reactive-prop-core';\nimport type { ReactivePropDefinition } from './reactive-prop-metadata';\nimport type { SsrSerializableHydrationBinding } from './ssr-hydration-binding';\n\n/**\n * Unified SSR host shape shared by core resolution and server serialization.\n */\nexport type InternalRadiantSsrHost = {\n\tconstructor: CustomElementConstructor;\n\tgetAttribute(name: string): string | null;\n\tgetAttributeNames(): string[];\n\tgetAuthoredHydrationScriptMarkup?: () => string | undefined;\n\tgetContextProviders: () => SsrSerializableContextProvider[];\n\tgetHydrationBindings: () => SsrSerializableHydrationBinding[];\n\tgetReactiveProperties: () => ReactiveProperty[];\n\tgetReactivePropDefinitions: () => ReactivePropDefinition[];\n\tgetPropertyValue: (name: string) => unknown;\n\tgetSlotProjectionScriptTag?: () => string | undefined;\n\tresolveTrackedRenderOutput: () => { containsSlots: boolean; value: JsxRenderable };\n\trenderViewToString: (options?: RenderToStringOptions) => string;\n};\n\nexport type RadiantElementSsrHostSource = InternalRadiantSsrHost;\n\nexport function resolveRadiantElementSsrHostSource(component: object): InternalRadiantSsrHost | undefined {\n\tif (isInternalRadiantSsrHost(component)) {\n\t\treturn component;\n\t}\n\n\treturn undefined;\n}\n\nexport function isInternalRadiantSsrHost(component: object): component is InternalRadiantSsrHost {\n\treturn (\n\t\ttypeof component.constructor === 'function' &&\n\t\ttypeof (component as { getAttribute?: unknown }).getAttribute === 'function' &&\n\t\ttypeof (component as { getAttributeNames?: unknown }).getAttributeNames === 'function' &&\n\t\ttypeof (component as { getAuthoredHydrationScriptMarkup?: unknown }).getAuthoredHydrationScriptMarkup ===\n\t\t\t'function' &&\n\t\ttypeof (component as { getContextProviders?: unknown }).getContextProviders === 'function' &&\n\t\ttypeof (component as { getHydrationBindings?: unknown }).getHydrationBindings === 'function' &&\n\t\ttypeof (component as { getReactiveProperties?: unknown }).getReactiveProperties === 'function' &&\n\t\ttypeof (component as { getSlotProjectionScriptTag?: unknown }).getSlotProjectionScriptTag === 'function' &&\n\t\ttypeof (component as { resolveTrackedRenderOutput?: unknown }).resolveTrackedRenderOutput === 'function' &&\n\t\ttypeof (component as { renderViewToString?: unknown }).renderViewToString === 'function'\n\t);\n}\n",
|
|
17
|
+
"import { getReactivePropDefinitions } from '../core/reactive-prop-metadata';\nimport { resolveRadiantElementSsrHostSource } from '../core/radiant-element-ssr-host';\nimport type { InternalRadiantSsrHost } from './internal-radiant-host';\n\nexport function toInternalRadiantSsrHost(component: object): InternalRadiantSsrHost {\n\tconst source = resolveRadiantElementSsrHostSource(component);\n\n\tif (!source) {\n\t\tthrow new Error('Radiant SSR runtime requires a server extraction host shape on the component.');\n\t}\n\n\treturn {\n\t\tconstructor: source.constructor,\n\t\tgetAttribute: (name) => source.getAttribute(name),\n\t\tgetAttributeNames: () => source.getAttributeNames(),\n\t\tgetAuthoredHydrationScriptMarkup: () => source.getAuthoredHydrationScriptMarkup?.(),\n\t\tgetContextProviders: () => source.getContextProviders(),\n\t\tgetHydrationBindings: () => source.getHydrationBindings(),\n\t\tgetReactiveProperties: () => source.getReactiveProperties(),\n\t\tgetReactivePropDefinitions: () => getReactivePropDefinitions(component),\n\t\tgetPropertyValue: (name) => Reflect.get(component, name),\n\t\tgetSlotProjectionScriptTag: () => source.getSlotProjectionScriptTag?.(),\n\t\tresolveTrackedRenderOutput: () => source.resolveTrackedRenderOutput(),\n\t\trenderViewToString: (options) => source.renderViewToString(options),\n\t};\n}\n",
|
|
18
|
+
"import type { JsxRenderable } from '@ecopages/jsx';\nimport type { RenderToStringOptions } from '@ecopages/jsx/server';\nimport { getCustomElementTagName } from '../core/custom-element-metadata';\nimport { withSsrContextProviders } from './context-ssr';\nimport { composeHostContent } from './host-script-composition';\nimport { resolveHostAttributes, stringifyHostAttributes } from './host-attribute-serialization';\nimport { ensureLegacyHostReady } from '../decorators/legacy/host-readiness';\nimport { toInternalRadiantSsrHost } from './radiant-element-ssr-extractor';\nimport type { InternalRadiantSsrHost } from '../core/radiant-element-ssr-host';\n\nexport class RadiantElementSsrService {\n\tprivate readonly component: object;\n\tprivate readonly host: InternalRadiantSsrHost;\n\n\tconstructor(component: object) {\n\t\tthis.component = component;\n\t\tthis.host = toInternalRadiantSsrHost(component);\n\t}\n\n\tprivate ensureReady(): void {\n\t\tensureLegacyHostReady(this.component, 'ssr');\n\t}\n\n\tpublic renderHost(): JsxRenderable {\n\t\tthis.ensureReady();\n\n\t\treturn {\n\t\t\tnodeType: 1,\n\t\t\touterHTML: this.renderHostToString({ mode: 'hydrate' }),\n\t\t};\n\t}\n\n\tpublic renderHostToString(options: RenderToStringOptions = {}, attributes = this.getHostAttributes()): string {\n\t\tthis.ensureReady();\n\t\tconst tagName = this.getTagName();\n\t\tconst restoreSsrContexts = withSsrContextProviders(this.host.getContextProviders());\n\n\t\ttry {\n\t\t\treturn `<${tagName}${stringifyHostAttributes(attributes)}>${this.renderHostContent(options)}</${tagName}>`;\n\t\t} finally {\n\t\t\trestoreSsrContexts();\n\t\t}\n\t}\n\n\tpublic getHostAttributes(): Record<string, string> {\n\t\tthis.ensureReady();\n\t\treturn resolveHostAttributes(this.host);\n\t}\n\n\tprivate renderHostContent(options: RenderToStringOptions): string {\n\t\tconst hydrate = options.mode === 'hydrate' || (options.mode === undefined && options.hydrate === true);\n\n\t\tconst hydrationScripts = hydrate\n\t\t\t? this.host\n\t\t\t\t\t.getHydrationBindings()\n\t\t\t\t\t.map((binding) => binding.renderHydrationScriptTag())\n\t\t\t\t\t.filter((markup): markup is string => typeof markup === 'string')\n\t\t\t\t\t.join('')\n\t\t\t: '';\n\n\t\treturn composeHostContent(\n\t\t\t{\n\t\t\t\thostContent: this.host.renderViewToString(options),\n\t\t\t\tauthoredHydrationMarkup: this.host.getAuthoredHydrationScriptMarkup?.() ?? '',\n\t\t\t\tslotProjectionScript: this.host.getSlotProjectionScriptTag?.() ?? '',\n\t\t\t\thydrationScripts,\n\t\t\t},\n\t\t\thydrate,\n\t\t);\n\t}\n\n\tprivate getTagName(): string {\n\t\tconst tagName = getCustomElementTagName(this.host.constructor);\n\n\t\tif (!tagName) {\n\t\t\tthrow new Error(`${this.host.constructor.name} is missing @customElement metadata.`);\n\t\t}\n\n\t\treturn tagName;\n\t}\n}\n",
|
|
19
|
+
"import type { JsxRenderable } from '@ecopages/jsx';\nimport type { RenderToStringOptions } from '@ecopages/jsx/server';\nimport { renderToString as renderJsxToString } from '@ecopages/jsx/server';\nimport {\n\tcreateServerHydrationBindingState,\n\tisServerRenderHydrationActive,\n\twithForcedServerCustomElementRendering,\n\twithServerCustomElementRenderHook,\n\twithServerHydrationBindingState,\n} from '@ecopages/jsx/server';\nimport { RadiantElementSsrService } from './radiant-element-ssr-service';\nimport { resolveRadiantElementSsrHostSource as resolveInternalRadiantElementSsrHostSource } from '../core/radiant-element-ssr-host';\nimport type {\n\tRadiantElementRenderBridge,\n\tRadiantElementServerRenderSsrCapable,\n\tRadiantElementSsrRuntime,\n\tRadiantElementTrackedRenderSsrCapable,\n} from '../core/radiant-element-ssr-registry';\nimport { withRadiantElementSsrRuntime } from '../core/radiant-element-ssr-registry';\n\nlet radiantElementSsrRuntime: RadiantElementSsrRuntime | undefined;\n\nexport function createRadiantElementSsrService(component: object): RadiantElementSsrService {\n\treturn new RadiantElementSsrService(component);\n}\n\nexport function renderRadiantElementHost(component: RadiantElementServerRenderSsrCapable): JsxRenderable {\n\treturn {\n\t\tnodeType: 1,\n\t\touterHTML: renderRadiantElementHostToString(component, { mode: 'hydrate' }),\n\t};\n}\n\nexport function renderRegisteredRadiantElementHost(component: unknown): JsxRenderable | undefined {\n\tif (isRadiantElementServerRenderable(component)) {\n\t\treturn renderRadiantElementHost(component);\n\t}\n\n\tif (!isLegacyServerRenderable(component)) {\n\t\treturn undefined;\n\t}\n\n\treturn component.renderHost?.() ?? { nodeType: 1, outerHTML: component.renderHostToString({ mode: 'hydrate' }) };\n}\n\nexport function renderRadiantElementHostToString(\n\tcomponent: RadiantElementServerRenderSsrCapable,\n\toptions: RenderToStringOptions = {},\n): string {\n\treturn withServerRadiantElementSsrRuntime(() =>\n\t\tcreateRadiantElementSsrService(component).renderHostToString(\n\t\t\toptions,\n\t\t\tgetRadiantElementHostSsrAttributes(component),\n\t\t),\n\t);\n}\n\nexport function renderRegisteredRadiantElementHostToString(\n\tcomponent: unknown,\n\toptions: RenderToStringOptions = {},\n): string | undefined {\n\tif (isRadiantElementServerRenderable(component)) {\n\t\treturn renderRadiantElementHostToString(component, options);\n\t}\n\n\tif (!isLegacyServerRenderable(component)) {\n\t\treturn undefined;\n\t}\n\n\treturn component.renderHostToString(options);\n}\n\nexport function resolveRegisteredRadiantElementPreview(component: unknown, markup: string): JsxRenderable | undefined {\n\tif (isRadiantElementServerRenderable(component)) {\n\t\treturn renderRadiantElementHost(component);\n\t}\n\n\tif (!isLegacyServerRenderable(component)) {\n\t\treturn undefined;\n\t}\n\n\treturn component.renderHost?.() ?? { nodeType: 1, outerHTML: markup };\n}\n\nexport function renderRadiantElementViewToString(\n\tcomponent: RadiantElementTrackedRenderSsrCapable,\n\toptions: RenderToStringOptions = {},\n): string {\n\treturn withServerRadiantElementSsrRuntime(() =>\n\t\twithRadiantServerCustomElementRenderBridge(() =>\n\t\t\trenderJsxToString(getRadiantElementTrackedRenderOutput(component).value, options),\n\t\t),\n\t);\n}\n\nexport function getRadiantElementHostSsrAttributes(\n\tcomponent: RadiantElementServerRenderSsrCapable,\n): Record<string, string> {\n\treturn createRadiantElementSsrService(component).getHostAttributes();\n}\n\nexport function resolveRadiantElementRenderBridge(component: object): RadiantElementRenderBridge | undefined {\n\tif (!isRadiantElementServerRenderable(component)) {\n\t\treturn undefined;\n\t}\n\n\treturn {\n\t\trenderHost: () => renderRadiantElementHost(component),\n\t\trenderHostToString: (options) => renderRadiantElementHostToString(component, options),\n\t};\n}\n\nexport function resolveRadiantElementSsrHostBridge(component: object): object | undefined {\n\treturn resolveInternalRadiantElementSsrHostSource(component);\n}\n\nexport function withRadiantServerCustomElementRenderBridge<T>(render: () => T): T {\n\treturn withForcedServerCustomElementRendering(() =>\n\t\twithServerCustomElementRenderHook(({ instance }) => {\n\t\t\tif (isRadiantElementServerRenderable(instance)) {\n\t\t\t\treturn {\n\t\t\t\t\tnodeType: 1,\n\t\t\t\t\tget outerHTML() {\n\t\t\t\t\t\tconst hydrate = isServerRenderHydrationActive();\n\t\t\t\t\t\tconst options: RenderToStringOptions = { hydrate, mode: hydrate ? 'hydrate' : 'plain' };\n\n\t\t\t\t\t\tif (!hydrate) {\n\t\t\t\t\t\t\treturn renderRadiantElementHostToString(instance, options);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn withServerHydrationBindingState(createServerHydrationBindingState(), () =>\n\t\t\t\t\t\t\trenderRadiantElementHostToString(instance, options),\n\t\t\t\t\t\t);\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tif (!isLegacyServerRenderable(instance)) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\tconst legacyInstance: { renderHostToString(options?: RenderToStringOptions): string } = instance;\n\n\t\t\treturn {\n\t\t\t\tnodeType: 1,\n\t\t\t\tget outerHTML() {\n\t\t\t\t\tconst hydrate = isServerRenderHydrationActive();\n\n\t\t\t\t\tif (!hydrate) {\n\t\t\t\t\t\treturn legacyInstance.renderHostToString({ hydrate, mode: hydrate ? 'hydrate' : 'plain' });\n\t\t\t\t\t}\n\n\t\t\t\t\treturn withServerHydrationBindingState(createServerHydrationBindingState(), () =>\n\t\t\t\t\t\tlegacyInstance.renderHostToString({ hydrate, mode: hydrate ? 'hydrate' : 'plain' }),\n\t\t\t\t\t);\n\t\t\t\t},\n\t\t\t};\n\t\t}, render),\n\t);\n}\n\nexport function getRadiantElementTrackedRenderOutput(component: RadiantElementTrackedRenderSsrCapable): {\n\tcontainsSlots: boolean;\n\tvalue: JsxRenderable;\n} {\n\tif (hasTrackedRenderOutput(component)) {\n\t\treturn component.resolveTrackedRenderOutput();\n\t}\n\n\tconst source = resolveInternalRadiantElementSsrHostSource(component);\n\n\tif (!source) {\n\t\tthrow new Error('Radiant SSR runtime requires tracked render output support on the component.');\n\t}\n\n\treturn source.resolveTrackedRenderOutput();\n}\n\nfunction isRadiantElementServerRenderable(component: unknown): component is RadiantElementServerRenderSsrCapable {\n\tif (typeof component !== 'object' || component === null) {\n\t\treturn false;\n\t}\n\n\treturn resolveInternalRadiantElementSsrHostSource(component) !== undefined;\n}\n\nfunction isLegacyServerRenderable(component: unknown): component is {\n\trenderHost?: () => JsxRenderable;\n\trenderHostToString(options?: RenderToStringOptions): string;\n} {\n\tif (typeof component !== 'object' || component === null) {\n\t\treturn false;\n\t}\n\n\treturn typeof (component as { renderHostToString?: unknown }).renderHostToString === 'function';\n}\n\nfunction hasTrackedRenderOutput(component: unknown): component is {\n\tresolveTrackedRenderOutput(): { containsSlots: boolean; value: JsxRenderable };\n} {\n\tif (typeof component !== 'object' || component === null) {\n\t\treturn false;\n\t}\n\n\treturn typeof (component as { resolveTrackedRenderOutput?: unknown }).resolveTrackedRenderOutput === 'function';\n}\n\nexport function getOrCreateRadiantElementSsrRuntime(): RadiantElementSsrRuntime {\n\tif (radiantElementSsrRuntime) {\n\t\treturn radiantElementSsrRuntime;\n\t}\n\n\tradiantElementSsrRuntime = {\n\t\tgetHostAttributes: getRadiantElementHostSsrAttributes,\n\t\trenderHost: renderRadiantElementHost,\n\t\trenderHostToString: renderRadiantElementHostToString,\n\t\tresolveRenderBridge: resolveRadiantElementRenderBridge,\n\t\trenderView: renderRadiantElementViewToString,\n\t};\n\n\treturn radiantElementSsrRuntime;\n}\n\nexport function withServerRadiantElementSsrRuntime<T>(render: () => T): T {\n\treturn withRadiantElementSsrRuntime(getOrCreateRadiantElementSsrRuntime(), render);\n}\n"
|
|
20
|
+
],
|
|
21
|
+
"mappings": "4PAEA,IAAM,EAA4B,OAAO,IAAI,2CAA2C,EAWjF,SAAS,EAA8B,CAC7C,EACA,EACA,EACO,CACP,IAAM,EAAc,EAAO,YACrB,EAAc,EAAY,IAA8B,CAAC,EAE/D,GAAI,EAAY,KAAK,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,EAAgC,EAAkC,EAAG,IAC3E,EAAe,mBAAmB,CAAE,UAAS,KAAM,EAAU,UAAY,OAAQ,CAAC,CACnF,EAEF,GACE,CAAM,CACV,EAGM,SAAS,EAAoC,CAAC,EAGnD,CACD,GAAI,GAAuB,CAAS,EACnC,OAAO,EAAU,2BAA2B,EAG7C,IAAM,EAAS,EAA2C,CAAS,EAEnE,GAAI,CAAC,EACJ,MAAU,MAAM,8EAA8E,EAG/F,OAAO,EAAO,2BAA2B,EAG1C,SAAS,CAAgC,CAAC,EAAuE,CAChH,GAAI,OAAO,IAAc,UAAY,IAAc,KAClD,MAAO,GAGR,OAAO,EAA2C,CAAS,IAAM,OAGlE,SAAS,CAAwB,CAAC,EAGhC,CACD,GAAI,OAAO,IAAc,UAAY,IAAc,KAClD,MAAO,GAGR,OAAO,OAAQ,EAA+C,qBAAuB,WAGtF,SAAS,EAAsB,CAAC,EAE9B,CACD,GAAI,OAAO,IAAc,UAAY,IAAc,KAClD,MAAO,GAGR,OAAO,OAAQ,EAAuD,6BAA+B,WAG/F,SAAS,EAAmC,EAA6B,CAC/E,GAAI,EACH,OAAO,EAWR,OARA,EAA2B,CAC1B,kBAAmB,EACnB,WAAY,EACZ,mBAAoB,EACpB,oBAAqB,EACrB,WAAY,CACb,EAEO,EAGD,SAAS,CAAqC,CAAC,EAAoB,CACzE,OAAO,EAA6B,GAAoC,EAAG,CAAM",
|
|
22
|
+
"debugId": "ADB47060B6AE441B64756E2164756E21",
|
|
23
|
+
"names": []
|
|
24
|
+
}
|
|
@@ -2,7 +2,7 @@ import type { JsxRenderable } from '@ecopages/jsx';
|
|
|
2
2
|
import type { RenderToStringOptions } from '@ecopages/jsx/server';
|
|
3
3
|
import type { ContextType, UnknownContext } from '../context/types';
|
|
4
4
|
import { type ServerRenderEnvironment } from './light-dom-shim';
|
|
5
|
-
|
|
5
|
+
export { createDefaultRenderTimestamp, toRenderedComponentPayload, toRenderedComponentWithPreview } from './render-fragment';
|
|
6
6
|
export type RenderedComponentAsset = {
|
|
7
7
|
/** Browser module specifier that must be loaded to activate the fragment. */
|
|
8
8
|
kind: 'script-module';
|
|
@@ -68,9 +68,9 @@ export type RenderedComponentWithPreview = RenderedComponentPayload & {
|
|
|
68
68
|
preview: JsxRenderable;
|
|
69
69
|
};
|
|
70
70
|
/** Minimal component contract needed for framework-agnostic SSR helpers. */
|
|
71
|
-
export type ServerRenderableComponent = {
|
|
71
|
+
export type ServerRenderableComponent = object & {
|
|
72
72
|
renderHost?: () => JsxRenderable;
|
|
73
|
-
renderHostToString
|
|
73
|
+
renderHostToString?: (options?: RenderToStringOptions) => string;
|
|
74
74
|
};
|
|
75
75
|
/** Constructor shape for a server-renderable component. */
|
|
76
76
|
export type ServerRenderableComponentConstructor<TComponent extends ServerRenderableComponent> = CustomElementConstructor & {
|
|
@@ -174,12 +174,6 @@ export declare function renderComponentToPayload<TComponent extends ServerRender
|
|
|
174
174
|
*/
|
|
175
175
|
export declare function renderComponentWithPreview<TComponent extends ServerRenderableComponent>(component: ServerRenderableComponentConstructor<TComponent>, options?: RenderComponentCallOptions<TComponent>): Promise<RenderedComponentWithPreview>;
|
|
176
176
|
export declare function renderComponentWithPreview<TComponent extends ServerRenderableComponent>(options: RenderComponentOptions<TComponent>): Promise<RenderedComponentWithPreview>;
|
|
177
|
-
/**
|
|
178
|
-
* Drops the preview renderable so the result can be sent through lightweight
|
|
179
|
-
* framework adapters or JSON/HTML fragment endpoints.
|
|
180
|
-
*/
|
|
181
|
-
export declare function toRenderedComponentPayload(render: RenderedComponentWithPreview | RenderedComponent): RenderedComponentPayload;
|
|
182
177
|
export declare function mergeRenderedComponentAssets(assets: readonly RenderedComponentAsset[], clientModuleSrc: string | undefined): readonly RenderedComponentAsset[];
|
|
183
178
|
export declare function resolvePrimaryClientModuleSrc(assets: readonly RenderedComponentAsset[]): string | undefined;
|
|
184
179
|
export declare function normalizeRenderOptions(options: RenderToStringOptions | undefined): RenderToStringOptions;
|
|
185
|
-
export {};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var Hf=((f)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(f,{get:(P,$)=>(typeof require<"u"?require:P)[$]}):f)(function(f){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+f+'" is not supported')});var _=Symbol.for("@ecopages/radiant.component-ssr-runtime");function R(){return globalThis[_]}function C(f){globalThis[_]=f}function u(f){switch(f){case Array:return"array";case Boolean:return"boolean";case Number:return"number";case Object:return"object";case String:return"string"}}function Qf(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 Zf(f){switch(f){case Number:return 0;case String:return"";case Boolean:return!1;default:return null}}function gf(f){try{return JSON.parse(f)}catch{throw TypeError("Invalid JSON string")}}var kf={array(f){let P=gf(f);if(!Array.isArray(P))throw TypeError(`Expected an array but got a value of type "${typeof P}"`);return P},boolean(f){return!(f==="0"||String(f).toLowerCase()==="false")},number(f){return Number(f.replace(/_/g,""))},object(f){let P=JSON.parse(f);if(P===null||typeof P!=="object"||Array.isArray(P))throw TypeError(`expected value of type "object" but instead got value "${f}" of type "${Qf(P)}"`);return P},string(f){return f}},N={default:E,array:r,object:r};function r(f){return JSON.stringify(f)}function E(f){return`${f}`}function S(f,P){let $=u(P);if(!$)throw TypeError(`[radiant-element] Unknown type "${P}"`);return kf[$](f)}function O(f,P){let $=u(P);if(!$)throw TypeError(`[radiant-element] Unknown type "${P}"`);return(N[$]??N.default??E)(f)}function Jf(f){return typeof f==="boolean"}function Ff(f){return typeof f==="number"}function Rf(f){return typeof f==="string"}function xf(f){return Array.isArray(f)}function Gf(f){return typeof f==="object"&&!Array.isArray(f)&&f!==null}function nf(f,P){switch(f){case Boolean:return Jf(P);case Number:return Ff(P);case String:return Rf(P);case Array:return xf(P);case Object:return Gf(P);default:return!1}}var ef=(f,P,$,h)=>{if(P===Boolean){let j=f.getAttribute($);if(j===null)return h;return j===""?!0:S(j,P)}let y=f.getAttribute($);return y!==null?S(y,P):h??Zf(P)};var i=Symbol.for("@ecopages/radiant.customElementTagName");function PP(f,P){f[i]=P}function x(f){return f[i]}var K=Symbol.for("@ecopages/radiant.reactivePropDefinitions");function hP(f,P,$){let h=f.constructor,y=h[K]??[];if(y.some((j)=>j.name===P))return;y.push({name:P,options:$}),h[K]=y}function v(f){return(f.constructor[K]??[]).slice()}var M=Symbol.for("@ecopages/radiant.ssr-context-provider-resolver");function p(){return globalThis}function t(f){p()[M]=f}function jP(f){return p()[M]?.(f)}var Q;function o(){if(Q!==void 0)return Q;try{let{AsyncLocalStorage:f}=(()=>{throw new Error("Cannot require module "+"node:async_hooks");})();return Q=new f,Q}catch{return Q=null,null}}var d=Symbol.for("@ecopages/radiant.ssr-context-fallback-stack");function a(){let f=globalThis;return f[d]??=[],f[d]}function G(f){if(f.length===0)return()=>{return};let P=new Map;for(let y of f)P.set(y.getContextKey(),y);let $=o();if($){let y=$.getStore()??[],j=[...y,P];return $.enterWith(j),()=>{$.enterWith(y)}}let h=a();return h.push(P),()=>{let y=h.lastIndexOf(P);if(y>=0)h.splice(y,1)}}function m(f){let P=o()?.getStore()??a();for(let $=P.length-1;$>=0;$-=1){let h=P[$]?.get(f);if(h)return h}return}function HP(f){let P=m(f);if(!P)return;return P.getContext()}t((f)=>m(f));class w{host;constructor(f){this.host=f}renderHost(){return{nodeType:1,outerHTML:this.renderHostToString({mode:"hydrate"})}}renderHostToString(f={},P=this.getHostAttributes()){let $=this.getTagName(),h=G(this.host.getContextProviders());try{return`<${$}${Uf(P)}>${this.renderHostContent(f)}</${$}>`}finally{h()}}renderHostContent(f){let P=this.host.renderToString(f),$=this.host.getAuthoredHydrationScriptMarkup?.()??"",h=this.host.getSlotProjectionScriptTag?.()??"";if(!(f.mode==="hydrate"||f.mode===void 0&&f.hydrate===!0))return`${P}${$}${h}`;let j=this.host.getHydrationBindings().map((b)=>b.renderHydrationScriptTag()).filter((b)=>typeof b==="string").join("");return`${P}${h}${j}`}getHostAttributes(){let f={},P=new Set;for(let $ of this.host.getReactiveProperties()){let h=this.host.getPropertyValue($.name);if(h===void 0||h===null||h===!1)continue;f[$.attribute]=String($.converter.toAttribute(h)),P.add($.attribute)}for(let $ of this.host.getReactivePropDefinitions()){let h=$.options.attribute??$.name;if(P.has(h))continue;let y=this.host.getPropertyValue($.name);if(y===void 0||y===null||y===!1)continue;f[h]=String(O(y,$.options.type)),P.add(h)}for(let $ of this.host.listAttributeNames()){let h=this.host.getAttributeValue($);if(h!==null)f[$]=h}return f}getTagName(){let f=x(this.host.constructor);if(!f)throw Error(`${this.host.constructor.name} is missing @customElement metadata.`);return f}}function Uf(f){return Object.entries(f).map(([P,$])=>` ${P}="${Wf($)}"`).join("")}function Wf(f){return f.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}import{renderToString as Xf}from"@ecopages/jsx/server";import{withServerCustomElementRenderHook as cf}from"@ecopages/jsx/server";var Df=Symbol.for("@ecopages/jsx.active-ssr-hydrate"),I=new WeakSet;function Yf(f){return{nodeType:1,outerHTML:l(f,{mode:"hydrate"})}}function l(f,P={}){return e(f).renderHostToString(P,n(f))}function n(f){let P=f;if(I.has(f))return e(f).getHostAttributes();I.add(f);try{return P.getHostSsrAttributes()}finally{I.delete(f)}}function e(f){let P=f;return new w({constructor:P.constructor,getAuthoredHydrationScriptMarkup:()=>P.getAuthoredHydrationScriptMarkup(),getHydrationBindings:()=>P.getHydrationBindings(),getSlotProjectionScriptTag:()=>P.getSlotProjectionScriptTag(),renderToString:($)=>P.renderToString($),getContextProviders:()=>P.getContextProviders(),getReactiveProperties:()=>P.getReactiveProperties(),getReactivePropDefinitions:()=>v(f),getPropertyValue:($)=>P[$],listAttributeNames:()=>typeof P.getAttributeNames==="function"?P.getAttributeNames():[],getAttributeValue:($)=>P.getAttribute($)})}function sf(f){return cf(({instance:P})=>{let $=ff(P);if(!$?.renderHostToString)return;let h=$.renderHostToString;return{nodeType:1,get outerHTML(){let y=Af();return h({hydrate:y,mode:y?"hydrate":"plain"})}}},f)}function ff(f){return f.resolveSsrRenderBridge?.()}function Af(){return globalThis[Df]===!0}function U(){let f=R();if(f)return f;let P={getHostAttributes:n,renderHost:Yf,renderHostToString:l,resolveRenderBridge:ff,renderView:($,h={})=>{let y=$;return sf(()=>Xf(y.resolveTrackedRenderOutput().value,h))}};return C(P),P}U();var W=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function Pf(f){let P=[],$=0;while($<f.length){let h=$;if(f.startsWith("<!--",$)){let b=f.indexOf("-->",$+4);$=b===-1?f.length:b+3,P.push(f.slice(h,$));continue}if(f[$]!=="<"){let b=f.indexOf("<",$);$=b===-1?f.length:b,P.push(f.slice(h,$));continue}let y=Z(f,$);if(!y){P.push(f.slice(h));break}if(y.type!=="open"||y.selfClosing||W.has(y.tagName)){$=y.end,P.push(f.slice(h,$));continue}$=y.end;let j=1;while($<f.length&&j>0){let b=f.indexOf("<",$);if(b===-1){$=f.length;break}let q=Z(f,b);if(!q){$=f.length;break}if($=q.end,q.type==="comment"||q.type==="declaration")continue;if(q.type==="open"&&!q.selfClosing&&!W.has(q.tagName)){j+=1;continue}if(q.type==="close")j-=1}P.push(f.slice(h,$))}return P.filter((h)=>h!=="")}function Kf(f,P){let $;for(let h=P+1;h<f.length;h+=1){let y=f[h];if($){if(y===$)$=void 0;continue}if(y==='"'||y==="'"){$=y;continue}if(y===">")return h+1}return f.length}function wf(f){let P={},$=/([:^@A-Za-z0-9_.-]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>/]+)))?/g;for(let h of f.matchAll($)){let[,y,j,b,q]=h;if(!y)continue;P[y]=j??b??q??""}return P}function Z(f,P){if(f.startsWith("<!--",P)){let F=f.indexOf("-->",P+4);return{end:F===-1?f.length:F+3,type:"comment"}}let $=Kf(f,P),h=f.slice(P+1,$-1).trim();if(h==="")return;if(h.startsWith("!")||h.startsWith("?"))return{end:$,type:"declaration"};if(h.startsWith("/"))return{end:$,type:"close"};let y=/\/\s*$/.test(h),j=y?h.replace(/\/\s*$/,"").trim():h,b=j.split(/[\s/>]/,1)[0]?.toLowerCase()??"",q=b.length,J=j.slice(q).trim(),A=y||W.has(b)?"":If(f,P,$,b);return{attributes:wf(J),end:$,innerHtml:A,selfClosing:y,tagName:b,type:"open"}}function If(f,P,$,h){let y=$,j=1;while(y<f.length&&j>0){let b=f.indexOf("<",y);if(b===-1)return f.slice($);let q=Z(f,b);if(!q)return f.slice($);if(q.type==="open"&&q.tagName===h&&!q.selfClosing&&!W.has(h))j+=1;if(q.type==="close"){if(f.slice(b+2,q.end-1).trim().toLowerCase()===h){if(j-=1,j===0)return f.slice($,b)}}y=q.end}return f.slice($)}class H extends EventTarget{nodeType;static ELEMENT_NODE=1;static TEXT_NODE=3;childNodes=[];parentNode=null;constructor(f){super();this.nodeType=f}append(...f){for(let P of f)this.appendChild(typeof P==="string"?B(P):P)}appendChild(f){if("parentNode"in f&&f.parentNode&&"removeChild"in f.parentNode)f.parentNode.removeChild(f);return this.childNodes.push(f),f.parentNode=this,f}removeChild(f){let P=this.childNodes.indexOf(f);if(P===-1)return f;return this.childNodes.splice(P,1),f.parentNode=null,f}replaceChildren(...f){for(let P of this.childNodes)P.parentNode=null;this.childNodes=[],this.append(...f)}get textContent(){return this.childNodes.map((f)=>f.textContent??"").join("")}set textContent(f){this.replaceChildren(f??"")}}class $f extends H{value;constructor(f){super(H.TEXT_NODE);this.value=f}get textContent(){return this.value}set textContent(f){this.value=f??""}}class X extends H{attributes=new Map;fragmentHtml;fragmentText;localName;tagName;constructor(f="div"){super(H.ELEMENT_NODE);this.localName=f.toLowerCase(),this.tagName=this.localName.toUpperCase()}hasAttribute(f){return this.attributes.has(f)}getAttribute(f){return this.attributes.get(f)??null}getAttributeNames(){return Array.from(this.attributes.keys())}setAttribute(f,P){this.fragmentHtml=void 0,this.attributes.set(f,String(P))}removeAttribute(f){this.fragmentHtml=void 0,this.attributes.delete(f)}querySelector(){return null}querySelectorAll(){return[]}matches(){return!1}get outerHTML(){if(this.fragmentHtml!==void 0)return this.fragmentHtml;let f=Array.from(this.attributes.entries()).map(([P,$])=>` ${P}="${Lf($)}"`).join("");return`<${this.localName}${f}>${this.innerHTML}</${this.localName}>`}get innerHTML(){return this.childNodes.map((f)=>_f(f)).join("")}set innerHTML(f){this.fragmentHtml=void 0,this.fragmentText=void 0,this.replaceChildren(...bf(f))}get textContent(){return this.fragmentText??super.textContent??""}set textContent(f){this.fragmentHtml=void 0,this.fragmentText=f??"",super.textContent=f}setSerializedFragment(f,P,$){this.fragmentHtml=f,this.fragmentText=P,this.attributes=new Map(Object.entries($)),this.replaceChildren()}}class D{bubbles;cancelable;composed;type;constructor(f,P={}){this.type=f,this.bubbles=P.bubbles??!1,this.cancelable=P.cancelable??!1,this.composed=P.composed??!1}}class V extends D{detail;constructor(f,P={}){super(f,P);this.detail=P.detail}}class k extends X{isConnected=!1;constructor(f="div"){super(f)}insertAdjacentHTML(f,P){this.append(...bf(P))}}class c extends k{constructor(){super("script")}}class hf{definitions=new Map;define(f,P){if(this.definitions.has(f))return;this.definitions.set(f,P)}get(f){return this.definitions.get(f)}}var g;function B(f){return new $f(f)}function yf(){let f=globalThis,P=f.customElements;if(typeof f.Node>"u"||typeof f.Element>"u"||typeof f.HTMLElement>"u"||!P||typeof P.define!=="function"||typeof P.get!=="function")return;return f.window??{CustomEvent:f.CustomEvent??V,Element:f.Element,Event:f.Event??D,EventTarget:f.EventTarget??EventTarget,HTMLScriptElement:f.HTMLScriptElement??f.HTMLElement,HTMLElement:f.HTMLElement,Node:f.Node,customElements:P}}function Bf(){let f=yf();if(f)return f;return Vf()}function jf(){return Bf(),{prepareHost(f,P={}){if(P.authoredContent!==void 0)f.innerHTML=P.authoredContent}}}function Vf(){let f=yf();if(f)return f;if(g)return g;let P=new hf,$=globalThis.Event??D,h=globalThis.CustomEvent??V,y=globalThis.EventTarget??EventTarget;return g={CustomEvent:h,Element:X,Event:$,EventTarget:y,HTMLScriptElement:c,HTMLElement:k,Node:H,customElements:P},Object.assign(globalThis,{CustomEvent:h,Element:X,Event:$,EventTarget:y,HTMLScriptElement:c,HTMLElement:k,Node:H,customElements:P,window:g}),g}function Tf(f,P){let $=P.tagName==="script"?new c:new k(P.tagName);return $.setSerializedFragment(f,zf(P.innerHtml),P.attributes),$}function Lf(f){return f.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function zf(f){return f.replace(/<!--.*?-->/gs,"").replace(/<[^>]+>/g,"")}function bf(f){return Pf(f).map((P)=>{if(!P.startsWith("<"))return B(P);let $=Z(P,0);if(!$||$.type!=="open")return B(P);return Tf(P,$)})}function _f(f){if(f.nodeType===H.TEXT_NODE)return f.textContent??"";return"outerHTML"in f&&typeof f.outerHTML==="string"?f.outerHTML:f.textContent??""}U();function Cf(f,P="hydrate"){return{kind:"script-module",src:f,stage:P}}function IP(f){return{kind:"modulepreload",href:f}}function BP(f,P){return P?{kind:"style",href:f,media:P}:{kind:"style",href:f}}async function VP(f,P){return(await Y(s(f,P))).markup}async function TP(f,P){return Y(s(f,P))}async function LP(f,P){return Ef(await Y(s(f,P)))}async function zP(f,P){return Of(await Y(s(f,P)))}async function Y(f){U();let P=f.environment??jf(),$=G(uf(f.ssrContext));try{let h="component"in f?f.component:await f.load(),y=new h;Sf(P,y,f.authoredContent,f.prepareHost),f.initialize?.(y);let j=f.clientModuleSrc??await f.resolveClientModuleSrc?.(h),b=f.assets??await f.resolveAssets?.(h)??[],q=pf(b,j),J=tf(q)??j,A=f.tagName??af(h),F=(f.now??vf)().toISOString(),T=df(f.renderOptions),L=Nf(y),z=L?.renderHostToString?.(T)??y.renderHostToString(T),qf=rf(y,L,z);return{markup:z,metadata:{assets:q,clientModuleUrl:J,generatedAt:F,tagName:A},preview:qf}}finally{$()}}function Nf(f){return R()?.resolveRenderBridge(f)}function rf(f,P,$){if(!P)return f.renderHost?.()??{nodeType:1,outerHTML:$};if(!P.renderHostToString&&P.renderHost)return{nodeType:1,outerHTML:$};return P.renderHost?.()??f.renderHost?.()??{nodeType:1,outerHTML:$}}function Sf(f,P,$,h){if(!of(P)){if($===void 0&&h===void 0)return;throw Error(`${P.constructor.name} cannot prepare SSR host content because it does not expose an innerHTML host surface.`)}f.prepareHost(P,{authoredContent:$}),h?.(P,f)}function uf(f){if(!f||f.length===0)return[];return f.map((P)=>({getContext:()=>P.value,getContextKey:()=>P.context,renderHydrationScript:()=>{return},renderHydrationScriptTag:()=>{return}}))}function Ef(f){if("metadata"in f)return{assets:f.metadata.assets,clientModuleSrc:f.metadata.clientModuleUrl,generatedAt:f.metadata.generatedAt,markup:f.markup,tagName:f.metadata.tagName};let{preview:P,...$}=f;return $}function Of(f){return{assets:f.metadata.assets,clientModuleSrc:f.metadata.clientModuleUrl,generatedAt:f.metadata.generatedAt,markup:f.markup,preview:f.preview,tagName:f.metadata.tagName}}function vf(){return new Date}function Mf(f){if(!f)return[];return[Cf(f)]}function pf(f,P){if(!P)return f;if(f.some(($)=>$.kind==="script-module"&&$.src===P))return f;return[...Mf(P),...f]}function tf(f){return f.find((P)=>P.kind==="script-module")?.src}function s(f,P){if(typeof f==="function")return{...P,component:f};return f}function df(f){if(f?.mode!==void 0||f?.hydrate!==void 0)return f;return{...f,mode:"hydrate"}}function of(f){return"innerHTML"in f}function af(f){let P=x(f);if(!P)throw Error(`${f.name} is missing @customElement metadata.`);return P}export{Ef as toRenderedComponentPayload,BP as styleAsset,Cf as scriptModuleAsset,tf as resolvePrimaryClientModuleSrc,zP as renderComponentWithPreview,VP as renderComponentToString,LP as renderComponentToPayload,TP as renderComponent,df as normalizeRenderOptions,IP as modulePreloadAsset,pf as mergeRenderedComponentAssets};
|
|
1
|
+
var v1=((q)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(q,{get:(Q,R)=>(typeof require<"u"?require:Q)[R]}):q)(function(q){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+q+'" is not supported')});var y=Symbol.for("@ecopages/radiant.reactivePropDefinitions");function E0(q,Q,R){let $=q.constructor,Z=$[y]??[];if(Z.some((F)=>F.name===Q))return;Z.push({name:Q,options:R}),$[y]=Z}function e(q){return(q.constructor[y]??[]).slice()}var q1=Symbol.for("@ecopages/radiant.legacy-instance-initializers"),Q1=Symbol.for("@ecopages/radiant.legacy-post-construction-initializers"),d1=Symbol.for("@ecopages/radiant.legacy-executed-post-construction-initializers");function O0(q,Q){Z1(q,q1,Q)}function N0(q,Q){Z1(q,Q1,Q)}function R1(q){h(q,q1)}function $1(q){let Q=q;h(q,Q1,Q[d1]??=new Set)}function Z1(q,Q,R){let $=q,Z=Object.prototype.hasOwnProperty.call($,Q)?$[Q]:void 0;if(Array.isArray(Z)){Z.push(R);return}Object.defineProperty($,Q,{value:[R]})}function h(q,Q,R,$=Object.getPrototypeOf(q)){if(!$||$===Object.prototype)return;h(q,Q,R,Object.getPrototypeOf($));let Z=$[Q];if(!Array.isArray(Z))return;for(let F of Z){if(R?.has(F))continue;F(q),R?.add(F)}}function L(q,Q){switch(Q){case"construct":R1(q);break;case"connect":case"ssr":$1(q);break}}function j1(q){switch(q){case Array:return"array";case Boolean:return"boolean";case Number:return"number";case Object:return"object";case String:return"string"}}function u1(q){switch(typeof q){case"boolean":return"boolean";case"number":return"number";case"string":return"string"}if(Array.isArray(q))return"array";if(Object.prototype.toString.call(q)==="[object Object]")return"object"}function c1(q){switch(q){case Number:return 0;case String:return"";case Boolean:return!1;default:return null}}function s1(q){try{return JSON.parse(q)}catch{throw TypeError("Invalid JSON string")}}var p1={array(q){let Q=s1(q);if(!Array.isArray(Q))throw TypeError(`Expected an array but got a value of type "${typeof Q}"`);return Q},boolean(q){return!(q==="0"||String(q).toLowerCase()==="false")},number(q){return Number(q.replace(/_/g,""))},object(q){let Q=JSON.parse(q);if(Q===null||typeof Q!=="object"||Array.isArray(Q))throw TypeError(`expected value of type "object" but instead got value "${q}" of type "${u1(Q)}"`);return Q},string(q){return q}},F1={default:X1,array:J1,object:J1};function J1(q){return JSON.stringify(q)}function X1(q){return`${q}`}function f1(q,Q){let R=j1(Q);if(!R)throw TypeError(`[radiant-element] Unknown type "${Q}"`);return p1[R](q)}function P1(q,Q){let R=j1(Q);if(!R)throw TypeError(`[radiant-element] Unknown type "${Q}"`);return(F1[R]??F1.default??X1)(q)}function l1(q){return typeof q==="boolean"}function m1(q){return typeof q==="number"}function r1(q){return typeof q==="string"}function i1(q){return Array.isArray(q)}function a1(q){return typeof q==="object"&&!Array.isArray(q)&&q!==null}function M0(q,Q){switch(q){case Boolean:return l1(Q);case Number:return m1(Q);case String:return r1(Q);case Array:return i1(Q);case Object:return a1(Q);default:return!1}}var v0=(q,Q,R,$)=>{if(Q===Boolean){let F=q.getAttribute(R);if(F===null)return $;return F===""?!0:f1(F,Q)}let Z=q.getAttribute(R);return Z!==null?f1(Z,Q):$??c1(Q)};import{getActiveSsrScopeValue as o1,withActiveSsrScopeValue as n1}from"@ecopages/jsx/server";var B1=Symbol.for("@ecopages/radiant.element-ssr-runtime");function c0(){return o1(B1)}function k(q,Q){return n1(B1,q,Q)}var G1=Symbol.for("@ecopages/radiant.customElementTagName");function p0(q,Q){q[G1]=Q}function I(q){return q[G1]}function U1(q){return q.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function W1(q){let Q={},R=new Set;return t1(q,Q,R),e1(q,Q,R),q0(q,Q),Q}function K1(q){return Object.entries(q).map(([Q,R])=>` ${Q}="${U1(R)}"`).join("")}function t1(q,Q,R){for(let $ of q.getReactiveProperties()){let Z=q.getPropertyValue($.name);if(Z===void 0||Z===null||Z===!1)continue;Q[$.attribute]=String($.converter.toAttribute(Z)),R.add($.attribute)}}function e1(q,Q,R){for(let $ of q.getReactivePropDefinitions()){let Z=$.options.attribute??$.name;if(R.has(Z))continue;let F=q.getPropertyValue($.name);if(F===void 0||F===null||F===!1)continue;Q[Z]=String(P1(F,$.options.type)),R.add(Z)}}function q0(q,Q){for(let R of q.getAttributeNames()){let $=q.getAttribute(R);if($!==null)Q[R]=$}}var Y1=Symbol.for("@ecopages/radiant.ssr-context-provider-resolver");function H1(){return globalThis}function _1(q){H1()[Y1]=q}function o0(q){return H1()[Y1]?.(q)}var W;function x1(){if(W!==void 0)return W;try{let{AsyncLocalStorage:q}=(()=>{throw new Error("Cannot require module "+"node:async_hooks");})();return W=new q,W}catch{return W=null,null}}var w1=Symbol.for("@ecopages/radiant.ssr-context-fallback-stack");function V1(){let q=globalThis;return q[w1]??=[],q[w1]}function D(q){if(q.length===0)return()=>{return};let Q=new Map;for(let Z of q)Q.set(Z.getContextKey(),Z);let R=x1();if(R){let Z=R.getStore()??[],F=[...Z,Q];return R.enterWith(F),()=>{R.enterWith(Z)}}let $=V1();return $.push(Q),()=>{let Z=$.lastIndexOf(Q);if(Z>=0)$.splice(Z,1)}}function A1(q){let Q=x1()?.getStore()??V1();for(let R=Q.length-1;R>=0;R-=1){let $=Q[R]?.get(q);if($)return $}return}function e0(q){let Q=A1(q);if(!Q)return;return Q.getContext()}_1((q)=>A1(q));function L1(q,Q){if(!Q)return`${q.hostContent}${q.authoredHydrationMarkup}${q.slotProjectionScript}`;return`${q.hostContent}${q.slotProjectionScript}${q.hydrationScripts}`}function B(q){if(Q0(q))return q;return}function Q0(q){return typeof q.constructor==="function"&&typeof q.getAttribute==="function"&&typeof q.getAttributeNames==="function"&&typeof q.getAuthoredHydrationScriptMarkup==="function"&&typeof q.getContextProviders==="function"&&typeof q.getHydrationBindings==="function"&&typeof q.getReactiveProperties==="function"&&typeof q.getSlotProjectionScriptTag==="function"&&typeof q.resolveTrackedRenderOutput==="function"&&typeof q.renderViewToString==="function"}function k1(q){let Q=B(q);if(!Q)throw Error("Radiant SSR runtime requires a server extraction host shape on the component.");return{constructor:Q.constructor,getAttribute:(R)=>Q.getAttribute(R),getAttributeNames:()=>Q.getAttributeNames(),getAuthoredHydrationScriptMarkup:()=>Q.getAuthoredHydrationScriptMarkup?.(),getContextProviders:()=>Q.getContextProviders(),getHydrationBindings:()=>Q.getHydrationBindings(),getReactiveProperties:()=>Q.getReactiveProperties(),getReactivePropDefinitions:()=>e(q),getPropertyValue:(R)=>Reflect.get(q,R),getSlotProjectionScriptTag:()=>Q.getSlotProjectionScriptTag?.(),resolveTrackedRenderOutput:()=>Q.resolveTrackedRenderOutput(),renderViewToString:(R)=>Q.renderViewToString(R)}}class M{component;host;constructor(q){this.component=q,this.host=k1(q)}ensureReady(){L(this.component,"ssr")}renderHost(){return this.ensureReady(),{nodeType:1,outerHTML:this.renderHostToString({mode:"hydrate"})}}renderHostToString(q={},Q=this.getHostAttributes()){this.ensureReady();let R=this.getTagName(),$=D(this.host.getContextProviders());try{return`<${R}${K1(Q)}>${this.renderHostContent(q)}</${R}>`}finally{$()}}getHostAttributes(){return this.ensureReady(),W1(this.host)}renderHostContent(q){let Q=q.mode==="hydrate"||q.mode===void 0&&q.hydrate===!0,R=Q?this.host.getHydrationBindings().map(($)=>$.renderHydrationScriptTag()).filter(($)=>typeof $==="string").join(""):"";return L1({hostContent:this.host.renderViewToString(q),authoredHydrationMarkup:this.host.getAuthoredHydrationScriptMarkup?.()??"",slotProjectionScript:this.host.getSlotProjectionScriptTag?.()??"",hydrationScripts:R},Q)}getTagName(){let q=I(this.host.constructor);if(!q)throw Error(`${this.host.constructor.name} is missing @customElement metadata.`);return q}}import{renderToString as R0}from"@ecopages/jsx/server";import{createServerHydrationBindingState as I1,isServerRenderHydrationActive as D1,withForcedServerCustomElementRendering as $0,withServerCustomElementRenderHook as Z0,withServerHydrationBindingState as C1}from"@ecopages/jsx/server";var C;function v(q){return new M(q)}function K(q){return{nodeType:1,outerHTML:X(q,{mode:"hydrate"})}}function d(q){if(Y(q))return K(q);if(!T(q))return;return q.renderHost?.()??{nodeType:1,outerHTML:q.renderHostToString({mode:"hydrate"})}}function X(q,Q={}){return p(()=>v(q).renderHostToString(Q,s(q)))}function u(q,Q={}){if(Y(q))return X(q,Q);if(!T(q))return;return q.renderHostToString(Q)}function c(q,Q){if(Y(q))return K(q);if(!T(q))return;return q.renderHost?.()??{nodeType:1,outerHTML:Q}}function T1(q,Q={}){return p(()=>b1(()=>R0(E1(q).value,Q)))}function s(q){return v(q).getHostAttributes()}function z1(q){if(!Y(q))return;return{renderHost:()=>K(q),renderHostToString:(Q)=>X(q,Q)}}function F0(q){return B(q)}function b1(q){return $0(()=>Z0(({instance:Q})=>{if(Y(Q))return{nodeType:1,get outerHTML(){let $=D1(),Z={hydrate:$,mode:$?"hydrate":"plain"};if(!$)return X(Q,Z);return C1(I1(),()=>X(Q,Z))}};if(!T(Q))return;let R=Q;return{nodeType:1,get outerHTML(){let $=D1();if(!$)return R.renderHostToString({hydrate:$,mode:$?"hydrate":"plain"});return C1(I1(),()=>R.renderHostToString({hydrate:$,mode:$?"hydrate":"plain"}))}}},q))}function E1(q){if(J0(q))return q.resolveTrackedRenderOutput();let Q=B(q);if(!Q)throw Error("Radiant SSR runtime requires tracked render output support on the component.");return Q.resolveTrackedRenderOutput()}function Y(q){if(typeof q!=="object"||q===null)return!1;return B(q)!==void 0}function T(q){if(typeof q!=="object"||q===null)return!1;return typeof q.renderHostToString==="function"}function J0(q){if(typeof q!=="object"||q===null)return!1;return typeof q.resolveTrackedRenderOutput==="function"}function z(){if(C)return C;return C={getHostAttributes:s,renderHost:K,renderHostToString:X,resolveRenderBridge:z1,renderView:T1},C}function p(q){return k(z(),q)}var b=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function g1(q){let Q=[],R=0;while(R<q.length){let $=R;if(q.startsWith("<!--",R)){let J=q.indexOf("-->",R+4);R=J===-1?q.length:J+3,Q.push(q.slice($,R));continue}if(q[R]!=="<"){let J=q.indexOf("<",R);R=J===-1?q.length:J,Q.push(q.slice($,R));continue}let Z=H(q,R);if(!Z){Q.push(q.slice($));break}if(Z.type!=="open"||Z.selfClosing||b.has(Z.tagName)){R=Z.end,Q.push(q.slice($,R));continue}R=Z.end;let F=1;while(R<q.length&&F>0){let J=q.indexOf("<",R);if(J===-1){R=q.length;break}let f=H(q,J);if(!f){R=q.length;break}if(R=f.end,f.type==="comment"||f.type==="declaration")continue;if(f.type==="open"&&!f.selfClosing&&!b.has(f.tagName)){F+=1;continue}if(f.type==="close")F-=1}Q.push(q.slice($,R))}return Q.filter(($)=>$!=="")}function f0(q,Q){let R;for(let $=Q+1;$<q.length;$+=1){let Z=q[$];if(R){if(Z===R)R=void 0;continue}if(Z==='"'||Z==="'"){R=Z;continue}if(Z===">")return $+1}return q.length}function j0(q){let Q={},R=/([:^@A-Za-z0-9_.-]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>/]+)))?/g;for(let $ of q.matchAll(R)){let[,Z,F,J,f]=$;if(!Z)continue;Q[Z]=F??J??f??""}return Q}function H(q,Q){if(q.startsWith("<!--",Q)){let A=q.indexOf("-->",Q+4);return{end:A===-1?q.length:A+3,type:"comment"}}let R=f0(q,Q),$=q.slice(Q+1,R-1).trim();if($==="")return;if($.startsWith("!")||$.startsWith("?"))return{end:R,type:"declaration"};if($.startsWith("/"))return{end:R,type:"close"};let Z=/\/\s*$/.test($),F=Z?$.replace(/\/\s*$/,"").trim():$,J=F.split(/[\s/>]/,1)[0]?.toLowerCase()??"",f=J.length,P=F.slice(f).trim(),S=Z||b.has(J)?"":X0(q,Q,R,J);return{attributes:j0(P),end:R,innerHtml:S,selfClosing:Z,tagName:J,type:"open"}}function X0(q,Q,R,$){let Z=R,F=1;while(Z<q.length&&F>0){let J=q.indexOf("<",Z);if(J===-1)return q.slice(R);let f=H(q,J);if(!f)return q.slice(R);if(f.type==="open"&&f.tagName===$&&!f.selfClosing&&!b.has($))F+=1;if(f.type==="close"){if(q.slice(J+2,f.end-1).trim().toLowerCase()===$){if(F-=1,F===0)return q.slice(R,J)}}Z=f.end}return q.slice(R)}class j extends EventTarget{nodeType;static DOCUMENT_NODE=9;static ELEMENT_NODE=1;static TEXT_NODE=3;childNodes=[];ownerDocument;parentNode=null;constructor(q,Q=null){super();this.nodeType=q;this.ownerDocument=Q}append(...q){for(let Q of q)this.appendChild(typeof Q==="string"?P0(Q):Q)}appendChild(q){if("parentNode"in q&&q.parentNode&&"removeChild"in q.parentNode)q.parentNode.removeChild(q);return this.childNodes.push(q),q.ownerDocument=this.nodeType===j.DOCUMENT_NODE?this:this.ownerDocument,q.parentNode=this,q}removeChild(q){let Q=this.childNodes.indexOf(q);if(Q===-1)return q;return this.childNodes.splice(Q,1),q.parentNode=null,q}replaceChildren(...q){for(let Q of this.childNodes)Q.parentNode=null;this.childNodes=[],this.append(...q)}get textContent(){return this.childNodes.map((q)=>q.textContent??"").join("")}set textContent(q){this.replaceChildren(q??"")}getRootNode(){let q=this;while("parentNode"in q&&q.parentNode)q=q.parentNode;return q}}class x extends j{value;constructor(q,Q=U()){super(j.TEXT_NODE,Q);this.value=q}get textContent(){return this.value}set textContent(q){this.value=q??""}}class O1{element;constructor(q){this.element=q}add(...q){let Q=new Set(this.readTokens());for(let R of q)if(R!=="")Q.add(R);this.writeTokens([...Q])}remove(...q){let Q=new Set(this.readTokens());for(let R of q)Q.delete(R);this.writeTokens([...Q])}toggle(q,Q){let R=this.contains(q);if(Q??!R)return this.add(q),!0;return this.remove(q),!1}contains(q){return this.readTokens().includes(q)}toString(){return this.value}get value(){return this.element.getAttribute("class")??""}readTokens(){return this.value.split(/\s+/).map((q)=>q.trim()).filter((q)=>q.length>0)}writeTokens(q){if(q.length===0){this.element.removeAttribute("class");return}this.element.setAttribute("class",q.join(" "))}}class E extends j{attributes=new Map;classListValue;datasetValue;fragmentHtml;fragmentText;localName;tagName;constructor(q="div",Q=U()){super(j.ELEMENT_NODE,Q);this.localName=q.toLowerCase(),this.tagName=this.localName.toUpperCase()}get id(){return this.getAttribute("id")??""}set id(q){if(q===""){this.removeAttribute("id");return}this.setAttribute("id",q)}get classList(){return this.classListValue??=new O1(this),this.classListValue}get dataset(){return this.datasetValue??=new Proxy({},{deleteProperty:(q,Q)=>{if(typeof Q!=="string")return!1;return this.removeAttribute(w(Q)),!0},get:(q,Q)=>{if(typeof Q!=="string")return;return this.getAttribute(w(Q))??void 0},getOwnPropertyDescriptor:(q,Q)=>{if(typeof Q!=="string")return;return{configurable:!0,enumerable:!0,value:this.getAttribute(w(Q))??void 0,writable:!0}},has:(q,Q)=>{return typeof Q==="string"&&this.hasAttribute(w(Q))},ownKeys:()=>{return this.getAttributeNames().filter((q)=>q.startsWith("data-")).map((q)=>Y0(q.slice(5)))},set:(q,Q,R)=>{if(typeof Q!=="string")return!1;return this.setAttribute(w(Q),String(R)),!0}}),this.datasetValue}hasAttribute(q){return this.attributes.has(q)}getAttribute(q){return this.attributes.get(q)??null}getAttributeNames(){return Array.from(this.attributes.keys())}setAttribute(q,Q){this.fragmentHtml=void 0,this.attributes.set(q,String(Q))}toggleAttribute(q,Q){if(Q??!this.hasAttribute(q))return this.setAttribute(q,""),!0;return this.removeAttribute(q),!1}removeAttribute(q){this.fragmentHtml=void 0,this.attributes.delete(q)}querySelector(){return null}querySelectorAll(){return[]}matches(){return!1}get outerHTML(){if(this.fragmentHtml!==void 0)return this.fragmentHtml;let q=Array.from(this.attributes.entries()).map(([Q,R])=>` ${Q}="${W0(R)}"`).join("");return`<${this.localName}${q}>${this.innerHTML}</${this.localName}>`}get innerHTML(){return this.childNodes.map((q)=>_0(q)).join("")}set innerHTML(q){this.fragmentHtml=void 0,this.fragmentText=void 0,this.replaceChildren(...h1(q,this.ownerDocument))}get textContent(){return this.fragmentText??super.textContent??""}set textContent(q){this.fragmentHtml=void 0,this.fragmentText=q??"",super.textContent=q}setSerializedFragment(q,Q,R){this.fragmentHtml=q,this.fragmentText=Q,this.attributes=new Map(Object.entries(R)),this.replaceChildren()}}class g{bubbles;cancelable;composed;type;constructor(q,Q={}){this.type=q,this.bubbles=Q.bubbles??!1,this.cancelable=Q.cancelable??!1,this.composed=Q.composed??!1}}class r extends g{detail;constructor(q,Q={}){super(q,Q);this.detail=Q.detail}}class G extends E{isConnected=!1;constructor(q="div",Q=U()){super(q,Q)}insertAdjacentHTML(q,Q){this.append(...h1(Q,this.ownerDocument))}}class V extends G{constructor(q=U()){super("script",q)}}class l extends j{constructor(){super(j.DOCUMENT_NODE)}createElement(q){return q.toLowerCase()==="script"?new V(this):new G(q,this)}createTextNode(q){return new x(q,this)}querySelector(){return null}querySelectorAll(){return[]}}class N1{definitions=new Map;define(q,Q){if(this.definitions.has(q))return;this.definitions.set(q,Q)}get(q){return this.definitions.get(q)}}var _,m={escape(q){return H0(String(q))}};function P0(q){return new x(q,U())}function U(){return globalThis.document??null}function S1(){let q=globalThis,Q=q.customElements;if(typeof q.Node>"u"||typeof q.Document>"u"||typeof q.Element>"u"||typeof q.HTMLElement>"u"||typeof q.document>"u"||!Q||typeof Q.define!=="function"||typeof Q.get!=="function")return;return q.window??{CSS:q.CSS??m,CustomEvent:q.CustomEvent??r,Document:q.Document,Element:q.Element,Event:q.Event??g,EventTarget:q.EventTarget??EventTarget,HTMLScriptElement:q.HTMLScriptElement??q.HTMLElement,HTMLElement:q.HTMLElement,Node:q.Node,document:q.document,customElements:Q}}function B0(){let q=S1();if(q)return q;return G0()}function y1(){return B0(),{prepareHost(q,Q={}){if(Q.authoredContent!==void 0)q.innerHTML=Q.authoredContent}}}function G0(){let q=S1();if(q)return q;if(_)return _;let Q=new N1,R=new l,$=globalThis.Event??g,Z=globalThis.CustomEvent??r,F=l,J=globalThis.EventTarget??EventTarget;return _={CSS:globalThis.CSS??m,CustomEvent:Z,Document:F,Element:E,Event:$,EventTarget:J,HTMLScriptElement:V,HTMLElement:G,Node:j,document:R,customElements:Q},Object.assign(globalThis,{CSS:globalThis.CSS??m,CustomEvent:Z,Document:F,Element:E,Event:$,EventTarget:J,HTMLScriptElement:V,HTMLElement:G,Node:j,document:R,customElements:Q,window:_}),_}function U0(q,Q,R){let $=Q.tagName==="script"?new V(R):new G(Q.tagName,R);return $.setSerializedFragment(q,K0(Q.innerHtml),Q.attributes),$}function W0(q){return q.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function K0(q){return q.replace(/<!--.*?-->/gs,"").replace(/<[^>]+>/g,"")}function h1(q,Q=U()){return g1(q).map((R)=>{if(!R.startsWith("<"))return new x(R,Q);let $=H(R,0);if(!$||$.type!=="open")return new x(R,Q);return U0(R,$,Q)})}function w(q){return`data-${q.replace(/([A-Z])/g,"-$1").toLowerCase()}`}function Y0(q){return q.replace(/-([a-z])/g,(Q,R)=>R.toUpperCase())}function H0(q){let Q="";for(let R=0;R<q.length;R+=1){let $=q[R]??"",Z=$.codePointAt(0)??0;if(Z===0){Q+="�";continue}let F=Z>=1&&Z<=31||Z===127,J=R===0&&Z>=48&&Z<=57,f=R===1&&Z>=48&&Z<=57&&(q[0]??"")==="-",P=R===0&&$==="-"&&q.length===1;if(F||J||f){Q+=`\\${Z.toString(16)} `;continue}if(Z>=128||$==="-"||$==="_"||Z>=48&&Z<=57||Z>=65&&Z<=90||Z>=97&&Z<=122){Q+=P?`\\${$}`:$;continue}Q+=`\\${$}`}return Q}function _0(q){if(q.nodeType===j.TEXT_NODE)return q.textContent??"";return"outerHTML"in q&&typeof q.outerHTML==="string"?q.outerHTML:q.textContent??""}function i(){return new Date}function a(q){if("metadata"in q)return{assets:q.metadata.assets,clientModuleSrc:q.metadata.clientModuleUrl,generatedAt:q.metadata.generatedAt,markup:q.markup,tagName:q.metadata.tagName};let{preview:Q,...R}=q;return R}function o(q){return{assets:q.metadata.assets,clientModuleSrc:q.metadata.clientModuleUrl,generatedAt:q.metadata.generatedAt,markup:q.markup,preview:q.preview,tagName:q.metadata.tagName}}function w0(q,Q="hydrate"){return{kind:"script-module",src:q,stage:Q}}function Oq(q){return{kind:"modulepreload",href:q}}function Nq(q,Q){return Q?{kind:"style",href:q,media:Q}:{kind:"style",href:q}}async function Sq(q,Q){return(await O(N(q,Q))).markup}async function yq(q,Q){return O(N(q,Q))}async function hq(q,Q){return a(await O(N(q,Q)))}async function Mq(q,Q){return o(await O(N(q,Q)))}async function O(q){return k(z(),async()=>{let Q=q.environment??y1(),R=D(A0(q.ssrContext));try{let $="component"in q?q.component:await q.load(),Z=new $;L(Z,"ssr"),V0(Q,Z,q.authoredContent,q.prepareHost),q.initialize?.(Z);let F=q.clientModuleSrc??await q.resolveClientModuleSrc?.($),J=q.assets??await q.resolveAssets?.($)??[],f=k0(J,F),P=I0(f)??F,S=q.tagName??z0($),A=(q.now??i)().toISOString(),n=D0(q.renderOptions),t=u(Z,n)??T0(Z,n),M1=x0(Z,t);return{markup:t,metadata:{assets:f,clientModuleUrl:P,generatedAt:A,tagName:S},preview:M1}}finally{R()}})}function x0(q,Q){return c(q,Q)??d(q)??q.renderHost?.()??{nodeType:1,outerHTML:Q}}function V0(q,Q,R,$){if(!C0(Q)){if(R===void 0&&$===void 0)return;throw Error(`${Q.constructor.name} cannot prepare SSR host content because it does not expose an innerHTML host surface.`)}q.prepareHost(Q,{authoredContent:R}),$?.(Q,q)}function A0(q){if(!q||q.length===0)return[];return q.map((Q)=>({getContext:()=>Q.value,getContextKey:()=>Q.context,renderHydrationScript:()=>{return},renderHydrationScriptTag:()=>{return}}))}function L0(q){if(!q)return[];return[w0(q)]}function k0(q,Q){if(!Q)return q;if(q.some((R)=>R.kind==="script-module"&&R.src===Q))return q;return[...L0(Q),...q]}function I0(q){return q.find((Q)=>Q.kind==="script-module")?.src}function N(q,Q){if(typeof q==="function")return{...Q,component:q};return q}function D0(q){if(q?.mode!==void 0||q?.hydrate!==void 0)return q;return{...q,mode:"hydrate"}}function C0(q){return"innerHTML"in q}function T0(q,Q){if(typeof q.renderHostToString==="function")return q.renderHostToString(Q);throw Error(`${q.constructor.name} cannot be server-rendered without a registered Radiant SSR host or renderHostToString().`)}function z0(q){let Q=I(q);if(!Q)throw Error(`${q.name} is missing @customElement metadata.`);return Q}export{o as toRenderedComponentWithPreview,a as toRenderedComponentPayload,Nq as styleAsset,w0 as scriptModuleAsset,I0 as resolvePrimaryClientModuleSrc,Mq as renderComponentWithPreview,Sq as renderComponentToString,hq as renderComponentToPayload,yq as renderComponent,D0 as normalizeRenderOptions,Oq as modulePreloadAsset,k0 as mergeRenderedComponentAssets,i as createDefaultRenderTimestamp};
|
|
2
2
|
|
|
3
|
-
//# debugId=
|
|
3
|
+
//# debugId=750AC485A4F3874264756E2164756E21
|