@backmatter/studio 0.0.7 → 0.0.9

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 (72) hide show
  1. package/dist/chunks/UiKitApp-b8qFsmA-.js +2401 -0
  2. package/dist/chunks/WorkspaceRoutes-BKKEkAq7.js +90126 -0
  3. package/dist/chunks/{dashboard-DCHRI0WD.js → dashboard-BNUcbYU0.js} +380 -382
  4. package/dist/chunks/{index-BS0-Bvbk.js → index-laWAz5_p.js} +111 -112
  5. package/dist/dashboard.js +2 -2
  6. package/dist/index.js +287 -146
  7. package/dist/site-widget.css +1615 -0
  8. package/dist/site-widget.js +30896 -630
  9. package/dist/studio.css +303 -98
  10. package/package.json +4 -4
  11. package/src/App.tsx +12 -29
  12. package/src/api.ts +55 -0
  13. package/src/chat/ChangeCard.tsx +2 -0
  14. package/src/chat/ChatMessage.tsx +73 -62
  15. package/src/chat/ChatPanel.tsx +110 -15
  16. package/src/chat/DocListCard.tsx +2 -0
  17. package/src/chat/LiveStatus.tsx +78 -8
  18. package/src/chat/Reveal.tsx +34 -0
  19. package/src/chat/Shimmer.tsx +65 -23
  20. package/src/chat/chat-helpers.ts +35 -0
  21. package/src/chat/motion.ts +73 -0
  22. package/src/chat/useStickToBottom.ts +129 -14
  23. package/src/chrome/AppShell.tsx +47 -10
  24. package/src/chrome/AppSidebar.tsx +9 -34
  25. package/src/chrome/ContentExplorerSidebar.tsx +149 -96
  26. package/src/chrome/UserMenu.tsx +3 -1
  27. package/src/chrome/content-tree-visibility.ts +55 -0
  28. package/src/chrome/explorer-icons.tsx +2 -4
  29. package/src/devbar-state.ts +125 -0
  30. package/src/index.css +3 -131
  31. package/src/pages/CliAuthorizePage.tsx +61 -28
  32. package/src/pages/MediaGalleryPage.tsx +144 -85
  33. package/src/pages/MediaLightbox.tsx +195 -96
  34. package/src/pages/SelectRepositoriesLink.tsx +28 -4
  35. package/src/pages/SettingsGeneralPage.tsx +25 -28
  36. package/src/pages/SettingsGithubPage.tsx +413 -124
  37. package/src/pages/SettingsUsagePage.tsx +23 -1
  38. package/src/pages/media-grid.ts +14 -1
  39. package/src/pages/ui-kit/UiKitApp.tsx +164 -0
  40. package/src/pages/ui-kit/buttons.tsx +30 -0
  41. package/src/pages/ui-kit/catalog.tsx +41 -0
  42. package/src/pages/ui-kit/colors.tsx +95 -0
  43. package/src/pages/ui-kit/devbar.tsx +160 -0
  44. package/src/pages/ui-kit/feedback.tsx +39 -0
  45. package/src/pages/ui-kit/fields.tsx +47 -0
  46. package/src/pages/ui-kit/lists.tsx +19 -0
  47. package/src/pages/ui-kit/overlays.tsx +39 -0
  48. package/src/pages/ui-kit/path.ts +9 -0
  49. package/src/pages/ui-kit/sections.tsx +32 -0
  50. package/src/pages/ui-kit/surfaces.tsx +121 -0
  51. package/src/pages/ui-kit/topic.tsx +112 -0
  52. package/src/pages/ui-kit/topics.ts +71 -0
  53. package/src/pages/ui-kit/type.tsx +55 -0
  54. package/src/preview-frame-radius.ts +51 -0
  55. package/src/preview-frame.tsx +93 -49
  56. package/src/shell-resets.css +155 -0
  57. package/src/site-bar.tsx +1791 -425
  58. package/src/site-dashboard-href.ts +21 -0
  59. package/src/site-devbar-overlay-inject.ts +15 -0
  60. package/src/site-devbar-overlay.css +217 -0
  61. package/src/site-pointer.ts +1 -1
  62. package/src/site-publish-menu.tsx +33 -0
  63. package/src/site-widget-styles.ts +7 -0
  64. package/src/site-widget.tsx +61 -21
  65. package/src/studio-prose-ui.css +39 -0
  66. package/src/theme/ThemeProvider.tsx +4 -1
  67. package/src/workspace-path.ts +18 -1
  68. package/dist/chunks/EmbedPublishPage-88VsmOhi.js +0 -149
  69. package/dist/chunks/UiKitPage-X4hkFL2d.js +0 -173
  70. package/dist/chunks/WorkspaceRoutes-DXzdWqN3.js +0 -59523
  71. package/dist/chunks/status-bar-action-wj1KZ51m.js +0 -30612
  72. package/src/pages/UiKitPage.tsx +0 -331
