@scania-nl/tegel-angular-extensions 0.0.4 → 0.0.6

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/index.d.ts CHANGED
@@ -1,4 +1,547 @@
1
- export * from './lib/toast/provide-toast';
2
- export * from './lib/toast/toast.config';
3
- export * from './lib/toast/toast.service';
4
- export * from './lib/toast/models/toast.model';
1
+ import * as _angular_core from '@angular/core';
2
+ import { InjectionToken, EnvironmentProviders } from '@angular/core';
3
+ import z$1, { z } from 'zod';
4
+ import { zx } from '@traversable/zod';
5
+ import { Subject } from 'rxjs';
6
+
7
+ /**
8
+ * List of available toast types (inherited from Tegel)
9
+ */
10
+ declare const TOAST_TYPES: readonly ["success", "information", "warning", "error"];
11
+ /**
12
+ * Type representing valid toast type values.
13
+ */
14
+ type ToastType = (typeof TOAST_TYPES)[number];
15
+
16
+ /**
17
+ * Global default configuration for toast behavior.
18
+ * Used when individual toast properties are not explicitly set.
19
+ */
20
+ interface ToastConfig {
21
+ /**
22
+ * Default toast type (e.g., 'success', 'information', etc.).
23
+ */
24
+ type: ToastType;
25
+ /**
26
+ * Default title to use when none is provided.
27
+ */
28
+ title: string;
29
+ /**
30
+ * Default description to use when none is provided.
31
+ */
32
+ description: string;
33
+ /**
34
+ * Default duration (ms) before auto-dismiss.
35
+ * Use `0` for persistent toasts.
36
+ */
37
+ duration: number;
38
+ /**
39
+ * Default duration (ms) for the fade-out animation.
40
+ */
41
+ closeDuration: number;
42
+ /**
43
+ * Whether toasts are closable by default.
44
+ */
45
+ closable: boolean;
46
+ }
47
+ declare const TOAST_CONFIG: InjectionToken<ToastConfig>;
48
+ declare const DEFAULT_TOAST_CONFIG: Required<ToastConfig>;
49
+
50
+ declare function provideToast(config?: Partial<ToastConfig>): EnvironmentProviders;
51
+
52
+ /**
53
+ * Represents the current lifecycle state of a toast.
54
+ */
55
+ declare enum ToastState {
56
+ /**
57
+ * The toast is fully visible and active.
58
+ */
59
+ Open = "open",
60
+ /**
61
+ * The toast is transitioning out (e.g., fading out).
62
+ */
63
+ Closing = "closing",
64
+ /**
65
+ * The toast is fully removed or dismissed.
66
+ */
67
+ Closed = "closed"
68
+ }
69
+
70
+ /**
71
+ * Defines the base structure for a toast message.
72
+ */
73
+ interface ToastOptions {
74
+ /**
75
+ * The visual style of the toast (e.g., success, error).
76
+ */
77
+ type: ToastType;
78
+ /**
79
+ * The main title text displayed in the toast.
80
+ */
81
+ title: string;
82
+ /**
83
+ * Optional description text providing additional context.
84
+ */
85
+ description?: string;
86
+ /**
87
+ * Duration in milliseconds before the toast auto-dismisses.
88
+ * Use `0` for persistent toasts.
89
+ */
90
+ duration: number;
91
+ /**
92
+ * Duration in milliseconds for the fade-out transition.
93
+ */
94
+ closeDuration: number;
95
+ /**
96
+ * Whether the toast can be manually closed by the user.
97
+ */
98
+ closable?: boolean;
99
+ /**
100
+ * Optional router link to navigate to when the toast is clicked.
101
+ */
102
+ link?: string;
103
+ /**
104
+ * Custom link text shown if a link is provided.
105
+ */
106
+ linkText?: string;
107
+ /**
108
+ * Optional callback triggered when the linkText is clicked.
109
+ * Used as an alternative to `link` for invoking custom behavior.
110
+ */
111
+ action?: () => void;
112
+ /**
113
+ * Optional callback triggered when the toast is created.
114
+ * @param toast The created toast instance.
115
+ */
116
+ onCreated?: (toast: Toast) => void;
117
+ /**
118
+ * Optional callback triggered when the toast begins to close.
119
+ * @param toast The toast that is closing.
120
+ */
121
+ onClose?: (toast: Toast) => void;
122
+ /**
123
+ * Optional callback triggered when the toast has been fully removed.
124
+ * @param toast The removed toast instance.
125
+ */
126
+ onRemoved?: (toast: Toast) => void;
127
+ }
128
+ /**
129
+ * Represents a fully instantiated toast, including unique ID and current state.
130
+ */
131
+ interface Toast extends ToastOptions {
132
+ /**
133
+ * Unique identifier for the toast instance.
134
+ */
135
+ id: number;
136
+ /**
137
+ * The current state of the toast (open, closing, or closed).
138
+ */
139
+ state: ToastState;
140
+ }
141
+
142
+ /**
143
+ * Service for creating, managing, and removing toast notifications.
144
+ * Supports automatic dismissal, manual control, and lifecycle hooks.
145
+ */
146
+ declare class ToastService {
147
+ private readonly config;
148
+ /** Internal ID tracker for unique toast IDs */
149
+ private id;
150
+ /** Signal state holding all toasts */
151
+ private readonly _toasts;
152
+ /** Public signal of all toasts */
153
+ readonly toasts: _angular_core.Signal<Toast[]>;
154
+ /** Signal of toasts that are not yet closed (open or closing) */
155
+ readonly activeToasts: _angular_core.Signal<Toast[]>;
156
+ /** Internal stream for auto-closing toasts */
157
+ private readonly autoCloseSubject;
158
+ /** Internal stream for fade-out/removal of toasts */
159
+ private readonly closeSubject;
160
+ constructor();
161
+ /**
162
+ * Creates and adds a new toast.
163
+ * @param toastOptions Partial toast definition.
164
+ * @returns The toast's unique ID.
165
+ */
166
+ create(toastOptions: Partial<ToastOptions>): number;
167
+ /**
168
+ * Initiates the fade-out transition for a toast.
169
+ * @param id The toast ID.
170
+ */
171
+ close(id: number): void;
172
+ /**
173
+ * Immediately marks a toast as closed and removes it from display.
174
+ * @param id The toast ID.
175
+ */
176
+ remove(id: number): void;
177
+ /**
178
+ * Closes and removes all toasts immediately without fade-out.
179
+ */
180
+ removeAll(): void;
181
+ /**
182
+ * Initiates closing process for all open toasts.
183
+ */
184
+ closeAll(): void;
185
+ /**
186
+ * Gets a toast by ID.
187
+ * @param id The toast ID.
188
+ * @returns The toast instance or undefined.
189
+ */
190
+ getToast(id: number): Toast | undefined;
191
+ /** Whether the toast is eligible for auto-closing */
192
+ private shouldAutoClose;
193
+ /** Whether the toast is eligible for final removal */
194
+ private shouldRemove;
195
+ /** Add toast to signal list */
196
+ private addToast;
197
+ /**
198
+ * Updates the state of a toast.
199
+ * @param id Toast ID
200
+ * @param state New state
201
+ * @returns The updated toast or undefined
202
+ */
203
+ private updateToastState;
204
+ /**
205
+ * Creates a unique id
206
+ * @returns New id
207
+ */
208
+ private createId;
209
+ /**
210
+ * Creates a success toast.
211
+ * @param props Toast props without type.
212
+ */
213
+ readonly success: (props?: Partial<Omit<ToastOptions, "type">>) => number;
214
+ /**
215
+ * Creates an error toast.
216
+ * @param props Toast props without type.
217
+ */
218
+ readonly error: (props?: Partial<Omit<ToastOptions, "type">>) => number;
219
+ /**
220
+ * Creates a warning toast.
221
+ * @param props Toast props without type.
222
+ */
223
+ readonly warning: (props?: Partial<Omit<ToastOptions, "type">>) => number;
224
+ /**
225
+ * Creates an informational toast.
226
+ * @param props Toast props without type.
227
+ */
228
+ readonly info: (props?: Partial<Omit<ToastOptions, "type">>) => number;
229
+ /**
230
+ * Creates a random toast for testing/demo purposes.
231
+ * @param props Optional overrides
232
+ */
233
+ readonly createRandomToast: (props?: Partial<ToastOptions>) => number;
234
+ private normalizeDuration;
235
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<ToastService, never>;
236
+ static ɵprov: _angular_core.ɵɵInjectableDeclaration<ToastService>;
237
+ }
238
+
239
+ /**
240
+ * Extracts the **output type** (validated runtime shape)
241
+ * from a Zod object schema — e.g. `z.output<typeof MySchema>`.
242
+ */
243
+ type SchemaOutput<S extends z.ZodObject<z.ZodRawShape>> = z.output<S>;
244
+ /**
245
+ * Represents a **development-time static environment** configuration.
246
+ * - `production` is always `false`.
247
+ * - Runtime-required keys (e.g. API URLs) are **optional** and may be set for local dev.
248
+ */
249
+ type DevStaticEnvFrom<S extends z.ZodObject<z.ZodRawShape>, K extends readonly (keyof SchemaOutput<S>)[]> = Omit<SchemaOutput<S>, K[number]> & {
250
+ production: false;
251
+ } & Partial<Pick<SchemaOutput<S>, K[number]>>;
252
+ /**
253
+ * Represents a **production-time static environment** configuration.
254
+ * - `production` is always `true`.
255
+ * - Runtime-required keys are **forbidden** here and must be provided at runtime.
256
+ */
257
+ type ProdStaticEnvFrom<S extends z.ZodObject<z.ZodRawShape>, K extends readonly (keyof SchemaOutput<S>)[]> = Omit<SchemaOutput<S>, K[number]> & {
258
+ production: true;
259
+ } & {
260
+ [P in K[number]]?: never;
261
+ };
262
+ /**
263
+ * Union type combining both development and production static environments.
264
+ * Used by `environment.ts` and `environment.prod.ts` to ensure correct key rules per mode.
265
+ */
266
+ type StaticEnvFrom<S extends z.ZodObject<z.ZodRawShape>, K extends readonly (keyof SchemaOutput<S>)[]> = DevStaticEnvFrom<S, K> | ProdStaticEnvFrom<S, K>;
267
+ /**
268
+ * Represents the **base default environment** for development builds.
269
+ * - Contains all common defaults.
270
+ * - Excludes runtime-required keys entirely from its type.
271
+ * - `production` is fixed to `false`.
272
+ */
273
+ type DevDefaultsFrom<S extends z.ZodObject<z.ZodRawShape>, K extends readonly (keyof SchemaOutput<S>)[]> = Omit<SchemaOutput<S>, K[number]> & {
274
+ production: false;
275
+ };
276
+ /**
277
+ * Generic interface returned by `createEnvKit`.
278
+ * Defines all helper methods and static typing for a fully type-safe environment configuration system.
279
+ */
280
+ interface EnvKit<S extends z.ZodObject<z.ZodRawShape>, K extends readonly (keyof SchemaOutput<S>)[]> {
281
+ /** Full Zod schema provided by the consumer */
282
+ schema: S;
283
+ /** Deep-partial schema (created via `zx.deepPartial(schema)`) used for runtime override validation */
284
+ runtimeOverridesSchema: zx.deepPartial.Semantic<S>;
285
+ /** List of top-level keys that must be defined at runtime when `production=true` */
286
+ runtimeRequiredKeys: K;
287
+ /** Parse raw `.env` content into a validated, deep-partial override object */
288
+ parseRuntimeOverridesAsync(raw: Record<string, unknown>): Promise<Partial<SchemaOutput<S>>>;
289
+ /** Merge static environment + runtime overrides, then validate using the Zod schema (async) */
290
+ mergeAndValidateAsync(staticEnv: StaticEnvFrom<S, K>, overrides?: Partial<SchemaOutput<S>>): Promise<SchemaOutput<S>>;
291
+ /** Type tokens (erased at runtime) for compile-time inference convenience */
292
+ types: {
293
+ /** The full validated config type (Zod output) */
294
+ EnvConfig: SchemaOutput<S>;
295
+ /** The dev-only defaults type (no runtime-required keys) */
296
+ DevDefaults: DevDefaultsFrom<S, K>;
297
+ /** Dev environment type (runtime keys optional) */
298
+ DevStaticEnv: DevStaticEnvFrom<S, K>;
299
+ /** Prod environment type (runtime keys forbidden) */
300
+ ProdStaticEnv: ProdStaticEnvFrom<S, K>;
301
+ /** Combined type of all static envs */
302
+ StaticEnv: StaticEnvFrom<S, K>;
303
+ /** The union of all runtime-required key names */
304
+ RuntimeRequired: K[number];
305
+ };
306
+ }
307
+
308
+ /**
309
+ * Builds a **type-safe environment kit** around a Zod schema.
310
+ *
311
+ * This utility encapsulates all environment configuration logic in a reusable,
312
+ * strongly-typed structure that:
313
+ * - Validates **deep-partial** runtime overrides using `zx.deepPartial(schema)`.
314
+ * - Ensures that **runtime-required keys** are provided when `production=true`.
315
+ * - Merges static defaults with runtime overrides and validates the **final config** asynchronously.
316
+ *
317
+ * @typeParam S - The Zod schema type describing the full environment configuration.
318
+ * @typeParam K - The list of top-level keys that must be supplied at runtime in production builds.
319
+ *
320
+ * @param params.schema - The full Zod schema defining the configuration structure.
321
+ * @param params.runtimeRequiredKeys - Keys that must be present in runtime overrides for production.
322
+ *
323
+ * @returns A fully-typed {@link EnvKit} instance exposing validation helpers, runtime parsers, and type tokens.
324
+ */
325
+ declare function createEnvKit<S extends z.ZodObject<z.ZodRawShape>, K extends readonly (keyof z.output<S>)[]>(params: {
326
+ /** The full Zod schema describing the app's configuration shape. */
327
+ schema: S;
328
+ /** Keys that must be provided at runtime when `production=true`. */
329
+ runtimeRequiredKeys: K;
330
+ }): EnvKit<S, K>;
331
+
332
+ /**
333
+ * Parses the contents of a `.env`-style file into a nested JavaScript object.
334
+ *
335
+ * Each line in the input string is expected to follow the format `KEY=VALUE`.
336
+ * Nested keys can be created using a configurable delimiter (default: `"__"`).
337
+ * Lines starting with `#` or containing only whitespace are ignored.
338
+ *
339
+ * Examples:
340
+ * ```env
341
+ * API_URL=https://api.local
342
+ * LOG__LEVEL=debug
343
+ * DB__CONNECTION__TIMEOUT=30
344
+ * ```
345
+ * Produces:
346
+ * ```ts
347
+ * {
348
+ * API_URL: "https://api.local",
349
+ * LOG: { LEVEL: "debug" },
350
+ * DB: { CONNECTION: { TIMEOUT: "30" } }
351
+ * }
352
+ * ```
353
+ *
354
+ * @param raw - The raw `.env` file content as a string.
355
+ * @param delimiter - The delimiter used to represent nested keys (default: `"__"`).
356
+ * @returns A nested object representing all parsed key-value pairs.
357
+ */
358
+ declare function parseEnvFile(raw: string, delimiter?: string): Record<string, unknown>;
359
+
360
+ /**
361
+ * Options for configuring the Angular runtime-config provider.
362
+ *
363
+ * @property envPath
364
+ * The URL (or path) to the runtime `.env` file that will be fetched at app start.
365
+ * Defaults to `"/env/runtime.env"`.
366
+ *
367
+ * @property debug
368
+ * Enables verbose console logging when `true`. Defaults to `false`.
369
+ *
370
+ * @property stopOnError
371
+ * If `true`, any failure while loading/parsing/validating the runtime config
372
+ * will reject the app initializer and **abort boot** (recommended for prod).
373
+ * If `false`, the provider falls back to the static environment only.
374
+ * Defaults to `true`.
375
+ *
376
+ * @property token
377
+ * Optional `InjectionToken` used to expose the validated configuration
378
+ * via Angular dependency injection. If omitted, the provider will create one
379
+ * automatically named `ENV_CONFIG`.
380
+ */
381
+ interface ProvideRuntimeConfigOptions<S extends z$1.ZodObject<z$1.ZodRawShape>> {
382
+ /** Path to the runtime env file (default: /env/runtime.env) */
383
+ envPath?: string;
384
+ /** Log debug info to console */
385
+ debug?: boolean;
386
+ /** Throw on error to stop app boot (default: true) */
387
+ stopOnError?: boolean;
388
+ /** Injection token used to provide the validated config via Angular DI */
389
+ token?: InjectionToken<SchemaOutput<S>>;
390
+ }
391
+ /**
392
+ * Registers providers that:
393
+ * - Fetch a runtime `.env` file at startup,
394
+ * - Parse it to a deep-partial structure via the kit,
395
+ * - Enforce runtime-required keys when appropriate,
396
+ * - Merge with the static environment,
397
+ * - Validate the **final** configuration against the Zod schema,
398
+ * - Expose the resulting config via a generated `InjectionToken`.
399
+ *
400
+ * @typeParam S - Zod schema type describing the full config shape.
401
+ * @typeParam K - List of runtime-required top-level keys.
402
+ *
403
+ * @param kit
404
+ * The `EnvKit` created by `createEnvKit(schema, runtimeRequiredKeys)`.
405
+ *
406
+ * @param options
407
+ * Runtime loading behavior and DI token description. See {@link ProvideRuntimeConfigOptions}.
408
+ *
409
+ * @returns The `EnvironmentProviders` to be added to `appConfig.providers`,
410
+ *
411
+ * @remarks
412
+ * - This uses an Angular **functional app initializer** to perform the load step.
413
+ * - If the server returns an HTML SPA fallback (instead of the `.env` file), the provider
414
+ * quietly uses the static environment (no runtime overrides).
415
+ */
416
+ declare function provideRuntimeConfig<S extends z$1.ZodObject<z$1.ZodRawShape>, K extends readonly (keyof z$1.output<S>)[]>(kit: EnvKit<S, K>, staticEnv: StaticEnvFrom<S, K>, { envPath, debug, stopOnError, token, }?: ProvideRuntimeConfigOptions<S>): EnvironmentProviders;
417
+
418
+ /**
419
+ * Options for configuring the Angular static-config provider.
420
+ *
421
+ * @property token
422
+ * A required `InjectionToken<T>` under which the static environment
423
+ * configuration will be registered. Angular resolves providers exclusively
424
+ * by **token instance identity**, not by token name or description, so the
425
+ * caller must supply the exact `InjectionToken<T>` that consumers will use
426
+ * when injecting the configuration.
427
+ */
428
+ type ProvideStaticConfigOptions<T> = {
429
+ token: InjectionToken<T>;
430
+ };
431
+ /**
432
+ * Registers providers that:
433
+ * - Expose a **static** environment configuration object via Angular DI,
434
+ * - Perform **no** runtime `.env` fetching or asynchronous initialization,
435
+ * - Mirror Angular’s standard build-time pattern:
436
+ *
437
+ * { provide: SOME_TOKEN, useValue: environment }
438
+ *
439
+ * This is intended for applications that:
440
+ * - Use only `environment.ts` build-time configuration,
441
+ * - Do not require runtime overrides or external `.env` files,
442
+ * - Wish to keep bootstrap logic minimal and predictable,
443
+ * - Or are running in unit tests where a fixed static config is sufficient.
444
+ *
445
+ * @typeParam T - The shape of the static configuration object.
446
+ *
447
+ * @param env
448
+ * The static configuration instance to expose via DI. Defaults to an empty
449
+ * object if omitted, enabling callers to provide minimal configuration
450
+ * without boilerplate.
451
+ *
452
+ * @param options
453
+ * A `ProvideStaticConfigOptions<T>` containing the **required**
454
+ * `InjectionToken<T>` under which the configuration will be registered.
455
+ * Angular DI resolves providers solely by token instance identity, so the
456
+ * caller must supply the exact token that consumers will inject.
457
+ *
458
+ * @returns The `EnvironmentProviders` to be added to `appConfig.providers`.
459
+ *
460
+ * @remarks
461
+ * The static provider is intentionally minimal, offering a lightweight
462
+ * counterpart to `provideRuntimeConfig` for apps that rely on build-time
463
+ * environment values only.
464
+ */
465
+ declare function provideStaticConfig<T>(env: T | undefined, options: ProvideStaticConfigOptions<T>): EnvironmentProviders;
466
+
467
+ /**
468
+ * Directive that triggers a hard page refresh when the host element is clicked
469
+ * a specified number of times within a configurable time window.
470
+ *
471
+ * This is useful for adding developer-oriented shortcuts, diagnostics entry points,
472
+ * hidden "triple-click to reload" behaviors, or fallback mechanisms in production.
473
+ *
474
+ * Usage:
475
+ * ```html
476
+ * <div taeHardRefresh [clicksRequired]="3" [clickWindowMs]="500">...</div>
477
+ * ```
478
+ */
479
+ declare class HardRefreshDirective {
480
+ /**
481
+ * The number of rapid consecutive clicks required to trigger a hard refresh.
482
+ * A "rapid" click is one that occurs within `clickWindowMs` of the previous click.
483
+ *
484
+ * @default 3
485
+ */
486
+ readonly clicksRequired: _angular_core.InputSignal<number>;
487
+ /**
488
+ * The maximum time interval (in milliseconds) allowed between consecutive clicks
489
+ * for them to be considered part of the same "streak".
490
+ *
491
+ * If the interval between two clicks exceeds this value, the streak resets.
492
+ *
493
+ * @default 500
494
+ */
495
+ readonly clickWindowMs: _angular_core.InputSignal<number>;
496
+ /**
497
+ * Internal click event stream used to build the rapid-click detection pipeline.
498
+ * Emits one value per host click (via the `(click)` host listener).
499
+ */
500
+ protected readonly clicks$: Subject<void>;
501
+ constructor();
502
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<HardRefreshDirective, never>;
503
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<HardRefreshDirective, "[taeHardRefresh]", never, { "clicksRequired": { "alias": "clicksRequired"; "required": false; "isSignal": true; }; "clickWindowMs": { "alias": "clickWindowMs"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
504
+ }
505
+
506
+ /**
507
+ * An enhanced standalone footer component based on the Tegel `TdsFooterComponent`.
508
+ *
509
+ * `TaeFooterComponent` maintains the same visual style as the original
510
+ * Tegel footer, but adds two key improvements:
511
+ *
512
+ * - A **compact “small” variant** for layouts where vertical space is limited.
513
+ * - Optional **version display**, allowing applications to show their
514
+ * build or release version directly in the footer.
515
+ *
516
+ * Example:
517
+ * ```html
518
+ * <tae-footer variant="small" version="v1.0.0" />
519
+ * ```
520
+ */
521
+ declare class TaeFooterComponent {
522
+ /**
523
+ * Determines the visual layout of the footer.
524
+ *
525
+ * - `"normal"` displays the standard footer layout (aligned to tds-footer)
526
+ * - `"small"` produces a more compact version suitable for tight layouts
527
+ *
528
+ * @default 'normal'
529
+ */
530
+ readonly variant: _angular_core.InputSignal<"normal" | "small">;
531
+ /**
532
+ * Optional application version string to display in the footer.
533
+ *
534
+ * When provided, it appears left of the Scania logo.
535
+ * If omitted or `undefined`, the version section is not shown.
536
+ */
537
+ readonly version: _angular_core.InputSignal<string | undefined>;
538
+ /**
539
+ * The current year used in the copyright section.
540
+ */
541
+ readonly currentYear: number;
542
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<TaeFooterComponent, never>;
543
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<TaeFooterComponent, "tae-footer", never, { "variant": { "alias": "variant"; "required": false; "isSignal": true; }; "version": { "alias": "version"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
544
+ }
545
+
546
+ export { DEFAULT_TOAST_CONFIG, HardRefreshDirective, TOAST_CONFIG, TaeFooterComponent, ToastService, createEnvKit, parseEnvFile, provideRuntimeConfig, provideStaticConfig, provideToast };
547
+ export type { Toast, ToastConfig, ToastOptions };
package/package.json CHANGED
@@ -1,22 +1,34 @@
1
1
  {
2
2
  "name": "@scania-nl/tegel-angular-extensions",
3
- "version": "0.0.4",
3
+ "version": "0.0.6",
4
4
  "license": "MIT",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
8
8
  "peerDependencies": {
9
- "@angular/common": "^19.0.0",
10
- "@angular/core": "^19.0.0",
11
- "@angular/router": "^19.0.0",
12
- "@scania/tegel-angular-17": "^1.0.0",
13
- "rxjs": "~7.8.0"
9
+ "@angular/common": ">=19",
10
+ "@angular/core": ">=19",
11
+ "@angular/router": ">=19",
12
+ "@scania/tegel-angular-17": ">=1.0.0",
13
+ "@traversable/zod": "^0.0.57",
14
+ "rxjs": ">=7.8.0",
15
+ "zod": "^4.1.12"
14
16
  },
15
17
  "sideEffects": false,
16
18
  "author": {
17
19
  "name": "Patrick Groot Koerkamp",
18
20
  "email": "patrick.groot.koerkamp@scania.com"
19
21
  },
22
+ "bin": {
23
+ "docker-entrypoint": "bin/docker-entrypoint.sh"
24
+ },
25
+ "files": [
26
+ "fesm2022/",
27
+ "esm2022/",
28
+ "bin/",
29
+ "docker/",
30
+ "index.d.ts"
31
+ ],
20
32
  "module": "esm2022/scania-nl-tegel-angular-extensions.mjs",
21
33
  "typings": "index.d.ts",
22
34
  "exports": {
@@ -1,17 +0,0 @@
1
- /**
2
- * Represents the current lifecycle state of a toast.
3
- */
4
- export declare enum ToastState {
5
- /**
6
- * The toast is fully visible and active.
7
- */
8
- Open = "open",
9
- /**
10
- * The toast is transitioning out (e.g., fading out).
11
- */
12
- Closing = "closing",
13
- /**
14
- * The toast is fully removed or dismissed.
15
- */
16
- Closed = "closed"
17
- }
@@ -1,8 +0,0 @@
1
- /**
2
- * List of available toast types (inherited from Tegel)
3
- */
4
- export declare const TOAST_TYPES: readonly ["success", "information", "warning", "error"];
5
- /**
6
- * Type representing valid toast type values.
7
- */
8
- export type ToastType = (typeof TOAST_TYPES)[number];
@@ -1,73 +0,0 @@
1
- import { ToastState } from './toast-state.enum';
2
- import { ToastType } from './toast-type';
3
- /**
4
- * Defines the base structure for a toast message.
5
- */
6
- export interface ToastOptions {
7
- /**
8
- * The visual style of the toast (e.g., success, error).
9
- */
10
- type: ToastType;
11
- /**
12
- * The main title text displayed in the toast.
13
- */
14
- title: string;
15
- /**
16
- * Optional description text providing additional context.
17
- */
18
- description?: string;
19
- /**
20
- * Duration in milliseconds before the toast auto-dismisses.
21
- * Use `0` for persistent toasts.
22
- */
23
- duration: number;
24
- /**
25
- * Duration in milliseconds for the fade-out transition.
26
- */
27
- closeDuration: number;
28
- /**
29
- * Whether the toast can be manually closed by the user.
30
- */
31
- closable?: boolean;
32
- /**
33
- * Optional router link to navigate to when the toast is clicked.
34
- */
35
- link?: string;
36
- /**
37
- * Custom link text shown if a link is provided.
38
- */
39
- linkText?: string;
40
- /**
41
- * Optional callback triggered when the linkText is clicked.
42
- * Used as an alternative to `link` for invoking custom behavior.
43
- */
44
- action?: () => void;
45
- /**
46
- * Optional callback triggered when the toast is created.
47
- * @param toast The created toast instance.
48
- */
49
- onCreated?: (toast: Toast) => void;
50
- /**
51
- * Optional callback triggered when the toast begins to close.
52
- * @param toast The toast that is closing.
53
- */
54
- onClose?: (toast: Toast) => void;
55
- /**
56
- * Optional callback triggered when the toast has been fully removed.
57
- * @param toast The removed toast instance.
58
- */
59
- onRemoved?: (toast: Toast) => void;
60
- }
61
- /**
62
- * Represents a fully instantiated toast, including unique ID and current state.
63
- */
64
- export interface Toast extends ToastOptions {
65
- /**
66
- * Unique identifier for the toast instance.
67
- */
68
- id: number;
69
- /**
70
- * The current state of the toast (open, closing, or closed).
71
- */
72
- state: ToastState;
73
- }