@webstudio-is/sdk-components-react 0.206.0 → 0.207.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.
@@ -66,6 +66,7 @@ export type VimeoOptions = Omit<VimeoPlayerOptions, "dnt" | "interactive_params"
66
66
  /** Whether to display the video owner's portrait. Only works if either title or byline are also enabled */
67
67
  showPortrait?: VimeoPlayerOptions["portrait"];
68
68
  };
69
+ export declare const requestFullscreen: (element: HTMLIFrameElement) => void;
69
70
  type PlayerStatus = "initial" | "loading" | "ready";
70
71
  export declare const VimeoContext: import("react").Context<{
71
72
  previewImageUrl?: URL;
package/lib/vimeo.js CHANGED
@@ -1,19 +1,19 @@
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) => {
1
+ import { jsx as s, jsxs as q, Fragment as A } from "react/jsx-runtime";
2
+ import { colord as B } from "colord";
3
+ import { createContext as T, forwardRef as z, useState as y, useContext as G, useRef as H, useEffect as v } from "react";
4
+ import { ReactSdkContext as Y } from "@webstudio-is/react-sdk/runtime";
5
+ const J = (e) => {
6
6
  if (e.url === void 0)
7
7
  return;
8
8
  let t;
9
9
  try {
10
- const o = new URL(e.url);
11
- t = new URL(R), t.pathname = `/video${o.pathname}`;
10
+ const n = new URL(e.url);
11
+ t = new URL(M), t.pathname = `/video${n.pathname}`;
12
12
  } catch {
13
13
  }
14
14
  if (t === void 0)
15
15
  return;
16
- const a = {
16
+ const r = {
17
17
  showPortrait: "portrait",
18
18
  showByline: "byline",
19
19
  showTitle: "title",
@@ -23,36 +23,36 @@ const Y = (e) => {
23
23
  backgroundMode: "background",
24
24
  doNotTrack: "dnt"
25
25
  };
26
- let r;
27
- for (r in e) {
28
- const o = e[r];
29
- if (r === "url" || o === void 0)
26
+ let o;
27
+ for (o in e) {
28
+ const n = e[o];
29
+ if (o === "url" || n === void 0)
30
30
  continue;
31
- const i = a[r] ?? r;
32
- t.searchParams.append(i, o.toString());
31
+ const i = r[o] ?? o;
32
+ t.searchParams.append(i, n.toString());
33
33
  }
34
34
  if (t.searchParams.set("autoplay", "true"), typeof e.controlsColor == "string") {
35
- const o = z(e.controlsColor).toHex().replace("#", "");
36
- t.searchParams.set("color", o);
35
+ const n = B(e.controlsColor).toHex().replace("#", "");
36
+ t.searchParams.set("color", n);
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
- }, h = (e) => {
39
+ }, w = (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 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) => {
43
+ let U = !1;
44
+ const K = "https://f.vimeocdn.com", M = "https://player.vimeo.com", S = "https://i.vimeocdn.com", Q = () => {
45
+ U || window.matchMedia("(hover: none)").matches || (w(K), w(M), w(S), U = !0);
46
+ }, W = (e) => {
47
47
  try {
48
- const a = new URL(e).pathname.split("/")[2];
49
- return a === "" || a == null ? void 0 : a;
48
+ const r = new URL(e).pathname.split("/")[2];
49
+ return r === "" || r == null ? void 0 : r;
50
50
  } catch {
51
51
  }
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(
52
+ }, X = async (e) => {
53
+ const r = `https://vimeo.com/api/v2/video/${W(e)}.json`, n = (await (await fetch(r)).json())[0].thumbnail_large, i = n.substr(n.lastIndexOf("/") + 1).split("_")[0], a = new URL(S);
54
+ return a.pathname = `/video/${i}.webp`, a.searchParams.append("mw", "1100"), a.searchParams.append("mh", "619"), a.searchParams.append("q", "70"), a;
55
+ }, Z = () => /* @__PURE__ */ s(
56
56
  "div",
57
57
  {
58
58
  style: {
@@ -65,141 +65,147 @@ const J = "https://f.vimeocdn.com", R = "https://player.vimeo.com", U = "https:/
65
65
  },
66
66
  children: 'Open the "Settings" panel and paste a video URL, e.g. https://vimeo.com/831343124.'
67
67
  }
68
- ), Z = ({
68
+ ), tt = (e) => {
69
+ const t = "ontouchstart" in window;
70
+ (window.matchMedia("(max-width: 1024px)").matches || t) && e.requestFullscreen();
71
+ }, et = ({
69
72
  title: e,
70
73
  status: t,
71
- loading: a,
72
- videoUrl: r,
73
- previewImageUrl: o,
74
+ loading: r,
75
+ videoUrl: o,
76
+ previewImageUrl: n,
74
77
  autoplay: i,
75
- renderer: n,
76
- showPreview: d,
78
+ renderer: a,
79
+ showPreview: u,
80
+ playsinline: f,
77
81
  onStatusChange: c,
78
82
  onPreviewImageUrlChange: l
79
83
  }) => {
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(() => {
86
- if (r !== void 0) {
87
- if (d === !1) {
84
+ const [m, h] = y(0), d = H(null);
85
+ if (v(() => {
86
+ i && a !== "canvas" && t === "initial" && c("loading");
87
+ }, [i, t, a, c]), v(() => {
88
+ a !== "canvas" && Q();
89
+ }, [a]), v(() => {
90
+ if (o !== void 0) {
91
+ if (u === !1) {
88
92
  l(void 0);
89
93
  return;
90
94
  }
91
- o === void 0 && W(r).then(l).catch(() => {
92
- console.error(`Could not load preview image for ${r}`);
95
+ n === void 0 && X(o).then(l).catch(() => {
96
+ console.error(`Could not load preview image for ${o}`);
93
97
  });
94
98
  }
95
- }, [l, d, r, o]), !(n === "canvas" || t === "initial"))
99
+ }, [l, u, o, n]), !(a === "canvas" || t === "initial"))
96
100
  return /* @__PURE__ */ s(
97
101
  "iframe",
98
102
  {
103
+ ref: d,
99
104
  title: e,
100
- src: r,
101
- loading: a,
105
+ src: o,
106
+ loading: r,
102
107
  allow: "accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture;",
103
108
  allowFullScreen: !0,
104
109
  style: {
105
110
  position: "absolute",
106
111
  width: "100%",
107
112
  height: "100%",
108
- opacity: p,
113
+ opacity: m,
109
114
  transition: "opacity 1s",
110
115
  border: "none"
111
116
  },
112
117
  onLoad: () => {
113
- c("ready"), u(1);
118
+ c("ready"), h(1), d.current && !f && !i && tt(d.current);
114
119
  }
115
120
  }
116
121
  );
117
- }, tt = T({
122
+ }, ot = T({
118
123
  onInitPlayer: () => {
119
124
  },
120
125
  status: "initial"
121
- }), et = q(
126
+ }), rt = z(
122
127
  ({
123
128
  url: e,
124
129
  loading: t = "lazy",
125
- autoplay: a = !1,
126
- autopause: r = !0,
127
- showByline: o = !1,
130
+ autoplay: r = !1,
131
+ autopause: o = !0,
132
+ showByline: n = !1,
128
133
  showControls: i = !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,
135
- showPortrait: S = !0,
136
- quality: L = "auto",
137
- responsive: k = !0,
138
- speed: E = !1,
139
- showTitle: _ = !1,
140
- transparent: j = !0,
141
- showPreview: M = !1,
142
- autopip: N,
143
- controlsColor: O,
144
- interactiveParams: V,
145
- texttrack: $,
146
- children: A,
147
- ...y
148
- }, m) => {
149
- const [w, g] = v("initial"), [P, B] = v(), { renderer: C } = G(H), I = Y({
134
+ doNotTrack: a = !1,
135
+ keyboard: u = !0,
136
+ loop: f = !1,
137
+ muted: c = !1,
138
+ pip: l = !1,
139
+ playsinline: m = !1,
140
+ showPortrait: h = !0,
141
+ quality: d = "auto",
142
+ responsive: L = !0,
143
+ speed: k = !1,
144
+ showTitle: E = !1,
145
+ transparent: _ = !0,
146
+ showPreview: j = !1,
147
+ autopip: F,
148
+ controlsColor: N,
149
+ interactiveParams: O,
150
+ texttrack: V,
151
+ children: D,
152
+ ...g
153
+ }, p) => {
154
+ const [P, C] = y("initial"), [x, $] = y(), { renderer: R } = G(Y), b = J({
150
155
  url: e,
151
- autoplay: a,
152
- autopause: r,
156
+ autoplay: r,
157
+ autopause: o,
153
158
  showControls: i,
154
- controlsColor: O,
155
- doNotTrack: n,
156
- interactiveParams: V,
157
- keyboard: d,
158
- loop: c,
159
- muted: l,
160
- pip: p,
161
- playsinline: u,
162
- quality: L,
163
- responsive: k,
164
- speed: E,
165
- texttrack: $,
166
- showTitle: _,
167
- transparent: j,
168
- showPortrait: S,
169
- autopip: N
159
+ controlsColor: N,
160
+ doNotTrack: a,
161
+ interactiveParams: O,
162
+ keyboard: u,
163
+ loop: f,
164
+ muted: c,
165
+ pip: l,
166
+ playsinline: m,
167
+ quality: d,
168
+ responsive: L,
169
+ speed: k,
170
+ texttrack: V,
171
+ showTitle: E,
172
+ transparent: _,
173
+ showPortrait: h,
174
+ autopip: F
170
175
  });
171
176
  return /* @__PURE__ */ s(
172
- tt.Provider,
177
+ ot.Provider,
173
178
  {
174
179
  value: {
175
- status: w,
176
- previewImageUrl: P,
180
+ status: P,
181
+ previewImageUrl: x,
177
182
  onInitPlayer() {
178
- C !== "canvas" && g("loading");
183
+ R !== "canvas" && C("loading");
179
184
  }
180
185
  },
181
186
  children: /* @__PURE__ */ s(
182
187
  "div",
183
188
  {
184
- ...y,
185
- ref: (x) => {
186
- m !== null && (typeof m == "function" ? m(x) : m.current = x);
189
+ ...g,
190
+ ref: (I) => {
191
+ p !== null && (typeof p == "function" ? p(I) : p.current = I);
187
192
  },
188
- children: I === void 0 ? /* @__PURE__ */ s(X, {}) : /* @__PURE__ */ D(F, { children: [
189
- A,
193
+ children: b === void 0 ? /* @__PURE__ */ s(Z, {}) : /* @__PURE__ */ q(A, { children: [
194
+ D,
190
195
  /* @__PURE__ */ s(
191
- Z,
196
+ et,
192
197
  {
193
- title: y.title,
194
- autoplay: a,
195
- videoUrl: I,
196
- previewImageUrl: P,
198
+ title: g.title,
199
+ autoplay: r,
200
+ playsinline: m,
201
+ videoUrl: b,
202
+ previewImageUrl: x,
197
203
  loading: t,
198
- showPreview: M,
199
- renderer: C,
200
- status: w,
201
- onStatusChange: g,
202
- onPreviewImageUrlChange: B
204
+ showPreview: j,
205
+ renderer: R,
206
+ status: P,
207
+ onStatusChange: C,
208
+ onPreviewImageUrlChange: $
203
209
  }
204
210
  )
205
211
  ] })
@@ -209,8 +215,9 @@ const J = "https://f.vimeocdn.com", R = "https://player.vimeo.com", U = "https:/
209
215
  );
210
216
  }
211
217
  );
212
- et.displayName = "Vimeo";
218
+ rt.displayName = "Vimeo";
213
219
  export {
214
- et as Vimeo,
215
- tt as VimeoContext
220
+ rt as Vimeo,
221
+ ot as VimeoContext,
222
+ tt as requestFullscreen
216
223
  };
package/lib/vimeo.ws.js CHANGED
@@ -1,14 +1,14 @@
1
1
  import { VimeoIcon as o } from "@webstudio-is/icons/svg";
2
2
  import { defaultStates as t } from "@webstudio-is/sdk";
3
- import { div as r } from "@webstudio-is/sdk/normalize.css";
4
- import { props as i } from "./__generated__/vimeo.props.js";
5
- const n = {
6
- div: r
3
+ import { div as i } from "@webstudio-is/sdk/normalize.css";
4
+ import { props as n } from "./__generated__/vimeo.props.js";
5
+ const r = {
6
+ div: i
7
7
  }, c = {
8
8
  type: "container",
9
9
  icon: o,
10
10
  states: t,
11
- presetStyle: n,
11
+ presetStyle: r,
12
12
  constraints: {
13
13
  relation: "ancestor",
14
14
  component: { $nin: ["Button", "Link", "Heading"] }
@@ -29,9 +29,10 @@ const n = {
29
29
  "showByline",
30
30
  "showTitle",
31
31
  "showControls",
32
- "controlsColor"
32
+ "controlsColor",
33
+ "playsinline"
33
34
  ], m = {
34
- props: i,
35
+ props: n,
35
36
  initialProps: e
36
37
  };
37
38
  export {
@@ -17,7 +17,15 @@ const n = {
17
17
  { selector: "[data-state=success]", label: "Success" }
18
18
  ]
19
19
  }, c = {
20
- props: e,
20
+ props: {
21
+ ...e,
22
+ action: {
23
+ type: "resource",
24
+ control: "resource",
25
+ description: "The URI of a program that processes the information submitted via the form.",
26
+ required: !0
27
+ }
28
+ },
21
29
  initialProps: ["id", "className", "state", "action"]
22
30
  };
23
31
  export {
package/lib/youtube.js CHANGED
@@ -1,137 +1,139 @@
1
- import { jsx as u, jsxs as R, Fragment as _ } from "react/jsx-runtime";
2
- import { forwardRef as L, useState as h, useContext as C, useEffect as y } from "react";
3
- import { ReactSdkContext as I } from "@webstudio-is/react-sdk/runtime";
4
- import { VimeoContext as E } from "./vimeo.js";
5
- const O = "https://www.youtube-nocookie.com", x = "https://www.youtube.com", w = "https://img.youtube.com", k = (e) => {
1
+ import { jsx as m, jsxs as _, Fragment as L } from "react/jsx-runtime";
2
+ import { forwardRef as C, useState as p, useContext as I, useRef as E, useEffect as h } from "react";
3
+ import { ReactSdkContext as O } from "@webstudio-is/react-sdk/runtime";
4
+ import { VimeoContext as x, requestFullscreen as S } from "./vimeo.js";
5
+ const T = "https://www.youtube-nocookie.com", j = "https://www.youtube.com", v = "https://img.youtube.com", R = (e) => {
6
6
  if (e)
7
7
  try {
8
- const t = new URL(e);
9
- return t.pathname === "/embed" ? void 0 : t.hostname === "youtu.be" ? t.pathname.slice(1) : t.searchParams.get("v") || t.pathname.split("/").pop();
8
+ const a = new URL(e);
9
+ return a.pathname === "/embed" ? void 0 : a.hostname === "youtu.be" ? a.pathname.slice(1) : a.searchParams.get("v") || a.pathname.split("/").pop();
10
10
  } catch {
11
11
  return e;
12
12
  }
13
- }, S = (e, t) => {
14
- var n, i;
15
- const l = k(e.url), r = new URL(t);
13
+ }, A = (e, a) => {
14
+ var i, c;
15
+ const l = R(e.url), r = new URL(a);
16
16
  if (l)
17
17
  r.pathname = `/embed/${l}`;
18
18
  else if (e.url)
19
19
  try {
20
- const c = new URL(e.url);
21
- r.pathname = c.pathname, r.search = c.search;
20
+ const n = new URL(e.url);
21
+ r.pathname = n.pathname, r.search = n.search;
22
22
  } catch {
23
23
  }
24
- const o = Object.keys(e), a = {};
25
- for (const c of o)
26
- switch (c) {
24
+ const o = Object.keys(e), t = {};
25
+ for (const n of o)
26
+ switch (n) {
27
27
  case "autoplay":
28
- a.autoplay = e.autoplay ? "1" : "0", e.autoplay && e.muted === void 0 && (a.mute = "1");
28
+ t.autoplay = e.autoplay ? "1" : "0", e.autoplay && e.muted === void 0 && (t.mute = "1");
29
29
  break;
30
30
  case "muted":
31
- a.mute = e.muted ? "1" : "0";
31
+ t.mute = e.muted ? "1" : "0";
32
32
  break;
33
33
  case "showControls":
34
- a.controls = e.showControls ? "1" : "0";
34
+ t.controls = e.showControls ? "1" : "0";
35
35
  break;
36
36
  case "showRelatedVideos":
37
- a.rel = e.showRelatedVideos ? "1" : "0";
37
+ t.rel = e.showRelatedVideos ? "1" : "0";
38
38
  break;
39
39
  case "keyboard":
40
- a.keyboard = e.keyboard ? "1" : "0";
40
+ t.keyboard = e.keyboard ? "1" : "0";
41
41
  break;
42
42
  case "loop":
43
- a.loop = e.loop ? "1" : "0", e.loop && (e.playlist ?? "").trim() === "" && (a.playlist = l);
43
+ t.loop = e.loop ? "1" : "0", e.loop && (e.playlist ?? "").trim() === "" && (t.playlist = l);
44
44
  break;
45
45
  case "inline":
46
- a.playsinline = e.inline ? "1" : "0";
46
+ t.playsinline = e.inline ? "1" : "0";
47
47
  break;
48
48
  case "allowFullscreen":
49
- a.fs = e.allowFullscreen ? "1" : "0";
49
+ t.fs = e.allowFullscreen ? "1" : "0";
50
50
  break;
51
51
  case "captionLanguage":
52
- a.cc_lang_pref = e.captionLanguage;
52
+ t.cc_lang_pref = e.captionLanguage;
53
53
  break;
54
54
  case "showCaptions":
55
- a.cc_load_policy = e.showCaptions ? "1" : "0";
55
+ t.cc_load_policy = e.showCaptions ? "1" : "0";
56
56
  break;
57
57
  case "showAnnotations":
58
- a.iv_load_policy = e.showAnnotations ? "1" : "3";
58
+ t.iv_load_policy = e.showAnnotations ? "1" : "3";
59
59
  break;
60
60
  case "startTime":
61
- a.start = (n = e.startTime) == null ? void 0 : n.toString();
61
+ t.start = (i = e.startTime) == null ? void 0 : i.toString();
62
62
  break;
63
63
  case "endTime":
64
- a.end = (i = e.endTime) == null ? void 0 : i.toString();
64
+ t.end = (c = e.endTime) == null ? void 0 : c.toString();
65
65
  break;
66
66
  case "disableKeyboard":
67
- a.disablekb = e.disableKeyboard ? "1" : "0";
67
+ t.disablekb = e.disableKeyboard ? "1" : "0";
68
68
  break;
69
69
  case "language":
70
- a.hl = e.language;
70
+ t.hl = e.language;
71
71
  break;
72
72
  case "listId":
73
- a.list = e.listId;
73
+ t.list = e.listId;
74
74
  break;
75
75
  case "listType":
76
- a.listType = e.listType;
76
+ t.listType = e.listType;
77
77
  break;
78
78
  case "color":
79
- a.color = e.color;
79
+ t.color = e.color;
80
80
  break;
81
81
  case "origin":
82
- a.origin = e.origin;
82
+ t.origin = e.origin;
83
83
  break;
84
84
  case "referrer":
85
- a.widget_referrer = e.referrer;
85
+ t.widget_referrer = e.referrer;
86
86
  break;
87
87
  case "playlist":
88
- a.playlist = e.playlist;
88
+ t.playlist = e.playlist;
89
89
  break;
90
90
  }
91
- return Object.entries(a).forEach(([c, s]) => {
92
- s !== void 0 && r.searchParams.append(c, s.toString());
91
+ return Object.entries(t).forEach(([n, s]) => {
92
+ s !== void 0 && r.searchParams.append(n, s.toString());
93
93
  }), r.toString();
94
- }, p = (e) => {
95
- const t = document.createElement("link");
96
- t.rel = "preconnect", t.href = e, t.crossOrigin = "true", document.head.appendChild(t);
94
+ }, w = (e) => {
95
+ const a = document.createElement("link");
96
+ a.rel = "preconnect", a.href = e, a.crossOrigin = "true", document.head.appendChild(a);
97
97
  };
98
- let g = !1;
99
- const T = (e) => {
100
- if (!(g || window.matchMedia("(hover: none)").matches)) {
98
+ let k = !1;
99
+ const N = (e) => {
100
+ if (!(k || window.matchMedia("(hover: none)").matches)) {
101
101
  try {
102
- const t = new URL(e);
103
- p(t.origin);
102
+ const a = new URL(e);
103
+ w(a.origin);
104
104
  } catch {
105
105
  }
106
- p(w), g = !0;
106
+ w(v), k = !0;
107
107
  }
108
- }, j = (e) => new URL(`${w}/vi/${e}/maxresdefault.jpg`), A = () => /* @__PURE__ */ u("div", { className: "flex w-full h-full items-center justify-center text-lg", children: 'Open the "Settings" panel and paste a video URL, e.g. https://youtube.com/watch?v=dQw4w9WgXcQ' }), N = ({
108
+ }, P = (e) => new URL(`${v}/vi/${e}/maxresdefault.jpg`), U = () => /* @__PURE__ */ m("div", { className: "flex w-full h-full items-center justify-center text-lg", children: 'Open the "Settings" panel and paste a video URL, e.g. https://youtube.com/watch?v=dQw4w9WgXcQ' }), V = ({
109
109
  title: e,
110
- status: t,
110
+ status: a,
111
111
  loading: l,
112
112
  videoUrl: r,
113
113
  previewImageUrl: o,
114
- autoplay: a,
115
- renderer: n,
116
- showPreview: i,
117
- onStatusChange: c,
118
- onPreviewImageUrlChange: s
114
+ autoplay: t,
115
+ inline: i,
116
+ renderer: c,
117
+ showPreview: n,
118
+ onStatusChange: s,
119
+ onPreviewImageUrlChange: u
119
120
  }) => {
120
- const [m, b] = h(0);
121
- return y(() => {
122
- a && n !== "canvas" && t === "initial" && c("loading");
123
- }, [a, t, n, c]), y(() => {
124
- n !== "canvas" && T(r);
125
- }, [n, r]), y(() => {
126
- const d = k(r);
127
- if (!d || !i) {
128
- s(void 0);
121
+ const [b, f] = p(0), d = E(null);
122
+ return h(() => {
123
+ t && c !== "canvas" && a === "initial" && s("loading");
124
+ }, [t, a, c, s]), h(() => {
125
+ c !== "canvas" && N(r);
126
+ }, [c, r]), h(() => {
127
+ const y = R(r);
128
+ if (!y || !n) {
129
+ u(void 0);
129
130
  return;
130
131
  }
131
- o || s(j(d));
132
- }, [s, i, r, o]), n === "canvas" || t === "initial" ? null : /* @__PURE__ */ u(
132
+ o || u(P(y));
133
+ }, [u, n, r, o]), c === "canvas" || a === "initial" ? null : /* @__PURE__ */ m(
133
134
  "iframe",
134
135
  {
136
+ ref: d,
135
137
  title: e,
136
138
  src: r,
137
139
  loading: l,
@@ -141,66 +143,69 @@ const T = (e) => {
141
143
  position: "absolute",
142
144
  width: "100%",
143
145
  height: "100%",
144
- opacity: m,
146
+ opacity: b,
145
147
  transition: "opacity 1s",
146
148
  border: "none"
147
149
  },
148
150
  onLoad: () => {
149
- c("ready"), b(1);
151
+ s("ready"), f(1), !i && !t && d.current && S(d.current);
150
152
  }
151
153
  }
152
154
  );
153
- }, P = L(
155
+ }, D = C(
154
156
  ({
155
157
  url: e,
156
- loading: t = "lazy",
158
+ loading: a = "lazy",
157
159
  autoplay: l,
158
160
  showPreview: r,
159
161
  children: o,
160
- privacyEnhancedMode: a,
161
- ...n
162
- }, i) => {
163
- const [c, s] = h("initial"), [m, b] = h(), { renderer: d } = C(I), v = a ?? !0 ? O : x, f = S(
162
+ privacyEnhancedMode: t,
163
+ inline: i = !1,
164
+ ...c
165
+ }, n) => {
166
+ const [s, u] = p("initial"), [b, f] = p(), { renderer: d } = I(O), y = t ?? !0 ? T : j, g = A(
164
167
  {
165
- ...n,
168
+ ...c,
169
+ inline: i,
166
170
  url: e,
167
171
  autoplay: !0
168
172
  },
169
- v
173
+ y
170
174
  );
171
- return /* @__PURE__ */ u(
172
- E.Provider,
175
+ return /* @__PURE__ */ m(
176
+ x.Provider,
173
177
  {
174
178
  value: {
175
- status: c,
176
- previewImageUrl: m,
179
+ status: s,
180
+ previewImageUrl: b,
177
181
  onInitPlayer() {
178
- d !== "canvas" && s("loading");
182
+ d !== "canvas" && u("loading");
179
183
  }
180
184
  },
181
- children: /* @__PURE__ */ u("div", { ...n, ref: i, children: f ? /* @__PURE__ */ R(_, { children: [
185
+ children: /* @__PURE__ */ m("div", { ...c, ref: n, children: g ? /* @__PURE__ */ _(L, { children: [
182
186
  o,
183
- /* @__PURE__ */ u(
184
- N,
187
+ /* @__PURE__ */ m(
188
+ V,
185
189
  {
186
- title: n.title,
190
+ title: c.title,
187
191
  autoplay: l,
188
- videoUrl: f,
189
- previewImageUrl: m,
190
- loading: t,
192
+ videoUrl: g,
193
+ previewImageUrl: b,
194
+ loading: a,
195
+ inline: i,
191
196
  showPreview: r,
192
197
  renderer: d,
193
- status: c,
194
- onStatusChange: s,
195
- onPreviewImageUrlChange: b
198
+ status: s,
199
+ onStatusChange: u,
200
+ onPreviewImageUrlChange: f
196
201
  }
197
202
  )
198
- ] }) : /* @__PURE__ */ u(A, {}) })
203
+ ] }) : /* @__PURE__ */ m(U, {}) })
199
204
  }
200
205
  );
201
206
  }
202
207
  );
203
- P.displayName = "YouTube";
208
+ D.displayName = "YouTube";
204
209
  export {
205
- P as YouTube
210
+ D as YouTube
206
211
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webstudio-is/sdk-components-react",
3
- "version": "0.206.0",
3
+ "version": "0.207.0",
4
4
  "description": "Webstudio default library for react",
5
5
  "author": "Webstudio <github@webstudio.is>",
6
6
  "homepage": "https://webstudio.is",
@@ -49,21 +49,22 @@
49
49
  "colord": "^2.9.3",
50
50
  "micromark": "^4.0.1",
51
51
  "micromark-extension-gfm-table": "^2.1.0",
52
- "@webstudio-is/icons": "0.206.0",
53
- "@webstudio-is/image": "0.206.0",
54
- "@webstudio-is/react-sdk": "0.206.0",
55
- "@webstudio-is/sdk": "0.206.0"
52
+ "@webstudio-is/icons": "0.207.0",
53
+ "@webstudio-is/react-sdk": "0.207.0",
54
+ "@webstudio-is/sdk": "0.207.0",
55
+ "@webstudio-is/image": "0.207.0"
56
56
  },
57
57
  "devDependencies": {
58
- "@testing-library/react": "^14.2.2",
58
+ "@testing-library/dom": "^10.4.0",
59
+ "@testing-library/react": "^16.2.0",
59
60
  "@types/react": "^18.2.70",
60
61
  "@types/react-dom": "^18.2.25",
61
62
  "react": "18.3.0-canary-14898b6a9-20240318",
62
63
  "react-dom": "18.3.0-canary-14898b6a9-20240318",
63
- "vitest": "^3.0.4",
64
+ "vitest": "^3.0.8",
64
65
  "@webstudio-is/generate-arg-types": "0.0.0",
65
66
  "@webstudio-is/sdk-cli": "0.94.0",
66
- "@webstudio-is/template": "0.206.0",
67
+ "@webstudio-is/template": "0.207.0",
67
68
  "@webstudio-is/tsconfig": "1.0.7"
68
69
  },
69
70
  "scripts": {