dreamboard 0.1.21 → 0.1.22
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/dist/{chunk-EYYWGWTO.js → chunk-2RCUHMGL.js} +343 -1911
- package/dist/chunk-2RCUHMGL.js.map +1 -0
- package/dist/{chunk-MOVHYB6E.js → chunk-AQ5UUNJS.js} +1018 -692
- package/dist/chunk-AQ5UUNJS.js.map +1 -0
- package/dist/{chunk-BMYC6772.js → chunk-H3O43F5P.js} +9765 -3068
- package/dist/chunk-H3O43F5P.js.map +1 -0
- package/dist/dev-host/dev-api-proxy-plugin.ts +330 -0
- package/dist/dev-host/dev-diagnostics.ts +62 -0
- package/dist/dev-host/dev-fallback-stylesheet.ts +50 -0
- package/dist/dev-host/dev-host-controller.ts +686 -0
- package/dist/dev-host/dev-host-player-query.ts +17 -0
- package/dist/dev-host/dev-host-session-transport.ts +52 -0
- package/dist/dev-host/dev-host-storage.ts +56 -0
- package/dist/dev-host/dev-log-relay-plugin.ts +469 -0
- package/dist/dev-host/dev-runtime-config.ts +14 -0
- package/dist/dev-host/dev-runtime-platform.ts +419 -0
- package/dist/dev-host/dev-virtual-modules-plugin.ts +63 -0
- package/dist/dev-host/host-main.css +182 -0
- package/dist/dev-host/host-main.tsx +754 -0
- package/dist/dev-host/index.html +56 -0
- package/dist/dev-host/plugin-main.ts +55 -0
- package/dist/dev-host/plugin.html +24 -0
- package/dist/dev-host/start-dev-server.ts +138 -0
- package/dist/dev-host/virtual-modules.d.ts +27 -0
- package/dist/dist-FEPN3BDN.js +16543 -0
- package/dist/dist-FEPN3BDN.js.map +1 -0
- package/dist/{dist-WJRJNFLI.js → dist-FRURQI7Q.js} +4 -2
- package/dist/index.js +3 -3
- package/dist/internal.js +159 -124
- package/dist/internal.js.map +1 -1
- package/dist/runtime-packages/tailwind-config/shared-styles.css +146 -0
- package/dist/runtime-packages/ui/src/components/.gitkeep +0 -0
- package/dist/runtime-packages/ui/src/components/accordion.tsx +66 -0
- package/dist/runtime-packages/ui/src/components/ai-elements/actions.tsx +65 -0
- package/dist/runtime-packages/ui/src/components/ai-elements/artifact.tsx +147 -0
- package/dist/runtime-packages/ui/src/components/ai-elements/branch.tsx +215 -0
- package/dist/runtime-packages/ui/src/components/ai-elements/canvas.tsx +22 -0
- package/dist/runtime-packages/ui/src/components/ai-elements/chain-of-thought.tsx +228 -0
- package/dist/runtime-packages/ui/src/components/ai-elements/code-block.tsx +179 -0
- package/dist/runtime-packages/ui/src/components/ai-elements/confirmation.tsx +158 -0
- package/dist/runtime-packages/ui/src/components/ai-elements/connection.tsx +28 -0
- package/dist/runtime-packages/ui/src/components/ai-elements/context.tsx +408 -0
- package/dist/runtime-packages/ui/src/components/ai-elements/controls.tsx +18 -0
- package/dist/runtime-packages/ui/src/components/ai-elements/conversation.tsx +97 -0
- package/dist/runtime-packages/ui/src/components/ai-elements/edge.tsx +140 -0
- package/dist/runtime-packages/ui/src/components/ai-elements/image.tsx +24 -0
- package/dist/runtime-packages/ui/src/components/ai-elements/inline-citation.tsx +287 -0
- package/dist/runtime-packages/ui/src/components/ai-elements/loader.tsx +96 -0
- package/dist/runtime-packages/ui/src/components/ai-elements/message.tsx +463 -0
- package/dist/runtime-packages/ui/src/components/ai-elements/node.tsx +71 -0
- package/dist/runtime-packages/ui/src/components/ai-elements/open-in-chat.tsx +365 -0
- package/dist/runtime-packages/ui/src/components/ai-elements/panel.tsx +15 -0
- package/dist/runtime-packages/ui/src/components/ai-elements/plan.tsx +142 -0
- package/dist/runtime-packages/ui/src/components/ai-elements/prompt-input.tsx +1380 -0
- package/dist/runtime-packages/ui/src/components/ai-elements/queue.tsx +274 -0
- package/dist/runtime-packages/ui/src/components/ai-elements/reasoning.tsx +182 -0
- package/dist/runtime-packages/ui/src/components/ai-elements/response.tsx +22 -0
- package/dist/runtime-packages/ui/src/components/ai-elements/shimmer.tsx +64 -0
- package/dist/runtime-packages/ui/src/components/ai-elements/sources.tsx +77 -0
- package/dist/runtime-packages/ui/src/components/ai-elements/suggestion.tsx +53 -0
- package/dist/runtime-packages/ui/src/components/ai-elements/task.tsx +87 -0
- package/dist/runtime-packages/ui/src/components/ai-elements/tool.tsx +165 -0
- package/dist/runtime-packages/ui/src/components/ai-elements/toolbar.tsx +16 -0
- package/dist/runtime-packages/ui/src/components/ai-elements/web-preview.tsx +263 -0
- package/dist/runtime-packages/ui/src/components/alert-dialog.tsx +157 -0
- package/dist/runtime-packages/ui/src/components/alert.tsx +66 -0
- package/dist/runtime-packages/ui/src/components/avatar.tsx +53 -0
- package/dist/runtime-packages/ui/src/components/badge.tsx +46 -0
- package/dist/runtime-packages/ui/src/components/button-group.tsx +83 -0
- package/dist/runtime-packages/ui/src/components/button.tsx +65 -0
- package/dist/runtime-packages/ui/src/components/card.tsx +92 -0
- package/dist/runtime-packages/ui/src/components/carousel.tsx +241 -0
- package/dist/runtime-packages/ui/src/components/collapsible.tsx +33 -0
- package/dist/runtime-packages/ui/src/components/command.tsx +184 -0
- package/dist/runtime-packages/ui/src/components/context-menu.tsx +252 -0
- package/dist/runtime-packages/ui/src/components/counter.tsx +11 -0
- package/dist/runtime-packages/ui/src/components/dialog.tsx +146 -0
- package/dist/runtime-packages/ui/src/components/drawer.tsx +132 -0
- package/dist/runtime-packages/ui/src/components/dropdown-menu.tsx +257 -0
- package/dist/runtime-packages/ui/src/components/form.tsx +168 -0
- package/dist/runtime-packages/ui/src/components/header.tsx +13 -0
- package/dist/runtime-packages/ui/src/components/hover-card.tsx +44 -0
- package/dist/runtime-packages/ui/src/components/input-group.tsx +178 -0
- package/dist/runtime-packages/ui/src/components/input.tsx +21 -0
- package/dist/runtime-packages/ui/src/components/item.tsx +193 -0
- package/dist/runtime-packages/ui/src/components/label.tsx +24 -0
- package/dist/runtime-packages/ui/src/components/navigation-menu.tsx +168 -0
- package/dist/runtime-packages/ui/src/components/popover.tsx +55 -0
- package/dist/runtime-packages/ui/src/components/progress.tsx +31 -0
- package/dist/runtime-packages/ui/src/components/radio-group.tsx +45 -0
- package/dist/runtime-packages/ui/src/components/resizable.tsx +56 -0
- package/dist/runtime-packages/ui/src/components/scroll-area.tsx +58 -0
- package/dist/runtime-packages/ui/src/components/select.tsx +187 -0
- package/dist/runtime-packages/ui/src/components/separator.tsx +28 -0
- package/dist/runtime-packages/ui/src/components/skeleton.tsx +13 -0
- package/dist/runtime-packages/ui/src/components/sonner.tsx +25 -0
- package/dist/runtime-packages/ui/src/components/spinner.tsx +16 -0
- package/dist/runtime-packages/ui/src/components/switch.tsx +31 -0
- package/dist/runtime-packages/ui/src/components/table.tsx +137 -0
- package/dist/runtime-packages/ui/src/components/tabs.tsx +74 -0
- package/dist/runtime-packages/ui/src/components/textarea.tsx +23 -0
- package/dist/runtime-packages/ui/src/components/theme-provider.tsx +73 -0
- package/dist/runtime-packages/ui/src/components/tooltip.tsx +61 -0
- package/dist/runtime-packages/ui/src/components/ui/file-upload.tsx +195 -0
- package/dist/runtime-packages/ui/src/hooks/.gitkeep +0 -0
- package/dist/runtime-packages/ui/src/index.ts +68 -0
- package/dist/runtime-packages/ui/src/lib/utils.ts +6 -0
- package/dist/runtime-packages/ui-host-runtime/src/actor-principal.ts +68 -0
- package/dist/runtime-packages/ui-host-runtime/src/components/host-controls.tsx +359 -0
- package/dist/runtime-packages/ui-host-runtime/src/components/host-feedback-toaster.tsx +274 -0
- package/dist/runtime-packages/ui-host-runtime/src/components/host-feedback.tsx +214 -0
- package/dist/runtime-packages/ui-host-runtime/src/components/host-session-metadata.tsx +135 -0
- package/dist/runtime-packages/ui-host-runtime/src/components/index.ts +5 -0
- package/dist/runtime-packages/ui-host-runtime/src/components/perf-overlay.tsx +194 -0
- package/dist/runtime-packages/ui-host-runtime/src/host-controls.tsx +1 -0
- package/dist/runtime-packages/ui-host-runtime/src/host-feedback.tsx +1 -0
- package/dist/runtime-packages/ui-host-runtime/src/host-session-transport.ts +162 -0
- package/dist/runtime-packages/ui-host-runtime/src/index.ts +2 -0
- package/dist/runtime-packages/ui-host-runtime/src/logger.ts +11 -0
- package/dist/runtime-packages/ui-host-runtime/src/perf.ts +253 -0
- package/dist/runtime-packages/ui-host-runtime/src/plugin-bridge.ts +195 -0
- package/dist/runtime-packages/ui-host-runtime/src/plugin-health-check.ts +138 -0
- package/dist/runtime-packages/ui-host-runtime/src/plugin-messages.ts +159 -0
- package/dist/runtime-packages/ui-host-runtime/src/plugin-session-gateway.ts +524 -0
- package/dist/runtime-packages/ui-host-runtime/src/runtime/index.ts +12 -0
- package/dist/runtime-packages/ui-host-runtime/src/screenshot/projection-to-snapshot.ts +122 -0
- package/dist/runtime-packages/ui-host-runtime/src/screenshot/static-store-api.ts +26 -0
- package/dist/runtime-packages/ui-host-runtime/src/session-ingress-controller.ts +477 -0
- package/dist/runtime-packages/ui-host-runtime/src/session-ingress.ts +209 -0
- package/dist/runtime-packages/ui-host-runtime/src/session-live-runtime.ts +112 -0
- package/dist/runtime-packages/ui-host-runtime/src/session-model.ts +318 -0
- package/dist/runtime-packages/ui-host-runtime/src/session-projection.ts +211 -0
- package/dist/runtime-packages/ui-host-runtime/src/session-state-reducer.ts +814 -0
- package/dist/runtime-packages/ui-host-runtime/src/sse-manager.ts +334 -0
- package/dist/runtime-packages/ui-host-runtime/src/unified-session-store.ts +180 -0
- package/dist/scaffold/assets/static/app/tsconfig.framework.json +3 -1
- package/dist/scaffold/assets/static/ui/tsconfig.framework.json +7 -19
- package/package.json +52 -17
- package/skills/dreamboard/SKILL.md +41 -75
- package/LICENSE +0 -89
- package/NOTICE +0 -1
- package/dist/chunk-BMYC6772.js.map +0 -1
- package/dist/chunk-EYYWGWTO.js.map +0 -1
- package/dist/chunk-MOVHYB6E.js.map +0 -1
- package/dist/scaffold/assets/static/ui/App.tsx +0 -22
- package/dist/src-CUL7EGGG.js +0 -634
- package/dist/src-CUL7EGGG.js.map +0 -1
- package/skills/dreamboard/references/authoring-lifecycle.md +0 -102
- package/skills/dreamboard/references/board-surfaces.md +0 -36
- package/skills/dreamboard/references/board-topology.md +0 -443
- package/skills/dreamboard/references/boards-and-topology.md +0 -100
- package/skills/dreamboard/references/card-actions.md +0 -107
- package/skills/dreamboard/references/cli.md +0 -120
- package/skills/dreamboard/references/core-concepts.md +0 -514
- package/skills/dreamboard/references/custom-renderers.md +0 -26
- package/skills/dreamboard/references/derived-values.md +0 -55
- package/skills/dreamboard/references/effects.md +0 -111
- package/skills/dreamboard/references/game-contract.md +0 -89
- package/skills/dreamboard/references/game-definition.md +0 -89
- package/skills/dreamboard/references/game-shell.md +0 -80
- package/skills/dreamboard/references/hand-surfaces.md +0 -33
- package/skills/dreamboard/references/index.md +0 -112
- package/skills/dreamboard/references/inputs-and-targets.md +0 -160
- package/skills/dreamboard/references/interactions.md +0 -158
- package/skills/dreamboard/references/manifest-fields.md +0 -137
- package/skills/dreamboard/references/manifest.md +0 -81
- package/skills/dreamboard/references/package-surfaces.md +0 -69
- package/skills/dreamboard/references/phases.md +0 -145
- package/skills/dreamboard/references/prompts-and-choices.md +0 -55
- package/skills/dreamboard/references/quickstart.md +0 -71
- package/skills/dreamboard/references/rule-authoring.md +0 -144
- package/skills/dreamboard/references/setup-bootstrap.md +0 -78
- package/skills/dreamboard/references/stages-and-zones.md +0 -59
- package/skills/dreamboard/references/static-views.md +0 -67
- package/skills/dreamboard/references/table-queries-and-ops.md +0 -103
- package/skills/dreamboard/references/testing-bases.md +0 -147
- package/skills/dreamboard/references/testing-generated-contracts.md +0 -142
- package/skills/dreamboard/references/testing-runtime-assertions.md +0 -124
- package/skills/dreamboard/references/testing-scenarios.md +0 -148
- package/skills/dreamboard/references/testing-ui-tests.md +0 -174
- package/skills/dreamboard/references/testing.md +0 -161
- package/skills/dreamboard/references/ui-architecture.md +0 -137
- package/skills/dreamboard/references/ui-components.md +0 -34
- package/skills/dreamboard/references/views.md +0 -72
- package/skills/dreamboard/references/workspace-layout.md +0 -136
- /package/dist/{dist-WJRJNFLI.js.map → dist-FRURQI7Q.js.map} +0 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
|
|
3
|
+
import { cn } from "@dreamboard/ui/lib/utils";
|
|
4
|
+
|
|
5
|
+
const Textarea = React.forwardRef<
|
|
6
|
+
HTMLTextAreaElement,
|
|
7
|
+
React.ComponentProps<"textarea">
|
|
8
|
+
>(({ className, ...props }, ref) => {
|
|
9
|
+
return (
|
|
10
|
+
<textarea
|
|
11
|
+
ref={ref}
|
|
12
|
+
data-slot="textarea"
|
|
13
|
+
className={cn(
|
|
14
|
+
"border-input placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 flex field-sizing-content min-h-16 w-full rounded-md border bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
|
|
15
|
+
className,
|
|
16
|
+
)}
|
|
17
|
+
{...props}
|
|
18
|
+
/>
|
|
19
|
+
);
|
|
20
|
+
});
|
|
21
|
+
Textarea.displayName = "Textarea";
|
|
22
|
+
|
|
23
|
+
export { Textarea };
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { createContext, useContext, useEffect, useState } from "react";
|
|
2
|
+
|
|
3
|
+
type Theme = "dark" | "light" | "system";
|
|
4
|
+
|
|
5
|
+
interface ThemeProviderProps {
|
|
6
|
+
children: React.ReactNode;
|
|
7
|
+
defaultTheme?: Theme;
|
|
8
|
+
storageKey?: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
interface ThemeProviderState {
|
|
12
|
+
theme: Theme;
|
|
13
|
+
setTheme: (theme: Theme) => void;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const initialState: ThemeProviderState = {
|
|
17
|
+
theme: "system",
|
|
18
|
+
setTheme: () => null,
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const ThemeProviderContext = createContext<ThemeProviderState>(initialState);
|
|
22
|
+
|
|
23
|
+
export function ThemeProvider({
|
|
24
|
+
children,
|
|
25
|
+
defaultTheme = "system",
|
|
26
|
+
storageKey = "vite-ui-theme",
|
|
27
|
+
...props
|
|
28
|
+
}: ThemeProviderProps) {
|
|
29
|
+
const [theme, setTheme] = useState<Theme>(
|
|
30
|
+
() => (localStorage.getItem(storageKey) as Theme) || defaultTheme,
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
const root = window.document.documentElement;
|
|
35
|
+
|
|
36
|
+
root.classList.remove("light", "dark");
|
|
37
|
+
|
|
38
|
+
if (theme === "system") {
|
|
39
|
+
const systemTheme = window.matchMedia("(prefers-color-scheme: dark)")
|
|
40
|
+
.matches
|
|
41
|
+
? "dark"
|
|
42
|
+
: "light";
|
|
43
|
+
|
|
44
|
+
root.classList.add(systemTheme);
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
root.classList.add(theme);
|
|
49
|
+
}, [theme]);
|
|
50
|
+
|
|
51
|
+
const value = {
|
|
52
|
+
theme,
|
|
53
|
+
setTheme: (theme: Theme) => {
|
|
54
|
+
localStorage.setItem(storageKey, theme);
|
|
55
|
+
setTheme(theme);
|
|
56
|
+
},
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
return (
|
|
60
|
+
<ThemeProviderContext.Provider {...props} value={value}>
|
|
61
|
+
{children}
|
|
62
|
+
</ThemeProviderContext.Provider>
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export const useTheme = () => {
|
|
67
|
+
const context = useContext(ThemeProviderContext);
|
|
68
|
+
|
|
69
|
+
if (context === undefined)
|
|
70
|
+
throw new Error("useTheme must be used within a ThemeProvider");
|
|
71
|
+
|
|
72
|
+
return context;
|
|
73
|
+
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import * as TooltipPrimitive from "@radix-ui/react-tooltip";
|
|
5
|
+
|
|
6
|
+
import { cn } from "@dreamboard/ui/lib/utils";
|
|
7
|
+
|
|
8
|
+
function TooltipProvider({
|
|
9
|
+
delayDuration = 0,
|
|
10
|
+
...props
|
|
11
|
+
}: React.ComponentProps<typeof TooltipPrimitive.Provider>) {
|
|
12
|
+
return (
|
|
13
|
+
<TooltipPrimitive.Provider
|
|
14
|
+
data-slot="tooltip-provider"
|
|
15
|
+
delayDuration={delayDuration}
|
|
16
|
+
{...props}
|
|
17
|
+
/>
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function Tooltip({
|
|
22
|
+
...props
|
|
23
|
+
}: React.ComponentProps<typeof TooltipPrimitive.Root>) {
|
|
24
|
+
return (
|
|
25
|
+
<TooltipProvider>
|
|
26
|
+
<TooltipPrimitive.Root data-slot="tooltip" {...props} />
|
|
27
|
+
</TooltipProvider>
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function TooltipTrigger({
|
|
32
|
+
...props
|
|
33
|
+
}: React.ComponentProps<typeof TooltipPrimitive.Trigger>) {
|
|
34
|
+
return <TooltipPrimitive.Trigger data-slot="tooltip-trigger" {...props} />;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function TooltipContent({
|
|
38
|
+
className,
|
|
39
|
+
sideOffset = 0,
|
|
40
|
+
children,
|
|
41
|
+
...props
|
|
42
|
+
}: React.ComponentProps<typeof TooltipPrimitive.Content>) {
|
|
43
|
+
return (
|
|
44
|
+
<TooltipPrimitive.Portal>
|
|
45
|
+
<TooltipPrimitive.Content
|
|
46
|
+
data-slot="tooltip-content"
|
|
47
|
+
sideOffset={sideOffset}
|
|
48
|
+
className={cn(
|
|
49
|
+
"bg-white text-foreground border-[3px] border-border wobbly-border-sm shadow-[4px_4px_0px_0px_#2d2d2d] animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-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 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) px-3 py-2 text-sm font-sans font-bold text-balance",
|
|
50
|
+
className,
|
|
51
|
+
)}
|
|
52
|
+
{...props}
|
|
53
|
+
>
|
|
54
|
+
{children}
|
|
55
|
+
<TooltipPrimitive.Arrow className="bg-transparent fill-border z-50 size-3 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]" />
|
|
56
|
+
</TooltipPrimitive.Content>
|
|
57
|
+
</TooltipPrimitive.Portal>
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider };
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
import { cn } from "@dreamboard/ui/lib/utils";
|
|
2
|
+
import { useRef, useState } from "react";
|
|
3
|
+
import { motion } from "framer-motion";
|
|
4
|
+
import { Upload } from "lucide-react";
|
|
5
|
+
import { useDropzone } from "react-dropzone";
|
|
6
|
+
|
|
7
|
+
const mainVariant = {
|
|
8
|
+
initial: {
|
|
9
|
+
x: 0,
|
|
10
|
+
y: 0,
|
|
11
|
+
},
|
|
12
|
+
animate: {
|
|
13
|
+
x: 20,
|
|
14
|
+
y: -20,
|
|
15
|
+
opacity: 0.9,
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const secondaryVariant = {
|
|
20
|
+
initial: {
|
|
21
|
+
opacity: 0,
|
|
22
|
+
},
|
|
23
|
+
animate: {
|
|
24
|
+
opacity: 1,
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export const FileUpload = ({
|
|
29
|
+
onChange,
|
|
30
|
+
}: {
|
|
31
|
+
onChange?: (files: File[]) => void;
|
|
32
|
+
}) => {
|
|
33
|
+
const [files, setFiles] = useState<File[]>([]);
|
|
34
|
+
const fileInputRef = useRef<HTMLInputElement>(null);
|
|
35
|
+
|
|
36
|
+
const handleFileChange = (newFiles: File[]) => {
|
|
37
|
+
setFiles((prevFiles) => [...prevFiles, ...newFiles]);
|
|
38
|
+
if (onChange) {
|
|
39
|
+
onChange(newFiles);
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
const handleClick = () => {
|
|
44
|
+
fileInputRef.current?.click();
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
const { getRootProps, isDragActive } = useDropzone({
|
|
48
|
+
multiple: false,
|
|
49
|
+
noClick: true,
|
|
50
|
+
onDrop: handleFileChange,
|
|
51
|
+
onDropRejected: () => {
|
|
52
|
+
// Error handling can be added here if needed
|
|
53
|
+
},
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
return (
|
|
57
|
+
<div className="w-full" {...getRootProps()}>
|
|
58
|
+
<motion.div
|
|
59
|
+
onClick={handleClick}
|
|
60
|
+
whileHover="animate"
|
|
61
|
+
className="p-10 group/file block rounded-lg cursor-pointer w-full relative overflow-hidden"
|
|
62
|
+
>
|
|
63
|
+
<input
|
|
64
|
+
ref={fileInputRef}
|
|
65
|
+
id="file-upload-handle"
|
|
66
|
+
type="file"
|
|
67
|
+
onChange={(e) => handleFileChange(Array.from(e.target.files || []))}
|
|
68
|
+
className="hidden"
|
|
69
|
+
/>
|
|
70
|
+
<div className="absolute inset-0 [mask-image:radial-gradient(ellipse_at_center,white,transparent)]">
|
|
71
|
+
<GridPattern />
|
|
72
|
+
</div>
|
|
73
|
+
<div className="flex flex-col items-center justify-center">
|
|
74
|
+
<p className="relative z-20 font-sans font-bold text-neutral-700 dark:text-neutral-300 text-base">
|
|
75
|
+
Upload file
|
|
76
|
+
</p>
|
|
77
|
+
<p className="relative z-20 font-sans font-normal text-neutral-400 dark:text-neutral-400 text-base mt-2">
|
|
78
|
+
Drag or drop your files here or click to upload
|
|
79
|
+
</p>
|
|
80
|
+
<div className="relative w-full mt-10 max-w-xl mx-auto">
|
|
81
|
+
{files.length > 0 &&
|
|
82
|
+
files.map((file, idx) => (
|
|
83
|
+
<motion.div
|
|
84
|
+
key={"file" + idx}
|
|
85
|
+
layoutId={idx === 0 ? "file-upload" : "file-upload-" + idx}
|
|
86
|
+
className={cn(
|
|
87
|
+
"relative overflow-hidden z-40 bg-white dark:bg-neutral-900 flex flex-col items-start justify-start md:h-24 p-4 mt-4 w-full mx-auto rounded-md",
|
|
88
|
+
"shadow-sm",
|
|
89
|
+
)}
|
|
90
|
+
>
|
|
91
|
+
<div className="flex justify-between w-full items-center gap-4">
|
|
92
|
+
<motion.p
|
|
93
|
+
initial={{ opacity: 0 }}
|
|
94
|
+
animate={{ opacity: 1 }}
|
|
95
|
+
layout
|
|
96
|
+
className="text-base text-neutral-700 dark:text-neutral-300 truncate max-w-xs"
|
|
97
|
+
>
|
|
98
|
+
{file.name}
|
|
99
|
+
</motion.p>
|
|
100
|
+
<motion.p
|
|
101
|
+
initial={{ opacity: 0 }}
|
|
102
|
+
animate={{ opacity: 1 }}
|
|
103
|
+
layout
|
|
104
|
+
className="rounded-lg px-2 py-1 w-fit flex-shrink-0 text-sm text-neutral-600 dark:bg-neutral-800 dark:text-white shadow-input"
|
|
105
|
+
>
|
|
106
|
+
{(file.size / (1024 * 1024)).toFixed(2)} MB
|
|
107
|
+
</motion.p>
|
|
108
|
+
</div>
|
|
109
|
+
|
|
110
|
+
<div className="flex text-sm md:flex-row flex-col items-start md:items-center w-full mt-2 justify-between text-neutral-600 dark:text-neutral-400">
|
|
111
|
+
<motion.p
|
|
112
|
+
initial={{ opacity: 0 }}
|
|
113
|
+
animate={{ opacity: 1 }}
|
|
114
|
+
layout
|
|
115
|
+
className="px-1 py-0.5 rounded-md bg-gray-100 dark:bg-neutral-800 "
|
|
116
|
+
>
|
|
117
|
+
{file.type}
|
|
118
|
+
</motion.p>
|
|
119
|
+
|
|
120
|
+
<motion.p
|
|
121
|
+
initial={{ opacity: 0 }}
|
|
122
|
+
animate={{ opacity: 1 }}
|
|
123
|
+
layout
|
|
124
|
+
>
|
|
125
|
+
modified{" "}
|
|
126
|
+
{new Date(file.lastModified).toLocaleDateString()}
|
|
127
|
+
</motion.p>
|
|
128
|
+
</div>
|
|
129
|
+
</motion.div>
|
|
130
|
+
))}
|
|
131
|
+
{!files.length && (
|
|
132
|
+
<motion.div
|
|
133
|
+
layoutId="file-upload"
|
|
134
|
+
variants={mainVariant}
|
|
135
|
+
transition={{
|
|
136
|
+
type: "spring",
|
|
137
|
+
stiffness: 300,
|
|
138
|
+
damping: 20,
|
|
139
|
+
}}
|
|
140
|
+
className={cn(
|
|
141
|
+
"relative group-hover/file:shadow-2xl z-40 bg-white dark:bg-neutral-900 flex items-center justify-center h-32 mt-4 w-full max-w-[8rem] mx-auto rounded-md",
|
|
142
|
+
"shadow-[0px_10px_50px_rgba(0,0,0,0.1)]",
|
|
143
|
+
)}
|
|
144
|
+
>
|
|
145
|
+
{isDragActive ? (
|
|
146
|
+
<motion.p
|
|
147
|
+
initial={{ opacity: 0 }}
|
|
148
|
+
animate={{ opacity: 1 }}
|
|
149
|
+
className="text-neutral-600 flex flex-col items-center"
|
|
150
|
+
>
|
|
151
|
+
Drop it
|
|
152
|
+
<Upload className="h-4 w-4 text-neutral-600 dark:text-neutral-400" />
|
|
153
|
+
</motion.p>
|
|
154
|
+
) : (
|
|
155
|
+
<Upload className="h-4 w-4 text-neutral-600 dark:text-neutral-300" />
|
|
156
|
+
)}
|
|
157
|
+
</motion.div>
|
|
158
|
+
)}
|
|
159
|
+
|
|
160
|
+
{!files.length && (
|
|
161
|
+
<motion.div
|
|
162
|
+
variants={secondaryVariant}
|
|
163
|
+
className="absolute opacity-0 border border-dashed border-sky-400 inset-0 z-30 bg-transparent flex items-center justify-center h-32 mt-4 w-full max-w-[8rem] mx-auto rounded-md"
|
|
164
|
+
></motion.div>
|
|
165
|
+
)}
|
|
166
|
+
</div>
|
|
167
|
+
</div>
|
|
168
|
+
</motion.div>
|
|
169
|
+
</div>
|
|
170
|
+
);
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
export function GridPattern() {
|
|
174
|
+
const columns = 41;
|
|
175
|
+
const rows = 11;
|
|
176
|
+
return (
|
|
177
|
+
<div className="flex bg-gray-100 dark:bg-neutral-900 flex-shrink-0 flex-wrap justify-center items-center gap-x-px gap-y-px scale-105">
|
|
178
|
+
{Array.from({ length: rows }).map((_, row) =>
|
|
179
|
+
Array.from({ length: columns }).map((_, col) => {
|
|
180
|
+
const index = row * columns + col;
|
|
181
|
+
return (
|
|
182
|
+
<div
|
|
183
|
+
key={`${col}-${row}`}
|
|
184
|
+
className={`w-10 h-10 flex flex-shrink-0 rounded-[2px] ${
|
|
185
|
+
index % 2 === 0
|
|
186
|
+
? "bg-gray-50 dark:bg-neutral-950"
|
|
187
|
+
: "bg-gray-50 dark:bg-neutral-950 shadow-[0px_0px_1px_3px_rgba(255,255,255,1)_inset] dark:shadow-[0px_0px_1px_3px_rgba(0,0,0,1)_inset]"
|
|
188
|
+
}`}
|
|
189
|
+
/>
|
|
190
|
+
);
|
|
191
|
+
}),
|
|
192
|
+
)}
|
|
193
|
+
</div>
|
|
194
|
+
);
|
|
195
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
export { cn } from "./lib/utils.js";
|
|
2
|
+
|
|
3
|
+
export { Alert, AlertDescription, AlertTitle } from "./components/alert.js";
|
|
4
|
+
export {
|
|
5
|
+
AlertDialog,
|
|
6
|
+
AlertDialogAction,
|
|
7
|
+
AlertDialogCancel,
|
|
8
|
+
AlertDialogContent,
|
|
9
|
+
AlertDialogDescription,
|
|
10
|
+
AlertDialogFooter,
|
|
11
|
+
AlertDialogHeader,
|
|
12
|
+
AlertDialogOverlay,
|
|
13
|
+
AlertDialogPortal,
|
|
14
|
+
AlertDialogTitle,
|
|
15
|
+
AlertDialogTrigger,
|
|
16
|
+
} from "./components/alert-dialog.js";
|
|
17
|
+
export { Badge, badgeVariants } from "./components/badge.js";
|
|
18
|
+
export { Button, buttonVariants } from "./components/button.js";
|
|
19
|
+
export {
|
|
20
|
+
Card,
|
|
21
|
+
CardAction,
|
|
22
|
+
CardContent,
|
|
23
|
+
CardDescription,
|
|
24
|
+
CardFooter,
|
|
25
|
+
CardHeader,
|
|
26
|
+
CardTitle,
|
|
27
|
+
} from "./components/card.js";
|
|
28
|
+
export {
|
|
29
|
+
Dialog,
|
|
30
|
+
DialogClose,
|
|
31
|
+
DialogContent,
|
|
32
|
+
DialogDescription,
|
|
33
|
+
DialogFooter,
|
|
34
|
+
DialogHeader,
|
|
35
|
+
DialogOverlay,
|
|
36
|
+
DialogPortal,
|
|
37
|
+
DialogTitle,
|
|
38
|
+
DialogTrigger,
|
|
39
|
+
} from "./components/dialog.js";
|
|
40
|
+
export {
|
|
41
|
+
Drawer,
|
|
42
|
+
DrawerClose,
|
|
43
|
+
DrawerContent,
|
|
44
|
+
DrawerDescription,
|
|
45
|
+
DrawerFooter,
|
|
46
|
+
DrawerHeader,
|
|
47
|
+
DrawerOverlay,
|
|
48
|
+
DrawerPortal,
|
|
49
|
+
DrawerTitle,
|
|
50
|
+
DrawerTrigger,
|
|
51
|
+
} from "./components/drawer.js";
|
|
52
|
+
export { Input } from "./components/input.js";
|
|
53
|
+
export { Label } from "./components/label.js";
|
|
54
|
+
export {
|
|
55
|
+
Popover,
|
|
56
|
+
PopoverAnchor,
|
|
57
|
+
PopoverContent,
|
|
58
|
+
PopoverTrigger,
|
|
59
|
+
} from "./components/popover.js";
|
|
60
|
+
export { ScrollArea, ScrollBar } from "./components/scroll-area.js";
|
|
61
|
+
export { Separator } from "./components/separator.js";
|
|
62
|
+
export { Skeleton } from "./components/skeleton.js";
|
|
63
|
+
export {
|
|
64
|
+
Tooltip,
|
|
65
|
+
TooltipContent,
|
|
66
|
+
TooltipProvider,
|
|
67
|
+
TooltipTrigger,
|
|
68
|
+
} from "./components/tooltip.js";
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
SeatAssignment,
|
|
3
|
+
SessionActor,
|
|
4
|
+
SessionGameSource,
|
|
5
|
+
} from "@dreamboard/api-client";
|
|
6
|
+
|
|
7
|
+
type HexColor = string & { readonly __brand: "HexColor" };
|
|
8
|
+
|
|
9
|
+
const HEX_COLOR_PATTERN = /^#[0-9A-Fa-f]{6}$/;
|
|
10
|
+
|
|
11
|
+
function parseHexColor(value: unknown): HexColor | undefined {
|
|
12
|
+
return typeof value === "string" && HEX_COLOR_PATTERN.test(value)
|
|
13
|
+
? (value as HexColor)
|
|
14
|
+
: undefined;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/** Stable string principal for comparing actors to connection `userId` / demo actor id. */
|
|
18
|
+
export function principalKey(actor: SessionActor): string {
|
|
19
|
+
if (actor.kind === "AUTH_USER") {
|
|
20
|
+
return actor.id;
|
|
21
|
+
}
|
|
22
|
+
return actor.demoActorSessionId;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export function principalMatchesActor(
|
|
26
|
+
principalId: string | null | undefined,
|
|
27
|
+
actor: SessionActor,
|
|
28
|
+
): boolean {
|
|
29
|
+
if (!principalId) {
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
return principalKey(actor) === principalId;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export function seatControlledByPrincipal(
|
|
36
|
+
seat: SeatAssignment,
|
|
37
|
+
principalId: string | null | undefined,
|
|
38
|
+
): boolean {
|
|
39
|
+
if (!principalId || !seat.controllerActor) {
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
return principalMatchesActor(principalId, seat.controllerActor);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export function gameIdFromGameSource(source: SessionGameSource): string {
|
|
46
|
+
if (source.kind === "USER_COMPILED") {
|
|
47
|
+
return source.gameId;
|
|
48
|
+
}
|
|
49
|
+
return `demo:${source.slug}:${source.revisionId}`;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export function seatsForPluginSnapshot(seats: SeatAssignment[]): Array<{
|
|
53
|
+
playerId: string;
|
|
54
|
+
controllerUserId?: string;
|
|
55
|
+
displayName: string;
|
|
56
|
+
playerColor?: HexColor;
|
|
57
|
+
isHost?: boolean;
|
|
58
|
+
}> {
|
|
59
|
+
return seats.map((seat) => ({
|
|
60
|
+
playerId: seat.playerId,
|
|
61
|
+
controllerUserId: seat.controllerActor
|
|
62
|
+
? principalKey(seat.controllerActor)
|
|
63
|
+
: undefined,
|
|
64
|
+
displayName: seat.displayName,
|
|
65
|
+
playerColor: parseHexColor(seat.playerColor),
|
|
66
|
+
isHost: seat.isHost,
|
|
67
|
+
}));
|
|
68
|
+
}
|