nativescript-vue 2.9.3 → 3.0.0-beta.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/README.md +10 -113
- 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 +69 -0
- package/dist/components/ActionBar.js.map +1 -0
- package/dist/components/ListView.d.ts +20 -0
- package/dist/components/ListView.js +108 -0
- package/dist/components/ListView.js.map +1 -0
- package/dist/components/ListView.working.d.ts +44 -0
- package/dist/components/ListView.working.js +126 -0
- package/dist/components/ListView.working.js.map +1 -0
- package/dist/components/index.d.ts +18 -0
- package/dist/components/index.js +7 -0
- package/dist/components/index.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 +304 -0
- package/dist/dom/index.js.map +1 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.js +66 -12847
- package/dist/index.js.map +1 -0
- package/dist/index.mjs.map +7 -0
- package/dist/nativescript/elements.d.ts +1 -0
- package/dist/nativescript/elements.js +139 -0
- package/dist/nativescript/elements.js.map +1 -0
- package/dist/nativescript/index.d.ts +6 -0
- package/dist/nativescript/index.js +27 -0
- package/dist/nativescript/index.js.map +1 -0
- package/dist/plugins/modals.d.ts +22 -0
- package/dist/plugins/modals.js +61 -0
- package/dist/plugins/modals.js.map +1 -0
- package/dist/plugins/navigation.d.ts +32 -0
- package/dist/plugins/navigation.js +129 -0
- package/dist/plugins/navigation.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 +53 -0
- package/dist/renderer/modules/events.js.map +1 -0
- package/dist/renderer/modules/style.d.ts +4 -0
- package/dist/renderer/modules/style.js +34 -0
- package/dist/renderer/modules/style.js.map +1 -0
- package/dist/renderer/nodeOps.d.ts +16 -0
- package/dist/renderer/nodeOps.js +68 -0
- package/dist/renderer/nodeOps.js.map +1 -0
- package/dist/renderer/patchProp.d.ts +2 -0
- package/dist/renderer/patchProp.js +30 -0
- package/dist/renderer/patchProp.js.map +1 -0
- package/dist/runtimeHelpers.d.ts +5 -0
- package/dist/runtimeHelpers.js +10 -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 +53 -0
- package/package.json +18 -111
- package/LICENSE +0 -21
- package/index.d.ts +0 -90
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { callWithAsyncErrorHandling, } from "@vue/runtime-core";
|
|
2
|
+
export function addEventListener(el, event, handler, options = {}) {
|
|
3
|
+
el.addEventListener(event, handler, options);
|
|
4
|
+
}
|
|
5
|
+
export function removeEventListener(el, event, handler, options = {}) {
|
|
6
|
+
el.removeEventListener(event, handler);
|
|
7
|
+
}
|
|
8
|
+
export function patchEvent(el, rawName, prevValue, nextValue, instance = null) {
|
|
9
|
+
// vei = vue event invokers
|
|
10
|
+
const invokers = el._vei || (el._vei = {});
|
|
11
|
+
const existingInvoker = invokers[rawName];
|
|
12
|
+
if (nextValue && existingInvoker) {
|
|
13
|
+
// patch
|
|
14
|
+
existingInvoker.value = nextValue;
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
const [name, options] = parseName(rawName);
|
|
18
|
+
if (nextValue) {
|
|
19
|
+
// add
|
|
20
|
+
const invoker = (invokers[rawName] = createInvoker(nextValue, instance));
|
|
21
|
+
addEventListener(el, name, invoker, options);
|
|
22
|
+
}
|
|
23
|
+
else if (existingInvoker) {
|
|
24
|
+
// remove
|
|
25
|
+
removeEventListener(el, name, existingInvoker, options);
|
|
26
|
+
invokers[rawName] = undefined;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
const optionsModifierRE = /(?:Once|Capture)$/;
|
|
31
|
+
function parseName(name) {
|
|
32
|
+
let options;
|
|
33
|
+
if (optionsModifierRE.test(name)) {
|
|
34
|
+
options = {};
|
|
35
|
+
let m;
|
|
36
|
+
while ((m = name.match(optionsModifierRE))) {
|
|
37
|
+
name = name.slice(0, name.length - m[0].length);
|
|
38
|
+
options[m[0].toLowerCase()] = true;
|
|
39
|
+
options;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
// return event name by removing on prefix. eg. onitemTap -> itemTap
|
|
43
|
+
return [name.slice(2), options];
|
|
44
|
+
// return [hyphenate(name.slice(2)), options]
|
|
45
|
+
}
|
|
46
|
+
function createInvoker(initialValue, instance) {
|
|
47
|
+
const invoker = (e) => {
|
|
48
|
+
callWithAsyncErrorHandling(invoker.value, instance, 5, [e]);
|
|
49
|
+
};
|
|
50
|
+
invoker.value = initialValue;
|
|
51
|
+
return invoker;
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=events.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"events.js","sourceRoot":"","sources":["../../../src/renderer/modules/events.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,0BAA0B,GAE3B,MAAM,m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AAC;AAE9C,SAAS,SAAS,CAAC,IAAY;IAC7B,IAAI,OAAyC,CAAC;IAC9C,IAAI,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;QAChC,OAAO,GAAG,EAAE,CAAC;QACb,IAAI,CAAC,CAAC;QACN,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC,EAAE;YAC1C,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;YAC/C,OAAe,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,GAAG,IAAI,CAAC;YAC5C,OAAO,CAAC;SACT;KACF;IACD,oEAAoE;IACpE,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;IAChC,6CAA6C;AAC/C,CAAC;AAED,SAAS,aAAa,CACpB,YAAwB,EACxB,QAA0C;IAE1C,MAAM,OAAO,GAAY,CAAC,CAAQ,EAAE,EAAE;QACpC,0BAA0B,CAAC,OAAO,CAAC,KAAK,EAAE,QAAQ,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IAC9D,CAAC,CAAC;IACF,OAAO,CAAC,KAAK,GAAG,YAAY,CAAC;IAC7B,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
function isRule(node) {
|
|
2
|
+
return node.type === "rule";
|
|
3
|
+
}
|
|
4
|
+
function isDeclaration(node) {
|
|
5
|
+
return node.type === "declaration";
|
|
6
|
+
}
|
|
7
|
+
function createDeclaration(decl) {
|
|
8
|
+
return { property: decl.property.toLowerCase(), value: decl.value };
|
|
9
|
+
}
|
|
10
|
+
function declarationsFromAstNodes(astRules) {
|
|
11
|
+
return astRules.filter(isRule).map((rule) => {
|
|
12
|
+
return rule.declarations.filter(isDeclaration).map(createDeclaration);
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
export function patchStyle(el, prev, next) {
|
|
16
|
+
if (prev) {
|
|
17
|
+
// todo: check if we can substitute cssTreeParse with parseInlineCSS from compiler/transforms/transformStyle (by extracting it to shared)
|
|
18
|
+
// reset previous styles
|
|
19
|
+
const localStyle = `local { ${prev} }`;
|
|
20
|
+
// const ast: any = cssTreeParse(localStyle, undefined)
|
|
21
|
+
// const [declarations] = declarationsFromAstNodes(ast.stylesheet.rules)
|
|
22
|
+
// declarations.forEach((d: any) => {
|
|
23
|
+
// ;(el.nativeView.style as any)[d.property] = unsetValue
|
|
24
|
+
// })
|
|
25
|
+
}
|
|
26
|
+
if (!next) {
|
|
27
|
+
el.removeAttribute("style");
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
// set new styles
|
|
31
|
+
el.style = next;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=style.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"style.js","sourceRoot":"","sources":["../../../src/renderer/modules/style.ts"],"names":[],"mappings":"AAIA,SAAS,MAAM,CAAC,IAAS;IACvB,OAAO,IAAI,CAAC,IAAI,KAAK,MAAM,CAAC;AAC9B,CAAC;AAED,SAAS,aAAa,CAAC,IAAS;IAC9B,OAAO,IAAI,CAAC,IAAI,KAAK,aAAa,CAAC;AACrC,CAAC;AAED,SAAS,iBAAiB,CAAC,IAAS;IAClC,OAAO,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,CAAC,WAAW,EAAE,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC;AACtE,CAAC;AAED,SAAS,wBAAwB,CAAC,QAAe;IAC/C,OAAO,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;QAC1C,OAAO,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;IACxE,CAAC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,EAAc,EAAE,IAAW,EAAE,IAAW;IACjE,IAAI,IAAI,EAAE;QACR,yIAAyI;QACzI,wBAAwB;QACxB,MAAM,UAAU,GAAG,WAAW,IAAI,IAAI,CAAC;QACvC,uDAAuD;QACvD,wEAAwE;QAExE,qCAAqC;QACrC,2DAA2D;QAC3D,KAAK;KACN;IAED,IAAI,CAAC,IAAI,EAAE;QACT,EAAE,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;KAC7B;SAAM;QACL,iBAAiB;QACjB,EAAE,CAAC,KAAK,GAAG,IAAI,CAAC;KACjB;AACH,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { VNodeProps, RendererOptions } from "@vue/runtime-dom";
|
|
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, isSVG?: boolean | undefined, 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, isSvg: boolean, start?: NSVNode, end?: NSVNode): [NSVNode, NSVNode];
|
|
16
|
+
export declare const nodeOps: Omit<RendererOptions, 'patchProp'>;
|
|
@@ -0,0 +1,68 @@
|
|
|
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, isSVG, 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
|
+
// insertStaticContent?(content: string, parent: HostElement, anchor: HostNode | null, isSVG: boolean, start?: HostNode | null, end?: HostNode | null): [HostNode, HostNode];
|
|
49
|
+
export function insertStaticContent(content, parent, anchor, isSvg, start, end) {
|
|
50
|
+
console.log("insert static content - not implemented.");
|
|
51
|
+
return [undefined, undefined];
|
|
52
|
+
}
|
|
53
|
+
export const nodeOps = {
|
|
54
|
+
insert,
|
|
55
|
+
remove,
|
|
56
|
+
createElement,
|
|
57
|
+
createText,
|
|
58
|
+
createComment,
|
|
59
|
+
setText,
|
|
60
|
+
setElementText,
|
|
61
|
+
parentNode,
|
|
62
|
+
nextSibling,
|
|
63
|
+
cloneNode,
|
|
64
|
+
insertStaticContent,
|
|
65
|
+
// querySelector,
|
|
66
|
+
// setScopeId,
|
|
67
|
+
};
|
|
68
|
+
//# sourceMappingURL=nodeOps.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nodeOps.js","sourceRoot":"","sources":["../../src/renderer/nodeOps.ts"],"names":[],"mappings":"AAEA,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;QACnB,gCAAgC;QAChC,MAAM,CAAC,YAAY,CAAC,EAAE,EAAE,MAAM,CAAC,CAAC;KACjC;SAAM;QACL,MAAM,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;KACxB;AACH,CAAC;AAED,MAAM,UAAU,MAAM,CAAC,EAAW;IAChC,IAAI,EAAE,CAAC,UAAU,IAAI,IAAI,EAAE;QACzB,EAAE,CAAC,UAAU,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;KAC/B;AACH,CAAC;AAED,MAAM,UAAU,aAAa,CAC3B,IAAY,EACZ,KAA2B,EAC3B,mBAAwC,EACxC,UAAqE;IAErE,sCAAsC;IACtC,OAAO,IAAI,UAAU,CAAC,IAAI,CAAC,CA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
|
+
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 { isOn } from "../runtimeHelpers";
|
|
6
|
+
export function patchProp(el, key, prevValue, nextValue, isSVG = false, prevChildren, parentComponent, parentSuspense, unmountChildren) {
|
|
7
|
+
switch (key) {
|
|
8
|
+
// special
|
|
9
|
+
case "class":
|
|
10
|
+
// console.log('->patchProp+Class')
|
|
11
|
+
patchClass(el, nextValue);
|
|
12
|
+
break;
|
|
13
|
+
case "style":
|
|
14
|
+
// console.log('->patchProp+Style')
|
|
15
|
+
patchStyle(el, prevValue, nextValue);
|
|
16
|
+
break;
|
|
17
|
+
case "modelValue":
|
|
18
|
+
case "onUpdate:modelValue":
|
|
19
|
+
// handled by v-model directive
|
|
20
|
+
break;
|
|
21
|
+
default:
|
|
22
|
+
if (isOn(key)) {
|
|
23
|
+
patchEvent(el, key, prevValue, nextValue, parentComponent);
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
patchAttr(el, key, prevValue, nextValue);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
//# 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,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAEzC,MAAM,UAAU,SAAS,CACvB,EAAc,EACd,GAAW,EACX,SAAc,EACd,SAAc,EACd,KAAK,GAAG,KAAK,EACb,YAAiB,EACjB,eAAoB,EACpB,cAAmB,EACnB,eAAoB;IAEpB,QAAQ,GAAG,EAAE;QACX,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,+BAA+B;YAC/B,MAAM;QACR;YACE,IAAI,IAAI,CAAC,GAAG,CAAC,EAAE;gBACb,UAAU,CAAC,EAAE,EAAE,GAAG,EAAE,SAAS,EAAE,SAAS,EAAE,eAAe,CAAC,CAAC;aAC5D;iBAAM;gBACL,SAAS,CAAC,EAAE,EAAE,GAAG,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC;aAC1C;KACJ;AACH,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const ELEMENT_REF: unique symbol;
|
|
2
|
+
export declare const isOn: (key: string) => boolean;
|
|
3
|
+
export declare const isAndroidKey: (key: string) => boolean;
|
|
4
|
+
export declare const isIOSKey: (key: string) => boolean;
|
|
5
|
+
export declare const isBoolean: (value: unknown) => boolean;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
const __DEV__ = true;
|
|
2
|
+
export const ELEMENT_REF = Symbol(__DEV__ ? `elementRef` : ``);
|
|
3
|
+
const onRE = /^on.+/;
|
|
4
|
+
export const isOn = (key) => onRE.test(key);
|
|
5
|
+
export const isAndroidKey = (key) => key.startsWith("android:");
|
|
6
|
+
export const isIOSKey = (key) => key.startsWith("ios:");
|
|
7
|
+
export const isBoolean = (value) => {
|
|
8
|
+
return typeof value === "boolean" || value instanceof Boolean;
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=runtimeHelpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtimeHelpers.js","sourceRoot":"","sources":["../src/runtimeHelpers.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,GAAG,IAAI,CAAC;AAGrB,MAAM,CAAC,MAAM,WAAW,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;AAE/D,MAAM,IAAI,GAAG,OAAO,CAAC;AACrB,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,GAAW,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,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,IAAI,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAE/C,uBAAuB,CAAC,iBAAiB,CAAC,CAAC;AAE3C,OAAO,EAAE,iBAAiB,IAAI,OAAO,EAAE,CAAA;AACvC,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
const { VueLoaderPlugin } = require("vue-loader");
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @param {typeof import("@nativescript/webpack")} webpack
|
|
5
|
+
*/
|
|
6
|
+
module.exports = (webpack) => {
|
|
7
|
+
webpack.useConfig("vue");
|
|
8
|
+
|
|
9
|
+
webpack.chainWebpack((config) => {
|
|
10
|
+
config.resolve.alias.set('vue', 'nativescript-vue');
|
|
11
|
+
|
|
12
|
+
config.plugin("VueLoaderPlugin").use(VueLoaderPlugin);
|
|
13
|
+
|
|
14
|
+
config.module
|
|
15
|
+
.rule("vue")
|
|
16
|
+
.test(/\.vue$/)
|
|
17
|
+
.use("vue-loader")
|
|
18
|
+
.loader(require.resolve("vue-loader"))
|
|
19
|
+
.tap((options) => {
|
|
20
|
+
return {
|
|
21
|
+
...options,
|
|
22
|
+
isServerBuild: false,
|
|
23
|
+
compilerOptions: {
|
|
24
|
+
// isCustomElement: (el) => el.toLowerCase() === 'label',
|
|
25
|
+
// transformHoist: null
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
config.plugin("DefinePlugin").tap((args) => {
|
|
31
|
+
Object.assign(args[0], {
|
|
32
|
+
__VUE_OPTIONS_API__: true,
|
|
33
|
+
__VUE_PROD_DEVTOOLS__: false,
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
return args;
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
// disable vue fork ts checker, as it doesn't work with vue3 yet?
|
|
40
|
+
config.plugin("ForkTsCheckerWebpackPlugin").tap((args) => {
|
|
41
|
+
args[0] = webpack.merge(args[0], {
|
|
42
|
+
typescript: {
|
|
43
|
+
extensions: {
|
|
44
|
+
vue: {
|
|
45
|
+
enabled: false,
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
});
|
|
50
|
+
return args;
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
};
|
package/package.json
CHANGED
|
@@ -1,122 +1,29 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nativescript-vue",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "NativeScript and Vue integration",
|
|
3
|
+
"version": "3.0.0-beta.1",
|
|
5
4
|
"main": "dist/index.js",
|
|
6
5
|
"files": [
|
|
7
|
-
"dist/
|
|
8
|
-
"
|
|
9
|
-
"dist/hooks/**",
|
|
10
|
-
"postinstall.js",
|
|
11
|
-
"preuninstall.js"
|
|
6
|
+
"dist/",
|
|
7
|
+
"nativescript.webpack.js"
|
|
12
8
|
],
|
|
13
|
-
"typings": "index.d.ts",
|
|
14
|
-
"scripts": {
|
|
15
|
-
"prepare": "husky install && patch-package",
|
|
16
|
-
"test": "jest",
|
|
17
|
-
"tdd": "jest --watch",
|
|
18
|
-
"dev": "npm run dev:core -- -w & npm run dev:compiler -- -w",
|
|
19
|
-
"dev:core": "rollup -c build/config.js --o dist/index.js --environment TARGET:nativescript-vue",
|
|
20
|
-
"dev:compiler": "rollup -c build/config.js --environment TARGET:nativescript-vue-template-compiler",
|
|
21
|
-
"build": "node build/build.js",
|
|
22
|
-
"prettier": "prettier --write \"{{platform,__test__}/**/*.js,samples/app/*.js}\"",
|
|
23
|
-
"release": "node build/releaser.js",
|
|
24
|
-
"release:notes": "node build/gen-release-notes.js",
|
|
25
|
-
"changelog": "conventional-changelog --release-count 0 --outfile CHANGELOG.md --preset angular",
|
|
26
|
-
"commit": "git-cz"
|
|
27
|
-
},
|
|
28
|
-
"repository": {
|
|
29
|
-
"type": "git",
|
|
30
|
-
"url": "git+https://github.com/nativescript-vue/nativescript-vue.git"
|
|
31
|
-
},
|
|
32
|
-
"keywords": [
|
|
33
|
-
"vuejs",
|
|
34
|
-
"nativescript",
|
|
35
|
-
"integration"
|
|
36
|
-
],
|
|
37
|
-
"author": "Igor Randjelovic",
|
|
38
9
|
"license": "MIT",
|
|
39
|
-
"
|
|
40
|
-
"
|
|
10
|
+
"scripts": {
|
|
11
|
+
"build": "tsc",
|
|
12
|
+
"prepack": "npm run build"
|
|
41
13
|
},
|
|
42
|
-
"
|
|
43
|
-
|
|
44
|
-
"
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
"plugin": {
|
|
49
|
-
"vue": "true",
|
|
50
|
-
"pan": "false",
|
|
51
|
-
"core3": "true",
|
|
52
|
-
"category": "Developer"
|
|
53
|
-
}
|
|
14
|
+
"dependencies": {
|
|
15
|
+
"@vue/compiler-dom": "^3.2.41",
|
|
16
|
+
"@vue/runtime-dom": "^3.2.41",
|
|
17
|
+
"@vue/compiler-sfc": "^3.2.41",
|
|
18
|
+
"set-value": "^4.1.0",
|
|
19
|
+
"vue-loader": "^17.0.0"
|
|
54
20
|
},
|
|
55
21
|
"devDependencies": {
|
|
56
|
-
"@
|
|
57
|
-
"@
|
|
58
|
-
"
|
|
59
|
-
"
|
|
60
|
-
"
|
|
61
|
-
"
|
|
62
|
-
"@rollup/plugin-alias": "3.1.9",
|
|
63
|
-
"@rollup/plugin-buble": "0.21.3",
|
|
64
|
-
"@rollup/plugin-commonjs": "22.0.0",
|
|
65
|
-
"@rollup/plugin-node-resolve": "13.3.0",
|
|
66
|
-
"@rollup/plugin-replace": "4.0.0",
|
|
67
|
-
"babel-jest": "28.1.0",
|
|
68
|
-
"chalk": "5.0.1",
|
|
69
|
-
"commitizen": "4.2.4",
|
|
70
|
-
"conventional-changelog-cli": "2.2.2",
|
|
71
|
-
"cz-conventional-changelog": "3.3.0",
|
|
72
|
-
"husky": "8.0.1",
|
|
73
|
-
"inquirer": "8.2.4",
|
|
74
|
-
"jest": "28.1.0",
|
|
75
|
-
"jest-junit": "13.2.0",
|
|
76
|
-
"lint-staged": "12.4.1",
|
|
77
|
-
"patch-package": "^6.4.7",
|
|
78
|
-
"prettier": "2.6.2",
|
|
79
|
-
"rollup": "^2.72.1",
|
|
80
|
-
"rollup-plugin-flow-no-whitespace": "1.0.0",
|
|
81
|
-
"rollup-plugin-resolve-aliases": "0.3.0",
|
|
82
|
-
"semver": "7.3.7",
|
|
83
|
-
"set-value": "4.1.0",
|
|
84
|
-
"vue": "2.6.14"
|
|
85
|
-
},
|
|
86
|
-
"jest": {
|
|
87
|
-
"verbose": true,
|
|
88
|
-
"modulePaths": [
|
|
89
|
-
"<rootDir>/platform/nativescript"
|
|
90
|
-
],
|
|
91
|
-
"collectCoverageFrom": [
|
|
92
|
-
"platform/**/*.js",
|
|
93
|
-
"!**/node_modules/**"
|
|
94
|
-
],
|
|
95
|
-
"moduleDirectories": [
|
|
96
|
-
"node_modules"
|
|
97
|
-
],
|
|
98
|
-
"modulePathIgnorePatterns": [
|
|
99
|
-
"<rootDir>/samples"
|
|
100
|
-
],
|
|
101
|
-
"collectCoverage": true,
|
|
102
|
-
"testEnvironmentOptions": {
|
|
103
|
-
"url": "http://localhost"
|
|
104
|
-
}
|
|
105
|
-
},
|
|
106
|
-
"prettier": {
|
|
107
|
-
"semi": false,
|
|
108
|
-
"singleQuote": true,
|
|
109
|
-
"trailingComma": "none",
|
|
110
|
-
"arrowParens": "avoid"
|
|
111
|
-
},
|
|
112
|
-
"lint-staged": {
|
|
113
|
-
"{{platform,__test__}/**/*.js,samples/app/*.js}": [
|
|
114
|
-
"prettier --write"
|
|
115
|
-
]
|
|
116
|
-
},
|
|
117
|
-
"config": {
|
|
118
|
-
"commitizen": {
|
|
119
|
-
"path": "./node_modules/cz-conventional-changelog"
|
|
120
|
-
}
|
|
22
|
+
"@nativescript/core": "^8.3.5",
|
|
23
|
+
"@nativescript/webpack": "~5.0.12",
|
|
24
|
+
"esbuild": "^0.15.12",
|
|
25
|
+
"tsx": "^3.11.0",
|
|
26
|
+
"typescript": "^4.8.4",
|
|
27
|
+
"vue": "^3.2.41"
|
|
121
28
|
}
|
|
122
29
|
}
|
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2017 Igor Randjelovic
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
package/index.d.ts
DELETED
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Page,
|
|
3
|
-
NavigationEntry,
|
|
4
|
-
BackstackEntry,
|
|
5
|
-
} from '@nativescript/core'
|
|
6
|
-
import { ItemEventData } from '@nativescript/core'
|
|
7
|
-
import { View } from '@nativescript/core'
|
|
8
|
-
import { ShowModalOptions } from '@nativescript/core'
|
|
9
|
-
import { Vue, VueConstructor, VueConfiguration } from 'vue/types/vue'
|
|
10
|
-
|
|
11
|
-
// ListView ItemEventData with the addition of the item property
|
|
12
|
-
export type NativeScriptVueItemEventData<T> = ItemEventData & { item: T }
|
|
13
|
-
|
|
14
|
-
// TODO: define fully.
|
|
15
|
-
type TargetFrame = any;
|
|
16
|
-
|
|
17
|
-
export interface NavigationEntryVue extends NavigationEntry {
|
|
18
|
-
props?: Record<string, any>,
|
|
19
|
-
frame?: TargetFrame,
|
|
20
|
-
resolveOnEvent?: "navigatingTo" | "navigatedTo" | string
|
|
21
|
-
// Page.navigatingToEvent | Page.navigatedToEvent
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export type navigateTo = (
|
|
25
|
-
component: VueConstructor,
|
|
26
|
-
options?: NavigationEntryVue,
|
|
27
|
-
cb?: () => Page,
|
|
28
|
-
) => Promise<Page>
|
|
29
|
-
|
|
30
|
-
export type navigateBack = (
|
|
31
|
-
options?: {
|
|
32
|
-
frame?: TargetFrame
|
|
33
|
-
},
|
|
34
|
-
backstackEntry?: BackstackEntry,
|
|
35
|
-
) => void
|
|
36
|
-
|
|
37
|
-
export interface ModalOptions extends Partial<ShowModalOptions> {
|
|
38
|
-
target?: any; // optional Vue target to open the modal from
|
|
39
|
-
props?: Record<string, any>;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
declare module 'vue/types/vue' {
|
|
43
|
-
// 3. Declare augmentation for Vue
|
|
44
|
-
interface Vue<V = View> {
|
|
45
|
-
nativeView: V
|
|
46
|
-
|
|
47
|
-
$navigateTo: navigateTo
|
|
48
|
-
$navigateBack: navigateBack
|
|
49
|
-
|
|
50
|
-
$modal?: { close: (data?: any) => Promise<typeof data> };
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* Open a modal using a component
|
|
54
|
-
* @param {typeof Vue} component
|
|
55
|
-
* @param {ModalOptions} options
|
|
56
|
-
* @returns {any}
|
|
57
|
-
*/
|
|
58
|
-
$showModal: (component: typeof Vue, options?: ModalOptions) => Promise<any>;
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* starts the nativescript application
|
|
62
|
-
*/
|
|
63
|
-
$start: () => void
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
export interface NativeScriptVue<V = View> extends Vue<V>{};
|
|
67
|
-
export interface NativeScriptVueConstructor<V = View> extends VueConstructor<NativeScriptVue<V>>
|
|
68
|
-
{
|
|
69
|
-
navigateTo: navigateTo
|
|
70
|
-
navigateBack: navigateBack
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* Registers NativeScript Plugin.
|
|
74
|
-
* @param elementName Name of the element to use in your template
|
|
75
|
-
* @param resolver function to register the element
|
|
76
|
-
* @param meta meta associated with the element
|
|
77
|
-
*/
|
|
78
|
-
registerElement: (elementName: string, resolver: Function, meta?: any) => void
|
|
79
|
-
|
|
80
|
-
config: NativeScriptVueConfiguration
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
interface NativeScriptVueConfiguration extends VueConfiguration {
|
|
84
|
-
suppressRenderLogs: boolean;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
export const NativeScriptVue: NativeScriptVueConstructor
|
|
88
|
-
|
|
89
|
-
// export as namespace NativeScriptVue;
|
|
90
|
-
export default NativeScriptVue;
|