@scion/components 20.0.0 → 21.1.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/dimension/package.json +2 -1
- package/fesm2022/scion-components-dimension.mjs +15 -12
- package/fesm2022/scion-components-dimension.mjs.map +1 -1
- package/fesm2022/scion-components-sashbox.mjs +41 -47
- package/fesm2022/scion-components-sashbox.mjs.map +1 -1
- package/fesm2022/scion-components-splitter.mjs +35 -49
- package/fesm2022/scion-components-splitter.mjs.map +1 -1
- package/fesm2022/scion-components-throbber.mjs +17 -17
- package/fesm2022/scion-components-throbber.mjs.map +1 -1
- package/fesm2022/scion-components-viewport.mjs +49 -62
- package/fesm2022/scion-components-viewport.mjs.map +1 -1
- package/package.json +13 -13
- package/sashbox/package.json +2 -1
- package/splitter/package.json +2 -1
- package/throbber/package.json +2 -1
- package/{sashbox/index.d.ts → types/scion-components-sashbox.d.ts} +3 -3
- package/{splitter/index.d.ts → types/scion-components-splitter.d.ts} +7 -8
- package/{viewport/index.d.ts → types/scion-components-viewport.d.ts} +18 -19
- package/viewport/package.json +2 -1
- /package/{dimension/index.d.ts → types/scion-components-dimension.d.ts} +0 -0
- /package/{throbber/index.d.ts → types/scion-components-throbber.d.ts} +0 -0
- /package/{index.d.ts → types/scion-components.d.ts} +0 -0
package/dimension/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { input, output, inject, ElementRef, NgZone, Directive, assertNotInReactiveContext, assertInInjectionContext, Injector, computed, isSignal, signal, effect, untracked } from '@angular/core';
|
|
2
|
+
import { input, output, inject, ElementRef, NgZone, ɵZONELESS_ENABLED as _ZONELESS_ENABLED, Directive, assertNotInReactiveContext, assertInInjectionContext, Injector, computed, isSignal, signal, effect, untracked } from '@angular/core';
|
|
3
3
|
import { fromResize$, fromBoundingClientRect$ } from '@scion/toolkit/observable';
|
|
4
4
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
5
5
|
import { subscribeIn, observeIn } from '@scion/toolkit/operators';
|
|
@@ -29,7 +29,7 @@ class SciDimensionDirective {
|
|
|
29
29
|
/**
|
|
30
30
|
* Controls if to output outside the Angular zone. Defaults to `false`.
|
|
31
31
|
*/
|
|
32
|
-
emitOutsideAngular = input(false);
|
|
32
|
+
emitOutsideAngular = input(false, ...(ngDevMode ? [{ debugName: "emitOutsideAngular" }] : []));
|
|
33
33
|
/**
|
|
34
34
|
* Outputs the size of the element.
|
|
35
35
|
*/
|
|
@@ -37,6 +37,7 @@ class SciDimensionDirective {
|
|
|
37
37
|
constructor() {
|
|
38
38
|
const host = inject(ElementRef).nativeElement;
|
|
39
39
|
const zone = inject(NgZone);
|
|
40
|
+
const zonelessEnabled = inject(_ZONELESS_ENABLED);
|
|
40
41
|
fromResize$(host)
|
|
41
42
|
.pipe(
|
|
42
43
|
// Avoid triggering change detection cycle.
|
|
@@ -46,8 +47,10 @@ class SciDimensionDirective {
|
|
|
46
47
|
// The scheduler always executes tasks in the context (e.g. zone) where the scheduler was first used in the application.
|
|
47
48
|
observeIn(fn => requestAnimationFrame(fn)), observeIn(fn => this.emitOutsideAngular() ? fn() : zone.run(fn)), takeUntilDestroyed())
|
|
48
49
|
.subscribe(() => {
|
|
49
|
-
|
|
50
|
-
|
|
50
|
+
if (!zonelessEnabled) {
|
|
51
|
+
// Assert Angular zone.
|
|
52
|
+
this.emitOutsideAngular() ? NgZone.assertNotInAngularZone() : NgZone.assertInAngularZone();
|
|
53
|
+
}
|
|
51
54
|
this.dimensionChange.emit({
|
|
52
55
|
clientWidth: host.clientWidth,
|
|
53
56
|
offsetWidth: host.offsetWidth,
|
|
@@ -57,15 +60,15 @@ class SciDimensionDirective {
|
|
|
57
60
|
});
|
|
58
61
|
});
|
|
59
62
|
}
|
|
60
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
61
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "
|
|
63
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: SciDimensionDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
64
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.0.0", type: SciDimensionDirective, isStandalone: true, selector: "[sciDimension]", inputs: { emitOutsideAngular: { classPropertyName: "emitOutsideAngular", publicName: "emitOutsideAngular", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { dimensionChange: "sciDimensionChange" }, ngImport: i0 });
|
|
62
65
|
}
|
|
63
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
66
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: SciDimensionDirective, decorators: [{
|
|
64
67
|
type: Directive,
|
|
65
68
|
args: [{
|
|
66
69
|
selector: '[sciDimension]',
|
|
67
70
|
}]
|
|
68
|
-
}], ctorParameters: () => [] });
|
|
71
|
+
}], ctorParameters: () => [], propDecorators: { emitOutsideAngular: [{ type: i0.Input, args: [{ isSignal: true, alias: "emitOutsideAngular", required: false }] }], dimensionChange: [{ type: i0.Output, args: ["sciDimensionChange"] }] } });
|
|
69
72
|
|
|
70
73
|
/*
|
|
71
74
|
* Copyright (c) 2018-2024 Swiss Federal Railways
|
|
@@ -83,8 +86,8 @@ function dimension(elementLike, options) {
|
|
|
83
86
|
}
|
|
84
87
|
const injector = options?.injector ?? inject(Injector);
|
|
85
88
|
const zone = injector.get(NgZone);
|
|
86
|
-
const element = computed(() => coerceElement(isSignal(elementLike) ? elementLike() : elementLike));
|
|
87
|
-
const onResize = signal(undefined, { equal: () => false });
|
|
89
|
+
const element = computed(() => coerceElement(isSignal(elementLike) ? elementLike() : elementLike), ...(ngDevMode ? [{ debugName: "element" }] : []));
|
|
90
|
+
const onResize = signal(undefined, ...(ngDevMode ? [{ debugName: "onResize", equal: () => false }] : [{ equal: () => false }]));
|
|
88
91
|
// Subscribe to element size changes.
|
|
89
92
|
effect(onCleanup => {
|
|
90
93
|
const el = element();
|
|
@@ -141,8 +144,8 @@ function boundingClientRect(elementLike, options) {
|
|
|
141
144
|
}
|
|
142
145
|
const injector = options?.injector ?? inject(Injector);
|
|
143
146
|
const zone = injector.get(NgZone);
|
|
144
|
-
const element = computed(() => coerceElement(isSignal(elementLike) ? elementLike() : elementLike));
|
|
145
|
-
const onBoundingBoxChange = signal(undefined, { equal: () => false });
|
|
147
|
+
const element = computed(() => coerceElement(isSignal(elementLike) ? elementLike() : elementLike), ...(ngDevMode ? [{ debugName: "element" }] : []));
|
|
148
|
+
const onBoundingBoxChange = signal(undefined, ...(ngDevMode ? [{ debugName: "onBoundingBoxChange", equal: () => false }] : [{ equal: () => false }]));
|
|
146
149
|
// Subscribe to element bounding box changes.
|
|
147
150
|
effect(onCleanup => {
|
|
148
151
|
const el = element();
|
|
@@ -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} 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\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 // Assert Angular zone.\n this.emitOutsideAngular() ? NgZone.assertNotInAngularZone() : NgZone.assertInAngularZone();\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 {assertInInjectionContext, 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';\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);\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 {assertInInjectionContext, 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';\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);\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"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":["../../../../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 {assertInInjectionContext, 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';\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);\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 {assertInInjectionContext, 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';\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);\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;AACa,IAAA,kBAAkB,GAAG,KAAK,CAAC,KAAK,8DAAC;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,QAAA,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC;AAC3B,QAAA,MAAM,eAAe,GAAG,MAAM,CAACA,iBAAiB,CAAC;QAEjD,WAAW,CAAC,IAAI;aACb,IAAI;;QAEH,WAAW,CAAC,EAAE,IAAI,IAAI,CAAC,iBAAiB,CAAC,EAAE,CAAC,CAAC;;;;AAI7C,QAAA,SAAS,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* as i0 from '@angular/core';
|
|
2
|
-
import { input, booleanAttribute, inject, signal, TemplateRef, computed, linkedSignal, Directive, ElementRef, ChangeDetectorRef, effect, Component, output, contentChildren, NgZone, afterNextRender, IterableDiffers, untracked
|
|
2
|
+
import { input, booleanAttribute, inject, signal, TemplateRef, computed, linkedSignal, Directive, ElementRef, ChangeDetectorRef, effect, Component, output, contentChildren, NgZone, afterNextRender, IterableDiffers, untracked } from '@angular/core';
|
|
3
3
|
import { SciSplitterComponent } from '@scion/components/splitter';
|
|
4
4
|
import { NgTemplateOutlet } from '@angular/common';
|
|
5
5
|
import { trigger, transition, style, animate } from '@angular/animations';
|
|
@@ -55,20 +55,20 @@ class SciSashDirective {
|
|
|
55
55
|
*
|
|
56
56
|
* If not set, remaining space is distributed equally.
|
|
57
57
|
*/
|
|
58
|
-
size = input('1', { transform: (size) => size ?? '1' });
|
|
58
|
+
size = input('1', ...(ngDevMode ? [{ debugName: "size", transform: (size) => size ?? '1' }] : [{ transform: (size) => size ?? '1' }]));
|
|
59
59
|
/**
|
|
60
60
|
* Specifies the minimal sash size in pixel or percent.
|
|
61
61
|
* The min-size prevents the user from shrinking the sash below this minimal size.
|
|
62
62
|
*
|
|
63
63
|
* If the unit is omitted, the value is interpreted as a pixel value.
|
|
64
64
|
*/
|
|
65
|
-
minSize = input();
|
|
65
|
+
minSize = input(...(ngDevMode ? [undefined, { debugName: "minSize" }] : []));
|
|
66
66
|
/**
|
|
67
67
|
* Specifies an optional key to identify this sash.
|
|
68
68
|
*
|
|
69
69
|
* The key is used as the property key in the object emitted by {@link SciSashboxComponent.sashEnd} to associate the size of this sash.
|
|
70
70
|
*/
|
|
71
|
-
key = input();
|
|
71
|
+
key = input(...(ngDevMode ? [undefined, { debugName: "key" }] : []));
|
|
72
72
|
/**
|
|
73
73
|
* Controls whether to animate the entering and leaving of this sash, only if fixed-sized. Defaults to `false`.
|
|
74
74
|
*
|
|
@@ -76,9 +76,9 @@ class SciSashDirective {
|
|
|
76
76
|
*
|
|
77
77
|
* Note: Animates only sashes added or removed after the initial rendering.
|
|
78
78
|
*/
|
|
79
|
-
animate = input(false, { transform: booleanAttribute });
|
|
79
|
+
animate = input(false, ...(ngDevMode ? [{ debugName: "animate", transform: booleanAttribute }] : [{ transform: booleanAttribute }]));
|
|
80
80
|
_sashBoxAccessor = inject(SciSashBoxAccessor);
|
|
81
|
-
_component = signal(undefined);
|
|
81
|
+
_component = signal(undefined, ...(ngDevMode ? [{ debugName: "_component" }] : []));
|
|
82
82
|
/**
|
|
83
83
|
* Flex properties computed based on the configured {@link size}. Properties are updated when moving this sash.
|
|
84
84
|
*/
|
|
@@ -102,13 +102,13 @@ class SciSashDirective {
|
|
|
102
102
|
*
|
|
103
103
|
* @internal
|
|
104
104
|
*/
|
|
105
|
-
isFixedSize = computed(() => Number.isNaN(+this.size()));
|
|
105
|
+
isFixedSize = computed(() => Number.isNaN(+this.size()), ...(ngDevMode ? [{ debugName: "isFixedSize" }] : []));
|
|
106
106
|
/**
|
|
107
107
|
* Gets the component that renders this sash.
|
|
108
108
|
*
|
|
109
109
|
* @internal
|
|
110
110
|
*/
|
|
111
|
-
component = computed(() => this._component() ?? throwError('[SciSashbox] SashComponent not available yet.'));
|
|
111
|
+
component = computed(() => this._component() ?? throwError('[SciSashbox] SashComponent not available yet.'), ...(ngDevMode ? [{ debugName: "component" }] : []));
|
|
112
112
|
/**
|
|
113
113
|
* Sets the component that renders this sash.
|
|
114
114
|
*
|
|
@@ -179,16 +179,16 @@ class SciSashDirective {
|
|
|
179
179
|
};
|
|
180
180
|
});
|
|
181
181
|
}
|
|
182
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
183
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "
|
|
182
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: SciSashDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
183
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.0.0", type: SciSashDirective, isStandalone: true, selector: "ng-template[sciSash]", inputs: { size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, minSize: { classPropertyName: "minSize", publicName: "minSize", isSignal: true, isRequired: false, transformFunction: null }, key: { classPropertyName: "key", publicName: "key", isSignal: true, isRequired: false, transformFunction: null }, animate: { classPropertyName: "animate", publicName: "animate", isSignal: true, isRequired: false, transformFunction: null } }, exportAs: ["sciSash"], ngImport: i0 });
|
|
184
184
|
}
|
|
185
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
185
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: SciSashDirective, decorators: [{
|
|
186
186
|
type: Directive,
|
|
187
187
|
args: [{
|
|
188
188
|
selector: 'ng-template[sciSash]',
|
|
189
189
|
exportAs: 'sciSash',
|
|
190
190
|
}]
|
|
191
|
-
}] });
|
|
191
|
+
}], propDecorators: { size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], minSize: [{ type: i0.Input, args: [{ isSignal: true, alias: "minSize", required: false }] }], key: [{ type: i0.Input, args: [{ isSignal: true, alias: "key", required: false }] }], animate: [{ type: i0.Input, args: [{ isSignal: true, alias: "animate", required: false }] }] } });
|
|
192
192
|
function throwError(error) {
|
|
193
193
|
throw Error(error);
|
|
194
194
|
}
|
|
@@ -207,10 +207,10 @@ function throwError(error) {
|
|
|
207
207
|
*/
|
|
208
208
|
class SciElementRefDirective {
|
|
209
209
|
host = inject(ElementRef).nativeElement;
|
|
210
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
211
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "
|
|
210
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: SciElementRefDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
211
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.0.0", type: SciElementRefDirective, isStandalone: true, selector: "[sciElementRef]", exportAs: ["sciElementRef"], ngImport: i0 });
|
|
212
212
|
}
|
|
213
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
213
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: SciElementRefDirective, decorators: [{
|
|
214
214
|
type: Directive,
|
|
215
215
|
args: [{
|
|
216
216
|
selector: '[sciElementRef]',
|
|
@@ -234,11 +234,11 @@ class SashComponent {
|
|
|
234
234
|
/**
|
|
235
235
|
* Specifies the sash representing this component.
|
|
236
236
|
*/
|
|
237
|
-
sash = input.required();
|
|
237
|
+
sash = input.required(...(ngDevMode ? [{ debugName: "sash" }] : []));
|
|
238
238
|
_host = inject(ElementRef).nativeElement;
|
|
239
239
|
_cd = inject(ChangeDetectorRef);
|
|
240
240
|
_sashBoxAccessor = inject(SciSashBoxAccessor);
|
|
241
|
-
animationState = linkedSignal(() => this.sash().animate() && this._sashBoxAccessor.afterFirstRender() ? 'enter' : null);
|
|
241
|
+
animationState = linkedSignal(() => this.sash().animate() && this._sashBoxAccessor.afterFirstRender() ? 'enter' : null, ...(ngDevMode ? [{ debugName: "animationState" }] : []));
|
|
242
242
|
constructor() {
|
|
243
243
|
// Associate sash with this component.
|
|
244
244
|
effect(() => this.sash().setComponent(this));
|
|
@@ -267,12 +267,12 @@ class SashComponent {
|
|
|
267
267
|
const { width, height } = this._host.getBoundingClientRect();
|
|
268
268
|
return this._sashBoxAccessor.direction() === 'row' ? width : height;
|
|
269
269
|
}
|
|
270
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
271
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "
|
|
270
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: SashComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
271
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.0.0", type: SashComponent, isStandalone: true, selector: "sci-sash", inputs: { sash: { classPropertyName: "sash", publicName: "sash", isSignal: true, isRequired: true, transformFunction: null } }, host: { listeners: { "@sash-animation.done": "onAnimationEnd();" }, properties: { "@sash-animation": "animationState()" } }, ngImport: i0, template: "<ng-container *ngTemplateOutlet=\"sash().sashTemplate\"/>\n", styles: [":host{display:grid;grid-auto-rows:100%;grid-auto-columns:100%;overflow:hidden}\n"], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], animations: [
|
|
272
272
|
trigger('sash-animation', provideAnimation()),
|
|
273
273
|
] });
|
|
274
274
|
}
|
|
275
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
275
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: SashComponent, decorators: [{
|
|
276
276
|
type: Component,
|
|
277
277
|
args: [{ selector: 'sci-sash', imports: [
|
|
278
278
|
NgTemplateOutlet,
|
|
@@ -282,7 +282,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.1", ngImpor
|
|
|
282
282
|
'[@sash-animation]': 'animationState()',
|
|
283
283
|
'(@sash-animation.done)': 'onAnimationEnd();',
|
|
284
284
|
}, template: "<ng-container *ngTemplateOutlet=\"sash().sashTemplate\"/>\n", styles: [":host{display:grid;grid-auto-rows:100%;grid-auto-columns:100%;overflow:hidden}\n"] }]
|
|
285
|
-
}], ctorParameters: () => [] });
|
|
285
|
+
}], ctorParameters: () => [], propDecorators: { sash: [{ type: i0.Input, args: [{ isSignal: true, alias: "sash", required: true }] }] } });
|
|
286
286
|
/**
|
|
287
287
|
* Returns animation metadata to slide-in and slide-out a sash.
|
|
288
288
|
*/
|
|
@@ -366,7 +366,7 @@ class SciSashboxComponent {
|
|
|
366
366
|
/**
|
|
367
367
|
* Specifies if to lay out sashes in a row (which is by default) or column arrangement.
|
|
368
368
|
*/
|
|
369
|
-
direction = input('row');
|
|
369
|
+
direction = input('row', ...(ngDevMode ? [{ debugName: "direction" }] : []));
|
|
370
370
|
/**
|
|
371
371
|
* Notifies when start sashing.
|
|
372
372
|
*/
|
|
@@ -378,23 +378,23 @@ class SciSashboxComponent {
|
|
|
378
378
|
*/
|
|
379
379
|
sashEnd = output();
|
|
380
380
|
_host = inject(ElementRef).nativeElement;
|
|
381
|
-
_contentChildren = contentChildren(SciSashDirective);
|
|
381
|
+
_contentChildren = contentChildren(SciSashDirective, ...(ngDevMode ? [{ debugName: "_contentChildren" }] : []));
|
|
382
382
|
/** @internal */
|
|
383
383
|
sashes = this.computeSashes(this._contentChildren);
|
|
384
384
|
/** @internal */
|
|
385
|
-
afterFirstRender = signal(false);
|
|
386
|
-
sashing = false;
|
|
387
|
-
maxHeight;
|
|
388
|
-
maxWidth;
|
|
385
|
+
afterFirstRender = signal(false, ...(ngDevMode ? [{ debugName: "afterFirstRender" }] : []));
|
|
386
|
+
sashing = signal(false, ...(ngDevMode ? [{ debugName: "sashing" }] : []));
|
|
387
|
+
maxHeight = signal(undefined, ...(ngDevMode ? [{ debugName: "maxHeight" }] : []));
|
|
388
|
+
maxWidth = signal(undefined, ...(ngDevMode ? [{ debugName: "maxWidth" }] : []));
|
|
389
389
|
constructor() {
|
|
390
390
|
this.detectFirstRendering();
|
|
391
391
|
}
|
|
392
392
|
onSashStart() {
|
|
393
|
-
this.sashing
|
|
393
|
+
this.sashing.set(true);
|
|
394
394
|
// Avoid overflow when sashing.
|
|
395
395
|
const hostBounds = this._host.getBoundingClientRect();
|
|
396
|
-
this.maxHeight
|
|
397
|
-
this.maxWidth
|
|
396
|
+
this.maxHeight.set(hostBounds.height);
|
|
397
|
+
this.maxWidth.set(hostBounds.width);
|
|
398
398
|
this.sashStart.emit();
|
|
399
399
|
// Set the effective sash size as the flex-basis for non-fixed sashes (as sashing operates on pixel deltas).
|
|
400
400
|
this.sashes().forEach(sash => {
|
|
@@ -408,9 +408,9 @@ class SciSashboxComponent {
|
|
|
408
408
|
});
|
|
409
409
|
}
|
|
410
410
|
onSashEnd() {
|
|
411
|
-
this.sashing
|
|
412
|
-
this.maxHeight
|
|
413
|
-
this.maxWidth
|
|
411
|
+
this.sashing.set(false);
|
|
412
|
+
this.maxHeight.set(undefined);
|
|
413
|
+
this.maxWidth.set(undefined);
|
|
414
414
|
// Unset the flex-basis for non-fixed sashes and set the flex-grow accordingly.
|
|
415
415
|
const pixelToFlexGrowFactor = computePixelToFlexGrowFactor(this.sashes());
|
|
416
416
|
const sashSizes = this.sashes().reduce((acc, sash, i) => acc.set(sash.computeKey(i), sash.component().size), new Map());
|
|
@@ -505,7 +505,7 @@ class SciSashboxComponent {
|
|
|
505
505
|
*/
|
|
506
506
|
computeSashes(contentChildren) {
|
|
507
507
|
const differ = inject(IterableDiffers).find([]).create();
|
|
508
|
-
const sashes = signal([]);
|
|
508
|
+
const sashes = signal([], ...(ngDevMode ? [{ debugName: "sashes" }] : []));
|
|
509
509
|
effect(() => {
|
|
510
510
|
// Compute removed sashes to be removed with an animation.
|
|
511
511
|
const removedAnimatedSashes = new Array();
|
|
@@ -529,13 +529,13 @@ class SciSashboxComponent {
|
|
|
529
529
|
});
|
|
530
530
|
return sashes;
|
|
531
531
|
}
|
|
532
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
533
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "
|
|
532
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: SciSashboxComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
533
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.0", type: SciSashboxComponent, isStandalone: true, selector: "sci-sashbox", inputs: { direction: { classPropertyName: "direction", publicName: "direction", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { sashStart: "sashStart", sashEnd: "sashEnd" }, host: { properties: { "attr.data-direction": "direction()", "class.sashing": "sashing()", "style.--\u0275sci-sashbox-max-height": "maxHeight()", "style.--\u0275sci-sashbox-max-width": "maxWidth()" } }, providers: [{
|
|
534
534
|
provide: SciSashBoxAccessor,
|
|
535
535
|
useFactory: provideSashBoxAccessor,
|
|
536
536
|
}], queries: [{ propertyName: "_contentChildren", predicate: SciSashDirective, isSignal: true }], ngImport: i0, template: "@for (sash of sashes(); track sash; let i = $index; let first = $first; let last = $last) {\n <sci-sash [sash]=\"sash\"\n [class.first]=\"first\"\n [class.last]=\"last\"\n [style.flex-grow]=\"sash.flexProperties().flexGrow\"\n [style.flex-shrink]=\"sash.flexProperties().flexShrink\"\n [style.flex-basis]=\"sash.flexProperties().flexBasis\"/>\n @if (!last) {\n <sci-splitter sciElementRef #sciElementRef=\"sciElementRef\"\n [orientation]=\"direction() === 'row' ? 'vertical' : 'horizontal'\"\n (start)=\"onSashStart()\"\n (move)=\"onSash(sciElementRef.host, i, $event)\"\n (end)=\"onSashEnd()\"\n (reset)=\"onSashReset(i)\"/>\n }\n}\n", styles: ["@charset \"UTF-8\";:host{display:flex;align-items:stretch;box-sizing:border-box;overflow:hidden;z-index:0}:host *{box-sizing:border-box}:host[data-direction=column]{flex-direction:column}:host[data-direction=row]{flex-direction:row}:host[data-direction=row]>sci-sash{margin:0 var(--sci-sashbox-gap)}:host[data-direction=row]>sci-sash.first{margin-left:0}:host[data-direction=row]>sci-sash.last{margin-right:0}:host[data-direction=column]>sci-sash{margin:var(--sci-sashbox-gap) 0}:host[data-direction=column]>sci-sash.first{margin-top:0}:host[data-direction=column]>sci-sash.last{margin-bottom:0}:host.sashing{max-height:calc(var(--\\275sci-sashbox-max-height) * 1px);max-width:calc(var(--\\275sci-sashbox-max-width) * 1px)}:host.sashing>sci-sash{pointer-events:none}:host>sci-splitter{--sci-splitter-background-color: var(--sci-sashbox-splitter-background-color);--sci-splitter-background-color-hover: var(--sci-sashbox-splitter-background-color-hover);--sci-splitter-size: var(--sci-sashbox-splitter-size);--sci-splitter-size-hover: var(--sci-sashbox-splitter-size-hover);--sci-splitter-touch-target-size: var(--sci-sashbox-splitter-touch-target-size);--sci-splitter-cross-axis-size: var(--sci-sashbox-splitter-cross-axis-size);--sci-splitter-border-radius: var(--sci-sashbox-splitter-border-radius);--sci-splitter-opacity-active: var(--sci-sashbox-splitter-opacity-active);--sci-splitter-opacity-hover: var(--sci-sashbox-splitter-opacity-hover);flex:none;z-index:1}\n"], dependencies: [{ kind: "component", type: SciSplitterComponent, selector: "sci-splitter", inputs: ["orientation"], outputs: ["start", "move", "end", "reset"] }, { kind: "directive", type: SciElementRefDirective, selector: "[sciElementRef]", exportAs: ["sciElementRef"] }, { kind: "component", type: SashComponent, selector: "sci-sash", inputs: ["sash"] }] });
|
|
537
537
|
}
|
|
538
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
538
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: SciSashboxComponent, decorators: [{
|
|
539
539
|
type: Component,
|
|
540
540
|
args: [{ selector: 'sci-sashbox', imports: [
|
|
541
541
|
SciSplitterComponent,
|
|
@@ -546,17 +546,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.1", ngImpor
|
|
|
546
546
|
useFactory: provideSashBoxAccessor,
|
|
547
547
|
}], host: {
|
|
548
548
|
'[attr.data-direction]': 'direction()',
|
|
549
|
+
'[class.sashing]': 'sashing()',
|
|
550
|
+
'[style.--ɵsci-sashbox-max-height]': 'maxHeight()',
|
|
551
|
+
'[style.--ɵsci-sashbox-max-width]': 'maxWidth()',
|
|
549
552
|
}, template: "@for (sash of sashes(); track sash; let i = $index; let first = $first; let last = $last) {\n <sci-sash [sash]=\"sash\"\n [class.first]=\"first\"\n [class.last]=\"last\"\n [style.flex-grow]=\"sash.flexProperties().flexGrow\"\n [style.flex-shrink]=\"sash.flexProperties().flexShrink\"\n [style.flex-basis]=\"sash.flexProperties().flexBasis\"/>\n @if (!last) {\n <sci-splitter sciElementRef #sciElementRef=\"sciElementRef\"\n [orientation]=\"direction() === 'row' ? 'vertical' : 'horizontal'\"\n (start)=\"onSashStart()\"\n (move)=\"onSash(sciElementRef.host, i, $event)\"\n (end)=\"onSashEnd()\"\n (reset)=\"onSashReset(i)\"/>\n }\n}\n", styles: ["@charset \"UTF-8\";:host{display:flex;align-items:stretch;box-sizing:border-box;overflow:hidden;z-index:0}:host *{box-sizing:border-box}:host[data-direction=column]{flex-direction:column}:host[data-direction=row]{flex-direction:row}:host[data-direction=row]>sci-sash{margin:0 var(--sci-sashbox-gap)}:host[data-direction=row]>sci-sash.first{margin-left:0}:host[data-direction=row]>sci-sash.last{margin-right:0}:host[data-direction=column]>sci-sash{margin:var(--sci-sashbox-gap) 0}:host[data-direction=column]>sci-sash.first{margin-top:0}:host[data-direction=column]>sci-sash.last{margin-bottom:0}:host.sashing{max-height:calc(var(--\\275sci-sashbox-max-height) * 1px);max-width:calc(var(--\\275sci-sashbox-max-width) * 1px)}:host.sashing>sci-sash{pointer-events:none}:host>sci-splitter{--sci-splitter-background-color: var(--sci-sashbox-splitter-background-color);--sci-splitter-background-color-hover: var(--sci-sashbox-splitter-background-color-hover);--sci-splitter-size: var(--sci-sashbox-splitter-size);--sci-splitter-size-hover: var(--sci-sashbox-splitter-size-hover);--sci-splitter-touch-target-size: var(--sci-sashbox-splitter-touch-target-size);--sci-splitter-cross-axis-size: var(--sci-sashbox-splitter-cross-axis-size);--sci-splitter-border-radius: var(--sci-sashbox-splitter-border-radius);--sci-splitter-opacity-active: var(--sci-sashbox-splitter-opacity-active);--sci-splitter-opacity-hover: var(--sci-sashbox-splitter-opacity-hover);flex:none;z-index:1}\n"] }]
|
|
550
|
-
}], ctorParameters: () => [], propDecorators: {
|
|
551
|
-
type: HostBinding,
|
|
552
|
-
args: ['class.sashing']
|
|
553
|
-
}], maxHeight: [{
|
|
554
|
-
type: HostBinding,
|
|
555
|
-
args: ['style.--ɵsci-sashbox-max-height']
|
|
556
|
-
}], maxWidth: [{
|
|
557
|
-
type: HostBinding,
|
|
558
|
-
args: ['style.--ɵsci-sashbox-max-width']
|
|
559
|
-
}] } });
|
|
553
|
+
}], ctorParameters: () => [], propDecorators: { direction: [{ type: i0.Input, args: [{ isSignal: true, alias: "direction", required: false }] }], sashStart: [{ type: i0.Output, args: ["sashStart"] }], sashEnd: [{ type: i0.Output, args: ["sashEnd"] }], _contentChildren: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => SciSashDirective), { isSignal: true }] }] } });
|
|
560
554
|
function between(value, minmax) {
|
|
561
555
|
return Math.min(minmax.max, Math.max(minmax.min, value));
|
|
562
556
|
}
|