devnonla-ui 0.9.1 → 0.10.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 CHANGED
@@ -55,7 +55,7 @@ Aliases: `xs` → small, `middle` / `medium` → default.
55
55
 
56
56
  All color lives in **`--nonla-*` knobs** (`src/styles.css`). Components never hardcode palette hex.
57
57
 
58
- Dark is the default (`:root` and `.dark`). `.light` is the daylight palette. `<App>` calls `initColorMode()` once and restores `localStorage` key `nonla-color-mode`, falling back to dark. Switch with `setColorMode("light" | "dark")` or `<ThemeToggle>`. To start in daylight before paint, put `class="light"` on `<html>`.
58
+ Dark is the default (`:root` and `.dark`). `.light` is the daylight palette. `<App>` calls `initColorMode()` once and restores `localStorage` key `nonla-color-mode`, falling back to dark. Switch with `setColorMode("light" | "dark")` or `<ThemeToggle>`. `setColorPreference("light" | "dark" | "system")` and `<ThemeSwitcher>` also store `system`, which follows the OS and still paints `light` or `dark`. To start in daylight before paint, put `class="light"` on `<html>`.
59
59
 
60
60
  **Other apps** — import the CSS, then override knobs. Do not fork Button/Tag/….
61
61
 
@@ -194,14 +194,42 @@ Primitives (`ChatWelcome`, `ChatUserMessage`, `ChatAgentMessage`, `ChatThinking`
194
194
 
195
195
  # Markdown
196
196
 
197
- `MarkdownEditor` edits markdown in preview, source, or diff. Pass `original` to enable the diff view. `diffLayout` is side by side by default. `readOnly` shows a finished document and hides the mode switcher.
197
+ `MarkdownViewer` renders markdown for reading: headings, lists, tables, code, and mermaid. Agent replies use the same view.
198
+
199
+ `MarkdownEditor` edits markdown in preview, source, or diff. Pass `original` to enable the diff view. `diffLayout` is side by side by default. `readOnly` locks the editor and hides the mode switcher.
198
200
 
199
201
  ```tsx
200
- import { MarkdownEditor } from "devnonla-ui";
202
+ import { MarkdownEditor, MarkdownViewer } from "devnonla-ui";
201
203
 
204
+ <MarkdownViewer value={article} />
202
205
  <MarkdownEditor value={text} original={previous} onChange={setText} />
203
206
  ```
204
207
 
208
+ # Typography
209
+
210
+ `Text`, `Title`, `Paragraph`, and `Link` share one decoration set: `type` (`secondary` | `success` | `warning` | `danger`), `disabled`, `mark`, `code`, `keyboard`, `underline`, `delete`, `strong`, and `italic`. `Title` `level` is 1–5. `Typography` groups the same pieces.
211
+
212
+ ```tsx
213
+ import { Link, Paragraph, Text, Title } from "devnonla-ui";
214
+
215
+ <Title level={2}>Agents</Title>
216
+ <Paragraph>Run them on your machine.</Paragraph>
217
+ <Text type="secondary">Updated today</Text>
218
+ <Link href="https://nonlaagents.com">nonlaagents.com</Link>
219
+ ```
220
+
221
+ # Logo
222
+
223
+ `Logo` is the mark and the wordmark “Nonla Agents”. `variant` is `icon`, `text`, or `full` (default). `face` is `pixel` (default) or `jakarta`. `size` is the icon height in px (default 32). `color` recolors the mark and the wordmark; the eyes and the smile stay.
224
+
225
+ ```tsx
226
+ import { Logo } from "devnonla-ui";
227
+
228
+ <Logo />
229
+ <Logo variant="icon" size={24} />
230
+ <Logo face="jakarta" color="#181818" />
231
+ ```
232
+
205
233
  # Icons
206
234
 
207
235
  `SolarIcon` renders vendored Solar icons (`@iconify-json/solar`) as inline SVG, so they follow `currentColor`. Default style is `linear`. A legacy Fluent Color id such as `settings-24` still resolves to the Solar equivalent.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "devnonla-ui",
3
- "version": "0.9.1",
3
+ "version": "0.10.0",
4
4
  "type": "module",
5
5
  "description": "NonlaUI — React controls for Nonla Agents",
6
6
  "author": "devlangla <devlangla0x01@gmail.com>",
@@ -38,6 +38,7 @@
38
38
  },
