@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 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` (~52KB Brotli) — which bundles the
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
- Then `launch()` loads component sources (from a server bundle, static files, or
373
- inline DOM), hydrates the stash, and renders.
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` attribute maps to the component filename (`.rip` extension is
488
- added automatically if omitted). Scripts with `data-name` are collected as
489
- component sources and are not executed as top-level code.
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
- For static hosting (GitHub Pages, S3, etc.) where the server can't handle
623
- SPA fallback routing, use hash-based URLs:
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
- ```coffee
626
- launch '/app', hash: true
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
- This switches from `/about` to `page.html#/about`. Back/forward navigation,
630
- direct URL loading, and `href="#/path"` links all work correctly.
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` (~52KB Brotli) from a CDN — no
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="dist/rip-ui.min.js"></script>
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
- <script type="text/rip">
656
- { launch } = importRip! 'ui.rip'
657
- launch hash: true
658
- </script>
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
- **Static files mode** `.rip` files served from any HTTP server or CDN:
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="dist/rip-ui.min.js"></script>
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'], hash: true
679
+ launch components: ['components/index.rip', 'components/about.rip']
668
680
  </script>
669
681
  ```
670
682
 
671
- **Explicit bundle** — pass a bundle object directly:
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
- { launch } = importRip! 'ui.rip'
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/demo.html` for a complete example — the full Rip UI Demo app
694
- (6 components, router, reactive state, persistence) in 337 lines of
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