@drawnagency/primitives 0.1.97 → 0.1.99

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 (67) hide show
  1. package/dist/{chunk-F2337B35.js → chunk-26ALJO4K.js} +1 -1
  2. package/dist/{chunk-S4L3ZFKM.js → chunk-3COSXTOY.js} +1 -1
  3. package/dist/{chunk-RHWWQV3J.js → chunk-BGHWUJFV.js} +1 -0
  4. package/dist/{chunk-QEHPGA5N.js → chunk-CZLYECHC.js} +20 -9
  5. package/dist/{chunk-YDXBJR74.js → chunk-EWNDBKYK.js} +1 -1
  6. package/dist/{chunk-EUSWEVOA.js → chunk-FAZFADJK.js} +9 -0
  7. package/dist/{chunk-XYCCXKVC.js → chunk-FOY5TF7D.js} +1 -1
  8. package/dist/{chunk-II3X7GLJ.js → chunk-GYCBWGVW.js} +1 -1
  9. package/dist/{chunk-FOEZNEF5.js → chunk-HKHEAH5F.js} +6 -6
  10. package/dist/{chunk-5BFPJWIO.js → chunk-KP4DWTPR.js} +3 -3
  11. package/dist/{chunk-KPP2CFW6.js → chunk-MUTHF2GT.js} +2 -2
  12. package/dist/{chunk-HJSE6SK5.js → chunk-REDDTTGJ.js} +3 -3
  13. package/dist/chunk-TGNS7D4F.js +200 -0
  14. package/dist/collab/rebase.d.ts.map +1 -1
  15. package/dist/collab/rebase.js +4 -2
  16. package/dist/components/editor/index.js +5 -5
  17. package/dist/components/primitives/index.js +6 -6
  18. package/dist/components/sections/brand-guide.js +6 -6
  19. package/dist/components/sections/register-schemas.js +9 -9
  20. package/dist/components/sections/register.js +9 -9
  21. package/dist/components/shell/EditorShell.d.ts.map +1 -1
  22. package/dist/hooks/useEditorPersistence.d.ts +7 -0
  23. package/dist/hooks/useEditorPersistence.d.ts.map +1 -1
  24. package/dist/hooks/useEditorPublish.d.ts +6 -1
  25. package/dist/hooks/useEditorPublish.d.ts.map +1 -1
  26. package/dist/index.js +16 -12
  27. package/dist/lib/block-move.d.ts.map +1 -1
  28. package/dist/lib/dexie.d.ts.map +1 -1
  29. package/dist/lib/dexie.js +6 -1
  30. package/dist/lib/index-ops.d.ts +139 -2
  31. package/dist/lib/index-ops.d.ts.map +1 -1
  32. package/dist/lib/index-ops.js +189 -9
  33. package/dist/lib/index.js +5 -5
  34. package/dist/lib/loader.d.ts +6 -0
  35. package/dist/lib/loader.d.ts.map +1 -1
  36. package/dist/lib/pages.d.ts +18 -0
  37. package/dist/lib/pages.d.ts.map +1 -1
  38. package/dist/media/index.js +3 -3
  39. package/dist/media/provider.d.ts +0 -1
  40. package/dist/media/provider.d.ts.map +1 -1
  41. package/dist/schemas/index.js +5 -3
  42. package/dist/schemas/site-config.d.ts +1 -0
  43. package/dist/schemas/site-config.d.ts.map +1 -1
  44. package/dist/storage/index.d.ts +1 -1
  45. package/dist/storage/index.d.ts.map +1 -1
  46. package/dist/storage/index.js +3 -1
  47. package/dist/storage/types.d.ts +22 -5
  48. package/dist/storage/types.d.ts.map +1 -1
  49. package/dist/types/database.d.ts +14 -3
  50. package/dist/types/database.d.ts.map +1 -1
  51. package/package.json +1 -1
  52. package/src/collab/rebase.ts +15 -0
  53. package/src/components/shell/EditorShell.tsx +70 -11
  54. package/src/hooks/useEditorPersistence.ts +14 -0
  55. package/src/hooks/useEditorPublish.ts +17 -3
  56. package/src/lib/block-move.ts +15 -4
  57. package/src/lib/dexie.ts +6 -1
  58. package/src/lib/index-ops.ts +277 -7
  59. package/src/lib/loader.ts +32 -11
  60. package/src/lib/pages.ts +48 -0
  61. package/src/media/provider.ts +0 -1
  62. package/src/schemas/nav.ts +3 -3
  63. package/src/schemas/site-config.ts +3 -1
  64. package/src/storage/index.ts +1 -1
  65. package/src/storage/types.ts +25 -5
  66. package/src/types/database.ts +14 -3
  67. package/dist/chunk-ZD6XGRQM.js +0 -85
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  getMediaProvider
3
- } from "./chunk-S4L3ZFKM.js";
3
+ } from "./chunk-3COSXTOY.js";
4
4
  import {
5
5
  cn
6
6
  } from "./chunk-7EOSDFS3.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  slugifyPageSlug
