@scion/components 22.2.0 → 22.4.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 (42) hide show
  1. package/_index.scss +94 -5
  2. package/common/package.json +4 -0
  3. package/design/_theming.scss +25 -10
  4. package/design/components/_scion-component-dark-tokens.scss +153 -0
  5. package/design/components/_scion-component-light-tokens.scss +153 -0
  6. package/design/icons/_scion-icon-font.scss +50 -0
  7. package/design/themes/_scion-dark-theme.scss +2 -7
  8. package/design/themes/_scion-light-theme.scss +3 -8
  9. package/fesm2022/scion-components-common.mjs +251 -0
  10. package/fesm2022/scion-components-common.mjs.map +1 -0
  11. package/fesm2022/scion-components-dimension.mjs +7 -6
  12. package/fesm2022/scion-components-dimension.mjs.map +1 -1
  13. package/fesm2022/scion-components-icon.mjs +327 -0
  14. package/fesm2022/scion-components-icon.mjs.map +1 -0
  15. package/fesm2022/scion-components-menu.mjs +3277 -0
  16. package/fesm2022/scion-components-menu.mjs.map +1 -0
  17. package/fesm2022/scion-components-sashbox.mjs +21 -21
  18. package/fesm2022/scion-components-sashbox.mjs.map +1 -1
  19. package/fesm2022/scion-components-splitter.mjs +16 -13
  20. package/fesm2022/scion-components-splitter.mjs.map +1 -1
  21. package/fesm2022/scion-components-table.mjs +2337 -0
  22. package/fesm2022/scion-components-table.mjs.map +1 -0
  23. package/fesm2022/scion-components-text.mjs +322 -0
  24. package/fesm2022/scion-components-text.mjs.map +1 -0
  25. package/fesm2022/scion-components-throbber.mjs +15 -15
  26. package/fesm2022/scion-components-throbber.mjs.map +1 -1
  27. package/fesm2022/scion-components-viewport.mjs +41 -72
  28. package/fesm2022/scion-components-viewport.mjs.map +1 -1
  29. package/icon/package.json +4 -0
  30. package/menu/package.json +4 -0
  31. package/package.json +23 -3
  32. package/table/package.json +4 -0
  33. package/text/package.json +4 -0
  34. package/types/scion-components-common.d.ts +185 -0
  35. package/types/scion-components-icon.d.ts +93 -0
  36. package/types/scion-components-menu.d.ts +1922 -0
  37. package/types/scion-components-sashbox.d.ts +4 -2
  38. package/types/scion-components-splitter.d.ts +4 -3
  39. package/types/scion-components-table.d.ts +595 -0
  40. package/types/scion-components-text.d.ts +131 -0
  41. package/types/scion-components-viewport.d.ts +7 -4
  42. 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,5 +1,5 @@
1
1
  import * as _angular_core from '@angular/core';
2
- import { ElementRef } from '@angular/core';
2
+ import { Signal, ElementRef } from '@angular/core';
3
3
 
4
4
  /**
5
5
  * Represents a viewport with slotted content (`<ng-content>`) used as scrollable content. By default, content is added to a CSS grid layout.
@@ -80,7 +80,10 @@ declare class SciViewportComponent {
80
80
  private readonly _host;
81
81
  private readonly _viewport;
82
82
  private readonly _viewportClient;
83
- constructor();
83
+ /**
84
+ * Indicates whether currently scrolling the viewport.
85
+ */
86
+ readonly scrolling: Signal<boolean>;
84
87
  focus(): void;
85
88
  /**
86
89
  * Returns the number of pixels that the viewport client is scrolled vertically.
@@ -149,9 +152,9 @@ declare class SciViewportComponent {
149
152
  */
150
153
  computeOffset(element: ElementRef<HTMLElement> | HTMLElement, border: 'left' | 'top'): number | null;
151
154
  /**
152
- * Emits when the scroll position changes.
155
+ * Computes whether currently scrolling the viewport.
153
156
  */
154
- private installScrollEmitter;
157
+ private computeScrolling;
155
158
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<SciViewportComponent, never>;
156
159
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<SciViewportComponent, "sci-viewport", never, { "scrollbarStyle": { "alias": "scrollbarStyle"; "required": false; "isSignal": true; }; }, { "scroll": "scroll"; }, never, never, true, never>;
157
160
  }
@@ -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
- );