@design-factory/angular 21.1.0-next.0 → 21.1.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 (191) hide show
  1. package/fesm2022/design-factory-angular-drawer.mjs +22 -29
  2. package/fesm2022/design-factory-angular-drawer.mjs.map +1 -1
  3. package/fesm2022/design-factory-angular-internals.mjs +5 -5
  4. package/fesm2022/design-factory-angular-internals.mjs.map +1 -1
  5. package/fesm2022/design-factory-angular-sidenav.mjs +139 -62
  6. package/fesm2022/design-factory-angular-sidenav.mjs.map +1 -1
  7. package/fesm2022/design-factory-angular-theme.mjs +1 -1
  8. package/fesm2022/design-factory-angular-theme.mjs.map +1 -1
  9. package/fesm2022/design-factory-angular-topnav.mjs +152 -75
  10. package/fesm2022/design-factory-angular-topnav.mjs.map +1 -1
  11. package/package.json +3 -6
  12. package/types/design-factory-angular-drawer.d.ts +13 -14
  13. package/types/design-factory-angular-internals.d.ts +3 -3
  14. package/types/design-factory-angular-sidenav.d.ts +19 -6
  15. package/types/design-factory-angular-topnav.d.ts +13 -6
  16. package/node_modules/@agnos-ui/core/README.md +0 -5
  17. package/node_modules/@agnos-ui/core/accordion-BC_9xn23.cjs +0 -314
  18. package/node_modules/@agnos-ui/core/accordion-Ca_0T8Bc.js +0 -315
  19. package/node_modules/@agnos-ui/core/alert-AhaliJ17.cjs +0 -9
  20. package/node_modules/@agnos-ui/core/alert-Cb9FhbFQ.js +0 -10
  21. package/node_modules/@agnos-ui/core/collapse-COriZO7o.cjs +0 -94
  22. package/node_modules/@agnos-ui/core/collapse-CP79atna.js +0 -95
  23. package/node_modules/@agnos-ui/core/common-B5jS-Ih_.cjs +0 -73
  24. package/node_modules/@agnos-ui/core/common-DFyZvkII.js +0 -74
  25. package/node_modules/@agnos-ui/core/components/accordion/accordion.d.ts +0 -333
  26. package/node_modules/@agnos-ui/core/components/accordion/index.cjs +0 -7
  27. package/node_modules/@agnos-ui/core/components/accordion/index.d.ts +0 -1
  28. package/node_modules/@agnos-ui/core/components/accordion/index.js +0 -7
  29. package/node_modules/@agnos-ui/core/components/alert/alert.d.ts +0 -37
  30. package/node_modules/@agnos-ui/core/components/alert/common.d.ts +0 -138
  31. package/node_modules/@agnos-ui/core/components/alert/index.cjs +0 -5
  32. package/node_modules/@agnos-ui/core/components/alert/index.d.ts +0 -1
  33. package/node_modules/@agnos-ui/core/components/alert/index.js +0 -5
  34. package/node_modules/@agnos-ui/core/components/carousel/carousel.d.ts +0 -247
  35. package/node_modules/@agnos-ui/core/components/carousel/index.cjs +0 -292
  36. package/node_modules/@agnos-ui/core/components/carousel/index.d.ts +0 -1
  37. package/node_modules/@agnos-ui/core/components/carousel/index.js +0 -292
  38. package/node_modules/@agnos-ui/core/components/collapse/collapse.d.ts +0 -135
  39. package/node_modules/@agnos-ui/core/components/collapse/index.cjs +0 -5
  40. package/node_modules/@agnos-ui/core/components/collapse/index.d.ts +0 -1
  41. package/node_modules/@agnos-ui/core/components/collapse/index.js +0 -5
  42. package/node_modules/@agnos-ui/core/components/commonProps.d.ts +0 -11
  43. package/node_modules/@agnos-ui/core/components/drawer/drawer.d.ts +0 -279
  44. package/node_modules/@agnos-ui/core/components/drawer/index.cjs +0 -5
  45. package/node_modules/@agnos-ui/core/components/drawer/index.d.ts +0 -1
  46. package/node_modules/@agnos-ui/core/components/drawer/index.js +0 -5
  47. package/node_modules/@agnos-ui/core/components/modal/index.cjs +0 -8
  48. package/node_modules/@agnos-ui/core/components/modal/index.d.ts +0 -1
  49. package/node_modules/@agnos-ui/core/components/modal/index.js +0 -8
  50. package/node_modules/@agnos-ui/core/components/modal/modal.d.ts +0 -245
  51. package/node_modules/@agnos-ui/core/components/pagination/index.cjs +0 -5
  52. package/node_modules/@agnos-ui/core/components/pagination/index.d.ts +0 -1
  53. package/node_modules/@agnos-ui/core/components/pagination/index.js +0 -5
  54. package/node_modules/@agnos-ui/core/components/pagination/pagination.d.ts +0 -313
  55. package/node_modules/@agnos-ui/core/components/progressbar/index.cjs +0 -5
  56. package/node_modules/@agnos-ui/core/components/progressbar/index.d.ts +0 -1
  57. package/node_modules/@agnos-ui/core/components/progressbar/index.js +0 -5
  58. package/node_modules/@agnos-ui/core/components/progressbar/progressbar.d.ts +0 -91
  59. package/node_modules/@agnos-ui/core/components/rating/index.cjs +0 -5
  60. package/node_modules/@agnos-ui/core/components/rating/index.d.ts +0 -1
  61. package/node_modules/@agnos-ui/core/components/rating/index.js +0 -5
  62. package/node_modules/@agnos-ui/core/components/rating/rating.d.ts +0 -191
  63. package/node_modules/@agnos-ui/core/components/slider/index.cjs +0 -5
  64. package/node_modules/@agnos-ui/core/components/slider/index.d.ts +0 -1
  65. package/node_modules/@agnos-ui/core/components/slider/index.js +0 -5
  66. package/node_modules/@agnos-ui/core/components/slider/slider-utils.d.ts +0 -25
  67. package/node_modules/@agnos-ui/core/components/slider/slider.d.ts +0 -383
  68. package/node_modules/@agnos-ui/core/components/toast/index.cjs +0 -7
  69. package/node_modules/@agnos-ui/core/components/toast/index.d.ts +0 -2
  70. package/node_modules/@agnos-ui/core/components/toast/index.js +0 -7
  71. package/node_modules/@agnos-ui/core/components/toast/toast.d.ts +0 -66
  72. package/node_modules/@agnos-ui/core/components/toast/toaster.d.ts +0 -128
  73. package/node_modules/@agnos-ui/core/components/tree/index.cjs +0 -5
  74. package/node_modules/@agnos-ui/core/components/tree/index.d.ts +0 -1
  75. package/node_modules/@agnos-ui/core/components/tree/index.js +0 -5
  76. package/node_modules/@agnos-ui/core/components/tree/tree.d.ts +0 -143
  77. package/node_modules/@agnos-ui/core/config.cjs +0 -36
  78. package/node_modules/@agnos-ui/core/config.d.ts +0 -117
  79. package/node_modules/@agnos-ui/core/config.js +0 -36
  80. package/node_modules/@agnos-ui/core/directive-Bsreu2z1.js +0 -523
  81. package/node_modules/@agnos-ui/core/directive-DCaXmRe_.cjs +0 -522
  82. package/node_modules/@agnos-ui/core/drawer-BbFAHV07.cjs +0 -328
  83. package/node_modules/@agnos-ui/core/drawer-C6Qa0xEu.js +0 -329
  84. package/node_modules/@agnos-ui/core/index.cjs +0 -134
  85. package/node_modules/@agnos-ui/core/index.d.ts +0 -29
  86. package/node_modules/@agnos-ui/core/index.js +0 -134
  87. package/node_modules/@agnos-ui/core/isFocusable-Ckwus82R.js +0 -32
  88. package/node_modules/@agnos-ui/core/isFocusable-DfzDLeAN.cjs +0 -31
  89. package/node_modules/@agnos-ui/core/modal-BsNuHhT7.cjs +0 -252
  90. package/node_modules/@agnos-ui/core/modal-CgzY8ezz.js +0 -253
  91. package/node_modules/@agnos-ui/core/package.json +0 -57
  92. package/node_modules/@agnos-ui/core/pagination-ZxGaNWZz.js +0 -255
  93. package/node_modules/@agnos-ui/core/pagination-xbcOHnhd.cjs +0 -254
  94. package/node_modules/@agnos-ui/core/progressbar-CRbMKp4b.cjs +0 -86
  95. package/node_modules/@agnos-ui/core/progressbar-CSEIFnlD.js +0 -87
  96. package/node_modules/@agnos-ui/core/promise-CxCD3NYv.cjs +0 -118
  97. package/node_modules/@agnos-ui/core/promise-D-RZVPuv.js +0 -119
  98. package/node_modules/@agnos-ui/core/rating-BIdiiPUo.js +0 -184
  99. package/node_modules/@agnos-ui/core/rating-qx1xaBmz.cjs +0 -183
  100. package/node_modules/@agnos-ui/core/scrollbars-CT87iv_6.cjs +0 -30
  101. package/node_modules/@agnos-ui/core/scrollbars-CcxSrnCx.js +0 -31
  102. package/node_modules/@agnos-ui/core/services/extendWidget.cjs +0 -41
  103. package/node_modules/@agnos-ui/core/services/extendWidget.d.ts +0 -31
  104. package/node_modules/@agnos-ui/core/services/extendWidget.js +0 -41
  105. package/node_modules/@agnos-ui/core/services/floatingUI.cjs +0 -111
  106. package/node_modules/@agnos-ui/core/services/floatingUI.d.ts +0 -76
  107. package/node_modules/@agnos-ui/core/services/floatingUI.js +0 -111
  108. package/node_modules/@agnos-ui/core/services/focusElement.cjs +0 -46
  109. package/node_modules/@agnos-ui/core/services/focusElement.d.ts +0 -9
  110. package/node_modules/@agnos-ui/core/services/focusElement.js +0 -46
  111. package/node_modules/@agnos-ui/core/services/focustrack.cjs +0 -47
  112. package/node_modules/@agnos-ui/core/services/focustrack.d.ts +0 -40
  113. package/node_modules/@agnos-ui/core/services/focustrack.js +0 -47
  114. package/node_modules/@agnos-ui/core/services/hash.cjs +0 -15
  115. package/node_modules/@agnos-ui/core/services/hash.d.ts +0 -3
  116. package/node_modules/@agnos-ui/core/services/hash.js +0 -15
  117. package/node_modules/@agnos-ui/core/services/intersection.cjs +0 -53
  118. package/node_modules/@agnos-ui/core/services/intersection.d.ts +0 -30
  119. package/node_modules/@agnos-ui/core/services/intersection.js +0 -53
  120. package/node_modules/@agnos-ui/core/services/matchMedia.cjs +0 -14
  121. package/node_modules/@agnos-ui/core/services/matchMedia.d.ts +0 -8
  122. package/node_modules/@agnos-ui/core/services/matchMedia.js +0 -14
  123. package/node_modules/@agnos-ui/core/services/navManager.cjs +0 -166
  124. package/node_modules/@agnos-ui/core/services/navManager.d.ts +0 -144
  125. package/node_modules/@agnos-ui/core/services/navManager.js +0 -166
  126. package/node_modules/@agnos-ui/core/services/pointerdownPosition.cjs +0 -60
  127. package/node_modules/@agnos-ui/core/services/pointerdownPosition.d.ts +0 -42
  128. package/node_modules/@agnos-ui/core/services/pointerdownPosition.js +0 -60
  129. package/node_modules/@agnos-ui/core/services/portal.cjs +0 -42
  130. package/node_modules/@agnos-ui/core/services/portal.d.ts +0 -16
  131. package/node_modules/@agnos-ui/core/services/portal.js +0 -42
  132. package/node_modules/@agnos-ui/core/services/resizeObserver.cjs +0 -54
  133. package/node_modules/@agnos-ui/core/services/resizeObserver.d.ts +0 -18
  134. package/node_modules/@agnos-ui/core/services/resizeObserver.js +0 -54
  135. package/node_modules/@agnos-ui/core/services/siblingsInert.cjs +0 -44
  136. package/node_modules/@agnos-ui/core/services/siblingsInert.d.ts +0 -16
  137. package/node_modules/@agnos-ui/core/services/siblingsInert.js +0 -44
  138. package/node_modules/@agnos-ui/core/services/transitions/baseTransitions.cjs +0 -186
  139. package/node_modules/@agnos-ui/core/services/transitions/baseTransitions.d.ts +0 -166
  140. package/node_modules/@agnos-ui/core/services/transitions/baseTransitions.js +0 -186
  141. package/node_modules/@agnos-ui/core/services/transitions/collapse.cjs +0 -40
  142. package/node_modules/@agnos-ui/core/services/transitions/collapse.d.ts +0 -49
  143. package/node_modules/@agnos-ui/core/services/transitions/collapse.js +0 -40
  144. package/node_modules/@agnos-ui/core/services/transitions/cssTransitions.cjs +0 -32
  145. package/node_modules/@agnos-ui/core/services/transitions/cssTransitions.d.ts +0 -25
  146. package/node_modules/@agnos-ui/core/services/transitions/cssTransitions.js +0 -32
  147. package/node_modules/@agnos-ui/core/services/transitions/simpleClassTransition.cjs +0 -37
  148. package/node_modules/@agnos-ui/core/services/transitions/simpleClassTransition.d.ts +0 -47
  149. package/node_modules/@agnos-ui/core/services/transitions/simpleClassTransition.js +0 -37
  150. package/node_modules/@agnos-ui/core/slider-B93hE0ag.cjs +0 -807
  151. package/node_modules/@agnos-ui/core/slider-Cjiq9FgI.js +0 -808
  152. package/node_modules/@agnos-ui/core/textDirection-cNgt24LJ.js +0 -4
  153. package/node_modules/@agnos-ui/core/textDirection-zqcZ5-eK.cjs +0 -3
  154. package/node_modules/@agnos-ui/core/toaster-BQWqxYv-.cjs +0 -190
  155. package/node_modules/@agnos-ui/core/toaster-BzEkshT2.js +0 -191
  156. package/node_modules/@agnos-ui/core/tree-DY04XPPg.cjs +0 -228
  157. package/node_modules/@agnos-ui/core/tree-HwcvZ0_p.js +0 -229
  158. package/node_modules/@agnos-ui/core/types.cjs +0 -6
  159. package/node_modules/@agnos-ui/core/types.d.ts +0 -246
  160. package/node_modules/@agnos-ui/core/types.js +0 -6
  161. package/node_modules/@agnos-ui/core/utils/directive.cjs +0 -28
  162. package/node_modules/@agnos-ui/core/utils/directive.d.ts +0 -352
  163. package/node_modules/@agnos-ui/core/utils/directive.js +0 -28
  164. package/node_modules/@agnos-ui/core/utils/func.cjs +0 -7
  165. package/node_modules/@agnos-ui/core/utils/func.d.ts +0 -11
  166. package/node_modules/@agnos-ui/core/utils/func.js +0 -7
  167. package/node_modules/@agnos-ui/core/utils/id.cjs +0 -5
  168. package/node_modules/@agnos-ui/core/utils/id.d.ts +0 -6
  169. package/node_modules/@agnos-ui/core/utils/id.js +0 -5
  170. package/node_modules/@agnos-ui/core/utils/internal/assign.d.ts +0 -10
  171. package/node_modules/@agnos-ui/core/utils/internal/checks.d.ts +0 -57
  172. package/node_modules/@agnos-ui/core/utils/internal/dom.d.ts +0 -75
  173. package/node_modules/@agnos-ui/core/utils/internal/isFocusable.d.ts +0 -9
  174. package/node_modules/@agnos-ui/core/utils/internal/math.d.ts +0 -5
  175. package/node_modules/@agnos-ui/core/utils/internal/promise.d.ts +0 -98
  176. package/node_modules/@agnos-ui/core/utils/internal/scrollbars.d.ts +0 -8
  177. package/node_modules/@agnos-ui/core/utils/internal/sort.d.ts +0 -16
  178. package/node_modules/@agnos-ui/core/utils/internal/ssrHTMLElement.d.ts +0 -17
  179. package/node_modules/@agnos-ui/core/utils/internal/textDirection.d.ts +0 -7
  180. package/node_modules/@agnos-ui/core/utils/internal/traversal.d.ts +0 -54
  181. package/node_modules/@agnos-ui/core/utils/stores.cjs +0 -172
  182. package/node_modules/@agnos-ui/core/utils/stores.d.ts +0 -224
  183. package/node_modules/@agnos-ui/core/utils/stores.js +0 -172
  184. package/node_modules/@agnos-ui/core/utils/widget.cjs +0 -8
  185. package/node_modules/@agnos-ui/core/utils/widget.d.ts +0 -11
  186. package/node_modules/@agnos-ui/core/utils/widget.js +0 -8
  187. package/node_modules/@agnos-ui/core/utils/writables.cjs +0 -16
  188. package/node_modules/@agnos-ui/core/utils/writables.d.ts +0 -95
  189. package/node_modules/@agnos-ui/core/utils/writables.js +0 -16
  190. package/node_modules/@agnos-ui/core/writables-DYGjj5T3.js +0 -103
  191. package/node_modules/@agnos-ui/core/writables-Dt68gADJ.cjs +0 -102
