devnonla-ui 0.11.0 → 0.13.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/README.md +6 -245
- package/package.json +4 -3
- package/src/app/App.tsx +6 -24
- package/src/app/context.ts +3 -7
- package/src/avatar/AgentAvatar.tsx +17 -6
- package/src/button/Button.tsx +28 -21
- package/src/card/Card.tsx +1 -4
- package/src/chat/AgentChatbox.tsx +1 -1
- package/src/chat/AgentPanel.tsx +1 -1
- package/src/chat/chatMessageList.tsx +1 -4
- package/src/chat/message-ui/ChatAgentMessage.tsx +6 -4
- package/src/chat/message-ui/ChatMarkdown.tsx +2 -2
- package/src/chat/tool-ui/CallAgentToolUI.tsx +1 -1
- package/src/codeblock/CodeBlock.tsx +1 -1
- package/src/desktop/DesktopWindow.tsx +41 -17
- package/src/index.ts +7 -5
- package/src/logo/Logo.tsx +17 -197
- package/src/markdown-editor/MarkdownPreview.tsx +3 -3
- package/src/markdown-editor/MarkdownTable.tsx +2 -2
- package/src/markdown-editor/MarkdownViewer.tsx +53 -55
- package/src/markdown-editor/MermaidBlock.tsx +1 -1
- package/src/markdown-editor/ReactCode.tsx +6 -7
- package/src/markdown-editor/ReactCodeFrame.tsx +41 -15
- package/src/markdown-editor/ReactCodeRunner.tsx +9 -0
- package/src/markdown-editor/ReactCodeSandbox.tsx +75 -30
- package/src/markdown-editor/markdownScale.ts +144 -0
- package/src/sidebar/Sidebar.tsx +7 -7
- package/src/styles.css +86 -52
- package/src/tabs/Tabs.tsx +261 -0
- package/src/tag/Tag.tsx +13 -13
- package/src/theme.ts +2 -87
- package/src/typography/Typography.tsx +41 -35
|
@@ -5,7 +5,7 @@ export type ChatMarkdownProps = {
|
|
|
5
5
|
streaming?: boolean;
|
|
6
6
|
};
|
|
7
7
|
|
|
8
|
-
/** Agent markdown.
|
|
8
|
+
/** Agent markdown. `MarkdownViewer` on the `chat` scale. */
|
|
9
9
|
export function ChatMarkdown({ content, streaming = false }: ChatMarkdownProps) {
|
|
10
|
-
return <MarkdownViewer value={content} streaming={streaming} />;
|
|
10
|
+
return <MarkdownViewer value={content} streaming={streaming} variant="chat" />;
|
|
11
11
|
}
|
|
@@ -138,7 +138,7 @@ export function CallAgentToolUI({ msg, assistantLabel = "Assistant", assistantCo
|
|
|
138
138
|
<div className="flex flex-col gap-3 px-3 py-3">
|
|
139
139
|
{composing || hasRequest ? (
|
|
140
140
|
<AgentTurn name={assistantLabel} align="end">
|
|
141
|
-
<div className="rounded-2xl rounded-tr-sm border border-solid border-(--nonla-input) bg-well-strong px-3 py-2 text-left">
|
|
141
|
+
<div className="nonla-chat-user rounded-2xl rounded-tr-sm border border-solid border-(--nonla-input) bg-well-strong px-3 py-2 text-left">
|
|
142
142
|
{composing ? <TypingDots /> : <p className="m-0 text-[14px] leading-[1.55] whitespace-pre-wrap text-foreground">{requestMessage}</p>}
|
|
143
143
|
</div>
|
|
144
144
|
</AgentTurn>
|
|
@@ -45,7 +45,7 @@ export function CodeBlock({ code, language, title, lineNumbers = false, wordWrap
|
|
|
45
45
|
return (
|
|
46
46
|
<CodeBlockContext.Provider value={{ code }}>
|
|
47
47
|
<div className={cn("nonla-codeblock relative flex min-w-0 w-full flex-col overflow-clip rounded-xl border border-border bg-card text-sm text-foreground", className)} data-language={language} {...props}>
|
|
48
|
-
<div className="flex h-8 items-center justify-between gap-2 pl-3 pr-1 text-xs text-muted-foreground">
|
|
48
|
+
<div className="nonla-codeblock-header flex h-8 items-center justify-between gap-2 pl-3 pr-1 text-xs text-muted-foreground">
|
|
49
49
|
<div className="flex min-w-0 items-center gap-2">
|
|
50
50
|
{label ? <span className="truncate font-medium">{label}</span> : null}
|
|
51
51
|
</div>
|
|
@@ -4,7 +4,7 @@ import { cn } from "../lib/cn";
|
|
|
4
4
|
import { glassSurfaceClass } from "../lib/surface";
|
|
5
5
|
import { OverlayScroll, type OverlayScrollVisibility } from "../scroll/OverlayScroll";
|
|
6
6
|
|
|
7
|
-
type Phase = "open" | "leaving";
|
|
7
|
+
type Phase = "enter" | "open" | "leaving";
|
|
8
8
|
type Size = { w: number; h: number };
|
|
9
9
|
type Point = { x: number; y: number };
|
|
10
10
|
type Rect = { x: number; y: number; w: number; h: number };
|
|
@@ -41,11 +41,11 @@ function hasOpenDialog() {
|
|
|
41
41
|
return Boolean(document.querySelector('dialog[open], [role="dialog"][data-state="open"], .nonla-modal-content'));
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
function
|
|
45
|
-
const
|
|
46
|
-
if (!(
|
|
44
|
+
function zoomOrigin(overlay: HTMLElement, frame: HTMLElement, source: HTMLElement | null) {
|
|
45
|
+
const from = source ?? document.querySelector('[aria-current="true"]');
|
|
46
|
+
if (!(from instanceof HTMLElement)) return "50% 50%";
|
|
47
47
|
|
|
48
|
-
const icon =
|
|
48
|
+
const icon = from.getBoundingClientRect();
|
|
49
49
|
const overlayBox = overlay.getBoundingClientRect();
|
|
50
50
|
const x = icon.left + icon.width / 2 - overlayBox.left - frame.offsetLeft;
|
|
51
51
|
const y = icon.top + icon.height / 2 - overlayBox.top - frame.offsetTop;
|
|
@@ -317,6 +317,10 @@ export type DesktopWindowProps = {
|
|
|
317
317
|
scrollbar?: OverlayScrollVisibility;
|
|
318
318
|
/** Last collapsed position and size. Default `"default"`. Pass a unique key per window, or `false` to disable. */
|
|
319
319
|
persistKey?: string | false;
|
|
320
|
+
/** Zoom from this element on open, and back to it on close. Falls back to the active desktop icon. */
|
|
321
|
+
origin?: { current: HTMLElement | null };
|
|
322
|
+
/** Animated close. Call this instead of unmounting so the window shrinks back to `origin`. */
|
|
323
|
+
closeRef?: { current: (() => void) | null };
|
|
320
324
|
children: ReactNode;
|
|
321
325
|
};
|
|
322
326
|
|
|
@@ -331,6 +335,8 @@ export function DesktopWindow({
|
|
|
331
335
|
scroll = true,
|
|
332
336
|
scrollbar = "hover",
|
|
333
337
|
persistKey = "default",
|
|
338
|
+
origin,
|
|
339
|
+
closeRef,
|
|
334
340
|
children,
|
|
335
341
|
}: DesktopWindowProps) {
|
|
336
342
|
const overlayRef = useRef<HTMLDivElement>(null);
|
|
@@ -351,7 +357,7 @@ export function DesktopWindow({
|
|
|
351
357
|
startY: number;
|
|
352
358
|
orig: Rect;
|
|
353
359
|
} | null>(null);
|
|
354
|
-
const [phase, setPhase] = useState<Phase>("open");
|
|
360
|
+
const [phase, setPhase] = useState<Phase>(() => (prefersReducedMotion() ? "open" : "enter"));
|
|
355
361
|
const [view, setView] = useState<Size>(initialView);
|
|
356
362
|
const [offset, setOffset] = useState(() => restoreGeometry(persistKey, initialView()).offset);
|
|
357
363
|
const [size, setSize] = useState<Size | null>(() => restoreGeometry(persistKey, initialView()).size);
|
|
@@ -371,14 +377,31 @@ export function DesktopWindow({
|
|
|
371
377
|
viewRef.current = view;
|
|
372
378
|
offsetRef.current = offset;
|
|
373
379
|
|
|
374
|
-
|
|
380
|
+
const applyOrigin = () => {
|
|
375
381
|
const overlay = overlayRef.current;
|
|
376
382
|
const frame = frameRef.current;
|
|
377
|
-
if (overlay
|
|
378
|
-
|
|
379
|
-
|
|
383
|
+
if (!overlay || !frame) return;
|
|
384
|
+
frame.style.transformOrigin = zoomOrigin(overlay, frame, origin?.current ?? null);
|
|
385
|
+
};
|
|
386
|
+
|
|
387
|
+
useLayoutEffect(() => {
|
|
388
|
+
applyOrigin();
|
|
380
389
|
}, []);
|
|
381
390
|
|
|
391
|
+
useEffect(() => {
|
|
392
|
+
if (phase !== "enter") return;
|
|
393
|
+
const id = requestAnimationFrame(() => setPhase("open"));
|
|
394
|
+
return () => cancelAnimationFrame(id);
|
|
395
|
+
}, [phase]);
|
|
396
|
+
|
|
397
|
+
useLayoutEffect(() => {
|
|
398
|
+
if (!closeRef) return;
|
|
399
|
+
closeRef.current = () => requestCloseRef.current();
|
|
400
|
+
return () => {
|
|
401
|
+
closeRef.current = null;
|
|
402
|
+
};
|
|
403
|
+
});
|
|
404
|
+
|
|
382
405
|
const requestClose = () => {
|
|
383
406
|
if (closedRef.current || phase === "leaving") return;
|
|
384
407
|
if (prefersReducedMotion()) {
|
|
@@ -386,6 +409,7 @@ export function DesktopWindow({
|
|
|
386
409
|
onClose();
|
|
387
410
|
return;
|
|
388
411
|
}
|
|
412
|
+
applyOrigin();
|
|
389
413
|
setPhase("leaving");
|
|
390
414
|
};
|
|
391
415
|
requestCloseRef.current = requestClose;
|
|
@@ -571,13 +595,13 @@ export function DesktopWindow({
|
|
|
571
595
|
onToggleExpand();
|
|
572
596
|
};
|
|
573
597
|
|
|
574
|
-
const
|
|
598
|
+
const shown = phase === "open";
|
|
575
599
|
const leaving = phase === "leaving";
|
|
576
600
|
const rect = expanded ? { x: 0, y: 0, w: view.w, h: view.h } : collapsedRect(view, offset, size);
|
|
577
601
|
const reduce = prefersReducedMotion();
|
|
578
602
|
const duration = reduce ? "150ms" : "300ms";
|
|
579
|
-
const geom =
|
|
580
|
-
const
|
|
603
|
+
const geom = phase === "open" && !dragging && !resizing && !reduce ? `top ${duration} ${EASE}, left ${duration} ${EASE}, width ${duration} ${EASE}, height ${duration} ${EASE}` : "";
|
|
604
|
+
const zoom = !dragging && !resizing && !reduce ? `opacity ${duration} ${EASE}, transform ${duration} ${EASE}` : "";
|
|
581
605
|
|
|
582
606
|
return (
|
|
583
607
|
<WindowHeaderSlotContext.Provider value={headerChrome}>
|
|
@@ -598,12 +622,12 @@ export function DesktopWindow({
|
|
|
598
622
|
left: rect.x,
|
|
599
623
|
width: rect.w,
|
|
600
624
|
height: rect.h,
|
|
601
|
-
opacity:
|
|
602
|
-
transform:
|
|
603
|
-
transition: [geom,
|
|
625
|
+
opacity: shown ? 1 : 0,
|
|
626
|
+
transform: shown ? "scale(1)" : "scale(0.18)",
|
|
627
|
+
transition: [geom, zoom].filter(Boolean).join(", ") || undefined,
|
|
604
628
|
}}
|
|
605
629
|
data-expanded={expanded || undefined}
|
|
606
|
-
className={cn("absolute flex flex-col rounded-xl pointer-events-auto transform-gpu", glassSurfaceClass, "nonla-window-glass",
|
|
630
|
+
className={cn("absolute flex flex-col rounded-xl pointer-events-auto transform-gpu", glassSurfaceClass, "nonla-window-glass", phase !== "open" && "pointer-events-none")}
|
|
607
631
|
>
|
|
608
632
|
<div className="relative flex min-h-0 flex-1 flex-col overflow-hidden rounded-xl">
|
|
609
633
|
{header ? (
|
package/src/index.ts
CHANGED
|
@@ -15,7 +15,7 @@ export type InputRef = HTMLInputElement;
|
|
|
15
15
|
|
|
16
16
|
export type { AlertProps, AlertType } from "./alert/Alert";
|
|
17
17
|
export { Alert } from "./alert/Alert";
|
|
18
|
-
export type { AgentAvatarConfig, AgentAvatarLook, AgentAvatarMotion, AgentAvatarProps } from "./avatar/AgentAvatar";
|
|
18
|
+
export type { AgentAvatarConfig, AgentAvatarEyeColor, AgentAvatarLook, AgentAvatarMotion, AgentAvatarProps } from "./avatar/AgentAvatar";
|
|
19
19
|
export { AGENT_AVATAR_PARTS, AgentAvatar } from "./avatar/AgentAvatar";
|
|
20
20
|
export type { CalendarProps } from "./calendar/Calendar";
|
|
21
21
|
export { Calendar } from "./calendar/Calendar";
|
|
@@ -159,11 +159,11 @@ export { placementToRadix } from "./lib/placement";
|
|
|
159
159
|
export type { CanonicalSize, ControlSize, ControlSizeTokens } from "./lib/sizes";
|
|
160
160
|
export { CONTROL_SIZES, controlHeightVar, controlRadiusVar, controlStatusClass, getSizeTokens, normalizeSize, useControlSize } from "./lib/sizes";
|
|
161
161
|
export { glassOverlayClass, glassSurfaceClass, meadowSurfaceClass } from "./lib/surface";
|
|
162
|
-
export type {
|
|
162
|
+
export type { LogoProps, LogoVariant } from "./logo/Logo";
|
|
163
163
|
export { Logo } from "./logo/Logo";
|
|
164
164
|
export type { MarkdownDiffLayout, MarkdownEditorMode, MarkdownEditorProps } from "./markdown-editor/MarkdownEditor";
|
|
165
165
|
export { MarkdownEditor } from "./markdown-editor/MarkdownEditor";
|
|
166
|
-
export type { MarkdownViewerProps } from "./markdown-editor/MarkdownViewer";
|
|
166
|
+
export type { MarkdownVariant, MarkdownViewerProps } from "./markdown-editor/MarkdownViewer";
|
|
167
167
|
export { MarkdownViewer } from "./markdown-editor/MarkdownViewer";
|
|
168
168
|
export type { MermaidBlockProps } from "./markdown-editor/MermaidBlock";
|
|
169
169
|
export { MermaidBlock } from "./markdown-editor/MermaidBlock";
|
|
@@ -213,10 +213,12 @@ export type {
|
|
|
213
213
|
TableRowSelection,
|
|
214
214
|
} from "./table/Table";
|
|
215
215
|
export { Table } from "./table/Table";
|
|
216
|
+
export type { TabsItem, TabsProps } from "./tabs/Tabs";
|
|
217
|
+
export { Tabs } from "./tabs/Tabs";
|
|
216
218
|
export type { TagProps, TagVariant } from "./tag/Tag";
|
|
217
219
|
export { Tag } from "./tag/Tag";
|
|
218
|
-
export type { NonlaColorMode, NonlaColorPreference,
|
|
219
|
-
export {
|
|
220
|
+
export type { NonlaColorMode, NonlaColorPreference, NonlaThemeKnob, NonlaThemeKnobName, NonlaTokenSnapshot } from "./theme";
|
|
221
|
+
export { getColorMode, getColorPreference, getDesignToken, initColorMode, NONLA_COLOR_MODE_KEY, NONLA_THEME_KEYS, NONLA_THEME_KNOBS, setColorMode, setColorPreference } from "./theme";
|
|
220
222
|
export type { ThemeSwitcherProps } from "./theme-switcher/ThemeSwitcher";
|
|
221
223
|
export { ThemeSwitcher, useColorPreference } from "./theme-switcher/ThemeSwitcher";
|
|
222
224
|
export type { ThemeToggleProps } from "./theme-toggle/ThemeToggle";
|
package/src/logo/Logo.tsx
CHANGED
|
@@ -1,18 +1,12 @@
|
|
|
1
|
-
import "@fontsource-variable/plus-jakarta-sans/wght.css";
|
|
2
1
|
import type { CSSProperties } from "react";
|
|
3
2
|
import { cn } from "../lib/cn";
|
|
4
3
|
|
|
5
4
|
/** `icon` is the mark. `text` is the wordmark. `full` is both. */
|
|
6
5
|
export type LogoVariant = "icon" | "text" | "full";
|
|
7
6
|
|
|
8
|
-
/** `pixel` is the grid. `jakarta` is Plus Jakarta Sans. */
|
|
9
|
-
export type LogoFace = "pixel" | "jakarta";
|
|
10
|
-
|
|
11
7
|
export type LogoProps = {
|
|
12
8
|
variant?: LogoVariant;
|
|
13
|
-
/**
|
|
14
|
-
face?: LogoFace;
|
|
15
|
-
/** Icon height in px. Width follows each asset's aspect ratio. Defaults to 32. */
|
|
9
|
+
/** Icon height in px. Width follows the mark's aspect ratio. Defaults to 32. */
|
|
16
10
|
size?: number;
|
|
17
11
|
/** Icon and wordmark fill. Eyes and the smile stay. Omit to keep the mascot palette and the current text color. */
|
|
18
12
|
color?: string;
|
|
@@ -26,161 +20,6 @@ const WORDMARK = "Nonla Agents";
|
|
|
26
20
|
const MARK_W = 1336;
|
|
27
21
|
const MARK_H = 960;
|
|
28
22
|
|
|
29
|
-
/** Pixel grid wordmark. 11 rows; cap letters use 7, so the box is taller than the caps. */
|
|
30
|
-
const WORD_W = 1340;
|
|
31
|
-
const WORD_H = 220;
|
|
32
|
-
const WORD_CELLS: ReadonlyArray<readonly [number, number]> = [
|
|
33
|
-
[2.4, 2.4],
|
|
34
|
-
[82.4, 2.4],
|
|
35
|
-
[2.4, 22.4],
|
|
36
|
-
[22.4, 22.4],
|
|
37
|
-
[82.4, 22.4],
|
|
38
|
-
[2.4, 42.4],
|
|
39
|
-
[22.4, 42.4],
|
|
40
|
-
[82.4, 42.4],
|
|
41
|
-
[2.4, 62.4],
|
|
42
|
-
[42.4, 62.4],
|
|
43
|
-
[82.4, 62.4],
|
|
44
|
-
[2.4, 82.4],
|
|
45
|
-
[62.4, 82.4],
|
|
46
|
-
[82.4, 82.4],
|
|
47
|
-
[2.4, 102.4],
|
|
48
|
-
[62.4, 102.4],
|
|
49
|
-
[82.4, 102.4],
|
|
50
|
-
[2.4, 122.4],
|
|
51
|
-
[82.4, 122.4],
|
|
52
|
-
[142.4, 42.4],
|
|
53
|
-
[162.4, 42.4],
|
|
54
|
-
[182.4, 42.4],
|
|
55
|
-
[122.4, 62.4],
|
|
56
|
-
[202.4, 62.4],
|
|
57
|
-
[122.4, 82.4],
|
|
58
|
-
[202.4, 82.4],
|
|
59
|
-
[122.4, 102.4],
|
|
60
|
-
[202.4, 102.4],
|
|
61
|
-
[142.4, 122.4],
|
|
62
|
-
[162.4, 122.4],
|
|
63
|
-
[182.4, 122.4],
|
|
64
|
-
[242.4, 42.4],
|
|
65
|
-
[262.4, 42.4],
|
|
66
|
-
[282.4, 42.4],
|
|
67
|
-
[302.4, 42.4],
|
|
68
|
-
[242.4, 62.4],
|
|
69
|
-
[322.4, 62.4],
|
|
70
|
-
[242.4, 82.4],
|
|
71
|
-
[322.4, 82.4],
|
|
72
|
-
[242.4, 102.4],
|
|
73
|
-
[322.4, 102.4],
|
|
74
|
-
[242.4, 122.4],
|
|
75
|
-
[322.4, 122.4],
|
|
76
|
-
[362.4, 2.4],
|
|
77
|
-
[382.4, 2.4],
|
|
78
|
-
[382.4, 22.4],
|
|
79
|
-
[382.4, 42.4],
|
|
80
|
-
[382.4, 62.4],
|
|
81
|
-
[382.4, 82.4],
|
|
82
|
-
[382.4, 102.4],
|
|
83
|
-
[382.4, 122.4],
|
|
84
|
-
[402.4, 122.4],
|
|
85
|
-
[462.4, 42.4],
|
|
86
|
-
[482.4, 42.4],
|
|
87
|
-
[502.4, 42.4],
|
|
88
|
-
[522.4, 62.4],
|
|
89
|
-
[462.4, 82.4],
|
|
90
|
-
[482.4, 82.4],
|
|
91
|
-
[502.4, 82.4],
|
|
92
|
-
[522.4, 82.4],
|
|
93
|
-
[442.4, 102.4],
|
|
94
|
-
[522.4, 102.4],
|
|
95
|
-
[462.4, 122.4],
|
|
96
|
-
[482.4, 122.4],
|
|
97
|
-
[502.4, 122.4],
|
|
98
|
-
[522.4, 122.4],
|
|
99
|
-
[662.4, 2.4],
|
|
100
|
-
[642.4, 22.4],
|
|
101
|
-
[682.4, 22.4],
|
|
102
|
-
[622.4, 42.4],
|
|
103
|
-
[702.4, 42.4],
|
|
104
|
-
[622.4, 62.4],
|
|
105
|
-
[702.4, 62.4],
|
|
106
|
-
[622.4, 82.4],
|
|
107
|
-
[642.4, 82.4],
|
|
108
|
-
[662.4, 82.4],
|
|
109
|
-
[682.4, 82.4],
|
|
110
|
-
[702.4, 82.4],
|
|
111
|
-
[622.4, 102.4],
|
|
112
|
-
[702.4, 102.4],
|
|
113
|
-
[622.4, 122.4],
|
|
114
|
-
[702.4, 122.4],
|
|
115
|
-
[762.4, 42.4],
|
|
116
|
-
[782.4, 42.4],
|
|
117
|
-
[802.4, 42.4],
|
|
118
|
-
[822.4, 42.4],
|
|
119
|
-
[742.4, 62.4],
|
|
120
|
-
[822.4, 62.4],
|
|
121
|
-
[742.4, 82.4],
|
|
122
|
-
[822.4, 82.4],
|
|
123
|
-
[742.4, 102.4],
|
|
124
|
-
[822.4, 102.4],
|
|
125
|
-
[762.4, 122.4],
|
|
126
|
-
[782.4, 122.4],
|
|
127
|
-
[802.4, 122.4],
|
|
128
|
-
[822.4, 122.4],
|
|
129
|
-
[822.4, 142.4],
|
|
130
|
-
[762.4, 162.4],
|
|
131
|
-
[782.4, 162.4],
|
|
132
|
-
[802.4, 162.4],
|
|
133
|
-
[882.4, 42.4],
|
|
134
|
-
[902.4, 42.4],
|
|
135
|
-
[922.4, 42.4],
|
|
136
|
-
[862.4, 62.4],
|
|
137
|
-
[942.4, 62.4],
|
|
138
|
-
[862.4, 82.4],
|
|
139
|
-
[882.4, 82.4],
|
|
140
|
-
[902.4, 82.4],
|
|
141
|
-
[922.4, 82.4],
|
|
142
|
-
[942.4, 82.4],
|
|
143
|
-
[862.4, 102.4],
|
|
144
|
-
[882.4, 122.4],
|
|
145
|
-
[902.4, 122.4],
|
|
146
|
-
[922.4, 122.4],
|
|
147
|
-
[942.4, 122.4],
|
|
148
|
-
[982.4, 42.4],
|
|
149
|
-
[1002.4, 42.4],
|
|
150
|
-
[1022.4, 42.4],
|
|
151
|
-
[1042.4, 42.4],
|
|
152
|
-
[982.4, 62.4],
|
|
153
|
-
[1062.4, 62.4],
|
|
154
|
-
[982.4, 82.4],
|
|
155
|
-
[1062.4, 82.4],
|
|
156
|
-
[982.4, 102.4],
|
|
157
|
-
[1062.4, 102.4],
|
|
158
|
-
[982.4, 122.4],
|
|
159
|
-
[1062.4, 122.4],
|
|
160
|
-
[1122.4, 22.4],
|
|
161
|
-
[1102.4, 42.4],
|
|
162
|
-
[1122.4, 42.4],
|
|
163
|
-
[1142.4, 42.4],
|
|
164
|
-
[1122.4, 62.4],
|
|
165
|
-
[1122.4, 82.4],
|
|
166
|
-
[1122.4, 102.4],
|
|
167
|
-
[1142.4, 122.4],
|
|
168
|
-
[1162.4, 122.4],
|
|
169
|
-
[1222.4, 42.4],
|
|
170
|
-
[1242.4, 42.4],
|
|
171
|
-
[1262.4, 42.4],
|
|
172
|
-
[1282.4, 42.4],
|
|
173
|
-
[1202.4, 62.4],
|
|
174
|
-
[1222.4, 82.4],
|
|
175
|
-
[1242.4, 82.4],
|
|
176
|
-
[1262.4, 82.4],
|
|
177
|
-
[1282.4, 102.4],
|
|
178
|
-
[1202.4, 122.4],
|
|
179
|
-
[1222.4, 122.4],
|
|
180
|
-
[1242.4, 122.4],
|
|
181
|
-
[1262.4, 122.4],
|
|
182
|
-
];
|
|
183
|
-
|
|
184
23
|
/** One paint color, split so the brim stays darker and the face stays lighter than the hat. */
|
|
185
24
|
function markTones(color?: string) {
|
|
186
25
|
if (!color) return { brim: "#dd7627", face: "#ffb45c", hat: "#ffa333" };
|
|
@@ -219,54 +58,35 @@ function LogoMark({ height, color }: { height: number; color?: string }) {
|
|
|
219
58
|
);
|
|
220
59
|
}
|
|
221
60
|
|
|
61
|
+
/** K2D regular outlines. Cap height is 709 units; the box includes the g. */
|
|
62
|
+
const WORD_CAP = 709;
|
|
63
|
+
const WORD_X = 70;
|
|
64
|
+
const WORD_Y = -709;
|
|
65
|
+
const WORD_W = 5908;
|
|
66
|
+
const WORD_H = 918;
|
|
67
|
+
const WORD_PATH = "M70 9L70-628Q70-666 93.50-687.50Q117-709 159-709L547-119L554-125L525-173L525-709Q571-709 594.50-689Q618-669 618-631L618-65Q618-33 595.50-12Q573 9 538 9L141-594L134-588L163-540L163-69Q163-31 139.50-11Q116 9 70 9M923 9Q862 9 812.50-14Q763-37 735.50-76.50Q708-116 708-165L708-329Q708-379 735.50-420Q763-461 812-485Q861-509 923-509Q985-509 1034.50-485Q1084-461 1111.50-420Q1139-379 1139-329L1139-165Q1139-116 1111-76.50Q1083-37 1034-14Q985 9 923 9M923-66Q983-66 1018.50-94.50Q1054-123 1054-169L1054-326Q1054-374 1018.50-404Q983-434 923-434Q864-434 828-404Q792-374 792-326L792-169Q792-123 827.50-94.50Q863-66 923-66M1254 9L1254-435Q1254-509 1338-509L1338-445Q1329-436 1317-418L1321-414Q1351-456 1399-482.50Q1447-509 1503-509Q1584-509 1631-461Q1678-413 1678-337L1678-55Q1678-22 1656.50-6.50Q1635 9 1591 9L1591-328Q1591-376 1564-404Q1537-432 1482-432Q1445-432 1412.50-416.50Q1380-401 1360.50-374.50Q1341-348 1341-317L1341-55Q1341-22 1319.50-6.50Q1298 9 1254 9M1953 9Q1880 9 1844-31.50Q1808-72 1808-138L1808-645Q1808-678 1829.50-693.50Q1851-709 1895-709L1895-141Q1895-102 1911-85Q1927-68 1964-68Q2001-68 2032-86Q2045-71 2045-51Q2045-27 2020-9Q1995 9 1953 9M2291 9Q2205 9 2152.50-37Q2100-83 2100-158Q2100-234 2155-280.50Q2210-327 2300-327Q2396-327 2458-259L2462-263Q2451-275 2437-288L2437-330Q2437-381 2405-409Q2373-437 2314-437Q2209-437 2164-354Q2148-362 2137.50-375.50Q2127-389 2127-403Q2127-430 2154-454.50Q2181-479 2225.50-494Q2270-509 2319-509Q2414-509 2468.50-462Q2523-415 2523-332L2523-58Q2523-23 2503-7Q2483 9 2440 9L2440-38Q2461-60 2463-64L2459-68Q2394 9 2291 9M2306-60Q2368-60 2403.50-86Q2439-112 2439-158Q2439-204 2404-231Q2369-258 2308-258Q2251-258 2218.50-231.50Q2186-205 2186-158Q2186-111 2217.50-85.50Q2249-60 2306-60M2955 9Q2925 3 2908-16.50Q2891-36 2891-64Q2891-83 2900-104L3139-679Q3151-709 3185-709Q3217-709 3230-679L3469-104Q3478-83 3478-64Q3478-37 3461-17Q3444 3 3414 9L3328-200L3041-200L2955 9M3070-281L3299-281L3170-608L3162-605L3180-559L3070-281M3757 209Q3705 209 3660 192Q3615 175 3589 146.50Q3563 118 3563 85Q3563 59 3580.50 47Q3598 35 3628 35Q3630 82 3664.50 109.50Q3699 137 3757 137Q3885 137 3885 13L3885-45Q3899-57 3906-67L3903-72Q3874-41 3830.50-21Q3787-1 3743-1Q3657-1 3602.50-48.50Q3548-96 3548-174L3548-335Q3548-386 3573.50-425.50Q3599-465 3643.50-487Q3688-509 3742-509Q3840-509 3906-423L3910-427L3890-452Q3890-480 3909.50-494.50Q3929-509 3973-509L3973 4Q3973 64 3945.50 110.50Q3918 157 3869 183Q3820 209 3757 209M3759-77Q3812-77 3849-105.50Q3886-134 3886-173L3886-336Q3886-377 3849.50-405Q3813-433 3761-433Q3701-433 3668-406.50Q3635-380 3635-331L3635-178Q3635-131 3667.50-104Q3700-77 3759-77M4314 9Q4253 9 4205-14.50Q4157-38 4130-79.50Q4103-121 4103-173L4103-321Q4103-374 4131.50-417Q4160-460 4208.50-484.50Q4257-509 4314-509Q4371-509 4418.50-485Q4466-461 4493.50-419Q4521-377 4521-324L4521-260Q4521-244 4509-233Q4497-222 4480-222L4188-222L4188-177Q4188-126 4220.50-95Q4253-64 4314-64Q4375-64 4407-91Q4439-118 4439-164Q4469-166 4489.50-152.50Q4510-139 4510-113Q4510-81 4482.50-53Q4455-25 4410-8Q4365 9 4314 9M4188-290L4440-290L4440-324Q4440-374 4405.50-405.50Q4371-437 4314-437Q4257-437 4222.50-405.50Q4188-374 4188-324L4188-290M4636 9L4636-435Q4636-509 4720-509L4720-445Q4711-436 4699-418L4703-414Q4733-456 4781-482.50Q4829-509 4885-509Q4966-509 5013-461Q5060-413 5060-337L5060-55Q5060-22 5038.50-6.50Q5017 9 4973 9L4973-328Q4973-376 4946-404Q4919-432 4864-432Q4827-432 4794.50-416.50Q4762-401 4742.50-374.50Q4723-348 4723-317L4723-55Q4723-22 4701.50-6.50Q4680 9 4636 9M5389 9Q5318 9 5283-31.50Q5248-72 5248-138L5248-430L5155-430Q5155-464 5170-482Q5185-500 5211-500L5249-500L5249-595Q5249-628 5270.50-643.50Q5292-659 5335-659L5335-500L5468-500Q5468-430 5405-430L5336-430L5336-141Q5336-101 5350.50-84.50Q5365-68 5403-68Q5438-68 5469-86Q5482-73 5482-51Q5482-27 5457-9Q5432 9 5389 9M5768 9Q5717 9 5672-6.50Q5627-22 5599.50-51Q5572-80 5572-119Q5572-167 5630-171Q5640-115 5677.50-88.50Q5715-62 5773-62Q5831-62 5863-79Q5895-96 5895-131Q5895-156 5882-171.50Q5869-187 5840.50-198.50Q5812-210 5759-221Q5693-236 5654-253Q5615-270 5594.50-298Q5574-326 5574-372Q5574-411 5598-442.50Q5622-474 5664.50-491.50Q5707-509 5761-509Q5811-509 5855.50-495Q5900-481 5927.50-455Q5955-429 5955-395Q5955-372 5937-358.50Q5919-345 5887-343Q5884-387 5851.50-412.50Q5819-438 5761-438Q5713-438 5685-420Q5657-402 5657-372Q5657-340 5683.50-324.50Q5710-309 5774-295Q5879-274 5928.50-237.50Q5978-201 5978-134Q5978-66 5923-28.50Q5868 9 5768 9";
|
|
222
68
|
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
return Math.round(iconH * (1 / 2) * (11 / 7));
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
/** Plus Jakarta Sans caps are 0.7em, so this em size makes them half the icon. */
|
|
229
|
-
function jakartaSize(iconH: number) {
|
|
230
|
-
return (iconH / 2) / 0.7;
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
function LogoJakarta({ iconH, color }: { iconH: number; color?: string }) {
|
|
234
|
-
return (
|
|
235
|
-
<span
|
|
236
|
-
aria-hidden
|
|
237
|
-
className="shrink-0 font-bold leading-none tracking-[-0.02em]"
|
|
238
|
-
style={{ fontFamily: '"Plus Jakarta Sans Variable", sans-serif', fontSize: jakartaSize(iconH), color }}
|
|
239
|
-
>
|
|
240
|
-
{WORDMARK}
|
|
241
|
-
</span>
|
|
242
|
-
);
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
function LogoWordmark({ height, color }: { height: number; color?: string }) {
|
|
69
|
+
function LogoWordmark({ iconH, color }: { iconH: number; color?: string }) {
|
|
70
|
+
const scale = (iconH * 4) / 10 / WORD_CAP;
|
|
246
71
|
return (
|
|
247
72
|
<svg
|
|
248
73
|
xmlns="http://www.w3.org/2000/svg"
|
|
249
|
-
viewBox={
|
|
250
|
-
width={
|
|
251
|
-
height={
|
|
74
|
+
viewBox={`${WORD_X} ${WORD_Y} ${WORD_W} ${WORD_H}`}
|
|
75
|
+
width={WORD_W * scale}
|
|
76
|
+
height={WORD_H * scale}
|
|
252
77
|
aria-hidden
|
|
253
78
|
className="shrink-0"
|
|
254
|
-
shapeRendering="crispEdges"
|
|
255
79
|
>
|
|
256
|
-
<
|
|
257
|
-
{WORD_CELLS.map(([x, y]) => (
|
|
258
|
-
<rect key={`${x}-${y}`} x={x} y={y} width={15.2} height={15.2} />
|
|
259
|
-
))}
|
|
260
|
-
</g>
|
|
80
|
+
<path fill={color ?? "currentColor"} d={WORD_PATH} />
|
|
261
81
|
</svg>
|
|
262
82
|
);
|
|
263
83
|
}
|
|
264
84
|
|
|
265
|
-
export function Logo({ variant = "full", size = 32,
|
|
85
|
+
export function Logo({ variant = "full", size = 32, color, className, style }: LogoProps) {
|
|
266
86
|
const iconH = size;
|
|
267
87
|
const mark = <LogoMark height={iconH} color={color} />;
|
|
268
|
-
const word =
|
|
269
|
-
const root = cn("inline-flex items-center text-foreground", variant === "full" && "gap-
|
|
88
|
+
const word = <LogoWordmark iconH={iconH} color={color} />;
|
|
89
|
+
const root = cn("inline-flex items-center text-foreground", variant === "full" && "gap-3", className);
|
|
270
90
|
|
|
271
91
|
return (
|
|
272
92
|
<span role="img" aria-label={WORDMARK} className={root} style={style}>
|
|
@@ -2,7 +2,7 @@ import { type MouseEvent, useLayoutEffect, useRef } from "react";
|
|
|
2
2
|
import { cn } from "../lib/cn";
|
|
3
3
|
import { OverlayScroll } from "../scroll/OverlayScroll";
|
|
4
4
|
import { type MarkdownDoc, readInlineEdit, writeInlineEdit } from "./blocks";
|
|
5
|
-
import { BlockBody, headingClass, ListItem, spaceBefore } from "./MarkdownViewer";
|
|
5
|
+
import { BlockBody, headingClass, ListItem, markdownVariantStyle, spaceBefore } from "./MarkdownViewer";
|
|
6
6
|
|
|
7
7
|
function BlockEditor({ value, mono, className, caret = "end", onChange, onBlur, onEnter }: { value: string; mono?: boolean; className?: string; caret?: "start" | "end"; onChange: (value: string) => void; onBlur: () => void; onEnter?: (before: string, after: string) => void }) {
|
|
8
8
|
const ref = useRef<HTMLTextAreaElement>(null);
|
|
@@ -57,7 +57,7 @@ function BlockEditor({ value, mono, className, caret = "end", onChange, onBlur,
|
|
|
57
57
|
});
|
|
58
58
|
}}
|
|
59
59
|
className={cn(
|
|
60
|
-
"block w-full resize-none overflow-hidden border-0 bg-transparent p-0 text-
|
|
60
|
+
"block w-full resize-none overflow-hidden border-0 bg-transparent p-0 text-(length:--md-body-size,16px) leading-(--md-body-leading,24px) text-(--md-ink) shadow-none outline-none ring-0 placeholder:text-placeholder focus:outline-none focus:ring-0",
|
|
61
61
|
mono && "font-mono text-[13px] leading-5",
|
|
62
62
|
className,
|
|
63
63
|
)}
|
|
@@ -88,7 +88,7 @@ export type MarkdownPreviewProps = {
|
|
|
88
88
|
export function MarkdownPreview({ doc, editingIndex, readOnly, placeholder = "Write markdown…", onStartEdit, onEditMouseDown, onChangeBody, onBlurBlock, onEnterList, caret = "end", onAppend }: MarkdownPreviewProps) {
|
|
89
89
|
return (
|
|
90
90
|
<OverlayScroll className="h-full bg-card">
|
|
91
|
-
<div className="mx-auto flex w-full max-w-3xl flex-col px-8 py-6">
|
|
91
|
+
<div className="mx-auto flex w-full max-w-3xl flex-col px-8 py-6" style={markdownVariantStyle("docs")}>
|
|
92
92
|
{doc.blocks.map((block, index) => {
|
|
93
93
|
const editing = editingIndex === index;
|
|
94
94
|
const locked = block.kind === "mermaid" || readOnly;
|
|
@@ -29,13 +29,13 @@ export function MarkdownTable({ children }: { children: ReactNode }) {
|
|
|
29
29
|
}, []);
|
|
30
30
|
|
|
31
31
|
return (
|
|
32
|
-
<div className="relative my-
|
|
32
|
+
<div className="relative my-(--md-table-my,16px) max-w-full overflow-hidden rounded-xl border border-border bg-card group">
|
|
33
33
|
<ButtonCopy getText={getText} label="Copy as Markdown" className="absolute top-1 right-1 z-10 opacity-0 group-hover:opacity-100" />
|
|
34
34
|
|
|
35
35
|
<div className="overflow-x-auto">
|
|
36
36
|
<table
|
|
37
37
|
ref={tableRef}
|
|
38
|
-
className="w-max min-w-full border-separate border-spacing-0 text-
|
|
38
|
+
className="w-max min-w-full border-separate border-spacing-0 text-(length:--md-table-size,15px) [&_th]:max-w-[360px] [&_td]:max-w-[360px] [&_th]:whitespace-normal [&_td]:whitespace-normal [&_th]:wrap-normal [&_td]:wrap-normal [&_th]:bg-(--nonla-table-head) [&_th]:font-semibold [&_th]:px-2.5 [&_th]:py-1.5 [&_th]:text-left [&_th]:align-top [&_th]:border-r [&_th]:border-b [&_th]:border-border [&_th:last-child]:border-r-0 [&_td]:px-2.5 [&_td]:py-1.5 [&_td]:align-top [&_td]:bg-card [&_td]:border-r [&_td]:border-b [&_td]:border-border [&_td:last-child]:border-r-0 [&_tbody_tr:last-child_td]:border-b-0"
|
|
39
39
|
>
|
|
40
40
|
{children}
|
|
41
41
|
</table>
|