@xwadex/fesd-next 0.3.4-7.20 → 0.3.4-7.22

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.
Files changed (58) hide show
  1. package/dist/components/content-builders/blocks/base-block.d.ts +8 -0
  2. package/dist/components/content-builders/blocks/base-block.js +95 -0
  3. package/dist/components/content-builders/blocks/index.d.ts +4 -0
  4. package/dist/components/content-builders/blocks/index.js +4 -0
  5. package/dist/components/content-builders/blocks/media-content.d.ts +7 -0
  6. package/dist/components/content-builders/blocks/media-content.js +23 -0
  7. package/dist/components/content-builders/blocks/root-header.d.ts +19 -0
  8. package/dist/components/content-builders/blocks/root-header.js +84 -0
  9. package/dist/components/content-builders/blocks/roots.d.ts +8 -0
  10. package/dist/components/content-builders/blocks/roots.js +18 -0
  11. package/dist/components/content-builders/blocks/text-content.d.ts +20 -0
  12. package/dist/components/content-builders/blocks/text-content.js +126 -0
  13. package/dist/components/content-builders/content-builder-actionbar.d.ts +2 -0
  14. package/dist/components/content-builders/content-builder-actionbar.js +21 -0
  15. package/dist/components/content-builders/content-builder-blocks.d.ts +4 -0
  16. package/dist/components/content-builders/content-builder-blocks.js +15 -0
  17. package/dist/components/content-builders/content-builder-configs.d.ts +10 -0
  18. package/dist/components/content-builders/content-builder-configs.js +55 -0
  19. package/dist/components/content-builders/content-builder-context.d.ts +22 -0
  20. package/dist/components/content-builders/content-builder-context.js +46 -0
  21. package/dist/components/content-builders/content-builder-fields.d.ts +1 -0
  22. package/dist/components/content-builders/content-builder-fields.js +5 -0
  23. package/dist/components/content-builders/content-builder-functionbar.d.ts +1 -0
  24. package/dist/components/content-builders/content-builder-functionbar.js +25 -0
  25. package/dist/components/content-builders/content-builder-helpers.d.ts +14 -0
  26. package/dist/components/content-builders/content-builder-helpers.js +45 -0
  27. package/dist/components/content-builders/content-builder-hooks.d.ts +32 -0
  28. package/dist/components/content-builders/content-builder-hooks.js +65 -0
  29. package/dist/components/content-builders/content-builder-iframe.d.ts +1 -0
  30. package/dist/components/content-builders/content-builder-iframe.js +8 -0
  31. package/dist/components/content-builders/content-builder-initial.d.ts +84 -0
  32. package/dist/components/content-builders/content-builder-initial.js +135 -0
  33. package/dist/components/content-builders/content-builder-overlay.d.ts +1 -0
  34. package/dist/components/content-builders/content-builder-overlay.js +21 -0
  35. package/dist/components/content-builders/content-builder-panels.d.ts +10 -0
  36. package/dist/components/content-builders/content-builder-panels.js +162 -0
  37. package/dist/components/content-builders/content-builder-preview.d.ts +4 -0
  38. package/dist/components/content-builders/content-builder-preview.js +20 -0
  39. package/dist/components/content-builders/content-builder-pucks-context.d.ts +12 -0
  40. package/dist/components/content-builders/content-builder-pucks-context.js +17 -0
  41. package/dist/components/content-builders/content-builder-pucks-hooks.d.ts +17 -0
  42. package/dist/components/content-builders/content-builder-pucks-hooks.js +89 -0
  43. package/dist/components/content-builders/content-builder-roots.d.ts +15 -0
  44. package/dist/components/content-builders/content-builder-roots.js +13 -0
  45. package/dist/components/content-builders/content-builder.d.ts +7 -0
  46. package/dist/components/content-builders/content-builder.js +17 -0
  47. package/dist/components/content-builders/content-render.d.ts +7 -0
  48. package/dist/components/content-builders/content-render.js +8 -0
  49. package/dist/components/content-builders/fields/fields-tabs.d.ts +5 -0
  50. package/dist/components/content-builders/fields/fields-tabs.js +9 -0
  51. package/dist/components/content-builders/index.d.ts +6 -0
  52. package/dist/components/content-builders/index.js +6 -0
  53. package/dist/components/index.d.ts +1 -0
  54. package/dist/components/index.js +1 -0
  55. package/dist/components/puck-contents/puck-contents-editor.d.ts +1 -0
  56. package/dist/components/puck-contents/puck-contents-editor.js +2 -2
  57. package/dist/components/puck-contents/puck-contents-rander.js +4 -0
  58. package/package.json +1 -1
