@ecopages/radiant 0.3.0-alpha.11 → 0.3.0-alpha.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (140) hide show
  1. package/dist/context/decorators/consume-context.js +2 -2
  2. package/dist/context/decorators/consume-context.js.map +4 -4
  3. package/dist/context/decorators/context-selector.js +2 -2
  4. package/dist/context/decorators/context-selector.js.map +5 -5
  5. package/dist/context/decorators/legacy/consume-context.js +2 -2
  6. package/dist/context/decorators/legacy/consume-context.js.map +4 -4
  7. package/dist/context/decorators/legacy/context-selector-field.js +2 -2
  8. package/dist/context/decorators/legacy/context-selector-field.js.map +4 -4
  9. package/dist/context/decorators/legacy/context-selector.js +2 -2
  10. package/dist/context/decorators/legacy/context-selector.js.map +4 -4
  11. package/dist/context/decorators/legacy/provide-context.js +2 -2
  12. package/dist/context/decorators/legacy/provide-context.js.map +4 -4
  13. package/dist/context/decorators/on-context-update.js +2 -2
  14. package/dist/context/decorators/on-context-update.js.map +4 -4
  15. package/dist/context/decorators/provide-context.js +2 -2
  16. package/dist/context/decorators/provide-context.js.map +4 -4
  17. package/dist/context/index.js +2 -2
  18. package/dist/context/index.js.map +9 -9
  19. package/dist/core/radiant-controller.d.ts +31 -4
  20. package/dist/core/radiant-controller.js +2 -2
  21. package/dist/core/radiant-controller.js.map +10 -6
  22. package/dist/core/radiant-element-ssr-host.d.ts +23 -0
  23. package/dist/core/radiant-element-ssr-host.js +3 -0
  24. package/dist/core/radiant-element-ssr-host.js.map +10 -0
  25. package/dist/core/radiant-element-ssr-registry.d.ts +45 -0
  26. package/dist/core/radiant-element-ssr-registry.js +3 -0
  27. package/dist/core/radiant-element-ssr-registry.js.map +10 -0
  28. package/dist/core/{radiant-component-ssr.d.ts → radiant-element-ssr-service.d.ts} +3 -4
  29. package/dist/core/{radiant-component-ssr.js → radiant-element-ssr-service.js} +2 -2
  30. package/dist/core/{radiant-component-ssr.js.map → radiant-element-ssr-service.js.map} +4 -4
  31. package/dist/core/radiant-element.d.ts +17 -124
  32. package/dist/core/radiant-element.js +2 -2
  33. package/dist/core/radiant-element.js.map +15 -10
  34. package/dist/core/reactive-host.d.ts +1 -1
  35. package/dist/core/reactive-host.js +2 -2
  36. package/dist/core/reactive-host.js.map +7 -4
  37. package/dist/core/reactive-jsx-value.d.ts +2 -1
  38. package/dist/core/reactive-jsx-value.js.map +2 -2
  39. package/dist/core/reactive-prop-core.d.ts +42 -0
  40. package/dist/core/reactive-prop-core.js +3 -0
  41. package/dist/core/reactive-prop-core.js.map +11 -0
  42. package/dist/core/reactive-prop-metadata.d.ts +1 -1
  43. package/dist/core/reactive-prop-metadata.js +2 -2
  44. package/dist/core/reactive-prop-metadata.js.map +2 -2
  45. package/dist/core/reactivity-adapter.d.ts +8 -0
  46. package/dist/core/reactivity-adapter.js +3 -0
  47. package/dist/core/reactivity-adapter.js.map +12 -0
  48. package/dist/core/reactivity-contract.d.ts +39 -0
  49. package/dist/core/reactivity-contract.js +2 -0
  50. package/dist/core/reactivity-contract.js.map +9 -0
  51. package/dist/core/reactivity-runtime.d.ts +18 -0
  52. package/dist/core/reactivity-runtime.js +3 -0
  53. package/dist/core/reactivity-runtime.js.map +11 -0
  54. package/dist/core/reactivity-signals.d.ts +10 -0
  55. package/dist/core/reactivity-signals.js +3 -0
  56. package/dist/core/reactivity-signals.js.map +10 -0
  57. package/dist/core/render-runtime.d.ts +29 -0
  58. package/dist/core/render-runtime.js +3 -0
  59. package/dist/core/render-runtime.js.map +16 -0
  60. package/dist/core/slot-projection-runtime.js +2 -2
  61. package/dist/core/slot-projection-runtime.js.map +3 -3
  62. package/dist/decorators/attr.js +2 -2
  63. package/dist/decorators/attr.js.map +6 -5
  64. package/dist/decorators/event.js +2 -2
  65. package/dist/decorators/event.js.map +3 -3
  66. package/dist/decorators/legacy/attr.js +2 -2
  67. package/dist/decorators/legacy/attr.js.map +6 -5
  68. package/dist/decorators/legacy/event.js +2 -2
  69. package/dist/decorators/legacy/event.js.map +3 -3
  70. package/dist/decorators/legacy/instance-initializers.d.ts +16 -0
  71. package/dist/decorators/legacy/instance-initializers.js +2 -2
  72. package/dist/decorators/legacy/instance-initializers.js.map +3 -3
  73. package/dist/decorators/legacy/on-event.js +2 -2
  74. package/dist/decorators/legacy/on-event.js.map +3 -3
  75. package/dist/decorators/legacy/on-updated.js +2 -2
  76. package/dist/decorators/legacy/on-updated.js.map +3 -3
  77. package/dist/decorators/legacy/query-slot.js +2 -2
  78. package/dist/decorators/legacy/query-slot.js.map +3 -3
  79. package/dist/decorators/legacy/query.js +2 -2
  80. package/dist/decorators/legacy/query.js.map +3 -3
  81. package/dist/decorators/legacy/reactive-field.js +2 -2
  82. package/dist/decorators/legacy/reactive-field.js.map +3 -3
  83. package/dist/decorators/legacy/reactive-prop.d.ts +1 -1
  84. package/dist/decorators/legacy/reactive-prop.js +2 -2
  85. package/dist/decorators/legacy/reactive-prop.js.map +7 -6
  86. package/dist/decorators/legacy/signal.d.ts +1 -1
  87. package/dist/decorators/legacy/signal.js +2 -2
  88. package/dist/decorators/legacy/signal.js.map +4 -4
  89. package/dist/decorators/on-event.js +2 -2
  90. package/dist/decorators/on-event.js.map +3 -3
  91. package/dist/decorators/on-updated.js +2 -2
  92. package/dist/decorators/on-updated.js.map +3 -3
  93. package/dist/decorators/prop.d.ts +1 -1
  94. package/dist/decorators/prop.js +2 -2
  95. package/dist/decorators/prop.js.map +9 -8
  96. package/dist/decorators/query-slot.js +2 -2
  97. package/dist/decorators/query-slot.js.map +3 -3
  98. package/dist/decorators/query.js +2 -2
  99. package/dist/decorators/query.js.map +3 -3
  100. package/dist/decorators/shared/reactive-attr.d.ts +1 -1
  101. package/dist/decorators/shared/reactive-attr.js +2 -2
  102. package/dist/decorators/shared/reactive-attr.js.map +5 -4
  103. package/dist/decorators/signal.js +2 -2
  104. package/dist/decorators/signal.js.map +5 -5
  105. package/dist/decorators/standard/attr.js +2 -2
  106. package/dist/decorators/standard/attr.js.map +5 -4
  107. package/dist/decorators/standard/reactive-prop.d.ts +1 -1
  108. package/dist/decorators/standard/reactive-prop.js +2 -2
  109. package/dist/decorators/standard/reactive-prop.js.map +6 -5
  110. package/dist/decorators/standard/signal.d.ts +1 -1
  111. package/dist/decorators/standard/signal.js.map +1 -1
  112. package/dist/decorators/state.js +2 -2
  113. package/dist/decorators/state.js.map +3 -3
  114. package/dist/index.js +2 -2
  115. package/dist/index.js.map +23 -18
  116. package/dist/package.json +3 -3
  117. package/dist/server/radiant-element-ssr-bridge.d.ts +21 -0
  118. package/dist/server/radiant-element-ssr-bridge.js +3 -0
  119. package/dist/server/radiant-element-ssr-bridge.js.map +19 -0
  120. package/dist/server/radiant-element-ssr-extractor.d.ts +3 -0
  121. package/dist/server/radiant-element-ssr-extractor.js +3 -0
  122. package/dist/server/radiant-element-ssr-extractor.js.map +12 -0
  123. package/dist/server/radiant-element-ssr-runtime.d.ts +1 -0
  124. package/dist/server/radiant-element-ssr-runtime.js +3 -0
  125. package/dist/server/radiant-element-ssr-runtime.js.map +19 -0
  126. package/dist/server/render-component.d.ts +2 -2
  127. package/dist/server/render-component.js +2 -2
  128. package/dist/server/render-component.js.map +11 -8
  129. package/dist/server/render-controller.js +2 -2
  130. package/dist/server/render-controller.js.map +12 -9
  131. package/dist/server/slot-projection-html.js +2 -2
  132. package/dist/server/slot-projection-html.js.map +3 -3
  133. package/package.json +1 -1
  134. package/size-budget.json +2 -2
  135. package/dist/core/radiant-component-ssr-registry.d.ts +0 -54
  136. package/dist/core/radiant-component-ssr-registry.js +0 -3
  137. package/dist/core/radiant-component-ssr-registry.js.map +0 -10
  138. package/dist/server/radiant-component-ssr-runtime.d.ts +0 -9
  139. package/dist/server/radiant-component-ssr-runtime.js +0 -3
  140. package/dist/server/radiant-component-ssr-runtime.js.map +0 -17
