Skip to content

Commit fc40152

Browse files
fix(vue): make update work
1 parent 0030be8 commit fc40152

File tree

9 files changed

+369
-372
lines changed

9 files changed

+369
-372
lines changed

packages/vue/package-lock.json

Lines changed: 303 additions & 309 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/vue/package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,13 @@
6161
"prettier": "^2.8.3",
6262
"rimraf": "^3.0.2",
6363
"rollup": "^4.2.0",
64-
"typescript": "^4.7.3",
65-
"vue": "3.2.47",
64+
"typescript": "^5.7.3",
65+
"vue": "3.4.38",
6666
"vue-router": "^4.0.16"
6767
},
6868
"dependencies": {
6969
"@ionic/core": "^8.4.2",
70+
"@stencil/vue-output-target": "0.9.2",
7071
"ionicons": "^7.0.0"
7172
},
7273
"vetur": {

packages/vue/src/components/IonApp.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,16 @@ export const IonApp = /*@__PURE__*/ defineComponent((_, { attrs, slots }) => {
99
return h(
1010
"ion-app",
1111
{
12+
name: "IonApp",
1213
...attrs,
1314
},
1415
[slots.default && slots.default(), ...userComponents.value]
1516
);
1617
};
18+
}, {
19+
name: "IonApp",
1720
});
1821

19-
IonApp.name = "IonApp";
20-
2122
/**
2223
* When rendering user components inside of
2324
* ion-modal, or ion-popover the component

packages/vue/src/components/IonBackButton.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export const IonBackButton = /*@__PURE__*/ defineComponent(
3434
slots.default && slots.default()
3535
);
3636
};
37+
}, {
38+
name: "IonBackButton",
3739
}
3840
);
39-
40-
IonBackButton.name = "IonBackButton";

packages/vue/src/components/IonNav.ts

Lines changed: 32 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -21,37 +21,36 @@ export const IonNav = /*@__PURE__*/ defineComponent((props) => {
2121
return () => {
2222
return h("ion-nav", { ...props, delegate }, views.value);
2323
};
24+
}, {
25+
name: "IonNav",
26+
/**
27+
* The default values follow what is defined at
28+
* https://ionicframework.com/docs/api/nav#properties
29+
* otherwise the default values on the Web Component
30+
* may be overridden. For example, if the default animated value
31+
* is not `true` below, then Vue would default the prop to `false`
32+
* which would override the Web Component default of `true`.
33+
*/
34+
props: {
35+
animated: {
36+
type: Boolean,
37+
default: true,
38+
},
39+
animation: {
40+
type: Function,
41+
default: undefined,
42+
},
43+
root: {
44+
type: [Function, Object, String],
45+
default: undefined,
46+
},
47+
rootParams: {
48+
type: Object,
49+
default: undefined,
50+
},
51+
swipeGesture: {
52+
type: Boolean,
53+
default: undefined,
54+
},
55+
}
2456
});
25-
26-
IonNav.name = "IonNav";
27-
28-
/**
29-
* The default values follow what is defined at
30-
* https://ionicframework.com/docs/api/nav#properties
31-
* otherwise the default values on the Web Component
32-
* may be overridden. For example, if the default animated value
33-
* is not `true` below, then Vue would default the prop to `false`
34-
* which would override the Web Component default of `true`.
35-
*/
36-
IonNav.props = {
37-
animated: {
38-
type: Boolean,
39-
default: true,
40-
},
41-
animation: {
42-
type: Function,
43-
default: undefined,
44-
},
45-
root: {
46-
type: [Function, Object, String],
47-
default: undefined,
48-
},
49-
rootParams: {
50-
type: Object,
51-
default: undefined,
52-
},
53-
swipeGesture: {
54-
type: Boolean,
55-
default: undefined,
56-
},
57-
};

