Skip to content

Commit c2039a2

Browse files
TommertomTommertom
authored andcommitted
Prettier
1 parent e6ba55c commit c2039a2

File tree

275 files changed

+61100
-62617
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

275 files changed

+61100
-62617
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
All notable changes to this project will be documented in this file.
44

5+
## 0.5.86
6+
7+
- added prettier and applied it to the files
8+
59
## 0.5.85
610

711
- fix as per discord suggestion https://discord.com/channels/520266681499779082/1049388501629681675/1264201865231339520

components/IonNav.svelte

Lines changed: 55 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,73 +1,73 @@
11
<script>
2-
import { onMount } from "svelte";
2+
import { onMount } from 'svelte';
33
4-
/**
5-
* The root component of a Svelte app.
6-
* @type {SvelteComponent}
7-
*/
8-
export let root;
4+
/**
5+
* The root component of a Svelte app.
6+
* @type {SvelteComponent}
7+
*/
8+
export let root;
99
10-
/**
11-
* Whether or not the component is animated.
12-
* @type {boolean|undefined}
13-
*/
14-
export let animated = true;
10+
/**
11+
* Whether or not the component is animated.
12+
* @type {boolean|undefined}
13+
*/
14+
export let animated = true;
1515
16-
/**
17-
* An animation function that takes a base element and optional options and returns an Animation object.
18-
* @type {((baseEl: any, opts?: any) => Animation)|undefined}
19-
*/
20-
export let animation;
16+
/**
17+
* An animation function that takes a base element and optional options and returns an Animation object.
18+
* @type {((baseEl: any, opts?: any) => Animation)|undefined}
19+
*/
20+
export let animation;
2121
22-
/**
23-
* Optional parameters for the root component.
24-
* @type {undefined|{[key: string]: any}}
25-
*/
26-
export let rootParams;
22+
/**
23+
* Optional parameters for the root component.
24+
* @type {undefined|{[key: string]: any}}
25+
*/
26+
export let rootParams;
2727
28-
/**
29-
* Whether or not swipe gesture is enabled.
30-
* @type {boolean|undefined}
31-
*/
32-
export let swipeGesture;
28+
/**
29+
* Whether or not swipe gesture is enabled.
30+
* @type {boolean|undefined}
31+
*/
32+
export let swipeGesture;
3333
34-
let ionNav;
35-
let rootComponent;
34+
let ionNav;
35+
let rootComponent;
3636
37-
const createHTMLCompFromSvelte = (component, componentProps = {}) => {
38-
const divWrapper = document.createElement("div");
39-
const contentID = "id" + Date.now();
40-
divWrapper.id = contentID;
37+
const createHTMLCompFromSvelte = (component, componentProps = {}) => {
38+
const divWrapper = document.createElement('div');
39+
const contentID = 'id' + Date.now();
40+
divWrapper.id = contentID;
4141
42-
let navContent = document.createElement("div");
42+
let navContent = document.createElement('div');
4343
44-
divWrapper.appendChild(navContent);
45-
document.body.appendChild(divWrapper);
44+
divWrapper.appendChild(navContent);
45+
document.body.appendChild(divWrapper);
4646
47-
const props = {
48-
...componentProps,
49-
};
47+
const props = {
48+
...componentProps
49+
};
5050
51-
const svelteComponent = new component({
52-
target: navContent,
53-
props,
54-
});
51+
const svelteComponent = new component({
52+
target: navContent,
53+
props
54+
});
5555
56-
return divWrapper;
57-
};
56+
return divWrapper;
57+
};
5858
59-
onMount(() => {
60-
rootComponent = createHTMLCompFromSvelte(root, {});
61-
});
59+
onMount(() => {
60+
rootComponent = createHTMLCompFromSvelte(root, {});
61+
});
6262
</script>
6363

6464
<ion-nav
65-
bind:this={ionNav}
66-
{animated}
67-
{animation}
68-
root-params={rootParams}
69-
swipe-gesture={swipeGesture}
70-
root={rootComponent}
71-
on:ionNavDidChange
72-
on:ionNavWillChange
65+
bind:this={ionNav}
66+
{animated}
67+
{animation}
68+
root-params={rootParams}
69+
swipe-gesture={swipeGesture}
70+
root={rootComponent}
71+
on:ionNavDidChange
72+
on:ionNavWillChange
7373
/>

