@design-factory/angular 21.0.4 → 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
@@ -1,14 +1,281 @@
1
- import { widgetsConfigFactory, createWidgetsConfig, toAngularWritableSignal } from '@agnos-ui/angular-headless';
2
- import { asWritable, computed } from '@amadeus-it-group/tansu';
1
+ import { computed, asWritable } from '@amadeus-it-group/tansu';
3
2
  import * as i0 from '@angular/core';
4
- import { InjectionToken, Directive } from '@angular/core';
3
+ import { signal, inject, DestroyRef, Injector, runInInjectionContext, Directive, InjectionToken, SkipSelf, Optional, ElementRef, PLATFORM_ID, afterNextRender, input } from '@angular/core';
4
+ import { createWidgetsConfig } from '@agnos-ui/core/config';
5
+ import { FACTORY_WIDGET_NAME } from '@agnos-ui/core/types';
6
+ import { toReadableStore } from '@agnos-ui/core/utils/stores';
7
+ import { multiDirective } from '@agnos-ui/core/utils/directive';
8
+ import { isPlatformServer } from '@angular/common';
9
+ import { createMatchMedia } from '@agnos-ui/core/services/matchMedia';
5
10
 
6
- const widgetFactories = widgetsConfigFactory(new InjectionToken('dfConfig', {
11
+ /**
12
+ * Converts a Tansu `ReadableSignal` to an Angular `Signal`.
13
+ *
14
+ * This function wraps the provided Tansu signal in an Angular signal. It subscribes to the
15
+ * Tansu signal and updates the Angular signal with the received values. The equality function
16
+ * for the Angular signal is set to always return false, ensuring that every new value from the
17
+ * Tansu signal triggers an update.
18
+ *
19
+ * @template T - The type of the value emitted by the signals.
20
+ * @param tansuSignal - The Tansu signal to convert.
21
+ * @returns - The resulting Angular signal.
22
+ */
23
+ const toAngularSignal = (tansuSignal) => {
24
+ // The equality of objects from 2 sequential emissions is already checked in tansu signal.
25
+ // Here we'll always emit the value received from tansu signal, therefor the equality function
26
+ const res = signal(undefined, { ...(ngDevMode ? { debugName: "res" } : {}), equal: () => false });
27
+ const subscription = tansuSignal.subscribe((value) => {
28
+ res.set(value);
29
+ });
30
+ inject(DestroyRef).onDestroy(subscription);
31
+ return res.asReadonly();
32
+ };
33
+ /**
34
+ * Converts a Tansu `WritableSignal` to an Angular `WritableSignal`.
35
+ *
36
+ * This function wraps the provided Tansu signal in an Angular signal. It subscribes to the
37
+ * Tansu signal and updates the Angular signal with the received values. The equality function
38
+ * for the Angular signal is set to always return false, ensuring that every new value from the
39
+ * Tansu signal triggers an update.
40
+ *
41
+ * @template T - The type of the value emitted by the signals.
42
+ * @param tansuSignal - The Tansu signal to convert.
43
+ * @returns - The resulting Angular signal.
44
+ */
45
+ const toAngularWritableSignal = (tansuSignal) => {
46
+ const res = signal(undefined, { ...(ngDevMode ? { debugName: "res" } : {}), equal: () => false });
47
+ const set = res.set.bind(res);
48
+ const subscription = tansuSignal.subscribe((value) => {
49
+ set(value);
50
+ });
51
+ inject(DestroyRef).onDestroy(subscription);
52
+ res.set = tansuSignal.set;
53
+ res.update = tansuSignal.update;
54
+ return res;
55
+ };
56
+
57
+ /**
58
+ * Call a widget factory using provided configs.
59
+ *
60
+ * The resulting widget can be easily hooked into the lifecycle of an Angular component through {@link BaseWidgetDirective}.
61
+ *
62
+ * @param factory - the widget factory to call
63
+ * @param options - the options
64
+ * @param options.defaultConfig - the default config of the widget
65
+ * @param options.widgetConfig - the config of the widget, overriding the defaultConfig
66
+ * @param options.events - the events of the widget
67
+ * @param options.afterInit - a callback to call after successful setup of the widget
68
+ * @returns the widget
69
+ */
70
+ const callWidgetFactoryWithConfig = (factory, options) => {
71
+ const { defaultConfig, widgetConfig, events: eventsProp, afterInit } = options ?? {};
72
+ const injector = inject(Injector);
73
+ const props = {};
74
+ let initDone;
75
+ const res = {
76
+ initialized: new Promise((resolve) => {
77
+ initDone = resolve;
78
+ }),
79
+ patch(newProps) {
80
+ // temporary function replaced in ngInit
81
+ Object.assign(props, newProps);
82
+ },
83
+ ngInit() {
84
+ runInInjectionContext(injector, () => {
85
+ const defaultConfig$ = toReadableStore(defaultConfig);
86
+ const widget = factory({
87
+ config: computed(() => ({
88
+ ...defaultConfig$(),
89
+ ...widgetConfig?.(),
90
+ ...eventsProp
91
+ })),
92
+ props
93
+ });
94
+ Object.assign(res, {
95
+ patch: widget.patch,
96
+ directives: widget.directives,
97
+ api: widget.api,
98
+ state: Object.fromEntries(Object.entries(widget.stores).map(([key, val]) => [
99
+ key.slice(0, -1),
100
+ toAngularSignal(val)
101
+ ]))
102
+ });
103
+ afterInit?.(res);
104
+ initDone();
105
+ });
106
+ }
107
+ };
108
+ return res;
109
+ };
110
+ function patchSimpleChanges(patchFn, changes) {
111
+ const obj = {};
112
+ for (const [key, simpleChange] of Object.entries(changes)) {
113
+ if (simpleChange !== undefined) {
114
+ obj[key] = simpleChange.currentValue;
115
+ }
116
+ }
117
+ patchFn(obj);
118
+ }
119
+ /**
120
+ * An abstract base class for widget directives, providing common functionality
121
+ * for Angular components that interact with widgets.
122
+ *
123
+ * @template W - The type of the widget.
124
+ */
125
+ class BaseWidgetDirective {
126
+ constructor(
127
+ // eslint-disable-next-line @angular-eslint/prefer-inject
128
+ _widget,
129
+ // eslint-disable-next-line @angular-eslint/prefer-inject
130
+ propRenames) {
131
+ this._widget = _widget;
132
+ this.propRenames = propRenames;
133
+ }
134
+ /**
135
+ * Retrieves the widget api
136
+ * @returns the widget api
137
+ */
138
+ get api() {
139
+ return this._widget.api;
140
+ }
141
+ /**
142
+ * Retrieves the widget state. Each property of the state is exposed through an Angular {@link https://angular.dev/api/core/Signal | Signal}
143
+ * @returns the widget state
144
+ */
145
+ get state() {
146
+ return this._widget.state;
147
+ }
148
+ /**
149
+ * Retrieves the widget directives
150
+ * @returns the widget directives
151
+ */
152
+ get directives() {
153
+ return this._widget.directives;
154
+ }
155
+ /**
156
+ * @inheritdoc
157
+ * @internal
158
+ */
159
+ ngOnChanges(changes) {
160
+ const renamedChanges = {};
161
+ if (this.propRenames) {
162
+ for (const [key, simpleChange] of Object.entries(changes)) {
163
+ const renamedKey = this.propRenames[key] ?? key;
164
+ renamedChanges[renamedKey] = simpleChange;
165
+ }
166
+ }
167
+ else {
168
+ Object.assign(renamedChanges, changes);
169
+ }
170
+ patchSimpleChanges(this._widget.patch, renamedChanges);
171
+ }
172
+ /** @internal */
173
+ ngOnInit() {
174
+ this._widget.ngInit();
175
+ }
176
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: BaseWidgetDirective, deps: "invalid", target: i0.ɵɵFactoryTarget.Directive }); }
177
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.0", type: BaseWidgetDirective, isStandalone: true, usesOnChanges: true, ngImport: i0 }); }
178
+ }
179
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: BaseWidgetDirective, decorators: [{
180
+ type: Directive
181
+ }], ctorParameters: () => [{ type: undefined }, { type: undefined }] });
182
+
183
+ const WIDGETS_CONFIG_INJECTION_TOKEN = new InjectionToken('widgetsConfig', {
7
184
  providedIn: 'root',
8
185
  factory: () => createWidgetsConfig()
9
- }));
10
- const provideWidgetsConfig = widgetFactories.provideWidgetsConfig;
11
- const injectWidgetsConfig = widgetFactories.injectWidgetsConfig;
186
+ });
187
+ /**
188
+ * Creates a provider of widgets default configuration that inherits from any widgets default configuration already defined at an upper level
189
+ * in the Angular dependency injection system. It contains its own set of widgets configuration properties that override the same properties form
190
+ * the parent configuration.
191
+ *
192
+ * @remarks
193
+ * The configuration is computed from the parent configuration in two steps:
194
+ * - first step: the parent configuration is transformed by the adaptParentConfig function (if specified).
195
+ * If adaptParentConfig is not specified, this step is skipped.
196
+ * - second step: the configuration from step 1 is merged (2-levels deep) with the own$ store. The own$ store initially contains
197
+ * an empty object (i.e. no property from the parent is overridden). It can be changed by calling set on the store returned by
198
+ * {@link injectWidgetsConfig}.
199
+ *
200
+ * @param adaptParentConfig - optional function that receives a 2-levels copy of the widgets default configuration
201
+ * defined at an upper level in the Angular dependency injection system (or an empty object if there is none) and returns the widgets
202
+ * default configuration to be used.
203
+ * It is called only if the configuration is needed, and was not yet computed for the current value of the parent configuration.
204
+ * It is called in a tansu reactive context, so it can use any tansu store and will be called again if those stores change.
205
+ * It is also called in an Angular injection context, so it can call the Angular inject function to get and use dependencies from the
206
+ * Angular dependency injection system.
207
+ *
208
+ * @returns DI provider to be included a list of `providers` (for example at a component level or
209
+ * any other level of the Angular dependency injection system)
210
+ *
211
+ * @example
212
+ * ```typescript
213
+ * @Component({
214
+ * // ...
215
+ * providers: [
216
+ * provideWidgetsConfig((parentConfig) => {
217
+ * // first step configuration: transforms the parent configuration
218
+ * parentConfig.rating = parentConfig.rating ?? {};
219
+ * parentConfig.rating.className = `${parentConfig.rating.className ?? ''} my-rating-extra-class`
220
+ * return parentConfig;
221
+ * })
222
+ * ]
223
+ * })
224
+ * class MyComponent {
225
+ * widgetsConfig = injectWidgetsConfig();
226
+ * constructor() {
227
+ * this.widgetsConfig.set({
228
+ * // second step configuration: overrides the parent configuration
229
+ * rating: {
230
+ * slotStar: MyCustomSlotStar
231
+ * }
232
+ * });
233
+ * }
234
+ * // ...
235
+ * }
236
+ * ```
237
+ */
238
+ const provideWidgetsConfig = (adaptParentConfig) => ({
239
+ provide: WIDGETS_CONFIG_INJECTION_TOKEN,
240
+ useFactory: (parent) => {
241
+ if (adaptParentConfig) {
242
+ const injector = inject(Injector);
243
+ const originalAdaptParentConfig = adaptParentConfig;
244
+ adaptParentConfig = (value) => runInInjectionContext(injector, () => originalAdaptParentConfig(value));
245
+ }
246
+ return createWidgetsConfig(parent ?? undefined, adaptParentConfig);
247
+ },
248
+ deps: [[new SkipSelf(), new Optional(), WIDGETS_CONFIG_INJECTION_TOKEN]]
249
+ });
250
+ /**
251
+ * Returns the widgets default configuration store that was provided in the current injection context.
252
+ * Throws if the no widgets default configuration store was provided.
253
+ *
254
+ * @param defaultConfig - values to set as soon as the config is injected
255
+ * @remarks
256
+ * This function must be called from an injection context, such as a constructor, a factory function, a field initializer or
257
+ * a function used with {@link https://angular.io/api/core/runInInjectionContext | runInInjectionContext}.
258
+ *
259
+ * @returns the widgets default configuration store.
260
+ */
261
+ const injectWidgetsConfig = (defaultConfig) => {
262
+ const widgetsConfig = inject(WIDGETS_CONFIG_INJECTION_TOKEN);
263
+ if (defaultConfig) {
264
+ widgetsConfig.set(defaultConfig);
265
+ }
266
+ return widgetsConfig;
267
+ };
268
+ /**
269
+ * Injects the configuration for a specific widget.
270
+ *
271
+ * @template T - The type of the widget configuration to be injected.
272
+ * @param widgetName - The name of the widget whose configuration is to be injected.
273
+ * @returns A `ReadableSignal` that provides a partial configuration of the specified widget or `undefined` if the configuration is not available.
274
+ */
275
+ const injectWidgetConfig = (widgetName) => {
276
+ const widgetsConfig = inject(WIDGETS_CONFIG_INJECTION_TOKEN, { optional: true });
277
+ return computed(() => widgetsConfig?.()[widgetName]);
278
+ };
12
279
  /**
13
280
  * Creates and initializes a widget using the provided factory and configuration options.
14
281
  *
@@ -19,12 +286,15 @@ const injectWidgetsConfig = widgetFactories.injectWidgetsConfig;
19
286
  * @param options - The options for creating the widget.
20
287
  * @param options.defaultConfig - The default configuration for the widget.
21
288
  * @param options.events - The event handlers for the widget.
22
- * @param options.slotTemplates - A function that returns the slot templates for the widget.
23
- * @param options.slotChildren - A function that returns the slot children for the widget.
24
289
  * @param options.afterInit - A callback function to be called after the widget is initialized.
25
290
  * @returns The initialized widget.
26
291
  */
