@vivix-labs/dashboard-projects 1.0.0-beta.2 → 1.0.0-beta.20

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.
@@ -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-size: 16px;
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: 4px;
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-surface-input);
63
- color: var(--vx-text-placeholder);
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;
@@ -1,12 +1,230 @@
1
1
  // packages/dashboard-projects/src/client.tsx
2
- import * as React from "react";
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 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().optional().transform(() => void 0),
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([
90
+ "reference",
91
+ "script",
92
+ "shot",
93
+ "music",
94
+ "voice",
95
+ "speech",
96
+ "subtitle",
97
+ "final",
98
+ "other"
99
+ ]).default("other"),
100
+ origin: z2.enum(["upload", "library", "generated", "authored"]),
101
+ orderKey: z2.number().int().nullable().default(null),
102
+ tags,
103
+ lifecycle: z2.enum(["draft", "ready", "archived"]).default("draft"),
104
+ sourceRef: versionRef.nullable().default(null),
105
+ adoptedVersionId: z2.uuid().nullable().default(null)
106
+ }).strict();
107
+ var storedAssetData = assetData.extend({
108
+ purpose: z2.union([assetData.shape.purpose, z2.literal("speech")])
109
+ });
110
+ var generationFields = z2.object({
111
+ targetAssetId: z2.uuid().optional(),
112
+ taskName: z2.string().trim().min(1).max(200).optional(),
113
+ context: z2.record(z2.string().min(1).max(64), z2.string().min(1).max(200)).describe(
114
+ "Owning-domain binding stored with the task. Short drama passes { episodeId, shotId } so the finished take attaches to that shot; production.generateShot sets it automatically."
115
+ ).optional(),
116
+ expectedRevision: z2.number().int().positive().optional(),
117
+ newAsset: z2.object({
118
+ name: z2.string().trim().min(1).max(200),
119
+ kind: z2.enum(["image", "video", "audio"]),
120
+ purpose: assetData.shape.purpose.unwrap().optional(),
121
+ tags: tags.unwrap().optional()
122
+ }).strict().optional(),
123
+ modelId: z2.string().min(1),
124
+ capabilityId: z2.string().min(1),
125
+ prompt: z2.string().max(32e3).optional(),
126
+ voiceRef: versionRef.optional(),
127
+ parameters: z2.record(z2.string(), z2.unknown()).default({}),
128
+ outputCount: z2.number().int().min(1).max(100).default(1),
129
+ inputs: z2.array(
130
+ z2.object({
131
+ ref: versionRef,
132
+ role: z2.string().min(1),
133
+ order: z2.number().int().nonnegative(),
134
+ weight: z2.number().finite().nullable().default(null)
135
+ }).strict()
136
+ ).max(100).default([]),
137
+ baseVersionId: z2.uuid().optional(),
138
+ changeRequest: z2.string().trim().min(1).max(4e3).optional(),
139
+ preserveRequest: z2.string().max(4e3).default(""),
140
+ anchor: z2.object({ kind: z2.literal("whole") }).strict().optional().describe("Deprecated whole-version selection."),
141
+ retryOfTaskId: z2.uuid().optional(),
142
+ acknowledgeUnknown: z2.boolean().optional()
143
+ }).strict();
144
+ var generationInput = generationFields.refine(
145
+ (input) => input.prompt !== void 0 || ["voice.clone", "voice.create"].includes(input.capabilityId),
146
+ { path: ["prompt"], message: "A prompt is required for this operation." }
147
+ ).transform((input) => ({ ...input, prompt: input.prompt ?? "" }));
148
+ var projectSettingsInput = z2.object({
149
+ projectId: z2.uuid(),
150
+ expectedRevision: z2.number().int().positive(),
151
+ changes: projectData.pick({ name: true, description: true, tags: true, aspectRatio: true, coverRef: true }).extend({
152
+ description: projectData.shape.description.unwrap(),
153
+ tags: projectData.shape.tags.unwrap(),
154
+ aspectRatio: projectData.shape.aspectRatio.unwrap(),
155
+ coverRef: projectData.shape.coverRef.unwrap()
156
+ }).partial().strict()
157
+ }).strict();
158
+ function generationReceiptPredecessors() {
159
+ const legacy = generationFields.omit({ voiceRef: true }).extend({
160
+ prompt: generationFields.shape.prompt.unwrap(),
161
+ newAsset: generationFields.shape.newAsset.unwrap().omit({ purpose: true, tags: true }).optional(),
162
+ anchor: z2.discriminatedUnion("kind", [
163
+ z2.object({ kind: z2.literal("whole") }).strict(),
164
+ z2.object({
165
+ kind: z2.literal("timeRange"),
166
+ startMs: z2.number().int().nonnegative(),
167
+ endMs: z2.number().int().nonnegative()
168
+ }).strict()
169
+ ]).default({ kind: "whole" })
170
+ });
171
+ const voice = legacy.extend({
172
+ prompt: legacy.shape.prompt.optional(),
173
+ voiceRef: versionRef.optional()
174
+ }).refine(
175
+ (input) => input.prompt !== void 0 || ["voice.clone", "voice.create"].includes(input.capabilityId)
176
+ ).transform((input) => ({ ...input, prompt: input.prompt ?? "" }));
177
+ return [
178
+ {
179
+ packageVersion: "1.0.0-beta.19",
180
+ packageIntegrity: "e70b5c3b91d551bbd73c0b181eadbe92e71b66fbc6a642004184740a14bd4c06",
181
+ input: legacy
182
+ },
183
+ {
184
+ packageVersion: "1.0.0-beta.20",
185
+ packageIntegrity: "febb0e966d82d98555beab936e2d735dab3cc98d6101d19e8b692c1ebe0dbe8a",
186
+ input: voice
187
+ },
188
+ {
189
+ packageVersion: "1.0.0-beta.22",
190
+ packageIntegrity: "6fefdd978b7441df8598373da79d22d945587c8656de4e92b64cb615eec30afb",
191
+ input: voice
192
+ },
193
+ { packageVersion: "1.0.0-beta.25", input: generationInput },
194
+ // The non-voice beta.22 branch used the original required prompt schema.
195
+ { packageVersion: "1.0.0-beta.22", input: legacy }
196
+ ].map((previous) => ({ ...previous, output: z2.any() }));
197
+ }
198
+ var generationSubmitOperation = defineOperation({
199
+ id: "generation.submit",
200
+ title: "Generate",
201
+ description: "Submit one media generation without approval, retaining its paid request identity. Pass context with the owning domain identifiers; without it the output is only stored in the media library.",
202
+ input: generationInput,
203
+ receiptPredecessors: generationReceiptPredecessors,
204
+ output: z2.any(),
205
+ effects: ["write", "paid"],
206
+ confirm: "none"
207
+ });
208
+ var favoriteData = z2.object({ ref: versionRef }).strict();
209
+ var sqlScalar = z2.union([z2.string(), z2.number().finite(), z2.null()]);
210
+ var globalQueryInput = z2.object({
211
+ sql: z2.string().trim().min(1),
212
+ params: z2.union([z2.array(sqlScalar), z2.record(z2.string(), sqlScalar)]).optional(),
213
+ timeoutMs: z2.number().int().positive().optional(),
214
+ maxRows: z2.number().int().positive().optional(),
215
+ limit: z2.number().int().min(1).max(200).optional(),
216
+ offset: z2.number().int().nonnegative().optional(),
217
+ source: z2.enum(["projects", "assets", "tasks"]),
218
+ excludeProjectIds: z2.array(z2.uuid()).optional(),
219
+ catalog: z2.array(z2.object({ id: z2.string().min(1), name: z2.string(), available: z2.boolean() }).strict()).optional()
220
+ }).strict();
221
+ var projectListSql = "SELECT rowId, projectId, name, available, createdAt, coverRef FROM studio_projects ORDER BY createdAt DESC, rowId ASC";
4
222
 
