@agnos-ui/angular-headless 0.8.1 → 0.9.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 (50) hide show
  1. package/fesm2022/agnos-ui-angular-headless.mjs +169 -164
  2. package/fesm2022/agnos-ui-angular-headless.mjs.map +1 -1
  3. package/index.d.ts +439 -1
  4. package/package.json +4 -4
  5. package/components/toast/index.d.ts +0 -2
  6. package/components/toast/toaster.service.d.ts +0 -30
  7. package/config.d.ts +0 -47
  8. package/generated/components/accordion/index.d.ts +0 -1
  9. package/generated/components/alert/index.d.ts +0 -1
  10. package/generated/components/carousel/index.d.ts +0 -1
  11. package/generated/components/modal/index.d.ts +0 -1
  12. package/generated/components/pagination/index.d.ts +0 -1
  13. package/generated/components/progressbar/index.d.ts +0 -1
  14. package/generated/components/rating/index.d.ts +0 -1
  15. package/generated/components/select/index.d.ts +0 -1
  16. package/generated/components/slider/index.d.ts +0 -1
  17. package/generated/components/toast/index.d.ts +0 -1
  18. package/generated/components/tree/index.d.ts +0 -1
  19. package/generated/config.d.ts +0 -1
  20. package/generated/index.d.ts +0 -35
  21. package/generated/services/extendWidget.d.ts +0 -1
  22. package/generated/services/floatingUI.d.ts +0 -1
  23. package/generated/services/focustrack.d.ts +0 -1
  24. package/generated/services/hash.d.ts +0 -1
  25. package/generated/services/intersection.d.ts +0 -1
  26. package/generated/services/matchMedia.d.ts +0 -1
  27. package/generated/services/navManager.d.ts +0 -1
  28. package/generated/services/portal.d.ts +0 -1
  29. package/generated/services/resizeObserver.d.ts +0 -1
  30. package/generated/services/siblingsInert.d.ts +0 -1
  31. package/generated/services/transitions/baseTransitions.d.ts +0 -1
  32. package/generated/services/transitions/collapse.d.ts +0 -1
  33. package/generated/services/transitions/cssTransitions.d.ts +0 -1
  34. package/generated/services/transitions/simpleClassTransition.d.ts +0 -1
  35. package/generated/slot.directive.d.ts +0 -1
  36. package/generated/types.d.ts +0 -1
  37. package/generated/utils/coercion.d.ts +0 -1
  38. package/generated/utils/directive.d.ts +0 -1
  39. package/generated/utils/func.d.ts +0 -1
  40. package/generated/utils/stores.d.ts +0 -1
  41. package/generated/utils/widget.d.ts +0 -1
  42. package/generated/utils/writables.d.ts +0 -1
  43. package/generated/utils/zone.d.ts +0 -1
  44. package/slot.directive.d.ts +0 -34
  45. package/types.d.ts +0 -116
  46. package/utils/coercion.d.ts +0 -20
  47. package/utils/directive.d.ts +0 -54
  48. package/utils/stores.d.ts +0 -31
  49. package/utils/widget.d.ts +0 -62
  50. package/utils/zone.d.ts +0 -26
