@simple-builder/react 1.0.1 → 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.
- package/dist/build-container-client-MHVIH442.js +1318 -0
- package/dist/build-container-client-QJL5MQR6.css +1123 -0
- package/dist/build-container-client-R2FNJHPM.mjs +1287 -0
- package/dist/{builder-content-4E6TBF6O.js → builder-content-BOQEXOAK.js} +7 -8
- package/dist/{builder-content-DEBYN2B4.mjs → builder-content-MNCJZTFS.mjs} +3 -4
- package/dist/builder-content-YW6SKGMM.css +1123 -0
- package/dist/{chunk-7K7IGTF3.mjs → chunk-FGQSJAOO.mjs} +13 -1
- package/dist/{chunk-AAKS5YHL.js → chunk-GSOMMLCG.js} +13 -10
- package/dist/chunk-IVFWYNC3.mjs +20 -0
- package/dist/{chunk-YHA5XZL4.mjs → chunk-LPIHSXYO.mjs} +12 -9
- package/dist/{chunk-W544L5I2.js → chunk-N2X3IJBG.js} +16 -12
- package/dist/chunk-UZFAGH6G.js +74 -0
- package/dist/index.css +260 -269
- package/dist/index.js +12 -40
- package/dist/index.mjs +2 -22
- package/package.json +11 -11
- package/dist/build-container-client-6LLYJPDM.mjs +0 -1268
- package/dist/build-container-client-DICNH7KJ.js +0 -1302
- package/dist/chunk-6C6XHDMD.mjs +0 -16
- package/dist/chunk-VMHWPKU4.js +0 -42
|
@@ -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
|
|
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');
|
|
@@ -27,8 +27,11 @@ function _interopNamespace(e) {
|
|
|
27
27
|
|
|
28
28
|
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
29
29
|
|
|
30
|
+
var twMerge = tailwindMerge.extendTailwindMerge({
|
|
31
|
+
prefix: "sb-"
|
|
32
|
+
});
|
|
30
33
|
function cn(...inputs) {
|
|
31
|
-
return
|
|
34
|
+
return twMerge(clsx.clsx(inputs));
|
|
32
35
|
}
|
|
33
36
|
var insertAt = (items, index, item) => {
|
|
34
37
|
return Array.isArray(items) ? [...items.slice(0, index), item, ...items.slice(index)] : [item];
|
|
@@ -89,7 +92,7 @@ var BuilderProvider = (props) => {
|
|
|
89
92
|
);
|
|
90
93
|
const addContent = React__namespace.useCallback(
|
|
91
94
|
(name, container, parent, index = 0) => {
|
|
92
|
-
const component =
|
|
95
|
+
const component = chunkUZFAGH6G_js.builder.getComponent(name);
|
|
93
96
|
if (!component) {
|
|
94
97
|
throw new Error(`[simple-builder]: Component "${name}" not found`);
|
|
95
98
|
}
|
|
@@ -250,18 +253,18 @@ var findRecursive = (items, predicate, key = "content") => {
|
|
|
250
253
|
}
|
|
251
254
|
};
|
|
252
255
|
var buttonVariants = classVarianceAuthority.cva(
|
|
253
|
-
"inline-flex uppercase font-roboto items-center justify-center whitespace-nowrap rounded-md text-xs font-semibold ring-offset-sb-
|
|
256
|
+
"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",
|
|
254
257
|
{
|
|
255
258
|
variants: {
|
|
256
259
|
variant: {
|
|
257
|
-
primary: "bg-sb-
|
|
258
|
-
destructive: "bg-sb-
|
|
259
|
-
outline: "border border-sb-
|
|
260
|
-
ghost: "hover:bg-
|
|
260
|
+
primary: "sb-bg-primary sb-text-primary-foreground hover:sb-bg-primary/90",
|
|
261
|
+
destructive: "sb-bg-destructive sb-text-destructive-foreground hover:sb-bg-destructive/90",
|
|
262
|
+
outline: "sb-border border-input sb-bg-background hover:sb-bg-accent hover:sb-text-accent-foreground",
|
|
263
|
+
ghost: "hover:sb-bg-accent hover:sb-text-accent-foreground"
|
|
261
264
|
},
|
|
262
265
|
size: {
|
|
263
|
-
default: "h-10 px-4 py-2",
|
|
264
|
-
sm: "h-8 px-3 py-1"
|
|
266
|
+
default: "sb-h-10 sb-px-4 sb-py-2",
|
|
267
|
+
sm: "sb-h-8 sb-px-3 sb-py-1"
|
|
265
268
|
}
|
|
266
269
|
},
|
|
267
270
|
defaultVariants: {
|
|
@@ -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,10 +1,13 @@
|
|
|
1
|
-
import { builder } from './chunk-
|
|
1
|
+
import { builder } from './chunk-FGQSJAOO.mjs';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { clsx } from 'clsx';
|
|
4
|
-
import {
|
|
4
|
+
import { extendTailwindMerge } from 'tailwind-merge';
|
|
5
5
|
import { Slot } from '@radix-ui/react-slot';
|
|
6
6
|
import { cva } from 'class-variance-authority';
|
|
7
7
|
|
|
8
|
+
var twMerge = extendTailwindMerge({
|
|
9
|
+
prefix: "sb-"
|
|
10
|
+
});
|
|
8
11
|
function cn(...inputs) {
|
|
9
12
|
return twMerge(clsx(inputs));
|
|
10
13
|
}
|
|
@@ -228,18 +231,18 @@ var findRecursive = (items, predicate, key = "content") => {
|
|
|
228
231
|
}
|
|
229
232
|
};
|
|
230
233
|
var buttonVariants = cva(
|
|
231
|
-
"inline-flex uppercase font-roboto items-center justify-center whitespace-nowrap rounded-md text-xs font-semibold ring-offset-sb-
|
|
234
|
+
"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",
|
|
232
235
|
{
|
|
233
236
|
variants: {
|
|
234
237
|
variant: {
|
|
235
|
-
primary: "bg-sb-
|
|
236
|
-
destructive: "bg-sb-
|
|
237
|
-
outline: "border border-sb-
|
|
238
|
-
ghost: "hover:bg-
|
|
238
|
+
primary: "sb-bg-primary sb-text-primary-foreground hover:sb-bg-primary/90",
|
|
239
|
+
destructive: "sb-bg-destructive sb-text-destructive-foreground hover:sb-bg-destructive/90",
|
|
240
|
+
outline: "sb-border border-input sb-bg-background hover:sb-bg-accent hover:sb-text-accent-foreground",
|
|
241
|
+
ghost: "hover:sb-bg-accent hover:sb-text-accent-foreground"
|
|
239
242
|
},
|
|
240
243
|
size: {
|
|
241
|
-
default: "h-10 px-4 py-2",
|
|
242
|
-
sm: "h-8 px-3 py-1"
|
|
244
|
+
default: "sb-h-10 sb-px-4 sb-py-2",
|
|
245
|
+
sm: "sb-h-8 sb-px-3 sb-py-1"
|
|
243
246
|
}
|
|
244
247
|
},
|
|
245
248
|
defaultVariants: {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
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
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
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
|
-
|
|
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;
|