@scion/components 19.0.0 → 19.2.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.
@@ -1,10 +1,18 @@
1
1
  import * as i0 from '@angular/core';
2
- import { Directive, Input, inject, ElementRef, NgZone, EventEmitter, Component, HostBinding, Output, ContentChildren, NgModule } from '@angular/core';
3
- import { switchMap, map, startWith, takeUntil } from 'rxjs/operators';
4
- import { BehaviorSubject, merge, Subject } from 'rxjs';
2
+ import { input, booleanAttribute, inject, signal, TemplateRef, computed, linkedSignal, Directive, ElementRef, ChangeDetectorRef, effect, Component, output, contentChildren, NgZone, afterNextRender, IterableDiffers, untracked, HostBinding, NgModule } from '@angular/core';
5
3
  import { SciSplitterComponent } from '@scion/components/splitter';
6
- import { AsyncPipe, NgTemplateOutlet } from '@angular/common';
4
+ import { NgTemplateOutlet } from '@angular/common';
5
+ import { trigger, transition, style, animate } from '@angular/animations';
7
6
 
7
+ /*
8
+ * Copyright (c) 2018-2025 Swiss Federal Railways
9
+ *
10
+ * This program and the accompanying materials are made
11
+ * available under the terms of the Eclipse Public License 2.0
12
+ * which is available at https://www.eclipse.org/legal/epl-2.0/
13
+ *
14
+ * SPDX-License-Identifier: EPL-2.0
15
+ */
8
16
  /**
9
17
  * Allows accessing the sashbox component from sashes.
10
18
  */
@@ -12,7 +20,7 @@ class SciSashBoxAccessor {
12
20
  }
13
21
 
14
22
  /*
15
- * Copyright (c) 2018-2019 Swiss Federal Railways
23
+ * Copyright (c) 2018-2025 Swiss Federal Railways
16
24
  *
17
25
  * This program and the accompanying materials are made
18
26
  * available under the terms of the Eclipse Public License 2.0
@@ -40,130 +48,139 @@ class SciSashBoxAccessor {
40
48
  * </sci-sashbox>
41
49
  */
