@drawnagency/primitives 0.1.59 → 0.1.60
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/capabilities.d.ts +16 -0
- package/dist/auth/capabilities.d.ts.map +1 -0
- package/dist/auth/index.d.ts +2 -0
- package/dist/auth/index.d.ts.map +1 -1
- package/dist/auth/index.js +3 -1
- package/dist/auth/types.d.ts +26 -22
- package/dist/auth/types.d.ts.map +1 -1
- package/dist/{chunk-ICLXLWQ5.js → chunk-BT7STGDW.js} +31 -23
- package/dist/{chunk-L2JJFOXD.js → chunk-CBWK3KPV.js} +5 -1
- package/dist/{chunk-V7JN2DDU.js → chunk-ODCJQOVO.js} +1 -1
- package/dist/{chunk-NTGSA3TI.js → chunk-Q5EEYBMJ.js} +7 -5
- package/dist/chunk-TZQPOR5A.js +24 -0
- package/dist/{chunk-XTK4BR27.js → chunk-UNWNT52N.js} +13 -0
- package/dist/chunk-ZGFAYZWB.js +8 -0
- package/dist/components/editor/DropEdgeIndicator.d.ts +8 -0
- package/dist/components/editor/DropEdgeIndicator.d.ts.map +1 -0
- package/dist/components/editor/PagesModal.d.ts.map +1 -1
- package/dist/components/editor/SectionOrderingModal.d.ts.map +1 -1
- package/dist/components/primitives/defineHeadingSection.d.ts +28 -0
- package/dist/components/primitives/defineHeadingSection.d.ts.map +1 -0
- package/dist/components/sections/Colors/index.d.ts.map +1 -1
- package/dist/components/sections/Container/index.d.ts.map +1 -1
- package/dist/components/sections/IconList/IconList.d.ts +1 -6
- package/dist/components/sections/IconList/IconList.d.ts.map +1 -1
- package/dist/components/sections/IconList/index.d.ts +11 -0
- package/dist/components/sections/IconList/index.d.ts.map +1 -1
- package/dist/components/sections/LinkHeading/index.d.ts.map +1 -1
- package/dist/components/sections/SubHeading/index.d.ts +0 -1
- package/dist/components/sections/SubHeading/index.d.ts.map +1 -1
- package/dist/components/sections/SubSubHeading/index.d.ts +0 -1
- package/dist/components/sections/SubSubHeading/index.d.ts.map +1 -1
- package/dist/components/sections/all-sections.d.ts +0 -2
- package/dist/components/sections/all-sections.d.ts.map +1 -1
- package/dist/components/sections/register-schemas.js +409 -420
- package/dist/components/shell/BugReportFAB.d.ts.map +1 -1
- package/dist/hooks/useEditorPublish.d.ts.map +1 -1
- package/dist/hooks/useMediaPipeline.d.ts.map +1 -1
- package/dist/hooks/useSortableRow.d.ts +25 -0
- package/dist/hooks/useSortableRow.d.ts.map +1 -0
- package/dist/index.js +27 -24
- package/dist/lib/image-refs.d.ts +21 -0
- package/dist/lib/image-refs.d.ts.map +1 -0
- package/dist/lib/index.js +8 -7
- package/dist/lib/platform-broker.d.ts +14 -0
- package/dist/lib/platform-broker.d.ts.map +1 -0
- package/dist/lib/platform-broker.js +60 -0
- package/dist/lib/reorder.d.ts +12 -0
- package/dist/lib/reorder.d.ts.map +1 -0
- package/dist/lib/text.d.ts +2 -0
- package/dist/lib/text.d.ts.map +1 -1
- package/dist/media/index.js +3 -2
- package/dist/media/utils.d.ts.map +1 -1
- package/dist/schemas/index.js +11 -11
- package/dist/types/database.d.ts +46 -0
- package/dist/types/database.d.ts.map +1 -1
- package/package.json +6 -2
- package/src/auth/capabilities.ts +26 -0
- package/src/auth/index.ts +3 -0
- package/src/auth/types.ts +36 -26
- package/src/components/editor/DropEdgeIndicator.tsx +13 -0
- package/src/components/editor/PagesModal.tsx +12 -80
- package/src/components/editor/SectionOrderingModal.tsx +8 -78
- package/src/components/primitives/defineHeadingSection.tsx +56 -0
- package/src/components/sections/Colors/index.tsx +2 -4
- package/src/components/sections/Container/index.tsx +2 -4
- package/src/components/sections/IconList/IconList.tsx +1 -7
- package/src/components/sections/IconList/index.tsx +11 -5
- package/src/components/sections/LinkHeading/index.tsx +5 -20
- package/src/components/sections/SubHeading/index.tsx +6 -23
- package/src/components/sections/SubSubHeading/index.tsx +6 -23
- package/src/components/shell/BugReportFAB.tsx +13 -9
- package/src/hooks/useEditorPublish.ts +71 -49
- package/src/hooks/useMediaPipeline.ts +11 -34
- package/src/hooks/useSortableRow.ts +99 -0
- package/src/lib/image-refs.ts +53 -0
- package/src/lib/platform-broker.ts +72 -0
- package/src/lib/reorder.ts +20 -0
- package/src/lib/text.ts +5 -0
- package/src/media/utils.ts +6 -1
- package/src/types/database.ts +41 -0
- package/dist/chunk-DKOUFIP6.js +0 -35
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getMediaProvider
|
|
3
|
-
} from "../../chunk-
|
|
3
|
+
} from "../../chunk-CBWK3KPV.js";
|
|
4
4
|
import {
|
|
5
5
|
DEFAULT_LINK,
|
|
6
6
|
LinkValueSchema
|
|
@@ -12,25 +12,29 @@ import {
|
|
|
12
12
|
sanitizeHtml,
|
|
13
13
|
toSectionId
|
|
14
14
|
} from "../../chunk-RFZNNCAS.js";
|
|
15
|
+
import "../../chunk-ZGFAYZWB.js";
|
|
15
16
|
import {
|
|
16
|
-
ColorItemSchema,
|
|
17
|
-
SingleMediaReferenceSchema,
|
|
18
17
|
getSectionSchema
|
|
19
|
-
} from "../../chunk-
|
|
20
|
-
import "../../chunk-DKOUFIP6.js";
|
|
21
|
-
import "../../chunk-NSCT3AMV.js";
|
|
18
|
+
} from "../../chunk-TZQPOR5A.js";
|
|
22
19
|
import {
|
|
23
20
|
defineSection,
|
|
24
21
|
getSection,
|
|
25
22
|
registerRichText,
|
|
26
23
|
registerSchema
|
|
27
24
|
} from "../../chunk-VKAGMEKE.js";
|
|
25
|
+
import {
|
|
26
|
+
ColorItemSchema,
|
|
27
|
+
SingleMediaReferenceSchema
|
|
28
|
+
} from "../../chunk-BT7STGDW.js";
|
|
29
|
+
import "../../chunk-NSCT3AMV.js";
|
|
28
30
|
import "../../chunk-JSBRDJBE.js";
|
|
29
31
|
|
|
30
32
|
// src/components/sections/LinkHeading/index.tsx
|
|
31
|
-
import { z } from "zod";
|
|
32
33
|
import { Heading1 } from "lucide-react";
|
|
33
34
|
|
|
35
|
+
// src/components/primitives/defineHeadingSection.tsx
|
|
36
|
+
import { z } from "zod";
|
|
37
|
+
|
|
34
38
|
// src/components/primitives/EditablePlainText.tsx
|
|
35
39
|
import {
|
|
36
40
|
useRef as useRef2,
|
|
@@ -162,93 +166,78 @@ function HeadingSection({ heading, tag, placeholder, className, onChange }) {
|
|
|
162
166
|
);
|
|
163
167
|
}
|
|
164
168
|
|
|
165
|
-
// src/components/
|
|
169
|
+
// src/components/primitives/defineHeadingSection.tsx
|
|
166
170
|
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
171
|
+
function defineHeadingSection(config) {
|
|
172
|
+
const content = config.navExclusion ? z.object({ heading: z.string(), excludeFromNav: z.boolean().optional() }) : z.object({ heading: z.string() });
|
|
173
|
+
const schema8 = z.object({ type: z.literal(config.type), content });
|
|
174
|
+
return defineSection({
|
|
175
|
+
type: config.type,
|
|
176
|
+
label: config.label,
|
|
177
|
+
icon: config.icon,
|
|
178
|
+
schema: schema8,
|
|
179
|
+
navRole: config.navRole,
|
|
180
|
+
component: ({ content: content2, onChange }) => /* @__PURE__ */ jsx2(
|
|
181
|
+
HeadingSection,
|
|
182
|
+
{
|
|
183
|
+
heading: content2.content.heading,
|
|
184
|
+
tag: config.tag,
|
|
185
|
+
placeholder: config.placeholder,
|
|
186
|
+
onChange: onChange ? (heading) => onChange({ ...content2, content: { ...content2.content, heading } }) : void 0
|
|
187
|
+
}
|
|
188
|
+
),
|
|
189
|
+
defaults: () => ({ type: config.type, content: { heading: config.defaultHeading } }),
|
|
190
|
+
getLabel: (content2) => content2.content.heading,
|
|
191
|
+
...config.navExclusion ? {
|
|
192
|
+
settings: {
|
|
193
|
+
excludeFromNav: { type: "checkbox", label: "Exclude from navigation", default: false, target: "content" }
|
|
194
|
+
}
|
|
195
|
+
} : {}
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
// src/components/sections/LinkHeading/index.tsx
|
|
200
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
201
|
+
var LinkHeading_default = defineHeadingSection({
|
|
172
202
|
type: "link_heading",
|
|
173
203
|
label: "Link Heading",
|
|
174
|
-
icon: /* @__PURE__ */
|
|
175
|
-
schema,
|
|
204
|
+
icon: /* @__PURE__ */ jsx3(Heading1, { size: 18 }),
|
|
176
205
|
navRole: "h1",
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
heading: content.content.heading,
|
|
181
|
-
tag: "h2",
|
|
182
|
-
placeholder: "Section heading",
|
|
183
|
-
onChange: onChange ? (heading) => onChange({ type: "link_heading", content: { heading } }) : void 0
|
|
184
|
-
}
|
|
185
|
-
),
|
|
186
|
-
defaults: () => ({ type: "link_heading", content: { heading: "New Section" } }),
|
|
187
|
-
getLabel: (content) => content.content.heading
|
|
206
|
+
tag: "h2",
|
|
207
|
+
placeholder: "Section heading",
|
|
208
|
+
defaultHeading: "New Section"
|
|
188
209
|
});
|
|
189
210
|
|
|
190
211
|
// src/components/sections/SubHeading/index.tsx
|
|
191
|
-
import { z as z2 } from "zod";
|
|
192
212
|
import { Heading2 } from "lucide-react";
|
|
193
|
-
import { jsx as
|
|
194
|
-
var
|
|
195
|
-
type: z2.literal("sub_heading"),
|
|
196
|
-
content: z2.object({ heading: z2.string(), excludeFromNav: z2.boolean().optional() })
|
|
197
|
-
});
|
|
198
|
-
var SubHeading_default = defineSection({
|
|
213
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
214
|
+
var SubHeading_default = defineHeadingSection({
|
|
199
215
|
type: "sub_heading",
|
|
200
216
|
label: "Sub Heading",
|
|
201
|
-
icon: /* @__PURE__ */
|
|
202
|
-
schema: schema2,
|
|
217
|
+
icon: /* @__PURE__ */ jsx4(Heading2, { size: 18 }),
|
|
203
218
|
navRole: "h2",
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
tag: "h3",
|
|
209
|
-
placeholder: "Sub heading",
|
|
210
|
-
onChange: onChange ? (heading) => onChange({ ...content, content: { ...content.content, heading } }) : void 0
|
|
211
|
-
}
|
|
212
|
-
),
|
|
213
|
-
defaults: () => ({ type: "sub_heading", content: { heading: "New Sub Heading" } }),
|
|
214
|
-
getLabel: (content) => content.content.heading,
|
|
215
|
-
settings: {
|
|
216
|
-
excludeFromNav: { type: "checkbox", label: "Exclude from navigation", default: false, target: "content" }
|
|
217
|
-
}
|
|
219
|
+
tag: "h3",
|
|
220
|
+
placeholder: "Sub heading",
|
|
221
|
+
defaultHeading: "New Sub Heading",
|
|
222
|
+
navExclusion: true
|
|
218
223
|
});
|
|
219
224
|
|
|
220
225
|
// src/components/sections/SubSubHeading/index.tsx
|
|
221
|
-
import { z as z3 } from "zod";
|
|
222
226
|
import { Heading3 } from "lucide-react";
|
|
223
|
-
import { jsx as
|
|
224
|
-
var
|
|
225
|
-
type: z3.literal("sub_sub_heading"),
|
|
226
|
-
content: z3.object({ heading: z3.string(), excludeFromNav: z3.boolean().optional() })
|
|
227
|
-
});
|
|
228
|
-
var SubSubHeading_default = defineSection({
|
|
227
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
228
|
+
var SubSubHeading_default = defineHeadingSection({
|
|
229
229
|
type: "sub_sub_heading",
|
|
230
230
|
label: "Sub Sub Heading",
|
|
231
|
-
icon: /* @__PURE__ */
|
|
232
|
-
schema: schema3,
|
|
231
|
+
icon: /* @__PURE__ */ jsx5(Heading3, { size: 18 }),
|
|
233
232
|
navRole: "h3",
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
tag: "h4",
|
|
239
|
-
placeholder: "Sub sub heading",
|
|
240
|
-
onChange: onChange ? (heading) => onChange({ ...content, content: { ...content.content, heading } }) : void 0
|
|
241
|
-
}
|
|
242
|
-
),
|
|
243
|
-
defaults: () => ({ type: "sub_sub_heading", content: { heading: "New Sub Sub Heading" } }),
|
|
244
|
-
getLabel: (content) => content.content.heading,
|
|
245
|
-
settings: {
|
|
246
|
-
excludeFromNav: { type: "checkbox", label: "Exclude from navigation", default: false, target: "content" }
|
|
247
|
-
}
|
|
233
|
+
tag: "h4",
|
|
234
|
+
placeholder: "Sub sub heading",
|
|
235
|
+
defaultHeading: "New Sub Sub Heading",
|
|
236
|
+
navExclusion: true
|
|
248
237
|
});
|
|
249
238
|
|
|
250
239
|
// src/components/sections/Prose/index.tsx
|
|
251
|
-
import { z as
|
|
240
|
+
import { z as z2 } from "zod";
|
|
252
241
|
import { AlignLeft } from "lucide-react";
|
|
253
242
|
|
|
254
243
|
// src/components/primitives/EditableRichText.tsx
|
|
@@ -458,7 +447,7 @@ import { useState as useState3 } from "react";
|
|
|
458
447
|
|
|
459
448
|
// src/components/shared/Button.tsx
|
|
460
449
|
import { forwardRef } from "react";
|
|
461
|
-
import { jsx as
|
|
450
|
+
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
462
451
|
var boxSize = {
|
|
463
452
|
sm: "rounded px-3 py-1.5 text-xs font-medium",
|
|
464
453
|
md: "rounded px-4 py-2 text-sm font-medium"
|
|
@@ -492,7 +481,7 @@ var Button = forwardRef(function Button2({
|
|
|
492
481
|
const isGhost = variant === "ghost";
|
|
493
482
|
const resolvedDisabled = disabled || isLoading;
|
|
494
483
|
const label = isLoading && loadingLabel ? loadingLabel : children;
|
|
495
|
-
return /* @__PURE__ */
|
|
484
|
+
return /* @__PURE__ */ jsx6(
|
|
496
485
|
"button",
|
|
497
486
|
{
|
|
498
487
|
ref,
|
|
@@ -528,7 +517,7 @@ function parseInternalHref(href) {
|
|
|
528
517
|
}
|
|
529
518
|
|
|
530
519
|
// src/components/primitives/LinkPopover.tsx
|
|
531
|
-
import { Fragment, jsx as
|
|
520
|
+
import { Fragment, jsx as jsx7, jsxs } from "react/jsx-runtime";
|
|
532
521
|
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";
|
|
533
522
|
function LinkPopover({ editor, onClose }) {
|
|
534
523
|
const { pages, getPageHeadings } = usePages();
|
|
@@ -573,7 +562,7 @@ function LinkPopover({ editor, onClose }) {
|
|
|
573
562
|
onMouseDown: (e) => e.stopPropagation(),
|
|
574
563
|
onKeyDown: handleKeyDown,
|
|
575
564
|
children: [
|
|
576
|
-
/* @__PURE__ */
|
|
565
|
+
/* @__PURE__ */ jsx7("div", { className: "flex gap-2", role: "tablist", children: ["external", "internal"].map((kind) => /* @__PURE__ */ jsx7(
|
|
577
566
|
"button",
|
|
578
567
|
{
|
|
579
568
|
type: "button",
|
|
@@ -589,7 +578,7 @@ function LinkPopover({ editor, onClose }) {
|
|
|
589
578
|
kind
|
|
590
579
|
)) }),
|
|
591
580
|
mode === "external" ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
592
|
-
/* @__PURE__ */
|
|
581
|
+
/* @__PURE__ */ jsx7(
|
|
593
582
|
"input",
|
|
594
583
|
{
|
|
595
584
|
autoFocus: true,
|
|
@@ -601,7 +590,7 @@ function LinkPopover({ editor, onClose }) {
|
|
|
601
590
|
}
|
|
602
591
|
),
|
|
603
592
|
/* @__PURE__ */ jsxs("label", { className: "flex cursor-pointer items-center gap-2 text-sm text-base-contrast", children: [
|
|
604
|
-
/* @__PURE__ */
|
|
593
|
+
/* @__PURE__ */ jsx7(
|
|
605
594
|
"input",
|
|
606
595
|
{
|
|
607
596
|
type: "checkbox",
|
|
@@ -625,8 +614,8 @@ function LinkPopover({ editor, onClose }) {
|
|
|
625
614
|
},
|
|
626
615
|
className: selectClasses,
|
|
627
616
|
children: [
|
|
628
|
-
/* @__PURE__ */
|
|
629
|
-
pages.map((p) => /* @__PURE__ */
|
|
617
|
+
/* @__PURE__ */ jsx7("option", { value: "", children: "Select a page\u2026" }),
|
|
618
|
+
pages.map((p) => /* @__PURE__ */ jsx7("option", { value: p.id, children: p.title }, p.id))
|
|
630
619
|
]
|
|
631
620
|
}
|
|
632
621
|
),
|
|
@@ -639,14 +628,14 @@ function LinkPopover({ editor, onClose }) {
|
|
|
639
628
|
onChange: (e) => setAnchorId(e.target.value),
|
|
640
629
|
className: cn(selectClasses, !pageId && "cursor-not-allowed opacity-50"),
|
|
641
630
|
children: [
|
|
642
|
-
/* @__PURE__ */
|
|
643
|
-
headings.map((h) => /* @__PURE__ */
|
|
631
|
+
/* @__PURE__ */ jsx7("option", { value: "", children: "None (top of page)" }),
|
|
632
|
+
headings.map((h) => /* @__PURE__ */ jsx7("option", { value: h.id, children: h.label }, h.id))
|
|
644
633
|
]
|
|
645
634
|
}
|
|
646
635
|
)
|
|
647
636
|
] }),
|
|
648
637
|
/* @__PURE__ */ jsxs("div", { className: "flex gap-2", children: [
|
|
649
|
-
/* @__PURE__ */
|
|
638
|
+
/* @__PURE__ */ jsx7(
|
|
650
639
|
Button,
|
|
651
640
|
{
|
|
652
641
|
variant: "brand",
|
|
@@ -658,7 +647,7 @@ function LinkPopover({ editor, onClose }) {
|
|
|
658
647
|
children: "Apply"
|
|
659
648
|
}
|
|
660
649
|
),
|
|
661
|
-
hasLink && /* @__PURE__ */
|
|
650
|
+
hasLink && /* @__PURE__ */ jsx7(
|
|
662
651
|
Button,
|
|
663
652
|
{
|
|
664
653
|
variant: "secondary",
|
|
@@ -670,7 +659,7 @@ function LinkPopover({ editor, onClose }) {
|
|
|
670
659
|
children: "Remove"
|
|
671
660
|
}
|
|
672
661
|
),
|
|
673
|
-
/* @__PURE__ */
|
|
662
|
+
/* @__PURE__ */ jsx7(
|
|
674
663
|
Button,
|
|
675
664
|
{
|
|
676
665
|
variant: "secondary",
|
|
@@ -689,9 +678,9 @@ function LinkPopover({ editor, onClose }) {
|
|
|
689
678
|
}
|
|
690
679
|
|
|
691
680
|
// src/components/primitives/RichTextToolbar.tsx
|
|
692
|
-
import { Fragment as Fragment2, jsx as
|
|
681
|
+
import { Fragment as Fragment2, jsx as jsx8, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
693
682
|
function ToolbarButton({ isActive, onClick, title, children }) {
|
|
694
|
-
return /* @__PURE__ */
|
|
683
|
+
return /* @__PURE__ */ jsx8(
|
|
695
684
|
"button",
|
|
696
685
|
{
|
|
697
686
|
type: "button",
|
|
@@ -711,7 +700,7 @@ function ToolbarButton({ isActive, onClick, title, children }) {
|
|
|
711
700
|
);
|
|
712
701
|
}
|
|
713
702
|
function Separator() {
|
|
714
|
-
return /* @__PURE__ */
|
|
703
|
+
return /* @__PURE__ */ jsx8("div", { className: "mx-1 h-5 w-px bg-base-contrast/20" });
|
|
715
704
|
}
|
|
716
705
|
function RichTextToolbar({ editor, preset }) {
|
|
717
706
|
const [showLinkPopover, setShowLinkPopover] = useState4(false);
|
|
@@ -743,37 +732,37 @@ function RichTextToolbar({ editor, preset }) {
|
|
|
743
732
|
"data-testid": "rich-text-toolbar",
|
|
744
733
|
className: "flex items-center gap-1 rounded border border-base-contrast/10 bg-base-accent p-1 shadow-md",
|
|
745
734
|
children: [
|
|
746
|
-
/* @__PURE__ */
|
|
735
|
+
/* @__PURE__ */ jsx8(
|
|
747
736
|
ToolbarButton,
|
|
748
737
|
{
|
|
749
738
|
isActive: state.isBold,
|
|
750
739
|
onClick: () => editor.chain().focus().toggleBold().run(),
|
|
751
740
|
title: "Bold",
|
|
752
|
-
children: /* @__PURE__ */
|
|
741
|
+
children: /* @__PURE__ */ jsx8("strong", { children: "B" })
|
|
753
742
|
}
|
|
754
743
|
),
|
|
755
|
-
/* @__PURE__ */
|
|
744
|
+
/* @__PURE__ */ jsx8(
|
|
756
745
|
ToolbarButton,
|
|
757
746
|
{
|
|
758
747
|
isActive: state.isItalic,
|
|
759
748
|
onClick: () => editor.chain().focus().toggleItalic().run(),
|
|
760
749
|
title: "Italic",
|
|
761
|
-
children: /* @__PURE__ */
|
|
750
|
+
children: /* @__PURE__ */ jsx8("em", { children: "I" })
|
|
762
751
|
}
|
|
763
752
|
),
|
|
764
|
-
/* @__PURE__ */
|
|
753
|
+
/* @__PURE__ */ jsx8(
|
|
765
754
|
ToolbarButton,
|
|
766
755
|
{
|
|
767
756
|
isActive: state.isUnderline,
|
|
768
757
|
onClick: () => editor.chain().focus().toggleUnderline().run(),
|
|
769
758
|
title: "Underline",
|
|
770
|
-
children: /* @__PURE__ */
|
|
759
|
+
children: /* @__PURE__ */ jsx8("span", { className: "underline", children: "U" })
|
|
771
760
|
}
|
|
772
761
|
),
|
|
773
762
|
preset === "rich" && /* @__PURE__ */ jsxs2(Fragment2, { children: [
|
|
774
|
-
/* @__PURE__ */
|
|
763
|
+
/* @__PURE__ */ jsx8(Separator, {}),
|
|
775
764
|
/* @__PURE__ */ jsxs2("div", { className: "relative", children: [
|
|
776
|
-
/* @__PURE__ */
|
|
765
|
+
/* @__PURE__ */ jsx8(
|
|
777
766
|
ToolbarButton,
|
|
778
767
|
{
|
|
779
768
|
isActive: state.isLink || showLinkPopover,
|
|
@@ -782,7 +771,7 @@ function RichTextToolbar({ editor, preset }) {
|
|
|
782
771
|
children: "\u{1F517}"
|
|
783
772
|
}
|
|
784
773
|
),
|
|
785
|
-
showLinkPopover && /* @__PURE__ */
|
|
774
|
+
showLinkPopover && /* @__PURE__ */ jsx8("div", { className: "absolute left-0 top-full z-50 mt-1", children: /* @__PURE__ */ jsx8(
|
|
786
775
|
LinkPopover,
|
|
787
776
|
{
|
|
788
777
|
editor,
|
|
@@ -790,8 +779,8 @@ function RichTextToolbar({ editor, preset }) {
|
|
|
790
779
|
}
|
|
791
780
|
) })
|
|
792
781
|
] }),
|
|
793
|
-
/* @__PURE__ */
|
|
794
|
-
/* @__PURE__ */
|
|
782
|
+
/* @__PURE__ */ jsx8(Separator, {}),
|
|
783
|
+
/* @__PURE__ */ jsx8(
|
|
795
784
|
ToolbarButton,
|
|
796
785
|
{
|
|
797
786
|
isActive: state.isBulletList,
|
|
@@ -800,7 +789,7 @@ function RichTextToolbar({ editor, preset }) {
|
|
|
800
789
|
children: "\u2022\u2261"
|
|
801
790
|
}
|
|
802
791
|
),
|
|
803
|
-
/* @__PURE__ */
|
|
792
|
+
/* @__PURE__ */ jsx8(
|
|
804
793
|
ToolbarButton,
|
|
805
794
|
{
|
|
806
795
|
isActive: state.isOrderedList,
|
|
@@ -809,8 +798,8 @@ function RichTextToolbar({ editor, preset }) {
|
|
|
809
798
|
children: "1\u2261"
|
|
810
799
|
}
|
|
811
800
|
),
|
|
812
|
-
/* @__PURE__ */
|
|
813
|
-
/* @__PURE__ */
|
|
801
|
+
/* @__PURE__ */ jsx8(Separator, {}),
|
|
802
|
+
/* @__PURE__ */ jsx8(
|
|
814
803
|
ToolbarButton,
|
|
815
804
|
{
|
|
816
805
|
isActive: state.isH3,
|
|
@@ -819,7 +808,7 @@ function RichTextToolbar({ editor, preset }) {
|
|
|
819
808
|
children: "H3"
|
|
820
809
|
}
|
|
821
810
|
),
|
|
822
|
-
/* @__PURE__ */
|
|
811
|
+
/* @__PURE__ */ jsx8(
|
|
823
812
|
ToolbarButton,
|
|
824
813
|
{
|
|
825
814
|
isActive: state.isH4,
|
|
@@ -828,7 +817,7 @@ function RichTextToolbar({ editor, preset }) {
|
|
|
828
817
|
children: "H4"
|
|
829
818
|
}
|
|
830
819
|
),
|
|
831
|
-
/* @__PURE__ */
|
|
820
|
+
/* @__PURE__ */ jsx8(
|
|
832
821
|
ToolbarButton,
|
|
833
822
|
{
|
|
834
823
|
isActive: state.isLarge,
|
|
@@ -837,7 +826,7 @@ function RichTextToolbar({ editor, preset }) {
|
|
|
837
826
|
children: "Lg"
|
|
838
827
|
}
|
|
839
828
|
),
|
|
840
|
-
/* @__PURE__ */
|
|
829
|
+
/* @__PURE__ */ jsx8(
|
|
841
830
|
ToolbarButton,
|
|
842
831
|
{
|
|
843
832
|
isActive: state.isLeadIn,
|
|
@@ -853,7 +842,7 @@ function RichTextToolbar({ editor, preset }) {
|
|
|
853
842
|
}
|
|
854
843
|
|
|
855
844
|
// src/components/primitives/EditableRichText.tsx
|
|
856
|
-
import { jsx as
|
|
845
|
+
import { jsx as jsx9, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
857
846
|
function isContentEmpty(html) {
|
|
858
847
|
return html.replace(/<[^>]*>/g, "").trim().length === 0;
|
|
859
848
|
}
|
|
@@ -921,7 +910,7 @@ function EditableRichText({
|
|
|
921
910
|
}, 150);
|
|
922
911
|
}, [deactivate]);
|
|
923
912
|
if (!isEditMode) {
|
|
924
|
-
return /* @__PURE__ */
|
|
913
|
+
return /* @__PURE__ */ jsx9(
|
|
925
914
|
"div",
|
|
926
915
|
{
|
|
927
916
|
className,
|
|
@@ -932,9 +921,9 @@ function EditableRichText({
|
|
|
932
921
|
if (!isEditorActive || !editor) {
|
|
933
922
|
const empty = isContentEmpty(value);
|
|
934
923
|
if (empty) {
|
|
935
|
-
return /* @__PURE__ */
|
|
924
|
+
return /* @__PURE__ */ jsx9("div", { className, onClick: handleClick, children: /* @__PURE__ */ jsx9("p", { className: "tiptap-placeholder", children: placeholder }) });
|
|
936
925
|
}
|
|
937
|
-
return /* @__PURE__ */
|
|
926
|
+
return /* @__PURE__ */ jsx9(
|
|
938
927
|
"div",
|
|
939
928
|
{
|
|
940
929
|
className,
|
|
@@ -951,7 +940,7 @@ function EditableRichText({
|
|
|
951
940
|
onFocus: handleFocus,
|
|
952
941
|
onBlur: handleBlur,
|
|
953
942
|
children: [
|
|
954
|
-
/* @__PURE__ */
|
|
943
|
+
/* @__PURE__ */ jsx9(
|
|
955
944
|
BubbleMenu,
|
|
956
945
|
{
|
|
957
946
|
editor,
|
|
@@ -960,20 +949,20 @@ function EditableRichText({
|
|
|
960
949
|
const { from, to } = state.selection;
|
|
961
950
|
return ed.isFocused && from !== to;
|
|
962
951
|
},
|
|
963
|
-
children: /* @__PURE__ */
|
|
952
|
+
children: /* @__PURE__ */ jsx9(RichTextToolbar, { editor, preset })
|
|
964
953
|
}
|
|
965
954
|
),
|
|
966
|
-
/* @__PURE__ */
|
|
955
|
+
/* @__PURE__ */ jsx9(EditorContent, { editor })
|
|
967
956
|
]
|
|
968
957
|
}
|
|
969
958
|
);
|
|
970
959
|
}
|
|
971
960
|
|
|
972
961
|
// src/components/sections/Prose/Prose.tsx
|
|
973
|
-
import { jsx as
|
|
962
|
+
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
974
963
|
function Prose({ body, onChange }) {
|
|
975
964
|
if (onChange) {
|
|
976
|
-
return /* @__PURE__ */
|
|
965
|
+
return /* @__PURE__ */ jsx10("div", { className: "prose-content", children: /* @__PURE__ */ jsx10(
|
|
977
966
|
EditableRichText,
|
|
978
967
|
{
|
|
979
968
|
value: body,
|
|
@@ -984,7 +973,7 @@ function Prose({ body, onChange }) {
|
|
|
984
973
|
}
|
|
985
974
|
) });
|
|
986
975
|
}
|
|
987
|
-
return /* @__PURE__ */
|
|
976
|
+
return /* @__PURE__ */ jsx10(
|
|
988
977
|
"div",
|
|
989
978
|
{
|
|
990
979
|
className: "prose-content",
|
|
@@ -1001,26 +990,29 @@ function truncate(text, maxLength) {
|
|
|
1001
990
|
if (text.length <= maxLength) return text;
|
|
1002
991
|
return text.slice(0, maxLength) + "...";
|
|
1003
992
|
}
|
|
993
|
+
function pluralize(n, word) {
|
|
994
|
+
return `${n} ${word}${n === 1 ? "" : "s"}`;
|
|
995
|
+
}
|
|
1004
996
|
|
|
1005
997
|
// src/components/sections/Prose/index.tsx
|
|
1006
|
-
import { jsx as
|
|
1007
|
-
var
|
|
1008
|
-
type:
|
|
1009
|
-
content:
|
|
998
|
+
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
999
|
+
var schema = z2.object({
|
|
1000
|
+
type: z2.literal("prose"),
|
|
1001
|
+
content: z2.object({ body: z2.string() })
|
|
1010
1002
|
});
|
|
1011
1003
|
var Prose_default = defineSection({
|
|
1012
1004
|
type: "prose",
|
|
1013
1005
|
label: "Prose",
|
|
1014
|
-
icon: /* @__PURE__ */
|
|
1015
|
-
schema
|
|
1006
|
+
icon: /* @__PURE__ */ jsx11(AlignLeft, { size: 18 }),
|
|
1007
|
+
schema,
|
|
1016
1008
|
richTextFields: ["body"],
|
|
1017
|
-
component: ({ content, onChange }) => /* @__PURE__ */
|
|
1009
|
+
component: ({ content, onChange }) => /* @__PURE__ */ jsx11(Prose, { body: content.content.body, onChange: onChange ? (c) => onChange(c) : void 0 }),
|
|
1018
1010
|
defaults: () => ({ type: "prose", content: { body: "<p></p>" } }),
|
|
1019
1011
|
getLabel: (content) => truncate(stripHtmlToPlainText(content.content.body), 60)
|
|
1020
1012
|
});
|
|
1021
1013
|
|
|
1022
1014
|
// src/components/sections/Media/index.tsx
|
|
1023
|
-
import { z as
|
|
1015
|
+
import { z as z3 } from "zod";
|
|
1024
1016
|
import { Image as ImageIcon2 } from "lucide-react";
|
|
1025
1017
|
|
|
1026
1018
|
// src/components/sections/Media/MediaBlock.tsx
|
|
@@ -1078,7 +1070,7 @@ function useResolvedMedia(imageId) {
|
|
|
1078
1070
|
}
|
|
1079
1071
|
|
|
1080
1072
|
// src/components/primitives/ResolvedMedia.tsx
|
|
1081
|
-
import { jsx as
|
|
1073
|
+
import { jsx as jsx12, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1082
1074
|
function ResolvedMedia({
|
|
1083
1075
|
imageId,
|
|
1084
1076
|
src: propSrc,
|
|
@@ -1096,20 +1088,20 @@ function ResolvedMedia({
|
|
|
1096
1088
|
const kind = resolved.kind;
|
|
1097
1089
|
const invertClass = invertFrom === "light" ? "invert dark:invert-0" : invertFrom === "dark" ? "dark:invert" : void 0;
|
|
1098
1090
|
const mediaClass = cn("h-full w-full", imgClassName, invertClass);
|
|
1099
|
-
return /* @__PURE__ */
|
|
1100
|
-
/* @__PURE__ */
|
|
1101
|
-
/* @__PURE__ */
|
|
1091
|
+
return /* @__PURE__ */ jsx12("div", { className, children: src ? kind === "video" ? /* @__PURE__ */ jsx12("video", { src, poster, muted: true, playsInline: true, loop: true, autoPlay: true, className: mediaClass }) : /* @__PURE__ */ jsx12("img", { src, srcSet: srcset, alt, className: mediaClass }) : /* @__PURE__ */ jsxs4("div", { className: "flex aspect-video h-full w-full flex-col items-center justify-center gap-1 rounded bg-base-accent text-base-contrast-light/50", children: [
|
|
1092
|
+
/* @__PURE__ */ jsx12(ImageIcon, { size: 24 }),
|
|
1093
|
+
/* @__PURE__ */ jsx12("span", { className: "text-sm", children: "No Image" })
|
|
1102
1094
|
] }) });
|
|
1103
1095
|
}
|
|
1104
1096
|
|
|
1105
1097
|
// src/components/primitives/ImageDropZone.tsx
|
|
1106
1098
|
import { useState as useState5 } from "react";
|
|
1107
|
-
import { Fragment as Fragment3, jsx as
|
|
1099
|
+
import { Fragment as Fragment3, jsx as jsx13, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1108
1100
|
var ACCEPTED = /^(image|video)\//;
|
|
1109
1101
|
function ImageDropZone({ onImageSelected, className, children }) {
|
|
1110
1102
|
const mediaLibrary = useMediaLibrary();
|
|
1111
1103
|
const [dragging, setDragging] = useState5(false);
|
|
1112
|
-
if (!mediaLibrary) return /* @__PURE__ */
|
|
1104
|
+
if (!mediaLibrary) return /* @__PURE__ */ jsx13(Fragment3, { children });
|
|
1113
1105
|
const maxFileSize = mediaLibrary.siteConfig?.media.maxFileSize;
|
|
1114
1106
|
const hasFiles = (e) => e.dataTransfer.types.includes("Files");
|
|
1115
1107
|
const handleDragOver = (e) => {
|
|
@@ -1150,14 +1142,14 @@ function ImageDropZone({ onImageSelected, className, children }) {
|
|
|
1150
1142
|
onDrop: handleDrop,
|
|
1151
1143
|
children: [
|
|
1152
1144
|
children,
|
|
1153
|
-
dragging && /* @__PURE__ */
|
|
1145
|
+
dragging && /* @__PURE__ */ jsx13("div", { className: "pointer-events-none absolute inset-0 z-10 rounded-md border-2 border-primary bg-primary/5" })
|
|
1154
1146
|
]
|
|
1155
1147
|
}
|
|
1156
1148
|
);
|
|
1157
1149
|
}
|
|
1158
1150
|
|
|
1159
1151
|
// src/components/sections/Media/MediaBlock.tsx
|
|
1160
|
-
import { jsx as
|
|
1152
|
+
import { jsx as jsx14, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1161
1153
|
function MediaBlock({ refValue, options, link, dodont, isEditMode, onRefChange }) {
|
|
1162
1154
|
const mediaLibrary = useMediaLibrary();
|
|
1163
1155
|
const fit = refValue.objectFit ?? options.objectFit;
|
|
@@ -1165,7 +1157,7 @@ function MediaBlock({ refValue, options, link, dodont, isEditMode, onRefChange }
|
|
|
1165
1157
|
const showBorder = refValue.border ?? options.border;
|
|
1166
1158
|
const captionStr = refValue.caption ? Array.isArray(refValue.caption) ? refValue.caption.join("\n") : refValue.caption : "";
|
|
1167
1159
|
const replace = onRefChange ? (imageId) => onRefChange({ ...refValue, imageId }) : void 0;
|
|
1168
|
-
const resolved = /* @__PURE__ */
|
|
1160
|
+
const resolved = /* @__PURE__ */ jsx14(
|
|
1169
1161
|
ResolvedMedia,
|
|
1170
1162
|
{
|
|
1171
1163
|
imageId: refValue.imageId || void 0,
|
|
@@ -1174,14 +1166,14 @@ function MediaBlock({ refValue, options, link, dodont, isEditMode, onRefChange }
|
|
|
1174
1166
|
invertFrom: refValue.invertFrom
|
|
1175
1167
|
}
|
|
1176
1168
|
);
|
|
1177
|
-
let media = isEditMode && replace ? /* @__PURE__ */
|
|
1169
|
+
let media = isEditMode && replace ? /* @__PURE__ */ jsx14(ImageDropZone, { onImageSelected: replace, className: "h-full w-full", children: resolved }) : resolved;
|
|
1178
1170
|
if (!isEditMode && link && link.kind === "external" && link.href) {
|
|
1179
|
-
media = /* @__PURE__ */
|
|
1171
|
+
media = /* @__PURE__ */ jsx14("a", { href: link.href, target: link.target, className: "group block", children: media });
|
|
1180
1172
|
}
|
|
1181
1173
|
const onImageClick = isEditMode && replace && mediaLibrary ? () => mediaLibrary.openSelectModal((imageId) => replace(imageId)) : void 0;
|
|
1182
1174
|
return /* @__PURE__ */ jsxs6("figure", { children: [
|
|
1183
|
-
dodont && /* @__PURE__ */
|
|
1184
|
-
/* @__PURE__ */
|
|
1175
|
+
dodont && /* @__PURE__ */ jsx14("div", { className: "flex h-10 items-center justify-center pb-1", children: dodont === "do" ? /* @__PURE__ */ jsx14(Check, { size: 28, className: "text-green-600" }) : /* @__PURE__ */ jsx14(X, { size: 28, className: "text-red-600" }) }),
|
|
1176
|
+
/* @__PURE__ */ jsx14(
|
|
1185
1177
|
"div",
|
|
1186
1178
|
{
|
|
1187
1179
|
"data-testid": "media-open-surface",
|
|
@@ -1196,7 +1188,7 @@ function MediaBlock({ refValue, options, link, dodont, isEditMode, onRefChange }
|
|
|
1196
1188
|
children: media
|
|
1197
1189
|
}
|
|
1198
1190
|
),
|
|
1199
|
-
options.showCaption && /* @__PURE__ */
|
|
1191
|
+
options.showCaption && /* @__PURE__ */ jsx14("figcaption", { className: "mt-2 min-h-[1em] text-sm text-base-contrast-light", children: isEditMode && onRefChange ? /* @__PURE__ */ jsx14(
|
|
1200
1192
|
EditablePlainText,
|
|
1201
1193
|
{
|
|
1202
1194
|
tag: "span",
|
|
@@ -1211,27 +1203,27 @@ function MediaBlock({ refValue, options, link, dodont, isEditMode, onRefChange }
|
|
|
1211
1203
|
}
|
|
1212
1204
|
|
|
1213
1205
|
// src/components/sections/Media/index.tsx
|
|
1214
|
-
import { jsx as
|
|
1215
|
-
var
|
|
1216
|
-
type:
|
|
1217
|
-
content:
|
|
1206
|
+
import { jsx as jsx15 } from "react/jsx-runtime";
|
|
1207
|
+
var schema2 = z3.object({
|
|
1208
|
+
type: z3.literal("media"),
|
|
1209
|
+
content: z3.object({
|
|
1218
1210
|
ref: SingleMediaReferenceSchema,
|
|
1219
1211
|
link: LinkValueSchema.optional(),
|
|
1220
|
-
dodont:
|
|
1212
|
+
dodont: z3.enum(["do", "dont"]).optional()
|
|
1221
1213
|
}),
|
|
1222
|
-
options:
|
|
1223
|
-
square:
|
|
1224
|
-
showCaption:
|
|
1225
|
-
border:
|
|
1226
|
-
objectFit:
|
|
1214
|
+
options: z3.object({
|
|
1215
|
+
square: z3.boolean().optional(),
|
|
1216
|
+
showCaption: z3.boolean().optional(),
|
|
1217
|
+
border: z3.boolean().optional(),
|
|
1218
|
+
objectFit: z3.enum(["cover", "contain"]).optional()
|
|
1227
1219
|
}).default({})
|
|
1228
1220
|
});
|
|
1229
1221
|
var Media_default = defineSection({
|
|
1230
1222
|
type: "media",
|
|
1231
1223
|
label: "Media",
|
|
1232
|
-
icon: /* @__PURE__ */
|
|
1233
|
-
schema:
|
|
1234
|
-
component: ({ content, options, onChange }) => /* @__PURE__ */
|
|
1224
|
+
icon: /* @__PURE__ */ jsx15(ImageIcon2, { size: 18 }),
|
|
1225
|
+
schema: schema2,
|
|
1226
|
+
component: ({ content, options, onChange }) => /* @__PURE__ */ jsx15(
|
|
1235
1227
|
MediaBlock,
|
|
1236
1228
|
{
|
|
1237
1229
|
refValue: content.content.ref,
|
|
@@ -1285,19 +1277,19 @@ var Media_default = defineSection({
|
|
|
1285
1277
|
});
|
|
1286
1278
|
|
|
1287
1279
|
// src/components/sections/Button/index.tsx
|
|
1288
|
-
import { z as
|
|
1280
|
+
import { z as z4 } from "zod";
|
|
1289
1281
|
import { RectangleHorizontal } from "lucide-react";
|
|
1290
1282
|
|
|
1291
1283
|
// src/components/sections/Button/CTAButton.tsx
|
|
1292
1284
|
import { Download } from "lucide-react";
|
|
1293
|
-
import { jsx as
|
|
1285
|
+
import { jsx as jsx16, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1294
1286
|
function Button3({ text, link, download, onChange }) {
|
|
1295
1287
|
const base = "inline-block rounded-md px-6 py-3 font-bold transition-colors";
|
|
1296
1288
|
const variant = "border-2 border-primary text-primary hover:bg-primary hover:text-primary-contrast";
|
|
1297
1289
|
if (onChange) {
|
|
1298
1290
|
return /* @__PURE__ */ jsxs7("span", { className: cn(base, variant, "inline-flex items-center gap-2"), children: [
|
|
1299
|
-
download && /* @__PURE__ */
|
|
1300
|
-
/* @__PURE__ */
|
|
1291
|
+
download && /* @__PURE__ */ jsx16(Download, { size: 16, className: "shrink-0" }),
|
|
1292
|
+
/* @__PURE__ */ jsx16(
|
|
1301
1293
|
EditablePlainText,
|
|
1302
1294
|
{
|
|
1303
1295
|
tag: "span",
|
|
@@ -1320,31 +1312,31 @@ function Button3({ text, link, download, onChange }) {
|
|
|
1320
1312
|
download: download ? "" : void 0,
|
|
1321
1313
|
className: cn(base, variant, download && "inline-flex items-center gap-2"),
|
|
1322
1314
|
children: [
|
|
1323
|
-
download && /* @__PURE__ */
|
|
1315
|
+
download && /* @__PURE__ */ jsx16(Download, { size: 16, className: "shrink-0" }),
|
|
1324
1316
|
text
|
|
1325
1317
|
]
|
|
1326
1318
|
}
|
|
1327
1319
|
);
|
|
1328
1320
|
}
|
|
1329
|
-
return /* @__PURE__ */
|
|
1321
|
+
return /* @__PURE__ */ jsx16("button", { className: cn("cursor-pointer", base, variant), children: text });
|
|
1330
1322
|
}
|
|
1331
1323
|
|
|
1332
1324
|
// src/components/sections/Button/index.tsx
|
|
1333
|
-
import { jsx as
|
|
1334
|
-
var
|
|
1335
|
-
type:
|
|
1336
|
-
content:
|
|
1337
|
-
text:
|
|
1325
|
+
import { jsx as jsx17 } from "react/jsx-runtime";
|
|
1326
|
+
var schema3 = z4.object({
|
|
1327
|
+
type: z4.literal("button"),
|
|
1328
|
+
content: z4.object({
|
|
1329
|
+
text: z4.string(),
|
|
1338
1330
|
link: LinkValueSchema.optional(),
|
|
1339
|
-
download:
|
|
1331
|
+
download: z4.boolean().optional()
|
|
1340
1332
|
})
|
|
1341
1333
|
});
|
|
1342
1334
|
var Button_default = defineSection({
|
|
1343
1335
|
type: "button",
|
|
1344
1336
|
label: "Button",
|
|
1345
|
-
icon: /* @__PURE__ */
|
|
1346
|
-
schema:
|
|
1347
|
-
component: ({ content, onChange }) => /* @__PURE__ */
|
|
1337
|
+
icon: /* @__PURE__ */ jsx17(RectangleHorizontal, { size: 18 }),
|
|
1338
|
+
schema: schema3,
|
|
1339
|
+
component: ({ content, onChange }) => /* @__PURE__ */ jsx17(
|
|
1348
1340
|
Button3,
|
|
1349
1341
|
{
|
|
1350
1342
|
text: content.content.text,
|
|
@@ -1362,7 +1354,7 @@ var Button_default = defineSection({
|
|
|
1362
1354
|
});
|
|
1363
1355
|
|
|
1364
1356
|
// src/components/sections/Colors/index.tsx
|
|
1365
|
-
import { z as
|
|
1357
|
+
import { z as z5 } from "zod";
|
|
1366
1358
|
import { Palette } from "lucide-react";
|
|
1367
1359
|
|
|
1368
1360
|
// src/components/brandguide/Colors.tsx
|
|
@@ -1403,23 +1395,23 @@ import { ImageIcon as ImageIcon3 } from "lucide-react";
|
|
|
1403
1395
|
// src/components/shared/icons.tsx
|
|
1404
1396
|
import { GripVertical, Plus, Trash2, X as X2, Settings } from "lucide-react";
|
|
1405
1397
|
import { GripVertical as GripVertical2, Plus as Plus2, Trash2 as Trash22, X as X3, Settings as Settings2 } from "lucide-react";
|
|
1406
|
-
import { jsx as
|
|
1398
|
+
import { jsx as jsx18 } from "react/jsx-runtime";
|
|
1407
1399
|
function DragHandle({ size = 16 }) {
|
|
1408
|
-
return /* @__PURE__ */
|
|
1400
|
+
return /* @__PURE__ */ jsx18(GripVertical, { size });
|
|
1409
1401
|
}
|
|
1410
1402
|
function AddIcon({ size = 14 }) {
|
|
1411
|
-
return /* @__PURE__ */
|
|
1403
|
+
return /* @__PURE__ */ jsx18(Plus, { size });
|
|
1412
1404
|
}
|
|
1413
1405
|
function DeleteIcon({ size = 14 }) {
|
|
1414
|
-
return /* @__PURE__ */
|
|
1406
|
+
return /* @__PURE__ */ jsx18(Trash2, { size });
|
|
1415
1407
|
}
|
|
1416
1408
|
function SettingsIcon({ size = 14 }) {
|
|
1417
|
-
return /* @__PURE__ */
|
|
1409
|
+
return /* @__PURE__ */ jsx18(Settings, { size });
|
|
1418
1410
|
}
|
|
1419
1411
|
|
|
1420
1412
|
// src/components/shared/IconButton.tsx
|
|
1421
1413
|
import { forwardRef as forwardRef2 } from "react";
|
|
1422
|
-
import { jsx as
|
|
1414
|
+
import { jsx as jsx19 } from "react/jsx-runtime";
|
|
1423
1415
|
var sizeClasses = {
|
|
1424
1416
|
sm: "h-chrome-sm w-chrome-sm",
|
|
1425
1417
|
md: "h-chrome-md w-chrome-md",
|
|
@@ -1432,7 +1424,7 @@ var intentClasses = {
|
|
|
1432
1424
|
};
|
|
1433
1425
|
var IconButton = forwardRef2(
|
|
1434
1426
|
function IconButton2({ icon, label, size = "md", intent = "default", className, ...rest }, ref) {
|
|
1435
|
-
return /* @__PURE__ */
|
|
1427
|
+
return /* @__PURE__ */ jsx19(
|
|
1436
1428
|
"button",
|
|
1437
1429
|
{
|
|
1438
1430
|
ref,
|
|
@@ -1527,7 +1519,7 @@ function useEditableCollection({
|
|
|
1527
1519
|
}
|
|
1528
1520
|
|
|
1529
1521
|
// src/components/primitives/EditableGrid.tsx
|
|
1530
|
-
import { jsx as
|
|
1522
|
+
import { jsx as jsx20, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1531
1523
|
function EditableGrid({
|
|
1532
1524
|
items,
|
|
1533
1525
|
columns,
|
|
@@ -1567,10 +1559,10 @@ function EditableGrid({
|
|
|
1567
1559
|
};
|
|
1568
1560
|
}, []);
|
|
1569
1561
|
if (!isEditMode) {
|
|
1570
|
-
return /* @__PURE__ */
|
|
1562
|
+
return /* @__PURE__ */ jsx20("div", { className: "@container", children: /* @__PURE__ */ jsx20("div", { className: cn("grid gap-4", containerGridClass[columns] || containerGridClass[1], className), children: wrappedItems.map((wrapped, index) => /* @__PURE__ */ jsx20("div", { children: renderItem(wrapped.data, { isEditMode: false, index }) }, wrapped.id)) }) });
|
|
1571
1563
|
}
|
|
1572
|
-
return /* @__PURE__ */
|
|
1573
|
-
wrappedItems.map((wrapped, index) => /* @__PURE__ */
|
|
1564
|
+
return /* @__PURE__ */ jsx20("div", { className: "@container", children: /* @__PURE__ */ jsxs8("div", { className: cn("group/grid relative grid gap-4", containerGridClass[columns] || containerGridClass[1], className), children: [
|
|
1565
|
+
wrappedItems.map((wrapped, index) => /* @__PURE__ */ jsx20(
|
|
1574
1566
|
GridCell,
|
|
1575
1567
|
{
|
|
1576
1568
|
id: wrapped.id,
|
|
@@ -1589,10 +1581,10 @@ function EditableGrid({
|
|
|
1589
1581
|
},
|
|
1590
1582
|
wrapped.id
|
|
1591
1583
|
)),
|
|
1592
|
-
/* @__PURE__ */
|
|
1584
|
+
/* @__PURE__ */ jsx20(
|
|
1593
1585
|
IconButton,
|
|
1594
1586
|
{
|
|
1595
|
-
icon: /* @__PURE__ */
|
|
1587
|
+
icon: /* @__PURE__ */ jsx20(AddIcon, { size: 16 }),
|
|
1596
1588
|
label: "Add item",
|
|
1597
1589
|
size: "lg",
|
|
1598
1590
|
intent: "primary",
|
|
@@ -1687,12 +1679,12 @@ function GridCell({
|
|
|
1687
1679
|
isCellDragging && "opacity-50"
|
|
1688
1680
|
),
|
|
1689
1681
|
children: [
|
|
1690
|
-
showLeftEdge && /* @__PURE__ */
|
|
1691
|
-
showRightEdge && /* @__PURE__ */
|
|
1692
|
-
!isDragging && !isLast && /* @__PURE__ */
|
|
1682
|
+
showLeftEdge && /* @__PURE__ */ jsx20("div", { className: "absolute top-0 bottom-0 left-0 z-10 w-0.5 -translate-x-2 bg-primary" }),
|
|
1683
|
+
showRightEdge && /* @__PURE__ */ jsx20("div", { className: "absolute top-0 right-0 bottom-0 z-10 w-0.5 translate-x-2 bg-primary" }),
|
|
1684
|
+
!isDragging && !isLast && /* @__PURE__ */ jsx20(
|
|
1693
1685
|
IconButton,
|
|
1694
1686
|
{
|
|
1695
|
-
icon: /* @__PURE__ */
|
|
1687
|
+
icon: /* @__PURE__ */ jsx20(AddIcon, { size: 12 }),
|
|
1696
1688
|
label: "Insert item",
|
|
1697
1689
|
size: "sm",
|
|
1698
1690
|
intent: "primary",
|
|
@@ -1700,39 +1692,39 @@ function GridCell({
|
|
|
1700
1692
|
className: "absolute top-1/2 -right-2 z-20 -translate-y-1/2 translate-x-1/2 rounded-full border border-base-200 bg-base opacity-0 group-hover/cell:opacity-100"
|
|
1701
1693
|
}
|
|
1702
1694
|
),
|
|
1703
|
-
/* @__PURE__ */
|
|
1695
|
+
/* @__PURE__ */ jsx20(
|
|
1704
1696
|
IconButton,
|
|
1705
1697
|
{
|
|
1706
1698
|
ref: handleRef,
|
|
1707
|
-
icon: /* @__PURE__ */
|
|
1699
|
+
icon: /* @__PURE__ */ jsx20(DragHandle, { size: 16 }),
|
|
1708
1700
|
label: "Drag to reorder",
|
|
1709
1701
|
className: cn("absolute left-1.5 z-10 cursor-grab bg-base/80 opacity-0 shadow-sm group-hover/cell:opacity-100 no-hover:opacity-100", chromeTopClass || "top-1.5"),
|
|
1710
1702
|
tabIndex: -1
|
|
1711
1703
|
}
|
|
1712
1704
|
),
|
|
1713
1705
|
/* @__PURE__ */ jsxs8("div", { className: cn("absolute right-1.5 z-10 flex items-center gap-1 opacity-0 group-hover/cell:opacity-100 no-hover:opacity-100", chromeTopClass || "top-1.5"), children: [
|
|
1714
|
-
onImageClick && /* @__PURE__ */
|
|
1706
|
+
onImageClick && /* @__PURE__ */ jsx20(
|
|
1715
1707
|
IconButton,
|
|
1716
1708
|
{
|
|
1717
|
-
icon: /* @__PURE__ */
|
|
1709
|
+
icon: /* @__PURE__ */ jsx20(ImageIcon3, { size: 16 }),
|
|
1718
1710
|
label: "Change image",
|
|
1719
1711
|
onClick: onImageClick,
|
|
1720
1712
|
className: "bg-base/80 shadow-sm"
|
|
1721
1713
|
}
|
|
1722
1714
|
),
|
|
1723
|
-
onSettings && /* @__PURE__ */
|
|
1715
|
+
onSettings && /* @__PURE__ */ jsx20(
|
|
1724
1716
|
IconButton,
|
|
1725
1717
|
{
|
|
1726
|
-
icon: /* @__PURE__ */
|
|
1718
|
+
icon: /* @__PURE__ */ jsx20(SettingsIcon, { size: 16 }),
|
|
1727
1719
|
label: "Item settings",
|
|
1728
1720
|
onClick: onSettings,
|
|
1729
1721
|
className: "bg-base/80 shadow-sm"
|
|
1730
1722
|
}
|
|
1731
1723
|
),
|
|
1732
|
-
/* @__PURE__ */
|
|
1724
|
+
/* @__PURE__ */ jsx20(
|
|
1733
1725
|
IconButton,
|
|
1734
1726
|
{
|
|
1735
|
-
icon: /* @__PURE__ */
|
|
1727
|
+
icon: /* @__PURE__ */ jsx20(DeleteIcon, { size: 16 }),
|
|
1736
1728
|
label: "Delete item",
|
|
1737
1729
|
intent: "destructive",
|
|
1738
1730
|
onClick: () => onRemove(id),
|
|
@@ -1753,9 +1745,9 @@ import { useState as useState8 } from "react";
|
|
|
1753
1745
|
import { forwardRef as forwardRef3, useId } from "react";
|
|
1754
1746
|
|
|
1755
1747
|
// src/components/shared/FormLabel.tsx
|
|
1756
|
-
import { jsx as
|
|
1748
|
+
import { jsx as jsx21 } from "react/jsx-runtime";
|
|
1757
1749
|
function FormLabel({ htmlFor, children, className }) {
|
|
1758
|
-
return /* @__PURE__ */
|
|
1750
|
+
return /* @__PURE__ */ jsx21(
|
|
1759
1751
|
"label",
|
|
1760
1752
|
{
|
|
1761
1753
|
htmlFor,
|
|
@@ -1766,13 +1758,13 @@ function FormLabel({ htmlFor, children, className }) {
|
|
|
1766
1758
|
}
|
|
1767
1759
|
|
|
1768
1760
|
// src/components/shared/Input.tsx
|
|
1769
|
-
import { jsx as
|
|
1761
|
+
import { jsx as jsx22, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1770
1762
|
var Input = forwardRef3(function Input2({ label, value, onChange, type = "text", className, disabled, error, ...rest }, ref) {
|
|
1771
1763
|
const id = useId();
|
|
1772
1764
|
const errorId = `${id}-error`;
|
|
1773
1765
|
return /* @__PURE__ */ jsxs9("div", { className, children: [
|
|
1774
|
-
/* @__PURE__ */
|
|
1775
|
-
/* @__PURE__ */
|
|
1766
|
+
/* @__PURE__ */ jsx22(FormLabel, { htmlFor: id, children: label }),
|
|
1767
|
+
/* @__PURE__ */ jsx22(
|
|
1776
1768
|
"input",
|
|
1777
1769
|
{
|
|
1778
1770
|
ref,
|
|
@@ -1791,12 +1783,12 @@ var Input = forwardRef3(function Input2({ label, value, onChange, type = "text",
|
|
|
1791
1783
|
...rest
|
|
1792
1784
|
}
|
|
1793
1785
|
),
|
|
1794
|
-
error && /* @__PURE__ */
|
|
1786
|
+
error && /* @__PURE__ */ jsx22("p", { id: errorId, className: "mt-1 text-xs text-red-600", children: error })
|
|
1795
1787
|
] });
|
|
1796
1788
|
});
|
|
1797
1789
|
|
|
1798
1790
|
// src/components/brandguide/ColorSwatchSettings.tsx
|
|
1799
|
-
import { jsx as
|
|
1791
|
+
import { jsx as jsx23, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1800
1792
|
function mergeSpaces(spaces) {
|
|
1801
1793
|
return Object.assign({}, ...spaces);
|
|
1802
1794
|
}
|
|
@@ -1815,7 +1807,7 @@ function ColorSwatchSettings({ color, onChange }) {
|
|
|
1815
1807
|
update({ ...localColor, spaces: [newSpace] });
|
|
1816
1808
|
};
|
|
1817
1809
|
return /* @__PURE__ */ jsxs10("div", { className: "space-y-3", children: [
|
|
1818
|
-
/* @__PURE__ */
|
|
1810
|
+
/* @__PURE__ */ jsx23(
|
|
1819
1811
|
Input,
|
|
1820
1812
|
{
|
|
1821
1813
|
label: "Name",
|
|
@@ -1823,7 +1815,7 @@ function ColorSwatchSettings({ color, onChange }) {
|
|
|
1823
1815
|
onChange: (name) => update({ ...localColor, name })
|
|
1824
1816
|
}
|
|
1825
1817
|
),
|
|
1826
|
-
["hex", "rgb", "cmyk", "pantone"].map((key) => /* @__PURE__ */
|
|
1818
|
+
["hex", "rgb", "cmyk", "pantone"].map((key) => /* @__PURE__ */ jsx23(
|
|
1827
1819
|
Input,
|
|
1828
1820
|
{
|
|
1829
1821
|
label: key.toUpperCase(),
|
|
@@ -1836,7 +1828,7 @@ function ColorSwatchSettings({ color, onChange }) {
|
|
|
1836
1828
|
}
|
|
1837
1829
|
|
|
1838
1830
|
// src/components/brandguide/Colors.tsx
|
|
1839
|
-
import { jsx as
|
|
1831
|
+
import { jsx as jsx24, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1840
1832
|
function getContrastClass(hex) {
|
|
1841
1833
|
if (!hex) return "text-white";
|
|
1842
1834
|
const h = hex.replace("#", "");
|
|
@@ -1861,7 +1853,7 @@ function buildContent(colors, options) {
|
|
|
1861
1853
|
}
|
|
1862
1854
|
function Colors({ colors, columns = 3, label, collapsing, showLabel = true, onChange, openModal }) {
|
|
1863
1855
|
if (onChange && openModal) {
|
|
1864
|
-
return /* @__PURE__ */
|
|
1856
|
+
return /* @__PURE__ */ jsx24(
|
|
1865
1857
|
ColorsEditable,
|
|
1866
1858
|
{
|
|
1867
1859
|
colors,
|
|
@@ -1874,7 +1866,7 @@ function Colors({ colors, columns = 3, label, collapsing, showLabel = true, onCh
|
|
|
1874
1866
|
}
|
|
1875
1867
|
);
|
|
1876
1868
|
}
|
|
1877
|
-
return /* @__PURE__ */
|
|
1869
|
+
return /* @__PURE__ */ jsx24(ColorsView, { colors, columns, label, collapsing, showLabel });
|
|
1878
1870
|
}
|
|
1879
1871
|
function ColorsView({
|
|
1880
1872
|
colors,
|
|
@@ -1903,35 +1895,35 @@ function ColorsView({
|
|
|
1903
1895
|
};
|
|
1904
1896
|
return /* @__PURE__ */ jsxs11("div", { children: [
|
|
1905
1897
|
(showLabel && !!label || collapsing) && /* @__PURE__ */ jsxs11("div", { className: "mb-4 flex items-center gap-2", children: [
|
|
1906
|
-
showLabel && !!label && /* @__PURE__ */
|
|
1898
|
+
showLabel && !!label && /* @__PURE__ */ jsx24("span", { className: "text-lg font-bold", children: label }),
|
|
1907
1899
|
collapsing && /* @__PURE__ */ jsxs11(
|
|
1908
1900
|
"button",
|
|
1909
1901
|
{
|
|
1910
1902
|
onClick: () => setExpanded(!expanded),
|
|
1911
1903
|
className: "cursor-pointer ml-auto flex items-center gap-1.5 text-sm text-base-contrast-light hover:text-base-contrast",
|
|
1912
1904
|
children: [
|
|
1913
|
-
/* @__PURE__ */
|
|
1914
|
-
expanded ? /* @__PURE__ */
|
|
1905
|
+
/* @__PURE__ */ jsx24("span", { children: expanded ? "Hide Details" : "Show Details" }),
|
|
1906
|
+
expanded ? /* @__PURE__ */ jsx24(EyeOff, { size: 16 }) : /* @__PURE__ */ jsx24(Eye, { size: 16 })
|
|
1915
1907
|
]
|
|
1916
1908
|
}
|
|
1917
1909
|
)
|
|
1918
1910
|
] }),
|
|
1919
|
-
/* @__PURE__ */
|
|
1911
|
+
/* @__PURE__ */ jsx24("div", { className: "@container", children: /* @__PURE__ */ jsx24("div", { className: cn("grid gap-4", containerGridClass[columns] || containerGridClass[3]), children: colors.map((color, i) => {
|
|
1920
1912
|
const hex = color.spaces[0]?.hex;
|
|
1921
1913
|
const contrast = getContrastClass(hex);
|
|
1922
1914
|
return /* @__PURE__ */ jsxs11("div", { className: "overflow-hidden rounded-md border border-base-200", children: [
|
|
1923
1915
|
/* @__PURE__ */ jsxs11("div", { className: cn("relative flex min-h-[80px] items-end p-3", contrast), style: { backgroundColor: hex || "#ccc" }, children: [
|
|
1924
|
-
color.name && /* @__PURE__ */
|
|
1925
|
-
copiedIndex === i && /* @__PURE__ */
|
|
1916
|
+
color.name && /* @__PURE__ */ jsx24("span", { className: "text-sm font-bold", children: color.name }),
|
|
1917
|
+
copiedIndex === i && /* @__PURE__ */ jsx24("span", { className: cn(
|
|
1926
1918
|
"absolute top-2 right-2 rounded-full px-2.5 py-0.5 text-xs font-medium",
|
|
1927
1919
|
getContrastClass(hex) === "text-black" ? "bg-black/15 text-black" : "bg-white/25 text-white"
|
|
1928
1920
|
), children: "Copied!" })
|
|
1929
1921
|
] }),
|
|
1930
|
-
expanded && /* @__PURE__ */
|
|
1922
|
+
expanded && /* @__PURE__ */ jsx24("div", { className: "space-y-1 bg-base-accent p-3 text-sm", children: color.spaces.map(
|
|
1931
1923
|
(space, j) => Object.entries(space).map(
|
|
1932
1924
|
([key, value]) => value ? /* @__PURE__ */ jsxs11("button", { onClick: () => handleCopy(value, i), className: "cursor-pointer flex w-full justify-between hover:text-primary", children: [
|
|
1933
|
-
/* @__PURE__ */
|
|
1934
|
-
/* @__PURE__ */
|
|
1925
|
+
/* @__PURE__ */ jsx24("span", { className: "font-medium uppercase", children: key }),
|
|
1926
|
+
/* @__PURE__ */ jsx24("span", { children: value })
|
|
1935
1927
|
] }, `${j}-${key}`) : null
|
|
1936
1928
|
)
|
|
1937
1929
|
) })
|
|
@@ -1957,7 +1949,7 @@ function ColorsEditable({
|
|
|
1957
1949
|
const color = colors[index];
|
|
1958
1950
|
openModal(
|
|
1959
1951
|
"Color Settings",
|
|
1960
|
-
/* @__PURE__ */
|
|
1952
|
+
/* @__PURE__ */ jsx24(ColorSwatchSettings, { color, onChange: (updated) => {
|
|
1961
1953
|
const newColors = colors.map((c, i) => i === index ? updated : c);
|
|
1962
1954
|
onChange(buildContent(newColors, options));
|
|
1963
1955
|
} })
|
|
@@ -1965,7 +1957,7 @@ function ColorsEditable({
|
|
|
1965
1957
|
};
|
|
1966
1958
|
return /* @__PURE__ */ jsxs11("div", { children: [
|
|
1967
1959
|
(showLabel && !!label || collapsing) && /* @__PURE__ */ jsxs11("div", { className: "mb-4 flex items-center gap-2", children: [
|
|
1968
|
-
showLabel && !!label && /* @__PURE__ */
|
|
1960
|
+
showLabel && !!label && /* @__PURE__ */ jsx24(
|
|
1969
1961
|
EditablePlainText,
|
|
1970
1962
|
{
|
|
1971
1963
|
tag: "span",
|
|
@@ -1981,13 +1973,13 @@ function ColorsEditable({
|
|
|
1981
1973
|
onClick: () => setExpanded(!expanded),
|
|
1982
1974
|
className: "cursor-pointer ml-auto flex items-center gap-1.5 text-sm text-base-contrast-light hover:text-base-contrast",
|
|
1983
1975
|
children: [
|
|
1984
|
-
/* @__PURE__ */
|
|
1985
|
-
expanded ? /* @__PURE__ */
|
|
1976
|
+
/* @__PURE__ */ jsx24("span", { children: expanded ? "Hide Details" : "Show Details" }),
|
|
1977
|
+
expanded ? /* @__PURE__ */ jsx24(EyeOff, { size: 16 }) : /* @__PURE__ */ jsx24(Eye, { size: 16 })
|
|
1986
1978
|
]
|
|
1987
1979
|
}
|
|
1988
1980
|
)
|
|
1989
1981
|
] }),
|
|
1990
|
-
/* @__PURE__ */
|
|
1982
|
+
/* @__PURE__ */ jsx24(
|
|
1991
1983
|
EditableGrid,
|
|
1992
1984
|
{
|
|
1993
1985
|
items: colors,
|
|
@@ -1996,7 +1988,7 @@ function ColorsEditable({
|
|
|
1996
1988
|
createItem: createColorItem,
|
|
1997
1989
|
isEditMode: true,
|
|
1998
1990
|
onItemSettings: handleItemSettings,
|
|
1999
|
-
renderItem: (color, { index }) => /* @__PURE__ */
|
|
1991
|
+
renderItem: (color, { index }) => /* @__PURE__ */ jsx24(
|
|
2000
1992
|
ColorSwatchEditable,
|
|
2001
1993
|
{
|
|
2002
1994
|
color,
|
|
@@ -2026,7 +2018,7 @@ function ColorSwatchEditable({
|
|
|
2026
2018
|
onChange(buildContent(newColors, options));
|
|
2027
2019
|
};
|
|
2028
2020
|
return /* @__PURE__ */ jsxs11("div", { className: "overflow-hidden rounded-md border border-base-200", children: [
|
|
2029
|
-
/* @__PURE__ */
|
|
2021
|
+
/* @__PURE__ */ jsx24("div", { className: cn("flex min-h-[80px] items-end p-3", contrast), style: { backgroundColor: hex || "#ccc" }, children: /* @__PURE__ */ jsx24(
|
|
2030
2022
|
EditablePlainText,
|
|
2031
2023
|
{
|
|
2032
2024
|
tag: "span",
|
|
@@ -2037,11 +2029,11 @@ function ColorSwatchEditable({
|
|
|
2037
2029
|
className: "text-sm font-bold"
|
|
2038
2030
|
}
|
|
2039
2031
|
) }),
|
|
2040
|
-
expanded && /* @__PURE__ */
|
|
2032
|
+
expanded && /* @__PURE__ */ jsx24("div", { className: "space-y-1 bg-base-accent p-3 text-sm", children: color.spaces.map(
|
|
2041
2033
|
(space, j) => Object.entries(space).map(
|
|
2042
2034
|
([key, value]) => value ? /* @__PURE__ */ jsxs11("div", { className: "flex w-full justify-between", children: [
|
|
2043
|
-
/* @__PURE__ */
|
|
2044
|
-
/* @__PURE__ */
|
|
2035
|
+
/* @__PURE__ */ jsx24("span", { className: "font-medium uppercase", children: key }),
|
|
2036
|
+
/* @__PURE__ */ jsx24("span", { children: value })
|
|
2045
2037
|
] }, `${j}-${key}`) : null
|
|
2046
2038
|
)
|
|
2047
2039
|
) })
|
|
@@ -2049,23 +2041,23 @@ function ColorSwatchEditable({
|
|
|
2049
2041
|
}
|
|
2050
2042
|
|
|
2051
2043
|
// src/components/sections/Colors/index.tsx
|
|
2052
|
-
import { jsx as
|
|
2053
|
-
var
|
|
2054
|
-
type:
|
|
2055
|
-
content:
|
|
2056
|
-
options:
|
|
2057
|
-
label:
|
|
2058
|
-
columns:
|
|
2059
|
-
collapsing:
|
|
2060
|
-
showLabel:
|
|
2044
|
+
import { jsx as jsx25 } from "react/jsx-runtime";
|
|
2045
|
+
var schema4 = z5.object({
|
|
2046
|
+
type: z5.literal("colors"),
|
|
2047
|
+
content: z5.object({ colors: z5.array(ColorItemSchema) }),
|
|
2048
|
+
options: z5.object({
|
|
2049
|
+
label: z5.string().optional(),
|
|
2050
|
+
columns: z5.number().int().min(2).max(4).optional(),
|
|
2051
|
+
collapsing: z5.boolean().optional(),
|
|
2052
|
+
showLabel: z5.boolean().optional()
|
|
2061
2053
|
}).optional()
|
|
2062
2054
|
});
|
|
2063
2055
|
var Colors_default = defineSection({
|
|
2064
2056
|
type: "colors",
|
|
2065
2057
|
label: "Colors",
|
|
2066
|
-
icon: /* @__PURE__ */
|
|
2067
|
-
schema:
|
|
2068
|
-
component: ({ content, options, onChange, openModal }) => /* @__PURE__ */
|
|
2058
|
+
icon: /* @__PURE__ */ jsx25(Palette, { size: 18 }),
|
|
2059
|
+
schema: schema4,
|
|
2060
|
+
component: ({ content, options, onChange, openModal }) => /* @__PURE__ */ jsx25(
|
|
2069
2061
|
Colors,
|
|
2070
2062
|
{
|
|
2071
2063
|
colors: content.content.colors,
|
|
@@ -2081,10 +2073,7 @@ var Colors_default = defineSection({
|
|
|
2081
2073
|
type: "colors",
|
|
2082
2074
|
content: { colors: [{ spaces: [{ hex: "#000000" }] }] }
|
|
2083
2075
|
}),
|
|
2084
|
-
getLabel: (content) =>
|
|
2085
|
-
const n = content.content.colors.length;
|
|
2086
|
-
return `${n} color${n === 1 ? "" : "s"}`;
|
|
2087
|
-
},
|
|
2076
|
+
getLabel: (content) => pluralize(content.content.colors.length, "color"),
|
|
2088
2077
|
getThumbnails: (content) => content.content.colors.filter((c) => c.spaces[0]?.hex).map((c) => ({ type: "color", value: c.spaces[0].hex })),
|
|
2089
2078
|
settings: {
|
|
2090
2079
|
columns: {
|
|
@@ -2101,7 +2090,7 @@ var Colors_default = defineSection({
|
|
|
2101
2090
|
});
|
|
2102
2091
|
|
|
2103
2092
|
// src/components/sections/IconList/index.tsx
|
|
2104
|
-
import { z as
|
|
2093
|
+
import { z as z6 } from "zod";
|
|
2105
2094
|
import { List } from "lucide-react";
|
|
2106
2095
|
|
|
2107
2096
|
// src/components/sections/IconList/IconList.tsx
|
|
@@ -2111,7 +2100,7 @@ import { CopyPlus, Pencil } from "lucide-react";
|
|
|
2111
2100
|
// src/components/primitives/IconPicker.tsx
|
|
2112
2101
|
import { useEffect as useEffect8, useRef as useRef7, useState as useState10 } from "react";
|
|
2113
2102
|
import { Check as Check2, X as X4 } from "lucide-react";
|
|
2114
|
-
import { Fragment as Fragment4, jsx as
|
|
2103
|
+
import { Fragment as Fragment4, jsx as jsx26, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
2115
2104
|
function IconPicker({
|
|
2116
2105
|
selected,
|
|
2117
2106
|
onSelect,
|
|
@@ -2140,7 +2129,7 @@ function IconPicker({
|
|
|
2140
2129
|
className: "absolute z-50 w-56 rounded-lg border border-base-200 bg-base p-2 shadow-lg",
|
|
2141
2130
|
children: [
|
|
2142
2131
|
allowDoDont && /* @__PURE__ */ jsxs12("div", { role: "tablist", "aria-label": "Icon mode", className: "mb-2 flex gap-1 rounded-md bg-base-200 p-0.5", children: [
|
|
2143
|
-
/* @__PURE__ */
|
|
2132
|
+
/* @__PURE__ */ jsx26(
|
|
2144
2133
|
"button",
|
|
2145
2134
|
{
|
|
2146
2135
|
type: "button",
|
|
@@ -2158,7 +2147,7 @@ function IconPicker({
|
|
|
2158
2147
|
children: "None"
|
|
2159
2148
|
}
|
|
2160
2149
|
),
|
|
2161
|
-
/* @__PURE__ */
|
|
2150
|
+
/* @__PURE__ */ jsx26(
|
|
2162
2151
|
"button",
|
|
2163
2152
|
{
|
|
2164
2153
|
type: "button",
|
|
@@ -2187,8 +2176,8 @@ function IconPicker({
|
|
|
2187
2176
|
),
|
|
2188
2177
|
onClick: () => onSelectDoDont?.("do"),
|
|
2189
2178
|
children: [
|
|
2190
|
-
/* @__PURE__ */
|
|
2191
|
-
/* @__PURE__ */
|
|
2179
|
+
/* @__PURE__ */ jsx26(Check2, { size: 20 }),
|
|
2180
|
+
/* @__PURE__ */ jsx26("span", { className: "text-xs font-medium", children: "Do" })
|
|
2192
2181
|
]
|
|
2193
2182
|
}
|
|
2194
2183
|
),
|
|
@@ -2204,16 +2193,16 @@ function IconPicker({
|
|
|
2204
2193
|
),
|
|
2205
2194
|
onClick: () => onSelectDoDont?.("dont"),
|
|
2206
2195
|
children: [
|
|
2207
|
-
/* @__PURE__ */
|
|
2208
|
-
/* @__PURE__ */
|
|
2196
|
+
/* @__PURE__ */ jsx26(X4, { size: 20 }),
|
|
2197
|
+
/* @__PURE__ */ jsx26("span", { className: "text-xs font-medium", children: "Don't" })
|
|
2209
2198
|
]
|
|
2210
2199
|
}
|
|
2211
2200
|
)
|
|
2212
2201
|
] }) : /* @__PURE__ */ jsxs12(Fragment4, { children: [
|
|
2213
|
-
/* @__PURE__ */
|
|
2202
|
+
/* @__PURE__ */ jsx26("div", { className: "grid grid-cols-5 gap-1", children: curatedIcons.map((entry) => {
|
|
2214
2203
|
const Icon = entry.icon;
|
|
2215
2204
|
const isSelected = selected === entry.id;
|
|
2216
|
-
return /* @__PURE__ */
|
|
2205
|
+
return /* @__PURE__ */ jsx26(
|
|
2217
2206
|
"button",
|
|
2218
2207
|
{
|
|
2219
2208
|
"aria-label": entry.label,
|
|
@@ -2223,12 +2212,12 @@ function IconPicker({
|
|
|
2223
2212
|
isSelected && "ring-2 ring-primary bg-base-accent text-primary"
|
|
2224
2213
|
),
|
|
2225
2214
|
onClick: () => onSelect(entry.id),
|
|
2226
|
-
children: /* @__PURE__ */
|
|
2215
|
+
children: /* @__PURE__ */ jsx26(Icon, { size: 18 })
|
|
2227
2216
|
},
|
|
2228
2217
|
entry.id
|
|
2229
2218
|
);
|
|
2230
2219
|
}) }),
|
|
2231
|
-
showRemove && /* @__PURE__ */
|
|
2220
|
+
showRemove && /* @__PURE__ */ jsx26(
|
|
2232
2221
|
"button",
|
|
2233
2222
|
{
|
|
2234
2223
|
className: "cursor-pointer mt-2 w-full rounded px-2 py-1.5 text-center text-xs text-base-contrast-light hover:bg-base-accent hover:text-base-contrast",
|
|
@@ -2243,7 +2232,7 @@ function IconPicker({
|
|
|
2243
2232
|
}
|
|
2244
2233
|
|
|
2245
2234
|
// src/components/sections/IconList/IconList.tsx
|
|
2246
|
-
import { jsx as
|
|
2235
|
+
import { jsx as jsx27, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
2247
2236
|
function IconList({
|
|
2248
2237
|
items,
|
|
2249
2238
|
icon = null,
|
|
@@ -2268,7 +2257,7 @@ function IconList({
|
|
|
2268
2257
|
[onChange, onItemsChange, icon, showLabel, stackText]
|
|
2269
2258
|
);
|
|
2270
2259
|
if (!isEditMode) {
|
|
2271
|
-
return /* @__PURE__ */
|
|
2260
|
+
return /* @__PURE__ */ jsx27(
|
|
2272
2261
|
ViewIconList,
|
|
2273
2262
|
{
|
|
2274
2263
|
items,
|
|
@@ -2281,7 +2270,7 @@ function IconList({
|
|
|
2281
2270
|
}
|
|
2282
2271
|
);
|
|
2283
2272
|
}
|
|
2284
|
-
return /* @__PURE__ */
|
|
2273
|
+
return /* @__PURE__ */ jsx27(
|
|
2285
2274
|
EditIconList,
|
|
2286
2275
|
{
|
|
2287
2276
|
items,
|
|
@@ -2316,7 +2305,7 @@ function ViewIconList({
|
|
|
2316
2305
|
iconClassName
|
|
2317
2306
|
}) {
|
|
2318
2307
|
const hasAnyIcon = items.some((item) => resolveIcon(item, defaultIcon));
|
|
2319
|
-
return /* @__PURE__ */
|
|
2308
|
+
return /* @__PURE__ */ jsx27("div", { className: "grid gap-4 pb-4", children: items.map((item, i) => {
|
|
2320
2309
|
const iconEntry = resolveIcon(item, defaultIcon);
|
|
2321
2310
|
const iconColor = resolveIconColor(item, iconClassName);
|
|
2322
2311
|
return /* @__PURE__ */ jsxs13(
|
|
@@ -2327,12 +2316,12 @@ function ViewIconList({
|
|
|
2327
2316
|
hasAnyIcon ? "grid-cols-[24px_1fr]" : "grid-cols-1"
|
|
2328
2317
|
),
|
|
2329
2318
|
children: [
|
|
2330
|
-
hasAnyIcon && /* @__PURE__ */
|
|
2319
|
+
hasAnyIcon && /* @__PURE__ */ jsx27(
|
|
2331
2320
|
"div",
|
|
2332
2321
|
{
|
|
2333
2322
|
"data-testid": "icon-list-icon",
|
|
2334
2323
|
className: cn("flex items-start pt-0.5", iconColor),
|
|
2335
|
-
children: iconEntry && /* @__PURE__ */
|
|
2324
|
+
children: iconEntry && /* @__PURE__ */ jsx27(iconEntry.icon, { size: 18 })
|
|
2336
2325
|
}
|
|
2337
2326
|
),
|
|
2338
2327
|
/* @__PURE__ */ jsxs13(
|
|
@@ -2345,7 +2334,7 @@ function ViewIconList({
|
|
|
2345
2334
|
item.label,
|
|
2346
2335
|
!stackText && " "
|
|
2347
2336
|
] }),
|
|
2348
|
-
/* @__PURE__ */
|
|
2337
|
+
/* @__PURE__ */ jsx27("span", { className: textClassName, children: item.text })
|
|
2349
2338
|
]
|
|
2350
2339
|
}
|
|
2351
2340
|
)
|
|
@@ -2394,7 +2383,7 @@ function EditIconList({
|
|
|
2394
2383
|
);
|
|
2395
2384
|
const hasAnyIcon = true;
|
|
2396
2385
|
return /* @__PURE__ */ jsxs13("div", { className: "group/list relative grid gap-4 pb-4", children: [
|
|
2397
|
-
wrappedItems.map((wrapped, index) => /* @__PURE__ */
|
|
2386
|
+
wrappedItems.map((wrapped, index) => /* @__PURE__ */ jsx27(
|
|
2398
2387
|
EditableRow,
|
|
2399
2388
|
{
|
|
2400
2389
|
id: wrapped.id,
|
|
@@ -2416,7 +2405,7 @@ function EditIconList({
|
|
|
2416
2405
|
},
|
|
2417
2406
|
wrapped.id
|
|
2418
2407
|
)),
|
|
2419
|
-
/* @__PURE__ */
|
|
2408
|
+
/* @__PURE__ */ jsx27(
|
|
2420
2409
|
TrailingDropZone,
|
|
2421
2410
|
{
|
|
2422
2411
|
index: wrappedItems.length,
|
|
@@ -2425,10 +2414,10 @@ function EditIconList({
|
|
|
2425
2414
|
onReorder
|
|
2426
2415
|
}
|
|
2427
2416
|
),
|
|
2428
|
-
/* @__PURE__ */
|
|
2417
|
+
/* @__PURE__ */ jsx27(
|
|
2429
2418
|
IconButton,
|
|
2430
2419
|
{
|
|
2431
|
-
icon: /* @__PURE__ */
|
|
2420
|
+
icon: /* @__PURE__ */ jsx27(AddIcon, { size: 16 }),
|
|
2432
2421
|
label: "Add item",
|
|
2433
2422
|
size: "lg",
|
|
2434
2423
|
intent: "primary",
|
|
@@ -2529,16 +2518,16 @@ function EditableRow({
|
|
|
2529
2518
|
onMouseEnter: () => setIconHover(true),
|
|
2530
2519
|
onMouseLeave: () => setIconHover(false),
|
|
2531
2520
|
children: [
|
|
2532
|
-
/* @__PURE__ */
|
|
2521
|
+
/* @__PURE__ */ jsx27(
|
|
2533
2522
|
"button",
|
|
2534
2523
|
{
|
|
2535
2524
|
className: "cursor-pointer transition-opacity hover:opacity-70",
|
|
2536
2525
|
"aria-label": "Change icon",
|
|
2537
2526
|
onClick: () => setPickerOpen((prev) => !prev),
|
|
2538
|
-
children: iconHover && !pickerOpen ? /* @__PURE__ */
|
|
2527
|
+
children: iconHover && !pickerOpen ? /* @__PURE__ */ jsx27(Pencil, { size: 18, className: "text-base-contrast-light" }) : iconEntry ? /* @__PURE__ */ jsx27(iconEntry.icon, { size: 18 }) : /* @__PURE__ */ jsx27("span", { className: "flex h-[18px] w-[18px] items-center justify-center rounded-sm border border-dashed border-base-contrast-light/40" })
|
|
2539
2528
|
}
|
|
2540
2529
|
),
|
|
2541
|
-
pickerOpen && /* @__PURE__ */
|
|
2530
|
+
pickerOpen && /* @__PURE__ */ jsx27("div", { className: "absolute top-full left-0 z-50 mt-1", children: /* @__PURE__ */ jsx27(
|
|
2542
2531
|
IconPicker,
|
|
2543
2532
|
{
|
|
2544
2533
|
selected: effectiveIconId,
|
|
@@ -2567,7 +2556,7 @@ function EditableRow({
|
|
|
2567
2556
|
}
|
|
2568
2557
|
),
|
|
2569
2558
|
/* @__PURE__ */ jsxs13("div", { className: stackText ? "flex flex-col" : void 0, children: [
|
|
2570
|
-
showLabel && /* @__PURE__ */
|
|
2559
|
+
showLabel && /* @__PURE__ */ jsx27(
|
|
2571
2560
|
EditablePlainText,
|
|
2572
2561
|
{
|
|
2573
2562
|
tag: "span",
|
|
@@ -2578,7 +2567,7 @@ function EditableRow({
|
|
|
2578
2567
|
className: cn(labelClassName, !stackText && "mr-1")
|
|
2579
2568
|
}
|
|
2580
2569
|
),
|
|
2581
|
-
/* @__PURE__ */
|
|
2570
|
+
/* @__PURE__ */ jsx27(
|
|
2582
2571
|
EditablePlainText,
|
|
2583
2572
|
{
|
|
2584
2573
|
tag: "span",
|
|
@@ -2598,30 +2587,30 @@ function EditableRow({
|
|
|
2598
2587
|
editingSuppressed ? "opacity-0 pointer-events-none" : "opacity-0 group-hover/row:opacity-100 no-hover:opacity-100"
|
|
2599
2588
|
),
|
|
2600
2589
|
children: [
|
|
2601
|
-
/* @__PURE__ */
|
|
2590
|
+
/* @__PURE__ */ jsx27(
|
|
2602
2591
|
IconButton,
|
|
2603
2592
|
{
|
|
2604
2593
|
ref: handleRef,
|
|
2605
|
-
icon: /* @__PURE__ */
|
|
2594
|
+
icon: /* @__PURE__ */ jsx27(DragHandle, { size: 14 }),
|
|
2606
2595
|
label: "Drag to reorder",
|
|
2607
2596
|
size: "sm",
|
|
2608
2597
|
className: "cursor-grab rounded bg-base/80 p-1 shadow-sm text-base-contrast-light/80 hover:text-base-contrast active:cursor-grabbing",
|
|
2609
2598
|
tabIndex: -1
|
|
2610
2599
|
}
|
|
2611
2600
|
),
|
|
2612
|
-
/* @__PURE__ */
|
|
2601
|
+
/* @__PURE__ */ jsx27(
|
|
2613
2602
|
"button",
|
|
2614
2603
|
{
|
|
2615
2604
|
"aria-label": "Duplicate item",
|
|
2616
2605
|
onClick: onDuplicate,
|
|
2617
2606
|
className: "cursor-pointer rounded bg-base/80 p-1 shadow-sm text-base-contrast-light hover:text-primary",
|
|
2618
|
-
children: /* @__PURE__ */
|
|
2607
|
+
children: /* @__PURE__ */ jsx27(CopyPlus, { size: 14 })
|
|
2619
2608
|
}
|
|
2620
2609
|
),
|
|
2621
|
-
/* @__PURE__ */
|
|
2610
|
+
/* @__PURE__ */ jsx27(
|
|
2622
2611
|
IconButton,
|
|
2623
2612
|
{
|
|
2624
|
-
icon: /* @__PURE__ */
|
|
2613
|
+
icon: /* @__PURE__ */ jsx27(DeleteIcon, { size: 14 }),
|
|
2625
2614
|
label: "Delete item",
|
|
2626
2615
|
size: "sm",
|
|
2627
2616
|
intent: "destructive",
|
|
@@ -2671,7 +2660,7 @@ function TrailingDropZone({
|
|
|
2671
2660
|
};
|
|
2672
2661
|
}, [index, onReorder, setDragState]);
|
|
2673
2662
|
const isDropTarget = dragState.targetId === trailingId && dragState.sourceId !== null;
|
|
2674
|
-
return /* @__PURE__ */
|
|
2663
|
+
return /* @__PURE__ */ jsx27(
|
|
2675
2664
|
"div",
|
|
2676
2665
|
{
|
|
2677
2666
|
ref,
|
|
@@ -2686,7 +2675,7 @@ import { useState as useState12 } from "react";
|
|
|
2686
2675
|
// src/components/shared/Checkbox.tsx
|
|
2687
2676
|
import { useId as useId2 } from "react";
|
|
2688
2677
|
import { Check as Check3 } from "lucide-react";
|
|
2689
|
-
import { jsx as
|
|
2678
|
+
import { jsx as jsx28, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
2690
2679
|
function Checkbox({
|
|
2691
2680
|
checked,
|
|
2692
2681
|
onChange,
|
|
@@ -2717,7 +2706,7 @@ function Checkbox({
|
|
|
2717
2706
|
align === "start" && "mt-0.5"
|
|
2718
2707
|
),
|
|
2719
2708
|
children: [
|
|
2720
|
-
/* @__PURE__ */
|
|
2709
|
+
/* @__PURE__ */ jsx28(
|
|
2721
2710
|
"input",
|
|
2722
2711
|
{
|
|
2723
2712
|
id,
|
|
@@ -2728,7 +2717,7 @@ function Checkbox({
|
|
|
2728
2717
|
className: "sr-only"
|
|
2729
2718
|
}
|
|
2730
2719
|
),
|
|
2731
|
-
/* @__PURE__ */
|
|
2720
|
+
/* @__PURE__ */ jsx28(
|
|
2732
2721
|
"span",
|
|
2733
2722
|
{
|
|
2734
2723
|
"aria-hidden": "true",
|
|
@@ -2737,7 +2726,7 @@ function Checkbox({
|
|
|
2737
2726
|
checked ? "border-primary bg-primary text-primary-contrast" : "border-base-300 bg-base hover:border-primary",
|
|
2738
2727
|
disabled && "pointer-events-none"
|
|
2739
2728
|
),
|
|
2740
|
-
children: checked && /* @__PURE__ */
|
|
2729
|
+
children: checked && /* @__PURE__ */ jsx28(Check3, { size: 14, strokeWidth: 3 })
|
|
2741
2730
|
}
|
|
2742
2731
|
)
|
|
2743
2732
|
]
|
|
@@ -2745,8 +2734,8 @@ function Checkbox({
|
|
|
2745
2734
|
),
|
|
2746
2735
|
startAdornment,
|
|
2747
2736
|
/* @__PURE__ */ jsxs14("div", { className: "text-sm", children: [
|
|
2748
|
-
/* @__PURE__ */
|
|
2749
|
-
description && /* @__PURE__ */
|
|
2737
|
+
/* @__PURE__ */ jsx28("span", { className: "font-medium text-base-contrast", children: label }),
|
|
2738
|
+
description && /* @__PURE__ */ jsx28("span", { className: "block text-base-contrast-light", children: description })
|
|
2750
2739
|
] })
|
|
2751
2740
|
]
|
|
2752
2741
|
}
|
|
@@ -2754,7 +2743,7 @@ function Checkbox({
|
|
|
2754
2743
|
}
|
|
2755
2744
|
|
|
2756
2745
|
// src/components/sections/IconList/IconListSettings.tsx
|
|
2757
|
-
import { jsx as
|
|
2746
|
+
import { jsx as jsx29, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
2758
2747
|
function IconListSettings({
|
|
2759
2748
|
icon: initialIcon,
|
|
2760
2749
|
showLabel: initialShowLabel,
|
|
@@ -2770,7 +2759,7 @@ function IconListSettings({
|
|
|
2770
2759
|
const iconEntry = icon ? getIcon(icon) : null;
|
|
2771
2760
|
return /* @__PURE__ */ jsxs15("div", { className: "space-y-4", children: [
|
|
2772
2761
|
/* @__PURE__ */ jsxs15("div", { className: "relative", children: [
|
|
2773
|
-
/* @__PURE__ */
|
|
2762
|
+
/* @__PURE__ */ jsx29(FormLabel, { htmlFor: "icon-picker-btn", children: "Default Icon" }),
|
|
2774
2763
|
/* @__PURE__ */ jsxs15("div", { className: "flex items-center gap-2", children: [
|
|
2775
2764
|
/* @__PURE__ */ jsxs15(
|
|
2776
2765
|
"button",
|
|
@@ -2779,12 +2768,12 @@ function IconListSettings({
|
|
|
2779
2768
|
className: "cursor-pointer flex items-center gap-2 rounded border border-base-200 px-3 py-1.5 text-sm text-base-contrast-light hover:border-primary hover:text-primary",
|
|
2780
2769
|
onClick: () => setPickerOpen((prev) => !prev),
|
|
2781
2770
|
children: [
|
|
2782
|
-
iconEntry && /* @__PURE__ */
|
|
2783
|
-
/* @__PURE__ */
|
|
2771
|
+
iconEntry && /* @__PURE__ */ jsx29(iconEntry.icon, { size: 16 }),
|
|
2772
|
+
/* @__PURE__ */ jsx29("span", { children: iconEntry?.label ?? "None" })
|
|
2784
2773
|
]
|
|
2785
2774
|
}
|
|
2786
2775
|
),
|
|
2787
|
-
icon && /* @__PURE__ */
|
|
2776
|
+
icon && /* @__PURE__ */ jsx29(
|
|
2788
2777
|
"button",
|
|
2789
2778
|
{
|
|
2790
2779
|
className: "cursor-pointer text-xs text-base-contrast-light hover:text-base-contrast",
|
|
@@ -2796,7 +2785,7 @@ function IconListSettings({
|
|
|
2796
2785
|
}
|
|
2797
2786
|
)
|
|
2798
2787
|
] }),
|
|
2799
|
-
pickerOpen && /* @__PURE__ */
|
|
2788
|
+
pickerOpen && /* @__PURE__ */ jsx29("div", { className: "absolute top-full left-0 z-50 mt-1", children: /* @__PURE__ */ jsx29(
|
|
2800
2789
|
IconPicker,
|
|
2801
2790
|
{
|
|
2802
2791
|
selected: icon,
|
|
@@ -2811,7 +2800,7 @@ function IconListSettings({
|
|
|
2811
2800
|
}
|
|
2812
2801
|
) })
|
|
2813
2802
|
] }),
|
|
2814
|
-
/* @__PURE__ */
|
|
2803
|
+
/* @__PURE__ */ jsx29(
|
|
2815
2804
|
Checkbox,
|
|
2816
2805
|
{
|
|
2817
2806
|
checked: showLabel,
|
|
@@ -2822,7 +2811,7 @@ function IconListSettings({
|
|
|
2822
2811
|
label: "Show labels"
|
|
2823
2812
|
}
|
|
2824
2813
|
),
|
|
2825
|
-
showLabel && /* @__PURE__ */
|
|
2814
|
+
showLabel && /* @__PURE__ */ jsx29(
|
|
2826
2815
|
Checkbox,
|
|
2827
2816
|
{
|
|
2828
2817
|
checked: stackText,
|
|
@@ -2837,24 +2826,30 @@ function IconListSettings({
|
|
|
2837
2826
|
}
|
|
2838
2827
|
|
|
2839
2828
|
// src/components/sections/IconList/index.tsx
|
|
2840
|
-
import { jsx as
|
|
2841
|
-
var
|
|
2842
|
-
|
|
2843
|
-
|
|
2844
|
-
|
|
2829
|
+
import { jsx as jsx30 } from "react/jsx-runtime";
|
|
2830
|
+
var IconListItemSchema = z6.object({
|
|
2831
|
+
label: z6.string(),
|
|
2832
|
+
text: z6.string(),
|
|
2833
|
+
icon: z6.string().optional(),
|
|
2834
|
+
dodont: z6.enum(["do", "dont"]).optional()
|
|
2835
|
+
});
|
|
2836
|
+
var schema5 = z6.object({
|
|
2837
|
+
type: z6.literal("icon_list"),
|
|
2838
|
+
content: z6.object({
|
|
2839
|
+
items: z6.array(IconListItemSchema)
|
|
2845
2840
|
}),
|
|
2846
|
-
options:
|
|
2847
|
-
icon:
|
|
2848
|
-
showLabel:
|
|
2849
|
-
stackText:
|
|
2841
|
+
options: z6.object({
|
|
2842
|
+
icon: z6.string().nullable().optional(),
|
|
2843
|
+
showLabel: z6.boolean().optional(),
|
|
2844
|
+
stackText: z6.boolean().optional()
|
|
2850
2845
|
}).optional()
|
|
2851
2846
|
});
|
|
2852
2847
|
var IconList_default = defineSection({
|
|
2853
2848
|
type: "icon_list",
|
|
2854
2849
|
label: "Icon List",
|
|
2855
|
-
icon: /* @__PURE__ */
|
|
2856
|
-
schema:
|
|
2857
|
-
component: ({ content, options, onChange }) => /* @__PURE__ */
|
|
2850
|
+
icon: /* @__PURE__ */ jsx30(List, { size: 18 }),
|
|
2851
|
+
schema: schema5,
|
|
2852
|
+
component: ({ content, options, onChange }) => /* @__PURE__ */ jsx30(
|
|
2858
2853
|
IconList,
|
|
2859
2854
|
{
|
|
2860
2855
|
items: content.content.items,
|
|
@@ -2868,15 +2863,12 @@ var IconList_default = defineSection({
|
|
|
2868
2863
|
type: "icon_list",
|
|
2869
2864
|
content: { items: [{ label: "", text: "" }] }
|
|
2870
2865
|
}),
|
|
2871
|
-
getLabel: (content) =>
|
|
2872
|
-
const n = content.content.items.length;
|
|
2873
|
-
return `${n} icon${n === 1 ? "" : "s"}`;
|
|
2874
|
-
},
|
|
2866
|
+
getLabel: (content) => pluralize(content.content.items.length, "icon"),
|
|
2875
2867
|
settingsForm: IconListSettings
|
|
2876
2868
|
});
|
|
2877
2869
|
|
|
2878
2870
|
// src/components/sections/Container/index.tsx
|
|
2879
|
-
import { z as
|
|
2871
|
+
import { z as z7 } from "zod";
|
|
2880
2872
|
import { LayoutTemplate } from "lucide-react";
|
|
2881
2873
|
|
|
2882
2874
|
// src/components/sections/Container/Container.tsx
|
|
@@ -2890,35 +2882,35 @@ import { CopyPlus as CopyPlus2 } from "lucide-react";
|
|
|
2890
2882
|
import { forwardRef as forwardRef4 } from "react";
|
|
2891
2883
|
|
|
2892
2884
|
// src/components/shared/Tooltip.tsx
|
|
2893
|
-
import { jsx as
|
|
2885
|
+
import { jsx as jsx31, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
2894
2886
|
function Tooltip({ content, children, className }) {
|
|
2895
2887
|
return /* @__PURE__ */ jsxs16("div", { className: cn("group/tooltip relative inline-flex", className), children: [
|
|
2896
2888
|
children,
|
|
2897
|
-
/* @__PURE__ */
|
|
2889
|
+
/* @__PURE__ */ jsx31(
|
|
2898
2890
|
"span",
|
|
2899
2891
|
{
|
|
2900
2892
|
className: "pointer-events-none absolute left-1/2 top-full z-50 mt-1.5 -translate-x-1/2 opacity-0 transition-opacity delay-300 group-hover/tooltip:opacity-100",
|
|
2901
2893
|
role: "tooltip",
|
|
2902
|
-
children: /* @__PURE__ */
|
|
2894
|
+
children: /* @__PURE__ */ jsx31("span", { className: "block whitespace-nowrap rounded bg-tooltip px-2 py-1 text-center text-xs leading-relaxed text-tooltip-muted", children: content })
|
|
2903
2895
|
}
|
|
2904
2896
|
)
|
|
2905
2897
|
] });
|
|
2906
2898
|
}
|
|
2907
2899
|
function Kbd({ children }) {
|
|
2908
|
-
return /* @__PURE__ */
|
|
2900
|
+
return /* @__PURE__ */ jsx31("strong", { className: "text-tooltip-contrast", children });
|
|
2909
2901
|
}
|
|
2910
2902
|
|
|
2911
2903
|
// src/components/editor/DragHandle.tsx
|
|
2912
|
-
import { Fragment as Fragment5, jsx as
|
|
2904
|
+
import { Fragment as Fragment5, jsx as jsx32, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
2913
2905
|
var DragHandle2 = forwardRef4(function DragHandle3(_, ref) {
|
|
2914
|
-
return /* @__PURE__ */
|
|
2915
|
-
/* @__PURE__ */
|
|
2906
|
+
return /* @__PURE__ */ jsx32(Tooltip, { content: /* @__PURE__ */ jsxs17(Fragment5, { children: [
|
|
2907
|
+
/* @__PURE__ */ jsx32(Kbd, { children: "Drag" }),
|
|
2916
2908
|
" to move"
|
|
2917
|
-
] }), children: /* @__PURE__ */
|
|
2909
|
+
] }), children: /* @__PURE__ */ jsx32(
|
|
2918
2910
|
IconButton,
|
|
2919
2911
|
{
|
|
2920
2912
|
ref,
|
|
2921
|
-
icon: /* @__PURE__ */
|
|
2913
|
+
icon: /* @__PURE__ */ jsx32(DragHandle, { size: 18 }),
|
|
2922
2914
|
label: "Drag to reorder section",
|
|
2923
2915
|
className: "pointer-events-auto cursor-grab active:cursor-grabbing rounded-md text-base-contrast-light/80 hover:bg-base-contrast-light/10 hover:text-base-contrast",
|
|
2924
2916
|
tabIndex: -1
|
|
@@ -2927,12 +2919,12 @@ var DragHandle2 = forwardRef4(function DragHandle3(_, ref) {
|
|
|
2927
2919
|
});
|
|
2928
2920
|
|
|
2929
2921
|
// src/components/editor/DeleteButton.tsx
|
|
2930
|
-
import { jsx as
|
|
2922
|
+
import { jsx as jsx33 } from "react/jsx-runtime";
|
|
2931
2923
|
function DeleteButton({ onDelete }) {
|
|
2932
|
-
return /* @__PURE__ */
|
|
2924
|
+
return /* @__PURE__ */ jsx33(
|
|
2933
2925
|
IconButton,
|
|
2934
2926
|
{
|
|
2935
|
-
icon: /* @__PURE__ */
|
|
2927
|
+
icon: /* @__PURE__ */ jsx33(DeleteIcon, { size: 16 }),
|
|
2936
2928
|
label: "Delete section",
|
|
2937
2929
|
intent: "destructive",
|
|
2938
2930
|
onClick: onDelete,
|
|
@@ -2942,12 +2934,12 @@ function DeleteButton({ onDelete }) {
|
|
|
2942
2934
|
}
|
|
2943
2935
|
|
|
2944
2936
|
// src/components/editor/SettingsButton.tsx
|
|
2945
|
-
import { jsx as
|
|
2937
|
+
import { jsx as jsx34 } from "react/jsx-runtime";
|
|
2946
2938
|
function SettingsButton({ onClick }) {
|
|
2947
|
-
return /* @__PURE__ */
|
|
2939
|
+
return /* @__PURE__ */ jsx34(
|
|
2948
2940
|
IconButton,
|
|
2949
2941
|
{
|
|
2950
|
-
icon: /* @__PURE__ */
|
|
2942
|
+
icon: /* @__PURE__ */ jsx34(SettingsIcon, { size: 16 }),
|
|
2951
2943
|
label: "Section settings",
|
|
2952
2944
|
onClick,
|
|
2953
2945
|
className: "pointer-events-auto"
|
|
@@ -3011,7 +3003,7 @@ function useFocusTrap(ref, active) {
|
|
|
3011
3003
|
}
|
|
3012
3004
|
|
|
3013
3005
|
// src/components/shared/Popover.tsx
|
|
3014
|
-
import { jsx as
|
|
3006
|
+
import { jsx as jsx35 } from "react/jsx-runtime";
|
|
3015
3007
|
function Popover({
|
|
3016
3008
|
isOpen,
|
|
3017
3009
|
onClose,
|
|
@@ -3061,7 +3053,7 @@ function Popover({
|
|
|
3061
3053
|
}, [isOpen, onClose, anchorRef]);
|
|
3062
3054
|
if (!isOpen) return null;
|
|
3063
3055
|
const effectiveAlign = align === "auto" ? resolvedAlign : align;
|
|
3064
|
-
return /* @__PURE__ */
|
|
3056
|
+
return /* @__PURE__ */ jsx35(
|
|
3065
3057
|
"div",
|
|
3066
3058
|
{
|
|
3067
3059
|
ref: panelRef,
|
|
@@ -3079,10 +3071,10 @@ function Popover({
|
|
|
3079
3071
|
|
|
3080
3072
|
// src/components/shared/PopoverItem.tsx
|
|
3081
3073
|
import { forwardRef as forwardRef5 } from "react";
|
|
3082
|
-
import { jsx as
|
|
3074
|
+
import { jsx as jsx36 } from "react/jsx-runtime";
|
|
3083
3075
|
var PopoverItem = forwardRef5(
|
|
3084
3076
|
function PopoverItem2({ className, children, ...rest }, ref) {
|
|
3085
|
-
return /* @__PURE__ */
|
|
3077
|
+
return /* @__PURE__ */ jsx36(
|
|
3086
3078
|
"button",
|
|
3087
3079
|
{
|
|
3088
3080
|
ref,
|
|
@@ -3099,14 +3091,14 @@ var PopoverItem = forwardRef5(
|
|
|
3099
3091
|
);
|
|
3100
3092
|
|
|
3101
3093
|
// src/components/editor/ColSpanControl.tsx
|
|
3102
|
-
import { jsx as
|
|
3094
|
+
import { jsx as jsx37, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
3103
3095
|
function ColSpanControl({ colSpan, columns, onChange }) {
|
|
3104
3096
|
const buttonRef = useRef10(null);
|
|
3105
3097
|
const [open, setOpen] = useState14(false);
|
|
3106
3098
|
if (columns <= 1) return null;
|
|
3107
3099
|
const current = Math.min(Math.max(colSpan, 1), columns);
|
|
3108
3100
|
return /* @__PURE__ */ jsxs18("div", { className: "relative", children: [
|
|
3109
|
-
/* @__PURE__ */
|
|
3101
|
+
/* @__PURE__ */ jsx37(
|
|
3110
3102
|
"button",
|
|
3111
3103
|
{
|
|
3112
3104
|
ref: buttonRef,
|
|
@@ -3116,10 +3108,10 @@ function ColSpanControl({ colSpan, columns, onChange }) {
|
|
|
3116
3108
|
"aria-expanded": open,
|
|
3117
3109
|
onClick: () => setOpen((v) => !v),
|
|
3118
3110
|
className: "pointer-events-auto inline-flex cursor-pointer items-center gap-1 rounded p-1 text-xs text-base-contrast-light hover:text-primary",
|
|
3119
|
-
children: /* @__PURE__ */
|
|
3111
|
+
children: /* @__PURE__ */ jsx37(Columns3, { size: 14 })
|
|
3120
3112
|
}
|
|
3121
3113
|
),
|
|
3122
|
-
/* @__PURE__ */
|
|
3114
|
+
/* @__PURE__ */ jsx37(Popover, { isOpen: open, onClose: () => setOpen(false), anchorRef: buttonRef, className: "min-w-28", children: /* @__PURE__ */ jsx37("ul", { role: "list", className: "py-1", children: Array.from({ length: columns }, (_, i) => i + 1).map((span) => /* @__PURE__ */ jsx37("li", { children: /* @__PURE__ */ jsxs18(
|
|
3123
3115
|
PopoverItem,
|
|
3124
3116
|
{
|
|
3125
3117
|
"aria-current": span === current,
|
|
@@ -3138,7 +3130,7 @@ function ColSpanControl({ colSpan, columns, onChange }) {
|
|
|
3138
3130
|
}
|
|
3139
3131
|
|
|
3140
3132
|
// src/components/editor/ChildBlockWrapper.tsx
|
|
3141
|
-
import { jsx as
|
|
3133
|
+
import { jsx as jsx38, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
3142
3134
|
var ChildBlockWrapper = forwardRef6(
|
|
3143
3135
|
function ChildBlockWrapper2({
|
|
3144
3136
|
label,
|
|
@@ -3165,38 +3157,38 @@ var ChildBlockWrapper = forwardRef6(
|
|
|
3165
3157
|
),
|
|
3166
3158
|
children: [
|
|
3167
3159
|
/* @__PURE__ */ jsxs19("div", { className: "absolute top-0 left-0 -translate-x-full z-20 flex flex-col items-center gap-1 opacity-0 transition-opacity group-hover/childblock:opacity-100 group-focus-within/childblock:opacity-100 pointer-events-none", children: [
|
|
3168
|
-
/* @__PURE__ */
|
|
3169
|
-
/* @__PURE__ */
|
|
3170
|
-
/* @__PURE__ */
|
|
3171
|
-
hasSettings && onOpenSettings && /* @__PURE__ */
|
|
3172
|
-
/* @__PURE__ */
|
|
3160
|
+
/* @__PURE__ */ jsx38("span", { className: "sr-only", children: label }),
|
|
3161
|
+
/* @__PURE__ */ jsx38("div", { className: "pointer-events-auto", children: /* @__PURE__ */ jsx38(DragHandle2, { ref: dragHandleRef }) }),
|
|
3162
|
+
/* @__PURE__ */ jsx38("div", { className: "pointer-events-auto", children: /* @__PURE__ */ jsx38(ColSpanControl, { colSpan, columns, onChange: onColSpanChange }) }),
|
|
3163
|
+
hasSettings && onOpenSettings && /* @__PURE__ */ jsx38("div", { className: "pointer-events-auto", children: /* @__PURE__ */ jsx38(SettingsButton, { onClick: onOpenSettings }) }),
|
|
3164
|
+
/* @__PURE__ */ jsx38("div", { className: "pointer-events-auto", children: /* @__PURE__ */ jsx38(
|
|
3173
3165
|
"button",
|
|
3174
3166
|
{
|
|
3175
3167
|
type: "button",
|
|
3176
3168
|
"aria-label": "Duplicate block",
|
|
3177
3169
|
onClick: onDuplicate,
|
|
3178
3170
|
className: "cursor-pointer rounded p-1 text-base-contrast-light hover:text-primary",
|
|
3179
|
-
children: /* @__PURE__ */
|
|
3171
|
+
children: /* @__PURE__ */ jsx38(CopyPlus2, { size: 16 })
|
|
3180
3172
|
}
|
|
3181
3173
|
) }),
|
|
3182
|
-
/* @__PURE__ */
|
|
3174
|
+
/* @__PURE__ */ jsx38("div", { className: "pointer-events-auto", children: /* @__PURE__ */ jsx38(DeleteButton, { onDelete }) })
|
|
3183
3175
|
] }),
|
|
3184
|
-
closestEdge === "left" && /* @__PURE__ */
|
|
3176
|
+
closestEdge === "left" && /* @__PURE__ */ jsx38(
|
|
3185
3177
|
"div",
|
|
3186
3178
|
{
|
|
3187
3179
|
"data-drop-edge": "left",
|
|
3188
3180
|
className: "absolute bottom-0 left-0 top-0 z-10 w-0.5 -translate-x-1 bg-primary"
|
|
3189
3181
|
}
|
|
3190
3182
|
),
|
|
3191
|
-
closestEdge === "right" && /* @__PURE__ */
|
|
3183
|
+
closestEdge === "right" && /* @__PURE__ */ jsx38(
|
|
3192
3184
|
"div",
|
|
3193
3185
|
{
|
|
3194
3186
|
"data-drop-edge": "right",
|
|
3195
3187
|
className: "absolute bottom-0 right-0 top-0 z-10 w-0.5 translate-x-1 bg-primary"
|
|
3196
3188
|
}
|
|
3197
3189
|
),
|
|
3198
|
-
closestEdge === "top" && /* @__PURE__ */
|
|
3199
|
-
closestEdge === "bottom" && /* @__PURE__ */
|
|
3190
|
+
closestEdge === "top" && /* @__PURE__ */ jsx38("div", { "data-drop-edge": "top", className: "absolute left-0 right-0 top-0 z-10 h-0.5 -translate-y-1 bg-primary" }),
|
|
3191
|
+
closestEdge === "bottom" && /* @__PURE__ */ jsx38("div", { "data-drop-edge": "bottom", className: "absolute left-0 right-0 bottom-0 z-10 h-0.5 translate-y-1 bg-primary" }),
|
|
3200
3192
|
children
|
|
3201
3193
|
]
|
|
3202
3194
|
}
|
|
@@ -3210,7 +3202,7 @@ import { useId as useId4, useState as useState16 } from "react";
|
|
|
3210
3202
|
// src/components/shared/Select.tsx
|
|
3211
3203
|
import { useId as useId3 } from "react";
|
|
3212
3204
|
import { ChevronDown } from "lucide-react";
|
|
3213
|
-
import { jsx as
|
|
3205
|
+
import { jsx as jsx39, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
3214
3206
|
function Select({
|
|
3215
3207
|
label,
|
|
3216
3208
|
value,
|
|
@@ -3222,9 +3214,9 @@ function Select({
|
|
|
3222
3214
|
}) {
|
|
3223
3215
|
const id = useId3();
|
|
3224
3216
|
return /* @__PURE__ */ jsxs20("div", { className, children: [
|
|
3225
|
-
label && /* @__PURE__ */
|
|
3217
|
+
label && /* @__PURE__ */ jsx39(FormLabel, { htmlFor: id, children: label }),
|
|
3226
3218
|
/* @__PURE__ */ jsxs20("div", { className: "relative", children: [
|
|
3227
|
-
/* @__PURE__ */
|
|
3219
|
+
/* @__PURE__ */ jsx39(
|
|
3228
3220
|
"select",
|
|
3229
3221
|
{
|
|
3230
3222
|
id,
|
|
@@ -3237,10 +3229,10 @@ function Select({
|
|
|
3237
3229
|
disabled && "cursor-not-allowed opacity-50",
|
|
3238
3230
|
selectClassName
|
|
3239
3231
|
),
|
|
3240
|
-
children: options.map((opt) => /* @__PURE__ */
|
|
3232
|
+
children: options.map((opt) => /* @__PURE__ */ jsx39("option", { value: opt.value, children: opt.label }, opt.value))
|
|
3241
3233
|
}
|
|
3242
3234
|
),
|
|
3243
|
-
/* @__PURE__ */
|
|
3235
|
+
/* @__PURE__ */ jsx39(
|
|
3244
3236
|
ChevronDown,
|
|
3245
3237
|
{
|
|
3246
3238
|
size: 14,
|
|
@@ -3252,7 +3244,7 @@ function Select({
|
|
|
3252
3244
|
}
|
|
3253
3245
|
|
|
3254
3246
|
// src/components/shared/LinkField.tsx
|
|
3255
|
-
import { Fragment as Fragment6, jsx as
|
|
3247
|
+
import { Fragment as Fragment6, jsx as jsx40, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
3256
3248
|
var TARGET_OPTIONS = [
|
|
3257
3249
|
{ label: "Same tab (_self)", value: "_self" },
|
|
3258
3250
|
{ label: "New tab (_blank)", value: "_blank" }
|
|
@@ -3267,8 +3259,8 @@ function LinkField({ label, value, onChange }) {
|
|
|
3267
3259
|
const pageId = isInternal ? value.pageId : "";
|
|
3268
3260
|
const headings = pageId ? getPageHeadings(pageId) : [];
|
|
3269
3261
|
return /* @__PURE__ */ jsxs21("div", { className: "flex flex-col gap-3", children: [
|
|
3270
|
-
/* @__PURE__ */
|
|
3271
|
-
/* @__PURE__ */
|
|
3262
|
+
/* @__PURE__ */ jsx40(FormLabel, { children: label }),
|
|
3263
|
+
/* @__PURE__ */ jsx40("div", { className: "flex gap-2", role: "tablist", children: ["external", "internal"].map((kind) => /* @__PURE__ */ jsx40(
|
|
3272
3264
|
"button",
|
|
3273
3265
|
{
|
|
3274
3266
|
type: "button",
|
|
@@ -3283,7 +3275,7 @@ function LinkField({ label, value, onChange }) {
|
|
|
3283
3275
|
},
|
|
3284
3276
|
kind
|
|
3285
3277
|
)) }),
|
|
3286
|
-
value.kind === "external" ? /* @__PURE__ */
|
|
3278
|
+
value.kind === "external" ? /* @__PURE__ */ jsx40(
|
|
3287
3279
|
Input,
|
|
3288
3280
|
{
|
|
3289
3281
|
label: "URL",
|
|
@@ -3292,7 +3284,7 @@ function LinkField({ label, value, onChange }) {
|
|
|
3292
3284
|
onChange: (href) => onChange({ kind: "external", href, target: value.target })
|
|
3293
3285
|
}
|
|
3294
3286
|
) : /* @__PURE__ */ jsxs21(Fragment6, { children: [
|
|
3295
|
-
/* @__PURE__ */
|
|
3287
|
+
/* @__PURE__ */ jsx40(
|
|
3296
3288
|
Select,
|
|
3297
3289
|
{
|
|
3298
3290
|
label: "Page",
|
|
@@ -3301,7 +3293,7 @@ function LinkField({ label, value, onChange }) {
|
|
|
3301
3293
|
onChange: (pid) => onChange({ kind: "internal", pageId: pid, anchorSectionId: null, target: value.target })
|
|
3302
3294
|
}
|
|
3303
3295
|
),
|
|
3304
|
-
/* @__PURE__ */
|
|
3296
|
+
/* @__PURE__ */ jsx40(
|
|
3305
3297
|
Select,
|
|
3306
3298
|
{
|
|
3307
3299
|
label: "Section",
|
|
@@ -3312,7 +3304,7 @@ function LinkField({ label, value, onChange }) {
|
|
|
3312
3304
|
}
|
|
3313
3305
|
)
|
|
3314
3306
|
] }),
|
|
3315
|
-
value.kind === "external" && /* @__PURE__ */
|
|
3307
|
+
value.kind === "external" && /* @__PURE__ */ jsx40(
|
|
3316
3308
|
Select,
|
|
3317
3309
|
{
|
|
3318
3310
|
label: "Opens in",
|
|
@@ -3326,7 +3318,7 @@ function LinkField({ label, value, onChange }) {
|
|
|
3326
3318
|
|
|
3327
3319
|
// src/components/shared/Tabs.tsx
|
|
3328
3320
|
import { useState as useState15 } from "react";
|
|
3329
|
-
import { jsx as
|
|
3321
|
+
import { jsx as jsx41, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
3330
3322
|
function Tabs({ tabs, defaultTabId, activeTabId, onTabChange, fullBleedTabBar }) {
|
|
3331
3323
|
const [uncontrolledId, setUncontrolledId] = useState15(defaultTabId ?? tabs[0]?.id);
|
|
3332
3324
|
const isControlled = activeTabId !== void 0;
|
|
@@ -3337,7 +3329,7 @@ function Tabs({ tabs, defaultTabId, activeTabId, onTabChange, fullBleedTabBar })
|
|
|
3337
3329
|
onTabChange?.(id);
|
|
3338
3330
|
}
|
|
3339
3331
|
return /* @__PURE__ */ jsxs22("div", { className: "flex flex-1 flex-col overflow-hidden", children: [
|
|
3340
|
-
/* @__PURE__ */
|
|
3332
|
+
/* @__PURE__ */ jsx41("div", { className: cn("border-b border-base-200", fullBleedTabBar && "-mx-6 px-6"), children: /* @__PURE__ */ jsx41("div", { className: "flex", role: "tablist", children: tabs.map((tab) => /* @__PURE__ */ jsx41(
|
|
3341
3333
|
"button",
|
|
3342
3334
|
{
|
|
3343
3335
|
type: "button",
|
|
@@ -3352,15 +3344,15 @@ function Tabs({ tabs, defaultTabId, activeTabId, onTabChange, fullBleedTabBar })
|
|
|
3352
3344
|
},
|
|
3353
3345
|
tab.id
|
|
3354
3346
|
)) }) }),
|
|
3355
|
-
/* @__PURE__ */
|
|
3347
|
+
/* @__PURE__ */ jsx41("div", { role: "tabpanel", children: activeTab?.content })
|
|
3356
3348
|
] });
|
|
3357
3349
|
}
|
|
3358
3350
|
|
|
3359
3351
|
// src/components/editor/SettingsForm.tsx
|
|
3360
|
-
import { jsx as
|
|
3361
|
-
function resolveValues(
|
|
3352
|
+
import { jsx as jsx42, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
3353
|
+
function resolveValues(schema8, values) {
|
|
3362
3354
|
const resolved = {};
|
|
3363
|
-
for (const [key, field] of Object.entries(
|
|
3355
|
+
for (const [key, field] of Object.entries(schema8)) {
|
|
3364
3356
|
resolved[key] = values[key] ?? field.default;
|
|
3365
3357
|
}
|
|
3366
3358
|
return resolved;
|
|
@@ -3377,10 +3369,10 @@ function normalizeEmpty(field, value) {
|
|
|
3377
3369
|
}
|
|
3378
3370
|
return value;
|
|
3379
3371
|
}
|
|
3380
|
-
function splitByTarget(
|
|
3372
|
+
function splitByTarget(schema8, allValues) {
|
|
3381
3373
|
const content = {};
|
|
3382
3374
|
const options = {};
|
|
3383
|
-
for (const [key, field] of Object.entries(
|
|
3375
|
+
for (const [key, field] of Object.entries(schema8)) {
|
|
3384
3376
|
const value = normalizeEmpty(field, coerceValue(field, allValues[key]));
|
|
3385
3377
|
const target = field.target ?? "options";
|
|
3386
3378
|
if (target === "content") {
|
|
@@ -3398,8 +3390,8 @@ function RangeField({
|
|
|
3398
3390
|
}) {
|
|
3399
3391
|
const id = useId4();
|
|
3400
3392
|
return /* @__PURE__ */ jsxs23("div", { children: [
|
|
3401
|
-
/* @__PURE__ */
|
|
3402
|
-
/* @__PURE__ */
|
|
3393
|
+
/* @__PURE__ */ jsx42(FormLabel, { htmlFor: id, children: field.label }),
|
|
3394
|
+
/* @__PURE__ */ jsx42(
|
|
3403
3395
|
"input",
|
|
3404
3396
|
{
|
|
3405
3397
|
id,
|
|
@@ -3419,7 +3411,7 @@ function RangeField({
|
|
|
3419
3411
|
function renderField(key, field, value, handleFieldChange) {
|
|
3420
3412
|
switch (field.type) {
|
|
3421
3413
|
case "text":
|
|
3422
|
-
return /* @__PURE__ */
|
|
3414
|
+
return /* @__PURE__ */ jsx42(
|
|
3423
3415
|
Input,
|
|
3424
3416
|
{
|
|
3425
3417
|
label: field.label,
|
|
@@ -3430,7 +3422,7 @@ function renderField(key, field, value, handleFieldChange) {
|
|
|
3430
3422
|
key
|
|
3431
3423
|
);
|
|
3432
3424
|
case "number":
|
|
3433
|
-
return /* @__PURE__ */
|
|
3425
|
+
return /* @__PURE__ */ jsx42(
|
|
3434
3426
|
Input,
|
|
3435
3427
|
{
|
|
3436
3428
|
label: field.label,
|
|
@@ -3441,7 +3433,7 @@ function renderField(key, field, value, handleFieldChange) {
|
|
|
3441
3433
|
key
|
|
3442
3434
|
);
|
|
3443
3435
|
case "checkbox":
|
|
3444
|
-
return /* @__PURE__ */
|
|
3436
|
+
return /* @__PURE__ */ jsx42(
|
|
3445
3437
|
Checkbox,
|
|
3446
3438
|
{
|
|
3447
3439
|
label: field.label,
|
|
@@ -3451,7 +3443,7 @@ function renderField(key, field, value, handleFieldChange) {
|
|
|
3451
3443
|
key
|
|
3452
3444
|
);
|
|
3453
3445
|
case "select":
|
|
3454
|
-
return /* @__PURE__ */
|
|
3446
|
+
return /* @__PURE__ */ jsx42(
|
|
3455
3447
|
Select,
|
|
3456
3448
|
{
|
|
3457
3449
|
label: field.label,
|
|
@@ -3462,7 +3454,7 @@ function renderField(key, field, value, handleFieldChange) {
|
|
|
3462
3454
|
key
|
|
3463
3455
|
);
|
|
3464
3456
|
case "range":
|
|
3465
|
-
return /* @__PURE__ */
|
|
3457
|
+
return /* @__PURE__ */ jsx42(
|
|
3466
3458
|
RangeField,
|
|
3467
3459
|
{
|
|
3468
3460
|
field,
|
|
@@ -3472,7 +3464,7 @@ function renderField(key, field, value, handleFieldChange) {
|
|
|
3472
3464
|
key
|
|
3473
3465
|
);
|
|
3474
3466
|
case "link":
|
|
3475
|
-
return /* @__PURE__ */
|
|
3467
|
+
return /* @__PURE__ */ jsx42(
|
|
3476
3468
|
LinkField,
|
|
3477
3469
|
{
|
|
3478
3470
|
label: field.label,
|
|
@@ -3485,24 +3477,24 @@ function renderField(key, field, value, handleFieldChange) {
|
|
|
3485
3477
|
return null;
|
|
3486
3478
|
}
|
|
3487
3479
|
}
|
|
3488
|
-
function SettingsForm({ schema:
|
|
3489
|
-
const [local, setLocal] = useState16(() => resolveValues(
|
|
3480
|
+
function SettingsForm({ schema: schema8, values, onChange, tabs }) {
|
|
3481
|
+
const [local, setLocal] = useState16(() => resolveValues(schema8, values));
|
|
3490
3482
|
function handleFieldChange(key, newValue) {
|
|
3491
3483
|
const next = { ...local, [key]: newValue };
|
|
3492
3484
|
setLocal(next);
|
|
3493
|
-
onChange(splitByTarget(
|
|
3485
|
+
onChange(splitByTarget(schema8, next));
|
|
3494
3486
|
}
|
|
3495
3487
|
if (tabs) {
|
|
3496
|
-
const fields = (keys) => keys.filter((key) => key in
|
|
3488
|
+
const fields = (keys) => keys.filter((key) => key in schema8).map((key) => renderField(key, schema8[key], local[key], handleFieldChange));
|
|
3497
3489
|
const listed = new Set(tabs.flatMap((t) => t.fields));
|
|
3498
|
-
const otherKeys = Object.keys(
|
|
3490
|
+
const otherKeys = Object.keys(schema8).filter((key) => !listed.has(key));
|
|
3499
3491
|
const tabItems = [
|
|
3500
|
-
...tabs.map((t) => ({ id: t.label, label: t.label, content: /* @__PURE__ */
|
|
3501
|
-
...otherKeys.length > 0 ? [{ id: "__other__", label: "Other", content: /* @__PURE__ */
|
|
3492
|
+
...tabs.map((t) => ({ id: t.label, label: t.label, content: /* @__PURE__ */ jsx42("div", { className: "flex flex-col gap-4", children: fields(t.fields) }) })),
|
|
3493
|
+
...otherKeys.length > 0 ? [{ id: "__other__", label: "Other", content: /* @__PURE__ */ jsx42("div", { className: "flex flex-col gap-4", children: fields(otherKeys) }) }] : []
|
|
3502
3494
|
];
|
|
3503
|
-
return /* @__PURE__ */
|
|
3495
|
+
return /* @__PURE__ */ jsx42(Tabs, { tabs: tabItems, fullBleedTabBar: true });
|
|
3504
3496
|
}
|
|
3505
|
-
return /* @__PURE__ */
|
|
3497
|
+
return /* @__PURE__ */ jsx42("div", { className: "flex flex-col gap-4", children: Object.entries(schema8).map(([key, field]) => renderField(key, field, local[key], handleFieldChange)) });
|
|
3506
3498
|
}
|
|
3507
3499
|
|
|
3508
3500
|
// src/hooks/useBlockDnd.ts
|
|
@@ -3686,7 +3678,7 @@ function trimTrailingSpacers(container) {
|
|
|
3686
3678
|
}
|
|
3687
3679
|
|
|
3688
3680
|
// src/components/sections/Container/Container.tsx
|
|
3689
|
-
import { jsx as
|
|
3681
|
+
import { jsx as jsx43, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
3690
3682
|
var ROW_EDGES = ["left", "right"];
|
|
3691
3683
|
var COL_EDGES = ["top", "bottom"];
|
|
3692
3684
|
function ContainerChild({
|
|
@@ -3717,14 +3709,14 @@ function ContainerChild({
|
|
|
3717
3709
|
allowedEdges: flow === "column" ? COL_EDGES : ROW_EDGES,
|
|
3718
3710
|
enabled: true
|
|
3719
3711
|
});
|
|
3720
|
-
return /* @__PURE__ */
|
|
3712
|
+
return /* @__PURE__ */ jsx43(
|
|
3721
3713
|
"div",
|
|
3722
3714
|
{
|
|
3723
3715
|
ref: dragRef,
|
|
3724
3716
|
className: cellClass,
|
|
3725
3717
|
"data-child-index": index,
|
|
3726
3718
|
"data-child-id": child.id,
|
|
3727
|
-
children: /* @__PURE__ */
|
|
3719
|
+
children: /* @__PURE__ */ jsx43(
|
|
3728
3720
|
ChildBlockWrapper,
|
|
3729
3721
|
{
|
|
3730
3722
|
label,
|
|
@@ -3738,7 +3730,7 @@ function ContainerChild({
|
|
|
3738
3730
|
onDuplicate,
|
|
3739
3731
|
onColSpanChange,
|
|
3740
3732
|
onOpenSettings,
|
|
3741
|
-
children: /* @__PURE__ */
|
|
3733
|
+
children: /* @__PURE__ */ jsx43(
|
|
3742
3734
|
ChildComp,
|
|
3743
3735
|
{
|
|
3744
3736
|
content: child,
|
|
@@ -3766,7 +3758,7 @@ function EmptyColumnCell({
|
|
|
3766
3758
|
enabled: true
|
|
3767
3759
|
});
|
|
3768
3760
|
const active = closestEdge !== null;
|
|
3769
|
-
return /* @__PURE__ */
|
|
3761
|
+
return /* @__PURE__ */ jsx43(
|
|
3770
3762
|
"div",
|
|
3771
3763
|
{
|
|
3772
3764
|
ref: dropRef,
|
|
@@ -3804,7 +3796,7 @@ function Container({ content, isEditMode, onChange, openModal }) {
|
|
|
3804
3796
|
flow === "column" && "grid-flow-col"
|
|
3805
3797
|
);
|
|
3806
3798
|
if (!editable) {
|
|
3807
|
-
return /* @__PURE__ */
|
|
3799
|
+
return /* @__PURE__ */ jsx43("div", { className: "@container", children: /* @__PURE__ */ jsx43("div", { className: gridClass, children: children.map((child, index) => {
|
|
3808
3800
|
const def = getSection(child.type);
|
|
3809
3801
|
if (!def) return null;
|
|
3810
3802
|
const Child = def.component;
|
|
@@ -3815,7 +3807,7 @@ function Container({ content, isEditMode, onChange, openModal }) {
|
|
|
3815
3807
|
colSpanClass[columns]?.[Math.min(span, columns)] || void 0,
|
|
3816
3808
|
child.type === "spacer" && spacerHiddenClass[columns]
|
|
3817
3809
|
);
|
|
3818
|
-
return /* @__PURE__ */
|
|
3810
|
+
return /* @__PURE__ */ jsx43("div", { className: cellClass, children: /* @__PURE__ */ jsx43(Child, { content: child, options: mergedOptions, isEditMode }) }, child.id ?? index);
|
|
3819
3811
|
}) }) });
|
|
3820
3812
|
}
|
|
3821
3813
|
function columnStartOf(index) {
|
|
@@ -3829,7 +3821,7 @@ function Container({ content, isEditMode, onChange, openModal }) {
|
|
|
3829
3821
|
const def = getSection(child.type);
|
|
3830
3822
|
if (!def) return null;
|
|
3831
3823
|
if (isSpacer(child)) {
|
|
3832
|
-
return /* @__PURE__ */
|
|
3824
|
+
return /* @__PURE__ */ jsx43(
|
|
3833
3825
|
EmptyColumnCell,
|
|
3834
3826
|
{
|
|
3835
3827
|
containerId: container.id,
|
|
@@ -3857,12 +3849,12 @@ function Container({ content, isEditMode, onChange, openModal }) {
|
|
|
3857
3849
|
const CustomForm = def.settingsForm;
|
|
3858
3850
|
openModal(
|
|
3859
3851
|
`${def.label} Settings`,
|
|
3860
|
-
/* @__PURE__ */
|
|
3852
|
+
/* @__PURE__ */ jsx43(CustomForm, { ...seed, onChange: applyResult })
|
|
3861
3853
|
);
|
|
3862
3854
|
} else if (def.settings) {
|
|
3863
3855
|
openModal(
|
|
3864
3856
|
`${def.label} Settings`,
|
|
3865
|
-
/* @__PURE__ */
|
|
3857
|
+
/* @__PURE__ */ jsx43(
|
|
3866
3858
|
SettingsForm,
|
|
3867
3859
|
{
|
|
3868
3860
|
schema: def.settings,
|
|
@@ -3874,7 +3866,7 @@ function Container({ content, isEditMode, onChange, openModal }) {
|
|
|
3874
3866
|
);
|
|
3875
3867
|
}
|
|
3876
3868
|
} : void 0;
|
|
3877
|
-
return /* @__PURE__ */
|
|
3869
|
+
return /* @__PURE__ */ jsx43(
|
|
3878
3870
|
ContainerChild,
|
|
3879
3871
|
{
|
|
3880
3872
|
containerId: container.id,
|
|
@@ -3900,9 +3892,9 @@ function Container({ content, isEditMode, onChange, openModal }) {
|
|
|
3900
3892
|
}
|
|
3901
3893
|
const occupied = occupiedColumns(children, columns);
|
|
3902
3894
|
const emptyCols = occupied < columns ? columns - occupied : 0;
|
|
3903
|
-
return /* @__PURE__ */
|
|
3895
|
+
return /* @__PURE__ */ jsx43("div", { className: "@container", children: /* @__PURE__ */ jsxs24("div", { className: gridClass, children: [
|
|
3904
3896
|
children.map(renderEditChild),
|
|
3905
|
-
Array.from({ length: emptyCols }, (_, i) => /* @__PURE__ */
|
|
3897
|
+
Array.from({ length: emptyCols }, (_, i) => /* @__PURE__ */ jsx43(
|
|
3906
3898
|
EmptyColumnCell,
|
|
3907
3899
|
{
|
|
3908
3900
|
containerId: container.id,
|
|
@@ -3916,7 +3908,7 @@ function Container({ content, isEditMode, onChange, openModal }) {
|
|
|
3916
3908
|
|
|
3917
3909
|
// src/components/sections/Container/ContainerSettingsForm.tsx
|
|
3918
3910
|
import { useState as useState18 } from "react";
|
|
3919
|
-
import { jsx as
|
|
3911
|
+
import { jsx as jsx44, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
3920
3912
|
function inheritableSchema(children) {
|
|
3921
3913
|
const out = {};
|
|
3922
3914
|
for (const child of children) {
|
|
@@ -3968,8 +3960,8 @@ function ContainerSettingsForm({
|
|
|
3968
3960
|
};
|
|
3969
3961
|
return /* @__PURE__ */ jsxs25("div", { className: "flex flex-col gap-6", children: [
|
|
3970
3962
|
/* @__PURE__ */ jsxs25("fieldset", { className: "flex flex-col gap-4", children: [
|
|
3971
|
-
/* @__PURE__ */
|
|
3972
|
-
/* @__PURE__ */
|
|
3963
|
+
/* @__PURE__ */ jsx44("legend", { className: "mb-2 text-sm font-semibold text-base-contrast", children: "Layout" }),
|
|
3964
|
+
/* @__PURE__ */ jsx44(
|
|
3973
3965
|
SettingsForm,
|
|
3974
3966
|
{
|
|
3975
3967
|
schema: layoutSchema,
|
|
@@ -3986,8 +3978,8 @@ function ContainerSettingsForm({
|
|
|
3986
3978
|
)
|
|
3987
3979
|
] }),
|
|
3988
3980
|
hasChildDefaults && /* @__PURE__ */ jsxs25("fieldset", { className: "flex flex-col gap-4 border-t border-base-200 pt-4", children: [
|
|
3989
|
-
/* @__PURE__ */
|
|
3990
|
-
/* @__PURE__ */
|
|
3981
|
+
/* @__PURE__ */ jsx44("legend", { className: "mb-2 text-sm font-semibold text-base-contrast", children: "Apply to all items" }),
|
|
3982
|
+
/* @__PURE__ */ jsx44(
|
|
3991
3983
|
SettingsForm,
|
|
3992
3984
|
{
|
|
3993
3985
|
schema: childSchema,
|
|
@@ -4004,16 +3996,16 @@ function ContainerSettingsForm({
|
|
|
4004
3996
|
}
|
|
4005
3997
|
|
|
4006
3998
|
// src/components/sections/Container/index.tsx
|
|
4007
|
-
import { jsx as
|
|
4008
|
-
var
|
|
4009
|
-
type:
|
|
4010
|
-
content:
|
|
4011
|
-
columns:
|
|
4012
|
-
flow:
|
|
4013
|
-
childDefaults:
|
|
3999
|
+
import { jsx as jsx45 } from "react/jsx-runtime";
|
|
4000
|
+
var schema6 = z7.object({
|
|
4001
|
+
type: z7.literal("container"),
|
|
4002
|
+
content: z7.object({
|
|
4003
|
+
columns: z7.number().int().min(1).max(MAX_CONTAINER_COLUMNS).default(1),
|
|
4004
|
+
flow: z7.enum(["row", "column"]).default("row"),
|
|
4005
|
+
childDefaults: z7.record(z7.string(), z7.unknown()).optional(),
|
|
4014
4006
|
// Recursive: children are full blocks. z.lazy defers evaluation to parse
|
|
4015
4007
|
// time, by which point every section schema (incl. container) is registered.
|
|
4016
|
-
children:
|
|
4008
|
+
children: z7.array(z7.lazy(() => getSectionSchema())).default([])
|
|
4017
4009
|
}).transform((c) => ({
|
|
4018
4010
|
...c,
|
|
4019
4011
|
children: c.children.map(
|
|
@@ -4024,42 +4016,39 @@ var schema9 = z9.object({
|
|
|
4024
4016
|
var Container_default = defineSection({
|
|
4025
4017
|
type: "container",
|
|
4026
4018
|
label: "Container",
|
|
4027
|
-
icon: /* @__PURE__ */
|
|
4028
|
-
schema:
|
|
4029
|
-
component: ({ content, onChange, isEditMode, openModal }) => /* @__PURE__ */
|
|
4019
|
+
icon: /* @__PURE__ */ jsx45(LayoutTemplate, { size: 18 }),
|
|
4020
|
+
schema: schema6,
|
|
4021
|
+
component: ({ content, onChange, isEditMode, openModal }) => /* @__PURE__ */ jsx45(Container, { content, isEditMode: !!isEditMode, onChange, openModal }),
|
|
4030
4022
|
defaults: () => ({
|
|
4031
4023
|
type: "container",
|
|
4032
4024
|
content: { columns: 1, flow: "row", children: [] }
|
|
4033
4025
|
}),
|
|
4034
|
-
getLabel: (content) => {
|
|
4035
|
-
const n = content.content.children.length;
|
|
4036
|
-
return `Container (${n} item${n === 1 ? "" : "s"})`;
|
|
4037
|
-
},
|
|
4026
|
+
getLabel: (content) => `Container (${pluralize(content.content.children.length, "item")})`,
|
|
4038
4027
|
settingsForm: ContainerSettingsForm
|
|
4039
4028
|
});
|
|
4040
4029
|
|
|
4041
4030
|
// src/components/sections/Spacer/index.tsx
|
|
4042
|
-
import { z as
|
|
4031
|
+
import { z as z8 } from "zod";
|
|
4043
4032
|
import { SquareDashed } from "lucide-react";
|
|
4044
4033
|
|
|
4045
4034
|
// src/components/sections/Spacer/Spacer.tsx
|
|
4046
|
-
import { jsx as
|
|
4035
|
+
import { jsx as jsx46 } from "react/jsx-runtime";
|
|
4047
4036
|
function Spacer() {
|
|
4048
|
-
return /* @__PURE__ */
|
|
4037
|
+
return /* @__PURE__ */ jsx46("div", { "data-spacer": true, "aria-hidden": "true", className: "h-full" });
|
|
4049
4038
|
}
|
|
4050
4039
|
|
|
4051
4040
|
// src/components/sections/Spacer/index.tsx
|
|
4052
|
-
import { jsx as
|
|
4053
|
-
var
|
|
4054
|
-
type:
|
|
4055
|
-
content:
|
|
4041
|
+
import { jsx as jsx47 } from "react/jsx-runtime";
|
|
4042
|
+
var schema7 = z8.object({
|
|
4043
|
+
type: z8.literal("spacer"),
|
|
4044
|
+
content: z8.object({}).default({})
|
|
4056
4045
|
});
|
|
4057
4046
|
var Spacer_default = defineSection({
|
|
4058
4047
|
type: "spacer",
|
|
4059
4048
|
label: "Spacer",
|
|
4060
|
-
icon: /* @__PURE__ */
|
|
4061
|
-
schema:
|
|
4062
|
-
component: () => /* @__PURE__ */
|
|
4049
|
+
icon: /* @__PURE__ */ jsx47(SquareDashed, { size: 18 }),
|
|
4050
|
+
schema: schema7,
|
|
4051
|
+
component: () => /* @__PURE__ */ jsx47(Spacer, {}),
|
|
4063
4052
|
defaults: () => ({ type: "spacer", content: {} })
|
|
4064
4053
|
});
|
|
4065
4054
|
|