You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
# Change Log Ionic-Svelte-NPM
2
2
All notable changes to this project will be documented in this file.
3
3
4
-
## 0.62/63/64/65
4
+
## 0.62/63/64/65/66/67
5
5
- removed typescript in *.svelte components as Vite does not process them (but does process *.ts)
6
6
- removed IonTabsLegacy.svelte - can still be found here https://github.com/Tommertom/svelte-ionic-app/blob/main/src/IonTabsLegacy.svelte for manual inclusion
Copy file name to clipboardExpand all lines: README.md
+32-25Lines changed: 32 additions & 25 deletions
Original file line number
Diff line number
Diff line change
@@ -68,7 +68,7 @@ adapter: adapter({
68
68
69
69
Integration of Ionic
70
70
71
-
-`npm i @ionic/core ionic-svelte`- (ionic svelte has typings until 6.4.2)
71
+
-`npm i @ionic/core ionic-svelte`
72
72
- create a theme folder/file that contains the colours for Ionic (see starterfiles/theme). Example: - create a theme folder/file that contains the colours for Ionic (see starterfiles/theme). Example: https://raw.githubusercontent.com/Tommertom/svelte-ionic-app/main/starterfiles/theme/variables.css
73
73
- the top-route layout file `+layout.svelte` (Kit) or top root module (others) needs to run `setupIonicSvelte()` and import the theme stylesheet before anything else - also see starterfiles/+layout.svelte. Example:
74
74
@@ -83,7 +83,7 @@ Integration of Ionic
83
83
import 'ionic-svelte/components/all';
84
84
85
85
/* run base configuration code from ionic/core */
86
-
setupIonicSvelte();
86
+
setupIonicBase();
87
87
</script>
88
88
89
89
<ion-app>
@@ -107,6 +107,28 @@ Code for this library - https://github.com/Tommertom/svelte-ionic-app
107
107
108
108
Ionic-svelte on NPMjs- https://www.npmjs.com/package/ionic-svelte
109
109
110
+
111
+
## Code Splitting to reduce bundle size
112
+
In order to reduce bundle size or limit the size of individual chunks, you can replace the import in main layout file. Example: if you replace the line `import 'ionic-svelte/components/all';` with imports like below. This can reduce the bundle for that chunk drastically. The import of `all` will result to at least an 800kb chunk (80 components), so it is worth it to change this.
113
+
114
+
Next you can choose to load specific components only where you use them.
115
+
116
+
Please note, you only need to import a component only once, as the import registers the webcomponent globally. So this saves you lots of imports, reducing the bundle as well (compared to tree-shaking).
117
+
118
+
And never forget to at least `import 'ionic-svelte/components/ion-app';` - as this one is in the main layout.
Ionic components are webcomponents, so appear in your template just like other dom elements. They don't need ECMA imports like `import {IonCard} from '...`.
112
134
@@ -115,8 +137,8 @@ Ionic components are webcomponents, so appear in your template just like other d
115
137
Here content
116
138
</ion-card>
117
139
```
140
+
So you can also apply css classes to them, also when wanting to tweak UI via the shadow dom/web-parts.
118
141
119
-
`setupIonicBase` - will register all these Ionic components as webcomponents so you can use them easily. But, there is a trade-off - no tree shaking (unless you change `setupIonicBase` a bit).
120
142
121
143
## Special components
122
144
Due to router issues and overlays, there are three special compontents included that override/replace the ionic standard webcomponents:
@@ -168,25 +190,6 @@ Sample `tsconfig.json`:
168
190
}
169
191
```
170
192
171
-
## Code Splitting to reduce bundle size
172
-
In order to reduce bundle size or limit the size of individual chunks, you can replace the
173
-
Example: if you replace the line `import 'ionic-svelte/components/all';` with imports like below. This can reduce the bundle for that chunk drastically. The import of `all` will result to at least an 800kb chunk (80 components), so it is worth it to change this.
174
-
175
-
Please note, you only need to import a component only once, as the import registers the webcomponent globally. So this saves you lots of imports, reducing the bundle as well (compared to tree-shaking).
176
-
177
-
And never forget to at least `import 'ionic-svelte/components/ion-app';`.
Would you like to contribute to this project? Great!
192
195
@@ -213,13 +216,15 @@ When you do a PR, make sure you explain what you did and why!
213
216
214
217
- bind:value does not seem to work on input and other form elements, so a click handler is needed - which is cumbersome - https://github.com/sveltejs/svelte/issues/892 - so probably not solvable without support by Ionic or Svelte - or we need to create wrappers for all elements - which is quite some work and you will be required to manually import all elements you use per page (like with Vue and React) - which seems a drag to me?
215
218
219
+
SvelteKit form actions make the usage of bind:value even obsolete. So that is the go-to way route anyway - https://kit.svelte.dev/docs/form-actions
220
+
216
221
Please note - if you use a library such as https://svelte-forms-lib-sapper-docs.vercel.app/introduction together with Yup schemas https://github.com/jquense/yup, the bind:value-issue actually becomes less relevant as you will have the library handle the events and you will use the observables to manage validation and final values to use for further processing. See https://blog.logrocket.com/form-validation-in-svelte/ for nice examples.
217
222
218
-
- Some styles are unused - related to md and ios options for webcomponents? Or need to be discarded. Probably issue with webcomponents and the nature of Ionic being sensitive to md or ios style (as part of its config)
223
+
- Some styles are reported as unused - related to md and ios options for webcomponents? Or need to be discarded. Probably issue with webcomponents and the nature of Ionic being sensitive to md or ios style (as part of its config). Or the way Svelte/vite checks for unused css.
219
224
220
225
- Add IonPage, IonTabs and IonBackButton are not part of the default export - these are svelte components, so index.ts cannot handle these (?)
221
226
222
-
- Ion Icons implementation will not support md and ios specific icons etc (yet) - name prop does not function - also happening in Vue/React.Similar icon issues arise with other component that can digest custom icons (to check) - solution could be to make a svelte IonIcon component, but that will likely import all icons in a non-tree-shakable way?
227
+
- Ion Icons implementation only uses icon-property syntax. Name/md/ios will not function
223
228
224
229
- In some cases IonPage clips the content enclosed - then you need to remove main tags in IonPage
225
230
@@ -231,7 +236,9 @@ Please note - if you use a library such as https://svelte-forms-lib-sapper-docs.
231
236
232
237
- ItemSliding sometimes does not catch the gesture - known issue - needs fix in @ionic/core
233
238
234
-
- Many "File not found errors" on css.map files. I frankly don't really mind these. Maybe it is easy to get rid of these, but for now, I leave it.
239
+
- Many "File not found errors" on css.map files in the demo app. I frankly don't really mind these. Maybe it is easy to get rid of these, but for now, I leave it.
240
+
241
+
Check https://github.com/Tommertom/svelte-ionic-app/issues for most recent overview of issues.
0 commit comments