@rip-lang/ui 0.3.18 → 0.3.20
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 +47 -50
- package/dist/rip-ui.min.js +105 -107
- package/dist/rip-ui.min.js.br +0 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -26,10 +26,6 @@ start port: 3000
|
|
|
26
26
|
|
|
27
27
|
```html
|
|
28
28
|
<script type="module" src="/rip/rip-ui.min.js"></script>
|
|
29
|
-
<script type="text/rip">
|
|
30
|
-
{ launch } = importRip! 'ui.rip'
|
|
31
|
-
launch()
|
|
32
|
-
</script>
|
|
33
29
|
```
|
|
34
30
|
|
|
35
31
|
**`pages/index.rip`** — a page component:
|
|
@@ -365,12 +361,14 @@ dramatically cleaner to use than their React equivalents.
|
|
|
365
361
|
|
|
366
362
|
## How It Works
|
|
367
363
|
|
|
368
|
-
The browser loads one file — `rip-ui.min.js` (~
|
|
364
|
+
The browser loads one file — `rip-ui.min.js` (~53KB Brotli) — which bundles the
|
|
369
365
|
Rip compiler and the pre-compiled UI framework. No runtime compilation of the
|
|
370
366
|
framework, no extra network requests.
|
|
371
367
|
|
|
372
|
-
|
|
373
|
-
|
|
368
|
+
The runtime auto-detects `<script type="text/rip" data-name="...">` components
|
|
369
|
+
on the page and calls `launch()` automatically with hash routing enabled by
|
|
370
|
+
default. For server-rendered apps, `launch()` fetches the app bundle from the
|
|
371
|
+
server. Either way, it hydrates the stash and renders.
|
|
374
372
|
|
|
375
373
|
### Browser Execution Contexts
|
|
376
374
|
|
|
@@ -465,6 +463,8 @@ in the browser.
|
|
|
465
463
|
Embed component source directly in the HTML page:
|
|
466
464
|
|
|
467
465
|
```html
|
|
466
|
+
<script type="module" src="rip-ui.min.js"></script>
|
|
467
|
+
|
|
468
468
|
<script type="text/rip" data-name="index">
|
|
469
469
|
export Home = component
|
|
470
470
|
render
|
|
@@ -477,16 +477,13 @@ Embed component source directly in the HTML page:
|
|
|
477
477
|
render
|
|
478
478
|
button @click: (-> count += 1), "#{count}"
|
|
479
479
|
</script>
|
|
480
|
-
|
|
481
|
-
<script type="text/rip">
|
|
482
|
-
{ launch } = importRip! '/rip/ui.rip'
|
|
483
|
-
launch()
|
|
484
|
-
</script>
|
|
485
480
|
```
|
|
486
481
|
|
|
487
|
-
The `data-name`
|
|
488
|
-
|
|
489
|
-
|
|
482
|
+
The runtime auto-detects `data-name` scripts and launches automatically — no
|
|
483
|
+
bootstrap script needed. The `data-name` attribute maps to the component
|
|
484
|
+
filename (`.rip` extension is added automatically if omitted). Scripts with
|
|
485
|
+
`data-name` are collected as component sources and are not executed as
|
|
486
|
+
top-level code.
|
|
490
487
|
|
|
491
488
|
### 3. Server Bundle (default)
|
|
492
489
|
|
|
@@ -619,26 +616,34 @@ shared components from `includes` stay out of the router.
|
|
|
619
616
|
|
|
620
617
|
## Hash Routing
|
|
621
618
|
|
|
622
|
-
|
|
623
|
-
|
|
619
|
+
Hash routing is **enabled by default** for auto-launched apps — ideal for
|
|
620
|
+
static hosting (GitHub Pages, S3, etc.) where the server can't handle SPA
|
|
621
|
+
fallback routing. URLs use `page.html#/about` instead of `/about`.
|
|
622
|
+
Back/forward navigation, direct URL loading, and `href="#/path"` links all
|
|
623
|
+
work correctly.
|
|
624
624
|
|
|
625
|
-
|
|
626
|
-
|
|
625
|
+
To disable hash routing (e.g., for server-rendered apps with proper fallback):
|
|
626
|
+
|
|
627
|
+
```html
|
|
628
|
+
<script type="module" src="rip-ui.min.js" data-hash="false"></script>
|
|
627
629
|
```
|
|
628
630
|
|
|
629
|
-
|
|
630
|
-
|
|
631
|
+
Or when calling `launch()` manually:
|
|
632
|
+
|
|
633
|
+
```coffee
|
|
634
|
+
launch hash: false
|
|
635
|
+
```
|
|
631
636
|
|
|
632
637
|
## Static Deployment
|
|
633
638
|
|
|
634
639
|
For zero-server deployment, use inline `data-name` scripts or a `components`
|
|
635
|
-
URL list. Both work with `rip-ui.min.js` (~
|
|
636
|
-
server middleware needed.
|
|
640
|
+
URL list. Both work with `rip-ui.min.js` (~53KB Brotli) from a CDN — no
|
|
641
|
+
server middleware needed, no bootstrap script needed.
|
|
637
642
|
|
|
638
643
|
**Inline mode** — everything in one HTML file:
|
|
639
644
|
|
|
640
645
|
```html
|
|
641
|
-
<script type="module" src="
|
|
646
|
+
<script type="module" src="rip-ui.min.js"></script>
|
|
642
647
|
|
|
643
648
|
<script type="text/rip" data-name="index">
|
|
644
649
|
export Home = component
|
|
@@ -651,48 +656,40 @@ server middleware needed.
|
|
|
651
656
|
render
|
|
652
657
|
h1 "About"
|
|
653
658
|
</script>
|
|
659
|
+
```
|
|
654
660
|
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
661
|
+
The runtime auto-detects the `data-name` components and launches with hash
|
|
662
|
+
routing. That's it — no bootstrap, no config.
|
|
663
|
+
|
|
664
|
+
**Remote bundle** — fetch components from a URL:
|
|
665
|
+
|
|
666
|
+
```html
|
|
667
|
+
<script type="module" src="rip-ui.min.js" data-url="https://example.com/app/"></script>
|
|
659
668
|
```
|
|
660
669
|
|
|
661
|
-
|
|
670
|
+
The `data-url` attribute tells the runtime to fetch the app bundle from the
|
|
671
|
+
given URL (appending `/bundle` to the path).
|
|
672
|
+
|
|
673
|
+
**Manual launch** — for full control, use a bare `<script type="text/rip">`:
|
|
662
674
|
|
|
663
675
|
```html
|
|
664
|
-
<script type="module" src="
|
|
676
|
+
<script type="module" src="rip-ui.min.js"></script>
|
|
665
677
|
<script type="text/rip">
|
|
666
678
|
{ launch } = importRip! 'ui.rip'
|
|
667
|
-
launch components: ['components/index.rip', 'components/about.rip']
|
|
679
|
+
launch components: ['components/index.rip', 'components/about.rip']
|
|
668
680
|
</script>
|
|
669
681
|
```
|
|
670
682
|
|
|
671
|
-
**
|
|
683
|
+
**Inline Rip** — run arbitrary Rip code alongside auto-launched apps:
|
|
672
684
|
|
|
673
685
|
```html
|
|
674
|
-
<script type="module" src="dist/rip-ui.min.js"></script>
|
|
675
686
|
<script type="text/rip">
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
launch bundle:
|
|
679
|
-
'/': '''
|
|
680
|
-
export Home = component
|
|
681
|
-
render
|
|
682
|
-
h1 "Hello"
|
|
683
|
-
'''
|
|
684
|
-
'/about': '''
|
|
685
|
-
export About = component
|
|
686
|
-
render
|
|
687
|
-
h1 "About"
|
|
688
|
-
'''
|
|
689
|
-
, hash: true
|
|
687
|
+
alert "Free cheese rollups for the girls!"
|
|
690
688
|
</script>
|
|
691
689
|
```
|
|
692
690
|
|
|
693
|
-
See `docs/
|
|
694
|
-
|
|
695
|
-
static HTML.
|
|
691
|
+
See `docs/results/index.html` for a complete example — a full Lab Results
|
|
692
|
+
brochure app with 7 components, SVG gauges, and inline CSS in one HTML file.
|
|
696
693
|
|
|
697
694
|
## Tailwind CSS Autocompletion
|
|
698
695
|
|