@scion/components 13.0.0 → 14.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/_index.scss +1 -23
  2. package/dimension/dimension.directive.d.ts +1 -1
  3. package/dimension/{scion-components-dimension.d.ts → index.d.ts} +0 -0
  4. package/esm2020/dimension/dimension.directive.mjs +3 -3
  5. package/esm2020/dimension/dimension.module.mjs +5 -7
  6. package/esm2020/sashbox/element-ref.directive.mjs +3 -3
  7. package/esm2020/sashbox/sash-initializer.directive.mjs +3 -3
  8. package/esm2020/sashbox/sash.directive.mjs +4 -4
  9. package/esm2020/sashbox/sashbox.component.mjs +6 -6
  10. package/esm2020/sashbox/sashbox.module.mjs +6 -8
  11. package/esm2020/splitter/splitter.component.mjs +3 -3
  12. package/esm2020/splitter/splitter.module.mjs +5 -7
  13. package/esm2020/throbber/ellipsis-throbber/ellipsis-throbber.component.mjs +3 -3
  14. package/esm2020/throbber/ripple-throbber/ripple-throbber.component.mjs +3 -3
  15. package/esm2020/throbber/roller-throbber/roller-throbber.component.mjs +3 -3
  16. package/esm2020/throbber/spinner-throbber/spinner-throbber.component.mjs +3 -3
  17. package/esm2020/throbber/throbber.component.mjs +8 -8
  18. package/esm2020/throbber/throbber.module.mjs +5 -7
  19. package/esm2020/viewport/native-scrollbar-track-size-provider.service.mjs +3 -3
  20. package/esm2020/viewport/scrollable.directive.mjs +3 -3
  21. package/esm2020/viewport/scrollbar/scrollbar.component.mjs +3 -3
  22. package/esm2020/viewport/viewport.component.mjs +54 -64
  23. package/esm2020/viewport/viewport.module.mjs +6 -8
  24. package/fesm2015/scion-components-dimension.mjs +7 -9
  25. package/fesm2015/scion-components-dimension.mjs.map +1 -1
  26. package/fesm2015/scion-components-sashbox.mjs +21 -23
  27. package/fesm2015/scion-components-sashbox.mjs.map +1 -1
  28. package/fesm2015/scion-components-splitter.mjs +7 -9
  29. package/fesm2015/scion-components-splitter.mjs.map +1 -1
  30. package/fesm2015/scion-components-throbber.mjs +20 -22
  31. package/fesm2015/scion-components-throbber.mjs.map +1 -1
  32. package/fesm2015/scion-components-viewport.mjs +67 -78
  33. package/fesm2015/scion-components-viewport.mjs.map +1 -1
  34. package/fesm2015/scion-components.mjs.map +1 -1
  35. package/fesm2020/scion-components-dimension.mjs +7 -9
  36. package/fesm2020/scion-components-dimension.mjs.map +1 -1
  37. package/fesm2020/scion-components-sashbox.mjs +21 -23
  38. package/fesm2020/scion-components-sashbox.mjs.map +1 -1
  39. package/fesm2020/scion-components-splitter.mjs +7 -9
  40. package/fesm2020/scion-components-splitter.mjs.map +1 -1
  41. package/fesm2020/scion-components-throbber.mjs +20 -22
  42. package/fesm2020/scion-components-throbber.mjs.map +1 -1
  43. package/fesm2020/scion-components-viewport.mjs +66 -78
  44. package/fesm2020/scion-components-viewport.mjs.map +1 -1
  45. package/fesm2020/scion-components.mjs.map +1 -1
  46. package/{scion-components.d.ts → index.d.ts} +0 -0
  47. package/package.json +13 -13
  48. package/sashbox/element-ref.directive.d.ts +1 -1
  49. package/sashbox/{scion-components-sashbox.d.ts → index.d.ts} +0 -0
  50. package/sashbox/sash-initializer.directive.d.ts +1 -1
  51. package/sashbox/sash.directive.d.ts +2 -2
  52. package/sashbox/sashbox.component.d.ts +1 -1
  53. package/splitter/{scion-components-splitter.d.ts → index.d.ts} +0 -0
  54. package/splitter/splitter.component.d.ts +1 -1
  55. package/throbber/ellipsis-throbber/ellipsis-throbber.component.d.ts +1 -1
  56. package/throbber/{scion-components-throbber.d.ts → index.d.ts} +0 -0
  57. package/throbber/ripple-throbber/ripple-throbber.component.d.ts +1 -1
  58. package/throbber/roller-throbber/roller-throbber.component.d.ts +1 -1
  59. package/throbber/spinner-throbber/spinner-throbber.component.d.ts +1 -1
  60. package/throbber/throbber.component.d.ts +1 -1
  61. package/viewport/_scrollbar.scss +3 -1
  62. package/viewport/{scion-components-viewport.d.ts → index.d.ts} +0 -0
  63. package/viewport/scrollable.directive.d.ts +1 -1
  64. package/viewport/scrollbar/scrollbar.component.d.ts +1 -1
  65. package/viewport/viewport.component.d.ts +26 -21
  66. package/_components.scss +0 -1
  67. package/dimension/package.json +0 -10
  68. package/sashbox/package.json +0 -10
  69. package/splitter/package.json +0 -10
  70. package/throbber/package.json +0 -10
  71. package/viewport/package.json +0 -10
@@ -1,14 +1,14 @@
1
1
  import * as i0 from '@angular/core';
