store icon indicating copy to clipboard operation
store copied to clipboard

feat: Svelte adapter

Open david-roeger opened this issue 2 years ago • 7 comments

This PR:

  • [x] Adds initial implementation of the Svelte adapter
  • [x] Adds initial tests for the Solid adapter

Regarding the questions in the issue:

  1. Packaging - I switched from tsub to svelte-package the official svelte way of well building packages. The build output from tsub threw errors when I tried to use it.
  2. Testing - I used testing-library svelte version. (The test for counting the rerender is a bit ugly because of https://github.com/testing-library/svelte-testing-library/issues/222)
  3. Reactivity interop - since svelte offers native store support this is quite nice. For the Api surface I tried to stay as close to the other packages.

Note: I just copy and pasted the shallow function - it might be worth refactoring that into the core package?

Closes https://github.com/TanStack/store/issues/4

david-roeger avatar Nov 05 '23 13:11 david-roeger

For the setup of the whole package I mainly copied and pasted from the vue example and svelte-query. I hope the setup is fine.

david-roeger avatar Nov 05 '23 13:11 david-roeger

This looks great to me, but I'm not a Svelte-spert admittedly 😅

Tagging in @LukeHagar to review the Svelte code, as he was offering to help out with a Svelte adapter for Forms

PS I'm so sorry I missed this PR - I just didn't see it at the time; no excuses. Sorry!

crutchcorn avatar Dec 13 '23 11:12 crutchcorn

I just wanted to follow up here, this looks like a good implementation, and I'm glad to see you using the existing Svelte store functions.

That being said I think this will end up changing once runes come about.

LukasParke avatar Dec 14 '23 15:12 LukasParke

@LukeHagar That's what we talked about yesterday in the discord. I played a bit around with runes and that's what I got so far: See https://github.com/david-roeger/svelte-store/pull/1 Or in the repl

But the tooling around svelte-5 is... well not there yet and I can't get svelte-package to output types for index.svelte.ts files or tests working

@crutchcorn does it make sense to release the adapter in it's current form for svelte-4 or should we just wait until svelte-5 arrives?

david-roeger avatar Dec 14 '23 16:12 david-roeger

Let's hold off for Svelte 5 - apologies for sending us all down this goose chase until then 😅😅

crutchcorn avatar Dec 16 '23 14:12 crutchcorn

Hey there, with Svelte 5 now being in Release Candidate Stage I would be like to continue working on the adapter :)

david-roeger avatar May 22 '24 11:05 david-roeger

Sounds great to me!

LukasParke avatar May 22 '24 12:05 LukasParke

I finished the implementation today.

I had to disable the code-coverage for tests because I ran into some svelte-5 releated issues (e.g. https://cloud.nx.app/runs/q2YUKafLGK) and I had to disable knip for the package because of this issues using vite-plugin-svelte conflict

david-roeger avatar May 27 '24 12:05 david-roeger

Hey all! Sorry I missed this. Asking some folks to review now via socials. I'm not super familiar with Svelte 5 yet. Let me also tag in @lachlancollins to see if we can fix up Knip and Nx in this PR

crutchcorn avatar Jun 20 '24 01:06 crutchcorn

@crutchcorn Not a Svelte pro, but I've been experimenting with runes (trying to convert the svelte-sonner package to runes), and I can say the implementation looks good here. The only suggestion I have is the possibility of exporting theshallow function from the vanilla package so that it can be imported by the Vue, React, and Svelte packages.

wobsoriano avatar Jun 20 '24 01:06 wobsoriano

☁️ Nx Cloud Report

CI is running/has finished running commands for commit cfa404231ee6506519809aee5d88faee8413126b. As they complete they will appear below. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this CI Pipeline Execution


✅ Successfully ran 1 target

Sent with 💌 from NxCloud.

nx-cloud[bot] avatar Jun 20 '24 01:06 nx-cloud[bot]