ranui 0.2.1-alpha.3 → 0.2.1-alpha.4

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.
Files changed (98) hide show
  1. package/dist/builder.js +1 -1
  2. package/dist/{builtin-BkM0LLof.js → builtin-1lUEp_ro.js} +1 -1
  3. package/dist/{button-D0zcnKnG.js → button-Cj-XSCsd.js} +1 -1
  4. package/dist/button.js +1 -1
  5. package/dist/{card-CygMndQS.js → card-BHN9Xp4S.js} +1 -1
  6. package/dist/card.js +1 -1
  7. package/dist/{checkbox-D5om9aJO.js → checkbox-O_J_n1_W.js} +1 -1
  8. package/dist/checkbox.js +1 -1
  9. package/dist/{colorpicker-qWnaTlYX.js → colorpicker-mebH0XLm.js} +4 -4
  10. package/dist/colorpicker.js +1 -1
  11. package/dist/{content-Rry-U6ir.js → content-YOKzMoc7.js} +1 -1
  12. package/dist/content.js +1 -1
  13. package/dist/{dropdown-DzdAR1nI.js → dropdown-CzGAVWYC.js} +1 -1
  14. package/dist/dropdown.js +1 -1
  15. package/dist/{factory-BkvRcCOx.js → factory-ZNhcQ4tf.js} +127 -127
  16. package/dist/{form-CUJpeQ7Q.js → form-B8afuJlF.js} +1 -1
  17. package/dist/form.js +1 -1
  18. package/dist/{glass-Bj1Zf8Hy.js → glass-BniIptBE.js} +1 -1
  19. package/dist/glass.js +1 -1
  20. package/dist/{icon-CtlZJISZ.js → icon-GZrfSeon.js} +1 -1
  21. package/dist/icon.js +1 -1
  22. package/dist/icons.js +1 -1
  23. package/dist/iife/button.iife.js +1 -1
  24. package/dist/iife/card.iife.js +1 -1
  25. package/dist/iife/checkbox.iife.js +1 -1
  26. package/dist/iife/colorpicker.iife.js +2 -2
  27. package/dist/iife/content.iife.js +1 -1
  28. package/dist/iife/dropdown.iife.js +1 -1
  29. package/dist/iife/form.iife.js +1 -1
  30. package/dist/iife/glass.iife.js +1 -1
  31. package/dist/iife/icon.iife.js +1 -1
  32. package/dist/iife/image.iife.js +1 -1
  33. package/dist/iife/input.iife.js +1 -1
  34. package/dist/iife/loading.iife.js +1 -1
  35. package/dist/iife/math.iife.js +1 -1
  36. package/dist/iife/mermaid.iife.js +1 -1
  37. package/dist/iife/message.iife.js +1 -1
  38. package/dist/iife/modal.iife.js +1 -1
  39. package/dist/iife/player.iife.js +1 -1
  40. package/dist/iife/popover.iife.js +1 -1
  41. package/dist/iife/progress.iife.js +1 -1
  42. package/dist/iife/radar.iife.js +1 -1
  43. package/dist/iife/route.iife.js +1 -1
  44. package/dist/iife/router.iife.js +1 -1
  45. package/dist/iife/scratch.iife.js +1 -1
  46. package/dist/iife/section.iife.js +1 -1
  47. package/dist/iife/select.iife.js +2 -2
  48. package/dist/iife/skeleton.iife.js +1 -1
  49. package/dist/iife/tab.iife.js +1 -1
  50. package/dist/iife/tabpane.iife.js +1 -1
  51. package/dist/iife/theme-switch.iife.js +1 -1
  52. package/dist/{image-ILZNlaGc.js → image-CqoQfJoV.js} +1 -1
  53. package/dist/image.js +1 -1
  54. package/dist/index.cjs +17 -17
  55. package/dist/index.iife.js +204 -204
  56. package/dist/index.js +29 -29
  57. package/dist/{input-CDH6zY9I.js → input-BlwAXu7I.js} +2 -2
  58. package/dist/input.js +1 -1
  59. package/dist/{loading-DJWGih1g.js → loading-M6gWxLbm.js} +1 -1
  60. package/dist/loading.js +1 -1
  61. package/dist/{math-DRmkEDSQ.js → math-8E-45Y8e.js} +1 -1
  62. package/dist/math.js +1 -1
  63. package/dist/{mermaid-CMhm7npE.js → mermaid-C1oQyPE3.js} +2 -2
  64. package/dist/mermaid.js +1 -1
  65. package/dist/{message-BpYJBvYn.js → message-CNdmbeLf.js} +2 -2
  66. package/dist/message.js +1 -1
  67. package/dist/{modal-BeQlDYDP.js → modal-gRagDkTb.js} +1 -1
  68. package/dist/modal.js +1 -1
  69. package/dist/{player-CQ4e3Yeo.js → player-CAQ5Og2P.js} +2 -2
  70. package/dist/player.js +1 -1
  71. package/dist/{popover-eZMnL1F3.js → popover-BZKSLe3D.js} +3 -3
  72. package/dist/popover.js +1 -1
  73. package/dist/{progress-DyHgW4Ep.js → progress-vk40tuhm.js} +1 -1
  74. package/dist/progress.js +1 -1
  75. package/dist/{radar-D21Rccap.js → radar-Bg0cexzU.js} +1 -1
  76. package/dist/radar.js +1 -1
  77. package/dist/{route-pR5P4ann.js → route-CGwS0cd_.js} +1 -1
  78. package/dist/route.js +1 -1
  79. package/dist/{router-CewzSH7O.js → router-BK6DEkcN.js} +1 -1
  80. package/dist/router.js +1 -1
  81. package/dist/{scratch-BFVsgl-7.js → scratch-ClF1awGi.js} +1 -1
  82. package/dist/scratch.js +1 -1
  83. package/dist/{section-DSPCsIxv.js → section-BL0V7Kjf.js} +1 -1
  84. package/dist/section.js +1 -1
  85. package/dist/{select-B58nMfB1.js → select-BIFVbQIj.js} +4 -4
  86. package/dist/select.js +1 -1
  87. package/dist/{skeleton-DoHYMsTn.js → skeleton-D7JIbROq.js} +1 -1
  88. package/dist/skeleton.js +1 -1
  89. package/dist/{tab-BRPdZ9Ws.js → tab-DFVtDJb2.js} +1 -1
  90. package/dist/tab.js +1 -1
  91. package/dist/{tabpane-Owf72hw_.js → tabpane-C3qZGN-D.js} +1 -1
  92. package/dist/tabpane.js +1 -1
  93. package/dist/test/ssr/stream.test.d.ts +1 -0
  94. package/dist/{theme-switch-CZDIIonc.js → theme-switch-BXNH5uPD.js} +44 -44
  95. package/dist/theme-switch.js +1 -1
  96. package/dist/utils/builder/core.d.ts +15 -13
  97. package/docs/BUILDER.md +15 -0
  98. package/package.json +1 -1
