@webstudio-is/sdk-components-react 0.224.0 → 0.226.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/video.js +24 -24
- package/lib/xml-node.js +14 -13
- package/package.json +7 -7
package/lib/video.js
CHANGED
|
@@ -1,50 +1,50 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { forwardRef as
|
|
1
|
+
import { jsx as E } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as y, useId as V, useContext as N, useEffect as x } from "react";
|
|
3
3
|
import { ReactSdkContext as I } from "@webstudio-is/react-sdk/runtime";
|
|
4
4
|
const c = "data-ws-video-id", S = {
|
|
5
5
|
HAVE_METADATA: 1
|
|
6
|
-
}, _ =
|
|
6
|
+
}, _ = y(
|
|
7
7
|
({
|
|
8
|
-
$progress:
|
|
9
|
-
$visible:
|
|
10
|
-
$timeline:
|
|
11
|
-
$webstudio$canvasOnly$assetId:
|
|
8
|
+
$progress: r,
|
|
9
|
+
$visible: n,
|
|
10
|
+
$timeline: a,
|
|
11
|
+
$webstudio$canvasOnly$assetId: w,
|
|
12
12
|
children: l,
|
|
13
|
-
src:
|
|
13
|
+
src: d,
|
|
14
14
|
...b
|
|
15
15
|
}, m) => {
|
|
16
|
-
const
|
|
17
|
-
[c]:
|
|
18
|
-
}, {
|
|
16
|
+
const o = V(), A = {
|
|
17
|
+
[c]: o
|
|
18
|
+
}, { videoLoader: f } = N(I), T = d && f ? f({ src: d }) : void 0;
|
|
19
19
|
return x(() => {
|
|
20
|
-
if (
|
|
20
|
+
if (r === void 0 || n === void 0)
|
|
21
21
|
return;
|
|
22
|
-
const e = document.querySelector(`[${c}="${
|
|
22
|
+
const e = document.querySelector(`[${c}="${o}"]`);
|
|
23
23
|
if (e === null || !(e instanceof HTMLVideoElement))
|
|
24
24
|
return;
|
|
25
25
|
if (e.play().catch(() => {
|
|
26
|
-
}), e.pause(),
|
|
27
|
-
return
|
|
26
|
+
}), e.pause(), a)
|
|
27
|
+
return r.subscribe((t) => {
|
|
28
28
|
if (e.readyState < S.HAVE_METADATA || (e.paused || e.pause(), e.seeking))
|
|
29
29
|
return;
|
|
30
|
-
let
|
|
31
|
-
Number.isNaN(
|
|
30
|
+
let s = e.duration;
|
|
31
|
+
Number.isNaN(s) || (Number.isFinite(s) || (s = 60), e.currentTime = (t ?? 0) * s);
|
|
32
32
|
});
|
|
33
|
-
let i = !1,
|
|
34
|
-
const v =
|
|
35
|
-
|
|
36
|
-
}),
|
|
33
|
+
let i = !1, u = !1;
|
|
34
|
+
const v = n.subscribe((t) => {
|
|
35
|
+
u = t, u === !1 && i === !1 && !e.loop && (e.currentTime = 0);
|
|
36
|
+
}), p = r.subscribe((t) => {
|
|
37
37
|
if (i && (t === void 0 || t === 0 || t === 1)) {
|
|
38
|
-
i = !1, e.pause(),
|
|
38
|
+
i = !1, e.pause(), u === !1 && i === !1 && !e.loop && (e.currentTime = 0);
|
|
39
39
|
return;
|
|
40
40
|
}
|
|
41
41
|
i || (i = !0, e.ended || e.play().catch(() => {
|
|
42
42
|
}));
|
|
43
43
|
});
|
|
44
44
|
return () => {
|
|
45
|
-
|
|
45
|
+
p(), v();
|
|
46
46
|
};
|
|
47
|
-
}, [
|
|
47
|
+
}, [r, a, n, o]), /* @__PURE__ */ E("video", { src: T, ...b, ...A, ref: m, children: l });
|
|
48
48
|
}
|
|
49
49
|
);
|
|
50
50
|
_.displayName = "Video";
|
package/lib/xml-node.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as r, jsx as t, Fragment as u } from "react/jsx-runtime";
|
|
2
2
|
import { ReactSdkContext as g, xmlNodeTagSuffix as x } from "@webstudio-is/react-sdk/runtime";
|
|
3
3
|
import { forwardRef as b, useContext as C, createElement as N, Children as F } from "react";
|
|
4
4
|
const j = b(
|
|
@@ -14,38 +14,39 @@ const j = b(
|
|
|
14
14
|
l
|
|
15
15
|
);
|
|
16
16
|
}
|
|
17
|
-
const n = F.toArray(l), a = n.length > 0 && n.every((e) => typeof e == "string"), m = (e) => e.map(([f, h], y) => /* @__PURE__ */
|
|
17
|
+
const n = F.toArray(l), a = n.length > 0 && n.every((e) => typeof e == "string"), m = (e) => e.map(([f, h], y) => /* @__PURE__ */ r("span", { children: [
|
|
18
18
|
" ",
|
|
19
|
-
/* @__PURE__ */
|
|
20
|
-
/* @__PURE__ */
|
|
21
|
-
/* @__PURE__ */
|
|
19
|
+
/* @__PURE__ */ t("span", { style: { color: "#FF0000" }, children: f }),
|
|
20
|
+
/* @__PURE__ */ t("span", { style: { color: "#000000" }, children: "=" }),
|
|
21
|
+
/* @__PURE__ */ r("span", { style: { color: "#0000FF" }, children: [
|
|
22
22
|
'"',
|
|
23
23
|
h,
|
|
24
24
|
'"'
|
|
25
25
|
] })
|
|
26
26
|
] }, y));
|
|
27
|
-
return /* @__PURE__ */
|
|
28
|
-
/* @__PURE__ */
|
|
29
|
-
/* @__PURE__ */
|
|
27
|
+
return /* @__PURE__ */ r("div", { ...i, style: { backgroundColor: "rgba(255,255,255,1)" }, children: [
|
|
28
|
+
/* @__PURE__ */ r("span", { children: [
|
|
29
|
+
/* @__PURE__ */ r("span", { style: { color: "#800000" }, children: [
|
|
30
30
|
"<",
|
|
31
31
|
s
|
|
32
32
|
] }),
|
|
33
33
|
o.length > 0 && m(o),
|
|
34
|
-
n.length === 0 ? /* @__PURE__ */
|
|
34
|
+
n.length === 0 ? /* @__PURE__ */ t("span", { style: { color: "#800000" }, children: "/>" }) : /* @__PURE__ */ t("span", { style: { color: "#800000" }, children: ">" })
|
|
35
35
|
] }),
|
|
36
|
-
n.length > 0 && /* @__PURE__ */
|
|
37
|
-
/* @__PURE__ */
|
|
36
|
+
n.length > 0 && /* @__PURE__ */ r(u, { children: [
|
|
37
|
+
/* @__PURE__ */ t(
|
|
38
38
|
"div",
|
|
39
39
|
{
|
|
40
40
|
ref: d,
|
|
41
41
|
style: {
|
|
42
42
|
display: a ? "inline" : "block",
|
|
43
|
-
marginLeft: a ? 0 : "1rem"
|
|
43
|
+
marginLeft: a ? 0 : "1rem",
|
|
44
|
+
color: "#000000"
|
|
44
45
|
},
|
|
45
46
|
children: l
|
|
46
47
|
}
|
|
47
48
|
),
|
|
48
|
-
/* @__PURE__ */
|
|
49
|
+
/* @__PURE__ */ r("span", { style: { color: "#800000" }, children: [
|
|
49
50
|
"</",
|
|
50
51
|
s,
|
|
51
52
|
">"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webstudio-is/sdk-components-react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.226.0",
|
|
4
4
|
"description": "Webstudio default library for react",
|
|
5
5
|
"author": "Webstudio <github@webstudio.is>",
|
|
6
6
|
"homepage": "https://webstudio.is",
|
|
@@ -44,10 +44,10 @@
|
|
|
44
44
|
"colord": "^2.9.3",
|
|
45
45
|
"micromark": "^4.0.2",
|
|
46
46
|
"micromark-extension-gfm-table": "^2.1.1",
|
|
47
|
-
"@webstudio-is/icons": "0.
|
|
48
|
-
"@webstudio-is/
|
|
49
|
-
"@webstudio-is/
|
|
50
|
-
"@webstudio-is/sdk": "0.
|
|
47
|
+
"@webstudio-is/icons": "0.226.0",
|
|
48
|
+
"@webstudio-is/sdk": "0.226.0",
|
|
49
|
+
"@webstudio-is/image": "0.226.0",
|
|
50
|
+
"@webstudio-is/react-sdk": "0.226.0"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"@testing-library/dom": "^10.4.0",
|
|
@@ -58,9 +58,9 @@
|
|
|
58
58
|
"react": "18.3.0-canary-14898b6a9-20240318",
|
|
59
59
|
"react-dom": "18.3.0-canary-14898b6a9-20240318",
|
|
60
60
|
"vitest": "^3.1.2",
|
|
61
|
-
"@webstudio-is/generate-arg-types": "0.0.0",
|
|
62
61
|
"@webstudio-is/sdk-cli": "0.94.0",
|
|
63
|
-
"@webstudio-is/
|
|
62
|
+
"@webstudio-is/generate-arg-types": "0.0.0",
|
|
63
|
+
"@webstudio-is/template": "0.226.0",
|
|
64
64
|
"@webstudio-is/tsconfig": "1.0.7"
|
|
65
65
|
},
|
|
66
66
|
"scripts": {
|