Skip to content

Commit b670e8d

Browse files
committed
chore: new svelte
1 parent a028348 commit b670e8d

5 files changed

Lines changed: 18 additions & 14 deletions

File tree

kitchen-sink/svelte/src/app.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { mount } from 'svelte';
12
import Framework7 from 'framework7/lite/bundle';
23
import Framework7Svelte from 'framework7-svelte';
34
import App from './app.svelte';
@@ -24,8 +25,8 @@ if (document.location.href.includes('example-preview')) {
2425
Framework7.use(Framework7Svelte);
2526

2627
// Init Svelte App
27-
const app = new App({
28-
target: document.getElementById('app'),
28+
const app = mount(App, {
29+
target: document.querySelector('#app'),
2930
});
3031

3132
export default app;

kitchen-sink/svelte/vite.config.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { svelte } from '@sveltejs/vite-plugin-svelte';
55
const buildFolder = process.env.NODE_ENV === 'production' ? 'packages' : 'build';
66

77
export default {
8-
plugins: [svelte({ onwarn() {} })],
8+
plugins: [svelte({ extensions: ['.svelte'], onwarn() {} })],
99
root: './',
1010
base: '',
1111
publicDir: path.resolve(__dirname, 'public'),
@@ -28,7 +28,10 @@ export default {
2828
__dirname,
2929
`../../${buildFolder}/core/framework7-lite.esm.js`,
3030
),
31-
'framework7-svelte': path.resolve(__dirname, `../../${buildFolder}/svelte`),
31+
'framework7-svelte': path.resolve(
32+
__dirname,
33+
`../../${buildFolder}/svelte/framework7-svelte.js`,
34+
),
3235
},
3336
},
3437
};

src/svelte/shared/mixins.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { isStringProp } from './utils.js';
22

3-
export function colorClasses(props) {
3+
export function colorClasses(props = {}) {
44
const { color, textColor, bgColor, borderColor, rippleColor, dark } = props;
55

66
return {
@@ -13,7 +13,7 @@ export function colorClasses(props) {
1313
};
1414
}
1515

16-
export function routerAttrs(props) {
16+
export function routerAttrs(props = {}) {
1717
const {
1818
force,
1919
reloadCurrent,
@@ -52,7 +52,7 @@ export function routerAttrs(props) {
5252
'data-open-in': isStringProp(openIn) ? openIn : undefined,
5353
};
5454
}
55-
export function routerClasses(props) {
55+
export function routerClasses(props = {}) {
5656
const { back, linkBack, external, preventRouter } = props;
5757

5858
return {
@@ -62,7 +62,7 @@ export function routerClasses(props) {
6262
};
6363
}
6464

65-
export function actionsAttrs(props) {
65+
export function actionsAttrs(props = {}) {
6666
const {
6767
searchbarEnable,
6868
searchbarDisable,
@@ -129,7 +129,7 @@ export function actionsAttrs(props) {
129129
(isStringProp(cardOpen) && cardOpen) || (isStringProp(cardClose) && cardClose) || undefined,
130130
};
131131
}
132-
export function actionsClasses(props) {
132+
export function actionsClasses(props = {}) {
133133
const {
134134
searchbarEnable,
135135
searchbarDisable,

src/svelte/shared/use-icon.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export const useIcon = (props = {}) => {
1+
export const useIcon = (restProps = {}) => {
22
const {
33
icon,
44
iconMaterial,
@@ -10,7 +10,7 @@ export const useIcon = (props = {}) => {
1010
iconBadge,
1111
badgeColor,
1212
iconBadgeColor,
13-
} = props;
13+
} = restProps;
1414
if (icon || iconMaterial || iconF7 || iconMd || iconIos) {
1515
return {
1616
props: {

src/svelte/shared/use-tab.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22
import { onMount, onDestroy } from 'svelte';
33
import { f7, f7ready } from './f7.js';
44

5-
export const useTab = (getEl, emit) => {
5+
export const useTab = (getEl, restProps = {}) => {
66
const onTabShow = (el) => {
77
if (getEl() !== el) return;
8-
emit('tabShow', [el]);
8+
restProps.tabShow?.(el);
99
};
1010
const onTabHide = (el) => {
1111
if (getEl() !== el) return;
12-
emit('tabHide', [el]);
12+
restProps.tabHide?.(el);
1313
};
1414
const attachEvents = () => {
1515
if (!getEl()) return;

0 commit comments

Comments
 (0)