5
223
  // packages/ui-system/dist/button.js
6
- import { jsx as _jsx2, jsxs as _jsxs } from "react/jsx-runtime";
224
+ import { jsx as _jsx2, jsxs as _jsxs2 } from "react/jsx-runtime";
7
225
 
8
226
  // packages/ui-system/dist/icon.js
9
- import { jsx as _jsx } from "react/jsx-runtime";
227
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
10
228
  var iconGeometry = {
11
229
  add: {
12
230
  width: 16,
@@ -73,6 +291,10 @@ var iconGeometry = {
73
291
  height: 15.5625,
74
292
  slot: 18
75
293
  },
294
+ "select-items": { width: 13.8681, height: 13.8667, slot: 16 },
295
+ trim: { width: 14.85, height: 14.85, slot: 16 },
296
+ crop: { width: 16.25, height: 16.25, slot: 16 },
297
+ filter: { width: 13.2, height: 13.2, slot: 16 },
76
298
  select: {
77
299
  width: 14.6298,
78
300
  height: 16.065,
@@ -128,6 +350,7 @@ var iconGeometry = {
128
350
  height: 20,
129
351
  slot: 20
130
352
  },
353
+ "fullscreen-exit": { width: 20, height: 20, slot: 20 },
131
354
  "placeholder-image": {
132
355
  width: 20,
133
356
  height: 20,
@@ -153,6 +376,9 @@ var iconGeometry = {
153
376
  height: 13.2,
154
377
  slot: 16
155
378
  },
379
+ favorite: { width: 11.8667, height: 14.5333, slot: 16 },
380
+ download: { width: 13.2001, height: 13.1997, slot: 16 },
381
+ delete: { width: 13.2, height: 14.533, slot: 16 },
156
382
  edit: {
157
383
  width: 10.8791,
158
384
  height: 12.0459,
@@ -194,7 +420,7 @@ var iconGeometry = {
194
420
  slot: 24
195
421
  }
196
422
  };
197
- function Icon({ name, size }) {
423
+ function Icon({ name, size, iconSet }) {
198
424
  const geometry = iconGeometry[name];
199
425
  const style = {
200
426
  ...geometry && {
@@ -204,7 +430,10 @@ function Icon({ name, size }) {
204
430
  },
205
431
  ...size === void 0 ? {} : { "--vx-icon-size": `${size}px` }
206
432
  };
207
- return _jsx("span", { "aria-hidden": "true", className: "vx-icon", "data-icon": name, style });
433
+ if (name === "menu" || name === "relationships" || name === "color-adjust" || name === "speed") {
434
+ return _jsx("svg", { "aria-hidden": "true", className: "vx-icon", "data-icon": name, "data-icon-set": iconSet === "chat" ? "chat" : void 0, style, viewBox: "0 0 20 20", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", children: name === "menu" ? _jsx("path", { d: "M3 5h14M3 10h14M3 15h14" }) : name === "color-adjust" ? _jsxs(_Fragment, { children: [_jsx("path", { d: "M3 5h3m4 0h7M3 10h8m4 0h2M3 15h3m4 0h7" }), _jsx("circle", { cx: "8", cy: "5", r: "2" }), _jsx("circle", { cx: "13", cy: "10", r: "2" }), _jsx("circle", { cx: "8", cy: "15", r: "2" })] }) : name === "speed" ? _jsxs(_Fragment, { children: [_jsx("path", { d: "M4 16a8 8 0 1 1 12 0M10 3v2M3 10h2m10 0h2M5 5l1.4 1.4M10 12l4-5" }), _jsx("circle", { cx: "10", cy: "12", r: "1.5" })] }) : _jsxs(_Fragment, { children: [_jsx("path", { d: "M8.5 6.3 5 11.7M11.5 6.3 15 11.7M6.5 14.5h7" }), _jsx("circle", { cx: "10", cy: "4", r: "2.5" }), _jsx("circle", { cx: "4", cy: "14.5", r: "2.5" }), _jsx("circle", { cx: "16", cy: "14.5", r: "2.5" })] }) });
435
+ }
436
+ return _jsx("span", { "aria-hidden": "true", className: "vx-icon", "data-icon": name, "data-icon-set": iconSet === "chat" ? "chat" : void 0, style });
208
437
  }
209
438
 
210
439
  // packages/ui-system/dist/button-variants.js
@@ -213,6 +442,9 @@ var buttonVariants = {
213
442
  "text-filled-leading-sm": { size: 32, appearance: "filled", shape: "text" },
214
443
  "text-ghost-sm": { size: 32, appearance: "ghost", shape: "text" },
215
444
  "text-on-content-sm": { size: 32, appearance: "on-content", shape: "text" },
445
+ "text-plain-sm": { size: 32, appearance: "plain", shape: "text" },
446
+ "text-link-sm": { size: 32, appearance: "link", shape: "text" },
447
+ "text-outline-sm": { size: 32, appearance: "outline", shape: "text" },
216
448
  "text-tonal-sm": { size: 32, appearance: "tonal", shape: "text" },
217
449
  // The medium recipes are shared by all dialog footer actions.
218
450
  "text-filled-md": { size: 40, appearance: "filled", shape: "text" },
@@ -233,7 +465,7 @@ var buttonVariants = {
233
465
  "icon-outline-sm": { size: 32, appearance: "outline", shape: "icon" },
234
466
  "icon-on-content": { size: 24, appearance: "on-content", shape: "icon" },
235
467
  "icon-outline-lg": { size: 48, appearance: "outline", shape: "icon" },
236
- // Compact bare action: reuse the transparent/default and surface-hover ghost treatment.
468
+ // Compact bare action: remain transparent at rest and on hover.
237
469
  "icon-bare-xs": { size: 24, appearance: "ghost", shape: "icon" },
238
470
  "icon-ghost-sm": { size: 32, appearance: "ghost", shape: "icon" },
239
471
  "icon-ghost-lg": { size: 48, appearance: "ghost", shape: "icon" },
@@ -245,48 +477,74 @@ var buttonVariants = {
245
477
  function ButtonFrame({ label, variant, loading = false, width, children, disabled, type = "button", style, className, ...props }) {
246
478
  const spec = buttonVariants[variant];
247
479
  const buttonStyle = "width" in spec ? { ...style, "--vx-button-width": `${spec.width}px` } : style;
248
- 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" })] });
480
+ return _jsxs2("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
481
  }
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 }) })] });
482
+ function Button({ variant = "text-filled-sm", leadingIcon, trailingIcon, badge, ...props }) {
483
+ return _jsxs2(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
484
  }
253
485
  function IconButton({ icon, variant = "icon-ghost-sm", ...props }) {
254
486
  return _jsx2(ButtonFrame, { ...props, variant, children: _jsx2(Icon, { name: icon }) });
255
487
  }
256
488
 
489
+ // packages/ui-system/dist/cover-preview.js
490
+ import { jsx as _jsx3 } from "react/jsx-runtime";
491
+ import { useState } from "react";
492
+ function CoverPreview(props) {
493
+ return _jsx3(Preview, { ...props }, JSON.stringify([props.kind, props.src]));
494
+ }
495
+ function Preview({ className, ref, kind: kind2 = "image", src, pending, iconSize = 20, children }) {
496
+ const [mediaState, setMediaState] = useState("loading");
497
+ const media = src && (kind2 === "image" || kind2 === "video");
498
+ const state = pending ? "loading" : media ? mediaState : children ? "ready" : "empty";
499
+ const iconKind = kind2 === "video" || kind2 === "audio" ? kind2 : kind2 === "text" ? "script" : "image";
500
+ const ready = () => setMediaState("ready");
501
+ const failed = () => setMediaState("empty");
502
+ 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 });
503
+ }
504
+
257
505
  // packages/ui-system/dist/segmented-control.js
258
- import { jsx as _jsx3, jsxs as _jsxs2 } from "react/jsx-runtime";
506
+ import { jsx as _jsx4, jsxs as _jsxs3 } from "react/jsx-runtime";
259
507
  import { useId } from "react";
260
508
  function SegmentedControl({ label, items, value, onValueChange, size = "medium", width = "fixed", iconOnly = false }) {
261
509
  const id = useId();
262
- return _jsx3("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: [_jsx3("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 && _jsx3(Icon, { name: item.icon }), (!iconOnly || !item.icon) && item.label] })] }, item.value)) });
510
+ 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) => _jsxs3("label", { title: iconOnly ? item.label : void 0, 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) }), _jsxs3("span", { className: "vx-segment-item", children: [item.icon && _jsx4(Icon, { name: item.icon }), (!iconOnly || !item.icon) && item.label] })] }, item.value)) });
263
511
  }