39
39
  "dependencies": {
40
40
  "@fontsource-variable/inter": "^5.3.0",
41
+ "@fontsource-variable/plus-jakarta-sans": "^5.3.0",
41
42
  "@iconify-json/solar": "^1.2.13",
42
43
  "@radix-ui/react-checkbox": "^1.3.3",
43
44
  "@radix-ui/react-context-menu": "^2.3.7",
package/src/chat/index.ts CHANGED
@@ -18,8 +18,8 @@ export type { ChatErrorProps } from "./message-ui/ChatError";
18
18
  export { ChatError } from "./message-ui/ChatError";
19
19
  export type { ChatInputProps } from "./message-ui/ChatInput";
20
20
  export { ChatInput } from "./message-ui/ChatInput";
21
- export type { ChatMarkdownProps, ChatMarkdownStreamState } from "./message-ui/ChatMarkdown";
22
- export { ChatMarkdown, chatBodyClass, chatMarkdownClass, chatMarkdownComponents, createChatMarkdownComponents } from "./message-ui/ChatMarkdown";
21
+ export type { ChatMarkdownProps } from "./message-ui/ChatMarkdown";
22
+ export { ChatMarkdown } from "./message-ui/ChatMarkdown";
23
23
  export { ChatSpinner } from "./message-ui/ChatSpinner";
24
24
  export type { ChatThinkingProps } from "./message-ui/ChatThinking";
25
25
  export { ChatThinking } from "./message-ui/ChatThinking";
@@ -27,8 +27,6 @@ export type { ChatUserMessageProps } from "./message-ui/ChatUserMessage";
27
27
  export { ChatUserMessage } from "./message-ui/ChatUserMessage";
28
28
  export type { ChatWelcomeProps } from "./message-ui/ChatWelcome";
29
29
  export { ChatWelcome } from "./message-ui/ChatWelcome";
30
- export type { MermaidBlockProps } from "./message-ui/MermaidBlock";
31
- export { MermaidBlock } from "./message-ui/MermaidBlock";
32
30
  export type { BackgroundTasksBarProps } from "./tool-ui/BackgroundTasksBar";
33
31
  export { BackgroundTasksBar } from "./tool-ui/BackgroundTasksBar";
34
32
  export { BackgroundTaskToolUI } from "./tool-ui/BackgroundTaskToolUI";
@@ -14,16 +14,12 @@ export type ChatAgentMessageProps = {
14
14
  };
15
15
 
16
16
  export function ChatAgentMessage({ content, children, thinking, thinkingDuration, thinkingStreaming, className }: ChatAgentMessageProps) {
17
- const body = children ?? (content ? <p className="m-0 whitespace-pre-wrap wrap-break-word">{content}</p> : null);
17
+ const body = children ?? (content ? <p className="m-0 whitespace-pre-wrap wrap-break-word text-(length:--chat-body-size) leading-(--chat-body-leading) text-(--nonla-ink)">{content}</p> : null);
18
18
 
19
19
  return (
20
20
  <div className={cn("nonla-chat-agent mt-1", className)}>
21
21
  {thinking ? <ChatThinking thinking={thinking} duration={thinkingDuration ?? 0} streaming={thinkingStreaming} /> : null}
22
- {body ? (
23
- <div className="min-w-0 px-4 pb-0.5">
24
- <div className="nonla-chat-body text-(length:--chat-body-size) leading-(--chat-body-leading) text-(--nonla-ink)">{body}</div>
25
- </div>
26
- ) : null}
22
+ {body ? <div className="min-w-0 px-4 pb-0.5">{body}</div> : null}
27
23
  </div>
28
24
  );
29
25
  }
@@ -1,129 +1,11 @@
1
- import { useRef } from "react";
2
- import ReactMarkdown, { type Components } from "react-markdown";
3
- import remarkGfm from "remark-gfm";
4
- import { Checkbox } from "../../checkbox/Checkbox";
5
- import { CodeBlock } from "../../codeblock/CodeBlock";
6
- import { cn } from "../../lib/cn";
7
- import { ChatMarkdownTable } from "./ChatMarkdownTable";
8
- import { MermaidBlock } from "./MermaidBlock";
9
- import { isPendingMermaidBlock } from "./mermaidFence";
10
-
11
- /** Message body — sizes come from --chat-* tokens. */
12
- export const chatBodyClass = "font-normal text-foreground text-(length:--chat-body-size) leading-(--chat-body-leading)";
13
-
14
- /** Shared Tailwind prose classes for chat markdown. */
15
- export const chatMarkdownClass = cn(
16
- chatBodyClass,
17
- "min-w-0 wrap-anywhere",
18
- "[&_p]:m-0 [&_p]:mb-(--chat-p-mb) [&_p:last-child]:mb-0",
19
- "[&_:is(h1,h2,h3,h4,h5,h6)]:mt-(--chat-h-mt) [&_:is(h1,h2,h3,h4,h5,h6)]:mb-(--chat-h-mb) [&_:is(h1,h2,h3,h4,h5,h6)]:text-(length:--chat-body-size) [&_:is(h1,h2,h3,h4,h5,h6)]:font-semibold [&_:is(h1,h2,h3,h4,h5,h6)]:leading-(--chat-body-leading)",
20
- "[&_:is(h1,h2,h3,h4,h5,h6):first-child]:mt-0",
21
- "[&_strong]:font-semibold [&_em]:italic",
22
- "[&_blockquote]:m-0 [&_blockquote]:mb-(--chat-p-mb) [&_blockquote]:border-0 [&_blockquote]:p-0 [&_blockquote]:not-italic [&_blockquote]:text-inherit [&_blockquote:last-child]:mb-0",
23
- "[&_ul]:mt-2 [&_ul]:mb-(--chat-p-mb)",
24
- "[&_ul:not(.contains-task-list)]:list-disc [&_ul:not(.contains-task-list)]:pl-6.5",
25
- "[&_ul.contains-task-list]:list-none [&_ul.contains-task-list]:pl-6.5",
26
- "[&_li.task-list-item]:relative",
27
- "[&_li.task-list-item>.nonla-md-task-check]:absolute [&_li.task-list-item>.nonla-md-task-check]:top-0 [&_li.task-list-item>.nonla-md-task-check]:-left-5.5",
28
- "[&_ol]:mt-2 [&_ol]:mb-(--chat-p-mb) [&_ol]:list-decimal [&_ol]:pl-6.5",
29
- "[&_li]:my-1.5 [&_li]:leading-(--chat-body-leading)",
30
- "[&_a]:text-link [&_a]:no-underline [&_a]:hover:underline [&_a]:hover:underline-offset-[3px]",
31
- );
32
-
33
- export type ChatMarkdownStreamState = {
34
- content: string;
35
- streaming: boolean;
36
- };
1
+ import { MarkdownViewer } from "../../markdown-editor/MarkdownViewer";
37
2
 
38
3
  export type ChatMarkdownProps = {
39
4
  content: string;
40
5
  streaming?: boolean;
41
- className?: string;
42
6
  };
43
7
 
44
- /**
45
- * Build markdown components. Pass getState so pending-mermaid can update via ref
46
- * without recreating the components object (avoids remounting finished charts).
47
- */
48
- export function createChatMarkdownComponents(getState?: () => ChatMarkdownStreamState): Components {
49
- return {
50
- code({ className, children }) {
51
- const match = /language-(\w+)/.exec(className || "");
52
- const lang = match?.[1] ?? "";
53
- const codeText = String(children).replace(/\n$/, "");
54
- const isBlock = codeText.includes("\n") || !!match;
55
-
56
- if (isBlock) {
57
- const isMermaid = lang.toLowerCase() === "mermaid";
58
- if (isMermaid) {
59
- const state = getState?.();
60
- const pending = state ? isPendingMermaidBlock(state.content, codeText, state.streaming) : false;
61
- if (!pending) return <MermaidBlock>{codeText}</MermaidBlock>;
62
- }
63
-
64
- return <CodeBlock code={codeText} language={lang || undefined} className="my-3 last:mb-0" />;
65
- }
66
-
67
- return <span className="rounded-sm bg-foreground/12 font-mono px-px">{children}</span>;
68
- },
69
- hr() {
70
- return null;
71
- },
72
- table({ children }) {
73
- return <ChatMarkdownTable>{children}</ChatMarkdownTable>;
74
- },
75
- th({ children }) {
76
- return (
77
- <th>
78
- <div className="inline-block max-w-75 wrap-break-word">{children}</div>
79
- </th>
80
- );
81
- },
82
- td({ children }) {
83
- return (
84
- <td>
85
- <div className="inline-block max-w-75 wrap-break-word">{children}</div>
86
- </td>
87
- );
88
- },
89
- a({ href, children, ...props }) {
90
- return (
91
- <a href={href} target="_blank" rel="noopener noreferrer" {...props}>
92
- {children}
93
- </a>
94
- );
95
- },
96
- input({ type, checked }) {
97
- if (type !== "checkbox") return <input type={type} checked={checked} readOnly />;
98
- return (
99
- <span className="nonla-md-task-check pointer-events-none inline-flex h-(--chat-body-leading) items-center">
100
- <Checkbox
101
- checked={Boolean(checked)}
102
- tabIndex={-1}
103
- className="data-[state=checked]:border-white data-[state=checked]:bg-white data-[state=checked]:text-(--nonla-bg) data-[state=indeterminate]:border-white data-[state=indeterminate]:bg-white data-[state=indeterminate]:text-(--nonla-bg)"
104
- />
105
- </span>
106
- );
107
- },
108
- };
109
- }
110
-
111
- export const chatMarkdownComponents: Components = createChatMarkdownComponents();
112
-
113
- export function ChatMarkdown({ content, streaming = false, className }: ChatMarkdownProps) {
114
- const streamStateRef = useRef<ChatMarkdownStreamState>({ content, streaming });
115
- streamStateRef.current = { content, streaming };
116
-
117
- const componentsRef = useRef<Components | null>(null);
118
- if (!componentsRef.current) {
119
- componentsRef.current = createChatMarkdownComponents(() => streamStateRef.current);
120
- }
121
-
122
- return (
123
- <div className={cn(chatMarkdownClass, className)}>
124
- <ReactMarkdown remarkPlugins={[remarkGfm]} components={componentsRef.current}>
125
- {content}
126
- </ReactMarkdown>
127
- </div>
128
- );
8
+ /** Agent markdown. Uses MarkdownViewer as-is, with no extra prose styles. */
9
+ export function ChatMarkdown({ content, streaming = false }: ChatMarkdownProps) {
10
+ return <MarkdownViewer value={content} streaming={streaming} />;
129
11
  }
@@ -156,7 +156,7 @@ export function CallAgentToolUI({ msg, assistantLabel = "Assistant", assistantCo
156
156
  <p className="m-0 text-[14px] leading-[1.55] text-destructive">{parsed?.error ?? "Agent call failed"}</p>
157
157
  ) : parsed ? (
158
158
  <ExpandableBody>
159
- <ChatMarkdown content={parsed.response ?? "(no response)"} className="[&_p]:m-0 [&_p]:mb-0 [&_p+p]:mt-2" />
159
+ <ChatMarkdown content={parsed.response ?? "(no response)"} />
160
160
  </ExpandableBody>
161
161
  ) : (
162
162
  <ExpandableBody>
package/src/index.ts CHANGED
@@ -39,13 +39,11 @@ export type {
39
39
  ChatErrorProps,
40
40
  ChatInputProps,
41
41
  ChatMarkdownProps,
42
- ChatMarkdownStreamState,
43
42
  ChatThinkingProps,
44
43
  ChatToolCallProps,
45
44
  ChatToolMessage,
46
45
  ChatUserMessageProps,
47
46
  ChatWelcomeProps,
48
- MermaidBlockProps,
49
47
  ToolUIProps,
50
48
  } from "./chat";
51
49
  export {
@@ -65,16 +63,11 @@ export {
65
63
  ChatToolCall,
66
64
  ChatUserMessage,
67
65
  ChatWelcome,
68
- chatBodyClass,
69
- chatMarkdownClass,
70
- chatMarkdownComponents,
71
- createChatMarkdownComponents,
72
66
  formatBgElapsed,
73
67
  formatToolName,
74
68
  GetCurrentTimeToolUI,
75
69
  isCallAgentToolName,
76
70
  isToolRunning,
77
- MermaidBlock,
78
71
  matchesToolHook,
79
72
  matchesToolName,
80
73
  matchesToolUIName,
@@ -164,8 +157,14 @@ export { placementToRadix } from "./lib/placement";
164
157
  export type { CanonicalSize, ControlSize, ControlSizeTokens } from "./lib/sizes";
165
158
  export { CONTROL_SIZES, controlHeightVar, controlRadiusVar, controlStatusClass, getSizeTokens, normalizeSize, useControlSize } from "./lib/sizes";
166
159
  export { glassOverlayClass, glassSurfaceClass, meadowSurfaceClass } from "./lib/surface";
160
+ export type { LogoFace, LogoProps, LogoVariant } from "./logo/Logo";
161
+ export { Logo } from "./logo/Logo";
167
162
  export type { MarkdownDiffLayout, MarkdownEditorMode, MarkdownEditorProps } from "./markdown-editor/MarkdownEditor";
168
163
  export { MarkdownEditor } from "./markdown-editor/MarkdownEditor";
164
+ export type { MarkdownViewerProps } from "./markdown-editor/MarkdownViewer";
165
+ export { MarkdownViewer } from "./markdown-editor/MarkdownViewer";
166
+ export type { MermaidBlockProps } from "./markdown-editor/MermaidBlock";
167
+ export { MermaidBlock } from "./markdown-editor/MermaidBlock";
169
168
  export type { MenuItemProps, MenuRootProps, MenuTriggerProps } from "./menu/Menu";
170
169
  export { Menu, MenuAction, MenuDivider, MenuItem, MenuTrigger } from "./menu/Menu";
171
170
  export type { MessageConfig, MessageType } from "./message/message";
@@ -207,11 +206,15 @@ export type {
207
206
  export { Table } from "./table/Table";
208
207
  export type { TagProps, TagVariant } from "./tag/Tag";
209
208
  export { Tag } from "./tag/Tag";
210
- export type { NonlaColorMode, NonlaThemeColorName, NonlaThemeColors, NonlaThemeConfig, NonlaThemeKnob, NonlaThemeKnobName, NonlaTokenSnapshot } from "./theme";
211
- export { applyNonlaTheme, getColorMode, getDesignToken, initColorMode, NONLA_COLOR_MODE_KEY, NONLA_THEME_KEYS, NONLA_THEME_KNOBS, setColorMode } from "./theme";
209
+ export type { NonlaColorMode, NonlaColorPreference, NonlaThemeColorName, NonlaThemeColors, NonlaThemeConfig, NonlaThemeKnob, NonlaThemeKnobName, NonlaTokenSnapshot } from "./theme";
210
+ export { applyNonlaTheme, getColorMode, getColorPreference, getDesignToken, initColorMode, NONLA_COLOR_MODE_KEY, NONLA_THEME_KEYS, NONLA_THEME_KNOBS, setColorMode, setColorPreference } from "./theme";
211
+ export type { ThemeSwitcherProps } from "./theme-switcher/ThemeSwitcher";
212
+ export { ThemeSwitcher, useColorPreference } from "./theme-switcher/ThemeSwitcher";
212
213
  export type { ThemeToggleProps } from "./theme-toggle/ThemeToggle";
213
214
  export { ThemeToggle, useColorMode } from "./theme-toggle/ThemeToggle";
214
215
  export type { TimePickerProps, TimeValue } from "./timepicker/TimePicker";
215
216
  export { TimePicker } from "./timepicker/TimePicker";
216
217
  export type { TooltipPlacement, TooltipProps } from "./tooltip/Tooltip";
217
218
  export { Tooltip } from "./tooltip/Tooltip";
219
+ export type { TitleLevel, TypographyLinkProps, TypographyParagraphProps, TypographyProps, TypographyTextProps, TypographyTitleProps, TypographyType } from "./typography/Typography";
220
+ export { Link, Paragraph, Text, Title, Typography } from "./typography/Typography";
@@ -0,0 +1,277 @@
1
+ import "@fontsource-variable/plus-jakarta-sans/wght.css";
2
+ import type { CSSProperties } from "react";
3
+ import { cn } from "../lib/cn";
4
+
5
+ /** `icon` is the mark. `text` is the wordmark. `full` is both. */
6
+ export type LogoVariant = "icon" | "text" | "full";
7
+
8
+ /** `pixel` is the grid. `jakarta` is Plus Jakarta Sans. */
9
+ export type LogoFace = "pixel" | "jakarta";
10
+
11
+ export type LogoProps = {
12
+ variant?: LogoVariant;
13
+ /** Wordmark face. Ignored when `variant` is `icon`. Defaults to `pixel`. */
14
+ face?: LogoFace;
15
+ /** Icon height in px. Width follows each asset's aspect ratio. Defaults to 32. */
16
+ size?: number;
17
+ /** Icon and wordmark fill. Eyes and the smile stay. Omit to keep the mascot palette and the current text color. */
18
+ color?: string;
19
+ className?: string;
20
+ style?: CSSProperties;
21
+ };
22
+
23
+ const WORDMARK = "Nonla Agents";
24
+
25
+ /** viewBox `100 40 1336 960`. */
26
+ const MARK_W = 1336;
27
+ const MARK_H = 960;
28
+
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
+ /** One paint color, split so the brim stays darker and the face stays lighter than the hat. */
185
+ function markTones(color?: string) {
186
+ if (!color) return { brim: "#dd7627", face: "#ffb45c", hat: "#ffa333" };
187
+ return {
188
+ brim: `color-mix(in srgb, ${color} 70%, black)`,
189
+ face: `color-mix(in srgb, ${color} 75%, white)`,
190
+ hat: color,
191
+ };
192
+ }
193
+
194
+ /** Eyes and the smile stay ink and white. */
195
+ function LogoMark({ height, color }: { height: number; color?: string }) {
196
+ const tone = markTones(color);
197
+ return (
198
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="100 40 1336 960" width={Math.round(height * (MARK_W / MARK_H))} height={height} aria-hidden className="shrink-0">
199
+ <ellipse fill={tone.brim} cx="767" cy="640" rx="666" ry="190" />
200
+ <circle fill={tone.face} cx="768" cy="602" r="371.6" />
201
+ <path fill="none" stroke={tone.hat} strokeWidth="6" d="M112 640 A655 108 0 0 1 1422 640" />
202
+ <path fill="none" stroke={tone.brim} strokeWidth="20" d="M112 640 A655 106 0 0 1 1422 640" />
203
+ <path
204
+ fill={tone.hat}
205
+ d="M768 68 C752 68 640 145 439 300 C338 377 250 449 194 500 C172 519 150 540 134 560 C122 576 109 591 103 600 C99 613 100 628 101 640 A666 108 0 0 1 1433 640 C1434 628 1435 613 1431 600 C1425 591 1412 576 1400 560 C1384 540 1362 519 1340 500 C1284 449 1196 377 1095 300 C894 145 782 68 768 68Z"
206
+ />
207
+ <g fill="none" stroke={tone.brim} strokeWidth="6" strokeLinecap="round" opacity="0.55">
208
+ <path d="M750 96 C625 260 455 421 282 563" />
209
+ <path d="M758 96 C700 241 644 377 588 507" />
210
+ <path d="M778 96 C836 241 892 377 948 507" />
211
+ <path d="M786 96 C911 260 1081 421 1254 563" />
212
+ </g>
213
+ <ellipse fill="#121212" cx="607.5" cy="705" rx="44.5" ry="68" />
214
+ <ellipse fill="#121212" cx="921.5" cy="705" rx="44.5" ry="68" />
215
+ <ellipse fill="#ffffff" cx="618" cy="678" rx="13" ry="19" />
216
+ <ellipse fill="#ffffff" cx="932" cy="678" rx="13" ry="19" />
217
+ <path fill="none" stroke="#121212" strokeWidth="24" strokeLinecap="round" d="M696 802 C733 846 801 846 837 802" />
218
+ </svg>
219
+ );
220
+ }
221
+
222
+
223
+ /** Cap height is half the icon. Caps are 7 of the 11 viewBox rows. */
224
+ function wordmarkHeight(iconH: number) {
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 }) {
246
+ return (
247
+ <svg
248
+ xmlns="http://www.w3.org/2000/svg"
249
+ viewBox={`0 0 ${WORD_W} ${WORD_H}`}
250
+ width={Math.round(height * (WORD_W / WORD_H))}
251
+ height={height}
252
+ aria-hidden
253
+ className="shrink-0"
254
+ shapeRendering="crispEdges"
255
+ >
256
+ <g transform="translate(20 20)" fill={color ?? "currentColor"}>
257
+ {WORD_CELLS.map(([x, y]) => (
258
+ <rect key={`${x}-${y}`} x={x} y={y} width={15.2} height={15.2} />
259
+ ))}
260
+ </g>
261
+ </svg>
262
+ );
263
+ }
264
+
265
+ export function Logo({ variant = "full", size = 32, face = "pixel", color, className, style }: LogoProps) {
266
+ const iconH = size;
267
+ const mark = <LogoMark height={iconH} color={color} />;
268
+ const word = face === "jakarta" ? <LogoJakarta iconH={iconH} color={color} /> : <LogoWordmark height={wordmarkHeight(iconH)} color={color} />;
269
+ const root = cn("inline-flex items-center text-foreground", variant === "full" && "gap-2", className);
270
+
271
+ return (
272
+ <span role="img" aria-label={WORDMARK} className={root} style={style}>
273
+ {variant === "text" ? null : mark}
274
+ {variant === "icon" ? null : word}
275
+ </span>
276
+ );
277
+ }
@@ -62,7 +62,8 @@ function useControllable<T>(value: T | undefined, defaultValue: T, onChange?: (v
62
62
  * Preview renders the document. Click a heading, list item, or paragraph to edit that text in place.
63
63
  * Mermaid fences render as diagrams and stay view only.
64
64
  * Edit is the full-file text buffer. Diff compares `original` and `value` like Monaco.
65
- * `readOnly` locks editing and hides the mode switcher, so preview can show a finished document.
65
+ * `readOnly` locks editing and hides the mode switcher.
66
+ * A finished document with no editor chrome uses `MarkdownViewer`.
66
67
  */
67
68
  export function MarkdownEditor({
68
69
  value: valueProp,