@tangle-network/ui 1.0.0 → 1.0.1
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/CHANGELOG.md +6 -0
- package/dist/{chunk-LISXUB4D.js → chunk-XY2FP763.js} +87 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +5 -1
- package/dist/primitives.d.ts +8 -1
- package/dist/primitives.js +5 -1
- package/package.json +1 -1
- package/src/primitives/index.ts +2 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @tangle-network/ui
|
|
2
2
|
|
|
3
|
+
## 1.0.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 0db7afc: Expose `ThemeToggle` and `useTheme` from `@tangle-network/ui/primitives`. The component and hook were bulk-imported in `1.0.0` but never wired into `primitives/index.ts`, leaving them inaccessible to consumers.
|
|
8
|
+
|
|
3
9
|
## 1.0.0
|
|
4
10
|
|
|
5
11
|
### Minor Changes
|
|
@@ -1175,6 +1175,91 @@ function SidebarDropZone({
|
|
|
1175
1175
|
);
|
|
1176
1176
|
}
|
|
1177
1177
|
|
|
1178
|
+
// src/primitives/theme-toggle.tsx
|
|
1179
|
+
import { useCallback as useCallback4, useEffect as useEffect2, useState as useState5 } from "react";
|
|
1180
|
+
import { jsx as jsx16, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
1181
|
+
function getSystemTheme() {
|
|
1182
|
+
return window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
1183
|
+
}
|
|
1184
|
+
function applyTheme(theme) {
|
|
1185
|
+
const resolved = theme === "system" ? getSystemTheme() : theme;
|
|
1186
|
+
document.documentElement.classList.toggle("dark", resolved === "dark");
|
|
1187
|
+
}
|
|
1188
|
+
function useTheme() {
|
|
1189
|
+
const [theme, setThemeState] = useState5(() => {
|
|
1190
|
+
if (typeof window === "undefined") return "system";
|
|
1191
|
+
return localStorage.getItem("theme") ?? "system";
|
|
1192
|
+
});
|
|
1193
|
+
const setTheme = useCallback4((next) => {
|
|
1194
|
+
setThemeState(next);
|
|
1195
|
+
if (next === "system") {
|
|
1196
|
+
localStorage.removeItem("theme");
|
|
1197
|
+
} else {
|
|
1198
|
+
localStorage.setItem("theme", next);
|
|
1199
|
+
}
|
|
1200
|
+
applyTheme(next);
|
|
1201
|
+
}, []);
|
|
1202
|
+
useEffect2(() => {
|
|
1203
|
+
applyTheme(theme);
|
|
1204
|
+
if (theme !== "system") return;
|
|
1205
|
+
const mq = window.matchMedia("(prefers-color-scheme: dark)");
|
|
1206
|
+
const handler = () => applyTheme("system");
|
|
1207
|
+
mq.addEventListener("change", handler);
|
|
1208
|
+
return () => mq.removeEventListener("change", handler);
|
|
1209
|
+
}, [theme]);
|
|
1210
|
+
return { theme, setTheme };
|
|
1211
|
+
}
|
|
1212
|
+
var iconClass = "h-4 w-4";
|
|
1213
|
+
function SunIcon() {
|
|
1214
|
+
return /* @__PURE__ */ jsxs14(
|
|
1215
|
+
"svg",
|
|
1216
|
+
{
|
|
1217
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1218
|
+
viewBox: "0 0 24 24",
|
|
1219
|
+
fill: "none",
|
|
1220
|
+
stroke: "currentColor",
|
|
1221
|
+
strokeWidth: 2,
|
|
1222
|
+
strokeLinecap: "round",
|
|
1223
|
+
strokeLinejoin: "round",
|
|
1224
|
+
className: iconClass,
|
|
1225
|
+
children: [
|
|
1226
|
+
/* @__PURE__ */ jsx16("circle", { cx: 12, cy: 12, r: 5 }),
|
|
1227
|
+
/* @__PURE__ */ jsx16("path", { d: "M12 1v2M12 21v2M4.22 4.22l1.42 1.42M18.36 18.36l1.42 1.42M1 12h2M21 12h2M4.22 19.78l1.42-1.42M18.36 5.64l1.42-1.42" })
|
|
1228
|
+
]
|
|
1229
|
+
}
|
|
1230
|
+
);
|
|
1231
|
+
}
|
|
1232
|
+
function MoonIcon() {
|
|
1233
|
+
return /* @__PURE__ */ jsx16(
|
|
1234
|
+
"svg",
|
|
1235
|
+
{
|
|
1236
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1237
|
+
viewBox: "0 0 24 24",
|
|
1238
|
+
fill: "none",
|
|
1239
|
+
stroke: "currentColor",
|
|
1240
|
+
strokeWidth: 2,
|
|
1241
|
+
strokeLinecap: "round",
|
|
1242
|
+
strokeLinejoin: "round",
|
|
1243
|
+
className: iconClass,
|
|
1244
|
+
children: /* @__PURE__ */ jsx16("path", { d: "M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z" })
|
|
1245
|
+
}
|
|
1246
|
+
);
|
|
1247
|
+
}
|
|
1248
|
+
function ThemeToggle() {
|
|
1249
|
+
const { theme, setTheme } = useTheme();
|
|
1250
|
+
const resolved = theme === "system" ? getSystemTheme() : theme;
|
|
1251
|
+
return /* @__PURE__ */ jsx16(
|
|
1252
|
+
"button",
|
|
1253
|
+
{
|
|
1254
|
+
type: "button",
|
|
1255
|
+
onClick: () => setTheme(resolved === "dark" ? "light" : "dark"),
|
|
1256
|
+
className: "inline-flex items-center justify-center rounded-md p-2 text-muted-foreground hover:bg-accent hover:text-accent-foreground transition-colors",
|
|
1257
|
+
"aria-label": `Switch to ${resolved === "dark" ? "light" : "dark"} mode`,
|
|
1258
|
+
children: resolved === "dark" ? /* @__PURE__ */ jsx16(SunIcon, {}) : /* @__PURE__ */ jsx16(MoonIcon, {})
|
|
1259
|
+
}
|
|
1260
|
+
);
|
|
1261
|
+
}
|
|
1262
|
+
|
|
1178
1263
|
export {
|
|
1179
1264
|
Dialog,
|
|
1180
1265
|
DialogTrigger,
|
|
@@ -1217,6 +1302,8 @@ export {
|
|
|
1217
1302
|
DropZone,
|
|
1218
1303
|
UploadProgress,
|
|
1219
1304
|
SidebarDropZone,
|
|
1305
|
+
useTheme,
|
|
1306
|
+
ThemeToggle,
|
|
1220
1307
|
Logo,
|
|
1221
1308
|
TangleKnot
|
|
1222
1309
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { B as Button, a as ButtonProps, b as buttonVariants } from './button-CMQuQEW_.js';
|
|
2
|
-
export { Avatar, AvatarFallback, AvatarImage, Badge, BadgeProps, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DropZone, DropZoneProps, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EmptyState, EmptyStateProps, InlineCode, InlineCodeProps, Input, InputProps, Label, Progress, SegmentedControl, SegmentedControlOption, SegmentedControlProps, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, SidebarDropZone, SidebarDropZoneProps, Skeleton, SkeletonCard, SkeletonTable, StatCard, StatCardProps, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, TerminalCursor, TerminalDisplay, TerminalInput, TerminalLine, Textarea, TextareaProps, Toast, ToastContainer, ToastProvider, UploadFile, UploadProgress, UploadProgressProps, badgeVariants, useToast } from './primitives.js';
|
|
2
|
+
export { Avatar, AvatarFallback, AvatarImage, Badge, BadgeProps, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DropZone, DropZoneProps, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EmptyState, EmptyStateProps, InlineCode, InlineCodeProps, Input, InputProps, Label, Progress, SegmentedControl, SegmentedControlOption, SegmentedControlProps, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, SidebarDropZone, SidebarDropZoneProps, Skeleton, SkeletonCard, SkeletonTable, StatCard, StatCardProps, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, TerminalCursor, TerminalDisplay, TerminalInput, TerminalLine, Textarea, TextareaProps, ThemeToggle, Toast, ToastContainer, ToastProvider, UploadFile, UploadProgress, UploadProgressProps, badgeVariants, useTheme, useToast } from './primitives.js';
|
|
3
3
|
export { Logo, LogoProps, TangleKnot } from '@tangle-network/brand';
|
|
4
4
|
export { A as ArtifactPane, a as ArtifactPaneProps } from './artifact-pane-DvJyPWV4.js';
|
|
5
5
|
export { AgentTimeline, AgentTimelineArtifactItem, AgentTimelineCustomItem, AgentTimelineItem, AgentTimelineMessageItem, AgentTimelineProps, AgentTimelineStatusItem, AgentTimelineTone, AgentTimelineToolGroupItem, AgentTimelineToolItem, ChatContainer, ChatContainerProps, ChatInput, ChatInputProps, ChatMessage, ChatMessageProps, MessageList, MessageListProps, MessageRole, PendingFile, ThinkingIndicator, ThinkingIndicatorProps, UserMessage, UserMessageProps } from './chat.js';
|
package/dist/index.js
CHANGED
|
@@ -103,11 +103,13 @@ import {
|
|
|
103
103
|
TerminalInput,
|
|
104
104
|
TerminalLine,
|
|
105
105
|
Textarea,
|
|
106
|
+
ThemeToggle,
|
|
106
107
|
ToastContainer,
|
|
107
108
|
ToastProvider,
|
|
108
109
|
UploadProgress,
|
|
110
|
+
useTheme,
|
|
109
111
|
useToast
|
|
110
|
-
} from "./chunk-
|
|
112
|
+
} from "./chunk-XY2FP763.js";
|
|
111
113
|
import {
|
|
112
114
|
Avatar,
|
|
113
115
|
AvatarFallback,
|
|
@@ -362,6 +364,7 @@ export {
|
|
|
362
364
|
TerminalInput,
|
|
363
365
|
TerminalLine,
|
|
364
366
|
Textarea,
|
|
367
|
+
ThemeToggle,
|
|
365
368
|
ThinkingIndicator,
|
|
366
369
|
TiptapEditor,
|
|
367
370
|
ToastContainer,
|
|
@@ -439,6 +442,7 @@ export {
|
|
|
439
442
|
useSSEStream,
|
|
440
443
|
useSdkSession,
|
|
441
444
|
useSessionsByActivity,
|
|
445
|
+
useTheme,
|
|
442
446
|
useToast,
|
|
443
447
|
useToolCallStream,
|
|
444
448
|
useTotalRunningSessions,
|
package/dist/primitives.d.ts
CHANGED
|
@@ -329,4 +329,11 @@ interface InlineCodeProps extends React.HTMLAttributes<HTMLElement> {
|
|
|
329
329
|
}
|
|
330
330
|
declare function InlineCode({ className, children, ...props }: InlineCodeProps): react_jsx_runtime.JSX.Element;
|
|
331
331
|
|
|
332
|
-
|
|
332
|
+
type Theme = "light" | "dark" | "system";
|
|
333
|
+
declare function useTheme(): {
|
|
334
|
+
theme: Theme;
|
|
335
|
+
setTheme: (next: Theme) => void;
|
|
336
|
+
};
|
|
337
|
+
declare function ThemeToggle(): react_jsx_runtime.JSX.Element;
|
|
338
|
+
|
|
339
|
+
export { Avatar, AvatarFallback, AvatarImage, Badge, type BadgeProps, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DropZone, type DropZoneProps, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EmptyState, type EmptyStateProps, InlineCode, type InlineCodeProps, Input, type InputProps, Label, Progress, SegmentedControl, type SegmentedControlOption, type SegmentedControlProps, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, SidebarDropZone, type SidebarDropZoneProps, Skeleton, SkeletonCard, SkeletonTable, StatCard, type StatCardProps, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, TerminalCursor, TerminalDisplay, TerminalInput, TerminalLine, Textarea, type TextareaProps, ThemeToggle, type Toast, ToastContainer, ToastProvider, type UploadFile, UploadProgress, type UploadProgressProps, badgeVariants, useTheme, useToast };
|
package/dist/primitives.js
CHANGED
|
@@ -38,11 +38,13 @@ import {
|
|
|
38
38
|
TerminalInput,
|
|
39
39
|
TerminalLine,
|
|
40
40
|
Textarea,
|
|
41
|
+
ThemeToggle,
|
|
41
42
|
ToastContainer,
|
|
42
43
|
ToastProvider,
|
|
43
44
|
UploadProgress,
|
|
45
|
+
useTheme,
|
|
44
46
|
useToast
|
|
45
|
-
} from "./chunk-
|
|
47
|
+
} from "./chunk-XY2FP763.js";
|
|
46
48
|
import {
|
|
47
49
|
Avatar,
|
|
48
50
|
AvatarFallback,
|
|
@@ -182,10 +184,12 @@ export {
|
|
|
182
184
|
TerminalInput,
|
|
183
185
|
TerminalLine,
|
|
184
186
|
Textarea,
|
|
187
|
+
ThemeToggle,
|
|
185
188
|
ToastContainer,
|
|
186
189
|
ToastProvider,
|
|
187
190
|
UploadProgress,
|
|
188
191
|
badgeVariants,
|
|
189
192
|
buttonVariants,
|
|
193
|
+
useTheme,
|
|
190
194
|
useToast
|
|
191
195
|
};
|
package/package.json
CHANGED
package/src/primitives/index.ts
CHANGED
|
@@ -116,3 +116,5 @@ export type { ArtifactPaneProps } from "./artifact-pane";
|
|
|
116
116
|
|
|
117
117
|
export { CodeBlock, CopyButton, InlineCode } from "./code-block";
|
|
118
118
|
export type { CodeBlockProps, InlineCodeProps } from "./code-block";
|
|
119
|
+
|
|
120
|
+
export { ThemeToggle, useTheme } from "./theme-toggle";
|