42
50
  class SciSashDirective {
43
- sashTemplate;
44
- _sashBoxAccessor;
45
- _size = '1';
46
- _flexGrow$ = new BehaviorSubject(0);
47
51
  /**
48
52
  * Specifies the sash size, either as fixed size with an explicit unit,
49
- * or as a unitless proportion to distibute remaining space. A proportional
53
+ * or as a unitless proportion to distribute remaining space. A proportional
50
54
  * sash has the ability to grow or shrink if necessary, and must be >= 1.
51
55
  *
52
56
  * If not set, remaining space is distributed equally.
53
57
  */
54
- set size(size) {
55
- this._size = size ?? '1';
56
- }
57
- get size() {
58
- return this._size;
59
- }
58
+ size = input('1', { transform: (size) => size ?? '1' });
60
59
  /**
61
60
  * Specifies the minimal sash size in pixel or percent.
62
61
  * The min-size prevents the user from shrinking the sash below this minimal size.
63
62
  *
64
63
  * If the unit is omitted, the value is interpreted as a pixel value.
65
64
  */
66
- minSize;
65
+ minSize = input();
67
66
  /**
68
- * @internal
67
+ * Specifies an optional key to identify this sash.
68
+ *
69
+ * The key is used as the property key in the object emitted by {@link SciSashboxComponent.sashEnd2} to associate the size of this sash.
69
70
  */
70
- element;
71
+ key = input();
71
72
  /**
73
+ * Controls whether to animate the entering and leaving of this sash, only if fixed-sized. Defaults to `false`.
74
+ *
75
+ * Enabling animation will mimic the behavior of a side panel that slides in or out.
76
+ *
77
+ * Note: Animates only sashes added or removed after the initial rendering.
78
+ */
79
+ animate = input(false, { transform: booleanAttribute });
80
+ _sashBoxAccessor = inject(SciSashBoxAccessor);
81
+ _component = signal(undefined);
82
+ /**
83
+ * Flex properties computed based on the configured {@link size}. Properties are updated when moving this sash.
84
+ */
85
+ _flexProperties = this.computeFlexProperties();
86
+ /**
87
+ * Represents the template used as sash content.
88
+ *
72
89
  * @internal
73
90
  */
74
- set flexGrow(flexGrow) {
75
- this._flexGrow$.next(flexGrow);
76
- }
91
+ sashTemplate = inject(TemplateRef);
77
92
  /**
93
+ * Flex properties with normalized 'flex-grow' to ensure the sashes fill the entire sash-box space.
94
+ *
95
+ * Use these properties to lay out this sash in the sashbox's flex layout.
96
+ *
78
97
  * @internal
79
98
  */
80
- get flexGrow() {
81
- return this._flexGrow$.value;
82
- }
99
+ flexProperties = this.normalizeFlexGrow(this._flexProperties);
83
100
  /**
101
+ * Returns if this sash has a fixed size, meaning that it has not the ability to grow or shrink.
102
+ *
84
103
  * @internal
85
104
  */
86
- flexShrink;
105
+ isFixedSize = computed(() => Number.isNaN(+this.size()));
87
106
  /**
107
+ * Gets the component that renders this sash.
108
+ *
88
109
  * @internal
89
110
  */
90
- flexBasis;
111
+ component = computed(() => this._component() ?? throwError('[SciSashbox] SashComponent not available yet.'));
91
112
  /**
92
- * Normalized flex-grow proportion of this sash, which is a value >= 1.
113
+ * Sets the component that renders this sash.
93
114
  *
94
115
  * @internal
95
116
  */
96
- flexGrowNormalized$;
97
- constructor(sashTemplate, _sashBoxAccessor) {
98
- this.sashTemplate = sashTemplate;
99
- this._sashBoxAccessor = _sashBoxAccessor;
100
- this.flexGrowNormalized$ = this._sashBoxAccessor.sashes$
101
- .pipe(switchMap(sashes => merge(...sashes.map(sash => sash._flexGrow$))), map(() => this.normalizeFlexGrow(this.flexGrow)));
102
- }
103
- ngOnInit() {
104
- this.setFlexItemProperties();
105
- }
106
- ngOnChanges(changes) {
107
- this.setFlexItemProperties();
117
+ setComponent(component) {
118
+ this._component.set(component);
108
119
  }
109
120
  /**
110
- * Returns if this sash has a fixed size, meaning that it has not the ability to grow or shrink if necessary.
121
+ * Returns the identity of this sash, or the passed index if not configured.
111
122
  *
112
123
  * @internal
113
124
  */
114
- get isFixedSize() {
115
- return Number.isNaN(+this.size);
125
+ computeKey(index) {
126
+ return this.key() ?? `${index}`;
116
127
  }
117
128
  /**
118
- * Returns the effective sash size as rendered in the DOM.
129
+ * Updates the flex properties of this sash for layout in the sashbox's flex layout.
119
130
  *
120
131
  * @internal
121
132
  */
122
- get computedSize() {
123
- // Note: Use `boundingClientRect` to get the fractional size.
124
- // see https://developer.mozilla.org/en-US/docs/Web/API/Element/clientWidth
125
- return this._sashBoxAccessor.direction === 'row' ? this.element.getBoundingClientRect().width : this.element.getBoundingClientRect().height;
133
+ updateFlexProperties(flexProperties) {
134
+ this._flexProperties.update(previousFlexProperties => ({ ...previousFlexProperties, ...flexProperties }));
126
135
  }
127
136
  /**
128
- * Computes and sets the flex item properties based on the modelled size.
137
+ * Computes the flex properties to lay out this sash in the sashbox's flex layout based on the configured {@link size}.
129
138
  */
130
- setFlexItemProperties() {
131
- if (this.isFixedSize) {
132
- // fixed-sized sash
133
- this.flexGrow = 0;
134
- this.flexShrink = 0;
135
- this.flexBasis = `${this.size}`;
136
- }
137
- else {
138
- // remaining space is distributed according to given proportion
139
- const proportion = +this.size;
140
- if (proportion < 1) {
141
- throw Error(`[IllegalSashSizeError] The proportion for flexible sized sashes must be >=1 [size=${this.size}]`);
139
+ computeFlexProperties() {
140
+ return linkedSignal(() => {
141
+ const size = this.size();
142
+ if (this.isFixedSize()) {
143
+ // fixed-sized sash
144
+ return {
145
+ flexGrow: 0,
146
+ flexShrink: 0,
147
+ flexBasis: `${size}`,
148
+ };
142
149
  }
143
- this.flexGrow = proportion;
144
- this.flexShrink = 1;
145
- this.flexBasis = '0';
146
- }
150
+ else {
151
+ // remaining space is distributed according to given proportion
152
+ const proportion = +size;
153
+ if (proportion < 1) {
154
+ throw Error(`[IllegalSashSizeError] The proportion for flexible sized sashes must be >=1 [size=${this.size()}]`);
155
+ }
156
+ return {
157
+ flexGrow: proportion,
158
+ flexShrink: 1,
159
+ flexBasis: '0',
160
+ };
161
+ }
162
+ });
147
163
  }
148
164
  /**
149
- * Computes the normalized flex-grow proportion of the given sash, which is a value >= 1.
165
+ * Normalizes the 'flex-grow' of the passed {@link FlexProperties} to ensure that the sum of the 'flex-grow' proportions of all sashes is 1.
150
166
  *
151
- * If the sum of all flex-grow proportions would be less than 1, then, the sashes would not fill the entire sash-box space.
152
- * Without normalization in place, e.g., this could happen when removing a sash.
167
+ * If the sum of all flex-grow proportions were less than 1, the sashes would not fill the entire sash-box space.
168
+ * Without normalization, this could occur when a sash is removed.
153
169
  */
154
- normalizeFlexGrow(flexGrow) {
155
- if (flexGrow === 0) {
156
- return 0;
157
- }
158
- const sashes = this._sashBoxAccessor.sashes;
159
- const flexGrowSum = sashes.reduce((sum, sash) => sum + sash.flexGrow, 0);
160
- if (flexGrowSum === 0) {
161
- return 0;
162
- }
163
- return flexGrow / flexGrowSum;
170
+ normalizeFlexGrow(flexProperties) {
171
+ return computed(() => {
172
+ const sashes = this._sashBoxAccessor.sashes();
173
+ const { flexGrow, flexShrink, flexBasis } = flexProperties();
174
+ const flexGrowSum = sashes.reduce((sum, sash) => sum + sash._flexProperties().flexGrow, 0);
175
+ return {
176
+ flexGrow: flexGrow === 0 || flexGrowSum === 0 ? 0 : flexGrow / flexGrowSum, // Sum of normalized flex-grow proportions must be 1;
177
+ flexShrink,
178
+ flexBasis,
179
+ };
180
+ });
164
181
  }
165
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: SciSashDirective, deps: [{ token: i0.TemplateRef }, { token: SciSashBoxAccessor }], target: i0.ɵɵFactoryTarget.Directive });
166
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.0.0", type: SciSashDirective, isStandalone: true, selector: "ng-template[sciSash]", inputs: { size: "size", minSize: "minSize" }, exportAs: ["sciSash"], usesOnChanges: true, ngImport: i0 });
182
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: SciSashDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
183
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.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 });
167
184
  }
168
185
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: SciSashDirective, decorators: [{
169
186
  type: Directive,
@@ -171,11 +188,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0", ngImpor
171
188
  selector: 'ng-template[sciSash]',
172
189
  exportAs: 'sciSash',
173
190
  }]
174
- }], ctorParameters: () => [{ type: i0.TemplateRef }, { type: SciSashBoxAccessor }], propDecorators: { size: [{
175
- type: Input
176
- }], minSize: [{
177
- type: Input
178
- }] } });
191
+ }] });
192
+ function throwError(error) {
193
+ throw Error(error);
194
+ }
179
195
 
