@scion/components 22.1.0 → 22.3.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.
- package/_index.scss +75 -5
- package/common/package.json +4 -0
- package/design/_theming.scss +25 -10
- package/design/components/_scion-component-dark-tokens.scss +153 -0
- package/design/components/_scion-component-light-tokens.scss +153 -0
- package/design/icons/_scion-icon-font.scss +50 -0
- package/design/themes/_scion-dark-theme.scss +2 -7
- package/design/themes/_scion-light-theme.scss +3 -8
- package/fesm2022/scion-components-common.mjs +251 -0
- package/fesm2022/scion-components-common.mjs.map +1 -0
- package/fesm2022/scion-components-dimension.mjs +7 -6
- package/fesm2022/scion-components-dimension.mjs.map +1 -1
- package/fesm2022/scion-components-icon.mjs +380 -0
- package/fesm2022/scion-components-icon.mjs.map +1 -0
- package/fesm2022/scion-components-menu.mjs +3271 -0
- package/fesm2022/scion-components-menu.mjs.map +1 -0
- package/fesm2022/scion-components-sashbox.mjs +21 -21
- package/fesm2022/scion-components-sashbox.mjs.map +1 -1
- package/fesm2022/scion-components-splitter.mjs +16 -13
- package/fesm2022/scion-components-splitter.mjs.map +1 -1
- package/fesm2022/scion-components-table.mjs +2265 -0
- package/fesm2022/scion-components-table.mjs.map +1 -0
- package/fesm2022/scion-components-text.mjs +322 -0
- package/fesm2022/scion-components-text.mjs.map +1 -0
- package/fesm2022/scion-components-throbber.mjs +15 -15
- package/fesm2022/scion-components-throbber.mjs.map +1 -1
- package/fesm2022/scion-components-viewport.mjs +142 -125
- package/fesm2022/scion-components-viewport.mjs.map +1 -1
- package/icon/package.json +4 -0
- package/menu/package.json +4 -0
- package/package.json +22 -2
- package/table/package.json +4 -0
- package/text/package.json +4 -0
- package/types/scion-components-common.d.ts +185 -0
- package/types/scion-components-icon.d.ts +146 -0
- package/types/scion-components-menu.d.ts +1922 -0
- package/types/scion-components-sashbox.d.ts +4 -2
- package/types/scion-components-splitter.d.ts +4 -3
- package/types/scion-components-table.d.ts +577 -0
- package/types/scion-components-text.d.ts +131 -0
- package/types/scion-components-viewport.d.ts +32 -39
- package/viewport/scrollbar/_scrollbar.scss +4 -4
- package/design/components/_scion-component-tokens.scss +0 -48
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { EnvironmentProviders, PipeTransform, Signal, Injector } from '@angular/core';
|
|
3
|
+
import { MaybeSignal } from '@scion/components/common';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Enables localization of texts used in SCION.
|
|
7
|
+
*
|
|
8
|
+
* A text provider is a function that returns the text for a translation key.
|
|
9
|
+
*
|
|
10
|
+
* Multiple text providers can be registered. Providers are called in registration order. If a provider does not provide the text,
|
|
11
|
+
* the next provider is called, and so on.
|
|
12
|
+
*
|
|
13
|
+
* The translation keys of built-in SCION texts start with the `scion.` prefix. To not localize built-in SCION texts, the text provider can return `undefined` instead.
|
|
14
|
+
*
|
|
15
|
+
* The function:
|
|
16
|
+
* - Can call `inject` to get any required dependencies.
|
|
17
|
+
* - Can use `toSignal` to convert an {@link Observable} to a {@link Signal}.
|
|
18
|
+
*
|
|
19
|
+
* @see SciTextProviderFn
|
|
20
|
+
* @see text
|
|
21
|
+
*/
|
|
22
|
+
declare function provideTextProvider(textProviderFn: SciTextProviderFn | undefined): EnvironmentProviders;
|
|
23
|
+
/**
|
|
24
|
+
* Signature of a function to provide texts.
|
|
25
|
+
*
|
|
26
|
+
* Texts starting with the percent symbol (`%`) are passed to registered text providers for translation, with the percent symbol omitted.
|
|
27
|
+
*
|
|
28
|
+
* A text provider can be registered via {@link provideTextProvider} function.
|
|
29
|
+
*
|
|
30
|
+
* The function:
|
|
31
|
+
* - Can call `inject` to get any required dependencies.
|
|
32
|
+
* - Can call `toSignal` to convert an {@link Observable} to a {@link Signal}.
|
|
33
|
+
*
|
|
34
|
+
* @param key - Translation key of the text.
|
|
35
|
+
* @param params - Parameters used for text interpolation.
|
|
36
|
+
* @returns Text associated with the key, or `undefined` if not found.
|
|
37
|
+
* Localized applications should return the text as {@link Signal} in the current language and update it on language change.
|
|
38
|
+
*/
|
|
39
|
+
type SciTextProviderFn = (key: string, params: {
|
|
40
|
+
[name: string]: string;
|
|
41
|
+
}) => MaybeSignal<string> | undefined;
|
|
42
|
+
/**
|
|
43
|
+
* Represents either a text or a key for translation.
|
|
44
|
+
*
|
|
45
|
+
* A translation key starts with the percent symbol (`%`) and may include parameters in matrix notation for text interpolation.
|
|
46
|
+
*
|
|
47
|
+
* Key and parameters are passed to registered text providers for translation. A text provider can be registered via
|
|
48
|
+
* {@link provideTextProvider} function.
|
|
49
|
+
*
|
|
50
|
+
* Semicolons in interpolation parameters must be escaped with two backslashes (`\\;`).
|
|
51
|
+
*
|
|
52
|
+
* Examples:
|
|
53
|
+
* - `%key`: translation key
|
|
54
|
+
* - `%key;param=value`: translation key with a single interpolation parameter
|
|
55
|
+
* - `%key;param1=value1;param2=value2`: translation key with multiple interpolation parameters
|
|
56
|
+
* - `text`: no translation key; text is returned as is
|
|
57
|
+
*
|
|
58
|
+
* @see provideTextProvider
|
|
59
|
+
*/
|
|
60
|
+
type Translatable = string | `%${string}`;
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Gets the text for given {@link Translatable} from registered text providers.
|
|
64
|
+
*
|
|
65
|
+
* A {@link Translatable} is a string that, if it starts with the percent symbol (`%`), is passed to registered text providers for translation, with the percent symbol omitted.
|
|
66
|
+
* Otherwise, the text is returned as is.
|
|
67
|
+
*
|
|
68
|
+
* A translation key may include parameters in matrix notation for text interpolation. Escape semicolons with two backslashes (`\\;`).
|
|
69
|
+
*
|
|
70
|
+
* Examples:
|
|
71
|
+
* - `%key`: translation key
|
|
72
|
+
* - `%key;param=value`: translation key with a single interpolation parameter
|
|
73
|
+
* - `%key;param1=value1;param2=value2`: translation key with multiple interpolation parameters
|
|
74
|
+
* - `text`: no translation key; text is returned as is
|
|
75
|
+
*/
|
|
76
|
+
declare class SciTextPipe implements PipeTransform {
|
|
77
|
+
private _translatable;
|
|
78
|
+
private _text;
|
|
79
|
+
transform(translatable: Translatable): Signal<string>;
|
|
80
|
+
transform(translatable: Translatable | undefined): Signal<string | undefined>;
|
|
81
|
+
transform(translatable: Translatable | null): Signal<string | null>;
|
|
82
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<SciTextPipe, never>;
|
|
83
|
+
static ɵpipe: i0.ɵɵPipeDeclaration<SciTextPipe, "sciText", true>;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Gets the text for given {@link Translatable} from registered text providers.
|
|
88
|
+
*
|
|
89
|
+
* A {@link Translatable} is a string that, if it starts with the percent symbol (`%`), is passed to registered text providers for translation, with the percent symbol omitted.
|
|
90
|
+
* Otherwise, the text is returned as is.
|
|
91
|
+
*
|
|
92
|
+
* A translation key may include parameters for text interpolation. Interpolation parameters can be passed via options or appended to the translatable in matrix notation.
|
|
93
|
+
* If appended, escape semicolons with two backslashes (`\\;`).
|
|
94
|
+
*
|
|
95
|
+
* Examples:
|
|
96
|
+
*
|
|
97
|
+
* @example - Get the text for a translation key
|
|
98
|
+
* ```ts
|
|
99
|
+
* text('%key');
|
|
100
|
+
* ```
|
|
101
|
+
*
|
|
102
|
+
* @example - Get the text for a translation key with interpolation parameters
|
|
103
|
+
* ```ts
|
|
104
|
+
* text('%key;param1=value1;param2=value2');
|
|
105
|
+
* ```
|
|
106
|
+
*
|
|
107
|
+
* @example - Alternatively, pass interpolation parameters via options
|
|
108
|
+
* ```ts
|
|
109
|
+
* text('%key', {params: {param1: 'value1', param2: 'value2'}});
|
|
110
|
+
* ```
|
|
111
|
+
*
|
|
112
|
+
* The function:
|
|
113
|
+
* - Must be called within an injection context, or an explicit {@link Injector} passed.
|
|
114
|
+
* - Must be called in a non-reactive (non-tracking) context.
|
|
115
|
+
*
|
|
116
|
+
* @param translatable - Translation key (starts with `%`) or plain text.
|
|
117
|
+
* @param options - Controls translation.
|
|
118
|
+
* @param options.injector - Injector to call text providers. Defaults to the current injection context.
|
|
119
|
+
* Note: Text providers may allocate resources that are released only when this injector is destroyed. Destroy the injector when the text is no longer needed.
|
|
120
|
+
* @param options.params - Parameters for text interpolation.
|
|
121
|
+
* @returns Signal with the translated text.
|
|
122
|
+
*
|
|
123
|
+
* @see provideTextProvider
|
|
124
|
+
*/
|
|
125
|
+
declare function text<T extends Translatable | null | undefined>(translatable: MaybeSignal<T>, options?: {
|
|
126
|
+
injector?: Injector;
|
|
127
|
+
params?: Record<string, unknown> | Map<string, unknown>;
|
|
128
|
+
}): Signal<T extends null | undefined ? T : string>;
|
|
129
|
+
|
|
130
|
+
export { SciTextPipe, provideTextProvider, text };
|
|
131
|
+
export type { SciTextProviderFn, Translatable };
|
|
@@ -1,35 +1,6 @@
|
|
|
1
1
|
import * as _angular_core from '@angular/core';
|
|
2
2
|
import { Signal, ElementRef } from '@angular/core';
|
|
3
3
|
|
|
4
|
-
/**
|
|
5
|
-
* Provides the native scrollbar tracksize.
|
|
6
|
-
*/
|
|
7
|
-
declare class SciNativeScrollbarTrackSizeProvider {
|
|
8
|
-
private readonly _document;
|
|
9
|
-
private readonly _zone;
|
|
10
|
-
/**
|
|
11
|
-
* Provides the track size of the native scrollbar, or `null` if the native scrollbars sit on top of the content.
|
|
12
|
-
*/
|
|
13
|
-
trackSize: Signal<NativeScrollbarTrackSize | null>;
|
|
14
|
-
constructor();
|
|
15
|
-
/**
|
|
16
|
-
* Computes the native scrollbar track size.
|
|
17
|
-
*
|
|
18
|
-
* @returns native track size, or `null` if the native scrollbars sit on top of the content.
|
|
19
|
-
*/
|
|
20
|
-
private computeTrackSize;
|
|
21
|
-
private createNativeScrollbarTrackSizeSignal;
|
|
22
|
-
static ɵfac: _angular_core.ɵɵFactoryDeclaration<SciNativeScrollbarTrackSizeProvider, never>;
|
|
23
|
-
static ɵprov: _angular_core.ɵɵInjectableDeclaration<SciNativeScrollbarTrackSizeProvider>;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Represents the native scrollbar track size.
|
|
27
|
-
*/
|
|
28
|
-
interface NativeScrollbarTrackSize {
|
|
29
|
-
hScrollbarTrackHeight: number;
|
|
30
|
-
vScrollbarTrackWidth: number;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
4
|
/**
|
|
34
5
|
* Represents a viewport with slotted content (`<ng-content>`) used as scrollable content. By default, content is added to a CSS grid layout.
|
|
35
6
|
*
|
|
@@ -109,8 +80,10 @@ declare class SciViewportComponent {
|
|
|
109
80
|
private readonly _host;
|
|
110
81
|
private readonly _viewport;
|
|
111
82
|
private readonly _viewportClient;
|
|
112
|
-
|
|
113
|
-
|
|
83
|
+
/**
|
|
84
|
+
* Indicates whether currently scrolling the viewport.
|
|
85
|
+
*/
|
|
86
|
+
readonly scrolling: Signal<boolean>;
|
|
114
87
|
focus(): void;
|
|
115
88
|
/**
|
|
116
89
|
* Returns the number of pixels that the viewport client is scrolled vertically.
|
|
@@ -179,9 +152,9 @@ declare class SciViewportComponent {
|
|
|
179
152
|
*/
|
|
180
153
|
computeOffset(element: ElementRef<HTMLElement> | HTMLElement, border: 'left' | 'top'): number | null;
|
|
181
154
|
/**
|
|
182
|
-
*
|
|
155
|
+
* Computes whether currently scrolling the viewport.
|
|
183
156
|
*/
|
|
184
|
-
private
|
|
157
|
+
private computeScrolling;
|
|
185
158
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<SciViewportComponent, never>;
|
|
186
159
|
static ɵcmp: _angular_core.ɵɵComponentDeclaration<SciViewportComponent, "sci-viewport", never, { "scrollbarStyle": { "alias": "scrollbarStyle"; "required": false; "isSignal": true; }; }, { "scroll": "scroll"; }, never, never, true, never>;
|
|
187
160
|
}
|
|
@@ -256,13 +229,13 @@ declare class SciScrollbarComponent {
|
|
|
256
229
|
/**
|
|
257
230
|
* Moves the scrollbar thumb to the specified position, scrolling the viewport accordingly.
|
|
258
231
|
*
|
|
259
|
-
* The thumb position must be given in
|
|
232
|
+
* The thumb position must be given in client coordinates (relative to the top-left corner of the page viewport).
|
|
260
233
|
*/
|
|
261
234
|
private scrollViewport;
|
|
262
235
|
/**
|
|
263
|
-
* Returns the position of this component in
|
|
236
|
+
* Returns the position of this component in client coordinates.
|
|
264
237
|
*
|
|
265
|
-
* Returned coordinates are relative to the top-left corner of the
|
|
238
|
+
* Returned coordinates are relative to the top-left corner of the page viewport.
|
|
266
239
|
* Depending on the scrollbar orientation, returned coordinates are `[top, bottom]` or `[left, right]`.
|
|
267
240
|
*/
|
|
268
241
|
private scrollbarComponentPosition;
|
|
@@ -293,9 +266,9 @@ declare class SciScrollbarComponent {
|
|
|
293
266
|
*/
|
|
294
267
|
private thumbSize;
|
|
295
268
|
/**
|
|
296
|
-
* Returns the current thumb position in
|
|
269
|
+
* Returns the current thumb position in client coordinates.
|
|
297
270
|
*
|
|
298
|
-
* Returned coordinates are relative to the top-left corner of the
|
|
271
|
+
* Returned coordinates are relative to the top-left corner of the page viewport.
|
|
299
272
|
* Depending on the scrollbar orientation, returned coordinates are `[top, bottom]` or `[left, right]`.
|
|
300
273
|
*/
|
|
301
274
|
private thumbPosition;
|
|
@@ -319,16 +292,36 @@ declare class SciScrollbarComponent {
|
|
|
319
292
|
* This directive expects its host element to be the only child in document flow in its parent DOM element. It makes the host element
|
|
320
293
|
* fill up the entire space (width and height set to 100%). The parent element must have its CSS `overflow` property set to `hidden`
|
|
321
294
|
* to hide the pushed out native scrollbars.
|
|
295
|
+
*
|
|
296
|
+
* This directive provides the `isNativeScrollbarCropped` signal, which indicates whether native scrollbars are pushed out of the viewport element.
|
|
297
|
+
* In templates, access it via the exported template reference variable `sciScrollable`.
|
|
298
|
+
*
|
|
299
|
+
* ```html
|
|
300
|
+
* <div sciScrollable #sciScrollable="sciScrollable" #viewport>
|
|
301
|
+
* content
|
|
302
|
+
* </div>
|
|
303
|
+
*
|
|
304
|
+
* <!-- Render scrollbars only if native scrollbars are pushed out of the viewport element. -->
|
|
305
|
+
* @if (sciScrollable.isNativeScrollbarCropped()) {
|
|
306
|
+
* <sci-scrollbar [viewport]="viewport" direction="vscroll"/>
|
|
307
|
+
* <sci-scrollbar [viewport]="viewport" direction="hscroll"/>
|
|
308
|
+
* }
|
|
309
|
+
* ```
|
|
322
310
|
*/
|
|
323
311
|
declare class SciScrollableDirective {
|
|
324
312
|
/**
|
|
325
313
|
* Controls whether to display native scrollbars.
|
|
314
|
+
*
|
|
326
315
|
* Has no effect if the native scrollbar sits on top of the content, e.g. in OS X.
|
|
327
316
|
*/
|
|
328
317
|
readonly displayNativeScrollbar: _angular_core.InputSignal<boolean>;
|
|
329
318
|
private readonly _host;
|
|
330
319
|
private readonly _renderer;
|
|
331
320
|
private readonly _nativeScrollbarTrackSizeProvider;
|
|
321
|
+
/**
|
|
322
|
+
* Indicates whether native scrollbars are pushed out of the viewport element.
|
|
323
|
+
*/
|
|
324
|
+
readonly isNativeScrollbarCropped: _angular_core.Signal<boolean>;
|
|
332
325
|
constructor();
|
|
333
326
|
/**
|
|
334
327
|
* Controls the display of the native scrollbar based on this directive's configuration.
|
|
@@ -344,7 +337,7 @@ declare class SciScrollableDirective {
|
|
|
344
337
|
private shiftNativeScrollbars;
|
|
345
338
|
private setStyle;
|
|
346
339
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<SciScrollableDirective, never>;
|
|
347
|
-
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<SciScrollableDirective, "[sciScrollable]",
|
|
340
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<SciScrollableDirective, "[sciScrollable]", ["sciScrollable"], { "displayNativeScrollbar": { "alias": "sciScrollableDisplayNativeScrollbar"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
348
341
|
}
|
|
349
342
|
|
|
350
343
|
export { SciScrollableDirective, SciScrollbarComponent, SciViewportComponent };
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
@use '../theming' as sci-theming;
|
|
2
|
-
|
|
3
|
-
$sci-scrollbar: (
|
|
4
|
-
--sci-scrollbar-color: var(--sci-color-gray-700),
|
|
5
|
-
);
|
|
6
|
-
|
|
7
|
-
$sci-viewport: (
|
|
8
|
-
--sci-viewport-scrollbar-color: var(--sci-scrollbar-color),
|
|
9
|
-
);
|
|
10
|
-
|
|
11
|
-
$sci-throbber: (
|
|
12
|
-
--sci-throbber-color: var(--sci-color-gray-300),
|
|
13
|
-
--sci-throbber-size: 50px,
|
|
14
|
-
--sci-throbber-duration: 1.25s,
|
|
15
|
-
);
|
|
16
|
-
|
|
17
|
-
$sci-splitter: (
|
|
18
|
-
--sci-splitter-background-color: var(--sci-color-border), // background color of the splitter
|
|
19
|
-
--sci-splitter-background-color-hover: var(--sci-splitter-background-color), // background color of the splitter when hovering it
|
|
20
|
-
--sci-splitter-size: 1px, // size of the splitter along the main axis (width if direction is row, or height if direction is column)
|
|
21
|
-
--sci-splitter-size-hover: 8px, // size of the splitter along the main axis when hovering it.
|
|
22
|
-
--sci-splitter-touch-target-size: 15px, // touch target size to move the splitter (accessibility)
|
|
23
|
-
--sci-splitter-cross-axis-size: 100%, // handle size along the cross axis
|
|
24
|
-
--sci-splitter-border-radius: 0, // border radius of the splitter
|
|
25
|
-
--sci-splitter-opacity-active: 1, // opacity of the splitter while the user moves the splitter
|
|
26
|
-
--sci-splitter-opacity-hover: .3, // opacity of the splitter when hovering it
|
|
27
|
-
);
|
|
28
|
-
|
|
29
|
-
$sci-sashbox: (
|
|
30
|
-
--sci-sashbox-gap: 10px, // gaps (gutters) between sashes
|
|
31
|
-
--sci-sashbox-splitter-background-color: var(--sci-splitter-background-color), // background color of the splitter
|
|
32
|
-
--sci-sashbox-splitter-background-color-hover: var(--sci-splitter-background-color), // background color of the splitter when hovering it
|
|
33
|
-
--sci-sashbox-splitter-size: var(--sci-splitter-size), // size of the splitter along the main axis (width if direction is row, or height if direction is column)
|
|
34
|
-
--sci-sashbox-splitter-size-hover: var(--sci-splitter-size-hover), // size of the splitter along the main axis when hovering it.
|
|
35
|
-
--sci-sashbox-splitter-touch-target-size: var(--sci-splitter-touch-target-size), // touch target size to move the splitter (accessibility)
|
|
36
|
-
--sci-sashbox-splitter-cross-axis-size: var(--sci-splitter-cross-axis-size), // handle size along the cross axis
|
|
37
|
-
--sci-sashbox-splitter-border-radius: var(--sci-splitter-border-radius), // border radius of the splitter
|
|
38
|
-
--sci-sashbox-splitter-opacity-active: var(--sci-splitter-opacity-active), // opacity of the splitter while the user moves the splitter
|
|
39
|
-
--sci-sashbox-splitter-opacity-hover: var(--sci-splitter-opacity-hover), // opacity of the splitter when hovering it
|
|
40
|
-
);
|
|
41
|
-
|
|
42
|
-
$tokens: sci-theming.map-merge(
|
|
43
|
-
$sci-scrollbar,
|
|
44
|
-
$sci-viewport,
|
|
45
|
-
$sci-throbber,
|
|
46
|
-
$sci-splitter,
|
|
47
|
-
$sci-sashbox,
|
|
48
|
-
);
|