@webstudio-is/sdk-components-react 0.0.0-4f7bf18 → 0.0.0-50b8685

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.
@@ -4,60 +4,61 @@ import { props as p } from "./__generated__/blockquote.props.js";
4
4
  const r = {
5
5
  blockquote: [
6
6
  {
7
- property: "marginTop",
7
+ property: "margin-top",
8
8
  value: { type: "unit", value: 0, unit: "number" }
9
9
  },
10
10
  {
11
- property: "marginRight",
11
+ property: "margin-right",
12
12
  value: { type: "unit", value: 0, unit: "number" }
13
13
  },
14
14
  {
15
- property: "marginBottom",
15
+ property: "margin-bottom",
16
16
  value: { type: "unit", value: 10, unit: "px" }
17
17
  },
18
18
  {
19
- property: "marginLeft",
19
+ property: "margin-left",
20
20
  value: { type: "unit", value: 0, unit: "number" }
21
21
  },
22
22
  {
23
- property: "paddingTop",
23
+ property: "padding-top",
24
24
  value: { type: "unit", value: 10, unit: "px" }
25
25
  },
26
26
  {
27
- property: "paddingBottom",
27
+ property: "padding-bottom",
28
28
  value: { type: "unit", value: 10, unit: "px" }
29
29
  },
30
30
  {
31
- property: "paddingLeft",
31
+ property: "padding-left",
32
32
  value: { type: "unit", value: 20, unit: "px" }
33
33
  },
34
34
  {
35
- property: "paddingRight",
35
+ property: "padding-right",
36
36
  value: { type: "unit", value: 20, unit: "px" }
37
37
  },
38
38
  {
39
- property: "borderLeftWidth",
39
+ property: "border-left-width",
40
40
  value: { type: "unit", value: 5, unit: "px" }
41
41
  },
42
42
  {
43
- property: "borderLeftStyle",
43
+ property: "border-left-style",
44
44
  value: { type: "keyword", value: "solid" }
45
45
  },
46
46
  {
47
- property: "borderLeftColor",
47
+ property: "border-left-color",
48
48
  value: { type: "rgb", r: 226, g: 226, b: 226, alpha: 1 }
49
49
  }
50
50
  ]
51
51
  }, i = {
52
52
  type: "container",
53
+ placeholder: "Blockquote",
53
54
  icon: t,
54
55
  states: e,
55
56
  presetStyle: r
56
- }, n = {
57
+ }, l = {
57
58
  props: p,
58
59
  initialProps: ["id", "className", "cite"]
59
60
  };
60
61
  export {
61
62
  i as meta,
62
- n as propsMeta
63
+ l as propsMeta
63
64
  };
