@vivix-labs/dashboard-projects 1.0.0-beta → 1.0.0-beta.11
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/Inter-LICENSE.txt +93 -0
- package/dist/client-code.css +41 -230
- package/dist/client-code.js +796 -360
- package/package.json +5 -1
- package/dist/assets/hero-base-5KRPU5WN.png +0 -0
- package/dist/assets/hero-landscape-H35LYO4H.png +0 -0
- package/dist/assets/inria-serif-latin-700-italic-UNRIXGAH.woff2 +0 -0
- /package/dist/{UI-SYSTEM-LICENSE.txt → UI-LICENSE.txt} +0 -0
package/dist/client-code.js
CHANGED
|
@@ -1,17 +1,380 @@
|
|
|
1
1
|
// packages/dashboard-projects/src/client.tsx
|
|
2
|
-
import "react";
|
|
3
|
-
|
|
4
|
-
// packages/studio-workbench/src/dashboard-card.tsx
|
|
5
2
|
import * as React2 from "react";
|
|
6
|
-
import { z as
|
|
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";
|
|
7
|
+
import { z } from "vivix-studio/sdk/shared";
|
|
8
|
+
var creditsFormat = new Intl.NumberFormat("en-US", {
|
|
9
|
+
minimumFractionDigits: 1,
|
|
10
|
+
maximumFractionDigits: 1,
|
|
11
|
+
useGrouping: false
|
|
12
|
+
});
|
|
13
|
+
var fixedRef = z.object({ storeId: z.uuid(), objectId: z.uuid(), versionId: z.uuid() }).strict();
|
|
14
|
+
var copy = z.string().max(8e3).default("");
|
|
15
|
+
var clipScript = z.object({
|
|
16
|
+
title: z.string().trim().min(1).max(200),
|
|
17
|
+
visual: copy,
|
|
18
|
+
voiceover: copy,
|
|
19
|
+
onScreenText: copy,
|
|
20
|
+
cta: copy,
|
|
21
|
+
plannedDurationMs: z.number().int().positive().nullable().default(null)
|
|
22
|
+
}).strict();
|
|
23
|
+
var adBrief = z.object({
|
|
24
|
+
product: copy,
|
|
25
|
+
category: copy,
|
|
26
|
+
audience: copy,
|
|
27
|
+
sellingPoints: copy,
|
|
28
|
+
channel: copy,
|
|
29
|
+
aspectRatio: z.string().max(40).nullable().default(null),
|
|
30
|
+
targetDurationMs: z.number().int().positive().nullable().default(null),
|
|
31
|
+
body: copy,
|
|
32
|
+
productRefs: z.array(fixedRef).max(100).default([]),
|
|
33
|
+
modelRefs: z.array(fixedRef).max(100).default([])
|
|
34
|
+
}).strict();
|
|
35
|
+
var adFilm = z.object({
|
|
36
|
+
title: z.string().trim().min(1).max(150),
|
|
37
|
+
source: fixedRef,
|
|
38
|
+
width: z.number().int().positive().max(8192),
|
|
39
|
+
height: z.number().int().positive().max(8192),
|
|
40
|
+
aspectRatio: z.string().regex(/^\d+:\d+$/)
|
|
41
|
+
}).strict();
|
|
42
|
+
var adStoryboard = z.object({
|
|
43
|
+
brief: adBrief,
|
|
44
|
+
films: z.array(adFilm).max(100).optional(),
|
|
45
|
+
clips: z.array(
|
|
46
|
+
z.object({
|
|
47
|
+
assetId: z.uuid(),
|
|
48
|
+
filmId: z.uuid().optional(),
|
|
49
|
+
script: clipScript,
|
|
50
|
+
edits: z.array(z.object({ sourceVersionId: z.uuid(), editRef: fixedRef }).strict()).max(200)
|
|
51
|
+
}).strict()
|
|
52
|
+
).max(200)
|
|
53
|
+
}).strict().superRefine((value, context) => {
|
|
54
|
+
if (new Set(value.clips.map((c) => c.assetId)).size !== value.clips.length)
|
|
55
|
+
context.addIssue({ code: "custom", message: "A clip can appear only once in a storyboard." });
|
|
56
|
+
for (const clip of value.clips)
|
|
57
|
+
if (new Set(clip.edits.map((e) => e.sourceVersionId)).size !== clip.edits.length)
|
|
58
|
+
context.addIssue({
|
|
59
|
+
code: "custom",
|
|
60
|
+
message: "Each candidate has one current edit binding."
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
var projectType = z2.enum(["short-drama", "product-ad", "other"]);
|
|
64
|
+
var studioConfig = z2.object({
|
|
65
|
+
role: z2.enum(["project", "coordinator"]).default("project"),
|
|
66
|
+
projectType: projectType.optional(),
|
|
67
|
+
dataInstance: z2.string().min(1).default("user:data"),
|
|
68
|
+
apiInstance: z2.string().min(1).default("api"),
|
|
69
|
+
libraryInstance: z2.string().min(1).nullable().default(null),
|
|
70
|
+
coordinatorInstance: z2.string().min(1).optional()
|
|
71
|
+
}).strict();
|
|
72
|
+
var versionRef = z2.object({ storeId: z2.uuid(), objectId: z2.uuid(), versionId: z2.uuid() }).strict();
|
|
73
|
+
var tags = z2.array(z2.string().trim().min(1).max(64)).max(50).transform((x) => [...new Set(x)]).default([]);
|
|
74
|
+
var kind = z2.enum(["text", "image", "video", "audio", "file"]);
|
|
75
|
+
var projectData = z2.object({
|
|
76
|
+
name: z2.string().trim().min(1).max(120),
|
|
77
|
+
description: z2.string().max(4e3).default(""),
|
|
78
|
+
status: z2.enum(["draft", "active", "archived"]).default("draft"),
|
|
79
|
+
aspectRatio: z2.string().nullable().default(null),
|
|
80
|
+
projectType: projectType.optional(),
|
|
81
|
+
coverRef: versionRef.nullable().default(null),
|
|
82
|
+
briefRef: z2.object({ storeId: z2.uuid(), objectId: z2.uuid() }).strict().nullable().default(null),
|
|
83
|
+
tags
|
|
84
|
+
}).strict();
|
|
85
|
+
var assetData = z2.object({
|
|
86
|
+
projectId: z2.uuid(),
|
|
87
|
+
name: z2.string().trim().min(1).max(200),
|
|
88
|
+
kind,
|
|
89
|
+
purpose: z2.enum(["reference", "script", "shot", "music", "voice", "subtitle", "final", "other"]).default("other"),
|
|
90
|
+
origin: z2.enum(["upload", "library", "generated", "authored"]),
|
|
91
|
+
orderKey: z2.number().int().nullable().default(null),
|
|
92
|
+
tags,
|
|
93
|
+
lifecycle: z2.enum(["draft", "ready", "archived"]).default("draft"),
|
|
94
|
+
sourceRef: versionRef.nullable().default(null),
|
|
95
|
+
adoptedVersionId: z2.uuid().nullable().default(null)
|
|
96
|
+
}).strict();
|
|
97
|
+
var anchor = z2.discriminatedUnion("kind", [
|
|
98
|
+
z2.object({ kind: z2.literal("whole") }).strict(),
|
|
99
|
+
z2.object({
|
|
100
|
+
kind: z2.literal("timeRange"),
|
|
101
|
+
startMs: z2.number().int().nonnegative(),
|
|
102
|
+
endMs: z2.number().int().nonnegative()
|
|
103
|
+
}).strict()
|
|
104
|
+
]);
|
|
105
|
+
var generationInput = z2.object({
|
|
106
|
+
targetAssetId: z2.uuid().optional(),
|
|
107
|
+
taskName: z2.string().trim().min(1).max(200).optional(),
|
|
108
|
+
context: z2.record(z2.string().min(1).max(64), z2.string().min(1).max(200)).optional(),
|
|
109
|
+
expectedRevision: z2.number().int().positive().optional(),
|
|
110
|
+
newAsset: z2.object({
|
|
111
|
+
name: z2.string().trim().min(1).max(200),
|
|
112
|
+
kind: z2.enum(["image", "video", "audio"])
|
|
113
|
+
}).strict().optional(),
|
|
114
|
+
modelId: z2.string().min(1),
|
|
115
|
+
capabilityId: z2.string().min(1),
|
|
116
|
+
prompt: z2.string().max(32e3),
|
|
117
|
+
parameters: z2.record(z2.string(), z2.unknown()).default({}),
|
|
118
|
+
outputCount: z2.number().int().min(1).max(100).default(1),
|
|
119
|
+
inputs: z2.array(
|
|
120
|
+
z2.object({
|
|
121
|
+
ref: versionRef,
|
|
122
|
+
role: z2.string().min(1),
|
|
123
|
+
order: z2.number().int().nonnegative(),
|
|
124
|
+
weight: z2.number().finite().nullable().default(null)
|
|
125
|
+
}).strict()
|
|
126
|
+
).max(100).default([]),
|
|
127
|
+
baseVersionId: z2.uuid().optional(),
|
|
128
|
+
changeRequest: z2.string().trim().min(1).max(4e3).optional(),
|
|
129
|
+
preserveRequest: z2.string().max(4e3).default(""),
|
|
130
|
+
anchor: anchor.default({ kind: "whole" }),
|
|
131
|
+
retryOfTaskId: z2.uuid().optional(),
|
|
132
|
+
acknowledgeUnknown: z2.boolean().optional()
|
|
133
|
+
}).strict();
|
|
134
|
+
var projectSettingsInput = z2.object({
|
|
135
|
+
projectId: z2.uuid(),
|
|
136
|
+
expectedRevision: z2.number().int().positive(),
|
|
137
|
+
changes: projectData.pick({ name: true, description: true, tags: true, aspectRatio: true, coverRef: true }).extend({
|
|
138
|
+
description: projectData.shape.description.unwrap(),
|
|
139
|
+
tags: projectData.shape.tags.unwrap(),
|
|
140
|
+
aspectRatio: projectData.shape.aspectRatio.unwrap(),
|
|
141
|
+
coverRef: projectData.shape.coverRef.unwrap()
|
|
142
|
+
}).partial().strict()
|
|
143
|
+
}).strict();
|
|
144
|
+
var generationSubmitOperation = defineOperation({
|
|
145
|
+
id: "generation.submit",
|
|
146
|
+
title: "Generate",
|
|
147
|
+
description: "Submit one media generation without approval, retaining its paid request identity.",
|
|
148
|
+
input: generationInput,
|
|
149
|
+
output: z2.any(),
|
|
150
|
+
effects: ["write", "paid"],
|
|
151
|
+
confirm: "none"
|
|
152
|
+
});
|
|
153
|
+
var favoriteData = z2.object({ ref: versionRef }).strict();
|
|
154
|
+
var sqlScalar = z2.union([z2.string(), z2.number().finite(), z2.null()]);
|
|
155
|
+
var globalQueryInput = z2.object({
|
|
156
|
+
sql: z2.string().trim().min(1),
|
|
157
|
+
params: z2.union([z2.array(sqlScalar), z2.record(z2.string(), sqlScalar)]).optional(),
|
|
158
|
+
timeoutMs: z2.number().int().positive().optional(),
|
|
159
|
+
maxRows: z2.number().int().positive().optional(),
|
|
160
|
+
limit: z2.number().int().min(1).max(200).optional(),
|
|
161
|
+
offset: z2.number().int().nonnegative().optional(),
|
|
162
|
+
source: z2.enum(["projects", "assets", "tasks"]),
|
|
163
|
+
excludeProjectIds: z2.array(z2.uuid()).optional(),
|
|
164
|
+
catalog: z2.array(z2.object({ id: z2.string().min(1), name: z2.string(), available: z2.boolean() }).strict()).optional()
|
|
165
|
+
}).strict();
|
|
166
|
+
var projectListSql = "SELECT rowId, projectId, name, available, createdAt, coverRef FROM studio_projects ORDER BY createdAt DESC, rowId ASC";
|
|
7
167
|
|
|
8
168
|
// packages/ui-system/dist/button.js
|
|
9
169
|
import { jsx as _jsx2, jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
170
|
|
|
11
171
|
// packages/ui-system/dist/icon.js
|
|
12
172
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
173
|
+
var iconGeometry = {
|
|
174
|
+
add: {
|
|
175
|
+
width: 16,
|
|
176
|
+
height: 16,
|
|
177
|
+
slot: 16
|
|
178
|
+
},
|
|
179
|
+
check: {
|
|
180
|
+
width: 12,
|
|
181
|
+
height: 12,
|
|
182
|
+
slot: 12
|
|
183
|
+
},
|
|
184
|
+
"check-on-content": {
|
|
185
|
+
width: 12,
|
|
186
|
+
height: 12,
|
|
187
|
+
slot: 12
|
|
188
|
+
},
|
|
189
|
+
"chevron-up": {
|
|
190
|
+
width: 12,
|
|
191
|
+
height: 12,
|
|
192
|
+
slot: 12
|
|
193
|
+
},
|
|
194
|
+
expand: {
|
|
195
|
+
width: 16,
|
|
196
|
+
height: 16,
|
|
197
|
+
slot: 16
|
|
198
|
+
},
|
|
199
|
+
"chevron-down": {
|
|
200
|
+
width: 12,
|
|
201
|
+
height: 12,
|
|
202
|
+
slot: 12
|
|
203
|
+
},
|
|
204
|
+
clear: {
|
|
205
|
+
width: 14.5332,
|
|
206
|
+
height: 14.5332,
|
|
207
|
+
slot: 16
|
|
208
|
+
},
|
|
209
|
+
grid: {
|
|
210
|
+
width: 13.2039,
|
|
211
|
+
height: 13.2,
|
|
212
|
+
slot: 16
|
|
213
|
+
},
|
|
214
|
+
list: {
|
|
215
|
+
width: 13.3372,
|
|
216
|
+
height: 12.0039,
|
|
217
|
+
slot: 16
|
|
218
|
+
},
|
|
219
|
+
search: {
|
|
220
|
+
width: 13.2,
|
|
221
|
+
height: 13.2,
|
|
222
|
+
slot: 16
|
|
223
|
+
},
|
|
224
|
+
calendar: {
|
|
225
|
+
width: 16,
|
|
226
|
+
height: 16,
|
|
227
|
+
slot: 16
|
|
228
|
+
},
|
|
229
|
+
import: {
|
|
230
|
+
width: 16,
|
|
231
|
+
height: 16,
|
|
232
|
+
slot: 16
|
|
233
|
+
},
|
|
234
|
+
magic: {
|
|
235
|
+
width: 14.0625,
|
|
236
|
+
height: 15.5625,
|
|
237
|
+
slot: 18
|
|
238
|
+
},
|
|
239
|
+
"select-items": { width: 13.8681, height: 13.8667, slot: 16 },
|
|
240
|
+
trim: { width: 14.85, height: 14.85, slot: 16 },
|
|
241
|
+
crop: { width: 16.25, height: 16.25, slot: 16 },
|
|
242
|
+
filter: { width: 13.2, height: 13.2, slot: 16 },
|
|
243
|
+
select: {
|
|
244
|
+
width: 14.6298,
|
|
245
|
+
height: 16.065,
|
|
246
|
+
slot: 18
|
|
247
|
+
},
|
|
248
|
+
area: {
|
|
249
|
+
width: 16.125,
|
|
250
|
+
height: 16.125,
|
|
251
|
+
slot: 18
|
|
252
|
+
},
|
|
253
|
+
draw: {
|
|
254
|
+
width: 16.125,
|
|
255
|
+
height: 16.125,
|
|
256
|
+
slot: 18
|
|
257
|
+
},
|
|
258
|
+
close: {
|
|
259
|
+
width: 18,
|
|
260
|
+
height: 18,
|
|
261
|
+
slot: 18
|
|
262
|
+
},
|
|
263
|
+
reset: {
|
|
264
|
+
width: 16.35,
|
|
265
|
+
height: 16.35,
|
|
266
|
+
slot: 18
|
|
267
|
+
},
|
|
268
|
+
more: {
|
|
269
|
+
width: 16,
|
|
270
|
+
height: 16,
|
|
271
|
+
slot: 16
|
|
272
|
+
},
|
|
273
|
+
play: {
|
|
274
|
+
width: 12.381,
|
|
275
|
+
height: 13.2143,
|
|
276
|
+
slot: 20
|
|
277
|
+
},
|
|
278
|
+
pause: {
|
|
279
|
+
width: 14.1905,
|
|
280
|
+
height: 14.1905,
|
|
281
|
+
slot: 20
|
|
282
|
+
},
|
|
283
|
+
mute: {
|
|
284
|
+
width: 17.5239,
|
|
285
|
+
height: 14.1922,
|
|
286
|
+
slot: 20
|
|
287
|
+
},
|
|
288
|
+
volume: {
|
|
289
|
+
width: 17.5239,
|
|
290
|
+
height: 14.1922,
|
|
291
|
+
slot: 20
|
|
292
|
+
},
|
|
293
|
+
fullscreen: {
|
|
294
|
+
width: 20,
|
|
295
|
+
height: 20,
|
|
296
|
+
slot: 20
|
|
297
|
+
},
|
|
298
|
+
"placeholder-image": {
|
|
299
|
+
width: 20,
|
|
300
|
+
height: 20,
|
|
301
|
+
slot: 20
|
|
302
|
+
},
|
|
303
|
+
"placeholder-video": {
|
|
304
|
+
width: 17.9199,
|
|
305
|
+
height: 16.2506,
|
|
306
|
+
slot: 20
|
|
307
|
+
},
|
|
308
|
+
"placeholder-audio": {
|
|
309
|
+
width: 17.5017,
|
|
310
|
+
height: 17.4992,
|
|
311
|
+
slot: 20
|
|
312
|
+
},
|
|
313
|
+
"placeholder-script": {
|
|
314
|
+
width: 17.0834,
|
|
315
|
+
height: 17.0837,
|
|
316
|
+
slot: 20
|
|
317
|
+
},
|
|
318
|
+
export: {
|
|
319
|
+
width: 11.8667,
|
|
320
|
+
height: 13.2,
|
|
321
|
+
slot: 16
|
|
322
|
+
},
|
|
323
|
+
favorite: { width: 11.8667, height: 14.5333, slot: 16 },
|
|
324
|
+
download: { width: 13.2001, height: 13.1997, slot: 16 },
|
|
325
|
+
delete: { width: 13.2, height: 14.533, slot: 16 },
|
|
326
|
+
edit: {
|
|
327
|
+
width: 10.8791,
|
|
328
|
+
height: 12.0459,
|
|
329
|
+
slot: 14
|
|
330
|
+
},
|
|
331
|
+
"play-cover": {
|
|
332
|
+
width: 12.9167,
|
|
333
|
+
height: 13.7501,
|
|
334
|
+
slot: 20
|
|
335
|
+
},
|
|
336
|
+
"playback-play": {
|
|
337
|
+
width: 13.29564,
|
|
338
|
+
height: 14.1905,
|
|
339
|
+
slot: 20
|
|
340
|
+
},
|
|
341
|
+
"playback-play-large": {
|
|
342
|
+
width: 15.95477,
|
|
343
|
+
height: 17.0286,
|
|
344
|
+
slot: 24
|
|
345
|
+
},
|
|
346
|
+
"pause-large": {
|
|
347
|
+
width: 17.0286,
|
|
348
|
+
height: 17.0286,
|
|
349
|
+
slot: 24
|
|
350
|
+
},
|
|
351
|
+
"volume-large": {
|
|
352
|
+
width: 21.02868,
|
|
353
|
+
height: 17.03064,
|
|
354
|
+
slot: 24
|
|
355
|
+
},
|
|
356
|
+
"mute-large": {
|
|
357
|
+
width: 21.0286,
|
|
358
|
+
height: 17.0307,
|
|
359
|
+
slot: 24
|
|
360
|
+
},
|
|
361
|
+
"fullscreen-large": {
|
|
362
|
+
width: 24,
|
|
363
|
+
height: 24,
|
|
364
|
+
slot: 24
|
|
365
|
+
}
|
|
366
|
+
};
|
|
13
367
|
function Icon({ name, size }) {
|
|
14
|
-
|
|
368
|
+
const geometry = iconGeometry[name];
|
|
369
|
+
const style = {
|
|
370
|
+
...geometry && {
|
|
371
|
+
"--vx-icon-native-size": `${geometry.slot}px`,
|
|
372
|
+
"--vx-icon-width": `${geometry.width / geometry.slot * 100}%`,
|
|
373
|
+
"--vx-icon-height": `${geometry.height / geometry.slot * 100}%`
|
|
374
|
+
},
|
|
375
|
+
...size === void 0 ? {} : { "--vx-icon-size": `${size}px` }
|
|
376
|
+
};
|
|
377
|
+
return _jsx("span", { "aria-hidden": "true", className: "vx-icon", "data-icon": name, style });
|
|
15
378
|
}
|
|
16
379
|
|
|
17
380
|
// packages/ui-system/dist/button-variants.js
|
|
@@ -20,6 +383,9 @@ var buttonVariants = {
|
|
|
20
383
|
"text-filled-leading-sm": { size: 32, appearance: "filled", shape: "text" },
|
|
21
384
|
"text-ghost-sm": { size: 32, appearance: "ghost", shape: "text" },
|
|
22
385
|
"text-on-content-sm": { size: 32, appearance: "on-content", shape: "text" },
|
|
386
|
+
"text-plain-sm": { size: 32, appearance: "plain", shape: "text" },
|
|
387
|
+
"text-link-sm": { size: 32, appearance: "link", shape: "text" },
|
|
388
|
+
"text-outline-sm": { size: 32, appearance: "outline", shape: "text" },
|
|
23
389
|
"text-tonal-sm": { size: 32, appearance: "tonal", shape: "text" },
|
|
24
390
|
// The medium recipes are shared by all dialog footer actions.
|
|
25
391
|
"text-filled-md": { size: 40, appearance: "filled", shape: "text" },
|
|
@@ -54,444 +420,464 @@ function ButtonFrame({ label, variant, loading = false, width, children, disable
|
|
|
54
420
|
const buttonStyle = "width" in spec ? { ...style, "--vx-button-width": `${spec.width}px` } : style;
|
|
55
421
|
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" })] });
|
|
56
422
|
}
|
|
57
|
-
function Button({ variant = "text-filled-sm", leadingIcon, trailingIcon, ...props }) {
|
|
58
|
-
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 }) })] });
|
|
423
|
+
function Button({ variant = "text-filled-sm", leadingIcon, trailingIcon, badge, ...props }) {
|
|
424
|
+
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 }) })] });
|
|
59
425
|
}
|
|
60
426
|
function IconButton({ icon, variant = "icon-ghost-sm", ...props }) {
|
|
61
427
|
return _jsx2(ButtonFrame, { ...props, variant, children: _jsx2(Icon, { name: icon }) });
|
|
62
428
|
}
|
|
63
429
|
|
|
430
|
+
// packages/ui-system/dist/cover-preview.js
|
|
431
|
+
import { jsx as _jsx3 } from "react/jsx-runtime";
|
|
432
|
+
import { useState } from "react";
|
|
433
|
+
function CoverPreview(props) {
|
|
434
|
+
return _jsx3(Preview, { ...props }, JSON.stringify([props.kind, props.src]));
|
|
435
|
+
}
|
|
436
|
+
function Preview({ className, ref, kind: kind2 = "image", src, pending, iconSize = 20, children }) {
|
|
437
|
+
const [mediaState, setMediaState] = useState("loading");
|
|
438
|
+
const media = src && (kind2 === "image" || kind2 === "video");
|
|
439
|
+
const state = pending ? "loading" : media ? mediaState : children ? "ready" : "empty";
|
|
440
|
+
const iconKind = kind2 === "video" || kind2 === "audio" ? kind2 : kind2 === "text" ? "script" : "image";
|
|
441
|
+
const ready = () => setMediaState("ready");
|
|
442
|
+
const failed = () => setMediaState("empty");
|
|
443
|
+
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 });
|
|
444
|
+
}
|
|
445
|
+
|
|
64
446
|
// packages/ui-system/dist/segmented-control.js
|
|
65
|
-
import { jsx as
|
|
447
|
+
import { jsx as _jsx4, jsxs as _jsxs2 } from "react/jsx-runtime";
|
|
66
448
|
import { useId } from "react";
|
|
67
449
|
function SegmentedControl({ label, items, value, onValueChange, size = "medium", width = "fixed", iconOnly = false }) {
|
|
68
450
|
const id = useId();
|
|
69
|
-
return
|
|
451
|
+
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)) });
|
|
70
452
|
}
|
|
71
453
|
|
|
72
454
|
// packages/ui-system/dist/input.js
|
|
73
|
-
import { jsx as
|
|
74
|
-
function TextInput({ label, value, onValueChange, size = "medium", ...props }) {
|
|
75
|
-
return _jsxs3("label", { className: "vx-field", "data-size": size, children: [
|
|
455
|
+
import { jsx as _jsx5, jsxs as _jsxs3 } from "react/jsx-runtime";
|
|
456
|
+
function TextInput({ label, value, onValueChange, size = "medium", appearance = "default", placeholder, ...props }) {
|
|
457
|
+
return _jsxs3("label", { className: "vx-field", "data-size": size, "data-appearance": appearance, children: [_jsx5("span", { children: label }), _jsx5("input", { ...props, type: "text", placeholder: placeholder ?? (props.readOnly ? void 0 : "Enter text"), value, onChange: (event) => onValueChange(event.currentTarget.value) })] });
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
// packages/ui-system/dist/dialog.js
|
|
461
|
+
import { jsx as _jsx6, jsxs as _jsxs4, Fragment as _Fragment } from "react/jsx-runtime";
|
|
462
|
+
import { useId as useId2, useLayoutEffect, useRef, useState as useState2 } from "react";
|
|
463
|
+
import { createPortal } from "react-dom";
|
|
464
|
+
|
|
465
|
+
// packages/ui-system/dist/dialog-surface.js
|
|
466
|
+
var overlayOpeningEvent = "vx-overlay-opening";
|
|
467
|
+
function outerDialogDocument(anchor2) {
|
|
468
|
+
const source = anchor2.ownerDocument;
|
|
469
|
+
try {
|
|
470
|
+
const target = source.defaultView?.top?.document;
|
|
471
|
+
return target && target !== source ? target : void 0;
|
|
472
|
+
} catch {
|
|
473
|
+
return void 0;
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
function createDialogSurface(anchor2) {
|
|
477
|
+
const source = anchor2.ownerDocument;
|
|
478
|
+
const target = outerDialogDocument(anchor2);
|
|
479
|
+
if (!target)
|
|
480
|
+
return void 0;
|
|
481
|
+
const host = target.createElement("div");
|
|
482
|
+
host.dataset.studioDialogSurface = "";
|
|
483
|
+
const shadow = host.attachShadow({ mode: "open" });
|
|
484
|
+
shadow.addEventListener("beforetoggle", (event) => {
|
|
485
|
+
if (event.newState === "open" && !event.target.classList.contains("vx-toast"))
|
|
486
|
+
target.dispatchEvent(new Event(overlayOpeningEvent));
|
|
487
|
+
}, true);
|
|
488
|
+
for (const original of source.querySelectorAll('link[rel="stylesheet"], style')) {
|
|
489
|
+
const clone = original.cloneNode(true);
|
|
490
|
+
if (original.tagName === "LINK")
|
|
491
|
+
clone.setAttribute("href", original.href);
|
|
492
|
+
shadow.append(clone);
|
|
493
|
+
}
|
|
494
|
+
const theme = anchor2.closest("[data-vx-theme]");
|
|
495
|
+
const root = target.createElement("div");
|
|
496
|
+
root.dataset.vxTheme = theme?.dataset.vxTheme ?? "light";
|
|
497
|
+
root.className = theme?.className ?? "";
|
|
498
|
+
root.style.display = "contents";
|
|
499
|
+
const style = source.defaultView.getComputedStyle(anchor2);
|
|
500
|
+
for (const name of style)
|
|
501
|
+
if (name.startsWith("--"))
|
|
502
|
+
root.style.setProperty(name, style.getPropertyValue(name));
|
|
503
|
+
shadow.append(root);
|
|
504
|
+
let container = root;
|
|
505
|
+
const ancestors = [];
|
|
506
|
+
for (let parent = anchor2.parentElement; parent && parent !== theme; parent = parent.parentElement)
|
|
507
|
+
ancestors.unshift(parent);
|
|
508
|
+
for (const original of ancestors) {
|
|
509
|
+
const wrapper = target.createElement("div");
|
|
510
|
+
wrapper.className = original.className;
|
|
511
|
+
for (const { name, value } of original.attributes)
|
|
512
|
+
if (name.startsWith("data-"))
|
|
513
|
+
wrapper.setAttribute(name, value);
|
|
514
|
+
wrapper.style.display = "contents";
|
|
515
|
+
container.append(wrapper);
|
|
516
|
+
container = wrapper;
|
|
517
|
+
}
|
|
518
|
+
target.body.append(host);
|
|
519
|
+
return { root: container, dispose: () => host.remove() };
|
|
76
520
|
}
|
|
77
521
|
|
|
78
522
|
// packages/ui-system/dist/dialog.js
|
|
79
|
-
|
|
80
|
-
import { useEffect, useId as useId2, useLayoutEffect, useRef } from "react";
|
|
81
|
-
function Dialog({ title, open, onOpenChange, children, actions, className }) {
|
|
523
|
+
function Dialog({ title, open, onOpenChange, children, actions, className, inlineWhenClosed = false, variant = "default", closeOnEscape = true, focusTitleOnOpen = variant === "welcome" }) {
|
|
82
524
|
const ref = useRef(null);
|
|
525
|
+
const anchor2 = useRef(null);
|
|
526
|
+
const [surface, setSurface] = useState2();
|
|
83
527
|
const heading = useId2();
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
if (!dialog || dialog.open === open)
|
|
528
|
+
useLayoutEffect(() => {
|
|
529
|
+
if (inlineWhenClosed || !open || !anchor2.current)
|
|
87
530
|
return;
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
531
|
+
const mounted = createDialogSurface(anchor2.current);
|
|
532
|
+
const active = anchor2.current.getRootNode().activeElement;
|
|
533
|
+
setSurface(mounted?.root ?? null);
|
|
534
|
+
return () => {
|
|
535
|
+
mounted?.dispose();
|
|
536
|
+
setSurface(void 0);
|
|
537
|
+
queueMicrotask(() => {
|
|
538
|
+
if (active?.isConnected)
|
|
539
|
+
active.focus();
|
|
540
|
+
});
|
|
541
|
+
};
|
|
542
|
+
}, [open, inlineWhenClosed]);
|
|
93
543
|
useLayoutEffect(() => {
|
|
94
|
-
const
|
|
544
|
+
const dialog2 = ref.current;
|
|
545
|
+
if (inlineWhenClosed && dialog2) {
|
|
546
|
+
if (open) {
|
|
547
|
+
dialog2.close();
|
|
548
|
+
dialog2.showModal();
|
|
549
|
+
} else {
|
|
550
|
+
if (dialog2.matches(":modal"))
|
|
551
|
+
dialog2.close();
|
|
552
|
+
dialog2.open = true;
|
|
553
|
+
}
|
|
554
|
+
return;
|
|
555
|
+
}
|
|
556
|
+
if (!open || surface === void 0 || !dialog2)
|
|
557
|
+
return;
|
|
558
|
+
dialog2.showModal();
|
|
95
559
|
return () => {
|
|
96
|
-
if (
|
|
97
|
-
|
|
560
|
+
if (dialog2.open)
|
|
561
|
+
dialog2.close();
|
|
98
562
|
};
|
|
99
|
-
}, []);
|
|
100
|
-
|
|
563
|
+
}, [open, surface, inlineWhenClosed]);
|
|
564
|
+
const welcome = variant === "welcome";
|
|
565
|
+
const closeButton = _jsx6(IconButton, { icon: "close", label: "Close dialog", onClick: () => onOpenChange(false) });
|
|
566
|
+
const dialog = _jsxs4("dialog", { ref, open: inlineWhenClosed || void 0, className: inlineWhenClosed && !open ? "vx-dialog vx-dialog-inline" : className ? `vx-dialog ${className}` : "vx-dialog", "data-variant": variant === "default" ? void 0 : variant, role: inlineWhenClosed && !open ? "presentation" : void 0, "aria-labelledby": inlineWhenClosed && !open ? void 0 : heading, onCancel: (event) => {
|
|
101
567
|
event.preventDefault();
|
|
102
568
|
event.stopPropagation();
|
|
103
|
-
|
|
569
|
+
if (closeOnEscape)
|
|
570
|
+
onOpenChange(false);
|
|
104
571
|
}, onClose: (event) => {
|
|
105
|
-
if (open && !event.currentTarget.open)
|
|
572
|
+
if (open && event.currentTarget.isConnected && !event.currentTarget.open)
|
|
106
573
|
onOpenChange(false);
|
|
107
|
-
}, children: [_jsxs4("header", { children: [
|
|
574
|
+
}, children: [_jsxs4("header", { hidden: inlineWhenClosed && !open, 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", { hidden: inlineWhenClosed && !open, children: [actions, welcome && closeButton] })] });
|
|
575
|
+
return _jsxs4(_Fragment, { children: [_jsx6("span", { ref: anchor2, hidden: true }), (open || inlineWhenClosed) && (surface ? createPortal(dialog, surface) : dialog)] });
|
|
108
576
|
}
|
|
109
577
|
|
|
110
|
-
// packages/
|
|
111
|
-
import
|
|
112
|
-
|
|
113
|
-
var columnName = z.string().min(1).max(200).refine((value) => !/[\u0000-\u001f]/.test(value));
|
|
114
|
-
var scalar = z.union([z.null(), z.string(), z.number().finite()]);
|
|
115
|
-
var customViewSchema = z.object({
|
|
116
|
-
source: z.enum(pageSources),
|
|
117
|
-
projectId: z.uuid().optional(),
|
|
118
|
-
name: z.string().trim().min(1).max(120),
|
|
119
|
-
sql: z.string().trim().min(1).max(32e3),
|
|
120
|
-
params: z.union([z.array(scalar), z.record(z.string(), scalar)]).default([]),
|
|
121
|
-
columns: z.array(
|
|
122
|
-
z.object({
|
|
123
|
-
path: columnName,
|
|
124
|
-
label: z.string().min(1).max(120).optional(),
|
|
125
|
-
width: z.number().int().min(80).max(600).default(140),
|
|
126
|
-
visible: z.boolean().default(true),
|
|
127
|
-
format: z.enum(["text", "categories", "date", "json"]).default("text"),
|
|
128
|
-
role: z.enum(["name", "preview", "state", "project"]).optional()
|
|
129
|
-
}).strict()
|
|
130
|
-
).min(1).max(60).refine(
|
|
131
|
-
(columns) => new Set(columns.map((c) => c.path)).size === columns.length,
|
|
132
|
-
"Column names must be unique."
|
|
133
|
-
),
|
|
134
|
-
identity: z.object({
|
|
135
|
-
row: columnName.default("rowId"),
|
|
136
|
-
project: columnName.default("projectId"),
|
|
137
|
-
ref: columnName.default("ref"),
|
|
138
|
-
outputs: columnName.default("outputRefs")
|
|
139
|
-
}).strict().default({ row: "rowId", project: "projectId", ref: "ref", outputs: "outputRefs" })
|
|
140
|
-
}).strict();
|
|
141
|
-
var column = (path, label, width = 140, extra = {}) => ({ path, label, width, visible: true, format: "text", ...extra });
|
|
142
|
-
function defaultSql(source, favorites = false) {
|
|
143
|
-
if (source === "projects")
|
|
144
|
-
return "SELECT * FROM studio_projects ORDER BY createdAt DESC, rowId ASC";
|
|
145
|
-
const table = favorites ? "studio_asset_versions" : `studio_${source}`;
|
|
146
|
-
return `SELECT a.*, p.name AS projectName, p.available AS projectAvailable FROM ${table} AS a LEFT JOIN studio_projects AS p ON p.projectId = a.projectId${favorites ? " WHERE a.favorite = 1" : ""} ORDER BY a.createdAt DESC, a.rowId ASC`;
|
|
147
|
-
}
|
|
148
|
-
function defaultView(source) {
|
|
149
|
-
const columns = source === "projects" ? [
|
|
150
|
-
column("previewUrl", "Preview", 120, { role: "preview" }),
|
|
151
|
-
column("name", "Project title", 260, { role: "name" }),
|
|
152
|
-
column("assetCount", "Assets", 120),
|
|
153
|
-
column("available", "Available", 120),
|
|
154
|
-
column("createdAt", "Created Time", 160, { format: "date" })
|
|
155
|
-
] : source === "assets" ? [
|
|
156
|
-
column("previewUrl", "Preview", 120, { role: "preview" }),
|
|
157
|
-
column("name", "Asset", 240, { role: "name" }),
|
|
158
|
-
column("kind", "Format", 100),
|
|
159
|
-
column("prompt", "Prompt", 280),
|
|
160
|
-
column("projectName", "Project", 180, { role: "project" }),
|
|
161
|
-
column("modelId", "Model", 160),
|
|
162
|
-
column("createdAt", "Created Time", 160, { format: "date" }),
|
|
163
|
-
column("purpose", "Purpose", 140, { visible: false })
|
|
164
|
-
] : [
|
|
165
|
-
column("previewUrl", "Preview", 120, { role: "preview" }),
|
|
166
|
-
column("name", "Task", 260, { role: "name" }),
|
|
167
|
-
column("state", "Status", 180, { role: "state" }),
|
|
168
|
-
column("costLabel", "Actual cost", 180),
|
|
169
|
-
column("kind", "Format", 100),
|
|
170
|
-
column("prompt", "Prompt", 280),
|
|
171
|
-
column("projectName", "Project", 200, { role: "project" }),
|
|
172
|
-
column("modelId", "Model", 160),
|
|
173
|
-
column("createdAt", "Created Time", 160, { format: "date" })
|
|
174
|
-
];
|
|
175
|
-
return {
|
|
176
|
-
id: `default:${source}`,
|
|
177
|
-
revision: 0,
|
|
178
|
-
view: customViewSchema.parse({
|
|
179
|
-
source,
|
|
180
|
-
name: "All",
|
|
181
|
-
sql: defaultSql(source),
|
|
182
|
-
columns
|
|
183
|
-
})
|
|
184
|
-
};
|
|
185
|
-
}
|
|
186
|
-
function decodeRef(value) {
|
|
187
|
-
let item = value;
|
|
188
|
-
if (typeof item === "string") {
|
|
189
|
-
try {
|
|
190
|
-
item = JSON.parse(item);
|
|
191
|
-
} catch {
|
|
192
|
-
return null;
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
if (!item || typeof item !== "object" || Array.isArray(item)) return null;
|
|
196
|
-
const ref = item;
|
|
197
|
-
return ["storeId", "objectId", "versionId"].every(
|
|
198
|
-
(key) => typeof ref[key] === "string" && /^[0-9a-f-]{36}$/i.test(ref[key])
|
|
199
|
-
) ? {
|
|
200
|
-
storeId: ref.storeId,
|
|
201
|
-
objectId: ref.objectId,
|
|
202
|
-
versionId: ref.versionId
|
|
203
|
-
} : null;
|
|
204
|
-
}
|
|
205
|
-
function rowRef(row, view) {
|
|
206
|
-
return decodeRef(row[view.identity.ref]);
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
// packages/studio-workbench/src/text-preview.ts
|
|
210
|
-
async function readTextPreview(response, signal, maxBytes = 128 * 1024) {
|
|
211
|
-
if (!response.ok || !response.body) throw Error("The text preview could not be loaded.");
|
|
212
|
-
const reader = response.body.getReader();
|
|
213
|
-
const decoder = new TextDecoder();
|
|
214
|
-
let text = "", used = 0, truncated = false;
|
|
215
|
-
const cancel = () => {
|
|
216
|
-
void reader.cancel(signal.reason).catch(() => void 0);
|
|
217
|
-
};
|
|
218
|
-
signal.addEventListener("abort", cancel, { once: true });
|
|
219
|
-
try {
|
|
220
|
-
while (true) {
|
|
221
|
-
signal.throwIfAborted();
|
|
222
|
-
const chunk = await reader.read();
|
|
223
|
-
signal.throwIfAborted();
|
|
224
|
-
if (chunk.done) break;
|
|
225
|
-
const remaining = maxBytes - used;
|
|
226
|
-
text += decoder.decode(chunk.value.subarray(0, remaining), { stream: true });
|
|
227
|
-
used += Math.min(remaining, chunk.value.byteLength);
|
|
228
|
-
if (chunk.value.byteLength > remaining) {
|
|
229
|
-
truncated = true;
|
|
230
|
-
break;
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
text += decoder.decode();
|
|
234
|
-
return { text, truncated };
|
|
235
|
-
} finally {
|
|
236
|
-
signal.removeEventListener("abort", cancel);
|
|
237
|
-
await reader.cancel().catch(() => void 0);
|
|
238
|
-
reader.releaseLock();
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
// packages/studio-workbench/src/studio-glyph.tsx
|
|
243
|
-
import "react";
|
|
244
|
-
import { jsx } from "react/jsx-runtime";
|
|
245
|
-
var paths = {
|
|
246
|
-
projects: [
|
|
247
|
-
"M6.66803 5.83333H10.0023M10.0023 5.83333H13.9617C15.7177 5.83333 16.5958 5.83333 17.2265 6.25466C17.4995 6.43706 17.734 6.67143 17.9164 6.94441C18.2448 7.43568 18.3173 8.07703 18.3333 9.16667M10.0023 5.83333L9.47426 4.7776C9.03683 3.90298 8.63709 3.0226 7.66768 2.65917C7.2431 2.5 6.75807 2.5 5.78802 2.5C4.27388 2.5 3.51681 2.5 2.94874 2.81693C2.54379 3.04285 2.20966 3.37689 1.98368 3.78172C1.66667 4.34964 1.66667 5.1065 1.66667 6.62023V9.16667C1.66667 13.095 1.66667 15.0592 2.88739 16.2796C4.10811 17.5 6.07283 17.5 10.0023 17.5",
|
|
248
|
-
"M15 16.4773C16.4728 16.4773 17.6667 15.2562 17.6667 13.75C17.6667 12.2438 16.4728 11.0227 15 11.0227M15 16.4773C13.5272 16.4773 12.3333 15.2562 12.3333 13.75C12.3333 12.2438 13.5272 11.0227 15 11.0227M15 16.4773V17.5M15 11.0227V10M12.5761 12.2624L11.667 11.7045M18.3333 15.7955L17.4243 15.2376M17.4239 12.2624L18.333 11.7045M11.6667 15.7955L12.5757 15.2376"
|
|
249
|
-
],
|
|
250
|
-
assets: [
|
|
251
|
-
"M2.5 2.5H17.5C17.9602 2.5 18.3333 2.8731 18.3333 3.33333V5.83333C18.3333 6.29357 17.9602 6.66667 17.5 6.66667H2.5C2.03976 6.66667 1.66667 6.29357 1.66667 5.83333V3.33333C1.66667 2.8731 2.03976 2.5 2.5 2.5Z",
|
|
252
|
-
"M3.33333 6.66667V15.8333C3.33333 16.2754 3.50893 16.6993 3.82149 17.0118C4.13405 17.3244 4.55797 17.5 5 17.5H15C15.442 17.5 15.866 17.3244 16.1785 17.0118C16.4911 16.6993 16.6667 16.2754 16.6667 15.8333V6.66667",
|
|
253
|
-
"M8.33333 10H11.6667"
|
|
254
|
-
],
|
|
255
|
-
tasks: [
|
|
256
|
-
"M15.75 7.41667C15.75 8.58344 15.75 9.16683 15.5229 9.61248C15.3232 10.0045 15.0045 10.3232 14.6125 10.5229C14.1668 10.75 13.5834 10.75 12.4167 10.75H4.08333C2.91656 10.75 2.33317 10.75 1.88752 10.5229C1.49552 10.3232 1.17681 10.0045 0.977071 9.61248C0.750001 9.16683 0.750001 8.58344 0.750001 7.41667",
|
|
257
|
-
"M3.25 7.41667H13.25M3.25 4.08333H13.25M3.25 0.75H13.25"
|
|
258
|
-
],
|
|
259
|
-
panel: [
|
|
260
|
-
"M2.08333 10C2.08333 6.26805 2.08333 4.40207 3.2427 3.2427C4.40207 2.08333 6.26805 2.08333 10 2.08333C13.7319 2.08333 15.5979 2.08333 16.7573 3.2427C17.9167 4.40207 17.9167 6.26805 17.9167 10C17.9167 13.7319 17.9167 15.5979 16.7573 16.7573C15.5979 17.9167 13.7319 17.9167 10 17.9167C6.26805 17.9167 4.40207 17.9167 3.2427 16.7573C2.08333 15.5979 2.08333 13.7319 2.08333 10Z",
|
|
261
|
-
"M7.06381 6.69231L7.09951 13.3523"
|
|
262
|
-
],
|
|
263
|
-
favorite: [
|
|
264
|
-
"M0.600003 5.73835V11.2539C0.600003 12.7911 0.600003 13.5597 1.11523 13.8349C2.11298 14.3676 3.98454 12.5901 4.87334 12.0549C5.38881 11.7446 5.64654 11.5894 5.93334 11.5894C6.22013 11.5894 6.47787 11.7446 6.99333 12.0549C7.88214 12.5901 9.75369 14.3676 10.7514 13.8349C11.2667 13.5597 11.2667 12.7911 11.2667 11.2539V5.73835C11.2667 3.31611 11.2667 2.10499 10.4856 1.3525C9.70457 0.600001 8.44749 0.600001 5.93334 0.600001C3.41918 0.600001 2.1621 0.600001 1.38105 1.3525C0.600003 2.10499 0.600003 3.31611 0.600003 5.73835Z"
|
|
265
|
-
]
|
|
266
|
-
};
|
|
267
|
-
function StudioGlyph({ name }) {
|
|
268
|
-
return /* @__PURE__ */ jsx(
|
|
269
|
-
"svg",
|
|
270
|
-
{
|
|
271
|
-
className: "studio-glyph",
|
|
272
|
-
"aria-hidden": "true",
|
|
273
|
-
width: "20",
|
|
274
|
-
height: "20",
|
|
275
|
-
viewBox: name === "tasks" ? "0 0 16.5 11.5" : name === "favorite" ? "0 0 11.8667 14.5333" : "0 0 20 20",
|
|
276
|
-
fill: "none",
|
|
277
|
-
stroke: "currentColor",
|
|
278
|
-
strokeWidth: name === "favorite" ? 1.2 : 1.5,
|
|
279
|
-
strokeLinecap: "round",
|
|
280
|
-
strokeLinejoin: "round",
|
|
281
|
-
children: paths[name].map((d, index) => /* @__PURE__ */ jsx("path", { d }, index))
|
|
282
|
-
}
|
|
283
|
-
);
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
// packages/studio-workbench/src/dashboard-card.tsx
|
|
287
|
-
import { Fragment, jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
288
|
-
var Config = z2.object({ studioInstance: z2.string().min(1).nullable().default(null) });
|
|
289
|
-
var dashboardAssetsSql = `SELECT a.* FROM studio_assets AS a
|
|
290
|
-
ORDER BY (json_extract(a.metadata, '$.homeFeatured') IS NOT NULL) DESC,
|
|
291
|
-
ROW_NUMBER() OVER (
|
|
292
|
-
PARTITION BY a.projectId, a.kind, a.purpose ORDER BY a.createdAt DESC, a.rowId ASC
|
|
293
|
-
), a.createdAt DESC, a.rowId ASC`;
|
|
294
|
-
function featuredRole(row) {
|
|
295
|
-
const metadata = row?.metadata;
|
|
296
|
-
return metadata && typeof metadata === "object" && "homeFeatured" in metadata ? metadata.homeFeatured : void 0;
|
|
297
|
-
}
|
|
298
|
-
function sampleAssets(items) {
|
|
299
|
-
const chosen = /* @__PURE__ */ new Set();
|
|
300
|
-
for (const [role, kind, purpose] of [
|
|
301
|
-
["character", "image", "reference"],
|
|
302
|
-
["video", "video", "shot"],
|
|
303
|
-
["scene", "image", "shot"],
|
|
304
|
-
["script", "text", "script"],
|
|
305
|
-
["audio", "audio", "voice"]
|
|
306
|
-
]) {
|
|
307
|
-
const asset = items.find((row) => featuredRole(row) === role && row.kind === kind) ?? items.find((row) => row.kind === kind && row.purpose === purpose && !chosen.has(row));
|
|
308
|
-
if (asset) chosen.add(asset);
|
|
309
|
-
}
|
|
310
|
-
for (const row of items) if (row.kind !== "text" || row.purpose === "script") chosen.add(row);
|
|
311
|
-
return [...chosen].slice(0, 5);
|
|
312
|
-
}
|
|
578
|
+
// packages/dashboard-projects/src/create-project-dialog.tsx
|
|
579
|
+
import * as React from "react";
|
|
580
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
313
581
|
var projectTypes = [
|
|
314
582
|
{
|
|
315
583
|
value: "short-drama",
|
|
316
584
|
label: "Short Drama",
|
|
317
585
|
preset: "@vivix-labs/short-drama-workbench:short-drama"
|
|
318
586
|
},
|
|
319
|
-
{ value: "ads", label: "Product Ad", preset: "@vivix-labs/
|
|
320
|
-
{ value: "table", label: "
|
|
587
|
+
{ value: "ads", label: "Product Ad", preset: "@vivix-labs/ads-workbench:ads" },
|
|
588
|
+
{ value: "table", label: "Others", preset: "@vivix-labs/studio-workbench:table" }
|
|
321
589
|
];
|
|
322
|
-
function NewProjectDialog({
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
590
|
+
function NewProjectDialog({
|
|
591
|
+
client,
|
|
592
|
+
close,
|
|
593
|
+
onCreated
|
|
594
|
+
}) {
|
|
595
|
+
const [type, setType] = React.useState(projectTypes[0].value);
|
|
596
|
+
const [name, setName] = React.useState("");
|
|
597
|
+
const [status, setStatus] = React.useState("");
|
|
598
|
+
const [presets, setPresets] = React.useState();
|
|
599
|
+
const [busy, setBusy] = React.useState(false);
|
|
600
|
+
const request = React.useRef(void 0);
|
|
601
|
+
React.useEffect(() => {
|
|
602
|
+
let active = true;
|
|
603
|
+
if (!client.projects?.presets || !client.projects.create) {
|
|
604
|
+
setStatus("Update Studio CLI to create projects from Home.");
|
|
605
|
+
return;
|
|
606
|
+
}
|
|
607
|
+
void client.projects.presets().then(
|
|
608
|
+
(items) => {
|
|
609
|
+
if (active) setPresets(items);
|
|
610
|
+
},
|
|
611
|
+
(error) => {
|
|
612
|
+
if (active) setStatus(error.message);
|
|
613
|
+
}
|
|
614
|
+
);
|
|
615
|
+
return () => {
|
|
616
|
+
active = false;
|
|
617
|
+
};
|
|
618
|
+
}, [client]);
|
|
326
619
|
const selection = projectTypes.find((item) => item.value === type);
|
|
327
620
|
const placeholder = type === "table" ? "Untitled Project" : "Untitled " + selection.label;
|
|
328
|
-
const
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
621
|
+
const [packageName, presetId] = selection.preset.split(":");
|
|
622
|
+
const preset = [packageName, packageName.replace("@vivix-labs/", "@vivix-studio/")].flatMap(
|
|
623
|
+
(name2) => presets?.filter(
|
|
624
|
+
(item) => item.spec.startsWith(name2 + "@") && item.spec.endsWith(":" + presetId)
|
|
625
|
+
) ?? []
|
|
626
|
+
)[0];
|
|
627
|
+
async function create() {
|
|
628
|
+
if (!preset || !client.projects?.create || busy) return;
|
|
629
|
+
const input = {
|
|
630
|
+
name: name.trim() || placeholder,
|
|
631
|
+
preset: preset.spec,
|
|
632
|
+
trust: true,
|
|
633
|
+
allowAccess: [...preset.requiredAccess]
|
|
634
|
+
};
|
|
635
|
+
const intent = JSON.stringify(input);
|
|
636
|
+
if (request.current?.intent !== intent) request.current = { intent, id: crypto.randomUUID() };
|
|
637
|
+
setBusy(true);
|
|
638
|
+
setStatus("");
|
|
639
|
+
try {
|
|
640
|
+
const project = await client.projects.create({ ...input, requestId: request.current.id });
|
|
641
|
+
onCreated(project);
|
|
642
|
+
close();
|
|
643
|
+
} catch (error) {
|
|
644
|
+
setStatus(error instanceof Error ? error.message : String(error));
|
|
645
|
+
} finally {
|
|
646
|
+
setBusy(false);
|
|
647
|
+
}
|
|
648
|
+
}
|
|
649
|
+
return /* @__PURE__ */ jsx(
|
|
333
650
|
Dialog,
|
|
334
651
|
{
|
|
335
|
-
title: "Create
|
|
652
|
+
title: "Create Projects",
|
|
336
653
|
open: true,
|
|
654
|
+
variant: "create-project",
|
|
337
655
|
className: "studio-home-dialog",
|
|
338
|
-
onOpenChange: (open) => !open && close(),
|
|
656
|
+
onOpenChange: (open) => !open && !busy && close(),
|
|
339
657
|
actions: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
340
|
-
/* @__PURE__ */
|
|
341
|
-
/* @__PURE__ */ jsx2(
|
|
658
|
+
/* @__PURE__ */ jsx(
|
|
342
659
|
Button,
|
|
343
660
|
{
|
|
344
|
-
label: "
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
661
|
+
label: "Cancel",
|
|
662
|
+
variant: "text-tonal-lg",
|
|
663
|
+
width: "hug",
|
|
664
|
+
disabled: busy,
|
|
665
|
+
onClick: close
|
|
666
|
+
}
|
|
667
|
+
),
|
|
668
|
+
/* @__PURE__ */ jsx(
|
|
669
|
+
Button,
|
|
670
|
+
{
|
|
671
|
+
label: busy ? "Creating\u2026" : "Create Project",
|
|
672
|
+
variant: "text-filled-lg",
|
|
673
|
+
width: "hug",
|
|
674
|
+
disabled: busy || !preset,
|
|
675
|
+
onClick: () => void create()
|
|
353
676
|
}
|
|
354
677
|
)
|
|
355
678
|
] }),
|
|
356
679
|
children: /* @__PURE__ */ jsxs("div", { className: "studio-home-create-form", children: [
|
|
357
|
-
/* @__PURE__ */
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
680
|
+
/* @__PURE__ */ jsxs("div", { className: "studio-home-create-field", children: [
|
|
681
|
+
/* @__PURE__ */ jsx("span", { children: "Project type" }),
|
|
682
|
+
/* @__PURE__ */ jsx(
|
|
683
|
+
SegmentedControl,
|
|
684
|
+
{
|
|
685
|
+
label: "Project type",
|
|
686
|
+
size: "large",
|
|
687
|
+
width: "full",
|
|
688
|
+
value: type,
|
|
689
|
+
items: projectTypes.map((item) => ({ ...item, disabled: busy })),
|
|
690
|
+
onValueChange: setType
|
|
691
|
+
}
|
|
692
|
+
)
|
|
693
|
+
] }),
|
|
694
|
+
/* @__PURE__ */ jsx(
|
|
368
695
|
TextInput,
|
|
369
696
|
{
|
|
370
697
|
label: "Project name",
|
|
698
|
+
size: "large",
|
|
371
699
|
value: name,
|
|
372
700
|
onValueChange: setName,
|
|
373
701
|
maxLength: 100,
|
|
374
|
-
|
|
702
|
+
disabled: busy,
|
|
703
|
+
placeholder: "Enter project name"
|
|
375
704
|
}
|
|
376
705
|
),
|
|
377
|
-
/* @__PURE__ */
|
|
378
|
-
|
|
379
|
-
|
|
706
|
+
presets && !preset && /* @__PURE__ */ jsxs("p", { role: "alert", children: [
|
|
707
|
+
"Install the ",
|
|
708
|
+
selection.label,
|
|
709
|
+
" preset to create this project."
|
|
710
|
+
] }),
|
|
711
|
+
status && /* @__PURE__ */ jsx("p", { role: "alert", children: status })
|
|
380
712
|
] })
|
|
381
713
|
}
|
|
382
714
|
);
|
|
383
715
|
}
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
716
|
+
|
|
717
|
+
// packages/dashboard-projects/src/client.tsx
|
|
718
|
+
import { Fragment as Fragment2, jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
719
|
+
var Config = z3.object({ studioInstance: z3.string().min(1).nullable().default(null) });
|
|
720
|
+
var dependencies = (config) => config.studioInstance ? [config.studioInstance] : [];
|
|
721
|
+
function decodeRef(value) {
|
|
722
|
+
let item = value;
|
|
723
|
+
if (typeof item === "string") {
|
|
724
|
+
try {
|
|
725
|
+
item = JSON.parse(item);
|
|
726
|
+
} catch {
|
|
727
|
+
return null;
|
|
728
|
+
}
|
|
729
|
+
}
|
|
730
|
+
if (!item || typeof item !== "object" || Array.isArray(item)) return null;
|
|
731
|
+
const ref = item;
|
|
732
|
+
return ["storeId", "objectId", "versionId"].every(
|
|
733
|
+
(key) => typeof ref[key] === "string" && /^[0-9a-f-]{36}$/i.test(ref[key])
|
|
734
|
+
) ? {
|
|
735
|
+
storeId: ref.storeId,
|
|
736
|
+
objectId: ref.objectId,
|
|
737
|
+
versionId: ref.versionId
|
|
738
|
+
} : null;
|
|
739
|
+
}
|
|
740
|
+
var projectPreviews = /* @__PURE__ */ new WeakMap();
|
|
741
|
+
function ProjectCover({
|
|
742
|
+
client,
|
|
743
|
+
row,
|
|
744
|
+
pending
|
|
745
|
+
}) {
|
|
746
|
+
const ref = decodeRef(row?.available ? row.previewRef ?? row.coverRef : void 0);
|
|
747
|
+
const instanceId = client.config.studioInstance;
|
|
748
|
+
const key = ref && JSON.stringify([instanceId, ref.storeId, ref.objectId, ref.versionId]);
|
|
749
|
+
const cached = key ? projectPreviews.get(client)?.get(key) : void 0;
|
|
750
|
+
const [resolved, setResolved] = React2.useState();
|
|
389
751
|
React2.useEffect(() => {
|
|
390
|
-
if (!
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
752
|
+
if (!ref || !instanceId || !key || cached) return;
|
|
753
|
+
let active = true;
|
|
754
|
+
void client.invoke({ instanceId, operationId: "global.asset" }, { ref }).then(
|
|
755
|
+
({ item }) => {
|
|
756
|
+
if (!active) return;
|
|
757
|
+
if (item.previewUrl) {
|
|
758
|
+
const previews = projectPreviews.get(client) ?? /* @__PURE__ */ new Map();
|
|
759
|
+
previews.set(key, item);
|
|
760
|
+
if (previews.size > 64) previews.delete(previews.keys().next().value);
|
|
761
|
+
projectPreviews.set(client, previews);
|
|
762
|
+
}
|
|
763
|
+
setResolved(item);
|
|
764
|
+
},
|
|
765
|
+
() => {
|
|
766
|
+
if (active) setResolved(null);
|
|
767
|
+
}
|
|
768
|
+
);
|
|
769
|
+
return () => {
|
|
770
|
+
active = false;
|
|
771
|
+
};
|
|
772
|
+
}, [client, instanceId, key, cached]);
|
|
773
|
+
const preview = cached ?? resolved;
|
|
774
|
+
const src = preview?.previewUrl ?? row?.previewUrl;
|
|
775
|
+
return /* @__PURE__ */ jsx2(
|
|
776
|
+
CoverPreview,
|
|
777
|
+
{
|
|
778
|
+
className: "studio-home-cover",
|
|
779
|
+
src: typeof src === "string" ? src : void 0,
|
|
780
|
+
kind: String(preview?.kind ?? row?.previewKind ?? "image"),
|
|
781
|
+
pending: pending || Boolean(instanceId && ref && preview === void 0)
|
|
782
|
+
}
|
|
783
|
+
);
|
|
397
784
|
}
|
|
398
|
-
|
|
785
|
+
var previousProjects = /* @__PURE__ */ new WeakMap();
|
|
786
|
+
function ProjectsCard({
|
|
399
787
|
client,
|
|
400
788
|
projects,
|
|
789
|
+
hiddenProjectIds,
|
|
790
|
+
projectCovers,
|
|
401
791
|
ready,
|
|
402
|
-
source,
|
|
403
|
-
title,
|
|
404
792
|
openProject,
|
|
405
793
|
openProjects,
|
|
406
|
-
|
|
794
|
+
onProjectCreated
|
|
407
795
|
}) {
|
|
408
|
-
const [
|
|
796
|
+
const [result, setResult] = React2.useState(() => previousProjects.get(client));
|
|
409
797
|
const [creating, setCreating] = React2.useState(false);
|
|
798
|
+
const grid = React2.useRef(null);
|
|
799
|
+
const [columns, setColumns] = React2.useState(1);
|
|
800
|
+
React2.useLayoutEffect(() => {
|
|
801
|
+
const element = grid.current;
|
|
802
|
+
if (!element) return;
|
|
803
|
+
const measure = () => setColumns(getComputedStyle(element).gridTemplateColumns.split(" ").length);
|
|
804
|
+
measure();
|
|
805
|
+
const observer = new ResizeObserver(measure);
|
|
806
|
+
observer.observe(element);
|
|
807
|
+
return () => observer.disconnect();
|
|
808
|
+
}, []);
|
|
410
809
|
const catalogKey = JSON.stringify(projects);
|
|
411
|
-
const
|
|
810
|
+
const hiddenKey = JSON.stringify(hiddenProjectIds ?? []);
|
|
811
|
+
const resultKey = JSON.stringify([catalogKey, hiddenKey]);
|
|
412
812
|
React2.useEffect(() => {
|
|
413
|
-
|
|
813
|
+
const instanceId = client.config.studioInstance;
|
|
814
|
+
if (!ready || !instanceId) return;
|
|
414
815
|
let active = true;
|
|
415
|
-
|
|
416
|
-
{ instanceId
|
|
816
|
+
const loadProjects = (countColumn) => client.invoke(
|
|
817
|
+
{ instanceId, operationId: "global.query" },
|
|
417
818
|
{
|
|
418
|
-
source,
|
|
419
|
-
sql:
|
|
420
|
-
params:
|
|
819
|
+
source: "projects",
|
|
820
|
+
sql: projectListSql.replace("SELECT ", `SELECT ${countColumn} AS cardAssetCount, `),
|
|
821
|
+
params: [],
|
|
421
822
|
catalog: JSON.parse(catalogKey),
|
|
422
|
-
|
|
823
|
+
...hiddenKey !== "[]" && { excludeProjectIds: JSON.parse(hiddenKey) },
|
|
824
|
+
limit: 5,
|
|
423
825
|
timeoutMs: 8e3,
|
|
424
826
|
offset: 0
|
|
425
827
|
}
|
|
426
|
-
)
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
const { item } = await client.invoke(
|
|
434
|
-
{ instanceId: client.config.studioInstance, operationId: "global.asset" },
|
|
435
|
-
{ ref }
|
|
436
|
-
);
|
|
437
|
-
return {
|
|
438
|
-
...row,
|
|
439
|
-
previewUrl: item.previewUrl ?? null,
|
|
440
|
-
previewKind: item.kind ?? null
|
|
441
|
-
};
|
|
442
|
-
} catch {
|
|
443
|
-
return row;
|
|
444
|
-
}
|
|
445
|
-
})
|
|
446
|
-
) : sampleAssets(items);
|
|
447
|
-
if (active) setState({ rows: rows2 });
|
|
828
|
+
);
|
|
829
|
+
void loadProjects("savedAssetCount").catch(() => loadProjects("assetCount")).then(
|
|
830
|
+
({ items }) => {
|
|
831
|
+
if (!active) return;
|
|
832
|
+
const result2 = { catalogKey: resultKey, rows: items };
|
|
833
|
+
previousProjects.set(client, result2);
|
|
834
|
+
setResult(result2);
|
|
448
835
|
},
|
|
449
836
|
() => {
|
|
450
|
-
if (active)
|
|
837
|
+
if (!active) return;
|
|
838
|
+
previousProjects.delete(client);
|
|
839
|
+
setResult({ catalogKey: resultKey, rows: [] });
|
|
451
840
|
}
|
|
452
841
|
);
|
|
453
842
|
return () => {
|
|
454
843
|
active = false;
|
|
455
844
|
};
|
|
456
|
-
}, [client, ready, catalogKey,
|
|
457
|
-
const
|
|
458
|
-
const
|
|
459
|
-
|
|
845
|
+
}, [client, ready, catalogKey, hiddenKey]);
|
|
846
|
+
const current = resultKey === result?.catalogKey ? result : void 0;
|
|
847
|
+
const pending = Boolean(client.config.studioInstance) && (!ready || !current);
|
|
848
|
+
const list = current?.rows ?? [];
|
|
849
|
+
const entries = (list.length ? list.map((row) => projects.find(({ id }) => id === row.projectId)).filter((entry) => !!entry) : projects.slice(0, 5)).map((project) => {
|
|
850
|
+
const row = list.find((entry) => entry.projectId === project.id);
|
|
851
|
+
const cover = projectCovers?.get(project.id);
|
|
852
|
+
const previewRow = {
|
|
853
|
+
...row,
|
|
854
|
+
available: project.available,
|
|
855
|
+
coverRef: cover ? { ...cover } : row?.coverRef ?? null
|
|
856
|
+
};
|
|
460
857
|
return {
|
|
461
858
|
key: project.id,
|
|
462
|
-
row,
|
|
859
|
+
row: previewRow,
|
|
463
860
|
name: String(row?.name ?? project.name),
|
|
464
|
-
note: row?.
|
|
861
|
+
note: typeof row?.cardAssetCount === "number" ? `${row.cardAssetCount} ${row.cardAssetCount === 1 ? "asset" : "assets"}` : "",
|
|
465
862
|
enabled: project.available,
|
|
466
863
|
open: () => openProject(project.id)
|
|
467
864
|
};
|
|
468
|
-
}) : rows.map((row) => {
|
|
469
|
-
const ref = rowRef(row, view);
|
|
470
|
-
return {
|
|
471
|
-
key: String(row.rowId),
|
|
472
|
-
row,
|
|
473
|
-
name: String(row.name ?? "Asset"),
|
|
474
|
-
note: featuredRole(row) === "character" ? "Character \xB7 Turnaround" : row.purpose === "script" ? "Script" : String(row.kind ?? "").replace(/^./, (first) => first.toUpperCase()),
|
|
475
|
-
enabled: !!ref,
|
|
476
|
-
open: () => ref && openAssets(ref)
|
|
477
|
-
};
|
|
478
865
|
});
|
|
479
|
-
return /* @__PURE__ */
|
|
480
|
-
/* @__PURE__ */
|
|
481
|
-
/* @__PURE__ */ jsx2("h2", { children:
|
|
866
|
+
return /* @__PURE__ */ jsxs2("section", { className: "studio-home-panel", "aria-label": "Project List", children: [
|
|
867
|
+
/* @__PURE__ */ jsxs2("header", { children: [
|
|
868
|
+
/* @__PURE__ */ jsx2("h2", { children: "Project List" }),
|
|
482
869
|
/* @__PURE__ */ jsx2(
|
|
483
870
|
Button,
|
|
484
871
|
{
|
|
485
|
-
label: "View all",
|
|
486
|
-
"aria-label": "View all "
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
onClick: source === "projects" ? openProjects : () => openAssets()
|
|
872
|
+
label: ready ? `View all ${projects.length}` : "View all",
|
|
873
|
+
"aria-label": "View all project list",
|
|
874
|
+
variant: "text-link-sm",
|
|
875
|
+
onClick: openProjects
|
|
490
876
|
}
|
|
491
877
|
)
|
|
492
878
|
] }),
|
|
493
|
-
|
|
494
|
-
|
|
879
|
+
/* @__PURE__ */ jsxs2("div", { className: "studio-home-grid", ref: grid, children: [
|
|
880
|
+
/* @__PURE__ */ jsxs2(
|
|
495
881
|
"button",
|
|
496
882
|
{
|
|
497
883
|
type: "button",
|
|
@@ -499,12 +885,14 @@ function DataCard({
|
|
|
499
885
|
onClick: () => setCreating(true),
|
|
500
886
|
children: [
|
|
501
887
|
/* @__PURE__ */ jsx2("span", { className: "studio-home-cover", "aria-hidden": "true", children: /* @__PURE__ */ jsx2("span", { children: /* @__PURE__ */ jsx2(Icon, { name: "add" }) }) }),
|
|
502
|
-
/* @__PURE__ */
|
|
503
|
-
|
|
888
|
+
/* @__PURE__ */ jsxs2("span", { className: "studio-home-caption", children: [
|
|
889
|
+
/* @__PURE__ */ jsx2("strong", { children: "Create Project" }),
|
|
890
|
+
/* @__PURE__ */ jsx2("small", { children: "Create a local project" })
|
|
891
|
+
] })
|
|
504
892
|
]
|
|
505
893
|
}
|
|
506
894
|
),
|
|
507
|
-
entries.map(({ key, row, name, note, enabled, open }) => /* @__PURE__ */
|
|
895
|
+
entries.slice(0, columns - 1).map(({ key, row, name, note, enabled, open }) => /* @__PURE__ */ jsxs2(
|
|
508
896
|
"button",
|
|
509
897
|
{
|
|
510
898
|
type: "button",
|
|
@@ -512,27 +900,75 @@ function DataCard({
|
|
|
512
900
|
onClick: open,
|
|
513
901
|
disabled: !enabled,
|
|
514
902
|
children: [
|
|
515
|
-
/* @__PURE__ */ jsx2(
|
|
516
|
-
|
|
517
|
-
|
|
903
|
+
/* @__PURE__ */ jsx2(
|
|
904
|
+
ProjectCover,
|
|
905
|
+
{
|
|
906
|
+
client,
|
|
907
|
+
row,
|
|
908
|
+
pending: enabled && pending
|
|
909
|
+
},
|
|
910
|
+
JSON.stringify([
|
|
911
|
+
client.config.studioInstance,
|
|
912
|
+
row?.available,
|
|
913
|
+
row?.previewRef ?? row?.coverRef
|
|
914
|
+
])
|
|
915
|
+
),
|
|
916
|
+
/* @__PURE__ */ jsxs2("span", { className: "studio-home-caption", children: [
|
|
917
|
+
/* @__PURE__ */ jsx2("strong", { title: name, children: name }),
|
|
918
|
+
note && /* @__PURE__ */ jsx2("small", { children: note })
|
|
919
|
+
] })
|
|
518
920
|
]
|
|
519
921
|
},
|
|
520
922
|
key
|
|
521
923
|
))
|
|
522
|
-
] })
|
|
523
|
-
creating && /* @__PURE__ */ jsx2(
|
|
924
|
+
] }),
|
|
925
|
+
creating && /* @__PURE__ */ jsx2(
|
|
926
|
+
NewProjectDialog,
|
|
927
|
+
{
|
|
928
|
+
client,
|
|
929
|
+
close: () => setCreating(false),
|
|
930
|
+
onCreated: (project) => {
|
|
931
|
+
if (onProjectCreated) onProjectCreated(project);
|
|
932
|
+
else openProject(project.id);
|
|
933
|
+
}
|
|
934
|
+
}
|
|
935
|
+
)
|
|
524
936
|
] });
|
|
525
937
|
}
|
|
526
|
-
|
|
527
|
-
// packages/dashboard-projects/src/client.tsx
|
|
528
|
-
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
529
|
-
var dependencies = (config) => config.studioInstance ? [config.studioInstance] : [];
|
|
530
938
|
function activate(client) {
|
|
531
939
|
client.registerUI({
|
|
532
940
|
id: "projects",
|
|
533
941
|
title: "Project List",
|
|
534
942
|
kind: "component",
|
|
535
|
-
component: (props) => /* @__PURE__ */
|
|
943
|
+
component: (props) => /* @__PURE__ */ jsx2(ProjectsCard, { ...props, client })
|
|
944
|
+
});
|
|
945
|
+
client.registerUI({
|
|
946
|
+
id: "create-project",
|
|
947
|
+
title: "Create Project",
|
|
948
|
+
kind: "component",
|
|
949
|
+
component: function ProjectCreator(props) {
|
|
950
|
+
const [open, setOpen] = React2.useState(false);
|
|
951
|
+
if ("close" in props) return /* @__PURE__ */ jsx2(NewProjectDialog, { client, ...props });
|
|
952
|
+
return /* @__PURE__ */ jsxs2(Fragment2, { children: [
|
|
953
|
+
/* @__PURE__ */ jsx2(
|
|
954
|
+
Button,
|
|
955
|
+
{
|
|
956
|
+
label: "Create Project",
|
|
957
|
+
variant: "text-filled-sm",
|
|
958
|
+
width: "hug",
|
|
959
|
+
onClick: () => setOpen(true)
|
|
960
|
+
}
|
|
961
|
+
),
|
|
962
|
+
open && /* @__PURE__ */ jsx2(
|
|
963
|
+
NewProjectDialog,
|
|
964
|
+
{
|
|
965
|
+
client,
|
|
966
|
+
close: () => setOpen(false),
|
|
967
|
+
onCreated: (project) => props.onProjectCreated?.(project)
|
|
968
|
+
}
|
|
969
|
+
)
|
|
970
|
+
] });
|
|
971
|
+
}
|
|
536
972
|
});
|
|
537
973
|
}
|
|
538
974
|
export {
|