27
- const callWidgetFactory = widgetFactories.callWidgetFactory;
292
+ const callWidgetFactory = (factory, options) => callWidgetFactoryWithConfig(factory, {
293
+ widgetConfig: factory[FACTORY_WIDGET_NAME] ? injectWidgetConfig(factory[FACTORY_WIDGET_NAME]) : undefined,
294
+ defaultConfig: options?.defaultConfig,
295
+ events: options?.events,
296
+ afterInit: options?.afterInit
297
+ });
28
298
  /**
29
299
  * Utility to provide configuration for a specific DF component.
30
300
  *
@@ -67,6 +337,122 @@ const injectDfComponentConfig = (componentKey) => () => {
67
337
  return toAngularWritableSignal(componentConfigStore);
68
338
  };
69
339
 
340
+ /**
341
+ * A utility function to manage the lifecycle of a directive for a host element.
342
+ *
343
+ * This function handles the creation, updating, and destruction of a directive instance
344
+ * associated with a host element. It ensures that the directive is called appropriately
345
+ * based on the platform (server or client) and manages the directive's lifecycle within
346
+ * the Angular injection context.
347
+ *
348
+ * @template T - The type of parameters that the directive accepts.
349
+ *
350
+ * @param [directive] - The directive to be applied to the host element.
351
+ * @param [params] - The parameters to be passed to the directive.
352
+ *
353
+ * @returns An object containing an `update` function to update the directive and its parameters.
354
+ */
355
+ const useDirectiveForHost = (directive, params) => {
356
+ const injector = inject(Injector);
357
+ const ref = inject(ElementRef);
358
+ const platform = inject(PLATFORM_ID);
359
+ let instance;
360
+ let plannedCallDirective = false;
361
+ const callDirective = isPlatformServer(platform)
362
+ ? () => {
363
+ instance = directive?.(ref.nativeElement, params);
364
+ }
365
+ : () => {
366
+ if (plannedCallDirective || !directive) {
367
+ return;
368
+ }
369
+ plannedCallDirective = true;
370
+ runInInjectionContext(injector, () => {
371
+ afterNextRender(() => {
372
+ plannedCallDirective = false;
373
+ instance = directive?.(ref.nativeElement, params);
374
+ });
375
+ });
376
+ };
377
+ function destroyDirectiveInstance() {
378
+ const oldInstance = instance;
379
+ instance = undefined;
380
+ directive = undefined;
381
+ oldInstance?.destroy?.();
382
+ }
383
+ inject(DestroyRef).onDestroy(destroyDirectiveInstance);
384
+ function update(newDirective, newParams) {
385
+ if (newDirective !== directive) {
386
+ void destroyDirectiveInstance();
387
+ directive = newDirective;
388
+ params = newParams;
389
+ callDirective();
390
+ }
391
+ else if (newParams != params) {
392
+ params = newParams;
393
+ instance?.update?.(params);
394
+ }
395
+ }
396
+ callDirective();
397
+ return { update };
398
+ };
399
+ /**
400
+ * A directive that allows the use of another directive with optional parameters.
401
+ *
402
+ * @template T - The type of the parameter that can be passed to the directive.
403
+ *
404
+ * @remarks
405
+ * This directive uses a private instance of {@link useDirectiveForHost} to manage the directive and its parameter.
406
+ */
407
+ class UseDirective {
408
+ constructor() {
409
+ this.use = input.required({ ...(ngDevMode ? { debugName: "use" } : {}), alias: 'dfUse' });
410
+ this.#useDirective = useDirectiveForHost();
411
+ }
412
+ #useDirective;
413
+ /** @internal */
414
+ ngOnChanges() {
415
+ const use = this.use();
416
+ const [directive, param] = Array.isArray(use) ? use : [use];
417
+ this.#useDirective.update(directive, param);
418
+ }
419
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: UseDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
420
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.0", type: UseDirective, isStandalone: true, selector: "[dfUse]", inputs: { use: { classPropertyName: "use", publicName: "dfUse", isSignal: true, isRequired: true, transformFunction: null } }, usesOnChanges: true, ngImport: i0 }); }
421
+ }
422
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: UseDirective, decorators: [{
423
+ type: Directive,
424
+ args: [{
425
+ selector: '[dfUse]'
426
+ }]
427
+ }], propDecorators: { use: [{ type: i0.Input, args: [{ isSignal: true, alias: "dfUse", required: true }] }] } });
428
+ /**
429
+ * A directive that allows the use of multiple directives on a host element.
430
+ *
431
+ * @template T - A tuple type representing the directives and their optional parameters.
432
+ */
433
+ class UseMultiDirective {
434
+ constructor() {
435
+ /**
436
+ * An input property that takes a tuple of directives and their optional parameters.
437
+ */
438
+ this.useMulti = input.required({ ...(ngDevMode ? { debugName: "useMulti" } : {}), alias: 'dfUseMulti' });
439
+ this.#useDirective = useDirectiveForHost();
440
+ }
441
+ #useDirective;
442
+ /** @internal */
443
+ ngOnChanges() {
444
+ this.#useDirective.update(multiDirective, this.useMulti());
445
+ }
446
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: UseMultiDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
447
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.0", type: UseMultiDirective, isStandalone: true, selector: "[dfUseMulti]", inputs: { useMulti: { classPropertyName: "useMulti", publicName: "dfUseMulti", isSignal: true, isRequired: true, transformFunction: null } }, usesOnChanges: true, ngImport: i0 }); }
448
+ }
449
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: UseMultiDirective, decorators: [{
450
+ type: Directive,
451
+ args: [{
452
+ selector: '[dfUseMulti]'
453
+ }]
454
+ }], propDecorators: { useMulti: [{ type: i0.Input, args: [{ isSignal: true, alias: "dfUseMulti", required: true }] }] } });
455
+
70
456
  /**
71
457
  * An abstract base class for widget directives, providing common functionality
72
458
  * for Angular components that interact with widgets.
@@ -92,20 +478,56 @@ class AgnosWidgetDirective {
92
478
  ngOnInit() {
93
479
  this._agnosWidget.ngInit();
94
480
  }
95
- /** @internal */
96
- ngAfterContentChecked() {
97
- this._agnosWidget.updateSlots();
481
+ /**
482
+ * Access to the widget state.
483
+ */
484
+ get state() {
485
+ return this._agnosWidget.state;
486
+ }
487
+ /**
488
+ * Access to the widget API.
489
+ */
490
+ get api() {
491
+ return this._agnosWidget.api;
492
+ }
493
+ /**
494
+ * Access to the widget directives.
495
+ */
496
+ get directives() {
497
+ return this._agnosWidget.directives;
98
498
  }
99
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: AgnosWidgetDirective, deps: "invalid", target: i0.ɵɵFactoryTarget.Directive }); }
100
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.1.1", type: AgnosWidgetDirective, isStandalone: true, usesOnChanges: true, ngImport: i0 }); }
499
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: AgnosWidgetDirective, deps: "invalid", target: i0.ɵɵFactoryTarget.Directive }); }
500
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.0", type: AgnosWidgetDirective, isStandalone: true, usesOnChanges: true, ngImport: i0 }); }
101
501
  }
