@drawnagency/primitives 0.1.49 → 0.1.50
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-P3HO76OS.js → chunk-DLXIYIG2.js} +6 -3
- package/dist/{chunk-5XYUO4HP.js → chunk-ICRCH3GI.js} +19 -2
- package/dist/{chunk-BJ6FYGYP.js → chunk-ONBJG426.js} +95 -9
- package/dist/components/editor/MoveSectionModal.d.ts +12 -0
- package/dist/components/editor/MoveSectionModal.d.ts.map +1 -0
- package/dist/components/editor/PagesModal.d.ts +18 -0
- package/dist/components/editor/PagesModal.d.ts.map +1 -0
- package/dist/components/editor/SectionWrapper.d.ts +1 -1
- package/dist/components/editor/SectionWrapper.d.ts.map +1 -1
- package/dist/components/editor/SettingsForm.d.ts.map +1 -1
- package/dist/components/sections/Button/CTAButton.d.ts +3 -3
- package/dist/components/sections/Button/CTAButton.d.ts.map +1 -1
- package/dist/components/sections/Button/index.d.ts +10 -2
- package/dist/components/sections/Button/index.d.ts.map +1 -1
- package/dist/components/shared/Input.d.ts +1 -0
- package/dist/components/shared/Input.d.ts.map +1 -1
- package/dist/components/shared/LinkField.d.ts +9 -0
- package/dist/components/shared/LinkField.d.ts.map +1 -0
- package/dist/components/shared/Navigation.d.ts +4 -3
- package/dist/components/shared/Navigation.d.ts.map +1 -1
- package/dist/components/shared/PagesContext.d.ts +13 -0
- package/dist/components/shared/PagesContext.d.ts.map +1 -0
- package/dist/components/shell/EditorShell.d.ts.map +1 -1
- package/dist/index.js +17 -3
- package/dist/lib/dexie.d.ts.map +1 -1
- package/dist/lib/dexie.js +16 -3
- package/dist/lib/events.d.ts +3 -1
- package/dist/lib/events.d.ts.map +1 -1
- package/dist/lib/index.js +2 -2
- package/dist/lib/links.d.ts +14 -0
- package/dist/lib/links.d.ts.map +1 -0
- package/dist/lib/loader.d.ts +2 -2
- package/dist/lib/loader.d.ts.map +1 -1
- package/dist/lib/nav.d.ts +23 -0
- package/dist/lib/nav.d.ts.map +1 -1
- package/dist/lib/pages.d.ts +31 -0
- package/dist/lib/pages.d.ts.map +1 -0
- package/dist/lib/registry.d.ts +7 -0
- package/dist/lib/registry.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 +17 -3
- package/dist/schemas/link.d.ts +24 -0
- package/dist/schemas/link.d.ts.map +1 -0
- package/dist/schemas/site-config.d.ts +128 -3
- package/dist/schemas/site-config.d.ts.map +1 -1
- package/package.json +5 -1
- package/src/components/editor/MoveSectionModal.tsx +38 -0
- package/src/components/editor/PagesModal.tsx +392 -0
- package/src/components/editor/SectionWrapper.tsx +13 -0
- package/src/components/editor/SettingsForm.tsx +12 -0
- package/src/components/sections/Button/CTAButton.tsx +10 -11
- package/src/components/sections/Button/index.tsx +4 -9
- package/src/components/shared/Input.tsx +14 -3
- package/src/components/shared/LinkField.tsx +87 -0
- package/src/components/shared/Navigation.tsx +131 -136
- package/src/components/shared/PagesContext.tsx +12 -0
- package/src/components/shell/EditorShell.tsx +273 -78
- package/src/hooks/useEditorPublish.ts +1 -1
- package/src/lib/dexie.ts +18 -5
- package/src/lib/events.ts +3 -1
- package/src/lib/links.ts +41 -0
- package/src/lib/loader.ts +5 -4
- package/src/lib/nav.ts +59 -0
- package/src/lib/pages.ts +209 -0
- package/src/lib/registry.ts +8 -0
- package/src/schemas/index.ts +1 -0
- package/src/schemas/link.ts +17 -0
- package/src/schemas/site-config.ts +113 -11
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
getAllSchemas,
|
|
4
4
|
getSection,
|
|
5
5
|
getSectionSchema
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-ONBJG426.js";
|
|
7
7
|
import {
|
|
8
8
|
safeNextPath
|
|
9
9
|
} from "./chunk-S2L3BPLS.js";
|
|
@@ -224,13 +224,16 @@ var editModeEvent = createEvent("editmodechange");
|
|
|
224
224
|
var navChangeEvent = createEvent("sitenavchange");
|
|
225
225
|
var darkModeEvent = createEvent("sitedarkmode");
|
|
226
226
|
var historySelectEvent = createEvent("history-select");
|
|
227
|
+
var siteNavChangeEvent = createEvent("sitenavchange-v2");
|
|
228
|
+
var pageSelectEvent = createEvent("pageselect");
|
|
227
229
|
|
|
228
230
|
// src/lib/loader.ts
|
|
229
231
|
function mergeSiteContent(index, sectionFiles) {
|
|
230
232
|
const sections = [];
|
|
231
233
|
const canValidate = getAllSchemas().length >= 2;
|
|
232
234
|
const schema = canValidate ? getSectionSchema() : null;
|
|
233
|
-
|
|
235
|
+
const orderedIds = index.pages.flatMap((p) => p.order);
|
|
236
|
+
for (const id of orderedIds) {
|
|
234
237
|
const raw = sectionFiles[id];
|
|
235
238
|
if (!raw) {
|
|
236
239
|
console.warn(`Section file missing for id: ${id}, skipping`);
|
|
@@ -268,7 +271,7 @@ async function loadSiteContent(contentDir) {
|
|
|
268
271
|
const indexRaw = JSON.parse(await fs.readFile(indexPath, "utf-8"));
|
|
269
272
|
const index = IndexSchema.parse(indexRaw);
|
|
270
273
|
const sectionFiles = {};
|
|
271
|
-
for (const id of index.order) {
|
|
274
|
+
for (const id of index.pages.flatMap((p) => p.order)) {
|
|
272
275
|
const sectionPath = path.join(contentDir, "sections", `${id}.json`);
|
|
273
276
|
sectionFiles[id] = JSON.parse(await fs.readFile(sectionPath, "utf-8"));
|
|
274
277
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
HexColorSchema
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-ONBJG426.js";
|
|
4
4
|
|
|
5
5
|
// src/schemas/audience.ts
|
|
6
6
|
import { z } from "zod";
|
|
@@ -22,9 +22,26 @@ var MediaGridOptionsSchema = z2.object({
|
|
|
22
22
|
showCaptions: z2.boolean().optional()
|
|
23
23
|
}).default({});
|
|
24
24
|
|
|
25
|
+
// src/schemas/link.ts
|
|
26
|
+
import { z as z3 } from "zod";
|
|
27
|
+
var LinkTargetSchema = z3.enum(["_self", "_blank"]);
|
|
28
|
+
var LinkValueSchema = z3.discriminatedUnion("kind", [
|
|
29
|
+
z3.object({ kind: z3.literal("external"), href: z3.string(), target: LinkTargetSchema }),
|
|
30
|
+
z3.object({
|
|
31
|
+
kind: z3.literal("internal"),
|
|
32
|
+
pageId: z3.string(),
|
|
33
|
+
anchorSectionId: z3.string().nullable().optional(),
|
|
34
|
+
target: LinkTargetSchema
|
|
35
|
+
})
|
|
36
|
+
]);
|
|
37
|
+
var DEFAULT_LINK = { kind: "external", href: "", target: "_self" };
|
|
38
|
+
|
|
25
39
|
export {
|
|
26
40
|
AudienceNameSchema,
|
|
27
41
|
AudienceColorSchema,
|
|
28
42
|
slugifyAudienceName,
|
|
29
|
-
MediaGridOptionsSchema
|
|
43
|
+
MediaGridOptionsSchema,
|
|
44
|
+
LinkTargetSchema,
|
|
45
|
+
LinkValueSchema,
|
|
46
|
+
DEFAULT_LINK
|
|
30
47
|
};
|
|
@@ -161,18 +161,100 @@ var SectionMetaSchema = z3.object({
|
|
|
161
161
|
status: StatusSchema,
|
|
162
162
|
access: z3.array(z3.string())
|
|
163
163
|
});
|
|
164
|
-
var
|
|
164
|
+
var RESERVED_SLUGS = ["edit", "api", "login", "set-password", "404"];
|
|
165
|
+
var PageStatusSchema = z3.enum(["live", "archived"]);
|
|
166
|
+
var PageSchema = z3.object({
|
|
167
|
+
id: z3.string().min(1),
|
|
168
|
+
title: z3.string(),
|
|
169
|
+
slug: z3.string(),
|
|
170
|
+
isHome: z3.boolean(),
|
|
171
|
+
showInNav: z3.boolean(),
|
|
172
|
+
status: PageStatusSchema,
|
|
173
|
+
access: z3.array(z3.string()),
|
|
174
|
+
order: z3.array(z3.string())
|
|
175
|
+
});
|
|
176
|
+
var SLUG_RE = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
|
|
177
|
+
var RawIndexSchema = z3.object({
|
|
165
178
|
siteId: z3.string(),
|
|
166
|
-
order: z3.array(z3.string()),
|
|
179
|
+
order: z3.array(z3.string()).optional(),
|
|
180
|
+
pages: z3.array(PageSchema).optional(),
|
|
167
181
|
sections: z3.record(z3.string(), SectionMetaSchema),
|
|
168
182
|
lastModified: z3.string().nullable().optional()
|
|
169
|
-
})
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
return
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
183
|
+
});
|
|
184
|
+
function normalizeRawIndex(data) {
|
|
185
|
+
if (data.pages && data.pages.length > 0) {
|
|
186
|
+
return {
|
|
187
|
+
siteId: data.siteId,
|
|
188
|
+
pages: data.pages,
|
|
189
|
+
sections: data.sections,
|
|
190
|
+
lastModified: data.lastModified ?? null
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
const order = data.order ?? Object.keys(data.sections);
|
|
194
|
+
return {
|
|
195
|
+
siteId: data.siteId,
|
|
196
|
+
pages: [
|
|
197
|
+
{
|
|
198
|
+
id: "home",
|
|
199
|
+
title: "Home",
|
|
200
|
+
slug: "",
|
|
201
|
+
isHome: true,
|
|
202
|
+
showInNav: true,
|
|
203
|
+
status: "live",
|
|
204
|
+
access: [],
|
|
205
|
+
order
|
|
206
|
+
}
|
|
207
|
+
],
|
|
208
|
+
sections: data.sections,
|
|
209
|
+
lastModified: data.lastModified ?? null
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
var CanonicalIndexSchema = z3.object({
|
|
213
|
+
siteId: z3.string(),
|
|
214
|
+
pages: z3.array(PageSchema),
|
|
215
|
+
sections: z3.record(z3.string(), SectionMetaSchema),
|
|
216
|
+
lastModified: z3.string().nullable().optional()
|
|
217
|
+
}).superRefine((data, ctx) => {
|
|
218
|
+
const homes = data.pages.filter((p) => p.isHome);
|
|
219
|
+
if (homes.length !== 1) {
|
|
220
|
+
ctx.addIssue({ code: z3.ZodIssueCode.custom, message: "Exactly one page must be the home page" });
|
|
221
|
+
}
|
|
222
|
+
if (homes[0]?.status === "archived") {
|
|
223
|
+
ctx.addIssue({ code: z3.ZodIssueCode.custom, message: "The home page cannot be archived" });
|
|
224
|
+
}
|
|
225
|
+
if (homes[0] && homes[0].slug !== "") {
|
|
226
|
+
ctx.addIssue({ code: z3.ZodIssueCode.custom, message: "The home page slug must be empty" });
|
|
227
|
+
}
|
|
228
|
+
const seenSlugs = /* @__PURE__ */ new Set();
|
|
229
|
+
for (const p of data.pages) {
|
|
230
|
+
if (!p.isHome) {
|
|
231
|
+
if (!SLUG_RE.test(p.slug)) {
|
|
232
|
+
ctx.addIssue({ code: z3.ZodIssueCode.custom, message: `Invalid slug "${p.slug}"` });
|
|
233
|
+
}
|
|
234
|
+
if (RESERVED_SLUGS.includes(p.slug)) {
|
|
235
|
+
ctx.addIssue({ code: z3.ZodIssueCode.custom, message: `Slug "${p.slug}" is reserved` });
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
if (seenSlugs.has(p.slug)) {
|
|
239
|
+
ctx.addIssue({ code: z3.ZodIssueCode.custom, message: `Duplicate slug "${p.slug}"` });
|
|
240
|
+
}
|
|
241
|
+
seenSlugs.add(p.slug);
|
|
242
|
+
}
|
|
243
|
+
const fromPages = [];
|
|
244
|
+
for (const p of data.pages) fromPages.push(...p.order);
|
|
245
|
+
const fromPagesSet = new Set(fromPages);
|
|
246
|
+
if (fromPages.length !== fromPagesSet.size) {
|
|
247
|
+
ctx.addIssue({ code: z3.ZodIssueCode.custom, message: "A section id appears in more than one page" });
|
|
248
|
+
}
|
|
249
|
+
const sectionKeys = Object.keys(data.sections);
|
|
250
|
+
if (fromPagesSet.size !== sectionKeys.length || !sectionKeys.every((k) => fromPagesSet.has(k))) {
|
|
251
|
+
ctx.addIssue({ code: z3.ZodIssueCode.custom, message: "Page section orders must partition sections{} exactly" });
|
|
252
|
+
}
|
|
253
|
+
});
|
|
254
|
+
var IndexSchema = RawIndexSchema.transform(normalizeRawIndex).pipe(CanonicalIndexSchema);
|
|
255
|
+
function normalizeSiteIndex(raw) {
|
|
256
|
+
return IndexSchema.parse(raw);
|
|
257
|
+
}
|
|
176
258
|
var SiteConfigSchema = z3.object({
|
|
177
259
|
siteName: z3.string().default("Brand Portal"),
|
|
178
260
|
primaryColor: HexColorSchema.default("#009ca6"),
|
|
@@ -205,6 +287,10 @@ export {
|
|
|
205
287
|
getSectionContentSchema,
|
|
206
288
|
getSectionSchema,
|
|
207
289
|
SectionMetaSchema,
|
|
290
|
+
RESERVED_SLUGS,
|
|
291
|
+
PageStatusSchema,
|
|
292
|
+
PageSchema,
|
|
208
293
|
IndexSchema,
|
|
294
|
+
normalizeSiteIndex,
|
|
209
295
|
SiteConfigSchema
|
|
210
296
|
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
interface Props {
|
|
2
|
+
pages: {
|
|
3
|
+
id: string;
|
|
4
|
+
title: string;
|
|
5
|
+
}[];
|
|
6
|
+
currentPageId: string;
|
|
7
|
+
onMove: (destPageId: string, position: "top" | "bottom") => void;
|
|
8
|
+
onCancel: () => void;
|
|
9
|
+
}
|
|
10
|
+
export declare function MoveSectionModal({ pages, currentPageId, onMove, onCancel }: Props): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=MoveSectionModal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MoveSectionModal.d.ts","sourceRoot":"","sources":["../../../src/components/editor/MoveSectionModal.tsx"],"names":[],"mappings":"AAKA,UAAU,KAAK;IACb,KAAK,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IACvC,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,GAAG,QAAQ,KAAK,IAAI,CAAC;IACjE,QAAQ,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,wBAAgB,gBAAgB,CAAC,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,KAAK,2CAyBjF"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { SiteIndex, Page } from "../../schemas/site-config";
|
|
2
|
+
import type { Audience } from "../../auth/types";
|
|
3
|
+
export interface PagesModalProps {
|
|
4
|
+
index: SiteIndex;
|
|
5
|
+
audiences: Audience[];
|
|
6
|
+
onReorder: (fromIndex: number, toIndex: number) => void;
|
|
7
|
+
/** Creates the page and returns its id so the modal can expand the new row. */
|
|
8
|
+
onAddPage: () => string;
|
|
9
|
+
onSetHome: (pageId: string) => void;
|
|
10
|
+
onSetArchived: (pageId: string, archived: boolean) => void;
|
|
11
|
+
onSetFields: (pageId: string, patch: Partial<Pick<Page, "title" | "slug" | "showInNav">>) => void;
|
|
12
|
+
onSetAudience: (pageId: string, access: string[]) => void;
|
|
13
|
+
onConfirmDelete: (pageId: string) => void;
|
|
14
|
+
/** Navigate the editor to this page (the shell also closes the modal). */
|
|
15
|
+
onNavigate: (pageId: string) => void;
|
|
16
|
+
}
|
|
17
|
+
export declare function PagesModal(props: PagesModalProps): import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
//# sourceMappingURL=PagesModal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PagesModal.d.ts","sourceRoot":"","sources":["../../../src/components/editor/PagesModal.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAUjD,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,SAAS,CAAC;IACjB,SAAS,EAAE,QAAQ,EAAE,CAAC;IACtB,SAAS,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACxD,+EAA+E;IAC/E,SAAS,EAAE,MAAM,MAAM,CAAC;IACxB,SAAS,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACpC,aAAa,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,KAAK,IAAI,CAAC;IAC3D,WAAW,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,GAAG,WAAW,CAAC,CAAC,KAAK,IAAI,CAAC;IAClG,aAAa,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IAC1D,eAAe,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1C,0EAA0E;IAC1E,UAAU,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;CACtC;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,2CA4EhD"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { WrapperProps } from "../../lib/registry";
|
|
2
|
-
export declare function SectionWrapper({ sectionId, sectionType, status, dirty, index, isLast, definition, options, audiences, access, onAccessChange, onStatusChange, onSectionChange, onReorder, onRequestInsert, onDelete, mainStatus, contentDiffersFromMain, isLocalOnly, children, }: WrapperProps): import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare function SectionWrapper({ sectionId, sectionType, status, dirty, index, isLast, definition, options, audiences, access, onAccessChange, onStatusChange, onSectionChange, onReorder, onRequestInsert, onDelete, onMoveSection, mainStatus, contentDiffersFromMain, isLocalOnly, children, }: WrapperProps): import("react/jsx-runtime").JSX.Element;
|
|
3
3
|
//# sourceMappingURL=SectionWrapper.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SectionWrapper.d.ts","sourceRoot":"","sources":["../../../src/components/editor/SectionWrapper.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SectionWrapper.d.ts","sourceRoot":"","sources":["../../../src/components/editor/SectionWrapper.tsx"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAGvD,wBAAgB,cAAc,CAAC,EAC7B,SAAS,EACT,WAAW,EACX,MAAM,EACN,KAAK,EACL,KAAK,EACL,MAAM,EACN,UAAU,EACV,OAAO,EACP,SAAS,EACT,MAAM,EACN,cAAc,EACd,cAAc,EACd,eAAe,EACf,SAAS,EACT,eAAe,EACf,QAAQ,EACR,aAAa,EACb,UAAU,EACV,sBAAsB,EACtB,WAAW,EACX,QAAQ,GACT,EAAE,YAAY,2CA4Rd"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SettingsForm.d.ts","sourceRoot":"","sources":["../../../src/components/editor/SettingsForm.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAoB,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"SettingsForm.d.ts","sourceRoot":"","sources":["../../../src/components/editor/SettingsForm.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAoB,MAAM,oBAAoB,CAAC;AAS3E,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAClC;AAED,UAAU,iBAAiB;IACzB,MAAM,EAAE,cAAc,CAAC;IACvB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC,QAAQ,EAAE,CAAC,MAAM,EAAE,kBAAkB,KAAK,IAAI,CAAC;CAChD;AAmED,wBAAgB,YAAY,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,iBAAiB,2CAoF3E"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { SectionContent } from "../../../schemas/sections";
|
|
2
|
+
import type { LinkValue } from "../../../schemas/link";
|
|
2
3
|
interface Props {
|
|
3
4
|
text: string;
|
|
4
|
-
|
|
5
|
-
target?: string;
|
|
5
|
+
link?: LinkValue;
|
|
6
6
|
download?: boolean;
|
|
7
7
|
onChange?: (content: SectionContent) => void;
|
|
8
8
|
}
|
|
9
|
-
export default function Button({ text,
|
|
9
|
+
export default function Button({ text, link, download, onChange }: Props): import("react/jsx-runtime").JSX.Element;
|
|
10
10
|
export {};
|
|
11
11
|
//# sourceMappingURL=CTAButton.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CTAButton.d.ts","sourceRoot":"","sources":["../../../../src/components/sections/Button/CTAButton.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"CTAButton.d.ts","sourceRoot":"","sources":["../../../../src/components/sections/Button/CTAButton.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAEvD,UAAU,KAAK;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,cAAc,KAAK,IAAI,CAAC;CAC9C;AAED,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAAE,KAAK,2CAmCvE"}
|
|
@@ -2,8 +2,16 @@ declare const _default: import("../../..").SectionDefinition<{
|
|
|
2
2
|
type: "button";
|
|
3
3
|
content: {
|
|
4
4
|
text: string;
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
link?: {
|
|
6
|
+
kind: "external";
|
|
7
|
+
href: string;
|
|
8
|
+
target: "_self" | "_blank";
|
|
9
|
+
} | {
|
|
10
|
+
kind: "internal";
|
|
11
|
+
pageId: string;
|
|
12
|
+
target: "_self" | "_blank";
|
|
13
|
+
anchorSectionId?: string | null | undefined;
|
|
14
|
+
} | undefined;
|
|
7
15
|
download?: boolean | undefined;
|
|
8
16
|
};
|
|
9
17
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/sections/Button/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/sections/Button/index.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAeA,wBAmBG"}
|
|
@@ -2,6 +2,7 @@ import { type InputHTMLAttributes } from "react";
|
|
|
2
2
|
interface InputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "onChange"> {
|
|
3
3
|
label: string;
|
|
4
4
|
onChange: (value: string) => void;
|
|
5
|
+
error?: string;
|
|
5
6
|
}
|
|
6
7
|
export declare const Input: import("react").ForwardRefExoticComponent<InputProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
7
8
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Input.d.ts","sourceRoot":"","sources":["../../../src/components/shared/Input.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAqB,KAAK,mBAAmB,EAAE,MAAM,OAAO,CAAC;AAIpE,UAAU,UAAW,SAAQ,IAAI,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,EAAE,UAAU,CAAC;IAClF,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"Input.d.ts","sourceRoot":"","sources":["../../../src/components/shared/Input.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAqB,KAAK,mBAAmB,EAAE,MAAM,OAAO,CAAC;AAIpE,UAAU,UAAW,SAAQ,IAAI,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,EAAE,UAAU,CAAC;IAClF,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,eAAO,MAAM,KAAK,yGAkChB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { LinkValue } from "../../schemas/link";
|
|
2
|
+
interface Props {
|
|
3
|
+
label: string;
|
|
4
|
+
value: LinkValue;
|
|
5
|
+
onChange: (value: LinkValue) => void;
|
|
6
|
+
}
|
|
7
|
+
export declare function LinkField({ label, value, onChange }: Props): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=LinkField.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LinkField.d.ts","sourceRoot":"","sources":["../../../src/components/shared/LinkField.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAGpD,UAAU,KAAK;IACb,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,SAAS,CAAC;IACjB,QAAQ,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,IAAI,CAAC;CACtC;AAOD,wBAAgB,SAAS,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,KAAK,2CAoE1D"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { SiteNav } from "../../lib/nav";
|
|
2
2
|
interface Props {
|
|
3
|
-
|
|
3
|
+
siteNav: SiteNav;
|
|
4
4
|
siteName: string;
|
|
5
5
|
darkMode: "light" | "dark" | "optional";
|
|
6
6
|
lastUpdated: string | null;
|
|
7
|
+
onPageSelect?: (pageId: string) => void;
|
|
7
8
|
}
|
|
8
|
-
export default function Navigation({
|
|
9
|
+
export default function Navigation({ siteNav: initialNav, siteName, darkMode, lastUpdated, onPageSelect }: Props): import("react/jsx-runtime").JSX.Element;
|
|
9
10
|
export {};
|
|
10
11
|
//# sourceMappingURL=Navigation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Navigation.d.ts","sourceRoot":"","sources":["../../../src/components/shared/Navigation.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,
|
|
1
|
+
{"version":3,"file":"Navigation.d.ts","sourceRoot":"","sources":["../../../src/components/shared/Navigation.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAW,MAAM,eAAe,CAAC;AAOtD,UAAU,KAAK;IACb,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,OAAO,GAAG,MAAM,GAAG,UAAU,CAAC;IACxC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAG3B,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;CACzC;AAED,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,EAAE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,QAAQ,EAAE,WAAW,EAAE,YAAY,EAAE,EAAE,KAAK,2CAwN/G"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface PagesContextValue {
|
|
2
|
+
pages: {
|
|
3
|
+
id: string;
|
|
4
|
+
title: string;
|
|
5
|
+
}[];
|
|
6
|
+
getPageHeadings: (pageId: string) => {
|
|
7
|
+
id: string;
|
|
8
|
+
label: string;
|
|
9
|
+
}[];
|
|
10
|
+
}
|
|
11
|
+
export declare const PagesContext: import("react").Context<PagesContextValue>;
|
|
12
|
+
export declare function usePages(): PagesContextValue;
|
|
13
|
+
//# sourceMappingURL=PagesContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PagesContext.d.ts","sourceRoot":"","sources":["../../../src/components/shared/PagesContext.tsx"],"names":[],"mappings":"AAEA,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IACvC,eAAe,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;CACtE;AAED,eAAO,MAAM,YAAY,4CAA6E,CAAC;AAEvG,wBAAgB,QAAQ,IAAI,iBAAiB,CAE5C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EditorShell.d.ts","sourceRoot":"","sources":["../../../src/components/shell/EditorShell.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"EditorShell.d.ts","sourceRoot":"","sources":["../../../src/components/shell/EditorShell.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAgEjD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAQxD,UAAU,KAAK;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,QAAQ,EAAE,CAAC;IACtB,YAAY,EAAE;QACZ,KAAK,EAAE,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;CACjE;AAED,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,EAClC,OAAO,EACP,MAAM,EACN,SAAS,EAAE,gBAAgB,EAC3B,YAAY,EACZ,WAAW,GACZ,EAAE,KAAK,2CA+2BP"}
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
AudienceColorSchema,
|
|
3
3
|
AudienceNameSchema,
|
|
4
|
+
DEFAULT_LINK,
|
|
5
|
+
LinkTargetSchema,
|
|
6
|
+
LinkValueSchema,
|
|
4
7
|
MediaGridOptionsSchema,
|
|
5
8
|
slugifyAudienceName
|
|
6
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-ICRCH3GI.js";
|
|
7
10
|
import {
|
|
8
11
|
AudienceSchema,
|
|
9
12
|
RoleSchema,
|
|
@@ -30,13 +33,16 @@ import {
|
|
|
30
33
|
safeRedirect,
|
|
31
34
|
sanitizeHtml,
|
|
32
35
|
toSectionId
|
|
33
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-DLXIYIG2.js";
|
|
34
37
|
import {
|
|
35
38
|
ColorItemSchema,
|
|
36
39
|
ColorSpaceSchema,
|
|
37
40
|
HexColorSchema,
|
|
38
41
|
IndexSchema,
|
|
39
42
|
MediaReferenceSchema,
|
|
43
|
+
PageSchema,
|
|
44
|
+
PageStatusSchema,
|
|
45
|
+
RESERVED_SLUGS,
|
|
40
46
|
SectionMetaSchema,
|
|
41
47
|
SiteConfigSchema,
|
|
42
48
|
TextLineSchema,
|
|
@@ -49,9 +55,10 @@ import {
|
|
|
49
55
|
getSection,
|
|
50
56
|
getSectionContentSchema,
|
|
51
57
|
getSectionSchema,
|
|
58
|
+
normalizeSiteIndex,
|
|
52
59
|
registerSchema,
|
|
53
60
|
registerSection
|
|
54
|
-
} from "./chunk-
|
|
61
|
+
} from "./chunk-ONBJG426.js";
|
|
55
62
|
import {
|
|
56
63
|
AUDIENCE_COOKIE,
|
|
57
64
|
LastOwnerError,
|
|
@@ -98,17 +105,23 @@ export {
|
|
|
98
105
|
AudienceSchema,
|
|
99
106
|
ColorItemSchema,
|
|
100
107
|
ColorSpaceSchema,
|
|
108
|
+
DEFAULT_LINK,
|
|
101
109
|
EXT_TO_MIME,
|
|
102
110
|
HexColorSchema,
|
|
103
111
|
ImageManifestSchema,
|
|
104
112
|
IndexSchema,
|
|
105
113
|
LastOwnerError,
|
|
114
|
+
LinkTargetSchema,
|
|
115
|
+
LinkValueSchema,
|
|
106
116
|
MIME_TO_EXT,
|
|
107
117
|
MediaConfigSchema,
|
|
108
118
|
MediaGridOptionsSchema,
|
|
109
119
|
MediaItemSchema,
|
|
110
120
|
MediaReferenceSchema,
|
|
121
|
+
PageSchema,
|
|
122
|
+
PageStatusSchema,
|
|
111
123
|
ProcessingQueue,
|
|
124
|
+
RESERVED_SLUGS,
|
|
112
125
|
RoleSchema,
|
|
113
126
|
SESSION_COOKIE,
|
|
114
127
|
SESSION_MAX_AGE_SECONDS,
|
|
@@ -152,6 +165,7 @@ export {
|
|
|
152
165
|
mergeSiteContent,
|
|
153
166
|
mimeToExt,
|
|
154
167
|
navChangeEvent,
|
|
168
|
+
normalizeSiteIndex,
|
|
155
169
|
registerSchema,
|
|
156
170
|
registerSection,
|
|
157
171
|
requireSessionSecret,
|
package/dist/lib/dexie.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dexie.d.ts","sourceRoot":"","sources":["../../src/lib/dexie.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,KAAK,EAAE,SAAS,EAAe,UAAU,
|
|
1
|
+
{"version":3,"file":"dexie.d.ts","sourceRoot":"","sources":["../../src/lib/dexie.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,KAAK,EAAE,SAAS,EAAe,UAAU,EAAQ,MAAM,wBAAwB,CAAC;AACvF,OAAO,KAAK,EAAE,aAAa,EAAE,MAA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62
62
|
return tx.table("pendingMedia").clear();
|
|
63
63
|
});
|
|
64
|
+
this.version(7).stores({
|
|
65
|
+
sections: "sectionId",
|
|
66
|
+
siteIndex: "key",
|
|
67
|
+
meta: "key",
|
|
68
|
+
siteConfig: "key",
|
|
69
|
+
contentCache: "key",
|
|
70
|
+
mediaManifest: "key",
|
|
71
|
+
pendingMedia: "id",
|
|
72
|
+
pendingMediaDeletions: "id"
|
|
73
|
+
}).upgrade(async (tx) => {
|
|
74
|
+
await tx.table("siteIndex").clear();
|
|
75
|
+
await tx.table("contentCache").clear();
|
|
76
|
+
});
|
|
64
77
|
}
|
|
65
78
|
};
|
|
66
79
|
var db = null;
|
|
@@ -97,7 +110,7 @@ async function restoreLocalChanges() {
|
|
|
97
110
|
const siteId = metaRow?.siteId ?? "";
|
|
98
111
|
return {
|
|
99
112
|
sections,
|
|
100
|
-
siteIndex: { siteId,
|
|
113
|
+
siteIndex: { siteId, pages: indexRow.pages, sections: indexRow.sections },
|
|
101
114
|
siteConfig: configRow?.config,
|
|
102
115
|
deletedSections: indexRow.deletedSections ?? []
|
|
103
116
|
};
|
|
@@ -121,7 +134,7 @@ async function persistSiteIndex(index, deletedSections = []) {
|
|
|
121
134
|
await database.transaction("rw", [database.siteIndex, database.meta], async () => {
|
|
122
135
|
await database.siteIndex.put({
|
|
123
136
|
key: "current",
|
|
124
|
-
|
|
137
|
+
pages: index.pages,
|
|
125
138
|
sections: index.sections,
|
|
126
139
|
deletedSections,
|
|
127
140
|
updatedAt: now
|
|
@@ -207,7 +220,7 @@ async function persistAll(sections, siteIndex, deletedSectionIds, siteConfig) {
|
|
|
207
220
|
if (siteIndex) {
|
|
208
221
|
await database.siteIndex.put({
|
|
209
222
|
key: "current",
|
|
210
|
-
|
|
223
|
+
pages: siteIndex.pages,
|
|
211
224
|
sections: siteIndex.sections,
|
|
212
225
|
deletedSections: [],
|
|
213
226
|
updatedAt: now
|
package/dist/lib/events.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { NavItem } from "./nav";
|
|
1
|
+
import type { NavItem, SiteNav } from "./nav";
|
|
2
2
|
export interface TypedEvent<T> {
|
|
3
3
|
dispatch(detail: T): void;
|
|
4
4
|
listen(callback: (detail: T) => void): () => void;
|
|
@@ -13,4 +13,6 @@ export declare const historySelectEvent: TypedEvent<{
|
|
|
13
13
|
sha: string;
|
|
14
14
|
date: string;
|
|
15
15
|
}>;
|
|
16
|
+
export declare const siteNavChangeEvent: TypedEvent<SiteNav>;
|
|
17
|
+
export declare const pageSelectEvent: TypedEvent<string>;
|
|
16
18
|
//# sourceMappingURL=events.d.ts.map
|
package/dist/lib/events.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../src/lib/events.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../src/lib/events.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAE9C,MAAM,WAAW,UAAU,CAAC,CAAC;IAC3B,QAAQ,CAAC,MAAM,EAAE,CAAC,GAAG,IAAI,CAAC;IAC1B,MAAM,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,CAAC,KAAK,IAAI,GAAG,MAAM,IAAI,CAAC;CACnD;AAED,wBAAgB,WAAW,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,GAAG,UAAU,CAAC,CAAC,CAAC,CAW1D;AAED,eAAO,MAAM,aAAa;gBAA6B,OAAO;EAAqB,CAAC;AACpF,eAAO,MAAM,cAAc,uBAA0C,CAAC;AACtE,eAAO,MAAM,aAAa,oBAAsC,CAAC;AACjE,eAAO,MAAM,kBAAkB;SAAsB,MAAM;UAAQ,MAAM;EAAqB,CAAC;AAC/F,eAAO,MAAM,kBAAkB,qBAA2C,CAAC;AAC3E,eAAO,MAAM,eAAe,oBAAoC,CAAC"}
|
package/dist/lib/index.js
CHANGED
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
safeRedirect,
|
|
19
19
|
sanitizeHtml,
|
|
20
20
|
toSectionId
|
|
21
|
-
} from "../chunk-
|
|
21
|
+
} from "../chunk-DLXIYIG2.js";
|
|
22
22
|
import {
|
|
23
23
|
clearRegistry,
|
|
24
24
|
createRegistry,
|
|
@@ -29,7 +29,7 @@ import {
|
|
|
29
29
|
getSection,
|
|
30
30
|
registerSchema,
|
|
31
31
|
registerSection
|
|
32
|
-
} from "../chunk-
|
|
32
|
+
} from "../chunk-ONBJG426.js";
|
|
33
33
|
import "../chunk-S2L3BPLS.js";
|
|
34
34
|
import {
|
|
35
35
|
env
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { SiteIndex } from "../schemas/site-config";
|
|
2
|
+
import type { Section } from "../schemas/sections";
|
|
3
|
+
import type { LinkValue } from "../schemas/link";
|
|
4
|
+
export declare function resolveLinkHref(link: LinkValue, index: SiteIndex, headingById: Record<string, string | undefined>): {
|
|
5
|
+
href: string;
|
|
6
|
+
target: string;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Rewrite any internal LinkValue embedded in a section's content into a
|
|
10
|
+
* resolved external link so the zero-JS viewer renders a plain <a>. Currently
|
|
11
|
+
* the only link-bearing field is the button section's `content.link`.
|
|
12
|
+
*/
|
|
13
|
+
export declare function resolveInternalLinks(section: Section, index: SiteIndex, headingById: Record<string, string | undefined>): Section;
|
|
14
|
+
//# sourceMappingURL=links.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"links.d.ts","sourceRoot":"","sources":["../../src/lib/links.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAIjD,wBAAgB,eAAe,CAC7B,IAAI,EAAE,SAAS,EACf,KAAK,EAAE,SAAS,EAChB,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,GAC9C;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAWlC;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,SAAS,EAChB,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,GAC9C,OAAO,CAQT"}
|
package/dist/lib/loader.d.ts
CHANGED
|
@@ -11,13 +11,13 @@ export interface SiteContent {
|
|
|
11
11
|
/**
|
|
12
12
|
* Merge a validated index with raw section file contents.
|
|
13
13
|
* Validates each section file against its Zod schema.
|
|
14
|
-
* Returns sections in the order
|
|
14
|
+
* Returns sections in the concatenated order of every page's order.
|
|
15
15
|
*/
|
|
16
16
|
export declare function mergeSiteContent(index: SiteIndex, sectionFiles: Record<string, 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
|
-
* receive sections merged
|
|
20
|
+
* receive sections merged across every page's order.
|
|
21
21
|
*/
|
|
22
22
|
export declare function loadStaticSiteContent(index: SiteIndex, sectionGlob: Record<string, unknown>): SiteContent;
|
|
23
23
|
/**
|
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;AAGvF,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;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,SAAS,EAChB,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACpC,WAAW,
|
|
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;AAGvF,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;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,SAAS,EAChB,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACpC,WAAW,CA6Bb;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,SAAS,EAChB,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACnC,WAAW,CAQb;AAED;;;GAGG;AACH,wBAAsB,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CAe9E"}
|
package/dist/lib/nav.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { LoadedSection } from "./loader";
|
|
2
2
|
import { type SectionRegistry } from "./registry";
|
|
3
|
+
import type { SiteIndex } from "../schemas/site-config";
|
|
3
4
|
export interface NavItem {
|
|
4
5
|
href: string;
|
|
5
6
|
label: string;
|
|
@@ -8,4 +9,26 @@ export interface NavItem {
|
|
|
8
9
|
}
|
|
9
10
|
export declare function toSectionId(text: string): string;
|
|
10
11
|
export declare function generateNavLinks(sections: LoadedSection[], registry?: SectionRegistry): NavItem[];
|
|
12
|
+
export interface PageNavItem {
|
|
13
|
+
id: string;
|
|
14
|
+
title: string;
|
|
15
|
+
href: string;
|
|
16
|
+
slug: string;
|
|
17
|
+
isActive: boolean;
|
|
18
|
+
headings: NavItem[];
|
|
19
|
+
}
|
|
20
|
+
export interface SiteNav {
|
|
21
|
+
pages: PageNavItem[];
|
|
22
|
+
/** Live pages with showInNav off — editor-only group, like the archive. */
|
|
23
|
+
hidden: PageNavItem[];
|
|
24
|
+
archive: PageNavItem[];
|
|
25
|
+
}
|
|
26
|
+
export declare function generateSiteNav(opts: {
|
|
27
|
+
index: SiteIndex;
|
|
28
|
+
activeSections: LoadedSection[];
|
|
29
|
+
activePageId: string | null;
|
|
30
|
+
mode: "viewer" | "editor";
|
|
31
|
+
audience: string | null;
|
|
32
|
+
registry?: SectionRegistry;
|
|
33
|
+
}): SiteNav;
|
|
11
34
|
//# sourceMappingURL=nav.d.ts.map
|