@simple-builder/react 1.0.2 → 1.0.3

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.
@@ -1,3 +1,4 @@
1
+ import * as React from 'react';
1
2
  import { createElement } from 'react';
2
3
 
3
4
  // src/lib/builder.ts
@@ -36,5 +37,16 @@ var builder = /* @__PURE__ */ (() => {
36
37
  }
37
38
  };
38
39
  })();
40
+ var BuildContainerInner = React.lazy(
41
+ () => import('./build-container-client-R2FNJHPM.mjs')
42
+ );
43
+ var BuildContainer = (props) => {
44
+ const { content, edit, name } = props;
45
+ const items = Array.isArray(content) ? content : content?.[name] || [];
46
+ if (!edit) {
47
+ return items.map((item) => builder.bindComponent(item));
48
+ }
49
+ return /* @__PURE__ */ React.createElement(React.Suspense, { fallback: /* @__PURE__ */ React.createElement("div", null, "Loading...") }, /* @__PURE__ */ React.createElement(BuildContainerInner, { ...props }));
50
+ };
39
51
 
40
- export { builder };
52
+ export { BuildContainer, builder };
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkVMHWPKU4_js = require('./chunk-VMHWPKU4.js');
3
+ var chunkUZFAGH6G_js = require('./chunk-UZFAGH6G.js');
4
4
  var React = require('react');
5
5
  var clsx = require('clsx');
6
6
  var tailwindMerge = require('tailwind-merge');
@@ -92,7 +92,7 @@ var BuilderProvider = (props) => {
92
92
  );
93
93
  const addContent = React__namespace.useCallback(
94
94
  (name, container, parent, index = 0) => {
95
- const component = chunkVMHWPKU4_js.builder.getComponent(name);
95
+ const component = chunkUZFAGH6G_js.builder.getComponent(name);
96
96
  if (!component) {
97
97
  throw new Error(`[simple-builder]: Component "${name}" not found`);
98
98
  }
@@ -0,0 +1,20 @@
1
+ import { BuildContainer } from './chunk-FGQSJAOO.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-MNCJZTFS.mjs'));
19
+
20
+ export { BuilderContent, StaticContent };
@@ -1,4 +1,4 @@
1
- import { builder } from './chunk-7K7IGTF3.mjs';
1
+ import { builder } from './chunk-FGQSJAOO.mjs';
2
2
  import * as React from 'react';
3
3
  import { clsx } from 'clsx';
4
4
  import { extendTailwindMerge } from 'tailwind-merge';
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkVMHWPKU4_js = require('./chunk-VMHWPKU4.js');
3
+ var chunkUZFAGH6G_js = require('./chunk-UZFAGH6G.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
+ chunkUZFAGH6G_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-BOQEXOAK.js'));
40
+
41
+ exports.BuilderContent = BuilderContent;
42
+ exports.StaticContent = StaticContent;
@@ -0,0 +1,74 @@
1
+ 'use strict';
2
+
3
+ var React = require('react');
4
+
5
+ function _interopNamespace(e) {
6
+ if (e && e.__esModule) return e;
7
+ var n = Object.create(null);
8
+ if (e) {
9
+ Object.keys(e).forEach(function (k) {
10
+ if (k !== 'default') {
11
+ var d = Object.getOwnPropertyDescriptor(e, k);
12
+ Object.defineProperty(n, k, d.get ? d : {
13
+ enumerable: true,
14
+ get: function () { return e[k]; }
15
+ });
16
+ }
17
+ });
18
+ }
19
+ n.default = e;
20
+ return Object.freeze(n);
21
+ }
22
+
23
+ var React__namespace = /*#__PURE__*/_interopNamespace(React);
24
+
25
+ // src/lib/builder.ts
26
+ var builder = /* @__PURE__ */ (() => {
27
+ const components = [];
28
+ return {
29
+ register: (component, config) => {
30
+ if (components.find(({ name }) => name === config.name)) {
31
+ console.log(
32
+ `[simple-builder]: Component ${config.name} already registered.`
33
+ );
34
+ return;
35
+ }
36
+ components.push({
37
+ component,
38
+ ...config
39
+ });
40
+ },
41
+ getComponents: () => components,
42
+ getComponent: (name) => {
43
+ return components.find((c) => c.name === name);
44
+ },
45
+ bindComponent: ({ content, ...block }, edit) => {
46
+ const component = components.find(({ name }) => name === block.component);
47
+ if (!component) {
48
+ throw new Error(
49
+ `[simple-builder]: Component ${block.component} not found`
50
+ );
51
+ }
52
+ const Element = React.createElement(component.component, {
53
+ key: block.id,
54
+ builder: { id: block.id, content, edit },
55
+ ...block.props
56
+ });
57
+ return Element;
58
+ }
59
+ };
60
+ })();
61
+ var BuildContainerInner = React__namespace.lazy(
62
+ () => import('./build-container-client-MHVIH442.js')
63
+ );
64
+ var BuildContainer = (props) => {
65
+ const { content, edit, name } = props;
66
+ const items = Array.isArray(content) ? content : content?.[name] || [];
67
+ if (!edit) {
68
+ return items.map((item) => builder.bindComponent(item));
69
+ }
70
+ return /* @__PURE__ */ React__namespace.createElement(React__namespace.Suspense, { fallback: /* @__PURE__ */ React__namespace.createElement("div", null, "Loading...") }, /* @__PURE__ */ React__namespace.createElement(BuildContainerInner, { ...props }));
71
+ };
72
+
73
+ exports.BuildContainer = BuildContainer;
74
+ exports.builder = builder;
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 chunkN2X3IJBG_js = require('./chunk-N2X3IJBG.js');
4
+ var chunkUZFAGH6G_js = require('./chunk-UZFAGH6G.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 chunkN2X3IJBG_js.BuilderContent; }
11
+ });
12
+ Object.defineProperty(exports, "StaticContent", {
13
+ enumerable: true,
14
+ get: function () { return chunkN2X3IJBG_js.StaticContent; }
15
+ });
42
16
  Object.defineProperty(exports, "BuildContainer", {
43
17
  enumerable: true,
44
- get: function () { return chunk5ZDNACOH_js.BuildContainer; }
18
+ get: function () { return chunkUZFAGH6G_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 chunkUZFAGH6G_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-IVFWYNC3.mjs';
2
+ export { BuildContainer, builder } from './chunk-FGQSJAOO.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.3",
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.3"
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,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 };
@@ -1,42 +0,0 @@
1
- 'use strict';
2
-
3
- var react = require('react');
4
-
5
- // src/lib/builder.ts
6
- var builder = /* @__PURE__ */ (() => {
7
- const components = [];
8
- return {
9
- register: (component, config) => {
10
- if (components.find(({ name }) => name === config.name)) {
11
- console.log(
12
- `[simple-builder]: Component ${config.name} already registered.`
13
- );
14
- return;
15
- }
16
- components.push({
17
- component,
18
- ...config
19
- });
20
- },
21
- getComponents: () => components,
22
- getComponent: (name) => {
23
- return components.find((c) => c.name === name);
24
- },
25
- bindComponent: ({ content, ...block }, edit) => {
26
- const component = components.find(({ name }) => name === block.component);
27
- if (!component) {
28
- throw new Error(
29
- `[simple-builder]: Component ${block.component} not found`
30
- );
31
- }
32
- const Element = react.createElement(component.component, {
33
- key: block.id,
34
- builder: { id: block.id, content, edit },
35
- ...block.props
36
- });
37
- return Element;
38
- }
39
- };
40
- })();
41
-
42
- exports.builder = builder;