@arsedizioni/ars-utils 22.5.2 → 22.5.4

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,100 +1,130 @@
1
- :root {
1
+ // Palette ARS.
2
+ //
3
+ // I token vivono in tre posti e non in due, e l'ordine conta:
4
+ //
5
+ // :root i valori chiari, sempre
6
+ // @media (prefers-color-scheme: dark) il sistema operativo, finche' nessuno ha scelto
7
+ // body.light / body.dark la scelta dell'utente, che batte il sistema
8
+ //
9
+ // L'ultima riga e' quella che serve: `ThemeService` scrive `light` o `dark` su <body>, anche
10
+ // quando la preferenza e' 'auto' (in quel caso risolve lui contro il sistema). Senza quei due
11
+ // blocchi, un utente che forza il tema scuro su una macchina chiara si ritrova i componenti
12
+ // Material scuri e tutto cio' che dipende da questi token ancora chiaro.
13
+
14
+ @mixin ars-light-tokens {
15
+
16
+ // Colors
17
+ --ars-color-link: #03A9F4;
18
+ --ars-color-link-low: #0288D1;
19
+ --ars-color-accent: #7894ae;
20
+ --ars-color-accent-low: #456179;
21
+ --ars-color-primary: #00a293;
22
+ --ars-color-primary-low: #006a60;
23
+ --ars-color-primary-hi: #12c0ae;
24
+ --ars-color-secondary: #4a635f;
25
+ --ars-color-secondary-low: #27403c;
26
+ --ars-color-error: #ff5449;
27
+ --ars-color-error-low: #a80710;
28
+ --ars-color-ok: #388E3C;
29
+ --ars-color-ok-low: #29692c;
30
+ --ars-color-warning: #FFC107;
31
+ --ars-color-warning-low: #FFA000;
32
+ --ars-color-text: #191c1b;
33
+ --ars-color-text-low: #e0e2e5;
34
+ --ars-color-divider: #757d87;
35
+ --ars-color-overlay: rgba(255, 255, 255, 0.75);
36
+ --ars-color-background: #f7faf8;
37
+ // Dialog surface: shared by the Material dialogs and by ui.shell, which reproduces
38
+ // their look without Material. Each one resolves to the app Material theme when there is
39
+ // one, and to a literal when there is not.
40
+ --ars-dialog-background-color: var(--mat-sys-surface-container-high, #e6eae8);
41
+ --ars-color-on-primary: var(--mat-sys-on-primary, #ffffff);
42
+ --ars-scrim-color: rgba(0, 0, 0, 0.32);
43
+ --ars-dialog-radius: 28px;
44
+ --ars-dialog-elevation: 0 4px 8px 3px rgba(0, 0, 0, 0.15), 0 1px 3px 0 rgba(0, 0, 0, 0.3);
45
+ // Busy overlay and progress indicators (ui.shell reproduces them without Material)
46
+ --ars-busy-scrim-color: rgba(0, 0, 0, 0.42);
47
+ --ars-progress-track-color: var(--mat-sys-surface-container-highest, #d5dbd8);
48
+ --ars-busy-bare-color: #ffffff;
49
+ // Stacking: cdk-overlay-container sits at 1000, so the shell overlays go above it and the
50
+ // busy one below the message, which is the order the CDK stack used to give for free.
51
+ --ars-shell-z-index: 1100;
52
+ --ars-busy-z-index: 1090;
53
+ // Drawer
54
+ --ars-drawer-background-color: #eff1ef;
55
+ --ars-drawer-divider-color: #6f7977;
56
+ // Item
57
+ --ars-item-hover-background-color: var(--mat-icon-button-ripple-color);
58
+ --ars-item-selected-background-color: #EAEEED;
59
+ --ars-dialog-item-selected-background-color: rgba(206, 209, 210, 0.9) !important;
60
+ --ars-dialog-item-hover-background-color: rgba(234, 236, 239, 0.9) !important;
61
+ // Filter Box
62
+ --ars-filterbox-filtered-background-color: #f9fbe7;
63
+ // File Preview
64
+ --ars-filepreview-content-background-color: #f7faf8;
65
+ }
66
+
67
+ @mixin ars-dark-tokens {
68
+
2
69
  // Colors
3
70
  --ars-color-link: #03A9F4;
4
71
  --ars-color-link-low: #0288D1;
5
- --ars-color-accent: #7894ae;
6
- --ars-color-accent-low: #456179;
7
- --ars-color-primary: #00a293;
8
- --ars-color-primary-low: #006a60;
9
- --ars-color-primary-hi: #12c0ae;
10
- --ars-color-secondary: #4a635f;
11
- --ars-color-secondary-low: #27403c;
72
+ --ars-color-accent: #adcae6;
73
+ --ars-color-accent-low: #5e7a93;
74
+ --ars-color-primary: #53dbc9;
75
+ --ars-color-primary-low: #008679;
76
+ --ars-color-primary-hi: #74f8e5;
77
+ --ars-color-secondary: #b1ccc6;
78
+ --ars-color-secondary-low: #627c77;
12
79
  --ars-color-error: #ff5449;
13
80
  --ars-color-error-low: #a80710;
14
- --ars-color-ok: #388E3C;
15
- --ars-color-ok-low: #29692c;
81
+ --ars-color-error-text: #191c1b;
82
+ --ars-color-ok: #4CAF50;
83
+ --ars-color-ok-low: #3f8f41;
16
84
  --ars-color-warning: #FFC107;
17
85
  --ars-color-warning-low: #FFA000;
18
- --ars-color-text: #191c1b;
19
- --ars-color-text-low: #e0e2e5;
86
+ --ars-color-warning-text: #191c1b;
87
+ --ars-color-text: #e0e2e5;
88
+ --ars-color-text-low: #191c1b;
20
89
  --ars-color-divider: #757d87;
21
- --ars-color-overlay: rgba(255, 255, 255, 0.75);
22
- --ars-color-background: #f7faf8;
23
- // Dialog surface: shared by the Material dialogs and by ui.shell, which reproduces
24
- // their look without Material. Each one resolves to the app Material theme when there is
25
- // one, and to a literal when there is not.
26
- --ars-dialog-background-color: var(--mat-sys-surface-container-high, #e6eae8);
27
- --ars-color-on-primary: var(--mat-sys-on-primary, #ffffff);
28
- --ars-scrim-color: rgba(0, 0, 0, 0.32);
29
- --ars-dialog-radius: 28px;
30
- --ars-dialog-elevation: 0 4px 8px 3px rgba(0, 0, 0, 0.15), 0 1px 3px 0 rgba(0, 0, 0, 0.3);
31
- // Busy overlay and progress indicators (ui.shell reproduces them without Material)
32
- --ars-busy-scrim-color: rgba(0, 0, 0, 0.42);
33
- --ars-progress-track-color: var(--mat-sys-surface-container-highest, #d5dbd8);
34
- --ars-busy-bare-color: #ffffff;
35
- // Stacking: cdk-overlay-container sits at 1000, so the shell overlays go above it and the
36
- // busy one below the message, which is the order the CDK stack used to give for free.
37
- --ars-shell-z-index: 1100;
38
- --ars-busy-z-index: 1090;
39
- // Drawer
40
- --ars-drawer-background-color: #eff1ef;
41
- --ars-drawer-divider-color: #6f7977;
90
+ --ars-color-overlay: rgba(0, 0, 0, 0.65);
91
+ --ars-color-background: #101413;
92
+
93
+ // Dialog surface
94
+ --ars-dialog-background-color: var(--mat-sys-surface-container-high, #282a29);
95
+ --ars-color-on-primary: var(--mat-sys-on-primary, #00382f);
96
+ --ars-scrim-color: rgba(0, 0, 0, 0.6);
97
+ // Busy overlay and progress indicators
98
+ --ars-busy-scrim-color: rgba(0, 0, 0, 0.6);
99
+ --ars-progress-track-color: var(--mat-sys-surface-container-highest, #3a3d3c);
100
+ // Drawer
101
+ --ars-drawer-background-color: #212223;
102
+ --ars-drawer-divider-color: #899390;
42
103
  // Item
43
104
  --ars-item-hover-background-color: var(--mat-icon-button-ripple-color);
44
- --ars-item-selected-background-color: #EAEEED;
45
- --ars-dialog-item-selected-background-color: rgba(206, 209, 210, 0.9) !important;
46
- --ars-dialog-item-hover-background-color: rgba(234, 236, 239, 0.9) !important;
105
+ --ars-item-selected-background-color: #1B1F1E;
106
+ --ars-dialog-item-selected-background-color: rgba(63, 67, 66, 0.9) !important;
107
+ --ars-dialog-item-hover-background-color: rgba(38, 42, 41, 0.9) !important;
47
108
  // Filter Box
48
- --ars-filterbox-filtered-background-color: #f9fbe7;
109
+ --ars-filterbox-filtered-background-color: #c6c7b8;
49
110
  // File Preview
50
- --ars-filepreview-content-background-color: #f7faf8;
51
- }
52
-
53
- @media (prefers-color-scheme: dark) {
54
-
55
- :root {
56
- // Colors
57
- --ars-color-link: #03A9F4;
58
- --ars-color-link-low: #0288D1;
59
- --ars-color-accent: #adcae6;
60
- --ars-color-accent-low: #5e7a93;
61
- --ars-color-primary: #53dbc9;
62
- --ars-color-primary-low: #008679;
63
- --ars-color-primary-hi: #74f8e5;
64
- --ars-color-secondary: #b1ccc6;
65
- --ars-color-secondary-low: #627c77;
66
- --ars-color-error: #ff5449;
67
- --ars-color-error-low: #a80710;
68
- --ars-color-error-text: #191c1b;
69
- --ars-color-ok: #4CAF50;
70
- --ars-color-ok-low: #3f8f41;
71
- --ars-color-warning: #FFC107;
72
- --ars-color-warning-low: #FFA000;
73
- --ars-color-warning-text: #191c1b;
74
- --ars-color-text: #e0e2e5;
75
- --ars-color-text-low: #191c1b;
76
- --ars-color-divider: #757d87;
77
- --ars-color-overlay: rgba(0, 0, 0, 0.65);
78
- --ars-color-background: #101413;
79
-
80
- // Dialog surface
81
- --ars-dialog-background-color: var(--mat-sys-surface-container-high, #282a29);
82
- --ars-color-on-primary: var(--mat-sys-on-primary, #00382f);
83
- --ars-scrim-color: rgba(0, 0, 0, 0.6);
84
- // Busy overlay and progress indicators
85
- --ars-busy-scrim-color: rgba(0, 0, 0, 0.6);
86
- --ars-progress-track-color: var(--mat-sys-surface-container-highest, #3a3d3c);
87
- // Drawer
88
- --ars-drawer-background-color: #212223;
89
- --ars-drawer-divider-color: #899390;
90
- // Item
91
- --ars-item-hover-background-color: var(--mat-icon-button-ripple-color);
92
- --ars-item-selected-background-color: #1B1F1E;
93
- --ars-dialog-item-selected-background-color: rgba(63, 67, 66, 0.9) !important;
94
- --ars-dialog-item-hover-background-color: rgba(38, 42, 41, 0.9) !important;
95
- // Filter Box
96
- --ars-filterbox-filtered-background-color: #c6c7b8;
97
- // File Preview
98
- --ars-filepreview-content-background-color: #101413;
99
- }
100
- }
111
+ --ars-filepreview-content-background-color: #101413;
112
+ }
113
+
114
+ :root {
115
+ @include ars-light-tokens;
116
+ }
117
+
118
+ @media (prefers-color-scheme: dark) {
119
+ :root {
120
+ @include ars-dark-tokens;
121
+ }
122
+ }
123
+
124
+ body.light {
125
+ @include ars-light-tokens;
126
+ }
127
+
128
+ body.dark {
129
+ @include ars-dark-tokens;
130
+ }
@@ -24,8 +24,9 @@ interface ShellMessageData {
24
24
  /**
25
25
  * Handle over an open shell message.
26
26
  *
27
- * Not a `MatDialogRef`: there is no Material here, and the shell never needs to reach into
28
- * the component instance. Closing it and knowing when it closed is the whole contract.
27
+ * Not a `MatDialogRef` — there is no Material here — but the two members a caller actually
28
+ * uses of one are the same, and mean the same thing, so moving a call site between
29
+ * `DialogService` and `ShellService` does not change how its result is awaited.
29
30
  */
30
31
  interface ShellMessageRef {
31
32
  /**
@@ -33,8 +34,16 @@ interface ShellMessageRef {
33
34
  * @returns void
34
35
  */
35
36
  close(): void;
36
- /** Resolves once the message has been removed from the DOM. */
37
- readonly closed: Promise<void>;
37
+ /**
38
+ * Emits once and completes when the message has been taken off the screen, whichever way it
39
+ * was dismissed — the button, Escape, the backdrop, the auto-dismiss timer, or a `close()`.
40
+ *
41
+ * Like `MatDialogRef.afterClosed()`, and like it in the corner case too: subscribing after
42
+ * the message is already gone completes without emitting, so it is not a way to ask whether
43
+ * it was closed.
44
+ * @returns An observable of the dismissal.
45
+ */
46
+ afterClosed(): Observable<void>;
38
47
  }
39
48
 
40
49
  /** Visual style of the busy indicator. */
@@ -53,6 +62,24 @@ type ShellBusyMode = 'determinate' | 'indeterminate';
53
62
  * class on the host, never a `createComponent`, so the 40-odd calls a screen costs nothing.
54
63
  */
55
64
  declare class ShellBusyComponent {
65
+ private readonly themeService;
66
+ /**
67
+ * True when the panel must paint itself dark.
68
+ *
69
+ * Read from {@link ThemeService} and not from `prefers-color-scheme`, because the two do not
70
+ * always agree: the service is what the user chose, and it may be forcing dark on a machine
71
+ * that is on light. Following the OS instead would leave this panel the only light thing on a
72
+ * dark screen.
73
+ */
74
+ protected readonly dark: _angular_core.WritableSignal<boolean>;
75
+ /**
76
+ * Keeps {@link dark} in step with the service, now and at every later change.
77
+ *
78
+ * `'auto'` is resolved through `getTheme()`, which is the only thing that knows what the
79
+ * operating system is currently on.
80
+ * @returns void
81
+ */
82
+ private followTheme;
56
83
  /** Whether the overlay is on screen. Hidden with `display: none`, so it costs no layout. */
57
84
  readonly visible: _angular_core.WritableSignal<boolean>;
58
85
  /** Visual style of the indicator. */
@@ -65,6 +92,7 @@ declare class ShellBusyComponent {
65
92
  readonly message: _angular_core.WritableSignal<string>;
66
93
  /** Circumference of the spinner circle, bound to `stroke-dasharray`. */
67
94
  protected readonly circumference: number;
95
+ constructor();
68
96
  /** Length of the spinner arc still to be drawn, derived from {@link progress}. */
69
97
  protected readonly dashOffset: _angular_core.Signal<number>;
70
98
  /**
@@ -110,7 +138,7 @@ declare class ShellService {
110
138
  private readonly environmentInjector;
111
139
  private messageRef?;
112
140
  private messageKind?;
113
- private resolveClosed?;
141
+ private messageClosed?;
114
142
  private previousOverflow?;
115
143
  private previouslyFocused?;
116
144
  private busyRef?;
@@ -154,7 +182,11 @@ declare class ShellService {
154
182
  */
155
183
  private showMessage;
156
184
  /**
157
- * Builds the handle returned to callers, wiring its `closed` promise to the current message.
185
+ * Builds the handle returned to callers.
186
+ *
187
+ * The subject is captured now rather than read at call time, so `afterClosed()` keeps
188
+ * answering about the message this handle was given for, even once another one has taken
189
+ * its place on screen.
158
190
  * @returns The handle over the message currently on screen.
159
191
  */
160
192
  private messageHandle;
@@ -281,6 +313,7 @@ declare class BusyTimer {
281
313
  declare class ShellMessageComponent {
282
314
  /** Emitted when the user dismisses the message, whichever way they did it. */
283
315
  readonly closed: _angular_core.OutputEmitterRef<void>;
316
+ private readonly themeService;
284
317
  private readonly panel;
285
318
  private readonly okButton;
286
319
  /** Unique id tying the panel to its heading for assistive technology. */
@@ -292,6 +325,23 @@ declare class ShellMessageComponent {
292
325
  private dismissTimer?;
293
326
  private copiedTimer?;
294
327
  private closing;
328
+ /**
329
+ * True when the panel must paint itself dark.
330
+ *
331
+ * Read from {@link ThemeService} and not from `prefers-color-scheme`, because the two do not
332
+ * always agree: the service is what the user chose, and it may be forcing dark on a machine
333
+ * that is on light. Following the OS instead would leave this panel the only light thing on a
334
+ * dark screen.
335
+ */
336
+ protected readonly dark: _angular_core.WritableSignal<boolean>;
337
+ /**
338
+ * Keeps {@link dark} in step with the service, now and at every later change.
339
+ *
340
+ * `'auto'` is resolved through `getTheme()`, which is the only thing that knows what the
341
+ * operating system is currently on.
342
+ * @returns void
343
+ */
344
+ private followTheme;
295
345
  constructor();
296
346
  /**
297
347
  * Replaces the content shown by the panel and restarts the auto-dismiss timer.