@drawnagency/primitives 0.1.105 → 0.1.107
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/cookies.d.ts +21 -1
- package/dist/auth/cookies.d.ts.map +1 -1
- package/dist/auth/index.d.ts +2 -1
- package/dist/auth/index.d.ts.map +1 -1
- package/dist/auth/index.js +3 -1
- package/dist/auth/types.d.ts +28 -0
- package/dist/auth/types.d.ts.map +1 -1
- package/dist/{chunk-PTOLUMGV.js → chunk-4RNF2DRG.js} +1 -0
- package/dist/{chunk-MUTHF2GT.js → chunk-5IZ2KTMU.js} +2 -2
- package/dist/{chunk-LZKVV4K2.js → chunk-6P4CJCXB.js} +7 -1
- package/dist/{chunk-CZLYECHC.js → chunk-AB3XVXI3.js} +4 -4
- package/dist/chunk-B7VBSE5X.js +12 -0
- package/dist/{chunk-BGHWUJFV.js → chunk-BOZUEKWL.js} +107 -171
- package/dist/{chunk-TGNS7D4F.js → chunk-CPTFFLK2.js} +1 -1
- package/dist/{chunk-26ALJO4K.js → chunk-D6TLUVOP.js} +1 -1
- package/dist/{chunk-EM5DFHDZ.js → chunk-GEENI3OC.js} +13 -4
- package/dist/chunk-GGXZZ77Z.js +70 -0
- package/dist/{chunk-X4PRBGB3.js → chunk-IPKZ5FU6.js} +83 -33
- package/dist/{chunk-CXQWLG6X.js → chunk-JIQBLG6Y.js} +23 -20
- package/dist/{chunk-EWNDBKYK.js → chunk-LUAI5DWR.js} +1 -1
- package/dist/chunk-NLQ5F3RQ.js +43 -0
- package/dist/{chunk-3COSXTOY.js → chunk-XBYJQ5RS.js} +1 -1
- package/dist/{chunk-WA6QPDJI.js → chunk-ZHHJVKU7.js} +6 -6
- package/dist/collab/rebase.js +2 -1
- package/dist/components/editor/SectionOrderingModal.d.ts.map +1 -1
- package/dist/components/editor/index.js +8 -7
- package/dist/components/primitives/index.js +7 -6
- package/dist/components/sections/Container/Container.d.ts.map +1 -1
- package/dist/components/sections/brand-guide.js +8 -7
- package/dist/components/sections/register-schemas.js +13 -12
- package/dist/components/sections/register.js +13 -12
- package/dist/components/shared/Navigation.d.ts +16 -1
- package/dist/components/shared/Navigation.d.ts.map +1 -1
- package/dist/components/shared/SectionSummaryRow.d.ts +24 -0
- package/dist/components/shared/SectionSummaryRow.d.ts.map +1 -0
- package/dist/components/shell/AudienceAddForm.d.ts +4 -1
- package/dist/components/shell/AudienceAddForm.d.ts.map +1 -1
- package/dist/components/shell/AudienceDetailsPanel.d.ts +28 -0
- package/dist/components/shell/AudienceDetailsPanel.d.ts.map +1 -0
- package/dist/components/shell/AudienceRow.d.ts +15 -1
- package/dist/components/shell/AudienceRow.d.ts.map +1 -1
- package/dist/components/shell/CredentialList.d.ts +18 -0
- package/dist/components/shell/CredentialList.d.ts.map +1 -0
- package/dist/components/shell/EditorShell.d.ts.map +1 -1
- package/dist/components/shell/MediaLibraryModal.d.ts.map +1 -1
- package/dist/components/shell/SectionTypePicker.d.ts.map +1 -1
- package/dist/components/shell/SiteSettingsViewerAccess.d.ts.map +1 -1
- package/dist/components/shell/ViewerLoginForm.d.ts +5 -1
- package/dist/components/shell/ViewerLoginForm.d.ts.map +1 -1
- package/dist/index.js +47 -29
- package/dist/lib/audience-overview.d.ts +53 -0
- package/dist/lib/audience-overview.d.ts.map +1 -0
- package/dist/lib/audience-secret.d.ts +11 -0
- package/dist/lib/audience-secret.d.ts.map +1 -0
- package/dist/lib/audience-secret.js +70 -0
- package/dist/lib/container-ops.d.ts.map +1 -1
- package/dist/lib/events.d.ts +3 -0
- package/dist/lib/events.d.ts.map +1 -1
- package/dist/lib/index-ops.js +3 -2
- package/dist/lib/index.js +13 -12
- package/dist/lib/insert-menu.d.ts +7 -3
- package/dist/lib/insert-menu.d.ts.map +1 -1
- package/dist/lib/nav.d.ts.map +1 -1
- package/dist/lib/thumb-views.d.ts +17 -0
- package/dist/lib/thumb-views.d.ts.map +1 -0
- package/dist/media/index.js +4 -3
- package/dist/schemas/audience.d.ts +29 -0
- package/dist/schemas/audience.d.ts.map +1 -1
- package/dist/schemas/audience.js +24 -0
- package/dist/schemas/auth.d.ts +1 -0
- package/dist/schemas/auth.d.ts.map +1 -1
- package/dist/schemas/auth.js +1 -1
- package/dist/schemas/index.js +28 -12
- package/dist/schemas/site-config.d.ts +1 -1
- package/dist/schemas/site-config.d.ts.map +1 -1
- package/dist/types/database.d.ts +59 -5
- package/dist/types/database.d.ts.map +1 -1
- package/package.json +9 -1
- package/src/auth/cookies.ts +37 -4
- package/src/auth/index.ts +2 -1
- package/src/auth/types.ts +32 -0
- package/src/components/editor/SectionOrderingModal.tsx +8 -73
- package/src/components/sections/Container/Container.tsx +12 -2
- package/src/components/sections/IconList/IconList.tsx +75 -22
- package/src/components/shared/Navigation.tsx +113 -7
- package/src/components/shared/SectionSummaryRow.tsx +73 -0
- package/src/components/shell/AudienceAddForm.tsx +18 -9
- package/src/components/shell/AudienceDetailsPanel.tsx +263 -0
- package/src/components/shell/AudienceRow.tsx +55 -13
- package/src/components/shell/CredentialList.tsx +285 -0
- package/src/components/shell/EditorShell.tsx +98 -5
- package/src/components/shell/MediaLibraryModal.tsx +42 -5
- package/src/components/shell/SectionTypePicker.tsx +28 -2
- package/src/components/shell/SiteSettingsViewerAccess.tsx +57 -6
- package/src/components/shell/ViewerLoginForm.tsx +35 -15
- package/src/lib/audience-overview.ts +110 -0
- package/src/lib/audience-secret.ts +99 -0
- package/src/lib/container-ops.ts +6 -3
- package/src/lib/events.ts +3 -0
- package/src/lib/insert-menu.ts +38 -4
- package/src/lib/nav.ts +6 -2
- package/src/lib/thumb-views.ts +28 -0
- package/src/schemas/audience.ts +52 -0
- package/src/schemas/auth.ts +6 -0
- package/src/schemas/site-config.ts +1 -1
- package/src/types/database.ts +59 -5
- package/dist/chunk-ZDQ3TT47.js +0 -30
|
@@ -44,19 +44,27 @@ async function verifySessionToken(token) {
|
|
|
44
44
|
return null;
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
|
-
async function signAudienceToken(audience) {
|
|
48
|
-
return new jose.SignJWT({ audience }).setProtectedHeader({ alg: "HS256" }).setExpirationTime(`${AUDIENCE_MAX_AGE_SECONDS}s`).setIssuedAt().sign(requireSessionSecret());
|
|
47
|
+
async function signAudienceToken(audience, isDefault = false, username = null) {
|
|
48
|
+
return new jose.SignJWT({ audience, isDefault, username }).setProtectedHeader({ alg: "HS256" }).setExpirationTime(`${AUDIENCE_MAX_AGE_SECONDS}s`).setIssuedAt().sign(requireSessionSecret());
|
|
49
49
|
}
|
|
50
|
-
async function
|
|
50
|
+
async function verifyAudienceClaims(token) {
|
|
51
51
|
const secret = requireSessionSecret();
|
|
52
52
|
try {
|
|
53
53
|
const { payload } = await jose.jwtVerify(token, secret, { algorithms: ["HS256"] });
|
|
54
54
|
const audience = payload.audience;
|
|
55
|
-
|
|
55
|
+
if (typeof audience !== "string" || audience === "") return null;
|
|
56
|
+
return {
|
|
57
|
+
audience,
|
|
58
|
+
isDefault: payload.isDefault === true,
|
|
59
|
+
username: typeof payload.username === "string" && payload.username !== "" ? payload.username : null
|
|
60
|
+
};
|
|
56
61
|
} catch {
|
|
57
62
|
return null;
|
|
58
63
|
}
|
|
59
64
|
}
|
|
65
|
+
async function verifyAudienceToken(token) {
|
|
66
|
+
return (await verifyAudienceClaims(token))?.audience ?? null;
|
|
67
|
+
}
|
|
60
68
|
function setSessionCookie(cookies, token, isProduction) {
|
|
61
69
|
cookies.set(SESSION_COOKIE, token, {
|
|
62
70
|
httpOnly: true,
|
|
@@ -90,6 +98,7 @@ export {
|
|
|
90
98
|
signSessionToken,
|
|
91
99
|
verifySessionToken,
|
|
92
100
|
signAudienceToken,
|
|
101
|
+
verifyAudienceClaims,
|
|
93
102
|
verifyAudienceToken,
|
|
94
103
|
setSessionCookie,
|
|
95
104
|
LastOwnerError,
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
// src/schemas/shared.ts
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
var TextHeadingLine = z.object({
|
|
4
|
+
type: z.literal("heading"),
|
|
5
|
+
text: z.string()
|
|
6
|
+
});
|
|
7
|
+
var TextParagraphLine = z.object({
|
|
8
|
+
type: z.enum(["paragraph", "paragraph_large"]),
|
|
9
|
+
text: z.string()
|
|
10
|
+
});
|
|
11
|
+
var TextLabelValueLine = z.object({
|
|
12
|
+
type: z.literal("label_value"),
|
|
13
|
+
label: z.string(),
|
|
14
|
+
text: z.string()
|
|
15
|
+
});
|
|
16
|
+
var TextListItemLine = z.object({
|
|
17
|
+
type: z.enum(["list_item_unordered", "list_item_ordered"]),
|
|
18
|
+
text: z.string()
|
|
19
|
+
});
|
|
20
|
+
var TextLineSchema = z.discriminatedUnion("type", [
|
|
21
|
+
TextHeadingLine,
|
|
22
|
+
TextParagraphLine,
|
|
23
|
+
TextLabelValueLine,
|
|
24
|
+
TextListItemLine
|
|
25
|
+
]);
|
|
26
|
+
var BaseMediaRef = z.object({
|
|
27
|
+
imageId: z.string().default("").describe("Media-library id of the image/video asset."),
|
|
28
|
+
caption: z.union([z.string(), z.array(z.string())]).optional().describe("Optional caption: a single string, or multiple lines as an array of strings."),
|
|
29
|
+
background: z.string().optional().describe("Optional CSS background color/value shown behind a transparent image."),
|
|
30
|
+
invertFrom: z.string().optional().describe("Optional CSS color; the image inverts when the page background matches it (e.g. for dark-mode logo swaps)."),
|
|
31
|
+
border: z.boolean().optional().describe("When true, draw a border around the media."),
|
|
32
|
+
objectFit: z.enum(["cover", "contain"]).optional().describe("How the image fills its box: 'contain' (fit whole image) or 'cover' (fill and crop).")
|
|
33
|
+
});
|
|
34
|
+
var ImageRef = BaseMediaRef.extend({
|
|
35
|
+
type: z.literal("image")
|
|
36
|
+
});
|
|
37
|
+
var VideoRef = BaseMediaRef.extend({
|
|
38
|
+
type: z.literal("video"),
|
|
39
|
+
poster: z.string().optional().describe("Optional poster-image URL shown before playback starts."),
|
|
40
|
+
autoplay: z.boolean().optional().describe("When true, the video starts playing automatically."),
|
|
41
|
+
loop: z.boolean().optional().describe("When true, the video repeats when it finishes."),
|
|
42
|
+
muted: z.boolean().optional().describe("When true, the video plays without sound.")
|
|
43
|
+
});
|
|
44
|
+
var DoDontImageRef = BaseMediaRef.extend({
|
|
45
|
+
type: z.literal("doDontImage"),
|
|
46
|
+
doDont: z.enum(["do", "dont"]).describe("Whether this is a 'do' (correct) or 'dont' (incorrect) example.")
|
|
47
|
+
});
|
|
48
|
+
var LinkedImageRef = BaseMediaRef.extend({
|
|
49
|
+
type: z.literal("linkedImage"),
|
|
50
|
+
href: z.string().describe("URL the image links to."),
|
|
51
|
+
target: z.string().optional().describe("Link target, e.g. '_self' or '_blank'."),
|
|
52
|
+
linkText: z.string().optional().describe("Optional accessible link text/label.")
|
|
53
|
+
});
|
|
54
|
+
var MediaReferenceSchema = z.discriminatedUnion("type", [
|
|
55
|
+
ImageRef,
|
|
56
|
+
VideoRef,
|
|
57
|
+
DoDontImageRef,
|
|
58
|
+
LinkedImageRef
|
|
59
|
+
]);
|
|
60
|
+
var SingleMediaReferenceSchema = z.discriminatedUnion("type", [ImageRef, VideoRef]);
|
|
61
|
+
var HexColorSchema = z.string().regex(/^#[0-9a-fA-F]{6}$/, "must be a 6-digit hex color");
|
|
62
|
+
var FontNameSchema = z.string().max(120).regex(/^[a-zA-Z0-9 ,'"-]+$/, "contains invalid font-name characters");
|
|
63
|
+
|
|
64
|
+
export {
|
|
65
|
+
TextLineSchema,
|
|
66
|
+
MediaReferenceSchema,
|
|
67
|
+
SingleMediaReferenceSchema,
|
|
68
|
+
HexColorSchema,
|
|
69
|
+
FontNameSchema
|
|
70
|
+
};
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Checkbox,
|
|
3
|
+
FormLabel,
|
|
4
|
+
Input
|
|
5
|
+
} from "./chunk-5THS4K5D.js";
|
|
1
6
|
import {
|
|
2
7
|
EditableGrid,
|
|
3
8
|
EditablePlainText,
|
|
4
9
|
MediaBlock,
|
|
5
10
|
containerGridClass,
|
|
6
11
|
useEditableCollection
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import {
|
|
9
|
-
Checkbox,
|
|
10
|
-
FormLabel,
|
|
11
|
-
Input
|
|
12
|
-
} from "./chunk-5THS4K5D.js";
|
|
12
|
+
} from "./chunk-5IZ2KTMU.js";
|
|
13
13
|
import {
|
|
14
14
|
AddIcon,
|
|
15
15
|
DeleteIcon,
|
|
16
16
|
DragHandle,
|
|
17
17
|
IconButton,
|
|
18
18
|
useMediaLibrary
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-D6TLUVOP.js";
|
|
20
20
|
import {
|
|
21
21
|
DEFAULT_LINK,
|
|
22
22
|
LinkValueSchema
|
|
@@ -30,7 +30,7 @@ import {
|
|
|
30
30
|
} from "./chunk-WDSVHKAH.js";
|
|
31
31
|
import {
|
|
32
32
|
createEvent
|
|
33
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-4RNF2DRG.js";
|
|
34
34
|
import {
|
|
35
35
|
cn
|
|
36
36
|
} from "./chunk-7EOSDFS3.js";
|
|
@@ -40,7 +40,7 @@ import {
|
|
|
40
40
|
import {
|
|
41
41
|
HexColorSchema,
|
|
42
42
|
SingleMediaReferenceSchema
|
|
43
|
-
} from "./chunk-
|
|
43
|
+
} from "./chunk-GGXZZ77Z.js";
|
|
44
44
|
|
|
45
45
|
// src/components/sections/Colors/index.tsx
|
|
46
46
|
import { z as z2 } from "zod";
|
|
@@ -410,7 +410,7 @@ import { z as z3 } from "zod";
|
|
|
410
410
|
import { List, Columns2 } from "lucide-react";
|
|
411
411
|
|
|
412
412
|
// src/components/sections/IconList/IconList.tsx
|
|
413
|
-
import { useRef as useRef3, useEffect as useEffect4, useState as useState4, useCallback } from "react";
|
|
413
|
+
import { useRef as useRef3, useEffect as useEffect4, useState as useState4, useCallback, useId } from "react";
|
|
414
414
|
import { Check as Check2, CopyPlus, Pencil, X as X2 } from "lucide-react";
|
|
415
415
|
|
|
416
416
|
// src/components/primitives/IconPicker.tsx
|
|
@@ -670,12 +670,47 @@ function EditIconList({
|
|
|
670
670
|
iconClassName,
|
|
671
671
|
onItemsChange
|
|
672
672
|
}) {
|
|
673
|
-
const
|
|
673
|
+
const listId = useId();
|
|
674
|
+
const { wrappedItems, onReorder, onAdd, onInsertItem, onRemove } = useEditableCollection({
|
|
674
675
|
items,
|
|
675
676
|
onChange: onItemsChange,
|
|
676
677
|
createItem: () => ({ label: "", text: "" })
|
|
677
678
|
});
|
|
678
679
|
const [dragState, setDragState] = useState4({ sourceId: null, targetId: null });
|
|
680
|
+
const cfgRef = useRef3({ listId, onReorder, onRemove, onInsertItem });
|
|
681
|
+
cfgRef.current = { listId, onReorder, onRemove, onInsertItem };
|
|
682
|
+
useEffect4(() => {
|
|
683
|
+
let cleanup;
|
|
684
|
+
let cancelled = false;
|
|
685
|
+
import("./adapter-HH47ZPGM.js").then(({ monitorForElements }) => {
|
|
686
|
+
if (cancelled) return;
|
|
687
|
+
cleanup = monitorForElements({
|
|
688
|
+
onDrop: ({ source, location }) => {
|
|
689
|
+
if (source.data.dragType !== "icon-list-row") return;
|
|
690
|
+
setDragState({ sourceId: null, targetId: null });
|
|
691
|
+
const { listId: my, onReorder: onReorder2, onRemove: onRemove2, onInsertItem: onInsertItem2 } = cfgRef.current;
|
|
692
|
+
const target = location.current.dropTargets[0];
|
|
693
|
+
if (!target) return;
|
|
694
|
+
const srcListId = source.data.listId;
|
|
695
|
+
const dstListId = target.data.listId;
|
|
696
|
+
const fromIndex = source.data.index;
|
|
697
|
+
const targetIndex = target.data.index;
|
|
698
|
+
if (srcListId === my && dstListId === my) {
|
|
699
|
+
const toIndex = target.data.trailing ? targetIndex - 1 : targetIndex;
|
|
700
|
+
if (fromIndex !== toIndex) onReorder2(fromIndex, toIndex);
|
|
701
|
+
} else if (srcListId === my) {
|
|
702
|
+
onRemove2(source.data.id);
|
|
703
|
+
} else if (dstListId === my) {
|
|
704
|
+
onInsertItem2(targetIndex, source.data.item);
|
|
705
|
+
}
|
|
706
|
+
}
|
|
707
|
+
});
|
|
708
|
+
});
|
|
709
|
+
return () => {
|
|
710
|
+
cancelled = true;
|
|
711
|
+
cleanup?.();
|
|
712
|
+
};
|
|
713
|
+
}, []);
|
|
679
714
|
const updateItem = useCallback(
|
|
680
715
|
(index, patch) => {
|
|
681
716
|
const updated = wrappedItems.map(
|
|
@@ -703,6 +738,7 @@ function EditIconList({
|
|
|
703
738
|
EditableRow,
|
|
704
739
|
{
|
|
705
740
|
id: wrapped.id,
|
|
741
|
+
listId,
|
|
706
742
|
index,
|
|
707
743
|
item: wrapped.data,
|
|
708
744
|
defaultIcon,
|
|
@@ -715,7 +751,6 @@ function EditIconList({
|
|
|
715
751
|
iconClassName,
|
|
716
752
|
dragState,
|
|
717
753
|
setDragState,
|
|
718
|
-
onReorder,
|
|
719
754
|
onRemove,
|
|
720
755
|
onUpdateItem: (patch) => updateItem(index, patch),
|
|
721
756
|
onDuplicate: () => duplicateItem(index)
|
|
@@ -725,10 +760,10 @@ function EditIconList({
|
|
|
725
760
|
/* @__PURE__ */ jsx8(
|
|
726
761
|
TrailingDropZone,
|
|
727
762
|
{
|
|
763
|
+
listId,
|
|
728
764
|
index: wrappedItems.length,
|
|
729
765
|
dragState,
|
|
730
|
-
setDragState
|
|
731
|
-
onReorder
|
|
766
|
+
setDragState
|
|
732
767
|
}
|
|
733
768
|
),
|
|
734
769
|
/* @__PURE__ */ jsx8(
|
|
@@ -746,6 +781,7 @@ function EditIconList({
|
|
|
746
781
|
}
|
|
747
782
|
function EditableRow({
|
|
748
783
|
id,
|
|
784
|
+
listId,
|
|
749
785
|
index,
|
|
750
786
|
item,
|
|
751
787
|
defaultIcon,
|
|
@@ -758,13 +794,14 @@ function EditableRow({
|
|
|
758
794
|
iconClassName,
|
|
759
795
|
dragState,
|
|
760
796
|
setDragState,
|
|
761
|
-
onReorder,
|
|
762
797
|
onRemove,
|
|
763
798
|
onUpdateItem,
|
|
764
799
|
onDuplicate
|
|
765
800
|
}) {
|
|
766
801
|
const rowRef = useRef3(null);
|
|
767
802
|
const handleRef = useRef3(null);
|
|
803
|
+
const itemRef = useRef3(item);
|
|
804
|
+
itemRef.current = item;
|
|
768
805
|
const [iconHover, setIconHover] = useState4(false);
|
|
769
806
|
const [pickerOpen, setPickerOpen] = useState4(false);
|
|
770
807
|
const [dodontOpen, setDodontOpen] = useState4(false);
|
|
@@ -782,22 +819,21 @@ function EditableRow({
|
|
|
782
819
|
if (cancelled) return;
|
|
783
820
|
const cleanupDraggable = draggable({
|
|
784
821
|
element: handle,
|
|
785
|
-
|
|
822
|
+
// `item` rides along so a destination list can insert it verbatim —
|
|
823
|
+
// persisted icon-list items have no ids, only positions. Read from a ref
|
|
824
|
+
// so typing in the row doesn't re-register the drag mid-gesture.
|
|
825
|
+
getInitialData: () => ({ dragType: "icon-list-row", listId, id, index, item: itemRef.current }),
|
|
786
826
|
onDragStart: () => setDragState({ sourceId: id, targetId: null }),
|
|
787
827
|
onDrop: () => setDragState({ sourceId: null, targetId: null })
|
|
788
828
|
});
|
|
789
829
|
const cleanupDropTarget = dropTargetForElements({
|
|
790
830
|
element: row,
|
|
791
831
|
canDrop: ({ source }) => source.data.dragType === "icon-list-row",
|
|
792
|
-
getData: () => ({ id, index }),
|
|
832
|
+
getData: () => ({ listId, id, index }),
|
|
793
833
|
onDragEnter: () => setDragState((prev) => ({ ...prev, targetId: id })),
|
|
794
834
|
onDragLeave: () => setDragState(
|
|
795
835
|
(prev) => prev.targetId === id ? { ...prev, targetId: null } : prev
|
|
796
|
-
)
|
|
797
|
-
onDrop: ({ source }) => {
|
|
798
|
-
const fromIndex = source.data.index;
|
|
799
|
-
if (fromIndex !== index) onReorder(fromIndex, index);
|
|
800
|
-
}
|
|
836
|
+
)
|
|
801
837
|
});
|
|
802
838
|
cleanup = () => {
|
|
803
839
|
cleanupDraggable();
|
|
@@ -808,7 +844,7 @@ function EditableRow({
|
|
|
808
844
|
cancelled = true;
|
|
809
845
|
cleanup?.();
|
|
810
846
|
};
|
|
811
|
-
}, [id, index,
|
|
847
|
+
}, [id, index, listId, setDragState]);
|
|
812
848
|
const isDropTarget = dragState.targetId === id && dragState.sourceId !== id;
|
|
813
849
|
const onEditableActivity = (e) => {
|
|
814
850
|
const t = e.target;
|
|
@@ -964,10 +1000,10 @@ function EditableRow({
|
|
|
964
1000
|
);
|
|
965
1001
|
}
|
|
966
1002
|
function TrailingDropZone({
|
|
1003
|
+
listId,
|
|
967
1004
|
index,
|
|
968
1005
|
dragState,
|
|
969
|
-
setDragState
|
|
970
|
-
onReorder
|
|
1006
|
+
setDragState
|
|
971
1007
|
}) {
|
|
972
1008
|
const ref = useRef3(null);
|
|
973
1009
|
const trailingId = "__trailing__";
|
|
@@ -981,23 +1017,19 @@ function TrailingDropZone({
|
|
|
981
1017
|
cleanup = dropTargetForElements({
|
|
982
1018
|
element: el,
|
|
983
1019
|
canDrop: ({ source }) => source.data.dragType === "icon-list-row",
|
|
984
|
-
getData: () => ({ id: trailingId, index }),
|
|
1020
|
+
getData: () => ({ listId, id: trailingId, index, trailing: true }),
|
|
985
1021
|
onDragEnter: () => setDragState((prev) => ({ ...prev, targetId: trailingId })),
|
|
986
1022
|
onDragLeave: () => setDragState(
|
|
987
1023
|
(prev) => prev.targetId === trailingId ? { ...prev, targetId: null } : prev
|
|
988
|
-
)
|
|
989
|
-
onDrop: ({ source }) => {
|
|
990
|
-
const fromIndex = source.data.index;
|
|
991
|
-
if (fromIndex !== index - 1) onReorder(fromIndex, index - 1);
|
|
992
|
-
}
|
|
1024
|
+
)
|
|
993
1025
|
});
|
|
994
1026
|
});
|
|
995
1027
|
return () => {
|
|
996
1028
|
cancelled = true;
|
|
997
1029
|
cleanup?.();
|
|
998
1030
|
};
|
|
999
|
-
}, [index,
|
|
1000
|
-
const isDropTarget = dragState.targetId === trailingId
|
|
1031
|
+
}, [index, listId, setDragState]);
|
|
1032
|
+
const isDropTarget = dragState.targetId === trailingId;
|
|
1001
1033
|
return /* @__PURE__ */ jsx8(
|
|
1002
1034
|
"div",
|
|
1003
1035
|
{
|
|
@@ -1358,6 +1390,24 @@ function DocumentDropZone({ onDocumentSelected, className }) {
|
|
|
1358
1390
|
);
|
|
1359
1391
|
}
|
|
1360
1392
|
|
|
1393
|
+
// src/lib/insert-menu.ts
|
|
1394
|
+
var PRESET_PREFIX = "__preset:";
|
|
1395
|
+
var INSERT_MENU_ORDER = [
|
|
1396
|
+
"container",
|
|
1397
|
+
"link_heading",
|
|
1398
|
+
"sub_heading",
|
|
1399
|
+
"sub_sub_heading",
|
|
1400
|
+
"prose",
|
|
1401
|
+
"media",
|
|
1402
|
+
"video",
|
|
1403
|
+
"button",
|
|
1404
|
+
"colors",
|
|
1405
|
+
"document",
|
|
1406
|
+
"icon_list",
|
|
1407
|
+
`${PRESET_PREFIX}do_dont_list`,
|
|
1408
|
+
"dodont_media"
|
|
1409
|
+
];
|
|
1410
|
+
|
|
1361
1411
|
// src/lib/container-ops.ts
|
|
1362
1412
|
function getContainerChildren(block) {
|
|
1363
1413
|
const content = block.content;
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
EditableRichText,
|
|
3
|
-
defineHeadingSection
|
|
4
|
-
} from "./chunk-EWNDBKYK.js";
|
|
5
1
|
import {
|
|
6
2
|
brandGuideSectionDefs,
|
|
7
3
|
duplicateChildAt,
|
|
@@ -13,17 +9,7 @@ import {
|
|
|
13
9
|
stripHtmlToPlainText,
|
|
14
10
|
trimTrailingSpacers,
|
|
15
11
|
truncate
|
|
16
|
-
} from "./chunk-
|
|
17
|
-
import {
|
|
18
|
-
EditablePlainText,
|
|
19
|
-
ImageDropZone,
|
|
20
|
-
MAX_CONTAINER_COLUMNS,
|
|
21
|
-
MediaBlock,
|
|
22
|
-
colSpanClass,
|
|
23
|
-
containerGridClass,
|
|
24
|
-
masonryColumnsClass,
|
|
25
|
-
spacerHiddenClass
|
|
26
|
-
} from "./chunk-MUTHF2GT.js";
|
|
12
|
+
} from "./chunk-IPKZ5FU6.js";
|
|
27
13
|
import {
|
|
28
14
|
DeleteButton,
|
|
29
15
|
DragHandle,
|
|
@@ -37,11 +23,25 @@ import {
|
|
|
37
23
|
buildBlockDropData,
|
|
38
24
|
canDropBlock,
|
|
39
25
|
isBlockDragData
|
|
40
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-ZHHJVKU7.js";
|
|
27
|
+
import {
|
|
28
|
+
EditableRichText,
|
|
29
|
+
defineHeadingSection
|
|
30
|
+
} from "./chunk-LUAI5DWR.js";
|
|
31
|
+
import {
|
|
32
|
+
EditablePlainText,
|
|
33
|
+
ImageDropZone,
|
|
34
|
+
MAX_CONTAINER_COLUMNS,
|
|
35
|
+
MediaBlock,
|
|
36
|
+
colSpanClass,
|
|
37
|
+
containerGridClass,
|
|
38
|
+
masonryColumnsClass,
|
|
39
|
+
spacerHiddenClass
|
|
40
|
+
} from "./chunk-5IZ2KTMU.js";
|
|
41
41
|
import {
|
|
42
42
|
useMediaLibrary,
|
|
43
43
|
useResolvedMedia
|
|
44
|
-
} from "./chunk-
|
|
44
|
+
} from "./chunk-D6TLUVOP.js";
|
|
45
45
|
import {
|
|
46
46
|
embedUrl
|
|
47
47
|
} from "./chunk-Y4JQGO6G.js";
|
|
@@ -64,7 +64,7 @@ import {
|
|
|
64
64
|
} from "./chunk-VKAGMEKE.js";
|
|
65
65
|
import {
|
|
66
66
|
SingleMediaReferenceSchema
|
|
67
|
-
} from "./chunk-
|
|
67
|
+
} from "./chunk-GGXZZ77Z.js";
|
|
68
68
|
|
|
69
69
|
// src/components/sections/LinkHeading/index.tsx
|
|
70
70
|
import { Heading1 } from "lucide-react";
|
|
@@ -483,7 +483,7 @@ import { z as z5 } from "zod";
|
|
|
483
483
|
import { LayoutTemplate } from "lucide-react";
|
|
484
484
|
|
|
485
485
|
// src/components/sections/Container/Container.tsx
|
|
486
|
-
import "react";
|
|
486
|
+
import { useRef as useRef3 } from "react";
|
|
487
487
|
|
|
488
488
|
// src/components/editor/ChildBlockWrapper.tsx
|
|
489
489
|
import { forwardRef } from "react";
|
|
@@ -859,13 +859,16 @@ function Container({ content, isEditMode, onChange, openModal }) {
|
|
|
859
859
|
content: content.content
|
|
860
860
|
};
|
|
861
861
|
const emit = (nextSection) => onChange?.({ ...content, content: nextSection.content });
|
|
862
|
+
const pendingChildren = useRef3(children);
|
|
863
|
+
pendingChildren.current = children;
|
|
862
864
|
const updateChild = (index, childContent) => {
|
|
863
|
-
const next =
|
|
865
|
+
const next = pendingChildren.current.map((c, i) => {
|
|
864
866
|
if (i !== index) return c;
|
|
865
867
|
const merged = { ...childContent, id: c.id ?? newId() };
|
|
866
868
|
if (c.layout !== void 0) merged.layout = c.layout;
|
|
867
869
|
return merged;
|
|
868
870
|
});
|
|
871
|
+
pendingChildren.current = next;
|
|
869
872
|
onChange?.({ ...content, content: { ...content.content, children: next } });
|
|
870
873
|
};
|
|
871
874
|
const gridClass = cn(
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import {
|
|
2
|
+
HexColorSchema
|
|
3
|
+
} from "./chunk-GGXZZ77Z.js";
|
|
4
|
+
|
|
5
|
+
// src/schemas/audience.ts
|
|
6
|
+
import { z } from "zod";
|
|
7
|
+
var AudienceNameSchema = z.string().min(1).max(32).regex(
|
|
8
|
+
/^[a-z0-9]([a-z0-9_-]*[a-z0-9])?$/,
|
|
9
|
+
"lowercase alphanumeric, dashes and underscores allowed"
|
|
10
|
+
);
|
|
11
|
+
var AudienceColorSchema = HexColorSchema.nullable();
|
|
12
|
+
var ViewerUsernameSchema = z.string().min(1).max(64).regex(
|
|
13
|
+
/^[a-z0-9]([a-z0-9._-]*[a-z0-9])?$/,
|
|
14
|
+
"lowercase alphanumeric; dots, dashes and underscores allowed"
|
|
15
|
+
);
|
|
16
|
+
function normalizeUsername(input) {
|
|
17
|
+
return input.trim().toLowerCase();
|
|
18
|
+
}
|
|
19
|
+
var NormalizedUsernameSchema = z.string().min(1).max(128).transform(normalizeUsername).pipe(ViewerUsernameSchema);
|
|
20
|
+
var VIEWER_PASSWORD_MIN_LENGTH = 8;
|
|
21
|
+
var ViewerPasswordSchema = z.string().min(VIEWER_PASSWORD_MIN_LENGTH);
|
|
22
|
+
var ViewerCredentialSchema = z.object({
|
|
23
|
+
username: z.string(),
|
|
24
|
+
label: z.string().nullable(),
|
|
25
|
+
/** The audience slug this sign-in grants — its content access, verbatim. */
|
|
26
|
+
audienceName: z.string(),
|
|
27
|
+
createdAt: z.string()
|
|
28
|
+
});
|
|
29
|
+
function slugifyAudienceName(input) {
|
|
30
|
+
return input.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export {
|
|
34
|
+
AudienceNameSchema,
|
|
35
|
+
AudienceColorSchema,
|
|
36
|
+
ViewerUsernameSchema,
|
|
37
|
+
normalizeUsername,
|
|
38
|
+
NormalizedUsernameSchema,
|
|
39
|
+
VIEWER_PASSWORD_MIN_LENGTH,
|
|
40
|
+
ViewerPasswordSchema,
|
|
41
|
+
ViewerCredentialSchema,
|
|
42
|
+
slugifyAudienceName
|
|
43
|
+
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Button,
|
|
3
|
-
usePages
|
|
4
|
-
} from "./chunk-ZSPCE6MZ.js";
|
|
5
1
|
import {
|
|
6
2
|
Checkbox,
|
|
7
3
|
FormLabel,
|
|
8
4
|
Input
|
|
9
5
|
} from "./chunk-5THS4K5D.js";
|
|
6
|
+
import {
|
|
7
|
+
Button,
|
|
8
|
+
usePages
|
|
9
|
+
} from "./chunk-ZSPCE6MZ.js";
|
|
10
10
|
import {
|
|
11
11
|
DeleteIcon,
|
|
12
12
|
DragHandle,
|
|
@@ -14,10 +14,10 @@ import {
|
|
|
14
14
|
SettingsIcon,
|
|
15
15
|
useMediaLibrary,
|
|
16
16
|
useResolvedMedia
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-D6TLUVOP.js";
|
|
18
18
|
import {
|
|
19
19
|
formatFileSize
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-XBYJQ5RS.js";
|
|
21
21
|
import {
|
|
22
22
|
cn
|
|
23
23
|
} from "./chunk-7EOSDFS3.js";
|
package/dist/collab/rebase.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SectionOrderingModal.d.ts","sourceRoot":"","sources":["../../../src/components/editor/SectionOrderingModal.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"SectionOrderingModal.d.ts","sourceRoot":"","sources":["../../../src/components/editor/SectionOrderingModal.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEtD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAQvD,UAAU,yBAAyB;IACjC,QAAQ,EAAE,aAAa,EAAE,CAAC;IAC1B,aAAa,EAAE,aAAa,CAAC;IAC7B,SAAS,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;CACzD;AA+CD,wBAAgB,oBAAoB,CAAC,EACnC,QAAQ,EACR,aAAa,EACb,SAAS,GACV,EAAE,yBAAyB,2CAc3B"}
|
|
@@ -11,21 +11,22 @@ import {
|
|
|
11
11
|
buildBlockDropData,
|
|
12
12
|
canDropBlock,
|
|
13
13
|
isBlockDragData
|
|
14
|
-
} from "../../chunk-
|
|
15
|
-
import "../../chunk-ZSPCE6MZ.js";
|
|
14
|
+
} from "../../chunk-ZHHJVKU7.js";
|
|
16
15
|
import "../../chunk-5THS4K5D.js";
|
|
16
|
+
import "../../chunk-ZSPCE6MZ.js";
|
|
17
17
|
import {
|
|
18
18
|
AddIcon,
|
|
19
19
|
IconButton
|
|
20
|
-
} from "../../chunk-
|
|
21
|
-
import "../../chunk-
|
|
22
|
-
import "../../chunk-
|
|
20
|
+
} from "../../chunk-D6TLUVOP.js";
|
|
21
|
+
import "../../chunk-XBYJQ5RS.js";
|
|
22
|
+
import "../../chunk-4RNF2DRG.js";
|
|
23
23
|
import {
|
|
24
24
|
cn
|
|
25
25
|
} from "../../chunk-7EOSDFS3.js";
|
|
26
|
-
import "../../chunk-
|
|
27
|
-
import "../../chunk-
|
|
26
|
+
import "../../chunk-CPTFFLK2.js";
|
|
27
|
+
import "../../chunk-BOZUEKWL.js";
|
|
28
28
|
import "../../chunk-FM4M4Q2W.js";
|
|
29
|
+
import "../../chunk-GGXZZ77Z.js";
|
|
29
30
|
import "../../chunk-JSBRDJBE.js";
|
|
30
31
|
|
|
31
32
|
// src/components/editor/InsertButton.tsx
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
EditableRichText,
|
|
3
3
|
LinkPopover,
|
|
4
4
|
defineHeadingSection
|
|
5
|
-
} from "../../chunk-
|
|
5
|
+
} from "../../chunk-LUAI5DWR.js";
|
|
6
6
|
import {
|
|
7
7
|
EditableGrid,
|
|
8
8
|
EditablePlainText,
|
|
@@ -10,22 +10,23 @@ import {
|
|
|
10
10
|
MediaBlock,
|
|
11
11
|
ResolvedMedia,
|
|
12
12
|
useEditableCollection
|
|
13
|
-
} from "../../chunk-
|
|
13
|
+
} from "../../chunk-5IZ2KTMU.js";
|
|
14
14
|
import "../../chunk-ZSPCE6MZ.js";
|
|
15
15
|
import {
|
|
16
16
|
DeleteIcon,
|
|
17
17
|
DragHandle,
|
|
18
18
|
IconButton
|
|
19
|
-
} from "../../chunk-
|
|
20
|
-
import "../../chunk-
|
|
19
|
+
} from "../../chunk-D6TLUVOP.js";
|
|
20
|
+
import "../../chunk-XBYJQ5RS.js";
|
|
21
21
|
import "../../chunk-72CG6AA2.js";
|
|
22
22
|
import {
|
|
23
23
|
cn
|
|
24
24
|
} from "../../chunk-7EOSDFS3.js";
|
|
25
|
-
import "../../chunk-
|
|
25
|
+
import "../../chunk-CPTFFLK2.js";
|
|
26
26
|
import "../../chunk-VKAGMEKE.js";
|
|
27
|
-
import "../../chunk-
|
|
27
|
+
import "../../chunk-BOZUEKWL.js";
|
|
28
28
|
import "../../chunk-FM4M4Q2W.js";
|
|
29
|
+
import "../../chunk-GGXZZ77Z.js";
|
|
29
30
|
import "../../chunk-JSBRDJBE.js";
|
|
30
31
|
|
|
31
32
|
// src/components/primitives/EditableList.tsx
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Container.d.ts","sourceRoot":"","sources":["../../../../src/components/sections/Container/Container.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAc,KAAK,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAcnE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AA4GzD,UAAU,gBAAgB;IACxB,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACxC,QAAQ,EAAE,OAAO,EAAE,CAAC;CACrB;AAED,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE;QAAE,EAAE,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,gBAAgB,CAAA;KAAE,CAAC;IACpD,UAAU,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IACtC,SAAS,CAAC,EAAE,SAAS,CAAC;CACvB;AAwFD,wBAAgB,SAAS,CAAC,EAAE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE,cAAc,
|
|
1
|
+
{"version":3,"file":"Container.d.ts","sourceRoot":"","sources":["../../../../src/components/sections/Container/Container.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAc,KAAK,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAcnE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AA4GzD,UAAU,gBAAgB;IACxB,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACxC,QAAQ,EAAE,OAAO,EAAE,CAAC;CACrB;AAED,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE;QAAE,EAAE,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,gBAAgB,CAAA;KAAE,CAAC;IACpD,UAAU,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IACtC,SAAS,CAAC,EAAE,SAAS,CAAC;CACvB;AAwFD,wBAAgB,SAAS,CAAC,EAAE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE,cAAc,kDAwSrF"}
|