180
196
  /*
181
197
  * Copyright (c) 2018-2019 Swiss Federal Railways
@@ -187,32 +203,23 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0", ngImpor
187
203
  * SPDX-License-Identifier: EPL-2.0
188
204
  */
189
205
  /**
190
- * Initializes {SashDirective} with the target {HTMLDivElement}.
206
+ * Provides access to the native {@link HTMLElement} of the host.
191
207
  */
192
- class SciSashInitializerDirective {
193
- _host;
194
- sash;
195
- constructor(_host) {
196
- this._host = _host;
197
- }
198
- ngOnChanges(changes) {
199
- this.sash.element = this._host.nativeElement;
200
- }
201
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: SciSashInitializerDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
202
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.0.0", type: SciSashInitializerDirective, isStandalone: true, selector: "div[sciSashInitializer].sash", inputs: { sash: ["sciSashInitializer", "sash"] }, usesOnChanges: true, ngImport: i0 });
208
+ class SciElementRefDirective {
209
+ host = inject(ElementRef).nativeElement;
210
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: SciElementRefDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
211
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.0.0", type: SciElementRefDirective, isStandalone: true, selector: "[sciElementRef]", exportAs: ["sciElementRef"], ngImport: i0 });
203
212
  }
204
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: SciSashInitializerDirective, decorators: [{
213
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: SciElementRefDirective, decorators: [{
205
214
  type: Directive,
206
215
  args: [{
207
- selector: 'div[sciSashInitializer].sash',
216
+ selector: '[sciElementRef]',
217
+ exportAs: 'sciElementRef',
208
218
  }]
209
- }], ctorParameters: () => [{ type: i0.ElementRef }], propDecorators: { sash: [{
210
- type: Input,
211
- args: [{ alias: 'sciSashInitializer', required: true }]
212
- }] } });
219
+ }] });
213
220
 
214
221
  /*
215
- * Copyright (c) 2018-2019 Swiss Federal Railways
222
+ * Copyright (c) 2018-2025 Swiss Federal Railways
216
223
  *
217
224
  * This program and the accompanying materials are made
218
225
  * available under the terms of the Eclipse Public License 2.0
@@ -221,28 +228,79 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0", ngImpor
221
228
  * SPDX-License-Identifier: EPL-2.0
222
229
  */
223
230
  /**
224
- * Provides access to the native {@link HTMLElement} of the host.
231
+ * Represents a {@link SciSashDirective} in the DOM, displaying the specified sash template.
225
232
  */
