@odx/foundation 1.0.0-alpha.6 → 1.0.0-alpha.7

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 (248) hide show
  1. package/README.md +7 -7
  2. package/dist/cdk.js +345 -0
  3. package/dist/components/accordion/accordion-header.component.d.ts +1 -1
  4. package/dist/components/button/base-button.d.ts +1 -1
  5. package/dist/components/button/button.component.d.ts +1 -1
  6. package/dist/components/button-group/button-group.component.d.ts +1 -1
  7. package/dist/components/card/card.component.d.ts +1 -1
  8. package/dist/components/chip/chip.component.d.ts +1 -1
  9. package/dist/components/dropdown/dropdown.component.d.ts +2 -2
  10. package/dist/components/format/format-date.component.d.ts +1 -1
  11. package/dist/components/format/format-number.component.d.ts +1 -1
  12. package/dist/components/format/format.component.d.ts +2 -2
  13. package/dist/components/format/relative-time.component.d.ts +1 -1
  14. package/dist/components/input/input.component.d.ts +1 -1
  15. package/dist/components/link/base-link.d.ts +1 -1
  16. package/dist/components/loading-overlay/loading-overlay.component.d.ts +1 -1
  17. package/dist/components/menu/menu.component.d.ts +2 -2
  18. package/dist/components/slider/slider-handle.component.d.ts +2 -2
  19. package/dist/components/slider/slider.component.d.ts +1 -1
  20. package/dist/components/spinbox/spinbox.component.d.ts +1 -1
  21. package/dist/components/tooltip/tooltip.element.d.ts +2 -2
  22. package/dist/components.js +4284 -0
  23. package/dist/i18n/lib/translate.d.ts +5 -1
  24. package/dist/i18n.js +140 -0
  25. package/dist/main.js +1448 -0
  26. package/dist/vendor.js +3660 -0
  27. package/package.json +13 -22
  28. package/dist/cdk/drag-drop/drag.controller.js +0 -90
  29. package/dist/cdk/drag-drop/is-draggable.js +0 -42
  30. package/dist/cdk/main.js +0 -5
  31. package/dist/cdk/popover/popover-host.mixin.css.js +0 -3
  32. package/dist/cdk/popover/popover-host.mixin.js +0 -115
  33. package/dist/cdk/popover/popover.component.css.js +0 -3
  34. package/dist/cdk/popover/popover.component.js +0 -38
  35. package/dist/cdk/popover/popover.models.js +0 -32
  36. package/dist/cdk/popover/popover.utils.js +0 -48
  37. package/dist/components/accordion/accordion-header.component.css.js +0 -3
  38. package/dist/components/accordion/accordion-header.component.js +0 -69
  39. package/dist/components/accordion/accordion-panel.component.css.js +0 -3
  40. package/dist/components/accordion/accordion-panel.component.js +0 -29
  41. package/dist/components/accordion/accordion.component.css.js +0 -3
  42. package/dist/components/accordion/accordion.component.js +0 -83
  43. package/dist/components/area-header/area-header.component.css.js +0 -3
  44. package/dist/components/area-header/area-header.component.js +0 -37
  45. package/dist/components/area-header/area-header.models.js +0 -11
  46. package/dist/components/avatar/avatar.component.css.js +0 -3
  47. package/dist/components/avatar/avatar.component.js +0 -31
  48. package/dist/components/avatar/avatar.models.js +0 -12
  49. package/dist/components/avatar-group/avatar-group.component.css.js +0 -3
  50. package/dist/components/avatar-group/avatar-group.component.js +0 -31
  51. package/dist/components/badge/badge.component.css.js +0 -3
  52. package/dist/components/badge/badge.component.js +0 -32
  53. package/dist/components/badge/badge.models.js +0 -10
  54. package/dist/components/breadcrumbs/breadcrumbs-item.component.css.js +0 -3
  55. package/dist/components/breadcrumbs/breadcrumbs-item.component.js +0 -56
  56. package/dist/components/breadcrumbs/breadcrumbs.component.css.js +0 -3
  57. package/dist/components/breadcrumbs/breadcrumbs.component.js +0 -88
  58. package/dist/components/button/base-button.css.js +0 -3
  59. package/dist/components/button/base-button.js +0 -72
  60. package/dist/components/button/button.component.css.js +0 -3
  61. package/dist/components/button/button.component.js +0 -66
  62. package/dist/components/button/button.models.js +0 -16
  63. package/dist/components/button-group/button-group.component.css.js +0 -3
  64. package/dist/components/button-group/button-group.component.js +0 -47
  65. package/dist/components/card/card.component.css.js +0 -3
  66. package/dist/components/card/card.component.js +0 -30
  67. package/dist/components/checkbox/checkbox.component.css.js +0 -3
  68. package/dist/components/checkbox/checkbox.component.js +0 -57
  69. package/dist/components/checkbox-group/checkbox-group.component.css.js +0 -3
  70. package/dist/components/checkbox-group/checkbox-group.component.js +0 -54
  71. package/dist/components/checkbox-group/checkbox-group.models.js +0 -5
  72. package/dist/components/chip/chip.component.css.js +0 -3
  73. package/dist/components/chip/chip.component.js +0 -94
  74. package/dist/components/chip/chip.models.js +0 -10
  75. package/dist/components/circular-progress-bar/circular-progress-bar.component.css.js +0 -3
  76. package/dist/components/circular-progress-bar/circular-progress-bar.component.js +0 -123
  77. package/dist/components/circular-progress-bar/circular-progress-bar.models.js +0 -7
  78. package/dist/components/content-box/content-box.component.css.js +0 -3
  79. package/dist/components/content-box/content-box.component.js +0 -26
  80. package/dist/components/dropdown/dropdown.component.css.js +0 -3
  81. package/dist/components/dropdown/dropdown.component.js +0 -121
  82. package/dist/components/dropdown/dropdown.models.js +0 -8
  83. package/dist/components/form-field/form-field.element.css.js +0 -3
  84. package/dist/components/form-field/form-field.element.js +0 -62
  85. package/dist/components/format/format-bytes.component.js +0 -46
  86. package/dist/components/format/format-date.component.js +0 -36
  87. package/dist/components/format/format-number.component.js +0 -59
  88. package/dist/components/format/format.component.js +0 -34
  89. package/dist/components/format/relative-time.component.js +0 -80
  90. package/dist/components/header/header-actions.component.css.js +0 -3
  91. package/dist/components/header/header-actions.component.js +0 -22
  92. package/dist/components/header/header.component.css.js +0 -3
  93. package/dist/components/header/header.component.js +0 -58
  94. package/dist/components/headline/headline.component.css.js +0 -3
  95. package/dist/components/headline/headline.component.js +0 -31
  96. package/dist/components/headline/headline.models.js +0 -8
  97. package/dist/components/icon-button/icon-button.component.js +0 -34
  98. package/dist/components/inline-message/inline-message.component.css.js +0 -3
  99. package/dist/components/inline-message/inline-message.component.js +0 -39
  100. package/dist/components/inline-message/inline-message.models.js +0 -9
  101. package/dist/components/input/input.component.css.js +0 -3
  102. package/dist/components/input/input.component.js +0 -72
  103. package/dist/components/input/input.models.js +0 -7
  104. package/dist/components/line-clamp/line-clamp.component.css.js +0 -3
  105. package/dist/components/line-clamp/line-clamp.component.js +0 -37
  106. package/dist/components/link/base-link.js +0 -70
  107. package/dist/components/link/link.component.css.js +0 -3
  108. package/dist/components/link/link.component.js +0 -33
  109. package/dist/components/list/list-item.component.css.js +0 -3
  110. package/dist/components/list/list-item.component.js +0 -33
  111. package/dist/components/list/list.component.css.js +0 -3
  112. package/dist/components/list/list.component.js +0 -25
  113. package/dist/components/loading-overlay/loading-overlay.component.css.js +0 -3
  114. package/dist/components/loading-overlay/loading-overlay.component.js +0 -78
  115. package/dist/components/loading-spinner/loading-spinner.component.css.js +0 -3
  116. package/dist/components/loading-spinner/loading-spinner.component.js +0 -58
  117. package/dist/components/logo/logo.component.css.js +0 -3
  118. package/dist/components/logo/logo.component.js +0 -38
  119. package/dist/components/logo/logo.models.js +0 -9
  120. package/dist/components/main-menu/main-menu-button.component.js +0 -38
  121. package/dist/components/main-menu/main-menu-link.component.css.js +0 -3
  122. package/dist/components/main-menu/main-menu-link.component.js +0 -20
  123. package/dist/components/main-menu/main-menu-subtitle.component.js +0 -29
  124. package/dist/components/main-menu/main-menu-title.component.js +0 -29
  125. package/dist/components/main-menu/main-menu.component.css.js +0 -3
  126. package/dist/components/main-menu/main-menu.component.js +0 -82
  127. package/dist/components/main.js +0 -102
  128. package/dist/components/menu/menu-label.component.css.js +0 -3
  129. package/dist/components/menu/menu-label.component.js +0 -18
  130. package/dist/components/menu/menu.component.css.js +0 -3
  131. package/dist/components/menu/menu.component.js +0 -111
  132. package/dist/components/menu-item/menu-item.component.css.js +0 -3
  133. package/dist/components/menu-item/menu-item.component.js +0 -45
  134. package/dist/components/navigation-item/navigation-item.component.css.js +0 -3
  135. package/dist/components/navigation-item/navigation-item.component.js +0 -43
  136. package/dist/components/navigation-item/navigation-item.models.js +0 -6
  137. package/dist/components/option/option.component.css.js +0 -3
  138. package/dist/components/option/option.component.js +0 -37
  139. package/dist/components/page/page.component.css.js +0 -3
  140. package/dist/components/page/page.component.js +0 -53
  141. package/dist/components/page/page.models.js +0 -9
  142. package/dist/components/page-layout/page-layout.component.css.js +0 -3
  143. package/dist/components/page-layout/page-layout.component.js +0 -28
  144. package/dist/components/progress-bar/progress-bar.component.css.js +0 -3
  145. package/dist/components/progress-bar/progress-bar.component.js +0 -89
  146. package/dist/components/progress-bar/progress-bar.models.js +0 -7
  147. package/dist/components/radio-button/radio-button.component.css.js +0 -3
  148. package/dist/components/radio-button/radio-button.component.js +0 -39
  149. package/dist/components/radio-group/radio-group.component.css.js +0 -3
  150. package/dist/components/radio-group/radio-group.component.js +0 -24
  151. package/dist/components/radio-group/radio-group.models.js +0 -5
  152. package/dist/components/rail-navigation/rail-navigation.component.css.js +0 -3
  153. package/dist/components/rail-navigation/rail-navigation.component.js +0 -65
  154. package/dist/components/search-bar/search-bar.component.css.js +0 -3
  155. package/dist/components/search-bar/search-bar.component.js +0 -100
  156. package/dist/components/search-bar/search-bar.events.js +0 -7
  157. package/dist/components/search-bar/search-bar.models.js +0 -6
  158. package/dist/components/select/select.component.css.js +0 -3
  159. package/dist/components/select/select.component.js +0 -101
  160. package/dist/components/separator/separator.component.css.js +0 -3
  161. package/dist/components/separator/separator.component.js +0 -49
  162. package/dist/components/skeleton/skeleton.component.css.js +0 -3
  163. package/dist/components/skeleton/skeleton.component.js +0 -32
  164. package/dist/components/slider/slider-handle.component.css.js +0 -3
  165. package/dist/components/slider/slider-handle.component.js +0 -168
  166. package/dist/components/slider/slider-marks.component.css.js +0 -3
  167. package/dist/components/slider/slider-marks.component.js +0 -61
  168. package/dist/components/slider/slider.component.css.js +0 -3
  169. package/dist/components/slider/slider.component.js +0 -119
  170. package/dist/components/slider/slider.models.js +0 -17
  171. package/dist/components/spacer/spacer.component.css.js +0 -3
  172. package/dist/components/spacer/spacer.component.js +0 -39
  173. package/dist/components/spinbox/spinbox.component.css.js +0 -3
  174. package/dist/components/spinbox/spinbox.component.js +0 -94
  175. package/dist/components/stack/stack.component.css.js +0 -3
  176. package/dist/components/stack/stack.component.js +0 -45
  177. package/dist/components/stack/stack.models.js +0 -23
  178. package/dist/components/switch/switch.component.css.js +0 -3
  179. package/dist/components/switch/switch.component.js +0 -36
  180. package/dist/components/table/table-body.element.css.js +0 -3
  181. package/dist/components/table/table-body.element.js +0 -26
  182. package/dist/components/table/table-cell.element.css.js +0 -3
  183. package/dist/components/table/table-cell.element.js +0 -26
  184. package/dist/components/table/table-checkbox-cell.element.css.js +0 -3
  185. package/dist/components/table/table-checkbox-cell.element.js +0 -66
  186. package/dist/components/table/table-header-cell.element.css.js +0 -3
  187. package/dist/components/table/table-header-cell.element.js +0 -40
  188. package/dist/components/table/table-header.element.css.js +0 -3
  189. package/dist/components/table/table-header.element.js +0 -52
  190. package/dist/components/table/table-row.element.css.js +0 -3
  191. package/dist/components/table/table-row.element.js +0 -111
  192. package/dist/components/table/table.element.css.js +0 -3
  193. package/dist/components/table/table.element.js +0 -97
  194. package/dist/components/text/text.component.css.js +0 -3
  195. package/dist/components/text/text.component.js +0 -34
  196. package/dist/components/text/text.models.js +0 -13
  197. package/dist/components/title/title.component.css.js +0 -3
  198. package/dist/components/title/title.component.js +0 -31
  199. package/dist/components/title/title.models.js +0 -10
  200. package/dist/components/toast/toast.element.css.js +0 -3
  201. package/dist/components/toast/toast.element.js +0 -31
  202. package/dist/components/toast/toast.models.js +0 -5
  203. package/dist/components/toggle-button/toggle-button.component.css.js +0 -3
  204. package/dist/components/toggle-button/toggle-button.component.js +0 -52
  205. package/dist/components/tooltip/tooltip.element.css.js +0 -3
  206. package/dist/components/tooltip/tooltip.element.js +0 -120
  207. package/dist/components/tooltip/tooltip.models.js +0 -10
  208. package/dist/components/visually-hidden/visually-hidden.component.css.js +0 -3
  209. package/dist/components/visually-hidden/visually-hidden.component.js +0 -22
  210. package/dist/i18n/lib/config.js +0 -16
  211. package/dist/i18n/lib/format.js +0 -55
  212. package/dist/i18n/lib/is-localized.mixin.js +0 -41
  213. package/dist/i18n/lib/localization.js +0 -28
  214. package/dist/i18n/lib/translate.js +0 -18
  215. package/dist/i18n/main.js +0 -5
  216. package/dist/lib/controllers/focus-trap.controller.js +0 -55
  217. package/dist/lib/custom-element.css.js +0 -3
  218. package/dist/lib/custom-element.js +0 -27
  219. package/dist/lib/decorators/request-update-on-aria-change.js +0 -15
  220. package/dist/lib/directives/aria-boolean-attr.js +0 -9
  221. package/dist/lib/directives/optional-attr.js +0 -8
  222. package/dist/lib/directives/optional-slot.js +0 -14
  223. package/dist/lib/directives/slot-fallback.js +0 -16
  224. package/dist/lib/external/roving-tabindex.js +0 -386
  225. package/dist/lib/facade/checkbox-form-control.js +0 -78
  226. package/dist/lib/facade/checkbox-group-form-control.js +0 -109
  227. package/dist/lib/facade/option-control.js +0 -49
  228. package/dist/lib/facade/radio-group-form-control.js +0 -87
  229. package/dist/lib/facade/select-form-control.js +0 -108
  230. package/dist/lib/main.js +0 -30
  231. package/dist/lib/mixins/can-be-disabled.js +0 -60
  232. package/dist/lib/mixins/can-be-readonly.js +0 -33
  233. package/dist/lib/mixins/can-be-required.js +0 -33
  234. package/dist/lib/mixins/can-be-validated.js +0 -32
  235. package/dist/lib/mixins/dedupe-mixin.js +0 -23
  236. package/dist/lib/mixins/form-control.js +0 -61
  237. package/dist/lib/mixins/number-control.js +0 -63
  238. package/dist/lib/mixins/with-aria-controls.js +0 -43
  239. package/dist/lib/mixins/with-loading-state.js +0 -33
  240. package/dist/lib/utils/date.js +0 -10
  241. package/dist/lib/utils/dom.js +0 -48
  242. package/dist/lib/utils/get-unique-id.js +0 -15
  243. package/dist/lib/utils/keyboard-events.js +0 -42
  244. package/dist/lib/utils/object.js +0 -7
  245. package/dist/lib/utils/shared-intersection-observer.js +0 -37
  246. package/dist/lib/utils/shared-resize-observer.js +0 -38
  247. package/dist/lib/utils/string.js +0 -7
  248. /package/dist/{lib/main.css → styles.css} +0 -0
