piral-ng 0.15.0-alpha.3816 → 0.15.0-alpha.3905
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 +1 -1
- package/esm/converter.js +9 -8
- package/esm/converter.js.map +1 -1
- package/lib/converter.js +9 -8
- package/lib/converter.js.map +1 -1
- package/package.json +4 -7
- package/src/converter.ts +18 -8
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# [Piral Ng](https://piral.io) · [](https://github.com/smapiot/piral/blob/main/LICENSE) [](https://www.npmjs.com/package/piral-ng) [](https://jestjs.io) [](https://gitter.im/piral-io/community)
|
|
4
4
|
|
|
5
|
-
This is a plugin that only has a peer dependency to `
|
|
5
|
+
This is a plugin that only has a peer dependency to `rxjs`, `@angular/core` and related packages. What `piral-ng` brings to the table is a set of Pilet API extensions that can be used with `piral` or `piral-core`.
|
|
6
6
|
|
|
7
7
|
The set includes an Angular converter for any component registration, as well as a `fromNg` shortcut, a `defineNgModule` function, and a `NgExtension` component.
|
|
8
8
|
|
package/esm/converter.js
CHANGED
|
@@ -5,16 +5,17 @@ import { bootstrap, prepareBootstrap } from './bootstrap';
|
|
|
5
5
|
export function createConverter(_ = {}) {
|
|
6
6
|
const convert = (component) => {
|
|
7
7
|
const bootstrapped = prepareBootstrap(component);
|
|
8
|
-
let mounted = Promise.resolve();
|
|
9
|
-
let active = true;
|
|
10
8
|
return {
|
|
11
|
-
mount(el, props, ctx) {
|
|
12
|
-
active = true;
|
|
13
|
-
|
|
9
|
+
mount(el, props, ctx, locals) {
|
|
10
|
+
locals.active = true;
|
|
11
|
+
if (!locals.queued) {
|
|
12
|
+
locals.queued = Promise.resolve();
|
|
13
|
+
}
|
|
14
|
+
locals.queued = locals.queued.then(() => enqueue(() => locals.active && bootstrap(bootstrapped, el, props, ctx)));
|
|
14
15
|
},
|
|
15
|
-
unmount() {
|
|
16
|
-
active = false;
|
|
17
|
-
|
|
16
|
+
unmount(el, locals) {
|
|
17
|
+
locals.active = false;
|
|
18
|
+
locals.queued = locals.queued.then((dispose) => dispose && dispose());
|
|
18
19
|
},
|
|
19
20
|
};
|
|
20
21
|
};
|
package/esm/converter.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"converter.js","sourceRoot":"","sources":["../src/converter.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"converter.js","sourceRoot":"","sources":["../src/converter.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAe1D,MAAM,UAAU,eAAe,CAAC,IAAwB,EAAE;IACxD,MAAM,OAAO,GAAG,CAAoC,SAAc,EAA4B,EAAE;QAC9F,MAAM,YAAY,GAAG,gBAAgB,CAAC,SAAS,CAAC,CAAC;QAEjD,OAAO;YACL,KAAK,CAAC,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,MAAe;gBACnC,MAAM,CAAC,MAAM,GAAG,IAAI,CAAC;gBAErB,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE;oBAClB,MAAM,CAAC,MAAM,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;iBACnC;gBAED,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,CACtC,OAAO,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,MAAM,IAAI,SAAS,CAAC,YAAY,EAAE,EAAE,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC,CACxE,CAAC;YACJ,CAAC;YACD,OAAO,CAAC,EAAE,EAAE,MAAe;gBACzB,MAAM,CAAC,MAAM,GAAG,KAAK,CAAC;gBACtB,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,IAAI,OAAO,EAAE,CAAC,CAAC;YACxE,CAAC;SACF,CAAC;IACJ,CAAC,CAAC;IACF,OAAO,CAAC,YAAY,GAAG,YAAY,CAAC;IACpC,OAAO,CAAC,SAAS,GAAG,WAAW,CAAC;IAChC,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
package/lib/converter.js
CHANGED
|
@@ -8,16 +8,17 @@ const bootstrap_1 = require("./bootstrap");
|
|
|
8
8
|
function createConverter(_ = {}) {
|
|
9
9
|
const convert = (component) => {
|
|
10
10
|
const bootstrapped = (0, bootstrap_1.prepareBootstrap)(component);
|
|
11
|
-
let mounted = Promise.resolve();
|
|
12
|
-
let active = true;
|
|
13
11
|
return {
|
|
14
|
-
mount(el, props, ctx) {
|
|
15
|
-
active = true;
|
|
16
|
-
|
|
12
|
+
mount(el, props, ctx, locals) {
|
|
13
|
+
locals.active = true;
|
|
14
|
+
if (!locals.queued) {
|
|
15
|
+
locals.queued = Promise.resolve();
|
|
16
|
+
}
|
|
17
|
+
locals.queued = locals.queued.then(() => (0, queue_1.enqueue)(() => locals.active && (0, bootstrap_1.bootstrap)(bootstrapped, el, props, ctx)));
|
|
17
18
|
},
|
|
18
|
-
unmount() {
|
|
19
|
-
active = false;
|
|
20
|
-
|
|
19
|
+
unmount(el, locals) {
|
|
20
|
+
locals.active = false;
|
|
21
|
+
locals.queued = locals.queued.then((dispose) => dispose && dispose());
|
|
21
22
|
},
|
|
22
23
|
};
|
|
23
24
|
};
|
package/lib/converter.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"converter.js","sourceRoot":"","sources":["../src/converter.ts"],"names":[],"mappings":";;;AAEA,+CAA4C;AAC5C,mCAAkC;AAClC,qCAAwC;AACxC,2CAA0D;
|
|
1
|
+
{"version":3,"file":"converter.js","sourceRoot":"","sources":["../src/converter.ts"],"names":[],"mappings":";;;AAEA,+CAA4C;AAC5C,mCAAkC;AAClC,qCAAwC;AACxC,2CAA0D;AAe1D,SAAgB,eAAe,CAAC,IAAwB,EAAE;IACxD,MAAM,OAAO,GAAG,CAAoC,SAAc,EAA4B,EAAE;QAC9F,MAAM,YAAY,GAAG,IAAA,4BAAgB,EAAC,SAAS,CAAC,CAAC;QAEjD,OAAO;YACL,KAAK,CAAC,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,MAAe;gBACnC,MAAM,CAAC,MAAM,GAAG,IAAI,CAAC;gBAErB,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE;oBAClB,MAAM,CAAC,MAAM,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;iBACnC;gBAED,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,CACtC,IAAA,eAAO,EAAC,GAAG,EAAE,CAAC,MAAM,CAAC,MAAM,IAAI,IAAA,qBAAS,EAAC,YAAY,EAAE,EAAE,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC,CACxE,CAAC;YACJ,CAAC;YACD,OAAO,CAAC,EAAE,EAAE,MAAe;gBACzB,MAAM,CAAC,MAAM,GAAG,KAAK,CAAC;gBACtB,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,IAAI,OAAO,EAAE,CAAC,CAAC;YACxE,CAAC;SACF,CAAC;IACJ,CAAC,CAAC;IACF,OAAO,CAAC,YAAY,GAAG,qBAAY,CAAC;IACpC,OAAO,CAAC,SAAS,GAAG,yBAAW,CAAC;IAChC,OAAO,OAAO,CAAC;AACjB,CAAC;AAzBD,0CAyBC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "piral-ng",
|
|
3
|
-
"version": "0.15.0-alpha.
|
|
3
|
+
"version": "0.15.0-alpha.3905",
|
|
4
4
|
"description": "Plugin for integrating Angular components in Piral.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"piral",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"@angular/platform-browser": "^8.0.0",
|
|
54
54
|
"@angular/platform-browser-dynamic": "^8.0.0",
|
|
55
55
|
"@angular/router": "^8.0.0",
|
|
56
|
-
"piral-core": "0.15.0-alpha.
|
|
56
|
+
"piral-core": "0.15.0-alpha.3905",
|
|
57
57
|
"rxjs": "^7.3.0"
|
|
58
58
|
},
|
|
59
59
|
"peerDependencies": {
|
|
@@ -62,10 +62,7 @@
|
|
|
62
62
|
"@angular/platform-browser": "^2.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0 || ^9.0.0 || ^10.0.0 || ^11.0.0 || ^12.0.0 || ^13.0.0",
|
|
63
63
|
"@angular/platform-browser-dynamic": "^2.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0 || ^9.0.0 || ^10.0.0 || ^11.0.0 || ^12.0.0 || ^13.0.0",
|
|
64
64
|
"@angular/router": "^2.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0 || ^9.0.0 || ^10.0.0 || ^11.0.0 || ^12.0.0 || ^13.0.0",
|
|
65
|
-
"
|
|
66
|
-
"piral-core": "0.14.x",
|
|
67
|
-
"rxjs": "^5.0.0 || ^6.0.0 || ^7.0.0",
|
|
68
|
-
"zone.js": "~0.9.0 || ~0.10.0 || ~0.11.0"
|
|
65
|
+
"rxjs": "^5.0.0 || ^6.0.0 || ^7.0.0"
|
|
69
66
|
},
|
|
70
|
-
"gitHead": "
|
|
67
|
+
"gitHead": "533d09963cfd8c901df797958ca386dbae0286e1"
|
|
71
68
|
}
|
package/src/converter.ts
CHANGED
|
@@ -13,20 +13,30 @@ export interface NgConverter {
|
|
|
13
13
|
Extension: any;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
+
interface NgState {
|
|
17
|
+
queued: Promise<void | Disposable>;
|
|
18
|
+
active: boolean;
|
|
19
|
+
}
|
|
20
|
+
|
|
16
21
|
export function createConverter(_: NgConverterOptions = {}): NgConverter {
|
|
17
22
|
const convert = <TProps extends BaseComponentProps>(component: any): ForeignComponent<TProps> => {
|
|
18
23
|
const bootstrapped = prepareBootstrap(component);
|
|
19
|
-
let mounted: Promise<void | Disposable> = Promise.resolve();
|
|
20
|
-
let active = true;
|
|
21
24
|
|
|
22
25
|
return {
|
|
23
|
-
mount(el, props, ctx) {
|
|
24
|
-
active = true;
|
|
25
|
-
|
|
26
|
+
mount(el, props, ctx, locals: NgState) {
|
|
27
|
+
locals.active = true;
|
|
28
|
+
|
|
29
|
+
if (!locals.queued) {
|
|
30
|
+
locals.queued = Promise.resolve();
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
locals.queued = locals.queued.then(() =>
|
|
34
|
+
enqueue(() => locals.active && bootstrap(bootstrapped, el, props, ctx)),
|
|
35
|
+
);
|
|
26
36
|
},
|
|
27
|
-
unmount() {
|
|
28
|
-
active = false;
|
|
29
|
-
|
|
37
|
+
unmount(el, locals: NgState) {
|
|
38
|
+
locals.active = false;
|
|
39
|
+
locals.queued = locals.queued.then((dispose) => dispose && dispose());
|
|
30
40
|
},
|
|
31
41
|
};
|
|
32
42
|
};
|