@design-factory/angular 21.0.3 → 21.1.0-next.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 (194) hide show
  1. package/drawer/README.md +54 -0
  2. package/fesm2022/design-factory-angular-drawer.mjs +202 -67
  3. package/fesm2022/design-factory-angular-drawer.mjs.map +1 -1
  4. package/fesm2022/design-factory-angular-internals.mjs +439 -17
  5. package/fesm2022/design-factory-angular-internals.mjs.map +1 -1
  6. package/fesm2022/design-factory-angular-sidenav.mjs +223 -210
  7. package/fesm2022/design-factory-angular-sidenav.mjs.map +1 -1
  8. package/fesm2022/design-factory-angular-theme.mjs +198 -0
  9. package/fesm2022/design-factory-angular-theme.mjs.map +1 -0
  10. package/fesm2022/design-factory-angular-topnav.mjs +1538 -0
  11. package/fesm2022/design-factory-angular-topnav.mjs.map +1 -0
  12. package/node_modules/@agnos-ui/core/README.md +5 -0
  13. package/node_modules/@agnos-ui/core/accordion-BC_9xn23.cjs +314 -0
  14. package/node_modules/@agnos-ui/core/accordion-Ca_0T8Bc.js +315 -0
  15. package/node_modules/@agnos-ui/core/alert-AhaliJ17.cjs +9 -0
  16. package/node_modules/@agnos-ui/core/alert-Cb9FhbFQ.js +10 -0
  17. package/node_modules/@agnos-ui/core/collapse-COriZO7o.cjs +94 -0
  18. package/node_modules/@agnos-ui/core/collapse-CP79atna.js +95 -0
  19. package/node_modules/@agnos-ui/core/common-B5jS-Ih_.cjs +73 -0
  20. package/node_modules/@agnos-ui/core/common-DFyZvkII.js +74 -0
  21. package/node_modules/@agnos-ui/core/components/accordion/accordion.d.ts +333 -0
  22. package/node_modules/@agnos-ui/core/components/accordion/index.cjs +7 -0
  23. package/node_modules/@agnos-ui/core/components/accordion/index.d.ts +1 -0
  24. package/node_modules/@agnos-ui/core/components/accordion/index.js +7 -0
  25. package/node_modules/@agnos-ui/core/components/alert/alert.d.ts +37 -0
  26. package/node_modules/@agnos-ui/core/components/alert/common.d.ts +138 -0
  27. package/node_modules/@agnos-ui/core/components/alert/index.cjs +5 -0
  28. package/node_modules/@agnos-ui/core/components/alert/index.d.ts +1 -0
  29. package/node_modules/@agnos-ui/core/components/alert/index.js +5 -0
  30. package/node_modules/@agnos-ui/core/components/carousel/carousel.d.ts +247 -0
  31. package/node_modules/@agnos-ui/core/components/carousel/index.cjs +292 -0
  32. package/node_modules/@agnos-ui/core/components/carousel/index.d.ts +1 -0
  33. package/node_modules/@agnos-ui/core/components/carousel/index.js +292 -0
  34. package/node_modules/@agnos-ui/core/components/collapse/collapse.d.ts +135 -0
  35. package/node_modules/@agnos-ui/core/components/collapse/index.cjs +5 -0
  36. package/node_modules/@agnos-ui/core/components/collapse/index.d.ts +1 -0
  37. package/node_modules/@agnos-ui/core/components/collapse/index.js +5 -0
  38. package/node_modules/@agnos-ui/core/components/commonProps.d.ts +11 -0
  39. package/node_modules/@agnos-ui/core/components/drawer/drawer.d.ts +279 -0
  40. package/node_modules/@agnos-ui/core/components/drawer/index.cjs +5 -0
  41. package/node_modules/@agnos-ui/core/components/drawer/index.d.ts +1 -0
  42. package/node_modules/@agnos-ui/core/components/drawer/index.js +5 -0
  43. package/node_modules/@agnos-ui/core/components/modal/index.cjs +8 -0
  44. package/node_modules/@agnos-ui/core/components/modal/index.d.ts +1 -0
  45. package/node_modules/@agnos-ui/core/components/modal/index.js +8 -0
  46. package/node_modules/@agnos-ui/core/components/modal/modal.d.ts +245 -0
  47. package/node_modules/@agnos-ui/core/components/pagination/index.cjs +5 -0
  48. package/node_modules/@agnos-ui/core/components/pagination/index.d.ts +1 -0
  49. package/node_modules/@agnos-ui/core/components/pagination/index.js +5 -0
  50. package/node_modules/@agnos-ui/core/components/pagination/pagination.d.ts +313 -0
  51. package/node_modules/@agnos-ui/core/components/progressbar/index.cjs +5 -0
  52. package/node_modules/@agnos-ui/core/components/progressbar/index.d.ts +1 -0
  53. package/node_modules/@agnos-ui/core/components/progressbar/index.js +5 -0
  54. package/node_modules/@agnos-ui/core/components/progressbar/progressbar.d.ts +91 -0
  55. package/node_modules/@agnos-ui/core/components/rating/index.cjs +5 -0
  56. package/node_modules/@agnos-ui/core/components/rating/index.d.ts +1 -0
  57. package/node_modules/@agnos-ui/core/components/rating/index.js +5 -0
  58. package/node_modules/@agnos-ui/core/components/rating/rating.d.ts +191 -0
  59. package/node_modules/@agnos-ui/core/components/slider/index.cjs +5 -0
  60. package/node_modules/@agnos-ui/core/components/slider/index.d.ts +1 -0
  61. package/node_modules/@agnos-ui/core/components/slider/index.js +5 -0
  62. package/node_modules/@agnos-ui/core/components/slider/slider-utils.d.ts +25 -0
  63. package/node_modules/@agnos-ui/core/components/slider/slider.d.ts +383 -0
  64. package/node_modules/@agnos-ui/core/components/toast/index.cjs +7 -0
  65. package/node_modules/@agnos-ui/core/components/toast/index.d.ts +2 -0
  66. package/node_modules/@agnos-ui/core/components/toast/index.js +7 -0
  67. package/node_modules/@agnos-ui/core/components/toast/toast.d.ts +66 -0
  68. package/node_modules/@agnos-ui/core/components/toast/toaster.d.ts +128 -0
  69. package/node_modules/@agnos-ui/core/components/tree/index.cjs +5 -0
  70. package/node_modules/@agnos-ui/core/components/tree/index.d.ts +1 -0
  71. package/node_modules/@agnos-ui/core/components/tree/index.js +5 -0
  72. package/node_modules/@agnos-ui/core/components/tree/tree.d.ts +143 -0
  73. package/node_modules/@agnos-ui/core/config.cjs +36 -0
  74. package/node_modules/@agnos-ui/core/config.d.ts +117 -0
  75. package/node_modules/@agnos-ui/core/config.js +36 -0
  76. package/node_modules/@agnos-ui/core/directive-Bsreu2z1.js +523 -0
  77. package/node_modules/@agnos-ui/core/directive-DCaXmRe_.cjs +522 -0
  78. package/node_modules/@agnos-ui/core/drawer-BbFAHV07.cjs +328 -0
  79. package/node_modules/@agnos-ui/core/drawer-C6Qa0xEu.js +329 -0
  80. package/node_modules/@agnos-ui/core/index.cjs +134 -0
  81. package/node_modules/@agnos-ui/core/index.d.ts +29 -0
  82. package/node_modules/@agnos-ui/core/index.js +134 -0
  83. package/node_modules/@agnos-ui/core/isFocusable-Ckwus82R.js +32 -0
  84. package/node_modules/@agnos-ui/core/isFocusable-DfzDLeAN.cjs +31 -0
  85. package/node_modules/@agnos-ui/core/modal-BsNuHhT7.cjs +252 -0
  86. package/node_modules/@agnos-ui/core/modal-CgzY8ezz.js +253 -0
  87. package/node_modules/@agnos-ui/core/package.json +57 -0
  88. package/node_modules/@agnos-ui/core/pagination-ZxGaNWZz.js +255 -0
  89. package/node_modules/@agnos-ui/core/pagination-xbcOHnhd.cjs +254 -0
  90. package/node_modules/@agnos-ui/core/progressbar-CRbMKp4b.cjs +86 -0
  91. package/node_modules/@agnos-ui/core/progressbar-CSEIFnlD.js +87 -0
  92. package/node_modules/@agnos-ui/core/promise-CxCD3NYv.cjs +118 -0
  93. package/node_modules/@agnos-ui/core/promise-D-RZVPuv.js +119 -0
  94. package/node_modules/@agnos-ui/core/rating-BIdiiPUo.js +184 -0
  95. package/node_modules/@agnos-ui/core/rating-qx1xaBmz.cjs +183 -0
  96. package/node_modules/@agnos-ui/core/scrollbars-CT87iv_6.cjs +30 -0
  97. package/node_modules/@agnos-ui/core/scrollbars-CcxSrnCx.js +31 -0
  98. package/node_modules/@agnos-ui/core/services/extendWidget.cjs +41 -0
  99. package/node_modules/@agnos-ui/core/services/extendWidget.d.ts +31 -0
  100. package/node_modules/@agnos-ui/core/services/extendWidget.js +41 -0
  101. package/node_modules/@agnos-ui/core/services/floatingUI.cjs +111 -0
  102. package/node_modules/@agnos-ui/core/services/floatingUI.d.ts +76 -0
  103. package/node_modules/@agnos-ui/core/services/floatingUI.js +111 -0
  104. package/node_modules/@agnos-ui/core/services/focusElement.cjs +46 -0
  105. package/node_modules/@agnos-ui/core/services/focusElement.d.ts +9 -0
  106. package/node_modules/@agnos-ui/core/services/focusElement.js +46 -0
  107. package/node_modules/@agnos-ui/core/services/focustrack.cjs +47 -0
  108. package/node_modules/@agnos-ui/core/services/focustrack.d.ts +40 -0
  109. package/node_modules/@agnos-ui/core/services/focustrack.js +47 -0
  110. package/node_modules/@agnos-ui/core/services/hash.cjs +15 -0
  111. package/node_modules/@agnos-ui/core/services/hash.d.ts +3 -0
  112. package/node_modules/@agnos-ui/core/services/hash.js +15 -0
  113. package/node_modules/@agnos-ui/core/services/intersection.cjs +53 -0
  114. package/node_modules/@agnos-ui/core/services/intersection.d.ts +30 -0
  115. package/node_modules/@agnos-ui/core/services/intersection.js +53 -0
  116. package/node_modules/@agnos-ui/core/services/matchMedia.cjs +14 -0
  117. package/node_modules/@agnos-ui/core/services/matchMedia.d.ts +8 -0
  118. package/node_modules/@agnos-ui/core/services/matchMedia.js +14 -0
  119. package/node_modules/@agnos-ui/core/services/navManager.cjs +166 -0
  120. package/node_modules/@agnos-ui/core/services/navManager.d.ts +144 -0
  121. package/node_modules/@agnos-ui/core/services/navManager.js +166 -0
  122. package/node_modules/@agnos-ui/core/services/pointerdownPosition.cjs +60 -0
  123. package/node_modules/@agnos-ui/core/services/pointerdownPosition.d.ts +42 -0
  124. package/node_modules/@agnos-ui/core/services/pointerdownPosition.js +60 -0
  125. package/node_modules/@agnos-ui/core/services/portal.cjs +42 -0
  126. package/node_modules/@agnos-ui/core/services/portal.d.ts +16 -0
  127. package/node_modules/@agnos-ui/core/services/portal.js +42 -0
  128. package/node_modules/@agnos-ui/core/services/resizeObserver.cjs +54 -0
  129. package/node_modules/@agnos-ui/core/services/resizeObserver.d.ts +18 -0
  130. package/node_modules/@agnos-ui/core/services/resizeObserver.js +54 -0
  131. package/node_modules/@agnos-ui/core/services/siblingsInert.cjs +44 -0
  132. package/node_modules/@agnos-ui/core/services/siblingsInert.d.ts +16 -0
  133. package/node_modules/@agnos-ui/core/services/siblingsInert.js +44 -0
  134. package/node_modules/@agnos-ui/core/services/transitions/baseTransitions.cjs +186 -0
  135. package/node_modules/@agnos-ui/core/services/transitions/baseTransitions.d.ts +166 -0
  136. package/node_modules/@agnos-ui/core/services/transitions/baseTransitions.js +186 -0
  137. package/node_modules/@agnos-ui/core/services/transitions/collapse.cjs +40 -0
  138. package/node_modules/@agnos-ui/core/services/transitions/collapse.d.ts +49 -0
  139. package/node_modules/@agnos-ui/core/services/transitions/collapse.js +40 -0
  140. package/node_modules/@agnos-ui/core/services/transitions/cssTransitions.cjs +32 -0
  141. package/node_modules/@agnos-ui/core/services/transitions/cssTransitions.d.ts +25 -0
  142. package/node_modules/@agnos-ui/core/services/transitions/cssTransitions.js +32 -0
  143. package/node_modules/@agnos-ui/core/services/transitions/simpleClassTransition.cjs +37 -0
  144. package/node_modules/@agnos-ui/core/services/transitions/simpleClassTransition.d.ts +47 -0
  145. package/node_modules/@agnos-ui/core/services/transitions/simpleClassTransition.js +37 -0
  146. package/node_modules/@agnos-ui/core/slider-B93hE0ag.cjs +807 -0
  147. package/node_modules/@agnos-ui/core/slider-Cjiq9FgI.js +808 -0
  148. package/node_modules/@agnos-ui/core/textDirection-cNgt24LJ.js +4 -0
  149. package/node_modules/@agnos-ui/core/textDirection-zqcZ5-eK.cjs +3 -0
  150. package/node_modules/@agnos-ui/core/toaster-BQWqxYv-.cjs +190 -0
  151. package/node_modules/@agnos-ui/core/toaster-BzEkshT2.js +191 -0
  152. package/node_modules/@agnos-ui/core/tree-DY04XPPg.cjs +228 -0
  153. package/node_modules/@agnos-ui/core/tree-HwcvZ0_p.js +229 -0
  154. package/node_modules/@agnos-ui/core/types.cjs +6 -0
  155. package/node_modules/@agnos-ui/core/types.d.ts +246 -0
  156. package/node_modules/@agnos-ui/core/types.js +6 -0
  157. package/node_modules/@agnos-ui/core/utils/directive.cjs +28 -0
  158. package/node_modules/@agnos-ui/core/utils/directive.d.ts +352 -0
  159. package/node_modules/@agnos-ui/core/utils/directive.js +28 -0
  160. package/node_modules/@agnos-ui/core/utils/func.cjs +7 -0
  161. package/node_modules/@agnos-ui/core/utils/func.d.ts +11 -0
  162. package/node_modules/@agnos-ui/core/utils/func.js +7 -0
  163. package/node_modules/@agnos-ui/core/utils/id.cjs +5 -0
  164. package/node_modules/@agnos-ui/core/utils/id.d.ts +6 -0
  165. package/node_modules/@agnos-ui/core/utils/id.js +5 -0
  166. package/node_modules/@agnos-ui/core/utils/internal/assign.d.ts +10 -0
  167. package/node_modules/@agnos-ui/core/utils/internal/checks.d.ts +57 -0
  168. package/node_modules/@agnos-ui/core/utils/internal/dom.d.ts +75 -0
  169. package/node_modules/@agnos-ui/core/utils/internal/isFocusable.d.ts +9 -0
  170. package/node_modules/@agnos-ui/core/utils/internal/math.d.ts +5 -0
  171. package/node_modules/@agnos-ui/core/utils/internal/promise.d.ts +98 -0
  172. package/node_modules/@agnos-ui/core/utils/internal/scrollbars.d.ts +8 -0
  173. package/node_modules/@agnos-ui/core/utils/internal/sort.d.ts +16 -0
  174. package/node_modules/@agnos-ui/core/utils/internal/ssrHTMLElement.d.ts +17 -0
  175. package/node_modules/@agnos-ui/core/utils/internal/textDirection.d.ts +7 -0
  176. package/node_modules/@agnos-ui/core/utils/internal/traversal.d.ts +54 -0
  177. package/node_modules/@agnos-ui/core/utils/stores.cjs +172 -0
  178. package/node_modules/@agnos-ui/core/utils/stores.d.ts +224 -0
  179. package/node_modules/@agnos-ui/core/utils/stores.js +172 -0
  180. package/node_modules/@agnos-ui/core/utils/widget.cjs +8 -0
  181. package/node_modules/@agnos-ui/core/utils/widget.d.ts +11 -0
  182. package/node_modules/@agnos-ui/core/utils/widget.js +8 -0
  183. package/node_modules/@agnos-ui/core/utils/writables.cjs +16 -0
  184. package/node_modules/@agnos-ui/core/utils/writables.d.ts +95 -0
  185. package/node_modules/@agnos-ui/core/utils/writables.js +16 -0
  186. package/node_modules/@agnos-ui/core/writables-DYGjj5T3.js +103 -0
  187. package/node_modules/@agnos-ui/core/writables-Dt68gADJ.cjs +102 -0
  188. package/package.json +25 -6
  189. package/schematics/collection.json +1 -1
  190. package/types/design-factory-angular-drawer.d.ts +71 -13
  191. package/types/design-factory-angular-internals.d.ts +220 -31
  192. package/types/design-factory-angular-sidenav.d.ts +15 -7
  193. package/types/design-factory-angular-theme.d.ts +122 -0
  194. package/types/design-factory-angular-topnav.d.ts +435 -0