3
- } from "./chunk-ZD6XGRQM.js";
3
+ } from "./chunk-TGNS7D4F.js";
4
4
 
5
5
  // src/media/utils.ts
6
6
  async function hashFileBuffer(buffer) {
@@ -364,6 +364,7 @@ export {
364
364
  RESERVED_SLUGS,
365
365
  PageStatusSchema,
366
366
  PageSchema,
367
+ SLUG_RE,
367
368
  IndexSchema,
368
369
  normalizeSiteIndex,
369
370
  ChatbotTaskSchema,
@@ -5,8 +5,8 @@ import {
5
5
  upgradeLegacySection
6
6
  } from "./chunk-5BM2Y3NJ.js";
7
7
  import {
8
- NavFileSchema
9
- } from "./chunk-HJSE6SK5.js";
8
+ NavEntrySchema
9
+ } from "./chunk-REDDTTGJ.js";
10
10
  import {
11
11
  getSectionSchema
12
12
  } from "./chunk-TZQPOR5A.js";
@@ -15,7 +15,7 @@ import {
15
15
  } from "./chunk-VKAGMEKE.js";
16
16
  import {
17
17
  IndexSchema
18
- } from "./chunk-RHWWQV3J.js";
18
+ } from "./chunk-BGHWUJFV.js";
19
19
  import {
20
20
  MAX_BLOCK_DEPTH,
21
21
  blockDepth
@@ -153,13 +153,23 @@ function safeRedirect(url, fallback) {
153
153
 
154
154
  // src/lib/loader.ts
155
155
  function parseNavFile(navFile) {
156
- if (!navFile) return [];
157
- const result = NavFileSchema.safeParse(navFile);
158
- if (!result.success) {
156
+ if (!navFile) return { entries: [], degraded: false };
157
+ const rawEntries = navFile.entries;
158
+ if (!Array.isArray(rawEntries)) {
159
159
  console.warn("Invalid nav.json, falling back to a flat navigation");
160
- return [];
160
+ return { entries: [], degraded: true };
161
161
  }
162
- return result.data.entries;
162
+ const entries = [];
163
+ let dropped = 0;
164
+ for (const raw of rawEntries) {
165
+ const result = NavEntrySchema.safeParse(raw);
166
+ if (result.success) entries.push(result.data);
167
+ else dropped++;
168
+ }
169
+ if (dropped > 0) {
170
+ console.warn(`nav.json: dropped ${dropped} entr${dropped === 1 ? "y" : "ies"} this package version cannot represent; navigation is degraded`);
171
+ }
172
+ return { entries, degraded: dropped > 0 };
163
173
  }
164
174
  function mergeSiteContent(index, sectionFiles, navFile) {
165
175
  const sections = [];
@@ -192,7 +202,8 @@ function mergeSiteContent(index, sectionFiles, navFile) {
192
202
  sections.push({ section: raw, meta });
193
203
  }
194
204
  }
195
- return { sections, index: { ...index, nav: parseNavFile(navFile) } };
205
+ const nav = parseNavFile(navFile);
206
+ return { sections, index: { ...index, nav: nav.entries }, navDegraded: nav.degraded };
196
207
  }
197
208
  function loadStaticSiteContent(index, sectionGlob, navFile) {
198
209
  const sectionFiles = {};
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  EditablePlainText
3
- } from "./chunk-KPP2CFW6.js";
3
+ } from "./chunk-MUTHF2GT.js";
4
4
  import {
5
5
  Button,
6
6
  usePages
@@ -7,6 +7,14 @@ var StorageConflictError = class extends Error {
7
7
  }
8
8
  currentVersion;
9
9
  };
10
+ var IdempotencyLookupUnavailableError = class extends Error {
11
+ constructor(cause) {
12
+ super("Could not search draft history for the idempotency key");
13
+ this.cause = cause;
14
+ this.name = "IdempotencyLookupUnavailableError";
15
+ }
16
+ cause;
17
+ };
10
18
  var IDEMPOTENCY_TRAILER = "Idempotency-Key";
11
19
  var IDEMPOTENCY_KEY_RE = /^[A-Za-z0-9._:-]{8,200}$/;
12
20
  function withIdempotencyTrailer(subject, key) {
@@ -22,6 +30,7 @@ var ASSET_CACHE_CONTROL = "max-age=31536000, immutable";
22
30
 
23
31
  export {
24
32
  StorageConflictError,
33
+ IdempotencyLookupUnavailableError,
25
34
  IDEMPOTENCY_TRAILER,
26
35
  IDEMPOTENCY_KEY_RE,
27
36
  withIdempotencyTrailer,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  HexColorSchema
3
- } from "./chunk-RHWWQV3J.js";
3
+ } from "./chunk-BGHWUJFV.js";
4
4
 
5
5
  // src/schemas/audience.ts
6
6
  import { z } from "zod";
@@ -14,7 +14,7 @@ import {
14
14
  SettingsIcon,
15
15
  useMediaLibrary,
16
16
  useResolvedMedia
17
- } from "./chunk-F2337B35.js";
17
+ } from "./chunk-26ALJO4K.js";
18
18
  import {
19
19
  cn
20
20
  } from "./chunk-7EOSDFS3.js";
