From 2d7f6a337611102a0c98c1e86ef4fe7c3d8e88ad Mon Sep 17 00:00:00 2001 From: Bob Fanger Date: Sat, 19 Oct 2024 20:54:57 +0200 Subject: [PATCH] feat: New Embrace -Inside the Svelte template prepend the name of the component with `react:` prefix. +Inside the Svelte template prepend the name of the component with `react.` prefix. -Instead of ` diff --git a/src/routes/input/+page.svelte b/src/routes/input/+page.svelte index 49a8a43..c3faa44 100644 --- a/src/routes/input/+page.svelte +++ b/src/routes/input/+page.svelte @@ -5,6 +5,6 @@ } - + {value} diff --git a/src/routes/lazy/+page.svelte b/src/routes/lazy/+page.svelte index effe48b..9e3fe12 100644 --- a/src/routes/lazy/+page.svelte +++ b/src/routes/lazy/+page.svelte @@ -1,12 +1,11 @@ {#if browser} - + {/if} diff --git a/src/routes/preprocessor/+page.svelte b/src/routes/preprocessor/+page.svelte index b77afd1..edf4d8d 100644 --- a/src/routes/preprocessor/+page.svelte +++ b/src/routes/preprocessor/+page.svelte @@ -1,19 +1,18 @@ -
+
- + -A simple alert +A simple alert - + "Multiline content". {10 ** 4} Lorem ipsum dolor sit amet consectetur adipisicing - elit. Suscipit nisi atque asperiores. -a div +a div diff --git a/src/routes/react-router/+layout.svelte b/src/routes/react-router/+layout.svelte index 90a3d1e..0b3d474 100644 --- a/src/routes/react-router/+layout.svelte +++ b/src/routes/react-router/+layout.svelte @@ -1,14 +1,13 @@ - - + + - + diff --git a/src/routes/react-router/[slug]/+page.svelte b/src/routes/react-router/[slug]/+page.svelte index c6b827b..c665afb 100644 --- a/src/routes/react-router/[slug]/+page.svelte +++ b/src/routes/react-router/[slug]/+page.svelte @@ -1,11 +1,10 @@

You're on the {$page.params.slug} page.

-Back to home +Back to home diff --git a/src/routes/typesafe/+page.svelte b/src/routes/typesafe/+page.svelte index 991c67c..c359d08 100644 --- a/src/routes/typesafe/+page.svelte +++ b/src/routes/typesafe/+page.svelte @@ -1,5 +1,4 @@ - + diff --git a/src/routes/youtube/svelte/+page.svelte b/src/routes/youtube/svelte/+page.svelte index c18ab24..dd5f2e3 100644 --- a/src/routes/youtube/svelte/+page.svelte +++ b/src/routes/youtube/svelte/+page.svelte @@ -1,8 +1,7 @@ - + diff --git a/src/tests/__snapshots__/preprocess.spec.ts.snap b/src/tests/__snapshots__/preprocess.spec.ts.snap index 59dc508..6e19906 100644 --- a/src/tests/__snapshots__/preprocess.spec.ts.snap +++ b/src/tests/__snapshots__/preprocess.spec.ts.snap @@ -1,219 +1,210 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`svelte-preprocess-react > should convert text content to react children prop 1`] = ` -" +; - + - + - + " `; exports[`svelte-preprocess-react > should import 'react-dom/server' when ssr is enabled 1`] = ` -" +; - { count = next; }} -> +> " `; exports[`svelte-preprocess-react > should inject a script tag 1`] = ` " - + " `; exports[`svelte-preprocess-react > should not import 'react-dom/server' when ssr is disabled 1`] = ` -" +; - { count = next; }} -> +> " `; exports[`svelte-preprocess-react > should portal slotted content as children 1`] = ` -" + const react = sveltify(Alert, { inject$$createPortal, inject$$ReactDOM, inject$$renderToString }); +; - + " `; exports[`svelte-preprocess-react > should process tags 1`] = ` -" + const react = sveltify({ Provider }, { inject$$createPortal, inject$$ReactDOM, inject$$renderToString }); +; - + - + - + " `; exports[`svelte-preprocess-react > should process tags 1`] = ` -" +; - { count = next; }} -> +> " `; exports[`svelte-preprocess-react > should process tags 2`] = ` -" +;

prop and event

- { count = next; }} -> +>

prop and Prop event

- { console.info("count"); }} -> +>

prop

- +

.

