camox 0.75.0 → 0.76.1

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 (72) hide show
  1. package/dist/core/editing/createEditableBlock.js +1077 -1681
  2. package/dist/core/editing/fieldSlot.js +251 -0
  3. package/dist/core/editing/useFieldSlot.js +159 -0
  4. package/dist/core/layoutContext.d.ts +2 -0
  5. package/dist/core/layoutContext.js +27 -1
  6. package/dist/features/canvas/CanvasPageFrame.js +2 -2
  7. package/dist/features/canvas/CanvasPreviewPageSlot.js +1 -1
  8. package/dist/features/canvas/canvasCameraController.js +595 -0
  9. package/dist/features/canvas/useCanvasCamera.js +141 -587
  10. package/dist/features/canvas/useCanvasFrame.js +1 -1
  11. package/dist/features/page/DerivedPageContent.js +4 -8
  12. package/dist/features/preview/components/AssetLightbox.js +6 -65
  13. package/dist/features/preview/components/CanvasPreview.js +2 -2
  14. package/dist/features/preview/components/Frame.js +3 -3
  15. package/dist/features/preview/components/ItemFieldsEditor.js +376 -460
  16. package/dist/features/preview/components/Overlays.js +4 -9
  17. package/dist/features/preview/components/PreviewPanel.js +3 -3
  18. package/dist/features/preview/components/RemovedBlockPlaceholder.js +2 -2
  19. package/dist/features/preview/components/SelectionEditor.js +285 -339
  20. package/dist/features/preview/components/ZoomableImage.js +105 -0
  21. package/dist/features/preview/components/contentFieldSchema.js +3 -1
  22. package/dist/features/preview/components/useFieldWriter.js +30 -51
  23. package/dist/features/preview/components/useRecordView.js +3 -3
  24. package/dist/features/preview/overlayMessages.js +20 -58
  25. package/dist/features/preview/previewStore.js +6 -123
  26. package/dist/features/preview/repeatableItemPath.js +47 -0
  27. package/dist/features/provider/AuthenticatedCamoxProvider.js +75 -63
  28. package/dist/features/renderer/RendererApp.js +6 -6
  29. package/dist/features/renderer/RendererFrames.js +2 -2
  30. package/dist/features/renderer/rendererHost.js +1 -1
  31. package/dist/features/routes/pageRuntime.d.ts +8 -12
  32. package/dist/features/routes/pageRuntime.js +26 -106
  33. package/dist/features/runtime/pageApp.js +1 -1
  34. package/dist/features/runtime/pageRead.js +105 -0
  35. package/dist/features/runtime/reader.d.ts +25 -0
  36. package/dist/features/runtime/reader.js +142 -0
  37. package/dist/features/runtime/runtime.d.ts +9 -3
  38. package/dist/features/runtime/runtime.js +608 -776
  39. package/dist/features/sdkBundle/buildSdkBundle.d.ts +5 -0
  40. package/dist/features/sdkBundle/buildSdkBundle.js +9 -3
  41. package/dist/features/studio/components/ChatWidget.js +137 -121
  42. package/dist/features/studio/components/ClearThread.js +121 -0
  43. package/dist/features/studio/components/DeleteDraftDialog.js +67 -65
  44. package/dist/features/studio/components/DraftBar.js +60 -49
  45. package/dist/features/studio/components/DraftNotices.js +149 -0
  46. package/dist/features/studio/components/DraftsControl.js +217 -180
  47. package/dist/features/studio/components/DraftsSheet.js +446 -0
  48. package/dist/features/studio/components/PublishedTab.js +511 -0
  49. package/dist/features/studio/components/ReviewDraftDialog.js +104 -89
  50. package/dist/features/studio/components/SheetTable.js +46 -0
  51. package/dist/features/studio/components/Specialists.js +1 -1
  52. package/dist/features/studio/components/ThreadMessages.js +227 -176
  53. package/dist/features/studio/draftLabel.js +15 -1
  54. package/dist/features/studio/draftNotice.js +1 -0
  55. package/dist/features/studio/showInCanvas.js +9 -19
  56. package/dist/features/studio/studioStore.js +5 -5
  57. package/dist/features/studio/useArchiveDraft.js +60 -0
  58. package/dist/features/studio/useEditorSelection.js +8 -19
  59. package/dist/features/studio/useRestoreDraft.js +70 -0
  60. package/dist/features/studio/viewSwitch.js +19 -11
  61. package/dist/lib/draft-scope.d.ts +1 -1
  62. package/dist/lib/draft-scope.js +6 -3
  63. package/dist/lib/queries.js +12 -1
  64. package/dist/lib/studio-reads.js +22 -0
  65. package/dist/lib/use-project-room.js +19 -13
  66. package/dist/lib/use-thread.js +1 -1
  67. package/dist/package.js +1 -1
  68. package/dist/studio.css +1 -1
  69. package/package.json +4 -4
  70. package/dist/core/hooks/useFieldSelection.js +0 -67
  71. package/dist/core/hooks/useIsEditable.js +0 -21
  72. package/dist/core/hooks/useOverlayMessage.js +0 -70
