sibujs 4.5.0 → 4.7.0

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 (116) hide show
  1. package/README.md +1 -1
  2. package/dist/browser.cjs +326 -133
  3. package/dist/browser.d.cts +46 -14
  4. package/dist/browser.d.ts +46 -14
  5. package/dist/browser.js +8 -6
  6. package/dist/build.cjs +2094 -1033
  7. package/dist/build.d.cts +133 -44
  8. package/dist/build.d.ts +133 -44
  9. package/dist/build.js +1372 -574
  10. package/dist/cdn.dev.global.js +10 -10
  11. package/dist/cdn.full.dev.global.js +11 -11
  12. package/dist/cdn.full.global.js +10 -10
  13. package/dist/cdn.global.js +10 -10
  14. package/dist/{chunk-2DCGACUU.js → chunk-2BPG2XDA.js} +251 -66
  15. package/dist/{chunk-IXKSNWV5.js → chunk-2INLLLMZ.js} +1 -1
  16. package/dist/{chunk-4PMLNECI.js → chunk-3QWBSL5R.js} +98 -29
  17. package/dist/{chunk-KKLW7YWL.js → chunk-4AWA2PVD.js} +275 -144
  18. package/dist/chunk-5HZXGZ6T.js +24 -0
  19. package/dist/{chunk-PCT43HW3.js → chunk-7LUJQAOJ.js} +1 -1
  20. package/dist/{chunk-5DXA2J44.js → chunk-7XHATCIH.js} +5 -2
  21. package/dist/chunk-BC2SECJD.js +44 -0
  22. package/dist/{chunk-TBYTO6BS.js → chunk-BSY63EM6.js} +136 -80
  23. package/dist/{chunk-FTIR4QW2.js → chunk-DKXRACVN.js} +6 -8
  24. package/dist/{chunk-ONOHFDLG.js → chunk-FNJXNGYZ.js} +3 -3
  25. package/dist/{chunk-XZZOBQAY.js → chunk-FQRUXCEE.js} +6 -5
  26. package/dist/{chunk-NIOYEGBQ.js → chunk-HURREPU2.js} +27 -13
  27. package/dist/chunk-J6FW5TV6.js +233 -0
  28. package/dist/{chunk-UGRX3S57.js → chunk-JWKYU5GV.js} +22 -4
  29. package/dist/chunk-NYNYSPK7.js +318 -0
  30. package/dist/{chunk-RBTPLM32.js → chunk-RUSSKG6G.js} +13 -12
  31. package/dist/{chunk-7LN645I6.js → chunk-SLM3IA34.js} +3 -3
  32. package/dist/{chunk-R25EFXXC.js → chunk-TUCPL2HB.js} +3 -3
  33. package/dist/{chunk-B3WHI2QA.js → chunk-UNWRJRKC.js} +55 -31
  34. package/dist/{chunk-KEISJXBU.js → chunk-UOL2ECCS.js} +44 -17
  35. package/dist/{chunk-RJE2BNI4.js → chunk-VZSG24LS.js} +108 -45
  36. package/dist/{chunk-RIXRAYIU.js → chunk-WEQ3DMVL.js} +10 -4
  37. package/dist/{chunk-3JZ4L5TJ.js → chunk-WOLJZUFQ.js} +354 -90
  38. package/dist/{chunk-S373NSMK.js → chunk-XYV3EDB7.js} +283 -123
  39. package/dist/{chunk-VZKNK2V7.js → chunk-XZR4PXRE.js} +296 -38
  40. package/dist/{chunk-GW3SCCZG.js → chunk-Z3OHK6QT.js} +153 -110
  41. package/dist/{chunk-OMJJM3KM.js → chunk-ZVL7TY4K.js} +287 -130
  42. package/dist/{contracts-DBdg9J_a.d.ts → contracts-CLqzJnOV.d.ts} +36 -17
  43. package/dist/{contracts-DBdg9J_a.d.cts → contracts-CTOJXu-x.d.cts} +36 -17
  44. package/dist/{customElement-OB9CIsc5.d.cts → customElement-MmInOW1U.d.cts} +21 -0
  45. package/dist/{customElement-OB9CIsc5.d.ts → customElement-MmInOW1U.d.ts} +21 -0
  46. package/dist/data.cjs +410 -155
  47. package/dist/data.d.cts +166 -12
  48. package/dist/data.d.ts +166 -12
  49. package/dist/data.js +12 -9
  50. package/dist/devtools.cjs +98 -61
  51. package/dist/devtools.js +7 -8
  52. package/dist/dispose-GEIG2KOF.js +28 -0
  53. package/dist/ecosystem.cjs +372 -126
  54. package/dist/ecosystem.d.cts +20 -3
  55. package/dist/ecosystem.d.ts +20 -3
  56. package/dist/ecosystem.js +12 -12
  57. package/dist/extras.cjs +2366 -909
  58. package/dist/extras.d.cts +11 -9
  59. package/dist/extras.d.ts +11 -9
  60. package/dist/extras.js +39 -28
  61. package/dist/index.cjs +421 -158
  62. package/dist/index.d.cts +213 -171
  63. package/dist/index.d.ts +213 -171
  64. package/dist/index.js +24 -27
  65. package/dist/motion.cjs +118 -44
  66. package/dist/motion.js +5 -5
  67. package/dist/patterns.cjs +344 -53
  68. package/dist/patterns.d.cts +28 -9
  69. package/dist/patterns.d.ts +28 -9
  70. package/dist/patterns.js +8 -8
  71. package/dist/performance.cjs +325 -220
  72. package/dist/performance.d.cts +2 -2
  73. package/dist/performance.d.ts +2 -2
  74. package/dist/performance.js +8 -9
  75. package/dist/plugin-DVgSnTfK.d.cts +112 -0
  76. package/dist/plugin-DVgSnTfK.d.ts +112 -0
  77. package/dist/plugins.cjs +664 -233
  78. package/dist/plugins.d.cts +127 -14
  79. package/dist/plugins.d.ts +127 -14
  80. package/dist/plugins.js +96 -42
  81. package/dist/signal-EotCj4hS.d.cts +110 -0
  82. package/dist/signal-EotCj4hS.d.ts +110 -0
  83. package/dist/{ssr-BiPRdZ6n.d.cts → ssr-Bli9XRW5.d.cts} +5 -0
  84. package/dist/{ssr-BiPRdZ6n.d.ts → ssr-Bli9XRW5.d.ts} +5 -0
  85. package/dist/{ssr-Y7XOEPEN.js → ssr-XOTUASDO.js} +4 -5
  86. package/dist/ssr.cjs +229 -84
  87. package/dist/ssr.d.cts +9 -3
  88. package/dist/ssr.d.ts +9 -3
  89. package/dist/ssr.js +11 -12
  90. package/dist/{startup-BMpaiMhP.d.ts → startup-BLfSeL15.d.cts} +73 -22
  91. package/dist/{startup-BMpaiMhP.d.cts → startup-BLfSeL15.d.ts} +73 -22
  92. package/dist/tagFactory-8qL9LCIx.d.cts +156 -0
  93. package/dist/tagFactory-BL2fymez.d.ts +156 -0
  94. package/dist/testing.cjs +2503 -2191
  95. package/dist/testing.d.cts +56 -5
  96. package/dist/testing.d.ts +56 -5
  97. package/dist/testing.js +580 -307
  98. package/dist/types-CJFViL6Q.d.cts +26 -0
  99. package/dist/types-CJFViL6Q.d.ts +26 -0
  100. package/dist/ui.cjs +732 -329
  101. package/dist/ui.d.cts +41 -7
  102. package/dist/ui.d.ts +41 -7
  103. package/dist/ui.js +151 -56
  104. package/dist/widgets.cjs +267 -291
  105. package/dist/widgets.js +9 -10
  106. package/package.json +4 -2
  107. package/dist/chunk-2WLZ6757.js +0 -149
  108. package/dist/chunk-CCSJMTRN.js +0 -15
  109. package/dist/chunk-QKRPLZ2V.js +0 -108
  110. package/dist/chunk-VUF4ALSW.js +0 -60
  111. package/dist/chunk-WWV3SJ3L.js +0 -131
  112. package/dist/dispose-46BOMMQJ.js +0 -19
  113. package/dist/plugin-D30wlGW5.d.cts +0 -71
  114. package/dist/plugin-D30wlGW5.d.ts +0 -71
  115. package/dist/tagFactory-DVoDpHye.d.cts +0 -215
  116. package/dist/tagFactory-DVoDpHye.d.ts +0 -215
