@drawnagency/primitives 0.1.94 → 0.1.96
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-UFOWXOG6.js → chunk-CS2ECR3U.js} +9 -3
- package/dist/{chunk-GDLH3LVH.js → chunk-CSVGCAIH.js} +7 -6
- package/dist/chunk-EUSWEVOA.js +29 -0
- package/dist/{chunk-677NTHAZ.js → chunk-PTOLUMGV.js} +3 -0
- package/dist/{chunk-XYFZ57AS.js → chunk-YUUUCDXN.js} +59 -5
- package/dist/components/brandguide/Colors.d.ts +2 -2
- package/dist/components/brandguide/Colors.d.ts.map +1 -1
- package/dist/components/brandguide/ColorsEditable.d.ts +2 -2
- package/dist/components/brandguide/ColorsEditable.d.ts.map +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/editor/index.js +4 -3
- package/dist/components/primitives/index.js +1 -1
- package/dist/components/sections/Container/Container.d.ts +2 -2
- package/dist/components/sections/Container/Container.d.ts.map +1 -1
- package/dist/components/sections/brand-guide.js +2 -2
- package/dist/components/sections/register-schemas.js +4 -4
- package/dist/components/sections/register.js +4 -4
- package/dist/components/shared/HistoryChangesModal.d.ts +39 -0
- package/dist/components/shared/HistoryChangesModal.d.ts.map +1 -0
- package/dist/components/shared/HistoryPopover.d.ts +3 -1
- package/dist/components/shared/HistoryPopover.d.ts.map +1 -1
- package/dist/components/shared/Navigation.d.ts.map +1 -1
- package/dist/components/shared/Popover.d.ts +10 -1
- package/dist/components/shared/Popover.d.ts.map +1 -1
- package/dist/components/shell/EditorModal.d.ts +6 -1
- package/dist/components/shell/EditorModal.d.ts.map +1 -1
- package/dist/components/shell/EditorModalContext.d.ts +3 -2
- package/dist/components/shell/EditorModalContext.d.ts.map +1 -1
- package/dist/components/shell/EditorShell.d.ts.map +1 -1
- package/dist/hooks/useEditorPublish.d.ts +5 -1
- package/dist/hooks/useEditorPublish.d.ts.map +1 -1
- package/dist/index.js +45 -37
- package/dist/lib/events.d.ts +18 -0
- package/dist/lib/events.d.ts.map +1 -1
- package/dist/lib/history-buckets.d.ts +30 -0
- package/dist/lib/history-buckets.d.ts.map +1 -0
- package/dist/lib/index-ops.d.ts +77 -0
- package/dist/lib/index-ops.d.ts.map +1 -0
- package/dist/lib/index-ops.js +223 -0
- package/dist/lib/index.d.ts +1 -1
- package/dist/lib/index.d.ts.map +1 -1
- package/dist/lib/index.js +6 -4
- package/dist/lib/media-folders.d.ts +13 -0
- package/dist/lib/media-folders.d.ts.map +1 -1
- package/dist/lib/media-folders.js +172 -0
- package/dist/lib/registry.d.ts +7 -1
- package/dist/lib/registry.d.ts.map +1 -1
- package/dist/lib/theme-vars.d.ts +19 -4
- package/dist/lib/theme-vars.d.ts.map +1 -1
- package/dist/schemas/index.js +1 -1
- package/dist/storage/index.d.ts +1 -1
- package/dist/storage/index.d.ts.map +1 -1
- package/dist/storage/index.js +9 -3
- package/dist/storage/types.d.ts +44 -0
- package/dist/storage/types.d.ts.map +1 -1
- package/package.json +9 -1
- package/src/components/brandguide/Colors.tsx +2 -1
- package/src/components/brandguide/ColorsEditable.tsx +2 -1
- package/src/components/editor/SectionWrapper.tsx +1 -0
- package/src/components/editor/SettingsForm.tsx +5 -2
- package/src/components/sections/Container/Container.tsx +5 -4
- package/src/components/shared/HistoryChangesModal.tsx +256 -0
- package/src/components/shared/HistoryPopover.tsx +255 -76
- package/src/components/shared/Navigation.tsx +30 -9
- package/src/components/shared/Popover.tsx +95 -2
- package/src/components/shell/EditorModal.tsx +26 -4
- package/src/components/shell/EditorModalContext.tsx +5 -4
- package/src/components/shell/EditorShell.tsx +51 -2
- package/src/components/shell/SiteSettingsModal.tsx +1 -1
- package/src/hooks/useEditorPublish.ts +15 -6
- package/src/lib/events.ts +11 -0
- package/src/lib/history-buckets.ts +190 -0
- package/src/lib/index-ops.ts +309 -0
- package/src/lib/index.ts +1 -1
- package/src/lib/media-folders.ts +16 -0
- package/src/lib/registry.ts +9 -1
- package/src/lib/theme-vars.ts +25 -4
- package/src/storage/index.ts +1 -1
- package/src/storage/types.ts +55 -0
- package/dist/chunk-VAOW4WXQ.js +0 -15
- package/dist/{chunk-ZKGMLLUQ.js → chunk-IFCQWC3G.js} +3 -3
package/dist/index.js
CHANGED
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
verifyAudienceToken,
|
|
13
|
-
verifySessionToken
|
|
14
|
-
} from "./chunk-EM5DFHDZ.js";
|
|
2
|
+
ASSET_CACHE_CONTROL,
|
|
3
|
+
IDEMPOTENCY_KEY_RE,
|
|
4
|
+
IDEMPOTENCY_TRAILER,
|
|
5
|
+
StorageConflictError,
|
|
6
|
+
withIdempotencyTrailer
|
|
7
|
+
} from "./chunk-EUSWEVOA.js";
|
|
8
|
+
import {
|
|
9
|
+
getCollabProvider,
|
|
10
|
+
setCollabProvider
|
|
11
|
+
} from "./chunk-2G2S36SY.js";
|
|
15
12
|
import {
|
|
16
13
|
BAKED_MEDIA_KEYS,
|
|
17
14
|
EXT_TO_MIME,
|
|
@@ -34,9 +31,19 @@ import {
|
|
|
34
31
|
setMediaProvider
|
|
35
32
|
} from "./chunk-SOILPZ7U.js";
|
|
36
33
|
import {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
34
|
+
AUDIENCE_COOKIE,
|
|
35
|
+
AUDIENCE_MAX_AGE_SECONDS,
|
|
36
|
+
LastOwnerError,
|
|
37
|
+
SESSION_COOKIE,
|
|
38
|
+
SESSION_MAX_AGE_SECONDS,
|
|
39
|
+
SessionExpiredError,
|
|
40
|
+
deriveUiCapabilities,
|
|
41
|
+
setSessionCookie,
|
|
42
|
+
signAudienceToken,
|
|
43
|
+
signSessionToken,
|
|
44
|
+
verifyAudienceToken,
|
|
45
|
+
verifySessionToken
|
|
46
|
+
} from "./chunk-EM5DFHDZ.js";
|
|
40
47
|
import {
|
|
41
48
|
CollabPeerSchema,
|
|
42
49
|
HEARTBEAT_INTERVAL_MS,
|
|
@@ -46,10 +53,6 @@ import {
|
|
|
46
53
|
SectionUpdateMessageSchema,
|
|
47
54
|
TakeoverMessageSchema
|
|
48
55
|
} from "./chunk-REM2NH7K.js";
|
|
49
|
-
import {
|
|
50
|
-
getCollabProvider,
|
|
51
|
-
setCollabProvider
|
|
52
|
-
} from "./chunk-2G2S36SY.js";
|
|
53
56
|
import {
|
|
54
57
|
AudienceColorSchema,
|
|
55
58
|
AudienceNameSchema,
|
|
@@ -80,6 +83,7 @@ import {
|
|
|
80
83
|
loadSiteContent,
|
|
81
84
|
loadStaticSiteContent,
|
|
82
85
|
mergeSiteContent,
|
|
86
|
+
onPrimaryVarValue,
|
|
83
87
|
primaryVarValue,
|
|
84
88
|
relativeLuminance,
|
|
85
89
|
resolveChatbotName,
|
|
@@ -87,7 +91,7 @@ import {
|
|
|
87
91
|
safeRedirect,
|
|
88
92
|
suggestAccessibleOn,
|
|
89
93
|
wcagLevel
|
|
90
|
-
} from "./chunk-
|
|
94
|
+
} from "./chunk-CS2ECR3U.js";
|
|
91
95
|
import {
|
|
92
96
|
curatedIcons,
|
|
93
97
|
getIcon
|
|
@@ -97,7 +101,7 @@ import {
|
|
|
97
101
|
darkModeEvent,
|
|
98
102
|
editModeEvent,
|
|
99
103
|
navChangeEvent
|
|
100
|
-
} from "./chunk-
|
|
104
|
+
} from "./chunk-PTOLUMGV.js";
|
|
101
105
|
import {
|
|
102
106
|
ensureSanitizer,
|
|
103
107
|
generateNavLinks,
|
|
@@ -107,19 +111,30 @@ import {
|
|
|
107
111
|
import {
|
|
108
112
|
cn
|
|
109
113
|
} from "./chunk-7EOSDFS3.js";
|
|
114
|
+
import {
|
|
115
|
+
audiencePasses
|
|
116
|
+
} from "./chunk-YBVK254P.js";
|
|
110
117
|
import {
|
|
111
118
|
isSameOriginRequest,
|
|
112
119
|
requireSessionSecret,
|
|
113
120
|
safeNextPath
|
|
114
121
|
} from "./chunk-S2L3BPLS.js";
|
|
115
|
-
import {
|
|
116
|
-
audiencePasses
|
|
117
|
-
} from "./chunk-YBVK254P.js";
|
|
118
122
|
import "./chunk-5BM2Y3NJ.js";
|
|
119
123
|
import {
|
|
120
124
|
getSectionContentSchema,
|
|
121
125
|
getSectionSchema
|
|
122
126
|
} from "./chunk-TZQPOR5A.js";
|
|
127
|
+
import {
|
|
128
|
+
clearRegistry,
|
|
129
|
+
createRegistry,
|
|
130
|
+
defineSection,
|
|
131
|
+
getAllSchemas,
|
|
132
|
+
getAllSections,
|
|
133
|
+
getSchema,
|
|
134
|
+
getSection,
|
|
135
|
+
registerSchema,
|
|
136
|
+
registerSection
|
|
137
|
+
} from "./chunk-VKAGMEKE.js";
|
|
123
138
|
import {
|
|
124
139
|
ChatbotConfigSchema,
|
|
125
140
|
ChatbotTaskSchema,
|
|
@@ -142,17 +157,6 @@ import {
|
|
|
142
157
|
VariantSchema,
|
|
143
158
|
normalizeSiteIndex
|
|
144
159
|
} from "./chunk-RHWWQV3J.js";
|
|
145
|
-
import {
|
|
146
|
-
clearRegistry,
|
|
147
|
-
createRegistry,
|
|
148
|
-
defineSection,
|
|
149
|
-
getAllSchemas,
|
|
150
|
-
getAllSections,
|
|
151
|
-
getSchema,
|
|
152
|
-
getSection,
|
|
153
|
-
registerSchema,
|
|
154
|
-
registerSection
|
|
155
|
-
} from "./chunk-VKAGMEKE.js";
|
|
156
160
|
import "./chunk-FM4M4Q2W.js";
|
|
157
161
|
import "./chunk-NSCT3AMV.js";
|
|
158
162
|
import {
|
|
@@ -176,6 +180,8 @@ export {
|
|
|
176
180
|
FontNameSchema,
|
|
177
181
|
HEARTBEAT_INTERVAL_MS,
|
|
178
182
|
HexColorSchema,
|
|
183
|
+
IDEMPOTENCY_KEY_RE,
|
|
184
|
+
IDEMPOTENCY_TRAILER,
|
|
179
185
|
ImageManifestSchema,
|
|
180
186
|
IndexSchema,
|
|
181
187
|
IndexUpdateMessageSchema,
|
|
@@ -253,6 +259,7 @@ export {
|
|
|
253
259
|
mimeToExt,
|
|
254
260
|
navChangeEvent,
|
|
255
261
|
normalizeSiteIndex,
|
|
262
|
+
onPrimaryVarValue,
|
|
256
263
|
primaryVarValue,
|
|
257
264
|
rebindImageRef,
|
|
258
265
|
registerSchema,
|
|
@@ -278,5 +285,6 @@ export {
|
|
|
278
285
|
toSectionId,
|
|
279
286
|
verifyAudienceToken,
|
|
280
287
|
verifySessionToken,
|
|
281
|
-
wcagLevel
|
|
288
|
+
wcagLevel,
|
|
289
|
+
withIdempotencyTrailer
|
|
282
290
|
};
|
package/dist/lib/events.d.ts
CHANGED
|
@@ -14,6 +14,24 @@ export declare const historySelectEvent: TypedEvent<{
|
|
|
14
14
|
sha: string;
|
|
15
15
|
date: string;
|
|
16
16
|
}>;
|
|
17
|
+
/** Restore straight from the history navigator, skipping the browse-then-restore
|
|
18
|
+
* detour. The shell loads the content at `sha` and runs the same restore path
|
|
19
|
+
* HistoryToolbar uses. Confirmation happens before this is dispatched. */
|
|
20
|
+
export declare const historyRestoreEvent: TypedEvent<{
|
|
21
|
+
sha: string;
|
|
22
|
+
date: string;
|
|
23
|
+
}>;
|
|
24
|
+
/** Restore failed. The navigator is a separate island from the shell that does
|
|
25
|
+
* the writing, so without this the failure is invisible and the UI sits on
|
|
26
|
+
* "Restoring…" forever. */
|
|
27
|
+
export declare const historyRestoreFailedEvent: TypedEvent<{
|
|
28
|
+
message: string;
|
|
29
|
+
}>;
|
|
30
|
+
/** Unsaved-draft state, published by the shell for other islands (the history
|
|
31
|
+
* navigator warns before restoring, which discards drafts irrecoverably). */
|
|
32
|
+
export declare const editorDirtyEvent: TypedEvent<{
|
|
33
|
+
hasUnsavedChanges: boolean;
|
|
34
|
+
}>;
|
|
17
35
|
export declare const siteNavChangeEvent: TypedEvent<SiteNav>;
|
|
18
36
|
export declare const pageSelectEvent: TypedEvent<string>;
|
|
19
37
|
//# 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,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,mBAAmB,oBAAwC,CAAC;AACzE,eAAO,MAAM,kBAAkB;SAAsB,MAAM;UAAQ,MAAM;EAAqB,CAAC;AAC/F,eAAO,MAAM,kBAAkB,qBAA2C,CAAC;AAC3E,eAAO,MAAM,eAAe,oBAAoC,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,mBAAmB,oBAAwC,CAAC;AACzE,eAAO,MAAM,kBAAkB;SAAsB,MAAM;UAAQ,MAAM;EAAqB,CAAC;AAC/F;;2EAE2E;AAC3E,eAAO,MAAM,mBAAmB;SAAsB,MAAM;UAAQ,MAAM;EAAsB,CAAC;AACjG;;4BAE4B;AAC5B,eAAO,MAAM,yBAAyB;aAA0B,MAAM;EAA6B,CAAC;AACpG;8EAC8E;AAC9E,eAAO,MAAM,gBAAgB;uBAAoC,OAAO;EAAmB,CAAC;AAC5F,eAAO,MAAM,kBAAkB,qBAA2C,CAAC;AAC3E,eAAO,MAAM,eAAe,oBAAoC,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export interface HistoryCommit {
|
|
2
|
+
sha: string;
|
|
3
|
+
date: string;
|
|
4
|
+
/** First parent's sha; null for the repo's root commit. */
|
|
5
|
+
parent: string | null;
|
|
6
|
+
}
|
|
7
|
+
export type NodeKind = "commit" | "day" | "week" | "month" | "year";
|
|
8
|
+
export interface HistoryNode {
|
|
9
|
+
/** Stable React key, unique within the tree. */
|
|
10
|
+
id: string;
|
|
11
|
+
kind: NodeKind;
|
|
12
|
+
label: string;
|
|
13
|
+
sublabel: string | null;
|
|
14
|
+
count: number;
|
|
15
|
+
/** Newest commit in this node — what "browse" opens. */
|
|
16
|
+
newestSha: string | null;
|
|
17
|
+
/** Compare base: parent of this node's oldest commit. Null at repo root. */
|
|
18
|
+
baseSha: string | null;
|
|
19
|
+
children: HistoryNode[];
|
|
20
|
+
}
|
|
21
|
+
export type GroupId = "today" | "this-week" | "previous-weeks" | "earlier-months" | "previous-years";
|
|
22
|
+
export interface HistoryGroup {
|
|
23
|
+
id: GroupId;
|
|
24
|
+
label: string;
|
|
25
|
+
nodes: HistoryNode[];
|
|
26
|
+
}
|
|
27
|
+
export declare function buildHistoryTree(commits: HistoryCommit[], now: Date): HistoryGroup[];
|
|
28
|
+
/** Largest node count anywhere in the tree; never 0, so callers can divide by it. */
|
|
29
|
+
export declare function maxNodeCount(groups: HistoryGroup[]): number;
|
|
30
|
+
//# sourceMappingURL=history-buckets.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"history-buckets.d.ts","sourceRoot":"","sources":["../../src/lib/history-buckets.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,aAAa;IAC5B,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,2DAA2D;IAC3D,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;CACvB;AAED,MAAM,MAAM,QAAQ,GAAG,QAAQ,GAAG,KAAK,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,CAAC;AAEpE,MAAM,WAAW,WAAW;IAC1B,gDAAgD;IAChD,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,QAAQ,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,wDAAwD;IACxD,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,4EAA4E;IAC5E,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,QAAQ,EAAE,WAAW,EAAE,CAAC;CACzB;AAED,MAAM,MAAM,OAAO,GACf,OAAO,GAAG,WAAW,GAAG,gBAAgB,GAAG,gBAAgB,GAAG,gBAAgB,CAAC;AAEnF,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,OAAO,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,WAAW,EAAE,CAAC;CACtB;AA0HD,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,aAAa,EAAE,EAAE,GAAG,EAAE,IAAI,GAAG,YAAY,EAAE,CA0BpF;AAED,qFAAqF;AACrF,wBAAgB,YAAY,CAAC,MAAM,EAAE,YAAY,EAAE,GAAG,MAAM,CAQ3D"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { type SiteIndex } from "../schemas/site-config";
|
|
3
|
+
export declare const IndexOpSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
4
|
+
op: z.ZodLiteral<"insertAfter">;
|
|
5
|
+
pageId: z.ZodString;
|
|
6
|
+
afterId: z.ZodNullable<z.ZodString>;
|
|
7
|
+
sections: z.ZodArray<z.ZodObject<{
|
|
8
|
+
id: z.ZodString;
|
|
9
|
+
status: z.ZodOptional<z.ZodEnum<{
|
|
10
|
+
draft: "draft";
|
|
11
|
+
live: "live";
|
|
12
|
+
archived: "archived";
|
|
13
|
+
}>>;
|
|
14
|
+
access: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
15
|
+
}, z.core.$strip>>;
|
|
16
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
17
|
+
op: z.ZodLiteral<"insertAt">;
|
|
18
|
+
pageId: z.ZodString;
|
|
19
|
+
position: z.ZodNumber;
|
|
20
|
+
sections: z.ZodArray<z.ZodObject<{
|
|
21
|
+
id: z.ZodString;
|
|
22
|
+
status: z.ZodOptional<z.ZodEnum<{
|
|
23
|
+
draft: "draft";
|
|
24
|
+
live: "live";
|
|
25
|
+
archived: "archived";
|
|
26
|
+
}>>;
|
|
27
|
+
access: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
28
|
+
}, z.core.$strip>>;
|
|
29
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
30
|
+
op: z.ZodLiteral<"move">;
|
|
31
|
+
pageId: z.ZodString;
|
|
32
|
+
id: z.ZodString;
|
|
33
|
+
afterId: z.ZodNullable<z.ZodString>;
|
|
34
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
35
|
+
op: z.ZodLiteral<"remove">;
|
|
36
|
+
ids: z.ZodArray<z.ZodString>;
|
|
37
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
38
|
+
op: z.ZodLiteral<"setMeta">;
|
|
39
|
+
id: z.ZodString;
|
|
40
|
+
status: z.ZodOptional<z.ZodEnum<{
|
|
41
|
+
draft: "draft";
|
|
42
|
+
live: "live";
|
|
43
|
+
archived: "archived";
|
|
44
|
+
}>>;
|
|
45
|
+
access: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
46
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
47
|
+
op: z.ZodLiteral<"setPageMeta">;
|
|
48
|
+
pageId: z.ZodString;
|
|
49
|
+
title: z.ZodOptional<z.ZodString>;
|
|
50
|
+
slug: z.ZodOptional<z.ZodString>;
|
|
51
|
+
showInNav: z.ZodOptional<z.ZodBoolean>;
|
|
52
|
+
access: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
53
|
+
}, z.core.$strip>], "op">;
|
|
54
|
+
export type IndexOp = z.infer<typeof IndexOpSchema>;
|
|
55
|
+
export type ApplyIndexOpsResult = {
|
|
56
|
+
ok: true;
|
|
57
|
+
index: SiteIndex;
|
|
58
|
+
removedIds: string[];
|
|
59
|
+
warnings: string[];
|
|
60
|
+
} | {
|
|
61
|
+
ok: false;
|
|
62
|
+
error: string;
|
|
63
|
+
};
|
|
64
|
+
/** Section-body types keyed by id, for the ids an insert op creates. */
|
|
65
|
+
export declare function collectPostedTypes(sections: {
|
|
66
|
+
id: string;
|
|
67
|
+
content: unknown;
|
|
68
|
+
}[] | undefined): Record<string, string>;
|
|
69
|
+
/**
|
|
70
|
+
* Every section id the ops name, derivable from the ops ALONE (no index read).
|
|
71
|
+
* Callers need this before applying anything: the collab broadcast has to tell
|
|
72
|
+
* browser editors which rows moved, and the audit trail has to record that an
|
|
73
|
+
* ops-only save touched anything at all. `setPageMeta` names no section.
|
|
74
|
+
*/
|
|
75
|
+
export declare function opTouchedSectionIds(ops: IndexOp[]): string[];
|
|
76
|
+
export declare function applyIndexOps(rawIndex: unknown, ops: IndexOp[], newSectionTypes: Record<string, string>): ApplyIndexOpsResult;
|
|
77
|
+
//# sourceMappingURL=index-ops.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-ops.d.ts","sourceRoot":"","sources":["../../src/lib/index-ops.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAA+B,KAAK,SAAS,EAAoB,MAAM,wBAAwB,CAAC;AAgCvG,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yBAqCxB,CAAC;AAEH,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAEpD,MAAM,MAAM,mBAAmB,GAC3B;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,KAAK,EAAE,SAAS,CAAC;IAAC,UAAU,EAAE,MAAM,EAAE,CAAC;IAAC,QAAQ,EAAE,MAAM,EAAE,CAAA;CAAE,GACxE;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAEjC,wEAAwE;AACxE,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,EAAE,GAAG,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAOnH;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,MAAM,EAAE,CAQ5D;AAID,wBAAgB,aAAa,CAC3B,QAAQ,EAAE,OAAO,EACjB,GAAG,EAAE,OAAO,EAAE,EACd,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GACtC,mBAAmB,CAsMrB"}
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
import {
|
|
2
|
+
IndexSchema,
|
|
3
|
+
RESERVED_SLUGS
|
|
4
|
+
} from "../chunk-RHWWQV3J.js";
|
|
5
|
+
import "../chunk-FM4M4Q2W.js";
|
|
6
|
+
import "../chunk-JSBRDJBE.js";
|
|
7
|
+
|
|
8
|
+
// src/lib/index-ops.ts
|
|
9
|
+
import { z } from "zod";
|
|
10
|
+
var OpStatusSchema = z.enum(["draft", "live", "archived"]);
|
|
11
|
+
var SAFE_SECTION_ID = /^[a-zA-Z0-9_-]{1,64}$/;
|
|
12
|
+
var SectionInsertSchema = z.object({
|
|
13
|
+
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
|
+
status: OpStatusSchema.optional().describe('Defaults to "draft" \u2014 invisible to viewers until promoted to "live".'),
|
|
15
|
+
access: z.array(z.string()).optional().describe("Audience slugs from list_audiences. Defaults to [] (everyone).")
|
|
16
|
+
});
|
|
17
|
+
var IndexOpSchema = z.discriminatedUnion("op", [
|
|
18
|
+
z.object({
|
|
19
|
+
op: z.literal("insertAfter"),
|
|
20
|
+
pageId: z.string().describe("The page whose order receives the sections."),
|
|
21
|
+
afterId: z.string().nullable().describe("Insert directly after this section id, or null for the start of the page."),
|
|
22
|
+
sections: z.array(SectionInsertSchema).min(1).describe("Sections to create, in the order they should appear. Each needs its body in this call's `sections`.")
|
|
23
|
+
}),
|
|
24
|
+
z.object({
|
|
25
|
+
op: z.literal("insertAt"),
|
|
26
|
+
pageId: z.string().describe("The page whose order receives the sections."),
|
|
27
|
+
position: z.number().int().min(0).describe("0-based index in the page's order; equal to the order's length appends."),
|
|
28
|
+
sections: z.array(SectionInsertSchema).min(1).describe("Sections to create, in the order they should appear. Each needs its body in this call's `sections`.")
|
|
29
|
+
}),
|
|
30
|
+
z.object({
|
|
31
|
+
op: z.literal("move"),
|
|
32
|
+
pageId: z.string().describe("Destination page id (may be the section's current page)."),
|
|
33
|
+
id: z.string().describe("The existing section to move."),
|
|
34
|
+
afterId: z.string().nullable().describe("Place it directly after this section id in the destination page, or null for the start.")
|
|
35
|
+
}),
|
|
36
|
+
z.object({
|
|
37
|
+
op: z.literal("remove"),
|
|
38
|
+
ids: z.array(z.string()).min(1).describe("Sections to delete: removed from the page order AND from sections{}, and their content files are deleted.")
|
|
39
|
+
}),
|
|
40
|
+
z.object({
|
|
41
|
+
op: z.literal("setMeta"),
|
|
42
|
+
id: z.string().describe("An existing section id."),
|
|
43
|
+
status: OpStatusSchema.optional().describe('New status. "live" is what makes a section visible to viewers.'),
|
|
44
|
+
access: z.array(z.string()).optional().describe("New audience slugs from list_audiences; [] means everyone.")
|
|
45
|
+
}),
|
|
46
|
+
z.object({
|
|
47
|
+
op: z.literal("setPageMeta"),
|
|
48
|
+
pageId: z.string().describe("An existing page id."),
|
|
49
|
+
title: z.string().optional().describe("New page title."),
|
|
50
|
+
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
|
+
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.")
|
|
53
|
+
})
|
|
54
|
+
]);
|
|
55
|
+
function collectPostedTypes(sections) {
|
|
56
|
+
const types = {};
|
|
57
|
+
for (const s of sections ?? []) {
|
|
58
|
+
const type = s.content?.type;
|
|
59
|
+
if (typeof type === "string") types[s.id] = type;
|
|
60
|
+
}
|
|
61
|
+
return types;
|
|
62
|
+
}
|
|
63
|
+
function opTouchedSectionIds(ops) {
|
|
64
|
+
const ids = /* @__PURE__ */ new Set();
|
|
65
|
+
for (const op of ops) {
|
|
66
|
+
if (op.op === "insertAfter" || op.op === "insertAt") for (const s of op.sections) ids.add(s.id);
|
|
67
|
+
else if (op.op === "move" || op.op === "setMeta") ids.add(op.id);
|
|
68
|
+
else if (op.op === "remove") for (const id of op.ids) ids.add(id);
|
|
69
|
+
}
|
|
70
|
+
return [...ids];
|
|
71
|
+
}
|
|
72
|
+
var fmt = (ids) => ids.map((id) => `"${id}"`).join(", ");
|
|
73
|
+
function applyIndexOps(rawIndex, ops, newSectionTypes) {
|
|
74
|
+
const base = IndexSchema.safeParse(rawIndex);
|
|
75
|
+
if (!base.success) {
|
|
76
|
+
return {
|
|
77
|
+
ok: false,
|
|
78
|
+
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
|
+
};
|
|
80
|
+
}
|
|
81
|
+
const index = {
|
|
82
|
+
...base.data,
|
|
83
|
+
pages: base.data.pages.map((p) => ({ ...p, order: [...p.order] })),
|
|
84
|
+
sections: Object.fromEntries(Object.entries(base.data.sections).map(([k, v]) => [k, { ...v }]))
|
|
85
|
+
};
|
|
86
|
+
const removed = /* @__PURE__ */ new Set();
|
|
87
|
+
const warnings = [];
|
|
88
|
+
const fail = (error) => ({ ok: false, error });
|
|
89
|
+
for (const [i, op] of ops.entries()) {
|
|
90
|
+
const at = `indexOps[${i}] ${op.op}`;
|
|
91
|
+
if (op.op === "insertAfter" || op.op === "insertAt") {
|
|
92
|
+
const page2 = index.pages.find((p) => p.id === op.pageId);
|
|
93
|
+
if (!page2) return fail(`${at}: no page with id "${op.pageId}" \u2014 page ids come from get_site_index.`);
|
|
94
|
+
let position;
|
|
95
|
+
if (op.op === "insertAfter") {
|
|
96
|
+
if (op.afterId === null) position = 0;
|
|
97
|
+
else {
|
|
98
|
+
const idx = page2.order.indexOf(op.afterId);
|
|
99
|
+
if (idx === -1) return fail(`${at}: afterId "${op.afterId}" is not in page "${op.pageId}"'s order.`);
|
|
100
|
+
position = idx + 1;
|
|
101
|
+
}
|
|
102
|
+
} else {
|
|
103
|
+
if (op.position > page2.order.length) {
|
|
104
|
+
return fail(`${at}: position ${op.position} is out of range for page "${op.pageId}" (valid: 0..${page2.order.length}).`);
|
|
105
|
+
}
|
|
106
|
+
position = op.position;
|
|
107
|
+
}
|
|
108
|
+
const metas = [];
|
|
109
|
+
const seen = /* @__PURE__ */ new Set();
|
|
110
|
+
for (const s of op.sections) {
|
|
111
|
+
if (seen.has(s.id)) return fail(`${at}: section "${s.id}" is listed twice in this op's \`sections\`.`);
|
|
112
|
+
seen.add(s.id);
|
|
113
|
+
if (index.sections[s.id]) {
|
|
114
|
+
return fail(`${at}: section "${s.id}" already exists in the index \u2014 use move to relocate it, or setMeta to change its status/access.`);
|
|
115
|
+
}
|
|
116
|
+
if (!SAFE_SECTION_ID.test(s.id)) {
|
|
117
|
+
return fail(`${at}: section id "${s.id}" is not usable \u2014 ids become filenames, so they may only contain letters, numbers, dashes and underscores (max 64 chars).`);
|
|
118
|
+
}
|
|
119
|
+
const type = newSectionTypes[s.id];
|
|
120
|
+
if (!type) {
|
|
121
|
+
return fail(`${at}: section "${s.id}" has no usable body in this call \u2014 post its full body ({ "type": "...", "content": {...} }) in \`sections\` in the same save; an inserted section's type comes from the body.`);
|
|
122
|
+
}
|
|
123
|
+
const meta = { type, status: s.status ?? "draft", access: s.access ?? [] };
|
|
124
|
+
const stranded = page2.access.length > 0 ? meta.access.filter((a) => !page2.access.includes(a)) : [];
|
|
125
|
+
if (stranded.length > 0) {
|
|
126
|
+
warnings.push(
|
|
127
|
+
`${at}: section "${s.id}" carries audience(s) ${fmt(stranded)} that page "${op.pageId}" does not allow, so no audienced viewer will see it \u2014 clear it with setMeta, or widen the page's access.`
|
|
128
|
+
);
|
|
129
|
+
}
|
|
130
|
+
metas.push([s.id, meta]);
|
|
131
|
+
}
|
|
132
|
+
page2.order.splice(position, 0, ...metas.map(([id]) => id));
|
|
133
|
+
for (const [id, meta] of metas) index.sections[id] = meta;
|
|
134
|
+
continue;
|
|
135
|
+
}
|
|
136
|
+
if (op.op === "move") {
|
|
137
|
+
const meta = index.sections[op.id];
|
|
138
|
+
if (!meta) return fail(`${at}: section "${op.id}" is not in the index.`);
|
|
139
|
+
const dest = index.pages.find((p) => p.id === op.pageId);
|
|
140
|
+
if (!dest) return fail(`${at}: no page with id "${op.pageId}" \u2014 page ids come from get_site_index.`);
|
|
141
|
+
if (op.afterId === op.id) return fail(`${at}: cannot move section "${op.id}" after itself.`);
|
|
142
|
+
for (const p of index.pages) {
|
|
143
|
+
const idx = p.order.indexOf(op.id);
|
|
144
|
+
if (idx !== -1) p.order.splice(idx, 1);
|
|
145
|
+
}
|
|
146
|
+
let position;
|
|
147
|
+
if (op.afterId === null) position = 0;
|
|
148
|
+
else {
|
|
149
|
+
const idx = dest.order.indexOf(op.afterId);
|
|
150
|
+
if (idx === -1) return fail(`${at}: afterId "${op.afterId}" is not in destination page "${op.pageId}"'s order.`);
|
|
151
|
+
position = idx + 1;
|
|
152
|
+
}
|
|
153
|
+
dest.order.splice(position, 0, op.id);
|
|
154
|
+
const stranded = dest.access.length > 0 ? meta.access.filter((a) => !dest.access.includes(a)) : [];
|
|
155
|
+
if (stranded.length > 0) {
|
|
156
|
+
warnings.push(
|
|
157
|
+
`${at}: section "${op.id}" carries audience(s) ${fmt(stranded)} that page "${op.pageId}" does not allow, so no audienced viewer will see it \u2014 clear it with setMeta, or widen the page's access.`
|
|
158
|
+
);
|
|
159
|
+
}
|
|
160
|
+
continue;
|
|
161
|
+
}
|
|
162
|
+
if (op.op === "remove") {
|
|
163
|
+
for (const id of op.ids) {
|
|
164
|
+
if (!index.sections[id]) return fail(`${at}: section "${id}" is not in the index.`);
|
|
165
|
+
delete index.sections[id];
|
|
166
|
+
for (const p of index.pages) {
|
|
167
|
+
const idx = p.order.indexOf(id);
|
|
168
|
+
if (idx !== -1) p.order.splice(idx, 1);
|
|
169
|
+
}
|
|
170
|
+
removed.add(id);
|
|
171
|
+
}
|
|
172
|
+
continue;
|
|
173
|
+
}
|
|
174
|
+
if (op.op === "setMeta") {
|
|
175
|
+
if (op.status === void 0 && op.access === void 0) {
|
|
176
|
+
return fail(`${at}: nothing to set \u2014 provide status and/or access.`);
|
|
177
|
+
}
|
|
178
|
+
const meta = index.sections[op.id];
|
|
179
|
+
if (!meta) return fail(`${at}: section "${op.id}" is not in the index.`);
|
|
180
|
+
if (op.status !== void 0) meta.status = op.status;
|
|
181
|
+
if (op.access !== void 0) meta.access = op.access;
|
|
182
|
+
continue;
|
|
183
|
+
}
|
|
184
|
+
if (op.title === void 0 && op.slug === void 0 && op.showInNav === void 0 && op.access === void 0) {
|
|
185
|
+
return fail(`${at}: nothing to set \u2014 provide title, slug, showInNav and/or access.`);
|
|
186
|
+
}
|
|
187
|
+
const page = index.pages.find((p) => p.id === op.pageId);
|
|
188
|
+
if (!page) return fail(`${at}: no page with id "${op.pageId}" \u2014 page ids come from get_site_index.`);
|
|
189
|
+
if (op.slug !== void 0 && page.isHome) {
|
|
190
|
+
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
|
+
}
|
|
192
|
+
if (op.slug !== void 0 && RESERVED_SLUGS.includes(op.slug)) {
|
|
193
|
+
return fail(`${at}: slug "${op.slug}" is reserved by a platform route and would shadow this page. Pick another slug.`);
|
|
194
|
+
}
|
|
195
|
+
if (op.title !== void 0) page.title = op.title;
|
|
196
|
+
if (op.slug !== void 0) page.slug = op.slug;
|
|
197
|
+
if (op.showInNav !== void 0) page.showInNav = op.showInNav;
|
|
198
|
+
if (op.access !== void 0) {
|
|
199
|
+
const dropped = page.access.filter((a) => !op.access.includes(a));
|
|
200
|
+
page.access = op.access;
|
|
201
|
+
if (dropped.length > 0 && op.access.length > 0) {
|
|
202
|
+
const stranded = page.order.filter((id) => index.sections[id]?.access.some((a) => dropped.includes(a)));
|
|
203
|
+
if (stranded.length > 0) {
|
|
204
|
+
warnings.push(
|
|
205
|
+
`${at}: section(s) ${fmt(stranded)} still carry audience(s) ${fmt(dropped)} that page "${op.pageId}" no longer allows, so no audienced viewer will see them \u2014 clear them with setMeta.`
|
|
206
|
+
);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
const removedIds = [...removed].filter((id) => !index.sections[id]);
|
|
212
|
+
const validated = IndexSchema.safeParse(index);
|
|
213
|
+
if (!validated.success) {
|
|
214
|
+
return fail(`applying indexOps produced an invalid index: ${validated.error.issues.map((issue) => issue.message).join("; ")}`);
|
|
215
|
+
}
|
|
216
|
+
return { ok: true, index: validated.data, removedIds, warnings };
|
|
217
|
+
}
|
|
218
|
+
export {
|
|
219
|
+
IndexOpSchema,
|
|
220
|
+
applyIndexOps,
|
|
221
|
+
collectPostedTypes,
|
|
222
|
+
opTouchedSectionIds
|
|
223
|
+
};
|
package/dist/lib/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ export { audiencePasses } from "./pages";
|
|
|
4
4
|
export { resolveChatbotName, resolveThinkingPhrases, DEFAULT_CHATBOT_NAME } from "./chatbot";
|
|
5
5
|
export { generateNavLinks, toSectionId, type NavItem } from "./nav";
|
|
6
6
|
export { deriveContrast, contrastColor, relativeLuminance, contrastRatio, wcagLevel, suggestAccessibleOn, type WcagLevel, } from "./contrast";
|
|
7
|
-
export { primaryVarValue, accentVarValue } from "./theme-vars";
|
|
7
|
+
export { primaryVarValue, accentVarValue, onPrimaryVarValue } from "./theme-vars";
|
|
8
8
|
export { sanitizeHtml, ensureSanitizer } from "./sanitize";
|
|
9
9
|
export { gridColsClass } from "./grid";
|
|
10
10
|
export { getIcon, curatedIcons, type IconEntry } from "./icons";
|
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,OAA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e,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
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
loadSiteContent,
|
|
11
11
|
loadStaticSiteContent,
|
|
12
12
|
mergeSiteContent,
|
|
13
|
+
onPrimaryVarValue,
|
|
13
14
|
primaryVarValue,
|
|
14
15
|
relativeLuminance,
|
|
15
16
|
resolveChatbotName,
|
|
@@ -17,7 +18,7 @@ import {
|
|
|
17
18
|
safeRedirect,
|
|
18
19
|
suggestAccessibleOn,
|
|
19
20
|
wcagLevel
|
|
20
|
-
} from "../chunk-
|
|
21
|
+
} from "../chunk-CS2ECR3U.js";
|
|
21
22
|
import {
|
|
22
23
|
curatedIcons,
|
|
23
24
|
getIcon
|
|
@@ -27,7 +28,7 @@ import {
|
|
|
27
28
|
darkModeEvent,
|
|
28
29
|
editModeEvent,
|
|
29
30
|
navChangeEvent
|
|
30
|
-
} from "../chunk-
|
|
31
|
+
} from "../chunk-PTOLUMGV.js";
|
|
31
32
|
import {
|
|
32
33
|
ensureSanitizer,
|
|
33
34
|
generateNavLinks,
|
|
@@ -37,13 +38,12 @@ import {
|
|
|
37
38
|
import {
|
|
38
39
|
cn
|
|
39
40
|
} from "../chunk-7EOSDFS3.js";
|
|
40
|
-
import "../chunk-S2L3BPLS.js";
|
|
41
41
|
import {
|
|
42
42
|
audiencePasses
|
|
43
43
|
} from "../chunk-YBVK254P.js";
|
|
44
|
+
import "../chunk-S2L3BPLS.js";
|
|
44
45
|
import "../chunk-5BM2Y3NJ.js";
|
|
45
46
|
import "../chunk-TZQPOR5A.js";
|
|
46
|
-
import "../chunk-RHWWQV3J.js";
|
|
47
47
|
import {
|
|
48
48
|
clearRegistry,
|
|
49
49
|
createRegistry,
|
|
@@ -55,6 +55,7 @@ import {
|
|
|
55
55
|
registerSchema,
|
|
56
56
|
registerSection
|
|
57
57
|
} from "../chunk-VKAGMEKE.js";
|
|
58
|
+
import "../chunk-RHWWQV3J.js";
|
|
58
59
|
import "../chunk-FM4M4Q2W.js";
|
|
59
60
|
import "../chunk-NSCT3AMV.js";
|
|
60
61
|
import {
|
|
@@ -91,6 +92,7 @@ export {
|
|
|
91
92
|
loadStaticSiteContent,
|
|
92
93
|
mergeSiteContent,
|
|
93
94
|
navChangeEvent,
|
|
95
|
+
onPrimaryVarValue,
|
|
94
96
|
primaryVarValue,
|
|
95
97
|
registerSchema,
|
|
96
98
|
registerSection,
|
|
@@ -43,6 +43,19 @@ export declare function itemFolderId(folders: Record<string, MediaFolder>, item:
|
|
|
43
43
|
export declare function recursiveItemCounts(folders: Record<string, MediaFolder>, items: MediaItem[]): Record<string, number>;
|
|
44
44
|
/** Pure heal: dangling folderIds dropped, orphan/cyclic folders re-rooted. */
|
|
45
45
|
export declare function healMediaManifest(manifest: MediaManifest): MediaManifest;
|
|
46
|
+
/**
|
|
47
|
+
* Rebase a local manifest onto a freshly-fetched remote one, so media another
|
|
48
|
+
* writer added is in our copy before the next save assembles from it. Without
|
|
49
|
+
* this a rebased session still writes its pre-conflict manifest, which silently
|
|
50
|
+
* drops their entries and orphans the files they committed.
|
|
51
|
+
*
|
|
52
|
+
* Images union, ours winning, so local alt/folder-move edits survive; a pending
|
|
53
|
+
* local deletion isn't removed from the manifest until save, so the union can't
|
|
54
|
+
* resurrect one. Folders stay ours verbatim — deleting a folder removes it from
|
|
55
|
+
* our map with no wire signal, so unioning would undo the delete. Mirrors the
|
|
56
|
+
* server-side merge in core's content-ops.
|
|
57
|
+
*/
|
|
58
|
+
export declare function rebaseMediaManifest(local: MediaManifest, remote: MediaManifest): MediaManifest;
|
|
46
59
|
/**
|
|
47
60
|
* Save-time manifest assembly: merge uploaded pending items, apply deletions,
|
|
48
61
|
* preserve every other manifest key (folders!), then heal.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"media-folders.d.ts","sourceRoot":"","sources":["../../src/lib/media-folders.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAE5E,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,cAAc,EAAE,CAAC;CAC5B;AAED,MAAM,WAAW,gBAAgB;IAC/B,2EAA2E;IAC3E,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IACxC,6DAA6D;IAC7D,WAAW,EAAE;QAAE,IAAI,EAAE,IAAI,CAAC;QAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,EAAE,CAAC;CACxD;AAED,gFAAgF;AAChF,wBAAgB,cAAc,IAAI,MAAM,CAIvC;AAED,iEAAiE;AACjE,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAQxF;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,EAAE,EAAE,EAAE,MAA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