@takazudo/zudo-sg 0.1.0
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/CHANGELOG.md +35 -0
- package/LICENSE +21 -0
- package/README.md +99 -0
- package/bin/zudo-sg.js +6 -0
- package/dist/catalog/component-thumb.d.ts +78 -0
- package/dist/catalog/component-thumb.js +110 -0
- package/dist/catalog/index.d.ts +4 -0
- package/dist/catalog/index.js +40 -0
- package/dist/catalog/tile-size.d.ts +28 -0
- package/dist/catalog/tile-size.js +42 -0
- package/dist/chrome/_styleguide-layout.d.ts +59 -0
- package/dist/chrome/_styleguide-layout.js +69 -0
- package/dist/chrome/index.d.ts +4 -0
- package/dist/chrome/index.js +39 -0
- package/dist/chrome/panel-contract.d.ts +15 -0
- package/dist/chrome/panel-contract.js +65 -0
- package/dist/chrome/panel-scripts-source.d.ts +2 -0
- package/dist/chrome/panel-scripts-source.js +121 -0
- package/dist/chrome/panel-scripts.d.ts +5 -0
- package/dist/chrome/panel-scripts.js +12 -0
- package/dist/cli/bin.d.ts +1 -0
- package/dist/cli/bin.js +74 -0
- package/dist/cli/config.d.ts +54 -0
- package/dist/cli/config.js +14 -0
- package/dist/cli/registry/build-registry-source.d.ts +27 -0
- package/dist/cli/registry/build-registry-source.js +77 -0
- package/dist/cli/registry/discover-stories.d.ts +36 -0
- package/dist/cli/registry/discover-stories.js +61 -0
- package/dist/cli/registry/gen-registry.d.ts +23 -0
- package/dist/cli/registry/gen-registry.js +74 -0
- package/dist/cli/scaffold/component-scaffold.d.ts +64 -0
- package/dist/cli/scaffold/component-scaffold.js +233 -0
- package/dist/cli/scaffold/new-component.d.ts +17 -0
- package/dist/cli/scaffold/new-component.js +119 -0
- package/dist/cli/token-manifest/css-var-parser.d.ts +9 -0
- package/dist/cli/token-manifest/css-var-parser.js +23 -0
- package/dist/cli/token-manifest/gen-token-manifest.d.ts +16 -0
- package/dist/cli/token-manifest/gen-token-manifest.js +49 -0
- package/dist/cli/token-manifest/ui-token-manifest.d.ts +78 -0
- package/dist/cli/token-manifest/ui-token-manifest.js +340 -0
- package/dist/code-panel/code-panel.d.ts +18 -0
- package/dist/code-panel/code-panel.js +76 -0
- package/dist/code-panel/copy-button.d.ts +15 -0
- package/dist/code-panel/copy-button.js +92 -0
- package/dist/code-panel/css-injection.d.ts +6 -0
- package/dist/code-panel/css-injection.js +37 -0
- package/dist/code-panel/editor-setup.d.ts +10 -0
- package/dist/code-panel/editor-setup.js +33 -0
- package/dist/code-panel/index.d.ts +6 -0
- package/dist/code-panel/index.js +10 -0
- package/dist/code-panel/source-editor.d.ts +8 -0
- package/dist/code-panel/source-editor.js +39 -0
- package/dist/config/index.d.ts +73 -0
- package/dist/config/index.js +68 -0
- package/dist/host-paths.d.ts +19 -0
- package/dist/host-paths.js +41 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +18 -0
- package/dist/islands.d.ts +2 -0
- package/dist/islands.js +6 -0
- package/dist/plugins/preview-css.d.ts +53 -0
- package/dist/plugins/preview-css.js +183 -0
- package/dist/plugins/routes.d.ts +84 -0
- package/dist/plugins/routes.js +237 -0
- package/dist/plugins/zdtp-apply-proxy.d.ts +58 -0
- package/dist/plugins/zdtp-apply-proxy.js +171 -0
- package/dist/preview/detail-workbench.d.ts +22 -0
- package/dist/preview/detail-workbench.js +179 -0
- package/dist/preview/index.d.ts +8 -0
- package/dist/preview/index.js +21 -0
- package/dist/preview/messages.d.ts +34 -0
- package/dist/preview/messages.js +32 -0
- package/dist/preview/preview-app.d.ts +11 -0
- package/dist/preview/preview-app.js +87 -0
- package/dist/preview/route.d.ts +1 -0
- package/dist/preview/route.js +5 -0
- package/dist/preview/variant-frame.d.ts +42 -0
- package/dist/preview/variant-frame.js +289 -0
- package/dist/preview-css/compile.d.ts +40 -0
- package/dist/preview-css/compile.js +42 -0
- package/dist/preview-css/index.d.ts +2 -0
- package/dist/preview-css/index.js +10 -0
- package/dist/registry/component-docs.d.ts +38 -0
- package/dist/registry/component-docs.js +34 -0
- package/dist/registry/index.d.ts +6 -0
- package/dist/registry/index.js +28 -0
- package/dist/registry/nav-nodes.d.ts +22 -0
- package/dist/registry/nav-nodes.js +36 -0
- package/dist/registry/registry.d.ts +68 -0
- package/dist/registry/registry.js +91 -0
- package/dist/safelist.css +2 -0
- package/dist/search/catalog-filter.d.ts +12 -0
- package/dist/search/catalog-filter.js +175 -0
- package/dist/search/index.d.ts +2 -0
- package/dist/search/index.js +4 -0
- package/dist/sg-context.d.ts +24 -0
- package/dist/sg-context.js +6 -0
- package/dist/sg-routes.d.ts +12 -0
- package/dist/sg-routes.js +17 -0
- package/dist/stories/index.d.ts +2 -0
- package/dist/stories/index.js +4 -0
- package/dist/stories/types.d.ts +164 -0
- package/dist/stories/types.js +6 -0
- package/dist/token-dashboard/create-token-dashboards.d.ts +24 -0
- package/dist/token-dashboard/create-token-dashboards.js +57 -0
- package/dist/token-dashboard/dashboard-inventory.d.ts +11 -0
- package/dist/token-dashboard/dashboard-inventory.js +13 -0
- package/dist/token-dashboard/index.d.ts +5 -0
- package/dist/token-dashboard/index.js +20 -0
- package/dist/token-dashboard/ui-token-tabs.d.ts +53 -0
- package/dist/token-dashboard/ui-token-tabs.js +159 -0
- package/dist/token-tweak/bootstrap-preview-token-panel.d.ts +12 -0
- package/dist/token-tweak/bootstrap-preview-token-panel.js +18 -0
- package/dist/token-tweak/iframe-css-vars-bridge.d.ts +35 -0
- package/dist/token-tweak/iframe-css-vars-bridge.js +73 -0
- package/dist/token-tweak/index.d.ts +6 -0
- package/dist/token-tweak/index.js +36 -0
- package/dist/token-tweak/preview-iframe-registry.d.ts +16 -0
- package/dist/token-tweak/preview-iframe-registry.js +48 -0
- package/dist/token-tweak/preview-token-panel-bootstrap.d.ts +6 -0
- package/dist/token-tweak/preview-token-panel-bootstrap.js +17 -0
- package/dist/token-tweak/preview-token-panel-config.d.ts +42 -0
- package/dist/token-tweak/preview-token-panel-config.js +37 -0
- package/dist/token-tweak/preview-tokens-button.d.ts +5 -0
- package/dist/token-tweak/preview-tokens-button.js +17 -0
- package/dist/token-tweak/token-panel-native-bootstrap.d.ts +17 -0
- package/dist/token-tweak/token-panel-native-bootstrap.js +49 -0
- package/package.json +172 -0
- package/routes-src/_chrome.tsx +83 -0
- package/routes-src/_context.ts +15 -0
- package/routes-src/_preview-app.tsx +32 -0
- package/routes-src/_registry.ts +12 -0
- package/routes-src/components-index.tsx +95 -0
- package/routes-src/components-preview.tsx +55 -0
- package/routes-src/components-slug.tsx +145 -0
- package/routes-src/tokens.tsx +76 -0
- package/styles.css +612 -0
- package/virtual-modules.d.ts +25 -0
package/styles.css
ADDED
|
@@ -0,0 +1,612 @@
|
|
|
1
|
+
/* ============================================================================
|
|
2
|
+
* @takazudo/zudo-sg — catalog, chrome and search CSS (#653, #661)
|
|
3
|
+
*
|
|
4
|
+
* Hand-authored package stylesheet (ADR docs/adr/styleguide-engine.md
|
|
5
|
+
* decision "Chrome CSS moves to the package root file"), shipped as the
|
|
6
|
+
* package-root `files` entry and exported as `@takazudo/zudo-sg/styles.css`
|
|
7
|
+
* (a host imports the package specifier, never this relative path).
|
|
8
|
+
*
|
|
9
|
+
* CONSUMER IMPORT ORDER (locked by the ADR, decision 10 "Consumer CSS
|
|
10
|
+
* order"): a host imports, in this order —
|
|
11
|
+
* 1. @takazudo/zudo-doc/features.css
|
|
12
|
+
* 2. @takazudo/zudo-sg/styles.css (this file)
|
|
13
|
+
* 3. @takazudo/zudo-sg/safelist.css (generated `@source inline(...)`
|
|
14
|
+
* from `dist/**\/*.js`, covers the
|
|
15
|
+
* Tailwind utility classes this file
|
|
16
|
+
* and the package's `.tsx` sources
|
|
17
|
+
* reference — e.g. `bg-accent`,
|
|
18
|
+
* `px-hsp-md` — for hosts that fall
|
|
19
|
+
* back to explicit @source scanning)
|
|
20
|
+
* 4. the host's own project `@theme {}` block
|
|
21
|
+
* The host keeps its OWN `@source` directives for its own component package
|
|
22
|
+
* (e.g. `@source "../../packages/demo-ui/src/**"`) — the engine's safelist only
|
|
23
|
+
* covers the engine package's compiled output, never consumer code.
|
|
24
|
+
*
|
|
25
|
+
* Combines what used to be two host files:
|
|
26
|
+
* - src/features/styleguide/styles.css (#sg-code-panel layout / sticky /
|
|
27
|
+
* resizer / responsive, [data-sg-*-hidden] toggle rules, and the .sg-*
|
|
28
|
+
* feature class family for chrome + search + the detail workbench toolbar)
|
|
29
|
+
* - src/features/styleguide/catalog/gallery.css (the inline-SSR thumbnail
|
|
30
|
+
* framing model: virtual viewport + scale + fit, the tile grid, and the
|
|
31
|
+
* tile-size segmented control)
|
|
32
|
+
* kept in the same relative order so the cascade is unchanged from before the
|
|
33
|
+
* move.
|
|
34
|
+
* ========================================================================== */
|
|
35
|
+
|
|
36
|
+
:root {
|
|
37
|
+
/* Header height — referenced by the native header and the code panel's sticky
|
|
38
|
+
* offset. Matches DocLayout's fixed header offset (`top-[3.5rem]`).
|
|
39
|
+
* Selector/var names stay in sync with src/chrome/panel-contract.ts. */
|
|
40
|
+
--sg-header-h: 3.5rem;
|
|
41
|
+
/* Default code-panel width — the resizer (chrome/panel-scripts.tsx) overrides
|
|
42
|
+
* this var per-user at runtime in px, so this stays the single source of the
|
|
43
|
+
* default width. The panel and the preview share one band bounded by the
|
|
44
|
+
* sidebar, so every px the panel takes at rest comes straight out of the
|
|
45
|
+
* previews the route exists to show. The floor still clears
|
|
46
|
+
* MIN_CODE_PANEL_W in panel-contract.ts. */
|
|
47
|
+
--sg-code-panel-w: clamp(18rem, 26vw, 26rem);
|
|
48
|
+
/* Code-panel resizer grab-strip width — no shared spacing rung matches
|
|
49
|
+
* 10px, so this stays a dedicated local constant. The strip is centered
|
|
50
|
+
* over the panel's 1px left border via the calc() below (left = -half
|
|
51
|
+
* width). */
|
|
52
|
+
--sg-code-panel-resizer-w: 0.625rem; /* 10px */
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/* ── Code panel: right-region layout (fills DocLayout's TOC column) ──
|
|
56
|
+
* Frame VISUALS: the left bar/gutter is owned here so it is guaranteed to
|
|
57
|
+
* render (the element carries no native border utility) — a 1px border-ladder
|
|
58
|
+
* divider + hsp-lg left padding + vsp-md block margin match the reference's
|
|
59
|
+
* right code-area frame (issue #60). Below the side-by-side breakpoint this
|
|
60
|
+
* swaps for a top divider (see the max-width:1279px block). --color-border,
|
|
61
|
+
* not --color-muted (a TEXT token), keeps structural dividers separate from
|
|
62
|
+
* text roles. */
|
|
63
|
+
#sg-code-panel {
|
|
64
|
+
position: relative;
|
|
65
|
+
flex-shrink: 0;
|
|
66
|
+
width: var(--sg-code-panel-w);
|
|
67
|
+
align-self: stretch;
|
|
68
|
+
margin-block: var(--spacing-vsp-md);
|
|
69
|
+
padding-left: var(--spacing-hsp-lg);
|
|
70
|
+
border-left: 1px solid var(--color-border);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/* Side-by-side only from 1280px (#541, raised from 1024): between the two the
|
|
74
|
+
* band minus the sidebar leaves the preview and the panel squeezing each
|
|
75
|
+
* other, so mid-widths stack instead. Matches DocLayout's own xl TOC-column
|
|
76
|
+
* breakpoint. */
|
|
77
|
+
@media (min-width: 1280px) {
|
|
78
|
+
#sg-code-panel {
|
|
79
|
+
position: sticky;
|
|
80
|
+
top: var(--sg-header-h);
|
|
81
|
+
max-height: calc(100vh - var(--sg-header-h));
|
|
82
|
+
overflow-y: auto;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/* Resizer handle — absolutely positioned grab strip at the code panel's edge,
|
|
87
|
+
* targeted by its data-attr (the drag wiring in panel-scripts.tsx uses the same
|
|
88
|
+
* attribute). Under the styleguide accent budget, hover is a resting/decorative
|
|
89
|
+
* tint — neutral. The [data-sg-dragging] active-drag state is the
|
|
90
|
+
* whitelisted pressed-control role, so it keeps the accent tint. The keyboard
|
|
91
|
+
* focus outline (panel-scripts-source.ts's ACCENT_OUTLINE) is untouched — also
|
|
92
|
+
* a whitelisted role. (The sidebar's own resizer is provided by DocLayout /
|
|
93
|
+
* SidebarResizerInit.) */
|
|
94
|
+
#sg-code-panel [data-sg-code-panel-resizer] {
|
|
95
|
+
position: absolute;
|
|
96
|
+
top: 0;
|
|
97
|
+
bottom: 0;
|
|
98
|
+
left: calc(var(--sg-code-panel-resizer-w) / -2);
|
|
99
|
+
width: var(--sg-code-panel-resizer-w);
|
|
100
|
+
cursor: col-resize;
|
|
101
|
+
z-index: var(--z-index-local-1);
|
|
102
|
+
background: transparent;
|
|
103
|
+
}
|
|
104
|
+
#sg-code-panel [data-sg-code-panel-resizer]:hover {
|
|
105
|
+
background: color-mix(in oklch, var(--color-border-strong) 50%, transparent);
|
|
106
|
+
}
|
|
107
|
+
#sg-code-panel [data-sg-code-panel-resizer][data-sg-dragging] {
|
|
108
|
+
background: color-mix(in oklch, var(--color-accent) 30%, transparent);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/* Visibility toggle for the code panel. */
|
|
112
|
+
:root[data-sg-code-panel-hidden] #sg-code-panel {
|
|
113
|
+
display: none;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/* Below the side-by-side breakpoint the framework .zd-doc-content-band stays an
|
|
117
|
+
* unconditional flex row — it never wraps on its own. Force a column stack
|
|
118
|
+
* when the code panel is present so it lands below the preview, then keep the
|
|
119
|
+
* panel full-width, swap its left border for a top divider, and drop the
|
|
120
|
+
* resizer. */
|
|
121
|
+
@media (max-width: 1279px) {
|
|
122
|
+
.zd-doc-content-band:has(#sg-code-panel) {
|
|
123
|
+
flex-direction: column;
|
|
124
|
+
gap: 0;
|
|
125
|
+
align-items: stretch;
|
|
126
|
+
}
|
|
127
|
+
#sg-code-panel {
|
|
128
|
+
width: 100%;
|
|
129
|
+
position: static;
|
|
130
|
+
max-height: none;
|
|
131
|
+
/* Floor for the flex-1 min-h-0 Live-CSS CodeMirror editor — without a
|
|
132
|
+
* fixed ancestor height the editor collapses to ~0 in column flow. */
|
|
133
|
+
min-height: 24rem;
|
|
134
|
+
margin-block-start: 0; /* cancel base margin-block so the border-top divider sits flush */
|
|
135
|
+
border-left: 0;
|
|
136
|
+
border-top: 1px solid var(--color-border);
|
|
137
|
+
/* CodePanel keeps its own p-hsp-md breathing room; subtract that inner
|
|
138
|
+
* inset so the visible SOURCE content aligns with <main>'s 24px edge. */
|
|
139
|
+
padding-inline: calc(var(--spacing-hsp-xl) - var(--spacing-hsp-md));
|
|
140
|
+
|
|
141
|
+
@media (min-width: 1024px) {
|
|
142
|
+
padding-inline: calc(var(--spacing-hsp-2xl) - var(--spacing-hsp-md));
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
#sg-code-panel [data-sg-code-panel-resizer] {
|
|
146
|
+
display: none;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/* ============================================================================
|
|
151
|
+
* Styleguide catalog content + interactive affordances
|
|
152
|
+
* ========================================================================== */
|
|
153
|
+
|
|
154
|
+
/* --- Copy-to-clipboard button (snippets + code panel) --------------------- */
|
|
155
|
+
.sg-copy-btn {
|
|
156
|
+
display: inline-flex;
|
|
157
|
+
align-items: center;
|
|
158
|
+
gap: var(--spacing-hsp-2xs);
|
|
159
|
+
padding: var(--spacing-vsp-3xs) var(--spacing-hsp-xs);
|
|
160
|
+
border: 1px solid var(--color-border);
|
|
161
|
+
border-radius: var(--radius-sm);
|
|
162
|
+
background: var(--color-surface);
|
|
163
|
+
color: var(--color-muted);
|
|
164
|
+
font-size: var(--text-micro);
|
|
165
|
+
line-height: 1;
|
|
166
|
+
cursor: pointer;
|
|
167
|
+
transition:
|
|
168
|
+
color 0.15s ease,
|
|
169
|
+
border-color 0.15s ease,
|
|
170
|
+
background-color 0.15s ease;
|
|
171
|
+
}
|
|
172
|
+
@media (hover: hover) {
|
|
173
|
+
.sg-copy-btn:hover {
|
|
174
|
+
color: var(--color-fg);
|
|
175
|
+
border-color: var(--color-border);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
.sg-copy-btn:focus-visible {
|
|
179
|
+
outline: 2px solid var(--color-focus);
|
|
180
|
+
outline-offset: 2px;
|
|
181
|
+
}
|
|
182
|
+
.sg-copy-btn[data-copied] {
|
|
183
|
+
color: var(--color-success);
|
|
184
|
+
border-color: var(--color-success);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/* --- Landing search + tag filter ------------------------------------------ */
|
|
188
|
+
.sg-filter {
|
|
189
|
+
display: flex;
|
|
190
|
+
flex-direction: column;
|
|
191
|
+
gap: var(--spacing-vsp-sm);
|
|
192
|
+
margin-bottom: var(--spacing-vsp-xl);
|
|
193
|
+
}
|
|
194
|
+
.sg-filter-row {
|
|
195
|
+
display: flex;
|
|
196
|
+
flex-wrap: wrap;
|
|
197
|
+
align-items: center;
|
|
198
|
+
gap: var(--spacing-hsp-md);
|
|
199
|
+
}
|
|
200
|
+
.sg-search-field {
|
|
201
|
+
display: flex;
|
|
202
|
+
flex: 1;
|
|
203
|
+
min-width: 14rem;
|
|
204
|
+
align-items: center;
|
|
205
|
+
gap: var(--spacing-hsp-sm);
|
|
206
|
+
padding: var(--spacing-vsp-xs) var(--spacing-hsp-md);
|
|
207
|
+
border: 1px solid var(--color-border);
|
|
208
|
+
border-radius: var(--radius-lg);
|
|
209
|
+
background: var(--color-surface);
|
|
210
|
+
transition: border-color 0.15s ease;
|
|
211
|
+
}
|
|
212
|
+
.sg-search-field:focus-within {
|
|
213
|
+
border-color: var(--color-accent);
|
|
214
|
+
}
|
|
215
|
+
.sg-search-input {
|
|
216
|
+
flex: 1;
|
|
217
|
+
min-width: 0;
|
|
218
|
+
border: 0;
|
|
219
|
+
background: transparent;
|
|
220
|
+
color: var(--color-fg);
|
|
221
|
+
font-size: var(--text-small);
|
|
222
|
+
outline: none;
|
|
223
|
+
}
|
|
224
|
+
.sg-search-input::placeholder {
|
|
225
|
+
color: var(--color-muted);
|
|
226
|
+
}
|
|
227
|
+
.sg-search-input::-webkit-search-cancel-button {
|
|
228
|
+
appearance: none;
|
|
229
|
+
}
|
|
230
|
+
.sg-search-clear {
|
|
231
|
+
display: inline-flex;
|
|
232
|
+
align-items: center;
|
|
233
|
+
justify-content: center;
|
|
234
|
+
width: var(--spacing-icon-md);
|
|
235
|
+
height: var(--spacing-icon-md);
|
|
236
|
+
border: 0;
|
|
237
|
+
border-radius: var(--radius-full);
|
|
238
|
+
background: var(--color-surface-2);
|
|
239
|
+
color: var(--color-muted);
|
|
240
|
+
font-size: var(--text-small);
|
|
241
|
+
line-height: 1;
|
|
242
|
+
cursor: pointer;
|
|
243
|
+
}
|
|
244
|
+
.sg-search-clear:hover {
|
|
245
|
+
color: var(--color-fg);
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
/* --- Chips (category filter + token copy-mode) ---------------------------- */
|
|
249
|
+
.sg-chip-row {
|
|
250
|
+
display: flex;
|
|
251
|
+
flex-wrap: wrap;
|
|
252
|
+
gap: var(--spacing-hsp-xs);
|
|
253
|
+
}
|
|
254
|
+
.sg-chip {
|
|
255
|
+
padding: var(--spacing-vsp-3xs) var(--spacing-hsp-md);
|
|
256
|
+
border: 1px solid var(--color-border);
|
|
257
|
+
border-radius: var(--radius-full);
|
|
258
|
+
background: var(--color-surface);
|
|
259
|
+
color: var(--color-muted);
|
|
260
|
+
font-size: var(--text-caption);
|
|
261
|
+
cursor: pointer;
|
|
262
|
+
transition:
|
|
263
|
+
color 0.15s ease,
|
|
264
|
+
border-color 0.15s ease,
|
|
265
|
+
background-color 0.15s ease;
|
|
266
|
+
}
|
|
267
|
+
@media (hover: hover) {
|
|
268
|
+
.sg-chip:hover {
|
|
269
|
+
border-color: var(--color-border);
|
|
270
|
+
color: var(--color-fg);
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
.sg-chip:focus-visible {
|
|
274
|
+
outline: 2px solid var(--color-focus);
|
|
275
|
+
outline-offset: 2px;
|
|
276
|
+
}
|
|
277
|
+
.sg-chip[aria-pressed="true"] {
|
|
278
|
+
background: var(--color-accent);
|
|
279
|
+
border-color: var(--color-accent);
|
|
280
|
+
color: var(--color-on-accent);
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
/* --- Detail-page workbench toolbar ---------------------------------------- */
|
|
284
|
+
/* One page-level toolbar owns theme / viewport / layout / code-panel /
|
|
285
|
+
* preview-tokens for every stage below it (see preview/detail-workbench.tsx).
|
|
286
|
+
*/
|
|
287
|
+
.sg-workbench-toolbar {
|
|
288
|
+
display: flex;
|
|
289
|
+
flex-wrap: wrap;
|
|
290
|
+
align-items: center;
|
|
291
|
+
gap: var(--spacing-hsp-md);
|
|
292
|
+
margin-bottom: var(--spacing-vsp-md);
|
|
293
|
+
padding: var(--spacing-vsp-2xs) var(--spacing-hsp-md);
|
|
294
|
+
border: 1px solid var(--color-border);
|
|
295
|
+
border-radius: var(--radius-lg);
|
|
296
|
+
/* Opaque — the stages scroll underneath it when it is pinned below. */
|
|
297
|
+
background: var(--color-surface);
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
/* Pinned only in the side-by-side desktop layout, where the strip is one or two
|
|
301
|
+
* rows and keeping "show this in dark" one click away part way down a long
|
|
302
|
+
* variant list is the whole point of hoisting these controls out of the stage
|
|
303
|
+
* headers. It wraps to four rows on a phone, where pinning would spend a fifth
|
|
304
|
+
* of the viewport on chrome for the entire scroll. */
|
|
305
|
+
@media (min-width: 1280px) {
|
|
306
|
+
.sg-workbench-toolbar {
|
|
307
|
+
position: sticky;
|
|
308
|
+
top: var(--sg-header-h);
|
|
309
|
+
/* Above the stages it scrolls over; below the framework header band. */
|
|
310
|
+
z-index: var(--z-index-local-2);
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
/* zdtp 0.8 paints regions but leaves their padded inventory wrapper transparent. */
|
|
315
|
+
#ui-defaults-light > .zdtp-dashboard__inventory {
|
|
316
|
+
background: var(--zdtp-dashboard-light-bg);
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
#ui-defaults-dark > .zdtp-dashboard__inventory {
|
|
320
|
+
background: var(--zdtp-dashboard-dark-bg);
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
@media (prefers-reduced-motion: reduce) {
|
|
324
|
+
.sg-copy-btn,
|
|
325
|
+
.sg-chip,
|
|
326
|
+
.sg-search-field {
|
|
327
|
+
transition: none;
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
/* ============================================================================
|
|
332
|
+
* /components catalogue gallery — inline, server-rendered thumbnails (#540)
|
|
333
|
+
*
|
|
334
|
+
* The catalogue used to be N blocks of text. Each tile now carries the real
|
|
335
|
+
* component, rendered SERVER-SIDE into the static HTML (see
|
|
336
|
+
* src/catalog/component-thumb.tsx) — no iframes, so the page costs no extra
|
|
337
|
+
* runtime and the thumbnails survive JS being disabled.
|
|
338
|
+
*
|
|
339
|
+
* THE FRAMING MODEL (the load-bearing part of this section)
|
|
340
|
+
*
|
|
341
|
+
* A component squeezed into a 272px tile renders its MOBILE layout and tells
|
|
342
|
+
* you nothing about the component. So each thumbnail is a two-box sandwich:
|
|
343
|
+
*
|
|
344
|
+
* .sg-thumb the visible tile slot — fluid width (the grid track),
|
|
345
|
+
* 16:10, clipped.
|
|
346
|
+
* .sg-thumb-inner a VIRTUAL VIEWPORT: a real desktop-width layout box
|
|
347
|
+
* (~720px, or ~400px for atom-scale categories) that is
|
|
348
|
+
* scaled down onto the slot with `transform: scale()`.
|
|
349
|
+
*
|
|
350
|
+
* The scale is a plain number — `track-min ÷ virtual-viewport-width` — and the
|
|
351
|
+
* virtual viewport's width is derived back out of it as `100% / scale`. That
|
|
352
|
+
* inversion is what keeps the layout honest while the track stays fluid: at
|
|
353
|
+
* the nominal track width the component lays out at exactly its virtual width,
|
|
354
|
+
* and in a stretched track it lays out slightly WIDER (never squeezed), with
|
|
355
|
+
* the apparent text size identical in every tile because the scale is constant.
|
|
356
|
+
*
|
|
357
|
+
* WHY THE VIRTUAL VIEWPORT ALSO CARRIES THE ASPECT RATIO
|
|
358
|
+
* `transform` does not affect layout, so alignment decided in the tile's own
|
|
359
|
+
* coordinate space would compare a 450px-tall layout box against a 170px-tall
|
|
360
|
+
* slot and top-anchor everything. Giving the virtual viewport the SAME 16:10
|
|
361
|
+
* ratio makes its height the exact pre-image of the slot's height, so
|
|
362
|
+
* `align-content: safe center` decides fit at full scale and is then scaled
|
|
363
|
+
* down with everything else: a component that fits is centred, one that
|
|
364
|
+
* overflows is top-anchored (`safe` falls back to `start`) and clipped, never
|
|
365
|
+
* cropped at both ends.
|
|
366
|
+
*
|
|
367
|
+
* PALETTE SCOPE — load-bearing, see the block on `.sg-thumb[data-sg-preview-scope]`.
|
|
368
|
+
* ========================================================================== */
|
|
369
|
+
|
|
370
|
+
:root {
|
|
371
|
+
/* Grid track minimum for the tile-size control, as a UNITLESS number so the
|
|
372
|
+
* scale below can divide by it. `--sg-tile-min-n * 1px` is its length twin.
|
|
373
|
+
* Compact is the default; `data-sg-tile-size` is set on <html> by the
|
|
374
|
+
* catalogue's restore script + segmented control (see catalog/tile-size.ts).
|
|
375
|
+
* Keep these two numbers in sync with TILE_SIZES there — the unit test
|
|
376
|
+
* asserts they match. */
|
|
377
|
+
--sg-tile-min-n: 272;
|
|
378
|
+
/* Virtual-viewport width, unitless. Overridden per tile (inline style) to
|
|
379
|
+
* THUMB_VIEWPORT_W_ATOM for the atom-scale categories. */
|
|
380
|
+
--sg-thumb-vw-n: 720;
|
|
381
|
+
}
|
|
382
|
+
:root[data-sg-tile-size="large"] {
|
|
383
|
+
--sg-tile-min-n: 400;
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
/* --- Catalogue grid ------------------------------------------------------- */
|
|
387
|
+
|
|
388
|
+
.sg-gallery-section {
|
|
389
|
+
margin-bottom: var(--spacing-vsp-xl);
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
.sg-grid {
|
|
393
|
+
display: grid;
|
|
394
|
+
/* `min(100%, …)` keeps a single track from exceeding the band on narrow
|
|
395
|
+
* viewports — without it the 400px Large track overflows a 390px phone and
|
|
396
|
+
* the whole page scrolls horizontally. */
|
|
397
|
+
grid-template-columns: repeat(
|
|
398
|
+
auto-fill,
|
|
399
|
+
minmax(min(100%, calc(var(--sg-tile-min-n) * 1px)), 1fr)
|
|
400
|
+
);
|
|
401
|
+
gap: var(--spacing-hsp-lg);
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
.sg-tile {
|
|
405
|
+
display: flex;
|
|
406
|
+
flex-direction: column;
|
|
407
|
+
min-width: 0;
|
|
408
|
+
overflow: hidden;
|
|
409
|
+
border: 1px solid var(--color-border);
|
|
410
|
+
border-radius: var(--radius-md);
|
|
411
|
+
background: var(--color-surface);
|
|
412
|
+
transition: border-color 0.15s ease;
|
|
413
|
+
}
|
|
414
|
+
/* Resting hover is neutral (accent budget): the border ladder steps up rather
|
|
415
|
+
* than spending accent on a pointer state. */
|
|
416
|
+
@media (hover: hover) {
|
|
417
|
+
.sg-tile:has(> [data-sg-card]:hover) {
|
|
418
|
+
border-color: var(--color-border-strong);
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
.sg-tile:has(> [data-sg-card]:focus-visible) {
|
|
422
|
+
border-color: var(--color-border-strong);
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
/* --- Thumbnail slot ------------------------------------------------------- */
|
|
426
|
+
|
|
427
|
+
.sg-thumb {
|
|
428
|
+
position: relative;
|
|
429
|
+
aspect-ratio: 16 / 10;
|
|
430
|
+
overflow: hidden;
|
|
431
|
+
border-bottom: 1px solid var(--color-border);
|
|
432
|
+
background: var(--color-bg);
|
|
433
|
+
/* Decorative: the tile's anchor is the only interactive element. `inert` on
|
|
434
|
+
* the element itself removes the rendered component from the tab order and
|
|
435
|
+
* the accessibility tree; this is the pointer half of the same guarantee. */
|
|
436
|
+
pointer-events: none;
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
/* PALETTE SCOPE.
|
|
440
|
+
*
|
|
441
|
+
* A host `@theme` typically RE-ASSERTS the overlapping `--color-*` names to
|
|
442
|
+
* its own doc-chrome roles at `:root` (0,1,0), so a component rendered on a
|
|
443
|
+
* doc-chrome page would silently take the DOC palette instead of its own.
|
|
444
|
+
* This selector is (0,2,0) — class + attribute — so it wins over `:root`
|
|
445
|
+
* regardless of @import order, and is scoped to the thumbnail so the
|
|
446
|
+
* surrounding catalogue chrome keeps the doc palette.
|
|
447
|
+
*
|
|
448
|
+
* The declarations below are the canonical Tier-2 provider values (see
|
|
449
|
+
* packages/demo-ui/styles/colors.css) restored for exactly the names a host is
|
|
450
|
+
* likely to re-assert. The ui-only names a host does NOT typically re-assert
|
|
451
|
+
* (surface-2, rail-*, focus, on-accent, loading-scrim) already resolve to the
|
|
452
|
+
* ui palette and need no restore here. */
|
|
453
|
+
.sg-thumb[data-sg-preview-scope] {
|
|
454
|
+
--color-bg: light-dark(var(--palette-neutral-0), var(--palette-neutral-3));
|
|
455
|
+
--color-surface: light-dark(var(--palette-neutral-0), var(--palette-neutral-3));
|
|
456
|
+
--color-fg: light-dark(var(--palette-neutral-3), var(--palette-neutral-0));
|
|
457
|
+
--color-muted: light-dark(var(--palette-neutral-2), var(--palette-neutral-1));
|
|
458
|
+
--color-accent: light-dark(var(--palette-accent-2), var(--palette-accent-1));
|
|
459
|
+
--color-accent-hover: light-dark(var(--palette-accent-3), var(--palette-accent-0));
|
|
460
|
+
/* Restore the provider border after a host's doc-ramp re-assertion. */
|
|
461
|
+
--color-border: light-dark(var(--palette-neutral-1), var(--palette-neutral-2));
|
|
462
|
+
--color-success: light-dark(var(--palette-state-success), var(--palette-state-success-dark));
|
|
463
|
+
--color-danger: light-dark(var(--palette-state-danger), var(--palette-state-danger-dark));
|
|
464
|
+
--color-warning: light-dark(var(--palette-state-warning), var(--palette-state-warning-dark));
|
|
465
|
+
--color-info: light-dark(var(--palette-state-info), var(--palette-state-info-dark));
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
/* Bottom fade for a component taller than its slot. Painted in the slot's own
|
|
469
|
+
* background, so over the empty space under a component that fits it is
|
|
470
|
+
* invisible — no measurement needed to decide whether to show it. */
|
|
471
|
+
.sg-thumb::after {
|
|
472
|
+
content: "";
|
|
473
|
+
position: absolute;
|
|
474
|
+
inset-inline: 0;
|
|
475
|
+
bottom: 0;
|
|
476
|
+
height: var(--spacing-vsp-md);
|
|
477
|
+
background: linear-gradient(to top, var(--color-bg), transparent);
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
.sg-thumb-inner {
|
|
481
|
+
/* The virtual viewport. `100% / scale` resolves to the nominal virtual width
|
|
482
|
+
* at the nominal track width, and a little wider in a stretched track. */
|
|
483
|
+
--sg-thumb-scale: calc(var(--sg-tile-min-n) / var(--sg-thumb-vw-n));
|
|
484
|
+
width: calc(100% / var(--sg-thumb-scale));
|
|
485
|
+
aspect-ratio: 16 / 10;
|
|
486
|
+
overflow: hidden;
|
|
487
|
+
padding: var(--spacing-hsp-xl);
|
|
488
|
+
display: grid;
|
|
489
|
+
/* Fallback first: a browser without the `safe` keyword top-anchors, which is
|
|
490
|
+
* the outcome that never crops. */
|
|
491
|
+
align-content: start;
|
|
492
|
+
align-content: safe center;
|
|
493
|
+
transform: scale(var(--sg-thumb-scale));
|
|
494
|
+
/* Also establishes the containing block for any `position: fixed` descendant
|
|
495
|
+
* (e.g. a mobile nav's fixed bar), so a thumbnail cannot escape its tile. */
|
|
496
|
+
transform-origin: top left;
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
/* Documented per-component opt-out (THUMB_OPT_OUTS): a static, legible note in
|
|
500
|
+
* place of a rendered component, at tile scale rather than virtual scale. */
|
|
501
|
+
.sg-thumb-note {
|
|
502
|
+
display: flex;
|
|
503
|
+
height: 100%;
|
|
504
|
+
align-items: center;
|
|
505
|
+
justify-content: center;
|
|
506
|
+
padding: var(--spacing-hsp-lg);
|
|
507
|
+
color: var(--color-muted);
|
|
508
|
+
font-size: var(--text-caption);
|
|
509
|
+
text-align: center;
|
|
510
|
+
text-wrap: balance;
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
/* --- Tile meta (the card link) -------------------------------------------- */
|
|
514
|
+
|
|
515
|
+
.sg-tile-meta {
|
|
516
|
+
display: flex;
|
|
517
|
+
min-width: 0;
|
|
518
|
+
flex: 1;
|
|
519
|
+
flex-direction: column;
|
|
520
|
+
gap: var(--spacing-vsp-3xs);
|
|
521
|
+
padding: var(--spacing-hsp-md);
|
|
522
|
+
color: inherit;
|
|
523
|
+
text-decoration: none;
|
|
524
|
+
}
|
|
525
|
+
.sg-tile-meta:focus-visible {
|
|
526
|
+
outline: 2px solid var(--color-focus);
|
|
527
|
+
outline-offset: calc(-2 * var(--spacing-px));
|
|
528
|
+
}
|
|
529
|
+
.sg-tile-title {
|
|
530
|
+
color: var(--color-fg);
|
|
531
|
+
font-size: var(--text-caption);
|
|
532
|
+
font-weight: 600;
|
|
533
|
+
}
|
|
534
|
+
/* Links carry an underline affordance for pointer AND keyboard alike. */
|
|
535
|
+
.sg-tile-meta:hover .sg-tile-title,
|
|
536
|
+
.sg-tile-meta:focus-visible .sg-tile-title {
|
|
537
|
+
text-decoration: underline;
|
|
538
|
+
}
|
|
539
|
+
.sg-tile-desc {
|
|
540
|
+
/* Two-line clamp keeps every tile in a row the same height. */
|
|
541
|
+
display: -webkit-box;
|
|
542
|
+
overflow: hidden;
|
|
543
|
+
-webkit-box-orient: vertical;
|
|
544
|
+
-webkit-line-clamp: 2;
|
|
545
|
+
color: var(--color-muted);
|
|
546
|
+
font-size: var(--text-caption);
|
|
547
|
+
line-height: var(--leading-snug);
|
|
548
|
+
}
|
|
549
|
+
.sg-tile-count {
|
|
550
|
+
margin-top: auto;
|
|
551
|
+
color: var(--color-muted);
|
|
552
|
+
/* True metadata (a count) — the one role --text-micro is for. */
|
|
553
|
+
font-size: var(--text-micro);
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
/* --- Segmented control (tile size) ---------------------------------------- */
|
|
557
|
+
|
|
558
|
+
.sg-seg {
|
|
559
|
+
display: inline-flex;
|
|
560
|
+
gap: var(--spacing-hsp-2xs);
|
|
561
|
+
padding: var(--spacing-hsp-2xs);
|
|
562
|
+
border: 1px solid var(--color-border);
|
|
563
|
+
border-radius: var(--radius-md);
|
|
564
|
+
background: var(--color-surface);
|
|
565
|
+
}
|
|
566
|
+
.sg-seg-btn {
|
|
567
|
+
position: relative;
|
|
568
|
+
padding: var(--spacing-vsp-3xs) var(--spacing-hsp-md);
|
|
569
|
+
border: 0;
|
|
570
|
+
border-radius: var(--radius-sm);
|
|
571
|
+
background: transparent;
|
|
572
|
+
color: var(--color-muted);
|
|
573
|
+
font-size: var(--text-caption);
|
|
574
|
+
cursor: pointer;
|
|
575
|
+
transition:
|
|
576
|
+
background-color 0.15s ease,
|
|
577
|
+
color 0.15s ease;
|
|
578
|
+
}
|
|
579
|
+
@media (hover: hover) {
|
|
580
|
+
.sg-seg-btn:hover {
|
|
581
|
+
color: var(--color-fg);
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
.sg-seg-btn:focus-visible {
|
|
585
|
+
outline: 2px solid var(--color-focus);
|
|
586
|
+
outline-offset: 2px;
|
|
587
|
+
}
|
|
588
|
+
/* Selected = NEUTRAL raised fill. The house accent budget is one filled-accent
|
|
589
|
+
* element per viewport and the catalogue already spends it on the pressed
|
|
590
|
+
* category chip, so selection here is carried by the raised surface plus the
|
|
591
|
+
* accent UNDERLINE marker below — never an accent background. */
|
|
592
|
+
.sg-seg-btn[aria-pressed="true"] {
|
|
593
|
+
background: var(--color-surface-2);
|
|
594
|
+
box-shadow: var(--shadow-card);
|
|
595
|
+
color: var(--color-fg);
|
|
596
|
+
}
|
|
597
|
+
.sg-seg-btn[aria-pressed="true"]::after {
|
|
598
|
+
content: "";
|
|
599
|
+
position: absolute;
|
|
600
|
+
inset-inline: var(--spacing-hsp-md);
|
|
601
|
+
bottom: var(--spacing-hsp-2xs);
|
|
602
|
+
height: calc(2 * var(--spacing-px));
|
|
603
|
+
border-radius: var(--radius-full);
|
|
604
|
+
background: var(--color-accent);
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
@media (prefers-reduced-motion: reduce) {
|
|
608
|
+
.sg-tile,
|
|
609
|
+
.sg-seg-btn {
|
|
610
|
+
transition: none;
|
|
611
|
+
}
|
|
612
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// GENERATED FILE — DO NOT EDIT.
|
|
2
|
+
// Built from src/routes/_virtual.d.ts by scripts/copy-virtual-modules.mjs
|
|
3
|
+
// (tsup onSuccess). Host code importing virtual:zudo-sg-context /
|
|
4
|
+
// virtual:zudo-sg-registry typechecks by referencing this file.
|
|
5
|
+
|
|
6
|
+
// Ambient declarations for the virtual modules registered by
|
|
7
|
+
// `@takazudo/zudo-sg/plugins/routes`. Source of truth for the shipped
|
|
8
|
+
// package-root `virtual-modules.d.ts` (generated by
|
|
9
|
+
// scripts/copy-virtual-modules.mjs, which rewrites the parent-relative
|
|
10
|
+
// `import(...)` specifiers below to bare `@takazudo/zudo-sg/*` subpaths).
|
|
11
|
+
// Only inline `import(...)` types are allowed here — a top-level import would
|
|
12
|
+
// turn the ambient blocks into module augmentations.
|
|
13
|
+
|
|
14
|
+
declare module "virtual:zudo-sg-context" {
|
|
15
|
+
export const sgContext: import("@takazudo/zudo-sg/sg-context").SgContext;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
declare module "virtual:zudo-sg-registry" {
|
|
19
|
+
export const storyModules: Record<string, import("@takazudo/zudo-sg/stories").StoryModule>;
|
|
20
|
+
export const storyExportOrder: Record<string, string[]>;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
declare module "virtual:zudo-sg-tokens" {
|
|
24
|
+
export const tokensManifest: import("@takazudo/zudo-sg/token-dashboard").UiDesignTokensManifest | null;
|
|
25
|
+
}
|