@vivix-labs/studio-workbench 1.0.0-beta.17 → 1.0.0-beta.19

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.
@@ -397,8 +397,8 @@ function Icon({ name, size }) {
397
397
  },
398
398
  ...size === void 0 ? {} : { "--vx-icon-size": `${size}px` }
399
399
  };
400
- if (name === "relationships" || name === "color-adjust" || name === "speed") {
401
- return _jsx2("svg", { "aria-hidden": "true", className: "vx-icon", "data-icon": name, style, viewBox: "0 0 20 20", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", children: name === "color-adjust" ? _jsxs(_Fragment, { children: [_jsx2("path", { d: "M3 5h3m4 0h7M3 10h8m4 0h2M3 15h3m4 0h7" }), _jsx2("circle", { cx: "8", cy: "5", r: "2" }), _jsx2("circle", { cx: "13", cy: "10", r: "2" }), _jsx2("circle", { cx: "8", cy: "15", r: "2" })] }) : name === "speed" ? _jsxs(_Fragment, { children: [_jsx2("path", { d: "M4 16a8 8 0 1 1 12 0M10 3v2M3 10h2m10 0h2M5 5l1.4 1.4M10 12l4-5" }), _jsx2("circle", { cx: "10", cy: "12", r: "1.5" })] }) : _jsxs(_Fragment, { children: [_jsx2("path", { d: "M8.5 6.3 5 11.7M11.5 6.3 15 11.7M6.5 14.5h7" }), _jsx2("circle", { cx: "10", cy: "4", r: "2.5" }), _jsx2("circle", { cx: "4", cy: "14.5", r: "2.5" }), _jsx2("circle", { cx: "16", cy: "14.5", r: "2.5" })] }) });
400
+ if (name === "menu" || name === "relationships" || name === "color-adjust" || name === "speed") {
401
+ return _jsx2("svg", { "aria-hidden": "true", className: "vx-icon", "data-icon": name, style, viewBox: "0 0 20 20", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", children: name === "menu" ? _jsx2("path", { d: "M3 5h14M3 10h14M3 15h14" }) : name === "color-adjust" ? _jsxs(_Fragment, { children: [_jsx2("path", { d: "M3 5h3m4 0h7M3 10h8m4 0h2M3 15h3m4 0h7" }), _jsx2("circle", { cx: "8", cy: "5", r: "2" }), _jsx2("circle", { cx: "13", cy: "10", r: "2" }), _jsx2("circle", { cx: "8", cy: "15", r: "2" })] }) : name === "speed" ? _jsxs(_Fragment, { children: [_jsx2("path", { d: "M4 16a8 8 0 1 1 12 0M10 3v2M3 10h2m10 0h2M5 5l1.4 1.4M10 12l4-5" }), _jsx2("circle", { cx: "10", cy: "12", r: "1.5" })] }) : _jsxs(_Fragment, { children: [_jsx2("path", { d: "M8.5 6.3 5 11.7M11.5 6.3 15 11.7M6.5 14.5h7" }), _jsx2("circle", { cx: "10", cy: "4", r: "2.5" }), _jsx2("circle", { cx: "4", cy: "14.5", r: "2.5" }), _jsx2("circle", { cx: "16", cy: "14.5", r: "2.5" })] }) });
402
402
  }
403
403
  return _jsx2("span", { "aria-hidden": "true", className: "vx-icon", "data-icon": name, style });
404
404
  }
@@ -2888,7 +2888,7 @@ function StudioHome({
2888
2888
  const Component2 = ui?.kind === "component" ? ui.component : void 0;
2889
2889
  return /* @__PURE__ */ React4.createElement(CardBoundary, { key: ref.plugin + "/" + ref.id, title: ui?.title ?? ref.id }, Component2 ? /* @__PURE__ */ React4.createElement(Component2, { ...props }) : /* @__PURE__ */ React4.createElement("p", { role: "status" }, "View unavailable: ", ref.plugin, "/", ref.id));
2890
2890
  };
2891
- const saved = client.config.savedViews;
2891
+ const saved = client.config.savedViews ?? [];
2892
2892
  const selected = saved.find(
2893
2893
  (ref) => "plugin" in ref && ref.plugin + "/" + ref.id === route.selected
2894
2894
  );
@@ -3026,9 +3026,35 @@ var samples = [
3026
3026
  { name: "out-of-steps", cover: "drama", label: "View a Short Drama Sample" },
3027
3027
  { name: "cobalt-headphones", cover: "ad", label: "View a Product Ad Sample" }
3028
3028
  ];
3029
+ function welcomeLocalKey(client) {
3030
+ return welcomeKey + "." + (client.scope?.id ?? "user");
3031
+ }
3032
+ async function markWelcomeSeen(client) {
3033
+ const dataInstance = client.config.dataInstance;
3034
+ const localKey = welcomeLocalKey(client);
3035
+ try {
3036
+ await client.invoke(
3037
+ { instanceId: dataInstance, operationId: "documents.create" },
3038
+ { name: "Studio welcome", payload: { namespace: welcomeKey } },
3039
+ { requestKey: welcomeKey }
3040
+ );
3041
+ } catch {
3042
+ try {
3043
+ localStorage.setItem(localKey, "seen");
3044
+ } catch {
3045
+ }
3046
+ }
3047
+ }
3048
+ function findCreatedWelcomeProject(initialIds, projects) {
3049
+ const added = projects.filter((project) => project.available && !initialIds.has(project.id));
3050
+ return added[added.length - 1];
3051
+ }
3029
3052
  function WelcomeDialog({
3030
3053
  client,
3031
3054
  instanceId,
3055
+ catalogReady,
3056
+ projects,
3057
+ paused = false,
3032
3058
  onCreate,
3033
3059
  onProject
3034
3060
  }) {
@@ -3036,8 +3062,27 @@ function WelcomeDialog({
3036
3062
  const [pending, setPending] = React5.useState();
3037
3063
  const [error, setError] = React5.useState("");
3038
3064
  const dataInstance = client.config.dataInstance;
3039
- const localKey = welcomeKey + "." + (client.scope?.id ?? "user");
3065
+ const localKey = welcomeLocalKey(client);
3066
+ const evaluatedRef = React5.useRef(void 0);
3067
+ const markedRef = React5.useRef(void 0);
3068
+ const initialIdsRef = React5.useRef(/* @__PURE__ */ new Set());
3069
+ const projectsRef = React5.useRef(projects);
3070
+ projectsRef.current = projects;
3071
+ const onProjectEvent = React5.useEffectEvent(onProject);
3072
+ const markSeen = React5.useEffectEvent(() => {
3073
+ if (markedRef.current?.client === client && markedRef.current.localKey === localKey) return;
3074
+ markedRef.current = { client, localKey };
3075
+ void markWelcomeSeen(client);
3076
+ });
3040
3077
  React5.useEffect(() => {
3078
+ if (!catalogReady) return;
3079
+ if (evaluatedRef.current?.client === client && evaluatedRef.current.localKey === localKey)
3080
+ return;
3081
+ evaluatedRef.current = { client, localKey };
3082
+ if (projectsRef.current.length > 0) {
3083
+ markSeen();
3084
+ return;
3085
+ }
3041
3086
  let active = true;
3042
3087
  async function firstVisit() {
3043
3088
  try {
@@ -3055,26 +3100,65 @@ function WelcomeDialog({
3055
3100
  } catch {
3056
3101
  }
3057
3102
  }
3058
- if (active) setOpen(true);
3103
+ if (!active) return;
3104
+ if (projectsRef.current.length > 0) {
3105
+ markSeen();
3106
+ return;
3107
+ }
3108
+ initialIdsRef.current = /* @__PURE__ */ new Set();
3109
+ setOpen(true);
3059
3110
  }
3060
3111
  void firstVisit();
3061
3112
  return () => {
3062
3113
  active = false;
3063
3114
  };
3064
- }, [client, dataInstance, localKey]);
3065
- if (!open) return null;
3066
- function dismiss() {
3067
- setOpen(false);
3068
- void client.invoke(
3069
- { instanceId: dataInstance, operationId: "documents.create" },
3070
- { name: "Studio welcome", payload: { namespace: welcomeKey } },
3071
- { requestKey: welcomeKey }
3072
- ).catch(() => {
3115
+ }, [client, dataInstance, localKey, catalogReady]);
3116
+ React5.useEffect(() => {
3117
+ if (!open || paused || pending) return;
3118
+ const fromCatalog = findCreatedWelcomeProject(initialIdsRef.current, projects);
3119
+ if (fromCatalog) {
3120
+ setOpen(false);
3121
+ markSeen();
3122
+ onProjectEvent(fromCatalog);
3123
+ return;
3124
+ }
3125
+ const listProjects = client.projects?.list;
3126
+ if (!listProjects) return;
3127
+ let active = true;
3128
+ let checking = false;
3129
+ async function checkExternalProject() {
3130
+ if (!active || checking) return;
3131
+ checking = true;
3073
3132
  try {
3074
- localStorage.setItem(localKey, "seen");
3133
+ const latest = await listProjects();
3134
+ if (!active) return;
3135
+ const created = findCreatedWelcomeProject(initialIdsRef.current, latest);
3136
+ if (!created) return;
3137
+ setOpen(false);
3138
+ markSeen();
3139
+ onProjectEvent(created);
3075
3140
  } catch {
3141
+ } finally {
3142
+ checking = false;
3076
3143
  }
3077
- });
3144
+ }
3145
+ const timer = window.setInterval(() => void checkExternalProject(), 1e3);
3146
+ const onWake = () => {
3147
+ if (document.visibilityState !== "hidden") void checkExternalProject();
3148
+ };
3149
+ window.addEventListener("focus", onWake);
3150
+ document.addEventListener("visibilitychange", onWake);
3151
+ return () => {
3152
+ active = false;
3153
+ window.clearInterval(timer);
3154
+ window.removeEventListener("focus", onWake);
3155
+ document.removeEventListener("visibilitychange", onWake);
3156
+ };
3157
+ }, [client, open, paused, pending, projects]);
3158
+ if (!open) return null;
3159
+ function dismiss() {
3160
+ setOpen(false);
3161
+ markSeen();
3078
3162
  }
3079
3163
  async function openSample(sample) {
3080
3164
  if (pending) return;
@@ -3107,6 +3191,7 @@ function WelcomeDialog({
3107
3191
  { requestKey: crypto.randomUUID() }
3108
3192
  );
3109
3193
  }
3194
+ dismiss();
3110
3195
  onProject(project);
3111
3196
  } catch (error2) {
3112
3197
  setError(error2 instanceof Error ? error2.message : String(error2));
@@ -3950,7 +4035,15 @@ function GlobalWorkbench({ client }) {
3950
4035
  if (route.project.view !== view2) navigate({ ...route, project: { ...route.project, view: view2 } });
3951
4036
  requestProjectView.current?.(view2, true);
3952
4037
  }
3953
- const sidebarPreferenceKey = `studio-sidebar-collapsed:${client.project.id}`;
4038
+ const sidebarPreferenceKey = `studio-sidebar-collapsed:${client.project?.id ?? client.scope?.id ?? "user"}`;
4039
+ const [mobileNavigation, setMobileNavigation] = React8.useState(false);
4040
+ React8.useEffect(() => {
4041
+ const media = window.matchMedia("(max-width: 500px)");
4042
+ const update = () => setMobileNavigation(media.matches);
4043
+ update();
4044
+ media.addEventListener("change", update);
4045
+ return () => media.removeEventListener("change", update);
4046
+ }, []);
3954
4047
  const [collapsed, setCollapsed] = React8.useState(() => {
3955
4048
  try {
3956
4049
  return window.localStorage.getItem(sidebarPreferenceKey) === "true";
@@ -4379,6 +4472,7 @@ function GlobalWorkbench({ client }) {
4379
4472
  });
4380
4473
  }
4381
4474
  function onProjectCreated(project) {
4475
+ void markWelcomeSeen(client);
4382
4476
  setCatalog((items) => [...(items ?? []).filter((item) => item.id !== project.id), project]);
4383
4477
  refreshCatalog();
4384
4478
  navigate({
@@ -4994,12 +5088,13 @@ function GlobalWorkbench({ client }) {
4994
5088
  ))
4995
5089
  ));
4996
5090
  })), /* @__PURE__ */ React8.createElement("div", { className: "studio-account" }, /* @__PURE__ */ React8.createElement("span", { className: "studio-user-mark vx-local-user-avatar", "aria-hidden": "true" }), /* @__PURE__ */ React8.createElement("span", null, "Local User"))),
4997
- /* @__PURE__ */ React8.createElement("main", { className: "studio-content" }, /* @__PURE__ */ React8.createElement("div", { className: "studio-mobile-nav" }, /* @__PURE__ */ React8.createElement(
4998
- Dropdown,
5091
+ /* @__PURE__ */ React8.createElement("main", { className: "studio-content" }, /* @__PURE__ */ React8.createElement("header", { className: "studio-mobile-nav" }, mobileNavigation && /* @__PURE__ */ React8.createElement(
5092
+ Menu,
4999
5093
  {
5000
- label: "Workspace page",
5001
- value: route.project ? menu && menu.active !== null && menu.active !== menu.overview && menu.tabs.some((tab) => tab.id === menu.active) ? "view:" + menu.active : "project:" + route.project.id : route.home ? "home" : route.page,
5002
- options: [
5094
+ label: "Workspace navigation",
5095
+ triggerIcon: "menu",
5096
+ floating: true,
5097
+ items: [
5003
5098
  { value: "home", label: "Home" },
5004
5099
  ...pageSources.map((page) => ({ value: page, label: workspaceLabels[page] })),
5005
5100
  ...visibleProjects.filter(({ available }) => available).map((project) => ({
@@ -5007,15 +5102,20 @@ function GlobalWorkbench({ client }) {
5007
5102
  label: projectSummaries.get(project.id)?.name ?? project.name
5008
5103
  })),
5009
5104
  ...menu?.tabs.map(({ id, label }) => ({ value: "view:" + id, label })) ?? []
5010
- ],
5011
- onValueChange: (value) => {
5012
- if (value.startsWith("project:")) openProject(value.slice("project:".length));
5013
- else if (value.startsWith("view:")) openProjectView(value.slice("view:".length));
5014
- else if (value === "home") goHome();
5015
- else go(value);
5016
- }
5105
+ ].map(({ value, label }) => ({
5106
+ id: value,
5107
+ label,
5108
+ icon: value === (route.project ? menu && menu.active !== null && menu.active !== menu.overview && menu.tabs.some((tab) => tab.id === menu.active) ? "view:" + menu.active : "project:" + route.project.id : route.home ? "home" : route.page) ? "check" : void 0,
5109
+ onSelect: () => {
5110
+ if (value.startsWith("project:")) openProject(value.slice("project:".length));
5111
+ else if (value.startsWith("view:"))
5112
+ openProjectView(value.slice("view:".length));
5113
+ else if (value === "home") goHome();
5114
+ else go(value);
5115
+ }
5116
+ }))
5017
5117
  }
5018
- )), !projectEntry && (!route.project || catalogReady || failure) && !route.home && /* @__PURE__ */ React8.createElement("header", { className: "studio-page-header" }, /* @__PURE__ */ React8.createElement("h1", null, route.project ? "Project workbench" : route.page === "assets" ? "Assets" : pageTitles[route.page]), route.project ? /* @__PURE__ */ React8.createElement(
5118
+ ), /* @__PURE__ */ React8.createElement("strong", null, "VIVIX STUDIO")), !projectEntry && (!route.project || catalogReady || failure) && !route.home && /* @__PURE__ */ React8.createElement("header", { className: "studio-page-header" }, /* @__PURE__ */ React8.createElement("h1", null, route.project ? "Project workbench" : route.page === "assets" ? "Assets" : pageTitles[route.page]), route.project ? /* @__PURE__ */ React8.createElement(
5019
5119
  Button,
5020
5120
  {
5021
5121
  label: "Back to workspace",
@@ -5473,6 +5573,9 @@ function GlobalWorkbench({ client }) {
5473
5573
  {
5474
5574
  client,
5475
5575
  instanceId: ownInstance,
5576
+ catalogReady,
5577
+ projects: catalog,
5578
+ paused: creatingProject,
5476
5579
  onCreate: NewProjectDialog ? () => setCreatingProject(true) : void 0,
5477
5580
  onProject: onProjectCreated
5478
5581
  }
package/dist/client.css CHANGED
@@ -4573,6 +4573,13 @@ body:has(.studio-global) {
4573
4573
  }
4574
4574
  .studio-mobile-nav {
4575
4575
  display: none;
4576
+ align-items: center;
4577
+ flex: none;
4578
+ min-height: 40px;
4579
+ gap: var(--vx-space-8);
4580
+ }
4581
+ .studio-mobile-nav > strong {
4582
+ font: var(--vx-typography-inter-16-semi-bold);
4576
4583
  }
4577
4584
  .studio-page-panel {
4578
4585
  display: flex;
@@ -5142,7 +5149,7 @@ body:has(.studio-global) {
5142
5149
  font: var(--vx-typography-inter-14-semi-bold);
5143
5150
  }
5144
5151
  }
5145
- @media (max-width: 760px) {
5152
+ @media (max-width: 500px) {
5146
5153
  .studio-shell {
5147
5154
  min-height: 100dvh;
5148
5155
  height: auto;
@@ -5152,10 +5159,10 @@ body:has(.studio-global) {
5152
5159
  }
5153
5160
  .studio-content {
5154
5161
  overflow: visible;
5155
- padding: 8px 16px;
5162
+ padding: 8px;
5156
5163
  }
5157
5164
  .studio-mobile-nav {
5158
- display: block;
5165
+ display: flex;
5159
5166
  }
5160
5167
  .studio-page-header {
5161
5168
  padding-left: 4px;
@@ -5289,12 +5296,12 @@ body:has(.studio-global) {
5289
5296
  color: var(--vx-text-primary);
5290
5297
  font: var(--vx-typography-inter-14-medium);
5291
5298
  }
5292
- @media (max-width: 760px) {
5299
+ @media (max-width: 500px) {
5293
5300
  .studio-shell[data-project] {
5294
5301
  height: 100dvh;
5295
5302
  }
5296
5303
  .studio-shell[data-project] .studio-mobile-nav {
5297
- padding: 8px 12px;
5304
+ padding: 8px;
5298
5305
  }
5299
5306
  }
5300
5307
  .studio-sidebar nav > button > .studio-nav-icon {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vivix-labs/studio-workbench",
3
- "version": "1.0.0-beta.17",
3
+ "version": "1.0.0-beta.19",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "public",
@@ -44,12 +44,9 @@
44
44
  "archiver": "7.0.1"
45
45
  },
46
46
  "devDependencies": {
47
- "@vivix-labs/project-studio": "workspace:*",
48
- "@vivix-labs/ui-system": "workspace:*",
49
- "@types/archiver": "7.0.0"
50
- },
51
- "scripts": {
52
- "build": "node ../../scripts/build-product-packages.mjs studio-workbench"
47
+ "@types/archiver": "7.0.0",
48
+ "@vivix-labs/project-studio": "1.0.0-beta.17",
49
+ "@vivix-labs/ui-system": "1.0.0-beta.17"
53
50
  },
54
51
  "vivixStudio": {
55
52
  "runtimePlugins": {
@@ -70,11 +67,14 @@
70
67
  "@vivix-labs/short-drama-storyboard": "1.0.0-beta.17",
71
68
  "@vivix-labs/short-drama-workbench": "1.0.0-beta.17",
72
69
  "@vivix-labs/studio-asset-list": "1.0.0-beta.17",
73
- "@vivix-labs/studio-workbench": "1.0.0-beta.17",
70
+ "@vivix-labs/studio-workbench": "1.0.0-beta.19",
74
71
  "@vivix-labs/vivix-api": "1.0.0-beta.17",
75
72
  "@vivix-labs/ads-workbench": "1.0.0-beta.17",
76
73
  "@vivix-labs/chat-components": "1.0.0-beta.17",
77
74
  "@vivix-labs/short-drama-authoring": "1.0.0-beta.17"
78
75
  }
76
+ },
77
+ "scripts": {
78
+ "build": "node ../../scripts/build-product-packages.mjs studio-workbench"
79
79
  }
80
- }
80
+ }
@@ -39,7 +39,7 @@
39
39
  {
40
40
  "id": "workbench",
41
41
  "package": "@vivix-labs/studio-workbench",
42
- "version": "1.0.0-beta.17",
42
+ "version": "1.0.0-beta.19",
43
43
  "enabled": true,
44
44
  "config": {
45
45
  "studioInstance": "studio",
@@ -79,7 +79,7 @@
79
79
  {
80
80
  "id": "workbench",
81
81
  "package": "@vivix-labs/studio-workbench",
82
- "version": "1.0.0-beta.17",
82
+ "version": "1.0.0-beta.19",
83
83
  "enabled": true,
84
84
  "config": {
85
85
  "studioInstance": "coordinator",