@webstudio-is/sdk-components-react 0.196.0 → 0.198.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.
Files changed (172) hide show
  1. package/lib/__generated__/image.props.js +1 -0
  2. package/lib/__generated__/vimeo-preview-image.props.js +6 -1
  3. package/lib/__generated__/vimeo.props.js +4 -5
  4. package/lib/__generated__/youtube.props.js +665 -0
  5. package/lib/blockquote.template.js +11 -0
  6. package/lib/blockquote.ws.js +5 -15
  7. package/lib/body.ws.js +1 -1
  8. package/lib/bold.ws.js +1 -1
  9. package/lib/box.ws.js +1 -1
  10. package/lib/button.ws.js +1 -1
  11. package/lib/checkbox.template.js +14 -0
  12. package/lib/checkbox.ws.js +5 -25
  13. package/lib/code-text.ws.js +1 -1
  14. package/lib/components.js +35 -33
  15. package/lib/content-embed.template.js +83 -0
  16. package/lib/form.ws.js +1 -1
  17. package/lib/heading.template.js +11 -0
  18. package/lib/heading.ws.js +12 -22
  19. package/lib/image.ws.js +17 -22
  20. package/lib/input.ws.js +1 -1
  21. package/lib/italic.ws.js +1 -1
  22. package/lib/label.template.js +10 -0
  23. package/lib/label.ws.js +13 -28
  24. package/lib/link.template.js +11 -0
  25. package/lib/link.ws.js +3 -13
  26. package/lib/list-item.template.js +11 -0
  27. package/lib/list-item.ws.js +8 -18
  28. package/lib/list.ws.js +1 -1
  29. package/lib/markdown-embed.js +10 -5
  30. package/lib/markdown-embed.template.js +75 -0
  31. package/lib/markdown-embed.ws.js +9 -87
  32. package/lib/metas.js +59 -59
  33. package/lib/option.ws.js +4 -5
  34. package/lib/paragraph.template.js +11 -0
  35. package/lib/paragraph.ws.js +10 -20
  36. package/lib/props.js +32 -30
  37. package/lib/radio-button.template.js +14 -0
  38. package/lib/radio-button.ws.js +7 -27
  39. package/lib/rich-text-link.ws.js +3 -5
  40. package/lib/select.template.js +16 -0
  41. package/lib/select.ws.js +11 -63
  42. package/lib/separator.ws.js +1 -1
  43. package/lib/span.ws.js +1 -1
  44. package/lib/subscript.ws.js +1 -1
  45. package/lib/superscript.ws.js +1 -1
  46. package/lib/templates.js +34 -6
  47. package/lib/text.template.js +11 -0
  48. package/lib/text.ws.js +9 -25
  49. package/lib/textarea.ws.js +1 -1
  50. package/lib/time.ws.js +1 -1
  51. package/lib/types/__generated__/blockquote.props.d.ts +1 -1
  52. package/lib/types/__generated__/body.props.d.ts +1 -1
  53. package/lib/types/__generated__/bold.props.d.ts +1 -1
  54. package/lib/types/__generated__/box.props.d.ts +1 -1
  55. package/lib/types/__generated__/button.props.d.ts +1 -1
  56. package/lib/types/__generated__/checkbox.props.d.ts +1 -1
  57. package/lib/types/__generated__/code-text.props.d.ts +1 -1
  58. package/lib/types/__generated__/form.props.d.ts +1 -1
  59. package/lib/types/__generated__/fragment.props.d.ts +1 -1
  60. package/lib/types/__generated__/heading.props.d.ts +1 -1
  61. package/lib/types/__generated__/html-embed.props.d.ts +1 -1
  62. package/lib/types/__generated__/image.props.d.ts +1 -1
  63. package/lib/types/__generated__/input.props.d.ts +1 -1
  64. package/lib/types/__generated__/italic.props.d.ts +1 -1
  65. package/lib/types/__generated__/label.props.d.ts +1 -1
  66. package/lib/types/__generated__/link.props.d.ts +1 -1
  67. package/lib/types/__generated__/list-item.props.d.ts +1 -1
  68. package/lib/types/__generated__/list.props.d.ts +1 -1
  69. package/lib/types/__generated__/markdown-embed.props.d.ts +1 -1
  70. package/lib/types/__generated__/option.props.d.ts +1 -1
  71. package/lib/types/__generated__/paragraph.props.d.ts +1 -1
  72. package/lib/types/__generated__/radio-button.props.d.ts +1 -1
  73. package/lib/types/__generated__/rich-text-link.props.d.ts +1 -1
  74. package/lib/types/__generated__/select.props.d.ts +1 -1
  75. package/lib/types/__generated__/separator.props.d.ts +1 -1
  76. package/lib/types/__generated__/slot.props.d.ts +1 -1
  77. package/lib/types/__generated__/span.props.d.ts +1 -1
  78. package/lib/types/__generated__/subscript.props.d.ts +1 -1
  79. package/lib/types/__generated__/superscript.props.d.ts +1 -1
  80. package/lib/types/__generated__/text.props.d.ts +1 -1
  81. package/lib/types/__generated__/textarea.props.d.ts +1 -1
  82. package/lib/types/__generated__/time.props.d.ts +1 -1
  83. package/lib/types/__generated__/vimeo-play-button.props.d.ts +1 -1
  84. package/lib/types/__generated__/vimeo-preview-image.props.d.ts +1 -1
  85. package/lib/types/__generated__/vimeo-spinner.props.d.ts +1 -1
  86. package/lib/types/__generated__/vimeo.props.d.ts +1 -1
  87. package/lib/types/__generated__/webhook-form.props.d.ts +1 -1
  88. package/lib/types/__generated__/xml-node.props.d.ts +1 -1
  89. package/lib/types/__generated__/xml-time.props.d.ts +1 -1
  90. package/lib/types/__generated__/youtube.props.d.ts +2 -0
  91. package/lib/types/blockquote.template.d.ts +2 -0
  92. package/lib/types/blockquote.ws.d.ts +1 -1
  93. package/lib/types/body.ws.d.ts +1 -1
  94. package/lib/types/bold.ws.d.ts +1 -1
  95. package/lib/types/box.ws.d.ts +1 -1
  96. package/lib/types/button.ws.d.ts +1 -1
  97. package/lib/types/checkbox.d.ts +1 -1
  98. package/lib/types/checkbox.template.d.ts +2 -0
  99. package/lib/types/checkbox.ws.d.ts +1 -1
  100. package/lib/types/code-text.ws.d.ts +1 -1
  101. package/lib/types/components.d.ts +1 -0
  102. package/lib/types/content-embed.template.d.ts +2 -0
  103. package/lib/types/form.ws.d.ts +1 -1
  104. package/lib/types/fragment.ws.d.ts +1 -1
  105. package/lib/types/heading.template.d.ts +2 -0
  106. package/lib/types/heading.ws.d.ts +1 -1
  107. package/lib/types/html-embed.ws.d.ts +1 -1
  108. package/lib/types/image.ws.d.ts +1 -9
  109. package/lib/types/input.ws.d.ts +1 -1
  110. package/lib/types/italic.ws.d.ts +1 -1
  111. package/lib/types/label.template.d.ts +2 -0
  112. package/lib/types/label.ws.d.ts +1 -1
  113. package/lib/types/link.template.d.ts +2 -0
  114. package/lib/types/link.ws.d.ts +1 -1
  115. package/lib/types/list-item.template.d.ts +2 -0
  116. package/lib/types/list-item.ws.d.ts +1 -1
  117. package/lib/types/list.ws.d.ts +1 -1
  118. package/lib/types/markdown-embed.template.d.ts +2 -0
  119. package/lib/types/markdown-embed.ws.d.ts +1 -1
  120. package/lib/types/metas.d.ts +1 -1
  121. package/lib/types/option.ws.d.ts +1 -1
  122. package/lib/types/paragraph.template.d.ts +2 -0
  123. package/lib/types/paragraph.ws.d.ts +1 -1
  124. package/lib/types/props.d.ts +1 -0
  125. package/lib/types/radio-button.d.ts +1 -1
  126. package/lib/types/radio-button.template.d.ts +2 -0
  127. package/lib/types/radio-button.ws.d.ts +1 -1
  128. package/lib/types/rich-text-link.ws.d.ts +1 -1
  129. package/lib/types/select.template.d.ts +2 -0
  130. package/lib/types/select.ws.d.ts +1 -1
  131. package/lib/types/separator.ws.d.ts +1 -1
  132. package/lib/types/slot.ws.d.ts +1 -1
  133. package/lib/types/span.ws.d.ts +1 -1
  134. package/lib/types/subscript.ws.d.ts +1 -1
  135. package/lib/types/superscript.ws.d.ts +1 -1
  136. package/lib/types/templates.d.ts +14 -0
  137. package/lib/types/text.template.d.ts +2 -0
  138. package/lib/types/text.ws.d.ts +1 -1
  139. package/lib/types/textarea.ws.d.ts +1 -1
  140. package/lib/types/time.ws.d.ts +1 -1
  141. package/lib/types/vimeo-play-button.ws.d.ts +1 -1
  142. package/lib/types/vimeo-preview-image.d.ts +21 -21
  143. package/lib/types/vimeo-preview-image.ws.d.ts +1 -1
  144. package/lib/types/vimeo-spinner.ws.d.ts +1 -1
  145. package/lib/types/vimeo.d.ts +12 -2
  146. package/lib/types/vimeo.ws.d.ts +1 -1
  147. package/lib/types/webhook-form.d.ts +1 -0
  148. package/lib/types/webhook-form.template.d.ts +2 -0
  149. package/lib/types/webhook-form.ws.d.ts +1 -1
  150. package/lib/types/xml-node.ws.d.ts +1 -1
  151. package/lib/types/xml-time.ws.d.ts +1 -1
  152. package/lib/types/youtube.d.ts +143 -0
  153. package/lib/types/youtube.template.d.ts +2 -0
  154. package/lib/types/youtube.ws.d.ts +3 -0
  155. package/lib/vimeo-play-button.ws.js +8 -8
  156. package/lib/vimeo-preview-image.ws.js +17 -9
  157. package/lib/vimeo-spinner.ws.js +8 -8
  158. package/lib/vimeo.js +88 -87
  159. package/lib/vimeo.template.js +17 -16
  160. package/lib/vimeo.ws.js +8 -7
  161. package/lib/webhook-form.template.js +49 -0
  162. package/lib/webhook-form.ws.js +17 -118
  163. package/lib/xml-node.js +18 -14
  164. package/lib/xml-node.ws.js +4 -5
  165. package/lib/xml-time.ws.js +4 -5
  166. package/lib/youtube.js +200 -0
  167. package/lib/youtube.template.js +97 -0
  168. package/lib/youtube.ws.js +51 -0
  169. package/package.json +14 -11
  170. package/lib/content-embed.ws.js +0 -77
  171. package/lib/types/__generated__/local-date.props.d.ts +0 -2
  172. package/lib/types/content-embed.ws.d.ts +0 -2
