nativescript-vue 3.0.0-beta.6 → 3.0.0-beta.7
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 +3 -4
- package/dist/components/ActionBar.d.ts +1 -1
- package/dist/components/ActionBar.js +5 -5
- package/dist/components/ListView.d.ts +2 -2
- package/dist/components/ListView.js +10 -11
- package/dist/components/ListView.js.map +1 -1
- package/dist/components/index.d.ts +6 -5
- package/dist/components/index.js +2 -2
- package/dist/components/index.js.map +1 -1
- package/dist/directives/vShow.d.ts +2 -2
- package/dist/directives/vShow.js +4 -4
- package/dist/dom/index.d.ts +1 -1
- package/dist/dom/index.js +7 -6
- package/dist/dom/index.js.map +1 -1
- package/dist/index.d.ts +13 -13
- package/dist/index.js +18 -18
- package/dist/nativescript/elements.js +54 -54
- package/dist/nativescript/index.d.ts +3 -3
- package/dist/nativescript/index.js +3 -3
- package/dist/plugins/modals.d.ts +5 -5
- package/dist/plugins/modals.js +46 -24
- package/dist/plugins/modals.js.map +1 -1
- package/dist/plugins/navigation.d.ts +6 -6
- package/dist/plugins/navigation.js +52 -72
- package/dist/plugins/navigation.js.map +1 -1
- 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 +1 -1
- package/dist/registry/index.js +2 -2
- package/dist/registry/index.js.map +1 -1
- package/dist/renderer/index.js +3 -3
- package/dist/renderer/modules/attrs.d.ts +1 -1
- package/dist/renderer/modules/attrs.js +3 -3
- package/dist/renderer/modules/class.d.ts +1 -1
- package/dist/renderer/modules/class.js +2 -2
- package/dist/renderer/modules/events.d.ts +2 -2
- package/dist/renderer/modules/events.js +2 -2
- package/dist/renderer/modules/style.d.ts +1 -1
- package/dist/renderer/modules/style.js +6 -6
- package/dist/renderer/nodeOps.d.ts +3 -3
- package/dist/renderer/nodeOps.js +4 -4
- package/dist/renderer/patchProp.d.ts +1 -1
- package/dist/renderer/patchProp.js +11 -11
- package/dist/runtimeHelpers.d.ts +8 -13
- package/dist/runtimeHelpers.js +14 -12
- package/dist/runtimeHelpers.js.map +1 -1
- package/dist/types.d.ts +1 -1
- package/nativescript.webpack.js +24 -12
- package/package.json +26 -10
package/dist/plugins/modals.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Application, View } from
|
|
2
|
-
import { warn, } from
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import { Application, View } from '@nativescript/core';
|
|
2
|
+
import { unref, warn, } from '@vue/runtime-core';
|
|
3
|
+
import { NSVElement, NSVRoot } from '../dom';
|
|
4
|
+
import { createNativeView } from '../runtimeHelpers';
|
|
5
|
+
import { isObject } from '@vue/shared';
|
|
6
6
|
/**
|
|
7
7
|
* @internal
|
|
8
8
|
*/
|
|
@@ -10,22 +10,20 @@ export function install(app) {
|
|
|
10
10
|
app.config.globalProperties.$showModal = $showModal;
|
|
11
11
|
}
|
|
12
12
|
function resolveModalTarget(target) {
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
const ob = unref(target);
|
|
14
|
+
if (ob instanceof NSVElement) {
|
|
15
|
+
return ob.nativeView;
|
|
15
16
|
}
|
|
16
|
-
else if (
|
|
17
|
-
return
|
|
17
|
+
else if (ob instanceof View) {
|
|
18
|
+
return ob;
|
|
18
19
|
}
|
|
19
|
-
else if (
|
|
20
|
-
return
|
|
20
|
+
else if (isObject(ob) && isObject(ob.$el)) {
|
|
21
|
+
return ob.$el.nativeView;
|
|
21
22
|
}
|
|
22
23
|
return false;
|
|
23
24
|
}
|
|
24
|
-
export async function $showModal(component, options) {
|
|
25
|
-
|
|
26
|
-
target: Application.getRootView(),
|
|
27
|
-
}, options);
|
|
28
|
-
const modalTarget = resolveModalTarget(options.target);
|
|
25
|
+
export async function $showModal(component, options = {}) {
|
|
26
|
+
const modalTarget = resolveModalTarget(options.target ?? Application.getRootView());
|
|
29
27
|
if (!modalTarget) {
|
|
30
28
|
if (__DEV__) {
|
|
31
29
|
warn(`could not open modal because the target does not exist`);
|
|
@@ -34,24 +32,48 @@ export async function $showModal(component, options) {
|
|
|
34
32
|
}
|
|
35
33
|
return new Promise((resolve) => {
|
|
36
34
|
let isResolved = false;
|
|
37
|
-
let
|
|
38
|
-
|
|
35
|
+
let isReloading = false;
|
|
36
|
+
let root = new NSVRoot();
|
|
37
|
+
const reloadModal = () => {
|
|
38
|
+
isReloading = true;
|
|
39
|
+
closeModal();
|
|
40
|
+
// reopening is done in `closeCallback`
|
|
41
|
+
};
|
|
42
|
+
let view = createNativeView(component, options.props, {
|
|
43
|
+
reload: reloadModal,
|
|
44
|
+
});
|
|
39
45
|
const closeCallback = (data) => {
|
|
40
46
|
if (isResolved)
|
|
41
47
|
return;
|
|
48
|
+
if (isReloading) {
|
|
49
|
+
view.unmount();
|
|
50
|
+
view.mount(root);
|
|
51
|
+
openModal({
|
|
52
|
+
// todo: for this to work nicely, we'd need to add `animated: false` to `closeModal` as well
|
|
53
|
+
// but not currently possible without a core change.
|
|
54
|
+
// animated: false,
|
|
55
|
+
});
|
|
56
|
+
isReloading = false;
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
42
59
|
isResolved = true;
|
|
43
60
|
view.unmount();
|
|
44
61
|
view = null;
|
|
45
62
|
resolve(data);
|
|
46
63
|
};
|
|
64
|
+
const openModal = (additionalOptions) => {
|
|
65
|
+
modalTarget.showModal(view.nativeView, {
|
|
66
|
+
...options,
|
|
67
|
+
context: null,
|
|
68
|
+
closeCallback,
|
|
69
|
+
...additionalOptions,
|
|
70
|
+
});
|
|
71
|
+
};
|
|
72
|
+
const closeModal = (...args) => view.nativeView?.closeModal(...args);
|
|
47
73
|
view.context.config.globalProperties.$closeModal = closeModal;
|
|
48
74
|
view.context.config.globalProperties.$modal = { close: closeModal };
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
...options,
|
|
52
|
-
context: null,
|
|
53
|
-
closeCallback,
|
|
54
|
-
});
|
|
75
|
+
view.mount(root);
|
|
76
|
+
openModal();
|
|
55
77
|
});
|
|
56
78
|
}
|
|
57
79
|
//# sourceMappingURL=modals.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modals.js","sourceRoot":"","sources":["../../src/plugins/modals.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAoB,IAAI,EAAE,MAAM,oBAAoB,CAAC;AACzE,OAAO,
|
|
1
|
+
{"version":3,"file":"modals.js","sourceRoot":"","sources":["../../src/plugins/modals.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAoB,IAAI,EAAE,MAAM,oBAAoB,CAAC;AACzE,OAAO,EAKL,KAAK,EACL,IAAI,GACL,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAyBvC;;GAEG;AACH,MAAM,UAAU,OAAO,CAAC,GAAQ;IAC9B,GAAG,CAAC,MAAM,CAAC,gBAAgB,CAAC,UAAU,GAAG,UAAU,CAAC;AACtD,CAAC;AAED,SAAS,kBAAkB,CACzB,MAA0D;IAE1D,MAAM,EAAE,GAAG,KAAK,CAAwB,MAAM,CAAC,CAAC;IAEhD,IAAI,EAAE,YAAY,UAAU,EAAE;QAC5B,OAAO,EAAE,CAAC,UAAU,CAAC;KACtB;SAAM,IAAI,EAAE,YAAY,IAAI,EAAE;QAC7B,OAAO,EAAE,CAAC;KACX;SAAM,IAAI,QAAQ,CAAC,EAAE,CAAC,IAAI,QAAQ,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE;QAC3C,OAAO,EAAE,CAAC,GAAG,CAAC,UAAU,CAAC;KAC1B;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,UAAU,CAC9B,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;gBACrC,GAAG,OAAO;gBACV,OAAO,EAAE,IAAI;gBACb,aAAa;gBACb,GAAG,iBAAiB;aACrB,CAAC,CAAC;QACL,CAAC,CAAC;QACF,MAAM,UAAU,GAAG,CAAC,GAAG,IAAW,EAAE,EAAE,CAAC,IAAI,CAAC,UAAU,EAAE,UAAU,CAAC,GAAG,IAAI,CAAC,CAAC;QAE5E,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,gBAAgB,CAAC,WAAW,GAAG,UAAU,CAAC;QAC9D,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,gBAAgB,CAAC,MAAM,GAAG,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC;QAEpE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACjB,SAAS,EAAE,CAAC;IACd,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Frame, NavigationEntry, Page } from
|
|
2
|
-
import { App, Component, Ref } from
|
|
3
|
-
import { NSVElement } from
|
|
4
|
-
declare module
|
|
1
|
+
import { Frame, NavigationEntry, Page } from '@nativescript/core';
|
|
2
|
+
import { App, Component, Ref } from '@vue/runtime-core';
|
|
3
|
+
import { NSVElement } from '../dom';
|
|
4
|
+
declare module '@vue/runtime-core' {
|
|
5
5
|
interface ComponentCustomProperties {
|
|
6
6
|
/**
|
|
7
7
|
* todo: update docblock
|
|
@@ -11,7 +11,7 @@ declare module "@vue/runtime-core" {
|
|
|
11
11
|
* @param target
|
|
12
12
|
* @param options
|
|
13
13
|
*/
|
|
14
|
-
$navigateTo: (target: Component, options?: NavigationOptions) =>
|
|
14
|
+
$navigateTo: (target: Component, options?: NavigationOptions) => Page;
|
|
15
15
|
$navigateBack: (options?: NavigationOptions) => void;
|
|
16
16
|
}
|
|
17
17
|
}
|
|
@@ -27,6 +27,6 @@ export interface BackNavigationOptions {
|
|
|
27
27
|
* @internal
|
|
28
28
|
*/
|
|
29
29
|
export declare function install(app: App): void;
|
|
30
|
-
export declare function $navigateTo(target: Component, options?: NavigationOptions):
|
|
30
|
+
export declare function $navigateTo(target: Component, options?: NavigationOptions): Page;
|
|
31
31
|
export declare function $navigateBack(options?: BackNavigationOptions): Promise<void>;
|
|
32
32
|
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Frame } from
|
|
2
|
-
import { unref } from
|
|
3
|
-
import { NSVElement, NSVRoot } from
|
|
4
|
-
import { createNativeView } from
|
|
1
|
+
import { Frame } from '@nativescript/core';
|
|
2
|
+
import { nextTick, unref } from '@vue/runtime-core';
|
|
3
|
+
import { NSVElement, NSVRoot } from '../dom';
|
|
4
|
+
import { createNativeView } from '../runtimeHelpers';
|
|
5
5
|
/**
|
|
6
6
|
* @internal
|
|
7
7
|
*/
|
|
@@ -25,102 +25,82 @@ function resolveFrame(frame) {
|
|
|
25
25
|
// right now, empty frames can't be navigated as they are not recognized by `getFrameById`
|
|
26
26
|
return Frame.getFrameById(ob);
|
|
27
27
|
}
|
|
28
|
-
function
|
|
29
|
-
const defaultRoot = new NSVRoot();
|
|
30
|
-
// flag to indicate when we need to call resetRoot
|
|
31
|
-
// usually happens when the root component is re-mounted (HMR)
|
|
32
|
-
let shouldResetRoot = false;
|
|
33
|
-
const appendChild = defaultRoot.appendChild.bind(defaultRoot);
|
|
34
|
-
const removeChild = defaultRoot.removeChild.bind(defaultRoot);
|
|
35
|
-
defaultRoot.removeChild = (el) => {
|
|
36
|
-
removeChild(el);
|
|
37
|
-
shouldResetRoot = true;
|
|
38
|
-
// console.log("remove child", (el as NSVElement).tagName);
|
|
39
|
-
};
|
|
40
|
-
defaultRoot.appendChild = (el) => {
|
|
41
|
-
appendChild(el);
|
|
42
|
-
if (shouldResetRoot) {
|
|
43
|
-
shouldResetRoot = false;
|
|
44
|
-
// console.log("append child", (el as NSVElement).tagName);
|
|
45
|
-
cb(el.nativeView);
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
return defaultRoot;
|
|
49
|
-
}
|
|
50
|
-
function attachDisposeCallbacks(targetPage, disposeCallback) {
|
|
51
|
-
// const handler = (args: NavigatedData) => {
|
|
52
|
-
// if (args.isBackNavigation) {
|
|
53
|
-
// console.log("navigatedFrom called.");
|
|
54
|
-
// targetPage.off("navigatedFrom", handler as any);
|
|
55
|
-
// disposeCallback();
|
|
56
|
-
// }
|
|
57
|
-
// };
|
|
58
|
-
// targetPage.on("navigatedFrom", handler);
|
|
59
|
-
const dispose = targetPage.disposeNativeView;
|
|
60
|
-
targetPage.disposeNativeView = () => {
|
|
61
|
-
// console.log("dispose native view called.");
|
|
62
|
-
disposeCallback(targetPage);
|
|
63
|
-
dispose.call(targetPage);
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
export async function $navigateTo(target, options) {
|
|
67
|
-
options = Object.assign({}, options);
|
|
68
|
-
// console.log("$navigateTo");
|
|
28
|
+
export function $navigateTo(target, options) {
|
|
69
29
|
try {
|
|
70
|
-
const frame = resolveFrame(options
|
|
30
|
+
const frame = resolveFrame(options?.frame);
|
|
71
31
|
if (!frame) {
|
|
72
|
-
throw new Error(
|
|
32
|
+
throw new Error('Failed to resolve frame. Make sure your frame exists.');
|
|
73
33
|
}
|
|
74
|
-
const
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
34
|
+
const root = new NSVRoot();
|
|
35
|
+
let isReloading = false;
|
|
36
|
+
const attachDisposeCallback = (page) => {
|
|
37
|
+
const dispose = page.disposeNativeView;
|
|
38
|
+
page.disposeNativeView = () => {
|
|
39
|
+
dispose.call(page);
|
|
40
|
+
// if we are reloading, don't unmount the view, as the reload will unmount/remount it.
|
|
41
|
+
if (!isReloading) {
|
|
42
|
+
view.unmount();
|
|
43
|
+
view = null;
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
const reloadPage = () => {
|
|
48
|
+
if (isReloading) {
|
|
49
|
+
return;
|
|
80
50
|
}
|
|
81
|
-
|
|
82
|
-
|
|
51
|
+
// if the page we are reloading is not the current page, wait for it to be navigated to
|
|
52
|
+
if (frame.currentPage !== view.nativeView) {
|
|
53
|
+
view.nativeView.once('navigatedTo', () => {
|
|
54
|
+
nextTick(() => {
|
|
55
|
+
reloadPage();
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
return;
|
|
83
59
|
}
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
// cache the original transition of the current page
|
|
60
|
+
isReloading = true;
|
|
61
|
+
view.unmount();
|
|
62
|
+
view.mount(root);
|
|
63
|
+
attachDisposeCallback(view.nativeView);
|
|
89
64
|
const originalTransition = frame.currentEntry.transition;
|
|
90
65
|
// replace current page
|
|
91
66
|
frame.replacePage({
|
|
92
67
|
...options,
|
|
93
68
|
transition: {
|
|
94
|
-
name:
|
|
69
|
+
name: 'fade',
|
|
95
70
|
duration: 10,
|
|
96
71
|
},
|
|
97
|
-
create: () =>
|
|
72
|
+
create: () => view.nativeView,
|
|
98
73
|
});
|
|
99
74
|
// reset the transition to the original one
|
|
100
|
-
frame.once(
|
|
75
|
+
frame.once('navigatedTo', () => {
|
|
101
76
|
frame.currentEntry.transition = originalTransition;
|
|
77
|
+
isReloading = false;
|
|
102
78
|
});
|
|
79
|
+
};
|
|
80
|
+
let view = createNativeView(target, options?.props, {
|
|
81
|
+
/**
|
|
82
|
+
* Called by @vue/runtime-core when the component is reloaded during HMR.
|
|
83
|
+
*/
|
|
84
|
+
reload: reloadPage,
|
|
103
85
|
});
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
let latestPage = targetPage;
|
|
107
|
-
attachDisposeCallbacks(targetPage, cleanup);
|
|
86
|
+
view.mount(root);
|
|
87
|
+
attachDisposeCallback(view.nativeView);
|
|
108
88
|
frame.navigate({
|
|
109
89
|
...options,
|
|
110
|
-
create: () =>
|
|
90
|
+
create: () => view.nativeView,
|
|
111
91
|
});
|
|
112
|
-
return
|
|
92
|
+
return view.nativeView;
|
|
113
93
|
}
|
|
114
94
|
catch (e) {
|
|
115
|
-
console.error(
|
|
95
|
+
console.error('[$navigateTo] Failed to navigate:\n\n');
|
|
116
96
|
console.error(e, e.stack);
|
|
117
97
|
throw e;
|
|
118
98
|
}
|
|
119
99
|
}
|
|
120
100
|
export async function $navigateBack(options) {
|
|
121
|
-
const frame = resolveFrame(options
|
|
101
|
+
const frame = resolveFrame(options?.frame);
|
|
122
102
|
if (!frame) {
|
|
123
|
-
throw new Error(
|
|
103
|
+
throw new Error('Failed to resolve frame. Make sure your frame exists.');
|
|
124
104
|
}
|
|
125
105
|
if (!frame.canGoBack()) {
|
|
126
106
|
return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"navigation.js","sourceRoot":"","sources":["../../src/plugins/navigation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAyB,MAAM,oBAAoB,CAAC;AAClE,OAAO,EAAuB,KAAK,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"navigation.js","sourceRoot":"","sources":["../../src/plugins/navigation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAyB,MAAM,oBAAoB,CAAC;AAClE,OAAO,EAAuB,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACzE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AA4BrD;;GAEG;AACH,MAAM,UAAU,OAAO,CAAC,GAAQ;IAC9B,GAAG,CAAC,MAAM,CAAC,gBAAgB,CAAC,WAAW,GAAG,WAAW,CAAC;IACtD,GAAG,CAAC,MAAM,CAAC,gBAAgB,CAAC,aAAa,GAAG,aAAa,CAAC;AAC5D,CAAC;AAED,SAAS,YAAY,CAAC,KAAuB;IAC3C,IAAI,CAAC,KAAK,EAAE;QACV,OAAO,KAAK,CAAC,OAAO,EAAE,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AC,KAAK,CAAC,CAAC;QAC1B,MAAM,CAAC,CAAC;KACT;AACH,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,OAA+B;IACjE,MAAM,KAAK,GAAG,YAAY,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IAE3C,IAAI,CAAC,KAAK,EAAE;QACV,MAAM,IAAI,KAAK,CAAC,uDAAuD,CAAC,CAAC;KAC1E;IAED,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE,EAAE;QACtB,OAAO;KACR;IAED,KAAK,CAAC,MAAM,EAAE,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @internal
|
|
3
|
+
*/
|
|
4
|
+
export function install(app) {
|
|
5
|
+
app.config.globalProperties.$templates = {
|
|
6
|
+
getKeyedTemplates() { },
|
|
7
|
+
selectorFn() { },
|
|
8
|
+
patchTemplate(name, context, oldVnode) { },
|
|
9
|
+
registerTemplate() { }
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=templates.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"templates.js","sourceRoot":"","sources":["../../src/plugins/templates.ts"],"names":[],"mappings":"AAQA;;GAEG;AACH,MAAM,UAAU,OAAO,CAAC,GAAQ;IAC9B,GAAG,CAAC,MAAM,CAAC,gBAAgB,CAAC,UAAU,GAAG;QACvC,iBAAiB,KAAI,CAAC;QACtB,UAAU,KAAI,CAAC;QACf,aAAa,CAAC,IAAY,EAAE,OAAY,EAAE,QAAe,IAAG,CAAC;QAC7D,gBAAgB,KAAI,CAAC;KACtB,CAAC;AACJ,CAAC"}
|
package/dist/registry/index.d.ts
CHANGED
package/dist/registry/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export let defaultViewMeta = {
|
|
2
|
-
viewFlags: 0, // NSVViewFlags.NONE
|
|
2
|
+
viewFlags: 0, // NSVViewFlags.NONE - circular dependency, using constant value instead
|
|
3
3
|
};
|
|
4
4
|
let elementMap = {};
|
|
5
5
|
export function getViewMeta(elementName) {
|
|
@@ -34,7 +34,7 @@ export function getViewClass(elementName) {
|
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
export function normalizeElementName(elementName) {
|
|
37
|
-
return elementName.replace(/-/g,
|
|
37
|
+
return elementName.replace(/-/g, '').toLowerCase();
|
|
38
38
|
}
|
|
39
39
|
export function registerElement(elementName, resolver, meta) {
|
|
40
40
|
const normalizedName = normalizeElementName(elementName);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/registry/index.ts"],"names":[],"mappings":"AAwBA,MAAM,CAAC,IAAI,eAAe,GAAgB;IACxC,SAAS,EAAE,CAAC,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/registry/index.ts"],"names":[],"mappings":"AAwBA,MAAM,CAAC,IAAI,eAAe,GAAgB;IACxC,SAAS,EAAE,CAAC,EAAE,wEAAwE;CACvF,CAAC;AAEF,IAAI,UAAU,GAAyC,EAAE,CAAC;AAE1D,MAAM,UAAU,WAAW,CAAC,WAAmB;IAC7C,+CAA+C;IAE/C,MAAM,cAAc,GAAG,oBAAoB,CAAC,WAAW,CAAC,CAAC;IAEzD,MAAM,KAAK,GAAG,UAAU,CAAC,cAAc,CAAC,CAAC;IAEzC,IAAI,CAAC,KAAK,EAAE;QACV,MAAM,IAAI,KAAK,CAAC,kCAAkC,WAAW,GAAG,CAAC,CAAC;KACnE;IAED,OAAO,KAAK,CAAC,IAAI,CAAC;AACpB,CAAC;AAED,IAAI,mBAAmB,CAAC;AAExB,MAAM,UAAU,2BAA2B,CAAC,QAA+B;IACzE,mBAAmB,GAAG,QAAQ,CAAC;AACjC,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,WAAmB;IAC9C,gDAAgD;IAChD,MAAM,cAAc,GAAG,oBAAoB,CAAC,WAAW,CAAC,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1,6 @@
|
|
|
1
|
-
import { createRenderer } from
|
|
2
|
-
import { patchProp } from
|
|
3
|
-
import { nodeOps } from
|
|
1
|
+
import { createRenderer } from '@vue/runtime-core';
|
|
2
|
+
import { patchProp } from './patchProp';
|
|
3
|
+
import { nodeOps } from './nodeOps';
|
|
4
4
|
export const renderer = createRenderer({
|
|
5
5
|
patchProp,
|
|
6
6
|
...nodeOps,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { NSVElement } from
|
|
1
|
+
import { NSVElement } from '../../dom';
|
|
2
2
|
export declare function patchAttr(el: NSVElement, key: string, prevValue: any, nextValue: any): void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { isBoolean, isAndroidKey, isIOSKey } from
|
|
2
|
-
import { isAndroid, isIOS } from
|
|
1
|
+
import { isBoolean, isAndroidKey, isIOSKey } from '../../runtimeHelpers';
|
|
2
|
+
import { isAndroid, isIOS } from '../../nativescript';
|
|
3
3
|
export function patchAttr(el, key, prevValue, nextValue) {
|
|
4
4
|
if (isAndroidKey(key)) {
|
|
5
5
|
if (!isAndroid) {
|
|
@@ -17,7 +17,7 @@ export function patchAttr(el, key, prevValue, nextValue) {
|
|
|
17
17
|
}
|
|
18
18
|
// detect expandable attrs for boolean values
|
|
19
19
|
// see https://vuejs.org/v2/guide/components-props.html#Passing-a-Boolean
|
|
20
|
-
if (isBoolean(el.getAttribute(key)) && nextValue ===
|
|
20
|
+
if (isBoolean(el.getAttribute(key)) && nextValue === '') {
|
|
21
21
|
nextValue = true;
|
|
22
22
|
}
|
|
23
23
|
if (nextValue === null) {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { NSVElement } from
|
|
1
|
+
import { NSVElement } from '../../dom';
|
|
2
2
|
export declare function patchClass(el: NSVElement, value: string | null): void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { NSVElement } from
|
|
2
|
-
import { ComponentInternalInstance } from
|
|
1
|
+
import { NSVElement } from '../../dom';
|
|
2
|
+
import { ComponentInternalInstance } from '@vue/runtime-core';
|
|
3
3
|
interface Invoker extends EventListener {
|
|
4
4
|
value: EventValue;
|
|
5
5
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { callWithAsyncErrorHandling, } from
|
|
1
|
+
import { callWithAsyncErrorHandling, } from '@vue/runtime-core';
|
|
2
2
|
export function addEventListener(el, event, handler, options = {}) {
|
|
3
3
|
el.addEventListener(event, handler, options);
|
|
4
4
|
}
|
|
@@ -43,7 +43,7 @@ function parseName(name) {
|
|
|
43
43
|
// this isn't technically perfect,
|
|
44
44
|
// since if the event name was UPPER then we'll convert it to uPPER
|
|
45
45
|
// but for the majority of cases, this should be the right thing to do.
|
|
46
|
-
name = name.slice(name.startsWith(
|
|
46
|
+
name = name.slice(name.startsWith('on:') ? 3 : 2);
|
|
47
47
|
name = name.charAt(0).toLowerCase() + name.slice(1);
|
|
48
48
|
// return event name by removing on prefix. eg. onitemTap -> itemTap
|
|
49
49
|
return [name, options];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { NSVElement } from
|
|
1
|
+
import { NSVElement } from '../../dom';
|
|
2
2
|
type Style = string | Record<string, string | number> | null;
|
|
3
3
|
export declare const STYLE_ORIGINAL_VALUE: unique symbol;
|
|
4
4
|
export declare function patchStyle(el: NSVElement, prev: Style, next: Style): void;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { parseStringStyle, isArray, isString, isObject, } from
|
|
1
|
+
import { parseStringStyle, isArray, isString, isObject, } from '@vue/shared';
|
|
2
2
|
function normalizeStyle(style) {
|
|
3
3
|
if (!style) {
|
|
4
4
|
return null;
|
|
5
5
|
}
|
|
6
6
|
if (isString(style)) {
|
|
7
|
-
if (style.trim().charAt(0) ===
|
|
7
|
+
if (style.trim().charAt(0) === '{') {
|
|
8
8
|
return JSON.parse(style);
|
|
9
9
|
}
|
|
10
10
|
return parseStringStyle(style);
|
|
@@ -20,13 +20,13 @@ function normalizeStyle(style) {
|
|
|
20
20
|
return {};
|
|
21
21
|
}
|
|
22
22
|
function normalizeProperty(property) {
|
|
23
|
-
if (property.endsWith(
|
|
23
|
+
if (property.endsWith('Align')) {
|
|
24
24
|
// NativeScript uses Alignment instead of Align, this ensures that text-align works
|
|
25
|
-
property +=
|
|
25
|
+
property += 'ment';
|
|
26
26
|
}
|
|
27
27
|
return property;
|
|
28
28
|
}
|
|
29
|
-
export const STYLE_ORIGINAL_VALUE = Symbol(
|
|
29
|
+
export const STYLE_ORIGINAL_VALUE = Symbol('style_original_value');
|
|
30
30
|
function addStyleProperty(el, property, value) {
|
|
31
31
|
const _sov = el[STYLE_ORIGINAL_VALUE] ?? (el[STYLE_ORIGINAL_VALUE] = new Map());
|
|
32
32
|
property = normalizeProperty(property);
|
|
@@ -67,7 +67,7 @@ export function patchStyle(el, prev, next) {
|
|
|
67
67
|
});
|
|
68
68
|
}
|
|
69
69
|
if (!next) {
|
|
70
|
-
el.removeAttribute(
|
|
70
|
+
el.removeAttribute('style');
|
|
71
71
|
}
|
|
72
72
|
else {
|
|
73
73
|
// set new styles
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { VNodeProps, RendererOptions } from
|
|
2
|
-
import { NSVElement, NSVNode } from
|
|
1
|
+
import { VNodeProps, RendererOptions } from '@vue/runtime-core';
|
|
2
|
+
import { NSVElement, NSVNode } from '../dom';
|
|
3
3
|
export declare function insert(el: NSVNode, parent: NSVElement, anchor?: NSVNode | null | undefined): void;
|
|
4
4
|
export declare function remove(el: NSVNode): void;
|
|
5
5
|
export declare function createElement(type: string, isSVG?: boolean | undefined, isCustomizedBuiltIn?: string | undefined, vnodeProps?: (VNodeProps & {
|
|
@@ -14,4 +14,4 @@ export declare function nextSibling(node: NSVNode): NSVNode | null;
|
|
|
14
14
|
export declare function cloneNode(node: NSVNode): NSVNode;
|
|
15
15
|
export declare function insertStaticContent(content: string, parent: NSVElement, anchor: NSVNode, isSvg: boolean, start?: NSVNode, end?: NSVNode): [NSVNode, NSVNode];
|
|
16
16
|
export declare function setScopeId(el: NSVElement, scopeId: string): void;
|
|
17
|
-
export declare const nodeOps: Omit<RendererOptions,
|
|
17
|
+
export declare const nodeOps: Omit<RendererOptions, 'patchProp'>;
|
package/dist/renderer/nodeOps.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { NSVComment, NSVElement, NSVText } from
|
|
1
|
+
import { NSVComment, NSVElement, NSVText } from '../dom';
|
|
2
2
|
export function insert(el, parent, anchor) {
|
|
3
3
|
// console.log("insert", el, parent.tagName, anchor);
|
|
4
4
|
if (anchor !== null) {
|
|
@@ -42,16 +42,16 @@ export function nextSibling(node) {
|
|
|
42
42
|
return node.nextSibling;
|
|
43
43
|
}
|
|
44
44
|
export function cloneNode(node) {
|
|
45
|
-
console.log(
|
|
45
|
+
console.log('CLONE NODE');
|
|
46
46
|
return node;
|
|
47
47
|
}
|
|
48
48
|
// insertStaticContent?(content: string, parent: HostElement, anchor: HostNode | null, isSVG: boolean, start?: HostNode | null, end?: HostNode | null): [HostNode, HostNode];
|
|
49
49
|
export function insertStaticContent(content, parent, anchor, isSvg, start, end) {
|
|
50
|
-
console.log(
|
|
50
|
+
console.log('insert static content - not implemented.');
|
|
51
51
|
return [undefined, undefined];
|
|
52
52
|
}
|
|
53
53
|
export function setScopeId(el, scopeId) {
|
|
54
|
-
el.setAttribute(scopeId,
|
|
54
|
+
el.setAttribute(scopeId, '');
|
|
55
55
|
}
|
|
56
56
|
export const nodeOps = {
|
|
57
57
|
insert,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { NSVElement } from
|
|
1
|
+
import { NSVElement } from '../dom';
|
|
2
2
|
export declare function patchProp(el: NSVElement, key: string, prevValue: any, nextValue: any, isSVG: boolean, prevChildren: any, parentComponent: any, parentSuspense: any, unmountChildren: any): void;
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import { patchAttr } from
|
|
2
|
-
import { patchClass } from
|
|
3
|
-
import { patchEvent } from
|
|
4
|
-
import { patchStyle } from
|
|
5
|
-
import { isOn } from
|
|
6
|
-
import { getViewMeta } from
|
|
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 { isOn } from '../runtimeHelpers';
|
|
6
|
+
import { getViewMeta } from '../registry';
|
|
7
7
|
export function patchProp(el, key, prevValue, nextValue, isSVG = false, prevChildren, parentComponent, parentSuspense, unmountChildren) {
|
|
8
8
|
switch (key) {
|
|
9
9
|
// special
|
|
10
|
-
case
|
|
10
|
+
case 'class':
|
|
11
11
|
// console.log('->patchProp+Class')
|
|
12
12
|
patchClass(el, nextValue);
|
|
13
13
|
break;
|
|
14
|
-
case
|
|
14
|
+
case 'style':
|
|
15
15
|
// console.log('->patchProp+Style')
|
|
16
16
|
patchStyle(el, prevValue, nextValue);
|
|
17
17
|
break;
|
|
18
|
-
case
|
|
19
|
-
case
|
|
18
|
+
case 'modelValue':
|
|
19
|
+
case 'onUpdate:modelValue':
|
|
20
20
|
try {
|
|
21
21
|
// v-model - maps modelValue/onUpdate:modelValue to the correct prop/events from the registry meta
|
|
22
22
|
const { prop, event } = getViewMeta(el.tagName)
|
|
23
23
|
.model;
|
|
24
|
-
if (key ===
|
|
24
|
+
if (key === 'modelValue') {
|
|
25
25
|
patchAttr(el, prop, prevValue, nextValue);
|
|
26
26
|
}
|
|
27
27
|
else {
|