@drawnagency/primitives 0.1.71 → 0.1.72
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-RTYJZAKR.js → chunk-2HZB675H.js} +12 -12
- package/dist/chunk-7SIZ2LV5.js +117 -0
- package/dist/{chunk-2BHPWO7M.js → chunk-BTGHF3SW.js} +158 -32
- package/dist/{chunk-3DCG4DNU.js → chunk-PZJL2S3Z.js} +8 -4
- package/dist/chunk-RBTSUR5V.js +37 -0
- package/dist/{chunk-NR7UB6DZ.js → chunk-SFKYUKVN.js} +1 -1
- package/dist/{chunk-YMVYTYGQ.js → chunk-SWIHUIFT.js} +28 -16
- package/dist/{chunk-6UDYJQL6.js → chunk-TOBPMMRM.js} +1 -1
- package/dist/{chunk-MU3CDERQ.js → chunk-UBK2IZ6G.js} +276 -96
- package/dist/{chunk-WXVKX6PY.js → chunk-VHINNGIF.js} +41 -95
- package/dist/{chunk-KWBM27UR.js → chunk-WCALKWPO.js} +4 -59
- package/dist/{chunk-GKV77AA6.js → chunk-ZRWGV5O6.js} +3 -3
- package/dist/chunk-ZSPCE6MZ.js +70 -0
- package/dist/components/editor/SettingsForm.d.ts.map +1 -1
- package/dist/components/editor/index.js +6 -3
- package/dist/components/primitives/index.js +7 -7
- package/dist/components/sections/Video/VideoBlock.d.ts +31 -0
- package/dist/components/sections/Video/VideoBlock.d.ts.map +1 -0
- package/dist/components/sections/Video/index.d.ts +28 -0
- package/dist/components/sections/Video/index.d.ts.map +1 -0
- package/dist/components/sections/all-sections.d.ts +25 -0
- package/dist/components/sections/all-sections.d.ts.map +1 -1
- package/dist/components/sections/brand-guide.js +7 -7
- package/dist/components/sections/core-sections.d.ts +25 -0
- package/dist/components/sections/core-sections.d.ts.map +1 -1
- package/dist/components/sections/register-schemas.js +13 -12
- package/dist/components/sections/register.js +13 -12
- package/dist/components/shared/Tabs.d.ts +1 -1
- package/dist/components/shared/VideoSourceField.d.ts +8 -0
- package/dist/components/shared/VideoSourceField.d.ts.map +1 -0
- package/dist/components/shell/EditorShell.d.ts.map +1 -1
- package/dist/components/shell/MediaLibraryModal.d.ts +4 -1
- package/dist/components/shell/MediaLibraryModal.d.ts.map +1 -1
- package/dist/hooks/useEditorPublish.d.ts.map +1 -1
- package/dist/hooks/useMediaPipeline.d.ts +9 -1
- package/dist/hooks/useMediaPipeline.d.ts.map +1 -1
- package/dist/index.js +24 -24
- package/dist/lib/index.js +10 -10
- package/dist/lib/registry.d.ts +6 -0
- package/dist/lib/registry.d.ts.map +1 -1
- package/dist/lib/video-url.d.ts +7 -0
- package/dist/lib/video-url.d.ts.map +1 -0
- package/dist/lib/video-url.js +9 -0
- package/dist/media/index.js +2 -2
- package/dist/media/videoPoster.d.ts +1 -0
- package/dist/media/videoPoster.d.ts.map +1 -1
- package/dist/schemas/index.js +4 -4
- package/dist/schemas/link.d.ts.map +1 -1
- package/dist/schemas/link.js +1 -1
- package/dist/schemas/media.d.ts +13 -0
- package/dist/schemas/media.d.ts.map +1 -1
- package/dist/schemas/shared.d.ts.map +1 -1
- package/dist/schemas/site-config.d.ts +1 -0
- package/dist/schemas/site-config.d.ts.map +1 -1
- package/dist/storage/index.d.ts +1 -1
- package/dist/storage/index.d.ts.map +1 -1
- package/dist/storage/types.d.ts +26 -0
- package/dist/storage/types.d.ts.map +1 -1
- package/package.json +5 -1
- package/src/components/editor/SettingsForm.tsx +11 -0
- package/src/components/sections/Video/VideoBlock.tsx +149 -0
- package/src/components/sections/Video/index.tsx +111 -0
- package/src/components/sections/core-sections.ts +2 -0
- package/src/components/shared/Tabs.tsx +2 -2
- package/src/components/shared/VideoSourceField.tsx +144 -0
- package/src/components/shell/EditorShell.tsx +8 -0
- package/src/components/shell/MediaLibraryModal.tsx +47 -1
- package/src/hooks/useEditorPublish.ts +3 -0
- package/src/hooks/useMediaPipeline.ts +188 -25
- package/src/lib/registry.ts +7 -0
- package/src/lib/video-url.ts +39 -0
- package/src/media/videoPoster.ts +2 -2
- package/src/schemas/link.ts +15 -4
- package/src/schemas/media.ts +12 -0
- package/src/schemas/shared.ts +23 -14
- package/src/storage/index.ts +1 -1
- package/src/storage/types.ts +23 -0
- package/dist/chunk-4E66N6UV.js +0 -10
- package/dist/chunk-I5737FJY.js +0 -62
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
EditablePlainText
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-WCALKWPO.js";
|
|
4
4
|
import {
|
|
5
|
+
Button,
|
|
5
6
|
usePages
|
|
6
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-ZSPCE6MZ.js";
|
|
7
8
|
import {
|
|
8
9
|
sanitizeHtml,
|
|
9
10
|
toSectionId
|
|
@@ -78,61 +79,6 @@ function defineHeadingSection(config) {
|
|
|
78
79
|
// src/components/primitives/LinkPopover.tsx
|
|
79
80
|
import { useState } from "react";
|
|
80
81
|
|
|
81
|
-
// src/components/shared/Button.tsx
|
|
82
|
-
import { forwardRef } from "react";
|
|
83
|
-
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
84
|
-
var boxSize = {
|
|
85
|
-
sm: "rounded px-3 py-1.5 text-xs font-medium",
|
|
86
|
-
md: "rounded px-4 py-2 text-sm font-medium"
|
|
87
|
-
};
|
|
88
|
-
var ghostSize = {
|
|
89
|
-
sm: "text-xs font-medium",
|
|
90
|
-
md: "text-sm font-medium"
|
|
91
|
-
};
|
|
92
|
-
var variantClasses = {
|
|
93
|
-
primary: "bg-base-contrast text-base-accent hover:bg-base-contrast/90",
|
|
94
|
-
brand: "bg-primary text-primary-contrast hover:opacity-90",
|
|
95
|
-
secondary: "border border-base-200 text-base-contrast hover:bg-base-accent",
|
|
96
|
-
destructive: "border border-red-600 text-red-600 hover:bg-red-600 hover:text-white"
|
|
97
|
-
};
|
|
98
|
-
var ghostToneClasses = {
|
|
99
|
-
neutral: "text-base-contrast-light hover:text-base-contrast",
|
|
100
|
-
destructive: "text-red-600 hover:text-red-800"
|
|
101
|
-
};
|
|
102
|
-
var Button = forwardRef(function Button2({
|
|
103
|
-
variant = "primary",
|
|
104
|
-
size = "sm",
|
|
105
|
-
tone = "neutral",
|
|
106
|
-
fullWidth = false,
|
|
107
|
-
isLoading = false,
|
|
108
|
-
loadingLabel,
|
|
109
|
-
disabled,
|
|
110
|
-
className,
|
|
111
|
-
children,
|
|
112
|
-
...rest
|
|
113
|
-
}, ref) {
|
|
114
|
-
const isGhost = variant === "ghost";
|
|
115
|
-
const resolvedDisabled = disabled || isLoading;
|
|
116
|
-
const label = isLoading && loadingLabel ? loadingLabel : children;
|
|
117
|
-
return /* @__PURE__ */ jsx3(
|
|
118
|
-
"button",
|
|
119
|
-
{
|
|
120
|
-
ref,
|
|
121
|
-
disabled: resolvedDisabled,
|
|
122
|
-
className: cn(
|
|
123
|
-
"inline-flex items-center justify-center transition-colors",
|
|
124
|
-
isGhost ? ghostSize[size] : boxSize[size],
|
|
125
|
-
isGhost ? ghostToneClasses[tone] : variantClasses[variant],
|
|
126
|
-
fullWidth && "w-full",
|
|
127
|
-
resolvedDisabled ? "cursor-not-allowed opacity-50" : "cursor-pointer",
|
|
128
|
-
className
|
|
129
|
-
),
|
|
130
|
-
...rest,
|
|
131
|
-
children: label
|
|
132
|
-
}
|
|
133
|
-
);
|
|
134
|
-
});
|
|
135
|
-
|
|
136
82
|
// src/lib/links.ts
|
|
137
83
|
function internalHref(pageId, anchorSectionId) {
|
|
138
84
|
return `page://${pageId}${anchorSectionId ? `#${anchorSectionId}` : ""}`;
|
|
@@ -143,7 +89,7 @@ function parseInternalHref(href) {
|
|
|
143
89
|
}
|
|
144
90
|
|
|
145
91
|
// src/components/primitives/LinkPopover.tsx
|
|
146
|
-
import { Fragment, jsx as
|
|
92
|
+
import { Fragment, jsx as jsx3, jsxs } from "react/jsx-runtime";
|
|
147
93
|
var selectClasses = "w-full rounded border border-base-contrast/20 bg-base px-2 py-1 text-sm text-base-contrast focus:outline-none focus:ring-1 focus:ring-primary";
|
|
148
94
|
function LinkPopover({ editor, onClose }) {
|
|
149
95
|
const { pages, getPageHeadings } = usePages();
|
|
@@ -188,7 +134,7 @@ function LinkPopover({ editor, onClose }) {
|
|
|
188
134
|
onMouseDown: (e) => e.stopPropagation(),
|
|
189
135
|
onKeyDown: handleKeyDown,
|
|
190
136
|
children: [
|
|
191
|
-
/* @__PURE__ */
|
|
137
|
+
/* @__PURE__ */ jsx3("div", { className: "flex gap-2", role: "tablist", children: ["external", "internal"].map((kind) => /* @__PURE__ */ jsx3(
|
|
192
138
|
"button",
|
|
193
139
|
{
|
|
194
140
|
type: "button",
|
|
@@ -204,7 +150,7 @@ function LinkPopover({ editor, onClose }) {
|
|
|
204
150
|
kind
|
|
205
151
|
)) }),
|
|
206
152
|
mode === "external" ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
207
|
-
/* @__PURE__ */
|
|
153
|
+
/* @__PURE__ */ jsx3(
|
|
208
154
|
"input",
|
|
209
155
|
{
|
|
210
156
|
autoFocus: true,
|
|
@@ -216,7 +162,7 @@ function LinkPopover({ editor, onClose }) {
|
|
|
216
162
|
}
|
|
217
163
|
),
|
|
218
164
|
/* @__PURE__ */ jsxs("label", { className: "flex cursor-pointer items-center gap-2 text-sm text-base-contrast", children: [
|
|
219
|
-
/* @__PURE__ */
|
|
165
|
+
/* @__PURE__ */ jsx3(
|
|
220
166
|
"input",
|
|
221
167
|
{
|
|
222
168
|
type: "checkbox",
|
|
@@ -240,8 +186,8 @@ function LinkPopover({ editor, onClose }) {
|
|
|
240
186
|
},
|
|
241
187
|
className: selectClasses,
|
|
242
188
|
children: [
|
|
243
|
-
/* @__PURE__ */
|
|
244
|
-
pages.map((p) => /* @__PURE__ */
|
|
189
|
+
/* @__PURE__ */ jsx3("option", { value: "", children: "Select a page\u2026" }),
|
|
190
|
+
pages.map((p) => /* @__PURE__ */ jsx3("option", { value: p.id, children: p.title }, p.id))
|
|
245
191
|
]
|
|
246
192
|
}
|
|
247
193
|
),
|
|
@@ -254,14 +200,14 @@ function LinkPopover({ editor, onClose }) {
|
|
|
254
200
|
onChange: (e) => setAnchorId(e.target.value),
|
|
255
201
|
className: cn(selectClasses, !pageId && "cursor-not-allowed opacity-50"),
|
|
256
202
|
children: [
|
|
257
|
-
/* @__PURE__ */
|
|
258
|
-
headings.map((h) => /* @__PURE__ */
|
|
203
|
+
/* @__PURE__ */ jsx3("option", { value: "", children: "None (top of page)" }),
|
|
204
|
+
headings.map((h) => /* @__PURE__ */ jsx3("option", { value: h.id, children: h.label }, h.id))
|
|
259
205
|
]
|
|
260
206
|
}
|
|
261
207
|
)
|
|
262
208
|
] }),
|
|
263
209
|
/* @__PURE__ */ jsxs("div", { className: "flex gap-2", children: [
|
|
264
|
-
/* @__PURE__ */
|
|
210
|
+
/* @__PURE__ */ jsx3(
|
|
265
211
|
Button,
|
|
266
212
|
{
|
|
267
213
|
variant: "brand",
|
|
@@ -273,7 +219,7 @@ function LinkPopover({ editor, onClose }) {
|
|
|
273
219
|
children: "Apply"
|
|
274
220
|
}
|
|
275
221
|
),
|
|
276
|
-
hasLink && /* @__PURE__ */
|
|
222
|
+
hasLink && /* @__PURE__ */ jsx3(
|
|
277
223
|
Button,
|
|
278
224
|
{
|
|
279
225
|
variant: "secondary",
|
|
@@ -285,7 +231,7 @@ function LinkPopover({ editor, onClose }) {
|
|
|
285
231
|
children: "Remove"
|
|
286
232
|
}
|
|
287
233
|
),
|
|
288
|
-
/* @__PURE__ */
|
|
234
|
+
/* @__PURE__ */ jsx3(
|
|
289
235
|
Button,
|
|
290
236
|
{
|
|
291
237
|
variant: "secondary",
|
|
@@ -504,9 +450,9 @@ function useEditableRichText({
|
|
|
504
450
|
// src/components/primitives/RichTextToolbar.tsx
|
|
505
451
|
import { useState as useState3 } from "react";
|
|
506
452
|
import { useEditorState } from "@tiptap/react";
|
|
507
|
-
import { Fragment as Fragment2, jsx as
|
|
453
|
+
import { Fragment as Fragment2, jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
508
454
|
function ToolbarButton({ isActive, onClick, title, children }) {
|
|
509
|
-
return /* @__PURE__ */
|
|
455
|
+
return /* @__PURE__ */ jsx4(
|
|
510
456
|
"button",
|
|
511
457
|
{
|
|
512
458
|
type: "button",
|
|
@@ -526,7 +472,7 @@ function ToolbarButton({ isActive, onClick, title, children }) {
|
|
|
526
472
|
);
|
|
527
473
|
}
|
|
528
474
|
function Separator() {
|
|
529
|
-
return /* @__PURE__ */
|
|
475
|
+
return /* @__PURE__ */ jsx4("div", { className: "mx-1 h-5 w-px bg-base-contrast/20" });
|
|
530
476
|
}
|
|
531
477
|
function RichTextToolbar({ editor, preset }) {
|
|
532
478
|
const [showLinkPopover, setShowLinkPopover] = useState3(false);
|
|
@@ -558,37 +504,37 @@ function RichTextToolbar({ editor, preset }) {
|
|
|
558
504
|
"data-testid": "rich-text-toolbar",
|
|
559
505
|
className: "flex items-center gap-1 rounded border border-base-contrast/10 bg-base-accent p-1 shadow-md",
|
|
560
506
|
children: [
|
|
561
|
-
/* @__PURE__ */
|
|
507
|
+
/* @__PURE__ */ jsx4(
|
|
562
508
|
ToolbarButton,
|
|
563
509
|
{
|
|
564
510
|
isActive: state.isBold,
|
|
565
511
|
onClick: () => editor.chain().focus().toggleBold().run(),
|
|
566
512
|
title: "Bold",
|
|
567
|
-
children: /* @__PURE__ */
|
|
513
|
+
children: /* @__PURE__ */ jsx4("strong", { children: "B" })
|
|
568
514
|
}
|
|
569
515
|
),
|
|
570
|
-
/* @__PURE__ */
|
|
516
|
+
/* @__PURE__ */ jsx4(
|
|
571
517
|
ToolbarButton,
|
|
572
518
|
{
|
|
573
519
|
isActive: state.isItalic,
|
|
574
520
|
onClick: () => editor.chain().focus().toggleItalic().run(),
|
|
575
521
|
title: "Italic",
|
|
576
|
-
children: /* @__PURE__ */
|
|
522
|
+
children: /* @__PURE__ */ jsx4("em", { children: "I" })
|
|
577
523
|
}
|
|
578
524
|
),
|
|
579
|
-
/* @__PURE__ */
|
|
525
|
+
/* @__PURE__ */ jsx4(
|
|
580
526
|
ToolbarButton,
|
|
581
527
|
{
|
|
582
528
|
isActive: state.isUnderline,
|
|
583
529
|
onClick: () => editor.chain().focus().toggleUnderline().run(),
|
|
584
530
|
title: "Underline",
|
|
585
|
-
children: /* @__PURE__ */
|
|
531
|
+
children: /* @__PURE__ */ jsx4("span", { className: "underline", children: "U" })
|
|
586
532
|
}
|
|
587
533
|
),
|
|
588
534
|
preset === "rich" && /* @__PURE__ */ jsxs2(Fragment2, { children: [
|
|
589
|
-
/* @__PURE__ */
|
|
535
|
+
/* @__PURE__ */ jsx4(Separator, {}),
|
|
590
536
|
/* @__PURE__ */ jsxs2("div", { className: "relative", children: [
|
|
591
|
-
/* @__PURE__ */
|
|
537
|
+
/* @__PURE__ */ jsx4(
|
|
592
538
|
ToolbarButton,
|
|
593
539
|
{
|
|
594
540
|
isActive: state.isLink || showLinkPopover,
|
|
@@ -597,7 +543,7 @@ function RichTextToolbar({ editor, preset }) {
|
|
|
597
543
|
children: "\u{1F517}"
|
|
598
544
|
}
|
|
599
545
|
),
|
|
600
|
-
showLinkPopover && /* @__PURE__ */
|
|
546
|
+
showLinkPopover && /* @__PURE__ */ jsx4("div", { className: "absolute left-0 top-full z-50 mt-1", children: /* @__PURE__ */ jsx4(
|
|
601
547
|
LinkPopover,
|
|
602
548
|
{
|
|
603
549
|
editor,
|
|
@@ -605,8 +551,8 @@ function RichTextToolbar({ editor, preset }) {
|
|
|
605
551
|
}
|
|
606
552
|
) })
|
|
607
553
|
] }),
|
|
608
|
-
/* @__PURE__ */
|
|
609
|
-
/* @__PURE__ */
|
|
554
|
+
/* @__PURE__ */ jsx4(Separator, {}),
|
|
555
|
+
/* @__PURE__ */ jsx4(
|
|
610
556
|
ToolbarButton,
|
|
611
557
|
{
|
|
612
558
|
isActive: state.isBulletList,
|
|
@@ -615,7 +561,7 @@ function RichTextToolbar({ editor, preset }) {
|
|
|
615
561
|
children: "\u2022\u2261"
|
|
616
562
|
}
|
|
617
563
|
),
|
|
618
|
-
/* @__PURE__ */
|
|
564
|
+
/* @__PURE__ */ jsx4(
|
|
619
565
|
ToolbarButton,
|
|
620
566
|
{
|
|
621
567
|
isActive: state.isOrderedList,
|
|
@@ -624,8 +570,8 @@ function RichTextToolbar({ editor, preset }) {
|
|
|
624
570
|
children: "1\u2261"
|
|
625
571
|
}
|
|
626
572
|
),
|
|
627
|
-
/* @__PURE__ */
|
|
628
|
-
/* @__PURE__ */
|
|
573
|
+
/* @__PURE__ */ jsx4(Separator, {}),
|
|
574
|
+
/* @__PURE__ */ jsx4(
|
|
629
575
|
ToolbarButton,
|
|
630
576
|
{
|
|
631
577
|
isActive: state.isH3,
|
|
@@ -634,7 +580,7 @@ function RichTextToolbar({ editor, preset }) {
|
|
|
634
580
|
children: "H3"
|
|
635
581
|
}
|
|
636
582
|
),
|
|
637
|
-
/* @__PURE__ */
|
|
583
|
+
/* @__PURE__ */ jsx4(
|
|
638
584
|
ToolbarButton,
|
|
639
585
|
{
|
|
640
586
|
isActive: state.isH4,
|
|
@@ -643,7 +589,7 @@ function RichTextToolbar({ editor, preset }) {
|
|
|
643
589
|
children: "H4"
|
|
644
590
|
}
|
|
645
591
|
),
|
|
646
|
-
/* @__PURE__ */
|
|
592
|
+
/* @__PURE__ */ jsx4(
|
|
647
593
|
ToolbarButton,
|
|
648
594
|
{
|
|
649
595
|
isActive: state.isLarge,
|
|
@@ -652,7 +598,7 @@ function RichTextToolbar({ editor, preset }) {
|
|
|
652
598
|
children: "Lg"
|
|
653
599
|
}
|
|
654
600
|
),
|
|
655
|
-
/* @__PURE__ */
|
|
601
|
+
/* @__PURE__ */ jsx4(
|
|
656
602
|
ToolbarButton,
|
|
657
603
|
{
|
|
658
604
|
isActive: state.isLeadIn,
|
|
@@ -668,7 +614,7 @@ function RichTextToolbar({ editor, preset }) {
|
|
|
668
614
|
}
|
|
669
615
|
|
|
670
616
|
// src/components/primitives/EditableRichText.tsx
|
|
671
|
-
import { jsx as
|
|
617
|
+
import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
672
618
|
function isContentEmpty(html) {
|
|
673
619
|
return html.replace(/<[^>]*>/g, "").trim().length === 0;
|
|
674
620
|
}
|
|
@@ -736,7 +682,7 @@ function EditableRichText({
|
|
|
736
682
|
}, 150);
|
|
737
683
|
}, [deactivate]);
|
|
738
684
|
if (!isEditMode) {
|
|
739
|
-
return /* @__PURE__ */
|
|
685
|
+
return /* @__PURE__ */ jsx5(
|
|
740
686
|
"div",
|
|
741
687
|
{
|
|
742
688
|
className,
|
|
@@ -747,9 +693,9 @@ function EditableRichText({
|
|
|
747
693
|
if (!isEditorActive || !editor) {
|
|
748
694
|
const empty = isContentEmpty(value);
|
|
749
695
|
if (empty) {
|
|
750
|
-
return /* @__PURE__ */
|
|
696
|
+
return /* @__PURE__ */ jsx5("div", { className, onClick: handleClick, children: /* @__PURE__ */ jsx5("p", { className: "tiptap-placeholder", children: placeholder }) });
|
|
751
697
|
}
|
|
752
|
-
return /* @__PURE__ */
|
|
698
|
+
return /* @__PURE__ */ jsx5(
|
|
753
699
|
"div",
|
|
754
700
|
{
|
|
755
701
|
className,
|
|
@@ -766,7 +712,7 @@ function EditableRichText({
|
|
|
766
712
|
onFocus: handleFocus,
|
|
767
713
|
onBlur: handleBlur,
|
|
768
714
|
children: [
|
|
769
|
-
/* @__PURE__ */
|
|
715
|
+
/* @__PURE__ */ jsx5(
|
|
770
716
|
BubbleMenu,
|
|
771
717
|
{
|
|
772
718
|
editor,
|
|
@@ -775,10 +721,10 @@ function EditableRichText({
|
|
|
775
721
|
const { from, to } = state.selection;
|
|
776
722
|
return ed.isFocused && from !== to;
|
|
777
723
|
},
|
|
778
|
-
children: /* @__PURE__ */
|
|
724
|
+
children: /* @__PURE__ */ jsx5(RichTextToolbar, { editor, preset })
|
|
779
725
|
}
|
|
780
726
|
),
|
|
781
|
-
/* @__PURE__ */
|
|
727
|
+
/* @__PURE__ */ jsx5(EditorContent, { editor })
|
|
782
728
|
]
|
|
783
729
|
}
|
|
784
730
|
);
|
|
@@ -3,11 +3,10 @@ import {
|
|
|
3
3
|
DeleteIcon,
|
|
4
4
|
DragHandle,
|
|
5
5
|
IconButton,
|
|
6
|
-
SettingsIcon
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
} from "./chunk-6UDYJQL6.js";
|
|
6
|
+
SettingsIcon,
|
|
7
|
+
useMediaLibrary,
|
|
8
|
+
useResolvedMedia
|
|
9
|
+
} from "./chunk-7SIZ2LV5.js";
|
|
11
10
|
import {
|
|
12
11
|
cn
|
|
13
12
|
} from "./chunk-7EOSDFS3.js";
|
|
@@ -128,60 +127,6 @@ function EditablePlainText({
|
|
|
128
127
|
// src/components/primitives/ResolvedMedia.tsx
|
|
129
128
|
import { useState as useState2 } from "react";
|
|
130
129
|
import { ImageIcon } from "lucide-react";
|
|
131
|
-
|
|
132
|
-
// src/hooks/useResolvedMedia.ts
|
|
133
|
-
import { useMemo } from "react";
|
|
134
|
-
|
|
135
|
-
// src/components/shell/MediaLibraryContext.tsx
|
|
136
|
-
import { createContext, useContext } from "react";
|
|
137
|
-
var MediaLibraryContext = createContext(null);
|
|
138
|
-
function useMediaLibrary() {
|
|
139
|
-
return useContext(MediaLibraryContext);
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
// src/hooks/useResolvedMedia.ts
|
|
143
|
-
function useResolvedMedia(imageId) {
|
|
144
|
-
const ctx = useMediaLibrary();
|
|
145
|
-
return useMemo(() => {
|
|
146
|
-
if (!imageId || !ctx) {
|
|
147
|
-
return { src: void 0, srcset: void 0, poster: void 0, alt: "", kind: "image" };
|
|
148
|
-
}
|
|
149
|
-
const { manifest, pendingItems, pendingLocalUrls, siteConfig } = ctx;
|
|
150
|
-
const sizes = siteConfig?.media?.sizes ?? [640, 1080, 1920];
|
|
151
|
-
const manifestItem = manifest.images[imageId];
|
|
152
|
-
const pendingItem = pendingItems.find((i) => i.id === imageId);
|
|
153
|
-
const item = manifestItem ?? pendingItem;
|
|
154
|
-
const alt = item?.alt ?? "";
|
|
155
|
-
const kind = item?.kind ?? "image";
|
|
156
|
-
const width = item?.width;
|
|
157
|
-
const height = item?.height;
|
|
158
|
-
const localUrl = pendingLocalUrls[imageId];
|
|
159
|
-
if (localUrl) {
|
|
160
|
-
return { src: localUrl, srcset: void 0, poster: void 0, alt, kind, width, height };
|
|
161
|
-
}
|
|
162
|
-
if (manifestItem) {
|
|
163
|
-
const provider = getMediaProvider();
|
|
164
|
-
const resolved = provider.resolve(manifestItem, sizes);
|
|
165
|
-
if (resolved && resolved.tag === "img") {
|
|
166
|
-
return {
|
|
167
|
-
src: resolved.src,
|
|
168
|
-
srcset: "srcSet" in resolved ? resolved.srcSet : void 0,
|
|
169
|
-
poster: void 0,
|
|
170
|
-
alt,
|
|
171
|
-
kind,
|
|
172
|
-
width: resolved.width,
|
|
173
|
-
height: resolved.height
|
|
174
|
-
};
|
|
175
|
-
}
|
|
176
|
-
if (resolved && resolved.tag === "video") {
|
|
177
|
-
return { src: resolved.src, srcset: void 0, poster: resolved.poster, alt, kind, width: resolved.width, height: resolved.height };
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
return { src: void 0, srcset: void 0, poster: void 0, alt, kind, width, height };
|
|
181
|
-
}, [imageId, ctx]);
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
// src/components/primitives/ResolvedMedia.tsx
|
|
185
130
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
186
131
|
function ResolvedMedia({
|
|
187
132
|
imageId,
|
|
@@ -7,12 +7,12 @@ import {
|
|
|
7
7
|
import {
|
|
8
8
|
getSectionSchema
|
|
9
9
|
} from "./chunk-TZQPOR5A.js";
|
|
10
|
-
import {
|
|
11
|
-
IndexSchema
|
|
12
|
-
} from "./chunk-YMVYTYGQ.js";
|
|
13
10
|
import {
|
|
14
11
|
getAllSchemas
|
|
15
12
|
} from "./chunk-VKAGMEKE.js";
|
|
13
|
+
import {
|
|
14
|
+
IndexSchema
|
|
15
|
+
} from "./chunk-SWIHUIFT.js";
|
|
16
16
|
import {
|
|
17
17
|
MAX_BLOCK_DEPTH,
|
|
18
18
|
blockDepth
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import {
|
|
2
|
+
cn
|
|
3
|
+
} from "./chunk-7EOSDFS3.js";
|
|
4
|
+
|
|
5
|
+
// src/components/shared/Button.tsx
|
|
6
|
+
import { forwardRef } from "react";
|
|
7
|
+
import { jsx } from "react/jsx-runtime";
|
|
8
|
+
var boxSize = {
|
|
9
|
+
sm: "rounded px-3 py-1.5 text-xs font-medium",
|
|
10
|
+
md: "rounded px-4 py-2 text-sm font-medium"
|
|
11
|
+
};
|
|
12
|
+
var ghostSize = {
|
|
13
|
+
sm: "text-xs font-medium",
|
|
14
|
+
md: "text-sm font-medium"
|
|
15
|
+
};
|
|
16
|
+
var variantClasses = {
|
|
17
|
+
primary: "bg-base-contrast text-base-accent hover:bg-base-contrast/90",
|
|
18
|
+
brand: "bg-primary text-primary-contrast hover:opacity-90",
|
|
19
|
+
secondary: "border border-base-200 text-base-contrast hover:bg-base-accent",
|
|
20
|
+
destructive: "border border-red-600 text-red-600 hover:bg-red-600 hover:text-white"
|
|
21
|
+
};
|
|
22
|
+
var ghostToneClasses = {
|
|
23
|
+
neutral: "text-base-contrast-light hover:text-base-contrast",
|
|
24
|
+
destructive: "text-red-600 hover:text-red-800"
|
|
25
|
+
};
|
|
26
|
+
var Button = forwardRef(function Button2({
|
|
27
|
+
variant = "primary",
|
|
28
|
+
size = "sm",
|
|
29
|
+
tone = "neutral",
|
|
30
|
+
fullWidth = false,
|
|
31
|
+
isLoading = false,
|
|
32
|
+
loadingLabel,
|
|
33
|
+
disabled,
|
|
34
|
+
className,
|
|
35
|
+
children,
|
|
36
|
+
...rest
|
|
37
|
+
}, ref) {
|
|
38
|
+
const isGhost = variant === "ghost";
|
|
39
|
+
const resolvedDisabled = disabled || isLoading;
|
|
40
|
+
const label = isLoading && loadingLabel ? loadingLabel : children;
|
|
41
|
+
return /* @__PURE__ */ jsx(
|
|
42
|
+
"button",
|
|
43
|
+
{
|
|
44
|
+
ref,
|
|
45
|
+
disabled: resolvedDisabled,
|
|
46
|
+
className: cn(
|
|
47
|
+
"inline-flex items-center justify-center transition-colors",
|
|
48
|
+
isGhost ? ghostSize[size] : boxSize[size],
|
|
49
|
+
isGhost ? ghostToneClasses[tone] : variantClasses[variant],
|
|
50
|
+
fullWidth && "w-full",
|
|
51
|
+
resolvedDisabled ? "cursor-not-allowed opacity-50" : "cursor-pointer",
|
|
52
|
+
className
|
|
53
|
+
),
|
|
54
|
+
...rest,
|
|
55
|
+
children: label
|
|
56
|
+
}
|
|
57
|
+
);
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
// src/components/shared/PagesContext.tsx
|
|
61
|
+
import { createContext, useContext } from "react";
|
|
62
|
+
var PagesContext = createContext({ pages: [], getPageHeadings: () => [] });
|
|
63
|
+
function usePages() {
|
|
64
|
+
return useContext(PagesContext);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export {
|
|
68
|
+
Button,
|
|
69
|
+
usePages
|
|
70
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SettingsForm.d.ts","sourceRoot":"","sources":["../../../src/components/editor/SettingsForm.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAoB,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"SettingsForm.d.ts","sourceRoot":"","sources":["../../../src/components/editor/SettingsForm.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAoB,MAAM,oBAAoB,CAAC;AAY3E,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAClC;AAED,UAAU,iBAAiB;IACzB,MAAM,EAAE,cAAc,CAAC;IACvB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC,QAAQ,EAAE,CAAC,MAAM,EAAE,kBAAkB,KAAK,IAAI,CAAC;IAC/C,IAAI,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,EAAE,CAAA;KAAE,EAAE,CAAC;CAC9C;AA8JD,wBAAgB,YAAY,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE,iBAAiB,2CA2BjF"}
|
|
@@ -11,17 +11,20 @@ import {
|
|
|
11
11
|
buildBlockDropData,
|
|
12
12
|
canDropBlock,
|
|
13
13
|
isBlockDragData
|
|
14
|
-
} from "../../chunk-
|
|
14
|
+
} from "../../chunk-BTGHF3SW.js";
|
|
15
|
+
import "../../chunk-ZSPCE6MZ.js";
|
|
15
16
|
import "../../chunk-5THS4K5D.js";
|
|
16
|
-
import "../../chunk-4E66N6UV.js";
|
|
17
17
|
import {
|
|
18
18
|
AddIcon,
|
|
19
19
|
IconButton
|
|
20
|
-
} from "../../chunk-
|
|
20
|
+
} from "../../chunk-7SIZ2LV5.js";
|
|
21
|
+
import "../../chunk-TOBPMMRM.js";
|
|
21
22
|
import "../../chunk-677NTHAZ.js";
|
|
22
23
|
import {
|
|
23
24
|
cn
|
|
24
25
|
} from "../../chunk-7EOSDFS3.js";
|
|
26
|
+
import "../../chunk-4YEOTFVU.js";
|
|
27
|
+
import "../../chunk-SWIHUIFT.js";
|
|
25
28
|
import "../../chunk-JSBRDJBE.js";
|
|
26
29
|
|
|
27
30
|
// 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-VHINNGIF.js";
|
|
6
6
|
import {
|
|
7
7
|
EditableGrid,
|
|
8
8
|
EditablePlainText,
|
|
@@ -10,21 +10,21 @@ import {
|
|
|
10
10
|
MediaBlock,
|
|
11
11
|
ResolvedMedia,
|
|
12
12
|
useEditableCollection
|
|
13
|
-
} from "../../chunk-
|
|
14
|
-
import "../../chunk-
|
|
13
|
+
} from "../../chunk-WCALKWPO.js";
|
|
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-7SIZ2LV5.js";
|
|
20
|
+
import "../../chunk-TOBPMMRM.js";
|
|
21
21
|
import "../../chunk-53DKVAB6.js";
|
|
22
|
-
import "../../chunk-4YEOTFVU.js";
|
|
23
22
|
import {
|
|
24
23
|
cn
|
|
25
24
|
} from "../../chunk-7EOSDFS3.js";
|
|
26
|
-
import "../../chunk-
|
|
25
|
+
import "../../chunk-4YEOTFVU.js";
|
|
27
26
|
import "../../chunk-VKAGMEKE.js";
|
|
27
|
+
import "../../chunk-SWIHUIFT.js";
|
|
28
28
|
import "../../chunk-JSBRDJBE.js";
|
|
29
29
|
|
|
30
30
|
// src/components/primitives/EditableList.tsx
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export type VideoSource = {
|
|
2
|
+
type: "library";
|
|
3
|
+
ref: {
|
|
4
|
+
imageId: string;
|
|
5
|
+
};
|
|
6
|
+
poster?: {
|
|
7
|
+
imageId: string;
|
|
8
|
+
src?: string;
|
|
9
|
+
};
|
|
10
|
+
} | {
|
|
11
|
+
type: "external";
|
|
12
|
+
provider: "youtube" | "vimeo";
|
|
13
|
+
id: string;
|
|
14
|
+
url: string;
|
|
15
|
+
width: number;
|
|
16
|
+
height: number;
|
|
17
|
+
};
|
|
18
|
+
interface VideoBlockProps {
|
|
19
|
+
source: VideoSource;
|
|
20
|
+
caption?: string;
|
|
21
|
+
options: {
|
|
22
|
+
playback?: "ambient" | "click";
|
|
23
|
+
showCaption?: boolean;
|
|
24
|
+
};
|
|
25
|
+
isEditMode?: boolean;
|
|
26
|
+
onSourceChange?: (source: VideoSource) => void;
|
|
27
|
+
onCaptionChange?: (caption: string) => void;
|
|
28
|
+
}
|
|
29
|
+
export declare function VideoBlock({ source, caption, options, isEditMode, onSourceChange, onCaptionChange }: VideoBlockProps): import("react/jsx-runtime").JSX.Element;
|
|
30
|
+
export {};
|
|
31
|
+
//# sourceMappingURL=VideoBlock.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"VideoBlock.d.ts","sourceRoot":"","sources":["../../../../src/components/sections/Video/VideoBlock.tsx"],"names":[],"mappings":"AAOA,MAAM,MAAM,WAAW,GACnB;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,GAAG,EAAE;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IAAC,MAAM,CAAC,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,CAAA;KAAE,CAAA;CAAE,GACzF;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,QAAQ,EAAE,SAAS,GAAG,OAAO,CAAC;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAEhH,UAAU,eAAe;IACvB,MAAM,EAAE,WAAW,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE;QAAE,QAAQ,CAAC,EAAE,SAAS,GAAG,OAAO,CAAC;QAAC,WAAW,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC;IACnE,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,IAAI,CAAC;IAC/C,eAAe,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;CAC7C;AAED,wBAAgB,UAAU,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,eAAe,EAAE,EAAE,eAAe,2CAgIpH"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
declare const _default: import("../../..").SectionDefinition<{
|
|
2
|
+
type: "video";
|
|
3
|
+
content: {
|
|
4
|
+
source: {
|
|
5
|
+
type: "library";
|
|
6
|
+
ref: {
|
|
7
|
+
imageId: string;
|
|
8
|
+
};
|
|
9
|
+
poster?: {
|
|
10
|
+
imageId: string;
|
|
11
|
+
} | undefined;
|
|
12
|
+
} | {
|
|
13
|
+
type: "external";
|
|
14
|
+
provider: "youtube" | "vimeo";
|
|
15
|
+
id: string;
|
|
16
|
+
url: string;
|
|
17
|
+
width: number;
|
|
18
|
+
height: number;
|
|
19
|
+
};
|
|
20
|
+
caption?: string | undefined;
|
|
21
|
+
};
|
|
22
|
+
options: {
|
|
23
|
+
playback?: "click" | "ambient" | undefined;
|
|
24
|
+
showCaption?: boolean | undefined;
|
|
25
|
+
};
|
|
26
|
+
}>;
|
|
27
|
+
export default _default;
|
|
28
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/sections/Video/index.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAoDA,wBA0DG"}
|
|
@@ -67,6 +67,31 @@ export declare const allSectionDefs: (import("../..").SectionDefinition<{
|
|
|
67
67
|
border?: boolean | undefined;
|
|
68
68
|
objectFit?: "cover" | "contain" | undefined;
|
|
69
69
|
};
|
|
70
|
+
}> | import("../..").SectionDefinition<{
|
|
71
|
+
type: "video";
|
|
72
|
+
content: {
|
|
73
|
+
source: {
|
|
74
|
+
type: "library";
|
|
75
|
+
ref: {
|
|
76
|
+
imageId: string;
|
|
77
|
+
};
|
|
78
|
+
poster?: {
|
|
79
|
+
imageId: string;
|
|
80
|
+
} | undefined;
|
|
81
|
+
} | {
|
|
82
|
+
type: "external";
|
|
83
|
+
provider: "youtube" | "vimeo";
|
|
84
|
+
id: string;
|
|
85
|
+
url: string;
|
|
86
|
+
width: number;
|
|
87
|
+
height: number;
|
|
88
|
+
};
|
|
89
|
+
caption?: string | undefined;
|
|
90
|
+
};
|
|
91
|
+
options: {
|
|
92
|
+
playback?: "click" | "ambient" | undefined;
|
|
93
|
+
showCaption?: boolean | undefined;
|
|
94
|
+
};
|
|
70
95
|
}> | import("../..").SectionDefinition<{
|
|
71
96
|
type: "button";
|
|
72
97
|
content: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"all-sections.d.ts","sourceRoot":"","sources":["../../../src/components/sections/all-sections.ts"],"names":[],"mappings":"AAGA;;;;;;;GAOG;AACH,eAAO,MAAM,cAAc
|
|
1
|
+
{"version":3,"file":"all-sections.d.ts","sourceRoot":"","sources":["../../../src/components/sections/all-sections.ts"],"names":[],"mappings":"AAGA;;;;;;;GAOG;AACH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAAiD,CAAC"}
|