package/index.d.ts CHANGED
@@ -1 +1,439 @@
1
- export * from './generated';
1
+ export * from '@agnos-ui/core/services/siblingsInert';
2
+ export * from '@agnos-ui/core/services/resizeObserver';
3
+ export * from '@agnos-ui/core/services/portal';
4
+ export * from '@agnos-ui/core/services/navManager';
5
+ export * from '@agnos-ui/core/services/matchMedia';
6
+ export * from '@agnos-ui/core/services/intersection';
7
+ export * from '@agnos-ui/core/services/hash';
8
+ export * from '@agnos-ui/core/services/focustrack';
9
+ export * from '@agnos-ui/core/services/floatingUI';
10
+ export * from '@agnos-ui/core/services/extendWidget';
11
+ export * from '@agnos-ui/core/services/transitions/simpleClassTransition';
12
+ export * from '@agnos-ui/core/services/transitions/cssTransitions';
13
+ export * from '@agnos-ui/core/services/transitions/collapse';
14
+ export * from '@agnos-ui/core/services/transitions/baseTransitions';
15
+ export * from '@agnos-ui/core/utils/writables';
16
+ import { ReadableSignal, WritableSignal } from '@amadeus-it-group/tansu';
17
+ import * as i0 from '@angular/core';
18
+ import { Signal, TemplateRef, Type, OnChanges, OnInit, AfterContentChecked, SimpleChanges, WritableSignal as WritableSignal$1, InjectionToken, FactoryProvider, OnDestroy } from '@angular/core';
19
+ import { Widget, WidgetState, SlotContent as SlotContent$1, Extends, WidgetFactory, WidgetProps, Directive, DirectiveAndParam, DirectivesAndOptParam } from '@agnos-ui/core/types';
20
+ export * from '@agnos-ui/core/types';
21
+ export * from '@agnos-ui/core/utils/func';
22
+ import * as _agnos_ui_angular_headless from '@agnos-ui/angular-headless';
23
+ import { WidgetsConfig, WidgetsConfigStore, Partial2Levels } from '@agnos-ui/core/config';
24
+ export * from '@agnos-ui/core/config';
25
+ export * from '@agnos-ui/core/components/tree';
26
+ import { ToasterProps, ToastProps, ToasterToast } from '@agnos-ui/core/components/toast';
27
+ export * from '@agnos-ui/core/components/toast';
28
+ export * from '@agnos-ui/core/components/slider';
29
+ export * from '@agnos-ui/core/components/select';
30
+ export * from '@agnos-ui/core/components/rating';
31
+ export * from '@agnos-ui/core/components/progressbar';
32
+ export * from '@agnos-ui/core/components/pagination';
33
+ export * from '@agnos-ui/core/components/modal';
34
+ export * from '@agnos-ui/core/components/carousel';
35
+ export * from '@agnos-ui/core/components/alert';
36
+ export * from '@agnos-ui/core/components/accordion';
37
+ export * from '@agnos-ui/core/utils/stores';
38
+ export * from '@agnos-ui/core/utils/directive';
39
+
40
+ /**
41
+ * Represents a template for a component with specified properties.
42
+ *
43
+ * @template Props - The type of properties that the template accepts.
44
+ * @template K - The key in the template object that maps to the template reference.
45
+ * @template T - An object type where each key of type K maps to a TemplateRef of Props.
46
+ *
47
+ * @param component - The component type that contains the template.
48
+ * @param templateProp - The key in the component that maps to the template reference.
49
+ */
50
+ declare class ComponentTemplate<Props, K extends string, T extends {
51
+ [key in K]: Signal<TemplateRef<Props>>;
52
+ }> {
53
+ readonly component: Type<T>;
54
+ readonly templateProp: K;
55
+ constructor(component: Type<T>, templateProp: K);
56
+ }
57
+ /**
58
+ * Represents the content that can be used in a slot.
59
+ *
60
+ * @template Props - The type of the properties that the slot content can accept.
61
+ *
62
+ * This type can be one of the following:
63
+ * - `undefined | null`: Nullish value
64
+ * - `string`: A static string
65
+ * - `(props: Props) => string`: A function that takes props as input and returns a string template
66
+ * - `TemplateRef<Props>`: A reference to an Angular template with the specified properties.
67
+ * - `Type<unknown>`: A type representing an unknown component or directive.
68
+ * - `ComponentTemplate<Props, any, any>`: A component template with the specified properties.
69
+ */
70
+ type SlotContent<Props extends object = object> = SlotContent$1<Props> | TemplateRef<Props> | Type<unknown> | ComponentTemplate<Props, any, any>;
71
+ /**
72
+ * A directive representing a slot component that can be used to manage the state and context of a widget.
73
+ *
74
+ * @template W - The type of the widget that this slot component manages.
75
+ */
76
+ declare abstract class SlotComponent<W extends Widget> {
77
+ /**
78
+ * The state of the widget. Each property of the state is exposed through an Angular {@link https://angular.dev/api/core/Signal | Signal}
79
+ */
80
+ readonly state: i0.InputSignal<AngularState<W>>;
81
+ /**
82
+ * all the api functions to interact with the widget
83
+ */
84
+ readonly api: i0.InputSignal<W["api"]>;
85
+ /**
86
+ * directives to be used on html elements in the template of the slot
87
+ */
88
+ readonly directives: i0.InputSignal<W["directives"]>;
89
+ /**
90
+ * The slot context, to be used when the slot component uses other slots.
91
+ */
92
+ readonly slotContext: Signal<{
93
+ state: AngularState<W>;
94
+ api: W["api"];
95
+ directives: W["directives"];
96
+ }>;
97
+ static ɵfac: i0.ɵɵFactoryDeclaration<SlotComponent<any>, never>;
98
+ static ɵdir: i0.ɵɵDirectiveDeclaration<SlotComponent<any>, never, never, { "state": { "alias": "state"; "required": true; "isSignal": true; }; "api": { "alias": "api"; "required": true; "isSignal": true; }; "directives": { "alias": "directives"; "required": true; "isSignal": true; }; }, {}, never, never, true, never>;
99
+ }
100
+ /**
101
+ * Type utility to determine if a given type `T` is or extends `SlotContent<any>`.
102
+ *
103
+ * This type alias uses conditional types to check if `T` extends `SlotContent<any>` or if `SlotContent<any>` extends `T`.
104
+ * If either condition is true, it resolves to `T`, otherwise it resolves to `0`.
105
+ *
106
+ * @template T - The type to be checked.
107
+ */
108
+ type IsSlotContent<T> = Extends<T, SlotContent<any>> | Extends<SlotContent<any>, T> extends 1 ? T : 0;
109
+ /**
110
+ * Represents the state of an Angular widget, where each key in the widget's state
111
+ * is mapped to a Signal of the corresponding state value.
112
+ *
113
+ * @template W - The type of the widget.
114
+ */
115
+ type AngularState<W extends Widget> = {
116
+ [key in keyof WidgetState<W>]: Signal<WidgetState<W>[key]>;
117
+ };
118
+ /**
119
+ * Represents an Angular widget that extends a base widget type.
120
+ *
121
+ * @template W - The type of the base widget.
122
+ */
123
+ interface AngularWidget<W extends Widget> extends Pick<W, 'api' | 'directives' | 'patch'> {
124
+ /**
125
+ * A promise that resolves when the widget is initialized
126
+ */
127
+ initialized: Promise<void>;
128
+ /**
129
+ * The state of the widget. Each property of the state is exposed through an Angular {@link https://angular.dev/api/core/Signal | Signal}
130
+ */
131
+ state: AngularState<W>;
132
+ /**
133
+ * A function to initialize the Angular widget.
134
+ */
135
+ ngInit: () => void;
136
+ /**
137
+ * A utility function to update the slot properties.
138
+ */
139
+ updateSlots: () => void;
140
+ }
141
+ /**
142
+ * Represents the context for a widget slot, providing access to the widget and its state.
143
+ *
144
+ * @template W - The type of the widget.
145
+ */
146
+ interface WidgetSlotContext<W extends Widget> extends Pick<W, 'api' | 'directives'> {
147
+ /**
148
+ * The state of the widget. Each property of the state is exposed through an Angular {@link https://angular.dev/api/core/Signal | Signal}
149
+ */
150
+ state: AngularState<W>;
151
+ }
152
+
153
+ /**
154
+ * Call a widget factory using provided configs.
155
+ *
156
+ * The resulting widget can be easily hooked into the lifecycle of an Angular component through {@link BaseWidgetDirective}.
157
+ *
158
+ * @param factory - the widget factory to call
159
+ * @param options - the options
160
+ * @param options.defaultConfig - the default config of the widget
161
+ * @param options.widgetConfig - the config of the widget, overriding the defaultConfig
162
+ * @param options.events - the events of the widget
163
+ * @param options.afterInit - a callback to call after successful setup of the widget
164
+ * @param options.slotTemplates - a function to provide all slot templates using child queries
165
+ * @param options.slotChildren - a function to provide the default children slot using a view query
166
+ * @returns the widget
167
+ */
168
+ declare const callWidgetFactoryWithConfig: <W extends Widget>(factory: WidgetFactory<W>, options?: {
169
+ defaultConfig?: Partial<WidgetProps<W>> | ReadableSignal<Partial<WidgetProps<W>> | undefined>;
170
+ widgetConfig?: null | undefined | ReadableSignal<Partial<WidgetProps<W>> | undefined>;
171
+ events?: Partial<Pick<WidgetProps<W>, keyof WidgetProps<W> & `on${string}`>>;
172
+ afterInit?: (widget: AngularWidget<W>) => void;
173
+ slotTemplates?: () => { [K in keyof WidgetProps<W> as IsSlotContent<WidgetProps<W>[K]> extends 0 ? never : K]: WidgetProps<W>[K] extends SlotContent<infer U> ? TemplateRef<U> | undefined : never; };
174
+ slotChildren?: () => TemplateRef<void> | undefined;
175
+ }) => AngularWidget<W>;
176
+ /**
177
+ * An abstract base class for widget directives, providing common functionality
178
+ * for Angular components that interact with widgets.
179
+ *
180
+ * @template W - The type of the widget.
181
+ */
182
+ declare abstract class BaseWidgetDirective<W extends Widget> implements OnChanges, OnInit, AfterContentChecked {
183
+ private readonly _widget;
184
+ constructor(_widget: AngularWidget<W>);
185
+ /**
186
+ * Retrieves the widget api
187
+ * @returns the widget api
188
+ */
189
+ get api(): W['api'];
190
+ /**
191
+ * Retrieves the widget state. Each property of the state is exposed through an Angular {@link https://angular.dev/api/core/Signal | Signal}
192
+ * @returns the widget state
193
+ */
194
+ get state(): AngularState<W>;
195
+ /**
196
+ * Retrieves the widget directives
197
+ * @returns the widget directives
198
+ */
199
+ get directives(): W['directives'];
200
+ /**
201
+ * @inheritdoc
202
+ * @internal
203
+ */
204
+ ngOnChanges(changes: SimpleChanges): void;
205
+ /** @internal */
206
+ ngOnInit(): void;
207
+ /** @internal */
208
+ ngAfterContentChecked(): void;
209
+ static ɵfac: i0.ɵɵFactoryDeclaration<BaseWidgetDirective<any>, never>;
210
+ static ɵdir: i0.ɵɵDirectiveDeclaration<BaseWidgetDirective<any>, never, never, {}, {}, never, never, true, never>;
211
+ }
212
+
213
+ /**
214
+ * Converts a Tansu `ReadableSignal` to an Angular `Signal`.
215
+ *
216
+ * This function wraps the provided Tansu signal in an Angular signal, ensuring that updates
217
+ * are properly handled within Angular's zone. It subscribes to the Tansu signal and updates
218
+ * the Angular signal with the received values. The equality function for the Angular signal
219
+ * is set to always return false, ensuring that every new value from the Tansu signal triggers
220
+ * an update.
221
+ *
222
+ * @template T - The type of the value emitted by the signals.
223
+ * @param tansuSignal - The Tansu signal to convert.
224
+ * @returns - The resulting Angular signal.
225
+ */
226
+ declare const toAngularSignal: <T>(tansuSignal: ReadableSignal<T>) => Signal<T>;
227
+ /**
228
+ * Converts a Tansu `WritableSignal` to an Angular `WritableSignal`.
229
+ *
230
+ * This function wraps the provided Tansu signal in an Angular signal, ensuring that updates
231
+ * are properly handled within Angular's zone. It subscribes to the Tansu signal and updates
232
+ * the Angular signal with the received values. The equality function for the Angular signal
233
+ * is set to always return false, ensuring that every new value from the Tansu signal triggers
234
+ * an update.
235
+ *
236
+ * @template T - The type of the value emitted by the signals.
237
+ * @param tansuSignal - The Tansu signal to convert.
238
+ * @returns - The resulting Angular signal.
239
+ */
240
+ declare const toAngularWritableSignal: <T>(tansuSignal: WritableSignal<T>) => WritableSignal$1<T>;
241
+
242
+ /**
243
+ * A utility function to manage the lifecycle of a directive for a host element.
244
+ *
245
+ * This function handles the creation, updating, and destruction of a directive instance
246
+ * associated with a host element. It ensures that the directive is called appropriately
247
+ * based on the platform (server or client) and manages the directive's lifecycle within
248
+ * the Angular injection context.
249
+ *
250
+ * @template T - The type of parameters that the directive accepts.
251
+ *
252
+ * @param [directive] - The directive to be applied to the host element.
253
+ * @param [params] - The parameters to be passed to the directive.
254
+ *
255
+ * @returns An object containing an `update` function to update the directive and its parameters.
256
+ */
257
+ declare const useDirectiveForHost: <T>(directive?: Directive<T>, params?: T) => {
258
+ update: (newDirective?: Directive<T>, newParams?: T) => void;
259
+ };
260
+ /**
261
+ * A directive that allows the use of another directive with optional parameters.
262
+ *
263
+ * @template T - The type of the parameter that can be passed to the directive.
264
+ *
265
+ * @remarks
266
+ * This directive uses a private instance of {@link useDirectiveForHost} to manage the directive and its parameter.
267
+ */
268
+ declare class UseDirective<T> implements OnChanges {
269
+ #private;
270
+ readonly use: i0.InputSignal<Directive | DirectiveAndParam<T>>;
271
+ /** @internal */
272
+ ngOnChanges(): void;
273
+ static ɵfac: i0.ɵɵFactoryDeclaration<UseDirective<any>, never>;
274
+ static ɵdir: i0.ɵɵDirectiveDeclaration<UseDirective<any>, "[auUse]", never, { "use": { "alias": "auUse"; "required": true; "isSignal": true; }; }, {}, never, never, true, never>;
275
+ }
276
+ /**
277
+ * A directive that allows the use of multiple directives on a host element.
278
+ *
279
+ * @template T - A tuple type representing the directives and their optional parameters.
280
+ */
281
+ declare class UseMultiDirective<T extends any[]> implements OnChanges {
282
+ #private;
283
+ /**
284
+ * An input property that takes a tuple of directives and their optional parameters.
285
+ */
286
+ readonly useMulti: i0.InputSignal<DirectivesAndOptParam<T, _agnos_ui_angular_headless.SSRHTMLElement>>;
287
+ /** @internal */
288
+ ngOnChanges(): void;
289
+ static ɵfac: i0.ɵɵFactoryDeclaration<UseMultiDirective<any>, never>;
290
+ static ɵdir: i0.ɵɵDirectiveDeclaration<UseMultiDirective<any>, "[auUseMulti]", never, { "useMulti": { "alias": "auUseMulti"; "required": true; "isSignal": true; }; }, {}, never, never, true, never>;
291
+ }
292
+
293
+ type AdaptParentConfig<Config> = (config: Partial2Levels<Config>) => Partial2Levels<Config>;
294
+ type InjectWidgetsConfig<Config> = (config?: Partial2Levels<Config>) => WidgetsConfigStore<Config>;
295
+ /**
296
+ * A factory to create the utilities to allow widgets to be context-aware.
297
+ *
298
+ * It can be used when extending the core and creating new widgets.
299
+ *
300
+ * @template Config - The type of the widgets configuration object.
301
+ * @param widgetsConfigInjectionToken - the widgets config injection token
302
+ * @returns the utilities to create / manage widgets and contexts
303
+ */
304
+ declare const widgetsConfigFactory: <Config extends {
305
+ [widgetName: string]: object;
306
+ } = WidgetsConfig>(widgetsConfigInjectionToken?: InjectionToken<WidgetsConfigStore<Config>>) => {
307
+ /**
308
+ * Dependency Injection token which can be used to provide or inject the widgets default configuration store.
309
+ */
310
+ widgetsConfigInjectionToken: InjectionToken<WidgetsConfigStore<Config>>;
311
+ provideWidgetsConfig: (adaptParentConfig?: AdaptParentConfig<Config>) => FactoryProvider;
312
+ injectWidgetsConfig: InjectWidgetsConfig<Config>;
313
+ injectWidgetConfig: <N extends keyof Config>(widgetName: N) => ReadableSignal<Partial<Config[N]> | undefined>;
314
+ callWidgetFactory: <W extends Widget>(factory: WidgetFactory<W>, options?: {
315
+ defaultConfig?: Partial<WidgetProps<W>> | ReadableSignal<Partial<WidgetProps<W>> | undefined>;
316
+ events?: Partial<Pick<WidgetProps<W>, keyof WidgetProps<W> & `on${string}`>>;
317
+ afterInit?: (widget: AngularWidget<W>) => void;
318
+ slotTemplates?: () => { [K in keyof WidgetProps<W> as IsSlotContent<WidgetProps<W>[K]> extends 0 ? never : K]: WidgetProps<W>[K] extends SlotContent<infer U> ? TemplateRef<U> | undefined : never; };
319
+ slotChildren?: () => TemplateRef<void> | undefined;
320
+ }) => AngularWidget<W>;
321
+ };
322
+ declare const widgetsConfigInjectionToken: InjectionToken<WidgetsConfigStore<WidgetsConfig>>;
323
+ declare const provideWidgetsConfig: (adaptParentConfig?: AdaptParentConfig<WidgetsConfig> | undefined) => FactoryProvider;
324
+ declare const injectWidgetConfig: <N extends keyof WidgetsConfig>(widgetName: N) => ReadableSignal<Partial<WidgetsConfig[N]> | undefined>;
325
+ declare const injectWidgetsConfig: InjectWidgetsConfig<WidgetsConfig>;
326
+ declare const callWidgetFactory: <W extends Widget>(factory: WidgetFactory<W>, options?: {
327
+ defaultConfig?: Partial<WidgetProps<W>> | ReadableSignal<Partial<WidgetProps<W>> | undefined> | undefined;
328
+ events?: Partial<Pick<WidgetProps<W>, keyof WidgetProps<W> & `on${string}`>> | undefined;
329
+ afterInit?: ((widget: AngularWidget<W>) => void) | undefined;
330
+ slotTemplates?: (() => { [K in keyof WidgetProps<W> as IsSlotContent<WidgetProps<W>[K]> extends 0 ? never : K]: WidgetProps<W>[K] extends SlotContent<infer U extends object> ? TemplateRef<U> | undefined : never; }) | undefined;
331
+ slotChildren?: (() => TemplateRef<void> | undefined) | undefined;
332
+ } | undefined) => AngularWidget<W>;
333
+
334
+ /**
335
+ * Injection token used to provide configuration properties for the toaster service.
336
+ *
337
+ * This token is associated with the `ToasterProps` interface, which defines the
338
+ * structure of the configuration object. It allows dependency injection to supply
339
+ * custom properties for the toaster service, such as default settings or behavior.
340
+ */
341
+ declare const ToastPropsToken: InjectionToken<ToasterProps>;
342
+ /**
343
+ * Create a toaster provider with helpers and state.
344
+ * @param props Options for the toaster.
345
+ * @template Props Type of the toast properties.
346
+ */
347
+ declare class ToasterService<Props extends Partial<ToastProps>> {
348
+ #private;
349
+ readonly optionsCore: ToasterProps | null;
350
+ readonly toasts: Signal<ToasterToast<Props>[]>;
351
+ readonly options: WritableSignal$1<ToasterProps>;
352
+ readonly addToast: (props: Props) => number;
353
+ readonly removeToast: (id: number) => void;
354
+ readonly eventsDirective: _agnos_ui_angular_headless.Directive<number>;
355
+ readonly closeAll: () => void;
356
+ static ɵfac: i0.ɵɵFactoryDeclaration<ToasterService<any>, never>;
357
+ static ɵprov: i0.ɵɵInjectableDeclaration<ToasterService<any>>;
358
+ }
359
+
360
+ type Wrapper = <T>(fn: T) => T;
361
+ /**
362
+ * A utility class that provides methods to run functions inside or outside of Angular's NgZone.
363
+ * This can be useful for optimizing performance by avoiding unnecessary change detection cycles.
364
+ */
365
+ declare class ZoneWrapper {
366
+ #private;
367
+ planNgZoneRun: () => void;
368
+ /**
369
+ * Run the input function synchronously within the Angular zone
370
+ *
371
+ * @param fn - a function to run
372
+ * @returns the value returned by the function
373
+ */
374
+ ngZoneRun<T>(fn: () => T): T;
375
+ insideNgZone: Wrapper;
376
+ insideNgZoneWrapFunctionsObject: Wrapper;
377
+ outsideNgZone: Wrapper;
378
+ outsideNgZoneWrapFunctionsObject: Wrapper;
379
+ outsideNgZoneWrapDirective: Wrapper;
380
+ outsideNgZoneWrapDirectivesObject: Wrapper;
381
+ static ɵfac: i0.ɵɵFactoryDeclaration<ZoneWrapper, never>;
382
+ static ɵprov: i0.ɵɵInjectableDeclaration<ZoneWrapper>;
383
+ }
384
+
385
+ /**
386
+ * Transforms a value (typically a string) to a boolean.
387
+ * Intended to be used as a transform function of an input.
388
+ *
389
+ * @example
390
+ * ```readonly status = input({ transform: auBooleanAttribute });```
391
+ * @param value - Value to be transformed.
392
+ * @returns the value transformed
393
+ */
394
+ declare function auBooleanAttribute(value: unknown): boolean | undefined;
395
+ /**
396
+ * Transforms a value (typically a string) to a number.
397
+ * Intended to be used as a transform function of an input.
398
+ * @param value - Value to be transformed.
399
+ *
400
+ * @example
401
+ * ```readonly id = input({ transform: auNumberAttribute });```
402
+ * @returns the value transformed
403
+ */
404
+ declare function auNumberAttribute(value: unknown): number | undefined;
405
+
406
+ /**
407
+ * A directive that manages slot content and its properties.
408
+ *
409
+ * @template Props - A record type representing the properties for the slot.
410
+ *
411
+ * @remarks
412
+ * This directive handles changes to the slot content and its properties,
413
+ * and manages the lifecycle of the slot handler.
414
+ */
415
+ declare class SlotDirective<Props extends Record<string, any>> implements OnChanges, OnDestroy {
416
+ /**
417
+ * The slot content to be managed.
418
+ */
419
+ readonly slot: i0.InputSignal<SlotContent<Props>>;
420
+ /**
421
+ * The properties for the slot content.
422
+ */
423
+ readonly props: i0.InputSignal<Props>;
424
+ private readonly _viewContainerRef;
425
+ private _slotType;
426
+ private _slotHandler;
427
+ /**
428
+ * @param changes SimpleChanges from Angular
429
+ * @internal
430
+ */
431
+ ngOnChanges(changes: SimpleChanges): void;
432
+ /** @internal */
433
+ ngOnDestroy(): void;
434
+ static ɵfac: i0.ɵɵFactoryDeclaration<SlotDirective<any>, never>;
435
+ static ɵdir: i0.ɵɵDirectiveDeclaration<SlotDirective<any>, "[auSlot]", never, { "slot": { "alias": "auSlot"; "required": true; "isSignal": true; }; "props": { "alias": "auSlotProps"; "required": true; "isSignal": true; }; }, {}, never, never, true, never>;
436
+ }
437
+
438
+ export { BaseWidgetDirective, ComponentTemplate, SlotComponent, SlotDirective, ToastPropsToken, ToasterService, UseDirective, UseMultiDirective, ZoneWrapper, auBooleanAttribute, auNumberAttribute, callWidgetFactory, callWidgetFactoryWithConfig, injectWidgetConfig, injectWidgetsConfig, provideWidgetsConfig, toAngularSignal, toAngularWritableSignal, useDirectiveForHost, widgetsConfigFactory, widgetsConfigInjectionToken };
439
+ export type { AngularState, AngularWidget, IsSlotContent, SlotContent, WidgetSlotContext };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@agnos-ui/angular-headless",
3
3
  "description": "Headless component library for Angular.",