@@ -3,7 +3,7 @@ import {
3
3
  pluralize,
4
4
  stripHtmlToPlainText,
5
5
  truncate
6
- } from "./chunk-5BFPJWIO.js";
6
+ } from "./chunk-KP4DWTPR.js";
7
7
  import {
8
8
  DeleteButton,
9
9
  DragHandle,
@@ -17,11 +17,11 @@ import {
17
17
  buildBlockDropData,
18
18
  canDropBlock,
19
19
  isBlockDragData
20
- } from "./chunk-II3X7GLJ.js";
20
+ } from "./chunk-GYCBWGVW.js";
21
21
  import {
22
22
  EditableRichText,
23
23
  defineHeadingSection
24
- } from "./chunk-YDXBJR74.js";
24
+ } from "./chunk-EWNDBKYK.js";
25
25
  import {
26
26
  EditablePlainText,
27
27
  ImageDropZone,
@@ -31,11 +31,11 @@ import {
31
31
  containerGridClass,
32
32
  masonryColumnsClass,
33
33
  spacerHiddenClass
34
- } from "./chunk-KPP2CFW6.js";
34
+ } from "./chunk-MUTHF2GT.js";
35
35
  import {
36
36
  useMediaLibrary,
37
37
  useResolvedMedia
38
- } from "./chunk-F2337B35.js";
38
+ } from "./chunk-26ALJO4K.js";
39
39
  import {
40
40
  embedUrl
41
41
  } from "./chunk-Y4JQGO6G.js";
@@ -58,7 +58,7 @@ import {
58
58
  } from "./chunk-VKAGMEKE.js";
59
59
  import {
60
60
  SingleMediaReferenceSchema
61
- } from "./chunk-RHWWQV3J.js";
61
+ } from "./chunk-BGHWUJFV.js";
62
62
 
63
63
  // src/components/sections/LinkHeading/index.tsx
64
64
  import { Heading1 } from "lucide-react";
@@ -9,13 +9,13 @@ import {
9
9
  MediaBlock,
10
10
  containerGridClass,
11
11
  useEditableCollection
12
- } from "./chunk-KPP2CFW6.js";
12
+ } from "./chunk-MUTHF2GT.js";
13
13
  import {
14
14
  AddIcon,
15
15
  DeleteIcon,
16
16
  DragHandle,
17
17
  IconButton
18
- } from "./chunk-F2337B35.js";
18
+ } from "./chunk-26ALJO4K.js";
19
19
  import {
20
20
  DEFAULT_LINK,
21
21
  LinkValueSchema
@@ -33,7 +33,7 @@ import {
33
33
  import {
34
34
  HexColorSchema,
35
35
  SingleMediaReferenceSchema
36
- } from "./chunk-RHWWQV3J.js";
36
+ } from "./chunk-BGHWUJFV.js";
37
37
 
38
38
  // src/components/sections/Colors/index.tsx
39
39
  import { z as z2 } from "zod";
@@ -6,10 +6,10 @@ import {
6
6
  SettingsIcon,
7
7
  useMediaLibrary,
8
8
  useResolvedMedia
9
- } from "./chunk-F2337B35.js";
9
+ } from "./chunk-26ALJO4K.js";
10
10
  import {
11
11
  rebindImageRef
12
- } from "./chunk-S4L3ZFKM.js";
12
+ } from "./chunk-3COSXTOY.js";
13
13
  import {
14
14
  cn
15
15
  } from "./chunk-7EOSDFS3.js";
@@ -11,9 +11,9 @@ var NavEntrySchema = z.discriminatedUnion("kind", [
11
11
  /** May be blank — agent-authored files can omit it; UI falls back to "Untitled group". */
12
12
  label: z.string().default(""),
13
13
  startCollapsed: z.boolean().default(false),
14
- // Everything but `id` defaults: NavFileSchema is all-or-nothing, and the
15
- // loader degrades a failed parse to a flat nav — so one agent-authored group
16
- // missing a key would silently discard every group on the site.
14
+ // Everything but `id` defaults: the loader parses entries individually and
15
+ // drops the ones that fail — defaulting here keeps an agent-authored group
16
+ // missing a key from being dropped (and its drop marking the nav degraded).
17
17
  pageIds: z.array(z.string().min(1)).default([])
18
18
  })
