Skip to content

New project fork and alternate organization approach #111

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 42 commits into from

Conversation

briznad
Copy link
Member

@briznad briznad commented Mar 21, 2025

Hi @Tommertom

I wanted to inform you about a significant fork I've made to your svelte-ionic-app project. After using your svelte-ionic package for quite a while on many different projects, I decided to reorganize the code into more modular pieces, which I hope will allow each piece to be simpler. This version breaks out the core compatibility piece from the custom framework components, the CLI create tool, and the demo app. Also, all Svelte code now uses 5+ syntax. I've created distinct repos/packages, and have grouped them under an organization in GitHub (https://github.com/ionic-sveltekit) and NPM (https://www.npmjs.com/org/ionic-sveltekit). The various pieces are now:

  • core
    the essential compat layer exposing Ionic custom components
  • components
    custom Svelte framework components that use Ionic custom elements and can be imported into Ionic SvelteKit apps. This includes a Tabs component, which we've discussed previously, as well as a Tooltip component.
  • example
    A demo app, showing how to integrate various Svelte features and Ionic UI elements. This is used as the base demo app when creating a fresh project via CLI tool.
  • create
    The CLI tool to spin up a new Ionic SvelteKit app.

I would love for you to take a look and provide any feedback you may have. Additionally, I want to say thank you. As I point out in the updated README, you deserve immense credit for this tool, and all of my recent work on this update is still based on your prior toil. I'd also like to offer for you to be a member of this new org and maintainer.

Let me know what you think.

Thanks,
@briznad

@Tommertom
Copy link
Collaborator

Hi @briznad - thanks for the work done - I haven't taken a look at it but pretty honoured seeing this work done. So I am stoked studying your approach and let you know my view. But just wanted to give you a quick headsup and appreciation for your contribution.

@Tommertom
Copy link
Collaborator

Hi Brad,

upon running the npx create on my windows machine I am getting

image

You have the same issue?

@Tommertom
Copy link
Collaborator

Hi,

After scanning through your changes a few things I like to note

  • great to see the organisation setup and a bit more separation - better use of GitHub.
  • lots of svelte5 stuff going on so that is a great enhancement
  • I see you did not include IonNav and IonPage, why is that? (or is ViewTransition the replacement?)
  • Why is IonTabs not part of core?
  • there are a few non-standard Ionic components added? Ago and Tooltip. Why is that?

The backdrop of these questions are some of the design decisions I had in mind for ionic-svelte

  • stay as close to the documentation as possible (Ionic Angular/React/Vue)
  • make it as if the Ionic team can take it over as is so official adoptions is as easy as possible for them
  • keep maintenance efforts for updates of ionic or svelte as low as possible (I kind of did not do much on svelte 4 and svelte 5 I have ignored as well - so that is overdue)

Next, there are a few fundamental issues that need to be resolved. I am interested hearing how you look at them:

  • modal and other overlays do not really work well - they need a bit more coding effort to make sure they behave like the official versions (e.g. ion-footer in ion-model). Can we create a modalController that uses inline ion-modal, without leaking dom elements?
  • native view transitions as defined in ionic's css (e.g. backbutton animation different from page animation) - this would require deep integration with the kit router, which imho is a nightmare path
  • ion-sliding-item does/did not work
  • swipe to go back on ios broken
  • just to name a few from the fundamental issues needing deeper coding efforts, and which I tried to discuss with the community -https://github.com/Tommertom/svelte-ionic-app/issues/93
    (a valid choice can be not to solve them now, btw)

To me it is a very appealing idea taking this to the level you have brought it. As co-maintainer or somehow helping it getting to the next stage. So truly appreciate the effort and looking forward to your view.

(haven't tried your demo app yet)

@briznad
Copy link
Member Author

briznad commented Mar 21, 2025

Hi Brad,

upon running the npx create on my windows machine I am getting

image

You have the same issue?

Good catch! It's working on my machine (MacOS), both locally and when pulling the package down without previously being installed, but I'm sure it's to do with the node version. Looking… yep, there it is. I'm requiring at least Node 18.0.0.

  "engines": {
    "node": ">=18.0.0"
  },

But module.stripTypeScriptTypes wasn't added until v22.13.0.

I pushed a commit that swaps out the node method for a 3rd party library. I'd usually prefer to stick with the built-in solution, but the 3rd party supports Node 18+, which will make it less likely people will need to upgrade their Node before they can run the CLI tool.

@Tommertom
Copy link
Collaborator

Two other comments:

  • based on earlier user feedback I removed the dependencies on Kit, so people who don't want to use svelteKIT can still use it. I suspect that mobile app developers like to work in SPA, which pretty much voids many of the Kit perks, other than routing
  • your components use typescript. There are also developers who dont want to use Typescript. That is why I moved away from typescript in the components and using JSDOC for type annotation, which gives the same intellisense perks.

@briznad
Copy link
Member Author

briznad commented Mar 24, 2025

@Tommertom you've raised many good points. Allow me to respond to the more concrete issues, then I'll move on to broader design decisions in a subsequent comment.

Next, there are a few fundamental issues that need to be resolved. I am interested hearing how you look at them:

  • modal and other overlays do not really work well - they need a bit more coding effort to make sure they behave like the official versions (e.g. ion-footer in ion-model). Can we create a modalController that uses inline ion-modal, without leaking dom elements?

I'm not aware of the modal issues you're referencing. I did create an example project, using the @ionic-sveltekit/create CLI tool, to test this: https://github.com/briznad/ionic-modal-footer-test. I'm not currently experiencing any problems. Is there an issue or example repo you could point me to so I can better understand the issue?

  • native view transitions as defined in ionic's css (e.g. backbutton animation different from page animation) - this would require deep integration with the kit router, which imho is a nightmare path

You're right that enabling proper view transitions would be difficult without SvelteKit support, but luckily they added the onNavigate lifecycle function to solve this exact problem. The ViewTransition and Tabs components take advantage of this capability. I need to spend more time refining the animations, but I believe enabling different animation based on forward or back navigation should be possible.

  • ion-sliding-item does/did not work

I'm not aware of the sliding item issues you're referencing. I did create an example project, a copy of the modal footer test repo, to test this: https://github.com/briznad/ionic-sliding-item-test. I'm not currently experiencing any problems. Is there an issue or example repo you could point me to so I can better understand the issue?

  • swipe to go back on ios broken

I'll need to test this out.

  • just to name a few from the fundamental issues needing deeper coding efforts, and which I tried to discuss with the community -DISCUSSION - Rebuilding ionic-svelte #93
    (a valid choice can be not to solve them now, btw)

I'll address the larger design perspective, which should also address the majority of the points in from DISCUSSION - Rebuilding ionic-svelte #93 as well, in a moment.

@briznad
Copy link
Member Author

briznad commented Mar 24, 2025

@Tommertom to introduce my perspective of the design principles for this project please allow a slight deviation into why I decided to engage in this project in the first place. As I mentioned, I've happily used your project for a while now, as it combines 2 of my favorite dev tools. Before I found svelte-ionic-app I had used Ionic extensively and was curious about Svelte, but was reluctant to use it. While Svelte seemed to offer a refreshing DX since it didn't offer Ionic integration I didn't like my options: reproduce all of the essential UI components from scratch OR learn the idiosyncrasies of an alternative Svelte UI library. But when I found your project I was finally able to devote time to Svelte, and I have found it to be a very pleasant experience. But the reality is all my Svelte experience has actually been with SvelteKit. Svelte's abstractions and syntax are the best available, IMO, but that's not nearly as compelling as having a full bells-and-whistles framework with clear file-based routing, the ability to write both frontend and backed code with minimal context switching, Vite speed & DX, etc. It has the do-it-all capacity of Next.js, but without any of React's baggage, unfortunate JSX syntax, or styling confusion. And since I've always used SvelteKit, this has also impacted my relationship with Ionic. I don't place much value on the "framework" aspect of Ionic anymore, but instead prefer just the elegant UI components that automatically adapt their presentation to the user's device. And it was this viewpoint that led me to suggest my approach to handling tabs in svelte-ionic-app, which relies on SvelteKit:
https://github.com/Tommertom/svelte-ionic-app/issues/91

Through the research I did related to that discussion, I read about the View Transitions API for the first time. And then when I discovered that SvelteKit had launched lifecycle hooks specifically to facilitate view transitions (even though they had already shipped support when I made this comment), this was the aha moment for me to undertake updating svelte-ionic-app to remove the awkward pieces that cause the most confusion, implementation headaches, and maintenance cost, such as IonNav and IonTabs. And it was only after I started that process, and began attempting to make sense of all the code in the repo, that I realized there were many parts I didn't expect, such as the create scripts, and that modularization may also benefit overall clarity.

So, perhaps more important than the modularity of my project, or support for Svelte 5, is the fact that I don't intend to support Svelte without SvelteKit, which I've reflected in the name.

Another important point is I aim to reduce areas of functional overlap between SvelteKit & Ionic framework, which means removing support for some Ionic framework features. Put differently, the parts of Ionic I value and aim to preserve are the UI components. However, Ionic doesn't define itself as just a UI component library. It would seem that it is the inclusion of additional features beyond the functional UI components, such as Navigation/Routing and Lifecycle is what makes Ionic a framework. I'd prefer if SvelteKit were the framework, and Ionic provided only the styled components layer.

A good demonstration of this is Tabs. The helper component utilizes ion-tabs and ion-tab-bar to present the interface and SvelteKit to handle routing and handling content. This makes it easier for users to implement common interaction patterns in a consistent and simple way. My hope is this would drive adoption. However, these components deviate from a purely Ionic way of doing things. They are framework components, combining Ionic & SvelteKit, and are no longer web components. As such it seems more straightforward to move them into their own repo and remove any naming that suggests association with Ionic, to avoid any confusion with the core package.

Further responses inline below:

Hi,

After scanning through your changes a few things I like to note

  • great to see the organisation setup and a bit more separation - better use of GitHub.
  • lots of svelte5 stuff going on so that is a great enhancement
  • I see you did not include IonNav and IonPage, why is that? (or is ViewTransition the replacement?)

Partly answered above, but IonNav is removed and support for it is not planned. I would welcome a compelling argument in defense of IonNav, but the uses cases for it - Using NavLink instead of a router or Navigation within a Modal - seem like anti-patterns and should be avoided. IonPage is similarly part of the "framework" part of Ionic, and is made redundant by SvelteKit with view transitions.

  • Why is IonTabs not part of core?

See above. I would add that any framework component, even if designed to simply wrap the corresponding Ionic framework feature, nonetheless likely deviates from the Ionic API and introduces its own bugs, as well as requires nuanced explanation of the areas that are supported versus any that may not work as indicated according to the Ionic docs. This erodes confidence of potential adopters.

  • there are a few non-standard Ionic components added? Ago and Tooltip. Why is that?
  • Tooltip
    While Ionic offers ion-popover, that can be used to create a tooltip, in order to render a tooltip requires additional work. Similar to Tabs, the Tooltip component combines the presentational aspects of Ionic with Svelte logic.
  • Ago
    The Ago component doesn't include any Ionic UI components, but I've often found it necessary to rebuild the same Svelte component across multiple projects, so I thought it might be helpful to include it here. I would be open to an argument that Ago should be removed.

The backdrop of these questions are some of the design decisions I had in mind for ionic-svelte

  • stay as close to the documentation as possible (Ionic Angular/React/Vue)

Absolutely agree. Every core UI component should be assumed to work exactly as designed in the Ionic documentation. I aim to create a 5th project, which would be documentation. The main objective would be to point out any deviations, with the assumption that if not explicitly called out it should work just like Ionic.

  • make it as if the Ionic team can take it over as is so official adoptions is as easy as possible for them

I agree with this in principal, and I think focusing the core package supports this aim. Though my focus on supporting SvelteKit and not supporting Ionic framework features, suggests this is unlikely.

  • keep maintenance efforts for updates of ionic or svelte as low as possible (I kind of did not do much on svelte 4 and svelte 5 I have ignored as well - so that is overdue)

By eliminating any svelte files from core, and from my use of your generator.js script to upgrade to the latest Ionic, this should be easy enough.

Plus your addendum:

Two other comments:

  • based on earlier user feedback I removed the dependencies on Kit, so people who don't want to use svelteKIT can still use it. I suspect that mobile app developers like to work in SPA, which pretty much voids many of the Kit perks, other than routing

I already put forth my perspective on this, that SvelteKit is the most compelling aspect. Anyone who doesn't feel they need the additional features is free to omit them, and pays no penalty in doing so. But then, when the project grows to the point of requiring any 'Kit features, they are ready. This is exactly what is compelling to me about SvelteKit: that it supports any use case. Coming up with a way to support Svelte and SvelteKit separately would be possible. But it would require more complicated directions for which components would be supported and in what scenarios. I don't think this is worthwhile.

  • your components use typescript. There are also developers who dont want to use Typescript. That is why I moved away from typescript in the components and using JSDOC for type annotation, which gives the same intellisense perks.

It's definitely part of a different, larger conversation, but I prefer Typescript. I disagree that JSDoc provides an equivalent DX. It's more verbose, harder to read, moves the context of types away from code where they're used, and is less intelligent or helpful. That said, when using the create CLI tool, if you specify JSDoc or no types, all Typescript references, ts files, and lang="ts" props on script tags will be removed from the example app that's created. I could also add a build step that would output Typescript-less versions of the components, so they could be included directly when not using the create CLI tool, but this isn't as high a priority right versus adding more UI navigation patterns to components, such as a desktop toolbar component, and a documentation project.

@Tommertom
Copy link
Collaborator

Hi @briznad,

Thanks for your elaborate responses.

What stands out for me is that you are speaking from experience working with Ionic and Svelte(Kit).

And I like your thoughts about framework overlap between Svelte(Kit) and Ionic - there are some choices to be made here in order to make it more usable as a dev. And the ViewTransition api in Kit really is something that adds value, I agree.

With your intention to make documentation you are creating room for a bit more specific opinion on how to best use it, which imho comes with using Ionic in Svelte(Kit) irrespective of which approach:

  • using as SPA
  • Kit router
  • No Ionic lifecycle hooks
  • Custom page transitions and suggestions on how to do this (compared to the fancy Ionic ones)
    ..
    Which still makes for a very attractive UX/DX - that developers hopefully love. So I like that idea.

Looking back, I have mostly focused on trying to get the APIs exactly the same which hits a dead end road unless I want to do some really heavy coding such as building/tweaking routers (which the Ionic team has done for React/Vue and Angular). I think that also explain why I have not be maintaining the repo a lot - even though it still functions.

Your feedback made me aware that achieving API-perfection bites true adoption here. The latter being way more important to me, as I equally feel very happy with both tools from a UX and DX perspective.

So having said all this, I wonder what I should do moving forward with this repo. Do you propose to integrate this repo in your organisation? I would hate to give up the github stars :) Maybe it could become the core part, while embracing Kit? And then to your point have create scripts, components and documentation in a different spot.

@briznad
Copy link
Member Author

briznad commented Mar 25, 2025

@Tommertom Where to go from here… that is the question. I wouldn't advocate for walking away from your stars. Seriously, you've earned them. I do think the svelte-ionic-app project could benefit from the same modularization approach I've taken with ionic-sveltekit: you could split the various pieces up into different repos, so that the create scripts and demo apps would be separate from the core compatibility pieces. You could also transfer the repo to an organization you create to maintain the project. I'd also recommend having the project on GitHub match the npm package - ionic-svelte - to reduce confusion. None of this would require any technical change, just some administrative time, and shouldn't impact the stars.

However, none of that speaks to what the project focus or future should be. As for that, I still think it makes sense conceptually to maintain the goals you laid out in DISCUSSION - Rebuilding ionic-svelte #93, as well as "[making] it as if the Ionic team can take it over as is so official adoptions is as easy as possible for them." I took a look at @ionic/react, @ionic/angular, and @ionic/vue, and I wonder if there's room to modify your current approach to be structured more like those projects. In particular, is it possible to define all Ionic aspects - including IonNav, etc - using only js, and not using svelte files? Or put differently, is there a scenario where the ionic-svelte/core package was refined enough to become @ionic/svelte, aka have it officially handed off and supported by the Ionic team. That would seem to be a huge win. But obviously I have no idea if they would consider it. As it is, Vue is about 3.5 times more popular than Svelte, judging by weekly downloads, though the popularity on npm doesn't track with the popularity of each package within @Ionic (@ionic/angular is 2x as popular as @ionic/react, even though React is 10x more popular than @angular/core) so it's difficult to estimate what the popularity of an official @ionic/svelte integration might be, or what threshold Ionic/OutSystems to officially adopt it. Given the shifting tides for Ionic, this may be low on their priorities. But still seems like a worthy goal.

The other thing I'd say for moving in this direction - not having svelte files - is it would eliminate the reason I created my project, which would be a good thing. I'd prefer not to split off my project. I don't want to create a competing vision for Ionic with Svelte, or steal away any of your stars :) Or even if I have a different vision for how someone may want to use Ionic with Svelte - aka using it with SvelteKit and not using the Ionic framework features - that's not in conflict with a simpler ionic-svelte project. Having ionic-sveltekit depend on ionic-svelte makes perfect sense to me. The only thing that prevents that is Svelte 5 support, which shouldn't be that difficult. I can take a crack at it. I could still see a world where my @ionic-sveltekit/components would be useful.

@gerhardcit
Copy link

@Tommertom and @briznad , thanks for this discussion. Very good points raised here.
I',m very keen to test Svelte and Ionic..
Is sveltekit with static adapter not a SPA in some way? export const ssr = false;
And you have to of course not having +page.server.ts
It would work great for mobile web apps.
We have yet to build a sveltekit app with capacitor in store, so if anyone has done that successfully that would be great to know? Is is really something that works?

@briznad
Copy link
Member Author

briznad commented Mar 26, 2025

We have yet to build a sveltekit app with capacitor in store, so if anyone has done that successfully that would be great to know? Is is really something that works?

@gerhardcit It works :) There are many skeptics that will insist a hybrid web app bundled as native lacks sufficient rendering performance, but I believe that is largely untrue. For many use cases it's a great combination of tools: Svelte for logical composition of components, possibly with SvelteKit for routing, and Ionic to render UI components that will look natural/native on whichever mobile OS they're built for, and Capacitor to package it up with minimal time spent in XCode or Android Studio.

