piral-vue 0.15.0-alpha.3804 → 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 +16 -19
- package/esm/converter.js.map +1 -1
- package/esm/types.d.ts +2 -2
- package/lib/converter.js +16 -19
- package/lib/converter.js.map +1 -1
- package/lib/types.d.ts +2 -2
- package/package.json +3 -4
- package/src/converter.ts +20 -20
- package/src/types.ts +2 -2
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# [Piral Vue](https://piral.io) · [](https://github.com/smapiot/piral/blob/main/LICENSE) [](https://www.npmjs.com/package/piral-vue) [](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 `vue`. What `piral-vue` 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 a Vue@2 converter for any component registration, as well as a `fromVue` shortcut and a `VueExtension` component.
|
|
8
8
|
|
package/esm/converter.js
CHANGED
|
@@ -3,25 +3,22 @@ import { createExtension } from './extension';
|
|
|
3
3
|
export function createConverter(config = {}) {
|
|
4
4
|
const { rootName = 'slot', selector = 'extension-component' } = config;
|
|
5
5
|
const Extension = createExtension(rootName, selector);
|
|
6
|
-
const convert = (root, captured) => {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
},
|
|
23
|
-
};
|
|
24
|
-
};
|
|
6
|
+
const convert = (root, captured) => ({
|
|
7
|
+
mount(parent, data, ctx, locals) {
|
|
8
|
+
const el = parent.appendChild(document.createElement(rootName));
|
|
9
|
+
locals.instance = mountVue(el, root, data, ctx, captured);
|
|
10
|
+
},
|
|
11
|
+
update(parent, data, ctx, locals) {
|
|
12
|
+
for (const prop in data) {
|
|
13
|
+
locals.instance[prop] = data[prop];
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
unmount(parent, locals) {
|
|
17
|
+
locals.instance.$destroy();
|
|
18
|
+
parent.innerHTML = '';
|
|
19
|
+
locals.instance = undefined;
|
|
20
|
+
},
|
|
21
|
+
});
|
|
25
22
|
convert.Extension = Extension;
|
|
26
23
|
return convert;
|
|
27
24
|
}
|
package/esm/converter.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"converter.js","sourceRoot":"","sources":["../src/converter.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"converter.js","sourceRoot":"","sources":["../src/converter.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAmB9C,MAAM,UAAU,eAAe,CAAC,SAA8B,EAAE;IAC9D,MAAM,EAAE,QAAQ,GAAG,MAAM,EAAE,QAAQ,GAAG,qBAAqB,EAAE,GAAG,MAAM,CAAC;IACvE,MAAM,SAAS,GAAG,eAAe,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IACtD,MAAM,OAAO,GAAG,CACd,IAAuB,EACvB,QAA8B,EACJ,EAAE,CAAC,CAAC;QAC9B,KAAK,CAAC,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,MAAgB;YACvC,MAAM,EAAE,GAAG,MAAM,CAAC,WAAW,CAAC,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC,CAAC;YAChE,MAAM,CAAC,QAAQ,GAAG,QAAQ,CAAC,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,QAAQ,CAAC,CAAC;QAC5D,CAAC;QACD,MAAM,CAAC,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,MAAgB;YACxC,KAAK,MAAM,IAAI,IAAI,IAAI,EAAE;gBACvB,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC;aACpC;QACH,CAAC;QACD,OAAO,CAAC,MAAM,EAAE,MAAgB;YAC9B,MAAM,CAAC,QAAQ,CAAC,QAAQ,EAAE,CAAC;YAC3B,MAAM,CAAC,SAAS,GAAG,EAAE,CAAC;YACtB,MAAM,CAAC,QAAQ,GAAG,SAAS,CAAC;QAC9B,CAAC;KACF,CAAC,CAAC;IACH,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC;IAC9B,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
package/esm/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Component } from 'vue';
|
|
2
|
-
import { ForeignComponent, ExtensionSlotProps } from 'piral-core';
|
|
1
|
+
import type { Component } from 'vue';
|
|
2
|
+
import type { ForeignComponent, ExtensionSlotProps } from 'piral-core';
|
|
3
3
|
declare module 'piral-core/lib/types/custom' {
|
|
4
4
|
interface PiletCustomApi extends PiletVueApi {
|
|
5
5
|
}
|
package/lib/converter.js
CHANGED
|
@@ -6,25 +6,22 @@ const extension_1 = require("./extension");
|
|
|
6
6
|
function createConverter(config = {}) {
|
|
7
7
|
const { rootName = 'slot', selector = 'extension-component' } = config;
|
|
8
8
|
const Extension = (0, extension_1.createExtension)(rootName, selector);
|
|
9
|
-
const convert = (root, captured) => {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
},
|
|
26
|
-
};
|
|
27
|
-
};
|
|
9
|
+
const convert = (root, captured) => ({
|
|
10
|
+
mount(parent, data, ctx, locals) {
|
|
11
|
+
const el = parent.appendChild(document.createElement(rootName));
|
|
12
|
+
locals.instance = (0, mount_1.mountVue)(el, root, data, ctx, captured);
|
|
13
|
+
},
|
|
14
|
+
update(parent, data, ctx, locals) {
|
|
15
|
+
for (const prop in data) {
|
|
16
|
+
locals.instance[prop] = data[prop];
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
unmount(parent, locals) {
|
|
20
|
+
locals.instance.$destroy();
|
|
21
|
+
parent.innerHTML = '';
|
|
22
|
+
locals.instance = undefined;
|
|
23
|
+
},
|
|
24
|
+
});
|
|
28
25
|
convert.Extension = Extension;
|
|
29
26
|
return convert;
|
|
30
27
|
}
|
package/lib/converter.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"converter.js","sourceRoot":"","sources":["../src/converter.ts"],"names":[],"mappings":";;;AAEA,mCAAmC;AACnC,2CAA8C;
|
|
1
|
+
{"version":3,"file":"converter.js","sourceRoot":"","sources":["../src/converter.ts"],"names":[],"mappings":";;;AAEA,mCAAmC;AACnC,2CAA8C;AAmB9C,SAAgB,eAAe,CAAC,SAA8B,EAAE;IAC9D,MAAM,EAAE,QAAQ,GAAG,MAAM,EAAE,QAAQ,GAAG,qBAAqB,EAAE,GAAG,MAAM,CAAC;IACvE,MAAM,SAAS,GAAG,IAAA,2BAAe,EAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IACtD,MAAM,OAAO,GAAG,CACd,IAAuB,EACvB,QAA8B,EACJ,EAAE,CAAC,CAAC;QAC9B,KAAK,CAAC,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,MAAgB;YACvC,MAAM,EAAE,GAAG,MAAM,CAAC,WAAW,CAAC,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC,CAAC;YAChE,MAAM,CAAC,QAAQ,GAAG,IAAA,gBAAQ,EAAC,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,QAAQ,CAAC,CAAC;QAC5D,CAAC;QACD,MAAM,CAAC,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,MAAgB;YACxC,KAAK,MAAM,IAAI,IAAI,IAAI,EAAE;gBACvB,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC;aACpC;QACH,CAAC;QACD,OAAO,CAAC,MAAM,EAAE,MAAgB;YAC9B,MAAM,CAAC,QAAQ,CAAC,QAAQ,EAAE,CAAC;YAC3B,MAAM,CAAC,SAAS,GAAG,EAAE,CAAC;YACtB,MAAM,CAAC,QAAQ,GAAG,SAAS,CAAC;QAC9B,CAAC;KACF,CAAC,CAAC;IACH,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC;IAC9B,OAAO,OAAO,CAAC;AACjB,CAAC;AAxBD,0CAwBC"}
|
package/lib/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Component } from 'vue';
|
|
2
|
-
import { ForeignComponent, ExtensionSlotProps } from 'piral-core';
|
|
1
|
+
import type { Component } from 'vue';
|
|
2
|
+
import type { ForeignComponent, ExtensionSlotProps } from 'piral-core';
|
|
3
3
|
declare module 'piral-core/lib/types/custom' {
|
|
4
4
|
interface PiletCustomApi extends PiletVueApi {
|
|
5
5
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "piral-vue",
|
|
3
|
-
"version": "0.15.0-alpha.
|
|
3
|
+
"version": "0.15.0-alpha.3905",
|
|
4
4
|
"description": "Plugin for integrating Vue@2 components in Piral.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"piral",
|
|
@@ -45,12 +45,11 @@
|
|
|
45
45
|
"test": "echo \"Error: run tests from root\" && exit 1"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"piral-core": "0.15.0-alpha.
|
|
48
|
+
"piral-core": "0.15.0-alpha.3905",
|
|
49
49
|
"vue": "^2.6.10"
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|
|
52
|
-
"piral-core": "0.14.x",
|
|
53
52
|
"vue": "^2.0.0"
|
|
54
53
|
},
|
|
55
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "533d09963cfd8c901df797958ca386dbae0286e1"
|
|
56
55
|
}
|
package/src/converter.ts
CHANGED
|
@@ -16,32 +16,32 @@ export interface VueConverterOptions {
|
|
|
16
16
|
rootName?: string;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
+
interface VueState {
|
|
20
|
+
instance: any;
|
|
21
|
+
}
|
|
22
|
+
|
|
19
23
|
export function createConverter(config: VueConverterOptions = {}) {
|
|
20
24
|
const { rootName = 'slot', selector = 'extension-component' } = config;
|
|
21
25
|
const Extension = createExtension(rootName, selector);
|
|
22
26
|
const convert = <TProps extends BaseComponentProps>(
|
|
23
27
|
root: Component<TProps>,
|
|
24
28
|
captured?: Record<string, any>,
|
|
25
|
-
): ForeignComponent<TProps> => {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
instance = undefined;
|
|
42
|
-
},
|
|
43
|
-
};
|
|
44
|
-
};
|
|
29
|
+
): ForeignComponent<TProps> => ({
|
|
30
|
+
mount(parent, data, ctx, locals: VueState) {
|
|
31
|
+
const el = parent.appendChild(document.createElement(rootName));
|
|
32
|
+
locals.instance = mountVue(el, root, data, ctx, captured);
|
|
33
|
+
},
|
|
34
|
+
update(parent, data, ctx, locals: VueState) {
|
|
35
|
+
for (const prop in data) {
|
|
36
|
+
locals.instance[prop] = data[prop];
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
unmount(parent, locals: VueState) {
|
|
40
|
+
locals.instance.$destroy();
|
|
41
|
+
parent.innerHTML = '';
|
|
42
|
+
locals.instance = undefined;
|
|
43
|
+
},
|
|
44
|
+
});
|
|
45
45
|
convert.Extension = Extension;
|
|
46
46
|
return convert;
|
|
47
47
|
}
|
package/src/types.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Component } from 'vue';
|
|
2
|
-
import { ForeignComponent, ExtensionSlotProps } from 'piral-core';
|
|
1
|
+
import type { Component } from 'vue';
|
|
2
|
+
import type { ForeignComponent, ExtensionSlotProps } from 'piral-core';
|
|
3
3
|
|
|
4
4
|
declare module 'piral-core/lib/types/custom' {
|
|
5
5
|
interface PiletCustomApi extends PiletVueApi {}
|