@fluixi/dom 1.0.0-alpha.82 → 1.0.0-alpha.84

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 (183) hide show
  1. package/dist/cdn/dom-client.cjs +1427 -1
  2. package/dist/cdn/dom-client.d.ts +2 -2
  3. package/dist/cdn/dom-client.global.js +2 -1
  4. package/dist/cdn/dom-client.js +3 -3
  5. package/dist/cdn/dom-client.mjs +1430 -1
  6. package/dist/cdn/dom.cjs +3127 -1
  7. package/dist/cdn/dom.d.ts +2 -2
  8. package/dist/cdn/dom.global.js +2 -1
  9. package/dist/cdn/dom.js +4 -4
  10. package/dist/cdn/dom.mjs +3133 -1
  11. package/dist/index.cjs +3155 -1
  12. package/dist/index.js +2 -2
  13. package/dist/index.mjs +3149 -1
  14. package/dist/lib/component/index.cjs +128 -1
  15. package/dist/lib/component/index.mjs +105 -1
  16. package/dist/lib/component/modifiers.cjs +126 -1
  17. package/dist/lib/component/modifiers.d.ts +12 -0
  18. package/dist/lib/component/modifiers.d.ts.map +1 -1
  19. package/dist/lib/component/modifiers.js +12 -84
  20. package/dist/lib/component/modifiers.mjs +105 -1
  21. package/dist/lib/dom/delegate.cjs +60 -1
  22. package/dist/lib/dom/delegate.js +1 -1
  23. package/dist/lib/dom/delegate.mjs +39 -1
  24. package/dist/lib/dom/dynamic-element.cjs +949 -1
  25. package/dist/lib/dom/dynamic-element.d.ts +3 -3
  26. package/dist/lib/dom/dynamic-element.js +3 -3
  27. package/dist/lib/dom/dynamic-element.mjs +928 -1
  28. package/dist/lib/dom/hydration-state.cjs +93 -1
  29. package/dist/lib/dom/hydration-state.d.ts +1 -1
  30. package/dist/lib/dom/hydration-state.js +1 -1
  31. package/dist/lib/dom/hydration-state.mjs +72 -1
  32. package/dist/lib/dom/hydration.cjs +685 -1
  33. package/dist/lib/dom/hydration.js +8 -8
  34. package/dist/lib/dom/hydration.mjs +664 -1
  35. package/dist/lib/dom/index.cjs +2040 -1
  36. package/dist/lib/dom/index.js +1 -1
  37. package/dist/lib/dom/index.mjs +2020 -1
  38. package/dist/lib/dom/integration.cjs +71 -1
  39. package/dist/lib/dom/integration.d.ts.map +1 -1
  40. package/dist/lib/dom/integration.js +15 -6
  41. package/dist/lib/dom/integration.mjs +51 -1
  42. package/dist/lib/dom/island.cjs +790 -1
  43. package/dist/lib/dom/island.d.ts +1 -1
  44. package/dist/lib/dom/island.js +12 -12
  45. package/dist/lib/dom/island.mjs +769 -1
  46. package/dist/lib/dom/runtime.cjs +1432 -1
  47. package/dist/lib/dom/runtime.d.ts +71 -19
  48. package/dist/lib/dom/runtime.d.ts.map +1 -1
  49. package/dist/lib/dom/runtime.js +261 -100
  50. package/dist/lib/dom/runtime.mjs +1414 -1
  51. package/dist/lib/dom/server/fx-data.cjs +53 -1
  52. package/dist/lib/dom/server/fx-data.d.ts +5 -5
  53. package/dist/lib/dom/server/fx-data.js +6 -6
  54. package/dist/lib/dom/server/fx-data.mjs +32 -1
  55. package/dist/lib/dom/server/host.cjs +66 -1
  56. package/dist/lib/dom/server/host.d.ts +14 -2
  57. package/dist/lib/dom/server/host.d.ts.map +1 -1
  58. package/dist/lib/dom/server/host.js +38 -10
  59. package/dist/lib/dom/server/host.mjs +45 -1
  60. package/dist/lib/dom/server/index.cjs +759 -1
  61. package/dist/lib/dom/server/index.d.ts +1 -1
  62. package/dist/lib/dom/server/index.js +1 -1
  63. package/dist/lib/dom/server/index.mjs +743 -1
  64. package/dist/lib/dom/server/nodes.cjs +302 -1
  65. package/dist/lib/dom/server/nodes.d.ts +2 -2
  66. package/dist/lib/dom/server/nodes.d.ts.map +1 -1
  67. package/dist/lib/dom/server/nodes.js +4 -4
  68. package/dist/lib/dom/server/nodes.mjs +279 -1
  69. package/dist/lib/dom/server/parse-template.cjs +395 -1
  70. package/dist/lib/dom/server/parse-template.d.ts +1 -1
  71. package/dist/lib/dom/server/parse-template.js +4 -4
  72. package/dist/lib/dom/server/parse-template.mjs +372 -1
  73. package/dist/lib/dom/server/render.cjs +691 -1
  74. package/dist/lib/dom/server/render.d.ts +9 -1
  75. package/dist/lib/dom/server/render.d.ts.map +1 -1
  76. package/dist/lib/dom/server/render.js +25 -17
  77. package/dist/lib/dom/server/render.mjs +677 -1
  78. package/dist/lib/dom/server/request-context.cjs +110 -1
  79. package/dist/lib/dom/server/request-context.d.ts +29 -9
  80. package/dist/lib/dom/server/request-context.d.ts.map +1 -1
  81. package/dist/lib/dom/server/request-context.js +28 -8
  82. package/dist/lib/dom/server/request-context.mjs +89 -1
  83. package/dist/lib/dom/server/serialize.cjs +187 -1
  84. package/dist/lib/dom/server/serialize.js +3 -3
  85. package/dist/lib/dom/server/serialize.mjs +164 -1
  86. package/dist/lib/dom/server-renderer.cjs +760 -1
  87. package/dist/lib/dom/server-renderer.js +1 -1
  88. package/dist/lib/dom/server-renderer.mjs +745 -1
  89. package/dist/lib/dom/types.cjs +18 -1
  90. package/dist/lib/dom/utils.cjs +381 -1
  91. package/dist/lib/dom/utils.d.ts +1 -88
  92. package/dist/lib/dom/utils.d.ts.map +1 -1
  93. package/dist/lib/dom/utils.js +2 -99
  94. package/dist/lib/dom/utils.mjs +361 -1
  95. package/dist/lib/dom/versions.cjs +60 -1
  96. package/dist/lib/dom/versions.d.ts +3 -3
  97. package/dist/lib/dom/versions.d.ts.map +1 -1
  98. package/dist/lib/dom/versions.js +17 -5
  99. package/dist/lib/dom/versions.mjs +37 -1
  100. package/dist/lib/element/attributes.cjs +19 -1
  101. package/dist/lib/element/attributes.d.ts +7 -7
  102. package/dist/lib/element/attributes.js +1 -1
  103. package/dist/lib/element/attributes.mjs +1 -0
  104. package/dist/lib/element/index.cjs +19 -1
  105. package/dist/lib/element/index.mjs +1 -0
  106. package/dist/lib/element/types.cjs +18 -1
  107. package/dist/lib/element/types.d.ts +4 -5
  108. package/dist/lib/element/types.d.ts.map +1 -1
  109. package/dist/lib/element/types.js +0 -1
  110. package/dist/lib/flow/class-map.cjs +38 -1
  111. package/dist/lib/flow/class-map.d.ts +3 -3
  112. package/dist/lib/flow/class-map.js +3 -3
  113. package/dist/lib/flow/class-map.mjs +17 -1
  114. package/dist/lib/flow/client-only.cjs +57 -1
  115. package/dist/lib/flow/client-only.d.ts +4 -4
  116. package/dist/lib/flow/client-only.js +4 -4
  117. package/dist/lib/flow/client-only.mjs +36 -1
  118. package/dist/lib/flow/dynamic.cjs +53 -1
  119. package/dist/lib/flow/dynamic.d.ts +2 -2
  120. package/dist/lib/flow/dynamic.js +4 -4
  121. package/dist/lib/flow/dynamic.mjs +32 -1
  122. package/dist/lib/flow/error-boundary.cjs +43 -1
  123. package/dist/lib/flow/error-boundary.d.ts +2 -2
  124. package/dist/lib/flow/error-boundary.js +4 -4
  125. package/dist/lib/flow/error-boundary.mjs +22 -1
  126. package/dist/lib/flow/for.cjs +66 -1
  127. package/dist/lib/flow/for.d.ts +9 -9
  128. package/dist/lib/flow/for.d.ts.map +1 -1
  129. package/dist/lib/flow/for.js +2 -2
  130. package/dist/lib/flow/for.mjs +45 -1
  131. package/dist/lib/flow/index-flow.cjs +67 -1
  132. package/dist/lib/flow/index-flow.d.ts +5 -5
  133. package/dist/lib/flow/index-flow.js +4 -4
  134. package/dist/lib/flow/index-flow.mjs +46 -1
  135. package/dist/lib/flow/index.cjs +805 -1
  136. package/dist/lib/flow/index.mjs +792 -1
  137. package/dist/lib/flow/portal.cjs +538 -1
  138. package/dist/lib/flow/portal.mjs +519 -1
  139. package/dist/lib/flow/show.cjs +81 -1
  140. package/dist/lib/flow/show.d.ts +1 -1
  141. package/dist/lib/flow/show.d.ts.map +1 -1
  142. package/dist/lib/flow/show.js +12 -118
  143. package/dist/lib/flow/show.mjs +67 -1
  144. package/dist/lib/flow/style-map.cjs +43 -1
  145. package/dist/lib/flow/style-map.d.ts +3 -3
  146. package/dist/lib/flow/style-map.js +4 -4
  147. package/dist/lib/flow/style-map.mjs +22 -1
  148. package/dist/lib/flow/switch.cjs +91 -1
  149. package/dist/lib/flow/switch.d.ts +3 -3
  150. package/dist/lib/flow/switch.d.ts.map +1 -1
  151. package/dist/lib/flow/switch.js +7 -7
  152. package/dist/lib/flow/switch.mjs +70 -1
  153. package/dist/lib/flow/utils.cjs +44 -1
  154. package/dist/lib/flow/utils.d.ts +1 -1
  155. package/dist/lib/flow/utils.js +1 -1
  156. package/dist/lib/flow/utils.mjs +23 -1
  157. package/dist/lib/html.cjs +32 -1
  158. package/dist/lib/html.d.ts +6 -6
  159. package/dist/lib/html.js +5 -5
  160. package/dist/lib/html.mjs +11 -1
  161. package/dist/lib/index.cjs +3104 -1
  162. package/dist/lib/index.d.ts +0 -1
  163. package/dist/lib/index.d.ts.map +1 -1
  164. package/dist/lib/index.js +2 -3
  165. package/dist/lib/index.mjs +3097 -1
  166. package/dist/lib/shared/types.cjs +18 -1
  167. package/dist/lib/shared/types.d.ts +8 -8
  168. package/dist/tsconfig.lib.tsbuildinfo +1 -1
  169. package/dist/version.generated.cjs +26 -1
  170. package/dist/version.generated.d.ts +1 -1
  171. package/dist/version.generated.js +2 -2
  172. package/dist/version.generated.mjs +5 -1
  173. package/package.json +7 -6
  174. package/dist/lib/jsx/control-flow/flow.cjs +0 -1
  175. package/dist/lib/jsx/control-flow/flow.d.ts +0 -2
  176. package/dist/lib/jsx/control-flow/flow.d.ts.map +0 -1
  177. package/dist/lib/jsx/control-flow/flow.js +0 -627
  178. package/dist/lib/jsx/control-flow/flow.mjs +0 -0
  179. package/dist/lib/jsx/control-flow/for-flow.cjs +0 -1
  180. package/dist/lib/jsx/control-flow/for-flow.d.ts +0 -2
  181. package/dist/lib/jsx/control-flow/for-flow.d.ts.map +0 -1
  182. package/dist/lib/jsx/control-flow/for-flow.js +0 -1
  183. package/dist/lib/jsx/control-flow/for-flow.mjs +0 -0