As for "[is it or is it] not a SPA…?" It is definitely a SPA. The significance of export const ssr = false; is that SvelteKit tries to encourage maximum performance by rendering initial views on the server, and serving the static html, then "hydrating" to a reactive js-based SPA after the first load. Essentially if you view source you'll actually see your app markup sent from the server, vs a pure fronted rendered React/Angular/Vue/Svelte system will have almost no markup until all the js has loaded to then render the views. SvelteKit provides this server-side rendering by default. However, this is one feature that doesn't work with how Ionic loads, since it needs knowledge of the device environment it's rendering on to customize the classes that determine how to present components. Therefore we have to disable SSR for Ionic. Not a huge problem, honestly. Especially if your primary output target is Capacitor, since, as you point out, that environment doesn't support the other server features of SvelteKit anyway.

@Tommertom
Copy link
Collaborator

Tommertom commented Mar 26, 2025

To expand on @briznad 's perfect explanation, @gerhardcit - mostly on the Capacitor capabilities (lesser on Ionic UI):

Josh Morony (an experienced Ionic vlogger) has demonstrated he can launch an app in the app store with just have one single simple HTML file that allows you to draw lines on a canvas - a few js lines in html. He used Capacitor for embedding the html in the native shell and that is that. https://www.youtube.com/watch?v=Y382mhVOoR8