19
19
  ]);
@@ -0,0 +1,200 @@
1
+ import {
2
+ RESERVED_SLUGS
3
+ } from "./chunk-BGHWUJFV.js";
4
+
5
+ // src/lib/nav-tree.ts
6
+ function reconcileNav(entries, pages) {
7
+ const entryList = Array.isArray(entries) ? entries : [];
8
+ const pageList = Array.isArray(pages) ? pages : [];
9
+ const validIds = /* @__PURE__ */ new Set();
10
+ for (const p of pageList) {
11
+ if (p?.id) validIds.add(p.id);
12
+ }
13
+ const placed = /* @__PURE__ */ new Set();
14
+ const seenGroupIds = /* @__PURE__ */ new Set();
15
+ const result = [];
16
+ for (const entry of entryList) {
17
+ if (entry?.kind === "page") {
18
+ if (!validIds.has(entry.pageId) || placed.has(entry.pageId)) continue;
19
+ placed.add(entry.pageId);
20
+ result.push({ ...entry });
21
+ continue;
22
+ }
23
+ if (entry?.kind !== "group") continue;
24
+ if (seenGroupIds.has(entry.id)) continue;
25
+ seenGroupIds.add(entry.id);
26
+ const claimed = Array.isArray(entry.pageIds) ? entry.pageIds : [];
27
+ const pageIds = claimed.filter((id) => {
28
+ if (!validIds.has(id) || placed.has(id)) return false;
29
+ placed.add(id);
30
+ return true;
31
+ });
32
+ const group = { ...entry, pageIds };
33
+ result.push(group);
34
+ }
35
+ for (const p of pageList) {
36
+ if (!p?.id || placed.has(p.id)) continue;
37
+ placed.add(p.id);
38
+ result.push({ kind: "page", pageId: p.id });
39
+ }
40
+ return result;
41
+ }
42
+ function navEntries(index) {
43
+ return reconcileNav(index.nav ?? [], index.pages);
44
+ }
45
+ function pagesInNavOrder(index) {
46
+ const byId = new Map(index.pages.map((p) => [p.id, p]));
47
+ const out = [];
48
+ for (const entry of navEntries(index)) {
49
+ if (entry.kind === "page") {
50
+ const p = byId.get(entry.pageId);
51
+ if (p) out.push(p);
52
+ } else {
53
+ for (const id of entry.pageIds) {
54
+ const p = byId.get(id);
55
+ if (p) out.push(p);
56
+ }
57
+ }
58
+ }
59
+ return out;
60
+ }
61
+ function groupOfPage(index, pageId) {
62
+ for (const entry of navEntries(index)) {
63
+ if (entry.kind === "group" && entry.pageIds.includes(pageId)) return entry;
64
+ }
65
+ return null;
66
+ }
67
+ function groupDisplayLabel(label) {
68
+ return label || "Untitled group";
69
+ }
70
+ function withNav(index, entries) {
71
+ return { ...index, nav: entries };
72
+ }
73
+ function addGroup(index, groupId) {
74
+ return withNav(index, [
75
+ ...navEntries(index),
76
+ { kind: "group", id: groupId, label: "", startCollapsed: false, pageIds: [] }
77
+ ]);
78
+ }
79
+ function renameGroup(index, groupId, label) {
80
+ return withNav(index, navEntries(index).map(
81
+ (e) => e.kind === "group" && e.id === groupId ? { ...e, label } : e
82
+ ));
83
+ }
84
+ function setGroupStartCollapsed(index, groupId, startCollapsed) {
85
+ return withNav(index, navEntries(index).map(
86
+ (e) => e.kind === "group" && e.id === groupId ? { ...e, startCollapsed } : e
87
+ ));
88
+ }
89
+ function deleteGroup(index, groupId) {
90
+ const out = [];
91
+ for (const entry of navEntries(index)) {
92
+ if (entry.kind === "group" && entry.id === groupId) {
93
+ for (const pageId of entry.pageIds) out.push({ kind: "page", pageId });
94
+ } else {
95
+ out.push(entry);
96
+ }
97
+ }
98
+ return withNav(index, out);
99
+ }
100
+ function moveNavEntry(index, from, to) {
101
+ const entries = navEntries(index).map((e) => e.kind === "group" ? { ...e, pageIds: [...e.pageIds] } : { ...e });
102
+ let moved;
103
+ if (from.groupId === null) {
104
+ if (from.index < 0 || from.index >= entries.length) return index;
105
+ [moved] = entries.splice(from.index, 1);
106
+ } else {
107
+ const group = entries.find((e) => e.kind === "group" && e.id === from.groupId);
108
+ if (!group || group.kind !== "group") return index;
109
+ if (from.index < 0 || from.index >= group.pageIds.length) return index;
110
+ [moved] = group.pageIds.splice(from.index, 1);
111
+ }
112
+ if (moved === void 0) return index;
113
+ const movedIsGroup = typeof moved !== "string" && moved.kind === "group";
114
+ if (movedIsGroup && to.groupId !== null) return index;
115
+ if (to.groupId === null) {
116
+ const entry = typeof moved === "string" ? { kind: "page", pageId: moved } : moved;
117
+ entries.splice(Math.max(0, Math.min(to.index, entries.length)), 0, entry);
118
+ } else {
119
+ const group = entries.find((e) => e.kind === "group" && e.id === to.groupId);
120
+ if (!group || group.kind !== "group") return index;
121
+ const pageId = typeof moved === "string" ? moved : moved.kind === "page" ? moved.pageId : null;
122
+ if (pageId === null) return index;
123
+ group.pageIds.splice(Math.max(0, Math.min(to.index, group.pageIds.length)), 0, pageId);
124
+ }
125
+ return withNav(index, entries);
126
+ }
127
+
128
+ // src/lib/pages.ts
129
+ function slugifyPageSlug(input) {
130
+ return input.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
131
+ }
132
+ function uniquePageSlug(base, existing) {
133
+ const taken = new Set(existing);
134
+ const reserved = new Set(RESERVED_SLUGS);
135
+ let candidate = base || "page";
136
+ if (!taken.has(candidate) && !reserved.has(candidate)) return candidate;
137
+ let n = 2;
138
+ while (taken.has(`${candidate}-${n}`) || reserved.has(`${candidate}-${n}`)) n++;
139
+ return `${candidate}-${n}`;
140
+ }
141
+ function pageById(index, id) {
142
+ return index.pages.find((p) => p.id === id);
143
+ }
144
+ function audiencePasses(access, audience) {
145
+ if (access.length === 0) return true;
146
+ if (!audience) return true;
147
+ return access.includes(audience);
148
+ }
149
+ function addPage(index, id) {
150
+ const slug = uniquePageSlug("new-page", index.pages.map((p) => p.slug));
151
+ const page = {
152
+ id,
153
+ title: "",
154
+ slug,
155
+ isHome: false,
156
+ showInNav: true,
157
+ status: "live",
158
+ access: [],
159
+ order: []
160
+ };
161
+ return {
162
+ ...index,
163
+ pages: [...index.pages, page],
164
+ nav: [...navEntries(index), { kind: "page", pageId: id }]
165
+ };
166
+ }
167
+ function deletePage(index, pageId) {
168
+ const page = pageById(index, pageId);
169
+ if (!page || page.isHome) return { index, removedSectionIds: [] };
170
+ const removedSectionIds = [...page.order];
171
+ const nextSections = { ...index.sections };
172
+ for (const id of removedSectionIds) delete nextSections[id];
173
+ return {
174
+ index: {
175
+ ...index,
176
+ pages: index.pages.filter((p) => p.id !== pageId),
177
+ sections: nextSections,
178
+ nav: navEntries(index).filter((e) => !(e.kind === "page" && e.pageId === pageId)).map((e) => e.kind === "group" ? { ...e, pageIds: e.pageIds.filter((id) => id !== pageId) } : e)
179
+ },
180
+ removedSectionIds
181
+ };
182
+ }
183
+
184
+ export {
185
+ reconcileNav,
186
+ navEntries,
187
+ pagesInNavOrder,
188
+ groupOfPage,
189
+ groupDisplayLabel,
190
+ addGroup,
191
+ renameGroup,
192
+ setGroupStartCollapsed,
193
+ deleteGroup,
194
+ moveNavEntry,
195
+ slugifyPageSlug,
196
+ uniquePageSlug,
197
+ audiencePasses,
198
+ addPage,
199
+ deletePage
200
+ };
@@ -1 +1 @@
1
- {"version":3,"file":"rebase.d.ts","sourceRoot":"","sources":["../../src/collab/rebase.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAIxD,MAAM,WAAW,UAAU;IACzB,aAAa,EAAE,aAAa,EAAE,CAAC;IAC/B,UAAU,EAAE,SAAS,CAAC;IACtB,eAAe,EAAE,OAAO,CAAC;IACzB,eAAe,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAC7B;;;;;+EAK2E;IAC3E,eAAe,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAC7B,iBAAiB,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAC/B,cAAc,EAAE,aAAa,EAAE,CAAC;IAChC,WAAW,EAAE,SAAS,CAAC;IAKvB,gBAAgB,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;CAC/B;AAED,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,aAAa,EAAE,CAAC;IAC1B,KAAK,EAAE,SAAS,CAAC;IAIjB,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB;AAED;;;;;;;;;;qEAUqE;AACrE;;;;;;;;;;;;;;;;;;;;;oEAqBoE;AACpE,wBAAgB,oBAAoB,CAAC,WAAW,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,GAAG,SAAS,CAS7F;AAED;;;;;;;;;;;;;;;;;;wCAkBwC;AACxC,wBAAgB,sBAAsB,CAAC,cAAc,EAAE,OAAO,EAAE,UAAU,EAAE,SAAS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avFileSchema
3
- } from "../chunk-HJSE6SK5.js";
3
+ } from "../chunk-REDDTTGJ.js";
4
4
  import {
5
5
  IndexSchema
6
- } from "../chunk-RHWWQV3J.js";
6
+ } from "../chunk-BGHWUJFV.js";
7
7
  import "../chunk-FM4M4Q2W.js";
