@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,172 +0,0 @@
1
- import { readable, equal, asWritable, derived, computed, batch, asReadable, get, writable } from "@amadeus-it-group/tansu";
2
- import { INVALID_VALUE } from "../types.js";
3
- import { identity } from "./func.js";
4
- import { generateId } from "./id.js";
5
- function createPatch(stores) {
6
- return function(storesValues) {
7
- batch(() => {
8
- for (const [name, value] of Object.entries(storesValues)) {
9
- stores[`${name}$`]?.set(value);
10
- }
11
- });
12
- };
13
- }
14
- function findChangedProperties(obj1, obj2) {
15
- if (obj1 === obj2) {
16
- return null;
17
- }
18
- let hasUpdate = false;
19
- const changedValues = {};
20
- const keys = /* @__PURE__ */ new Set([...Object.keys(obj1), ...Object.keys(obj2)]);
21
- for (const key of keys) {
22
- const value = obj2[key];
23
- if (obj1[key] !== value) {
24
- changedValues[key] = value;
25
- hasUpdate = true;
26
- }
27
- }
28
- return hasUpdate ? changedValues : null;
29
- }
30
- function writableWithDefault(defValue, config$ = readable(void 0), options = {}, own$ = writable(void 0)) {
31
- const { normalizeValue = identity, equal: equal2 = Object.is } = options;
32
- const getDefValue = () => defValue;
33
- const callNormalizeValue = (value, defValue2 = getDefValue) => {
34
- const normalizedValue = value === void 0 ? void 0 : normalizeValue(value);
35
- if (normalizedValue === INVALID_VALUE) {
36
- console.error("Not using invalid value", value);
37
- return defValue2();
38
- }
39
- if (normalizedValue === void 0) {
40
- return defValue2();
41
- }
42
- return normalizedValue;
43
- };
44
- const validatedDefConfig$ = computed(() => callNormalizeValue(config$()), { equal: equal2 });
45
- const validatedOwnValue$ = computed(() => callNormalizeValue(own$(), validatedDefConfig$), { equal: equal2 });
46
- return asWritable(validatedOwnValue$, (value) => {
47
- if (value !== void 0) {
48
- const normalizedValue = normalizeValue(value);
49
- if (normalizedValue === INVALID_VALUE) {
50
- console.error("Not setting invalid value", value);
51
- return;
52
- }
53
- value = normalizedValue;
54
- }
55
- own$.set(value);
56
- });
57
- }
58
- const isStore = (x) => !!(x && typeof x === "function" && "subscribe" in x);
59
- const toReadableStore = (x) => isStore(x) ? x : readable(x);
60
- const toWritableStore = (x) => isStore(x) ? x : writable(x);
61
- const normalizeConfigStores = (keys, config) => {
62
- const res = {};
63
- if (config) {
64
- const configIsStore = isStore(config);
65
- for (const key of keys) {
66
- res[key] = configIsStore ? computed(() => config()[key]) : toReadableStore(config[key]);
67
- }
68
- }
69
- return res;
70
- };
71
- const mergeConfigStores = (keys, config1, config2) => {
72
- const res = {};
73
- for (const key of keys) {
74
- const config1Store = config1?.[key];
75
- const config2Store = config2?.[key];
76
- res[key] = config1Store && config2Store ? computed(() => config1Store() ?? config2Store()) : config1Store || config2Store;
77
- }
78
- return res;
79
- };
80
- const writablesWithDefault = (defConfig, propsConfig, options) => {
81
- const res = {};
82
- const keys = Object.keys(defConfig);
83
- const configStores = normalizeConfigStores(keys, propsConfig?.config);
84
- const props = propsConfig?.props;
85
- for (const key of keys) {
86
- const propValue = props?.[key];
87
- res[`${key}$`] = writableWithDefault(defConfig[key], configStores[key], options?.[key], toWritableStore(propValue));
88
- }
89
- return res;
90
- };
91
- const writablesForProps = (defConfig, propsConfig, options) => {
92
- const stores = writablesWithDefault(defConfig, propsConfig, options);
93
- return [stores, createPatch(stores)];
94
- };
95
- const stateStores = (inputStores) => {
96
- const storesNames = [];
97
- const storesArray = [];
98
- const stores = {};
99
- for (const [key, store] of Object.entries(inputStores)) {
100
- if (key.endsWith("$")) {
101
- storesNames.push(key.substring(0, key.length - 1));
102
- storesArray.push(store);
103
- stores[key] = asReadable(store);
104
- }
105
- }
106
- return {
107
- stores,
108
- state$: computed(() => {
109
- const values = storesArray.map(get);
110
- const res = {};
111
- storesNames.forEach((name, index) => {
112
- res[name] = values[index];
113
- });
114
- return res;
115
- })
116
- };
117
- };
118
- const bindableDerived = (onChange$, stores, adjustValue = (arg) => arg[0], equal2 = (currentValue, newValue) => newValue === currentValue) => {
119
- let currentValue = stores[0]();
120
- return asWritable(
121
- derived(stores, {
122
- derive(values) {
123
- const newValue = adjustValue(values);
124
- const rectifiedValue = !equal2(values[0], newValue);
125
- if (rectifiedValue) {
126
- stores[0].set(newValue);
127
- }
128
- if (rectifiedValue || !equal2(currentValue, newValue)) {
129
- currentValue = newValue;
130
- onChange$()(newValue);
131
- }
132
- return newValue;
133
- },
134
- equal: equal2
135
- }),
136
- stores[0].set.bind(stores[0])
137
- );
138
- };
139
- const bindableProp = (store$, onChange$, adjustValue = identity, equal$1 = equal) => asWritable(
140
- computed(() => adjustValue(store$()), { equal: equal$1 }),
141
- (newValue) => {
142
- const adjustedValue = adjustValue(newValue);
143
- if (!equal$1(store$(), adjustedValue)) {
144
- store$.set(adjustedValue);
145
- onChange$()(adjustedValue);
146
- }
147
- }
148
- );
149
- function idWithDefault(id$) {
150
- const autoId$ = computed(() => generateId());
151
- return computed(() => id$() || autoId$());
152
- }
153
- const true$ = readable(true);
154
- const false$ = readable(false);
155
- export {
156
- bindableDerived,
157
- bindableProp,
158
- createPatch,
159
- false$,
160
- findChangedProperties,
161
- idWithDefault,
162
- isStore,
163
- mergeConfigStores,
164
- normalizeConfigStores,
165
- stateStores,
166
- toReadableStore,
167
- toWritableStore,
168
- true$,
169
- writableWithDefault,
170
- writablesForProps,
171
- writablesWithDefault
172
- };
@@ -1,8 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const types = require("../types.cjs");
4
- function createWidgetFactory(widgetName, factory) {
5
- factory[types.FACTORY_WIDGET_NAME] = widgetName;
6
- return factory;
7
- }
8
- exports.createWidgetFactory = createWidgetFactory;
@@ -1,11 +0,0 @@
1
- import type { PropsConfig, Widget, WidgetFactory, WidgetProps } from '../types';
2
- /**
3
- * Define a widget factory that can be linked with configuration through the provided widget name.
4
- *
5
- * @param widgetName - the widget name, used for configuration injection
6
- * @param factory - the widget factory function
7
- * @template W - The type of the widget
8
- * @template T - The type of the widget factory function. Useful when the widget factory has a generic.
9
- * @returns the widget factory
10
- */
11
- export declare function createWidgetFactory<W extends Widget, T extends (config?: PropsConfig<WidgetProps<W>>) => W = (config?: PropsConfig<WidgetProps<W>>) => W>(widgetName: string, factory: T): WidgetFactory<W, T>;
@@ -1,8 +0,0 @@
1
- import { FACTORY_WIDGET_NAME } from "../types.js";
2
- function createWidgetFactory(widgetName, factory) {
3
- factory[FACTORY_WIDGET_NAME] = widgetName;
4
- return factory;
5
- }
6
- export {
7
- createWidgetFactory
8
- };
@@ -1,16 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const utils_writables = require("../writables-Dt68gADJ.cjs");
4
- require("../types.cjs");
5
- exports.createTypeEnum = utils_writables.createTypeEnum;
6
- exports.testToNormalizeValue = utils_writables.testToNormalizeValue;
7
- exports.typeArray = utils_writables.typeArray;
8
- exports.typeBoolean = utils_writables.typeBoolean;
9
- exports.typeBooleanOrNull = utils_writables.typeBooleanOrNull;
10
- exports.typeFunction = utils_writables.typeFunction;
11
- exports.typeHTMLElementOrNull = utils_writables.typeHTMLElementOrNull;
12
- exports.typeNumber = utils_writables.typeNumber;
13
- exports.typeNumberInRangeFactory = utils_writables.typeNumberInRangeFactory;
14
- exports.typeNumberOrNull = utils_writables.typeNumberOrNull;
15
- exports.typeString = utils_writables.typeString;
16
- exports.typeStringOrNull = utils_writables.typeStringOrNull;
@@ -1,95 +0,0 @@
1
- import type { WritableWithDefaultOptions } from '../types';
2
- import { INVALID_VALUE } from '../types';
3
- /**
4
- * Check if a value respects a provided type guard.
5
- *
6
- * @template T - The type that the filter function validates.
7
- * @param filter - A function that takes a value and returns a boolean indicating
8
- * whether the value is of type T.
9
- * @returns A function that takes a value and returns the value if it passes the filter,
10
- * otherwise returns `INVALID_VALUE`.
11
- */
12
- export declare const testToNormalizeValue: <T>(filter: (value: any) => value is T) => ((value: any) => T | typeof INVALID_VALUE);
13
- /**
14
- * A writable object with default options for handling numbers.
15
- */
16
- export declare const typeNumber: WritableWithDefaultOptions<number>;
17
- /**
18
- * Options for specifying the behavior of number range validation.
19
- */
20
- export interface TypeNumberInRangeOptions {
21
- /** If `true`, the range checking will be strict, excluding the minimum and maximum values. Default is `false`. */
22
- strict?: boolean;
23
- /** If `true`, values outside the range will be clamped to the minimum or maximum. Default is `true`. */
24
- useClamp?: boolean;
25
- }
26
- /**
27
- * Factory function for creating a type constraint for numbers within a specified range.
28
- *
29
- * @param min - The minimum value.
30
- * @param max - The maximum value.
31
- * @param options - Additional options to customize the behavior.
32
- *
33
- * @returns A type guard function that returns the clamp value or INVALID_VALUE depending on the provided options.
34
- */
35
- export declare function typeNumberInRangeFactory(min: number, max: number, options?: TypeNumberInRangeOptions): WritableWithDefaultOptions<number>;
36
- /**
37
- * A writable object with default options for boolean values.
38
- *
39
- * This object provides a normalized way to handle boolean values
40
- * using the `WritableWithDefaultOptions` interface. The `normalizeValue`
41
- * function ensures that the value is properly validated and normalized
42
- * as a boolean.
43
- */
44
- export declare const typeBoolean: WritableWithDefaultOptions<boolean>;
45
- /**
46
- * A writable with default options that normalizes its value to a boolean or null.
47
- *
48
- * This writable uses a normalization function that allows null values and ensures
49
- * the value is a boolean.
50
- */
51
- export declare const typeBooleanOrNull: WritableWithDefaultOptions<boolean | null>;
52
- /**
53
- * A writable object with default options for string values.
54
- *
55
- * This object provides a normalized value for strings using the `testToNormalizeValue` function
56
- * with the `isString` validator.
57
- */
58
- export declare const typeString: WritableWithDefaultOptions<string>;
59
- /**
60
- * A writable with default options that normalizes its value to a string or null.
61
- *
62
- * This object provides a normalized value for strings using the `testToNormalizeValue` function
63
- * with the `isString` validator.
64
- */
65
- export declare const typeStringOrNull: WritableWithDefaultOptions<string | null>;
66
- /**
67
- * A writable with default options that normalizes its value to a number or null.
68
- *
69
- * This writable uses a normalization function that allows null values and ensures
70
- * the value is a boolean.
71
- */
72
- export declare const typeNumberOrNull: WritableWithDefaultOptions<number | null>;
73
- /**
74
- * A writable object that holds a function type with default options.
75
- */
76
- export declare const typeFunction: WritableWithDefaultOptions<(...args: any[]) => any>;
77
- /**
78
- * A writable object with default options for handling values of type `HTMLElement` or `null`.
79
- *
80
- * This object provides:
81
- * - `normalizeValue`: A function to normalize the value, ensuring it is either an `HTMLElement` or `null`.
82
- * - `equal`: A function to compare two values for equality using `Object.is`.
83
- */
84
- export declare const typeHTMLElementOrNull: WritableWithDefaultOptions<HTMLElement | null>;
85
- /**
86
- * A writable object with default options for handling arrays.
87
- */
88
- export declare const typeArray: WritableWithDefaultOptions<any[]>;
89
- /**
90
- * Build an enum normalizer
91
- * @template T - the enum type
92
- * @param enumList - list of enum values to check
93
- * @returns the enum normalizer
94
- */
95
- export declare function createTypeEnum<T>(enumList: T[]): WritableWithDefaultOptions<T>;
@@ -1,16 +0,0 @@
1
- import { c, t, a, b, d, e, f, g, h, i, j, k } from "../writables-DYGjj5T3.js";
2
- import "../types.js";
3
- export {
4
- c as createTypeEnum,
5
- t as testToNormalizeValue,
6
- a as typeArray,
7
- b as typeBoolean,
8
- d as typeBooleanOrNull,
9
- e as typeFunction,
10
- f as typeHTMLElementOrNull,
11
- g as typeNumber,
12
- h as typeNumberInRangeFactory,
13
- i as typeNumberOrNull,
14
- j as typeString,
15
- k as typeStringOrNull
16
- };
@@ -1,103 +0,0 @@
1
- import { INVALID_VALUE } from "./types.js";
2
- function isNumber(value) {
3
- return typeof value === "number" && !isNaN(value) && Number.isFinite(value);
4
- }
5
- function isBoolean(value) {
6
- return value === true || value === false;
7
- }
8
- function isFunction(value) {
9
- return typeof value === "function";
10
- }
11
- function isString(value) {
12
- return typeof value === "string";
13
- }
14
- const isArray = Array.isArray;
15
- function clamp(value, max, min = 0) {
16
- return Math.max(Math.min(value, max), min);
17
- }
18
- const isHTMLElement = (value) => value instanceof HTMLElement;
19
- const allowNull = (isType) => (value) => value === null || isType(value);
20
- function isFromEnum(list) {
21
- return (value) => list.includes(value);
22
- }
23
- const testToNormalizeValue = (filter) => (value) => filter(value) ? value : INVALID_VALUE;
24
- const numberNormalizeFn = testToNormalizeValue(isNumber);
25
- const typeNumber = {
26
- normalizeValue: numberNormalizeFn
27
- };
28
- function typeNumberInRangeFactory(min, max, options = {}) {
29
- const { strict = false, useClamp = true } = options;
30
- return {
31
- normalizeValue: (value) => {
32
- let normalizedNumber = numberNormalizeFn(value);
33
- if (normalizedNumber !== INVALID_VALUE) {
34
- if (!strict && useClamp) {
35
- normalizedNumber = clamp(normalizedNumber, max, min);
36
- }
37
- if (normalizedNumber >= min && normalizedNumber <= max) {
38
- if (!strict || normalizedNumber !== min && normalizedNumber !== max) {
39
- return normalizedNumber;
40
- }
41
- }
42
- }
43
- return INVALID_VALUE;
44
- }
45
- };
46
- }
47
- const typeBoolean = {
48
- normalizeValue: testToNormalizeValue(isBoolean)
49
- };
50
- const typeBooleanOrNull = {
51
- normalizeValue: testToNormalizeValue(allowNull(isBoolean))
52
- };
53
- const typeString = {
54
- normalizeValue: testToNormalizeValue(isString)
55
- };
56
- const typeStringOrNull = {
57
- normalizeValue: testToNormalizeValue(allowNull(isString))
58
- };
59
- const typeNumberOrNull = {
60
- normalizeValue: testToNormalizeValue(allowNull(isNumber))
61
- };
62
- const typeFunction = {
63
- normalizeValue: testToNormalizeValue(isFunction),
64
- equal: Object.is
65
- };
66
- const typeHTMLElementOrNull = {
67
- normalizeValue: testToNormalizeValue(allowNull(isHTMLElement)),
68
- equal: Object.is
69
- };
70
- const typeArray = {
71
- normalizeValue: testToNormalizeValue(isArray),
72
- equal: (a, b) => {
73
- if (a === b) {
74
- return true;
75
- } else {
76
- if (a?.length !== b?.length) {
77
- return false;
78
- }
79
- return a.every((val, index) => val === b[index]);
80
- }
81
- }
82
- };
83
- function createTypeEnum(enumList) {
84
- return {
85
- normalizeValue: testToNormalizeValue(isFromEnum(enumList))
86
- };
87
- }
88
- export {
89
- typeArray as a,
90
- typeBoolean as b,
91
- createTypeEnum as c,
92
- typeBooleanOrNull as d,
93
- typeFunction as e,
94
- typeHTMLElementOrNull as f,
95
- typeNumber as g,
96
- typeNumberInRangeFactory as h,
97
- typeNumberOrNull as i,
98
- typeString as j,
99
- typeStringOrNull as k,
100
- clamp as l,
101
- isNumber as m,
102
- testToNormalizeValue as t
103
- };
@@ -1,102 +0,0 @@
1
- "use strict";
2
- const types = require("./types.cjs");
3
- function isNumber(value) {
4
- return typeof value === "number" && !isNaN(value) && Number.isFinite(value);
5
- }
6
- function isBoolean(value) {
7
- return value === true || value === false;
8
- }
9
- function isFunction(value) {
10
- return typeof value === "function";
11
- }
12
- function isString(value) {
13
- return typeof value === "string";
14
- }
15
- const isArray = Array.isArray;
16
- function clamp(value, max, min = 0) {
17
- return Math.max(Math.min(value, max), min);
18
- }
19
- const isHTMLElement = (value) => value instanceof HTMLElement;
20
- const allowNull = (isType) => (value) => value === null || isType(value);
21
- function isFromEnum(list) {
22
- return (value) => list.includes(value);
23
- }
24
- const testToNormalizeValue = (filter) => (value) => filter(value) ? value : types.INVALID_VALUE;
25
- const numberNormalizeFn = testToNormalizeValue(isNumber);
26
- const typeNumber = {
27
- normalizeValue: numberNormalizeFn
28
- };
29
- function typeNumberInRangeFactory(min, max, options = {}) {
30
- const { strict = false, useClamp = true } = options;
31
- return {
32
- normalizeValue: (value) => {
33
- let normalizedNumber = numberNormalizeFn(value);
34
- if (normalizedNumber !== types.INVALID_VALUE) {
35
- if (!strict && useClamp) {
36
- normalizedNumber = clamp(normalizedNumber, max, min);
37
- }
38
- if (normalizedNumber >= min && normalizedNumber <= max) {
39
- if (!strict || normalizedNumber !== min && normalizedNumber !== max) {
40
- return normalizedNumber;
41
- }
42
- }
43
- }
44
- return types.INVALID_VALUE;
45
- }
46
- };
47
- }
48
- const typeBoolean = {
49
- normalizeValue: testToNormalizeValue(isBoolean)
50
- };
51
- const typeBooleanOrNull = {
52
- normalizeValue: testToNormalizeValue(allowNull(isBoolean))
53
- };
54
- const typeString = {
55
- normalizeValue: testToNormalizeValue(isString)
56
- };
57
- const typeStringOrNull = {
58
- normalizeValue: testToNormalizeValue(allowNull(isString))
59
- };
60
- const typeNumberOrNull = {
61
- normalizeValue: testToNormalizeValue(allowNull(isNumber))
62
- };
63
- const typeFunction = {
64
- normalizeValue: testToNormalizeValue(isFunction),
65
- equal: Object.is
66
- };
67
- const typeHTMLElementOrNull = {
68
- normalizeValue: testToNormalizeValue(allowNull(isHTMLElement)),
69
- equal: Object.is
70
- };
71
- const typeArray = {
72
- normalizeValue: testToNormalizeValue(isArray),
73
- equal: (a, b) => {
74
- if (a === b) {
75
- return true;
76
- } else {
77
- if (a?.length !== b?.length) {
78
- return false;
79
- }
80
- return a.every((val, index) => val === b[index]);
81
- }
82
- }
83
- };
84
- function createTypeEnum(enumList) {
85
- return {
86
- normalizeValue: testToNormalizeValue(isFromEnum(enumList))
87
- };
88
- }
89
- exports.clamp = clamp;
90
- exports.createTypeEnum = createTypeEnum;
91
- exports.isNumber = isNumber;
92
- exports.testToNormalizeValue = testToNormalizeValue;
93
- exports.typeArray = typeArray;
94
- exports.typeBoolean = typeBoolean;
95
- exports.typeBooleanOrNull = typeBooleanOrNull;
96
- exports.typeFunction = typeFunction;
97
- exports.typeHTMLElementOrNull = typeHTMLElementOrNull;
98
- exports.typeNumber = typeNumber;
99
- exports.typeNumberInRangeFactory = typeNumberInRangeFactory;
100
- exports.typeNumberOrNull = typeNumberOrNull;
101
- exports.typeString = typeString;
102
- exports.typeStringOrNull = typeStringOrNull;