I think as a principle apps published in the stores are client code heavy - which in web terms translates to SPA. And as you can build a SPA in Kit - it is totally doable and feasible. I haven't published anything in the store, but definitely succesfully deployed Kit-SPA apps on android devices (USB install)

In theory you can actually have a SSR rendered app displayed in Capacitor - but a) without Ionic UI (as its custom components as per @briznad comment have their ways in handling hydration b) you cannot publish it in the app store as it won't have acceptable behaviour when offline - in capacitor.config you can specify a server URL the shell uses to load webcontents - normally localhost.

Which brings me to something else really cool about Ionic-SvelteKit and Capacitor - you can do HMR in an emulator or even physical device with that same url parameter - which means you can build in web and immediately see the results in a device and even use native features. So that is really slick DX if you ask me.

And even cooler - you can have live updates of the app without having to go through app store updates, using some capacitor plugin that pulls web assets and replaces them in the app.

image

In short on Ionic & Kit - my summary would be - Ionic UI works well with Svelte . As Kit has been setup to solve specific problems related to SPA (SEO, heavy JS, long time until interaction/meaningful paint/etc) many features it brings are not usable for an Ionic app - form enhancement and SSR notably are two things you need other solutions for (Superforms e..g.). But the router is very usable. If you need SEO, then I also wonder about why you would want Ionic UI at all - as native app look&feel imho are not natural for landing pages and other purposes that we find on the web.