@@ -1,331 +0,0 @@
1
- // packages/studio/src/pages/UiKitPage.tsx
2
- import { useState } from "react";
3
- import * as stylex from "@stylexjs/stylex";
4
- import { StatusBar, StatusItem } from "../chrome/StatusBar";
5
- import { colors, radius, space, type } from "../styles/tokens.stylex";
6
- import { useTheme } from "../theme/ThemeProvider";
7
- import { BackLink } from "../ui/BackLink";
8
- import { Button, ButtonLink } from "../ui/Button";
9
- import { Field } from "../ui/Field";
10
- import { Input, Select, Textarea } from "../ui/Input";
11
- import { List, ListRow } from "../ui/ListRow";
12
- import { PageHeader, Panel, Stack } from "../ui/Page";
13
- import { Text } from "../ui/Text";
14
-
15
- const VARIANTS = ["primary", "secondary", "ghost", "danger"] as const;
16
-
17
- export function UiKitPage() {
18
- const { preference, resolved, setPreference } = useTheme();
19
- const [locale, setLocale] = useState("en");
20
-
21
- return (
22
- <div {...stylex.props(styles.page)}>
23
- <header {...stylex.props(styles.top)}>
24
- <div>
25
- <Text as="p" size="xs" tone="muted" weight="semibold">
26
- DEV ONLY · /__ui
27
- </Text>
28
- <Text as="h1" size="display" weight="semibold">
29
- UI kit
30
- </Text>
31
- <Text tone="muted" size="sm">
32
- StyleX + Base UI primitives. Theme is {preference} (resolved{" "}
33
- {resolved}
34
- ).
35
- </Text>
36
- <div {...stylex.props(styles.back)}>
37
- <BackLink to="/">← Back to app</BackLink>
38
- </div>
39
- </div>
40
- <div {...stylex.props(styles.themeRow)}>
41
- <Button
42
- variant={preference === "system" ? "primary" : "secondary"}
43
- onClick={() => setPreference("system")}
44
- >
45
- System
46
- </Button>
47
- <Button
48
- variant={preference === "light" ? "primary" : "secondary"}
49
- onClick={() => setPreference("light")}
50
- >
51
- Light
52
- </Button>
53
- <Button
54
- variant={preference === "dark" ? "primary" : "secondary"}
55
- onClick={() => setPreference("dark")}
56
- >
57
- Dark
58
- </Button>
59
- </div>
60
- </header>
61
-
62
- <Stack gap="lg">
63
- <section {...stylex.props(styles.section)}>
64
- <SectionTitle>Buttons</SectionTitle>
65
- <Panel>
66
- <Stack gap="md">
67
- {VARIANTS.map((variant) => (
68
- <Row key={variant} label={variant}>
69
- <Button variant={variant}>{variant}</Button>
70
- <Button variant={variant} disabled>
71
- disabled
72
- </Button>
73
- <ButtonLink variant={variant} to="/__ui">
74
- link
75
- </ButtonLink>
76
- </Row>
77
- ))}
78
- </Stack>
79
- </Panel>
80
- </section>
81
-
82
- <section {...stylex.props(styles.section)}>
83
- <SectionTitle>Fields</SectionTitle>
84
- <Panel>
85
- <Stack>
86
- <Field label="Text" hint="Functional note under the field.">
87
- <Input
88
- defaultValue="Ada Lovelace"
89
- autoComplete="off"
90
- spellCheck={false}
91
- />
92
- </Field>
93
- <Field label="Disabled">
94
- <Input defaultValue="Locked" disabled />
95
- </Field>
96
- <Field label="Select">
97
- <Select
98
- aria-label="Locale"
99
- value={locale}
100
- onValueChange={(next) => setLocale(next ?? "en")}
101
- options={[
102
- { value: "en", label: "English (en)" },
103
- { value: "da", label: "Dansk (da)" },
104
- ]}
105
- />
106
- </Field>
107
- <Field label="Body (mono)">
108
- <Textarea
109
- mono
110
- rows={4}
111
- defaultValue={"---\ntitle: Hello\n---\n\nParagraph."}
112
- />
113
- </Field>
114
- </Stack>
115
- </Panel>
116
- </section>
117
-
118
- <section {...stylex.props(styles.section)}>
119
- <SectionTitle>Text</SectionTitle>
120
- <Panel>
121
- <Stack gap="sm">
122
- <Text size="display" weight="semibold">
123
- Display · 20px
124
- </Text>
125
- <Text size="xl" weight="semibold">
126
- Title · 16px
127
- </Text>
128
- <Text size="lg" weight="medium">
129
- Heading · 14px
130
- </Text>
131
- <Text>Body · 13px</Text>
132
- <Text size="sm" tone="muted">
133
- Muted · 12px
134
- </Text>
135
- <Text size="xs" tone="muted" weight="semibold">
136
- OVERLINE
137
- </Text>
138
- <Text tone="danger">Danger</Text>
139
- <Text tone="success">Success</Text>
140
- <Text mono size="sm">
141
- Geist Mono / content/en/blog/hello.mdx
142
- </Text>
143
- </Stack>
144
- </Panel>
145
- </section>
146
-
147
- <section {...stylex.props(styles.section)}>
148
- <SectionTitle>List + page chrome</SectionTitle>
149
- <Panel>
150
- <PageHeader
151
- kicker={<BackLink to="/__ui">← Kit</BackLink>}
152
- title="Documents"
153
- description="Sample page header with action."
154
- action={<Button>New</Button>}
155
- />
156
- <List>
157
- <ListRow
158
- to="/__ui"
159
- title="hello-world"
160
- meta="en"
161
- trailing="modified"
162
- />
163
- <ListRow
164
- to="/__ui"
165
- title="about"
166
- meta="da"
167
- trailing="new"
168
- />
169
- </List>
170
- </Panel>
171
- </section>
172
-
173
- <section {...stylex.props(styles.section)}>
174
- <SectionTitle>Top bar</SectionTitle>
175
- <Panel>
176
- <div {...stylex.props(styles.statusWrap)}>
177
- <StatusBar>
178
- <StatusItem>main</StatusItem>
179
- <StatusItem>2 uncommitted</StatusItem>
180
- </StatusBar>
181
- <StatusBar>
182
- <StatusItem>feat/sale</StatusItem>
183
- <StatusItem>Unsaved</StatusItem>
184
- </StatusBar>
185
- <StatusBar>
186
- <StatusItem tone="danger">Save failed</StatusItem>
187
- </StatusBar>
188
- </div>
189
- </Panel>
190
- </section>
191
-
192
- <section {...stylex.props(styles.section)}>
193
- <SectionTitle>Surfaces</SectionTitle>
194
- <div {...stylex.props(styles.swatches)}>
195
- <Swatch label="bgApp" fill={styles.bgApp} />
196
- <Swatch label="bgSidebar" fill={styles.bgSidebar} />
197
- <Swatch label="bgSurface" fill={styles.bgSurface} />
198
- <Swatch label="accent" fill={styles.accent} />
199
- <Swatch label="danger" fill={styles.dangerFill} />
200
- <Swatch label="success" fill={styles.successFill} />
201
- </div>
202
- </section>
203
- </Stack>
204
- </div>
205
- );
206
- }
207
-
208
- function SectionTitle({ children }: { children: string }) {
209
- return (
210
- <Text as="h2" size="xs" tone="muted" weight="semibold">
211
- {children}
212
- </Text>
213
- );
214
- }
215
-
216
- function Row({
217
- label,
218
- children,
219
- }: {
220
- label: string;
221
- children: React.ReactNode;
222
- }) {
223
- return (
224
- <div {...stylex.props(styles.row)}>
225
- <span {...stylex.props(styles.rowLabel)}>{label}</span>
226
- <div {...stylex.props(styles.rowItems)}>{children}</div>
227
- </div>
228
- );
229
- }
230
-
231
- function Swatch({
232
- label,
233
- fill,
234
- }: {
235
- label: string;
236
- fill: stylex.StyleXStyles;
237
- }) {
238
- return (
239
- <div {...stylex.props(styles.swatch)}>
240
- <div {...stylex.props(styles.chip, fill)} />
241
- <Text size="xs" tone="muted" mono>
242
- {label}
243
- </Text>
244
- </div>
245
- );
246
- }
247
-
248
- const styles = stylex.create({
249
- page: {
250
- minHeight: "100dvh",
251
- maxWidth: "880px",
252
- marginInline: "auto",
253
- paddingInline: space.xxl,
254
- paddingBlock: space.xxl,
255
- },
256
- section: {
257
- display: "flex",
258
- flexDirection: "column",
259
- gap: space.sm,
260
- },
261
- top: {
262
- display: "flex",
263
- flexWrap: "wrap",
264
- alignItems: "flex-start",
265
- justifyContent: "space-between",
266
- gap: space.lg,
267
- marginBottom: space.xxl,
268
- },
269
- back: {
270
- marginTop: space.md,
271
- },
272
- themeRow: {
273
- display: "flex",
274
- flexWrap: "wrap",
275
- gap: space.sm,
276
- },
277
- row: {
278
- display: "flex",
279
- flexWrap: "wrap",
280
- alignItems: "center",
281
- gap: space.lg,
282
- },
283
- rowLabel: {
284
- width: "88px",
285
- flexShrink: 0,
286
- fontSize: type.xs,
287
- fontWeight: 600,
288
- letterSpacing: "0.04em",
289
- textTransform: "uppercase",
290
- color: colors.textMuted,
291
- },
292
- rowItems: {
293
- display: "flex",
294
- flexWrap: "wrap",
295
- alignItems: "center",
296
- gap: space.sm,
297
- },
298
- statusWrap: {
299
- display: "flex",
300
- flexDirection: "column",
301
- gap: space.md,
302
- overflow: "hidden",
303
- borderRadius: radius.md,
304
- borderWidth: 1,
305
- borderStyle: "solid",
306
- borderColor: colors.border,
307
- },
308
- swatches: {
309
- display: "grid",
310
- gridTemplateColumns: "repeat(auto-fill, minmax(120px, 1fr))",
311
- gap: space.md,
312
- },
313
- swatch: {
314
- display: "flex",
315
- flexDirection: "column",
316
- gap: space.sm,
317
- },
318
- chip: {
319
- height: "40px",
320
- borderRadius: radius.md,
321
- borderWidth: 1,
322
- borderStyle: "solid",
323
- borderColor: colors.border,
324
- },
325
- bgApp: { backgroundColor: colors.bgApp },
326
- bgSidebar: { backgroundColor: colors.bgSidebar },
327
- bgSurface: { backgroundColor: colors.bgSurface },
328
- accent: { backgroundColor: colors.accent },
329
- dangerFill: { backgroundColor: colors.danger },
330
- successFill: { backgroundColor: colors.success },
331
- });