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
package/README.md
CHANGED
|
@@ -1,119 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
<a href="https://nativescript-vue.org">
|
|
3
|
-
<img src="https://art.nativescript-vue.org/NativeScript-Vue.svg" width="270">
|
|
4
|
-
</a>
|
|
5
|
-
</p>
|
|
1
|
+
# NativeScript-Vue3 Beta
|
|
6
2
|
|
|
7
|
-
|
|
8
|
-
<a href="https://github.com/prettier/prettier">
|
|
9
|
-
<img src="https://img.shields.io/badge/styled_with-prettier-ff69b4.svg" alt="styled with prettier">
|
|
10
|
-
</a>
|
|
11
|
-
<a href="https://www.npmjs.com/package/nativescript-vue">
|
|
12
|
-
<img src="https://img.shields.io/npm/v/nativescript-vue.svg" alt="npm">
|
|
13
|
-
</a>
|
|
14
|
-
<a href="https://github.com/nativescript-vue/nativescript-vue/blob/master/LICENSE">
|
|
15
|
-
<img src="https://img.shields.io/github/license/nativescript-vue/nativescript-vue.svg" alt="license">
|
|
16
|
-
</a>
|
|
17
|
-
<a href="https://circleci.com/gh/nativescript-vue/nativescript-vue/tree/master">
|
|
18
|
-
<img src="https://img.shields.io/circleci/project/github/nativescript-vue/nativescript-vue.svg" alt="CircleCI">
|
|
19
|
-
</a>
|
|
20
|
-
<a href="https://codecov.io/gh/nativescript-vue/nativescript-vue">
|
|
21
|
-
<img src="https://img.shields.io/codecov/c/github/nativescript-vue/nativescript-vue.svg" alt="Codecov">
|
|
22
|
-
</a>
|
|
23
|
-
<a href="https://stakes.social/0x92f4c210aEc2D7e34aA226f4319aa879d253f206">
|
|
24
|
-
<img src="https://badge.devprotocol.xyz/0x92f4c210aEc2D7e34aA226f4319aa879d253f206/descriptive" alt="Stake to support us">
|
|
25
|
-
</a>
|
|
26
|
-
</p>
|
|
3
|
+
NativeScript-Vue with Vue3 support now in beta!
|
|
27
4
|
|
|
28
|
-
|
|
5
|
+
## Quick start
|
|
29
6
|
|
|
30
|
-
|
|
7
|
+
To get started, you can use the [StackBlitz Template](https://stackblitz.com/fork/nativescript-vue3-beta)
|
|
31
8
|
|
|
32
|
-
|
|
33
|
-
<table>
|
|
34
|
-
<tbody>
|
|
35
|
-
<tr>
|
|
36
|
-
<td align="center" valign="middle">
|
|
37
|
-
<a href="https://www.privateinternetaccess.com/?source=nativescript-vue-github" target="_blank">
|
|
38
|
-
<img width="300px" src="https://art.nativescript-vue.org/sponsors/pia.png">
|
|
39
|
-
</a>
|
|
40
|
-
</td>
|
|
41
|
-
<td align="center" valign="middle">
|
|
42
|
-
<a href="https://kiwiirc.com/?source=nativescript-vue-github" target="_blank">
|
|
43
|
-
<img height="50px" src="https://art.nativescript-vue.org/sponsors/kiwiirc.png?v=1">
|
|
44
|
-
</a>
|
|
45
|
-
</td>
|
|
46
|
-
<td align="center" valign="middle">
|
|
47
|
-
<a href="https://www.progress.com/?source=nativescript-vue-github" target="_blank">
|
|
48
|
-
<img height="50px" src="https://art.nativescript-vue.org/sponsors/progress.png">
|
|
49
|
-
</a>
|
|
50
|
-
</td>
|
|
51
|
-
</tr><tr></tr>
|
|
52
|
-
<tr>
|
|
53
|
-
<td align="center" valign="middle">
|
|
54
|
-
<a href="https://nativescripting.com/?source=nativescript-vue-github" target="_blank">
|
|
55
|
-
<img height="50px" src="https://nativescripting.com/img/logo_full.svg">
|
|
56
|
-
</a>
|
|
57
|
-
</td>
|
|
58
|
-
<td align="center" valign="middle">
|
|
59
|
-
<a href="https://www.exigency.net/?source=nativescript-vue-github" target="_blank">
|
|
60
|
-
<img height="50px" src="https://art.nativescript-vue.org/sponsors/exigencytr.png">
|
|
61
|
-
</a>
|
|
62
|
-
</td>
|
|
63
|
-
<td></td>
|
|
64
|
-
</tr>
|
|
65
|
-
</tbody>
|
|
66
|
-
</table>
|
|
67
|
-
<!--/sponsors-->
|
|
9
|
+
...or locally:
|
|
68
10
|
|
|
69
|
-
|
|
11
|
+
```bash
|
|
12
|
+
ns create myAwesomeApp --template @nativescript-vue/template-blank@beta
|
|
70
13
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
- OpenLitterMap
|
|
75
|
-
- Aparajita Fishman
|
|
76
|
-
- Hajnalka Molnár Csikós
|
|
77
|
-
- Jen Looper
|
|
78
|
-
- Packy Tagliaferro
|
|
79
|
-
- Alexander Vakrilov
|
|
80
|
-
- Dave
|
|
81
|
-
- Todd Anglin
|
|
82
|
-
- Mohamed Hussain
|
|
83
|
-
- Gleb Zhelezin
|
|
84
|
-
- Robert M. Svendsen
|
|
85
|
-
- Andy Drexler
|
|
86
|
-
- ChiwalahSoftware
|
|
87
|
-
- Nayir Chami
|
|
88
|
-
- Teon Ooi
|
|
89
|
-
- Thomas Kuhlmann
|
|
90
|
-
- Abdullah Al Mashmoum
|
|
91
|
-
- Stian Årsnes
|
|
92
|
-
- Robertino Vasilescu
|
|
93
|
-
- Marc Lewis
|
|
94
|
-
- Tom Coonen
|
|
95
|
-
- John McAuley
|
|
96
|
-
- Christian Quispe
|
|
97
|
-
- Nhut Tran
|
|
98
|
-
- Antonio
|
|
99
|
-
- Benjamin Hanzl
|
|
100
|
-
|
|
101
|
-
If you'd like to join them, please consider [becoming a backer / sponsor on Patreon](https://www.patreon.com/rigor789).
|
|
102
|
-
|
|
103
|
-
A huge thank you for all of the backers / sponsors!
|
|
104
|
-
|
|
105
|
-
---
|
|
106
|
-
|
|
107
|
-
# NativeScript Vue
|
|
108
|
-
|
|
109
|
-
This project integrates [Vue](https://vuejs.org/) and [NativeScript](https://www.nativescript.org/), allowing you to build cross-platform iOS and Android apps using Vue.
|
|
110
|
-
|
|
111
|
-
## Contributing
|
|
112
|
-
|
|
113
|
-
If you feel like contributing to this project, that’s awesome! Start by reading [this repo’s `CONTRIBUTING.MD`](https://github.com/rigor789/nativescript-vue/blob/master/CONTRIBUTING.md) file for details on the required development setup, how to send pull requests, and how to run this repo’s sample app.
|
|
114
|
-
|
|
115
|
-
If you have any questions, or you would like to get involved with NativeScript Vue, join us in the #vue channel on the [NativeScript community Slack](https://www.nativescript.org/slack-invitation-form).
|
|
116
|
-
|
|
117
|
-
## License
|
|
118
|
-
|
|
119
|
-
NativeScript-Vue is licensed under the [MIT license](https://github.com/rigor789/nativescript-vue/blob/master/LICENSE)
|
|
14
|
+
cd myAwesomeApp
|
|
15
|
+
ns run ios|android
|
|
16
|
+
```
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "@vue/compiler-sfc";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/compiler-sfc/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAA"}
|
package/dist/compiler.js
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { compile } from "@vue/compiler-dom";
|
|
2
|
+
import { warn } from "@vue/runtime-dom";
|
|
3
|
+
import * as runtime from "./index";
|
|
4
|
+
const NOOP = () => { };
|
|
5
|
+
const compileCache = Object.create(null);
|
|
6
|
+
export function compileToFunction(template, options) {
|
|
7
|
+
if (typeof template !== "string") {
|
|
8
|
+
warn("invalid template option: ", template);
|
|
9
|
+
return NOOP;
|
|
10
|
+
}
|
|
11
|
+
const key = template;
|
|
12
|
+
const cached = compileCache[key];
|
|
13
|
+
if (cached) {
|
|
14
|
+
return cached;
|
|
15
|
+
}
|
|
16
|
+
const { code } = compile(template, {
|
|
17
|
+
isNativeTag: (tag) => true,
|
|
18
|
+
hoistStatic: true,
|
|
19
|
+
prefixIdentifiers: true,
|
|
20
|
+
onWarn(warn) {
|
|
21
|
+
console.warn("Template Compile Warning", warn);
|
|
22
|
+
},
|
|
23
|
+
onError(err) {
|
|
24
|
+
console.error("Template Compile Error", err);
|
|
25
|
+
},
|
|
26
|
+
...options,
|
|
27
|
+
});
|
|
28
|
+
const render = new Function("Vue", code)(runtime);
|
|
29
|
+
return (compileCache[key] = render);
|
|
30
|
+
}
|
|
31
|
+
export { compileToFunction as compile };
|
|
32
|
+
//# sourceMappingURL=compiler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compiler.js","sourceRoot":"","sources":["../src/compiler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAkC,MAAM,mBAAmB,CAAC;AAC5E,OAAO,EAAkB,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AAEnC,MAAM,IAAI,GAAG,GAAG,EAAE,GAAE,CAAC,CAAC;AACtB,MAAM,YAAY,GAAmC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AAEzE,MAAM,UAAU,iBAAiB,CAC/B,QAAgB,EAChB,OAAyB;IAEzB,IAAI,OAAO,QAAQ,KAAK,QAAQ,EAAE;QAChC,IAAI,CAAC,2BAA2B,EAAE,QAAQ,CAAC,CAAC;QAC5C,OAAO,IAAI,CAAC;KACb;IAED,MAAM,GAAG,GAAG,QAAQ,CAAC;IACrB,MAAM,MAAM,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC;IAEjC,IAAI,MAAM,EAAE;QACV,OAAO,MAAM,CAAC;KACf;IAED,MAAM,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC,QAAQ,EAAE;QACjC,WAAW,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI;QAC1B,WAAW,EAAE,IAAI;QACjB,iBAAiB,EAAE,IAAI;QACvB,MAAM,CAAC,IAAmB;YACxB,OAAO,CAAC,IAAI,CAAC,0BAA0B,EAAE,IAAI,CAAC,CAAC;QACjD,CAAC;QACD,OAAO,CAAC,GAAkB;YACxB,OAAO,CAAC,KAAK,CAAC,wBAAwB,EAAE,GAAG,CAAC,CAAC;QAC/C,CAAC;QACD,GAAG,OAAO;KACX,CAAC,CAAC;IAEH,MAAM,MAAM,GAAG,IAAI,QAAQ,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,OAAO,CAAmB,CAAC;IAEpE,OAAO,CAAC,YAAY,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,CAAC;AACtC,CAAC;AAED,OAAO,EACL,iBAAiB,IAAI,OAAO,EAC7B,CAAA"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export declare const ActionBar: import("@vue/runtime-core").DefineComponent<{}, () => import("@vue/runtime-core").VNode<import("@vue/runtime-core").RendererNode, import("@vue/runtime-core").RendererElement, {
|
|
2
|
+
[key: string]: any;
|
|
3
|
+
}>, {}, {}, {}, import("@vue/runtime-core").ComponentOptionsMixin, import("@vue/runtime-core").ComponentOptionsMixin, {}, string, import("@vue/runtime-core").VNodeProps & import("@vue/runtime-core").AllowedComponentProps & import("@vue/runtime-core").ComponentCustomProps, Readonly<import("@vue/runtime-core").ExtractPropTypes<{}>>, {}>;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { Page as NSCPage, ActionBar as NSCActionBar, NavigationButton as NSCNavigationButton, ActionItem as NSCActionItem, } from "@nativescript/core";
|
|
2
|
+
import { defineComponent, h, warn } from "@vue/runtime-core";
|
|
3
|
+
import { registerElement } from "../registry";
|
|
4
|
+
registerElement("NSCActionBar", () => NSCActionBar, {
|
|
5
|
+
viewFlags: 1 /* NSVViewFlags.SKIP_ADD_TO_DOM */,
|
|
6
|
+
nodeOps: {
|
|
7
|
+
insert(child, parent, atIndex) {
|
|
8
|
+
const actionBar = parent.nativeView;
|
|
9
|
+
const childView = child.nativeView;
|
|
10
|
+
if (childView instanceof NSCNavigationButton) {
|
|
11
|
+
actionBar.navigationButton = childView;
|
|
12
|
+
}
|
|
13
|
+
else if (childView instanceof NSCActionItem) {
|
|
14
|
+
if (atIndex) {
|
|
15
|
+
const ai = actionBar.actionItems.getItems();
|
|
16
|
+
ai.splice(atIndex, 0, childView);
|
|
17
|
+
actionBar.actionItems.setItems(ai);
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
actionBar.actionItems.addItem(childView);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
actionBar.titleView = childView;
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
remove(child, parent) {
|
|
28
|
+
const actionBar = parent.nativeView;
|
|
29
|
+
const childView = child.nativeView;
|
|
30
|
+
if (childView instanceof NSCNavigationButton) {
|
|
31
|
+
if (actionBar.navigationButton === childView) {
|
|
32
|
+
actionBar.navigationButton = null;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
else if (childView instanceof NSCActionItem) {
|
|
36
|
+
actionBar.actionItems.removeItem(childView);
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
if (actionBar.titleView === childView) {
|
|
40
|
+
actionBar.titleView = null;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
});
|
|
46
|
+
export const ActionBar = /*#__PURE__*/ defineComponent({
|
|
47
|
+
setup(props, ctx) {
|
|
48
|
+
return () => {
|
|
49
|
+
return h("NSCActionBar", {
|
|
50
|
+
...ctx.attrs,
|
|
51
|
+
onVnodeMounted(vnode) {
|
|
52
|
+
const el = vnode.el;
|
|
53
|
+
const actionBar = el.nativeView;
|
|
54
|
+
const parent = el.parentNode;
|
|
55
|
+
if (parent.nativeView instanceof NSCPage) {
|
|
56
|
+
parent.nativeView.actionBar = actionBar;
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
if (__DEV__) {
|
|
60
|
+
warn(`<ActionBar> must be a direct child of a <Page> element - ` +
|
|
61
|
+
`got <${parent.nativeView.constructor.name}> instead.`);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
}, ctx.slots.default ? ctx.slots.default() : undefined);
|
|
66
|
+
};
|
|
67
|
+
},
|
|
68
|
+
});
|
|
69
|
+
//# sourceMappingURL=ActionBar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ActionBar.js","sourceRoot":"","sources":["../../src/components/ActionBar.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,IAAI,OAAO,EACf,SAAS,IAAI,YAAY,EACzB,gBAAgB,IAAI,mBAAmB,EACvC,UAAU,IAAI,aAAa,GAC5B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,eAAe,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAE7D,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9C,eAAe,CAAC,cAAc,EAAE,GAAG,EAAE,CAAC,YAAY,EAAE;IAClD,SAAS,sCAA8B;IACvC,OAAO,EAAE;QACP,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO;YAC3B,MA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,GAAG;QACd,OAAO,GAAG,EAAE;YACV,OAAO,CAAC,CACN,cAAc,EACd;gBACE,GAAG,GAAG,CAAC,KAAK;gBACZ,cAAc,CAAC,KAAK;oBAClB,MAAM,EAAE,GAAG,KAAK,CAAC,EAAgB,CAAC;oBAClC,MAAM,SAAS,GAAG,EAAE,CAAC,UAA0B,CAAC;oBAChD,MAAM,MAAM,GAAG,EAAE,CAAC,UAAwB,CAAC;oBAE3C,IAAI,MAAM,CAAC,UAAU,YAAY,OAAO,EAAE;wBACxC,MAAM,CAAC,UAAU,CAAC,SAAS,GAAG,SAAS,CAAC;qBACzC;yBAAM;wBACL,IAAI,OAAO,EAAE;4BACX,IAAI,CACF,2DAA2D;gCACzD,QAAQ,MAAM,CAAC,UAAU,CAAC,WAAW,CAAC,IAAI,YAAY,CACzD,CAAC;yBACH;qBACF;gBACH,CAAC;aACF,EACD,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,SAAS,CACpD,CAAC;QACJ,CAAC,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { VNode } from "..";
|
|
2
|
+
export interface ListItem<T = any> {
|
|
3
|
+
item: T;
|
|
4
|
+
index: number;
|
|
5
|
+
even: boolean;
|
|
6
|
+
odd: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare const ListView: import("@vue/runtime-core").DefineComponent<{
|
|
9
|
+
items: {
|
|
10
|
+
validator(value: unknown): boolean;
|
|
11
|
+
};
|
|
12
|
+
itemTemplateSelector: FunctionConstructor;
|
|
13
|
+
}, () => VNode<import("@vue/runtime-core").RendererNode, import("@vue/runtime-core").RendererElement, {
|
|
14
|
+
[key: string]: any;
|
|
15
|
+
}>, unknown, {}, {}, import("@vue/runtime-core").ComponentOptionsMixin, import("@vue/runtime-core").ComponentOptionsMixin, {}, string, import("@vue/runtime-core").VNodeProps & import("@vue/runtime-core").AllowedComponentProps & import("@vue/runtime-core").ComponentCustomProps, Readonly<import("@vue/runtime-core").ExtractPropTypes<{
|
|
16
|
+
items: {
|
|
17
|
+
validator(value: unknown): boolean;
|
|
18
|
+
};
|
|
19
|
+
itemTemplateSelector: FunctionConstructor;
|
|
20
|
+
}>>, {}>;
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { defineComponent, h, warn } from "@vue/runtime-core";
|
|
2
|
+
import { ListView as NSCListView, ObservableArray, } from "@nativescript/core";
|
|
3
|
+
import { getCurrentInstance, ref, watch } from "..";
|
|
4
|
+
import { registerElement } from "../registry";
|
|
5
|
+
import { ELEMENT_REF } from "../runtimeHelpers";
|
|
6
|
+
registerElement("NSCListView", () => NSCListView, {
|
|
7
|
+
viewFlags: 8 /* NSVViewFlags.NO_CHILDREN */,
|
|
8
|
+
});
|
|
9
|
+
// }
|
|
10
|
+
function getListItem(item, index) {
|
|
11
|
+
return {
|
|
12
|
+
item,
|
|
13
|
+
index,
|
|
14
|
+
even: index % 2 === 0,
|
|
15
|
+
odd: index % 2 !== 0,
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
const LIST_CELL_ID = Symbol("list_cell_id");
|
|
19
|
+
export const ListView = /*#__PURE__*/ defineComponent({
|
|
20
|
+
props: {
|
|
21
|
+
items: {
|
|
22
|
+
validator(value) {
|
|
23
|
+
return Array.isArray(value) || value instanceof ObservableArray;
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
itemTemplateSelector: Function,
|
|
27
|
+
},
|
|
28
|
+
setup(props, ctx) {
|
|
29
|
+
const itemTemplates = Object.keys(ctx.slots).map((slotName) => {
|
|
30
|
+
return {
|
|
31
|
+
key: slotName,
|
|
32
|
+
createView() {
|
|
33
|
+
// no need to return anything here
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
});
|
|
37
|
+
const getSlotName = (itemCtx) => props.itemTemplateSelector?.(itemCtx) ?? "default";
|
|
38
|
+
const listView = ref(null);
|
|
39
|
+
const vm = getCurrentInstance();
|
|
40
|
+
watch(props, () => {
|
|
41
|
+
try {
|
|
42
|
+
if (props.items instanceof ObservableArray) {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
const lv = listView.value?.nativeView;
|
|
46
|
+
lv?.refresh();
|
|
47
|
+
}
|
|
48
|
+
catch (err) {
|
|
49
|
+
console.error("Error while refreshing ListView", err);
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
let cellId = 0;
|
|
53
|
+
const cells = ref({});
|
|
54
|
+
function onitemLoading(event) {
|
|
55
|
+
const el = event.view?.[ELEMENT_REF];
|
|
56
|
+
const id = el?.nativeView[LIST_CELL_ID] ?? `LIST_CELL_${cellId++}`;
|
|
57
|
+
const itemCtx = getListItem(props.items instanceof ObservableArray
|
|
58
|
+
? props.items.getItem(event.index)
|
|
59
|
+
: props.items[event.index], event.index);
|
|
60
|
+
// update the cell data with the current row
|
|
61
|
+
cells.value[id] = {
|
|
62
|
+
itemCtx,
|
|
63
|
+
slotName: getSlotName(itemCtx),
|
|
64
|
+
};
|
|
65
|
+
// trigger an update!
|
|
66
|
+
vm.update();
|
|
67
|
+
// find the vnode rendering this cell
|
|
68
|
+
const vnode = vm.subTree.children.find((vnode) => {
|
|
69
|
+
return vnode.key === id;
|
|
70
|
+
});
|
|
71
|
+
// store the cell id on the Element itself so we can retrieve it when recycling kicks in
|
|
72
|
+
const cellEl = vnode.el.nativeView;
|
|
73
|
+
cellEl[LIST_CELL_ID] = id;
|
|
74
|
+
// finally, set the event.view to the rendered cellEl
|
|
75
|
+
event.view = cellEl;
|
|
76
|
+
}
|
|
77
|
+
function itemTemplateSelector(item, index) {
|
|
78
|
+
// pass on the template selector call with the ListItem context
|
|
79
|
+
return getSlotName(getListItem(item, index));
|
|
80
|
+
}
|
|
81
|
+
// render all realized templates as children
|
|
82
|
+
const cellVNODES = () => Object.entries(cells.value).map(([id, entry]) => {
|
|
83
|
+
const vnodes = ctx.slots[entry.slotName]?.(entry.itemCtx) ?? [
|
|
84
|
+
// default template is just a label
|
|
85
|
+
h("Label", {
|
|
86
|
+
text: entry.itemCtx.item,
|
|
87
|
+
}),
|
|
88
|
+
];
|
|
89
|
+
if (vnodes.length > 1) {
|
|
90
|
+
warn(`ListView template must contain a single root element. Found: ${vnodes.length}. Only the first one will be used.`);
|
|
91
|
+
}
|
|
92
|
+
const vnode = vnodes[0];
|
|
93
|
+
// set the key to the list cell id, so we can find this cell later...
|
|
94
|
+
vnode.key = id;
|
|
95
|
+
return vnode;
|
|
96
|
+
});
|
|
97
|
+
return () => {
|
|
98
|
+
return h("NSCListView", {
|
|
99
|
+
ref: listView,
|
|
100
|
+
items: props.items,
|
|
101
|
+
itemTemplates,
|
|
102
|
+
itemTemplateSelector,
|
|
103
|
+
onitemLoading,
|
|
104
|
+
}, cellVNODES());
|
|
105
|
+
};
|
|
106
|
+
},
|
|
107
|
+
});
|
|
108
|
+
//# sourceMappingURL=ListView.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ListView.js","sourceRoot":"","sources":["../../src/components/ListView.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAE7D,OAAO,EAEL,QAAQ,IAAI,WAAW,EACvB,eAAe,GAChB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,kBAAkB,EAAE,GAAG,EAAS,KAAK,EAAY,MAAM,IAAI,CAAC;AAErE,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,eAAe,CAAC,aAAa,EAAE,GAAG,EAAE,CAAC,WAAW,EAAE;IAChD,SAAS,kCAA0B;CACpC,CAAC,CAAC;AASH,IAAI;AAEJ,SAAS,WAAW,CAAC,IAAS,EAAE,KAAa;IAC3C,OAAO;QACL,IAAI;QACJ,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EAAE,KAAK,CAAC,CAAC,CAAC;QAC/C,CAAC;QAED,4CAA4C;QAC5C,MAAM,UAAU,GAAG,GAAG,EAAE,CACtB,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,KAAK,CAAC,EAAE,EAAE;YAC9C,MAAM,MAAM,GAAY,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI;gBACpE,mCAAmC;gBACnC,CAAC,CAAC,OAAO,EAAE;oBACT,IAAI,EAAE,KAAK,CAAC,OAAO,CAAC,IAAI;iBACzB,CAAC;aACH,CAAC;YAEF,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE;gBACrB,IAAI,CACF,gEAAgE,MAAM,CAAC,MAAM,oCAAoC,CAClH,CAAC;aACH;YAED,MAAM,KAAK,GAAU,MAAM,CAAC,CAAC,CAAC,CAAC;YAC/B,qEAAqE;YACrE,KAAK,CAAC,GAAG,GAAG,EAAE,CAAC;YAEf,OAAO,KAAK,CAAC;QACf,CAAC,CAAC,CAAC;QAEL,OAAO,GAAG,EAAE;YACV,OAAO,CAAC,CACN,aAAa,EACb;gBACE,GAAG,EAAE,QAAQ;gBACb,KAAK,EAAE,KAAK,CAAC,KAAK;gBAClB,aAAa;gBACb,oBAAoB;gBACpB,aAAa;aACd,EACD,UAAU,EAAE,CACb,CAAC;QACJ,CAAC,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { VNode } from "..";
|
|
2
|
+
declare global {
|
|
3
|
+
interface ListItem<T = any> {
|
|
4
|
+
item: T;
|
|
5
|
+
index: number;
|
|
6
|
+
even: boolean;
|
|
7
|
+
odd: boolean;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
export declare const ListView: import("@vue/runtime-core").DefineComponent<{
|
|
11
|
+
items: {
|
|
12
|
+
(arrayLength: number): any[];
|
|
13
|
+
(...items: any[]): any[];
|
|
14
|
+
new (arrayLength: number): any[];
|
|
15
|
+
new (...items: any[]): any[];
|
|
16
|
+
isArray(arg: any): arg is any[];
|
|
17
|
+
readonly prototype: any[];
|
|
18
|
+
from<T>(arrayLike: ArrayLike<T>): T[];
|
|
19
|
+
from<T_1, U>(arrayLike: ArrayLike<T_1>, mapfn: (v: T_1, k: number) => U, thisArg?: any): U[];
|
|
20
|
+
from<T_2>(iterable: Iterable<T_2> | ArrayLike<T_2>): T_2[];
|
|
21
|
+
from<T_3, U_1>(iterable: Iterable<T_3> | ArrayLike<T_3>, mapfn: (v: T_3, k: number) => U_1, thisArg?: any): U_1[];
|
|
22
|
+
of<T_4>(...items: T_4[]): T_4[];
|
|
23
|
+
readonly [Symbol.species]: ArrayConstructor;
|
|
24
|
+
};
|
|
25
|
+
itemTemplateSelector: FunctionConstructor;
|
|
26
|
+
}, () => VNode<import("@vue/runtime-core").RendererNode, import("@vue/runtime-core").RendererElement, {
|
|
27
|
+
[key: string]: any;
|
|
28
|
+
}>, unknown, {}, {}, import("@vue/runtime-core").ComponentOptionsMixin, import("@vue/runtime-core").ComponentOptionsMixin, {}, string, import("@vue/runtime-core").VNodeProps & import("@vue/runtime-core").AllowedComponentProps & import("@vue/runtime-core").ComponentCustomProps, Readonly<import("@vue/runtime-core").ExtractPropTypes<{
|
|
29
|
+
items: {
|
|
30
|
+
(arrayLength: number): any[];
|
|
31
|
+
(...items: any[]): any[];
|
|
32
|
+
new (arrayLength: number): any[];
|
|
33
|
+
new (...items: any[]): any[];
|
|
34
|
+
isArray(arg: any): arg is any[];
|
|
35
|
+
readonly prototype: any[];
|
|
36
|
+
from<T>(arrayLike: ArrayLike<T>): T[];
|
|
37
|
+
from<T_1, U>(arrayLike: ArrayLike<T_1>, mapfn: (v: T_1, k: number) => U, thisArg?: any): U[];
|
|
38
|
+
from<T_2>(iterable: Iterable<T_2> | ArrayLike<T_2>): T_2[];
|
|
39
|
+
from<T_3, U_1>(iterable: Iterable<T_3> | ArrayLike<T_3>, mapfn: (v: T_3, k: number) => U_1, thisArg?: any): U_1[];
|
|
40
|
+
of<T_4>(...items: T_4[]): T_4[];
|
|
41
|
+
readonly [Symbol.species]: ArrayConstructor;
|
|
42
|
+
};
|
|
43
|
+
itemTemplateSelector: FunctionConstructor;
|
|
44
|
+
}>>, {}>;
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { defineComponent, h, warn } from "@vue/runtime-core";
|
|
2
|
+
import { ListView as NSCListView, ObservableArray, StackLayout, } from "@nativescript/core";
|
|
3
|
+
import { getCurrentInstance, ref, watch, onBeforeUpdate, onUpdated, } from "..";
|
|
4
|
+
import { registerElement } from "../registry";
|
|
5
|
+
import { ELEMENT_REF } from "../runtimeHelpers";
|
|
6
|
+
registerElement("NSCListView", () => NSCListView, {
|
|
7
|
+
viewFlags: 8 /* NSVViewFlags.NO_CHILDREN */,
|
|
8
|
+
});
|
|
9
|
+
registerElement("NSCListViewDummyHolder", () => StackLayout);
|
|
10
|
+
function getListItem(item, index) {
|
|
11
|
+
return {
|
|
12
|
+
item,
|
|
13
|
+
index,
|
|
14
|
+
even: index % 2 === 0,
|
|
15
|
+
odd: index % 2 !== 0,
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
const LIST_CELL_ID = Symbol("list_cell_id");
|
|
19
|
+
export const ListView = /*#__PURE__*/ defineComponent({
|
|
20
|
+
props: {
|
|
21
|
+
items: (Array),
|
|
22
|
+
itemTemplateSelector: Function,
|
|
23
|
+
},
|
|
24
|
+
setup(props, ctx) {
|
|
25
|
+
const itemTemplates = Object.keys(ctx.slots).map((slotName) => {
|
|
26
|
+
return {
|
|
27
|
+
key: slotName,
|
|
28
|
+
createView() {
|
|
29
|
+
// no need to return anything here
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
});
|
|
33
|
+
const getSlotName = (itemCtx) => props.itemTemplateSelector?.(itemCtx) ?? "default";
|
|
34
|
+
const listView = ref(null);
|
|
35
|
+
const vm = getCurrentInstance();
|
|
36
|
+
watch(props, () => {
|
|
37
|
+
console.log("props changed?");
|
|
38
|
+
try {
|
|
39
|
+
const lv = listView.value?.nativeView;
|
|
40
|
+
lv?.refresh();
|
|
41
|
+
}
|
|
42
|
+
catch (err) {
|
|
43
|
+
console.log(err);
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
let cellId = 0;
|
|
47
|
+
const cells = ref({});
|
|
48
|
+
function onitemLoading(event) {
|
|
49
|
+
const el = event.view?.[ELEMENT_REF];
|
|
50
|
+
const id = el?.nativeView[LIST_CELL_ID] ?? `LIST_CELL_${cellId++}`;
|
|
51
|
+
const itemCtx = getListItem(props.items instanceof ObservableArray
|
|
52
|
+
? props.items.getItem(event.index)
|
|
53
|
+
: props.items[event.index], event.index);
|
|
54
|
+
// update the cell data with the current row
|
|
55
|
+
cells.value[id] = {
|
|
56
|
+
itemCtx,
|
|
57
|
+
slotName: getSlotName(itemCtx),
|
|
58
|
+
};
|
|
59
|
+
// trigger an update!
|
|
60
|
+
vm.update();
|
|
61
|
+
// find the vnode rendering this cell
|
|
62
|
+
const vnode = vm.subTree.children.find((vnode) => {
|
|
63
|
+
return vnode.key === id;
|
|
64
|
+
});
|
|
65
|
+
// store the cell id on the Element itself so we can retrieve it when recycling kicks in
|
|
66
|
+
const cellEl = vnode.el.nativeView;
|
|
67
|
+
cellEl[LIST_CELL_ID] = id;
|
|
68
|
+
// finally, set the event.view to the rendered cellEl
|
|
69
|
+
event.view = cellEl;
|
|
70
|
+
// event.view = new Label();
|
|
71
|
+
}
|
|
72
|
+
function itemTemplateSelector(item, index) {
|
|
73
|
+
// pass on the template selector call with the ListItem context
|
|
74
|
+
return getSlotName(getListItem(item, index));
|
|
75
|
+
}
|
|
76
|
+
onBeforeUpdate(() => {
|
|
77
|
+
console.time("update");
|
|
78
|
+
});
|
|
79
|
+
onUpdated(() => {
|
|
80
|
+
console.timeEnd("update");
|
|
81
|
+
});
|
|
82
|
+
return () => {
|
|
83
|
+
console.log("RENDER");
|
|
84
|
+
// return h("StackLayout", [
|
|
85
|
+
// h("NSCListView", {
|
|
86
|
+
// ref: listView,
|
|
87
|
+
// items: props.items,
|
|
88
|
+
// itemTemplates,
|
|
89
|
+
// itemTemplateSelector,
|
|
90
|
+
// onitemLoading,
|
|
91
|
+
// }),
|
|
92
|
+
// ...Object.entries(cells.value).map(([id, child]) => {
|
|
93
|
+
// const vnodes: VNode[] = ctx.slots[child.slotName](child.itemCtx);
|
|
94
|
+
// if (vnodes.length > 1) {
|
|
95
|
+
// warn(
|
|
96
|
+
// `ListView template must contain a single root element. Found: ${vnodes.length}. Only the first one will be used.`
|
|
97
|
+
// );
|
|
98
|
+
// }
|
|
99
|
+
// const vnode: VNode = vnodes[0];
|
|
100
|
+
// // set the key to the list cell id, so we can find this cell later...
|
|
101
|
+
// vnode.key = id;
|
|
102
|
+
// return vnode;
|
|
103
|
+
// }),
|
|
104
|
+
// ]);
|
|
105
|
+
return h("NSCListView", {
|
|
106
|
+
ref: listView,
|
|
107
|
+
items: props.items,
|
|
108
|
+
itemTemplates,
|
|
109
|
+
itemTemplateSelector,
|
|
110
|
+
onitemLoading,
|
|
111
|
+
},
|
|
112
|
+
// render all realized templates as children
|
|
113
|
+
Object.entries(cells.value).map(([id, child]) => {
|
|
114
|
+
const vnodes = ctx.slots[child.slotName](child.itemCtx);
|
|
115
|
+
if (vnodes.length > 1) {
|
|
116
|
+
warn(`ListView template must contain a single root element. Found: ${vnodes.length}. Only the first one will be used.`);
|
|
117
|
+
}
|
|
118
|
+
const vnode = vnodes[0];
|
|
119
|
+
// set the key to the list cell id, so we can find this cell later...
|
|
120
|
+
vnode.key = id;
|
|
121
|
+
return vnode;
|
|
122
|
+
}));
|
|
123
|
+
};
|
|
124
|
+
},
|
|
125
|
+
});
|
|
126
|
+
//# sourceMappingURL=ListView.working.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version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AAK,EAAE,KAAK,CAAC,KAAK;gBAClB,aAAa;gBACb,oBAAoB;gBACpB,aAAa;aACd;YACD,4CAA4C;YAC5C,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,KAAK,CAAC,EAAE,EAAE;gBAC9C,MAAM,MAAM,GAAY,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;gBAEjE,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE;oBACrB,IAAI,CACF,gEAAgE,MAAM,CAAC,MAAM,oCAAoC,CAClH,CAAC;iBACH;gBAED,MAAM,KAAK,GAAU,MAAM,CAAC,CAAC,CAAC,CAAC;gBAC/B,qEAAqE;gBACrE,KAAK,CAAC,GAAG,GAAG,EAAE,CAAC;gBAEf,OAAO,KAAK,CAAC;YACf,CAAC,CAAC,CACH,CAAC;QACJ,CAAC,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export declare const BUILT_IN_COMPONENTS: {
|
|
2
|
+
ActionBar: import("@vue/runtime-core").DefineComponent<{}, () => import("@vue/runtime-core").VNode<import("@vue/runtime-core").RendererNode, import("@vue/runtime-core").RendererElement, {
|
|
3
|
+
[key: string]: any;
|
|
4
|
+
}>, {}, {}, {}, import("@vue/runtime-core").ComponentOptionsMixin, import("@vue/runtime-core").ComponentOptionsMixin, {}, string, import("@vue/runtime-core").VNodeProps & import("@vue/runtime-core").AllowedComponentProps & import("@vue/runtime-core").ComponentCustomProps, Readonly<import("@vue/runtime-core").ExtractPropTypes<{}>>, {}>;
|
|
5
|
+
ListView: import("@vue/runtime-core").DefineComponent<{
|
|
6
|
+
items: {
|
|
7
|
+
validator(value: unknown): boolean;
|
|
8
|
+
};
|
|
9
|
+
itemTemplateSelector: FunctionConstructor;
|
|
10
|
+
}, () => import("@vue/runtime-core").VNode<import("@vue/runtime-core").RendererNode, import("@vue/runtime-core").RendererElement, {
|
|
11
|
+
[key: string]: any;
|
|
12
|
+
}>, unknown, {}, {}, import("@vue/runtime-core").ComponentOptionsMixin, import("@vue/runtime-core").ComponentOptionsMixin, {}, string, import("@vue/runtime-core").VNodeProps & import("@vue/runtime-core").AllowedComponentProps & import("@vue/runtime-core").ComponentCustomProps, Readonly<import("@vue/runtime-core").ExtractPropTypes<{
|
|
13
|
+
items: {
|
|
14
|
+
validator(value: unknown): boolean;
|
|
15
|
+
};
|
|
16
|
+
itemTemplateSelector: FunctionConstructor;
|
|
17
|
+
}>>, {}>;
|
|
18
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,SAAS;IACT,QAAQ;CACT,CAAC"}
|