package/dist/skeleton.js CHANGED
@@ -1,4 +1,4 @@
1
- import { t as e } from "./skeleton-DoHYMsTn.js";
1
+ import { t as e } from "./skeleton-D7JIbROq.js";
2
2
  export {
3
3
  e as Skeleton,
4
4
  e as default
@@ -1,6 +1,6 @@
1
1
  import { a as b, c, n as f, o as v, r as d, t as p } from "./utils-D1iZnChu.js";
2
2
  import { t as u } from "./events-C59wGdni.js";
3
- import { _ as g, i as h, p as y } from "./factory-BkvRcCOx.js";
3
+ import { _ as g, i as h, p as y } from "./factory-ZNhcQ4tf.js";
4
4
  import { a as A, n as _ } from "./ssr-DSGwPtEd.js";
5
5
  var w = '.remove-wap-active-focus{outline:0;-webkit-tap-highlight-color:transparent}.remove-wap-active-focus:active,.remove-wap-active-focus:focus{outline:0;-webkit-tap-highlight-color:transparent}.ran-tab ::slotted(r-tab){box-sizing:border-box;width:100%;height:100%;padding:10px;flex-shrink:0;overflow:auto;text-align:start}.ran-tab-header{position:relative;overflow:hidden;scroll-behavior:smooth}.ran-tab-header-nav{display:flex;flex-flow:row nowrap;justify-content:flex-start;align-items:center}.ran-tab-header-nav::-webkit-scrollbar{display:none}.ran-tab-header-nav-item{flex-shrink:0}.ran-tab-header-nav .active{color:var(--ran-tab-active-color, var(--ran-color-primary, #006bff))}.ran-tab-header-line{position:absolute;width:0;margin-top:-2px;height:2px;border-radius:2px;background:var(--ran-tab-line-color, var(--ran-color-primary, #006bff));transition:var(--ran-tab-line-transition, left .2s, width .2s, transform .2s)}.ran-tab-content{overflow:hidden}.ran-tab-content-wrap{display:flex;width:100%;height:100%;transition:var(--ran-tab-content-transition, transform .2s)}:host([type="line"]) .ran-tab-header-nav-item{border:solid 1px transparent}:host([type="line"]) .ran-tab-header-nav .active{color:var(--ran-tab-line-color, var(--ran-color-primary, #006bff));border:solid 1px transparent;border-color:var(--ran-tab-border-color, var(--ran-color-border, rgba(0, 0, 0, .2))) var(--ran-tab-border-color, var(--ran-color-border, rgba(0, 0, 0, .2))) transparent;border-radius:var(--ran-tab-border-radius, var(--ran-radius-sm, .25em)) var(--ran-tab-border-radius, var(--ran-radius-sm, .25em)) 0 0}:host([type="line"]) .ran-tab-header-line{transition:none;visibility:hidden}:host([type="line"]) .ran-tab-header-line:after,:host([type="line"]) .ran-tab-header-line:before{content:"";position:absolute;visibility:visible;width:9999px;height:1px;bottom:0;background:var(--ran-tab-border-color, var(--ran-color-border, rgba(0, 0, 0, .2)))}:host([type="line"]) .ran-tab-header-line:after{left:100%}:host([type="line"]) .ran-tab-header-line:before{right:100%}:host([align="center"]) .ran-tab-header-nav{justify-content:center}:host([align="center"]) .ran-tab-header-line{left:50%}:host([align="end"]) .ran-tab-header-nav{justify-content:flex-end}', x = 0, m = class extends _ {
6
6
  static get observedAttributes() {
package/dist/tab.js CHANGED
@@ -1,4 +1,4 @@
1
- import { t } from "./tab-BRPdZ9Ws.js";
1
+ import { t } from "./tab-DFVtDJb2.js";
2
2
  export {
3
3
  t as Tabs,
4
4
  t as default
@@ -1,6 +1,6 @@
1
1
  import { a as s, n as r, o as a, t as n } from "./utils-D1iZnChu.js";
2
2
  import { t as h } from "./events-C59wGdni.js";
3
- import { p as o } from "./factory-BkvRcCOx.js";
3
+ import { p as o } from "./factory-ZNhcQ4tf.js";
4
4
  import { a as b, n as c } from "./ssr-DSGwPtEd.js";
5
5
  var u = ".remove-wap-active-focus{outline:0;-webkit-tap-highlight-color:transparent}.remove-wap-active-focus:active,.remove-wap-active-focus:focus{outline:0;-webkit-tap-highlight-color:transparent}", d = class extends c {
6
6
  static get observedAttributes() {
package/dist/tabpane.js CHANGED
@@ -1,4 +1,4 @@
1
- import { t } from "./tabpane-Owf72hw_.js";
1
+ import { t } from "./tabpane-C3qZGN-D.js";
2
2
  export {
3
3
  t as TabPane,
4
4
  t as default
@@ -1,2 +1,3 @@
1
1
  import '@/components/button/index';
2
2
  import '@/components/progress/index';
3
+ import '@/components/theme-switch/index';
@@ -1,16 +1,18 @@
1
- import { a as i, n as o, o as h, r as c, t as l } from "./utils-D1iZnChu.js";
2
- import { t as d } from "./events-C59wGdni.js";
3
- import { a as u, n as m } from "./ssr-DSGwPtEd.js";
4
- import { i as b, n as v } from "./theme-kOWZbKCq.js";
5
- var g = ".remove-wap-active-focus{outline:0;-webkit-tap-highlight-color:transparent}.remove-wap-active-focus:active,.remove-wap-active-focus:focus{outline:0;-webkit-tap-highlight-color:transparent}:host{display:var(--ran-theme-switch-display, inline-flex);box-sizing:border-box}.ran-theme-switch{display:inline-flex;align-items:center;gap:var(--ran-theme-switch-gap, 2px);padding:var(--ran-theme-switch-padding, 2px);border-width:var(--ran-skin-border-width, 1px);border-style:var(--ran-skin-border-style, solid);border-color:var(--ran-theme-switch-border-color, var(--ran-color-border, #eaeaea));border-radius:var(--ran-theme-switch-radius, var(--ran-radius-full, 9999px));background:var(--ran-theme-switch-background, transparent);box-sizing:border-box}.ran-theme-switch button{width:var(--ran-theme-switch-button-size, 28px);height:var(--ran-theme-switch-button-size, 28px);display:grid;place-items:center;border:none;border-radius:var(--ran-theme-switch-radius, var(--ran-radius-full, 9999px));background:transparent;color:var(--ran-theme-switch-color, var(--ran-color-text-secondary, #4d4d4d));cursor:pointer;padding:0}.ran-theme-switch button:hover{color:var(--ran-theme-switch-hover-color, var(--ran-color-text, #171717))}.ran-theme-switch button[aria-pressed=true]{background:var(--ran-theme-switch-active-background, var(--ran-color-bg-hover, #ebebeb));color:var(--ran-theme-switch-active-color, var(--ran-color-text, #171717))}.ran-theme-switch button:focus-visible{outline:var(--ran-theme-switch-focus-outline, 2px solid var(--ran-color-primary, #006bff));outline-offset:2px}.ran-theme-switch svg{width:var(--ran-theme-switch-icon-size, 16px);height:var(--ran-theme-switch-icon-size, 16px)}", a = [
1
+ import { a as i, n as o, o as h, r as l, t as c } from "./utils-D1iZnChu.js";
2
+ import { c as d } from "./mocks-CMGoftIc.js";
3
+ import { t as u } from "./events-C59wGdni.js";
4
+ import { i as m, n as b } from "./factory-ZNhcQ4tf.js";
5
+ import { a as v, n as p } from "./ssr-DSGwPtEd.js";
6
+ import { i as g, n as w } from "./theme-kOWZbKCq.js";
7
+ var f = ".remove-wap-active-focus{outline:0;-webkit-tap-highlight-color:transparent}.remove-wap-active-focus:active,.remove-wap-active-focus:focus{outline:0;-webkit-tap-highlight-color:transparent}:host{display:var(--ran-theme-switch-display, inline-flex);box-sizing:border-box}.ran-theme-switch{display:inline-flex;align-items:center;gap:var(--ran-theme-switch-gap, 2px);padding:var(--ran-theme-switch-padding, 2px);border-width:var(--ran-skin-border-width, 1px);border-style:var(--ran-skin-border-style, solid);border-color:var(--ran-theme-switch-border-color, var(--ran-color-border, #eaeaea));border-radius:var(--ran-theme-switch-radius, var(--ran-radius-full, 9999px));background:var(--ran-theme-switch-background, transparent);box-sizing:border-box}.ran-theme-switch button{width:var(--ran-theme-switch-button-size, 28px);height:var(--ran-theme-switch-button-size, 28px);display:grid;place-items:center;border:none;border-radius:var(--ran-theme-switch-radius, var(--ran-radius-full, 9999px));background:transparent;color:var(--ran-theme-switch-color, var(--ran-color-text-secondary, #4d4d4d));cursor:pointer;padding:0}.ran-theme-switch button:hover{color:var(--ran-theme-switch-hover-color, var(--ran-color-text, #171717))}.ran-theme-switch button[aria-pressed=true]{background:var(--ran-theme-switch-active-background, var(--ran-color-bg-hover, #ebebeb));color:var(--ran-theme-switch-active-color, var(--ran-color-text, #171717))}.ran-theme-switch button:focus-visible{outline:var(--ran-theme-switch-focus-outline, 2px solid var(--ran-color-primary, #006bff));outline-offset:2px}.ran-theme-switch svg{width:var(--ran-theme-switch-icon-size, 16px);height:var(--ran-theme-switch-icon-size, 16px)}", a = [
6
8
  "system",
7
9
  "light",
8
10
  "dark"
9
- ], p = {
11
+ ], y = {
10
12
  system: '<svg viewBox="0 0 16 16" aria-hidden="true"><rect x="1.5" y="2.5" width="13" height="9" rx="1.5" fill="none" stroke="currentColor" stroke-width="1.5"/><path d="M5.5 14h5" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/></svg>',
11
13
  light: '<svg viewBox="0 0 16 16" aria-hidden="true"><circle cx="8" cy="8" r="3" fill="none" stroke="currentColor" stroke-width="1.5"/><path d="M8 1v1.8M8 13.2V15M15 8h-1.8M2.8 8H1m11.4-4.4-1.3 1.3M4.9 11.1l-1.3 1.3m9.8 0-1.3-1.3M4.9 4.9 3.6 3.6" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/></svg>',
12
14
  dark: '<svg viewBox="0 0 16 16" aria-hidden="true"><path d="M13.5 9.5A6 6 0 0 1 6.5 2.5a6 6 0 1 0 7 7z" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linejoin="round"/></svg>'
13
- }, s = "ran-theme-switch-sync", w = class extends m {
15
+ }, s = "ran-theme-switch-sync", _ = class extends p {
14
16
  static get observedAttributes() {
15
17
  return [
16
18
  "label-system",
@@ -19,70 +21,68 @@ var g = ".remove-wap-active-focus{outline:0;-webkit-tap-highlight-color:transpar
19
21
  "sheet"
20
22
  ];
21
23
  }
22
- _events = new d();
24
+ _events = new u();
23
25
  _shadowDom;
24
26
  _group;
25
27
  constructor() {
26
- super(), this._shadowDom = o(this, g), this._group = l(this._shadowDom, ".ran-theme-switch", () => {
27
- const e = document.createElement("div");
28
- e.className = "ran-theme-switch", e.setAttribute("part", "switch"), e.setAttribute("role", "group");
29
- for (const t of a) {
30
- const r = document.createElement("button");
31
- r.type = "button", r.dataset.choice = t, r.setAttribute("part", `button ${t}`), r.setAttribute("aria-pressed", "false"), r.innerHTML = p[t], e.appendChild(r);
32
- }
33
- return e;
28
+ super(), this._shadowDom = o(this, f), this._group = c(this._shadowDom, ".ran-theme-switch", () => {
29
+ const t = a.map((e) => {
30
+ const r = b().attr("type", "button").data("choice", e).attr("part", `button ${e}`).aria("pressed", "false").build();
31
+ return d || (r.innerHTML = y[e]), r;
32
+ });
33
+ return m().class("ran-theme-switch").attr("part", "switch").role("group").children(t).build();
34
34
  });
35
35
  }
36
36
  get sheet() {
37
- return c(this, "sheet");
37
+ return l(this, "sheet");
38
38
  }
39
- set sheet(e) {
40
- i(this, "sheet", e);
39
+ set sheet(t) {
40
+ i(this, "sheet", t);
41
41
  }
42
42
  get value() {
43
- return v() || "system";
43
+ return w() || "system";
44
44
  }
45
- set value(e) {
46
- a.includes(e) && this._select(e);
45
+ set value(t) {
46
+ a.includes(t) && this._select(t);
47
47
  }
48
- _label(e) {
49
- const t = {
48
+ _label(t) {
49
+ const e = {
50
50
  system: "System theme",
51
51
  light: "Light theme",
52
52
  dark: "Dark theme"
53
- }[e];
54
- return this.getAttribute(`label-${e}`) || t;
53
+ }[t];
54
+ return this.getAttribute(`label-${t}`) || e;
55
55
  }
56
56
  _syncLabels() {
57
57
  this._group.setAttribute("aria-label", this.getAttribute("label") || "Theme");
58
- for (const e of this._group.querySelectorAll("button")) e.setAttribute("aria-label", this._label(e.dataset.choice));
58
+ for (const t of this._group.querySelectorAll("button")) t.setAttribute("aria-label", this._label(t.dataset.choice));
59
59
  }
60
60
  _reflect() {
61
- const e = this.value;
62
- for (const t of this._group.querySelectorAll("button")) t.setAttribute("aria-pressed", t.dataset.choice === e ? "true" : "false");
61
+ const t = this.value;
62
+ for (const e of this._group.querySelectorAll("button")) e.setAttribute("aria-pressed", e.dataset.choice === t ? "true" : "false");
63
63
  }
64
- _select(e) {
65
- b(e), this._reflect(), this._syncMeta(e), document.dispatchEvent(new CustomEvent(s)), this.dispatchEvent(new CustomEvent("change", {
66
- detail: { theme: e },
64
+ _select(t) {
65
+ g(t), this._reflect(), this._syncMeta(t), document.dispatchEvent(new CustomEvent(s)), this.dispatchEvent(new CustomEvent("change", {
66
+ detail: { theme: t },
67
67
  bubbles: !0,
68
68
  composed: !0
69
69
  }));
70
70
  }
71
- _syncMeta(e) {
71
+ _syncMeta(t) {
72
72
  if (typeof requestAnimationFrame > "u") return;
73
- const t = document.querySelectorAll('meta[name="theme-color"]');
74
- t.length && requestAnimationFrame(() => {
75
- for (const r of t)
76
- if (r.dataset.ranOriginalContent === void 0 && (r.dataset.ranOriginalContent = r.getAttribute("content") || ""), e === "system") r.setAttribute("content", r.dataset.ranOriginalContent);
73
+ const e = document.querySelectorAll('meta[name="theme-color"]');
74
+ e.length && requestAnimationFrame(() => {
75
+ for (const r of e)
76
+ if (r.dataset.ranOriginalContent === void 0 && (r.dataset.ranOriginalContent = r.getAttribute("content") || ""), t === "system") r.setAttribute("content", r.dataset.ranOriginalContent);
77
77
  else {
78
78
  const n = getComputedStyle(document.documentElement).getPropertyValue("--ran-color-bg").trim() || getComputedStyle(document.body).backgroundColor;
79
79
  r.setAttribute("content", n);
80
80
  }
81
81
  });
82
82
  }
83
- _handleClick = (e) => {
84
- const t = e.target.closest?.("button")?.dataset.choice;
85
- t && a.includes(t) && this._select(t);
83
+ _handleClick = (t) => {
84
+ const e = t.target.closest?.("button")?.dataset.choice;
85
+ e && a.includes(e) && this._select(e);
86
86
  };
87
87
  _handleSync = () => this._reflect();
88
88
  handlerExternalCss = () => {
@@ -94,11 +94,11 @@ var g = ".remove-wap-active-focus{outline:0;-webkit-tap-highlight-color:transpar
94
94
  disconnectedCallback() {
95
95
  this._events.abort(), document.removeEventListener(s, this._handleSync), typeof window < "u" && window.removeEventListener("storage", this._handleSync);
96
96
  }
97
- attributeChangedCallback(e, t, r) {
98
- t !== r && (e === "sheet" && this.handlerExternalCss(), e.startsWith("label") && this._syncLabels());
97
+ attributeChangedCallback(t, e, r) {
98
+ e !== r && (t === "sheet" && this.handlerExternalCss(), t.startsWith("label") && this._syncLabels());
99
99
  }
100
100
  };
101
- u("r-theme-switch", w);
101
+ v("r-theme-switch", _);
102
102
  export {
103
- w as t
103
+ _ as t
104
104
  };
@@ -1,4 +1,4 @@
1
- import { t as e } from "./theme-switch-CZDIIonc.js";
1
+ import { t as e } from "./theme-switch-BXNH5uPD.js";
2
2
  export {
3
3
  e as ThemeSwitch,
4
4
  e as default
@@ -8,13 +8,14 @@ export declare const createRef: <T extends HTMLElement = HTMLElement>() => Ref<T
8
8
  * Internal helper — the public, general type is {@link Child}. */
9
9
  type StaticChild = HTMLElement | string | ElementBuilder<any> | undefined | null;
10
10
  /**
11
- * The one type every `children()` / `replaceChildren()` argument accepts:
12
- * a node, text, nested builder, `null`/`undefined`, a (nested) array of those,
13
- * a getter `() => …` marking a reactive region (re-evaluated when a signal it
14
- * reads changes; rebuilds the region see docs), or a {@link For} handle for a
15
- * keyed list (reuses nodes across updates). On SSR getters / `For` render once.
11
+ * The one type every `children()` / `replaceChildren()` argument accepts
12
+ * fully composable (recursive): a node, text, nested builder, `null`/`undefined`,
13
+ * a (nested) array, a {@link For}/{@link Index} handle for a keyed list, or a
14
+ * getter `() => Child` marking a reactive region. A getter (or `Show`/`Switch`
15
+ * branch) may itself return any `Child`, including a `For`/`Index` or another
16
+ * getter — control-flow nests freely. On SSR getters / `For` / `Index` render once.
16
17
  */
17
- export type Child = StaticChild | StaticChild[] | (() => StaticChild | StaticChild[]) | ForHandle | IndexHandle;
18
+ export type Child = StaticChild | ForHandle | IndexHandle | Child[] | (() => Child);
18
19
  declare const FOR_BRAND = "__ranFor";
19
20
  /** Options for {@link For}. */
20
21
  export interface ForOptions<T> {
@@ -54,11 +55,12 @@ export declare function For<T>(options: ForOptions<T>): ForHandle;
54
55
  export interface ShowOptions<T> {
55
56
  /** Condition source. Truthy → `children`, falsy → `fallback`. */
56
57
  when: () => T;
57
- /** Built when `when` is truthy. Receives an accessor to the narrowed value
58
+ /** Built when `when` is truthy. May return any {@link Child} a `For`/`Index`
59
+ * list, a nested `Show`, etc. Receives an accessor to the narrowed value —
58
60
  * read it inside a binding (`.text(() => v())`) to update without rebuilding. */
59
- children: (value: () => NonNullable<T>) => StaticChild;
61
+ children: (value: () => NonNullable<T>) => Child;
60
62
  /** Built when `when` is falsy. Omitted → nothing is rendered. */
61
- fallback?: () => StaticChild;
63
+ fallback?: () => Child;
62
64
  }
63
65
  /**
64
66
  * Fine-grained conditional child. Unlike a raw getter child (which re-runs on
@@ -76,11 +78,11 @@ export interface ShowOptions<T> {
76
78
  * `Show` returns a getter, so it is accepted anywhere `children()` takes a child.
77
79
  * Must be created inside a `createRoot` (it owns a memo + the branch effect).
78
80
  */
79
- export declare function Show<T>(options: ShowOptions<T>): () => StaticChild;
81
+ export declare function Show<T>(options: ShowOptions<T>): () => Child;
80
82
  /** One branch of a {@link Switch}; build with {@link Match}. */
81
83
  export interface MatchClause<T> {
82
84
  when: () => T;
83
- children: (value: () => NonNullable<T>) => StaticChild;
85
+ children: (value: () => NonNullable<T>) => Child;
84
86
  }
85
87
  /** Declare one `Switch` branch (identity helper — gives per-clause type inference). */
86
88
  export declare function Match<T>(clause: MatchClause<T>): MatchClause<T>;
@@ -90,7 +92,7 @@ export interface SwitchOptions {
90
92
  * heterogeneous (each `Match<T>` carries its own `T`), hence `any` here. */
91
93
  children: MatchClause<any>[];
92
94
  /** Rendered when no branch matches. Omitted → nothing. */
93
- fallback?: () => StaticChild;
95
+ fallback?: () => Child;
94
96
  }
95
97
  /**
96
98
  * Fine-grained multi-branch conditional (the n-way `Show`). Renders the first
@@ -107,7 +109,7 @@ export interface SwitchOptions {
107
109
  * ],
108
110
  * })
109
111
  */
110
- export declare function Switch(options: SwitchOptions): () => StaticChild;
112
+ export declare function Switch(options: SwitchOptions): () => Child;
111
113
  declare const INDEX_BRAND = "__ranIndex";
112
114
  /** Options for {@link Index}. */
113
115
  export interface IndexOptions<T> {
package/docs/BUILDER.md CHANGED
@@ -195,6 +195,21 @@ Div().children(
195
195
  binding so it updates without rebuilding. `Show` returns a getter, so it slots
196
196
  into `children()` anywhere.
197
197
 
198
+ **Control flow composes.** A `Show`/`Switch` branch (and any reactive getter) may
199
+ return **any `Child`** — including a `For`/`Index` list or a nested `Show` — no
200
+ wrapper element needed:
201
+
202
+ ```ts
203
+ Show({
204
+ when: () => loaded(),
205
+ children: () => For({ each: () => rows(), key: (r) => r.id, render: (r) => Li().text(r.title) }),
206
+ fallback: () => Spinner(),
207
+ });
208
+ ```
209
+
210
+ When the branch flips away, the nested list's scope (its effects) is disposed and
211
+ its nodes removed; re-entering rebuilds fresh from the current source.
212
+
198
213
  ### Multi-branch — `Switch` / `Match`
199
214
 
200
215
  `Switch` is the n-way `Show`: it renders the **first** `Match` whose `when` is
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ranui",
3
- "version": "0.2.1-alpha.3",
3
+ "version": "0.2.1-alpha.4",
4
4
  "description": "A framework-agnostic Web Components UI library built on native custom elements, with TypeScript types, light/dark theming, SSR and PWA support.",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.js",