@webstudio-is/react-sdk 0.48.0 → 0.50.0
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/lib/app/custom-components/image.js +9 -9
- package/lib/app/custom-components/shared/remix-link.js +9 -10
- package/lib/app/handle-request.server.js +1 -4
- package/lib/app/root.js +11 -29
- package/lib/cjs/app/custom-components/image.cjs +9 -9
- package/lib/cjs/app/custom-components/shared/remix-link.cjs +9 -10
- package/lib/cjs/app/handle-request.server.cjs +1 -4
- package/lib/cjs/app/root.cjs +11 -29
- package/lib/cjs/components/__generated__/fragment.props.cjs +24 -0
- package/lib/cjs/components/__generated__/slot.props.cjs +24 -0
- package/lib/cjs/components/blockquote.ws.cjs +1 -0
- package/lib/cjs/components/body.cjs +1 -4
- package/lib/cjs/components/body.ws.cjs +1 -1
- package/lib/cjs/components/bold.cjs +1 -4
- package/lib/cjs/components/box.ws.cjs +1 -0
- package/lib/cjs/components/button.cjs +1 -6
- package/lib/cjs/components/button.ws.cjs +1 -0
- package/lib/cjs/components/code.ws.cjs +1 -0
- package/lib/cjs/components/{component-type.cjs → component-meta.cjs} +22 -4
- package/lib/cjs/components/components-utils.cjs +6 -0
- package/lib/cjs/components/components.cjs +4 -0
- package/lib/cjs/components/form.cjs +1 -4
- package/lib/cjs/components/form.ws.cjs +1 -0
- package/lib/cjs/components/fragment.cjs +29 -0
- package/lib/cjs/components/fragment.ws.cjs +32 -0
- package/lib/cjs/components/heading.ws.cjs +1 -0
- package/lib/cjs/components/image.cjs +8 -5
- package/lib/cjs/components/image.ws.cjs +4 -0
- package/lib/cjs/components/index.cjs +8 -0
- package/lib/cjs/components/input.cjs +1 -4
- package/lib/cjs/components/input.ws.cjs +1 -0
- package/lib/cjs/components/italic.cjs +1 -4
- package/lib/cjs/components/link-block.cjs +1 -4
- package/lib/cjs/components/link-block.ws.cjs +1 -0
- package/lib/cjs/components/link.cjs +1 -5
- package/lib/cjs/components/link.ws.cjs +1 -0
- package/lib/cjs/components/list-item.ws.cjs +1 -0
- package/lib/cjs/components/list.ws.cjs +1 -0
- package/lib/cjs/components/paragraph.cjs +1 -4
- package/lib/cjs/components/paragraph.ws.cjs +1 -0
- package/lib/cjs/components/rich-text-link.cjs +1 -4
- package/lib/cjs/components/rich-text-link.ws.cjs +2 -1
- package/lib/cjs/components/separator.ws.cjs +1 -0
- package/lib/cjs/components/slot.cjs +36 -0
- package/lib/cjs/components/slot.ws.cjs +34 -0
- package/lib/cjs/components/span.cjs +1 -4
- package/lib/cjs/components/subscript.cjs +1 -4
- package/lib/cjs/components/superscript.cjs +1 -4
- package/lib/cjs/components/text-block.cjs +1 -4
- package/lib/cjs/components/text-block.ws.cjs +1 -0
- package/lib/cjs/css/categories.cjs +6 -0
- package/lib/cjs/index.cjs +2 -0
- package/lib/cjs/pubsub/create.cjs +13 -0
- package/lib/cjs/tree/create-elements-tree.cjs +26 -22
- package/lib/cjs/tree/session-storage-polyfill.cjs +7 -4
- package/lib/cjs/tree/webstudio-component.cjs +5 -10
- package/lib/components/__generated__/fragment.props.js +4 -0
- package/lib/components/__generated__/slot.props.js +4 -0
- package/lib/components/blockquote.ws.js +1 -0
- package/lib/components/body.js +1 -4
- package/lib/components/body.ws.js +1 -1
- package/lib/components/bold.js +1 -4
- package/lib/components/box.ws.js +1 -0
- package/lib/components/button.js +1 -6
- package/lib/components/button.ws.js +1 -0
- package/lib/components/code.ws.js +1 -0
- package/lib/components/component-meta.js +34 -0
- package/lib/components/components-utils.js +2 -0
- package/lib/components/components.js +4 -0
- package/lib/components/form.js +1 -4
- package/lib/components/form.ws.js +1 -0
- package/lib/components/fragment.js +9 -0
- package/lib/components/fragment.ws.js +12 -0
- package/lib/components/heading.ws.js +1 -0
- package/lib/components/image.js +8 -5
- package/lib/components/image.ws.js +4 -0
- package/lib/components/index.js +8 -0
- package/lib/components/input.js +1 -4
- package/lib/components/input.ws.js +1 -0
- package/lib/components/italic.js +1 -4
- package/lib/components/link-block.js +1 -4
- package/lib/components/link-block.ws.js +1 -0
- package/lib/components/link.js +1 -5
- package/lib/components/link.ws.js +1 -0
- package/lib/components/list-item.ws.js +1 -0
- package/lib/components/list.ws.js +1 -0
- package/lib/components/paragraph.js +1 -4
- package/lib/components/paragraph.ws.js +1 -0
- package/lib/components/rich-text-link.js +1 -4
- package/lib/components/rich-text-link.ws.js +2 -1
- package/lib/components/separator.ws.js +1 -0
- package/lib/components/slot.js +16 -0
- package/lib/components/slot.ws.js +14 -0
- package/lib/components/span.js +1 -4
- package/lib/components/subscript.js +1 -4
- package/lib/components/superscript.js +1 -4
- package/lib/components/text-block.js +1 -4
- package/lib/components/text-block.ws.js +1 -0
- package/lib/css/categories.js +6 -0
- package/lib/index.js +4 -0
- package/lib/pubsub/create.js +9 -0
- package/lib/tree/create-elements-tree.js +26 -22
- package/lib/tree/session-storage-polyfill.js +7 -4
- package/lib/tree/webstudio-component.js +5 -10
- package/package.json +12 -16
- package/src/app/custom-components/index.ts +1 -1
- package/src/components/__generated__/fragment.props.ts +3 -0
- package/src/components/__generated__/slot.props.ts +3 -0
- package/src/components/blockquote.ws.tsx +2 -1
- package/src/components/body.ws.tsx +2 -2
- package/src/components/bold.ws.tsx +1 -1
- package/src/components/box.ws.ts +2 -1
- package/src/components/button.ws.tsx +2 -1
- package/src/components/code.ws.tsx +2 -1
- package/src/components/{component-type.ts → component-meta.ts} +21 -23
- package/src/components/components-utils.ts +4 -0
- package/src/components/components.ts +2 -0
- package/src/components/form.ws.tsx +2 -1
- package/src/components/fragment.tsx +11 -0
- package/src/components/fragment.ws.ts +11 -0
- package/src/components/heading.ws.tsx +2 -1
- package/src/components/image.ws.tsx +2 -1
- package/src/components/index.ts +11 -1
- package/src/components/input.ws.tsx +2 -1
- package/src/components/italic.ws.tsx +1 -1
- package/src/components/link-block.ws.tsx +2 -1
- package/src/components/link.ws.tsx +2 -1
- package/src/components/list-item.ws.tsx +2 -1
- package/src/components/list.ws.tsx +2 -1
- package/src/components/paragraph.ws.tsx +2 -1
- package/src/components/rich-text-link.ws.tsx +4 -2
- package/src/components/separator.ws.tsx +2 -1
- package/src/components/slot.stories.tsx +16 -0
- package/src/components/slot.tsx +17 -0
- package/src/components/slot.ws.ts +13 -0
- package/src/components/span.ws.tsx +1 -1
- package/src/components/subscript.ws.tsx +1 -1
- package/src/components/superscript.ws.tsx +1 -1
- package/src/components/text-block.ws.tsx +2 -1
- package/src/index.ts +5 -4
- package/src/tree/create-elements-tree.tsx +24 -10
- package/src/tree/webstudio-component.tsx +1 -0
- package/lib/components/component-type.js +0 -20
|
@@ -25,6 +25,7 @@ module.exports = __toCommonJS(input_ws_exports);
|
|
|
25
25
|
var import_icons = require("@webstudio-is/icons");
|
|
26
26
|
var import_input = require("./__generated__/input.props");
|
|
27
27
|
const meta = {
|
|
28
|
+
category: "forms",
|
|
28
29
|
type: "control",
|
|
29
30
|
label: "Input",
|
|
30
31
|
Icon: import_icons.InputIcon
|
|
@@ -24,8 +24,5 @@ module.exports = __toCommonJS(italic_exports);
|
|
|
24
24
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
25
25
|
var import_react = require("react");
|
|
26
26
|
const defaultTag = "i";
|
|
27
|
-
const Italic = (0, import_react.forwardRef)((props, ref) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("i", {
|
|
28
|
-
...props,
|
|
29
|
-
ref
|
|
30
|
-
}));
|
|
27
|
+
const Italic = (0, import_react.forwardRef)((props, ref) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("i", { ...props, ref }));
|
|
31
28
|
Italic.displayName = "Italic";
|
|
@@ -24,8 +24,5 @@ module.exports = __toCommonJS(link_block_exports);
|
|
|
24
24
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
25
25
|
var import_react = require("react");
|
|
26
26
|
var import_link = require("./link");
|
|
27
|
-
const LinkBlock = (0, import_react.forwardRef)((props, ref) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_link.Link, {
|
|
28
|
-
...props,
|
|
29
|
-
ref
|
|
30
|
-
}));
|
|
27
|
+
const LinkBlock = (0, import_react.forwardRef)((props, ref) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_link.Link, { ...props, ref }));
|
|
31
28
|
LinkBlock.displayName = "LinkBlock";
|
|
@@ -25,11 +25,7 @@ var import_jsx_runtime = require("react/jsx-runtime");
|
|
|
25
25
|
var import_react = require("react");
|
|
26
26
|
const Link = (0, import_react.forwardRef)(
|
|
27
27
|
({ href = "", ...props }, ref) => {
|
|
28
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("a", {
|
|
29
|
-
...props,
|
|
30
|
-
href,
|
|
31
|
-
ref
|
|
32
|
-
});
|
|
28
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("a", { ...props, href, ref });
|
|
33
29
|
}
|
|
34
30
|
);
|
|
35
31
|
Link.displayName = "Link";
|
|
@@ -25,6 +25,7 @@ module.exports = __toCommonJS(list_item_ws_exports);
|
|
|
25
25
|
var import_icons = require("@webstudio-is/icons");
|
|
26
26
|
var import_list_item = require("./__generated__/list-item.props");
|
|
27
27
|
const meta = {
|
|
28
|
+
category: "typography",
|
|
28
29
|
type: "rich-text",
|
|
29
30
|
label: "List Item",
|
|
30
31
|
Icon: import_icons.ListItemIcon,
|
|
@@ -24,8 +24,5 @@ module.exports = __toCommonJS(paragraph_exports);
|
|
|
24
24
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
25
25
|
var import_react = require("react");
|
|
26
26
|
const defaultTag = "p";
|
|
27
|
-
const Paragraph = (0, import_react.forwardRef)((props, ref) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
|
|
28
|
-
...props,
|
|
29
|
-
ref
|
|
30
|
-
}));
|
|
27
|
+
const Paragraph = (0, import_react.forwardRef)((props, ref) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { ...props, ref }));
|
|
31
28
|
Paragraph.displayName = "Paragraph";
|
|
@@ -25,6 +25,7 @@ module.exports = __toCommonJS(paragraph_ws_exports);
|
|
|
25
25
|
var import_icons = require("@webstudio-is/icons");
|
|
26
26
|
var import_paragraph = require("./__generated__/paragraph.props");
|
|
27
27
|
const meta = {
|
|
28
|
+
category: "typography",
|
|
28
29
|
type: "rich-text",
|
|
29
30
|
label: "Paragraph",
|
|
30
31
|
Icon: import_icons.TextAlignLeftIcon,
|
|
@@ -24,8 +24,5 @@ module.exports = __toCommonJS(rich_text_link_exports);
|
|
|
24
24
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
25
25
|
var import_react = require("react");
|
|
26
26
|
var import_link = require("./link");
|
|
27
|
-
const RichTextLink = (0, import_react.forwardRef)((props, ref) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_link.Link, {
|
|
28
|
-
...props,
|
|
29
|
-
ref
|
|
30
|
-
}));
|
|
27
|
+
const RichTextLink = (0, import_react.forwardRef)((props, ref) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_link.Link, { ...props, ref }));
|
|
31
28
|
RichTextLink.displayName = "RichTextLink";
|
|
@@ -24,8 +24,9 @@ __export(rich_text_link_ws_exports, {
|
|
|
24
24
|
module.exports = __toCommonJS(rich_text_link_ws_exports);
|
|
25
25
|
var import_rich_text_link = require("./__generated__/rich-text-link.props");
|
|
26
26
|
var import_link = require("./link.ws");
|
|
27
|
+
const { category, ...linkMetaRest } = import_link.meta;
|
|
27
28
|
const meta = {
|
|
28
|
-
...
|
|
29
|
+
...linkMetaRest,
|
|
29
30
|
type: "rich-text-child",
|
|
30
31
|
children: []
|
|
31
32
|
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var slot_exports = {};
|
|
20
|
+
__export(slot_exports, {
|
|
21
|
+
Slot: () => Slot
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(slot_exports);
|
|
24
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
25
|
+
var import_react = require("react");
|
|
26
|
+
const Slot = (0, import_react.forwardRef)((props, ref) => {
|
|
27
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
28
|
+
"div",
|
|
29
|
+
{
|
|
30
|
+
...props,
|
|
31
|
+
ref,
|
|
32
|
+
style: { display: props.children ? "contents" : "block" }
|
|
33
|
+
}
|
|
34
|
+
);
|
|
35
|
+
});
|
|
36
|
+
Slot.displayName = "Slot";
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var slot_ws_exports = {};
|
|
20
|
+
__export(slot_ws_exports, {
|
|
21
|
+
meta: () => meta,
|
|
22
|
+
propsMeta: () => propsMeta
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(slot_ws_exports);
|
|
25
|
+
var import_icons = require("@webstudio-is/icons");
|
|
26
|
+
const meta = {
|
|
27
|
+
category: "general",
|
|
28
|
+
type: "container",
|
|
29
|
+
label: "Slot",
|
|
30
|
+
Icon: import_icons.SlotComponentIcon
|
|
31
|
+
};
|
|
32
|
+
const propsMeta = {
|
|
33
|
+
props: {}
|
|
34
|
+
};
|
|
@@ -24,8 +24,5 @@ module.exports = __toCommonJS(span_exports);
|
|
|
24
24
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
25
25
|
var import_react = require("react");
|
|
26
26
|
const defaultTag = "span";
|
|
27
|
-
const Span = (0, import_react.forwardRef)((props, ref) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
28
|
-
...props,
|
|
29
|
-
ref
|
|
30
|
-
}));
|
|
27
|
+
const Span = (0, import_react.forwardRef)((props, ref) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { ...props, ref }));
|
|
31
28
|
Span.displayName = "Span";
|
|
@@ -24,8 +24,5 @@ module.exports = __toCommonJS(subscript_exports);
|
|
|
24
24
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
25
25
|
var import_react = require("react");
|
|
26
26
|
const defaultTag = "sub";
|
|
27
|
-
const Subscript = (0, import_react.forwardRef)((props, ref) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("sub", {
|
|
28
|
-
...props,
|
|
29
|
-
ref
|
|
30
|
-
}));
|
|
27
|
+
const Subscript = (0, import_react.forwardRef)((props, ref) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("sub", { ...props, ref }));
|
|
31
28
|
Subscript.displayName = "Subscript";
|
|
@@ -24,8 +24,5 @@ module.exports = __toCommonJS(superscript_exports);
|
|
|
24
24
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
25
25
|
var import_react = require("react");
|
|
26
26
|
const defaultTag = "sup";
|
|
27
|
-
const Superscript = (0, import_react.forwardRef)((props, ref) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("sup", {
|
|
28
|
-
...props,
|
|
29
|
-
ref
|
|
30
|
-
}));
|
|
27
|
+
const Superscript = (0, import_react.forwardRef)((props, ref) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("sup", { ...props, ref }));
|
|
31
28
|
Superscript.displayName = "Bold";
|
|
@@ -24,8 +24,5 @@ module.exports = __toCommonJS(text_block_exports);
|
|
|
24
24
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
25
25
|
var import_react = require("react");
|
|
26
26
|
const defaultTag = "div";
|
|
27
|
-
const TextBlock = (0, import_react.forwardRef)((props, ref) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
28
|
-
...props,
|
|
29
|
-
ref
|
|
30
|
-
}));
|
|
27
|
+
const TextBlock = (0, import_react.forwardRef)((props, ref) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { ...props, ref }));
|
|
31
28
|
TextBlock.displayName = "TextBlock";
|
|
@@ -24,11 +24,14 @@ __export(categories_exports, {
|
|
|
24
24
|
module.exports = __toCommonJS(categories_exports);
|
|
25
25
|
const layout = [
|
|
26
26
|
"display",
|
|
27
|
+
// Flex
|
|
27
28
|
"flexDirection",
|
|
28
29
|
"flexWrap",
|
|
30
|
+
// Flex or grid
|
|
29
31
|
"alignItems",
|
|
30
32
|
"justifyContent",
|
|
31
33
|
"alignContent",
|
|
34
|
+
// Grid
|
|
32
35
|
"justifyItems",
|
|
33
36
|
"rowGap",
|
|
34
37
|
"columnGap",
|
|
@@ -109,6 +112,7 @@ const typography = [
|
|
|
109
112
|
"direction",
|
|
110
113
|
"whiteSpace",
|
|
111
114
|
"textShadow",
|
|
115
|
+
// More
|
|
112
116
|
"fontSizeAdjust",
|
|
113
117
|
"fontStretch",
|
|
114
118
|
"fontVariant",
|
|
@@ -149,6 +153,7 @@ const borders = [
|
|
|
149
153
|
"borderRightWidth",
|
|
150
154
|
"borderBottomWidth",
|
|
151
155
|
"borderLeftWidth",
|
|
156
|
+
// More
|
|
152
157
|
"borderImageSlice",
|
|
153
158
|
"borderImageWidth",
|
|
154
159
|
"borderImageOutset",
|
|
@@ -167,6 +172,7 @@ const effects = [
|
|
|
167
172
|
"filter",
|
|
168
173
|
"backdropFilter",
|
|
169
174
|
"cursor",
|
|
175
|
+
// More
|
|
170
176
|
"animationDelay",
|
|
171
177
|
"animationDirection",
|
|
172
178
|
"animationDuration",
|
package/lib/cjs/index.cjs
CHANGED
|
@@ -19,6 +19,7 @@ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "defau
|
|
|
19
19
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
20
|
var src_exports = {};
|
|
21
21
|
__export(src_exports, {
|
|
22
|
+
componentCategories: () => import_component_meta.componentCategories,
|
|
22
23
|
customComponentMetas: () => import_custom_components.customComponentMetas,
|
|
23
24
|
customComponentPropsMetas: () => import_custom_components.customComponentPropsMetas,
|
|
24
25
|
customComponents: () => import_custom_components.customComponents
|
|
@@ -32,3 +33,4 @@ __reExport(src_exports, require("./app"), module.exports);
|
|
|
32
33
|
__reExport(src_exports, require("./components/components"), module.exports);
|
|
33
34
|
__reExport(src_exports, require("./components/components-utils"), module.exports);
|
|
34
35
|
var import_custom_components = require("./app/custom-components");
|
|
36
|
+
var import_component_meta = require("./components/component-meta");
|
|
@@ -18,6 +18,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
return to;
|
|
19
19
|
};
|
|
20
20
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
21
25
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
26
|
mod
|
|
23
27
|
));
|
|
@@ -43,10 +47,16 @@ const createPubsub = () => {
|
|
|
43
47
|
);
|
|
44
48
|
}
|
|
45
49
|
return {
|
|
50
|
+
/**
|
|
51
|
+
* To publish a postMessage event on the current window and parent window from the iframe.
|
|
52
|
+
*/
|
|
46
53
|
publish(action) {
|
|
47
54
|
window.parent.postMessage(action, "*");
|
|
48
55
|
window.postMessage(action, "*");
|
|
49
56
|
},
|
|
57
|
+
/**
|
|
58
|
+
* To publish a postMessage event on the iframe and parent window from the parent window.
|
|
59
|
+
*/
|
|
50
60
|
usePublish() {
|
|
51
61
|
const iframeRef = (0, import_react.useRef)(null);
|
|
52
62
|
const publishCallback = (0, import_react.useCallback)(
|
|
@@ -62,6 +72,9 @@ const createPubsub = () => {
|
|
|
62
72
|
);
|
|
63
73
|
return [publishCallback, iframeRef];
|
|
64
74
|
},
|
|
75
|
+
/**
|
|
76
|
+
* To subscribe a message event on the current window.
|
|
77
|
+
*/
|
|
65
78
|
useSubscribe(type, onAction) {
|
|
66
79
|
(0, import_react.useEffect)(() => {
|
|
67
80
|
emitter.on(type, onAction);
|
|
@@ -34,32 +34,31 @@ const createElementsTree = ({
|
|
|
34
34
|
Component,
|
|
35
35
|
getComponent
|
|
36
36
|
}) => {
|
|
37
|
+
const rootInstanceSelector = [instance.id];
|
|
37
38
|
const children = createInstanceChildrenElements({
|
|
39
|
+
instanceSelector: rootInstanceSelector,
|
|
38
40
|
Component,
|
|
39
41
|
children: instance.children,
|
|
40
42
|
getComponent
|
|
41
43
|
});
|
|
42
|
-
const
|
|
44
|
+
const root = createInstanceElement({
|
|
43
45
|
Component,
|
|
44
46
|
instance,
|
|
47
|
+
instanceSelector: rootInstanceSelector,
|
|
45
48
|
children: [
|
|
46
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react.Fragment, {
|
|
47
|
-
children
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
]
|
|
53
|
-
}, "children")
|
|
49
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react.Fragment, { children: [
|
|
50
|
+
children,
|
|
51
|
+
sandbox && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_session_storage_polyfill.SessionStoragePolyfill, {}),
|
|
52
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react2.ScrollRestoration, {}),
|
|
53
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react2.Scripts, {})
|
|
54
|
+
] }, "children")
|
|
54
55
|
],
|
|
55
56
|
getComponent
|
|
56
57
|
});
|
|
57
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_context.ReactSdkContext.Provider, {
|
|
58
|
-
value: { propsByInstanceIdStore, assetsStore },
|
|
59
|
-
children: body
|
|
60
|
-
});
|
|
58
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_context.ReactSdkContext.Provider, { value: { propsByInstanceIdStore, assetsStore }, children: root });
|
|
61
59
|
};
|
|
62
60
|
const createInstanceChildrenElements = ({
|
|
61
|
+
instanceSelector,
|
|
63
62
|
children,
|
|
64
63
|
Component,
|
|
65
64
|
getComponent
|
|
@@ -70,13 +69,16 @@ const createInstanceChildrenElements = ({
|
|
|
70
69
|
elements.push(child.value);
|
|
71
70
|
continue;
|
|
72
71
|
}
|
|
72
|
+
const childInstanceSelector = [child.id, ...instanceSelector];
|
|
73
73
|
const children2 = createInstanceChildrenElements({
|
|
74
|
+
instanceSelector: childInstanceSelector,
|
|
74
75
|
children: child.children,
|
|
75
76
|
Component,
|
|
76
77
|
getComponent
|
|
77
78
|
});
|
|
78
79
|
const element = createInstanceElement({
|
|
79
80
|
instance: child,
|
|
81
|
+
instanceSelector: childInstanceSelector,
|
|
80
82
|
Component,
|
|
81
83
|
children: children2,
|
|
82
84
|
getComponent
|
|
@@ -88,16 +90,18 @@ const createInstanceChildrenElements = ({
|
|
|
88
90
|
const createInstanceElement = ({
|
|
89
91
|
Component,
|
|
90
92
|
instance,
|
|
93
|
+
instanceSelector,
|
|
91
94
|
children = [],
|
|
92
95
|
getComponent
|
|
93
96
|
}) => {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
97
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
98
|
+
Component,
|
|
99
|
+
{
|
|
100
|
+
instance,
|
|
101
|
+
instanceSelector,
|
|
102
|
+
getComponent,
|
|
103
|
+
children
|
|
104
|
+
},
|
|
105
|
+
instance.id
|
|
106
|
+
);
|
|
103
107
|
};
|
|
@@ -56,7 +56,10 @@ const polyfill = function() {
|
|
|
56
56
|
});
|
|
57
57
|
}
|
|
58
58
|
}.toString();
|
|
59
|
-
const SessionStoragePolyfill = () => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
})
|
|
59
|
+
const SessionStoragePolyfill = () => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
60
|
+
"script",
|
|
61
|
+
{
|
|
62
|
+
dangerouslySetInnerHTML: { __html: `(${polyfill})()` },
|
|
63
|
+
suppressHydrationWarning: true
|
|
64
|
+
}
|
|
65
|
+
);
|
|
@@ -30,12 +30,10 @@ var import_react = require("react");
|
|
|
30
30
|
var import_props = require("../props");
|
|
31
31
|
const renderText = (text) => {
|
|
32
32
|
const lines = text.split("\n");
|
|
33
|
-
return lines.map((line, index) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react.Fragment, {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
]
|
|
38
|
-
}, index));
|
|
33
|
+
return lines.map((line, index) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react.Fragment, { children: [
|
|
34
|
+
line,
|
|
35
|
+
index < lines.length - 1 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("br", {}) : null
|
|
36
|
+
] }, index));
|
|
39
37
|
};
|
|
40
38
|
const renderWebstudioComponentChildren = (children) => {
|
|
41
39
|
if (children === void 0 || children.length === 0) {
|
|
@@ -62,10 +60,7 @@ const WebstudioComponent = ({
|
|
|
62
60
|
if (Component === void 0) {
|
|
63
61
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {});
|
|
64
62
|
}
|
|
65
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Component, {
|
|
66
|
-
...props,
|
|
67
|
-
children: renderWebstudioComponentChildren(children)
|
|
68
|
-
});
|
|
63
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Component, { ...props, children: renderWebstudioComponentChildren(children) });
|
|
69
64
|
};
|
|
70
65
|
const idAttribute = "data-ws-id";
|
|
71
66
|
const componentAttribute = "data-ws-component";
|
package/lib/components/body.js
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef } from "react";
|
|
3
3
|
const defaultTag = "body";
|
|
4
|
-
const Body = forwardRef((props, ref) => /* @__PURE__ */ jsx("body", {
|
|
5
|
-
...props,
|
|
6
|
-
ref
|
|
7
|
-
}));
|
|
4
|
+
const Body = forwardRef((props, ref) => /* @__PURE__ */ jsx("body", { ...props, ref }));
|
|
8
5
|
Body.displayName = "Body";
|
|
9
6
|
export {
|
|
10
7
|
Body
|
package/lib/components/bold.js
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef } from "react";
|
|
3
3
|
const defaultTag = "b";
|
|
4
|
-
const Bold = forwardRef((props, ref) => /* @__PURE__ */ jsx("b", {
|
|
5
|
-
...props,
|
|
6
|
-
ref
|
|
7
|
-
}));
|
|
4
|
+
const Bold = forwardRef((props, ref) => /* @__PURE__ */ jsx("b", { ...props, ref }));
|
|
8
5
|
Bold.displayName = "Bold";
|
|
9
6
|
export {
|
|
10
7
|
Bold
|
package/lib/components/box.ws.js
CHANGED
package/lib/components/button.js
CHANGED
|
@@ -7,12 +7,7 @@ const Button = forwardRef(
|
|
|
7
7
|
innerText = "Edit Inner Text in Properties",
|
|
8
8
|
children,
|
|
9
9
|
...props
|
|
10
|
-
}, ref) => /* @__PURE__ */ jsx("button", {
|
|
11
|
-
type,
|
|
12
|
-
...props,
|
|
13
|
-
ref,
|
|
14
|
-
children: children ? children : innerText
|
|
15
|
-
})
|
|
10
|
+
}, ref) => /* @__PURE__ */ jsx("button", { type, ...props, ref, children: children ? children : innerText })
|
|
16
11
|
);
|
|
17
12
|
Button.displayName = "Button";
|
|
18
13
|
export {
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { PropMeta } from "@webstudio-is/generate-arg-types";
|
|
3
|
+
const WsComponentPropsMeta = z.object({
|
|
4
|
+
props: z.record(PropMeta),
|
|
5
|
+
initialProps: z.array(z.string()).optional()
|
|
6
|
+
});
|
|
7
|
+
const componentCategories = [
|
|
8
|
+
"general",
|
|
9
|
+
"typography",
|
|
10
|
+
"media",
|
|
11
|
+
"forms"
|
|
12
|
+
];
|
|
13
|
+
const WsComponentMeta = z.object({
|
|
14
|
+
category: z.enum(componentCategories).optional(),
|
|
15
|
+
// container - can accept other components with dnd
|
|
16
|
+
// control - usually form controls like inputs, without children
|
|
17
|
+
// embed - images, videos or other embeddable components, without children
|
|
18
|
+
// rich-text - editable text component
|
|
19
|
+
// rich-text-child - formatted text fragment, not listed in components list
|
|
20
|
+
type: z.enum([
|
|
21
|
+
"container",
|
|
22
|
+
"control",
|
|
23
|
+
"embed",
|
|
24
|
+
"rich-text",
|
|
25
|
+
"rich-text-child"
|
|
26
|
+
]),
|
|
27
|
+
label: z.string(),
|
|
28
|
+
Icon: z.function(),
|
|
29
|
+
presetStyle: z.optional(z.any()),
|
|
30
|
+
children: z.optional(z.array(z.string()))
|
|
31
|
+
});
|
|
32
|
+
export {
|
|
33
|
+
componentCategories
|
|
34
|
+
};
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { Slot } from "./slot";
|
|
2
|
+
import { Fragment } from "./fragment";
|
|
1
3
|
import { Body } from "./body";
|
|
2
4
|
import { Box } from "./box";
|
|
3
5
|
import { TextBlock } from "./text-block";
|
|
@@ -28,6 +30,7 @@ export {
|
|
|
28
30
|
Button,
|
|
29
31
|
Code,
|
|
30
32
|
Form,
|
|
33
|
+
Fragment,
|
|
31
34
|
Heading,
|
|
32
35
|
Image,
|
|
33
36
|
Input,
|
|
@@ -39,6 +42,7 @@ export {
|
|
|
39
42
|
Paragraph,
|
|
40
43
|
RichTextLink,
|
|
41
44
|
Separator,
|
|
45
|
+
Slot,
|
|
42
46
|
Span,
|
|
43
47
|
Subscript,
|
|
44
48
|
Superscript,
|