@backmatter/studio 0.0.20 → 0.0.21
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/dist/chunks/{UiKitApp-C269OA8v.js → UiKitApp-CMMcsaX4.js} +2 -2
- package/dist/chunks/{WorkspaceRoutes-B4B5jjje.js → WorkspaceRoutes-DW0sLdpJ.js} +27141 -26241
- package/dist/chunks/dashboard-By0P4Yny.js +1879 -0
- package/dist/chunks/{index-7-TtXaMq.js → index-DTPUqaHE.js} +1 -1
- package/dist/dashboard.js +2 -2
- package/dist/index.js +205 -194
- package/dist/site-widget.css +208 -0
- package/dist/site-widget.js +10495 -9947
- package/dist/studio.css +276 -32
- package/package.json +2 -2
- package/src/App.tsx +7 -1
- package/src/api.ts +106 -13
- package/src/chat/ChatFiles.tsx +261 -0
- package/src/chat/ChatMessage.tsx +5 -0
- package/src/chat/ChatPanel.tsx +218 -14
- package/src/chat/ChatProvider.tsx +72 -22
- package/src/chat/Composer.tsx +83 -6
- package/src/chat/PendingFileRow.tsx +188 -0
- package/src/chat/chat-context.ts +7 -1
- package/src/chat/chat-helpers.ts +49 -0
- package/src/chat/chat-state.ts +17 -6
- package/src/chat/icons.tsx +28 -0
- package/src/chat/model-copy.ts +41 -0
- package/src/chat/pending-files.ts +236 -0
- package/src/chat/side-width.ts +48 -0
- package/src/chrome/AppShell.tsx +9 -1
- package/src/chrome/CommandPalette.tsx +7 -0
- package/src/chrome/ContentExplorerSidebar.tsx +43 -74
- package/src/chrome/folder-create-context.ts +56 -11
- package/src/chrome/hotkeys.ts +8 -0
- package/src/fields/FieldControl.tsx +331 -115
- package/src/fields/LinkFieldInput.tsx +13 -6
- package/src/fields/array-item-title.ts +28 -0
- package/src/fields/field-label.ts +8 -0
- package/src/host-pointer.ts +2 -0
- package/src/install-preview-pointer.ts +1 -0
- package/src/pages/BlockPicker.tsx +362 -0
- package/src/pages/BlocksList.tsx +39 -67
- package/src/pages/CliAuthorizePage.tsx +138 -25
- package/src/pages/DocEditorPage.tsx +95 -18
- package/src/pages/EmbedPublishPage.tsx +40 -2
- package/src/pages/LoginPage.tsx +118 -31
- package/src/pages/SettingsSchemaPage.tsx +19 -3
- package/src/pages/WorkspaceLayout.tsx +16 -1
- package/src/pages/block-picker.ts +116 -0
- package/src/pages/editor-grab.ts +61 -13
- package/src/pages/preview-split.ts +24 -0
- package/src/pages/session-preview.ts +1 -0
- package/src/replica/types.ts +2 -0
- package/src/sign-in-link.ts +45 -0
- package/src/site-pointer.ts +14 -1
- package/src/site-widget.tsx +12 -1
- package/src/ui/Field.tsx +26 -0
- package/src/workspace/schema-source.tsx +126 -0
- package/dist/chunks/dashboard-DeNgythd.js +0 -1779
- package/src/site-devbar-overlay-inject.ts +0 -15
- package/src/site-publish-menu.tsx +0 -33
package/src/site-widget.tsx
CHANGED
|
@@ -178,7 +178,12 @@ export function SiteWidget({
|
|
|
178
178
|
</TooltipProvider>
|
|
179
179
|
) : null}
|
|
180
180
|
{doc && publishOpen ? (
|
|
181
|
-
<div
|
|
181
|
+
<div
|
|
182
|
+
role="dialog"
|
|
183
|
+
aria-label="Publish"
|
|
184
|
+
data-backmatter-panel=""
|
|
185
|
+
style={publishPanelStyle(publishAnchor)}
|
|
186
|
+
>
|
|
182
187
|
<EmbedPublishPage
|
|
183
188
|
workspaceId={doc.workspaceId}
|
|
184
189
|
onStatus={({ changeCount: count }) => setChangeCount(count)}
|
|
@@ -325,6 +330,9 @@ function SitePointer({ doc }: { doc: SiteWidgetDoc }) {
|
|
|
325
330
|
return null;
|
|
326
331
|
}
|
|
327
332
|
|
|
333
|
+
// Inline so the panel keeps its look on any host, even if the widget stylesheet
|
|
334
|
+
// is missing or stale. The text color is set here so panel text never inherits
|
|
335
|
+
// the host page's color (white text on a dark site would vanish on this white panel).
|
|
328
336
|
function publishPanelStyle(anchor: DOMRect | null): CSSProperties {
|
|
329
337
|
const insetRight = anchor
|
|
330
338
|
? Math.max(16, window.innerWidth - anchor.right)
|
|
@@ -343,6 +351,9 @@ function publishPanelStyle(anchor: DOMRect | null): CSSProperties {
|
|
|
343
351
|
border: "1px solid #e4e4e7",
|
|
344
352
|
borderRadius: 12,
|
|
345
353
|
background: "#ffffff",
|
|
354
|
+
color: "#18181b",
|
|
355
|
+
colorScheme: "light",
|
|
356
|
+
fontFamily: '"Geist Sans", Geist, ui-sans-serif, system-ui, sans-serif',
|
|
346
357
|
boxShadow: "0 16px 40px rgba(24, 24, 27, 0.14), 0 2px 8px rgba(24, 24, 27, 0.06)",
|
|
347
358
|
};
|
|
348
359
|
}
|
package/src/ui/Field.tsx
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
// packages/studio/src/ui/Field.tsx
|
|
2
|
+
import { useId } from "react";
|
|
2
3
|
import * as stylex from "@stylexjs/stylex";
|
|
3
4
|
import { colors, space, type } from "../styles/tokens.stylex";
|
|
4
5
|
|
|
@@ -21,6 +22,31 @@ export function Field({
|
|
|
21
22
|
);
|
|
22
23
|
}
|
|
23
24
|
|
|
25
|
+
/**
|
|
26
|
+
* `Field` for a composite control (an object or a list) that holds its own
|
|
27
|
+
* labeled inputs. A group, not a `<label>`, so its children keep their labels.
|
|
28
|
+
*/
|
|
29
|
+
export function FieldGroup({
|
|
30
|
+
label,
|
|
31
|
+
hint,
|
|
32
|
+
children,
|
|
33
|
+
}: {
|
|
34
|
+
label: string;
|
|
35
|
+
hint?: React.ReactNode;
|
|
36
|
+
children: React.ReactNode;
|
|
37
|
+
}) {
|
|
38
|
+
const labelId = useId();
|
|
39
|
+
return (
|
|
40
|
+
<div role="group" aria-labelledby={labelId} {...stylex.props(styles.field)}>
|
|
41
|
+
<span id={labelId} {...stylex.props(styles.label)}>
|
|
42
|
+
{label}
|
|
43
|
+
</span>
|
|
44
|
+
{children}
|
|
45
|
+
{hint ? <span {...stylex.props(styles.hint)}>{hint}</span> : null}
|
|
46
|
+
</div>
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
|
|
24
50
|
/**
|
|
25
51
|
* A label forwards a click on its plain content to its first labelable descendant.
|
|
26
52
|
* In a composite control that is an arbitrary button, such as a gallery's first remove button.
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
// packages/studio/src/workspace/schema-source.tsx
|
|
2
|
+
//
|
|
3
|
+
// Where the schema snapshot behind the current branch came from: the branch it
|
|
4
|
+
// was imported from, when, and which source files failed to evaluate. A block
|
|
5
|
+
// whose file fails is missing or stale in the picker; this says why.
|
|
6
|
+
import { createContext, useContext } from "react";
|
|
7
|
+
import * as stylex from "@stylexjs/stylex";
|
|
8
|
+
import type { SchemaFailure } from "../api";
|
|
9
|
+
import { commitAge } from "../pages/home-rows";
|
|
10
|
+
import { colors, radius, space, type } from "../styles/tokens.stylex";
|
|
11
|
+
|
|
12
|
+
export type SchemaSource = {
|
|
13
|
+
branch?: string;
|
|
14
|
+
/** ISO time the snapshot was written. */
|
|
15
|
+
createdAt?: string;
|
|
16
|
+
failures: SchemaFailure[];
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const SchemaSourceContext = createContext<SchemaSource | null>(null);
|
|
20
|
+
|
|
21
|
+
export const SchemaSourceProvider = SchemaSourceContext.Provider;
|
|
22
|
+
|
|
23
|
+
export function useSchemaSource(): SchemaSource | null {
|
|
24
|
+
return useContext(SchemaSourceContext);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/** Failures of `blocks/` and `richtext/` definition files. */
|
|
28
|
+
export function blockFailures(source: SchemaSource | null): SchemaFailure[] {
|
|
29
|
+
return (source?.failures ?? []).filter((failure) =>
|
|
30
|
+
/(^|\/)(blocks|richtext)\//.test(failure.path),
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/** "main · 2h ago". Empty when the snapshot names neither. */
|
|
35
|
+
export function schemaSourceLabel(source: SchemaSource | null, now = Date.now()): string {
|
|
36
|
+
if (!source) return "";
|
|
37
|
+
const age = source.createdAt ? commitAge(source.createdAt, now) : "";
|
|
38
|
+
return [source.branch, age].filter(Boolean).join(" · ");
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export function SchemaSourceNote({ source }: { source: SchemaSource | null }) {
|
|
42
|
+
const label = schemaSourceLabel(source);
|
|
43
|
+
if (!label) return null;
|
|
44
|
+
const title = source?.createdAt
|
|
45
|
+
? `Schema snapshot imported from ${source.branch ?? "the repository"} at ${new Date(source.createdAt).toLocaleString()}`
|
|
46
|
+
: undefined;
|
|
47
|
+
return (
|
|
48
|
+
<span data-schema-source="" title={title} {...stylex.props(styles.note)}>
|
|
49
|
+
{label}
|
|
50
|
+
</span>
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export function SchemaFailureList({
|
|
55
|
+
failures,
|
|
56
|
+
title,
|
|
57
|
+
}: {
|
|
58
|
+
failures: SchemaFailure[];
|
|
59
|
+
title: string;
|
|
60
|
+
}) {
|
|
61
|
+
if (failures.length === 0) return null;
|
|
62
|
+
return (
|
|
63
|
+
<div role="status" data-schema-failures="" {...stylex.props(styles.failures)}>
|
|
64
|
+
<span {...stylex.props(styles.failuresTitle)}>{title}</span>
|
|
65
|
+
<ul {...stylex.props(styles.list)}>
|
|
66
|
+
{failures.map((failure) => (
|
|
67
|
+
<li key={failure.path} {...stylex.props(styles.item)}>
|
|
68
|
+
<code {...stylex.props(styles.path)}>{failure.path}</code>
|
|
69
|
+
<span {...stylex.props(styles.message)}>{failure.message}</span>
|
|
70
|
+
</li>
|
|
71
|
+
))}
|
|
72
|
+
</ul>
|
|
73
|
+
</div>
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
const styles = stylex.create({
|
|
78
|
+
note: {
|
|
79
|
+
color: colors.textMuted,
|
|
80
|
+
fontFamily: type.mono,
|
|
81
|
+
fontSize: type.xs,
|
|
82
|
+
whiteSpace: "nowrap",
|
|
83
|
+
},
|
|
84
|
+
failures: {
|
|
85
|
+
display: "flex",
|
|
86
|
+
flexDirection: "column",
|
|
87
|
+
gap: space.xs,
|
|
88
|
+
paddingBlock: space.sm,
|
|
89
|
+
paddingInline: space.md,
|
|
90
|
+
borderWidth: 1,
|
|
91
|
+
borderStyle: "solid",
|
|
92
|
+
borderColor: colors.border,
|
|
93
|
+
borderInlineStartWidth: 2,
|
|
94
|
+
borderInlineStartColor: colors.danger,
|
|
95
|
+
borderRadius: radius.md,
|
|
96
|
+
fontSize: type.sm,
|
|
97
|
+
},
|
|
98
|
+
failuresTitle: {
|
|
99
|
+
color: colors.danger,
|
|
100
|
+
fontWeight: 500,
|
|
101
|
+
},
|
|
102
|
+
list: {
|
|
103
|
+
display: "flex",
|
|
104
|
+
flexDirection: "column",
|
|
105
|
+
gap: space.xs,
|
|
106
|
+
margin: 0,
|
|
107
|
+
padding: 0,
|
|
108
|
+
listStyle: "none",
|
|
109
|
+
},
|
|
110
|
+
item: {
|
|
111
|
+
display: "flex",
|
|
112
|
+
flexDirection: "column",
|
|
113
|
+
gap: "2px",
|
|
114
|
+
minWidth: 0,
|
|
115
|
+
},
|
|
116
|
+
path: {
|
|
117
|
+
fontFamily: type.mono,
|
|
118
|
+
fontSize: type.xs,
|
|
119
|
+
color: colors.text,
|
|
120
|
+
},
|
|
121
|
+
message: {
|
|
122
|
+
color: colors.textMuted,
|
|
123
|
+
fontSize: type.xs,
|
|
124
|
+
overflowWrap: "anywhere",
|
|
125
|
+
},
|
|
126
|
+
});
|