@bitstack/ng-boundary 14.0.1-alpha.5 → 14.0.1-alpha.6

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,38 +1,20 @@
1
- import { Component, EventEmitter, inject, Input, Output, ViewChild } from '@angular/core';
1
+ import { Component, EventEmitter, inject, Input, Output, } from '@angular/core';
2
2
  import { BreakpointObserver } from '@angular/cdk/layout';
3
3
  import { Subject, takeUntil } from 'rxjs';
4
4
  import * as i0 from "@angular/core";
5
5
  export class BsBoundary {
6
6
  constructor() {
7
- this.isDebug = false;
8
- this.contentClickable = true;
9
- this.orientationMode = 'auto';
10
- this.boundary = null;
7
+ this.isFixedCenter = false;
8
+ this.lockOrientation = 'auto';
11
9
  this.afterBoundaryInit = new EventEmitter();
12
10
  this.orientationChange = new EventEmitter();
13
11
  this.breakpointObserver = inject(BreakpointObserver);
14
12
  this.destroy$ = new Subject();
15
13
  this.isLandscape = false;
16
14
  }
17
- get _boundaryClass() {
18
- return {
19
- backgroundColor: this.bgColor,
20
- ...this.injectStyle?.['drag-boundary']
21
- };
22
- }
23
- get _contentClass() {
24
- return {
25
- ...this.injectStyle?.['content-wrap']
26
- };
27
- }
28
15
  ngOnInit() {
29
16
  this.setupBreakpointObserver();
30
17
  }
31
- ngAfterViewInit() {
32
- if (this.boundary) {
33
- this.afterBoundaryInit.emit(this.boundary);
34
- }
35
- }
36
18
  ngOnDestroy() {
37
19
  this.destroy$.next();
38
20
  this.destroy$.complete();
@@ -41,11 +23,11 @@ export class BsBoundary {
41
23
  * 監控方向變化
42
24
  */
43
25
  setupBreakpointObserver() {
44
- if (this.orientationMode === 'landscape') {
26
+ if (this.lockOrientation === 'landscape') {
45
27
  this.isLandscape = true;
46
28
  return;
47
29
  }
48
- if (this.orientationMode === 'portrait') {
30
+ if (this.lockOrientation === 'portrait') {
49
31
  this.isLandscape = false;
50
32
  return;
51
33
  }
@@ -59,26 +41,19 @@ export class BsBoundary {
59
41
  }
60
42
  }
61
43
  BsBoundary.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: BsBoundary, deps: [], target: i0.ɵɵFactoryTarget.Component });
62
- BsBoundary.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: BsBoundary, isStandalone: true, selector: "bs-boundary", inputs: { isDebug: "isDebug", bgColor: "bgColor", contentClickable: "contentClickable", orientationMode: "orientationMode", injectStyle: "injectStyle" }, outputs: { afterBoundaryInit: "afterBoundaryInit", orientationChange: "orientationChange" }, viewQueries: [{ propertyName: "boundary", first: true, predicate: ["boundary"], descendants: true }], ngImport: i0, template: "<div\n #boundary\n class=\"drag-boundary\"\n [class.enable-debug]=\"isDebug\"\n [class.landscape]=\"isLandscape\"\n [style]=\"_boundaryClass\"\n>\n <div\n class=\"content-wrap\"\n [class.clickable]=\"contentClickable\"\n [style]=\"_contentClass\"\n >\n <ng-content></ng-content>\n </div>\n</div>\n", styles: ["@charset \"UTF-8\";.scale-btn{cursor:pointer;transition:transform .1s}.scale-btn:active{transform:scale(.9)}.drag-boundary{position:fixed;top:50%;left:50%;transform:translate(-50%,-50%);width:100%;height:100%;max-width:var(--boundary-width);max-height:var(--boundary-height);overflow:hidden;aspect-ratio:.5625;z-index:1;pointer-events:none;transform-origin:center;--boundary-width: min(100dvw, 56.25dvh);--boundary-height: min(100dvh, 177.7777777778dvw);--design-base-width: 540;--design-base-height: 960;--px2vw-ratio: calc(var(--boundary-width) / var(--design-base-width))}.drag-boundary.landscape{aspect-ratio:1.7777777778;--boundary-width: min(100dvw, 177.7777777778dvh);--boundary-height: min(100dvh, 56.25dvw);--design-base-width: 960;--design-base-height: 540}.drag-boundary.enable-debug{background-color:#86cee668}.drag-boundary.hidden{visibility:hidden}.content-wrap{width:100%;height:100%}.content-wrap.clickable{pointer-events:all}\n"] });
44
+ BsBoundary.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: BsBoundary, isStandalone: true, selector: "bs-boundary", inputs: { isFixedCenter: "isFixedCenter", lockOrientation: "lockOrientation", forwardStyle: "forwardStyle" }, outputs: { afterBoundaryInit: "afterBoundaryInit", orientationChange: "orientationChange" }, ngImport: i0, template: "<div\n class=\"boundary-wrapper\"\n [class.fixed-center]=\"isFixedCenter\"\n [class.landscape]=\"isLandscape\"\n [style]=\"forwardStyle\"\n>\n <ng-content></ng-content>\n</div>\n", styles: [":host{--landscape-ratio: calc(var(--design-width) / var(--design-height));--portrait-ratio: calc(var(--design-height) / var(--design-width));pointer-events:none}.boundary-wrapper{width:100%;height:100%;max-width:var(--boundary-width);max-height:var(--boundary-height);overflow:hidden;pointer-events:auto}.boundary-wrapper{--boundary-width: min(var(--vw100), var(--boundary-max-width));--boundary-height: min(var(--vh100), var(--boundary-max-height));--px2vw-ratio: calc(var(--boundary-width) / var(--design-base-width));--boundary-max-width: calc(var(--vh100) * var(--landscape-ratio));--boundary-max-height: calc(var(--vw100) * var(--portrait-ratio));--design-base-width: var(--design-width);--design-base-height: var(--design-height)}.boundary-wrapper.landscape{--boundary-max-width: calc(var(--vh100) * var(--portrait-ratio));--boundary-max-height: calc(var(--vw100) * var(--landscape-ratio));--design-base-width: var(--design-height);--design-base-height: var(--design-width)}.fixed-center{position:fixed;top:50%;left:50%;transform:translate(-50%,-50%);z-index:99}\n"] });
63
45
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: BsBoundary, decorators: [{
64
46
  type: Component,
65
- args: [{ selector: 'bs-boundary', standalone: true, template: "<div\n #boundary\n class=\"drag-boundary\"\n [class.enable-debug]=\"isDebug\"\n [class.landscape]=\"isLandscape\"\n [style]=\"_boundaryClass\"\n>\n <div\n class=\"content-wrap\"\n [class.clickable]=\"contentClickable\"\n [style]=\"_contentClass\"\n >\n <ng-content></ng-content>\n </div>\n</div>\n", styles: ["@charset \"UTF-8\";.scale-btn{cursor:pointer;transition:transform .1s}.scale-btn:active{transform:scale(.9)}.drag-boundary{position:fixed;top:50%;left:50%;transform:translate(-50%,-50%);width:100%;height:100%;max-width:var(--boundary-width);max-height:var(--boundary-height);overflow:hidden;aspect-ratio:.5625;z-index:1;pointer-events:none;transform-origin:center;--boundary-width: min(100dvw, 56.25dvh);--boundary-height: min(100dvh, 177.7777777778dvw);--design-base-width: 540;--design-base-height: 960;--px2vw-ratio: calc(var(--boundary-width) / var(--design-base-width))}.drag-boundary.landscape{aspect-ratio:1.7777777778;--boundary-width: min(100dvw, 177.7777777778dvh);--boundary-height: min(100dvh, 56.25dvw);--design-base-width: 960;--design-base-height: 540}.drag-boundary.enable-debug{background-color:#86cee668}.drag-boundary.hidden{visibility:hidden}.content-wrap{width:100%;height:100%}.content-wrap.clickable{pointer-events:all}\n"] }]
66
- }], propDecorators: { isDebug: [{
67
- type: Input
68
- }], bgColor: [{
69
- type: Input
70
- }], contentClickable: [{
47
+ args: [{ selector: 'bs-boundary', standalone: true, template: "<div\n class=\"boundary-wrapper\"\n [class.fixed-center]=\"isFixedCenter\"\n [class.landscape]=\"isLandscape\"\n [style]=\"forwardStyle\"\n>\n <ng-content></ng-content>\n</div>\n", styles: [":host{--landscape-ratio: calc(var(--design-width) / var(--design-height));--portrait-ratio: calc(var(--design-height) / var(--design-width));pointer-events:none}.boundary-wrapper{width:100%;height:100%;max-width:var(--boundary-width);max-height:var(--boundary-height);overflow:hidden;pointer-events:auto}.boundary-wrapper{--boundary-width: min(var(--vw100), var(--boundary-max-width));--boundary-height: min(var(--vh100), var(--boundary-max-height));--px2vw-ratio: calc(var(--boundary-width) / var(--design-base-width));--boundary-max-width: calc(var(--vh100) * var(--landscape-ratio));--boundary-max-height: calc(var(--vw100) * var(--portrait-ratio));--design-base-width: var(--design-width);--design-base-height: var(--design-height)}.boundary-wrapper.landscape{--boundary-max-width: calc(var(--vh100) * var(--portrait-ratio));--boundary-max-height: calc(var(--vw100) * var(--landscape-ratio));--design-base-width: var(--design-height);--design-base-height: var(--design-width)}.fixed-center{position:fixed;top:50%;left:50%;transform:translate(-50%,-50%);z-index:99}\n"] }]
48
+ }], propDecorators: { isFixedCenter: [{
71
49
  type: Input
72
- }], orientationMode: [{
50
+ }], lockOrientation: [{
73
51
  type: Input
74
- }], injectStyle: [{
52
+ }], forwardStyle: [{
75
53
  type: Input
76
- }], boundary: [{
77
- type: ViewChild,
78
- args: ['boundary']
79
54
  }], afterBoundaryInit: [{
80
55
  type: Output
81
56
  }], orientationChange: [{
82
57
  type: Output
83
58
  }] } });