@@ -0,0 +1,8 @@
1
+ import type { PuckComponent, ComponentConfig, Slot } from "@puckeditor/core";
2
+ export interface Props {
3
+ options?: any;
4
+ slotTextBlock?: Slot;
5
+ slotMediaBlock?: Slot;
6
+ }
7
+ export declare const BaseBlock: PuckComponent<Props>;
8
+ export declare const BaseBlockConfigs: ComponentConfig;
@@ -0,0 +1,95 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
+ import { TextContentConfigs } from "./text-content";
4
+ import { MediaContentConfigs } from "./media-content";
5
+ import { cn } from "../../../shadcns/index.js";
6
+ export const BaseBlock = ({ options, slotTextBlock: SlotTextBlock, slotMediaBlock: SlotMediaBlock, ...props }) => {
7
+ const { textAlign } = options;
8
+ return (_jsx("div", { "data-component": "base-block", className: cn("grid items-center justify-center overflow-hidden", "grid-cols-[1fr_1fr]"), children: textAlign == "left"
9
+ ? _jsxs(_Fragment, { children: [_jsxs("div", { children: [" ", SlotTextBlock ? _jsx(SlotTextBlock, {}) : null] }), _jsxs("div", { children: [" ", SlotMediaBlock ? _jsx(SlotMediaBlock, {}) : null] })] })
10
+ : _jsxs(_Fragment, { children: [_jsxs("div", { children: [" ", SlotMediaBlock ? _jsx(SlotMediaBlock, {}) : null] }), _jsxs("div", { children: [" ", SlotTextBlock ? _jsx(SlotTextBlock, {}) : null] })] }) }));
11
+ };
12
+ export const BaseBlockConfigs = {
13
+ label: "BaseBlock",
14
+ fields: {
15
+ slotTextBlock: { type: "slot", allow: ["TextContent"] },
16
+ slotMediaBlock: { type: "slot", allow: ["MediaContent"] },
17
+ options: {
18
+ label: "Contetn Options",
19
+ type: "object",
20
+ objectFields: {
21
+ textAlign: {
22
+ label: "Content Position",
23
+ type: "radio",
24
+ options: [
25
+ { label: "Left", value: "left" },
26
+ { label: "Right", value: "right" },
27
+ ],
28
+ },
29
+ textAlign2: {
30
+ label: "Content Vertical",
31
+ type: "radio",
32
+ options: [
33
+ { label: "Top", value: "top" },
34
+ { label: "Middle", value: "middle" },
35
+ { label: "Bottom", value: "bottom" },
36
+ ],
37
+ },
38
+ },
39
+ },
40
+ background: {
41
+ label: "Background Setting",
42
+ type: "object",
43
+ objectFields: {
44
+ isImage: {
45
+ label: "Use Image",
46
+ type: "radio",
47
+ options: [
48
+ { label: "Yes", value: "yes" },
49
+ { label: "No", value: "no" },
50
+ ],
51
+ },
52
+ imageAddress: {
53
+ label: "Image Address",
54
+ type: "text"
55
+ },
56
+ color: {
57
+ label: "Color",
58
+ type: "text"
59
+ },
60
+ },
61
+ },
62
+ },
63
+ resolveData: async ({ props }) => {
64
+ const nextProps = { ...props };
65
+ const tb = Array.isArray(nextProps.textBlock) ? nextProps.textBlock : [];
66
+ nextProps.textBlock = tb.map((item, idx) => {
67
+ if (!item?.props)
68
+ return item;
69
+ const lockDelete = tb.length === 1; // ✅ 核心判斷
70
+ return { ...item, props: { ...item.props, lockDelete } };
71
+ });
72
+ return { props: nextProps };
73
+ },
74
+ defaultProps: {
75
+ options: {
76
+ textAlign: "left",
77
+ textAlign2: "top"
78
+ },
79
+ background: {
80
+ isImage: "no"
81
+ },
82
+ slotTextBlock: [{
83
+ type: "TextContent",
84
+ props: { ...TextContentConfigs.defaultProps, requiredInSlot: true, }
85
+ }],
86
+ slotMediaBlock: [{
87
+ type: "MediaContent",
88
+ props: { ...MediaContentConfigs.defaultProps }
89
+ }],
90
+ configs: {
91
+ className: ""
92
+ }
93
+ },
94
+ render: BaseBlock
95
+ };
@@ -0,0 +1,4 @@
1
+ export * from "./roots";
2
+ export * from "./base-block";
3
+ export * from "./media-content";
4
+ export * from "./text-content";
@@ -0,0 +1,4 @@
1
+ export * from "./roots";
2
+ export * from "./base-block";
3
+ export * from "./media-content";
4
+ export * from "./text-content";
@@ -0,0 +1,7 @@
1
+ import { ComponentConfig, PuckComponent } from "@puckeditor/core";
2
+ export interface MediaContentProps {
3
+ imgs?: string;
4
+ alt?: string;
5
+ }
6
+ export declare const MediaContent: PuckComponent<MediaContentProps>;
7
+ export declare const MediaContentConfigs: ComponentConfig;
@@ -0,0 +1,23 @@
1
+ "use client";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ export const MediaContent = ({ alt, imgs, }) => {
4
+ return (_jsx("div", { "data-component": "media-content", onClick: console.log, children: _jsx("figure", { className: "flex flex-col gap-3 items-center [&_img]:max-w-full w-full", children: _jsx("div", { className: "bg-gray-100 w-full", children: _jsx("img", { src: String(imgs), className: "w-full!" }) }) }) }));
5
+ };
6
+ export const MediaContentConfigs = {
7
+ label: "Media Content",
8
+ permissions: {
9
+ delete: false,
10
+ drag: false,
11
+ insert: false,
12
+ duplicate: false
13
+ },
14
+ fields: {
15
+ imgs: { type: "text" },
16
+ alt: { type: "text", contentEditable: true },
17
+ },
18
+ defaultProps: {
19
+ imgs: "/01.png",
20
+ alt: "alt"
21
+ },
22
+ render: MediaContent
23
+ };
@@ -0,0 +1,19 @@
1
+ import { ComponentConfig, PuckComponent } from "@puckeditor/core";
2
+ export interface Button {
3
+ label?: string;
4
+ link?: string;
5
+ linkBlank?: boolean;
6
+ labelColor?: string;
7
+ bgColor?: string;
8
+ borderColor?: string;
9
+ }
10
+ export interface RootHeaderProps {
11
+ title?: string;
12
+ description?: string;
13
+ subTitle?: string;
14
+ buttons?: Button[];
15
+ imgs?: string;
16
+ options?: any;
17
+ }
18
+ export declare const RootHeader: PuckComponent<RootHeaderProps>;
19
+ export declare const RootHeaderConfig: ComponentConfig;
@@ -0,0 +1,84 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { cn } from "../../../shadcns/index.js";
4
+ export const RootHeader = ({ title, description, subTitle, buttons, ...props }) => {
5
+ return (_jsxs("div", { "data-component": "header-block", className: "px-10 py-2 flex justify-between w-full bg-white", children: [_jsx("div", { className: "text-xl font-semibold flex-1", children: "LOGO" }), _jsxs("div", { className: "flex-1 flex gap-10 justify-center items-center", children: [_jsx("div", { className: "text-md font-semibold", children: "ABOTU" }), _jsx("div", { className: "text-md font-semibold", children: "PRODUCTS" }), _jsx("div", { className: "text-md font-semibold", children: "SOLUTIONS" }), _jsx("div", { className: "text-md font-semibold", children: "SUPPORT" })] }), _jsx("div", { className: cn("text-2xl font-semibold flex-1 flex justify-end items-center", "[&_span]:w-8", "[&_span]:h-0.5", "[&_span]:bg-black"), children: _jsxs("div", { className: cn("flex flex-col gap-1"), children: [_jsx("span", {}), _jsx("span", {}), _jsx("span", {})] }) })] }));
6
+ };
7
+ export const RootHeaderConfig = {
8
+ label: "RootHeader",
9
+ permissions: {
10
+ delete: false,
11
+ drag: false,
12
+ duplicate: false,
13
+ insert: false
14
+ },
15
+ fields: {
16
+ title: {
17
+ label: "Title",
18
+ type: "text",
19
+ contentEditable: true
20
+ },
21
+ subTitle: {
22
+ label: "Sub Title",
23
+ type: "text",
24
+ contentEditable: true
25
+ },
26
+ description: {
27
+ label: "Description",
28
+ type: "textarea",
29
+ contentEditable: true
30
+ },
31
+ buttons: {
32
+ label: "Buttons",
33
+ type: "array",
34
+ arrayFields: {
35
+ label: {
36
+ label: "Label",
37
+ type: "text",
38
+ contentEditable: true,
39
+ placeholder: "ex: learn more"
40
+ },
41
+ link: {
42
+ label: "Link",
43
+ type: "text",
44
+ placeholder: "ex: http://www.abc.com"
45
+ },
46
+ linkTarget: {
47
+ label: "Link Blank",
48
+ type: "radio",
49
+ options: [
50
+ { label: "Yes", value: "yes" },
51
+ { label: "No", value: "no" },
52
+ ],
53
+ },
54
+ labelColor: {
55
+ label: "Label Color",
56
+ type: "text",
57
+ placeholder: "ex: #000000"
58
+ },
59
+ backgroundColor: {
60
+ label: "Background Color",
61
+ type: "text",
62
+ placeholder: "ex: #000000"
63
+ },
64
+ borderColor: {
65
+ label: "Border Color",
66
+ type: "text",
67
+ placeholder: "ex: #000000"
68
+ },
69
+ },
70
+ defaultItemProps: (index) => ({
71
+ label: `Unnamed ${index + 1}`,
72
+ }),
73
+ getItemSummary: (item, index) => {
74
+ return item?.label || `Unnamed ${Number(index) + 1}`;
75
+ },
76
+ },
77
+ },
78
+ defaultProps: {
79
+ title: "Content that adapts to your layout",
80
+ subTitle: "Designed for clarity and consistency",
81
+ description: "This section supports flexible content placement and alignment across different screen sizes.",
82
+ },
83
+ render: RootHeader
84
+ };
@@ -0,0 +1,8 @@
1
+ import type { Config, Slot } from "@puckeditor/core";
2
+ export interface RootsProps {
3
+ title?: string;
4
+ description?: string;
5
+ children?: React.ReactNode;
6
+ slotHeader?: Slot;
7
+ }
8
+ export declare const RootsConfigs: Config["root"];
@@ -0,0 +1,18 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
+ import { cn } from "../../../shadcns/index.js";
4
+ const Roots = ({ children, title, description, slotHeader: SlotHeader }) => {
5
+ return (_jsxs(_Fragment, { children: [_jsxs("header", { className: "px-10 py-2 flex justify-between border-b fixed left-0 w-full z-90 bg-white", children: [_jsx("div", { className: "text-xl font-semibold flex-1", children: "LOGO" }), _jsxs("div", { className: "flex-1 flex gap-10 justify-center items-center", children: [_jsx("div", { className: "text-md font-semibold", children: "ABOTU" }), _jsx("div", { className: "text-md font-semibold", children: "PRODUCTS" }), _jsx("div", { className: "text-md font-semibold", children: "SOLUTIONS" }), _jsx("div", { className: "text-md font-semibold", children: "SUPPORT" })] }), _jsx("div", { className: cn("text-2xl font-semibold flex-1 flex justify-end items-center", "[&_span]:w-8", "[&_span]:h-0.5", "[&_span]:bg-black"), children: _jsxs("div", { className: cn("flex flex-col gap-1"), children: [_jsx("span", {}), _jsx("span", {}), _jsx("span", {})] }) })] }), _jsx("main", { className: cn("pt-11.5", "flex", "flex-col", "z-1", "*:data-puck-dropzone:min-h-100!"), children: children }), _jsx("footer", { className: cn("px-10 py-2"), children: description })] }));
6
+ };
7
+ export const RootsConfigs = {
8
+ label: "Page Content",
9
+ fields: {
10
+ title: { type: "text" },
11
+ description: { type: "textarea" },
12
+ },
13
+ defaultProps: {
14
+ title: "Hello, world",
15
+ description: "Lorem ipsum",
16
+ },
17
+ render: Roots
18
+ };
@@ -0,0 +1,20 @@
1
+ import { ComponentConfig, PuckComponent } from "@puckeditor/core";
2
+ export interface ButtonProps {
3
+ label?: string;
4
+ link?: string;
5
+ linkBlank?: boolean;
6
+ labelColor?: string;
7
+ bgColor?: string;
8
+ borderColor?: string;
9
+ }
10
+ export interface TextContentProps {
11
+ title?: string;
12
+ description?: string;
13
+ subTitle?: string;
14
+ buttons?: ButtonProps[];
15
+ imgs?: string;
16
+ options?: any;
17
+ titleOptions?: any;
18
+ }
19
+ export declare const TextContent: PuckComponent<TextContentProps>;
20
+ export declare const TextContentConfigs: ComponentConfig;
@@ -0,0 +1,126 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { cn } from "../../../shadcns/index.js";
4
+ export const TextContent = ({ title, description, subTitle, buttons, titleOptions, ...props }) => {
5
+ const { tage2 } = titleOptions || {};
6
+ const TitleComponent = tage2 ?? "h3";
7
+ return (_jsx("div", { "data-component": "text-content", className: cn("flex", "justify-center", "p-5"), children: _jsxs("div", { className: cn("flex flex-col gap-10", "justify-start items-start"), children: [_jsxs("hgroup", { "data-component": "text-content-hgroup", className: "flex flex-col gap-3", children: [_jsx(TitleComponent, { "data-component": "text-content-title", className: "text-3xl font-semibold", children: title }), _jsx("p", { "data-component": "text-content-subTitle", className: "text-base font-medium", children: subTitle })] }), _jsx("p", { "data-component": "text-content-description", className: "", children: description }), buttons && buttons?.length > 0 && _jsx("div", { "data-component": "text-content-buttonGroup", className: "flex gap-0.5", children: buttons.map((bt, index) => (_jsx("button", { "data-component": "text-content-button", className: "p-3 border rounded", children: bt.label }, index))) })] }) }));
8
+ };
9
+ export const TextContentConfigs = {
10
+ label: "TextContent",
11
+ permissions: {
12
+ // delete: false,
13
+ // drag: true,
14
+ insert: true,
15
+ },
16
+ fields: {
17
+ title: {
18
+ label: "Title",
19
+ type: "text",
20
+ contentEditable: true
21
+ },
22
+ subTitle: {
23
+ label: "Sub Title",
24
+ type: "text",
25
+ contentEditable: true
26
+ },
27
+ description: {
28
+ label: "Description",
29
+ type: "textarea",
30
+ contentEditable: true
31
+ },
32
+ buttons: {
33
+ label: "Buttons",
34
+ type: "array",
35
+ arrayFields: {
36
+ label: {
37
+ label: "Label",
38
+ type: "text",
39
+ contentEditable: true,
40
+ placeholder: "ex: learn more"
41
+ },
42
+ link: {
43
+ label: "Link",
44
+ type: "text",
45
+ placeholder: "ex: http://www.abc.com"
46
+ },
47
+ linkTarget: {
48
+ label: "Link Blank",
49
+ type: "radio",
50
+ options: [
51
+ { label: "Yes", value: "yes" },
52
+ { label: "No", value: "no" },
53
+ ],
54
+ },
55
+ labelColor: {
56
+ label: "Label Color",
57
+ type: "text",
58
+ placeholder: "ex: #000000"
59
+ },
60
+ backgroundColor: {
61
+ label: "Background Color",
62
+ type: "text",
63
+ placeholder: "ex: #000000"
64
+ },
65
+ borderColor: {
66
+ label: "Border Color",
67
+ type: "text",
68
+ placeholder: "ex: #000000"
69
+ },
70
+ },
71
+ defaultItemProps: (index) => ({
72
+ label: `Unnamed ${index + 1}`,
73
+ }),
74
+ getItemSummary: (item, index) => {
75
+ return item?.label || `Unnamed ${Number(index) + 1}`;
76
+ },
77
+ },
78
+ titleOptions: {
79
+ label: "Title",
80
+ type: "object",
81
+ objectFields: {
82
+ content2: {
83
+ label: "Content",
84
+ type: "text"
85
+ },
86
+ tage2: {
87
+ label: "Tag",
88
+ type: "radio",
89
+ options: [
90
+ { label: "H1", value: "h1" },
91
+ { label: "H2", value: "h2" },
92
+ { label: "H3", value: "h3" },
93
+ { label: "H4", value: "h4" },
94
+ { label: "H5", value: "h5" },
95
+ { label: "H6", value: "h6" }
96
+ ]
97
+ },
98
+ color2: {
99
+ label: "Color",
100
+ type: "text"
101
+ },
102
+ align2: {
103
+ label: "Align",
104
+ type: "radio",
105
+ options: [
106
+ { label: "Left", value: "left" },
107
+ { label: "Center", value: "center" },
108
+ { label: "Right", value: "right" }
109
+ ],
110
+ },
111
+ },
112
+ },
113
+ },
114
+ defaultProps: {
115
+ title: "Content that adapts to your layout",
116
+ subTitle: "Designed for clarity and consistency",
117
+ description: "This section supports flexible content placement and alignment across different screen sizes.",
118
+ titleOptions: {
119
+ content2: "Content that adapts to your layout",
120
+ tage2: "h3",
121
+ color2: "",
122
+ align2: "left"
123
+ },
124
+ },
125
+ render: TextContent
126
+ };
@@ -0,0 +1,2 @@
1
+ export declare const BuilderIframe: import("react").MemoExoticComponent<({ document, children }: any) => import("react/jsx-runtime").JSX.Element>;
2
+ export declare const BuilderActionBar: import("react").MemoExoticComponent<({ children, label, data }: any) => import("react/jsx-runtime").JSX.Element>;
@@ -0,0 +1,21 @@
1
+ "use client";
2
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { memo } from "react";
4
+ import { Edit } from "lucide-react";
5
+ import { ActionBar } from "@puckeditor/core";
6
+ import { useBuilderContext } from "./content-builder-context";
7
+ import { getPuckSelectedItem } from "./content-builder-pucks-hooks";
8
+ export const BuilderIframe = memo(({ document, children }) => {
9
+ if (document)
10
+ document.body.style.overflowY = "auto";
11
+ return _jsx(_Fragment, { children: children });
12
+ });
13
+ export const BuilderActionBar = memo(({ children, label, data }) => {
14
+ const selectedItem = getPuckSelectedItem();
15
+ const { setBuilderPanelsActive } = useBuilderContext();
16
+ return (_jsx("div", { children: _jsx(ActionBar, { label: label, children: _jsxs(ActionBar.Group, { children: [_jsx(ActionBar.Action, { label: "wade", onClick: () => {
17
+ if (!selectedItem?.props)
18
+ return;
19
+ setBuilderPanelsActive("contentEditor", true);
20
+ }, children: _jsx(Edit, { size: 17 }) }), children] }) }) }));
21
+ });
@@ -0,0 +1,4 @@
1
+ interface BuilderBlocksProps extends React.ComponentProps<"div"> {
2
+ }
3
+ export declare const BuilderBlocks: React.FC<BuilderBlocksProps>;
4
+ export {};
@@ -0,0 +1,15 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { AlertDialog, AlertDialogCancel, AlertDialogContent, } from "../../shadcns/index.js";
4
+ import { useBuilderContext } from "./content-builder-context";
5
+ import { cn } from "../../shadcns/index.js";
6
+ export const BuilderBlocks = () => {
7
+ const { blocksViews, setBuilderNewBlocks, builderProps } = useBuilderContext();
8
+ const { other, ...categories } = builderProps.config?.categories ?? {};
9
+ return (_jsx(AlertDialog, { open: blocksViews.active, onOpenChange: setBuilderNewBlocks, children: _jsx(AlertDialogContent, { className: "w-[85dvw]! max-w-450! h-[86dvh]! p-0 rounded gap-0 border-0 shadow-2xl", children: _jsxs("div", { className: "h-full flex flex-rows gap-15 overflow-hidden", children: [_jsx("div", { className: "w-60 bg-stone-100", children: "sidebar" }), _jsxs("div", { className: "flex-1 flex flex-col gap-20 justify-start items-start h-full overflow-y-auto pr-15", children: [_jsx(AlertDialogCancel, { children: "Cancel" }), categories && Object.keys(categories).map((key, index) => {
10
+ const { title, components } = categories[key];
11
+ return (_jsxs("div", { className: cn("flex", "flex-col", "gap-3"), children: [_jsx("div", { className: "text-base font-semibold", children: title }), _jsx("div", { className: "columns-2 gap-10", children: components?.map((component, index) => (_jsx("div", { className: "select-none break-inside-avoid cursor-pointer", onClick: () => {
12
+ setBuilderNewBlocks(component);
13
+ }, children: _jsxs("div", { className: "grid grid-cols-2 gap-10 items-center w-full origin-top-left border-2", children: [_jsxs("hgroup", { children: [_jsxs("h3", { children: [component, "-Content that adapts to your layout"] }), _jsx("p", { children: "Designed for clarity and consistency" })] }), _jsx("div", { children: _jsx("img", { src: "/01.png" }) })] }) }, index))) })] }, index));
14
+ })] })] }) }) }));
15
+ };
@@ -0,0 +1,10 @@
1
+ import type { Config } from "@puckeditor/core";
2
+ import type { RootsProps } from "./blocks";
3
+ type Components = {};
4
+ export declare const builderConfigs: Config<Components, RootsProps>;
5
+ export declare const builderOverrides: {
6
+ iframe: import("react").MemoExoticComponent<({ document, children }: any) => import("react/jsx-runtime").JSX.Element>;
7
+ actionBar: import("react").MemoExoticComponent<({ children, label, data }: any) => import("react/jsx-runtime").JSX.Element>;
8
+ componentOverlay: import("react").MemoExoticComponent<({ children, componentType, isSelected }: any) => import("react/jsx-runtime").JSX.Element>;
9
+ };
10
+ export {};
@@ -0,0 +1,55 @@
1
+ "use client";
2
+ import { BaseBlockConfigs } from "./blocks/base-block";
3
+ import { MediaContentConfigs } from "./blocks/media-content";
4
+ import { TextContentConfigs } from "./blocks/text-content";
5
+ import { RootsConfigs, } from "./blocks";
6
+ import { BuilderActionBar, BuilderIframe } from "./content-builder-actionbar";
7
+ import { BuilderComponentOverlay } from "./content-builder-overlay";
8
+ export const builderConfigs = {
9
+ root: RootsConfigs,
10
+ components: {
11
+ BaseBlock: BaseBlockConfigs,
12
+ MediaContent: MediaContentConfigs,
13
+ TextContent: TextContentConfigs,
14
+ },
15
+ categories: {
16
+ base: {
17
+ title: "Base",
18
+ components: ["BaseBlock"],
19
+ },
20
+ base2: {
21
+ title: "Base2",
22
+ components: [
23
+ "BaseBlock",
24
+ "BaseBlock",
25
+ "BaseBlock",
26
+ "BaseBlock",
27
+ "BaseBlock",
28
+ "BaseBlock",
29
+ "BaseBlock",
30
+ "BaseBlock",
31
+ ],
32
+ },
33
+ base3: {
34
+ title: "Base3",
35
+ components: [
36
+ "BaseBlock",
37
+ "BaseBlock",
38
+ "BaseBlock",
39
+ "BaseBlock",
40
+ "BaseBlock",
41
+ "BaseBlock",
42
+ "BaseBlock",
43
+ "BaseBlock",
44
+ ],
45
+ },
46
+ other: {
47
+ visible: false,
48
+ },
49
+ }
50
+ };
51
+ export const builderOverrides = {
52
+ iframe: BuilderIframe,
53
+ actionBar: BuilderActionBar,
54
+ componentOverlay: BuilderComponentOverlay
55
+ };
@@ -0,0 +1,22 @@
1
+ import { ContentBuilderProps } from "./content-builder";
2
+ import type { BlocksViews, BuildersPanels, BuildersViewport } from "./content-builder-hooks";
3
+ export interface BuilderContextValue {
4
+ builderProps: ContentBuilderProps;
5
+ builderRef?: React.RefObject<HTMLDivElement | null>;
6
+ blocksViews: BlocksViews;
7
+ viewport: BuildersViewport;
8
+ panels: BuildersPanels;
9
+ selectBuilderBlocks: () => Promise<string | boolean>;
10
+ setBuilderViewport: (viewport: BuildersViewport) => void;
11
+ setBuilderBlockView: React.Dispatch<React.SetStateAction<BlocksViews>>;
12
+ setBuilderPanels: React.Dispatch<React.SetStateAction<BuildersPanels>>;
13
+ setBuilderPanelsActive: (id: string, active?: boolean) => void;
14
+ setBuilderDragging: (state: boolean) => void;
15
+ setBuilderNewBlocks: (block: string | boolean) => void;
16
+ saveBuilderData: (data: any) => void;
17
+ }
18
+ export interface BuilderContextProps extends ContentBuilderProps {
19
+ children: React.ReactNode;
20
+ }
21
+ export declare const BuilderContextProviders: ({ children, ...builderProps }: BuilderContextProps) => import("react/jsx-runtime").JSX.Element;
22
+ export declare const useBuilderContext: () => BuilderContextValue;
@@ -0,0 +1,46 @@
1
+ "use client";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { createContext, use, useMemo } from "react";
4
+ import { useContentBuilder, } from "./content-builder-hooks";
5
+ const BuilderContext = createContext(null);
6
+ export const BuilderContextProviders = ({ children, ...builderProps }) => {
7
+ const { builderRef, viewport, blocksViews, panels, setBuilderBlockView, selectBuilderBlocks, setBuilderPanels, setBuilderPanelsActive, setBuilderViewport, setBuilderDragging, setBuilderNewBlocks, saveBuilderData, } = useContentBuilder({
8
+ builderProps
9
+ });
10
+ const contextValue = useMemo(() => ({
11
+ builderProps,
12
+ builderRef,
13
+ viewport,
14
+ blocksViews,
15
+ panels,
16
+ setBuilderBlockView,
17
+ selectBuilderBlocks,
18
+ setBuilderPanels,
19
+ setBuilderPanelsActive,
20
+ setBuilderViewport,
21
+ setBuilderDragging,
22
+ setBuilderNewBlocks,
23
+ saveBuilderData,
24
+ }), [
25
+ builderProps,
26
+ builderRef,
27
+ viewport,
28
+ blocksViews,
29
+ panels,
30
+ setBuilderBlockView,
31
+ selectBuilderBlocks,
32
+ setBuilderPanels,
33
+ setBuilderPanelsActive,
34
+ setBuilderViewport,
35
+ setBuilderDragging,
36
+ setBuilderNewBlocks,
37
+ saveBuilderData,
38
+ ]);
39
+ return _jsx(BuilderContext, { value: contextValue, children: children });
40
+ };
41
+ export const useBuilderContext = () => {
42
+ const context = use(BuilderContext);
43
+ if (!context)
44
+ throw new Error("BuilderContext must be used inside BuilderContextProviders");
45
+ return context;
46
+ };
@@ -0,0 +1 @@
1
+ export declare const BuilderFields: import("react").MemoExoticComponent<(props: any) => import("react/jsx-runtime").JSX.Element>;
@@ -0,0 +1,5 @@
1
+ "use client";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { memo } from "react";
4
+ import { Puck } from "@puckeditor/core";
5
+ export const BuilderFields = memo((props) => _jsx(Puck.Fields, { ...props }));
@@ -0,0 +1 @@
1
+ export declare const BuilderFunctionBar: () => import("react/jsx-runtime").JSX.Element;