flexium 0.10.6 → 0.12.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (192) hide show
  1. package/README.md +15 -15
  2. package/dist/canvas.d.cts +83 -23
  3. package/dist/canvas.d.ts +83 -23
  4. package/dist/canvas.js +1 -1
  5. package/dist/canvas.js.map +1 -1
  6. package/dist/canvas.mjs +1 -1
  7. package/dist/canvas.mjs.map +1 -1
  8. package/dist/chunk-44RZHCII.mjs +2 -0
  9. package/dist/chunk-44RZHCII.mjs.map +1 -0
  10. package/dist/chunk-7BXR4ZFD.js +2 -0
  11. package/dist/chunk-7BXR4ZFD.js.map +1 -0
  12. package/dist/chunk-7DXFHPWZ.mjs +2 -0
  13. package/dist/chunk-7DXFHPWZ.mjs.map +1 -0
  14. package/dist/chunk-ALTO2MGI.js +2 -0
  15. package/dist/chunk-ALTO2MGI.js.map +1 -0
  16. package/dist/chunk-C452JE6C.js +2 -0
  17. package/dist/chunk-C452JE6C.js.map +1 -0
  18. package/dist/chunk-CPJRQL2C.mjs +2 -0
  19. package/dist/chunk-CPJRQL2C.mjs.map +1 -0
  20. package/dist/chunk-EJ7Z5OMU.mjs +2 -0
  21. package/dist/chunk-EJ7Z5OMU.mjs.map +1 -0
  22. package/dist/chunk-ENWGYQNU.js +2 -0
  23. package/dist/chunk-ENWGYQNU.js.map +1 -0
  24. package/dist/chunk-EXLNKYSH.js +2 -0
  25. package/dist/chunk-EXLNKYSH.js.map +1 -0
  26. package/dist/chunk-LUREDEUB.mjs +2 -0
  27. package/dist/chunk-LUREDEUB.mjs.map +1 -0
  28. package/dist/chunk-LUW7DIEW.js +2 -0
  29. package/dist/chunk-LUW7DIEW.js.map +1 -0
  30. package/dist/chunk-ZCO4NIGC.mjs +2 -0
  31. package/dist/chunk-ZCO4NIGC.mjs.map +1 -0
  32. package/dist/core.d.cts +41 -2
  33. package/dist/core.d.ts +41 -2
  34. package/dist/core.js +1 -1
  35. package/dist/core.mjs +1 -1
  36. package/dist/dom.d.cts +10 -33
  37. package/dist/dom.d.ts +10 -33
  38. package/dist/dom.js +1 -1
  39. package/dist/dom.js.map +1 -1
  40. package/dist/dom.mjs +1 -1
  41. package/dist/dom.mjs.map +1 -1
  42. package/dist/index.d.cts +1 -24
  43. package/dist/index.d.ts +1 -24
  44. package/dist/index.js +1 -1
  45. package/dist/index.js.map +1 -1
  46. package/dist/index.mjs +1 -1
  47. package/dist/index.mjs.map +1 -1
  48. package/dist/interactive.d.cts +65 -148
  49. package/dist/interactive.d.ts +65 -148
  50. package/dist/interactive.js +1 -1
  51. package/dist/interactive.js.map +1 -1
  52. package/dist/interactive.mjs +1 -1
  53. package/dist/interactive.mjs.map +1 -1
  54. package/dist/jsx-dev-runtime.d.cts +6 -2
  55. package/dist/jsx-dev-runtime.d.ts +6 -2
  56. package/dist/jsx-dev-runtime.js +1 -1
  57. package/dist/jsx-dev-runtime.js.map +1 -1
  58. package/dist/jsx-dev-runtime.mjs +1 -1
  59. package/dist/jsx-dev-runtime.mjs.map +1 -1
  60. package/dist/jsx-runtime.d.cts +6 -68
  61. package/dist/jsx-runtime.d.ts +6 -68
  62. package/dist/jsx-runtime.js +1 -1
  63. package/dist/jsx-runtime.mjs +1 -1
  64. package/dist/metafile-cjs.json +1 -1
  65. package/dist/metafile-esm.json +1 -1
  66. package/dist/router.d.cts +48 -15
  67. package/dist/router.d.ts +48 -15
  68. package/dist/router.js +1 -1
  69. package/dist/router.js.map +1 -1
  70. package/dist/router.mjs +1 -1
  71. package/dist/router.mjs.map +1 -1
  72. package/package.json +13 -53
  73. package/dist/DrawText-CVAKQ5wZ.d.cts +0 -309
  74. package/dist/DrawText-Dlh1L1Ar.d.ts +0 -309
  75. package/dist/Motion-BrOAJzgH.d.cts +0 -87
  76. package/dist/Motion-BrOAJzgH.d.ts +0 -87
  77. package/dist/advanced.d.cts +0 -32
  78. package/dist/advanced.d.ts +0 -32
  79. package/dist/advanced.js +0 -2
  80. package/dist/advanced.js.map +0 -1
  81. package/dist/advanced.mjs +0 -2
  82. package/dist/advanced.mjs.map +0 -1
  83. package/dist/chunk-2L2QFYBL.mjs +0 -2
  84. package/dist/chunk-2L2QFYBL.mjs.map +0 -1
  85. package/dist/chunk-ANJNQW77.js +0 -2
  86. package/dist/chunk-ANJNQW77.js.map +0 -1
  87. package/dist/chunk-BYHIHYRR.mjs +0 -2
  88. package/dist/chunk-BYHIHYRR.mjs.map +0 -1
  89. package/dist/chunk-DZ7L3SHV.js +0 -2
  90. package/dist/chunk-DZ7L3SHV.js.map +0 -1
  91. package/dist/chunk-E5WYPGCV.mjs +0 -3
  92. package/dist/chunk-E5WYPGCV.mjs.map +0 -1
  93. package/dist/chunk-ECYYIQEX.mjs +0 -3
  94. package/dist/chunk-ECYYIQEX.mjs.map +0 -1
  95. package/dist/chunk-ERIXVRJ4.mjs +0 -3
  96. package/dist/chunk-ERIXVRJ4.mjs.map +0 -1
  97. package/dist/chunk-F23GIQDE.mjs +0 -2
  98. package/dist/chunk-F23GIQDE.mjs.map +0 -1
  99. package/dist/chunk-FDMJHFN7.mjs +0 -2
  100. package/dist/chunk-FDMJHFN7.mjs.map +0 -1
  101. package/dist/chunk-GKJQEOP7.mjs +0 -2
  102. package/dist/chunk-GKJQEOP7.mjs.map +0 -1
  103. package/dist/chunk-GYDP6MFV.js +0 -3
  104. package/dist/chunk-GYDP6MFV.js.map +0 -1
  105. package/dist/chunk-HB5VPQTB.mjs +0 -2
  106. package/dist/chunk-HB5VPQTB.mjs.map +0 -1
  107. package/dist/chunk-KNF5ERPK.mjs +0 -2
  108. package/dist/chunk-KNF5ERPK.mjs.map +0 -1
  109. package/dist/chunk-NF4RPLCK.js +0 -3
  110. package/dist/chunk-NF4RPLCK.js.map +0 -1
  111. package/dist/chunk-OPAAGNBO.mjs +0 -2
  112. package/dist/chunk-OPAAGNBO.mjs.map +0 -1
  113. package/dist/chunk-OPAQ4R4M.mjs +0 -2
  114. package/dist/chunk-OPAQ4R4M.mjs.map +0 -1
  115. package/dist/chunk-Q7IWDVJ4.js +0 -2
  116. package/dist/chunk-Q7IWDVJ4.js.map +0 -1
  117. package/dist/chunk-RLLO5M6F.js +0 -3
  118. package/dist/chunk-RLLO5M6F.js.map +0 -1
  119. package/dist/chunk-RMN5IPS5.js +0 -2
  120. package/dist/chunk-RMN5IPS5.js.map +0 -1
  121. package/dist/chunk-U6C6VDVZ.js +0 -2
  122. package/dist/chunk-U6C6VDVZ.js.map +0 -1
  123. package/dist/chunk-WQFQO5LK.js +0 -2
  124. package/dist/chunk-WQFQO5LK.js.map +0 -1
  125. package/dist/chunk-WVEJT7HD.mjs +0 -2
  126. package/dist/chunk-WVEJT7HD.mjs.map +0 -1
  127. package/dist/chunk-WWEWRI6S.js +0 -2
  128. package/dist/chunk-WWEWRI6S.js.map +0 -1
  129. package/dist/chunk-YDZ37ZZ4.js +0 -2
  130. package/dist/chunk-YDZ37ZZ4.js.map +0 -1
  131. package/dist/chunk-YEBBTVHG.js +0 -2
  132. package/dist/chunk-YEBBTVHG.js.map +0 -1
  133. package/dist/chunk-YPVRQKMW.js +0 -2
  134. package/dist/chunk-YPVRQKMW.js.map +0 -1
  135. package/dist/components-BMbqsbMY.d.cts +0 -126
  136. package/dist/components-C83mBQXW.d.ts +0 -126
  137. package/dist/core-CxHP8991.d.cts +0 -32
  138. package/dist/core-D0ggvjX3.d.ts +0 -32
  139. package/dist/effect-554ONNZR.js +0 -2
  140. package/dist/effect-554ONNZR.js.map +0 -1
  141. package/dist/effect-T2GVIS3T.mjs +0 -2
  142. package/dist/effect-T2GVIS3T.mjs.map +0 -1
  143. package/dist/owner-QS9tPwPr.d.cts +0 -27
  144. package/dist/owner-QS9tPwPr.d.ts +0 -27
  145. package/dist/portal-BK_0Z0hE.d.cts +0 -206
  146. package/dist/portal-CbguxtuQ.d.ts +0 -206
  147. package/dist/primitives/layout.d.cts +0 -295
  148. package/dist/primitives/layout.d.ts +0 -295
  149. package/dist/primitives/layout.js +0 -2
  150. package/dist/primitives/layout.js.map +0 -1
  151. package/dist/primitives/layout.mjs +0 -2
  152. package/dist/primitives/layout.mjs.map +0 -1
  153. package/dist/primitives/motion.d.cts +0 -230
  154. package/dist/primitives/motion.d.ts +0 -230
  155. package/dist/primitives/motion.js +0 -2
  156. package/dist/primitives/motion.js.map +0 -1
  157. package/dist/primitives/motion.mjs +0 -2
  158. package/dist/primitives/motion.mjs.map +0 -1
  159. package/dist/primitives/ui.d.cts +0 -81
  160. package/dist/primitives/ui.d.ts +0 -81
  161. package/dist/primitives/ui.js +0 -2
  162. package/dist/primitives/ui.js.map +0 -1
  163. package/dist/primitives/ui.mjs +0 -2
  164. package/dist/primitives/ui.mjs.map +0 -1
  165. package/dist/primitives.d.cts +0 -93
  166. package/dist/primitives.d.ts +0 -93
  167. package/dist/primitives.js +0 -2
  168. package/dist/primitives.js.map +0 -1
  169. package/dist/primitives.mjs +0 -2
  170. package/dist/primitives.mjs.map +0 -1
  171. package/dist/renderer-DSLb-FGg.d.cts +0 -135
  172. package/dist/renderer-DSLb-FGg.d.ts +0 -135
  173. package/dist/server.d.cts +0 -3
  174. package/dist/server.d.ts +0 -3
  175. package/dist/server.js +0 -2
  176. package/dist/server.js.map +0 -1
  177. package/dist/server.mjs +0 -2
  178. package/dist/server.mjs.map +0 -1
  179. package/dist/state-DitsMyev.d.cts +0 -96
  180. package/dist/state-DitsMyev.d.ts +0 -96
  181. package/dist/state-S3TSPDMB.js +0 -2
  182. package/dist/state-S3TSPDMB.js.map +0 -1
  183. package/dist/state-SUVOJZYY.mjs +0 -2
  184. package/dist/state-SUVOJZYY.mjs.map +0 -1
  185. package/dist/sync-Z4QqUDjF.d.cts +0 -25
  186. package/dist/sync-Z4QqUDjF.d.ts +0 -25
  187. package/dist/test-exports.d.cts +0 -68
  188. package/dist/test-exports.d.ts +0 -68
  189. package/dist/test-exports.js +0 -2
  190. package/dist/test-exports.js.map +0 -1
  191. package/dist/test-exports.mjs +0 -2
  192. package/dist/test-exports.mjs.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","file":"effect-554ONNZR.js"}
