@bitstack/ng-boundary 0.0.0-watch

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/README.md ADDED
@@ -0,0 +1,63 @@
1
+ # MyLib
2
+
3
+ This project was generated using [Angular CLI](https://github.com/angular/angular-cli) version 20.3.0.
4
+
5
+ ## Code scaffolding
6
+
7
+ Angular CLI includes powerful code scaffolding tools. To generate a new component, run:
8
+
9
+ ```bash
10
+ ng generate component component-name
11
+ ```
12
+
13
+ For a complete list of available schematics (such as `components`, `directives`, or `pipes`), run:
14
+
15
+ ```bash
16
+ ng generate --help
17
+ ```
18
+
19
+ ## Building
20
+
21
+ To build the library, run:
22
+
23
+ ```bash
24
+ ng build bitstack-ng-boundary
25
+ ```
26
+
27
+ This command will compile your project, and the build artifacts will be placed in the `dist/` directory.
28
+
29
+ ### Publishing the Library
30
+
31
+ Once the project is built, you can publish your library by following these steps:
32
+
33
+ 1. Navigate to the `dist` directory:
34
+ ```bash
35
+ cd dist/bitstack-ng-boundary
36
+ ```
37
+
38
+ 2. Run the `npm publish` command to publish your library to the npm registry:
39
+ ```bash
40
+ npm publish
41
+ ```
42
+
43
+ ## Running unit tests
44
+
45
+ To execute unit tests with the [Karma](https://karma-runner.github.io) test runner, use the following command:
46
+
47
+ ```bash
48
+ ng test
49
+ ```
50
+
51
+ ## Running end-to-end tests
52
+
53
+ For end-to-end (e2e) testing, run:
54
+
55
+ ```bash
56
+ ng e2e
57
+ ```
58
+
59
+ Angular CLI does not come with an end-to-end testing framework by default. You can choose one that suits your needs.
60
+
61
+ ## Additional Resources
62
+
63
+ For more information on using the Angular CLI, including detailed command references, visit the [Angular CLI Overview and Command Reference](https://angular.dev/tools/cli) page.
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Generated bundle index. Do not edit.
3
+ */
4
+ export * from './public-api';
5
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYml0c3RhY2stbmctYm91bmRhcnkuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9wcm9qZWN0cy9iaXRzdGFjay1uZy1ib3VuZGFyeS9zcmMvYml0c3RhY2stbmctYm91bmRhcnkudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7O0dBRUc7QUFFSCxjQUFjLGNBQWMsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbIi8qKlxuICogR2VuZXJhdGVkIGJ1bmRsZSBpbmRleC4gRG8gbm90IGVkaXQuXG4gKi9cblxuZXhwb3J0ICogZnJvbSAnLi9wdWJsaWMtYXBpJztcbiJdfQ==
@@ -0,0 +1,121 @@
1
+ import { Component, EventEmitter, inject, Input, Output, ViewChild } from '@angular/core';
2
+ import { BreakpointObserver } from '@angular/cdk/layout';
3
+ import { Subject, takeUntil } from 'rxjs';
4
+ import * as i0 from "@angular/core";
5
+ export class BsBoundary {
6
+ constructor() {
7
+ this.enableFrameLight = false;
8
+ this.contentClickable = true;
9
+ this.isDebug = false;
10
+ this.orientationMode = 'auto';
11
+ this.boundary = null;
12
+ this.afterBoundaryInit = new EventEmitter();
13
+ this.orientationChange = new EventEmitter();
14
+ this.breakpointObserver = inject(BreakpointObserver);
15
+ this.destroy$ = new Subject();
16
+ this.isLandscape = false;
17
+ }
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
+ ngOnInit() {
30
+ this.setupBreakpointObserver();
31
+ }
32
+ ngAfterViewInit() {
33
+ if (this.boundary) {
34
+ this.afterBoundaryInit.emit(this.boundary);
35
+ }
36
+ }
37
+ ngOnDestroy() {
38
+ this.destroy$.next();
39
+ this.destroy$.complete();
40
+ }
41
+ /**
42
+ * 監控方向變化
43
+ */
44
+ setupBreakpointObserver() {
45
+ if (this.orientationMode === 'landscape') {
46
+ this.isLandscape = true;
47
+ return;
48
+ }
49
+ if (this.orientationMode === 'portrait') {
50
+ this.isLandscape = false;
51
+ return;
52
+ }
53
+ this.breakpointObserver
54
+ .observe('(orientation: landscape)')
55
+ .pipe(takeUntil(this.destroy$))
56
+ .subscribe(result => {
57
+ this.orientationChange.emit(result.matches ? 'landscape' : 'portrait');
58
+ this.isLandscape = result.matches;
59
+ });
60
+ }
61
+ }
62
+ BsBoundary.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: BsBoundary, deps: [], target: i0.ɵɵFactoryTarget.Component });
63
+ BsBoundary.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: BsBoundary, isStandalone: true, selector: "bs-boundary", inputs: { bgColor: "bgColor", enableFrameLight: "enableFrameLight", contentClickable: "contentClickable", isDebug: "isDebug", orientationMode: "orientationMode", injectStyle: "injectStyle" }, outputs: { afterBoundaryInit: "afterBoundaryInit", orientationChange: "orientationChange" }, viewQueries: [{ propertyName: "boundary", first: true, predicate: ["boundary"], descendants: true }], ngImport: i0, template: `
64
+ <div
65
+ #boundary
66
+ class="drag-boundary"
67
+ [class.enable-debug]="isDebug"
68
+ [class.landscape]="isLandscape"
69
+ [class.enableFrameLight]="enableFrameLight"
70
+ [style]="_boundaryClass"
71
+ >
72
+ <div
73
+ class="content-wrap"
74
+ [class.clickable]="contentClickable"
75
+ [style]="_contentClass"
76
+ >
77
+ <ng-content/>
78
+ </div>
79
+ </div>
80
+ `, isInline: true, 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:.5622188906;z-index:1;pointer-events:none;transform-origin:center;--boundary-width: min(100dvw, 56.2218890555dvh);--boundary-height: min(100dvh, 177.8666666667dvw);--design-base-width: 375;--design-base-height: 667;--px2vw-ratio: calc(var(--boundary-width) / var(--design-base-width))}.drag-boundary.landscape{aspect-ratio:1.7786666667;--boundary-width: min(100dvw, 177.8666666667dvh);--boundary-height: min(100dvh, 56.2218890555dvw);--design-base-width: 667;--design-base-height: 375}.drag-boundary.enable-debug{background-color:#86cee668}.drag-boundary.hidden{visibility:hidden}@screen desktop{.drag-boundary { --boundary-height: calc(100vh - env(safe-area-inset-bottom)); } .drag-boundary.enableFrameLight:before,.drag-boundary.enableFrameLight:after {content: \"\"; position: absolute; top: 0; z-index: -1; width: auto; height: 100%; aspect-ratio: 170/1080; background: 100%; background-image: url(/assets/images/_common/bg-light.png); background-size: cover;} .drag-boundary.enableFrameLight:before {left: 100%; transform: scale(-1);} .drag-boundary.enableFrameLight:after {right: 100%;}}.content-wrap{width:100%;height:100%}.content-wrap.clickable{pointer-events:all}\n"] });
81
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: BsBoundary, decorators: [{
82
+ type: Component,
83
+ args: [{ selector: 'bs-boundary', template: `
84
+ <div
85
+ #boundary
86
+ class="drag-boundary"
87
+ [class.enable-debug]="isDebug"
88
+ [class.landscape]="isLandscape"
89
+ [class.enableFrameLight]="enableFrameLight"
90
+ [style]="_boundaryClass"
91
+ >
92
+ <div
93
+ class="content-wrap"
94
+ [class.clickable]="contentClickable"
95
+ [style]="_contentClass"
96
+ >
97
+ <ng-content/>
98
+ </div>
99
+ </div>
100
+ `, standalone: true, 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:.5622188906;z-index:1;pointer-events:none;transform-origin:center;--boundary-width: min(100dvw, 56.2218890555dvh);--boundary-height: min(100dvh, 177.8666666667dvw);--design-base-width: 375;--design-base-height: 667;--px2vw-ratio: calc(var(--boundary-width) / var(--design-base-width))}.drag-boundary.landscape{aspect-ratio:1.7786666667;--boundary-width: min(100dvw, 177.8666666667dvh);--boundary-height: min(100dvh, 56.2218890555dvw);--design-base-width: 667;--design-base-height: 375}.drag-boundary.enable-debug{background-color:#86cee668}.drag-boundary.hidden{visibility:hidden}@screen desktop{.drag-boundary { --boundary-height: calc(100vh - env(safe-area-inset-bottom)); } .drag-boundary.enableFrameLight:before,.drag-boundary.enableFrameLight:after {content: \"\"; position: absolute; top: 0; z-index: -1; width: auto; height: 100%; aspect-ratio: 170/1080; background: 100%; background-image: url(/assets/images/_common/bg-light.png); background-size: cover;} .drag-boundary.enableFrameLight:before {left: 100%; transform: scale(-1);} .drag-boundary.enableFrameLight:after {right: 100%;}}.content-wrap{width:100%;height:100%}.content-wrap.clickable{pointer-events:all}\n"] }]
101
+ }], propDecorators: { bgColor: [{
102
+ type: Input
103
+ }], enableFrameLight: [{
104
+ type: Input
105
+ }], contentClickable: [{
106
+ type: Input
107
+ }], isDebug: [{
108
+ type: Input
109
+ }], orientationMode: [{
110
+ type: Input
111
+ }], injectStyle: [{
112
+ type: Input
113
+ }], boundary: [{
114
+ type: ViewChild,
115
+ args: ['boundary']
116
+ }], afterBoundaryInit: [{
117
+ type: Output
118
+ }], orientationChange: [{
119
+ type: Output
120
+ }] } });
121
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYnMtYm91bmRhcnkuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9wcm9qZWN0cy9iaXRzdGFjay1uZy1ib3VuZGFyeS9zcmMvbGliL2JzLWJvdW5kYXJ5LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFFSCxTQUFTLEVBRVQsWUFBWSxFQUNaLE1BQU0sRUFDTixLQUFLLEVBRUwsTUFBTSxFQ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mVtaXQodGhpcy5ib3VuZGFyeSk7XG4gICAgICAgIH1cbiAgICB9XG5cbiAgICBuZ09uRGVzdHJveSgpOiB2b2lkIHtcbiAgICAgICAgdGhpcy5kZXN0cm95JC5uZXh0KCk7XG4gICAgICAgIHRoaXMuZGVzdHJveSQuY29tcGxldGUoKTtcbiAgICB9XG5cbiAgICAvKipcbiAgICAgKiDnm6PmjqfmlrnlkJHororljJZcbiAgICAgKi9cbiAgICBzZXR1cEJyZWFrcG9pbnRPYnNlcnZlcigpIHtcbiAgICAgICAgaWYgKHRoaXMub3JpZW50YXRpb25Nb2RlID09PSAnbGFuZHNjYXBlJykge1xuICAgICAgICAgICAgdGhpcy5pc0xhbmRzY2FwZSA9IHRydWU7XG4gICAgICAgICAgICByZXR1cm47XG4gICAgICAgIH1cblxuICAgICAgICBpZiAodGhpcy5vcmllbnRhdGlvbk1vZGUgPT09ICdwb3J0cmFpdCcpIHtcbiAgICAgICAgICAgIHRoaXMuaXNMYW5kc2NhcGUgPSBmYWxzZTtcbiAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgfVxuXG4gICAgICAgIHRoaXMuYnJlYWtwb2ludE9ic2VydmVyXG4gICAgICAgICAgICAub2JzZXJ2ZSgnKG9yaWVudGF0aW9uOiBsYW5kc2NhcGUpJylcbiAgICAgICAgICAgIC5waXBlKHRha2VVbnRpbCh0aGlzLmRlc3Ryb3kkKSlcbiAgICAgICAgICAgIC5zdWJzY3JpYmUocmVzdWx0ID0+IHtcbiAgICAgICAgICAgICAgICB0aGlzLm9yaWVudGF0aW9uQ2hhbmdlLmVtaXQocmVzdWx0Lm1hdGNoZXMgPyAnbGFuZHNjYXBlJyA6ICdwb3J0cmFpdCcpO1xuICAgICAgICAgICAgICAgIHRoaXMuaXNMYW5kc2NhcGUgPSByZXN1bHQubWF0Y2hlcztcbiAgICAgICAgICAgIH0pO1xuICAgIH1cbn1cbiJdfQ==
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibW9kZWwuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9wcm9qZWN0cy9iaXRzdGFjay1uZy1ib3VuZGFyeS9zcmMvbGliL21vZGVsLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiIiLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgaW50ZXJmYWNlIElJbmplY3RTdHlsZSB7XG4gICAgJ2RyYWctYm91bmRhcnknPzogUmVjb3JkPHN0cmluZywgc3RyaW5nPjtcbiAgICAnY29udGVudC13cmFwJz86IFJlY29yZDxzdHJpbmcsIHN0cmluZz47XG59XG5leHBvcnQgdHlwZSBUT3JpZW50YXRpb25Nb2RlID0gJ2F1dG8nIHwgJ3BvcnRyYWl0JyB8ICdsYW5kc2NhcGUnO1xuIl19
@@ -0,0 +1,5 @@
1
+ /*
2
+ * Public API Surface of @bitstack/ng-boundary
3
+ */
4
+ export * from './lib/bs-boundary';
5
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHVibGljLWFwaS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3Byb2plY3RzL2JpdHN0YWNrLW5nLWJvdW5kYXJ5L3NyYy9wdWJsaWMtYXBpLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOztHQUVHO0FBRUgsY0FBYyxtQkFBbUIsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbIi8qXG4gKiBQdWJsaWMgQVBJIFN1cmZhY2Ugb2YgQGJpdHN0YWNrL25nLWJvdW5kYXJ5XG4gKi9cblxuZXhwb3J0ICogZnJvbSAnLi9saWIvYnMtYm91bmRhcnknO1xuIl19
@@ -0,0 +1,129 @@
1
+ import * as i0 from '@angular/core';
2
+ import { EventEmitter, inject, Component, Input, ViewChild, Output } from '@angular/core';
3
+ import { BreakpointObserver } from '@angular/cdk/layout';
4
+ import { Subject, takeUntil } from 'rxjs';
5
+
6
+ class BsBoundary {
7
+ constructor() {
8
+ this.enableFrameLight = false;
9
+ this.contentClickable = true;
10
+ this.isDebug = false;
11
+ this.orientationMode = 'auto';
12
+ this.boundary = null;
13
+ this.afterBoundaryInit = new EventEmitter();
14
+ this.orientationChange = new EventEmitter();
15
+ this.breakpointObserver = inject(BreakpointObserver);
16
+ this.destroy$ = new Subject();
17
+ this.isLandscape = false;
18
+ }
19
+ get _boundaryClass() {
20
+ var _a;
21
+ return Object.assign({ backgroundColor: this.bgColor }, (_a = this.injectStyle) === null || _a === void 0 ? void 0 : _a['drag-boundary']);
22
+ }
23
+ get _contentClass() {
24
+ var _a;
25
+ return Object.assign({}, (_a = this.injectStyle) === null || _a === void 0 ? void 0 : _a['content-wrap']);
26
+ }
27
+ ngOnInit() {
28
+ this.setupBreakpointObserver();
29
+ }
30
+ ngAfterViewInit() {
31
+ if (this.boundary) {
32
+ this.afterBoundaryInit.emit(this.boundary);
33
+ }
34
+ }
35
+ ngOnDestroy() {
36
+ this.destroy$.next();
37
+ this.destroy$.complete();
38
+ }
39
+ /**
40
+ * 監控方向變化
41
+ */
42
+ setupBreakpointObserver() {
43
+ if (this.orientationMode === 'landscape') {
44
+ this.isLandscape = true;
45
+ return;
46
+ }
47
+ if (this.orientationMode === 'portrait') {
48
+ this.isLandscape = false;
49
+ return;
50
+ }
51
+ this.breakpointObserver
52
+ .observe('(orientation: landscape)')
53
+ .pipe(takeUntil(this.destroy$))
54
+ .subscribe(result => {
55
+ this.orientationChange.emit(result.matches ? 'landscape' : 'portrait');
56
+ this.isLandscape = result.matches;
57
+ });
58
+ }
59
+ }
60
+ BsBoundary.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: BsBoundary, deps: [], target: i0.ɵɵFactoryTarget.Component });
61
+ BsBoundary.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: BsBoundary, isStandalone: true, selector: "bs-boundary", inputs: { bgColor: "bgColor", enableFrameLight: "enableFrameLight", contentClickable: "contentClickable", isDebug: "isDebug", orientationMode: "orientationMode", injectStyle: "injectStyle" }, outputs: { afterBoundaryInit: "afterBoundaryInit", orientationChange: "orientationChange" }, viewQueries: [{ propertyName: "boundary", first: true, predicate: ["boundary"], descendants: true }], ngImport: i0, template: `
62
+ <div
63
+ #boundary
64
+ class="drag-boundary"
65
+ [class.enable-debug]="isDebug"
66
+ [class.landscape]="isLandscape"
67
+ [class.enableFrameLight]="enableFrameLight"
68
+ [style]="_boundaryClass"
69
+ >
70
+ <div
71
+ class="content-wrap"
72
+ [class.clickable]="contentClickable"
73
+ [style]="_contentClass"
74
+ >
75
+ <ng-content/>
76
+ </div>
77
+ </div>
78
+ `, isInline: true, 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:.5622188906;z-index:1;pointer-events:none;transform-origin:center;--boundary-width: min(100dvw, 56.2218890555dvh);--boundary-height: min(100dvh, 177.8666666667dvw);--design-base-width: 375;--design-base-height: 667;--px2vw-ratio: calc(var(--boundary-width) / var(--design-base-width))}.drag-boundary.landscape{aspect-ratio:1.7786666667;--boundary-width: min(100dvw, 177.8666666667dvh);--boundary-height: min(100dvh, 56.2218890555dvw);--design-base-width: 667;--design-base-height: 375}.drag-boundary.enable-debug{background-color:#86cee668}.drag-boundary.hidden{visibility:hidden}@screen desktop{.drag-boundary { --boundary-height: calc(100vh - env(safe-area-inset-bottom)); } .drag-boundary.enableFrameLight:before,.drag-boundary.enableFrameLight:after {content: \"\"; position: absolute; top: 0; z-index: -1; width: auto; height: 100%; aspect-ratio: 170/1080; background: 100%; background-image: url(/assets/images/_common/bg-light.png); background-size: cover;} .drag-boundary.enableFrameLight:before {left: 100%; transform: scale(-1);} .drag-boundary.enableFrameLight:after {right: 100%;}}.content-wrap{width:100%;height:100%}.content-wrap.clickable{pointer-events:all}\n"] });
79
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: BsBoundary, decorators: [{
80
+ type: Component,
81
+ args: [{ selector: 'bs-boundary', template: `
82
+ <div
83
+ #boundary
84
+ class="drag-boundary"
85
+ [class.enable-debug]="isDebug"
86
+ [class.landscape]="isLandscape"
87
+ [class.enableFrameLight]="enableFrameLight"
88
+ [style]="_boundaryClass"
89
+ >
90
+ <div
91
+ class="content-wrap"
92
+ [class.clickable]="contentClickable"
93
+ [style]="_contentClass"
94
+ >
95
+ <ng-content/>
96
+ </div>
97
+ </div>
98
+ `, standalone: true, 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:.5622188906;z-index:1;pointer-events:none;transform-origin:center;--boundary-width: min(100dvw, 56.2218890555dvh);--boundary-height: min(100dvh, 177.8666666667dvw);--design-base-width: 375;--design-base-height: 667;--px2vw-ratio: calc(var(--boundary-width) / var(--design-base-width))}.drag-boundary.landscape{aspect-ratio:1.7786666667;--boundary-width: min(100dvw, 177.8666666667dvh);--boundary-height: min(100dvh, 56.2218890555dvw);--design-base-width: 667;--design-base-height: 375}.drag-boundary.enable-debug{background-color:#86cee668}.drag-boundary.hidden{visibility:hidden}@screen desktop{.drag-boundary { --boundary-height: calc(100vh - env(safe-area-inset-bottom)); } .drag-boundary.enableFrameLight:before,.drag-boundary.enableFrameLight:after {content: \"\"; position: absolute; top: 0; z-index: -1; width: auto; height: 100%; aspect-ratio: 170/1080; background: 100%; background-image: url(/assets/images/_common/bg-light.png); background-size: cover;} .drag-boundary.enableFrameLight:before {left: 100%; transform: scale(-1);} .drag-boundary.enableFrameLight:after {right: 100%;}}.content-wrap{width:100%;height:100%}.content-wrap.clickable{pointer-events:all}\n"] }]
99
+ }], propDecorators: { bgColor: [{
100
+ type: Input
101
+ }], enableFrameLight: [{
102
+ type: Input
103
+ }], contentClickable: [{
104
+ type: Input
105
+ }], isDebug: [{
106
+ type: Input
107
+ }], orientationMode: [{
108
+ type: Input
109
+ }], injectStyle: [{
110
+ type: Input
111
+ }], boundary: [{
112
+ type: ViewChild,
113
+ args: ['boundary']
114
+ }], afterBoundaryInit: [{
115
+ type: Output
116
+ }], orientationChange: [{
117
+ type: Output
118
+ }] } });
119
+
120
+ /*
121
+ * Public API Surface of @bitstack/ng-boundary
122
+ */
123
+
124
+ /**
125
+ * Generated bundle index. Do not edit.
126
+ */
127
+
128
+ export { BsBoundary };
129
+ //# sourceMappingURL=bitstack-ng-boundary.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bitstack-ng-boundary.mjs","sources":["../../../projects/bitstack-ng-boundary/src/lib/bs-boundary.ts","../../../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 template: `\n <div\n #boundary\n class=\"drag-boundary\"\n [class.enable-debug]=\"isDebug\"\n [class.landscape]=\"isLandscape\"\n [class.enableFrameLight]=\"enableFrameLight\"\n [style]=\"_boundaryClass\"\n >\n <div\n class=\"content-wrap\"\n [class.clickable]=\"contentClickable\"\n [style]=\"_contentClass\"\n >\n <ng-content/>\n </div>\n </div>\n `,\n standalone: true,\n styleUrls: ['./styles.scss'],\n})\nexport class BsBoundary implements OnInit, AfterViewInit, OnDestroy {\n @Input() bgColor!: string;\n @Input() enableFrameLight = false;\n @Input() contentClickable = true;\n @Input() isDebug = false;\n @Input() orientationMode?: TOrientationMode = 'auto';\n @Input() injectStyle?: IInjectStyle;\n @ViewChild('boundary') boundary: ElementRef<HTMLDivElement> | null = null;\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 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","/*\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":";;;;;MAsCa,UAAU,CAAA;AAvBvB,IAAA,WAAA,GAAA;AAyBa,QAAA,IAAgB,CAAA,gBAAA,GAAG,KAAK,CAAC;AACzB,QAAA,IAAgB,CAAA,gBAAA,GAAG,IAAI,CAAC;AACxB,QAAA,IAAO,CAAA,OAAA,GAAG,KAAK,C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,EAAA,KAAA,EAAA,IAAA,EAAA,SAAA,EAAA,CAAA,UAAA,CAAA,EAAA,WAAA,EAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,EAAA,EAAA,QAAA,EAAA,CAAA;;;;;;;;;;;;;;;;;KAiBT,EAAA,QAAA,EAAA,IAAA,EAAA,MAAA,EAAA,CAAA,y8CAAA,CAAA,EAAA,CAAA,CAAA;4FAIQ,UAAU,EAAA,UAAA,EAAA,CAAA;kBAvBtB,SAAS;YACI,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,aAAa,EACb,QAAA,EAAA,CAAA;;;;;;;;;;;;;;;;;KAiBT,EAAA,UAAA,EACW,IAAI,EAAA,MAAA,EAAA,CAAA,y8CAAA,CAAA,EAAA,CAAA;8BAIP,OAAO,EAAA,CAAA;sBAAf,KAAK;gBACG,gBAAgB,EAAA,CAAA;sBAAxB,KAAK;gBACG,gBAAgB,EAAA,CAAA;sBAAxB,KAAK;gBACG,OAAO,EAAA,CAAA;sBAAf,KAAK;gBACG,eAAe,EAAA,CAAA;sBAAvB,KAAK;gBACG,WAAW,EAAA,CAAA;sBAAnB,KAAK;gBACiB,QAAQ,EAAA,CAAA;sBAA9B,SAAS;uBAAC,UAAU,CAAA;gBACX,iBAAiB,EAAA,CAAA;sBAA1B,MAAM;gBACG,iBAAiB,EAAA,CAAA;sBAA1B,MAAM;;;AC/CX;;AAEG;;ACFH;;AAEG;;;;"}
@@ -0,0 +1,132 @@
1
+ import * as i0 from '@angular/core';
2
+ import { EventEmitter, inject, Component, Input, ViewChild, Output } from '@angular/core';
3
+ import { BreakpointObserver } from '@angular/cdk/layout';
4
+ import { Subject, takeUntil } from 'rxjs';
5
+
6
+ class BsBoundary {
7
+ constructor() {
8
+ this.enableFrameLight = false;
9
+ this.contentClickable = true;
10
+ this.isDebug = false;
11
+ this.orientationMode = 'auto';
12
+ this.boundary = null;
13
+ this.afterBoundaryInit = new EventEmitter();
14
+ this.orientationChange = new EventEmitter();
15
+ this.breakpointObserver = inject(BreakpointObserver);
16
+ this.destroy$ = new Subject();
17
+ this.isLandscape = false;
18
+ }
19
+ get _boundaryClass() {
20
+ return {
21
+ backgroundColor: this.bgColor,
22
+ ...this.injectStyle?.['drag-boundary']
23
+ };
24
+ }
25
+ get _contentClass() {
26
+ return {
27
+ ...this.injectStyle?.['content-wrap']
28
+ };
29
+ }
30
+ ngOnInit() {
31
+ this.setupBreakpointObserver();
32
+ }
33
+ ngAfterViewInit() {
34
+ if (this.boundary) {
35
+ this.afterBoundaryInit.emit(this.boundary);
36
+ }
37
+ }
38
+ ngOnDestroy() {
39
+ this.destroy$.next();
40
+ this.destroy$.complete();
41
+ }
42
+ /**
43
+ * 監控方向變化
44
+ */
45
+ setupBreakpointObserver() {
46
+ if (this.orientationMode === 'landscape') {
47
+ this.isLandscape = true;
48
+ return;
49
+ }
50
+ if (this.orientationMode === 'portrait') {
51
+ this.isLandscape = false;
52
+ return;
53
+ }
54
+ this.breakpointObserver
55
+ .observe('(orientation: landscape)')
56
+ .pipe(takeUntil(this.destroy$))
57
+ .subscribe(result => {
58
+ this.orientationChange.emit(result.matches ? 'landscape' : 'portrait');
59
+ this.isLandscape = result.matches;
60
+ });
61
+ }
62
+ }
63
+ BsBoundary.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: BsBoundary, deps: [], target: i0.ɵɵFactoryTarget.Component });
64
+ BsBoundary.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: BsBoundary, isStandalone: true, selector: "bs-boundary", inputs: { bgColor: "bgColor", enableFrameLight: "enableFrameLight", contentClickable: "contentClickable", isDebug: "isDebug", orientationMode: "orientationMode", injectStyle: "injectStyle" }, outputs: { afterBoundaryInit: "afterBoundaryInit", orientationChange: "orientationChange" }, viewQueries: [{ propertyName: "boundary", first: true, predicate: ["boundary"], descendants: true }], ngImport: i0, template: `
65
+ <div
66
+ #boundary
67
+ class="drag-boundary"
68
+ [class.enable-debug]="isDebug"
69
+ [class.landscape]="isLandscape"
70
+ [class.enableFrameLight]="enableFrameLight"
71
+ [style]="_boundaryClass"
72
+ >
73
+ <div
74
+ class="content-wrap"
75
+ [class.clickable]="contentClickable"
76
+ [style]="_contentClass"
77
+ >
78
+ <ng-content/>
79
+ </div>
80
+ </div>
81
+ `, isInline: true, 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:.5622188906;z-index:1;pointer-events:none;transform-origin:center;--boundary-width: min(100dvw, 56.2218890555dvh);--boundary-height: min(100dvh, 177.8666666667dvw);--design-base-width: 375;--design-base-height: 667;--px2vw-ratio: calc(var(--boundary-width) / var(--design-base-width))}.drag-boundary.landscape{aspect-ratio:1.7786666667;--boundary-width: min(100dvw, 177.8666666667dvh);--boundary-height: min(100dvh, 56.2218890555dvw);--design-base-width: 667;--design-base-height: 375}.drag-boundary.enable-debug{background-color:#86cee668}.drag-boundary.hidden{visibility:hidden}@screen desktop{.drag-boundary { --boundary-height: calc(100vh - env(safe-area-inset-bottom)); } .drag-boundary.enableFrameLight:before,.drag-boundary.enableFrameLight:after {content: \"\"; position: absolute; top: 0; z-index: -1; width: auto; height: 100%; aspect-ratio: 170/1080; background: 100%; background-image: url(/assets/images/_common/bg-light.png); background-size: cover;} .drag-boundary.enableFrameLight:before {left: 100%; transform: scale(-1);} .drag-boundary.enableFrameLight:after {right: 100%;}}.content-wrap{width:100%;height:100%}.content-wrap.clickable{pointer-events:all}\n"] });
82
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: BsBoundary, decorators: [{
83
+ type: Component,
84
+ args: [{ selector: 'bs-boundary', template: `
85
+ <div
86
+ #boundary
87
+ class="drag-boundary"
88
+ [class.enable-debug]="isDebug"
89
+ [class.landscape]="isLandscape"
90
+ [class.enableFrameLight]="enableFrameLight"
91
+ [style]="_boundaryClass"
92
+ >
93
+ <div
94
+ class="content-wrap"
95
+ [class.clickable]="contentClickable"
96
+ [style]="_contentClass"
97
+ >
98
+ <ng-content/>
99
+ </div>
100
+ </div>
101
+ `, standalone: true, 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:.5622188906;z-index:1;pointer-events:none;transform-origin:center;--boundary-width: min(100dvw, 56.2218890555dvh);--boundary-height: min(100dvh, 177.8666666667dvw);--design-base-width: 375;--design-base-height: 667;--px2vw-ratio: calc(var(--boundary-width) / var(--design-base-width))}.drag-boundary.landscape{aspect-ratio:1.7786666667;--boundary-width: min(100dvw, 177.8666666667dvh);--boundary-height: min(100dvh, 56.2218890555dvw);--design-base-width: 667;--design-base-height: 375}.drag-boundary.enable-debug{background-color:#86cee668}.drag-boundary.hidden{visibility:hidden}@screen desktop{.drag-boundary { --boundary-height: calc(100vh - env(safe-area-inset-bottom)); } .drag-boundary.enableFrameLight:before,.drag-boundary.enableFrameLight:after {content: \"\"; position: absolute; top: 0; z-index: -1; width: auto; height: 100%; aspect-ratio: 170/1080; background: 100%; background-image: url(/assets/images/_common/bg-light.png); background-size: cover;} .drag-boundary.enableFrameLight:before {left: 100%; transform: scale(-1);} .drag-boundary.enableFrameLight:after {right: 100%;}}.content-wrap{width:100%;height:100%}.content-wrap.clickable{pointer-events:all}\n"] }]
102
+ }], propDecorators: { bgColor: [{
103
+ type: Input
104
+ }], enableFrameLight: [{
105
+ type: Input
106
+ }], contentClickable: [{
107
+ type: Input
108
+ }], isDebug: [{
109
+ type: Input
110
+ }], orientationMode: [{
111
+ type: Input
112
+ }], injectStyle: [{
113
+ type: Input
114
+ }], boundary: [{
115
+ type: ViewChild,
116
+ args: ['boundary']
117
+ }], afterBoundaryInit: [{
118
+ type: Output
119
+ }], orientationChange: [{
120
+ type: Output
121
+ }] } });
122
+
123
+ /*
124
+ * Public API Surface of @bitstack/ng-boundary
125
+ */
126
+
127
+ /**
128
+ * Generated bundle index. Do not edit.
129
+ */
130
+
131
+ export { BsBoundary };
132
+ //# sourceMappingURL=bitstack-ng-boundary.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bitstack-ng-boundary.mjs","sources":["../../../projects/bitstack-ng-boundary/src/lib/bs-boundary.ts","../../../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 template: `\n <div\n #boundary\n class=\"drag-boundary\"\n [class.enable-debug]=\"isDebug\"\n [class.landscape]=\"isLandscape\"\n [class.enableFrameLight]=\"enableFrameLight\"\n [style]=\"_boundaryClass\"\n >\n <div\n class=\"content-wrap\"\n [class.clickable]=\"contentClickable\"\n [style]=\"_contentClass\"\n >\n <ng-content/>\n </div>\n </div>\n `,\n standalone: true,\n styleUrls: ['./styles.scss'],\n})\nexport class BsBoundary implements OnInit, AfterViewInit, OnDestroy {\n @Input() bgColor!: string;\n @Input() enableFrameLight = false;\n @Input() contentClickable = true;\n @Input() isDebug = false;\n @Input() orientationMode?: TOrientationMode = 'auto';\n @Input() injectStyle?: IInjectStyle;\n @ViewChild('boundary') boundary: ElementRef<HTMLDivElement> | null = null;\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 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","/*\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":";;;;;MAsCa,UAAU,CAAA;AAvBvB,IAAA,WAAA,GAAA;QAyBa,IAAgB,CAAA,gBAAA,GAAG,KAAK,CAAC;QACzB,IAAgB,CAAA,gBAAA,GAAG,IAAI,CAAC;QACxB,IAAO,CAAA,OAAA,GAAG,KAAK,CAAC;QAChB,IAAe,CAAA,eAAA,GAAsB,MAAM,CAAC;QAE9B,IAAQ,CAAA,QAAA,GAAsC,IAAI,CAAC;AAChE,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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ACG,gBAAgB,EAAA,CAAA;sBAAxB,KAAK;gBACG,gBAAgB,EAAA,CAAA;sBAAxB,KAAK;gBACG,OAAO,EAAA,CAAA;sBAAf,KAAK;gBACG,eAAe,EAAA,CAAA;sBAAvB,KAAK;gBACG,WAAW,EAAA,CAAA;sBAAnB,KAAK;gBACiB,QAAQ,EAAA,CAAA;sBAA9B,SAAS;uBAAC,UAAU,CAAA;gBACX,iBAAiB,EAAA,CAAA;sBAA1B,MAAM;gBACG,iBAAiB,EAAA,CAAA;sBAA1B,MAAM;;;AC/CX;;AAEG;;ACFH;;AAEG;;;;"}
package/index.d.ts ADDED
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Generated bundle index. Do not edit.
3
+ */
4
+ /// <amd-module name="@bitstack/ng-boundary" />
5
+ export * from './public-api';
@@ -0,0 +1,32 @@
1
+ import { AfterViewInit, ElementRef, EventEmitter, OnDestroy, OnInit } from '@angular/core';
2
+ import { TOrientationMode, IInjectStyle } from './model';
3
+ import * as i0 from "@angular/core";
4
+ export declare class BsBoundary implements OnInit, AfterViewInit, OnDestroy {
5
+ bgColor: string;
6
+ enableFrameLight: boolean;
7
+ contentClickable: boolean;
8
+ isDebug: boolean;
9
+ orientationMode?: TOrientationMode;
10
+ injectStyle?: IInjectStyle;
11
+ boundary: ElementRef<HTMLDivElement> | null;
12
+ afterBoundaryInit: EventEmitter<ElementRef<HTMLDivElement>>;
13
+ orientationChange: EventEmitter<TOrientationMode>;
14
+ private breakpointObserver;
15
+ private destroy$;
16
+ isLandscape: boolean;
17
+ get _boundaryClass(): {
18
+ backgroundColor: string;
19
+ };
20
+ get _contentClass(): {
21
+ [x: string]: string;
22
+ };
23
+ ngOnInit(): void;
24
+ ngAfterViewInit(): void;
25
+ ngOnDestroy(): void;
26
+ /**
27
+ * 監控方向變化
28
+ */
29
+ setupBreakpointObserver(): void;
30
+ static ɵfac: i0.ɵɵFactoryDeclaration<BsBoundary, never>;
31
+ static ɵcmp: i0.ɵɵComponentDeclaration<BsBoundary, "bs-boundary", never, { "bgColor": "bgColor"; "enableFrameLight": "enableFrameLight"; "contentClickable": "contentClickable"; "isDebug": "isDebug"; "orientationMode": "orientationMode"; "injectStyle": "injectStyle"; }, { "afterBoundaryInit": "afterBoundaryInit"; "orientationChange": "orientationChange"; }, never, ["*"], true, never>;
32
+ }
package/lib/model.d.ts ADDED
@@ -0,0 +1,5 @@
1
+ export interface IInjectStyle {
2
+ 'drag-boundary'?: Record<string, string>;
3
+ 'content-wrap'?: Record<string, string>;
4
+ }
5
+ export type TOrientationMode = 'auto' | 'portrait' | 'landscape';
package/package.json ADDED
@@ -0,0 +1,32 @@
1
+ {
2
+ "name": "@bitstack/ng-boundary",
3
+ "version": "0.0.0-watch+1763402264371",
4
+ "peerDependencies": {
5
+ "@angular/common": "^15.2.0",
6
+ "@angular/core": "^15.2.0",
7
+ "@angular/cdk": "^15.2.0"
8
+ },
9
+ "dependencies": {
10
+ "tslib": "^2.3.0"
11
+ },
12
+ "sideEffects": false,
13
+ "module": "fesm2015/bitstack-ng-boundary.mjs",
14
+ "es2020": "fesm2020/bitstack-ng-boundary.mjs",
15
+ "esm2020": "esm2020/bitstack-ng-boundary.mjs",
16
+ "fesm2020": "fesm2020/bitstack-ng-boundary.mjs",
17
+ "fesm2015": "fesm2015/bitstack-ng-boundary.mjs",
18
+ "typings": "index.d.ts",
19
+ "exports": {
20
+ "./package.json": {
21
+ "default": "./package.json"
22
+ },
23
+ ".": {
24
+ "types": "./index.d.ts",
25
+ "esm2020": "./esm2020/bitstack-ng-boundary.mjs",
26
+ "es2020": "./fesm2020/bitstack-ng-boundary.mjs",
27
+ "es2015": "./fesm2015/bitstack-ng-boundary.mjs",
28
+ "node": "./fesm2015/bitstack-ng-boundary.mjs",
29
+ "default": "./fesm2020/bitstack-ng-boundary.mjs"
30
+ }
31
+ }
32
+ }
@@ -0,0 +1 @@
1
+ export * from './lib/bs-boundary';