@webstudio-is/sdk-components-react 0.200.0 → 0.202.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/fragment.ws.js +5 -6
- package/lib/head-link.ws.js +6 -7
- package/lib/head-meta.ws.js +2 -3
- package/lib/head-slot.ws.js +4 -5
- package/lib/head-title.ws.js +2 -3
- package/lib/slot.ws.js +2 -3
- package/lib/xml-node.ws.js +4 -5
- package/lib/xml-time.ws.js +2 -3
- package/lib/youtube.js +92 -86
- package/package.json +7 -7
package/lib/fragment.ws.js
CHANGED
package/lib/head-link.ws.js
CHANGED
|
@@ -1,20 +1,19 @@
|
|
|
1
1
|
import { ResourceIcon as o } from "@webstudio-is/icons/svg";
|
|
2
2
|
import "@webstudio-is/sdk";
|
|
3
|
-
import { props as
|
|
4
|
-
const
|
|
3
|
+
import { props as t } from "./__generated__/head-link.props.js";
|
|
4
|
+
const p = {
|
|
5
5
|
category: "hidden",
|
|
6
6
|
icon: o,
|
|
7
7
|
type: "container",
|
|
8
|
-
stylable: !1,
|
|
9
8
|
constraints: {
|
|
10
9
|
relation: "parent",
|
|
11
10
|
component: { $eq: "HeadSlot" }
|
|
12
11
|
}
|
|
13
|
-
},
|
|
14
|
-
props:
|
|
12
|
+
}, a = {
|
|
13
|
+
props: t,
|
|
15
14
|
initialProps: ["rel", "hrefLang", "href", "type", "as"]
|
|
16
15
|
};
|
|
17
16
|
export {
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
p as meta,
|
|
18
|
+
a as propsMeta
|
|
20
19
|
};
|
package/lib/head-meta.ws.js
CHANGED
|
@@ -5,16 +5,15 @@ const p = {
|
|
|
5
5
|
category: "hidden",
|
|
6
6
|
icon: o,
|
|
7
7
|
type: "container",
|
|
8
|
-
stylable: !1,
|
|
9
8
|
constraints: {
|
|
10
9
|
relation: "parent",
|
|
11
10
|
component: { $eq: "HeadSlot" }
|
|
12
11
|
}
|
|
13
|
-
},
|
|
12
|
+
}, i = {
|
|
14
13
|
props: t,
|
|
15
14
|
initialProps: ["name", "property", "content"]
|
|
16
15
|
};
|
|
17
16
|
export {
|
|
18
17
|
p as meta,
|
|
19
|
-
|
|
18
|
+
i as propsMeta
|
|
20
19
|
};
|
package/lib/head-slot.ws.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { HeaderIcon as
|
|
1
|
+
import { HeaderIcon as o } from "@webstudio-is/icons/svg";
|
|
2
2
|
import "@webstudio-is/sdk";
|
|
3
|
-
import { props as
|
|
3
|
+
import { props as t } from "./__generated__/head.props.js";
|
|
4
4
|
const r = {
|
|
5
|
-
icon:
|
|
5
|
+
icon: o,
|
|
6
6
|
type: "container",
|
|
7
|
-
stylable: !1,
|
|
8
7
|
description: "Inserts children into the head of the document",
|
|
9
8
|
constraints: [
|
|
10
9
|
{
|
|
@@ -17,7 +16,7 @@ const r = {
|
|
|
17
16
|
}
|
|
18
17
|
]
|
|
19
18
|
}, a = {
|
|
20
|
-
props:
|
|
19
|
+
props: t,
|
|
21
20
|
initialProps: []
|
|
22
21
|
};
|
|
23
22
|
export {
|
package/lib/head-title.ws.js
CHANGED
|
@@ -5,15 +5,14 @@ const p = {
|
|
|
5
5
|
category: "hidden",
|
|
6
6
|
icon: o,
|
|
7
7
|
type: "container",
|
|
8
|
-
stylable: !1,
|
|
9
8
|
constraints: {
|
|
10
9
|
relation: "parent",
|
|
11
10
|
component: { $eq: "HeadSlot" }
|
|
12
11
|
}
|
|
13
|
-
},
|
|
12
|
+
}, i = {
|
|
14
13
|
props: t
|
|
15
14
|
};
|
|
16
15
|
export {
|
|
17
16
|
p as meta,
|
|
18
|
-
|
|
17
|
+
i as propsMeta
|
|
19
18
|
};
|
package/lib/slot.ws.js
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import { SlotComponentIcon as t } from "@webstudio-is/icons/svg";
|
|
2
|
-
const
|
|
2
|
+
const e = {
|
|
3
3
|
category: "general",
|
|
4
4
|
type: "container",
|
|
5
5
|
description: "Slot is a container for content that you want to reference across the project. Changes made to a Slot's children will be reflected in all other instances of that Slot.",
|
|
6
6
|
icon: t,
|
|
7
|
-
stylable: !1,
|
|
8
7
|
order: 5
|
|
9
8
|
}, n = {
|
|
10
9
|
props: {}
|
|
11
10
|
};
|
|
12
11
|
export {
|
|
13
|
-
|
|
12
|
+
e as meta,
|
|
14
13
|
n as propsMeta
|
|
15
14
|
};
|
package/lib/xml-node.ws.js
CHANGED
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
import { XmlIcon as o } from "@webstudio-is/icons/svg";
|
|
2
|
-
import { props as
|
|
3
|
-
const
|
|
2
|
+
import { props as r } from "./__generated__/xml-node.props.js";
|
|
3
|
+
const e = {
|
|
4
4
|
category: "xml",
|
|
5
5
|
order: 6,
|
|
6
6
|
type: "container",
|
|
7
7
|
icon: o,
|
|
8
|
-
stylable: !1,
|
|
9
8
|
description: "XML Node"
|
|
10
9
|
}, i = {
|
|
11
|
-
props:
|
|
10
|
+
props: r,
|
|
12
11
|
initialProps: ["tag"]
|
|
13
12
|
};
|
|
14
13
|
export {
|
|
15
|
-
|
|
14
|
+
e as meta,
|
|
16
15
|
i as propsMeta
|
|
17
16
|
};
|
package/lib/xml-time.ws.js
CHANGED
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
import { CalendarIcon as t } from "@webstudio-is/icons/svg";
|
|
2
2
|
import { props as e } from "./__generated__/xml-time.props.js";
|
|
3
|
-
const
|
|
3
|
+
const a = {
|
|
4
4
|
category: "xml",
|
|
5
5
|
type: "container",
|
|
6
6
|
description: "Converts machine-readable date and time to ISO format.",
|
|
7
7
|
icon: t,
|
|
8
|
-
stylable: !1,
|
|
9
8
|
order: 7
|
|
10
9
|
}, i = {
|
|
11
10
|
props: e,
|
|
12
11
|
initialProps: ["datetime", "dateStyle"]
|
|
13
12
|
};
|
|
14
13
|
export {
|
|
15
|
-
|
|
14
|
+
a as meta,
|
|
16
15
|
i as propsMeta
|
|
17
16
|
};
|
package/lib/youtube.js
CHANGED
|
@@ -1,134 +1,140 @@
|
|
|
1
|
-
import { jsx as u, jsxs as
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import { ReactSdkContext as
|
|
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
4
|
import { VimeoContext as E } from "./vimeo.js";
|
|
5
5
|
const O = "https://www.youtube-nocookie.com", x = "https://www.youtube.com", w = "https://img.youtube.com", k = (e) => {
|
|
6
6
|
if (e)
|
|
7
7
|
try {
|
|
8
|
-
const
|
|
9
|
-
return
|
|
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();
|
|
10
10
|
} catch {
|
|
11
11
|
return e;
|
|
12
12
|
}
|
|
13
|
-
}, S = (e,
|
|
14
|
-
var
|
|
15
|
-
const
|
|
16
|
-
if (
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
13
|
+
}, S = (e, t) => {
|
|
14
|
+
var n, i;
|
|
15
|
+
const l = k(e.url), r = new URL(t);
|
|
16
|
+
if (l)
|
|
17
|
+
r.pathname = `/embed/${l}`;
|
|
18
|
+
else if (e.url)
|
|
19
|
+
try {
|
|
20
|
+
const c = new URL(e.url);
|
|
21
|
+
r.pathname = c.pathname, r.search = c.search;
|
|
22
|
+
} catch {
|
|
23
|
+
}
|
|
24
|
+
const o = Object.keys(e), a = {};
|
|
25
|
+
for (const c of o)
|
|
26
|
+
switch (c) {
|
|
21
27
|
case "autoplay":
|
|
22
|
-
|
|
28
|
+
a.autoplay = e.autoplay ? "1" : "0", e.autoplay && e.muted === void 0 && (a.mute = "1");
|
|
23
29
|
break;
|
|
24
30
|
case "muted":
|
|
25
|
-
|
|
31
|
+
a.mute = e.muted ? "1" : "0";
|
|
26
32
|
break;
|
|
27
33
|
case "showControls":
|
|
28
|
-
|
|
34
|
+
a.controls = e.showControls ? "1" : "0";
|
|
29
35
|
break;
|
|
30
36
|
case "showRelatedVideos":
|
|
31
|
-
|
|
37
|
+
a.rel = e.showRelatedVideos ? "1" : "0";
|
|
32
38
|
break;
|
|
33
39
|
case "keyboard":
|
|
34
|
-
|
|
40
|
+
a.keyboard = e.keyboard ? "1" : "0";
|
|
35
41
|
break;
|
|
36
42
|
case "loop":
|
|
37
|
-
|
|
43
|
+
a.loop = e.loop ? "1" : "0", e.loop && (e.playlist ?? "").trim() === "" && (a.playlist = l);
|
|
38
44
|
break;
|
|
39
45
|
case "inline":
|
|
40
|
-
|
|
46
|
+
a.playsinline = e.inline ? "1" : "0";
|
|
41
47
|
break;
|
|
42
48
|
case "allowFullscreen":
|
|
43
|
-
|
|
49
|
+
a.fs = e.allowFullscreen ? "1" : "0";
|
|
44
50
|
break;
|
|
45
51
|
case "captionLanguage":
|
|
46
|
-
|
|
52
|
+
a.cc_lang_pref = e.captionLanguage;
|
|
47
53
|
break;
|
|
48
54
|
case "showCaptions":
|
|
49
|
-
|
|
55
|
+
a.cc_load_policy = e.showCaptions ? "1" : "0";
|
|
50
56
|
break;
|
|
51
57
|
case "showAnnotations":
|
|
52
|
-
|
|
58
|
+
a.iv_load_policy = e.showAnnotations ? "1" : "3";
|
|
53
59
|
break;
|
|
54
60
|
case "startTime":
|
|
55
|
-
|
|
61
|
+
a.start = (n = e.startTime) == null ? void 0 : n.toString();
|
|
56
62
|
break;
|
|
57
63
|
case "endTime":
|
|
58
|
-
|
|
64
|
+
a.end = (i = e.endTime) == null ? void 0 : i.toString();
|
|
59
65
|
break;
|
|
60
66
|
case "disableKeyboard":
|
|
61
|
-
|
|
67
|
+
a.disablekb = e.disableKeyboard ? "1" : "0";
|
|
62
68
|
break;
|
|
63
69
|
case "language":
|
|
64
|
-
|
|
70
|
+
a.hl = e.language;
|
|
65
71
|
break;
|
|
66
72
|
case "listId":
|
|
67
|
-
|
|
73
|
+
a.list = e.listId;
|
|
68
74
|
break;
|
|
69
75
|
case "listType":
|
|
70
|
-
|
|
76
|
+
a.listType = e.listType;
|
|
71
77
|
break;
|
|
72
78
|
case "color":
|
|
73
|
-
|
|
79
|
+
a.color = e.color;
|
|
74
80
|
break;
|
|
75
81
|
case "origin":
|
|
76
|
-
|
|
82
|
+
a.origin = e.origin;
|
|
77
83
|
break;
|
|
78
84
|
case "referrer":
|
|
79
|
-
|
|
85
|
+
a.widget_referrer = e.referrer;
|
|
80
86
|
break;
|
|
81
87
|
case "playlist":
|
|
82
|
-
|
|
88
|
+
a.playlist = e.playlist;
|
|
83
89
|
break;
|
|
84
90
|
}
|
|
85
|
-
return Object.entries(
|
|
86
|
-
|
|
87
|
-
}),
|
|
88
|
-
},
|
|
89
|
-
const
|
|
90
|
-
|
|
91
|
+
return Object.entries(a).forEach(([c, s]) => {
|
|
92
|
+
s !== void 0 && r.searchParams.append(c, s.toString());
|
|
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);
|
|
91
97
|
};
|
|
92
98
|
let g = !1;
|
|
93
99
|
const T = (e) => {
|
|
94
100
|
if (!(g || window.matchMedia("(hover: none)").matches)) {
|
|
95
101
|
try {
|
|
96
|
-
const
|
|
97
|
-
|
|
102
|
+
const t = new URL(e);
|
|
103
|
+
p(t.origin);
|
|
98
104
|
} catch {
|
|
99
105
|
}
|
|
100
|
-
|
|
106
|
+
p(w), g = !0;
|
|
101
107
|
}
|
|
102
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 = ({
|
|
103
109
|
title: e,
|
|
104
|
-
status:
|
|
105
|
-
loading:
|
|
106
|
-
videoUrl:
|
|
107
|
-
previewImageUrl:
|
|
108
|
-
autoplay:
|
|
109
|
-
renderer:
|
|
110
|
-
showPreview:
|
|
111
|
-
onStatusChange:
|
|
112
|
-
onPreviewImageUrlChange:
|
|
110
|
+
status: t,
|
|
111
|
+
loading: l,
|
|
112
|
+
videoUrl: r,
|
|
113
|
+
previewImageUrl: o,
|
|
114
|
+
autoplay: a,
|
|
115
|
+
renderer: n,
|
|
116
|
+
showPreview: i,
|
|
117
|
+
onStatusChange: c,
|
|
118
|
+
onPreviewImageUrlChange: s
|
|
113
119
|
}) => {
|
|
114
|
-
const [m, b] =
|
|
120
|
+
const [m, b] = h(0);
|
|
115
121
|
return y(() => {
|
|
116
|
-
|
|
117
|
-
}, [
|
|
118
|
-
|
|
119
|
-
}, [
|
|
120
|
-
const d = k(
|
|
121
|
-
if (!d || !
|
|
122
|
-
|
|
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);
|
|
123
129
|
return;
|
|
124
130
|
}
|
|
125
|
-
|
|
126
|
-
}, [
|
|
131
|
+
o || s(j(d));
|
|
132
|
+
}, [s, i, r, o]), n === "canvas" || t === "initial" ? null : /* @__PURE__ */ u(
|
|
127
133
|
"iframe",
|
|
128
134
|
{
|
|
129
135
|
title: e,
|
|
130
|
-
src:
|
|
131
|
-
loading:
|
|
136
|
+
src: r,
|
|
137
|
+
loading: l,
|
|
132
138
|
allow: "accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture",
|
|
133
139
|
allowFullScreen: !0,
|
|
134
140
|
style: {
|
|
@@ -140,23 +146,23 @@ const T = (e) => {
|
|
|
140
146
|
border: "none"
|
|
141
147
|
},
|
|
142
148
|
onLoad: () => {
|
|
143
|
-
|
|
149
|
+
c("ready"), b(1);
|
|
144
150
|
}
|
|
145
151
|
}
|
|
146
152
|
);
|
|
147
|
-
}, P =
|
|
153
|
+
}, P = L(
|
|
148
154
|
({
|
|
149
155
|
url: e,
|
|
150
|
-
loading:
|
|
151
|
-
autoplay:
|
|
152
|
-
showPreview:
|
|
153
|
-
children:
|
|
154
|
-
privacyEnhancedMode:
|
|
155
|
-
...
|
|
156
|
-
},
|
|
157
|
-
const [
|
|
156
|
+
loading: t = "lazy",
|
|
157
|
+
autoplay: l,
|
|
158
|
+
showPreview: r,
|
|
159
|
+
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(
|
|
158
164
|
{
|
|
159
|
-
...
|
|
165
|
+
...n,
|
|
160
166
|
url: e,
|
|
161
167
|
autoplay: !0
|
|
162
168
|
},
|
|
@@ -166,26 +172,26 @@ const T = (e) => {
|
|
|
166
172
|
E.Provider,
|
|
167
173
|
{
|
|
168
174
|
value: {
|
|
169
|
-
status:
|
|
175
|
+
status: c,
|
|
170
176
|
previewImageUrl: m,
|
|
171
177
|
onInitPlayer() {
|
|
172
|
-
d !== "canvas" &&
|
|
178
|
+
d !== "canvas" && s("loading");
|
|
173
179
|
}
|
|
174
180
|
},
|
|
175
|
-
children: /* @__PURE__ */ u("div", { ...
|
|
176
|
-
|
|
181
|
+
children: /* @__PURE__ */ u("div", { ...n, ref: i, children: f ? /* @__PURE__ */ R(_, { children: [
|
|
182
|
+
o,
|
|
177
183
|
/* @__PURE__ */ u(
|
|
178
184
|
N,
|
|
179
185
|
{
|
|
180
|
-
title:
|
|
181
|
-
autoplay:
|
|
182
|
-
videoUrl:
|
|
186
|
+
title: n.title,
|
|
187
|
+
autoplay: l,
|
|
188
|
+
videoUrl: f,
|
|
183
189
|
previewImageUrl: m,
|
|
184
|
-
loading:
|
|
185
|
-
showPreview:
|
|
190
|
+
loading: t,
|
|
191
|
+
showPreview: r,
|
|
186
192
|
renderer: d,
|
|
187
|
-
status:
|
|
188
|
-
onStatusChange:
|
|
193
|
+
status: c,
|
|
194
|
+
onStatusChange: s,
|
|
189
195
|
onPreviewImageUrlChange: b
|
|
190
196
|
}
|
|
191
197
|
)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webstudio-is/sdk-components-react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.202.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.1",
|
|
51
51
|
"micromark-extension-gfm-table": "^2.1.0",
|
|
52
|
-
"@webstudio-is/
|
|
53
|
-
"@webstudio-is/
|
|
54
|
-
"@webstudio-is/
|
|
55
|
-
"@webstudio-is/react-sdk": "0.
|
|
52
|
+
"@webstudio-is/image": "0.202.0",
|
|
53
|
+
"@webstudio-is/sdk": "0.202.0",
|
|
54
|
+
"@webstudio-is/icons": "0.202.0",
|
|
55
|
+
"@webstudio-is/react-sdk": "0.202.0"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
58
|
"@testing-library/react": "^14.2.2",
|
|
@@ -61,9 +61,9 @@
|
|
|
61
61
|
"react": "18.3.0-canary-14898b6a9-20240318",
|
|
62
62
|
"react-dom": "18.3.0-canary-14898b6a9-20240318",
|
|
63
63
|
"vitest": "^3.0.2",
|
|
64
|
-
"@webstudio-is/sdk-cli": "0.94.0",
|
|
65
64
|
"@webstudio-is/generate-arg-types": "0.0.0",
|
|
66
|
-
"@webstudio-is/
|
|
65
|
+
"@webstudio-is/sdk-cli": "0.94.0",
|
|
66
|
+
"@webstudio-is/template": "0.202.0",
|
|
67
67
|
"@webstudio-is/tsconfig": "1.0.7"
|
|
68
68
|
},
|
|
69
69
|
"scripts": {
|