@drawnagency/primitives 0.1.96 → 0.1.98
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.
- package/dist/{chunk-CI624HRS.js → chunk-26ALJO4K.js} +1 -1
- package/dist/{chunk-SOILPZ7U.js → chunk-3COSXTOY.js} +1 -1
- package/dist/{chunk-RHWWQV3J.js → chunk-BGHWUJFV.js} +1 -0
- package/dist/{chunk-RQPHPAT2.js → chunk-EWNDBKYK.js} +2 -2
- package/dist/{chunk-3HJDMFTB.js → chunk-FOY5TF7D.js} +1 -1
- package/dist/{chunk-YUUUCDXN.js → chunk-GYCBWGVW.js} +1 -1
- package/dist/chunk-HJSE6SK5.js +27 -0
- package/dist/{chunk-CSVGCAIH.js → chunk-HKHEAH5F.js} +7 -7
- package/dist/{chunk-IFCQWC3G.js → chunk-KP4DWTPR.js} +3 -3
- package/dist/{chunk-DJAJRBPD.js → chunk-MUTHF2GT.js} +2 -2
- package/dist/{chunk-CS2ECR3U.js → chunk-NA5EJM6Z.js} +24 -6
- package/dist/chunk-TGNS7D4F.js +200 -0
- package/dist/collab/rebase.d.ts +20 -0
- package/dist/collab/rebase.d.ts.map +1 -1
- package/dist/collab/rebase.js +17 -0
- package/dist/components/editor/DropEdgeIndicator.d.ts +6 -1
- package/dist/components/editor/DropEdgeIndicator.d.ts.map +1 -1
- package/dist/components/editor/NavGroupRow.d.ts +21 -0
- package/dist/components/editor/NavGroupRow.d.ts.map +1 -0
- package/dist/components/editor/PagesModal.d.ts +7 -1
- package/dist/components/editor/PagesModal.d.ts.map +1 -1
- package/dist/components/editor/index.js +5 -5
- package/dist/components/primitives/index.js +7 -7
- package/dist/components/sections/brand-guide.js +6 -6
- package/dist/components/sections/register-schemas.js +10 -10
- package/dist/components/sections/register.js +10 -10
- package/dist/components/shared/Navigation.d.ts.map +1 -1
- package/dist/components/shell/EditorShell.d.ts.map +1 -1
- package/dist/hooks/useEditorPersistence.d.ts +7 -0
- package/dist/hooks/useEditorPersistence.d.ts.map +1 -1
- package/dist/hooks/useSortableNavRow.d.ts +27 -0
- package/dist/hooks/useSortableNavRow.d.ts.map +1 -0
- package/dist/index.js +26 -8
- package/dist/lib/dexie.d.ts.map +1 -1
- package/dist/lib/dexie.js +9 -2
- package/dist/lib/index-ops.d.ts +138 -2
- package/dist/lib/index-ops.d.ts.map +1 -1
- package/dist/lib/index-ops.js +176 -8
- package/dist/lib/index.d.ts +1 -0
- package/dist/lib/index.d.ts.map +1 -1
- package/dist/lib/index.js +17 -6
- package/dist/lib/loader.d.ts +2 -2
- package/dist/lib/loader.d.ts.map +1 -1
- package/dist/lib/nav-tree.d.ts +63 -0
- package/dist/lib/nav-tree.d.ts.map +1 -0
- package/dist/lib/nav.d.ts +13 -2
- package/dist/lib/nav.d.ts.map +1 -1
- package/dist/lib/pages.d.ts +0 -1
- package/dist/lib/pages.d.ts.map +1 -1
- package/dist/lib/reorder.d.ts +24 -0
- package/dist/lib/reorder.d.ts.map +1 -1
- package/dist/media/index.js +3 -3
- package/dist/media/provider.d.ts +0 -1
- package/dist/media/provider.d.ts.map +1 -1
- package/dist/schemas/index.d.ts +1 -0
- package/dist/schemas/index.d.ts.map +1 -1
- package/dist/schemas/index.js +10 -2
- package/dist/schemas/nav.d.ts +40 -0
- package/dist/schemas/nav.d.ts.map +1 -0
- package/dist/schemas/site-config.d.ts +12 -1
- package/dist/schemas/site-config.d.ts.map +1 -1
- package/dist/types/database.d.ts +0 -3
- package/dist/types/database.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/collab/rebase.ts +35 -0
- package/src/components/editor/DropEdgeIndicator.tsx +15 -8
- package/src/components/editor/NavGroupRow.tsx +126 -0
- package/src/components/editor/PagesModal.tsx +150 -29
- package/src/components/shared/Navigation.tsx +51 -13
- package/src/components/shell/EditorShell.tsx +67 -18
- package/src/hooks/useEditorPersistence.ts +14 -0
- package/src/hooks/useSortableNavRow.ts +139 -0
- package/src/lib/dexie.ts +12 -2
- package/src/lib/index-ops.ts +261 -7
- package/src/lib/index.ts +1 -0
- package/src/lib/loader.ts +31 -4
- package/src/lib/nav-tree.ts +192 -0
- package/src/lib/nav.ts +43 -10
- package/src/lib/pages.ts +14 -11
- package/src/lib/reorder.ts +56 -0
- package/src/media/provider.ts +0 -1
- package/src/schemas/index.ts +1 -0
- package/src/schemas/nav.ts +36 -0
- package/src/schemas/site-config.ts +12 -2
- package/src/types/database.ts +0 -3
- package/dist/chunk-YBVK254P.js +0 -14
- /package/dist/{chunk-53DKVAB6.js → chunk-72CG6AA2.js} +0 -0
package/dist/lib/index-ops.js
CHANGED
|
@@ -1,7 +1,23 @@
|
|
|
1
|
+
import {
|
|
2
|
+
addGroup,
|
|
3
|
+
addPage,
|
|
4
|
+
deleteGroup,
|
|
5
|
+
deletePage,
|
|
6
|
+
groupOfPage,
|
|
7
|
+
moveNavEntry,
|
|
8
|
+
navEntries,
|
|
9
|
+
reconcileNav,
|
|
10
|
+
renameGroup,
|
|
11
|
+
setGroupStartCollapsed,
|
|
12
|
+
slugifyPageSlug,
|
|
13
|
+
uniquePageSlug
|
|
14
|
+
} from "../chunk-TGNS7D4F.js";
|
|
1
15
|
import {
|
|
2
16
|
IndexSchema,
|
|
3
|
-
|
|
4
|
-
|
|
17
|
+
PageStatusSchema,
|
|
18
|
+
RESERVED_SLUGS,
|
|
19
|
+
SLUG_RE
|
|
20
|
+
} from "../chunk-BGHWUJFV.js";
|
|
5
21
|
import "../chunk-FM4M4Q2W.js";
|
|
6
22
|
import "../chunk-JSBRDJBE.js";
|
|
7
23
|
|
|
@@ -9,6 +25,7 @@ import "../chunk-JSBRDJBE.js";
|
|
|
9
25
|
import { z } from "zod";
|
|
10
26
|
var OpStatusSchema = z.enum(["draft", "live", "archived"]);
|
|
11
27
|
var SAFE_SECTION_ID = /^[a-zA-Z0-9_-]{1,64}$/;
|
|
28
|
+
var SAFE_ENTITY_ID = /^[a-zA-Z0-9_-]{1,64}$/;
|
|
12
29
|
var SectionInsertSchema = z.object({
|
|
13
30
|
id: z.string().regex(SAFE_SECTION_ID, "Section ids may only contain letters, numbers, dashes and underscores (max 64 chars) \u2014 they become filenames.").describe("The new section's id: letters, numbers, dashes, underscores; max 64 chars. Must not already exist in the index."),
|
|
14
31
|
status: OpStatusSchema.optional().describe('Defaults to "draft" \u2014 invisible to viewers until promoted to "live".'),
|
|
@@ -49,7 +66,45 @@ var IndexOpSchema = z.discriminatedUnion("op", [
|
|
|
49
66
|
title: z.string().optional().describe("New page title."),
|
|
50
67
|
slug: z.string().optional().describe("New URL slug (lowercase words joined by dashes). Not settable on the home page, whose slug is always empty."),
|
|
51
68
|
showInNav: z.boolean().optional().describe("Whether the page appears in site navigation."),
|
|
52
|
-
access: z.array(z.string()).optional().describe("New audience slugs from list_audiences; [] means everyone.")
|
|
69
|
+
access: z.array(z.string()).optional().describe("New audience slugs from list_audiences; [] means everyone."),
|
|
70
|
+
status: PageStatusSchema.optional().describe('Page status. "archived" hides the page and its sections from viewers without deleting anything; the home page cannot be archived.')
|
|
71
|
+
}),
|
|
72
|
+
z.object({
|
|
73
|
+
op: z.literal("addPage"),
|
|
74
|
+
id: z.string().regex(SAFE_ENTITY_ID, "Page ids may only contain letters, numbers, dashes and underscores (max 64 chars).").describe("The new page's id: letters, numbers, dashes, underscores; max 64 chars. Must not already exist."),
|
|
75
|
+
title: z.string().describe("Page title, shown in navigation."),
|
|
76
|
+
slug: z.string().optional().describe("URL slug (lowercase words joined by dashes). Defaults to a unique slug derived from the title."),
|
|
77
|
+
showInNav: z.boolean().optional().describe("Whether the page appears in site navigation. Defaults to true."),
|
|
78
|
+
access: z.array(z.string()).optional().describe("Audience slugs from list_audiences. Defaults to [] (everyone)."),
|
|
79
|
+
navGroupId: z.string().optional().describe("Put the new page inside this existing nav group instead of at the top level.")
|
|
80
|
+
}),
|
|
81
|
+
z.object({
|
|
82
|
+
op: z.literal("removePage"),
|
|
83
|
+
pageId: z.string().describe("The page to delete. The home page cannot be deleted."),
|
|
84
|
+
removeSections: z.boolean().optional().describe("Required `true` when the page still holds sections \u2014 they are deleted with it and their content files removed. Without it a non-empty page is refused, so a page is never emptied by accident.")
|
|
85
|
+
}),
|
|
86
|
+
z.object({
|
|
87
|
+
op: z.literal("addNavGroup"),
|
|
88
|
+
id: z.string().regex(SAFE_ENTITY_ID, "Nav group ids may only contain letters, numbers, dashes and underscores (max 64 chars).").describe("The new group's id: letters, numbers, dashes, underscores; max 64 chars."),
|
|
89
|
+
label: z.string().optional().describe('Group heading in the sidebar. Blank renders as "Untitled group".'),
|
|
90
|
+
startCollapsed: z.boolean().optional().describe("Whether the group renders collapsed on first viewer load. Defaults to false."),
|
|
91
|
+
pageIds: z.array(z.string()).optional().describe("Existing page ids to move into the group, in order. A page belongs to at most one group, so listing it here removes it from wherever it was.")
|
|
92
|
+
}),
|
|
93
|
+
z.object({
|
|
94
|
+
op: z.literal("removeNavGroup"),
|
|
95
|
+
groupId: z.string().describe("The group to remove. Its member pages are NOT deleted \u2014 they become top-level nav entries at the group's former position.")
|
|
96
|
+
}),
|
|
97
|
+
z.object({
|
|
98
|
+
op: z.literal("setNavGroupMeta"),
|
|
99
|
+
groupId: z.string().describe("An existing nav group id."),
|
|
100
|
+
label: z.string().optional().describe("New sidebar heading."),
|
|
101
|
+
startCollapsed: z.boolean().optional().describe("Whether the group renders collapsed on first viewer load.")
|
|
102
|
+
}),
|
|
103
|
+
z.object({
|
|
104
|
+
op: z.literal("movePageInNav"),
|
|
105
|
+
pageId: z.string().describe("The page to reposition in the sidebar."),
|
|
106
|
+
groupId: z.string().nullable().describe("Destination group id, or null to move the page out to the top level."),
|
|
107
|
+
position: z.number().int().min(0).optional().describe("0-based slot within the destination (inside the group, or among top-level nav entries). Defaults to the end.")
|
|
53
108
|
})
|
|
54
109
|
]);
|
|
55
110
|
function collectPostedTypes(sections) {
|
|
@@ -70,6 +125,13 @@ function opTouchedSectionIds(ops) {
|
|
|
70
125
|
return [...ids];
|
|
71
126
|
}
|
|
72
127
|
var fmt = (ids) => ids.map((id) => `"${id}"`).join(", ");
|
|
128
|
+
function moveIntoGroup(index, pageId, groupId, position) {
|
|
129
|
+
const entries = navEntries(index);
|
|
130
|
+
const currentGroup = groupOfPage(index, pageId);
|
|
131
|
+
const from = currentGroup ? { groupId: currentGroup.id, index: currentGroup.pageIds.indexOf(pageId) } : { groupId: null, index: entries.findIndex((e) => e.kind === "page" && e.pageId === pageId) };
|
|
132
|
+
const destLength = groupId === null ? entries.length : entries.find((e) => e.kind === "group" && e.id === groupId)?.pageIds.length ?? 0;
|
|
133
|
+
return moveNavEntry(index, from, { groupId, index: position ?? destLength });
|
|
134
|
+
}
|
|
73
135
|
function applyIndexOps(rawIndex, ops, newSectionTypes) {
|
|
74
136
|
const base = IndexSchema.safeParse(rawIndex);
|
|
75
137
|
if (!base.success) {
|
|
@@ -78,14 +140,17 @@ function applyIndexOps(rawIndex, ops, newSectionTypes) {
|
|
|
78
140
|
error: "the site's current index could not be parsed, so indexOps cannot be applied \u2014 read it with get_site_index and post a repaired full `index` instead. " + base.error.issues.map((i) => i.message).join("; ")
|
|
79
141
|
};
|
|
80
142
|
}
|
|
81
|
-
const
|
|
143
|
+
const rawNav = rawIndex?.nav;
|
|
144
|
+
let index = {
|
|
82
145
|
...base.data,
|
|
83
146
|
pages: base.data.pages.map((p) => ({ ...p, order: [...p.order] })),
|
|
84
|
-
sections: Object.fromEntries(Object.entries(base.data.sections).map(([k, v]) => [k, { ...v }]))
|
|
147
|
+
sections: Object.fromEntries(Object.entries(base.data.sections).map(([k, v]) => [k, { ...v }])),
|
|
148
|
+
...Array.isArray(rawNav) ? { nav: rawNav } : {}
|
|
85
149
|
};
|
|
86
150
|
const removed = /* @__PURE__ */ new Set();
|
|
87
151
|
const warnings = [];
|
|
88
152
|
const fail = (error) => ({ ok: false, error });
|
|
153
|
+
let navTouched = false;
|
|
89
154
|
for (const [i, op] of ops.entries()) {
|
|
90
155
|
const at = `indexOps[${i}] ${op.op}`;
|
|
91
156
|
if (op.op === "insertAfter" || op.op === "insertAt") {
|
|
@@ -181,11 +246,112 @@ function applyIndexOps(rawIndex, ops, newSectionTypes) {
|
|
|
181
246
|
if (op.access !== void 0) meta.access = op.access;
|
|
182
247
|
continue;
|
|
183
248
|
}
|
|
184
|
-
if (op.
|
|
185
|
-
|
|
249
|
+
if (op.op === "addPage") {
|
|
250
|
+
if (index.pages.some((p) => p.id === op.id)) {
|
|
251
|
+
return fail(`${at}: a page with id "${op.id}" already exists \u2014 use setPageMeta to edit it.`);
|
|
252
|
+
}
|
|
253
|
+
let slug;
|
|
254
|
+
if (op.slug !== void 0) {
|
|
255
|
+
if (!SLUG_RE.test(op.slug)) {
|
|
256
|
+
return fail(`${at}: slug "${op.slug}" is not a valid URL slug \u2014 use lowercase words joined by dashes (e.g. "brand-guide").`);
|
|
257
|
+
}
|
|
258
|
+
if (RESERVED_SLUGS.includes(op.slug)) {
|
|
259
|
+
return fail(`${at}: slug "${op.slug}" is reserved by a platform route and would shadow this page. Pick another slug.`);
|
|
260
|
+
}
|
|
261
|
+
if (index.pages.some((p) => p.slug === op.slug)) {
|
|
262
|
+
return fail(`${at}: slug "${op.slug}" is already used by another page. Slugs must be unique.`);
|
|
263
|
+
}
|
|
264
|
+
slug = op.slug;
|
|
265
|
+
} else {
|
|
266
|
+
slug = uniquePageSlug(slugifyPageSlug(op.title), index.pages.map((p) => p.slug));
|
|
267
|
+
}
|
|
268
|
+
if (op.navGroupId !== void 0 && !navEntries(index).some((e) => e.kind === "group" && e.id === op.navGroupId)) {
|
|
269
|
+
return fail(`${at}: no nav group with id "${op.navGroupId}" \u2014 create it with addNavGroup first, or omit navGroupId to place the page at the top level.`);
|
|
270
|
+
}
|
|
271
|
+
index = addPage(index, op.id);
|
|
272
|
+
const created = index.pages.find((p) => p.id === op.id);
|
|
273
|
+
created.title = op.title;
|
|
274
|
+
created.slug = slug;
|
|
275
|
+
if (op.showInNav !== void 0) created.showInNav = op.showInNav;
|
|
276
|
+
if (op.access !== void 0) created.access = op.access;
|
|
277
|
+
if (op.navGroupId !== void 0) {
|
|
278
|
+
index = moveIntoGroup(index, op.id, op.navGroupId, void 0);
|
|
279
|
+
}
|
|
280
|
+
navTouched = true;
|
|
281
|
+
continue;
|
|
282
|
+
}
|
|
283
|
+
if (op.op === "removePage") {
|
|
284
|
+
const page2 = index.pages.find((p) => p.id === op.pageId);
|
|
285
|
+
if (!page2) return fail(`${at}: no page with id "${op.pageId}" \u2014 page ids come from get_site_index.`);
|
|
286
|
+
if (page2.isHome) {
|
|
287
|
+
return fail(`${at}: the home page cannot be removed \u2014 it is the site's root. Promote a different page to home in the editor first.`);
|
|
288
|
+
}
|
|
289
|
+
if (page2.order.length > 0 && op.removeSections !== true) {
|
|
290
|
+
return fail(
|
|
291
|
+
`${at}: page "${op.pageId}" still holds ${page2.order.length} section(s) (${fmt(page2.order.slice(0, 5))}${page2.order.length > 5 ? ", \u2026" : ""}). Pass removeSections: true to delete them with the page, or move them elsewhere first with move ops.`
|
|
292
|
+
);
|
|
293
|
+
}
|
|
294
|
+
const result2 = deletePage(index, op.pageId);
|
|
295
|
+
index = result2.index;
|
|
296
|
+
for (const id of result2.removedSectionIds) removed.add(id);
|
|
297
|
+
navTouched = true;
|
|
298
|
+
continue;
|
|
299
|
+
}
|
|
300
|
+
if (op.op === "addNavGroup") {
|
|
301
|
+
const entries = navEntries(index);
|
|
302
|
+
if (entries.some((e) => e.kind === "group" && e.id === op.id)) {
|
|
303
|
+
return fail(`${at}: a nav group with id "${op.id}" already exists \u2014 use setNavGroupMeta to edit it.`);
|
|
304
|
+
}
|
|
305
|
+
const missing = (op.pageIds ?? []).filter((id) => !index.pages.some((p) => p.id === id));
|
|
306
|
+
if (missing.length > 0) {
|
|
307
|
+
return fail(`${at}: no page with id ${fmt(missing)} \u2014 page ids come from get_site_index.`);
|
|
308
|
+
}
|
|
309
|
+
index = addGroup(index, op.id);
|
|
310
|
+
if (op.label !== void 0) index = renameGroup(index, op.id, op.label);
|
|
311
|
+
if (op.startCollapsed !== void 0) index = setGroupStartCollapsed(index, op.id, op.startCollapsed);
|
|
312
|
+
for (const pageId of op.pageIds ?? []) index = moveIntoGroup(index, pageId, op.id, void 0);
|
|
313
|
+
navTouched = true;
|
|
314
|
+
continue;
|
|
315
|
+
}
|
|
316
|
+
if (op.op === "removeNavGroup") {
|
|
317
|
+
if (!navEntries(index).some((e) => e.kind === "group" && e.id === op.groupId)) {
|
|
318
|
+
return fail(`${at}: no nav group with id "${op.groupId}" \u2014 group ids come from the \`nav\` on get_site_index.`);
|
|
319
|
+
}
|
|
320
|
+
index = deleteGroup(index, op.groupId);
|
|
321
|
+
navTouched = true;
|
|
322
|
+
continue;
|
|
323
|
+
}
|
|
324
|
+
if (op.op === "setNavGroupMeta") {
|
|
325
|
+
if (op.label === void 0 && op.startCollapsed === void 0) {
|
|
326
|
+
return fail(`${at}: nothing to set \u2014 provide label and/or startCollapsed.`);
|
|
327
|
+
}
|
|
328
|
+
if (!navEntries(index).some((e) => e.kind === "group" && e.id === op.groupId)) {
|
|
329
|
+
return fail(`${at}: no nav group with id "${op.groupId}" \u2014 group ids come from the \`nav\` on get_site_index.`);
|
|
330
|
+
}
|
|
331
|
+
if (op.label !== void 0) index = renameGroup(index, op.groupId, op.label);
|
|
332
|
+
if (op.startCollapsed !== void 0) index = setGroupStartCollapsed(index, op.groupId, op.startCollapsed);
|
|
333
|
+
navTouched = true;
|
|
334
|
+
continue;
|
|
335
|
+
}
|
|
336
|
+
if (op.op === "movePageInNav") {
|
|
337
|
+
if (!index.pages.some((p) => p.id === op.pageId)) {
|
|
338
|
+
return fail(`${at}: no page with id "${op.pageId}" \u2014 page ids come from get_site_index.`);
|
|
339
|
+
}
|
|
340
|
+
if (op.groupId !== null && !navEntries(index).some((e) => e.kind === "group" && e.id === op.groupId)) {
|
|
341
|
+
return fail(`${at}: no nav group with id "${op.groupId}" \u2014 group ids come from the \`nav\` on get_site_index.`);
|
|
342
|
+
}
|
|
343
|
+
index = moveIntoGroup(index, op.pageId, op.groupId, op.position);
|
|
344
|
+
navTouched = true;
|
|
345
|
+
continue;
|
|
346
|
+
}
|
|
347
|
+
if (op.title === void 0 && op.slug === void 0 && op.showInNav === void 0 && op.access === void 0 && op.status === void 0) {
|
|
348
|
+
return fail(`${at}: nothing to set \u2014 provide title, slug, showInNav, access and/or status.`);
|
|
186
349
|
}
|
|
187
350
|
const page = index.pages.find((p) => p.id === op.pageId);
|
|
188
351
|
if (!page) return fail(`${at}: no page with id "${op.pageId}" \u2014 page ids come from get_site_index.`);
|
|
352
|
+
if (op.status === "archived" && page.isHome) {
|
|
353
|
+
return fail(`${at}: the home page cannot be archived \u2014 it is the site's root. Promote a different page to home in the editor first.`);
|
|
354
|
+
}
|
|
189
355
|
if (op.slug !== void 0 && page.isHome) {
|
|
190
356
|
return fail(`${at}: the home page's slug is always empty and cannot be set. Promote a different page to home in the editor if you need to change which page is the root.`);
|
|
191
357
|
}
|
|
@@ -195,6 +361,7 @@ function applyIndexOps(rawIndex, ops, newSectionTypes) {
|
|
|
195
361
|
if (op.title !== void 0) page.title = op.title;
|
|
196
362
|
if (op.slug !== void 0) page.slug = op.slug;
|
|
197
363
|
if (op.showInNav !== void 0) page.showInNav = op.showInNav;
|
|
364
|
+
if (op.status !== void 0) page.status = op.status;
|
|
198
365
|
if (op.access !== void 0) {
|
|
199
366
|
const dropped = page.access.filter((a) => !op.access.includes(a));
|
|
200
367
|
page.access = op.access;
|
|
@@ -213,7 +380,8 @@ function applyIndexOps(rawIndex, ops, newSectionTypes) {
|
|
|
213
380
|
if (!validated.success) {
|
|
214
381
|
return fail(`applying indexOps produced an invalid index: ${validated.error.issues.map((issue) => issue.message).join("; ")}`);
|
|
215
382
|
}
|
|
216
|
-
|
|
383
|
+
const result = navTouched ? { ...validated.data, nav: reconcileNav(index.nav ?? [], validated.data.pages) } : validated.data;
|
|
384
|
+
return { ok: true, index: result, removedIds, warnings };
|
|
217
385
|
}
|
|
218
386
|
export {
|
|
219
387
|
IndexOpSchema,
|
package/dist/lib/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export { cn } from "./cn";
|
|
|
3
3
|
export { audiencePasses } from "./pages";
|
|
4
4
|
export { resolveChatbotName, resolveThinkingPhrases, DEFAULT_CHATBOT_NAME } from "./chatbot";
|
|
5
5
|
export { generateNavLinks, toSectionId, type NavItem } from "./nav";
|
|
6
|
+
export { navEntries, pagesInNavOrder, groupOfPage, groupDisplayLabel, reconcileNav } from "./nav-tree";
|
|
6
7
|
export { deriveContrast, contrastColor, relativeLuminance, contrastRatio, wcagLevel, suggestAccessibleOn, type WcagLevel, } from "./contrast";
|
|
7
8
|
export { primaryVarValue, accentVarValue, onPrimaryVarValue } from "./theme-vars";
|
|
8
9
|
export { sanitizeHtml, ensureSanitizer } from "./sanitize";
|
package/dist/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/lib/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAC5B,OAAO,EAAE,EAAE,EAAE,MAAM,MAAM,CAAC;AAC1B,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AAC7F,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,KAAK,OAAO,EAAE,MAAM,OAAO,CAAC;AACpE,OAAO,EACL,cAAc,EACd,aAAa,EACb,iBAAiB,EACjB,aAAa,EACb,SAAS,EACT,mBAAmB,EACnB,KAAK,SAAS,GACf,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAClF,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,KAAK,SAAS,EAAE,MAAM,SAAS,CAAC;AAChE,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,cAAc,EAAE,aAAa,EAAE,KAAK,UAAU,EAAE,MAAM,UAAU,CAAC;AACtG,OAAO,EACL,cAAc,EACd,aAAa,EACb,eAAe,EACf,cAAc,EACd,UAAU,EACV,SAAS,EACT,cAAc,EACd,aAAa,EACb,aAAa,EACb,KAAK,eAAe,EACpB,KAAK,iBAAiB,EACtB,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACnB,KAAK,uBAAuB,GAC7B,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,gBAAgB,EAChB,qBAAqB,EACrB,eAAe,EACf,KAAK,aAAa,EAClB,KAAK,WAAW,GACjB,MAAM,UAAU,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/lib/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAC5B,OAAO,EAAE,EAAE,EAAE,MAAM,MAAM,CAAC;AAC1B,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AAC7F,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,KAAK,OAAO,EAAE,MAAM,OAAO,CAAC;AACpE,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,WAAW,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AACvG,OAAO,EACL,cAAc,EACd,aAAa,EACb,iBAAiB,EACjB,aAAa,EACb,SAAS,EACT,mBAAmB,EACnB,KAAK,SAAS,GACf,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAClF,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,KAAK,SAAS,EAAE,MAAM,SAAS,CAAC;AAChE,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,cAAc,EAAE,aAAa,EAAE,KAAK,UAAU,EAAE,MAAM,UAAU,CAAC;AACtG,OAAO,EACL,cAAc,EACd,aAAa,EACb,eAAe,EACf,cAAc,EACd,UAAU,EACV,SAAS,EACT,cAAc,EACd,aAAa,EACb,aAAa,EACb,KAAK,eAAe,EACpB,KAAK,iBAAiB,EACtB,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACnB,KAAK,uBAAuB,GAC7B,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,gBAAgB,EAChB,qBAAqB,EACrB,eAAe,EACf,KAAK,aAAa,EAClB,KAAK,WAAW,GACjB,MAAM,UAAU,CAAC"}
|
package/dist/lib/index.js
CHANGED
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
safeRedirect,
|
|
19
19
|
suggestAccessibleOn,
|
|
20
20
|
wcagLevel
|
|
21
|
-
} from "../chunk-
|
|
21
|
+
} from "../chunk-NA5EJM6Z.js";
|
|
22
22
|
import {
|
|
23
23
|
curatedIcons,
|
|
24
24
|
getIcon
|
|
@@ -34,15 +34,21 @@ import {
|
|
|
34
34
|
generateNavLinks,
|
|
35
35
|
sanitizeHtml,
|
|
36
36
|
toSectionId
|
|
37
|
-
} from "../chunk-
|
|
37
|
+
} from "../chunk-72CG6AA2.js";
|
|
38
38
|
import {
|
|
39
39
|
cn
|
|
40
40
|
} from "../chunk-7EOSDFS3.js";
|
|
41
|
-
import {
|
|
42
|
-
audiencePasses
|
|
43
|
-
} from "../chunk-YBVK254P.js";
|
|
44
41
|
import "../chunk-S2L3BPLS.js";
|
|
42
|
+
import {
|
|
43
|
+
audiencePasses,
|
|
44
|
+
groupDisplayLabel,
|
|
45
|
+
groupOfPage,
|
|
46
|
+
navEntries,
|
|
47
|
+
pagesInNavOrder,
|
|
48
|
+
reconcileNav
|
|
49
|
+
} from "../chunk-TGNS7D4F.js";
|
|
45
50
|
import "../chunk-5BM2Y3NJ.js";
|
|
51
|
+
import "../chunk-HJSE6SK5.js";
|
|
46
52
|
import "../chunk-TZQPOR5A.js";
|
|
47
53
|
import {
|
|
48
54
|
clearRegistry,
|
|
@@ -55,7 +61,7 @@ import {
|
|
|
55
61
|
registerSchema,
|
|
56
62
|
registerSection
|
|
57
63
|
} from "../chunk-VKAGMEKE.js";
|
|
58
|
-
import "../chunk-
|
|
64
|
+
import "../chunk-BGHWUJFV.js";
|
|
59
65
|
import "../chunk-FM4M4Q2W.js";
|
|
60
66
|
import "../chunk-NSCT3AMV.js";
|
|
61
67
|
import {
|
|
@@ -88,12 +94,17 @@ export {
|
|
|
88
94
|
getSchema,
|
|
89
95
|
getSection,
|
|
90
96
|
gridColsClass,
|
|
97
|
+
groupDisplayLabel,
|
|
98
|
+
groupOfPage,
|
|
91
99
|
loadSiteContent,
|
|
92
100
|
loadStaticSiteContent,
|
|
93
101
|
mergeSiteContent,
|
|
94
102
|
navChangeEvent,
|
|
103
|
+
navEntries,
|
|
95
104
|
onPrimaryVarValue,
|
|
105
|
+
pagesInNavOrder,
|
|
96
106
|
primaryVarValue,
|
|
107
|
+
reconcileNav,
|
|
97
108
|
registerSchema,
|
|
98
109
|
registerSection,
|
|
99
110
|
relativeLuminance,
|
package/dist/lib/loader.d.ts
CHANGED
|
@@ -13,13 +13,13 @@ export interface SiteContent {
|
|
|
13
13
|
* Validates each section file against its Zod schema.
|
|
14
14
|
* Returns sections in the concatenated order of every page's order.
|
|
15
15
|
*/
|
|
16
|
-
export declare function mergeSiteContent(index: SiteIndex, sectionFiles: Record<string, unknown
|
|
16
|
+
export declare function mergeSiteContent(index: SiteIndex, sectionFiles: Record<string, unknown>, navFile?: unknown): SiteContent;
|
|
17
17
|
/**
|
|
18
18
|
* Build a SiteContent from a Vite `import.meta.glob` result.
|
|
19
19
|
* Callers glob the section JSON files at build time, pass the parsed index, and
|
|
20
20
|
* receive sections merged across every page's order.
|
|
21
21
|
*/
|
|
22
|
-
export declare function loadStaticSiteContent(index: SiteIndex, sectionGlob: Record<string, unknown
|
|
22
|
+
export declare function loadStaticSiteContent(index: SiteIndex, sectionGlob: Record<string, unknown>, navFile?: unknown): SiteContent;
|
|
23
23
|
/**
|
|
24
24
|
* Load site content from the filesystem.
|
|
25
25
|
* For use in scripts and tests — Astro pages should use import.meta.glob instead.
|
package/dist/lib/loader.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../src/lib/loader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,KAAK,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACrE,OAAO,EAAe,KAAK,SAAS,EAAE,KAAK,WAAW,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../src/lib/loader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,KAAK,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACrE,OAAO,EAAe,KAAK,SAAS,EAAE,KAAK,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAMvF,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,WAAW,CAAC;CACnB;AAED,MAAM,WAAW,WAAW;IAC1B,QAAQ,EAAE,aAAa,EAAE,CAAC;IAC1B,KAAK,EAAE,SAAS,CAAC;CAClB;AAiBD;;;;GAIG;AACH,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,SAAS,EAChB,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACrC,OAAO,CAAC,EAAE,OAAO,GAChB,WAAW,CA6Cb;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,SAAS,EAChB,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACpC,OAAO,CAAC,EAAE,OAAO,GAChB,WAAW,CAQb;AAED;;;GAGG;AACH,wBAAsB,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CAwB9E"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type { NavEntry, NavGroupEntry } from "../schemas/nav";
|
|
2
|
+
import type { Page, SiteIndex } from "../schemas/site-config";
|
|
3
|
+
/**
|
|
4
|
+
* Repair an authored nav against the current page set.
|
|
5
|
+
*
|
|
6
|
+
* Total, pure, and idempotent: every possible input maps to a valid nav in
|
|
7
|
+
* which each page appears exactly once. This is what lets the sidecar tolerate
|
|
8
|
+
* an older writer editing index.json without knowing about nav.json — the worst
|
|
9
|
+
* case is a page drifting to the bottom of the nav, never a hard failure. It is
|
|
10
|
+
* deliberately NOT a schema refinement: parse-rejecting content leaves viewer
|
|
11
|
+
* and editor both refusing to load, with no in-product repair path.
|
|
12
|
+
*
|
|
13
|
+
* "Total" is meant literally, so the shape guards below are load-bearing rather
|
|
14
|
+
* than paranoia: callers include agent-authored JSON and live editor state, and
|
|
15
|
+
* `pages` is not id-unique (IndexSchema checks slug uniqueness, not page ids).
|
|
16
|
+
* Every entry is cloned on the way out — the editor holds this in React state,
|
|
17
|
+
* where a returned-by-reference entry would let a later mutation silently edit
|
|
18
|
+
* prior state and defeat identity-based re-render checks.
|
|
19
|
+
*/
|
|
20
|
+
export declare function reconcileNav(entries: NavEntry[], pages: Page[]): NavEntry[];
|
|
21
|
+
/**
|
|
22
|
+
* The ONLY sanctioned way to read the nav. Always reconciles, so callers never
|
|
23
|
+
* have to reason about whether index.nav is present, stale, or authored by an
|
|
24
|
+
* older writer. Cheap and idempotent — call it freely.
|
|
25
|
+
*/
|
|
26
|
+
export declare function navEntries(index: SiteIndex): NavEntry[];
|
|
27
|
+
/** Pages in authored nav order. Use this anywhere user-visible sequence matters. */
|
|
28
|
+
export declare function pagesInNavOrder(index: SiteIndex): Page[];
|
|
29
|
+
export declare function groupOfPage(index: SiteIndex, pageId: string): NavGroupEntry | null;
|
|
30
|
+
/** Display fallback for blank group labels — mirrors pageDisplayTitle in lib/pages.ts. */
|
|
31
|
+
export declare function groupDisplayLabel(label: string): string;
|
|
32
|
+
/** A position in the nav: inside a group, or at the top level when groupId is null. */
|
|
33
|
+
export interface NavLocation {
|
|
34
|
+
groupId: string | null;
|
|
35
|
+
index: number;
|
|
36
|
+
}
|
|
37
|
+
export type NavRow = {
|
|
38
|
+
kind: "page";
|
|
39
|
+
pageId: string;
|
|
40
|
+
groupId: string | null;
|
|
41
|
+
index: number;
|
|
42
|
+
} | {
|
|
43
|
+
kind: "group";
|
|
44
|
+
groupId: string;
|
|
45
|
+
index: number;
|
|
46
|
+
} | {
|
|
47
|
+
kind: "empty-group";
|
|
48
|
+
groupId: string;
|
|
49
|
+
} | {
|
|
50
|
+
kind: "tail";
|
|
51
|
+
};
|
|
52
|
+
export declare function addGroup(index: SiteIndex, groupId: string): SiteIndex;
|
|
53
|
+
export declare function renameGroup(index: SiteIndex, groupId: string, label: string): SiteIndex;
|
|
54
|
+
export declare function setGroupStartCollapsed(index: SiteIndex, groupId: string, startCollapsed: boolean): SiteIndex;
|
|
55
|
+
/** Removes the group; its members become top-level entries at the group's slot. */
|
|
56
|
+
export declare function deleteGroup(index: SiteIndex, groupId: string): SiteIndex;
|
|
57
|
+
/**
|
|
58
|
+
* The single reorder+reparent primitive. `from` and `to` are both NavLocations,
|
|
59
|
+
* so moving within a container, between containers, and promoting/demoting a
|
|
60
|
+
* page are all the same operation.
|
|
61
|
+
*/
|
|
62
|
+
export declare function moveNavEntry(index: SiteIndex, from: NavLocation, to: NavLocation): SiteIndex;
|
|
63
|
+
//# sourceMappingURL=nav-tree.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nav-tree.d.ts","sourceRoot":"","sources":["../../src/lib/nav-tree.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC9D,OAAO,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAE9D;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,QAAQ,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,QAAQ,EAAE,CA0C3E;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,SAAS,GAAG,QAAQ,EAAE,CAEvD;AAED,oFAAoF;AACpF,wBAAgB,eAAe,CAAC,KAAK,EAAE,SAAS,GAAG,IAAI,EAAE,CAexD;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,GAAG,aAAa,GAAG,IAAI,CAKlF;AAED,0FAA0F;AAC1F,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEvD;AAED,uFAAuF;AACvF,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,MAAM,MAAM,GACd;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GACvE;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GACjD;IAAE,IAAI,EAAE,aAAa,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GAIxC;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAMrB,wBAAgB,QAAQ,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,GAAG,SAAS,CAKrE;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,SAAS,CAIvF;AAED,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,OAAO,GAAG,SAAS,CAI5G;AAED,mFAAmF;AACnF,wBAAgB,WAAW,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,GAAG,SAAS,CAUxE;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,WAAW,EAAE,EAAE,EAAE,WAAW,GAAG,SAAS,CAgC5F"}
|
package/dist/lib/nav.d.ts
CHANGED
|
@@ -17,9 +17,20 @@ export interface PageNavItem {
|
|
|
17
17
|
isActive: boolean;
|
|
18
18
|
headings: NavItem[];
|
|
19
19
|
}
|
|
20
|
-
export interface
|
|
20
|
+
export interface GroupNavItem {
|
|
21
|
+
kind: "group";
|
|
22
|
+
id: string;
|
|
23
|
+
label: string;
|
|
24
|
+
startCollapsed: boolean;
|
|
21
25
|
pages: PageNavItem[];
|
|
22
|
-
|
|
26
|
+
}
|
|
27
|
+
export type SiteNavEntry = ({
|
|
28
|
+
kind: "page";
|
|
29
|
+
} & PageNavItem) | GroupNavItem;
|
|
30
|
+
export interface SiteNav {
|
|
31
|
+
/** The authored tree: loose pages and groups, in nav order. */
|
|
32
|
+
entries: SiteNavEntry[];
|
|
33
|
+
/** Live pages with showInNav off — editor-only flat bucket, like the archive. */
|
|
23
34
|
hidden: PageNavItem[];
|
|
24
35
|
archive: PageNavItem[];
|
|
25
36
|
}
|
package/dist/lib/nav.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nav.d.ts","sourceRoot":"","sources":["../../src/lib/nav.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,EAAc,KAAK,eAAe,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"nav.d.ts","sourceRoot":"","sources":["../../src/lib/nav.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,EAAc,KAAK,eAAe,EAAE,MAAM,YAAY,CAAC;AAG9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAExD,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,OAAO,EAAE,CAAC;CACrB;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAchD;AAED,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,aAAa,EAAE,EACzB,QAAQ,CAAC,EAAE,eAAe,GACzB,OAAO,EAAE,CAqDX;AAED,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE,OAAO,EAAE,CAAC;CACrB;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,OAAO,CAAC;IACd,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,cAAc,EAAE,OAAO,CAAC;IACxB,KAAK,EAAE,WAAW,EAAE,CAAC;CACtB;AAED,MAAM,MAAM,YAAY,GAAG,CAAC;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,WAAW,CAAC,GAAG,YAAY,CAAC;AAE3E,MAAM,WAAW,OAAO;IACtB,+DAA+D;IAC/D,OAAO,EAAE,YAAY,EAAE,CAAC;IACxB,iFAAiF;IACjF,MAAM,EAAE,WAAW,EAAE,CAAC;IACtB,OAAO,EAAE,WAAW,EAAE,CAAC;CACxB;AAMD,wBAAgB,eAAe,CAAC,IAAI,EAAE;IACpC,KAAK,EAAE,SAAS,CAAC;IACjB,cAAc,EAAE,aAAa,EAAE,CAAC;IAChC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,IAAI,EAAE,QAAQ,GAAG,QAAQ,CAAC;IAC1B,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,QAAQ,CAAC,EAAE,eAAe,CAAC;CAC5B,GAAG,OAAO,CAiDV"}
|
package/dist/lib/pages.d.ts
CHANGED
|
@@ -13,7 +13,6 @@ export declare function homePage(index: SiteIndex): Page;
|
|
|
13
13
|
export declare function pageBySlug(index: SiteIndex, slug: string): Page | undefined;
|
|
14
14
|
export declare function audiencePasses(access: string[], audience: string | null): boolean;
|
|
15
15
|
export declare function addPage(index: SiteIndex, id: string): SiteIndex;
|
|
16
|
-
export declare function reorderPages(index: SiteIndex, fromIndex: number, toIndex: number): SiteIndex;
|
|
17
16
|
export declare function setHomePage(index: SiteIndex, pageId: string): SiteIndex;
|
|
18
17
|
export declare function setPageArchived(index: SiteIndex, pageId: string, archived: boolean): SiteIndex;
|
|
19
18
|
export declare function setPageFields(index: SiteIndex, pageId: string, patch: Partial<Pick<Page, "title" | "slug" | "showInNav">>): SiteIndex;
|
package/dist/lib/pages.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pages.d.ts","sourceRoot":"","sources":["../../src/lib/pages.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAK3E,OAAO,EAAyB,KAAK,eAAe,EAAE,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"pages.d.ts","sourceRoot":"","sources":["../../src/lib/pages.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAK3E,OAAO,EAAyB,KAAK,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAG1F;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEtD;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAErD;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,MAAM,CAQvE;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAEvE;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,SAAS,GAAG,IAAI,CAE/C;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAI3E;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAIjF;AAMD,wBAAgB,OAAO,CAAC,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,GAAG,SAAS,CAY/D;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,GAAG,SAAS,CAWvE;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,GAAG,SAAS,CAM9F;AAED,wBAAgB,aAAa,CAC3B,KAAK,EAAE,SAAS,EAChB,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,GAAG,WAAW,CAAC,CAAC,GACzD,SAAS,CAEX;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,eAAe,CAAC,GAAG,SAAS,CAgB5G;AAED,wBAAgB,eAAe,CAC7B,KAAK,EAAE,SAAS,EAChB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EAAE,GACf;IAAE,KAAK,EAAE,SAAS,CAAC;IAAC,eAAe,EAAE,MAAM,EAAE,CAAA;CAAE,CAkBjD;AAED,wBAAgB,UAAU,CACxB,KAAK,EAAE,SAAS,EAChB,MAAM,EAAE,MAAM,GACb;IAAE,KAAK,EAAE,SAAS,CAAC;IAAC,iBAAiB,EAAE,MAAM,EAAE,CAAA;CAAE,CAiBnD;AAED,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,SAAS,EAChB,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,WAAW,EACjB,WAAW,EAAE,MAAM,GAClB,SAAS,CAQX;AAED,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,GAAG,SAAS,CAOrF;AAED,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,SAAS,EAChB,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,MAAM,GACd,SAAS,CAWX;AAED,wBAAgB,WAAW,CACzB,KAAK,EAAE,SAAS,EAChB,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,KAAK,GAAG,QAAQ,GACzB,SAAS,CAuBX"}
|
package/dist/lib/reorder.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { NavLocation, NavRow } from "./nav-tree";
|
|
1
2
|
/**
|
|
2
3
|
* Compute the destination index for a closest-edge drag-to-reorder drop.
|
|
3
4
|
*
|
|
@@ -9,4 +10,27 @@
|
|
|
9
10
|
* Returns the target index, or `null` when the drop would not move the row.
|
|
10
11
|
*/
|
|
11
12
|
export declare function computeReorderTarget(fromIndex: number, overIndex: number, edge: "top" | "bottom" | null): number | null;
|
|
13
|
+
/**
|
|
14
|
+
* Resolve a closest-edge drop over a nav row into a destination NavLocation.
|
|
15
|
+
*
|
|
16
|
+
* With one level of nesting a target's own identity determines its container,
|
|
17
|
+
* so page drags need no depth inference. Group drags DO need remapping: a group
|
|
18
|
+
* can only live at the top level, so hovering a member row is reinterpreted as
|
|
19
|
+
* "next to that member's group" rather than rejected — otherwise every member
|
|
20
|
+
* row of every expanded group is an inert dead zone during a group drag.
|
|
21
|
+
*
|
|
22
|
+
* `overEntryIndex` is the row's index in the TOP-LEVEL entry list: its own index
|
|
23
|
+
* for a top-level page or group row, its enclosing group's index for a member
|
|
24
|
+
* row, and the total entry count for the tail row. Group-drag remapping targets
|
|
25
|
+
* it directly.
|
|
26
|
+
*
|
|
27
|
+
* Returns null when the drop would not move anything, or is not permitted.
|
|
28
|
+
*/
|
|
29
|
+
export declare function computeNavDropTarget(args: {
|
|
30
|
+
from: NavLocation;
|
|
31
|
+
fromKind: "page" | "group";
|
|
32
|
+
over: NavRow;
|
|
33
|
+
overEntryIndex: number;
|
|
34
|
+
edge: "top" | "bottom" | null;
|
|
35
|
+
}): NavLocation | null;
|
|
12
36
|
//# sourceMappingURL=reorder.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reorder.d.ts","sourceRoot":"","sources":["../../src/lib/reorder.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAClC,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,KAAK,GAAG,QAAQ,GAAG,IAAI,GAC5B,MAAM,GAAG,IAAI,CAKf"}
|
|
1
|
+
{"version":3,"file":"reorder.d.ts","sourceRoot":"","sources":["../../src/lib/reorder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAEtD;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAClC,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,KAAK,GAAG,QAAQ,GAAG,IAAI,GAC5B,MAAM,GAAG,IAAI,CAKf;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE;IACzC,IAAI,EAAE,WAAW,CAAC;IAClB,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,cAAc,EAAE,MAAM,CAAC;IACvB,IAAI,EAAE,KAAK,GAAG,QAAQ,GAAG,IAAI,CAAC;CAC/B,GAAG,WAAW,GAAG,IAAI,CA8BrB"}
|
package/dist/media/index.js
CHANGED
|
@@ -18,15 +18,15 @@ import {
|
|
|
18
18
|
resolveMedia,
|
|
19
19
|
sanitizeMediaName,
|
|
20
20
|
setMediaProvider
|
|
21
|
-
} from "../chunk-
|
|
22
|
-
import "../chunk-
|
|
21
|
+
} from "../chunk-3COSXTOY.js";
|
|
22
|
+
import "../chunk-TGNS7D4F.js";
|
|
23
23
|
import {
|
|
24
24
|
ImageManifestSchema,
|
|
25
25
|
MediaConfigSchema,
|
|
26
26
|
MediaFolderSchema,
|
|
27
27
|
MediaItemSchema,
|
|
28
28
|
VariantSchema
|
|
29
|
-
} from "../chunk-
|
|
29
|
+
} from "../chunk-BGHWUJFV.js";
|
|
30
30
|
import "../chunk-FM4M4Q2W.js";
|
|
31
31
|
import "../chunk-JSBRDJBE.js";
|
|
32
32
|
export {
|
package/dist/media/provider.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { MediaManifest, MediaItem, ResolvedMedia } from "./types";
|
|
2
2
|
export interface MediaProvider {
|
|
3
|
-
getManifest(): Promise<MediaManifest>;
|
|
4
3
|
resolve(item: MediaItem, sizes: number[]): ResolvedMedia | null;
|
|
5
4
|
exists(hash: string, manifest: MediaManifest): boolean;
|
|
6
5
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../src/media/provider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAEvE,MAAM,WAAW,aAAa;IAC5B,
|
|
1
|
+
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../src/media/provider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAEvE,MAAM,WAAW,aAAa;IAC5B,OAAO,CAAC,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,aAAa,GAAG,IAAI,CAAC;IAChE,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,aAAa,GAAG,OAAO,CAAC;CACxD"}
|
package/dist/schemas/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/schemas/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,sBAAsB,CAAC;AACrC,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/schemas/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,OAAO,CAAC;AACtB,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,sBAAsB,CAAC;AACrC,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC"}
|
package/dist/schemas/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
AudienceNameSchema,
|
|
4
4
|
MediaGridOptionsSchema,
|
|
5
5
|
slugifyAudienceName
|
|
6
|
-
} from "../chunk-
|
|
6
|
+
} from "../chunk-FOY5TF7D.js";
|
|
7
7
|
import {
|
|
8
8
|
AudienceSchema,
|
|
9
9
|
RoleSchema,
|
|
@@ -16,6 +16,10 @@ import {
|
|
|
16
16
|
LinkValueSchema,
|
|
17
17
|
isSafeHref
|
|
18
18
|
} from "../chunk-PZJL2S3Z.js";
|
|
19
|
+
import {
|
|
20
|
+
NavEntrySchema,
|
|
21
|
+
NavFileSchema
|
|
22
|
+
} from "../chunk-HJSE6SK5.js";
|
|
19
23
|
import {
|
|
20
24
|
getSectionContentSchema,
|
|
21
25
|
getSectionSchema
|
|
@@ -35,6 +39,7 @@ import {
|
|
|
35
39
|
PageSchema,
|
|
36
40
|
PageStatusSchema,
|
|
37
41
|
RESERVED_SLUGS,
|
|
42
|
+
SLUG_RE,
|
|
38
43
|
SectionMetaSchema,
|
|
39
44
|
SingleMediaReferenceSchema,
|
|
40
45
|
SiteConfigSchema,
|
|
@@ -42,7 +47,7 @@ import {
|
|
|
42
47
|
TextLineSchema,
|
|
43
48
|
VariantSchema,
|
|
44
49
|
normalizeSiteIndex
|
|
45
|
-
} from "../chunk-
|
|
50
|
+
} from "../chunk-BGHWUJFV.js";
|
|
46
51
|
import "../chunk-FM4M4Q2W.js";
|
|
47
52
|
import "../chunk-NSCT3AMV.js";
|
|
48
53
|
import "../chunk-JSBRDJBE.js";
|
|
@@ -64,10 +69,13 @@ export {
|
|
|
64
69
|
MediaGridOptionsSchema,
|
|
65
70
|
MediaItemSchema,
|
|
66
71
|
MediaReferenceSchema,
|
|
72
|
+
NavEntrySchema,
|
|
73
|
+
NavFileSchema,
|
|
67
74
|
PageSchema,
|
|
68
75
|
PageStatusSchema,
|
|
69
76
|
RESERVED_SLUGS,
|
|
70
77
|
RoleSchema,
|
|
78
|
+
SLUG_RE,
|
|
71
79
|
SectionMetaSchema,
|
|
72
80
|
SessionSchema,
|
|
73
81
|
SingleMediaReferenceSchema,
|