@@ -1,7 +1,31 @@
1
+ /**
2
+ * Listener tracking for accessibility checks.
3
+ *
4
+ * Listeners added with `addEventListener` leave no trace in the DOM, so
5
+ * `checkKeyboardAccess` could not see `on: { click }` handlers attached by the
6
+ * framework. Once tracking is enabled, `EventTarget.prototype.addEventListener`
7
+ * and `removeEventListener` are wrapped to record which listeners each element
8
+ * currently has. Because the wrap sits below the framework, it covers tag
9
+ * factories, `html` templates and hand-written listeners alike, in development
10
+ * and production builds, without adding anything to the core bundle.
11
+ *
12
+ * The record follows DOM listener identity: an entry is `(type, callback,
13
+ * capture)`, so registering the same callback twice with the same capture flag
14
+ * is one listener, and removing it with the other flag removes nothing. Entries
15
+ * also disappear when a `once` listener is dispatched or its `signal` aborts.
16
+ *
17
+ * The testing entry point enables tracking when it loads. Listeners attached
18
+ * before that are not seen. State lives on a global symbol, so several copies of
19
+ * the testing utilities share one wrap.
20
+ */
21
+ /** Start recording element listeners. Idempotent. */
22
+ declare function enableListenerTracking(): void;
23
+
1
24
  /**
2
25
  * Accessibility testing utilities for SibuJS.
3
26
  * Provides automated a11y checks and WCAG compliance validation.
4
27
  */
