@agnos-ui/angular-headless 0.0.1-alpha.1 → 0.0.1-alpha.3
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.
- package/esm2022/lib/config.mjs +102 -0
- package/esm2022/lib/slot.directive.mjs +5 -5
- package/esm2022/lib/slotDefault.directive.mjs +4 -4
- package/esm2022/lib/slotTypes.mjs +7 -0
- package/esm2022/lib/use.directive.mjs +3 -3
- package/esm2022/lib/utils.mjs +10 -92
- package/esm2022/public-api.mjs +17 -1
- package/fesm2022/agnos-ui-angular-headless.mjs +161 -130
- package/fesm2022/agnos-ui-angular-headless.mjs.map +1 -1
- package/lib/config.d.ts +48 -0
- package/lib/slot.directive.d.ts +1 -1
- package/lib/slotDefault.directive.d.ts +1 -1
- package/lib/slotTypes.d.ts +18 -0
- package/lib/utils.d.ts +12 -91
- package/package.json +3 -3
- package/public-api.d.ts +18 -3
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { createWidgetsConfig } from '@agnos-ui/core';
|
|
1
|
+
import { toReadableStore, createWidgetsConfig, createAccordion as createAccordion$1, createAlert as createAlert$1, createModal as createModal$1, createPagination as createPagination$1, createRating as createRating$1, createSelect as createSelect$1, createProgressbar as createProgressbar$1 } from '@agnos-ui/core';
|
|
2
2
|
export * from '@agnos-ui/core';
|
|
3
3
|
import { DOCUMENT } from '@angular/common';
|
|
4
4
|
import * as i0 from '@angular/core';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { createComponent, EnvironmentInjector, TemplateRef, reflectComponentType, inject, ViewContainerRef, Directive, Input, ElementRef, Injector, runInInjectionContext, SkipSelf, Optional, InjectionToken } from '@angular/core';
|
|
6
|
+
import { writable, computed } from '@amadeus-it-group/tansu';
|
|
7
7
|
|
|
8
8
|
class ComponentTemplate {
|
|
9
9
|
constructor(component, templateProp) {
|
|
@@ -11,123 +11,6 @@ class ComponentTemplate {
|
|
|
11
11
|
this.templateProp = templateProp;
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
|
-
/**
|
|
15
|
-
* Dependency Injection token which can be used to provide or inject the widgets default configuration store.
|
|
16
|
-
*/
|
|
17
|
-
const widgetsConfigInjectionToken = new InjectionToken('widgetsConfig');
|
|
18
|
-
/**
|
|
19
|
-
* Creates a provider of widgets default configuration that inherits from any widgets default configuration already defined at an upper level
|
|
20
|
-
* in the Angular dependency injection system. It contains its own set of widgets configuration properties that override the same properties form
|
|
21
|
-
* the parent configuration.
|
|
22
|
-
*
|
|
23
|
-
* @remarks
|
|
24
|
-
* The configuration is computed from the parent configuration in two steps:
|
|
25
|
-
* - first step: the parent configuration is transformed by the adaptParentConfig function (if specified).
|
|
26
|
-
* If adaptParentConfig is not specified, this step is skipped.
|
|
27
|
-
* - second step: the configuration from step 1 is merged (2-levels deep) with the own$ store. The own$ store initially contains
|
|
28
|
-
* an empty object (i.e. no property from the parent is overridden). It can be changed by calling set on the store returned by
|
|
29
|
-
* {@link injectWidgetsConfig}.
|
|
30
|
-
*
|
|
31
|
-
* @param adaptParentConfig - optional function that receives a 2-levels copy of the widgets default configuration
|
|
32
|
-
* defined at an upper level in the Angular dependency injection system (or an empty object if there is none) and returns the widgets
|
|
33
|
-
* default configuration to be used.
|
|
34
|
-
* It is called only if the configuration is needed, and was not yet computed for the current value of the parent configuration.
|
|
35
|
-
* It is called in a tansu reactive context, so it can use any tansu store and will be called again if those stores change.
|
|
36
|
-
* It is also called in an Angular injection context, so it can call the Angular inject function to get and use dependencies from the
|
|
37
|
-
* Angular dependency injection system.
|
|
38
|
-
|
|
39
|
-
* @returns DI provider to be included a list of `providers` (for example at a component level or
|
|
40
|
-
* any other level of the Angular dependency injection system)
|
|
41
|
-
*
|
|
42
|
-
* @example
|
|
43
|
-
* ```typescript
|
|
44
|
-
* @Component({
|
|
45
|
-
* // ...
|
|
46
|
-
* providers: [
|
|
47
|
-
* provideWidgetsConfig((parentConfig) => {
|
|
48
|
-
* // first step configuration: transforms the parent configuration
|
|
49
|
-
* parentConfig.rating = parentConfig.rating ?? {};
|
|
50
|
-
* parentConfig.rating.className = `${parentConfig.rating.className ?? ''} my-rating-extra-class`
|
|
51
|
-
* return parentConfig;
|
|
52
|
-
* })
|
|
53
|
-
* ]
|
|
54
|
-
* })
|
|
55
|
-
* class MyComponent {
|
|
56
|
-
* widgetsConfig = injectWidgetsConfig();
|
|
57
|
-
* constructor() {
|
|
58
|
-
* this.widgetsConfig.set({
|
|
59
|
-
* // second step configuration: overrides the parent configuration
|
|
60
|
-
* rating: {
|
|
61
|
-
* slotStar: MyCustomSlotStar
|
|
62
|
-
* }
|
|
63
|
-
* });
|
|
64
|
-
* }
|
|
65
|
-
* // ...
|
|
66
|
-
* }
|
|
67
|
-
* ```
|
|
68
|
-
*/
|
|
69
|
-
const provideWidgetsConfig = (adaptParentConfig) => ({
|
|
70
|
-
provide: widgetsConfigInjectionToken,
|
|
71
|
-
useFactory: (parent) => {
|
|
72
|
-
if (adaptParentConfig) {
|
|
73
|
-
const injector = inject(Injector);
|
|
74
|
-
const originalAdaptParentConfig = adaptParentConfig;
|
|
75
|
-
adaptParentConfig = (value) => runInInjectionContext(injector, () => originalAdaptParentConfig(value));
|
|
76
|
-
}
|
|
77
|
-
return createWidgetsConfig(parent ?? undefined, adaptParentConfig);
|
|
78
|
-
},
|
|
79
|
-
deps: [[new SkipSelf(), new Optional(), widgetsConfigInjectionToken]],
|
|
80
|
-
});
|
|
81
|
-
/**
|
|
82
|
-
* Returns the widgets default configuration store that was provided in the current injection context.
|
|
83
|
-
* Throws if the no widgets default configuration store was provided.
|
|
84
|
-
*
|
|
85
|
-
* @remarks
|
|
86
|
-
* This function must be called from an injection context, such as a constructor, a factory function, a field initializer or
|
|
87
|
-
* a function used with {@link https://angular.io/api/core/runInInjectionContext | runInInjectionContext}.
|
|
88
|
-
*
|
|
89
|
-
* @returns the widgets default configuration store.
|
|
90
|
-
*/
|
|
91
|
-
const injectWidgetsConfig = () => inject(widgetsConfigInjectionToken);
|
|
92
|
-
const createPatchSlots = (set) => {
|
|
93
|
-
let lastValue = {};
|
|
94
|
-
return (object) => {
|
|
95
|
-
const newValue = {};
|
|
96
|
-
let hasChange = false;
|
|
97
|
-
for (const key of Object.keys(object)) {
|
|
98
|
-
const objectKey = object[key];
|
|
99
|
-
if (objectKey != null) {
|
|
100
|
-
// only use defined slots
|
|
101
|
-
newValue[key] = objectKey;
|
|
102
|
-
}
|
|
103
|
-
if (objectKey != lastValue[key]) {
|
|
104
|
-
hasChange = true;
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
if (hasChange) {
|
|
108
|
-
lastValue = newValue;
|
|
109
|
-
set(newValue);
|
|
110
|
-
}
|
|
111
|
-
};
|
|
112
|
-
};
|
|
113
|
-
const callWidgetFactory = (factory, widgetName, defaultConfig = {}) => {
|
|
114
|
-
const defaultConfigStore = typeof defaultConfig !== 'function' ? readable(defaultConfig) : defaultConfig;
|
|
115
|
-
const slots$ = writable({});
|
|
116
|
-
const widgetsConfig = widgetName ? inject(widgetsConfigInjectionToken, { optional: true }) : undefined;
|
|
117
|
-
return {
|
|
118
|
-
...factory(computed(() => ({ ...defaultConfigStore(), ...(widgetName ? widgetsConfig?.()[widgetName] : undefined), ...slots$() }))),
|
|
119
|
-
patchSlots: createPatchSlots(slots$.set),
|
|
120
|
-
};
|
|
121
|
-
};
|
|
122
|
-
function patchSimpleChanges(patchFn, changes) {
|
|
123
|
-
const obj = {};
|
|
124
|
-
for (const [key, simpleChange] of Object.entries(changes)) {
|
|
125
|
-
if (simpleChange !== undefined) {
|
|
126
|
-
obj[key] = simpleChange.currentValue;
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
patchFn(obj);
|
|
130
|
-
}
|
|
131
14
|
|
|
132
15
|
class SlotHandler {
|
|
133
16
|
constructor(viewContainerRef, document) {
|
|
@@ -307,10 +190,10 @@ class SlotDirective {
|
|
|
307
190
|
this._slotHandler?.destroy();
|
|
308
191
|
this._slotHandler = undefined;
|
|
309
192
|
}
|
|
310
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.
|
|
311
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.
|
|
193
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.9", ngImport: i0, type: SlotDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
194
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.9", type: SlotDirective, isStandalone: true, selector: "[auSlot]", inputs: { slot: ["auSlot", "slot"], props: ["auSlotProps", "props"] }, usesOnChanges: true, ngImport: i0 }); }
|
|
312
195
|
}
|
|
313
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.
|
|
196
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.9", ngImport: i0, type: SlotDirective, decorators: [{
|
|
314
197
|
type: Directive,
|
|
315
198
|
args: [{
|
|
316
199
|
selector: '[auSlot]',
|
|
@@ -331,10 +214,10 @@ class SlotDefaultDirective {
|
|
|
331
214
|
ngOnInit() {
|
|
332
215
|
this.auSlotDefault.update((value) => ({ ...value, slotDefault: this.templateRef }));
|
|
333
216
|
}
|
|
334
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.
|
|
335
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.
|
|
217
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.9", ngImport: i0, type: SlotDefaultDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
218
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.9", type: SlotDefaultDirective, isStandalone: true, selector: "[auSlotDefault]", inputs: { auSlotDefault: "auSlotDefault" }, ngImport: i0 }); }
|
|
336
219
|
}
|
|
337
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.
|
|
220
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.9", ngImport: i0, type: SlotDefaultDirective, decorators: [{
|
|
338
221
|
type: Directive,
|
|
339
222
|
args: [{ selector: '[auSlotDefault]', standalone: true }]
|
|
340
223
|
}], propDecorators: { auSlotDefault: [{
|
|
@@ -380,10 +263,10 @@ class UseDirective {
|
|
|
380
263
|
this.#destroyDirectiveInstance();
|
|
381
264
|
this.#directive = undefined;
|
|
382
265
|
}
|
|
383
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.
|
|
384
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.
|
|
266
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.9", ngImport: i0, type: UseDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
267
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.9", type: UseDirective, isStandalone: true, selector: "[auUse]", inputs: { use: ["auUse", "use"], params: ["auUseParams", "params"] }, usesOnChanges: true, ngImport: i0 }); }
|
|
385
268
|
}
|
|
386
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.
|
|
269
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.9", ngImport: i0, type: UseDirective, decorators: [{
|
|
387
270
|
type: Directive,
|
|
388
271
|
args: [{
|
|
389
272
|
standalone: true,
|
|
@@ -397,13 +280,161 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.5", ngImpor
|
|
|
397
280
|
args: ['auUseParams']
|
|
398
281
|
}] } });
|
|
399
282
|
|
|
283
|
+
const createPatchSlots = (set) => {
|
|
284
|
+
let lastValue = {};
|
|
285
|
+
return (object) => {
|
|
286
|
+
const newValue = {};
|
|
287
|
+
let hasChange = false;
|
|
288
|
+
for (const key of Object.keys(object)) {
|
|
289
|
+
const objectKey = object[key];
|
|
290
|
+
if (objectKey != null) {
|
|
291
|
+
// only use defined slots
|
|
292
|
+
newValue[key] = objectKey;
|
|
293
|
+
}
|
|
294
|
+
if (objectKey != lastValue[key]) {
|
|
295
|
+
hasChange = true;
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
if (hasChange) {
|
|
299
|
+
lastValue = newValue;
|
|
300
|
+
set(newValue);
|
|
301
|
+
}
|
|
302
|
+
};
|
|
303
|
+
};
|
|
304
|
+
const callWidgetFactoryWithConfig = ({ factory, defaultConfig, widgetConfig, events, }) => {
|
|
305
|
+
const defaultConfig$ = toReadableStore(defaultConfig);
|
|
306
|
+
const slots$ = writable({});
|
|
307
|
+
const widget = factory({
|
|
308
|
+
config: computed(() => ({ ...defaultConfig$(), ...widgetConfig?.(), ...slots$() })),
|
|
309
|
+
});
|
|
310
|
+
widget.patch(events);
|
|
311
|
+
return {
|
|
312
|
+
...widget,
|
|
313
|
+
patchSlots: createPatchSlots(slots$.set),
|
|
314
|
+
};
|
|
315
|
+
};
|
|
316
|
+
function patchSimpleChanges(patchFn, changes) {
|
|
317
|
+
const obj = {};
|
|
318
|
+
for (const [key, simpleChange] of Object.entries(changes)) {
|
|
319
|
+
if (simpleChange !== undefined) {
|
|
320
|
+
obj[key] = simpleChange.currentValue;
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
patchFn(obj);
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
const widgetsConfigFactory = (widgetsConfigInjectionToken = new InjectionToken('widgetsConfig')) => {
|
|
327
|
+
/**
|
|
328
|
+
* Creates a provider of widgets default configuration that inherits from any widgets default configuration already defined at an upper level
|
|
329
|
+
* in the Angular dependency injection system. It contains its own set of widgets configuration properties that override the same properties form
|
|
330
|
+
* the parent configuration.
|
|
331
|
+
*
|
|
332
|
+
* @remarks
|
|
333
|
+
* The configuration is computed from the parent configuration in two steps:
|
|
334
|
+
* - first step: the parent configuration is transformed by the adaptParentConfig function (if specified).
|
|
335
|
+
* If adaptParentConfig is not specified, this step is skipped.
|
|
336
|
+
* - second step: the configuration from step 1 is merged (2-levels deep) with the own$ store. The own$ store initially contains
|
|
337
|
+
* an empty object (i.e. no property from the parent is overridden). It can be changed by calling set on the store returned by
|
|
338
|
+
* {@link injectWidgetsConfig}.
|
|
339
|
+
*
|
|
340
|
+
* @param adaptParentConfig - optional function that receives a 2-levels copy of the widgets default configuration
|
|
341
|
+
* defined at an upper level in the Angular dependency injection system (or an empty object if there is none) and returns the widgets
|
|
342
|
+
* default configuration to be used.
|
|
343
|
+
* It is called only if the configuration is needed, and was not yet computed for the current value of the parent configuration.
|
|
344
|
+
* It is called in a tansu reactive context, so it can use any tansu store and will be called again if those stores change.
|
|
345
|
+
* It is also called in an Angular injection context, so it can call the Angular inject function to get and use dependencies from the
|
|
346
|
+
* Angular dependency injection system.
|
|
347
|
+
|
|
348
|
+
* @returns DI provider to be included a list of `providers` (for example at a component level or
|
|
349
|
+
* any other level of the Angular dependency injection system)
|
|
350
|
+
*
|
|
351
|
+
* @example
|
|
352
|
+
* ```typescript
|
|
353
|
+
* @Component({
|
|
354
|
+
* // ...
|
|
355
|
+
* providers: [
|
|
356
|
+
* provideWidgetsConfig((parentConfig) => {
|
|
357
|
+
* // first step configuration: transforms the parent configuration
|
|
358
|
+
* parentConfig.rating = parentConfig.rating ?? {};
|
|
359
|
+
* parentConfig.rating.className = `${parentConfig.rating.className ?? ''} my-rating-extra-class`
|
|
360
|
+
* return parentConfig;
|
|
361
|
+
* })
|
|
362
|
+
* ]
|
|
363
|
+
* })
|
|
364
|
+
* class MyComponent {
|
|
365
|
+
* widgetsConfig = injectWidgetsConfig();
|
|
366
|
+
* constructor() {
|
|
367
|
+
* this.widgetsConfig.set({
|
|
368
|
+
* // second step configuration: overrides the parent configuration
|
|
369
|
+
* rating: {
|
|
370
|
+
* slotStar: MyCustomSlotStar
|
|
371
|
+
* }
|
|
372
|
+
* });
|
|
373
|
+
* }
|
|
374
|
+
* // ...
|
|
375
|
+
* }
|
|
376
|
+
* ```
|
|
377
|
+
*/
|
|
378
|
+
const provideWidgetsConfig = (adaptParentConfig) => ({
|
|
379
|
+
provide: widgetsConfigInjectionToken,
|
|
380
|
+
useFactory: (parent) => {
|
|
381
|
+
if (adaptParentConfig) {
|
|
382
|
+
const injector = inject(Injector);
|
|
383
|
+
const originalAdaptParentConfig = adaptParentConfig;
|
|
384
|
+
adaptParentConfig = (value) => runInInjectionContext(injector, () => originalAdaptParentConfig(value));
|
|
385
|
+
}
|
|
386
|
+
return createWidgetsConfig(parent ?? undefined, adaptParentConfig);
|
|
387
|
+
},
|
|
388
|
+
deps: [[new SkipSelf(), new Optional(), widgetsConfigInjectionToken]],
|
|
389
|
+
});
|
|
390
|
+
/**
|
|
391
|
+
* Returns the widgets default configuration store that was provided in the current injection context.
|
|
392
|
+
* Throws if the no widgets default configuration store was provided.
|
|
393
|
+
*
|
|
394
|
+
* @remarks
|
|
395
|
+
* This function must be called from an injection context, such as a constructor, a factory function, a field initializer or
|
|
396
|
+
* a function used with {@link https://angular.io/api/core/runInInjectionContext | runInInjectionContext}.
|
|
397
|
+
*
|
|
398
|
+
* @returns the widgets default configuration store.
|
|
399
|
+
*/
|
|
400
|
+
const injectWidgetsConfig = () => inject(widgetsConfigInjectionToken);
|
|
401
|
+
const injectWidgetConfig = (widgetName) => {
|
|
402
|
+
const widgetsConfig = inject(widgetsConfigInjectionToken, { optional: true });
|
|
403
|
+
return computed(() => widgetsConfig?.()[widgetName]);
|
|
404
|
+
};
|
|
405
|
+
const callWidgetFactory = ({ factory, widgetName = null, defaultConfig = {}, events, }) => callWidgetFactoryWithConfig({
|
|
406
|
+
factory,
|
|
407
|
+
widgetConfig: widgetName ? injectWidgetConfig(widgetName) : null,
|
|
408
|
+
defaultConfig,
|
|
409
|
+
events,
|
|
410
|
+
});
|
|
411
|
+
return {
|
|
412
|
+
/**
|
|
413
|
+
* Dependency Injection token which can be used to provide or inject the widgets default configuration store.
|
|
414
|
+
*/
|
|
415
|
+
widgetsConfigInjectionToken,
|
|
416
|
+
provideWidgetsConfig,
|
|
417
|
+
injectWidgetsConfig,
|
|
418
|
+
injectWidgetConfig,
|
|
419
|
+
callWidgetFactory,
|
|
420
|
+
};
|
|
421
|
+
};
|
|
422
|
+
const { widgetsConfigInjectionToken, provideWidgetsConfig, injectWidgetConfig, injectWidgetsConfig, callWidgetFactory } = widgetsConfigFactory();
|
|
423
|
+
|
|
400
424
|
/*
|
|
401
425
|
* Public API Surface of @agnos-ui/angular-headless
|
|
402
426
|
*/
|
|
427
|
+
const createAccordion = createAccordion$1;
|
|
428
|
+
const createAlert = createAlert$1;
|
|
429
|
+
const createModal = createModal$1;
|
|
430
|
+
const createPagination = createPagination$1;
|
|
431
|
+
const createRating = createRating$1;
|
|
432
|
+
const createSelect = createSelect$1;
|
|
433
|
+
const createProgressbar = createProgressbar$1;
|
|
403
434
|
|
|
404
435
|
/**
|
|
405
436
|
* Generated bundle index. Do not edit.
|
|
406
437
|
*/
|
|
407
438
|
|
|
408
|
-
export { ComponentTemplate, SlotDefaultDirective, SlotDirective, UseDirective, callWidgetFactory, injectWidgetsConfig, patchSimpleChanges, provideWidgetsConfig, widgetsConfigInjectionToken };
|
|
439
|
+
export { ComponentTemplate, SlotDefaultDirective, SlotDirective, UseDirective, callWidgetFactory, callWidgetFactoryWithConfig, createAccordion, createAlert, createModal, createPagination, createProgressbar, createRating, createSelect, injectWidgetConfig, injectWidgetsConfig, patchSimpleChanges, provideWidgetsConfig, widgetsConfigFactory, widgetsConfigInjectionToken };
|
|
409
440
|
//# sourceMappingURL=agnos-ui-angular-headless.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agnos-ui-angular-headless.mjs","sources":["../../../headless/src/lib/utils.ts","../../../headless/src/lib/slot.directive.ts","../../../headless/src/lib/slotDefault.directive.ts","../../../headless/src/lib/use.directive.ts","../../../headless/src/public-api.ts","../../../headless/src/agnos-ui-angular-headless.ts"],"sourcesContent":["import type {\n\tSlotContent as CoreSlotContent,\n\tWidgetsConfig as CoreWidgetsConfig,\n\tPartial2Levels,\n\tWidget,\n\tWidgetFactory,\n\tWidgetProps,\n\tWidgetSlotContext,\n\tWidgetState,\n\tWidgetsConfigStore,\n} from '@agnos-ui/core';\nimport {createWidgetsConfig} from '@agnos-ui/core';\nimport type {ReadableSignal, SubscribableStore} from '@amadeus-it-group/tansu';\nimport {computed, readable, writable} from '@amadeus-it-group/tansu';\nimport type {FactoryProvider, SimpleChanges, TemplateRef, Type} from '@angular/core';\nimport {InjectionToken, Injector, Optional, SkipSelf, inject, runInInjectionContext} from '@angular/core';\n\nexport class ComponentTemplate<Props, K extends string, T extends {[key in K]: TemplateRef<Props>}> {\n\tconstructor(public readonly component: Type<T>, public readonly templateProp: K) {}\n}\n\nexport type SlotContent<Props extends object = object> =\n\t| CoreSlotContent<Props>\n\t| TemplateRef<Props>\n\t| Type<unknown>\n\t| ComponentTemplate<Props, any, any>;\n\nexport type AdaptSlotContentProps<Props extends Record<string, any>> = Props extends WidgetSlotContext<infer U>\n\t? WidgetSlotContext<AdaptWidgetSlots<U>> & AdaptPropsSlots<Omit<Props, keyof WidgetSlotContext<any>>>\n\t: AdaptPropsSlots<Props>;\n\nexport type AdaptPropsSlots<Props> = Omit<Props, `slot${string}`> & {\n\t[K in keyof Props & `slot${string}`]: Props[K] extends CoreSlotContent<infer U> ? SlotContent<AdaptSlotContentProps<U>> : Props[K];\n};\n\nexport type AdaptWidgetSlots<W extends Widget> = Widget<\n\tAdaptPropsSlots<WidgetProps<W>>,\n\tAdaptPropsSlots<WidgetState<W>>,\n\tW['api'],\n\tW['actions'],\n\tW['directives']\n>;\n\nexport type WidgetsConfig = {\n\t[WidgetName in keyof CoreWidgetsConfig]: AdaptPropsSlots<CoreWidgetsConfig[WidgetName]>;\n};\n\n/**\n * Dependency Injection token which can be used to provide or inject the widgets default configuration store.\n */\nexport const widgetsConfigInjectionToken = new InjectionToken<WidgetsConfigStore<WidgetsConfig>>('widgetsConfig');\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 */\nexport const provideWidgetsConfig = (\n\tadaptParentConfig?: (config: Partial2Levels<WidgetsConfig>) => Partial2Levels<WidgetsConfig>\n): FactoryProvider => ({\n\tprovide: widgetsConfigInjectionToken,\n\tuseFactory: (parent: WidgetsConfigStore<WidgetsConfig> | null) => {\n\t\tif (adaptParentConfig) {\n\t\t\tconst injector = inject(Injector);\n\t\t\tconst originalAdaptParentConfig = adaptParentConfig;\n\t\t\tadaptParentConfig = (value) => runInInjectionContext(injector, () => originalAdaptParentConfig(value));\n\t\t}\n\t\treturn createWidgetsConfig(parent ?? undefined, adaptParentConfig);\n\t},\n\tdeps: [[new SkipSelf(), new Optional(), widgetsConfigInjectionToken]],\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 * @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 */\nexport const injectWidgetsConfig = () => inject(widgetsConfigInjectionToken);\n\nconst createPatchSlots = <T extends object>(set: (object: Partial<T>) => void) => {\n\tlet lastValue: Partial<T> = {};\n\treturn (object: T) => {\n\t\tconst newValue: Partial<T> = {};\n\t\tlet hasChange = false;\n\t\tfor (const key of Object.keys(object) as (string & keyof T)[]) {\n\t\t\tconst objectKey = (object as any)[key];\n\t\t\tif (objectKey != null) {\n\t\t\t\t// only use defined slots\n\t\t\t\tnewValue[key] = objectKey;\n\t\t\t}\n\t\t\tif (objectKey != lastValue[key]) {\n\t\t\t\thasChange = true;\n\t\t\t}\n\t\t}\n\t\tif (hasChange) {\n\t\t\tlastValue = newValue;\n\t\t\tset(newValue);\n\t\t}\n\t};\n};\n\nexport type WithPatchSlots<W extends Widget> = AdaptWidgetSlots<W> & {\n\tpatchSlots(slots: {\n\t\t[K in keyof WidgetProps<W> & `slot${string}`]: WidgetProps<W>[K] extends CoreSlotContent<infer U>\n\t\t\t? TemplateRef<AdaptSlotContentProps<U>> | undefined\n\t\t\t: never;\n\t}): void;\n};\n\nexport const callWidgetFactory = <W extends Widget>(\n\tfactory: WidgetFactory<W>,\n\twidgetName: keyof WidgetsConfig | null,\n\tdefaultConfig: Partial<AdaptPropsSlots<WidgetProps<W>>> | ReadableSignal<Partial<AdaptPropsSlots<WidgetProps<W>>>> = {}\n): WithPatchSlots<W> => {\n\tconst defaultConfigStore = typeof defaultConfig !== 'function' ? readable(defaultConfig) : defaultConfig;\n\tconst slots$ = writable({});\n\tconst widgetsConfig = widgetName ? inject(widgetsConfigInjectionToken, {optional: true}) : undefined;\n\treturn {\n\t\t...(factory(\n\t\t\tcomputed(() => ({...(defaultConfigStore() as any), ...(widgetName ? widgetsConfig?.()[widgetName] : undefined), ...slots$()}))\n\t\t) as any),\n\t\tpatchSlots: createPatchSlots(slots$.set),\n\t};\n};\n\nexport function patchSimpleChanges(patchFn: (obj: any) => void, changes: SimpleChanges) {\n\tconst obj: any = {};\n\tfor (const [key, simpleChange] of Object.entries(changes)) {\n\t\tif (simpleChange !== undefined) {\n\t\t\tobj[key] = simpleChange.currentValue;\n\t\t}\n\t}\n\tpatchFn(obj);\n}\n\nexport type ExtractStoreType<T> = T extends SubscribableStore<infer U> ? U : never;\n","import {DOCUMENT} from '@angular/common';\nimport type {ComponentRef, EmbeddedViewRef, OnChanges, OnDestroy, SimpleChanges, Type} from '@angular/core';\nimport {Directive, EnvironmentInjector, Input, TemplateRef, ViewContainerRef, createComponent, inject, reflectComponentType} from '@angular/core';\nimport type {SlotContent} from './utils';\nimport {ComponentTemplate} from './utils';\n\nabstract class SlotHandler<Props extends Record<string, any>, Slot extends SlotContent<Props> = SlotContent<Props>> {\n\tconstructor(public viewContainerRef: ViewContainerRef, public document: Document) {}\n\tslotChange(slot: Slot, props: Props) {}\n\tpropsChange(slot: Slot, props: Props) {}\n\tdestroy() {}\n}\n\nclass StringSlotHandler<Props extends Record<string, any>> extends SlotHandler<Props, string> {\n\t#nodeRef: Text | undefined;\n\t#previousText = '';\n\n\toverride slotChange(slot: string): void {\n\t\tif (slot === this.#previousText) {\n\t\t\treturn;\n\t\t}\n\t\tthis.#previousText = slot;\n\t\tif (this.#nodeRef) {\n\t\t\tthis.#nodeRef.textContent = slot;\n\t\t} else {\n\t\t\tconst viewContainerElement: Comment | undefined = this.viewContainerRef.element.nativeElement;\n\t\t\tif (this.document && viewContainerElement?.parentNode) {\n\t\t\t\tthis.#nodeRef = viewContainerElement.parentNode.insertBefore(this.document.createTextNode(slot), viewContainerElement);\n\t\t\t}\n\t\t}\n\t}\n\n\toverride destroy(): void {\n\t\tthis.#nodeRef?.parentNode?.removeChild(this.#nodeRef);\n\t\tthis.#nodeRef = undefined;\n\t}\n}\n\nclass FunctionSlotHandler<Props extends Record<string, any>> extends SlotHandler<Props, (props: Props) => string> {\n\t#stringSlotHandler = new StringSlotHandler(this.viewContainerRef, this.document);\n\n\toverride slotChange(slot: (props: Props) => string, props: Props): void {\n\t\tthis.#stringSlotHandler.slotChange(slot(props));\n\t}\n\n\toverride propsChange(slot: (props: Props) => string, props: Props): void {\n\t\tthis.#stringSlotHandler.slotChange(slot(props));\n\t}\n\n\toverride destroy(): void {\n\t\tthis.#stringSlotHandler.destroy();\n\t}\n}\n\nclass ComponentSlotHandler<Props extends Record<string, any>> extends SlotHandler<Props, Type<unknown>> {\n\t#componentRef: ComponentRef<any> | undefined;\n\t#properties: string[];\n\n\toverride slotChange(slot: Type<unknown>, props: Props): void {\n\t\tif (this.#componentRef) {\n\t\t\tthis.destroy();\n\t\t}\n\t\tthis.#componentRef = this.viewContainerRef.createComponent(slot);\n\t\tthis.#applyProperties(props);\n\t}\n\n\t#applyProperties(props: Props, oldProperties?: Set<string>) {\n\t\tconst properties = Object.keys(props);\n\t\tthis.#properties = properties;\n\t\tconst componentRef = this.#componentRef!;\n\t\tfor (const property of properties) {\n\t\t\tcomponentRef.setInput(property, props[property]);\n\t\t\toldProperties?.delete(property);\n\t\t}\n\t}\n\n\toverride propsChange(slot: Type<unknown>, props: Props): void {\n\t\tconst oldProperties = new Set(this.#properties);\n\t\tthis.#applyProperties(props, oldProperties);\n\t\tconst componentRef = this.#componentRef!;\n\t\tfor (const property of oldProperties) {\n\t\t\tcomponentRef.setInput(property, undefined);\n\t\t}\n\t}\n\n\toverride destroy(): void {\n\t\tthis.viewContainerRef.clear();\n\t\tthis.#componentRef = undefined;\n\t}\n}\n\nclass TemplateRefSlotHandler<Props extends Record<string, any>> extends SlotHandler<Props, TemplateRef<Props>> {\n\t#viewRef: EmbeddedViewRef<Props> | undefined;\n\t#props: Props;\n\n\toverride slotChange(slot: TemplateRef<Props>, props: Props): void {\n\t\tif (this.#viewRef) {\n\t\t\tthis.destroy();\n\t\t}\n\t\tprops = {...props};\n\t\tthis.#props = props;\n\t\tthis.#viewRef = this.viewContainerRef.createEmbeddedView(slot, props);\n\t}\n\n\toverride propsChange(slot: TemplateRef<Props>, props: Props): void {\n\t\tif (this.#viewRef) {\n\t\t\tconst templateProps = this.#props;\n\t\t\tconst oldProperties = new Set<keyof Props>(Object.keys(templateProps));\n\t\t\tfor (const property of Object.keys(props) as (keyof Props)[]) {\n\t\t\t\ttemplateProps[property] = props[property];\n\t\t\t\toldProperties.delete(property);\n\t\t\t}\n\t\t\tfor (const oldProperty of oldProperties) {\n\t\t\t\tdelete templateProps[oldProperty];\n\t\t\t}\n\t\t\tthis.#viewRef.markForCheck();\n\t\t}\n\t}\n\n\toverride destroy(): void {\n\t\tthis.viewContainerRef.clear();\n\t}\n}\n\nclass ComponentTemplateSlotHandler<\n\tProps extends Record<string, any>,\n\tK extends string,\n\tT extends {[key in K]: TemplateRef<Props>}\n> extends SlotHandler<Props, ComponentTemplate<Props, K, T>> {\n\t#componentRef: ComponentRef<T> | undefined;\n\t#templateSlotHandler = new TemplateRefSlotHandler(this.viewContainerRef, this.document);\n\t#templateRef: TemplateRef<Props> | undefined;\n\n\toverride slotChange(slot: ComponentTemplate<Props, K, T>, props: Props): void {\n\t\tif (this.#componentRef) {\n\t\t\tthis.destroy();\n\t\t}\n\t\tthis.#componentRef = createComponent(slot.component, {\n\t\t\telementInjector: this.viewContainerRef.injector,\n\t\t\tenvironmentInjector: this.viewContainerRef.injector.get(EnvironmentInjector),\n\t\t});\n\t\tthis.#templateRef = this.#componentRef.instance[slot.templateProp];\n\t\tthis.#templateSlotHandler.slotChange(this.#templateRef, props);\n\t}\n\n\toverride propsChange(slot: ComponentTemplate<Props, K, T>, props: Props): void {\n\t\tthis.#templateSlotHandler.propsChange(this.#templateRef!, props);\n\t}\n\n\toverride destroy(): void {\n\t\tthis.#templateSlotHandler.destroy();\n\t\tthis.#componentRef?.destroy();\n\t\tthis.#componentRef = undefined;\n\t}\n}\n\nconst getSlotType = (value: any): undefined | {new (viewContainerRef: ViewContainerRef, document: Document): SlotHandler<any>} => {\n\tif (!value) return undefined;\n\tconst type = typeof value;\n\tswitch (type) {\n\t\tcase 'string':\n\t\t\treturn StringSlotHandler;\n\t\tcase 'function':\n\t\t\tif (reflectComponentType(value)) {\n\t\t\t\treturn ComponentSlotHandler;\n\t\t\t}\n\t\t\treturn FunctionSlotHandler;\n\t\tcase 'object':\n\t\t\tif (value instanceof TemplateRef) {\n\t\t\t\treturn TemplateRefSlotHandler;\n\t\t\t}\n\t\t\tif (value instanceof ComponentTemplate) {\n\t\t\t\treturn ComponentTemplateSlotHandler;\n\t\t\t}\n\t\t\tbreak;\n\t}\n\treturn undefined;\n};\n\n@Directive({\n\tselector: '[auSlot]',\n\tstandalone: true,\n})\nexport class SlotDirective<Props extends Record<string, any>> implements OnChanges, OnDestroy {\n\t@Input('auSlot') slot: SlotContent<Props>;\n\t@Input('auSlotProps') props: Props;\n\n\tprivate _viewContainerRef = inject(ViewContainerRef);\n\tprivate _document = inject(DOCUMENT);\n\tprivate _slotType: ReturnType<typeof getSlotType>;\n\tprivate _slotHandler: SlotHandler<Props> | undefined;\n\n\tngOnChanges(changes: SimpleChanges): void {\n\t\tconst slotChange = changes['slot'];\n\t\tconst propsChange = changes['props'];\n\t\tconst slot = this.slot;\n\t\tif (slotChange) {\n\t\t\tconst newSlotType = getSlotType(slot);\n\t\t\tif (newSlotType !== this._slotType) {\n\t\t\t\tthis._slotHandler?.destroy();\n\t\t\t\tthis._slotHandler = newSlotType ? new newSlotType(this._viewContainerRef, this._document) : undefined;\n\t\t\t\tthis._slotType = newSlotType;\n\t\t\t}\n\t\t\tthis._slotHandler?.slotChange(slot, this.props);\n\t\t} else if (propsChange) {\n\t\t\tthis._slotHandler?.propsChange(slot, this.props);\n\t\t}\n\t}\n\n\tngOnDestroy(): void {\n\t\tthis._slotHandler?.destroy();\n\t\tthis._slotHandler = undefined;\n\t}\n}\n","import type {WritableSignal} from '@amadeus-it-group/tansu';\nimport type {OnInit} from '@angular/core';\nimport {Directive, Input, TemplateRef, inject} from '@angular/core';\nimport type {SlotContent} from './utils';\n\n@Directive({selector: '[auSlotDefault]', standalone: true})\nexport class SlotDefaultDirective<T extends object> implements OnInit {\n\t@Input('auSlotDefault') auSlotDefault: WritableSignal<{slotDefault?: SlotContent<T>}>;\n\n\ttemplateRef = inject(TemplateRef<T>);\n\n\tngOnInit(): void {\n\t\tthis.auSlotDefault.update((value) => ({...value, slotDefault: this.templateRef}));\n\t}\n}\n","import type {OnChanges, OnDestroy, SimpleChanges} from '@angular/core';\nimport {Directive, ElementRef, inject, Input} from '@angular/core';\nimport type {Directive as AgnosUIDirective} from '@agnos-ui/core';\n\n// All calls of the directive in this class are done asynchronously (with await 0)\n// in order to avoid ExpressionChangedAfterItHasBeenCheckedError\n// or the corresponding issue with signals (https://github.com/angular/angular/issues/50320)\n// This is relevant especially if calling the directive changes variables used in a template.\n\n@Directive({\n\tstandalone: true,\n\tselector: '[auUse]',\n})\nexport class UseDirective<T> implements OnChanges, OnDestroy {\n\t@Input('auUse')\n\tuse: AgnosUIDirective<T> | undefined;\n\n\t@Input('auUseParams')\n\tparams: T | undefined;\n\n\t#ref = inject(ElementRef);\n\n\t#directive: AgnosUIDirective<T> | undefined;\n\t#directiveInstance?: ReturnType<AgnosUIDirective<T>>;\n\n\tasync #destroyDirectiveInstance() {\n\t\tconst directiveInstance = this.#directiveInstance;\n\t\tthis.#directiveInstance = undefined;\n\t\tif (directiveInstance?.destroy) {\n\t\t\tawait 0;\n\t\t\tdirectiveInstance.destroy?.();\n\t\t}\n\t}\n\n\tasync ngOnChanges(changes: SimpleChanges): Promise<void> {\n\t\tif (this.use !== this.#directive) {\n\t\t\tthis.#destroyDirectiveInstance();\n\t\t\tconst directive = this.use;\n\t\t\tthis.#directive = directive;\n\t\t\tif (directive) {\n\t\t\t\tawait 0;\n\t\t\t\t// checks that the directive did not change while waiting:\n\t\t\t\tif (directive === this.#directive && !this.#directiveInstance) {\n\t\t\t\t\tthis.#directiveInstance = directive(this.#ref.nativeElement, this.params as T);\n\t\t\t\t}\n\t\t\t}\n\t\t} else if (changes['params']) {\n\t\t\tawait 0;\n\t\t\tthis.#directiveInstance?.update?.(this.params as T);\n\t\t}\n\t}\n\n\tngOnDestroy(): void {\n\t\tthis.#destroyDirectiveInstance();\n\t\tthis.#directive = undefined;\n\t}\n}\n","/*\n * Public API Surface of @agnos-ui/angular-headless\n */\n\nexport * from '@agnos-ui/core';\n\nexport * from './lib/slot.directive';\nexport * from './lib/slotDefault.directive';\nexport * from './lib/use.directive';\nexport * from './lib/utils';\nexport type {SlotContent, WidgetsConfig} from './lib/utils';\nimport type {WidgetProps, WidgetState} from '@agnos-ui/core';\nimport type {AdaptSlotContentProps, AdaptWidgetSlots} from './lib/utils';\n\nexport type AccordionWidget = AdaptWidgetSlots<import('@agnos-ui/core').AccordionWidget>;\nexport type AccordionProps = WidgetProps<AccordionWidget>;\nexport type AccordionState = WidgetState<AccordionWidget>;\nexport type AccordionItemWidget = AdaptWidgetSlots<import('@agnos-ui/core').AccordionItemWidget>;\nexport type AccordionItemProps = WidgetProps<AccordionItemWidget>;\nexport type AccordionItemState = WidgetState<AccordionItemWidget>;\nexport type AccordionItemContext = AdaptSlotContentProps<import('@agnos-ui/core').AccordionItemContext>;\n\nexport type AlertWidget = AdaptWidgetSlots<import('@agnos-ui/core').AlertWidget>;\nexport type AlertProps = WidgetProps<AlertWidget>;\nexport type AlertState = WidgetState<AlertWidget>;\nexport type AlertContext = AdaptSlotContentProps<import('@agnos-ui/core').AlertContext>;\n\nexport type ModalWidget = AdaptWidgetSlots<import('@agnos-ui/core').ModalWidget>;\nexport type ModalProps = WidgetProps<ModalWidget>;\nexport type ModalState = WidgetState<ModalWidget>;\nexport type ModalContext = AdaptSlotContentProps<import('@agnos-ui/core').ModalContext>;\n\nexport type PaginationWidget = AdaptWidgetSlots<import('@agnos-ui/core').PaginationWidget>;\nexport type PaginationProps = WidgetProps<PaginationWidget>;\nexport type PaginationState = WidgetState<PaginationWidget>;\nexport type PaginationContext = AdaptSlotContentProps<import('@agnos-ui/core').PaginationContext>;\nexport type PaginationNumberContext = AdaptSlotContentProps<import('@agnos-ui/core').PaginationNumberContext>;\n\nexport type RatingWidget = AdaptWidgetSlots<import('@agnos-ui/core').RatingWidget>;\nexport type RatingProps = WidgetProps<RatingWidget>;\nexport type RatingState = WidgetState<RatingWidget>;\n\nexport type SelectWidget<Item> = AdaptWidgetSlots<import('@agnos-ui/core').SelectWidget<Item>>;\nexport type SelectProps<Item> = WidgetProps<SelectWidget<Item>>;\nexport type SelectState<Item> = WidgetState<SelectWidget<Item>>;\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;MAiBa,iBAAiB,CAAA;IAC7B,WAA4B,CAAA,SAAkB,EAAkB,YAAe,EAAA;QAAnD,IAAS,CAAA,SAAA,GAAT,SAAS,CAAS;QAAkB,IAAY,CAAA,YAAA,GAAZ,YAAY,CAAG;KAAI;AACnF,CAAA;AA4BD;;AAEG;MACU,2BAA2B,GAAG,IAAI,cAAc,CAAoC,eAAe,EAAE;AAElH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkDG;MACU,oBAAoB,GAAG,CACnC,iBAA4F,MACtE;AACtB,IAAA,OAAO,EAAE,2BAA2B;A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AAA,EAAA,EAAA,EAAA,CAAA,CAAA,EAAA;;2FAAZ,YAAY,EAAA,UAAA,EAAA,CAAA;kBAJxB,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE,IAAI;AAChB,oBAAA,QAAQ,EAAE,SAAS;AACnB,iBAAA,CAAA;8BAGA,GAAG,EAAA,CAAA;sBADF,KAAK;uBAAC,OAAO,CAAA;gBAId,MAAM,EAAA,CAAA;sBADL,KAAK;uBAAC,aAAa,CAAA;;;ACjBrB;;AAEG;;ACFH;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"agnos-ui-angular-headless.mjs","sources":["../../../headless/src/lib/slotTypes.ts","../../../headless/src/lib/slot.directive.ts","../../../headless/src/lib/slotDefault.directive.ts","../../../headless/src/lib/use.directive.ts","../../../headless/src/lib/utils.ts","../../../headless/src/lib/config.ts","../../../headless/src/public-api.ts","../../../headless/src/agnos-ui-angular-headless.ts"],"sourcesContent":["import type {SlotContent as CoreSlotContent, Widget, WidgetFactory, WidgetProps, WidgetSlotContext, WidgetState} from '@agnos-ui/core';\nimport type {TemplateRef, Type} from '@angular/core';\n\nexport class ComponentTemplate<Props, K extends string, T extends {[key in K]: TemplateRef<Props>}> {\n\tconstructor(public readonly component: Type<T>, public readonly templateProp: K) {}\n}\n\nexport type SlotContent<Props extends object = object> =\n\t| CoreSlotContent<Props>\n\t| TemplateRef<Props>\n\t| Type<unknown>\n\t| ComponentTemplate<Props, any, any>;\n\nexport type AdaptSlotContentProps<Props extends Record<string, any>> = Props extends WidgetSlotContext<infer U>\n\t? WidgetSlotContext<AdaptWidgetSlots<U>> & AdaptPropsSlots<Omit<Props, keyof WidgetSlotContext<any>>>\n\t: AdaptPropsSlots<Props>;\n\nexport type AdaptPropsSlots<Props> = Omit<Props, `slot${string}`> & {\n\t[K in keyof Props & `slot${string}`]: Props[K] extends CoreSlotContent<infer U> ? SlotContent<AdaptSlotContentProps<U>> : Props[K];\n};\n\nexport type AdaptWidgetFactories<T> = {\n\t[K in keyof T]: T[K] extends WidgetFactory<infer U> ? WidgetFactory<AdaptWidgetSlots<U>> : T[K];\n};\n\nexport type AdaptWidgetSlots<W extends Widget> = Widget<\n\tAdaptPropsSlots<WidgetProps<W>>,\n\tAdaptPropsSlots<WidgetState<W>>,\n\tAdaptWidgetFactories<W['api']>,\n\tW['actions'],\n\tW['directives']\n>;\n","import {DOCUMENT} from '@angular/common';\nimport type {ComponentRef, EmbeddedViewRef, OnChanges, OnDestroy, SimpleChanges, Type} from '@angular/core';\nimport {Directive, EnvironmentInjector, Input, TemplateRef, ViewContainerRef, createComponent, inject, reflectComponentType} from '@angular/core';\nimport type {SlotContent} from './slotTypes';\nimport {ComponentTemplate} from './slotTypes';\n\nabstract class SlotHandler<Props extends Record<string, any>, Slot extends SlotContent<Props> = SlotContent<Props>> {\n\tconstructor(public viewContainerRef: ViewContainerRef, public document: Document) {}\n\tslotChange(slot: Slot, props: Props) {}\n\tpropsChange(slot: Slot, props: Props) {}\n\tdestroy() {}\n}\n\nclass StringSlotHandler<Props extends Record<string, any>> extends SlotHandler<Props, string> {\n\t#nodeRef: Text | undefined;\n\t#previousText = '';\n\n\toverride slotChange(slot: string): void {\n\t\tif (slot === this.#previousText) {\n\t\t\treturn;\n\t\t}\n\t\tthis.#previousText = slot;\n\t\tif (this.#nodeRef) {\n\t\t\tthis.#nodeRef.textContent = slot;\n\t\t} else {\n\t\t\tconst viewContainerElement: Comment | undefined = this.viewContainerRef.element.nativeElement;\n\t\t\tif (this.document && viewContainerElement?.parentNode) {\n\t\t\t\tthis.#nodeRef = viewContainerElement.parentNode.insertBefore(this.document.createTextNode(slot), viewContainerElement);\n\t\t\t}\n\t\t}\n\t}\n\n\toverride destroy(): void {\n\t\tthis.#nodeRef?.parentNode?.removeChild(this.#nodeRef);\n\t\tthis.#nodeRef = undefined;\n\t}\n}\n\nclass FunctionSlotHandler<Props extends Record<string, any>> extends SlotHandler<Props, (props: Props) => string> {\n\t#stringSlotHandler = new StringSlotHandler(this.viewContainerRef, this.document);\n\n\toverride slotChange(slot: (props: Props) => string, props: Props): void {\n\t\tthis.#stringSlotHandler.slotChange(slot(props));\n\t}\n\n\toverride propsChange(slot: (props: Props) => string, props: Props): void {\n\t\tthis.#stringSlotHandler.slotChange(slot(props));\n\t}\n\n\toverride destroy(): void {\n\t\tthis.#stringSlotHandler.destroy();\n\t}\n}\n\nclass ComponentSlotHandler<Props extends Record<string, any>> extends SlotHandler<Props, Type<unknown>> {\n\t#componentRef: ComponentRef<any> | undefined;\n\t#properties: string[];\n\n\toverride slotChange(slot: Type<unknown>, props: Props): void {\n\t\tif (this.#componentRef) {\n\t\t\tthis.destroy();\n\t\t}\n\t\tthis.#componentRef = this.viewContainerRef.createComponent(slot);\n\t\tthis.#applyProperties(props);\n\t}\n\n\t#applyProperties(props: Props, oldProperties?: Set<string>) {\n\t\tconst properties = Object.keys(props);\n\t\tthis.#properties = properties;\n\t\tconst componentRef = this.#componentRef!;\n\t\tfor (const property of properties) {\n\t\t\tcomponentRef.setInput(property, props[property]);\n\t\t\toldProperties?.delete(property);\n\t\t}\n\t}\n\n\toverride propsChange(slot: Type<unknown>, props: Props): void {\n\t\tconst oldProperties = new Set(this.#properties);\n\t\tthis.#applyProperties(props, oldProperties);\n\t\tconst componentRef = this.#componentRef!;\n\t\tfor (const property of oldProperties) {\n\t\t\tcomponentRef.setInput(property, undefined);\n\t\t}\n\t}\n\n\toverride destroy(): void {\n\t\tthis.viewContainerRef.clear();\n\t\tthis.#componentRef = undefined;\n\t}\n}\n\nclass TemplateRefSlotHandler<Props extends Record<string, any>> extends SlotHandler<Props, TemplateRef<Props>> {\n\t#viewRef: EmbeddedViewRef<Props> | undefined;\n\t#props: Props;\n\n\toverride slotChange(slot: TemplateRef<Props>, props: Props): void {\n\t\tif (this.#viewRef) {\n\t\t\tthis.destroy();\n\t\t}\n\t\tprops = {...props};\n\t\tthis.#props = props;\n\t\tthis.#viewRef = this.viewContainerRef.createEmbeddedView(slot, props);\n\t}\n\n\toverride propsChange(slot: TemplateRef<Props>, props: Props): void {\n\t\tif (this.#viewRef) {\n\t\t\tconst templateProps = this.#props;\n\t\t\tconst oldProperties = new Set<keyof Props>(Object.keys(templateProps));\n\t\t\tfor (const property of Object.keys(props) as (keyof Props)[]) {\n\t\t\t\ttemplateProps[property] = props[property];\n\t\t\t\toldProperties.delete(property);\n\t\t\t}\n\t\t\tfor (const oldProperty of oldProperties) {\n\t\t\t\tdelete templateProps[oldProperty];\n\t\t\t}\n\t\t\tthis.#viewRef.markForCheck();\n\t\t}\n\t}\n\n\toverride destroy(): void {\n\t\tthis.viewContainerRef.clear();\n\t}\n}\n\nclass ComponentTemplateSlotHandler<\n\tProps extends Record<string, any>,\n\tK extends string,\n\tT extends {[key in K]: TemplateRef<Props>}\n> extends SlotHandler<Props, ComponentTemplate<Props, K, T>> {\n\t#componentRef: ComponentRef<T> | undefined;\n\t#templateSlotHandler = new TemplateRefSlotHandler(this.viewContainerRef, this.document);\n\t#templateRef: TemplateRef<Props> | undefined;\n\n\toverride slotChange(slot: ComponentTemplate<Props, K, T>, props: Props): void {\n\t\tif (this.#componentRef) {\n\t\t\tthis.destroy();\n\t\t}\n\t\tthis.#componentRef = createComponent(slot.component, {\n\t\t\telementInjector: this.viewContainerRef.injector,\n\t\t\tenvironmentInjector: this.viewContainerRef.injector.get(EnvironmentInjector),\n\t\t});\n\t\tthis.#templateRef = this.#componentRef.instance[slot.templateProp];\n\t\tthis.#templateSlotHandler.slotChange(this.#templateRef, props);\n\t}\n\n\toverride propsChange(slot: ComponentTemplate<Props, K, T>, props: Props): void {\n\t\tthis.#templateSlotHandler.propsChange(this.#templateRef!, props);\n\t}\n\n\toverride destroy(): void {\n\t\tthis.#templateSlotHandler.destroy();\n\t\tthis.#componentRef?.destroy();\n\t\tthis.#componentRef = undefined;\n\t}\n}\n\nconst getSlotType = (value: any): undefined | {new (viewContainerRef: ViewContainerRef, document: Document): SlotHandler<any>} => {\n\tif (!value) return undefined;\n\tconst type = typeof value;\n\tswitch (type) {\n\t\tcase 'string':\n\t\t\treturn StringSlotHandler;\n\t\tcase 'function':\n\t\t\tif (reflectComponentType(value)) {\n\t\t\t\treturn ComponentSlotHandler;\n\t\t\t}\n\t\t\treturn FunctionSlotHandler;\n\t\tcase 'object':\n\t\t\tif (value instanceof TemplateRef) {\n\t\t\t\treturn TemplateRefSlotHandler;\n\t\t\t}\n\t\t\tif (value instanceof ComponentTemplate) {\n\t\t\t\treturn ComponentTemplateSlotHandler;\n\t\t\t}\n\t\t\tbreak;\n\t}\n\treturn undefined;\n};\n\n@Directive({\n\tselector: '[auSlot]',\n\tstandalone: true,\n})\nexport class SlotDirective<Props extends Record<string, any>> implements OnChanges, OnDestroy {\n\t@Input('auSlot') slot: SlotContent<Props>;\n\t@Input('auSlotProps') props: Props;\n\n\tprivate _viewContainerRef = inject(ViewContainerRef);\n\tprivate _document = inject(DOCUMENT);\n\tprivate _slotType: ReturnType<typeof getSlotType>;\n\tprivate _slotHandler: SlotHandler<Props> | undefined;\n\n\tngOnChanges(changes: SimpleChanges): void {\n\t\tconst slotChange = changes['slot'];\n\t\tconst propsChange = changes['props'];\n\t\tconst slot = this.slot;\n\t\tif (slotChange) {\n\t\t\tconst newSlotType = getSlotType(slot);\n\t\t\tif (newSlotType !== this._slotType) {\n\t\t\t\tthis._slotHandler?.destroy();\n\t\t\t\tthis._slotHandler = newSlotType ? new newSlotType(this._viewContainerRef, this._document) : undefined;\n\t\t\t\tthis._slotType = newSlotType;\n\t\t\t}\n\t\t\tthis._slotHandler?.slotChange(slot, this.props);\n\t\t} else if (propsChange) {\n\t\t\tthis._slotHandler?.propsChange(slot, this.props);\n\t\t}\n\t}\n\n\tngOnDestroy(): void {\n\t\tthis._slotHandler?.destroy();\n\t\tthis._slotHandler = undefined;\n\t}\n}\n","import type {WritableSignal} from '@amadeus-it-group/tansu';\nimport type {OnInit} from '@angular/core';\nimport {Directive, Input, TemplateRef, inject} from '@angular/core';\nimport type {SlotContent} from './slotTypes';\n\n@Directive({selector: '[auSlotDefault]', standalone: true})\nexport class SlotDefaultDirective<T extends object> implements OnInit {\n\t@Input('auSlotDefault') auSlotDefault: WritableSignal<{slotDefault?: SlotContent<T>}>;\n\n\ttemplateRef = inject(TemplateRef<T>);\n\n\tngOnInit(): void {\n\t\tthis.auSlotDefault.update((value) => ({...value, slotDefault: this.templateRef}));\n\t}\n}\n","import type {OnChanges, OnDestroy, SimpleChanges} from '@angular/core';\nimport {Directive, ElementRef, inject, Input} from '@angular/core';\nimport type {Directive as AgnosUIDirective} from '@agnos-ui/core';\n\n// All calls of the directive in this class are done asynchronously (with await 0)\n// in order to avoid ExpressionChangedAfterItHasBeenCheckedError\n// or the corresponding issue with signals (https://github.com/angular/angular/issues/50320)\n// This is relevant especially if calling the directive changes variables used in a template.\n\n@Directive({\n\tstandalone: true,\n\tselector: '[auUse]',\n})\nexport class UseDirective<T> implements OnChanges, OnDestroy {\n\t@Input('auUse')\n\tuse: AgnosUIDirective<T> | undefined;\n\n\t@Input('auUseParams')\n\tparams: T | undefined;\n\n\t#ref = inject(ElementRef);\n\n\t#directive: AgnosUIDirective<T> | undefined;\n\t#directiveInstance?: ReturnType<AgnosUIDirective<T>>;\n\n\tasync #destroyDirectiveInstance() {\n\t\tconst directiveInstance = this.#directiveInstance;\n\t\tthis.#directiveInstance = undefined;\n\t\tif (directiveInstance?.destroy) {\n\t\t\tawait 0;\n\t\t\tdirectiveInstance.destroy?.();\n\t\t}\n\t}\n\n\tasync ngOnChanges(changes: SimpleChanges): Promise<void> {\n\t\tif (this.use !== this.#directive) {\n\t\t\tthis.#destroyDirectiveInstance();\n\t\t\tconst directive = this.use;\n\t\t\tthis.#directive = directive;\n\t\t\tif (directive) {\n\t\t\t\tawait 0;\n\t\t\t\t// checks that the directive did not change while waiting:\n\t\t\t\tif (directive === this.#directive && !this.#directiveInstance) {\n\t\t\t\t\tthis.#directiveInstance = directive(this.#ref.nativeElement, this.params as T);\n\t\t\t\t}\n\t\t\t}\n\t\t} else if (changes['params']) {\n\t\t\tawait 0;\n\t\t\tthis.#directiveInstance?.update?.(this.params as T);\n\t\t}\n\t}\n\n\tngOnDestroy(): void {\n\t\tthis.#destroyDirectiveInstance();\n\t\tthis.#directive = undefined;\n\t}\n}\n","import type {Widget, WidgetFactory, WidgetProps} from '@agnos-ui/core';\nimport {toReadableStore} from '@agnos-ui/core';\nimport type {ReadableSignal} from '@amadeus-it-group/tansu';\nimport {computed, writable} from '@amadeus-it-group/tansu';\nimport type {SimpleChanges, TemplateRef} from '@angular/core';\nimport type {SlotContent} from './slotTypes';\n\nconst createPatchSlots = <T extends object>(set: (object: Partial<T>) => void) => {\n\tlet lastValue: Partial<T> = {};\n\treturn (object: T) => {\n\t\tconst newValue: Partial<T> = {};\n\t\tlet hasChange = false;\n\t\tfor (const key of Object.keys(object) as (string & keyof T)[]) {\n\t\t\tconst objectKey = (object as any)[key];\n\t\t\tif (objectKey != null) {\n\t\t\t\t// only use defined slots\n\t\t\t\tnewValue[key] = objectKey;\n\t\t\t}\n\t\t\tif (objectKey != lastValue[key]) {\n\t\t\t\thasChange = true;\n\t\t\t}\n\t\t}\n\t\tif (hasChange) {\n\t\t\tlastValue = newValue;\n\t\t\tset(newValue);\n\t\t}\n\t};\n};\n\nexport type WithPatchSlots<W extends Widget> = W & {\n\tpatchSlots(slots: {\n\t\t[K in keyof WidgetProps<W> & `slot${string}`]: WidgetProps<W>[K] extends SlotContent<infer U> ? TemplateRef<U> | undefined : never;\n\t}): void;\n};\n\nexport const callWidgetFactoryWithConfig = <W extends Widget>({\n\tfactory,\n\tdefaultConfig,\n\twidgetConfig,\n\tevents,\n}: {\n\tfactory: WidgetFactory<W>;\n\tdefaultConfig?: Partial<WidgetProps<W>> | ReadableSignal<Partial<WidgetProps<W>> | undefined>;\n\twidgetConfig?: null | undefined | ReadableSignal<Partial<WidgetProps<W>> | undefined>;\n\tevents: Pick<WidgetProps<W>, keyof WidgetProps<W> & `on${string}`>;\n}): WithPatchSlots<W> => {\n\tconst defaultConfig$ = toReadableStore(defaultConfig);\n\tconst slots$ = writable({});\n\tconst widget = factory({\n\t\tconfig: computed(() => ({...defaultConfig$(), ...widgetConfig?.(), ...slots$()})),\n\t});\n\twidget.patch(events);\n\treturn {\n\t\t...widget,\n\t\tpatchSlots: createPatchSlots(slots$.set),\n\t};\n};\n\nexport function patchSimpleChanges(patchFn: (obj: any) => void, changes: SimpleChanges) {\n\tconst obj: any = {};\n\tfor (const [key, simpleChange] of Object.entries(changes)) {\n\t\tif (simpleChange !== undefined) {\n\t\t\tobj[key] = simpleChange.currentValue;\n\t\t}\n\t}\n\tpatchFn(obj);\n}\n","import type {Partial2Levels, Widget, WidgetFactory, WidgetProps, WidgetsConfigStore} from '@agnos-ui/core';\nimport {createWidgetsConfig} from '@agnos-ui/core';\nimport type {ReadableSignal} from '@amadeus-it-group/tansu';\nimport {computed} from '@amadeus-it-group/tansu';\nimport type {FactoryProvider} from '@angular/core';\nimport {InjectionToken, Injector, Optional, SkipSelf, inject, runInInjectionContext} from '@angular/core';\nimport type {AdaptPropsSlots} from './slotTypes';\nimport type {WithPatchSlots} from './utils';\nimport {callWidgetFactoryWithConfig} from './utils';\n\nexport type WidgetsConfig = {\n\t[WidgetName in keyof import('@agnos-ui/core').WidgetsConfig]: AdaptPropsSlots<import('@agnos-ui/core').WidgetsConfig[WidgetName]>;\n};\n\nexport const widgetsConfigFactory = <Config extends {[widgetName: string]: object} = WidgetsConfig>(\n\twidgetsConfigInjectionToken = new InjectionToken<WidgetsConfigStore<Config>>('widgetsConfig')\n) => {\n\t/**\n\t * Creates a provider of widgets default configuration that inherits from any widgets default configuration already defined at an upper level\n\t * in the Angular dependency injection system. It contains its own set of widgets configuration properties that override the same properties form\n\t * the parent configuration.\n\t *\n\t * @remarks\n\t * The configuration is computed from the parent configuration in two steps:\n\t * - first step: the parent configuration is transformed by the adaptParentConfig function (if specified).\n\t * If adaptParentConfig is not specified, this step is skipped.\n\t * - second step: the configuration from step 1 is merged (2-levels deep) with the own$ store. The own$ store initially contains\n\t * 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\t * {@link injectWidgetsConfig}.\n\t *\n\t * @param adaptParentConfig - optional function that receives a 2-levels copy of the widgets default configuration\n\t * defined at an upper level in the Angular dependency injection system (or an empty object if there is none) and returns the widgets\n\t * default configuration to be used.\n\t * It is called only if the configuration is needed, and was not yet computed for the current value of the parent configuration.\n\t * 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\t * 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\t * Angular dependency injection system.\n\n\t* @returns DI provider to be included a list of `providers` (for example at a component level or\n\t* any other level of the Angular dependency injection system)\n\t*\n\t* @example\n\t* ```typescript\n\t* @Component({\n\t* // ...\n\t* providers: [\n\t* provideWidgetsConfig((parentConfig) => {\n\t* // first step configuration: transforms the parent configuration\n\t* parentConfig.rating = parentConfig.rating ?? {};\n\t* parentConfig.rating.className = `${parentConfig.rating.className ?? ''} my-rating-extra-class`\n\t* return parentConfig;\n\t* })\n\t* ]\n\t* })\n\t* class MyComponent {\n\t* widgetsConfig = injectWidgetsConfig();\n\t* constructor() {\n\t* this.widgetsConfig.set({\n\t* // second step configuration: overrides the parent configuration\n\t* rating: {\n\t* slotStar: MyCustomSlotStar\n\t* }\n\t* });\n\t* }\n\t* // ...\n\t* }\n\t* ```\n\t*/\n\tconst provideWidgetsConfig = (adaptParentConfig?: (config: Partial2Levels<Config>) => Partial2Levels<Config>): FactoryProvider => ({\n\t\tprovide: widgetsConfigInjectionToken,\n\t\tuseFactory: (parent: WidgetsConfigStore<Config> | null) => {\n\t\t\tif (adaptParentConfig) {\n\t\t\t\tconst injector = inject(Injector);\n\t\t\t\tconst originalAdaptParentConfig = adaptParentConfig;\n\t\t\t\tadaptParentConfig = (value) => runInInjectionContext(injector, () => originalAdaptParentConfig(value));\n\t\t\t}\n\t\t\treturn createWidgetsConfig(parent ?? undefined, adaptParentConfig);\n\t\t},\n\t\tdeps: [[new SkipSelf(), new Optional(), widgetsConfigInjectionToken]],\n\t});\n\n\t/**\n\t * Returns the widgets default configuration store that was provided in the current injection context.\n\t * Throws if the no widgets default configuration store was provided.\n\t *\n\t * @remarks\n\t * This function must be called from an injection context, such as a constructor, a factory function, a field initializer or\n\t * a function used with {@link https://angular.io/api/core/runInInjectionContext | runInInjectionContext}.\n\t *\n\t * @returns the widgets default configuration store.\n\t */\n\tconst injectWidgetsConfig = () => inject(widgetsConfigInjectionToken);\n\n\tconst injectWidgetConfig = <N extends keyof Config>(widgetName: N): ReadableSignal<Partial<Config[N]> | undefined> => {\n\t\tconst widgetsConfig = inject(widgetsConfigInjectionToken, {optional: true});\n\t\treturn computed(() => widgetsConfig?.()[widgetName]);\n\t};\n\n\tconst callWidgetFactory = <W extends Widget>({\n\t\tfactory,\n\t\twidgetName = null,\n\t\tdefaultConfig = {},\n\t\tevents,\n\t}: {\n\t\tfactory: WidgetFactory<W>;\n\t\twidgetName?: null | keyof Config;\n\t\tdefaultConfig?: Partial<WidgetProps<W>> | ReadableSignal<Partial<WidgetProps<W>> | undefined>;\n\t\tevents: Pick<WidgetProps<W>, keyof WidgetProps<W> & `on${string}`>;\n\t}): WithPatchSlots<W> =>\n\t\tcallWidgetFactoryWithConfig({\n\t\t\tfactory,\n\t\t\twidgetConfig: widgetName ? (injectWidgetConfig(widgetName) as any) : null,\n\t\t\tdefaultConfig,\n\t\t\tevents,\n\t\t});\n\n\treturn {\n\t\t/**\n\t\t * Dependency Injection token which can be used to provide or inject the widgets default configuration store.\n\t\t */\n\t\twidgetsConfigInjectionToken,\n\t\tprovideWidgetsConfig,\n\t\tinjectWidgetsConfig,\n\t\tinjectWidgetConfig,\n\t\tcallWidgetFactory,\n\t};\n};\n\nexport const {widgetsConfigInjectionToken, provideWidgetsConfig, injectWidgetConfig, injectWidgetsConfig, callWidgetFactory} =\n\twidgetsConfigFactory<WidgetsConfig>();\n","/*\n * Public API Surface of @agnos-ui/angular-headless\n */\n\nexport * from '@agnos-ui/core';\n\nexport * from './lib/slot.directive';\nexport * from './lib/slotDefault.directive';\nexport * from './lib/use.directive';\nexport * from './lib/slotTypes';\nexport * from './lib/utils';\nexport * from './lib/config';\n\nimport type {PropsConfig, WidgetFactory, WidgetProps, WidgetState} from '@agnos-ui/core';\nimport type {AdaptSlotContentProps, AdaptWidgetSlots} from './lib/slotTypes';\n\nexport type {SlotContent} from './lib/slotTypes';\nexport type {WidgetsConfig} from './lib/config';\n\nexport type AccordionWidget = AdaptWidgetSlots<import('@agnos-ui/core').AccordionWidget>;\nexport type AccordionProps = WidgetProps<AccordionWidget>;\nexport type AccordionState = WidgetState<AccordionWidget>;\nexport type AccordionApi = AccordionWidget['api'];\nexport type AccordionItemWidget = AdaptWidgetSlots<import('@agnos-ui/core').AccordionItemWidget>;\nexport type AccordionItemProps = WidgetProps<AccordionItemWidget>;\nexport type AccordionItemState = WidgetState<AccordionItemWidget>;\nexport type AccordionItemContext = AdaptSlotContentProps<import('@agnos-ui/core').AccordionItemContext>;\nimport {createAccordion as coreCreateAccordion} from '@agnos-ui/core';\nexport const createAccordion: WidgetFactory<AccordionWidget> = coreCreateAccordion as any;\n\nexport type AlertWidget = AdaptWidgetSlots<import('@agnos-ui/core').AlertWidget>;\nexport type AlertProps = WidgetProps<AlertWidget>;\nexport type AlertState = WidgetState<AlertWidget>;\nexport type AlertContext = AdaptSlotContentProps<import('@agnos-ui/core').AlertContext>;\nimport {createAlert as coreCreateAlert} from '@agnos-ui/core';\nexport const createAlert: WidgetFactory<AlertWidget> = coreCreateAlert as any;\n\nexport type ModalWidget = AdaptWidgetSlots<import('@agnos-ui/core').ModalWidget>;\nexport type ModalProps = WidgetProps<ModalWidget>;\nexport type ModalState = WidgetState<ModalWidget>;\nexport type ModalContext = AdaptSlotContentProps<import('@agnos-ui/core').ModalContext>;\nimport {createModal as coreCreateModal} from '@agnos-ui/core';\nexport const createModal: WidgetFactory<ModalWidget> = coreCreateModal as any;\n\nexport type PaginationWidget = AdaptWidgetSlots<import('@agnos-ui/core').PaginationWidget>;\nexport type PaginationProps = WidgetProps<PaginationWidget>;\nexport type PaginationState = WidgetState<PaginationWidget>;\nexport type PaginationContext = AdaptSlotContentProps<import('@agnos-ui/core').PaginationContext>;\nexport type PaginationNumberContext = AdaptSlotContentProps<import('@agnos-ui/core').PaginationNumberContext>;\nimport {createPagination as coreCreatePagination} from '@agnos-ui/core';\nexport const createPagination: WidgetFactory<PaginationWidget> = coreCreatePagination as any;\n\nexport type RatingWidget = AdaptWidgetSlots<import('@agnos-ui/core').RatingWidget>;\nexport type RatingProps = WidgetProps<RatingWidget>;\nexport type RatingState = WidgetState<RatingWidget>;\nimport {createRating as coreCreateRating} from '@agnos-ui/core';\nexport const createRating: WidgetFactory<RatingWidget> = coreCreateRating as any;\n\nexport type SelectWidget<Item> = AdaptWidgetSlots<import('@agnos-ui/core').SelectWidget<Item>>;\nexport type SelectProps<Item> = WidgetProps<SelectWidget<Item>>;\nexport type SelectState<Item> = WidgetState<SelectWidget<Item>>;\nimport {createSelect as coreCreateSelect} from '@agnos-ui/core';\nexport const createSelect: <Item>(propsConfig?: PropsConfig<SelectProps<Item>>) => SelectWidget<Item> = coreCreateSelect as any;\n\nexport type ProgressbarWidget = AdaptWidgetSlots<import('@agnos-ui/core').ProgressbarWidget>;\nexport type ProgressbarProps = WidgetProps<ProgressbarWidget>;\nexport type ProgressbarState = WidgetState<ProgressbarWidget>;\nexport type ProgressbarContext = AdaptSlotContentProps<import('@agnos-ui/core').ProgressbarContext>;\nimport {createProgressbar as coreCreateProgressbar} from '@agnos-ui/core';\nexport const createProgressbar: WidgetFactory<ProgressbarWidget> = coreCreateProgressbar as any;\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["coreCreateAccordion","coreCreateAlert","coreCreateModal","coreCreatePagination","coreCreateRating","coreCreateSelect","coreCreateProgressbar"],"mappings":";;;;;;;MAGa,iBAAiB,CAAA;IA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,kBAAkB;QAClB,iBAAiB;KACjB,CAAC;AACH,EAAE;AAEW,MAAA,EAAC,2BAA2B,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,iBAAiB,EAAC,GAC3H,oBAAoB;;ACjIrB;;AAEG;AA0BI,MAAM,eAAe,GAAmCA,kBAA2B;AAOnF,MAAM,WAAW,GAA+BC,cAAuB;AAOvE,MAAM,WAAW,GAA+BC,cAAuB;AAQvE,MAAM,gBAAgB,GAAoCC,mBAA4B;AAMtF,MAAM,YAAY,GAAgCC,eAAwB;AAM1E,MAAM,YAAY,GAA+EC,eAAwB;AAOzH,MAAM,iBAAiB,GAAqCC;;ACrEnE;;AAEG;;;;"}
|
package/lib/config.d.ts
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { Partial2Levels, Widget, WidgetFactory, WidgetProps, WidgetsConfigStore } from '@agnos-ui/core';
|
|
2
|
+
import type { ReadableSignal } from '@amadeus-it-group/tansu';
|
|
3
|
+
import type { FactoryProvider } from '@angular/core';
|
|
4
|
+
import { InjectionToken } from '@angular/core';
|
|
5
|
+
import type { AdaptPropsSlots } from './slotTypes';
|
|
6
|
+
import type { WithPatchSlots } from './utils';
|
|
7
|
+
export type WidgetsConfig = {
|
|
8
|
+
[WidgetName in keyof import('@agnos-ui/core').WidgetsConfig]: AdaptPropsSlots<import('@agnos-ui/core').WidgetsConfig[WidgetName]>;
|
|
9
|
+
};
|
|
10
|
+
export declare const widgetsConfigFactory: <Config extends {
|
|
11
|
+
[widgetName: string]: object;
|
|
12
|
+
} = WidgetsConfig>(widgetsConfigInjectionToken?: InjectionToken<WidgetsConfigStore<Config>>) => {
|
|
13
|
+
/**
|
|
14
|
+
* Dependency Injection token which can be used to provide or inject the widgets default configuration store.
|
|
15
|
+
*/
|
|
16
|
+
widgetsConfigInjectionToken: InjectionToken<WidgetsConfigStore<Config>>;
|
|
17
|
+
provideWidgetsConfig: (adaptParentConfig?: ((config: Partial<{ [Level1 in keyof Config]: Partial<Config[Level1]>; }>) => Partial<{ [Level1 in keyof Config]: Partial<Config[Level1]>; }>) | undefined) => FactoryProvider;
|
|
18
|
+
injectWidgetsConfig: () => WidgetsConfigStore<Config>;
|
|
19
|
+
injectWidgetConfig: <N extends keyof Config>(widgetName: N) => ReadableSignal<Partial<Config[N]> | undefined>;
|
|
20
|
+
callWidgetFactory: <W extends Widget<object, object, object, object, object>>({ factory, widgetName, defaultConfig, events, }: {
|
|
21
|
+
factory: WidgetFactory<W>;
|
|
22
|
+
widgetName?: keyof Config | null | undefined;
|
|
23
|
+
defaultConfig?: Partial<WidgetProps<W>> | ReadableSignal<Partial<WidgetProps<W>> | undefined> | undefined;
|
|
24
|
+
events: Pick<WidgetProps<W>, keyof WidgetProps<W> & `on${string}`>;
|
|
25
|
+
}) => WithPatchSlots<W>;
|
|
26
|
+
};
|
|
27
|
+
export declare const widgetsConfigInjectionToken: InjectionToken<WidgetsConfigStore<WidgetsConfig>>, provideWidgetsConfig: (adaptParentConfig?: ((config: Partial<{
|
|
28
|
+
pagination: Partial<AdaptPropsSlots<import("@agnos-ui/core").PaginationProps>>;
|
|
29
|
+
rating: Partial<AdaptPropsSlots<import("@agnos-ui/core").RatingProps>>;
|
|
30
|
+
select: Partial<AdaptPropsSlots<import("@agnos-ui/core").SelectProps<any>>>;
|
|
31
|
+
modal: Partial<AdaptPropsSlots<import("@agnos-ui/core").ModalProps>>;
|
|
32
|
+
alert: Partial<AdaptPropsSlots<import("@agnos-ui/core").AlertProps>>;
|
|
33
|
+
accordion: Partial<AdaptPropsSlots<import("@agnos-ui/core").AccordionProps>>;
|
|
34
|
+
progressbar: Partial<AdaptPropsSlots<import("@agnos-ui/core").ProgressbarProps>>;
|
|
35
|
+
}>) => Partial<{
|
|
36
|
+
pagination: Partial<AdaptPropsSlots<import("@agnos-ui/core").PaginationProps>>;
|
|
37
|
+
rating: Partial<AdaptPropsSlots<import("@agnos-ui/core").RatingProps>>;
|
|
38
|
+
select: Partial<AdaptPropsSlots<import("@agnos-ui/core").SelectProps<any>>>;
|
|
39
|
+
modal: Partial<AdaptPropsSlots<import("@agnos-ui/core").ModalProps>>;
|
|
40
|
+
alert: Partial<AdaptPropsSlots<import("@agnos-ui/core").AlertProps>>;
|
|
41
|
+
accordion: Partial<AdaptPropsSlots<import("@agnos-ui/core").AccordionProps>>;
|
|
42
|
+
progressbar: Partial<AdaptPropsSlots<import("@agnos-ui/core").ProgressbarProps>>;
|
|
43
|
+
}>) | undefined) => FactoryProvider, injectWidgetConfig: <N extends keyof import("@agnos-ui/core").WidgetsConfig>(widgetName: N) => ReadableSignal<Partial<WidgetsConfig[N]> | undefined>, injectWidgetsConfig: () => WidgetsConfigStore<WidgetsConfig>, callWidgetFactory: <W extends Widget<object, object, object, object, object>>({ factory, widgetName, defaultConfig, events, }: {
|
|
44
|
+
factory: WidgetFactory<W>;
|
|
45
|
+
widgetName?: keyof import("@agnos-ui/core").WidgetsConfig | null | undefined;
|
|
46
|
+
defaultConfig?: Partial<WidgetProps<W>> | ReadableSignal<Partial<WidgetProps<W>> | undefined> | undefined;
|
|
47
|
+
events: Pick<WidgetProps<W>, keyof WidgetProps<W> & `on${string}`>;
|
|
48
|
+
}) => WithPatchSlots<W>;
|
package/lib/slot.directive.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { OnChanges, OnDestroy, SimpleChanges } from '@angular/core';
|
|
2
|
-
import type { SlotContent } from './
|
|
2
|
+
import type { SlotContent } from './slotTypes';
|
|
3
3
|
import * as i0 from "@angular/core";
|
|
4
4
|
export declare class SlotDirective<Props extends Record<string, any>> implements OnChanges, OnDestroy {
|
|
5
5
|
slot: SlotContent<Props>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { WritableSignal } from '@amadeus-it-group/tansu';
|
|
2
2
|
import type { OnInit } from '@angular/core';
|
|
3
3
|
import { TemplateRef } from '@angular/core';
|
|
4
|
-
import type { SlotContent } from './
|
|
4
|
+
import type { SlotContent } from './slotTypes';
|
|
5
5
|
import * as i0 from "@angular/core";
|
|
6
6
|
export declare class SlotDefaultDirective<T extends object> implements OnInit {
|
|
7
7
|
auSlotDefault: WritableSignal<{
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { SlotContent as CoreSlotContent, Widget, WidgetFactory, WidgetProps, WidgetSlotContext, WidgetState } from '@agnos-ui/core';
|
|
2
|
+
import type { TemplateRef, Type } from '@angular/core';
|
|
3
|
+
export declare class ComponentTemplate<Props, K extends string, T extends {
|
|
4
|
+
[key in K]: TemplateRef<Props>;
|
|
5
|
+
}> {
|
|
6
|
+
readonly component: Type<T>;
|
|
7
|
+
readonly templateProp: K;
|
|
8
|
+
constructor(component: Type<T>, templateProp: K);
|
|
9
|
+
}
|
|
10
|
+
export type SlotContent<Props extends object = object> = CoreSlotContent<Props> | TemplateRef<Props> | Type<unknown> | ComponentTemplate<Props, any, any>;
|
|
11
|
+
export type AdaptSlotContentProps<Props extends Record<string, any>> = Props extends WidgetSlotContext<infer U> ? WidgetSlotContext<AdaptWidgetSlots<U>> & AdaptPropsSlots<Omit<Props, keyof WidgetSlotContext<any>>> : AdaptPropsSlots<Props>;
|
|
12
|
+
export type AdaptPropsSlots<Props> = Omit<Props, `slot${string}`> & {
|
|
13
|
+
[K in keyof Props & `slot${string}`]: Props[K] extends CoreSlotContent<infer U> ? SlotContent<AdaptSlotContentProps<U>> : Props[K];
|
|
14
|
+
};
|
|
15
|
+
export type AdaptWidgetFactories<T> = {
|
|
16
|
+
[K in keyof T]: T[K] extends WidgetFactory<infer U> ? WidgetFactory<AdaptWidgetSlots<U>> : T[K];
|
|
17
|
+
};
|
|
18
|
+
export type AdaptWidgetSlots<W extends Widget> = Widget<AdaptPropsSlots<WidgetProps<W>>, AdaptPropsSlots<WidgetState<W>>, AdaptWidgetFactories<W['api']>, W['actions'], W['directives']>;
|