@@ -3,6 +3,7 @@ import { useViewLocale } from "../../lib/view-locale-context.js";
3
3
  import { useLocation, useNavigate } from "../navigation/navigation.js";
4
4
  import { useProjectUuid } from "../../lib/auth.js";
5
5
  import { reads, useStudioCache } from "../../lib/studio-reads.js";
6
+ import { fieldOwner, ownerSelection, slotSelection } from "../../core/editing/fieldSlot.js";
6
7
  import { previewStore, sameEditingOwner } from "../preview/previewStore.js";
7
8
  import { fieldTypesDictionary } from "../../core/lib/fieldTypes.js";
8
9
  import { c } from "react/compiler-runtime";
@@ -18,27 +19,16 @@ const isFieldType = (kind) => !!kind && Object.hasOwn(fieldTypesDictionary, kind
18
19
  /** What to select on the target's page: its field, else its item or block, else nothing. */
19
20
  function selectionOf({ blockId, itemId, field }) {
20
21
  if (!blockId) return null;
21
- const fieldType = field && isFieldType(field.kind) ? field.kind : null;
22
- if (itemId) return field && fieldType ? {
23
- type: "item-field",
24
- blockId,
25
- itemId,
26
- fieldName: field.name,
27
- fieldType
28
- } : {
29
- type: "item",
22
+ const owner = fieldOwner({
30
23
  blockId,
31
24
  itemId
32
- };
33
- return field && fieldType ? {
34
- type: "block-field",
35
- blockId,
36
- fieldName: field.name,
37
- fieldType
38
- } : {
39
- type: "block",
40
- blockId
41
- };
25
+ });
26
+ if (!field || !isFieldType(field.kind)) return ownerSelection(owner);
27
+ return slotSelection({
28
+ owner,
29
+ name: field.name,
30
+ type: field.kind
31
+ });
42
32
  }
43
33
  /** Stops selecting what was last shown in the Canvas. */
44
34
  let stopSelecting = null;
@@ -6,7 +6,7 @@ const studioStore = createStore({
6
6
  isCommandPaletteOpen: false,
7
7
  commandPalettePages: [],
8
8
  isReviewDraftDialogOpen: false,
9
- isDeleteDraftDialogOpen: false,
9
+ isDraftsSheetOpen: false,
10
10
  localeDialog: null,
11
11
  websiteLocation: null,
12
12
  agentMessages: [],
@@ -58,16 +58,16 @@ const studioStore = createStore({
58
58
  isReviewDraftDialogOpen: false
59
59
  };
60
60
  },
61
- openDeleteDraftDialog: (context) => {
61
+ openDraftsSheet: (context) => {
62
62
  return {
63
63
  ...context,
64
- isDeleteDraftDialogOpen: true
64
+ isDraftsSheetOpen: true
65
65
  };
66
66
  },
67
- closeDeleteDraftDialog: (context) => {
67
+ closeDraftsSheet: (context) => {
68
68
  return {
69
69
  ...context,
70
- isDeleteDraftDialogOpen: false
70
+ isDraftsSheetOpen: false
71
71
  };
72
72
  },
73
73
  openLocaleDialog: (context, event) => {
@@ -0,0 +1,60 @@
1
+ import { draftMutations } from "../../lib/queries.js";
2
+ import { useLeaveDraft } from "./viewSwitch.js";
3
+ import { c } from "react/compiler-runtime";
4
+ import { useMutation } from "@tanstack/react-query";
5
+ import { toast } from "@camox/ui/toaster";
6
+
7
+ //#region src/features/studio/useArchiveDraft.ts
8
+ /**
9
+ * Archives the draft the studio views, then switches to Live (ADR 0046). Archiving loses nothing
10
+ * and any member can restore the draft, so it asks for no confirmation.
11
+ */
12
+ function useArchiveDraft(projectId) {
13
+ const $ = c(9);
14
+ const leaveDraft = useLeaveDraft();
15
+ let t0;
16
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
17
+ t0 = draftMutations.archive();
18
+ $[0] = t0;
19
+ } else t0 = $[0];
20
+ let t1;
21
+ if ($[1] !== leaveDraft) {
22
+ t1 = {
23
+ ...t0,
24
+ onSuccess: (t2) => {
25
+ const { archived } = t2;
26
+ return leaveDraft(archived);
27
+ },
28
+ onError: _temp
29
+ };
30
+ $[1] = leaveDraft;
31
+ $[2] = t1;
32
+ } else t1 = $[2];
33
+ const archive = useMutation(t1);
34
+ let t2;
35
+ if ($[3] !== archive || $[4] !== projectId) {
36
+ t2 = () => {
37
+ if (projectId) archive.mutate({ projectId });
38
+ };
39
+ $[3] = archive;
40
+ $[4] = projectId;
41
+ $[5] = t2;
42
+ } else t2 = $[5];
43
+ let t3;
44
+ if ($[6] !== archive.isPending || $[7] !== t2) {
45
+ t3 = {
46
+ archive: t2,
47
+ archiving: archive.isPending
48
+ };
49
+ $[6] = archive.isPending;
50
+ $[7] = t2;
51
+ $[8] = t3;
52
+ } else t3 = $[8];
53
+ return t3;
54
+ }
55
+ function _temp(error) {
56
+ return toast.error(error.message || "Could not archive the draft");
57
+ }
58
+
59
+ //#endregion
60
+ export { useArchiveDraft };
@@ -1,11 +1,11 @@
1
1
  import { placedRecords } from "../../lib/normalized-data.js";
2
2
  import { reads, useReadQuery } from "../../lib/studio-reads.js";
3
3
  import { useBlockDefinition, useCollectionDefinition } from "../../lib/studio-definitions.js";
4
- import { isBlockPlacement, previewStore, selectionBlockId, selectionForOwner, selectionItemId } from "../preview/previewStore.js";
4
+ import { isBlockPlacement, slotOf } from "../../core/editing/fieldSlot.js";
5
+ import { previewStore, selectionBlockId, selectionForOwner, selectionItemId } from "../preview/previewStore.js";
5
6
  import { entityName } from "../preview/entityName.js";
6
- import { contentFieldSchema } from "../preview/components/contentFieldSchema.js";
7
- import { formatFieldName } from "../preview/components/ItemFieldsEditor.js";
8
- import { getSchemaForItem } from "../preview/components/SelectionEditor.js";
7
+ import { itemContentSchema, itemPath } from "../preview/repeatableItemPath.js";
8
+ import { contentFieldSchema, formatFieldName } from "../preview/components/contentFieldSchema.js";
9
9
  import { c } from "react/compiler-runtime";
10
10
  import { useSelector } from "@xstate/store-react";
11
11
 
@@ -32,14 +32,8 @@ function editorSelectionOf({ selection, block, items, schema, records, recordSch
32
32
  for (const item of items) path.push(entityName(item, "Item"));
33
33
  const recordSelected = selection.type === "record" || selection.type === "record-field";
34
34
  if (recordSelected) path.push(...records.length > 0 ? records.map((record) => record.title || "Record") : ["Record"]);
35
- let fieldName;
36
- if (selection.type === "block-field" || selection.type === "item-field") {
37
- fieldName = selection.fieldName;
38
- path.push(fieldLabel(schema, fieldName));
39
- } else if (selection.type === "record-field") {
40
- fieldName = selection.recordFieldName;
41
- path.push(fieldLabel(recordSchema, fieldName));
42
- }
35
+ const fieldName = slotOf(selection)?.name;
36
+ if (fieldName) path.push(fieldLabel(recordSelected ? recordSchema : schema, fieldName));
43
37
  const itemId = selectionItemId(selection) ?? void 0;
44
38
  const recordId = recordSelected ? selection.nested?.recordId ?? selection.recordId : void 0;
45
39
  return {
@@ -94,13 +88,8 @@ function useEditorSelection(where) {
94
88
  $[8] = t4;
95
89
  $[9] = t5;
96
90
  } else t5 = $[9];
97
- const itemsMap = t5;
98
- const items = [];
99
- for (let item_0 = itemId ? itemsMap.get(itemId) : void 0; item_0;) {
100
- items.unshift(item_0);
101
- item_0 = item_0.parentItemId ? itemsMap.get(item_0.parentItemId) : void 0;
102
- }
103
- const schema = blockDef && itemId ? getSchemaForItem(blockDef.contentSchema, itemId, itemsMap) : blockDef?.contentSchema;
91
+ const items = itemPath(itemId, t5);
92
+ const schema = blockDef && itemContentSchema(blockDef.contentSchema, items);
104
93
  const records = [];
105
94
  if ((selection?.type === "record" || selection?.type === "record-field") && isBlockPlacement(selection)) {
106
95
  const placer = itemId ? items.at(-1) : bundle?.block;
@@ -0,0 +1,70 @@
1
+ import { useNavigate } from "../navigation/navigation.js";
2
+ import { draftMutations } from "../../lib/queries.js";
3
+ import { useSwitchView } from "./viewSwitch.js";
4
+ import { c } from "react/compiler-runtime";
5
+ import { useMutation } from "@tanstack/react-query";
6
+ import { toast } from "@camox/ui/toaster";
7
+
8
+ //#region src/features/studio/useRestoreDraft.ts
9
+ /**
10
+ * Restores an archived draft, then takes the member into it on the same page (ADR 0046): the
11
+ * draft is back as it was, so they go on where it stopped. `label` names it in the toast.
12
+ */
13
+ function useRestoreDraft(projectId, options) {
14
+ const $ = c(10);
15
+ const navigate = useNavigate();
16
+ const switchView = useSwitchView();
17
+ let t0;
18
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
19
+ t0 = {
20
+ ...draftMutations.restore(),
21
+ onError: _temp
22
+ };
23
+ $[0] = t0;
24
+ } else t0 = $[0];
25
+ const restore = useMutation(t0);
26
+ let t1;
27
+ if ($[1] !== navigate || $[2] !== options || $[3] !== projectId || $[4] !== restore || $[5] !== switchView) {
28
+ t1 = (draftId, t2) => {
29
+ const label = t2 === void 0 ? "the draft" : t2;
30
+ if (!projectId) return;
31
+ restore.mutate({
32
+ projectId,
33
+ draftId
34
+ }, { onSuccess: () => {
35
+ options?.onRestored?.();
36
+ switchView(() => navigate({
37
+ to: window.location.href,
38
+ draft: draftId
39
+ }), {
40
+ loading: `Restoring ${label}…`,
41
+ success: `Restored ${label}. You're now viewing it.`
42
+ });
43
+ } });
44
+ };
45
+ $[1] = navigate;
46
+ $[2] = options;
47
+ $[3] = projectId;
48
+ $[4] = restore;
49
+ $[5] = switchView;
50
+ $[6] = t1;
51
+ } else t1 = $[6];
52
+ const t2 = restore.isPending ? restore.variables?.draftId : void 0;
53
+ let t3;
54
+ if ($[7] !== t1 || $[8] !== t2) {
55
+ t3 = {
56
+ restore: t1,
57
+ restoring: t2
58
+ };
59
+ $[7] = t1;
60
+ $[8] = t2;
61
+ $[9] = t3;
62
+ } else t3 = $[9];
63
+ return t3;
64
+ }
65
+ function _temp(error) {
66
+ return toast.error(error.message || "Could not restore the draft");
67
+ }
68
+
69
+ //#endregion
70
+ export { useRestoreDraft };
@@ -4,6 +4,7 @@ import { c } from "react/compiler-runtime";
4
4
  import { toast } from "@camox/ui/toaster";
5
5
 
6
6
  //#region src/features/studio/viewSwitch.ts
7
+ const SWITCH_FAILED = "Something went wrong while switching. Reload the page to try again.";
7
8
  /**
8
9
  * Tells the editor the studio heard them while it switches to another draft or locale: the
9
10
  * studio keeps showing what it showed until the next view is ready, then shows it at once.
@@ -12,7 +13,7 @@ import { toast } from "@camox/ui/toaster";
12
13
  function toastSwitch(switching, messages) {
13
14
  toast.promise(switching, {
14
15
  ...messages,
15
- error: "Something went wrong while switching. Reload the page to try again."
16
+ error: SWITCH_FAILED
16
17
  });
17
18
  }
18
19
  /**
@@ -31,9 +32,10 @@ function useSwitchView() {
31
32
  return t0;
32
33
  }
33
34
  /**
34
- * Switches the studio to Live once the draft it views ended, by this member, here or in another
35
- * tab, replacing the draft's URL entry. Called once the studio already left the draft, it does
36
- * nothing.
35
+ * Switches the studio to Live once the draft it views ended or was archived, by this member, here
36
+ * or in another tab, replacing the draft's URL entry. An ended draft's dialog already showed it
37
+ * working, so its toast only says so once Live shows; an archived draft's toast shows meanwhile
38
+ * too. Called once the studio already left the draft, it does nothing.
37
39
  */
38
40
  function useLeaveDraft() {
39
41
  const $ = c(3);
@@ -41,14 +43,17 @@ function useLeaveDraft() {
41
43
  const shown = useViewShown();
42
44
  let t0;
43
45
  if ($[0] !== draftScope || $[1] !== shown) {
44
- t0 = (ended) => {
45
- if (ended && draftScope.current() !== ended.draftId) return;
46
- draftScope.leave(ended);
47
- if (!ended) return;
48
- const what = `Draft ${ended.outcome}`;
46
+ t0 = (left) => {
47
+ if (left && draftScope.current() !== left.draftId) return;
48
+ draftScope.leave(left);
49
+ if (!left) return;
50
+ if ("outcome" in left) {
51
+ shown().then(() => toast.success(`Draft ${left.outcome}. You're now viewing Live.`), _temp);
52
+ return;
53
+ }
49
54
  toastSwitch(shown(), {
50
- loading: `${what}. Switching to Live…`,
51
- success: `${what}. You're now viewing Live.`
55
+ loading: "Draft archived. Switching to Live…",
56
+ success: "Draft archived. You're now viewing Live."
52
57
  });
53
58
  };
54
59
  $[0] = draftScope;
@@ -57,6 +62,9 @@ function useLeaveDraft() {
57
62
  } else t0 = $[2];
58
63
  return t0;
59
64
  }
65
+ function _temp() {
66
+ return toast.error(SWITCH_FAILED);
67
+ }
60
68
 
61
69
  //#endregion
62
70
  export { useLeaveDraft, useSwitchView };
@@ -1,5 +1,5 @@
1
1
  import "./locale-path.js";
2
2
  import "../features/routes/pageRuntime.js";
3
3
  import "react";
4
- import { EndedDraft } from "@camox/api-contract/drafts";
4
+ import { ArchivedDraft, EndedDraft } from "@camox/api-contract/drafts";
5
5
  import { QueryClient } from "@tanstack/react-query";
@@ -136,14 +136,17 @@ function createDraftScope({ queryClient, browser }) {
136
136
  }
137
137
  notify("adopted");
138
138
  },
139
- leave(ended, { notice = false } = {}) {
139
+ leave(left, { notice = false } = {}) {
140
140
  queryClient.invalidateQueries({ queryKey: ["camox"] });
141
141
  pending = null;
142
142
  current = null;
143
143
  replaceUrl(null);
144
- if (notice && ended) report({
144
+ if (notice && left) report("outcome" in left ? {
145
145
  reason: "ended",
146
- ...ended
146
+ ...left
147
+ } : {
148
+ reason: "archived",
149
+ ...left
147
150
  });
148
151
  notify("left");
149
152
  },
@@ -42,8 +42,19 @@ const projectMutations = {
42
42
  await sendFaviconChange(String(projectId), { method: "DELETE" });
43
43
  } })
44
44
  };
45
+ const publicationMutations = {
46
+ /** Starts a draft reverting a Publication (ADR 0045), named in the input. */
47
+ revert: () => getOrpc().publications.revert.mutationOptions(),
48
+ /** Clears a Publication's thread for good, named in the input (ADR 0045). */
49
+ clearThread: () => getOrpc().publications.clearThread.mutationOptions()
50
+ };
45
51
  const draftMutations = {
46
52
  publish: () => getOrpc().drafts.publish.mutationOptions(),
53
+ /** Archives the draft the studio views (ADR 0046). */
54
+ archive: () => getOrpc().drafts.archive.mutationOptions(),
55
+ /** Restores an archived draft, named in the input. */
56
+ restore: () => getOrpc().drafts.restore.mutationOptions(),
57
+ /** Deletes an archived draft for good, named in the input. */
47
58
  delete: () => getOrpc().drafts.delete.mutationOptions(),
48
59
  /** Requests the draft's overview again right away, once it failed. */
49
60
  retryOverview: () => getOrpc().drafts.retryOverview.mutationOptions(),
@@ -138,4 +149,4 @@ const fileMutations = {
138
149
  };
139
150
 
140
151
  //#endregion
141
- export { blockMutations, collectionMutations, draftMutations, fileMutations, localeMutations, pageMutations, projectMutations, repeatableItemMutations, specialistMutations };
152
+ export { blockMutations, collectionMutations, draftMutations, fileMutations, localeMutations, pageMutations, projectMutations, publicationMutations, repeatableItemMutations, specialistMutations };
@@ -197,6 +197,28 @@ const reads = {
197
197
  fetch: ({ api, signal }, { projectId }) => api.drafts.list({ projectId }, { signal }),
198
198
  staleTime: Infinity
199
199
  }),
200
+ archivedDrafts: entry({
201
+ key: ({ projectId }) => [...queryKeys.drafts.archived, projectId],
202
+ shared: true,
203
+ fetch: async ({ api, signal }, { projectId }) => (await api.drafts.listArchived({ projectId }, { signal })).drafts,
204
+ staleTime: Infinity
205
+ }),
206
+ publications: entry({
207
+ key: ({ projectId }) => [...queryKeys.publications.list, projectId],
208
+ shared: true,
209
+ fetch: async ({ api, signal }, { projectId }) => (await api.publications.list({ projectId }, { signal })).publications,
210
+ staleTime: Infinity
211
+ }),
212
+ publication: entry({
213
+ key: ({ projectId, id }) => [
214
+ ...queryKeys.publications.get,
215
+ projectId,
216
+ id
217
+ ],
218
+ shared: true,
219
+ fetch: async ({ api, signal }, input) => (await api.publications.get(input, { signal })).publication,
220
+ staleTime: Infinity
221
+ }),
200
222
  draft: entry({
201
223
  key: ({ draftId }) => [...queryKeys.drafts.get, draftId],
202
224
  shared: true,
@@ -11,14 +11,14 @@ const DEBOUNCE_MS = 300;
11
11
  * wherever they change nothing. The studio cache applies each one to the reads it reaches.
12
12
  */
13
13
  function useProjectRoom(apiUrl, projectId, studioCache, t0) {
14
- const $ = c(13);
14
+ const $ = c(14);
15
15
  let t1;
16
16
  if ($[0] !== t0) {
17
17
  t1 = t0 === void 0 ? {} : t0;
18
18
  $[0] = t0;
19
19
  $[1] = t1;
20
20
  } else t1 = $[1];
21
- const { onDraftEnded, onRevision } = t1;
21
+ const { onDraftEnded, onDraftArchived, onRevision } = t1;
22
22
  const timerRef = useRef(void 0);
23
23
  let t2;
24
24
  if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
@@ -35,7 +35,7 @@ function useProjectRoom(apiUrl, projectId, studioCache, t0) {
35
35
  const t4 = String(projectId ?? "");
36
36
  const t5 = !!projectId;
37
37
  let t6;
38
- if ($[5] !== onDraftEnded || $[6] !== onRevision || $[7] !== projectId || $[8] !== studioCache || $[9] !== t3 || $[10] !== t4 || $[11] !== t5) {
38
+ if ($[5] !== onDraftArchived || $[6] !== onDraftEnded || $[7] !== onRevision || $[8] !== projectId || $[9] !== studioCache || $[10] !== t3 || $[11] !== t4 || $[12] !== t5) {
39
39
  t6 = {
40
40
  ...t3,
41
41
  party: "project-room",
@@ -63,8 +63,13 @@ function useProjectRoom(apiUrl, projectId, studioCache, t0) {
63
63
  onDraftEnded?.(ended);
64
64
  return;
65
65
  }
66
+ if (data.type === "draftArchived") {
67
+ const { type: _type_0, ...archived } = data;
68
+ onDraftArchived?.(archived);
69
+ return;
70
+ }
66
71
  if (data.type === "revision") {
67
- const { type: _type_0, ...revision } = data;
72
+ const { type: _type_1, ...revision } = data;
68
73
  onRevision?.(revision);
69
74
  return;
70
75
  }
@@ -78,15 +83,16 @@ function useProjectRoom(apiUrl, projectId, studioCache, t0) {
78
83
  }, DEBOUNCE_MS);
79
84
  }
80
85
  };
81
- $[5] = onDraftEnded;
82
- $[6] = onRevision;
83
- $[7] = projectId;
84
- $[8] = studioCache;
85
- $[9] = t3;
86
- $[10] = t4;
87
- $[11] = t5;
88
- $[12] = t6;
89
- } else t6 = $[12];
86
+ $[5] = onDraftArchived;
87
+ $[6] = onDraftEnded;
88
+ $[7] = onRevision;
89
+ $[8] = projectId;
90
+ $[9] = studioCache;
91
+ $[10] = t3;
92
+ $[11] = t4;
93
+ $[12] = t5;
94
+ $[13] = t6;
95
+ } else t6 = $[13];
90
96
  usePartySocket(t6);
91
97
  }
92
98
 
@@ -147,7 +147,7 @@ function useThread(apiUrl, projectId, draftId, t0) {
147
147
  if (asked(frame_1.startedDraft)) {
148
148
  handedOff.set(threadKey(apiUrl, projectId, frame_1.startedDraft.draftId), {
149
149
  sent,
150
- view: runOf(threadViewOf(latest.current))
150
+ ...!frame_1.startedDraft.restored && { view: runOf(threadViewOf(latest.current)) }
151
151
  });
152
152
  onEnterDraft?.(frame_1.startedDraft.draftId);
153
153
  }
package/dist/package.js CHANGED
@@ -1,5 +1,5 @@
1
1
  //#region package.json
2
- var version = "0.75.0";
2
+ var version = "0.76.1";
3
3
 
4
4
  //#endregion
5
5
  export { version };