8
8
  import "../chunk-JSBRDJBE.js";
9
9
 
@@ -73,6 +73,8 @@ function rebaseContent(args) {
73
73
  }
74
74
  index = { ...args.localIndex, pages, sections };
75
75
  }
76
+ const nav = args.remoteIndex.nav !== void 0 ? args.remoteIndex.nav : args.localIndex.nav;
77
+ if (nav !== void 0) index = { ...index, nav };
76
78
  for (const s of merged) {
77
79
  const id = s.section.id;
78
80
  if (id in index.sections) continue;
@@ -11,20 +11,20 @@ import {
11
11
  buildBlockDropData,
12
12
  canDropBlock,
13
13
  isBlockDragData
14
- } from "../../chunk-II3X7GLJ.js";
14
+ } from "../../chunk-GYCBWGVW.js";
15
15
  import "../../chunk-5THS4K5D.js";
16
16
  import "../../chunk-ZSPCE6MZ.js";
17
17
  import {
18
18
  AddIcon,
19
19
  IconButton
20
- } from "../../chunk-F2337B35.js";
21
- import "../../chunk-S4L3ZFKM.js";
20
+ } from "../../chunk-26ALJO4K.js";
21
+ import "../../chunk-3COSXTOY.js";
22
22
  import "../../chunk-PTOLUMGV.js";
