Skip to content

Commit f3285aa

Browse files
serpentbladeclaude
andcommitted
docs(examples): tab the compiled-output dumps per target via code-group
Each example page stacked six "## <Target> output" sections — one tall scroll per page. Wrap the six rozie-out fences in a VitePress `::: code-group` so readers toggle between Vue / React / Svelte / Angular / Solid / Lit in place. rozie-codegen now injects the target name as the fence `[label]` (with an optional explicit `[Custom]` override) so each block names its tab; the compiled output is still regenerated from the real .rozie source through @rozie/core on every build (no drift). card.md keeps its two components as two labeled groups. Docs build green (147 anchors, 0 broken); rendered HTML carries vp-code-group with six labeled radio tabs per group. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 118b25e commit f3285aa

15 files changed

Lines changed: 100 additions & 167 deletions

docs/.vitepress/rozie-codegen.ts

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,21 @@ const TARGET_LANG: Record<CompileTarget, string> = {
3636
lit: 'ts',
3737
};
3838

39+
/**
40+
* Human-readable tab label per target. Injected as the fence's `[label]` so a
41+
* `rozie-out` block carries its framework name into a VitePress `::: code-group`
42+
* (the label becomes the tab; outside a code-group it renders as the code-block
43+
* title). An explicit trailing `[Custom]` in the fence info overrides this.
44+
*/
45+
const TARGET_LABEL: Record<CompileTarget, string> = {
46+
vue: 'Vue',
47+
react: 'React',
48+
svelte: 'Svelte',
49+
angular: 'Angular',
50+
solid: 'Solid',
51+
lit: 'Lit',
52+
};
53+
3954
const VALID_TARGETS = new Set<string>(Object.keys(TARGET_LANG));
4055

4156
export interface RozieCodegenOptions {
@@ -107,7 +122,12 @@ export function rozieCodegen(
107122
}
108123

109124
if (info.startsWith('rozie-out')) {
110-
const [name, target] = info.slice('rozie-out'.length).trim().split(/\s+/);
125+
const rest = info.slice('rozie-out'.length).trim();
126+
// An optional trailing `[Custom Label]` overrides the derived tab label.
127+
const labelMatch = rest.match(/\[([^\]]*)\]\s*$/);
128+
const explicitLabel = labelMatch ? labelMatch[1].trim() : '';
129+
const spec = labelMatch ? rest.slice(0, labelMatch.index).trim() : rest;
130+
const [name, target] = spec.split(/\s+/);
111131
if (!name || !target) {
112132
throw new Error(
113133
'[rozie-codegen] `rozie-out` needs a component name and a target',
@@ -131,7 +151,10 @@ export function rozieCodegen(
131151
);
132152
}
133153
token.content = result.code;
134-
token.info = TARGET_LANG[target as CompileTarget];
154+
const label = explicitLabel || TARGET_LABEL[target as CompileTarget];
155+
// Language first, then `[label]` — VitePress reads the label to title the
156+
// block / name the code-group tab.
157+
token.info = `${TARGET_LANG[target as CompileTarget]} [${label}]`;
135158
continue;
136159
}
137160
}

docs/examples/card.md

