piral-vue-3 0.13.8 → 0.14.0-beta.3156
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/convert.d.ts +8 -6
- package/convert.js +17 -8
- package/esm/converter.d.ts +17 -2
- package/esm/converter.js +12 -11
- package/esm/converter.js.map +1 -1
- package/esm/create.d.ts +4 -13
- package/esm/create.js +8 -14
- package/esm/create.js.map +1 -1
- package/esm/extension.d.ts +1 -1
- package/esm/extension.js +3 -4
- package/esm/extension.js.map +1 -1
- package/esm/mount.d.ts +1 -1
- package/esm/mount.js +3 -4
- package/esm/mount.js.map +1 -1
- package/lib/converter.d.ts +17 -2
- package/lib/converter.js +15 -14
- package/lib/converter.js.map +1 -1
- package/lib/create.d.ts +4 -13
- package/lib/create.js +9 -15
- package/lib/create.js.map +1 -1
- package/lib/extension.d.ts +1 -1
- package/lib/extension.js +5 -6
- package/lib/extension.js.map +1 -1
- package/lib/index.js +3 -3
- package/lib/index.js.map +1 -1
- package/lib/mount.d.ts +1 -1
- package/lib/mount.js +5 -6
- package/lib/mount.js.map +1 -1
- package/package.json +4 -5
- package/src/converter.ts +18 -2
- package/src/create.ts +6 -20
- package/src/extension.ts +1 -1
- package/src/mount.ts +1 -1
- package/convert.ts +0 -16
package/convert.d.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import type { HtmlComponent } from 'piral-core';
|
|
2
|
-
import {
|
|
3
|
-
declare const convert: <TProps extends import("piral-core").BaseComponentProps>(root: import("vue").Component<TProps, any, any, import("vue").ComputedOptions, import("vue").MethodOptions>, captured?: Record<string, any>) => import("piral-core").ForeignComponent<TProps>;
|
|
2
|
+
import { createConverter } from './lib/converter';
|
|
4
3
|
export interface Vue3Converter {
|
|
5
|
-
(...params: Parameters<typeof
|
|
4
|
+
(...params: Parameters<ReturnType<typeof createConverter>>): HtmlComponent<any>;
|
|
6
5
|
}
|
|
7
|
-
export declare
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
export declare function createVue3Converter(...params: Parameters<typeof createConverter>): {
|
|
7
|
+
from: Vue3Converter;
|
|
8
|
+
Extension: import("vue").Component<import("piral-core").ExtensionSlotProps<string>, any, any, import("vue").ComputedOptions, import("vue").MethodOptions>;
|
|
9
|
+
};
|
|
10
|
+
declare const fromVue3: Vue3Converter, Vue3Extension: import("vue").Component<import("piral-core").ExtensionSlotProps<string>, any, any, import("vue").ComputedOptions, import("vue").MethodOptions>;
|
|
11
|
+
export { fromVue3, Vue3Extension };
|
package/convert.js
CHANGED
|
@@ -1,12 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
exports.__esModule = true;
|
|
3
|
-
exports.
|
|
3
|
+
exports.Vue3Extension = exports.fromVue3 = exports.createVue3Converter = void 0;
|
|
4
4
|
var converter_1 = require("./lib/converter");
|
|
5
|
-
|
|
6
|
-
var
|
|
7
|
-
var
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
function createVue3Converter() {
|
|
6
|
+
var params = [];
|
|
7
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
8
|
+
params[_i] = arguments[_i];
|
|
9
|
+
}
|
|
10
|
+
var convert = converter_1.createConverter.apply(void 0, params);
|
|
11
|
+
var Extension = convert.Extension;
|
|
12
|
+
var from = function (root, captured) { return ({
|
|
13
|
+
type: 'html',
|
|
14
|
+
component: convert(root, captured)
|
|
15
|
+
}); };
|
|
16
|
+
return { from: from, Extension: Extension };
|
|
17
|
+
}
|
|
18
|
+
exports.createVue3Converter = createVue3Converter;
|
|
19
|
+
var _a = createVue3Converter(), fromVue3 = _a.from, Vue3Extension = _a.Extension;
|
|
11
20
|
exports.fromVue3 = fromVue3;
|
|
12
|
-
exports.
|
|
21
|
+
exports.Vue3Extension = Vue3Extension;
|
package/esm/converter.d.ts
CHANGED
|
@@ -1,3 +1,18 @@
|
|
|
1
|
-
import { ForeignComponent, BaseComponentProps } from 'piral-core';
|
|
1
|
+
import type { ForeignComponent, BaseComponentProps } from 'piral-core';
|
|
2
2
|
import { Component } from 'vue';
|
|
3
|
-
export
|
|
3
|
+
export interface Vue3ConverterOptions {
|
|
4
|
+
/**
|
|
5
|
+
* Defines the name of the extension component.
|
|
6
|
+
* @default extension-component
|
|
7
|
+
*/
|
|
8
|
+
selector?: string;
|
|
9
|
+
/**
|
|
10
|
+
* Defines the name of the root element.
|
|
11
|
+
* @default slot
|
|
12
|
+
*/
|
|
13
|
+
rootName?: string;
|
|
14
|
+
}
|
|
15
|
+
export declare function createConverter(config?: Vue3ConverterOptions): {
|
|
16
|
+
<TProps extends BaseComponentProps>(root: Component<TProps, any, any, import("vue").ComputedOptions, import("vue").MethodOptions>, captured?: Record<string, any>): ForeignComponent<TProps>;
|
|
17
|
+
Extension: Component<import("piral-core").ExtensionSlotProps<string>, any, any, import("vue").ComputedOptions, import("vue").MethodOptions>;
|
|
18
|
+
};
|
package/esm/converter.js
CHANGED
|
@@ -1,31 +1,32 @@
|
|
|
1
1
|
import { createExtension } from './extension';
|
|
2
2
|
import { mountVue } from './mount';
|
|
3
|
-
export function createConverter(
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
export function createConverter(config = {}) {
|
|
4
|
+
const { rootName = 'slot', selector = 'extension-component' } = config;
|
|
5
|
+
const Extension = createExtension(rootName);
|
|
6
|
+
const convert = (root, captured) => {
|
|
7
|
+
let instance = undefined;
|
|
8
8
|
return {
|
|
9
|
-
mount
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
mount(parent, data, ctx) {
|
|
10
|
+
const el = parent.appendChild(document.createElement(rootName));
|
|
11
|
+
const app = mountVue(root, data, ctx, captured);
|
|
12
12
|
app.mount(el);
|
|
13
13
|
app.component(selector, createExtension(rootName));
|
|
14
14
|
!app._props && (app._props = {});
|
|
15
15
|
instance = app;
|
|
16
16
|
},
|
|
17
|
-
update
|
|
18
|
-
for (
|
|
17
|
+
update(_, data) {
|
|
18
|
+
for (const prop in data) {
|
|
19
19
|
instance._props[prop] = data[prop];
|
|
20
20
|
}
|
|
21
21
|
},
|
|
22
|
-
unmount
|
|
22
|
+
unmount(el) {
|
|
23
23
|
instance.unmount();
|
|
24
24
|
el.innerHTML = '';
|
|
25
25
|
instance = undefined;
|
|
26
26
|
},
|
|
27
27
|
};
|
|
28
28
|
};
|
|
29
|
+
convert.Extension = Extension;
|
|
29
30
|
return convert;
|
|
30
31
|
}
|
|
31
32
|
//# sourceMappingURL=converter.js.map
|
package/esm/converter.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"converter.js","sourceRoot":"","sources":["../src/converter.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"converter.js","sourceRoot":"","sources":["../src/converter.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAenC,MAAM,UAAU,eAAe,CAAC,SAA+B,EAAE;IAC/D,MAAM,EAAE,QAAQ,GAAG,MAAM,EAAE,QAAQ,GAAG,qBAAqB,EAAE,GAAG,MAAM,CAAC;IACvE,MAAM,SAAS,GAAG,eAAe,CAAC,QAAQ,CAAC,CAAC;IAC5C,MAAM,OAAO,GAAG,CACd,IAAuB,EACvB,QAA8B,EACJ,EAAE;QAC5B,IAAI,QAAQ,GAAQ,SAAS,CAAC;QAE9B,OAAO;YACL,KAAK,CAAC,MAAM,EAAE,IAAI,EAAE,GAAG;gBACrB,MAAM,EAAE,GAAG,MAAM,CAAC,WAAW,CAAC,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC,CAAC;gBAChE,MAAM,GAAG,GAAG,QAAQ,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,QAAQ,CAAC,CAAC;gBAChD,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;gBACd,GAAG,CAAC,SAAS,CAAC,QAAQ,EAAE,eAAe,CAAC,QAAQ,CAAC,CAAC,CAAC;gBACnD,CAAC,GAAG,CAAC,MAAM,IAAI,CAAC,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;gBACjC,QAAQ,GAAG,GAAG,CAAC;YACjB,CAAC;YACD,MAAM,CAAC,CAAC,EAAE,IAAI;gBACZ,KAAK,MAAM,IAAI,IAAI,IAAI,EAAE;oBACvB,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC;iBACpC;YACH,CAAC;YACD,OAAO,CAAC,EAAE;gBACR,QAAQ,CAAC,OAAO,EAAE,CAAC;gBACnB,EAAE,CAAC,SAAS,GAAG,EAAE,CAAC;gBAClB,QAAQ,GAAG,SAAS,CAAC;YACvB,CAAC;SACF,CAAC;IACJ,CAAC,CAAC;IACF,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC;IAC9B,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
package/esm/create.d.ts
CHANGED
|
@@ -1,19 +1,10 @@
|
|
|
1
|
-
import { PiralPlugin } from 'piral-core';
|
|
2
|
-
import {
|
|
1
|
+
import type { PiralPlugin } from 'piral-core';
|
|
2
|
+
import { Vue3ConverterOptions } from './converter';
|
|
3
|
+
import type { PiletVue3Api } from './types';
|
|
3
4
|
/**
|
|
4
5
|
* Available configuration options for the Vue@3 plugin.
|
|
5
6
|
*/
|
|
6
|
-
export interface Vue3Config {
|
|
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;
|
|
7
|
+
export interface Vue3Config extends Vue3ConverterOptions {
|
|
17
8
|
}
|
|
18
9
|
/**
|
|
19
10
|
* Creates new Pilet API extensions for integration of Vue@3.
|
package/esm/create.js
CHANGED
|
@@ -1,26 +1,20 @@
|
|
|
1
1
|
import { createConverter } from './converter';
|
|
2
|
-
import { createExtension } from './extension';
|
|
3
2
|
/**
|
|
4
3
|
* Creates new Pilet API extensions for integration of Vue@3.
|
|
5
4
|
*/
|
|
6
|
-
export function createVue3Api(config) {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
var convert = createConverter(rootName, selector);
|
|
11
|
-
context.converters.vue3 = function (_a) {
|
|
12
|
-
var root = _a.root, captured = _a.captured;
|
|
13
|
-
return convert(root, captured);
|
|
14
|
-
};
|
|
5
|
+
export function createVue3Api(config = {}) {
|
|
6
|
+
return (context) => {
|
|
7
|
+
const convert = createConverter(config);
|
|
8
|
+
context.converters.vue3 = ({ root, captured }) => convert(root, captured);
|
|
15
9
|
return {
|
|
16
|
-
fromVue3
|
|
10
|
+
fromVue3(root, captured) {
|
|
17
11
|
return {
|
|
18
12
|
type: 'vue3',
|
|
19
|
-
root
|
|
20
|
-
captured
|
|
13
|
+
root,
|
|
14
|
+
captured,
|
|
21
15
|
};
|
|
22
16
|
},
|
|
23
|
-
Vue3Extension:
|
|
17
|
+
Vue3Extension: convert.Extension,
|
|
24
18
|
};
|
|
25
19
|
};
|
|
26
20
|
}
|
package/esm/create.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create.js","sourceRoot":"","sources":["../src/create.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,
|
|
1
|
+
{"version":3,"file":"create.js","sourceRoot":"","sources":["../src/create.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAwB,MAAM,aAAa,CAAC;AAQpE;;GAEG;AACH,MAAM,UAAU,aAAa,CAAC,SAAqB,EAAE;IACnD,OAAO,CAAC,OAAO,EAAE,EAAE;QACjB,MAAM,OAAO,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC;QACxC,OAAO,CAAC,UAAU,CAAC,IAAI,GAAG,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;QAE1E,OAAO;YACL,QAAQ,CAAC,IAAI,EAAE,QAAQ;gBACrB,OAAO;oBACL,IAAI,EAAE,MAAM;oBACZ,IAAI;oBACJ,QAAQ;iBACT,CAAC;YACJ,CAAC;YACD,aAAa,EAAE,OAAO,CAAC,SAAS;SACjC,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC"}
|
package/esm/extension.d.ts
CHANGED
package/esm/extension.js
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { h } from 'vue';
|
|
2
2
|
export function createExtension(rootName) {
|
|
3
|
-
|
|
4
|
-
var Vue3Extension = {
|
|
3
|
+
const Vue3Extension = {
|
|
5
4
|
functional: false,
|
|
6
5
|
props: ['name', 'empty', 'render', 'params'],
|
|
7
6
|
inject: ['piral'],
|
|
8
|
-
render
|
|
7
|
+
render() {
|
|
9
8
|
return h(rootName);
|
|
10
9
|
},
|
|
11
|
-
mounted
|
|
10
|
+
mounted() {
|
|
12
11
|
this.piral.renderHtmlExtension(this.$el, {
|
|
13
12
|
empty: this.empty,
|
|
14
13
|
params: this.params,
|
package/esm/extension.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extension.js","sourceRoot":"","sources":["../src/extension.ts"],"names":[],"mappings":"AACA,OAAO,EAAa,CAAC,EAAE,MAAM,KAAK,CAAC;AAEnC,MAAM,UAAU,eAAe,CAAC,
|
|
1
|
+
{"version":3,"file":"extension.js","sourceRoot":"","sources":["../src/extension.ts"],"names":[],"mappings":"AACA,OAAO,EAAa,CAAC,EAAE,MAAM,KAAK,CAAC;AAEnC,MAAM,UAAU,eAAe,CAAC,QAAgB;IAC9C,MAAM,aAAa,GAAkC;QACnD,UAAU,EAAE,KAAK;QACjB,KAAK,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,CAAC;QAC5C,MAAM,EAAE,CAAC,OAAO,CAAC;QACjB,MAAM;YACJ,OAAO,CAAC,CAAC,QAAQ,CAAC,CAAC;QACrB,CAAC;QACD,OAAO;YACL,IAAI,CAAC,KAAK,CAAC,mBAAmB,CAAC,IAAI,CAAC,GAAG,EAAE;gBACvC,KAAK,EAAE,IAAI,CAAC,KAAK;gBACjB,MAAM,EAAE,IAAI,CAAC,MAAM;gBACnB,MAAM,EAAE,IAAI,CAAC,MAAM;gBACnB,IAAI,EAAE,IAAI,CAAC,IAAI;aAChB,CAAC,CAAC;QACL,CAAC;KACF,CAAC;IAEF,OAAO,aAAa,CAAC;AACvB,CAAC"}
|
package/esm/mount.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
+
import type { BaseComponentProps, ComponentContext } from 'piral-core';
|
|
1
2
|
import { Component } from 'vue';
|
|
2
|
-
import { BaseComponentProps, ComponentContext } from 'piral-core';
|
|
3
3
|
export declare function mountVue<T extends BaseComponentProps>(root: Component<T>, props: T, ctx: ComponentContext, captured?: Record<string, any>): import("vue").App<Element>;
|
package/esm/mount.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { __assign } from "tslib";
|
|
2
1
|
import { createApp, h } from 'vue';
|
|
3
2
|
export function mountVue(root, props, ctx, captured) {
|
|
4
3
|
return createApp({
|
|
5
|
-
provide:
|
|
6
|
-
render
|
|
7
|
-
return h(root,
|
|
4
|
+
provide: Object.assign({ piral: props.piral }, ctx),
|
|
5
|
+
render() {
|
|
6
|
+
return h(root, Object.assign(Object.assign({}, captured), props));
|
|
8
7
|
},
|
|
9
8
|
});
|
|
10
9
|
}
|
package/esm/mount.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mount.js","sourceRoot":"","sources":["../src/mount.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"mount.js","sourceRoot":"","sources":["../src/mount.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAa,CAAC,EAAE,MAAM,KAAK,CAAC;AAE9C,MAAM,UAAU,QAAQ,CACtB,IAAkB,EAClB,KAAQ,EACR,GAAqB,EACrB,QAA8B;IAE9B,OAAO,SAAS,CAAC;QACf,OAAO,kBACL,KAAK,EAAE,KAAK,CAAC,KAAK,IACf,GAAG,CACP;QACD,MAAM;YACJ,OAAO,CAAC,CAAC,IAAW,kCACf,QAAQ,GACR,KAAK,EACR,CAAC;QACL,CAAC;KACF,CAAC,CAAC;AACL,CAAC"}
|
package/lib/converter.d.ts
CHANGED
|
@@ -1,3 +1,18 @@
|
|
|
1
|
-
import { ForeignComponent, BaseComponentProps } from 'piral-core';
|
|
1
|
+
import type { ForeignComponent, BaseComponentProps } from 'piral-core';
|
|
2
2
|
import { Component } from 'vue';
|
|
3
|
-
export
|
|
3
|
+
export interface Vue3ConverterOptions {
|
|
4
|
+
/**
|
|
5
|
+
* Defines the name of the extension component.
|
|
6
|
+
* @default extension-component
|
|
7
|
+
*/
|
|
8
|
+
selector?: string;
|
|
9
|
+
/**
|
|
10
|
+
* Defines the name of the root element.
|
|
11
|
+
* @default slot
|
|
12
|
+
*/
|
|
13
|
+
rootName?: string;
|
|
14
|
+
}
|
|
15
|
+
export declare function createConverter(config?: Vue3ConverterOptions): {
|
|
16
|
+
<TProps extends BaseComponentProps>(root: Component<TProps, any, any, import("vue").ComputedOptions, import("vue").MethodOptions>, captured?: Record<string, any>): ForeignComponent<TProps>;
|
|
17
|
+
Extension: Component<import("piral-core").ExtensionSlotProps<string>, any, any, import("vue").ComputedOptions, import("vue").MethodOptions>;
|
|
18
|
+
};
|
package/lib/converter.js
CHANGED
|
@@ -1,34 +1,35 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createConverter = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
function createConverter(
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
4
|
+
const extension_1 = require("./extension");
|
|
5
|
+
const mount_1 = require("./mount");
|
|
6
|
+
function createConverter(config = {}) {
|
|
7
|
+
const { rootName = 'slot', selector = 'extension-component' } = config;
|
|
8
|
+
const Extension = (0, extension_1.createExtension)(rootName);
|
|
9
|
+
const convert = (root, captured) => {
|
|
10
|
+
let instance = undefined;
|
|
11
11
|
return {
|
|
12
|
-
mount
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
mount(parent, data, ctx) {
|
|
13
|
+
const el = parent.appendChild(document.createElement(rootName));
|
|
14
|
+
const app = (0, mount_1.mountVue)(root, data, ctx, captured);
|
|
15
15
|
app.mount(el);
|
|
16
|
-
app.component(selector, extension_1.createExtension(rootName));
|
|
16
|
+
app.component(selector, (0, extension_1.createExtension)(rootName));
|
|
17
17
|
!app._props && (app._props = {});
|
|
18
18
|
instance = app;
|
|
19
19
|
},
|
|
20
|
-
update
|
|
21
|
-
for (
|
|
20
|
+
update(_, data) {
|
|
21
|
+
for (const prop in data) {
|
|
22
22
|
instance._props[prop] = data[prop];
|
|
23
23
|
}
|
|
24
24
|
},
|
|
25
|
-
unmount
|
|
25
|
+
unmount(el) {
|
|
26
26
|
instance.unmount();
|
|
27
27
|
el.innerHTML = '';
|
|
28
28
|
instance = undefined;
|
|
29
29
|
},
|
|
30
30
|
};
|
|
31
31
|
};
|
|
32
|
+
convert.Extension = Extension;
|
|
32
33
|
return convert;
|
|
33
34
|
}
|
|
34
35
|
exports.createConverter = createConverter;
|
package/lib/converter.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"converter.js","sourceRoot":"","sources":["../src/converter.ts"],"names":[],"mappings":";;;AAEA,
|
|
1
|
+
{"version":3,"file":"converter.js","sourceRoot":"","sources":["../src/converter.ts"],"names":[],"mappings":";;;AAEA,2CAA8C;AAC9C,mCAAmC;AAenC,SAAgB,eAAe,CAAC,SAA+B,EAAE;IAC/D,MAAM,EAAE,QAAQ,GAAG,MAAM,EAAE,QAAQ,GAAG,qBAAqB,EAAE,GAAG,MAAM,CAAC;IACvE,MAAM,SAAS,GAAG,IAAA,2BAAe,EAAC,QAAQ,CAAC,CAAC;IAC5C,MAAM,OAAO,GAAG,CACd,IAAuB,EACvB,QAA8B,EACJ,EAAE;QAC5B,IAAI,QAAQ,GAAQ,SAAS,CAAC;QAE9B,OAAO;YACL,KAAK,CAAC,MAAM,EAAE,IAAI,EAAE,GAAG;gBACrB,MAAM,EAAE,GAAG,MAAM,CAAC,WAAW,CAAC,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC,CAAC;gBAChE,MAAM,GAAG,GAAG,IAAA,gBAAQ,EAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,QAAQ,CAAC,CAAC;gBAChD,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;gBACd,GAAG,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAA,2BAAe,EAAC,QAAQ,CAAC,CAAC,CAAC;gBACnD,CAAC,GAAG,CAAC,MAAM,IAAI,CAAC,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;gBACjC,QAAQ,GAAG,GAAG,CAAC;YACjB,CAAC;YACD,MAAM,CAAC,CAAC,EAAE,IAAI;gBACZ,KAAK,MAAM,IAAI,IAAI,IAAI,EAAE;oBACvB,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC;iBACpC;YACH,CAAC;YACD,OAAO,CAAC,EAAE;gBACR,QAAQ,CAAC,OAAO,EAAE,CAAC;gBACnB,EAAE,CAAC,SAAS,GAAG,EAAE,CAAC;gBAClB,QAAQ,GAAG,SAAS,CAAC;YACvB,CAAC;SACF,CAAC;IACJ,CAAC,CAAC;IACF,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC;IAC9B,OAAO,OAAO,CAAC;AACjB,CAAC;AAhCD,0CAgCC"}
|
package/lib/create.d.ts
CHANGED
|
@@ -1,19 +1,10 @@
|
|
|
1
|
-
import { PiralPlugin } from 'piral-core';
|
|
2
|
-
import {
|
|
1
|
+
import type { PiralPlugin } from 'piral-core';
|
|
2
|
+
import { Vue3ConverterOptions } from './converter';
|
|
3
|
+
import type { PiletVue3Api } from './types';
|
|
3
4
|
/**
|
|
4
5
|
* Available configuration options for the Vue@3 plugin.
|
|
5
6
|
*/
|
|
6
|
-
export interface Vue3Config {
|
|
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;
|
|
7
|
+
export interface Vue3Config extends Vue3ConverterOptions {
|
|
17
8
|
}
|
|
18
9
|
/**
|
|
19
10
|
* Creates new Pilet API extensions for integration of Vue@3.
|
package/lib/create.js
CHANGED
|
@@ -1,29 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createVue3Api = void 0;
|
|
4
|
-
|
|
5
|
-
var extension_1 = require("./extension");
|
|
4
|
+
const converter_1 = require("./converter");
|
|
6
5
|
/**
|
|
7
6
|
* Creates new Pilet API extensions for integration of Vue@3.
|
|
8
7
|
*/
|
|
9
|
-
function createVue3Api(config) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
var convert = converter_1.createConverter(rootName, selector);
|
|
14
|
-
context.converters.vue3 = function (_a) {
|
|
15
|
-
var root = _a.root, captured = _a.captured;
|
|
16
|
-
return convert(root, captured);
|
|
17
|
-
};
|
|
8
|
+
function createVue3Api(config = {}) {
|
|
9
|
+
return (context) => {
|
|
10
|
+
const convert = (0, converter_1.createConverter)(config);
|
|
11
|
+
context.converters.vue3 = ({ root, captured }) => convert(root, captured);
|
|
18
12
|
return {
|
|
19
|
-
fromVue3
|
|
13
|
+
fromVue3(root, captured) {
|
|
20
14
|
return {
|
|
21
15
|
type: 'vue3',
|
|
22
|
-
root
|
|
23
|
-
captured
|
|
16
|
+
root,
|
|
17
|
+
captured,
|
|
24
18
|
};
|
|
25
19
|
},
|
|
26
|
-
Vue3Extension:
|
|
20
|
+
Vue3Extension: convert.Extension,
|
|
27
21
|
};
|
|
28
22
|
};
|
|
29
23
|
}
|
package/lib/create.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create.js","sourceRoot":"","sources":["../src/create.ts"],"names":[],"mappings":";;;AACA,
|
|
1
|
+
{"version":3,"file":"create.js","sourceRoot":"","sources":["../src/create.ts"],"names":[],"mappings":";;;AACA,2CAAoE;AAQpE;;GAEG;AACH,SAAgB,aAAa,CAAC,SAAqB,EAAE;IACnD,OAAO,CAAC,OAAO,EAAE,EAAE;QACjB,MAAM,OAAO,GAAG,IAAA,2BAAe,EAAC,MAAM,CAAC,CAAC;QACxC,OAAO,CAAC,UAAU,CAAC,IAAI,GAAG,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;QAE1E,OAAO;YACL,QAAQ,CAAC,IAAI,EAAE,QAAQ;gBACrB,OAAO;oBACL,IAAI,EAAE,MAAM;oBACZ,IAAI;oBACJ,QAAQ;iBACT,CAAC;YACJ,CAAC;YACD,aAAa,EAAE,OAAO,CAAC,SAAS;SACjC,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC;AAhBD,sCAgBC"}
|
package/lib/extension.d.ts
CHANGED
package/lib/extension.js
CHANGED
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createExtension = void 0;
|
|
4
|
-
|
|
4
|
+
const vue_1 = require("vue");
|
|
5
5
|
function createExtension(rootName) {
|
|
6
|
-
|
|
7
|
-
var Vue3Extension = {
|
|
6
|
+
const Vue3Extension = {
|
|
8
7
|
functional: false,
|
|
9
8
|
props: ['name', 'empty', 'render', 'params'],
|
|
10
9
|
inject: ['piral'],
|
|
11
|
-
render
|
|
12
|
-
return vue_1.h(rootName);
|
|
10
|
+
render() {
|
|
11
|
+
return (0, vue_1.h)(rootName);
|
|
13
12
|
},
|
|
14
|
-
mounted
|
|
13
|
+
mounted() {
|
|
15
14
|
this.piral.renderHtmlExtension(this.$el, {
|
|
16
15
|
empty: this.empty,
|
|
17
16
|
params: this.params,
|
package/lib/extension.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extension.js","sourceRoot":"","sources":["../src/extension.ts"],"names":[],"mappings":";;;AACA,
|
|
1
|
+
{"version":3,"file":"extension.js","sourceRoot":"","sources":["../src/extension.ts"],"names":[],"mappings":";;;AACA,6BAAmC;AAEnC,SAAgB,eAAe,CAAC,QAAgB;IAC9C,MAAM,aAAa,GAAkC;QACnD,UAAU,EAAE,KAAK;QACjB,KAAK,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,CAAC;QAC5C,MAAM,EAAE,CAAC,OAAO,CAAC;QACjB,MAAM;YACJ,OAAO,IAAA,OAAC,EAAC,QAAQ,CAAC,CAAC;QACrB,CAAC;QACD,OAAO;YACL,IAAI,CAAC,KAAK,CAAC,mBAAmB,CAAC,IAAI,CAAC,GAAG,EAAE;gBACvC,KAAK,EAAE,IAAI,CAAC,KAAK;gBACjB,MAAM,EAAE,IAAI,CAAC,MAAM;gBACnB,MAAM,EAAE,IAAI,CAAC,MAAM;gBACnB,IAAI,EAAE,IAAI,CAAC,IAAI;aAChB,CAAC,CAAC;QACL,CAAC;KACF,CAAC;IAEF,OAAO,aAAa,CAAC;AACvB,CAAC;AAnBD,0CAmBC"}
|
package/lib/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
tslib_1.__exportStar(require("./create"), exports);
|
|
5
|
-
tslib_1.__exportStar(require("./types"), exports);
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
(0, tslib_1.__exportStar)(require("./create"), exports);
|
|
5
|
+
(0, tslib_1.__exportStar)(require("./types"), exports);
|
|
6
6
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,wDAAyB;AACzB,uDAAwB"}
|
package/lib/mount.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
+
import type { BaseComponentProps, ComponentContext } from 'piral-core';
|
|
1
2
|
import { Component } from 'vue';
|
|
2
|
-
import { BaseComponentProps, ComponentContext } from 'piral-core';
|
|
3
3
|
export declare function mountVue<T extends BaseComponentProps>(root: Component<T>, props: T, ctx: ComponentContext, captured?: Record<string, any>): import("vue").App<Element>;
|
package/lib/mount.js
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.mountVue = void 0;
|
|
4
|
-
|
|
5
|
-
var vue_1 = require("vue");
|
|
4
|
+
const vue_1 = require("vue");
|
|
6
5
|
function mountVue(root, props, ctx, captured) {
|
|
7
|
-
return vue_1.createApp({
|
|
8
|
-
provide:
|
|
9
|
-
render
|
|
10
|
-
return vue_1.h(root,
|
|
6
|
+
return (0, vue_1.createApp)({
|
|
7
|
+
provide: Object.assign({ piral: props.piral }, ctx),
|
|
8
|
+
render() {
|
|
9
|
+
return (0, vue_1.h)(root, Object.assign(Object.assign({}, captured), props));
|
|
11
10
|
},
|
|
12
11
|
});
|
|
13
12
|
}
|
package/lib/mount.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mount.js","sourceRoot":"","sources":["../src/mount.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"mount.js","sourceRoot":"","sources":["../src/mount.ts"],"names":[],"mappings":";;;AACA,6BAA8C;AAE9C,SAAgB,QAAQ,CACtB,IAAkB,EAClB,KAAQ,EACR,GAAqB,EACrB,QAA8B;IAE9B,OAAO,IAAA,eAAS,EAAC;QACf,OAAO,kBACL,KAAK,EAAE,KAAK,CAAC,KAAK,IACf,GAAG,CACP;QACD,MAAM;YACJ,OAAO,IAAA,OAAC,EAAC,IAAW,kCACf,QAAQ,GACR,KAAK,EACR,CAAC;QACL,CAAC;KACF,CAAC,CAAC;AACL,CAAC;AAlBD,4BAkBC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "piral-vue-3",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.0-beta.3156",
|
|
4
4
|
"description": "Plugin for integrating Vue@3 components in Piral.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"piral",
|
|
@@ -26,7 +26,6 @@
|
|
|
26
26
|
"lib",
|
|
27
27
|
"src",
|
|
28
28
|
"convert.d.ts",
|
|
29
|
-
"convert.ts",
|
|
30
29
|
"convert.js"
|
|
31
30
|
],
|
|
32
31
|
"repository": {
|
|
@@ -45,12 +44,12 @@
|
|
|
45
44
|
"test": "echo \"Error: run tests from root\" && exit 1"
|
|
46
45
|
},
|
|
47
46
|
"devDependencies": {
|
|
48
|
-
"piral-core": "^0.
|
|
47
|
+
"piral-core": "^0.14.0-beta.3156",
|
|
49
48
|
"vue": "^3.0.0"
|
|
50
49
|
},
|
|
51
50
|
"peerDependencies": {
|
|
52
|
-
"piral-core": "0.
|
|
51
|
+
"piral-core": "0.14.x",
|
|
53
52
|
"vue": "^3.0.0"
|
|
54
53
|
},
|
|
55
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "e368a181defdfca4722d7bd478a9dcd47d90a51b"
|
|
56
55
|
}
|
package/src/converter.ts
CHANGED
|
@@ -1,9 +1,24 @@
|
|
|
1
|
-
import { ForeignComponent, BaseComponentProps } from 'piral-core';
|
|
1
|
+
import type { ForeignComponent, BaseComponentProps } from 'piral-core';
|
|
2
2
|
import { Component, App } from 'vue';
|
|
3
3
|
import { createExtension } from './extension';
|
|
4
4
|
import { mountVue } from './mount';
|
|
5
5
|
|
|
6
|
-
export
|
|
6
|
+
export interface Vue3ConverterOptions {
|
|
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
|
+
|
|
19
|
+
export function createConverter(config: Vue3ConverterOptions = {}) {
|
|
20
|
+
const { rootName = 'slot', selector = 'extension-component' } = config;
|
|
21
|
+
const Extension = createExtension(rootName);
|
|
7
22
|
const convert = <TProps extends BaseComponentProps>(
|
|
8
23
|
root: Component<TProps>,
|
|
9
24
|
captured?: Record<string, any>,
|
|
@@ -31,5 +46,6 @@ export function createConverter(rootName = 'slot', selector = 'extension-compone
|
|
|
31
46
|
},
|
|
32
47
|
};
|
|
33
48
|
};
|
|
49
|
+
convert.Extension = Extension;
|
|
34
50
|
return convert;
|
|
35
51
|
}
|
package/src/create.ts
CHANGED
|
@@ -1,32 +1,18 @@
|
|
|
1
|
-
import { PiralPlugin } from 'piral-core';
|
|
2
|
-
import { createConverter } from './converter';
|
|
3
|
-
import { PiletVue3Api } from './types';
|
|
4
|
-
import { createExtension } from './extension';
|
|
1
|
+
import type { PiralPlugin } from 'piral-core';
|
|
2
|
+
import { createConverter, Vue3ConverterOptions } from './converter';
|
|
3
|
+
import type { PiletVue3Api } from './types';
|
|
5
4
|
|
|
6
5
|
/**
|
|
7
6
|
* Available configuration options for the Vue@3 plugin.
|
|
8
7
|
*/
|
|
9
|
-
export interface Vue3Config {
|
|
10
|
-
/**
|
|
11
|
-
* Defines the name of the extension component.
|
|
12
|
-
* @default extension-component
|
|
13
|
-
*/
|
|
14
|
-
selector?: string;
|
|
15
|
-
/**
|
|
16
|
-
* Defines the name of the root element.
|
|
17
|
-
* @default slot
|
|
18
|
-
*/
|
|
19
|
-
rootName?: string;
|
|
20
|
-
}
|
|
8
|
+
export interface Vue3Config extends Vue3ConverterOptions {}
|
|
21
9
|
|
|
22
10
|
/**
|
|
23
11
|
* Creates new Pilet API extensions for integration of Vue@3.
|
|
24
12
|
*/
|
|
25
13
|
export function createVue3Api(config: Vue3Config = {}): PiralPlugin<PiletVue3Api> {
|
|
26
|
-
const { rootName, selector } = config;
|
|
27
|
-
|
|
28
14
|
return (context) => {
|
|
29
|
-
const convert = createConverter(
|
|
15
|
+
const convert = createConverter(config);
|
|
30
16
|
context.converters.vue3 = ({ root, captured }) => convert(root, captured);
|
|
31
17
|
|
|
32
18
|
return {
|
|
@@ -37,7 +23,7 @@ export function createVue3Api(config: Vue3Config = {}): PiralPlugin<PiletVue3Api
|
|
|
37
23
|
captured,
|
|
38
24
|
};
|
|
39
25
|
},
|
|
40
|
-
Vue3Extension:
|
|
26
|
+
Vue3Extension: convert.Extension,
|
|
41
27
|
};
|
|
42
28
|
};
|
|
43
29
|
}
|
package/src/extension.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ExtensionSlotProps } from 'piral-core';
|
|
2
2
|
import { Component, h } from 'vue';
|
|
3
3
|
|
|
4
|
-
export function createExtension(rootName
|
|
4
|
+
export function createExtension(rootName: string): Component<ExtensionSlotProps> {
|
|
5
5
|
const Vue3Extension: Component<ExtensionSlotProps> = {
|
|
6
6
|
functional: false,
|
|
7
7
|
props: ['name', 'empty', 'render', 'params'],
|
package/src/mount.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import type { BaseComponentProps, ComponentContext } from 'piral-core';
|
|
1
2
|
import { createApp, Component, h } from 'vue';
|
|
2
|
-
import { BaseComponentProps, ComponentContext } from 'piral-core';
|
|
3
3
|
|
|
4
4
|
export function mountVue<T extends BaseComponentProps>(
|
|
5
5
|
root: Component<T>,
|
package/convert.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { HtmlComponent } from 'piral-core';
|
|
2
|
-
import { createConverter } from './lib/converter';
|
|
3
|
-
import { createExtension } from './lib/extension';
|
|
4
|
-
|
|
5
|
-
const convert = createConverter();
|
|
6
|
-
|
|
7
|
-
export interface Vue3Converter {
|
|
8
|
-
(...params: Parameters<typeof convert>): HtmlComponent<any>;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export const fromVue3: Vue3Converter = (root, captured) => ({
|
|
12
|
-
type: 'html',
|
|
13
|
-
component: convert(root, captured),
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
export const createVue3Extension = createExtension;
|