dreamboard 0.1.21 → 0.1.23

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 (186) hide show
  1. package/dist/{chunk-EYYWGWTO.js → chunk-2RCUHMGL.js} +343 -1911
  2. package/dist/chunk-2RCUHMGL.js.map +1 -0
  3. package/dist/{chunk-MOVHYB6E.js → chunk-GN7232BY.js} +1025 -695
  4. package/dist/chunk-GN7232BY.js.map +1 -0
  5. package/dist/{chunk-BMYC6772.js → chunk-H3O43F5P.js} +9765 -3068
  6. package/dist/chunk-H3O43F5P.js.map +1 -0
  7. package/dist/dev-host/dev-api-proxy-plugin.ts +330 -0
  8. package/dist/dev-host/dev-diagnostics.ts +62 -0
  9. package/dist/dev-host/dev-fallback-stylesheet.ts +50 -0
  10. package/dist/dev-host/dev-host-controller.ts +686 -0
  11. package/dist/dev-host/dev-host-player-query.ts +17 -0
  12. package/dist/dev-host/dev-host-session-transport.ts +52 -0
  13. package/dist/dev-host/dev-host-storage.ts +56 -0
  14. package/dist/dev-host/dev-log-relay-plugin.ts +469 -0
  15. package/dist/dev-host/dev-runtime-config.ts +14 -0
  16. package/dist/dev-host/dev-runtime-platform.ts +419 -0
  17. package/dist/dev-host/dev-virtual-modules-plugin.ts +63 -0
  18. package/dist/dev-host/host-main.css +182 -0
  19. package/dist/dev-host/host-main.tsx +754 -0
  20. package/dist/dev-host/index.html +56 -0
  21. package/dist/dev-host/plugin-main.ts +55 -0
  22. package/dist/dev-host/plugin.html +24 -0
  23. package/dist/dev-host/start-dev-server.ts +138 -0
  24. package/dist/dev-host/virtual-modules.d.ts +27 -0
  25. package/dist/dist-FEPN3BDN.js +16543 -0
  26. package/dist/dist-FEPN3BDN.js.map +1 -0
  27. package/dist/{dist-WJRJNFLI.js → dist-FRURQI7Q.js} +4 -2
  28. package/dist/index.js +3 -3
  29. package/dist/internal.js +159 -124
  30. package/dist/internal.js.map +1 -1
  31. package/dist/runtime-packages/tailwind-config/shared-styles.css +146 -0
  32. package/dist/runtime-packages/ui/src/components/.gitkeep +0 -0
  33. package/dist/runtime-packages/ui/src/components/accordion.tsx +66 -0
  34. package/dist/runtime-packages/ui/src/components/ai-elements/actions.tsx +65 -0
  35. package/dist/runtime-packages/ui/src/components/ai-elements/artifact.tsx +147 -0
  36. package/dist/runtime-packages/ui/src/components/ai-elements/branch.tsx +215 -0
  37. package/dist/runtime-packages/ui/src/components/ai-elements/canvas.tsx +22 -0
  38. package/dist/runtime-packages/ui/src/components/ai-elements/chain-of-thought.tsx +228 -0
  39. package/dist/runtime-packages/ui/src/components/ai-elements/code-block.tsx +179 -0
  40. package/dist/runtime-packages/ui/src/components/ai-elements/confirmation.tsx +158 -0
  41. package/dist/runtime-packages/ui/src/components/ai-elements/connection.tsx +28 -0
  42. package/dist/runtime-packages/ui/src/components/ai-elements/context.tsx +408 -0
  43. package/dist/runtime-packages/ui/src/components/ai-elements/controls.tsx +18 -0
  44. package/dist/runtime-packages/ui/src/components/ai-elements/conversation.tsx +97 -0
  45. package/dist/runtime-packages/ui/src/components/ai-elements/edge.tsx +140 -0
  46. package/dist/runtime-packages/ui/src/components/ai-elements/image.tsx +24 -0
  47. package/dist/runtime-packages/ui/src/components/ai-elements/inline-citation.tsx +287 -0
  48. package/dist/runtime-packages/ui/src/components/ai-elements/loader.tsx +96 -0
  49. package/dist/runtime-packages/ui/src/components/ai-elements/message.tsx +463 -0
  50. package/dist/runtime-packages/ui/src/components/ai-elements/node.tsx +71 -0
  51. package/dist/runtime-packages/ui/src/components/ai-elements/open-in-chat.tsx +365 -0
  52. package/dist/runtime-packages/ui/src/components/ai-elements/panel.tsx +15 -0
  53. package/dist/runtime-packages/ui/src/components/ai-elements/plan.tsx +142 -0
  54. package/dist/runtime-packages/ui/src/components/ai-elements/prompt-input.tsx +1380 -0
  55. package/dist/runtime-packages/ui/src/components/ai-elements/queue.tsx +274 -0
  56. package/dist/runtime-packages/ui/src/components/ai-elements/reasoning.tsx +182 -0
  57. package/dist/runtime-packages/ui/src/components/ai-elements/response.tsx +22 -0
  58. package/dist/runtime-packages/ui/src/components/ai-elements/shimmer.tsx +64 -0
  59. package/dist/runtime-packages/ui/src/components/ai-elements/sources.tsx +77 -0
  60. package/dist/runtime-packages/ui/src/components/ai-elements/suggestion.tsx +53 -0
  61. package/dist/runtime-packages/ui/src/components/ai-elements/task.tsx +87 -0
  62. package/dist/runtime-packages/ui/src/components/ai-elements/tool.tsx +165 -0
  63. package/dist/runtime-packages/ui/src/components/ai-elements/toolbar.tsx +16 -0
  64. package/dist/runtime-packages/ui/src/components/ai-elements/web-preview.tsx +263 -0
  65. package/dist/runtime-packages/ui/src/components/alert-dialog.tsx +157 -0
  66. package/dist/runtime-packages/ui/src/components/alert.tsx +66 -0
  67. package/dist/runtime-packages/ui/src/components/avatar.tsx +53 -0
  68. package/dist/runtime-packages/ui/src/components/badge.tsx +46 -0
  69. package/dist/runtime-packages/ui/src/components/button-group.tsx +83 -0
  70. package/dist/runtime-packages/ui/src/components/button.tsx +65 -0
  71. package/dist/runtime-packages/ui/src/components/card.tsx +92 -0
  72. package/dist/runtime-packages/ui/src/components/carousel.tsx +241 -0
  73. package/dist/runtime-packages/ui/src/components/collapsible.tsx +33 -0
  74. package/dist/runtime-packages/ui/src/components/command.tsx +184 -0
  75. package/dist/runtime-packages/ui/src/components/context-menu.tsx +252 -0
  76. package/dist/runtime-packages/ui/src/components/counter.tsx +11 -0
  77. package/dist/runtime-packages/ui/src/components/dialog.tsx +146 -0
  78. package/dist/runtime-packages/ui/src/components/drawer.tsx +132 -0
  79. package/dist/runtime-packages/ui/src/components/dropdown-menu.tsx +257 -0
  80. package/dist/runtime-packages/ui/src/components/form.tsx +168 -0
  81. package/dist/runtime-packages/ui/src/components/header.tsx +13 -0
  82. package/dist/runtime-packages/ui/src/components/hover-card.tsx +44 -0
  83. package/dist/runtime-packages/ui/src/components/input-group.tsx +178 -0
  84. package/dist/runtime-packages/ui/src/components/input.tsx +21 -0
  85. package/dist/runtime-packages/ui/src/components/item.tsx +193 -0
  86. package/dist/runtime-packages/ui/src/components/label.tsx +24 -0
  87. package/dist/runtime-packages/ui/src/components/navigation-menu.tsx +168 -0
  88. package/dist/runtime-packages/ui/src/components/popover.tsx +55 -0
  89. package/dist/runtime-packages/ui/src/components/progress.tsx +31 -0
  90. package/dist/runtime-packages/ui/src/components/radio-group.tsx +45 -0
  91. package/dist/runtime-packages/ui/src/components/resizable.tsx +56 -0
  92. package/dist/runtime-packages/ui/src/components/scroll-area.tsx +58 -0
  93. package/dist/runtime-packages/ui/src/components/select.tsx +187 -0
  94. package/dist/runtime-packages/ui/src/components/separator.tsx +28 -0
  95. package/dist/runtime-packages/ui/src/components/skeleton.tsx +13 -0
  96. package/dist/runtime-packages/ui/src/components/sonner.tsx +25 -0
  97. package/dist/runtime-packages/ui/src/components/spinner.tsx +16 -0
  98. package/dist/runtime-packages/ui/src/components/switch.tsx +31 -0
  99. package/dist/runtime-packages/ui/src/components/table.tsx +137 -0
  100. package/dist/runtime-packages/ui/src/components/tabs.tsx +74 -0
  101. package/dist/runtime-packages/ui/src/components/textarea.tsx +23 -0
  102. package/dist/runtime-packages/ui/src/components/theme-provider.tsx +73 -0
  103. package/dist/runtime-packages/ui/src/components/tooltip.tsx +61 -0
  104. package/dist/runtime-packages/ui/src/components/ui/file-upload.tsx +195 -0
  105. package/dist/runtime-packages/ui/src/hooks/.gitkeep +0 -0
  106. package/dist/runtime-packages/ui/src/index.ts +68 -0
  107. package/dist/runtime-packages/ui/src/lib/utils.ts +6 -0
  108. package/dist/runtime-packages/ui-host-runtime/src/actor-principal.ts +68 -0
  109. package/dist/runtime-packages/ui-host-runtime/src/components/host-controls.tsx +359 -0
  110. package/dist/runtime-packages/ui-host-runtime/src/components/host-feedback-toaster.tsx +274 -0
  111. package/dist/runtime-packages/ui-host-runtime/src/components/host-feedback.tsx +214 -0
  112. package/dist/runtime-packages/ui-host-runtime/src/components/host-session-metadata.tsx +135 -0
  113. package/dist/runtime-packages/ui-host-runtime/src/components/index.ts +5 -0
  114. package/dist/runtime-packages/ui-host-runtime/src/components/perf-overlay.tsx +194 -0
  115. package/dist/runtime-packages/ui-host-runtime/src/host-controls.tsx +1 -0
  116. package/dist/runtime-packages/ui-host-runtime/src/host-feedback.tsx +1 -0
  117. package/dist/runtime-packages/ui-host-runtime/src/host-session-transport.ts +162 -0
  118. package/dist/runtime-packages/ui-host-runtime/src/index.ts +2 -0
  119. package/dist/runtime-packages/ui-host-runtime/src/logger.ts +11 -0
  120. package/dist/runtime-packages/ui-host-runtime/src/perf.ts +253 -0
  121. package/dist/runtime-packages/ui-host-runtime/src/plugin-bridge.ts +195 -0
  122. package/dist/runtime-packages/ui-host-runtime/src/plugin-health-check.ts +138 -0
  123. package/dist/runtime-packages/ui-host-runtime/src/plugin-messages.ts +159 -0
  124. package/dist/runtime-packages/ui-host-runtime/src/plugin-session-gateway.ts +524 -0
  125. package/dist/runtime-packages/ui-host-runtime/src/runtime/index.ts +12 -0
  126. package/dist/runtime-packages/ui-host-runtime/src/screenshot/projection-to-snapshot.ts +122 -0
  127. package/dist/runtime-packages/ui-host-runtime/src/screenshot/static-store-api.ts +26 -0
  128. package/dist/runtime-packages/ui-host-runtime/src/session-ingress-controller.ts +477 -0
  129. package/dist/runtime-packages/ui-host-runtime/src/session-ingress.ts +209 -0
  130. package/dist/runtime-packages/ui-host-runtime/src/session-live-runtime.ts +112 -0
  131. package/dist/runtime-packages/ui-host-runtime/src/session-model.ts +318 -0
  132. package/dist/runtime-packages/ui-host-runtime/src/session-projection.ts +211 -0
  133. package/dist/runtime-packages/ui-host-runtime/src/session-state-reducer.ts +814 -0
  134. package/dist/runtime-packages/ui-host-runtime/src/sse-manager.ts +334 -0
  135. package/dist/runtime-packages/ui-host-runtime/src/unified-session-store.ts +180 -0
  136. package/dist/scaffold/assets/static/app/tsconfig.framework.json +3 -1
  137. package/dist/scaffold/assets/static/ui/tsconfig.framework.json +7 -19
  138. package/package.json +52 -17
  139. package/skills/dreamboard/SKILL.md +41 -75
  140. package/LICENSE +0 -89
  141. package/NOTICE +0 -1
  142. package/dist/chunk-BMYC6772.js.map +0 -1
  143. package/dist/chunk-EYYWGWTO.js.map +0 -1
  144. package/dist/chunk-MOVHYB6E.js.map +0 -1
  145. package/dist/scaffold/assets/static/ui/App.tsx +0 -22
  146. package/dist/src-CUL7EGGG.js +0 -634
  147. package/dist/src-CUL7EGGG.js.map +0 -1
  148. package/skills/dreamboard/references/authoring-lifecycle.md +0 -102
  149. package/skills/dreamboard/references/board-surfaces.md +0 -36
  150. package/skills/dreamboard/references/board-topology.md +0 -443
  151. package/skills/dreamboard/references/boards-and-topology.md +0 -100
  152. package/skills/dreamboard/references/card-actions.md +0 -107
  153. package/skills/dreamboard/references/cli.md +0 -120
  154. package/skills/dreamboard/references/core-concepts.md +0 -514
  155. package/skills/dreamboard/references/custom-renderers.md +0 -26
  156. package/skills/dreamboard/references/derived-values.md +0 -55
  157. package/skills/dreamboard/references/effects.md +0 -111
  158. package/skills/dreamboard/references/game-contract.md +0 -89
  159. package/skills/dreamboard/references/game-definition.md +0 -89
  160. package/skills/dreamboard/references/game-shell.md +0 -80
  161. package/skills/dreamboard/references/hand-surfaces.md +0 -33
  162. package/skills/dreamboard/references/index.md +0 -112
  163. package/skills/dreamboard/references/inputs-and-targets.md +0 -160
  164. package/skills/dreamboard/references/interactions.md +0 -158
  165. package/skills/dreamboard/references/manifest-fields.md +0 -137
  166. package/skills/dreamboard/references/manifest.md +0 -81
  167. package/skills/dreamboard/references/package-surfaces.md +0 -69
  168. package/skills/dreamboard/references/phases.md +0 -145
  169. package/skills/dreamboard/references/prompts-and-choices.md +0 -55
  170. package/skills/dreamboard/references/quickstart.md +0 -71
  171. package/skills/dreamboard/references/rule-authoring.md +0 -144
  172. package/skills/dreamboard/references/setup-bootstrap.md +0 -78
  173. package/skills/dreamboard/references/stages-and-zones.md +0 -59
  174. package/skills/dreamboard/references/static-views.md +0 -67
  175. package/skills/dreamboard/references/table-queries-and-ops.md +0 -103
  176. package/skills/dreamboard/references/testing-bases.md +0 -147
  177. package/skills/dreamboard/references/testing-generated-contracts.md +0 -142
  178. package/skills/dreamboard/references/testing-runtime-assertions.md +0 -124
  179. package/skills/dreamboard/references/testing-scenarios.md +0 -148
  180. package/skills/dreamboard/references/testing-ui-tests.md +0 -174
  181. package/skills/dreamboard/references/testing.md +0 -161
  182. package/skills/dreamboard/references/ui-architecture.md +0 -137
  183. package/skills/dreamboard/references/ui-components.md +0 -34
  184. package/skills/dreamboard/references/views.md +0 -72
  185. package/skills/dreamboard/references/workspace-layout.md +0 -136
  186. /package/dist/{dist-WJRJNFLI.js.map → dist-FRURQI7Q.js.map} +0 -0