28
+
5
29
  type A11yViolationLevel = "error" | "warning" | "info";
6
30
  interface A11yViolation {
7
31
  rule: string;
@@ -17,6 +41,13 @@ interface A11yCheckResult {
17
41
  info: A11yViolation[];
18
42
  summary: string;
19
43
  }
44
+ interface KeyboardAccessOptions {
45
+ /**
46
+ * Recognise a container as delegating activation to its own controls, instead
47
+ * of marking it with `data-a11y-delegates`.
48
+ */
49
+ delegatesActivation?: (el: Element) => boolean;
50
+ }
20
51
  /**
21
52
  * Check that all images have alt text.
22
53
  */
@@ -41,7 +72,7 @@ declare function checkColorContrast(root: Element): A11yViolation[];
41
72
  * Check that interactive elements are keyboard accessible.
42
73
  * Elements with click handlers should have tabindex, role, and key handlers.
43
74
  */
44
- declare function checkKeyboardAccess(root: Element): A11yViolation[];
75
+ declare function checkKeyboardAccess(root: Element, options?: KeyboardAccessOptions): A11yViolation[];
45
76
  /**
46
77
  * Check ARIA attribute validity.
47
78
  * - role attributes use valid ARIA roles
@@ -155,6 +186,8 @@ declare function createCypressAdapter(): {
155
186
  }): {
156
187
  element: HTMLElement;
157
188
  container: HTMLElement;
189
+ /** Dispose the mounted component and remove the container this call created. Idempotent. */
190
+ unmount: () => void;
158
191
  };
159
192
  /** Generate Cypress custom commands for SibuJS */