@@ -1,523 +0,0 @@
1
- import { readable, batch, asReadable, writable, derived, computed } from "@amadeus-it-group/tansu";
2
- import { BROWSER } from "esm-env";
3
- import { noop } from "./utils/func.js";
4
- const computeCommonAncestor = (elements) => {
5
- const length = elements.length;
6
- if (length === 0) return null;
7
- let ancestor = elements[0];
8
- for (let i = 1; i < length && ancestor; i++) {
9
- const element = elements[i];
10
- while (ancestor) {
11
- if (ancestor === element) {
12
- break;
13
- }
14
- const comparison = ancestor.compareDocumentPosition(element);
15
- if (comparison & Node.DOCUMENT_POSITION_CONTAINED_BY) {
16
- break;
17
- } else if (comparison & Node.DOCUMENT_POSITION_CONTAINS) {
18
- ancestor = element;
19
- break;
20
- } else if (comparison & Node.DOCUMENT_POSITION_DISCONNECTED) {
21
- return null;
22
- }
23
- ancestor = ancestor.parentElement;
24
- }
25
- }
26
- return ancestor;
27
- };
28
- const reflow = BROWSER ? (element = document.body) => {
29
- if (isBrowserHTMLElement(element)) {
30
- element.getBoundingClientRect();
31
- }
32
- } : noop;
33
- const addClasses = (element, classes) => {
34
- if (classes && classes.length > 0) {
35
- element.classList.add(...classes);
36
- }
37
- };
38
- const removeClasses = (element, classes) => {
39
- if (classes && classes.length > 0) {
40
- element.classList.remove(...classes);
41
- }
42
- };
43
- function addEvent(element, type, fn, options) {
44
- element.addEventListener(type, fn, options);
45
- return function() {
46
- element.removeEventListener(type, fn, options);
47
- };
48
- }
49
- const notEmpty = (value) => value != null && value !== false;
50
- function classNamesSubscribe(node, classNames$) {
51
- let currentClassNames = /* @__PURE__ */ new Set();
52
- return classNames$.subscribe((newClassName) => {
53
- const classNames = new Set(`${newClassName ?? ""}`.split(" "));
54
- classNames.delete("");
55
- const classList = node.classList;
56
- for (const className of currentClassNames) {
57
- if (!classNames.has(className)) {
58
- classList.remove(className);
59
- }
60
- }
61
- if (classNames.size > 0) {
62
- classList.add(...classNames);
63
- }
64
- currentClassNames = classNames;
65
- });
66
- }
67
- function attributeSubscribe(node, attributeName, value$) {
68
- return value$.subscribe((value) => {
69
- if (notEmpty(value)) {
70
- node.setAttribute(attributeName, "" + (value === true ? attributeName : value));
71
- } else {
72
- node.removeAttribute(attributeName);
73
- }
74
- });
75
- }
76
- function bindAttribute(node, attributeName, value$) {
77
- const isClass = attributeName === "class";
78
- return isClass ? classNamesSubscribe(node, value$) : attributeSubscribe(node, attributeName, value$);
79
- }
80
- const isCustomProperty = (styleName) => styleName.startsWith("--");
81
- function bindStyle(node, styleName, value$) {
82
- return value$.subscribe((value) => {
83
- const style = node.style;
84
- value = "" + (notEmpty(value) ? value : "");
85
- if (isCustomProperty(styleName)) {
86
- style.setProperty(styleName, value);
87
- } else {
88
- style[styleName] = value;
89
- }
90
- });
91
- }
92
- function bindClassName(node, className, value$) {
93
- const unsubscribe = value$.subscribe((isPresent) => {
94
- node.classList.toggle(className, isPresent);
95
- });
96
- return () => {
97
- unsubscribe();
98
- node.classList.remove(className);
99
- };
100
- }
101
- const importantSuffixRegExp = /\s*!important$/;
102
- const withoutImportant = (value) => value?.replace(importantSuffixRegExp, "") ?? "";
103
- const toKebabCase = (str) => str.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
104
- const getStyleKeyFromDirectProp = (str) => {
105
- if (typeof str !== "string" || str.startsWith("--")) {
106
- return void 0;
107
- }
108
- return toKebabCase(str);
109
- };
110
- const getStyleKeyFromMethods = (str) => {
111
- if (!str.startsWith("--") && str !== toKebabCase(str)) {
112
- return void 0;
113
- }
114
- return str;
115
- };
116
- const ssrHTMLElementStyle = /* @__PURE__ */ Symbol("style");
117
- class SSRStyle {
118
- // all styles in kebab-case, including custom properties:
119
- [ssrHTMLElementStyle] = {};
120
- constructor() {
121
- return new Proxy(this, {
122
- get: (target, prop) => {
123
- const styleKey = prop in target ? void 0 : getStyleKeyFromDirectProp(prop);
124
- if (styleKey) {
125
- return withoutImportant(target[ssrHTMLElementStyle][styleKey]);
126
- } else {
127
- return target[prop];
128
- }
129
- },
130
- set: (target, prop, value) => {
131
- const styleKey = prop in target ? void 0 : getStyleKeyFromDirectProp(prop);
132
- if (styleKey) {
133
- target.setProperty(styleKey, value);
134
- } else {
135
- target[prop] = value;
136
- }
137
- return true;
138
- }
139
- });
140
- }
141
- setProperty(property, value, priority) {
142
- if (!value) {
143
- this.removeProperty(property);
144
- return;
145
- }
146
- const key = getStyleKeyFromMethods(property);
147
- if (!key || priority !== "important" && priority !== "" && priority != null || importantSuffixRegExp.test(value)) {
148
- return;
149
- }
150
- this[ssrHTMLElementStyle][key] = value + (priority ? " !important" : "");
151
- }
152
- removeProperty(property) {
153
- const key = getStyleKeyFromMethods(property);
154
- if (!key) {
155
- return "";
156
- }
157
- const style = this[ssrHTMLElementStyle];
158
- const value = style[key];
159
- delete style[key];
160
- return withoutImportant(value);
161
- }
162
- }
163
- const ssrHTMLElementAttributesAndStyle = /* @__PURE__ */ Symbol("attributesAndStyle");
164
- const spaceRegExp = /\s+/;
165
- const ssrHTMLElement = () => {
166
- const attributes = {};
167
- const style = new SSRStyle();
168
- let classNames = /* @__PURE__ */ new Set();
169
- const toggleClass = (className, force = !classNames.has(className)) => {
170
- if (force) {
171
- classNames.add(className);
172
- } else {
173
- classNames.delete(className);
174
- }
175
- return !!force;
176
- };
177
- const toggleAll = (force) => (...classNames2) => classNames2.forEach((className) => toggleClass(className, force));
178
- return {
179
- style,
180
- classList: {
181
- add: toggleAll(true),
182
- remove: toggleAll(false),
183
- toggle: toggleClass
184
- },
185
- setAttribute(name, value) {
186
- if (name === "class") {
187
- classNames = new Set(value.trim().split(spaceRegExp));
188
- } else if (name === "style") {
189
- throw new Error(
190
- 'setAttribute("style",...) is not implemented in ssrHTMLElement. Use the style property instead.'
191
- );
192
- } else {
193
- attributes[name] = value;
194
- }
195
- },
196
- removeAttribute(name) {
197
- if (name === "class") {
198
- classNames = /* @__PURE__ */ new Set();
199
- } else {
200
- delete attributes[name];
201
- }
202
- },
203
- [ssrHTMLElementAttributesAndStyle]() {
204
- return { attributes: { ...attributes }, classNames: [...classNames], style: { ...style[ssrHTMLElementStyle] } };
205
- }
206
- };
207
- };
208
- const cssEscapeStyleName = (styleName) => styleName.replace(/([^\w-])/gi, "\\$1");
209
- const cssTextFromObject = (style) => Object.entries(style).filter(([, value]) => !!value).map(([name, value]) => `${cssEscapeStyleName(name)}: ${value};`).join("");
210
- function r(e) {
211
- var t, f, n = "";
212
- if ("string" == typeof e || "number" == typeof e) n += e;
213
- else if ("object" == typeof e) if (Array.isArray(e)) {
214
- var o = e.length;
215
- for (t = 0; t < o; t++) e[t] && (f = r(e[t])) && (n && (n += " "), n += f);
216
- } else for (f in e) e[f] && (n && (n += " "), n += f);
217
- return n;
218
- }
219
- function clsx() {
220
- for (var e, t, f = 0, n = "", o = arguments.length; f < o; f++) (e = arguments[f]) && (t = r(e)) && (n && (n += " "), n += t);
221
- return n;
222
- }
223
- const isBrowserHTMLElement = BROWSER ? ((element) => {
224
- const contentWindow = element?.ownerDocument?.defaultView ?? window;
225
- return element instanceof contentWindow.HTMLElement;
226
- }) : (
227
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
228
- ((element) => false)
229
- );
230
- const browserDirective = BROWSER ? (directive) => (node, args) => {
231
- if (isBrowserHTMLElement(node)) {
232
- return directive(node, args);
233
- }
234
- } : (
235
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
236
- ((directive) => noop)
237
- );
238
- const bindDirective = (directive, directiveArg$) => (element) => {
239
- let firstTime = true;
240
- let instance;
241
- const unsubscribe = directiveArg$.subscribe((value) => {
242
- if (firstTime) {
243
- firstTime = false;
244
- instance = directive(element, value);
245
- } else {
246
- instance?.update?.(value);
247
- }
248
- });
249
- return {
250
- destroy() {
251
- instance?.destroy?.();
252
- unsubscribe();
253
- }
254
- };
255
- };
256
- const noArg = readable(void 0);
257
- const bindDirectiveNoArg = (directive) => bindDirective(directive, noArg);
258
- const mapDirectiveArg = (directive, fn) => (node, arg) => {
259
- const instance = directive(node, fn(arg));
260
- return {
261
- update: (arg2) => {
262
- instance?.update?.(fn(arg2));
263
- },
264
- destroy: () => instance?.destroy?.()
265
- };
266
- };
267
- const directiveSubscribe = (store, asyncUnsubscribe = true) => () => {
268
- const unsubscribe = store.subscribe(noop);
269
- return {
270
- destroy: () => void (async () => {
271
- if (asyncUnsubscribe) {
272
- await Promise.resolve();
273
- }
274
- unsubscribe();
275
- })()
276
- };
277
- };
278
- const directiveUpdate = (update) => (_element, arg) => {
279
- update(arg);
280
- return {
281
- update
282
- };
283
- };
284
- const equalOption = { equal: Object.is };
285
- const registrationArray = () => {
286
- const elements$ = writable([], equalOption);
287
- return asReadable(elements$, {
288
- /**
289
- * Add the given element to the array.
290
- * @param element - Element to be added to the array.
291
- * @returns A function to remove the element from the array.
292
- */
293
- register: (element) => {
294
- let removed = false;
295
- elements$.update((currentElements) => [...currentElements, element]);
296
- return () => {
297
- if (!removed) {
298
- removed = true;
299
- elements$.update((currentElements) => {
300
- const index = currentElements.indexOf(element);
301
- if (index > -1) {
302
- const copy = [...currentElements];
303
- copy.splice(index, 1);
304
- return copy;
305
- }
306
- return currentElements;
307
- });
308
- }
309
- };
310
- }
311
- });
312
- };
313
- const createConditionalStoreArrayDirective = () => {
314
- const elements$ = registrationArray();
315
- return {
316
- elements$: asReadable(elements$),
317
- directive: (element, enabled = true) => {
318
- let destroyElements;
319
- const update = (newEnabled = true) => {
320
- if (!!newEnabled != !!destroyElements) {
321
- if (newEnabled) {
322
- destroyElements = elements$.register(element);
323
- } else {
324
- destroyElements?.();
325
- destroyElements = void 0;
326
- }
327
- }
328
- };
329
- update(enabled);
330
- return {
331
- destroy: () => update(false),
332
- update
333
- };
334
- }
335
- };
336
- };
337
- const createStoreArrayDirective = () => {
338
- const { directive, elements$ } = createConditionalStoreArrayDirective();
339
- return {
340
- directive: bindDirectiveNoArg(directive),
341
- elements$
342
- };
343
- };
344
- const createBrowserStoreArrayDirective = () => {
345
- const { directive, elements$ } = createStoreArrayDirective();
346
- return { directive: browserDirective(directive), elements$ };
347
- };
348
- const createConditionalBrowserStoreArrayDirective = () => {
349
- const { directive, elements$ } = createConditionalStoreArrayDirective();
350
- return { directive: browserDirective(directive), elements$ };
351
- };
352
- const createStoreDirective = () => {
353
- const element$ = writable(null, equalOption);
354
- return {
355
- element$: asReadable(element$),
356
- directive: (element) => {
357
- let valid = false;
358
- element$.update((currentElement) => {
359
- if (currentElement) {
360
- console.error("The directive cannot be used on multiple elements.", currentElement, element);
361
- return currentElement;
362
- }
363
- valid = true;
364
- return element;
365
- });
366
- return valid ? {
367
- destroy() {
368
- element$.update((currentElement) => element === currentElement ? null : currentElement);
369
- }
370
- } : void 0;
371
- }
372
- };
373
- };
374
- const createBrowserStoreDirective = () => {
375
- const { directive, element$ } = createStoreDirective();
376
- return { directive: browserDirective(directive), element$ };
377
- };
378
- const conditionalDirective = (directive, condition) => (element, arg) => {
379
- const instance$ = derived(
380
- condition,
381
- (enabled, set) => {
382
- const instance = enabled ? directive(element, arg) : void 0;
383
- set(instance);
384
- return () => instance?.destroy?.();
385
- },
386
- void 0
387
- );
388
- const destroy = instance$.subscribe(() => {
389
- });
390
- return {
391
- update(newArg) {
392
- arg = newArg;
393
- instance$()?.update?.(newArg);
394
- },
395
- destroy
396
- };
397
- };
398
- const mergeDirectives = (...args) => (element, arg) => {
399
- const instances = batch(() => args.map((directive) => directive(element, arg)));
400
- return {
401
- update(arg2) {
402
- batch(() => instances.forEach((instance) => instance?.update?.(arg2)));
403
- },
404
- destroy() {
405
- batch(() => instances.reverse().forEach((instance) => instance?.destroy?.()));
406
- }
407
- };
408
- };
409
- const multiDirective = (element, directives) => {
410
- const instances = [];
411
- const update = (directives2) => batch(() => {
412
- directives2.forEach((directiveWithArg, index) => {
413
- const [directive, arg] = Array.isArray(directiveWithArg) ? directiveWithArg : [directiveWithArg, void 0];
414
- const oldInstance = instances[index];
415
- if (oldInstance) {
416
- if (oldInstance.directive === directive) {
417
- if (oldInstance.arg !== arg) {
418
- oldInstance.instance?.update?.(arg);
419
- oldInstance.arg = arg;
420
- }
421
- return;
422
- }
423
- oldInstance.instance?.destroy?.();
424
- }
425
- const instance = directive(element, arg);
426
- instances[index] = { directive, instance, arg };
427
- });
428
- const extraInstances = instances.splice(directives2.length);
429
- extraInstances.reverse().forEach(({ instance }) => instance?.destroy?.());
430
- });
431
- update(directives);
432
- return {
433
- update,
434
- destroy: () => update([])
435
- };
436
- };
437
- const createAttributesDirective = (propsFn) => (node, args) => {
438
- const unsubscribers = [];
439
- const args$ = writable(args);
440
- const { events, attributes, styles, classNames } = propsFn(args$);
441
- if (isBrowserHTMLElement(node)) {
442
- for (const [type, event] of Object.entries(events ?? {})) {
443
- if (typeof event === "function") {
444
- unsubscribers.push(addEvent(node, type, event));
445
- } else {
446
- unsubscribers.push(addEvent(node, type, event.handler, event.options));
447
- }
448
- }
449
- }
450
- for (const [attributeName, value] of Object.entries(attributes ?? {})) {
451
- if (value != null) {
452
- unsubscribers.push(bindAttribute(node, attributeName, value));
453
- }
454
- }
455
- for (const [styleName, value] of Object.entries(styles ?? {})) {
456
- if (value) {
457
- unsubscribers.push(bindStyle(node, styleName, value));
458
- }
459
- }
460
- for (const [className, value] of Object.entries(classNames ?? {})) {
461
- unsubscribers.push(bindClassName(node, className, value));
462
- }
463
- return {
464
- update: (args2) => args$.set(args2),
465
- destroy: () => unsubscribers.forEach((fn) => fn())
466
- };
467
- };
468
- const attributesData = (...directives) => {
469
- const instances = [];
470
- try {
471
- const element = ssrHTMLElement();
472
- for (const directive of directives) {
473
- instances.push(Array.isArray(directive) ? directive[0](element, directive[1]) : directive(element));
474
- }
475
- return element[ssrHTMLElementAttributesAndStyle]();
476
- } finally {
477
- instances.forEach((instance) => instance?.destroy?.());
478
- }
479
- };
480
- const classDirective = createAttributesDirective((className$) => ({
481
- attributes: { class: computed(() => clsx(className$())) }
482
- }));
483
- function directiveAttributes(...directives) {
484
- const { attributes, classNames, style } = attributesData(...directives);
485
- if (classNames.length) {
486
- attributes["class"] = classNames.join(" ");
487
- }
488
- const stringStyle = cssTextFromObject(style);
489
- if (stringStyle.length) {
490
- attributes["style"] = stringStyle;
491
- }
492
- return attributes;
493
- }
494
- const ssrAttributes = BROWSER ? () => ({}) : directiveAttributes;
495
- export {
496
- computeCommonAncestor as A,
497
- attributesData as a,
498
- bindDirective as b,
499
- bindDirectiveNoArg as c,
500
- browserDirective as d,
501
- classDirective as e,
502
- conditionalDirective as f,
503
- createAttributesDirective as g,
504
- createBrowserStoreArrayDirective as h,
505
- createBrowserStoreDirective as i,
506
- createConditionalBrowserStoreArrayDirective as j,
507
- createConditionalStoreArrayDirective as k,
508
- createStoreArrayDirective as l,
509
- createStoreDirective as m,
510
- directiveAttributes as n,
511
- directiveSubscribe as o,
512
- directiveUpdate as p,
513
- isBrowserHTMLElement as q,
514
- mapDirectiveArg as r,
515
- mergeDirectives as s,
516
- multiDirective as t,
517
- registrationArray as u,
518
- ssrAttributes as v,
519
- addEvent as w,
520
- removeClasses as x,
521
- addClasses as y,
522
- reflow as z
523
- };