@arsedizioni/ars-utils 22.5.4 → 22.5.5

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.
@@ -1,220 +0,0 @@
1
- import { Folder, ApiResult } from '@arsedizioni/ars-utils/core';
2
- import * as rxjs from 'rxjs';
3
- import { BehaviorSubject } from 'rxjs';
4
- import * as _angular_core from '@angular/core';
5
- import { OnDestroy } from '@angular/core';
6
- import { BreakpointObserver } from '@angular/cdk/layout';
7
- import { MatSidenav } from '@angular/material/sidenav';
8
- import { MatTree } from '@angular/material/tree';
9
-
10
- interface ChapterParentInfo {
11
- id: string;
12
- name: string;
13
- }
14
- interface Chapter extends Folder {
15
- parents?: ChapterParentInfo[];
16
- }
17
- interface ChapterBag {
18
- chapter: Chapter;
19
- data: string;
20
- hits: number;
21
- }
22
- interface ChapterTree extends Chapter {
23
- subFolders: ChapterTree[];
24
- path: string;
25
- }
26
-
27
- interface HelpViewerDialogData {
28
- id?: string;
29
- }
30
- declare class IndexInfo {
31
- id: string;
32
- parent?: IndexInfo;
33
- name: string;
34
- itemsCount?: number;
35
- children?: IndexInfo[];
36
- }
37
- declare class IndexNode extends IndexInfo {
38
- expandable: boolean;
39
- level: number;
40
- constructor(item: IndexInfo, level: number);
41
- }
42
- declare class IndexTreeDataSource implements OnDestroy {
43
- dataChange: BehaviorSubject<IndexInfo[]>;
44
- get data(): IndexInfo[];
45
- ngOnDestroy(): void;
46
- /**
47
- * Initialises the data source with a flat list of root nodes.
48
- * @param data - Array of root `IndexInfo` items to display in the tree.
49
- */
50
- initialize(data: IndexInfo[]): void;
51
- /**
52
- * Recursively searches the tree for a node with the given id.
53
- * @param node - The node to start from, or `null`/`undefined` to search from the root.
54
- * @param id - The id of the node to find.
55
- * @returns The matching `IndexInfo`, or `undefined` if not found.
56
- */
57
- findNode(node: IndexInfo | undefined | null, id: string): IndexInfo | undefined;
58
- /**
59
- * Removes the node with the given id from the tree.
60
- * @param id - The id of the node to remove.
61
- */
62
- removeNode(id: string): void;
63
- /**
64
- * Inserts a new node at the beginning of its parent's children, or at the root.
65
- * @param node - The `IndexInfo` node to insert.
66
- */
67
- insertNode(node: IndexInfo): void;
68
- /**
69
- * Renames a node in the tree.
70
- * @param id - The id of the node to rename.
71
- * @param name - The new display name.
72
- */
73
- renameNode(id: string, name: string): void;
74
- /**
75
- * Re-emits the current data to all subscribers, triggering a tree refresh.
76
- */
77
- update(): void;
78
- static ɵfac: _angular_core.ɵɵFactoryDeclaration<IndexTreeDataSource, never>;
79
- static ɵprov: _angular_core.ɵɵInjectableDeclaration<IndexTreeDataSource>;
80
- }
81
- declare class HelpViewerComponent {
82
- readonly indexPane: _angular_core.Signal<MatSidenav>;
83
- private readonly destroyRef;
84
- private readonly dialogRef;
85
- protected readonly dialogData: HelpViewerDialogData;
86
- private readonly dialogService;
87
- private readonly helpService;
88
- protected readonly breakpointObserver: BreakpointObserver;
89
- protected readonly busy: _angular_core.WritableSignal<boolean>;
90
- protected readonly page: _angular_core.WritableSignal<string>;
91
- private indexId;
92
- private indexPaneClosed;
93
- protected indexNode: IndexInfo | undefined;
94
- private readonly history;
95
- protected readonly canGoBack: _angular_core.Signal<boolean>;
96
- private tree;
97
- readonly matTree: _angular_core.Signal<MatTree<IndexNode, IndexNode>>;
98
- /** Provides the level of a flat node to the tree component. */
99
- protected readonly levelAccessor: (node: IndexNode) => number;
100
- /** Flat list of all tree nodes used as the tree data source. */
101
- protected readonly flatNodes: _angular_core.WritableSignal<IndexNode[]>;
102
- private folders?;
103
- protected hasChild: (_: number, _node: IndexNode) => boolean;
104
- constructor();
105
- /**
106
- * Handle filter pane visibility
107
- */
108
- private handleFilterPaneVisibility;
109
- /**
110
- * Shows or hides the index pane when the user clicks the toggle button.
111
- * Also tracks the user's explicit intent so the pane is not auto-reopened.
112
- */
113
- protected toggleIndexPane(): void;
114
- /**
115
- * Closes the help viewer dialog.
116
- */
117
- protected close(): void;
118
- /**
119
- * Loads the table of contents from the help service and populates the tree.
120
- */
121
- protected getToc(): void;
122
- /**
123
- * Intercepts anchor clicks inside the help page and navigates to the referenced chapter.
124
- * @param e - The click `MouseEvent` from the page content area.
125
- * @returns `false` to prevent default browser navigation.
126
- */
127
- protected gotoChapter(e: MouseEvent): boolean;
128
- /**
129
- * Searches the folder list for a node matching the given id.
130
- * @param id - The id of the folder to locate.
131
- * @returns The matching `IndexInfo`, or `undefined` if not found.
132
- */
133
- private findFolder;
134
- /**
135
- * Expands the tree node that corresponds to the currently selected chapter,
136
- * and all its ancestor nodes.
137
- */
138
- private expandCurrentFolder;
139
- /**
140
- * Recursively flattens a nested IndexInfo tree into a depth-first ordered array of IndexNodes.
141
- * @param items - Root-level nodes to flatten.
142
- * @param level - Current depth level.
143
- */
144
- private flattenNodes;
145
- /**
146
- * Retrieves and displays a help chapter by id.
147
- * Optionally scrolls to an anchor or pixel offset after loading.
148
- * @param id - Chapter id, optionally followed by an anchor (`id#anchor`).
149
- * @param position - Pixel scroll offset to restore (default `0`, meaning top).
150
- */
151
- protected getChapter(id: string, position?: number): void;
152
- /**
153
- * Scrolls the help content to a named anchor or a numeric pixel offset.
154
- * @param anchor - Named anchor (`<a name="…">`) to scroll to, if any.
155
- * @param position - Fallback pixel offset (default `0`).
156
- */
157
- protected gotoPosition(anchor: string | undefined, position?: number): void;
158
- /**
159
- * Returns the current vertical scroll offset of the help content scroller.
160
- * @returns The `scrollTop` value in pixels, or `0` if the element is not found.
161
- */
162
- protected getPosition(): number;
163
- /**
164
- * Scrolls the help content scroller to the specified pixel offset.
165
- * @param position - The vertical pixel offset to scroll to.
166
- */
167
- protected setPosition(position: number): void;
168
- /**
169
- * Navigates back to the previous chapter in the browsing history.
170
- */
171
- protected back(): void;
172
- static ɵfac: _angular_core.ɵɵFactoryDeclaration<HelpViewerComponent, never>;
173
- static ɵcmp: _angular_core.ɵɵComponentDeclaration<HelpViewerComponent, "ng-component", never, {}, {}, never, never, true, never>;
174
- }
175
-
176
- declare class HelpService {
177
- private readonly httpClient;
178
- private readonly dialogService;
179
- private serviceUri;
180
- /**
181
- * Initialises the service with the back-end base URI.
182
- * Must be called once during application bootstrap before any other method.
183
- * @param serviceUri - Base URL of the help service (e.g. `'https://api.example.com'`).
184
- */
185
- initialize(serviceUri: string): void;
186
- /**
187
- * Retrieves the HTML content and metadata of a help chapter.
188
- * @param id - The chapter id.
189
- * @param query - Optional search query to highlight within the chapter content.
190
- * @returns An observable that emits `ApiResult<ChapterBag>`.
191
- */
192
- getChapter(id: string, query?: string | undefined): rxjs.Observable<ApiResult<ChapterBag>>;
193
- /**
194
- * Retrieves metadata (title, path, etc.) for a help chapter without its content.
195
- * @param id - The chapter id.
196
- * @returns An observable that emits `ApiResult<Chapter>`.
197
- */
198
- getChapterInfo(id: string): rxjs.Observable<ApiResult<Chapter>>;
199
- /**
200
- * Retrieves a raw repository file by id.
201
- * @param id - The repository file id.
202
- * @returns An observable that emits `ApiResult<unknown>`.
203
- */
204
- getRepo(id: string): rxjs.Observable<ApiResult<unknown>>;
205
- /**
206
- * Retrieves the table of contents as a hierarchical `IndexInfo` tree.
207
- * @returns An observable that emits `ApiResult<IndexInfo>`.
208
- */
209
- getToc(): rxjs.Observable<ApiResult<IndexInfo>>;
210
- /**
211
- * Opens the help viewer dialog, optionally pre-navigated to a specific chapter.
212
- * @param id - The chapter id to open (default: `'1'`, the root chapter).
213
- */
214
- show(id?: string): void;
215
- static ɵfac: _angular_core.ɵɵFactoryDeclaration<HelpService, never>;
216
- static ɵprov: _angular_core.ɵɵInjectableDeclaration<HelpService>;
217
- }
218
-
219
- export { HelpService, HelpViewerComponent, IndexInfo, IndexNode, IndexTreeDataSource };
220
- export type { Chapter, ChapterBag, ChapterParentInfo, ChapterTree, HelpViewerDialogData };
@@ -1,73 +0,0 @@
1
- import * as _angular_core from '@angular/core';
2
- import { MatPaginator, PageEvent } from '@angular/material/paginator';
3
- import { ScreenService, SelectableModel } from '@arsedizioni/ars-utils/core';
4
- import { SupportNotificationInfo, SupportNotificationsSearchParams } from '@arsedizioni/ars-utils/support.common';
5
-
6
- declare class SupportNotificationsBrowserComponent {
7
- readonly paginator: _angular_core.Signal<MatPaginator>;
8
- protected readonly screenService: ScreenService;
9
- private readonly supportService;
10
- private readonly broadcastService;
11
- private readonly dialogService;
12
- private readonly destroyRef;
13
- protected selection: SelectableModel<SupportNotificationInfo, number>;
14
- protected searchParams: SupportNotificationsSearchParams;
15
- protected total: _angular_core.WritableSignal<number>;
16
- protected items: _angular_core.WritableSignal<SupportNotificationInfo[]>;
17
- constructor();
18
- /**
19
- * Scrolls the notifications list back to the top.
20
- */
21
- private updateScroll;
22
- /**
23
- * Resets the `isMenuOpen` flag on all items after a context menu is closed.
24
- */
25
- protected updateMenuButtonsVisibility(): void;
26
- /**
27
- * Returns the ids of the currently selected items.
28
- * Shows an error and returns `undefined` when the selection exceeds 50 items.
29
- * @returns An array of selected notification ids, or `undefined` on validation failure.
30
- */
31
- private getSelectedIds;
32
- /**
33
- * Returns the CSS class to apply to the read-state indicator stripe.
34
- * @param item - The notification to evaluate.
35
- * @returns `'unread-bg'` when the notification has not been read, otherwise `undefined`.
36
- */
37
- protected getItemStateCssClass(item: SupportNotificationInfo): string | undefined;
38
- /**
39
- * Returns the tooltip text for the read-state indicator stripe.
40
- * @param item - The notification to evaluate.
41
- * @returns `'Non letto'` when unread, otherwise an empty string.
42
- */
43
- protected getItemStateTooltip(item: SupportNotificationInfo): string;
44
- /**
45
- * Resets pagination to page 0 and fetches a fresh result set.
46
- */
47
- protected find(): void;
48
- /**
49
- * Fetches the current page of notifications from the server.
50
- */
51
- private fetch;
52
- /**
53
- * Handles paginator page changes and loads the corresponding result page.
54
- * @param e - The `PageEvent` emitted by `MatPaginator`.
55
- */
56
- protected fetchMore(e: PageEvent): void;
57
- /**
58
- * Marks one or more notifications as read or unread.
59
- * When no specific item is supplied, acts on the current selection.
60
- * @param item - A single notification to mark, or `undefined` to use the selection.
61
- * @param unmark - `true` to mark as unread; `false` (default) to mark as read.
62
- */
63
- protected mark(item?: SupportNotificationInfo, unmark?: boolean): void;
64
- /**
65
- * Opens the notification detail dialog for the given item.
66
- * @param item - The notification to display.
67
- */
68
- protected show(item: SupportNotificationInfo): void;
69
- static ɵfac: _angular_core.ɵɵFactoryDeclaration<SupportNotificationsBrowserComponent, never>;
70
- static ɵcmp: _angular_core.ɵɵComponentDeclaration<SupportNotificationsBrowserComponent, "ng-component", never, {}, {}, never, never, true, never>;
71
- }
72
-
73
- export { SupportNotificationsBrowserComponent };
@@ -1,63 +0,0 @@
1
- import * as _angular_core from '@angular/core';
2
-
3
- declare class TinymceUtils {
4
- /**
5
- * Returns `true` when the user agent currently prefers a dark color scheme.
6
- * Evaluated on demand (not frozen at module load) and SSR-safe.
7
- */
8
- private static prefersDark;
9
- /** URL of the TinyMCE script hosted on the Tiny Cloud CDN. */
10
- static readonly CDN_URL = "https://cdn.tiny.cloud/1/5lnoc6ohmpjau6zyzgqyhyf52cueoennkcs8v1yfoak57ku9/tinymce/7/tinymce.min.js";
11
- /** URL of the locally bundled TinyMCE script. */
12
- static readonly LOCAL_URL = "/assets/tinymce/tinymce.min.js";
13
- /**
14
- * Full-featured TinyMCE base configuration with all standard plugins and toolbar.
15
- */
16
- static TinymceConfig: Record<string, any>;
17
- /**
18
- * Compact TinyMCE configuration with autoresize, bottom toolbar, and grouped toolbar buttons.
19
- * Extends `TinymceConfig` with reduced height and a simplified toolbar.
20
- */
21
- static TinymceCompactConfig: Record<string, any>;
22
- /**
23
- * Extended compact TinyMCE configuration that adds fullscreen support and an insert group.
24
- * Extends `TinymceCompactConfig`.
25
- */
26
- static TinymceCompactExtendedConfig: Record<string, any>;
27
- /**
28
- * Inject the TinyMCE script tag into the document head if it is not already present.
29
- * @param useCDN - When `true`, loads from the Tiny Cloud CDN; otherwise uses the local asset.
30
- */
31
- static loadTinyMCEScript(useCDN?: boolean): void;
32
- }
33
-
34
- interface FullScreenEditorDialogData {
35
- text: string;
36
- configuration: Record<string, any>;
37
- infoButtonLabel?: string;
38
- onShowInfo?: Function;
39
- disabled?: boolean;
40
- }
41
- declare class FullScreenEditorComponent {
42
- /** Emitted with the edited text when the user saves. */
43
- readonly saving: _angular_core.OutputEmitterRef<string>;
44
- private readonly dialogRef;
45
- /** Dialog configuration, injected and exposed as a signal. */
46
- protected readonly dialogData: _angular_core.WritableSignal<FullScreenEditorDialogData>;
47
- /** Whether the editor is in read-only mode. */
48
- protected readonly disabled: _angular_core.WritableSignal<boolean>;
49
- /** Current editor content, kept as a plain field for [(ngModel)] two-way binding. */
50
- protected text: string;
51
- /** TinyMCE editor configuration. */
52
- protected tinymceConfig: Record<string, any>;
53
- constructor();
54
- /**
55
- * Save the current editor content and close the dialog.
56
- */
57
- protected ok(): void;
58
- static ɵfac: _angular_core.ɵɵFactoryDeclaration<FullScreenEditorComponent, never>;
59
- static ɵcmp: _angular_core.ɵɵComponentDeclaration<FullScreenEditorComponent, "ng-component", never, {}, { "saving": "saving"; }, never, never, true, never>;
60
- }
61
-
62
- export { FullScreenEditorComponent, TinymceUtils };
63
- export type { FullScreenEditorDialogData };