devnonla-ui 0.13.0 → 0.15.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.
Files changed (86) hide show
  1. package/package.json +2 -2
  2. package/src/app/App.tsx +2 -2
  3. package/src/app/context.ts +1 -12
  4. package/src/avatar/avatar.css +107 -0
  5. package/src/blob-shape/BlobShape.tsx +337 -0
  6. package/src/button/Button.tsx +4 -4
  7. package/src/button/ButtonCopy.tsx +3 -3
  8. package/src/calendar/Calendar.tsx +1 -1
  9. package/src/card/Card.tsx +1 -1
  10. package/src/chat/AgentChatbox.tsx +1 -1
  11. package/src/chat/AgentPanel.tsx +1 -1
  12. package/src/chat/chatMessageList.tsx +5 -3
  13. package/src/chat/chatRhythm.ts +8 -0
  14. package/src/chat/common/createAgentSseSession.ts +9 -3
  15. package/src/chat/common/sse.ts +290 -122
  16. package/src/chat/common/useAgentStream.ts +1 -1
  17. package/src/chat/index.ts +2 -2
  18. package/src/chat/message-ui/ChatAgentMessage.tsx +4 -3
  19. package/src/chat/message-ui/ChatError.tsx +5 -4
  20. package/src/chat/message-ui/ChatInput.tsx +9 -8
  21. package/src/chat/message-ui/ChatMarkdown.tsx +36 -2
  22. package/src/chat/message-ui/ChatThinking.tsx +8 -7
  23. package/src/chat/message-ui/ChatUserMessage.tsx +5 -5
  24. package/src/chat/tool-ui/BackgroundTaskToolUI.tsx +7 -6
  25. package/src/chat/tool-ui/BackgroundTasksBar.tsx +9 -9
  26. package/src/chat/tool-ui/CallAgentToolUI.tsx +16 -15
  27. package/src/chat/tool-ui/ChatToolCall.tsx +13 -12
  28. package/src/chat/tool-ui/GetCurrentTimeToolUI.tsx +7 -6
  29. package/src/chat/tool-ui/ReadSkillToolUI.tsx +10 -9
  30. package/src/chat/tool-ui/RunJsToolUI.tsx +9 -8
  31. package/src/chat/tool-ui/ToolUiBadge.tsx +1 -1
  32. package/src/chat/tool-ui/ToolUiTrailing.tsx +3 -3
  33. package/src/chat/tool-ui/WebFetchToolUI.tsx +10 -9
  34. package/src/checkbox/Checkbox.tsx +2 -2
  35. package/src/codeblock/CodeBlock.tsx +1 -1
  36. package/src/colorpicker/ColorPicker.tsx +10 -8
  37. package/src/datepicker/DatePicker.tsx +3 -3
  38. package/src/desktop/DesktopHeader.tsx +2 -2
  39. package/src/desktop/DesktopIcon.tsx +3 -4
  40. package/src/desktop/DesktopStage.tsx +1 -1
  41. package/src/desktop/DesktopWindow.tsx +3 -3
  42. package/src/desktop/MeadowDesktop.tsx +2 -2
  43. package/src/drawer/Drawer.tsx +6 -2
  44. package/src/dropdown/menuClasses.ts +1 -1
  45. package/src/empty/Empty.tsx +1 -1
  46. package/src/form/variants/FieldRadio.tsx +1 -1
  47. package/src/form/variants/FieldRepeaterItem.tsx +1 -1
  48. package/src/icon/Icon.tsx +21 -0
  49. package/src/icon/glyphs.ts +35 -0
  50. package/src/index.ts +9 -23
  51. package/src/input/EditableInput.tsx +5 -4
  52. package/src/input/Input.tsx +15 -7
  53. package/src/lib/sizes.ts +6 -6
  54. package/src/lib/surface.ts +14 -4
  55. package/src/markdown-editor/MarkdownDiff.tsx +4 -4
  56. package/src/markdown-editor/MarkdownEditor.tsx +4 -4
  57. package/src/markdown-editor/MarkdownPreview.tsx +6 -6
  58. package/src/markdown-editor/MarkdownSource.tsx +1 -1
  59. package/src/markdown-editor/MarkdownTable.tsx +48 -11
  60. package/src/markdown-editor/MarkdownViewer.tsx +28 -31
  61. package/src/markdown-editor/MermaidBlock.tsx +5 -5
  62. package/src/markdown-editor/ReactCodeFrame.tsx +10 -6
  63. package/src/markdown-editor/ReactCodeSandbox.tsx +2 -2
  64. package/src/markdown-editor/markdownScale.ts +66 -127
  65. package/src/menu/Menu.tsx +3 -3
  66. package/src/message/message.tsx +18 -8
  67. package/src/modal/Modal.tsx +13 -7
  68. package/src/pagination/Pagination.tsx +7 -7
  69. package/src/popover/Popover.tsx +1 -1
  70. package/src/scroll/OverlayScroll.tsx +13 -5
  71. package/src/segmented/Segmented.tsx +1 -1
  72. package/src/select/Select.tsx +4 -4
  73. package/src/sidebar/Sidebar.tsx +39 -36
  74. package/src/skeleton/Skeleton.tsx +4 -4
  75. package/src/spin/Spin.tsx +14 -2
  76. package/src/splitter/Splitter.tsx +1 -1
  77. package/src/styles.css +188 -844
  78. package/src/table/Table.tsx +12 -12
  79. package/src/tabs/Tabs.tsx +76 -14
  80. package/src/tag/Tag.tsx +3 -3
  81. package/src/theme-switcher/ThemeSwitcher.tsx +6 -6
  82. package/src/theme.ts +53 -147
  83. package/src/timepicker/TimePicker.tsx +2 -2
  84. package/src/typography/Typography.tsx +8 -8
  85. package/src/icon/SolarIcon.tsx +0 -39
  86. package/src/icon/solar.ts +0 -172
