camox 0.65.1 → 0.66.0

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.
Files changed (30) hide show
  1. package/dist/features/canvas/CamoxCanvas.js +195 -173
  2. package/dist/features/canvas/canvasFrameCapture.js +5 -12
  3. package/dist/features/canvas/canvasFrameDocument.js +90 -29
  4. package/dist/features/canvas/canvasItems.js +22 -6
  5. package/dist/features/canvas/sidebar/ContentSidebar.js +19 -21
  6. package/dist/features/canvas/sidebar/LayoutPageOverview.js +22 -49
  7. package/dist/features/canvas/sidebar/LayoutPageSeo.js +73 -76
  8. package/dist/features/canvas/sidebar/PageInspector.js +61 -50
  9. package/dist/features/canvas/sidebar/PageInspectorSkeleton.js +4 -4
  10. package/dist/features/canvas/useCanvasCamera.js +22 -5
  11. package/dist/features/preview/components/PageInfo.js +103 -100
  12. package/dist/features/runtime/RuntimeChrome.js +66 -40
  13. package/dist/features/studio/components/AgentSidebar.js +3 -3
  14. package/dist/features/studio/components/ChatWidget.js +34 -29
  15. package/dist/features/studio/components/DraftsControl.js +172 -159
  16. package/dist/features/studio/components/Patrol.js +423 -418
  17. package/dist/features/studio/components/ReviewDraftSheet.js +227 -188
  18. package/dist/features/studio/components/ThreadComposer.js +183 -121
  19. package/dist/features/studio/components/ThreadMessages.js +19 -11
  20. package/dist/features/studio/components/UnnamedDraftBar.js +349 -0
  21. package/dist/features/studio/patrollerBio.js +40 -0
  22. package/dist/features/studio/studioStore.js +13 -0
  23. package/dist/features/studio/workingSentence.js +2 -7
  24. package/dist/lib/revisions.js +25 -3
  25. package/dist/lib/use-thread.js +1 -1
  26. package/dist/package.js +1 -1
  27. package/dist/studio.css +1 -1
  28. package/package.json +4 -4
  29. package/dist/features/canvas/sidebar/DerivedPageInspector.js +0 -49
  30. package/dist/features/canvas/sidebar/SingletonPageInspector.js +0 -39
