@simple-builder/react 1.2.4 → 1.2.6
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/{build-container-client-KI3QULNY.mjs → build-container-client-56IGH4EB.mjs} +13 -6
- package/dist/{build-container-client-DLQONPHH.mjs → build-container-client-6D4M5MV6.mjs} +8 -4
- package/dist/{build-container-client-UYQEUZU5.mjs → build-container-client-JR4HENF4.mjs} +17 -17
- package/dist/{build-container-client-BAVL356F.js → build-container-client-JS3CR4W3.js} +107 -100
- package/dist/{build-container-client-LR4UL6XD.js → build-container-client-JXYQOZHZ.js} +102 -98
- package/dist/build-container-client-OANZW6DH.mjs +2255 -0
- package/dist/build-container-client-QBXLJYQD.js +2291 -0
- package/dist/{build-container-client-XVX67J7D.js → build-container-client-QOFTIHCU.js} +110 -110
- package/dist/build-container-client-YTZ4C67E.mjs +7 -0
- package/dist/build-container-client-Z34EUPR3.js +7 -0
- package/dist/{builder-content-2CLARIDQ.js → builder-content-5K55QBEE.js} +7 -7
- package/dist/{builder-content-YOL4MKX3.mjs → builder-content-EHVMYKSR.mjs} +2 -2
- package/dist/{builder-content-Y7KZGM4Z.js → builder-content-J6G2PNIM.js} +7 -7
- package/dist/{builder-content-44DXQN5V.mjs → builder-content-JQ7BYR4W.mjs} +2 -2
- package/dist/{builder-content-P2XQRXZX.js → builder-content-LYSSA6KK.js} +7 -7
- package/dist/builder-content-MPQ7ZQN4.js +42 -0
- package/dist/{builder-content-J45ZXXEM.mjs → builder-content-OE75E24Z.mjs} +2 -2
- package/dist/builder-content-STUVQ4ME.mjs +20 -0
- package/dist/{chunk-NAY45PRQ.mjs → chunk-2DLJX5FY.mjs} +1 -1
- package/dist/{chunk-ISTZWAYI.js → chunk-2S5KDJXM.js} +5 -5
- package/dist/{chunk-TZQPIYI7.mjs → chunk-5DXQZNUR.mjs} +1 -1
- package/dist/{chunk-R7ZUBTTN.js → chunk-5N4LAZ6V.js} +3 -3
- package/dist/{chunk-Q42UV6O3.mjs → chunk-5NN2XSII.mjs} +1 -1
- package/dist/{chunk-47IWLKYO.js → chunk-5VQCJART.js} +1 -1
- package/dist/{chunk-WVO43G3J.mjs → chunk-75X4HNGS.mjs} +1 -1
- package/dist/chunk-BUELIHBX.mjs +238 -0
- package/dist/{chunk-U3LGZ4IJ.js → chunk-DMNRRIPC.js} +3 -3
- package/dist/{chunk-5EZQG6MP.mjs → chunk-EMZAPBOH.mjs} +2 -2
- package/dist/{chunk-FUIGTZRW.mjs → chunk-FN6K4WJP.mjs} +2 -2
- package/dist/{chunk-527WHDFS.mjs → chunk-HA4DTJA7.mjs} +1 -1
- package/dist/{chunk-IAIJXTFG.js → chunk-I4TPSTXB.js} +5 -5
- package/dist/{chunk-ZEA47N62.js → chunk-IACBZNOK.js} +1 -1
- package/dist/{chunk-DXQKEGLP.js → chunk-IVF3GTYS.js} +5 -5
- package/dist/{chunk-7SAGJTH2.js → chunk-ORODN5Q7.js} +1 -1
- package/dist/chunk-RCDOLMDG.js +263 -0
- package/dist/chunk-SMRPMB3V.js +153 -0
- package/dist/{chunk-F7EVAQN7.mjs → chunk-TF7VKEU2.mjs} +1 -1
- package/dist/{chunk-M2YJU6AM.js → chunk-TWGYIJD2.js} +3 -3
- package/dist/{chunk-MV72DQML.mjs → chunk-UFWIAKEA.mjs} +2 -2
- package/dist/chunk-UH23D2JA.mjs +123 -0
- package/dist/chunk-WP7KTUTL.js +42 -0
- package/dist/chunk-XULCJNV7.mjs +20 -0
- package/dist/index.js +6 -6
- package/dist/index.mjs +2 -2
- package/package.json +15 -15
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
'use client';
|
|
2
|
+
'use client';
|
|
3
|
+
'use client';
|
|
4
|
+
'use client';
|
|
5
|
+
'use client';
|
|
6
|
+
'use client';
|
|
7
|
+
'use client';
|
|
8
|
+
'use client';
|
|
2
9
|
import './chunk-7J7CMYXS.mjs';
|
|
3
10
|
import { buttonVariants, Button, useBuilder } from './chunk-G6MYXYJU.mjs';
|
|
4
11
|
import { cn, tv, DesignWrapper, builder, Image } from './chunk-NJ6FM7SJ.mjs';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var chunkIVF3GTYS_js = require('./chunk-IVF3GTYS.js');
|
|
4
|
+
var chunk5VQCJART_js = require('./chunk-5VQCJART.js');
|
|
5
5
|
var React2 = require('react');
|
|
6
6
|
|
|
7
7
|
function _interopNamespace(e) {
|
|
@@ -25,17 +25,17 @@ function _interopNamespace(e) {
|
|
|
25
25
|
var React2__namespace = /*#__PURE__*/_interopNamespace(React2);
|
|
26
26
|
|
|
27
27
|
var BuilderHeader = () => {
|
|
28
|
-
const { save } =
|
|
29
|
-
return /* @__PURE__ */ React2__namespace.createElement("div", { className: "sb-grid sb-grid-cols-3 sb-gap-4 sb-items-center sb-p-2 sb-shadow-lg sb-sticky sb-inset-x-0 sb-top-0 sb-bg-background sb-z-30" }, /* @__PURE__ */ React2__namespace.createElement("div", { className: "sb-flex sb-gap-4 sb-items-center" }, /* @__PURE__ */ React2__namespace.createElement(
|
|
28
|
+
const { save } = chunkIVF3GTYS_js.useBuilder();
|
|
29
|
+
return /* @__PURE__ */ React2__namespace.createElement("div", { className: "sb-grid sb-grid-cols-3 sb-gap-4 sb-items-center sb-p-2 sb-shadow-lg sb-sticky sb-inset-x-0 sb-top-0 sb-bg-background sb-z-30" }, /* @__PURE__ */ React2__namespace.createElement("div", { className: "sb-flex sb-gap-4 sb-items-center" }, /* @__PURE__ */ React2__namespace.createElement(chunkIVF3GTYS_js.Button, { variant: "ghost", size: "sm", onClick: save }, "Opslaan")));
|
|
30
30
|
};
|
|
31
31
|
|
|
32
32
|
// src/components/builder-content.tsx
|
|
33
33
|
var BuilderContent = (props) => {
|
|
34
|
-
return /* @__PURE__ */ React2__namespace.createElement(
|
|
34
|
+
return /* @__PURE__ */ React2__namespace.createElement(chunkIVF3GTYS_js.BuilderProvider, { content: props.content }, /* @__PURE__ */ React2__namespace.createElement(BuilderContentInner, null));
|
|
35
35
|
};
|
|
36
36
|
var BuilderContentInner = () => {
|
|
37
|
-
const { content } =
|
|
38
|
-
return /* @__PURE__ */ React2__namespace.createElement(React2__namespace.Fragment, null, /* @__PURE__ */ React2__namespace.createElement(BuilderHeader, null), /* @__PURE__ */ React2__namespace.createElement(
|
|
37
|
+
const { content } = chunkIVF3GTYS_js.useBuilder();
|
|
38
|
+
return /* @__PURE__ */ React2__namespace.createElement(React2__namespace.Fragment, null, /* @__PURE__ */ React2__namespace.createElement(BuilderHeader, null), /* @__PURE__ */ React2__namespace.createElement(chunk5VQCJART_js.BuildContainer, { name: "root", edit: true, multiple: true, content }));
|
|
39
39
|
};
|
|
40
40
|
var builder_content_default = BuilderContent;
|
|
41
41
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { BuilderProvider, useBuilder, Button } from './chunk-
|
|
2
|
-
import { BuildContainer } from './chunk-
|
|
1
|
+
import { BuilderProvider, useBuilder, Button } from './chunk-BUELIHBX.mjs';
|
|
2
|
+
import { BuildContainer } from './chunk-UH23D2JA.mjs';
|
|
3
3
|
import * as React2 from 'react';
|
|
4
4
|
|
|
5
5
|
var BuilderHeader = () => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var chunkRCDOLMDG_js = require('./chunk-RCDOLMDG.js');
|
|
4
|
+
var chunkORODN5Q7_js = require('./chunk-ORODN5Q7.js');
|
|
5
5
|
var React2 = require('react');
|
|
6
6
|
|
|
7
7
|
function _interopNamespace(e) {
|
|
@@ -25,17 +25,17 @@ function _interopNamespace(e) {
|
|
|
25
25
|
var React2__namespace = /*#__PURE__*/_interopNamespace(React2);
|
|
26
26
|
|
|
27
27
|
var BuilderHeader = () => {
|
|
28
|
-
const { save } =
|
|
29
|
-
return /* @__PURE__ */ React2__namespace.createElement("div", { className: "sb-grid sb-grid-cols-3 sb-gap-4 sb-items-center sb-p-2 sb-shadow-lg sb-sticky sb-inset-x-0 sb-top-0 sb-bg-background sb-z-30" }, /* @__PURE__ */ React2__namespace.createElement("div", { className: "sb-flex sb-gap-4 sb-items-center" }, /* @__PURE__ */ React2__namespace.createElement(
|
|
28
|
+
const { save } = chunkRCDOLMDG_js.useBuilder();
|
|
29
|
+
return /* @__PURE__ */ React2__namespace.createElement("div", { className: "sb-grid sb-grid-cols-3 sb-gap-4 sb-items-center sb-p-2 sb-shadow-lg sb-sticky sb-inset-x-0 sb-top-0 sb-bg-background sb-z-30" }, /* @__PURE__ */ React2__namespace.createElement("div", { className: "sb-flex sb-gap-4 sb-items-center" }, /* @__PURE__ */ React2__namespace.createElement(chunkRCDOLMDG_js.Button, { variant: "ghost", size: "sm", onClick: save }, "Opslaan")));
|
|
30
30
|
};
|
|
31
31
|
|
|
32
32
|
// src/components/builder-content.tsx
|
|
33
33
|
var BuilderContent = (props) => {
|
|
34
|
-
return /* @__PURE__ */ React2__namespace.createElement(
|
|
34
|
+
return /* @__PURE__ */ React2__namespace.createElement(chunkRCDOLMDG_js.BuilderProvider, { content: props.content }, /* @__PURE__ */ React2__namespace.createElement(BuilderContentInner, null));
|
|
35
35
|
};
|
|
36
36
|
var BuilderContentInner = () => {
|
|
37
|
-
const { content } =
|
|
38
|
-
return /* @__PURE__ */ React2__namespace.createElement(React2__namespace.Fragment, null, /* @__PURE__ */ React2__namespace.createElement(BuilderHeader, null), /* @__PURE__ */ React2__namespace.createElement(
|
|
37
|
+
const { content } = chunkRCDOLMDG_js.useBuilder();
|
|
38
|
+
return /* @__PURE__ */ React2__namespace.createElement(React2__namespace.Fragment, null, /* @__PURE__ */ React2__namespace.createElement(BuilderHeader, null), /* @__PURE__ */ React2__namespace.createElement(chunkORODN5Q7_js.BuildContainer, { name: "root", edit: true, multiple: true, content }));
|
|
39
39
|
};
|
|
40
40
|
var builder_content_default = BuilderContent;
|
|
41
41
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { BuilderProvider, useBuilder, Button } from './chunk-
|
|
2
|
-
import { BuildContainer } from './chunk-
|
|
1
|
+
import { BuilderProvider, useBuilder, Button } from './chunk-5NN2XSII.mjs';
|
|
2
|
+
import { BuildContainer } from './chunk-2DLJX5FY.mjs';
|
|
3
3
|
import * as React2 from 'react';
|
|
4
4
|
|
|
5
5
|
var BuilderHeader = () => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var chunk2S5KDJXM_js = require('./chunk-2S5KDJXM.js');
|
|
4
|
+
var chunkIACBZNOK_js = require('./chunk-IACBZNOK.js');
|
|
5
5
|
var React2 = require('react');
|
|
6
6
|
|
|
7
7
|
function _interopNamespace(e) {
|
|
@@ -25,17 +25,17 @@ function _interopNamespace(e) {
|
|
|
25
25
|
var React2__namespace = /*#__PURE__*/_interopNamespace(React2);
|
|
26
26
|
|
|
27
27
|
var BuilderHeader = () => {
|
|
28
|
-
const { save } =
|
|
29
|
-
return /* @__PURE__ */ React2__namespace.createElement("div", { className: "sb-grid sb-grid-cols-3 sb-gap-4 sb-items-center sb-p-2 sb-shadow-lg sb-sticky sb-inset-x-0 sb-top-0 sb-bg-background sb-z-30" }, /* @__PURE__ */ React2__namespace.createElement("div", { className: "sb-flex sb-gap-4 sb-items-center" }, /* @__PURE__ */ React2__namespace.createElement(
|
|
28
|
+
const { save } = chunk2S5KDJXM_js.useBuilder();
|
|
29
|
+
return /* @__PURE__ */ React2__namespace.createElement("div", { className: "sb-grid sb-grid-cols-3 sb-gap-4 sb-items-center sb-p-2 sb-shadow-lg sb-sticky sb-inset-x-0 sb-top-0 sb-bg-background sb-z-30" }, /* @__PURE__ */ React2__namespace.createElement("div", { className: "sb-flex sb-gap-4 sb-items-center" }, /* @__PURE__ */ React2__namespace.createElement(chunk2S5KDJXM_js.Button, { variant: "ghost", size: "sm", onClick: save }, "Opslaan")));
|
|
30
30
|
};
|
|
31
31
|
|
|
32
32
|
// src/components/builder-content.tsx
|
|
33
33
|
var BuilderContent = (props) => {
|
|
34
|
-
return /* @__PURE__ */ React2__namespace.createElement(
|
|
34
|
+
return /* @__PURE__ */ React2__namespace.createElement(chunk2S5KDJXM_js.BuilderProvider, { content: props.content }, /* @__PURE__ */ React2__namespace.createElement(BuilderContentInner, null));
|
|
35
35
|
};
|
|
36
36
|
var BuilderContentInner = () => {
|
|
37
|
-
const { content } =
|
|
38
|
-
return /* @__PURE__ */ React2__namespace.createElement(React2__namespace.Fragment, null, /* @__PURE__ */ React2__namespace.createElement(BuilderHeader, null), /* @__PURE__ */ React2__namespace.createElement(
|
|
37
|
+
const { content } = chunk2S5KDJXM_js.useBuilder();
|
|
38
|
+
return /* @__PURE__ */ React2__namespace.createElement(React2__namespace.Fragment, null, /* @__PURE__ */ React2__namespace.createElement(BuilderHeader, null), /* @__PURE__ */ React2__namespace.createElement(chunkIACBZNOK_js.BuildContainer, { name: "root", edit: true, multiple: true, content }));
|
|
39
39
|
};
|
|
40
40
|
var builder_content_default = BuilderContent;
|
|
41
41
|
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkI4TPSTXB_js = require('./chunk-I4TPSTXB.js');
|
|
4
|
+
var chunkSMRPMB3V_js = require('./chunk-SMRPMB3V.js');
|
|
5
|
+
var React2 = require('react');
|
|
6
|
+
|
|
7
|
+
function _interopNamespace(e) {
|
|
8
|
+
if (e && e.__esModule) return e;
|
|
9
|
+
var n = Object.create(null);
|
|
10
|
+
if (e) {
|
|
11
|
+
Object.keys(e).forEach(function (k) {
|
|
12
|
+
if (k !== 'default') {
|
|
13
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
14
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
get: function () { return e[k]; }
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
n.default = e;
|
|
22
|
+
return Object.freeze(n);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
var React2__namespace = /*#__PURE__*/_interopNamespace(React2);
|
|
26
|
+
|
|
27
|
+
var BuilderHeader = () => {
|
|
28
|
+
const { save } = chunkI4TPSTXB_js.useBuilder();
|
|
29
|
+
return /* @__PURE__ */ React2__namespace.createElement("div", { className: "sb-grid sb-grid-cols-3 sb-gap-4 sb-items-center sb-p-2 sb-shadow-lg sb-sticky sb-inset-x-0 sb-top-0 sb-bg-background sb-z-30" }, /* @__PURE__ */ React2__namespace.createElement("div", { className: "sb-flex sb-gap-4 sb-items-center" }, /* @__PURE__ */ React2__namespace.createElement(chunkI4TPSTXB_js.Button, { variant: "ghost", size: "sm", onClick: save }, "Opslaan")));
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
// src/components/builder-content.tsx
|
|
33
|
+
var BuilderContent = (props) => {
|
|
34
|
+
return /* @__PURE__ */ React2__namespace.createElement(chunkI4TPSTXB_js.BuilderProvider, { content: props.content }, /* @__PURE__ */ React2__namespace.createElement(BuilderContentInner, null));
|
|
35
|
+
};
|
|
36
|
+
var BuilderContentInner = () => {
|
|
37
|
+
const { content } = chunkI4TPSTXB_js.useBuilder();
|
|
38
|
+
return /* @__PURE__ */ React2__namespace.createElement(React2__namespace.Fragment, null, /* @__PURE__ */ React2__namespace.createElement(BuilderHeader, null), /* @__PURE__ */ React2__namespace.createElement(chunkSMRPMB3V_js.BuildContainer, { name: "root", edit: true, multiple: true, content }));
|
|
39
|
+
};
|
|
40
|
+
var builder_content_default = BuilderContent;
|
|
41
|
+
|
|
42
|
+
module.exports = builder_content_default;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { BuilderProvider, useBuilder, Button } from './chunk-
|
|
2
|
-
import { BuildContainer } from './chunk-
|
|
1
|
+
import { BuilderProvider, useBuilder, Button } from './chunk-5DXQZNUR.mjs';
|
|
2
|
+
import { BuildContainer } from './chunk-TF7VKEU2.mjs';
|
|
3
3
|
import * as React2 from 'react';
|
|
4
4
|
|
|
5
5
|
var BuilderHeader = () => {
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { BuilderProvider, useBuilder, Button } from './chunk-75X4HNGS.mjs';
|
|
2
|
+
import { BuildContainer } from './chunk-HA4DTJA7.mjs';
|
|
3
|
+
import * as React2 from 'react';
|
|
4
|
+
|
|
5
|
+
var BuilderHeader = () => {
|
|
6
|
+
const { save } = useBuilder();
|
|
7
|
+
return /* @__PURE__ */ React2.createElement("div", { className: "sb-grid sb-grid-cols-3 sb-gap-4 sb-items-center sb-p-2 sb-shadow-lg sb-sticky sb-inset-x-0 sb-top-0 sb-bg-background sb-z-30" }, /* @__PURE__ */ React2.createElement("div", { className: "sb-flex sb-gap-4 sb-items-center" }, /* @__PURE__ */ React2.createElement(Button, { variant: "ghost", size: "sm", onClick: save }, "Opslaan")));
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
// src/components/builder-content.tsx
|
|
11
|
+
var BuilderContent = (props) => {
|
|
12
|
+
return /* @__PURE__ */ React2.createElement(BuilderProvider, { content: props.content }, /* @__PURE__ */ React2.createElement(BuilderContentInner, null));
|
|
13
|
+
};
|
|
14
|
+
var BuilderContentInner = () => {
|
|
15
|
+
const { content } = useBuilder();
|
|
16
|
+
return /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(BuilderHeader, null), /* @__PURE__ */ React2.createElement(BuildContainer, { name: "root", edit: true, multiple: true, content }));
|
|
17
|
+
};
|
|
18
|
+
var builder_content_default = BuilderContent;
|
|
19
|
+
|
|
20
|
+
export { builder_content_default as default };
|
|
@@ -109,7 +109,7 @@ var DesignWrapper = (props) => {
|
|
|
109
109
|
`.replace(/\s\s+/g, " ")));
|
|
110
110
|
};
|
|
111
111
|
var BuildContainerInner = React3.lazy(
|
|
112
|
-
() => import('./build-container-client-
|
|
112
|
+
() => import('./build-container-client-6D4M5MV6.mjs')
|
|
113
113
|
);
|
|
114
114
|
var BuildContainer = (props) => {
|
|
115
115
|
const { content, edit, name } = props;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkIACBZNOK_js = require('./chunk-IACBZNOK.js');
|
|
4
4
|
var React = require('react');
|
|
5
5
|
var reactSlot = require('@radix-ui/react-slot');
|
|
6
6
|
var classVarianceAuthority = require('class-variance-authority');
|
|
@@ -57,7 +57,7 @@ var BuilderProvider = (props) => {
|
|
|
57
57
|
);
|
|
58
58
|
const addContent = React__namespace.useCallback(
|
|
59
59
|
(name, container, parent, index = 0) => {
|
|
60
|
-
const component =
|
|
60
|
+
const component = chunkIACBZNOK_js.builder.getComponent(name);
|
|
61
61
|
if (!component) {
|
|
62
62
|
throw new Error(`[simple-builder]: Component "${name}" not found`);
|
|
63
63
|
}
|
|
@@ -79,7 +79,7 @@ var BuilderProvider = (props) => {
|
|
|
79
79
|
}
|
|
80
80
|
};
|
|
81
81
|
if (!parent) {
|
|
82
|
-
setContent((content2) =>
|
|
82
|
+
setContent((content2) => chunkIACBZNOK_js.insertAt(content2, index, entry));
|
|
83
83
|
return;
|
|
84
84
|
}
|
|
85
85
|
setContent(
|
|
@@ -89,7 +89,7 @@ var BuilderProvider = (props) => {
|
|
|
89
89
|
...item,
|
|
90
90
|
content: {
|
|
91
91
|
...item.content,
|
|
92
|
-
[container]:
|
|
92
|
+
[container]: chunkIACBZNOK_js.insertAt(item.content?.[container], index, entry)
|
|
93
93
|
}
|
|
94
94
|
};
|
|
95
95
|
}
|
|
@@ -248,7 +248,7 @@ var Button = React__namespace.forwardRef(
|
|
|
248
248
|
return /* @__PURE__ */ React__namespace.createElement(
|
|
249
249
|
Comp,
|
|
250
250
|
{
|
|
251
|
-
className:
|
|
251
|
+
className: chunkIACBZNOK_js.cn(buttonVariants({ variant, size, className })),
|
|
252
252
|
ref,
|
|
253
253
|
...props
|
|
254
254
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkSMRPMB3V_js = require('./chunk-SMRPMB3V.js');
|
|
4
4
|
var React = require('react');
|
|
5
5
|
|
|
6
6
|
function _interopNamespace(e) {
|
|
@@ -25,7 +25,7 @@ var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
|
25
25
|
|
|
26
26
|
var StaticContent = (props) => {
|
|
27
27
|
return /* @__PURE__ */ React__namespace.createElement(
|
|
28
|
-
|
|
28
|
+
chunkSMRPMB3V_js.BuildContainer,
|
|
29
29
|
{
|
|
30
30
|
name: "root",
|
|
31
31
|
edit: false,
|
|
@@ -36,7 +36,7 @@ var StaticContent = (props) => {
|
|
|
36
36
|
};
|
|
37
37
|
|
|
38
38
|
// src/index.ts
|
|
39
|
-
var BuilderContent = React.lazy(() => import('./builder-content-
|
|
39
|
+
var BuilderContent = React.lazy(() => import('./builder-content-MPQ7ZQN4.js'));
|
|
40
40
|
|
|
41
41
|
exports.BuilderContent = BuilderContent;
|
|
42
42
|
exports.StaticContent = StaticContent;
|
|
@@ -133,7 +133,7 @@ var DesignWrapper = (props) => {
|
|
|
133
133
|
`.replace(/\s\s+/g, " ")));
|
|
134
134
|
};
|
|
135
135
|
var BuildContainerInner = React3__namespace.lazy(
|
|
136
|
-
() => import('./build-container-client-
|
|
136
|
+
() => import('./build-container-client-JXYQOZHZ.js')
|
|
137
137
|
);
|
|
138
138
|
var BuildContainer = (props) => {
|
|
139
139
|
const { content, edit, name } = props;
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
import { cn, builder, insertAt } from './chunk-UH23D2JA.mjs';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { Slot } from '@radix-ui/react-slot';
|
|
4
|
+
import { cva } from 'class-variance-authority';
|
|
5
|
+
|
|
6
|
+
var BuilderContext = React.createContext(
|
|
7
|
+
null
|
|
8
|
+
);
|
|
9
|
+
var BuilderProvider = (props) => {
|
|
10
|
+
const url = props.url ?? "/api/simple-builder";
|
|
11
|
+
const [content, setContent] = React.useState(
|
|
12
|
+
props.content ?? []
|
|
13
|
+
);
|
|
14
|
+
const getItem = React.useCallback(
|
|
15
|
+
(id) => {
|
|
16
|
+
return findRecursive(content, (item) => item.id === id);
|
|
17
|
+
},
|
|
18
|
+
[content]
|
|
19
|
+
);
|
|
20
|
+
const patchItem = React.useCallback(
|
|
21
|
+
(id, patch) => {
|
|
22
|
+
setContent(
|
|
23
|
+
(content2) => mapRecursive(content2, (item) => {
|
|
24
|
+
if (item.id === id) {
|
|
25
|
+
return {
|
|
26
|
+
...item,
|
|
27
|
+
...patch
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
return item;
|
|
31
|
+
})
|
|
32
|
+
);
|
|
33
|
+
},
|
|
34
|
+
[setContent, mapRecursive]
|
|
35
|
+
);
|
|
36
|
+
const addContent = React.useCallback(
|
|
37
|
+
(name, container, parent, index = 0) => {
|
|
38
|
+
const component = builder.getComponent(name);
|
|
39
|
+
if (!component) {
|
|
40
|
+
throw new Error(`[simple-builder]: Component "${name}" not found`);
|
|
41
|
+
}
|
|
42
|
+
const entry = {
|
|
43
|
+
id: crypto.randomUUID(),
|
|
44
|
+
component: component.name,
|
|
45
|
+
...parent && { parent },
|
|
46
|
+
...component.inputs && {
|
|
47
|
+
props: component.inputs.reduce(
|
|
48
|
+
(acc, input) => ({
|
|
49
|
+
...acc,
|
|
50
|
+
[input.name]: input.defaultValue
|
|
51
|
+
}),
|
|
52
|
+
{}
|
|
53
|
+
)
|
|
54
|
+
},
|
|
55
|
+
...component.defaultStyles && {
|
|
56
|
+
styles: component.defaultStyles
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
if (!parent) {
|
|
60
|
+
setContent((content2) => insertAt(content2, index, entry));
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
setContent(
|
|
64
|
+
(content2) => mapRecursive(content2, (item) => {
|
|
65
|
+
if (item.id === parent) {
|
|
66
|
+
return {
|
|
67
|
+
...item,
|
|
68
|
+
content: {
|
|
69
|
+
...item.content,
|
|
70
|
+
[container]: insertAt(item.content?.[container], index, entry)
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
return item;
|
|
75
|
+
})
|
|
76
|
+
);
|
|
77
|
+
},
|
|
78
|
+
[setContent, mapRecursive]
|
|
79
|
+
);
|
|
80
|
+
const deleteContent = React.useCallback(
|
|
81
|
+
(id) => setContent((prev) => filterRecursive(prev, (item) => item.id !== id)),
|
|
82
|
+
[setContent, filterRecursive]
|
|
83
|
+
);
|
|
84
|
+
const bringUp = React.useCallback(
|
|
85
|
+
(id) => {
|
|
86
|
+
setContent(
|
|
87
|
+
(content2) => mapRecursive(content2, (item, index, arr) => {
|
|
88
|
+
if (item.id === id && index > 0) {
|
|
89
|
+
return arr[index - 1];
|
|
90
|
+
}
|
|
91
|
+
if (arr[index + 1]?.id === id) {
|
|
92
|
+
return arr[index + 1];
|
|
93
|
+
}
|
|
94
|
+
return item;
|
|
95
|
+
})
|
|
96
|
+
);
|
|
97
|
+
},
|
|
98
|
+
[setContent, mapRecursive]
|
|
99
|
+
);
|
|
100
|
+
const bringDown = React.useCallback(
|
|
101
|
+
(id) => {
|
|
102
|
+
setContent(
|
|
103
|
+
(content2) => mapRecursive(content2, (item, index, arr) => {
|
|
104
|
+
if (item.id === id && index < arr.length - 1) {
|
|
105
|
+
return arr[index + 1];
|
|
106
|
+
}
|
|
107
|
+
if (arr[index - 1]?.id === id) {
|
|
108
|
+
return arr[index - 1];
|
|
109
|
+
}
|
|
110
|
+
return item;
|
|
111
|
+
})
|
|
112
|
+
);
|
|
113
|
+
},
|
|
114
|
+
[setContent, mapRecursive]
|
|
115
|
+
);
|
|
116
|
+
const save = React.useCallback(async () => {
|
|
117
|
+
const slug = window.location.pathname;
|
|
118
|
+
await fetch(`${url}/page/update`, {
|
|
119
|
+
method: "POST",
|
|
120
|
+
body: JSON.stringify({
|
|
121
|
+
slug,
|
|
122
|
+
content
|
|
123
|
+
})
|
|
124
|
+
});
|
|
125
|
+
}, [content]);
|
|
126
|
+
return /* @__PURE__ */ React.createElement(
|
|
127
|
+
BuilderContext.Provider,
|
|
128
|
+
{
|
|
129
|
+
value: {
|
|
130
|
+
url,
|
|
131
|
+
content,
|
|
132
|
+
setContent,
|
|
133
|
+
getItem,
|
|
134
|
+
patchItem,
|
|
135
|
+
addContent,
|
|
136
|
+
bringUp,
|
|
137
|
+
bringDown,
|
|
138
|
+
deleteContent,
|
|
139
|
+
save
|
|
140
|
+
}
|
|
141
|
+
},
|
|
142
|
+
props.children
|
|
143
|
+
);
|
|
144
|
+
};
|
|
145
|
+
var useBuilder = () => {
|
|
146
|
+
const context = React.useContext(BuilderContext);
|
|
147
|
+
if (!context) {
|
|
148
|
+
throw new Error(
|
|
149
|
+
"[simple-builder]: useBuilder must be used within a BuilderProvider"
|
|
150
|
+
);
|
|
151
|
+
}
|
|
152
|
+
return context;
|
|
153
|
+
};
|
|
154
|
+
var filterRecursive = (items, predicate, key = "content") => {
|
|
155
|
+
return items.filter(predicate).map((item) => ({
|
|
156
|
+
...item,
|
|
157
|
+
...item[key] && {
|
|
158
|
+
[key]: Object.entries(item[key] ?? {}).reduce(
|
|
159
|
+
(acc, [name, content]) => ({
|
|
160
|
+
...acc,
|
|
161
|
+
[name]: filterRecursive(content, predicate, key)
|
|
162
|
+
}),
|
|
163
|
+
{}
|
|
164
|
+
)
|
|
165
|
+
}
|
|
166
|
+
}));
|
|
167
|
+
};
|
|
168
|
+
var mapRecursive = (items, predicate, key = "content") => {
|
|
169
|
+
return items.map(predicate).map((item) => ({
|
|
170
|
+
...item,
|
|
171
|
+
...item[key] && {
|
|
172
|
+
[key]: Object.entries(item[key] ?? {}).reduce(
|
|
173
|
+
(acc, [name, content]) => ({
|
|
174
|
+
...acc,
|
|
175
|
+
[name]: mapRecursive(content, predicate, key)
|
|
176
|
+
}),
|
|
177
|
+
{}
|
|
178
|
+
)
|
|
179
|
+
}
|
|
180
|
+
}));
|
|
181
|
+
};
|
|
182
|
+
var findRecursive = (items, predicate, key = "content") => {
|
|
183
|
+
for (const item of items) {
|
|
184
|
+
if (predicate(item)) {
|
|
185
|
+
return item;
|
|
186
|
+
}
|
|
187
|
+
if (item[key]) {
|
|
188
|
+
const keys = Object.keys(item[key] ?? {});
|
|
189
|
+
for (const x of keys) {
|
|
190
|
+
const found = findRecursive(item[key][x], predicate, key);
|
|
191
|
+
if (found) {
|
|
192
|
+
return found;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
};
|
|
198
|
+
var buttonVariants = cva(
|
|
199
|
+
"sb-inline-flex sb-items-center sb-justify-center sb-gap-2 sb-whitespace-nowrap sb-rounded-md sb-text-sm sb-font-medium sb-transition-colors focus-visible:sb-outline-none focus-visible:sb-ring-1 focus-visible:sb-ring-ring disabled:sb-pointer-events-none disabled:sb-opacity-50 [&_svg]:sb-pointer-events-none [&_svg]:sb-size-4 [&_svg]:sb-shrink-0",
|
|
200
|
+
{
|
|
201
|
+
variants: {
|
|
202
|
+
variant: {
|
|
203
|
+
default: "sb-bg-primary sb-text-primary-foreground sb-shadow hover:sb-bg-primary/90",
|
|
204
|
+
destructive: "sb-bg-destructive sb-text-destructive-foreground sb-shadow-sm hover:sb-bg-destructive/90",
|
|
205
|
+
outline: "sb-border sb-border-input sb-bg-background sb-shadow-sm hover:sb-bg-accent hover:sb-text-accent-foreground",
|
|
206
|
+
secondary: "sb-bg-secondary sb-text-secondary-foreground sb-shadow-sm hover:sb-bg-secondary/80",
|
|
207
|
+
ghost: "hover:sb-bg-accent hover:sb-text-accent-foreground",
|
|
208
|
+
link: "sb-text-primary sb-underline-offset-4 hover:sb-underline"
|
|
209
|
+
},
|
|
210
|
+
size: {
|
|
211
|
+
default: "sb-h-9 sb-px-4 sb-py-2",
|
|
212
|
+
sm: "sb-h-8 sb-rounded-md sb-px-3 sb-text-xs",
|
|
213
|
+
lg: "sb-h-10 sb-rounded-md sb-px-8",
|
|
214
|
+
icon: "sb-h-9 sb-w-9"
|
|
215
|
+
}
|
|
216
|
+
},
|
|
217
|
+
defaultVariants: {
|
|
218
|
+
variant: "default",
|
|
219
|
+
size: "default"
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
);
|
|
223
|
+
var Button = React.forwardRef(
|
|
224
|
+
({ className, variant, size, asChild = false, ...props }, ref) => {
|
|
225
|
+
const Comp = asChild ? Slot : "button";
|
|
226
|
+
return /* @__PURE__ */ React.createElement(
|
|
227
|
+
Comp,
|
|
228
|
+
{
|
|
229
|
+
className: cn(buttonVariants({ variant, size, className })),
|
|
230
|
+
ref,
|
|
231
|
+
...props
|
|
232
|
+
}
|
|
233
|
+
);
|
|
234
|
+
}
|
|
235
|
+
);
|
|
236
|
+
Button.displayName = "Button";
|
|
237
|
+
|
|
238
|
+
export { BuilderProvider, Button, buttonVariants, useBuilder };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkIACBZNOK_js = require('./chunk-IACBZNOK.js');
|
|
4
4
|
var React = require('react');
|
|
5
5
|
|
|
6
6
|
function _interopNamespace(e) {
|
|
@@ -25,7 +25,7 @@ var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
|
25
25
|
|
|
26
26
|
var StaticContent = (props) => {
|
|
27
27
|
return /* @__PURE__ */ React__namespace.createElement(
|
|
28
|
-
|
|
28
|
+
chunkIACBZNOK_js.BuildContainer,
|
|
29
29
|
{
|
|
30
30
|
name: "root",
|
|
31
31
|
edit: false,
|
|
@@ -36,7 +36,7 @@ var StaticContent = (props) => {
|
|
|
36
36
|
};
|
|
37
37
|
|
|
38
38
|
// src/index.ts
|
|
39
|
-
var BuilderContent = React.lazy(() => import('./builder-content-
|
|
39
|
+
var BuilderContent = React.lazy(() => import('./builder-content-LYSSA6KK.js'));
|
|
40
40
|
|
|
41
41
|
exports.BuilderContent = BuilderContent;
|
|
42
42
|
exports.StaticContent = StaticContent;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BuildContainer } from './chunk-
|
|
1
|
+
import { BuildContainer } from './chunk-TF7VKEU2.mjs';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { lazy } from 'react';
|
|
4
4
|
|
|
@@ -15,6 +15,6 @@ var StaticContent = (props) => {
|
|
|
15
15
|
};
|
|
16
16
|
|
|
17
17
|
// src/index.ts
|
|
18
|
-
var BuilderContent = lazy(() => import('./builder-content-
|
|
18
|
+
var BuilderContent = lazy(() => import('./builder-content-OE75E24Z.mjs'));
|
|
19
19
|
|
|
20
20
|
export { BuilderContent, StaticContent };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BuildContainer } from './chunk-
|
|
1
|
+
import { BuildContainer } from './chunk-2DLJX5FY.mjs';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { lazy } from 'react';
|
|
4
4
|
|
|
@@ -15,6 +15,6 @@ var StaticContent = (props) => {
|
|
|
15
15
|
};
|
|
16
16
|
|
|
17
17
|
// src/index.ts
|
|
18
|
-
var BuilderContent = lazy(() => import('./builder-content-
|
|
18
|
+
var BuilderContent = lazy(() => import('./builder-content-JQ7BYR4W.mjs'));
|
|
19
19
|
|
|
20
20
|
export { BuilderContent, StaticContent };
|
|
@@ -109,7 +109,7 @@ var DesignWrapper = (props) => {
|
|
|
109
109
|
`.replace(/\s\s+/g, " ")));
|
|
110
110
|
};
|
|
111
111
|
var BuildContainerInner = React3.lazy(
|
|
112
|
-
() => import('./build-container-client-
|
|
112
|
+
() => import('./build-container-client-56IGH4EB.mjs')
|
|
113
113
|
);
|
|
114
114
|
var BuildContainer = (props) => {
|
|
115
115
|
const { content, edit, name } = props;
|