package/lib/body.ws.js CHANGED
@@ -6,15 +6,15 @@ const a = {
6
6
  body: [
7
7
  ...e,
8
8
  {
9
- property: "WebkitFontSmoothing",
9
+ property: "-webkit-font-smoothing",
10
10
  value: { type: "keyword", value: "antialiased" }
11
11
  },
12
12
  {
13
- property: "MozOsxFontSmoothing",
13
+ property: "-moz-osx-font-smoothing",
14
14
  value: { type: "keyword", value: "grayscale" }
15
15
  }
16
16
  ]
17
- }, m = {
17
+ }, n = {
18
18
  type: "container",
19
19
  icon: o,
20
20
  states: t,
@@ -24,6 +24,6 @@ const a = {
24
24
  initialProps: ["id", "className"]
25
25
  };
26
26
  export {
27
- m as meta,
27
+ n as meta,
28
28
  y as propsMeta
29
29
  };
@@ -6,7 +6,7 @@ const r = {
6
6
  input: [
7
7
  ...o,
8
8
  {
9
- property: "marginRight",
9
+ property: "margin-right",
10
10
  value: { type: "unit", unit: "em", value: 0.5 }
11
11
  }
12
12
  ]
@@ -10,27 +10,27 @@ const p = {
10
10
  value: { type: "keyword", value: "block" }
11
11
  },
12
12
  {
13
- property: "whiteSpaceCollapse",
13
+ property: "white-space-collapse",
14
14
  value: { type: "keyword", value: "preserve" }
15
15
  },
16
16
  {
17
- property: "textWrapMode",
17
+ property: "text-wrap-mode",
18
18
  value: { type: "keyword", value: "wrap" }
19
19
  },
20
20
  {
21
- property: "paddingLeft",
21
+ property: "padding-left",
22
22
  value: { type: "unit", value: 0.2, unit: "em" }
23
23
  },
24
24
  {
25
- property: "paddingRight",
25
+ property: "padding-right",
26
26
  value: { type: "unit", value: 0.2, unit: "em" }
27
27
  },
28
28
  {
29
- property: "backgroundColor",
29
+ property: "background-color",
30
30
  value: { type: "rgb", r: 238, g: 238, b: 238, alpha: 1 }
31
31
  }
32
32
  ]
33
- }, s = {
33
+ }, i = {
34
34
  category: "general",
35
35
  type: "embed",
36
36
  description: "Use this component when you want to display code as text on the page.",
@@ -42,7 +42,7 @@ const p = {
42
42
  states: t,
43
43
  presetStyle: p,
44
44
  order: 5
45
- }, d = {
45
+ }, c = {
46
46
  props: {
47
47
  ...r,
48
48
  code: {
@@ -54,6 +54,6 @@ const p = {
54
54
  initialProps: ["id", "className", "lang", "code"]
55
55
  };
56
56
  export {
57
- s as meta,
58
- d as propsMeta
57
+ i as meta,
58
+ c as propsMeta
59
59
  };
package/lib/form.ws.js CHANGED
@@ -5,7 +5,7 @@ import { props as e } from "./__generated__/form.props.js";
5
5
  const n = {
6
6
  form: [
7
7
  ...r,
8
- { property: "minHeight", value: { type: "unit", unit: "px", value: 20 } }
8
+ { property: "min-height", value: { type: "unit", unit: "px", value: 20 } }
9
9
  ]
10
10
  }, p = {
11
11
  category: "forms",
@@ -1,16 +1,16 @@
1
1
  import { ResourceIcon as o } from "@webstudio-is/icons/svg";
2
2
  import "@webstudio-is/sdk";
3
- import { props as t } from "./__generated__/head-link.props.js";
3
+ import { props as e } from "./__generated__/head-link.props.js";
4
4
  const p = {
5
5
  category: "hidden",
6
6
  icon: o,
7
- type: "container",
7
+ type: "embed",
8
8
  constraints: {
9
9
  relation: "parent",
10
10
  component: { $eq: "HeadSlot" }
11
11
  }
12
12
  }, a = {
13
- props: t,
13
+ props: e,
14
14
  initialProps: ["rel", "hrefLang", "href", "type", "as"]
15
15
  };
16
16
  export {
@@ -4,7 +4,7 @@ import { props as t } from "./__generated__/head-meta.props.js";
4
4
  const p = {
5
5
  category: "hidden",
6
6
  icon: o,
7
- type: "container",
7
+ type: "embed",
8
8
  constraints: {
9
9
  relation: "parent",
10
10
  component: { $eq: "HeadSlot" }
package/lib/heading.ws.js CHANGED
@@ -1,28 +1,29 @@
1
1
  import { HeadingIcon as t } from "@webstudio-is/icons/svg";
2
2
  import { defaultStates as o } from "@webstudio-is/sdk";
3
- import { h1 as e, h2 as n, h3 as r, h4 as a, h5 as s, h6 as i } from "@webstudio-is/sdk/normalize.css";
3
+ import { h1 as e, h2 as n, h3 as r, h4 as a, h5 as i, h6 as s } from "@webstudio-is/sdk/normalize.css";
4
4
  import { props as p } from "./__generated__/heading.props.js";
5
- const m = {
5
+ const c = {
6
6
  h1: e,
7
7
  h2: n,
8
8
  h3: r,
9
9
  h4: a,
10
- h5: s,
11
- h6: i
12
- }, d = {
10
+ h5: i,
11
+ h6: s
12
+ }, f = {
13
13
  type: "container",
14
+ placeholder: "Heading",
14
15
  icon: t,
15
16
  constraints: {
16
17
  relation: "ancestor",
17
18
  component: { $neq: "Heading" }
18
19
  },
19
20
  states: o,
20
- presetStyle: m
21
+ presetStyle: c
21
22
  }, g = {
22
23
  props: p,
23
24
  initialProps: ["id", "className", "tag"]
24
25
  };
25
26
  export {
26
- d as meta,
27
+ f as meta,
27
28
  g as propsMeta
28
29
  };
@@ -7,7 +7,7 @@ const i = {
7
7
  value: { type: "keyword", value: "contents" }
8
8
  },
9
9
  {
10
- property: "whiteSpaceCollapse",
10
+ property: "white-space-collapse",
11
11
  value: { type: "keyword", value: "collapse" }
12
12
  }
13
13
  ]
@@ -19,7 +19,7 @@ const i = {
19
19
  icon: t,
20
20
  presetStyle: i,
21
21
  order: 2
22
- }, r = {
22
+ }, s = {
23
23
  props: {
24
24
  ...e,
25
25
  clientOnly: {
@@ -42,5 +42,5 @@ const i = {
42
42
  };
43
43
  export {
44
44
  a as meta,
45
- r as propsMeta
45
+ s as propsMeta
46
46
  };
package/lib/image.ws.js CHANGED
@@ -7,7 +7,7 @@ const a = {
7
7
  ...o,
8
8
  // Otherwise on new image insert onto canvas it can overfit screen size multiple times
9
9
  {
10
- property: "maxWidth",
10
+ property: "max-width",
11
11
  value: { type: "unit", unit: "%", value: 100 }
12
12
  },
13
13
  // inline | inline-block is not suitable because without line-height: 0 on the parent you get unsuitable spaces/margins
package/lib/italic.ws.js CHANGED
@@ -6,7 +6,7 @@ const r = {
6
6
  i: [
7
7
  ...o,
8
8
  {
9
- property: "fontStyle",
9
+ property: "font-style",
10
10
  value: { type: "keyword", value: "italic" }
11
11
  }
12
12
  ]
package/lib/link.ws.js CHANGED
@@ -12,6 +12,7 @@ const a = {
12
12
  ]
13
13
  }, l = {
14
14
  type: "container",
15
+ placeholder: "Link",
15
16
  icon: e,
16
17
  constraints: {
17
18
  relation: "ancestor",
@@ -6,6 +6,7 @@ const s = {
6
6
  li: e
7
7
  }, m = {
8
8
  type: "container",
9
+ placeholder: "List item",
9
10
  constraints: {
10
11
  // cannot use parent relation here
11
12
  // because list item can be put inside of collection or slot
package/lib/list.ws.js CHANGED
@@ -1,42 +1,42 @@
1
1
  import { ListIcon as e } from "@webstudio-is/icons/svg";
2
- import { defaultStates as r } from "@webstudio-is/sdk";
3
- import { ol as t, ul as o } from "@webstudio-is/sdk/normalize.css";
2
+ import { defaultStates as t } from "@webstudio-is/sdk";
3
+ import { ol as r, ul as o } from "@webstudio-is/sdk/normalize.css";
4
4
  import { props as p } from "./__generated__/list.props.js";
5
5
  const a = {
6
6
  ol: [
7
- ...t,
7
+ ...r,
8
8
  {
9
- property: "marginTop",
9
+ property: "margin-top",
10
10
  value: { type: "keyword", value: "0" }
11
11
  },
12
12
  {
13
- property: "marginBottom",
13
+ property: "margin-bottom",
14
14
  value: { type: "keyword", value: "10px" }
15
15
  },
16
16
  {
17
- property: "paddingLeft",
17
+ property: "padding-left",
18
18
  value: { type: "keyword", value: "40px" }
19
19
  }
20
20
  ],
21
21
  ul: [
22
22
  ...o,
23
23
  {
24
- property: "marginTop",
24
+ property: "margin-top",
25
25
  value: { type: "keyword", value: "0" }
26
26
  },
27
27
  {
28
- property: "marginBottom",
28
+ property: "margin-bottom",
29
29
  value: { type: "keyword", value: "10px" }
30
30
  },
31
31
  {
32
- property: "paddingLeft",
32
+ property: "padding-left",
33
33
  value: { type: "keyword", value: "40px" }
34
34
  }
35
35
  ]
36
36
  }, d = {
37
37
  type: "container",
38
38
  icon: e,
39
- states: r,
39
+ states: t,
40
40
  presetStyle: a
41
41
  }, s = {
42
42
  props: p,
@@ -10,7 +10,7 @@ const t = {
10
10
  value: { type: "keyword", value: "contents" }
11
11
  },
12
12
  {
13
- property: "whiteSpaceCollapse",
13
+ property: "white-space-collapse",
14
14
  value: { type: "keyword", value: "collapse" }
15
15
  }
16
16
  ]
package/lib/option.ws.js CHANGED
@@ -3,7 +3,7 @@ import { props as t } from "./__generated__/option.props.js";
3
3
  const o = {
4
4
  option: [
5
5
  {
6
- property: "backgroundColor",
6
+ property: "background-color",
7
7
  state: ":checked",
8
8
  value: {
9
9
  type: "rgb",
@@ -2,22 +2,23 @@ import { TextAlignLeftIcon as t } from "@webstudio-is/icons/svg";
2
2
  import { defaultStates as o } from "@webstudio-is/sdk";
3
3
  import { p as r } from "@webstudio-is/sdk/normalize.css";
4
4
  import { props as e } from "./__generated__/paragraph.props.js";
5
- const n = {
5
+ const a = {
6
6
  p: r
7
- }, m = {
7
+ }, c = {
8
8
  type: "container",
9
+ placeholder: "Paragraph",
9
10
  icon: t,
10
11
  constraints: {
11
12
  relation: "ancestor",
12
13
  component: { $neq: "Paragraph" }
13
14
  },
14
15
  states: o,
15
- presetStyle: n
16
- }, c = {
16
+ presetStyle: a
17
+ }, m = {
17
18
  props: e,
18
19
  initialProps: ["id", "className"]
19
20
  };
20
21
  export {
21
- m as meta,
22
- c as propsMeta
22
+ c as meta,
23
+ m as propsMeta
23
24
  };
@@ -6,7 +6,7 @@ const i = {
6
6
  input: [
7
7
  ...o,
8
8
  {
9
- property: "marginRight",
9
+ property: "margin-right",
10
10
  value: { type: "unit", unit: "em", value: 0.5 }
11
11
  }
12
12
  ]
@@ -10,23 +10,23 @@ const p = {
10
10
  value: { type: "keyword", value: "1px" }
11
11
  },
12
12
  {
13
- property: "backgroundColor",
13
+ property: "background-color",
14
14
  value: { type: "keyword", value: "gray" }
15
15
  },
16
16
  {
17
- property: "borderTopStyle",
17
+ property: "border-top-style",
18
18
  value: { type: "keyword", value: "none" }
19
19
  },
20
20
  {
21
- property: "borderRightStyle",
21
+ property: "border-right-style",
22
22
  value: { type: "keyword", value: "none" }
23
23
  },
24
24
  {
25
- property: "borderLeftStyle",
25
+ property: "border-left-style",
26
26
  value: { type: "keyword", value: "none" }
27
27
  },
28
28
  {
29
- property: "borderBottomStyle",
29
+ property: "border-bottom-style",
30
30
  value: { type: "keyword", value: "none" }
31
31
  }
32
32
  ]
@@ -38,11 +38,11 @@ const p = {
38
38
  states: o,
39
39
  presetStyle: p,
40
40
  order: 3
41
- }, d = {
41
+ }, s = {
42
42
  props: t,
43
43
  initialProps: ["id", "className"]
44
44
  };
45
45
  export {
46
46
  n as meta,
47
- d as propsMeta
47
+ s as propsMeta
48
48
  };
package/lib/text.ws.js CHANGED
@@ -6,7 +6,7 @@ const r = {
6
6
  div: [
7
7
  ...o,
8
8
  {
9
- property: "minHeight",
9
+ property: "min-height",
10
10
  value: { type: "unit", unit: "em", value: 1 }
11
11
  }
12
12
  ]
@@ -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: !1
27
+ }
28
+ },
21
29
  initialProps: ["id", "className", "state", "action"]
22
30
  };
23
31
  export {
package/lib/youtube.js CHANGED
@@ -1,22 +1,28 @@
1
- import { jsx as u, jsxs as _, Fragment as R } from "react/jsx-runtime";
2
- import { forwardRef as C, useState as f, useContext as I, useEffect as y } from "react";
3
- import { ReactSdkContext as L } 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
8
  const a = new URL(e);
9
- return a.hostname === "youtu.be" ? a.pathname.slice(1) : a.searchParams.get("v") || a.pathname.split("/").pop();
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, a) => {
14
- var r, s;
15
- const o = k(e.url);
16
- if (!o)
17
- return;
18
- const c = new URL(`${a}/embed/${o}`), l = Object.keys(e), t = {};
19
- for (const n of l)
13
+ }, A = (e, a) => {
14
+ var i, c;
15
+ const l = R(e.url), r = new URL(a);
16
+ if (l)
17
+ r.pathname = `/embed/${l}`;
18
+ else if (e.url)
19
+ try {
20
+ const n = new URL(e.url);
21
+ r.pathname = n.pathname, r.search = n.search;
22
+ } catch {
23
+ }
24
+ const o = Object.keys(e), t = {};
25
+ for (const n of o)
20
26
  switch (n) {
21
27
  case "autoplay":
22
28
  t.autoplay = e.autoplay ? "1" : "0", e.autoplay && e.muted === void 0 && (t.mute = "1");
@@ -34,7 +40,7 @@ const O = "https://www.youtube-nocookie.com", x = "https://www.youtube.com", w =
34
40
  t.keyboard = e.keyboard ? "1" : "0";
35
41
  break;
36
42
  case "loop":
37
- t.loop = e.loop ? "1" : "0", e.loop && (e.playlist ?? "").trim() === "" && (t.playlist = o);
43
+ t.loop = e.loop ? "1" : "0", e.loop && (e.playlist ?? "").trim() === "" && (t.playlist = l);
38
44
  break;
39
45
  case "inline":
40
46
  t.playsinline = e.inline ? "1" : "0";
@@ -52,10 +58,10 @@ const O = "https://www.youtube-nocookie.com", x = "https://www.youtube.com", w =
52
58
  t.iv_load_policy = e.showAnnotations ? "1" : "3";
53
59
  break;
54
60
  case "startTime":
55
- t.start = (r = e.startTime) == null ? void 0 : r.toString();
61
+ t.start = (i = e.startTime) == null ? void 0 : i.toString();
56
62
  break;
57
63
  case "endTime":
58
- t.end = (s = e.endTime) == null ? void 0 : s.toString();
64
+ t.end = (c = e.endTime) == null ? void 0 : c.toString();
59
65
  break;
60
66
  case "disableKeyboard":
61
67
  t.disablekb = e.disableKeyboard ? "1" : "0";
@@ -82,119 +88,124 @@ const O = "https://www.youtube-nocookie.com", x = "https://www.youtube.com", w =
82
88
  t.playlist = e.playlist;
83
89
  break;
84
90
  }
85
- return Object.entries(t).forEach(([n, i]) => {
86
- i !== void 0 && c.searchParams.append(n, i.toString());
87
- }), c.toString();
88
- }, h = (e) => {
91
+ return Object.entries(t).forEach(([n, s]) => {
92
+ s !== void 0 && r.searchParams.append(n, s.toString());
93
+ }), r.toString();
94
+ }, w = (e) => {
89
95
  const a = document.createElement("link");
90
96
  a.rel = "preconnect", a.href = e, a.crossOrigin = "true", document.head.appendChild(a);
91
97
  };
92
- let g = !1;
93
- const T = (e) => {
94
- if (!(g || window.matchMedia("(hover: none)").matches)) {
98
+ let k = !1;
99
+ const N = (e) => {
100
+ if (!(k || window.matchMedia("(hover: none)").matches)) {
95
101
  try {
96
102
  const a = new URL(e);
97
- h(a.origin);
103
+ w(a.origin);
98
104
  } catch {
99
105
  }
100
- h(w), g = !0;
106
+ w(v), k = !0;
101
107
  }
102
- }, 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 = ({
103
109
  title: e,
104
110
  status: a,
105
- loading: o,
106
- videoUrl: c,
107
- previewImageUrl: l,
111
+ loading: l,
112
+ videoUrl: r,
113
+ previewImageUrl: o,
108
114
  autoplay: t,
109
- renderer: r,
110
- showPreview: s,
111
- onStatusChange: n,
112
- onPreviewImageUrlChange: i
115
+ inline: i,
116
+ renderer: c,
117
+ showPreview: n,
118
+ onStatusChange: s,
119
+ onPreviewImageUrlChange: u
113
120
  }) => {
114
- const [m, b] = f(0);
115
- return y(() => {
116
- t && r !== "canvas" && a === "initial" && n("loading");
117
- }, [t, a, r, n]), y(() => {
118
- r !== "canvas" && T(c);
119
- }, [r, c]), y(() => {
120
- const d = k(c);
121
- if (!d || !s) {
122
- i(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);
123
130
  return;
124
131
  }
125
- l || i(j(d));
126
- }, [i, s, c, l]), r === "canvas" || a === "initial" ? null : /* @__PURE__ */ u(
132
+ o || u(P(y));
133
+ }, [u, n, r, o]), c === "canvas" || a === "initial" ? null : /* @__PURE__ */ m(
127
134
  "iframe",
128
135
  {
136
+ ref: d,
129
137
  title: e,
130
- src: c,
131
- loading: o,
138
+ src: r,
139
+ loading: l,
132
140
  allow: "accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture",
133
141
  allowFullScreen: !0,
134
142
  style: {
135
143
  position: "absolute",
136
144
  width: "100%",
137
145
  height: "100%",
138
- opacity: m,
146
+ opacity: b,
139
147
  transition: "opacity 1s",
140
148
  border: "none"
141
149
  },
142
150
  onLoad: () => {
143
- n("ready"), b(1);
151
+ s("ready"), f(1), !i && !t && d.current && S(d.current);
144
152
  }
145
153
  }
146
154
  );
147
- }, P = C(
155
+ }, D = C(
148
156
  ({
149
157
  url: e,
150
158
  loading: a = "lazy",
151
- autoplay: o,
152
- showPreview: c,
153
- children: l,
159
+ autoplay: l,
160
+ showPreview: r,
161
+ children: o,
154
162
  privacyEnhancedMode: t,
155
- ...r
156
- }, s) => {
157
- const [n, i] = f("initial"), [m, b] = f(), { renderer: d } = I(L), v = t ?? !0 ? O : x, p = S(
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(
158
167
  {
159
- ...r,
168
+ ...c,
169
+ inline: i,
160
170
  url: e,
161
171
  autoplay: !0
162
172
  },
163
- v
173
+ y
164
174
  );
165
- return /* @__PURE__ */ u(
166
- E.Provider,
175
+ return /* @__PURE__ */ m(
176
+ x.Provider,
167
177
  {
168
178
  value: {
169
- status: n,
170
- previewImageUrl: m,
179
+ status: s,
180
+ previewImageUrl: b,
171
181
  onInitPlayer() {
172
- d !== "canvas" && i("loading");
182
+ d !== "canvas" && u("loading");
173
183
  }
174
184
  },
175
- children: /* @__PURE__ */ u("div", { ...r, ref: s, children: p ? /* @__PURE__ */ _(R, { children: [
176
- l,
177
- /* @__PURE__ */ u(
178
- N,
185
+ children: /* @__PURE__ */ m("div", { ...c, ref: n, children: g ? /* @__PURE__ */ _(L, { children: [
186
+ o,
187
+ /* @__PURE__ */ m(
188
+ V,
179
189
  {
180
- title: r.title,
181
- autoplay: o,
182
- videoUrl: p,
183
- previewImageUrl: m,
190
+ title: c.title,
191
+ autoplay: l,
192
+ videoUrl: g,
193
+ previewImageUrl: b,
184
194
  loading: a,
185
- showPreview: c,
195
+ inline: i,
196
+ showPreview: r,
186
197
  renderer: d,
187
- status: n,
188
- onStatusChange: i,
189
- onPreviewImageUrlChange: b
198
+ status: s,
199
+ onStatusChange: u,
200
+ onPreviewImageUrlChange: f
190
201
  }
191
202
  )
192
- ] }) : /* @__PURE__ */ u(A, {}) })
203
+ ] }) : /* @__PURE__ */ m(U, {}) })
193
204
  }
194
205
  );
195
206
  }
196
207
  );
197
- P.displayName = "YouTube";
208
+ D.displayName = "YouTube";
198
209
  export {
199
- P as YouTube
210
+ D as YouTube
200
211
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webstudio-is/sdk-components-react",
3
- "version": "0.0.0-4f7bf18",
3
+ "version": "0.0.0-50b8685",
4
4
  "description": "Webstudio default library for react",
5
5
  "author": "Webstudio <github@webstudio.is>",
6
6
  "homepage": "https://webstudio.is",
@@ -44,25 +44,26 @@
44
44
  "react-dom": "18.3.0-canary-14898b6a9-20240318"
45
45
  },
46
46
  "dependencies": {
47
- "@react-aria/utils": "^3.26.0",
47
+ "@react-aria/utils": "^3.27.0",
48
48
  "await-interaction-response": "^0.0.2",
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.0.0-4f7bf18",
53
- "@webstudio-is/image": "0.0.0-4f7bf18",
54
- "@webstudio-is/sdk": "0.0.0-4f7bf18",
55
- "@webstudio-is/react-sdk": "0.0.0-4f7bf18"
52
+ "@webstudio-is/icons": "0.0.0-50b8685",
53
+ "@webstudio-is/react-sdk": "0.0.0-50b8685",
54
+ "@webstudio-is/image": "0.0.0-50b8685",
55
+ "@webstudio-is/sdk": "0.0.0-50b8685"
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.2",
64
+ "vitest": "^3.0.8",
64
65
  "@webstudio-is/generate-arg-types": "0.0.0",
65
- "@webstudio-is/template": "0.0.0-4f7bf18",
66
+ "@webstudio-is/template": "0.0.0-50b8685",
66
67
  "@webstudio-is/tsconfig": "1.0.7",
67
68
  "@webstudio-is/sdk-cli": "0.94.0"
68
69
  },