Each deployment technology has its own merits and purpose - full native, hybrid, PWA, SEO optimised web, you pick and choose what works for you best- ideally by trying.

@Tommertom
Copy link
Collaborator

Tommertom commented Mar 26, 2025

@Tommertom Where to go from here… that is the question. I wouldn't advocate for walking away from your stars. Seriously, you've earned them. I do think the svelte-ionic-app project could benefit from the same modularization approach I've taken with ionic-sveltekit: you could split the various pieces up into different repos, so that the create scripts and demo apps would be separate from the core compatibility pieces. You could also transfer the repo to an organization you create to maintain the project. I'd also recommend having the project on GitHub match the npm package - ionic-svelte - to reduce confusion. None of this would require any technical change, just some administrative time, and shouldn't impact the stars.

Steep learning curve on the org setup for me :) Will take a look at it.

However, none of that speaks to what the project focus or future should be. As for that, I still think it makes sense conceptually to maintain the goals you laid out in DISCUSSION - Rebuilding ionic-svelte #93, as well as "[making] it as if the Ionic team can take it over as is so official adoptions is as easy as possible for them." I took a look at @ionic/react, @ionic/angular, and @ionic/vue, and I wonder if there's room to modify your current approach to be structured more like those projects. In particular, is it possible to define all Ionic aspects - including IonNav, etc - using only js, and not using svelte files?

