@simple-builder/react 1.0.8 → 1.0.9
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-TRHCXW7W.mjs → build-container-client-BOFDDL56.mjs} +310 -424
- package/dist/build-container-client-PB2K64X3.js +1258 -0
- package/dist/{builder-content-WVKVDIRR.mjs → builder-content-DNX5TNK2.mjs} +2 -2
- package/dist/{builder-content-XAIOE6LA.js → builder-content-SSON3UB4.js} +7 -7
- package/dist/{chunk-4Z4JII4A.mjs → chunk-2GQCSML3.mjs} +2 -4
- package/dist/{chunk-LJSVUW4D.js → chunk-ECJUPPTG.js} +1 -45
- package/dist/{chunk-EFA2EAPD.mjs → chunk-LULPEBSO.mjs} +2 -2
- package/dist/{chunk-S3NVED5S.mjs → chunk-OCMLPCSW.mjs} +2 -45
- package/dist/{chunk-MSCSJUNQ.js → chunk-VFH3LVDU.js} +3 -3
- package/dist/{chunk-I2LWMDYD.js → chunk-YGI2WZVP.js} +6 -8
- package/dist/index.js +6 -6
- package/dist/index.mjs +2 -2
- package/package.json +6 -6
- package/dist/build-container-client-64PFJ5XN.js +0 -1372
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { BuilderProvider, useBuilder, Button } from './chunk-
|
|
2
|
-
import { BuildContainer } from './chunk-
|
|
1
|
+
import { BuilderProvider, useBuilder, Button } from './chunk-2GQCSML3.mjs';
|
|
2
|
+
import { BuildContainer } from './chunk-OCMLPCSW.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 chunkYGI2WZVP_js = require('./chunk-YGI2WZVP.js');
|
|
4
|
+
var chunkECJUPPTG_js = require('./chunk-ECJUPPTG.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 } = chunkYGI2WZVP_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(chunkYGI2WZVP_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(chunkYGI2WZVP_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 } = chunkYGI2WZVP_js.useBuilder();
|
|
38
|
+
return /* @__PURE__ */ React2__namespace.createElement(React2__namespace.Fragment, null, /* @__PURE__ */ React2__namespace.createElement(BuilderHeader, null), /* @__PURE__ */ React2__namespace.createElement(chunkECJUPPTG_js.BuildContainer, { name: "root", edit: true, multiple: true, content }));
|
|
39
39
|
};
|
|
40
40
|
var builder_content_default = BuilderContent;
|
|
41
41
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { tv, builder, insertAt } from './chunk-
|
|
1
|
+
import { tv, builder, insertAt } from './chunk-OCMLPCSW.mjs';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { Slot } from '@radix-ui/react-slot';
|
|
4
4
|
|
|
@@ -12,9 +12,7 @@ var BuilderProvider = (props) => {
|
|
|
12
12
|
);
|
|
13
13
|
const getItem = React.useCallback(
|
|
14
14
|
(id) => {
|
|
15
|
-
|
|
16
|
-
console.log("RES", res);
|
|
17
|
-
return res;
|
|
15
|
+
return findRecursive(content, (item) => item.id === id);
|
|
18
16
|
},
|
|
19
17
|
[content]
|
|
20
18
|
);
|
|
@@ -85,49 +85,6 @@ var tv = tailwindVariants.createTV({
|
|
|
85
85
|
var insertAt = (items, index, item) => {
|
|
86
86
|
return Array.isArray(items) ? [...items.slice(0, index), item, ...items.slice(index)] : [item];
|
|
87
87
|
};
|
|
88
|
-
var spacing = {
|
|
89
|
-
parse: (input) => {
|
|
90
|
-
if (typeof input !== "string")
|
|
91
|
-
return {
|
|
92
|
-
top: 0,
|
|
93
|
-
right: 0,
|
|
94
|
-
bottom: 0,
|
|
95
|
-
left: 0
|
|
96
|
-
};
|
|
97
|
-
const matches = input.match(/(\d+)/gm);
|
|
98
|
-
const [top = 0, right = 0, bottom = 0, left = 0] = matches?.map((match) => +match) || [];
|
|
99
|
-
switch (matches?.length) {
|
|
100
|
-
case 1:
|
|
101
|
-
return { top, right: top, bottom: top, left: top };
|
|
102
|
-
case 2:
|
|
103
|
-
return { top, bottom: top, left: right, right };
|
|
104
|
-
case 3:
|
|
105
|
-
return { top, right, left: right, bottom };
|
|
106
|
-
default:
|
|
107
|
-
return { top, right, bottom, left };
|
|
108
|
-
}
|
|
109
|
-
},
|
|
110
|
-
stringify: ({
|
|
111
|
-
top = 0,
|
|
112
|
-
right = 0,
|
|
113
|
-
bottom = 0,
|
|
114
|
-
left = 0
|
|
115
|
-
}) => {
|
|
116
|
-
if ([right, bottom, left].every((v) => v === top)) {
|
|
117
|
-
if (top === 0)
|
|
118
|
-
return;
|
|
119
|
-
return `${top}px`;
|
|
120
|
-
} else if (top === bottom && left === right) {
|
|
121
|
-
return `${top}px ${left}px`;
|
|
122
|
-
} else {
|
|
123
|
-
return `${top}px ${right}px ${bottom}px ${left}px`;
|
|
124
|
-
}
|
|
125
|
-
},
|
|
126
|
-
isIndipendent: (input) => {
|
|
127
|
-
const { top, right, bottom, left } = spacing.parse(input || "");
|
|
128
|
-
return top !== bottom || right !== left;
|
|
129
|
-
}
|
|
130
|
-
};
|
|
131
88
|
|
|
132
89
|
// src/components/design-wrapper.tsx
|
|
133
90
|
var DesignWrapper = (props) => {
|
|
@@ -159,7 +116,7 @@ var DesignWrapper = (props) => {
|
|
|
159
116
|
`.replace(/\s\s+/g, " ")));
|
|
160
117
|
};
|
|
161
118
|
var BuildContainerInner = React3__namespace.lazy(
|
|
162
|
-
() => import('./build-container-client-
|
|
119
|
+
() => import('./build-container-client-PB2K64X3.js')
|
|
163
120
|
);
|
|
164
121
|
var BuildContainer = (props) => {
|
|
165
122
|
const { content, edit, name } = props;
|
|
@@ -176,5 +133,4 @@ exports.Image = Image;
|
|
|
176
133
|
exports.builder = builder;
|
|
177
134
|
exports.cn = cn;
|
|
178
135
|
exports.insertAt = insertAt;
|
|
179
|
-
exports.spacing = spacing;
|
|
180
136
|
exports.tv = tv;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BuildContainer } from './chunk-
|
|
1
|
+
import { BuildContainer } from './chunk-OCMLPCSW.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-DNX5TNK2.mjs'));
|
|
19
19
|
|
|
20
20
|
export { BuilderContent, StaticContent };
|
|
@@ -61,49 +61,6 @@ var tv = createTV({
|
|
|
61
61
|
var insertAt = (items, index, item) => {
|
|
62
62
|
return Array.isArray(items) ? [...items.slice(0, index), item, ...items.slice(index)] : [item];
|
|
63
63
|
};
|
|
64
|
-
var spacing = {
|
|
65
|
-
parse: (input) => {
|
|
66
|
-
if (typeof input !== "string")
|
|
67
|
-
return {
|
|
68
|
-
top: 0,
|
|
69
|
-
right: 0,
|
|
70
|
-
bottom: 0,
|
|
71
|
-
left: 0
|
|
72
|
-
};
|
|
73
|
-
const matches = input.match(/(\d+)/gm);
|
|
74
|
-
const [top = 0, right = 0, bottom = 0, left = 0] = matches?.map((match) => +match) || [];
|
|
75
|
-
switch (matches?.length) {
|
|
76
|
-
case 1:
|
|
77
|
-
return { top, right: top, bottom: top, left: top };
|
|
78
|
-
case 2:
|
|
79
|
-
return { top, bottom: top, left: right, right };
|
|
80
|
-
case 3:
|
|
81
|
-
return { top, right, left: right, bottom };
|
|
82
|
-
default:
|
|
83
|
-
return { top, right, bottom, left };
|
|
84
|
-
}
|
|
85
|
-
},
|
|
86
|
-
stringify: ({
|
|
87
|
-
top = 0,
|
|
88
|
-
right = 0,
|
|
89
|
-
bottom = 0,
|
|
90
|
-
left = 0
|
|
91
|
-
}) => {
|
|
92
|
-
if ([right, bottom, left].every((v) => v === top)) {
|
|
93
|
-
if (top === 0)
|
|
94
|
-
return;
|
|
95
|
-
return `${top}px`;
|
|
96
|
-
} else if (top === bottom && left === right) {
|
|
97
|
-
return `${top}px ${left}px`;
|
|
98
|
-
} else {
|
|
99
|
-
return `${top}px ${right}px ${bottom}px ${left}px`;
|
|
100
|
-
}
|
|
101
|
-
},
|
|
102
|
-
isIndipendent: (input) => {
|
|
103
|
-
const { top, right, bottom, left } = spacing.parse(input || "");
|
|
104
|
-
return top !== bottom || right !== left;
|
|
105
|
-
}
|
|
106
|
-
};
|
|
107
64
|
|
|
108
65
|
// src/components/design-wrapper.tsx
|
|
109
66
|
var DesignWrapper = (props) => {
|
|
@@ -135,7 +92,7 @@ var DesignWrapper = (props) => {
|
|
|
135
92
|
`.replace(/\s\s+/g, " ")));
|
|
136
93
|
};
|
|
137
94
|
var BuildContainerInner = React3.lazy(
|
|
138
|
-
() => import('./build-container-client-
|
|
95
|
+
() => import('./build-container-client-BOFDDL56.mjs')
|
|
139
96
|
);
|
|
140
97
|
var BuildContainer = (props) => {
|
|
141
98
|
const { content, edit, name } = props;
|
|
@@ -146,4 +103,4 @@ var BuildContainer = (props) => {
|
|
|
146
103
|
return /* @__PURE__ */ React3.createElement(React3.Suspense, { fallback: /* @__PURE__ */ React3.createElement("div", null, "Loading...") }, /* @__PURE__ */ React3.createElement(BuildContainerInner, { ...props }));
|
|
147
104
|
};
|
|
148
105
|
|
|
149
|
-
export { BuildContainer, DesignWrapper, Image, builder, cn, insertAt,
|
|
106
|
+
export { BuildContainer, DesignWrapper, Image, builder, cn, insertAt, tv };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkECJUPPTG_js = require('./chunk-ECJUPPTG.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
|
+
chunkECJUPPTG_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-SSON3UB4.js'));
|
|
40
40
|
|
|
41
41
|
exports.BuilderContent = BuilderContent;
|
|
42
42
|
exports.StaticContent = StaticContent;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkECJUPPTG_js = require('./chunk-ECJUPPTG.js');
|
|
4
4
|
var React = require('react');
|
|
5
5
|
var reactSlot = require('@radix-ui/react-slot');
|
|
6
6
|
|
|
@@ -34,9 +34,7 @@ var BuilderProvider = (props) => {
|
|
|
34
34
|
);
|
|
35
35
|
const getItem = React__namespace.useCallback(
|
|
36
36
|
(id) => {
|
|
37
|
-
|
|
38
|
-
console.log("RES", res);
|
|
39
|
-
return res;
|
|
37
|
+
return findRecursive(content, (item) => item.id === id);
|
|
40
38
|
},
|
|
41
39
|
[content]
|
|
42
40
|
);
|
|
@@ -58,7 +56,7 @@ var BuilderProvider = (props) => {
|
|
|
58
56
|
);
|
|
59
57
|
const addContent = React__namespace.useCallback(
|
|
60
58
|
(name, container, parent, index = 0) => {
|
|
61
|
-
const component =
|
|
59
|
+
const component = chunkECJUPPTG_js.builder.getComponent(name);
|
|
62
60
|
if (!component) {
|
|
63
61
|
throw new Error(`[simple-builder]: Component "${name}" not found`);
|
|
64
62
|
}
|
|
@@ -80,7 +78,7 @@ var BuilderProvider = (props) => {
|
|
|
80
78
|
}
|
|
81
79
|
};
|
|
82
80
|
if (!parent) {
|
|
83
|
-
setContent((content2) =>
|
|
81
|
+
setContent((content2) => chunkECJUPPTG_js.insertAt(content2, index, entry));
|
|
84
82
|
return;
|
|
85
83
|
}
|
|
86
84
|
setContent(
|
|
@@ -90,7 +88,7 @@ var BuilderProvider = (props) => {
|
|
|
90
88
|
...item,
|
|
91
89
|
content: {
|
|
92
90
|
...item.content,
|
|
93
|
-
[container]:
|
|
91
|
+
[container]: chunkECJUPPTG_js.insertAt(item.content?.[container], index, entry)
|
|
94
92
|
}
|
|
95
93
|
};
|
|
96
94
|
}
|
|
@@ -218,7 +216,7 @@ var findRecursive = (items, predicate, key = "content") => {
|
|
|
218
216
|
}
|
|
219
217
|
}
|
|
220
218
|
};
|
|
221
|
-
var buttonVariants =
|
|
219
|
+
var buttonVariants = chunkECJUPPTG_js.tv({
|
|
222
220
|
base: "sb-inline-flex sb-uppercase sb-font-roboto sb-items-center sb-justify-center sb-whitespace-nowrap sb-rounded-md sb-text-xs sb-font-semibold ring-offset-background sb-transition-colors focus-visible:sb-outline-none focus-visible:sb-ring-2 focus-visible:ring-ring focus-visible:sb-ring-offset-2 disabled:sb-pointer-events-none disabled:sb-opacity-50",
|
|
223
221
|
variants: {
|
|
224
222
|
variant: {
|
package/dist/index.js
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var chunkVFH3LVDU_js = require('./chunk-VFH3LVDU.js');
|
|
4
|
+
var chunkECJUPPTG_js = require('./chunk-ECJUPPTG.js');
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
Object.defineProperty(exports, "BuilderContent", {
|
|
9
9
|
enumerable: true,
|
|
10
|
-
get: function () { return
|
|
10
|
+
get: function () { return chunkVFH3LVDU_js.BuilderContent; }
|
|
11
11
|
});
|
|
12
12
|
Object.defineProperty(exports, "StaticContent", {
|
|
13
13
|
enumerable: true,
|
|
14
|
-
get: function () { return
|
|
14
|
+
get: function () { return chunkVFH3LVDU_js.StaticContent; }
|
|
15
15
|
});
|
|
16
16
|
Object.defineProperty(exports, "BuildContainer", {
|
|
17
17
|
enumerable: true,
|
|
18
|
-
get: function () { return
|
|
18
|
+
get: function () { return chunkECJUPPTG_js.BuildContainer; }
|
|
19
19
|
});
|
|
20
20
|
Object.defineProperty(exports, "builder", {
|
|
21
21
|
enumerable: true,
|
|
22
|
-
get: function () { return
|
|
22
|
+
get: function () { return chunkECJUPPTG_js.builder; }
|
|
23
23
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { BuilderContent, StaticContent } from './chunk-
|
|
2
|
-
export { BuildContainer, builder } from './chunk-
|
|
1
|
+
export { BuilderContent, StaticContent } from './chunk-LULPEBSO.mjs';
|
|
2
|
+
export { BuildContainer, builder } from './chunk-OCMLPCSW.mjs';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@simple-builder/react",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.9",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "React package for the simple builder package.",
|
|
6
6
|
"repository": "https://github.com/pieter-berkel/simple-builder.git",
|
|
@@ -37,24 +37,24 @@
|
|
|
37
37
|
"@radix-ui/react-toggle": "^1.0.3",
|
|
38
38
|
"clsx": "^2.1.0",
|
|
39
39
|
"date-fns": "^3.2.0",
|
|
40
|
-
"lucide-react": "^0.
|
|
40
|
+
"lucide-react": "^0.312.0",
|
|
41
41
|
"react-day-picker": "^8.10.0",
|
|
42
42
|
"react-hook-form": "^7.49.3",
|
|
43
43
|
"server-only": "^0.0.1",
|
|
44
44
|
"tailwind-merge": "^2.2.0",
|
|
45
45
|
"tailwind-variants": "^0.1.20",
|
|
46
46
|
"zod": "^3.22.4",
|
|
47
|
-
"@simple-builder/server": "1.0.
|
|
47
|
+
"@simple-builder/server": "1.0.9"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
50
|
"react": ">=16.8.0",
|
|
51
51
|
"react-dom": ">=16.8.0"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
|
-
"@types/node": "^20.11.
|
|
55
|
-
"@types/react": "^18.2.
|
|
54
|
+
"@types/node": "^20.11.5",
|
|
55
|
+
"@types/react": "^18.2.48",
|
|
56
56
|
"@types/react-dom": "^18.2.18",
|
|
57
|
-
"autoprefixer": "^10.4.
|
|
57
|
+
"autoprefixer": "^10.4.17",
|
|
58
58
|
"postcss": "^8.4.33",
|
|
59
59
|
"react": "^18.2.0",
|
|
60
60
|
"react-dom": "^18.2.0",
|