potatejs 1.0.0-beta.0 → 1.0.0-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -11
- package/bin/potate-cli.mjs +1 -1
- package/dist/astro-client.js +1 -1
- package/dist/astro-integration.js +2 -24
- package/dist/astro-render.js +2 -1
- package/dist/chunk-O3JMYIZZ.js +25 -0
- package/dist/chunk-QRCR45N4.js +2 -0
- package/dist/{index-esbuild.js → index-esbuild-jsx.js} +162 -85
- package/dist/{index-vite.js → index-vite-jsx.js} +161 -84
- package/dist/index.js +4 -4
- package/dist/renderToString.js +1 -0
- package/dist/vite-integration.js +331 -0
- package/package.json +13 -11
- package/dist/ssr-vite.js +0 -1
package/README.md
CHANGED
|
@@ -19,6 +19,11 @@ Potate supports all the APIs of React including the upcoming concurrent mode API
|
|
|
19
19
|
- Fast alternative to Virtual DOM. (JSX without VDOM).
|
|
20
20
|
- Smaller transpiled footprint of your source code, than traditional JSX.
|
|
21
21
|
|
|
22
|
+
## LIVE DEMO with Astro
|
|
23
|
+
|
|
24
|
+
[Here](https://stackblitz.com/edit/github-cywxrcwm-3n79zz3t?file=src%2Fcomponents%2FPotate.jsx
|
|
25
|
+
) is a live demo with Astro on StackBlitz.
|
|
26
|
+
|
|
22
27
|
## Installation
|
|
23
28
|
|
|
24
29
|
### Astro
|
|
@@ -55,17 +60,12 @@ Now, you can use not only Astro components (`.astro`) but also Potate JSX compon
|
|
|
55
60
|
> **Note:** Potate components in Astro Islands
|
|
56
61
|
>
|
|
57
62
|
> * **No directive (Server Only)**: Rendered as just static HTML tags. It results in zero client-side JavaScript. (I used to think there wasn't much point in writing static content in JSX components instead of just using Astro components. It seemed like standard Astro components was more than enough. **However, I've realized one major advantage:** [SSR Emotion for Astro](docs/SSR_EMOTION_FOR_ASTRO.md) — the ultimate SSR Zero-Runtime CSS-in-JS solution, seamlessly integrated with Astro. By using Potate JSX components, your styles are automatically extracted into static CSS during the build process. This means you can enjoy the full power of CSS-in-JS while still shipping zero bytes of JS to the browser. In this regard, it's a significant upgrade over standard Astro components.)
|
|
63
|
+
>
|
|
58
64
|
> * `client:only="potate"` **(Client Only)**: This is the mode where the relationship between Potate and Astro is the clearest. (In this context, Potate plays the same role as React in other integrations.) It skips server-side rendering and runs entirely in the browser.
|
|
59
65
|
>
|
|
60
66
|
> * `client:load`(and others like `client:visible` or `client:idle`) **(SSR Hydration)**: Despite its cool and flashy name, "SSR Hydration" is not that complicated: it just creates a static HTML skeleton first, and once the JS is ready, the engine takes over the DOM as if it had been there from the start. If you are particular about the visual transition—like ensuring there is no layout shift by pre-setting an image's height—you might want to take control to make the swap feel completely natural.
|
|
61
67
|
|
|
62
68
|
|
|
63
|
-
#### LIVE DEMO with Astro
|
|
64
|
-
|
|
65
|
-
[Here](https://stackblitz.com/edit/github-cywxrcwm-3n79zz3t?file=src%2Fcomponents%2FPotate.jsx
|
|
66
|
-
) is a live demo with Astro on StackBlitz.
|
|
67
|
-
|
|
68
|
-
|
|
69
69
|
### Vite
|
|
70
70
|
|
|
71
71
|
Create your new app with `select a framework: > Vanilla`.
|
|
@@ -82,12 +82,16 @@ npm install potatejs
|
|
|
82
82
|
|
|
83
83
|
Add Potate in your `vite.config.ts` file.
|
|
84
84
|
|
|
85
|
+
> **Note:** What is the `clientOnly` option? See [SSR Emotion for Vite](/docs/SSR_EMOTION_FOR_VITE.md#using-pure-vite-standard-csr-only).
|
|
86
|
+
|
|
85
87
|
``` js
|
|
86
88
|
import { defineConfig } from 'vite'
|
|
87
89
|
import potate from 'potatejs/vite'
|
|
88
90
|
|
|
89
91
|
export default defineConfig({
|
|
90
|
-
plugins: [potate(
|
|
92
|
+
plugins: [potate({
|
|
93
|
+
clientOnly: true,
|
|
94
|
+
})],
|
|
91
95
|
})
|
|
92
96
|
|
|
93
97
|
```
|
|
@@ -304,10 +308,11 @@ For the above example, the Brahmos output is 685 bytes, compared to 824 bytes fr
|
|
|
304
308
|
- [x] React Utilities and Methods
|
|
305
309
|
- [x] ⭐⭐⭐ Vite Plugin to transpile JSX to tagged templates
|
|
306
310
|
- [x] ⭐⭐⭐ Esbuild Plugin to transpile JSX to tagged templates
|
|
307
|
-
- [x] ⭐⭐⭐ [Potate Native Component(PNC)](docs/POTATE_NATIVE_COMPONENT.md)
|
|
308
|
-
- [x] ⭐⭐⭐ [SSR Emotion for Astro](docs/SSR_EMOTION_FOR_ASTRO.md)
|
|
309
|
-
- [x] ⭐⭐⭐ [
|
|
310
|
-
- [x] ⭐⭐⭐ [
|
|
311
|
+
- [x] ⭐⭐⭐ [Potate Native Component(PNC)](/docs/POTATE_NATIVE_COMPONENT.md)
|
|
312
|
+
- [x] ⭐⭐⭐ [SSR Emotion for Astro](/docs/SSR_EMOTION_FOR_ASTRO.md)
|
|
313
|
+
- [x] ⭐⭐⭐ [SSR Emotion for Vite](/docs/SSR_EMOTION_FOR_VITE.md)
|
|
314
|
+
- [x] ⭐⭐⭐ [reacty(ReactComponent) API](/docs/API.md)
|
|
315
|
+
- [x] ⭐⭐⭐ [watch(resource) API](/docs/API.md)
|
|
311
316
|
- [x] ⭐ The Lanes Light **(Though I haven't cleaned up the no-longer-needed TRANSITION_STATE_TIMED_OUT yet.)**
|
|
312
317
|
- [x] ⭐ The Standalone `startTransition`
|
|
313
318
|
- [x] ⭐ Enhanced `useTransition` hook
|
|
@@ -339,6 +344,7 @@ For the above example, the Brahmos output is 685 bytes, compared to 824 bytes fr
|
|
|
339
344
|
|
|
340
345
|
* Potate Server Components (PSC)
|
|
341
346
|
* Potate Compiler
|
|
347
|
+
* Async SSR
|
|
342
348
|
* `useSyncExternalStore` hook
|
|
343
349
|
* `useOptimistic` hook
|
|
344
350
|
* Superficial Type Definitions: We do not provide type information solely to satisfy IDE warnings unless it directly impacts runtime execution safety.
|
package/bin/potate-cli.mjs
CHANGED
package/dist/astro-client.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createElement as
|
|
1
|
+
import{createElement as l,render as n}from"potatejs";var m=r=>(t,c,o,{client:d})=>{let e=document.createElement("div");n(l(t,c),e),r.replaceChildren(...Array.from(e.childNodes))};export{m as default};
|