@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
@@ -1 +0,0 @@
1
- export * from '@agnos-ui/core/services/siblingsInert';
@@ -1 +0,0 @@
1
- export * from '@agnos-ui/core/services/transitions/baseTransitions';
@@ -1 +0,0 @@
1
- export * from '@agnos-ui/core/services/transitions/collapse';
@@ -1 +0,0 @@
1
- export * from '@agnos-ui/core/services/transitions/cssTransitions';
@@ -1 +0,0 @@
1
- export * from '@agnos-ui/core/services/transitions/simpleClassTransition';
@@ -1 +0,0 @@
1
- export * from './../slot.directive';
@@ -1 +0,0 @@
1
- export * from './../types';
@@ -1 +0,0 @@
1
- export * from './../../utils/coercion';
@@ -1 +0,0 @@
1
- export * from './../../utils/directive';
@@ -1 +0,0 @@
1
- export * from '@agnos-ui/core/utils/func';
@@ -1 +0,0 @@
1
- export * from './../../utils/stores';
@@ -1 +0,0 @@
1
- export * from './../../utils/widget';
@@ -1 +0,0 @@
1
- export * from '@agnos-ui/core/utils/writables';
@@ -1 +0,0 @@
1
- export * from './../../utils/zone';
@@ -1,34 +0,0 @@
1
- import type { OnChanges, OnDestroy, SimpleChanges } from '@angular/core';
2
- import type { SlotContent } from './types';
3
- import * as i0 from "@angular/core";
4
- /**
5
- * A directive that manages slot content and its properties.
6
- *
7
- * @template Props - A record type representing the properties for the slot.
8
- *
9
- * @remarks
10
- * This directive handles changes to the slot content and its properties,
11
- * and manages the lifecycle of the slot handler.
12
- */
13
- export declare class SlotDirective<Props extends Record<string, any>> implements OnChanges, OnDestroy {
14
- /**
15
- * The slot content to be managed.
16
- */
17
- readonly slot: import("@angular/core").InputSignal<SlotContent<Props>>;
18
- /**
19
- * The properties for the slot content.
20
- */
21
- readonly props: import("@angular/core").InputSignal<Props>;
22
- private readonly _viewContainerRef;
23
- private _slotType;
24
- private _slotHandler;
25
- /**
26
- * @param changes SimpleChanges from Angular
27
- * @internal
28
- */
29
- ngOnChanges(changes: SimpleChanges): void;
30
- /** @internal */
31
- ngOnDestroy(): void;
32
- static ɵfac: i0.ɵɵFactoryDeclaration<SlotDirective<any>, never>;
33
- 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>;
34
- }
package/types.d.ts DELETED
@@ -1,116 +0,0 @@
1
- import type { SlotContent as CoreSlotContent, Widget, WidgetState, Extends } from '@agnos-ui/core/types';
2
- import type { Signal, TemplateRef, Type } from '@angular/core';
3
- import * as i0 from "@angular/core";
4
- export * from '@agnos-ui/core/types';
5
- /**
6
- * Represents a template for a component with specified properties.
7
- *
8
- * @template Props - The type of properties that the template accepts.
9
- * @template K - The key in the template object that maps to the template reference.
10
- * @template T - An object type where each key of type K maps to a TemplateRef of Props.
11
- *
12
- * @param component - The component type that contains the template.
13
- * @param templateProp - The key in the component that maps to the template reference.
14
- */
15
- export declare class ComponentTemplate<Props, K extends string, T extends {
16
- [key in K]: Signal<TemplateRef<Props>>;
17
- }> {
18
- readonly component: Type<T>;
19
- readonly templateProp: K;
20
- constructor(component: Type<T>, templateProp: K);
21
- }
22
- /**
23
- * Represents the content that can be used in a slot.
24
- *
25
- * @template Props - The type of the properties that the slot content can accept.
26
- *
27
- * This type can be one of the following:
28
- * - `undefined | null`: Nullish value
29
- * - `string`: A static string
30
- * - `(props: Props) => string`: A function that takes props as input and returns a string template
31
- * - `TemplateRef<Props>`: A reference to an Angular template with the specified properties.
32
- * - `Type<unknown>`: A type representing an unknown component or directive.
33
- * - `ComponentTemplate<Props, any, any>`: A component template with the specified properties.
34
- */
35
- export type SlotContent<Props extends object = object> = CoreSlotContent<Props> | TemplateRef<Props> | Type<unknown> | ComponentTemplate<Props, any, any>;
36
- /**
37
- * A directive representing a slot component that can be used to manage the state and context of a widget.
38
- *
39
- * @template W - The type of the widget that this slot component manages.
40
- */
41
- export declare abstract class SlotComponent<W extends Widget> {
42
- /**
43
- * The state of the widget. Each property of the state is exposed through an Angular {@link https://angular.dev/api/core/Signal | Signal}
44
- */
45
- readonly state: import("@angular/core").InputSignal<AngularState<W>>;
46
- /**
47
- * all the api functions to interact with the widget
48
- */
49
- readonly api: import("@angular/core").InputSignal<W["api"]>;
50
- /**
51
- * directives to be used on html elements in the template of the slot
52
- */
53
- readonly directives: import("@angular/core").InputSignal<W["directives"]>;
54
- /**
55
- * The slot context, to be used when the slot component uses other slots.
56
- */
57
- readonly slotContext: Signal<{
58
- state: AngularState<W>;
59
- api: W["api"];
60
- directives: W["directives"];
61
- }>;
62
- static ɵfac: i0.ɵɵFactoryDeclaration<SlotComponent<any>, never>;
63
- 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>;
64
- }
65
- /**
66
- * Type utility to determine if a given type `T` is or extends `SlotContent<any>`.
67
- *
68
- * This type alias uses conditional types to check if `T` extends `SlotContent<any>` or if `SlotContent<any>` extends `T`.
69
- * If either condition is true, it resolves to `T`, otherwise it resolves to `0`.
70
- *
71
- * @template T - The type to be checked.
72
- */
73
- export type IsSlotContent<T> = Extends<T, SlotContent<any>> | Extends<SlotContent<any>, T> extends 1 ? T : 0;
74
- /**
75
- * Represents the state of an Angular widget, where each key in the widget's state
76
- * is mapped to a Signal of the corresponding state value.
77
- *
78
- * @template W - The type of the widget.
79
- */
80
- export type AngularState<W extends Widget> = {
81
- [key in keyof WidgetState<W>]: Signal<WidgetState<W>[key]>;
82
- };
83
- /**
84
- * Represents an Angular widget that extends a base widget type.
85
- *
86
- * @template W - The type of the base widget.
87
- */
88
- export interface AngularWidget<W extends Widget> extends Pick<W, 'api' | 'directives' | 'patch'> {
89
- /**
90
- * A promise that resolves when the widget is initialized
91
- */
92
- initialized: Promise<void>;
93
- /**
94
- * The state of the widget. Each property of the state is exposed through an Angular {@link https://angular.dev/api/core/Signal | Signal}
95
- */
96
- state: AngularState<W>;
97
- /**
98
- * A function to initialize the Angular widget.
99
- */
100
- ngInit: () => void;
101
- /**
102
- * A utility function to update the slot properties.
103
- */
104
- updateSlots: () => void;
105
- }
106
- /**
107
- * Represents the context for a widget slot, providing access to the widget and its state.
108
- *
109
- * @template W - The type of the widget.
110
- */
111
- export interface WidgetSlotContext<W extends Widget> extends Pick<W, 'api' | 'directives'> {
112
- /**
113
- * The state of the widget. Each property of the state is exposed through an Angular {@link https://angular.dev/api/core/Signal | Signal}
114
- */
115
- state: AngularState<W>;
116
- }
@@ -1,20 +0,0 @@
1
- /**
2
- * Transforms a value (typically a string) to a boolean.
3
- * Intended to be used as a transform function of an input.
4
- *
5
- * @example
6
- * ```readonly status = input({ transform: auBooleanAttribute });```
7
- * @param value - Value to be transformed.
8
- * @returns the value transformed
9
- */
10
- export declare function auBooleanAttribute(value: unknown): boolean | undefined;
11
- /**
12
- * Transforms a value (typically a string) to a number.
13
- * Intended to be used as a transform function of an input.
14
- * @param value - Value to be transformed.
15
- *
16
- * @example
17
- * ```readonly id = input({ transform: auNumberAttribute });```
18
- * @returns the value transformed
19
- */
20
- export declare function auNumberAttribute(value: unknown): number | undefined;
@@ -1,54 +0,0 @@
1
- import type { Directive as AgnosUIDirective, DirectiveAndParam, DirectivesAndOptParam } from '@agnos-ui/core/types';
2
- import type { OnChanges } from '@angular/core';
3
- import * as i0 from "@angular/core";
4
- export * from '@agnos-ui/core/utils/directive';
5
- /**
6
- * A utility function to manage the lifecycle of a directive for a host element.
7
- *
8
- * This function handles the creation, updating, and destruction of a directive instance
9
- * associated with a host element. It ensures that the directive is called appropriately
10
- * based on the platform (server or client) and manages the directive's lifecycle within
11
- * the Angular injection context.
12
- *
13
- * @template T - The type of parameters that the directive accepts.
14
- *
15
- * @param [directive] - The directive to be applied to the host element.
16
- * @param [params] - The parameters to be passed to the directive.
17
- *
18
- * @returns An object containing an `update` function to update the directive and its parameters.
19
- */
20
- export declare const useDirectiveForHost: <T>(directive?: AgnosUIDirective<T>, params?: T) => {
21
- update: (newDirective?: AgnosUIDirective<T>, newParams?: T) => void;
22
- };
23
- /**
24
- * A directive that allows the use of another directive with optional parameters.
25
- *
26
- * @template T - The type of the parameter that can be passed to the directive.
27
- *
28
- * @remarks
29
- * This directive uses a private instance of {@link useDirectiveForHost} to manage the directive and its parameter.
30
- */
31
- export declare class UseDirective<T> implements OnChanges {
32
- #private;
33
- readonly use: import("@angular/core").InputSignal<AgnosUIDirective | DirectiveAndParam<T>>;
34
- /** @internal */
35
- ngOnChanges(): void;
36
- static ɵfac: i0.ɵɵFactoryDeclaration<UseDirective<any>, never>;
37
- static ɵdir: i0.ɵɵDirectiveDeclaration<UseDirective<any>, "[auUse]", never, { "use": { "alias": "auUse"; "required": true; "isSignal": true; }; }, {}, never, never, true, never>;
38
- }
39
- /**
40
- * A directive that allows the use of multiple directives on a host element.
41
- *
42
- * @template T - A tuple type representing the directives and their optional parameters.
43
- */
44
- export declare class UseMultiDirective<T extends any[]> implements OnChanges {
45
- #private;
46
- /**
47
- * An input property that takes a tuple of directives and their optional parameters.
48
- */
49
- readonly useMulti: import("@angular/core").InputSignal<DirectivesAndOptParam<T, import("@agnos-ui/angular-headless").SSRHTMLElement>>;
50
- /** @internal */
51
- ngOnChanges(): void;
52
- static ɵfac: i0.ɵɵFactoryDeclaration<UseMultiDirective<any>, never>;
53
- static ɵdir: i0.ɵɵDirectiveDeclaration<UseMultiDirective<any>, "[auUseMulti]", never, { "useMulti": { "alias": "auUseMulti"; "required": true; "isSignal": true; }; }, {}, never, never, true, never>;
54
- }
package/utils/stores.d.ts DELETED
@@ -1,31 +0,0 @@
1
- import type { ReadableSignal, WritableSignal as TansuWritableSignal } from '@amadeus-it-group/tansu';
2
- import type { Signal, WritableSignal } from '@angular/core';
3
- export * from '@agnos-ui/core/utils/stores';
4
- /**
5
- * Converts a Tansu `ReadableSignal` to an Angular `Signal`.
6
- *
7
- * This function wraps the provided Tansu signal in an Angular signal, ensuring that updates
8
- * are properly handled within Angular's zone. It subscribes to the Tansu signal and updates
9
- * the Angular signal with the received values. The equality function for the Angular signal
10
- * is set to always return false, ensuring that every new value from the Tansu signal triggers
11
- * an update.
12
- *
13
- * @template T - The type of the value emitted by the signals.
14
- * @param tansuSignal - The Tansu signal to convert.
15
- * @returns - The resulting Angular signal.
16
- */
17
- export declare const toAngularSignal: <T>(tansuSignal: ReadableSignal<T>) => Signal<T>;
18
- /**
19
- * Converts a Tansu `WritableSignal` to an Angular `WritableSignal`.
20
- *
21
- * This function wraps the provided Tansu signal in an Angular signal, ensuring that updates
22
- * are properly handled within Angular's zone. It subscribes to the Tansu signal and updates
23
- * the Angular signal with the received values. The equality function for the Angular signal
24
- * is set to always return false, ensuring that every new value from the Tansu signal triggers
25
- * an update.
26
- *
27
- * @template T - The type of the value emitted by the signals.
28
- * @param tansuSignal - The Tansu signal to convert.
29
- * @returns - The resulting Angular signal.
30
- */
31
- export declare const toAngularWritableSignal: <T>(tansuSignal: TansuWritableSignal<T>) => WritableSignal<T>;
package/utils/widget.d.ts DELETED
@@ -1,62 +0,0 @@
1
- import { type ReadableSignal } from '@amadeus-it-group/tansu';
2
- import type { AfterContentChecked, OnChanges, OnInit, SimpleChanges, TemplateRef } from '@angular/core';
3
- import type { AngularState, AngularWidget, IsSlotContent, SlotContent, Widget, WidgetFactory, WidgetProps } from '../types';
4
- import * as i0 from "@angular/core";
5
- /**
6
- * Call a widget factory using provided configs.
7
- *
8
- * @param parameter - the parameter
9
- * @param parameter.factory - the widget factory to call
10
- * @param parameter.defaultConfig - the default config of the widget
11
- * @param parameter.widgetConfig - the config of the widget, overriding the defaultConfig
12
- * @param parameter.events - the events of the widget
13
- * @param parameter.afterInit - a callback to call after successful setup of the widget
14
- * @param parameter.slotTemplates - a function to provide all slot templates using child queries
15
- * @param parameter.slotChildren - a function to provide the default children slot using a view query
16
- * @returns the widget
17
- */
18
- export declare const callWidgetFactoryWithConfig: <W extends Widget>({ factory, defaultConfig, widgetConfig, events, afterInit, slotTemplates, slotChildren, }: {
19
- factory: WidgetFactory<W>;
20
- defaultConfig?: Partial<WidgetProps<W>> | ReadableSignal<Partial<WidgetProps<W>> | undefined>;
21
- widgetConfig?: null | undefined | ReadableSignal<Partial<WidgetProps<W>> | undefined>;
22
- events?: Partial<Pick<WidgetProps<W>, keyof WidgetProps<W> & `on${string}`>>;
23
- afterInit?: (widget: AngularWidget<W>) => void;
24
- 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; };
25
- slotChildren?: () => TemplateRef<void> | undefined;
26
- }) => AngularWidget<W>;
27
- /**
28
- * An abstract base class for widget directives, providing common functionality
29
- * for Angular components that interact with widgets.
30
- *
31
- * @template W - The type of the widget.
32
- */
33
- export declare abstract class BaseWidgetDirective<W extends Widget> implements OnChanges, OnInit, AfterContentChecked {
34
- private readonly _widget;
35
- constructor(_widget: AngularWidget<W>);
36
- /**
37
- * Retrieves the widget api
38
- * @returns the widget api
39
- */
40
- get api(): W['api'];
41
- /**
42
- * Retrieves the widget state. Each property of the state is exposed through an Angular {@link https://angular.dev/api/core/Signal | Signal}
43
- * @returns the widget state
44
- */
45
- get state(): AngularState<W>;
46
- /**
47
- * Retrieves the widget directives
48
- * @returns the widget directives
49
- */
50
- get directives(): W['directives'];
51
- /**
52
- * @inheritdoc
53
- * @internal
54
- */
55
- ngOnChanges(changes: SimpleChanges): void;
56
- /** @internal */
57
- ngOnInit(): void;
58
- /** @internal */
59
- ngAfterContentChecked(): void;
60
- static ɵfac: i0.ɵɵFactoryDeclaration<BaseWidgetDirective<any>, never>;
61
- static ɵdir: i0.ɵɵDirectiveDeclaration<BaseWidgetDirective<any>, never, never, {}, {}, never, never, true, never>;
62
- }
package/utils/zone.d.ts DELETED
@@ -1,26 +0,0 @@
1
- import * as i0 from "@angular/core";
2
- type Wrapper = <T>(fn: T) => T;
3
- /**
4
- * A utility class that provides methods to run functions inside or outside of Angular's NgZone.
5
- * This can be useful for optimizing performance by avoiding unnecessary change detection cycles.
6
- */
7
- export declare class ZoneWrapper {
8
- #private;
9
- planNgZoneRun: () => void;
10
- /**
11
- * Run the input function synchronously within the Angular zone
12
- *
13
- * @param fn - a function to run
14
- * @returns the value returned by the function
15
- */
16
- ngZoneRun<T>(fn: () => T): T;
17
- insideNgZone: Wrapper;
18
- insideNgZoneWrapFunctionsObject: Wrapper;
19
- outsideNgZone: Wrapper;
20
- outsideNgZoneWrapFunctionsObject: Wrapper;
21
- outsideNgZoneWrapDirective: Wrapper;
22
- outsideNgZoneWrapDirectivesObject: Wrapper;
23
- static ɵfac: i0.ɵɵFactoryDeclaration<ZoneWrapper, never>;
24
- static ɵprov: i0.ɵɵInjectableDeclaration<ZoneWrapper>;
25
- }
26
- export {};