@simple-builder/react 1.2.5 → 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-56IGH4EB.mjs +2255 -0
- package/dist/build-container-client-6D4M5MV6.mjs +2251 -0
- package/dist/build-container-client-JR4HENF4.mjs +2253 -0
- package/dist/build-container-client-JS3CR4W3.js +2291 -0
- package/dist/build-container-client-JXYQOZHZ.js +2287 -0
- package/dist/build-container-client-OANZW6DH.mjs +2255 -0
- package/dist/build-container-client-QBXLJYQD.js +2291 -0
- package/dist/build-container-client-QOFTIHCU.js +2289 -0
- package/dist/build-container-client-YTZ4C67E.mjs +7 -0
- package/dist/build-container-client-Z34EUPR3.js +7 -0
- package/dist/builder-content-5K55QBEE.js +42 -0
- package/dist/builder-content-EHVMYKSR.mjs +20 -0
- package/dist/builder-content-J6G2PNIM.js +42 -0
- package/dist/builder-content-JQ7BYR4W.mjs +20 -0
- package/dist/builder-content-LYSSA6KK.js +42 -0
- package/dist/builder-content-MPQ7ZQN4.js +42 -0
- package/dist/builder-content-OE75E24Z.mjs +20 -0
- package/dist/builder-content-STUVQ4ME.mjs +20 -0
- package/dist/chunk-2DLJX5FY.mjs +123 -0
- package/dist/chunk-2S5KDJXM.js +263 -0
- package/dist/chunk-5DXQZNUR.mjs +238 -0
- package/dist/chunk-5N4LAZ6V.js +42 -0
- package/dist/chunk-5NN2XSII.mjs +238 -0
- package/dist/chunk-5VQCJART.js +153 -0
- package/dist/chunk-75X4HNGS.mjs +238 -0
- package/dist/chunk-BUELIHBX.mjs +238 -0
- package/dist/chunk-DMNRRIPC.js +42 -0
- package/dist/chunk-EMZAPBOH.mjs +20 -0
- package/dist/chunk-FN6K4WJP.mjs +20 -0
- package/dist/chunk-HA4DTJA7.mjs +123 -0
- package/dist/chunk-I4TPSTXB.js +263 -0
- package/dist/chunk-IACBZNOK.js +153 -0
- package/dist/chunk-IVF3GTYS.js +263 -0
- package/dist/chunk-ORODN5Q7.js +153 -0
- package/dist/chunk-RCDOLMDG.js +263 -0
- package/dist/chunk-SMRPMB3V.js +153 -0
- package/dist/chunk-TF7VKEU2.mjs +123 -0
- package/dist/chunk-TWGYIJD2.js +42 -0
- package/dist/chunk-UFWIAKEA.mjs +20 -0
- 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 +2 -2
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunk5VQCJART_js = require('./chunk-5VQCJART.js');
|
|
4
|
+
var React = require('react');
|
|
5
|
+
|
|
6
|
+
function _interopNamespace(e) {
|
|
7
|
+
if (e && e.__esModule) return e;
|
|
8
|
+
var n = Object.create(null);
|
|
9
|
+
if (e) {
|
|
10
|
+
Object.keys(e).forEach(function (k) {
|
|
11
|
+
if (k !== 'default') {
|
|
12
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
13
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
14
|
+
enumerable: true,
|
|
15
|
+
get: function () { return e[k]; }
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
n.default = e;
|
|
21
|
+
return Object.freeze(n);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
25
|
+
|
|
26
|
+
var StaticContent = (props) => {
|
|
27
|
+
return /* @__PURE__ */ React__namespace.createElement(
|
|
28
|
+
chunk5VQCJART_js.BuildContainer,
|
|
29
|
+
{
|
|
30
|
+
name: "root",
|
|
31
|
+
edit: false,
|
|
32
|
+
multiple: true,
|
|
33
|
+
content: props.content || []
|
|
34
|
+
}
|
|
35
|
+
);
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
// src/index.ts
|
|
39
|
+
var BuilderContent = React.lazy(() => import('./builder-content-5K55QBEE.js'));
|
|
40
|
+
|
|
41
|
+
exports.BuilderContent = BuilderContent;
|
|
42
|
+
exports.StaticContent = StaticContent;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { BuildContainer } from './chunk-UH23D2JA.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-EHVMYKSR.mjs'));
|
|
19
|
+
|
|
20
|
+
export { BuilderContent, StaticContent };
|
|
@@ -0,0 +1,123 @@
|
|
|
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
|
+
import { createTV } from 'tailwind-variants';
|
|
7
|
+
|
|
8
|
+
// src/lib/builder.ts
|
|
9
|
+
var builder = /* @__PURE__ */ (() => {
|
|
10
|
+
const components = [];
|
|
11
|
+
return {
|
|
12
|
+
register: (component, config) => {
|
|
13
|
+
if (components.find(({ name }) => name === config.name)) {
|
|
14
|
+
console.log(
|
|
15
|
+
`[simple-builder]: Component ${config.name} already registered.`
|
|
16
|
+
);
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
components.push({
|
|
20
|
+
component,
|
|
21
|
+
...config
|
|
22
|
+
});
|
|
23
|
+
},
|
|
24
|
+
getComponents: () => components,
|
|
25
|
+
getComponent: (name) => {
|
|
26
|
+
return components.find((c) => c.name === name);
|
|
27
|
+
},
|
|
28
|
+
bindComponent: ({ content, ...block }, edit) => {
|
|
29
|
+
const component = components.find(({ name }) => name === block.component);
|
|
30
|
+
if (!component) {
|
|
31
|
+
throw new Error(
|
|
32
|
+
`[simple-builder]: Component ${block.component} not found`
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
const Element = createElement(component.component, {
|
|
36
|
+
key: block.id,
|
|
37
|
+
builder: { id: block.id, content, edit },
|
|
38
|
+
...block.props
|
|
39
|
+
});
|
|
40
|
+
return Element;
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
})();
|
|
44
|
+
var Image = (props) => {
|
|
45
|
+
if (typeof NextImage !== "undefined") {
|
|
46
|
+
return /* @__PURE__ */ React3.createElement(NextImage, { ...props });
|
|
47
|
+
}
|
|
48
|
+
return /* @__PURE__ */ React3.createElement("img", { ...props });
|
|
49
|
+
};
|
|
50
|
+
var twMerge = extendTailwindMerge({
|
|
51
|
+
prefix: "sb-"
|
|
52
|
+
});
|
|
53
|
+
function cn(...inputs) {
|
|
54
|
+
return twMerge(clsx(inputs));
|
|
55
|
+
}
|
|
56
|
+
var tv = createTV({
|
|
57
|
+
twMergeConfig: {
|
|
58
|
+
prefix: "sb-"
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
var insertAt = (items, index, item) => {
|
|
62
|
+
return Array.isArray(items) ? [...items.slice(0, index), item, ...items.slice(index)] : [item];
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
// src/components/design-wrapper.tsx
|
|
66
|
+
var DesignWrapper = (props) => {
|
|
67
|
+
const { children, className, building = false } = props;
|
|
68
|
+
const { background } = props.styles?.desktop ?? {};
|
|
69
|
+
const matches = typeof background === "string" ? background.match(/url\(["']?(.*?)["']?\)/) : void 0;
|
|
70
|
+
const src = matches ? matches[1] : void 0;
|
|
71
|
+
const desktopStyles = props.styles?.desktop ?? {};
|
|
72
|
+
const mobileStyles = props.styles?.mobile ?? {};
|
|
73
|
+
const container = props.styles?.container ?? true;
|
|
74
|
+
const hidden = props.styles?.hidden ?? "never";
|
|
75
|
+
const id = React3.useId().replace(/[^a-zA-Z0-9]/g, "");
|
|
76
|
+
let hiddenClass = "";
|
|
77
|
+
switch (hidden) {
|
|
78
|
+
case "always":
|
|
79
|
+
hiddenClass = building ? "sb-opacity-30" : "sb-hidden";
|
|
80
|
+
break;
|
|
81
|
+
case "mobile":
|
|
82
|
+
hiddenClass = building ? "max-md:sb-opacity-30" : "max-md:sb-hidden";
|
|
83
|
+
break;
|
|
84
|
+
case "desktop":
|
|
85
|
+
hiddenClass = building ? "md:sb-opacity-30" : "md:sb-hidden";
|
|
86
|
+
break;
|
|
87
|
+
case "never":
|
|
88
|
+
hiddenClass = "";
|
|
89
|
+
break;
|
|
90
|
+
}
|
|
91
|
+
return /* @__PURE__ */ React3.createElement("div", { id, className: cn("sb-relative", className, hiddenClass) }, 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
|
+
), container ? /* @__PURE__ */ React3.createElement("div", { className: "container sb-mx-auto" }, children) : children, /* @__PURE__ */ React3.createElement("style", null, `
|
|
100
|
+
#${id} {
|
|
101
|
+
${Object.entries(desktopStyles).filter(([key]) => !(key === "background" && src)).map(([key, value]) => `${key}: ${value};`).join(" ")}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
@media (max-width: 1024px) {
|
|
105
|
+
#${id} {
|
|
106
|
+
${Object.entries(mobileStyles).filter(([key]) => !(key === "background" && src)).map(([key, value]) => `${key}: ${value}; `).join(" ")}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
`.replace(/\s\s+/g, " ")));
|
|
110
|
+
};
|
|
111
|
+
var BuildContainerInner = React3.lazy(
|
|
112
|
+
() => import('./build-container-client-OANZW6DH.mjs')
|
|
113
|
+
);
|
|
114
|
+
var BuildContainer = (props) => {
|
|
115
|
+
const { content, edit, name } = props;
|
|
116
|
+
const items = Array.isArray(content) ? content : content?.[name] || [];
|
|
117
|
+
if (!edit) {
|
|
118
|
+
return items.map((item) => /* @__PURE__ */ React3.createElement(DesignWrapper, { styles: item.styles }, builder.bindComponent(item, true)));
|
|
119
|
+
}
|
|
120
|
+
return /* @__PURE__ */ React3.createElement(React3.Suspense, { fallback: /* @__PURE__ */ React3.createElement("div", null, "Loading...") }, /* @__PURE__ */ React3.createElement(BuildContainerInner, { ...props }));
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
export { BuildContainer, DesignWrapper, Image, builder, cn, insertAt, tv };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkORODN5Q7_js = require('./chunk-ORODN5Q7.js');
|
|
4
|
+
var React = require('react');
|
|
5
|
+
|
|
6
|
+
function _interopNamespace(e) {
|
|
7
|
+
if (e && e.__esModule) return e;
|
|
8
|
+
var n = Object.create(null);
|
|
9
|
+
if (e) {
|
|
10
|
+
Object.keys(e).forEach(function (k) {
|
|
11
|
+
if (k !== 'default') {
|
|
12
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
13
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
14
|
+
enumerable: true,
|
|
15
|
+
get: function () { return e[k]; }
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
n.default = e;
|
|
21
|
+
return Object.freeze(n);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
25
|
+
|
|
26
|
+
var StaticContent = (props) => {
|
|
27
|
+
return /* @__PURE__ */ React__namespace.createElement(
|
|
28
|
+
chunkORODN5Q7_js.BuildContainer,
|
|
29
|
+
{
|
|
30
|
+
name: "root",
|
|
31
|
+
edit: false,
|
|
32
|
+
multiple: true,
|
|
33
|
+
content: props.content || []
|
|
34
|
+
}
|
|
35
|
+
);
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
// src/index.ts
|
|
39
|
+
var BuilderContent = React.lazy(() => import('./builder-content-J6G2PNIM.js'));
|
|
40
|
+
|
|
41
|
+
exports.BuilderContent = BuilderContent;
|
|
42
|
+
exports.StaticContent = StaticContent;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { BuildContainer } from './chunk-HA4DTJA7.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-STUVQ4ME.mjs'));
|
|
19
|
+
|
|
20
|
+
export { BuilderContent, StaticContent };
|
package/dist/index.js
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var chunk5N4LAZ6V_js = require('./chunk-5N4LAZ6V.js');
|
|
4
|
+
var chunkSMRPMB3V_js = require('./chunk-SMRPMB3V.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 chunk5N4LAZ6V_js.BuilderContent; }
|
|
11
11
|
});
|
|
12
12
|
Object.defineProperty(exports, "StaticContent", {
|
|
13
13
|
enumerable: true,
|
|
14
|
-
get: function () { return
|
|
14
|
+
get: function () { return chunk5N4LAZ6V_js.StaticContent; }
|
|
15
15
|
});
|
|
16
16
|
Object.defineProperty(exports, "BuildContainer", {
|
|
17
17
|
enumerable: true,
|
|
18
|
-
get: function () { return
|
|
18
|
+
get: function () { return chunkSMRPMB3V_js.BuildContainer; }
|
|
19
19
|
});
|
|
20
20
|
Object.defineProperty(exports, "builder", {
|
|
21
21
|
enumerable: true,
|
|
22
|
-
get: function () { return
|
|
22
|
+
get: function () { return chunkSMRPMB3V_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-UFWIAKEA.mjs';
|
|
2
|
+
export { BuildContainer, builder } from './chunk-UH23D2JA.mjs';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@simple-builder/react",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.6",
|
|
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",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"tailwind-merge": "^2.2.0",
|
|
60
60
|
"tailwind-variants": "^0.1.20",
|
|
61
61
|
"zod": "^3.22.4",
|
|
62
|
-
"@simple-builder/server": "1.
|
|
62
|
+
"@simple-builder/server": "1.2.6"
|
|
63
63
|
},
|
|
64
64
|
"peerDependencies": {
|
|
65
65
|
"react": ">=16.8.0",
|