@drawnagency/primitives 0.1.31 → 0.1.32
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/index.js +3 -2
- package/dist/auth/security.d.ts +0 -4
- package/dist/auth/security.d.ts.map +1 -1
- package/dist/{chunk-ZDKSJY2K.js → chunk-C2MVDXD7.js} +1 -1
- package/dist/chunk-LZKVV4K2.js +30 -0
- package/dist/{chunk-MNK7XA6S.js → chunk-OUFUUBZ4.js} +1 -29
- package/dist/{chunk-EUNJDXYX.js → chunk-S2L3BPLS.js} +4 -3
- package/dist/chunk-WKZ7OENC.js +8 -0
- package/dist/{chunk-PKMPRW7T.js → chunk-YEOGH3QH.js} +1 -1
- package/dist/components/primitives/RichTextToolbar.d.ts.map +1 -1
- package/dist/components/shell/EditorShell.d.ts.map +1 -1
- package/dist/hooks/useBuildStatus.d.ts +0 -1
- package/dist/hooks/useBuildStatus.d.ts.map +1 -1
- package/dist/hooks/useContentLifecycle.d.ts +0 -1
- package/dist/hooks/useContentLifecycle.d.ts.map +1 -1
- package/dist/hooks/useEditorPersistence.d.ts +2 -3
- package/dist/hooks/useEditorPersistence.d.ts.map +1 -1
- package/dist/hooks/useEditorPublish.d.ts.map +1 -1
- package/dist/index.js +13 -7
- package/dist/lib/dexie.d.ts +2 -2
- package/dist/lib/dexie.d.ts.map +1 -1
- package/dist/lib/env.d.ts +7 -0
- package/dist/lib/env.d.ts.map +1 -0
- package/dist/lib/env.js +6 -0
- package/dist/lib/index.d.ts +1 -0
- package/dist/lib/index.d.ts.map +1 -1
- package/dist/lib/index.js +6 -2
- package/dist/schemas/auth.js +12 -0
- package/dist/schemas/index.js +6 -4
- package/package.json +9 -1
- package/src/auth/security.ts +1 -4
- package/src/components/primitives/RichTextToolbar.tsx +18 -0
- package/src/components/primitives/tiptap-presets.ts +1 -1
- package/src/components/shell/EditorShell.tsx +16 -16
- package/src/hooks/useBuildStatus.ts +1 -5
- package/src/hooks/useContentLifecycle.ts +3 -4
- package/src/hooks/useEditorPersistence.ts +3 -19
- package/src/hooks/useEditorPublish.ts +78 -98
- package/src/lib/dexie.ts +3 -3
- package/src/lib/env.ts +13 -0
- package/src/lib/index.ts +1 -0
- package/src/components/brandguide/ColorSwatchSettings.d.ts +0 -8
- package/src/components/brandguide/Colors.d.ts +0 -15
- package/src/components/brandguide/DoDontList.d.ts +0 -16
- package/src/components/brandguide/DoDontMediaGrid.d.ts +0 -16
- package/src/components/primitives/CustomParagraph.d.ts +0 -2
- package/src/components/primitives/EditableGrid.d.ts +0 -19
- package/src/components/primitives/EditablePlainText.d.ts +0 -12
- package/src/components/primitives/EditableRichText.d.ts +0 -12
- package/src/components/primitives/HeadingSection.d.ts +0 -10
- package/src/components/primitives/IconPicker.d.ts +0 -9
- package/src/components/primitives/LinkPopover.d.ts +0 -8
- package/src/components/primitives/MediaSettingsForms.d.ts +0 -19
- package/src/components/primitives/ResolvedMedia.d.ts +0 -8
- package/src/components/primitives/RichTextToolbar.d.ts +0 -9
- package/src/components/primitives/tiptap-presets.d.ts +0 -4
- package/src/components/primitives/useEditableCollection.d.ts +0 -19
- package/src/components/primitives/useEditablePlainText.d.ts +0 -14
- package/src/components/primitives/useEditableRichText.d.ts +0 -17
- package/src/components/sections/Button/CTAButton.d.ts +0 -11
- package/src/components/sections/Button/index.d.ts +0 -11
- package/src/components/sections/Colors/index.d.ts +0 -22
- package/src/components/sections/DoDontList/index.d.ts +0 -21
- package/src/components/sections/DoDontMediaGrid/index.d.ts +0 -55
- package/src/components/sections/IconList/IconList.d.ts +0 -20
- package/src/components/sections/IconList/IconListSettings.d.ts +0 -11
- package/src/components/sections/IconList/index.d.ts +0 -17
- package/src/components/sections/LinkHeading/index.d.ts +0 -8
- package/src/components/sections/MediaGrid/MediaGrid.d.ts +0 -17
- package/src/components/sections/MediaGrid/index.d.ts +0 -55
- package/src/components/sections/Prose/Prose.d.ts +0 -8
- package/src/components/sections/Prose/index.d.ts +0 -8
- package/src/components/sections/SplitContent/SplitContent.d.ts +0 -11
- package/src/components/sections/SplitContent/index.d.ts +0 -13
- package/src/components/sections/SubHeading/index.d.ts +0 -9
- package/src/components/sections/SubSubHeading/index.d.ts +0 -9
- package/src/components/sections/register-schemas.d.ts +0 -2
- package/src/components/shared/Button.d.ts +0 -15
- package/src/components/shared/Checkbox.d.ts +0 -14
- package/src/components/shared/FormLabel.d.ts +0 -8
- package/src/components/shared/IconButton.d.ts +0 -12
- package/src/components/shared/Input.d.ts +0 -8
- package/src/components/shared/Select.d.ts +0 -16
- package/src/components/shared/icons.d.ts +0 -17
- package/src/components/shell/MediaLibraryContext.d.ts +0 -14
- package/src/env.d.ts +0 -3
- package/src/hooks/useResolvedMedia.d.ts +0 -9
- package/src/lib/cn.d.ts +0 -3
- package/src/lib/grid.d.ts +0 -2
- package/src/lib/icons.d.ts +0 -9
- package/src/lib/loader.d.ts +0 -28
- package/src/lib/nav.d.ts +0 -15
- package/src/lib/registry.d.ts +0 -110
- package/src/lib/sanitize.d.ts +0 -2
- package/src/media/github.d.ts +0 -3
- package/src/media/index.d.ts +0 -8
- package/src/media/queue.d.ts +0 -74
- package/src/media/resolve.d.ts +0 -14
- package/src/media/types.d.ts +0 -42
- package/src/media/utils.d.ts +0 -7
- package/src/media/videoPoster.d.ts +0 -6
- package/src/schemas/auth.d.ts +0 -36
- package/src/schemas/media-grid-options.d.ts +0 -8
- package/src/schemas/media.d.ts +0 -63
- package/src/schemas/sections.d.ts +0 -12
- package/src/schemas/shared.d.ts +0 -98
- package/src/schemas/site-config.d.ts +0 -48
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { useCallback, useRef, useEffect } from "react";
|
|
2
2
|
import type { SectionContent } from "../schemas/sections";
|
|
3
|
-
import type { SiteIndex } from "../schemas/site-config";
|
|
3
|
+
import type { SiteIndex, SiteConfig } from "../schemas/site-config";
|
|
4
4
|
import { persistAll, persistSiteConfig } from "../lib/dexie";
|
|
5
5
|
|
|
6
6
|
interface PersistenceState {
|
|
7
7
|
pendingSections: Map<string, SectionContent>;
|
|
8
|
-
pendingDeletes: Set<string>;
|
|
9
8
|
indexDirty: boolean;
|
|
10
9
|
configDirty: boolean;
|
|
11
10
|
}
|
|
@@ -13,7 +12,6 @@ interface PersistenceState {
|
|
|
13
12
|
export function useEditorPersistence(siteIndexRef: React.RefObject<SiteIndex>) {
|
|
14
13
|
const state = useRef<PersistenceState>({
|
|
15
14
|
pendingSections: new Map(),
|
|
16
|
-
pendingDeletes: new Set(),
|
|
17
15
|
indexDirty: false,
|
|
18
16
|
configDirty: false,
|
|
19
17
|
});
|
|
@@ -21,23 +19,20 @@ export function useEditorPersistence(siteIndexRef: React.RefObject<SiteIndex>) {
|
|
|
21
19
|
|
|
22
20
|
const flushToDexie = useCallback(async () => {
|
|
23
21
|
const s = state.current;
|
|
24
|
-
if (s.pendingSections.size === 0 && !s.indexDirty
|
|
22
|
+
if (s.pendingSections.size === 0 && !s.indexDirty) return;
|
|
25
23
|
|
|
26
24
|
const entries = Array.from(s.pendingSections.entries()).map(([sectionId, content]) => ({
|
|
27
25
|
sectionId,
|
|
28
26
|
content,
|
|
29
27
|
}));
|
|
30
|
-
const deletedIds = Array.from(s.pendingDeletes);
|
|
31
28
|
|
|
32
29
|
s.pendingSections = new Map();
|
|
33
|
-
s.pendingDeletes = new Set();
|
|
34
30
|
const wasIndexDirty = s.indexDirty;
|
|
35
31
|
s.indexDirty = false;
|
|
36
32
|
|
|
37
33
|
await persistAll(
|
|
38
34
|
entries,
|
|
39
35
|
wasIndexDirty ? siteIndexRef.current : undefined,
|
|
40
|
-
deletedIds.length > 0 ? deletedIds : undefined,
|
|
41
36
|
);
|
|
42
37
|
}, [siteIndexRef]);
|
|
43
38
|
|
|
@@ -60,22 +55,12 @@ export function useEditorPersistence(siteIndexRef: React.RefObject<SiteIndex>) {
|
|
|
60
55
|
[scheduleFlush],
|
|
61
56
|
);
|
|
62
57
|
|
|
63
|
-
const markSectionDeleted = useCallback(
|
|
64
|
-
(sectionId: string) => {
|
|
65
|
-
state.current.pendingSections.delete(sectionId);
|
|
66
|
-
state.current.pendingDeletes.add(sectionId);
|
|
67
|
-
state.current.indexDirty = true;
|
|
68
|
-
scheduleFlush();
|
|
69
|
-
},
|
|
70
|
-
[scheduleFlush],
|
|
71
|
-
);
|
|
72
|
-
|
|
73
58
|
const markIndexDirty = useCallback(() => {
|
|
74
59
|
state.current.indexDirty = true;
|
|
75
60
|
scheduleFlush();
|
|
76
61
|
}, [scheduleFlush]);
|
|
77
62
|
|
|
78
|
-
const persistConfig = useCallback(async (config:
|
|
63
|
+
const persistConfig = useCallback(async (config: SiteConfig) => {
|
|
79
64
|
state.current.configDirty = true;
|
|
80
65
|
await persistSiteConfig(config);
|
|
81
66
|
}, []);
|
|
@@ -92,7 +77,6 @@ export function useEditorPersistence(siteIndexRef: React.RefObject<SiteIndex>) {
|
|
|
92
77
|
|
|
93
78
|
return {
|
|
94
79
|
markSectionDirty,
|
|
95
|
-
markSectionDeleted,
|
|
96
80
|
markIndexDirty,
|
|
97
81
|
persistConfig,
|
|
98
82
|
flushNow: flushToDexie,
|
|
@@ -75,12 +75,16 @@ export function useEditorPublish({
|
|
|
75
75
|
feedbackTimerRef.current = setTimeout(() => setPublishFeedback(null), duration);
|
|
76
76
|
}, []);
|
|
77
77
|
|
|
78
|
-
async function gatherMediaPayload(
|
|
79
|
-
|
|
78
|
+
async function gatherMediaPayload(
|
|
79
|
+
pendingItems: MediaItem[],
|
|
80
|
+
pendingDeletions: string[],
|
|
81
|
+
manifest: MediaManifest,
|
|
82
|
+
): Promise<GatheredMedia> {
|
|
83
|
+
const hasMediaChanges = pendingItems.length > 0 || pendingDeletions.length > 0;
|
|
80
84
|
const mediaUploads: { item: MediaItem; blobs: { path: string; base64: string }[] }[] = [];
|
|
81
85
|
|
|
82
|
-
const deletionSet = new Set(
|
|
83
|
-
const itemsToUpload =
|
|
86
|
+
const deletionSet = new Set(pendingDeletions);
|
|
87
|
+
const itemsToUpload = pendingItems.filter((i) => !deletionSet.has(i.id));
|
|
84
88
|
|
|
85
89
|
for (const item of itemsToUpload) {
|
|
86
90
|
const storedBlobs = await getPendingMediaBlobs(item.id);
|
|
@@ -108,11 +112,11 @@ export function useEditorPublish({
|
|
|
108
112
|
|
|
109
113
|
let updatedManifest: MediaManifest | undefined;
|
|
110
114
|
if (hasMediaChanges) {
|
|
111
|
-
const images = { ...
|
|
115
|
+
const images = { ...manifest.images };
|
|
112
116
|
for (const upload of mediaUploads) {
|
|
113
117
|
images[upload.item.id] = upload.item;
|
|
114
118
|
}
|
|
115
|
-
for (const id of
|
|
119
|
+
for (const id of pendingDeletions) {
|
|
116
120
|
delete images[id];
|
|
117
121
|
}
|
|
118
122
|
updatedManifest = { images };
|
|
@@ -121,6 +125,68 @@ export function useEditorPublish({
|
|
|
121
125
|
return { mediaUploads, updatedManifest, hasMediaChanges };
|
|
122
126
|
}
|
|
123
127
|
|
|
128
|
+
async function performSave(args: {
|
|
129
|
+
siteConfig: SiteConfig;
|
|
130
|
+
siteIndexRef: React.RefObject<SiteIndex>;
|
|
131
|
+
deletedSectionIds?: string[];
|
|
132
|
+
isConfigDirty: () => boolean;
|
|
133
|
+
pendingMediaItems: MediaItem[];
|
|
134
|
+
pendingMediaDeletions: string[];
|
|
135
|
+
mediaManifest: MediaManifest;
|
|
136
|
+
}): Promise<{ sha: string }> {
|
|
137
|
+
const dirty = await getDirtySections();
|
|
138
|
+
const gathered = await gatherMediaPayload(
|
|
139
|
+
args.pendingMediaItems,
|
|
140
|
+
args.pendingMediaDeletions,
|
|
141
|
+
args.mediaManifest,
|
|
142
|
+
);
|
|
143
|
+
|
|
144
|
+
let siteIndex = args.siteIndexRef.current;
|
|
145
|
+
if (args.deletedSectionIds?.length) {
|
|
146
|
+
const deleteSet = new Set(args.deletedSectionIds);
|
|
147
|
+
const filteredSections = { ...siteIndex.sections };
|
|
148
|
+
for (const id of args.deletedSectionIds) {
|
|
149
|
+
delete filteredSections[id];
|
|
150
|
+
}
|
|
151
|
+
siteIndex = {
|
|
152
|
+
...siteIndex,
|
|
153
|
+
order: siteIndex.order.filter((id) => !deleteSet.has(id)),
|
|
154
|
+
sections: filteredSections,
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
const response = await fetch("/api/save", {
|
|
159
|
+
method: "POST",
|
|
160
|
+
headers: { "Content-Type": "application/json" },
|
|
161
|
+
body: JSON.stringify({
|
|
162
|
+
sections: dirty.map(({ sectionId, content }) => ({
|
|
163
|
+
id: sectionId,
|
|
164
|
+
content,
|
|
165
|
+
})),
|
|
166
|
+
siteIndex,
|
|
167
|
+
...(args.deletedSectionIds?.length ? { deletedSectionIds: args.deletedSectionIds } : {}),
|
|
168
|
+
...(args.isConfigDirty() ? { siteConfig: args.siteConfig } : {}),
|
|
169
|
+
...(gathered.hasMediaChanges ? {
|
|
170
|
+
media: {
|
|
171
|
+
uploads: gathered.mediaUploads.map(({ item, blobs }) => ({ item, blobs })),
|
|
172
|
+
deletions: args.pendingMediaDeletions.map((id) => ({
|
|
173
|
+
id,
|
|
174
|
+
folder: args.mediaManifest.images[id]?.folder,
|
|
175
|
+
})).filter((d) => d.folder),
|
|
176
|
+
manifest: gathered.updatedManifest,
|
|
177
|
+
},
|
|
178
|
+
} : {}),
|
|
179
|
+
}),
|
|
180
|
+
});
|
|
181
|
+
|
|
182
|
+
if (!response.ok) {
|
|
183
|
+
const errorBody = await response.json().catch(() => ({}));
|
|
184
|
+
throw new Error(errorBody.error || "Save failed");
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
return response.json();
|
|
188
|
+
}
|
|
189
|
+
|
|
124
190
|
const handleSave = useCallback(async () => {
|
|
125
191
|
if (!siteConfig) return;
|
|
126
192
|
|
|
@@ -139,55 +205,11 @@ export function useEditorPublish({
|
|
|
139
205
|
return;
|
|
140
206
|
}
|
|
141
207
|
|
|
142
|
-
const
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
// Build a filtered siteIndex if there are deletions
|
|
146
|
-
let siteIndex = siteIndexRef.current;
|
|
147
|
-
if (deletedSectionIds?.length) {
|
|
148
|
-
const deleteSet = new Set(deletedSectionIds);
|
|
149
|
-
const filteredSections = { ...siteIndex.sections };
|
|
150
|
-
for (const id of deletedSectionIds) {
|
|
151
|
-
delete filteredSections[id];
|
|
152
|
-
}
|
|
153
|
-
siteIndex = {
|
|
154
|
-
...siteIndex,
|
|
155
|
-
order: siteIndex.order.filter((id) => !deleteSet.has(id)),
|
|
156
|
-
sections: filteredSections,
|
|
157
|
-
};
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
const response = await fetch("/api/save", {
|
|
161
|
-
method: "POST",
|
|
162
|
-
headers: { "Content-Type": "application/json" },
|
|
163
|
-
body: JSON.stringify({
|
|
164
|
-
sections: dirty.map(({ sectionId, content }) => ({
|
|
165
|
-
id: sectionId,
|
|
166
|
-
content,
|
|
167
|
-
})),
|
|
168
|
-
siteIndex,
|
|
169
|
-
...(deletedSectionIds?.length ? { deletedSectionIds } : {}),
|
|
170
|
-
...(isConfigDirty() ? { siteConfig } : {}),
|
|
171
|
-
...(mediaChanged ? {
|
|
172
|
-
media: {
|
|
173
|
-
uploads: mediaUploads.map(({ item, blobs }) => ({ item, blobs })),
|
|
174
|
-
deletions: pendingMediaDeletions.map((id) => ({
|
|
175
|
-
id,
|
|
176
|
-
folder: mediaManifest.images[id]?.folder,
|
|
177
|
-
})).filter((d) => d.folder),
|
|
178
|
-
manifest: updatedManifest,
|
|
179
|
-
},
|
|
180
|
-
} : {}),
|
|
181
|
-
}),
|
|
208
|
+
const { sha } = await performSave({
|
|
209
|
+
siteConfig, siteIndexRef, deletedSectionIds,
|
|
210
|
+
isConfigDirty, pendingMediaItems, pendingMediaDeletions, mediaManifest,
|
|
182
211
|
});
|
|
183
212
|
|
|
184
|
-
if (!response.ok) {
|
|
185
|
-
const errorBody = await response.json().catch(() => ({}));
|
|
186
|
-
throw new Error(errorBody.error || "Save failed");
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
const { sha } = await response.json();
|
|
190
|
-
|
|
191
213
|
await discardLocalChanges();
|
|
192
214
|
await clearPendingMedia();
|
|
193
215
|
clearConfigDirty();
|
|
@@ -247,52 +269,10 @@ export function useEditorPublish({
|
|
|
247
269
|
const hasLocalEdits = hasChanges || isConfigDirty() || hasMediaChanges || hasDeletedSections;
|
|
248
270
|
|
|
249
271
|
if (hasLocalEdits) {
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
// Build a filtered siteIndex if there are deletions
|
|
254
|
-
let siteIndex = siteIndexRef.current;
|
|
255
|
-
if (deletedSectionIds?.length) {
|
|
256
|
-
const deleteSet = new Set(deletedSectionIds);
|
|
257
|
-
const filteredSections = { ...siteIndex.sections };
|
|
258
|
-
for (const id of deletedSectionIds) {
|
|
259
|
-
delete filteredSections[id];
|
|
260
|
-
}
|
|
261
|
-
siteIndex = {
|
|
262
|
-
...siteIndex,
|
|
263
|
-
order: siteIndex.order.filter((id) => !deleteSet.has(id)),
|
|
264
|
-
sections: filteredSections,
|
|
265
|
-
};
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
const saveResponse = await fetch("/api/save", {
|
|
269
|
-
method: "POST",
|
|
270
|
-
headers: { "Content-Type": "application/json" },
|
|
271
|
-
body: JSON.stringify({
|
|
272
|
-
sections: dirty.map(({ sectionId, content }) => ({
|
|
273
|
-
id: sectionId,
|
|
274
|
-
content,
|
|
275
|
-
})),
|
|
276
|
-
siteIndex,
|
|
277
|
-
...(deletedSectionIds?.length ? { deletedSectionIds } : {}),
|
|
278
|
-
...(isConfigDirty() ? { siteConfig } : {}),
|
|
279
|
-
...(gathered.hasMediaChanges ? {
|
|
280
|
-
media: {
|
|
281
|
-
uploads: gathered.mediaUploads.map(({ item, blobs }) => ({ item, blobs })),
|
|
282
|
-
deletions: pendingMediaDeletions.map((id) => ({
|
|
283
|
-
id,
|
|
284
|
-
folder: mediaManifest.images[id]?.folder,
|
|
285
|
-
})).filter((d) => d.folder),
|
|
286
|
-
manifest: gathered.updatedManifest,
|
|
287
|
-
},
|
|
288
|
-
} : {}),
|
|
289
|
-
}),
|
|
272
|
+
await performSave({
|
|
273
|
+
siteConfig, siteIndexRef, deletedSectionIds,
|
|
274
|
+
isConfigDirty, pendingMediaItems, pendingMediaDeletions, mediaManifest,
|
|
290
275
|
});
|
|
291
|
-
|
|
292
|
-
if (!saveResponse.ok) {
|
|
293
|
-
const errorBody = await saveResponse.json().catch(() => ({}));
|
|
294
|
-
throw new Error(errorBody.error || "Save failed");
|
|
295
|
-
}
|
|
296
276
|
}
|
|
297
277
|
|
|
298
278
|
setPublishAction("publishing");
|
package/src/lib/dexie.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import Dexie from "dexie";
|
|
2
2
|
import type { SectionContent } from "../schemas/sections";
|
|
3
|
-
import type { SiteIndex, SectionMeta } from "../schemas/site-config";
|
|
3
|
+
import type { SiteIndex, SectionMeta, SiteConfig } from "../schemas/site-config";
|
|
4
4
|
import type { LoadedSection } from "./loader";
|
|
5
5
|
import type { MediaManifest, MediaItem } from "../media/types";
|
|
6
6
|
|
|
@@ -216,12 +216,12 @@ export async function persistSiteIndex(index: SiteIndex, deletedSections: string
|
|
|
216
216
|
});
|
|
217
217
|
}
|
|
218
218
|
|
|
219
|
-
export async function persistSiteConfig(config:
|
|
219
|
+
export async function persistSiteConfig(config: SiteConfig): Promise<void> {
|
|
220
220
|
const now = new Date().toISOString();
|
|
221
221
|
const database = getDb();
|
|
222
222
|
await database.siteConfig.put({
|
|
223
223
|
key: "current",
|
|
224
|
-
config,
|
|
224
|
+
config: config as Record<string, unknown>,
|
|
225
225
|
updatedAt: now,
|
|
226
226
|
});
|
|
227
227
|
}
|
package/src/lib/env.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
declare global {
|
|
2
|
+
interface ImportMeta {
|
|
3
|
+
readonly env?: Record<string, string | undefined>;
|
|
4
|
+
}
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export function env(key: string): string {
|
|
8
|
+
return (
|
|
9
|
+
import.meta.env?.[key] ??
|
|
10
|
+
(typeof process !== "undefined" ? process.env?.[key] : undefined) ??
|
|
11
|
+
""
|
|
12
|
+
);
|
|
13
|
+
}
|
package/src/lib/index.ts
CHANGED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { ColorItem } from "../../schemas/shared";
|
|
2
|
-
interface Props {
|
|
3
|
-
color: ColorItem;
|
|
4
|
-
onChange: (color: ColorItem) => void;
|
|
5
|
-
}
|
|
6
|
-
export default function ColorSwatchSettings({ color, onChange }: Props): import("react/jsx-runtime").JSX.Element;
|
|
7
|
-
export {};
|
|
8
|
-
//# sourceMappingURL=ColorSwatchSettings.d.ts.map
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { ReactNode } from "react";
|
|
2
|
-
import type { ColorItem } from "../../schemas/shared";
|
|
3
|
-
import type { SectionContent } from "../../schemas/sections";
|
|
4
|
-
interface Props {
|
|
5
|
-
colors: ColorItem[];
|
|
6
|
-
columns?: number;
|
|
7
|
-
label?: string;
|
|
8
|
-
collapsing?: boolean;
|
|
9
|
-
showLabel?: boolean;
|
|
10
|
-
onChange?: (content: SectionContent) => void;
|
|
11
|
-
openModal?: (title: string, content: ReactNode) => void;
|
|
12
|
-
}
|
|
13
|
-
export default function Colors({ colors, columns, label, collapsing, showLabel, onChange, openModal }: Props): import("react/jsx-runtime").JSX.Element;
|
|
14
|
-
export {};
|
|
15
|
-
//# sourceMappingURL=Colors.d.ts.map
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { SectionContent } from "../../schemas/sections";
|
|
2
|
-
interface DoDontItem {
|
|
3
|
-
label: string;
|
|
4
|
-
text: string;
|
|
5
|
-
icon?: string;
|
|
6
|
-
}
|
|
7
|
-
interface Props {
|
|
8
|
-
doItems: DoDontItem[];
|
|
9
|
-
dontItems: DoDontItem[];
|
|
10
|
-
showLabel?: boolean;
|
|
11
|
-
stackText?: boolean;
|
|
12
|
-
onChange?: (content: SectionContent) => void;
|
|
13
|
-
}
|
|
14
|
-
export default function DoDontList({ doItems, dontItems, showLabel, stackText, onChange, }: Props): import("react/jsx-runtime").JSX.Element;
|
|
15
|
-
export {};
|
|
16
|
-
//# sourceMappingURL=DoDontList.d.ts.map
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { ReactNode } from "react";
|
|
2
|
-
import type { MediaReference } from "../../schemas/shared";
|
|
3
|
-
import type { SectionContent } from "../../schemas/sections";
|
|
4
|
-
interface Props {
|
|
5
|
-
media: MediaReference[];
|
|
6
|
-
columns: number;
|
|
7
|
-
square?: boolean;
|
|
8
|
-
border?: boolean;
|
|
9
|
-
crop?: boolean;
|
|
10
|
-
showCaptions?: boolean;
|
|
11
|
-
onChange?: (content: SectionContent) => void;
|
|
12
|
-
openModal?: (title: string, content: ReactNode) => void;
|
|
13
|
-
}
|
|
14
|
-
export default function DoDontMediaGrid(props: Props): import("react/jsx-runtime").JSX.Element;
|
|
15
|
-
export {};
|
|
16
|
-
//# sourceMappingURL=DoDontMediaGrid.d.ts.map
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { type ReactNode } from "react";
|
|
2
|
-
interface EditableGridProps<T> {
|
|
3
|
-
items: T[];
|
|
4
|
-
columns: number;
|
|
5
|
-
onChange: (items: T[]) => void;
|
|
6
|
-
createItem: () => T;
|
|
7
|
-
isEditMode: boolean;
|
|
8
|
-
renderItem: (item: T, props: {
|
|
9
|
-
isEditMode: boolean;
|
|
10
|
-
index: number;
|
|
11
|
-
}) => ReactNode;
|
|
12
|
-
onItemSettings?: (index: number) => void;
|
|
13
|
-
onItemImageClick?: (index: number) => void;
|
|
14
|
-
chromeTopClass?: string;
|
|
15
|
-
className?: string;
|
|
16
|
-
}
|
|
17
|
-
export declare function EditableGrid<T>({ items, columns, onChange, createItem, isEditMode, renderItem, onItemSettings, onItemImageClick, chromeTopClass, className, }: EditableGridProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
18
|
-
export {};
|
|
19
|
-
//# sourceMappingURL=EditableGrid.d.ts.map
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { type ElementType, type HTMLAttributes } from "react";
|
|
2
|
-
interface EditablePlainTextProps extends Omit<HTMLAttributes<HTMLElement>, "onChange"> {
|
|
3
|
-
tag: ElementType;
|
|
4
|
-
value: string;
|
|
5
|
-
onChange: (value: string) => void;
|
|
6
|
-
isEditMode: boolean;
|
|
7
|
-
multiline?: boolean;
|
|
8
|
-
placeholder?: string;
|
|
9
|
-
}
|
|
10
|
-
export declare function EditablePlainText({ tag, value, onChange, isEditMode, multiline, placeholder, className, ...htmlAttrs }: EditablePlainTextProps): import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
|
11
|
-
export {};
|
|
12
|
-
//# sourceMappingURL=EditablePlainText.d.ts.map
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { PresetName } from "./tiptap-presets";
|
|
2
|
-
interface EditableRichTextProps {
|
|
3
|
-
value: string;
|
|
4
|
-
onChange: (html: string) => void;
|
|
5
|
-
isEditMode: boolean;
|
|
6
|
-
preset?: PresetName;
|
|
7
|
-
className?: string;
|
|
8
|
-
placeholder?: string;
|
|
9
|
-
}
|
|
10
|
-
export declare function EditableRichText({ value, onChange, isEditMode, preset, className, placeholder, }: EditableRichTextProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
-
export {};
|
|
12
|
-
//# sourceMappingURL=EditableRichText.d.ts.map
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
interface Props {
|
|
2
|
-
heading: string;
|
|
3
|
-
tag: "h2" | "h3" | "h4";
|
|
4
|
-
placeholder: string;
|
|
5
|
-
className?: string;
|
|
6
|
-
onChange?: (heading: string) => void;
|
|
7
|
-
}
|
|
8
|
-
export declare function HeadingSection({ heading, tag, placeholder, className, onChange }: Props): import("react/jsx-runtime").JSX.Element;
|
|
9
|
-
export {};
|
|
10
|
-
//# sourceMappingURL=HeadingSection.d.ts.map
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
interface IconPickerProps {
|
|
2
|
-
selected: string | null;
|
|
3
|
-
onSelect: (iconId: string | null) => void;
|
|
4
|
-
onClose: () => void;
|
|
5
|
-
showRemove?: boolean;
|
|
6
|
-
}
|
|
7
|
-
export declare function IconPicker({ selected, onSelect, onClose, showRemove }: IconPickerProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
-
export {};
|
|
9
|
-
//# sourceMappingURL=IconPicker.d.ts.map
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { Editor } from "@tiptap/core";
|
|
2
|
-
interface LinkPopoverProps {
|
|
3
|
-
editor: Editor;
|
|
4
|
-
onClose: () => void;
|
|
5
|
-
}
|
|
6
|
-
export declare function LinkPopover({ editor, onClose }: LinkPopoverProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
-
export {};
|
|
8
|
-
//# sourceMappingURL=LinkPopover.d.ts.map
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
export declare function ImageSettingsForm({ border, objectFit, onChange, }: {
|
|
2
|
-
border?: boolean;
|
|
3
|
-
objectFit?: "cover" | "contain";
|
|
4
|
-
onChange: (update: {
|
|
5
|
-
border?: boolean;
|
|
6
|
-
objectFit?: "cover" | "contain";
|
|
7
|
-
}) => void;
|
|
8
|
-
}): import("react/jsx-runtime").JSX.Element;
|
|
9
|
-
export declare function DoDontImageSettingsForm({ border, objectFit, doDont: initialDoDont, onChange, }: {
|
|
10
|
-
border?: boolean;
|
|
11
|
-
objectFit?: "cover" | "contain";
|
|
12
|
-
doDont: "do" | "dont";
|
|
13
|
-
onChange: (update: {
|
|
14
|
-
border?: boolean;
|
|
15
|
-
objectFit?: "cover" | "contain";
|
|
16
|
-
doDont: "do" | "dont";
|
|
17
|
-
}) => void;
|
|
18
|
-
}): import("react/jsx-runtime").JSX.Element;
|
|
19
|
-
//# sourceMappingURL=MediaSettingsForms.d.ts.map
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
interface ResolvedMediaProps {
|
|
2
|
-
imageId: string | undefined;
|
|
3
|
-
className?: string;
|
|
4
|
-
imgClassName?: string;
|
|
5
|
-
}
|
|
6
|
-
export declare function ResolvedMedia({ imageId, className, imgClassName, }: ResolvedMediaProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
-
export {};
|
|
8
|
-
//# sourceMappingURL=ResolvedMedia.d.ts.map
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { Editor } from "@tiptap/core";
|
|
2
|
-
import type { PresetName } from "./tiptap-presets";
|
|
3
|
-
interface RichTextToolbarProps {
|
|
4
|
-
editor: Editor;
|
|
5
|
-
preset: PresetName;
|
|
6
|
-
}
|
|
7
|
-
export declare function RichTextToolbar({ editor, preset }: RichTextToolbarProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
-
export {};
|
|
9
|
-
//# sourceMappingURL=RichTextToolbar.d.ts.map
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
interface WrappedItem<T> {
|
|
2
|
-
id: string;
|
|
3
|
-
data: T;
|
|
4
|
-
}
|
|
5
|
-
interface UseEditableCollectionOptions<T> {
|
|
6
|
-
items: T[];
|
|
7
|
-
onChange: (items: T[]) => void;
|
|
8
|
-
createItem: () => T;
|
|
9
|
-
}
|
|
10
|
-
interface UseEditableCollectionReturn<T> {
|
|
11
|
-
wrappedItems: WrappedItem<T>[];
|
|
12
|
-
onReorder: (fromIndex: number, toIndex: number) => void;
|
|
13
|
-
onAdd: () => void;
|
|
14
|
-
onInsert: (index: number) => void;
|
|
15
|
-
onRemove: (id: string) => void;
|
|
16
|
-
}
|
|
17
|
-
export declare function useEditableCollection<T>({ items, onChange, createItem, }: UseEditableCollectionOptions<T>): UseEditableCollectionReturn<T>;
|
|
18
|
-
export {};
|
|
19
|
-
//# sourceMappingURL=useEditableCollection.d.ts.map
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
interface UseEditablePlainTextOptions {
|
|
2
|
-
value: string;
|
|
3
|
-
onChange: (value: string) => void;
|
|
4
|
-
multiline?: boolean;
|
|
5
|
-
}
|
|
6
|
-
interface UseEditablePlainTextReturn {
|
|
7
|
-
value: string;
|
|
8
|
-
handleInput: (text: string) => void;
|
|
9
|
-
handleBlur: () => void;
|
|
10
|
-
shouldPreventEnter: boolean;
|
|
11
|
-
}
|
|
12
|
-
export declare function useEditablePlainText({ value: propValue, onChange, multiline, }: UseEditablePlainTextOptions): UseEditablePlainTextReturn;
|
|
13
|
-
export {};
|
|
14
|
-
//# sourceMappingURL=useEditablePlainText.d.ts.map
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { Editor } from "@tiptap/core";
|
|
2
|
-
import { type PresetName } from "./tiptap-presets";
|
|
3
|
-
interface UseEditableRichTextOptions {
|
|
4
|
-
value: string;
|
|
5
|
-
onChange: (html: string) => void;
|
|
6
|
-
preset: PresetName;
|
|
7
|
-
placeholder?: string;
|
|
8
|
-
}
|
|
9
|
-
interface UseEditableRichTextReturn {
|
|
10
|
-
isEditorActive: boolean;
|
|
11
|
-
editor: Editor | null;
|
|
12
|
-
activate: () => void;
|
|
13
|
-
deactivate: () => void;
|
|
14
|
-
}
|
|
15
|
-
export declare function useEditableRichText({ value, onChange, preset, placeholder, }: UseEditableRichTextOptions): UseEditableRichTextReturn;
|
|
16
|
-
export {};
|
|
17
|
-
//# sourceMappingURL=useEditableRichText.d.ts.map
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { SectionContent } from "../../../schemas/sections";
|
|
2
|
-
interface Props {
|
|
3
|
-
text: string;
|
|
4
|
-
href?: string;
|
|
5
|
-
target?: string;
|
|
6
|
-
download?: boolean;
|
|
7
|
-
onChange?: (content: SectionContent) => void;
|
|
8
|
-
}
|
|
9
|
-
export default function Button({ text, href, target, download, onChange }: Props): import("react/jsx-runtime").JSX.Element;
|
|
10
|
-
export {};
|
|
11
|
-
//# sourceMappingURL=CTAButton.d.ts.map
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
declare const _default: import("../../../lib/registry").SectionDefinition<{
|
|
2
|
-
type: "button";
|
|
3
|
-
content: {
|
|
4
|
-
text: string;
|
|
5
|
-
href?: string | undefined;
|
|
6
|
-
target?: string | undefined;
|
|
7
|
-
download?: boolean | undefined;
|
|
8
|
-
};
|
|
9
|
-
}>;
|
|
10
|
-
export default _default;
|
|
11
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
declare const _default: import("../../../lib/registry").SectionDefinition<{
|
|
2
|
-
type: "colors";
|
|
3
|
-
content: {
|
|
4
|
-
colors: {
|
|
5
|
-
spaces: {
|
|
6
|
-
hex?: string | undefined;
|
|
7
|
-
rgb?: string | undefined;
|
|
8
|
-
cmyk?: string | undefined;
|
|
9
|
-
pantone?: string | undefined;
|
|
10
|
-
}[];
|
|
11
|
-
name?: string | undefined;
|
|
12
|
-
}[];
|
|
13
|
-
};
|
|
14
|
-
options?: {
|
|
15
|
-
label?: string | undefined;
|
|
16
|
-
columns?: number | undefined;
|
|
17
|
-
collapsing?: boolean | undefined;
|
|
18
|
-
showLabel?: boolean | undefined;
|
|
19
|
-
} | undefined;
|
|
20
|
-
}>;
|
|
21
|
-
export default _default;
|
|
22
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
declare const _default: import("../../../lib/registry").SectionDefinition<{
|
|
2
|
-
type: "do_dont";
|
|
3
|
-
content: {
|
|
4
|
-
doItems: {
|
|
5
|
-
label: string;
|
|
6
|
-
text: string;
|
|
7
|
-
icon?: string | undefined;
|
|
8
|
-
}[];
|
|
9
|
-
dontItems: {
|
|
10
|
-
label: string;
|
|
11
|
-
text: string;
|
|
12
|
-
icon?: string | undefined;
|
|
13
|
-
}[];
|
|
14
|
-
};
|
|
15
|
-
options?: {
|
|
16
|
-
showLabel?: boolean | undefined;
|
|
17
|
-
stackText?: boolean | undefined;
|
|
18
|
-
} | undefined;
|
|
19
|
-
}>;
|
|
20
|
-
export default _default;
|
|
21
|
-
//# sourceMappingURL=index.d.ts.map
|