nativescript-vue 3.0.0-beta.6 → 3.0.0-beta.8

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 (51) hide show
  1. package/README.md +3 -4
  2. package/dist/components/ActionBar.d.ts +1 -1
  3. package/dist/components/ActionBar.js +5 -5
  4. package/dist/components/ListView.d.ts +2 -2
  5. package/dist/components/ListView.js +10 -11
  6. package/dist/components/ListView.js.map +1 -1
  7. package/dist/components/index.d.ts +6 -5
  8. package/dist/components/index.js +2 -2
  9. package/dist/components/index.js.map +1 -1
  10. package/dist/directives/vShow.d.ts +2 -2
  11. package/dist/directives/vShow.js +4 -4
  12. package/dist/dom/index.d.ts +1 -1
  13. package/dist/dom/index.js +7 -6
  14. package/dist/dom/index.js.map +1 -1
  15. package/dist/index.d.ts +18 -13
  16. package/dist/index.js +48 -18
  17. package/dist/index.js.map +1 -1
  18. package/dist/nativescript/elements.js +54 -54
  19. package/dist/nativescript/index.d.ts +3 -3
  20. package/dist/nativescript/index.js +3 -3
  21. package/dist/plugins/modals.d.ts +5 -5
  22. package/dist/plugins/modals.js +46 -24
  23. package/dist/plugins/modals.js.map +1 -1
  24. package/dist/plugins/navigation.d.ts +6 -6
  25. package/dist/plugins/navigation.js +52 -72
  26. package/dist/plugins/navigation.js.map +1 -1
  27. package/dist/plugins/templates.d.ts +10 -0
  28. package/dist/plugins/templates.js +12 -0
  29. package/dist/plugins/templates.js.map +1 -0
  30. package/dist/registry/index.d.ts +1 -1
  31. package/dist/registry/index.js +2 -2
  32. package/dist/registry/index.js.map +1 -1
  33. package/dist/renderer/index.js +3 -3
  34. package/dist/renderer/modules/attrs.d.ts +1 -1
  35. package/dist/renderer/modules/attrs.js +3 -3
  36. package/dist/renderer/modules/class.d.ts +1 -1
  37. package/dist/renderer/modules/class.js +2 -2
  38. package/dist/renderer/modules/events.d.ts +2 -2
  39. package/dist/renderer/modules/events.js +2 -2
  40. package/dist/renderer/modules/style.d.ts +1 -1
  41. package/dist/renderer/modules/style.js +6 -6
  42. package/dist/renderer/nodeOps.d.ts +3 -3
  43. package/dist/renderer/nodeOps.js +4 -4
  44. package/dist/renderer/patchProp.d.ts +1 -1
  45. package/dist/renderer/patchProp.js +11 -11
  46. package/dist/runtimeHelpers.d.ts +8 -13
  47. package/dist/runtimeHelpers.js +14 -12
  48. package/dist/runtimeHelpers.js.map +1 -1
  49. package/dist/types.d.ts +1 -1
  50. package/nativescript.webpack.js +24 -12
  51. package/package.json +26 -10
@@ -1,27 +1,27 @@
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";
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 "class":
10
+ case 'class':
11
11
  // console.log('->patchProp+Class')
12
12
  patchClass(el, nextValue);
13
13
  break;
14
- case "style":
14
+ case 'style':
15
15
  // console.log('->patchProp+Style')
16
16
  patchStyle(el, prevValue, nextValue);
17
17
  break;
