piral-ng 1.0.0-pre.2296 → 1.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 +1 -1
- package/README.md +701 -42
- package/common/NgExtension.d.ts +14 -0
- package/common/ResourceUrlPipe.d.ts +10 -0
- package/common/SharedModule.d.ts +10 -0
- package/common/esm2022/NgExtension.mjs +47 -0
- package/common/esm2022/ResourceUrlPipe.mjs +23 -0
- package/common/esm2022/SharedModule.mjs +25 -0
- package/common/esm2022/piral-ng-common.mjs +5 -0
- package/common/esm2022/public_api.mjs +4 -0
- package/common/fesm2022/piral-ng-common.mjs +93 -0
- package/common/fesm2022/piral-ng-common.mjs.map +1 -0
- package/common/index.d.ts +1 -0
- package/common/package.json +35 -0
- package/common/piral-ng-common.js +3 -0
- package/common/public_api.d.ts +3 -0
- package/convert.d.ts +17 -7
- package/convert.js +17 -11
- package/esm/RoutingService.d.ts +13 -0
- package/esm/RoutingService.js +109 -0
- package/esm/RoutingService.js.map +1 -0
- package/esm/bootstrap.d.ts +6 -5
- package/esm/bootstrap.js +52 -87
- package/esm/bootstrap.js.map +1 -1
- package/esm/common/NgExtension.d.ts +11 -0
- package/esm/common/NgExtension.js +41 -0
- package/esm/common/NgExtension.js.map +1 -0
- package/esm/common/ResourceUrlPipe.d.ts +7 -0
- package/esm/common/ResourceUrlPipe.js +18 -0
- package/esm/common/ResourceUrlPipe.js.map +1 -0
- package/esm/common/SharedModule.d.ts +3 -0
- package/esm/common/SharedModule.js +21 -0
- package/esm/common/SharedModule.js.map +1 -0
- package/esm/common/public_api.d.ts +3 -0
- package/esm/common/public_api.js +4 -0
- package/esm/common/public_api.js.map +1 -0
- package/esm/converter.d.ts +10 -2
- package/esm/converter.js +35 -16
- package/esm/converter.js.map +1 -1
- package/esm/create.d.ts +2 -16
- package/esm/create.js +9 -13
- package/esm/create.js.map +1 -1
- package/esm/module.d.ts +24 -0
- package/esm/module.js +131 -0
- package/esm/module.js.map +1 -0
- package/esm/queue.d.ts +1 -1
- package/esm/queue.js +3 -3
- package/esm/queue.js.map +1 -1
- package/esm/startup.d.ts +8 -0
- package/esm/startup.js +115 -0
- package/esm/startup.js.map +1 -0
- package/esm/types.d.ts +71 -3
- package/esm/utils.d.ts +18 -0
- package/esm/utils.js +46 -0
- package/esm/utils.js.map +1 -0
- package/extend-webpack.js +107 -0
- package/lib/RoutingService.d.ts +13 -0
- package/lib/RoutingService.js +112 -0
- package/lib/RoutingService.js.map +1 -0
- package/lib/bootstrap.d.ts +6 -5
- package/lib/bootstrap.js +55 -91
- package/lib/bootstrap.js.map +1 -1
- package/lib/common/NgExtension.d.ts +11 -0
- package/lib/common/NgExtension.js +44 -0
- package/lib/common/NgExtension.js.map +1 -0
- package/lib/common/ResourceUrlPipe.d.ts +7 -0
- package/lib/common/ResourceUrlPipe.js +21 -0
- package/lib/common/ResourceUrlPipe.js.map +1 -0
- package/lib/common/SharedModule.d.ts +3 -0
- package/lib/common/SharedModule.js +24 -0
- package/lib/common/SharedModule.js.map +1 -0
- package/lib/common/public_api.d.ts +3 -0
- package/lib/common/public_api.js +7 -0
- package/lib/common/public_api.js.map +1 -0
- package/lib/converter.d.ts +10 -2
- package/lib/converter.js +36 -17
- package/lib/converter.js.map +1 -1
- package/lib/create.d.ts +2 -16
- package/lib/create.js +10 -14
- package/lib/create.js.map +1 -1
- package/lib/index.js +1 -1
- package/lib/module.d.ts +24 -0
- package/lib/module.js +139 -0
- package/lib/module.js.map +1 -0
- package/lib/queue.d.ts +1 -1
- package/lib/queue.js +3 -3
- package/lib/queue.js.map +1 -1
- package/lib/startup.d.ts +8 -0
- package/lib/startup.js +120 -0
- package/lib/startup.js.map +1 -0
- package/lib/types.d.ts +71 -3
- package/lib/utils.d.ts +18 -0
- package/lib/utils.js +55 -0
- package/lib/utils.js.map +1 -0
- package/package.json +51 -16
- package/src/RoutingService.ts +114 -0
- package/src/bootstrap.ts +57 -104
- package/src/common/NgExtension.ts +33 -0
- package/src/common/ResourceUrlPipe.ts +12 -0
- package/src/common/SharedModule.ts +18 -0
- package/src/common/index.d.ts +1 -0
- package/src/common/ng-package.json +11 -0
- package/src/common/package.json +19 -0
- package/src/common/piral-ng-common.js +3 -0
- package/src/common/public_api.ts +3 -0
- package/src/converter.ts +58 -20
- package/src/create.ts +6 -23
- package/src/module.ts +163 -0
- package/src/queue.ts +1 -1
- package/src/startup.ts +148 -0
- package/src/types.ts +73 -3
- package/src/utils.ts +69 -0
- package/convert.ts +0 -16
- package/esm/extension.d.ts +0 -1
- package/esm/extension.js +0 -41
- package/esm/extension.js.map +0 -1
- package/lib/extension.d.ts +0 -1
- package/lib/extension.js +0 -45
- package/lib/extension.js.map +0 -1
- package/src/extension.ts +0 -29
package/lib/bootstrap.js
CHANGED
|
@@ -1,98 +1,62 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
function
|
|
9
|
-
return
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}
|
|
47
|
-
exports.bootstrap = bootstrap;
|
|
48
|
-
function bootstrapComponent(context, props, component, node, id) {
|
|
49
|
-
var piral = props.piral;
|
|
50
|
-
var declarations = [component, piral.NgExtension];
|
|
51
|
-
node.id = sanatize(id);
|
|
52
|
-
setComponentSelector(component, node.id);
|
|
53
|
-
var BootstrapModule = /** @class */ (function () {
|
|
54
|
-
function BootstrapModule() {
|
|
3
|
+
exports.bootstrap = exports.prepareBootstrap = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const module_1 = require("./module");
|
|
6
|
+
const utils_1 = require("./utils");
|
|
7
|
+
const startup_1 = require("./startup");
|
|
8
|
+
function prepareBootstrap(moduleOrComponent, piral) {
|
|
9
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
10
|
+
if ('module' in moduleOrComponent && typeof moduleOrComponent.module === 'function') {
|
|
11
|
+
if (!(moduleOrComponent.state.current instanceof Promise)) {
|
|
12
|
+
moduleOrComponent.state.current = moduleOrComponent.module().then((result) => {
|
|
13
|
+
if (typeof result !== 'object' || !('default' in result)) {
|
|
14
|
+
throw new Error('The lazy loaded module does not `default` export a NgModule class.');
|
|
15
|
+
}
|
|
16
|
+
(0, module_1.defineModule)(result.default, moduleOrComponent.opts);
|
|
17
|
+
return (0, module_1.findModule)(result.default);
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
const moduleDef = yield moduleOrComponent.state.current;
|
|
21
|
+
const { components } = moduleDef;
|
|
22
|
+
const component = components.find((m) => (0, utils_1.hasSelector)(m, moduleOrComponent.selector));
|
|
23
|
+
if (!component) {
|
|
24
|
+
throw new Error(`No component matching the selector "${moduleOrComponent.selector}" has been found.`);
|
|
25
|
+
}
|
|
26
|
+
return [...(0, module_1.activateModuleInstance)(moduleDef, piral), component];
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
const [annotation] = (0, utils_1.getAnnotations)(moduleOrComponent);
|
|
30
|
+
const standalone = annotation === null || annotation === void 0 ? void 0 : annotation.standalone;
|
|
31
|
+
// first way is to directly use a module, which is the legacy way
|
|
32
|
+
// second way is to find a previously defined Angular module
|
|
33
|
+
if (annotation && annotation.bootstrap) {
|
|
34
|
+
// usually contains things like imports, exports, declarations, ...
|
|
35
|
+
const [component] = annotation.bootstrap;
|
|
36
|
+
annotation.exports = [component];
|
|
37
|
+
(0, module_1.defineModule)(moduleOrComponent);
|
|
38
|
+
return [...(0, module_1.getModuleInstance)(component, standalone, piral), component];
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
// usually contains things like selector, template or templateUrl, changeDetection, ...
|
|
42
|
+
const result = (0, module_1.getModuleInstance)(moduleOrComponent, standalone, piral) ||
|
|
43
|
+
(0, module_1.createModuleInstance)(moduleOrComponent, standalone, piral);
|
|
44
|
+
return [...result, moduleOrComponent];
|
|
45
|
+
}
|
|
55
46
|
}
|
|
56
|
-
|
|
57
|
-
core_1.NgModule({
|
|
58
|
-
imports: [platform_browser_1.BrowserModule],
|
|
59
|
-
providers: [
|
|
60
|
-
{
|
|
61
|
-
provide: 'piral',
|
|
62
|
-
useValue: piral,
|
|
63
|
-
},
|
|
64
|
-
],
|
|
65
|
-
declarations: declarations,
|
|
66
|
-
bootstrap: [component],
|
|
67
|
-
})
|
|
68
|
-
], BootstrapModule);
|
|
69
|
-
return BootstrapModule;
|
|
70
|
-
}());
|
|
71
|
-
return startup(context, props, BootstrapModule, node);
|
|
47
|
+
});
|
|
72
48
|
}
|
|
73
|
-
exports.
|
|
74
|
-
function
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
var declarations = annotation.declarations || [];
|
|
82
|
-
var component = (annotation.bootstrap || [])[0];
|
|
83
|
-
annotation.providers = tslib_1.__spreadArrays(providers, [
|
|
84
|
-
{
|
|
85
|
-
provide: 'piral',
|
|
86
|
-
useValue: piral,
|
|
87
|
-
},
|
|
88
|
-
]);
|
|
89
|
-
annotation.declarations = tslib_1.__spreadArrays(declarations, [piral.NgExtension]);
|
|
90
|
-
if (component) {
|
|
91
|
-
setComponentSelector(component, node.id);
|
|
92
|
-
annotation.bootstrap = [component];
|
|
49
|
+
exports.prepareBootstrap = prepareBootstrap;
|
|
50
|
+
function bootstrap(result, node, props, context) {
|
|
51
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
52
|
+
const [selectedModule, ngOptions, component] = result;
|
|
53
|
+
const ref = yield (0, startup_1.startup)(selectedModule, context, ngOptions);
|
|
54
|
+
if (ref) {
|
|
55
|
+
ref.instance.attach(component, node, props);
|
|
56
|
+
return () => ref.instance.detach(component, node);
|
|
93
57
|
}
|
|
94
|
-
|
|
95
|
-
|
|
58
|
+
return () => { };
|
|
59
|
+
});
|
|
96
60
|
}
|
|
97
|
-
exports.
|
|
61
|
+
exports.bootstrap = bootstrap;
|
|
98
62
|
//# sourceMappingURL=bootstrap.js.map
|
package/lib/bootstrap.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bootstrap.js","sourceRoot":"","sources":["../src/bootstrap.ts"],"names":[],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"bootstrap.js","sourceRoot":"","sources":["../src/bootstrap.ts"],"names":[],"mappings":";;;;AAIA,qCAAqH;AACrH,mCAAsD;AACtD,uCAAoC;AAEpC,SAAsB,gBAAgB,CACpC,iBAAyC,EACzC,KAAe;;QAEf,IAAI,QAAQ,IAAI,iBAAiB,IAAI,OAAO,iBAAiB,CAAC,MAAM,KAAK,UAAU,EAAE;YACnF,IAAI,CAAC,CAAC,iBAAiB,CAAC,KAAK,CAAC,OAAO,YAAY,OAAO,CAAC,EAAE;gBACzD,iBAAiB,CAAC,KAAK,CAAC,OAAO,GAAG,iBAAiB,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE;oBAC3E,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,CAAC,CAAC,SAAS,IAAI,MAAM,CAAC,EAAE;wBACxD,MAAM,IAAI,KAAK,CAAC,oEAAoE,CAAC,CAAC;qBACvF;oBAED,IAAA,qBAAY,EAAC,MAAM,CAAC,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E,KAAK,CAAC;oBACvD,IAAA,6BAAoB,EAAC,iBAAiB,EAAE,UAAU,EAAE,KAAK,CAAC,CAAC;gBAC7D,OAAO,CAAC,GAAG,MAAM,EAAE,iBAAiB,CAAC,CAAC;aACvC;SACF;IACH,CAAC;CAAA;AA7CD,4CA6CC;AAED,SAAsB,SAAS,CAC7B,MAA8B,EAC9B,IAAiB,EACjB,KAA8B,EAC9B,OAAyB;;QAEzB,MAAM,CAAC,cAAc,EAAE,SAAS,EAAE,SAAS,CAAC,GAAG,MAAM,CAAC;QACtD,MAAM,GAAG,GAAG,MAAM,IAAA,iBAAO,EAAC,cAAc,EAAE,OAAO,EAAE,SAAS,CAAC,CAAC;QAE9D,IAAI,GAAG,EAAE;YACP,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,SAAS,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;YAC5C,OAAO,GAAG,EAAE,CAAC,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;SACnD;QAED,OAAO,GAAG,EAAE,GAAE,CAAC,CAAC;IAClB,CAAC;CAAA;AAfD,8BAeC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { PiletApi } from 'piral-core';
|
|
2
|
+
import { ElementRef, OnChanges } from '@angular/core';
|
|
3
|
+
export declare class NgExtension implements OnChanges {
|
|
4
|
+
private elRef;
|
|
5
|
+
private piral;
|
|
6
|
+
name: string | undefined;
|
|
7
|
+
params: object | undefined;
|
|
8
|
+
constructor(elRef: ElementRef<HTMLElement>, piral: PiletApi);
|
|
9
|
+
ngOnChanges(): void;
|
|
10
|
+
ngAfterContentInit(): void;
|
|
11
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NgExtension = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const core_1 = require("@angular/core");
|
|
6
|
+
const selector = 'extension-component';
|
|
7
|
+
let NgExtension = class NgExtension {
|
|
8
|
+
constructor(elRef, piral) {
|
|
9
|
+
this.elRef = elRef;
|
|
10
|
+
this.piral = piral;
|
|
11
|
+
}
|
|
12
|
+
ngOnChanges() {
|
|
13
|
+
this.elRef.nativeElement.dispatchEvent(new CustomEvent('extension-props-changed', {
|
|
14
|
+
detail: {
|
|
15
|
+
name: this.name,
|
|
16
|
+
params: this.params,
|
|
17
|
+
},
|
|
18
|
+
}));
|
|
19
|
+
}
|
|
20
|
+
ngAfterContentInit() {
|
|
21
|
+
this.piral.renderHtmlExtension(this.elRef.nativeElement, {
|
|
22
|
+
name: this.name,
|
|
23
|
+
params: this.params,
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
tslib_1.__decorate([
|
|
28
|
+
(0, core_1.Input)('name'),
|
|
29
|
+
tslib_1.__metadata("design:type", String)
|
|
30
|
+
], NgExtension.prototype, "name", void 0);
|
|
31
|
+
tslib_1.__decorate([
|
|
32
|
+
(0, core_1.Input)('params'),
|
|
33
|
+
tslib_1.__metadata("design:type", Object)
|
|
34
|
+
], NgExtension.prototype, "params", void 0);
|
|
35
|
+
NgExtension = tslib_1.__decorate([
|
|
36
|
+
(0, core_1.Component)({
|
|
37
|
+
selector,
|
|
38
|
+
template: '',
|
|
39
|
+
}),
|
|
40
|
+
tslib_1.__param(1, (0, core_1.Inject)('piral')),
|
|
41
|
+
tslib_1.__metadata("design:paramtypes", [core_1.ElementRef, Object])
|
|
42
|
+
], NgExtension);
|
|
43
|
+
exports.NgExtension = NgExtension;
|
|
44
|
+
//# sourceMappingURL=NgExtension.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NgExtension.js","sourceRoot":"","sources":["../../src/common/NgExtension.ts"],"names":[],"mappings":";;;;AACA,wCAAgF;AAEhF,MAAM,QAAQ,GAAG,qBAAqB,CAAC;AAEvC,IAIa,WAAW,GAJxB,MAIa,WAAW;IAItB,YAAoB,KAA8B,EAA2B,KAAe;QAAxE,UAAK,GAAL,KAAK,CAAyB;QAA2B,UAAK,GAAL,KAAK,CAAU;IAAG,CAAC;IAEhG,WAAW;QACT,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,aAAa,CACpC,IAAI,WAAW,CAAC,yBAAyB,EAAE;YACzC,MAAM,EAAE;gBACN,IAAI,EAAE,IAAI,CAAC,IAAI;gBACf,MAAM,EAAE,IAAI,CAAC,MAAM;aACpB;SACF,CAAC,CACH,CAAC;IACJ,CAAC;IAED,kBAAkB;QAChB,IAAI,CAAC,KAAK,CAAC,mBAAmB,CAAC,IAAI,CAAC,KAAK,CAAC,aAAa,EAAE;YACvD,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,MAAM,EAAE,IAAI,CAAC,MAAM;SACpB,CAAC,CAAC;IACL,CAAC;CACF,CAAA;AAtBuB;IAArB,IAAA,YAAK,EAAC,MAAM,CAAC;;yCAAiC;AACvB;IAAvB,IAAA,YAAK,EAAC,QAAQ,CAAC;;2CAAmC;AAFxC,WAAW;IAJvB,IAAA,gBAAS,EAAC;QACT,QAAQ;QACR,QAAQ,EAAE,EAAE;KACb,CAAC;IAKqD,mBAAA,IAAA,aAAM,EAAC,OAAO,CAAC,CAAA;6CAAzC,iBAAU;GAJ1B,WAAW,CAuBvB;AAvBY,kCAAW"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ResourceUrlPipe = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const core_1 = require("@angular/core");
|
|
6
|
+
let ResourceUrlPipe = class ResourceUrlPipe {
|
|
7
|
+
constructor(piral) {
|
|
8
|
+
this.piral = piral;
|
|
9
|
+
}
|
|
10
|
+
transform(value) {
|
|
11
|
+
const { basePath = '/' } = this.piral.meta;
|
|
12
|
+
return basePath + value;
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
ResourceUrlPipe = tslib_1.__decorate([
|
|
16
|
+
(0, core_1.Pipe)({ name: 'resourceUrl' }),
|
|
17
|
+
tslib_1.__param(0, (0, core_1.Inject)('piral')),
|
|
18
|
+
tslib_1.__metadata("design:paramtypes", [Object])
|
|
19
|
+
], ResourceUrlPipe);
|
|
20
|
+
exports.ResourceUrlPipe = ResourceUrlPipe;
|
|
21
|
+
//# sourceMappingURL=ResourceUrlPipe.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ResourceUrlPipe.js","sourceRoot":"","sources":["../../src/common/ResourceUrlPipe.ts"],"names":[],"mappings":";;;;AACA,wCAA4D;AAE5D,IACa,eAAe,GAD5B,MACa,eAAe;IAC1B,YAAqC,KAAe;QAAf,UAAK,GAAL,KAAK,CAAU;IAAG,CAAC;IAExD,SAAS,CAAC,KAAa;QACrB,MAAM,EAAE,QAAQ,GAAG,GAAG,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC;QAC3C,OAAO,QAAQ,GAAG,KAAK,CAAC;IAC1B,CAAC;CACF,CAAA;AAPY,eAAe;IAD3B,IAAA,WAAI,EAAC,EAAE,IAAI,EAAE,aAAa,EAAE,CAAC;IAEf,mBAAA,IAAA,aAAM,EAAC,OAAO,CAAC,CAAA;;GADjB,eAAe,CAO3B;AAPY,0CAAe"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SharedModule = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const common_1 = require("@angular/common");
|
|
6
|
+
const core_1 = require("@angular/core");
|
|
7
|
+
const NgExtension_1 = require("./NgExtension");
|
|
8
|
+
const ResourceUrlPipe_1 = require("./ResourceUrlPipe");
|
|
9
|
+
const declarationsDef = [NgExtension_1.NgExtension, ResourceUrlPipe_1.ResourceUrlPipe];
|
|
10
|
+
const exportsDef = [NgExtension_1.NgExtension, ResourceUrlPipe_1.ResourceUrlPipe];
|
|
11
|
+
const importsDef = [common_1.CommonModule];
|
|
12
|
+
let SharedModule = class SharedModule {
|
|
13
|
+
};
|
|
14
|
+
SharedModule.props = {};
|
|
15
|
+
SharedModule = tslib_1.__decorate([
|
|
16
|
+
(0, core_1.NgModule)({
|
|
17
|
+
declarations: declarationsDef,
|
|
18
|
+
providers: [],
|
|
19
|
+
imports: importsDef,
|
|
20
|
+
exports: exportsDef,
|
|
21
|
+
})
|
|
22
|
+
], SharedModule);
|
|
23
|
+
exports.SharedModule = SharedModule;
|
|
24
|
+
//# sourceMappingURL=SharedModule.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SharedModule.js","sourceRoot":"","sources":["../../src/common/SharedModule.ts"],"names":[],"mappings":";;;;AAAA,4CAA+C;AAC/C,wCAAyC;AACzC,+CAA4C;AAC5C,uDAAoD;AAEpD,MAAM,eAAe,GAAG,CAAC,yBAAW,EAAE,iCAAe,CAAC,CAAC;AACvD,MAAM,UAAU,GAAG,CAAC,yBAAW,EAAE,iCAAe,CAAC,CAAC;AAClD,MAAM,UAAU,GAAG,CAAC,qBAAY,CAAC,CAAC;AAQlC,IAAa,YAAY,GAAzB,MAAa,YAAY;;AAChB,kBAAK,GAAG,EAAE,AAAL,CAAM;AADP,YAAY;IANxB,IAAA,eAAQ,EAAC;QACR,YAAY,EAAE,eAAe;QAC7B,SAAS,EAAE,EAAE;QACb,OAAO,EAAE,UAAU;QACnB,OAAO,EAAE,UAAU;KACpB,CAAC;GACW,YAAY,CAExB;AAFY,oCAAY"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
tslib_1.__exportStar(require("./SharedModule"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./NgExtension"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./ResourceUrlPipe"), exports);
|
|
7
|
+
//# sourceMappingURL=public_api.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"public_api.js","sourceRoot":"","sources":["../../src/common/public_api.ts"],"names":[],"mappings":";;;AAAA,yDAA+B;AAC/B,wDAA8B;AAC9B,4DAAkC"}
|
package/lib/converter.d.ts
CHANGED
|
@@ -1,2 +1,10 @@
|
|
|
1
|
-
import { ForeignComponent, BaseComponentProps } from 'piral-core';
|
|
2
|
-
|
|
1
|
+
import type { ForeignComponent, BaseComponentProps } from 'piral-core';
|
|
2
|
+
import type { NgModuleDefiner } from './types';
|
|
3
|
+
export interface NgConverterOptions {
|
|
4
|
+
}
|
|
5
|
+
export interface NgConverter {
|
|
6
|
+
<TProps extends BaseComponentProps>(component: any): ForeignComponent<TProps>;
|
|
7
|
+
defineModule: NgModuleDefiner;
|
|
8
|
+
Extension: any;
|
|
9
|
+
}
|
|
10
|
+
export declare function createConverter(_?: NgConverterOptions): NgConverter;
|
package/lib/converter.js
CHANGED
|
@@ -1,23 +1,42 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createConverter = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const rxjs_1 = require("rxjs");
|
|
6
|
+
const queue_1 = require("./queue");
|
|
7
|
+
const module_1 = require("./module");
|
|
8
|
+
const bootstrap_1 = require("./bootstrap");
|
|
9
|
+
const common_1 = require("../common");
|
|
10
|
+
function createConverter(_ = {}) {
|
|
11
|
+
const registry = new Map();
|
|
12
|
+
const convert = (component) => ({
|
|
13
|
+
mount(el, props, ctx, locals) {
|
|
14
|
+
locals.active = true;
|
|
15
|
+
if (!locals.props) {
|
|
16
|
+
locals.props = new rxjs_1.BehaviorSubject(props);
|
|
17
|
+
}
|
|
18
|
+
if (!locals.queued) {
|
|
19
|
+
locals.queued = Promise.resolve();
|
|
20
|
+
}
|
|
21
|
+
locals.queued = locals.queued.then(() => (0, queue_1.enqueue)(() => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
22
|
+
if (!registry.has(component)) {
|
|
23
|
+
registry.set(component, yield (0, bootstrap_1.prepareBootstrap)(component, props.piral));
|
|
24
|
+
}
|
|
25
|
+
if (locals.active) {
|
|
26
|
+
return yield (0, bootstrap_1.bootstrap)(registry.get(component), el, locals.props, ctx);
|
|
27
|
+
}
|
|
28
|
+
})));
|
|
29
|
+
},
|
|
30
|
+
update(el, props, ctx, locals) {
|
|
31
|
+
locals.props.next(props);
|
|
32
|
+
},
|
|
33
|
+
unmount(el, locals) {
|
|
34
|
+
locals.active = false;
|
|
35
|
+
locals.queued = locals.queued.then((dispose) => dispose && (0, queue_1.enqueue)(dispose));
|
|
36
|
+
},
|
|
37
|
+
});
|
|
38
|
+
convert.defineModule = module_1.defineModule;
|
|
39
|
+
convert.Extension = common_1.NgExtension;
|
|
21
40
|
return convert;
|
|
22
41
|
}
|
|
23
42
|
exports.createConverter = createConverter;
|
package/lib/converter.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"converter.js","sourceRoot":"","sources":["../src/converter.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"converter.js","sourceRoot":"","sources":["../src/converter.ts"],"names":[],"mappings":";;;;AAGA,+BAAuC;AACvC,mCAAkC;AAClC,qCAAwC;AACxC,2CAA0D;AAC1D,sCAAwC;AAgBxC,SAAgB,eAAe,CAAC,IAAwB,EAAE;IACxD,MAAM,QAAQ,GAAG,IAAI,GAAG,EAA+B,CAAC;IACxD,MAAM,OAAO,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eAAO,EAAC,OAAO,CAAC,CAAC,CAAC;QAC/E,CAAC;KACF,CAAC,CAAC;IACH,OAAO,CAAC,YAAY,GAAG,qBAAY,CAAC;IACpC,OAAO,CAAC,SAAS,GAAG,oBAAW,CAAC;IAChC,OAAO,OAAO,CAAC;AACjB,CAAC;AArCD,0CAqCC"}
|
package/lib/create.d.ts
CHANGED
|
@@ -1,24 +1,10 @@
|
|
|
1
1
|
import type { PiralPlugin } from 'piral-core';
|
|
2
2
|
import type { PiletNgApi } from './types';
|
|
3
|
+
import { NgConverterOptions } from './converter';
|
|
3
4
|
/**
|
|
4
5
|
* Available configuration options for the Angular plugin.
|
|
5
6
|
*/
|
|
6
|
-
export interface NgConfig {
|
|
7
|
-
/**
|
|
8
|
-
* Defines the name of the extension component.
|
|
9
|
-
* @default extension-component
|
|
10
|
-
*/
|
|
11
|
-
selector?: string;
|
|
12
|
-
/**
|
|
13
|
-
* Defines the name of the root element.
|
|
14
|
-
* @default slot
|
|
15
|
-
*/
|
|
16
|
-
rootName?: string;
|
|
17
|
-
/**
|
|
18
|
-
* Defines how the next ID for mounting is selected.
|
|
19
|
-
* By default a random number is used in conjunction with a `ng-` prefix.
|
|
20
|
-
*/
|
|
21
|
-
selectId?(): string;
|
|
7
|
+
export interface NgConfig extends NgConverterOptions {
|
|
22
8
|
}
|
|
23
9
|
/**
|
|
24
10
|
* Creates the Pilet API extensions for Angular.
|
package/lib/create.js
CHANGED
|
@@ -1,26 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createNgApi = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
const converter_1 = require("./converter");
|
|
5
|
+
const module_1 = require("./module");
|
|
6
6
|
/**
|
|
7
7
|
* Creates the Pilet API extensions for Angular.
|
|
8
8
|
*/
|
|
9
|
-
function createNgApi(config) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
var convert = converter_1.createConverter(selectId);
|
|
14
|
-
context.converters.ng = function (_a) {
|
|
15
|
-
var component = _a.component;
|
|
16
|
-
return convert(component);
|
|
17
|
-
};
|
|
9
|
+
function createNgApi(config = {}) {
|
|
10
|
+
return (context) => {
|
|
11
|
+
const convert = (0, converter_1.createConverter)(config);
|
|
12
|
+
context.converters.ng = ({ component }) => convert(component);
|
|
18
13
|
return {
|
|
19
|
-
NgExtension:
|
|
20
|
-
|
|
14
|
+
NgExtension: convert.Extension,
|
|
15
|
+
defineNgModule: module_1.defineModule,
|
|
16
|
+
fromNg(component) {
|
|
21
17
|
return {
|
|
22
18
|
type: 'ng',
|
|
23
|
-
component
|
|
19
|
+
component,
|
|
24
20
|
};
|
|
25
21
|
},
|
|
26
22
|
};
|
package/lib/create.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create.js","sourceRoot":"","sources":["../src/create.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"create.js","sourceRoot":"","sources":["../src/create.ts"],"names":[],"mappings":";;;AAEA,2CAAkE;AAClE,qCAAwC;AAOxC;;GAEG;AACH,SAAgB,WAAW,CAAC,SAAmB,EAAE;IAC/C,OAAO,CAAC,OAAO,EAAE,EAAE;QACjB,MAAM,OAAO,GAAG,IAAA,2BAAe,EAAC,MAAM,CAAC,CAAC;QACxC,OAAO,CAAC,UAAU,CAAC,EAAE,GAAG,CAAC,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;QAE9D,OAAO;YACL,WAAW,EAAE,OAAO,CAAC,SAAS;YAC9B,cAAc,EAAE,qBAAY;YAC5B,MAAM,CAAC,SAAS;gBACd,OAAO;oBACL,IAAI,EAAE,IAAI;oBACV,SAAS;iBACV,CAAC;YACJ,CAAC;SACF,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC;AAhBD,kCAgBC"}
|
package/lib/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
4
|
tslib_1.__exportStar(require("./create"), exports);
|
|
5
5
|
tslib_1.__exportStar(require("./types"), exports);
|
|
6
6
|
//# sourceMappingURL=index.js.map
|
package/lib/module.d.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { PiletApi } from 'piral-core';
|
|
2
|
+
import type { NgOptions, ModuleInstanceResult } from './types';
|
|
3
|
+
interface ModuleDefinition {
|
|
4
|
+
active: any;
|
|
5
|
+
module: any;
|
|
6
|
+
components: Array<any>;
|
|
7
|
+
opts: NgOptions;
|
|
8
|
+
}
|
|
9
|
+
export declare function activateModuleInstance(moduleDef: ModuleDefinition, piral: PiletApi): ModuleInstanceResult;
|
|
10
|
+
export declare function getModuleInstance(component: any, standalone: boolean, piral: PiletApi): ModuleInstanceResult;
|
|
11
|
+
export declare function createModuleInstance(component: any, standalone: boolean, piral: PiletApi): ModuleInstanceResult;
|
|
12
|
+
export declare function findModule(module: any): ModuleDefinition;
|
|
13
|
+
export declare function defineModule(module: any, opts?: NgOptions): (selector: string) => {
|
|
14
|
+
component: {
|
|
15
|
+
selector: string;
|
|
16
|
+
module: any;
|
|
17
|
+
opts: (import("@angular/core").CompilerOptions & import("@angular/core").BootstrapOptions) | (import("@angular/core").CompilerOptions & import("@angular/core").BootstrapOptions)[];
|
|
18
|
+
state: {
|
|
19
|
+
current: any;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
type: "ng";
|
|
23
|
+
};
|
|
24
|
+
export {};
|