@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.
- package/_index.scss +94 -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 +327 -0
- package/fesm2022/scion-components-icon.mjs.map +1 -0
- package/fesm2022/scion-components-menu.mjs +3277 -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 +2337 -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 +41 -72
- package/fesm2022/scion-components-viewport.mjs.map +1 -1
- package/icon/package.json +4 -0
- package/menu/package.json +4 -0
- package/package.json +23 -3
- 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 +93 -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 +595 -0
- package/types/scion-components-text.d.ts +131 -0
- package/types/scion-components-viewport.d.ts +7 -4
- package/design/components/_scion-component-tokens.scss +0 -48
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scion/components",
|
|
3
|
-
"version": "22.
|
|
3
|
+
"version": "22.4.0",
|
|
4
4
|
"description": "Provides a collection of Angular components and directives primarily for use in SCION libraries such as `@scion/workbench` and `@scion/microfrontend-platform`. This library is not a comprehensive component library as its focus is on SCION requirements.",
|
|
5
5
|
"license": "EPL-2.0",
|
|
6
6
|
"private": false,
|
|
@@ -29,10 +29,22 @@
|
|
|
29
29
|
"./package.json": {
|
|
30
30
|
"default": "./package.json"
|
|
31
31
|
},
|
|
32
|
+
"./common": {
|
|
33
|
+
"types": "./types/scion-components-common.d.ts",
|
|
34
|
+
"default": "./fesm2022/scion-components-common.mjs"
|
|
35
|
+
},
|
|
32
36
|
"./dimension": {
|
|
33
37
|
"types": "./types/scion-components-dimension.d.ts",
|
|
34
38
|
"default": "./fesm2022/scion-components-dimension.mjs"
|
|
35
39
|
},
|
|
40
|
+
"./icon": {
|
|
41
|
+
"types": "./types/scion-components-icon.d.ts",
|
|
42
|
+
"default": "./fesm2022/scion-components-icon.mjs"
|
|
43
|
+
},
|
|
44
|
+
"./menu": {
|
|
45
|
+
"types": "./types/scion-components-menu.d.ts",
|
|
46
|
+
"default": "./fesm2022/scion-components-menu.mjs"
|
|
47
|
+
},
|
|
36
48
|
"./sashbox": {
|
|
37
49
|
"types": "./types/scion-components-sashbox.d.ts",
|
|
38
50
|
"default": "./fesm2022/scion-components-sashbox.mjs"
|
|
@@ -41,6 +53,14 @@
|
|
|
41
53
|
"types": "./types/scion-components-splitter.d.ts",
|
|
42
54
|
"default": "./fesm2022/scion-components-splitter.mjs"
|
|
43
55
|
},
|
|
56
|
+
"./table": {
|
|
57
|
+
"types": "./types/scion-components-table.d.ts",
|
|
58
|
+
"default": "./fesm2022/scion-components-table.mjs"
|
|
59
|
+
},
|
|
60
|
+
"./text": {
|
|
61
|
+
"types": "./types/scion-components-text.d.ts",
|
|
62
|
+
"default": "./fesm2022/scion-components-text.mjs"
|
|
63
|
+
},
|
|
44
64
|
"./throbber": {
|
|
45
65
|
"types": "./types/scion-components-throbber.d.ts",
|
|
46
66
|
"default": "./fesm2022/scion-components-throbber.mjs"
|
|
@@ -58,12 +78,12 @@
|
|
|
58
78
|
"@angular/common": "^22.0.0",
|
|
59
79
|
"@angular/animations": "^22.0.0",
|
|
60
80
|
"@angular/cdk": "^22.0.0",
|
|
61
|
-
"@scion/toolkit": "^2.
|
|
81
|
+
"@scion/toolkit": "^2.2.0",
|
|
62
82
|
"rxjs": "^7.8.0"
|
|
63
83
|
},
|
|
64
84
|
"repository": {
|
|
65
85
|
"type": "git",
|
|
66
|
-
"url": "https://github.com/SchweizerischeBundesbahnen/scion-toolkit.git"
|
|
86
|
+
"url": "git+https://github.com/SchweizerischeBundesbahnen/scion-toolkit.git"
|
|
67
87
|
},
|
|
68
88
|
"sideEffects": false,
|
|
69
89
|
"module": "fesm2022/scion-components.mjs",
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { Signal, Injector, Provider, DestroyableInjector, Binding, Type, TemplateRef } from '@angular/core';
|
|
3
|
+
import { Observable } from 'rxjs';
|
|
4
|
+
import { ComponentType } from '@angular/cdk/portal';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Represents a value or a {@link Signal} of that value.
|
|
8
|
+
*/
|
|
9
|
+
type MaybeSignal<T> = T | Signal<T>;
|
|
10
|
+
/**
|
|
11
|
+
* Coerces the given value into a {@link Signal}. If the value is already a signal, it is returned as-is; otherwise, it is wrapped in a signal.
|
|
12
|
+
*
|
|
13
|
+
* Passing `undefined` returns `undefined`, unless the option `coerceUndefined` is set to `true`.
|
|
14
|
+
*
|
|
15
|
+
* @param value - Specifies the value to coerece.
|
|
16
|
+
*/
|
|
17
|
+
declare function coerceSignal<T extends MaybeSignal<unknown>>(value: T): T extends Signal<unknown> ? T : T extends undefined ? undefined : Signal<T>;
|
|
18
|
+
/**
|
|
19
|
+
* Coerces the given value into a {@link Signal}. If the value is already a signal, it is returned as-is; otherwise, it is wrapped in a signal.
|
|
20
|
+
*
|
|
21
|
+
* @param value - Specifies the value to coerece.
|
|
22
|
+
* @param options - Controls coercion.
|
|
23
|
+
* @param options.coerceUndefined - If `true`, returns `signal(undefined)` for a `undefined` value. Defaults to `false`.
|
|
24
|
+
*/
|
|
25
|
+
declare function coerceSignal<T>(value: MaybeSignal<T> | undefined, options: {
|
|
26
|
+
coerceUndefined: true;
|
|
27
|
+
}): Signal<T | undefined>;
|
|
28
|
+
/**
|
|
29
|
+
* Like {@link toObservable}, but lazily creates the effect upon subscription, binding it to the subscription lifecycle instead of the injection context, plus, emits the signal's initial value synchronously.
|
|
30
|
+
*/
|
|
31
|
+
declare function toLazyObservable<T>(signal: MaybeSignal<NonNullable<T>>, options?: {
|
|
32
|
+
injector?: Injector;
|
|
33
|
+
}): Observable<NonNullable<T>>;
|
|
34
|
+
declare function toLazyObservable<T>(signal: MaybeSignal<NonNullable<T>> | undefined, options?: {
|
|
35
|
+
injector?: Injector;
|
|
36
|
+
}): Observable<NonNullable<T>> | undefined;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Creates a {@link DestroyableInjector} bound to the lifecycle of its parent injector. Defaults to the current injector if not configuring a parent injector.
|
|
40
|
+
*
|
|
41
|
+
* Unlike injectors created via {@link Injector.create}, the returned injector:
|
|
42
|
+
* - Is destroyed with its parent, also if used outside a component injection context.
|
|
43
|
+
* - Does not throw an error when invoking {@link DestroyableInjector.destroy} if already destroyed.
|
|
44
|
+
* - Uses the current injection context as parent if no explicit parent injector is specified.
|
|
45
|
+
*
|
|
46
|
+
* @docs-private Not public API. For internal use only.
|
|
47
|
+
*
|
|
48
|
+
* @param options - Configures the injector.
|
|
49
|
+
* @param options.parent - Specifies the parent injector. Defaults to the current injector.
|
|
50
|
+
* @param options.providers - Specifies providers to associate with the injector.
|
|
51
|
+
* @param options.name - Names the injector, useful for debugging the injector hierarchy.
|
|
52
|
+
*/
|
|
53
|
+
declare function createDestroyableInjector(options?: {
|
|
54
|
+
parent?: Injector;
|
|
55
|
+
providers?: Provider[];
|
|
56
|
+
name?: string;
|
|
57
|
+
}): DestroyableInjector;
|
|
58
|
+
/**
|
|
59
|
+
* Asserts that the current stack frame is within an injection context and has access to inject.
|
|
60
|
+
*
|
|
61
|
+
* Delegates to `assertInInjectionContext` from @angular/core, adding the given message to the error if the assertion fails.
|
|
62
|
+
*
|
|
63
|
+
* @docs-private Not public API. For internal use only.
|
|
64
|
+
*/
|
|
65
|
+
declare function assertInInjectionContext(debugFn: Function, message: string): void;
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Renders a component based on a descriptor, similar to `ngComponentOutlet`, but with input bindings.
|
|
69
|
+
*
|
|
70
|
+
* Usage:
|
|
71
|
+
*
|
|
72
|
+
* ```html
|
|
73
|
+
* <ng-container *sciComponentOutlet="descriptor"/>
|
|
74
|
+
* ````
|
|
75
|
+
*
|
|
76
|
+
* ```ts
|
|
77
|
+
* protected readonly descriptor: SciComponentDescriptor = {
|
|
78
|
+
* component: FilterComponent,
|
|
79
|
+
* bindings: [
|
|
80
|
+
* inputBinding('placeholder', signal('Filter items...')),
|
|
81
|
+
* ],
|
|
82
|
+
* };
|
|
83
|
+
* ```
|
|
84
|
+
*/
|
|
85
|
+
declare class SciComponentOutletDirective {
|
|
86
|
+
/**
|
|
87
|
+
* Specifies the component to render.
|
|
88
|
+
*/
|
|
89
|
+
readonly descriptor: i0.InputSignal<SciComponentDescriptor | null | undefined>;
|
|
90
|
+
constructor();
|
|
91
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<SciComponentOutletDirective, never>;
|
|
92
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<SciComponentOutletDirective, "ng-template[sciComponentOutlet]", never, { "descriptor": { "alias": "sciComponentOutlet"; "required": true; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Describes the rendering of a component.
|
|
96
|
+
*/
|
|
97
|
+
interface SciComponentDescriptor {
|
|
98
|
+
/**
|
|
99
|
+
* Specifies the component to render.
|
|
100
|
+
*/
|
|
101
|
+
component: ComponentType<unknown>;
|
|
102
|
+
/**
|
|
103
|
+
* Specifies input and output bindings.
|
|
104
|
+
*
|
|
105
|
+
* @example - Passing inputs to the component
|
|
106
|
+
* ```ts
|
|
107
|
+
* bindings: [inputBinding('placeholder', signal('Filter items...'))];
|
|
108
|
+
* ```
|
|
109
|
+
*
|
|
110
|
+
* Inputs are available as input properties in the component.
|
|
111
|
+
*
|
|
112
|
+
* @example - Reading inputs in the component
|
|
113
|
+
* ```ts
|
|
114
|
+
* public placeholder = input.required<string>();
|
|
115
|
+
* ```
|
|
116
|
+
*
|
|
117
|
+
* @see inputBinding
|
|
118
|
+
* @see outputBinding
|
|
119
|
+
* @see twoWayBinding
|
|
120
|
+
*/
|
|
121
|
+
bindings?: Binding[];
|
|
122
|
+
/**
|
|
123
|
+
* Specifies directives to be applied to the component.
|
|
124
|
+
*/
|
|
125
|
+
directives?: Array<Type<unknown> | {
|
|
126
|
+
type: Type<unknown>;
|
|
127
|
+
bindings: Binding[];
|
|
128
|
+
}>;
|
|
129
|
+
/**
|
|
130
|
+
* Specifies the injector used to instantiate the component, giving control over which objects are available for injection. Defaults to the element injector.
|
|
131
|
+
*
|
|
132
|
+
* ```ts
|
|
133
|
+
* Injector.create({
|
|
134
|
+
* parent: ...,
|
|
135
|
+
* providers: [
|
|
136
|
+
* {provide: <TOKEN>, useValue: <VALUE>}
|
|
137
|
+
* ],
|
|
138
|
+
* })
|
|
139
|
+
* ```
|
|
140
|
+
*/
|
|
141
|
+
injector?: Injector;
|
|
142
|
+
/**
|
|
143
|
+
* Specifies providers available for injection in the component.
|
|
144
|
+
*/
|
|
145
|
+
providers?: Provider[];
|
|
146
|
+
/**
|
|
147
|
+
* Specifies CSS classes to associate with the component.
|
|
148
|
+
*/
|
|
149
|
+
cssClass?: MaybeSignal<string | string[]>;
|
|
150
|
+
/**
|
|
151
|
+
* Specifies HTML attributes to associate with the component.
|
|
152
|
+
*
|
|
153
|
+
* Data attributes should start with the `data-` prefix.
|
|
154
|
+
*/
|
|
155
|
+
attributes?: MaybeSignal<{
|
|
156
|
+
[name: string]: string | undefined;
|
|
157
|
+
}>;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* Use to add specified attributes to the host element.
|
|
162
|
+
*/
|
|
163
|
+
declare class SciAttributesDirective {
|
|
164
|
+
/**
|
|
165
|
+
* Specifies attributes to add to the host element.
|
|
166
|
+
*
|
|
167
|
+
* Attributes with `null` or `undefined` values are removed.
|
|
168
|
+
*/
|
|
169
|
+
readonly attributes: i0.InputSignal<{
|
|
170
|
+
[name: string]: unknown;
|
|
171
|
+
} | null | undefined>;
|
|
172
|
+
constructor();
|
|
173
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<SciAttributesDirective, never>;
|
|
174
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<SciAttributesDirective, "[sciAttributes]", never, { "attributes": { "alias": "sciAttributes"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
interface SciTemplateDescriptor {
|
|
178
|
+
template: MaybeSignal<TemplateRef<unknown>>;
|
|
179
|
+
context?: {
|
|
180
|
+
[key: string]: MaybeSignal<unknown>;
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
export { SciAttributesDirective, SciComponentOutletDirective, assertInInjectionContext, coerceSignal, createDestroyableInjector, toLazyObservable };
|
|
185
|
+
export type { MaybeSignal, SciComponentDescriptor, SciTemplateDescriptor };
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { Signal, EnvironmentProviders } from '@angular/core';
|
|
3
|
+
import { SciComponentDescriptor } from '@scion/components/common';
|
|
4
|
+
import { ComponentType } from '@angular/cdk/portal';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Renders an icon based on registered icon providers.
|
|
8
|
+
*
|
|
9
|
+
* Set the icon name as the slotted content of the `<sci-icon>` component.
|
|
10
|
+
*
|
|
11
|
+
* Example:
|
|
12
|
+
* ```html
|
|
13
|
+
* <sci-icon>home</sci-icon>
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* An icon provider can be registered using {@link provideIconProvider}.
|
|
17
|
+
*
|
|
18
|
+
* Providers are called in registration order. If a provider does not provide the icon, the next provider is called, and so on.
|
|
19
|
+
* If no provider provides the icon, defaults to a Material icon provider, interpreting the icon as a Material icon font ligature.
|
|
20
|
+
* Refer to https://fonts.google.com/icons for available Material icons and instructions on including the Material icon font.
|
|
21
|
+
*
|
|
22
|
+
* By default, the icon size is `1em`. To change the size, set the font-size on the `<sci-icon>` element or use the `--sci-icon-size` CSS variable.
|
|
23
|
+
*
|
|
24
|
+
* ```scss
|
|
25
|
+
* sci-icon {
|
|
26
|
+
* --sci-icon-size: 16px;
|
|
27
|
+
* }
|
|
28
|
+
* ```
|
|
29
|
+
*
|
|
30
|
+
* @see provideIconProvider
|
|
31
|
+
*
|
|
32
|
+
* TODO [Angular 23] Consider changing encapsulation to `IsolatedShadowDom` when stable. See branch: issue/icon-shadow-dom.
|
|
33
|
+
*/
|
|
34
|
+
declare class SciIconComponent {
|
|
35
|
+
private readonly _slottedContent;
|
|
36
|
+
protected readonly icon: Signal<SciComponentDescriptor | undefined>;
|
|
37
|
+
/**
|
|
38
|
+
* Reads the icon from slotted content and passes it to registered icon providers for resolution.
|
|
39
|
+
*/
|
|
40
|
+
private computeIcon;
|
|
41
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<SciIconComponent, never>;
|
|
42
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<SciIconComponent, "sci-icon", never, {}, {}, never, ["*"], true, never>;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Enables contribution or replacement of icons used in SCION.
|
|
47
|
+
*
|
|
48
|
+
* An icon provider is a function that returns a component for an icon. The component renders the icon.
|
|
49
|
+
*
|
|
50
|
+
* Multiple icon providers can be registered. Providers are called in registration order. If a provider does not provide the icon,
|
|
51
|
+
* the next provider is called, and so on.
|
|
52
|
+
*
|
|
53
|
+
* Defaults to a Material icon provider, interpreting the icon as a Material icon ligature.
|
|
54
|
+
*
|
|
55
|
+
* Refer to https://fonts.google.com/icons for available Material icons and https://developers.google.com/fonts/docs/material_symbols#use_in_web
|
|
56
|
+
* for instructions on including the Material icon font.
|
|
57
|
+
*
|
|
58
|
+
* @example - Importing the Material icon font in `styles.scss`
|
|
59
|
+
* ```scss
|
|
60
|
+
* @import url('https://fonts.googleapis.com/css2?family=Material+Symbols+Rounded:opsz,wght,FILL@20..24,400,0&display=block');
|
|
61
|
+
* ```
|
|
62
|
+
*
|
|
63
|
+
* Built-in SCION icons start with the `scion.` prefix. To not replace SCION icons, the icon provider can return `undefined` for icons starting with the `scion.` prefix.
|
|
64
|
+
* Refer to https://icons.scion.vercel.app for available SCION icons.
|
|
65
|
+
*
|
|
66
|
+
* The function can call `inject` to get any required dependencies.
|
|
67
|
+
*
|
|
68
|
+
* @see SciIconProviderFn
|
|
69
|
+
* @see SciIconComponent
|
|
70
|
+
*/
|
|
71
|
+
declare function provideIconProvider(iconProviderFn: SciIconProviderFn | undefined): EnvironmentProviders;
|
|
72
|
+
/**
|
|
73
|
+
* Signature of a function to provide icons.
|
|
74
|
+
*
|
|
75
|
+
* An icon provider is a function that returns the component for an icon. The component renders the icon.
|
|
76
|
+
*
|
|
77
|
+
* Alternatively, the icon provider can return a descriptor, allowing for additional configuration such as inputs.
|
|
78
|
+
* Inputs are available as input properties in the component. The component can use the inputs to render the icon.
|
|
79
|
+
*
|
|
80
|
+
* Icon keys used by SCION start with the `scion.` prefix. To not replace SCION icons, the icon provider can
|
|
81
|
+
* return `undefined` for icons starting with the `scion.` prefix.
|
|
82
|
+
*
|
|
83
|
+
* An icon provider can be registered via {@link provideIconProvider} function.
|
|
84
|
+
*
|
|
85
|
+
* The function can call `inject` to get any required dependencies.
|
|
86
|
+
*
|
|
87
|
+
* @param icon - The key of the icon for which to provide the icon component.
|
|
88
|
+
* @returns ComponentType or {@link SciComponentDescriptor} to render the icon, or `undefined` if not provided by the icon provider.
|
|
89
|
+
*/
|
|
90
|
+
type SciIconProviderFn = (icon: string) => ComponentType<unknown> | SciComponentDescriptor | undefined;
|
|
91
|
+
|
|
92
|
+
export { SciIconComponent, provideIconProvider };
|
|
93
|
+
export type { SciIconProviderFn };
|