Lines changed: 10 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -39,36 +39,30 @@ Note the auto kebab/camel conversion: the source writes `:on-close="$props.onClo
3939
```rozie-src Card
4040
```
4141

42-
### Card — Vue output
42+
### Card — compiled output
43+
44+
::: code-group
4345

4446
```rozie-out Card vue
4547
```
4648

47-
### Card — React output
48-
4949
```rozie-out Card react
5050
```
5151

52-
### Card — Svelte output
53-
5452
```rozie-out Card svelte
5553
```
5654

57-
### Card — Angular output
58-
5955
```rozie-out Card angular
6056
```
6157

62-
### Card — Solid output
63-
6458
```rozie-out Card solid
6559
```
6660

67-
### Card — Lit output
68-
6961
```rozie-out Card lit
7062
```
7163

64+
:::
65+
7266
---
7367

7468
## CardHeader — source
@@ -78,32 +72,26 @@ A tiny leaf component (~30 lines) — no `<components>` block, no slots, no life
7872
```rozie-src CardHeader
7973
```
8074

81-
### CardHeader — Vue output
75+
### CardHeader — compiled output
76+
77+
::: code-group
8278

8379
```rozie-out CardHeader vue
8480
```
8581

86-
### CardHeader — React output
87-
8882
```rozie-out CardHeader react
8983
```
9084

91-
### CardHeader — Svelte output
92-
9385
```rozie-out CardHeader svelte
9486
```
9587

96-
### CardHeader — Angular output
97-
9888
```rozie-out CardHeader angular
9989
```
10090

101-
### CardHeader — Solid output
102-
10391
```rozie-out CardHeader solid
10492
```
10593

106-
### CardHeader — Lit output
107-
10894
```rozie-out CardHeader lit
10995
```
96+
97+
:::

docs/examples/counter.md

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,32 +26,26 @@ The Counter below is the *actual* `examples/Counter.rozie` file from the monorep
2626
```rozie-src Counter
2727
```
2828

29-
## Vue output
29+
## Compiled output
30+
31+
::: code-group
3032

3133
```rozie-out Counter vue
3234
```
3335

34-
## React output
35-
3636
```rozie-out Counter react
3737
```
3838

39-
## Svelte output
40-
4139
```rozie-out Counter svelte
4240
```
4341

44-
## Angular output
45-
4642
```rozie-out Counter angular
4743
```
4844

49-
## Solid output
50-
5145
```rozie-out Counter solid
5246
```
5347

54-
## Lit output
55-
5648
```rozie-out Counter lit
5749
```
50+
51+
:::

docs/examples/dropdown.md

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -40,32 +40,26 @@ Click the trigger to open. Then try: clicking outside the panel (closes via the
4040
```rozie-src Dropdown
4141
```
4242

43-
## Vue output
43+
## Compiled output
44+
45+
::: code-group
4446

4547
```rozie-out Dropdown vue
4648
```
4749

48-
## React output
49-
5050
```rozie-out Dropdown react
5151
```
5252

53-
## Svelte output
54-
5553
```rozie-out Dropdown svelte
5654
```
5755

58-
## Angular output
59-
6056
```rozie-out Dropdown angular
6157
```
6258

63-
## Solid output
64-
6559
```rozie-out Dropdown solid
6660
```
6761

68-
## Lit output
69-
7062
```rozie-out Dropdown lit
7163
```
64+
65+
:::

docs/examples/flatpickr.md

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -28,36 +28,30 @@ The wrapper is a compact tour of the engine-binding pattern:
2828
```rozie-src Flatpickr
2929
```
3030

31-
## Vue output
31+
## Compiled output
32+
33+
::: code-group
3234

3335
```rozie-out Flatpickr vue
3436
```
3537

36-
## React output
37-
3838
```rozie-out Flatpickr react
3939
```
4040

41-
## Svelte output
42-
4341
```rozie-out Flatpickr svelte
4442
```
4543

46-
## Angular output
47-
4844
```rozie-out Flatpickr angular
4945
```
5046

51-
## Solid output
52-
5347
```rozie-out Flatpickr solid
5448
```
5549

56-
## Lit output
57-
5850
```rozie-out Flatpickr lit
5951
```
6052

53+
:::
54+
6155
## Demo source — FlatpickrDemo.rozie
6256

6357
```rozie-src FlatpickrDemo

docs/examples/line-chart.md

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,36 +27,30 @@ It is the deepest-reactivity example in the set:
2727
```rozie-src Chart
2828
```
2929

30-
## Vue output
30+
## Compiled output
31+
32+
::: code-group
3133

3234
```rozie-out Chart vue
3335
```
3436

35-
## React output
36-
3737
```rozie-out Chart react
3838
```
3939

40-
## Svelte output
41-
4240
```rozie-out Chart svelte
4341
```
4442

45-
## Angular output
46-
4743
```rozie-out Chart angular
4844
```
4945

50-
## Solid output
51-
5246
```rozie-out Chart solid
5347
```
5448

55-
## Lit output
56-
5749
```rozie-out Chart lit
5850
```
5951

52+
:::
53+
6054
## Demo source — LineChartDemo.rozie
6155

6256
```rozie-src LineChartDemo

docs/examples/modal.md

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,32 +32,26 @@ Click the button to open the *actual* `examples/Modal.rozie`. Press Escape, clic
3232
```rozie-src Modal
3333
```
3434

35-
## Vue output
35+
## Compiled output
36+
37+
::: code-group
3638

3739
```rozie-out Modal vue
3840
```
3941

40-
## React output
41-
4242
```rozie-out Modal react
4343
```
4444

45-
## Svelte output
46-
4745
```rozie-out Modal svelte
4846
```
4947

50-
## Angular output
51-
5248
```rozie-out Modal angular
5349
```
5450

55-
## Solid output
56-
5751
```rozie-out Modal solid
5852
```
5953

60-
## Lit output
61-
6254
```rozie-out Modal lit
6355
```
56+
57+
:::

docs/examples/portal-list.md

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -98,32 +98,26 @@ All six targets dispose every active portal mount BEFORE destroying the engine i
9898
```rozie-src PortalListDemo
9999
```
100100

101-
## Vue output
101+
## Compiled output
102+
103+
::: code-group
102104

103105
```rozie-out PortalList vue
104106
```
105107

106-
## React output
107-
108108
```rozie-out PortalList react
109109
```
110110

111-
## Svelte output
112-
113111
```rozie-out PortalList svelte
114112
```
115113

116-
## Angular output
117-
118114
```rozie-out PortalList angular
119115
```
120116

121-
## Solid output
122-
123117
```rozie-out PortalList solid
124118
```
125119

126-
## Lit output
127-
128120
```rozie-out PortalList lit
129121
```
122+
123+
:::

0 commit comments

Comments
 (0)