18
- case "modelValue":
19
- case "onUpdate:modelValue":
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 === "modelValue") {
24
+ if (key === 'modelValue') {
25
25
  patchAttr(el, prop, prevValue, nextValue);
26
26
  }
27
27
  else {
@@ -1,19 +1,14 @@
1
- import { View } from "@nativescript/core";
2
- import { AppContext, Component } from "@vue/runtime-core";
3
- import { NSVNode } from "./dom";
1
+ import { View } from '@nativescript/core';
2
+ import { AppContext, Component, RendererElement, RendererNode, VNode } from '@vue/runtime-core';
3
+ import { NSVNode } from './dom';
4
4
  type Props = Record<string, unknown>;
5
5
  export declare const setRootContext: (context: AppContext) => void;
6
- export declare const createNativeView: <T = View>(component: Component, props?: Props) => {
7
- context: {
8
- app: import("@vue/runtime-core").App<any>;
9
- config: import("@vue/runtime-core").AppConfig;
10
- mixins: import("@vue/runtime-core").ComponentOptions<{}, any, any, any, any, any, any, any>[];
11
- components: Record<string, Component<any, any, any, import("@vue/runtime-core").ComputedOptions, import("@vue/runtime-core").MethodOptions>>;
12
- directives: Record<string, import("@vue/runtime-core").Directive<any, any>>;
13
- provides: Record<string | symbol, any>;
14
- };
6
+ export declare const createNativeView: <T = View>(component: Component, props?: Props, contextOverrides?: any) => {
7
+ context: any;
15
8
  readonly nativeView: T;
16
- mount(root?: NSVNode): T;
9
+ mount(root?: NSVNode): VNode<RendererNode, RendererElement, {
10
+ nativeView: T;
11
+ }>;
17
12
  unmount(): void;
18
13
  };
19
14
  export declare const ELEMENT_REF: unique symbol;
@@ -1,36 +1,38 @@
1
- import { h } from "@vue/runtime-core";
2
- import { NSVRoot } from "./dom";
3
- import { renderer } from "./renderer";
1
+ import { h, } from '@vue/runtime-core';
2
+ import { NSVRoot } from './dom';
3
+ import { renderer } from './renderer';
4
4
  const __DEV__ = true;
5
5
  let rootContext = null;
6
6
  export const setRootContext = (context) => {
7
7
  rootContext = context;
8
8
  };
9
- export const createNativeView = (component, props) => {
9
+ export const createNativeView = (component, props, contextOverrides) => {
10
10
  let vnode;
11
11
  let isMounted = false;
12
12
  let container;
13
- const context = { ...rootContext };
13
+ const context = { ...rootContext, ...contextOverrides };
14
14
  return {
15
15
  context,
16
16
  get nativeView() {
17
17
  return vnode.el.nativeView;
18
18
  },
19
19
  mount(root = new NSVRoot()) {
20
- if (isMounted)
21
- return vnode.el.nativeView;
20
+ if (isMounted) {
21
+ return vnode;
22
+ }
22
23
  vnode = h(component, props);
23
24
  vnode.appContext = context;
24
25
  renderer.render(vnode, root);
25
26
  isMounted = true;
26
27
  container = root;
27
- return vnode.el.nativeView;
28
+ return vnode;
28
29
  },
29
30
  unmount() {
30
31
  if (!isMounted)
31
32
  return;
32
- renderer.render(null, container);
33
33
  vnode = null;
34
+ renderer.render(null, container);
35
+ isMounted = false;
34
36
  container = null;
35
37
  },
36
38
  };
@@ -38,9 +40,9 @@ export const createNativeView = (component, props) => {
38
40
  export const ELEMENT_REF = Symbol(__DEV__ ? `elementRef` : ``);
39
41
  const onRE = /^on.+/;
40
42
  export const isOn = (key) => onRE.test(key);
41
- export const isAndroidKey = (key) => key.startsWith("android:");
42
- export const isIOSKey = (key) => key.startsWith("ios:");
43
+ export const isAndroidKey = (key) => key.startsWith('android:');
44
+ export const isIOSKey = (key) => key.startsWith('ios:');
43
45
  export const isBoolean = (value) => {
44
- return typeof value === "boolean" || value instanceof Boolean;
46
+ return typeof value === 'boolean' || value instanceof Boolean;
45
47
  };
46
48
  //# sourceMappingURL=runtimeHelpers.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"runtimeHelpers.js","sourceRoot":"","sources":["../src/runtimeHelpers.ts"],"names":[],"mappings":"AACA,OAAO,EAAyB,CAAC,EAAS,MAAM,mBAAmB,CAAC;AACpE,OAAO,EAAW,OAAO,EAAE,MAAM,OAAO,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAItC,MAAM,OAAO,GAAG,IAAI,CAAC;AAErB,IAAI,WAAW,GAAe,IAAI,CAAC;AAEnC,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,OAAmB,EAAE,EAAE;IACpD,WAAW,GAAG,OAAO,CAAC;AACxB,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAC9B,SAAoB,EACpB,KAAa,EACb,EAAE;IACF,IAAI,KAAY,CAAC;IACjB,IAAI,SAAS,GAAG,KAAK,CAA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I,CAAC;YACjB,SAAS,GAAG,IAAI,CAAC;YAEjB,OAAO,KAAU,CAAC;QACpB,CAAC;QACD,OAAO;YACL,IAAI,CAAC,SAAS;gBAAE,OAAO;YACvB,KAAK,GAAG,IAAI,CAAC;YACb,QAAQ,CAAC,MAAM,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;YACjC,SAAS,GAAG,KAAK,CAAC;YAClB,SAAS,GAAG,IAAI,CAAC;QACnB,CAAC;KACF,CAAC;AACJ,CAAC,CAAC;AAEF,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 CHANGED
@@ -1,4 +1,4 @@
1
- declare module "@vue/runtime-core" {
1
+ declare module '@vue/runtime-core' {
2
2
  interface GlobalComponents {
3
3
  Frame: DefineComponent<{}>;
4
4
  Page: DefineComponent;
@@ -1,21 +1,22 @@
1
- const { VueLoaderPlugin } = require("vue-loader");
1
+ const { VueLoaderPlugin } = require('vue-loader');
2
2
 
3
3
  /**
4
4
  * @param {typeof import("@nativescript/webpack")} webpack
5
5
  */
6
6
  module.exports = (webpack) => {
7
- webpack.useConfig("vue");
7
+ webpack.useConfig('vue');
8
8
 
9
9
  webpack.chainWebpack((config) => {
10
+ // resolve any imports from "vue" to "nativescript-vue"
10
11
  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"))
12
+
13
+ config.plugins.get('VueLoaderPlugin').use(VueLoaderPlugin);
14
+
15
+ // use "vue-loader" from "nativescript-vue" deps rather than the one from @nativescript/webpack
16
+ config.module.rules
17
+ .get('vue')
18
+ .uses.get('vue-loader')
19
+ .loader(require.resolve('vue-loader'))
19
20
  .tap((options) => {
20
21
  return {
21
22
  ...options,
@@ -27,7 +28,17 @@ module.exports = (webpack) => {
27
28
  };
28
29
  });
29
30
 
30
- config.plugin("DefinePlugin").tap((args) => {
31
+ config.module.rules
32
+ .get('css')
33
+ .uses.get('vue-css-loader')
34
+ .loader(require.resolve('vue-loader/dist/stylePostLoader.js'));
35
+
36
+ config.module.rules
37
+ .get('scss')
38
+ .uses.get('vue-css-loader')
39
+ .loader(require.resolve('vue-loader/dist/stylePostLoader.js'));
40
+
41
+ config.plugin('DefinePlugin').tap((args) => {
31
42
  Object.assign(args[0], {
32
43
  __VUE_OPTIONS_API__: true,
33
44
  __VUE_PROD_DEVTOOLS__: false,
@@ -37,7 +48,7 @@ module.exports = (webpack) => {
37
48
  });
38
49
 
39
50
  // disable vue fork ts checker, as it doesn't work with vue3 yet?
40
- config.plugin("ForkTsCheckerWebpackPlugin").tap((args) => {
51
+ config.plugin('ForkTsCheckerWebpackPlugin').tap((args) => {
41
52
  args[0] = webpack.merge(args[0], {
42
53
  typescript: {
43
54
  extensions: {
@@ -47,6 +58,7 @@ module.exports = (webpack) => {
47
58
  },
48
59
  },
49
60
  });
61
+
50
62
  return args;
51
63
  });
52
64
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nativescript-vue",
3
- "version": "3.0.0-beta.6",
3
+ "version": "3.0.0-beta.8",
4
4
  "main": "dist/index.js",
5
5
  "files": [
6
6
  "dist/",
@@ -9,20 +9,36 @@
9
9
  "license": "MIT",
10
10
  "scripts": {
11
11
  "build": "tsc",
12
+ "format": "prettier --write .",
13
+ "format:check": "prettier --check .",
14
+ "prepare": "husky install",
12
15
  "prepack": "npm run build"
13
16
  },
14
17
  "dependencies": {
15
- "@vue/compiler-dom": "^3.2.41",
16
- "@vue/compiler-sfc": "^3.2.41",
18
+ "@vue/compiler-sfc": "^3.3.4",
19
+ "@vue/runtime-core": "^3.3.4",
20
+ "@vue/shared": "^3.3.4",
17
21
  "set-value": "^4.1.0",
18
- "vue-loader": "^17.0.0"
22
+ "vue-loader": "^17.2.2"
19
23
  },
20
24
  "devDependencies": {
21
- "@nativescript/core": "^8.3.5",
22
- "@nativescript/webpack": "~5.0.12",
23
- "esbuild": "^0.15.12",
24
- "tsx": "^3.11.0",
25
- "typescript": "^4.8.4",
26
- "vue": "^3.2.41"
25
+ "@commitlint/cli": "^17.6.3",
26
+ "@commitlint/config-conventional": "^17.6.3",
27
+ "@nativescript/core": "~8.5.0",
28
+ "@nativescript/webpack": "~5.0.14",
29
+ "esbuild": "^0.17.19",
30
+ "husky": "^8.0.3",
31
+ "lint-staged": "^13.2.2",
32
+ "prettier": "^2.8.8",
33
+ "typescript": "^4.9.5"
34
+ },
35
+ "lint-staged": {
36
+ "*": [
37
+ "prettier --ignore-unknown --write"
38
+ ]
39
+ },
40
+ "prettier": {
41
+ "useTabs": false,
42
+ "singleQuote": true
27
43
  }
28
44
  }