@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
package/dist/chunk-6C6XHDMD.mjs
DELETED
|
@@ -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-6LLYJPDM.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 };
|
package/dist/chunk-VMHWPKU4.js
DELETED
|
@@ -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;
|