nativescript-vue 2.9.2 → 3.0.0-beta.0

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.
Files changed (78) hide show
  1. package/dist/compiler-sfc/index.d.ts +1 -0
  2. package/dist/compiler-sfc/index.js +2 -0
  3. package/dist/compiler-sfc/index.js.map +1 -0
  4. package/dist/compiler.d.ts +4 -0
  5. package/dist/compiler.js +32 -0
  6. package/dist/compiler.js.map +1 -0
  7. package/dist/components/ActionBar.d.ts +3 -0
  8. package/dist/components/ActionBar.js +69 -0
  9. package/dist/components/ActionBar.js.map +1 -0
  10. package/dist/components/ListView.d.ts +20 -0
  11. package/dist/components/ListView.js +108 -0
  12. package/dist/components/ListView.js.map +1 -0
  13. package/dist/components/ListView.working.d.ts +44 -0
  14. package/dist/components/ListView.working.js +126 -0
  15. package/dist/components/ListView.working.js.map +1 -0
  16. package/dist/components/index.d.ts +18 -0
  17. package/dist/components/index.js +7 -0
  18. package/dist/components/index.js.map +1 -0
  19. package/dist/directives/vShow.d.ts +7 -0
  20. package/dist/directives/vShow.js +45 -0
  21. package/dist/directives/vShow.js.map +1 -0
  22. package/dist/dom/index.d.ts +66 -0
  23. package/dist/dom/index.js +304 -0
  24. package/dist/dom/index.js.map +1 -0
  25. package/dist/index.d.ts +18 -0
  26. package/dist/index.js +66 -12847
  27. package/dist/index.js.map +1 -0
  28. package/dist/index.mjs.map +7 -0
  29. package/dist/nativescript/elements.d.ts +1 -0
  30. package/dist/nativescript/elements.js +139 -0
  31. package/dist/nativescript/elements.js.map +1 -0
  32. package/dist/nativescript/index.d.ts +6 -0
  33. package/dist/nativescript/index.js +27 -0
  34. package/dist/nativescript/index.js.map +1 -0
  35. package/dist/plugins/modals.d.ts +22 -0
  36. package/dist/plugins/modals.js +61 -0
  37. package/dist/plugins/modals.js.map +1 -0
  38. package/dist/plugins/navigation.d.ts +32 -0
  39. package/dist/plugins/navigation.js +129 -0
  40. package/dist/plugins/navigation.js.map +1 -0
  41. package/dist/registry/index.d.ts +26 -0
  42. package/dist/registry/index.js +55 -0
  43. package/dist/registry/index.js.map +1 -0
  44. package/dist/renderer/index.d.ts +1 -0
  45. package/dist/renderer/index.js +8 -0
  46. package/dist/renderer/index.js.map +1 -0
  47. package/dist/renderer/modules/attrs.d.ts +2 -0
  48. package/dist/renderer/modules/attrs.js +31 -0
  49. package/dist/renderer/modules/attrs.js.map +1 -0
  50. package/dist/renderer/modules/class.d.ts +2 -0
  51. package/dist/renderer/modules/class.js +9 -0
  52. package/dist/renderer/modules/class.js.map +1 -0
  53. package/dist/renderer/modules/events.d.ts +12 -0
  54. package/dist/renderer/modules/events.js +53 -0
  55. package/dist/renderer/modules/events.js.map +1 -0
  56. package/dist/renderer/modules/style.d.ts +4 -0
  57. package/dist/renderer/modules/style.js +34 -0
  58. package/dist/renderer/modules/style.js.map +1 -0
  59. package/dist/renderer/nodeOps.d.ts +16 -0
  60. package/dist/renderer/nodeOps.js +68 -0
  61. package/dist/renderer/nodeOps.js.map +1 -0
  62. package/dist/renderer/patchProp.d.ts +2 -0
  63. package/dist/renderer/patchProp.js +30 -0
  64. package/dist/renderer/patchProp.js.map +1 -0
  65. package/dist/runtimeHelpers.d.ts +5 -0
  66. package/dist/runtimeHelpers.js +10 -0
  67. package/dist/runtimeHelpers.js.map +1 -0
  68. package/dist/types.d.ts +15 -0
  69. package/dist/types.js +2 -0
  70. package/dist/types.js.map +1 -0
  71. package/dist/withCompiler.d.ts +3 -0
  72. package/dist/withCompiler.js +6 -0
  73. package/dist/withCompiler.js.map +1 -0
  74. package/nativescript.webpack.js +51 -0
  75. package/package.json +18 -111
  76. package/LICENSE +0 -21
  77. package/README.md +0 -118
  78. package/index.d.ts +0 -90