@@ -0,0 +1,87 @@
1
+ "use client";
2
+
3
+ import {
4
+ Collapsible,
5
+ CollapsibleContent,
6
+ CollapsibleTrigger,
7
+ } from "@dreamboard/ui/components/collapsible";
8
+ import { cn } from "@dreamboard/ui/lib/utils";
9
+ import { ChevronDownIcon, SearchIcon } from "lucide-react";
10
+ import type { ComponentProps } from "react";
11
+
12
+ export type TaskItemFileProps = ComponentProps<"div">;
13
+
14
+ export const TaskItemFile = ({
15
+ children,
16
+ className,
17
+ ...props
18
+ }: TaskItemFileProps) => (
19
+ <div
20
+ className={cn(
21
+ "inline-flex items-center gap-1 rounded-md border bg-secondary px-1.5 py-0.5 text-foreground text-xs",
22
+ className,
23
+ )}
24
+ {...props}
25
+ >
26
+ {children}
27
+ </div>
28
+ );
29
+
30
+ export type TaskItemProps = ComponentProps<"div">;
31
+
32
+ export const TaskItem = ({ children, className, ...props }: TaskItemProps) => (
33
+ <div className={cn("text-muted-foreground text-sm", className)} {...props}>
34
+ {children}
35
+ </div>
36
+ );
37
+
38
+ export type TaskProps = ComponentProps<typeof Collapsible>;
39
+
40
+ export const Task = ({
41
+ defaultOpen = true,
42
+ className,
43
+ ...props
44
+ }: TaskProps) => (
45
+ <Collapsible className={cn(className)} defaultOpen={defaultOpen} {...props} />
46
+ );
47
+
48
+ export type TaskTriggerProps = ComponentProps<typeof CollapsibleTrigger> & {
49
+ title: string;
50
+ };
51
+
52
+ export const TaskTrigger = ({
53
+ children,
54
+ className,
55
+ title,
56
+ ...props
57
+ }: TaskTriggerProps) => (
58
+ <CollapsibleTrigger asChild className={cn("group", className)} {...props}>
59
+ {children ?? (
60
+ <div className="flex w-full cursor-pointer items-center gap-2 text-muted-foreground text-sm transition-colors hover:text-foreground">
61
+ <SearchIcon className="size-4" />
62
+ <p className="text-sm">{title}</p>
63
+ <ChevronDownIcon className="size-4 transition-transform group-data-[state=open]:rotate-180" />
64
+ </div>
65
+ )}
66
+ </CollapsibleTrigger>
67
+ );
68
+
69
+ export type TaskContentProps = ComponentProps<typeof CollapsibleContent>;
70
+
71
+ export const TaskContent = ({
72
+ children,
73
+ className,
74
+ ...props
75
+ }: TaskContentProps) => (
76
+ <CollapsibleContent
77
+ className={cn(
78
+ "data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 text-popover-foreground outline-none data-[state=closed]:animate-out data-[state=open]:animate-in",
79
+ className,
80
+ )}
81
+ {...props}
82
+ >
83
+ <div className="mt-4 space-y-2 border-muted border-l-2 pl-4">
84
+ {children}
85
+ </div>
86
+ </CollapsibleContent>
87
+ );
@@ -0,0 +1,165 @@
1
+ "use client";
2
+
3
+ import { Badge } from "@dreamboard/ui/components/badge";
4
+ import {
5
+ Collapsible,
6
+ CollapsibleContent,
7
+ CollapsibleTrigger,
8
+ } from "@dreamboard/ui/components/collapsible";
9
+ import { cn } from "@dreamboard/ui/lib/utils";
10
+ import type { ToolUIPart } from "ai";
11
+ import {
12
+ CheckCircleIcon,
13
+ ChevronDownIcon,
14
+ CircleIcon,
15
+ ClockIcon,
16
+ WrenchIcon,
17
+ XCircleIcon,
18
+ } from "lucide-react";
19
+ import type { ComponentProps, ReactNode } from "react";
20
+ import { isValidElement } from "react";
21
+ import { CodeBlock } from "./code-block.js";
22
+
23
+ export type ToolProps = ComponentProps<typeof Collapsible>;
24
+
25
+ export const Tool = ({ className, ...props }: ToolProps) => (
26
+ <Collapsible
27
+ className={cn("not-prose mb-4 w-full rounded-md border", className)}
28
+ {...props}
29
+ />
30
+ );
31
+
32
+ export interface ToolHeaderProps {
33
+ title?: string;
34
+ type: ToolUIPart["type"];
35
+ state: ToolUIPart["state"];
36
+ className?: string;
37
+ }
38
+
39
+ const getStatusBadge = (status: ToolUIPart["state"]) => {
40
+ const labels: Record<string, string> = {
41
+ "input-streaming": "Pending",
42
+ "input-available": "Running",
43
+ "approval-requested": "Awaiting Approval",
44
+ "approval-responded": "Responded",
45
+ "output-available": "Completed",
46
+ "output-error": "Error",
47
+ "output-denied": "Denied",
48
+ };
49
+
50
+ const icons: Record<string, ReactNode> = {
51
+ "input-streaming": <CircleIcon className="size-4" />,
52
+ "input-available": <ClockIcon className="size-4 animate-pulse" />,
53
+ "approval-requested": <ClockIcon className="size-4 text-yellow-600" />,
54
+ "approval-responded": <CheckCircleIcon className="size-4 text-blue-600" />,
55
+ "output-available": <CheckCircleIcon className="size-4 text-green-600" />,
56
+ "output-error": <XCircleIcon className="size-4 text-red-600" />,
57
+ "output-denied": <XCircleIcon className="size-4 text-orange-600" />,
58
+ };
59
+
60
+ return (
61
+ <Badge className="gap-1.5 rounded-full text-xs" variant="secondary">
62
+ {icons[status]}
63
+ {labels[status]}
64
+ </Badge>
65
+ );
66
+ };
67
+
68
+ export const ToolHeader = ({
69
+ className,
70
+ title,
71
+ type,
72
+ state,
73
+ ...props
74
+ }: ToolHeaderProps) => (
75
+ <CollapsibleTrigger
76
+ className={cn(
77
+ "flex w-full items-center justify-between gap-4 p-3",
78
+ className,
79
+ )}
80
+ {...props}
81
+ >
82
+ <div className="flex items-center gap-2">
83
+ <WrenchIcon className="size-4 text-muted-foreground" />
84
+ <span className="font-medium text-sm">
85
+ {title ?? type.split("-").slice(1).join("-")}
86
+ </span>
87
+ {getStatusBadge(state)}
88
+ </div>
89
+ <ChevronDownIcon className="size-4 text-muted-foreground transition-transform group-data-[state=open]:rotate-180" />
90
+ </CollapsibleTrigger>
91
+ );
92
+
93
+ export type ToolContentProps = ComponentProps<typeof CollapsibleContent>;
94
+
95
+ export const ToolContent = ({ className, ...props }: ToolContentProps) => (
96
+ <CollapsibleContent
97
+ className={cn(
98
+ "data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 text-popover-foreground outline-none data-[state=closed]:animate-out data-[state=open]:animate-in",
99
+ className,
100
+ )}
101
+ {...props}
102
+ />
103
+ );
104
+
105
+ export type ToolInputProps = ComponentProps<"div"> & {
106
+ input: ToolUIPart["input"];
107
+ };
108
+
109
+ export const ToolInput = ({ className, input, ...props }: ToolInputProps) => (
110
+ <div className={cn("space-y-2 overflow-hidden p-4", className)} {...props}>
111
+ <h4 className="font-medium text-muted-foreground text-xs uppercase tracking-wide">
112
+ Parameters
113
+ </h4>
114
+ <div className="max-h-64 overflow-auto rounded-md bg-muted/50 [&_code]:whitespace-pre-wrap [&_code]:break-all [&_pre]:whitespace-pre-wrap">
115
+ <CodeBlock code={JSON.stringify(input, null, 2)} language="json" />
116
+ </div>
117
+ </div>
118
+ );
119
+
120
+ export type ToolOutputProps = ComponentProps<"div"> & {
121
+ output: ToolUIPart["output"];
122
+ errorText: ToolUIPart["errorText"];
123
+ };
124
+
125
+ export const ToolOutput = ({
126
+ className,
127
+ output,
128
+ errorText,
129
+ ...props
130
+ }: ToolOutputProps) => {
131
+ if (!(output || errorText)) {
132
+ return null;
133
+ }
134
+
135
+ let Output = <div>{output as ReactNode}</div>;
136
+
137
+ if (typeof output === "object" && !isValidElement(output)) {
138
+ Output = (
139
+ <CodeBlock code={JSON.stringify(output, null, 2)} language="json" />
140
+ );
141
+ } else if (typeof output === "string") {
142
+ Output = <CodeBlock code={output} language="json" />;
143
+ }
144
+
145
+ return (
146
+ <div className={cn("space-y-2 p-4", className)} {...props}>
147
+ <h4 className="font-medium text-muted-foreground text-xs uppercase tracking-wide">
148
+ {errorText ? "Error" : "Result"}
149
+ </h4>
150
+ <div
151
+ className={cn(
152
+ "max-h-64 overflow-auto rounded-md text-xs [&_code]:whitespace-pre-wrap [&_code]:break-all [&_pre]:whitespace-pre-wrap [&_table]:w-full",
153
+ errorText
154
+ ? "bg-destructive/10 text-destructive"
155
+ : "bg-muted/50 text-foreground",
156
+ )}
157
+ >
158
+ {errorText && (
159
+ <div className="whitespace-pre-wrap break-words p-3">{errorText}</div>
160
+ )}
161
+ {Output}
162
+ </div>
163
+ </div>
164
+ );
165
+ };
@@ -0,0 +1,16 @@
1
+ import { cn } from "@dreamboard/ui/lib/utils";
2
+ import { NodeToolbar, Position } from "@xyflow/react";
3
+ import type { ComponentProps } from "react";
4
+
5
+ type ToolbarProps = ComponentProps<typeof NodeToolbar>;
6
+
7
+ export const Toolbar = ({ className, ...props }: ToolbarProps) => (
8
+ <NodeToolbar
9
+ className={cn(
10
+ "flex items-center gap-1 rounded-sm border bg-background p-1.5",
11
+ className,
12
+ )}
13
+ position={Position.Bottom}
14
+ {...props}
15
+ />
16
+ );
@@ -0,0 +1,263 @@
1
+ "use client";
2
+
3
+ import { Button } from "@dreamboard/ui/components/button";
4
+ import {
5
+ Collapsible,
6
+ CollapsibleContent,
7
+ CollapsibleTrigger,
8
+ } from "@dreamboard/ui/components/collapsible";
9
+ import { Input } from "@dreamboard/ui/components/input";
10
+ import {
11
+ Tooltip,
12
+ TooltipContent,
13
+ TooltipProvider,
14
+ TooltipTrigger,
15
+ } from "@dreamboard/ui/components/tooltip";
16
+ import { cn } from "@dreamboard/ui/lib/utils";
17
+ import { ChevronDownIcon } from "lucide-react";
18
+ import type { ComponentProps, ReactNode } from "react";
19
+ import { createContext, useContext, useEffect, useState } from "react";
20
+
21
+ export interface WebPreviewContextValue {
22
+ url: string;
23
+ setUrl: (url: string) => void;
24
+ consoleOpen: boolean;
25
+ setConsoleOpen: (open: boolean) => void;
26
+ }
27
+
28
+ const WebPreviewContext = createContext<WebPreviewContextValue | null>(null);
29
+
30
+ const useWebPreview = () => {
31
+ const context = useContext(WebPreviewContext);
32
+ if (!context) {
33
+ throw new Error("WebPreview components must be used within a WebPreview");
34
+ }
35
+ return context;
36
+ };
37
+
38
+ export type WebPreviewProps = ComponentProps<"div"> & {
39
+ defaultUrl?: string;
40
+ onUrlChange?: (url: string) => void;
41
+ };
42
+
43
+ export const WebPreview = ({
44
+ className,
45
+ children,
46
+ defaultUrl = "",
47
+ onUrlChange,
48
+ ...props
49
+ }: WebPreviewProps) => {
50
+ const [url, setUrl] = useState(defaultUrl);
51
+ const [consoleOpen, setConsoleOpen] = useState(false);
52
+
53
+ const handleUrlChange = (newUrl: string) => {
54
+ setUrl(newUrl);
55
+ onUrlChange?.(newUrl);
56
+ };
57
+
58
+ const contextValue: WebPreviewContextValue = {
59
+ url,
60
+ setUrl: handleUrlChange,
61
+ consoleOpen,
62
+ setConsoleOpen,
63
+ };
64
+
65
+ return (
66
+ <WebPreviewContext.Provider value={contextValue}>
67
+ <div
68
+ className={cn(
69
+ "flex size-full flex-col rounded-lg border bg-card",
70
+ className,
71
+ )}
72
+ {...props}
73
+ >
74
+ {children}
75
+ </div>
76
+ </WebPreviewContext.Provider>
77
+ );
78
+ };
79
+
80
+ export type WebPreviewNavigationProps = ComponentProps<"div">;
81
+
82
+ export const WebPreviewNavigation = ({
83
+ className,
84
+ children,
85
+ ...props
86
+ }: WebPreviewNavigationProps) => (
87
+ <div
88
+ className={cn("flex items-center gap-1 border-b p-2", className)}
89
+ {...props}
90
+ >
91
+ {children}
92
+ </div>
93
+ );
94
+
95
+ export type WebPreviewNavigationButtonProps = ComponentProps<typeof Button> & {
96
+ tooltip?: string;
97
+ };
98
+
99
+ export const WebPreviewNavigationButton = ({
100
+ onClick,
101
+ disabled,
102
+ tooltip,
103
+ children,
104
+ ...props
105
+ }: WebPreviewNavigationButtonProps) => (
106
+ <TooltipProvider>
107
+ <Tooltip>
108
+ <TooltipTrigger asChild>
109
+ <Button
110
+ className="h-8 w-8 p-0 hover:text-foreground"
111
+ disabled={disabled}
112
+ onClick={onClick}
113
+ size="sm"
114
+ variant="ghost"
115
+ {...props}
116
+ >
117
+ {children}
118
+ </Button>
119
+ </TooltipTrigger>
120
+ <TooltipContent>
121
+ <p>{tooltip}</p>
122
+ </TooltipContent>
123
+ </Tooltip>
124
+ </TooltipProvider>
125
+ );
126
+
127
+ export type WebPreviewUrlProps = ComponentProps<typeof Input>;
128
+
129
+ export const WebPreviewUrl = ({
130
+ value,
131
+ onChange,
132
+ onKeyDown,
133
+ ...props
134
+ }: WebPreviewUrlProps) => {
135
+ const { url, setUrl } = useWebPreview();
136
+ const [inputValue, setInputValue] = useState(url);
137
+
138
+ // Sync input value with context URL when it changes externally
139
+ useEffect(() => {
140
+ setInputValue(url);
141
+ }, [url]);
142
+
143
+ const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
144
+ setInputValue(event.target.value);
145
+ onChange?.(event);
146
+ };
147
+
148
+ const handleKeyDown = (event: React.KeyboardEvent<HTMLInputElement>) => {
149
+ if (event.key === "Enter") {
150
+ const target = event.target as HTMLInputElement;
151
+ setUrl(target.value);
152
+ }
153
+ onKeyDown?.(event);
154
+ };
155
+
156
+ return (
157
+ <Input
158
+ className="h-8 flex-1 text-sm"
159
+ onChange={onChange ?? handleChange}
160
+ onKeyDown={handleKeyDown}
161
+ placeholder="Enter URL..."
162
+ value={value ?? inputValue}
163
+ {...props}
164
+ />
165
+ );
166
+ };
167
+
168
+ export type WebPreviewBodyProps = ComponentProps<"iframe"> & {
169
+ loading?: ReactNode;
170
+ };
171
+
172
+ export const WebPreviewBody = ({
173
+ className,
174
+ loading,
175
+ src,
176
+ ...props
177
+ }: WebPreviewBodyProps) => {
178
+ const { url } = useWebPreview();
179
+
180
+ return (
181
+ <div className="flex-1">
182
+ <iframe
183
+ className={cn("size-full", className)}
184
+ sandbox="allow-scripts allow-same-origin allow-forms allow-popups allow-presentation"
185
+ src={(src ?? url) || undefined}
186
+ title="Preview"
187
+ {...props}
188
+ />
189
+ {loading}
190
+ </div>
191
+ );
192
+ };
193
+
194
+ export type WebPreviewConsoleProps = ComponentProps<"div"> & {
195
+ logs?: Array<{
196
+ level: "log" | "warn" | "error";
197
+ message: string;
198
+ timestamp: Date;
199
+ }>;
200
+ };
201
+
202
+ export const WebPreviewConsole = ({
203
+ className,
204
+ logs = [],
205
+ children,
206
+ ...props
207
+ }: WebPreviewConsoleProps) => {
208
+ const { consoleOpen, setConsoleOpen } = useWebPreview();
209
+
210
+ return (
211
+ <Collapsible
212
+ className={cn("border-t bg-muted/50 font-mono text-sm", className)}
213
+ onOpenChange={setConsoleOpen}
214
+ open={consoleOpen}
215
+ {...props}
216
+ >
217
+ <CollapsibleTrigger asChild>
218
+ <Button
219
+ className="flex w-full items-center justify-between p-4 text-left font-medium hover:bg-muted/50"
220
+ variant="ghost"
221
+ >
222
+ Console
223
+ <ChevronDownIcon
224
+ className={cn(
225
+ "h-4 w-4 transition-transform duration-200",
226
+ consoleOpen && "rotate-180",
227
+ )}
228
+ />
229
+ </Button>
230
+ </CollapsibleTrigger>
231
+ <CollapsibleContent
232
+ className={cn(
233
+ "px-4 pb-4",
234
+ "data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 outline-none data-[state=closed]:animate-out data-[state=open]:animate-in",
235
+ )}
236
+ >
237
+ <div className="max-h-48 space-y-1 overflow-y-auto">
238
+ {logs.length === 0 ? (
239
+ <p className="text-muted-foreground">No console output</p>
240
+ ) : (
241
+ logs.map((log, index) => (
242
+ <div
243
+ className={cn(
244
+ "text-xs",
245
+ log.level === "error" && "text-destructive",
246
+ log.level === "warn" && "text-yellow-600",
247
+ log.level === "log" && "text-foreground",
248
+ )}
249
+ key={`${log.timestamp.getTime()}-${index}`}
250
+ >
251
+ <span className="text-muted-foreground">
252
+ {log.timestamp.toLocaleTimeString()}
253
+ </span>{" "}
254
+ {log.message}
255
+ </div>
256
+ ))
257
+ )}
258
+ {children}
259
+ </div>
260
+ </CollapsibleContent>
261
+ </Collapsible>
262
+ );
263
+ };
@@ -0,0 +1,157 @@
1
+ "use client";
2
+
3
+ import * as React from "react";
4
+ import * as AlertDialogPrimitive from "@radix-ui/react-alert-dialog";
5
+
6
+ import { cn } from "@dreamboard/ui/lib/utils";
7
+ import { buttonVariants } from "@dreamboard/ui/components/button";
8
+
9
+ function AlertDialog({
10
+ ...props
11
+ }: React.ComponentProps<typeof AlertDialogPrimitive.Root>) {
12
+ return <AlertDialogPrimitive.Root data-slot="alert-dialog" {...props} />;
13
+ }
14
+
15
+ function AlertDialogTrigger({
16
+ ...props
17
+ }: React.ComponentProps<typeof AlertDialogPrimitive.Trigger>) {
18
+ return (
19
+ <AlertDialogPrimitive.Trigger data-slot="alert-dialog-trigger" {...props} />
20
+ );
21
+ }
22
+
23
+ function AlertDialogPortal({
24
+ ...props
25
+ }: React.ComponentProps<typeof AlertDialogPrimitive.Portal>) {
26
+ return (
27
+ <AlertDialogPrimitive.Portal data-slot="alert-dialog-portal" {...props} />
28
+ );
29
+ }
30
+
31
+ function AlertDialogOverlay({
32
+ className,
33
+ ...props
34
+ }: React.ComponentProps<typeof AlertDialogPrimitive.Overlay>) {
35
+ return (
36
+ <AlertDialogPrimitive.Overlay
37
+ data-slot="alert-dialog-overlay"
38
+ className={cn(
39
+ "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",
40
+ className,
41
+ )}
42
+ {...props}
43
+ />
44
+ );
45
+ }
46
+
47
+ function AlertDialogContent({
48
+ className,
49
+ ...props
50
+ }: React.ComponentProps<typeof AlertDialogPrimitive.Content>) {
51
+ return (
52
+ <AlertDialogPortal>
53
+ <AlertDialogOverlay />
54
+ <AlertDialogPrimitive.Content
55
+ data-slot="alert-dialog-content"
56
+ className={cn(
57
+ "bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",
58
+ className,
59
+ )}
60
+ {...props}
61
+ />
62
+ </AlertDialogPortal>
63
+ );
64
+ }
65
+
66
+ function AlertDialogHeader({
67
+ className,
68
+ ...props
69
+ }: React.ComponentProps<"div">) {
70
+ return (
71
+ <div
72
+ data-slot="alert-dialog-header"
73
+ className={cn("flex flex-col gap-2 text-center sm:text-left", className)}
74
+ {...props}
75
+ />
76
+ );
77
+ }
78
+
79
+ function AlertDialogFooter({
80
+ className,
81
+ ...props
82
+ }: React.ComponentProps<"div">) {
83
+ return (
84
+ <div
85
+ data-slot="alert-dialog-footer"
86
+ className={cn(
87
+ "flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",
88
+ className,
89
+ )}
90
+ {...props}
91
+ />
92
+ );
93
+ }
94
+
95
+ function AlertDialogTitle({
96
+ className,
97
+ ...props
98
+ }: React.ComponentProps<typeof AlertDialogPrimitive.Title>) {
99
+ return (
100
+ <AlertDialogPrimitive.Title
101
+ data-slot="alert-dialog-title"
102
+ className={cn("text-lg font-semibold", className)}
103
+ {...props}
104
+ />
105
+ );
106
+ }
107
+
108
+ function AlertDialogDescription({
109
+ className,
110
+ ...props
111
+ }: React.ComponentProps<typeof AlertDialogPrimitive.Description>) {
112
+ return (
113
+ <AlertDialogPrimitive.Description
114
+ data-slot="alert-dialog-description"
115
+ className={cn("text-muted-foreground text-sm", className)}
116
+ {...props}
117
+ />
118
+ );
119
+ }
120
+
121
+ function AlertDialogAction({
122
+ className,
123
+ ...props
124
+ }: React.ComponentProps<typeof AlertDialogPrimitive.Action>) {
125
+ return (
126
+ <AlertDialogPrimitive.Action
127
+ className={cn(buttonVariants(), className)}
128
+ {...props}
129
+ />
130
+ );
131
+ }
132
+
133
+ function AlertDialogCancel({
134
+ className,
135
+ ...props
136
+ }: React.ComponentProps<typeof AlertDialogPrimitive.Cancel>) {
137
+ return (
138
+ <AlertDialogPrimitive.Cancel
139
+ className={cn(buttonVariants({ variant: "outline" }), className)}
140
+ {...props}
141
+ />
142
+ );
143
+ }
144
+
145
+ export {
146
+ AlertDialog,
147
+ AlertDialogPortal,
148
+ AlertDialogOverlay,
149
+ AlertDialogTrigger,
150
+ AlertDialogContent,
151
+ AlertDialogHeader,
152
+ AlertDialogFooter,
153
+ AlertDialogTitle,
154
+ AlertDialogDescription,
155
+ AlertDialogAction,
156
+ AlertDialogCancel,
157
+ };