piral-ember 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 +18 -21
- package/esm/converter.js.map +1 -1
- package/lib/converter.js +18 -21
- package/lib/converter.js.map +1 -1
- package/package.json +4 -5
- package/src/converter.ts +25 -25
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# [Piral Ember](https://piral.io) · [](https://github.com/smapiot/piral/blob/main/LICENSE) [](https://www.npmjs.com/package/piral-ember) [](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 `ember-source`. What `piral-ember` 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 Ember.js converter for any component registration, as well as a `fromEmber` shortcut and a `EmberExtension` component.
|
|
8
8
|
|
package/esm/converter.js
CHANGED
|
@@ -2,27 +2,24 @@ import { createExtension } from './extension';
|
|
|
2
2
|
export function createConverter(config = {}) {
|
|
3
3
|
const { selector = 'ember-extension' } = config;
|
|
4
4
|
const Extension = createExtension(selector);
|
|
5
|
-
const convert = (App, opts) => {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
},
|
|
24
|
-
};
|
|
25
|
-
};
|
|
5
|
+
const convert = (App, opts) => ({
|
|
6
|
+
mount(rootElement, props, ctx, locals) {
|
|
7
|
+
locals.app = App.create(Object.assign(Object.assign({}, opts), { rootElement,
|
|
8
|
+
props,
|
|
9
|
+
ctx }));
|
|
10
|
+
},
|
|
11
|
+
update(rootElement, props, ctx, locals) {
|
|
12
|
+
locals.app.setProperties({
|
|
13
|
+
props,
|
|
14
|
+
ctx,
|
|
15
|
+
});
|
|
16
|
+
},
|
|
17
|
+
unmount(rootElement, locals) {
|
|
18
|
+
locals.app.destroy();
|
|
19
|
+
locals.app = undefined;
|
|
20
|
+
rootElement.innerHTML = '';
|
|
21
|
+
},
|
|
22
|
+
});
|
|
26
23
|
convert.Extension = Extension;
|
|
27
24
|
return convert;
|
|
28
25
|
}
|
package/esm/converter.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"converter.js","sourceRoot":"","sources":["../src/converter.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"converter.js","sourceRoot":"","sources":["../src/converter.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAe9C,MAAM,UAAU,eAAe,CAAC,SAAgC,EAAE;IAChE,MAAM,EAAE,QAAQ,GAAG,iBAAiB,EAAE,GAAG,MAAM,CAAC;IAEhD,MAAM,SAAS,GAAG,eAAe,CAAC,QAAQ,CAAC,CAAC;IAE5C,MAAM,OAAO,GAAG,CACd,GAAwB,EACxB,IAAS,EACiB,EAAE,CAAC,CAAC;QAC9B,KAAK,CAAC,WAAW,EAAE,KAAK,EAAE,GAAG,EAAE,MAA0B;YACvD,MAAM,CAAC,GAAG,GAAG,GAAG,CAAC,MAAM,iCAClB,IAAI,KACP,WAAW;gBACX,KAAK;gBACL,GAAG,IACH,CAAC;QACL,CAAC;QACD,MAAM,CAAC,WAAW,EAAE,KAAK,EAAE,GAAG,EAAE,MAA0B;YACxD,MAAM,CAAC,GAAG,CAAC,aAAa,CAAC;gBACvB,KAAK;gBACL,GAAG;aACJ,CAAC,CAAC;QACL,CAAC;QACD,OAAO,CAAC,WAAW,EAAE,MAA0B;YAC7C,MAAM,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC;YACrB,MAAM,CAAC,GAAG,GAAG,SAAS,CAAC;YACvB,WAAW,CAAC,SAAS,GAAG,EAAE,CAAC;QAC7B,CAAC;KACF,CAAC,CAAC;IACH,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC;IAC9B,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
package/lib/converter.js
CHANGED
|
@@ -5,27 +5,24 @@ const extension_1 = require("./extension");
|
|
|
5
5
|
function createConverter(config = {}) {
|
|
6
6
|
const { selector = 'ember-extension' } = config;
|
|
7
7
|
const Extension = (0, extension_1.createExtension)(selector);
|
|
8
|
-
const convert = (App, opts) => {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
},
|
|
27
|
-
};
|
|
28
|
-
};
|
|
8
|
+
const convert = (App, opts) => ({
|
|
9
|
+
mount(rootElement, props, ctx, locals) {
|
|
10
|
+
locals.app = App.create(Object.assign(Object.assign({}, opts), { rootElement,
|
|
11
|
+
props,
|
|
12
|
+
ctx }));
|
|
13
|
+
},
|
|
14
|
+
update(rootElement, props, ctx, locals) {
|
|
15
|
+
locals.app.setProperties({
|
|
16
|
+
props,
|
|
17
|
+
ctx,
|
|
18
|
+
});
|
|
19
|
+
},
|
|
20
|
+
unmount(rootElement, locals) {
|
|
21
|
+
locals.app.destroy();
|
|
22
|
+
locals.app = undefined;
|
|
23
|
+
rootElement.innerHTML = '';
|
|
24
|
+
},
|
|
25
|
+
});
|
|
29
26
|
convert.Extension = Extension;
|
|
30
27
|
return convert;
|
|
31
28
|
}
|
package/lib/converter.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"converter.js","sourceRoot":"","sources":["../src/converter.ts"],"names":[],"mappings":";;;AACA,2CAA8C;
|
|
1
|
+
{"version":3,"file":"converter.js","sourceRoot":"","sources":["../src/converter.ts"],"names":[],"mappings":";;;AACA,2CAA8C;AAe9C,SAAgB,eAAe,CAAC,SAAgC,EAAE;IAChE,MAAM,EAAE,QAAQ,GAAG,iBAAiB,EAAE,GAAG,MAAM,CAAC;IAEhD,MAAM,SAAS,GAAG,IAAA,2BAAe,EAAC,QAAQ,CAAC,CAAC;IAE5C,MAAM,OAAO,GAAG,CACd,GAAwB,EACxB,IAAS,EACiB,EAAE,CAAC,CAAC;QAC9B,KAAK,CAAC,WAAW,EAAE,KAAK,EAAE,GAAG,EAAE,MAA0B;YACvD,MAAM,CAAC,GAAG,GAAG,GAAG,CAAC,MAAM,iCAClB,IAAI,KACP,WAAW;gBACX,KAAK;gBACL,GAAG,IACH,CAAC;QACL,CAAC;QACD,MAAM,CAAC,WAAW,EAAE,KAAK,EAAE,GAAG,EAAE,MAA0B;YACxD,MAAM,CAAC,GAAG,CAAC,aAAa,CAAC;gBACvB,KAAK;gBACL,GAAG;aACJ,CAAC,CAAC;QACL,CAAC;QACD,OAAO,CAAC,WAAW,EAAE,MAA0B;YAC7C,MAAM,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC;YACrB,MAAM,CAAC,GAAG,GAAG,SAAS,CAAC;YACvB,WAAW,CAAC,SAAS,GAAG,EAAE,CAAC;QAC7B,CAAC;KACF,CAAC,CAAC;IACH,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC;IAC9B,OAAO,OAAO,CAAC;AACjB,CAAC;AA/BD,0CA+BC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "piral-ember",
|
|
3
|
-
"version": "0.15.0-alpha.
|
|
3
|
+
"version": "0.15.0-alpha.3905",
|
|
4
4
|
"description": "Plugin for integrating Ember.js components in Piral.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"piral",
|
|
@@ -46,11 +46,10 @@
|
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@types/ember": "^3.1.1",
|
|
48
48
|
"ember-source": "^3.15.0",
|
|
49
|
-
"piral-core": "0.15.0-alpha.
|
|
49
|
+
"piral-core": "0.15.0-alpha.3905"
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|
|
52
|
-
"ember-source": "^3.0.0"
|
|
53
|
-
"piral-core": "0.14.x"
|
|
52
|
+
"ember-source": "^3.0.0"
|
|
54
53
|
},
|
|
55
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "533d09963cfd8c901df797958ca386dbae0286e1"
|
|
56
55
|
}
|
package/src/converter.ts
CHANGED
|
@@ -10,6 +10,10 @@ export interface EmberConverterOptions {
|
|
|
10
10
|
selector?: string;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
+
interface EmberState<TProps> {
|
|
14
|
+
app: EmberInstance<TProps>;
|
|
15
|
+
}
|
|
16
|
+
|
|
13
17
|
export function createConverter(config: EmberConverterOptions = {}) {
|
|
14
18
|
const { selector = 'ember-extension' } = config;
|
|
15
19
|
|
|
@@ -18,31 +22,27 @@ export function createConverter(config: EmberConverterOptions = {}) {
|
|
|
18
22
|
const convert = <TProps extends BaseComponentProps>(
|
|
19
23
|
App: EmberModule<TProps>,
|
|
20
24
|
opts: any,
|
|
21
|
-
): ForeignComponent<TProps> => {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
rootElement.innerHTML = '';
|
|
43
|
-
},
|
|
44
|
-
};
|
|
45
|
-
};
|
|
25
|
+
): ForeignComponent<TProps> => ({
|
|
26
|
+
mount(rootElement, props, ctx, locals: EmberState<TProps>) {
|
|
27
|
+
locals.app = App.create({
|
|
28
|
+
...opts,
|
|
29
|
+
rootElement,
|
|
30
|
+
props,
|
|
31
|
+
ctx,
|
|
32
|
+
});
|
|
33
|
+
},
|
|
34
|
+
update(rootElement, props, ctx, locals: EmberState<TProps>) {
|
|
35
|
+
locals.app.setProperties({
|
|
36
|
+
props,
|
|
37
|
+
ctx,
|
|
38
|
+
});
|
|
39
|
+
},
|
|
40
|
+
unmount(rootElement, locals: EmberState<TProps>) {
|
|
41
|
+
locals.app.destroy();
|
|
42
|
+
locals.app = undefined;
|
|
43
|
+
rootElement.innerHTML = '';
|
|
44
|
+
},
|
|
45
|
+
});
|
|
46
46
|
convert.Extension = Extension;
|
|
47
47
|
return convert;
|
|
48
48
|
}
|