@drawnagency/primitives 0.1.114 → 0.1.115
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-OAGJBCSH.js → chunk-4WQ36ZP7.js} +19 -3
- package/dist/{chunk-PTY2RG2K.js → chunk-67P34WNW.js} +75 -130
- package/dist/chunk-APIJPTFG.js +64 -0
- package/dist/chunk-CDBURDPX.js +90 -0
- package/dist/chunk-DFKTF3CH.js +0 -0
- package/dist/chunk-DJABADOO.js +131 -0
- package/dist/{chunk-IP2SEBAJ.js → chunk-DJOGPSRU.js} +31 -72
- package/dist/{chunk-N3G7DOU3.js → chunk-FHTKSELX.js} +6 -6
- package/dist/chunk-GNF6KFQ7.js +18 -0
- package/dist/{chunk-QHMKIODQ.js → chunk-HHNPSKPT.js} +2 -89
- package/dist/{chunk-PZPGJZRG.js → chunk-JXATNKLV.js} +5 -5
- package/dist/{chunk-PLANHXS7.js → chunk-NX7TFHA4.js} +9 -9
- package/dist/{chunk-PNSCDBU7.js → chunk-O37AV27P.js} +6 -49
- package/dist/{chunk-5KSAS4VY.js → chunk-RIITGTV3.js} +1 -1
- package/dist/chunk-S7QRHUWO.js +8 -0
- package/dist/{chunk-7SAAJVDE.js → chunk-T26HAKW3.js} +37 -35
- package/dist/chunk-VY3IFGE3.js +70 -0
- package/dist/{chunk-VUYCRBJK.js → chunk-WYOFQHKI.js} +6 -4
- package/dist/{chunk-Y5QECJX7.js → chunk-YV3YSZEB.js} +5 -5
- package/dist/collab/rebase.d.ts.map +1 -1
- package/dist/collab/rebase.js +15 -15
- package/dist/components/editor/index.js +13 -13
- package/dist/components/primitives/index.js +16 -11
- package/dist/components/sections/brand-guide.js +13 -8
- package/dist/components/sections/register-schemas.js +20 -15
- package/dist/components/sections/register.js +20 -15
- package/dist/components/shell/EditorShell.d.ts.map +1 -1
- package/dist/deck-builder/index.js +9 -9
- package/dist/hooks/useEditorPublish.d.ts +4 -1
- package/dist/hooks/useEditorPublish.d.ts.map +1 -1
- package/dist/hooks/useMediaPipeline.d.ts.map +1 -1
- package/dist/index.js +85 -56
- package/dist/lib/dexie.d.ts +7 -1
- package/dist/lib/dexie.d.ts.map +1 -1
- package/dist/lib/dexie.js +3 -2
- package/dist/lib/image-variant-plan.d.ts +42 -0
- package/dist/lib/image-variant-plan.d.ts.map +1 -0
- package/dist/lib/image-variant-plan.js +53 -0
- package/dist/lib/index-ops.d.ts.map +1 -1
- package/dist/lib/index-ops.js +20 -16
- package/dist/lib/index.d.ts +2 -1
- package/dist/lib/index.d.ts.map +1 -1
- package/dist/lib/index.js +43 -22
- package/dist/lib/loader.d.ts +16 -17
- package/dist/lib/loader.d.ts.map +1 -1
- package/dist/lib/media-ops.d.ts +73 -0
- package/dist/lib/media-ops.d.ts.map +1 -0
- package/dist/lib/media-ops.js +60 -0
- package/dist/lib/nav-tree.d.ts +6 -0
- package/dist/lib/nav-tree.d.ts.map +1 -1
- package/dist/lib/pages.d.ts +2 -1
- package/dist/lib/pages.d.ts.map +1 -1
- package/dist/lib/sidecar-diagnostics.d.ts +20 -0
- package/dist/lib/sidecar-diagnostics.d.ts.map +1 -0
- package/dist/lib/sidecars.d.ts +118 -0
- package/dist/lib/sidecars.d.ts.map +1 -0
- package/dist/lib/sidecars.js +23 -0
- package/dist/lib/slug.d.ts +2 -0
- package/dist/lib/slug.d.ts.map +1 -0
- package/dist/lib/storage-tier.d.ts +17 -0
- package/dist/lib/storage-tier.d.ts.map +1 -0
- package/dist/lib/storage-tier.js +29 -0
- package/dist/lib/tags.d.ts +6 -0
- package/dist/lib/tags.d.ts.map +1 -1
- package/dist/media/index.js +15 -15
- package/dist/media/queue.d.ts +2 -0
- package/dist/media/queue.d.ts.map +1 -1
- package/dist/media/worker.d.ts +1 -35
- package/dist/media/worker.d.ts.map +1 -1
- package/dist/schemas/index.js +18 -12
- package/dist/schemas/media.d.ts +4 -0
- package/dist/schemas/media.d.ts.map +1 -1
- package/dist/storage/index.js +2 -1
- package/dist/storage/memory.d.ts +21 -0
- package/dist/storage/memory.d.ts.map +1 -0
- package/dist/storage/memory.js +129 -0
- package/dist/storage/types.d.ts +9 -0
- package/dist/storage/types.d.ts.map +1 -1
- package/package.json +21 -1
- package/src/collab/rebase.ts +12 -16
- package/src/components/shell/EditorShell.tsx +7 -4
- package/src/hooks/useEditorPublish.ts +9 -4
- package/src/hooks/useMediaPipeline.ts +29 -23
- package/src/lib/dexie.ts +9 -1
- package/src/lib/image-variant-plan.ts +92 -0
- package/src/lib/index-ops.ts +9 -18
- package/src/lib/index.ts +15 -0
- package/src/lib/loader.ts +18 -77
- package/src/lib/media-ops.ts +112 -0
- package/src/lib/nav-tree.ts +33 -4
- package/src/lib/pages.ts +2 -3
- package/src/lib/sidecar-diagnostics.ts +29 -0
- package/src/lib/sidecars.ts +221 -0
- package/src/lib/slug.ts +6 -0
- package/src/lib/storage-tier.ts +38 -0
- package/src/lib/tags.ts +20 -3
- package/src/media/queue.ts +3 -0
- package/src/media/utils.ts +1 -1
- package/src/media/worker.ts +17 -8
- package/src/schemas/media.ts +7 -2
- package/src/storage/memory.ts +178 -0
- package/src/storage/types.ts +15 -2
- /package/dist/{chunk-45FA7Z55.js → chunk-UUUSJDIG.js} +0 -0
package/dist/lib/loader.d.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { type Section } from "../schemas/sections";
|
|
2
2
|
import { type SiteIndex, type SectionMeta } from "../schemas/site-config";
|
|
3
|
+
import type { NavEntry } from "../schemas/nav";
|
|
4
|
+
import type { TagEntry } from "../schemas/tags";
|
|
5
|
+
import type { SidecarRead } from "./sidecars";
|
|
3
6
|
export interface LoadedSection {
|
|
4
7
|
section: Section;
|
|
5
8
|
meta: SectionMeta;
|
|
@@ -10,39 +13,35 @@ export interface LoadedSection {
|
|
|
10
13
|
export interface SiteContent {
|
|
11
14
|
sections: LoadedSection[];
|
|
12
15
|
index: SiteIndex;
|
|
13
|
-
/**
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
* nav.json from a degraded read permanently destroys the entries this
|
|
17
|
-
* version dropped. */
|
|
16
|
+
/** A Degraded read of nav.json (see SidecarRead): the returned nav is missing
|
|
17
|
+
* entries, so writers treat it as read-only — wholesale-replacing nav.json
|
|
18
|
+
* from it permanently destroys the entries this version dropped. */
|
|
18
19
|
navDegraded: boolean;
|
|
19
20
|
/** Same contract as navDegraded, for tags.json: a degraded read is
|
|
20
21
|
* read-only for tags. */
|
|
21
22
|
tagsDegraded: boolean;
|
|
22
23
|
}
|
|
23
24
|
/**
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
25
|
+
* The Sidecars a load read, from the Sidecar module's readers. A Sidecar the
|
|
26
|
+
* load did not look for is omitted. Tags then stay unattached ("not loaded":
|
|
27
|
+
* writers leave tags.json alone, where an attached `[]` saved back would delete
|
|
28
|
+
* every tag). Nav is attached as `[]` either way — the editor has no nav gate
|
|
29
|
+
* yet to make "not loaded" safe for nav (exploration B).
|
|
29
30
|
*/
|
|
30
|
-
export type
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
loaded: true;
|
|
34
|
-
file: unknown;
|
|
31
|
+
export type SidecarReads = {
|
|
32
|
+
nav?: SidecarRead<NavEntry>;
|
|
33
|
+
tags?: SidecarRead<TagEntry>;
|
|
35
34
|
};
|
|
36
35
|
/**
|
|
37
36
|
* Merge a validated index with raw section file contents.
|
|
38
37
|
* Validates each section file against its Zod schema.
|
|
39
38
|
* Returns sections in the concatenated order of every page's order.
|
|
40
39
|
*/
|
|
41
|
-
export declare function mergeSiteContent(index: SiteIndex, sectionFiles: Record<string, unknown>,
|
|
40
|
+
export declare function mergeSiteContent(index: SiteIndex, sectionFiles: Record<string, unknown>, sidecars?: SidecarReads): SiteContent;
|
|
42
41
|
/**
|
|
43
42
|
* Build a SiteContent from a Vite `import.meta.glob` result.
|
|
44
43
|
* Callers glob the section JSON files at build time, pass the parsed index, and
|
|
45
44
|
* receive sections merged across every page's order.
|
|
46
45
|
*/
|
|
47
|
-
export declare function loadStaticSiteContent(index: SiteIndex, sectionGlob: Record<string, unknown>,
|
|
46
|
+
export declare function loadStaticSiteContent(index: SiteIndex, sectionGlob: Record<string, unknown>, sidecars?: SidecarReads): SiteContent;
|
|
48
47
|
//# sourceMappingURL=loader.d.ts.map
|
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,EAA2B,KAAK,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC5E,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,EAA2B,KAAK,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC5E,OAAO,EAAe,KAAK,SAAS,EAAE,KAAK,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAIvF,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,WAAW,CAAC;IAClB;+DAC2D;IAC3D,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,WAAW;IAC1B,QAAQ,EAAE,aAAa,EAAE,CAAC;IAC1B,KAAK,EAAE,SAAS,CAAC;IACjB;;yEAEqE;IACrE,WAAW,EAAE,OAAO,CAAC;IACrB;8BAC0B;IAC1B,YAAY,EAAE,OAAO,CAAC;CACvB;AAED;;;;;;GAMG;AACH,MAAM,MAAM,YAAY,GAAG;IAAE,GAAG,CAAC,EAAE,WAAW,CAAC,QAAQ,CAAC,CAAC;IAAC,IAAI,CAAC,EAAE,WAAW,CAAC,QAAQ,CAAC,CAAA;CAAE,CAAC;AAEzF;;;;GAIG;AACH,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,SAAS,EAChB,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACrC,QAAQ,GAAE,YAAiB,GAC1B,WAAW,CA2Db;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,SAAS,EAChB,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACpC,QAAQ,GAAE,YAAiB,GAC1B,WAAW,CAQb"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import type { MediaItem, MediaManifest } from "../schemas/media";
|
|
2
|
+
import type { DocumentManifest, DocumentManifestEntry } from "../schemas/documents";
|
|
3
|
+
export type MediaBlob = {
|
|
4
|
+
path: string;
|
|
5
|
+
base64: string;
|
|
6
|
+
};
|
|
7
|
+
export type MediaOp =
|
|
8
|
+
/**
|
|
9
|
+
* A new image and its variant files, keyed by its id (the content hash).
|
|
10
|
+
* `alt` is the caller's alt text, if it sent one — the only alt applied when
|
|
11
|
+
* the image turns out to be in the library already (`entry.alt` is just the
|
|
12
|
+
* new entry's default).
|
|
13
|
+
*/
|
|
14
|
+
{
|
|
15
|
+
op: "addImage";
|
|
16
|
+
entry: MediaItem;
|
|
17
|
+
blobs: MediaBlob[];
|
|
18
|
+
alt?: string;
|
|
19
|
+
} | {
|
|
20
|
+
op: "setImageAlt";
|
|
21
|
+
imageId: string;
|
|
22
|
+
alt: string;
|
|
23
|
+
} | {
|
|
24
|
+
op: "deleteImage";
|
|
25
|
+
imageId: string;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* A document's manifest entry, with its bytes when they ride in the commit
|
|
29
|
+
* (git tier; bucket-tier bytes are uploaded beforehand). For an id already in
|
|
30
|
+
* the library — git-tier ids are the content hash, so the same bytes — only
|
|
31
|
+
* the filename is applied: its stored bytes and path stay. That is how a
|
|
32
|
+
* rename lands.
|
|
33
|
+
*/
|
|
34
|
+
| {
|
|
35
|
+
op: "putDocument";
|
|
36
|
+
documentId: string;
|
|
37
|
+
entry: DocumentManifestEntry;
|
|
38
|
+
blob?: MediaBlob;
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* Per op, in order. `existed` means `addImage` found the image already in the
|
|
42
|
+
* library: its bytes are not committed again, and only a differing alt text is
|
|
43
|
+
* applied.
|
|
44
|
+
*/
|
|
45
|
+
export type MediaOpOutcome = "added" | "existed" | "updated" | "deleted";
|
|
46
|
+
export type AppliedMediaOps = {
|
|
47
|
+
ok: true;
|
|
48
|
+
images: MediaManifest;
|
|
49
|
+
/** Null when no op touched documents, so the write leaves that file alone. */
|
|
50
|
+
documents: DocumentManifest | null;
|
|
51
|
+
uploads: {
|
|
52
|
+
item: {
|
|
53
|
+
id: string;
|
|
54
|
+
folder: string;
|
|
55
|
+
};
|
|
56
|
+
blobs: MediaBlob[];
|
|
57
|
+
}[];
|
|
58
|
+
/** Images whose variant folders the write deletes. */
|
|
59
|
+
deletions: {
|
|
60
|
+
id: string;
|
|
61
|
+
folder: string;
|
|
62
|
+
}[];
|
|
63
|
+
outcomes: MediaOpOutcome[];
|
|
64
|
+
};
|
|
65
|
+
export declare function applyMediaOps(manifests: {
|
|
66
|
+
images: MediaManifest;
|
|
67
|
+
documents: DocumentManifest;
|
|
68
|
+
}, ops: MediaOp[]): AppliedMediaOps | {
|
|
69
|
+
ok: false;
|
|
70
|
+
code: "not_found";
|
|
71
|
+
error: string;
|
|
72
|
+
};
|
|
73
|
+
//# sourceMappingURL=media-ops.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"media-ops.d.ts","sourceRoot":"","sources":["../../src/lib/media-ops.ts"],"names":[],"mappings":"AAAA,O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AAC,MAAM,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAC5C,QAAQ,EAAE,cAAc,EAAE,CAAC;CAC5B,CAAC;AAEF,wBAAgB,aAAa,CAC3B,SAAS,EAAE;IAAE,MAAM,EAAE,aAAa,CAAC;IAAC,SAAS,EAAE,gBAAgB,CAAA;CAAE,EACjE,GAAG,EAAE,OAAO,EAAE,GACb,eAAe,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,IAAI,EAAE,WAAW,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CA2DnE"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import "../chunk-JSBRDJBE.js";
|
|
2
|
+
|
|
3
|
+
// src/lib/media-ops.ts
|
|
4
|
+
function applyMediaOps(manifests, ops) {
|
|
5
|
+
const images = { ...manifests.images, images: { ...manifests.images.images } };
|
|
6
|
+
let documents = null;
|
|
7
|
+
const uploads = [];
|
|
8
|
+
const deletions = [];
|
|
9
|
+
const outcomes = [];
|
|
10
|
+
const keyOf = (imageId) => imageId in images.images ? imageId : Object.keys(images.images).find((key) => images.images[key].id === imageId);
|
|
11
|
+
const notFound = (imageId) => ({ ok: false, code: "not_found", error: `No media with imageId "${imageId}" in the site's media library.` });
|
|
12
|
+
for (const op of ops) {
|
|
13
|
+
switch (op.op) {
|
|
14
|
+
case "addImage": {
|
|
15
|
+
const key = keyOf(op.entry.id);
|
|
16
|
+
if (key === void 0) {
|
|
17
|
+
images.images[op.entry.id] = op.entry;
|
|
18
|
+
uploads.push({ item: { id: op.entry.id, folder: op.entry.folder }, blobs: op.blobs });
|
|
19
|
+
outcomes.push("added");
|
|
20
|
+
} else {
|
|
21
|
+
if (op.alt !== void 0) images.images[key] = { ...images.images[key], alt: op.alt };
|
|
22
|
+
outcomes.push("existed");
|
|
23
|
+
}
|
|
24
|
+
break;
|
|
25
|
+
}
|
|
26
|
+
case "setImageAlt": {
|
|
27
|
+
const key = keyOf(op.imageId);
|
|
28
|
+
if (key === void 0) return notFound(op.imageId);
|
|
29
|
+
images.images[key] = { ...images.images[key], alt: op.alt };
|
|
30
|
+
outcomes.push("updated");
|
|
31
|
+
break;
|
|
32
|
+
}
|
|
33
|
+
case "deleteImage": {
|
|
34
|
+
const key = keyOf(op.imageId);
|
|
35
|
+
if (key === void 0) return notFound(op.imageId);
|
|
36
|
+
deletions.push({ id: key, folder: images.images[key].folder });
|
|
37
|
+
delete images.images[key];
|
|
38
|
+
outcomes.push("deleted");
|
|
39
|
+
break;
|
|
40
|
+
}
|
|
41
|
+
case "putDocument": {
|
|
42
|
+
documents ??= { ...manifests.documents };
|
|
43
|
+
const existing = documents[op.documentId];
|
|
44
|
+
if (existing) {
|
|
45
|
+
documents[op.documentId] = { ...existing, filename: op.entry.filename };
|
|
46
|
+
outcomes.push(existing.filename === op.entry.filename ? "existed" : "updated");
|
|
47
|
+
} else {
|
|
48
|
+
documents[op.documentId] = op.entry;
|
|
49
|
+
if (op.blob) uploads.push({ item: { id: op.documentId, folder: op.blob.path.split("/")[2] ?? "" }, blobs: [op.blob] });
|
|
50
|
+
outcomes.push("added");
|
|
51
|
+
}
|
|
52
|
+
break;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return { ok: true, images, documents, uploads, deletions, outcomes };
|
|
57
|
+
}
|
|
58
|
+
export {
|
|
59
|
+
applyMediaOps
|
|
60
|
+
};
|
package/dist/lib/nav-tree.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { NavEntry, NavGroupEntry } from "../schemas/nav";
|
|
2
2
|
import type { Page, SiteIndex } from "../schemas/site-config";
|
|
3
|
+
import { type SidecarDiagnostic } from "./sidecar-diagnostics";
|
|
3
4
|
/**
|
|
4
5
|
* Repair an authored nav against the current page set.
|
|
5
6
|
*
|
|
@@ -18,6 +19,11 @@ import type { Page, SiteIndex } from "../schemas/site-config";
|
|
|
18
19
|
* prior state and defeat identity-based re-render checks.
|
|
19
20
|
*/
|
|
20
21
|
export declare function reconcileNav(entries: NavEntry[], pages: Page[]): NavEntry[];
|
|
22
|
+
/** reconcileNav plus what the repair changed — what a validator reports. */
|
|
23
|
+
export declare function reconcileNavReport(entries: NavEntry[], pages: Page[]): {
|
|
24
|
+
entries: NavEntry[];
|
|
25
|
+
diagnostics: SidecarDiagnostic[];
|
|
26
|
+
};
|
|
21
27
|
/**
|
|
22
28
|
* The ONLY sanctioned way to read the nav. Always reconciles, so callers never
|
|
23
29
|
* have to reason about whether index.nav is present, stale, or authored by an
|
|
@@ -1 +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;
|
|
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;AAC9D,OAAO,EAAwB,KAAK,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAErF;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,QAAQ,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,QAAQ,EAAE,CAE3E;AAED,4EAA4E;AAC5E,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,QAAQ,EAAE,EACnB,KAAK,EAAE,IAAI,EAAE,GACZ;IAAE,OAAO,EAAE,QAAQ,EAAE,CAAC;IAAC,WAAW,EAAE,iBAAiB,EAAE,CAAA;CAAE,CA4E3D;AAED;;;;GAIG;AACH,wBAAgB,U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UxE;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,WAAW,EAAE,EAAE,EAAE,WAAW,GAAG,SAAS,CAgC5F;AAqBD,wBAAgB,eAAe,CAAC,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,IAAI,EAAE,WAAW,GAAG,MAAM,GAAG,IAAI,CAkD5G"}
|
package/dist/lib/pages.d.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import type { Page, SiteIndex, SectionMeta } from "../schemas/site-config";
|
|
2
2
|
import { type DocumentOptions } from "../document/engine/settings";
|
|
3
|
+
import { slugifyPageSlug } from "./slug";
|
|
3
4
|
/**
|
|
4
5
|
* Display fallback for blank page titles. addPage creates pages with an empty
|
|
5
6
|
* title (the editor prompts for one), and closing the modal can leave it blank
|
|
6
7
|
* — every UI that renders a page title must go through this.
|
|
7
8
|
*/
|
|
8
9
|
export declare function pageDisplayTitle(title: string): string;
|
|
9
|
-
export
|
|
10
|
+
export { slugifyPageSlug };
|
|
10
11
|
export declare function uniquePageSlug(base: string, existing: string[]): string;
|
|
11
12
|
export declare function pageById(index: SiteIndex, id: string): Page | undefined;
|
|
12
13
|
export declare function homePage(index: SiteIndex): Page;
|
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,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,SAAS,CAuBX"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a Sidecar reconcile changed. Reconcile repairs silently on every read, so
|
|
3
|
+
* these are only ever warnings: a validator reports them, nothing rejects on them.
|
|
4
|
+
* - dangling: ids of pages/sections the index does not have, dropped
|
|
5
|
+
* - duplicate-id: a group/tag id used again, later uses dropped
|
|
6
|
+
* - duplicate-member: a page placed twice / a section tagged twice, later placements dropped
|
|
7
|
+
* - unlisted: pages missing from the nav, appended to its end (nav only)
|
|
8
|
+
*
|
|
9
|
+
* Its own leaf so nav-tree and tags can report without importing the Sidecar
|
|
10
|
+
* module that imports them.
|
|
11
|
+
*/
|
|
12
|
+
export type SidecarDiagnostic = {
|
|
13
|
+
code: "dangling" | "duplicate-id" | "duplicate-member" | "unlisted";
|
|
14
|
+
ids: string[];
|
|
15
|
+
};
|
|
16
|
+
export declare function diagnosticsCollector(): {
|
|
17
|
+
add(code: SidecarDiagnostic["code"], id: string): void;
|
|
18
|
+
list(): SidecarDiagnostic[];
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=sidecar-diagnostics.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sidecar-diagnostics.d.ts","sourceRoot":"","sources":["../../src/lib/sidecar-diagnostics.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC9B,IAAI,EAAE,UAAU,GAAG,cAAc,GAAG,kBAAkB,GAAG,UAAU,CAAC;IACpE,GAAG,EAAE,MAAM,EAAE,CAAC;CACf,CAAC;AAEF,wBAAgB,oBAAoB;cAGtB,iBAAiB,CAAC,MAAM,CAAC,MAAM,MAAM;YAKvC,iBAAiB,EAAE;EAI9B"}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import type { ZodType } from "zod";
|
|
2
|
+
import { type NavEntry } from "../schemas/nav";
|
|
3
|
+
import { type TagEntry } from "../schemas/tags";
|
|
4
|
+
import type { SiteIndex } from "../schemas/site-config";
|
|
5
|
+
import type { SidecarDiagnostic } from "./sidecar-diagnostics";
|
|
6
|
+
export type { SidecarDiagnostic };
|
|
7
|
+
/**
|
|
8
|
+
* One definition per Sidecar — a content file kept beside index.json rather than
|
|
9
|
+
* on it, so a writer that predates it cannot drop it (CONTEXT.md). Every rule a
|
|
10
|
+
* caller would otherwise re-implement per file lives behind these: lenient
|
|
11
|
+
* parse, lifting the wire key off an index before IndexSchema strips it, and the
|
|
12
|
+
* two places the Sidecars genuinely differ — how a list is repaired against the
|
|
13
|
+
* index, and how concurrent edits rebase. Pure and browser-safe: the editor uses
|
|
14
|
+
* it during hydration, and callers do their own I/O.
|
|
15
|
+
*/
|
|
16
|
+
export interface SidecarDefinition<E> {
|
|
17
|
+
/** Also the key the Sidecar travels under on the wire (`index.nav`, `index.tags`). */
|
|
18
|
+
name: "nav" | "tags";
|
|
19
|
+
path: string;
|
|
20
|
+
/** The key holding the entry list inside the file. */
|
|
21
|
+
fileKey: "entries" | "tags";
|
|
22
|
+
entrySchema: ZodType<E>;
|
|
23
|
+
fileSchema: ZodType<unknown>;
|
|
24
|
+
/** Total, pure and idempotent; also reports what it repaired. */
|
|
25
|
+
reconcile(entries: E[], index: SiteIndex): {
|
|
26
|
+
entries: E[];
|
|
27
|
+
diagnostics: SidecarDiagnostic[];
|
|
28
|
+
};
|
|
29
|
+
/** The list after a collab rebase; `undefined` when no side carries one. */
|
|
30
|
+
rebase(args: {
|
|
31
|
+
base: E[] | undefined;
|
|
32
|
+
local: E[] | undefined;
|
|
33
|
+
remote: E[] | undefined;
|
|
34
|
+
}): E[] | undefined;
|
|
35
|
+
/** Words for a declined write's warning. */
|
|
36
|
+
words: {
|
|
37
|
+
/** What the file holds: "navigation entries". */
|
|
38
|
+
entries: string;
|
|
39
|
+
/** What did not land: "Page grouping changes". */
|
|
40
|
+
changes: string;
|
|
41
|
+
/** What a valid payload is: "a valid navigation tree". */
|
|
42
|
+
valid: string;
|
|
43
|
+
/** The expected wire shape, for an agent that sent the wrong one. */
|
|
44
|
+
shape: string;
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
export declare const NAV: SidecarDefinition<NavEntry>;
|
|
48
|
+
export declare const TAGS: SidecarDefinition<TagEntry>;
|
|
49
|
+
export declare const SIDECARS: readonly SidecarDefinition<unknown>[];
|
|
50
|
+
/**
|
|
51
|
+
* A Sidecar as read. `degraded` means the file was present but held something
|
|
52
|
+
* this package version could not represent, so `entries` is missing it: the read
|
|
53
|
+
* is a Degraded read, never to be cached, posted back, or written over the file.
|
|
54
|
+
*/
|
|
55
|
+
export type SidecarRead<E> = {
|
|
56
|
+
entries: E[];
|
|
57
|
+
degraded: boolean;
|
|
58
|
+
};
|
|
59
|
+
/** Read a parsed Sidecar file. Absent (null/undefined) is an empty list, not degraded. */
|
|
60
|
+
export declare function readSidecar<E>(def: SidecarDefinition<E>, file: unknown): SidecarRead<E>;
|
|
61
|
+
/**
|
|
62
|
+
* Read a Sidecar file's raw text. Present-but-unparseable JSON is degraded, not
|
|
63
|
+
* absent: a site whose nav.json is corrupt still has groups, and treating it as
|
|
64
|
+
* "never had any" would let a writer replace them.
|
|
65
|
+
*/
|
|
66
|
+
export declare function readSidecarText<E>(def: SidecarDefinition<E>, text: string | undefined): SidecarRead<E>;
|
|
67
|
+
/**
|
|
68
|
+
* Lift the Sidecars off an index as it arrives on the wire, BEFORE anything
|
|
69
|
+
* parses it with IndexSchema — the parse strips unknown keys, and an index
|
|
70
|
+
* round-tripped through it has lost its Sidecars. A key the index does not carry
|
|
71
|
+
* is `undefined` (omitted: writers leave the file alone); a carried key is read
|
|
72
|
+
* with the file's per-entry leniency, into fresh objects that never alias the
|
|
73
|
+
* caller's.
|
|
74
|
+
*/
|
|
75
|
+
export declare function liftSidecars(rawIndex: unknown): {
|
|
76
|
+
nav?: SidecarRead<NavEntry>;
|
|
77
|
+
tags?: SidecarRead<TagEntry>;
|
|
78
|
+
};
|
|
79
|
+
/** The Sidecar file on the branch a write lands on, as the writer read it. */
|
|
80
|
+
export type SidecarFileState = {
|
|
81
|
+
kind: "absent";
|
|
82
|
+
} | {
|
|
83
|
+
kind: "present";
|
|
84
|
+
text: string;
|
|
85
|
+
}
|
|
86
|
+
/** The read itself failed, so nothing is known about the file. */
|
|
87
|
+
| {
|
|
88
|
+
kind: "unreadable";
|
|
89
|
+
};
|
|
90
|
+
export type SidecarWritePlan = {
|
|
91
|
+
action: "untouched";
|
|
92
|
+
} | {
|
|
93
|
+
action: "write";
|
|
94
|
+
path: string;
|
|
95
|
+
content: string;
|
|
96
|
+
}
|
|
97
|
+
/** Declined. The rest of the write still lands, so the warning is what tells the caller. */
|
|
98
|
+
| {
|
|
99
|
+
action: "skip";
|
|
100
|
+
warning: string;
|
|
101
|
+
};
|
|
102
|
+
/**
|
|
103
|
+
* What a write does to one Sidecar file, given what was posted (from
|
|
104
|
+
* liftSidecars) and the file on the branch. Every Sidecar write REPLACES the
|
|
105
|
+
* file, and the posted list was built from what this package version could
|
|
106
|
+
* READ — so a file holding anything this version cannot fully parse (an entry
|
|
107
|
+
* from a newer package, or a corrupt file) is read-only: replacing it would
|
|
108
|
+
* destroy those entries with a clean write. The same holds for a posted
|
|
109
|
+
* Degraded read.
|
|
110
|
+
*
|
|
111
|
+
* Emptiness is judged on the POSTED list, before reconcile: an empty list never
|
|
112
|
+
* creates a file (every editor save carries the Sidecars, and nav's reconcile
|
|
113
|
+
* would turn [] into the page list), while an empty list over an existing file
|
|
114
|
+
* replaces it wholesale. A written list is reconciled against the index being
|
|
115
|
+
* written, so it never names a page or section that write removed.
|
|
116
|
+
*/
|
|
117
|
+
export declare function planSidecarWrite<E>(def: SidecarDefinition<E>, posted: SidecarRead<E> | undefined, branch: SidecarFileState, index: SiteIndex): SidecarWritePlan;
|
|
118
|
+
//# sourceMappingURL=sidecars.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sidecars.d.ts","sourceRoot":"","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EAAE,OAAO,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE;AACpD,4FAA4F;GAC1F;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAExC;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,EAChC,GAAG,EAAE,iBAAiB,CAAC,CAAC,CAAC,EACzB,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC,GAAG,SAAS,EAClC,MAAM,EAAE,gBAAgB,EACxB,KAAK,EAAE,SAAS,GACf,gBAAgB,CAkClB"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import {
|
|
2
|
+
NAV,
|
|
3
|
+
SIDECARS,
|
|
4
|
+
TAGS,
|
|
5
|
+
liftSidecars,
|
|
6
|
+
planSidecarWrite,
|
|
7
|
+
readSidecar,
|
|
8
|
+
readSidecarText
|
|
9
|
+
} from "../chunk-DJABADOO.js";
|
|
10
|
+
import "../chunk-DJOGPSRU.js";
|
|
11
|
+
import "../chunk-4WQ36ZP7.js";
|
|
12
|
+
import "../chunk-GNF6KFQ7.js";
|
|
13
|
+
import "../chunk-4Y2JQQZL.js";
|
|
14
|
+
import "../chunk-JSBRDJBE.js";
|
|
15
|
+
export {
|
|
16
|
+
NAV,
|
|
17
|
+
SIDECARS,
|
|
18
|
+
TAGS,
|
|
19
|
+
liftSidecars,
|
|
20
|
+
planSidecarWrite,
|
|
21
|
+
readSidecar,
|
|
22
|
+
readSidecarText
|
|
23
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slug.d.ts","sourceRoot":"","sources":["../../src/lib/slug.ts"],"names":[],"mappings":"AAGA,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAErD"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { DOCUMENT_GIT_MAX_BYTES, DOCUMENT_BUCKET_MAX_BYTES } from "../schemas/documents";
|
|
2
|
+
import { MEDIA_GIT_MAX_BYTES, MEDIA_BUCKET_MAX_BYTES, type MediaConfig } from "../schemas/media";
|
|
3
|
+
export { DOCUMENT_GIT_MAX_BYTES, DOCUMENT_BUCKET_MAX_BYTES, MEDIA_GIT_MAX_BYTES, MEDIA_BUCKET_MAX_BYTES };
|
|
4
|
+
/**
|
|
5
|
+
* The MCP connector's own document ceiling, half the bucket cap. The binding
|
|
6
|
+
* constraint is memory, not time: a presigned PUT cannot stream, so the whole
|
|
7
|
+
* body is buffered (peak about 2x the file). The browser path has no such
|
|
8
|
+
* limit because those bytes never pass through a function.
|
|
9
|
+
*/
|
|
10
|
+
export declare const DOCUMENT_CONNECTOR_MAX_BYTES = 104857600;
|
|
11
|
+
export type StorageTier = "git" | "bucket" | "too_large";
|
|
12
|
+
type MediaLimits = Pick<MediaConfig, "maxFileSize" | "maxAssetSize">;
|
|
13
|
+
/** Media limits come from the site's `media` config; documents' are fixed. */
|
|
14
|
+
export declare function tierFor(kind: "document" | "media", bytes: number, media?: MediaLimits): StorageTier;
|
|
15
|
+
/** "2.5 MB", "100 MB" — one decimal at most, in binary megabytes. */
|
|
16
|
+
export declare function formatBytes(bytes: number): string;
|
|
17
|
+
//# sourceMappingURL=storage-tier.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storage-tier.d.ts","sourceRoot":"","sources":["../../src/lib/storage-tier.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AACzF,OAAO,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,KAAK,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAOjG,OAAO,EAAE,sBAAsB,EAAE,yBAAyB,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,CAAC;AAE1G;;;;;GAKG;AACH,eAAO,MAAM,4BAA4B,YAAc,CAAC;AAExD,MAAM,MAAM,WAAW,GAAG,KAAK,GAAG,QAAQ,GAAG,WAAW,CAAC;AAEzD,KAAK,WAAW,GAAG,IAAI,CAAC,WAAW,EAAE,aAAa,GAAG,cAAc,CAAC,CAAC;AAErE,8EAA8E;AAC9E,wBAAgB,OAAO,CACrB,IAAI,EAAE,UAAU,GAAG,OAAO,EAC1B,KAAK,EAAE,MAAM,EACb,KAAK,GAAE,WAAwF,GAC9F,WAAW,CAKb;AAED,qEAAqE;AACrE,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEjD"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import {
|
|
2
|
+
MEDIA_BUCKET_MAX_BYTES,
|
|
3
|
+
MEDIA_GIT_MAX_BYTES
|
|
4
|
+
} from "../chunk-APIJPTFG.js";
|
|
5
|
+
import {
|
|
6
|
+
DOCUMENT_BUCKET_MAX_BYTES,
|
|
7
|
+
DOCUMENT_GIT_MAX_BYTES
|
|
8
|
+
} from "../chunk-BS5AQHZG.js";
|
|
9
|
+
import "../chunk-JSBRDJBE.js";
|
|
10
|
+
|
|
11
|
+
// src/lib/storage-tier.ts
|
|
12
|
+
var DOCUMENT_CONNECTOR_MAX_BYTES = 104857600;
|
|
13
|
+
function tierFor(kind, bytes, media = { maxFileSize: MEDIA_GIT_MAX_BYTES, maxAssetSize: MEDIA_BUCKET_MAX_BYTES }) {
|
|
14
|
+
const [gitMax, bucketMax] = kind === "document" ? [DOCUMENT_GIT_MAX_BYTES, DOCUMENT_BUCKET_MAX_BYTES] : [media.maxFileSize, media.maxAssetSize];
|
|
15
|
+
if (bytes <= gitMax) return "git";
|
|
16
|
+
return bytes <= bucketMax ? "bucket" : "too_large";
|
|
17
|
+
}
|
|
18
|
+
function formatBytes(bytes) {
|
|
19
|
+
return `${Math.round(bytes / 1024 / 1024 * 10) / 10} MB`;
|
|
20
|
+
}
|
|
21
|
+
export {
|
|
22
|
+
DOCUMENT_BUCKET_MAX_BYTES,
|
|
23
|
+
DOCUMENT_CONNECTOR_MAX_BYTES,
|
|
24
|
+
DOCUMENT_GIT_MAX_BYTES,
|
|
25
|
+
MEDIA_BUCKET_MAX_BYTES,
|
|
26
|
+
MEDIA_GIT_MAX_BYTES,
|
|
27
|
+
formatBytes,
|
|
28
|
+
tierFor
|
|
29
|
+
};
|
package/dist/lib/tags.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { TagEntry } from "../schemas/tags";
|
|
2
2
|
import type { SiteIndex } from "../schemas/site-config";
|
|
3
|
+
import { type SidecarDiagnostic } from "./sidecar-diagnostics";
|
|
3
4
|
/**
|
|
4
5
|
* Repair the tag sidecar against the current section set.
|
|
5
6
|
*
|
|
@@ -18,6 +19,11 @@ import type { SiteIndex } from "../schemas/site-config";
|
|
|
18
19
|
* React state, where a shared array would let a later edit mutate prior state).
|
|
19
20
|
*/
|
|
20
21
|
export declare function reconcileTags(entries: TagEntry[], sections: SiteIndex["sections"]): TagEntry[];
|
|
22
|
+
/** reconcileTags plus what the repair changed — what a validator reports. */
|
|
23
|
+
export declare function reconcileTagsReport(entries: TagEntry[], sections: SiteIndex["sections"]): {
|
|
24
|
+
entries: TagEntry[];
|
|
25
|
+
diagnostics: SidecarDiagnostic[];
|
|
26
|
+
};
|
|
21
27
|
/**
|
|
22
28
|
* The ONLY sanctioned way to read the tags. Always reconciles, so callers never
|
|
23
29
|
* reason about whether index.tags is present, stale, or names deleted sections.
|
package/dist/lib/tags.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tags.d.ts","sourceRoot":"","sources":["../../src/lib/tags.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"tags.d.ts","sourceRoot":"","sources":["../../src/lib/tags.ts"],"names":[],"mappings":"AAAA,OAAO,K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AM,EAAE,MAAM,EAAE,OAAO,GAAG,SAAS,CAS/G;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE;IAC9B,IAAI,EAAE,QAAQ,EAAE,GAAG,SAAS,CAAC;IAC7B,KAAK,EAAE,QAAQ,EAAE,GAAG,SAAS,CAAC;IAC9B,MAAM,EAAE,QAAQ,EAAE,GAAG,SAAS,CAAC;CAChC,GAAG,QAAQ,EAAE,GAAG,SAAS,CAsCzB"}
|
package/dist/media/index.js
CHANGED
|
@@ -1,36 +1,36 @@
|
|
|
1
1
|
import {
|
|
2
2
|
BAKED_MEDIA_KEYS,
|
|
3
|
-
EXT_TO_MIME,
|
|
4
|
-
MIME_TO_EXT,
|
|
5
3
|
ProcessingQueue,
|
|
6
4
|
composePreviewImage,
|
|
5
|
+
generateVideoPoster,
|
|
6
|
+
getMediaProvider,
|
|
7
|
+
rebindImageRef,
|
|
8
|
+
resolveLogo,
|
|
9
|
+
resolveManifestReferences,
|
|
10
|
+
resolveMedia,
|
|
11
|
+
setMediaProvider
|
|
12
|
+
} from "../chunk-HHNPSKPT.js";
|
|
13
|
+
import {
|
|
14
|
+
EXT_TO_MIME,
|
|
15
|
+
MIME_TO_EXT,
|
|
7
16
|
displayFilename,
|
|
8
17
|
displayFilenameExt,
|
|
9
18
|
displayName,
|
|
10
19
|
formatFileSize,
|
|
11
|
-
generateVideoPoster,
|
|
12
|
-
getMediaProvider,
|
|
13
20
|
hashFileBuffer,
|
|
14
21
|
imageThumbnailUrl,
|
|
15
22
|
mediaThumbnailUrl,
|
|
16
23
|
mimeToExt,
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
resolveMedia,
|
|
21
|
-
sanitizeMediaName,
|
|
22
|
-
setMediaProvider
|
|
23
|
-
} from "../chunk-QHMKIODQ.js";
|
|
24
|
-
import "../chunk-IP2SEBAJ.js";
|
|
24
|
+
sanitizeMediaName
|
|
25
|
+
} from "../chunk-CDBURDPX.js";
|
|
26
|
+
import "../chunk-S7QRHUWO.js";
|
|
25
27
|
import {
|
|
26
28
|
ImageManifestSchema,
|
|
27
29
|
MediaConfigSchema,
|
|
28
30
|
MediaFolderSchema,
|
|
29
31
|
MediaItemSchema,
|
|
30
32
|
VariantSchema
|
|
31
|
-
} from "../chunk-
|
|
32
|
-
import "../chunk-4TZJZU2T.js";
|
|
33
|
-
import "../chunk-AASEGXNT.js";
|
|
33
|
+
} from "../chunk-APIJPTFG.js";
|
|
34
34
|
import "../chunk-JSBRDJBE.js";
|
|
35
35
|
export {
|
|
36
36
|
BAKED_MEDIA_KEYS,
|
package/dist/media/queue.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { MediaKind } from "./types";
|
|
2
|
+
import type { ImageVariantPlan } from "../lib/image-variant-plan";
|
|
2
3
|
export interface QueueInput {
|
|
3
4
|
buffer: ArrayBuffer;
|
|
4
5
|
originalName: string;
|
|
@@ -26,6 +27,7 @@ export interface QueueItem {
|
|
|
26
27
|
posterBlob?: Blob;
|
|
27
28
|
width: number;
|
|
28
29
|
height: number;
|
|
30
|
+
plan?: ImageVariantPlan;
|
|
29
31
|
};
|
|
30
32
|
}
|
|
31
33
|
export type QueueEvent = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"queue.d.ts","sourceRoot":"","sources":["../../src/media/queue.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"queue.d.ts","sourceRoot":"","sources":["../../src/media/queue.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAElE,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,WAAW,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,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