@estjs/template 0.0.14-beta.9 → 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,14 +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;
131
+
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;
159
+ }
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[];
6
180
 
7
- type Props = Record<string, any>;
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;
8
187
 
9
- interface EssorNode<T = Record<string, any>> {
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;
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;
256
+
257
+ type estComponent = (props: Record<string, unknown>) => JSX.Element | TemplateNode;
258
+
259
+ interface estNode<T = Record<string, any>> {
10
260
  props?: T;
11
- template: EssorComponent | HTMLTemplateElement;
261
+ template: estComponent | HTMLTemplateElement;
12
262
 
13
263
  get firstChild(): Node | null;
14
264
  get isConnected(): boolean;
@@ -31,8 +281,8 @@ declare const SERIALIZABLE: unique symbol;
31
281
 
32
282
  declare global {
33
283
  export namespace JSX {
34
- export type Element = EssorNode;
35
- export type JSXElement = EssorNode;
284
+ export type Element = estNode;
285
+ export type JSXElement = estNode;
36
286
 
37
287
  type Children =
38
288
  | string
@@ -56,14 +306,12 @@ declare global {
56
306
  interface ElementChildrenAttribute {
57
307
  children: {};
58
308
  }
59
- interface EventHandler<T, E extends Event> {
60
- (
61
- e: E & {
62
- currentTarget: T;
63
- target: DOMElement;
64
- },
65
- ): void;
66
- }
309
+ type EventHandler<T, E extends Event> = (
310
+ e: E & {
311
+ currentTarget: T;
312
+ target: DOMElement;
313
+ },
314
+ ) => void;
67
315
  interface BoundEventHandler<T, E extends Event> {
68
316
  0: (
69
317
  data: any,
@@ -76,16 +324,14 @@ declare global {
76
324
  }
77
325
  type EventHandlerUnion<T, E extends Event> = EventHandler<T, E> | BoundEventHandler<T, E>;
78
326
 
79
- interface InputEventHandler<T, E extends InputEvent> {
80
- (
81
- e: E & {
82
- currentTarget: T;
83
- target: T extends HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement
84
- ? T
85
- : DOMElement;
86
- },
87
- ): void;
88
- }
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;
89
335
  interface BoundInputEventHandler<T, E extends InputEvent> {
90
336
  0: (
91
337
  data: any,
@@ -102,16 +348,14 @@ declare global {
102
348
  | InputEventHandler<T, E>
103
349
  | BoundInputEventHandler<T, E>;
104
350
 
105
- interface ChangeEventHandler<T, E extends Event> {
106
- (
107
- e: E & {
108
- currentTarget: T;
109
- target: T extends HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement
110
- ? T
111
- : DOMElement;
112
- },
113
- ): void;
114
- }
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;
115
359
  interface BoundChangeEventHandler<T, E extends Event> {
116
360
  0: (
117
361
  data: any,
@@ -128,16 +372,14 @@ declare global {
128
372
  | ChangeEventHandler<T, E>
129
373
  | BoundChangeEventHandler<T, E>;
130
374
 
131
- interface FocusEventHandler<T, E extends FocusEvent> {
132
- (
133
- e: E & {
134
- currentTarget: T;
135
- target: T extends HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement
136
- ? T
137
- : DOMElement;
138
- },
139
- ): void;
140
- }
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;
141
383
  interface BoundFocusEventHandler<T, E extends FocusEvent> {
142
384
  0: (
143
385
  data: any,
@@ -166,10 +408,10 @@ declare global {
166
408
  ref?: Signal<T> | ((el: T) => void);
167
409
  key?: string | number | symbol;
168
410
  }
169
- type Accessor<T> = () => T;
411
+ type Accest<T> = () => T;
170
412
  interface Directives {}
171
413
  interface DirectiveFunctions {
172
- [x: string]: (el: DOMElement, accessor: Accessor<any>) => void;
414
+ [x: string]: (el: DOMElement, accest: Accest<any>) => void;
173
415
  }
174
416
  interface ExplicitProperties<T> {
175
417
  value: Signal<T>;
@@ -189,7 +431,8 @@ declare global {
189
431
  [Key in keyof ExplicitProperties]?: ExplicitProperties<T>[Key];
190
432
  };
191
433
  interface DOMAttributes<T>
192
- extends CustomAttributes<T>,
434
+ extends
435
+ CustomAttributes<T>,
193
436
  PropAttributes<T>,
194
437
  OnCaptureAttributes<T>,
195
438
  CustomEventHandlersCamelCase<T>,
@@ -423,7 +666,7 @@ declare global {
423
666
  | 'allow-orientation-lock'
424
667
  | 'allow-pointer-lock'
425
668
  | 'allow-popups'
426
- | 'allow-popups-to-escape-sandbox'
669
+ | 'allow-popups-to-escapeHTML-sandbox'
427
670
  | 'allow-presentation'
428
671
  | 'allow-same-origin'
429
672
  | 'allow-scripts'
@@ -556,7 +799,7 @@ declare global {
556
799
  'aria-labelledby'?: string;
557
800
  /** Defines the hierarchical level of an element within a structure. */
558
801
  'aria-level'?: number | string;
559
- /** 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. */
560
803
  'aria-live'?: 'off' | 'assertive' | 'polite';
561
804
  /** Indicates whether an element is modal when displayed. */
562
805
  'aria-modal'?: boolean | 'false' | 'true';
@@ -1225,7 +1468,7 @@ declare global {
1225
1468
  | 'defer xMidYMax slice'
1226
1469
  | 'defer xMaxYMax slice';
1227
1470
  type SVGUnits = 'userSpaceOnUse' | 'objectBoundingBox';
1228
- interface CoreSVGAttributes<T> extends AriaAttributes, DOMAttributes<T> {
1471
+ interface estSVGAttributes<T> extends AriaAttributes, DOMAttributes<T> {
1229
1472
  id?: string;
1230
1473
  lang?: string;
1231
1474
  tabIndex?: number | string;
@@ -1383,11 +1626,13 @@ declare global {
1383
1626
  'writing-mode'?: 'lr-tb' | 'rl-tb' | 'tb-rl' | 'lr' | 'rl' | 'tb' | 'inherit';
1384
1627
  }
1385
1628
  interface AnimationElementSVGAttributes<T>
1386
- extends CoreSVGAttributes<T>,
1629
+ extends
1630
+ estSVGAttributes<T>,
1387
1631
  ExternalResourceSVGAttributes,
1388
1632
  ConditionalProcessingSVGAttributes {}
1389
1633
  interface ContainerElementSVGAttributes<T>
1390
- extends CoreSVGAttributes<T>,
1634
+ extends
1635
+ estSVGAttributes<T>,
1391
1636
  ShapeElementSVGAttributes<T>,
1392
1637
  Pick<
1393
1638
  PresentationSVGAttributes,
@@ -1401,8 +1646,7 @@ declare global {
1401
1646
  | 'color-rendering'
1402
1647
  > {}
1403
1648
  interface FilterPrimitiveElementSVGAttributes<T>
1404
- extends CoreSVGAttributes<T>,
1405
- Pick<PresentationSVGAttributes, 'color-interpolation-filters'> {
1649
+ extends estSVGAttributes<T>, Pick<PresentationSVGAttributes, 'color-interpolation-filters'> {
1406
1650
  x?: number | string;
1407
1651
  y?: number | string;
1408
1652
  width?: number | string;
@@ -1421,16 +1665,15 @@ declare global {
1421
1665
  preserveAspectRatio?: SVGPreserveAspectRatio;
1422
1666
  }
1423
1667
  interface GradientElementSVGAttributes<T>
1424
- extends CoreSVGAttributes<T>,
1425
- ExternalResourceSVGAttributes,
1426
- StylableSVGAttributes {
1668
+ extends estSVGAttributes<T>, ExternalResourceSVGAttributes, StylableSVGAttributes {
1427
1669
  gradientUnits?: SVGUnits;
1428
1670
  gradientTransform?: string;
1429
1671
  spreadMethod?: 'pad' | 'reflect' | 'repeat';
1430
1672
  href?: string;
1431
1673
  }
1432
1674
  interface GraphicsElementSVGAttributes<T>
1433
- extends CoreSVGAttributes<T>,
1675
+ extends
1676
+ estSVGAttributes<T>,
1434
1677
  Pick<
1435
1678
  PresentationSVGAttributes,
1436
1679
  | 'clip-rule'
@@ -1444,14 +1687,14 @@ declare global {
1444
1687
  | 'color-interpolation'
1445
1688
  | 'color-rendering'
1446
1689
  > {}
1447
- interface LightSourceElementSVGAttributes<T> extends CoreSVGAttributes<T> {}
1690
+ interface LightSourceElementSVGAttributes<T> extends estSVGAttributes<T> {}
1448
1691
  interface NewViewportSVGAttributes<T>
1449
- extends CoreSVGAttributes<T>,
1450
- Pick<PresentationSVGAttributes, 'overflow' | 'clip'> {
1692
+ extends estSVGAttributes<T>, Pick<PresentationSVGAttributes, 'overflow' | 'clip'> {
1451
1693
  viewBox?: string;
1452
1694
  }
1453
1695
  interface ShapeElementSVGAttributes<T>
1454
- extends CoreSVGAttributes<T>,
1696
+ extends
1697
+ estSVGAttributes<T>,
1455
1698
  Pick<
1456
1699
  PresentationSVGAttributes,
1457
1700
  | 'color'
@@ -1470,7 +1713,8 @@ declare global {
1470
1713
  | 'pathLength'
1471
1714
  > {}
1472
1715
  interface TextContentElementSVGAttributes<T>
1473
- extends CoreSVGAttributes<T>,
1716
+ extends
1717
+ estSVGAttributes<T>,
1474
1718
  Pick<
1475
1719
  PresentationSVGAttributes,
1476
1720
  | 'font-family'
@@ -1507,14 +1751,16 @@ declare global {
1507
1751
  zoomAndPan?: 'disable' | 'magnify';
1508
1752
  }
1509
1753
  interface AnimateSVGAttributes<T>
1510
- extends AnimationElementSVGAttributes<T>,
1754
+ extends
1755
+ AnimationElementSVGAttributes<T>,
1511
1756
  AnimationAttributeTargetSVGAttributes,
1512
1757
  AnimationTimingSVGAttributes,
1513
1758
  AnimationValueSVGAttributes,
1514
1759
  AnimationAdditionSVGAttributes,
1515
1760
  Pick<PresentationSVGAttributes, 'color-interpolation' | 'color-rendering'> {}
1516
1761
  interface AnimateMotionSVGAttributes<T>
1517
- extends AnimationElementSVGAttributes<T>,
1762
+ extends
1763
+ AnimationElementSVGAttributes<T>,
1518
1764
  AnimationTimingSVGAttributes,
1519
1765
  AnimationValueSVGAttributes,
1520
1766
  AnimationAdditionSVGAttributes {
@@ -1524,7 +1770,8 @@ declare global {
1524
1770
  origin?: 'default';
1525
1771
  }
1526
1772
  interface AnimateTransformSVGAttributes<T>
1527
- extends AnimationElementSVGAttributes<T>,
1773
+ extends
1774
+ AnimationElementSVGAttributes<T>,
1528
1775
  AnimationAttributeTargetSVGAttributes,
1529
1776
  AnimationTimingSVGAttributes,
1530
1777
  AnimationValueSVGAttributes,
@@ -1532,7 +1779,8 @@ declare global {
1532
1779
  type?: 'translate' | 'scale' | 'rotate' | 'skewX' | 'skewY';
1533
1780
  }
1534
1781
  interface CircleSVGAttributes<T>
1535
- extends GraphicsElementSVGAttributes<T>,
1782
+ extends
1783
+ GraphicsElementSVGAttributes<T>,
1536
1784
  ShapeElementSVGAttributes<T>,
1537
1785
  ConditionalProcessingSVGAttributes,
1538
1786
  StylableSVGAttributes,
@@ -1542,7 +1790,8 @@ declare global {
1542
1790
  r?: number | string;
1543
1791
  }
1544
1792
  interface ClipPathSVGAttributes<T>
1545
- extends CoreSVGAttributes<T>,
1793
+ extends
1794
+ estSVGAttributes<T>,
1546
1795
  ConditionalProcessingSVGAttributes,
1547
1796
  ExternalResourceSVGAttributes,
1548
1797
  StylableSVGAttributes,
@@ -1551,14 +1800,16 @@ declare global {
1551
1800
  clipPathUnits?: SVGUnits;
1552
1801
  }
1553
1802
  interface DefsSVGAttributes<T>
1554
- extends ContainerElementSVGAttributes<T>,
1803
+ extends
1804
+ ContainerElementSVGAttributes<T>,
1555
1805
  ConditionalProcessingSVGAttributes,
1556
1806
  ExternalResourceSVGAttributes,
1557
1807
  StylableSVGAttributes,
1558
1808
  TransformableSVGAttributes {}
1559
- interface DescSVGAttributes<T> extends CoreSVGAttributes<T>, StylableSVGAttributes {}
1809
+ interface DescSVGAttributes<T> extends estSVGAttributes<T>, StylableSVGAttributes {}
1560
1810
  interface EllipseSVGAttributes<T>
1561
- extends GraphicsElementSVGAttributes<T>,
1811
+ extends
1812
+ GraphicsElementSVGAttributes<T>,
1562
1813
  ShapeElementSVGAttributes<T>,
1563
1814
  ConditionalProcessingSVGAttributes,
1564
1815
  ExternalResourceSVGAttributes,
@@ -1570,24 +1821,28 @@ declare global {
1570
1821
  ry?: number | string;
1571
1822
  }
1572
1823
  interface FeBlendSVGAttributes<T>
1573
- extends FilterPrimitiveElementSVGAttributes<T>,
1824
+ extends
1825
+ FilterPrimitiveElementSVGAttributes<T>,
1574
1826
  DoubleInputFilterSVGAttributes,
1575
1827
  StylableSVGAttributes {
1576
1828
  mode?: 'normal' | 'multiply' | 'screen' | 'darken' | 'lighten';
1577
1829
  }
1578
1830
  interface FeColorMatrixSVGAttributes<T>
1579
- extends FilterPrimitiveElementSVGAttributes<T>,
1831
+ extends
1832
+ FilterPrimitiveElementSVGAttributes<T>,
1580
1833
  SingleInputFilterSVGAttributes,
1581
1834
  StylableSVGAttributes {
1582
1835
  type?: 'matrix' | 'saturate' | 'hueRotate' | 'luminanceToAlpha';
1583
1836
  values?: string;
1584
1837
  }
1585
1838
  interface FeComponentTransferSVGAttributes<T>
1586
- extends FilterPrimitiveElementSVGAttributes<T>,
1839
+ extends
1840
+ FilterPrimitiveElementSVGAttributes<T>,
1587
1841
  SingleInputFilterSVGAttributes,
1588
1842
  StylableSVGAttributes {}
1589
1843
  interface FeCompositeSVGAttributes<T>
1590
- extends FilterPrimitiveElementSVGAttributes<T>,
1844
+ extends
1845
+ FilterPrimitiveElementSVGAttributes<T>,
1591
1846
  DoubleInputFilterSVGAttributes,
1592
1847
  StylableSVGAttributes {
1593
1848
  operator?: 'over' | 'in' | 'out' | 'atop' | 'xor' | 'arithmetic';
@@ -1597,7 +1852,8 @@ declare global {
1597
1852
  k4?: number | string;
1598
1853
  }
1599
1854
  interface FeConvolveMatrixSVGAttributes<T>
1600
- extends FilterPrimitiveElementSVGAttributes<T>,
1855
+ extends
1856
+ FilterPrimitiveElementSVGAttributes<T>,
1601
1857
  SingleInputFilterSVGAttributes,
1602
1858
  StylableSVGAttributes {
1603
1859
  order?: number | string;
@@ -1611,7 +1867,8 @@ declare global {
1611
1867
  preserveAlpha?: 'true' | 'false';
1612
1868
  }
1613
1869
  interface FeDiffuseLightingSVGAttributes<T>
1614
- extends FilterPrimitiveElementSVGAttributes<T>,
1870
+ extends
1871
+ FilterPrimitiveElementSVGAttributes<T>,
1615
1872
  SingleInputFilterSVGAttributes,
1616
1873
  StylableSVGAttributes,
1617
1874
  Pick<PresentationSVGAttributes, 'color' | 'lighting-color'> {
@@ -1620,7 +1877,8 @@ declare global {
1620
1877
  kernelUnitLength?: number | string;
1621
1878
  }
1622
1879
  interface FeDisplacementMapSVGAttributes<T>
1623
- extends FilterPrimitiveElementSVGAttributes<T>,
1880
+ extends
1881
+ FilterPrimitiveElementSVGAttributes<T>,
1624
1882
  DoubleInputFilterSVGAttributes,
1625
1883
  StylableSVGAttributes {
1626
1884
  scale?: number | string;
@@ -1632,7 +1890,8 @@ declare global {
1632
1890
  elevation?: number | string;
1633
1891
  }
1634
1892
  interface FeDropShadowSVGAttributes<T>
1635
- extends CoreSVGAttributes<T>,
1893
+ extends
1894
+ estSVGAttributes<T>,
1636
1895
  FilterPrimitiveElementSVGAttributes<T>,
1637
1896
  StylableSVGAttributes,
1638
1897
  Pick<PresentationSVGAttributes, 'color' | 'flood-color' | 'flood-opacity'> {
@@ -1641,10 +1900,11 @@ declare global {
1641
1900
  stdDeviation?: number | string;
1642
1901
  }
1643
1902
  interface FeFloodSVGAttributes<T>
1644
- extends FilterPrimitiveElementSVGAttributes<T>,
1903
+ extends
1904
+ FilterPrimitiveElementSVGAttributes<T>,
1645
1905
  StylableSVGAttributes,
1646
1906
  Pick<PresentationSVGAttributes, 'color' | 'flood-color' | 'flood-opacity'> {}
1647
- interface FeFuncSVGAttributes<T> extends CoreSVGAttributes<T> {
1907
+ interface FeFuncSVGAttributes<T> extends estSVGAttributes<T> {
1648
1908
  type?: 'identity' | 'table' | 'discrete' | 'linear' | 'gamma';
1649
1909
  tableValues?: string;
1650
1910
  slope?: number | string;
@@ -1654,33 +1914,35 @@ declare global {
1654
1914
  offset?: number | string;
1655
1915
  }
1656
1916
  interface FeGaussianBlurSVGAttributes<T>
1657
- extends FilterPrimitiveElementSVGAttributes<T>,
1917
+ extends
1918
+ FilterPrimitiveElementSVGAttributes<T>,
1658
1919
  SingleInputFilterSVGAttributes,
1659
1920
  StylableSVGAttributes {
1660
1921
  stdDeviation?: number | string;
1661
1922
  }
1662
1923
  interface FeImageSVGAttributes<T>
1663
- extends FilterPrimitiveElementSVGAttributes<T>,
1924
+ extends
1925
+ FilterPrimitiveElementSVGAttributes<T>,
1664
1926
  ExternalResourceSVGAttributes,
1665
1927
  StylableSVGAttributes {
1666
1928
  preserveAspectRatio?: SVGPreserveAspectRatio;
1667
1929
  href?: string;
1668
1930
  }
1669
1931
  interface FeMergeSVGAttributes<T>
1670
- extends FilterPrimitiveElementSVGAttributes<T>,
1671
- StylableSVGAttributes {}
1932
+ extends FilterPrimitiveElementSVGAttributes<T>, StylableSVGAttributes {}
1672
1933
  interface FeMergeNodeSVGAttributes<T>
1673
- extends CoreSVGAttributes<T>,
1674
- SingleInputFilterSVGAttributes {}
1934
+ extends estSVGAttributes<T>, SingleInputFilterSVGAttributes {}
1675
1935
  interface FeMorphologySVGAttributes<T>
1676
- extends FilterPrimitiveElementSVGAttributes<T>,
1936
+ extends
1937
+ FilterPrimitiveElementSVGAttributes<T>,
1677
1938
  SingleInputFilterSVGAttributes,
1678
1939
  StylableSVGAttributes {
1679
1940
  operator?: 'erode' | 'dilate';
1680
1941
  radius?: number | string;
1681
1942
  }
1682
1943
  interface FeOffsetSVGAttributes<T>
1683
- extends FilterPrimitiveElementSVGAttributes<T>,
1944
+ extends
1945
+ FilterPrimitiveElementSVGAttributes<T>,
1684
1946
  SingleInputFilterSVGAttributes,
1685
1947
  StylableSVGAttributes {
1686
1948
  dx?: number | string;
@@ -1692,7 +1954,8 @@ declare global {
1692
1954
  z?: number | string;
1693
1955
  }
1694
1956
  interface FeSpecularLightingSVGAttributes<T>
1695
- extends FilterPrimitiveElementSVGAttributes<T>,
1957
+ extends
1958
+ FilterPrimitiveElementSVGAttributes<T>,
1696
1959
  SingleInputFilterSVGAttributes,
1697
1960
  StylableSVGAttributes,
1698
1961
  Pick<PresentationSVGAttributes, 'color' | 'lighting-color'> {
@@ -1712,12 +1975,12 @@ declare global {
1712
1975
  limitingConeAngle?: number | string;
1713
1976
  }
1714
1977
  interface FeTileSVGAttributes<T>
1715
- extends FilterPrimitiveElementSVGAttributes<T>,
1978
+ extends
1979
+ FilterPrimitiveElementSVGAttributes<T>,
1716
1980
  SingleInputFilterSVGAttributes,
1717
1981
  StylableSVGAttributes {}
1718
1982
  interface FeTurbulanceSVGAttributes<T>
1719
- extends FilterPrimitiveElementSVGAttributes<T>,
1720
- StylableSVGAttributes {
1983
+ extends FilterPrimitiveElementSVGAttributes<T>, StylableSVGAttributes {
1721
1984
  baseFrequency?: number | string;
1722
1985
  numOctaves?: number | string;
1723
1986
  seed?: number | string;
@@ -1725,9 +1988,7 @@ declare global {
1725
1988
  type?: 'fractalNoise' | 'turbulence';
1726
1989
  }
1727
1990
  interface FilterSVGAttributes<T>
1728
- extends CoreSVGAttributes<T>,
1729
- ExternalResourceSVGAttributes,
1730
- StylableSVGAttributes {
1991
+ extends estSVGAttributes<T>, ExternalResourceSVGAttributes, StylableSVGAttributes {
1731
1992
  filterUnits?: SVGUnits;
1732
1993
  primitiveUnits?: SVGUnits;
1733
1994
  x?: number | string;
@@ -1737,7 +1998,8 @@ declare global {
1737
1998
  filterRes?: number | string;
1738
1999
  }
1739
2000
  interface ForeignObjectSVGAttributes<T>
1740
- extends NewViewportSVGAttributes<T>,
2001
+ extends
2002
+ NewViewportSVGAttributes<T>,
1741
2003
  ConditionalProcessingSVGAttributes,
1742
2004
  ExternalResourceSVGAttributes,
1743
2005
  StylableSVGAttributes,
@@ -1749,14 +2011,16 @@ declare global {
1749
2011
  height?: number | string;
1750
2012
  }
1751
2013
  interface GSVGAttributes<T>
1752
- extends ContainerElementSVGAttributes<T>,
2014
+ extends
2015
+ ContainerElementSVGAttributes<T>,
1753
2016
  ConditionalProcessingSVGAttributes,
1754
2017
  ExternalResourceSVGAttributes,
1755
2018
  StylableSVGAttributes,
1756
2019
  TransformableSVGAttributes,
1757
2020
  Pick<PresentationSVGAttributes, 'display' | 'visibility'> {}
1758
2021
  interface ImageSVGAttributes<T>
1759
- extends NewViewportSVGAttributes<T>,
2022
+ extends
2023
+ NewViewportSVGAttributes<T>,
1760
2024
  GraphicsElementSVGAttributes<T>,
1761
2025
  ConditionalProcessingSVGAttributes,
1762
2026
  StylableSVGAttributes,
@@ -1770,7 +2034,8 @@ declare global {
1770
2034
  href?: string;
1771
2035
  }
1772
2036
  interface LineSVGAttributes<T>
1773
- extends GraphicsElementSVGAttributes<T>,
2037
+ extends
2038
+ GraphicsElementSVGAttributes<T>,
1774
2039
  ShapeElementSVGAttributes<T>,
1775
2040
  ConditionalProcessingSVGAttributes,
1776
2041
  ExternalResourceSVGAttributes,
@@ -1789,7 +2054,8 @@ declare global {
1789
2054
  y2?: number | string;
1790
2055
  }
1791
2056
  interface MarkerSVGAttributes<T>
1792
- extends ContainerElementSVGAttributes<T>,
2057
+ extends
2058
+ ContainerElementSVGAttributes<T>,
1793
2059
  ExternalResourceSVGAttributes,
1794
2060
  StylableSVGAttributes,
1795
2061
  FitToViewBoxSVGAttributes,
@@ -1802,7 +2068,8 @@ declare global {
1802
2068
  orient?: string;
1803
2069
  }
1804
2070
  interface MaskSVGAttributes<T>
1805
- extends Omit<ContainerElementSVGAttributes<T>, 'opacity' | 'filter'>,
2071
+ extends
2072
+ Omit<ContainerElementSVGAttributes<T>, 'opacity' | 'filter'>,
1806
2073
  ConditionalProcessingSVGAttributes,
1807
2074
  ExternalResourceSVGAttributes,
1808
2075
  StylableSVGAttributes {
@@ -1813,10 +2080,11 @@ declare global {
1813
2080
  width?: number | string;
1814
2081
  height?: number | string;
1815
2082
  }
1816
- interface MetadataSVGAttributes<T> extends CoreSVGAttributes<T> {}
1817
- interface MPathSVGAttributes<T> extends CoreSVGAttributes<T> {}
2083
+ interface MetadataSVGAttributes<T> extends estSVGAttributes<T> {}
2084
+ interface MPathSVGAttributes<T> extends estSVGAttributes<T> {}
1818
2085
  interface PathSVGAttributes<T>
1819
- extends GraphicsElementSVGAttributes<T>,
2086
+ extends
2087
+ GraphicsElementSVGAttributes<T>,
1820
2088
  ShapeElementSVGAttributes<T>,
1821
2089
  ConditionalProcessingSVGAttributes,
1822
2090
  ExternalResourceSVGAttributes,
@@ -1827,7 +2095,8 @@ declare global {
1827
2095
  pathLength?: number | string;
1828
2096
  }
1829
2097
  interface PatternSVGAttributes<T>
1830
- extends ContainerElementSVGAttributes<T>,
2098
+ extends
2099
+ ContainerElementSVGAttributes<T>,
1831
2100
  ConditionalProcessingSVGAttributes,
1832
2101
  ExternalResourceSVGAttributes,
1833
2102
  StylableSVGAttributes,
@@ -1843,7 +2112,8 @@ declare global {
1843
2112
  href?: string;
1844
2113
  }
1845
2114
  interface PolygonSVGAttributes<T>
1846
- extends GraphicsElementSVGAttributes<T>,
2115
+ extends
2116
+ GraphicsElementSVGAttributes<T>,
1847
2117
  ShapeElementSVGAttributes<T>,
1848
2118
  ConditionalProcessingSVGAttributes,
1849
2119
  ExternalResourceSVGAttributes,
@@ -1853,7 +2123,8 @@ declare global {
1853
2123
  points?: string;
1854
2124
  }
1855
2125
  interface PolylineSVGAttributes<T>
1856
- extends GraphicsElementSVGAttributes<T>,
2126
+ extends
2127
+ GraphicsElementSVGAttributes<T>,
1857
2128
  ShapeElementSVGAttributes<T>,
1858
2129
  ConditionalProcessingSVGAttributes,
1859
2130
  ExternalResourceSVGAttributes,
@@ -1870,7 +2141,8 @@ declare global {
1870
2141
  fy?: number | string;
1871
2142
  }
1872
2143
  interface RectSVGAttributes<T>
1873
- extends GraphicsElementSVGAttributes<T>,
2144
+ extends
2145
+ GraphicsElementSVGAttributes<T>,
1874
2146
  ShapeElementSVGAttributes<T>,
1875
2147
  ConditionalProcessingSVGAttributes,
1876
2148
  ExternalResourceSVGAttributes,
@@ -1884,17 +2156,17 @@ declare global {
1884
2156
  ry?: number | string;
1885
2157
  }
1886
2158
  interface SetSVGAttributes<T>
1887
- extends CoreSVGAttributes<T>,
1888
- StylableSVGAttributes,
1889
- AnimationTimingSVGAttributes {}
2159
+ extends estSVGAttributes<T>, StylableSVGAttributes, AnimationTimingSVGAttributes {}
1890
2160
  interface StopSVGAttributes<T>
1891
- extends CoreSVGAttributes<T>,
2161
+ extends
2162
+ estSVGAttributes<T>,
1892
2163
  StylableSVGAttributes,
1893
2164
  Pick<PresentationSVGAttributes, 'color' | 'stop-color' | 'stop-opacity'> {
1894
2165
  offset?: number | string;
1895
2166
  }
1896
2167
  interface SvgSVGAttributes<T>
1897
- extends ContainerElementSVGAttributes<T>,
2168
+ extends
2169
+ ContainerElementSVGAttributes<T>,
1898
2170
  NewViewportSVGAttributes<T>,
1899
2171
  ConditionalProcessingSVGAttributes,
1900
2172
  ExternalResourceSVGAttributes,
@@ -1913,14 +2185,16 @@ declare global {
1913
2185
  xmlns?: string;
1914
2186
  }
1915
2187
  interface SwitchSVGAttributes<T>
1916
- extends ContainerElementSVGAttributes<T>,
2188
+ extends
2189
+ ContainerElementSVGAttributes<T>,
1917
2190
  ConditionalProcessingSVGAttributes,
1918
2191
  ExternalResourceSVGAttributes,
1919
2192
  StylableSVGAttributes,
1920
2193
  TransformableSVGAttributes,
1921
2194
  Pick<PresentationSVGAttributes, 'display' | 'visibility'> {}
1922
2195
  interface SymbolSVGAttributes<T>
1923
- extends ContainerElementSVGAttributes<T>,
2196
+ extends
2197
+ ContainerElementSVGAttributes<T>,
1924
2198
  NewViewportSVGAttributes<T>,
1925
2199
  ExternalResourceSVGAttributes,
1926
2200
  StylableSVGAttributes,
@@ -1935,7 +2209,8 @@ declare global {
1935
2209
  y?: number | string;
1936
2210
  }
1937
2211
  interface TextSVGAttributes<T>
1938
- extends TextContentElementSVGAttributes<T>,
2212
+ extends
2213
+ TextContentElementSVGAttributes<T>,
1939
2214
  GraphicsElementSVGAttributes<T>,
1940
2215
  ConditionalProcessingSVGAttributes,
1941
2216
  ExternalResourceSVGAttributes,
@@ -1951,7 +2226,8 @@ declare global {
1951
2226
  lengthAdjust?: 'spacing' | 'spacingAndGlyphs';
1952
2227
  }
1953
2228
  interface TextPathSVGAttributes<T>
1954
- extends TextContentElementSVGAttributes<T>,
2229
+ extends
2230
+ TextContentElementSVGAttributes<T>,
1955
2231
  ConditionalProcessingSVGAttributes,
1956
2232
  ExternalResourceSVGAttributes,
1957
2233
  StylableSVGAttributes,
@@ -1965,7 +2241,8 @@ declare global {
1965
2241
  href?: string;
1966
2242
  }
1967
2243
  interface TSpanSVGAttributes<T>
1968
- extends TextContentElementSVGAttributes<T>,
2244
+ extends
2245
+ TextContentElementSVGAttributes<T>,
1969
2246
  ConditionalProcessingSVGAttributes,
1970
2247
  ExternalResourceSVGAttributes,
1971
2248
  StylableSVGAttributes,
@@ -1982,7 +2259,8 @@ declare global {
1982
2259
  lengthAdjust?: 'spacing' | 'spacingAndGlyphs';
1983
2260
  }
1984
2261
  interface UseSVGAttributes<T>
1985
- extends GraphicsElementSVGAttributes<T>,
2262
+ extends
2263
+ GraphicsElementSVGAttributes<T>,
1986
2264
  ConditionalProcessingSVGAttributes,
1987
2265
  ExternalResourceSVGAttributes,
1988
2266
  StylableSVGAttributes,
@@ -1994,7 +2272,8 @@ declare global {
1994
2272
  href?: string;
1995
2273
  }
1996
2274
  interface ViewSVGAttributes<T>
1997
- extends CoreSVGAttributes<T>,
2275
+ extends
2276
+ estSVGAttributes<T>,
1998
2277
  ExternalResourceSVGAttributes,
1999
2278
  FitToViewBoxSVGAttributes,
2000
2279
  ZoomAndPanSVGAttributes {
@@ -2192,198 +2471,246 @@ declare global {
2192
2471
  view: ViewSVGAttributes<SVGViewElement>;
2193
2472
  }
2194
2473
  interface IntrinsicElements
2195
- extends HTMLElementTags,
2196
- HTMLElementDeprecatedTags,
2197
- SVGElementTags {}
2474
+ extends HTMLElementTags, HTMLElementDeprecatedTags, SVGElementTags {}
2198
2475
  }
2199
2476
  }
2200
2477
 
2201
- declare class LifecycleContext {
2202
- addEventListener(): void;
2203
- removeEventListener(): void;
2204
- static ref: LifecycleContext | null;
2205
- static context: Record<symbol, Signal$1<any>>;
2206
- hooks: Record<Hook, Set<() => void>>;
2207
- addHook(hook: Hook, cb: () => void): void;
2208
- getContext<T>(context: symbol | string | number): T | undefined;
2209
- setContext<T>(context: symbol | string | number, value: T): void;
2210
- initRef(): void;
2211
- removeRef(): void;
2212
- clearHooks(): void;
2213
- }
2478
+ type AnyNode = Node | Component;
2214
2479
 
2215
- declare class ComponentNode$1 extends LifecycleContext implements JSX.Element {
2216
- template: EssorComponent;
2217
- props?: Props | undefined;
2218
- key?: string | undefined;
2219
- private proxyProps;
2220
- private emitter;
2221
- private rootNode;
2222
- private trackMap;
2223
- constructor(template: EssorComponent, props?: Props | undefined, key?: string | undefined);
2224
- private createProxyProps;
2225
- get firstChild(): Node | null;
2226
- get isConnected(): boolean;
2227
- mount(parent: Node, before?: Node | null): Node[];
2228
- unmount(): void;
2229
- private callMountHooks;
2230
- private callDestroyHooks;
2231
- private clearEmitter;
2232
- inheritNode(node: ComponentNode$1): void;
2233
- private getNodeTrack;
2234
- patchProps(props: Record<string, any> | undefined): void;
2235
- private patchEventListener;
2236
- private patchRef;
2237
- private patchUpdateHandler;
2238
- private patchNormalProp;
2480
+ interface FragmentProps {
2481
+ children?: AnyNode | AnyNode[];
2482
+ key?: string;
2239
2483
  }
2240
-
2241
2484
  /**
2242
- * Creates a JSX element from a given template.
2485
+ * Fragment component - renders multiple children without wrapper elements
2243
2486
  *
2244
- * @param template - The template to render. Can be a string representing an HTML
2245
- * element, a function representing a component, or an `HTMLTemplateElement`.
2246
- * @param props - Properties to pass to the component or element.
2247
- * @param key - The key of the element.
2248
- * @returns The created JSX element.
2249
- */
2250
- declare function h<K extends keyof HTMLElementTagNameMap>(template: EssorComponent | HTMLTemplateElement | K | '', props?: Props, key?: string): JSX.Element;
2251
- /**
2252
- * Checks if the given node is an instance of `ComponentNode`.
2487
+ * @param props - Component props with children
2488
+ * @returns DocumentFragment containing all children
2253
2489
  *
2254
- * @param node The node to check.
2255
- * @returns `true` if the node is an instance of `ComponentNode`, otherwise `false`.
2490
+ * @example
2491
+ * ```tsx
2492
+ * <Fragment>
2493
+ * <div>First</div>
2494
+ * <span>Second</span>
2495
+ * </Fragment>
2496
+ * ```
2256
2497
  */
2257
- declare function isComponent(node: unknown): node is ComponentNode$1;
2498
+ declare function Fragment(props: FragmentProps): DocumentFragment | string;
2499
+ declare namespace Fragment {
2500
+ var fragment: boolean;
2501
+ }
2258
2502
  /**
2259
- * Checks if the given node is a JSX element. A JSX element is either an instance
2260
- * of `ComponentNode` or an instance of `TemplateNode`.
2261
- *
2262
- * @param node The node to check.
2263
- * @returns `true` if the node is a JSX element, 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
2264
2506
  */
2265
- declare function isJsxElement(node: unknown): node is EssorNode;
2507
+ declare function isFragment(node: unknown): boolean;
2508
+
2509
+ interface PortalProps {
2510
+ children?: AnyNode | AnyNode[];
2511
+ target: string | HTMLElement;
2512
+ key?: string;
2513
+ }
2266
2514
  /**
2267
- * Creates an HTML template element from a given HTML string.
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
2268
2519
  *
2269
- * @param html The HTML string to create a template from.
2270
- * @returns A new HTML template element.
2520
+ * @example
2521
+ * ```tsx
2522
+ * <Portal target="#modal-root">
2523
+ * <div>Modal content</div>
2524
+ * </Portal>
2525
+ * ```
2271
2526
  */
2272
- declare function createTemplate(html: string): HTMLTemplateElement;
2527
+ declare function Portal(props: PortalProps): Comment | string;
2528
+ declare namespace Portal {
2529
+ var portal: boolean;
2530
+ }
2273
2531
  /**
2274
- * @param props - An object containing the `children` prop.
2275
- * @param props.children - The children to be rendered. Can be a single JSX element, string, number, boolean,
2276
- * or an array of these. Falsy values in arrays will be filtered out.
2277
- * @returns A JSX element representing the fragment, wrapping the filtered children.
2532
+ * Check if a node is a Portal component
2533
+ * @param node - Node to check
2534
+ * @returns true if node is a Portal
2278
2535
  */
2279
- declare function Fragment<T extends JSX.JSXElement | string | number | boolean | (JSX.JSXElement | string | number | boolean)[]>(props: {
2280
- children: T;
2281
- }): JSX.Element;
2536
+ declare function isPortal(node: unknown): boolean;
2282
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
+ }
2283
2546
  /**
2284
- * Registers a hook to be called when the component is mounted.
2547
+ * Suspense component - handles async content with a fallback UI
2285
2548
  *
2286
- * @remarks
2287
- * This function can only be called in the component function body.
2288
- * It cannot be used in asynchronous or deferred calls.
2289
- * @param cb - The function to call when the component is mounted.
2290
- */
2291
- declare function onMount(cb: () => void): void;
2292
- /**
2293
- * 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
2294
2551
  *
2295
- * @remarks
2296
- * This function can only be called in the component function body.
2297
- * It cannot be used in asynchronous or deferred calls.
2298
- * @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
+ * ```
2299
2558
  */
2300
- declare function onDestroy(cb: () => void): void;
2301
- 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;
2302
2564
  }
2303
2565
  /**
2304
- * Provides a value to be used in the component tree.
2566
+ * Suspense component - handles async content with a fallback UI
2305
2567
  *
2306
- * @remarks
2307
- * This function can only be called in the component function body.
2308
- * It cannot be used in asynchronous or deferred calls.
2309
- * @param key - The key to store the value in the LifecycleContext with.
2310
- * @param value - The value to store in the LifecycleContext with the given key.
2568
+ * @param props - Component props with children, fallback, and optional key
2569
+ * @returns Placeholder node or fallback content
2570
+ *
2571
+ * @example
2572
+ * ```tsx
2573
+ * <Suspense fallback={<div>Loading...</div>}>
2574
+ * {asyncContent}
2575
+ * </Suspense>
2576
+ * ```
2311
2577
  */
2312
- declare function useProvide<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
+ }
2313
2582
  /**
2314
- * Injects a value from the current component LifecycleContext.
2315
- *
2316
- * @remarks
2317
- * This function can only be called in the component function body.
2318
- * It cannot be used in asynchronous or deferred calls.
2319
- * @param key - The key to retrieve the value from the LifecycleContext with.
2320
- * @param defaultValue - The default value to return if the key is not present
2321
- * in the LifecycleContext.
2322
- * @returns The value stored in the LifecycleContext with the given key, or the default
2323
- * 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
2324
2586
  */
2325
- declare function useInject<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;
2588
+
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;
2602
+ }
2326
2603
  /**
2327
- * Creates a reactive ref that can be used to reference a DOM node
2328
- * or a component instance within the component function body.
2604
+ * Create a resource for async data fetching
2605
+ * Inspired by SolidJS createResource
2329
2606
  *
2330
- * @returns a reactive ref signal
2607
+ * @param fetcher - Function that returns a Promise with the data
2608
+ * @param options - Optional configuration
2609
+ * @returns Tuple of [resource, actions]
2331
2610
  *
2332
2611
  * @example
2333
- * const inputRef = useRef<HTMLInputElement>()
2612
+ * ```typescript
2613
+ * const [data, { refetch, mutate }] = createResource(
2614
+ * () => fetch('/api/user').then(r => r.json()),
2615
+ * { initialValue: null }
2616
+ * );
2617
+ *
2618
+ * // Access data
2619
+ * console.log(data());
2620
+ * console.log(data.loading.value);
2621
+ * console.log(data.state.value);
2334
2622
  *
2335
- * <input ref={inputRef} />
2623
+ * // Refetch data
2624
+ * await refetch();
2336
2625
  *
2337
- * inputRef.value // input element
2626
+ * // Update data directly
2627
+ * mutate({ name: 'John' });
2628
+ * ```
2338
2629
  */
2339
- declare function useRef<T>(): Signal$1<T | null>;
2340
-
2341
- declare class SSGNode extends LifecycleContext {
2342
- private template;
2343
- private props;
2344
- key?: string | undefined;
2345
- private templates;
2346
- constructor(template: string[] | SSGNode | ((props: Props) => SSGNode), props?: Props, key?: string | undefined);
2347
- private processTemplate;
2348
- private processHtmlString;
2349
- mount(): string;
2350
- render(): string;
2351
- private renderTemplate;
2352
- private normalizeProps;
2353
- private generateAttributes;
2354
- private renderChildren;
2355
- private renderChild;
2356
- }
2630
+ declare function createResource<T>(fetcher: () => Promise<T>, options?: ResourceOptions<T>): [Resource<T>, ResourceActions<T>];
2357
2631
 
2358
2632
  /**
2359
- * Render a component to a string.
2360
2633
  *
2361
- * This function renders a component to an HTML string. It is used for server-side rendering (SSR) and static site generation (SSG).
2634
+ * ssg compile
2635
+ *
2636
+ * component context it will this:
2637
+ *
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
+ *
2362
2645
  *
2363
- * @param component The component to render.
2364
- * @param props Optional props to pass to the component.
2365
- * @returns The rendered HTML string.
2366
2646
  */
2367
- declare function renderToString(component: EssorComponent, props?: Props): string;
2368
2647
  /**
2369
- * Hydrate a component in a container.
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
2667
+ */
2668
+ declare function createSSGComponent(component: ComponentFn, props?: ComponentProps): string;
2669
+
2670
+ /**
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
2370
2678
  *
2371
- * This function hydrates a component in a container element. It is used for server-side rendering (SSR) and client-side rendering (CSR).
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
2372
2684
  *
2373
- * @param component The component to hydrate.
2374
- * @param container The container element to hydrate in. Can be a string selector or an Element.
2375
- * @throws Error if the container is not found.
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
2376
2689
  */
2377
- declare function hydrate(component: EssorComponent, container: string | Element): void;
2690
+ declare function setSSGAttr(attrName: string, attrValue: any, hydrationId: string): string;
2691
+
2378
2692
  /**
2379
- * Create a server-side generation (SSG) node from a component.
2380
- *
2381
- * 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.
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
2382
2708
  *
2383
- * @param component The component to create the SSGNode from.
2384
- * @param props Optional props to pass to the component.
2385
- * @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
2386
2713
  */
2387
- 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;
2388
2715
 
2389
- export { Fragment, type InjectionKey, h, hydrate, isComponent, isJsxElement, onDestroy, onMount, renderToString, ssg, createTemplate as template, useInject, useProvide, useRef };
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 };