@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
|
@@ -0,0 +1,340 @@
|
|
|
1
|
+
import { parseCssCustomProperties } from "./css-var-parser.js";
|
|
2
|
+
const SPACING_PREFIX = "--spacing-";
|
|
3
|
+
function suffixOf(cssVar) {
|
|
4
|
+
if (cssVar.startsWith(SPACING_PREFIX)) {
|
|
5
|
+
return cssVar.slice(SPACING_PREFIX.length);
|
|
6
|
+
}
|
|
7
|
+
return cssVar.slice(2);
|
|
8
|
+
}
|
|
9
|
+
function idOf(cssVar) {
|
|
10
|
+
return `ui-${suffixOf(cssVar)}`;
|
|
11
|
+
}
|
|
12
|
+
function labelOf(cssVar) {
|
|
13
|
+
const suffix = suffixOf(cssVar);
|
|
14
|
+
const lineHeightMatch = suffix.match(/^(.*)--line-height$/);
|
|
15
|
+
if (lineHeightMatch) return `${lineHeightMatch[1]} / lh`;
|
|
16
|
+
return suffix;
|
|
17
|
+
}
|
|
18
|
+
const FONT_WEIGHT_OPTIONS = ["100", "200", "300", "400", "500", "600", "700", "800", "900"];
|
|
19
|
+
const PALETTE_NAMES = [
|
|
20
|
+
"neutral-0",
|
|
21
|
+
"neutral-1",
|
|
22
|
+
"neutral-2",
|
|
23
|
+
"neutral-3",
|
|
24
|
+
"accent-0",
|
|
25
|
+
"accent-1",
|
|
26
|
+
"accent-2",
|
|
27
|
+
"accent-3",
|
|
28
|
+
"state-danger",
|
|
29
|
+
"state-danger-dark",
|
|
30
|
+
"state-success",
|
|
31
|
+
"state-success-dark",
|
|
32
|
+
"state-warning",
|
|
33
|
+
"state-warning-dark",
|
|
34
|
+
"state-info",
|
|
35
|
+
"state-info-dark",
|
|
36
|
+
"line-vacuum-accent",
|
|
37
|
+
"line-vacuum-accent-dark",
|
|
38
|
+
"line-vacuum-hover",
|
|
39
|
+
"line-vacuum-hover-dark",
|
|
40
|
+
"line-process-accent",
|
|
41
|
+
"line-process-accent-dark",
|
|
42
|
+
"line-process-hover",
|
|
43
|
+
"line-process-hover-dark",
|
|
44
|
+
"line-laser-accent",
|
|
45
|
+
"line-laser-accent-dark",
|
|
46
|
+
"line-laser-hover",
|
|
47
|
+
"line-laser-hover-dark",
|
|
48
|
+
"line-meeting-accent",
|
|
49
|
+
"line-meeting-accent-dark",
|
|
50
|
+
"line-meeting-hover",
|
|
51
|
+
"line-meeting-hover-dark",
|
|
52
|
+
"line-beauty-accent",
|
|
53
|
+
"line-beauty-accent-dark",
|
|
54
|
+
"line-beauty-hover",
|
|
55
|
+
"line-beauty-hover-dark"
|
|
56
|
+
];
|
|
57
|
+
const COLOR_SPECS = [
|
|
58
|
+
{ cssVar: "--color-bg", group: "surface" },
|
|
59
|
+
{ cssVar: "--color-surface", group: "surface" },
|
|
60
|
+
{ cssVar: "--color-surface-2", group: "surface" },
|
|
61
|
+
{ cssVar: "--color-border", group: "surface" },
|
|
62
|
+
{
|
|
63
|
+
cssVar: "--color-loading-scrim",
|
|
64
|
+
group: "surface",
|
|
65
|
+
note: "Translucent frost scrim derived from --color-bg (SPA loading overlay)."
|
|
66
|
+
},
|
|
67
|
+
{ cssVar: "--color-fg", group: "text" },
|
|
68
|
+
{ cssVar: "--color-muted", group: "text" },
|
|
69
|
+
{ cssVar: "--color-accent", group: "accent" },
|
|
70
|
+
{ cssVar: "--color-accent-hover", group: "accent" },
|
|
71
|
+
{
|
|
72
|
+
cssVar: "--color-on-accent",
|
|
73
|
+
group: "accent",
|
|
74
|
+
note: "Foreground token for text/icons on filled accent/state surfaces (consumed via `text-on-accent`)."
|
|
75
|
+
},
|
|
76
|
+
{ cssVar: "--color-focus", group: "accent" },
|
|
77
|
+
{ cssVar: "--color-rail-bg", group: "rail" },
|
|
78
|
+
{ cssVar: "--color-rail-bg-strong", group: "rail" },
|
|
79
|
+
{ cssVar: "--color-rail-fg", group: "rail" },
|
|
80
|
+
{ cssVar: "--color-rail-muted", group: "rail" },
|
|
81
|
+
{ cssVar: "--color-rail-border", group: "rail" },
|
|
82
|
+
{ cssVar: "--color-rail-hover-bg", group: "rail" },
|
|
83
|
+
{ cssVar: "--color-success", group: "state" },
|
|
84
|
+
{ cssVar: "--color-danger", group: "state" },
|
|
85
|
+
{ cssVar: "--color-warning", group: "state" },
|
|
86
|
+
{ cssVar: "--color-info", group: "state" }
|
|
87
|
+
];
|
|
88
|
+
const SPACING_SPECS = [
|
|
89
|
+
{ cssVar: "--spacing-hsp-2xs", group: "hsp", step: 0.025, unit: "rem" },
|
|
90
|
+
{ cssVar: "--spacing-hsp-xs", group: "hsp", step: 0.025, unit: "rem" },
|
|
91
|
+
{ cssVar: "--spacing-hsp-sm", group: "hsp", step: 0.025, unit: "rem" },
|
|
92
|
+
{ cssVar: "--spacing-hsp-md", group: "hsp", step: 0.025, unit: "rem" },
|
|
93
|
+
{ cssVar: "--spacing-hsp-lg", group: "hsp", step: 0.025, unit: "rem" },
|
|
94
|
+
{ cssVar: "--spacing-hsp-xl", group: "hsp", step: 0.025, unit: "rem" },
|
|
95
|
+
{ cssVar: "--spacing-hsp-2xl", group: "hsp", step: 0.025, unit: "rem" },
|
|
96
|
+
{ cssVar: "--spacing-vsp-3xs", group: "vsp", step: 0.025, unit: "rem" },
|
|
97
|
+
{ cssVar: "--spacing-vsp-2xs", group: "vsp", step: 0.025, unit: "rem" },
|
|
98
|
+
{ cssVar: "--spacing-vsp-xs", group: "vsp", step: 0.025, unit: "rem" },
|
|
99
|
+
{ cssVar: "--spacing-vsp-sm", group: "vsp", step: 0.025, unit: "rem" },
|
|
100
|
+
{ cssVar: "--spacing-vsp-md", group: "vsp", step: 0.025, unit: "rem" },
|
|
101
|
+
{ cssVar: "--spacing-vsp-lg", group: "vsp", step: 0.025, unit: "rem" },
|
|
102
|
+
{ cssVar: "--spacing-vsp-xl", group: "vsp", step: 0.025, unit: "rem" },
|
|
103
|
+
{ cssVar: "--spacing-vsp-2xl", group: "vsp", step: 0.025, unit: "rem" }
|
|
104
|
+
];
|
|
105
|
+
const FONT_SPECS = [
|
|
106
|
+
{ cssVar: "--text-xs", group: "font-size", step: 0.05, unit: "rem" },
|
|
107
|
+
{ cssVar: "--text-sm", group: "font-size", step: 0.05, unit: "rem" },
|
|
108
|
+
{ cssVar: "--text-base", group: "font-size", step: 0.05, unit: "rem" },
|
|
109
|
+
{ cssVar: "--text-lg", group: "font-size", step: 0.05, unit: "rem" },
|
|
110
|
+
{ cssVar: "--text-xl", group: "font-size", step: 0.05, unit: "rem" },
|
|
111
|
+
{ cssVar: "--text-2xl", group: "font-size", step: 0.05, unit: "rem" },
|
|
112
|
+
{ cssVar: "--text-xs--line-height", group: "font-size-lh", step: 0.05, unit: "" },
|
|
113
|
+
{ cssVar: "--text-sm--line-height", group: "font-size-lh", step: 0.05, unit: "" },
|
|
114
|
+
{ cssVar: "--text-base--line-height", group: "font-size-lh", step: 0.05, unit: "" },
|
|
115
|
+
{ cssVar: "--text-lg--line-height", group: "font-size-lh", step: 0.05, unit: "" },
|
|
116
|
+
{ cssVar: "--text-xl--line-height", group: "font-size-lh", step: 0.05, unit: "" },
|
|
117
|
+
{ cssVar: "--text-2xl--line-height", group: "font-size-lh", step: 0.05, unit: "" },
|
|
118
|
+
{ cssVar: "--font-weight-normal", group: "font-weight", step: 1, unit: "", control: "select", options: FONT_WEIGHT_OPTIONS },
|
|
119
|
+
{ cssVar: "--font-weight-medium", group: "font-weight", step: 1, unit: "", control: "select", options: FONT_WEIGHT_OPTIONS },
|
|
120
|
+
{ cssVar: "--font-weight-semibold", group: "font-weight", step: 1, unit: "", control: "select", options: FONT_WEIGHT_OPTIONS },
|
|
121
|
+
{ cssVar: "--font-weight-bold", group: "font-weight", step: 1, unit: "", control: "select", options: FONT_WEIGHT_OPTIONS },
|
|
122
|
+
{ cssVar: "--leading-tight", group: "line-height", step: 0.05, unit: "" },
|
|
123
|
+
{ cssVar: "--leading-snug", group: "line-height", step: 0.05, unit: "" },
|
|
124
|
+
{ cssVar: "--leading-normal", group: "line-height", step: 0.05, unit: "" },
|
|
125
|
+
{ cssVar: "--leading-relaxed", group: "line-height", step: 0.05, unit: "" },
|
|
126
|
+
{ cssVar: "--font-sans", group: "font-family", step: 1, unit: "", control: "text" },
|
|
127
|
+
{ cssVar: "--font-mono", group: "font-family", step: 1, unit: "", control: "text" }
|
|
128
|
+
];
|
|
129
|
+
const SIZE_SPECS = [
|
|
130
|
+
// `unit` MUST match the unit the token is authored in, because the panel
|
|
131
|
+
// appends it to whatever bare number the user types. `--radius-full` is
|
|
132
|
+
// the exception: its value really is the px pill sentinel `9999px`.
|
|
133
|
+
{ cssVar: "--radius-DEFAULT", group: "radius", step: 0.05, unit: "rem" },
|
|
134
|
+
{ cssVar: "--radius-sm", group: "radius", step: 0.05, unit: "rem" },
|
|
135
|
+
{ cssVar: "--radius-md", group: "radius", step: 0.05, unit: "rem" },
|
|
136
|
+
{ cssVar: "--radius-lg", group: "radius", step: 0.05, unit: "rem" },
|
|
137
|
+
{ cssVar: "--radius-full", group: "radius", step: 1, unit: "px", pill: { value: "9999px", customDefault: "16px" } },
|
|
138
|
+
{ cssVar: "--shadow-card", group: "shadow", step: 1, unit: "", control: "text" },
|
|
139
|
+
{ cssVar: "--shadow-raised", group: "shadow", step: 1, unit: "", control: "text" },
|
|
140
|
+
{ cssVar: "--shadow-overlay", group: "shadow", step: 1, unit: "", control: "text" }
|
|
141
|
+
];
|
|
142
|
+
function lookup(vars, cssVar, sourceLabel) {
|
|
143
|
+
const value = vars.get(cssVar);
|
|
144
|
+
if (value === void 0) {
|
|
145
|
+
throw new Error(
|
|
146
|
+
`${cssVar} is listed in the token manifest spec but was not found in ${sourceLabel}. Either the CSS var was renamed/removed (update the spec in ui-token-manifest.ts), or this is a real drift.`
|
|
147
|
+
);
|
|
148
|
+
}
|
|
149
|
+
return value;
|
|
150
|
+
}
|
|
151
|
+
function buildPaletteColors(colorVars) {
|
|
152
|
+
return PALETTE_NAMES.map((name) => ({
|
|
153
|
+
name,
|
|
154
|
+
value: lookup(colorVars, `--palette-${name}`, "the colors CSS file")
|
|
155
|
+
}));
|
|
156
|
+
}
|
|
157
|
+
function buildColorTokens(colorVars) {
|
|
158
|
+
return COLOR_SPECS.map(({ cssVar, group, note }) => ({
|
|
159
|
+
id: idOf(cssVar),
|
|
160
|
+
cssVar,
|
|
161
|
+
label: labelOf(cssVar),
|
|
162
|
+
group,
|
|
163
|
+
default: lookup(colorVars, cssVar, "the colors CSS file"),
|
|
164
|
+
step: 1,
|
|
165
|
+
unit: "",
|
|
166
|
+
control: "text",
|
|
167
|
+
...note ? { note } : {}
|
|
168
|
+
}));
|
|
169
|
+
}
|
|
170
|
+
function buildFromSpecs(specs, tokenVars, sourceLabel) {
|
|
171
|
+
return specs.map(({ cssVar, group, step, unit, control, options, pill }) => ({
|
|
172
|
+
id: idOf(cssVar),
|
|
173
|
+
cssVar,
|
|
174
|
+
label: labelOf(cssVar),
|
|
175
|
+
group,
|
|
176
|
+
default: lookup(tokenVars, cssVar, sourceLabel),
|
|
177
|
+
step,
|
|
178
|
+
unit,
|
|
179
|
+
...control ? { control } : {},
|
|
180
|
+
...options ? { options } : {},
|
|
181
|
+
...pill ? { pill } : {}
|
|
182
|
+
}));
|
|
183
|
+
}
|
|
184
|
+
function buildUiTokenManifest({ tokensCss, colorsCss }) {
|
|
185
|
+
const tokenVars = parseCssCustomProperties(tokensCss);
|
|
186
|
+
const colorVars = parseCssCustomProperties(colorsCss);
|
|
187
|
+
return {
|
|
188
|
+
paletteColors: buildPaletteColors(colorVars),
|
|
189
|
+
colorTokens: buildColorTokens(colorVars),
|
|
190
|
+
spacingTokens: buildFromSpecs(SPACING_SPECS, tokenVars, "the tokens CSS file"),
|
|
191
|
+
fontTokens: buildFromSpecs(FONT_SPECS, tokenVars, "the tokens CSS file"),
|
|
192
|
+
sizeTokens: buildFromSpecs(SIZE_SPECS, tokenVars, "the tokens CSS file")
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
function jsStringLiteral(value) {
|
|
196
|
+
return JSON.stringify(value);
|
|
197
|
+
}
|
|
198
|
+
function renderTokenDefObject(token, indent) {
|
|
199
|
+
const pad = " ".repeat(indent);
|
|
200
|
+
const fields = [
|
|
201
|
+
`id: ${jsStringLiteral(token.id)}`,
|
|
202
|
+
`cssVar: ${jsStringLiteral(token.cssVar)}`,
|
|
203
|
+
`label: ${jsStringLiteral(token.label)}`,
|
|
204
|
+
`group: ${jsStringLiteral(token.group)}`,
|
|
205
|
+
`default: ${jsStringLiteral(token.default)}`,
|
|
206
|
+
`step: ${token.step}`,
|
|
207
|
+
`unit: ${jsStringLiteral(token.unit ?? "")}`
|
|
208
|
+
];
|
|
209
|
+
if (token.control) fields.push(`control: ${jsStringLiteral(token.control)}`);
|
|
210
|
+
if (token.options) {
|
|
211
|
+
fields.push(`options: FONT_WEIGHT_OPTIONS`);
|
|
212
|
+
}
|
|
213
|
+
if (token.pill) {
|
|
214
|
+
fields.push(
|
|
215
|
+
`pill: { value: ${jsStringLiteral(token.pill.value)}, customDefault: ${jsStringLiteral(token.pill.customDefault)} }`
|
|
216
|
+
);
|
|
217
|
+
}
|
|
218
|
+
const body = fields.map((f) => `${pad} ${f},`).join("\n");
|
|
219
|
+
const note = token.note ? `${pad}// ${token.note}
|
|
220
|
+
` : "";
|
|
221
|
+
return `${note}${pad}{
|
|
222
|
+
${body}
|
|
223
|
+
${pad}},`;
|
|
224
|
+
}
|
|
225
|
+
function renderPaletteEntry(entry) {
|
|
226
|
+
return ` { name: ${jsStringLiteral(entry.name)}, value: ${jsStringLiteral(entry.value)} },`;
|
|
227
|
+
}
|
|
228
|
+
function renderUiTokenManifestFile(manifest) {
|
|
229
|
+
const paletteLines = manifest.paletteColors.map(renderPaletteEntry).join("\n");
|
|
230
|
+
const colorLines = manifest.colorTokens.map((t) => renderTokenDefObject(t, 2)).join("\n");
|
|
231
|
+
const spacingLines = manifest.spacingTokens.map((t) => renderTokenDefObject(t, 2)).join("\n");
|
|
232
|
+
const fontLines = manifest.fontTokens.map((t) => renderTokenDefObject(t, 2)).join("\n");
|
|
233
|
+
const sizeLines = manifest.sizeTokens.map((t) => renderTokenDefObject(t, 2)).join("\n");
|
|
234
|
+
return `/**
|
|
235
|
+
* Design-token manifest for @zudo-sg/demo-ui target-website tokens.
|
|
236
|
+
*
|
|
237
|
+
* GENERATED \u2014 do not hand-edit. Run \`pnpm gen:token-manifest\` after changing
|
|
238
|
+
* packages/demo-ui/styles/tokens.css or packages/demo-ui/styles/colors.css, then commit
|
|
239
|
+
* the regenerated output. \`pnpm check:token-manifest\` fails on drift.
|
|
240
|
+
*
|
|
241
|
+
* Source of truth: packages/demo-ui/styles/tokens.css and packages/demo-ui/styles/colors.css,
|
|
242
|
+
* parsed by the \`zudo-sg gen-token-manifest\` CLI command
|
|
243
|
+
* (@takazudo/zudo-sg's src/cli/token-manifest/ui-token-manifest.ts). Only
|
|
244
|
+
* \`default\` values are derived from the CSS; \`group\`/\`step\`/\`unit\`/
|
|
245
|
+
* \`control\`/\`options\`/\`pill\` are presentation metadata with no CSS
|
|
246
|
+
* equivalent and are configured in that module's SPECS tables.
|
|
247
|
+
*
|
|
248
|
+
* Covers: Color / Spacing / Font / Size tabs.
|
|
249
|
+
* Does NOT include any --zd-* doc-chrome tokens.
|
|
250
|
+
*/
|
|
251
|
+
import type { TokenDef } from "@takazudo/zdtp";
|
|
252
|
+
|
|
253
|
+
// --- Font weight select options ---
|
|
254
|
+
const FONT_WEIGHT_OPTIONS = [
|
|
255
|
+
"100", "200", "300", "400", "500", "600", "700", "800", "900",
|
|
256
|
+
] as const;
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
* Tier-1 raw palette colors from \`packages/demo-ui/styles/colors.css\` (the \`:root\`
|
|
260
|
+
* \`--palette-{group}-{step-or-role}\` block). This is the raw material beneath the
|
|
261
|
+
* semantic \`--color-*\` tokens in UI_COLOR_TOKENS below \u2014 same three-tier
|
|
262
|
+
* model the doc-chrome panel exposes via \`--palette-*\` ramps and \`--zd-*\`
|
|
263
|
+
* semantic roles.
|
|
264
|
+
*
|
|
265
|
+
* These are plain name/value descriptors (NOT \`TokenDef\`) because zdtp's
|
|
266
|
+
* \`TokenDef.control\` has no \`"color"\` option \u2014 the preview panel builds them
|
|
267
|
+
* into \`{ kind: "color" }\` TierItems inline, mirroring the doc panel's
|
|
268
|
+
* ramp tiers. Rendered as a "Palette" swatch tier in the preview
|
|
269
|
+
* panel's Color tab; editing a swatch pushes \`--palette-*\` to the preview
|
|
270
|
+
* iframes via the sink, cascading into every semantic token that references it.
|
|
271
|
+
*
|
|
272
|
+
* Coverage: ${manifest.paletteColors.length} colors.
|
|
273
|
+
*/
|
|
274
|
+
export interface UiPaletteColor {
|
|
275
|
+
/** Palette key without the \`--palette-\` prefix, e.g. "neutral-2". */
|
|
276
|
+
name: string;
|
|
277
|
+
/** Raw oklch value, from colors.css. */
|
|
278
|
+
value: string;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
export const UI_PALETTE_COLORS: readonly UiPaletteColor[] = [
|
|
282
|
+
${paletteLines}
|
|
283
|
+
];
|
|
284
|
+
|
|
285
|
+
/**
|
|
286
|
+
* Color tokens from \`packages/demo-ui/styles/colors.css\`.
|
|
287
|
+
*
|
|
288
|
+
* All values use light-dark() for dual-scheme support. Defaults here are
|
|
289
|
+
* the full CSS declarations including both light and dark sides.
|
|
290
|
+
* Stored as read-only text rows because light-dark() expressions cannot
|
|
291
|
+
* be driven by a single-axis slider.
|
|
292
|
+
*
|
|
293
|
+
* Coverage: ${manifest.colorTokens.length} tokens total.
|
|
294
|
+
*/
|
|
295
|
+
export const UI_COLOR_TOKENS: readonly TokenDef[] = [
|
|
296
|
+
${colorLines}
|
|
297
|
+
];
|
|
298
|
+
|
|
299
|
+
/**
|
|
300
|
+
* Spacing tokens from \`packages/demo-ui/styles/tokens.css\`.
|
|
301
|
+
*
|
|
302
|
+
* Coverage: ${manifest.spacingTokens.length} tokens total.
|
|
303
|
+
*/
|
|
304
|
+
export const UI_SPACING_TOKENS: readonly TokenDef[] = [
|
|
305
|
+
${spacingLines}
|
|
306
|
+
];
|
|
307
|
+
|
|
308
|
+
/**
|
|
309
|
+
* Font tokens from \`packages/demo-ui/styles/tokens.css\`.
|
|
310
|
+
*
|
|
311
|
+
* Coverage: ${manifest.fontTokens.length} tokens total.
|
|
312
|
+
*/
|
|
313
|
+
export const UI_FONT_TOKENS: readonly TokenDef[] = [
|
|
314
|
+
${fontLines}
|
|
315
|
+
];
|
|
316
|
+
|
|
317
|
+
/**
|
|
318
|
+
* Size tokens from \`packages/demo-ui/styles/tokens.css\`.
|
|
319
|
+
*
|
|
320
|
+
* Coverage: ${manifest.sizeTokens.length} tokens total.
|
|
321
|
+
* \`--radius-full\` carries a pill toggle (sentinel 9999px).
|
|
322
|
+
*/
|
|
323
|
+
export const UI_SIZE_TOKENS: readonly TokenDef[] = [
|
|
324
|
+
${sizeLines}
|
|
325
|
+
];
|
|
326
|
+
`;
|
|
327
|
+
}
|
|
328
|
+
export {
|
|
329
|
+
COLOR_SPECS,
|
|
330
|
+
FONT_SPECS,
|
|
331
|
+
PALETTE_NAMES,
|
|
332
|
+
SIZE_SPECS,
|
|
333
|
+
SPACING_SPECS,
|
|
334
|
+
buildColorTokens,
|
|
335
|
+
buildFromSpecs,
|
|
336
|
+
buildPaletteColors,
|
|
337
|
+
buildUiTokenManifest,
|
|
338
|
+
lookup,
|
|
339
|
+
renderUiTokenManifestFile
|
|
340
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { JSX } from "preact";
|
|
2
|
+
export interface CodePanelVariant {
|
|
3
|
+
exportName: string;
|
|
4
|
+
name: string;
|
|
5
|
+
/** Resolved verbatim source (Story.source ?? meta.usage). */
|
|
6
|
+
source: string;
|
|
7
|
+
}
|
|
8
|
+
export interface CodePanelProps {
|
|
9
|
+
storyTitle: string;
|
|
10
|
+
variants: CodePanelVariant[];
|
|
11
|
+
/** Base-prefixed preview route URL — the same value DetailWorkbench receives. */
|
|
12
|
+
previewUrl?: string;
|
|
13
|
+
}
|
|
14
|
+
declare function CodePanel({ storyTitle, variants, previewUrl, }: CodePanelProps): JSX.Element;
|
|
15
|
+
declare namespace CodePanel {
|
|
16
|
+
var displayName: string;
|
|
17
|
+
}
|
|
18
|
+
export default CodePanel;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "preact/jsx-runtime";
|
|
3
|
+
import { useRef, useState } from "preact/hooks";
|
|
4
|
+
import SourceEditor from "./source-editor.js";
|
|
5
|
+
import CopyButton from "./copy-button.js";
|
|
6
|
+
import { injectCssToAllPreviews } from "./css-injection.js";
|
|
7
|
+
const STARTER_CSS = `/* Live CSS \u2014 edits inject into every preview above.
|
|
8
|
+
Try overriding a component utility, e.g.:
|
|
9
|
+
.btn { letter-spacing: 0.04em; } */
|
|
10
|
+
`;
|
|
11
|
+
function CodePanel({
|
|
12
|
+
storyTitle,
|
|
13
|
+
variants,
|
|
14
|
+
previewUrl
|
|
15
|
+
}) {
|
|
16
|
+
const [activeVariant, setActiveVariant] = useState(
|
|
17
|
+
variants[0]?.exportName ?? ""
|
|
18
|
+
);
|
|
19
|
+
const debounceRef = useRef(void 0);
|
|
20
|
+
const active = variants.find((v) => v.exportName === activeVariant) ?? variants[0];
|
|
21
|
+
function handleCssChange(css) {
|
|
22
|
+
window.clearTimeout(debounceRef.current);
|
|
23
|
+
debounceRef.current = window.setTimeout(() => {
|
|
24
|
+
injectCssToAllPreviews("live", css, previewUrl);
|
|
25
|
+
}, 250);
|
|
26
|
+
}
|
|
27
|
+
return /* @__PURE__ */ jsxs("div", { class: "flex h-full flex-col gap-vsp-md p-hsp-md", children: [
|
|
28
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
29
|
+
/* @__PURE__ */ jsxs("div", { class: "flex items-center justify-between gap-hsp-sm", children: [
|
|
30
|
+
/* @__PURE__ */ jsx("h2", { class: "text-small font-semibold uppercase tracking-wide text-muted", children: "Source" }),
|
|
31
|
+
active && /* @__PURE__ */ jsx(CopyButton, { text: active.source, label: "Copy source" })
|
|
32
|
+
] }),
|
|
33
|
+
variants.length > 1 && /* @__PURE__ */ jsx("div", { role: "tablist", class: "mt-vsp-2xs flex flex-wrap gap-hsp-3xs", children: variants.map((v) => /* @__PURE__ */ jsx(
|
|
34
|
+
"button",
|
|
35
|
+
{
|
|
36
|
+
type: "button",
|
|
37
|
+
role: "tab",
|
|
38
|
+
"aria-selected": v.exportName === activeVariant,
|
|
39
|
+
onClick: () => setActiveVariant(v.exportName),
|
|
40
|
+
class: "px-hsp-xs py-vsp-3xs text-xs rounded-sm border transition-colors " + (v.exportName === activeVariant ? "border-accent bg-accent text-on-accent" : "border-border text-muted hover:text-fg"),
|
|
41
|
+
children: v.name
|
|
42
|
+
},
|
|
43
|
+
v.exportName
|
|
44
|
+
)) }),
|
|
45
|
+
active && /* @__PURE__ */ jsx("div", { class: "mt-vsp-xs", children: /* @__PURE__ */ jsx(
|
|
46
|
+
SourceEditor,
|
|
47
|
+
{
|
|
48
|
+
value: active.source,
|
|
49
|
+
language: "tsx",
|
|
50
|
+
editable: false
|
|
51
|
+
},
|
|
52
|
+
active.exportName
|
|
53
|
+
) })
|
|
54
|
+
] }),
|
|
55
|
+
/* @__PURE__ */ jsxs("div", { class: "flex min-h-0 flex-1 flex-col", children: [
|
|
56
|
+
/* @__PURE__ */ jsx("h2", { class: "text-small font-semibold uppercase tracking-wide text-muted", children: "Live CSS" }),
|
|
57
|
+
/* @__PURE__ */ jsxs("p", { class: "mt-vsp-3xs text-xs text-muted", children: [
|
|
58
|
+
"Injected into the previews above. ",
|
|
59
|
+
storyTitle
|
|
60
|
+
] }),
|
|
61
|
+
/* @__PURE__ */ jsx("div", { class: "mt-vsp-xs min-h-0 flex-1", children: /* @__PURE__ */ jsx(
|
|
62
|
+
SourceEditor,
|
|
63
|
+
{
|
|
64
|
+
value: STARTER_CSS,
|
|
65
|
+
language: "css",
|
|
66
|
+
editable: true,
|
|
67
|
+
onChange: handleCssChange
|
|
68
|
+
}
|
|
69
|
+
) })
|
|
70
|
+
] })
|
|
71
|
+
] });
|
|
72
|
+
}
|
|
73
|
+
CodePanel.displayName = "CodePanel";
|
|
74
|
+
export {
|
|
75
|
+
CodePanel as default
|
|
76
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { JSX } from "preact";
|
|
2
|
+
export declare function copyText(text: string): Promise<boolean>;
|
|
3
|
+
export interface CopyButtonProps {
|
|
4
|
+
/** Verbatim text placed on the clipboard. */
|
|
5
|
+
text: string;
|
|
6
|
+
/** Optional accessible label / tooltip. */
|
|
7
|
+
label?: string;
|
|
8
|
+
/** Extra classes for layout (the visual style is fixed). */
|
|
9
|
+
class?: string;
|
|
10
|
+
}
|
|
11
|
+
declare function CopyButton({ text, label, class: extraClass, }: CopyButtonProps): JSX.Element;
|
|
12
|
+
declare namespace CopyButton {
|
|
13
|
+
var displayName: string;
|
|
14
|
+
}
|
|
15
|
+
export default CopyButton;
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "preact/jsx-runtime";
|
|
3
|
+
import { useState } from "preact/hooks";
|
|
4
|
+
async function copyText(text) {
|
|
5
|
+
try {
|
|
6
|
+
if (typeof navigator !== "undefined" && navigator.clipboard?.writeText) {
|
|
7
|
+
await navigator.clipboard.writeText(text);
|
|
8
|
+
return true;
|
|
9
|
+
}
|
|
10
|
+
} catch {
|
|
11
|
+
}
|
|
12
|
+
try {
|
|
13
|
+
const ta = document.createElement("textarea");
|
|
14
|
+
ta.value = text;
|
|
15
|
+
ta.style.position = "fixed";
|
|
16
|
+
ta.style.opacity = "0";
|
|
17
|
+
document.body.appendChild(ta);
|
|
18
|
+
ta.select();
|
|
19
|
+
const ok = document.execCommand("copy");
|
|
20
|
+
document.body.removeChild(ta);
|
|
21
|
+
return ok;
|
|
22
|
+
} catch {
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
function CopyButton({
|
|
27
|
+
text,
|
|
28
|
+
label = "Copy",
|
|
29
|
+
class: extraClass = ""
|
|
30
|
+
}) {
|
|
31
|
+
const [copied, setCopied] = useState(false);
|
|
32
|
+
async function handleClick() {
|
|
33
|
+
const ok = await copyText(text);
|
|
34
|
+
if (!ok) return;
|
|
35
|
+
setCopied(true);
|
|
36
|
+
window.setTimeout(() => setCopied(false), 1400);
|
|
37
|
+
}
|
|
38
|
+
return /* @__PURE__ */ jsx(
|
|
39
|
+
"button",
|
|
40
|
+
{
|
|
41
|
+
type: "button",
|
|
42
|
+
class: `sg-copy-btn ${extraClass}`,
|
|
43
|
+
onClick: () => void handleClick(),
|
|
44
|
+
"aria-label": copied ? "Copied" : label,
|
|
45
|
+
title: copied ? "Copied" : label,
|
|
46
|
+
"data-copied": copied ? "true" : void 0,
|
|
47
|
+
children: copied ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
48
|
+
/* @__PURE__ */ jsx(
|
|
49
|
+
"svg",
|
|
50
|
+
{
|
|
51
|
+
width: "14",
|
|
52
|
+
height: "14",
|
|
53
|
+
viewBox: "0 0 24 24",
|
|
54
|
+
fill: "none",
|
|
55
|
+
stroke: "currentColor",
|
|
56
|
+
"stroke-width": "2.5",
|
|
57
|
+
"stroke-linecap": "round",
|
|
58
|
+
"stroke-linejoin": "round",
|
|
59
|
+
"aria-hidden": "true",
|
|
60
|
+
children: /* @__PURE__ */ jsx("path", { d: "M20 6 9 17l-5-5" })
|
|
61
|
+
}
|
|
62
|
+
),
|
|
63
|
+
/* @__PURE__ */ jsx("span", { children: "Copied" })
|
|
64
|
+
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
65
|
+
/* @__PURE__ */ jsxs(
|
|
66
|
+
"svg",
|
|
67
|
+
{
|
|
68
|
+
width: "14",
|
|
69
|
+
height: "14",
|
|
70
|
+
viewBox: "0 0 24 24",
|
|
71
|
+
fill: "none",
|
|
72
|
+
stroke: "currentColor",
|
|
73
|
+
"stroke-width": "2",
|
|
74
|
+
"stroke-linecap": "round",
|
|
75
|
+
"stroke-linejoin": "round",
|
|
76
|
+
"aria-hidden": "true",
|
|
77
|
+
children: [
|
|
78
|
+
/* @__PURE__ */ jsx("rect", { x: "9", y: "9", width: "13", height: "13", rx: "2", ry: "2" }),
|
|
79
|
+
/* @__PURE__ */ jsx("path", { d: "M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1" })
|
|
80
|
+
]
|
|
81
|
+
}
|
|
82
|
+
),
|
|
83
|
+
/* @__PURE__ */ jsx("span", { children: "Copy" })
|
|
84
|
+
] })
|
|
85
|
+
}
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
CopyButton.displayName = "CopyButton";
|
|
89
|
+
export {
|
|
90
|
+
copyText,
|
|
91
|
+
CopyButton as default
|
|
92
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Inject `css` (keyed by `cssKey`, e.g. a filename) into all preview iframes.
|
|
3
|
+
* Re-injecting with the same key replaces the prior buffer. `previewUrl` is the
|
|
4
|
+
* (base-prefixed) preview route the iframes load; defaults to PREVIEW_ROUTE_PATH.
|
|
5
|
+
*/
|
|
6
|
+
export declare function injectCssToAllPreviews(cssKey: string, css: string, previewUrl?: string): void;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { PREVIEW_ROUTE_PATH } from "../preview/route.js";
|
|
2
|
+
const INJECTED_STYLE_ATTR = "data-sg-injected-css";
|
|
3
|
+
function previewIframes(previewUrl) {
|
|
4
|
+
if (typeof document === "undefined") return [];
|
|
5
|
+
return Array.from(
|
|
6
|
+
document.querySelectorAll(`iframe[src*="${previewUrl}"]`)
|
|
7
|
+
);
|
|
8
|
+
}
|
|
9
|
+
function injectInto(iframe, cssKey, css) {
|
|
10
|
+
const doc = iframe.contentDocument;
|
|
11
|
+
if (!doc) return;
|
|
12
|
+
const id = `sg-injected-${cssKey}`;
|
|
13
|
+
let style = doc.querySelector(
|
|
14
|
+
`style[${INJECTED_STYLE_ATTR}="${CSS.escape(cssKey)}"]`
|
|
15
|
+
);
|
|
16
|
+
if (!style) {
|
|
17
|
+
style = doc.createElement("style");
|
|
18
|
+
style.setAttribute(INJECTED_STYLE_ATTR, cssKey);
|
|
19
|
+
style.id = id;
|
|
20
|
+
doc.head.appendChild(style);
|
|
21
|
+
}
|
|
22
|
+
style.textContent = css;
|
|
23
|
+
}
|
|
24
|
+
function injectCssToAllPreviews(cssKey, css, previewUrl = PREVIEW_ROUTE_PATH) {
|
|
25
|
+
for (const iframe of previewIframes(previewUrl)) {
|
|
26
|
+
if (iframe.contentDocument?.head) {
|
|
27
|
+
injectInto(iframe, cssKey, css);
|
|
28
|
+
} else {
|
|
29
|
+
iframe.addEventListener("load", () => injectInto(iframe, cssKey, css), {
|
|
30
|
+
once: true
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
export {
|
|
36
|
+
injectCssToAllPreviews
|
|
37
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { EditorView } from "@codemirror/view";
|
|
2
|
+
export interface CreateEditorOptions {
|
|
3
|
+
/** "css" enables the CSS language (live-injection buffer); else TS/JSX. */
|
|
4
|
+
language: "css" | "tsx";
|
|
5
|
+
/** Whether the editor is editable (false = read-only source view). */
|
|
6
|
+
editable: boolean;
|
|
7
|
+
/** Fired on every document change with the full text. */
|
|
8
|
+
onChange?: (value: string) => void;
|
|
9
|
+
}
|
|
10
|
+
export declare function createEditorView(doc: string, parent: HTMLElement, opts: CreateEditorOptions): EditorView;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { EditorView, lineNumbers, keymap } from "@codemirror/view";
|
|
2
|
+
import { EditorState } from "@codemirror/state";
|
|
3
|
+
import { defaultKeymap, history, historyKeymap } from "@codemirror/commands";
|
|
4
|
+
import { javascript } from "@codemirror/lang-javascript";
|
|
5
|
+
import { css } from "@codemirror/lang-css";
|
|
6
|
+
import { oneDark } from "@codemirror/theme-one-dark";
|
|
7
|
+
function createEditorView(doc, parent, opts) {
|
|
8
|
+
const langExtension = opts.language === "css" ? css() : javascript({ jsx: true, typescript: true });
|
|
9
|
+
const extensions = [
|
|
10
|
+
lineNumbers(),
|
|
11
|
+
history(),
|
|
12
|
+
keymap.of([...defaultKeymap, ...historyKeymap]),
|
|
13
|
+
langExtension,
|
|
14
|
+
oneDark,
|
|
15
|
+
EditorView.lineWrapping,
|
|
16
|
+
EditorState.readOnly.of(!opts.editable),
|
|
17
|
+
EditorView.editable.of(opts.editable)
|
|
18
|
+
];
|
|
19
|
+
if (opts.onChange) {
|
|
20
|
+
extensions.push(
|
|
21
|
+
EditorView.updateListener.of((update) => {
|
|
22
|
+
if (update.docChanged) opts.onChange(update.state.doc.toString());
|
|
23
|
+
})
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
return new EditorView({
|
|
27
|
+
state: EditorState.create({ doc, extensions }),
|
|
28
|
+
parent
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
export {
|
|
32
|
+
createEditorView
|
|
33
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { default as CodePanel } from "./code-panel.js";
|
|
2
|
+
export type { CodePanelProps, CodePanelVariant } from "./code-panel.js";
|
|
3
|
+
export { default as CopyButton } from "./copy-button.js";
|
|
4
|
+
export { default as SourceEditor } from "./source-editor.js";
|
|
5
|
+
export type { SourceEditorProps } from "./source-editor.js";
|
|
6
|
+
export { injectCssToAllPreviews } from "./css-injection.js";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { default as default2 } from "./code-panel.js";
|
|
2
|
+
import { default as default3 } from "./copy-button.js";
|
|
3
|
+
import { default as default4 } from "./source-editor.js";
|
|
4
|
+
import { injectCssToAllPreviews } from "./css-injection.js";
|
|
5
|
+
export {
|
|
6
|
+
default2 as CodePanel,
|
|
7
|
+
default3 as CopyButton,
|
|
8
|
+
default4 as SourceEditor,
|
|
9
|
+
injectCssToAllPreviews
|
|
10
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { JSX } from "preact";
|
|
2
|
+
export interface SourceEditorProps {
|
|
3
|
+
value: string;
|
|
4
|
+
language: "css" | "tsx";
|
|
5
|
+
editable?: boolean;
|
|
6
|
+
onChange?: (value: string) => void;
|
|
7
|
+
}
|
|
8
|
+
export default function SourceEditor({ value, language, editable, onChange, }: SourceEditorProps): JSX.Element;
|