264
512
 
265
513
  // packages/ui-system/dist/input.js
266
- import { jsx as _jsx4, jsxs as _jsxs3 } from "react/jsx-runtime";
267
- function TextInput({ label, value, onValueChange, size = "medium", ...props }) {
268
- return _jsxs3("label", { className: "vx-field", "data-size": size, children: [_jsx4("span", { children: label }), _jsx4("input", { ...props, type: "text", value, onChange: (event) => onValueChange(event.currentTarget.value) })] });
514
+ import { jsx as _jsx5, jsxs as _jsxs4 } from "react/jsx-runtime";
515
+ import { useEffect, useState as useState2 } from "react";
516
+ function TextInput({ label, value, onValueChange, size = "medium", appearance = "default", placeholder, ...props }) {
517
+ return _jsxs4("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) })] });
269
518
  }
270
519
 
271
520
  // packages/ui-system/dist/dialog.js
272
- import { jsx as _jsx5, jsxs as _jsxs4, Fragment as _Fragment } from "react/jsx-runtime";
273
- import { useId as useId2, useLayoutEffect, useRef, useState } from "react";
521
+ import { jsx as _jsx6, jsxs as _jsxs5, Fragment as _Fragment2 } from "react/jsx-runtime";
522
+ import { useId as useId2, useLayoutEffect, useRef, useState as useState3 } from "react";
274
523
  import { createPortal } from "react-dom";
275
524
 
276
525
  // packages/ui-system/dist/dialog-surface.js
277
- function createDialogSurface(anchor) {
526
+ var overlayOpeningEvent = "vx-overlay-opening";
527
+ function outerDialogDocument(anchor) {
278
528
  const source = anchor.ownerDocument;
279
- let target;
280
529
  try {
281
- target = source.defaultView?.top?.document ?? source;
530
+ const target = source.defaultView?.top?.document;
531
+ return target && target !== source ? target : void 0;
282
532
  } catch {
283
533
  return void 0;
284
534
  }
285
- if (target === source)
535
+ }
536
+ function createDialogSurface(anchor) {
537
+ const source = anchor.ownerDocument;
538
+ const target = outerDialogDocument(anchor);
539
+ if (!target)
286
540
  return void 0;
287
541
  const host = target.createElement("div");
288
542
  host.dataset.studioDialogSurface = "";
289
543
  const shadow = host.attachShadow({ mode: "open" });
544
+ shadow.addEventListener("beforetoggle", (event) => {
545
+ if (event.newState === "open" && !event.target.classList.contains("vx-toast"))
546
+ target.dispatchEvent(new Event(overlayOpeningEvent));
547
+ }, true);
290
548
  for (const original of source.querySelectorAll('link[rel="stylesheet"], style')) {
291
549
  const clone = original.cloneNode(true);
292
550
  if (original.tagName === "LINK")
@@ -322,13 +580,13 @@ function createDialogSurface(anchor) {
322
580
  }
323
581
 
324
582
  // packages/ui-system/dist/dialog.js
325
- function Dialog({ title, open, onOpenChange, children, actions, className, variant = "default" }) {
583
+ function Dialog({ title, titleBadge, open, onOpenChange, children, actions, className, inlineWhenClosed = false, variant = "default", closeOnEscape = true, focusTitleOnOpen = variant === "welcome" }) {
326
584
  const ref = useRef(null);
327
585
  const anchor = useRef(null);
328
- const [surface, setSurface] = useState();
586
+ const [surface, setSurface] = useState3();
329
587
  const heading = useId2();
330
588
  useLayoutEffect(() => {
331
- if (!open || !anchor.current)
589
+ if (inlineWhenClosed || !open || !anchor.current)
332
590
  return;
333
591
  const mounted = createDialogSurface(anchor.current);
334
592
  const active = anchor.current.getRootNode().activeElement;
@@ -341,9 +599,20 @@ function Dialog({ title, open, onOpenChange, children, actions, className, varia
341
599
  active.focus();
342
600
  });
343
601
  };
344
- }, [open]);
602
+ }, [open, inlineWhenClosed]);
345
603
  useLayoutEffect(() => {
346
604
  const dialog2 = ref.current;
605
+ if (inlineWhenClosed && dialog2) {
606
+ if (open) {
607
+ dialog2.close();
608
+ dialog2.showModal();
609
+ } else {
610
+ if (dialog2.matches(":modal"))
611
+ dialog2.close();
612
+ dialog2.open = true;
613
+ }
614
+ return;
615
+ }
347
616
  if (!open || surface === void 0 || !dialog2)
348
617
  return;
349
618
  dialog2.showModal();
@@ -351,42 +620,24 @@ function Dialog({ title, open, onOpenChange, children, actions, className, varia
351
620
  if (dialog2.open)
352
621
  dialog2.close();
353
622
  };
354
- }, [open, surface]);
355
- const dialog = _jsxs4("dialog", { ref, className: className ? `vx-dialog ${className}` : "vx-dialog", "data-variant": variant === "default" ? void 0 : variant, "aria-labelledby": heading, onCancel: (event) => {
623
+ }, [open, surface, inlineWhenClosed]);
624
+ const welcome = variant === "welcome";
625
+ const closeButton = _jsx6(IconButton, { icon: "close", label: "Close dialog", onClick: () => onOpenChange(false) });
626
+ const dialog = _jsxs5("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) => {
356
627
  event.preventDefault();
357
628
  event.stopPropagation();
358
- onOpenChange(false);
629
+ if (closeOnEscape)
630
+ onOpenChange(false);
359
631
  }, onClose: (event) => {
360
632
  if (open && event.currentTarget.isConnected && !event.currentTarget.open)
361
633
  onOpenChange(false);
362
- }, children: [_jsxs4("header", { children: [_jsx5("h2", { id: heading, children: title }), _jsx5(IconButton, { icon: "close", label: "Close dialog", onClick: () => onOpenChange(false) })] }), _jsx5("div", { className: "vx-dialog-body", children }), actions && _jsx5("footer", { children: actions })] });
363
- return _jsxs4(_Fragment, { children: [_jsx5("span", { ref: anchor, hidden: true }), open && (surface ? createPortal(dialog, surface) : dialog)] });
634
+ }, children: [_jsxs5("header", { hidden: inlineWhenClosed && !open, children: [_jsx6("h2", { id: heading, tabIndex: focusTitleOnOpen ? -1 : void 0, autoFocus: focusTitleOnOpen, children: title }), titleBadge, !welcome && closeButton] }), _jsx6("div", { className: "vx-dialog-body", children }), (actions || welcome) && _jsxs5("footer", { hidden: inlineWhenClosed && !open, children: [actions, welcome && closeButton] })] });
635
+ return _jsxs5(_Fragment2, { children: [_jsx6("span", { ref: anchor, hidden: true }), (open || inlineWhenClosed) && (surface ? createPortal(dialog, surface) : dialog)] });
364
636
  }
