@webstudio-is/sdk-components-react 0.213.0 → 0.214.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/bold.ws.js CHANGED
@@ -5,16 +5,16 @@ import { props as r } from "./__generated__/bold.props.js";
5
5
  const p = {
6
6
  b: e
7
7
  }, l = {
8
- type: "rich-text-child",
8
+ type: "container",
9
9
  label: "Bold Text",
10
10
  icon: t,
11
11
  states: o,
12
12
  presetStyle: p
13
- }, c = {
13
+ }, n = {
14
14
  props: r,
15
15
  initialProps: ["id", "className"]
16
16
  };
17
17
  export {
18
18
  l as meta,
19
- c as propsMeta
19
+ n as propsMeta
20
20
  };
package/lib/italic.ws.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import { TextItalicIcon as t } from "@webstudio-is/icons/svg";
2
2
  import { defaultStates as e } from "@webstudio-is/sdk";
3
3
  import { i as o } from "@webstudio-is/sdk/normalize.css";
4
- import { props as i } from "./__generated__/italic.props.js";
5
- const r = {
4
+ import { props as r } from "./__generated__/italic.props.js";
5
+ const i = {
6
6
  i: [
7
7
  ...o,
8
8
  {
@@ -11,13 +11,13 @@ const r = {
11
11
  }
12
12
  ]
13
13
  }, c = {
14
- type: "rich-text-child",
14
+ type: "container",
15
15
  label: "Italic Text",
16
16
  icon: t,
17
17
  states: e,
18
- presetStyle: r
18
+ presetStyle: i
19
19
  }, m = {
20
- props: i,
20
+ props: r,
21
21
  initialProps: ["id", "className"]
22
22
  };
23
23
  export {
@@ -1,9 +1,9 @@
1
- import { meta as t, propsMeta as e } from "./link.ws.js";
2
- const a = {
1
+ import { meta as t, propsMeta as a } from "./link.ws.js";
2
+ const o = {
3
3
  ...t,
4
- type: "rich-text-child"
5
- }, o = e;
4
+ type: "container"
5
+ }, p = a;
6
6
  export {
7
- a as meta,
8
- o as propsMeta
7
+ o as meta,
8
+ p as propsMeta
9
9
  };
package/lib/span.ws.js CHANGED
@@ -4,17 +4,17 @@ import { span as r } from "@webstudio-is/sdk/normalize.css";
4
4
  import { props as e } from "./__generated__/span.props.js";
5
5
  const s = {
6
6
  span: r
7
- }, c = {
8
- type: "rich-text-child",
7
+ }, n = {
8
+ type: "container",
9
9
  label: "Text",
10
10
  icon: t,
11
11
  states: o,
12
12
  presetStyle: s
13
- }, n = {
13
+ }, c = {
14
14
  props: e,
15
15
  initialProps: ["id", "className"]
16
16
  };
17
17
  export {
18
- c as meta,
19
- n as propsMeta
18
+ n as meta,
19
+ c as propsMeta
20
20
  };
@@ -4,17 +4,17 @@ import { sub as r } from "@webstudio-is/sdk/normalize.css";
4
4
  import { props as s } from "./__generated__/subscript.props.js";
5
5
  const e = {
6
6
  sub: r
7
- }, a = {
8
- type: "rich-text-child",
7
+ }, c = {
8
+ type: "container",
9
9
  label: "Subscript Text",
10
10
  icon: t,
11
11
  states: o,
12
12
  presetStyle: e
13
- }, l = {
13
+ }, n = {
14
14
  props: s,
15
15
  initialProps: ["id", "className"]
16
16
  };
17
17
  export {
18
- a as meta,
19
- l as propsMeta
18
+ c as meta,
19
+ n as propsMeta
20
20
  };
@@ -1,20 +1,20 @@
1
1
  import { SuperscriptIcon as t } from "@webstudio-is/icons/svg";
2
- import { defaultStates as r } from "@webstudio-is/sdk";
3
- import { sup as o } from "@webstudio-is/sdk/normalize.css";
2
+ import { defaultStates as o } from "@webstudio-is/sdk";
3
+ import { sup as r } from "@webstudio-is/sdk/normalize.css";
4
4
  import { props as p } from "./__generated__/superscript.props.js";
5
5
  const e = {
6
- sup: o
7
- }, a = {
8
- type: "rich-text-child",
6
+ sup: r
7
+ }, c = {
8
+ type: "container",
9
9
  label: "Superscript Text",
10
10
  icon: t,
11
- states: r,
11
+ states: o,
12
12
  presetStyle: e
13
- }, l = {
13
+ }, n = {
14
14
  props: p,
15
15
  initialProps: ["id", "className"]
16
16
  };
17
17
  export {
18
- a as meta,
19
- l as propsMeta
18
+ c as meta,
19
+ n as propsMeta
20
20
  };
package/lib/youtube.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { jsx as u, jsxs as E, Fragment as O } from "react/jsx-runtime";
2
- import { forwardRef as x, useState as p, useContext as S, useRef as T, useEffect as h } from "react";
2
+ import { forwardRef as x, useState as p, useContext as S, useRef as T, useEffect as y } from "react";
3
3
  import { ReactSdkContext as A } from "@webstudio-is/react-sdk/runtime";
4
4
  import { VimeoContext as N, requestFullscreen as P } from "./vimeo.js";
5
5
  const U = "https://www.youtube-nocookie.com", V = "https://www.youtube.com", j = "https://img.youtube.com", L = (e) => {
@@ -12,9 +12,9 @@ const U = "https://www.youtube-nocookie.com", V = "https://www.youtube.com", j =
12
12
  }
13
13
  }, D = (e, t) => {
14
14
  var o, n;
15
- const l = L(e.url), r = new URL(t);
16
- if (l)
17
- r.pathname = `/embed/${l}`;
15
+ const s = L(e.url), r = new URL(t);
16
+ if (s)
17
+ r.pathname = `/embed/${s}`;
18
18
  else if (e.url)
19
19
  try {
20
20
  const c = new URL(e.url);
@@ -22,77 +22,79 @@ const U = "https://www.youtube-nocookie.com", V = "https://www.youtube.com", j =
22
22
  } catch {
23
23
  }
24
24
  const i = Object.keys(e), a = {};
25
+ a.autoplay = "1";
25
26
  for (const c of i)
26
- switch (c) {
27
- case "autoplay":
28
- a.autoplay = e.autoplay ? "1" : "0", e.autoplay && e.muted === void 0 && (a.mute = "1");
29
- break;
30
- case "muted":
31
- a.mute = e.muted ? "1" : "0";
32
- break;
33
- case "showControls":
34
- a.controls = e.showControls ? "1" : "0";
35
- break;
36
- case "showRelatedVideos":
37
- a.rel = e.showRelatedVideos ? "1" : "0";
38
- break;
39
- case "keyboard":
40
- a.keyboard = e.keyboard ? "1" : "0";
41
- break;
42
- case "loop":
43
- a.loop = e.loop ? "1" : "0", e.loop && (e.playlist ?? "").trim() === "" && (a.playlist = l);
44
- break;
45
- case "inline":
46
- a.playsinline = e.inline ? "1" : "0";
47
- break;
48
- case "allowFullscreen":
49
- a.fs = e.allowFullscreen ? "1" : "0";
50
- break;
51
- case "captionLanguage":
52
- a.cc_lang_pref = e.captionLanguage;
53
- break;
54
- case "showCaptions":
55
- a.cc_load_policy = e.showCaptions ? "1" : "0";
56
- break;
57
- case "showAnnotations":
58
- a.iv_load_policy = e.showAnnotations ? "1" : "3";
59
- break;
60
- case "startTime":
61
- a.start = (o = e.startTime) == null ? void 0 : o.toString();
62
- break;
63
- case "endTime":
64
- a.end = (n = e.endTime) == null ? void 0 : n.toString();
65
- break;
66
- case "disableKeyboard":
67
- a.disablekb = e.disableKeyboard ? "1" : "0";
68
- break;
69
- case "language":
70
- a.hl = e.language;
71
- break;
72
- case "listId":
73
- a.list = e.listId;
74
- break;
75
- case "listType":
76
- a.listType = e.listType;
77
- break;
78
- case "color":
79
- a.color = e.color;
80
- break;
81
- case "origin":
82
- a.origin = e.origin;
83
- break;
84
- case "referrer":
85
- a.widget_referrer = e.referrer;
86
- break;
87
- case "playlist":
88
- a.playlist = e.playlist;
89
- break;
90
- case "enablejsapi":
91
- a.enablejsapi = e.enablejsapi ? "1" : "0";
92
- break;
93
- }
94
- return Object.entries(a).forEach(([c, s]) => {
95
- s !== void 0 && r.searchParams.append(c, s.toString());
27
+ if (e[c] !== void 0)
28
+ switch (c) {
29
+ case "autoplay":
30
+ e.autoplay && e.muted === void 0 && (a.mute = "1");
31
+ break;
32
+ case "muted":
33
+ a.mute = e.muted ? "1" : "0";
34
+ break;
35
+ case "showControls":
36
+ a.controls = e.showControls ? "1" : "0";
37
+ break;
38
+ case "showRelatedVideos":
39
+ a.rel = e.showRelatedVideos ? "1" : "0";
40
+ break;
41
+ case "keyboard":
42
+ a.keyboard = e.keyboard ? "1" : "0";
43
+ break;
44
+ case "loop":
45
+ a.loop = e.loop ? "1" : "0", e.loop && (e.playlist ?? "").trim() === "" && (a.playlist = s);
46
+ break;
47
+ case "inline":
48
+ a.playsinline = e.inline ? "1" : "0";
49
+ break;
50
+ case "allowFullscreen":
51
+ a.fs = e.allowFullscreen ? "1" : "0";
52
+ break;
53
+ case "captionLanguage":
54
+ a.cc_lang_pref = e.captionLanguage;
55
+ break;
56
+ case "showCaptions":
57
+ a.cc_load_policy = e.showCaptions ? "1" : "0";
58
+ break;
59
+ case "showAnnotations":
60
+ a.iv_load_policy = e.showAnnotations ? "1" : "3";
61
+ break;
62
+ case "startTime":
63
+ a.start = (o = e.startTime) == null ? void 0 : o.toString();
64
+ break;
65
+ case "endTime":
66
+ a.end = (n = e.endTime) == null ? void 0 : n.toString();
67
+ break;
68
+ case "disableKeyboard":
69
+ a.disablekb = e.disableKeyboard ? "1" : "0";
70
+ break;
71
+ case "language":
72
+ a.hl = e.language;
73
+ break;
74
+ case "listId":
75
+ a.list = e.listId;
76
+ break;
77
+ case "listType":
78
+ a.listType = e.listType;
79
+ break;
80
+ case "color":
81
+ a.color = e.color;
82
+ break;
83
+ case "origin":
84
+ a.origin = e.origin;
85
+ break;
86
+ case "referrer":
87
+ a.widget_referrer = e.referrer;
88
+ break;
89
+ case "playlist":
90
+ a.playlist = e.playlist;
91
+ break;
92
+ case "enablejsapi":
93
+ a.enablejsapi = e.enablejsapi ? "1" : "0";
94
+ break;
95
+ }
96
+ return Object.entries(a).forEach(([c, l]) => {
97
+ l !== void 0 && r.searchParams.append(c, l.toString());
96
98
  }), r.toString();
97
99
  }, R = (e) => {
98
100
  const t = document.createElement("link");
@@ -111,22 +113,22 @@ const F = (e) => {
111
113
  }, Y = (e) => new URL(`${j}/vi/${e}/maxresdefault.jpg`), K = () => /* @__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' }), M = ({
112
114
  title: e,
113
115
  status: t,
114
- loading: l,
116
+ loading: s,
115
117
  videoUrl: r,
116
118
  previewImageUrl: i,
117
119
  autoplay: a,
118
120
  inline: o,
119
121
  renderer: n,
120
122
  showPreview: c,
121
- onStatusChange: s,
123
+ onStatusChange: l,
122
124
  onPreviewImageUrlChange: d
123
125
  }) => {
124
- const [y, m] = p(0), b = T(null);
125
- return h(() => {
126
- a && n !== "canvas" && t === "initial" && s("loading");
127
- }, [a, t, n, s]), h(() => {
126
+ const [h, m] = p(0), b = T(null);
127
+ return y(() => {
128
+ a && n !== "canvas" && t === "initial" && l("loading");
129
+ }, [a, t, n, l]), y(() => {
128
130
  n !== "canvas" && F(r);
129
- }, [n, r]), h(() => {
131
+ }, [n, r]), y(() => {
130
132
  const f = L(r);
131
133
  if (!f || !c) {
132
134
  d(void 0);
@@ -139,19 +141,19 @@ const F = (e) => {
139
141
  ref: b,
140
142
  title: e,
141
143
  src: r,
142
- loading: l,
144
+ loading: s,
143
145
  allow: "accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture",
144
146
  allowFullScreen: !0,
145
147
  style: {
146
148
  position: "absolute",
147
149
  width: "100%",
148
150
  height: "100%",
149
- opacity: y,
151
+ opacity: h,
150
152
  transition: "opacity 1s",
151
153
  border: "none"
152
154
  },
153
155
  onLoad: () => {
154
- s("ready"), m(1), !o && !a && b.current && P(b.current);
156
+ l("ready"), m(1), !o && !a && b.current && P(b.current);
155
157
  }
156
158
  }
157
159
  );
@@ -159,29 +161,29 @@ const F = (e) => {
159
161
  ({
160
162
  url: e,
161
163
  loading: t = "lazy",
162
- autoplay: l,
164
+ autoplay: s,
163
165
  showPreview: r,
164
166
  showAnnotations: i,
165
167
  showCaptions: a,
166
168
  showControls: o,
167
169
  allowFullscreen: n,
168
170
  keyboard: c,
169
- children: s,
171
+ children: l,
170
172
  privacyEnhancedMode: d,
171
- inline: y = !1,
173
+ inline: h = !1,
172
174
  ...m
173
175
  }, b) => {
174
176
  const [f, g] = p("initial"), [w, C] = p(), { renderer: k } = S(A), I = d ?? !0 ? U : V, v = D(
175
177
  {
176
178
  ...m,
177
- inline: y,
179
+ inline: h,
178
180
  url: e,
179
181
  keyboard: c,
180
182
  showAnnotations: i,
181
183
  showCaptions: a,
182
184
  allowFullscreen: n,
183
185
  showControls: o,
184
- autoplay: !0,
186
+ autoplay: s,
185
187
  enablejsapi: !1
186
188
  },
187
189
  I
@@ -197,16 +199,16 @@ const F = (e) => {
197
199
  }
198
200
  },
199
201
  children: /* @__PURE__ */ u("div", { ...m, ref: b, children: v ? /* @__PURE__ */ E(O, { children: [
200
- s,
202
+ l,
201
203
  /* @__PURE__ */ u(
202
204
  M,
203
205
  {
204
206
  title: m.title,
205
- autoplay: l,
207
+ autoplay: s,
206
208
  videoUrl: v,
207
209
  previewImageUrl: w,
208
210
  loading: t,
209
- inline: y,
211
+ inline: h,
210
212
  showPreview: r,
211
213
  renderer: k,
212
214
  status: f,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webstudio-is/sdk-components-react",
3
- "version": "0.213.0",
3
+ "version": "0.214.0",
4
4
  "description": "Webstudio default library for react",
5
5
  "author": "Webstudio <github@webstudio.is>",
6
6
  "homepage": "https://webstudio.is",
@@ -49,10 +49,10 @@
49
49
  "colord": "^2.9.3",
50
50
  "micromark": "^4.0.2",
51
51
  "micromark-extension-gfm-table": "^2.1.1",
52
- "@webstudio-is/icons": "0.213.0",
53
- "@webstudio-is/image": "0.213.0",
54
- "@webstudio-is/react-sdk": "0.213.0",
55
- "@webstudio-is/sdk": "0.213.0"
52
+ "@webstudio-is/icons": "0.214.0",
53
+ "@webstudio-is/react-sdk": "0.214.0",
54
+ "@webstudio-is/image": "0.214.0",
55
+ "@webstudio-is/sdk": "0.214.0"
56
56
  },
57
57
  "devDependencies": {
58
58
  "@testing-library/dom": "^10.4.0",
@@ -63,9 +63,9 @@
63
63
  "react": "18.3.0-canary-14898b6a9-20240318",
64
64
  "react-dom": "18.3.0-canary-14898b6a9-20240318",
65
65
  "vitest": "^3.0.8",
66
- "@webstudio-is/generate-arg-types": "0.0.0",
67
66
  "@webstudio-is/sdk-cli": "0.94.0",
68
- "@webstudio-is/template": "0.213.0",
67
+ "@webstudio-is/generate-arg-types": "0.0.0",
68
+ "@webstudio-is/template": "0.214.0",
69
69
  "@webstudio-is/tsconfig": "1.0.7"
70
70
  },
71
71
  "scripts": {