@@ -1,16 +1,16 @@
1
- import { defaultStates as t } from "@webstudio-is/react-sdk";
2
- import { props as o } from "./__generated__/vimeo-play-button.props.js";
3
- import { ButtonElementIcon as e } from "@webstudio-is/icons/svg";
4
- import { button as n } from "@webstudio-is/sdk/normalize.css";
1
+ import { defaultStates as t } from "@webstudio-is/sdk";
2
+ import { ButtonElementIcon as o } from "@webstudio-is/icons/svg";
3
+ import { button as e } from "@webstudio-is/sdk/normalize.css";
4
+ import { props as n } from "./__generated__/vimeo-play-button.props.js";
5
5
  const r = {
6
- button: n
6
+ button: e
7
7
  }, p = {
8
8
  category: "hidden",
9
9
  type: "container",
10
10
  constraints: [
11
11
  {
12
12
  relation: "ancestor",
13
- component: { $eq: "Vimeo" }
13
+ component: { $in: ["Vimeo", "YouTube"] }
14
14
  },
15
15
  {
16
16
  relation: "ancestor",
@@ -18,11 +18,11 @@ const r = {
18
18
  }
19
19
  ],
20
20
  label: "Play Button",
21
- icon: e,
21
+ icon: o,
22
22
  presetStyle: r,
23
23
  states: t
24
24
  }, c = {
25
- props: o,
25
+ props: n,
26
26
  initialProps: ["id", "className"]
27
27
  };
28
28
  export {
@@ -1,19 +1,27 @@
1
- import "@webstudio-is/react-sdk";
2
- import { meta as o, propsOverrides as r, propsMeta as e } from "./image.ws.js";
3
- import { props as t } from "./__generated__/vimeo-preview-image.props.js";
1
+ import { meta as e, propsMeta as o } from "./image.ws.js";
2
+ import { props as r } from "./__generated__/vimeo-preview-image.props.js";
4
3
  const i = {
5
- ...o,
4
+ ...e,
6
5
  category: "hidden",
7
6
  label: "Preview Image",
8
7
  constraints: {
9
8
  relation: "ancestor",
10
- component: { $eq: "Vimeo" }
9
+ component: { $in: ["Vimeo", "YouTube"] }
11
10
  }
12
- }, m = {
13
- props: { ...t, ...r },
14
- initialProps: e.initialProps
11
+ }, p = {
12
+ props: {
13
+ ...r,
14
+ // Automatically generated props don't have the right control.
15
+ src: {
16
+ type: "string",
17
+ control: "file",
18
+ label: "Source",
19
+ required: !1
20
+ }
21
+ },
22
+ initialProps: o.initialProps
15
23
  };
16
24
  export {
17
25
  i as meta,
18
- m as propsMeta
26
+ p as propsMeta
19
27
  };
@@ -1,22 +1,22 @@
1
- import { defaultStates as o } from "@webstudio-is/react-sdk";
2
- import { props as t } from "./__generated__/vimeo-spinner.props.js";
3
- import { div as e } from "@webstudio-is/sdk/normalize.css";
4
- import { BoxIcon as r } from "@webstudio-is/icons/svg";
1
+ import { defaultStates as o } from "@webstudio-is/sdk";
2
+ import { div as t } from "@webstudio-is/sdk/normalize.css";
3
+ import { BoxIcon as e } from "@webstudio-is/icons/svg";
4
+ import { props as r } from "./__generated__/vimeo-spinner.props.js";
5
5
  const n = {
6
- div: e
6
+ div: t
7
7
  }, m = {
8
8
  type: "container",
9
9
  constraints: {
10
10
  relation: "ancestor",
11
- component: { $eq: "Vimeo" }
11
+ component: { $in: ["Vimeo", "YouTube"] }
12
12
  },
13
- icon: r,
13
+ icon: e,
14
14
  states: o,
15
15
  presetStyle: n,
16
16
  category: "hidden",
17
17
  label: "Spinner"
18
18
  }, c = {
19
- props: t,
19
+ props: r,
20
20
  initialProps: ["id", "className"]
21
21
  };
22
22
  export {
package/lib/vimeo.js CHANGED
@@ -1,19 +1,19 @@
1
- import { jsx as s, jsxs as F, Fragment as z } from "react/jsx-runtime";
2
- import { colord as T } from "colord";
3
- import { createContext as q, forwardRef as G, useState as h, useContext as H, useEffect as u } from "react";
4
- import { ReactSdkContext as Y } from "@webstudio-is/react-sdk/runtime";
5
- const J = (e) => {
1
+ import { jsx as s, jsxs as D, Fragment as F } from "react/jsx-runtime";
2
+ import { colord as z } from "colord";
3
+ import { createContext as T, forwardRef as q, useState as v, useContext as G, useEffect as f } from "react";
4
+ import { ReactSdkContext as H } from "@webstudio-is/react-sdk/runtime";
5
+ const Y = (e) => {
6
6
  if (e.url === void 0)
7
7
  return;
8
8
  let t;
9
9
  try {
10
10
  const o = new URL(e.url);
11
- t = new URL(x), t.pathname = `/video${o.pathname}`;
11
+ t = new URL(R), t.pathname = `/video${o.pathname}`;
12
12
  } catch {
13
13
  }
14
14
  if (t === void 0)
15
15
  return;
16
- const r = {
16
+ const a = {
17
17
  showPortrait: "portrait",
18
18
  showByline: "byline",
19
19
  showTitle: "title",
@@ -23,36 +23,36 @@ const J = (e) => {
23
23
  backgroundMode: "background",
24
24
  doNotTrack: "dnt"
25
25
  };
26
- let n;
27
- for (n in e) {
28
- const o = e[n];
29
- if (n === "url" || o === void 0)
26
+ let r;
27
+ for (r in e) {
28
+ const o = e[r];
29
+ if (r === "url" || o === void 0)
30
30
  continue;
31
- const a = r[n] ?? n;
32
- t.searchParams.append(a, o.toString());
31
+ const i = a[r] ?? r;
32
+ t.searchParams.append(i, o.toString());
33
33
  }
34
34
  if (t.searchParams.set("autoplay", "true"), typeof e.controlsColor == "string") {
35
- const o = T(e.controlsColor).toHex().replace("#", "");
35
+ const o = z(e.controlsColor).toHex().replace("#", "");
36
36
  t.searchParams.set("color", o);
37
37
  }
38
38
  return e.showPortrait && t.searchParams.set("title", "true"), e.showByline && (t.searchParams.set("portrait", "true"), t.searchParams.set("title", "true")), t.toString();
39
- }, f = (e) => {
39
+ }, h = (e) => {
40
40
  const t = document.createElement("link");
41
41
  t.rel = "preconnect", t.href = e, t.crossOrigin = "true", document.head.appendChild(t);
42
42
  };
43
- let I = !1;
44
- const K = "https://f.vimeocdn.com", x = "https://player.vimeo.com", b = "https://i.vimeocdn.com", Q = () => {
45
- I || window.matchMedia("(hover: none)").matches || (f(K), f(x), f(b), I = !0);
46
- }, W = (e) => {
43
+ let b = !1;
44
+ const J = "https://f.vimeocdn.com", R = "https://player.vimeo.com", U = "https://i.vimeocdn.com", K = () => {
45
+ b || window.matchMedia("(hover: none)").matches || (h(J), h(R), h(U), b = !0);
46
+ }, Q = (e) => {
47
47
  try {
48
- const r = new URL(e).pathname.split("/")[2];
49
- return r === "" || r == null ? void 0 : r;
48
+ const a = new URL(e).pathname.split("/")[2];
49
+ return a === "" || a == null ? void 0 : a;
50
50
  } catch {
51
51
  }
52
- }, X = async (e) => {
53
- const r = `https://vimeo.com/api/v2/video/${W(e)}.json`, o = (await (await fetch(r)).json())[0].thumbnail_large, a = o.substr(o.lastIndexOf("/") + 1).split("_")[0], i = new URL(b);
54
- return i.pathname = `/video/${a}.webp`, i.searchParams.append("mw", "1100"), i.searchParams.append("mh", "619"), i.searchParams.append("q", "70"), i;
55
- }, Z = () => /* @__PURE__ */ s(
52
+ }, W = async (e) => {
53
+ const a = `https://vimeo.com/api/v2/video/${Q(e)}.json`, o = (await (await fetch(a)).json())[0].thumbnail_large, i = o.substr(o.lastIndexOf("/") + 1).split("_")[0], n = new URL(U);
54
+ return n.pathname = `/video/${i}.webp`, n.searchParams.append("mw", "1100"), n.searchParams.append("mh", "619"), n.searchParams.append("q", "70"), n;
55
+ }, X = () => /* @__PURE__ */ s(
56
56
  "div",
57
57
  {
58
58
  style: {
@@ -65,72 +65,73 @@ const K = "https://f.vimeocdn.com", x = "https://player.vimeo.com", b = "https:/
65
65
  },
66
66
  children: 'Open the "Settings" panel and paste a video URL, e.g. https://vimeo.com/831343124.'
67
67
  }
68
- ), tt = ({
69
- status: e,
70
- loading: t,
68
+ ), Z = ({
69
+ title: e,
70
+ status: t,
71
+ loading: a,
71
72
  videoUrl: r,
72
- previewImageUrl: n,
73
- autoplay: o,
74
- renderer: a,
75
- showPreview: i,
73
+ previewImageUrl: o,
74
+ autoplay: i,
75
+ renderer: n,
76
+ showPreview: d,
76
77
  onStatusChange: c,
77
78
  onPreviewImageUrlChange: l
78
79
  }) => {
79
- const [m, p] = h(0);
80
- if (u(() => {
81
- o && a !== "canvas" && e === "initial" && c("loading");
82
- }, [o, e, a, c]), u(() => {
83
- a !== "canvas" && Q();
84
- }, [a]), u(() => {
80
+ const [p, u] = v(0);
81
+ if (f(() => {
82
+ i && n !== "canvas" && t === "initial" && c("loading");
83
+ }, [i, t, n, c]), f(() => {
84
+ n !== "canvas" && K();
85
+ }, [n]), f(() => {
85
86
  if (r !== void 0) {
86
- if (i === !1) {
87
+ if (d === !1) {
87
88
  l(void 0);
88
89
  return;
89
90
  }
90
- n === void 0 && X(r).then(l).catch(() => {
91
+ o === void 0 && W(r).then(l).catch(() => {
91
92
  console.error(`Could not load preview image for ${r}`);
92
93
  });
93
94
  }
94
- }, [l, i, r, n]), !(a === "canvas" || e === "initial"))
95
+ }, [l, d, r, o]), !(n === "canvas" || t === "initial"))
95
96
  return /* @__PURE__ */ s(
96
97
  "iframe",
97
98
  {
99
+ title: e,
98
100
  src: r,
99
- loading: t,
101
+ loading: a,
100
102
  allow: "accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture;",
101
103
  allowFullScreen: !0,
102
104
  style: {
103
105
  position: "absolute",
104
106
  width: "100%",
105
107
  height: "100%",
106
- opacity: m,
108
+ opacity: p,
107
109
  transition: "opacity 1s",
108
110
  border: "none"
109
111
  },
110
112
  onLoad: () => {
111
- c("ready"), p(1);
113
+ c("ready"), u(1);
112
114
  }
113
115
  }
114
116
  );
115
- }, et = q({
117
+ }, tt = T({
116
118
  onInitPlayer: () => {
117
119
  },
118
120
  status: "initial"
119
- }), rt = G(
121
+ }), et = q(
120
122
  ({
121
123
  url: e,
122
124
  loading: t = "lazy",
123
- autoplay: r = !1,
124
- autopause: n = !0,
125
- backgroundMode: o = !1,
126
- showByline: a = !1,
125
+ autoplay: a = !1,
126
+ autopause: r = !0,
127
+ showByline: o = !1,
127
128
  showControls: i = !0,
128
- doNotTrack: c = !1,
129
- keyboard: l = !0,
130
- loop: m = !1,
131
- muted: p = !1,
132
- pip: R = !1,
133
- playsinline: U = !0,
129
+ doNotTrack: n = !1,
130
+ keyboard: d = !0,
131
+ loop: c = !1,
132
+ muted: l = !1,
133
+ pip: p = !1,
134
+ playsinline: u = !0,
134
135
  showPortrait: S = !0,
135
136
  quality: L = "auto",
136
137
  responsive: k = !0,
@@ -143,22 +144,21 @@ const K = "https://f.vimeocdn.com", x = "https://player.vimeo.com", b = "https:/
143
144
  interactiveParams: V,
144
145
  texttrack: $,
145
146
  children: A,
146
- ...B
147
- }, d) => {
148
- const [v, y] = h("initial"), [w, D] = h(), { renderer: g } = H(Y), P = J({
147
+ ...y
148
+ }, m) => {
149
+ const [w, g] = v("initial"), [P, B] = v(), { renderer: C } = G(H), I = Y({
149
150
  url: e,
150
- autoplay: r,
151
- autopause: n,
152
- backgroundMode: o,
151
+ autoplay: a,
152
+ autopause: r,
153
153
  showControls: i,
154
154
  controlsColor: O,
155
- doNotTrack: c,
155
+ doNotTrack: n,
156
156
  interactiveParams: V,
157
- keyboard: l,
158
- loop: m,
159
- muted: p,
160
- pip: R,
161
- playsinline: U,
157
+ keyboard: d,
158
+ loop: c,
159
+ muted: l,
160
+ pip: p,
161
+ playsinline: u,
162
162
  quality: L,
163
163
  responsive: k,
164
164
  speed: E,
@@ -169,36 +169,37 @@ const K = "https://f.vimeocdn.com", x = "https://player.vimeo.com", b = "https:/
169
169
  autopip: N
170
170
  });
171
171
  return /* @__PURE__ */ s(
172
- et.Provider,
172
+ tt.Provider,
173
173
  {
174
174
  value: {
175
- status: v,
176
- previewImageUrl: w,
175
+ status: w,
176
+ previewImageUrl: P,
177
177
  onInitPlayer() {
178
- g !== "canvas" && y("loading");
178
+ C !== "canvas" && g("loading");
179
179
  }
180
180
  },
181
181
  children: /* @__PURE__ */ s(
182
182
  "div",
183
183
  {
184
- ...B,
185
- ref: (C) => {
186
- d !== null && (typeof d == "function" ? d(C) : d.current = C);
184
+ ...y,
185
+ ref: (x) => {
186
+ m !== null && (typeof m == "function" ? m(x) : m.current = x);
187
187
  },
188
- children: P === void 0 ? /* @__PURE__ */ s(Z, {}) : /* @__PURE__ */ F(z, { children: [
188
+ children: I === void 0 ? /* @__PURE__ */ s(X, {}) : /* @__PURE__ */ D(F, { children: [
189
189
  A,
190
190
  /* @__PURE__ */ s(
191
- tt,
191
+ Z,
192
192
  {
193
- autoplay: r,
194
- videoUrl: P,
195
- previewImageUrl: w,
193
+ title: y.title,
194
+ autoplay: a,
195
+ videoUrl: I,
196
+ previewImageUrl: P,
196
197
  loading: t,
197
198
  showPreview: M,
198
- renderer: g,
199
- status: v,
200
- onStatusChange: y,
201
- onPreviewImageUrlChange: D
199
+ renderer: C,
200
+ status: w,
201
+ onStatusChange: g,
202
+ onPreviewImageUrlChange: B
202
203
  }
203
204
  )
204
205
  ] })
@@ -208,8 +209,8 @@ const K = "https://f.vimeocdn.com", x = "https://player.vimeo.com", b = "https:/
208
209
  );
209
210
  }
210
211
  );
211
- rt.displayName = "Vimeo";
212
+ et.displayName = "Vimeo";
212
213
  export {
213
- rt as Vimeo,
214
- et as VimeoContext
214
+ et as Vimeo,
215
+ tt as VimeoContext
215
216
  };
@@ -1,6 +1,6 @@
1
- import { jsxs as i, jsx as o } from "react/jsx-runtime";
2
- import { SpinnerIcon as r, PlayIcon as a } from "@webstudio-is/icons/svg";
3
- import { $ as e, css as t } from "@webstudio-is/template";
1
+ import { jsxs as i, jsx as t } from "react/jsx-runtime";
2
+ import { SpinnerIcon as r, PlayIcon as n } from "@webstudio-is/icons/svg";
3
+ import { $ as e, css as o } from "@webstudio-is/template";
4
4
  const p = {
5
5
  category: "media",
6
6
  order: 1,
@@ -8,32 +8,33 @@ const p = {
8
8
  template: /* @__PURE__ */ i(
9
9
  e.Vimeo,
10
10
  {
11
- "ws:style": t`
11
+ "ws:style": o`
12
12
  position: relative;
13
13
  aspect-ratio: 640/360;
14
14
  width: 100%;
15
15
  `,
16
16
  children: [
17
- /* @__PURE__ */ o(
17
+ /* @__PURE__ */ t(
18
18
  e.VimeoPreviewImage,
19
19
  {
20
- "ws:style": t`
20
+ "ws:style": o`
21
21
  position: absolute;
22
22
  object-fit: cover;
23
- object-position: cover;
23
+ object-position: center;
24
24
  width: 100%;
25
25
  height: 100%;
26
26
  border-radius: 20px;
27
27
  `,
28
28
  alt: "Vimeo video preview image",
29
- sizes: "100vw"
29
+ sizes: "100vw",
30
+ optimize: !0
30
31
  }
31
32
  ),
32
- /* @__PURE__ */ o(
33
+ /* @__PURE__ */ t(
33
34
  e.VimeoSpinner,
34
35
  {
35
36
  "ws:label": "Spinner",
36
- "ws:style": t`
37
+ "ws:style": o`
37
38
  position: absolute;
38
39
  top: 50%;
39
40
  left: 50%;
@@ -42,13 +43,13 @@ const p = {
42
43
  margin-top: -35px;
43
44
  margin-left: -35px;
44
45
  `,
45
- children: /* @__PURE__ */ o(e.HtmlEmbed, { "ws:label": "Spinner SVG", code: r })
46
+ children: /* @__PURE__ */ t(e.HtmlEmbed, { "ws:label": "Spinner SVG", code: r })
46
47
  }
47
48
  ),
48
- /* @__PURE__ */ o(
49
+ /* @__PURE__ */ t(
49
50
  e.VimeoPlayButton,
50
51
  {
51
- "ws:style": t`
52
+ "ws:style": o`
52
53
  position: absolute;
53
54
  width: 140px;
54
55
  height: 80px;
@@ -69,16 +70,16 @@ const p = {
69
70
  }
70
71
  `,
71
72
  "aria-label": "Play button",
72
- children: /* @__PURE__ */ o(
73
+ children: /* @__PURE__ */ t(
73
74
  e.Box,
74
75
  {
75
76
  "ws:label": "Play Icon",
76
- "ws:style": t`
77
+ "ws:style": o`
77
78
  width: 60px;
78
79
  height: 60px;
79
80
  `,
80
81
  "aria-hidden": !0,
81
- children: /* @__PURE__ */ o(e.HtmlEmbed, { "ws:label": "Play SVG", code: a })
82
+ children: /* @__PURE__ */ t(e.HtmlEmbed, { "ws:label": "Play SVG", code: n })
82
83
  }
83
84
  )
84
85
  }
package/lib/vimeo.ws.js CHANGED
@@ -1,22 +1,23 @@
1
1
  import { VimeoIcon as o } from "@webstudio-is/icons/svg";
2
- import { defaultStates as t } from "@webstudio-is/react-sdk";
2
+ import { defaultStates as t } from "@webstudio-is/sdk";
3
3
  import { div as r } from "@webstudio-is/sdk/normalize.css";
4
- import { props as n } from "./__generated__/vimeo.props.js";
5
- const i = {
4
+ import { props as i } from "./__generated__/vimeo.props.js";
5
+ const n = {
6
6
  div: r
7
7
  }, c = {
8
8
  type: "container",
9
9
  icon: o,
10
10
  states: t,
11
- presetStyle: i,
11
+ presetStyle: n,
12
12
  constraints: {
13
13
  relation: "ancestor",
14
14
  component: { $nin: ["Button", "Link", "Heading"] }
15
15
  }
16
- }, s = [
16
+ }, e = [
17
17
  "id",
18
18
  "className",
19
19
  "url",
20
+ "title",
20
21
  "quality",
21
22
  "loading",
22
23
  "showPreview",
@@ -30,8 +31,8 @@ const i = {
30
31
  "showControls",
31
32
  "controlsColor"
32
33
  ], m = {
33
- props: n,
34
- initialProps: s
34
+ props: i,
35
+ initialProps: e
35
36
  };
36
37
  export {
37
38
  c as meta,
@@ -0,0 +1,49 @@
1
+ import { jsxs as r, jsx as t } from "react/jsx-runtime";
2
+ import { Variable as s, $ as e, expression as o, ActionValue as i, PlaceholderValue as a } from "@webstudio-is/template";
3
+ const n = new s("formState", "initial"), w = {
4
+ category: "data",
5
+ order: 1,
6
+ description: "Collect user data and send it to any webhook.",
7
+ template: /* @__PURE__ */ r(
8
+ e.Form,
9
+ {
10
+ state: o`${n}`,
11
+ onStateChange: new i(["state"], o`${n} = state`),
12
+ children: [
13
+ /* @__PURE__ */ r(
14
+ e.Box,
15
+ {
16
+ "ws:label": "Form Content",
17
+ "ws:show": o`${n} === 'initial' || ${n} === 'error'`,
18
+ children: [
19
+ /* @__PURE__ */ t(e.Label, { children: new a("Name") }),
20
+ /* @__PURE__ */ t(e.Input, { name: "name" }),
21
+ /* @__PURE__ */ t(e.Label, { children: new a("Email") }),
22
+ /* @__PURE__ */ t(e.Input, { name: "email" }),
23
+ /* @__PURE__ */ t(e.Button, { children: new a("Submit") })
24
+ ]
25
+ }
26
+ ),
27
+ /* @__PURE__ */ t(
28
+ e.Box,
29
+ {
30
+ "ws:label": "Success Message",
31
+ "ws:show": o`${n} === 'success'`,
32
+ children: new a("Thank you for getting in touch!")
33
+ }
34
+ ),
35
+ /* @__PURE__ */ t(
36
+ e.Box,
37
+ {
38
+ "ws:label": "Error Message",
39
+ "ws:show": o`${n} === 'error'`,
40
+ children: new a("Sorry, something went wrong.")
41
+ }
42
+ )
43
+ ]
44
+ }
45
+ )
46
+ };
47
+ export {
48
+ w as meta
49
+ };