@fhss-web-team/frontend-utils 4.1.1 → 21.0.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 (29) hide show
  1. package/fesm2022/fhss-web-team-frontend-utils.mjs +190 -326
  2. package/fesm2022/fhss-web-team-frontend-utils.mjs.map +1 -1
  3. package/package.json +3 -3
  4. package/{lib/signals/fetch-signal/fetch-signal.types.d.ts → types/fhss-web-team-frontend-utils.d.ts} +372 -35
  5. package/index.d.ts +0 -5
  6. package/lib/components/byu-footer/byu-footer.component.d.ts +0 -6
  7. package/lib/components/byu-header/byu-header-link/byu-header-link.d.ts +0 -30
  8. package/lib/components/byu-header/byu-header.component.d.ts +0 -54
  9. package/lib/components/combo-box/combo-box.component.d.ts +0 -24
  10. package/lib/components/confirmation/confirmation.dialog.d.ts +0 -27
  11. package/lib/components/fhss-table/fhss-table.component.d.ts +0 -37
  12. package/lib/components/fhss-table/fhss-table.types.d.ts +0 -46
  13. package/lib/config/lib.config.d.ts +0 -5
  14. package/lib/config/utils.config.d.ts +0 -3
  15. package/lib/directives/scroll-anchor.directive.d.ts +0 -12
  16. package/lib/guards/auth/auth.guard.d.ts +0 -5
  17. package/lib/guards/permission/permission.guard.d.ts +0 -25
  18. package/lib/pages/auth-error/auth-error.page.d.ts +0 -7
  19. package/lib/pages/forbidden/forbidden.page.d.ts +0 -7
  20. package/lib/pages/not-found/not-found.page.d.ts +0 -7
  21. package/lib/pages/server-error/server-error.page.d.ts +0 -7
  22. package/lib/pages/system/system.page.d.ts +0 -11
  23. package/lib/services/auth/auth.service.d.ts +0 -67
  24. package/lib/services/scroll-registry/scroll-registry.service.d.ts +0 -10
  25. package/lib/signals/debounced/debounced.d.ts +0 -2
  26. package/lib/signals/fetch-signal/fetch-signal.d.ts +0 -4
  27. package/lib/signals/trpcResource/trpcResource.d.ts +0 -9
  28. package/lib/signals/trpcResource/trpcResource.types.d.ts +0 -72
  29. package/public-api.d.ts +0 -41
