Skip to content

Commit eb725fc

Browse files
fix(vue): update Stencil Vue output target (#30159)
This patch includes some necessary updates for `@stencil/[email protected]`: - we started to export Stencils helpers as runtime via `@stencil/vue-output-target/runtime` similar to what we did in React - this version requires some updates to Vue and TypeScript as well - adjustments related to that update
1 parent 0030be8 commit eb725fc

File tree

16 files changed

+857
-811
lines changed

16 files changed

+857
-811
lines changed

packages/angular/src/directives/proxies.ts

Lines changed: 85 additions & 85 deletions
Large diffs are not rendered by default.

packages/angular/standalone/src/directives/proxies.ts

Lines changed: 74 additions & 74 deletions
Large diffs are not rendered by default.

packages/vue/package-lock.json

Lines changed: 390 additions & 267 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: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,9 @@
5252
"@babel/types": "^7.18.4",
5353
"@ionic/eslint-config": "^0.3.0",
5454
"@ionic/prettier-config": "^2.0.0",
55+
"@rollup/plugin-node-resolve": "^16.0.0",
5556
"@rollup/plugin-typescript": "^11.1.5",
57+
"@stencil/vue-output-target": "0.9.4",
5658
"@typescript-eslint/eslint-plugin": "^5.48.2",
5759
"@typescript-eslint/parser": "^5.48.2",
5860
"change-case": "^4.1.1",
@@ -61,8 +63,8 @@
6163
"prettier": "^2.8.3",
6264
"rimraf": "^3.0.2",
6365
"rollup": "^4.2.0",
64-
"typescript": "^4.7.3",
65-
"vue": "3.2.47",
66+
"typescript": "^5.7.3",
67+
"vue": "3.4.38",
6668
"vue-router": "^4.0.16"
6769
},
6870
"dependencies": {

packages/vue/rollup.config.mjs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1+
import resolve from '@rollup/plugin-node-resolve';
12
import typescript from '@rollup/plugin-typescript';
3+
24
const external = ['vue', 'vue-router'];
35

46
export default {
@@ -12,6 +14,13 @@ export default {
1214
sourcemap: true
1315
},
1416
],
15-
plugins: [typescript()],
16-
external: id => external.includes(id) || id.startsWith('@ionic/core') || id.startsWith('ionicons')
17+
plugins: [
18+
typescript(),
19+
resolve()
20+
],
21+
external: (
22+
id => external.includes(id) ||
23+
id.startsWith('@ionic/core') ||
24+
id.startsWith('ionicons')
25+
)
1726
};

packages/vue/scripts/copy-overlays.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ function generateOverlays() {
3737
let componentImports = [];
3838
let componentDefinitions = [];
3939

40-
components.forEach(component => {
40+
components.sort((a, b) => a.tag.localeCompare(b.tag)).forEach(component => {
4141
const docsBlock = getDocsBlock(component.tag);
4242
const props = getPropsFromDocsBlock(docsBlock);
4343

@@ -57,13 +57,12 @@ export const ${component.name} = /*@__PURE__*/ defineOverlayContainer<JSX.${comp
5757
* Changes made to this file will be overwritten on build.
5858
*/
5959
60-
import {
60+
import type {
6161
JSX,
6262
} from '@ionic/core/components';
63-
6463
${componentImports.join('\n')}
6564
66-
import { defineOverlayContainer } from '../vue-component-lib/overlays';
65+
import { defineOverlayContainer } from '../utils/overlays';
6766
${componentDefinitions.join('')}
6867
`;
6968

packages/vue/src/components/IonApp.ts

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,24 @@ import type { VNode } from "vue";
33
import { h, defineComponent, shallowRef } from "vue";
44

55
const userComponents = shallowRef([]);
6-
export const IonApp = /*@__PURE__*/ defineComponent((_, { attrs, slots }) => {
7-
defineCustomElement();
8-
return () => {
9-
return h(
10-
"ion-app",
11-
{
12-
...attrs,
13-
},
14-
[slots.default && slots.default(), ...userComponents.value]
15-
);
16-
};
17-
});
18-
19-
IonApp.name = "IonApp";
6+
export const IonApp = /*@__PURE__*/ defineComponent(
7+
(_, { attrs, slots }) => {
8+
defineCustomElement();
9+
return () => {
10+
return h(
11+
"ion-app",
12+
{
13+
name: "IonApp",
14+
...attrs,
15+
},
16+
[slots.default && slots.default(), ...userComponents.value]
17+
);
18+
};
19+
},
20+
{
21+
name: "IonApp",
22+
}
23+
);
2024

2125
/**
2226
* When rendering user components inside of

packages/vue/src/components/IonBackButton.ts

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

packages/vue/src/components/IonNav.ts

Lines changed: 50 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -4,54 +4,56 @@ import { defineComponent, h, shallowRef } from "vue";
44

55
import { VueDelegate } from "../framework-delegate";
66

7-
export const IonNav = /*@__PURE__*/ defineComponent((props) => {
8-
defineCustomElement();
9-
const views = shallowRef([]);
7+
export const IonNav = /*@__PURE__*/ defineComponent(
8+
(props) => {
9+
defineCustomElement();
10+
const views = shallowRef([]);
1011

11-
/**
12-
* Allows us to create the component
13-
* within the Vue application context.
14-
*/
15-
const addView = (component: VNode) =>
16-
(views.value = [...views.value, component]);
17-
const removeView = (component: VNode) =>
18-
(views.value = views.value.filter((cmp) => cmp !== component));
12+
/**
13+
* Allows us to create the component
14+
* within the Vue application context.
15+
*/
16+
const addView = (component: VNode) =>
17+
(views.value = [...views.value, component]);
18+
const removeView = (component: VNode) =>
19+
(views.value = views.value.filter((cmp) => cmp !== component));
1920

20-
const delegate = VueDelegate(addView, removeView);
21-
return () => {
22-
return h("ion-nav", { ...props, delegate }, views.value);
23-
};
24-
});
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,
21+
const delegate = VueDelegate(addView, removeView);
22+
return () => {
23+
return h("ion-nav", { ...props, delegate }, views.value);
24+
};
5625
},
57-
};
26+
{
27+
name: "IonNav",
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+
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+
},
58+
}
59+
);

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();

0 commit comments

Comments
 (0)