I have spent quite some time tinkering on this and there are at least a few challenges to overcome:

  • all supported packages need to implement an overlaying mechanism for the modal/popover things - https://github.com/ionic-team/ionic-framework/blob/main/packages/react/src/framework-delegate.tsx. I have gotten real close to it but dropped it for some motivational reasons
  • all supported integrations have done deep changes in the native router to support full native transitions. The router needs to apply animation to certain elements of the leaving and entering page. Because the supported frameworks have routers with route definitions in code, instead of the kit cli generating it, it would probably require deep intervention in the kit dev tool generating the routes to deal with it. The ViewTransition API does help a bit - but because the leaving page gets fully replaced and we (seem not) to be able to apply the transition properly (see https://github.com/ionic-team/ionic-framework/blob/1cfa915e8fe362951c521bce970a9f5f10918ab2/core/src/utils/transition/md.transition.ts#L4), we cannot fully create 100% like-for-like behaviour. So I even investigated going away from Kit to some other Svelte router, but these are just poorly supported or do not have the opportunity to inject javascript code at the leaving/entering pages.

Here I like to raise my earlier point - the more exact you want it to become to the Ionic API (and easy to handover to the team - if they would), the more work and possibly less maintainable it becomes. And my conversations with the Ionic team confirms that these parts (navigation and overlays) are the hardest part to maintain - making generic framework adoption a problem. This will be a hard design decision on their side - e.g. doing all animations with ViewTransition api only maybe?

Or put differently, is there a scenario where the ionic-svelte/core package was refined enough to become @ionic/svelte, aka have it officially handed off and supported by the Ionic team. That would seem to be a huge win. But obviously I have no idea if they would consider it. As it is, Vue is about 3.5 times more popular than Svelte, judging by weekly downloads, though the popularity on npm doesn't track with the popularity of each package within @Ionic (@ionic/angular is 2x as popular as @ionic/react, even though React is 10x more popular than @angular/core) so it's difficult to estimate what the popularity of an official @ionic/svelte integration might be, or what threshold Ionic/OutSystems to officially adopt it. Given the shifting tides for Ionic, this may be low on their priorities. But still seems like a worthy goal.

I am not too worried about Outsystems support - I am inclined to believe they will continue the support, and maybe even more. My first goal was to drive adoption - getting Ionic people into Svelte and Svelte people into Ionic. Both had its merits and challenges. On the Ionic side (people coming from Angular/Vue/React) it is a framework conversation. On the Svelte side you see the largest developer base clinging onto the Kit perks that a SPA kinda-voids. I remember people literally frowning on me asking about custom componets in the Discord. Like I had some disease or something.... :) (not complaining here, btw) . Luckily the few interactions I had with the svelte maintainers (including Rich Harris) were infinitively more constructive, informative and enjoyable - and confirms everything: Kit is setup for non-SPA, customer component frameworks need SPA, hence always a tension.