365
637
 
366
- // packages/dashboard-projects/src/client.tsx
638
+ // packages/dashboard-projects/src/create-project-dialog.tsx
639
+ import * as React from "react";
367
640
  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
641
  var projectTypes = [
391
642
  {
392
643
  value: "short-drama",
@@ -396,6 +647,16 @@ var projectTypes = [
396
647
  { value: "ads", label: "Product Ad", preset: "@vivix-labs/ads-workbench:ads" },
397
648
  { value: "table", label: "Others", preset: "@vivix-labs/studio-workbench:table" }
398
649
  ];
650
+ function formatErrorMessage(error) {
651
+ if (!(error instanceof Error)) return String(error);
652
+ const hint = "hint" in error && typeof error.hint === "string" ? error.hint.trim() : "";
653
+ const message = error.message.trim();
654
+ const detail = hint || message;
655
+ const code = "code" in error && typeof error.code === "string" ? error.code : "";
656
+ if (code === "INSTANCE_UNAVAILABLE" && detail && !detail.includes("vivix-studio"))
657
+ return `${detail} Check with: vivix-studio plugin list --scope user --json`;
658
+ return detail;
659
+ }
399
660
  function NewProjectDialog({
400
661
  client,
401
662
  close,
@@ -418,7 +679,7 @@ function NewProjectDialog({
418
679
  if (active) setPresets(items);
419
680
  },
420
681
  (error) => {
421
- if (active) setStatus(error.message);
682
+ if (active) setStatus(formatErrorMessage(error));
422
683
  }
423
684
  );
424
685
  return () => {
@@ -428,9 +689,11 @@ function NewProjectDialog({
428
689
  const selection = projectTypes.find((item) => item.value === type);
429
690
  const placeholder = type === "table" ? "Untitled Project" : "Untitled " + selection.label;
430
691
  const [packageName, presetId] = selection.preset.split(":");
431
- const preset = presets?.find(
432
- (item) => item.spec.startsWith(packageName + "@") && item.spec.endsWith(":" + presetId)
433
- );
692
+ const preset = [packageName, packageName.replace("@vivix-labs/", "@vivix-studio/")].flatMap(
693
+ (name2) => presets?.filter(
694
+ (item) => item.spec.startsWith(name2 + "@") && item.spec.endsWith(":" + presetId)
695
+ ) ?? []
696
+ )[0];
434
697
  async function create() {
435
698
  if (!preset || !client.projects?.create || busy) return;
436
699
  const input = {
@@ -448,7 +711,7 @@ function NewProjectDialog({
448
711
  onCreated(project);
449
712
  close();
450
713
  } catch (error) {
451
- setStatus(error instanceof Error ? error.message : String(error));
714
+ setStatus(formatErrorMessage(error));
452
715
  } finally {
453
716
  setBusy(false);
454
717
  }
@@ -520,108 +783,186 @@ function NewProjectDialog({
520
783
  }
521
784
  );
522
785
  }
523
- function ProjectCover({ row }) {
524
- const [failed, setFailed] = React.useState(false);
525
- const source = typeof row?.previewUrl === "string" && !failed ? row.previewUrl : void 0;
526
- return /* @__PURE__ */ jsx("span", { className: "studio-home-cover", "aria-hidden": "true", children: source && row?.previewKind === "video" ? /* @__PURE__ */ jsx("video", { src: source, muted: true, playsInline: true, preload: "auto", onError: () => setFailed(true) }) : source ? /* @__PURE__ */ jsx("img", { src: source, alt: "", loading: "lazy", onError: () => setFailed(true) }) : null });
786
+
787
+ // packages/dashboard-projects/src/client.tsx
788
+ import { Fragment as Fragment2, jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
789
+ var Config = z3.object({ studioInstance: z3.string().min(1).nullable().default(null) });
790
+ var dependencies = (config) => config.studioInstance ? [config.studioInstance] : [];
791
+ function decodeRef(value) {
792
+ let item = value;
793
+ if (typeof item === "string") {
794
+ try {
795
+ item = JSON.parse(item);
796
+ } catch {
797
+ return null;
798
+ }
799
+ }
800
+ if (!item || typeof item !== "object" || Array.isArray(item)) return null;
801
+ const ref = item;
802
+ return ["storeId", "objectId", "versionId"].every(
803
+ (key) => typeof ref[key] === "string" && /^[0-9a-f-]{36}$/i.test(ref[key])
804
+ ) ? {
805
+ storeId: ref.storeId,
806
+ objectId: ref.objectId,
807
+ versionId: ref.versionId
808
+ } : null;
809
+ }
810
+ var projectPreviews = /* @__PURE__ */ new WeakMap();
811
+ function ProjectCover({
812
+ client,
813
+ row,
814
+ pending
815
+ }) {
816
+ const ref = decodeRef(row?.available ? row.previewRef ?? row.coverRef : void 0);
817
+ const instanceId = client.config.studioInstance;
818
+ const key = ref && JSON.stringify([instanceId, ref.storeId, ref.objectId, ref.versionId]);
819
+ const cached = key ? projectPreviews.get(client)?.get(key) : void 0;
820
+ const [resolved, setResolved] = React2.useState();
821
+ React2.useEffect(() => {
822
+ if (!ref || !instanceId || !key || cached) return;
823
+ let active = true;
824
+ void client.invoke({ instanceId, operationId: "global.asset" }, { ref }).then(
825
+ ({ item }) => {
826
+ if (!active) return;
827
+ if (item.previewUrl) {
828
+ const previews = projectPreviews.get(client) ?? /* @__PURE__ */ new Map();
829
+ previews.set(key, item);
830
+ if (previews.size > 64) previews.delete(previews.keys().next().value);
831
+ projectPreviews.set(client, previews);
832
+ }
833
+ setResolved(item);
834
+ },
835
+ () => {
836
+ if (active) setResolved(null);
837
+ }
838
+ );
839
+ return () => {
840
+ active = false;
841
+ };
842
+ }, [client, instanceId, key, cached]);
843
+ const preview = cached ?? resolved;
844
+ const src = preview?.previewUrl ?? row?.previewUrl;
845
+ return /* @__PURE__ */ jsx2(
846
+ CoverPreview,
847
+ {
848
+ className: "studio-home-cover",
849
+ src: typeof src === "string" ? src : void 0,
850
+ kind: String(preview?.kind ?? row?.previewKind ?? "image"),
851
+ pending: pending || Boolean(instanceId && ref && preview === void 0)
852
+ }
853
+ );
527
854
  }
855
+ var previousProjects = /* @__PURE__ */ new WeakMap();
528
856
  function ProjectsCard({
529
857
  client,
530
858
  projects,
859
+ hiddenProjectIds,
860
+ projectCovers,
531
861
  ready,
532
862
  openProject,
533
863
  openProjects,
534
864
  onProjectCreated
535
865
  }) {
536
- const [rows, setRows] = React.useState();
537
- const [creating, setCreating] = React.useState(false);
866
+ const [result, setResult] = React2.useState(() => previousProjects.get(client));
867
+ const [creating, setCreating] = React2.useState(false);
868
+ const grid = React2.useRef(null);
869
+ const [columns, setColumns] = React2.useState(1);
870
+ React2.useLayoutEffect(() => {
871
+ const element = grid.current;
872
+ if (!element) return;
873
+ const measure = () => setColumns(getComputedStyle(element).gridTemplateColumns.split(" ").length);
874
+ measure();
875
+ const observer = new ResizeObserver(measure);
876
+ observer.observe(element);
877
+ return () => observer.disconnect();
878
+ }, []);
538
879
  const catalogKey = JSON.stringify(projects);
539
- React.useEffect(() => {
540
- if (!ready || !client.config.studioInstance) return;
880
+ const hiddenKey = JSON.stringify(hiddenProjectIds ?? []);
881
+ const resultKey = JSON.stringify([catalogKey, hiddenKey]);
882
+ React2.useEffect(() => {
883
+ const instanceId = client.config.studioInstance;
884
+ if (!ready || !instanceId) return;
541
885
  let active = true;
542
- void client.invoke(
543
- { instanceId: client.config.studioInstance, operationId: "global.query" },
886
+ const loadProjects = (countColumn) => client.invoke(
887
+ { instanceId, operationId: "global.query" },
544
888
  {
545
889
  source: "projects",
546
- sql: projectsSql,
890
+ sql: projectListSql.replace("SELECT ", `SELECT ${countColumn} AS cardAssetCount, `),
547
891
  params: [],
548
892
  catalog: JSON.parse(catalogKey),
893
+ ...hiddenKey !== "[]" && { excludeProjectIds: JSON.parse(hiddenKey) },
549
894
  limit: 5,
550
895
  timeoutMs: 8e3,
551
896
  offset: 0
552
897
  }
553
- ).then(
554
- async ({ items }) => {
555
- const next = await Promise.all(
556
- items.map(async (row) => {
557
- const ref = decodeRef(row.previewRef ?? row.coverRef);
558
- if (!ref || !row.available) return row;
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);
898
+ );
899
+ void loadProjects("savedAssetCount").catch(() => loadProjects("assetCount")).then(
900
+ ({ items }) => {
901
+ if (!active) return;
902
+ const result2 = { catalogKey: resultKey, rows: items };
903
+ previousProjects.set(client, result2);
904
+ setResult(result2);
575
905
  },
576
906
  () => {
577
- if (active) setRows([]);
907
+ if (!active) return;
908
+ previousProjects.delete(client);
909
+ setResult({ catalogKey: resultKey, rows: [] });
578
910
  }
579
911
  );
580
912
  return () => {
581
913
  active = false;
582
914
  };
583
- }, [client, ready, catalogKey]);
584
- const list = rows ?? [];
915
+ }, [client, ready, catalogKey, hiddenKey]);
916
+ const current = resultKey === result?.catalogKey ? result : void 0;
917
+ const pending = Boolean(client.config.studioInstance) && (!ready || !current);
918
+ const list = current?.rows ?? [];
585
919
  const entries = (list.length ? list.map((row) => projects.find(({ id }) => id === row.projectId)).filter((entry) => !!entry) : projects.slice(0, 5)).map((project) => {
586
920
  const row = list.find((entry) => entry.projectId === project.id);
921
+ const cover = projectCovers?.get(project.id);
922
+ const previewRow = {
923
+ ...row,
924
+ available: project.available,
925
+ coverRef: cover ? { ...cover } : row?.coverRef ?? null
926
+ };
587
927
  return {
588
928
  key: project.id,
589
- row,
929
+ row: previewRow,
590
930
  name: String(row?.name ?? project.name),
591
- note: row?.assetCount !== void 0 ? String(row.assetCount) + " assets" : "",
931
+ note: typeof row?.cardAssetCount === "number" ? `${row.cardAssetCount} ${row.cardAssetCount === 1 ? "asset" : "assets"}` : "",
592
932
  enabled: project.available,
593
933
  open: () => openProject(project.id)
594
934
  };
595
935
  });
596
- return /* @__PURE__ */ jsxs("section", { className: "studio-home-panel", "aria-label": "Project List", children: [
597
- /* @__PURE__ */ jsxs("header", { children: [
598
- /* @__PURE__ */ jsx("h2", { children: "Project List" }),
599
- /* @__PURE__ */ jsx(
936
+ return /* @__PURE__ */ jsxs2("section", { className: "studio-home-panel", "aria-label": "Project List", children: [
937
+ /* @__PURE__ */ jsxs2("header", { children: [
938
+ /* @__PURE__ */ jsx2("h2", { children: "Project List" }),
939
+ /* @__PURE__ */ jsx2(
600
940
  Button,
601
941
  {
602
- label: "View all",
942
+ label: ready ? `View all ${projects.length}` : "View all",
603
943
  "aria-label": "View all project list",
604
- className: "studio-home-view-all",
605
- variant: "text-tonal-sm",
944
+ variant: "text-link-sm",
606
945
  onClick: openProjects
607
946
  }
608
947
  )
609
948
  ] }),
610
- /* @__PURE__ */ jsxs("div", { className: "studio-home-grid", children: [
611
- /* @__PURE__ */ jsxs(
949
+ /* @__PURE__ */ jsxs2("div", { className: "studio-home-grid", ref: grid, children: [
950
+ /* @__PURE__ */ jsxs2(
612
951
  "button",
613
952
  {
614
953
  type: "button",
615
954
  className: "studio-home-tile studio-home-create",
616
955
  onClick: () => setCreating(true),
617
956
  children: [
618
- /* @__PURE__ */ jsx("span", { className: "studio-home-cover", "aria-hidden": "true", children: /* @__PURE__ */ jsx("span", { children: /* @__PURE__ */ jsx(Icon, { name: "add" }) }) }),
619
- /* @__PURE__ */ jsx("strong", { children: "Create Project" }),
620
- /* @__PURE__ */ jsx("small", { children: "Create a local project" })
957
+ /* @__PURE__ */ jsx2("span", { className: "studio-home-cover", "aria-hidden": "true", children: /* @__PURE__ */ jsx2("span", { children: /* @__PURE__ */ jsx2(Icon, { name: "add" }) }) }),
958
+ /* @__PURE__ */ jsxs2("span", { className: "studio-home-caption", children: [
959
+ /* @__PURE__ */ jsx2("strong", { children: "Create Project" }),
960
+ /* @__PURE__ */ jsx2("small", { children: "Create a local project" })
961
+ ] })
621
962
  ]
622
963
  }
623
964
  ),
624
- entries.map(({ key, row, name, note, enabled, open }) => /* @__PURE__ */ jsxs(
965
+ entries.slice(0, columns - 1).map(({ key, row, name, note, enabled, open }) => /* @__PURE__ */ jsxs2(
625
966
  "button",
626
967
  {
627
968
  type: "button",
@@ -629,15 +970,29 @@ function ProjectsCard({
629
970
  onClick: open,
630
971
  disabled: !enabled,
631
972
  children: [
632
- /* @__PURE__ */ jsx(ProjectCover, { row }, String(row?.previewUrl ?? "")),
633
- /* @__PURE__ */ jsx("strong", { title: name, children: name }),
634
- note && /* @__PURE__ */ jsx("small", { children: note })
973
+ /* @__PURE__ */ jsx2(
974
+ ProjectCover,
975
+ {
976
+ client,
977
+ row,
978
+ pending: enabled && pending
979
+ },
980
+ JSON.stringify([
981
+ client.config.studioInstance,
982
+ row?.available,
983
+ row?.previewRef ?? row?.coverRef
984
+ ])
985
+ ),
986
+ /* @__PURE__ */ jsxs2("span", { className: "studio-home-caption", children: [
987
+ /* @__PURE__ */ jsx2("strong", { title: name, children: name }),
988
+ note && /* @__PURE__ */ jsx2("small", { children: note })
989
+ ] })
635
990
  ]
636
991
  },
637
992
  key
638
993
  ))
639
994
  ] }),
640
- creating && /* @__PURE__ */ jsx(
995
+ creating && /* @__PURE__ */ jsx2(
641
996
  NewProjectDialog,
642
997
  {
643
998
  client,
@@ -655,7 +1010,35 @@ function activate(client) {
655
1010
  id: "projects",
656
1011
  title: "Project List",
657
1012
  kind: "component",
658
- component: (props) => /* @__PURE__ */ jsx(ProjectsCard, { ...props, client })
1013
+ component: (props) => /* @__PURE__ */ jsx2(ProjectsCard, { ...props, client })
1014
+ });
1015
+ client.registerUI({
1016
+ id: "create-project",
1017
+ title: "Create Project",
1018
+ kind: "component",
1019
+ component: function ProjectCreator(props) {
1020
+ const [open, setOpen] = React2.useState(false);
1021
+ if ("close" in props) return /* @__PURE__ */ jsx2(NewProjectDialog, { client, ...props });
1022
+ return /* @__PURE__ */ jsxs2(Fragment2, { children: [
1023
+ /* @__PURE__ */ jsx2(
1024
+ Button,
1025
+ {
1026
+ label: "Create Project",
1027
+ variant: "text-filled-sm",
1028
+ width: "hug",
1029
+ onClick: () => setOpen(true)
1030
+ }
1031
+ ),
1032
+ open && /* @__PURE__ */ jsx2(
1033
+ NewProjectDialog,
1034
+ {
1035
+ client,
1036
+ close: () => setOpen(false),
1037
+ onCreated: (project) => props.onProjectCreated?.(project)
1038
+ }
1039
+ )
1040
+ ] });
1041
+ }
659
1042
  });
660
1043
  }
661
1044
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vivix-labs/dashboard-projects",
3
- "version": "1.0.0-beta.2",
3
+ "version": "1.0.0-beta.20",
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
+ }