2
- import { Injectable, Inject, NgZone, Component, ChangeDetectionStrategy, ViewChild, HostBinding, Input, Directive, EventEmitter, Output, HostListener, NgModule } from '@angular/core';
3
- import * as i5 from '@angular/common';
2
+ import { Injectable, Inject, NgZone, Component, ChangeDetectionStrategy, ViewChild, HostBinding, Input, Directive, EventEmitter, ViewEncapsulation, Output, HostListener, NgModule } from '@angular/core';
3
+ import * as i2 from '@angular/common';
4
4
  import { DOCUMENT, CommonModule } from '@angular/common';
5
5
  import { coerceElement } from '@angular/cdk/coercion';
6
6
  import { BehaviorSubject, Subject, fromEvent, of, merge, timer } from 'rxjs';
7
7
  import { debounceTime, startWith, map, distinctUntilChanged, takeUntil, switchMap, first, withLatestFrom, takeWhile } from 'rxjs/operators';
8
+ import * as i3 from '@angular/cdk/scrolling';
9
+ import { ScrollingModule } from '@angular/cdk/scrolling';
8
10
  import { fromDimension$, fromMutation$ } from '@scion/toolkit/observable';
9
11
  import { subscribeInside, filterArray } from '@scion/toolkit/operators';
10
- import * as i4 from '@angular/cdk/scrolling';
11
- import { ScrollingModule } from '@angular/cdk/scrolling';
12
12
 
13
13
  /*
14
14
  * Copyright (c) 2018-2019 Swiss Federal Railways
@@ -98,9 +98,9 @@ class SciNativeScrollbarTrackSizeProvider {
98
98
  this._destroy$.next();
99
99
  }
100
100
  }
101
- SciNativeScrollbarTrackSizeProvider.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: SciNativeScrollbarTrackSizeProvider, deps: [{ token: DOCUMENT }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Injectable });
102
- SciNativeScrollbarTrackSizeProvider.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: SciNativeScrollbarTrackSizeProvider, providedIn: 'root' });
103
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: SciNativeScrollbarTrackSizeProvider, decorators: [{
101
+ SciNativeScrollbarTrackSizeProvider.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: SciNativeScrollbarTrackSizeProvider, deps: [{ token: DOCUMENT }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Injectable });
102
+ SciNativeScrollbarTrackSizeProvider.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: SciNativeScrollbarTrackSizeProvider, providedIn: 'root' });
103
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: SciNativeScrollbarTrackSizeProvider, decorators: [{
104
104
  type: Injectable,
105
105
  args: [{ providedIn: 'root' }]
106
106
  }], ctorParameters: function () { return [{ type: Document, decorators: [{
@@ -407,9 +407,9 @@ class SciScrollbarComponent {
407
407
  * @internal
408
408
  */
409
409
  SciScrollbarComponent.VIEWPORT_RESIZE_DEBOUNCE_TIME = 50;