So I basically see now a new phase needed we just need something that works - with proven solutions for some of the challenges, not trying to be pixel perfect on native UI, nor religious about framework. That is where you come in, imho - you have something that works in reality and people can build upon it creating coolness -> ADOPTION!!!

The other thing I'd say for moving in this direction - not having svelte files - is it would eliminate the reason I created my project, which would be a good thing. I'd prefer not to split off my project. I don't want to create a competing vision for Ionic with Svelte, or steal away any of your stars :) Or even if I have a different vision for how someone may want to use Ionic with Svelte - aka using it with SvelteKit and not using the Ionic framework features - that's not in conflict with a simpler ionic-svelte project. Having ionic-sveltekit depend on ionic-svelte makes perfect sense to me. The only thing that prevents that is Svelte 5 support, which shouldn't be that difficult. I can take a crack at it. I could still see a world where my @ionic-sveltekit/components would be useful.

So I would love to focus on the core support and documenting what we don't support in the core, for which we have the goodies you created. And then making you co-maintainer for the core, so there is less dependencies.

I am very happy to take on Svelte5 support in the ionic-svelte package.

@briznad
Copy link
Member Author

briznad commented Mar 26, 2025

@Tommertom on the topic of whether we could create a package that was closer to @ionic/[react|angular|vue], check out this repo I just put together:
https://github.com/briznad/ionic-svelte-wrappers