102
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: AgnosWidgetDirective, decorators: [{
502
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: AgnosWidgetDirective, decorators: [{
103
503
  type: Directive
104
504
  }], ctorParameters: () => [{ type: undefined }] });
105
505
 
506
+ // Breakpoints based on Bootstrap 5
507
+ /**
508
+ * sm breakpoint,
509
+ * tansu signal that returns true when the viewport is at least 576px wide
510
+ */
511
+ const sm$ = createMatchMedia('(min-width: 576px)');
512
+ /**
513
+ * md breakpoint,
514
+ * tansu signal that returns true when the viewport is at least 768px wide
515
+ */
516
+ const md$ = createMatchMedia('(min-width: 768px)');
517
+ /**
518
+ * lg breakpoint,
519
+ * tansu signal that returns true when the viewport is at least 992px wide
520
+ */
521
+ const lg$ = createMatchMedia('(min-width: 992px)');
522
+ /**
523
+ * xl breakpoint,
524
+ * tansu signal that returns true when the viewport is at least 1200px wide
525
+ */
526
+ const xl$ = createMatchMedia('(min-width: 1200px)');
527
+
106
528
  /**
107
529
  * Generated bundle index. Do not edit.
108
530
  */
109
531
 
110
- export { AgnosWidgetDirective, callWidgetFactory, injectDfComponentConfig, injectWidgetsConfig, provideDfComponentConfig, provideWidgetsConfig };
532
+ export { AgnosWidgetDirective, BaseWidgetDirective, UseDirective, UseMultiDirective, callWidgetFactory, callWidgetFactoryWithConfig, injectDfComponentConfig, injectWidgetConfig, lg$, md$, provideDfComponentConfig, sm$, toAngularSignal, toAngularWritableSignal, useDirectiveForHost, xl$ };
111
533
  //# sourceMappingURL=design-factory-angular-internals.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"design-factory-angular-internals.mjs","sources":["../../internals/config.ts","../../internals/widget.directive.ts","../../internals/design-factory-angular-internals.ts"],"sourcesContent":["import type { WidgetsConfigStore } from '@agnos-ui/angular-headless';\nimport { createWidgetsConfig, toAngularWritableSignal, widgetsConfigFactory } from '@agnos-ui/angular-headless';\nimport { asWritable, computed, type ReadableSignal } from '@amadeus-it-group/tansu';\nimport type { FactoryProvider } from '@angular/core';\nimport { InjectionToken } from '@angular/core';\n\nconst widgetFactories = widgetsConfigFactory(\n new InjectionToken<WidgetsConfigStore<unknown>>('dfConfig', {\n providedIn: 'root',\n factory: () => createWidgetsConfig()\n })\n);\n\nexport const provideWidgetsConfig = widgetFactories.provideWidgetsConfig;\n\nexport const injectWidgetsConfig = widgetFactories.injectWidgetsConfig;\n\n/**\n * Creates and initializes a widget using the provided factory and configuration options.\n *\n * The resulting widget can be easily hooked into the lifecycle of an Angular component through {@link BaseWidgetDirective}.\n *\n * @template W - The type of the widget.\n * @param factory - The factory function to create the widget.\n * @param options - The options for creating the widget.\n * @param options.defaultConfig - The default configuration for the widget.\n * @param options.events - The event handlers for the widget.\n * @param options.slotTemplates - A function that returns the slot templates for the widget.\n * @param options.slotChildren - A function that returns the slot children for the widget.\n * @param options.afterInit - A callback function to be called after the widget is initialized.\n * @returns The initialized widget.\n */\nexport const callWidgetFactory = widgetFactories.callWidgetFactory;\n\n/**\n * Utility to provide configuration for a specific DF component.\n *\n * @example\n * ```typescript\n * export const provideDfCollapseConfig = provideDfComponentConfig<DfCollapseConfig>(COLLAPSE_CONFIG_KEY);\n * ```\n *\n * @param componentKey the key of the component in the global configuration\n * @returns the component config provider\n */\nexport const provideDfComponentConfig = <T>(componentKey: string) => {\n return (config?: Partial<T> | ((prevConfig: Partial<T>) => Partial<T>)) => {\n const typedProvideWidgetsConfig = provideWidgetsConfig as (\n adaptParentConfig?: (parentConfig: { [componentKey]?: Partial<T> }) => { [componentKey]?: Partial<T> }\n ) => FactoryProvider;\n return typedProvideWidgetsConfig((prevConfig) => ({\n ...prevConfig,\n [componentKey]: {\n ...(prevConfig?.[componentKey] ?? {}),\n ...(typeof config === 'function' ? config(prevConfig?.[componentKey] ?? {}) : (config ?? {}))\n }\n }));\n };\n};\n\n/**\n * Utility to inject writable configuration for a specific DF component.\n *\n * @example\n * ```typescript\n * export const injectDfCollapseConfig = injectDfComponentConfig<DfCollapseConfig>(COLLAPSE_CONFIG_KEY);\n * ```\n *\n * @param componentKey the key of the component in the global configuration\n * @returns the inject function that returns the writable component configuration\n */\nexport const injectDfComponentConfig =\n <T>(componentKey: string) =>\n () => {\n const widgetsConfigStore = injectWidgetsConfig() as WidgetsConfigStore<{ [componentKey]?: Partial<T> }>;\n const componentConfigStore = asWritable(\n computed(() => widgetsConfigStore.own$()[componentKey] ?? {}) as ReadableSignal<Partial<T>>,\n (newConfig: Partial<T>) => {\n widgetsConfigStore.own$.update((currentConfig) => ({ ...currentConfig, [componentKey]: newConfig }));\n }\n );\n return toAngularWritableSignal(componentConfigStore);\n };\n","import { AngularWidget, Widget } from '@agnos-ui/angular-headless';\nimport { AfterContentChecked, Directive, OnChanges, OnInit, SimpleChanges } from '@angular/core';\n\n/**\n * An abstract base class for widget directives, providing common functionality\n * for Angular components that interact with widgets.\n *\n * @template W - The type of the widget.\n */\n@Directive()\nexport abstract class AgnosWidgetDirective<W extends Widget> implements OnChanges, OnInit, AfterContentChecked {\n // eslint-disable-next-line @angular-eslint/prefer-inject\n constructor(protected readonly _agnosWidget: AngularWidget<W>) {}\n\n /** @internal */\n ngOnChanges(changes: SimpleChanges): void {\n const patchData: any = {};\n for (const [key, simpleChange] of Object.entries(changes)) {\n if (simpleChange !== undefined) {\n patchData[key] = simpleChange.currentValue;\n }\n }\n this._agnosWidget.patch(patchData);\n }\n\n /** @internal */\n ngOnInit(): void {\n this._agnosWidget.ngInit();\n }\n\n /** @internal */\n ngAfterContentChecked(): void {\n this._agnosWidget.updateSlots();\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;AAMA,MAAM,eAAe,GAAG,oBAAoB,CAC1C,IAAI,cAAc,CAA8B,UAAU,EAAE;AAC1D,IAAA,UAAU,EAAE,MAAM;AAClB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AAA,YAAY,GAAZ,YAAY;IAAqB;;AAGhE,IAAA,WAAW,CAAC,OAAsB,EAAA;QAChC,MAAM,SAAS,GAAQ,EAAE;AACzB,QAAA,KAAK,MAAM,CAAC,GAAG,EAAE,YAAY,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE;AACzD,YAAA,IAAI,YAAY,KAAK,SAAS,EAAE;AAC9B,gBAAA,SAAS,CAAC,GAAG,CAAC,GAAG,YAAY,CAAC,YAAY;YAC5C;QACF;AACA,QAAA,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,SAAS,CAAC;IACpC;;IAGA,QAAQ,GAAA;AACN,QAAA,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE;IAC5B;;IAGA,qBAAqB,GAAA;AACnB,QAAA,IAAI,CAAC,YAAY,CAAC,WAAW,EAAE;IACjC;8GAvBoB,oBAAoB,EAAA,IAAA,EAAA,SAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA;kGAApB,oBAAoB,EAAA,YAAA,EAAA,IAAA,EAAA,aAAA,EAAA,IAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA;;2FAApB,oBAAoB,EAAA,UAAA,EAAA,CAAA;kBADzC;;;ACTD;;AAEG;;;;"}