components/IonPage.svelte

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,40 @@
11
<script>
2-
import { fly } from "svelte/transition";
2+
import { fly } from 'svelte/transition';
33
4-
import { onDestroy, onMount } from "svelte";
5-
// import { beforeNavigate } from "@sveltejs/kit/src/runtime/app/navigation"; // gives error - https://github.com/sveltejs/kit/issues/5879
4+
import { onDestroy, onMount } from 'svelte';
5+
// import { beforeNavigate } from "@sveltejs/kit/src/runtime/app/navigation"; // gives error - https://github.com/sveltejs/kit/issues/5879
66
7-
export const ionViewWillEnter = () => {};
8-
export const ionViewDidEnter = () => {};
9-
export const ionViewWillLeave = undefined; // unsupported as we cannot use beforeNavigate in npm library
10-
export const ionViewDidLeave = () => {};
7+
export const ionViewWillEnter = () => {};
8+
export const ionViewDidEnter = () => {};
9+
export const ionViewWillLeave = undefined; // unsupported as we cannot use beforeNavigate in npm library
10+
export const ionViewDidLeave = () => {};
1111
12-
// put export in front, copy to your $lib and then you have your custom IonPage!
13-
let animation = { in: { x: 1000, duration: 300 }, out: { x: -1000, duration: 300 } };
12+
// put export in front, copy to your $lib and then you have your custom IonPage!
13+
let animation = { in: { x: 1000, duration: 300 }, out: { x: -1000, duration: 300 } };
1414
15-
ionViewWillEnter();
15+
ionViewWillEnter();
1616
17-
// to include when beforeNavigate issue is fixed
18-
// beforeNavigate(() => {
19-
// ionViewWillLeave();
20-
// return true;
21-
// });
17+
// to include when beforeNavigate issue is fixed
18+
// beforeNavigate(() => {
19+
// ionViewWillLeave();
20+
// return true;
21+
// });
2222
23-
onMount(() => {
24-
ionViewDidEnter();
25-
});
23+
onMount(() => {
24+
ionViewDidEnter();
25+
});
2626
27-
onDestroy(() => {
28-
if (ionViewWillLeave != undefined) {
29-
console.warn(
30-
`ionViewWillLeave is not implemented - use beforeNavigate in $app/navigation. See https://github.com/sveltejs/kit/issues/5879`
31-
);
32-
}
27+
onDestroy(() => {
28+
if (ionViewWillLeave != undefined) {
29+
console.warn(
30+
`ionViewWillLeave is not implemented - use beforeNavigate in $app/navigation. See https://github.com/sveltejs/kit/issues/5879`
31+
);
32+
}
3333
34-
ionViewDidLeave();
35-
});
34+
ionViewDidLeave();
35+
});
3636
</script>
3737

3838
<div class="ion-page" in:fly={animation.in} out:fly={animation.out}>
39-
<slot />
39+
<slot />
4040
</div>

components/IonTabs.svelte

Lines changed: 77 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -1,96 +1,96 @@
11
<script>
2-
// @ts-nocheck
3-
import { navigating, page } from "$app/stores";
4-
import { onMount } from "svelte";
2+
// @ts-nocheck
3+
import { navigating, page } from '$app/stores';
4+
import { onMount } from 'svelte';
55
6-
import { goto } from "$app/navigation";
6+
import { goto } from '$app/navigation';
77
8-
export let ionTabsDidChange = () => {};
9-
export let ionTabsWillChange = () => {};
10-
export let slot = "bottom";
8+
export let ionTabsDidChange = () => {};
9+
export let ionTabsWillChange = () => {};
10+
export let slot = 'bottom';
1111
12-
/**
12+
/**
1313
An array of tab objects containing label, icon, and tab properties.
1414
@type {{label: string; icon: string; tab: string;}[]}
1515
*/
16-
export let tabs = [];
16+
export let tabs = [];
1717
18-
let ionTabBarElement;
19-
let controller;
18+
let ionTabBarElement;
19+
let controller;
2020
21-
// we need relative path for the goto to function properly and to allow for relative tab definitions
22-
const { pathname } = $page.url;
23-
const cleanedPath = pathname.replace(/\/+$/, ''); // Strip trailing slashes, so we can get the last part of the path correctly. (e.g. /pages/homepage/ -> /pages/homepage)
24-
const pathSplit = cleanedPath.split("/");
25-
let currentTabName = pathSplit[pathSplit.length - 1]; // we don't want to use at(-1) because of old browsers
26-
let relativePath = cleanedPath.replace(currentTabName, "");
21+
// we need relative path for the goto to function properly and to allow for relative tab definitions
22+
const { pathname } = $page.url;
23+
const cleanedPath = pathname.replace(/\/+$/, ''); // Strip trailing slashes, so we can get the last part of the path correctly. (e.g. /pages/homepage/ -> /pages/homepage)
24+
const pathSplit = cleanedPath.split('/');
25+
let currentTabName = pathSplit[pathSplit.length - 1]; // we don't want to use at(-1) because of old browsers
26+
let relativePath = cleanedPath.replace(currentTabName, '');
2727
28-
// we need to capture the router changes - to support a-href navigation and other stuff
29-
$: if ($navigating && $navigating.to) {
30-
tabs.forEach(async (tab) => {
31-
if ($navigating.to.url.pathname.includes(relativePath + tab.tab)) {
32-
currentTabName = tab.tab;
33-
await goto($navigating.to.url.pathname);
34-
controller.select(tab.tab);
35-
}
36-
});
37-
}
28+
// we need to capture the router changes - to support a-href navigation and other stuff
29+
$: if ($navigating && $navigating.to) {
30+
tabs.forEach(async (tab) => {
31+
if ($navigating.to.url.pathname.includes(relativePath + tab.tab)) {
32+
currentTabName = tab.tab;
33+
await goto($navigating.to.url.pathname);
34+
controller.select(tab.tab);
35+
}
36+
});
37+
}
3838
39-
onMount(async () => {
40-
// reassignment needed after onMount
41-
controller = ionTabBarElement;
42-
controller.select(currentTabName);
43-
});
39+
onMount(async () => {
40+
// reassignment needed after onMount
41+
controller = ionTabBarElement;
42+
controller.select(currentTabName);
43+
});
4444
45-
const tabBarClick = async (selectedTab) => {
46-
currentTabName = selectedTab;
47-
await goto(relativePath + selectedTab);
48-
controller.select(selectedTab);
49-
};
45+
const tabBarClick = async (selectedTab) => {
46+
currentTabName = selectedTab;
47+
await goto(relativePath + selectedTab);
48+
controller.select(selectedTab);
49+
};
5050
</script>
5151

