@webstudio-is/sdk-components-react 0.195.0 → 0.197.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__/image.props.js +1 -0
- package/lib/__generated__/vimeo-preview-image.props.js +6 -1
- package/lib/__generated__/vimeo.props.js +4 -5
- package/lib/__generated__/youtube.props.js +665 -0
- package/lib/blockquote.template.js +11 -0
- package/lib/blockquote.ws.js +5 -21
- package/lib/body.ws.js +1 -1
- package/lib/bold.ws.js +1 -1
- package/lib/box.ws.js +1 -1
- package/lib/button.template.js +11 -0
- package/lib/button.ws.js +2 -18
- package/lib/checkbox.template.js +14 -0
- package/lib/checkbox.ws.js +5 -25
- package/lib/code-text.ws.js +6 -6
- package/lib/components.js +35 -33
- package/lib/content-embed.template.js +83 -0
- package/lib/form.ws.js +1 -1
- package/lib/heading.template.js +11 -0
- package/lib/heading.ws.js +15 -31
- package/lib/image.ws.js +17 -22
- package/lib/input.ws.js +1 -1
- package/lib/italic.ws.js +1 -1
- package/lib/label.template.js +10 -0
- package/lib/label.ws.js +13 -28
- package/lib/link.template.js +11 -0
- package/lib/link.ws.js +3 -23
- package/lib/list-item.template.js +11 -0
- package/lib/list-item.ws.js +12 -28
- package/lib/list.template.js +15 -0
- package/lib/list.ws.js +10 -54
- package/lib/markdown-embed.js +10 -5
- package/lib/markdown-embed.template.js +75 -0
- package/lib/markdown-embed.ws.js +9 -87
- package/lib/metas.js +59 -59
- package/lib/option.ws.js +4 -5
- package/lib/paragraph.template.js +11 -0
- package/lib/paragraph.ws.js +12 -28
- package/lib/props.js +32 -30
- package/lib/radio-button.template.js +14 -0
- package/lib/radio-button.ws.js +7 -27
- package/lib/rich-text-link.ws.js +3 -5
- package/lib/select.template.js +16 -0
- package/lib/select.ws.js +11 -63
- package/lib/separator.ws.js +2 -2
- package/lib/span.ws.js +1 -1
- package/lib/subscript.ws.js +1 -1
- package/lib/superscript.ws.js +1 -1
- package/lib/templates.js +36 -0
- package/lib/text.template.js +11 -0
- package/lib/text.ws.js +8 -24
- package/lib/textarea.ws.js +1 -1
- package/lib/time.ws.js +5 -6
- package/lib/types/__generated__/blockquote.props.d.ts +1 -1
- package/lib/types/__generated__/body.props.d.ts +1 -1
- package/lib/types/__generated__/bold.props.d.ts +1 -1
- package/lib/types/__generated__/box.props.d.ts +1 -1
- package/lib/types/__generated__/button.props.d.ts +1 -1
- package/lib/types/__generated__/checkbox.props.d.ts +1 -1
- package/lib/types/__generated__/code-text.props.d.ts +1 -1
- package/lib/types/__generated__/form.props.d.ts +1 -1
- package/lib/types/__generated__/fragment.props.d.ts +1 -1
- package/lib/types/__generated__/heading.props.d.ts +1 -1
- package/lib/types/__generated__/html-embed.props.d.ts +1 -1
- package/lib/types/__generated__/image.props.d.ts +1 -1
- package/lib/types/__generated__/input.props.d.ts +1 -1
- package/lib/types/__generated__/italic.props.d.ts +1 -1
- package/lib/types/__generated__/label.props.d.ts +1 -1
- package/lib/types/__generated__/link.props.d.ts +1 -1
- package/lib/types/__generated__/list-item.props.d.ts +1 -1
- package/lib/types/__generated__/list.props.d.ts +1 -1
- package/lib/types/__generated__/markdown-embed.props.d.ts +1 -1
- package/lib/types/__generated__/option.props.d.ts +1 -1
- package/lib/types/__generated__/paragraph.props.d.ts +1 -1
- package/lib/types/__generated__/radio-button.props.d.ts +1 -1
- package/lib/types/__generated__/rich-text-link.props.d.ts +1 -1
- package/lib/types/__generated__/select.props.d.ts +1 -1
- package/lib/types/__generated__/separator.props.d.ts +1 -1
- package/lib/types/__generated__/slot.props.d.ts +1 -1
- package/lib/types/__generated__/span.props.d.ts +1 -1
- package/lib/types/__generated__/subscript.props.d.ts +1 -1
- package/lib/types/__generated__/superscript.props.d.ts +1 -1
- package/lib/types/__generated__/text.props.d.ts +1 -1
- package/lib/types/__generated__/textarea.props.d.ts +1 -1
- package/lib/types/__generated__/time.props.d.ts +1 -1
- package/lib/types/__generated__/vimeo-play-button.props.d.ts +1 -1
- package/lib/types/__generated__/vimeo-preview-image.props.d.ts +1 -1
- package/lib/types/__generated__/vimeo-spinner.props.d.ts +1 -1
- package/lib/types/__generated__/vimeo.props.d.ts +1 -1
- package/lib/types/__generated__/webhook-form.props.d.ts +1 -1
- package/lib/types/__generated__/xml-node.props.d.ts +1 -1
- package/lib/types/__generated__/xml-time.props.d.ts +1 -1
- package/lib/types/__generated__/youtube.props.d.ts +2 -0
- package/lib/types/blockquote.template.d.ts +2 -0
- package/lib/types/blockquote.ws.d.ts +1 -1
- package/lib/types/body.ws.d.ts +1 -1
- package/lib/types/bold.ws.d.ts +1 -1
- package/lib/types/box.ws.d.ts +1 -1
- package/lib/types/button.template.d.ts +2 -0
- package/lib/types/button.ws.d.ts +1 -1
- package/lib/types/checkbox.d.ts +1 -1
- package/lib/types/checkbox.template.d.ts +2 -0
- package/lib/types/checkbox.ws.d.ts +1 -1
- package/lib/types/code-text.ws.d.ts +1 -1
- package/lib/types/components.d.ts +1 -0
- package/lib/types/content-embed.template.d.ts +2 -0
- package/lib/types/form.ws.d.ts +1 -1
- package/lib/types/fragment.ws.d.ts +1 -1
- package/lib/types/heading.template.d.ts +2 -0
- package/lib/types/heading.ws.d.ts +1 -1
- package/lib/types/html-embed.ws.d.ts +1 -1
- package/lib/types/image.ws.d.ts +1 -9
- package/lib/types/input.ws.d.ts +1 -1
- package/lib/types/italic.ws.d.ts +1 -1
- package/lib/types/label.template.d.ts +2 -0
- package/lib/types/label.ws.d.ts +1 -1
- package/lib/types/link.template.d.ts +2 -0
- package/lib/types/link.ws.d.ts +1 -1
- package/lib/types/list-item.template.d.ts +2 -0
- package/lib/types/list-item.ws.d.ts +1 -1
- package/lib/types/list.template.d.ts +2 -0
- package/lib/types/list.ws.d.ts +1 -1
- package/lib/types/markdown-embed.template.d.ts +2 -0
- package/lib/types/markdown-embed.ws.d.ts +1 -1
- package/lib/types/metas.d.ts +1 -1
- package/lib/types/option.ws.d.ts +1 -1
- package/lib/types/paragraph.template.d.ts +2 -0
- package/lib/types/paragraph.ws.d.ts +1 -1
- package/lib/types/props.d.ts +1 -0
- package/lib/types/radio-button.d.ts +1 -1
- package/lib/types/radio-button.template.d.ts +2 -0
- package/lib/types/radio-button.ws.d.ts +1 -1
- package/lib/types/rich-text-link.ws.d.ts +1 -1
- package/lib/types/select.template.d.ts +2 -0
- package/lib/types/select.ws.d.ts +1 -1
- package/lib/types/separator.ws.d.ts +1 -1
- package/lib/types/slot.ws.d.ts +1 -1
- package/lib/types/span.ws.d.ts +1 -1
- package/lib/types/subscript.ws.d.ts +1 -1
- package/lib/types/superscript.ws.d.ts +1 -1
- package/lib/types/templates.d.ts +17 -0
- package/lib/types/text.template.d.ts +2 -0
- package/lib/types/text.ws.d.ts +1 -1
- package/lib/types/textarea.ws.d.ts +1 -1
- package/lib/types/time.ws.d.ts +1 -1
- package/lib/types/vimeo-play-button.ws.d.ts +1 -1
- package/lib/types/vimeo-preview-image.d.ts +21 -21
- package/lib/types/vimeo-preview-image.ws.d.ts +1 -1
- package/lib/types/vimeo-spinner.ws.d.ts +1 -1
- package/lib/types/vimeo.d.ts +12 -2
- package/lib/types/vimeo.template.d.ts +2 -0
- package/lib/types/vimeo.ws.d.ts +1 -1
- package/lib/types/webhook-form.template.d.ts +2 -0
- package/lib/types/webhook-form.ws.d.ts +1 -1
- package/lib/types/xml-node.ws.d.ts +1 -1
- package/lib/types/xml-time.ws.d.ts +1 -1
- package/lib/types/youtube.d.ts +143 -0
- package/lib/types/youtube.template.d.ts +2 -0
- package/lib/types/youtube.ws.d.ts +3 -0
- package/lib/vimeo-play-button.ws.js +8 -8
- package/lib/vimeo-preview-image.ws.js +17 -9
- package/lib/vimeo-spinner.ws.js +8 -8
- package/lib/vimeo.js +88 -87
- package/lib/vimeo.template.js +93 -0
- package/lib/vimeo.ws.js +14 -302
- package/lib/webhook-form.template.js +49 -0
- package/lib/webhook-form.ws.js +17 -118
- package/lib/xml-node.js +18 -14
- package/lib/xml-node.ws.js +4 -5
- package/lib/xml-time.ws.js +4 -5
- package/lib/youtube.js +200 -0
- package/lib/youtube.template.js +97 -0
- package/lib/youtube.ws.js +51 -0
- package/package.json +16 -9
- package/lib/content-embed.ws.js +0 -77
- package/lib/types/__generated__/local-date.props.d.ts +0 -2
- package/lib/types/content-embed.ws.d.ts +0 -2
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { type ComponentProps } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Options for configuring the YouTube player parameters.
|
|
4
|
+
* https://developers.google.com/youtube/player_parameters
|
|
5
|
+
*/
|
|
6
|
+
type YouTubePlayerParameters = {
|
|
7
|
+
/**
|
|
8
|
+
* Whether the video should autoplay.
|
|
9
|
+
* Some browsers require the `muted` parameter to be set to `true` for autoplay to work.
|
|
10
|
+
* @default false
|
|
11
|
+
*/
|
|
12
|
+
autoplay?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Whether the video should start muted.
|
|
15
|
+
* Useful for enabling autoplay in browsers that require videos to be muted.
|
|
16
|
+
* Original parameter: `mute`
|
|
17
|
+
*@default false
|
|
18
|
+
*/
|
|
19
|
+
muted?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Whether to show player controls.
|
|
22
|
+
* @default true
|
|
23
|
+
*/
|
|
24
|
+
showControls?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Whether to show related videos at the end.
|
|
27
|
+
* Original parameter: `rel`
|
|
28
|
+
* @default true
|
|
29
|
+
*/
|
|
30
|
+
showRelatedVideos?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Whether to enable keyboard controls.
|
|
33
|
+
* @default true
|
|
34
|
+
*/
|
|
35
|
+
keyboard?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Whether the video should loop continuously.
|
|
38
|
+
* @default false
|
|
39
|
+
*/
|
|
40
|
+
loop?: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Whether to play inline on mobile (not fullscreen).
|
|
43
|
+
* @default false
|
|
44
|
+
*/
|
|
45
|
+
inline?: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Whether to allow fullscreen mode.
|
|
48
|
+
* Original parameter: `fs`
|
|
49
|
+
* @default true
|
|
50
|
+
*/
|
|
51
|
+
allowFullscreen?: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Whether captions should be shown by default.
|
|
54
|
+
* Original parameter: `cc_load_policy`
|
|
55
|
+
* @default false
|
|
56
|
+
*/
|
|
57
|
+
showCaptions?: boolean;
|
|
58
|
+
/**
|
|
59
|
+
* Whether to show annotations on the video.
|
|
60
|
+
* Original parameter: `iv_load_policy`
|
|
61
|
+
* @default true
|
|
62
|
+
*/
|
|
63
|
+
showAnnotations?: boolean;
|
|
64
|
+
/**
|
|
65
|
+
* Start time of the video in seconds.
|
|
66
|
+
* Original parameter: `start`
|
|
67
|
+
*/
|
|
68
|
+
startTime?: number;
|
|
69
|
+
/**
|
|
70
|
+
* End time of the video in seconds.
|
|
71
|
+
* Original parameter: `end`
|
|
72
|
+
*/
|
|
73
|
+
endTime?: number;
|
|
74
|
+
/**
|
|
75
|
+
* Whether to disable keyboard controls.
|
|
76
|
+
* Original parameter: `disablekb`
|
|
77
|
+
* @default false
|
|
78
|
+
*/
|
|
79
|
+
disableKeyboard?: boolean;
|
|
80
|
+
/**
|
|
81
|
+
* Referrer URL for tracking purposes.
|
|
82
|
+
* Original parameter: `widget_referrer`
|
|
83
|
+
*/
|
|
84
|
+
referrer?: string;
|
|
85
|
+
/**
|
|
86
|
+
* Type of playlist to load.
|
|
87
|
+
*/
|
|
88
|
+
listType?: "playlist" | "user_uploads";
|
|
89
|
+
/**
|
|
90
|
+
* ID of the playlist to load.
|
|
91
|
+
* Original parameter: `list`
|
|
92
|
+
*/
|
|
93
|
+
listId?: string;
|
|
94
|
+
/**
|
|
95
|
+
* Your domain for API compliance (e.g., `https://yourdomain.com`).
|
|
96
|
+
*/
|
|
97
|
+
origin?: string;
|
|
98
|
+
/**
|
|
99
|
+
* Specifies the default language that the player will use to display captions.
|
|
100
|
+
* The value is an ISO 639-1 two-letter language code.
|
|
101
|
+
* Original parameter: `cc_lang_pref`
|
|
102
|
+
*/
|
|
103
|
+
captionLanguage?: string;
|
|
104
|
+
/**
|
|
105
|
+
* Sets the player's interface language. The value is an ISO 639-1 two-letter language code or a fully specified locale.
|
|
106
|
+
* Original parameter: `hl`
|
|
107
|
+
*/
|
|
108
|
+
language?: string;
|
|
109
|
+
/**
|
|
110
|
+
* Specifies the color that will be used in the player's video progress bar to highlight the amount of the video that the viewer has already seen.
|
|
111
|
+
* Valid values are 'red' and 'white'.
|
|
112
|
+
*/
|
|
113
|
+
color?: "red" | "white";
|
|
114
|
+
/**
|
|
115
|
+
* This parameter specifies a comma-separated list of video IDs to play
|
|
116
|
+
*/
|
|
117
|
+
playlist?: string;
|
|
118
|
+
};
|
|
119
|
+
type YouTubePlayerOptions = {
|
|
120
|
+
/** The YouTube video URL or ID */
|
|
121
|
+
url?: string;
|
|
122
|
+
showPreview?: boolean;
|
|
123
|
+
/**
|
|
124
|
+
* The Privacy Enhanced Mode of the YouTube embedded player prevents the use of views of embedded YouTube content from influencing the viewer’s browsing experience on YouTube.
|
|
125
|
+
* https://support.google.com/youtube/answer/171780?hl=en#zippy=%2Cturn-on-privacy-enhanced-mode
|
|
126
|
+
* @default true
|
|
127
|
+
*/
|
|
128
|
+
privacyEnhancedMode?: boolean;
|
|
129
|
+
} & YouTubePlayerParameters & {
|
|
130
|
+
/** Loading strategy for iframe */
|
|
131
|
+
loading?: "eager" | "lazy";
|
|
132
|
+
};
|
|
133
|
+
declare const defaultTag = "div";
|
|
134
|
+
type Props = Omit<ComponentProps<typeof defaultTag>, keyof YouTubePlayerOptions> & YouTubePlayerOptions & {
|
|
135
|
+
/**
|
|
136
|
+
* The `title` attribute for the iframe.
|
|
137
|
+
* Improves accessibility by providing a brief description of the video content for screen readers.
|
|
138
|
+
* Example: "Video about web development tips".
|
|
139
|
+
*/
|
|
140
|
+
title?: string | undefined;
|
|
141
|
+
};
|
|
142
|
+
export declare const YouTube: import("react").ForwardRefExoticComponent<Omit<Props, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
143
|
+
export {};
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { defaultStates as t } from "@webstudio-is/
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { defaultStates as t } from "@webstudio-is/sdk";
|
|
2
|
+
import { ButtonElementIcon as o } from "@webstudio-is/icons/svg";
|
|
3
|
+
import { button as e } from "@webstudio-is/sdk/normalize.css";
|
|
4
|
+
import { props as n } from "./__generated__/vimeo-play-button.props.js";
|
|
5
5
|
const r = {
|
|
6
|
-
button:
|
|
6
|
+
button: e
|
|
7
7
|
}, p = {
|
|
8
8
|
category: "hidden",
|
|
9
9
|
type: "container",
|
|
10
10
|
constraints: [
|
|
11
11
|
{
|
|
12
12
|
relation: "ancestor",
|
|
13
|
-
component: { $
|
|
13
|
+
component: { $in: ["Vimeo", "YouTube"] }
|
|
14
14
|
},
|
|
15
15
|
{
|
|
16
16
|
relation: "ancestor",
|
|
@@ -18,11 +18,11 @@ const r = {
|
|
|
18
18
|
}
|
|
19
19
|
],
|
|
20
20
|
label: "Play Button",
|
|
21
|
-
icon:
|
|
21
|
+
icon: o,
|
|
22
22
|
presetStyle: r,
|
|
23
23
|
states: t
|
|
24
24
|
}, c = {
|
|
25
|
-
props:
|
|
25
|
+
props: n,
|
|
26
26
|
initialProps: ["id", "className"]
|
|
27
27
|
};
|
|
28
28
|
export {
|
|
@@ -1,19 +1,27 @@
|
|
|
1
|
-
import "
|
|
2
|
-
import {
|
|
3
|
-
import { props as t } from "./__generated__/vimeo-preview-image.props.js";
|
|
1
|
+
import { meta as e, propsMeta as o } from "./image.ws.js";
|
|
2
|
+
import { props as r } from "./__generated__/vimeo-preview-image.props.js";
|
|
4
3
|
const i = {
|
|
5
|
-
...
|
|
4
|
+
...e,
|
|
6
5
|
category: "hidden",
|
|
7
6
|
label: "Preview Image",
|
|
8
7
|
constraints: {
|
|
9
8
|
relation: "ancestor",
|
|
10
|
-
component: { $
|
|
9
|
+
component: { $in: ["Vimeo", "YouTube"] }
|
|
11
10
|
}
|
|
12
|
-
},
|
|
13
|
-
props: {
|
|
14
|
-
|
|
11
|
+
}, p = {
|
|
12
|
+
props: {
|
|
13
|
+
...r,
|
|
14
|
+
// Automatically generated props don't have the right control.
|
|
15
|
+
src: {
|
|
16
|
+
type: "string",
|
|
17
|
+
control: "file",
|
|
18
|
+
label: "Source",
|
|
19
|
+
required: !1
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
initialProps: o.initialProps
|
|
15
23
|
};
|
|
16
24
|
export {
|
|
17
25
|
i as meta,
|
|
18
|
-
|
|
26
|
+
p as propsMeta
|
|
19
27
|
};
|
package/lib/vimeo-spinner.ws.js
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { defaultStates as o } from "@webstudio-is/
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { defaultStates as o } from "@webstudio-is/sdk";
|
|
2
|
+
import { div as t } from "@webstudio-is/sdk/normalize.css";
|
|
3
|
+
import { BoxIcon as e } from "@webstudio-is/icons/svg";
|
|
4
|
+
import { props as r } from "./__generated__/vimeo-spinner.props.js";
|
|
5
5
|
const n = {
|
|
6
|
-
div:
|
|
6
|
+
div: t
|
|
7
7
|
}, m = {
|
|
8
8
|
type: "container",
|
|
9
9
|
constraints: {
|
|
10
10
|
relation: "ancestor",
|
|
11
|
-
component: { $
|
|
11
|
+
component: { $in: ["Vimeo", "YouTube"] }
|
|
12
12
|
},
|
|
13
|
-
icon:
|
|
13
|
+
icon: e,
|
|
14
14
|
states: o,
|
|
15
15
|
presetStyle: n,
|
|
16
16
|
category: "hidden",
|
|
17
17
|
label: "Spinner"
|
|
18
18
|
}, c = {
|
|
19
|
-
props:
|
|
19
|
+
props: r,
|
|
20
20
|
initialProps: ["id", "className"]
|
|
21
21
|
};
|
|
22
22
|
export {
|
package/lib/vimeo.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { jsx as s, jsxs as
|
|
2
|
-
import { colord as
|
|
3
|
-
import { createContext as
|
|
4
|
-
import { ReactSdkContext as
|
|
5
|
-
const
|
|
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) => {
|
|
6
6
|
if (e.url === void 0)
|
|
7
7
|
return;
|
|
8
8
|
let t;
|
|
9
9
|
try {
|
|
10
10
|
const o = new URL(e.url);
|
|
11
|
-
t = new URL(
|
|
11
|
+
t = new URL(R), t.pathname = `/video${o.pathname}`;
|
|
12
12
|
} catch {
|
|
13
13
|
}
|
|
14
14
|
if (t === void 0)
|
|
15
15
|
return;
|
|
16
|
-
const
|
|
16
|
+
const a = {
|
|
17
17
|
showPortrait: "portrait",
|
|
18
18
|
showByline: "byline",
|
|
19
19
|
showTitle: "title",
|
|
@@ -23,36 +23,36 @@ const J = (e) => {
|
|
|
23
23
|
backgroundMode: "background",
|
|
24
24
|
doNotTrack: "dnt"
|
|
25
25
|
};
|
|
26
|
-
let
|
|
27
|
-
for (
|
|
28
|
-
const o = e[
|
|
29
|
-
if (
|
|
26
|
+
let r;
|
|
27
|
+
for (r in e) {
|
|
28
|
+
const o = e[r];
|
|
29
|
+
if (r === "url" || o === void 0)
|
|
30
30
|
continue;
|
|
31
|
-
const
|
|
32
|
-
t.searchParams.append(
|
|
31
|
+
const i = a[r] ?? r;
|
|
32
|
+
t.searchParams.append(i, o.toString());
|
|
33
33
|
}
|
|
34
34
|
if (t.searchParams.set("autoplay", "true"), typeof e.controlsColor == "string") {
|
|
35
|
-
const o =
|
|
35
|
+
const o = z(e.controlsColor).toHex().replace("#", "");
|
|
36
36
|
t.searchParams.set("color", o);
|
|
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
|
-
},
|
|
39
|
+
}, h = (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
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
},
|
|
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) => {
|
|
47
47
|
try {
|
|
48
|
-
const
|
|
49
|
-
return
|
|
48
|
+
const a = new URL(e).pathname.split("/")[2];
|
|
49
|
+
return a === "" || a == null ? void 0 : a;
|
|
50
50
|
} catch {
|
|
51
51
|
}
|
|
52
|
-
},
|
|
53
|
-
const
|
|
54
|
-
return
|
|
55
|
-
},
|
|
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(
|
|
56
56
|
"div",
|
|
57
57
|
{
|
|
58
58
|
style: {
|
|
@@ -65,72 +65,73 @@ const K = "https://f.vimeocdn.com", x = "https://player.vimeo.com", b = "https:/
|
|
|
65
65
|
},
|
|
66
66
|
children: 'Open the "Settings" panel and paste a video URL, e.g. https://vimeo.com/831343124.'
|
|
67
67
|
}
|
|
68
|
-
),
|
|
69
|
-
|
|
70
|
-
|
|
68
|
+
), Z = ({
|
|
69
|
+
title: e,
|
|
70
|
+
status: t,
|
|
71
|
+
loading: a,
|
|
71
72
|
videoUrl: r,
|
|
72
|
-
previewImageUrl:
|
|
73
|
-
autoplay:
|
|
74
|
-
renderer:
|
|
75
|
-
showPreview:
|
|
73
|
+
previewImageUrl: o,
|
|
74
|
+
autoplay: i,
|
|
75
|
+
renderer: n,
|
|
76
|
+
showPreview: d,
|
|
76
77
|
onStatusChange: c,
|
|
77
78
|
onPreviewImageUrlChange: l
|
|
78
79
|
}) => {
|
|
79
|
-
const [
|
|
80
|
-
if (
|
|
81
|
-
|
|
82
|
-
}, [
|
|
83
|
-
|
|
84
|
-
}, [
|
|
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(() => {
|
|
85
86
|
if (r !== void 0) {
|
|
86
|
-
if (
|
|
87
|
+
if (d === !1) {
|
|
87
88
|
l(void 0);
|
|
88
89
|
return;
|
|
89
90
|
}
|
|
90
|
-
|
|
91
|
+
o === void 0 && W(r).then(l).catch(() => {
|
|
91
92
|
console.error(`Could not load preview image for ${r}`);
|
|
92
93
|
});
|
|
93
94
|
}
|
|
94
|
-
}, [l,
|
|
95
|
+
}, [l, d, r, o]), !(n === "canvas" || t === "initial"))
|
|
95
96
|
return /* @__PURE__ */ s(
|
|
96
97
|
"iframe",
|
|
97
98
|
{
|
|
99
|
+
title: e,
|
|
98
100
|
src: r,
|
|
99
|
-
loading:
|
|
101
|
+
loading: a,
|
|
100
102
|
allow: "accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture;",
|
|
101
103
|
allowFullScreen: !0,
|
|
102
104
|
style: {
|
|
103
105
|
position: "absolute",
|
|
104
106
|
width: "100%",
|
|
105
107
|
height: "100%",
|
|
106
|
-
opacity:
|
|
108
|
+
opacity: p,
|
|
107
109
|
transition: "opacity 1s",
|
|
108
110
|
border: "none"
|
|
109
111
|
},
|
|
110
112
|
onLoad: () => {
|
|
111
|
-
c("ready"),
|
|
113
|
+
c("ready"), u(1);
|
|
112
114
|
}
|
|
113
115
|
}
|
|
114
116
|
);
|
|
115
|
-
},
|
|
117
|
+
}, tt = T({
|
|
116
118
|
onInitPlayer: () => {
|
|
117
119
|
},
|
|
118
120
|
status: "initial"
|
|
119
|
-
}),
|
|
121
|
+
}), et = q(
|
|
120
122
|
({
|
|
121
123
|
url: e,
|
|
122
124
|
loading: t = "lazy",
|
|
123
|
-
autoplay:
|
|
124
|
-
autopause:
|
|
125
|
-
|
|
126
|
-
showByline: a = !1,
|
|
125
|
+
autoplay: a = !1,
|
|
126
|
+
autopause: r = !0,
|
|
127
|
+
showByline: o = !1,
|
|
127
128
|
showControls: i = !0,
|
|
128
|
-
doNotTrack:
|
|
129
|
-
keyboard:
|
|
130
|
-
loop:
|
|
131
|
-
muted:
|
|
132
|
-
pip:
|
|
133
|
-
playsinline:
|
|
129
|
+
doNotTrack: n = !1,
|
|
130
|
+
keyboard: d = !0,
|
|
131
|
+
loop: c = !1,
|
|
132
|
+
muted: l = !1,
|
|
133
|
+
pip: p = !1,
|
|
134
|
+
playsinline: u = !0,
|
|
134
135
|
showPortrait: S = !0,
|
|
135
136
|
quality: L = "auto",
|
|
136
137
|
responsive: k = !0,
|
|
@@ -143,22 +144,21 @@ const K = "https://f.vimeocdn.com", x = "https://player.vimeo.com", b = "https:/
|
|
|
143
144
|
interactiveParams: V,
|
|
144
145
|
texttrack: $,
|
|
145
146
|
children: A,
|
|
146
|
-
...
|
|
147
|
-
},
|
|
148
|
-
const [
|
|
147
|
+
...y
|
|
148
|
+
}, m) => {
|
|
149
|
+
const [w, g] = v("initial"), [P, B] = v(), { renderer: C } = G(H), I = Y({
|
|
149
150
|
url: e,
|
|
150
|
-
autoplay:
|
|
151
|
-
autopause:
|
|
152
|
-
backgroundMode: o,
|
|
151
|
+
autoplay: a,
|
|
152
|
+
autopause: r,
|
|
153
153
|
showControls: i,
|
|
154
154
|
controlsColor: O,
|
|
155
|
-
doNotTrack:
|
|
155
|
+
doNotTrack: n,
|
|
156
156
|
interactiveParams: V,
|
|
157
|
-
keyboard:
|
|
158
|
-
loop:
|
|
159
|
-
muted:
|
|
160
|
-
pip:
|
|
161
|
-
playsinline:
|
|
157
|
+
keyboard: d,
|
|
158
|
+
loop: c,
|
|
159
|
+
muted: l,
|
|
160
|
+
pip: p,
|
|
161
|
+
playsinline: u,
|
|
162
162
|
quality: L,
|
|
163
163
|
responsive: k,
|
|
164
164
|
speed: E,
|
|
@@ -169,36 +169,37 @@ const K = "https://f.vimeocdn.com", x = "https://player.vimeo.com", b = "https:/
|
|
|
169
169
|
autopip: N
|
|
170
170
|
});
|
|
171
171
|
return /* @__PURE__ */ s(
|
|
172
|
-
|
|
172
|
+
tt.Provider,
|
|
173
173
|
{
|
|
174
174
|
value: {
|
|
175
|
-
status:
|
|
176
|
-
previewImageUrl:
|
|
175
|
+
status: w,
|
|
176
|
+
previewImageUrl: P,
|
|
177
177
|
onInitPlayer() {
|
|
178
|
-
|
|
178
|
+
C !== "canvas" && g("loading");
|
|
179
179
|
}
|
|
180
180
|
},
|
|
181
181
|
children: /* @__PURE__ */ s(
|
|
182
182
|
"div",
|
|
183
183
|
{
|
|
184
|
-
...
|
|
185
|
-
ref: (
|
|
186
|
-
|
|
184
|
+
...y,
|
|
185
|
+
ref: (x) => {
|
|
186
|
+
m !== null && (typeof m == "function" ? m(x) : m.current = x);
|
|
187
187
|
},
|
|
188
|
-
children:
|
|
188
|
+
children: I === void 0 ? /* @__PURE__ */ s(X, {}) : /* @__PURE__ */ D(F, { children: [
|
|
189
189
|
A,
|
|
190
190
|
/* @__PURE__ */ s(
|
|
191
|
-
|
|
191
|
+
Z,
|
|
192
192
|
{
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
193
|
+
title: y.title,
|
|
194
|
+
autoplay: a,
|
|
195
|
+
videoUrl: I,
|
|
196
|
+
previewImageUrl: P,
|
|
196
197
|
loading: t,
|
|
197
198
|
showPreview: M,
|
|
198
|
-
renderer:
|
|
199
|
-
status:
|
|
200
|
-
onStatusChange:
|
|
201
|
-
onPreviewImageUrlChange:
|
|
199
|
+
renderer: C,
|
|
200
|
+
status: w,
|
|
201
|
+
onStatusChange: g,
|
|
202
|
+
onPreviewImageUrlChange: B
|
|
202
203
|
}
|
|
203
204
|
)
|
|
204
205
|
] })
|
|
@@ -208,8 +209,8 @@ const K = "https://f.vimeocdn.com", x = "https://player.vimeo.com", b = "https:/
|
|
|
208
209
|
);
|
|
209
210
|
}
|
|
210
211
|
);
|
|
211
|
-
|
|
212
|
+
et.displayName = "Vimeo";
|
|
212
213
|
export {
|
|
213
|
-
|
|
214
|
-
|
|
214
|
+
et as Vimeo,
|
|
215
|
+
tt as VimeoContext
|
|
215
216
|
};
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { jsxs as i, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { SpinnerIcon as r, PlayIcon as a } from "@webstudio-is/icons/svg";
|
|
3
|
+
import { $ as e, css as o } from "@webstudio-is/template";
|
|
4
|
+
const p = {
|
|
5
|
+
category: "media",
|
|
6
|
+
order: 1,
|
|
7
|
+
description: "Add a video to your page that is hosted on Vimeo. Paste a Vimeo URL and configure the video in the Settings tab.",
|
|
8
|
+
template: /* @__PURE__ */ i(
|
|
9
|
+
e.Vimeo,
|
|
10
|
+
{
|
|
11
|
+
"ws:style": o`
|
|
12
|
+
position: relative;
|
|
13
|
+
aspect-ratio: 640/360;
|
|
14
|
+
width: 100%;
|
|
15
|
+
`,
|
|
16
|
+
children: [
|
|
17
|
+
/* @__PURE__ */ t(
|
|
18
|
+
e.VimeoPreviewImage,
|
|
19
|
+
{
|
|
20
|
+
"ws:style": o`
|
|
21
|
+
position: absolute;
|
|
22
|
+
object-fit: cover;
|
|
23
|
+
object-position: cover;
|
|
24
|
+
width: 100%;
|
|
25
|
+
height: 100%;
|
|
26
|
+
border-radius: 20px;
|
|
27
|
+
`,
|
|
28
|
+
alt: "Vimeo video preview image",
|
|
29
|
+
sizes: "100vw",
|
|
30
|
+
optimize: !0
|
|
31
|
+
}
|
|
32
|
+
),
|
|
33
|
+
/* @__PURE__ */ t(
|
|
34
|
+
e.VimeoSpinner,
|
|
35
|
+
{
|
|
36
|
+
"ws:label": "Spinner",
|
|
37
|
+
"ws:style": o`
|
|
38
|
+
position: absolute;
|
|
39
|
+
top: 50%;
|
|
40
|
+
left: 50%;
|
|
41
|
+
width: 70px;
|
|
42
|
+
height: 70px;
|
|
43
|
+
margin-top: -35px;
|
|
44
|
+
margin-left: -35px;
|
|
45
|
+
`,
|
|
46
|
+
children: /* @__PURE__ */ t(e.HtmlEmbed, { "ws:label": "Spinner SVG", code: r })
|
|
47
|
+
}
|
|
48
|
+
),
|
|
49
|
+
/* @__PURE__ */ t(
|
|
50
|
+
e.VimeoPlayButton,
|
|
51
|
+
{
|
|
52
|
+
"ws:style": o`
|
|
53
|
+
position: absolute;
|
|
54
|
+
width: 140px;
|
|
55
|
+
height: 80px;
|
|
56
|
+
top: 50%;
|
|
57
|
+
left: 50%;
|
|
58
|
+
margin-top: -40px;
|
|
59
|
+
margin-left: -70px;
|
|
60
|
+
display: flex;
|
|
61
|
+
align-items: center;
|
|
62
|
+
justify-content: center;
|
|
63
|
+
border-style: none;
|
|
64
|
+
border-radius: 5px;
|
|
65
|
+
cursor: pointer;
|
|
66
|
+
background-color: rgb(18, 18, 18);
|
|
67
|
+
color: rgb(255, 255, 255);
|
|
68
|
+
&:hover {
|
|
69
|
+
background-color: rgb(0, 173, 239);
|
|
70
|
+
}
|
|
71
|
+
`,
|
|
72
|
+
"aria-label": "Play button",
|
|
73
|
+
children: /* @__PURE__ */ t(
|
|
74
|
+
e.Box,
|
|
75
|
+
{
|
|
76
|
+
"ws:label": "Play Icon",
|
|
77
|
+
"ws:style": o`
|
|
78
|
+
width: 60px;
|
|
79
|
+
height: 60px;
|
|
80
|
+
`,
|
|
81
|
+
"aria-hidden": !0,
|
|
82
|
+
children: /* @__PURE__ */ t(e.HtmlEmbed, { "ws:label": "Play SVG", code: a })
|
|
83
|
+
}
|
|
84
|
+
)
|
|
85
|
+
}
|
|
86
|
+
)
|
|
87
|
+
]
|
|
88
|
+
}
|
|
89
|
+
)
|
|
90
|
+
};
|
|
91
|
+
export {
|
|
92
|
+
p as meta
|
|
93
|
+
};
|