packages/vue/src/components/IonRouterOutlet.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export const IonRouterOutlet = /*@__PURE__*/ defineComponent({
4444
let previousMatchedRouteRef: Ref | undefined;
4545
let previousMatchedPath: string | undefined;
4646

47-
provide(viewDepthKey, depth + 1);
47+
provide(viewDepthKey, depth + 1 as 0);
4848
provide(matchedRouteKey, matchedRouteRef);
4949

5050
const ionRouterOutlet = ref();

packages/vue/src/components/IonTabBar.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export const IonTabBar = defineComponent({
4343
data() {
4444
return {
4545
tabState: {
46-
activeTab: undefined,
46+
activeTab: undefined as string | undefined,
4747
tabs: {},
4848
/**
4949
* Passing this prop to each tab button
@@ -52,7 +52,7 @@ export const IonTabBar = defineComponent({
5252
*/
5353
hasRouterOutlet: false,
5454
},
55-
tabVnodes: [],
55+
tabVnodes: [] as VNode[],
5656
/* eslint-disable @typescript-eslint/no-empty-function */
5757
_tabsWillChange: { type: Function, default: () => {} },
5858
_tabsDidChange: { type: Function, default: () => {} },

packages/vue/src/vue-component-lib/overlays.ts

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
import { defineComponent, h, ref, VNode, onMounted } from 'vue';
1+
/* eslint-disable no-prototype-builtins */
2+
import type { VNode, ComponentOptions } from 'vue';
3+
import { defineComponent, h, ref, onMounted } from 'vue';
24

35
// TODO(FW-2969): types
46

@@ -10,6 +12,20 @@ const EMPTY_PROP = Symbol();
1012
const DEFAULT_EMPTY_PROP = { default: EMPTY_PROP };
1113

1214
export const defineOverlayContainer = <Props extends object>(name: string, defineCustomElement: () => void, componentProps: string[] = [], hasDelegateHost?: boolean, controller?: any) => {
15+
const options: ComponentOptions = {
16+
name,
17+
props: {
18+
'isOpen': DEFAULT_EMPTY_PROP
19+
}
20+
}
21+
22+
componentProps.forEach(componentProp => {
23+
options.props[componentProp] = DEFAULT_EMPTY_PROP;
24+
});
25+
26+
if (controller !== undefined) {
27+
options.emits = ['willPresent', 'didPresent', 'willDismiss', 'didDismiss'];
28+
}
1329

1430
const createControllerComponent = () => {
1531
return defineComponent<Props & OverlayProps>((props, { slots, emit }) => {
@@ -77,7 +93,7 @@ export const defineOverlayContainer = <Props extends object>(name: string, defin
7793
return;
7894
}
7995

80-
let restOfProps: any = {};
96+
const restOfProps: Record<string, any> = {};
8197

8298
/**
8399
* We can use Object.entries here
@@ -130,7 +146,7 @@ export const defineOverlayContainer = <Props extends object>(name: string, defin
130146
}
131147
);
132148
}
133-
});
149+
}, options);
134150
};
135151
const createInlineComponent = () => {
136152
return defineComponent((props, { slots }) => {
@@ -147,7 +163,7 @@ export const defineOverlayContainer = <Props extends object>(name: string, defin
147163
});
148164

149165
return () => {
150-
let restOfProps: any = {};
166+
const restOfProps: Record<string, any> = {};
151167

152168
/**
153169
* We can use Object.entries here
@@ -187,24 +203,10 @@ export const defineOverlayContainer = <Props extends object>(name: string, defin
187203
(isOpen.value || restOfProps.keepContentsMounted || restOfProps.keepContentsMounted === '') ? renderChildren() : undefined
188204
)
189205
}
190-
});
206+
}, options);
191207
}
192208

193209
const Container = (controller !== undefined) ? createControllerComponent() : createInlineComponent();
194210

195-
Container.name = name;
196-
197-
Container.props = {
198-
'isOpen': DEFAULT_EMPTY_PROP
199-
};
200-
201-
componentProps.forEach(componentProp => {
202-
Container.props[componentProp] = DEFAULT_EMPTY_PROP;
203-
});
204-
205-
if (controller !== undefined) {
206-
Container.emits = ['willPresent', 'didPresent', 'willDismiss', 'didDismiss'];
207-
}
208-
209211
return Container;
210212
}

packages/vue/tsconfig.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
"experimentalDecorators": true,
88
"esModuleInterop": true,
99
"lib": ["dom", "es2020"],
10-
"module": "es2015",
11-
"moduleResolution": "node",
10+
"module": "ES2020",
11+
"moduleResolution": "bundler",
1212
"noImplicitAny": true,
1313
"noImplicitReturns": false,
1414
"noUnusedLocals": true,

0 commit comments

Comments
 (0)