@drawnagency/primitives 0.1.111 → 0.1.113
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/auth/types.d.ts +1 -0
- package/dist/auth/types.d.ts.map +1 -1
- package/dist/chunk-4I5OO5UB.js +785 -0
- package/dist/{chunk-7WQJ57XG.js → chunk-6BZ2KNTP.js} +68 -260
- package/dist/{chunk-UVIYI4J6.js → chunk-AHALSCQH.js} +19 -3
- package/dist/{chunk-7MI3HCOF.js → chunk-BDFTMGCL.js} +10 -6
- package/dist/chunk-CXZ5YJG4.js +85 -0
- package/dist/{chunk-RA5IOFPY.js → chunk-DNY72JZN.js} +16 -38
- package/dist/{chunk-3GAG6ZXB.js → chunk-DS4GCYV2.js} +8 -4
- package/dist/{chunk-XQMDWXD6.js → chunk-FRE2CCLV.js} +3 -2
- package/dist/chunk-FV7JQRCN.js +94 -0
- package/dist/chunk-IIDKW7AV.js +41 -0
- package/dist/chunk-IINIZBQB.js +204 -0
- package/dist/{chunk-ELQ4C677.js → chunk-JH762VUH.js} +9 -44
- package/dist/{chunk-OUYB2GCW.js → chunk-K7DYZXVU.js} +1 -57
- package/dist/{chunk-NXGIHSL5.js → chunk-KR2MHTNJ.js} +11 -91
- package/dist/chunk-MM7KZS5C.js +30 -0
- package/dist/{chunk-OTDA6KWL.js → chunk-NHN2LSIU.js} +1 -1
- package/dist/chunk-QQ3S3P5P.js +38 -0
- package/dist/chunk-VAYZJKVR.js +209 -0
- package/dist/{chunk-VCCNKTFD.js → chunk-VWWY5TL5.js} +3 -31
- package/dist/chunk-WUJ3XNFI.js +62 -0
- package/dist/{chunk-ALMEC3XN.js → chunk-Z7W3DQTR.js} +22 -18
- package/dist/collab/rebase.js +1 -1
- package/dist/components/chat/ChatComposer.d.ts +25 -0
- package/dist/components/chat/ChatComposer.d.ts.map +1 -0
- package/dist/components/chat/ChatPanel.d.ts +5 -4
- package/dist/components/chat/ChatPanel.d.ts.map +1 -1
- package/dist/components/chat/ChatWidget.d.ts.map +1 -1
- package/dist/components/chat/markdown.d.ts +14 -0
- package/dist/components/chat/markdown.d.ts.map +1 -0
- package/dist/components/editor/index.js +16 -11
- package/dist/components/primitives/EditablePlainText.d.ts.map +1 -1
- package/dist/components/primitives/index.js +15 -10
- package/dist/components/sections/brand-guide.js +11 -9
- package/dist/components/sections/register-schemas.js +19 -14
- package/dist/components/sections/register.js +19 -14
- package/dist/components/shared/Navigation.d.ts +1 -0
- package/dist/components/shared/Navigation.d.ts.map +1 -1
- package/dist/components/shell/AudienceChips.d.ts +10 -0
- package/dist/components/shell/AudienceChips.d.ts.map +1 -0
- package/dist/components/shell/EditorShell.d.ts.map +1 -1
- package/dist/components/shell/SiteSettingsChatbot.d.ts.map +1 -1
- package/dist/components/shell/SiteSettingsDecks.d.ts +13 -0
- package/dist/components/shell/SiteSettingsDecks.d.ts.map +1 -0
- package/dist/components/shell/SiteSettingsDisplay.d.ts.map +1 -1
- package/dist/components/shell/SiteSettingsModal.d.ts.map +1 -1
- package/dist/components/shell/SiteSettingsUsers.d.ts.map +1 -1
- package/dist/deck/DeckComponentView.d.ts +13 -0
- package/dist/deck/DeckComponentView.d.ts.map +1 -0
- package/dist/deck/DeckPlayer.d.ts +26 -0
- package/dist/deck/DeckPlayer.d.ts.map +1 -0
- package/dist/deck/DeckSlideView.d.ts +17 -0
- package/dist/deck/DeckSlideView.d.ts.map +1 -0
- package/dist/deck/DeckStage.d.ts +16 -0
- package/dist/deck/DeckStage.d.ts.map +1 -0
- package/dist/deck/components/DeckImage.d.ts +14 -0
- package/dist/deck/components/DeckImage.d.ts.map +1 -0
- package/dist/deck/components/DeckImageGrid.d.ts +27 -0
- package/dist/deck/components/DeckImageGrid.d.ts.map +1 -0
- package/dist/deck/components/DeckRichText.d.ts +22 -0
- package/dist/deck/components/DeckRichText.d.ts.map +1 -0
- package/dist/deck/components/DeckVideo.d.ts +15 -0
- package/dist/deck/components/DeckVideo.d.ts.map +1 -0
- package/dist/deck/editing.d.ts +50 -0
- package/dist/deck/editing.d.ts.map +1 -0
- package/dist/deck/flip.d.ts +11 -0
- package/dist/deck/flip.d.ts.map +1 -0
- package/dist/deck/index.d.ts +24 -0
- package/dist/deck/index.d.ts.map +1 -0
- package/dist/deck/index.js +53 -0
- package/dist/deck/layouts/CenteredTextLayout.d.ts +12 -0
- package/dist/deck/layouts/CenteredTextLayout.d.ts.map +1 -0
- package/dist/deck/layouts/ColumnSplitLayout.d.ts +14 -0
- package/dist/deck/layouts/ColumnSplitLayout.d.ts.map +1 -0
- package/dist/deck/layouts/FullBleedImageLayout.d.ts +14 -0
- package/dist/deck/layouts/FullBleedImageLayout.d.ts.map +1 -0
- package/dist/deck/media.d.ts +33 -0
- package/dist/deck/media.d.ts.map +1 -0
- package/dist/deck/tokens.d.ts +22 -0
- package/dist/deck/tokens.d.ts.map +1 -0
- package/dist/deck/useStageScale.d.ts +10 -0
- package/dist/deck/useStageScale.d.ts.map +1 -0
- package/dist/deck-builder/DeckBuilderApp.d.ts +30 -0
- package/dist/deck-builder/DeckBuilderApp.d.ts.map +1 -0
- package/dist/deck-builder/DeckBuilderTopBar.d.ts +24 -0
- package/dist/deck-builder/DeckBuilderTopBar.d.ts.map +1 -0
- package/dist/deck-builder/DeckChatPanel.d.ts +45 -0
- package/dist/deck-builder/DeckChatPanel.d.ts.map +1 -0
- package/dist/deck-builder/DeckEditor.d.ts +37 -0
- package/dist/deck-builder/DeckEditor.d.ts.map +1 -0
- package/dist/deck-builder/DeckLibrary.d.ts +22 -0
- package/dist/deck-builder/DeckLibrary.d.ts.map +1 -0
- package/dist/deck-builder/DeckSlideSurface.d.ts +31 -0
- package/dist/deck-builder/DeckSlideSurface.d.ts.map +1 -0
- package/dist/deck-builder/deck-api.d.ts +76 -0
- package/dist/deck-builder/deck-api.d.ts.map +1 -0
- package/dist/deck-builder/deck-chat-client.d.ts +44 -0
- package/dist/deck-builder/deck-chat-client.d.ts.map +1 -0
- package/dist/deck-builder/deck-chat-history.d.ts +10 -0
- package/dist/deck-builder/deck-chat-history.d.ts.map +1 -0
- package/dist/deck-builder/index.d.ts +13 -0
- package/dist/deck-builder/index.d.ts.map +1 -0
- package/dist/deck-builder/index.js +1505 -0
- package/dist/deck-builder/starter-deck.d.ts +23 -0
- package/dist/deck-builder/starter-deck.d.ts.map +1 -0
- package/dist/deck-builder/types.d.ts +29 -0
- package/dist/deck-builder/types.d.ts.map +1 -0
- package/dist/deck-builder/useSortableSlide.d.ts +29 -0
- package/dist/deck-builder/useSortableSlide.d.ts.map +1 -0
- package/dist/index.js +70 -63
- package/dist/lib/deck-access.d.ts +86 -0
- package/dist/lib/deck-access.d.ts.map +1 -0
- package/dist/lib/deck-access.js +58 -0
- package/dist/lib/deck-dexie.d.ts +88 -0
- package/dist/lib/deck-dexie.d.ts.map +1 -0
- package/dist/lib/deck-dexie.js +22 -0
- package/dist/lib/deck-edit.d.ts +67 -0
- package/dist/lib/deck-edit.d.ts.map +1 -0
- package/dist/lib/deck-media-assets.d.ts +27 -0
- package/dist/lib/deck-media-assets.d.ts.map +1 -0
- package/dist/lib/deck-media-assets.js +25 -0
- package/dist/lib/deck-media-refs.d.ts +35 -0
- package/dist/lib/deck-media-refs.d.ts.map +1 -0
- package/dist/lib/deck-media-refs.js +36 -0
- package/dist/lib/deck-tool.d.ts +25 -0
- package/dist/lib/deck-tool.d.ts.map +1 -0
- package/dist/lib/deck-tool.js +58 -0
- package/dist/lib/index-ops.js +2 -2
- package/dist/lib/index.js +17 -12
- package/dist/lib/nav.d.ts.map +1 -1
- package/dist/media/index.js +3 -3
- package/dist/media/resolve.d.ts +2 -0
- package/dist/media/resolve.d.ts.map +1 -1
- package/dist/schemas/deck-meta.d.ts +85 -0
- package/dist/schemas/deck-meta.d.ts.map +1 -0
- package/dist/schemas/deck-meta.js +64 -0
- package/dist/schemas/deck.d.ts +954 -0
- package/dist/schemas/deck.d.ts.map +1 -0
- package/dist/schemas/deck.js +65 -0
- package/dist/schemas/index.js +39 -37
- package/dist/schemas/site-config.d.ts +14 -1
- package/dist/schemas/site-config.d.ts.map +1 -1
- package/dist/types/database.d.ts +8 -0
- package/dist/types/database.d.ts.map +1 -1
- package/package.json +37 -1
- package/src/auth/types.ts +1 -0
- package/src/components/chat/ChatComposer.tsx +100 -0
- package/src/components/chat/ChatPanel.tsx +20 -69
- package/src/components/chat/ChatWidget.tsx +5 -4
- package/src/components/chat/markdown.ts +32 -0
- package/src/components/primitives/EditablePlainText.tsx +11 -1
- package/src/components/shared/Navigation.tsx +26 -18
- package/src/components/shell/AudienceChips.tsx +30 -0
- package/src/components/shell/EditorShell.tsx +12 -0
- package/src/components/shell/SiteSettingsChatbot.tsx +1 -18
- package/src/components/shell/SiteSettingsDecks.tsx +41 -0
- package/src/components/shell/SiteSettingsDisplay.tsx +10 -1
- package/src/components/shell/SiteSettingsModal.tsx +11 -0
- package/src/components/shell/SiteSettingsUsers.tsx +49 -2
- package/src/deck/DeckComponentView.tsx +28 -0
- package/src/deck/DeckPlayer.tsx +166 -0
- package/src/deck/DeckSlideView.tsx +38 -0
- package/src/deck/DeckStage.tsx +39 -0
- package/src/deck/components/DeckImage.tsx +38 -0
- package/src/deck/components/DeckImageGrid.tsx +254 -0
- package/src/deck/components/DeckRichText.tsx +111 -0
- package/src/deck/components/DeckVideo.tsx +81 -0
- package/src/deck/editing.tsx +201 -0
- package/src/deck/flip.ts +70 -0
- package/src/deck/index.ts +30 -0
- package/src/deck/layouts/CenteredTextLayout.tsx +29 -0
- package/src/deck/layouts/ColumnSplitLayout.tsx +69 -0
- package/src/deck/layouts/FullBleedImageLayout.tsx +58 -0
- package/src/deck/media.tsx +46 -0
- package/src/deck/tokens.ts +57 -0
- package/src/deck/useStageScale.ts +44 -0
- package/src/deck-builder/DeckBuilderApp.tsx +572 -0
- package/src/deck-builder/DeckBuilderTopBar.tsx +62 -0
- package/src/deck-builder/DeckChatPanel.tsx +334 -0
- package/src/deck-builder/DeckEditor.tsx +258 -0
- package/src/deck-builder/DeckLibrary.tsx +195 -0
- package/src/deck-builder/DeckSlideSurface.tsx +55 -0
- package/src/deck-builder/deck-api.ts +177 -0
- package/src/deck-builder/deck-chat-client.ts +129 -0
- package/src/deck-builder/deck-chat-history.ts +62 -0
- package/src/deck-builder/index.ts +12 -0
- package/src/deck-builder/starter-deck.ts +86 -0
- package/src/deck-builder/types.ts +24 -0
- package/src/deck-builder/useSortableSlide.ts +102 -0
- package/src/lib/deck-access.ts +132 -0
- package/src/lib/deck-dexie.ts +190 -0
- package/src/lib/deck-edit.ts +196 -0
- package/src/lib/deck-media-assets.ts +57 -0
- package/src/lib/deck-media-refs.ts +67 -0
- package/src/lib/deck-tool.ts +95 -0
- package/src/lib/nav.ts +21 -1
- package/src/media/resolve.ts +3 -1
- package/src/schemas/deck-meta.ts +88 -0
- package/src/schemas/deck.ts +478 -0
- package/src/schemas/index.ts +4 -0
- package/src/schemas/site-config.ts +27 -1
- package/src/types/database.ts +4 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type Deck } from "../schemas/deck";
|
|
2
|
+
/**
|
|
3
|
+
* A new deck's seed. Three slides using the two text-only Layouts, so a New
|
|
4
|
+
* Deck is publishable and presentable before the author has said anything —
|
|
5
|
+
* and so the starter never cites media that a given site may not have (a
|
|
6
|
+
* reference the manifest cannot resolve renders as a gap, which is a poor
|
|
7
|
+
* first impression of the runtime).
|
|
8
|
+
*
|
|
9
|
+
* Parsed rather than cast: this is the one deck the product itself authors, so
|
|
10
|
+
* a schema change that breaks it should break a test, not a client's first
|
|
11
|
+
* deck.
|
|
12
|
+
*/
|
|
13
|
+
export declare function starterDeck(id: string, title: string): Deck;
|
|
14
|
+
/**
|
|
15
|
+
* A deck id for a new deck: a slug of the title plus a short random suffix.
|
|
16
|
+
*
|
|
17
|
+
* Random rather than sequential because the id is a directory name on a shared
|
|
18
|
+
* branch that this browser cannot enumerate (a viewer only ever sees their own
|
|
19
|
+
* decks), so "next free number" is not something the builder can know. The
|
|
20
|
+
* charset is `DeckIdSchema`'s.
|
|
21
|
+
*/
|
|
22
|
+
export declare function newDeckId(title: string): string;
|
|
23
|
+
//# sourceMappingURL=starter-deck.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"starter-deck.d.ts","sourceRoot":"","sources":["../../src/deck-builder/starter-deck.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmC,KAAK,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAE7E;;;;;;;;;;GAUG;AACH,wBAAgB,WAAW,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAsD3D;AAED;;;;;;;GAOG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAQ/C"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { Deck } from "../schemas/deck";
|
|
2
|
+
/**
|
|
3
|
+
* One row of the builder's deck grid: whatever this browser has staged, joined
|
|
4
|
+
* to whatever the decks branch holds.
|
|
5
|
+
*
|
|
6
|
+
* The join is by deck id and both sides are optional, because the three states
|
|
7
|
+
* are all real: a draft never published (published side absent), a deck
|
|
8
|
+
* published from another device (draft side absent), and the normal case where
|
|
9
|
+
* both exist and may differ.
|
|
10
|
+
*/
|
|
11
|
+
export interface DeckGridEntry {
|
|
12
|
+
id: string;
|
|
13
|
+
title: string;
|
|
14
|
+
slideCount: number;
|
|
15
|
+
/** ISO timestamp behind the card's "… ago" line. */
|
|
16
|
+
updatedAt: string;
|
|
17
|
+
/** Present when this browser has the deck staged. */
|
|
18
|
+
draft: {
|
|
19
|
+
deck: Deck;
|
|
20
|
+
baseVersion: string | null;
|
|
21
|
+
} | null;
|
|
22
|
+
/** Present when the decks branch holds it. */
|
|
23
|
+
published: {
|
|
24
|
+
version: string;
|
|
25
|
+
} | null;
|
|
26
|
+
/** The draft differs from what was published (or was never published). */
|
|
27
|
+
unpublishedChanges: boolean;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/deck-builder/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAE5C;;;;;;;;GAQG;AACH,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,oDAAoD;IACpD,SAAS,EAAE,MAAM,CAAC;IAClB,qDAAqD;IACrD,KAAK,EAAE;QAAE,IAAI,EAAE,IAAI,CAAC;QAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,GAAG,IAAI,CAAC;IACzD,8CAA8C;IAC9C,SAAS,EAAE;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IACtC,0EAA0E;IAC1E,kBAAkB,EAAE,OAAO,CAAC;CAC7B"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
interface Options {
|
|
2
|
+
index: number;
|
|
3
|
+
onReorder: (fromIndex: number, toIndex: number) => void;
|
|
4
|
+
/** False while a chat turn streams — the strip goes inert, like the stage. */
|
|
5
|
+
enabled: boolean;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Drag-to-reorder for one filmstrip thumbnail.
|
|
9
|
+
*
|
|
10
|
+
* A sibling of `useSortableRow` rather than an option on it: the filmstrip is
|
|
11
|
+
* HORIZONTAL, so it reads left/right edges where every existing consumer reads
|
|
12
|
+
* top/bottom, and widening that hook's `closestEdge` type would change the two
|
|
13
|
+
* shipped editor modals that render `DropEdgeIndicator` from it. The Deck
|
|
14
|
+
* Builder is a sealed subtree; a second small hook here costs less than a type
|
|
15
|
+
* change under two surfaces this ticket is not touching.
|
|
16
|
+
*
|
|
17
|
+
* The pointer-math is NOT duplicated: `computeReorderTarget` is written in
|
|
18
|
+
* before/after terms, so left maps to "top" and right to "bottom" and the
|
|
19
|
+
* unit-tested decrement stays the one implementation. The whole atlaskit
|
|
20
|
+
* adapter is imported lazily, as it is everywhere else — jsdom cannot run it,
|
|
21
|
+
* which is why `moveDeckSlide` and the move affordances carry the coverage.
|
|
22
|
+
*/
|
|
23
|
+
export declare function useSortableSlide<E extends HTMLElement>({ index, onReorder, enabled }: Options): {
|
|
24
|
+
ref: import("react").RefObject<E | null>;
|
|
25
|
+
isDragging: boolean;
|
|
26
|
+
closestEdge: "right" | "left" | null;
|
|
27
|
+
};
|
|
28
|
+
export {};
|
|
29
|
+
//# sourceMappingURL=useSortableSlide.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSortableSlide.d.ts","sourceRoot":"","sources":["../../src/deck-builder/useSortableSlide.ts"],"names":[],"mappings":"AAGA,UAAU,OAAO;IACf,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACxD,8EAA8E;IAC9E,OAAO,EAAE,OAAO,CAAC;CAClB;AAID;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,SAAS,WAAW,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,EAAE,OAAO;;;;EAyE7F"}
|
package/dist/index.js
CHANGED
|
@@ -57,45 +57,7 @@ import {
|
|
|
57
57
|
resolveMedia,
|
|
58
58
|
sanitizeMediaName,
|
|
59
59
|
setMediaProvider
|
|
60
|
-
} from "./chunk-
|
|
61
|
-
import {
|
|
62
|
-
MediaGridOptionsSchema
|
|
63
|
-
} from "./chunk-B7VBSE5X.js";
|
|
64
|
-
import {
|
|
65
|
-
AudienceSchema,
|
|
66
|
-
RoleSchema,
|
|
67
|
-
SessionSchema,
|
|
68
|
-
SiteUserSchema
|
|
69
|
-
} from "./chunk-6P4CJCXB.js";
|
|
70
|
-
import {
|
|
71
|
-
AudienceColorSchema,
|
|
72
|
-
AudienceNameSchema,
|
|
73
|
-
NormalizedUsernameSchema,
|
|
74
|
-
VIEWER_PASSWORD_MIN_LENGTH,
|
|
75
|
-
ViewerCredentialSchema,
|
|
76
|
-
ViewerPasswordSchema,
|
|
77
|
-
ViewerUsernameSchema,
|
|
78
|
-
normalizeUsername,
|
|
79
|
-
slugifyAudienceName
|
|
80
|
-
} from "./chunk-HBULBDGP.js";
|
|
81
|
-
import {
|
|
82
|
-
DEFAULT_LINK,
|
|
83
|
-
LinkTargetSchema,
|
|
84
|
-
LinkValueSchema,
|
|
85
|
-
isSafeHref
|
|
86
|
-
} from "./chunk-3ZRQ4G5F.js";
|
|
87
|
-
import {
|
|
88
|
-
DOCUMENT_BUCKET_MAX_BYTES,
|
|
89
|
-
DOCUMENT_GIT_MAX_BYTES,
|
|
90
|
-
DOCUMENT_KIND_TO_MIME,
|
|
91
|
-
DOCUMENT_MANIFEST_PATH,
|
|
92
|
-
DOCUMENT_MIME_TO_EXT,
|
|
93
|
-
DocumentManifestEntrySchema,
|
|
94
|
-
DocumentManifestSchema,
|
|
95
|
-
documentBucketPath,
|
|
96
|
-
documentFileUrl,
|
|
97
|
-
documentGitPath
|
|
98
|
-
} from "./chunk-BS5AQHZG.js";
|
|
60
|
+
} from "./chunk-FRE2CCLV.js";
|
|
99
61
|
import {
|
|
100
62
|
DEFAULT_CHATBOT_NAME,
|
|
101
63
|
accentVarValue,
|
|
@@ -103,7 +65,6 @@ import {
|
|
|
103
65
|
contrastColor,
|
|
104
66
|
contrastRatio,
|
|
105
67
|
deriveContrast,
|
|
106
|
-
formatTimestamp,
|
|
107
68
|
gridColsClass,
|
|
108
69
|
loadSiteContent,
|
|
109
70
|
loadStaticSiteContent,
|
|
@@ -116,8 +77,11 @@ import {
|
|
|
116
77
|
safeRedirect,
|
|
117
78
|
suggestAccessibleOn,
|
|
118
79
|
wcagLevel
|
|
119
|
-
} from "./chunk-
|
|
80
|
+
} from "./chunk-VWWY5TL5.js";
|
|
120
81
|
import "./chunk-FRVO75DK.js";
|
|
82
|
+
import {
|
|
83
|
+
formatTimestamp
|
|
84
|
+
} from "./chunk-MM7KZS5C.js";
|
|
121
85
|
import {
|
|
122
86
|
curatedIcons,
|
|
123
87
|
getIcon
|
|
@@ -129,14 +93,25 @@ import {
|
|
|
129
93
|
navChangeEvent
|
|
130
94
|
} from "./chunk-4RNF2DRG.js";
|
|
131
95
|
import {
|
|
132
|
-
ensureSanitizer,
|
|
133
96
|
generateNavLinks,
|
|
134
|
-
sanitizeHtml,
|
|
135
97
|
toSectionId
|
|
136
|
-
} from "./chunk-
|
|
98
|
+
} from "./chunk-DNY72JZN.js";
|
|
99
|
+
import "./chunk-CXZ5YJG4.js";
|
|
100
|
+
import {
|
|
101
|
+
ensureSanitizer,
|
|
102
|
+
sanitizeHtml
|
|
103
|
+
} from "./chunk-QQ3S3P5P.js";
|
|
137
104
|
import {
|
|
138
105
|
cn
|
|
139
106
|
} from "./chunk-7EOSDFS3.js";
|
|
107
|
+
import {
|
|
108
|
+
audiencePasses,
|
|
109
|
+
groupDisplayLabel,
|
|
110
|
+
groupOfPage,
|
|
111
|
+
navEntries,
|
|
112
|
+
pagesInNavOrder,
|
|
113
|
+
reconcileNav
|
|
114
|
+
} from "./chunk-NHN2LSIU.js";
|
|
140
115
|
import {
|
|
141
116
|
isSameOriginRequest,
|
|
142
117
|
requireSessionSecret,
|
|
@@ -146,13 +121,8 @@ import {
|
|
|
146
121
|
env
|
|
147
122
|
} from "./chunk-WKZ7OENC.js";
|
|
148
123
|
import {
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
groupOfPage,
|
|
152
|
-
navEntries,
|
|
153
|
-
pagesInNavOrder,
|
|
154
|
-
reconcileNav
|
|
155
|
-
} from "./chunk-OTDA6KWL.js";
|
|
124
|
+
MediaGridOptionsSchema
|
|
125
|
+
} from "./chunk-B7VBSE5X.js";
|
|
156
126
|
import {
|
|
157
127
|
NavEntrySchema,
|
|
158
128
|
NavFileSchema
|
|
@@ -162,20 +132,10 @@ import {
|
|
|
162
132
|
getSectionSchema,
|
|
163
133
|
getSectionSchemaForType
|
|
164
134
|
} from "./chunk-DMCGN5AS.js";
|
|
165
|
-
import {
|
|
166
|
-
clearRegistry,
|
|
167
|
-
createRegistry,
|
|
168
|
-
defineSection,
|
|
169
|
-
getAllSchemas,
|
|
170
|
-
getAllSections,
|
|
171
|
-
getSchema,
|
|
172
|
-
getSection,
|
|
173
|
-
registerSchema,
|
|
174
|
-
registerSection
|
|
175
|
-
} from "./chunk-FTPETWXE.js";
|
|
176
135
|
import {
|
|
177
136
|
ChatbotConfigSchema,
|
|
178
137
|
ChatbotTaskSchema,
|
|
138
|
+
DeckBuilderConfigSchema,
|
|
179
139
|
ImageManifestSchema,
|
|
180
140
|
IndexSchema,
|
|
181
141
|
MediaConfigSchema,
|
|
@@ -190,8 +150,36 @@ import {
|
|
|
190
150
|
StatusSchema,
|
|
191
151
|
VariantSchema,
|
|
192
152
|
normalizeSiteIndex
|
|
193
|
-
} from "./chunk-
|
|
153
|
+
} from "./chunk-AHALSCQH.js";
|
|
194
154
|
import "./chunk-4TZJZU2T.js";
|
|
155
|
+
import {
|
|
156
|
+
clearRegistry,
|
|
157
|
+
createRegistry,
|
|
158
|
+
defineSection,
|
|
159
|
+
getAllSchemas,
|
|
160
|
+
getAllSections,
|
|
161
|
+
getSchema,
|
|
162
|
+
getSection,
|
|
163
|
+
registerSchema,
|
|
164
|
+
registerSection
|
|
165
|
+
} from "./chunk-FTPETWXE.js";
|
|
166
|
+
import {
|
|
167
|
+
AudienceSchema,
|
|
168
|
+
RoleSchema,
|
|
169
|
+
SessionSchema,
|
|
170
|
+
SiteUserSchema
|
|
171
|
+
} from "./chunk-6P4CJCXB.js";
|
|
172
|
+
import {
|
|
173
|
+
AudienceColorSchema,
|
|
174
|
+
AudienceNameSchema,
|
|
175
|
+
NormalizedUsernameSchema,
|
|
176
|
+
VIEWER_PASSWORD_MIN_LENGTH,
|
|
177
|
+
ViewerCredentialSchema,
|
|
178
|
+
ViewerPasswordSchema,
|
|
179
|
+
ViewerUsernameSchema,
|
|
180
|
+
normalizeUsername,
|
|
181
|
+
slugifyAudienceName
|
|
182
|
+
} from "./chunk-HBULBDGP.js";
|
|
195
183
|
import {
|
|
196
184
|
FontNameSchema,
|
|
197
185
|
HexColorSchema,
|
|
@@ -200,6 +188,24 @@ import {
|
|
|
200
188
|
TextLineSchema
|
|
201
189
|
} from "./chunk-GGXZZ77Z.js";
|
|
202
190
|
import "./chunk-NSCT3AMV.js";
|
|
191
|
+
import {
|
|
192
|
+
DEFAULT_LINK,
|
|
193
|
+
LinkTargetSchema,
|
|
194
|
+
LinkValueSchema,
|
|
195
|
+
isSafeHref
|
|
196
|
+
} from "./chunk-3ZRQ4G5F.js";
|
|
197
|
+
import {
|
|
198
|
+
DOCUMENT_BUCKET_MAX_BYTES,
|
|
199
|
+
DOCUMENT_GIT_MAX_BYTES,
|
|
200
|
+
DOCUMENT_KIND_TO_MIME,
|
|
201
|
+
DOCUMENT_MANIFEST_PATH,
|
|
202
|
+
DOCUMENT_MIME_TO_EXT,
|
|
203
|
+
DocumentManifestEntrySchema,
|
|
204
|
+
DocumentManifestSchema,
|
|
205
|
+
documentBucketPath,
|
|
206
|
+
documentFileUrl,
|
|
207
|
+
documentGitPath
|
|
208
|
+
} from "./chunk-BS5AQHZG.js";
|
|
203
209
|
import "./chunk-JSBRDJBE.js";
|
|
204
210
|
export {
|
|
205
211
|
ASSET_CACHE_CONTROL,
|
|
@@ -220,6 +226,7 @@ export {
|
|
|
220
226
|
DOCUMENT_KIND_TO_MIME,
|
|
221
227
|
DOCUMENT_MANIFEST_PATH,
|
|
222
228
|
DOCUMENT_MIME_TO_EXT,
|
|
229
|
+
DeckBuilderConfigSchema,
|
|
223
230
|
DocumentManifestEntrySchema,
|
|
224
231
|
DocumentManifestSchema,
|
|
225
232
|
EXT_TO_MIME,
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import type { DeckOwner } from "../schemas/deck-meta";
|
|
2
|
+
/**
|
|
3
|
+
* Who is asking. Built from the request's identity — a signed audience cookie
|
|
4
|
+
* (with the credential username when the site has named credentials) or an
|
|
5
|
+
* editor session — and deliberately NOT an Astro `locals`: the decision below
|
|
6
|
+
* is pure, so it is testable the way `audiencePasses` is.
|
|
7
|
+
*
|
|
8
|
+
* `audience` (no username) is the env-mode standalone case: a shared password
|
|
9
|
+
* per audience means there is no person to attribute to (ADR 0002).
|
|
10
|
+
*/
|
|
11
|
+
export type DeckIdentity = {
|
|
12
|
+
kind: "viewer";
|
|
13
|
+
username: string;
|
|
14
|
+
audience: string;
|
|
15
|
+
} | {
|
|
16
|
+
kind: "editor";
|
|
17
|
+
userId: string;
|
|
18
|
+
} | {
|
|
19
|
+
kind: "audience";
|
|
20
|
+
audience: string;
|
|
21
|
+
};
|
|
22
|
+
/** The owner to record on a deck this identity is creating. */
|
|
23
|
+
export declare function deckOwnerFor(identity: DeckIdentity): DeckOwner;
|
|
24
|
+
/**
|
|
25
|
+
* Ownership. Credential-keyed for viewers (the username is the person-level
|
|
26
|
+
* key — an audience change must not hand a deck to someone else, and must not
|
|
27
|
+
* take it away from its author), user-id-keyed for editors, and audience-keyed
|
|
28
|
+
* for the env-mode fallback.
|
|
29
|
+
*
|
|
30
|
+
* An audience-owned deck is owned by everyone in that audience, which is
|
|
31
|
+
* exactly the attribution loss ADR 0002 accepts for env-mode portals. The
|
|
32
|
+
* reverse does not hold: an identity with no username cannot claim a
|
|
33
|
+
* credential-owned deck.
|
|
34
|
+
*/
|
|
35
|
+
export declare function isDeckOwner(owner: DeckOwner, identity: DeckIdentity): boolean;
|
|
36
|
+
/**
|
|
37
|
+
* May this identity see and change this deck? Owner, or any editor — editors
|
|
38
|
+
* are super-admins over every deck on the site regardless of audience config
|
|
39
|
+
* (feasibility decision 9).
|
|
40
|
+
*
|
|
41
|
+
* One function for read and for write because today they are the same rule:
|
|
42
|
+
* a deck is private to its owner (Deck Visibility). Audience grants and Public
|
|
43
|
+
* Links (#36/#37) widen READ only, and that is when the two split.
|
|
44
|
+
*/
|
|
45
|
+
export declare function canAccessDeck(owner: DeckOwner, identity: DeckIdentity): boolean;
|
|
46
|
+
/**
|
|
47
|
+
* May this identity CREATE a deck? Editors always (super-admins); everyone else
|
|
48
|
+
* only from a deck-enabled audience — `deckBuilder.audiences`, strict opt-in
|
|
49
|
+
* exactly like `chatbot.audiences`, so an empty list means no viewer may.
|
|
50
|
+
*
|
|
51
|
+
* Creation rights are AUDIENCE-keyed while ownership of the result is
|
|
52
|
+
* CREDENTIAL-keyed (`deckOwnerFor`); the two deliberately do not share a key.
|
|
53
|
+
* An `audience` identity (env-mode standalone, shared password, no named
|
|
54
|
+
* credential) passes when its audience is listed: that is a deliberate opt-in
|
|
55
|
+
* by the editor, and the resulting deck is audience-owned — the attribution
|
|
56
|
+
* loss ADR 0002 accepts, not an accident. What the list prevents is the DEFAULT
|
|
57
|
+
* audience being enabled implicitly, i.e. anyone holding the site password
|
|
58
|
+
* writing to the client's repo.
|
|
59
|
+
*/
|
|
60
|
+
export declare function canCreateDeck(identity: DeckIdentity, deckAudiences: readonly string[]): boolean;
|
|
61
|
+
/**
|
|
62
|
+
* The Deck Draft partition key for an identity.
|
|
63
|
+
*
|
|
64
|
+
* A Deck Draft lives in one browser until it is published (ADR 0002), and a
|
|
65
|
+
* browser PROFILE is shared between people far more often than an account is.
|
|
66
|
+
* Keyed by site alone, two viewers signing into the same portal on one machine
|
|
67
|
+
* saw each other's unpublished drafts in the grid, could open and read them,
|
|
68
|
+
* and could publish another person's never-published draft under their own
|
|
69
|
+
* ownership; a signed-out user's drafts simply waited for whoever came next.
|
|
70
|
+
*
|
|
71
|
+
* The partition mirrors `deckOwnerFor` exactly, so a draft can only ever be
|
|
72
|
+
* published under the identity that staged it.
|
|
73
|
+
*
|
|
74
|
+
* DIGESTED, not spelled out, because the value becomes an IndexedDB database
|
|
75
|
+
* NAME and any script on the origin can enumerate those — a raw username there
|
|
76
|
+
* would disclose who last used the browser. This is NOT a security boundary:
|
|
77
|
+
* IndexedDB is per-origin and isolates nothing between people sharing a
|
|
78
|
+
* profile. It bounds accidents, not somebody with the keyboard.
|
|
79
|
+
*
|
|
80
|
+
* Switching identity leaves the previous identity's database in place,
|
|
81
|
+
* untouched and unread. That is deliberate — the alternative is destroying a
|
|
82
|
+
* colleague's unpublished work on sign-in — so orphaned drafts persist until
|
|
83
|
+
* the browser's own storage eviction takes them.
|
|
84
|
+
*/
|
|
85
|
+
export declare function deckDraftScope(identity: DeckIdentity): string;
|
|
86
|
+
//# sourceMappingURL=deck-access.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deck-access.d.ts","sourceRoot":"","sources":["../../src/lib/deck-access.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEtD;;;;;;;;GAQG;AACH,MAAM,MAAM,YAAY,GACpB;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,GACtD;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAClC;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC;AAE3C,+DAA+D;AAC/D,wBAAgB,YAAY,CAAC,QAAQ,EAAE,YAAY,GAAG,SAAS,CAS9D;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,YAAY,GAAG,OAAO,CAS7E;AAED;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,YAAY,GAAG,OAAO,CAE/E;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,YAAY,EAAE,aAAa,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAG/F;AAgBD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,YAAY,GAAG,MAAM,CAW7D"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import "../chunk-JSBRDJBE.js";
|
|
2
|
+
|
|
3
|
+
// src/lib/deck-access.ts
|
|
4
|
+
function deckOwnerFor(identity) {
|
|
5
|
+
switch (identity.kind) {
|
|
6
|
+
case "viewer":
|
|
7
|
+
return { kind: "viewer", username: identity.username, audience: identity.audience };
|
|
8
|
+
case "editor":
|
|
9
|
+
return { kind: "editor", userId: identity.userId };
|
|
10
|
+
case "audience":
|
|
11
|
+
return { kind: "audience", audience: identity.audience };
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
function isDeckOwner(owner, identity) {
|
|
15
|
+
switch (owner.kind) {
|
|
16
|
+
case "viewer":
|
|
17
|
+
return identity.kind === "viewer" && identity.username === owner.username;
|
|
18
|
+
case "editor":
|
|
19
|
+
return identity.kind === "editor" && identity.userId === owner.userId;
|
|
20
|
+
case "audience":
|
|
21
|
+
return (identity.kind === "viewer" || identity.kind === "audience") && identity.audience === owner.audience;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
function canAccessDeck(owner, identity) {
|
|
25
|
+
return identity.kind === "editor" || isDeckOwner(owner, identity);
|
|
26
|
+
}
|
|
27
|
+
function canCreateDeck(identity, deckAudiences) {
|
|
28
|
+
if (identity.kind === "editor") return true;
|
|
29
|
+
return deckAudiences.includes(identity.audience);
|
|
30
|
+
}
|
|
31
|
+
function digest(input) {
|
|
32
|
+
const half = (offset) => {
|
|
33
|
+
let hash = offset;
|
|
34
|
+
for (let i = 0; i < input.length; i++) {
|
|
35
|
+
hash ^= input.charCodeAt(i);
|
|
36
|
+
hash = Math.imul(hash, 16777619) >>> 0;
|
|
37
|
+
}
|
|
38
|
+
return hash.toString(16).padStart(8, "0");
|
|
39
|
+
};
|
|
40
|
+
return half(2166136261) + half(2147483647);
|
|
41
|
+
}
|
|
42
|
+
function deckDraftScope(identity) {
|
|
43
|
+
switch (identity.kind) {
|
|
44
|
+
case "viewer":
|
|
45
|
+
return digest(`viewer:${identity.username}@${identity.audience}`);
|
|
46
|
+
case "editor":
|
|
47
|
+
return digest(`editor:${identity.userId}`);
|
|
48
|
+
case "audience":
|
|
49
|
+
return digest(`audience:${identity.audience}`);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
export {
|
|
53
|
+
canAccessDeck,
|
|
54
|
+
canCreateDeck,
|
|
55
|
+
deckDraftScope,
|
|
56
|
+
deckOwnerFor,
|
|
57
|
+
isDeckOwner
|
|
58
|
+
};
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { type Deck } from "../schemas/deck";
|
|
2
|
+
/**
|
|
3
|
+
* Deck Draft staging — the deck builder's half of the editor's unsaved-state
|
|
4
|
+
* model (`./dexie.ts`), and the reason the authoring loop performs no server
|
|
5
|
+
* writes at all (ADR 0002). A draft lives in this browser only until an
|
|
6
|
+
* explicit publish; nothing here ever talks to the network.
|
|
7
|
+
*
|
|
8
|
+
* A SEPARATE database from the editor's `brand-portal-{siteId}`, not a table on
|
|
9
|
+
* it. The builder is a VIEWER surface: opening the editor's connection from it
|
|
10
|
+
* would run the editor's upgrade chain (11 versions, several of which clear
|
|
11
|
+
* caches) in a viewer's browser, and would hold a connection open that blocks
|
|
12
|
+
* the editor's next schema bump. Nothing here needs the editor's rows.
|
|
13
|
+
*
|
|
14
|
+
* Keyed by site AND by identity scope (`deckDraftScope`). One browser profile
|
|
15
|
+
* routinely serves several people, and drafts are unpublished work — see that
|
|
16
|
+
* function for what the scope is, why it is a digest, and what happens to the
|
|
17
|
+
* databases an identity leaves behind.
|
|
18
|
+
*/
|
|
19
|
+
export interface DeckDraftRow {
|
|
20
|
+
/** Deck id — also the directory name on the decks branch. */
|
|
21
|
+
deckId: string;
|
|
22
|
+
deck: Deck;
|
|
23
|
+
/**
|
|
24
|
+
* The published version this draft was based on, and the `baseVersion` the
|
|
25
|
+
* next publish sends. `null` means the deck has never been published, which
|
|
26
|
+
* is exactly what POST /api/decks wants to be told to create it.
|
|
27
|
+
*/
|
|
28
|
+
baseVersion: string | null;
|
|
29
|
+
/**
|
|
30
|
+
* The published deck's serialized bytes AT `baseVersion`, or null when it has
|
|
31
|
+
* never been published. Stored rather than a dirty flag because the flag has
|
|
32
|
+
* to survive a reload, and re-deriving it would mean a server read — which is
|
|
33
|
+
* the one thing a draft must not need. Comparing bytes also makes an
|
|
34
|
+
* edit-then-undo correctly report "no unpublished changes".
|
|
35
|
+
*/
|
|
36
|
+
publishedText: string | null;
|
|
37
|
+
updatedAt: string;
|
|
38
|
+
}
|
|
39
|
+
export declare function initDeckDraftStore(siteId: string, scope: string): void;
|
|
40
|
+
/** Every staged draft, newest first. Drives the builder's deck grid. */
|
|
41
|
+
export declare function listDeckDrafts(): Promise<DeckDraftRow[]>;
|
|
42
|
+
export declare function getDeckDraft(deckId: string): Promise<DeckDraftRow | null>;
|
|
43
|
+
/**
|
|
44
|
+
* Stage a deck edit. `baseVersion`/`publishedText` are carried forward from the
|
|
45
|
+
* existing row rather than taken as arguments: an edit never changes what the
|
|
46
|
+
* server holds, and letting a caller pass them is how a draft would come to
|
|
47
|
+
* claim it was published when it was not.
|
|
48
|
+
*/
|
|
49
|
+
export declare function putDeckDraft(deck: Deck): Promise<DeckDraftRow>;
|
|
50
|
+
/**
|
|
51
|
+
* Record what the server now holds — after a publish, or after loading a
|
|
52
|
+
* published deck into the draft. The deck body is restated from `deck` so the
|
|
53
|
+
* row and its published baseline can never disagree.
|
|
54
|
+
*
|
|
55
|
+
* `updatedAt` is an argument because the two callers mean different things by
|
|
56
|
+
* it. A publish genuinely changed the deck, so "now" is right. Merely OPENING a
|
|
57
|
+
* published deck changes nothing, and stamping "now" there sorted it to the top
|
|
58
|
+
* of the grid — reading a deck must not reorder the library — so that caller
|
|
59
|
+
* passes the sidecar's own timestamp.
|
|
60
|
+
*/
|
|
61
|
+
export declare function markDeckDraftPublished(deck: Deck, version: string, updatedAt?: string): Promise<DeckDraftRow>;
|
|
62
|
+
/**
|
|
63
|
+
* Record a successful publish WITHOUT touching the working deck (#39).
|
|
64
|
+
*
|
|
65
|
+
* The difference from `markDeckDraftPublished` is the whole point: that
|
|
66
|
+
* function restates the body from its argument, which is a pre-request snapshot
|
|
67
|
+
* at the publish call site, so an edit landing during the round-trip was
|
|
68
|
+
* silently discarded. #35 could answer that with a lock because its only other
|
|
69
|
+
* writer was a chat turn; inline editing cannot — locking a text field the
|
|
70
|
+
* author is mid-word in is worse than the race it prevents.
|
|
71
|
+
*
|
|
72
|
+
* So this re-reads the row and writes back only the publish BASELINE: what the
|
|
73
|
+
* server now holds (`baseVersion`) and the bytes it holds (`publishedText`,
|
|
74
|
+
* serialized from the deck that was actually sent). `deck` stays whatever is
|
|
75
|
+
* current by now, which makes `hasUnpublishedChanges` correctly report the
|
|
76
|
+
* mid-flight edit as unpublished rather than losing it.
|
|
77
|
+
*
|
|
78
|
+
* Returns null when the row is gone (deleted during the round-trip) — recreating
|
|
79
|
+
* it would resurrect a deck the author just removed.
|
|
80
|
+
*/
|
|
81
|
+
export declare function recordDeckPublish(deckId: string, publishedDeck: Deck, version: string): Promise<DeckDraftRow | null>;
|
|
82
|
+
export declare function deleteDeckDraft(deckId: string): Promise<void>;
|
|
83
|
+
/**
|
|
84
|
+
* Does this row differ from what was published? A never-published draft always
|
|
85
|
+
* has changes — there is nothing on the server to match.
|
|
86
|
+
*/
|
|
87
|
+
export declare function hasUnpublishedChanges(row: DeckDraftRow): boolean;
|
|
88
|
+
//# sourceMappingURL=deck-dexie.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deck-dexie.d.ts","sourceRoot":"","sources":["../../src/lib/deck-dexie.ts"],"names":[],"mappings":"AACA,OAAO,EAAiB,KAAK,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAE3D;;;;;;;;;;;;;;;;GAgBG;AAEH,MAAM,WAAW,YAAY;IAC3B,6DAA6D;IAC7D,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,IAAI,CAAC;IACX;;;;OAIG;IACH,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B;;;;;;OAMG;IACH,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,SAAS,EAAE,MAAM,CAAC;CACnB;AAkBD,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAUtE;AAOD,wEAAwE;AACxE,wBAAsB,cAAc,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC,CAG9D;AAED,wBAAsB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC,CAE/E;AAED;;;;;GAKG;AACH,wBAAsB,YAAY,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,YAAY,CAAC,CAoBpE;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,sBAAsB,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC,CAUnH;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAsB,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC,CAsB1H;AAED,wBAAsB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAEnE;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,YAAY,GAAG,OAAO,CAEhE"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import {
|
|
2
|
+
deleteDeckDraft,
|
|
3
|
+
getDeckDraft,
|
|
4
|
+
hasUnpublishedChanges,
|
|
5
|
+
initDeckDraftStore,
|
|
6
|
+
listDeckDrafts,
|
|
7
|
+
markDeckDraftPublished,
|
|
8
|
+
putDeckDraft,
|
|
9
|
+
recordDeckPublish
|
|
10
|
+
} from "../chunk-FV7JQRCN.js";
|
|
11
|
+
import "../chunk-VAYZJKVR.js";
|
|
12
|
+
import "../chunk-JSBRDJBE.js";
|
|
13
|
+
export {
|
|
14
|
+
deleteDeckDraft,
|
|
15
|
+
getDeckDraft,
|
|
16
|
+
hasUnpublishedChanges,
|
|
17
|
+
initDeckDraftStore,
|
|
18
|
+
listDeckDrafts,
|
|
19
|
+
markDeckDraftPublished,
|
|
20
|
+
putDeckDraft,
|
|
21
|
+
recordDeckPublish
|
|
22
|
+
};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { type Deck, type DeckRichText, type DeckSlide } from "../schemas/deck";
|
|
2
|
+
/**
|
|
3
|
+
* Direct-manipulation edits to a Deck Draft (#39).
|
|
4
|
+
*
|
|
5
|
+
* Every operation here is PURE and ends in `parseDeck`, which is what makes
|
|
6
|
+
* "a manual edit is always schema-valid" a property of this module rather than
|
|
7
|
+
* of its callers. It also means the schema owns the refusals: duplicating past
|
|
8
|
+
* `DECK_MAX_SLIDES` and deleting the last slide are reported with the same
|
|
9
|
+
* messages the authoring loop's validation retry reads, not with a second copy
|
|
10
|
+
* of those rules written here.
|
|
11
|
+
*
|
|
12
|
+
* The scope line is the product decision recorded in CONTEXT.md — "chat
|
|
13
|
+
* authors, direct manipulation adjusts". There is deliberately no operation
|
|
14
|
+
* here that changes a Layout, adds or removes a Deck Component, or composes a
|
|
15
|
+
* grid. Text leaves and slide order are the whole vocabulary.
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* Which Deck Component within a slide's Layout. A slide-local coordinate: the
|
|
19
|
+
* runtime renders one slide and has no idea which one, so the slide index stays
|
|
20
|
+
* an argument at the call site.
|
|
21
|
+
*/
|
|
22
|
+
declare const DECK_TEXT_SLOTS: readonly ["content", "overlay", "left", "right"];
|
|
23
|
+
export type DeckTextSlot = (typeof DECK_TEXT_SLOTS)[number];
|
|
24
|
+
declare const DECK_TEXT_FIELDS: readonly ["kicker", "heading", "subheading", "paragraphs", "bullets"];
|
|
25
|
+
export type DeckTextField = (typeof DECK_TEXT_FIELDS)[number];
|
|
26
|
+
/**
|
|
27
|
+
* A single editable text LEAF — always a plain string in the schema.
|
|
28
|
+
*
|
|
29
|
+
* That "always a leaf" framing is what keeps inline editing free of a
|
|
30
|
+
* formatting UI without ever destroying a mark: a paragraph carrying spans is
|
|
31
|
+
* edited one span at a time (`span`), so `bold`/`italic` are untouched by an
|
|
32
|
+
* edit that only ever writes `text`. A plain-string line has no `span`.
|
|
33
|
+
*/
|
|
34
|
+
export interface DeckTextPath {
|
|
35
|
+
slot: DeckTextSlot;
|
|
36
|
+
field: DeckTextField;
|
|
37
|
+
/** Index into `paragraphs`/`bullets`. Absent for the three single-line fields. */
|
|
38
|
+
line?: number;
|
|
39
|
+
/** Index into that line's spans, when the line is a span run rather than a string. */
|
|
40
|
+
span?: number;
|
|
41
|
+
}
|
|
42
|
+
export type DeckEditResult = {
|
|
43
|
+
ok: true;
|
|
44
|
+
deck: Deck;
|
|
45
|
+
} | {
|
|
46
|
+
ok: false;
|
|
47
|
+
errors: string[];
|
|
48
|
+
};
|
|
49
|
+
/** The rich text a slot holds, or null when that slot holds something else. */
|
|
50
|
+
export declare function richTextAt(slide: DeckSlide, slot: DeckTextSlot): DeckRichText | null;
|
|
51
|
+
/**
|
|
52
|
+
* Commit an inline text edit.
|
|
53
|
+
*
|
|
54
|
+
* Rejecting (rather than clamping) an over-long or emptied field is deliberate:
|
|
55
|
+
* the caps are the schema's, and a silent truncation is an edit the author did
|
|
56
|
+
* not make. The caller shows the schema's own message and leaves the draft
|
|
57
|
+
* untouched.
|
|
58
|
+
*/
|
|
59
|
+
export declare function applyDeckTextEdit(deck: Deck, slideIndex: number, path: DeckTextPath, text: string): DeckEditResult;
|
|
60
|
+
/** Move a slide to a new index. `to` is the destination in the POST-removal list. */
|
|
61
|
+
export declare function moveDeckSlide(deck: Deck, from: number, to: number): DeckEditResult;
|
|
62
|
+
/** Duplicate a slide, inserting the copy directly after the original. */
|
|
63
|
+
export declare function duplicateDeckSlide(deck: Deck, index: number): DeckEditResult;
|
|
64
|
+
/** Remove a slide. Removing the only one is refused by the schema, by design. */
|
|
65
|
+
export declare function removeDeckSlide(deck: Deck, index: number): DeckEditResult;
|
|
66
|
+
export {};
|
|
67
|
+
//# sourceMappingURL=deck-edit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deck-edit.d.ts","sourceRoot":"","sources":["../../src/lib/deck-edit.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,IAAI,EAET,KAAK,YAAY,EACjB,KAAK,SAAS,EACf,MAAM,iBAAiB,CAAC;AAEzB;;;;;;;;;;;;;;GAcG;AAEH;;;;GAIG;AAOH,QAAA,MAAM,eAAe,kDAAmD,CAAC;AACzE,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,CAAC,CAAC;AAE5D,QAAA,MAAM,gBAAgB,uEAAwE,CAAC;AAC/F,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE9D;;;;;;;GAOG;AACH,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,YAAY,CAAC;IACnB,KAAK,EAAE,aAAa,CAAC;IACrB,kFAAkF;IAClF,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,sFAAsF;IACtF,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,MAAM,cAAc,GAAG;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,IAAI,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC;AAUxF,+EAA+E;AAC/E,wBAAgB,UAAU,CAAC,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,YAAY,GAAG,YAAY,GAAG,IAAI,CAWpF;AA+CD;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,GAAG,cAAc,CAgBlH;AAED,qFAAqF;AACrF,wBAAgB,aAAa,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,cAAc,CAOlF;AAgBD,yEAAyE;AACzE,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,GAAG,cAAc,CAU5E;AAED,iFAAiF;AACjF,wBAAgB,eAAe,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,GAAG,cAAc,CAIzE"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { DeckMediaAsset } from "../schemas/deck";
|
|
2
|
+
import type { MediaManifest } from "../media/types";
|
|
3
|
+
import type { MediaProvider } from "../media/provider";
|
|
4
|
+
/**
|
|
5
|
+
* The production side of the deck runtime's media seam: the site's image
|
|
6
|
+
* manifest, resolved to the `mediaAssets` map `DeckPlayer` takes.
|
|
7
|
+
*
|
|
8
|
+
* A MAP, not a `DeckMediaResolver` function, because the builder mounts across
|
|
9
|
+
* an Astro island boundary and a function prop cannot survive that trip. It is
|
|
10
|
+
* built server-side, where the manifest and the media provider live.
|
|
11
|
+
*
|
|
12
|
+
* This replaces the dev preview route's generated plates
|
|
13
|
+
* (`core/src/lib/dev-deck-preview.ts`), which stay exactly where they are —
|
|
14
|
+
* they keep that route working offline and with no GitHub credentials.
|
|
15
|
+
*/
|
|
16
|
+
export declare function deckMediaAssets(manifest: MediaManifest, sizes: number[], provider: MediaProvider,
|
|
17
|
+
/**
|
|
18
|
+
* The audience boundary, when the caller has one. Only these ids resolve.
|
|
19
|
+
*
|
|
20
|
+
* The builder's map must match the catalog the model is offered (#35, decided
|
|
21
|
+
* 2026-08-07) or the two disagree about what exists — and because this map
|
|
22
|
+
* travels as ISLAND PROPS, an unfiltered one also puts every asset's filename
|
|
23
|
+
* and alt text in the page source of a creator who cannot see those pages.
|
|
24
|
+
* Omitted means no filtering, which is what the dev preview route wants.
|
|
25
|
+
*/
|
|
26
|
+
allowIds?: ReadonlySet<string>): Record<string, DeckMediaAsset>;
|
|
27
|
+
//# sourceMappingURL=deck-media-assets.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deck-media-assets.d.ts","sourceRoot":"","sources":["../../src/lib/deck-media-assets.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAEvD;;;;;;;;;;;GAWG;AACH,wBAAgB,eAAe,CAC7B,QAAQ,EAAE,aAAa,EACvB,KAAK,EAAE,MAAM,EAAE,EACf,QAAQ,EAAE,aAAa;AACvB;;;;;;;;GAQG;AACH,QAAQ,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,GAC7B,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CA0BhC"}
|