160
193
  commands: {
@@ -292,7 +325,7 @@ declare function createTimerMock(options?: {
292
325
  */
293
326
  declare function createDOMSnapshot(element: Element): string;
294
327
  /**
295
- * Assert that two DOM trees are structurally equivalent.
328
+ * Assert two DOM elements have the same structure.
296
329
  */
297
330
  declare function assertDOMEquals(actual: Element, expected: Element): void;
298
331
  /**
@@ -324,6 +357,17 @@ declare function testComponent(component: (() => HTMLElement) | HTMLElement, opt
324
357
  * `null` if no match is found — unlike `getByText`, does not throw.
325
358
  */
326
359
  declare function queryByText(container: HTMLElement, text: string): HTMLElement | null;
360
+ /**
361
+ * First descendant of `container` whose `attribute` is exactly `value`.
362
+ *
363
+ * Deliberately not `querySelector(`[attr="${value}"]`)`: interpolating an
364
+ * arbitrary attribute value into a selector breaks on quotes, backslashes and
365
+ * brackets (an invalid-selector DOMException) or matches something else. Only
366
+ * the attribute NAME, which is always a fixed literal here, reaches the selector.
367
+ */
368
+ declare function queryByAttribute(container: ParentNode, attribute: string, value: string): HTMLElement | null;
369
+ /** Every descendant of `container` whose `attribute` is exactly `value`. See {@link queryByAttribute}. */
370
+ declare function queryAllByAttribute(container: ParentNode, attribute: string, value: string): HTMLElement[];
327
371
  declare function queryByTestId(container: HTMLElement, testId: string): HTMLElement | null;
328
372
  declare function queryByRole(container: HTMLElement, role: string): HTMLElement | null;
329
373
  declare function queryByLabel(container: HTMLElement, labelText: string): HTMLElement | null;
@@ -444,16 +488,23 @@ interface VisualFingerprint {
444
488
  inlineStyles: string[];
445
489
  /** Data attributes */
446
490
  dataAttributes: Record<string, string>;
491
+ /**
492
+ * Appearance-relevant computed styles per element, in tree order. Captures
493
+ * stylesheet, inherited and custom-property driven changes that leave the
494
+ * markup untouched.
495
+ */
496
+ computedStyles: string[];
447
497
  /** Computed hash of the fingerprint */
448
498
  hash: string;
449
499
  }
450
500
  /**
451
501
  * Capture a visual fingerprint of a component.
452
- * Includes DOM structure, attributes, text content, and inline styles.
502
+ * Includes DOM structure, attributes, text content, inline styles and the
503
+ * appearance-relevant computed styles of every element.
453
504
  */
454
505
  declare function captureFingerprint(element: Element): VisualFingerprint;
455
506
  interface FingerprintChange {
456
- type: "structure" | "text" | "class" | "style" | "data" | "elements";
507
+ type: "structure" | "text" | "class" | "style" | "data" | "elements" | "computed";
457
508
  description: string;
458
509
  }
459
510
  /**
@@ -542,4 +593,4 @@ declare function mockStore<T extends object>(initialState: T): {
542
593
  reset: () => void;
543
594
  };
544
595
 
545
- export { type A11yCheckResult, type A11yViolation, type A11yViolationLevel, type FindOptions, type FingerprintChange, type MockResponse, type MockRoute, type VisualFingerprint, assertA11y, assertDOMEquals, captureFingerprint, checkA11y, checkAriaAttributes, checkColorContrast, checkFormLabels, checkHeadingHierarchy, checkImageAlt, checkKeyboardAccess, checkLandmarks, checkLinksAndButtons, checkListSemantics, checkTabOrder, compareFingerprints, createCypressAdapter, createDOMSnapshot, createHttpMock, createJestAdapter, createPlaywrightAdapter, createSnapshotMatcher, createSnapshotStore, createTimerMock, createUniversalAdapter, createVisualSuite, findByRole, findByTestId, findByText, fireEvent, matchSnapshot, mockRouter, mockStore, queryByLabel, queryByRole, queryByTestId, queryByText, render, snapshotComponent, testComponent, type, unmountAll, waitFor, waitForSignal };
596
+ export { type A11yCheckResult, type A11yViolation, type A11yViolationLevel, type FindOptions, type FingerprintChange, type KeyboardAccessOptions, type MockResponse, type MockRoute, type VisualFingerprint, assertA11y, assertDOMEquals, captureFingerprint, checkA11y, checkAriaAttributes, checkColorContrast, checkFormLabels, checkHeadingHierarchy, checkImageAlt, checkKeyboardAccess, checkLandmarks, checkLinksAndButtons, checkListSemantics, checkTabOrder, compareFingerprints, createCypressAdapter, createDOMSnapshot, createHttpMock, createJestAdapter, createPlaywrightAdapter, createSnapshotMatcher, createSnapshotStore, createTimerMock, createUniversalAdapter, createVisualSuite, enableListenerTracking, findByRole, findByTestId, findByText, fireEvent, matchSnapshot, mockRouter, mockStore, queryAllByAttribute, queryByAttribute, queryByLabel, queryByRole, queryByTestId, queryByText, render, snapshotComponent, testComponent, type, unmountAll, waitFor, waitForSignal };
package/dist/testing.d.ts CHANGED
@@ -1,7 +1,31 @@
1
+ /**
2
+ * Listener tracking for accessibility checks.
3
+ *
4
+ * Listeners added with `addEventListener` leave no trace in the DOM, so
5
+ * `checkKeyboardAccess` could not see `on: { click }` handlers attached by the
6
+ * framework. Once tracking is enabled, `EventTarget.prototype.addEventListener`
7
+ * and `removeEventListener` are wrapped to record which listeners each element
8
+ * currently has. Because the wrap sits below the framework, it covers tag
9
+ * factories, `html` templates and hand-written listeners alike, in development
10
+ * and production builds, without adding anything to the core bundle.
11
+ *
12
+ * The record follows DOM listener identity: an entry is `(type, callback,
13
+ * capture)`, so registering the same callback twice with the same capture flag
14
+ * is one listener, and removing it with the other flag removes nothing. Entries
15
+ * also disappear when a `once` listener is dispatched or its `signal` aborts.
16
+ *
17
+ * The testing entry point enables tracking when it loads. Listeners attached
18
+ * before that are not seen. State lives on a global symbol, so several copies of
19
+ * the testing utilities share one wrap.
20
+ */
21
+ /** Start recording element listeners. Idempotent. */
22
+ declare function enableListenerTracking(): void;
23
+
1
24
  /**
2
25
  * Accessibility testing utilities for SibuJS.
3
26
  * Provides automated a11y checks and WCAG compliance validation.
4
27
  */
28
+
5
29
  type A11yViolationLevel = "error" | "warning" | "info";
6
30
  interface A11yViolation {
7
31
  rule: string;
@@ -17,6 +41,13 @@ interface A11yCheckResult {
17
41
  info: A11yViolation[];
18
42
  summary: string;
19
43
  }
44
+ interface KeyboardAccessOptions {
45
+ /**
46
+ * Recognise a container as delegating activation to its own controls, instead
47
+ * of marking it with `data-a11y-delegates`.
48
+ */
49
+ delegatesActivation?: (el: Element) => boolean;
50
+ }
20
51
  /**
21
52
  * Check that all images have alt text.
22
53
  */
@@ -41,7 +72,7 @@ declare function checkColorContrast(root: Element): A11yViolation[];
41
72
  * Check that interactive elements are keyboard accessible.
42
73
  * Elements with click handlers should have tabindex, role, and key handlers.
43
74
  */
44
- declare function checkKeyboardAccess(root: Element): A11yViolation[];
75
+ declare function checkKeyboardAccess(root: Element, options?: KeyboardAccessOptions): A11yViolation[];
45
76
  /**
46
77
  * Check ARIA attribute validity.
47
78
  * - role attributes use valid ARIA roles
@@ -155,6 +186,8 @@ declare function createCypressAdapter(): {
155
186
  }): {
156
187
  element: HTMLElement;
157
188
  container: HTMLElement;
189
+ /** Dispose the mounted component and remove the container this call created. Idempotent. */
190
+ unmount: () => void;
158
191
  };
159
192
  /** Generate Cypress custom commands for SibuJS */
160
193
  commands: {
@@ -292,7 +325,7 @@ declare function createTimerMock(options?: {
292
325
  */
293
326
  declare function createDOMSnapshot(element: Element): string;
294
327
  /**
295
- * Assert that two DOM trees are structurally equivalent.
328
+ * Assert two DOM elements have the same structure.
296
329
  */
297
330
  declare function assertDOMEquals(actual: Element, expected: Element): void;
298
331
  /**
@@ -324,6 +357,17 @@ declare function testComponent(component: (() => HTMLElement) | HTMLElement, opt
324
357
  * `null` if no match is found — unlike `getByText`, does not throw.
325
358
  */
326
359
  declare function queryByText(container: HTMLElement, text: string): HTMLElement | null;
360
+ /**
361
+ * First descendant of `container` whose `attribute` is exactly `value`.
362
+ *
363
+ * Deliberately not `querySelector(`[attr="${value}"]`)`: interpolating an
364
+ * arbitrary attribute value into a selector breaks on quotes, backslashes and
365
+ * brackets (an invalid-selector DOMException) or matches something else. Only
366
+ * the attribute NAME, which is always a fixed literal here, reaches the selector.
367
+ */
368
+ declare function queryByAttribute(container: ParentNode, attribute: string, value: string): HTMLElement | null;
369
+ /** Every descendant of `container` whose `attribute` is exactly `value`. See {@link queryByAttribute}. */
370
+ declare function queryAllByAttribute(container: ParentNode, attribute: string, value: string): HTMLElement[];
327
371
  declare function queryByTestId(container: HTMLElement, testId: string): HTMLElement | null;
328
372
  declare function queryByRole(container: HTMLElement, role: string): HTMLElement | null;
329
373
  declare function queryByLabel(container: HTMLElement, labelText: string): HTMLElement | null;
@@ -444,16 +488,23 @@ interface VisualFingerprint {
444
488
  inlineStyles: string[];
445
489
  /** Data attributes */
446
490
  dataAttributes: Record<string, string>;
491
+ /**
492
+ * Appearance-relevant computed styles per element, in tree order. Captures
493
+ * stylesheet, inherited and custom-property driven changes that leave the
494
+ * markup untouched.
495
+ */
496
+ computedStyles: string[];
447
497
  /** Computed hash of the fingerprint */
448
498
  hash: string;
449
499
  }
450
500
  /**
451
501
  * Capture a visual fingerprint of a component.
452
- * Includes DOM structure, attributes, text content, and inline styles.
502
+ * Includes DOM structure, attributes, text content, inline styles and the
503
+ * appearance-relevant computed styles of every element.
453
504
  */
454
505
  declare function captureFingerprint(element: Element): VisualFingerprint;
455
506
  interface FingerprintChange {
456
- type: "structure" | "text" | "class" | "style" | "data" | "elements";
507
+ type: "structure" | "text" | "class" | "style" | "data" | "elements" | "computed";
457
508
  description: string;
458
509
  }
459
510
  /**
@@ -542,4 +593,4 @@ declare function mockStore<T extends object>(initialState: T): {
542
593
  reset: () => void;
543
594
  };
544
595
 
545
- export { type A11yCheckResult, type A11yViolation, type A11yViolationLevel, type FindOptions, type FingerprintChange, type MockResponse, type MockRoute, type VisualFingerprint, assertA11y, assertDOMEquals, captureFingerprint, checkA11y, checkAriaAttributes, checkColorContrast, checkFormLabels, checkHeadingHierarchy, checkImageAlt, checkKeyboardAccess, checkLandmarks, checkLinksAndButtons, checkListSemantics, checkTabOrder, compareFingerprints, createCypressAdapter, createDOMSnapshot, createHttpMock, createJestAdapter, createPlaywrightAdapter, createSnapshotMatcher, createSnapshotStore, createTimerMock, createUniversalAdapter, createVisualSuite, findByRole, findByTestId, findByText, fireEvent, matchSnapshot, mockRouter, mockStore, queryByLabel, queryByRole, queryByTestId, queryByText, render, snapshotComponent, testComponent, type, unmountAll, waitFor, waitForSignal };
596
+ export { type A11yCheckResult, type A11yViolation, type A11yViolationLevel, type FindOptions, type FingerprintChange, type KeyboardAccessOptions, type MockResponse, type MockRoute, type VisualFingerprint, assertA11y, assertDOMEquals, captureFingerprint, checkA11y, checkAriaAttributes, checkColorContrast, checkFormLabels, checkHeadingHierarchy, checkImageAlt, checkKeyboardAccess, checkLandmarks, checkLinksAndButtons, checkListSemantics, checkTabOrder, compareFingerprints, createCypressAdapter, createDOMSnapshot, createHttpMock, createJestAdapter, createPlaywrightAdapter, createSnapshotMatcher, createSnapshotStore, createTimerMock, createUniversalAdapter, createVisualSuite, enableListenerTracking, findByRole, findByTestId, findByText, fireEvent, matchSnapshot, mockRouter, mockStore, queryAllByAttribute, queryByAttribute, queryByLabel, queryByRole, queryByTestId, queryByText, render, snapshotComponent, testComponent, type, unmountAll, waitFor, waitForSignal };