5252
<ion-tabs
53-
on:ionTabsDidChange={ionTabsDidChange}
54-
on:ionTabsWillChange={ionTabsWillChange}
55-
bind:this={ionTabBarElement}
53+
on:ionTabsDidChange={ionTabsDidChange}
54+
on:ionTabsWillChange={ionTabsWillChange}
55+
bind:this={ionTabBarElement}
5656
>
57-
<slot />
57+
<slot />
5858

59-
{#if slot === "bottom" || slot === ""}
60-
<ion-tab-bar slot="bottom">
61-
{#each tabs as tab}
62-
<ion-tab-button
63-
tab={tab.tab}
64-
on:keydown={() => {
65-
tabBarClick(tab.tab);
66-
}}
67-
on:click={() => {
68-
tabBarClick(tab.tab);
69-
}}
70-
>
71-
<ion-label>{tab.label}</ion-label>
72-
<ion-icon icon={tab.icon} />
73-
</ion-tab-button>
74-
{/each}
75-
</ion-tab-bar>
76-
{/if}
59+
{#if slot === 'bottom' || slot === ''}
60+
<ion-tab-bar slot="bottom">
61+
{#each tabs as tab}
62+
<ion-tab-button
63+
tab={tab.tab}
64+
on:keydown={() => {
65+
tabBarClick(tab.tab);
66+
}}
67+
on:click={() => {
68+
tabBarClick(tab.tab);
69+
}}
70+
>
71+
<ion-label>{tab.label}</ion-label>
72+
<ion-icon icon={tab.icon} />
73+
</ion-tab-button>
74+
{/each}
75+
</ion-tab-bar>
76+
{/if}
7777

78-
{#if slot === "top"}
79-
<ion-tab-bar slot="top">
80-
{#each tabs as tab}
81-
<ion-tab-button
82-
tab={tab.tab}
83-
on:keydown={() => {
84-
tabBarClick(tab.tab);
85-
}}
86-
on:click={() => {
87-
tabBarClick(tab.tab);
88-
}}
89-
>
90-
<ion-label>{tab.label}</ion-label>
91-
<ion-icon icon={tab.icon} />
92-
</ion-tab-button>
93-
{/each}
94-
</ion-tab-bar>
95-
{/if}
78+
{#if slot === 'top'}
79+
<ion-tab-bar slot="top">
80+
{#each tabs as tab}
81+
<ion-tab-button
82+
tab={tab.tab}
83+
on:keydown={() => {
84+
tabBarClick(tab.tab);
85+
}}
86+
on:click={() => {
87+
tabBarClick(tab.tab);
88+
}}
89+
>
90+
<ion-label>{tab.label}</ion-label>
91+
<ion-icon icon={tab.icon} />
92+
</ion-tab-button>
93+
{/each}
94+
</ion-tab-bar>
95+
{/if}
9696
</ion-tabs>

components/NavEmpty.svelte

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script>
2-
console.warn(
3-
`Please replace import { IonNav } from 'ionic-svelte' with import IonNav from 'ionic-svelte/components/IonNav.svelte'`
4-
);
2+
console.warn(
3+
`Please replace import { IonNav } from 'ionic-svelte' with import IonNav from 'ionic-svelte/components/IonNav.svelte'`
4+
);
55
</script>

0 commit comments

Comments
 (0)