23
23
  import {
24
24
  cn
25
25
  } from "../../chunk-7EOSDFS3.js";
26
- import "../../chunk-ZD6XGRQM.js";
27
- import "../../chunk-RHWWQV3J.js";
26
+ import "../../chunk-TGNS7D4F.js";
27
+ import "../../chunk-BGHWUJFV.js";
28
28
  import "../../chunk-FM4M4Q2W.js";
29
29
  import "../../chunk-JSBRDJBE.js";
30
30
 
@@ -2,7 +2,7 @@ import {
2
2
  EditableRichText,
3
3
  LinkPopover,
4
4
  defineHeadingSection
5
- } from "../../chunk-YDXBJR74.js";
5
+ } from "../../chunk-EWNDBKYK.js";
6
6
  import {
7
7
  EditableGrid,
8
8
  EditablePlainText,
@@ -10,21 +10,21 @@ import {
10
10
  MediaBlock,
11
11
  ResolvedMedia,
12
12
  useEditableCollection
13
- } from "../../chunk-KPP2CFW6.js";
13
+ } from "../../chunk-MUTHF2GT.js";
14
14
  import "../../chunk-ZSPCE6MZ.js";
15
15
  import {
16
16
  DeleteIcon,
17
17
  DragHandle,
18
18
  IconButton
19
- } from "../../chunk-F2337B35.js";
20
- import "../../chunk-S4L3ZFKM.js";
19
+ } from "../../chunk-26ALJO4K.js";
20
+ import "../../chunk-3COSXTOY.js";
21
21
  import "../../chunk-72CG6AA2.js";
22
22
  import {
23
23
  cn
24
24
  } from "../../chunk-7EOSDFS3.js";
25
- import "../../chunk-ZD6XGRQM.js";
25
+ import "../../chunk-TGNS7D4F.js";
26
26
  import "../../chunk-VKAGMEKE.js";
27
- import "../../chunk-RHWWQV3J.js";
27
+ import "../../chunk-BGHWUJFV.js";
28
28
  import "../../chunk-FM4M4Q2W.js";
29
29
  import "../../chunk-JSBRDJBE.js";
30
30
 
@@ -2,17 +2,17 @@ import {
2
2
  ColorItemSchema,
3
3
  ColorSpaceSchema,
4
4
  brandGuideSectionDefs
5
- } from "../../chunk-5BFPJWIO.js";
5
+ } from "../../chunk-KP4DWTPR.js";
6
6
  import "../../chunk-5THS4K5D.js";