1
+ {"version":3,"file":"design-factory-angular-internals.mjs","sources":["../../internals/utils/stores.ts","../../internals/utils/widget.ts","../../internals/config.ts","../../internals/utils/directive.ts","../../internals/widget.directive.ts","../../internals/breakpoints.ts","../../internals/design-factory-angular-internals.ts"],"sourcesContent":["import type { ReadableSignal, WritableSignal as TansuWritableSignal } from '@amadeus-it-group/tansu';\nimport type { Signal, WritableSignal } from '@angular/core';\nimport { DestroyRef, inject, signal } from '@angular/core';\n\n/**\n * Converts a Tansu `ReadableSignal` to an Angular `Signal`.\n *\n * This function wraps the provided Tansu signal in an Angular signal. It subscribes to the\n * Tansu signal and updates the Angular signal with the received values. The equality function\n * for the Angular signal is set to always return false, ensuring that every new value from the\n * Tansu signal triggers an update.\n *\n * @template T - The type of the value emitted by the signals.\n * @param tansuSignal - The Tansu signal to convert.\n * @returns - The resulting Angular signal.\n */\nexport const toAngularSignal = <T>(tansuSignal: ReadableSignal<T>): Signal<T> => {\n // The equality of objects from 2 sequential emissions is already checked in tansu signal.\n // Here we'll always emit the value received from tansu signal, therefor the equality function\n const res = signal(undefined as any as T, { equal: () => false });\n const subscription = tansuSignal.subscribe((value) => {\n res.set(value);\n });\n inject(DestroyRef).onDestroy(subscription);\n\n return res.asReadonly();\n};\n\n/**\n * Converts a Tansu `WritableSignal` to an Angular `WritableSignal`.\n *\n * This function wraps the provided Tansu signal in an Angular signal. It subscribes to the\n * Tansu signal and updates the Angular signal with the received values. The equality function\n * for the Angular signal is set to always return false, ensuring that every new value from the\n * Tansu signal triggers an update.\n *\n * @template T - The type of the value emitted by the signals.\n * @param tansuSignal - The Tansu signal to convert.\n * @returns - The resulting Angular signal.\n */\nexport const toAngularWritableSignal = <T>(tansuSignal: TansuWritableSignal<T>): WritableSignal<T> => {\n const res = signal(undefined as any as T, { equal: () => false });\n const set = res.set.bind(res);\n const subscription = tansuSignal.subscribe((value) => {\n set(value);\n });\n inject(DestroyRef).onDestroy(subscription);\n res.set = tansuSignal.set;\n res.update = tansuSignal.update;\n return res;\n};\n","import { computed, type ReadableSignal } from '@amadeus-it-group/tansu';\nimport type { OnChanges, OnInit, SimpleChanges } from '@angular/core';\nimport { Directive, Injector, inject, runInInjectionContext } from '@angular/core';\nimport type { AngularState, AngularWidget } from '../types';\nimport type { Widget, WidgetFactory, WidgetProps } from '@agnos-ui/core/types';\nimport { toAngularSignal } from './stores';\nimport { toReadableStore } from '@agnos-ui/core/utils/stores';\n\n/**\n * Call a widget factory using provided configs.\n *\n * The resulting widget can be easily hooked into the lifecycle of an Angular component through {@link BaseWidgetDirective}.\n *\n * @param factory - the widget factory to call\n * @param options - the options\n * @param options.defaultConfig - the default config of the widget\n * @param options.widgetConfig - the config of the widget, overriding the defaultConfig\n * @param options.events - the events of the widget\n * @param options.afterInit - a callback to call after successful setup of the widget\n * @returns the widget\n */\nexport const callWidgetFactoryWithConfig = <W extends Widget>(\n factory: WidgetFactory<W>,\n options?: {\n defaultConfig?: Partial<WidgetProps<W>> | ReadableSignal<Partial<WidgetProps<W>> | undefined>;\n widgetConfig?: null | undefined | ReadableSignal<Partial<WidgetProps<W>> | undefined>;\n events?: Partial<Pick<WidgetProps<W>, keyof WidgetProps<W> & `on${string}`>>;\n afterInit?: (widget: AngularWidget<W>) => void;\n }\n): AngularWidget<W> => {\n const { defaultConfig, widgetConfig, events: eventsProp, afterInit } = options ?? {};\n const injector = inject(Injector);\n const props = {};\n let initDone: () => void;\n\n const res = {\n initialized: new Promise<void>((resolve) => {\n initDone = resolve;\n }),\n patch(newProps: Partial<WidgetProps<W>>) {\n // temporary function replaced in ngInit\n Object.assign(props, newProps);\n },\n ngInit() {\n runInInjectionContext(injector, () => {\n const defaultConfig$ = toReadableStore(defaultConfig);\n const widget = factory({\n config: computed(() => ({\n ...defaultConfig$(),\n ...widgetConfig?.(),\n ...(eventsProp as Partial<WidgetProps<W>>)\n })),\n props\n });\n Object.assign(res, {\n patch: widget.patch,\n directives: widget.directives,\n api: widget.api,\n state: Object.fromEntries(\n Object.entries<ReadableSignal<unknown>>(widget.stores as any).map(([key, val]) => [\n key.slice(0, -1),\n toAngularSignal(val)\n ])\n )\n });\n afterInit?.(res as AngularWidget<W>);\n initDone();\n });\n }\n };\n\n return res as AngularWidget<W>;\n};\n\nfunction patchSimpleChanges(patchFn: (obj: any) => void, changes: SimpleChanges) {\n const obj: any = {};\n for (const [key, simpleChange] of Object.entries(changes)) {\n if (simpleChange !== undefined) {\n obj[key] = simpleChange.currentValue;\n }\n }\n patchFn(obj);\n}\n\n/**\n * An abstract base class for widget directives, providing common functionality\n * for Angular components that interact with widgets.\n *\n * @template W - The type of the widget.\n */\n@Directive()\nexport abstract class BaseWidgetDirective<W extends Widget> implements OnChanges, OnInit {\n constructor(\n // eslint-disable-next-line @angular-eslint/prefer-inject\n private readonly _widget: AngularWidget<W>,\n // eslint-disable-next-line @angular-eslint/prefer-inject\n private readonly propRenames?: Record<string, string>\n ) {}\n\n /**\n * Retrieves the widget api\n * @returns the widget api\n */\n get api(): W['api'] {\n return this._widget.api;\n }\n\n /**\n * Retrieves the widget state. Each property of the state is exposed through an Angular {@link https://angular.dev/api/core/Signal | Signal}\n * @returns the widget state\n */\n get state(): AngularState<W> {\n return this._widget.state;\n }\n\n /**\n * Retrieves the widget directives\n * @returns the widget directives\n */\n get directives(): W['directives'] {\n return this._widget.directives;\n }\n\n /**\n * @inheritdoc\n * @internal\n */\n ngOnChanges(changes: SimpleChanges): void {\n const renamedChanges: SimpleChanges = {};\n if (this.propRenames) {\n for (const [key, simpleChange] of Object.entries(changes)) {\n const renamedKey = this.propRenames[key] ?? key;\n renamedChanges[renamedKey] = simpleChange;\n }\n } else {\n Object.assign(renamedChanges, changes);\n }\n patchSimpleChanges(this._widget.patch, renamedChanges);\n }\n\n /** @internal */\n ngOnInit(): void {\n this._widget.ngInit();\n }\n}\n","import { asWritable, computed, type ReadableSignal } from '@amadeus-it-group/tansu';\nimport type { FactoryProvider } from '@angular/core';\nimport { InjectionToken, Injector, Optional, SkipSelf, inject, runInInjectionContext } from '@angular/core';\nimport type { Partial2Levels, WidgetsConfigStore } from '@agnos-ui/core/config';\nimport { createWidgetsConfig } from '@agnos-ui/core/config';\nimport type { Widget, WidgetFactory, WidgetProps } from '@agnos-ui/core/types';\nimport { FACTORY_WIDGET_NAME } from '@agnos-ui/core/types';\nimport type { AngularWidget } from './types';\nimport { toAngularWritableSignal } from './utils/stores';\nimport { callWidgetFactoryWithConfig } from './utils/widget';\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport type { BaseWidgetDirective } from './utils/widget';\n\ntype AdaptParentConfig<Config> = (config: Partial2Levels<Config>) => Partial2Levels<Config>;\ntype InjectWidgetsConfig<Config> = (config?: Partial2Levels<Config>) => WidgetsConfigStore<Config>;\ntype GenericConfig = Record<string, Record<string, unknown>>;\n\nconst WIDGETS_CONFIG_INJECTION_TOKEN = new InjectionToken<WidgetsConfigStore<GenericConfig>>('widgetsConfig', {\n providedIn: 'root',\n factory: () => createWidgetsConfig()\n});\n\n/**\n * Creates a provider of widgets default configuration that inherits from any widgets default configuration already defined at an upper level\n * in the Angular dependency injection system. It contains its own set of widgets configuration properties that override the same properties form\n * the parent configuration.\n *\n * @remarks\n * The configuration is computed from the parent configuration in two steps:\n * - first step: the parent configuration is transformed by the adaptParentConfig function (if specified).\n * If adaptParentConfig is not specified, this step is skipped.\n * - second step: the configuration from step 1 is merged (2-levels deep) with the own$ store. The own$ store initially contains\n * an empty object (i.e. no property from the parent is overridden). It can be changed by calling set on the store returned by\n * {@link injectWidgetsConfig}.\n *\n * @param adaptParentConfig - optional function that receives a 2-levels copy of the widgets default configuration\n * defined at an upper level in the Angular dependency injection system (or an empty object if there is none) and returns the widgets\n * default configuration to be used.\n * It is called only if the configuration is needed, and was not yet computed for the current value of the parent configuration.\n * It is called in a tansu reactive context, so it can use any tansu store and will be called again if those stores change.\n * It is also called in an Angular injection context, so it can call the Angular inject function to get and use dependencies from the\n * Angular dependency injection system.\n *\n * @returns DI provider to be included a list of `providers` (for example at a component level or\n * any other level of the Angular dependency injection system)\n *\n * @example\n * ```typescript\n * @Component({\n * // ...\n * providers: [\n * provideWidgetsConfig((parentConfig) => {\n * // first step configuration: transforms the parent configuration\n * parentConfig.rating = parentConfig.rating ?? {};\n * parentConfig.rating.className = `${parentConfig.rating.className ?? ''} my-rating-extra-class`\n * return parentConfig;\n * })\n * ]\n * })\n * class MyComponent {\n * widgetsConfig = injectWidgetsConfig();\n * constructor() {\n * this.widgetsConfig.set({\n * // second step configuration: overrides the parent configuration\n * rating: {\n * slotStar: MyCustomSlotStar\n * }\n * });\n * }\n * // ...\n * }\n * ```\n */\nconst provideWidgetsConfig = (adaptParentConfig?: AdaptParentConfig<GenericConfig>): FactoryProvider => ({\n provide: WIDGETS_CONFIG_INJECTION_TOKEN,\n useFactory: (parent: WidgetsConfigStore<GenericConfig> | null) => {\n if (adaptParentConfig) {\n const injector = inject(Injector);\n const originalAdaptParentConfig = adaptParentConfig;\n adaptParentConfig = (value) => runInInjectionContext(injector, () => originalAdaptParentConfig(value));\n }\n return createWidgetsConfig(parent ?? undefined, adaptParentConfig);\n },\n deps: [[new SkipSelf(), new Optional(), WIDGETS_CONFIG_INJECTION_TOKEN]]\n});\n\n/**\n * Returns the widgets default configuration store that was provided in the current injection context.\n * Throws if the no widgets default configuration store was provided.\n *\n * @param defaultConfig - values to set as soon as the config is injected\n * @remarks\n * This function must be called from an injection context, such as a constructor, a factory function, a field initializer or\n * a function used with {@link https://angular.io/api/core/runInInjectionContext | runInInjectionContext}.\n *\n * @returns the widgets default configuration store.\n */\nconst injectWidgetsConfig: InjectWidgetsConfig<GenericConfig> = (defaultConfig?: Partial2Levels<GenericConfig>) => {\n const widgetsConfig = inject(WIDGETS_CONFIG_INJECTION_TOKEN);\n if (defaultConfig) {\n widgetsConfig.set(defaultConfig);\n }\n return widgetsConfig;\n};\n\n/**\n * Injects the configuration for a specific widget.\n *\n * @template T - The type of the widget configuration to be injected.\n * @param widgetName - The name of the widget whose configuration is to be injected.\n * @returns A `ReadableSignal` that provides a partial configuration of the specified widget or `undefined` if the configuration is not available.\n */\nexport const injectWidgetConfig = <T>(widgetName: string): ReadableSignal<Partial<T> | undefined> => {\n const widgetsConfig = inject(WIDGETS_CONFIG_INJECTION_TOKEN, { optional: true });\n return computed(() => widgetsConfig?.()[widgetName] as Partial<T> | undefined);\n};\n\n/**\n * Creates and initializes a widget using the provided factory and configuration options.\n *\n * The resulting widget can be easily hooked into the lifecycle of an Angular component through {@link BaseWidgetDirective}.\n *\n * @template W - The type of the widget.\n * @param factory - The factory function to create the widget.\n * @param options - The options for creating the widget.\n * @param options.defaultConfig - The default configuration for the widget.\n * @param options.events - The event handlers for the widget.\n * @param options.afterInit - A callback function to be called after the widget is initialized.\n * @returns The initialized widget.\n */\nexport const callWidgetFactory = <W extends Widget>(\n factory: WidgetFactory<W>,\n options?: {\n defaultConfig?: Partial<WidgetProps<W>> | ReadableSignal<Partial<WidgetProps<W>> | undefined>;\n events?: Partial<Pick<WidgetProps<W>, keyof WidgetProps<W> & `on${string}`>>;\n afterInit?: (widget: AngularWidget<W>) => void;\n }\n): AngularWidget<W> =>\n callWidgetFactoryWithConfig(factory, {\n widgetConfig: factory[FACTORY_WIDGET_NAME] ? (injectWidgetConfig(factory[FACTORY_WIDGET_NAME]) as any) : undefined,\n defaultConfig: options?.defaultConfig,\n events: options?.events,\n afterInit: options?.afterInit\n });\n\n/**\n * Utility to provide configuration for a specific DF component.\n *\n * @example\n * ```typescript\n * export const provideDfCollapseConfig = provideDfComponentConfig<DfCollapseConfig>(COLLAPSE_CONFIG_KEY);\n * ```\n *\n * @param componentKey the key of the component in the global configuration\n * @returns the component config provider\n */\nexport const provideDfComponentConfig = <T>(componentKey: string) => {\n return (config?: Partial<T> | ((prevConfig: Partial<T>) => Partial<T>)) => {\n const typedProvideWidgetsConfig = provideWidgetsConfig as (\n adaptParentConfig?: (parentConfig: { [componentKey]?: Partial<T> }) => { [componentKey]?: Partial<T> }\n ) => FactoryProvider;\n return typedProvideWidgetsConfig((prevConfig) => ({\n ...prevConfig,\n [componentKey]: {\n ...(prevConfig?.[componentKey] ?? {}),\n ...(typeof config === 'function' ? config(prevConfig?.[componentKey] ?? {}) : (config ?? {}))\n }\n }));\n };\n};\n\n/**\n * Utility to inject writable configuration for a specific DF component.\n *\n * @example\n * ```typescript\n * export const injectDfCollapseConfig = injectDfComponentConfig<DfCollapseConfig>(COLLAPSE_CONFIG_KEY);\n * ```\n *\n * @param componentKey the key of the component in the global configuration\n * @returns the inject function that returns the writable component configuration\n */\nexport const injectDfComponentConfig =\n <T>(componentKey: string) =>\n () => {\n const widgetsConfigStore = injectWidgetsConfig() as WidgetsConfigStore<{ [componentKey]?: Partial<T> }>;\n const componentConfigStore = asWritable(\n computed(() => widgetsConfigStore.own$()[componentKey] ?? {}) as ReadableSignal<Partial<T>>,\n (newConfig: Partial<T>) => {\n widgetsConfigStore.own$.update((currentConfig) => ({ ...currentConfig, [componentKey]: newConfig }));\n }\n );\n return toAngularWritableSignal(componentConfigStore);\n };\n","import type { Directive as AgnosUIDirective, DirectiveAndParam, DirectivesAndOptParam } from '@agnos-ui/core/types';\nimport { multiDirective } from '@agnos-ui/core/utils/directive';\nimport { isPlatformServer } from '@angular/common';\nimport type { OnChanges } from '@angular/core';\nimport {\n DestroyRef,\n Directive,\n ElementRef,\n Injector,\n PLATFORM_ID,\n afterNextRender,\n inject,\n runInInjectionContext,\n input\n} from '@angular/core';\n\n/**\n * A utility function to manage the lifecycle of a directive for a host element.\n *\n * This function handles the creation, updating, and destruction of a directive instance\n * associated with a host element. It ensures that the directive is called appropriately\n * based on the platform (server or client) and manages the directive's lifecycle within\n * the Angular injection context.\n *\n * @template T - The type of parameters that the directive accepts.\n *\n * @param [directive] - The directive to be applied to the host element.\n * @param [params] - The parameters to be passed to the directive.\n *\n * @returns An object containing an `update` function to update the directive and its parameters.\n */\nexport const useDirectiveForHost = <T>(directive?: AgnosUIDirective<T>, params?: T) => {\n const injector = inject(Injector);\n const ref = inject(ElementRef);\n const platform = inject(PLATFORM_ID);\n\n let instance: undefined | ReturnType<AgnosUIDirective<T>>;\n let plannedCallDirective = false;\n\n const callDirective = isPlatformServer(platform)\n ? () => {\n instance = directive?.(ref.nativeElement, params as T);\n }\n : () => {\n if (plannedCallDirective || !directive) {\n return;\n }\n plannedCallDirective = true;\n runInInjectionContext(injector, () => {\n afterNextRender(() => {\n plannedCallDirective = false;\n instance = directive?.(ref.nativeElement, params as T);\n });\n });\n };\n\n function destroyDirectiveInstance() {\n const oldInstance = instance;\n instance = undefined;\n directive = undefined;\n oldInstance?.destroy?.();\n }\n\n inject(DestroyRef).onDestroy(destroyDirectiveInstance);\n\n function update(newDirective?: AgnosUIDirective<T>, newParams?: T) {\n if (newDirective !== directive) {\n void destroyDirectiveInstance();\n directive = newDirective;\n params = newParams;\n callDirective();\n } else if (newParams != params) {\n params = newParams;\n instance?.update?.(params as T);\n }\n }\n\n callDirective();\n return { update };\n};\n\n/**\n * A directive that allows the use of another directive with optional parameters.\n *\n * @template T - The type of the parameter that can be passed to the directive.\n *\n * @remarks\n * This directive uses a private instance of {@link useDirectiveForHost} to manage the directive and its parameter.\n */\n@Directive({\n selector: '[dfUse]'\n})\nexport class UseDirective<T> implements OnChanges {\n readonly use = input.required<AgnosUIDirective | DirectiveAndParam<T>>({ alias: 'dfUse' });\n readonly #useDirective = useDirectiveForHost<T>();\n\n /** @internal */\n ngOnChanges() {\n const use = this.use();\n const [directive, param] = Array.isArray(use) ? use : [use as any];\n this.#useDirective.update(directive, param);\n }\n}\n\n/**\n * A directive that allows the use of multiple directives on a host element.\n *\n * @template T - A tuple type representing the directives and their optional parameters.\n */\n@Directive({\n selector: '[dfUseMulti]'\n})\nexport class UseMultiDirective<T extends any[]> implements OnChanges {\n /**\n * An input property that takes a tuple of directives and their optional parameters.\n */\n readonly useMulti = input.required<DirectivesAndOptParam<T>>({ alias: 'dfUseMulti' });\n\n readonly #useDirective = useDirectiveForHost<DirectivesAndOptParam<T>>();\n\n /** @internal */\n ngOnChanges() {\n this.#useDirective.update(multiDirective, this.useMulti());\n }\n}\n","import type { Widget } from '@agnos-ui/core/types';\nimport type { AngularWidget } from './types';\nimport { Directive, OnChanges, OnInit, SimpleChanges } from '@angular/core';\n\n/**\n * An abstract base class for widget directives, providing common functionality\n * for Angular components that interact with widgets.\n *\n * @template W - The type of the widget.\n */\n@Directive()\nexport abstract class AgnosWidgetDirective<W extends Widget> implements OnChanges, OnInit {\n // eslint-disable-next-line @angular-eslint/prefer-inject\n constructor(protected readonly _agnosWidget: AngularWidget<W>) {}\n\n /** @internal */\n ngOnChanges(changes: SimpleChanges): void {\n const patchData: any = {};\n for (const [key, simpleChange] of Object.entries(changes)) {\n if (simpleChange !== undefined) {\n patchData[key] = simpleChange.currentValue;\n }\n }\n this._agnosWidget.patch(patchData);\n }\n\n /** @internal */\n ngOnInit(): void {\n this._agnosWidget.ngInit();\n }\n\n /**\n * Access to the widget state.\n */\n protected get state(): AngularWidget<W>['state'] {\n return this._agnosWidget.state;\n }\n\n /**\n * Access to the widget API.\n */\n protected get api(): AngularWidget<W>['api'] {\n return this._agnosWidget.api;\n }\n\n /**\n * Access to the widget directives.\n */\n protected get directives(): AngularWidget<W>['directives'] {\n return this._agnosWidget.directives;\n }\n}\n","import { createMatchMedia } from '@agnos-ui/core/services/matchMedia';\n\n// Breakpoints based on Bootstrap 5\n\n/**\n * sm breakpoint,\n * tansu signal that returns true when the viewport is at least 576px wide\n */\nexport const sm$ = createMatchMedia('(min-width: 576px)');\n/**\n * md breakpoint,\n * tansu signal that returns true when the viewport is at least 768px wide\n */\nexport const md$ = createMatchMedia('(min-width: 768px)');\n/**\n * lg breakpoint,\n * tansu signal that returns true when the viewport is at least 992px wide\n */\nexport const lg$ = createMatchMedia('(min-width: 992px)');\n/**\n * xl breakpoint,\n * tansu signal that returns true when the viewport is at least 1200px wide\n */\nexport const xl$ = createMatchMedia('(min-width: 1200px)');\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;AAIA;;;;;;;;;;;AAWG;AACI,MAAM,eAAe,GAAG,CAAI,WAA8B,KAAe;;;AAG9E,IAAA,MAAM,GAAG,GAAG,MAAM,CAAC,SAAqB,EAAA,EAAA,IAAA,SAAA,GAAA,EAAA,SAAA,EAAA,KAAA,EAAA,GAAA,EAAA,CAAA,EAAI,KAAK,EAAE,MAAM,KAAK,GAAG;IACjE,MAAM,YAAY,GAAG,WAAW,CAAC,SAAS,CAAC,CAAC,KAAK,KAAI;AACnD,QAAA,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC;AAChB,IAAA,CAAC,CAAC;IACF,MAAM,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