@rip-lang/ui 0.3.10 → 0.3.11
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 +101 -6
- package/dist/rip-ui.min.js +66 -66
- package/dist/rip-ui.min.js.br +0 -0
- package/package.json +1 -1
- package/ui.rip +16 -1
package/README.md
CHANGED
|
@@ -209,7 +209,8 @@ The browser loads one file — `rip-ui.min.js` (~52KB Brotli) — which bundles
|
|
|
209
209
|
Rip compiler and the pre-compiled UI framework. No runtime compilation of the
|
|
210
210
|
framework, no extra network requests.
|
|
211
211
|
|
|
212
|
-
Then `launch()`
|
|
212
|
+
Then `launch()` loads component sources (from a server bundle, static files, or
|
|
213
|
+
inline DOM), hydrates the stash, and renders.
|
|
213
214
|
|
|
214
215
|
### Browser Execution Contexts
|
|
215
216
|
|
|
@@ -277,6 +278,66 @@ maps them into a flat `components/` namespace in the bundle — pages go
|
|
|
277
278
|
under `components/`, shared components under `components/_lib/`. The `_`
|
|
278
279
|
prefix tells the router to skip `_lib/` entries when generating routes.
|
|
279
280
|
|
|
281
|
+
## Component Loading Modes
|
|
282
|
+
|
|
283
|
+
`launch()` supports three ways to load component sources, checked in priority
|
|
284
|
+
order. All three produce the same internal bundle format — everything downstream
|
|
285
|
+
(compilation, routing, rendering) works identically regardless of source.
|
|
286
|
+
|
|
287
|
+
### 1. Static File URLs — `launch components: [...]`
|
|
288
|
+
|
|
289
|
+
Fetch individual `.rip` files as plain text from any static server:
|
|
290
|
+
|
|
291
|
+
```coffee
|
|
292
|
+
launch components: [
|
|
293
|
+
'components/index.rip'
|
|
294
|
+
'components/dashboard.rip'
|
|
295
|
+
'components/line-chart.rip'
|
|
296
|
+
]
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
No server middleware needed. Serve `.rip` files as static text from any HTTP
|
|
300
|
+
server, CDN, or `file://` path. Each URL is fetched individually and compiled
|
|
301
|
+
in the browser.
|
|
302
|
+
|
|
303
|
+
### 2. Inline DOM — `<script type="text/rip" data-name="...">`
|
|
304
|
+
|
|
305
|
+
Embed component source directly in the HTML page:
|
|
306
|
+
|
|
307
|
+
```html
|
|
308
|
+
<script type="text/rip" data-name="index">
|
|
309
|
+
export Home = component
|
|
310
|
+
render
|
|
311
|
+
h1 "Hello from inline"
|
|
312
|
+
</script>
|
|
313
|
+
|
|
314
|
+
<script type="text/rip" data-name="counter">
|
|
315
|
+
export Counter = component
|
|
316
|
+
@count := 0
|
|
317
|
+
render
|
|
318
|
+
button @click: (-> count += 1), "#{count}"
|
|
319
|
+
</script>
|
|
320
|
+
|
|
321
|
+
<script type="text/rip">
|
|
322
|
+
{ launch } = importRip! '/rip/ui.rip'
|
|
323
|
+
launch()
|
|
324
|
+
</script>
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
The `data-name` attribute maps to the component filename (`.rip` extension is
|
|
328
|
+
added automatically if omitted). Scripts with `data-name` are collected as
|
|
329
|
+
component sources and are not executed as top-level code.
|
|
330
|
+
|
|
331
|
+
### 3. Server Bundle (default)
|
|
332
|
+
|
|
333
|
+
When neither `components` nor inline `data-name` scripts are present, `launch()`
|
|
334
|
+
fetches the app bundle from the server at `/{app}/bundle`. This is the default
|
|
335
|
+
mode when using the `ripUI` server middleware.
|
|
336
|
+
|
|
337
|
+
```coffee
|
|
338
|
+
launch() # fetches /bundle automatically
|
|
339
|
+
```
|
|
340
|
+
|
|
280
341
|
## Server Middleware
|
|
281
342
|
|
|
282
343
|
The `ripUI` middleware registers routes for the framework files, the app
|
|
@@ -408,12 +469,46 @@ launch '/app', hash: true
|
|
|
408
469
|
This switches from `/about` to `page.html#/about`. Back/forward navigation,
|
|
409
470
|
direct URL loading, and `href="#/path"` links all work correctly.
|
|
410
471
|
|
|
411
|
-
## Static Deployment
|
|
472
|
+
## Static Deployment
|
|
473
|
+
|
|
474
|
+
For zero-server deployment, use inline `data-name` scripts or a `components`
|
|
475
|
+
URL list. Both work with `rip-ui.min.js` (~52KB Brotli) from a CDN — no
|
|
476
|
+
server middleware needed.
|
|
477
|
+
|
|
478
|
+
**Inline mode** — everything in one HTML file:
|
|
479
|
+
|
|
480
|
+
```html
|
|
481
|
+
<script type="module" src="dist/rip-ui.min.js"></script>
|
|
482
|
+
|
|
483
|
+
<script type="text/rip" data-name="index">
|
|
484
|
+
export Home = component
|
|
485
|
+
render
|
|
486
|
+
h1 "Hello"
|
|
487
|
+
</script>
|
|
488
|
+
|
|
489
|
+
<script type="text/rip" data-name="about">
|
|
490
|
+
export About = component
|
|
491
|
+
render
|
|
492
|
+
h1 "About"
|
|
493
|
+
</script>
|
|
494
|
+
|
|
495
|
+
<script type="text/rip">
|
|
496
|
+
{ launch } = importRip! 'ui.rip'
|
|
497
|
+
launch hash: true
|
|
498
|
+
</script>
|
|
499
|
+
```
|
|
500
|
+
|
|
501
|
+
**Static files mode** — `.rip` files served from any HTTP server or CDN:
|
|
502
|
+
|
|
503
|
+
```html
|
|
504
|
+
<script type="module" src="dist/rip-ui.min.js"></script>
|
|
505
|
+
<script type="text/rip">
|
|
506
|
+
{ launch } = importRip! 'ui.rip'
|
|
507
|
+
launch components: ['components/index.rip', 'components/about.rip'], hash: true
|
|
508
|
+
</script>
|
|
509
|
+
```
|
|
412
510
|
|
|
413
|
-
|
|
414
|
-
Use `rip-ui.min.js` (~52KB Brotli) — a combined bundle with the compiler
|
|
415
|
-
and pre-compiled UI framework. No extra network requests, no runtime
|
|
416
|
-
compilation of the framework:
|
|
511
|
+
**Explicit bundle** — pass a bundle object directly:
|
|
417
512
|
|
|
418
513
|
```html
|
|
419
514
|
<script type="module" src="dist/rip-ui.min.js"></script>
|