@scion/components 22.5.0 → 22.7.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 +32 -88
- package/design/components/_scion-component-dark-tokens.scss +15 -0
- package/design/components/_scion-component-light-tokens.scss +15 -0
- package/fesm2022/scion-components-common.mjs +156 -5
- package/fesm2022/scion-components-common.mjs.map +1 -1
- package/fesm2022/scion-components-dimension.mjs +3 -3
- package/fesm2022/scion-components-dimension.mjs.map +1 -1
- package/fesm2022/scion-components-icon.mjs +134 -98
- package/fesm2022/scion-components-icon.mjs.map +1 -1
- package/fesm2022/scion-components-menu.mjs +58 -51
- package/fesm2022/scion-components-menu.mjs.map +1 -1
- package/fesm2022/scion-components-sashbox.mjs +1 -1
- package/fesm2022/scion-components-sashbox.mjs.map +1 -1
- package/fesm2022/scion-components-splitter.mjs +1 -1
- package/fesm2022/scion-components-splitter.mjs.map +1 -1
- package/fesm2022/scion-components-table.mjs +1544 -1008
- package/fesm2022/scion-components-table.mjs.map +1 -1
- package/fesm2022/scion-components-text.mjs +83 -40
- package/fesm2022/scion-components-text.mjs.map +1 -1
- package/fesm2022/scion-components-throbber.mjs +1 -1
- package/fesm2022/scion-components-throbber.mjs.map +1 -1
- package/fesm2022/scion-components-tree.mjs +306 -0
- package/fesm2022/scion-components-tree.mjs.map +1 -0
- package/fesm2022/scion-components-viewport.mjs +31 -18
- package/fesm2022/scion-components-viewport.mjs.map +1 -1
- package/package.json +6 -2
- package/tree/package.json +4 -0
- package/types/scion-components-common.d.ts +111 -4
- package/types/scion-components-icon.d.ts +42 -15
- package/types/scion-components-menu.d.ts +7 -2
- package/types/scion-components-sashbox.d.ts +1 -1
- package/types/scion-components-splitter.d.ts +1 -1
- package/types/scion-components-table.d.ts +1112 -300
- package/types/scion-components-text.d.ts +6 -5
- package/types/scion-components-throbber.d.ts +1 -1
- package/types/scion-components-tree.d.ts +559 -0
- package/types/scion-components-viewport.d.ts +20 -11
- package/viewport/scrollbar/_scrollbar.scss +12 -0
- package/design/icons/_scion-icon-font.scss +0 -50
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scion-components-dimension.mjs","sources":["../../../../projects/scion/components/dimension/src/dimension.directive.ts","../../../../projects/scion/components/dimension/src/dimension.signal.ts","../../../../projects/scion/components/dimension/src/bounding-client-rect.signal.ts","../../../../projects/scion/components/dimension/src/public_api.ts","../../../../projects/scion/components/dimension/src/scion-components-dimension.ts"],"sourcesContent":["/*\n * Copyright (c) 2018-2024 Swiss Federal Railways\n *\n * This program and the accompanying materials are made\n * available under the terms of the Eclipse Public License 2.0\n * which is available at https://www.eclipse.org/legal/epl-2.0/\n *\n * SPDX-License-Identifier: EPL-2.0\n */\n\nimport {Directive, ElementRef, inject, input, NgZone, output, ɵZONELESS_ENABLED} from '@angular/core';\nimport {fromResize$} from '@scion/toolkit/observable';\nimport {takeUntilDestroyed} from '@angular/core/rxjs-interop';\nimport {observeIn, subscribeIn} from '@scion/toolkit/operators';\nimport {SciDimension} from './dimension';\n\n/**\n * Observes the size of the host element.\n *\n * ---\n * Usage:\n *\n * ```html\n * <div sciDimension (sciDimensionChange)=\"onDimensionChange($event)\"></div>\n * ```\n */\n@Directive({\n selector: '[sciDimension]',\n})\nexport class SciDimensionDirective {\n\n /**\n * Controls if to output outside the Angular zone. Defaults to `false`.\n */\n public readonly emitOutsideAngular = input(false);\n\n /**\n * Outputs the size of the element.\n */\n public readonly dimensionChange = output<SciDimension>({alias: 'sciDimensionChange'});\n\n constructor() {\n const host = inject(ElementRef).nativeElement as HTMLElement;\n const zone = inject(NgZone);\n const zonelessEnabled = inject(ɵZONELESS_ENABLED);\n\n fromResize$(host)\n .pipe(\n // Avoid triggering change detection cycle.\n subscribeIn(fn => zone.runOutsideAngular(fn)),\n // Run in animation frame to prevent 'ResizeObserver loop completed with undelivered notifications' error.\n // Do not use `animationFrameScheduler` because the scheduler does not necessarily execute in the current execution context, such as inside or outside Angular.\n // The scheduler always executes tasks in the context (e.g. zone) where the scheduler was first used in the application.\n observeIn(fn => requestAnimationFrame(fn)),\n observeIn(fn => this.emitOutsideAngular() ? fn() : zone.run(fn)),\n takeUntilDestroyed(),\n )\n .subscribe(() => {\n if (!zonelessEnabled) {\n // Assert Angular zone.\n this.emitOutsideAngular() ? NgZone.assertNotInAngularZone() : NgZone.assertInAngularZone();\n }\n\n this.dimensionChange.emit({\n clientWidth: host.clientWidth,\n offsetWidth: host.offsetWidth,\n clientHeight: host.clientHeight,\n offsetHeight: host.offsetHeight,\n element: host,\n });\n });\n }\n}\n","/*\n * Copyright (c) 2018-2024 Swiss Federal Railways\n *\n * This program and the accompanying materials are made\n * available under the terms of the Eclipse Public License 2.0\n * which is available at https://www.eclipse.org/legal/epl-2.0/\n *\n * SPDX-License-Identifier: EPL-2.0\n */\n\nimport {assertNotInReactiveContext, computed, effect, ElementRef, inject, Injector, isSignal, NgZone, signal, Signal, untracked} from '@angular/core';\nimport {SciDimension} from './dimension';\nimport {coerceElement} from '@angular/cdk/coercion';\nimport {Objects} from '@scion/toolkit/util';\nimport {fromResize$} from '@scion/toolkit/observable';\nimport {observeIn, subscribeIn} from '@scion/toolkit/operators';\nimport {assertInInjectionContext} from '@scion/components/common';\n\n/**\n * Creates a signal observing the size of an element.\n *\n * The element can be passed as a signal, enabling observation of view children in the component constructor.\n *\n * The signal subscribes to the native {@link ResizeObserver} to monitor element size changes. Destroying the injection context will unsubscribe the observer.\n *\n * Usage:\n * - Must be called within an injection context or an injector provided. Destroying the injector will unsubscribe the signal.\n * - Must not be called within a reactive context to avoid repeated subscriptions.\n */\nexport function dimension(elementLike: HTMLElement | ElementRef<HTMLElement> | Signal<HTMLElement | ElementRef<HTMLElement>>, options?: {injector?: Injector}): Signal<SciDimension>;\nexport function dimension(elementLike: HTMLElement | ElementRef<HTMLElement> | Signal<HTMLElement | ElementRef<HTMLElement> | undefined>, options?: {injector?: Injector}): Signal<SciDimension | undefined>;\nexport function dimension(elementLike: HTMLElement | ElementRef<HTMLElement> | Signal<HTMLElement | ElementRef<HTMLElement> | undefined>, options?: {injector?: Injector}): Signal<SciDimension | undefined> {\n assertNotInReactiveContext(dimension, 'Invoking `dimension` causes new subscriptions every time. Move `dimension` outside of the reactive context and read the signal value where needed.');\n if (!options?.injector) {\n assertInInjectionContext(dimension, 'Must be called within an injection context, or an explicit `Injector` passed via options. Stops tracking the dimension when the injection context is destroyed.');\n }\n\n const injector = options?.injector ?? inject(Injector);\n const zone = injector.get(NgZone);\n const element = computed(() => coerceElement(isSignal(elementLike) ? elementLike() : elementLike));\n const onResize = signal<void>(undefined, {equal: () => false});\n\n // Subscribe to element size changes.\n effect(onCleanup => {\n const el = element();\n if (!el) {\n return;\n }\n\n untracked(() => {\n const subscription = fromResize$(el)\n .pipe(\n // Avoid triggering change detection cycle.\n subscribeIn(fn => zone.runOutsideAngular(fn)),\n // Run in animation frame to prevent 'ResizeObserver loop completed with undelivered notifications' error.\n // Do not use `animationFrameScheduler` because the scheduler does not necessarily execute in the current execution context, such as inside or outside Angular.\n // The scheduler always executes tasks in the context (e.g. zone) where the scheduler was first used in the application.\n observeIn(fn => requestAnimationFrame(fn)),\n )\n .subscribe(() => {\n NgZone.assertNotInAngularZone();\n onResize.set();\n });\n onCleanup(() => subscription.unsubscribe());\n });\n }, {injector});\n\n // Create signal that recomputes each time the size changes.\n return computed(() => {\n const el = element();\n if (!el) {\n return undefined;\n }\n\n // Track element size.\n onResize();\n\n return {\n clientWidth: el.clientWidth,\n offsetWidth: el.offsetWidth,\n clientHeight: el.clientHeight,\n offsetHeight: el.offsetHeight,\n element: el,\n };\n }, {equal: Objects.isEqual});\n}\n","/*\n * Copyright (c) 2018-2024 Swiss Federal Railways\n *\n * This program and the accompanying materials are made\n * available under the terms of the Eclipse Public License 2.0\n * which is available at https://www.eclipse.org/legal/epl-2.0/\n *\n * SPDX-License-Identifier: EPL-2.0\n */\n\nimport {assertNotInReactiveContext, computed, effect, ElementRef, inject, Injector, isSignal, NgZone, signal, Signal, untracked} from '@angular/core';\nimport {coerceElement} from '@angular/cdk/coercion';\nimport {fromBoundingClientRect$} from '@scion/toolkit/observable';\nimport {subscribeIn} from '@scion/toolkit/operators';\nimport {assertInInjectionContext} from '@scion/components/common';\n\n/**\n * Creates a signal observing the bounding box of an element.\n *\n * The bounding box includes the element's position relative to the top-left of the viewport and its size.\n * Refer to https://developer.mozilla.org/en-US/docs/Web/API/Element/getBoundingClientRect for more details.\n *\n * The element can be passed as a signal, enabling observation of view children in the component constructor.\n *\n * There is no native browser API to observe the position of an element. The signal uses {@link IntersectionObserver} and\n * {@link ResizeObserver} to detect position changes. For tracking only size changes, use the {@link dimension} signal instead.\n *\n * Usage:\n * - Must be called within an injection context or an injector provided. Destroying the injector will unsubscribe the signal.\n * - Must not be called within a reactive context to avoid repeated subscriptions.\n * - The element and the document root (`<html>`) must be positioned `relative` or `absolute`. If not, positioning is changed to `relative`.\n */\nexport function boundingClientRect(elementLike: HTMLElement | ElementRef<HTMLElement> | Signal<HTMLElement | ElementRef<HTMLElement>>, options?: {injector?: Injector}): Signal<DOMRect>;\nexport function boundingClientRect(elementLike: HTMLElement | ElementRef<HTMLElement> | Signal<HTMLElement | ElementRef<HTMLElement> | undefined>, options?: {injector?: Injector}): Signal<DOMRect | undefined>;\nexport function boundingClientRect(elementLike: HTMLElement | ElementRef<HTMLElement> | Signal<HTMLElement | ElementRef<HTMLElement> | undefined>, options?: {injector?: Injector}): Signal<DOMRect | undefined> {\n assertNotInReactiveContext(boundingClientRect, 'Invoking `boundingClientRect` causes new subscriptions every time. Move `boundingClientRect` outside of the reactive context and read the signal value where needed.');\n if (!options?.injector) {\n assertInInjectionContext(boundingClientRect, 'Must be called within an injection context, or an explicit `Injector` passed via options. Stops tracking the bounding box when the injection context is destroyed.');\n }\n\n const injector = options?.injector ?? inject(Injector);\n const zone = injector.get(NgZone);\n const element = computed(() => coerceElement(isSignal(elementLike) ? elementLike() : elementLike));\n const onBoundingBoxChange = signal<void>(undefined, {equal: () => false});\n\n // Subscribe to element bounding box changes.\n effect(onCleanup => {\n const el = element();\n if (!el) {\n return;\n }\n\n untracked(() => {\n const subscription = fromBoundingClientRect$(el)\n // Avoid triggering change detection cycle.\n .pipe(subscribeIn(fn => zone.runOutsideAngular(fn)))\n .subscribe(() => {\n NgZone.assertNotInAngularZone();\n onBoundingBoxChange.set();\n });\n onCleanup(() => subscription.unsubscribe());\n });\n }, {injector});\n\n // Create signal that recomputes each time the bounding box changes.\n return computed(() => {\n const el = element();\n if (!el) {\n return undefined;\n }\n\n // Track bounding box.\n onBoundingBoxChange();\n\n return el.getBoundingClientRect();\n }, {equal: isEqualDomRect});\n}\n\nfunction isEqualDomRect(a: DOMRect | undefined, b: DOMRect | undefined): boolean {\n return a?.top === b?.top && a?.right === b?.right && a?.bottom === b?.bottom && a?.left === b?.left;\n}\n","/*\n * Copyright (c) 2018-2019 Swiss Federal Railways\n *\n * This program and the accompanying materials are made\n * available under the terms of the Eclipse Public License 2.0\n * which is available at https://www.eclipse.org/legal/epl-2.0/\n *\n * SPDX-License-Identifier: EPL-2.0\n */\n\n/*\n * Secondary entrypoint: '@scion/components/dimension'\n *\n * @see https://github.com/ng-packagr/ng-packagr/blob/master/docs/secondary-entrypoints.md\n */\nexport {SciDimensionDirective} from './dimension.directive';\nexport {dimension} from './dimension.signal';\nexport {boundingClientRect} from './bounding-client-rect.signal';\nexport {type SciDimension} from './dimension';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":["ɵZONELESS_ENABLED"],"mappings":";;;;;;;;;AAAA;;;;;;;;AAQG;AAQH;;;;;;;;;AASG;MAIU,qBAAqB,CAAA;AAEhC;;AAEG;IACa,kBAAkB,GAAG,KAAK,CAAC,KAAK;2FAAC;AAEjD;;AAEG;IACa,eAAe,GAAG,MAAM,CAAe,EAAC,KAAK,EAAE,oBAAoB,EAAC,CAAC;AAErF,IAAA,WAAA,GAAA;QACE,MAAM,IAAI,GAAG,MAAM,CAAC,UA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ACdH;;AAEG;;"}
|
|
1
|
+
{"version":3,"file":"scion-components-dimension.mjs","sources":["../../../../projects/scion/components/dimension/src/dimension.directive.ts","../../../../projects/scion/components/dimension/src/dimension.signal.ts","../../../../projects/scion/components/dimension/src/bounding-client-rect.signal.ts","../../../../projects/scion/components/dimension/src/public_api.ts","../../../../projects/scion/components/dimension/src/scion-components-dimension.ts"],"sourcesContent":["/*\n * Copyright (c) 2018-2024 Swiss Federal Railways\n *\n * This program and the accompanying materials are made\n * available under the terms of the Eclipse Public License 2.0\n * which is available at https://www.eclipse.org/legal/epl-2.0/\n *\n * SPDX-License-Identifier: EPL-2.0\n */\n\nimport {Directive, ElementRef, inject, input, NgZone, output, ɵZONELESS_ENABLED} from '@angular/core';\nimport {fromResize$} from '@scion/toolkit/observable';\nimport {takeUntilDestroyed} from '@angular/core/rxjs-interop';\nimport {observeIn, subscribeIn} from '@scion/toolkit/operators';\nimport {SciDimension} from './dimension';\n\n/**\n * Observes the size of the host element.\n *\n * ---\n * Usage:\n *\n * ```html\n * <div sciDimension (sciDimensionChange)=\"onDimensionChange($event)\"></div>\n * ```\n */\n@Directive({\n selector: '[sciDimension]',\n})\nexport class SciDimensionDirective {\n\n /**\n * Controls if to output outside the Angular zone. Defaults to `false`.\n */\n public readonly emitOutsideAngular = input(false);\n\n /**\n * Outputs the size of the element.\n */\n public readonly dimensionChange = output<SciDimension>({alias: 'sciDimensionChange'});\n\n constructor() {\n const host = inject(ElementRef).nativeElement as HTMLElement;\n const zone = inject(NgZone);\n const zonelessEnabled = inject(ɵZONELESS_ENABLED);\n\n fromResize$(host)\n .pipe(\n // Avoid triggering change detection cycle.\n subscribeIn(fn => zone.runOutsideAngular(fn)),\n // Run in animation frame to prevent 'ResizeObserver loop completed with undelivered notifications' error.\n // Do not use `animationFrameScheduler` because the scheduler does not necessarily execute in the current execution context, such as inside or outside Angular.\n // The scheduler always executes tasks in the context (e.g. zone) where the scheduler was first used in the application.\n observeIn(fn => requestAnimationFrame(fn)),\n observeIn(fn => this.emitOutsideAngular() ? fn() : zone.run(fn)),\n takeUntilDestroyed(),\n )\n .subscribe(() => {\n if (!zonelessEnabled) {\n // Assert Angular zone.\n this.emitOutsideAngular() ? NgZone.assertNotInAngularZone() : NgZone.assertInAngularZone();\n }\n\n this.dimensionChange.emit({\n clientWidth: host.clientWidth,\n offsetWidth: host.offsetWidth,\n clientHeight: host.clientHeight,\n offsetHeight: host.offsetHeight,\n element: host,\n });\n });\n }\n}\n","/*\n * Copyright (c) 2018-2024 Swiss Federal Railways\n *\n * This program and the accompanying materials are made\n * available under the terms of the Eclipse Public License 2.0\n * which is available at https://www.eclipse.org/legal/epl-2.0/\n *\n * SPDX-License-Identifier: EPL-2.0\n */\n\nimport {assertNotInReactiveContext, computed, effect, ElementRef, inject, Injector, isSignal, NgZone, signal, Signal, untracked} from '@angular/core';\nimport {SciDimension} from './dimension';\nimport {coerceElement} from '@angular/cdk/coercion';\nimport {Objects} from '@scion/toolkit/util';\nimport {fromResize$} from '@scion/toolkit/observable';\nimport {observeIn, subscribeIn} from '@scion/toolkit/operators';\nimport {ɵassertInInjectionContext} from '@scion/components/common';\n\n/**\n * Creates a signal observing the size of an element.\n *\n * The element can be passed as a signal, enabling observation of view children in the component constructor.\n *\n * The signal subscribes to the native {@link ResizeObserver} to monitor element size changes. Destroying the injection context will unsubscribe the observer.\n *\n * Usage:\n * - Must be called within an injection context or an injector provided. Destroying the injector will unsubscribe the signal.\n * - Must not be called within a reactive context to avoid repeated subscriptions.\n */\nexport function dimension(elementLike: HTMLElement | ElementRef<HTMLElement> | Signal<HTMLElement | ElementRef<HTMLElement>>, options?: {injector?: Injector}): Signal<SciDimension>;\nexport function dimension(elementLike: HTMLElement | ElementRef<HTMLElement> | Signal<HTMLElement | ElementRef<HTMLElement> | undefined>, options?: {injector?: Injector}): Signal<SciDimension | undefined>;\nexport function dimension(elementLike: HTMLElement | ElementRef<HTMLElement> | Signal<HTMLElement | ElementRef<HTMLElement> | undefined>, options?: {injector?: Injector}): Signal<SciDimension | undefined> {\n assertNotInReactiveContext(dimension, 'Invoking `dimension` causes new subscriptions every time. Move `dimension` outside of the reactive context and read the signal value where needed.');\n if (!options?.injector) {\n ɵassertInInjectionContext(dimension, 'Must be called within an injection context, or an explicit `Injector` passed via options. Stops tracking the dimension when the injection context is destroyed.');\n }\n\n const injector = options?.injector ?? inject(Injector);\n const zone = injector.get(NgZone);\n const element = computed(() => coerceElement(isSignal(elementLike) ? elementLike() : elementLike));\n const onResize = signal<void>(undefined, {equal: () => false});\n\n // Subscribe to element size changes.\n effect(onCleanup => {\n const el = element();\n if (!el) {\n return;\n }\n\n untracked(() => {\n const subscription = fromResize$(el)\n .pipe(\n // Avoid triggering change detection cycle.\n subscribeIn(fn => zone.runOutsideAngular(fn)),\n // Run in animation frame to prevent 'ResizeObserver loop completed with undelivered notifications' error.\n // Do not use `animationFrameScheduler` because the scheduler does not necessarily execute in the current execution context, such as inside or outside Angular.\n // The scheduler always executes tasks in the context (e.g. zone) where the scheduler was first used in the application.\n observeIn(fn => requestAnimationFrame(fn)),\n )\n .subscribe(() => {\n NgZone.assertNotInAngularZone();\n onResize.set();\n });\n onCleanup(() => subscription.unsubscribe());\n });\n }, {injector});\n\n // Create signal that recomputes each time the size changes.\n return computed(() => {\n const el = element();\n if (!el) {\n return undefined;\n }\n\n // Track element size.\n onResize();\n\n return {\n clientWidth: el.clientWidth,\n offsetWidth: el.offsetWidth,\n clientHeight: el.clientHeight,\n offsetHeight: el.offsetHeight,\n element: el,\n };\n }, {equal: Objects.isEqual});\n}\n","/*\n * Copyright (c) 2018-2024 Swiss Federal Railways\n *\n * This program and the accompanying materials are made\n * available under the terms of the Eclipse Public License 2.0\n * which is available at https://www.eclipse.org/legal/epl-2.0/\n *\n * SPDX-License-Identifier: EPL-2.0\n */\n\nimport {assertNotInReactiveContext, computed, effect, ElementRef, inject, Injector, isSignal, NgZone, signal, Signal, untracked} from '@angular/core';\nimport {coerceElement} from '@angular/cdk/coercion';\nimport {fromBoundingClientRect$} from '@scion/toolkit/observable';\nimport {subscribeIn} from '@scion/toolkit/operators';\nimport {ɵassertInInjectionContext} from '@scion/components/common';\n\n/**\n * Creates a signal observing the bounding box of an element.\n *\n * The bounding box includes the element's position relative to the top-left of the viewport and its size.\n * Refer to https://developer.mozilla.org/en-US/docs/Web/API/Element/getBoundingClientRect for more details.\n *\n * The element can be passed as a signal, enabling observation of view children in the component constructor.\n *\n * There is no native browser API to observe the position of an element. The signal uses {@link IntersectionObserver} and\n * {@link ResizeObserver} to detect position changes. For tracking only size changes, use the {@link dimension} signal instead.\n *\n * Usage:\n * - Must be called within an injection context or an injector provided. Destroying the injector will unsubscribe the signal.\n * - Must not be called within a reactive context to avoid repeated subscriptions.\n * - The element and the document root (`<html>`) must be positioned `relative` or `absolute`. If not, positioning is changed to `relative`.\n */\nexport function boundingClientRect(elementLike: HTMLElement | ElementRef<HTMLElement> | Signal<HTMLElement | ElementRef<HTMLElement>>, options?: {injector?: Injector}): Signal<DOMRect>;\nexport function boundingClientRect(elementLike: HTMLElement | ElementRef<HTMLElement> | Signal<HTMLElement | ElementRef<HTMLElement> | undefined>, options?: {injector?: Injector}): Signal<DOMRect | undefined>;\nexport function boundingClientRect(elementLike: HTMLElement | ElementRef<HTMLElement> | Signal<HTMLElement | ElementRef<HTMLElement> | undefined>, options?: {injector?: Injector}): Signal<DOMRect | undefined> {\n assertNotInReactiveContext(boundingClientRect, 'Invoking `boundingClientRect` causes new subscriptions every time. Move `boundingClientRect` outside of the reactive context and read the signal value where needed.');\n if (!options?.injector) {\n ɵassertInInjectionContext(boundingClientRect, 'Must be called within an injection context, or an explicit `Injector` passed via options. Stops tracking the bounding box when the injection context is destroyed.');\n }\n\n const injector = options?.injector ?? inject(Injector);\n const zone = injector.get(NgZone);\n const element = computed(() => coerceElement(isSignal(elementLike) ? elementLike() : elementLike));\n const onBoundingBoxChange = signal<void>(undefined, {equal: () => false});\n\n // Subscribe to element bounding box changes.\n effect(onCleanup => {\n const el = element();\n if (!el) {\n return;\n }\n\n untracked(() => {\n const subscription = fromBoundingClientRect$(el)\n // Avoid triggering change detection cycle.\n .pipe(subscribeIn(fn => zone.runOutsideAngular(fn)))\n .subscribe(() => {\n NgZone.assertNotInAngularZone();\n onBoundingBoxChange.set();\n });\n onCleanup(() => subscription.unsubscribe());\n });\n }, {injector});\n\n // Create signal that recomputes each time the bounding box changes.\n return computed(() => {\n const el = element();\n if (!el) {\n return undefined;\n }\n\n // Track bounding box.\n onBoundingBoxChange();\n\n return el.getBoundingClientRect();\n }, {equal: isEqualDomRect});\n}\n\nfunction isEqualDomRect(a: DOMRect | undefined, b: DOMRect | undefined): boolean {\n return a?.top === b?.top && a?.right === b?.right && a?.bottom === b?.bottom && a?.left === b?.left;\n}\n","/*\n * Copyright (c) 2018-2019 Swiss Federal Railways\n *\n * This program and the accompanying materials are made\n * available under the terms of the Eclipse Public License 2.0\n * which is available at https://www.eclipse.org/legal/epl-2.0/\n *\n * SPDX-License-Identifier: EPL-2.0\n */\n\n/*\n * Secondary entrypoint: '@scion/components/dimension'\n *\n * @see https://github.com/ng-packagr/ng-packagr/blob/master/docs/secondary-entrypoints.md\n */\nexport {SciDimensionDirective} from './dimension.directive';\nexport {dimension} from './dimension.signal';\nexport {boundingClientRect} from './bounding-client-rect.signal';\nexport {type SciDimension} from './dimension';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":["ɵZONELESS_ENABLED","ɵassertInInjectionContext"],"mappings":";;;;;;;;;AAAA;;;;;;;;AAQG;AAQH;;;;;;;;;AASG;MAIU,qBAAqB,CAAA;AAEhC;;AAEG;IACa,kBAAkB,GAAG,KAAK,CAAC,KAAK;2FAAC;AAEjD;;AAEG;IACa,eAAe,GAAG,MAAM,CAAe,EAAC,KAAK,EAAE,oBAAoB,EAAC,CAAC;AAErF,IAAA,WAAA,GAAA;QACE,MAAM,IAAI,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC,aAA4B;AAC5D,Q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8 +1,9 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { input, Component, inputBinding, inject, InjectionToken, Injector, assertNotInReactiveContext, runInInjectionContext, Injectable, viewChild, computed, untracked, Directive, makeEnvironmentProviders } from '@angular/core';
|
|
3
|
+
import { coerceSignal, SciComponentOutletDirective } from '@scion/components/common';
|
|
4
4
|
import { fromMutation$ } from '@scion/toolkit/observable';
|
|
5
|
-
import { of, concatWith, map } from 'rxjs';
|
|
5
|
+
import { Observable, of, concatWith, map } from 'rxjs';
|
|
6
|
+
import { rxResource } from '@angular/core/rxjs-interop';
|
|
6
7
|
|
|
7
8
|
/*
|
|
8
9
|
* Copyright (c) 2018-2026 Swiss Federal Railways
|
|
@@ -14,18 +15,43 @@ import { of, concatWith, map } from 'rxjs';
|
|
|
14
15
|
* SPDX-License-Identifier: EPL-2.0
|
|
15
16
|
*/
|
|
16
17
|
/**
|
|
17
|
-
*
|
|
18
|
+
* Renders an icon of an icon font based on its ligature.
|
|
19
|
+
*/
|
|
20
|
+
class SciIconFontComponent {
|
|
21
|
+
/**
|
|
22
|
+
* Specifies the name of the icon font.
|
|
23
|
+
*/
|
|
24
|
+
fontFamily = input.required(/* @ts-ignore */
|
|
25
|
+
...(ngDevMode ? [{ debugName: "fontFamily" }] : /* istanbul ignore next */ []));
|
|
26
|
+
/**
|
|
27
|
+
* Specifies the ligature of the icon.
|
|
28
|
+
*/
|
|
29
|
+
ligature = input.required(/* @ts-ignore */
|
|
30
|
+
...(ngDevMode ? [{ debugName: "ligature" }] : /* istanbul ignore next */ []));
|
|
31
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: SciIconFontComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
32
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.1.7", type: SciIconFontComponent, isStandalone: true, selector: "sci-icon-font", inputs: { fontFamily: { classPropertyName: "fontFamily", publicName: "fontFamily", isSignal: true, isRequired: true, transformFunction: null }, ligature: { classPropertyName: "ligature", publicName: "ligature", isSignal: true, isRequired: true, transformFunction: null } }, host: { properties: { "attr.data-ligature": "ligature()", "style.font-family": "fontFamily()" } }, ngImport: i0, template: '', isInline: true, styles: [":host{font-style:normal;font-weight:400;font-variant:normal;display:inline-block;text-transform:none;line-height:1;white-space:nowrap;word-wrap:normal;direction:ltr;letter-spacing:0;font-feature-settings:\"liga\";font-variant-ligatures:discretionary-ligatures;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;text-box-trim:trim-start;text-box-edge:text alphabetic}:host:before{content:attr(data-ligature)}\n"] });
|
|
33
|
+
}
|
|
34
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: SciIconFontComponent, decorators: [{
|
|
35
|
+
type: Component,
|
|
36
|
+
args: [{ selector: 'sci-icon-font', template: '', host: {
|
|
37
|
+
'[attr.data-ligature]': 'ligature()',
|
|
38
|
+
'[style.font-family]': 'fontFamily()',
|
|
39
|
+
}, styles: [":host{font-style:normal;font-weight:400;font-variant:normal;display:inline-block;text-transform:none;line-height:1;white-space:nowrap;word-wrap:normal;direction:ltr;letter-spacing:0;font-feature-settings:\"liga\";font-variant-ligatures:discretionary-ligatures;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;text-box-trim:trim-start;text-box-edge:text alphabetic}:host:before{content:attr(data-ligature)}\n"] }]
|
|
40
|
+
}], propDecorators: { fontFamily: [{ type: i0.Input, args: [{ isSignal: true, alias: "fontFamily", required: true }] }], ligature: [{ type: i0.Input, args: [{ isSignal: true, alias: "ligature", required: true }] }] } });
|
|
41
|
+
|
|
42
|
+
/*
|
|
43
|
+
* Copyright (c) 2018-2026 Swiss Federal Railways
|
|
44
|
+
*
|
|
45
|
+
* This program and the accompanying materials are made
|
|
46
|
+
* available under the terms of the Eclipse Public License 2.0
|
|
47
|
+
* which is available at https://www.eclipse.org/legal/epl-2.0/
|
|
48
|
+
*
|
|
49
|
+
* SPDX-License-Identifier: EPL-2.0
|
|
18
50
|
*/
|
|
19
|
-
const materialIconProvider = (ligature) => {
|
|
20
|
-
if (ligature.startsWith('scion.')) {
|
|
21
|
-
return undefined; // delegate to next provider
|
|
22
|
-
}
|
|
23
|
-
return { component: MaterialIconComponent, bindings: [inputBinding('ligature', () => ligature)] };
|
|
24
|
-
};
|
|
25
51
|
/**
|
|
26
|
-
*
|
|
52
|
+
* Provides Material icons for non-scion icons.
|
|
27
53
|
*
|
|
28
|
-
* This
|
|
54
|
+
* This provider requires a Material icon font to be included in the HTML.
|
|
29
55
|
*
|
|
30
56
|
* Supported fonts:
|
|
31
57
|
* - https://fonts.googleapis.com/css2?family=Material+Symbols+Rounded
|
|
@@ -33,19 +59,18 @@ const materialIconProvider = (ligature) => {
|
|
|
33
59
|
* - https://fonts.googleapis.com/css2?family=Material+Symbols+Sharp
|
|
34
60
|
* - https://fonts.googleapis.com/css?family=Material+Icons|Material+Icons+Outlined|Material+Icons+Round|Material+Icons+Sharp
|
|
35
61
|
*/
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}], propDecorators: { ligature: [{ type: i0.Input, args: [{ isSignal: true, alias: "ligature", required: true }] }] } });
|
|
62
|
+
const materialIconProvider = (ligature) => {
|
|
63
|
+
if (ligature.startsWith('scion:')) {
|
|
64
|
+
return undefined; // delegate to next provider
|
|
65
|
+
}
|
|
66
|
+
return {
|
|
67
|
+
component: SciIconFontComponent,
|
|
68
|
+
bindings: [
|
|
69
|
+
inputBinding('fontFamily', () => `'Material Symbols Rounded', 'Material Symbols Outlined', 'Material Symbols Sharp', 'Material Icons', 'Material Icons Outlined', 'Material Icons Round', 'Material Icons Sharp'`),
|
|
70
|
+
inputBinding('ligature', () => ligature),
|
|
71
|
+
],
|
|
72
|
+
};
|
|
73
|
+
};
|
|
49
74
|
|
|
50
75
|
/*
|
|
51
76
|
* Copyright (c) 2018-2026 Swiss Federal Railways
|
|
@@ -60,32 +85,27 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImpor
|
|
|
60
85
|
* Provides icons used in SCION libraries.
|
|
61
86
|
*
|
|
62
87
|
* Register this provider as the last icon provider, enabling replacement of built-in SCION icons.
|
|
88
|
+
*
|
|
89
|
+
* This provider requires the SCION icon font 'scion-icons' to be included in the HTML:
|
|
90
|
+
*
|
|
91
|
+
* scss
|
|
92
|
+
* ```
|
|
93
|
+
* @import url('https://cdn.jsdelivr.net/npm/@scion/icons/scion-icon-font.css');
|
|
94
|
+
* ```
|
|
63
95
|
*/
|
|
64
96
|
const scionIconProvider = (icon) => {
|
|
65
|
-
const ligature = icon.startsWith('scion
|
|
97
|
+
const ligature = icon.startsWith('scion:') ? icon.substring('scion:'.length) : undefined;
|
|
66
98
|
if (ligature) {
|
|
67
|
-
return {
|
|
99
|
+
return {
|
|
100
|
+
component: SciIconFontComponent,
|
|
101
|
+
bindings: [
|
|
102
|
+
inputBinding('fontFamily', () => 'scion-icons'),
|
|
103
|
+
inputBinding('ligature', () => ligature),
|
|
104
|
+
],
|
|
105
|
+
};
|
|
68
106
|
}
|
|
69
107
|
return undefined;
|
|
70
108
|
};
|
|
71
|
-
/**
|
|
72
|
-
* Renders the icon for a ligature of the SCION icon font.
|
|
73
|
-
*
|
|
74
|
-
* This component requires the SCION icon font 'scion-icons' to be included in the HTML.
|
|
75
|
-
*/
|
|
76
|
-
class SciIconFontGlyphComponent {
|
|
77
|
-
/**
|
|
78
|
-
* Specifies the ligature of the icon.
|
|
79
|
-
*/
|
|
80
|
-
ligature = input.required(/* @ts-ignore */
|
|
81
|
-
...(ngDevMode ? [{ debugName: "ligature" }] : /* istanbul ignore next */ []));
|
|
82
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: SciIconFontGlyphComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
83
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.1.7", type: SciIconFontGlyphComponent, isStandalone: true, selector: "sci-icon-font-glyph", inputs: { ligature: { classPropertyName: "ligature", publicName: "ligature", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0, template: '{{ligature()}}', isInline: true, styles: [":host{font-family:scion-icons;font-style:normal;font-weight:400;font-variant:normal;text-transform:none;line-height:1;letter-spacing:0;font-feature-settings:\"liga\";font-variant-ligatures:discretionary-ligatures;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}\n"] });
|
|
84
|
-
}
|
|
85
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: SciIconFontGlyphComponent, decorators: [{
|
|
86
|
-
type: Component,
|
|
87
|
-
args: [{ selector: 'sci-icon-font-glyph', template: '{{ligature()}}', styles: [":host{font-family:scion-icons;font-style:normal;font-weight:400;font-variant:normal;text-transform:none;line-height:1;letter-spacing:0;font-feature-settings:\"liga\";font-variant-ligatures:discretionary-ligatures;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}\n"] }]
|
|
88
|
-
}], propDecorators: { ligature: [{ type: i0.Input, args: [{ isSignal: true, alias: "ligature", required: true }] }] } });
|
|
89
109
|
|
|
90
110
|
/*
|
|
91
111
|
* Copyright (c) 2018-2026 Swiss Federal Railways
|
|
@@ -112,9 +132,10 @@ class IconProviders {
|
|
|
112
132
|
/**
|
|
113
133
|
* Provides the icon descriptor for the given icon based on icon providers registered under the {@link SCI_ICON_PROVIDER} DI token.
|
|
114
134
|
*
|
|
115
|
-
* Icon providers are called in registration order.
|
|
135
|
+
* Icon providers are called in registration order. Returning `undefined` delegates to the next provider.
|
|
116
136
|
*/
|
|
117
137
|
provide(icon) {
|
|
138
|
+
assertNotInReactiveContext(this.provide, 'Call IconProviders.provide() in a non-reactive (non-tracking) context.');
|
|
118
139
|
if (!icon) {
|
|
119
140
|
return undefined;
|
|
120
141
|
}
|
|
@@ -163,7 +184,17 @@ const SCI_ICON_PROVIDER = new InjectionToken('SCI_ICON_PROVIDER');
|
|
|
163
184
|
* <sci-icon>home</sci-icon>
|
|
164
185
|
* ```
|
|
165
186
|
*
|
|
166
|
-
*
|
|
187
|
+
* Icons can be contributed via icon providers. Register an icon provider using the {@link provideIconProvider} function.
|
|
188
|
+
*
|
|
189
|
+
* ```ts
|
|
190
|
+
* import {provideIconProvider} from '@scion/components/icon';
|
|
191
|
+
* import {ComponentType} from '@angular/cdk/portal';
|
|
192
|
+
* import {SciComponentDescriptor} from '@scion/components/common';
|
|
193
|
+
*
|
|
194
|
+
* provideIconProvider((icon: string): ComponentType<unknown> | SciComponentDescriptor | undefined => {
|
|
195
|
+
* return ...;
|
|
196
|
+
* });
|
|
197
|
+
* ```
|
|
167
198
|
*
|
|
168
199
|
* Providers are called in registration order. If a provider does not provide the icon, the next provider is called, and so on.
|
|
169
200
|
* If no provider provides the icon, defaults to a Material icon provider, interpreting the icon as a Material icon font ligature.
|
|
@@ -182,70 +213,76 @@ const SCI_ICON_PROVIDER = new InjectionToken('SCI_ICON_PROVIDER');
|
|
|
182
213
|
* TODO [Angular 23] Consider changing encapsulation to `IsolatedShadowDom` when stable. See branch: issue/icon-shadow-dom.
|
|
183
214
|
*/
|
|
184
215
|
class SciIconComponent {
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
216
|
+
slottedContent = this.computeSlottedContent();
|
|
217
|
+
iconDescriptor = this.computeIconDescriptor();
|
|
218
|
+
_slotTemplate = viewChild.required('slot_template', /* @ts-ignore */
|
|
219
|
+
...(ngDevMode ? [{ debugName: "_slotTemplate" }] : /* istanbul ignore next */ []));
|
|
220
|
+
computeIconDescriptor() {
|
|
221
|
+
const iconProviders = inject(IconProviders);
|
|
222
|
+
return computed(() => {
|
|
223
|
+
const slottedContent = this.slottedContent.value();
|
|
224
|
+
return untracked(() => {
|
|
225
|
+
const iconDescriptor = iconProviders.provide(slottedContent);
|
|
226
|
+
// Augment icon descriptor.
|
|
227
|
+
return iconDescriptor && {
|
|
228
|
+
...iconDescriptor,
|
|
229
|
+
attributes: computed(() => ({
|
|
230
|
+
...coerceSignal(iconDescriptor.attributes)?.(),
|
|
231
|
+
// Prevent user agent translating the icon.
|
|
232
|
+
translate: 'no',
|
|
233
|
+
})),
|
|
234
|
+
directives: [
|
|
235
|
+
...iconDescriptor.directives ?? [],
|
|
236
|
+
// Set icon font size to 'var(--sci-icon-size, 1em)', required to inherit the location's font size for icons with a fixed font size.
|
|
237
|
+
// For example, Material sets a fixed font size of 24px.
|
|
238
|
+
IconFontSizeDirective,
|
|
239
|
+
],
|
|
240
|
+
};
|
|
241
|
+
});
|
|
242
|
+
});
|
|
243
|
+
}
|
|
188
244
|
/**
|
|
189
|
-
* Reads the icon from slotted content
|
|
245
|
+
* Reads the icon from slotted content.
|
|
190
246
|
*/
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
untracked(() => {
|
|
198
|
-
// Instantiate template to "read" slotted content.
|
|
199
|
-
const view = slottedContent.createEmbeddedView(undefined);
|
|
200
|
-
onCleanup(() => view.destroy());
|
|
247
|
+
computeSlottedContent() {
|
|
248
|
+
return rxResource({
|
|
249
|
+
params: () => this._slotTemplate(),
|
|
250
|
+
stream: ({ params: slotTemplate }) => new Observable(observer => {
|
|
251
|
+
// Instantiate template to read slotted content.
|
|
252
|
+
const view = slotTemplate.createEmbeddedView(undefined);
|
|
201
253
|
// Return if empty, i.e., no icon to render.
|
|
202
254
|
if (!view.rootNodes.length) {
|
|
203
|
-
|
|
255
|
+
observer.next(undefined);
|
|
204
256
|
return;
|
|
205
257
|
}
|
|
206
258
|
// Ensure only text is provided as slotted content.
|
|
207
259
|
if (view.rootNodes.length > 1 || view.rootNodes[0].nodeType !== Node.TEXT_NODE) {
|
|
208
|
-
|
|
260
|
+
observer.error(Error('[InvalidInputError] Only text (ligature) is allowed in slotted content of <sci-icon>.'));
|
|
261
|
+
return;
|
|
209
262
|
}
|
|
210
|
-
//
|
|
263
|
+
// Observe slotted content.
|
|
211
264
|
const textNode = view.rootNodes[0];
|
|
212
265
|
const subscription = of(textNode.textContent)
|
|
213
|
-
.pipe(concatWith(fromMutation$(textNode, { characterData: true }).pipe(map(() => textNode.textContent))), map(slottedContent =>
|
|
214
|
-
.subscribe(
|
|
215
|
-
|
|
216
|
-
|
|
266
|
+
.pipe(concatWith(fromMutation$(textNode, { characterData: true }).pipe(map(() => textNode.textContent))), map(slottedContent => slottedContent.trim() || undefined))
|
|
267
|
+
.subscribe(observer);
|
|
268
|
+
return () => {
|
|
269
|
+
subscription.unsubscribe();
|
|
270
|
+
view.destroy();
|
|
271
|
+
};
|
|
272
|
+
}),
|
|
217
273
|
});
|
|
218
|
-
return icon;
|
|
219
274
|
}
|
|
220
275
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: SciIconComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
221
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.1.7", type: SciIconComponent, isStandalone: true, selector: "sci-icon", viewQueries: [{ propertyName: "
|
|
276
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.1.7", type: SciIconComponent, isStandalone: true, selector: "sci-icon", host: { properties: { "attr.icon": "slottedContent.value()" } }, viewQueries: [{ propertyName: "_slotTemplate", first: true, predicate: ["slot_template"], descendants: true, isSignal: true }], ngImport: i0, template: "<ng-container *sciComponentOutlet=\"iconDescriptor()\"/>\n\n<!--Template to capture slotted content. -->\n<ng-template #slot_template>\n <ng-content/>\n</ng-template>\n", styles: [":host{display:inline-grid;place-content:center;-webkit-user-select:none;user-select:none;height:var(--sci-icon-size, 1em);width:var(--sci-icon-size, 1em);overflow:hidden}\n"], dependencies: [{ kind: "directive", type: SciComponentOutletDirective, selector: "ng-template[sciComponentOutlet]", inputs: ["sciComponentOutlet"] }] });
|
|
222
277
|
}
|
|
223
278
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: SciIconComponent, decorators: [{
|
|
224
279
|
type: Component,
|
|
225
280
|
args: [{ selector: 'sci-icon', imports: [
|
|
226
281
|
SciComponentOutletDirective,
|
|
227
|
-
],
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
*
|
|
232
|
-
* - Prevents the browser from translating the icon.
|
|
233
|
-
* - Sets the icon's font size to 'var(--sci-icon-size, 1em)', required to inherit the location's font size for icons with a fixed font size.
|
|
234
|
-
* For example, Material sets a fixed font size of 24px.
|
|
235
|
-
*/
|
|
236
|
-
function augmentIconDescriptor() {
|
|
237
|
-
return map((icon) => icon && {
|
|
238
|
-
...icon,
|
|
239
|
-
attributes: computed(() => ({
|
|
240
|
-
...coerceSignal(icon.attributes)?.(),
|
|
241
|
-
translate: 'no',
|
|
242
|
-
})),
|
|
243
|
-
directives: [
|
|
244
|
-
...icon.directives ?? [],
|
|
245
|
-
IconFontSizeDirective,
|
|
246
|
-
],
|
|
247
|
-
});
|
|
248
|
-
}
|
|
282
|
+
], host: {
|
|
283
|
+
'[attr.icon]': 'slottedContent.value()', // Public API: Enables selecting the icon by name in CSS
|
|
284
|
+
}, template: "<ng-container *sciComponentOutlet=\"iconDescriptor()\"/>\n\n<!--Template to capture slotted content. -->\n<ng-template #slot_template>\n <ng-content/>\n</ng-template>\n", styles: [":host{display:inline-grid;place-content:center;-webkit-user-select:none;user-select:none;height:var(--sci-icon-size, 1em);width:var(--sci-icon-size, 1em);overflow:hidden}\n"] }]
|
|
285
|
+
}], propDecorators: { _slotTemplate: [{ type: i0.ViewChild, args: ['slot_template', { isSignal: true }] }] } });
|
|
249
286
|
/**
|
|
250
287
|
* Sets the font size to 'var(--sci-icon-size, 1em)', required to inherit the location's font size for icons with a fixed font size.
|
|
251
288
|
* For example, Material sets a fixed font size of 24px.
|
|
@@ -273,23 +310,22 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImpor
|
|
|
273
310
|
*
|
|
274
311
|
* An icon provider is a function that returns a component for an icon. The component renders the icon.
|
|
275
312
|
*
|
|
276
|
-
* Multiple icon providers can be registered. Providers are called in registration order.
|
|
277
|
-
* the next provider is called, and so on.
|
|
313
|
+
* Multiple icon providers can be registered. Providers are called in registration order. Returning `undefined` delegates to the next provider.
|
|
278
314
|
*
|
|
279
315
|
* Defaults to a Material icon provider, interpreting the icon as a Material icon ligature.
|
|
280
316
|
*
|
|
281
317
|
* Refer to https://fonts.google.com/icons for available Material icons and https://developers.google.com/fonts/docs/material_symbols#use_in_web
|
|
282
318
|
* for instructions on including the Material icon font.
|
|
283
319
|
*
|
|
284
|
-
* @example - Importing the Material icon font in `styles.scss`
|
|
320
|
+
* @example - Importing the Material icon font in `src/styles.scss`
|
|
285
321
|
* ```scss
|
|
286
322
|
* @import url('https://fonts.googleapis.com/css2?family=Material+Symbols+Rounded:opsz,wght,FILL@20..24,400,0&display=block');
|
|
287
323
|
* ```
|
|
288
324
|
*
|
|
289
|
-
* Built-in SCION icons start with the `scion
|
|
325
|
+
* 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.
|
|
290
326
|
* Refer to https://icons.scion.vercel.app for available SCION icons.
|
|
291
327
|
*
|
|
292
|
-
* The function can call `inject` to get
|
|
328
|
+
* The function can call `inject` to get required dependencies.
|
|
293
329
|
*
|
|
294
330
|
* @see SciIconProviderFn
|
|
295
331
|
* @see SciIconComponent
|
|
@@ -323,5 +359,5 @@ function provideIconProvider(iconProviderFn) {
|
|
|
323
359
|
* Generated bundle index. Do not edit.
|
|
324
360
|
*/
|
|
325
361
|
|
|
326
|
-
export { SciIconComponent, provideIconProvider };
|
|
362
|
+
export { SciIconComponent, SciIconFontComponent, provideIconProvider };
|
|
327
363
|
//# sourceMappingURL=scion-components-icon.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scion-components-icon.mjs","sources":["../../../../projects/scion/components/icon/src/material-icon-provider.ts","../../../../projects/scion/components/icon/src/scion-icon-provider.ts","../../../../projects/scion/components/icon/src/icon-providers.ts","../../../../projects/scion/components/icon/src/icon.component.ts","../../../../projects/scion/components/icon/src/icon.component.html","../../../../projects/scion/components/icon/src/icon.provider.ts","../../../../projects/scion/components/icon/src/public_api.ts","../../../../projects/scion/components/icon/src/scion-components-icon.ts"],"sourcesContent":["/*\n * Copyright (c) 2018-2026 Swiss Federal Railways\n *\n * This program and the accompanying materials are made\n * available under the terms of the Eclipse Public License 2.0\n * which is available at https://www.eclipse.org/legal/epl-2.0/\n *\n * SPDX-License-Identifier: EPL-2.0\n */\n\nimport {Component, input, inputBinding} from '@angular/core';\nimport {SciIconProviderFn} from './icon.provider';\nimport {SciComponentDescriptor} from '@scion/components/common';\n\n/**\n * Provides Material icons for non-scion icons.\n */\nexport const materialIconProvider: SciIconProviderFn = (ligature: string): SciComponentDescriptor | undefined => {\n if (ligature.startsWith('scion.')) {\n return undefined; // delegate to next provider\n }\n\n return {component: MaterialIconComponent, bindings: [inputBinding('ligature', () => ligature)]};\n};\n\n/**\n * Renders a Material icon based on its ligature.\n *\n * This component requires a Material icon font to be included in the HTML.\n *\n * Supported fonts:\n * - https://fonts.googleapis.com/css2?family=Material+Symbols+Rounded\n * - https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined\n * - https://fonts.googleapis.com/css2?family=Material+Symbols+Sharp\n * - https://fonts.googleapis.com/css?family=Material+Icons|Material+Icons+Outlined|Material+Icons+Round|Material+Icons+Sharp\n */\n@Component({\n selector: 'sci-material-icon',\n template: '{{ligature()}}',\n styles: `\n :host {\n font-family: 'Material Symbols Rounded', 'Material Symbols Outlined', 'Material Symbols Sharp', 'Material Icons', 'Material Icons Outlined', 'Material Icons Round', 'Material Icons Sharp';\n font-weight: normal;\n font-style: normal;\n line-height: 1;\n letter-spacing: normal;\n text-transform: none;\n display: inline-block;\n white-space: nowrap;\n word-wrap: normal;\n direction: ltr;\n font-feature-settings: 'liga';\n -webkit-font-smoothing: antialiased;\n }\n `,\n})\nexport class MaterialIconComponent {\n /**\n * Specifies the ligature of the Material icon.\n */\n public readonly ligature = input.required<string>();\n}\n","/*\n * Copyright (c) 2018-2026 Swiss Federal Railways\n *\n * This program and the accompanying materials are made\n * available under the terms of the Eclipse Public License 2.0\n * which is available at https://www.eclipse.org/legal/epl-2.0/\n *\n * SPDX-License-Identifier: EPL-2.0\n */\n\nimport {Component, input, inputBinding} from '@angular/core';\nimport {SciIconProviderFn} from './icon.provider';\nimport {SciComponentDescriptor} from '@scion/components/common';\n\n/**\n * Provides icons used in SCION libraries.\n *\n * Register this provider as the last icon provider, enabling replacement of built-in SCION icons.\n */\nexport const scionIconProvider: SciIconProviderFn = (icon: string): SciComponentDescriptor | undefined => {\n const ligature = icon.startsWith('scion.') ? icon.substring('scion.'.length) : undefined;\n if (ligature) {\n return {component: SciIconFontGlyphComponent, bindings: [inputBinding('ligature', () => ligature)]};\n }\n return undefined;\n};\n\n/**\n * Renders the icon for a ligature of the SCION icon font.\n *\n * This component requires the SCION icon font 'scion-icons' to be included in the HTML.\n */\n@Component({\n selector: 'sci-icon-font-glyph',\n template: '{{ligature()}}',\n styles: `\n :host {\n font-family: 'scion-icons';\n font-style: normal;\n font-weight: normal;\n font-variant: normal;\n text-transform: none;\n line-height: 1;\n\n /* Enable Ligatures */\n letter-spacing: 0;\n font-feature-settings: \"liga\";\n font-variant-ligatures: discretionary-ligatures;\n\n /* Better Font Rendering */\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n }\n `,\n})\nexport class SciIconFontGlyphComponent {\n\n /**\n * Specifies the ligature of the icon.\n */\n public readonly ligature = input.required<string>();\n}\n","/*\n * Copyright (c) 2018-2026 Swiss Federal Railways\n *\n * This program and the accompanying materials are made\n * available under the terms of the Eclipse Public License 2.0\n * which is available at https://www.eclipse.org/legal/epl-2.0/\n *\n * SPDX-License-Identifier: EPL-2.0\n */\n\nimport {inject, Injectable, InjectionToken, Injector, runInInjectionContext} from '@angular/core';\nimport {materialIconProvider} from './material-icon-provider';\nimport {scionIconProvider} from './scion-icon-provider';\nimport {SciIconProviderFn} from './icon.provider';\nimport {SciComponentDescriptor} from '@scion/components/common';\n\n/**\n * Provides icons based on registered icon providers.\n */\n@Injectable({providedIn: 'root'})\nexport class IconProviders {\n\n private readonly _iconProviders: SciIconProviderFn[] = [\n // Provide app-specific icons.\n ...inject(SCI_ICON_PROVIDER, {optional: true}) ?? [],\n // Provide SCION icons.\n scionIconProvider,\n // Provide material icons.\n materialIconProvider,\n ];\n private readonly _injector = inject(Injector);\n\n /**\n * Provides the icon descriptor for the given icon based on icon providers registered under the {@link SCI_ICON_PROVIDER} DI token.\n *\n * Icon providers are called in registration order. If a provider does not provide the icon, the next provider is called, and so on.\n */\n public provide(icon: string | undefined): SciComponentDescriptor | undefined {\n if (!icon) {\n return undefined;\n }\n\n if (!this._iconProviders.length) {\n return undefined;\n }\n\n for (const iconProvider of this._iconProviders) {\n const componentOrDescriptor = runInInjectionContext(this._injector, () => iconProvider(icon));\n if (componentOrDescriptor) {\n return typeof componentOrDescriptor === 'function' ? {component: componentOrDescriptor} : componentOrDescriptor;\n }\n }\n return undefined;\n }\n}\n\n/**\n * Multi-DI token for injecting icon providers.\n *\n * @see provideIconProvider\n * @see SciIconProviderFn\n */\nexport const SCI_ICON_PROVIDER = new InjectionToken<SciIconProviderFn[]>('SCI_ICON_PROVIDER');\n","/*\n * Copyright (c) 2018-2026 Swiss Federal Railways\n *\n * This program and the accompanying materials are made\n * available under the terms of the Eclipse Public License 2.0\n * which is available at https://www.eclipse.org/legal/epl-2.0/\n *\n * SPDX-License-Identifier: EPL-2.0\n */\n\nimport {Component, computed, Directive, effect, inject, signal, Signal, TemplateRef, untracked, viewChild} from '@angular/core';\nimport {coerceSignal, SciComponentDescriptor, SciComponentOutletDirective} from '@scion/components/common';\nimport {IconProviders} from './icon-providers';\nimport {fromMutation$} from '@scion/toolkit/observable';\nimport {concatWith, map, MonoTypeOperatorFunction, of} from 'rxjs';\n\n/**\n * Renders an icon based on registered icon providers.\n *\n * Set the icon name as the slotted content of the `<sci-icon>` component.\n *\n * Example:\n * ```html\n * <sci-icon>home</sci-icon>\n * ```\n *\n * An icon provider can be registered using {@link provideIconProvider}.\n *\n * Providers are called in registration order. If a provider does not provide the icon, the next provider is called, and so on.\n * If no provider provides the icon, defaults to a Material icon provider, interpreting the icon as a Material icon font ligature.\n * Refer to https://fonts.google.com/icons for available Material icons and instructions on including the Material icon font.\n *\n * 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.\n *\n * ```scss\n * sci-icon {\n * --sci-icon-size: 16px;\n * }\n * ```\n *\n * @see provideIconProvider\n *\n * TODO [Angular 23] Consider changing encapsulation to `IsolatedShadowDom` when stable. See branch: issue/icon-shadow-dom.\n */\n@Component({\n selector: 'sci-icon',\n templateUrl: './icon.component.html',\n styleUrl: './icon.component.scss',\n imports: [\n SciComponentOutletDirective,\n ],\n})\nexport class SciIconComponent {\n\n private readonly _slottedContent = viewChild.required<TemplateRef<void>>('slotted_content');\n\n protected readonly icon = this.computeIcon();\n\n /**\n * Reads the icon from slotted content and passes it to registered icon providers for resolution.\n */\n private computeIcon(): Signal<SciComponentDescriptor | undefined> {\n const icon = signal<SciComponentDescriptor | undefined>(undefined);\n const iconProviders = inject(IconProviders);\n\n effect(onCleanup => {\n const slottedContent = this._slottedContent();\n\n untracked(() => {\n // Instantiate template to \"read\" slotted content.\n const view = slottedContent.createEmbeddedView(undefined);\n onCleanup(() => view.destroy());\n\n // Return if empty, i.e., no icon to render.\n if (!view.rootNodes.length) {\n icon.set(undefined);\n return;\n }\n\n // Ensure only text is provided as slotted content.\n if (view.rootNodes.length > 1 || (view.rootNodes[0] as Element).nodeType !== Node.TEXT_NODE) {\n throw Error('[InvalidInputError] Only text (ligature) is allowed in slotted content of <sci-icon>.');\n }\n\n // Watch slotted content.\n const textNode = view.rootNodes[0] as Text;\n const subscription = of(textNode.textContent)\n .pipe(\n concatWith(fromMutation$(textNode, {characterData: true}).pipe(map(() => textNode.textContent))),\n map(slottedContent => iconProviders.provide(slottedContent.trim() || undefined)),\n augmentIconDescriptor(),\n )\n .subscribe(iconDescriptor => icon.set(iconDescriptor));\n\n onCleanup(() => subscription.unsubscribe());\n });\n });\n\n return icon;\n }\n}\n\n/**\n * Augments the icon descriptor:\n *\n * - Prevents the browser from translating the icon.\n * - Sets the icon's font size to 'var(--sci-icon-size, 1em)', required to inherit the location's font size for icons with a fixed font size.\n * For example, Material sets a fixed font size of 24px.\n */\nfunction augmentIconDescriptor(): MonoTypeOperatorFunction<SciComponentDescriptor | undefined> {\n return map((icon: SciComponentDescriptor | undefined) => icon && {\n ...icon,\n attributes: computed(() => ({\n ...coerceSignal(icon.attributes)?.(),\n translate: 'no',\n })),\n directives: [\n ...icon.directives ?? [],\n IconFontSizeDirective,\n ],\n } satisfies SciComponentDescriptor);\n}\n\n/**\n * Sets the font size to 'var(--sci-icon-size, 1em)', required to inherit the location's font size for icons with a fixed font size.\n * For example, Material sets a fixed font size of 24px.\n */\n@Directive({host: {'[style.font-size]': `'var(--sci-icon-size, 1em)'`}})\nclass IconFontSizeDirective {\n}\n","<ng-container *sciComponentOutlet=\"icon()\"/>\n\n<!--Template to capture slotted content. -->\n<ng-template #slotted_content>\n <ng-content/>\n</ng-template>\n","/*\n * Copyright (c) 2018-2026 Swiss Federal Railways\n *\n * This program and the accompanying materials are made\n * available under the terms of the Eclipse Public License 2.0\n * which is available at https://www.eclipse.org/legal/epl-2.0/\n *\n * SPDX-License-Identifier: EPL-2.0\n */\n\nimport {EnvironmentProviders, makeEnvironmentProviders} from '@angular/core';\nimport {SCI_ICON_PROVIDER} from './icon-providers';\nimport {ComponentType} from '@angular/cdk/portal';\nimport {SciComponentDescriptor} from '@scion/components/common';\n\n/**\n * Enables contribution or replacement of icons used in SCION.\n *\n * An icon provider is a function that returns a component for an icon. The component renders the icon.\n *\n * Multiple icon providers can be registered. Providers are called in registration order. If a provider does not provide the icon,\n * the next provider is called, and so on.\n *\n * Defaults to a Material icon provider, interpreting the icon as a Material icon ligature.\n *\n * Refer to https://fonts.google.com/icons for available Material icons and https://developers.google.com/fonts/docs/material_symbols#use_in_web\n * for instructions on including the Material icon font.\n *\n * @example - Importing the Material icon font in `styles.scss`\n * ```scss\n * @import url('https://fonts.googleapis.com/css2?family=Material+Symbols+Rounded:opsz,wght,FILL@20..24,400,0&display=block');\n * ```\n *\n * 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.\n * Refer to https://icons.scion.vercel.app for available SCION icons.\n *\n * The function can call `inject` to get any required dependencies.\n *\n * @see SciIconProviderFn\n * @see SciIconComponent\n */\nexport function provideIconProvider(iconProviderFn: SciIconProviderFn | undefined): EnvironmentProviders {\n return makeEnvironmentProviders(iconProviderFn ? [\n {\n provide: SCI_ICON_PROVIDER,\n useValue: iconProviderFn,\n multi: true,\n },\n ] : []);\n}\n\n/**\n * Signature of a function to provide icons.\n *\n * An icon provider is a function that returns the component for an icon. The component renders the icon.\n *\n * Alternatively, the icon provider can return a descriptor, allowing for additional configuration such as inputs.\n * Inputs are available as input properties in the component. The component can use the inputs to render the icon.\n *\n * Icon keys used by SCION start with the `scion.` prefix. To not replace SCION icons, the icon provider can\n * return `undefined` for icons starting with the `scion.` prefix.\n *\n * An icon provider can be registered via {@link provideIconProvider} function.\n *\n * The function can call `inject` to get any required dependencies.\n *\n * @param icon - The key of the icon for which to provide the icon component.\n * @returns ComponentType or {@link SciComponentDescriptor} to render the icon, or `undefined` if not provided by the icon provider.\n */\nexport type SciIconProviderFn = (icon: string) => ComponentType<unknown> | SciComponentDescriptor | undefined;\n","/*\n * Copyright (c) 2018-2026 Swiss Federal Railways\n *\n * This program and the accompanying materials are made\n * available under the terms of the Eclipse Public License 2.0\n * which is available at https://www.eclipse.org/legal/epl-2.0/\n *\n * SPDX-License-Identifier: EPL-2.0\n */\n\n/*\n * Secondary entrypoint: '@scion/components/icon'\n *\n * @see https://github.com/ng-packagr/ng-packagr/blob/master/docs/secondary-entrypoints.md\n */\nexport {SciIconComponent} from './icon.component';\nexport {provideIconProvider, type SciIconProviderFn} from './icon.provider';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;;;;AAAA;;;;;;;;AAQG;AAMH;;AAEG;AACI,MAAM,oBAAoB,GAAsB,CAAC,QAAgB,KAAwC;AAC9G,IAAA,IAAI,QAAQ,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE;QACjC,OAAO,SAAS,CAAC;IACnB;AAEA,IAAA,OAAO,EAAC,SAAS,EAAE,qBAAqB,EAAE,QAAQ,EAAE,CAAC,YAAY,CAAC,UAAU,EAAE,MAAM,QAAQ,CAAC,CAAC,EAAC;AACjG,CAAC;AAED;;;;;;;;;;AAUG;MAqBU,qBAAqB,CAAA;AAChC;;AAEG;IACa,QAAQ,GAAG,KAAK,CAAC,QAAQ;iFAAU;uGAJxC,qBAAqB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;AAArB,IAAA,OAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,qBAAqB,yNAlBtB,gBAAgB,EAAA,QAAA,EAAA,IAAA,EAAA,MAAA,EAAA,CAAA,oZAAA,CAAA,EAAA,CAAA;;2FAkBf,qBAAqB,EAAA,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IAAI;AACP,QAAA,UAAU,EAAE,QAAQ,CAAC,OAAO;AAC1B,YAAA,GAAG,YAAY,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI;AACpC,YAAA,SAAS,EAAE,IAAI;AAChB,SAAA,CAAC,CAAC;AACH,QAAA,UAAU,EAAE;AACV,YAAA,GAAG,IAAI,CAAC,UAAU,IAAI,EAAE;YACxB,qBAAqB;AACtB,SAAA;AAC+B,KAAA,CAAC;AACrC;AAEA;;;AAGG;AACH,MACM,qBAAqB,CAAA;uGAArB,qBAAqB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;2FAArB,qBAAqB,EAAA,YAAA,EAAA,IAAA,EAAA,IAAA,EAAA,EAAA,UAAA,EAAA,EAAA,iBAAA,EAAA,6BAAA,EAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA;;2FAArB,qBAAqB,EAAA,UAAA,EAAA,CAAA;kBAD1B,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA,EAAC,IAAI,EAAE,EAAC,mBAAmB,EAAE,CAAA,2BAAA,CAA6B,EAAC,EAAC;;;AE/HvE;;;;;;;;AAQG;AAOH;;;;;;;;;;;;;;;;;;;;;;;;;AAyBG;AACG,SAAU,mBAAmB,CAAC,cAA6C,EAAA;AAC/E,IAAA,OAAO,wBAAwB,CAAC,cAAc,GAAG;AAC/C,QAAA;AACE,YAAA,OAAO,EAAE,iBAAiB;AAC1B,YAAA,QAAQ,EAAE,cAAc;AACxB,YAAA,KAAK,EAAE,IAAI;AACZ,SAAA;AACF,KAAA,GAAG,EAAE,CAAC;AACT;;ACjDA;;;;;;;;AAQG;AAEH;;;;AAIG;;ACdH;;AAEG;;"}
|
|
1
|
+
{"version":3,"file":"scion-components-icon.mjs","sources":["../../../../projects/scion/components/icon/src/icon-font.component.ts","../../../../projects/scion/components/icon/src/material-icon-provider.ts","../../../../projects/scion/components/icon/src/scion-icon-provider.ts","../../../../projects/scion/components/icon/src/icon-providers.ts","../../../../projects/scion/components/icon/src/icon.component.ts","../../../../projects/scion/components/icon/src/icon.component.html","../../../../projects/scion/components/icon/src/icon.provider.ts","../../../../projects/scion/components/icon/src/public_api.ts","../../../../projects/scion/components/icon/src/scion-components-icon.ts"],"sourcesContent":["/*\n * Copyright (c) 2018-2026 Swiss Federal Railways\n *\n * This program and the accompanying materials are made\n * available under the terms of the Eclipse Public License 2.0\n * which is available at https://www.eclipse.org/legal/epl-2.0/\n *\n * SPDX-License-Identifier: EPL-2.0\n */\n\nimport {Component, input} from '@angular/core';\n\n/**\n * Renders an icon of an icon font based on its ligature.\n */\n@Component({\n selector: 'sci-icon-font',\n template: '',\n host: {\n '[attr.data-ligature]': 'ligature()',\n '[style.font-family]': 'fontFamily()',\n },\n styles: `\n :host {\n font-style: normal;\n font-weight: normal;\n font-variant: normal;\n display: inline-block;\n text-transform: none;\n line-height: 1;\n white-space: nowrap;\n word-wrap: normal;\n direction: ltr;\n\n /* Enable Ligatures */\n letter-spacing: 0;\n font-feature-settings: 'liga';\n font-variant-ligatures: discretionary-ligatures;\n\n /* Better Font Rendering */\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n\n /* Prevent font metrics from misaligning the icon vertically with adjacent text. */\n text-box-trim: trim-start;\n text-box-edge: text alphabetic;\n\n /* Render ligature in ::before pseudo-element so it is excluded from the DOM tree (e.g., will not be returned by Element.textContent). */\n &::before {\n content: attr(data-ligature);\n }\n }\n `,\n})\nexport class SciIconFontComponent {\n /**\n * Specifies the name of the icon font.\n */\n public readonly fontFamily = input.required<string>();\n\n /**\n * Specifies the ligature of the icon.\n */\n public readonly ligature = input.required<string>();\n}\n","/*\n * Copyright (c) 2018-2026 Swiss Federal Railways\n *\n * This program and the accompanying materials are made\n * available under the terms of the Eclipse Public License 2.0\n * which is available at https://www.eclipse.org/legal/epl-2.0/\n *\n * SPDX-License-Identifier: EPL-2.0\n */\n\nimport {inputBinding} from '@angular/core';\nimport {SciIconProviderFn} from './icon.provider';\nimport {SciComponentDescriptor} from '@scion/components/common';\nimport {SciIconFontComponent} from './icon-font.component';\n\n/**\n * Provides Material icons for non-scion icons.\n *\n * This provider requires a Material icon font to be included in the HTML.\n *\n * Supported fonts:\n * - https://fonts.googleapis.com/css2?family=Material+Symbols+Rounded\n * - https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined\n * - https://fonts.googleapis.com/css2?family=Material+Symbols+Sharp\n * - https://fonts.googleapis.com/css?family=Material+Icons|Material+Icons+Outlined|Material+Icons+Round|Material+Icons+Sharp\n */\nexport const materialIconProvider: SciIconProviderFn = (ligature: string): SciComponentDescriptor | undefined => {\n if (ligature.startsWith('scion:')) {\n return undefined; // delegate to next provider\n }\n\n return {\n component: SciIconFontComponent,\n bindings: [\n inputBinding('fontFamily', () => `'Material Symbols Rounded', 'Material Symbols Outlined', 'Material Symbols Sharp', 'Material Icons', 'Material Icons Outlined', 'Material Icons Round', 'Material Icons Sharp'`),\n inputBinding('ligature', () => ligature),\n ],\n };\n};\n","/*\n * Copyright (c) 2018-2026 Swiss Federal Railways\n *\n * This program and the accompanying materials are made\n * available under the terms of the Eclipse Public License 2.0\n * which is available at https://www.eclipse.org/legal/epl-2.0/\n *\n * SPDX-License-Identifier: EPL-2.0\n */\n\nimport {inputBinding} from '@angular/core';\nimport {SciIconProviderFn} from './icon.provider';\nimport {SciComponentDescriptor} from '@scion/components/common';\nimport {SciIconFontComponent} from './icon-font.component';\n\n/**\n * Provides icons used in SCION libraries.\n *\n * Register this provider as the last icon provider, enabling replacement of built-in SCION icons.\n *\n * This provider requires the SCION icon font 'scion-icons' to be included in the HTML:\n *\n * scss\n * ```\n * @import url('https://cdn.jsdelivr.net/npm/@scion/icons/scion-icon-font.css');\n * ```\n */\nexport const scionIconProvider: SciIconProviderFn = (icon: string): SciComponentDescriptor | undefined => {\n const ligature = icon.startsWith('scion:') ? icon.substring('scion:'.length) : undefined;\n if (ligature) {\n return {\n component: SciIconFontComponent,\n bindings: [\n inputBinding('fontFamily', () => 'scion-icons'),\n inputBinding('ligature', () => ligature),\n ],\n };\n }\n return undefined;\n};\n","/*\n * Copyright (c) 2018-2026 Swiss Federal Railways\n *\n * This program and the accompanying materials are made\n * available under the terms of the Eclipse Public License 2.0\n * which is available at https://www.eclipse.org/legal/epl-2.0/\n *\n * SPDX-License-Identifier: EPL-2.0\n */\n\nimport {assertNotInReactiveContext, inject, Injectable, InjectionToken, Injector, runInInjectionContext} from '@angular/core';\nimport {materialIconProvider} from './material-icon-provider';\nimport {scionIconProvider} from './scion-icon-provider';\nimport {SciIconProviderFn} from './icon.provider';\nimport {SciComponentDescriptor} from '@scion/components/common';\n\n/**\n * Provides icons based on registered icon providers.\n */\n@Injectable({providedIn: 'root'})\nexport class IconProviders {\n\n private readonly _iconProviders: SciIconProviderFn[] = [\n // Provide app-specific icons.\n ...inject(SCI_ICON_PROVIDER, {optional: true}) ?? [],\n // Provide SCION icons.\n scionIconProvider,\n // Provide material icons.\n materialIconProvider,\n ];\n private readonly _injector = inject(Injector);\n\n /**\n * Provides the icon descriptor for the given icon based on icon providers registered under the {@link SCI_ICON_PROVIDER} DI token.\n *\n * Icon providers are called in registration order. Returning `undefined` delegates to the next provider.\n */\n public provide(icon: string | undefined): SciComponentDescriptor | undefined {\n assertNotInReactiveContext(this.provide, 'Call IconProviders.provide() in a non-reactive (non-tracking) context.');\n\n if (!icon) {\n return undefined;\n }\n\n if (!this._iconProviders.length) {\n return undefined;\n }\n\n for (const iconProvider of this._iconProviders) {\n const componentOrDescriptor = runInInjectionContext(this._injector, () => iconProvider(icon));\n if (componentOrDescriptor) {\n return typeof componentOrDescriptor === 'function' ? {component: componentOrDescriptor} : componentOrDescriptor;\n }\n }\n return undefined;\n }\n}\n\n/**\n * Multi-DI token for injecting icon providers.\n *\n * @see provideIconProvider\n * @see SciIconProviderFn\n */\nexport const SCI_ICON_PROVIDER = new InjectionToken<SciIconProviderFn[]>('SCI_ICON_PROVIDER');\n","/*\n * Copyright (c) 2018-2026 Swiss Federal Railways\n *\n * This program and the accompanying materials are made\n * available under the terms of the Eclipse Public License 2.0\n * which is available at https://www.eclipse.org/legal/epl-2.0/\n *\n * SPDX-License-Identifier: EPL-2.0\n */\n\nimport {Component, computed, Directive, inject, ResourceRef, Signal, TemplateRef, untracked, viewChild} from '@angular/core';\nimport {coerceSignal, SciComponentDescriptor, SciComponentOutletDirective} from '@scion/components/common';\nimport {IconProviders} from './icon-providers';\nimport {fromMutation$} from '@scion/toolkit/observable';\nimport {concatWith, map, Observable, of} from 'rxjs';\nimport {rxResource} from '@angular/core/rxjs-interop';\n\n/**\n * Renders an icon based on registered icon providers.\n *\n * Set the icon name as the slotted content of the `<sci-icon>` component.\n *\n * Example:\n * ```html\n * <sci-icon>home</sci-icon>\n * ```\n *\n * Icons can be contributed via icon providers. Register an icon provider using the {@link provideIconProvider} function.\n *\n * ```ts\n * import {provideIconProvider} from '@scion/components/icon';\n * import {ComponentType} from '@angular/cdk/portal';\n * import {SciComponentDescriptor} from '@scion/components/common';\n *\n * provideIconProvider((icon: string): ComponentType<unknown> | SciComponentDescriptor | undefined => {\n * return ...;\n * });\n * ```\n *\n * Providers are called in registration order. If a provider does not provide the icon, the next provider is called, and so on.\n * If no provider provides the icon, defaults to a Material icon provider, interpreting the icon as a Material icon font ligature.\n * Refer to https://fonts.google.com/icons for available Material icons and instructions on including the Material icon font.\n *\n * 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.\n *\n * ```scss\n * sci-icon {\n * --sci-icon-size: 16px;\n * }\n * ```\n *\n * @see provideIconProvider\n *\n * TODO [Angular 23] Consider changing encapsulation to `IsolatedShadowDom` when stable. See branch: issue/icon-shadow-dom.\n */\n@Component({\n selector: 'sci-icon',\n templateUrl: './icon.component.html',\n styleUrl: './icon.component.scss',\n imports: [\n SciComponentOutletDirective,\n ],\n host: {\n '[attr.icon]': 'slottedContent.value()', // Public API: Enables selecting the icon by name in CSS\n },\n})\nexport class SciIconComponent {\n\n protected readonly slottedContent = this.computeSlottedContent();\n protected readonly iconDescriptor = this.computeIconDescriptor();\n\n private readonly _slotTemplate = viewChild.required<TemplateRef<void>>('slot_template');\n\n private computeIconDescriptor(): Signal<SciComponentDescriptor | undefined> {\n const iconProviders = inject(IconProviders);\n\n return computed(() => {\n const slottedContent = this.slottedContent.value();\n\n return untracked(() => {\n const iconDescriptor = iconProviders.provide(slottedContent);\n\n // Augment icon descriptor.\n return iconDescriptor && {\n ...iconDescriptor,\n attributes: computed(() => ({\n ...coerceSignal(iconDescriptor.attributes)?.(),\n // Prevent user agent translating the icon.\n translate: 'no',\n })),\n directives: [\n ...iconDescriptor.directives ?? [],\n // Set icon font size to 'var(--sci-icon-size, 1em)', required to inherit the location's font size for icons with a fixed font size.\n // For example, Material sets a fixed font size of 24px.\n IconFontSizeDirective,\n ],\n } satisfies SciComponentDescriptor;\n });\n });\n }\n\n /**\n * Reads the icon from slotted content.\n */\n private computeSlottedContent(): ResourceRef<string | undefined> {\n return rxResource({\n params: () => this._slotTemplate(),\n stream: ({params: slotTemplate}) => new Observable<string | undefined>(observer => {\n // Instantiate template to read slotted content.\n const view = slotTemplate.createEmbeddedView(undefined);\n\n // Return if empty, i.e., no icon to render.\n if (!view.rootNodes.length) {\n observer.next(undefined);\n return;\n }\n\n // Ensure only text is provided as slotted content.\n if (view.rootNodes.length > 1 || (view.rootNodes[0] as Element).nodeType !== Node.TEXT_NODE) {\n observer.error(Error('[InvalidInputError] Only text (ligature) is allowed in slotted content of <sci-icon>.'));\n return;\n }\n\n // Observe slotted content.\n const textNode = view.rootNodes[0] as Text;\n const subscription = of(textNode.textContent)\n .pipe(\n concatWith(fromMutation$(textNode, {characterData: true}).pipe(map(() => textNode.textContent))),\n map(slottedContent => slottedContent.trim() || undefined),\n )\n .subscribe(observer);\n\n return () => {\n subscription.unsubscribe();\n view.destroy();\n };\n }),\n });\n }\n}\n\n/**\n * Sets the font size to 'var(--sci-icon-size, 1em)', required to inherit the location's font size for icons with a fixed font size.\n * For example, Material sets a fixed font size of 24px.\n */\n@Directive({host: {'[style.font-size]': `'var(--sci-icon-size, 1em)'`}})\nclass IconFontSizeDirective {\n}\n","<ng-container *sciComponentOutlet=\"iconDescriptor()\"/>\n\n<!--Template to capture slotted content. -->\n<ng-template #slot_template>\n <ng-content/>\n</ng-template>\n","/*\n * Copyright (c) 2018-2026 Swiss Federal Railways\n *\n * This program and the accompanying materials are made\n * available under the terms of the Eclipse Public License 2.0\n * which is available at https://www.eclipse.org/legal/epl-2.0/\n *\n * SPDX-License-Identifier: EPL-2.0\n */\n\nimport {EnvironmentProviders, makeEnvironmentProviders} from '@angular/core';\nimport {SCI_ICON_PROVIDER} from './icon-providers';\nimport {ComponentType} from '@angular/cdk/portal';\nimport {SciComponentDescriptor} from '@scion/components/common';\n\n/**\n * Enables contribution or replacement of icons used in SCION.\n *\n * An icon provider is a function that returns a component for an icon. The component renders the icon.\n *\n * Multiple icon providers can be registered. Providers are called in registration order. Returning `undefined` delegates to the next provider.\n *\n * Defaults to a Material icon provider, interpreting the icon as a Material icon ligature.\n *\n * Refer to https://fonts.google.com/icons for available Material icons and https://developers.google.com/fonts/docs/material_symbols#use_in_web\n * for instructions on including the Material icon font.\n *\n * @example - Importing the Material icon font in `src/styles.scss`\n * ```scss\n * @import url('https://fonts.googleapis.com/css2?family=Material+Symbols+Rounded:opsz,wght,FILL@20..24,400,0&display=block');\n * ```\n *\n * 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.\n * Refer to https://icons.scion.vercel.app for available SCION icons.\n *\n * The function can call `inject` to get required dependencies.\n *\n * @see SciIconProviderFn\n * @see SciIconComponent\n */\nexport function provideIconProvider(iconProviderFn: SciIconProviderFn | undefined): EnvironmentProviders {\n return makeEnvironmentProviders(iconProviderFn ? [\n {\n provide: SCI_ICON_PROVIDER,\n useValue: iconProviderFn,\n multi: true,\n },\n ] : []);\n}\n\n/**\n * Signature of a function to provide icons.\n *\n * An icon provider is a function that returns the component for an icon. The component renders the icon.\n *\n * Alternatively, the icon provider can return a descriptor, allowing for additional configuration such as inputs.\n * Inputs are available as input properties in the component. The component can use the inputs to render the icon.\n *\n * Icon keys used by SCION start with the `scion:` prefix. To not replace SCION icons, the icon provider can\n * return `undefined` for icons starting with the `scion:` prefix.\n *\n * An icon provider can be registered via {@link provideIconProvider} function.\n *\n * The function can call `inject` to get required dependencies.\n *\n * @param icon - The key of the icon for which to provide the icon component.\n * @returns ComponentType or {@link SciComponentDescriptor} to render the icon, or `undefined` if not provided by the icon provider.\n */\nexport type SciIconProviderFn = (icon: string) => ComponentType<unknown> | SciComponentDescriptor | undefined;\n","/*\n * Copyright (c) 2018-2026 Swiss Federal Railways\n *\n * This program and the accompanying materials are made\n * available under the terms of the Eclipse Public License 2.0\n * which is available at https://www.eclipse.org/legal/epl-2.0/\n *\n * SPDX-License-Identifier: EPL-2.0\n */\n\n/*\n * Secondary entrypoint: '@scion/components/icon'\n *\n * @see https://github.com/ng-packagr/ng-packagr/blob/master/docs/secondary-entrypoints.md\n */\nexport {SciIconComponent} from './icon.component';\nexport {provideIconProvider, type SciIconProviderFn} from './icon.provider';\nexport {SciIconFontComponent} from './icon-font.component';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;;;;;AAAA;;;;;;;;AAQG;AAIH;;AAEG;MAwCU,oBAAoB,CAAA;AAC/B;;AAEG;IACa,UAAU,GAAG,KAAK,CAAC,QAAQ;mFAAU;AAErD;;AAEG;IACa,QAAQ,GAAG,KAAK,CAAC,QAAQ;iFAAU;uGATxC,oBAAoB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;AAApB,IAAA,OAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA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