@@ -0,0 +1 @@
1
+ export * from "@vue/compiler-sfc";
@@ -0,0 +1,2 @@
1
+ export * from "@vue/compiler-sfc";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/compiler-sfc/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAA"}
@@ -0,0 +1,4 @@
1
+ import { CompilerOptions } from "@vue/compiler-dom";
2
+ import { RenderFunction } from "@vue/runtime-dom";
3
+ export declare function compileToFunction(template: string, options?: CompilerOptions): RenderFunction;
4
+ export { compileToFunction as compile };
@@ -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,MAAM,SAAS,GAAG,MAAM,CAAC,UAA0B,CAAC;YACpD,MAAM,SAAS,GAAG,KAAK,CAAC,UAAU,CAAC;YAEnC,IAAI,SAAS,YAAY,mBAAmB,EAAE;gBAC5C,SAAS,CAAC,gBAAgB,GAAG,SAAS,CAAC;aACxC;iBAAM,IAAI,SAAS,YAAY,aAAa,EAAE;gBAC7C,IAAI,OAAO,EAAE;oBACX,MAAM,EAAE,GAAoB,SAAS,CAAC,WAAW,CAAC,QAAQ,EAAE,CAAC;oBAC7D,EAAE,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC,EAAE,SAAS,CAAC,CAAC;oBAChC,SAAS,CAAC,WAAmB,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;iBAC7C;qBAAM;oBACL,SAAS,CAAC,WAAW,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;iBAC1C;aACF;iBAAM;gBACL,SAAS,CAAC,SAAS,GAAG,SAAS,CAAC;aAC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C,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,KAAK;QACL,IAAI,EAAE,KAAK,GAAG,CAAC,KAAK,CAAC;QACrB,GAAG,EAAE,KAAK,GAAG,CAAC,KAAK,CAAC;KACrB,CAAC;AACJ,CAAC;AAED,MAAM,YAAY,GAAG,MAAM,CAAC,cAAc,CAAC,CAAC;AAE5C,MAAM,CAAC,MAAM,QAAQ,GAAG,aAAa,CAAC,eAAe,CAAC;IACpD,KAAK,EAAE;QACL,KAAK,EAAE;YACL,SAAS,CAAC,KAAK;gBACb,OAAO,K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,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":3,"file":"ListView.working.js","sourceRoot":"","sources":["../../src/components/ListView.working.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAE7D,OAAO,EAGL,QAAQ,IAAI,WAAW,EACvB,eAAe,EACf,WAAW,GACZ,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACL,kBAAkB,EAClB,GAAG,EAEH,KAAK,EACL,cAAc,EACd,SAAS,GACV,MAAM,IAAI,CAAC;AAEZ,OAA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,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,7 @@
1
+ import { ActionBar } from "./ActionBar";
2
+ import { ListView } from "./ListView";
3
+ export const BUILT_IN_COMPONENTS = {
4
+ ActionBar,
5
+ ListView,
6
+ };
7
+ //# sourceMappingURL=index.js.map
@@ -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"}
@@ -0,0 +1,7 @@
1
+ import { ObjectDirective } from "@vue/runtime-core";
2
+ import { NSVElement } from "../dom";
3
+ interface VShowElement extends NSVElement {
4
+ _vod: string;
5
+ }
6
+ export declare const vShow: ObjectDirective<VShowElement>;
7
+ export {};
@@ -0,0 +1,45 @@
1
+ export const vShow = {
2
+ beforeMount(el, { value }, { transition }) {
3
+ el._vod =
4
+ el.getAttribute("visibility") === "none"
5
+ ? ""
6
+ : el.getAttribute("visibility");
7
+ if (transition && value) {
8
+ transition.beforeEnter(el);
9
+ }
10
+ else {
11
+ setDisplay(el, value);
12
+ }
13
+ },
14
+ mounted(el, { value }, { transition }) {
15
+ if (transition && value) {
16
+ transition.enter(el);
17
+ }
18
+ },
19
+ updated(el, { value, oldValue }, { transition }) {
20
+ if (!value === !oldValue)
21
+ return;
22
+ if (transition) {
23
+ if (value) {
24
+ transition.beforeEnter(el);
25
+ setDisplay(el, true);
26
+ transition.enter(el);
27
+ }
28
+ else {
29
+ transition.leave(el, () => {
30
+ setDisplay(el, false);
31
+ });
32
+ }
33
+ }
34
+ else {
35
+ setDisplay(el, value);
36
+ }
37
+ },
38
+ beforeUnmount(el) {
39
+ setDisplay(el, true);
40
+ },
41
+ };
42
+ function setDisplay(el, value) {
43
+ el.setAttribute("visibility", value ? el._vod : "collapsed");
44
+ }
45
+ //# sourceMappingURL=vShow.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file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CAAC,EAAE;QACd,UAAU,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC;IACvB,CAAC;CACF,CAAC;AAEF,SAAS,UAAU,CAAC,EAAgB,EAAE,KAAc;IAClD,EAAE,CAAC,YAAY,CAAC,YAAY,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC;AAC/D,CAAC"}
@@ -0,0 +1,66 @@
1
+ import { NSVViewMeta } from "../registry";
2
+ export declare const enum NSVNodeTypes {
3
+ TEXT = "text",
4
+ ELEMENT = "element",
5
+ COMMENT = "comment",
6
+ ROOT = "root"
7
+ }
8
+ export declare const enum NSVViewFlags {
9
+ NONE = 0,
10
+ SKIP_ADD_TO_DOM = 1,
11
+ CONTENT_VIEW = 2,
12
+ LAYOUT_VIEW = 4,
13
+ NO_CHILDREN = 8
14
+ }
15
+ export declare abstract class NSVNode {
16
+ protected constructor(nodeType: NSVNodeTypes);
17
+ nodeId: number;
18
+ nodeType: NSVNodeTypes;
19
+ private _text?;
20
+ get text(): string | undefined;
21
+ set text(value: string | undefined);
22
+ parentNode: NSVElement | null;
23
+ childNodes: NSVNode[];
24
+ get nextSibling(): NSVNode | null;
25
+ get prevSibling(): NSVNode | null;
26
+ get firstChild(): NSVNode;
27
+ get lastChild(): NSVNode;
28
+ }
29
+ export declare class NSVElement extends NSVNode {
30
+ private readonly _tagName;
31
+ private readonly _nativeView;
32
+ private _meta;
33
+ private _attributeOriginalValue;
34
+ constructor(tagName: string);
35
+ get tagName(): string;
36
+ get nativeView(): any;
37
+ get style(): any | string;
38
+ set style(inlineStyle: any | string);
39
+ get text(): string | undefined;
40
+ set text(t: string | undefined);
41
+ get meta(): NSVViewMeta;
42
+ addEventListener(event: string, handler: any, options?: AddEventListenerOptions): void;
43
+ removeEventListener(event: string, handler?: any): void;
44
+ dispatchEvent(event: string): void;
45
+ getAttribute(name: string): unknown;
46
+ setAttribute(name: string, value: unknown): void;
47
+ removeAttribute(name: string): void;
48
+ insertBefore(el: NSVNode, anchor?: NSVNode | null): void;
49
+ appendChild(el: NSVNode): void;
50
+ removeChild(el: NSVNode): void;
51
+ private addChild;
52
+ updateText(): void;
53
+ }
54
+ export declare class NSVComment extends NSVNode {
55
+ constructor(text: string);
56
+ }
57
+ export declare class NSVText extends NSVNode {
58
+ constructor(text: string);
59
+ }
60
+ export declare class NSVRoot extends NSVNode {
61
+ el?: NSVElement;
62
+ constructor();
63
+ appendChild(el: NSVNode): void;
64
+ removeChild(el: NSVNode): void;
65
+ insertBefore(el: NSVNode, anchor?: NSVNode | null): void;
66
+ }