@@ -1,45 +1,377 @@
1
- import { Injector, Signal, ValueEqualityFn } from "@angular/core";
1
+ import * as i0 from '@angular/core';
2
+ import { InjectionToken, Provider, ElementRef, WritableSignal, Injector, ValueEqualityFn, Signal } from '@angular/core';
3
+ import { UrlTree, CanActivateFn } from '@angular/router';
4
+ import * as _angular_material_dialog from '@angular/material/dialog';
5
+ import { Resolver } from '@trpc/client';
6
+
7
+ declare class ByuFooterComponent {
8
+ currentYear: number;
9
+ static ɵfac: i0.ɵɵFactoryDeclaration<ByuFooterComponent, never>;
10
+ static ɵcmp: i0.ɵɵComponentDeclaration<ByuFooterComponent, "byu-footer", never, {}, {}, never, never, true, never>;
11
+ }
12
+
13
+ type AuthUser = {
14
+ id: string;
15
+ preferredFirstName: string;
16
+ preferredLastName: string;
17
+ roles: string[];
18
+ permissions: string[];
19
+ };
20
+ declare class AuthService {
21
+ private readonly FhssConfig;
22
+ private readonly readyPromise;
23
+ constructor();
24
+ /**
25
+ * Returns a promise that resolves when the authentication service is ready.
26
+ */
27
+ ready(): Promise<AuthUser | null>;
28
+ /**
29
+ * Updates the authentication state by retrieving the current user's information.
30
+ *
31
+ * @returns A promise containing the current user's authentication details.
32
+ */
33
+ update(): Promise<AuthUser | null>;
34
+ readonly authenticated: i0.WritableSignal<boolean>;
35
+ readonly userId: i0.WritableSignal<string | undefined>;
36
+ readonly preferredFirstName: i0.WritableSignal<string | undefined>;
37
+ readonly preferredLastName: i0.WritableSignal<string | undefined>;
38
+ readonly roles: i0.WritableSignal<string[]>;
39
+ readonly permissions: i0.WritableSignal<string[]>;
40
+ /**
41
+ * Contains all of the user's permissions, meaning those explicitly given, as well as
42
+ * those provided by the user's roles.
43
+ *
44
+ * The result is a `Set` containing all unique permissions granted to the user.
45
+ */
46
+ readonly effectivePermissions: i0.Signal<Set<string>>;
47
+ /**
48
+ * Computes the user's preferred full name by concatenating the preferred first name
49
+ * and, if available, the preferred last name separated by a space.
50
+ * If the preferred first name is not set, an empty string is used.
51
+ * If the preferred last name is not set, only the first name is returned.
52
+ *
53
+ * @returns The computed preferred full name as a string.
54
+ */
55
+ readonly preferredName: i0.Signal<string>;
56
+ private resetAuthState;
57
+ private setUser;
58
+ /**
59
+ * Redirects the user to the login page.
60
+ *
61
+ * @param nextUri - (Optional) The URI to redirect to after login.
62
+ */
63
+ login(nextUri?: string): void;
64
+ /**
65
+ * Logs the user out by resetting the authentication state and redirecting to the logout page.
66
+ */
67
+ logout(): void;
68
+ /**
69
+ * Retrieves information about the currently authenticated user.
70
+ *
71
+ * @returns A promise that resolves to a `WhoAmI` object
72
+ * representing the current user, or `null` if not authenticated or on error.
73
+ */
74
+ private whoAmI;
75
+ static ɵfac: i0.ɵɵFactoryDeclaration<AuthService, never>;
76
+ static ɵprov: i0.ɵɵInjectableDeclaration<AuthService>;
77
+ }
78
+
79
+ type HeaderLink = {
80
+ /** text content of link */
81
+ text: string;
82
+ /**
83
+ * If the path is a string that starts with `http`, it will be used as an absolute path for the href
84
+ *
85
+ * Else it will be used as a relative path for the routerLink
86
+ */
87
+ path: string | any[] | UrlTree | null | undefined;
88
+ /** if the link should open in a new tab */
89
+ newTab?: boolean;
90
+ };
91
+
92
+ type MenuLink<T extends string> = {
93
+ /** text content of the link */
94
+ text: string;
95
+ /**
96
+ * If the link is a string that starts with `http`, it will be used as an absolute path for the href
97
+ *
98
+ * Else it will be used as a relative path for the routerLink
99
+ */
100
+ path: string | any[] | UrlTree | null | undefined;
101
+ /** if the link should open in a new tab */
102
+ newTab?: boolean;
103
+ /** list of permissions that a user must have at least one of to see the link */
104
+ requiredPermissions?: T[];
105
+ /** if instead the user should have all of the required permissions */
106
+ haveAll?: boolean;
107
+ /** if the user must be authenticated to see the link */
108
+ needsAuthentication?: boolean;
109
+ };
110
+ type MenuDropdown<T extends string> = {
111
+ /** text content of the link */
112
+ text: string;
113
+ /** items to display in the dropdown menu */
114
+ items: MenuLink<T>[];
115
+ };
116
+ type HeaderMenu<T extends string> = MenuLink<T> | MenuDropdown<T>;
117
+ type HeaderConfig<Permission extends string> = {
118
+ /** Main site title: a link or plain text */
119
+ title: HeaderLink | string;
120
+ /** Optional subtitle: a link or plain text */
121
+ subtitle?: HeaderLink | string;
122
+ /** Optional breadcrumbs for navigational context: links or plain texts */
123
+ breadcrumbs?: (HeaderLink | string)[];
124
+ /** Optional menu items: links or dropdowns, potentially restricted by authentication or permissions */
125
+ menu?: HeaderMenu<Permission>[];
126
+ };
127
+ declare class ByuHeaderComponent {
128
+ auth: AuthService;
129
+ config: i0.InputSignal<HeaderConfig<string>>;
130
+ openDropdown: MenuDropdown<string> | null;
131
+ isMenuOpen: i0.WritableSignal<boolean>;
132
+ isMenuLink(item: HeaderMenu<string>): item is MenuLink<string>;
133
+ isMenuLinkVisible(link: MenuLink<string>): boolean;
134
+ isMenuDropdownVisible(dropdown: MenuDropdown<string>): boolean;
135
+ toggleDropdown(dropdown: MenuDropdown<string>): void;
136
+ toggleMenu(): void;
137
+ onDocumentClick(ev: MouseEvent): void;
138
+ static ɵfac: i0.ɵɵFactoryDeclaration<ByuHeaderComponent, never>;
139
+ static ɵcmp: i0.ɵɵComponentDeclaration<ByuHeaderComponent, "byu-header", never, { "config": { "alias": "config"; "required": true; "isSignal": true; }; }, {}, never, never, true, never>;
140
+ }
141
+
142
+ type ConfirmationConfig = {
143
+ title?: string;
144
+ action?: string;
145
+ description?: never;
146
+ buttons?: readonly string[];
147
+ } | {
148
+ title?: string;
149
+ action?: never;
150
+ description?: string;
151
+ buttons?: readonly string[];
152
+ };
153
+ type ConfirmationResult<C extends ConfirmationConfig | undefined> = C extends {
154
+ buttons: readonly string[];
155
+ } ? C['buttons'][number] : boolean;
156
+ declare class ConfirmationDialogContainer {
157
+ protected readonly config: ConfirmationConfig | undefined;
158
+ static ɵfac: i0.ɵɵFactoryDeclaration<ConfirmationDialogContainer, never>;
159
+ static ɵcmp: i0.ɵɵComponentDeclaration<ConfirmationDialogContainer, "fhss-confirmation", never, {}, {}, never, never, true, never>;
160
+ }
161
+ declare class ConfirmationDialog {
162
+ private readonly dialog;
163
+ open<C extends ConfirmationConfig | undefined>(config?: C): _angular_material_dialog.MatDialogRef<ConfirmationDialogContainer, ConfirmationResult<C>>;
164
+ static ɵfac: i0.ɵɵFactoryDeclaration<ConfirmationDialog, never>;
165
+ static ɵprov: i0.ɵɵInjectableDeclaration<ConfirmationDialog>;
166
+ }
167
+
168
+ type value = string | number;
169
+ type Option = {
170
+ label: string;
171
+ value: value | null;
172
+ };
173
+ type Boolish = string | boolean | undefined;
174
+ declare class ComboBoxComponent {
175
+ options: i0.InputSignal<Option[]>;
176
+ placeholder: i0.InputSignal<string>;
177
+ appearance: i0.InputSignal<"fill" | "outline">;
178
+ multiple: i0.InputSignalWithTransform<boolean, Boolish>;
179
+ showClear: i0.InputSignalWithTransform<boolean, Boolish>;
180
+ /**
181
+ * Takes a signal to store the selected value(s) in.
182
+ */
183
+ selected: i0.ModelSignal<value | value[] | null>;
184
+ filter: i0.WritableSignal<string>;
185
+ protected isOptionHidden: (opt: Option) => boolean;
186
+ clearSelected(): void;
187
+ static ɵfac: i0.ɵɵFactoryDeclaration<ComboBoxComponent, never>;
188
+ static ɵcmp: i0.ɵɵComponentDeclaration<ComboBoxComponent, "fhss-combo-box", never, { "options": { "alias": "options"; "required": true; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": true; "isSignal": true; }; "appearance": { "alias": "appearance"; "required": false; "isSignal": true; }; "multiple": { "alias": "multiple"; "required": false; "isSignal": true; }; "showClear": { "alias": "showClear"; "required": false; "isSignal": true; }; "selected": { "alias": "selected"; "required": true; "isSignal": true; }; }, { "selected": "selectedChange"; }, never, never, true, never>;
189
+ }
190
+
191
+ declare const FHSS_CONFIG: InjectionToken<FhssConfig>;
192
+ interface FhssConfig {
193
+ rolePermissionMap: Record<string, string[]>;
194
+ }
195
+
196
+ declare const provideFhss: (config: FhssConfig) => Provider;
197
+
198
+ declare class ScrollAnchorDirective {
199
+ private element;
200
+ private readonly registery;
201
+ scrollAnchor: i0.InputSignal<string>;
202
+ constructor(element: ElementRef<HTMLElement>);
203
+ ngOnInit(): void;
204
+ ngOnDestroy(): void;
205
+ static ɵfac: i0.ɵɵFactoryDeclaration<ScrollAnchorDirective, never>;
206
+ static ɵdir: i0.ɵɵDirectiveDeclaration<ScrollAnchorDirective, "[scrollAnchor]", never, { "scrollAnchor": { "alias": "scrollAnchor"; "required": true; "isSignal": true; }; }, {}, never, never, true, never>;
207
+ }
208
+
209
+ /**
210
+ * This guard checks if the client is authenticated, redirecting to login if not.
211
+ */
212
+ declare const authGuard: CanActivateFn;
213
+
214
+ /**
215
+ * A permission-based route guard.
216
+ *
217
+ * This guard checks if the current user has the required permissions to access a route.
218
+ * If the user is not authenticated, they are redirected to the login page.
219
+ * If the user lacks the necessary permissions, they are redirected to the `/forbidden` page.
220
+ *
221
+ * Pass the Permission type to get intellisense on requiredPermissions
222
+ * @param requiredPermissions - An array of permission strings that the user must have.
223
+ * @param haveAll - If `true`, the user must have all required permissions. If `false` or omitted, the user must have at least one of the required permissions.
224
+ * @returns A `CanActivateFn` function to be used as a route guard.
225
+ *
226
+ * @example
227
+ * ```typescript
228
+ * const routes: Routes = [
229
+ * {
230
+ * path: 'admin',
231
+ * component: AdminPage,
232
+ * canActivate: [permissionGuard<Permission>(['manage-users', 'see-data'], true)],
233
+ * },
234
+ * ];
235
+ * ```
236
+ */
237
+ declare const permissionGuard: <Permission extends string>(requiredPermissions: Permission[], haveAll?: boolean) => CanActivateFn;
238
+
239
+ type SystemConfig = {
240
+ title?: string;
241
+ message?: string;
242
+ image?: string;
243
+ };
244
+
245
+ declare class AuthErrorPage {
246
+ protected readonly config: SystemConfig;
247
+ static ɵfac: i0.ɵɵFactoryDeclaration<AuthErrorPage, never>;
248
+ static ɵcmp: i0.ɵɵComponentDeclaration<AuthErrorPage, "fhss-auth-error", never, {}, {}, never, never, true, never>;
249
+ }
250
+
251
+ declare class ForbiddenPage {
252
+ protected readonly config: SystemConfig;
253
+ static ɵfac: i0.ɵɵFactoryDeclaration<ForbiddenPage, never>;
254
+ static ɵcmp: i0.ɵɵComponentDeclaration<ForbiddenPage, "fhss-forbidden", never, {}, {}, never, never, true, never>;
255
+ }
256
+
257
+ declare class NotFoundPage {
258
+ protected readonly config: SystemConfig;
259
+ static ɵfac: i0.ɵɵFactoryDeclaration<NotFoundPage, never>;
260
+ static ɵcmp: i0.ɵɵComponentDeclaration<NotFoundPage, "fhss-not-found", never, {}, {}, never, never, true, never>;
261
+ }
262
+
263
+ declare class ServerErrorPage {
264
+ protected readonly config: SystemConfig;
265
+ static ɵfac: i0.ɵɵFactoryDeclaration<ServerErrorPage, never>;
266
+ static ɵcmp: i0.ɵɵComponentDeclaration<ServerErrorPage, "fhss-server-error", never, {}, {}, never, never, true, never>;
267
+ }
268
+
269
+ declare class ScrollRegistryService {
270
+ private anchors;
271
+ private pending;
272
+ register(key: string, el: HTMLElement): void;
273
+ unregister(key: string): void;
274
+ scrollTo(key: string, opts?: ScrollIntoViewOptions & {
275
+ delay?: number;
276
+ }): void;
277
+ static ɵfac: i0.ɵɵFactoryDeclaration<ScrollRegistryService, never>;
278
+ static ɵprov: i0.ɵɵInjectableDeclaration<ScrollRegistryService>;
279
+ }
280
+
281
+ type ResolverDef = {
282
+ input: any;
283
+ output: any;
284
+ transformer: boolean;
285
+ errorShape: any;
286
+ };
287
+ type TrpcResourceOptions<TOutput> = {
288
+ /**
289
+ * Whether or not the request should be fetched reactively when the request updates.
290
+ */
291
+ autoRefresh?: boolean;
292
+ /**
293
+ * Optional computation that will be used in a `linkedSignal` definition of the `trpcResource` value.
294
+ */
295
+ valueComputation?: () => NoInfer<TOutput>;
296
+ /**
297
+ * Value that the `trpcResource` will take when in the Idle or Error states.
298
+ *
299
+ * If not set, the `trpcResource` will use `undefined` as its default value.
300
+ */
301
+ defaultValue?: NoInfer<TOutput> | undefined;
302
+ /**
303
+ * Value that the `trpcResource` will take when first initialized.
304
+ *
305
+ * If not set, the `trpcResource` will use `defaultValue` as its initial value.
306
+ */
307
+ initialValue?: NoInfer<TOutput> | undefined;
308
+ /**
309
+ * The `Injector` in which to create the `trpcResource`.
310
+ *
311
+ * If this is not provided, the current
312
+ * [injection context](https://angular.dev/guide/di/dependency-injection-context)
313
+ * will be used instead (via `inject`).
314
+ */
315
+ injector?: Injector | undefined;
316
+ /**
317
+ * A comparison function which defines equality for the response value.
318
+ */
319
+ equal?: ValueEqualityFn<NoInfer<TOutput | undefined>> | undefined;
320
+ };
321
+ type Expand<T> = T extends infer O ? {
322
+ [K in keyof O]: O[K];
323
+ } : never;
324
+ type _TrpcResource<TDef extends ResolverDef> = {
325
+ /**
326
+ * Signal of the tRPC procedure output, when available.
327
+ * This value will persist while the `trpcResource` is loading.
328
+ */
329
+ value: WritableSignal<TDef["output"] | undefined>;
330
+ /**
331
+ * Signal of the tRPC procedure error, when available.
332
+ */
333
+ error: WritableSignal<TDef['errorShape'] | undefined>;
334
+ /**
335
+ * Whether this `trpcResource` is loading a new value (or reloading the existing one).
336
+ */
337
+ isLoading: WritableSignal<boolean>;
338
+ /**
339
+ * Instructs the `trpcResource` to call the procedure with the current reactive dependencies.
340
+ * @param abortSignal Optional abort signal to abort the procedure call.
341
+ * @param keepLoadingThroughAbort Whether the `trpcResource` should maintain a loading state after an abort.
342
+ * This is useful when another refresh is the cause of an abort so the resource appears to keep loading.
343
+ * @returns true if there was no error during the call
344
+ */
345
+ refresh: (abortSignal?: AbortSignal, keepLoadingThroughAbort?: boolean) => Promise<boolean>;
346
+ };
347
+ /**
348
+ * Represents the reactive result of an tRPC request.
349
+ */
350
+ type TrpcResource<TDef extends ResolverDef> = Expand<_TrpcResource<TDef>>;
351
+
352
+ declare function trpcResource<TDef extends ResolverDef>(procedure: Resolver<TDef>, input: () => TDef['input'] | undefined, options?: TrpcResourceOptions<TDef['output']>): TrpcResource<TDef>;
353
+ declare function debugTrpcResource<TDef extends ResolverDef>(_trpcResource: TrpcResource<TDef>): {
354
+ value: TDef["output"] | undefined;
355
+ error: TDef["errorShape"] | undefined;
356
+ isLoading: boolean;
357
+ };
358
+
2
359
  type JsonValue = string | number | boolean | null | JsonArray | JsonObject;
3
- export type JsonObject = {
360
+ type JsonObject = {
4
361
  [key: string]: JsonValue;
5
362
  };
6
363
  type JsonArray = JsonValue[];
7
- export type Json = JsonObject | JsonArray;
8
- export type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
364
+ type Json = JsonObject | JsonArray;
9
365
  type DefaultError = {
10
366
  code?: string;
11
367
  message?: string;
12
368
  details?: Json;
13
369
  };
14
370
  type KnownHeaderKeys = 'Accept' | 'Accept-Encoding' | 'Accept-Language' | 'Access-Control-Request-Headers' | 'Access-Control-Request-Method' | 'Authorization' | 'Cache-Control' | 'Connection' | 'Content-Encoding' | 'Content-Length' | 'Content-Type' | 'Cookie' | 'Date' | 'Expect' | 'Forwarded' | 'From' | 'Host' | 'If-Match' | 'If-Modified-Since' | 'If-None-Match' | 'If-Range' | 'If-Unmodified-Since' | 'Keep-Alive' | 'Max-Forwards' | 'Origin' | 'Prefer' | 'Priority' | 'Proxy-Authorization' | 'Range' | 'Referer' | 'TE' | 'Transfer-Encoding' | 'Upgrade' | 'User-Agent' | 'Via';
15
- /**
16
- * A value that may be a plain value of type `T` or a reactive `Signal<T>`.
17
- *
18
- * This is useful in APIs that accept either static or reactive values,
19
- * allowing flexibility while maintaining type safety.
20
- *
21
- * Use `unwrapSignal` to extract the underlying value in a uniform way.
22
- *
23
- * @template T The underlying value type.
24
- */
25
- export type MaybeSignal<T> = T | Signal<T>;
26
- /**
27
- * Reads the underlying value from a MaybeSignal.
28
- *
29
- * This function is designed for use with reactive APIs (like fetchSignal) where it's important
30
- * that Angular's computed methods register the dependency. If the input is a Signal, invoking it
31
- * not only returns its current value but also tracks the signal for reactivity. If the input is
32
- * a plain value, it simply returns that value.
33
- *
34
- * @template T The type of the value.
35
- * @param value A plain value or a Signal that yields the value.
36
- * @returns The current value, with dependency tracking enabled if the input is a Signal.
37
- */
38
- export declare function readMaybeSignal<T>(value: MaybeSignal<T>): T;
39
371
  /**
40
372
  * The structure of an `fetchSignal` request which will be sent to the backend via the Fetch API.
41
373
  */
42
- export type FetchSignalRequest = {
374
+ type FetchSignalRequest = {
43
375
  /**
44
376
  * URL of the request.
45
377
  *
@@ -79,8 +411,8 @@ export type FetchSignalRequest = {
79
411
  * `resolved` - Loading has completed and the fetch signal has the value returned from the loader.
80
412
  *
81
413
  */
82
- export type FetchSignalStatus = 'idle' | 'error' | 'loading' | 'resolved' | 'destroyed';
83
- export type FetchSignalOptions<TResult, TRaw> = {
414
+ type FetchSignalStatus = 'idle' | 'error' | 'loading' | 'resolved' | 'destroyed';
415
+ type FetchSignalOptions<TResult, TRaw> = {
84
416
  /**
85
417
  * Whether or not the request should be fetched reactively when the request updates.
86
418
  */
@@ -114,11 +446,10 @@ export type FetchSignalOptions<TResult, TRaw> = {
114
446
  */
115
447
  equal?: ValueEqualityFn<NoInfer<TResult | undefined>> | undefined;
116
448
  };
117
- export type ResponseTransformer<T> = (response: Response) => Promise<T>;
118
449
  /**
119
450
  * Represents the reactive result of an HTTP fetch request.
120
451
  */
121
- export type FetchSignal<Response, ErrorResponse = DefaultError> = {
452
+ type FetchSignal<Response, ErrorResponse = DefaultError> = {
122
453
  /**
123
454
  * Signal of the HTTP response body when the response is `ok`, when available.
124
455
  * This value will persist while the fetchSignal is loading.
@@ -163,7 +494,7 @@ export type FetchSignal<Response, ErrorResponse = DefaultError> = {
163
494
  */
164
495
  destroy: () => void;
165
496
  };
166
- export type FetchSignalFactory = {
497
+ type FetchSignalFactory = {
167
498
  /**
168
499
  * Initiates a reactive HTTP GET request using the provided request configuration.
169
500
  *
@@ -457,4 +788,10 @@ export type FetchSignalFactory = {
457
788
  arrayBuffer: <ErrorResponse extends Json = DefaultError>(request: () => FetchSignalRequest, options?: FetchSignalOptions<ArrayBuffer, ArrayBuffer>) => FetchSignal<ArrayBuffer, ErrorResponse>;
458
789
  };
459
790
  };
460
- export {};
791
+
792
+ declare const fetchSignal: FetchSignalFactory;
793
+
794
+ declare const debounced: <T>(inputSignal: Signal<T>, wait?: number) => i0.WritableSignal<T>;
795
+
796
+ export { AuthErrorPage, AuthService, ByuFooterComponent, ByuHeaderComponent, ComboBoxComponent, ConfirmationDialog, FHSS_CONFIG, ForbiddenPage, NotFoundPage, ScrollAnchorDirective, ScrollRegistryService, ServerErrorPage, authGuard, debounced, debugTrpcResource, fetchSignal, permissionGuard, provideFhss, trpcResource };
797
+ export type { FhssConfig, HeaderConfig, Json, Option };
package/index.d.ts DELETED
@@ -1,5 +0,0 @@
1
- /**
2
- * Generated bundle index. Do not edit.
3
- */
4
- /// <amd-module name="@fhss-web-team/frontend-utils" />
5
- export * from './public-api';
@@ -1,6 +0,0 @@
1
- import * as i0 from "@angular/core";
2
- export declare class ByuFooterComponent {
3
- currentYear: number;
4
- static ɵfac: i0.ɵɵFactoryDeclaration<ByuFooterComponent, never>;
5
- static ɵcmp: i0.ɵɵComponentDeclaration<ByuFooterComponent, "byu-footer", never, {}, {}, never, never, true, never>;
6
- }
@@ -1,30 +0,0 @@
1
- import { UrlTree } from "@angular/router";
2
- import * as i0 from "@angular/core";
3
- export type HeaderLink = {
4
- /** text content of link */
5
- text: string;
6
- /**
7
- * If the path is a string that starts with `http`, it will be used as an absolute path for the href
8
- *
9
- * Else it will be used as a relative path for the routerLink
10
- */
11
- path: string | any[] | UrlTree | null | undefined;
12
- /** if the link should open in a new tab */
13
- newTab?: boolean;
14
- };
15
- export declare class NormalizedHeaderItem {
16
- headerItem: import("@angular/core").InputSignal<string | HeaderLink>;
17
- normalizeHeaderItem: import("@angular/core").Signal<{
18
- text: string;
19
- routerLink: null;
20
- href: null;
21
- newTab: null;
22
- } | {
23
- text: string;
24
- routerLink: string | any[] | UrlTree | null | undefined;
25
- href: string | null;
26
- newTab: boolean;
27
- }>;
28
- static ɵfac: i0.ɵɵFactoryDeclaration<NormalizedHeaderItem, never>;
29
- static ɵcmp: i0.ɵɵComponentDeclaration<NormalizedHeaderItem, "byu-header-link", never, { "headerItem": { "alias": "headerItem"; "required": true; "isSignal": true; }; }, {}, never, never, true, never>;
30
- }
@@ -1,54 +0,0 @@
1
- import { UrlTree } from '@angular/router';
2
- import { AuthService } from '../../services/auth/auth.service';
3
- import { HeaderLink } from './byu-header-link/byu-header-link';
4
- import * as i0 from "@angular/core";
5
- type MenuLink<T extends string> = {
6
- /** text content of the link */
7
- text: string;
8
- /**
9
- * If the link is a string that starts with `http`, it will be used as an absolute path for the href
10
- *
11
- * Else it will be used as a relative path for the routerLink
12
- */
13
- path: string | any[] | UrlTree | null | undefined;
14
- /** if the link should open in a new tab */
15
- newTab?: boolean;
16
- /** list of permissions that a user must have at least one of to see the link */
17
- requiredPermissions?: T[];
18
- /** if instead the user should have all of the required permissions */
19
- haveAll?: boolean;
20
- /** if the user must be authenticated to see the link */
21
- needsAuthentication?: boolean;
22
- };
23
- type MenuDropdown<T extends string> = {
24
- /** text content of the link */
25
- text: string;
26
- /** items to display in the dropdown menu */
27
- items: MenuLink<T>[];
28
- };
29
- type HeaderMenu<T extends string> = MenuLink<T> | MenuDropdown<T>;
30
- export type HeaderConfig<Permission extends string> = {
31
- /** Main site title: a link or plain text */
32
- title: HeaderLink | string;
33
- /** Optional subtitle: a link or plain text */
34
- subtitle?: HeaderLink | string;
35
- /** Optional breadcrumbs for navigational context: links or plain texts */
36
- breadcrumbs?: (HeaderLink | string)[];
37
- /** Optional menu items: links or dropdowns, potentially restricted by authentication or permissions */
38
- menu?: HeaderMenu<Permission>[];
39
- };
40
- export declare class ByuHeaderComponent {
41
- auth: AuthService;
42
- config: import("@angular/core").InputSignal<HeaderConfig<string>>;
43
- openDropdown: MenuDropdown<string> | null;
44
- isMenuOpen: import("@angular/core").WritableSignal<boolean>;
45
- isMenuLink(item: HeaderMenu<string>): item is MenuLink<string>;
46
- isMenuLinkVisible(link: MenuLink<string>): boolean;
47
- isMenuDropdownVisible(dropdown: MenuDropdown<string>): boolean;
48
- toggleDropdown(dropdown: MenuDropdown<string>): void;
49
- toggleMenu(): void;
50
- onDocumentClick(ev: MouseEvent): void;
51
- static ɵfac: i0.ɵɵFactoryDeclaration<ByuHeaderComponent, never>;
52
- static ɵcmp: i0.ɵɵComponentDeclaration<ByuHeaderComponent, "byu-header", never, { "config": { "alias": "config"; "required": true; "isSignal": true; }; }, {}, never, never, true, never>;
53
- }
54
- export {};
@@ -1,24 +0,0 @@
1
- import * as i0 from "@angular/core";
2
- type value = string | number;
3
- export type Option = {
4
- label: string;
5
- value: value | null;
6
- };
7
- type Boolish = string | boolean | undefined;
8
- export declare class ComboBoxComponent {
9
- options: import("@angular/core").InputSignal<Option[]>;
10
- placeholder: import("@angular/core").InputSignal<string>;
11
- appearance: import("@angular/core").InputSignal<"fill" | "outline">;
12
- multiple: import("@angular/core").InputSignalWithTransform<boolean, Boolish>;
13
- showClear: import("@angular/core").InputSignalWithTransform<boolean, Boolish>;
14
- /**
15
- * Takes a signal to store the selected value(s) in.
16
- */
17
- selected: import("@angular/core").ModelSignal<value | value[] | null>;
18
- filter: import("@angular/core").WritableSignal<string>;
19
- protected isOptionHidden: (opt: Option) => boolean;
20
- clearSelected(): void;
21
- static ɵfac: i0.ɵɵFactoryDeclaration<ComboBoxComponent, never>;
22
- static ɵcmp: i0.ɵɵComponentDeclaration<ComboBoxComponent, "fhss-combo-box", never, { "options": { "alias": "options"; "required": true; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": true; "isSignal": true; }; "appearance": { "alias": "appearance"; "required": false; "isSignal": true; }; "multiple": { "alias": "multiple"; "required": false; "isSignal": true; }; "showClear": { "alias": "showClear"; "required": false; "isSignal": true; }; "selected": { "alias": "selected"; "required": true; "isSignal": true; }; }, { "selected": "selectedChange"; }, never, never, true, never>;
23
- }
24
- export {};
@@ -1,27 +0,0 @@
1
- import * as i0 from "@angular/core";
2
- type ConfirmationConfig = {
3
- title?: string;
4
- action?: string;
5
- description?: never;
6
- buttons?: readonly string[];
7
- } | {
8
- title?: string;
9
- action?: never;
10
- description?: string;
11
- buttons?: readonly string[];
12
- };
13
- type ConfirmationResult<C extends ConfirmationConfig | undefined> = C extends {
14
- buttons: readonly string[];
15
- } ? C['buttons'][number] : boolean;
16
- declare class ConfirmationDialogContainer {
17
- protected readonly config: ConfirmationConfig | undefined;
18
- static ɵfac: i0.ɵɵFactoryDeclaration<ConfirmationDialogContainer, never>;
19
- static ɵcmp: i0.ɵɵComponentDeclaration<ConfirmationDialogContainer, "fhss-confirmation", never, {}, {}, never, never, true, never>;
20
- }
21
- export declare class ConfirmationDialog {
22
- private readonly dialog;
23
- open<C extends ConfirmationConfig | undefined>(config?: C): import("@angular/material/dialog").MatDialogRef<ConfirmationDialogContainer, ConfirmationResult<C>>;
24
- static ɵfac: i0.ɵɵFactoryDeclaration<ConfirmationDialog, never>;
25
- static ɵprov: i0.ɵɵInjectableDeclaration<ConfirmationDialog>;
26
- }
27
- export {};
@@ -1,37 +0,0 @@
1
- import { OnInit } from '@angular/core';
2
- import { FhssTableConfig, AnyResolver, AnyResource } from './fhss-table.types';
3
- import { PageEvent } from '@angular/material/paginator';
4
- import { Sort } from '@angular/material/sort';
5
- import { SelectionModel } from '@angular/cdk/collections';
6
- import * as i0 from "@angular/core";
7
- export { makeTableConfig } from './fhss-table.types';
8
- export declare class FhssTableComponent implements OnInit {
9
- private injector;
10
- config: import("@angular/core").InputSignal<FhssTableConfig<AnyResolver>>;
11
- miscParams: import("@angular/core").InputSignal<Record<string, any>>;
12
- columnKeys: string[];
13
- columnsToDisplay: string[];
14
- selection: SelectionModel<any> | undefined;
15
- selectedValues: import("@angular/core").ModelSignal<any[]>;
16
- dataResource: AnyResource;
17
- refresh(): void;
18
- ngOnInit(): void;
19
- search: import("@angular/core").WritableSignal<string>;
20
- debouncedSearch: import("@angular/core").WritableSignal<string>;
21
- filters: import("@angular/core").WritableSignal<Record<string, string>>;
22
- debouncedFilters: import("@angular/core").WritableSignal<Record<string, string>>;
23
- sortBy: import("@angular/core").WritableSignal<string>;
24
- sortDirection: import("@angular/core").WritableSignal<"asc" | "desc">;
25
- pageIndex: import("@angular/core").WritableSignal<number>;
26
- onFilterChange(col: string, val: string): void;
27
- onPaginationChange(e: PageEvent): void;
28
- onSortChange(sort: Sort): void;
29
- onSelectionChange(): void;
30
- onRowClick(row: any): void;
31
- isAllSelected(): boolean;
32
- toggleAllRows(): void;
33
- checkboxLabel(row?: any): string;
34
- protected isBoolean: (val: unknown) => val is boolean;
35
- static ɵfac: i0.ɵɵFactoryDeclaration<FhssTableComponent, never>;
36
- static ɵcmp: i0.ɵɵComponentDeclaration<FhssTableComponent, "fhss-table", never, { "config": { "alias": "config"; "required": true; "isSignal": true; }; "miscParams": { "alias": "miscParams"; "required": false; "isSignal": true; }; "selectedValues": { "alias": "selectedValues"; "required": false; "isSignal": true; }; }, { "selectedValues": "selectedValuesChange"; }, never, ["*"], true, never>;
37
- }