7
- import "../../chunk-KPP2CFW6.js";
8
- import "../../chunk-F2337B35.js";
9
- import "../../chunk-S4L3ZFKM.js";
7
+ import "../../chunk-MUTHF2GT.js";
8
+ import "../../chunk-26ALJO4K.js";
9
+ import "../../chunk-3COSXTOY.js";
10
10
  import "../../chunk-PZJL2S3Z.js";
11
11
  import "../../chunk-WDSVHKAH.js";
12
12
  import "../../chunk-7EOSDFS3.js";
13
- import "../../chunk-ZD6XGRQM.js";
13
+ import "../../chunk-TGNS7D4F.js";
14
14
  import "../../chunk-VKAGMEKE.js";
15
- import "../../chunk-RHWWQV3J.js";
15
+ import "../../chunk-BGHWUJFV.js";
16
16
  import "../../chunk-FM4M4Q2W.js";
17
17
  import "../../chunk-JSBRDJBE.js";
18
18
  export {
@@ -1,26 +1,26 @@
1
1
  import {
2
2
  allSectionDefs
3
- } from "../../chunk-FOEZNEF5.js";
4
- import "../../chunk-5BFPJWIO.js";
5
- import "../../chunk-II3X7GLJ.js";
3
+ } from "../../chunk-HKHEAH5F.js";
4
+ import "../../chunk-KP4DWTPR.js";
5
+ import "../../chunk-GYCBWGVW.js";
6
6
  import "../../chunk-5THS4K5D.js";
7
- import "../../chunk-YDXBJR74.js";
8
- import "../../chunk-KPP2CFW6.js";
7
+ import "../../chunk-EWNDBKYK.js";
8
+ import "../../chunk-MUTHF2GT.js";
9
9
  import "../../chunk-ZSPCE6MZ.js";
10
- import "../../chunk-F2337B35.js";
10
+ import "../../chunk-26ALJO4K.js";
11
11
  import "../../chunk-Y4JQGO6G.js";
12
- import "../../chunk-S4L3ZFKM.js";
12
+ import "../../chunk-3COSXTOY.js";
13
13
  import "../../chunk-PZJL2S3Z.js";
14
14
  import "../../chunk-WDSVHKAH.js";
15
15
  import "../../chunk-72CG6AA2.js";
16
16
  import "../../chunk-7EOSDFS3.js";
17
- import "../../chunk-ZD6XGRQM.js";
17
+ import "../../chunk-TGNS7D4F.js";
18
18
  import "../../chunk-TZQPOR5A.js";
19
19
  import {
20
20
  registerRichText,
21
21
  registerSchema
22
22
  } from "../../chunk-VKAGMEKE.js";
23
- import "../../chunk-RHWWQV3J.js";
23
+ import "../../chunk-BGHWUJFV.js";
24
24
  import "../../chunk-FM4M4Q2W.js";
25
25
  import "../../chunk-NSCT3AMV.js";
26
26
  import "../../chunk-JSBRDJBE.js";
@@ -1,25 +1,25 @@
1
1
  import {
2
2
  allSectionDefs
3
- } from "../../chunk-FOEZNEF5.js";
4
- import "../../chunk-5BFPJWIO.js";
5
- import "../../chunk-II3X7GLJ.js";
3
+ } from "../../chunk-HKHEAH5F.js";
4
+ import "../../chunk-KP4DWTPR.js";
5
+ import "../../chunk-GYCBWGVW.js";
6
6
  import "../../chunk-5THS4K5D.js";
7
- import "../../chunk-YDXBJR74.js";
8
- import "../../chunk-KPP2CFW6.js";
7
+ import "../../chunk-EWNDBKYK.js";
8
+ import "../../chunk-MUTHF2GT.js";
9
9
  import "../../chunk-ZSPCE6MZ.js";
10
- import "../../chunk-F2337B35.js";
10
+ import "../../chunk-26ALJO4K.js";
11
11
  import "../../chunk-Y4JQGO6G.js";
12
- import "../../chunk-S4L3ZFKM.js";
12
+ import "../../chunk-3COSXTOY.js";
13
13
  import "../../chunk-PZJL2S3Z.js";
14
14
  import "../../chunk-WDSVHKAH.js";
15
15
  import "../../chunk-72CG6AA2.js";
16
16
  import "../../chunk-7EOSDFS3.js";
17
- import "../../chunk-ZD6XGRQM.js";
17
+ import "../../chunk-TGNS7D4F.js";
18
18
  import "../../chunk-TZQPOR5A.js";
19
19
  import {
20
20
  registerSection
21
21
  } from "../../chunk-VKAGMEKE.js";