@@ -98,7 +98,7 @@ function useDrafts() {
98
98
  * still names what the studio is viewing.
99
99
  */
100
100
  function DraftPicker(t0) {
101
- const $ = c(64);
101
+ const $ = c(66);
102
102
  const { disabled: t1 } = t0;
103
103
  const disabled = t1 === void 0 ? false : t1;
104
104
  const { draftScope, draftId, projectId, list, current } = useDrafts();
@@ -149,11 +149,13 @@ function DraftPicker(t0) {
149
149
  } else t6 = $[9];
150
150
  const switchTo = t6;
151
151
  const t7 = !!projectId;
152
- let t8;
153
- if ($[10] !== draftId || $[11] !== drafts || $[12] !== switchTo || $[13] !== t7) {
154
- t8 = {
152
+ const t8 = current?.name === null;
153
+ let t9;
154
+ if ($[10] !== draftId || $[11] !== drafts || $[12] !== switchTo || $[13] !== t7 || $[14] !== t8) {
155
+ t9 = {
155
156
  enabled: t7,
156
157
  draftId,
158
+ unnamed: t8,
157
159
  drafts,
158
160
  switchTo
159
161
  };
@@ -162,171 +164,172 @@ function DraftPicker(t0) {
162
164
  $[12] = switchTo;
163
165
  $[13] = t7;
164
166
  $[14] = t8;
165
- } else t8 = $[14];
166
- useDraftsActions(t8);
167
+ $[15] = t9;
168
+ } else t9 = $[15];
169
+ useDraftsActions(t9);
167
170
  if (draftId && !current) return null;
168
- let t9;
169
- if ($[15] === Symbol.for("react.memo_cache_sentinel")) {
170
- t9 = /* @__PURE__ */ jsx(Button, {
171
+ let t10;
172
+ if ($[16] === Symbol.for("react.memo_cache_sentinel")) {
173
+ t10 = /* @__PURE__ */ jsx(Button, {
171
174
  type: "button",
172
175
  variant: "ghost"
173
176
  });
174
- $[15] = t9;
175
- } else t9 = $[15];
176
- const t10 = draftId ? "bg-blue-500" : "bg-emerald-500";
177
- let t11;
178
- if ($[16] !== t10) {
179
- t11 = cn("size-2 shrink-0 rounded-full", t10);
180
177
  $[16] = t10;
181
- $[17] = t11;
182
- } else t11 = $[17];
178
+ } else t10 = $[16];
179
+ const t11 = draftId ? "bg-blue-500" : "bg-emerald-500";
183
180
  let t12;
184
- if ($[18] !== t11) {
185
- t12 = /* @__PURE__ */ jsx("span", {
181
+ if ($[17] !== t11) {
182
+ t12 = cn("size-2 shrink-0 rounded-full", t11);
183
+ $[17] = t11;
184
+ $[18] = t12;
185
+ } else t12 = $[18];
186
+ let t13;
187
+ if ($[19] !== t12) {
188
+ t13 = /* @__PURE__ */ jsx("span", {
186
189
  "aria-hidden": true,
187
- className: t11
190
+ className: t12
188
191
  });
189
- $[18] = t11;
190
192
  $[19] = t12;
191
- } else t12 = $[19];
192
- let t13;
193
- if ($[20] !== current || $[21] !== draftId) {
194
- t13 = draftId ? draftLabel(current) : "Live";
195
- $[20] = current;
196
- $[21] = draftId;
197
- $[22] = t13;
198
- } else t13 = $[22];
193
+ $[20] = t13;
194
+ } else t13 = $[20];
199
195
  let t14;
200
- if ($[23] !== t13) {
201
- t14 = /* @__PURE__ */ jsx("span", {
196
+ if ($[21] !== current || $[22] !== draftId) {
197
+ t14 = draftId ? draftLabel(current) : "Live";
198
+ $[21] = current;
199
+ $[22] = draftId;
200
+ $[23] = t14;
201
+ } else t14 = $[23];
202
+ let t15;
203
+ if ($[24] !== t14) {
204
+ t15 = /* @__PURE__ */ jsx("span", {
202
205
  className: "max-w-48 truncate",
203
- children: t13
206
+ children: t14
204
207
  });
205
- $[23] = t13;
206
208
  $[24] = t14;
207
- } else t14 = $[24];
208
- let t15;
209
- if ($[25] === Symbol.for("react.memo_cache_sentinel")) {
210
- t15 = /* @__PURE__ */ jsx(ChevronsUpDown, {
211
- "aria-hidden": true,
212
- className: "size-4 opacity-50"
213
- });
214
209
  $[25] = t15;
215
210
  } else t15 = $[25];
216
211
  let t16;
217
- if ($[26] !== disabled || $[27] !== t12 || $[28] !== t14) {
218
- t16 = /* @__PURE__ */ jsxs(DropdownMenuTrigger, {
212
+ if ($[26] === Symbol.for("react.memo_cache_sentinel")) {
213
+ t16 = /* @__PURE__ */ jsx(ChevronsUpDown, {
214
+ "aria-hidden": true,
215
+ className: "size-4 opacity-50"
216
+ });
217
+ $[26] = t16;
218
+ } else t16 = $[26];
219
+ let t17;
220
+ if ($[27] !== disabled || $[28] !== t13 || $[29] !== t15) {
221
+ t17 = /* @__PURE__ */ jsxs(DropdownMenuTrigger, {
219
222
  disabled,
220
- render: t9,
223
+ render: t10,
221
224
  children: [
222
- t12,
223
- t14,
224
- t15
225
+ t13,
226
+ t15,
227
+ t16
225
228
  ]
226
229
  });
227
- $[26] = disabled;
228
- $[27] = t12;
229
- $[28] = t14;
230
- $[29] = t16;
231
- } else t16 = $[29];
232
- let t17;
233
- if ($[30] !== draftId) {
234
- t17 = !draftId && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(DropdownMenuGroup, { children: /* @__PURE__ */ jsx(DropdownMenuLabel, {
230
+ $[27] = disabled;
231
+ $[28] = t13;
232
+ $[29] = t15;
233
+ $[30] = t17;
234
+ } else t17 = $[30];
235
+ let t18;
236
+ if ($[31] !== draftId) {
237
+ t18 = !draftId && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(DropdownMenuGroup, { children: /* @__PURE__ */ jsx(DropdownMenuLabel, {
235
238
  className: "text-muted-foreground font-normal",
236
239
  children: "Live is read-only. Your first edit starts a new draft."
237
240
  }) }), /* @__PURE__ */ jsx(DropdownMenuSeparator, {})] });
238
- $[30] = draftId;
239
- $[31] = t17;
240
- } else t17 = $[31];
241
- const t18 = draftId ?? LIVE;
242
- let t19;
243
- if ($[32] !== switchTo) {
244
- t19 = (value) => switchTo(value === LIVE ? null : String(value));
245
- $[32] = switchTo;
246
- $[33] = t19;
247
- } else t19 = $[33];
241
+ $[31] = draftId;
242
+ $[32] = t18;
243
+ } else t18 = $[32];
244
+ const t19 = draftId ?? LIVE;
248
245
  let t20;
249
- if ($[34] === Symbol.for("react.memo_cache_sentinel")) {
250
- t20 = /* @__PURE__ */ jsx(DropdownMenuLabel, { children: "Switch to" });
246
+ if ($[33] !== switchTo) {
247
+ t20 = (value) => switchTo(value === LIVE ? null : String(value));
248
+ $[33] = switchTo;
251
249
  $[34] = t20;
252
250
  } else t20 = $[34];
253
251
  let t21;
254
252
  if ($[35] === Symbol.for("react.memo_cache_sentinel")) {
255
- t21 = /* @__PURE__ */ jsx("span", { children: "Live" });
253
+ t21 = /* @__PURE__ */ jsx(DropdownMenuLabel, { children: "Switch to" });
256
254
  $[35] = t21;
257
255
  } else t21 = $[35];
258
256
  let t22;
259
- if ($[36] !== list) {
260
- t22 = list && /* @__PURE__ */ jsx("span", {
257
+ if ($[36] === Symbol.for("react.memo_cache_sentinel")) {
258
+ t22 = /* @__PURE__ */ jsx("span", { children: "Live" });
259
+ $[36] = t22;
260
+ } else t22 = $[36];
261
+ let t23;
262
+ if ($[37] !== list) {
263
+ t23 = list && /* @__PURE__ */ jsx("span", {
261
264
  className: "text-muted-foreground text-xs",
262
265
  children: liveLine(list.live)
263
266
  });
264
- $[36] = list;
265
- $[37] = t22;
266
- } else t22 = $[37];
267
- let t23;
268
- if ($[38] !== t22) {
269
- t23 = /* @__PURE__ */ jsx(DropdownMenuRadioItem, {
267
+ $[37] = list;
268
+ $[38] = t23;
269
+ } else t23 = $[38];
270
+ let t24;
271
+ if ($[39] !== t23) {
272
+ t24 = /* @__PURE__ */ jsx(DropdownMenuRadioItem, {
270
273
  value: LIVE,
271
274
  closeOnClick: true,
272
275
  children: /* @__PURE__ */ jsxs("div", {
273
276
  className: "flex flex-col",
274
- children: [t21, t22]
277
+ children: [t22, t23]
275
278
  })
276
279
  });
277
- $[38] = t22;
278
280
  $[39] = t23;
279
- } else t23 = $[39];
280
- let t24;
281
- if ($[40] !== drafts) {
282
- t24 = drafts.map(_temp6);
283
- $[40] = drafts;
284
- $[41] = t24;
285
- } else t24 = $[41];
281
+ $[40] = t24;
282
+ } else t24 = $[40];
286
283
  let t25;
287
- if ($[42] !== t23 || $[43] !== t24) {
288
- t25 = /* @__PURE__ */ jsxs(DropdownMenuGroup, { children: [
289
- t20,
290
- t23,
291
- t24
284
+ if ($[41] !== drafts) {
285
+ t25 = drafts.map(_temp6);
286
+ $[41] = drafts;
287
+ $[42] = t25;
288
+ } else t25 = $[42];
289
+ let t26;
290
+ if ($[43] !== t24 || $[44] !== t25) {
291
+ t26 = /* @__PURE__ */ jsxs(DropdownMenuGroup, { children: [
292
+ t21,
293
+ t24,
294
+ t25
292
295
  ] });
293
- $[42] = t23;
294
296
  $[43] = t24;
295
297
  $[44] = t25;
296
- } else t25 = $[44];
297
- let t26;
298
- if ($[45] !== t18 || $[46] !== t19 || $[47] !== t25) {
299
- t26 = /* @__PURE__ */ jsx(DropdownMenuRadioGroup, {
300
- value: t18,
301
- onValueChange: t19,
302
- children: t25
298
+ $[45] = t26;
299
+ } else t26 = $[45];
300
+ let t27;
301
+ if ($[46] !== t19 || $[47] !== t20 || $[48] !== t26) {
302
+ t27 = /* @__PURE__ */ jsx(DropdownMenuRadioGroup, {
303
+ value: t19,
304
+ onValueChange: t20,
305
+ children: t26
303
306
  });
304
- $[45] = t18;
305
307
  $[46] = t19;
306
- $[47] = t25;
308
+ $[47] = t20;
307
309
  $[48] = t26;
308
- } else t26 = $[48];
309
- let t27;
310
- if ($[49] !== t17 || $[50] !== t26) {
311
- t27 = /* @__PURE__ */ jsx(DropdownMenuContent, {
310
+ $[49] = t27;
311
+ } else t27 = $[49];
312
+ let t28;
313
+ if ($[50] !== t18 || $[51] !== t27) {
314
+ t28 = /* @__PURE__ */ jsx(DropdownMenuContent, {
312
315
  className: "w-80",
313
316
  align: "start",
314
- children: /* @__PURE__ */ jsxs(Fragment, { children: [t17, t26] })
317
+ children: /* @__PURE__ */ jsxs(Fragment, { children: [t18, t27] })
315
318
  });
316
- $[49] = t17;
317
- $[50] = t26;
319
+ $[50] = t18;
318
320
  $[51] = t27;
319
- } else t27 = $[51];
320
- let t28;
321
- if ($[52] !== t16 || $[53] !== t27) {
322
- t28 = /* @__PURE__ */ jsxs(DropdownMenu, { children: [t16, t27] });
323
- $[52] = t16;
324
- $[53] = t27;
325
- $[54] = t28;
326
- } else t28 = $[54];
321
+ $[52] = t28;
322
+ } else t28 = $[52];
327
323
  let t29;
328
- if ($[55] !== deleting || $[56] !== draftId || $[57] !== leaveDraft || $[58] !== projectId || $[59] !== review) {
329
- t29 = draftId && projectId && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(ReviewDraftSheet, {
324
+ if ($[53] !== t17 || $[54] !== t28) {
325
+ t29 = /* @__PURE__ */ jsxs(DropdownMenu, { children: [t17, t28] });
326
+ $[53] = t17;
327
+ $[54] = t28;
328
+ $[55] = t29;
329
+ } else t29 = $[55];
330
+ let t30;
331
+ if ($[56] !== current?.name || $[57] !== deleting || $[58] !== draftId || $[59] !== leaveDraft || $[60] !== projectId || $[61] !== review) {
332
+ t30 = draftId && projectId && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(ReviewDraftSheet, {
330
333
  projectId,
331
334
  draftId,
332
335
  open: review.open,
@@ -335,24 +338,26 @@ function DraftPicker(t0) {
335
338
  }), /* @__PURE__ */ jsx(DeleteDraftDialog, {
336
339
  projectId,
337
340
  open: deleting,
341
+ discard: current?.name === null,
338
342
  onOpenChange: _temp8,
339
- onDeleted: leaveDraft
343
+ onDeleted: (ended) => leaveDraft(ended, { discarded: current?.name === null })
340
344
  })] });
341
- $[55] = deleting;
342
- $[56] = draftId;
343
- $[57] = leaveDraft;
344
- $[58] = projectId;
345
- $[59] = review;
346
- $[60] = t29;
347
- } else t29 = $[60];
348
- let t30;
349
- if ($[61] !== t28 || $[62] !== t29) {
350
- t30 = /* @__PURE__ */ jsxs(Fragment, { children: [t28, t29] });
351
- $[61] = t28;
352
- $[62] = t29;
353
- $[63] = t30;
354
- } else t30 = $[63];
355
- return t30;
345
+ $[56] = current?.name;
346
+ $[57] = deleting;
347
+ $[58] = draftId;
348
+ $[59] = leaveDraft;
349
+ $[60] = projectId;
350
+ $[61] = review;
351
+ $[62] = t30;
352
+ } else t30 = $[62];
353
+ let t31;
354
+ if ($[63] !== t29 || $[64] !== t30) {
355
+ t31 = /* @__PURE__ */ jsxs(Fragment, { children: [t29, t30] });
356
+ $[63] = t29;
357
+ $[64] = t30;
358
+ $[65] = t31;
359
+ } else t31 = $[65];
360
+ return t31;
356
361
  }
357
362
  function _temp8(open_0) {
358
363
  if (!open_0) studioStore.send({ type: "closeDeleteDraftDialog" });
@@ -369,6 +374,7 @@ function _temp5() {
369
374
  function _temp4() {
370
375
  studioStore.send({ type: "closeReviewDraftSheet" });
371
376
  studioStore.send({ type: "closeDeleteDraftDialog" });
377
+ studioStore.send({ type: "closeKeepDraft" });
372
378
  }
373
379
  function _temp3(t0) {
374
380
  const { move } = t0;
@@ -382,12 +388,12 @@ function _temp(state) {
382
388
  }
383
389
  /**
384
390
  * The current draft's pending changes, which open its review to publish or delete them. Live
385
- * has none, so it shows nothing there.
391
+ * has none, so it shows nothing there. An unnamed draft shows the Unnamed Draft Bar instead.
386
392
  */
387
393
  function PendingChanges() {
388
394
  const $ = c(7);
389
395
  const { current } = useDrafts();
390
- if (!current) return null;
396
+ if (!current || current.name === null) return null;
391
397
  let t0;
392
398
  if ($[0] !== current.changeCount) {
393
399
  t0 = plural(current.changeCount, "change");
@@ -426,11 +432,11 @@ function _temp9() {
426
432
  * deletes by itself.
427
433
  */
428
434
  function useDraftsActions(t0) {
429
- const $ = c(6);
430
- const { enabled, draftId, drafts, switchTo } = t0;
435
+ const $ = c(7);
436
+ const { enabled, draftId, unnamed, drafts, switchTo } = t0;
431
437
  let t1;
432
438
  let t2;
433
- if ($[0] !== draftId || $[1] !== drafts || $[2] !== enabled || $[3] !== switchTo) {
439
+ if ($[0] !== draftId || $[1] !== drafts || $[2] !== enabled || $[3] !== switchTo || $[4] !== unnamed) {
434
440
  t1 = () => {
435
441
  const inDraft = enabled && !!draftId;
436
442
  const others = drafts.filter((listed) => listed.id !== draftId);
@@ -451,11 +457,15 @@ function useDraftsActions(t0) {
451
457
  },
452
458
  {
453
459
  id: "delete-draft",
454
- label: "Delete draft…",
455
- aliases: [
460
+ label: unnamed ? "Discard changes…" : "Delete draft…",
461
+ aliases: unnamed ? [
456
462
  "Delete draft",
457
463
  "Throw away changes",
458
464
  "Revert changes"
465
+ ] : [
466
+ "Discard changes",
467
+ "Throw away changes",
468
+ "Revert changes"
459
469
  ],
460
470
  groupLabel: "Drafts",
461
471
  checkIfAvailable: () => inDraft,
@@ -463,11 +473,18 @@ function useDraftsActions(t0) {
463
473
  },
464
474
  {
465
475
  id: "rename-draft",
466
- label: "Rename draft…",
467
- aliases: ["Name draft"],
476
+ label: unnamed ? "Keep as draft…" : "Rename draft…",
477
+ aliases: unnamed ? [
478
+ "Name draft",
479
+ "Rename draft",
480
+ "Save draft"
481
+ ] : ["Name draft"],
468
482
  groupLabel: "Drafts",
469
483
  checkIfAvailable: () => inDraft,
470
- execute: _temp12
484
+ execute: () => studioStore.send(unnamed ? { type: "openKeepDraft" } : {
485
+ type: "openReviewDraftSheet",
486
+ startRenaming: true
487
+ })
471
488
  },
472
489
  {
473
490
  id: "switch-to-live",
@@ -493,7 +510,7 @@ function useDraftsActions(t0) {
493
510
  groupLabel: "Drafts",
494
511
  checkIfAvailable: () => others.length > 0,
495
512
  hasChildren: true,
496
- execute: _temp13
513
+ execute: _temp12
497
514
  },
498
515
  ...others.map((other) => ({
499
516
  id: `${SWITCH_TO_DRAFT_ID}-${other.id}`,
@@ -501,7 +518,7 @@ function useDraftsActions(t0) {
501
518
  label: `Switch to "${draftLabel(other)}"`,
502
519
  aliases: [other.createdBy.name],
503
520
  groupLabel: "Drafts",
504
- checkIfAvailable: _temp14,
521
+ checkIfAvailable: _temp13,
505
522
  execute: () => switchTo(other.id)
506
523
  }))
507
524
  ];
@@ -512,13 +529,14 @@ function useDraftsActions(t0) {
512
529
  return () => {
513
530
  actionsStore.send({
514
531
  type: "unregisterManyActions",
515
- ids: actions.map(_temp15)
532
+ ids: actions.map(_temp14)
516
533
  });
517
534
  };
518
535
  };
519
536
  t2 = [
520
537
  enabled,
521
538
  draftId,
539
+ unnamed,
522
540
  drafts,
523
541
  switchTo
524
542
  ];
@@ -526,27 +544,22 @@ function useDraftsActions(t0) {
526
544
  $[1] = drafts;
527
545
  $[2] = enabled;
528
546
  $[3] = switchTo;
529
- $[4] = t1;
530
- $[5] = t2;
547
+ $[4] = unnamed;
548
+ $[5] = t1;
549
+ $[6] = t2;
531
550
  } else {
532
- t1 = $[4];
533
- t2 = $[5];
551
+ t1 = $[5];
552
+ t2 = $[6];
534
553
  }
535
554
  React.useEffect(t1, t2);
536
555
  }
537
- function _temp15(a) {
556
+ function _temp14(a) {
538
557
  return a.id;
539
558
  }
540
- function _temp14() {
559
+ function _temp13() {
541
560
  return true;
542
561
  }
543
- function _temp13() {}
544
- function _temp12() {
545
- return studioStore.send({
546
- type: "openReviewDraftSheet",
547
- startRenaming: true
548
- });
549
- }
562
+ function _temp12() {}
550
563
  function _temp11() {
551
564
  return studioStore.send({ type: "openDeleteDraftDialog" });
552
565
  }
@@ -635,4 +648,4 @@ function DraftItem(t0) {
635
648
  }
636
649
 
637
650
  //#endregion
638
- export { DraftPicker, PendingChanges };
651
+ export { DraftPicker, PendingChanges, useDrafts };