@webstudio-is/react-sdk 0.49.0 → 0.51.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 +11 -13
- package/lib/app/custom-components/shared/remix-link.js +7 -24
- package/lib/app/handle-request.server.js +1 -4
- package/lib/app/root.js +11 -29
- package/lib/cjs/app/custom-components/image.cjs +10 -12
- package/lib/cjs/app/custom-components/shared/remix-link.cjs +6 -23
- 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__/link-block.props.cjs +5 -5
- package/lib/cjs/components/__generated__/link.props.cjs +6 -6
- package/lib/cjs/components/__generated__/rich-text-link.props.cjs +5 -5
- 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 +7 -2
- package/lib/cjs/components/link.cjs +10 -7
- package/lib/cjs/components/link.ws.cjs +9 -1
- 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 +7 -3
- 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/context.cjs +2 -1
- package/lib/cjs/css/categories.cjs +6 -0
- package/lib/cjs/index.cjs +2 -0
- package/lib/cjs/props.cjs +43 -2
- package/lib/cjs/pubsub/create.cjs +13 -0
- package/lib/cjs/tree/create-elements-tree.cjs +33 -22
- package/lib/cjs/tree/root.cjs +1 -0
- 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__/link-block.props.js +5 -5
- package/lib/components/__generated__/link.props.js +6 -6
- package/lib/components/__generated__/rich-text-link.props.js +5 -5
- 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 +7 -2
- package/lib/components/link.js +10 -7
- package/lib/components/link.ws.js +9 -1
- 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 +8 -4
- 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/context.js +2 -1
- package/lib/css/categories.js +6 -0
- package/lib/index.js +4 -0
- package/lib/props.js +43 -2
- package/lib/pubsub/create.js +9 -0
- package/lib/tree/create-elements-tree.js +33 -22
- package/lib/tree/root.js +1 -0
- 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/image.tsx +4 -7
- package/src/app/custom-components/index.ts +1 -1
- package/src/app/custom-components/shared/remix-link.tsx +12 -48
- package/src/components/__generated__/fragment.props.ts +3 -0
- package/src/components/__generated__/link-block.props.ts +5 -5
- package/src/components/__generated__/link.props.ts +6 -6
- package/src/components/__generated__/rich-text-link.props.ts +5 -5
- 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 +8 -3
- package/src/components/link.tsx +12 -6
- package/src/components/link.ws.tsx +10 -2
- 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 +10 -5
- 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/context.tsx +3 -1
- package/src/index.ts +5 -4
- package/src/props.test.ts +95 -0
- package/src/props.ts +59 -3
- package/src/tree/create-elements-tree.tsx +30 -12
- package/src/tree/root.ts +2 -0
- package/src/tree/webstudio-component.tsx +1 -0
- package/lib/components/component-type.js +0 -20
|
@@ -0,0 +1,32 @@
|
|
|
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 fragment_ws_exports = {};
|
|
20
|
+
__export(fragment_ws_exports, {
|
|
21
|
+
meta: () => meta,
|
|
22
|
+
propsMeta: () => propsMeta
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(fragment_ws_exports);
|
|
25
|
+
const meta = {
|
|
26
|
+
type: "container",
|
|
27
|
+
label: "Fragment",
|
|
28
|
+
Icon: () => null
|
|
29
|
+
};
|
|
30
|
+
const propsMeta = {
|
|
31
|
+
props: {}
|
|
32
|
+
};
|
|
@@ -25,6 +25,7 @@ module.exports = __toCommonJS(heading_ws_exports);
|
|
|
25
25
|
var import_icons = require("@webstudio-is/icons");
|
|
26
26
|
var import_heading = require("./__generated__/heading.props");
|
|
27
27
|
const meta = {
|
|
28
|
+
category: "typography",
|
|
28
29
|
type: "rich-text",
|
|
29
30
|
label: "Heading",
|
|
30
31
|
Icon: import_icons.HeadingIcon,
|
|
@@ -26,11 +26,14 @@ var import_react = require("react");
|
|
|
26
26
|
const defaultTag = "img";
|
|
27
27
|
const Image = (0, import_react.forwardRef)(
|
|
28
28
|
(imageProps, ref) => {
|
|
29
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
29
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
30
|
+
"img",
|
|
31
|
+
{
|
|
32
|
+
...imageProps,
|
|
33
|
+
src: imageProps.src || imagePlaceholderSvg,
|
|
34
|
+
ref
|
|
35
|
+
}
|
|
36
|
+
);
|
|
34
37
|
}
|
|
35
38
|
);
|
|
36
39
|
Image.defaultProps = {
|
|
@@ -25,17 +25,21 @@ module.exports = __toCommonJS(image_ws_exports);
|
|
|
25
25
|
var import_icons = require("@webstudio-is/icons");
|
|
26
26
|
var import_image = require("./__generated__/image.props");
|
|
27
27
|
const presetStyle = {
|
|
28
|
+
// Otherwise on new image insert onto canvas it can overfit screen size multiple times
|
|
28
29
|
maxWidth: {
|
|
29
30
|
type: "unit",
|
|
30
31
|
unit: "%",
|
|
31
32
|
value: 100
|
|
32
33
|
},
|
|
34
|
+
// inline | inline-block is not suitable because without line-height: 0 on the parent you get unsuitable spaces/margins
|
|
35
|
+
// see https://stackoverflow.com/questions/24771194/is-the-margin-of-inline-block-4px-is-static-for-all-browsers
|
|
33
36
|
display: {
|
|
34
37
|
type: "keyword",
|
|
35
38
|
value: "block"
|
|
36
39
|
}
|
|
37
40
|
};
|
|
38
41
|
const meta = {
|
|
42
|
+
category: "media",
|
|
39
43
|
type: "embed",
|
|
40
44
|
label: "Image",
|
|
41
45
|
Icon: import_icons.ImageIcon,
|
|
@@ -27,6 +27,8 @@ __export(components_exports, {
|
|
|
27
27
|
});
|
|
28
28
|
module.exports = __toCommonJS(components_exports);
|
|
29
29
|
var import_generate_arg_types = require("@webstudio-is/generate-arg-types");
|
|
30
|
+
var import_slot = require("./slot.ws");
|
|
31
|
+
var import_fragment = require("./fragment.ws");
|
|
30
32
|
var import_body = require("./body.ws");
|
|
31
33
|
var import_box = require("./box.ws");
|
|
32
34
|
var import_text_block = require("./text-block.ws");
|
|
@@ -49,6 +51,8 @@ var import_list = require("./list.ws");
|
|
|
49
51
|
var import_list_item = require("./list-item.ws");
|
|
50
52
|
var import_separator = require("./separator.ws");
|
|
51
53
|
var import_code = require("./code.ws");
|
|
54
|
+
var import_slot2 = require("./slot.ws");
|
|
55
|
+
var import_fragment2 = require("./fragment.ws");
|
|
52
56
|
var import_body2 = require("./body.ws");
|
|
53
57
|
var import_box2 = require("./box.ws");
|
|
54
58
|
var import_text_block2 = require("./text-block.ws");
|
|
@@ -72,6 +76,8 @@ var import_list_item2 = require("./list-item.ws");
|
|
|
72
76
|
var import_separator2 = require("./separator.ws");
|
|
73
77
|
var import_code2 = require("./code.ws");
|
|
74
78
|
const defaultMetas = {
|
|
79
|
+
Slot: import_slot.meta,
|
|
80
|
+
Fragment: import_fragment.meta,
|
|
75
81
|
Box: import_box.meta,
|
|
76
82
|
Body: import_body.meta,
|
|
77
83
|
TextBlock: import_text_block.meta,
|
|
@@ -107,6 +113,8 @@ const registerComponentMetas = (overrides) => {
|
|
|
107
113
|
currentMetas = result;
|
|
108
114
|
};
|
|
109
115
|
const defaultPropsMetasRaw = {
|
|
116
|
+
Slot: import_slot2.propsMeta,
|
|
117
|
+
Fragment: import_fragment2.propsMeta,
|
|
110
118
|
Box: import_box2.propsMeta,
|
|
111
119
|
Body: import_body2.propsMeta,
|
|
112
120
|
TextBlock: import_text_block2.propsMeta,
|
|
@@ -24,8 +24,5 @@ module.exports = __toCommonJS(input_exports);
|
|
|
24
24
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
25
25
|
var import_react = require("react");
|
|
26
26
|
const defaultTag = "input";
|
|
27
|
-
const Input = (0, import_react.forwardRef)(({ children: _children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", {
|
|
28
|
-
...props,
|
|
29
|
-
ref
|
|
30
|
-
}));
|
|
27
|
+
const Input = (0, import_react.forwardRef)(({ children: _children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { ...props, ref }));
|
|
31
28
|
Input.displayName = "Input";
|
|
@@ -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";
|
|
@@ -24,6 +24,7 @@ __export(link_block_ws_exports, {
|
|
|
24
24
|
module.exports = __toCommonJS(link_block_ws_exports);
|
|
25
25
|
var import_icons = require("@webstudio-is/icons");
|
|
26
26
|
var import_link_block = require("./__generated__/link-block.props");
|
|
27
|
+
var import_link = require("./link.ws");
|
|
27
28
|
const presetStyle = {
|
|
28
29
|
boxSizing: {
|
|
29
30
|
type: "keyword",
|
|
@@ -35,12 +36,16 @@ const presetStyle = {
|
|
|
35
36
|
}
|
|
36
37
|
};
|
|
37
38
|
const meta = {
|
|
39
|
+
category: "general",
|
|
38
40
|
type: "container",
|
|
39
41
|
label: "Link Block",
|
|
40
42
|
Icon: import_icons.BoxLinkIcon,
|
|
41
43
|
presetStyle
|
|
42
44
|
};
|
|
43
45
|
const propsMeta = {
|
|
44
|
-
props:
|
|
45
|
-
|
|
46
|
+
props: {
|
|
47
|
+
...import_link_block.props,
|
|
48
|
+
href: import_link.propsMeta.props.href
|
|
49
|
+
},
|
|
50
|
+
initialProps: import_link.propsMeta.initialProps
|
|
46
51
|
};
|
|
@@ -23,13 +23,16 @@ __export(link_exports, {
|
|
|
23
23
|
module.exports = __toCommonJS(link_exports);
|
|
24
24
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
25
25
|
var import_react = require("react");
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
var import_props = require("../props");
|
|
27
|
+
const Link = (0, import_react.forwardRef)((props, ref) => {
|
|
28
|
+
const href = (0, import_props.usePropUrl)((0, import_props.getInstanceIdFromComponentProps)(props), "href");
|
|
29
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
30
|
+
"a",
|
|
31
|
+
{
|
|
29
32
|
...props,
|
|
30
|
-
href,
|
|
33
|
+
href: typeof href === "string" ? href : href?.path,
|
|
31
34
|
ref
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
);
|
|
35
|
+
}
|
|
36
|
+
);
|
|
37
|
+
});
|
|
35
38
|
Link.displayName = "Link";
|
|
@@ -36,6 +36,7 @@ const presetStyle = {
|
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
38
|
const meta = {
|
|
39
|
+
category: "general",
|
|
39
40
|
type: "rich-text",
|
|
40
41
|
label: "Link Text",
|
|
41
42
|
Icon: import_icons.Link2Icon,
|
|
@@ -43,6 +44,13 @@ const meta = {
|
|
|
43
44
|
children: ["Link text you can edit"]
|
|
44
45
|
};
|
|
45
46
|
const propsMeta = {
|
|
46
|
-
props:
|
|
47
|
+
props: {
|
|
48
|
+
...import_link.props,
|
|
49
|
+
href: {
|
|
50
|
+
type: "string",
|
|
51
|
+
control: "url",
|
|
52
|
+
required: false
|
|
53
|
+
}
|
|
54
|
+
},
|
|
47
55
|
initialProps: ["href", "target", "prefetch"]
|
|
48
56
|
};
|
|
@@ -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,12 +24,16 @@ __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
|
};
|
|
32
33
|
const propsMeta = {
|
|
33
|
-
|
|
34
|
-
props:
|
|
34
|
+
initialProps: import_link.propsMeta.initialProps,
|
|
35
|
+
props: {
|
|
36
|
+
...import_rich_text_link.props,
|
|
37
|
+
href: import_link.propsMeta.props.href
|
|
38
|
+
}
|
|
35
39
|
};
|
|
@@ -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";
|
package/lib/cjs/context.cjs
CHANGED
|
@@ -25,5 +25,6 @@ var import_nanostores = require("nanostores");
|
|
|
25
25
|
var import_react = require("react");
|
|
26
26
|
const ReactSdkContext = (0, import_react.createContext)({
|
|
27
27
|
propsByInstanceIdStore: (0, import_nanostores.atom)(/* @__PURE__ */ new Map()),
|
|
28
|
-
assetsStore: (0, import_nanostores.atom)(/* @__PURE__ */ new Map())
|
|
28
|
+
assetsStore: (0, import_nanostores.atom)(/* @__PURE__ */ new Map()),
|
|
29
|
+
pagesStore: (0, import_nanostores.atom)(/* @__PURE__ */ new Map())
|
|
29
30
|
});
|
|
@@ -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");
|
package/lib/cjs/props.cjs
CHANGED
|
@@ -18,15 +18,19 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
var props_exports = {};
|
|
20
20
|
__export(props_exports, {
|
|
21
|
+
getInstanceIdFromComponentProps: () => getInstanceIdFromComponentProps,
|
|
21
22
|
getPropsByInstanceId: () => getPropsByInstanceId,
|
|
23
|
+
resolveUrlProp: () => resolveUrlProp,
|
|
22
24
|
useInstanceProps: () => useInstanceProps,
|
|
23
|
-
usePropAsset: () => usePropAsset
|
|
25
|
+
usePropAsset: () => usePropAsset,
|
|
26
|
+
usePropUrl: () => usePropUrl
|
|
24
27
|
});
|
|
25
28
|
module.exports = __toCommonJS(props_exports);
|
|
26
29
|
var import_react = require("react");
|
|
27
30
|
var import_nanostores = require("nanostores");
|
|
28
31
|
var import_react2 = require("@nanostores/react");
|
|
29
32
|
var import_context = require("./context");
|
|
33
|
+
var import_webstudio_component = require("./tree/webstudio-component");
|
|
30
34
|
const getPropsByInstanceId = (props) => {
|
|
31
35
|
const propsByInstanceId = /* @__PURE__ */ new Map();
|
|
32
36
|
for (const prop of props.values()) {
|
|
@@ -61,7 +65,7 @@ const usePropAsset = (instanceId, name) => {
|
|
|
61
65
|
(propsByInstanceId, assets) => {
|
|
62
66
|
const instanceProps = propsByInstanceId.get(instanceId);
|
|
63
67
|
if (instanceProps === void 0) {
|
|
64
|
-
return
|
|
68
|
+
return;
|
|
65
69
|
}
|
|
66
70
|
for (const prop of instanceProps) {
|
|
67
71
|
if (prop.type === "asset" && prop.name === name) {
|
|
@@ -75,3 +79,40 @@ const usePropAsset = (instanceId, name) => {
|
|
|
75
79
|
const asset = (0, import_react2.useStore)(assetStore);
|
|
76
80
|
return asset;
|
|
77
81
|
};
|
|
82
|
+
const resolveUrlProp = (instanceId, name, propsByInstanceId, pages) => {
|
|
83
|
+
const instanceProps = propsByInstanceId.get(instanceId);
|
|
84
|
+
if (instanceProps === void 0) {
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
for (const prop of instanceProps) {
|
|
88
|
+
if (prop.name !== name) {
|
|
89
|
+
continue;
|
|
90
|
+
}
|
|
91
|
+
if (prop.type === "page") {
|
|
92
|
+
return pages.get(prop.value);
|
|
93
|
+
}
|
|
94
|
+
if (prop.type === "string") {
|
|
95
|
+
for (const page of pages.values()) {
|
|
96
|
+
if (page.path === prop.value) {
|
|
97
|
+
return page;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
return prop.value;
|
|
101
|
+
}
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
const usePropUrl = (instanceId, name) => {
|
|
106
|
+
const { propsByInstanceIdStore, pagesStore } = (0, import_react.useContext)(import_context.ReactSdkContext);
|
|
107
|
+
const pageStore = (0, import_react.useMemo)(
|
|
108
|
+
() => (0, import_nanostores.computed)(
|
|
109
|
+
[propsByInstanceIdStore, pagesStore],
|
|
110
|
+
(propsByInstanceId, pages) => resolveUrlProp(instanceId, name, propsByInstanceId, pages)
|
|
111
|
+
),
|
|
112
|
+
[propsByInstanceIdStore, pagesStore, instanceId, name]
|
|
113
|
+
);
|
|
114
|
+
return (0, import_react2.useStore)(pageStore);
|
|
115
|
+
};
|
|
116
|
+
const getInstanceIdFromComponentProps = (props) => {
|
|
117
|
+
return props[import_webstudio_component.idAttribute];
|
|
118
|
+
};
|
|
@@ -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);
|