@simple-builder/react 1.0.2 → 1.0.4

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.
@@ -0,0 +1,115 @@
1
+ import * as React3 from 'react';
2
+ import { createElement } from 'react';
3
+ import NextImage from 'next/image';
4
+ import { clsx } from 'clsx';
5
+ import { extendTailwindMerge } from 'tailwind-merge';
6
+
7
+ // src/lib/builder.ts
8
+ var builder = /* @__PURE__ */ (() => {
9
+ const components = [];
10
+ return {
11
+ register: (component, config) => {
12
+ if (components.find(({ name }) => name === config.name)) {
13
+ console.log(
14
+ `[simple-builder]: Component ${config.name} already registered.`
15
+ );
16
+ return;
17
+ }
18
+ components.push({
19
+ component,
20
+ ...config
21
+ });
22
+ },
23
+ getComponents: () => components,
24
+ getComponent: (name) => {
25
+ return components.find((c) => c.name === name);
26
+ },
27
+ bindComponent: ({ content, ...block }, edit) => {
28
+ const component = components.find(({ name }) => name === block.component);
29
+ if (!component) {
30
+ throw new Error(
31
+ `[simple-builder]: Component ${block.component} not found`
32
+ );
33
+ }
34
+ const Element = createElement(component.component, {
35
+ key: block.id,
36
+ builder: { id: block.id, content, edit },
37
+ ...block.props
38
+ });
39
+ return Element;
40
+ }
41
+ };
42
+ })();
43
+ var Image = (props) => {
44
+ if (typeof NextImage !== "undefined") {
45
+ return /* @__PURE__ */ React3.createElement(NextImage.default, { ...props });
46
+ }
47
+ return /* @__PURE__ */ React3.createElement("img", { ...props });
48
+ };
49
+ var twMerge = extendTailwindMerge({
50
+ prefix: "sb-"
51
+ });
52
+ function cn(...inputs) {
53
+ return twMerge(clsx(inputs));
54
+ }
55
+ var insertAt = (items, index, item) => {
56
+ return Array.isArray(items) ? [...items.slice(0, index), item, ...items.slice(index)] : [item];
57
+ };
58
+ var spacing = {
59
+ parse: (input) => {
60
+ const matches = input.match(/(\d+)/gm);
61
+ const [top = 0, right = 0, bottom = 0, left = 0] = matches?.map((match) => +match) || [];
62
+ switch (matches?.length) {
63
+ case 1:
64
+ return { top, right: top, bottom: top, left: top };
65
+ case 2:
66
+ return { top, bottom: top, left: right, right };
67
+ case 3:
68
+ return { top, right, left: right, bottom };
69
+ default:
70
+ return { top, right, bottom, left };
71
+ }
72
+ },
73
+ isIndipendent: (input) => {
74
+ const { top, right, bottom, left } = spacing.parse(input);
75
+ return top !== bottom || right !== left;
76
+ }
77
+ };
78
+
79
+ // src/components/design-wrapper.tsx
80
+ var DesignWrapper = (props) => {
81
+ const { children, className, styles } = props;
82
+ const { container = true, background, ...rest } = styles || {};
83
+ const matches = typeof background === "string" ? background.match(/url\(["']?(.*?)["']?\)/) : void 0;
84
+ const src = matches ? matches[1] : void 0;
85
+ return /* @__PURE__ */ React3.createElement(
86
+ "div",
87
+ {
88
+ className: cn("sb-relative", className),
89
+ style: { ...!src && { background }, ...rest }
90
+ },
91
+ src && /* @__PURE__ */ React3.createElement(
92
+ Image,
93
+ {
94
+ src,
95
+ alt: "",
96
+ fill: true,
97
+ className: "sb-object-cover sb-absolute sb-inset-0 sb-pointer-events-none sb--z-[1]"
98
+ }
99
+ ),
100
+ container ? /* @__PURE__ */ React3.createElement("div", { className: "sb-container sb-mx-auto" }, children) : children
101
+ );
102
+ };
103
+ var BuildContainerInner = React3.lazy(
104
+ () => import('./build-container-client-Y55WZE6M.mjs')
105
+ );
106
+ var BuildContainer = (props) => {
107
+ const { content, edit, name } = props;
108
+ const items = Array.isArray(content) ? content : content?.[name] || [];
109
+ if (!edit) {
110
+ return items.map((item) => /* @__PURE__ */ React3.createElement(DesignWrapper, { styles: item.styles }, builder.bindComponent(item, true)));
111
+ }
112
+ return /* @__PURE__ */ React3.createElement(React3.Suspense, { fallback: /* @__PURE__ */ React3.createElement("div", null, "Loading...") }, /* @__PURE__ */ React3.createElement(BuildContainerInner, { ...props }));
113
+ };
114
+
115
+ export { BuildContainer, DesignWrapper, Image, builder, cn, insertAt, spacing };
@@ -1,41 +1,8 @@
1
- import { builder } from './chunk-7K7IGTF3.mjs';
1
+ import { cn, builder, insertAt } from './chunk-BSE6WW6Q.mjs';
2
2
  import * as React from 'react';
3
- import { clsx } from 'clsx';
4
- import { extendTailwindMerge } from 'tailwind-merge';
5
3
  import { Slot } from '@radix-ui/react-slot';
6
4
  import { cva } from 'class-variance-authority';
7
5
 
8
- var twMerge = extendTailwindMerge({
9
- prefix: "sb-"
10
- });
11
- function cn(...inputs) {
12
- return twMerge(clsx(inputs));
13
- }
14
- var insertAt = (items, index, item) => {
15
- return Array.isArray(items) ? [...items.slice(0, index), item, ...items.slice(index)] : [item];
16
- };
17
- var spacing = {
18
- parse: (input) => {
19
- const matches = input.match(/(\d+)/gm);
20
- const [top = 0, right = 0, bottom = 0, left = 0] = matches?.map((match) => +match) || [];
21
- switch (matches?.length) {
22
- case 1:
23
- return { top, right: top, bottom: top, left: top };
24
- case 2:
25
- return { top, bottom: top, left: right, right };
26
- case 3:
27
- return { top, right, left: right, bottom };
28
- default:
29
- return { top, right, bottom, left };
30
- }
31
- },
32
- isIndipendent: (input) => {
33
- const { top, right, bottom, left } = spacing.parse(input);
34
- return top !== bottom || right !== left;
35
- }
36
- };
37
-
38
- // src/components/context/builder-context.tsx
39
6
  var BuilderContext = React.createContext(
40
7
  null
41
8
  );
@@ -266,4 +233,4 @@ var Button = React.forwardRef(
266
233
  );
267
234
  Button.displayName = "Button";
268
235
 
269
- export { BuilderProvider, Button, buttonVariants, cn, spacing, useBuilder };
236
+ export { BuilderProvider, Button, buttonVariants, useBuilder };
@@ -0,0 +1,145 @@
1
+ 'use strict';
2
+
3
+ var React3 = require('react');
4
+ var NextImage = require('next/image');
5
+ var clsx = require('clsx');
6
+ var tailwindMerge = require('tailwind-merge');
7
+
8
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
9
+
10
+ function _interopNamespace(e) {
11
+ if (e && e.__esModule) return e;
12
+ var n = Object.create(null);
13
+ if (e) {
14
+ Object.keys(e).forEach(function (k) {
15
+ if (k !== 'default') {
16
+ var d = Object.getOwnPropertyDescriptor(e, k);
17
+ Object.defineProperty(n, k, d.get ? d : {
18
+ enumerable: true,
19
+ get: function () { return e[k]; }
20
+ });
21
+ }
22
+ });
23
+ }
24
+ n.default = e;
25
+ return Object.freeze(n);
26
+ }
27
+
28
+ var React3__namespace = /*#__PURE__*/_interopNamespace(React3);
29
+ var NextImage__default = /*#__PURE__*/_interopDefault(NextImage);
30
+
31
+ // src/lib/builder.ts
32
+ var builder = /* @__PURE__ */ (() => {
33
+ const components = [];
34
+ return {
35
+ register: (component, config) => {
36
+ if (components.find(({ name }) => name === config.name)) {
37
+ console.log(
38
+ `[simple-builder]: Component ${config.name} already registered.`
39
+ );
40
+ return;
41
+ }
42
+ components.push({
43
+ component,
44
+ ...config
45
+ });
46
+ },
47
+ getComponents: () => components,
48
+ getComponent: (name) => {
49
+ return components.find((c) => c.name === name);
50
+ },
51
+ bindComponent: ({ content, ...block }, edit) => {
52
+ const component = components.find(({ name }) => name === block.component);
53
+ if (!component) {
54
+ throw new Error(
55
+ `[simple-builder]: Component ${block.component} not found`
56
+ );
57
+ }
58
+ const Element = React3.createElement(component.component, {
59
+ key: block.id,
60
+ builder: { id: block.id, content, edit },
61
+ ...block.props
62
+ });
63
+ return Element;
64
+ }
65
+ };
66
+ })();
67
+ var Image = (props) => {
68
+ if (typeof NextImage__default.default !== "undefined") {
69
+ return /* @__PURE__ */ React3__namespace.createElement(NextImage__default.default.default, { ...props });
70
+ }
71
+ return /* @__PURE__ */ React3__namespace.createElement("img", { ...props });
72
+ };
73
+ var twMerge = tailwindMerge.extendTailwindMerge({
74
+ prefix: "sb-"
75
+ });
76
+ function cn(...inputs) {
77
+ return twMerge(clsx.clsx(inputs));
78
+ }
79
+ var insertAt = (items, index, item) => {
80
+ return Array.isArray(items) ? [...items.slice(0, index), item, ...items.slice(index)] : [item];
81
+ };
82
+ var spacing = {
83
+ parse: (input) => {
84
+ const matches = input.match(/(\d+)/gm);
85
+ const [top = 0, right = 0, bottom = 0, left = 0] = matches?.map((match) => +match) || [];
86
+ switch (matches?.length) {
87
+ case 1:
88
+ return { top, right: top, bottom: top, left: top };
89
+ case 2:
90
+ return { top, bottom: top, left: right, right };
91
+ case 3:
92
+ return { top, right, left: right, bottom };
93
+ default:
94
+ return { top, right, bottom, left };
95
+ }
96
+ },
97
+ isIndipendent: (input) => {
98
+ const { top, right, bottom, left } = spacing.parse(input);
99
+ return top !== bottom || right !== left;
100
+ }
101
+ };
102
+
103
+ // src/components/design-wrapper.tsx
104
+ var DesignWrapper = (props) => {
105
+ const { children, className, styles } = props;
106
+ const { container = true, background, ...rest } = styles || {};
107
+ const matches = typeof background === "string" ? background.match(/url\(["']?(.*?)["']?\)/) : void 0;
108
+ const src = matches ? matches[1] : void 0;
109
+ return /* @__PURE__ */ React3__namespace.createElement(
110
+ "div",
111
+ {
112
+ className: cn("sb-relative", className),
113
+ style: { ...!src && { background }, ...rest }
114
+ },
115
+ src && /* @__PURE__ */ React3__namespace.createElement(
116
+ Image,
117
+ {
118
+ src,
119
+ alt: "",
120
+ fill: true,
121
+ className: "sb-object-cover sb-absolute sb-inset-0 sb-pointer-events-none sb--z-[1]"
122
+ }
123
+ ),
124
+ container ? /* @__PURE__ */ React3__namespace.createElement("div", { className: "sb-container sb-mx-auto" }, children) : children
125
+ );
126
+ };
127
+ var BuildContainerInner = React3__namespace.lazy(
128
+ () => import('./build-container-client-PDM3LRIQ.js')
129
+ );
130
+ var BuildContainer = (props) => {
131
+ const { content, edit, name } = props;
132
+ const items = Array.isArray(content) ? content : content?.[name] || [];
133
+ if (!edit) {
134
+ return items.map((item) => /* @__PURE__ */ React3__namespace.createElement(DesignWrapper, { styles: item.styles }, builder.bindComponent(item, true)));
135
+ }
136
+ return /* @__PURE__ */ React3__namespace.createElement(React3__namespace.Suspense, { fallback: /* @__PURE__ */ React3__namespace.createElement("div", null, "Loading...") }, /* @__PURE__ */ React3__namespace.createElement(BuildContainerInner, { ...props }));
137
+ };
138
+
139
+ exports.BuildContainer = BuildContainer;
140
+ exports.DesignWrapper = DesignWrapper;
141
+ exports.Image = Image;
142
+ exports.builder = builder;
143
+ exports.cn = cn;
144
+ exports.insertAt = insertAt;
145
+ exports.spacing = spacing;
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkVMHWPKU4_js = require('./chunk-VMHWPKU4.js');
3
+ var chunkJ36K7WVK_js = require('./chunk-J36K7WVK.js');
4
4
  var React = require('react');
5
5
 
6
6
  function _interopNamespace(e) {
@@ -23,16 +23,20 @@ function _interopNamespace(e) {
23
23
 
24
24
  var React__namespace = /*#__PURE__*/_interopNamespace(React);
25
25
 
26
- var BuildContainerInner = React__namespace.lazy(
27
- () => import('./build-container-client-LHGW2FFR.js')
28
- );
29
- var BuildContainer = (props) => {
30
- const { content, edit, name } = props;
31
- const items = Array.isArray(content) ? content : content?.[name] || [];
32
- if (!edit) {
33
- return items.map((item) => chunkVMHWPKU4_js.builder.bindComponent(item));
34
- }
35
- return /* @__PURE__ */ React__namespace.createElement(BuildContainerInner, { ...props });
26
+ var StaticContent = (props) => {
27
+ return /* @__PURE__ */ React__namespace.createElement(
28
+ chunkJ36K7WVK_js.BuildContainer,
29
+ {
30
+ name: "root",
31
+ edit: false,
32
+ multiple: true,
33
+ content: props.content || []
34
+ }
35
+ );
36
36
  };
37
37
 
38
- exports.BuildContainer = BuildContainer;
38
+ // src/index.ts
39
+ var BuilderContent = React.lazy(() => import('./builder-content-QNCUQJUB.js'));
40
+
41
+ exports.BuilderContent = BuilderContent;
42
+ exports.StaticContent = StaticContent;
@@ -0,0 +1,20 @@
1
+ import { BuildContainer } from './chunk-BSE6WW6Q.mjs';
2
+ import * as React from 'react';
3
+ import { lazy } from 'react';
4
+
5
+ var StaticContent = (props) => {
6
+ return /* @__PURE__ */ React.createElement(
7
+ BuildContainer,
8
+ {
9
+ name: "root",
10
+ edit: false,
11
+ multiple: true,
12
+ content: props.content || []
13
+ }
14
+ );
15
+ };
16
+
17
+ // src/index.ts
18
+ var BuilderContent = lazy(() => import('./builder-content-GELONUMY.mjs'));
19
+
20
+ export { BuilderContent, StaticContent };
@@ -1,9 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var chunkVMHWPKU4_js = require('./chunk-VMHWPKU4.js');
3
+ var chunkJ36K7WVK_js = require('./chunk-J36K7WVK.js');
4
4
  var React = require('react');
5
- var clsx = require('clsx');
6
- var tailwindMerge = require('tailwind-merge');
7
5
  var reactSlot = require('@radix-ui/react-slot');
8
6
  var classVarianceAuthority = require('class-variance-authority');
9
7
 
@@ -27,37 +25,6 @@ function _interopNamespace(e) {
27
25
 
28
26
  var React__namespace = /*#__PURE__*/_interopNamespace(React);
29
27
 
30
- var twMerge = tailwindMerge.extendTailwindMerge({
31
- prefix: "sb-"
32
- });
33
- function cn(...inputs) {
34
- return twMerge(clsx.clsx(inputs));
35
- }
36
- var insertAt = (items, index, item) => {
37
- return Array.isArray(items) ? [...items.slice(0, index), item, ...items.slice(index)] : [item];
38
- };
39
- var spacing = {
40
- parse: (input) => {
41
- const matches = input.match(/(\d+)/gm);
42
- const [top = 0, right = 0, bottom = 0, left = 0] = matches?.map((match) => +match) || [];
43
- switch (matches?.length) {
44
- case 1:
45
- return { top, right: top, bottom: top, left: top };
46
- case 2:
47
- return { top, bottom: top, left: right, right };
48
- case 3:
49
- return { top, right, left: right, bottom };
50
- default:
51
- return { top, right, bottom, left };
52
- }
53
- },
54
- isIndipendent: (input) => {
55
- const { top, right, bottom, left } = spacing.parse(input);
56
- return top !== bottom || right !== left;
57
- }
58
- };
59
-
60
- // src/components/context/builder-context.tsx
61
28
  var BuilderContext = React__namespace.createContext(
62
29
  null
63
30
  );
@@ -92,7 +59,7 @@ var BuilderProvider = (props) => {
92
59
  );
93
60
  const addContent = React__namespace.useCallback(
94
61
  (name, container, parent, index = 0) => {
95
- const component = chunkVMHWPKU4_js.builder.getComponent(name);
62
+ const component = chunkJ36K7WVK_js.builder.getComponent(name);
96
63
  if (!component) {
97
64
  throw new Error(`[simple-builder]: Component "${name}" not found`);
98
65
  }
@@ -114,7 +81,7 @@ var BuilderProvider = (props) => {
114
81
  }
115
82
  };
116
83
  if (!parent) {
117
- setContent((content2) => insertAt(content2, index, entry));
84
+ setContent((content2) => chunkJ36K7WVK_js.insertAt(content2, index, entry));
118
85
  return;
119
86
  }
120
87
  setContent(
@@ -124,7 +91,7 @@ var BuilderProvider = (props) => {
124
91
  ...item,
125
92
  content: {
126
93
  ...item.content,
127
- [container]: insertAt(item.content?.[container], index, entry)
94
+ [container]: chunkJ36K7WVK_js.insertAt(item.content?.[container], index, entry)
128
95
  }
129
96
  };
130
97
  }
@@ -279,7 +246,7 @@ var Button = React__namespace.forwardRef(
279
246
  return /* @__PURE__ */ React__namespace.createElement(
280
247
  Comp,
281
248
  {
282
- className: cn(buttonVariants({ variant, size, className })),
249
+ className: chunkJ36K7WVK_js.cn(buttonVariants({ variant, size, className })),
283
250
  ref,
284
251
  ...props
285
252
  }
@@ -291,6 +258,4 @@ Button.displayName = "Button";
291
258
  exports.BuilderProvider = BuilderProvider;
292
259
  exports.Button = Button;
293
260
  exports.buttonVariants = buttonVariants;
294
- exports.cn = cn;
295
- exports.spacing = spacing;
296
261
  exports.useBuilder = useBuilder;
package/dist/index.d.mts CHANGED
@@ -52,7 +52,7 @@ type BuildContainerProps = {
52
52
  multiple?: boolean;
53
53
  edit: boolean;
54
54
  };
55
- declare const BuildContainer: (props: BuildContainerProps) => React.JSX.Element | React.FunctionComponentElement<any>[];
55
+ declare const BuildContainer: (props: BuildContainerProps) => React.JSX.Element | React.JSX.Element[];
56
56
 
57
57
  declare const BuilderContent: React.LazyExoticComponent<(props: {
58
58
  content?: _simple_builder_server.BuilderContent | undefined;
package/dist/index.d.ts CHANGED
@@ -52,7 +52,7 @@ type BuildContainerProps = {
52
52
  multiple?: boolean;
53
53
  edit: boolean;
54
54
  };
55
- declare const BuildContainer: (props: BuildContainerProps) => React.JSX.Element | React.FunctionComponentElement<any>[];
55
+ declare const BuildContainer: (props: BuildContainerProps) => React.JSX.Element | React.JSX.Element[];
56
56
 
57
57
  declare const BuilderContent: React.LazyExoticComponent<(props: {
58
58
  content?: _simple_builder_server.BuilderContent | undefined;
package/dist/index.js CHANGED
@@ -1,51 +1,23 @@
1
1
  'use strict';
2
2
 
3
- var chunk5ZDNACOH_js = require('./chunk-5ZDNACOH.js');
4
- var chunkVMHWPKU4_js = require('./chunk-VMHWPKU4.js');
5
- var React = require('react');
3
+ var chunkKOBGFPWB_js = require('./chunk-KOBGFPWB.js');
4
+ var chunkJ36K7WVK_js = require('./chunk-J36K7WVK.js');
6
5
 
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
6
 
25
- var React__namespace = /*#__PURE__*/_interopNamespace(React);
26
-
27
- var StaticContent = (props) => {
28
- return /* @__PURE__ */ React__namespace.createElement(
29
- chunk5ZDNACOH_js.BuildContainer,
30
- {
31
- name: "root",
32
- edit: false,
33
- multiple: true,
34
- content: props.content || []
35
- }
36
- );
37
- };
38
-
39
- // src/index.ts
40
- var BuilderContent = React.lazy(() => import('./builder-content-66LHSBUX.js'));
41
7
 
8
+ Object.defineProperty(exports, "BuilderContent", {
9
+ enumerable: true,
10
+ get: function () { return chunkKOBGFPWB_js.BuilderContent; }
11
+ });
12
+ Object.defineProperty(exports, "StaticContent", {
13
+ enumerable: true,
14
+ get: function () { return chunkKOBGFPWB_js.StaticContent; }
15
+ });
42
16
  Object.defineProperty(exports, "BuildContainer", {
43
17
  enumerable: true,
44
- get: function () { return chunk5ZDNACOH_js.BuildContainer; }
18
+ get: function () { return chunkJ36K7WVK_js.BuildContainer; }
45
19
  });
46
20
  Object.defineProperty(exports, "builder", {
47
21
  enumerable: true,
48
- get: function () { return chunkVMHWPKU4_js.builder; }
22
+ get: function () { return chunkJ36K7WVK_js.builder; }
49
23
  });
50
- exports.BuilderContent = BuilderContent;
51
- exports.StaticContent = StaticContent;
package/dist/index.mjs CHANGED
@@ -1,22 +1,2 @@
1
- import { BuildContainer } from './chunk-NROQCSBF.mjs';
2
- export { BuildContainer } from './chunk-NROQCSBF.mjs';
3
- export { builder } from './chunk-7K7IGTF3.mjs';
4
- import * as React from 'react';
5
- import { lazy } from 'react';
6
-
7
- var StaticContent = (props) => {
8
- return /* @__PURE__ */ React.createElement(
9
- BuildContainer,
10
- {
11
- name: "root",
12
- edit: false,
13
- multiple: true,
14
- content: props.content || []
15
- }
16
- );
17
- };
18
-
19
- // src/index.ts
20
- var BuilderContent = lazy(() => import('./builder-content-FCQHSHSY.mjs'));
21
-
22
- export { BuilderContent, StaticContent };
1
+ export { BuilderContent, StaticContent } from './chunk-NP2NHVJP.mjs';
2
+ export { BuildContainer, builder } from './chunk-BSE6WW6Q.mjs';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@simple-builder/react",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
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",
@@ -26,7 +26,7 @@
26
26
  "dist"
27
27
  ],
28
28
  "dependencies": {
29
- "@hookform/resolvers": "^3.3.3",
29
+ "@hookform/resolvers": "^3.3.4",
30
30
  "@radix-ui/react-alert-dialog": "^1.0.5",
31
31
  "@radix-ui/react-dialog": "^1.0.5",
32
32
  "@radix-ui/react-label": "^2.0.2",
@@ -36,29 +36,29 @@
36
36
  "@radix-ui/react-tabs": "^1.0.4",
37
37
  "@radix-ui/react-toggle": "^1.0.3",
38
38
  "class-variance-authority": "^0.7.0",
39
- "clsx": "^2.0.0",
40
- "date-fns": "^3.0.6",
41
- "lucide-react": "^0.303.0",
39
+ "clsx": "^2.1.0",
40
+ "date-fns": "^3.2.0",
41
+ "lucide-react": "^0.309.0",
42
42
  "react-day-picker": "^8.10.0",
43
- "react-hook-form": "^7.49.2",
43
+ "react-hook-form": "^7.49.3",
44
44
  "server-only": "^0.0.1",
45
45
  "tailwind-merge": "^2.2.0",
46
46
  "zod": "^3.22.4",
47
- "@simple-builder/server": "1.0.2"
47
+ "@simple-builder/server": "1.0.4"
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.10.5",
55
- "@types/react": "^18.2.46",
54
+ "@types/node": "^20.11.0",
55
+ "@types/react": "^18.2.47",
56
56
  "@types/react-dom": "^18.2.18",
57
57
  "autoprefixer": "^10.4.16",
58
- "postcss": "^8.4.32",
58
+ "postcss": "^8.4.33",
59
59
  "react": "^18.2.0",
60
60
  "react-dom": "^18.2.0",
61
- "tailwindcss": "^3.4.0",
61
+ "tailwindcss": "^3.4.1",
62
62
  "tailwindcss-animate": "^1.0.7",
63
63
  "tsup": "^8.0.1",
64
64
  "typescript": "5.3.3"
@@ -1,40 +0,0 @@
1
- import { createElement } from 'react';
2
-
3
- // src/lib/builder.ts
4
- var builder = /* @__PURE__ */ (() => {
5
- const components = [];
6
- return {
7
- register: (component, config) => {
8
- if (components.find(({ name }) => name === config.name)) {
9
- console.log(
10
- `[simple-builder]: Component ${config.name} already registered.`
11
- );
12
- return;
13
- }
14
- components.push({
15
- component,
16
- ...config
17
- });
18
- },
19
- getComponents: () => components,
20
- getComponent: (name) => {
21
- return components.find((c) => c.name === name);
22
- },
23
- bindComponent: ({ content, ...block }, edit) => {
24
- const component = components.find(({ name }) => name === block.component);
25
- if (!component) {
26
- throw new Error(
27
- `[simple-builder]: Component ${block.component} not found`
28
- );
29
- }
30
- const Element = createElement(component.component, {
31
- key: block.id,
32
- builder: { id: block.id, content, edit },
33
- ...block.props
34
- });
35
- return Element;
36
- }
37
- };
38
- })();
39
-
40
- export { builder };
@@ -1,16 +0,0 @@
1
- import { builder } from './chunk-7K7IGTF3.mjs';
2
- import * as React from 'react';
3
-
4
- var BuildContainerInner = React.lazy(
5
- () => import('./build-container-client-SL4TZBOD.mjs')
6
- );
7
- var BuildContainer = (props) => {
8
- const { content, edit, name } = props;
9
- const items = Array.isArray(content) ? content : content?.[name] || [];
10
- if (!edit) {
11
- return items.map((item) => builder.bindComponent(item));
12
- }
13
- return /* @__PURE__ */ React.createElement(BuildContainerInner, { ...props });
14
- };
15
-
16
- export { BuildContainer };