@@ -1,61 +0,0 @@
1
- import { property } from 'lit/decorators.js';
2
- import { CustomElement } from '../custom-element.js';
3
- import { CanBeDisabled } from './can-be-disabled.js';
4
- import { CanBeReadonly } from './can-be-readonly.js';
5
- import { CanBeRequired } from './can-be-required.js';
6
- import { CanBeValidated } from './can-be-validated.js';
7
- import { dedupeMixin } from './dedupe-mixin.js';
8
-
9
- var __defProp = Object.defineProperty;
10
- var __decorateClass = (decorators, target, key, kind) => {
11
- var result = void 0 ;
12
- for (var i = decorators.length - 1, decorator; i >= 0; i--)
13
- if (decorator = decorators[i])
14
- result = (decorator(target, key, result) ) || result;
15
- if (result) __defProp(target, key, result);
16
- return result;
17
- };
18
- const FormControl = dedupeMixin((superClass) => {
19
- class FormControlElement extends CanBeValidated(CanBeRequired(CanBeReadonly(CanBeDisabled(superClass)))) {
20
- constructor(...args) {
21
- super(...args);
22
- this.name = "";
23
- this.value = "";
24
- this.internals = this.attachInternals();
25
- }
26
- static {
27
- this.formAssociated = true;
28
- }
29
- static {
30
- this.shadowRootOptions = {
31
- ...CustomElement.shadowRootOptions,
32
- delegatesFocus: true
33
- };
34
- }
35
- get form() {
36
- return this.internals.form;
37
- }
38
- toFormValue() {
39
- return this.value;
40
- }
41
- willUpdate(props) {
42
- super.willUpdate?.(props);
43
- this.updateAriaAttributes?.();
44
- }
45
- updated(props) {
46
- super.updated(props);
47
- if (props.has("value")) {
48
- this.internals.setFormValue(this.toFormValue());
49
- }
50
- }
51
- }
52
- __decorateClass([
53
- property()
54
- ], FormControlElement.prototype, "name");
55
- __decorateClass([
56
- property()
57
- ], FormControlElement.prototype, "value");
58
- return FormControlElement;
59
- });
60
-
61
- export { FormControl };
@@ -1,63 +0,0 @@
1
- import { property } from 'lit/decorators.js';
2
- import { dedupeMixin } from './dedupe-mixin.js';
3
- import { FormControl } from './form-control.js';
4
-
5
- var __defProp = Object.defineProperty;
6
- var __decorateClass = (decorators, target, key, kind) => {
7
- var result = void 0 ;
8
- for (var i = decorators.length - 1, decorator; i >= 0; i--)
9
- if (decorator = decorators[i])
10
- result = (decorator(target, key, result) ) || result;
11
- if (result) __defProp(target, key, result);
12
- return result;
13
- };
14
- const MIN_STEP_VALUE = 1 / 2 ^ 16;
15
- const NumberControl = dedupeMixin((superClass) => {
16
- class NumberControlElement extends FormControl(superClass) {
17
- constructor() {
18
- super(...arguments);
19
- this.min = 0;
20
- this.max = 100;
21
- this.step = 1;
22
- this.value = 0;
23
- }
24
- getValueText() {
25
- return this.ariaValueText?.trim() ?? "";
26
- }
27
- update(props) {
28
- if (props.has("value")) {
29
- this.internals.ariaValueNow = String(this.value);
30
- this.internals.ariaValueText = this.getValueText();
31
- }
32
- if (props.has("min")) {
33
- this.internals.ariaValueMin = String(this.min);
34
- }
35
- if (props.has("max")) {
36
- this.internals.ariaValueMax = String(this.max);
37
- }
38
- if (props.has("step")) {
39
- this.step = Math.max(MIN_STEP_VALUE, this.step);
40
- }
41
- this.value = Math.max(this.min, Math.min(this.value, this.max));
42
- super.update?.(props);
43
- }
44
- toFormValue() {
45
- return String(this.value);
46
- }
47
- }
48
- __decorateClass([
49
- property({ type: Number })
50
- ], NumberControlElement.prototype, "min");
51
- __decorateClass([
52
- property({ type: Number })
53
- ], NumberControlElement.prototype, "max");
54
- __decorateClass([
55
- property({ type: Number })
56
- ], NumberControlElement.prototype, "step");
57
- __decorateClass([
58
- property({ type: Number, reflect: true })
59
- ], NumberControlElement.prototype, "value");
60
- return NumberControlElement;
61
- });
62
-
63
- export { NumberControl };
@@ -1,43 +0,0 @@
1
- import { property } from 'lit/decorators.js';
2
- import { getUniqueId } from '../utils/get-unique-id.js';
3
- import { CanBeDisabled } from './can-be-disabled.js';
4
- import { dedupeMixin } from './dedupe-mixin.js';
5
-
6
- var __defProp = Object.defineProperty;
7
- var __decorateClass = (decorators, target, key, kind) => {
8
- var result = void 0 ;
9
- for (var i = decorators.length - 1, decorator; i >= 0; i--)
10
- if (decorator = decorators[i])
11
- result = (decorator(target, key, result) ) || result;
12
- if (result) __defProp(target, key, result);
13
- return result;
14
- };
15
- const WithAriaControls = dedupeMixin((superClass) => {
16
- class WithAriaControlsElement extends CanBeDisabled(superClass) {
17
- get region() {
18
- return this.nextElementSibling;
19
- }
20
- updateA11yAttributes() {
21
- if (!this.region) return;
22
- this.id ||= getUniqueId(this.localName);
23
- this.role ||= "button";
24
- this.region.role ||= "region";
25
- this.region.id ||= `${this.id}-region`;
26
- this.region.ariaHidden = this.disabled ? "true" : this.region.ariaHidden;
27
- this.setAttribute("aria-controls", this.region.id);
28
- this.region.setAttribute("aria-labelledby", this.id);
29
- }
30
- update(props) {
31
- super.update(props);
32
- if (props.has("disabled") || props.has("id")) {
33
- this.updateA11yAttributes();
34
- }
35
- }
36
- }
37
- __decorateClass([
38
- property({ reflect: true })
39
- ], WithAriaControlsElement.prototype, "id");
40
- return WithAriaControlsElement;
41
- });
42
-
43
- export { WithAriaControls };
@@ -1,33 +0,0 @@
1
- import { property } from 'lit/decorators.js';
2
- import { toAriaBooleanAttribute, fromAriaBooleanAttribute } from '../directives/aria-boolean-attr.js';
3
- import { dedupeMixin } from './dedupe-mixin.js';
4
-
5
- var __defProp = Object.defineProperty;
6
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
7
- var __decorateClass = (decorators, target, key, kind) => {
8
- var result = __getOwnPropDesc(target, key) ;
9
- for (var i = decorators.length - 1, decorator; i >= 0; i--)
10
- if (decorator = decorators[i])
11
- result = (decorator(target, key, result) ) || result;
12
- if (result) __defProp(target, key, result);
13
- return result;
14
- };
15
- const WithLoadingState = dedupeMixin((superClass) => {
16
- class WithLoadingStateElement extends superClass {
17
- get loadingContainer() {
18
- return this;
19
- }
20
- set loading(value) {
21
- this.loadingContainer.ariaBusy = toAriaBooleanAttribute(value);
22
- }
23
- get loading() {
24
- return fromAriaBooleanAttribute(this.loadingContainer.ariaBusy);
25
- }
26
- }
27
- __decorateClass([
28
- property({ type: Boolean, reflect: true })
29
- ], WithLoadingStateElement.prototype, "loading");
30
- return WithLoadingStateElement;
31
- });
32
-
33
- export { WithLoadingState };
@@ -1,10 +0,0 @@
1
- function parseDate(value) {
2
- const date = new Date(value);
3
- if (Number.isNaN(date.getTime()) && typeof value === "string") {
4
- const timestamp = Number(value);
5
- return Number.isNaN(timestamp) ? null : new Date(timestamp);
6
- }
7
- return Number.isNaN(date.getTime()) ? null : date;
8
- }
9
-
10
- export { parseDate };
@@ -1,48 +0,0 @@
1
- import { round } from 'es-toolkit';
2
-
3
- function createMutationObserver(callback) {
4
- try {
5
- return new MutationObserver(callback);
6
- } catch {
7
- return { takeRecords: () => [], observe: () => void 0, disconnect: () => void 0 };
8
- }
9
- }
10
- function toggleAttribute(element, name, value) {
11
- if (!element) return;
12
- if (typeof value === "boolean") {
13
- element.toggleAttribute(name, value);
14
- return;
15
- }
16
- if (value != null) {
17
- element.setAttribute(name, value.toString());
18
- return;
19
- }
20
- element.removeAttribute(name);
21
- }
22
- function getElementFromEvent(event, filterFn) {
23
- return event.composedPath().find((node) => node instanceof Element && filterFn(node));
24
- }
25
- function findClosestDocument(node) {
26
- let parent = node.parentNode;
27
- while (parent && parent.nodeType !== Node.DOCUMENT_FRAGMENT_NODE && parent.nodeType !== Node.DOCUMENT_NODE) {
28
- parent = parent.parentNode;
29
- }
30
- return parent;
31
- }
32
- function toPx(value) {
33
- const coercedValue = Number(value);
34
- if (Number.isNaN(coercedValue)) return null;
35
- return `${round(coercedValue, 2)}px`;
36
- }
37
- function getAssignedElements(host, ...slots) {
38
- const selector = slots.map((slot) => `[slot=${slot}]`).join(", ") || "*";
39
- return Array.from(host.querySelectorAll(`:is(${selector})`));
40
- }
41
- async function waitForAnimations(element, subtree = false) {
42
- if (!element || typeof element.getAnimations !== "function") {
43
- return [];
44
- }
45
- return Promise.all(element.getAnimations({ subtree }).map((animation) => animation.finished)).catch(() => []);
46
- }
47
-
48
- export { createMutationObserver, findClosestDocument, getAssignedElements, getElementFromEvent, toPx, toggleAttribute, waitForAnimations };
@@ -1,15 +0,0 @@
1
- const uniqueIdCache = /* @__PURE__ */ new Map();
2
- function getUniqueId(key) {
3
- const nextIndex = (uniqueIdCache.get(key) ?? 0) + 1;
4
- uniqueIdCache.set(key, nextIndex);
5
- return `${key}-${nextIndex}`;
6
- }
7
- function clearUniqueIdCache(key) {
8
- if (key) {
9
- uniqueIdCache.delete(key);
10
- } else {
11
- uniqueIdCache.clear();
12
- }
13
- }
14
-
15
- export { clearUniqueIdCache, getUniqueId };
@@ -1,42 +0,0 @@
1
- const KeyboardKey = {
2
- ARROW_UP: "ArrowUp",
3
- ARROW_DOWN: "ArrowDown",
4
- ARROW_LEFT: "ArrowLeft",
5
- ARROW_RIGHT: "ArrowRight",
6
- ENTER: "Enter",
7
- ESCAPE: "Escape",
8
- SPACE: " ",
9
- TAB: "Tab",
10
- BACKSPACE: "Backspace",
11
- DELETE: "Delete",
12
- END: "End",
13
- HOME: "Home",
14
- PAGE_UP: "PageUp",
15
- PAGE_DOWN: "PageDown",
16
- SHIFT: "Shift",
17
- CONTROL: "Control",
18
- ALT: "Alt",
19
- META: "Meta"
20
- };
21
- function getKeyboardEventInfo(event) {
22
- const { key } = event;
23
- const up = key === KeyboardKey.ARROW_UP;
24
- const right = key === KeyboardKey.ARROW_RIGHT;
25
- const down = key === KeyboardKey.ARROW_DOWN;
26
- const left = key === KeyboardKey.ARROW_LEFT;
27
- return {
28
- axis: { x: left || right, y: up || down },
29
- direction: { up, right, down, left },
30
- actions: {
31
- enter: key === KeyboardKey.ENTER,
32
- escape: key === KeyboardKey.ESCAPE,
33
- space: key === KeyboardKey.SPACE,
34
- tab: key === KeyboardKey.TAB && !event.shiftKey,
35
- backTab: key === KeyboardKey.TAB && event.shiftKey,
36
- start: key === KeyboardKey.HOME,
37
- end: key === KeyboardKey.END
38
- }
39
- };
40
- }
41
-
42
- export { KeyboardKey, getKeyboardEventInfo };
@@ -1,7 +0,0 @@
1
- import { toMerged } from 'es-toolkit';
2
-
3
- function createOptions(defaultOptions) {
4
- return (options) => toMerged(defaultOptions, options ?? {});
5
- }
6
-
7
- export { createOptions };
@@ -1,37 +0,0 @@
1
- function createIntersectionObserver(callback) {
2
- try {
3
- return new IntersectionObserver(callback);
4
- } catch {
5
- return { root: null, rootMargin: "", thresholds: [], takeRecords: () => [], observe: () => void 0, disconnect: () => void 0, unobserve: () => void 0 };
6
- }
7
- }
8
- class SharedIntersectionObserverInstance {
9
- #observer;
10
- #handlers = /* @__PURE__ */ new WeakMap();
11
- #updateLog = /* @__PURE__ */ new WeakMap();
12
- observe(target, handler, options = { fpsLimit: 60 }) {
13
- this.#observer ??= createIntersectionObserver(this.#handleIntersection);
14
- this.#handlers.set(target, [handler, options.fpsLimit]);
15
- this.#observer.observe(target);
16
- }
17
- unobserve(target) {
18
- this.#handlers.delete(target);
19
- this.#observer?.unobserve(target);
20
- }
21
- #handleIntersection = (entries) => {
22
- if (!this.#observer) return;
23
- for (const entry of entries) {
24
- const [handler, fpsLimit] = this.#handlers.get(entry.target) ?? [];
25
- if (typeof handler !== "function" || !this.#shouldUpdate(entry.target, fpsLimit)) continue;
26
- handler?.([entry], this.#observer);
27
- this.#updateLog.set(entry.target, Date.now());
28
- }
29
- };
30
- #shouldUpdate(target, fpsLimit) {
31
- if (!target.isConnected || typeof fpsLimit !== "number" || fpsLimit < 1) return false;
32
- return Date.now() - (this.#updateLog.get(target) ?? 0) >= 1e3 / fpsLimit;
33
- }
34
- }
35
- const SharedIntersectionObserver = new SharedIntersectionObserverInstance();
36
-
37
- export { SharedIntersectionObserver, createIntersectionObserver };
@@ -1,38 +0,0 @@
1
- function createResizeObserver(callback) {
2
- try {
3
- return new ResizeObserver(callback);
4
- } catch {
5
- return { observe: () => void 0, disconnect: () => void 0, unobserve: () => void 0 };
6
- }
7
- }
8
- class SharedResizeObserverInstance {
9
- #observer;
10
- #handlers = /* @__PURE__ */ new WeakMap();
11
- #updateLog = /* @__PURE__ */ new WeakMap();
12
- observe(target, handler, options = { fpsLimit: 60 }) {
13
- const { fpsLimit, ...observerOptions } = options;
14
- this.#observer ??= createResizeObserver(this.#handleResize);
15
- this.#handlers.set(target, [handler, fpsLimit]);
16
- this.#observer.observe(target, observerOptions);
17
- }
18
- unobserve(target) {
19
- this.#handlers.delete(target);
20
- this.#observer?.unobserve(target);
21
- }
22
- #handleResize = (entries) => {
23
- if (!this.#observer) return;
24
- for (const entry of entries) {
25
- const [handler, fpsLimit] = this.#handlers.get(entry.target) ?? [];
26
- if (typeof handler !== "function" || !this.#shouldUpdate(entry.target, fpsLimit ?? 60)) continue;
27
- handler?.([entry], this.#observer);
28
- this.#updateLog.set(entry.target, Date.now());
29
- }
30
- };
31
- #shouldUpdate(target, fpsLimit) {
32
- if (!target.isConnected || fpsLimit < 1) return false;
33
- return Date.now() - (this.#updateLog.get(target) ?? 0) >= 1e3 / fpsLimit;
34
- }
35
- }
36
- const SharedResizeObserver = new SharedResizeObserverInstance();
37
-
38
- export { SharedResizeObserver, createResizeObserver };
@@ -1,7 +0,0 @@
1
- function interpolate(value, context) {
2
- return value.replaceAll(/\{\{\s*([^}\s]+)\s*}}/g, (match, variableName) => {
3
- return context[variableName] ? interpolate(context[variableName].toString(), context) : match;
4
- });
5
- }
6
-
7
- export { interpolate };
File without changes