@@ -0,0 +1,143 @@
1
+ import type { Directive, WidgetFactory } from '../../types';
2
+ import { type Widget } from '../../types';
3
+ import type { WidgetsCommonPropsAndState } from '../commonProps';
4
+ /**
5
+ * Represents a tree item component.
6
+ */
7
+ export interface TreeItem {
8
+ /**
9
+ * Optional accessibility label for the node
10
+ */
11
+ ariaLabel?: string;
12
+ /**
13
+ * Optional array of children nodes
14
+ */
15
+ children?: TreeItem[];
16
+ /**
17
+ * If `true` the node is expanded
18
+ */
19
+ isExpanded?: boolean;
20
+ /**
21
+ * String title of the node
22
+ */
23
+ label: string;
24
+ }
25
+ /**
26
+ * Normalized TreeItem object
27
+ */
28
+ export interface NormalizedTreeItem extends TreeItem {
29
+ /**
30
+ * Accessibility label for the node
31
+ */
32
+ ariaLabel: string;
33
+ /**
34
+ * Level in the hierarchy, starts with 0 for a root node
35
+ */
36
+ level: number;
37
+ /**
38
+ * An array of children nodes
39
+ */
40
+ children: NormalizedTreeItem[];
41
+ }
42
+ interface TreeCommonPropsAndState extends WidgetsCommonPropsAndState {
43
+ }
44
+ /**
45
+ * Interface representing the properties for the Tree component.
46
+ */
47
+ export interface TreeProps extends TreeCommonPropsAndState {
48
+ /**
49
+ * Array of the tree nodes to display
50
+ *
51
+ * @defaultValue `[]`
52
+ */
53
+ nodes: TreeItem[];
54
+ /**
55
+ * An event emitted when the user toggles the expand of the TreeItem.
56
+ *
57
+ * Event payload is equal to the TreeItem clicked.
58
+ *
59
+ * @defaultValue
60
+ * ```ts
61
+ * () => {}
62
+ * ```
63
+ */
64
+ onExpandToggle: (node: NormalizedTreeItem) => void;
65
+ /**
66
+ * Retrieves expand items of the TreeItem
67
+ *
68
+ * @param node - HTML element that is representing the expand item
69
+ *
70
+ * @defaultValue
71
+ * ```ts
72
+ * (node: HTMLElement) => node.querySelectorAll('button')
73
+ * ```
74
+ */
75
+ navSelector(node: HTMLElement): NodeListOf<HTMLElement>;
76
+ /**
77
+ * Return the value for the 'aria-label' attribute of the toggle
78
+ * @param label - tree item label
79
+ *
80
+ * @defaultValue
81
+ * ```ts
82
+ * (label: string) => `Toggle ${label}`
83
+ * ```
84
+ */
85
+ ariaLabelToggleFn: (label: string) => string;
86
+ }
87
+ /**
88
+ * Represents the state of a Tree component.
89
+ */
90
+ export interface TreeState extends TreeCommonPropsAndState {
91
+ /**
92
+ * Array of normalized tree nodes
93
+ */
94
+ normalizedNodes: NormalizedTreeItem[];
95
+ /**
96
+ * Getter of expanded state for each tree node
97
+ */
98
+ expandedMap: {
99
+ get(item: NormalizedTreeItem): boolean | undefined;
100
+ };
101
+ }
102
+ /**
103
+ * Interface representing the API for a Tree component.
104
+ */
105
+ export interface TreeApi {
106
+ }
107
+ /**
108
+ * Interface representing various directives used in the Tree component.
109
+ */
110
+ export interface TreeDirectives {
111
+ /**
112
+ * Directive to attach navManager for the tree
113
+ */
114
+ navigationDirective: Directive;
115
+ /**
116
+ * Directive to handle toggle for the tree item
117
+ */
118
+ itemToggleDirective: Directive<{
119
+ item: NormalizedTreeItem;
120
+ }>;
121
+ /**
122
+ * Directive to handle attributes for the tree item
123
+ */
124
+ itemAttributesDirective: Directive<{
125
+ item: NormalizedTreeItem;
126
+ }>;
127
+ }
128
+ /**
129
+ * Represents a Tree widget component.
130
+ */
131
+ export type TreeWidget = Widget<TreeProps, TreeState, TreeApi, TreeDirectives>;
132
+ /**
133
+ * Retrieve a shallow copy of the default Tree config
134
+ * @returns the default Tree config
135
+ */
136
+ export declare function getTreeDefaultConfig(): TreeProps;
137
+ /**
138
+ * Create a tree widget with given config props
139
+ * @param config - an optional tree config
140
+ * @returns a TreeWidget
141
+ */
142
+ export declare const createTree: WidgetFactory<TreeWidget>;
143
+ export {};
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const tansu = require("@amadeus-it-group/tansu");
4
+ const utils_func = require("./utils/func.cjs");
5
+ const mergeInto = (destination, source, levels = Infinity) => {
6
+ if (source !== void 0) {
7
+ if (typeof source === "object" && source && levels >= 1) {
8
+ if (!destination) {
9
+ destination = {};
10
+ }
11
+ for (const key of Object.keys(source)) {
12
+ if (!Object.prototype.hasOwnProperty.call(source, key)) continue;
13
+ if (key === "__proto__" || key === "constructor") continue;
14
+ destination[key] = mergeInto(destination[key], source[key], levels - 1);
15
+ }
16
+ } else {
17
+ return source;
18
+ }
19
+ }
20
+ return destination;
21
+ };
22
+ const createWidgetsConfig = (parent$, adaptParentConfig = utils_func.identity) => {
23
+ const own$ = tansu.writable({});
24
+ const adaptedParent$ = adaptParentConfig === utils_func.identity ? parent$ : tansu.computed(() => adaptParentConfig(mergeInto({}, parent$?.(), 2)));
25
+ return tansu.asWritable(
26
+ tansu.computed(() => mergeInto(mergeInto({}, adaptedParent$?.(), 2), own$(), 2)),
27
+ {
28
+ ...own$,
29
+ own$,
30
+ adaptedParent$,
31
+ parent$
32
+ }
33
+ );
34
+ };
35
+ exports.createWidgetsConfig = createWidgetsConfig;
36
+ exports.mergeInto = mergeInto;
@@ -0,0 +1,117 @@
1
+ import type { ReadableSignal, WritableSignal } from '@amadeus-it-group/tansu';
2
+ import type { ModalProps } from './components/modal/modal';
3
+ import type { AlertProps } from './components/alert/alert';
4
+ import type { PaginationProps } from './components/pagination/pagination';
5
+ import type { RatingProps } from './components/rating/rating';
6
+ import type { AccordionProps } from './components/accordion/accordion';
7
+ import type { ProgressbarProps } from './components/progressbar/progressbar';
8
+ import type { SliderProps } from './components/slider/slider';
9
+ import type { ToastProps } from './components/toast/toast';
10
+ import type { TreeProps } from './components/tree/tree';
11
+ import type { CarouselProps } from './components/carousel';
12
+ import type { CollapseProps } from './components/collapse';
13
+ import type { DrawerProps } from './components/drawer/drawer';
14
+ /**
15
+ * A utility type that makes all properties of an object type `T` optional,
16
+ * and also makes all properties of the nested objects within `T` optional.
17
+ *
18
+ * @template T - The object type to be transformed.
19
+ */
20
+ export type Partial2Levels<T> = Partial<{
21
+ [Level1 in keyof T]: Partial<T[Level1]>;
22
+ }>;
23
+ /**
24
+ * Represents a store for widget configurations with support for partial updates
25
+ * at two levels of depth. This store includes signals for its own state, an optional
26
+ * parent state, and an optional adapted parent state.
27
+ *
28
+ * @template T - The type of the widget configuration.
29
+ */
30
+ export type WidgetsConfigStore<T> = WritableSignal<Partial2Levels<T>> & {
31
+ own$: WritableSignal<Partial2Levels<T>>;
32
+ parent$: undefined | WritableSignal<Partial2Levels<T>>;
33
+ adaptedParent$: undefined | ReadableSignal<Partial2Levels<T>>;
34
+ };
35
+ /**
36
+ * Merges source object into destination object, up to the provided number of levels.
37
+ * @param destination - destination object
38
+ * @param source - source object
39
+ * @param levels - number of levels to merge
40
+ * @returns the destination object in most cases, or the source in some cases (if the source is not undefined and either levels is smaller than 1
41
+ * or the source is not an object)
42
+ */
43
+ export declare const mergeInto: <T>(destination: T, source: T | undefined, levels?: number) => T;
44
+ /**
45
+ * Creates a new widgets default configuration store, optionally inheriting from a parent store, and containing
46
+ * its own set of widgets configuration properties that override the same properties form the parent configuration.
47
+ *
48
+ * @remarks
49
+ * The resulting store has a value computed from the parent store in two steps:
50
+ * - first step: the parent configuration is transformed by the adaptParentConfig function (if specified).
51
+ * If adaptParentConfig is not specified, this step is skipped.
52
+ * - second step: the configuration from step 1 is merged (2-levels deep) with the own$ store. The own$ store initially contains
53
+ * an empty object (i.e. no property from the parent is overridden). It can be changed by calling set on the store returned by this function.
54
+ *
55
+ * @param parent$ - optional parent widgets default configuration store.
56
+ * @param adaptParentConfig - optional function that receives a 2-levels copy of the widgets default configuration
57
+ * from parent$ (or an empty object if parent$ is not specified) and returns the widgets default configuration to be used.
58
+ * It is called only if the configuration is needed, and was not yet computed for the current value of the parent configuration.
59
+ * It is called in a tansu reactive context, so it can use any tansu store and will be called again if those stores change.
60
+ * @returns the resulting widgets default configuration store, which contains 3 additional properties that are stores:
61
+ * parent$, adaptedParent$ (containing the value computed after the first step), and own$ (that contains only overridding properties).
62
+ * The resulting store is writable, its set function is actually the set function of the own$ store.
63
+ */
64
+ export declare const createWidgetsConfig: <T>(parent$?: WidgetsConfigStore<T>, adaptParentConfig?: (config: Partial2Levels<T>) => Partial2Levels<T>) => WidgetsConfigStore<T>;
65
+ /**
66
+ * Configuration for various widgets used in the application.
67
+ */
68
+ export type WidgetsConfig = {
69
+ /**
70
+ * the pagination widget config
71
+ */
72
+ pagination: PaginationProps;
73
+ /**
74
+ * the rating widget config
75
+ */
76
+ rating: RatingProps;
77
+ /**
78
+ * the modal widget config
79
+ */
80
+ modal: ModalProps;
81
+ /**
82
+ * the alert widget config
83
+ */
84
+ alert: AlertProps;
85
+ /**
86
+ * the accordion widget config
87
+ */
88
+ accordion: AccordionProps;
89
+ /**
90
+ * the progress bar widget config
91
+ */
92
+ progressbar: ProgressbarProps;
93
+ /**
94
+ * slider widget config
95
+ */
96
+ slider: SliderProps;
97
+ /**
98
+ * toast widget config
99
+ */
100
+ toast: ToastProps;
101
+ /**
102
+ * tree widget config
103
+ */
104
+ tree: TreeProps;
105
+ /**
106
+ * carousel widget config
107
+ */
108
+ carousel: CarouselProps;
109
+ /**
110
+ * collapse widget config
111
+ */
112
+ collapse: CollapseProps;
113
+ /**
114
+ * drawer widget config
115
+ */
116
+ drawer: DrawerProps;
117
+ };
@@ -0,0 +1,36 @@
1
+ import { writable, computed, asWritable } from "@amadeus-it-group/tansu";
2
+ import { identity } from "./utils/func.js";
3
+ const mergeInto = (destination, source, levels = Infinity) => {
4
+ if (source !== void 0) {
5
+ if (typeof source === "object" && source && levels >= 1) {
6
+ if (!destination) {
7
+ destination = {};
8
+ }
9
+ for (const key of Object.keys(source)) {
10
+ if (!Object.prototype.hasOwnProperty.call(source, key)) continue;
11
+ if (key === "__proto__" || key === "constructor") continue;
12
+ destination[key] = mergeInto(destination[key], source[key], levels - 1);
13
+ }
14
+ } else {
15
+ return source;
16
+ }
17
+ }
18
+ return destination;
19
+ };
20
+ const createWidgetsConfig = (parent$, adaptParentConfig = identity) => {
21
+ const own$ = writable({});
22
+ const adaptedParent$ = adaptParentConfig === identity ? parent$ : computed(() => adaptParentConfig(mergeInto({}, parent$?.(), 2)));
23
+ return asWritable(
24
+ computed(() => mergeInto(mergeInto({}, adaptedParent$?.(), 2), own$(), 2)),
25
+ {
26
+ ...own$,
27
+ own$,
28
+ adaptedParent$,
29
+ parent$
30
+ }
31
+ );
32
+ };
33
+ export {
34
+ createWidgetsConfig,
35
+ mergeInto
36
+ };