- + " `; exports[`svelte-preprocess-react > should process (lowercase) tags 1`] = ` " - console.info("clicked")}> + console.info("clicked")}> - + " `; exports[`svelte-preprocess-react > should process {:else} {:then} and {:catch} sections 1`] = ` -" + const react = sveltify({ Component }, { inject$$createPortal, inject$$ReactDOM, inject$$renderToString }); +; {#if number === 1} - + {:else if number === 2} - + {:else} - + {/if} {#each [] as _} - + {:else} - + {/each} {#await Promise.resolve()} - + {:then} - + {:catch} - + {/await} " `; exports[`svelte-preprocess-react > should process on:event forwarding 1`] = ` -" +; - + " `; diff --git a/src/tests/fixtures/Binding.svelte b/src/tests/fixtures/Binding.svelte index d86b04e..05343bb 100644 --- a/src/tests/fixtures/Binding.svelte +++ b/src/tests/fixtures/Binding.svelte @@ -1,9 +1,9 @@ - + diff --git a/src/tests/fixtures/Blocks.svelte b/src/tests/fixtures/Blocks.svelte index 7c218c6..d281d04 100644 --- a/src/tests/fixtures/Blocks.svelte +++ b/src/tests/fixtures/Blocks.svelte @@ -1,33 +1,32 @@ {#if number === 1} - + {:else if number === 2} - + {:else} - + {/if} {#each [] as _} - + {:else} - + {/each} {#await Promise.resolve()} - + {:then} - + {:catch} - + {/await} diff --git a/src/tests/fixtures/Container.svelte b/src/tests/fixtures/Container.svelte index 99980fe..bffff40 100644 --- a/src/tests/fixtures/Container.svelte +++ b/src/tests/fixtures/Container.svelte @@ -1,15 +1,14 @@ - { count = next; }} -> +> diff --git a/src/tests/fixtures/Element.svelte b/src/tests/fixtures/Element.svelte index cdcc965..0ba5202 100644 --- a/src/tests/fixtures/Element.svelte +++ b/src/tests/fixtures/Element.svelte @@ -1,4 +1,4 @@ - console.info("clicked")}> + console.info("clicked")}> - + diff --git a/src/tests/fixtures/Forwarding.svelte b/src/tests/fixtures/Forwarding.svelte index 1038c3d..12bbf30 100644 --- a/src/tests/fixtures/Forwarding.svelte +++ b/src/tests/fixtures/Forwarding.svelte @@ -1,8 +1,7 @@ - + diff --git a/src/tests/fixtures/Multiple.svelte b/src/tests/fixtures/Multiple.svelte index a7be899..5c68e5f 100644 --- a/src/tests/fixtures/Multiple.svelte +++ b/src/tests/fixtures/Multiple.svelte @@ -1,27 +1,26 @@

prop and event

- { count = next; }} -> +>

prop and Prop event

- { console.info("count"); }} -> +>

prop

- +

.

- + diff --git a/src/tests/fixtures/NoScript.svelte b/src/tests/fixtures/NoScript.svelte index 00d1585..0b3e90c 100644 --- a/src/tests/fixtures/NoScript.svelte +++ b/src/tests/fixtures/NoScript.svelte @@ -1,2 +1,2 @@ - + diff --git a/src/tests/fixtures/Provider.svelte b/src/tests/fixtures/Provider.svelte index d2036d4..54ca899 100644 --- a/src/tests/fixtures/Provider.svelte +++ b/src/tests/fixtures/Provider.svelte @@ -1,15 +1,14 @@ -content +content - + - + diff --git a/src/tests/fixtures/Slots.svelte b/src/tests/fixtures/Slots.svelte index 1001915..b3c7187 100644 --- a/src/tests/fixtures/Slots.svelte +++ b/src/tests/fixtures/Slots.svelte @@ -1,8 +1,7 @@ -A simple primary alert. Check it out! +A simple primary alert. Check it out! diff --git a/src/tests/fixtures/SlottedText.svelte b/src/tests/fixtures/SlottedText.svelte index f9e24a9..9b43b60 100644 --- a/src/tests/fixtures/SlottedText.svelte +++ b/src/tests/fixtures/SlottedText.svelte @@ -1,17 +1,16 @@ -Static Text +Static Text - + "Multiline content". Lorem ipsum dolor sit amet consectetur adipisicing elit. Suscipit nisi atque asperiores. - +
-Value: {count + 1} +Value: {count + 1}