8000 Merge branch 'master' into frame-and-router · jprando/nativescript-vue@4bb3103 · GitHub
[go: up one dir, main page]

Skip to content

Commit 4bb3103

Browse files
authored
Merge branch 'master' into frame-and-router
2 parents af7f50b + e72f597 commit 4bb3103

File tree

16 files changed

+372
-52
lines changed

16 files changed

+372
-52
lines changed

CHANGELOG.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,37 @@
1+
<a name="2.0.0-alpha.3"></a>
2+
# [2.0.0-alpha.3](https://github.com/nativescript-vue/nativescript-vue/compare/v2.0.0-alpha.2...v2.0.0-alpha.3) (2018-09-12)
3+
4+
5+
### Bug Fixes
6+
7+
* canBeLeftOpenTag in defaultViewMeta instead of canBeLeftOpen ([#308](https://github.com/nativescript-vue/nativescript-vue/issues/308)) ([1b63f5b](https://github.com/nativescript-vue/nativescript-vue/commit/1b63f5b))
8+
* provide explicit type to data ([#305](https://github.com/nativescript-vue/nativescript-vue/issues/305)) ([4389228](https://github.com/nativescript-vue/nativescript-vue/commit/4389228))
9+
10+
11+
12+
<a name="2.0.0-alpha.2"></a>
13+
# [2.0.0-alpha.2](https://github.com/nativescript-vue/nativescript-vue/compare/v2.0.0-alpha.1...v2.0.0-alpha.2) (2018-08-08)
14+
15+
16+
### Bug Fixes
17+
18+
* **typings:** add proper typings ([#289](https://github.com/nativescript-vue/nativescript-vue/issues/289)) ([bb265bd](https://github.com/nativescript-vue/nativescript-vue/commit/bb265bd))
19+
* **typings:** declare explicitly the location of the TS typings ([259640e](https://github.com/nativescript-vue/nativescript-vue/commit/259640e))
20+
* ensre default is exported after bundling ([#301](https://github.com/nativescript-vue/nativescript-vue/issues/301)) ([7e39039](https://github.com/nativescript-vue/nativescript-vue/commit/7e39039))
21+
* re-adding <keep-alive> elements to view ([#291](https://github.com/nativescript-vue/nativescript-vue/issues/291)) ([a953db5](https://github.com/nativescript-vue/nativescript-vue/commit/a953db5)), closes [#220](https://github.com/nativescript-vue/nativescript-vue/issues/220) [#220](https://github.com/nativescript-vue/nativescript-vue/issues/220)
22+
23+
24+
25+
<a name="2.0.0-alpha.1"></a>
26+
# [2.0.0-alpha.1](https://github.com/nativescript-vue/nativescript-vue/compare/v2.0.0-alpha.0...v2.0.0-alpha.1) (2018-07-15)
27+
28+
29+
### Bug Fixes
30+
31+
* action bar rendering - issue [#276](https://github.com/nativescript-vue/nativescript-vue/issues/276) ([#278](https://github.com/nativescript-vue/nativescript-vue/issues/278)) ([db6df39](https://github.com/nativescript-vue/nativescript-vue/commit/db6df39))
32+
33+
34+
135
<a name="2.0.0-alpha.0"></a>
236
# [2.0.0-alpha.0](https://github.com/nativescript-vue/nativescript-vue/compare/v1.4.0-alpha.0...v2.0.0-alpha.0) (2018-07-04)
337

README.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,20 @@ NativeScript-Vue is an MIT-licensed open source project made possible by our spo
3131
<tbody>
3232
<tr>
3333
<td align="center" valign="middle">
34-
<a href="https://www.privateinternetaccess.com/" target="_blank">
34+
<a href="https://www.privateinternetaccess.com/?source=nativescript-vue-github" target="_blank">
3535
<img width="300px" src="https://art.nativescript-vue.org/sponsors/pia.png">
3636
</a>
3737
</td>
3838
<td align="center" valign="middle">
39-
<a href="https://kiwiirc.com/" target="_blank">
39+
<a href="https://kiwiirc.com/?source=nativescript-vue-github" target="_blank">
4040
<img height="50px" src="https://art.nativescript-vue.org/sponsors/kiwiirc.png?v=1">
4141
</a>
4242
</td>
43+
<td align="center" valign="middle">
44+
<a href="https://www.progress.com/?source=nativescript-vue-github" target="_blank">
45+
<img height="50px" src="https://art.nativescript-vue.org/sponsors/progress.png">
46+
</a>
47+
</td>
4348
</tr><tr></tr>
4449
</tbody>
4550
</table>

__tests__/renderer/ViewNode.test.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,8 @@ describe('ViewNode', () => {
241241
expect(prevChildNode.nextSibling).toEqual(nextChildNode)
242242
expect(nextChildNode.prevSibling).toEqual(prevChildNode)
243243
expect(childNode.parentNode).toBeNull()
244+
expect(childNode.prevSibling).toBeNull()
245+
expect(childNode.nextSibling).toBeNull()
244246
})
245247

246248
test('nativeView can be set once', () => {

build/releaser.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ inquirer
2222
name: 'releaseTag',
2323
type: 'input',
2424
message: 'Input release tag',
25+
default: 'next',
2526
when: ({bump}) => bump === 'custom'
2627
}
2728
])
@@ -37,8 +38,8 @@ inquirer
3738
type: 'confirm',
3839
message: 'Are you sure you want to release v' + v.version + (res.releaseTag ? ' with tag: ' + res.releaseTag: ''),
3940
default: false
40-
}]).then((res) => {
41-
if (res.confirmed) {
41+
}]).then(({confirmed}) => {
42+
if (confirmed) {
4243
return resolve({
4344
version: v.version,
4445
releaseTag: res.releaseTag
@@ -50,6 +51,7 @@ inquirer
5051
})
5152
.then(({version, releaseTag}) => {
5253
console.log(blue(`Releasing v${version}...`))
54+
console.log(blue(`With tag: ${releaseTag}`))
5355
console.log(blue('-'.repeat(80)))
5456

5557
const buildMessage = `build: ${version}`
@@ -60,7 +62,7 @@ inquirer
6062
echo "Starting build..."
6163
VERSION=${version} npm run build
6264
echo "Build Successful. Updating packages"
63-
cd packages/nativescript-vue-template-compiler && npm version ${version} && npm publish
65+
cd packages/nativescript-vue-template-compiler && npm version ${version} && npm publish${releaseTag ? ' --tag ' + releaseTag : ''}
6466
git add -A
6567
git add -f dist/index.js dist/index.js.map packages/nativescript-vue-template-compiler/index.js
6668
git commit --no-verify -m "${buildMessage}"

index.d.ts

Lines changed: 57 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,58 @@
1-
// Typings for NativeScript-Vue
2-
declare module 'nativescript-vue' {
3-
// import vue.js typings
4-
import Vue from 'vue';
5-
6-
// creat a nativescript vue class that extends vue.js
7-
class NativeScriptVue extends Vue {
8-
/**
9-
* Registers NativeScript Plugin.
10-
* @param elementName Name of the element to use in your template
11-
* @param resolver function to regi 1C6A ster the element
12-
* @param meta meta associated with the element
13-
*/
14-
static registerElement(elementName: string, resolver: Function, meta?: any): void;
15-
16-
/**
17-
* starts the nativescript application
18-
*/
19-
$run(): void
20-
}
21-
22-
export = NativeScriptVue;
1+
// import vue.js typings
2+
// import Vue from 'vue';
3+
import { Vue, VueConstructor } from 'vue/types/vue'
4+
import { Page, NavigationEntry, Size } from 'tns-core-modules/ui/frame/frame'
5+
import { View } from 'tns-core-modules/ui/core/view'
6+
7+
export type navigateTo = (
8+
component: VueConstructor,
9+
options?: NavigationEntry,
10+
cb?: () => Page,
11+
) => Promise<Page>;
12+
13+
export interface ModalOptions {
14+
context?: any;
15+
fullscreen?: boolean;
16+
}
17+
18+
// create a nativescript vue class that extends vue.js
19+
export interface NativeScriptVue<V = View> extends Vue {
20+
nativeView: V
21+
22+
$navigateTo: navigateTo
23+
$navigateBack: () => void
24+
25+
$modal?: { close: (data?: any) => Promise<typeof data> };
26+
27+
/**
28+
* Open a modal using a component
29+
* @param {typeof Vue} component
30+
* @param {ModalOptions} options
31+
* @returns {any}
32+
*/
33+
$showModal: (component: typeof Vue, options?: ModalOptions) => Promise<any>;
34+
35+
/**
36+
* starts the nativescript application
37+
*/
38+
$start: () => void
39+
}
40+
41+
export interface NativeScriptVueConstructor extends VueConstructor<NativeScriptVue> {
42+
navigateTo: navigateTo
43+
navigateBack: () => void
2344
}
45+
46+
export const NativeScriptVue: NativeScriptVueConstructor
47+
48+
export default NativeScriptVue;
49+
50+
// export as namespace NativeScriptVue;
51+
52+
/**
53+
* Registers NativeScript Plugin.
54+
* @param elementName Name of the element to use in your template
55+
* @param resolver function to register the element
56+
* @param meta meta associated with the element
57+
*/
58+
export function registerElement(elementName: string, resolver: Function, meta?: any): void;

package.json

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
{
22
"name": "nativescript-vue",
3-
"version": "2.0.0-alpha.0",
3+
"version": "2.0.0-alpha.3",
44
"description": "NativeScript and Vue integration",
55
"main": "dist/index.js",
66
"files": [
77
"dist/index.js",
88
"index.d.ts"
99
],
10+
"typings": "index.d.ts",
1011
"scripts": {
1112
"test": "jest",
1213
"tdd": "jest --watch",
@@ -38,8 +39,8 @@
3839
"homepage": "https://github.com/rigor789/nativescript-vue#readme",
3940
"nativescript": {
4041
"platforms": {
41-
"android": "4.1.2",
42-
"ios": "4.1.0"
42+
"android": "4.2.0",
43+
"ios": "4.2.0"
4344
},
4445
"plugin": {
4546
"vue": "true",
@@ -77,8 +78,7 @@
7778
"set-value": "^2.0.0",
7879
"tns-core-modules": "4.1.0",
7980
"util-inspect": "^0.1.8",
80-
"vue": "^2.5.16",
81-
"vue-router": "file:../vue-router/"
81+
"vue": "^2.5.17"
8282
},
8383
"jest": {
8484
"verbose": true,
@@ -95,7 +95,8 @@
9595
"modulePathIgnorePatterns": [
9696
"<rootDir>/samples"
9797
],
98-
"collectCoverage": true
98+
"collectCoverage": true,
99+
"testURL": "http://localhost"
99100
},
100101
"prettier": {
101102
"semi": false,

packages/nativescript-vue-template-compiler/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "nativescript-vue-template-compiler",
3-
"version": "2.0.0-alpha.0",
3+
"version": "2.0.0-alpha.3",
44
"description": "template compiler for nativescript-vue",
55
"main": "index.js",
66
"repository": {

platform/nativescript/element-registry.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const defaultViewMeta = {
88
skipAddToDom: false,
99
isUnaryTag: false,
1010
tagNamespace: '',
11-
canBeLeftOpen: false,
11+
canBeLeftOpenTag: false,
1212
model: null,
1313
component: null
1414
}

platform/nativescript/framework.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import application from 'tns-core-modules/application'
99
import Vue from './runtime/index'
1010
import ModalPlugin from './plugins/modal-plugin'
1111
import NavigatorPlugin from './plugins/navigator-plugin'
12-
import mode from './plugins/router-plugin'
1312

1413
import { setVue } from './util'
1514

@@ -72,9 +71,10 @@ global.__onLiveSyncCore = () => {
7271
}
7372
}
7473

75-
Object.assign(Vue, {
76-
Vue,
77-
mode
78-
})
74+
// Fix a rollup problem which does not define
75+
// module.export.default = Vue
76+
// so a `import Vue from 'nativescript-vue'` will
77+
// fail from a Typescript file
78+
Vue.default = Vue
7979

8080
export default Vue

platform/nativescript/renderer/ViewNode.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,12 @@ export default class ViewNode {
251251
childNode.nextSibling.prevSibling = childNode.prevSibling
252252
}
253253

254+
// reset the prevSibling and nextSibling. If not, a keep-alived component will
255+
// still have a filled nextSibling attribute so vue will not
256+
// insert the node again to the parent. See #220
257+
childNode.prevSibling = null
258+
childNode.nextSibling = null
259+
254260
this.childNodes = this.childNodes.filter(node => node !== childNode)
255261

256262
viewUtil.removeChild(this, childNode)

0 commit comments

Comments
 (0)
0