Thanks to visit codestin.com
Credit goes to github.com

Skip to content

feat: updates #1045

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# EditorConfig is awesome: https://EditorConfig.org

# top-most EditorConfig file
root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
5 changes: 5 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

echo "\n---- Commit Lint ----\n";
npx --no-install commitlint --edit "$1"
5 changes: 5 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

echo "\n---- Lint Staged ----\n";
npx --no-install lint-staged --config=package.json
4 changes: 4 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
demo/hooks
demo/platforms
demo/App_Resources
dist/
34 changes: 16 additions & 18 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
{
"files.exclude": {
"**/.git": true,
"**/.svn": true,
"**/.hg": true,
"**/CVS": true,
"**/.DS_Store": true,
"**/Thumbs.db": true,
"**/*.js": {
"when": "$(basename).ts"
},
"**/*.map": true,
"**/.idea": false,
"**/.tscache": true,
"**/node_modules": false
"files.exclude": {
"**/.git": true,
"**/.svn": true,
"**/.hg": true,
"**/CVS": true,
"**/.DS_Store": true,
"**/Thumbs.db": true,
"**/*.js": {
"when": "$(basename).ts"
},
"**/*.map": true,
"**/.idea": false,
"**/.tscache": true,
"**/node_modules": false
},

"html.customData": [
"./test.json"
]
}
"html.customData": ["./test.json"]
}
3 changes: 0 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

<h1 align="center">NativeScript-Vue3 Beta</h1>


<p align="center">
<a href="https://www.npmjs.com/package/nativescript-vue">
<img src="https://img.shields.io/npm/v/nativescript-vue/beta.svg" alt="npm">
Expand All @@ -14,7 +13,6 @@
</a>
</p>


NativeScript-Vue with Vue3 support now in beta!

## Quick start
Expand All @@ -38,7 +36,6 @@ If you encounter any issues, please open a new issue with as much detail as poss

- [Join Discord](https://nativescript.org/discord)


## Looking for V2?

The V2 version has been moved to the [v2 branch](https://github.com/nativescript-vue/nativescript-vue/tree/v2)
20 changes: 10 additions & 10 deletions build.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import path from "path";
import { fileURLToPath } from "url";
import { build } from "esbuild";
import path from 'path';
import { fileURLToPath } from 'url';
import { build } from 'esbuild';

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
Expand All @@ -9,17 +9,17 @@ try {
await build({
bundle: true,
sourcemap: true,
format: "cjs",
format: 'cjs',
// target: "node",
external: ["@nativescript/core"],
entryPoints: [path.join(__dirname, "src", "index.ts")],
outdir: path.join(__dirname, "dist"),
external: ['@nativescript/core'],
entryPoints: [path.join(__dirname, 'src', 'index.ts')],
outdir: path.join(__dirname, 'dist'),
// outExtension: { ".js": ".mjs" },
define: {
__VUE_OPTIONS_API__: true,
__VUE_PROD_DEVTOOLS__: true
}
__VUE_PROD_DEVTOOLS__: true,
},
});
} catch {
process.exitCode = 1;
}
}
3 changes: 3 additions & 0 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
extends: ['@commitlint/config-conventional'],
};
10 changes: 10 additions & 0 deletions demo/App_Resources/iOS/Podfile
Original file line number Diff line number Diff line change
@@ -1 +1,11 @@
platform :ios, '13.0'

pod 'FPSCounter', '~> 4.1'

post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '13.0'
end
end
end
4 changes: 3 additions & 1 deletion demo/App_Resources/iOS/build.xcconfig
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
// You can add custom settings here
// for example you can uncomment the following line to force distribution code signing
// CODE_SIGN_IDENTITY = iPhone Distribution
// CODE_SIGN_IDENTITY = iPhone Distribution
// To build for device with XCode you need to specify your development team.
// DEVELOPMENT_TEAM = YOUR_TEAM_ID;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;

DEVELOPMENT_TEAM = 3462C7DLZZ

IPHONEOS_DEPLOYMENT_TARGET = 13.0;
10 changes: 3 additions & 7 deletions demo/app/app.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
import { createApp } from "vue";
import { createApp } from 'nativescript-vue';

// @ts-ignore
global.window = global;
// import Home from './components/Home.vue'

import App from "./components/demo_ListView.vue";
import App from './components/demo_ListView.vue';

createApp(App)
.use(() => {
console.log("test1");
console.log('test1');
})
.start();
14 changes: 5 additions & 9 deletions demo/app/components/Bench.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default {
show: false,
iter: 0,

times: [],
times: [] as number[],
};
},
methods: {
Expand All @@ -24,11 +24,11 @@ export default {

if (this.iter < 5) {
setTimeout(() => {
console.log("hide now");
console.log('hide now');
this.show = false;

setTimeout(() => {
console.log("and. start.");
console.log('and. start.');
this.start();
}, 5000);
}, 2000);
Expand Down Expand Up @@ -62,12 +62,8 @@ export default {
/>

<template v-if="show">
<Label
v-for="i in 2000"
:key="this.iter + 'item' + i"
text="Hello World"
/>
<Label @loaded="end" :key="this.iter + 'end'" text="End" />
<Label v-for="i in 2000" :key="iter + 'item' + i" text="Hello World" />
<Label @loaded="end" :key="iter + 'end'" text="End" />
</template>
</GridLayout>
</Page>
Expand Down
12 changes: 6 additions & 6 deletions demo/app/components/GH1010.vue
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
<!-- https://github.com/nativescript-vue/nativescript-vue/issues/1010 -->
<script lang="ts" setup>
import { ref } from "vue";
import { EventData } from '@nativescript/core';
import { ref } from 'nativescript-vue';

const tapCount = ref(0);

function onTap() {
tapCount.value++;
console.trace("Tapped!", tapCount.value);
console.trace('Tapped!', tapCount.value);
}

function onLoaded(args) {
console.log("STACK LOADED")
function onLoaded(_args: EventData) {
console.log('STACK LOADED');
}
</script>

<template>
<StackLayout @loaded="onLoaded" @LOADED="onLoaded" @lOaD="onLoaded">
<Label>Tap count: {{ tapCount }}</Label>
<Button @tap="(tapCount = 0)">Reset</Button>
<Button @tap="tapCount = 0">Reset</Button>

<!-- correct: fires only once -->
<Button @tap="onTap">Tap: Button</Button>
Expand All @@ -26,4 +27,3 @@ function onLoaded(args) {
<Label @tap="onTap">Tap: Label</Label>
</StackLayout>
</template>

10 changes: 5 additions & 5 deletions demo/app/components/GH1010.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
appId: org.nativescript.demo
---
- launchApp
- assertVisible: "Tap Count: 0"
- tapOn: "Tap: Button"
- assertVisible: "Tap Count: 1"
- tapOn: "Tap: Label"
- assertVisible: "Tap Count: 2"
- assertVisible: 'Tap Count: 0'
- tapOn: 'Tap: Button'
- assertVisible: 'Tap Count: 1'
- tapOn: 'Tap: Label'
- assertVisible: 'Tap Count: 2'
2 changes: 1 addition & 1 deletion demo/app/components/GH1011.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
text="Test text"
class="text-2xl m-6"
backgroundColor="yellow"
style="background-color: red;"
style="background-color: red"
></Label>
</template>
15 changes: 9 additions & 6 deletions demo/app/components/GH1012.vue
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
<script lang="ts" setup>
const wait = ms => new Promise(resolve => setTimeout(resolve, ms));
import type { Button, EventData } from '@nativescript/core';
import { Color } from '@nativescript/core';

async function animateIn(args) {
console.log("ANIMATE")
const wait = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms));

async function animateIn(args: EventData) {
console.log('ANIMATE');
await wait(1);
const view = args.object;
view.color = "green";
const view = args.object as Button;
view.color = new Color('green');
view.scaleX = 0;
view.scaleY = 0;

Expand All @@ -19,7 +22,7 @@ async function animateIn(args) {
duration: 3000,
})
.then(() => {
view.color = "red";
view.color = new Color('red');
})
.catch((err) => console.log(err));
}
Expand Down
26 changes: 16 additions & 10 deletions demo/app/components/Home.vue
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
<script setup lang="ts">
import Test from "./Test.vue";
import { goHome } from "~/composables/goHome";
import { onUnmounted } from "vue";
import { ListItem } from "../../../src";
import { ListItem, onMounted, onUnmounted } from 'nativescript-vue';
import { goHome } from '~/composables/goHome';
import Test from './Test.vue';

defineProps<{
depth?: number;
}>();
defineProps({
depth: {
type: Number,
default: 0,
},
});

const message = "Hello World!";
const message = 'Hello World!!';

interface Test {
name: string;
Expand All @@ -25,11 +27,15 @@ const items: Test[] = Array(1000)
}));

function selector(item: ListItem<Test>) {
return item.even ? "default" : "odd";
return item.even ? 'default' : 'odd';
}

onMounted(() => {
console.log('MOUNTED HOME');
});

onUnmounted(() => {
console.log("UNMOUNTED HOME");
console.log('UNMOUNTED HOME');
});
</script>

Expand Down
2 changes: 1 addition & 1 deletion demo/app/components/Test.vue
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<template>
<Label>Hello I'm a label...</Label>
<Label>Hello I'm a label...</Label>
</template>
Loading