@ibyar/router 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2020-2025 @ibyar/router
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,31 @@
1
+ # Ibyar Router
2
+
3
+ [![NPM Version][npm-image]][npm-url]
4
+ [![NPM Downloads][downloads-image]][downloads-url]
5
+ [![LICENSE][license-img]][license-url]
6
+ [![lerna][lerna-img]][lerna-url]
7
+ ![GitHub contributors][contributors]
8
+
9
+ [npm-image]: https://img.shields.io/npm/v/@ibyar/router.svg?logo=npm&logoColor=fff&label=NPM+package&color=limegreen
10
+ [npm-url]: https://npmjs.org/package/@ibyar/router
11
+ [downloads-image]: https://img.shields.io/npm/dt/@ibyar/router
12
+ [downloads-url]: https://npmjs.org/package/@ibyar/router
13
+ [license-img]: https://img.shields.io/github/license/ibyar/aurora
14
+ [license-url]: https://github.com/ibyar/aurora/blob/master/LICENSE
15
+ [lerna-img]: https://img.shields.io/badge/maintained%20with-lerna-cc00ff.svg
16
+ [lerna-url]: https://lerna.js.org/
17
+ [contributors]: https://img.shields.io/github/contributors/ibyar/aurora
18
+
19
+ Ibyar router has the built-in directives for router and navigation.
20
+
21
+ ## `Install`
22
+
23
+ ``` bash
24
+ npm i --save @ibyar/router
25
+ ```
26
+
27
+ ``` bash
28
+ yarn add @ibyar/router
29
+ ```
30
+
31
+
@@ -0,0 +1,6 @@
1
+ import { OnDestroy, StructuralDirective, Type } from '@ibyar/core';
2
+ export declare class ComponentOutlet<C extends {}> extends StructuralDirective implements OnDestroy {
3
+ component: import("@ibyar/core").InputWithTransform<void, Type<C> | undefined>;
4
+ onDestroy(): void;
5
+ }
6
+ //# sourceMappingURL=component-outlet%20copy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"component-outlet copy.d.ts","sourceRoot":"","sources":["../../../src/router/components/component-outlet copy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,SAAS,EAAE,mBAAmB,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAGrF,qBAGa,eAAe,CAAC,CAAC,SAAS,EAAE,CAAE,SAAQ,mBAAoB,YAAW,SAAS;IAE1F,SAAS,sEAKN;IAEH,SAAS;CAIT"}
@@ -0,0 +1,33 @@
1
+ import { __esDecorate, __runInitializers } from "tslib";
2
+ import { Directive, input, StructuralDirective } from '@ibyar/core';
3
+ let ComponentOutlet = (() => {
4
+ let _classDecorators = [Directive({
5
+ selector: '*component-outlet',
6
+ })];
7
+ let _classDescriptor;
8
+ let _classExtraInitializers = [];
9
+ let _classThis;
10
+ let _classSuper = StructuralDirective;
11
+ var ComponentOutlet = class extends _classSuper {
12
+ static { _classThis = this; }
13
+ static {
14
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
15
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
16
+ ComponentOutlet = _classThis = _classDescriptor.value;
17
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
18
+ __runInitializers(_classThis, _classExtraInitializers);
19
+ }
20
+ component = input.required({
21
+ transform: (componentType) => {
22
+ this.viewContainerRef.clear();
23
+ componentType && this.viewContainerRef.createComponent(componentType);
24
+ }
25
+ });
26
+ onDestroy() {
27
+ this.viewContainerRef.clear();
28
+ }
29
+ };
30
+ return ComponentOutlet = _classThis;
31
+ })();
32
+ export { ComponentOutlet };
33
+ //# sourceMappingURL=component-outlet%20copy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"component-outlet copy.js","sourceRoot":"","sources":["../../../src/router/components/component-outlet copy.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAa,mBAAmB,EAAQ,MAAM,aAAa,CAAC;IAMxE,eAAe;4BAH3B,SAAS,CAAC;YACV,QAAQ,EAAE,mBAAmB;SAC7B,CAAC;;;;sBACiD,mBAAmB;+BAA3B,SAAQ,WAAmB;;;;YAAtE,6KAaC;;;YAbY,uDAAe;;QAE3B,SAAS,GAAG,KAAK,CAAC,QAAQ,CAAC;YAC1B,SAAS,EAAE,CAAC,aAAuB,EAAE,EAAE;gBACtC,IAAI,CAAC,gBAAgB,CAAC,KAAK,EAAE,CAAC;gBAC9B,aAAa,IAAI,IAAI,CAAC,gBAAgB,CAAC,eAAe,CAAI,aAAa,CAAC,CAAC;YAC1E,CAAC;SACD,CAAC,CAAC;QAEH,SAAS;YACR,IAAI,CAAC,gBAAgB,CAAC,KAAK,EAAE,CAAC;QAC/B,CAAC;;;;SAXW,eAAe","sourcesContent":["import { Directive, input, OnDestroy, StructuralDirective, Type } from '@ibyar/core';\n\n\n@Directive({\n\tselector: '*component-outlet',\n})\nexport class ComponentOutlet<C extends {}> extends StructuralDirective implements OnDestroy {\n\n\tcomponent = input.required({\n\t\ttransform: (componentType?: Type<C>) => {\n\t\t\tthis.viewContainerRef.clear();\n\t\t\tcomponentType && this.viewContainerRef.createComponent<C>(componentType);\n\t\t}\n\t});\n\n\tonDestroy() {\n\t\tthis.viewContainerRef.clear();\n\t}\n\n}\n"]}
@@ -0,0 +1,17 @@
1
+ import { OnDestroy, StructuralDirective, Type } from '@ibyar/core';
2
+ export declare class ComponentOutlet<C extends {}> extends StructuralDirective implements OnDestroy {
3
+ component: import("@ibyar/core").InputWithTransform<void, Type<C> | undefined>;
4
+ onDestroy(): void;
5
+ }
6
+ export type ɵɵ0ComponentOutletDirective0ɵɵ = {
7
+ selector: "*component-outlet";
8
+ successors: [
9
+ ];
10
+ inputs: [
11
+ {
12
+ name: "component";
13
+ aliasName: "component";
14
+ }
15
+ ];
16
+ };
17
+ //# sourceMappingURL=component-outlet.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"component-outlet.d.ts","sourceRoot":"","sources":["../../../src/router/components/component-outlet.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,SAAS,EAAE,mBAAmB,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAGrF,qBAGa,eAAe,CAAC,CAAC,SAAS,EAAE,CAAE,SAAQ,mBAAoB,YAAW,SAAS;IAE1F,SAAS,sEAKN;IAEH,SAAS;CAIT;AAnBD,MAAM,MAAK,8BAA+B,GAAE;IAAE,QAAQ,EAAC,mBAAoB,CAAC;IAAA,UAC5E,EAEA;KAAE,CAAC;IAAA,MAAM,EAAC;QACT;YAAA,IAAG,EAAC,WAAY,CAAC;YAAA,SAAU,EAAC,WAEvB,CAAA;SAAC;KAAC,CAAA;CAAC,CAAC"}
@@ -0,0 +1,33 @@
1
+ import { __esDecorate, __runInitializers } from "tslib";
2
+ import { Directive, input, StructuralDirective } from '@ibyar/core';
3
+ let ComponentOutlet = (() => {
4
+ let _classDecorators = [Directive({
5
+ selector: '*component-outlet',
6
+ })];
7
+ let _classDescriptor;
8
+ let _classExtraInitializers = [];
9
+ let _classThis;
10
+ let _classSuper = StructuralDirective;
11
+ var ComponentOutlet = class extends _classSuper {
12
+ static { _classThis = this; }
13
+ static {
14
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
15
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
16
+ ComponentOutlet = _classThis = _classDescriptor.value;
17
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
18
+ __runInitializers(_classThis, _classExtraInitializers);
19
+ }
20
+ component = input.required({
21
+ transform: (componentType) => {
22
+ this.viewContainerRef.clear();
23
+ componentType && this.viewContainerRef.createComponent(componentType);
24
+ }
25
+ });
26
+ onDestroy() {
27
+ this.viewContainerRef.clear();
28
+ }
29
+ };
30
+ return ComponentOutlet = _classThis;
31
+ })();
32
+ export { ComponentOutlet };
33
+ //# sourceMappingURL=component-outlet.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"component-outlet.js","sourceRoot":"","sources":["../../../src/router/components/component-outlet.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAa,mBAAmB,EAAQ,MAAM,aAAa,CAAC;IAMxE,eAAe;4BAH3B,SAAS,CAAC;YACV,QAAQ,EAAE,mBAAmB;SAC7B,CAAC;;;;sBACiD,mBAAmB;+BAA3B,SAAQ,WAAmB;;;;YAAtE,6KAaC;;;YAbY,uDAAe;;QAE3B,SAAS,GAAG,KAAK,CAAC,QAAQ,CAAC;YAC1B,SAAS,EAAE,CAAC,aAAuB,EAAE,EAAE;gBACtC,IAAI,CAAC,gBAAgB,CAAC,KAAK,EAAE,CAAC;gBAC9B,aAAa,IAAI,IAAI,CAAC,gBAAgB,CAAC,eAAe,CAAI,aAAa,CAAC,CAAC;YAC1E,CAAC;SACD,CAAC,CAAC;QAEH,SAAS;YACR,IAAI,CAAC,gBAAgB,CAAC,KAAK,EAAE,CAAC;QAC/B,CAAC;;;;SAXW,eAAe","sourcesContent":["import { Directive, input, OnDestroy, StructuralDirective, Type } from '@ibyar/core';\n\n\n@Directive({\n\tselector: '*component-outlet',\n})\nexport class ComponentOutlet<C extends {}> extends StructuralDirective implements OnDestroy {\n\n\tcomponent = input.required({\n\t\ttransform: (componentType?: Type<C>) => {\n\t\t\tthis.viewContainerRef.clear();\n\t\t\tcomponentType && this.viewContainerRef.createComponent<C>(componentType);\n\t\t}\n\t});\n\n\tonDestroy() {\n\t\tthis.viewContainerRef.clear();\n\t}\n\n}\n"]}
@@ -0,0 +1,14 @@
1
+ import { OnDestroy, StructuralDirective, Type } from '@ibyar/core';
2
+ export declare class LazyHiddenViewComponent implements OnDestroy {
3
+ private hidden;
4
+ hide(nativeElement: HTMLElement): void;
5
+ onDestroy(): void;
6
+ }
7
+ export declare class LazyOutletComponent<C extends {}> extends StructuralDirective implements OnDestroy {
8
+ private viewRef;
9
+ private hiddenView;
10
+ private currentType;
11
+ component: import("@ibyar/core").InputWithTransform<void, Type<C> | undefined>;
12
+ onDestroy(): void;
13
+ }
14
+ //# sourceMappingURL=lazy-component-outlet.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lazy-component-outlet.d.ts","sourceRoot":"","sources":["../../../src/router/components/lazy-component-outlet.ts"],"names":[],"mappings":"AAAA,OAAO,EAEN,SAAS,EAAE,mBAAmB,EAAE,IAAI,EACpC,MAAM,aAAa,CAAC;AAGrB,qBAIa,uBAAwB,YAAW,SAAS;IAExD,OAAO,CAAC,MAAM,CAAuB;IAErC,IAAI,CAAC,aAAa,EAAE,WAAW;IAQ/B,SAAS,IAAI,IAAI;CAIjB;AAGD,qBAIa,mBAAmB,CAAC,CAAC,SAAS,EAAE,CAAE,SAAQ,mBAAoB,YAAW,SAAS;IAE9F,OAAO,CAAC,OAAO,CAA2C;IAC1D,OAAO,CAAC,UAAU,CAAkE;IACpF,OAAO,CAAC,WAAW,CAAsB;IAEzC,SAAS,sEAuBN;IAEH,SAAS;CAIT"}
@@ -0,0 +1,91 @@
1
+ import { __esDecorate, __runInitializers } from "tslib";
2
+ import { Component, Directive, input, StructuralDirective, viewChild } from '@ibyar/core';
3
+ let LazyHiddenViewComponent = (() => {
4
+ let _classDecorators = [Component({
5
+ selector: 'lazy-hidden-view',
6
+ template: `<div #hidden style="display: none"><div></div></div>`
7
+ })];
8
+ let _classDescriptor;
9
+ let _classExtraInitializers = [];
10
+ let _classThis;
11
+ var LazyHiddenViewComponent = class {
12
+ static { _classThis = this; }
13
+ static {
14
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
15
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
16
+ LazyHiddenViewComponent = _classThis = _classDescriptor.value;
17
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
18
+ __runInitializers(_classThis, _classExtraInitializers);
19
+ }
20
+ hidden = viewChild('hidden');
21
+ hide(nativeElement) {
22
+ const div = this.hidden.get();
23
+ if (div.moveBefore && div.lastChild) {
24
+ div.moveBefore(nativeElement, div.lastChild);
25
+ }
26
+ else if (div.lastChild) {
27
+ div.lastChild.before(nativeElement);
28
+ }
29
+ }
30
+ onDestroy() {
31
+ this.hidden.get().innerHTML = '';
32
+ }
33
+ };
34
+ return LazyHiddenViewComponent = _classThis;
35
+ })();
36
+ export { LazyHiddenViewComponent };
37
+ let LazyOutletComponent = (() => {
38
+ let _classDecorators = [Directive({
39
+ selector: '*lazy-outlet',
40
+ imports: [LazyHiddenViewComponent]
41
+ })];
42
+ let _classDescriptor;
43
+ let _classExtraInitializers = [];
44
+ let _classThis;
45
+ let _classSuper = StructuralDirective;
46
+ var LazyOutletComponent = class extends _classSuper {
47
+ static { _classThis = this; }
48
+ static {
49
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
50
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
51
+ LazyOutletComponent = _classThis = _classDescriptor.value;
52
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
53
+ __runInitializers(_classThis, _classExtraInitializers);
54
+ }
55
+ viewRef = new Map();
56
+ hiddenView = this.viewContainerRef.createComponent(LazyHiddenViewComponent);
57
+ currentType;
58
+ component = input.required({
59
+ transform: (componentType) => {
60
+ if (componentType === this.currentType) {
61
+ return;
62
+ }
63
+ const ref = this.viewRef.get(this.currentType);
64
+ if (ref) {
65
+ const index = this.viewContainerRef.indexOf(ref.viewRef);
66
+ this.viewContainerRef.remove(index, false);
67
+ this.hiddenView.instance.hide(ref.nativeElement);
68
+ }
69
+ if (this.viewRef.has(componentType) && componentType) {
70
+ const oldView = this.viewRef.get(componentType);
71
+ this.viewContainerRef.adopt(oldView.viewRef);
72
+ this.currentType = componentType;
73
+ }
74
+ else if (componentType) {
75
+ const newRef = this.viewContainerRef.createComponent(componentType);
76
+ this.viewRef.set(componentType, newRef);
77
+ this.currentType = componentType;
78
+ }
79
+ else {
80
+ this.currentType = undefined;
81
+ }
82
+ }
83
+ });
84
+ onDestroy() {
85
+ this.viewContainerRef.clear();
86
+ }
87
+ };
88
+ return LazyOutletComponent = _classThis;
89
+ })();
90
+ export { LazyOutletComponent };
91
+ //# sourceMappingURL=lazy-component-outlet.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lazy-component-outlet.js","sourceRoot":"","sources":["../../../src/router/components/lazy-component-outlet.ts"],"names":[],"mappings":"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","sourcesContent":["import {\n\tComponent, ComponentViewRef, Directive, input,\n\tOnDestroy, StructuralDirective, Type, viewChild\n} from '@ibyar/core';\n\n\n@Component({\n\tselector: 'lazy-hidden-view',\n\ttemplate: `<div #hidden style=\"display: none\"><div></div></div>`\n})\nexport class LazyHiddenViewComponent implements OnDestroy {\n\n\tprivate hidden = viewChild('hidden');\n\n\thide(nativeElement: HTMLElement) {\n\t\tconst div = this.hidden.get() as HTMLDivElement & { moveBefore?: (node: Node, child: ChildNode) => void };\n\t\tif (div.moveBefore && div.lastChild) {\n\t\t\tdiv.moveBefore(nativeElement, div.lastChild);\n\t\t} else if (div.lastChild) {\n\t\t\tdiv.lastChild.before(nativeElement);\n\t\t}\n\t}\n\tonDestroy(): void {\n\t\tthis.hidden.get().innerHTML = '';\n\t}\n\n}\n\n\n@Directive({\n\tselector: '*lazy-outlet',\n\timports: [LazyHiddenViewComponent]\n})\nexport class LazyOutletComponent<C extends {}> extends StructuralDirective implements OnDestroy {\n\n\tprivate viewRef = new Map<Type<C>, ComponentViewRef<C>>();\n\tprivate hiddenView = this.viewContainerRef.createComponent(LazyHiddenViewComponent);\n\tprivate currentType: Type<C> | undefined;\n\n\tcomponent = input.required({\n\t\ttransform: (componentType?: Type<C>) => {\n\t\t\tif (componentType === this.currentType) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst ref = this.viewRef.get(this.currentType!);\n\t\t\tif (ref) {\n\t\t\t\tconst index = this.viewContainerRef.indexOf(ref.viewRef);\n\t\t\t\tthis.viewContainerRef.remove(index, false);\n\t\t\t\tthis.hiddenView.instance.hide(ref.nativeElement);\n\t\t\t}\n\t\t\tif (this.viewRef.has(componentType!) && componentType) {\n\t\t\t\tconst oldView = this.viewRef.get(componentType)!;\n\t\t\t\tthis.viewContainerRef.adopt(oldView.viewRef);\n\t\t\t\tthis.currentType = componentType;\n\t\t\t} else if (componentType) {\n\t\t\t\tconst newRef = this.viewContainerRef.createComponent<C>(componentType);\n\t\t\t\tthis.viewRef.set(componentType, newRef);\n\t\t\t\tthis.currentType = componentType;\n\t\t\t} else {\n\t\t\t\tthis.currentType = undefined;\n\t\t\t}\n\t\t}\n\t});\n\n\tonDestroy() {\n\t\tthis.viewContainerRef.clear();\n\t}\n\n}\n"]}
@@ -0,0 +1,24 @@
1
+ import { OnDestroy, StructuralDirective, Type } from '@ibyar/core';
2
+ export declare class LazyHiddenViewComponent {
3
+ static readonly HTMLLazyHiddenViewElement: ConstructorOfView<HTMLLazyHiddenViewElement>;
4
+ private hidden;
5
+ hide(nativeElement: HTMLElement): void;
6
+ }
7
+ export declare class LazyOutletComponent<C extends {}> extends StructuralDirective implements OnDestroy {
8
+ private viewRef;
9
+ private hiddenView;
10
+ private currentType;
11
+ component: import("@ibyar/core").InputWithTransform<void, Type<C> | undefined>;
12
+ onDestroy(): void;
13
+ }
14
+ import { BaseComponent, BaseFormAssociatedComponent, ConstructorOfView } from "@ibyar/core";
15
+ declare class HTMLLazyHiddenViewElement extends HTMLElement {
16
+ }
17
+ declare interface HTMLLazyHiddenViewElement extends BaseComponent<LazyHiddenViewComponent> {
18
+ }
19
+ declare global {
20
+ interface HTMLElementTagNameMap {
21
+ ["lazy-hidden-view"]: HTMLLazyHiddenViewElement;
22
+ }
23
+ }
24
+ //# sourceMappingURL=lazy-outlet.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lazy-outlet.d.ts","sourceRoot":"","sources":["../../../src/router/components/lazy-outlet.ts"],"names":[],"mappings":"AAAA,OAAO,EAEN,SAAS,EAAE,mBAAmB,EAAE,IAAI,EACpC,MAAM,aAAa,CAAC;AAGrB,qBAIa,uBAAuB;IAJpC,wFAiBC;IAXA,OAAO,CAAC,MAAM,CAAuB;IAErC,IAAI,CAAC,aAAa,EAAE,WAAW;CAS/B;AAGD,qBAIa,mBAAmB,CAAC,CAAC,SAAS,EAAE,CAAE,SAAQ,mBAAoB,YAAW,SAAS;IAE9F,OAAO,CAAC,OAAO,CAA2C;IAC1D,OAAO,CAAC,UAAU,CAAkE;IACpF,OAAO,CAAC,WAAW,CAAsB;IAEzC,SAAS,sEAuBN;IAEH,SAAS;CAIT;AAjED,OACC,EAAC,aAAc,EAAC,2BAA4B,EAAC,iBAC9B,EAAE,MAAK,aAAc,CAAC;AAAC,OACpC,OAAM,yBAGE,SACL,WAAY;CACd;AAAA,OAAW,WAAU,yBAA0B,SAAQ,aAEvD,CAAC,uBAAuB,CAAC;CAAG;AAAA,OAE3B,CAAA,MAAO,CAAA;IAAE,UAAa,qBAElB;QAAE,CAAM,kBAAkB,CACnC,EAAE,yBAAyB,CAAC;KAAK;CAAI"}
@@ -0,0 +1,89 @@
1
+ import { __esDecorate, __runInitializers } from "tslib";
2
+ import { Component, Directive, input, StructuralDirective, viewChild } from '@ibyar/core';
3
+ let LazyHiddenViewComponent = (() => {
4
+ let _classDecorators = [Component({
5
+ selector: 'lazy-hidden-view',
6
+ compiledTemplate: { attributes: [{ name: "style", value: "display: none", expression: { type: "AssignmentExpression", operator: "=", left: { type: "MemberExpression", object: { type: "ThisExpression", range: [0, 4] }, property: { type: "Identifier", name: "style", range: [5, 10] }, computed: false, optional: false, range: [0, 10] }, right: { type: "Literal", value: "display: none", raw: "'display: none'", range: [13, 28] }, range: [0, 28] }, type: "ElementAttribute" }], children: [{ tagName: "div", type: "DomElementNode" }], tagName: "div", templateRefName: { name: "hidden", value: "", type: "Attribute" }, type: "DomElementNode" },
7
+ signals: [{ signal: "viewChild", options: [{ name: "hidden", alias: "hidden" }] }]
8
+ })];
9
+ let _classDescriptor;
10
+ let _classExtraInitializers = [];
11
+ let _classThis;
12
+ var LazyHiddenViewComponent = class {
13
+ static { _classThis = this; }
14
+ static {
15
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
16
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
17
+ LazyHiddenViewComponent = _classThis = _classDescriptor.value;
18
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
19
+ __runInitializers(_classThis, _classExtraInitializers);
20
+ }
21
+ hidden = viewChild('hidden');
22
+ hide(nativeElement) {
23
+ const div = this.hidden.get();
24
+ if (div.moveBefore && div.lastChild) {
25
+ div.moveBefore(nativeElement, div.lastChild);
26
+ }
27
+ else if (div.lastChild) {
28
+ div.lastChild.before(nativeElement);
29
+ }
30
+ }
31
+ };
32
+ return LazyHiddenViewComponent = _classThis;
33
+ })();
34
+ export { LazyHiddenViewComponent };
35
+ let LazyOutletComponent = (() => {
36
+ let _classDecorators = [Directive({
37
+ selector: '*lazy-outlet',
38
+ imports: [LazyHiddenViewComponent]
39
+ })];
40
+ let _classDescriptor;
41
+ let _classExtraInitializers = [];
42
+ let _classThis;
43
+ let _classSuper = StructuralDirective;
44
+ var LazyOutletComponent = class extends _classSuper {
45
+ static { _classThis = this; }
46
+ static {
47
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
48
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
49
+ LazyOutletComponent = _classThis = _classDescriptor.value;
50
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
51
+ __runInitializers(_classThis, _classExtraInitializers);
52
+ }
53
+ viewRef = new Map();
54
+ hiddenView = this.viewContainerRef.createComponent(LazyHiddenViewComponent);
55
+ currentType;
56
+ component = input.required({
57
+ transform: (componentType) => {
58
+ if (componentType === this.currentType) {
59
+ return;
60
+ }
61
+ const ref = this.viewRef.get(this.currentType);
62
+ if (ref) {
63
+ const index = this.viewContainerRef.indexOf(ref.viewRef);
64
+ this.viewContainerRef.remove(index, false);
65
+ this.hiddenView.instance.hide(ref.nativeElement);
66
+ }
67
+ if (this.viewRef.has(componentType) && componentType) {
68
+ const oldView = this.viewRef.get(componentType);
69
+ this.viewContainerRef.adopt(oldView.viewRef);
70
+ this.currentType = componentType;
71
+ }
72
+ else if (componentType) {
73
+ const newRef = this.viewContainerRef.createComponent(componentType);
74
+ this.viewRef.set(componentType, newRef);
75
+ this.currentType = componentType;
76
+ }
77
+ else {
78
+ this.currentType = undefined;
79
+ }
80
+ }
81
+ });
82
+ onDestroy() {
83
+ this.viewContainerRef.clear();
84
+ }
85
+ };
86
+ return LazyOutletComponent = _classThis;
87
+ })();
88
+ export { LazyOutletComponent };
89
+ //# sourceMappingURL=lazy-outlet.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lazy-outlet.js","sourceRoot":"","sources":["../../../src/router/components/lazy-outlet.ts"],"names":[],"mappings":";AAAA,OAAO,EACN,SAAS,EAAoB,SAAS,EAAE,KAAK,EAClC,mBAAmB,EAAQ,SAAS,EAC/C,MAAM,aAAa,CAAC;IAOR,uBAAuB;4BAJnC,SAAS,CAAC;YACV,QAAQ,EAAE,kBAAkB;YAC5B,8nBAAgE;;SAChE,CAAC;;;;;;;;YACF,6KAaC;;;YAbY,uDAAuB;;QAE3B,MAAM,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC;QAErC,IAAI,CAAC,aAA0B;YAC9B,MAAM,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,EAA8E,CAAC;YAC1G,IAAI,GAAG,CAAC,UAAU,IAAI,GAAG,CAAC,SAAS,EAAE,CAAC;gBACrC,GAAG,CAAC,UAAU,CAAC,aAAa,EAAE,GAAG,CAAC,SAAS,CAAC,CAAC;YAC9C,CAAC;iBAAM,IAAI,GAAG,CAAC,SAAS,EAAE,CAAC;gBAC1B,GAAG,CAAC,SAAS,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;YACrC,CAAC;QACF,CAAC;;;;SAXW,uBAAuB;IAoBvB,mBAAmB;4BAJ/B,SAAS,CAAC;YACV,QAAQ,EAAE,cAAc;YACxB,OAAO,EAAE,CAAC,uBAAuB,CAAC;SAClC,CAAC;;;;sBACqD,mBAAmB;mCAA3B,SAAQ,WAAmB;;;;YAA1E,6KAmCC;;;YAnCY,uDAAmB;;QAEvB,OAAO,GAAG,IAAI,GAAG,EAAgC,CAAC;QAClD,UAAU,GAAG,IAAI,CAAC,gBAAgB,CAAC,eAAe,CAAC,uBAAuB,CAAC,CAAC;QAC5E,WAAW,CAAsB;QAEzC,SAAS,GAAG,KAAK,CAAC,QAAQ,CAAC;YAC1B,SAAS,EAAE,CAAC,aAAuB,EAAE,EAAE;gBACtC,IAAI,aAAa,KAAK,IAAI,CAAC,WAAW,EAAE,CAAC;oBACxC,OAAO;gBACR,CAAC;gBACD,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,WAAY,CAAC,CAAC;gBAChD,IAAI,GAAG,EAAE,CAAC;oBACT,MAAM,KAAK,GAAG,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;oBACzD,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;oBAC3C,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;gBAClD,CAAC;gBACD,IAAI,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,aAAc,CAAC,IAAI,aAAa,EAAE,CAAC;oBACvD,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,aAAa,CAAE,CAAC;oBACjD,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;oBAC7C,IAAI,CAAC,WAAW,GAAG,aAAa,CAAC;gBAClC,CAAC;qBAAM,IAAI,aAAa,EAAE,CAAC;oBAC1B,MAAM,MAAM,GAAG,IAAI,CAAC,gBAAgB,CAAC,eAAe,CAAI,aAAa,CAAC,CAAC;oBACvE,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC;oBACxC,IAAI,CAAC,WAAW,GAAG,aAAa,CAAC;gBAClC,CAAC;qBAAM,CAAC;oBACP,IAAI,CAAC,WAAW,GAAG,SAAS,CAAC;gBAC9B,CAAC;YACF,CAAC;SACD,CAAC,CAAC;QAEH,SAAS;YACR,IAAI,CAAC,gBAAgB,CAAC,KAAK,EAAE,CAAC;QAC/B,CAAC;;;;SAjCW,mBAAmB","sourcesContent":["import {\n\tComponent, ComponentViewRef, Directive, input,\n\tOnDestroy, StructuralDirective, Type, viewChild\n} from '@ibyar/core';\n\n\n@Component({\n\tselector: 'lazy-hidden-view',\n\ttemplate: `<div #hidden style=\"display: none\"><div></div></div>`\n})\nexport class LazyHiddenViewComponent {\n\n\tprivate hidden = viewChild('hidden');\n\n\thide(nativeElement: HTMLElement) {\n\t\tconst div = this.hidden.get() as HTMLDivElement & { moveBefore?: (node: Node, child: ChildNode) => void };\n\t\tif (div.moveBefore && div.lastChild) {\n\t\t\tdiv.moveBefore(nativeElement, div.lastChild);\n\t\t} else if (div.lastChild) {\n\t\t\tdiv.lastChild.before(nativeElement);\n\t\t}\n\t}\n\n}\n\n\n@Directive({\n\tselector: '*lazy-outlet',\n\timports: [LazyHiddenViewComponent]\n})\nexport class LazyOutletComponent<C extends {}> extends StructuralDirective implements OnDestroy {\n\n\tprivate viewRef = new Map<Type<C>, ComponentViewRef<C>>();\n\tprivate hiddenView = this.viewContainerRef.createComponent(LazyHiddenViewComponent);\n\tprivate currentType: Type<C> | undefined;\n\n\tcomponent = input.required({\n\t\ttransform: (componentType?: Type<C>) => {\n\t\t\tif (componentType === this.currentType) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst ref = this.viewRef.get(this.currentType!);\n\t\t\tif (ref) {\n\t\t\t\tconst index = this.viewContainerRef.indexOf(ref.viewRef);\n\t\t\t\tthis.viewContainerRef.remove(index, false);\n\t\t\t\tthis.hiddenView.instance.hide(ref.nativeElement);\n\t\t\t}\n\t\t\tif (this.viewRef.has(componentType!) && componentType) {\n\t\t\t\tconst oldView = this.viewRef.get(componentType)!;\n\t\t\t\tthis.viewContainerRef.adopt(oldView.viewRef);\n\t\t\t\tthis.currentType = componentType;\n\t\t\t} else if (componentType) {\n\t\t\t\tconst newRef = this.viewContainerRef.createComponent<C>(componentType);\n\t\t\t\tthis.viewRef.set(componentType, newRef);\n\t\t\t\tthis.currentType = componentType;\n\t\t\t} else {\n\t\t\t\tthis.currentType = undefined;\n\t\t\t}\n\t\t}\n\t});\n\n\tonDestroy() {\n\t\tthis.viewContainerRef.clear();\n\t}\n\n}\n"]}
package/index.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ export * from './components/component-outlet.js';
2
+ export * from './components/lazy-outlet.js';
3
+ export * from './routes/router-outlet.js';
4
+ //# sourceMappingURL=index.d.ts.map
package/index.d.ts.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/router/index.ts"],"names":[],"mappings":"AACA,cAAc,kCAAkC,CAAC;AACjD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,2BAA2B,CAAC"}
package/index.js ADDED
@@ -0,0 +1,4 @@
1
+ export * from './components/component-outlet.js';
2
+ export * from './components/lazy-outlet.js';
3
+ export * from './routes/router-outlet.js';
4
+ //# sourceMappingURL=index.js.map
package/index.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/router/index.ts"],"names":[],"mappings":"AACA,cAAc,kCAAkC,CAAC;AACjD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,2BAA2B,CAAC","sourcesContent":["\nexport * from './components/component-outlet.js';\nexport * from './components/lazy-outlet.js';\nexport * from './routes/router-outlet.js';"]}
package/package.json ADDED
@@ -0,0 +1,57 @@
1
+ {
2
+ "name": "@ibyar/router",
3
+ "version": "4.0.0",
4
+ "description": "Ibyar router has the built-in directives for router and navigation",
5
+ "license": "MIT",
6
+ "homepage": "https://github.com/ibyar/aurora/tree/dev/packages/router",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/ibyar/aurora.git",
10
+ "directory": "packages/router"
11
+ },
12
+ "bugs": {
13
+ "url": "https://github.com/ibyar/aurora/issues"
14
+ },
15
+ "author": "The Ibyar Authors (https://github.com/ibyar/aurora/graphs/contributors)",
16
+ "contributors": [
17
+ {
18
+ "name": "Muhammad Salem",
19
+ "email": "salem.ebo@gmail.com",
20
+ "url": "https://github.com/muhammad-salem"
21
+ }
22
+ ],
23
+ "main": "./index.js",
24
+ "module": "./index.js",
25
+ "types": "./index.d.ts",
26
+ "type": "module",
27
+ "exports": {
28
+ ".": "./index.js"
29
+ },
30
+ "files": [
31
+ "*"
32
+ ],
33
+ "publishConfig": {
34
+ "access": "public"
35
+ },
36
+ "dependencies": {
37
+ "@ibyar/core": "^4.0.0",
38
+ "@ibyar/elements": "^4.0.0",
39
+ "@ibyar/platform": "^4.0.0",
40
+ "tslib": "^2.8.1"
41
+ },
42
+ "devDependencies": {
43
+ "typescript": "^5.8.3"
44
+ },
45
+ "scripts": {
46
+ "build": "tsc --build --verbose",
47
+ "docs": "npx typedoc --tsconfig ../../src/router/tsconfig.json"
48
+ },
49
+ "keywords": [
50
+ "aurora",
51
+ "ibyar",
52
+ "router",
53
+ "typescript",
54
+ "front-end"
55
+ ],
56
+ "gitHead": "6671356b7c827061a32d138db5cad660ad0053c5"
57
+ }
@@ -0,0 +1,21 @@
1
+ import { OnDestroy, StructuralDirective } from '@ibyar/core';
2
+ export interface RouteData {
3
+ selector: string;
4
+ is?: string;
5
+ }
6
+ export declare class RouterOutlet extends StructuralDirective implements OnDestroy {
7
+ data: import("@ibyar/core").InputWithTransform<void, RouteData | undefined>;
8
+ onDestroy(): void;
9
+ }
10
+ export type ɵɵ0RouterOutletDirective0ɵɵ = {
11
+ selector: "*router-outlet";
12
+ successors: [
13
+ ];
14
+ inputs: [
15
+ {
16
+ name: "data";
17
+ aliasName: "data";
18
+ }
19
+ ];
20
+ };
21
+ //# sourceMappingURL=router-outlet.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"router-outlet.d.ts","sourceRoot":"","sources":["../../../src/router/routes/router-outlet.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,SAAS,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAG/E,MAAM,WAAW,SAAS;IAAG,QAAQ,EAAE,MAAM,CAAC;IAAC,EAAE,CAAC,EAAE,MAAM,CAAA;CAAE;AAE5D,qBAGa,YAAa,SAAQ,mBAAoB,YAAW,SAAS;IAEzE,IAAI,wEAKD;IAEH,SAAS;CAIT;AArBD,MAAM,MAAK,2BAA4B,GAAE;IAAE,QAAQ,EAAC,gBAAiB,CAAC;IAAA,UACtE,EAEA;KAAE,CAAC;IAAA,MAAM,EAAC;QAAE;YAAC,IAAI,EAAC,MAAO,CAAC;YAAC,SAAS,EAAC,MAAO,CAAA;SAAC;KAAC,CAAA;CAAC,CAAC"}
@@ -0,0 +1,34 @@
1
+ import { __esDecorate, __runInitializers } from "tslib";
2
+ import { Directive, input, StructuralDirective } from '@ibyar/core';
3
+ ;
4
+ let RouterOutlet = (() => {
5
+ let _classDecorators = [Directive({
6
+ selector: '*router-outlet',
7
+ })];
8
+ let _classDescriptor;
9
+ let _classExtraInitializers = [];
10
+ let _classThis;
11
+ let _classSuper = StructuralDirective;
12
+ var RouterOutlet = class extends _classSuper {
13
+ static { _classThis = this; }
14
+ static {
15
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
16
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
17
+ RouterOutlet = _classThis = _classDescriptor.value;
18
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
19
+ __runInitializers(_classThis, _classExtraInitializers);
20
+ }
21
+ data = input.required({
22
+ transform: (routeData) => {
23
+ this.viewContainerRef.clear();
24
+ routeData && this.viewContainerRef.createComponent(routeData.selector);
25
+ },
26
+ });
27
+ onDestroy() {
28
+ this.viewContainerRef.clear();
29
+ }
30
+ };
31
+ return RouterOutlet = _classThis;
32
+ })();
33
+ export { RouterOutlet };
34
+ //# sourceMappingURL=router-outlet.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"router-outlet.js","sourceRoot":"","sources":["../../../src/router/routes/router-outlet.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAa,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAGnB,CAAC;IAKhD,YAAY;4BAHxB,SAAS,CAAC;YACV,QAAQ,EAAE,gBAAgB;SAC1B,CAAC;;;;sBACgC,mBAAmB;4BAA3B,SAAQ,WAAmB;;;;YAArD,6KAaC;;;YAbY,uDAAY;;QAExB,IAAI,GAAG,KAAK,CAAC,QAAQ,CAAC;YACrB,SAAS,EAAE,CAAC,SAAqB,EAAE,EAAE;gBACpC,IAAI,CAAC,gBAAgB,CAAC,KAAK,EAAE,CAAC;gBAC9B,SAAS,IAAI,IAAI,CAAC,gBAAgB,CAAC,eAAe,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;YACxE,CAAC;SACD,CAAC,CAAC;QAEH,SAAS;YACR,IAAI,CAAC,gBAAgB,CAAC,KAAK,EAAE,CAAC;QAC/B,CAAC;;;;SAXW,YAAY","sourcesContent":["import { Directive, input, OnDestroy, StructuralDirective } from '@ibyar/core';\n\n\nexport interface RouteData { selector: string, is?: string };\n\n@Directive({\n\tselector: '*router-outlet',\n})\nexport class RouterOutlet extends StructuralDirective implements OnDestroy {\n\n\tdata = input.required({\n\t\ttransform: (routeData?: RouteData) => {\n\t\t\tthis.viewContainerRef.clear();\n\t\t\trouteData && this.viewContainerRef.createComponent(routeData.selector);\n\t\t},\n\t});\n\n\tonDestroy() {\n\t\tthis.viewContainerRef.clear();\n\t}\n\n}\n"]}
package/typedoc.json ADDED
@@ -0,0 +1,8 @@
1
+ {
2
+ "extends": [
3
+ "../../typedoc.base.json"
4
+ ],
5
+ "entryPoints": [
6
+ "../../src/router/index.ts"
7
+ ]
8
+ }