It's an alternative approach to the current ionic-svelte that downloads the latest component definitions from https://unpkg.com/@ionic/docs/core.json, then programmatically outputs Svelte components with full type support for props. It handles IonNav & similar previously difficult corner cases without creating Svelte files. There are currently a couple issues - I need to fix event handling, this outputs Svelte 4 and below syntax, I'd prefer to use a Svelte component generator method - but I think it's pretty compelling as an approach that is much more similar to how Ionic handles React, etc.

@Tommertom
Copy link
Collaborator

@Tommertom on the topic of whether we could create a package that was closer to @ionic/[react|angular|vue], check out this repo I just put together: https://github.com/briznad/ionic-svelte-wrappers

It's an alternative approach to the current ionic-svelte that downloads the latest component definitions from https://unpkg.com/@ionic/docs/core.json, then programmatically outputs Svelte components with full type support for props. It handles IonNav & similar previously difficult corner cases without creating Svelte files. There are currently a couple issues - I need to fix event handling, this outputs Svelte 4 and below syntax, I'd prefer to use a Svelte component generator method - but I think it's pretty compelling as an approach that is much more similar to how Ionic handles React, etc.

I considered that as well, but imho it breaks the DX compared to how svelte loves to work with styling. Parent components cannot style the IonCard etc using ion-card selectors. You would then have to style everything in the global sheet, which goes against the style encapsulation principles that makes Svelte so appealing according to many.

If you want to solve that, I suspect you have to pass css as props to the component which then programmatically needs to apply css props progammatically to the ionic element. That sounds pretty yuck to me.

So to me a bit of a no here, unless it is something additional/alternative approach for those coming from React/Vue-land? But maybe you got to draw a line here...

@briznad
Copy link
Member Author

briznad commented Mar 26, 2025 via email

@Tommertom
Copy link
Collaborator

@briznad - I am going to start working on your suggestions . I do believe your PR is pretty big and massive. So I want to cut things in chunks.

Some other things

  • I don't want to remove the demo-app - as it is a showcase of UI elements and some appreciated it (your demo app, as far as I can tell requires API key, which imho is also friction)
  • I dont want to change the logo - it was made by a contributor

I am not sure if there is a better way to work with the PR, but at least this is what I would do

@Tommertom
Copy link
Collaborator

Tommertom commented Mar 30, 2025

Org https://github.com/ionic-svelte ionic-svelte created
4 repos created (demo-app, core, components and scripts
npmjs org created (ionic-svelte)
core published on @ionic-svelte/core

@briznad
Copy link
Member Author

briznad commented Apr 1, 2025

@briznad - I am going to start working on your suggestions . I do believe your PR is pretty big and massive. So I want to cut things in chunks.

Some other things

  • I don't want to remove the demo-app - as it is a showcase of UI elements and some appreciated it (your demo app, as far as I can tell requires API key, which imho is also friction)
  • I dont want to change the logo - it was made by a contributor

I am not sure if there is a better way to work with the PR, but at least this is what I would do

totally agree. to prevent any confusion, I didn't actually intend this PR as a suggestion that it should be merged. I just thought a PR was the easiest means to kick off the conversation. totally makes sense to keep the demo app and logo.

I see that we're using the new org. very cool! I hope it wasn't too much of an administrative headache :)

@briznad
Copy link
Member Author

briznad commented Apr 18, 2025

I'm going to close this PR. The conversation I was hoping to spur has been fruitful and I'm excited about the direction things are going.

@briznad briznad closed this Apr 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants