@estjs/template 0.0.14 → 0.0.15-beta.1

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.
@@ -1,25 +1,264 @@
1
- import { Signal as Signal$1 } from '@estjs/signal';
1
+ import { Signal as Signal$1, Computed } from '@estjs/signals';
2
2
  import * as csstype from 'csstype';
3
+ export { escapeHTML } from '@estjs/shared';
3
4
 
4
- type EssorComponent = (props: Record<string, unknown>) => JSX.Element | TemplateNode;
5
- type Hook = 'mounted' | 'destroy';
5
+ interface InjectionKey<T> extends Symbol {
6
+ }
7
+ /**
8
+ * provide a value to the context
9
+ * @param {InjectionKey<T>|string|number} key - the key to provide the value to
10
+ * @param {T} value - the value to provide
11
+ */
12
+ declare function provide<T>(key: InjectionKey<T> | string | number, value: T): void;
13
+ /**
14
+ * inject a value from the context
15
+ * @param {InjectionKey<T>|string|number} key - the key to inject the value from
16
+ * @param {T} defaultValue - the default value to return if the key is not found
17
+ * @returns {T} the value injected
18
+ */
19
+ declare function inject<T>(key: InjectionKey<T> | string | number, defaultValue?: T): T;
20
+
21
+ /**
22
+ * context interface
23
+ */
24
+ interface Context {
25
+ id: number;
26
+ parent: Context | null;
27
+ provides: Map<InjectionKey<unknown> | number | string | symbol, any>;
28
+ cleanup: Set<() => void>;
29
+ mount: Set<() => void | Promise<void>>;
30
+ update: Set<() => void | Promise<void>>;
31
+ destroy: Set<() => void | Promise<void>>;
32
+ isMount: boolean;
33
+ isDestroy: boolean;
34
+ children: Set<Context>;
35
+ }
36
+
37
+ declare enum COMPONENT_TYPE {
38
+ NORMAL = "normal",
39
+ FRAGMENT = "fragment",
40
+ PORTAL = "portal",
41
+ SUSPENSE = "suspense",
42
+ FOR = "for"
43
+ }
44
+
45
+ type ComponentFn = (props?: ComponentProps) => Node | Signal$1<Node> | Computed<Node>;
46
+ type ComponentProps = Record<string, unknown>;
47
+ declare class Component {
48
+ component: ComponentFn;
49
+ props: ComponentProps | undefined;
50
+ protected renderedNode: Node | null;
51
+ protected componentContext: Context | null;
52
+ protected parentNode: Node | null;
53
+ protected beforeNode: Node | null;
54
+ private reactiveProps;
55
+ private _propSnapshots;
56
+ readonly key: string | undefined;
57
+ protected state: number;
58
+ protected context: Context | null;
59
+ protected parentContext: Context | null;
60
+ private [COMPONENT_TYPE.NORMAL];
61
+ get isConnected(): boolean;
62
+ get firstChild(): Node | null;
63
+ constructor(component: ComponentFn, props: ComponentProps | undefined);
64
+ mount(parentNode: Node, beforeNode?: Node | null): Node | null | Promise<Node | null>;
65
+ update(prevNode: Component): Component;
66
+ forceUpdate(): Promise<void>;
67
+ /**
68
+ * Destroy component
69
+ */
70
+ destroy(): void;
71
+ applyProps(props: ComponentProps): void;
72
+ }
73
+ /**
74
+ * check if a node is a component
75
+ * @param {unknown} node - the node to check
76
+ * @returns {boolean} true if the node is a component, false otherwise
77
+ */
78
+ declare function isComponent(node: unknown): node is Component;
79
+ /**
80
+ * create a component
81
+ * @param {Function} componentFn - the component function
82
+ * @param {ComponentProps} props - the component props
83
+ * @returns {Component} the component
84
+ */
85
+ declare function createComponent(componentFn: ComponentFn, props?: ComponentProps): Component;
86
+
87
+ /**
88
+ * Create a template factory function from HTML string
89
+ *
90
+ * This function creates a reusable template factory that efficiently clones
91
+ * DOM nodes from the provided HTML string. The template is parsed once and
92
+ *
93
+ * @param html - The HTML string to create template from
94
+ * @returns Factory function that returns a cloned node of the template
95
+ * @throws {Error} When template content is empty or invalid
96
+ *
97
+ * @example
98
+ * ```typescript
99
+ * const buttonTemplate = template('<button>Click me</button>');
100
+ * const button1 = buttonTemplate(); // Creates first button instance
101
+ * const button2 = buttonTemplate(); // Creates second button instance
102
+ * ```
103
+ */
104
+ declare function template(html: string): () => Node;
105
+ /**
106
+ * Create and mount an application with the specified component
107
+ *
108
+ * This function initializes an application by mounting a root component
109
+ * to a target DOM element. It handles target validation and cleanup.
110
+ *
111
+ * @param component - The root component function to mount
112
+ * @param target - CSS selector string or DOM element to mount to
113
+ * @returns The mount root component instance, or undefined if target not found
114
+ *
115
+ * @example
116
+ * ```typescript
117
+ * const App = () => template('<div>Hello World</div>')
118
+ * const app = createApp(App, '#root');
119
+ *
120
+ * // Or with DOM element
121
+ * const container = document.getElementById('app');
122
+ * const app = createApp(App, container);
123
+ * ```
124
+ */
125
+ declare function createApp(component: ComponentFn, target: string | Element): Component | undefined;
126
+
127
+ type LifecycleHook = () => void;
128
+ declare function onMount(hook: LifecycleHook): void;
129
+ declare function onDestroy(hook: LifecycleHook): void;
130
+ declare function onUpdate(hook: LifecycleHook): void;
6
131
 
7
- interface NodeTrack {
8
- cleanup: () => void;
9
- isRoot?: boolean;
10
- lastNodes?: Map<string, Node | JSX.Element>;
132
+ /**
133
+ * Add event listener with automatic cleanup on context destruction
134
+ */
135
+ declare function addEventListener(element: Element, event: string, handler: EventListener, options?: AddEventListenerOptions): void;
136
+ /**
137
+ * Bind an element to a setter function, allowing the element to update the setter value when its value changes.
138
+ *
139
+ * @param node The element to bind.
140
+ * @param setter The setter function to call when the element's value changes.
141
+ */
142
+ declare function bindElement(node: Element, key: any, defaultValue: any, setter: (value: unknown) => void): void;
143
+ /**
144
+ * Reactive node insertion with binding support
145
+ *
146
+ * @param parent Parent node
147
+ * @param nodeFactory Node factory function or static node
148
+ * @param before Reference node for insertion position
149
+ *
150
+ * @example
151
+ * ```typescript
152
+ * insert(container, () => message.value, null);
153
+ * insert(container, staticElement, referenceNode);
154
+ * insert(container, "Hello World", null); // Direct string support
155
+ * ```
156
+ */
157
+ interface InsertOptions {
158
+ preserveOnCleanup?: boolean;
11
159
  }
12
- interface NodeTrack {
13
- cleanup: () => void;
14
- isRoot?: boolean;
15
- lastNodes?: Map<string, Node | JSX.Element>;
160
+ /**
161
+ * Reactive node insertion with binding support
162
+ *
163
+ * @param parent Parent node
164
+ * @param nodeFactory Node factory function or static node
165
+ * @param before Reference node for insertion position
166
+ * @param options Insertion options
167
+ *
168
+ * @example
169
+ * ```typescript
170
+ * insert(container, () => message.value, null);
171
+ * insert(container, staticElement, referenceNode);
172
+ * insert(container, "Hello World", null); // Direct string support
173
+ * ```
174
+ */
175
+ declare function insert(parent: Node, nodeFactory: Function | Node | string, before?: Node, options?: InsertOptions): void;
176
+ /**
177
+ * Map nodes from template by indexes
178
+ */
179
+ declare function mapNodes(template: Node, indexes: number[]): Node[];
180
+
181
+ /**
182
+ * Set up event delegation for specified event types
183
+ * @param {string[]} eventNames - Array of event names to delegate
184
+ * @param {Document} document - Document to attach events to (defaults to window.document)
185
+ */
186
+ declare function delegateEvents(eventNames: string[], document?: Document): void;
187
+
188
+ /**
189
+ * Patches the class attribute of an element
190
+ * Supports silent hydration (skips DOM updates during hydration phase)
191
+ *
192
+ * @param el - The element to patch classes on
193
+ * @param prev - Previous class value for diffing
194
+ * @param next - New class value to apply
195
+ * @param isSVG - Whether the element is an SVG element
196
+ * @public
197
+ */
198
+ declare function patchClass(el: Element, prev: unknown, next: unknown, isSVG?: boolean): void;
199
+ /**
200
+ * Normalizes different class value formats into a single string
201
+ *
202
+ * @param value - The class value to normalize
203
+ * @returns A normalized class string
204
+ * @public
205
+ */
206
+ declare function normalizeClass(value: unknown): string;
207
+
208
+ /**
209
+ * Patches the style of an element, optimized for different style formats
210
+ * Supports silent hydration (skips DOM updates during hydration phase)
211
+ *
212
+ * @param el - The element to patch styles on
213
+ * @public
214
+ */
215
+ declare function patchStyle(el: HTMLElement, prev: unknown, next: unknown): void;
216
+ /**
217
+ * Sets an individual style property with various optimizations
218
+ *
219
+ * @param style - The style object to modify
220
+ * @param name - The style property name
221
+ * @param val - The style property value
222
+ * @private
223
+ */
224
+ declare function setStyle(style: CSSStyleDeclaration, name: string, val: string | string[]): void;
225
+
226
+ type AttrValue = string | boolean | number | null | undefined;
227
+ declare function patchAttr(el: Element, key: string, prev: AttrValue, next: AttrValue): void;
228
+
229
+ /**
230
+ * Extended event options with delegation support
231
+ * @public
232
+ */
233
+ interface EventOptions extends AddEventListenerOptions {
234
+ /**
235
+ * CSS selector for event delegation
236
+ * When provided, the event will only trigger if the target matches this selector
237
+ */
238
+ delegate?: string;
16
239
  }
240
+ /**
241
+ * Event handler cleanup function
242
+ * @public
243
+ */
244
+ type EventCleanup = () => void;
245
+ /**
246
+ * Adds an event listener to an element with optional delegation
247
+ *
248
+ * @param el - The element to attach the event to
249
+ * @param event - The event name (e.g., 'click', 'input')
250
+ * @param handler - The event handler function
251
+ * @param options - Additional event options including delegation
252
+ * @returns A cleanup function to remove the event listener
253
+ * @public
254
+ */
255
+ declare function addEvent(el: Element, event: string, handler: EventListener, options?: EventOptions): EventCleanup;
17
256
 
18
- type Props = Record<string, any>;
257
+ type estComponent = (props: Record<string, unknown>) => JSX.Element | TemplateNode;
19
258
 
20
- interface EssorNode<T = Record<string, any>> {
259
+ interface estNode<T = Record<string, any>> {
21
260
  props?: T;
22
- template: EssorComponent | HTMLTemplateElement;
261
+ template: estComponent | HTMLTemplateElement;
23
262
 
24
263
  get firstChild(): Node | null;
25
264
  get isConnected(): boolean;
@@ -42,8 +281,8 @@ declare const SERIALIZABLE: unique symbol;
42
281
 
43
282
  declare global {
44
283
  export namespace JSX {
45
- export type Element = EssorNode;
46
- export type JSXElement = EssorNode;
284
+ export type Element = estNode;
285
+ export type JSXElement = estNode;
47
286
 
48
287
  type Children =
49
288
  | string
@@ -67,14 +306,12 @@ declare global {
67
306
  interface ElementChildrenAttribute {
68
307
  children: {};
69
308
  }
70
- interface EventHandler<T, E extends Event> {
71
- (
72
- e: E & {
73
- currentTarget: T;
74
- target: DOMElement;
75
- },
76
- ): void;
77
- }
309
+ type EventHandler<T, E extends Event> = (
310
+ e: E & {
311
+ currentTarget: T;
312
+ target: DOMElement;
313
+ },
314
+ ) => void;
78
315
  interface BoundEventHandler<T, E extends Event> {
79
316
  0: (
80
317
  data: any,
@@ -87,16 +324,14 @@ declare global {
87
324
  }
88
325
  type EventHandlerUnion<T, E extends Event> = EventHandler<T, E> | BoundEventHandler<T, E>;
89
326
 
90
- interface InputEventHandler<T, E extends InputEvent> {
91
- (
92
- e: E & {
93
- currentTarget: T;
94
- target: T extends HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement
95
- ? T
96
- : DOMElement;
97
- },
98
- ): void;
99
- }
327
+ type InputEventHandler<T, E extends InputEvent> = (
328
+ e: E & {
329
+ currentTarget: T;
330
+ target: T extends HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement
331
+ ? T
332
+ : DOMElement;
333
+ },
334
+ ) => void;
100
335
  interface BoundInputEventHandler<T, E extends InputEvent> {
101
336
  0: (
102
337
  data: any,
@@ -113,16 +348,14 @@ declare global {
113
348
  | InputEventHandler<T, E>
114
349
  | BoundInputEventHandler<T, E>;
115
350
 
116
- interface ChangeEventHandler<T, E extends Event> {
117
- (
118
- e: E & {
119
- currentTarget: T;
120
- target: T extends HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement
121
- ? T
122
- : DOMElement;
123
- },
124
- ): void;
125
- }
351
+ type ChangeEventHandler<T, E extends Event> = (
352
+ e: E & {
353
+ currentTarget: T;
354
+ target: T extends HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement
355
+ ? T
356
+ : DOMElement;
357
+ },
358
+ ) => void;
126
359
  interface BoundChangeEventHandler<T, E extends Event> {
127
360
  0: (
128
361
  data: any,
@@ -139,16 +372,14 @@ declare global {
139
372
  | ChangeEventHandler<T, E>
140
373
  | BoundChangeEventHandler<T, E>;
141
374
 
142
- interface FocusEventHandler<T, E extends FocusEvent> {
143
- (
144
- e: E & {
145
- currentTarget: T;
146
- target: T extends HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement
147
- ? T
148
- : DOMElement;
149
- },
150
- ): void;
151
- }
375
+ type FocusEventHandler<T, E extends FocusEvent> = (
376
+ e: E & {
377
+ currentTarget: T;
378
+ target: T extends HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement
379
+ ? T
380
+ : DOMElement;
381
+ },
382
+ ) => void;
152
383
  interface BoundFocusEventHandler<T, E extends FocusEvent> {
153
384
  0: (
154
385
  data: any,
@@ -177,10 +408,10 @@ declare global {
177
408
  ref?: Signal<T> | ((el: T) => void);
178
409
  key?: string | number | symbol;
179
410
  }
180
- type Accessor<T> = () => T;
411
+ type Accest<T> = () => T;
181
412
  interface Directives {}
182
413
  interface DirectiveFunctions {
183
- [x: string]: (el: DOMElement, accessor: Accessor<any>) => void;
414
+ [x: string]: (el: DOMElement, accest: Accest<any>) => void;
184
415
  }
185
416
  interface ExplicitProperties<T> {
186
417
  value: Signal<T>;
@@ -200,7 +431,8 @@ declare global {
200
431
  [Key in keyof ExplicitProperties]?: ExplicitProperties<T>[Key];
201
432
  };
202
433
  interface DOMAttributes<T>
203
- extends CustomAttributes<T>,
434
+ extends
435
+ CustomAttributes<T>,
204
436
  PropAttributes<T>,
205
437
  OnCaptureAttributes<T>,
206
438
  CustomEventHandlersCamelCase<T>,
@@ -434,7 +666,7 @@ declare global {
434
666
  | 'allow-orientation-lock'
435
667
  | 'allow-pointer-lock'
436
668
  | 'allow-popups'
437
- | 'allow-popups-to-escape-sandbox'
669
+ | 'allow-popups-to-escapeHTML-sandbox'
438
670
  | 'allow-presentation'
439
671
  | 'allow-same-origin'
440
672
  | 'allow-scripts'
@@ -567,7 +799,7 @@ declare global {
567
799
  'aria-labelledby'?: string;
568
800
  /** Defines the hierarchical level of an element within a structure. */
569
801
  'aria-level'?: number | string;
570
- /** Indicates that an element will be updated, and describes the types of updates the user agents, assistive technologies, and user can expect from the live region. */
802
+ /** Indicates that an element will be update, and describes the types of updates the user agents, assistive technologies, and user can expect from the live region. */
571
803
  'aria-live'?: 'off' | 'assertive' | 'polite';
572
804
  /** Indicates whether an element is modal when displayed. */
573
805
  'aria-modal'?: boolean | 'false' | 'true';
@@ -1236,7 +1468,7 @@ declare global {
1236
1468
  | 'defer xMidYMax slice'
1237
1469
  | 'defer xMaxYMax slice';
1238
1470
  type SVGUnits = 'userSpaceOnUse' | 'objectBoundingBox';
1239
- interface CoreSVGAttributes<T> extends AriaAttributes, DOMAttributes<T> {
1471
+ interface estSVGAttributes<T> extends AriaAttributes, DOMAttributes<T> {
1240
1472
  id?: string;
1241
1473
  lang?: string;
1242
1474
  tabIndex?: number | string;
@@ -1394,11 +1626,13 @@ declare global {
1394
1626
  'writing-mode'?: 'lr-tb' | 'rl-tb' | 'tb-rl' | 'lr' | 'rl' | 'tb' | 'inherit';
1395
1627
  }
1396
1628
  interface AnimationElementSVGAttributes<T>
1397
- extends CoreSVGAttributes<T>,
1629
+ extends
1630
+ estSVGAttributes<T>,
1398
1631
  ExternalResourceSVGAttributes,
1399
1632
  ConditionalProcessingSVGAttributes {}
1400
1633
  interface ContainerElementSVGAttributes<T>
1401
- extends CoreSVGAttributes<T>,
1634
+ extends
1635
+ estSVGAttributes<T>,
1402
1636
  ShapeElementSVGAttributes<T>,
1403
1637
  Pick<
1404
1638
  PresentationSVGAttributes,
@@ -1412,8 +1646,7 @@ declare global {
1412
1646
  | 'color-rendering'
1413
1647
  > {}
1414
1648
  interface FilterPrimitiveElementSVGAttributes<T>
1415
- extends CoreSVGAttributes<T>,
1416
- Pick<PresentationSVGAttributes, 'color-interpolation-filters'> {
1649
+ extends estSVGAttributes<T>, Pick<PresentationSVGAttributes, 'color-interpolation-filters'> {
1417
1650
  x?: number | string;
1418
1651
  y?: number | string;
1419
1652
  width?: number | string;
@@ -1432,16 +1665,15 @@ declare global {
1432
1665
  preserveAspectRatio?: SVGPreserveAspectRatio;
1433
1666
  }
1434
1667
  interface GradientElementSVGAttributes<T>
1435
- extends CoreSVGAttributes<T>,
1436
- ExternalResourceSVGAttributes,
1437
- StylableSVGAttributes {
1668
+ extends estSVGAttributes<T>, ExternalResourceSVGAttributes, StylableSVGAttributes {
1438
1669
  gradientUnits?: SVGUnits;
1439
1670
  gradientTransform?: string;
1440
1671
  spreadMethod?: 'pad' | 'reflect' | 'repeat';
1441
1672
  href?: string;
1442
1673
  }
1443
1674
  interface GraphicsElementSVGAttributes<T>
1444
- extends CoreSVGAttributes<T>,
1675
+ extends
1676
+ estSVGAttributes<T>,
1445
1677
  Pick<
1446
1678
  PresentationSVGAttributes,
1447
1679
  | 'clip-rule'
@@ -1455,14 +1687,14 @@ declare global {
1455
1687
  | 'color-interpolation'
1456
1688
  | 'color-rendering'
1457
1689
  > {}
1458
- interface LightSourceElementSVGAttributes<T> extends CoreSVGAttributes<T> {}
1690
+ interface LightSourceElementSVGAttributes<T> extends estSVGAttributes<T> {}
1459
1691
  interface NewViewportSVGAttributes<T>
1460
- extends CoreSVGAttributes<T>,
1461
- Pick<PresentationSVGAttributes, 'overflow' | 'clip'> {
1692
+ extends estSVGAttributes<T>, Pick<PresentationSVGAttributes, 'overflow' | 'clip'> {
1462
1693
  viewBox?: string;
1463
1694
  }
1464
1695
  interface ShapeElementSVGAttributes<T>
1465
- extends CoreSVGAttributes<T>,
1696
+ extends
1697
+ estSVGAttributes<T>,
1466
1698
  Pick<
1467
1699
  PresentationSVGAttributes,
1468
1700
  | 'color'
@@ -1481,7 +1713,8 @@ declare global {
1481
1713
  | 'pathLength'
1482
1714
  > {}
1483
1715
  interface TextContentElementSVGAttributes<T>
1484
- extends CoreSVGAttributes<T>,
1716
+ extends
1717
+ estSVGAttributes<T>,
1485
1718
  Pick<
1486
1719
  PresentationSVGAttributes,
1487
1720
  | 'font-family'
@@ -1518,14 +1751,16 @@ declare global {
1518
1751
  zoomAndPan?: 'disable' | 'magnify';
1519
1752
  }
1520
1753
  interface AnimateSVGAttributes<T>
1521
- extends AnimationElementSVGAttributes<T>,
1754
+ extends
1755
+ AnimationElementSVGAttributes<T>,
1522
1756
  AnimationAttributeTargetSVGAttributes,
1523
1757
  AnimationTimingSVGAttributes,
1524
1758
  AnimationValueSVGAttributes,
1525
1759
  AnimationAdditionSVGAttributes,
1526
1760
  Pick<PresentationSVGAttributes, 'color-interpolation' | 'color-rendering'> {}
1527
1761
  interface AnimateMotionSVGAttributes<T>
1528
- extends AnimationElementSVGAttributes<T>,
1762
+ extends
1763
+ AnimationElementSVGAttributes<T>,
1529
1764
  AnimationTimingSVGAttributes,
1530
1765
  AnimationValueSVGAttributes,
1531
1766
  AnimationAdditionSVGAttributes {
@@ -1535,7 +1770,8 @@ declare global {
1535
1770
  origin?: 'default';
1536
1771
  }
1537
1772
  interface AnimateTransformSVGAttributes<T>
1538
- extends AnimationElementSVGAttributes<T>,
1773
+ extends
1774
+ AnimationElementSVGAttributes<T>,
1539
1775
  AnimationAttributeTargetSVGAttributes,
1540
1776
  AnimationTimingSVGAttributes,
1541
1777
  AnimationValueSVGAttributes,
@@ -1543,7 +1779,8 @@ declare global {
1543
1779
  type?: 'translate' | 'scale' | 'rotate' | 'skewX' | 'skewY';
1544
1780
  }
1545
1781
  interface CircleSVGAttributes<T>
1546
- extends GraphicsElementSVGAttributes<T>,
1782
+ extends
1783
+ GraphicsElementSVGAttributes<T>,
1547
1784
  ShapeElementSVGAttributes<T>,
1548
1785
  ConditionalProcessingSVGAttributes,
1549
1786
  StylableSVGAttributes,
@@ -1553,7 +1790,8 @@ declare global {
1553
1790
  r?: number | string;
1554
1791
  }
1555
1792
  interface ClipPathSVGAttributes<T>
1556
- extends CoreSVGAttributes<T>,
1793
+ extends
1794
+ estSVGAttributes<T>,
1557
1795
  ConditionalProcessingSVGAttributes,
1558
1796
  ExternalResourceSVGAttributes,
1559
1797
  StylableSVGAttributes,
@@ -1562,14 +1800,16 @@ declare global {
1562
1800
  clipPathUnits?: SVGUnits;
1563
1801
  }
1564
1802
  interface DefsSVGAttributes<T>
1565
- extends ContainerElementSVGAttributes<T>,
1803
+ extends
1804
+ ContainerElementSVGAttributes<T>,
1566
1805
  ConditionalProcessingSVGAttributes,
1567
1806
  ExternalResourceSVGAttributes,
1568
1807
  StylableSVGAttributes,
1569
1808
  TransformableSVGAttributes {}
1570
- interface DescSVGAttributes<T> extends CoreSVGAttributes<T>, StylableSVGAttributes {}
1809
+ interface DescSVGAttributes<T> extends estSVGAttributes<T>, StylableSVGAttributes {}
1571
1810
  interface EllipseSVGAttributes<T>
1572
- extends GraphicsElementSVGAttributes<T>,
1811
+ extends
1812
+ GraphicsElementSVGAttributes<T>,
1573
1813
  ShapeElementSVGAttributes<T>,
1574
1814
  ConditionalProcessingSVGAttributes,
1575
1815
  ExternalResourceSVGAttributes,
@@ -1581,24 +1821,28 @@ declare global {
1581
1821
  ry?: number | string;
1582
1822
  }
1583
1823
  interface FeBlendSVGAttributes<T>
1584
- extends FilterPrimitiveElementSVGAttributes<T>,
1824
+ extends
1825
+ FilterPrimitiveElementSVGAttributes<T>,
1585
1826
  DoubleInputFilterSVGAttributes,
1586
1827
  StylableSVGAttributes {
1587
1828
  mode?: 'normal' | 'multiply' | 'screen' | 'darken' | 'lighten';
1588
1829
  }
1589
1830
  interface FeColorMatrixSVGAttributes<T>
1590
- extends FilterPrimitiveElementSVGAttributes<T>,
1831
+ extends
1832
+ FilterPrimitiveElementSVGAttributes<T>,
1591
1833
  SingleInputFilterSVGAttributes,
1592
1834
  StylableSVGAttributes {
1593
1835
  type?: 'matrix' | 'saturate' | 'hueRotate' | 'luminanceToAlpha';
1594
1836
  values?: string;
1595
1837
  }
1596
1838
  interface FeComponentTransferSVGAttributes<T>
1597
- extends FilterPrimitiveElementSVGAttributes<T>,
1839
+ extends
1840
+ FilterPrimitiveElementSVGAttributes<T>,
1598
1841
  SingleInputFilterSVGAttributes,
1599
1842
  StylableSVGAttributes {}
1600
1843
  interface FeCompositeSVGAttributes<T>
1601
- extends FilterPrimitiveElementSVGAttributes<T>,
1844
+ extends
1845
+ FilterPrimitiveElementSVGAttributes<T>,
1602
1846
  DoubleInputFilterSVGAttributes,
1603
1847
  StylableSVGAttributes {
1604
1848
  operator?: 'over' | 'in' | 'out' | 'atop' | 'xor' | 'arithmetic';
@@ -1608,7 +1852,8 @@ declare global {
1608
1852
  k4?: number | string;
1609
1853
  }
1610
1854
  interface FeConvolveMatrixSVGAttributes<T>
1611
- extends FilterPrimitiveElementSVGAttributes<T>,
1855
+ extends
1856
+ FilterPrimitiveElementSVGAttributes<T>,
1612
1857
  SingleInputFilterSVGAttributes,
1613
1858
  StylableSVGAttributes {
1614
1859
  order?: number | string;
@@ -1622,7 +1867,8 @@ declare global {
1622
1867
  preserveAlpha?: 'true' | 'false';
1623
1868
  }
1624
1869
  interface FeDiffuseLightingSVGAttributes<T>
1625
- extends FilterPrimitiveElementSVGAttributes<T>,
1870
+ extends
1871
+ FilterPrimitiveElementSVGAttributes<T>,
1626
1872
  SingleInputFilterSVGAttributes,
1627
1873
  StylableSVGAttributes,
1628
1874
  Pick<PresentationSVGAttributes, 'color' | 'lighting-color'> {
@@ -1631,7 +1877,8 @@ declare global {
1631
1877
  kernelUnitLength?: number | string;
1632
1878
  }
1633
1879
  interface FeDisplacementMapSVGAttributes<T>
1634
- extends FilterPrimitiveElementSVGAttributes<T>,
1880
+ extends
1881
+ FilterPrimitiveElementSVGAttributes<T>,
1635
1882
  DoubleInputFilterSVGAttributes,
1636
1883
  StylableSVGAttributes {
1637
1884
  scale?: number | string;
@@ -1643,7 +1890,8 @@ declare global {
1643
1890
  elevation?: number | string;
1644
1891
  }
1645
1892
  interface FeDropShadowSVGAttributes<T>
1646
- extends CoreSVGAttributes<T>,
1893
+ extends
1894
+ estSVGAttributes<T>,
1647
1895
  FilterPrimitiveElementSVGAttributes<T>,
1648
1896
  StylableSVGAttributes,
1649
1897
  Pick<PresentationSVGAttributes, 'color' | 'flood-color' | 'flood-opacity'> {
@@ -1652,10 +1900,11 @@ declare global {
1652
1900
  stdDeviation?: number | string;
1653
1901
  }
1654
1902
  interface FeFloodSVGAttributes<T>
1655
- extends FilterPrimitiveElementSVGAttributes<T>,
1903
+ extends
1904
+ FilterPrimitiveElementSVGAttributes<T>,
1656
1905
  StylableSVGAttributes,
1657
1906
  Pick<PresentationSVGAttributes, 'color' | 'flood-color' | 'flood-opacity'> {}
1658
- interface FeFuncSVGAttributes<T> extends CoreSVGAttributes<T> {
1907
+ interface FeFuncSVGAttributes<T> extends estSVGAttributes<T> {
1659
1908
  type?: 'identity' | 'table' | 'discrete' | 'linear' | 'gamma';
1660
1909
  tableValues?: string;
1661
1910
  slope?: number | string;
@@ -1665,33 +1914,35 @@ declare global {
1665
1914
  offset?: number | string;
1666
1915
  }
1667
1916
  interface FeGaussianBlurSVGAttributes<T>
1668
- extends FilterPrimitiveElementSVGAttributes<T>,
1917
+ extends
1918
+ FilterPrimitiveElementSVGAttributes<T>,
1669
1919
  SingleInputFilterSVGAttributes,
1670
1920
  StylableSVGAttributes {
1671
1921
  stdDeviation?: number | string;
1672
1922
  }
1673
1923
  interface FeImageSVGAttributes<T>
1674
- extends FilterPrimitiveElementSVGAttributes<T>,
1924
+ extends
1925
+ FilterPrimitiveElementSVGAttributes<T>,
1675
1926
  ExternalResourceSVGAttributes,
1676
1927
  StylableSVGAttributes {
1677
1928
  preserveAspectRatio?: SVGPreserveAspectRatio;
1678
1929
  href?: string;
1679
1930
  }
1680
1931
  interface FeMergeSVGAttributes<T>
1681
- extends FilterPrimitiveElementSVGAttributes<T>,
1682
- StylableSVGAttributes {}
1932
+ extends FilterPrimitiveElementSVGAttributes<T>, StylableSVGAttributes {}
1683
1933
  interface FeMergeNodeSVGAttributes<T>
1684
- extends CoreSVGAttributes<T>,
1685
- SingleInputFilterSVGAttributes {}
1934
+ extends estSVGAttributes<T>, SingleInputFilterSVGAttributes {}
1686
1935
  interface FeMorphologySVGAttributes<T>
1687
- extends FilterPrimitiveElementSVGAttributes<T>,
1936
+ extends
1937
+ FilterPrimitiveElementSVGAttributes<T>,
1688
1938
  SingleInputFilterSVGAttributes,
1689
1939
  StylableSVGAttributes {
1690
1940
  operator?: 'erode' | 'dilate';
1691
1941
  radius?: number | string;
1692
1942
  }
1693
1943
  interface FeOffsetSVGAttributes<T>
1694
- extends FilterPrimitiveElementSVGAttributes<T>,
1944
+ extends
1945
+ FilterPrimitiveElementSVGAttributes<T>,
1695
1946
  SingleInputFilterSVGAttributes,
1696
1947
  StylableSVGAttributes {
1697
1948
  dx?: number | string;
@@ -1703,7 +1954,8 @@ declare global {
1703
1954
  z?: number | string;
1704
1955
  }
1705
1956
  interface FeSpecularLightingSVGAttributes<T>
1706
- extends FilterPrimitiveElementSVGAttributes<T>,
1957
+ extends
1958
+ FilterPrimitiveElementSVGAttributes<T>,
1707
1959
  SingleInputFilterSVGAttributes,
1708
1960
  StylableSVGAttributes,
1709
1961
  Pick<PresentationSVGAttributes, 'color' | 'lighting-color'> {
@@ -1723,12 +1975,12 @@ declare global {
1723
1975
  limitingConeAngle?: number | string;
1724
1976
  }
1725
1977
  interface FeTileSVGAttributes<T>
1726
- extends FilterPrimitiveElementSVGAttributes<T>,
1978
+ extends
1979
+ FilterPrimitiveElementSVGAttributes<T>,
1727
1980
  SingleInputFilterSVGAttributes,
1728
1981
  StylableSVGAttributes {}
1729
1982
  interface FeTurbulanceSVGAttributes<T>
1730
- extends FilterPrimitiveElementSVGAttributes<T>,
1731
- StylableSVGAttributes {
1983
+ extends FilterPrimitiveElementSVGAttributes<T>, StylableSVGAttributes {
1732
1984
  baseFrequency?: number | string;
1733
1985
  numOctaves?: number | string;
1734
1986
  seed?: number | string;
@@ -1736,9 +1988,7 @@ declare global {
1736
1988
  type?: 'fractalNoise' | 'turbulence';
1737
1989
  }
1738
1990
  interface FilterSVGAttributes<T>
1739
- extends CoreSVGAttributes<T>,
1740
- ExternalResourceSVGAttributes,
1741
- StylableSVGAttributes {
1991
+ extends estSVGAttributes<T>, ExternalResourceSVGAttributes, StylableSVGAttributes {
1742
1992
  filterUnits?: SVGUnits;
1743
1993
  primitiveUnits?: SVGUnits;
1744
1994
  x?: number | string;
@@ -1748,7 +1998,8 @@ declare global {
1748
1998
  filterRes?: number | string;
1749
1999
  }
1750
2000
  interface ForeignObjectSVGAttributes<T>
1751
- extends NewViewportSVGAttributes<T>,
2001
+ extends
2002
+ NewViewportSVGAttributes<T>,
1752
2003
  ConditionalProcessingSVGAttributes,
1753
2004
  ExternalResourceSVGAttributes,
1754
2005
  StylableSVGAttributes,
@@ -1760,14 +2011,16 @@ declare global {
1760
2011
  height?: number | string;
1761
2012
  }
1762
2013
  interface GSVGAttributes<T>
1763
- extends ContainerElementSVGAttributes<T>,
2014
+ extends
2015
+ ContainerElementSVGAttributes<T>,
1764
2016
  ConditionalProcessingSVGAttributes,
1765
2017
  ExternalResourceSVGAttributes,
1766
2018
  StylableSVGAttributes,
1767
2019
  TransformableSVGAttributes,
1768
2020
  Pick<PresentationSVGAttributes, 'display' | 'visibility'> {}
1769
2021
  interface ImageSVGAttributes<T>
1770
- extends NewViewportSVGAttributes<T>,
2022
+ extends
2023
+ NewViewportSVGAttributes<T>,
1771
2024
  GraphicsElementSVGAttributes<T>,
1772
2025
  ConditionalProcessingSVGAttributes,
1773
2026
  StylableSVGAttributes,
@@ -1781,7 +2034,8 @@ declare global {
1781
2034
  href?: string;
1782
2035
  }
1783
2036
  interface LineSVGAttributes<T>
1784
- extends GraphicsElementSVGAttributes<T>,
2037
+ extends
2038
+ GraphicsElementSVGAttributes<T>,
1785
2039
  ShapeElementSVGAttributes<T>,
1786
2040
  ConditionalProcessingSVGAttributes,
1787
2041
  ExternalResourceSVGAttributes,
@@ -1800,7 +2054,8 @@ declare global {
1800
2054
  y2?: number | string;
1801
2055
  }
1802
2056
  interface MarkerSVGAttributes<T>
1803
- extends ContainerElementSVGAttributes<T>,
2057
+ extends
2058
+ ContainerElementSVGAttributes<T>,
1804
2059
  ExternalResourceSVGAttributes,
1805
2060
  StylableSVGAttributes,
1806
2061
  FitToViewBoxSVGAttributes,
@@ -1813,7 +2068,8 @@ declare global {
1813
2068
  orient?: string;
1814
2069
  }
1815
2070
  interface MaskSVGAttributes<T>
1816
- extends Omit<ContainerElementSVGAttributes<T>, 'opacity' | 'filter'>,
2071
+ extends
2072
+ Omit<ContainerElementSVGAttributes<T>, 'opacity' | 'filter'>,
1817
2073
  ConditionalProcessingSVGAttributes,
1818
2074
  ExternalResourceSVGAttributes,
1819
2075
  StylableSVGAttributes {
@@ -1824,10 +2080,11 @@ declare global {
1824
2080
  width?: number | string;
1825
2081
  height?: number | string;
1826
2082
  }
1827
- interface MetadataSVGAttributes<T> extends CoreSVGAttributes<T> {}
1828
- interface MPathSVGAttributes<T> extends CoreSVGAttributes<T> {}
2083
+ interface MetadataSVGAttributes<T> extends estSVGAttributes<T> {}
2084
+ interface MPathSVGAttributes<T> extends estSVGAttributes<T> {}
1829
2085
  interface PathSVGAttributes<T>
1830
- extends GraphicsElementSVGAttributes<T>,
2086
+ extends
2087
+ GraphicsElementSVGAttributes<T>,
1831
2088
  ShapeElementSVGAttributes<T>,
1832
2089
  ConditionalProcessingSVGAttributes,
1833
2090
  ExternalResourceSVGAttributes,
@@ -1838,7 +2095,8 @@ declare global {
1838
2095
  pathLength?: number | string;
1839
2096
  }
1840
2097
  interface PatternSVGAttributes<T>
1841
- extends ContainerElementSVGAttributes<T>,
2098
+ extends
2099
+ ContainerElementSVGAttributes<T>,
1842
2100
  ConditionalProcessingSVGAttributes,
1843
2101
  ExternalResourceSVGAttributes,
1844
2102
  StylableSVGAttributes,
@@ -1854,7 +2112,8 @@ declare global {
1854
2112
  href?: string;
1855
2113
  }
1856
2114
  interface PolygonSVGAttributes<T>
1857
- extends GraphicsElementSVGAttributes<T>,
2115
+ extends
2116
+ GraphicsElementSVGAttributes<T>,
1858
2117
  ShapeElementSVGAttributes<T>,
1859
2118
  ConditionalProcessingSVGAttributes,
1860
2119
  ExternalResourceSVGAttributes,
@@ -1864,7 +2123,8 @@ declare global {
1864
2123
  points?: string;
1865
2124
  }
1866
2125
  interface PolylineSVGAttributes<T>
1867
- extends GraphicsElementSVGAttributes<T>,
2126
+ extends
2127
+ GraphicsElementSVGAttributes<T>,
1868
2128
  ShapeElementSVGAttributes<T>,
1869
2129
  ConditionalProcessingSVGAttributes,
1870
2130
  ExternalResourceSVGAttributes,
@@ -1881,7 +2141,8 @@ declare global {
1881
2141
  fy?: number | string;
1882
2142
  }
1883
2143
  interface RectSVGAttributes<T>
1884
- extends GraphicsElementSVGAttributes<T>,
2144
+ extends
2145
+ GraphicsElementSVGAttributes<T>,
1885
2146
  ShapeElementSVGAttributes<T>,
1886
2147
  ConditionalProcessingSVGAttributes,
1887
2148
  ExternalResourceSVGAttributes,
@@ -1895,17 +2156,17 @@ declare global {
1895
2156
  ry?: number | string;
1896
2157
  }
1897
2158
  interface SetSVGAttributes<T>
1898
- extends CoreSVGAttributes<T>,
1899
- StylableSVGAttributes,
1900
- AnimationTimingSVGAttributes {}
2159
+ extends estSVGAttributes<T>, StylableSVGAttributes, AnimationTimingSVGAttributes {}
1901
2160
  interface StopSVGAttributes<T>
1902
- extends CoreSVGAttributes<T>,
2161
+ extends
2162
+ estSVGAttributes<T>,
1903
2163
  StylableSVGAttributes,
1904
2164
  Pick<PresentationSVGAttributes, 'color' | 'stop-color' | 'stop-opacity'> {
1905
2165
  offset?: number | string;
1906
2166
  }
1907
2167
  interface SvgSVGAttributes<T>
1908
- extends ContainerElementSVGAttributes<T>,
2168
+ extends
2169
+ ContainerElementSVGAttributes<T>,
1909
2170
  NewViewportSVGAttributes<T>,
1910
2171
  ConditionalProcessingSVGAttributes,
1911
2172
  ExternalResourceSVGAttributes,
@@ -1924,14 +2185,16 @@ declare global {
1924
2185
  xmlns?: string;
1925
2186
  }
1926
2187
  interface SwitchSVGAttributes<T>
1927
- extends ContainerElementSVGAttributes<T>,
2188
+ extends
2189
+ ContainerElementSVGAttributes<T>,
1928
2190
  ConditionalProcessingSVGAttributes,
1929
2191
  ExternalResourceSVGAttributes,
1930
2192
  StylableSVGAttributes,
1931
2193
  TransformableSVGAttributes,
1932
2194
  Pick<PresentationSVGAttributes, 'display' | 'visibility'> {}
1933
2195
  interface SymbolSVGAttributes<T>
1934
- extends ContainerElementSVGAttributes<T>,
2196
+ extends
2197
+ ContainerElementSVGAttributes<T>,
1935
2198
  NewViewportSVGAttributes<T>,
1936
2199
  ExternalResourceSVGAttributes,
1937
2200
  StylableSVGAttributes,
@@ -1946,7 +2209,8 @@ declare global {
1946
2209
  y?: number | string;
1947
2210
  }
1948
2211
  interface TextSVGAttributes<T>
1949
- extends TextContentElementSVGAttributes<T>,
2212
+ extends
2213
+ TextContentElementSVGAttributes<T>,
1950
2214
  GraphicsElementSVGAttributes<T>,
1951
2215
  ConditionalProcessingSVGAttributes,
1952
2216
  ExternalResourceSVGAttributes,
@@ -1962,7 +2226,8 @@ declare global {
1962
2226
  lengthAdjust?: 'spacing' | 'spacingAndGlyphs';
1963
2227
  }
1964
2228
  interface TextPathSVGAttributes<T>
1965
- extends TextContentElementSVGAttributes<T>,
2229
+ extends
2230
+ TextContentElementSVGAttributes<T>,
1966
2231
  ConditionalProcessingSVGAttributes,
1967
2232
  ExternalResourceSVGAttributes,
1968
2233
  StylableSVGAttributes,
@@ -1976,7 +2241,8 @@ declare global {
1976
2241
  href?: string;
1977
2242
  }
1978
2243
  interface TSpanSVGAttributes<T>
1979
- extends TextContentElementSVGAttributes<T>,
2244
+ extends
2245
+ TextContentElementSVGAttributes<T>,
1980
2246
  ConditionalProcessingSVGAttributes,
1981
2247
  ExternalResourceSVGAttributes,
1982
2248
  StylableSVGAttributes,
@@ -1993,7 +2259,8 @@ declare global {
1993
2259
  lengthAdjust?: 'spacing' | 'spacingAndGlyphs';
1994
2260
  }
1995
2261
  interface UseSVGAttributes<T>
1996
- extends GraphicsElementSVGAttributes<T>,
2262
+ extends
2263
+ GraphicsElementSVGAttributes<T>,
1997
2264
  ConditionalProcessingSVGAttributes,
1998
2265
  ExternalResourceSVGAttributes,
1999
2266
  StylableSVGAttributes,
@@ -2005,7 +2272,8 @@ declare global {
2005
2272
  href?: string;
2006
2273
  }
2007
2274
  interface ViewSVGAttributes<T>
2008
- extends CoreSVGAttributes<T>,
2275
+ extends
2276
+ estSVGAttributes<T>,
2009
2277
  ExternalResourceSVGAttributes,
2010
2278
  FitToViewBoxSVGAttributes,
2011
2279
  ZoomAndPanSVGAttributes {
@@ -2203,223 +2471,246 @@ declare global {
2203
2471
  view: ViewSVGAttributes<SVGViewElement>;
2204
2472
  }
2205
2473
  interface IntrinsicElements
2206
- extends HTMLElementTags,
2207
- HTMLElementDeprecatedTags,
2208
- SVGElementTags {}
2474
+ extends HTMLElementTags, HTMLElementDeprecatedTags, SVGElementTags {}
2209
2475
  }
2210
2476
  }
2211
2477
 
2212
- declare class LifecycleContext {
2213
- addEventListener(): void;
2214
- removeEventListener(): void;
2215
- static ref: LifecycleContext | null;
2216
- static context: Record<symbol, Signal$1<any>>;
2217
- hooks: Record<Hook, Set<() => void>>;
2218
- addHook(hook: Hook, cb: () => void): void;
2219
- getContext<T>(context: symbol | string | number): T | undefined;
2220
- setContext<T>(context: symbol | string | number, value: T): void;
2221
- initRef(): void;
2222
- removeRef(): void;
2223
- clearHooks(): void;
2224
- }
2225
-
2226
- declare class TemplateNode$1 implements JSX.Element {
2227
- template: HTMLTemplateElement;
2228
- props: Props;
2229
- key?: string | undefined;
2230
- protected treeMap: Map<number, Node>;
2231
- protected mounted: boolean;
2232
- protected nodes: Node[];
2233
- protected trackMap: Map<string, NodeTrack>;
2234
- protected bindValueKeys: string[];
2235
- protected componentIndex: number;
2236
- protected parent: Node | null;
2237
- constructor(template: HTMLTemplateElement, props: Props, key?: string | undefined);
2238
- get firstChild(): Node | null;
2239
- get isConnected(): boolean;
2240
- addEventListener(): void;
2241
- removeEventListener(): void;
2242
- mount(parent: Node, before?: Node | null): Node[];
2243
- unmount(): void;
2244
- inheritNode(node: TemplateNode$1): void;
2245
- protected mapSSGNodeTree(parent: Node): void;
2246
- protected mapNodeTree(parent: Node, tree: Node): void;
2247
- protected walkNodeTree(node: Node, handler: (node: Node) => void): void;
2248
- protected handleSSGNode(node: Node): void;
2249
- protected patchProps(props: Record<string, Record<string, unknown>> | undefined): void;
2250
- protected patchProp(key: string, node: Node, props: Record<string, unknown>, isRoot: boolean): void;
2251
- protected getBindUpdateValue(props: Record<string, any>, key: string, attr: string): any;
2252
- protected patchChildren(key: string, node: Node, children: unknown, isRoot: boolean): void;
2253
- protected patchEventListener(key: string, node: Node, attr: string, listener: EventListener): void;
2254
- protected patchAttribute(key: string, element: HTMLElement, attr: string, value: unknown, updateFn?: Function): void;
2255
- protected getNodeTrack(trackKey: string, trackLastNodes?: boolean, isRoot?: boolean): NodeTrack;
2256
- protected patchChild(track: NodeTrack, parent: Node, child: unknown, before: Node | null): void;
2257
- protected reconcileChildren(parent: Node, nextNodes: Node[], before: Node | null): Map<string, Node>;
2258
- }
2478
+ type AnyNode = Node | Component;
2259
2479
 
2260
- declare class ComponentNode$1 extends LifecycleContext implements JSX.Element {
2261
- template: EssorComponent;
2262
- props: Props;
2263
- key?: string | undefined;
2264
- protected proxyProps: Record<string, Signal$1<unknown>>;
2265
- protected emitter: Set<() => void>;
2266
- protected rootNode: TemplateNode$1 | null;
2267
- protected trackMap: Map<string, NodeTrack>;
2268
- protected nodes: Node[];
2269
- protected parent: Node | null;
2270
- protected before: Node | null;
2271
- constructor(template: EssorComponent, props: Props, key?: string | undefined);
2272
- get firstChild(): Node | null;
2273
- get isConnected(): boolean;
2274
- mount(parent: Node, before: Node | null): Node[];
2275
- unmount(): void;
2276
- private resetState;
2277
- protected callLifecycleHooks(type: 'mounted' | 'destroy'): void;
2278
- protected callMountHooks(): void;
2279
- protected callDestroyHooks(): void;
2280
- protected clearEmitter(): void;
2281
- inheritNode(node: ComponentNode$1): void;
2282
- protected getNodeTrack(trackKey: string): NodeTrack;
2283
- patchProps(props: Record<string, any> | undefined): void;
2284
- protected patchEventListener(key: string, prop: any): void;
2285
- protected patchRef(prop: {
2286
- value: Node | null;
2287
- }): void;
2288
- protected patchUpdateHandler(key: string, prop: any): void;
2289
- protected patchNormalProp(key: string, prop: any): void;
2290
- protected cleanup(): void;
2480
+ interface FragmentProps {
2481
+ children?: AnyNode | AnyNode[];
2482
+ key?: string;
2291
2483
  }
2292
-
2293
2484
  /**
2294
- * Creates a JSX element from a given template.
2485
+ * Fragment component - renders multiple children without wrapper elements
2295
2486
  *
2296
- * @param template - The template to render. Can be a string representing an HTML
2297
- * element, a function representing a component, or an `HTMLTemplateElement`.
2298
- * @param props - Properties to pass to the component or element.
2299
- * @param key - The key of the element.
2300
- * @returns The created JSX element.
2487
+ * @param props - Component props with children
2488
+ * @returns DocumentFragment containing all children
2489
+ *
2490
+ * @example
2491
+ * ```tsx
2492
+ * <Fragment>
2493
+ * <div>First</div>
2494
+ * <span>Second</span>
2495
+ * </Fragment>
2496
+ * ```
2301
2497
  */
2302
- declare function h<K extends keyof HTMLElementTagNameMap>(template: EssorComponent | HTMLTemplateElement | K | '', props?: Props, key?: string): JSX.Element;
2498
+ declare function Fragment(props: FragmentProps): DocumentFragment | string;
2499
+ declare namespace Fragment {
2500
+ var fragment: boolean;
2501
+ }
2303
2502
  /**
2304
- * Checks if the given node is an instance of `ComponentNode`.
2305
- *
2306
- * @param node The node to check.
2307
- * @returns `true` if the node is an instance of `ComponentNode`, otherwise `false`.
2503
+ * Check if a node is a Fragment component
2504
+ * @param node - Node to check
2505
+ * @returns true if node is a Fragment
2308
2506
  */
2309
- declare function isComponent(node: unknown): node is ComponentNode$1;
2507
+ declare function isFragment(node: unknown): boolean;
2508
+
2509
+ interface PortalProps {
2510
+ children?: AnyNode | AnyNode[];
2511
+ target: string | HTMLElement;
2512
+ key?: string;
2513
+ }
2310
2514
  /**
2311
- * Checks if the given node is a JSX element. A JSX element is either an instance
2312
- * of `ComponentNode` or an instance of `TemplateNode`.
2515
+ * Portal component - renders children into a different DOM node
2516
+ *
2517
+ * @param props - Component props with children and target
2518
+ * @returns Comment node as placeholder in parent tree
2313
2519
  *
2314
- * @param node The node to check.
2315
- * @returns `true` if the node is a JSX element, otherwise `false`.
2520
+ * @example
2521
+ * ```tsx
2522
+ * <Portal target="#modal-root">
2523
+ * <div>Modal content</div>
2524
+ * </Portal>
2525
+ * ```
2316
2526
  */
2317
- declare function isJsxElement(node: unknown): node is EssorNode;
2527
+ declare function Portal(props: PortalProps): Comment | string;
2528
+ declare namespace Portal {
2529
+ var portal: boolean;
2530
+ }
2318
2531
  /**
2319
- * Creates an HTML template element from a given HTML string.
2320
- *
2321
- * @param html The HTML string to create a template from.
2322
- * @returns A new HTML template element.
2532
+ * Check if a node is a Portal component
2533
+ * @param node - Node to check
2534
+ * @returns true if node is a Portal
2323
2535
  */
2324
- declare function createTemplate(html: string): HTMLTemplateElement;
2325
- declare function Fragment<T extends JSX.JSXElement | string | number | boolean | Array<JSX.JSXElement | string | number | boolean>>(template: HTMLTemplateElement | '', props: {
2326
- children: T;
2327
- } | {
2328
- [key: string]: {
2329
- children: T;
2330
- };
2331
- }): JSX.Element;
2536
+ declare function isPortal(node: unknown): boolean;
2332
2537
 
2538
+ interface SuspenseProps {
2539
+ /** The content to render. Can be a Promise for async loading. */
2540
+ children?: AnyNode | AnyNode[] | Promise<AnyNode | AnyNode[]>;
2541
+ /** Fallback content to display while children is loading (Promise pending). */
2542
+ fallback?: AnyNode;
2543
+ /** Optional key for reconciliation. */
2544
+ key?: string;
2545
+ }
2333
2546
  /**
2334
- * Registers a hook to be called when the component is mounted.
2547
+ * Suspense component - handles async content with a fallback UI
2335
2548
  *
2336
- * @remarks
2337
- * This function can only be called in the component function body.
2338
- * It cannot be used in asynchronous or deferred calls.
2339
- * @param cb - The function to call when the component is mounted.
2340
- */
2341
- declare function onMount(cb: () => void): void;
2342
- /**
2343
- * Registers a hook to be called when the component is about to be unmounted.
2549
+ * @param props - Component props with children, fallback, and optional key
2550
+ * @returns Placeholder node or fallback content
2344
2551
  *
2345
- * @remarks
2346
- * This function can only be called in the component function body.
2347
- * It cannot be used in asynchronous or deferred calls.
2348
- * @param cb - The function to call when the component is about to be unmounted.
2552
+ * @example
2553
+ * ```tsx
2554
+ * <Suspense fallback={<div>Loading...</div>}>
2555
+ * {asyncContent}
2556
+ * </Suspense>
2557
+ * ```
2349
2558
  */
2350
- declare function onDestroy(cb: () => void): void;
2351
- interface InjectionKey<T> extends Symbol {
2559
+ declare const SuspenseContext: unique symbol;
2560
+ interface SuspenseContextType {
2561
+ register: (promise: Promise<any>) => void;
2562
+ increment: () => void;
2563
+ decrement: () => void;
2352
2564
  }
2353
2565
  /**
2354
- * Provides a value to be used in the component tree.
2566
+ * Suspense component - handles async content with a fallback UI
2567
+ *
2568
+ * @param props - Component props with children, fallback, and optional key
2569
+ * @returns Placeholder node or fallback content
2355
2570
  *
2356
- * @remarks
2357
- * This function can only be called in the component function body.
2358
- * It cannot be used in asynchronous or deferred calls.
2359
- * @param key - The key to store the value in the LifecycleContext with.
2360
- * @param value - The value to store in the LifecycleContext with the given key.
2571
+ * @example
2572
+ * ```tsx
2573
+ * <Suspense fallback={<div>Loading...</div>}>
2574
+ * {asyncContent}
2575
+ * </Suspense>
2576
+ * ```
2361
2577
  */
2362
- declare function provide<T, K = InjectionKey<T> | string | number>(key: K, value: K extends InjectionKey<infer V> ? V : T): void;
2578
+ declare function Suspense(props: SuspenseProps): Node | string;
2579
+ declare namespace Suspense {
2580
+ var suspense: boolean;
2581
+ }
2363
2582
  /**
2364
- * Injects a value from the current component LifecycleContext.
2365
- *
2366
- * @remarks
2367
- * This function can only be called in the component function body.
2368
- * It cannot be used in asynchronous or deferred calls.
2369
- * @param key - The key to retrieve the value from the LifecycleContext with.
2370
- * @param defaultValue - The default value to return if the key is not present
2371
- * in the LifecycleContext.
2372
- * @returns The value stored in the LifecycleContext with the given key, or the default
2373
- * value if the key is not present in the LifecycleContext.
2583
+ * Check if a node is a Suspense component
2584
+ * @param node - Node to check
2585
+ * @returns true if node is a Suspense
2374
2586
  */
2375
- declare function inject<T, K = InjectionKey<T> | string | number>(key: K, defaultValue?: K extends InjectionKey<infer V> ? V : T): (K extends InjectionKey<infer V> ? V : T) | undefined;
2587
+ declare function isSuspense(node: unknown): boolean;
2376
2588
 
2377
- declare class SSGNode extends LifecycleContext {
2378
- private template;
2379
- private props;
2380
- key?: string | undefined;
2381
- private templates;
2382
- constructor(template: string[] | SSGNode | ((props: Props) => SSGNode), props?: Props, key?: string | undefined);
2383
- private processTemplate;
2384
- private processHtmlString;
2385
- mount(): string;
2386
- render(): string;
2387
- private renderTemplate;
2388
- private normalizeProps;
2389
- private generateAttributes;
2390
- private renderChildren;
2391
- private renderChild;
2589
+ type ResourceState = 'pending' | 'ready' | 'errored';
2590
+ interface Resource<T> {
2591
+ (): T | undefined;
2592
+ loading: Signal$1<boolean>;
2593
+ error: Signal$1<Error | null>;
2594
+ state: Signal$1<ResourceState>;
2595
+ }
2596
+ interface ResourceActions<T> {
2597
+ mutate: (value: T) => void;
2598
+ refetch: () => Promise<void>;
2599
+ }
2600
+ interface ResourceOptions<T> {
2601
+ initialValue?: T;
2392
2602
  }
2393
-
2394
2603
  /**
2395
- * Render a component to a string.
2604
+ * Create a resource for async data fetching
2605
+ * Inspired by SolidJS createResource
2606
+ *
2607
+ * @param fetcher - Function that returns a Promise with the data
2608
+ * @param options - Optional configuration
2609
+ * @returns Tuple of [resource, actions]
2610
+ *
2611
+ * @example
2612
+ * ```typescript
2613
+ * const [data, { refetch, mutate }] = createResource(
2614
+ * () => fetch('/api/user').then(r => r.json()),
2615
+ * { initialValue: null }
2616
+ * );
2396
2617
  *
2397
- * This function renders a component to an HTML string. It is used for server-side rendering (SSR) and static site generation (SSG).
2618
+ * // Access data
2619
+ * console.log(data());
2620
+ * console.log(data.loading.value);
2621
+ * console.log(data.state.value);
2398
2622
  *
2399
- * @param component The component to render.
2400
- * @param props Optional props to pass to the component.
2401
- * @returns The rendered HTML string.
2623
+ * // Refetch data
2624
+ * await refetch();
2625
+ *
2626
+ * // Update data directly
2627
+ * mutate({ name: 'John' });
2628
+ * ```
2402
2629
  */
2403
- declare function renderToString(component: EssorComponent, props?: Props): string;
2630
+ declare function createResource<T>(fetcher: () => Promise<T>, options?: ResourceOptions<T>): [Resource<T>, ResourceActions<T>];
2631
+
2404
2632
  /**
2405
- * Hydrate a component in a container.
2406
2633
  *
2407
- * This function hydrates a component in a container element. It is used for server-side rendering (SSR) and client-side rendering (CSR).
2634
+ * ssg compile
2635
+ *
2636
+ * component context it will this:
2408
2637
  *
2409
- * @param component The component to hydrate.
2410
- * @param container The container element to hydrate in. Can be a string selector or an Element.
2411
- * @throws Error if the container is not found.
2638
+ * function component(props) {
2639
+ * // render function props: template, hydrationKey, ...components
2640
+ * return render(_tmpl, getHydrationKey(), createSSGComponent(xx, {}));
2641
+ * }
2642
+ *
2643
+ * renderToString(component, props)
2644
+ *
2645
+ *
2646
+ */
2647
+ /**
2648
+ * render the component to string
2649
+ * @param {ComponentFn} component - the component to render
2650
+ * @param {ComponentProps} props - the props to pass to the component
2651
+ * @returns {string} the rendered string
2652
+ */
2653
+ declare function renderToString(component: ComponentFn, props?: ComponentProps): string;
2654
+ /**
2655
+ * render the component to string
2656
+ * @param {string[]} templates - the template to render
2657
+ * @param {string} hydrationKey - the hydration key
2658
+ * @param {...string[]} components - the components to render
2659
+ * @returns {string} the rendered string
2660
+ */
2661
+ declare function render(templates: string[], hydrationKey: string, ...components: string[]): string;
2662
+ /**
2663
+ * create a ssg component
2664
+ * @param {ComponentFn} component - the component to create
2665
+ * @param {ComponentProps} props - the props to pass to the component
2666
+ * @returns {string} the created component as a string
2412
2667
  */
2413
- declare function hydrate(component: EssorComponent, container: string | Element): void;
2668
+ declare function createSSGComponent(component: ComponentFn, props?: ComponentProps): string;
2669
+
2414
2670
  /**
2415
- * Create a server-side generation (SSG) node from a component.
2671
+ * get the hydration key
2672
+ * @returns {string} the hydration key
2673
+ */
2674
+ declare function getHydrationKey(): string;
2675
+
2676
+ /**
2677
+ * Generate server-side rendering attribute string
2678
+ *
2679
+ * Generate HTML-compatible attribute string based on attribute type, handling special cases:
2680
+ * - Automatic unwrapping of reactive values
2681
+ * - Normalization of special attributes (style/class)
2682
+ * - Ignoring event attributes
2683
+ * - Special handling for boolean attributes
2416
2684
  *
2417
- * If the render context is set to SSG, this function will create a new SSGNode from the component. Otherwise, it will create a new JSX element using the h function.
2685
+ * @param attrName Attribute name
2686
+ * @param attrValue Attribute value
2687
+ * @param hydrationId Hydration ID (for client-side reuse)
2688
+ * @returns Formatted HTML attribute string
2689
+ */
2690
+ declare function setSSGAttr(attrName: string, attrValue: any, hydrationId: string): string;
2691
+
2692
+ /**
2693
+ * Server-side node mapping utilities
2694
+ */
2695
+ /**
2696
+ * getRenderedElement function - gets an element based on string template
2697
+ */
2698
+ declare function getRenderedElement(temp: string): () => Node;
2699
+ /**
2700
+ * Maps server-side rendered nodes during hydration
2701
+ * @param {HTMLElement} template - The root template element
2702
+ * @param {number[]} idx - Array of indices to map
2703
+ * @returns {Node[]} Array of mapped nodes
2704
+ */
2705
+ declare function mapSSRNodes(template: HTMLElement, idx: number[]): Node[];
2706
+ /**
2707
+ * Hydrates a server-rendered component
2418
2708
  *
2419
- * @param component The component to create the SSGNode from.
2420
- * @param props Optional props to pass to the component.
2421
- * @returns The SSGNode or JSX element.
2709
+ * @param {Function} component - Component function to hydrate
2710
+ * @param {HTMLElement | string} container - Container element or selector
2711
+ * @param {Record<string, unknown>} props - Component properties
2712
+ * @returns {any} Component instance or undefined if hydration fails
2422
2713
  */
2423
- declare function ssg(component: EssorComponent, props?: Props): SSGNode | JSX.Element;
2714
+ declare function hydrate(component: (props?: any) => any, container: HTMLElement | string, props?: Record<string, unknown>): any;
2424
2715
 
2425
- export { Fragment, type InjectionKey, h, hydrate, inject, isComponent, isJsxElement, onDestroy, onMount, provide, renderToString, ssg, createTemplate as template };
2716
+ export { Component, type ComponentFn, type ComponentProps, Fragment, type FragmentProps, type InjectionKey, Portal, type PortalProps, type Resource, type ResourceActions, type ResourceOptions, type ResourceState, Suspense, SuspenseContext, type SuspenseContextType, type SuspenseProps, addEvent, addEventListener, bindElement, createApp, createComponent, createResource, createSSGComponent, delegateEvents, getHydrationKey, getRenderedElement, hydrate, inject, insert, isComponent, isFragment, isPortal, isSuspense, mapNodes, mapSSRNodes, normalizeClass, onDestroy, onMount, onUpdate, patchAttr, patchClass, patchStyle, provide, render, renderToString, setSSGAttr, setStyle, template };