@@ -1,39 +0,0 @@
1
- import { useEffect, useState } from "react";
2
- import { cn } from "../lib/cn";
3
- import { ensureSolarIcons, getSolarSvg } from "./solar";
4
-
5
- export function SolarIcon({ name, size = 16, className }: { name: string; size?: number; className?: string }) {
6
- const [svg, setSvg] = useState<string | null>(() => getSolarSvg(name));
7
-
8
- useEffect(() => {
9
- const cached = getSolarSvg(name);
10
- if (cached) {
11
- setSvg(cached);
12
- return;
13
- }
14
- let cancelled = false;
15
- void ensureSolarIcons().then(() => {
16
- if (!cancelled) setSvg(getSolarSvg(name));
17
- });
18
- return () => {
19
- cancelled = true;
20
- };
21
- }, [name]);
22
-
23
- if (!svg) {
24
- return <span aria-hidden className={cn("inline-block shrink-0", className)} style={{ width: size, height: size }} />;
25
- }
26
-
27
- return (
28
- <span
29
- aria-hidden
30
- className={cn("inline-flex shrink-0 select-none text-current pointer-events-none [&_svg]:size-full", className)}
31
- style={{ width: size, height: size }}
32
- // biome-ignore lint/security/noDangerouslySetInnerHtml: Solar SVG comes from the vendored icon pack, keyed by name
33
- dangerouslySetInnerHTML={{ __html: svg }}
34
- />
35
- );
36
- }
37
-
38
- /** @deprecated Use SolarIcon. Same component — Solar icons, not Fluent Color. */
39
- export const FluentIcon = SolarIcon;
package/src/icon/solar.ts DELETED
@@ -1,172 +0,0 @@
1
- export const ICON_PREFIX = "solar";
2
- export const DEFAULT_ICON_STYLE = "linear";
3
- export const DEFAULT_ICON_NAME = "bot-linear";
4
- export const DEFAULT_TOOL_ICON = `${ICON_PREFIX}:${DEFAULT_ICON_NAME}`;
5
-
6
- const STYLE_SUFFIXES = ["bold-duotone", "line-duotone", "linear", "outline", "broken", "bold"] as const;
7
-
8
- export type SolarIconStyle = (typeof STYLE_SUFFIXES)[number];
9
-
10
- /** Fluent Color ids that do not share a Solar stem. Values are full Solar icon ids. */
11
- const LEGACY_NAMES: Record<string, string> = {
12
- alert: "bell-linear",
13
- apps: "widget-4-linear",
14
- "apps-list": "list-linear",
15
- "apps-list-detail": "sidebar-minimalistic-linear",
16
- "arrow-square-down": "alt-arrow-down-linear",
17
- "arrow-sync": "refresh-linear",
18
- board: "kanban-linear",
19
- "book-open": "book-2-linear",
20
- "bot-sparkle": "magic-stick-3-linear",
21
- "calendar-clock": "calendar-mark-linear",
22
- chat: "chat-round-linear",
23
- "chat-bubbles-question": "chat-round-question-mark-linear",
24
- "chat-more": "chat-round-dots-linear",
25
- "chat-multiple": "dialog-2-linear",
26
- checkbox: "check-square-linear",
27
- clock: "clock-circle-linear",
28
- "code-block": "code-square-linear",
29
- comment: "dialog-linear",
30
- "content-view": "window-frame-linear",
31
- "data-bar-vertical-ascending": "chart-linear",
32
- "dismiss-circle": "close-circle-linear",
33
- drafts: "notes-linear",
34
- edit: "pen-linear",
35
- "fast-forward-circle": "round-double-alt-arrow-right-linear",
36
- form: "clipboard-text-linear",
37
- "image-off": "gallery-remove-linear",
38
- "lightbulb-filament": "lightbulb-linear",
39
- "list-bar": "hamburger-menu-linear",
40
- "number-symbol-square": "hashtag-square-linear",
41
- options: "tuning-2-linear",
42
- "people-community": "users-group-rounded-linear",
43
- person: "user-rounded-linear",
44
- "search-sparkle": "magnifer-linear",
45
- "share-android": "share-linear",
46
- "share-ios": "square-share-line-linear",
47
- sparkle: "stars-linear",
48
- "text-edit-style": "text-field-linear",
49
- vault: "safe-square-linear",
50
- "wrench-screwdriver": "toolbox-linear",
51
- };
52
-
53
- type IconifyIcon = { body: string; width?: number; height?: number; left?: number; top?: number };
54
- type IconifyAlias = { parent: string };
55
- type IconifyPack = {
56
- icons?: Record<string, IconifyIcon>;
57
- aliases?: Record<string, IconifyAlias>;
58
- width?: number;
59
- height?: number;
60
- };
61
-
62
- let pack: IconifyPack | null = null;
63
- let memoryNames: string[] | null = null;
64
- const svgByName = new Map<string, string>();
65
- const imgSrcByName = new Map<string, string>();
66
- let inflight: Promise<string[]> | null = null;
67
-
68
- function hasStyle(name: string) {
69
- return STYLE_SUFFIXES.some((style) => name.endsWith(`-${style}`));
70
- }
71
-
72
- function stripStyle(name: string) {
73
- for (const style of STYLE_SUFFIXES) {
74
- const suffix = `-${style}`;
75
- if (name.endsWith(suffix)) return name.slice(0, -suffix.length);
76
- }
77
- return name;
78
- }
79
-
80
- function bareName(value: string) {
81
- let name = value.trim();
82
- if (name.startsWith(`${ICON_PREFIX}:`)) name = name.slice(ICON_PREFIX.length + 1);
83
- if (name.startsWith("fluent-color:")) name = name.slice("fluent-color:".length);
84
- return name;
85
- }
86
-
87
- /** Solar icon id. Accepts `solar:…`, a styled id, or a legacy Fluent Color id such as `settings-24`. Pass `style` to force a weight such as `bold-duotone`. */
88
- export function solarIconName(value: string, style?: SolarIconStyle): string {
89
- const name = bareName(value);
90
- const stem = name.replace(/-24$/, "");
91
- const resolved = hasStyle(name) ? name : (LEGACY_NAMES[stem] ?? LEGACY_NAMES[name] ?? `${stem}-${DEFAULT_ICON_STYLE}`);
92
- if (!style || resolved.endsWith(`-${style}`)) return resolved;
93
- return `${stripStyle(resolved)}-${style}`;
94
- }
95
-
96
- export function solarIconRef(name: string): string {
97
- return `${ICON_PREFIX}:${solarIconName(name)}`;
98
- }
99
-
100
- function lookup(name: string): IconifyIcon | null {
101
- if (!pack) return null;
102
- const seen = new Set<string>();
103
- let current = name;
104
- while (current && !seen.has(current)) {
105
- seen.add(current);
106
- const icon = pack.icons?.[current];
107
- if (icon?.body) return icon;
108
- const parent = pack.aliases?.[current]?.parent;
109
- if (!parent) return null;
110
- current = parent;
111
- }
112
- return null;
113
- }
114
-
115
- function toSvg(icon: IconifyIcon): string {
116
- const left = icon.left ?? 0;
117
- const top = icon.top ?? 0;
118
- const width = icon.width ?? pack?.width ?? 24;
119
- const height = icon.height ?? pack?.height ?? 24;
120
- return `<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="${left} ${top} ${width} ${height}">${icon.body}</svg>`;
121
- }
122
-
123
- /** Loads the vendored Solar pack (code-split). No network. */
124
- export function ensureSolarIcons(): Promise<string[]> {
125
- if (memoryNames) return Promise.resolve(memoryNames);
126
- if (inflight) return inflight;
127
- inflight = import("@iconify-json/solar/icons.json")
128
- .then((mod) => {
129
- pack = (mod.default ?? mod) as IconifyPack;
130
- memoryNames = [...Object.keys(pack.icons ?? {}), ...Object.keys(pack.aliases ?? {})];
131
- return memoryNames;
132
- })
133
- .finally(() => {
134
- inflight = null;
135
- });
136
- return inflight;
137
- }
138
-
139
- export function getIconNames(): string[] {
140
- return memoryNames ?? [];
141
- }
142
-
143
- export function getSolarSvg(name: string): string | null {
144
- if (!pack) return null;
145
- const resolved = solarIconName(name);
146
- const cached = svgByName.get(resolved);
147
- if (cached) return cached;
148
- const icon = lookup(resolved);
149
- if (!icon) return null;
150
- const svg = toSvg(icon);
151
- svgByName.set(resolved, svg);
152
- return svg;
153
- }
154
-
155
- export function getSolarImgSrc(name: string): string | null {
156
- const resolved = solarIconName(name);
157
- const hit = imgSrcByName.get(resolved);
158
- if (hit) return hit;
159
- const svg = getSolarSvg(name);
160
- if (!svg) return null;
161
- const src = `data:image/svg+xml;charset=utf-8,${encodeURIComponent(svg)}`;
162
- imgSrcByName.set(resolved, src);
163
- return src;
164
- }
165
-
166
- export function isSvgIcon(value?: string | null): boolean {
167
- return !!value && value.trimStart().startsWith("<svg");
168
- }
169
-
170
- export function isSolarIcon(value?: string | null): boolean {
171
- return !!value && (value.startsWith(`${ICON_PREFIX}:`) || value.startsWith("fluent-color:"));
172
- }