4
- "version": "0.8.1",
4
+ "version": "0.9.0-next.0",
5
5
  "type": "module",
6
6
  "exports": {
7
7
  ".": {
@@ -13,11 +13,11 @@
13
13
  },
14
14
  "peerDependencies": {
15
15
  "@amadeus-it-group/tansu": "^2.0.0",
16
- "@angular/common": "^19.0.0",
17
- "@angular/core": "^19.0.0"
16
+ "@angular/common": "^20.0.0",
17
+ "@angular/core": "^20.0.0"
18
18
  },
19
19
  "dependencies": {
20
- "@agnos-ui/core": "0.8.1",
20
+ "@agnos-ui/core": "0.9.0-next.0",
21
21
  "tslib": "^2.8.1"
22
22
  },
23
23
  "sideEffects": false,
@@ -1,2 +0,0 @@
1
- export * from '@agnos-ui/core/components/toast';
2
- export * from './toaster.service';
@@ -1,30 +0,0 @@
1
- import { type ToastProps } from '@agnos-ui/core/components/toast';
2
- import type { ToasterToast, ToasterProps } from '@agnos-ui/core/components/toast';
3
- import type { Signal, WritableSignal } from '@angular/core';
4
- import { InjectionToken } from '@angular/core';
5
- import * as i0 from "@angular/core";
6
- /**
7
- * Injection token used to provide configuration properties for the toaster service.
8
- *
9
- * This token is associated with the `ToasterProps` interface, which defines the
10
- * structure of the configuration object. It allows dependency injection to supply
11
- * custom properties for the toaster service, such as default settings or behavior.
12
- */
13
- export declare const ToastPropsToken: InjectionToken<ToasterProps>;
14
- /**
15
- * Create a toaster provider with helpers and state.
16
- * @param props Options for the toaster.
17
- * @template Props Type of the toast properties.
18
- */
19
- export declare class ToasterService<Props extends Partial<ToastProps>> {
20
- #private;
21
- readonly optionsCore: ToasterProps | null;
22
- readonly toasts: Signal<ToasterToast<Props>[]>;
23
- readonly options: WritableSignal<ToasterProps>;
24
- readonly addToast: (props: Props) => number;
25
- readonly removeToast: (id: number) => void;
26
- readonly eventsDirective: import("@agnos-ui/angular-headless").Directive<number>;
27
- readonly closeAll: () => void;
28
- static ɵfac: i0.ɵɵFactoryDeclaration<ToasterService<any>, never>;
29
- static ɵprov: i0.ɵɵInjectableDeclaration<ToasterService<any>>;
30
- }
package/config.d.ts DELETED
@@ -1,47 +0,0 @@
1
- import type { Widget, WidgetFactory, WidgetProps } from '@agnos-ui/core/types';
2
- import type { Partial2Levels, WidgetsConfigStore, WidgetsConfig } from '@agnos-ui/core/config';
3
- import type { ReadableSignal } from '@amadeus-it-group/tansu';
4
- import type { FactoryProvider, TemplateRef } from '@angular/core';
5
- import { InjectionToken } from '@angular/core';
6
- import type { AngularWidget, IsSlotContent, SlotContent } from './types';
7
- export * from '@agnos-ui/core/config';
8
- type AdaptParentConfig<Config> = (config: Partial2Levels<Config>) => Partial2Levels<Config>;
9
- type InjectWidgetsConfig<Config> = (config?: Partial2Levels<Config>) => WidgetsConfigStore<Config>;
10
- /**
11
- * A factory to create the utilities to allow widgets to be context-aware.
12
- *
13
- * It can be used when extending the core and creating new widgets.
14
- *
15
- * @template Config - The type of the widgets configuration object.
16
- * @param widgetsConfigInjectionToken - the widgets config injection token
17
- * @returns the utilities to create / manage widgets and contexts
18
- */
19
- export declare const widgetsConfigFactory: <Config extends {
20
- [widgetName: string]: object;
21
- } = WidgetsConfig>(widgetsConfigInjectionToken?: InjectionToken<WidgetsConfigStore<Config>>) => {
22
- /**
23
- * Dependency Injection token which can be used to provide or inject the widgets default configuration store.
24
- */
25
- widgetsConfigInjectionToken: InjectionToken<WidgetsConfigStore<Config>>;
26
- provideWidgetsConfig: (adaptParentConfig?: AdaptParentConfig<Config>) => FactoryProvider;
27
- injectWidgetsConfig: InjectWidgetsConfig<Config>;
28
- injectWidgetConfig: <N extends keyof Config>(widgetName: N) => ReadableSignal<Partial<Config[N]> | undefined>;
29
- callWidgetFactory: <W extends Widget>({ factory, widgetName, defaultConfig, events, afterInit, slotTemplates, slotChildren, }: {
30
- factory: WidgetFactory<W>;
31
- widgetName?: null | keyof Config;
32
- defaultConfig?: Partial<WidgetProps<W>> | ReadableSignal<Partial<WidgetProps<W>> | undefined>;
33
- events?: Partial<Pick<WidgetProps<W>, keyof WidgetProps<W> & `on${string}`>>;
34
- afterInit?: (widget: AngularWidget<W>) => void;
35
- slotTemplates?: () => { [K in keyof WidgetProps<W> as IsSlotContent<WidgetProps<W>[K]> extends 0 ? never : K]: WidgetProps<W>[K] extends SlotContent<infer U> ? TemplateRef<U> | undefined : never; };
36
- slotChildren?: () => TemplateRef<void> | undefined;
37
- }) => AngularWidget<W>;
38
- };
39
- export declare const widgetsConfigInjectionToken: InjectionToken<WidgetsConfigStore<WidgetsConfig>>, provideWidgetsConfig: (adaptParentConfig?: AdaptParentConfig<WidgetsConfig> | undefined) => FactoryProvider, injectWidgetConfig: <N extends keyof WidgetsConfig>(widgetName: N) => ReadableSignal<Partial<WidgetsConfig[N]> | undefined>, injectWidgetsConfig: InjectWidgetsConfig<WidgetsConfig>, callWidgetFactory: <W extends Widget>({ factory, widgetName, defaultConfig, events, afterInit, slotTemplates, slotChildren, }: {
40
- factory: WidgetFactory<W>;
41
- widgetName?: keyof WidgetsConfig | null | undefined;
42
- defaultConfig?: Partial<WidgetProps<W>> | ReadableSignal<Partial<WidgetProps<W>> | undefined> | undefined;
43
- events?: Partial<Pick<WidgetProps<W>, keyof WidgetProps<W> & `on${string}`>> | undefined;
44
- afterInit?: ((widget: AngularWidget<W>) => void) | undefined;
45
- slotTemplates?: (() => { [K in keyof WidgetProps<W> as IsSlotContent<WidgetProps<W>[K]> extends 0 ? never : K]: WidgetProps<W>[K] extends SlotContent<infer U extends object> ? TemplateRef<U> | undefined : never; }) | undefined;
46
- slotChildren?: (() => TemplateRef<void> | undefined) | undefined;
47
- }) => AngularWidget<W>;
@@ -1 +0,0 @@
1
- export * from '@agnos-ui/core/components/accordion';
@@ -1 +0,0 @@
1
- export * from '@agnos-ui/core/components/alert';
@@ -1 +0,0 @@
1
- export * from '@agnos-ui/core/components/carousel';
@@ -1 +0,0 @@
1
- export * from '@agnos-ui/core/components/modal';
@@ -1 +0,0 @@
1
- export * from '@agnos-ui/core/components/pagination';
@@ -1 +0,0 @@
1
- export * from '@agnos-ui/core/components/progressbar';
@@ -1 +0,0 @@
1
- export * from '@agnos-ui/core/components/rating';
@@ -1 +0,0 @@
1
- export * from '@agnos-ui/core/components/select';
@@ -1 +0,0 @@
1
- export * from '@agnos-ui/core/components/slider';
@@ -1 +0,0 @@
1
- export * from './../../../components/toast';
@@ -1 +0,0 @@
1
- export * from '@agnos-ui/core/components/tree';
@@ -1 +0,0 @@
1
- export * from './../config';
@@ -1,35 +0,0 @@
1
- export * from './services/siblingsInert';
2
- export * from './services/resizeObserver';
3
- export * from './services/portal';
4
- export * from './services/navManager';
5
- export * from './services/matchMedia';
6
- export * from './services/intersection';
7
- export * from './services/hash';
8
- export * from './services/focustrack';
9
- export * from './services/floatingUI';
10
- export * from './services/extendWidget';
11
- export * from './services/transitions/simpleClassTransition';
12
- export * from './services/transitions/cssTransitions';
13
- export * from './services/transitions/collapse';
14
- export * from './services/transitions/baseTransitions';
15
- export * from './utils/writables';
16
- export * from './utils/stores';
17
- export * from './utils/func';
18
- export * from './utils/directive';
19
- export * from './types';
20
- export * from './config';
21
- export * from './components/tree/index';
22
- export * from './components/toast/index';
23
- export * from './components/slider/index';
24
- export * from './components/select/index';
25
- export * from './components/rating/index';
26
- export * from './components/progressbar/index';
27
- export * from './components/pagination/index';
28
- export * from './components/modal/index';
29
- export * from './components/carousel/index';
30
- export * from './components/alert/index';
31
- export * from './components/accordion/index';
32
- export * from './utils/zone';
33
- export * from './utils/widget';
34
- export * from './utils/coercion';
35
- export * from './slot.directive';
@@ -1 +0,0 @@
1
- export * from '@agnos-ui/core/services/extendWidget';
@@ -1 +0,0 @@
1
- export * from '@agnos-ui/core/services/floatingUI';
@@ -1 +0,0 @@
1
- export * from '@agnos-ui/core/services/focustrack';
@@ -1 +0,0 @@
1
- export * from '@agnos-ui/core/services/hash';
@@ -1 +0,0 @@
1
- export * from '@agnos-ui/core/services/intersection';
@@ -1 +0,0 @@
1
- export * from '@agnos-ui/core/services/matchMedia';
@@ -1 +0,0 @@
1
- export * from '@agnos-ui/core/services/navManager';
@@ -1 +0,0 @@
1
- export * from '@agnos-ui/core/services/portal';
@@ -1 +0,0 @@
1
- export * from '@agnos-ui/core/services/resizeObserver';