@vivix-labs/dashboard-projects 1.0.0-beta.2 → 1.0.0-beta.9
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/client-code.css +30 -26
- package/dist/client-code.js +366 -99
- package/package.json +5 -2
package/dist/client-code.css
CHANGED
|
@@ -1,3 +1,19 @@
|
|
|
1
|
+
/* packages/dashboard-projects/src/create-project-dialog.css */
|
|
2
|
+
.studio-home-create-form {
|
|
3
|
+
display: grid;
|
|
4
|
+
gap: var(--vx-space-16);
|
|
5
|
+
}
|
|
6
|
+
.studio-home-create-field {
|
|
7
|
+
display: grid;
|
|
8
|
+
gap: var(--vx-space-8);
|
|
9
|
+
color: var(--vx-text-secondary);
|
|
10
|
+
font: var(--vx-typography-inter-14-regular);
|
|
11
|
+
}
|
|
12
|
+
.studio-home-create-form p {
|
|
13
|
+
margin: 0;
|
|
14
|
+
color: var(--vx-text-secondary-readable);
|
|
15
|
+
}
|
|
16
|
+
|
|
1
17
|
/* packages/dashboard-projects/src/card.css */
|
|
2
18
|
.studio-home-panel {
|
|
3
19
|
--home-panel-inset: 16px;
|
|
@@ -15,7 +31,7 @@
|
|
|
15
31
|
}
|
|
16
32
|
.studio-home-panel > header h2 {
|
|
17
33
|
margin: 0;
|
|
18
|
-
font
|
|
34
|
+
font: var(--vx-typography-inter-16-semi-bold);
|
|
19
35
|
}
|
|
20
36
|
.studio-home-grid {
|
|
21
37
|
display: grid;
|
|
@@ -23,11 +39,11 @@
|
|
|
23
39
|
gap: 8px;
|
|
24
40
|
padding: 0 var(--home-panel-inset) var(--home-panel-inset);
|
|
25
41
|
}
|
|
26
|
-
.studio-home-tile {
|
|
42
|
+
.studio-home-panel .studio-home-tile {
|
|
27
43
|
display: grid;
|
|
28
44
|
align-content: start;
|
|
29
45
|
text-align: start;
|
|
30
|
-
gap:
|
|
46
|
+
gap: var(--vx-space-8);
|
|
31
47
|
min-width: 0;
|
|
32
48
|
width: 100%;
|
|
33
49
|
color: inherit;
|
|
@@ -37,6 +53,14 @@
|
|
|
37
53
|
padding: 0;
|
|
38
54
|
cursor: pointer;
|
|
39
55
|
}
|
|
56
|
+
.studio-home-caption {
|
|
57
|
+
display: grid;
|
|
58
|
+
min-width: 0;
|
|
59
|
+
gap: var(--vx-space-4);
|
|
60
|
+
}
|
|
61
|
+
.studio-home-caption > strong {
|
|
62
|
+
font: var(--vx-typography-inter-14-semi-bold);
|
|
63
|
+
}
|
|
40
64
|
.studio-home-tile:disabled {
|
|
41
65
|
opacity: 0.5;
|
|
42
66
|
cursor: default;
|
|
@@ -59,8 +83,8 @@
|
|
|
59
83
|
place-items: center;
|
|
60
84
|
overflow: hidden;
|
|
61
85
|
border-radius: 8px;
|
|
62
|
-
background: var(--vx-
|
|
63
|
-
color: var(--vx-text-
|
|
86
|
+
background: var(--vx-cover-background);
|
|
87
|
+
color: var(--vx-text-on-content-secondary);
|
|
64
88
|
}
|
|
65
89
|
.studio-home-cover img,
|
|
66
90
|
.studio-home-cover video {
|
|
@@ -70,12 +94,10 @@
|
|
|
70
94
|
height: 100%;
|
|
71
95
|
object-fit: contain;
|
|
72
96
|
}
|
|
73
|
-
.studio-home-cover:has(img, video) {
|
|
74
|
-
background: #151515;
|
|
75
|
-
}
|
|
76
97
|
.studio-home-create .studio-home-cover {
|
|
77
98
|
border: 1px dashed var(--vx-border-secondary);
|
|
78
99
|
background: var(--vx-surface-input);
|
|
100
|
+
color: var(--vx-text-primary);
|
|
79
101
|
}
|
|
80
102
|
.studio-home-create .studio-home-cover > span {
|
|
81
103
|
display: grid;
|
|
@@ -85,24 +107,6 @@
|
|
|
85
107
|
border-radius: 4px;
|
|
86
108
|
background: var(--vx-background-dialog);
|
|
87
109
|
}
|
|
88
|
-
.studio-home-create-form {
|
|
89
|
-
display: grid;
|
|
90
|
-
gap: var(--vx-space-16);
|
|
91
|
-
}
|
|
92
|
-
.studio-home-create-field {
|
|
93
|
-
display: grid;
|
|
94
|
-
gap: var(--vx-space-8);
|
|
95
|
-
color: var(--vx-text-secondary);
|
|
96
|
-
font: var(--vx-typography-inter-14-regular);
|
|
97
|
-
}
|
|
98
|
-
.studio-home-create-form p {
|
|
99
|
-
margin: 0;
|
|
100
|
-
color: var(--vx-text-secondary-readable);
|
|
101
|
-
}
|
|
102
|
-
.studio-home-view-all.vx-button {
|
|
103
|
-
background: transparent;
|
|
104
|
-
color: var(--vx-state-success);
|
|
105
|
-
}
|
|
106
110
|
@media (max-width: 660px) {
|
|
107
111
|
.studio-home-panel {
|
|
108
112
|
--home-panel-inset: 12px;
|
package/dist/client-code.js
CHANGED
|
@@ -1,6 +1,164 @@
|
|
|
1
1
|
// packages/dashboard-projects/src/client.tsx
|
|
2
|
-
import * as
|
|
2
|
+
import * as React2 from "react";
|
|
3
|
+
import { z as z3 } from "vivix-studio/sdk/shared";
|
|
4
|
+
|
|
5
|
+
// packages/project-studio/dist/shared.js
|
|
6
|
+
import { z as z2, defineOperation } from "vivix-studio/sdk/shared";
|
|
3
7
|
import { z } from "vivix-studio/sdk/shared";
|
|
8
|
+
var fixedRef = z.object({ storeId: z.uuid(), objectId: z.uuid(), versionId: z.uuid() }).strict();
|
|
9
|
+
var copy = z.string().max(8e3).default("");
|
|
10
|
+
var clipScript = z.object({
|
|
11
|
+
title: z.string().trim().min(1).max(200),
|
|
12
|
+
visual: copy,
|
|
13
|
+
voiceover: copy,
|
|
14
|
+
onScreenText: copy,
|
|
15
|
+
cta: copy,
|
|
16
|
+
plannedDurationMs: z.number().int().positive().nullable().default(null)
|
|
17
|
+
}).strict();
|
|
18
|
+
var adBrief = z.object({
|
|
19
|
+
product: copy,
|
|
20
|
+
category: copy,
|
|
21
|
+
audience: copy,
|
|
22
|
+
sellingPoints: copy,
|
|
23
|
+
channel: copy,
|
|
24
|
+
aspectRatio: z.string().max(40).nullable().default(null),
|
|
25
|
+
targetDurationMs: z.number().int().positive().nullable().default(null),
|
|
26
|
+
body: copy,
|
|
27
|
+
productRefs: z.array(fixedRef).max(100).default([]),
|
|
28
|
+
modelRefs: z.array(fixedRef).max(100).default([])
|
|
29
|
+
}).strict();
|
|
30
|
+
var adFilm = z.object({
|
|
31
|
+
title: z.string().trim().min(1).max(150),
|
|
32
|
+
source: fixedRef,
|
|
33
|
+
width: z.number().int().positive().max(8192),
|
|
34
|
+
height: z.number().int().positive().max(8192),
|
|
35
|
+
aspectRatio: z.string().regex(/^\d+:\d+$/)
|
|
36
|
+
}).strict();
|
|
37
|
+
var adStoryboard = z.object({
|
|
38
|
+
brief: adBrief,
|
|
39
|
+
films: z.array(adFilm).max(100).optional(),
|
|
40
|
+
clips: z.array(
|
|
41
|
+
z.object({
|
|
42
|
+
assetId: z.uuid(),
|
|
43
|
+
filmId: z.uuid().optional(),
|
|
44
|
+
script: clipScript,
|
|
45
|
+
edits: z.array(z.object({ sourceVersionId: z.uuid(), editRef: fixedRef }).strict()).max(200)
|
|
46
|
+
}).strict()
|
|
47
|
+
).max(200)
|
|
48
|
+
}).strict().superRefine((value, context) => {
|
|
49
|
+
if (new Set(value.clips.map((c) => c.assetId)).size !== value.clips.length)
|
|
50
|
+
context.addIssue({ code: "custom", message: "A clip can appear only once in a storyboard." });
|
|
51
|
+
for (const clip of value.clips)
|
|
52
|
+
if (new Set(clip.edits.map((e) => e.sourceVersionId)).size !== clip.edits.length)
|
|
53
|
+
context.addIssue({
|
|
54
|
+
code: "custom",
|
|
55
|
+
message: "Each candidate has one current edit binding."
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
var projectType = z2.enum(["short-drama", "product-ad", "other"]);
|
|
59
|
+
var studioConfig = z2.object({
|
|
60
|
+
role: z2.enum(["project", "coordinator"]).default("project"),
|
|
61
|
+
projectType: projectType.optional(),
|
|
62
|
+
dataInstance: z2.string().min(1).default("user:data"),
|
|
63
|
+
apiInstance: z2.string().min(1).default("api"),
|
|
64
|
+
libraryInstance: z2.string().min(1).nullable().default(null),
|
|
65
|
+
coordinatorInstance: z2.string().min(1).optional()
|
|
66
|
+
}).strict();
|
|
67
|
+
var versionRef = z2.object({ storeId: z2.uuid(), objectId: z2.uuid(), versionId: z2.uuid() }).strict();
|
|
68
|
+
var tags = z2.array(z2.string().trim().min(1).max(64)).max(50).transform((x) => [...new Set(x)]).default([]);
|
|
69
|
+
var kind = z2.enum(["text", "image", "video", "audio", "file"]);
|
|
70
|
+
var projectData = z2.object({
|
|
71
|
+
name: z2.string().trim().min(1).max(120),
|
|
72
|
+
description: z2.string().max(4e3).default(""),
|
|
73
|
+
status: z2.enum(["draft", "active", "archived"]).default("draft"),
|
|
74
|
+
aspectRatio: z2.string().nullable().default(null),
|
|
75
|
+
projectType: projectType.optional(),
|
|
76
|
+
coverRef: versionRef.nullable().default(null),
|
|
77
|
+
briefRef: z2.object({ storeId: z2.uuid(), objectId: z2.uuid() }).strict().nullable().default(null),
|
|
78
|
+
tags
|
|
79
|
+
}).strict();
|
|
80
|
+
var assetData = z2.object({
|
|
81
|
+
projectId: z2.uuid(),
|
|
82
|
+
name: z2.string().trim().min(1).max(200),
|
|
83
|
+
kind,
|
|
84
|
+
purpose: z2.enum(["reference", "script", "shot", "music", "voice", "subtitle", "final", "other"]).default("other"),
|
|
85
|
+
origin: z2.enum(["upload", "library", "generated", "authored"]),
|
|
86
|
+
orderKey: z2.number().int().nullable().default(null),
|
|
87
|
+
tags,
|
|
88
|
+
lifecycle: z2.enum(["draft", "ready", "archived"]).default("draft"),
|
|
89
|
+
sourceRef: versionRef.nullable().default(null),
|
|
90
|
+
adoptedVersionId: z2.uuid().nullable().default(null)
|
|
91
|
+
}).strict();
|
|
92
|
+
var anchor = z2.discriminatedUnion("kind", [
|
|
93
|
+
z2.object({ kind: z2.literal("whole") }).strict(),
|
|
94
|
+
z2.object({
|
|
95
|
+
kind: z2.literal("timeRange"),
|
|
96
|
+
startMs: z2.number().int().nonnegative(),
|
|
97
|
+
endMs: z2.number().int().nonnegative()
|
|
98
|
+
}).strict()
|
|
99
|
+
]);
|
|
100
|
+
var generationInput = z2.object({
|
|
101
|
+
targetAssetId: z2.uuid().optional(),
|
|
102
|
+
taskName: z2.string().trim().min(1).max(200).optional(),
|
|
103
|
+
context: z2.record(z2.string().min(1).max(64), z2.string().min(1).max(200)).optional(),
|
|
104
|
+
expectedRevision: z2.number().int().positive().optional(),
|
|
105
|
+
newAsset: z2.object({
|
|
106
|
+
name: z2.string().trim().min(1).max(200),
|
|
107
|
+
kind: z2.enum(["image", "video", "audio"])
|
|
108
|
+
}).strict().optional(),
|
|
109
|
+
modelId: z2.string().min(1),
|
|
110
|
+
capabilityId: z2.string().min(1),
|
|
111
|
+
prompt: z2.string().max(32e3),
|
|
112
|
+
parameters: z2.record(z2.string(), z2.unknown()).default({}),
|
|
113
|
+
outputCount: z2.number().int().min(1).max(100).default(1),
|
|
114
|
+
inputs: z2.array(
|
|
115
|
+
z2.object({
|
|
116
|
+
ref: versionRef,
|
|
117
|
+
role: z2.string().min(1),
|
|
118
|
+
order: z2.number().int().nonnegative(),
|
|
119
|
+
weight: z2.number().finite().nullable().default(null)
|
|
120
|
+
}).strict()
|
|
121
|
+
).max(100).default([]),
|
|
122
|
+
baseVersionId: z2.uuid().optional(),
|
|
123
|
+
changeRequest: z2.string().trim().min(1).max(4e3).optional(),
|
|
124
|
+
preserveRequest: z2.string().max(4e3).default(""),
|
|
125
|
+
anchor: anchor.default({ kind: "whole" }),
|
|
126
|
+
retryOfTaskId: z2.uuid().optional(),
|
|
127
|
+
acknowledgeUnknown: z2.boolean().optional()
|
|
128
|
+
}).strict();
|
|
129
|
+
var projectSettingsInput = z2.object({
|
|
130
|
+
projectId: z2.uuid(),
|
|
131
|
+
expectedRevision: z2.number().int().positive(),
|
|
132
|
+
changes: projectData.pick({ name: true, description: true, tags: true, aspectRatio: true, coverRef: true }).extend({
|
|
133
|
+
description: projectData.shape.description.unwrap(),
|
|
134
|
+
tags: projectData.shape.tags.unwrap(),
|
|
135
|
+
aspectRatio: projectData.shape.aspectRatio.unwrap(),
|
|
136
|
+
coverRef: projectData.shape.coverRef.unwrap()
|
|
137
|
+
}).partial().strict()
|
|
138
|
+
}).strict();
|
|
139
|
+
var generationSubmitOperation = defineOperation({
|
|
140
|
+
id: "generation.submit",
|
|
141
|
+
title: "Generate",
|
|
142
|
+
description: "Submit one media generation without approval, retaining its paid request identity.",
|
|
143
|
+
input: generationInput,
|
|
144
|
+
output: z2.any(),
|
|
145
|
+
effects: ["write", "paid"],
|
|
146
|
+
confirm: "none"
|
|
147
|
+
});
|
|
148
|
+
var favoriteData = z2.object({ ref: versionRef }).strict();
|
|
149
|
+
var sqlScalar = z2.union([z2.string(), z2.number().finite(), z2.null()]);
|
|
150
|
+
var globalQueryInput = z2.object({
|
|
151
|
+
sql: z2.string().trim().min(1),
|
|
152
|
+
params: z2.union([z2.array(sqlScalar), z2.record(z2.string(), sqlScalar)]).optional(),
|
|
153
|
+
timeoutMs: z2.number().int().positive().optional(),
|
|
154
|
+
maxRows: z2.number().int().positive().optional(),
|
|
155
|
+
limit: z2.number().int().min(1).max(200).optional(),
|
|
156
|
+
offset: z2.number().int().nonnegative().optional(),
|
|
157
|
+
source: z2.enum(["projects", "assets", "tasks"]),
|
|
158
|
+
excludeProjectIds: z2.array(z2.uuid()).optional(),
|
|
159
|
+
catalog: z2.array(z2.object({ id: z2.string().min(1), name: z2.string(), available: z2.boolean() }).strict()).optional()
|
|
160
|
+
}).strict();
|
|
161
|
+
var projectListSql = "SELECT rowId, projectId, name, available, createdAt, coverRef FROM studio_projects ORDER BY createdAt DESC, rowId ASC";
|
|
4
162
|
|
|
5
163
|
// packages/ui-system/dist/button.js
|
|
6
164
|
import { jsx as _jsx2, jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -73,6 +231,10 @@ var iconGeometry = {
|
|
|
73
231
|
height: 15.5625,
|
|
74
232
|
slot: 18
|
|
75
233
|
},
|
|
234
|
+
"select-items": { width: 13.8681, height: 13.8667, slot: 16 },
|
|
235
|
+
trim: { width: 14.85, height: 14.85, slot: 16 },
|
|
236
|
+
crop: { width: 16.25, height: 16.25, slot: 16 },
|
|
237
|
+
filter: { width: 13.2, height: 13.2, slot: 16 },
|
|
76
238
|
select: {
|
|
77
239
|
width: 14.6298,
|
|
78
240
|
height: 16.065,
|
|
@@ -153,6 +315,9 @@ var iconGeometry = {
|
|
|
153
315
|
height: 13.2,
|
|
154
316
|
slot: 16
|
|
155
317
|
},
|
|
318
|
+
favorite: { width: 11.8667, height: 14.5333, slot: 16 },
|
|
319
|
+
download: { width: 13.2001, height: 13.1997, slot: 16 },
|
|
320
|
+
delete: { width: 13.2, height: 14.533, slot: 16 },
|
|
156
321
|
edit: {
|
|
157
322
|
width: 10.8791,
|
|
158
323
|
height: 12.0459,
|
|
@@ -213,6 +378,9 @@ var buttonVariants = {
|
|
|
213
378
|
"text-filled-leading-sm": { size: 32, appearance: "filled", shape: "text" },
|
|
214
379
|
"text-ghost-sm": { size: 32, appearance: "ghost", shape: "text" },
|
|
215
380
|
"text-on-content-sm": { size: 32, appearance: "on-content", shape: "text" },
|
|
381
|
+
"text-plain-sm": { size: 32, appearance: "plain", shape: "text" },
|
|
382
|
+
"text-link-sm": { size: 32, appearance: "link", shape: "text" },
|
|
383
|
+
"text-outline-sm": { size: 32, appearance: "outline", shape: "text" },
|
|
216
384
|
"text-tonal-sm": { size: 32, appearance: "tonal", shape: "text" },
|
|
217
385
|
// The medium recipes are shared by all dialog footer actions.
|
|
218
386
|
"text-filled-md": { size: 40, appearance: "filled", shape: "text" },
|
|
@@ -247,35 +415,51 @@ function ButtonFrame({ label, variant, loading = false, width, children, disable
|
|
|
247
415
|
const buttonStyle = "width" in spec ? { ...style, "--vx-button-width": `${spec.width}px` } : style;
|
|
248
416
|
return _jsxs("button", { ...props, type, className: className ? `vx-button ${className}` : "vx-button", "data-variant": variant, "data-appearance": spec.appearance, "data-shape": spec.shape, "data-size": spec.size, "data-width": width, "data-state": loading ? "loading" : disabled ? "disabled" : "default", style: buttonStyle, disabled: disabled || loading, "aria-label": label, "aria-busy": loading || void 0, children: [_jsx2("span", { className: "vx-button-content", children }), loading && _jsx2("span", { className: "vx-button-loading", "aria-hidden": "true" })] });
|
|
249
417
|
}
|
|
250
|
-
function Button({ variant = "text-filled-sm", leadingIcon, trailingIcon, ...props }) {
|
|
251
|
-
return _jsxs(ButtonFrame, { ...props, variant, children: [leadingIcon && _jsx2(Icon, { name: leadingIcon }), _jsx2("span", { className: "vx-button-label", children: props.label }), trailingIcon && _jsx2("span", { className: "vx-button-trailing", children: _jsx2(Icon, { name: trailingIcon }) })] });
|
|
418
|
+
function Button({ variant = "text-filled-sm", leadingIcon, trailingIcon, badge, ...props }) {
|
|
419
|
+
return _jsxs(ButtonFrame, { ...props, label: badge ? `${props.label} (${badge})` : props.label, variant, children: [leadingIcon && _jsx2(Icon, { name: leadingIcon }), _jsx2("span", { className: "vx-button-label", children: props.label }), badge !== void 0 && badge > 0 && _jsx2("span", { className: "vx-button-badge", children: badge }), trailingIcon && _jsx2("span", { className: "vx-button-trailing", children: _jsx2(Icon, { name: trailingIcon }) })] });
|
|
252
420
|
}
|
|
253
421
|
function IconButton({ icon, variant = "icon-ghost-sm", ...props }) {
|
|
254
422
|
return _jsx2(ButtonFrame, { ...props, variant, children: _jsx2(Icon, { name: icon }) });
|
|
255
423
|
}
|
|
256
424
|
|
|
425
|
+
// packages/ui-system/dist/cover-preview.js
|
|
426
|
+
import { jsx as _jsx3 } from "react/jsx-runtime";
|
|
427
|
+
import { useState } from "react";
|
|
428
|
+
function CoverPreview(props) {
|
|
429
|
+
return _jsx3(Preview, { ...props }, JSON.stringify([props.kind, props.src]));
|
|
430
|
+
}
|
|
431
|
+
function Preview({ className, ref, kind: kind2 = "image", src, pending, iconSize = 20, children }) {
|
|
432
|
+
const [mediaState, setMediaState] = useState("loading");
|
|
433
|
+
const media = src && (kind2 === "image" || kind2 === "video");
|
|
434
|
+
const state = pending ? "loading" : media ? mediaState : children ? "ready" : "empty";
|
|
435
|
+
const iconKind = kind2 === "video" || kind2 === "audio" ? kind2 : kind2 === "text" ? "script" : "image";
|
|
436
|
+
const ready = () => setMediaState("ready");
|
|
437
|
+
const failed = () => setMediaState("empty");
|
|
438
|
+
return _jsx3("span", { ref, className: `vx-cover-preview ${className}`, "data-cover-state": state, "aria-hidden": "true", children: state === "empty" ? _jsx3(Icon, { name: `placeholder-${iconKind}`, size: iconSize }) : !pending && media ? kind2 === "video" ? _jsx3("video", { src, muted: true, playsInline: true, preload: "auto", onLoadedData: ready, onError: failed }) : _jsx3("img", { src, alt: "", loading: "lazy", onLoad: ready, onError: failed }) : state === "ready" ? children : null });
|
|
439
|
+
}
|
|
440
|
+
|
|
257
441
|
// packages/ui-system/dist/segmented-control.js
|
|
258
|
-
import { jsx as
|
|
442
|
+
import { jsx as _jsx4, jsxs as _jsxs2 } from "react/jsx-runtime";
|
|
259
443
|
import { useId } from "react";
|
|
260
444
|
function SegmentedControl({ label, items, value, onValueChange, size = "medium", width = "fixed", iconOnly = false }) {
|
|
261
445
|
const id = useId();
|
|
262
|
-
return
|
|
446
|
+
return _jsx4("div", { role: "radiogroup", "aria-label": label, className: "vx-segment", "data-size": size, "data-width": width, "data-icon-only": iconOnly, children: items.map((item) => _jsxs2("label", { children: [_jsx4("input", { type: "radio", name: id, value: item.value, disabled: item.disabled, checked: item.value === value, "aria-label": item.label, onChange: () => onValueChange(item.value) }), _jsxs2("span", { className: "vx-segment-item", children: [item.icon && _jsx4(Icon, { name: item.icon }), (!iconOnly || !item.icon) && item.label] })] }, item.value)) });
|
|
263
447
|
}
|
|
264
448
|
|
|
265
449
|
// packages/ui-system/dist/input.js
|
|
266
|
-
import { jsx as
|
|
267
|
-
function TextInput({ label, value, onValueChange, size = "medium", ...props }) {
|
|
268
|
-
return _jsxs3("label", { className: "vx-field", "data-size": size, children: [
|
|
450
|
+
import { jsx as _jsx5, jsxs as _jsxs3 } from "react/jsx-runtime";
|
|
451
|
+
function TextInput({ label, value, onValueChange, size = "medium", appearance = "default", ...props }) {
|
|
452
|
+
return _jsxs3("label", { className: "vx-field", "data-size": size, "data-appearance": appearance, children: [_jsx5("span", { children: label }), _jsx5("input", { ...props, type: "text", value, onChange: (event) => onValueChange(event.currentTarget.value) })] });
|
|
269
453
|
}
|
|
270
454
|
|
|
271
455
|
// packages/ui-system/dist/dialog.js
|
|
272
|
-
import { jsx as
|
|
273
|
-
import { useId as useId2, useLayoutEffect, useRef, useState } from "react";
|
|
456
|
+
import { jsx as _jsx6, jsxs as _jsxs4, Fragment as _Fragment } from "react/jsx-runtime";
|
|
457
|
+
import { useId as useId2, useLayoutEffect, useRef, useState as useState2 } from "react";
|
|
274
458
|
import { createPortal } from "react-dom";
|
|
275
459
|
|
|
276
460
|
// packages/ui-system/dist/dialog-surface.js
|
|
277
|
-
function createDialogSurface(
|
|
278
|
-
const source =
|
|
461
|
+
function createDialogSurface(anchor2) {
|
|
462
|
+
const source = anchor2.ownerDocument;
|
|
279
463
|
let target;
|
|
280
464
|
try {
|
|
281
465
|
target = source.defaultView?.top?.document ?? source;
|
|
@@ -293,19 +477,19 @@ function createDialogSurface(anchor) {
|
|
|
293
477
|
clone.setAttribute("href", original.href);
|
|
294
478
|
shadow.append(clone);
|
|
295
479
|
}
|
|
296
|
-
const theme =
|
|
480
|
+
const theme = anchor2.closest("[data-vx-theme]");
|
|
297
481
|
const root = target.createElement("div");
|
|
298
482
|
root.dataset.vxTheme = theme?.dataset.vxTheme ?? "light";
|
|
299
483
|
root.className = theme?.className ?? "";
|
|
300
484
|
root.style.display = "contents";
|
|
301
|
-
const style = source.defaultView.getComputedStyle(
|
|
485
|
+
const style = source.defaultView.getComputedStyle(anchor2);
|
|
302
486
|
for (const name of style)
|
|
303
487
|
if (name.startsWith("--"))
|
|
304
488
|
root.style.setProperty(name, style.getPropertyValue(name));
|
|
305
489
|
shadow.append(root);
|
|
306
490
|
let container = root;
|
|
307
491
|
const ancestors = [];
|
|
308
|
-
for (let parent =
|
|
492
|
+
for (let parent = anchor2.parentElement; parent && parent !== theme; parent = parent.parentElement)
|
|
309
493
|
ancestors.unshift(parent);
|
|
310
494
|
for (const original of ancestors) {
|
|
311
495
|
const wrapper = target.createElement("div");
|
|
@@ -322,16 +506,16 @@ function createDialogSurface(anchor) {
|
|
|
322
506
|
}
|
|
323
507
|
|
|
324
508
|
// packages/ui-system/dist/dialog.js
|
|
325
|
-
function Dialog({ title, open, onOpenChange, children, actions, className, variant = "default" }) {
|
|
509
|
+
function Dialog({ title, open, onOpenChange, children, actions, className, variant = "default", focusTitleOnOpen = variant === "welcome" }) {
|
|
326
510
|
const ref = useRef(null);
|
|
327
|
-
const
|
|
328
|
-
const [surface, setSurface] =
|
|
511
|
+
const anchor2 = useRef(null);
|
|
512
|
+
const [surface, setSurface] = useState2();
|
|
329
513
|
const heading = useId2();
|
|
330
514
|
useLayoutEffect(() => {
|
|
331
|
-
if (!open || !
|
|
515
|
+
if (!open || !anchor2.current)
|
|
332
516
|
return;
|
|
333
|
-
const mounted = createDialogSurface(
|
|
334
|
-
const active =
|
|
517
|
+
const mounted = createDialogSurface(anchor2.current);
|
|
518
|
+
const active = anchor2.current.getRootNode().activeElement;
|
|
335
519
|
setSurface(mounted?.root ?? null);
|
|
336
520
|
return () => {
|
|
337
521
|
mounted?.dispose();
|
|
@@ -352,6 +536,8 @@ function Dialog({ title, open, onOpenChange, children, actions, className, varia
|
|
|
352
536
|
dialog2.close();
|
|
353
537
|
};
|
|
354
538
|
}, [open, surface]);
|
|
539
|
+
const welcome = variant === "welcome";
|
|
540
|
+
const closeButton = _jsx6(IconButton, { icon: "close", label: "Close dialog", onClick: () => onOpenChange(false) });
|
|
355
541
|
const dialog = _jsxs4("dialog", { ref, className: className ? `vx-dialog ${className}` : "vx-dialog", "data-variant": variant === "default" ? void 0 : variant, "aria-labelledby": heading, onCancel: (event) => {
|
|
356
542
|
event.preventDefault();
|
|
357
543
|
event.stopPropagation();
|
|
@@ -359,34 +545,13 @@ function Dialog({ title, open, onOpenChange, children, actions, className, varia
|
|
|
359
545
|
}, onClose: (event) => {
|
|
360
546
|
if (open && event.currentTarget.isConnected && !event.currentTarget.open)
|
|
361
547
|
onOpenChange(false);
|
|
362
|
-
}, children: [_jsxs4("header", { children: [
|
|
363
|
-
return _jsxs4(_Fragment, { children: [
|
|
548
|
+
}, children: [_jsxs4("header", { children: [_jsx6("h2", { id: heading, tabIndex: focusTitleOnOpen ? -1 : void 0, autoFocus: focusTitleOnOpen, children: title }), !welcome && closeButton] }), _jsx6("div", { className: "vx-dialog-body", children }), (actions || welcome) && _jsxs4("footer", { children: [actions, welcome && closeButton] })] });
|
|
549
|
+
return _jsxs4(_Fragment, { children: [_jsx6("span", { ref: anchor2, hidden: true }), open && (surface ? createPortal(dialog, surface) : dialog)] });
|
|
364
550
|
}
|
|
365
551
|
|
|
366
|
-
// packages/dashboard-projects/src/
|
|
552
|
+
// packages/dashboard-projects/src/create-project-dialog.tsx
|
|
553
|
+
import * as React from "react";
|
|
367
554
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
368
|
-
var Config = z.object({ studioInstance: z.string().min(1).nullable().default(null) });
|
|
369
|
-
var dependencies = (config) => config.studioInstance ? [config.studioInstance] : [];
|
|
370
|
-
var projectsSql = "SELECT * FROM studio_projects ORDER BY createdAt DESC, rowId ASC";
|
|
371
|
-
function decodeRef(value) {
|
|
372
|
-
let item = value;
|
|
373
|
-
if (typeof item === "string") {
|
|
374
|
-
try {
|
|
375
|
-
item = JSON.parse(item);
|
|
376
|
-
} catch {
|
|
377
|
-
return null;
|
|
378
|
-
}
|
|
379
|
-
}
|
|
380
|
-
if (!item || typeof item !== "object" || Array.isArray(item)) return null;
|
|
381
|
-
const ref = item;
|
|
382
|
-
return ["storeId", "objectId", "versionId"].every(
|
|
383
|
-
(key) => typeof ref[key] === "string" && /^[0-9a-f-]{36}$/i.test(ref[key])
|
|
384
|
-
) ? {
|
|
385
|
-
storeId: ref.storeId,
|
|
386
|
-
objectId: ref.objectId,
|
|
387
|
-
versionId: ref.versionId
|
|
388
|
-
} : null;
|
|
389
|
-
}
|
|
390
555
|
var projectTypes = [
|
|
391
556
|
{
|
|
392
557
|
value: "short-drama",
|
|
@@ -428,9 +593,11 @@ function NewProjectDialog({
|
|
|
428
593
|
const selection = projectTypes.find((item) => item.value === type);
|
|
429
594
|
const placeholder = type === "table" ? "Untitled Project" : "Untitled " + selection.label;
|
|
430
595
|
const [packageName, presetId] = selection.preset.split(":");
|
|
431
|
-
const preset =
|
|
432
|
-
(
|
|
433
|
-
|
|
596
|
+
const preset = [packageName, packageName.replace("@vivix-labs/", "@vivix-studio/")].flatMap(
|
|
597
|
+
(name2) => presets?.filter(
|
|
598
|
+
(item) => item.spec.startsWith(name2 + "@") && item.spec.endsWith(":" + presetId)
|
|
599
|
+
) ?? []
|
|
600
|
+
)[0];
|
|
434
601
|
async function create() {
|
|
435
602
|
if (!preset || !client.projects?.create || busy) return;
|
|
436
603
|
const input = {
|
|
@@ -520,68 +687,125 @@ function NewProjectDialog({
|
|
|
520
687
|
}
|
|
521
688
|
);
|
|
522
689
|
}
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
690
|
+
|
|
691
|
+
// packages/dashboard-projects/src/client.tsx
|
|
692
|
+
import { Fragment as Fragment2, jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
693
|
+
var Config = z3.object({ studioInstance: z3.string().min(1).nullable().default(null) });
|
|
694
|
+
var dependencies = (config) => config.studioInstance ? [config.studioInstance] : [];
|
|
695
|
+
function decodeRef(value) {
|
|
696
|
+
let item = value;
|
|
697
|
+
if (typeof item === "string") {
|
|
698
|
+
try {
|
|
699
|
+
item = JSON.parse(item);
|
|
700
|
+
} catch {
|
|
701
|
+
return null;
|
|
702
|
+
}
|
|
703
|
+
}
|
|
704
|
+
if (!item || typeof item !== "object" || Array.isArray(item)) return null;
|
|
705
|
+
const ref = item;
|
|
706
|
+
return ["storeId", "objectId", "versionId"].every(
|
|
707
|
+
(key) => typeof ref[key] === "string" && /^[0-9a-f-]{36}$/i.test(ref[key])
|
|
708
|
+
) ? {
|
|
709
|
+
storeId: ref.storeId,
|
|
710
|
+
objectId: ref.objectId,
|
|
711
|
+
versionId: ref.versionId
|
|
712
|
+
} : null;
|
|
527
713
|
}
|
|
714
|
+
var projectPreviews = /* @__PURE__ */ new WeakMap();
|
|
715
|
+
function ProjectCover({
|
|
716
|
+
client,
|
|
717
|
+
row,
|
|
718
|
+
pending
|
|
719
|
+
}) {
|
|
720
|
+
const ref = decodeRef(row?.available ? row.previewRef ?? row.coverRef : void 0);
|
|
721
|
+
const instanceId = client.config.studioInstance;
|
|
722
|
+
const key = ref && JSON.stringify([instanceId, ref.storeId, ref.objectId, ref.versionId]);
|
|
723
|
+
const cached = key ? projectPreviews.get(client)?.get(key) : void 0;
|
|
724
|
+
const [resolved, setResolved] = React2.useState();
|
|
725
|
+
React2.useEffect(() => {
|
|
726
|
+
if (!ref || !instanceId || !key || cached) return;
|
|
727
|
+
let active = true;
|
|
728
|
+
void client.invoke({ instanceId, operationId: "global.asset" }, { ref }).then(
|
|
729
|
+
({ item }) => {
|
|
730
|
+
if (!active) return;
|
|
731
|
+
if (item.previewUrl) {
|
|
732
|
+
const previews = projectPreviews.get(client) ?? /* @__PURE__ */ new Map();
|
|
733
|
+
previews.set(key, item);
|
|
734
|
+
if (previews.size > 64) previews.delete(previews.keys().next().value);
|
|
735
|
+
projectPreviews.set(client, previews);
|
|
736
|
+
}
|
|
737
|
+
setResolved(item);
|
|
738
|
+
},
|
|
739
|
+
() => {
|
|
740
|
+
if (active) setResolved(null);
|
|
741
|
+
}
|
|
742
|
+
);
|
|
743
|
+
return () => {
|
|
744
|
+
active = false;
|
|
745
|
+
};
|
|
746
|
+
}, [client, instanceId, key, cached]);
|
|
747
|
+
const preview = cached ?? resolved;
|
|
748
|
+
const src = preview?.previewUrl ?? row?.previewUrl;
|
|
749
|
+
return /* @__PURE__ */ jsx2(
|
|
750
|
+
CoverPreview,
|
|
751
|
+
{
|
|
752
|
+
className: "studio-home-cover",
|
|
753
|
+
src: typeof src === "string" ? src : void 0,
|
|
754
|
+
kind: String(preview?.kind ?? row?.previewKind ?? "image"),
|
|
755
|
+
pending: pending || Boolean(instanceId && ref && preview === void 0)
|
|
756
|
+
}
|
|
757
|
+
);
|
|
758
|
+
}
|
|
759
|
+
var previousProjects = /* @__PURE__ */ new WeakMap();
|
|
528
760
|
function ProjectsCard({
|
|
529
761
|
client,
|
|
530
762
|
projects,
|
|
763
|
+
hiddenProjectIds,
|
|
531
764
|
ready,
|
|
532
765
|
openProject,
|
|
533
766
|
openProjects,
|
|
534
767
|
onProjectCreated
|
|
535
768
|
}) {
|
|
536
|
-
const [
|
|
537
|
-
const [creating, setCreating] =
|
|
769
|
+
const [result, setResult] = React2.useState(() => previousProjects.get(client));
|
|
770
|
+
const [creating, setCreating] = React2.useState(false);
|
|
538
771
|
const catalogKey = JSON.stringify(projects);
|
|
539
|
-
|
|
772
|
+
const hiddenKey = JSON.stringify(hiddenProjectIds ?? []);
|
|
773
|
+
const resultKey = JSON.stringify([catalogKey, hiddenKey]);
|
|
774
|
+
React2.useEffect(() => {
|
|
540
775
|
if (!ready || !client.config.studioInstance) return;
|
|
541
776
|
let active = true;
|
|
542
777
|
void client.invoke(
|
|
543
778
|
{ instanceId: client.config.studioInstance, operationId: "global.query" },
|
|
544
779
|
{
|
|
545
780
|
source: "projects",
|
|
546
|
-
sql:
|
|
781
|
+
sql: projectListSql,
|
|
547
782
|
params: [],
|
|
548
783
|
catalog: JSON.parse(catalogKey),
|
|
784
|
+
...hiddenKey !== "[]" && { excludeProjectIds: JSON.parse(hiddenKey) },
|
|
549
785
|
limit: 5,
|
|
550
786
|
timeoutMs: 8e3,
|
|
551
787
|
offset: 0
|
|
552
788
|
}
|
|
553
789
|
).then(
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
try {
|
|
560
|
-
const { item } = await client.invoke(
|
|
561
|
-
{ instanceId: client.config.studioInstance, operationId: "global.asset" },
|
|
562
|
-
{ ref }
|
|
563
|
-
);
|
|
564
|
-
return {
|
|
565
|
-
...row,
|
|
566
|
-
previewUrl: item.previewUrl ?? null,
|
|
567
|
-
previewKind: item.kind ?? null
|
|
568
|
-
};
|
|
569
|
-
} catch {
|
|
570
|
-
return row;
|
|
571
|
-
}
|
|
572
|
-
})
|
|
573
|
-
);
|
|
574
|
-
if (active) setRows(next);
|
|
790
|
+
({ items }) => {
|
|
791
|
+
if (!active) return;
|
|
792
|
+
const result2 = { catalogKey: resultKey, rows: items };
|
|
793
|
+
previousProjects.set(client, result2);
|
|
794
|
+
setResult(result2);
|
|
575
795
|
},
|
|
576
796
|
() => {
|
|
577
|
-
if (active)
|
|
797
|
+
if (!active) return;
|
|
798
|
+
previousProjects.delete(client);
|
|
799
|
+
setResult({ catalogKey: resultKey, rows: [] });
|
|
578
800
|
}
|
|
579
801
|
);
|
|
580
802
|
return () => {
|
|
581
803
|
active = false;
|
|
582
804
|
};
|
|
583
|
-
}, [client, ready, catalogKey]);
|
|
584
|
-
const
|
|
805
|
+
}, [client, ready, catalogKey, hiddenKey]);
|
|
806
|
+
const current = resultKey === result?.catalogKey ? result : void 0;
|
|
807
|
+
const pending = Boolean(client.config.studioInstance) && (!ready || !current);
|
|
808
|
+
const list = current?.rows ?? [];
|
|
585
809
|
const entries = (list.length ? list.map((row) => projects.find(({ id }) => id === row.projectId)).filter((entry) => !!entry) : projects.slice(0, 5)).map((project) => {
|
|
586
810
|
const row = list.find((entry) => entry.projectId === project.id);
|
|
587
811
|
return {
|
|
@@ -593,35 +817,36 @@ function ProjectsCard({
|
|
|
593
817
|
open: () => openProject(project.id)
|
|
594
818
|
};
|
|
595
819
|
});
|
|
596
|
-
return /* @__PURE__ */
|
|
597
|
-
/* @__PURE__ */
|
|
598
|
-
/* @__PURE__ */
|
|
599
|
-
/* @__PURE__ */
|
|
820
|
+
return /* @__PURE__ */ jsxs2("section", { className: "studio-home-panel", "aria-label": "Project List", children: [
|
|
821
|
+
/* @__PURE__ */ jsxs2("header", { children: [
|
|
822
|
+
/* @__PURE__ */ jsx2("h2", { children: "Project List" }),
|
|
823
|
+
/* @__PURE__ */ jsx2(
|
|
600
824
|
Button,
|
|
601
825
|
{
|
|
602
|
-
label: "View all",
|
|
826
|
+
label: ready ? `View all ${projects.length}` : "View all",
|
|
603
827
|
"aria-label": "View all project list",
|
|
604
|
-
|
|
605
|
-
variant: "text-tonal-sm",
|
|
828
|
+
variant: "text-link-sm",
|
|
606
829
|
onClick: openProjects
|
|
607
830
|
}
|
|
608
831
|
)
|
|
609
832
|
] }),
|
|
610
|
-
/* @__PURE__ */
|
|
611
|
-
/* @__PURE__ */
|
|
833
|
+
/* @__PURE__ */ jsxs2("div", { className: "studio-home-grid", children: [
|
|
834
|
+
/* @__PURE__ */ jsxs2(
|
|
612
835
|
"button",
|
|
613
836
|
{
|
|
614
837
|
type: "button",
|
|
615
838
|
className: "studio-home-tile studio-home-create",
|
|
616
839
|
onClick: () => setCreating(true),
|
|
617
840
|
children: [
|
|
618
|
-
/* @__PURE__ */
|
|
619
|
-
/* @__PURE__ */
|
|
620
|
-
|
|
841
|
+
/* @__PURE__ */ jsx2("span", { className: "studio-home-cover", "aria-hidden": "true", children: /* @__PURE__ */ jsx2("span", { children: /* @__PURE__ */ jsx2(Icon, { name: "add" }) }) }),
|
|
842
|
+
/* @__PURE__ */ jsxs2("span", { className: "studio-home-caption", children: [
|
|
843
|
+
/* @__PURE__ */ jsx2("strong", { children: "Create Project" }),
|
|
844
|
+
/* @__PURE__ */ jsx2("small", { children: "Create a local project" })
|
|
845
|
+
] })
|
|
621
846
|
]
|
|
622
847
|
}
|
|
623
848
|
),
|
|
624
|
-
entries.map(({ key, row, name, note, enabled, open }) => /* @__PURE__ */
|
|
849
|
+
entries.map(({ key, row, name, note, enabled, open }) => /* @__PURE__ */ jsxs2(
|
|
625
850
|
"button",
|
|
626
851
|
{
|
|
627
852
|
type: "button",
|
|
@@ -629,15 +854,29 @@ function ProjectsCard({
|
|
|
629
854
|
onClick: open,
|
|
630
855
|
disabled: !enabled,
|
|
631
856
|
children: [
|
|
632
|
-
/* @__PURE__ */
|
|
633
|
-
|
|
634
|
-
|
|
857
|
+
/* @__PURE__ */ jsx2(
|
|
858
|
+
ProjectCover,
|
|
859
|
+
{
|
|
860
|
+
client,
|
|
861
|
+
row,
|
|
862
|
+
pending: enabled && pending
|
|
863
|
+
},
|
|
864
|
+
JSON.stringify([
|
|
865
|
+
client.config.studioInstance,
|
|
866
|
+
row?.available,
|
|
867
|
+
row?.previewRef ?? row?.coverRef
|
|
868
|
+
])
|
|
869
|
+
),
|
|
870
|
+
/* @__PURE__ */ jsxs2("span", { className: "studio-home-caption", children: [
|
|
871
|
+
/* @__PURE__ */ jsx2("strong", { title: name, children: name }),
|
|
872
|
+
note && /* @__PURE__ */ jsx2("small", { children: note })
|
|
873
|
+
] })
|
|
635
874
|
]
|
|
636
875
|
},
|
|
637
876
|
key
|
|
638
877
|
))
|
|
639
878
|
] }),
|
|
640
|
-
creating && /* @__PURE__ */
|
|
879
|
+
creating && /* @__PURE__ */ jsx2(
|
|
641
880
|
NewProjectDialog,
|
|
642
881
|
{
|
|
643
882
|
client,
|
|
@@ -655,7 +894,35 @@ function activate(client) {
|
|
|
655
894
|
id: "projects",
|
|
656
895
|
title: "Project List",
|
|
657
896
|
kind: "component",
|
|
658
|
-
component: (props) => /* @__PURE__ */
|
|
897
|
+
component: (props) => /* @__PURE__ */ jsx2(ProjectsCard, { ...props, client })
|
|
898
|
+
});
|
|
899
|
+
client.registerUI({
|
|
900
|
+
id: "create-project",
|
|
901
|
+
title: "Create Project",
|
|
902
|
+
kind: "component",
|
|
903
|
+
component: function ProjectCreator(props) {
|
|
904
|
+
const [open, setOpen] = React2.useState(false);
|
|
905
|
+
if ("close" in props) return /* @__PURE__ */ jsx2(NewProjectDialog, { client, ...props });
|
|
906
|
+
return /* @__PURE__ */ jsxs2(Fragment2, { children: [
|
|
907
|
+
/* @__PURE__ */ jsx2(
|
|
908
|
+
Button,
|
|
909
|
+
{
|
|
910
|
+
label: "Create Project",
|
|
911
|
+
variant: "text-filled-sm",
|
|
912
|
+
width: "hug",
|
|
913
|
+
onClick: () => setOpen(true)
|
|
914
|
+
}
|
|
915
|
+
),
|
|
916
|
+
open && /* @__PURE__ */ jsx2(
|
|
917
|
+
NewProjectDialog,
|
|
918
|
+
{
|
|
919
|
+
client,
|
|
920
|
+
close: () => setOpen(false),
|
|
921
|
+
onCreated: (project) => props.onProjectCreated?.(project)
|
|
922
|
+
}
|
|
923
|
+
)
|
|
924
|
+
] });
|
|
925
|
+
}
|
|
659
926
|
});
|
|
660
927
|
}
|
|
661
928
|
export {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vivix-labs/dashboard-projects",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.9",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public",
|
|
@@ -18,5 +18,8 @@
|
|
|
18
18
|
"vivix-studio": ">=2.2.0",
|
|
19
19
|
"react": "^19.0.0",
|
|
20
20
|
"react-dom": "^19.0.0"
|
|
21
|
+
},
|
|
22
|
+
"devDependencies": {
|
|
23
|
+
"@vivix-labs/project-studio": "workspace:*"
|
|
21
24
|
}
|
|
22
|
-
}
|
|
25
|
+
}
|