410
- SciScrollbarComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: SciScrollbarComponent, deps: [{ token: i0.ElementRef }, { token: DOCUMENT }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component });
411
- SciScrollbarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.3", type: SciScrollbarComponent, selector: "sci-scrollbar", inputs: { direction: "direction", setViewport: ["viewport", "setViewport"] }, host: { properties: { "class.vertical": "this.vertical", "class.horizontal": "this.horizontal", "class.scrolling": "this.scrolling" } }, viewQueries: [{ propertyName: "thumbElement", first: true, predicate: ["thumb_handle"], descendants: true, static: true }], ngImport: i0, template: "<!-- scrolltrack to move the viewport client upwards (paging) -->\n<div class=\"scrolltrack-start\" (mousedown)=\"onScrollTrackMouseDown($event, 'up')\"></div>\n\n<!-- scrollthumb -->\n<div #thumb_handle\n class=\"thumb-handle\"\n [class.vertical]=\"vertical\"\n [class.horizontal]=\"horizontal\"\n (mousedown)=\"onMouseDown($event)\"\n (touchstart)=\"onTouchStart($event)\"\n (touchmove)=\"onTouchMove($event)\"\n (touchend)=\"onTouchEnd($event)\"\n (touchcancel)=\"onTouchEnd($event)\">\n <div class=\"thumb\"\n [class.vertical]=\"vertical\"\n [class.horizontal]=\"horizontal\">\n </div>\n</div>\n\n<!-- scrolltrack to move the viewport client downwards (paging) -->\n<div class=\"scrolltrack-end\" (mousedown)=\"onScrollTrackMouseDown($event, 'down')\"></div>\n", styles: ["@charset \"UTF-8\";:host{display:flex;border:2px solid transparent;box-sizing:border-box;--sci-scrollbar-color: rgb(78, 78, 78);--\\275sci-scrollbar-thumb-position-fr: 0;--\\275sci-scrollbar-thumb-size-fr: 0}:host.vertical{flex-direction:column}:host.horizontal{flex-direction:row}:host>div.scrolltrack-start{flex-grow:var(--\\275sci-scrollbar-thumb-position-fr)}:host>div.thumb-handle{flex-basis:20px;display:flex;flex-grow:var(--\\275sci-scrollbar-thumb-size-fr);align-items:center}:host>div.thumb-handle.vertical{flex-direction:column}:host>div.thumb-handle.horizontal{flex-direction:row}:host>div.thumb-handle>div.thumb{flex:auto;border-radius:4px;background-color:var(--sci-scrollbar-color);opacity:.4;transition-duration:125ms;transition-property:width,height;transition-timing-function:ease-out}:host>div.thumb-handle>div.thumb.vertical{width:60%}:host>div.thumb-handle>div.thumb.horizontal{height:60%}:host>div.scrolltrack-end{flex-grow:calc(1 - (var(--\\275sci-scrollbar-thumb-position-fr) + var(--\\275sci-scrollbar-thumb-size-fr)))}:host-context:not(.overflow){display:none}:host-context:hover>div.thumb-handle>div.thumb,:host-context(.scrolling)>div.thumb-handle>div.thumb{background-color:var(--sci-scrollbar-color);opacity:.75}:host-context:hover>div.thumb-handle>div.thumb.vertical,:host-context(.scrolling)>div.thumb-handle>div.thumb.vertical{width:100%}:host-context:hover>div.thumb-handle>div.thumb.horizontal,:host-context(.scrolling)>div.thumb-handle>div.thumb.horizontal{height:100%}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
412
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: SciScrollbarComponent, decorators: [{
410
+ SciScrollbarComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: SciScrollbarComponent, deps: [{ token: i0.ElementRef }, { token: DOCUMENT }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component });
411
+ SciScrollbarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.2", type: SciScrollbarComponent, selector: "sci-scrollbar", inputs: { direction: "direction", setViewport: ["viewport", "setViewport"] }, host: { properties: { "class.vertical": "this.vertical", "class.horizontal": "this.horizontal", "class.scrolling": "this.scrolling" } }, viewQueries: [{ propertyName: "thumbElement", first: true, predicate: ["thumb_handle"], descendants: true, static: true }], ngImport: i0, template: "<!-- scrolltrack to move the viewport client upwards (paging) -->\n<div class=\"scrolltrack-start\" (mousedown)=\"onScrollTrackMouseDown($event, 'up')\"></div>\n\n<!-- scrollthumb -->\n<div #thumb_handle\n class=\"thumb-handle\"\n [class.vertical]=\"vertical\"\n [class.horizontal]=\"horizontal\"\n (mousedown)=\"onMouseDown($event)\"\n (touchstart)=\"onTouchStart($event)\"\n (touchmove)=\"onTouchMove($event)\"\n (touchend)=\"onTouchEnd($event)\"\n (touchcancel)=\"onTouchEnd($event)\">\n <div class=\"thumb\"\n [class.vertical]=\"vertical\"\n [class.horizontal]=\"horizontal\">\n </div>\n</div>\n\n<!-- scrolltrack to move the viewport client downwards (paging) -->\n<div class=\"scrolltrack-end\" (mousedown)=\"onScrollTrackMouseDown($event, 'down')\"></div>\n", styles: ["@charset \"UTF-8\";:host{display:flex;border:2px solid transparent;box-sizing:border-box;--sci-scrollbar-color: rgb(78, 78, 78);--\\275sci-scrollbar-thumb-position-fr: 0;--\\275sci-scrollbar-thumb-size-fr: 0}:host.vertical{flex-direction:column}:host.horizontal{flex-direction:row}:host>div.scrolltrack-start{flex-grow:var(--\\275sci-scrollbar-thumb-position-fr)}:host>div.thumb-handle{flex-basis:20px;display:flex;flex-grow:var(--\\275sci-scrollbar-thumb-size-fr);align-items:center}:host>div.thumb-handle.vertical{flex-direction:column}:host>div.thumb-handle.horizontal{flex-direction:row}:host>div.thumb-handle>div.thumb{flex:auto;border-radius:4px;background-color:var(--sci-scrollbar-color);opacity:.4;transition-duration:125ms;transition-property:width,height;transition-timing-function:ease-out}:host>div.thumb-handle>div.thumb.vertical{width:60%}:host>div.thumb-handle>div.thumb.horizontal{height:60%}:host>div.scrolltrack-end{flex-grow:calc(1 - (var(--\\275sci-scrollbar-thumb-position-fr) + var(--\\275sci-scrollbar-thumb-size-fr)))}:host-context:not(.overflow){display:none}:host-context:hover>div.thumb-handle>div.thumb,:host-context(.scrolling)>div.thumb-handle>div.thumb{background-color:var(--sci-scrollbar-color);opacity:.75}:host-context:hover>div.thumb-handle>div.thumb.vertical,:host-context(.scrolling)>div.thumb-handle>div.thumb.vertical{width:100%}:host-context:hover>div.thumb-handle>div.thumb.horizontal,:host-context(.scrolling)>div.thumb-handle>div.thumb.horizontal{height:100%}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
412
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: SciScrollbarComponent, decorators: [{
413
413
  type: Component,
414
414
  args: [{ selector: 'sci-scrollbar', changeDetection: ChangeDetectionStrategy.OnPush, template: "<!-- scrolltrack to move the viewport client upwards (paging) -->\n<div class=\"scrolltrack-start\" (mousedown)=\"onScrollTrackMouseDown($event, 'up')\"></div>\n\n<!-- scrollthumb -->\n<div #thumb_handle\n class=\"thumb-handle\"\n [class.vertical]=\"vertical\"\n [class.horizontal]=\"horizontal\"\n (mousedown)=\"onMouseDown($event)\"\n (touchstart)=\"onTouchStart($event)\"\n (touchmove)=\"onTouchMove($event)\"\n (touchend)=\"onTouchEnd($event)\"\n (touchcancel)=\"onTouchEnd($event)\">\n <div class=\"thumb\"\n [class.vertical]=\"vertical\"\n [class.horizontal]=\"horizontal\">\n </div>\n</div>\n\n<!-- scrolltrack to move the viewport client downwards (paging) -->\n<div class=\"scrolltrack-end\" (mousedown)=\"onScrollTrackMouseDown($event, 'down')\"></div>\n", styles: ["@charset \"UTF-8\";:host{display:flex;border:2px solid transparent;box-sizing:border-box;--sci-scrollbar-color: rgb(78, 78, 78);--\\275sci-scrollbar-thumb-position-fr: 0;--\\275sci-scrollbar-thumb-size-fr: 0}:host.vertical{flex-direction:column}:host.horizontal{flex-direction:row}:host>div.scrolltrack-start{flex-grow:var(--\\275sci-scrollbar-thumb-position-fr)}:host>div.thumb-handle{flex-basis:20px;display:flex;flex-grow:var(--\\275sci-scrollbar-thumb-size-fr);align-items:center}:host>div.thumb-handle.vertical{flex-direction:column}:host>div.thumb-handle.horizontal{flex-direction:row}:host>div.thumb-handle>div.thumb{flex:auto;border-radius:4px;background-color:var(--sci-scrollbar-color);opacity:.4;transition-duration:125ms;transition-property:width,height;transition-timing-function:ease-out}:host>div.thumb-handle>div.thumb.vertical{width:60%}:host>div.thumb-handle>div.thumb.horizontal{height:60%}:host>div.scrolltrack-end{flex-grow:calc(1 - (var(--\\275sci-scrollbar-thumb-position-fr) + var(--\\275sci-scrollbar-thumb-size-fr)))}:host-context:not(.overflow){display:none}:host-context:hover>div.thumb-handle>div.thumb,:host-context(.scrolling)>div.thumb-handle>div.thumb{background-color:var(--sci-scrollbar-color);opacity:.75}:host-context:hover>div.thumb-handle>div.thumb.vertical,:host-context(.scrolling)>div.thumb-handle>div.thumb.vertical{width:100%}:host-context:hover>div.thumb-handle>div.thumb.horizontal,:host-context(.scrolling)>div.thumb-handle>div.thumb.horizontal{height:100%}\n"] }]
415
415
  }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: undefined, decorators: [{
@@ -510,9 +510,9 @@ class SciScrollableDirective {
510
510
  this._destroy$.next();
511
511
  }
512
512
  }
513
- SciScrollableDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: SciScrollableDirective, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }, { token: SciNativeScrollbarTrackSizeProvider }], target: i0.ɵɵFactoryTarget.Directive });
514
- SciScrollableDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.2.3", type: SciScrollableDirective, selector: "[sciScrollable]", inputs: { isDisplayNativeScrollbar: ["sciScrollableDisplayNativeScrollbar", "isDisplayNativeScrollbar"] }, usesOnChanges: true, ngImport: i0 });
515
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: SciScrollableDirective, decorators: [{
513
+ SciScrollableDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: SciScrollableDirective, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }, { token: SciNativeScrollbarTrackSizeProvider }], target: i0.ɵɵFactoryTarget.Directive });
514
+ SciScrollableDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.1.2", type: SciScrollableDirective, selector: "[sciScrollable]", inputs: { isDisplayNativeScrollbar: ["sciScrollableDisplayNativeScrollbar", "isDisplayNativeScrollbar"] }, usesOnChanges: true, ngImport: i0 });
515
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: SciScrollableDirective, decorators: [{
516
516
  type: Directive,
517
517
  args: [{
518
518
  selector: '[sciScrollable]',
@@ -532,7 +532,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.3", ngImpor
532
532
  * SPDX-License-Identifier: EPL-2.0
533
533
  */
534
534
  /**
535
- * Represents a viewport with the `<ng-content>` used as scrollable content. Content is added to a CSS grid layout.
535
+ * Represents a viewport with slotted content (`<ng-content>`) used as scrollable content. By default, content is added to a CSS grid layout.
536
536
  *
537
537
  * The viewport component displays scrollbars when its content overflows. Scrollbars are displayed on top of the content, not next to it.
538
538
  * The component uses the native scrollbars of the operating system if they are already sitting on top, or falls back and renders scrollbars on top otherwise.
@@ -564,24 +564,24 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.3", ngImpor
564
564
  * For the complete documentation on the flex layout and its features, refer to https://developer.mozilla.org/en-US/docs/Web/CSS/flex.
565
565
  *
566
566
  *
567
- * ## Layouting the viewport content
568
- *
569
- * `NgContent` is added to a CSS grid container with, by default, a single column, filling remaining space vertically and horizontally.
567
+ * ## Layouting the viewport's slotted content
570
568
  *
571
- * You can override the following CSS variables to control the grid:
569
+ * By default, the viewport's content is added to a CSS grid container with a single column, filling remaining space vertically and horizontally.
570
+ * Using the `::part(content)` pseudo element selector, you can configure the grid container or apply a different layout, such as a flex or flow layout.
572
571
  *
573
- * - sci-viewport-content-grid-template-columns: Defines the columns and their track sizes (by default, single column with track size auto)
574
- * - sci-viewport-content-grid-template-rows: Defines the rows and their track sizes (by default, single row with track size auto)
575
- * - sci-viewport-content-grid-auto-columns: Defines the track size of not explicitly declared columns.
576
- * - sci-viewport-content-grid-auto-rows: Defines the track size of not explicitly declared rows.
577
- * - sci-viewport-content-grid-gap: Sets the gaps (gutters) between rows and columns.
578
- *
579
- * Example of how to control the CSS grid:
572
+ * #### Example of adding slotted content to a CSS flex container.
573
+ * ```css
574
+ * sci-viewport::part(content) {
575
+ * display: flex;
576
+ * flex-direction: column;
577
+ * }
578
+ * ```
580
579
  *
580
+ * #### Example of configuring CSS grid container with two columns
581
581
  * ```css
582
- * sci-viewport {
583
- * --sci-viewport-content-grid-auto-rows: min-content;
584
- * --sci-viewport-content-grid-gap: .5em; // specifies the row and column gap
582
+ * sci-viewport::part(content) {
583
+ * grid-template-columns: 1fr 1fr;
584
+ * gap: 1em;
585
585
  * }
586
586
  * ```
587
587
  *
@@ -602,7 +602,6 @@ class SciViewportComponent {
602
602
  this.host = host;
603
603
  this.nativeScrollbarTrackSizeProvider = nativeScrollbarTrackSizeProvider;
604
604
  this._scrollbarStyle = 'on-top';
605
- this.tabindex = -1; // make the viewport programmatically focusable but do not include it in the tab order
606
605
  /**
607
606
  * Emits upon a scroll event.
608
607
  *
@@ -612,7 +611,7 @@ class SciViewportComponent {
612
611
  }
613
612
  /** @internal */
614
613
  set setViewport(viewport) {
615
- this._viewport = coerceElement(viewport);
614
+ this._viewportElement = coerceElement(viewport);
616
615
  }
617
616
  /** @internal */
618
617
  set setViewportClient(viewportClient) {
@@ -629,7 +628,7 @@ class SciViewportComponent {
629
628
  return this._scrollbarStyle;
630
629
  }
631
630
  focus() {
632
- this._viewport && this._viewport.focus();
631
+ this._viewportElement?.focus();
633
632
  }
634
633
  onScroll(event) {
635
634
  this.scroll.emit(event);
@@ -640,7 +639,7 @@ class SciViewportComponent {
640
639
  * @see Element.scrollTop
641
640
  */
642
641
  get scrollTop() {
643
- return this._viewport.scrollTop;
642
+ return this._viewportElement.scrollTop;
644
643
  }
645
644
  /**
646
645
  * Sets the number of pixels that the viewport client is scrolled vertically.
@@ -648,7 +647,7 @@ class SciViewportComponent {
648
647
  * @see Element.scrollTop
649
648
  */
650
649
  set scrollTop(scrollTop) {
651
- this._viewport.scrollTop = scrollTop;
650
+ this._viewportElement.scrollTop = scrollTop;
652
651
  }
653
652
  /**
654
653
  * Returns the number of pixels that the viewport client is scrolled horizontally.
@@ -656,7 +655,7 @@ class SciViewportComponent {
656
655
  * @see Element.scrollLeft
657
656
  */
658
657
  get scrollLeft() {
659
- return this._viewport.scrollLeft;
658
+ return this._viewportElement.scrollLeft;
660
659
  }
661
660
  /**
662
661
  * Sets the number of pixels that the viewport client is scrolled horizontally.
@@ -664,7 +663,7 @@ class SciViewportComponent {
664
663
  * @see Element.scrollLeft
665
664
  */
666
665
  set scrollLeft(scrollLeft) {
667
- this._viewport.scrollLeft = scrollLeft;
666
+ this._viewportElement.scrollLeft = scrollLeft;
668
667
  }
669
668
  /**
670
669
  * Returns the height of the viewport client.
@@ -672,7 +671,7 @@ class SciViewportComponent {
672
671
  * @see Element.scrollHeight
673
672
  */
674
673
  get scrollHeight() {
675
- return this._viewport.scrollHeight;
674
+ return this._viewportElement.scrollHeight;
676
675
  }
677
676
  /**
678
677
  * Returns the width of the viewport client.
@@ -680,13 +679,13 @@ class SciViewportComponent {
680
679
  * @see Element.scrollWidth
681
680
  */
682
681
  get scrollWidth() {
683
- return this._viewport.scrollWidth;
682
+ return this._viewportElement.scrollWidth;
684
683
  }
685
684
  /**
686
685
  * Returns the viewport {HTMLElement}.
687
686
  */
688
687
  get viewportElement() {
689
- return this._viewport;
688
+ return this._viewportElement;
690
689
  }
691
690
  /**
692
691
  * Returns the viewport client {HTMLElement}.
@@ -699,16 +698,18 @@ class SciViewportComponent {
699
698
  *
700
699
  * @param element - the element to be checked
701
700
  * @param fit - control if the element must fully or partially fit into the viewport
701
+ *
702
+ * @throws if the element is not contained in the viewport's slotted content.
702
703
  */
703
704
  isElementInView(element, fit) {
704
705
  const elLeft = this.computeOffset(element, 'left');
705
- const elRight = elLeft + element.offsetWidth;
706
+ const elRight = elLeft + coerceElement(element).offsetWidth;
706
707
  const elTop = this.computeOffset(element, 'top');
707
- const elBottom = elTop + element.offsetHeight;
708
- const vpLeft = this._viewport.scrollLeft;
709
- const vpRight = vpLeft + this._viewport.clientWidth;
710
- const vpTop = this._viewport.scrollTop;
711
- const vpBottom = vpTop + this._viewport.clientHeight;
708
+ const elBottom = elTop + coerceElement(element).offsetHeight;
709
+ const vpLeft = this._viewportElement.scrollLeft;
710
+ const vpRight = vpLeft + this._viewportElement.clientWidth;
711
+ const vpTop = this._viewportElement.scrollTop;
712
+ const vpBottom = vpTop + this._viewportElement.clientHeight;
712
713
  switch (fit) {
713
714
  case 'full':
714
715
  return (elLeft >= vpLeft && elRight <= vpRight) && (elTop >= vpTop && elBottom <= vpBottom);
@@ -723,36 +724,37 @@ class SciViewportComponent {
723
724
  *
724
725
  * @param element - the element to scroll into the viewport
725
726
  * @param offset - the gap between the element and the viewport
727
+ *
728
+ * @throws if the element is not contained in the viewport's slotted content.
726
729
  */
727
730
  scrollIntoView(element, offset = 50) {
728
- this._viewport.scrollTop = this.computeOffset(element, 'top') - offset;
729
- this._viewport.scrollLeft = this.computeOffset(element, 'left') - offset;
731
+ this._viewportElement.scrollTop = this.computeOffset(element, 'top') - offset;
732
+ this._viewportElement.scrollLeft = this.computeOffset(element, 'left') - offset;
730
733
  }
731
734
  /**
732
735
  * Computes the distance of the element to the viewport's left or top border.
736
+ *
737
+ * @throws if the element is not contained in the viewport's slotted content.
733
738
  */
734
739
  computeOffset(element, border) {
735
- if (!isChildOf(element, this._viewport)) {
736
- throw Error('element not a child of the viewport');
737
- }
738
740
  let offset = 0;
739
- let el = element;
741
+ let el = coerceElement(element);
740
742
  do {
741
743
  offset += (border === 'left' ? el.offsetLeft : el.offsetTop);
742
744
  el = el.offsetParent;
743
- } while (el !== null && el !== this._viewport);
745
+ if (el === null) {
746
+ throw Error(`[ElementNotContainedError] Element not contained in the viewport's slotted content`);
747
+ }
748
+ } while (el !== this.host.nativeElement);
744
749
  return offset;
745
750
  }
746
751
  }
747
- SciViewportComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: SciViewportComponent, deps: [{ token: i0.ElementRef }, { token: SciNativeScrollbarTrackSizeProvider }], target: i0.ɵɵFactoryTarget.Component });
748
- SciViewportComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.3", type: SciViewportComponent, selector: "sci-viewport", inputs: { scrollbarStyle: "scrollbarStyle" }, outputs: { scroll: "scroll" }, host: { listeners: { "focus": "focus()" }, properties: { "attr.tabindex": "this.tabindex" } }, viewQueries: [{ propertyName: "setViewport", first: true, predicate: ["viewport"], descendants: true, static: true }, { propertyName: "setViewportClient", first: true, predicate: ["viewport_client"], descendants: true, static: true }], ngImport: i0, template: "<!-- viewport and viewport client -->\n<div #viewport\n class=\"viewport\"\n tabindex=\"-1\"\n sciScrollable [sciScrollableDisplayNativeScrollbar]=\"scrollbarStyle === 'native'\"\n cdkScrollable\n (scroll)=\"onScroll($event)\">\n <div #viewport_client class=\"viewport-client\">\n <ng-content></ng-content>\n </div>\n</div>\n\n<!-- render emulated scrollbars which sit on-top -->\n<ng-container *ngIf=\"scrollbarStyle === 'on-top' && (nativeScrollbarTrackSizeProvider.trackSize$ | async) !== null\">\n <sci-scrollbar [direction]=\"'vscroll'\" [viewport]=\"viewport\"></sci-scrollbar>\n <sci-scrollbar [direction]=\"'hscroll'\" [viewport]=\"viewport\"></sci-scrollbar>\n</ng-container>\n", styles: [":host{--sci-viewport-content-grid-template-columns: auto;--sci-viewport-content-grid-template-rows: unset;--sci-viewport-content-grid-auto-columns: unset;--sci-viewport-content-grid-auto-rows: auto;--sci-viewport-content-grid-gap: 0 0;--sci-viewport-scrollbar-color: rgb(78, 78, 78);display:grid;grid-template-columns:100%;grid-template-rows:100%;position:relative;overflow:hidden;outline:none}:host:not(:hover):not(:active) sci-scrollbar:not(.scrolling){opacity:0}:host>div.viewport{display:grid;position:relative;outline:none;-webkit-overflow-scrolling:touch}:host>div.viewport>div.viewport-client{display:grid;grid-template-columns:var(--sci-viewport-content-grid-template-columns);grid-template-rows:var(--sci-viewport-content-grid-template-rows);grid-auto-rows:var(--sci-viewport-content-grid-auto-rows);grid-auto-columns:var(--sci-viewport-content-grid-auto-columns);grid-gap:var(--sci-viewport-content-grid-gap);gap:var(--sci-viewport-content-grid-gap)}:host>sci-scrollbar{--sci-scrollbar-color: var(--sci-viewport-scrollbar-color);position:absolute;transition-duration:1s;transition-property:opacity;transition-timing-function:ease-out}:host>sci-scrollbar.vertical{top:0;right:0;bottom:0;left:unset;width:12px}:host>sci-scrollbar.horizontal{top:unset;right:0;bottom:0;left:0;height:12px}\n"], components: [{ type: SciScrollbarComponent, selector: "sci-scrollbar", inputs: ["direction", "viewport"] }], directives: [{ type: SciScrollableDirective, selector: "[sciScrollable]", inputs: ["sciScrollableDisplayNativeScrollbar"] }, { type: i4.CdkScrollable, selector: "[cdk-scrollable], [cdkScrollable]" }, { type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], pipes: { "async": i5.AsyncPipe } });
749
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: SciViewportComponent, decorators: [{
752
+ SciViewportComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: SciViewportComponent, deps: [{ token: i0.ElementRef }, { token: SciNativeScrollbarTrackSizeProvider }], target: i0.ɵɵFactoryTarget.Component });
753
+ SciViewportComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.2", type: SciViewportComponent, selector: "sci-viewport", inputs: { scrollbarStyle: "scrollbarStyle" }, outputs: { scroll: "scroll" }, host: { listeners: { "focus": "focus()" } }, viewQueries: [{ propertyName: "setViewport", first: true, predicate: ["viewport"], descendants: true, static: true }, { propertyName: "setViewportClient", first: true, predicate: ["viewport_client"], descendants: true, static: true }], ngImport: i0, template: "<!-- viewport and viewport client -->\n<div #viewport\n class=\"viewport\"\n tabindex=\"-1\"\n sciScrollable [sciScrollableDisplayNativeScrollbar]=\"scrollbarStyle === 'native'\"\n cdkScrollable\n (scroll)=\"onScroll($event)\">\n <div #viewport_client class=\"viewport-client\" part=\"content\">\n <slot></slot>\n </div>\n</div>\n\n<!-- render emulated scrollbars which sit on-top -->\n<ng-container *ngIf=\"scrollbarStyle === 'on-top' && (nativeScrollbarTrackSizeProvider.trackSize$ | async) !== null\">\n <sci-scrollbar [direction]=\"'vscroll'\" [viewport]=\"viewport\"></sci-scrollbar>\n <sci-scrollbar [direction]=\"'hscroll'\" [viewport]=\"viewport\"></sci-scrollbar>\n</ng-container>\n", styles: [":host{--sci-viewport-content-grid-template-columns: auto;--sci-viewport-content-grid-template-rows: unset;--sci-viewport-content-grid-auto-columns: unset;--sci-viewport-content-grid-auto-rows: auto;--sci-viewport-content-grid-gap: 0 0;--sci-viewport-scrollbar-color: rgb(78, 78, 78);display:grid;grid-template-columns:100%;grid-template-rows:100%;position:relative;overflow:hidden;outline:none}:host:not(:hover):not(:active) sci-scrollbar:not(.scrolling){opacity:0}:host>div.viewport{display:grid;position:relative;outline:none;-webkit-overflow-scrolling:touch}:host>div.viewport>div.viewport-client{display:grid;grid-template-columns:var(--sci-viewport-content-grid-template-columns);grid-template-rows:var(--sci-viewport-content-grid-template-rows);grid-auto-rows:var(--sci-viewport-content-grid-auto-rows);grid-auto-columns:var(--sci-viewport-content-grid-auto-columns);gap:var(--sci-viewport-content-grid-gap)}:host>sci-scrollbar{--sci-scrollbar-color: var(--sci-viewport-scrollbar-color);position:absolute;transition-duration:1s;transition-property:opacity;transition-timing-function:ease-out}:host>sci-scrollbar.vertical{top:0;right:0;bottom:0;left:unset;width:12px}:host>sci-scrollbar.horizontal{top:unset;right:0;bottom:0;left:0;height:12px}\n"], dependencies: [{ kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i3.CdkScrollable, selector: "[cdk-scrollable], [cdkScrollable]" }, { kind: "component", type: SciScrollbarComponent, selector: "sci-scrollbar", inputs: ["direction", "viewport"] }, { kind: "directive", type: SciScrollableDirective, selector: "[sciScrollable]", inputs: ["sciScrollableDisplayNativeScrollbar"] }, { kind: "pipe", type: i2.AsyncPipe, name: "async" }], encapsulation: i0.ViewEncapsulation.ShadowDom });
754
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: SciViewportComponent, decorators: [{
750
755
  type: Component,
751
- args: [{ selector: 'sci-viewport', template: "<!-- viewport and viewport client -->\n<div #viewport\n class=\"viewport\"\n tabindex=\"-1\"\n sciScrollable [sciScrollableDisplayNativeScrollbar]=\"scrollbarStyle === 'native'\"\n cdkScrollable\n (scroll)=\"onScroll($event)\">\n <div #viewport_client class=\"viewport-client\">\n <ng-content></ng-content>\n </div>\n</div>\n\n<!-- render emulated scrollbars which sit on-top -->\n<ng-container *ngIf=\"scrollbarStyle === 'on-top' && (nativeScrollbarTrackSizeProvider.trackSize$ | async) !== null\">\n <sci-scrollbar [direction]=\"'vscroll'\" [viewport]=\"viewport\"></sci-scrollbar>\n <sci-scrollbar [direction]=\"'hscroll'\" [viewport]=\"viewport\"></sci-scrollbar>\n</ng-container>\n", styles: [":host{--sci-viewport-content-grid-template-columns: auto;--sci-viewport-content-grid-template-rows: unset;--sci-viewport-content-grid-auto-columns: unset;--sci-viewport-content-grid-auto-rows: auto;--sci-viewport-content-grid-gap: 0 0;--sci-viewport-scrollbar-color: rgb(78, 78, 78);display:grid;grid-template-columns:100%;grid-template-rows:100%;position:relative;overflow:hidden;outline:none}:host:not(:hover):not(:active) sci-scrollbar:not(.scrolling){opacity:0}:host>div.viewport{display:grid;position:relative;outline:none;-webkit-overflow-scrolling:touch}:host>div.viewport>div.viewport-client{display:grid;grid-template-columns:var(--sci-viewport-content-grid-template-columns);grid-template-rows:var(--sci-viewport-content-grid-template-rows);grid-auto-rows:var(--sci-viewport-content-grid-auto-rows);grid-auto-columns:var(--sci-viewport-content-grid-auto-columns);grid-gap:var(--sci-viewport-content-grid-gap);gap:var(--sci-viewport-content-grid-gap)}:host>sci-scrollbar{--sci-scrollbar-color: var(--sci-viewport-scrollbar-color);position:absolute;transition-duration:1s;transition-property:opacity;transition-timing-function:ease-out}:host>sci-scrollbar.vertical{top:0;right:0;bottom:0;left:unset;width:12px}:host>sci-scrollbar.horizontal{top:unset;right:0;bottom:0;left:0;height:12px}\n"] }]
752
- }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: SciNativeScrollbarTrackSizeProvider }]; }, propDecorators: { tabindex: [{
753
- type: HostBinding,
754
- args: ['attr.tabindex']
755
- }], setViewport: [{
756
+ args: [{ selector: 'sci-viewport', encapsulation: ViewEncapsulation.ShadowDom, template: "<!-- viewport and viewport client -->\n<div #viewport\n class=\"viewport\"\n tabindex=\"-1\"\n sciScrollable [sciScrollableDisplayNativeScrollbar]=\"scrollbarStyle === 'native'\"\n cdkScrollable\n (scroll)=\"onScroll($event)\">\n <div #viewport_client class=\"viewport-client\" part=\"content\">\n <slot></slot>\n </div>\n</div>\n\n<!-- render emulated scrollbars which sit on-top -->\n<ng-container *ngIf=\"scrollbarStyle === 'on-top' && (nativeScrollbarTrackSizeProvider.trackSize$ | async) !== null\">\n <sci-scrollbar [direction]=\"'vscroll'\" [viewport]=\"viewport\"></sci-scrollbar>\n <sci-scrollbar [direction]=\"'hscroll'\" [viewport]=\"viewport\"></sci-scrollbar>\n</ng-container>\n", styles: [":host{--sci-viewport-content-grid-template-columns: auto;--sci-viewport-content-grid-template-rows: unset;--sci-viewport-content-grid-auto-columns: unset;--sci-viewport-content-grid-auto-rows: auto;--sci-viewport-content-grid-gap: 0 0;--sci-viewport-scrollbar-color: rgb(78, 78, 78);display:grid;grid-template-columns:100%;grid-template-rows:100%;position:relative;overflow:hidden;outline:none}:host:not(:hover):not(:active) sci-scrollbar:not(.scrolling){opacity:0}:host>div.viewport{display:grid;position:relative;outline:none;-webkit-overflow-scrolling:touch}:host>div.viewport>div.viewport-client{display:grid;grid-template-columns:var(--sci-viewport-content-grid-template-columns);grid-template-rows:var(--sci-viewport-content-grid-template-rows);grid-auto-rows:var(--sci-viewport-content-grid-auto-rows);grid-auto-columns:var(--sci-viewport-content-grid-auto-columns);gap:var(--sci-viewport-content-grid-gap)}:host>sci-scrollbar{--sci-scrollbar-color: var(--sci-viewport-scrollbar-color);position:absolute;transition-duration:1s;transition-property:opacity;transition-timing-function:ease-out}:host>sci-scrollbar.vertical{top:0;right:0;bottom:0;left:unset;width:12px}:host>sci-scrollbar.horizontal{top:unset;right:0;bottom:0;left:0;height:12px}\n"] }]
757
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: SciNativeScrollbarTrackSizeProvider }]; }, propDecorators: { setViewport: [{
756
758
  type: ViewChild,
757
759
  args: ['viewport', { static: true }]
758
760
  }], setViewportClient: [{
@@ -766,18 +768,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.3", ngImpor
766
768
  type: HostListener,
767
769
  args: ['focus']
768
770
  }] } });
769
- /**
770
- * Returns 'true' if the given element is a child element of the parent element.
771
- */
772
- function isChildOf(element, parent) {
773
- while (element.parentElement !== null) {
774
- element = element.parentElement;
775
- if (element === parent) {
776
- return true;
777
- }
778
- }
779
- return false;
780
- }
781
771
 
782
772
  /*
783
773
  * Copyright (c) 2018-2019 Swiss Federal Railways
@@ -793,18 +783,16 @@ function isChildOf(element, parent) {
793
783
  */
794
784
  class SciViewportModule {
795
785
  }
796
- SciViewportModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: SciViewportModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
797
- SciViewportModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: SciViewportModule, declarations: [SciViewportComponent,
786
+ SciViewportModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: SciViewportModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
787
+ SciViewportModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.1.2", ngImport: i0, type: SciViewportModule, declarations: [SciViewportComponent,
798
788
  SciScrollbarComponent,
799
789
  SciScrollableDirective], imports: [CommonModule,
800
790
  ScrollingModule], exports: [SciViewportComponent,
801
791
  SciScrollbarComponent,
802
792
  SciScrollableDirective] });
803
- SciViewportModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: SciViewportModule, imports: [[
804
- CommonModule,
805
- ScrollingModule,
806
- ]] });
807
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: SciViewportModule, decorators: [{
793
+ SciViewportModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: SciViewportModule, imports: [CommonModule,
794
+ ScrollingModule] });
795
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: SciViewportModule, decorators: [{
808
796
  type: NgModule,
809
797
  args: [{
810
798
  imports: [