@@ -3,9 +3,9 @@ import { type JsxRenderable, type SubscribableJsxValue } from '@ecopages/jsx';
3
3
  import type { RenderToStringOptions } from '@ecopages/jsx/server';
4
4
  import type { SsrSerializableContextProvider } from '../context/context-provider';
5
5
  import type { UnknownContext } from '../context/types';
6
+ import { type ReactiveBindingOption, type ReactiveBindingValue, type ReactiveBindings, type ReactiveFieldOptions, type ReactiveProperty, type ReactivePropertyOptions } from './reactive-prop-core';
6
7
  import type { SsrSerializableHydrationBinding } from './ssr-hydration-binding';
7
- import { type RadiantElementRenderBridge } from './radiant-component-ssr-registry';
8
- import { type AttributeTypeConstant, type ReadAttributeValueReturnType, type WriteAttributeValueReturnType } from '../utils/attribute-utils';
8
+ export type { ReactiveBindingOption, ReactiveBindingValue, ReactiveBindings, ReactiveField, ReactiveFieldOptions, ReactiveProperty, ReactivePropertyOptions, } from './reactive-prop-core';
9
9
  declare const RadiantElementBase: {
10
10
  new (): HTMLElement;
11
11
  prototype: HTMLElement;
@@ -24,79 +24,7 @@ export type RadiantElementEventListener = {
24
24
  listener: EventListener;
25
25
  options?: AddEventListenerOptions;
26
26
  };
27
- /**
28
- * Represents a property metadata object.
29
- */
30
- export interface ReactiveProperty<T = unknown> {
31
- type: AttributeTypeConstant;
32
- value?: T;
33
- initialValue?: T;
34
- name: string;
35
- attribute: string;
36
- converter: {
37
- fromAttribute: (value: string) => ReadAttributeValueReturnType;
38
- toAttribute: (value: any) => WriteAttributeValueReturnType;
39
- };
40
- }
41
- /**
42
- * Represents the options for a reactive property.
43
- */
44
- export type ReactivePropertyOptions<T> = {
45
- type: AttributeTypeConstant;
46
- reflect?: boolean;
47
- attribute?: string;
48
- defaultValue?: T;
49
- /**
50
- * Exposes a JSX binding companion for the reactive property.
51
- *
52
- * - `true` creates a `$propertyName` accessor.
53
- * - a string creates a custom accessor with that name.
54
- * - `undefined` defers to the host default.
55
- *
56
- * The generated accessor returns a subscribable JSX child value so JSX can
57
- * patch only the affected child part when the property changes.
58
- */
59
- bind?: boolean | string;
60
- };
61
- export type ReactiveBindingOption = boolean | string;
62
- export type ReactiveFieldOptions = {
63
- /**
64
- * Exposes a JSX binding companion for the reactive field.
65
- *
66
- * - `true` creates a `$fieldName` accessor.
67
- * - a string creates a custom accessor with that name.
68
- * - `undefined` defers to the host default.
69
- */
70
- bind?: ReactiveBindingOption;
71
- };
72
- export type ReactiveField<T = unknown> = {
73
- name: string;
74
- value: T;
75
- initialValue: T;
76
- };
77
27
  type StringPropertyKey<Value> = Extract<keyof Value, string>;
78
- /**
79
- * Value type produced by a JSX binding for a selected reactive member.
80
- *
81
- * Bindings preserve the original property type when it is already renderable by
82
- * the Ecopages JSX runtime. For non-renderable values, the binding falls back
83
- * to the broader `JsxRenderable` contract consumed by the renderer.
84
- */
85
- export type ReactiveBindingValue<Host extends object, Property extends StringPropertyKey<Host>> = Host[Property] extends JsxRenderable ? Host[Property] : JsxRenderable;
86
- /**
87
- * Namespace of cached JSX bindings keyed by the explicit bindable shape.
88
- *
89
- * Radiant exposes this namespace twice on every host:
90
- *
91
- * - `host.bindings.key` for the explicit form
92
- * - `host.$.key` for the short form
93
- *
94
- * Both aliases resolve through the same cached binding objects as
95
- * `host.bind('key')`.
96
- */
97
- export type ReactiveBindings<Bindings extends object> = {
98
- readonly [Property in StringPropertyKey<Bindings>]: SubscribableJsxValue<ReactiveBindingValue<Bindings, Property>>;
99
- };
100
28
  /**
101
29
  * Represents an interface for a Radiant element.
102
30
  * @typeParam Bindings - Explicit internal bindable shape used to type `bind()` and `getReactiveBinding()`.
@@ -238,10 +166,7 @@ export declare class RadiantElement<Bindings extends object = {}> extends Radian
238
166
  readonly bindings: ReactiveBindings<Bindings>;
239
167
  readonly $: ReactiveBindings<Bindings>;
240
168
  private readonly reactiveHost;
241
- /**
242
- * A map of property metadata objects, it contains useful information about the properties configured via decorators.
243
- */
244
- private reactiveProperties;
169
+ private readonly reactivePropertyState;
245
170
  /**
246
171
  * Registered context providers keyed by decorated property name.
247
172
  */
@@ -266,33 +191,13 @@ export declare class RadiantElement<Bindings extends object = {}> extends Radian
266
191
  private isFirstConnectPending;
267
192
  private isRenderScheduled;
268
193
  private needsRender;
269
- /**
270
- * Snapshot of own-property values that existed before Radiant installs the
271
- * reactive accessors for declared props.
272
- *
273
- * "Pre-upgrade" refers to the custom-element upgrade window where user code,
274
- * SSR boot code, or another framework assigns `element.someProp = value`
275
- * before the browser has finished constructing the final custom-element class
276
- * instance with its accessors in place.
277
- *
278
- * Those early assignments land as plain own properties on the element. If we
279
- * define a reactive accessor later without first capturing them, the accessor
280
- * would either miss the assigned value or remain shadowed by the own property.
281
- * `createReactiveProp()` consumes this snapshot so the early value becomes the
282
- * prop's initial reactive state.
283
- */
284
- private readonly preUpgradePropertyValues;
285
- private projectedSlotContent;
286
- private renderSignal?;
287
- private readonly renderWatcher;
288
- private slotProjectionObserver?;
289
- private slotProjectionVersion;
194
+ private renderRuntime?;
290
195
  constructor();
196
+ get slotProjectionVersion(): number;
291
197
  connectedCallback(): void;
292
198
  connectedContextCallback(_contextName: UnknownContext): void;
293
199
  disconnectedCallback(): void;
294
200
  notifyUpdate(changedProperty: string, oldValue: unknown, value: unknown): void;
295
- private transformAttributeValue;
296
201
  attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
297
202
  /**
298
203
  * Renders a trusted HTML template string into the specified target element.
@@ -309,19 +214,17 @@ export declare class RadiantElement<Bindings extends object = {}> extends Radian
309
214
  sanitize?: (html: string) => string;
310
215
  }): void;
311
216
  render(): JsxRenderable;
312
- renderToString(options?: RenderToStringOptions): string;
313
- renderHost(): JsxRenderable;
314
- renderHostToString(options?: RenderToStringOptions): string;
217
+ renderViewToString(options?: RenderToStringOptions): string;
315
218
  hydrate(): void;
316
219
  requestUpdate(): void;
317
220
  update(): void;
318
221
  registerReactiveProperty(config: ReactiveProperty): void;
319
- protected getReactiveProperties(): ReactiveProperty[];
222
+ getReactiveProperties(): ReactiveProperty[];
320
223
  registerReactiveDependencyReader(property: string, read: () => unknown): void;
321
224
  registerContextProvider(name: string, provider: SsrSerializableContextProvider): void;
322
225
  registerHydrationBinding(name: string, binding: SsrSerializableHydrationBinding): void;
323
- protected getContextProviders(): SsrSerializableContextProvider[];
324
- protected getHydrationBindings(): SsrSerializableHydrationBinding[];
226
+ getContextProviders(): SsrSerializableContextProvider[];
227
+ getHydrationBindings(): SsrSerializableHydrationBinding[];
325
228
  /**
326
229
  * Flushes any deferred SSR-only preparation work before the host is
327
230
  * serialized.
@@ -344,8 +247,6 @@ export declare class RadiantElement<Bindings extends object = {}> extends Radian
344
247
  protected shouldRunRenderLifecycle(): boolean;
345
248
  /** Returns the DOM root used by client-side render and hydrate work. */
346
249
  protected getRenderTarget(): RadiantRenderTarget;
347
- protected getHostSsrAttributes(): Record<string, string>;
348
- protected resolveSsrRenderBridge(): RadiantElementRenderBridge;
349
250
  registerUpdateCallback(property: string, update: (...rest: any[]) => any): () => void;
350
251
  getReactiveBinding<Property extends StringPropertyKey<Bindings>>(property: Property): SubscribableJsxValue<ReactiveBindingValue<Bindings, Property>>;
351
252
  bind<Property extends StringPropertyKey<Bindings>>(property: Property): SubscribableJsxValue<ReactiveBindingValue<Bindings, Property>>;
@@ -381,20 +282,12 @@ export declare class RadiantElement<Bindings extends object = {}> extends Radian
381
282
  * writes survive into the reactive lifecycle.
382
283
  */
383
284
  createReactiveProp<T = unknown>(propertyName: string, options: ReactivePropertyOptions<T>): void;
384
- private ensureSlotProjectionState;
385
- private getHostChildNodeCount;
386
- private getSlotProjectionScriptTag;
387
- private getAuthoredHydrationScriptMarkup;
388
- private handleSlotProjectionMutations;
389
- private addProjectedSlotNode;
390
- private removeProjectedSlotNode;
391
- private observeSlotProjection;
392
- private disconnectSlotProjectionObserver;
393
- private disconnectRenderWatcher;
394
- private resolveTrackedRenderOutput;
395
- private resolveRenderOutput;
396
- private getEventSubscriptionTarget;
397
- private getQueryRoot;
398
- private assertSupportsHostSsrRendering;
285
+ getSlotProjectionScriptTag(): string | undefined;
286
+ getAuthoredHydrationScriptMarkup(): string | undefined;
287
+ resolveTrackedRenderOutput(): {
288
+ containsSlots: boolean;
289
+ value: JsxRenderable;
290
+ };
291
+ private getOrCreateRenderRuntime;
292
+ private resolveRenderSurface;
399
293
  }