@@ -1,2 +0,0 @@
1
- export{b as EffectNode,c as effect,d as onCleanup}from'./chunk-HB5VPQTB.mjs';import'./chunk-ECYYIQEX.mjs';//# sourceMappingURL=effect-T2GVIS3T.mjs.map
2
- //# sourceMappingURL=effect-T2GVIS3T.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","file":"effect-T2GVIS3T.mjs"}
@@ -1,27 +0,0 @@
1
- /**
2
- * Execute a function without tracking signal dependencies.
3
- * Useful when you need to read signals inside an effect without creating dependencies.
4
- *
5
- * @param fn - Function to execute without tracking
6
- * @returns The return value of fn
7
- */
8
- declare function untrack<T>(fn: () => T): T;
9
- /**
10
- * Creates a disposal scope.
11
- * The return value of the function is returned, and a dispose function is returned.
12
- *
13
- * @param fn - Function to run within a new root scope
14
- * @returns [return value of fn, dispose function]
15
- *
16
- * @example
17
- * ```tsx
18
- * const [val, dispose] = root((dispose) => {
19
- * effect(() => console.log('Inside root'));
20
- * return 123;
21
- * });
22
- * dispose(); // Cleans up all effects created inside
23
- * ```
24
- */
25
- declare function root<T>(fn: (dispose: () => void) => T): T;
26
-
27
- export { root as r, untrack as u };
@@ -1,27 +0,0 @@
1
- /**
2
- * Execute a function without tracking signal dependencies.
3
- * Useful when you need to read signals inside an effect without creating dependencies.
4
- *
5
- * @param fn - Function to execute without tracking
6
- * @returns The return value of fn
7
- */
8
- declare function untrack<T>(fn: () => T): T;
9
- /**
10
- * Creates a disposal scope.
11
- * The return value of the function is returned, and a dispose function is returned.
12
- *
13
- * @param fn - Function to run within a new root scope
14
- * @returns [return value of fn, dispose function]
15
- *
16
- * @example
17
- * ```tsx
18
- * const [val, dispose] = root((dispose) => {
19
- * effect(() => console.log('Inside root'));
20
- * return 123;
21
- * });
22
- * dispose(); // Cleans up all effects created inside
23
- * ```
24
- */
25
- declare function root<T>(fn: (dispose: () => void) => T): T;
26
-
27
- export { root as r, untrack as u };
@@ -1,206 +0,0 @@
1
- import { R as Renderer, E as EventHandler, F as FNode } from './renderer-DSLb-FGg.cjs';
2
- import { S as StateValue } from './state-DitsMyev.cjs';
3
-
4
- /**
5
- * DOM Renderer implementation
6
- */
7
- declare class DOMRenderer implements Renderer {
8
- createNode(type: string, props: Record<string, any>): HTMLElement | SVGElement;
9
- updateNode(node: HTMLElement | SVGElement, oldProps: Record<string, any>, newProps: Record<string, any>): void;
10
- appendChild(parent: Node, child: Node): void;
11
- insertBefore(parent: Node, child: Node, beforeChild: Node | null): void;
12
- nextSibling(node: Node): Node | null;
13
- removeChild(parent: Node, child: Node): void;
14
- createTextNode(text: string): Text;
15
- updateTextNode(node: Text, text: string): void;
16
- addEventListener(node: Node, event: string, handler: EventHandler): void;
17
- removeEventListener(node: Node, event: string, _handler: EventHandler): void;
18
- }
19
- /**
20
- * Default DOM renderer instance
21
- */
22
- declare const domRenderer: DOMRenderer;
23
-
24
- /**
25
- * JSX Factory Function (f)
26
- *
27
- * This module provides the JSX factory function for creating Flexium nodes.
28
- * It's used by the JSX transpiler to convert JSX syntax into function calls.
29
- *
30
- * Usage in tsconfig.json:
31
- * {
32
- * "compilerOptions": {
33
- * "jsx": "react",
34
- * "jsxFactory": "f",
35
- * "jsxFragmentFactory": "Fragment"
36
- * }
37
- * }
38
- */
39
-
40
- /**
41
- * JSX factory function for Flexium
42
- * Creates a Flexium node from JSX syntax
43
- *
44
- * @param type - Element type (string for built-in, function for components)
45
- * @param props - Element properties
46
- * @param children - Child elements
47
- * @returns Flexium node
48
- */
49
- declare function f(type: string | Function, props: Record<string, any> | null, ...children: any[]): FNode;
50
- /**
51
- * Fragment component
52
- * Renders children without a wrapper element
53
- */
54
- declare function Fragment(props: {
55
- children?: any[];
56
- }): FNode;
57
-
58
- /**
59
- * DOM Render Function
60
- *
61
- * This module provides the main render function for mounting components to the DOM.
62
- * It includes simple reconciliation logic for mounting and unmounting components.
63
- *
64
- * Note: This module uses reactive rendering internally via mountReactive.
65
- * For root-level rendering with cleanup support, use createReactiveRoot.
66
- */
67
-
68
- /**
69
- * Render a component to a DOM container with automatic reactivity
70
- *
71
- * This function uses reactive rendering by default, which means:
72
- * - Signals passed as children automatically update the DOM
73
- * - Signals in props automatically update element properties
74
- * - Component functions automatically re-render when signals change
75
- *
76
- * @param vnode - Flexium node to render
77
- * @returns The rendered DOM node
78
- *
79
- * @example
80
- * const count = signal(0);
81
- * render(f('div', {}, [count]), document.body);
82
- * // The div will automatically update when count changes
83
- */
84
- /**
85
- * Mounts a Flexium node to a container
86
- * @param node - Flexium node to render
87
- * @param container - DOM element to mount to
88
- */
89
- declare function render(node: FNode | string | number | null | undefined | Function, container: HTMLElement): Node | null;
90
- /**
91
- * Create a root for rendering with automatic reactivity
92
- *
93
- * This creates a root that supports fine-grained reactive updates.
94
- * Signals are automatically tracked and only the affected DOM nodes are updated.
95
- *
96
- * @param container - DOM element to render into
97
- * @returns Root object with render and unmount methods
98
- *
99
- * @example
100
- * const root = createRoot(document.body);
101
- * const count = signal(0);
102
- * root.render(f('div', {}, [count]));
103
- * // Later: count.value++ will automatically update the DOM
104
- */
105
- declare function createRoot(container: HTMLElement): {
106
- render(node: FNode): void;
107
- unmount(): void;
108
- };
109
-
110
- /**
111
- * Getter function that returns the current value (signal-like)
112
- */
113
- type ItemsGetter<T> = () => T[];
114
- /**
115
- * Fixed-height item configuration
116
- */
117
- interface FixedSizeConfig {
118
- mode: 'fixed';
119
- itemHeight: number;
120
- }
121
- /**
122
- * Variable-height item configuration
123
- */
124
- interface VariableSizeConfig {
125
- mode: 'variable';
126
- estimatedItemHeight: number;
127
- getItemHeight?: (index: number, item: unknown) => number;
128
- }
129
- type SizeConfig = FixedSizeConfig | VariableSizeConfig;
130
- /**
131
- * List component marker
132
- */
133
- interface ListComponent<T> {
134
- [key: symbol]: true;
135
- each: ItemsGetter<T>;
136
- renderItem: (item: T, index: () => number) => FNode;
137
- virtual: boolean;
138
- height?: number | string;
139
- width?: number | string;
140
- itemSize?: number | SizeConfig;
141
- overscan: number;
142
- getKey?: (item: T, index: number) => string | number;
143
- onScroll?: (scrollTop: number) => void;
144
- onVisibleRangeChange?: (startIndex: number, endIndex: number) => void;
145
- class?: string;
146
- style?: Record<string, string | number>;
147
- }
148
-
149
- /**
150
- * Reactive DOM Rendering
151
- *
152
- * Integrates the signal system with the DOM renderer to enable fine-grained
153
- * reactive updates. Only the specific DOM nodes that depend on changed signals
154
- * will be updated, without re-rendering the entire component tree.
155
- */
156
-
157
- /**
158
- * Mount a virtual node reactively to the DOM.
159
- *
160
- * This is the core rendering function that handles all node types:
161
- * - FNodes (both built-in elements and function components)
162
- * - Strings and numbers (text nodes)
163
- * - Signals and computed values (reactive children)
164
- * - StateValues from the state() API
165
- * - ListComponents
166
- * - Arrays and fragments
167
- *
168
- * Reactive values are automatically tracked and DOM updates occur
169
- * only when the specific values change (fine-grained reactivity).
170
- *
171
- * @param vnode - The virtual node to mount
172
- * @param container - Optional parent node to append to
173
- * @returns The created DOM node, or null for empty/boolean values
174
- *
175
- * @example
176
- * ```tsx
177
- * // Mount a simple element
178
- * const node = mountReactive(<div>Hello</div>, document.body)
179
- *
180
- * // Mount a reactive signal
181
- * const count = signal(0)
182
- * mountReactive(() => <span>{count.value}</span>, container)
183
- * ```
184
- */
185
- declare function mountReactive(node: FNode | string | number | boolean | StateValue<any> | null | undefined | Function | any[] | ListComponent<any>, container?: Node): Node | null;
186
- declare function createReactiveRoot(container: HTMLElement): {
187
- render(node: FNode): void;
188
- unmount(): void;
189
- };
190
-
191
- interface PortalProps {
192
- mount?: HTMLElement;
193
- children: any;
194
- }
195
- /**
196
- * <Portal> component renders its children into a different part of the DOM.
197
- * Useful for modals, tooltips, etc.
198
- *
199
- * @example
200
- * <Portal mount={document.body}>
201
- * <div class="modal">...</div>
202
- * </Portal>
203
- */
204
- declare function Portal(props: PortalProps): Comment | null;
205
-
206
- export { DOMRenderer as D, Fragment as F, type ListComponent as L, Portal as P, createReactiveRoot as a, createRoot as c, domRenderer as d, f, mountReactive as m, render as r };
@@ -1,206 +0,0 @@
1
- import { R as Renderer, E as EventHandler, F as FNode } from './renderer-DSLb-FGg.js';
2
- import { S as StateValue } from './state-DitsMyev.js';
3
-
4
- /**
5
- * DOM Renderer implementation
6
- */
7
- declare class DOMRenderer implements Renderer {
8
- createNode(type: string, props: Record<string, any>): HTMLElement | SVGElement;
9
- updateNode(node: HTMLElement | SVGElement, oldProps: Record<string, any>, newProps: Record<string, any>): void;
10
- appendChild(parent: Node, child: Node): void;
11
- insertBefore(parent: Node, child: Node, beforeChild: Node | null): void;
12
- nextSibling(node: Node): Node | null;
13
- removeChild(parent: Node, child: Node): void;
14
- createTextNode(text: string): Text;
15
- updateTextNode(node: Text, text: string): void;
16
- addEventListener(node: Node, event: string, handler: EventHandler): void;
17
- removeEventListener(node: Node, event: string, _handler: EventHandler): void;
18
- }
19
- /**
20
- * Default DOM renderer instance
21
- */
22
- declare const domRenderer: DOMRenderer;
23
-
24
- /**
25
- * JSX Factory Function (f)
26
- *
27
- * This module provides the JSX factory function for creating Flexium nodes.
28
- * It's used by the JSX transpiler to convert JSX syntax into function calls.
29
- *
30
- * Usage in tsconfig.json:
31
- * {
32
- * "compilerOptions": {
33
- * "jsx": "react",
34
- * "jsxFactory": "f",
35
- * "jsxFragmentFactory": "Fragment"
36
- * }
37
- * }
38
- */
39
-
40
- /**
41
- * JSX factory function for Flexium
42
- * Creates a Flexium node from JSX syntax
43
- *
44
- * @param type - Element type (string for built-in, function for components)
45
- * @param props - Element properties
46
- * @param children - Child elements
47
- * @returns Flexium node
48
- */
49
- declare function f(type: string | Function, props: Record<string, any> | null, ...children: any[]): FNode;
50
- /**
51
- * Fragment component
52
- * Renders children without a wrapper element
53
- */
54
- declare function Fragment(props: {
55
- children?: any[];
56
- }): FNode;
57
-
58
- /**
59
- * DOM Render Function
60
- *
61
- * This module provides the main render function for mounting components to the DOM.
62
- * It includes simple reconciliation logic for mounting and unmounting components.
63
- *
64
- * Note: This module uses reactive rendering internally via mountReactive.
65
- * For root-level rendering with cleanup support, use createReactiveRoot.
66
- */
67
-
68
- /**
69
- * Render a component to a DOM container with automatic reactivity
70
- *
71
- * This function uses reactive rendering by default, which means:
72
- * - Signals passed as children automatically update the DOM
73
- * - Signals in props automatically update element properties
74
- * - Component functions automatically re-render when signals change
75
- *
76
- * @param vnode - Flexium node to render
77
- * @returns The rendered DOM node
78
- *
79
- * @example
80
- * const count = signal(0);
81
- * render(f('div', {}, [count]), document.body);
82
- * // The div will automatically update when count changes
83
- */
84
- /**
85
- * Mounts a Flexium node to a container
86
- * @param node - Flexium node to render
87
- * @param container - DOM element to mount to
88
- */
89
- declare function render(node: FNode | string | number | null | undefined | Function, container: HTMLElement): Node | null;
90
- /**
91
- * Create a root for rendering with automatic reactivity
92
- *
93
- * This creates a root that supports fine-grained reactive updates.
94
- * Signals are automatically tracked and only the affected DOM nodes are updated.
95
- *
96
- * @param container - DOM element to render into
97
- * @returns Root object with render and unmount methods
98
- *
99
- * @example
100
- * const root = createRoot(document.body);
101
- * const count = signal(0);
102
- * root.render(f('div', {}, [count]));
103
- * // Later: count.value++ will automatically update the DOM
104
- */
105
- declare function createRoot(container: HTMLElement): {
106
- render(node: FNode): void;
107
- unmount(): void;
108
- };
109
-
110
- /**
111
- * Getter function that returns the current value (signal-like)
112
- */
113
- type ItemsGetter<T> = () => T[];
114
- /**
115
- * Fixed-height item configuration
116
- */
117
- interface FixedSizeConfig {
118
- mode: 'fixed';
119
- itemHeight: number;
120
- }
121
- /**
122
- * Variable-height item configuration
123
- */
124
- interface VariableSizeConfig {
125
- mode: 'variable';
126
- estimatedItemHeight: number;
127
- getItemHeight?: (index: number, item: unknown) => number;
128
- }
129
- type SizeConfig = FixedSizeConfig | VariableSizeConfig;
130
- /**
131
- * List component marker
132
- */
133
- interface ListComponent<T> {
134
- [key: symbol]: true;
135
- each: ItemsGetter<T>;
136
- renderItem: (item: T, index: () => number) => FNode;
137
- virtual: boolean;
138
- height?: number | string;
139
- width?: number | string;
140
- itemSize?: number | SizeConfig;
141
- overscan: number;
142
- getKey?: (item: T, index: number) => string | number;
143
- onScroll?: (scrollTop: number) => void;
144
- onVisibleRangeChange?: (startIndex: number, endIndex: number) => void;
145
- class?: string;
146
- style?: Record<string, string | number>;
147
- }
148
-
149
- /**
150
- * Reactive DOM Rendering
151
- *
152
- * Integrates the signal system with the DOM renderer to enable fine-grained
153
- * reactive updates. Only the specific DOM nodes that depend on changed signals
154
- * will be updated, without re-rendering the entire component tree.
155
- */
156
-
157
- /**
158
- * Mount a virtual node reactively to the DOM.
159
- *
160
- * This is the core rendering function that handles all node types:
161
- * - FNodes (both built-in elements and function components)
162
- * - Strings and numbers (text nodes)
163
- * - Signals and computed values (reactive children)
164
- * - StateValues from the state() API
165
- * - ListComponents
166
- * - Arrays and fragments
167
- *
168
- * Reactive values are automatically tracked and DOM updates occur
169
- * only when the specific values change (fine-grained reactivity).
170
- *
171
- * @param vnode - The virtual node to mount
172
- * @param container - Optional parent node to append to
173
- * @returns The created DOM node, or null for empty/boolean values
174
- *
175
- * @example
176
- * ```tsx
177
- * // Mount a simple element
178
- * const node = mountReactive(<div>Hello</div>, document.body)
179
- *
180
- * // Mount a reactive signal
181
- * const count = signal(0)
182
- * mountReactive(() => <span>{count.value}</span>, container)
183
- * ```
184
- */
185
- declare function mountReactive(node: FNode | string | number | boolean | StateValue<any> | null | undefined | Function | any[] | ListComponent<any>, container?: Node): Node | null;
186
- declare function createReactiveRoot(container: HTMLElement): {
187
- render(node: FNode): void;
188
- unmount(): void;
189
- };
190
-
191
- interface PortalProps {
192
- mount?: HTMLElement;
193
- children: any;
194
- }
195
- /**
196
- * <Portal> component renders its children into a different part of the DOM.
197
- * Useful for modals, tooltips, etc.
198
- *
199
- * @example
200
- * <Portal mount={document.body}>
201
- * <div class="modal">...</div>
202
- * </Portal>
203
- */
204
- declare function Portal(props: PortalProps): Comment | null;
205
-
206
- export { DOMRenderer as D, Fragment as F, type ListComponent as L, Portal as P, createReactiveRoot as a, createRoot as c, domRenderer as d, f, mountReactive as m, render as r };