@bitstack/ng-boundary 14.0.1-alpha.4 → 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.
- package/esm2020/lib/bs-boundary.mjs +11 -36
- package/esm2020/lib/model.mjs +1 -1
- package/fesm2015/bitstack-ng-boundary.mjs +10 -32
- package/fesm2015/bitstack-ng-boundary.mjs.map +1 -1
- package/fesm2020/bitstack-ng-boundary.mjs +10 -35
- package/fesm2020/bitstack-ng-boundary.mjs.map +1 -1
- package/lib/bs-boundary.d.ts +7 -17
- package/lib/model.d.ts +0 -4
- package/package.json +1 -1
- package/src/styles/_awd.scss +22 -100
- package/styles.scss +1 -3
- package/src/styles/_mixin.scss +0 -107
- package/src/styles/_responsive.scss +0 -698
- package/src/styles/_variables.scss +0 -29
- package/src/styles/index.scss +0 -20
|
@@ -1,38 +1,20 @@
|
|
|
1
|
-
import { Component, EventEmitter, inject, Input, Output,
|
|
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.
|
|
8
|
-
this.
|
|
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.
|
|
26
|
+
if (this.lockOrientation === 'landscape') {
|
|
45
27
|
this.isLandscape = true;
|
|
46
28
|
return;
|
|
47
29
|
}
|
|
48
|
-
if (this.
|
|
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: {
|
|
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
|
|
66
|
-
}], propDecorators: {
|
|
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
|
-
}],
|
|
50
|
+
}], lockOrientation: [{
|
|
73
51
|
type: Input
|
|
74
|
-
}],
|
|
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,
|
|
59
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYnMtYm91bmRhcnkuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9wcm9qZWN0cy9iaXRzdGFjay1uZy1ib3VuZGFyeS9zcmMvbGliL2JzLWJvdW5kYXJ5LnRzIiwiLi4vLi4vLi4vLi4vcHJvamVjdHMvYml0c3RhY2stbmctYm91bmRhcnkvc3JjL2xpYi90ZW1wbGF0ZS5odG1sIl0sIm5hbWVzIjpbXSwib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HNjYXBlXCJcbiAgW3N0eWxlXT1cImZvcndhcmRTdHlsZVwiXG4+XG4gICA8bmctY29udGVudD48L25nLWNvbnRlbnQ+XG48L2Rpdj5cbiJdfQ==
|
package/esm2020/lib/model.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export {};
|
|
2
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
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,
|
|
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.
|
|
9
|
-
this.
|
|
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.
|
|
27
|
+
if (this.lockOrientation === 'landscape') {
|
|
43
28
|
this.isLandscape = true;
|
|
44
29
|
return;
|
|
45
30
|
}
|
|
46
|
-
if (this.
|
|
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: {
|
|
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
|
|
64
|
-
}], propDecorators: {
|
|
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
|
-
}],
|
|
51
|
+
}], lockOrientation: [{
|
|
71
52
|
type: Input
|
|
72
|
-
}],
|
|
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
|
|
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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AC;AACvE,YAAA,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC,OAAO,CAAC;AACtC,SAAC,CAAC,CAAC;KACV;;uGA5CQ,UAAU,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,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,kRCnBvB,0LAQA,EAAA,MAAA,EAAA,CAAA,gjCAAA,CAAA,EAAA,CAAA,CAAA;2FDWa,UAAU,EAAA,UAAA,EAAA,CAAA;kBANtB,SAAS;YACI,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,39 +1,21 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { EventEmitter, inject, Component, Input,
|
|
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.
|
|
9
|
-
this.
|
|
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.
|
|
27
|
+
if (this.lockOrientation === 'landscape') {
|
|
46
28
|
this.isLandscape = true;
|
|
47
29
|
return;
|
|
48
30
|
}
|
|
49
|
-
if (this.
|
|
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: {
|
|
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
|
|
67
|
-
}], propDecorators: {
|
|
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
|
-
}],
|
|
51
|
+
}], lockOrientation: [{
|
|
74
52
|
type: Input
|
|
75
|
-
}],
|
|
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
|
|
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,CAAC;AAChD,QAAA,IAAA,CAAA,QAAQ,GAAG,IAAI,OAAO,EAAQ,CAAC;QAEvC,IAAW,CAAA,WAAA,GAAG,KAAK,CAAC;AAiCvB,KAAA;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,SAAA;AAED,QAAA,IAAI,IAAI,CAAC,eAAe,KAAK,UAAU,EAAE;AACrC,YAAA,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC;YACzB,OAAO;AACV,SAAA;AAED,QAAA,IAAI,CAAC,kBAAkB;aAClB,OAAO,CAAC,0BAA0B,CAAC;AACnC,aAAA,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;aAC9B,SAAS,CAAC,MAAM,IAAG;AAChB,YAAA,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,GAAG,WAAW,GAAG,UAAU,CAAC,CAAC;AACvE,YAAA,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC,OAAO,CAAC;AACtC,SAAC,CAAC,CAAC;KACV;;uGA5CQ,UAAU,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,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,kRCnBvB,0LAQA,EAAA,MAAA,EAAA,CAAA,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;;;;"}
|
package/lib/bs-boundary.d.ts
CHANGED
|
@@ -1,31 +1,21 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { TOrientationMode
|
|
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,
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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, { "
|
|
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
package/package.json
CHANGED
package/src/styles/_awd.scss
CHANGED
|
@@ -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
|
-
//
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
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
|
|