@@ -1,5 +1,4 @@
1
1
  /**
2
- * @fileoverview DOM utilities for Fluixi
3
2
  * @module @fluixi/core/dom
4
3
  *
5
4
  * This module provides utilities for DOM manipulation and queries.
@@ -124,7 +123,7 @@ export const SVG_ELEMENTS = new Set([
124
123
  export const SVG_NAMESPACE = 'http://www.w3.org/2000/svg';
125
124
  /**
126
125
  * Returns true for custom elements (tag name contains a hyphen per the Web
127
- * Components spec e.g. `adf-accounts-selector`).
126
+ * Components spec: e.g. `adf-accounts-selector`).
128
127
  */
129
128
  export function isCustomElement(element) {
130
129
  return element.localName.includes('-');
@@ -154,7 +153,7 @@ export function applyElementProp(element, name, value, isSVG = false) {
154
153
  // );
155
154
  // }
156
155
  if (isCustomElement(element)) {
157
- // if ((element as any)[name]!==value)
156
+ // if ((element as any)[name]!==value)
158
157
  element[name] = value;
159
158
  return;
160
159
  }
@@ -175,11 +174,6 @@ export const JSX_PROPERTIES = new Set([
175
174
  /**
176
175
  * Queries a single element with type safety
177
176
  *
178
- * @template T - Element type
179
- * @param {string} selector - CSS selector
180
- * @param {Element | Document} root - Root element (default: document)
181
- * @returns {T | null} Found element or null
182
- *
183
177
  * @example
184
178
  * ```typescript
185
179
  * import { query } from '@fluixi/core/dom';
@@ -194,11 +188,6 @@ export function query(selector, root = document) {
194
188
  /**
195
189
  * Queries all matching elements with type safety
196
190
  *
197
- * @template T - Element type
198
- * @param {string} selector - CSS selector
199
- * @param {Element | Document} root - Root element (default: document)
200
- * @returns {T[]} Array of matching elements
201
- *
202
191
  * @example
203
192
  * ```typescript
204
193
  * import { queryAll } from '@fluixi/core/dom';
@@ -213,11 +202,6 @@ export function queryAll(selector, root = document) {
213
202
  /**
214
203
  * Queries the closest matching ancestor element
215
204
  *
216
- * @template T - Element type
217
- * @param {Element} element - Starting element
218
- * @param {string} selector - CSS selector
219
- * @returns {T | null} Closest matching ancestor or null
220
- *
221
205
  * @example
222
206
  * ```typescript
223
207
  * import { closest } from '@fluixi/core/dom';
@@ -232,9 +216,6 @@ export function closest(element, selector) {
232
216
  /**
233
217
  * Adds one or more classes to an element
234
218
  *
235
- * @param {Element} element - Target element
236
- * @param {...string} classes - Classes to add
237
- *
238
219
  * @example
239
220
  * ```typescript
240
221
  * import { addClass } from '@fluixi/core/dom';
@@ -248,9 +229,6 @@ export function addClass(element, ...classes) {
248
229
  /**
249
230
  * Removes one or more classes from an element
250
231
  *
251
- * @param {Element} element - Target element
252
- * @param {...string} classes - Classes to remove
253
- *
254
232
  * @example
255
233
  * ```typescript
256
234
  * import { removeClass } from '@fluixi/core/dom';
@@ -264,9 +242,6 @@ export function removeClass(element, ...classes) {
264
242
  /**
265
243
  * Toggles one or more classes on an element
266
244
  *
267
- * @param {Element} element - Target element
268
- * @param {...string} classes - Classes to toggle
269
- *
270
245
  * @example
271
246
  * ```typescript
272
247
  * import { toggleClass } from '@fluixi/core/dom';
@@ -280,10 +255,6 @@ export function toggleClass(element, ...classes) {
280
255
  /**
281
256
  * Checks if element has a class
282
257
  *
283
- * @param {Element} element - Target element
284
- * @param {string} className - Class name to check
285
- * @returns {boolean} True if element has the class
286
- *
287
258
  * @example
288
259
  * ```typescript
289
260
  * import { hasClass } from '@fluixi/core/dom';
@@ -299,10 +270,6 @@ export function hasClass(element, className) {
299
270
  /**
300
271
  * Sets an attribute on an element
301
272
  *
302
- * @param {Element} element - Target element
303
- * @param {string} name - Attribute name
304
- * @param {string | number | boolean} value - Attribute value
305
- *
306
273
  * @example
307
274
  * ```typescript
308
275
  * import { setAttribute } from '@fluixi/core/dom';
@@ -332,16 +299,6 @@ export function setAttribute(element, name, value, isSVG = false) {
332
299
  // /**
333
300
  // * Set an attribute or property on an element
334
301
  // */
335
- // export function setAttribute(
336
- // element: Element,
337
- // name: string,
338
- // value: any,
339
- // isSVG = false
340
- // ): void {
341
- // if (value == null || value === false) {
342
- // element.removeAttribute(name);
343
- // return;
344
- // }
345
302
  // if (value === true) {
346
303
  // element.setAttribute(name, '');
347
304
  // return;
@@ -351,10 +308,6 @@ export function setAttribute(element, name, value, isSVG = false) {
351
308
  /**
352
309
  * Gets an attribute from an element
353
310
  *
354
- * @param {Element} element - Target element
355
- * @param {string} name - Attribute name
356
- * @returns {string | null} Attribute value or null
357
- *
358
311
  * @example
359
312
  * ```typescript
360
313
  * import { getAttribute } from '@fluixi/core/dom';
@@ -368,9 +321,6 @@ export function getAttribute(element, name) {
368
321
  /**
369
322
  * Removes an attribute from an element
370
323
  *
371
- * @param {Element} element - Target element
372
- * @param {string} name - Attribute name
373
- *
374
324
  * @example
375
325
  * ```typescript
376
326
  * import { removeAttribute } from '@fluixi/core/dom';
@@ -384,9 +334,6 @@ export function removeAttribute(element, name) {
384
334
  /**
385
335
  * Sets multiple styles on an element
386
336
  *
387
- * @param {HTMLElement} element - Target element
388
- * @param {Partial<CSSStyleDeclaration>} styles - Styles object
389
- *
390
337
  * @example
391
338
  * ```typescript
392
339
  * import { setStyles } from '@fluixi/core/dom';
@@ -404,10 +351,6 @@ export function setStyles(element, styles) {
404
351
  /**
405
352
  * Gets computed style of an element
406
353
  *
407
- * @param {Element} element - Target element
408
- * @param {string} property - CSS property name
409
- * @returns {string} Computed style value
410
- *
411
354
  * @example
412
355
  * ```typescript
413
356
  * import { getStyle } from '@fluixi/core/dom';
@@ -421,12 +364,6 @@ export function getStyle(element, property) {
421
364
  /**
422
365
  * Creates an element with attributes and children
423
366
  *
424
- * @template K - Element tag name
425
- * @param {K} tagName - HTML tag name
426
- * @param {Record<string, any>} attributes - Element attributes
427
- * @param {...(Node | string)} children - Child nodes or text
428
- * @returns {HTMLElementTagNameMap[K]} Created element
429
- *
430
367
  * @example
431
368
  * ```typescript
432
369
  * import { createElement } from '@fluixi/core/dom';
@@ -467,8 +404,6 @@ export function createElement(tagName, attributes = {}, ...children) {
467
404
  /**
468
405
  * Removes all children from an element
469
406
  *
470
- * @param {Element} element - Target element
471
- *
472
407
  * @example
473
408
  * ```typescript
474
409
  * import { removeChildren } from '@fluixi/core/dom';
@@ -484,9 +419,6 @@ export function removeChildren(element) {
484
419
  /**
485
420
  * Appends multiple children to an element
486
421
  *
487
- * @param {Element} parent - Parent element
488
- * @param {...(Node | string)} children - Children to append
489
- *
490
422
  * @example
491
423
  * ```typescript
492
424
  * import { appendChildren } from '@fluixi/core/dom';
@@ -511,9 +443,6 @@ export function appendChildren(parent, ...children) {
511
443
  /**
512
444
  * Checks if element is visible in the viewport
513
445
  *
514
- * @param {Element} element - Target element
515
- * @returns {boolean} True if element is visible
516
- *
517
446
  * @example
518
447
  * ```typescript
519
448
  * import { isVisible } from '@fluixi/core/dom';
@@ -533,9 +462,6 @@ export function isVisible(element) {
533
462
  /**
534
463
  * Scrolls element into view smoothly
535
464
  *
536
- * @param {Element} element - Target element
537
- * @param {ScrollIntoViewOptions} options - Scroll options
538
- *
539
465
  * @example
540
466
  * ```typescript
541
467
  * import { scrollIntoView } from '@fluixi/core/dom';
@@ -549,9 +475,6 @@ export function scrollIntoView(element, options = { behavior: 'smooth', block: '
549
475
  /**
550
476
  * Gets element's offset relative to document
551
477
  *
552
- * @param {Element} element - Target element
553
- * @returns {{ top: number; left: number }} Offset coordinates
554
- *
555
478
  * @example
556
479
  * ```typescript
557
480
  * import { getOffset } from '@fluixi/core/dom';
@@ -569,13 +492,6 @@ export function getOffset(element) {
569
492
  /**
570
493
  * Delegates event handling to a parent element
571
494
  *
572
- * @template K - Event type
573
- * @param {Element} parent - Parent element
574
- * @param {K} eventName - Event name
575
- * @param {string} selector - Child selector
576
- * @param {(event: Event, target: Element) => void} handler - Event handler
577
- * @returns {() => void} Cleanup function
578
- *
579
495
  * @example
580
496
  * ```typescript
581
497
  * import { delegate } from '@fluixi/core/dom';
@@ -600,10 +516,6 @@ export function delegate(parent, eventName, selector, handler) {
600
516
  /**
601
517
  * Waits for an element to appear in the DOM
602
518
  *
603
- * @param {string} selector - CSS selector
604
- * @param {number} timeout - Timeout in milliseconds (default: 5000)
605
- * @returns {Promise<Element>} Promise that resolves with the element
606
- *
607
519
  * @example
608
520
  * ```typescript
609
521
  * import { waitForElement } from '@fluixi/core/dom';
@@ -639,11 +551,6 @@ export function waitForElement(selector, timeout = 5000) {
639
551
  /**
640
552
  * Observes element intersection with viewport
641
553
  *
642
- * @param {Element} element - Target element
643
- * @param {(isIntersecting: boolean) => void} callback - Callback function
644
- * @param {IntersectionObserverInit} options - Observer options
645
- * @returns {() => void} Cleanup function
646
- *
647
554
  * @example
648
555
  * ```typescript
649
556
  * import { observeIntersection } from '@fluixi/core/dom';
@@ -667,10 +574,6 @@ export function observeIntersection(element, callback, options = {}) {
667
574
  /**
668
575
  * Observes element size changes
669
576
  *
670
- * @param {Element} element - Target element
671
- * @param {(entry: ResizeObserverEntry) => void} callback - Callback function
672
- * @returns {() => void} Cleanup function
673
- *
674
577
  * @example
675
578
  * ```typescript
676
579
  * import { observeResize } from '@fluixi/core/dom';
@@ -1 +1,361 @@
1
- function m(e){return e.startsWith("aria-")||e.startsWith("data-")?e:/[A-Z]/.test(e)?e.replace(/([A-Z])/g,"-$1").toLowerCase():e}function g(e){return e.startsWith("@")||e.startsWith("on")&&e.length>2}function E(e){return e.startsWith("@")?e.slice(1):e.startsWith("on")?e.slice(2).toLowerCase():e}function b(e,t){let n=new Set(["checked","value","selected","disabled","readonly","required","multiple","open","contenteditable","draggable","spellcheck"]),r={input:new Set(["value","checked","indeterminate"]),textarea:new Set(["value"]),select:new Set(["value"]),option:new Set(["selected","value"]),audio:new Set(["volume","currentTime","paused"]),video:new Set(["volume","currentTime","paused"]),img:new Set(["src","srcset"]),iframe:new Set(["src"]),a:new Set(["href"])};return n.has(t)||r[e]&&r[e].has(t)}var x=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),h=new Set(["svg","g","path","circle","rect","line","polyline","polygon","ellipse","text","tspan","use","defs","symbol","mask","clipPath","pattern","linearGradient","radialGradient","stop","filter","feGaussianBlur","feOffset","feMerge","feMergeNode","foreignObject"]),y="http://www.w3.org/2000/svg";function u(e){return e.localName.includes("-")}function w(e,t,n,r=!1){if(n==null){e.removeAttribute(t);return}if(u(e)){e[t]=n;return}c(e,t,n,r)}var T=new Set(["className","value","checked","selected","innerHTML","innerText","textContent","indeterminate","htmlFor"]);function a(e,t=document){return t.querySelector(e)}function v(e,t=document){return Array.from(t.querySelectorAll(e))}function S(e,t){return e.closest(t)}function A(e,...t){e.classList.add(...t)}function L(e,...t){e.classList.remove(...t)}function C(e,...t){t.forEach(n=>e.classList.toggle(n))}function N(e,t){return e.classList.contains(t)}function c(e,t,n,r=!1){if(n==null||n===!1){e.removeAttribute(t);return}if(n===!0){e.setAttribute(t,"");return}if(typeof n=="object"){e.setAttribute(t,JSON.stringify(n));return}e.setAttribute(t,String(n))}function M(e,t){return e.getAttribute(t)}function O(e,t){e.removeAttribute(t)}function f(e,t){Object.assign(e.style,t)}function I(e,t){return window.getComputedStyle(e).getPropertyValue(t)}function P(e,t={},...n){let r=document.createElement(e);return Object.entries(t).forEach(([o,i])=>{if(o==="class"||o==="className")r.className=i;else if(o==="style"&&typeof i=="object")f(r,i);else if(o.startsWith("on")&&typeof i=="function"){let s=o.slice(2).toLowerCase();r.addEventListener(s,i)}else c(r,o,i)}),n.forEach(o=>{typeof o=="string"?r.appendChild(document.createTextNode(o)):r.appendChild(o)}),r}function R(e){for(;e.firstChild;)e.removeChild(e.firstChild)}function H(e,...t){t.forEach(n=>{typeof n=="string"?e.appendChild(document.createTextNode(n)):e.appendChild(n)})}function V(e){let t=e.getBoundingClientRect();return t.top>=0&&t.left>=0&&t.bottom<=window.innerHeight&&t.right<=window.innerWidth}function j(e,t={behavior:"smooth",block:"nearest"}){e.scrollIntoView(t)}function G(e){let t=e.getBoundingClientRect();return{top:t.top+window.pageYOffset,left:t.left+window.pageXOffset}}function W(e,t,n,r){let o=i=>{let s=i.target.closest(n);s&&e.contains(s)&&r(i,s)};return e.addEventListener(t,o),()=>{e.removeEventListener(t,o)}}function $(e,t=5e3){return new Promise((n,r)=>{let o=a(e);if(o){n(o);return}let i=new MutationObserver(()=>{let l=a(e);l&&(i.disconnect(),clearTimeout(s),n(l))});i.observe(document.body,{childList:!0,subtree:!0});let s=setTimeout(()=>{i.disconnect(),r(new Error(`Element ${e} not found within ${t}ms`))},t)})}function q(e,t,n={}){let r=new IntersectionObserver(o=>{o.forEach(i=>{t(i.isIntersecting)})},n);return r.observe(e),()=>{r.disconnect()}}function D(e,t){let n=new ResizeObserver(r=>{r.forEach(t)});return n.observe(e),()=>{n.disconnect()}}var d=typeof Symbol=="function"&&Symbol.for?Symbol.for("react.element"):60103;function F(e){return typeof e=="object"&&e!==null&&e.$$typeof===d}function p(e){return e&&typeof e=="object"&&e.strings&&Array.isArray(e.strings)&&e.values&&Array.isArray(e.values)}function z(e){if(typeof e!="function")return!1;try{let t=e();return p(t)}catch{return!1}}function B(e){return typeof e=="object"&&e!==null&&(e.$$typeof==="template"||typeof e.type=="function")}function J(e){return e instanceof Node}function X(e,t,n="Fluixi"){typeof globalThis<"u"&&(typeof globalThis[n]>"u"&&(globalThis[n]={}),typeof globalThis[n][e]>"u"&&(globalThis[n][e]=t))}function K(e,t,n="Fluixi"){return typeof globalThis<"u"&&typeof globalThis[n]<"u"&&typeof globalThis[n][e]<"u"?globalThis[n][e]:t}export{T as JSX_PROPERTIES,h as SVG_ELEMENTS,y as SVG_NAMESPACE,x as VOID_ELEMENTS,A as addClass,H as appendChildren,w as applyElementProp,S as closest,P as createElement,W as delegate,M as getAttribute,K as getGlobal,E as getLitEventName,G as getOffset,I as getStyle,N as hasClass,u as isCustomElement,J as isDOMNode,g as isEventHandler,B as isJSXTemplate,p as isLitTemplateResult,F as isReactElement,z as isTemplateFactory,V as isVisible,q as observeIntersection,D as observeResize,a as query,v as queryAll,X as registerGlobal,O as removeAttribute,R as removeChildren,L as removeClass,j as scrollIntoView,c as setAttribute,f as setStyles,b as shouldSetAsProperty,m as toAttributeName,C as toggleClass,$ as waitForElement};
1
+ /*! @fluixi/dom v1.0.0-alpha.84 | (c) 2026 Ibrahima Touré and Fluixi contributors | MIT */
2
+
3
+ // src/lib/dom/utils.ts
4
+ function toAttributeName(key) {
5
+ if (key.startsWith("aria-") || key.startsWith("data-")) {
6
+ return key;
7
+ }
8
+ if (/[A-Z]/.test(key)) {
9
+ return key.replace(/([A-Z])/g, "-$1").toLowerCase();
10
+ }
11
+ return key;
12
+ }
13
+ function isEventHandler(key) {
14
+ return key.startsWith("@") || key.startsWith("on") && key.length > 2;
15
+ }
16
+ function getLitEventName(key) {
17
+ if (key.startsWith("@")) {
18
+ return key.slice(1);
19
+ }
20
+ if (key.startsWith("on")) {
21
+ const eventName = key.slice(2);
22
+ return eventName.toLowerCase();
23
+ }
24
+ return key;
25
+ }
26
+ function shouldSetAsProperty(element, key) {
27
+ const propertyAttributes = /* @__PURE__ */ new Set([
28
+ "checked",
29
+ "value",
30
+ "selected",
31
+ "disabled",
32
+ "readonly",
33
+ "required",
34
+ "multiple",
35
+ "open",
36
+ "contenteditable",
37
+ "draggable",
38
+ "spellcheck"
39
+ ]);
40
+ const elementSpecificProps = {
41
+ input: /* @__PURE__ */ new Set(["value", "checked", "indeterminate"]),
42
+ textarea: /* @__PURE__ */ new Set(["value"]),
43
+ select: /* @__PURE__ */ new Set(["value"]),
44
+ option: /* @__PURE__ */ new Set(["selected", "value"]),
45
+ audio: /* @__PURE__ */ new Set(["volume", "currentTime", "paused"]),
46
+ video: /* @__PURE__ */ new Set(["volume", "currentTime", "paused"]),
47
+ img: /* @__PURE__ */ new Set(["src", "srcset"]),
48
+ iframe: /* @__PURE__ */ new Set(["src"]),
49
+ a: /* @__PURE__ */ new Set(["href"])
50
+ };
51
+ return propertyAttributes.has(key) || elementSpecificProps[element] && elementSpecificProps[element].has(key);
52
+ }
53
+ var VOID_ELEMENTS = /* @__PURE__ */ new Set([
54
+ "area",
55
+ "base",
56
+ "br",
57
+ "col",
58
+ "embed",
59
+ "hr",
60
+ "img",
61
+ "input",
62
+ "link",
63
+ "meta",
64
+ "param",
65
+ "source",
66
+ "track",
67
+ "wbr"
68
+ ]);
69
+ var SVG_ELEMENTS = /* @__PURE__ */ new Set([
70
+ "svg",
71
+ "g",
72
+ "path",
73
+ "circle",
74
+ "rect",
75
+ "line",
76
+ "polyline",
77
+ "polygon",
78
+ "ellipse",
79
+ "text",
80
+ "tspan",
81
+ "use",
82
+ "defs",
83
+ "symbol",
84
+ "mask",
85
+ "clipPath",
86
+ "pattern",
87
+ "linearGradient",
88
+ "radialGradient",
89
+ "stop",
90
+ "filter",
91
+ "feGaussianBlur",
92
+ "feOffset",
93
+ "feMerge",
94
+ "feMergeNode",
95
+ "foreignObject"
96
+ ]);
97
+ var SVG_NAMESPACE = "http://www.w3.org/2000/svg";
98
+ function isCustomElement(element) {
99
+ return element.localName.includes("-");
100
+ }
101
+ function applyElementProp(element, name, value, isSVG = false) {
102
+ if (value == null) {
103
+ element.removeAttribute(name);
104
+ return;
105
+ }
106
+ if (isCustomElement(element)) {
107
+ element[name] = value;
108
+ return;
109
+ }
110
+ setAttribute(element, name, value, isSVG);
111
+ }
112
+ var JSX_PROPERTIES = /* @__PURE__ */ new Set([
113
+ "className",
114
+ "value",
115
+ "checked",
116
+ "selected",
117
+ "innerHTML",
118
+ "innerText",
119
+ "textContent",
120
+ "indeterminate",
121
+ "htmlFor"
122
+ ]);
123
+ function query(selector, root = document) {
124
+ return root.querySelector(selector);
125
+ }
126
+ function queryAll(selector, root = document) {
127
+ return Array.from(root.querySelectorAll(selector));
128
+ }
129
+ function closest(element, selector) {
130
+ return element.closest(selector);
131
+ }
132
+ function addClass(element, ...classes) {
133
+ element.classList.add(...classes);
134
+ }
135
+ function removeClass(element, ...classes) {
136
+ element.classList.remove(...classes);
137
+ }
138
+ function toggleClass(element, ...classes) {
139
+ classes.forEach((cls) => element.classList.toggle(cls));
140
+ }
141
+ function hasClass(element, className) {
142
+ return element.classList.contains(className);
143
+ }
144
+ function setAttribute(element, name, value, isSVG = false) {
145
+ if (value == null || value === false) {
146
+ element.removeAttribute(name);
147
+ return;
148
+ }
149
+ if (value === true) {
150
+ element.setAttribute(name, "");
151
+ return;
152
+ }
153
+ if (typeof value === "object") {
154
+ element.setAttribute(name, JSON.stringify(value));
155
+ return;
156
+ }
157
+ element.setAttribute(name, String(value));
158
+ }
159
+ function getAttribute(element, name) {
160
+ return element.getAttribute(name);
161
+ }
162
+ function removeAttribute(element, name) {
163
+ element.removeAttribute(name);
164
+ }
165
+ function setStyles(element, styles) {
166
+ Object.assign(element.style, styles);
167
+ }
168
+ function getStyle(element, property) {
169
+ return window.getComputedStyle(element).getPropertyValue(property);
170
+ }
171
+ function createElement(tagName, attributes = {}, ...children) {
172
+ const element = document.createElement(tagName);
173
+ Object.entries(attributes).forEach(([key, value]) => {
174
+ if (key === "class" || key === "className") {
175
+ element.className = value;
176
+ } else if (key === "style" && typeof value === "object") {
177
+ setStyles(element, value);
178
+ } else if (key.startsWith("on") && typeof value === "function") {
179
+ const event = key.slice(2).toLowerCase();
180
+ element.addEventListener(event, value);
181
+ } else {
182
+ setAttribute(element, key, value);
183
+ }
184
+ });
185
+ children.forEach((child) => {
186
+ if (typeof child === "string") {
187
+ element.appendChild(document.createTextNode(child));
188
+ } else {
189
+ element.appendChild(child);
190
+ }
191
+ });
192
+ return element;
193
+ }
194
+ function removeChildren(element) {
195
+ while (element.firstChild) {
196
+ element.removeChild(element.firstChild);
197
+ }
198
+ }
199
+ function appendChildren(parent, ...children) {
200
+ children.forEach((child) => {
201
+ if (typeof child === "string") {
202
+ parent.appendChild(document.createTextNode(child));
203
+ } else {
204
+ parent.appendChild(child);
205
+ }
206
+ });
207
+ }
208
+ function isVisible(element) {
209
+ const rect = element.getBoundingClientRect();
210
+ return rect.top >= 0 && rect.left >= 0 && rect.bottom <= window.innerHeight && rect.right <= window.innerWidth;
211
+ }
212
+ function scrollIntoView(element, options = { behavior: "smooth", block: "nearest" }) {
213
+ element.scrollIntoView(options);
214
+ }
215
+ function getOffset(element) {
216
+ const rect = element.getBoundingClientRect();
217
+ return {
218
+ top: rect.top + window.pageYOffset,
219
+ left: rect.left + window.pageXOffset
220
+ };
221
+ }
222
+ function delegate(parent, eventName, selector, handler) {
223
+ const listener = (event) => {
224
+ const target = event.target.closest(selector);
225
+ if (target && parent.contains(target)) {
226
+ handler(event, target);
227
+ }
228
+ };
229
+ parent.addEventListener(eventName, listener);
230
+ return () => {
231
+ parent.removeEventListener(eventName, listener);
232
+ };
233
+ }
234
+ function waitForElement(selector, timeout = 5e3) {
235
+ return new Promise((resolve, reject) => {
236
+ const element = query(selector);
237
+ if (element) {
238
+ resolve(element);
239
+ return;
240
+ }
241
+ const observer = new MutationObserver(() => {
242
+ const element2 = query(selector);
243
+ if (element2) {
244
+ observer.disconnect();
245
+ clearTimeout(timeoutId);
246
+ resolve(element2);
247
+ }
248
+ });
249
+ observer.observe(document.body, {
250
+ childList: true,
251
+ subtree: true
252
+ });
253
+ const timeoutId = setTimeout(() => {
254
+ observer.disconnect();
255
+ reject(new Error(`Element ${selector} not found within ${timeout}ms`));
256
+ }, timeout);
257
+ });
258
+ }
259
+ function observeIntersection(element, callback, options = {}) {
260
+ const observer = new IntersectionObserver((entries) => {
261
+ entries.forEach((entry) => {
262
+ callback(entry.isIntersecting);
263
+ });
264
+ }, options);
265
+ observer.observe(element);
266
+ return () => {
267
+ observer.disconnect();
268
+ };
269
+ }
270
+ function observeResize(element, callback) {
271
+ const observer = new ResizeObserver((entries) => {
272
+ entries.forEach(callback);
273
+ });
274
+ observer.observe(element);
275
+ return () => {
276
+ observer.disconnect();
277
+ };
278
+ }
279
+ var REACT_ELEMENT_TYPE = typeof Symbol === "function" && Symbol.for ? /* @__PURE__ */ Symbol.for("react.element") : 60103;
280
+ function isReactElement(value) {
281
+ return typeof value === "object" && value !== null && value.$$typeof === REACT_ELEMENT_TYPE;
282
+ }
283
+ function isLitTemplateResult(value) {
284
+ return value && typeof value === "object" && value.strings && Array.isArray(value.strings) && value.values && Array.isArray(value.values);
285
+ }
286
+ function isTemplateFactory(value) {
287
+ if (typeof value !== "function") return false;
288
+ try {
289
+ const result = value();
290
+ return isLitTemplateResult(result);
291
+ } catch {
292
+ return false;
293
+ }
294
+ }
295
+ function isJSXTemplate(value) {
296
+ return typeof value === "object" && value !== null && (value.$$typeof === "template" || typeof value.type === "function");
297
+ }
298
+ function isDOMNode(value) {
299
+ return value instanceof Node;
300
+ }
301
+ function registerGlobal(key, value, _Key = "Fluixi") {
302
+ if (typeof globalThis !== "undefined") {
303
+ if (typeof globalThis[_Key] === "undefined") {
304
+ globalThis[_Key] = {};
305
+ }
306
+ if (typeof globalThis[_Key][key] === "undefined") {
307
+ globalThis[_Key][key] = value;
308
+ }
309
+ }
310
+ }
311
+ function getGlobal(key, value, _Key = "Fluixi") {
312
+ if (typeof globalThis !== "undefined") {
313
+ if (typeof globalThis[_Key] !== "undefined") {
314
+ if (typeof globalThis[_Key][key] !== "undefined") {
315
+ return globalThis[_Key][key];
316
+ }
317
+ }
318
+ }
319
+ return value;
320
+ }
321
+ export {
322
+ JSX_PROPERTIES,
323
+ SVG_ELEMENTS,
324
+ SVG_NAMESPACE,
325
+ VOID_ELEMENTS,
326
+ addClass,
327
+ appendChildren,
328
+ applyElementProp,
329
+ closest,
330
+ createElement,
331
+ delegate,
332
+ getAttribute,
333
+ getGlobal,
334
+ getLitEventName,
335
+ getOffset,
336
+ getStyle,
337
+ hasClass,
338
+ isCustomElement,
339
+ isDOMNode,
340
+ isEventHandler,
341
+ isJSXTemplate,
342
+ isLitTemplateResult,
343
+ isReactElement,
344
+ isTemplateFactory,
345
+ isVisible,
346
+ observeIntersection,
347
+ observeResize,
348
+ query,
349
+ queryAll,
350
+ registerGlobal,
351
+ removeAttribute,
352
+ removeChildren,
353
+ removeClass,
354
+ scrollIntoView,
355
+ setAttribute,
356
+ setStyles,
357
+ shouldSetAsProperty,
358
+ toAttributeName,
359
+ toggleClass,
360
+ waitForElement
361
+ };