@webstudio-is/sdk-components-react 0.209.0 → 0.212.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/__generated__/box.props.js +1 -19
- package/lib/__generated__/heading.props.js +1 -8
- package/lib/__generated__/text.props.js +1 -8
- package/lib/__generated__/video.props.js +587 -0
- package/lib/box.js +9 -6
- package/lib/box.ws.js +38 -18
- package/lib/button.ws.js +6 -10
- package/lib/checkbox.template.js +1 -1
- package/lib/checkbox.ws.js +12 -16
- package/lib/code-text.ws.js +4 -8
- package/lib/components.js +6 -4
- package/lib/form.ws.js +10 -14
- package/lib/heading.js +9 -6
- package/lib/heading.ws.js +22 -18
- package/lib/input.ws.js +8 -12
- package/lib/label.ws.js +8 -12
- package/lib/link.ws.js +2 -6
- package/lib/list-item.ws.js +5 -12
- package/lib/metas.js +6 -4
- package/lib/option.ws.js +2 -6
- package/lib/paragraph.ws.js +6 -10
- package/lib/props.js +4 -2
- package/lib/radio-button.template.js +1 -1
- package/lib/radio-button.ws.js +6 -10
- package/lib/select.ws.js +6 -10
- package/lib/text.js +9 -7
- package/lib/text.ws.js +23 -15
- package/lib/textarea.ws.js +10 -14
- package/lib/types/__generated__/video.props.d.ts +2 -0
- package/lib/types/box.d.ts +2 -3
- package/lib/types/components.d.ts +1 -0
- package/lib/types/heading.d.ts +1 -2
- package/lib/types/link.d.ts +1 -1
- package/lib/types/metas.d.ts +1 -0
- package/lib/types/props.d.ts +1 -0
- package/lib/types/text.d.ts +2 -3
- package/lib/types/video.d.ts +7 -0
- package/lib/types/video.ws.d.ts +3 -0
- package/lib/video.js +46 -0
- package/lib/video.ws.js +34 -0
- package/lib/webhook-form.ws.js +10 -14
- package/lib/youtube.js +115 -101
- package/package.json +9 -8
package/lib/radio-button.ws.js
CHANGED
|
@@ -2,7 +2,7 @@ import { RadioCheckedIcon as e } from "@webstudio-is/icons/svg";
|
|
|
2
2
|
import { defaultStates as t } from "@webstudio-is/sdk";
|
|
3
3
|
import { radio as o } from "@webstudio-is/sdk/normalize.css";
|
|
4
4
|
import { props as r } from "./__generated__/radio-button.props.js";
|
|
5
|
-
const
|
|
5
|
+
const a = {
|
|
6
6
|
input: [
|
|
7
7
|
...o,
|
|
8
8
|
{
|
|
@@ -10,15 +10,11 @@ const i = {
|
|
|
10
10
|
value: { type: "unit", unit: "em", value: 0.5 }
|
|
11
11
|
}
|
|
12
12
|
]
|
|
13
|
-
},
|
|
14
|
-
constraints: {
|
|
15
|
-
relation: "ancestor",
|
|
16
|
-
component: { $nin: ["Button", "Link"] }
|
|
17
|
-
},
|
|
13
|
+
}, s = {
|
|
18
14
|
type: "control",
|
|
19
15
|
label: "Radio",
|
|
20
16
|
icon: e,
|
|
21
|
-
presetStyle:
|
|
17
|
+
presetStyle: a,
|
|
22
18
|
states: [
|
|
23
19
|
...t,
|
|
24
20
|
{ selector: ":checked", label: "Checked" },
|
|
@@ -30,11 +26,11 @@ const i = {
|
|
|
30
26
|
//{ selector: ":read-only", label: "Read Only" },
|
|
31
27
|
//{ selector: ":read-write", label: "Read Write" },
|
|
32
28
|
]
|
|
33
|
-
},
|
|
29
|
+
}, n = {
|
|
34
30
|
props: r,
|
|
35
31
|
initialProps: ["id", "className", "name", "value", "required", "checked"]
|
|
36
32
|
};
|
|
37
33
|
export {
|
|
38
|
-
|
|
39
|
-
|
|
34
|
+
s as meta,
|
|
35
|
+
n as propsMeta
|
|
40
36
|
};
|
package/lib/select.ws.js
CHANGED
|
@@ -1,32 +1,28 @@
|
|
|
1
1
|
import { SelectIcon as e } from "@webstudio-is/icons/svg";
|
|
2
|
-
import { defaultStates as
|
|
3
|
-
import { select as
|
|
2
|
+
import { defaultStates as l } from "@webstudio-is/sdk";
|
|
3
|
+
import { select as t } from "@webstudio-is/sdk/normalize.css";
|
|
4
4
|
import { props as o } from "./__generated__/select.props.js";
|
|
5
5
|
const r = {
|
|
6
6
|
select: [
|
|
7
|
-
...
|
|
7
|
+
...t,
|
|
8
8
|
{
|
|
9
9
|
property: "display",
|
|
10
10
|
value: { type: "keyword", value: "block" }
|
|
11
11
|
}
|
|
12
12
|
]
|
|
13
13
|
}, c = {
|
|
14
|
-
constraints: {
|
|
15
|
-
relation: "ancestor",
|
|
16
|
-
component: { $nin: ["Button", "Link"] }
|
|
17
|
-
},
|
|
18
14
|
type: "container",
|
|
19
15
|
icon: e,
|
|
20
16
|
presetStyle: r,
|
|
21
17
|
states: [
|
|
22
|
-
...
|
|
18
|
+
...l,
|
|
23
19
|
{ selector: "::placeholder", label: "Placeholder" },
|
|
24
20
|
{ selector: ":valid", label: "Valid" },
|
|
25
21
|
{ selector: ":invalid", label: "Invalid" },
|
|
26
22
|
{ selector: ":required", label: "Required" },
|
|
27
23
|
{ selector: ":optional", label: "Optional" }
|
|
28
24
|
]
|
|
29
|
-
},
|
|
25
|
+
}, d = {
|
|
30
26
|
props: o,
|
|
31
27
|
initialProps: [
|
|
32
28
|
"id",
|
|
@@ -40,5 +36,5 @@ const r = {
|
|
|
40
36
|
};
|
|
41
37
|
export {
|
|
42
38
|
c as meta,
|
|
43
|
-
|
|
39
|
+
d as propsMeta
|
|
44
40
|
};
|
package/lib/text.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
const
|
|
4
|
-
({ tag:
|
|
1
|
+
import { forwardRef as a, createElement as m } from "react";
|
|
2
|
+
import { getTagFromProps as f } from "@webstudio-is/sdk/runtime";
|
|
3
|
+
const g = "div", n = a(
|
|
4
|
+
({ tag: e, ...t }, r) => {
|
|
5
|
+
const o = f(t) ?? e ?? g;
|
|
6
|
+
return m(o, { ...t, ref: r });
|
|
7
|
+
}
|
|
5
8
|
);
|
|
6
|
-
|
|
9
|
+
n.displayName = "Text";
|
|
7
10
|
export {
|
|
8
|
-
|
|
9
|
-
m as defaultTag
|
|
11
|
+
n as Text
|
|
10
12
|
};
|
package/lib/text.ws.js
CHANGED
|
@@ -2,24 +2,32 @@ import { TextIcon as t } from "@webstudio-is/icons/svg";
|
|
|
2
2
|
import { defaultStates as e } from "@webstudio-is/sdk";
|
|
3
3
|
import { div as o } from "@webstudio-is/sdk/normalize.css";
|
|
4
4
|
import { props as i } from "./__generated__/text.props.js";
|
|
5
|
-
const
|
|
6
|
-
div: [
|
|
7
|
-
...o,
|
|
8
|
-
{
|
|
9
|
-
property: "min-height",
|
|
10
|
-
value: { type: "unit", unit: "em", value: 1 }
|
|
11
|
-
}
|
|
12
|
-
]
|
|
13
|
-
}, n = {
|
|
5
|
+
const s = {
|
|
14
6
|
type: "container",
|
|
15
7
|
icon: t,
|
|
16
8
|
states: e,
|
|
17
|
-
presetStyle:
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
9
|
+
presetStyle: {
|
|
10
|
+
div: [
|
|
11
|
+
...o,
|
|
12
|
+
{
|
|
13
|
+
property: "min-height",
|
|
14
|
+
value: { type: "unit", unit: "em", value: 1 }
|
|
15
|
+
}
|
|
16
|
+
]
|
|
17
|
+
}
|
|
18
|
+
}, m = {
|
|
19
|
+
props: {
|
|
20
|
+
...i,
|
|
21
|
+
tag: {
|
|
22
|
+
required: !0,
|
|
23
|
+
control: "tag",
|
|
24
|
+
type: "string",
|
|
25
|
+
options: ["div", "cite", "figcaption", "span"]
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
initialProps: ["tag", "id", "className"]
|
|
21
29
|
};
|
|
22
30
|
export {
|
|
23
|
-
|
|
24
|
-
|
|
31
|
+
s as meta,
|
|
32
|
+
m as propsMeta
|
|
25
33
|
};
|
package/lib/textarea.ws.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { FormTextAreaIcon as e } from "@webstudio-is/icons/svg";
|
|
2
|
-
import { defaultStates as
|
|
3
|
-
import { textarea as
|
|
4
|
-
import { props as
|
|
2
|
+
import { defaultStates as r } from "@webstudio-is/sdk";
|
|
3
|
+
import { textarea as o } from "@webstudio-is/sdk/normalize.css";
|
|
4
|
+
import { props as t } from "./__generated__/textarea.props.js";
|
|
5
5
|
const l = {
|
|
6
6
|
textarea: [
|
|
7
|
-
...
|
|
7
|
+
...o,
|
|
8
8
|
// resize doesn't work well while on canvas
|
|
9
9
|
{ property: "resize", value: { type: "keyword", value: "none" } },
|
|
10
10
|
{
|
|
@@ -12,7 +12,7 @@ const l = {
|
|
|
12
12
|
value: { type: "keyword", value: "block" }
|
|
13
13
|
}
|
|
14
14
|
]
|
|
15
|
-
},
|
|
15
|
+
}, c = {
|
|
16
16
|
category: "forms",
|
|
17
17
|
type: "control",
|
|
18
18
|
label: "Text Area",
|
|
@@ -20,12 +20,8 @@ const l = {
|
|
|
20
20
|
icon: e,
|
|
21
21
|
presetStyle: l,
|
|
22
22
|
order: 4,
|
|
23
|
-
constraints: {
|
|
24
|
-
relation: "ancestor",
|
|
25
|
-
component: { $nin: ["Button", "Link"] }
|
|
26
|
-
},
|
|
27
23
|
states: [
|
|
28
|
-
...
|
|
24
|
+
...r,
|
|
29
25
|
{ selector: "::placeholder", label: "Placeholder" },
|
|
30
26
|
{ selector: ":valid", label: "Valid" },
|
|
31
27
|
{ selector: ":invalid", label: "Invalid" },
|
|
@@ -37,8 +33,8 @@ const l = {
|
|
|
37
33
|
//{ selector: ":read-only", label: "Read Only" },
|
|
38
34
|
//{ selector: ":read-write", label: "Read Write" },
|
|
39
35
|
]
|
|
40
|
-
},
|
|
41
|
-
props:
|
|
36
|
+
}, n = {
|
|
37
|
+
props: t,
|
|
42
38
|
initialProps: [
|
|
43
39
|
"id",
|
|
44
40
|
"className",
|
|
@@ -50,6 +46,6 @@ const l = {
|
|
|
50
46
|
]
|
|
51
47
|
};
|
|
52
48
|
export {
|
|
53
|
-
|
|
54
|
-
|
|
49
|
+
c as meta,
|
|
50
|
+
n as propsMeta
|
|
55
51
|
};
|
package/lib/types/box.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { type ComponentProps } from "react";
|
|
2
|
-
|
|
2
|
+
declare const defaultTag = "div";
|
|
3
3
|
type Props = ComponentProps<typeof defaultTag> & {
|
|
4
|
-
|
|
5
|
-
tag?: "div" | "header" | "footer" | "nav" | "main" | "section" | "article" | "aside" | "address" | "figure";
|
|
4
|
+
tag?: string;
|
|
6
5
|
};
|
|
7
6
|
export declare const Box: import("react").ForwardRefExoticComponent<Omit<Props, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
8
7
|
export {};
|
package/lib/types/heading.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { type ComponentProps } from "react";
|
|
2
2
|
declare const defaultTag = "h1";
|
|
3
3
|
type Props = ComponentProps<typeof defaultTag> & {
|
|
4
|
-
|
|
5
|
-
tag?: "h1" | "h2" | "h3" | "h4" | "h5" | "h6";
|
|
4
|
+
tag?: string;
|
|
6
5
|
};
|
|
7
6
|
export declare const Heading: import("react").ForwardRefExoticComponent<Omit<Props, "ref"> & import("react").RefAttributes<HTMLHeadingElement>>;
|
|
8
7
|
export {};
|
package/lib/types/link.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare const defaultTag = "a";
|
|
2
|
-
export declare const Link: import("react").ForwardRefExoticComponent<Omit<Omit<import("react").DetailedHTMLProps<import("react").AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>, "
|
|
2
|
+
export declare const Link: import("react").ForwardRefExoticComponent<Omit<Omit<import("react").DetailedHTMLProps<import("react").AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>, "download" | "target"> & {
|
|
3
3
|
target?: "_self" | "_blank" | "_parent" | "_top";
|
|
4
4
|
download?: boolean;
|
|
5
5
|
prefetch?: "none" | "intent" | "render" | "viewport";
|
package/lib/types/metas.d.ts
CHANGED
package/lib/types/props.d.ts
CHANGED
|
@@ -42,3 +42,4 @@ export { propsMeta as HeadSlot } from "./head-slot.ws";
|
|
|
42
42
|
export { propsMeta as HeadLink } from "./head-link.ws";
|
|
43
43
|
export { propsMeta as HeadMeta } from "./head-meta.ws";
|
|
44
44
|
export { propsMeta as HeadTitle } from "./head-title.ws";
|
|
45
|
+
export { propsMeta as Video } from "./video.ws";
|
package/lib/types/text.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { type ComponentProps } from "react";
|
|
2
|
-
|
|
2
|
+
declare const defaultTag = "div";
|
|
3
3
|
type Props = ComponentProps<typeof defaultTag> & {
|
|
4
|
-
|
|
5
|
-
tag?: "div" | "span" | "figcaption" | "cite";
|
|
4
|
+
tag?: string;
|
|
6
5
|
};
|
|
7
6
|
export declare const Text: import("react").ForwardRefExoticComponent<Omit<Props, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
8
7
|
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Atom } from "nanostores";
|
|
2
|
+
export declare const defaultTag = "video";
|
|
3
|
+
export declare const Video: import("react").ForwardRefExoticComponent<Omit<import("react").ClassAttributes<HTMLVideoElement> & import("react").VideoHTMLAttributes<HTMLVideoElement> & {
|
|
4
|
+
$progress?: Atom<number | undefined>;
|
|
5
|
+
$visible?: Atom<boolean>;
|
|
6
|
+
$timeline?: boolean;
|
|
7
|
+
}, "ref"> & import("react").RefAttributes<HTMLVideoElement>>;
|
package/lib/video.js
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { jsx as b } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as m, useId as V, useEffect as _ } from "react";
|
|
3
|
+
const a = "data-ws-video-id", H = {
|
|
4
|
+
HAVE_NOTHING: 0,
|
|
5
|
+
HAVE_METADATA: 1,
|
|
6
|
+
HAVE_CURRENT_DATA: 2,
|
|
7
|
+
HAVE_FUTURE_DATA: 3,
|
|
8
|
+
HAVE_ENOUGH_DATA: 4
|
|
9
|
+
}, N = m(({ $progress: r, $visible: n, $timeline: f, children: d, ...c }, A) => {
|
|
10
|
+
const s = V(), l = {
|
|
11
|
+
[a]: s
|
|
12
|
+
};
|
|
13
|
+
return _(() => {
|
|
14
|
+
if (r === void 0 || n === void 0)
|
|
15
|
+
return;
|
|
16
|
+
const e = document.querySelector(`[${a}="${s}"]`);
|
|
17
|
+
if (e === null || !(e instanceof HTMLVideoElement))
|
|
18
|
+
return;
|
|
19
|
+
if (e.play().catch(() => {
|
|
20
|
+
}), e.pause(), f)
|
|
21
|
+
return r.subscribe((i) => {
|
|
22
|
+
if (e.readyState < H.HAVE_METADATA || (e.paused || e.pause(), e.seeking))
|
|
23
|
+
return;
|
|
24
|
+
let u = e.duration;
|
|
25
|
+
Number.isNaN(u) || (Number.isFinite(u) || (u = 60), e.currentTime = (i ?? 0) * u);
|
|
26
|
+
});
|
|
27
|
+
let t = !1, o = !1;
|
|
28
|
+
const T = n.subscribe((i) => {
|
|
29
|
+
o = i, o === !1 && t === !1 && !e.loop && (e.currentTime = 0);
|
|
30
|
+
}), E = r.subscribe((i) => {
|
|
31
|
+
if (t && (i === void 0 || i === 0 || i === 1)) {
|
|
32
|
+
t = !1, e.pause(), o === !1 && t === !1 && !e.loop && (e.currentTime = 0);
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
t || (t = !0, e.ended || e.play().catch(() => {
|
|
36
|
+
}));
|
|
37
|
+
});
|
|
38
|
+
return () => {
|
|
39
|
+
E(), T();
|
|
40
|
+
};
|
|
41
|
+
}, [r, f, n, s]), /* @__PURE__ */ b("video", { ...c, ...l, ref: A, children: d });
|
|
42
|
+
});
|
|
43
|
+
N.displayName = "Video";
|
|
44
|
+
export {
|
|
45
|
+
N as Video
|
|
46
|
+
};
|
package/lib/video.ws.js
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { VideoIcon as o } from "@webstudio-is/icons/svg";
|
|
2
|
+
import "@webstudio-is/sdk";
|
|
3
|
+
import { props as t } from "./__generated__/video.props.js";
|
|
4
|
+
const r = {
|
|
5
|
+
type: "control",
|
|
6
|
+
icon: o,
|
|
7
|
+
presetStyle: {
|
|
8
|
+
video: [
|
|
9
|
+
{
|
|
10
|
+
property: "max-width",
|
|
11
|
+
value: { type: "unit", unit: "%", value: 100 }
|
|
12
|
+
}
|
|
13
|
+
]
|
|
14
|
+
}
|
|
15
|
+
}, a = {
|
|
16
|
+
props: t,
|
|
17
|
+
initialProps: [
|
|
18
|
+
"id",
|
|
19
|
+
"className",
|
|
20
|
+
"width",
|
|
21
|
+
"height",
|
|
22
|
+
"src",
|
|
23
|
+
"autoPlay",
|
|
24
|
+
"controls",
|
|
25
|
+
"loop",
|
|
26
|
+
"muted",
|
|
27
|
+
"preload",
|
|
28
|
+
"playsInline"
|
|
29
|
+
]
|
|
30
|
+
};
|
|
31
|
+
export {
|
|
32
|
+
r as meta,
|
|
33
|
+
a as propsMeta
|
|
34
|
+
};
|
package/lib/webhook-form.ws.js
CHANGED
|
@@ -1,24 +1,20 @@
|
|
|
1
|
-
import { WebhookFormIcon as
|
|
2
|
-
import { form as
|
|
3
|
-
import { props as
|
|
4
|
-
const
|
|
1
|
+
import { WebhookFormIcon as e } from "@webstudio-is/icons/svg";
|
|
2
|
+
import { form as o } from "@webstudio-is/sdk/normalize.css";
|
|
3
|
+
import { props as r } from "./__generated__/webhook-form.props.js";
|
|
4
|
+
const c = {
|
|
5
5
|
label: "Webhook Form",
|
|
6
|
-
icon:
|
|
6
|
+
icon: e,
|
|
7
7
|
type: "container",
|
|
8
|
-
constraints: {
|
|
9
|
-
relation: "ancestor",
|
|
10
|
-
component: { $nin: ["Form", "Button", "Link"] }
|
|
11
|
-
},
|
|
12
8
|
presetStyle: {
|
|
13
|
-
form:
|
|
9
|
+
form: o
|
|
14
10
|
},
|
|
15
11
|
states: [
|
|
16
12
|
{ selector: "[data-state=error]", label: "Error" },
|
|
17
13
|
{ selector: "[data-state=success]", label: "Success" }
|
|
18
14
|
]
|
|
19
|
-
},
|
|
15
|
+
}, i = {
|
|
20
16
|
props: {
|
|
21
|
-
...
|
|
17
|
+
...r,
|
|
22
18
|
action: {
|
|
23
19
|
type: "resource",
|
|
24
20
|
control: "resource",
|
|
@@ -29,6 +25,6 @@ const n = {
|
|
|
29
25
|
initialProps: ["id", "className", "state", "action"]
|
|
30
26
|
};
|
|
31
27
|
export {
|
|
32
|
-
|
|
33
|
-
|
|
28
|
+
c as meta,
|
|
29
|
+
i as propsMeta
|
|
34
30
|
};
|