84
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYnMtYm91bmRhcnkuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9wcm9qZWN0cy9iaXRzdGFjay1uZy1ib3VuZGFyeS9zcmMvbGliL2JzLWJvdW5kYXJ5LnRzIiwiLi4vLi4vLi4vLi4vcHJvamVjdHMvYml0c3RhY2stbmctYm91bmRhcnkvc3JjL2xpYi90ZW1wbGF0ZS5odG1sIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFFSCxTQUFTLEVBRVQsWUFBWSxFQUNaLE1BQU0sRUFDTixLQUFLLEVBRUwsTUFBTSxFQUNOLFNBQVMsRUFDWixNQUFNLGVBQWUsQ0FBQztBQUV2QixPQUFPLEVBQUMsa0JBQWtCLEVBQUMsTUFBTSxxQkFBcUIsQ0FBQztBQUN2RCxPQUFPLEVBQUMsT0FBTyxFQUFFLFNBQVMsRUFBQyxNQUFNLE1BQU0sQ0FBQzs7QUFReEMsTUFBTSxPQUFPLFVBQVU7SUFOdkI7UUFPYSxZQUFPLEdBQUcsS0FBSyxDQUFDO1FBRWhCLHFCQUFnQixHQUFHLElBQUksQ0FBQztRQUN4QixvQkFBZSxHQUFzQixNQUFNLENBQUM7UUFFOUIsYUFBUSxHQUFzQyxJQUFJLENBQUM7UUFFaEUsc0JBQWlCLEdBQ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hbmRzY2FwZSknKVxuICAgICAgICAgICAgLnBpcGUodGFrZVVudGlsKHRoaXMuZGVzdHJveSQpKVxuICAgICAgICAgICAgLnN1YnNjcmliZShyZXN1bHQgPT4ge1xuICAgICAgICAgICAgICAgIHRoaXMub3JpZW50YXRpb25DaGFuZ2UuZW1pdChyZXN1bHQubWF0Y2hlcyA/ICdsYW5kc2NhcGUnIDogJ3BvcnRyYWl0Jyk7XG4gICAgICAgICAgICAgICAgdGhpcy5pc0xhbmRzY2FwZSA9IHJlc3VsdC5tYXRjaGVzO1xuICAgICAgICAgICAgfSk7XG4gICAgfVxufVxuIiwiPGRpdlxuICBjbGFzcz1cImJvdW5kYXJ5LXdyYXBwZXJcIlxuICBbY2xhc3MuZml4ZWQtY2VudGVyXT1cImlzRml4ZWRDZW50ZXJcIlxuICBbY2xhc3MubGFuZHNjYXBlXT1cImlzTGFuZHNjYXBlXCJcbiAgW3N0eWxlXT1cImZvcndhcmRTdHlsZVwiXG4+XG4gICA8bmctY29udGVudD48L25nLWNvbnRlbnQ+XG48L2Rpdj5cbiJdfQ==
@@ -1,2 +1,2 @@
1
1
  export {};
2
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibW9kZWwuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9wcm9qZWN0cy9iaXRzdGFjay1uZy1ib3VuZGFyeS9zcmMvbGliL21vZGVsLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiIiLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgaW50ZXJmYWNlIElJbmplY3RTdHlsZSB7XG4gICAgJ2RyYWctYm91bmRhcnknPzogUmVjb3JkPHN0cmluZywgc3RyaW5nPjtcbiAgICAnY29udGVudC13cmFwJz86IFJlY29yZDxzdHJpbmcsIHN0cmluZz47XG59XG5leHBvcnQgdHlwZSBUT3JpZW50YXRpb25Nb2RlID0gJ2F1dG8nIHwgJ3BvcnRyYWl0JyB8ICdsYW5kc2NhcGUnO1xuIl19
2
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibW9kZWwuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9wcm9qZWN0cy9iaXRzdGFjay1uZy1ib3VuZGFyeS9zcmMvbGliL21vZGVsLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiIiLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgdHlwZSBUT3JpZW50YXRpb25Nb2RlID0gJ2F1dG8nIHwgJ3BvcnRyYWl0JyB8ICdsYW5kc2NhcGUnO1xuIl19
@@ -1,36 +1,21 @@
1
1
  import * as i0 from '@angular/core';
2
- import { EventEmitter, inject, Component, Input, ViewChild, Output } from '@angular/core';
2
+ import { EventEmitter, inject, Component, Input, Output } from '@angular/core';
3
3
  import { BreakpointObserver } from '@angular/cdk/layout';
4
4
  import { Subject, takeUntil } from 'rxjs';
5
5
 
