@webstudio-is/sdk-components-react 0.86.0 → 0.87.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.
@@ -72,7 +72,7 @@ const HtmlEmbed = (0, import_react.forwardRef)((props, ref) => {
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" && executeScriptOnCanvas === true) {
75
+ if (renderer === "canvas" && executeScriptOnCanvas === true || renderer === "preview") {
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 });
@@ -35,6 +35,10 @@ const meta = {
35
35
  const propsMeta = {
36
36
  props: {
37
37
  ...import_html_embed.props,
38
+ executeScriptOnCanvas: {
39
+ ...import_html_embed.props.executeScriptOnCanvas,
40
+ label: "Run script on canvas"
41
+ },
38
42
  code: {
39
43
  required: true,
40
44
  control: "code",
package/lib/html-embed.js CHANGED
@@ -54,7 +54,7 @@ const HtmlEmbed = forwardRef((props, ref) => {
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" && executeScriptOnCanvas === true) {
57
+ if (renderer === "canvas" && executeScriptOnCanvas === true || renderer === "preview") {
58
58
  return /* @__PURE__ */ jsx(ExecutableHtml, { innerRef: ref, code, ...rest });
59
59
  }
60
60
  return /* @__PURE__ */ jsx(InnerHtml, { innerRef: ref, code, ...rest });
@@ -11,6 +11,10 @@ const meta = {
11
11
  const propsMeta = {
12
12
  props: {
13
13
  ...props,
14
+ executeScriptOnCanvas: {
15
+ ...props.executeScriptOnCanvas,
16
+ label: "Run script on canvas"
17
+ },
14
18
  code: {
15
19
  required: true,
16
20
  control: "code",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webstudio-is/sdk-components-react",
3
- "version": "0.86.0",
3
+ "version": "0.87.0",
4
4
  "description": "Webstudio default library for react",
5
5
  "author": "Webstudio <github@webstudio.is>",
6
6
  "homepage": "https://webstudio.is",
@@ -37,18 +37,18 @@
37
37
  "react-dom": "^18.2.0"
38
38
  },
39
39
  "dependencies": {
40
- "@react-aria/utils": "^3.18.0",
40
+ "@react-aria/utils": "^3.19.0",
41
41
  "colord": "^2.9.3",
42
42
  "shallow-equal": "^3.1.0",
43
- "@webstudio-is/css-vars": "^0.86.0",
44
- "@webstudio-is/generate-arg-types": "^0.86.0",
45
- "@webstudio-is/icons": "^0.86.0",
46
- "@webstudio-is/image": "^0.86.0",
47
- "@webstudio-is/react-sdk": "^0.86.0"
43
+ "@webstudio-is/css-vars": "^0.87.0",
44
+ "@webstudio-is/generate-arg-types": "^0.87.0",
45
+ "@webstudio-is/icons": "^0.87.0",
46
+ "@webstudio-is/image": "^0.87.0",
47
+ "@webstudio-is/react-sdk": "^0.87.0"
48
48
  },
49
49
  "devDependencies": {
50
50
  "@storybook/react": "^7.2.1",
51
- "@types/react": "^18.2.16",
51
+ "@types/react": "^18.2.20",
52
52
  "@types/react-dom": "^18.2.7",
53
53
  "react": "^18.2.0",
54
54
  "react-dom": "^18.2.0",
@@ -86,7 +86,10 @@ export const HtmlEmbed = forwardRef<HTMLDivElement, Props>((props, ref) => {
86
86
  return <Placeholder innerRef={ref} {...rest} />;
87
87
  }
88
88
 
89
- if (renderer === "canvas" && executeScriptOnCanvas === true) {
89
+ if (
90
+ (renderer === "canvas" && executeScriptOnCanvas === true) ||
91
+ renderer === "preview"
92
+ ) {
90
93
  return <ExecutableHtml innerRef={ref} code={code} {...rest} />;
91
94
  }
92
95
 
@@ -17,6 +17,11 @@ export const meta: WsComponentMeta = {
17
17
  export const propsMeta: WsComponentPropsMeta = {
18
18
  props: {
19
19
  ...props,
20
+
21
+ executeScriptOnCanvas: {
22
+ ...props.executeScriptOnCanvas,
23
+ label: "Run script on canvas",
24
+ },
20
25
  code: {
21
26
  required: true,
22
27
  control: "code",