400
- export {};
@@ -1,3 +1,3 @@
1
- var h0=((Q)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(Q,{get:($,W)=>(typeof require<"u"?require:$)[W]}):Q)(function(Q){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+Q+'" is not supported')});var D=Symbol.for("@ecopages/radiant.legacy-instance-initializers");function f0(Q,$){let X=Q[D];if(Array.isArray(X)){X.push($);return}Object.defineProperty(Q,D,{value:[$],configurable:!0})}function _(Q){let $=[],W=Object.getPrototypeOf(Q);while(W&&W!==Object.prototype)$.push(W),W=Object.getPrototypeOf(W);for(let X=$.length-1;X>=0;X-=1){let Z=$[X][D];if(!Array.isArray(Z))continue;for(let q of Z)q(Q)}}import{createSubscribableJsxValue as W0}from"@ecopages/jsx";import{trackDependency as C}from"@ecopages/signals";class I{read;subscribers=new Set;watcherListeners=new Set;version=0;constructor(Q){this.read=Q}get(){return C(this),this.read()}subscribe(Q){return this.subscribers.add(Q),()=>{this.subscribers.delete(Q)}}addWatcher(Q){return this.watcherListeners.add(Q),()=>{this.watcherListeners.delete(Q)}}getVersion(){return this.version}notify(Q){this.version+=1;let $;try{this.notifyWatchers()}catch(W){$=W}if(this.publish(Q),$)throw $}publish(Q){for(let $ of this.subscribers)$(Q)}notifyWatchers(){let Q=[];for(let $ of this.watcherListeners)try{$()}catch(W){Q.push(W)}if(Q.length===1)throw Q[0];if(Q.length>1)throw AggregateError(Q,"Multiple reactive dependency notifications failed.")}}function X0(Q){return typeof Q==="object"&&Q!==null&&typeof Q.get==="function"}class w{host;access;shouldAutoBind;bindings;$;reactiveFields=new Map;reactiveDependencies=new Map;reactiveDependencyReaders=new Map;reactiveBindings=new Map;updateCallbacks=new Map;onConnectedCallbacks=[];onDisconnectedCallback=[];constructor(Q,$,W){this.host=Q;this.access=$;this.shouldAutoBind=W;let X=this.createReactiveBindingNamespace();this.bindings=X,this.$=X}connectHost(){for(let Q of this.onConnectedCallbacks)Q()}disconnectHost(){for(let Q of this.onDisconnectedCallback)Q()}notifyUpdate(Q,$,W){if($===W)return;this.reactiveDependencies.get(Q)?.notify(W);let X=this.updateCallbacks.get(Q);if(X)for(let Z of X)Z()}registerCleanupCallback(Q){this.onDisconnectedCallback.push(Q)}registerConnectedCallback(Q){this.onConnectedCallbacks.push(Q)}registerHydrationBinding(Q,$){}registerReactiveDependencyReader(Q,$){this.reactiveDependencyReaders.set(Q,$)}registerUpdateCallback(Q,$){if(!this.updateCallbacks.has(Q))this.updateCallbacks.set(Q,new Set);let W=this.updateCallbacks.get(Q);return W.add($),()=>{if(W.delete($),W.size===0)this.updateCallbacks.delete(Q)}}getReactiveBinding(Q){let $=this.reactiveBindings.get(Q);if($)return $;let W=W0({getValue:()=>this.readReactiveBindingValue(Q),subscribe:(X)=>this.registerUpdateCallback(Q,()=>{X(this.readReactiveBindingValue(Q))})});return this.reactiveBindings.set(Q,W),W}bind(Q){return this.getReactiveBinding(Q)}defineReactiveBinding(Q,$=!0){let W=typeof $==="string"?$:$?`$${Q}`:void 0,X=this.access.getBindingTarget?.(this.host)??this.host;if(!W||this.access.hasProperty(this.host,W))return;this.access.defineProperty(X,W,{get:()=>this.getReactiveBinding(Q),enumerable:!1,configurable:!0})}trackReactiveRead(Q){C(this.getReactiveDependency(Q))}defineReactiveAccessor(Q,$){let W=$.bind??this.shouldAutoBind();if(this.defineReactiveBinding(Q,W),this.registerReactiveDependencyReader(Q,$.getValue),this.access.defineProperty(this.host,Q,{get:()=>{return this.trackReactiveRead(Q),$.getValue()},set:(X)=>{let Z=$.getValue();if(Z===X)return;$.setValue(X),this.notifyUpdate(Q,Z,X)},enumerable:!0,configurable:!0}),$.notifyInitialValue!==void 0)this.notifyUpdate(Q,void 0,$.notifyInitialValue)}createReactiveField(Q,$,W={}){let X={name:Q,value:$,initialValue:$};this.reactiveFields.set(Q,X),this.defineReactiveAccessor(Q,{bind:W.bind,getValue:()=>this.reactiveFields.get(Q)?.value,setValue:(Z)=>{this.reactiveFields.set(Q,{...X,value:Z})},notifyInitialValue:$})}createReactiveBindingNamespace(){return new Proxy(Object.create(null),{get:(Q,$)=>{if(typeof $!=="string")return;return this.getReactiveBinding($)}})}getReactiveDependency(Q){let $=this.reactiveDependencies.get(Q);if($)return $;let W=new I(()=>this.readReactiveDependencyValue(Q));return this.reactiveDependencies.set(Q,W),W}readReactiveDependencyValue(Q){let $=this.reactiveDependencyReaders.get(Q);if($)return $();return this.readReactiveBindingValue(Q)}readReactiveBindingValue(Q){let $=this.access.readProperty(this.host,Q);if(X0($))return $.get();return $}}var L=Symbol.for("@ecopages/radiant.ssr-preparation-callbacks"),A=Symbol.for("@ecopages/radiant.ssr-preparation-running");function v0(Q,$){let X=Q[L];if(Array.isArray(X)){X.push($);return}Object.defineProperty(Q,L,{value:[$],configurable:!0})}function S(Q){let $=Q,W=$[L];if(!Array.isArray(W))return;$[A]=!0;try{for(let X of W)X()}finally{delete $[A]}}function R(Q){return Q.replace(/&/g,"\\u0026").replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}var F="data-hydration",T="data-hydration-type",O="data-hydration-key";function s0(Q){let $=Q.hydrationKey?` ${O}="${Z0(Q.hydrationKey)}"`:"";return`<script type="application/json" ${F} ${T}="${Q.type}"${$}>${Q.serializedValue}</script>`}function u0(Q){return R(Q)}function d0(Q,$){let W=Q.textContent;if(!W)return $;try{return JSON.parse(W)}catch{if(typeof console<"u")console.warn(`[@ecopages/radiant] Failed to parse hydration payload from <script ${F}>:`,W.slice(0,120));return $}}function i0(Q,$,W){let X=Q.children;if(!X||X.length===0){let Z=Q.childNodes;if(!Z||Z.length===0)return null;for(let q=0;q<Z.length;q+=1){let G=Z[q];if(G.nodeType!==1)continue;let M=G;if(h(M,$,W))return M}return null}for(let Z=0;Z<X.length;Z+=1)if(h(X[Z],$,W))return X[Z];return null}function h(Q,$,W){if(Q.tagName!=="SCRIPT"||!Q.hasAttribute(F)||Q.getAttribute(T)!==$)return!1;if(W!==void 0)return Q.getAttribute(O)===W;return!Q.hasAttribute(O)}function Z0(Q){return Q.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}import{createMarkupNodeLike as q0,isKeyedJsxValue as f,isSlotJsxValue as G0}from"@ecopages/jsx";var z="",H="data-radiant-slot-projection";function N(Q){let $=new Map;for(let W of Array.from(Q.childNodes)){if(z0(W))continue;J0($,M0(W),W)}return $}function V(Q){let $;try{$=JSON.parse(Q)}catch{if(typeof console<"u")console.warn("[@ecopages/radiant] Failed to parse slot projection payload:",Q.slice(0,120));return new Map}let W=new Map;for(let[X,Z]of Object.entries($)){if(!Array.isArray(Z)||Z.length===0)continue;W.set(P(X),Z.map((q)=>q0(q)))}return W}function g(Q){let $=Array.from(Q.childNodes).filter((W)=>s(W)).map((W)=>B(W)??"").filter((W)=>W!=="");return $.length>0?$.join(""):void 0}function m(Q){let $={};for(let[W,X]of Q.entries()){let Z=X.map((q)=>B(q)).filter((q)=>q!==void 0&&q!=="");if(Z.length>0)$[W]=Z}return Object.keys($).length>0?JSON.stringify($):void 0}function v(Q,$){let W=!1,X=(q)=>{if(G0(q))return W=!0,B0(q,$,X);if(f(q))return F0(q,X(q.value));if(U0(q))return{_$rType$:1,rootLocalName:q.rootLocalName,strings:q.strings,values:q.values.map((G)=>X(G))};if(c(q))return Array.from(q,(G)=>X(G));return q},Z=X(Q);return{containsSlots:W,value:Z}}function b(Q){for(let $ of Array.from(Q.childNodes)){if(!y($))continue;let W=$.textContent??void 0;return $.parentNode?.removeChild($),W}return}function J0(Q,$,W){let X=Q.get($);if(X){X.push(W);return}Q.set($,[W])}function F0(Q,$){return{...Q,value:$}}function M0(Q){if(Q instanceof Element)return P(Q.getAttribute("slot"));return z}function c(Q){return typeof Q!=="string"&&typeof Q==="object"&&Q!==null&&Symbol.iterator in Q}function y(Q){return Q instanceof HTMLScriptElement&&Q.hasAttribute(H)}function s(Q){return Q instanceof HTMLScriptElement&&Q.hasAttribute(F)}function z0(Q){return y(Q)||s(Q)}function U0(Q){return typeof Q==="object"&&Q!==null&&Q._$rType$===1&&Array.isArray(Q.strings)&&Array.isArray(Q.values)}function P(Q){return Q??z}function B(Q){if(Q===void 0||Q===null||Q===!1||Q===!0)return;if(typeof Node<"u"&&Q instanceof Node){if(Q.nodeType===Node.TEXT_NODE)return Q.textContent??"";return Q.outerHTML??Q.textContent??void 0}if(f(Q))return B(Q.value);if(typeof Q==="string"||typeof Q==="number"||typeof Q==="bigint")return String(Q);if(typeof Q==="object"&&Q!==null&&"outerHTML"in Q)return typeof Q.outerHTML==="string"?Q.outerHTML:Q.textContent??void 0;if(c(Q))return Array.from(Q,($)=>B($)??"").join("");return}function B0(Q,$,W){let X=$.get(P(Q.name));if(X&&X.length>0)return X.length===1?X[0]:X;if(Q.fallback===void 0)return"";return W(Q.fallback)}var E=Symbol.for("@ecopages/radiant.hydrator-installed");function a0(){globalThis[E]=!0}function r0(){delete globalThis[E]}function u(){return globalThis[E]===!0}var d=Symbol.for("@ecopages/radiant.component-ssr-runtime");function i(){return globalThis[d]}function e0(Q){globalThis[d]=Q}function o(Q){switch(Q){case Array:return"array";case Boolean:return"boolean";case Number:return"number";case Object:return"object";case String:return"string"}}function H0(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 Y0(Q){switch(Q){case Number:return 0;case String:return"";case Boolean:return!1;default:return null}}function K0(Q){try{return JSON.parse(Q)}catch{throw TypeError("Invalid JSON string")}}var j0={array(Q){let $=K0(Q);if(!Array.isArray($))throw TypeError(`Expected an array but got a value of type "${typeof $}"`);return $},boolean(Q){return!(Q==="0"||String(Q).toLowerCase()==="false")},number(Q){return Number(Q.replace(/_/g,""))},object(Q){let $=JSON.parse(Q);if($===null||typeof $!=="object"||Array.isArray($))throw TypeError(`expected value of type "object" but instead got value "${Q}" of type "${H0($)}"`);return $},string(Q){return Q}},p={default:n,array:l,object:l};function l(Q){return JSON.stringify(Q)}function n(Q){return`${Q}`}function Y(Q,$){let W=o($);if(!W)throw TypeError(`[radiant-element] Unknown type "${$}"`);return j0[W](Q)}function a(Q,$){let W=o($);if(!W)throw TypeError(`[radiant-element] Unknown type "${$}"`);return(p[W]??p.default??n)(Q)}function x0(Q){return typeof Q==="boolean"}function D0(Q){return typeof Q==="number"}function w0(Q){return typeof Q==="string"}function L0(Q){return Array.isArray(Q)}function O0(Q){return typeof Q==="object"&&!Array.isArray(Q)&&Q!==null}function r(Q,$){switch(Q){case Boolean:return x0($);case Number:return D0($);case String:return w0($);case Array:return L0($);case Object:return O0($);default:return!1}}var t=(Q,$,W,X)=>{if($===Boolean){let q=Q.getAttribute(W);if(q===null)return X;return q===""?!0:Y(q,$)}let Z=Q.getAttribute(W);return Z!==null?Y(Z,$):X??Y0($)};import{hasHydrationMarkers as P0,hydrate as E0,jsx as k0,render as _0}from"@ecopages/jsx";import{Computed as C0,subtle as I0}from"@ecopages/signals";var A0=S0();function S0(){if(typeof HTMLElement<"u")return HTMLElement;throw Error("RadiantElement requires HTMLElement. Install '@ecopages/radiant/server/light-dom-shim' before importing Radiant components in SSR.")}class j extends A0{renderRootMode="light";bindings;$;reactiveHost;reactiveProperties=new Map;contextProviders=new Map;hydrationBindings=new Map;eventSubscriptions=new Map;eventEmitters=new Map;elementReady=!1;isRendering=!1;isFirstConnectPending=!1;isRenderScheduled=!1;needsRender=!1;preUpgradePropertyValues=new Map;projectedSlotContent=new Map;renderSignal;renderWatcher=new I0.Watcher(()=>{this.requestUpdate()});slotProjectionObserver;slotProjectionVersion=0;constructor(){super();for(let Q of Object.getOwnPropertyNames(this))this.preUpgradePropertyValues.set(Q,this[Q]);this.reactiveHost=new w(this,{defineProperty:(Q,$,W)=>Object.defineProperty(Q,$,W),getBindingTarget:(Q)=>Object.getPrototypeOf(Q)??Q,hasProperty:(Q,$)=>($ in Q),readProperty:(Q,$)=>Q[$]},()=>this.shouldAutoBindReactiveMembers()),this.bindings=this.reactiveHost.bindings,this.$=this.reactiveHost.$,_(this)}connectedCallback(){let Q=this.isFirstConnectPending;if(this.elementReady=!0,this.reactiveHost.connectHost(),Q)return;this.isFirstConnectPending=!0,queueMicrotask(()=>{if(this.isFirstConnectPending=!1,!this.isConnected)return;if(!this.shouldRunRenderLifecycle())return;if(this.ensureSlotProjectionState(),this.observeSlotProjection(),e(this)){if(this.needsRender=!1,this.hydrate(),this.needsRender)this.update();return}this.update()})}connectedContextCallback(Q){}disconnectedCallback(){this.disconnectSlotProjectionObserver(),this.disconnectRenderWatcher(),this.removeAllSubscribedEvents(),this.reactiveHost.disconnectHost()}notifyUpdate(Q,$,W){this.reactiveHost.notifyUpdate(Q,$,W)}transformAttributeValue(Q,$){return Q!==null?$?.converter.fromAttribute(Q):Q}attributeChangedCallback(Q,$,W){if($===W||!this.elementReady)return;if(this.reactiveProperties.has(Q)){let X=this.reactiveProperties.get(Q),Z=this.transformAttributeValue(W,X),q=this.transformAttributeValue($,X),G=X?X.attribute:Q;this[G]=Z,this.notifyUpdate(Q,q,Z)}}renderTemplate({target:Q=this,template:$,insert:W="replace",sanitize:X}){let Z=X?X($):$;switch(W){case"replace":Q.innerHTML=Z;break;case"beforeend":Q.insertAdjacentHTML("beforeend",Z);break;case"afterbegin":Q.insertAdjacentHTML("afterbegin",Z);break;case"beforebegin":Q.insertAdjacentHTML("beforebegin",Z);break;case"afterend":Q.insertAdjacentHTML("afterend",Z);break}}render(){return k0("slot",{})}renderToString(Q={}){if(!this.shouldRunRenderLifecycle())return this.innerHTML;return this.prepareForSsr(),K().renderView(this,Q)}renderHost(){return this.assertSupportsHostSsrRendering(),K().renderHost(this)}renderHostToString(Q={}){return this.assertSupportsHostSsrRendering(),K().renderHostToString(this,Q)}hydrate(){if(!this.shouldRunRenderLifecycle()||!this.isConnected||this.isRendering)return;let Q=this.getRenderTarget();this.isRendering=!0,this.disconnectSlotProjectionObserver();try{E0(this.resolveTrackedRenderOutput().value,Q)}finally{this.isRendering=!1,this.observeSlotProjection()}}requestUpdate(){if(!this.shouldRunRenderLifecycle())return;if(this.needsRender=!0,this.isRenderScheduled)return;this.isRenderScheduled=!0,queueMicrotask(()=>{if(this.isRenderScheduled=!1,!this.needsRender)return;this.update()})}update(){if(!this.shouldRunRenderLifecycle())return;let Q=this.getRenderTarget();if(this.needsRender=!0,!this.isConnected||this.isRendering)return;if(this.isFirstConnectPending&&e(this))return;while(this.needsRender&&this.isConnected){this.needsRender=!1,this.isRendering=!0,this.disconnectSlotProjectionObserver();try{_0(this.resolveTrackedRenderOutput().value,Q)}finally{this.isRendering=!1,this.observeSlotProjection()}}}registerReactiveProperty(Q){this.reactiveProperties.set(Q.name,Q)}getReactiveProperties(){return Array.from(this.reactiveProperties.values())}registerReactiveDependencyReader(Q,$){this.reactiveHost.registerReactiveDependencyReader(Q,$)}registerContextProvider(Q,$){this.contextProviders.set(Q,$),this.registerHydrationBinding(Q,$)}registerHydrationBinding(Q,$){this.hydrationBindings.set(Q,$)}getContextProviders(){return Array.from(this.contextProviders.values())}getHydrationBindings(){return Array.from(this.hydrationBindings.values())}prepareForSsr(){S(this)}shouldAutoBindReactiveMembers(){return!0}shouldRunRenderLifecycle(){return this.render!==j.prototype.render}getRenderTarget(){if(this.renderRootMode!=="shadow")return this;if(this.shadowRoot)return this.shadowRoot;if(typeof this.attachShadow!=="function")throw Error("RadiantElement shadow render mode requires attachShadow().");return this.attachShadow({mode:"open"})}getHostSsrAttributes(){return K().getHostAttributes(this)}resolveSsrRenderBridge(){let Q={};if(this.renderHostToString===j.prototype.renderHostToString)Q.renderHostToString=($)=>this.renderHostToString($);if(this.renderHost===j.prototype.renderHost)Q.renderHost=()=>this.renderHost();return Q}registerUpdateCallback(Q,$){return this.reactiveHost.registerUpdateCallback(Q,$)}getReactiveBinding(Q){return this.reactiveHost.getReactiveBinding(Q)}bind(Q){return this.reactiveHost.bind(Q)}defineReactiveBinding(Q,$=!0){this.reactiveHost.defineReactiveBinding(Q,$)}trackReactiveRead(Q){this.reactiveHost.trackReactiveRead(Q)}subscribeEvents(Q){let $=[];for(let W of Q)$.push(this.subscribeEvent(W));return $}subscribeEvent(Q){let $=this.getEventSubscriptionTarget(),W=(Z)=>{if(Z.target&&Z.target.matches(Q.selector))Q.listener.call(this,Z)},X=`${Q.type}:${Q.selector}`;return $.addEventListener(Q.type,W,Q.options),this.eventSubscriptions.set(X,{...Q,listener:W,target:$}),this.unsubscribeEvent.bind(this,X)}unsubscribeEvent(Q){let $=this.eventSubscriptions.get(Q);if($)$.target.removeEventListener($.type,$.listener,$.options),this.eventSubscriptions.delete(Q)}removeAllSubscribedEvents(){for(let Q of this.eventSubscriptions.values())Q.target.removeEventListener(Q.type,Q.listener,Q.options);this.eventSubscriptions.clear()}registerCleanupCallback(Q){this.reactiveHost.registerCleanupCallback(Q)}registerConnectedCallback(Q){this.reactiveHost.registerConnectedCallback(Q)}registerEventEmitter(Q,$){this.eventEmitters.set(Q,$)}getRef(Q,$=!1){let W=`[data-ref="${Q}"]`,X=this.getQueryRoot();if($)return Array.from(X.querySelectorAll(W));return X.querySelector(W)??null}getSlotElement(Q){return this.getSlotElements(Q)[0]??null}getSlotElements(Q){return this.ensureSlotProjectionState(),(this.projectedSlotContent.get(Q??z)??[]).filter(($)=>typeof Node<"u"&&$ instanceof Element)}createReactiveField(Q,$,W={}){this.reactiveHost.createReactiveField(Q,$,W)}createReactiveProp(Q,$){let{type:W,attribute:X,reflect:Z,defaultValue:q}=$,G=X??Q,M=this.preUpgradePropertyValues.has(Q),Q0=M?this.preUpgradePropertyValues.get(Q):void 0;if(q!==void 0&&!r(W,q))throw Error(`defaultValue does not match the expected type for ${W.name}`);let U=M?Q0:t(this,W,G,q);if(this.hasAttribute(G)&&(!Z||U==null||U===""))this.removeAttribute(G);if(M&&Object.prototype.hasOwnProperty.call(this,Q))Reflect.deleteProperty(this,Q);let x={type:W,name:Q,value:U,initialValue:U,attribute:G,converter:{fromAttribute:(J)=>Y(J,W),toAttribute:(J)=>a(J,W)}};this.registerReactiveProperty(x);let k=(J)=>{if(Z)if(J==null||J===""||J===!1)this.removeAttribute(G);else{let $0=x.converter.toAttribute(J);this.setAttribute(G,$0)}};if(this.reactiveHost.defineReactiveAccessor(Q,{bind:$.bind,getValue:()=>this.reactiveProperties.get(Q)?.value,setValue:(J)=>{this.reactiveProperties.set(Q,{...x,value:J}),k(J)}}),U!==void 0)queueMicrotask(()=>{let J=this.reactiveProperties.get(Q)?.value;if(J===void 0)return;k(J),this.notifyUpdate(Q,void 0,J)})}ensureSlotProjectionState(){if(this.projectedSlotContent.size>0)return;let Q=this.isConnected?b(this):void 0;if(typeof Q==="string"&&Q!==""){this.projectedSlotContent=V(Q),this.slotProjectionVersion+=1;return}if(this.getHostChildNodeCount()>0)this.projectedSlotContent=N(this),this.slotProjectionVersion+=1}getHostChildNodeCount(){return"childNodes"in this&&this.childNodes?this.childNodes.length:0}getSlotProjectionScriptTag(){this.ensureSlotProjectionState();let Q=m(this.projectedSlotContent);if(!Q)return;return`<script type="application/json" ${H}>${R0(Q)}</script>`}getAuthoredHydrationScriptMarkup(){let Q=g(this);if(Q)return Q;return}handleSlotProjectionMutations(Q){let $=!1;for(let W of Q){for(let X of Array.from(W.removedNodes))if(this.removeProjectedSlotNode(X))$=!0;for(let X of Array.from(W.addedNodes)){if(X.parentNode!==this)continue;if(this.addProjectedSlotNode(X))$=!0}}if($)this.slotProjectionVersion+=1,this.update()}addProjectedSlotNode(Q){if(Q instanceof HTMLScriptElement&&(Q.hasAttribute(H)||Q.hasAttribute(F)))return!1;let $=Q instanceof Element?Q.getAttribute("slot")??z:z,W=this.projectedSlotContent.get($);if(W){if(W.includes(Q))return!1;return W.push(Q),!0}return this.projectedSlotContent.set($,[Q]),!0}removeProjectedSlotNode(Q){for(let[$,W]of this.projectedSlotContent.entries()){let X=W.indexOf(Q);if(X===-1)continue;if(W.splice(X,1),W.length===0)this.projectedSlotContent.delete($);return!0}return!1}observeSlotProjection(){if(typeof MutationObserver>"u"||this.slotProjectionObserver||!this.isConnected)return;this.slotProjectionObserver=new MutationObserver((Q)=>this.handleSlotProjectionMutations(Q)),this.slotProjectionObserver.observe(this,{childList:!0})}disconnectSlotProjectionObserver(){this.slotProjectionObserver?.disconnect(),this.slotProjectionObserver=void 0}disconnectRenderWatcher(){if(!this.renderSignal)return;this.renderWatcher.unwatch(this.renderSignal),this.renderSignal=void 0}resolveTrackedRenderOutput(){let Q=new C0(()=>this.resolveRenderOutput()),$=Q.get();if(!this.isConnected)return $;if(this.renderSignal)this.renderWatcher.unwatch(this.renderSignal);return this.renderSignal=Q,this.renderWatcher.watch(Q),$}resolveRenderOutput(){return this.ensureSlotProjectionState(),v(this.render(),this.projectedSlotContent)}getEventSubscriptionTarget(){let Q=this.getRenderTarget();return Q instanceof ShadowRoot?Q:this}getQueryRoot(){let Q=this.getRenderTarget();return Q instanceof ShadowRoot?Q:this}assertSupportsHostSsrRendering(){if(this.renderRootMode==="shadow")throw Error("RadiantElement shadow render mode does not support renderHost() or renderHostToString().")}}function K(){let Q=i();if(!Q)throw Error("Radiant SSR runtime is unavailable. Import `@ecopages/radiant/server/render-component` before using instance SSR methods.");return Q}function e(Q){return u()&&P0(Q)}function R0(Q){return Q.replace(/</g,"\\u003c")}export{j as RadiantElement};
1
+ var r0=(($)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy($,{get:(Q,X)=>(typeof require<"u"?require:Q)[X]}):$)(function($){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+$+'" is not supported')});var I=Symbol.for("@ecopages/radiant.legacy-instance-initializers"),R=Symbol.for("@ecopages/radiant.legacy-post-construction-initializers"),K0=Symbol.for("@ecopages/radiant.legacy-executed-post-construction-initializers");function e0($,Q){f($,I,Q)}function $2($,Q){f($,R,Q)}function T($){O($,I)}function H($){let Q=$;O($,R,Q[K0]??=new Set)}function f($,Q,X){let q=$,Z=Object.prototype.hasOwnProperty.call(q,Q)?q[Q]:void 0;if(Array.isArray(Z)){Z.push(X);return}Object.defineProperty(q,Q,{value:[X]})}function O($,Q,X,q=Object.getPrototypeOf($)){if(!q||q===Object.prototype)return;O($,Q,X,Object.getPrototypeOf(q));let Z=q[Q];if(!Array.isArray(Z))return;for(let W of Z){if(X?.has(W))continue;W($),X?.add(W)}}function V($){switch($){case Array:return"array";case Boolean:return"boolean";case Number:return"number";case Object:return"object";case String:return"string"}}function w0($){switch(typeof $){case"boolean":return"boolean";case"number":return"number";case"string":return"string"}if(Array.isArray($))return"array";if(Object.prototype.toString.call($)==="[object Object]")return"object"}function D0($){switch($){case Number:return 0;case String:return"";case Boolean:return!1;default:return null}}function z0($){try{return JSON.parse($)}catch{throw TypeError("Invalid JSON string")}}var L0={array($){let Q=z0($);if(!Array.isArray(Q))throw TypeError(`Expected an array but got a value of type "${typeof Q}"`);return Q},boolean($){return!($==="0"||String($).toLowerCase()==="false")},number($){return Number($.replace(/_/g,""))},object($){let Q=JSON.parse($);if(Q===null||typeof Q!=="object"||Array.isArray(Q))throw TypeError(`expected value of type "object" but instead got value "${$}" of type "${w0(Q)}"`);return Q},string($){return $}},S={default:N,array:h,object:h};function h($){return JSON.stringify($)}function N($){return`${$}`}function K($,Q){let X=V(Q);if(!X)throw TypeError(`[radiant-element] Unknown type "${Q}"`);return L0[X]($)}function g($,Q){let X=V(Q);if(!X)throw TypeError(`[radiant-element] Unknown type "${Q}"`);return(S[X]??S.default??N)($)}function O0($){return typeof $==="boolean"}function P0($){return typeof $==="number"}function E0($){return typeof $==="string"}function j0($){return Array.isArray($)}function A0($){return typeof $==="object"&&!Array.isArray($)&&$!==null}function b($,Q){switch($){case Boolean:return O0(Q);case Number:return P0(Q);case String:return E0(Q);case Array:return j0(Q);case Object:return A0(Q);default:return!1}}var v=($,Q,X,q)=>{if(Q===Boolean){let W=$.getAttribute(X);if(W===null)return q;return W===""?!0:K(W,Q)}let Z=$.getAttribute(X);return Z!==null?K(Z,Q):q??D0(Q)};function m($,Q){if(Q!==void 0&&!b($,Q))throw Error(`defaultValue does not match the expected type for ${$.name}`)}function y($,Q,X,q){return{type:X,name:$,value:q,initialValue:q,attribute:Q,converter:{fromAttribute:(Z)=>K(Z,X),toAttribute:(Z)=>g(Z,X)}}}import{Computed as _0,subtle as k0,trackDependency as C0}from"@ecopages/signals";function I0($){return $}function c($){return $}var s={trackDependency($){C0(I0($))},createComputed($){return new _0($)},createWatcher($){let Q=new k0.Watcher($);return{watch(X){Q.watch(c(X))},unwatch(X){Q.unwatch(c(X))}}}};var u=s;function w(){return u}function R0($){u=$}function P($){w().trackDependency($)}function d($){return w().createComputed($)}function p($){return w().createWatcher($)}function i($){return $.replace(/&/g,"\\u0026").replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}var J="data-hydration",o="data-hydration-type",E="data-hydration-key";function Y2($){let Q=$.hydrationKey?` ${E}="${T0($.hydrationKey)}"`:"";return`<script type="application/json" ${J} ${o}="${$.type}"${Q}>${$.serializedValue}</script>`}function K2($){return i($)}function w2($,Q){let X=$.textContent;if(!X)return Q;try{return JSON.parse(X)}catch{if(typeof console<"u")console.warn(`[@ecopages/radiant] Failed to parse hydration payload from <script ${J}>:`,X.slice(0,120));return Q}}function D2($,Q,X){let q=$.children;if(!q||q.length===0){let Z=$.childNodes;if(!Z||Z.length===0)return null;for(let W=0;W<Z.length;W+=1){let G=Z[W];if(G.nodeType!==1)continue;let M=G;if(l(M,Q,X))return M}return null}for(let Z=0;Z<q.length;Z+=1)if(l(q[Z],Q,X))return q[Z];return null}function l($,Q,X){if($.tagName!=="SCRIPT"||!$.hasAttribute(J)||$.getAttribute(o)!==Q)return!1;if(X!==void 0)return $.getAttribute(E)===X;return!$.hasAttribute(E)}function T0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}import{createMarkupNodeLike as f0,isKeyedJsxValue as n,isSlotJsxValue as S0}from"@ecopages/jsx";var B="",z="data-radiant-slot-projection";function a($){let Q=new Map;for(let X of Array.from($.childNodes)){if(g0(X))continue;h0(Q,N0(X),X)}return Q}function r($){let Q;try{Q=JSON.parse($)}catch{if(typeof console<"u")console.warn("[@ecopages/radiant] Failed to parse slot projection payload:",$.slice(0,120));return new Map}let X=new Map;for(let[q,Z]of Object.entries(Q)){if(!Array.isArray(Z)||Z.length===0)continue;X.set(j(q),Z.map((W)=>f0(W)))}return X}function t($){let Q=Array.from($.childNodes).filter((X)=>Z0(X)).map((X)=>D(X)??"").filter((X)=>X!=="");return Q.length>0?Q.join(""):void 0}function e($){let Q={};for(let[X,q]of $.entries()){let Z=q.map((W)=>D(W)).filter((W)=>W!==void 0&&W!=="");if(Z.length>0)Q[X]=Z}return Object.keys(Q).length>0?JSON.stringify(Q):void 0}function $0($,Q){let X=!1,q=(W)=>{if(S0(W))return X=!0,v0(W,Q,q);if(n(W))return V0(W,q(W.value));if(b0(W))return{_$rType$:1,rootLocalName:W.rootLocalName,ssrIntrinsicProps:W.ssrIntrinsicProps,strings:W.strings,values:W.values.map((G)=>q(G))};if(X0(W))return Array.from(W,(G)=>q(G));return W},Z=q($);return{containsSlots:X,value:Z}}function Q0($){for(let Q of Array.from($.childNodes)){if(!q0(Q))continue;let X=Q.textContent??void 0;return Q.parentNode?.removeChild(Q),X}return}function h0($,Q,X){let q=$.get(Q);if(q){q.push(X);return}$.set(Q,[X])}function V0($,Q){return{...$,value:Q}}function N0($){if($ instanceof Element)return j($.getAttribute("slot"));return B}function X0($){return typeof $!=="string"&&typeof $==="object"&&$!==null&&Symbol.iterator in $}function q0($){return $ instanceof HTMLScriptElement&&$.hasAttribute(z)}function Z0($){return $ instanceof HTMLScriptElement&&$.hasAttribute(J)}function g0($){return q0($)||Z0($)}function b0($){return typeof $==="object"&&$!==null&&$._$rType$===1&&Array.isArray($.strings)&&Array.isArray($.values)}function j($){return $??B}function D($){if($===void 0||$===null||$===!1||$===!0)return;if(typeof Node<"u"&&$ instanceof Node){if($.nodeType===Node.TEXT_NODE)return $.textContent??"";return $.outerHTML??$.textContent??void 0}if(n($))return D($.value);if(typeof $==="string"||typeof $==="number"||typeof $==="bigint")return String($);if(typeof $==="object"&&$!==null&&"outerHTML"in $)return typeof $.outerHTML==="string"?$.outerHTML:$.textContent??void 0;if(X0($))return Array.from($,(Q)=>D(Q)??"").join("");return}function v0($,Q,X){let q=Q.get(j($.name));if(q&&q.length>0)return q.length===1?q[0]:q;if($.fallback===void 0)return"";return X($.fallback)}import{hydrate as m0,render as y0}from"@ecopages/jsx";class A{#$;#Q=new Map;#X;#Z;#q;#W=0;constructor($){this.#$=$,this.#Z=p(()=>{this.#$.requestUpdate()})}get slotProjectionVersion(){return this.#W}getSlotElement($){return this.getSlotElements($)[0]??null}getSlotElements($){return this.ensureSlotProjectionState(),(this.#Q.get($??B)??[]).filter((Q)=>typeof Node<"u"&&Q instanceof Element)}getSlotProjectionScriptTag(){this.ensureSlotProjectionState();let $=e(this.#Q);if(!$)return;return`<script type="application/json" ${z}>${c0($)}</script>`}getAuthoredHydrationScriptMarkup(){return t(this.#$)??void 0}hydrate($){this.disconnectSlotProjectionObserver();try{m0(this.resolveTrackedRenderOutput().value,$)}finally{this.observeSlotProjection()}}render($){this.disconnectSlotProjectionObserver();try{y0(this.resolveTrackedRenderOutput().value,$)}finally{this.observeSlotProjection()}}observeSlotProjection(){if(typeof MutationObserver>"u"||this.#q||!this.#$.isConnected)return;this.#q=new MutationObserver(($)=>this.handleSlotProjectionMutations($)),this.#q.observe(this.#$,{childList:!0})}disconnectSlotProjectionObserver(){this.#q?.disconnect(),this.#q=void 0}disconnectRenderWatcher(){if(!this.#X)return;this.#Z.unwatch(this.#X),this.#X=void 0}resolveTrackedRenderOutput(){let $=d(()=>this.resolveRenderOutput()),Q=$.get();if(!this.#$.isConnected)return Q;if(this.#X)this.#Z.unwatch(this.#X);return this.#X=$,this.#Z.watch($),Q}dispose(){this.disconnectSlotProjectionObserver(),this.disconnectRenderWatcher()}ensureSlotProjectionState(){if(this.#Q.size>0)return;let $=this.#$.isConnected?Q0(this.#$):void 0;if(typeof $==="string"&&$!==""){this.#Q=r($),this.#W+=1;return}if(this.#$.childNodes.length>0)this.#Q=a(this.#$),this.#W+=1}handleSlotProjectionMutations($){let Q=!1;for(let X of $){for(let q of Array.from(X.removedNodes))if(this.removeProjectedSlotNode(q))Q=!0;for(let q of Array.from(X.addedNodes)){if(q.parentNode!==this.#$)continue;if(this.addProjectedSlotNode(q))Q=!0}}if(Q)this.#W+=1,this.#$.requestUpdate()}addProjectedSlotNode($){if($ instanceof HTMLScriptElement&&($.hasAttribute(z)||$.hasAttribute(J)))return!1;let Q=$ instanceof Element?$.getAttribute("slot")??B:B,X=this.#Q.get(Q);if(X){if(X.includes($))return!1;return X.push($),!0}return this.#Q.set(Q,[$]),!0}removeProjectedSlotNode($){for(let[Q,X]of this.#Q.entries()){let q=X.indexOf($);if(q===-1)continue;if(X.splice(q,1),X.length===0)this.#Q.delete(Q);return!0}return!1}resolveRenderOutput(){return this.ensureSlotProjectionState(),$0(this.#$.render(),this.#Q)}}function c0($){return $.replace(/</g,"\\u003c")}import{createSubscribableJsxValue as s0}from"@ecopages/jsx";class W0{read;subscribers=new Set;watcherListeners=new Set;version=0;constructor($){this.read=$}get(){return P(this),this.read()}subscribe($){return this.subscribers.add($),()=>{this.subscribers.delete($)}}addWatcher($){return this.watcherListeners.add($),()=>{this.watcherListeners.delete($)}}getVersion(){return this.version}notify($){this.version+=1;let Q;try{this.notifyWatchers()}catch(X){Q=X}if(this.publish($),Q)throw Q}publish($){for(let Q of this.subscribers)Q($)}notifyWatchers(){let $=[];for(let Q of this.watcherListeners)try{Q()}catch(X){$.push(X)}if($.length===1)throw $[0];if($.length>1)throw AggregateError($,"Multiple reactive dependency notifications failed.")}}function u0($){return typeof $==="object"&&$!==null&&typeof $.get==="function"}class _{host;access;shouldAutoBind;bindings;$;reactiveFields=new Map;reactiveDependencies=new Map;reactiveDependencyReaders=new Map;reactiveBindings=new Map;updateCallbacks=new Map;onConnectedCallbacks=[];onDisconnectedCallback=[];constructor($,Q,X){this.host=$;this.access=Q;this.shouldAutoBind=X;let q=this.createReactiveBindingNamespace();this.bindings=q,this.$=q}connectHost(){for(let $ of this.onConnectedCallbacks)$()}disconnectHost(){for(let $ of this.onDisconnectedCallback)$()}notifyUpdate($,Q,X){if(Q===X)return;this.reactiveDependencies.get($)?.notify(X);let q=this.updateCallbacks.get($);if(q)for(let Z of q)Z()}registerCleanupCallback($){this.onDisconnectedCallback.push($)}registerConnectedCallback($){this.onConnectedCallbacks.push($)}registerHydrationBinding($,Q){}registerReactiveDependencyReader($,Q){this.reactiveDependencyReaders.set($,Q)}registerUpdateCallback($,Q){if(!this.updateCallbacks.has($))this.updateCallbacks.set($,new Set);let X=this.updateCallbacks.get($);return X.add(Q),()=>{if(X.delete(Q),X.size===0)this.updateCallbacks.delete($)}}getReactiveBinding($){let Q=this.reactiveBindings.get($);if(Q)return Q;let X=s0({getValue:()=>this.readReactiveBindingValue($),subscribe:(q)=>this.registerUpdateCallback($,()=>{q(this.readReactiveBindingValue($))})});return this.reactiveBindings.set($,X),X}bind($){return this.getReactiveBinding($)}defineReactiveBinding($,Q=!0){let X=typeof Q==="string"?Q:Q?`$${$}`:void 0,q=this.access.getBindingTarget?.(this.host)??this.host;if(!X||this.access.hasProperty(this.host,X))return;this.access.defineProperty(q,X,{get:()=>this.getReactiveBinding($),enumerable:!1,configurable:!0})}trackReactiveRead($){P(this.getReactiveDependency($))}defineReactiveAccessor($,Q){let X=Q.bind??this.shouldAutoBind();if(this.defineReactiveBinding($,X),this.registerReactiveDependencyReader($,Q.getValue),this.access.defineProperty(this.host,$,{get:()=>{return this.trackReactiveRead($),Q.getValue()},set:(q)=>{let Z=Q.getValue();if(Z===q)return;Q.setValue(q),this.notifyUpdate($,Z,q)},enumerable:!0,configurable:!0}),Q.notifyInitialValue!==void 0)this.notifyUpdate($,void 0,Q.notifyInitialValue)}createReactiveField($,Q,X={}){let q={name:$,value:Q,initialValue:Q};this.reactiveFields.set($,q),this.defineReactiveAccessor($,{bind:X.bind,getValue:()=>this.reactiveFields.get($)?.value,setValue:(Z)=>{this.reactiveFields.set($,{...q,value:Z})},notifyInitialValue:Q})}createReactiveBindingNamespace(){return new Proxy(Object.create(null),{get:($,Q)=>{if(typeof Q!=="string")return;return this.getReactiveBinding(Q)}})}getReactiveDependency($){let Q=this.reactiveDependencies.get($);if(Q)return Q;let X=new W0(()=>this.readReactiveDependencyValue($));return this.reactiveDependencies.set($,X),X}readReactiveDependencyValue($){let Q=this.reactiveDependencyReaders.get($);if(Q)return Q();return this.readReactiveBindingValue($)}readReactiveBindingValue($){let Q=this.access.readProperty(this.host,$);if(u0(Q))return Q.get();return Q}}var k=Symbol.for("@ecopages/radiant.ssr-preparation-callbacks"),G0=Symbol.for("@ecopages/radiant.ssr-preparation-running");function T2($,Q){let q=$[k];if(Array.isArray(q)){q.push(Q);return}Object.defineProperty($,k,{value:[Q],configurable:!0})}function J0($){let Q=$,X=Q[k];if(!Array.isArray(X))return;Q[G0]=!0;try{for(let q of X)q()}finally{delete Q[G0]}}var C=Symbol.for("@ecopages/radiant.hydrator-installed");function S2(){globalThis[C]=!0}function h2(){delete globalThis[C]}function F0(){return globalThis[C]===!0}import{getActiveSsrScopeValue as d0,withActiveSsrScopeValue as p0}from"@ecopages/jsx/server";var x0=Symbol.for("@ecopages/radiant.element-ssr-runtime");function B0(){return d0(x0)}function g2($,Q){return p0(x0,$,Q)}import{hasHydrationMarkers as i0,jsx as l0}from"@ecopages/jsx";var o0=n0();function n0(){if(typeof HTMLElement<"u")return HTMLElement;throw Error("RadiantElement requires HTMLElement. Install '@ecopages/radiant/server/light-dom-shim' before SSR imports.")}class H0 extends o0{renderRootMode="light";bindings;$;reactiveHost;reactivePropertyState;contextProviders=new Map;hydrationBindings=new Map;eventSubscriptions=new Map;eventEmitters=new Map;elementReady=!1;isRendering=!1;isFirstConnectPending=!1;isRenderScheduled=!1;needsRender=!1;renderRuntime;constructor(){super();this.reactivePropertyState=new U0(this),this.reactiveHost=new _(this,{defineProperty:($,Q,X)=>Object.defineProperty($,Q,X),getBindingTarget:($)=>Object.getPrototypeOf($)??$,hasProperty:($,Q)=>(Q in $),readProperty:($,Q)=>$[Q]},()=>this.shouldAutoBindReactiveMembers()),this.bindings=this.reactiveHost.bindings,this.$=this.reactiveHost.$,T(this)}get slotProjectionVersion(){return this.renderRuntime?.slotProjectionVersion??0}connectedCallback(){H(this);let $=this.isFirstConnectPending;if(this.elementReady=!0,this.reactiveHost.connectHost(),$)return;this.isFirstConnectPending=!0,queueMicrotask(()=>{if(this.isFirstConnectPending=!1,!this.isConnected)return;if(!this.shouldRunRenderLifecycle())return;if(this.getOrCreateRenderRuntime().observeSlotProjection(),M0(this)){if(this.needsRender=!1,this.hydrate(),this.needsRender)this.update();return}this.update()})}connectedContextCallback($){}disconnectedCallback(){this.renderRuntime?.dispose(),this.renderRuntime=void 0,this.removeAllSubscribedEvents(),this.reactiveHost.disconnectHost()}notifyUpdate($,Q,X){this.reactiveHost.notifyUpdate($,Q,X)}attributeChangedCallback($,Q,X){if(Q===X||!this.elementReady)return;this.reactivePropertyState.applyAttributeChange($,Q,X)}renderTemplate({target:$=this,template:Q,insert:X="replace",sanitize:q}){let Z=q?q(Q):Q;switch(X){case"replace":$.innerHTML=Z;break;case"beforeend":$.insertAdjacentHTML("beforeend",Z);break;case"afterbegin":$.insertAdjacentHTML("afterbegin",Z);break;case"beforebegin":$.insertAdjacentHTML("beforebegin",Z);break;case"afterend":$.insertAdjacentHTML("afterend",Z);break}}render(){return l0("slot",{})}renderViewToString($={}){if(!this.shouldRunRenderLifecycle())return this.innerHTML;return H(this),this.prepareForSsr(),a0().renderView(this,$)}hydrate(){if(!this.shouldRunRenderLifecycle()||!this.isConnected||this.isRendering)return;let{renderTarget:$}=this.resolveRenderSurface(),Q=this.getOrCreateRenderRuntime();this.isRendering=!0;try{Q.hydrate($)}finally{this.isRendering=!1}}requestUpdate(){if(!this.shouldRunRenderLifecycle())return;if(this.needsRender=!0,this.isRenderScheduled)return;this.isRenderScheduled=!0,queueMicrotask(()=>{if(this.isRenderScheduled=!1,!this.needsRender)return;this.update()})}update(){if(!this.shouldRunRenderLifecycle())return;let{renderTarget:$}=this.resolveRenderSurface(),Q=this.getOrCreateRenderRuntime();if(this.needsRender=!0,!this.isConnected||this.isRendering)return;if(this.isFirstConnectPending&&M0(this))return;while(this.needsRender&&this.isConnected){this.needsRender=!1,this.isRendering=!0;try{Q.render($)}finally{this.isRendering=!1}}}registerReactiveProperty($){this.reactivePropertyState.register($)}getReactiveProperties(){return this.reactivePropertyState.getAll()}registerReactiveDependencyReader($,Q){this.reactiveHost.registerReactiveDependencyReader($,Q)}registerContextProvider($,Q){this.contextProviders.set($,Q),this.hydrationBindings.set($,Q)}registerHydrationBinding($,Q){this.hydrationBindings.set($,Q)}getContextProviders(){return H(this),[...this.contextProviders.values()]}getHydrationBindings(){return H(this),[...this.hydrationBindings.values()]}prepareForSsr(){J0(this)}shouldAutoBindReactiveMembers(){return!0}shouldRunRenderLifecycle(){return this.render!==H0.prototype.render}getRenderTarget(){if(this.renderRootMode!=="shadow")return this;if(this.shadowRoot)return this.shadowRoot;if(typeof this.attachShadow!=="function")throw Error("RadiantElement shadow render mode requires attachShadow().");return this.attachShadow({mode:"open"})}registerUpdateCallback($,Q){return this.reactiveHost.registerUpdateCallback($,Q)}getReactiveBinding($){return this.reactiveHost.getReactiveBinding($)}bind($){return this.reactiveHost.bind($)}defineReactiveBinding($,Q=!0){this.reactiveHost.defineReactiveBinding($,Q)}trackReactiveRead($){this.reactiveHost.trackReactiveRead($)}subscribeEvents($){let Q=[];for(let X of $)Q.push(this.subscribeEvent(X));return Q}subscribeEvent($){let{interactionTarget:Q}=this.resolveRenderSurface(),X=(Z)=>{if(Z.target&&Z.target.matches($.selector))$.listener.call(this,Z)},q=`${$.type}:${$.selector}`;return Q.addEventListener($.type,X,$.options),this.eventSubscriptions.set(q,{...$,listener:X,target:Q}),this.unsubscribeEvent.bind(this,q)}unsubscribeEvent($){let Q=this.eventSubscriptions.get($);if(Q)Q.target.removeEventListener(Q.type,Q.listener,Q.options),this.eventSubscriptions.delete($)}removeAllSubscribedEvents(){for(let $ of this.eventSubscriptions.values())$.target.removeEventListener($.type,$.listener,$.options);this.eventSubscriptions.clear()}registerCleanupCallback($){this.reactiveHost.registerCleanupCallback($)}registerConnectedCallback($){this.reactiveHost.registerConnectedCallback($)}registerEventEmitter($,Q){this.eventEmitters.set($,Q)}getRef($,Q=!1){let X=`[data-ref="${$}"]`,{queryRoot:q}=this.resolveRenderSurface();if(Q)return Array.from(q.querySelectorAll(X));return q.querySelector(X)??null}getSlotElement($){return this.getOrCreateRenderRuntime().getSlotElement($)}getSlotElements($){return this.getOrCreateRenderRuntime().getSlotElements($)}createReactiveField($,Q,X={}){this.reactiveHost.createReactiveField($,Q,X)}createReactiveProp($,Q){this.reactivePropertyState.create($,Q,(X,q,Z)=>v(this,X,q,Z),(X,q)=>{this.reactiveHost.defineReactiveAccessor(X,q)})}getSlotProjectionScriptTag(){return this.getOrCreateRenderRuntime().getSlotProjectionScriptTag()}getAuthoredHydrationScriptMarkup(){return this.getOrCreateRenderRuntime().getAuthoredHydrationScriptMarkup()}resolveTrackedRenderOutput(){return this.getOrCreateRenderRuntime().resolveTrackedRenderOutput()}getOrCreateRenderRuntime(){if(this.renderRuntime)return this.renderRuntime;return this.renderRuntime=new A(this),this.renderRuntime}resolveRenderSurface(){let $=this.getRenderTarget(),Q=$ instanceof ShadowRoot?$:this;return{interactionTarget:Q,queryRoot:Q,renderTarget:$}}}function a0(){let $=B0();if(!$)throw Error("Radiant SSR runtime unavailable. Import `@ecopages/radiant/server/render-component` first.");return $}function M0($){return F0()&&i0($)}class U0{host;properties=new Map;preUpgradePropertyValues=new Map;constructor($){this.host=$;for(let Q of Object.getOwnPropertyNames($))this.preUpgradePropertyValues.set(Q,Reflect.get($,Q))}register($){this.properties.set($.name,$)}getAll(){return Array.from(this.properties.values())}applyAttributeChange($,Q,X){let q=this.properties.get($);if(!q)return;let Z=this.transformAttributeValue(X,q),W=this.transformAttributeValue(Q,q);Reflect.set(this.host,q.attribute,Z),this.host.notifyUpdate($,W,Z)}create($,Q,X,q){let{type:Z,attribute:W,reflect:G,defaultValue:M}=Q,F=W??$,L=this.preUpgradePropertyValues.has($),Y0=L?this.preUpgradePropertyValues.get($):void 0;m(Z,M);let U=L?Y0:X(Z,F,M);if(this.host.hasAttribute(F)&&(!G||U==null||U===""))this.host.removeAttribute(F);if(L&&Object.prototype.hasOwnProperty.call(this.host,$))Reflect.deleteProperty(this.host,$);let Y=y($,F,Z,U);if(this.register(Y),q($,{bind:Q.bind,getValue:()=>this.properties.get($)?.value,setValue:(x)=>{this.properties.set($,{...Y,value:x}),this.reflectValue(F,G,Y,x)}}),U!==void 0)queueMicrotask(()=>{let x=this.properties.get($)?.value;if(x===void 0)return;this.reflectValue(F,G,Y,x),this.host.notifyUpdate($,void 0,x)})}transformAttributeValue($,Q){return $!==null?Q.converter.fromAttribute($):$}reflectValue($,Q,X,q){if(!Q)return;if(q==null||q===""||q===!1){this.host.removeAttribute($);return}let Z=X.converter.toAttribute(q);this.host.setAttribute($,Z)}}export{H0 as RadiantElement};
2
2
 
3
- //# debugId=00E7CEE7F33A213F64756E2164756E21
3
+ //# debugId=282CC73B7E25712B64756E2164756E21