6
6
  class BsBoundary {
7
7
  constructor() {
8
- this.isDebug = false;
9
- this.contentClickable = true;
10
- this.orientationMode = 'auto';
11
- this.boundary = null;
8
+ this.isFixedCenter = false;
9
+ this.lockOrientation = 'auto';
12
10
  this.afterBoundaryInit = new EventEmitter();
13
11
  this.orientationChange = new EventEmitter();
14
12
  this.breakpointObserver = inject(BreakpointObserver);
15
13
  this.destroy$ = new Subject();
16
14
  this.isLandscape = false;
17
15
  }
18
- get _boundaryClass() {
19
- var _a;
20
- return Object.assign({ backgroundColor: this.bgColor }, (_a = this.injectStyle) === null || _a === void 0 ? void 0 : _a['drag-boundary']);
21
- }
22
- get _contentClass() {
23
- var _a;
24
- return Object.assign({}, (_a = this.injectStyle) === null || _a === void 0 ? void 0 : _a['content-wrap']);
25
- }
26
16
  ngOnInit() {
27
17
  this.setupBreakpointObserver();
28
18
  }
29
- ngAfterViewInit() {
30
- if (this.boundary) {
31
- this.afterBoundaryInit.emit(this.boundary);
32
- }
33
- }
34
19
  ngOnDestroy() {
35
20
  this.destroy$.next();
36
21
  this.destroy$.complete();
@@ -39,11 +24,11 @@ class BsBoundary {
39
24
  * 監控方向變化
40
25
  */
41
26
  setupBreakpointObserver() {
42
- if (this.orientationMode === 'landscape') {
27
+ if (this.lockOrientation === 'landscape') {
43
28
  this.isLandscape = true;
44
29
  return;
45
30
  }
46
- if (this.orientationMode === 'portrait') {
31
+ if (this.lockOrientation === 'portrait') {
47
32
  this.isLandscape = false;
48
33
  return;
49
34
  }
@@ -57,23 +42,16 @@ class BsBoundary {
57
42
  }
58
43
  }
59
44
  BsBoundary.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: BsBoundary, deps: [], target: i0.ɵɵFactoryTarget.Component });
60
- BsBoundary.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: BsBoundary, isStandalone: true, selector: "bs-boundary", inputs: { isDebug: "isDebug", bgColor: "bgColor", contentClickable: "contentClickable", orientationMode: "orientationMode", injectStyle: "injectStyle" }, outputs: { afterBoundaryInit: "afterBoundaryInit", orientationChange: "orientationChange" }, viewQueries: [{ propertyName: "boundary", first: true, predicate: ["boundary"], descendants: true }], ngImport: i0, template: "<div\n #boundary\n class=\"drag-boundary\"\n [class.enable-debug]=\"isDebug\"\n [class.landscape]=\"isLandscape\"\n [style]=\"_boundaryClass\"\n>\n <div\n class=\"content-wrap\"\n [class.clickable]=\"contentClickable\"\n [style]=\"_contentClass\"\n >\n <ng-content></ng-content>\n </div>\n</div>\n", styles: ["@charset \"UTF-8\";.scale-btn{cursor:pointer;transition:transform .1s}.scale-btn:active{transform:scale(.9)}.drag-boundary{position:fixed;top:50%;left:50%;transform:translate(-50%,-50%);width:100%;height:100%;max-width:var(--boundary-width);max-height:var(--boundary-height);overflow:hidden;aspect-ratio:.5625;z-index:1;pointer-events:none;transform-origin:center;--boundary-width: min(100dvw, 56.25dvh);--boundary-height: min(100dvh, 177.7777777778dvw);--design-base-width: 540;--design-base-height: 960;--px2vw-ratio: calc(var(--boundary-width) / var(--design-base-width))}.drag-boundary.landscape{aspect-ratio:1.7777777778;--boundary-width: min(100dvw, 177.7777777778dvh);--boundary-height: min(100dvh, 56.25dvw);--design-base-width: 960;--design-base-height: 540}.drag-boundary.enable-debug{background-color:#86cee668}.drag-boundary.hidden{visibility:hidden}.content-wrap{width:100%;height:100%}.content-wrap.clickable{pointer-events:all}\n"] });
45
+ BsBoundary.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: BsBoundary, isStandalone: true, selector: "bs-boundary", inputs: { isFixedCenter: "isFixedCenter", lockOrientation: "lockOrientation", forwardStyle: "forwardStyle" }, outputs: { afterBoundaryInit: "afterBoundaryInit", orientationChange: "orientationChange" }, ngImport: i0, template: "<div\n class=\"boundary-wrapper\"\n [class.fixed-center]=\"isFixedCenter\"\n [class.landscape]=\"isLandscape\"\n [style]=\"forwardStyle\"\n>\n <ng-content></ng-content>\n</div>\n", styles: [":host{--landscape-ratio: calc(var(--design-width) / var(--design-height));--portrait-ratio: calc(var(--design-height) / var(--design-width));pointer-events:none}.boundary-wrapper{width:100%;height:100%;max-width:var(--boundary-width);max-height:var(--boundary-height);overflow:hidden;pointer-events:auto}.boundary-wrapper{--boundary-width: min(var(--vw100), var(--boundary-max-width));--boundary-height: min(var(--vh100), var(--boundary-max-height));--px2vw-ratio: calc(var(--boundary-width) / var(--design-base-width));--boundary-max-width: calc(var(--vh100) * var(--landscape-ratio));--boundary-max-height: calc(var(--vw100) * var(--portrait-ratio));--design-base-width: var(--design-width);--design-base-height: var(--design-height)}.boundary-wrapper.landscape{--boundary-max-width: calc(var(--vh100) * var(--portrait-ratio));--boundary-max-height: calc(var(--vw100) * var(--landscape-ratio));--design-base-width: var(--design-height);--design-base-height: var(--design-width)}.fixed-center{position:fixed;top:50%;left:50%;transform:translate(-50%,-50%);z-index:99}\n"] });
61
46
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: BsBoundary, decorators: [{
62
47
  type: Component,
63
- args: [{ selector: 'bs-boundary', standalone: true, template: "<div\n #boundary\n class=\"drag-boundary\"\n [class.enable-debug]=\"isDebug\"\n [class.landscape]=\"isLandscape\"\n [style]=\"_boundaryClass\"\n>\n <div\n class=\"content-wrap\"\n [class.clickable]=\"contentClickable\"\n [style]=\"_contentClass\"\n >\n <ng-content></ng-content>\n </div>\n</div>\n", styles: ["@charset \"UTF-8\";.scale-btn{cursor:pointer;transition:transform .1s}.scale-btn:active{transform:scale(.9)}.drag-boundary{position:fixed;top:50%;left:50%;transform:translate(-50%,-50%);width:100%;height:100%;max-width:var(--boundary-width);max-height:var(--boundary-height);overflow:hidden;aspect-ratio:.5625;z-index:1;pointer-events:none;transform-origin:center;--boundary-width: min(100dvw, 56.25dvh);--boundary-height: min(100dvh, 177.7777777778dvw);--design-base-width: 540;--design-base-height: 960;--px2vw-ratio: calc(var(--boundary-width) / var(--design-base-width))}.drag-boundary.landscape{aspect-ratio:1.7777777778;--boundary-width: min(100dvw, 177.7777777778dvh);--boundary-height: min(100dvh, 56.25dvw);--design-base-width: 960;--design-base-height: 540}.drag-boundary.enable-debug{background-color:#86cee668}.drag-boundary.hidden{visibility:hidden}.content-wrap{width:100%;height:100%}.content-wrap.clickable{pointer-events:all}\n"] }]
64
- }], propDecorators: { isDebug: [{
65
- type: Input
66
- }], bgColor: [{
67
- type: Input
68
- }], contentClickable: [{
48
+ args: [{ selector: 'bs-boundary', standalone: true, template: "<div\n class=\"boundary-wrapper\"\n [class.fixed-center]=\"isFixedCenter\"\n [class.landscape]=\"isLandscape\"\n [style]=\"forwardStyle\"\n>\n <ng-content></ng-content>\n</div>\n", styles: [":host{--landscape-ratio: calc(var(--design-width) / var(--design-height));--portrait-ratio: calc(var(--design-height) / var(--design-width));pointer-events:none}.boundary-wrapper{width:100%;height:100%;max-width:var(--boundary-width);max-height:var(--boundary-height);overflow:hidden;pointer-events:auto}.boundary-wrapper{--boundary-width: min(var(--vw100), var(--boundary-max-width));--boundary-height: min(var(--vh100), var(--boundary-max-height));--px2vw-ratio: calc(var(--boundary-width) / var(--design-base-width));--boundary-max-width: calc(var(--vh100) * var(--landscape-ratio));--boundary-max-height: calc(var(--vw100) * var(--portrait-ratio));--design-base-width: var(--design-width);--design-base-height: var(--design-height)}.boundary-wrapper.landscape{--boundary-max-width: calc(var(--vh100) * var(--portrait-ratio));--boundary-max-height: calc(var(--vw100) * var(--landscape-ratio));--design-base-width: var(--design-height);--design-base-height: var(--design-width)}.fixed-center{position:fixed;top:50%;left:50%;transform:translate(-50%,-50%);z-index:99}\n"] }]
49
+ }], propDecorators: { isFixedCenter: [{
69
50
  type: Input
70
- }], orientationMode: [{
51
+ }], lockOrientation: [{
71
52
  type: Input
72
- }], injectStyle: [{
53
+ }], forwardStyle: [{
73
54
  type: Input
74
- }], boundary: [{
75
- type: ViewChild,
76
- args: ['boundary']
77
55
  }], afterBoundaryInit: [{
78
56
  type: Output
79
57
  }], orientationChange: [{
@@ -1 +1 @@
1
- {"version":3,"file":"bitstack-ng-boundary.mjs","sources":["../../../projects/bitstack-ng-boundary/src/lib/bs-boundary.ts","../../../projects/bitstack-ng-boundary/src/lib/template.html","../../../projects/bitstack-ng-boundary/src/public-api.ts","../../../projects/bitstack-ng-boundary/src/bitstack-ng-boundary.ts"],"sourcesContent":["import {\n AfterViewInit,\n Component,\n ElementRef,\n EventEmitter,\n inject,\n Input, OnDestroy,\n OnInit,\n Output,\n ViewChild\n} from '@angular/core';\nimport {TOrientationMode, IInjectStyle} from './model';\nimport {BreakpointObserver} from '@angular/cdk/layout';\nimport {Subject, takeUntil} from 'rxjs';\n\n@Component({\n selector: 'bs-boundary',\n templateUrl: 'template.html',\n standalone: true,\n styleUrls: ['./styles.scss'],\n})\nexport class BsBoundary implements OnInit, AfterViewInit, OnDestroy {\n @Input() isDebug = false;\n @Input() bgColor!: string;\n @Input() contentClickable = true;\n @Input() orientationMode?: TOrientationMode = 'auto';\n @Input() injectStyle?: IInjectStyle;\n @ViewChild('boundary') boundary: ElementRef<HTMLDivElement> | null = null;\n\n @Output() afterBoundaryInit = new EventEmitter<ElementRef<HTMLDivElement>>();\n @Output() orientationChange = new EventEmitter<TOrientationMode>();\n\n private breakpointObserver = inject(BreakpointObserver);\n private destroy$ = new Subject<void>();\n\n isLandscape = false;\n\n get _boundaryClass() {\n return {\n backgroundColor: this.bgColor,\n ...this.injectStyle?.['drag-boundary']\n };\n }\n\n get _contentClass() {\n return {\n ...this.injectStyle?.['content-wrap']\n };\n }\n\n ngOnInit(): void {\n this.setupBreakpointObserver();\n }\n\n ngAfterViewInit(): void {\n if (this.boundary) {\n this.afterBoundaryInit.emit(this.boundary);\n }\n }\n\n ngOnDestroy(): void {\n this.destroy$.next();\n this.destroy$.complete();\n }\n\n /**\n * 監控方向變化\n */\n setupBreakpointObserver() {\n if (this.orientationMode === 'landscape') {\n this.isLandscape = true;\n return;\n }\n\n if (this.orientationMode === 'portrait') {\n this.isLandscape = false;\n return;\n }\n\n this.breakpointObserver\n .observe('(orientation: landscape)')\n .pipe(takeUntil(this.destroy$))\n .subscribe(result => {\n this.orientationChange.emit(result.matches ? 'landscape' : 'portrait');\n this.isLandscape = result.matches;\n });\n }\n}\n","<div\n #boundary\n class=\"drag-boundary\"\n [class.enable-debug]=\"isDebug\"\n [class.landscape]=\"isLandscape\"\n [style]=\"_boundaryClass\"\n>\n <div\n class=\"content-wrap\"\n [class.clickable]=\"contentClickable\"\n [style]=\"_contentClass\"\n >\n <ng-content></ng-content>\n </div>\n</div>\n","/*\n * Public API Surface of @bitstack/ng-boundary\n */\n\nexport * from './lib/bs-boundary';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;MAqBa,UAAU,CAAA;AANvB,IAAA,WAAA,GAAA;AAOa,QAAA,IAAO,CAAA,OAAA,GAAG,KAAK,CAAC;A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BACG,OAAO,EAAA,CAAA;sBAAf,KAAK;gBACG,gBAAgB,EAAA,CAAA;sBAAxB,KAAK;gBACG,eAAe,EAAA,CAAA;sBAAvB,KAAK;gBACG,WAAW,EAAA,CAAA;sBAAnB,KAAK;gBACiB,QAAQ,EAAA,CAAA;sBAA9B,SAAS;uBAAC,UAAU,CAAA;gBAEX,iBAAiB,EAAA,CAAA;sBAA1B,MAAM;gBACG,iBAAiB,EAAA,CAAA;sBAA1B,MAAM;;;AE9BX;;AAEG;;ACFH;;AAEG;;;;"}
1
+ {"version":3,"file":"bitstack-ng-boundary.mjs","sources":["../../../projects/bitstack-ng-boundary/src/lib/bs-boundary.ts","../../../projects/bitstack-ng-boundary/src/lib/template.html","../../../projects/bitstack-ng-boundary/src/public-api.ts","../../../projects/bitstack-ng-boundary/src/bitstack-ng-boundary.ts"],"sourcesContent":["import {\n Component,\n ElementRef,\n EventEmitter,\n inject,\n Input, OnDestroy,\n OnInit,\n Output,\n} from '@angular/core';\nimport {TOrientationMode} from './model';\nimport {BreakpointObserver} from '@angular/cdk/layout';\nimport {Subject, takeUntil} from 'rxjs';\n\n@Component({\n selector: 'bs-boundary',\n templateUrl: 'template.html',\n standalone: true,\n styleUrls: ['./styles.scss'],\n})\nexport class BsBoundary implements OnInit, OnDestroy {\n\n @Input() isFixedCenter?: boolean = false;\n @Input() lockOrientation?: TOrientationMode = 'auto';\n @Input() forwardStyle?: Record<string, string>;\n\n @Output() afterBoundaryInit = new EventEmitter<ElementRef<HTMLDivElement>>();\n @Output() orientationChange = new EventEmitter<TOrientationMode>();\n\n private breakpointObserver = inject(BreakpointObserver);\n private destroy$ = new Subject<void>();\n\n isLandscape = false;\n\n ngOnInit(): void {\n this.setupBreakpointObserver();\n }\n\n ngOnDestroy(): void {\n this.destroy$.next();\n this.destroy$.complete();\n }\n\n /**\n * 監控方向變化\n */\n setupBreakpointObserver() {\n if (this.lockOrientation === 'landscape') {\n this.isLandscape = true;\n return;\n }\n\n if (this.lockOrientation === 'portrait') {\n this.isLandscape = false;\n return;\n }\n\n this.breakpointObserver\n .observe('(orientation: landscape)')\n .pipe(takeUntil(this.destroy$))\n .subscribe(result => {\n this.orientationChange.emit(result.matches ? 'landscape' : 'portrait');\n this.isLandscape = result.matches;\n });\n }\n}\n","<div\n class=\"boundary-wrapper\"\n [class.fixed-center]=\"isFixedCenter\"\n [class.landscape]=\"isLandscape\"\n [style]=\"forwardStyle\"\n>\n <ng-content></ng-content>\n</div>\n","/*\n * Public API Surface of @bitstack/ng-boundary\n */\n\nexport * from './lib/bs-boundary';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;MAmBa,UAAU,CAAA;AANvB,IAAA,WAAA,GAAA;AAQa,QAAA,IAAa,CAAA,aAAA,GAAa,KAAK,CAAC;AAChC,QAAA,IAAe,CAAA,eAAA,GAAsB,MAAM,CAAC;AAG3C,QAAA,IAAA,CAAA,iBAAiB,GAAG,IAAI,YAAY,EAA8B,CAAC;AACnE,QAAA,IAAA,CAAA,iBAAiB,GAAG,IAAI,YAAY,EAAoB,CAAC;AAE3D,QAAA,IAAA,CAAA,kBAAkB,GAAG,MAAM,CAAC,kBAAkB,CAAC,CAAC;AAChD,QAAA,IAAA,CAAA,QAAQ,GAAG,IAAI,OAAO,EAAQ,CAAC;AAEvC,QAAA,IAAW,CAAA,WAAA,GAAG,KAAK,CAAC;KAiCvB;IA/BG,QAAQ,GAAA;QACJ,IAAI,CAAC,uBAAuB,EAAE,CAAC;KAClC;IAED,WAAW,GAAA;AACP,QAAA,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;AACrB,QAAA,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,CAAC;KAC5B;AAED;;AAEG;IACH,uBAAuB,GAAA;AACnB,QAAA,IAAI,IAAI,CAAC,eAAe,KAAK,WAAW,EAAE;AACtC,YAAA,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;YACxB,OAAO;AACV,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@
1
1
  import * as i0 from '@angular/core';
2
- import { EventEmitter, inject, Component, Input, ViewChild, Output } from '@angular/core';
2
+ import { EventEmitter, inject, Component, Input, Output } from '@angular/core';
3
3
  import { BreakpointObserver } from '@angular/cdk/layout';
4
4
  import { Subject, takeUntil } from 'rxjs';
5
5
 
6
6
  class BsBoundary {
7
7
  constructor() {
8
- this.isDebug = false;
9
- this.contentClickable = true;
10
- this.orientationMode = 'auto';
11
- this.boundary = null;
8
+ this.isFixedCenter = false;
9
+ this.lockOrientation = 'auto';
12
10
  this.afterBoundaryInit = new EventEmitter();
13
11
  this.orientationChange = new EventEmitter();
14
12
  this.breakpointObserver = inject(BreakpointObserver);
15
13
  this.destroy$ = new Subject();
16
14
  this.isLandscape = false;
17
15
  }
18
- get _boundaryClass() {
19
- return {
20
- backgroundColor: this.bgColor,
21
- ...this.injectStyle?.['drag-boundary']
22
- };
23
- }
24
- get _contentClass() {
25
- return {
26
- ...this.injectStyle?.['content-wrap']
27
- };
28
- }
29
16
  ngOnInit() {
30
17
  this.setupBreakpointObserver();
31
18
  }
32
- ngAfterViewInit() {
33
- if (this.boundary) {
34
- this.afterBoundaryInit.emit(this.boundary);
35
- }
36
- }
37
19
  ngOnDestroy() {
38
20
  this.destroy$.next();
39
21
  this.destroy$.complete();
@@ -42,11 +24,11 @@ class BsBoundary {
42
24
  * 監控方向變化
43
25
  */
44
26
  setupBreakpointObserver() {
45
- if (this.orientationMode === 'landscape') {
27
+ if (this.lockOrientation === 'landscape') {
46
28
  this.isLandscape = true;
47
29
  return;
48
30
  }
49
- if (this.orientationMode === 'portrait') {
31
+ if (this.lockOrientation === 'portrait') {
50
32
  this.isLandscape = false;
51
33
  return;
52
34
  }
@@ -60,23 +42,16 @@ class BsBoundary {
60
42
  }
61
43
  }
62
44
  BsBoundary.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: BsBoundary, deps: [], target: i0.ɵɵFactoryTarget.Component });
63
- BsBoundary.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: BsBoundary, isStandalone: true, selector: "bs-boundary", inputs: { isDebug: "isDebug", bgColor: "bgColor", contentClickable: "contentClickable", orientationMode: "orientationMode", injectStyle: "injectStyle" }, outputs: { afterBoundaryInit: "afterBoundaryInit", orientationChange: "orientationChange" }, viewQueries: [{ propertyName: "boundary", first: true, predicate: ["boundary"], descendants: true }], ngImport: i0, template: "<div\n #boundary\n class=\"drag-boundary\"\n [class.enable-debug]=\"isDebug\"\n [class.landscape]=\"isLandscape\"\n [style]=\"_boundaryClass\"\n>\n <div\n class=\"content-wrap\"\n [class.clickable]=\"contentClickable\"\n [style]=\"_contentClass\"\n >\n <ng-content></ng-content>\n </div>\n</div>\n", styles: ["@charset \"UTF-8\";.scale-btn{cursor:pointer;transition:transform .1s}.scale-btn:active{transform:scale(.9)}.drag-boundary{position:fixed;top:50%;left:50%;transform:translate(-50%,-50%);width:100%;height:100%;max-width:var(--boundary-width);max-height:var(--boundary-height);overflow:hidden;aspect-ratio:.5625;z-index:1;pointer-events:none;transform-origin:center;--boundary-width: min(100dvw, 56.25dvh);--boundary-height: min(100dvh, 177.7777777778dvw);--design-base-width: 540;--design-base-height: 960;--px2vw-ratio: calc(var(--boundary-width) / var(--design-base-width))}.drag-boundary.landscape{aspect-ratio:1.7777777778;--boundary-width: min(100dvw, 177.7777777778dvh);--boundary-height: min(100dvh, 56.25dvw);--design-base-width: 960;--design-base-height: 540}.drag-boundary.enable-debug{background-color:#86cee668}.drag-boundary.hidden{visibility:hidden}.content-wrap{width:100%;height:100%}.content-wrap.clickable{pointer-events:all}\n"] });
45
+ BsBoundary.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: BsBoundary, isStandalone: true, selector: "bs-boundary", inputs: { isFixedCenter: "isFixedCenter", lockOrientation: "lockOrientation", forwardStyle: "forwardStyle" }, outputs: { afterBoundaryInit: "afterBoundaryInit", orientationChange: "orientationChange" }, ngImport: i0, template: "<div\n class=\"boundary-wrapper\"\n [class.fixed-center]=\"isFixedCenter\"\n [class.landscape]=\"isLandscape\"\n [style]=\"forwardStyle\"\n>\n <ng-content></ng-content>\n</div>\n", styles: [":host{--landscape-ratio: calc(var(--design-width) / var(--design-height));--portrait-ratio: calc(var(--design-height) / var(--design-width));pointer-events:none}.boundary-wrapper{width:100%;height:100%;max-width:var(--boundary-width);max-height:var(--boundary-height);overflow:hidden;pointer-events:auto}.boundary-wrapper{--boundary-width: min(var(--vw100), var(--boundary-max-width));--boundary-height: min(var(--vh100), var(--boundary-max-height));--px2vw-ratio: calc(var(--boundary-width) / var(--design-base-width));--boundary-max-width: calc(var(--vh100) * var(--landscape-ratio));--boundary-max-height: calc(var(--vw100) * var(--portrait-ratio));--design-base-width: var(--design-width);--design-base-height: var(--design-height)}.boundary-wrapper.landscape{--boundary-max-width: calc(var(--vh100) * var(--portrait-ratio));--boundary-max-height: calc(var(--vw100) * var(--landscape-ratio));--design-base-width: var(--design-height);--design-base-height: var(--design-width)}.fixed-center{position:fixed;top:50%;left:50%;transform:translate(-50%,-50%);z-index:99}\n"] });
64
46
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: BsBoundary, decorators: [{
65
47
  type: Component,
66
- args: [{ selector: 'bs-boundary', standalone: true, template: "<div\n #boundary\n class=\"drag-boundary\"\n [class.enable-debug]=\"isDebug\"\n [class.landscape]=\"isLandscape\"\n [style]=\"_boundaryClass\"\n>\n <div\n class=\"content-wrap\"\n [class.clickable]=\"contentClickable\"\n [style]=\"_contentClass\"\n >\n <ng-content></ng-content>\n </div>\n</div>\n", styles: ["@charset \"UTF-8\";.scale-btn{cursor:pointer;transition:transform .1s}.scale-btn:active{transform:scale(.9)}.drag-boundary{position:fixed;top:50%;left:50%;transform:translate(-50%,-50%);width:100%;height:100%;max-width:var(--boundary-width);max-height:var(--boundary-height);overflow:hidden;aspect-ratio:.5625;z-index:1;pointer-events:none;transform-origin:center;--boundary-width: min(100dvw, 56.25dvh);--boundary-height: min(100dvh, 177.7777777778dvw);--design-base-width: 540;--design-base-height: 960;--px2vw-ratio: calc(var(--boundary-width) / var(--design-base-width))}.drag-boundary.landscape{aspect-ratio:1.7777777778;--boundary-width: min(100dvw, 177.7777777778dvh);--boundary-height: min(100dvh, 56.25dvw);--design-base-width: 960;--design-base-height: 540}.drag-boundary.enable-debug{background-color:#86cee668}.drag-boundary.hidden{visibility:hidden}.content-wrap{width:100%;height:100%}.content-wrap.clickable{pointer-events:all}\n"] }]
67
- }], propDecorators: { isDebug: [{
68
- type: Input
69
- }], bgColor: [{
70
- type: Input
71
- }], contentClickable: [{
48
+ args: [{ selector: 'bs-boundary', standalone: true, template: "<div\n class=\"boundary-wrapper\"\n [class.fixed-center]=\"isFixedCenter\"\n [class.landscape]=\"isLandscape\"\n [style]=\"forwardStyle\"\n>\n <ng-content></ng-content>\n</div>\n", styles: [":host{--landscape-ratio: calc(var(--design-width) / var(--design-height));--portrait-ratio: calc(var(--design-height) / var(--design-width));pointer-events:none}.boundary-wrapper{width:100%;height:100%;max-width:var(--boundary-width);max-height:var(--boundary-height);overflow:hidden;pointer-events:auto}.boundary-wrapper{--boundary-width: min(var(--vw100), var(--boundary-max-width));--boundary-height: min(var(--vh100), var(--boundary-max-height));--px2vw-ratio: calc(var(--boundary-width) / var(--design-base-width));--boundary-max-width: calc(var(--vh100) * var(--landscape-ratio));--boundary-max-height: calc(var(--vw100) * var(--portrait-ratio));--design-base-width: var(--design-width);--design-base-height: var(--design-height)}.boundary-wrapper.landscape{--boundary-max-width: calc(var(--vh100) * var(--portrait-ratio));--boundary-max-height: calc(var(--vw100) * var(--landscape-ratio));--design-base-width: var(--design-height);--design-base-height: var(--design-width)}.fixed-center{position:fixed;top:50%;left:50%;transform:translate(-50%,-50%);z-index:99}\n"] }]
49
+ }], propDecorators: { isFixedCenter: [{
72
50
  type: Input
73
- }], orientationMode: [{
51
+ }], lockOrientation: [{
74
52
  type: Input
75
- }], injectStyle: [{
53
+ }], forwardStyle: [{
76
54
  type: Input
77
- }], boundary: [{
78
- type: ViewChild,
79
- args: ['boundary']
80
55
  }], afterBoundaryInit: [{
81
56
  type: Output
82
57
  }], orientationChange: [{
@@ -1 +1 @@
1
- {"version":3,"file":"bitstack-ng-boundary.mjs","sources":["../../../projects/bitstack-ng-boundary/src/lib/bs-boundary.ts","../../../projects/bitstack-ng-boundary/src/lib/template.html","../../../projects/bitstack-ng-boundary/src/public-api.ts","../../../projects/bitstack-ng-boundary/src/bitstack-ng-boundary.ts"],"sourcesContent":["import {\n AfterViewInit,\n Component,\n ElementRef,\n EventEmitter,\n inject,\n Input, OnDestroy,\n OnInit,\n Output,\n ViewChild\n} from '@angular/core';\nimport {TOrientationMode, IInjectStyle} from './model';\nimport {BreakpointObserver} from '@angular/cdk/layout';\nimport {Subject, takeUntil} from 'rxjs';\n\n@Component({\n selector: 'bs-boundary',\n templateUrl: 'template.html',\n standalone: true,\n styleUrls: ['./styles.scss'],\n})\nexport class BsBoundary implements OnInit, AfterViewInit, OnDestroy {\n @Input() isDebug = false;\n @Input() bgColor!: string;\n @Input() contentClickable = true;\n @Input() orientationMode?: TOrientationMode = 'auto';\n @Input() injectStyle?: IInjectStyle;\n @ViewChild('boundary') boundary: ElementRef<HTMLDivElement> | null = null;\n\n @Output() afterBoundaryInit = new EventEmitter<ElementRef<HTMLDivElement>>();\n @Output() orientationChange = new EventEmitter<TOrientationMode>();\n\n private breakpointObserver = inject(BreakpointObserver);\n private destroy$ = new Subject<void>();\n\n isLandscape = false;\n\n get _boundaryClass() {\n return {\n backgroundColor: this.bgColor,\n ...this.injectStyle?.['drag-boundary']\n };\n }\n\n get _contentClass() {\n return {\n ...this.injectStyle?.['content-wrap']\n };\n }\n\n ngOnInit(): void {\n this.setupBreakpointObserver();\n }\n\n ngAfterViewInit(): void {\n if (this.boundary) {\n this.afterBoundaryInit.emit(this.boundary);\n }\n }\n\n ngOnDestroy(): void {\n this.destroy$.next();\n this.destroy$.complete();\n }\n\n /**\n * 監控方向變化\n */\n setupBreakpointObserver() {\n if (this.orientationMode === 'landscape') {\n this.isLandscape = true;\n return;\n }\n\n if (this.orientationMode === 'portrait') {\n this.isLandscape = false;\n return;\n }\n\n this.breakpointObserver\n .observe('(orientation: landscape)')\n .pipe(takeUntil(this.destroy$))\n .subscribe(result => {\n this.orientationChange.emit(result.matches ? 'landscape' : 'portrait');\n this.isLandscape = result.matches;\n });\n }\n}\n","<div\n #boundary\n class=\"drag-boundary\"\n [class.enable-debug]=\"isDebug\"\n [class.landscape]=\"isLandscape\"\n [style]=\"_boundaryClass\"\n>\n <div\n class=\"content-wrap\"\n [class.clickable]=\"contentClickable\"\n [style]=\"_contentClass\"\n >\n <ng-content></ng-content>\n </div>\n</div>\n","/*\n * Public API Surface of @bitstack/ng-boundary\n */\n\nexport * from './lib/bs-boundary';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;MAqBa,UAAU,CAAA;AANvB,IAAA,WAAA,GAAA;QAOa,IAAO,CAAA,OAAA,GAAG,KAAK,CAAC;QAEhB,IAAgB,CAAA,gBAAA,GAAG,IAAI,CAAC;QACxB,IAAe,CAAA,eAAA,GAAsB,MAAM,CAAC;QAE9B,IAAQ,CAAA,QAAA,GAAsC,IAAI,CAAC;AAEhE,QAAA,IAAA,CAAA,iBAAiB,GAAG,IAAI,YAAY,EAA8B,CAAC;AACnE,QAAA,IAAA,CAAA,iBAAiB,GAAG,IAAI,YAAY,EAAoB,CAAC;AAE3D,QAAA,IAAA,CAAA,kBAAkB,GAAG,MAAM,CAAC,kBAAkB,CAAC,CAAC;AAChD,QAAA,IAAA,CAAA,QAAQ,GAAG,IAAI,OAAO,EAAQ,CAAC;QAEvC,IAAW,CAAA,WAAA,GAAG,KAAK,CAAC;AAoDvB,KAAA;AAlDG,IAAA,IAAI,cAAc,GAAA;QACd,OAAO;YACH,eAAe,EAAE,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,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA;AAAV,UAAA,CAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAU,oaCrBvB,+TAeA,EAAA,MAAA,EAAA,CAAA,k7BAAA,CAAA,EAAA,CAAA,CAAA;2FDMa,UAAU,EAAA,UAAA,EAAA,CAAA;kBANtB,SAAS;AACI,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,aAAa,cAEX,IAAI,EAAA,QAAA,EAAA,+TAAA,EAAA,MAAA,EAAA,CAAA,k7BAAA,CAAA,EAAA,CAAA;8BAIP,OAAO,EAAA,CAAA;sBAAf,KAAK;gBACG,OAAO,EAAA,CAAA;sBAAf,KAAK;gBACG,gBAAgB,EAAA,CAAA;sBAAxB,KAAK;gBACG,eAAe,EAAA,CAAA;sBAAvB,KAAK;gBACG,WAAW,EAAA,CAAA;sBAAnB,KAAK;gBACiB,QAAQ,EAAA,CAAA;sBAA9B,SAAS;uBAAC,UAAU,CAAA;gBAEX,iBAAiB,EAAA,CAAA;sBAA1B,MAAM;gBACG,iBAAiB,EAAA,CAAA;sBAA1B,MAAM;;;AE9BX;;AAEG;;ACFH;;AAEG;;;;"}
1
+ {"version":3,"file":"bitstack-ng-boundary.mjs","sources":["../../../projects/bitstack-ng-boundary/src/lib/bs-boundary.ts","../../../projects/bitstack-ng-boundary/src/lib/template.html","../../../projects/bitstack-ng-boundary/src/public-api.ts","../../../projects/bitstack-ng-boundary/src/bitstack-ng-boundary.ts"],"sourcesContent":["import {\n Component,\n ElementRef,\n EventEmitter,\n inject,\n Input, OnDestroy,\n OnInit,\n Output,\n} from '@angular/core';\nimport {TOrientationMode} from './model';\nimport {BreakpointObserver} from '@angular/cdk/layout';\nimport {Subject, takeUntil} from 'rxjs';\n\n@Component({\n selector: 'bs-boundary',\n templateUrl: 'template.html',\n standalone: true,\n styleUrls: ['./styles.scss'],\n})\nexport class BsBoundary implements OnInit, OnDestroy {\n\n @Input() isFixedCenter?: boolean = false;\n @Input() lockOrientation?: TOrientationMode = 'auto';\n @Input() forwardStyle?: Record<string, string>;\n\n @Output() afterBoundaryInit = new EventEmitter<ElementRef<HTMLDivElement>>();\n @Output() orientationChange = new EventEmitter<TOrientationMode>();\n\n private breakpointObserver = inject(BreakpointObserver);\n private destroy$ = new Subject<void>();\n\n isLandscape = false;\n\n ngOnInit(): void {\n this.setupBreakpointObserver();\n }\n\n ngOnDestroy(): void {\n this.destroy$.next();\n this.destroy$.complete();\n }\n\n /**\n * 監控方向變化\n */\n setupBreakpointObserver() {\n if (this.lockOrientation === 'landscape') {\n this.isLandscape = true;\n return;\n }\n\n if (this.lockOrientation === 'portrait') {\n this.isLandscape = false;\n return;\n }\n\n this.breakpointObserver\n .observe('(orientation: landscape)')\n .pipe(takeUntil(this.destroy$))\n .subscribe(result => {\n this.orientationChange.emit(result.matches ? 'landscape' : 'portrait');\n this.isLandscape = result.matches;\n });\n }\n}\n","<div\n class=\"boundary-wrapper\"\n [class.fixed-center]=\"isFixedCenter\"\n [class.landscape]=\"isLandscape\"\n [style]=\"forwardStyle\"\n>\n <ng-content></ng-content>\n</div>\n","/*\n * Public API Surface of @bitstack/ng-boundary\n */\n\nexport * from './lib/bs-boundary';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;MAmBa,UAAU,CAAA;AANvB,IAAA,WAAA,GAAA;QAQa,IAAa,CAAA,aAAA,GAAa,KAAK,CAAC;QAChC,IAAe,CAAA,eAAA,GAAsB,MAAM,CAAC;AAG3C,QAAA,IAAA,CAAA,iBAAiB,GAAG,IAAI,YAAY,EAA8B,CAAC;AACnE,QAAA,IAAA,CAAA,iBAAiB,GAAG,IAAI,YAAY,EAAoB,CAAC;AAE3D,QAAA,IAAA,CAAA,kBAAkB,GAAG,MAAM,CAAC,kBAAkB,CAAC,C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AAA,gjCAAA,CAAA,EAAA,CAAA,CAAA;2FDWa,UAAU,EAAA,UAAA,EAAA,CAAA;kBANtB,SAAS;AACI,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,aAAa,cAEX,IAAI,EAAA,QAAA,EAAA,0LAAA,EAAA,MAAA,EAAA,CAAA,gjCAAA,CAAA,EAAA,CAAA;8BAKP,aAAa,EAAA,CAAA;sBAArB,KAAK;gBACG,eAAe,EAAA,CAAA;sBAAvB,KAAK;gBACG,YAAY,EAAA,CAAA;sBAApB,KAAK;gBAEI,iBAAiB,EAAA,CAAA;sBAA1B,MAAM;gBACG,iBAAiB,EAAA,CAAA;sBAA1B,MAAM;;;AE1BX;;AAEG;;ACFH;;AAEG;;;;"}
@@ -1,31 +1,21 @@
1
- import { AfterViewInit, ElementRef, EventEmitter, OnDestroy, OnInit } from '@angular/core';
2
- import { TOrientationMode, IInjectStyle } from './model';
1
+ import { ElementRef, EventEmitter, OnDestroy, OnInit } from '@angular/core';
2
+ import { TOrientationMode } from './model';
3
3
  import * as i0 from "@angular/core";
4
- export declare class BsBoundary implements OnInit, AfterViewInit, OnDestroy {
5
- isDebug: boolean;
6
- bgColor: string;
7
- contentClickable: boolean;
8
- orientationMode?: TOrientationMode;
9
- injectStyle?: IInjectStyle;
10
- boundary: ElementRef<HTMLDivElement> | null;
4
+ export declare class BsBoundary implements OnInit, OnDestroy {
5
+ isFixedCenter?: boolean;
6
+ lockOrientation?: TOrientationMode;
7
+ forwardStyle?: Record<string, string>;
11
8
  afterBoundaryInit: EventEmitter<ElementRef<HTMLDivElement>>;
12
9
  orientationChange: EventEmitter<TOrientationMode>;
13
10
  private breakpointObserver;
14
11
  private destroy$;
15
12
  isLandscape: boolean;
16
- get _boundaryClass(): {
17
- backgroundColor: string;
18
- };
19
- get _contentClass(): {
20
- [x: string]: string;
21
- };
22
13
  ngOnInit(): void;
23
- ngAfterViewInit(): void;
24
14
  ngOnDestroy(): void;
25
15
  /**
26
16
  * 監控方向變化
27
17
  */
28
18
  setupBreakpointObserver(): void;
29
19
  static ɵfac: i0.ɵɵFactoryDeclaration<BsBoundary, never>;
30
- static ɵcmp: i0.ɵɵComponentDeclaration<BsBoundary, "bs-boundary", never, { "isDebug": "isDebug"; "bgColor": "bgColor"; "contentClickable": "contentClickable"; "orientationMode": "orientationMode"; "injectStyle": "injectStyle"; }, { "afterBoundaryInit": "afterBoundaryInit"; "orientationChange": "orientationChange"; }, never, ["*"], true>;
20
+ static ɵcmp: i0.ɵɵComponentDeclaration<BsBoundary, "bs-boundary", never, { "isFixedCenter": "isFixedCenter"; "lockOrientation": "lockOrientation"; "forwardStyle": "forwardStyle"; }, { "afterBoundaryInit": "afterBoundaryInit"; "orientationChange": "orientationChange"; }, never, ["*"], true>;
31
21
  }
package/lib/model.d.ts CHANGED
@@ -1,5 +1 @@
1
- export interface IInjectStyle {
2
- 'drag-boundary'?: Record<string, string>;
3
- 'content-wrap'?: Record<string, string>;
4
- }
5
1
  export declare type TOrientationMode = 'auto' | 'portrait' | 'landscape';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bitstack/ng-boundary",
3
- "version": "14.0.1-alpha.5",
3
+ "version": "14.0.1-alpha.6",
4
4
  "peerDependencies": {
5
5
  "@angular/common": "^14.0.0",
6
6
  "@angular/core": "^14.0.0",
@@ -1,109 +1,31 @@
1
1
  // check support device-vh
2
2
  @use "sass:math";
3
- @use "variables";
4
- @use "responsive";
5
3
 
6
- // Import required mixins from responsive
7
- @mixin supports-dv {
8
- @supports (width: 100dvh) {
9
- @content;
10
- }
11
- }
12
- @mixin not-supports-dv {
13
- @supports not (width: 100dvh) {
14
- @content;
15
- }
16
- }
17
-
18
- // Import and re-export functions from responsive
19
- @function responsive-size-by-px($px, $unit: 'v', $isLandscape: false, $isMax: false) {
20
- $w: math.div($px, 5.4);
21
- @return responsive.responsive-size-by-vw($w, $unit, $isLandscape, $isMax);
22
- }
23
-
24
- // Note: responsive-size-by-vw is provided by the responsive module
25
- // and should be accessed via @use "responsive"
26
-
27
-
28
-
29
- // use vw, vh or dvw, dvh
30
- @function vw($w) {
31
- @return #{$w}#{variables.$vw-unit};
32
- }
33
- @function vh($h) {
34
- @return #{$h}#{variables.$vh-unit};
35
- }
36
-
37
-
38
-
39
- @mixin setProperty($property, $value) {
40
- @include supports-dv {
41
- #{$property}: responsive-size-by-px($value, 'dv');
42
- }
43
- @include not-supports-dv {
44
- #{$property}: responsive-size-by-px($value, 'v');
45
- }
46
- }
47
-
48
- // 響應式尺寸 mixin 版本 (包含 supports-dv 判斷)
49
- @mixin px2vw($property, $px) {
50
- $layout-width-num: variables.$design-width; // 375
51
- $layout-height-num: variables.$design-height; // 667
52
-
53
- $vw-value: math.div($px, $layout-width-num) * 100; // 70/375*100
54
- $vh-value: math.div($px, $layout-height-num) * 100; // 70/667*100
55
-
56
- @include supports-dv {
57
- #{$property}: min(#{$vw-value}dvw, #{$vh-value}dvh);
58
- }
59
- @include not-supports-dv {
60
- #{$property}: min(#{$vw-value}vw, #{$vh-value}vh);
61
- }
62
- }
63
4
 
64
- // 單一屬性響應式 mixin (你想要的語法)
65
- @mixin height($px) {
66
- @include px2vw(height, $px);
67
- }
68
-
69
- @mixin width($px) {
70
- @include px2vw(width, $px);
71
- }
72
-
73
- @mixin padding-left($px) {
74
- @include px2vw(padding-left, $px);
75
- }
76
-
77
- @mixin padding-right($px) {
78
- @include px2vw(padding-right, $px);
79
- }
80
-
81
- @mixin padding-top($px) {
82
- @include px2vw(padding-top, $px);
83
- }
84
-
85
- @mixin padding-bottom($px) {
86
- @include px2vw(padding-bottom, $px);
87
- }
88
-
89
- // 響應式尺寸函數 (自動適應直式/橫式)
90
- // 使用 CSS 變數來獲取當前模式下的設計基準寬度
91
- // Portrait: --design-base-width = 375
92
- // Landscape: --design-base-width = 667
5
+ // ============================================================
6
+ // px2vw - 響應式尺寸函數 (推薦使用)
7
+ // ============================================================
8
+ // 使用 CSS 變數來實現動態計算,自動適應直式/橫式
9
+ //
10
+ // 運作方式:
11
+ // 1. boundary 元件會設定 --px2vw-ratio CSS 變數
12
+ // 2. Portrait 模式: --px2vw-ratio = boundary-width / design-width
13
+ // 3. Landscape 模式: --px2vw-ratio = boundary-width / design-height
14
+ // 4. 此函數將 px 值乘以該比例,實現響應式縮放
15
+ //
16
+ // 使用範例:
17
+ // .logo {
18
+ // width: px2vw(100); // 100px 會根據 boundary 自動縮放
19
+ // height: px2vw(100);
20
+ // }
21
+ //
22
+ // 覆寫設計尺寸:
23
+ // bs-boundary {
24
+ // --design-width: 375;
25
+ // --design-height: 667;
26
+ // }
93
27
  @function px2vw($px) {
94
28
  @return calc(#{$px} * var(--px2vw-ratio));
95
29
  }
96
30
 
97
- // 原始的 px2vw 函數 (不受 boundary 限制,直接基於 viewport)
98
- @function px2vw-unbounded($px) {
99
- $layout-width-num: variables.$design-width; // 375
100
- $layout-height-num: variables.$design-height; // 667
101
-
102
- $vw-value: math.div($px, $layout-width-num) * 100; // 70/375*100 = 18.666667
103
- $vh-value: math.div($px, $layout-height-num) * 100; // 70/667*100 = 10.494948
104
-
105
- @return unquote("min(#{$vw-value}#{variables.$vw-unit}, #{$vh-value}#{variables.$vw-unit})");
106
- }
107
-
108
-
109
31
 
package/styles.scss CHANGED
@@ -5,6 +5,4 @@
5
5
  * @use '@bitstack/ng-boundary/styles' as boundary;
6
6
  */
7
7
 
8
- @forward './src/styles/_variables';
9
- @forward './src/styles/awd' show px2vw;
10
- @forward './src/styles/_mixin';
8
+ @forward './src/styles/awd' show px2vw, px2vw-unbounded, vw, vh;