22
- import "../../chunk-RHWWQV3J.js";
22
+ import "../../chunk-BGHWUJFV.js";
23
23
  import "../../chunk-FM4M4Q2W.js";
24
24
  import "../../chunk-NSCT3AMV.js";
25
25
  import "../../chunk-JSBRDJBE.js";
@@ -1 +1 @@
1
- {"version":3,"file":"EditorShell.d.ts","sourceRoot":"","sources":["../../../src/components/shell/EditorShell.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAcjD,OAAO,EAAoC,KAAK,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAyDtF,OAAO,KAAK,EAAE,eAAe,EAA2D,MAAM,oBAAoB,CAAC;AAyCnH,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAoBxD,UAAU,KAAK;IACb,OAAO,EAAE,MAAM,CAAC;IAIhB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,QAAQ,EAAE,CAAC;IACtB,YAAY,EAAE;QACZ,KAAK,EAAE,OAAO,CAAC;QACf,aAAa,EAAE,OAAO,CAAC;QACvB,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AAE,OAAO,CAAC;QACf,aAAa,EAAE,OAAO,CAAC;QACvB,YAAY,EAAE,OAAO,CAAC;QACtB,cAAc,EAAE,OAAO,CAAC;QACxB,kBAAkB,EAAE,OAAO,CAAC;QAC5B,cAAc,EAAE,OAAO,CAAC;KACzB,CAAC;IACF,WAAW,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,OAAO,GAAG,QAAQ,CAAA;KAAE,GAAG,IAAI,CAAC;IAIhE,sBAAsB,CAAC,EAAE,OAAO,CAAC;IAKjC,eAAe,CAAC,EAAE,eAAe,GAAG,IAAI,CAAC;CAC1C;AAED,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,EAClC,OAAO,EACP,YAAY,EACZ,MAAM,EACN,SAAS,EAAE,gBAAgB,EAC3B,YAAY,EACZ,WAAW,EACX,sBAA8B,EAC9B,eAAe,GAChB,EAAE,KAAK,2CA4vDP;AAuED;6EAC6E;AAC7E,wBAAgB,kBAAkB,CAChC,YAAY,EAAE,WAAW,CAAC,YAAY,CAAC,EACvC,aAAa,EAAE,MAAM,GAAG,IAAI,EAC5B,eAAe,EAAE,MAAM,GAAG,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAK/B"}
@@ -10,6 +10,13 @@ interface PersistenceOptions {
10
10
  sectionId: string;
11
11
  content: SectionContent;
12
12
  }[], indexFlushed: boolean) => void;
13
+ /** Ref mirror of the shell's pending-deletion set, read at flush time and
14
+ * persisted alongside the index snapshot. Deletion is INTENT that cannot be
15
+ * inferred back from the snapshot: the restore path would otherwise diff the
16
+ * stale local index against a fresh remote read and treat sections a third
17
+ * party added in the meantime (MCP connector, peer editor) as local
18
+ * deletions — then delete them on the next save. */
19
+ deletedSectionsRef?: React.RefObject<Set<string>>;
13
20
  }
14
21
  export declare function useEditorPersistence(siteIndexRef: React.RefObject<SiteIndex>, options?: PersistenceOptions): {
15
22
  markSectionDirty: (sectionId: string, content: SectionContent) => void;
@@ -1 +1 @@
1
- {"version":3,"file":"useEditorPersistence.d.ts","sourceRoot":"","sources":["../../src/hooks/useEditorPersistence.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AA2BpE,UAAU,kBAAkB;IAC1B;;;;+DAI2D;IAC3D,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,cAAc,CAAA;KAAE,EAAE,EAAE,YAAY,EAAE,OAAO,KAAK,IAAI,CAAC;CACtG;AAED,wBAAgB,oBAAoB,CAClC,YAAY,EAAE,KAAK,CAAC,SAAS,CAAC,SAAS,CAAC,EACxC,OAAO,CAAC,EAAE,kBAAkB;kCAwFd,MAAM,WAAW,cAAc;;+BAmBC,MAAM;oCAiBD,MAAM;mCAQ3C,MAAM;4BAI6B,UAAU;;;;;;;yCAgCH,MAAM;;;qCAWhD,MAAM,cAAc,MAAM;EAuBzC"}
1
+ {"version":3,"file":"useEditorPersistence.d.ts","sourceRoot":"","sources":["../../src/hooks/useEditorPersistence.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AA2BpE,UAAU,kBAAkB;IAC1B;;;;+DAI2D;IAC3D,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,cAAc,CAAA;KAAE,EAAE,EAAE,YAAY,EAAE,OAAO,KAAK,IAAI,CAAC;IACrG;;;;;yDAKqD;IACrD,kBAAkB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC;CACnD;AAED,wBAAgB,oBAAoB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