nativescript-vue 3.0.0-dev.3 → 3.0.0-rc.1
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 +21 -0
- package/README.md +59 -1
- package/devtools.js +33 -0
- package/dist/compiler-sfc/index.d.ts +1 -0
- package/dist/compiler-sfc/index.js +2 -0
- package/dist/compiler-sfc/index.js.map +1 -0
- package/dist/compiler.d.ts +4 -0
- package/dist/compiler.js +32 -0
- package/dist/compiler.js.map +1 -0
- package/dist/components/ActionBar.d.ts +3 -0
- package/dist/components/ActionBar.js +70 -0
- package/dist/components/ActionBar.js.map +1 -0
- package/dist/components/ListView.d.ts +20 -0
- package/dist/components/ListView.js +110 -0
- package/dist/components/ListView.js.map +1 -0
- package/dist/components/index.d.ts +22 -0
- package/dist/components/index.js +8 -0
- package/dist/components/index.js.map +1 -0
- package/dist/directives/vModel.d.ts +8 -0
- package/dist/directives/vModel.js +38 -0
- package/dist/directives/vModel.js.map +1 -0
- package/dist/directives/vShow.d.ts +7 -0
- package/dist/directives/vShow.js +45 -0
- package/dist/directives/vShow.js.map +1 -0
- package/dist/dom/index.d.ts +66 -0
- package/dist/dom/index.js +303 -0
- package/dist/dom/index.js.map +1 -0
- package/dist/index.d.ts +27 -0
- package/dist/index.js +101 -0
- package/dist/index.js.map +1 -0
- package/dist/nativescript/elements.d.ts +1 -0
- package/dist/nativescript/elements.js +164 -0
- package/dist/nativescript/elements.js.map +1 -0
- package/dist/nativescript/index.d.ts +6 -0
- package/dist/nativescript/index.js +26 -0
- package/dist/nativescript/index.js.map +1 -0
- package/dist/plugins/modals.d.ts +26 -0
- package/dist/plugins/modals.js +79 -0
- package/dist/plugins/modals.js.map +1 -0
- package/dist/plugins/navigation.d.ts +32 -0
- package/dist/plugins/navigation.js +110 -0
- package/dist/plugins/navigation.js.map +1 -0
- package/dist/plugins/templates.d.ts +10 -0
- package/dist/plugins/templates.js +12 -0
- package/dist/plugins/templates.js.map +1 -0
- package/dist/registry/index.d.ts +26 -0
- package/dist/registry/index.js +55 -0
- package/dist/registry/index.js.map +1 -0
- package/dist/renderer/index.d.ts +1 -0
- package/dist/renderer/index.js +8 -0
- package/dist/renderer/index.js.map +1 -0
- package/dist/renderer/modules/attrs.d.ts +2 -0
- package/dist/renderer/modules/attrs.js +31 -0
- package/dist/renderer/modules/attrs.js.map +1 -0
- package/dist/renderer/modules/class.d.ts +2 -0
- package/dist/renderer/modules/class.js +9 -0
- package/dist/renderer/modules/class.js.map +1 -0
- package/dist/renderer/modules/events.d.ts +12 -0
- package/dist/renderer/modules/events.js +59 -0
- package/dist/renderer/modules/events.js.map +1 -0
- package/dist/renderer/modules/style.d.ts +5 -0
- package/dist/renderer/modules/style.js +80 -0
- package/dist/renderer/modules/style.js.map +1 -0
- package/dist/renderer/nodeOps.d.ts +17 -0
- package/dist/renderer/nodeOps.js +70 -0
- package/dist/renderer/nodeOps.js.map +1 -0
- package/dist/renderer/patchProp.d.ts +2 -0
- package/dist/renderer/patchProp.js +47 -0
- package/dist/renderer/patchProp.js.map +1 -0
- package/dist/runtimeHelpers.d.ts +31 -0
- package/dist/runtimeHelpers.js +51 -0
- package/dist/runtimeHelpers.js.map +1 -0
- package/dist/types.d.ts +15 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/withCompiler.d.ts +3 -0
- package/dist/withCompiler.js +6 -0
- package/dist/withCompiler.js.map +1 -0
- package/nativescript.webpack.js +162 -0
- package/package.json +43 -22
- package/dist/nativescript-vue.cjs.js +0 -56
- package/dist/nativescript-vue.cjs.prod.js +0 -55
- package/dist/nativescript-vue.esm-bundler.js +0 -36
- package/index.js +0 -7
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"style.js","sourceRoot":"","sources":["../../../src/renderer/modules/style.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,gBAAgB,EAChB,OAAO,EACP,QAAQ,EACR,QAAQ,GACT,MAAM,aAAa,CAAC;AAIr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E;YACtC,mBAAmB,CAAC,EAAE,EAAE,QAAQ,CAAC,CAAC;QACpC,CAAC,CAAC,CAAC;IACL,CAAC;IAED,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,EAAE,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;IAC9B,CAAC;SAAM,CAAC;QACN,iBAAiB;QACjB,MAAM,KAAK,GAAG,cAAc,CAAC,IAAI,CAAC,CAAC;QACnC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE;YACtC,gBAAgB,CAAC,EAAE,EAAE,QAAQ,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC;QAClD,CAAC,CAAC,CAAC;IACL,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { VNodeProps, RendererOptions, ElementNamespace } from '@vue/runtime-core';
|
|
2
|
+
import { NSVElement, NSVNode } from '../dom';
|
|
3
|
+
export declare function insert(el: NSVNode, parent: NSVElement, anchor?: NSVNode | null | undefined): void;
|
|
4
|
+
export declare function remove(el: NSVNode): void;
|
|
5
|
+
export declare function createElement(type: string, namespace: ElementNamespace, isCustomizedBuiltIn?: string | undefined, vnodeProps?: (VNodeProps & {
|
|
6
|
+
[key: string]: any;
|
|
7
|
+
}) | null | undefined): NSVElement;
|
|
8
|
+
export declare function createText(text: string): NSVNode;
|
|
9
|
+
export declare function createComment(text: string): NSVNode;
|
|
10
|
+
export declare function setText(node: NSVNode, text: string): void;
|
|
11
|
+
export declare function setElementText(node: NSVElement, text: string): void;
|
|
12
|
+
export declare function parentNode(node: NSVNode): NSVElement | null;
|
|
13
|
+
export declare function nextSibling(node: NSVNode): NSVNode | null;
|
|
14
|
+
export declare function cloneNode(node: NSVNode): NSVNode;
|
|
15
|
+
export declare function insertStaticContent(content: string, parent: NSVElement, anchor: NSVNode, namespace: ElementNamespace, start?: NSVNode, end?: NSVNode): [NSVNode, NSVNode];
|
|
16
|
+
export declare function setScopeId(el: NSVElement, scopeId: string): void;
|
|
17
|
+
export declare const nodeOps: Omit<RendererOptions, 'patchProp'>;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { NSVComment, NSVElement, NSVText } from '../dom';
|
|
2
|
+
export function insert(el, parent, anchor) {
|
|
3
|
+
// console.log("insert", el, parent.tagName, anchor);
|
|
4
|
+
if (anchor !== null) {
|
|
5
|
+
// console.log('insert before!')
|
|
6
|
+
parent.insertBefore(el, anchor);
|
|
7
|
+
}
|
|
8
|
+
else {
|
|
9
|
+
parent.appendChild(el);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
export function remove(el) {
|
|
13
|
+
if (el.parentNode != null) {
|
|
14
|
+
el.parentNode.removeChild(el);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
export function createElement(type, namespace, isCustomizedBuiltIn, vnodeProps) {
|
|
18
|
+
// console.log("createElement", type);
|
|
19
|
+
return new NSVElement(type);
|
|
20
|
+
}
|
|
21
|
+
export function createText(text) {
|
|
22
|
+
// console.log("createText");
|
|
23
|
+
return new NSVText(text);
|
|
24
|
+
}
|
|
25
|
+
export function createComment(text) {
|
|
26
|
+
// console.log("createComment");
|
|
27
|
+
return new NSVComment(text);
|
|
28
|
+
}
|
|
29
|
+
export function setText(node, text) {
|
|
30
|
+
// console.log("set text", node, text);
|
|
31
|
+
node.text = text;
|
|
32
|
+
}
|
|
33
|
+
export function setElementText(node, text) {
|
|
34
|
+
// console.log("set element text", node, text);
|
|
35
|
+
node.text = text;
|
|
36
|
+
}
|
|
37
|
+
export function parentNode(node) {
|
|
38
|
+
// console.log("parentNode?", node.nodeType);
|
|
39
|
+
return node.parentNode;
|
|
40
|
+
}
|
|
41
|
+
export function nextSibling(node) {
|
|
42
|
+
return node.nextSibling;
|
|
43
|
+
}
|
|
44
|
+
export function cloneNode(node) {
|
|
45
|
+
console.log('CLONE NODE');
|
|
46
|
+
return node;
|
|
47
|
+
}
|
|
48
|
+
export function insertStaticContent(content, parent, anchor, namespace, start, end) {
|
|
49
|
+
console.log('insert static content - not implemented.');
|
|
50
|
+
return [undefined, undefined];
|
|
51
|
+
}
|
|
52
|
+
export function setScopeId(el, scopeId) {
|
|
53
|
+
el.setAttribute(scopeId, '');
|
|
54
|
+
}
|
|
55
|
+
export const nodeOps = {
|
|
56
|
+
insert,
|
|
57
|
+
remove,
|
|
58
|
+
createElement,
|
|
59
|
+
createText,
|
|
60
|
+
createComment,
|
|
61
|
+
setText,
|
|
62
|
+
setElementText,
|
|
63
|
+
parentNode,
|
|
64
|
+
nextSibling,
|
|
65
|
+
cloneNode,
|
|
66
|
+
insertStaticContent,
|
|
67
|
+
setScopeId,
|
|
68
|
+
// querySelector,
|
|
69
|
+
};
|
|
70
|
+
//# sourceMappingURL=nodeOps.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nodeOps.js","sourceRoot":"","sources":["../../src/renderer/nodeOps.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAW,OAAO,EAAE,MAAM,QAAQ,CAAC;AAElE,MAAM,UAAU,MAAM,CACpB,EAAW,EACX,MAAkB,EAClB,MAAmC;IAEnC,qDAAqD;IACrD,IAAI,MAAM,KAAK,IAAI,EAAE,CAAC;QACpB,gCAAgC;QAChC,MAAM,CAAC,YAAY,CAAC,EAAE,EAAE,MAAM,CAAC,CAAC;IAClC,CAAC;SAAM,CAAC;QACN,MAAM,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;IACzB,CAAC;AACH,CAAC;AAED,MAAM,UAAU,MAAM,CAAC,EAAW;IAChC,IAAI,EAAE,CAAC,UAAU,IAAI,IAAI,EAAE,CAAC;QAC1B,EAAE,CAAC,UAAU,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;IAChC,CAAC;AACH,CAAC;AAED,MAAM,UAAU,aAAa,CAC3B,IAAY,EACZ,SAA2B,EAC3B,mBAAwC,EACxC,UAAqE;IAEr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b,UAAU;IACV,aAAa;IACb,OAAO;IACP,cAAc;IACd,UAAU;IACV,WAAW;IAEX,SAAS;IACT,mBAAmB;IAEnB,UAAU;IAEV,mBAAmB;CACpB,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { patchAttr } from './modules/attrs';
|
|
2
|
+
import { patchClass } from './modules/class';
|
|
3
|
+
import { patchEvent } from './modules/events';
|
|
4
|
+
import { patchStyle } from './modules/style';
|
|
5
|
+
import { getViewMeta } from '../registry';
|
|
6
|
+
import { isOn } from '../runtimeHelpers';
|
|
7
|
+
export const patchProp = (el, key, prevValue, nextValue, namespace, prevChildren, parentComponent, parentSuspense, unmountChildren) => {
|
|
8
|
+
switch (key) {
|
|
9
|
+
// special
|
|
10
|
+
case 'class':
|
|
11
|
+
// console.log('->patchProp+Class')
|
|
12
|
+
patchClass(el, nextValue);
|
|
13
|
+
break;
|
|
14
|
+
case 'style':
|
|
15
|
+
// console.log('->patchProp+Style')
|
|
16
|
+
patchStyle(el, prevValue, nextValue);
|
|
17
|
+
break;
|
|
18
|
+
case 'modelValue':
|
|
19
|
+
case 'onUpdate:modelValue':
|
|
20
|
+
try {
|
|
21
|
+
// v-model - maps modelValue/onUpdate:modelValue to the correct prop/events from the registry meta
|
|
22
|
+
const { prop, event } = getViewMeta(el.tagName)
|
|
23
|
+
.model;
|
|
24
|
+
if (key === 'modelValue') {
|
|
25
|
+
patchAttr(el, prop, prevValue, nextValue);
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
const cb = nextValue
|
|
29
|
+
? ($event) => nextValue($event.object[prop])
|
|
30
|
+
: nextValue;
|
|
31
|
+
patchEvent(el, `on:${event}`, prevValue, cb);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
catch (err) {
|
|
35
|
+
// ignore if the view meta can't be found.
|
|
36
|
+
}
|
|
37
|
+
break;
|
|
38
|
+
default:
|
|
39
|
+
if (isOn(key)) {
|
|
40
|
+
patchEvent(el, key, prevValue, nextValue, parentComponent);
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
patchAttr(el, key, prevValue, nextValue);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
//# sourceMappingURL=patchProp.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"patchProp.js","sourceRoot":"","sources":["../../src/renderer/patchProp.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C,OAAO,EAAE,WAAW,EAAsB,MAAM,aAAa,CAAC;AAC9D,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AASzC,MAAM,CAAC,MAAM,SAAS,GAAiC,CACrD,EAAc,EACd,GAAW,EACX,SAAc,EACd,SAAc,EACd,SAA4B,EAC5B,YAAoB,EACpB,eAAkD,EAClD,cAAwC,EACxC,eAAqB,EACrB,EAAE;IACF,QAAQ,GAAG,EAAE,CAAC;QACZ,UAAU;QACV,KAAK,OAAO;YACV,mCAAmC;YACnC,UAAU,CAAC,EAAE,EAAE,SAAS,CAAC,CAAC;YAC1B,MAAM;QACR,KAAK,OAAO;YACV,mCAAmC;YACnC,UAAU,CAAC,EAAE,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC;YACrC,MAAM;QACR,KAAK,YAAY,CAAC;QAClB,KAAK,qBAAqB;YACxB,IAAI,CAAC;gBACH,kGAAkG;gBAClG,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,WAAW,CAAC,EAAE,CAAC,OAAO,CAAC;qBAC5C,KAA2B,CAAC;gBAC/B,IAAI,GAAG,KAAK,YAAY,EAAE,CAAC;oBACzB,SAAS,CAAC,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC;gBAC5C,CAAC;qBAAM,CAAC;oBACN,MAAM,EAAE,GAAG,SAAS;wBAClB,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,SAAS,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;wBAC5C,CAAC,CAAC,SAAS,CAAC;oBACd,UAAU,CAAC,EAAE,EAAE,MAAM,KAAK,EAAE,EAAE,SAAS,EAAE,EAAE,CAAC,CAAC;gBAC/C,CAAC;YACH,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACb,0CAA0C;YAC5C,CAAC;YACD,MAAM;QACR;YACE,IAAI,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;gBACd,UAAU,CAAC,EAAE,EAAE,GAAG,EAAE,SAAS,EAAE,SAAS,EAAE,eAAe,CAAC,CAAC;YAC7D,CAAC;iBAAM,CAAC;gBACN,SAAS,CAAC,EAAE,EAAE,GAAG,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC;YAC3C,CAAC;IACL,CAAC;AACH,CAAC,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { View } from '@nativescript/core';
|
|
2
|
+
import { App, Component, RendererElement, RendererNode, VNode } from '@vue/runtime-core';
|
|
3
|
+
import { NSVNode } from './dom';
|
|
4
|
+
type Props = Record<string, unknown>;
|
|
5
|
+
export declare const setRootApp: (app: App) => void;
|
|
6
|
+
export declare const createNativeView: <T = View>(component: Component, props?: Props, contextOverrides?: {
|
|
7
|
+
reload?(): void;
|
|
8
|
+
}) => {
|
|
9
|
+
context: {
|
|
10
|
+
reload?(): void;
|
|
11
|
+
config: import("@vue/runtime-core").AppConfig;
|
|
12
|
+
mixins: import("@vue/runtime-core").ComponentOptions<{}, any, any, any, any, any, any, any, any>[];
|
|
13
|
+
components: Record<string, Component<any, any, any, import("@vue/runtime-core").ComputedOptions, import("@vue/runtime-core").MethodOptions, {}, any>>;
|
|
14
|
+
directives: Record<string, import("@vue/runtime-core").Directive<any, any>>;
|
|
15
|
+
provides: Record<string | symbol, any>;
|
|
16
|
+
};
|
|
17
|
+
readonly vnode: VNode<RendererNode, RendererElement, {
|
|
18
|
+
[key: string]: any;
|
|
19
|
+
}>;
|
|
20
|
+
readonly nativeView: T;
|
|
21
|
+
mount(root?: NSVNode): VNode<RendererNode, RendererElement, {
|
|
22
|
+
nativeView: T;
|
|
23
|
+
}>;
|
|
24
|
+
unmount(): void;
|
|
25
|
+
};
|
|
26
|
+
export declare const ELEMENT_REF: unique symbol;
|
|
27
|
+
export declare const isOn: (key: string) => boolean;
|
|
28
|
+
export declare const isAndroidKey: (key: string) => boolean;
|
|
29
|
+
export declare const isIOSKey: (key: string) => boolean;
|
|
30
|
+
export declare const isBoolean: (value: unknown) => boolean;
|
|
31
|
+
export {};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { NSVRoot } from './dom';
|
|
2
|
+
import { renderer } from './renderer';
|
|
3
|
+
const __DEV__ = true;
|
|
4
|
+
let rootApp = null;
|
|
5
|
+
export const setRootApp = (app) => {
|
|
6
|
+
rootApp = app;
|
|
7
|
+
};
|
|
8
|
+
export const createNativeView = (component, props, contextOverrides) => {
|
|
9
|
+
let isMounted = false;
|
|
10
|
+
let vm;
|
|
11
|
+
const newApp = renderer.createApp(component, props);
|
|
12
|
+
// Destructure so as not to copy over the root app instance
|
|
13
|
+
const { app, ...rootContext } = rootApp._context;
|
|
14
|
+
const context = { ...rootContext, ...contextOverrides };
|
|
15
|
+
return {
|
|
16
|
+
context,
|
|
17
|
+
get vnode() {
|
|
18
|
+
return vm?.$.vnode;
|
|
19
|
+
},
|
|
20
|
+
get nativeView() {
|
|
21
|
+
return this.vnode?.el.nativeView;
|
|
22
|
+
},
|
|
23
|
+
mount(root = new NSVRoot()) {
|
|
24
|
+
if (isMounted) {
|
|
25
|
+
return this.vnode;
|
|
26
|
+
}
|
|
27
|
+
Object.keys(context).forEach((key) => {
|
|
28
|
+
newApp._context[key] = context[key];
|
|
29
|
+
});
|
|
30
|
+
vm = newApp.mount(root);
|
|
31
|
+
isMounted = true;
|
|
32
|
+
return this.vnode;
|
|
33
|
+
},
|
|
34
|
+
unmount() {
|
|
35
|
+
if (!isMounted)
|
|
36
|
+
return;
|
|
37
|
+
vm = null;
|
|
38
|
+
newApp.unmount();
|
|
39
|
+
isMounted = false;
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
export const ELEMENT_REF = Symbol(__DEV__ ? `elementRef` : ``);
|
|
44
|
+
const onRE = /^on.+/;
|
|
45
|
+
export const isOn = (key) => onRE.test(key);
|
|
46
|
+
export const isAndroidKey = (key) => key.startsWith('android:');
|
|
47
|
+
export const isIOSKey = (key) => key.startsWith('ios:');
|
|
48
|
+
export const isBoolean = (value) => {
|
|
49
|
+
return typeof value === 'boolean' || value instanceof Boolean;
|
|
50
|
+
};
|
|
51
|
+
//# sourceMappingURL=runtimeHelpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtimeHelpers.js","sourceRoot":"","sources":["../src/runtimeHelpers.ts"],"names":[],"mappings":"AASA,OAAO,EAAW,OAAO,EAAE,MAAM,OAAO,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAItC,MAAM,OAAO,GAAG,IAAI,CAAC;AAErB,IAAI,OAAO,GAAQ,IAAI,CAAC;AAExB,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,GAAQ,EAAE,EAAE;IACrC,OAAO,GAAG,GAAG,CAAC;AAChB,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAC9B,SAAoB,EACpB,KAAa,EACb,gBAAsC,EACtC,EAAE;IACF,IAAI,SAAS,GAAG,KAAK,CAAC;IACtB,IAAI,EAAkC,CAAC;IACvC,MAAM,MAAM,GAAG,QAAQ,CAAC,SAAS,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;I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GAAG,CAAC,CAAC;AAEpD,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,GAAW,EAAE,EAAE,CAAC,GAAG,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;AAExE,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,GAAW,EAAE,EAAE,CAAC,GAAG,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;AAEhE,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,KAAc,EAAW,EAAE;IACnD,OAAO,OAAO,KAAK,KAAK,SAAS,IAAI,KAAK,YAAY,OAAO,CAAC;AAChE,CAAC,CAAC"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
declare module '@vue/runtime-core' {
|
|
2
|
+
interface GlobalComponents {
|
|
3
|
+
Frame: DefineComponent<{}>;
|
|
4
|
+
Page: DefineComponent;
|
|
5
|
+
StackLayout: DefineComponent;
|
|
6
|
+
GridLayout: DefineComponent;
|
|
7
|
+
Label: DefineComponent<{
|
|
8
|
+
text?: unknown;
|
|
9
|
+
}>;
|
|
10
|
+
Button: DefineComponent<{
|
|
11
|
+
text?: unknown;
|
|
12
|
+
}>;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
export {};
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"withCompiler.js","sourceRoot":"","sources":["../src/withCompiler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAE/C,uBAAuB,CAAC,iBAAiB,CAAC,CAAC;AAE3C,OAAO,EAAE,iBAAiB,IAAI,OAAO,EAAE,CAAC;AACxC,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
const { VueLoaderPlugin } = require('vue-loader');
|
|
2
|
+
const spawn = require('cross-spawn');
|
|
3
|
+
|
|
4
|
+
function findFreePort(startingPort = 8098) {
|
|
5
|
+
let found = false;
|
|
6
|
+
let port = startingPort;
|
|
7
|
+
|
|
8
|
+
const isPortFree = (port) =>
|
|
9
|
+
new Promise((resolve) => {
|
|
10
|
+
const server = require('http')
|
|
11
|
+
.createServer()
|
|
12
|
+
.listen(port, '0.0.0.0', () => {
|
|
13
|
+
server.close();
|
|
14
|
+
resolve(true);
|
|
15
|
+
})
|
|
16
|
+
.on('error', () => {
|
|
17
|
+
resolve(false);
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
const findFreePort = () => {
|
|
22
|
+
isPortFree(port).then((isFree) => {
|
|
23
|
+
if (!isFree) {
|
|
24
|
+
port++;
|
|
25
|
+
return findFreePort();
|
|
26
|
+
}
|
|
27
|
+
found = true;
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
findFreePort();
|
|
32
|
+
|
|
33
|
+
while (!found) {
|
|
34
|
+
process._tickCallback();
|
|
35
|
+
const start = Date.now();
|
|
36
|
+
while (Date.now() - start < 100) {
|
|
37
|
+
// busy wait... not ideal, but we need to find a port synchronously...
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return port;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function startVueDevtools(port, isAndroid = false) {
|
|
45
|
+
console.log(`[VueDevtools] Starting standalone Vue Devtools on port ${port}`);
|
|
46
|
+
if (isAndroid) {
|
|
47
|
+
console.log(
|
|
48
|
+
`[VueDevtools] If the app doesn't automatically connect, check if http traffic is allowed. (e.g. on Android, you may need to set android:usesCleartextTraffic="true" in AndroidManifest.xml)`,
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
spawn(require.resolve('@vue/devtools/bin.js'), [], {
|
|
52
|
+
stdio: 'ignore',
|
|
53
|
+
env: {
|
|
54
|
+
...process.env,
|
|
55
|
+
PORT: port,
|
|
56
|
+
},
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* @param {typeof import("@nativescript/webpack")} webpack
|
|
62
|
+
*/
|
|
63
|
+
module.exports = (webpack) => {
|
|
64
|
+
webpack.useConfig('vue');
|
|
65
|
+
|
|
66
|
+
webpack.chainWebpack((config, env) => {
|
|
67
|
+
const additionalDefines = {
|
|
68
|
+
__VUE_PROD_DEVTOOLS__: false,
|
|
69
|
+
__VUE_PROD_HYDRATION_MISMATCH_DETAILS__: false
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
// todo: support configuring the devtools host/port from the nativescript.config.ts...
|
|
73
|
+
if (!!env.vueDevtools) {
|
|
74
|
+
// find a free port for the devtools
|
|
75
|
+
const vueDevtoolsPort = findFreePort(8098);
|
|
76
|
+
const isAndroid = webpack.Utils.platform.getPlatformName() === 'android';
|
|
77
|
+
|
|
78
|
+
// on android simulators, localhost is not the host machine...
|
|
79
|
+
const vueDevtoolsHost = isAndroid
|
|
80
|
+
? 'http://10.0.2.2'
|
|
81
|
+
: 'http://localhost';
|
|
82
|
+
|
|
83
|
+
additionalDefines['__VUE_PROD_DEVTOOLS__'] = true;
|
|
84
|
+
additionalDefines['__NS_VUE_DEVTOOLS_HOST__'] =
|
|
85
|
+
JSON.stringify(vueDevtoolsHost);
|
|
86
|
+
additionalDefines['__NS_VUE_DEVTOOLS_PORT__'] = vueDevtoolsPort;
|
|
87
|
+
|
|
88
|
+
const devtoolsEntryPath = require.resolve('./devtools.js');
|
|
89
|
+
const entryPath = webpack.Utils.platform.getEntryPath();
|
|
90
|
+
const paths = config.entry('bundle').values();
|
|
91
|
+
const entryIndex = paths.indexOf(entryPath);
|
|
92
|
+
|
|
93
|
+
if (entryIndex === -1) {
|
|
94
|
+
// if the app entry is not found, add the devtools entry at the beginning - generally should not happen, but just in case.
|
|
95
|
+
paths.unshift(entryPath);
|
|
96
|
+
} else {
|
|
97
|
+
// insert devtools entry before the app entry, but after globals etc.
|
|
98
|
+
paths.splice(entryIndex, 0, devtoolsEntryPath);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
config.entry('bundle').clear().merge(paths);
|
|
102
|
+
|
|
103
|
+
// start the devtools...
|
|
104
|
+
startVueDevtools(vueDevtoolsPort, isAndroid);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// resolve any imports from "vue" to "nativescript-vue"
|
|
108
|
+
config.resolve.alias.set('vue', 'nativescript-vue');
|
|
109
|
+
|
|
110
|
+
config.plugins.get('VueLoaderPlugin').use(VueLoaderPlugin);
|
|
111
|
+
|
|
112
|
+
// use "vue-loader" from "nativescript-vue" deps rather than the one from @nativescript/webpack
|
|
113
|
+
config.module.rules
|
|
114
|
+
.get('vue')
|
|
115
|
+
.uses.get('vue-loader')
|
|
116
|
+
.loader(require.resolve('vue-loader'))
|
|
117
|
+
.tap((options) => {
|
|
118
|
+
return {
|
|
119
|
+
...options,
|
|
120
|
+
isServerBuild: false,
|
|
121
|
+
compilerOptions: {
|
|
122
|
+
// isCustomElement: (el) => el.toLowerCase() === 'label',
|
|
123
|
+
// transformHoist: null
|
|
124
|
+
},
|
|
125
|
+
};
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
config.module.rules
|
|
129
|
+
.get('css')
|
|
130
|
+
.uses.get('vue-css-loader')
|
|
131
|
+
.loader(require.resolve('vue-loader/dist/stylePostLoader.js'));
|
|
132
|
+
|
|
133
|
+
config.module.rules
|
|
134
|
+
.get('scss')
|
|
135
|
+
.uses.get('vue-css-loader')
|
|
136
|
+
.loader(require.resolve('vue-loader/dist/stylePostLoader.js'));
|
|
137
|
+
|
|
138
|
+
config.plugin('DefinePlugin').tap((args) => {
|
|
139
|
+
Object.assign(args[0], {
|
|
140
|
+
__VUE_OPTIONS_API__: true,
|
|
141
|
+
...additionalDefines,
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
return args;
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
// disable vue fork ts checker, as it doesn't work with vue3 yet?
|
|
148
|
+
config.plugin('ForkTsCheckerWebpackPlugin').tap((args) => {
|
|
149
|
+
args[0] = webpack.merge(args[0], {
|
|
150
|
+
typescript: {
|
|
151
|
+
extensions: {
|
|
152
|
+
vue: {
|
|
153
|
+
enabled: false,
|
|
154
|
+
},
|
|
155
|
+
},
|
|
156
|
+
},
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
return args;
|
|
160
|
+
});
|
|
161
|
+
});
|
|
162
|
+
};
|
package/package.json
CHANGED
|
@@ -1,31 +1,52 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nativescript-vue",
|
|
3
|
-
"version": "3.0.0-
|
|
4
|
-
"
|
|
5
|
-
"main": "index.js",
|
|
6
|
-
"module": "dist/nativescript-vue.esm-bundler.js",
|
|
3
|
+
"version": "3.0.0-rc.1",
|
|
4
|
+
"main": "dist/index.js",
|
|
7
5
|
"files": [
|
|
8
|
-
"
|
|
9
|
-
"
|
|
6
|
+
"dist/",
|
|
7
|
+
"devtools.js",
|
|
8
|
+
"nativescript.webpack.js"
|
|
10
9
|
],
|
|
11
|
-
"types": "dist/nativescript-vue.d.ts",
|
|
12
|
-
"repository": {
|
|
13
|
-
"type": "git",
|
|
14
|
-
"url": "git+https://github.com/nativescript-vue/nativescript-vue.git"
|
|
15
|
-
},
|
|
16
|
-
"keywords": [
|
|
17
|
-
"nativescript-vue"
|
|
18
|
-
],
|
|
19
|
-
"author": "Randjelovic Igor",
|
|
20
10
|
"license": "MIT",
|
|
21
|
-
"
|
|
22
|
-
"
|
|
11
|
+
"scripts": {
|
|
12
|
+
"build": "tsc",
|
|
13
|
+
"format": "prettier --write .",
|
|
14
|
+
"format:check": "prettier --check .",
|
|
15
|
+
"prepare": "simple-git-hooks",
|
|
16
|
+
"pack:template": "npm pack ./packages/template-blank",
|
|
17
|
+
"prepack": "npm run build && npm run pack:template"
|
|
23
18
|
},
|
|
24
|
-
"homepage": "https://github.com/nativescript-vue/nativescript-vue/tree/dev/packages/nativescript-vue#readme",
|
|
25
19
|
"dependencies": {
|
|
26
|
-
"@
|
|
27
|
-
"@
|
|
28
|
-
"@
|
|
29
|
-
"@vue/shared": "^3.
|
|
20
|
+
"@vue/compiler-sfc": "^3.4.3",
|
|
21
|
+
"@vue/devtools": "^6.5.1",
|
|
22
|
+
"@vue/runtime-core": "^3.4.3",
|
|
23
|
+
"@vue/shared": "^3.4.3",
|
|
24
|
+
"cross-spawn": "^7.0.3",
|
|
25
|
+
"set-value": "^4.1.0",
|
|
26
|
+
"vue-loader": "^17.4.2"
|
|
27
|
+
},
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"@commitlint/cli": "^18.4.3",
|
|
30
|
+
"@commitlint/config-conventional": "^18.4.3",
|
|
31
|
+
"@nativescript/core": "~8.6.2",
|
|
32
|
+
"@nativescript/webpack": "~5.0.18",
|
|
33
|
+
"esbuild": "^0.19.11",
|
|
34
|
+
"lint-staged": "^15.2.0",
|
|
35
|
+
"prettier": "^3.1.1",
|
|
36
|
+
"simple-git-hooks": "^2.9.0",
|
|
37
|
+
"typescript": "^5.3.3"
|
|
38
|
+
},
|
|
39
|
+
"simple-git-hooks": {
|
|
40
|
+
"pre-commit": "npx --no-install lint-staged --config=package.json",
|
|
41
|
+
"commit-msg": "npx --no-install commitlint --edit"
|
|
42
|
+
},
|
|
43
|
+
"lint-staged": {
|
|
44
|
+
"*": [
|
|
45
|
+
"prettier --ignore-unknown --write"
|
|
46
|
+
]
|
|
47
|
+
},
|
|
48
|
+
"prettier": {
|
|
49
|
+
"useTabs": false,
|
|
50
|
+
"singleQuote": true
|
|
30
51
|
}
|
|
31
52
|
}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var compiler = require('@nativescript-vue/compiler');
|
|
6
|
-
var runtime = require('@nativescript-vue/runtime');
|
|
7
|
-
var shared = require('@vue/shared');
|
|
8
|
-
|
|
9
|
-
function _interopNamespace(e) {
|
|
10
|
-
if (e && e.__esModule) { return e; } else {
|
|
11
|
-
var n = Object.create(null);
|
|
12
|
-
if (e) {
|
|
13
|
-
Object.keys(e).forEach(function (k) {
|
|
14
|
-
n[k] = e[k];
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
n['default'] = e;
|
|
18
|
-
return Object.freeze(n);
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
var runtime__namespace = /*#__PURE__*/_interopNamespace(runtime);
|
|
23
|
-
|
|
24
|
-
//
|
|
25
|
-
const compileCache = Object.create(null);
|
|
26
|
-
function compileToFunction(template, options) {
|
|
27
|
-
if (!shared.isString(template)) {
|
|
28
|
-
runtime.warn('invalid template option: ', template);
|
|
29
|
-
return shared.NOOP;
|
|
30
|
-
}
|
|
31
|
-
const key = template;
|
|
32
|
-
const cached = compileCache[key];
|
|
33
|
-
if (cached) {
|
|
34
|
-
return cached;
|
|
35
|
-
}
|
|
36
|
-
const { code } = compiler.compile(template, {
|
|
37
|
-
// at runtime - the registry should know about all elements, so we override the
|
|
38
|
-
// isNativeTag function from our standalone compiler
|
|
39
|
-
isNativeTag: tag => runtime.isKnownView(tag),
|
|
40
|
-
hoistStatic: true,
|
|
41
|
-
onError(err) {
|
|
42
|
-
// todo
|
|
43
|
-
},
|
|
44
|
-
...options
|
|
45
|
-
});
|
|
46
|
-
// console.log(code)
|
|
47
|
-
// const render = () => {}
|
|
48
|
-
const render = new Function('Vue', code)(runtime__namespace);
|
|
49
|
-
return (compileCache[key] = render);
|
|
50
|
-
}
|
|
51
|
-
runtime.registerRuntimeCompiler(compileToFunction);
|
|
52
|
-
|
|
53
|
-
Object.keys(runtime).forEach(function (k) {
|
|
54
|
-
if (k !== 'default') exports[k] = runtime[k];
|
|
55
|
-
});
|
|
56
|
-
exports.compile = compileToFunction;
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var compiler = require('@nativescript-vue/compiler');
|
|
6
|
-
var runtime = require('@nativescript-vue/runtime');
|
|
7
|
-
var shared = require('@vue/shared');
|
|
8
|
-
|
|
9
|
-
function _interopNamespace(e) {
|
|
10
|
-
if (e && e.__esModule) { return e; } else {
|
|
11
|
-
var n = Object.create(null);
|
|
12
|
-
if (e) {
|
|
13
|
-
Object.keys(e).forEach(function (k) {
|
|
14
|
-
n[k] = e[k];
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
n['default'] = e;
|
|
18
|
-
return Object.freeze(n);
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
var runtime__namespace = /*#__PURE__*/_interopNamespace(runtime);
|
|
23
|
-
|
|
24
|
-
//
|
|
25
|
-
const compileCache = Object.create(null);
|
|
26
|
-
function compileToFunction(template, options) {
|
|
27
|
-
if (!shared.isString(template)) {
|
|
28
|
-
return shared.NOOP;
|
|
29
|
-
}
|
|
30
|
-
const key = template;
|
|
31
|
-
const cached = compileCache[key];
|
|
32
|
-
if (cached) {
|
|
33
|
-
return cached;
|
|
34
|
-
}
|
|
35
|
-
const { code } = compiler.compile(template, {
|
|
36
|
-
// at runtime - the registry should know about all elements, so we override the
|
|
37
|
-
// isNativeTag function from our standalone compiler
|
|
38
|
-
isNativeTag: tag => runtime.isKnownView(tag),
|
|
39
|
-
hoistStatic: true,
|
|
40
|
-
onError(err) {
|
|
41
|
-
// todo
|
|
42
|
-
},
|
|
43
|
-
...options
|
|
44
|
-
});
|
|
45
|
-
// console.log(code)
|
|
46
|
-
// const render = () => {}
|
|
47
|
-
const render = new Function('Vue', code)(runtime__namespace);
|
|
48
|
-
return (compileCache[key] = render);
|
|
49
|
-
}
|
|
50
|
-
runtime.registerRuntimeCompiler(compileToFunction);
|
|
51
|
-
|
|
52
|
-
Object.keys(runtime).forEach(function (k) {
|
|
53
|
-
if (k !== 'default') exports[k] = runtime[k];
|
|
54
|
-
});
|
|
55
|
-
exports.compile = compileToFunction;
|