226
- class SciElementRefDirective {
227
- host;
228
- nativeElement;
229
- constructor(host) {
230
- this.host = host;
231
- this.nativeElement = host.nativeElement;
233
+ class SashComponent {
234
+ /**
235
+ * Specifies the sash representing this component.
236
+ */
237
+ sash = input.required();
238
+ _host = inject(ElementRef).nativeElement;
239
+ _cd = inject(ChangeDetectorRef);
240
+ _sashBoxAccessor = inject(SciSashBoxAccessor);
241
+ animationState = linkedSignal(() => this.sash().animate() && this._sashBoxAccessor.afterFirstRender() ? 'enter' : null);
242
+ constructor() {
243
+ // Associate sash with this component.
244
+ effect(() => this.sash().setComponent(this));
232
245
  }
233
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: SciElementRefDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
234
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.0.0", type: SciElementRefDirective, isStandalone: true, selector: "[sciElementRef]", exportAs: ["sciElementRef"], ngImport: i0 });
246
+ /**
247
+ * Starts the leave animation, returning a signal to track animation completion.
248
+ */
249
+ startLeaveAnimation() {
250
+ // Detach change detector to prevent updates to the component during the animation.
251
+ this._cd.detach();
252
+ // Trigger 'leave' animation.
253
+ this.animationState.set('leave');
254
+ // Return signal to track animation completion.
255
+ return computed(() => void this.animationState(), { equal: () => false });
256
+ }
257
+ /**
258
+ * Notifies when ending the animation.
259
+ */
260
+ onAnimationEnd() {
261
+ this.animationState.set(null);
262
+ }
263
+ /**
264
+ * Gets the size of this sash in pixel.
265
+ */
266
+ get size() {
267
+ const { width, height } = this._host.getBoundingClientRect();
268
+ return this._sashBoxAccessor.direction() === 'row' ? width : height;
269
+ }
270
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: SashComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
271
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.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
+ trigger('sash-animation', provideAnimation()),
273
+ ] });
274
+ }
275
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: SashComponent, decorators: [{
276
+ type: Component,
277
+ args: [{ selector: 'sci-sash', imports: [
278
+ NgTemplateOutlet,
279
+ ], animations: [
280
+ trigger('sash-animation', provideAnimation()),
281
+ ], host: {
282
+ '[@sash-animation]': 'animationState()',
283
+ '(@sash-animation.done)': 'onAnimationEnd();',
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: () => [] });
286
+ /**
287
+ * Returns animation metadata to slide-in and slide-out a sash.
288
+ */
289
+ function provideAnimation() {
290
+ return [
291
+ transition('void => enter', [
292
+ style({ 'flex-basis': 0 }),
293
+ animate(`125ms ease-out`, style({ 'flex-basis': '*' })),
294
+ ]),
295
+ transition('* => leave', [
296
+ style({ 'flex-basis': '*' }),
297
+ animate(`125ms ease-out`, style({ 'flex-basis': 0 })),
298
+ ]),
299
+ ];
235
300
  }
236
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: SciElementRefDirective, decorators: [{
237
- type: Directive,
238
- args: [{
239
- selector: '[sciElementRef]',
240
- exportAs: 'sciElementRef',
241
- }]
242
- }], ctorParameters: () => [{ type: i0.ElementRef }] });
243
301
 
244
302
  /*
245
- * Copyright (c) 2018-2019 Swiss Federal Railways
303
+ * Copyright (c) 2018-2025 Swiss Federal Railways
246
304
  *
247
305
  * This program and the accompanying materials are made
248
306
  * available under the terms of the Eclipse Public License 2.0
@@ -255,10 +313,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0", ngImpor
255
313
  * or column arrangement (as specified by the direction property). A splitter is added between each child to allow the user to
256
314
  * shrink or stretch the individual sashes.
257
315
  *
258
- * Sashes are modelled as content children inside a <ng-template> decorated with the 'sciSash' directive.
259
- * A sash can have a fixed size with an explicit unit, or a unitless proportion to distibute remaining space.
316
+ * Sashes are modelled as <ng-template> decorated with the 'sciSash' directive.
317
+ * A sash can have a fixed size with an explicit unit, or a unitless proportion to distribute remaining space.
260
318
  * A proportional sash has the ability to grow or shrink if necessary.
261
319
  *
320
+ * Sash content is added to a CSS grid container with a single column, stretching the content vertically and horizontally.
262
321
  *
263
322
  * ### Usage
264
323
  *
@@ -304,32 +363,43 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0", ngImpor
304
363
  * ```
305
364
  */
306
365
  class SciSashboxComponent {
307
- _destroy$ = new Subject();
308
- _host = inject((ElementRef)).nativeElement;
309
- _zone = inject(NgZone);
310
- sashes$ = new BehaviorSubject([]);
311
- sashing = false;
312
- maxHeight;
313
- maxWidth;
314
366
  /**
315
367
  * Specifies if to lay out sashes in a row (which is by default) or column arrangement.
316
368
  */
317
- direction = 'row';
369
+ direction = input('row');
318
370
  /**
319
- * Emits when start sashing.
371
+ * Notifies when start sashing.
320
372
  */
321
- sashStart = new EventEmitter();
373
+ sashStart = output();
322
374
  /**
323
- * Emits the absolute sash sizes (px) when finished sashing.
375
+ * Emits an array with new sash sizes when sashing ends.
376
+ *
377
+ * The array contains the sash sizes in display order.
378
+ *
379
+ * TODO [Angular 20] BREAKING CHANGE: Change signature from `number[]` to `{[key: string]: number}` and remove {@link sashEnd2}.
324
380
  */
325
- sashEnd = new EventEmitter();
381
+ sashEnd = output();
382
+ /**
383
+ * Emits an object with new sash sizes when sashing ends.
384
+ *
385
+ * Each sash size is associated with its {@link SciSashDirective.key} or its display position (zero-based) if not set.
386
+ *
387
+ * Note: This output will be renamed to `sashEnd` in version 20, changing the signature of {@link sashEnd} from `number[]` to `{[key: string]: number}`.
388
+ *
389
+ * TODO [Angular 20] BREAKING CHANGE: Replace with {@link sashEnd}.
390
+ */
391
+ sashEnd2 = output();
392
+ _host = inject(ElementRef).nativeElement;
393
+ _contentChildren = contentChildren(SciSashDirective);
326
394
  /** @internal */
327
- set setSashes(queryList) {
328
- queryList.changes
329
- .pipe(startWith(queryList), takeUntil(this._destroy$))
330
- .subscribe((sashes) => {
331
- this.sashes$.next(sashes.toArray());
332
- });
395
+ sashes = this.computeSashes(this._contentChildren);
396
+ /** @internal */
397
+ afterFirstRender = signal(false);
398
+ sashing = false;
399
+ maxHeight;
400
+ maxWidth;
401
+ constructor() {
402
+ this.detectFirstRendering();
333
403
  }
334
404
  onSashStart() {
335
405
  this.sashing = true;
@@ -338,12 +408,14 @@ class SciSashboxComponent {
338
408
  this.maxHeight = hostBounds.height;
339
409
  this.maxWidth = hostBounds.width;
340
410
  this.sashStart.emit();
341
- // set the effective sash size as the flex-basis for non-fixed sashes (as sashing operates on pixel deltas)
342
- this.sashes.forEach(sash => {
343
- if (!sash.isFixedSize) {
344
- sash.flexGrow = 0;
345
- sash.flexShrink = 1;
346
- sash.flexBasis = `${sash.computedSize}px`;
411
+ // Set the effective sash size as the flex-basis for non-fixed sashes (as sashing operates on pixel deltas).
412
+ this.sashes().forEach(sash => {
413
+ if (!sash.isFixedSize()) {
414
+ sash.updateFlexProperties({
415
+ flexGrow: 0,
416
+ flexShrink: 1,
417
+ flexBasis: `${sash.component().size}px`,
418
+ });
347
419
  }
348
420
  });
349
421
  }
@@ -351,86 +423,80 @@ class SciSashboxComponent {
351
423
  this.sashing = false;
352
424
  this.maxHeight = undefined;
353
425
  this.maxWidth = undefined;
354
- // unset the flex-basis for non-fixed sashes and set the flex-grow accordingly
355
- const pixelToFlexGrowFactor = computePixelToFlexGrowFactor(this.sashes);
356
- const absoluteSashSizes = this.sashes.map(sash => sash.computedSize);
357
- this.sashes.forEach((sash, i) => {
358
- if (!sash.isFixedSize) {
359
- sash.flexGrow = pixelToFlexGrowFactor * absoluteSashSizes[i];
360
- sash.flexShrink = 1;
361
- sash.flexBasis = '0';
426
+ // Unset the flex-basis for non-fixed sashes and set the flex-grow accordingly.
427
+ const pixelToFlexGrowFactor = computePixelToFlexGrowFactor(this.sashes());
428
+ const sashSizes = this.sashes().reduce((acc, sash, i) => acc.set(sash.computeKey(i), sash.component().size), new Map());
429
+ this.sashes().forEach((sash, i) => {
430
+ if (!sash.isFixedSize()) {
431
+ sash.updateFlexProperties({
432
+ flexGrow: pixelToFlexGrowFactor * sashSizes.get(sash.computeKey(i)),
433
+ flexShrink: 1,
434
+ flexBasis: '0',
435
+ });
362
436
  }
363
437
  });
364
- this.sashEnd.emit(absoluteSashSizes);
438
+ this.sashEnd.emit(Array.from(sashSizes.values()));
439
+ this.sashEnd2.emit(Object.fromEntries(sashSizes));
365
440
  }
366
441
  onSash(splitter, sashIndex, moveEvent) {
442
+ NgZone.assertNotInAngularZone();
367
443
  const distance = moveEvent.distance;
368
444
  if (distance === 0) {
369
445
  return;
370
446
  }
371
- NgZone.assertNotInAngularZone();
372
- // compute the splitter position
447
+ // Compute the splitter position.
373
448
  const splitterRect = splitter.getBoundingClientRect();
374
449
  const splitterStart = (this.isRowDirection ? splitterRect.left : splitterRect.top);
375
450
  const splitterEnd = (this.isRowDirection ? splitterRect.left + splitterRect.width : splitterRect.top + splitterRect.height);
376
- // ignore the event if outside of the splitter's action scope
451
+ // Ignore the event if outside the splitter's action scope.
377
452
  const eventPos = moveEvent.position.clientPos;
378
- // i.e. the sash should not grow if moved the mouse pointer beyond the left bounds of the sash, and if now moving the mouse pointer back toward the current sash.
453
+ // The sash should not grow after moved the mouse pointer beyond the left bounds of the sash and now moving the mouse pointer back toward the current sash.
379
454
  if (distance > 0 && eventPos < splitterStart) {
380
455
  return;
381
456
  }
382
- // i.e. the sash should not shrink if moved the mouse pointer beyond the right bounds of the sash, and if now moving the mouse pointer back toward the current sash.
457
+ // The sash should not shrink after moved the mouse pointer beyond the right bounds of the sash and now moving the mouse pointer back toward the current sash.
383
458
  if (distance < 0 && eventPos > splitterEnd) {
384
459
  return;
385
460
  }
386
- // compute the new sash sizes
387
- const sash1 = this.sashes[sashIndex];
388
- const sash2 = this.sashes[sashIndex + 1];
389
- const sashSize1 = sash1.computedSize;
390
- const sashSize2 = sash2.computedSize;
391
- const sashMinSize1 = sash1.minSize ? this.toPixel(sash1.minSize) : 0;
392
- const sashMinSize2 = sash2.minSize ? this.toPixel(sash2.minSize) : 0;
461
+ // Compute the new sash sizes.
462
+ const sash1 = this.sashes()[sashIndex];
463
+ const sash2 = this.sashes()[sashIndex + 1];
464
+ const sashSize1 = sash1.component().size;
465
+ const sashSize2 = sash2.component().size;
466
+ const sashMinSize1 = sash1.minSize() ? this.toPixel(sash1.minSize()) : 0;
467
+ const sashMinSize2 = sash2.minSize() ? this.toPixel(sash2.minSize()) : 0;
393
468
  const newSashSize1 = between(Math.round(sashSize1 + distance), { min: sashMinSize1, max: sashSize1 + sashSize2 - sashMinSize2 });
394
469
  const newSashSize2 = between(Math.round(sashSize2 - distance), { min: sashMinSize2, max: sashSize1 + sashSize2 - sashMinSize1 });
395
- // set the new computed sash sizes
396
- this._zone.run(() => {
397
- sash1.flexBasis = `${newSashSize1}px`;
398
- sash2.flexBasis = `${newSashSize2}px`;
399
- });
470
+ // Set the new computed sash sizes.
471
+ sash1.updateFlexProperties({ flexBasis: `${newSashSize1}px` });
472
+ sash2.updateFlexProperties({ flexBasis: `${newSashSize2}px` });
400
473
  }
401
474
  onSashReset(sashIndex) {
402
- const sash1 = this.sashes[sashIndex];
403
- const sash2 = this.sashes[sashIndex + 1];
404
- const equalSashSize = (sash1.computedSize + sash2.computedSize) / 2;
405
- const pixelToFlexGrowFactor = computePixelToFlexGrowFactor(this.sashes);
406
- const absoluteSashSizesAfterReset = this.sashes.map((sash, index) => {
407
- if (index === sashIndex || index === sashIndex + 1) {
408
- return equalSashSize;
409
- }
410
- return sash.computedSize;
411
- });
475
+ const sash1 = this.sashes()[sashIndex];
476
+ const sash2 = this.sashes()[sashIndex + 1];
477
+ const equalSashSize = (sash1.component().size + sash2.component().size) / 2;
478
+ const pixelToFlexGrowFactor = computePixelToFlexGrowFactor(this.sashes());
479
+ const sashSizesAfterReset = this.sashes().reduce((acc, sash, index) => {
480
+ const size = index === sashIndex || index === sashIndex + 1 ? equalSashSize : sash.component().size;
481
+ return acc.set(sash.computeKey(index), size);
482
+ }, new Map());
412
483
  [sash1, sash2].forEach(sash => {
413
- if (sash.isFixedSize) {
414
- sash.flexBasis = `${equalSashSize}px`;
484
+ if (sash.isFixedSize()) {
485
+ sash.updateFlexProperties({ flexBasis: `${equalSashSize}px` });
415
486
  }
416
487
  else {
417
- sash.flexGrow = pixelToFlexGrowFactor * equalSashSize;
488
+ sash.updateFlexProperties({ flexGrow: pixelToFlexGrowFactor * equalSashSize });
418
489
  }
419
490
  });
420
491
  this.sashStart.emit();
421
- this.sashEnd.emit(absoluteSashSizesAfterReset);
492
+ this.sashEnd.emit(Array.from(sashSizesAfterReset.values()));
493
+ this.sashEnd2.emit(Object.fromEntries(sashSizesAfterReset));
422
494
  }
423
495
  get isColumnDirection() {
424
- return this.direction === 'column';
496
+ return this.direction() === 'column';
425
497
  }
426
498
  get isRowDirection() {
427
- return this.direction === 'row';
428
- }
429
- get sashes() {
430
- return this.sashes$.value;
431
- }
432
- ngOnDestroy() {
433
- this._destroy$.next();
499
+ return this.direction() === 'row';
434
500
  }
435
501
  toPixel(value) {
436
502
  if (typeof value === 'number') {
@@ -443,25 +509,63 @@ class SciSashboxComponent {
443
509
  }
444
510
  return parseInt(value, 10);
445
511
  }
512
+ /**
513
+ * Detects when rendered this component for the first time.
514
+ */
515
+ detectFirstRendering() {
516
+ afterNextRender({
517
+ read: () => this.afterFirstRender.set(true),
518
+ });
519
+ }
520
+ /**
521
+ * Mirrors the provided signal. If animated sashes are being removed, delays emission until the animation completes,
522
+ * effectively removing the element after the animation.
523
+ *
524
+ * Delayed removal is required for CDK Portals to not remove displayed content immediately.
525
+ */
526
+ computeSashes(contentChildren) {
527
+ const differ = inject(IterableDiffers).find([]).create();
528
+ const sashes = signal([]);
529
+ effect(() => {
530
+ // Compute removed sashes to be removed with an animation.
531
+ const removedAnimatedSashes = new Array();
532
+ differ.diff(contentChildren())?.forEachRemovedItem(({ item: sash }) => untracked(() => {
533
+ if (sash.animate()) {
534
+ removedAnimatedSashes.push(sash);
535
+ }
536
+ }));
537
+ // Emit if no sashes are removed with an animation.
538
+ if (!removedAnimatedSashes.length) {
539
+ sashes.set(contentChildren());
540
+ return;
541
+ }
542
+ // Delay emission until a leave animation completes.
543
+ removedAnimatedSashes.forEach(sash => {
544
+ // Start the leave animation.
545
+ const done = sash.component().startLeaveAnimation();
546
+ // Track animation completion, re-running this effect to finally emit the sashes.
547
+ done();
548
+ });
549
+ });
550
+ return sashes;
551
+ }
446
552
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: SciSashboxComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
447
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.0", type: SciSashboxComponent, isStandalone: true, selector: "sci-sashbox", inputs: { direction: "direction" }, outputs: { sashStart: "sashStart", sashEnd: "sashEnd" }, host: { properties: { "class.sashing": "this.sashing", "style.--\u0275sci-sashbox-max-height": "this.maxHeight", "style.--\u0275sci-sashbox-max-width": "this.maxWidth", "class.column": "this.isColumnDirection", "class.row": "this.isRowDirection" } }, providers: [{
553
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.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", sashEnd2: "sashEnd2" }, host: { properties: { "class.sashing": "this.sashing", "style.--\u0275sci-sashbox-max-height": "this.maxHeight", "style.--\u0275sci-sashbox-max-width": "this.maxWidth", "class.column": "this.isColumnDirection", "class.row": "this.isRowDirection" } }, providers: [{
448
554
  provide: SciSashBoxAccessor,
449
555
  useFactory: provideSashBoxAccessor,
450
- }], queries: [{ propertyName: "setSashes", predicate: SciSashDirective }], ngImport: i0, template: "@for (sash of sashes$ | async; track sash; let i = $index; let first = $first; let last = $last) {\n <div class=\"sash\"\n [class.first]=\"first\"\n [class.last]=\"last\"\n [sciSashInitializer]=\"sash\"\n [style.flex-grow]=\"sash.flexGrowNormalized$ | async\"\n [style.flex-shrink]=\"sash.flexShrink\"\n [style.flex-basis]=\"sash.flexBasis\">\n <ng-container *ngTemplateOutlet=\"sash.sashTemplate\"/>\n </div>\n @if (!last) {\n <sci-splitter sciElementRef #sciElementRef=\"sciElementRef\"\n [orientation]=\"isRowDirection ? 'vertical' : 'horizontal'\"\n (start)=\"onSashStart()\"\n (move)=\"onSash(sciElementRef.nativeElement, 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.column{flex-direction:column}:host.row{flex-direction:row}:host>div.sash{overflow:hidden;display:grid;grid-auto-rows:100%;grid-auto-columns:100%}:host.row>div.sash{margin:0 var(--sci-sashbox-gap)}:host.row>div.sash.first{margin-left:0}:host.row>div.sash.last{margin-right:0}:host.column>div.sash{margin:var(--sci-sashbox-gap) 0}:host.column>div.sash.first{margin-top:0}:host.column>div.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>div.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: "pipe", type: AsyncPipe, name: "async" }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: SciSashInitializerDirective, selector: "div[sciSashInitializer].sash", inputs: ["sciSashInitializer"] }, { kind: "component", type: SciSplitterComponent, selector: "sci-splitter", inputs: ["orientation"], outputs: ["start", "move", "end", "reset"] }, { kind: "directive", type: SciElementRefDirective, selector: "[sciElementRef]", exportAs: ["sciElementRef"] }] });
556
+ }], 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]=\"isRowDirection ? '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.column{flex-direction:column}:host.row{flex-direction:row}:host.row>sci-sash{margin:0 var(--sci-sashbox-gap)}:host.row>sci-sash.first{margin-left:0}:host.row>sci-sash.last{margin-right:0}:host.column>sci-sash{margin:var(--sci-sashbox-gap) 0}:host.column>sci-sash.first{margin-top:0}:host.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"] }] });
451
557
  }
452
558
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: SciSashboxComponent, decorators: [{
453
559
  type: Component,
454
560
  args: [{ selector: 'sci-sashbox', imports: [
455
- AsyncPipe,
456
- NgTemplateOutlet,
457
- SciSashInitializerDirective,
458
561
  SciSplitterComponent,
459
562
  SciElementRefDirective,
563
+ SashComponent,
460
564
  ], providers: [{
461
565
  provide: SciSashBoxAccessor,
462
566
  useFactory: provideSashBoxAccessor,
463
- }], template: "@for (sash of sashes$ | async; track sash; let i = $index; let first = $first; let last = $last) {\n <div class=\"sash\"\n [class.first]=\"first\"\n [class.last]=\"last\"\n [sciSashInitializer]=\"sash\"\n [style.flex-grow]=\"sash.flexGrowNormalized$ | async\"\n [style.flex-shrink]=\"sash.flexShrink\"\n [style.flex-basis]=\"sash.flexBasis\">\n <ng-container *ngTemplateOutlet=\"sash.sashTemplate\"/>\n </div>\n @if (!last) {\n <sci-splitter sciElementRef #sciElementRef=\"sciElementRef\"\n [orientation]=\"isRowDirection ? 'vertical' : 'horizontal'\"\n (start)=\"onSashStart()\"\n (move)=\"onSash(sciElementRef.nativeElement, 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.column{flex-direction:column}:host.row{flex-direction:row}:host>div.sash{overflow:hidden;display:grid;grid-auto-rows:100%;grid-auto-columns:100%}:host.row>div.sash{margin:0 var(--sci-sashbox-gap)}:host.row>div.sash.first{margin-left:0}:host.row>div.sash.last{margin-right:0}:host.column>div.sash{margin:var(--sci-sashbox-gap) 0}:host.column>div.sash.first{margin-top:0}:host.column>div.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>div.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"] }]
464
- }], propDecorators: { sashing: [{
567
+ }], 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]=\"isRowDirection ? '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.column{flex-direction:column}:host.row{flex-direction:row}:host.row>sci-sash{margin:0 var(--sci-sashbox-gap)}:host.row>sci-sash.first{margin-left:0}:host.row>sci-sash.last{margin-right:0}:host.column>sci-sash{margin:var(--sci-sashbox-gap) 0}:host.column>sci-sash.first{margin-top:0}:host.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"] }]
568
+ }], ctorParameters: () => [], propDecorators: { sashing: [{
465
569
  type: HostBinding,
466
570
  args: ['class.sashing']
467
571
  }], maxHeight: [{
@@ -470,15 +574,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0", ngImpor
470
574
  }], maxWidth: [{
471
575
  type: HostBinding,
472
576
  args: ['style.--ɵsci-sashbox-max-width']
473
- }], direction: [{
474
- type: Input
475
- }], sashStart: [{
476
- type: Output
477
- }], sashEnd: [{
478
- type: Output
479
- }], setSashes: [{
480
- type: ContentChildren,
481
- args: [SciSashDirective]
482
577
  }], isColumnDirection: [{
483
578
  type: HostBinding,
484
579
  args: ['class.column']
@@ -493,24 +588,18 @@ function between(value, minmax) {
493
588
  * Returns the factor to compute the flex-grow proportion from the pixel size of a sash.
494
589
  */
495
590
  function computePixelToFlexGrowFactor(sashes) {
496
- const flexibleSashes = sashes.filter(sash => !sash.isFixedSize);
497
- const proportionSum = flexibleSashes.reduce((sum, sash) => sum + Number(sash.size), 0);
498
- const pixelSum = flexibleSashes.reduce((sum, sash) => sum + sash.computedSize, 0);
591
+ const flexibleSashes = sashes.filter(sash => !sash.isFixedSize());
592
+ const proportionSum = flexibleSashes.reduce((sum, sash) => sum + Number(sash.size()), 0);
593
+ const pixelSum = flexibleSashes.reduce((sum, sash) => sum + sash.component().size, 0);
499
594
  return proportionSum / pixelSum;
500
595
  }
501
596
  function provideSashBoxAccessor() {
502
597
  const component = inject(SciSashboxComponent);
503
598
  return new class {
504
- get direction() {
505
- return component.direction;
506
- }
507
- get sashes$() {
508
- return component.sashes$;
509
- }
510
- get sashes() {
511
- return component.sashes$.value;
512
- }
513
- };
599
+ sashes = component.sashes;
600
+ direction = component.direction;
601
+ afterFirstRender = component.afterFirstRender;
602
+ }();
514
603
  }
515
604
 
516
605
  /*