@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
package/lib/youtube.js
ADDED
|
@@ -0,0 +1,200 @@
|
|
|
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) => {
|
|
6
|
+
if (e)
|
|
7
|
+
try {
|
|
8
|
+
const a = new URL(e);
|
|
9
|
+
return a.hostname === "youtu.be" ? a.pathname.slice(1) : a.searchParams.get("v") || a.pathname.split("/").pop();
|
|
10
|
+
} catch {
|
|
11
|
+
return e;
|
|
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)
|
|
20
|
+
switch (n) {
|
|
21
|
+
case "autoplay":
|
|
22
|
+
t.autoplay = e.autoplay ? "1" : "0", e.autoplay && e.muted === void 0 && (t.mute = "1");
|
|
23
|
+
break;
|
|
24
|
+
case "muted":
|
|
25
|
+
t.mute = e.muted ? "1" : "0";
|
|
26
|
+
break;
|
|
27
|
+
case "showControls":
|
|
28
|
+
t.controls = e.showControls ? "1" : "0";
|
|
29
|
+
break;
|
|
30
|
+
case "showRelatedVideos":
|
|
31
|
+
t.rel = e.showRelatedVideos ? "1" : "0";
|
|
32
|
+
break;
|
|
33
|
+
case "keyboard":
|
|
34
|
+
t.keyboard = e.keyboard ? "1" : "0";
|
|
35
|
+
break;
|
|
36
|
+
case "loop":
|
|
37
|
+
t.loop = e.loop ? "1" : "0", e.loop && (e.playlist ?? "").trim() === "" && (t.playlist = o);
|
|
38
|
+
break;
|
|
39
|
+
case "inline":
|
|
40
|
+
t.playsinline = e.inline ? "1" : "0";
|
|
41
|
+
break;
|
|
42
|
+
case "allowFullscreen":
|
|
43
|
+
t.fs = e.allowFullscreen ? "1" : "0";
|
|
44
|
+
break;
|
|
45
|
+
case "captionLanguage":
|
|
46
|
+
t.cc_lang_pref = e.captionLanguage;
|
|
47
|
+
break;
|
|
48
|
+
case "showCaptions":
|
|
49
|
+
t.cc_load_policy = e.showCaptions ? "1" : "0";
|
|
50
|
+
break;
|
|
51
|
+
case "showAnnotations":
|
|
52
|
+
t.iv_load_policy = e.showAnnotations ? "1" : "3";
|
|
53
|
+
break;
|
|
54
|
+
case "startTime":
|
|
55
|
+
t.start = (r = e.startTime) == null ? void 0 : r.toString();
|
|
56
|
+
break;
|
|
57
|
+
case "endTime":
|
|
58
|
+
t.end = (s = e.endTime) == null ? void 0 : s.toString();
|
|
59
|
+
break;
|
|
60
|
+
case "disableKeyboard":
|
|
61
|
+
t.disablekb = e.disableKeyboard ? "1" : "0";
|
|
62
|
+
break;
|
|
63
|
+
case "language":
|
|
64
|
+
t.hl = e.language;
|
|
65
|
+
break;
|
|
66
|
+
case "listId":
|
|
67
|
+
t.list = e.listId;
|
|
68
|
+
break;
|
|
69
|
+
case "listType":
|
|
70
|
+
t.listType = e.listType;
|
|
71
|
+
break;
|
|
72
|
+
case "color":
|
|
73
|
+
t.color = e.color;
|
|
74
|
+
break;
|
|
75
|
+
case "origin":
|
|
76
|
+
t.origin = e.origin;
|
|
77
|
+
break;
|
|
78
|
+
case "referrer":
|
|
79
|
+
t.widget_referrer = e.referrer;
|
|
80
|
+
break;
|
|
81
|
+
case "playlist":
|
|
82
|
+
t.playlist = e.playlist;
|
|
83
|
+
break;
|
|
84
|
+
}
|
|
85
|
+
return Object.entries(t).forEach(([n, i]) => {
|
|
86
|
+
i !== void 0 && c.searchParams.append(n, i.toString());
|
|
87
|
+
}), c.toString();
|
|
88
|
+
}, h = (e) => {
|
|
89
|
+
const a = document.createElement("link");
|
|
90
|
+
a.rel = "preconnect", a.href = e, a.crossOrigin = "true", document.head.appendChild(a);
|
|
91
|
+
};
|
|
92
|
+
let g = !1;
|
|
93
|
+
const T = (e) => {
|
|
94
|
+
if (!(g || window.matchMedia("(hover: none)").matches)) {
|
|
95
|
+
try {
|
|
96
|
+
const a = new URL(e);
|
|
97
|
+
h(a.origin);
|
|
98
|
+
} catch {
|
|
99
|
+
}
|
|
100
|
+
h(w), g = !0;
|
|
101
|
+
}
|
|
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 = ({
|
|
103
|
+
title: e,
|
|
104
|
+
status: a,
|
|
105
|
+
loading: o,
|
|
106
|
+
videoUrl: c,
|
|
107
|
+
previewImageUrl: l,
|
|
108
|
+
autoplay: t,
|
|
109
|
+
renderer: r,
|
|
110
|
+
showPreview: s,
|
|
111
|
+
onStatusChange: n,
|
|
112
|
+
onPreviewImageUrlChange: i
|
|
113
|
+
}) => {
|
|
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);
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
l || i(j(d));
|
|
126
|
+
}, [i, s, c, l]), r === "canvas" || a === "initial" ? null : /* @__PURE__ */ u(
|
|
127
|
+
"iframe",
|
|
128
|
+
{
|
|
129
|
+
title: e,
|
|
130
|
+
src: c,
|
|
131
|
+
loading: o,
|
|
132
|
+
allow: "accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture",
|
|
133
|
+
allowFullScreen: !0,
|
|
134
|
+
style: {
|
|
135
|
+
position: "absolute",
|
|
136
|
+
width: "100%",
|
|
137
|
+
height: "100%",
|
|
138
|
+
opacity: m,
|
|
139
|
+
transition: "opacity 1s",
|
|
140
|
+
border: "none"
|
|
141
|
+
},
|
|
142
|
+
onLoad: () => {
|
|
143
|
+
n("ready"), b(1);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
);
|
|
147
|
+
}, P = C(
|
|
148
|
+
({
|
|
149
|
+
url: e,
|
|
150
|
+
loading: a = "lazy",
|
|
151
|
+
autoplay: o,
|
|
152
|
+
showPreview: c,
|
|
153
|
+
children: l,
|
|
154
|
+
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(
|
|
158
|
+
{
|
|
159
|
+
...r,
|
|
160
|
+
url: e,
|
|
161
|
+
autoplay: !0
|
|
162
|
+
},
|
|
163
|
+
v
|
|
164
|
+
);
|
|
165
|
+
return /* @__PURE__ */ u(
|
|
166
|
+
E.Provider,
|
|
167
|
+
{
|
|
168
|
+
value: {
|
|
169
|
+
status: n,
|
|
170
|
+
previewImageUrl: m,
|
|
171
|
+
onInitPlayer() {
|
|
172
|
+
d !== "canvas" && i("loading");
|
|
173
|
+
}
|
|
174
|
+
},
|
|
175
|
+
children: /* @__PURE__ */ u("div", { ...r, ref: s, children: p ? /* @__PURE__ */ _(R, { children: [
|
|
176
|
+
l,
|
|
177
|
+
/* @__PURE__ */ u(
|
|
178
|
+
N,
|
|
179
|
+
{
|
|
180
|
+
title: r.title,
|
|
181
|
+
autoplay: o,
|
|
182
|
+
videoUrl: p,
|
|
183
|
+
previewImageUrl: m,
|
|
184
|
+
loading: a,
|
|
185
|
+
showPreview: c,
|
|
186
|
+
renderer: d,
|
|
187
|
+
status: n,
|
|
188
|
+
onStatusChange: i,
|
|
189
|
+
onPreviewImageUrlChange: b
|
|
190
|
+
}
|
|
191
|
+
)
|
|
192
|
+
] }) : /* @__PURE__ */ u(A, {}) })
|
|
193
|
+
}
|
|
194
|
+
);
|
|
195
|
+
}
|
|
196
|
+
);
|
|
197
|
+
P.displayName = "YouTube";
|
|
198
|
+
export {
|
|
199
|
+
P as YouTube
|
|
200
|
+
};
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { jsxs as i, jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { SpinnerIcon as r, PlayIcon as l } from "@webstudio-is/icons/svg";
|
|
3
|
+
import { $ as e, css as t } from "@webstudio-is/template";
|
|
4
|
+
const p = {
|
|
5
|
+
label: "YouTube",
|
|
6
|
+
category: "media",
|
|
7
|
+
order: 1,
|
|
8
|
+
description: "Add a video to your page that is hosted on YouTube. Paste a YouTube URL and configure the video in the Settings tab.",
|
|
9
|
+
template: /* @__PURE__ */ i(
|
|
10
|
+
e.YouTube,
|
|
11
|
+
{
|
|
12
|
+
"ws:label": "YouTube",
|
|
13
|
+
"ws:style": t`
|
|
14
|
+
position: relative;
|
|
15
|
+
aspect-ratio: 640/360;
|
|
16
|
+
width: 100%;
|
|
17
|
+
`,
|
|
18
|
+
children: [
|
|
19
|
+
/* @__PURE__ */ o(
|
|
20
|
+
e.VimeoPreviewImage,
|
|
21
|
+
{
|
|
22
|
+
"ws:label": "Preview Image",
|
|
23
|
+
"ws:style": t`
|
|
24
|
+
position: absolute;
|
|
25
|
+
object-fit: cover;
|
|
26
|
+
object-position: cover;
|
|
27
|
+
width: 100%;
|
|
28
|
+
height: 100%;
|
|
29
|
+
border-radius: 20px;
|
|
30
|
+
`,
|
|
31
|
+
alt: "Vimeo video preview image",
|
|
32
|
+
sizes: "100vw",
|
|
33
|
+
optimize: !0
|
|
34
|
+
}
|
|
35
|
+
),
|
|
36
|
+
/* @__PURE__ */ o(
|
|
37
|
+
e.VimeoSpinner,
|
|
38
|
+
{
|
|
39
|
+
"ws:label": "Spinner",
|
|
40
|
+
"ws:style": t`
|
|
41
|
+
position: absolute;
|
|
42
|
+
top: 50%;
|
|
43
|
+
left: 50%;
|
|
44
|
+
width: 70px;
|
|
45
|
+
height: 70px;
|
|
46
|
+
margin-top: -35px;
|
|
47
|
+
margin-left: -35px;
|
|
48
|
+
`,
|
|
49
|
+
children: /* @__PURE__ */ o(e.HtmlEmbed, { "ws:label": "Spinner SVG", code: r })
|
|
50
|
+
}
|
|
51
|
+
),
|
|
52
|
+
/* @__PURE__ */ o(
|
|
53
|
+
e.VimeoPlayButton,
|
|
54
|
+
{
|
|
55
|
+
"ws:label": "Play Button",
|
|
56
|
+
"ws:style": t`
|
|
57
|
+
position: absolute;
|
|
58
|
+
width: 140px;
|
|
59
|
+
height: 80px;
|
|
60
|
+
top: 50%;
|
|
61
|
+
left: 50%;
|
|
62
|
+
margin-top: -40px;
|
|
63
|
+
margin-left: -70px;
|
|
64
|
+
display: flex;
|
|
65
|
+
align-items: center;
|
|
66
|
+
justify-content: center;
|
|
67
|
+
border-style: none;
|
|
68
|
+
border-radius: 5px;
|
|
69
|
+
cursor: pointer;
|
|
70
|
+
background-color: rgb(18, 18, 18);
|
|
71
|
+
color: rgb(255, 255, 255);
|
|
72
|
+
&:hover {
|
|
73
|
+
background-color: rgb(0, 173, 239);
|
|
74
|
+
}
|
|
75
|
+
`,
|
|
76
|
+
"aria-label": "Play button",
|
|
77
|
+
children: /* @__PURE__ */ o(
|
|
78
|
+
e.Box,
|
|
79
|
+
{
|
|
80
|
+
"ws:label": "Play Icon",
|
|
81
|
+
"ws:style": t`
|
|
82
|
+
width: 60px;
|
|
83
|
+
height: 60px;
|
|
84
|
+
`,
|
|
85
|
+
"aria-hidden": !0,
|
|
86
|
+
children: /* @__PURE__ */ o(e.HtmlEmbed, { "ws:label": "Play SVG", code: l })
|
|
87
|
+
}
|
|
88
|
+
)
|
|
89
|
+
}
|
|
90
|
+
)
|
|
91
|
+
]
|
|
92
|
+
}
|
|
93
|
+
)
|
|
94
|
+
};
|
|
95
|
+
export {
|
|
96
|
+
p as meta
|
|
97
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { Youtube1cIcon as o } from "@webstudio-is/icons/svg";
|
|
2
|
+
import { defaultStates as t } from "@webstudio-is/sdk";
|
|
3
|
+
import { div as e } from "@webstudio-is/sdk/normalize.css";
|
|
4
|
+
import { props as n } from "./__generated__/youtube.props.js";
|
|
5
|
+
const i = {
|
|
6
|
+
div: e
|
|
7
|
+
}, c = {
|
|
8
|
+
type: "container",
|
|
9
|
+
icon: o,
|
|
10
|
+
states: t,
|
|
11
|
+
presetStyle: i,
|
|
12
|
+
constraints: {
|
|
13
|
+
relation: "ancestor",
|
|
14
|
+
component: { $nin: ["Button", "Link", "Heading"] }
|
|
15
|
+
}
|
|
16
|
+
}, a = [
|
|
17
|
+
"id",
|
|
18
|
+
"className",
|
|
19
|
+
"url",
|
|
20
|
+
"privacyEnhancedMode",
|
|
21
|
+
"title",
|
|
22
|
+
"loading",
|
|
23
|
+
"showPreview",
|
|
24
|
+
"autoplay",
|
|
25
|
+
"showControls",
|
|
26
|
+
"showRelatedVideos",
|
|
27
|
+
"keyboard",
|
|
28
|
+
"loop",
|
|
29
|
+
"inline",
|
|
30
|
+
"allowFullscreen",
|
|
31
|
+
"showCaptions",
|
|
32
|
+
"showAnnotations",
|
|
33
|
+
"startTime",
|
|
34
|
+
"endTime",
|
|
35
|
+
"disableKeyboard",
|
|
36
|
+
"referrer",
|
|
37
|
+
"listType",
|
|
38
|
+
"listId",
|
|
39
|
+
"origin",
|
|
40
|
+
"captionLanguage",
|
|
41
|
+
"language",
|
|
42
|
+
"color",
|
|
43
|
+
"playlist"
|
|
44
|
+
], d = {
|
|
45
|
+
props: n,
|
|
46
|
+
initialProps: a
|
|
47
|
+
};
|
|
48
|
+
export {
|
|
49
|
+
c as meta,
|
|
50
|
+
d as propsMeta
|
|
51
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webstudio-is/sdk-components-react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.197.0",
|
|
4
4
|
"description": "Webstudio default library for react",
|
|
5
5
|
"author": "Webstudio <github@webstudio.is>",
|
|
6
6
|
"homepage": "https://webstudio.is",
|
|
@@ -32,6 +32,11 @@
|
|
|
32
32
|
"webstudio": "./src/hooks.ts",
|
|
33
33
|
"types": "./lib/types/hooks.d.ts",
|
|
34
34
|
"import": "./lib/hooks.js"
|
|
35
|
+
},
|
|
36
|
+
"./templates": {
|
|
37
|
+
"webstudio": "./src/templates.ts",
|
|
38
|
+
"types": "./lib/types/templates.d.ts",
|
|
39
|
+
"import": "./lib/templates.js"
|
|
35
40
|
}
|
|
36
41
|
},
|
|
37
42
|
"peerDependencies": {
|
|
@@ -39,14 +44,15 @@
|
|
|
39
44
|
"react-dom": "18.3.0-canary-14898b6a9-20240318"
|
|
40
45
|
},
|
|
41
46
|
"dependencies": {
|
|
42
|
-
"@react-aria/utils": "^3.
|
|
43
|
-
"colord": "^2.9.3",
|
|
44
|
-
"micromark": "^4.0.0",
|
|
47
|
+
"@react-aria/utils": "^3.26.0",
|
|
45
48
|
"await-interaction-response": "^0.0.2",
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"@webstudio-is/
|
|
49
|
+
"colord": "^2.9.3",
|
|
50
|
+
"micromark": "^4.0.1",
|
|
51
|
+
"micromark-extension-gfm-table": "^2.1.0",
|
|
52
|
+
"@webstudio-is/icons": "0.197.0",
|
|
53
|
+
"@webstudio-is/react-sdk": "0.197.0",
|
|
54
|
+
"@webstudio-is/image": "0.197.0",
|
|
55
|
+
"@webstudio-is/sdk": "0.197.0"
|
|
50
56
|
},
|
|
51
57
|
"devDependencies": {
|
|
52
58
|
"@testing-library/react": "^14.2.2",
|
|
@@ -56,11 +62,12 @@
|
|
|
56
62
|
"react-dom": "18.3.0-canary-14898b6a9-20240318",
|
|
57
63
|
"vitest": "^2.1.8",
|
|
58
64
|
"@webstudio-is/generate-arg-types": "0.0.0",
|
|
65
|
+
"@webstudio-is/template": "0.197.0",
|
|
59
66
|
"@webstudio-is/tsconfig": "1.0.7"
|
|
60
67
|
},
|
|
61
68
|
"scripts": {
|
|
62
69
|
"build": "vite build --config ../../vite.sdk-components.config.ts",
|
|
63
|
-
"build:args": "NODE_OPTIONS=--conditions=webstudio generate-arg-types './src/*.tsx !./src/*.stories.tsx !./src/*.test.{ts,tsx} !./src/*.ws.ts' && prettier --write \"**/*.props.ts\"",
|
|
70
|
+
"build:args": "NODE_OPTIONS=--conditions=webstudio generate-arg-types './src/*.tsx !./src/*.stories.tsx !./src/*.test.{ts,tsx} !./src/*.ws.ts !./src/*.ws.ts !./src/*.template.tsx' && prettier --write \"**/*.props.ts\"",
|
|
64
71
|
"dts": "tsc --project tsconfig.dts.json",
|
|
65
72
|
"test": "vitest run",
|
|
66
73
|
"typecheck": "tsc"
|
package/lib/content-embed.ws.js
DELETED
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import { ContentEmbedIcon as n } from "@webstudio-is/icons/svg";
|
|
2
|
-
import { imagePlaceholderDataUrl as l } from "@webstudio-is/image";
|
|
3
|
-
import { descendantComponent as a } from "@webstudio-is/react-sdk";
|
|
4
|
-
const i = `
|
|
5
|
-
<h1>Styling HTML with Content Embed</h1>
|
|
6
|
-
<p>Content Embed allows styling of HTML, which primarily comes from external data.</p>
|
|
7
|
-
<h2>How to Use Content Embed</h2>
|
|
8
|
-
<ul>
|
|
9
|
-
<li>Every element is shown in the Navigator.</li>
|
|
10
|
-
<li>Apply styles and Tokens to each element.</li>
|
|
11
|
-
<li>Adjustments to elements apply universally within this embed, ensuring consistency across your content.</li>
|
|
12
|
-
</ul>
|
|
13
|
-
<hr>
|
|
14
|
-
<h2>This sample text contains all the elements that can be styled.</h2>
|
|
15
|
-
<p>Any elements that were not used above are used below.</p>
|
|
16
|
-
<h3>Heading 3</h3>
|
|
17
|
-
<h4>Heading 4</h4>
|
|
18
|
-
<h5>Heading 5</h5>
|
|
19
|
-
<h6>Heading 6</h6>
|
|
20
|
-
<p><a href="#">Links</a> connect your content to relevant resources.</p>
|
|
21
|
-
<p><strong>Bold text</strong> makes your important points stand out.</p>
|
|
22
|
-
<p><em>Italic text</em> is great for emphasizing terms.</p>
|
|
23
|
-
<ol>
|
|
24
|
-
<li>First Step</li>
|
|
25
|
-
<li>Second Step</li>
|
|
26
|
-
</ol>
|
|
27
|
-
<img src="${l}">
|
|
28
|
-
<blockquote>Capture attention with a powerful quote.</blockquote>
|
|
29
|
-
<p>Using <code>console.log("Hello World");</code> will log to the console.</p>
|
|
30
|
-
`.trim(), e = (t, o) => ({
|
|
31
|
-
type: "instance",
|
|
32
|
-
component: a,
|
|
33
|
-
label: t,
|
|
34
|
-
props: [{ type: "string", name: "selector", value: ` ${o}` }],
|
|
35
|
-
children: []
|
|
36
|
-
}), p = {
|
|
37
|
-
category: "data",
|
|
38
|
-
type: "control",
|
|
39
|
-
description: "Content Embed allows styling of HTML, which can be provided via the Code property statically or loaded dynamically from any Resource, for example, from a CMS.",
|
|
40
|
-
icon: n,
|
|
41
|
-
order: 3,
|
|
42
|
-
template: [
|
|
43
|
-
{
|
|
44
|
-
type: "instance",
|
|
45
|
-
component: "HtmlEmbed",
|
|
46
|
-
label: "Content Embed",
|
|
47
|
-
props: [
|
|
48
|
-
{
|
|
49
|
-
name: "code",
|
|
50
|
-
type: "string",
|
|
51
|
-
value: i
|
|
52
|
-
}
|
|
53
|
-
],
|
|
54
|
-
children: [
|
|
55
|
-
e("Paragraph", "p"),
|
|
56
|
-
e("Heading 1", "h1"),
|
|
57
|
-
e("Heading 2", "h2"),
|
|
58
|
-
e("Heading 3", "h3"),
|
|
59
|
-
e("Heading 4", "h4"),
|
|
60
|
-
e("Heading 5", "h5"),
|
|
61
|
-
e("Heading 6", "h6"),
|
|
62
|
-
e("Bold", ":where(strong, b)"),
|
|
63
|
-
e("Italic", ":where(em, i)"),
|
|
64
|
-
e("Link", "a"),
|
|
65
|
-
e("Image", "img"),
|
|
66
|
-
e("Blockquote", "blockquote"),
|
|
67
|
-
e("Code Text", "code"),
|
|
68
|
-
e("List", ":where(ul, ol)"),
|
|
69
|
-
e("List Item", "li"),
|
|
70
|
-
e("Separator", "hr")
|
|
71
|
-
]
|
|
72
|
-
}
|
|
73
|
-
]
|
|
74
|
-
};
|
|
75
|
-
export {
|
|
76
|
-
p as meta
|
|
77
|
-
};
|