@webstudio-is/react-sdk 0.66.0 → 0.67.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/index.js +4 -1
- package/lib/cjs/app/custom-components/index.js +4 -1
- package/lib/cjs/components/__generated__/{code.props.js → code-text.props.js} +3 -3
- package/lib/cjs/components/__generated__/{html.props.js → html-embed.props.js} +4 -4
- package/lib/cjs/components/{code.js → code-text.js} +6 -6
- package/lib/cjs/components/{code.ws.js → code-text.ws.js} +9 -9
- package/lib/cjs/components/components.js +4 -4
- package/lib/cjs/components/{html.js → html-embed.js} +9 -9
- package/lib/cjs/components/{html.ws.js → html-embed.ws.js} +7 -7
- package/lib/cjs/components/index.js +8 -8
- package/lib/components/__generated__/{html.props.js → html-embed.props.js} +1 -1
- package/lib/components/{code.js → code-text.js} +3 -3
- package/lib/components/{code.ws.js → code-text.ws.js} +5 -5
- package/lib/components/components.js +4 -4
- package/lib/components/{html.js → html-embed.js} +6 -6
- package/lib/components/{html.ws.js → html-embed.ws.js} +4 -4
- package/lib/components/index.js +8 -8
- package/lib/types/components/{code.d.ts → code-text.d.ts} +1 -1
- package/lib/types/components/{code.stories.d.ts → code-text.stories.d.ts} +1 -1
- package/lib/types/components/components.d.ts +2 -2
- package/lib/types/components/html-embed.d.ts +7 -0
- package/lib/types/components/{html.stories.d.ts → html-embed.stories.d.ts} +3 -3
- package/lib/types/css/style-rules.d.ts +1 -1
- package/lib/types/embed-template.d.ts +1 -1
- package/package.json +13 -13
- package/src/app/custom-components/index.ts +4 -1
- package/src/components/__generated__/{html.props.ts → html-embed.props.ts} +1 -1
- package/src/components/code-text.stories.tsx +16 -0
- package/src/components/{code.tsx → code-text.tsx} +2 -2
- package/src/components/{code.ws.tsx → code-text.ws.tsx} +5 -5
- package/src/components/components.ts +2 -2
- package/src/components/html-embed.stories.tsx +16 -0
- package/src/components/{html.tsx → html-embed.tsx} +6 -6
- package/src/components/{html.ws.ts → html-embed.ws.ts} +4 -4
- package/src/components/index.ts +8 -8
- package/lib/types/components/html.d.ts +0 -7
- package/src/components/code.stories.tsx +0 -16
- package/src/components/html.stories.tsx +0 -16
- /package/lib/components/__generated__/{code.props.js → code-text.props.js} +0 -0
- /package/lib/types/components/__generated__/{code.props.d.ts → code-text.props.d.ts} +0 -0
- /package/lib/types/components/__generated__/{html.props.d.ts → html-embed.props.d.ts} +0 -0
- /package/lib/types/components/{code.ws.d.ts → code-text.ws.d.ts} +0 -0
- /package/lib/types/components/{html.ws.d.ts → html-embed.ws.d.ts} +0 -0
- /package/src/components/__generated__/{code.props.ts → code-text.props.ts} +0 -0
|
@@ -13,7 +13,10 @@ const customComponents = {
|
|
|
13
13
|
Form
|
|
14
14
|
};
|
|
15
15
|
const customComponentPropsMetas = {
|
|
16
|
-
Image: {
|
|
16
|
+
Image: {
|
|
17
|
+
props: imageProps,
|
|
18
|
+
initialProps: ["src", "width", "height", "alt", "loading"]
|
|
19
|
+
},
|
|
17
20
|
Form: formPropsMeta
|
|
18
21
|
};
|
|
19
22
|
const customComponentMetas = {
|
|
@@ -38,7 +38,10 @@ const customComponents = {
|
|
|
38
38
|
Form: import_form.Form
|
|
39
39
|
};
|
|
40
40
|
const customComponentPropsMetas = {
|
|
41
|
-
Image: {
|
|
41
|
+
Image: {
|
|
42
|
+
props: import_image.imageProps,
|
|
43
|
+
initialProps: ["src", "width", "height", "alt", "loading"]
|
|
44
|
+
},
|
|
42
45
|
Form: import_form2.propsMeta
|
|
43
46
|
};
|
|
44
47
|
const customComponentMetas = {
|
|
@@ -16,11 +16,11 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
return to;
|
|
17
17
|
};
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var
|
|
20
|
-
__export(
|
|
19
|
+
var code_text_props_exports = {};
|
|
20
|
+
__export(code_text_props_exports, {
|
|
21
21
|
props: () => props
|
|
22
22
|
});
|
|
23
|
-
module.exports = __toCommonJS(
|
|
23
|
+
module.exports = __toCommonJS(code_text_props_exports);
|
|
24
24
|
const props = {
|
|
25
25
|
meta: { required: false, control: "text", type: "string" },
|
|
26
26
|
slot: { required: false, control: "text", type: "string" },
|
|
@@ -16,14 +16,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
return to;
|
|
17
17
|
};
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var
|
|
20
|
-
__export(
|
|
19
|
+
var html_embed_props_exports = {};
|
|
20
|
+
__export(html_embed_props_exports, {
|
|
21
21
|
props: () => props
|
|
22
22
|
});
|
|
23
|
-
module.exports = __toCommonJS(
|
|
23
|
+
module.exports = __toCommonJS(html_embed_props_exports);
|
|
24
24
|
const props = {
|
|
25
25
|
code: { required: true, control: "text", type: "string" },
|
|
26
|
-
|
|
26
|
+
executeScriptOnCanvas: {
|
|
27
27
|
required: true,
|
|
28
28
|
control: "boolean",
|
|
29
29
|
type: "boolean"
|
|
@@ -16,13 +16,13 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
return to;
|
|
17
17
|
};
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var
|
|
20
|
-
__export(
|
|
21
|
-
|
|
19
|
+
var code_text_exports = {};
|
|
20
|
+
__export(code_text_exports, {
|
|
21
|
+
CodeText: () => CodeText,
|
|
22
22
|
defaultTag: () => defaultTag,
|
|
23
23
|
displayVarNamespace: () => displayVarNamespace
|
|
24
24
|
});
|
|
25
|
-
module.exports = __toCommonJS(
|
|
25
|
+
module.exports = __toCommonJS(code_text_exports);
|
|
26
26
|
var import_react = require("react");
|
|
27
27
|
var import_css_vars = require("@webstudio-is/css-vars");
|
|
28
28
|
const defaultTag = "code";
|
|
@@ -30,10 +30,10 @@ const displayVarNamespace = import_css_vars.cssVars.unique("code-display");
|
|
|
30
30
|
const blockStyle = {
|
|
31
31
|
[import_css_vars.cssVars.define(displayVarNamespace, true)]: "block"
|
|
32
32
|
};
|
|
33
|
-
const
|
|
33
|
+
const CodeText = (0, import_react.forwardRef)(
|
|
34
34
|
({ inline = false, ...props }, ref) => {
|
|
35
35
|
const style = inline ? void 0 : blockStyle;
|
|
36
36
|
return (0, import_react.createElement)(defaultTag, { ...props, style, ref });
|
|
37
37
|
}
|
|
38
38
|
);
|
|
39
|
-
|
|
39
|
+
CodeText.displayName = "CodeText";
|
|
@@ -16,16 +16,16 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
return to;
|
|
17
17
|
};
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var
|
|
20
|
-
__export(
|
|
19
|
+
var code_text_ws_exports = {};
|
|
20
|
+
__export(code_text_ws_exports, {
|
|
21
21
|
meta: () => meta,
|
|
22
22
|
propsMeta: () => propsMeta
|
|
23
23
|
});
|
|
24
|
-
module.exports = __toCommonJS(
|
|
24
|
+
module.exports = __toCommonJS(code_text_ws_exports);
|
|
25
25
|
var import_svg = require("@webstudio-is/icons/svg");
|
|
26
26
|
var import_component_meta = require("./component-meta");
|
|
27
|
-
var
|
|
28
|
-
var
|
|
27
|
+
var import_code_text = require("./code-text");
|
|
28
|
+
var import_code_text2 = require("./__generated__/code-text.props");
|
|
29
29
|
var import_normalize = require("../css/normalize");
|
|
30
30
|
const presetStyle = {
|
|
31
31
|
code: [
|
|
@@ -34,7 +34,7 @@ const presetStyle = {
|
|
|
34
34
|
property: "display",
|
|
35
35
|
value: {
|
|
36
36
|
type: "var",
|
|
37
|
-
value:
|
|
37
|
+
value: import_code_text.displayVarNamespace,
|
|
38
38
|
fallbacks: [{ type: "keyword", value: "inline-block" }]
|
|
39
39
|
}
|
|
40
40
|
},
|
|
@@ -55,13 +55,13 @@ const presetStyle = {
|
|
|
55
55
|
const meta = {
|
|
56
56
|
category: "general",
|
|
57
57
|
type: "rich-text",
|
|
58
|
-
label: "Code",
|
|
59
|
-
icon: import_svg.
|
|
58
|
+
label: "Code Text",
|
|
59
|
+
icon: import_svg.CodeTextIcon,
|
|
60
60
|
states: import_component_meta.defaultStates,
|
|
61
61
|
presetStyle,
|
|
62
62
|
children: [{ type: "text", value: "Code you can edit" }]
|
|
63
63
|
};
|
|
64
64
|
const propsMeta = {
|
|
65
|
-
props:
|
|
65
|
+
props: import_code_text2.props,
|
|
66
66
|
initialProps: ["inline", "lang", "meta"]
|
|
67
67
|
};
|
|
@@ -25,12 +25,12 @@ __export(components_exports, {
|
|
|
25
25
|
Button: () => import_button.Button,
|
|
26
26
|
Checkbox: () => import_checkbox.Checkbox,
|
|
27
27
|
CheckboxField: () => import_checkbox_field.CheckboxField,
|
|
28
|
-
|
|
28
|
+
CodeText: () => import_code_text.CodeText,
|
|
29
29
|
ErrorMessage: () => import_error_message.ErrorMessage,
|
|
30
30
|
Form: () => import_form.Form,
|
|
31
31
|
Fragment: () => import_fragment.Fragment,
|
|
32
32
|
Heading: () => import_heading.Heading,
|
|
33
|
-
|
|
33
|
+
HtmlEmbed: () => import_html_embed.HtmlEmbed,
|
|
34
34
|
Image: () => import_image.Image,
|
|
35
35
|
Input: () => import_input.Input,
|
|
36
36
|
Italic: () => import_italic.Italic,
|
|
@@ -55,7 +55,7 @@ __export(components_exports, {
|
|
|
55
55
|
module.exports = __toCommonJS(components_exports);
|
|
56
56
|
var import_slot = require("./slot");
|
|
57
57
|
var import_fragment = require("./fragment");
|
|
58
|
-
var
|
|
58
|
+
var import_html_embed = require("./html-embed");
|
|
59
59
|
var import_body = require("./body");
|
|
60
60
|
var import_box = require("./box");
|
|
61
61
|
var import_text_block = require("./text-block");
|
|
@@ -77,7 +77,7 @@ var import_blockquote = require("./blockquote");
|
|
|
77
77
|
var import_list = require("./list");
|
|
78
78
|
var import_list_item = require("./list-item");
|
|
79
79
|
var import_separator = require("./separator");
|
|
80
|
-
var
|
|
80
|
+
var import_code_text = require("./code-text");
|
|
81
81
|
var import_label = require("./label");
|
|
82
82
|
var import_success_message = require("./success-message");
|
|
83
83
|
var import_error_message = require("./error-message");
|
|
@@ -16,11 +16,11 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
return to;
|
|
17
17
|
};
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var
|
|
20
|
-
__export(
|
|
21
|
-
|
|
19
|
+
var html_embed_exports = {};
|
|
20
|
+
__export(html_embed_exports, {
|
|
21
|
+
HtmlEmbed: () => HtmlEmbed
|
|
22
22
|
});
|
|
23
|
-
module.exports = __toCommonJS(
|
|
23
|
+
module.exports = __toCommonJS(html_embed_exports);
|
|
24
24
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
25
25
|
var import_react = require("react");
|
|
26
26
|
var import_utils = require("@react-aria/utils");
|
|
@@ -64,17 +64,17 @@ const InnerHtml = (props) => {
|
|
|
64
64
|
};
|
|
65
65
|
const Placeholder = (props) => {
|
|
66
66
|
const { code, innerRef, ...rest } = props;
|
|
67
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { ref: innerRef, ...rest, style: { padding: "20px" }, children: '
|
|
67
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { ref: innerRef, ...rest, style: { padding: "20px" }, children: 'Open "Properties" panel to insert HTML code' });
|
|
68
68
|
};
|
|
69
|
-
const
|
|
69
|
+
const HtmlEmbed = (0, import_react.forwardRef)((props, ref) => {
|
|
70
70
|
const { renderer } = (0, import_react.useContext)(import_context.ReactSdkContext);
|
|
71
|
-
const { code,
|
|
71
|
+
const { code, executeScriptOnCanvas, ...rest } = props;
|
|
72
72
|
if (code === void 0 || code.trim().length === 0) {
|
|
73
73
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Placeholder, { innerRef: ref, ...rest });
|
|
74
74
|
}
|
|
75
|
-
if (renderer === "canvas" &&
|
|
75
|
+
if (renderer === "canvas" && executeScriptOnCanvas === true) {
|
|
76
76
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ExecutableHtml, { innerRef: ref, code, ...rest });
|
|
77
77
|
}
|
|
78
78
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(InnerHtml, { innerRef: ref, code, ...rest });
|
|
79
79
|
});
|
|
80
|
-
|
|
80
|
+
HtmlEmbed.displayName = "HtmlEmbed";
|
|
@@ -16,23 +16,23 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
return to;
|
|
17
17
|
};
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var
|
|
20
|
-
__export(
|
|
19
|
+
var html_embed_ws_exports = {};
|
|
20
|
+
__export(html_embed_ws_exports, {
|
|
21
21
|
meta: () => meta,
|
|
22
22
|
propsMeta: () => propsMeta
|
|
23
23
|
});
|
|
24
|
-
module.exports = __toCommonJS(
|
|
24
|
+
module.exports = __toCommonJS(html_embed_ws_exports);
|
|
25
25
|
var import_svg = require("@webstudio-is/icons/svg");
|
|
26
|
-
var
|
|
26
|
+
var import_html_embed = require("./__generated__/html-embed.props");
|
|
27
27
|
const meta = {
|
|
28
28
|
category: "general",
|
|
29
29
|
type: "embed",
|
|
30
|
-
label: "
|
|
31
|
-
icon: import_svg.
|
|
30
|
+
label: "HTML Embed",
|
|
31
|
+
icon: import_svg.EmbedIcon
|
|
32
32
|
};
|
|
33
33
|
const propsMeta = {
|
|
34
34
|
props: {
|
|
35
|
-
...
|
|
35
|
+
...import_html_embed.props,
|
|
36
36
|
code: {
|
|
37
37
|
required: true,
|
|
38
38
|
control: "code",
|
|
@@ -29,7 +29,7 @@ __export(components_exports, {
|
|
|
29
29
|
module.exports = __toCommonJS(components_exports);
|
|
30
30
|
var import_slot = require("./slot.ws");
|
|
31
31
|
var import_fragment = require("./fragment.ws");
|
|
32
|
-
var
|
|
32
|
+
var import_html_embed = require("./html-embed.ws");
|
|
33
33
|
var import_body = require("./body.ws");
|
|
34
34
|
var import_box = require("./box.ws");
|
|
35
35
|
var import_text_block = require("./text-block.ws");
|
|
@@ -51,7 +51,7 @@ var import_blockquote = require("./blockquote.ws");
|
|
|
51
51
|
var import_list = require("./list.ws");
|
|
52
52
|
var import_list_item = require("./list-item.ws");
|
|
53
53
|
var import_separator = require("./separator.ws");
|
|
54
|
-
var
|
|
54
|
+
var import_code_text = require("./code-text.ws");
|
|
55
55
|
var import_label = require("./label.ws");
|
|
56
56
|
var import_success_message = require("./success-message.ws");
|
|
57
57
|
var import_error_message = require("./error-message.ws");
|
|
@@ -62,7 +62,7 @@ var import_checkbox_field = require("./checkbox-field.ws");
|
|
|
62
62
|
var import_checkbox = require("./checkbox.ws");
|
|
63
63
|
var import_slot2 = require("./slot.ws");
|
|
64
64
|
var import_fragment2 = require("./fragment.ws");
|
|
65
|
-
var
|
|
65
|
+
var import_html_embed2 = require("./html-embed.ws");
|
|
66
66
|
var import_body2 = require("./body.ws");
|
|
67
67
|
var import_box2 = require("./box.ws");
|
|
68
68
|
var import_text_block2 = require("./text-block.ws");
|
|
@@ -84,7 +84,7 @@ var import_blockquote2 = require("./blockquote.ws");
|
|
|
84
84
|
var import_list2 = require("./list.ws");
|
|
85
85
|
var import_list_item2 = require("./list-item.ws");
|
|
86
86
|
var import_separator2 = require("./separator.ws");
|
|
87
|
-
var
|
|
87
|
+
var import_code_text2 = require("./code-text.ws");
|
|
88
88
|
var import_label2 = require("./label.ws");
|
|
89
89
|
var import_success_message2 = require("./success-message.ws");
|
|
90
90
|
var import_error_message2 = require("./error-message.ws");
|
|
@@ -96,7 +96,7 @@ var import_checkbox2 = require("./checkbox.ws");
|
|
|
96
96
|
const defaultMetas = {
|
|
97
97
|
Slot: import_slot.meta,
|
|
98
98
|
Fragment: import_fragment.meta,
|
|
99
|
-
|
|
99
|
+
HtmlEmbed: import_html_embed.meta,
|
|
100
100
|
Box: import_box.meta,
|
|
101
101
|
Body: import_body.meta,
|
|
102
102
|
TextBlock: import_text_block.meta,
|
|
@@ -118,7 +118,7 @@ const defaultMetas = {
|
|
|
118
118
|
List: import_list.meta,
|
|
119
119
|
ListItem: import_list_item.meta,
|
|
120
120
|
Separator: import_separator.meta,
|
|
121
|
-
|
|
121
|
+
CodeText: import_code_text.meta,
|
|
122
122
|
Label: import_label.meta,
|
|
123
123
|
SuccessMessage: import_success_message.meta,
|
|
124
124
|
ErrorMessage: import_error_message.meta,
|
|
@@ -142,7 +142,7 @@ const registerComponentMetas = (overrides) => {
|
|
|
142
142
|
const defaultPropsMetas = {
|
|
143
143
|
Slot: import_slot2.propsMeta,
|
|
144
144
|
Fragment: import_fragment2.propsMeta,
|
|
145
|
-
|
|
145
|
+
HtmlEmbed: import_html_embed2.propsMeta,
|
|
146
146
|
Box: import_box2.propsMeta,
|
|
147
147
|
Body: import_body2.propsMeta,
|
|
148
148
|
TextBlock: import_text_block2.propsMeta,
|
|
@@ -164,7 +164,7 @@ const defaultPropsMetas = {
|
|
|
164
164
|
List: import_list2.propsMeta,
|
|
165
165
|
ListItem: import_list_item2.propsMeta,
|
|
166
166
|
Separator: import_separator2.propsMeta,
|
|
167
|
-
|
|
167
|
+
CodeText: import_code_text2.propsMeta,
|
|
168
168
|
Label: import_label2.propsMeta,
|
|
169
169
|
SuccessMessage: import_success_message2.propsMeta,
|
|
170
170
|
ErrorMessage: import_error_message2.propsMeta,
|
|
@@ -8,15 +8,15 @@ const displayVarNamespace = cssVars.unique("code-display");
|
|
|
8
8
|
const blockStyle = {
|
|
9
9
|
[cssVars.define(displayVarNamespace, true)]: "block"
|
|
10
10
|
};
|
|
11
|
-
const
|
|
11
|
+
const CodeText = forwardRef(
|
|
12
12
|
({ inline = false, ...props }, ref) => {
|
|
13
13
|
const style = inline ? void 0 : blockStyle;
|
|
14
14
|
return createElement(defaultTag, { ...props, style, ref });
|
|
15
15
|
}
|
|
16
16
|
);
|
|
17
|
-
|
|
17
|
+
CodeText.displayName = "CodeText";
|
|
18
18
|
export {
|
|
19
|
-
|
|
19
|
+
CodeText,
|
|
20
20
|
defaultTag,
|
|
21
21
|
displayVarNamespace
|
|
22
22
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CodeTextIcon } from "@webstudio-is/icons/svg";
|
|
2
2
|
import {
|
|
3
3
|
defaultStates
|
|
4
4
|
} from "./component-meta";
|
|
5
|
-
import { displayVarNamespace } from "./code";
|
|
6
|
-
import { props } from "./__generated__/code.props";
|
|
5
|
+
import { displayVarNamespace } from "./code-text";
|
|
6
|
+
import { props } from "./__generated__/code-text.props";
|
|
7
7
|
import { code } from "../css/normalize";
|
|
8
8
|
const presetStyle = {
|
|
9
9
|
code: [
|
|
@@ -33,8 +33,8 @@ const presetStyle = {
|
|
|
33
33
|
const meta = {
|
|
34
34
|
category: "general",
|
|
35
35
|
type: "rich-text",
|
|
36
|
-
label: "Code",
|
|
37
|
-
icon:
|
|
36
|
+
label: "Code Text",
|
|
37
|
+
icon: CodeTextIcon,
|
|
38
38
|
states: defaultStates,
|
|
39
39
|
presetStyle,
|
|
40
40
|
children: [{ type: "text", value: "Code you can edit" }]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Slot } from "./slot";
|
|
2
2
|
import { Fragment } from "./fragment";
|
|
3
|
-
import {
|
|
3
|
+
import { HtmlEmbed } from "./html-embed";
|
|
4
4
|
import { Body } from "./body";
|
|
5
5
|
import { Box } from "./box";
|
|
6
6
|
import { TextBlock } from "./text-block";
|
|
@@ -22,7 +22,7 @@ import { Blockquote } from "./blockquote";
|
|
|
22
22
|
import { List } from "./list";
|
|
23
23
|
import { ListItem } from "./list-item";
|
|
24
24
|
import { Separator } from "./separator";
|
|
25
|
-
import {
|
|
25
|
+
import { CodeText } from "./code-text";
|
|
26
26
|
import { Label } from "./label";
|
|
27
27
|
import { SuccessMessage } from "./success-message";
|
|
28
28
|
import { ErrorMessage } from "./error-message";
|
|
@@ -39,12 +39,12 @@ export {
|
|
|
39
39
|
Button,
|
|
40
40
|
Checkbox,
|
|
41
41
|
CheckboxField,
|
|
42
|
-
|
|
42
|
+
CodeText,
|
|
43
43
|
ErrorMessage,
|
|
44
44
|
Form,
|
|
45
45
|
Fragment,
|
|
46
46
|
Heading,
|
|
47
|
-
|
|
47
|
+
HtmlEmbed,
|
|
48
48
|
Image,
|
|
49
49
|
Input,
|
|
50
50
|
Italic,
|
|
@@ -46,20 +46,20 @@ const InnerHtml = (props) => {
|
|
|
46
46
|
};
|
|
47
47
|
const Placeholder = (props) => {
|
|
48
48
|
const { code, innerRef, ...rest } = props;
|
|
49
|
-
return /* @__PURE__ */ jsx("div", { ref: innerRef, ...rest, style: { padding: "20px" }, children: '
|
|
49
|
+
return /* @__PURE__ */ jsx("div", { ref: innerRef, ...rest, style: { padding: "20px" }, children: 'Open "Properties" panel to insert HTML code' });
|
|
50
50
|
};
|
|
51
|
-
const
|
|
51
|
+
const HtmlEmbed = forwardRef((props, ref) => {
|
|
52
52
|
const { renderer } = useContext(ReactSdkContext);
|
|
53
|
-
const { code,
|
|
53
|
+
const { code, executeScriptOnCanvas, ...rest } = props;
|
|
54
54
|
if (code === void 0 || code.trim().length === 0) {
|
|
55
55
|
return /* @__PURE__ */ jsx(Placeholder, { innerRef: ref, ...rest });
|
|
56
56
|
}
|
|
57
|
-
if (renderer === "canvas" &&
|
|
57
|
+
if (renderer === "canvas" && executeScriptOnCanvas === true) {
|
|
58
58
|
return /* @__PURE__ */ jsx(ExecutableHtml, { innerRef: ref, code, ...rest });
|
|
59
59
|
}
|
|
60
60
|
return /* @__PURE__ */ jsx(InnerHtml, { innerRef: ref, code, ...rest });
|
|
61
61
|
});
|
|
62
|
-
|
|
62
|
+
HtmlEmbed.displayName = "HtmlEmbed";
|
|
63
63
|
export {
|
|
64
|
-
|
|
64
|
+
HtmlEmbed
|
|
65
65
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { props } from "./__generated__/html.props";
|
|
1
|
+
import { EmbedIcon } from "@webstudio-is/icons/svg";
|
|
2
|
+
import { props } from "./__generated__/html-embed.props";
|
|
3
3
|
const meta = {
|
|
4
4
|
category: "general",
|
|
5
5
|
type: "embed",
|
|
6
|
-
label: "
|
|
7
|
-
icon:
|
|
6
|
+
label: "HTML Embed",
|
|
7
|
+
icon: EmbedIcon
|
|
8
8
|
};
|
|
9
9
|
const propsMeta = {
|
|
10
10
|
props: {
|
package/lib/components/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { meta as SlotMeta } from "./slot.ws";
|
|
2
2
|
import { meta as FragmentMeta } from "./fragment.ws";
|
|
3
|
-
import { meta as
|
|
3
|
+
import { meta as HtmlEmbedMeta } from "./html-embed.ws";
|
|
4
4
|
import { meta as BodyMeta } from "./body.ws";
|
|
5
5
|
import { meta as BoxMeta } from "./box.ws";
|
|
6
6
|
import { meta as TextBlockMeta } from "./text-block.ws";
|
|
@@ -22,7 +22,7 @@ import { meta as BlockquoteMeta } from "./blockquote.ws";
|
|
|
22
22
|
import { meta as ListMeta } from "./list.ws";
|
|
23
23
|
import { meta as ListItemMeta } from "./list-item.ws";
|
|
24
24
|
import { meta as SeparatorMeta } from "./separator.ws";
|
|
25
|
-
import { meta as
|
|
25
|
+
import { meta as CodeTextMeta } from "./code-text.ws";
|
|
26
26
|
import { meta as LabelMeta } from "./label.ws";
|
|
27
27
|
import { meta as SuccessMessageMeta } from "./success-message.ws";
|
|
28
28
|
import { meta as ErrorMessageMeta } from "./error-message.ws";
|
|
@@ -33,7 +33,7 @@ import { meta as CheckboxFieldMeta } from "./checkbox-field.ws";
|
|
|
33
33
|
import { meta as CheckboxMeta } from "./checkbox.ws";
|
|
34
34
|
import { propsMeta as SlotMetaPropsMeta } from "./slot.ws";
|
|
35
35
|
import { propsMeta as FragmentMetaPropsMeta } from "./fragment.ws";
|
|
36
|
-
import { propsMeta as
|
|
36
|
+
import { propsMeta as HtmlEmbedMetaPropsMeta } from "./html-embed.ws";
|
|
37
37
|
import { propsMeta as BodyMetaPropsMeta } from "./body.ws";
|
|
38
38
|
import { propsMeta as BoxMetaPropsMeta } from "./box.ws";
|
|
39
39
|
import { propsMeta as TextBlockMetaPropsMeta } from "./text-block.ws";
|
|
@@ -55,7 +55,7 @@ import { propsMeta as BlockquotePropsMeta } from "./blockquote.ws";
|
|
|
55
55
|
import { propsMeta as ListPropsMeta } from "./list.ws";
|
|
56
56
|
import { propsMeta as ListItemPropsMeta } from "./list-item.ws";
|
|
57
57
|
import { propsMeta as SeparatorPropsMeta } from "./separator.ws";
|
|
58
|
-
import { propsMeta as
|
|
58
|
+
import { propsMeta as CodeTextPropsMeta } from "./code-text.ws";
|
|
59
59
|
import { propsMeta as LabelPropsMeta } from "./label.ws";
|
|
60
60
|
import { propsMeta as SuccessMessagePropsMeta } from "./success-message.ws";
|
|
61
61
|
import { propsMeta as ErrorMessagePropsMeta } from "./error-message.ws";
|
|
@@ -67,7 +67,7 @@ import { propsMeta as CheckboxPropsMeta } from "./checkbox.ws";
|
|
|
67
67
|
const defaultMetas = {
|
|
68
68
|
Slot: SlotMeta,
|
|
69
69
|
Fragment: FragmentMeta,
|
|
70
|
-
|
|
70
|
+
HtmlEmbed: HtmlEmbedMeta,
|
|
71
71
|
Box: BoxMeta,
|
|
72
72
|
Body: BodyMeta,
|
|
73
73
|
TextBlock: TextBlockMeta,
|
|
@@ -89,7 +89,7 @@ const defaultMetas = {
|
|
|
89
89
|
List: ListMeta,
|
|
90
90
|
ListItem: ListItemMeta,
|
|
91
91
|
Separator: SeparatorMeta,
|
|
92
|
-
|
|
92
|
+
CodeText: CodeTextMeta,
|
|
93
93
|
Label: LabelMeta,
|
|
94
94
|
SuccessMessage: SuccessMessageMeta,
|
|
95
95
|
ErrorMessage: ErrorMessageMeta,
|
|
@@ -113,7 +113,7 @@ const registerComponentMetas = (overrides) => {
|
|
|
113
113
|
const defaultPropsMetas = {
|
|
114
114
|
Slot: SlotMetaPropsMeta,
|
|
115
115
|
Fragment: FragmentMetaPropsMeta,
|
|
116
|
-
|
|
116
|
+
HtmlEmbed: HtmlEmbedMetaPropsMeta,
|
|
117
117
|
Box: BoxMetaPropsMeta,
|
|
118
118
|
Body: BodyMetaPropsMeta,
|
|
119
119
|
TextBlock: TextBlockMetaPropsMeta,
|
|
@@ -135,7 +135,7 @@ const defaultPropsMetas = {
|
|
|
135
135
|
List: ListPropsMeta,
|
|
136
136
|
ListItem: ListItemPropsMeta,
|
|
137
137
|
Separator: SeparatorPropsMeta,
|
|
138
|
-
|
|
138
|
+
CodeText: CodeTextPropsMeta,
|
|
139
139
|
Label: LabelPropsMeta,
|
|
140
140
|
SuccessMessage: SuccessMessagePropsMeta,
|
|
141
141
|
ErrorMessage: ErrorMessagePropsMeta,
|
|
@@ -5,5 +5,5 @@ type Props = Omit<ComponentProps<typeof defaultTag>, "inline"> & {
|
|
|
5
5
|
inline?: boolean;
|
|
6
6
|
meta?: string;
|
|
7
7
|
};
|
|
8
|
-
export declare const
|
|
8
|
+
export declare const CodeText: import("react").ForwardRefExoticComponent<Omit<Props, "ref"> & import("react").RefAttributes<HTMLElement>>;
|
|
9
9
|
export {};
|
|
@@ -5,7 +5,7 @@ declare const _default: ComponentMeta<import("react").ForwardRefExoticComponent<
|
|
|
5
5
|
meta?: string | undefined;
|
|
6
6
|
}, "ref"> & import("react").RefAttributes<HTMLElement>>>;
|
|
7
7
|
export default _default;
|
|
8
|
-
export declare const
|
|
8
|
+
export declare const CodeText: ComponentStory<import("react").ForwardRefExoticComponent<Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLElement>, HTMLElement>, "inline"> & {
|
|
9
9
|
inline?: boolean | undefined;
|
|
10
10
|
meta?: string | undefined;
|
|
11
11
|
}, "ref"> & import("react").RefAttributes<HTMLElement>>>;
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
export { Slot } from "./slot";
|
|
9
9
|
export { Fragment } from "./fragment";
|
|
10
|
-
export {
|
|
10
|
+
export { HtmlEmbed } from "./html-embed";
|
|
11
11
|
export { Body } from "./body";
|
|
12
12
|
export { Box } from "./box";
|
|
13
13
|
export { TextBlock } from "./text-block";
|
|
@@ -29,7 +29,7 @@ export { Blockquote } from "./blockquote";
|
|
|
29
29
|
export { List } from "./list";
|
|
30
30
|
export { ListItem } from "./list-item";
|
|
31
31
|
export { Separator } from "./separator";
|
|
32
|
-
export {
|
|
32
|
+
export { CodeText } from "./code-text";
|
|
33
33
|
export { Label } from "./label";
|
|
34
34
|
export { SuccessMessage } from "./success-message";
|
|
35
35
|
export { ErrorMessage } from "./error-message";
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
import type { ComponentStory, ComponentMeta } from "@storybook/react";
|
|
3
3
|
declare const _default: ComponentMeta<import("react").ForwardRefExoticComponent<{
|
|
4
4
|
code: string;
|
|
5
|
-
|
|
5
|
+
executeScriptOnCanvas: boolean;
|
|
6
6
|
} & import("react").RefAttributes<HTMLDivElement>>>;
|
|
7
7
|
export default _default;
|
|
8
|
-
export declare const
|
|
8
|
+
export declare const HtmlEmbed: ComponentStory<import("react").ForwardRefExoticComponent<{
|
|
9
9
|
code: string;
|
|
10
|
-
|
|
10
|
+
executeScriptOnCanvas: boolean;
|
|
11
11
|
} & import("react").RefAttributes<HTMLDivElement>>>;
|
|
@@ -193,9 +193,9 @@ export declare const getStyleRules: (styles: Map<string, {
|
|
|
193
193
|
})[];
|
|
194
194
|
})[];
|
|
195
195
|
};
|
|
196
|
+
property: "filter" | "float" | "fontFamily" | "width" | "height" | "clip" | "top" | "right" | `--${string}` | "accentColor" | "alignContent" | "alignItems" | "alignSelf" | "alignTracks" | "animationComposition" | "animationDelay" | "animationDirection" | "animationDuration" | "animationFillMode" | "animationIterationCount" | "animationName" | "animationPlayState" | "animationTimingFunction" | "animationTimeline" | "appearance" | "aspectRatio" | "backdropFilter" | "backfaceVisibility" | "backgroundAttachment" | "backgroundBlendMode" | "backgroundClip" | "backgroundColor" | "backgroundImage" | "backgroundOrigin" | "backgroundPosition" | "backgroundPositionX" | "backgroundPositionY" | "backgroundRepeat" | "backgroundSize" | "blockOverflow" | "blockSize" | "borderBlockColor" | "borderBlockStyle" | "borderBlockWidth" | "borderBlockEndColor" | "borderBlockEndStyle" | "borderBlockEndWidth" | "borderBlockStartColor" | "borderBlockStartStyle" | "borderBlockStartWidth" | "borderBottomColor" | "borderBottomLeftRadius" | "borderBottomRightRadius" | "borderBottomStyle" | "borderBottomWidth" | "borderCollapse" | "borderEndEndRadius" | "borderEndStartRadius" | "borderImageOutset" | "borderImageRepeat" | "borderImageSlice" | "borderImageSource" | "borderImageWidth" | "borderInlineColor" | "borderInlineStyle" | "borderInlineWidth" | "borderInlineEndColor" | "borderInlineEndStyle" | "borderInlineEndWidth" | "borderInlineStartColor" | "borderInlineStartStyle" | "borderInlineStartWidth" | "borderLeftColor" | "borderLeftStyle" | "borderLeftWidth" | "borderRightColor" | "borderRightStyle" | "borderRightWidth" | "borderSpacing" | "borderStartEndRadius" | "borderStartStartRadius" | "borderTopColor" | "borderTopLeftRadius" | "borderTopRightRadius" | "borderTopStyle" | "borderTopWidth" | "bottom" | "boxDecorationBreak" | "boxShadow" | "boxSizing" | "breakAfter" | "breakBefore" | "breakInside" | "captionSide" | "caretColor" | "caretShape" | "clear" | "clipPath" | "color" | "printColorAdjust" | "colorScheme" | "columnCount" | "columnFill" | "columnGap" | "columnRuleColor" | "columnRuleStyle" | "columnRuleWidth" | "columnSpan" | "columnWidth" | "contain" | "containIntrinsicBlockSize" | "containIntrinsicHeight" | "containIntrinsicInlineSize" | "containIntrinsicWidth" | "content" | "contentVisibility" | "counterIncrement" | "counterReset" | "counterSet" | "cursor" | "direction" | "display" | "emptyCells" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontFeatureSettings" | "fontKerning" | "fontLanguageOverride" | "fontOpticalSizing" | "fontVariationSettings" | "fontSize" | "fontSizeAdjust" | "fontStretch" | "fontStyle" | "fontSynthesis" | "fontVariant" | "fontVariantAlternates" | "fontVariantCaps" | "fontVariantEastAsian" | "fontVariantLigatures" | "fontVariantNumeric" | "fontVariantPosition" | "fontWeight" | "forcedColorAdjust" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridColumnEnd" | "gridColumnStart" | "gridRowEnd" | "gridRowStart" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "hangingPunctuation" | "hyphenateCharacter" | "hyphens" | "imageOrientation" | "imageRendering" | "imageResolution" | "initialLetter" | "initialLetterAlign" | "inlineSize" | "inputSecurity" | "insetBlockEnd" | "insetBlockStart" | "insetInlineEnd" | "insetInlineStart" | "isolation" | "justifyContent" | "justifyItems" | "justifySelf" | "justifyTracks" | "left" | "letterSpacing" | "lineBreak" | "lineClamp" | "lineHeight" | "lineHeightStep" | "listStyleImage" | "listStylePosition" | "listStyleType" | "marginBlockEnd" | "marginBlockStart" | "marginBottom" | "marginInlineEnd" | "marginInlineStart" | "marginLeft" | "marginRight" | "marginTop" | "marginTrim" | "maskBorderMode" | "maskBorderOutset" | "maskBorderRepeat" | "maskBorderSlice" | "maskBorderSource" | "maskBorderWidth" | "maskClip" | "maskComposite" | "maskImage" | "maskMode" | "maskOrigin" | "maskPosition" | "maskRepeat" | "maskSize" | "maskType" | "masonryAutoFlow" | "mathDepth" | "mathShift" | "mathStyle" | "maxBlockSize" | "maxHeight" | "maxInlineSize" | "maxLines" | "maxWidth" | "minBlockSize" | "minHeight" | "minInlineSize" | "minWidth" | "mixBlendMode" | "objectFit" | "objectPosition" | "offsetAnchor" | "offsetDistance" | "offsetPath" | "offsetPosition" | "offsetRotate" | "opacity" | "order" | "orphans" | "outlineColor" | "outlineOffset" | "outlineStyle" | "outlineWidth" | "overflow" | "overflowAnchor" | "overflowBlock" | "overflowClipMargin" | "overflowInline" | "overflowWrap" | "overflowX" | "overflowY" | "overscrollBehavior" | "overscrollBehaviorBlock" | "overscrollBehaviorInline" | "overscrollBehaviorX" | "overscrollBehaviorY" | "paddingBlockEnd" | "paddingBlockStart" | "paddingBottom" | "paddingInlineEnd" | "paddingInlineStart" | "paddingLeft" | "paddingRight" | "paddingTop" | "pageBreakAfter" | "pageBreakBefore" | "pageBreakInside" | "paintOrder" | "perspective" | "perspectiveOrigin" | "pointerEvents" | "position" | "quotes" | "resize" | "rotate" | "rowGap" | "rubyAlign" | "rubyMerge" | "rubyPosition" | "scale" | "scrollbarColor" | "scrollbarGutter" | "scrollbarWidth" | "scrollBehavior" | "scrollMarginBlockStart" | "scrollMarginBlockEnd" | "scrollMarginBottom" | "scrollMarginInlineStart" | "scrollMarginInlineEnd" | "scrollMarginLeft" | "scrollMarginRight" | "scrollMarginTop" | "scrollPaddingBlockStart" | "scrollPaddingBlockEnd" | "scrollPaddingBottom" | "scrollPaddingInlineStart" | "scrollPaddingInlineEnd" | "scrollPaddingLeft" | "scrollPaddingRight" | "scrollPaddingTop" | "scrollSnapAlign" | "scrollSnapStop" | "scrollSnapType" | "scrollTimelineAxis" | "scrollTimelineName" | "shapeImageThreshold" | "shapeMargin" | "shapeOutside" | "tabSize" | "tableLayout" | "textAlign" | "textAlignLast" | "textCombineUpright" | "textDecorationColor" | "textDecorationLine" | "textDecorationSkip" | "textDecorationSkipInk" | "textDecorationStyle" | "textDecorationThickness" | "textEmphasisColor" | "textEmphasisPosition" | "textEmphasisStyle" | "textIndent" | "textJustify" | "textOrientation" | "textOverflow" | "textRendering" | "textShadow" | "textSizeAdjust" | "textTransform" | "textUnderlineOffset" | "textUnderlinePosition" | "touchAction" | "transform" | "transformBox" | "transformOrigin" | "transformStyle" | "transitionDelay" | "transitionDuration" | "transitionProperty" | "transitionTimingFunction" | "translate" | "unicodeBidi" | "userSelect" | "verticalAlign" | "visibility" | "whiteSpace" | "widows" | "willChange" | "wordBreak" | "wordSpacing" | "wordWrap" | "writingMode" | "zIndex";
|
|
196
197
|
styleSourceId: string;
|
|
197
198
|
breakpointId: string;
|
|
198
|
-
property: "filter" | "float" | "fontFamily" | "width" | "height" | "clip" | "top" | "right" | `--${string}` | "accentColor" | "alignContent" | "alignItems" | "alignSelf" | "alignTracks" | "animationComposition" | "animationDelay" | "animationDirection" | "animationDuration" | "animationFillMode" | "animationIterationCount" | "animationName" | "animationPlayState" | "animationTimingFunction" | "animationTimeline" | "appearance" | "aspectRatio" | "backdropFilter" | "backfaceVisibility" | "backgroundAttachment" | "backgroundBlendMode" | "backgroundClip" | "backgroundColor" | "backgroundImage" | "backgroundOrigin" | "backgroundPosition" | "backgroundPositionX" | "backgroundPositionY" | "backgroundRepeat" | "backgroundSize" | "blockOverflow" | "blockSize" | "borderBlockColor" | "borderBlockStyle" | "borderBlockWidth" | "borderBlockEndColor" | "borderBlockEndStyle" | "borderBlockEndWidth" | "borderBlockStartColor" | "borderBlockStartStyle" | "borderBlockStartWidth" | "borderBottomColor" | "borderBottomLeftRadius" | "borderBottomRightRadius" | "borderBottomStyle" | "borderBottomWidth" | "borderCollapse" | "borderEndEndRadius" | "borderEndStartRadius" | "borderImageOutset" | "borderImageRepeat" | "borderImageSlice" | "borderImageSource" | "borderImageWidth" | "borderInlineColor" | "borderInlineStyle" | "borderInlineWidth" | "borderInlineEndColor" | "borderInlineEndStyle" | "borderInlineEndWidth" | "borderInlineStartColor" | "borderInlineStartStyle" | "borderInlineStartWidth" | "borderLeftColor" | "borderLeftStyle" | "borderLeftWidth" | "borderRightColor" | "borderRightStyle" | "borderRightWidth" | "borderSpacing" | "borderStartEndRadius" | "borderStartStartRadius" | "borderTopColor" | "borderTopLeftRadius" | "borderTopRightRadius" | "borderTopStyle" | "borderTopWidth" | "bottom" | "boxDecorationBreak" | "boxShadow" | "boxSizing" | "breakAfter" | "breakBefore" | "breakInside" | "captionSide" | "caretColor" | "caretShape" | "clear" | "clipPath" | "color" | "printColorAdjust" | "colorScheme" | "columnCount" | "columnFill" | "columnGap" | "columnRuleColor" | "columnRuleStyle" | "columnRuleWidth" | "columnSpan" | "columnWidth" | "contain" | "containIntrinsicBlockSize" | "containIntrinsicHeight" | "containIntrinsicInlineSize" | "containIntrinsicWidth" | "content" | "contentVisibility" | "counterIncrement" | "counterReset" | "counterSet" | "cursor" | "direction" | "display" | "emptyCells" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontFeatureSettings" | "fontKerning" | "fontLanguageOverride" | "fontOpticalSizing" | "fontVariationSettings" | "fontSize" | "fontSizeAdjust" | "fontStretch" | "fontStyle" | "fontSynthesis" | "fontVariant" | "fontVariantAlternates" | "fontVariantCaps" | "fontVariantEastAsian" | "fontVariantLigatures" | "fontVariantNumeric" | "fontVariantPosition" | "fontWeight" | "forcedColorAdjust" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridColumnEnd" | "gridColumnStart" | "gridRowEnd" | "gridRowStart" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "hangingPunctuation" | "hyphenateCharacter" | "hyphens" | "imageOrientation" | "imageRendering" | "imageResolution" | "initialLetter" | "initialLetterAlign" | "inlineSize" | "inputSecurity" | "insetBlockEnd" | "insetBlockStart" | "insetInlineEnd" | "insetInlineStart" | "isolation" | "justifyContent" | "justifyItems" | "justifySelf" | "justifyTracks" | "left" | "letterSpacing" | "lineBreak" | "lineClamp" | "lineHeight" | "lineHeightStep" | "listStyleImage" | "listStylePosition" | "listStyleType" | "marginBlockEnd" | "marginBlockStart" | "marginBottom" | "marginInlineEnd" | "marginInlineStart" | "marginLeft" | "marginRight" | "marginTop" | "marginTrim" | "maskBorderMode" | "maskBorderOutset" | "maskBorderRepeat" | "maskBorderSlice" | "maskBorderSource" | "maskBorderWidth" | "maskClip" | "maskComposite" | "maskImage" | "maskMode" | "maskOrigin" | "maskPosition" | "maskRepeat" | "maskSize" | "maskType" | "masonryAutoFlow" | "mathDepth" | "mathShift" | "mathStyle" | "maxBlockSize" | "maxHeight" | "maxInlineSize" | "maxLines" | "maxWidth" | "minBlockSize" | "minHeight" | "minInlineSize" | "minWidth" | "mixBlendMode" | "objectFit" | "objectPosition" | "offsetAnchor" | "offsetDistance" | "offsetPath" | "offsetPosition" | "offsetRotate" | "opacity" | "order" | "orphans" | "outlineColor" | "outlineOffset" | "outlineStyle" | "outlineWidth" | "overflow" | "overflowAnchor" | "overflowBlock" | "overflowClipMargin" | "overflowInline" | "overflowWrap" | "overflowX" | "overflowY" | "overscrollBehavior" | "overscrollBehaviorBlock" | "overscrollBehaviorInline" | "overscrollBehaviorX" | "overscrollBehaviorY" | "paddingBlockEnd" | "paddingBlockStart" | "paddingBottom" | "paddingInlineEnd" | "paddingInlineStart" | "paddingLeft" | "paddingRight" | "paddingTop" | "pageBreakAfter" | "pageBreakBefore" | "pageBreakInside" | "paintOrder" | "perspective" | "perspectiveOrigin" | "pointerEvents" | "position" | "quotes" | "resize" | "rotate" | "rowGap" | "rubyAlign" | "rubyMerge" | "rubyPosition" | "scale" | "scrollbarColor" | "scrollbarGutter" | "scrollbarWidth" | "scrollBehavior" | "scrollMarginBlockStart" | "scrollMarginBlockEnd" | "scrollMarginBottom" | "scrollMarginInlineStart" | "scrollMarginInlineEnd" | "scrollMarginLeft" | "scrollMarginRight" | "scrollMarginTop" | "scrollPaddingBlockStart" | "scrollPaddingBlockEnd" | "scrollPaddingBottom" | "scrollPaddingInlineStart" | "scrollPaddingInlineEnd" | "scrollPaddingLeft" | "scrollPaddingRight" | "scrollPaddingTop" | "scrollSnapAlign" | "scrollSnapStop" | "scrollSnapType" | "scrollTimelineAxis" | "scrollTimelineName" | "shapeImageThreshold" | "shapeMargin" | "shapeOutside" | "tabSize" | "tableLayout" | "textAlign" | "textAlignLast" | "textCombineUpright" | "textDecorationColor" | "textDecorationLine" | "textDecorationSkip" | "textDecorationSkipInk" | "textDecorationStyle" | "textDecorationThickness" | "textEmphasisColor" | "textEmphasisPosition" | "textEmphasisStyle" | "textIndent" | "textJustify" | "textOrientation" | "textOverflow" | "textRendering" | "textShadow" | "textSizeAdjust" | "textTransform" | "textUnderlineOffset" | "textUnderlinePosition" | "touchAction" | "transform" | "transformBox" | "transformOrigin" | "transformStyle" | "transitionDelay" | "transitionDuration" | "transitionProperty" | "transitionTimingFunction" | "translate" | "unicodeBidi" | "userSelect" | "verticalAlign" | "visibility" | "whiteSpace" | "widows" | "willChange" | "wordBreak" | "wordSpacing" | "wordWrap" | "writingMode" | "zIndex";
|
|
199
199
|
}>, styleSourceSelections: Map<string, {
|
|
200
200
|
values: string[];
|
|
201
201
|
instanceId: string;
|
|
@@ -1718,9 +1718,9 @@ export declare const generateDataFromEmbedTemplate: (treeTemplate: ({
|
|
|
1718
1718
|
})[];
|
|
1719
1719
|
})[];
|
|
1720
1720
|
};
|
|
1721
|
+
property: "filter" | "float" | "fontFamily" | "width" | "height" | "clip" | "top" | "right" | `--${string}` | "accentColor" | "alignContent" | "alignItems" | "alignSelf" | "alignTracks" | "animationComposition" | "animationDelay" | "animationDirection" | "animationDuration" | "animationFillMode" | "animationIterationCount" | "animationName" | "animationPlayState" | "animationTimingFunction" | "animationTimeline" | "appearance" | "aspectRatio" | "backdropFilter" | "backfaceVisibility" | "backgroundAttachment" | "backgroundBlendMode" | "backgroundClip" | "backgroundColor" | "backgroundImage" | "backgroundOrigin" | "backgroundPosition" | "backgroundPositionX" | "backgroundPositionY" | "backgroundRepeat" | "backgroundSize" | "blockOverflow" | "blockSize" | "borderBlockColor" | "borderBlockStyle" | "borderBlockWidth" | "borderBlockEndColor" | "borderBlockEndStyle" | "borderBlockEndWidth" | "borderBlockStartColor" | "borderBlockStartStyle" | "borderBlockStartWidth" | "borderBottomColor" | "borderBottomLeftRadius" | "borderBottomRightRadius" | "borderBottomStyle" | "borderBottomWidth" | "borderCollapse" | "borderEndEndRadius" | "borderEndStartRadius" | "borderImageOutset" | "borderImageRepeat" | "borderImageSlice" | "borderImageSource" | "borderImageWidth" | "borderInlineColor" | "borderInlineStyle" | "borderInlineWidth" | "borderInlineEndColor" | "borderInlineEndStyle" | "borderInlineEndWidth" | "borderInlineStartColor" | "borderInlineStartStyle" | "borderInlineStartWidth" | "borderLeftColor" | "borderLeftStyle" | "borderLeftWidth" | "borderRightColor" | "borderRightStyle" | "borderRightWidth" | "borderSpacing" | "borderStartEndRadius" | "borderStartStartRadius" | "borderTopColor" | "borderTopLeftRadius" | "borderTopRightRadius" | "borderTopStyle" | "borderTopWidth" | "bottom" | "boxDecorationBreak" | "boxShadow" | "boxSizing" | "breakAfter" | "breakBefore" | "breakInside" | "captionSide" | "caretColor" | "caretShape" | "clear" | "clipPath" | "color" | "printColorAdjust" | "colorScheme" | "columnCount" | "columnFill" | "columnGap" | "columnRuleColor" | "columnRuleStyle" | "columnRuleWidth" | "columnSpan" | "columnWidth" | "contain" | "containIntrinsicBlockSize" | "containIntrinsicHeight" | "containIntrinsicInlineSize" | "containIntrinsicWidth" | "content" | "contentVisibility" | "counterIncrement" | "counterReset" | "counterSet" | "cursor" | "direction" | "display" | "emptyCells" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontFeatureSettings" | "fontKerning" | "fontLanguageOverride" | "fontOpticalSizing" | "fontVariationSettings" | "fontSize" | "fontSizeAdjust" | "fontStretch" | "fontStyle" | "fontSynthesis" | "fontVariant" | "fontVariantAlternates" | "fontVariantCaps" | "fontVariantEastAsian" | "fontVariantLigatures" | "fontVariantNumeric" | "fontVariantPosition" | "fontWeight" | "forcedColorAdjust" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridColumnEnd" | "gridColumnStart" | "gridRowEnd" | "gridRowStart" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "hangingPunctuation" | "hyphenateCharacter" | "hyphens" | "imageOrientation" | "imageRendering" | "imageResolution" | "initialLetter" | "initialLetterAlign" | "inlineSize" | "inputSecurity" | "insetBlockEnd" | "insetBlockStart" | "insetInlineEnd" | "insetInlineStart" | "isolation" | "justifyContent" | "justifyItems" | "justifySelf" | "justifyTracks" | "left" | "letterSpacing" | "lineBreak" | "lineClamp" | "lineHeight" | "lineHeightStep" | "listStyleImage" | "listStylePosition" | "listStyleType" | "marginBlockEnd" | "marginBlockStart" | "marginBottom" | "marginInlineEnd" | "marginInlineStart" | "marginLeft" | "marginRight" | "marginTop" | "marginTrim" | "maskBorderMode" | "maskBorderOutset" | "maskBorderRepeat" | "maskBorderSlice" | "maskBorderSource" | "maskBorderWidth" | "maskClip" | "maskComposite" | "maskImage" | "maskMode" | "maskOrigin" | "maskPosition" | "maskRepeat" | "maskSize" | "maskType" | "masonryAutoFlow" | "mathDepth" | "mathShift" | "mathStyle" | "maxBlockSize" | "maxHeight" | "maxInlineSize" | "maxLines" | "maxWidth" | "minBlockSize" | "minHeight" | "minInlineSize" | "minWidth" | "mixBlendMode" | "objectFit" | "objectPosition" | "offsetAnchor" | "offsetDistance" | "offsetPath" | "offsetPosition" | "offsetRotate" | "opacity" | "order" | "orphans" | "outlineColor" | "outlineOffset" | "outlineStyle" | "outlineWidth" | "overflow" | "overflowAnchor" | "overflowBlock" | "overflowClipMargin" | "overflowInline" | "overflowWrap" | "overflowX" | "overflowY" | "overscrollBehavior" | "overscrollBehaviorBlock" | "overscrollBehaviorInline" | "overscrollBehaviorX" | "overscrollBehaviorY" | "paddingBlockEnd" | "paddingBlockStart" | "paddingBottom" | "paddingInlineEnd" | "paddingInlineStart" | "paddingLeft" | "paddingRight" | "paddingTop" | "pageBreakAfter" | "pageBreakBefore" | "pageBreakInside" | "paintOrder" | "perspective" | "perspectiveOrigin" | "pointerEvents" | "position" | "quotes" | "resize" | "rotate" | "rowGap" | "rubyAlign" | "rubyMerge" | "rubyPosition" | "scale" | "scrollbarColor" | "scrollbarGutter" | "scrollbarWidth" | "scrollBehavior" | "scrollMarginBlockStart" | "scrollMarginBlockEnd" | "scrollMarginBottom" | "scrollMarginInlineStart" | "scrollMarginInlineEnd" | "scrollMarginLeft" | "scrollMarginRight" | "scrollMarginTop" | "scrollPaddingBlockStart" | "scrollPaddingBlockEnd" | "scrollPaddingBottom" | "scrollPaddingInlineStart" | "scrollPaddingInlineEnd" | "scrollPaddingLeft" | "scrollPaddingRight" | "scrollPaddingTop" | "scrollSnapAlign" | "scrollSnapStop" | "scrollSnapType" | "scrollTimelineAxis" | "scrollTimelineName" | "shapeImageThreshold" | "shapeMargin" | "shapeOutside" | "tabSize" | "tableLayout" | "textAlign" | "textAlignLast" | "textCombineUpright" | "textDecorationColor" | "textDecorationLine" | "textDecorationSkip" | "textDecorationSkipInk" | "textDecorationStyle" | "textDecorationThickness" | "textEmphasisColor" | "textEmphasisPosition" | "textEmphasisStyle" | "textIndent" | "textJustify" | "textOrientation" | "textOverflow" | "textRendering" | "textShadow" | "textSizeAdjust" | "textTransform" | "textUnderlineOffset" | "textUnderlinePosition" | "touchAction" | "transform" | "transformBox" | "transformOrigin" | "transformStyle" | "transitionDelay" | "transitionDuration" | "transitionProperty" | "transitionTimingFunction" | "translate" | "unicodeBidi" | "userSelect" | "verticalAlign" | "visibility" | "whiteSpace" | "widows" | "willChange" | "wordBreak" | "wordSpacing" | "wordWrap" | "writingMode" | "zIndex";
|
|
1721
1722
|
styleSourceId: string;
|
|
1722
1723
|
breakpointId: string;
|
|
1723
|
-
property: "filter" | "float" | "fontFamily" | "width" | "height" | "clip" | "top" | "right" | `--${string}` | "accentColor" | "alignContent" | "alignItems" | "alignSelf" | "alignTracks" | "animationComposition" | "animationDelay" | "animationDirection" | "animationDuration" | "animationFillMode" | "animationIterationCount" | "animationName" | "animationPlayState" | "animationTimingFunction" | "animationTimeline" | "appearance" | "aspectRatio" | "backdropFilter" | "backfaceVisibility" | "backgroundAttachment" | "backgroundBlendMode" | "backgroundClip" | "backgroundColor" | "backgroundImage" | "backgroundOrigin" | "backgroundPosition" | "backgroundPositionX" | "backgroundPositionY" | "backgroundRepeat" | "backgroundSize" | "blockOverflow" | "blockSize" | "borderBlockColor" | "borderBlockStyle" | "borderBlockWidth" | "borderBlockEndColor" | "borderBlockEndStyle" | "borderBlockEndWidth" | "borderBlockStartColor" | "borderBlockStartStyle" | "borderBlockStartWidth" | "borderBottomColor" | "borderBottomLeftRadius" | "borderBottomRightRadius" | "borderBottomStyle" | "borderBottomWidth" | "borderCollapse" | "borderEndEndRadius" | "borderEndStartRadius" | "borderImageOutset" | "borderImageRepeat" | "borderImageSlice" | "borderImageSource" | "borderImageWidth" | "borderInlineColor" | "borderInlineStyle" | "borderInlineWidth" | "borderInlineEndColor" | "borderInlineEndStyle" | "borderInlineEndWidth" | "borderInlineStartColor" | "borderInlineStartStyle" | "borderInlineStartWidth" | "borderLeftColor" | "borderLeftStyle" | "borderLeftWidth" | "borderRightColor" | "borderRightStyle" | "borderRightWidth" | "borderSpacing" | "borderStartEndRadius" | "borderStartStartRadius" | "borderTopColor" | "borderTopLeftRadius" | "borderTopRightRadius" | "borderTopStyle" | "borderTopWidth" | "bottom" | "boxDecorationBreak" | "boxShadow" | "boxSizing" | "breakAfter" | "breakBefore" | "breakInside" | "captionSide" | "caretColor" | "caretShape" | "clear" | "clipPath" | "color" | "printColorAdjust" | "colorScheme" | "columnCount" | "columnFill" | "columnGap" | "columnRuleColor" | "columnRuleStyle" | "columnRuleWidth" | "columnSpan" | "columnWidth" | "contain" | "containIntrinsicBlockSize" | "containIntrinsicHeight" | "containIntrinsicInlineSize" | "containIntrinsicWidth" | "content" | "contentVisibility" | "counterIncrement" | "counterReset" | "counterSet" | "cursor" | "direction" | "display" | "emptyCells" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontFeatureSettings" | "fontKerning" | "fontLanguageOverride" | "fontOpticalSizing" | "fontVariationSettings" | "fontSize" | "fontSizeAdjust" | "fontStretch" | "fontStyle" | "fontSynthesis" | "fontVariant" | "fontVariantAlternates" | "fontVariantCaps" | "fontVariantEastAsian" | "fontVariantLigatures" | "fontVariantNumeric" | "fontVariantPosition" | "fontWeight" | "forcedColorAdjust" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridColumnEnd" | "gridColumnStart" | "gridRowEnd" | "gridRowStart" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "hangingPunctuation" | "hyphenateCharacter" | "hyphens" | "imageOrientation" | "imageRendering" | "imageResolution" | "initialLetter" | "initialLetterAlign" | "inlineSize" | "inputSecurity" | "insetBlockEnd" | "insetBlockStart" | "insetInlineEnd" | "insetInlineStart" | "isolation" | "justifyContent" | "justifyItems" | "justifySelf" | "justifyTracks" | "left" | "letterSpacing" | "lineBreak" | "lineClamp" | "lineHeight" | "lineHeightStep" | "listStyleImage" | "listStylePosition" | "listStyleType" | "marginBlockEnd" | "marginBlockStart" | "marginBottom" | "marginInlineEnd" | "marginInlineStart" | "marginLeft" | "marginRight" | "marginTop" | "marginTrim" | "maskBorderMode" | "maskBorderOutset" | "maskBorderRepeat" | "maskBorderSlice" | "maskBorderSource" | "maskBorderWidth" | "maskClip" | "maskComposite" | "maskImage" | "maskMode" | "maskOrigin" | "maskPosition" | "maskRepeat" | "maskSize" | "maskType" | "masonryAutoFlow" | "mathDepth" | "mathShift" | "mathStyle" | "maxBlockSize" | "maxHeight" | "maxInlineSize" | "maxLines" | "maxWidth" | "minBlockSize" | "minHeight" | "minInlineSize" | "minWidth" | "mixBlendMode" | "objectFit" | "objectPosition" | "offsetAnchor" | "offsetDistance" | "offsetPath" | "offsetPosition" | "offsetRotate" | "opacity" | "order" | "orphans" | "outlineColor" | "outlineOffset" | "outlineStyle" | "outlineWidth" | "overflow" | "overflowAnchor" | "overflowBlock" | "overflowClipMargin" | "overflowInline" | "overflowWrap" | "overflowX" | "overflowY" | "overscrollBehavior" | "overscrollBehaviorBlock" | "overscrollBehaviorInline" | "overscrollBehaviorX" | "overscrollBehaviorY" | "paddingBlockEnd" | "paddingBlockStart" | "paddingBottom" | "paddingInlineEnd" | "paddingInlineStart" | "paddingLeft" | "paddingRight" | "paddingTop" | "pageBreakAfter" | "pageBreakBefore" | "pageBreakInside" | "paintOrder" | "perspective" | "perspectiveOrigin" | "pointerEvents" | "position" | "quotes" | "resize" | "rotate" | "rowGap" | "rubyAlign" | "rubyMerge" | "rubyPosition" | "scale" | "scrollbarColor" | "scrollbarGutter" | "scrollbarWidth" | "scrollBehavior" | "scrollMarginBlockStart" | "scrollMarginBlockEnd" | "scrollMarginBottom" | "scrollMarginInlineStart" | "scrollMarginInlineEnd" | "scrollMarginLeft" | "scrollMarginRight" | "scrollMarginTop" | "scrollPaddingBlockStart" | "scrollPaddingBlockEnd" | "scrollPaddingBottom" | "scrollPaddingInlineStart" | "scrollPaddingInlineEnd" | "scrollPaddingLeft" | "scrollPaddingRight" | "scrollPaddingTop" | "scrollSnapAlign" | "scrollSnapStop" | "scrollSnapType" | "scrollTimelineAxis" | "scrollTimelineName" | "shapeImageThreshold" | "shapeMargin" | "shapeOutside" | "tabSize" | "tableLayout" | "textAlign" | "textAlignLast" | "textCombineUpright" | "textDecorationColor" | "textDecorationLine" | "textDecorationSkip" | "textDecorationSkipInk" | "textDecorationStyle" | "textDecorationThickness" | "textEmphasisColor" | "textEmphasisPosition" | "textEmphasisStyle" | "textIndent" | "textJustify" | "textOrientation" | "textOverflow" | "textRendering" | "textShadow" | "textSizeAdjust" | "textTransform" | "textUnderlineOffset" | "textUnderlinePosition" | "touchAction" | "transform" | "transformBox" | "transformOrigin" | "transformStyle" | "transitionDelay" | "transitionDuration" | "transitionProperty" | "transitionTimingFunction" | "translate" | "unicodeBidi" | "userSelect" | "verticalAlign" | "visibility" | "whiteSpace" | "widows" | "willChange" | "wordBreak" | "wordSpacing" | "wordWrap" | "writingMode" | "zIndex";
|
|
1724
1724
|
}[];
|
|
1725
1725
|
};
|
|
1726
1726
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webstudio-is/react-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.67.0",
|
|
4
4
|
"description": "Webstudio JavaScript / TypeScript API",
|
|
5
5
|
"author": "Webstudio <github@webstudio.is>",
|
|
6
6
|
"homepage": "https://webstudio.is",
|
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
"typescript": "5.0.3",
|
|
19
19
|
"zod": "^3.19.1",
|
|
20
20
|
"@webstudio-is/jest-config": "^1.0.6",
|
|
21
|
-
"@webstudio-is/scripts": "^0.0.0",
|
|
22
21
|
"@webstudio-is/storybook-config": "^0.0.0",
|
|
22
|
+
"@webstudio-is/scripts": "^0.0.0",
|
|
23
23
|
"@webstudio-is/tsconfig": "^1.0.6"
|
|
24
24
|
},
|
|
25
25
|
"peerDependencies": {
|
|
@@ -36,17 +36,17 @@
|
|
|
36
36
|
"nanoevents": "^7.0.1",
|
|
37
37
|
"nanoid": "^3.2.0",
|
|
38
38
|
"nanostores": "^0.7.1",
|
|
39
|
-
"@webstudio-is/asset-uploader": "^0.
|
|
40
|
-
"@webstudio-is/css-data": "^0.
|
|
41
|
-
"@webstudio-is/css-engine": "^0.
|
|
42
|
-
"@webstudio-is/css-vars": "^0.
|
|
43
|
-
"@webstudio-is/fonts": "^0.
|
|
44
|
-
"@webstudio-is/form-handlers": "^0.
|
|
45
|
-
"@webstudio-is/generate-arg-types": "^0.
|
|
46
|
-
"@webstudio-is/icons": "^0.
|
|
47
|
-
"@webstudio-is/image": "^0.
|
|
48
|
-
"@webstudio-is/prisma-client": "^0.
|
|
49
|
-
"@webstudio-is/project-build": "^0.
|
|
39
|
+
"@webstudio-is/asset-uploader": "^0.67.0",
|
|
40
|
+
"@webstudio-is/css-data": "^0.67.0",
|
|
41
|
+
"@webstudio-is/css-engine": "^0.67.0",
|
|
42
|
+
"@webstudio-is/css-vars": "^0.67.0",
|
|
43
|
+
"@webstudio-is/fonts": "^0.67.0",
|
|
44
|
+
"@webstudio-is/form-handlers": "^0.67.0",
|
|
45
|
+
"@webstudio-is/generate-arg-types": "^0.67.0",
|
|
46
|
+
"@webstudio-is/icons": "^0.67.0",
|
|
47
|
+
"@webstudio-is/image": "^0.67.0",
|
|
48
|
+
"@webstudio-is/prisma-client": "^0.67.0",
|
|
49
|
+
"@webstudio-is/project-build": "^0.67.0"
|
|
50
50
|
},
|
|
51
51
|
"exports": {
|
|
52
52
|
".": {
|
|
@@ -16,7 +16,10 @@ export const customComponents = {
|
|
|
16
16
|
};
|
|
17
17
|
|
|
18
18
|
export const customComponentPropsMetas: Record<string, WsComponentPropsMeta> = {
|
|
19
|
-
Image: {
|
|
19
|
+
Image: {
|
|
20
|
+
props: imageProps,
|
|
21
|
+
initialProps: ["src", "width", "height", "alt", "loading"],
|
|
22
|
+
},
|
|
20
23
|
Form: formPropsMeta,
|
|
21
24
|
};
|
|
22
25
|
|
|
@@ -2,7 +2,7 @@ import type { PropMeta } from "@webstudio-is/generate-arg-types";
|
|
|
2
2
|
|
|
3
3
|
export const props: Record<string, PropMeta> = {
|
|
4
4
|
code: { required: true, control: "text", type: "string" },
|
|
5
|
-
|
|
5
|
+
executeScriptOnCanvas: {
|
|
6
6
|
required: true,
|
|
7
7
|
control: "boolean",
|
|
8
8
|
type: "boolean",
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ComponentStory, ComponentMeta } from "@storybook/react";
|
|
2
|
+
import { CodeText as CodeTextPrimitive } from "./code-text";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
title: "Components/CodeText",
|
|
6
|
+
component: CodeTextPrimitive,
|
|
7
|
+
} as ComponentMeta<typeof CodeTextPrimitive>;
|
|
8
|
+
|
|
9
|
+
const Template: ComponentStory<typeof CodeTextPrimitive> = (args) => (
|
|
10
|
+
<CodeTextPrimitive {...args} />
|
|
11
|
+
);
|
|
12
|
+
|
|
13
|
+
export const CodeText = Template.bind({});
|
|
14
|
+
CodeText.args = {
|
|
15
|
+
children: "alert('Hello World!')",
|
|
16
|
+
};
|
|
@@ -19,7 +19,7 @@ type Props = Omit<ComponentProps<typeof defaultTag>, "inline"> & {
|
|
|
19
19
|
meta?: string;
|
|
20
20
|
};
|
|
21
21
|
|
|
22
|
-
export const
|
|
22
|
+
export const CodeText = forwardRef<ElementRef<typeof defaultTag>, Props>(
|
|
23
23
|
({ inline = false, ...props }, ref) => {
|
|
24
24
|
// @todo in the future we should expose the inline prop a an attribute
|
|
25
25
|
// and define the display style in `presetStyle` in meta.
|
|
@@ -28,4 +28,4 @@ export const Code = forwardRef<ElementRef<typeof defaultTag>, Props>(
|
|
|
28
28
|
}
|
|
29
29
|
);
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
CodeText.displayName = "CodeText";
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CodeTextIcon } from "@webstudio-is/icons/svg";
|
|
2
2
|
import {
|
|
3
3
|
defaultStates,
|
|
4
4
|
type PresetStyle,
|
|
5
5
|
type WsComponentMeta,
|
|
6
6
|
type WsComponentPropsMeta,
|
|
7
7
|
} from "./component-meta";
|
|
8
|
-
import { type defaultTag, displayVarNamespace } from "./code";
|
|
9
|
-
import { props } from "./__generated__/code.props";
|
|
8
|
+
import { type defaultTag, displayVarNamespace } from "./code-text";
|
|
9
|
+
import { props } from "./__generated__/code-text.props";
|
|
10
10
|
import { code } from "../css/normalize";
|
|
11
11
|
|
|
12
12
|
const presetStyle = {
|
|
@@ -38,8 +38,8 @@ const presetStyle = {
|
|
|
38
38
|
export const meta: WsComponentMeta = {
|
|
39
39
|
category: "general",
|
|
40
40
|
type: "rich-text",
|
|
41
|
-
label: "Code",
|
|
42
|
-
icon:
|
|
41
|
+
label: "Code Text",
|
|
42
|
+
icon: CodeTextIcon,
|
|
43
43
|
states: defaultStates,
|
|
44
44
|
presetStyle,
|
|
45
45
|
children: [{ type: "text", value: "Code you can edit" }],
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
export { Slot } from "./slot";
|
|
9
9
|
export { Fragment } from "./fragment";
|
|
10
|
-
export {
|
|
10
|
+
export { HtmlEmbed } from "./html-embed";
|
|
11
11
|
export { Body } from "./body";
|
|
12
12
|
export { Box } from "./box";
|
|
13
13
|
export { TextBlock } from "./text-block";
|
|
@@ -29,7 +29,7 @@ export { Blockquote } from "./blockquote";
|
|
|
29
29
|
export { List } from "./list";
|
|
30
30
|
export { ListItem } from "./list-item";
|
|
31
31
|
export { Separator } from "./separator";
|
|
32
|
-
export {
|
|
32
|
+
export { CodeText } from "./code-text";
|
|
33
33
|
export { Label } from "./label";
|
|
34
34
|
export { SuccessMessage } from "./success-message";
|
|
35
35
|
export { ErrorMessage } from "./error-message";
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ComponentStory, ComponentMeta } from "@storybook/react";
|
|
2
|
+
import { HtmlEmbed as HtmlEmbedPrimitive } from "./html-embed";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
title: "Components/HtmlEmbed",
|
|
6
|
+
component: HtmlEmbedPrimitive,
|
|
7
|
+
} as ComponentMeta<typeof HtmlEmbedPrimitive>;
|
|
8
|
+
|
|
9
|
+
const Template: ComponentStory<typeof HtmlEmbedPrimitive> = (args) => (
|
|
10
|
+
<HtmlEmbedPrimitive {...args} />
|
|
11
|
+
);
|
|
12
|
+
|
|
13
|
+
export const HtmlEmbed = Template.bind({});
|
|
14
|
+
HtmlEmbed.args = {
|
|
15
|
+
code: "<strong>custom code</strong>",
|
|
16
|
+
};
|
|
@@ -10,7 +10,7 @@ import { ReactSdkContext } from "../context";
|
|
|
10
10
|
|
|
11
11
|
type Props = {
|
|
12
12
|
code: string;
|
|
13
|
-
|
|
13
|
+
executeScriptOnCanvas: boolean;
|
|
14
14
|
};
|
|
15
15
|
|
|
16
16
|
type ChildProps = {
|
|
@@ -72,25 +72,25 @@ const Placeholder = (props: ChildProps) => {
|
|
|
72
72
|
const { code, innerRef, ...rest } = props;
|
|
73
73
|
return (
|
|
74
74
|
<div ref={innerRef} {...rest} style={{ padding: "20px" }}>
|
|
75
|
-
{'
|
|
75
|
+
{'Open "Properties" panel to insert HTML code'}
|
|
76
76
|
</div>
|
|
77
77
|
);
|
|
78
78
|
};
|
|
79
79
|
|
|
80
|
-
export const
|
|
80
|
+
export const HtmlEmbed = forwardRef<HTMLDivElement, Props>((props, ref) => {
|
|
81
81
|
const { renderer } = useContext(ReactSdkContext);
|
|
82
|
-
const { code,
|
|
82
|
+
const { code, executeScriptOnCanvas, ...rest } = props;
|
|
83
83
|
|
|
84
84
|
// code can be actually undefined when prop is not provided
|
|
85
85
|
if (code === undefined || code.trim().length === 0) {
|
|
86
86
|
return <Placeholder innerRef={ref} {...rest} />;
|
|
87
87
|
}
|
|
88
88
|
|
|
89
|
-
if (renderer === "canvas" &&
|
|
89
|
+
if (renderer === "canvas" && executeScriptOnCanvas === true) {
|
|
90
90
|
return <ExecutableHtml innerRef={ref} code={code} {...rest} />;
|
|
91
91
|
}
|
|
92
92
|
|
|
93
93
|
return <InnerHtml innerRef={ref} code={code} {...rest} />;
|
|
94
94
|
});
|
|
95
95
|
|
|
96
|
-
|
|
96
|
+
HtmlEmbed.displayName = "HtmlEmbed";
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { EmbedIcon } from "@webstudio-is/icons/svg";
|
|
2
2
|
import type { WsComponentMeta, WsComponentPropsMeta } from "./component-meta";
|
|
3
|
-
import { props } from "./__generated__/html.props";
|
|
3
|
+
import { props } from "./__generated__/html-embed.props";
|
|
4
4
|
|
|
5
5
|
export const meta: WsComponentMeta = {
|
|
6
6
|
category: "general",
|
|
7
7
|
type: "embed",
|
|
8
|
-
label: "
|
|
9
|
-
icon:
|
|
8
|
+
label: "HTML Embed",
|
|
9
|
+
icon: EmbedIcon,
|
|
10
10
|
};
|
|
11
11
|
|
|
12
12
|
export const propsMeta: WsComponentPropsMeta = {
|
package/src/components/index.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { WsComponentMeta, WsComponentPropsMeta } from "./component-meta";
|
|
|
2
2
|
import type { ComponentName } from "./components-utils";
|
|
3
3
|
import { meta as SlotMeta } from "./slot.ws";
|
|
4
4
|
import { meta as FragmentMeta } from "./fragment.ws";
|
|
5
|
-
import { meta as
|
|
5
|
+
import { meta as HtmlEmbedMeta } from "./html-embed.ws";
|
|
6
6
|
import { meta as BodyMeta } from "./body.ws";
|
|
7
7
|
import { meta as BoxMeta } from "./box.ws";
|
|
8
8
|
import { meta as TextBlockMeta } from "./text-block.ws";
|
|
@@ -24,7 +24,7 @@ import { meta as BlockquoteMeta } from "./blockquote.ws";
|
|
|
24
24
|
import { meta as ListMeta } from "./list.ws";
|
|
25
25
|
import { meta as ListItemMeta } from "./list-item.ws";
|
|
26
26
|
import { meta as SeparatorMeta } from "./separator.ws";
|
|
27
|
-
import { meta as
|
|
27
|
+
import { meta as CodeTextMeta } from "./code-text.ws";
|
|
28
28
|
import { meta as LabelMeta } from "./label.ws";
|
|
29
29
|
import { meta as SuccessMessageMeta } from "./success-message.ws";
|
|
30
30
|
import { meta as ErrorMessageMeta } from "./error-message.ws";
|
|
@@ -37,7 +37,7 @@ import { meta as CheckboxMeta } from "./checkbox.ws";
|
|
|
37
37
|
// these are huge JSON objects that we want to be tree-shaken when not used!
|
|
38
38
|
import { propsMeta as SlotMetaPropsMeta } from "./slot.ws";
|
|
39
39
|
import { propsMeta as FragmentMetaPropsMeta } from "./fragment.ws";
|
|
40
|
-
import { propsMeta as
|
|
40
|
+
import { propsMeta as HtmlEmbedMetaPropsMeta } from "./html-embed.ws";
|
|
41
41
|
import { propsMeta as BodyMetaPropsMeta } from "./body.ws";
|
|
42
42
|
import { propsMeta as BoxMetaPropsMeta } from "./box.ws";
|
|
43
43
|
import { propsMeta as TextBlockMetaPropsMeta } from "./text-block.ws";
|
|
@@ -59,7 +59,7 @@ import { propsMeta as BlockquotePropsMeta } from "./blockquote.ws";
|
|
|
59
59
|
import { propsMeta as ListPropsMeta } from "./list.ws";
|
|
60
60
|
import { propsMeta as ListItemPropsMeta } from "./list-item.ws";
|
|
61
61
|
import { propsMeta as SeparatorPropsMeta } from "./separator.ws";
|
|
62
|
-
import { propsMeta as
|
|
62
|
+
import { propsMeta as CodeTextPropsMeta } from "./code-text.ws";
|
|
63
63
|
import { propsMeta as LabelPropsMeta } from "./label.ws";
|
|
64
64
|
import { propsMeta as SuccessMessagePropsMeta } from "./success-message.ws";
|
|
65
65
|
import { propsMeta as ErrorMessagePropsMeta } from "./error-message.ws";
|
|
@@ -73,7 +73,7 @@ import { propsMeta as CheckboxPropsMeta } from "./checkbox.ws";
|
|
|
73
73
|
export const defaultMetas: Record<string, WsComponentMeta> = {
|
|
74
74
|
Slot: SlotMeta,
|
|
75
75
|
Fragment: FragmentMeta,
|
|
76
|
-
|
|
76
|
+
HtmlEmbed: HtmlEmbedMeta,
|
|
77
77
|
Box: BoxMeta,
|
|
78
78
|
Body: BodyMeta,
|
|
79
79
|
TextBlock: TextBlockMeta,
|
|
@@ -95,7 +95,7 @@ export const defaultMetas: Record<string, WsComponentMeta> = {
|
|
|
95
95
|
List: ListMeta,
|
|
96
96
|
ListItem: ListItemMeta,
|
|
97
97
|
Separator: SeparatorMeta,
|
|
98
|
-
|
|
98
|
+
CodeText: CodeTextMeta,
|
|
99
99
|
Label: LabelMeta,
|
|
100
100
|
SuccessMessage: SuccessMessageMeta,
|
|
101
101
|
ErrorMessage: ErrorMessageMeta,
|
|
@@ -126,7 +126,7 @@ export const registerComponentMetas = (
|
|
|
126
126
|
export const defaultPropsMetas: Record<string, WsComponentPropsMeta> = {
|
|
127
127
|
Slot: SlotMetaPropsMeta,
|
|
128
128
|
Fragment: FragmentMetaPropsMeta,
|
|
129
|
-
|
|
129
|
+
HtmlEmbed: HtmlEmbedMetaPropsMeta,
|
|
130
130
|
Box: BoxMetaPropsMeta,
|
|
131
131
|
Body: BodyMetaPropsMeta,
|
|
132
132
|
TextBlock: TextBlockMetaPropsMeta,
|
|
@@ -148,7 +148,7 @@ export const defaultPropsMetas: Record<string, WsComponentPropsMeta> = {
|
|
|
148
148
|
List: ListPropsMeta,
|
|
149
149
|
ListItem: ListItemPropsMeta,
|
|
150
150
|
Separator: SeparatorPropsMeta,
|
|
151
|
-
|
|
151
|
+
CodeText: CodeTextPropsMeta,
|
|
152
152
|
Label: LabelPropsMeta,
|
|
153
153
|
SuccessMessage: SuccessMessagePropsMeta,
|
|
154
154
|
ErrorMessage: ErrorMessagePropsMeta,
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { ComponentStory, ComponentMeta } from "@storybook/react";
|
|
2
|
-
import { Code as CodePrimitive } from "./code";
|
|
3
|
-
|
|
4
|
-
export default {
|
|
5
|
-
title: "Components/Code",
|
|
6
|
-
component: CodePrimitive,
|
|
7
|
-
} as ComponentMeta<typeof CodePrimitive>;
|
|
8
|
-
|
|
9
|
-
const Template: ComponentStory<typeof CodePrimitive> = (args) => (
|
|
10
|
-
<CodePrimitive {...args} />
|
|
11
|
-
);
|
|
12
|
-
|
|
13
|
-
export const Code = Template.bind({});
|
|
14
|
-
Code.args = {
|
|
15
|
-
children: "alert('Hello World!')",
|
|
16
|
-
};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { ComponentStory, ComponentMeta } from "@storybook/react";
|
|
2
|
-
import { Html as HtmlPrimitive } from "./html";
|
|
3
|
-
|
|
4
|
-
export default {
|
|
5
|
-
title: "Components/Html",
|
|
6
|
-
component: HtmlPrimitive,
|
|
7
|
-
} as ComponentMeta<typeof HtmlPrimitive>;
|
|
8
|
-
|
|
9
|
-
const Template: ComponentStory<typeof HtmlPrimitive> = (args) => (
|
|
10
|
-
<HtmlPrimitive {...args} />
|
|
11
|
-
);
|
|
12
|
-
|
|
13
|
-
export const Html = Template.bind({});
|
|
14
|
-
Html.args = {
|
|
15
|
-
code: "<strong>custom code</strong>",
|
|
16
|
-
};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|