@scion/components 22.2.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.
Files changed (42) hide show
  1. package/_index.scss +75 -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 +380 -0
  14. package/fesm2022/scion-components-icon.mjs.map +1 -0
  15. package/fesm2022/scion-components-menu.mjs +3271 -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 +2265 -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 +22 -2
  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 +146 -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 +577 -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,4 @@
1
+ {
2
+ "module": "../fesm2022/scion-components-table.mjs",
3
+ "typings": "../types/scion-components-table.d.ts"
4
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "module": "../fesm2022/scion-components-text.mjs",
3
+ "typings": "../types/scion-components-text.d.ts"
4
+ }
@@ -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,146 @@
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
+ * SCION uses the following built-in icons:
64
+ * - scion.add : Add an item
65
+ * - scion.add_large : Add an item (large)
66
+ * - scion.bin : Bin symbol
67
+ * - scion.checkmark : Indicates a selected option
68
+ * - scion.chevron_down : Chevron down symbol
69
+ * - scion.chevron_left : Chevron left symbol
70
+ * - scion.chevron_right : Chevron right symbol
71
+ * - scion.chevron_up : Chevron up symbol
72
+ * - scion.clear : Clear items
73
+ * - scion.close : Close a popover
74
+ * - scion.collapse_all : Collapse all items
75
+ * - scion.copy : Copy an item
76
+ * - scion.delete : Delete an item
77
+ * - scion.dirty : Indicates unsaved data
78
+ * - scion.drag_handle : Drag or move an item
79
+ * - scion.duplicate : Duplicate an item
80
+ * - scion.edit : Edit an item
81
+ * - scion.emdash : Em dash symbol
82
+ * - scion.envelope : Envelope symbol
83
+ * - scion.envelope_closed : Indicates a closed envelope
84
+ * - scion.envelope_opened : Indicates an opened envelope
85
+ * - scion.expand_all : Expand an item
86
+ * - scion.external_link : Open link in a new tab
87
+ * - scion.filter : Set or change a filter
88
+ * - scion.find : Find an item
89
+ * - scion.folder : Directory symbol
90
+ * - scion.help : Indicates help, support, or documentation
91
+ * - scion.hide : Hide a panel
92
+ * - scion.magnifier : Magnifier symbol
93
+ * - scion.minimize : Minimize a panel
94
+ * - scion.minus : Minus sign
95
+ * - scion.modified : Indicates modified data
96
+ * - scion.more_horizontal : Show a popover to the left or right
97
+ * - scion.more_vertical : Show a popover above or below
98
+ * - scion.new : Create an item
99
+ * - scion.new_large : Create an item (large)
100
+ * - scion.paste : Paste from clipboard
101
+ * - scion.pen : Pen symbol
102
+ * - scion.pin : Pin an item
103
+ * - scion.pinned : Indicates a pinned item
104
+ * - scion.placeholder_frame : Placeholder symbol
105
+ * - scion.placeholder_image : Placeholder symbol for an image
106
+ * - scion.plus : Plus sign
107
+ * - scion.plus_large : Plus sign (large)
108
+ * - scion.remove : Remove an item (x)
109
+ * - scion.remove_minus : Remove an item (-)
110
+ * - scion.reset : Reset a form
111
+ * - scion.search : Search for an item
112
+ * - scion.sort_ascending : Sort items in ascending order (A-Z, 0-9)
113
+ * - scion.sort_by : Change sort order
114
+ * - scion.sort_descending : Sort items in descending order (Z-A, 9-0)
115
+ * - scion.user : User symbol
116
+ *
117
+ * To not replace built-in icons, the icon provider can return `undefined` for icons starting with the `scion.` prefix.
118
+ *
119
+ * The function can call `inject` to get any required dependencies.
120
+ *
121
+ * @see SciIconProviderFn
122
+ * @see SciIconComponent
123
+ */
124
+ declare function provideIconProvider(iconProviderFn: SciIconProviderFn | undefined): EnvironmentProviders;
125
+ /**
126
+ * Signature of a function to provide icons.
127
+ *
128
+ * An icon provider is a function that returns the component for an icon. The component renders the icon.
129
+ *
130
+ * Alternatively, the icon provider can return a descriptor, allowing for additional configuration such as inputs.
131
+ * Inputs are available as input properties in the component. The component can use the inputs to render the icon.
132
+ *
133
+ * Icon keys used by SCION start with the `scion.` prefix. To not replace built-in icons, the icon provider can
134
+ * return `undefined` for icons starting with the `scion.` prefix.
135
+ *
136
+ * An icon provider can be registered via {@link provideIconProvider} function.
137
+ *
138
+ * The function can call `inject` to get any required dependencies.
139
+ *
140
+ * @param icon - The key of the icon for which to provide the icon component.
141
+ * @returns ComponentType or {@link SciComponentDescriptor} to render the icon, or `undefined` if not provided by the icon provider.
142
+ */
143
+ type SciIconProviderFn = (icon: string) => ComponentType<unknown> | SciComponentDescriptor | undefined;
144
+
145
+ export { SciIconComponent, provideIconProvider };
146
+ export type { SciIconProviderFn };