@webstudio-is/sdk-components-react 0.0.0-021f2d4
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/LICENSE +661 -0
- package/README.md +3 -0
- package/lib/__generated__/blockquote.props.js +514 -0
- package/lib/__generated__/body.props.js +508 -0
- package/lib/__generated__/bold.props.js +508 -0
- package/lib/__generated__/box.props.js +527 -0
- package/lib/__generated__/button.props.js +570 -0
- package/lib/__generated__/checkbox.props.js +672 -0
- package/lib/__generated__/code-text.props.js +509 -0
- package/lib/__generated__/form.props.js +556 -0
- package/lib/__generated__/head-link.props.js +620 -0
- package/lib/__generated__/head-meta.props.js +532 -0
- package/lib/__generated__/head-title.props.js +508 -0
- package/lib/__generated__/head.props.js +508 -0
- package/lib/__generated__/heading.props.js +516 -0
- package/lib/__generated__/html-embed.props.js +13 -0
- package/lib/__generated__/image.props.js +593 -0
- package/lib/__generated__/input.props.js +696 -0
- package/lib/__generated__/italic.props.js +508 -0
- package/lib/__generated__/label.props.js +520 -0
- package/lib/__generated__/link.props.js +578 -0
- package/lib/__generated__/list-item.props.js +514 -0
- package/lib/__generated__/list.props.js +534 -0
- package/lib/__generated__/markdown-embed.props.js +7 -0
- package/lib/__generated__/option.props.js +532 -0
- package/lib/__generated__/paragraph.props.js +508 -0
- package/lib/__generated__/radio-button.props.js +672 -0
- package/lib/__generated__/select.props.js +556 -0
- package/lib/__generated__/separator.props.js +508 -0
- package/lib/__generated__/span.props.js +508 -0
- package/lib/__generated__/subscript.props.js +508 -0
- package/lib/__generated__/superscript.props.js +508 -0
- package/lib/__generated__/text.props.js +516 -0
- package/lib/__generated__/textarea.props.js +587 -0
- package/lib/__generated__/time.props.js +312 -0
- package/lib/__generated__/vimeo-play-button.props.js +569 -0
- package/lib/__generated__/vimeo-preview-image.props.js +591 -0
- package/lib/__generated__/vimeo-spinner.props.js +508 -0
- package/lib/__generated__/vimeo.props.js +673 -0
- package/lib/__generated__/webhook-form.props.js +569 -0
- package/lib/__generated__/xml-node.props.js +21 -0
- package/lib/__generated__/xml-time.props.js +18 -0
- package/lib/__generated__/youtube.props.js +665 -0
- package/lib/blockquote.js +9 -0
- package/lib/blockquote.template.js +11 -0
- package/lib/blockquote.ws.js +63 -0
- package/lib/body.js +7 -0
- package/lib/body.ws.js +29 -0
- package/lib/bold.js +7 -0
- package/lib/bold.ws.js +20 -0
- package/lib/box.js +9 -0
- package/lib/box.ws.js +31 -0
- package/lib/button.js +9 -0
- package/lib/button.template.js +11 -0
- package/lib/button.ws.js +27 -0
- package/lib/checkbox.js +15 -0
- package/lib/checkbox.template.js +14 -0
- package/lib/checkbox.ws.js +38 -0
- package/lib/code-text.js +10 -0
- package/lib/code-text.ws.js +59 -0
- package/lib/components.js +89 -0
- package/lib/content-embed.template.js +83 -0
- package/lib/form.js +7 -0
- package/lib/form.ws.js +30 -0
- package/lib/fragment.js +7 -0
- package/lib/fragment.ws.js +10 -0
- package/lib/head-link.js +23 -0
- package/lib/head-link.ws.js +19 -0
- package/lib/head-meta.js +23 -0
- package/lib/head-meta.ws.js +19 -0
- package/lib/head-slot.js +54 -0
- package/lib/head-slot.template.js +15 -0
- package/lib/head-slot.ws.js +25 -0
- package/lib/head-title.js +23 -0
- package/lib/head-title.ws.js +18 -0
- package/lib/heading.js +9 -0
- package/lib/heading.template.js +11 -0
- package/lib/heading.ws.js +28 -0
- package/lib/home_wsKvRSqvkajPPBeycZ-C8.svg +3 -0
- package/lib/hooks.js +6 -0
- package/lib/html-embed-patchers.js +29 -0
- package/lib/html-embed.js +112 -0
- package/lib/html-embed.ws.js +46 -0
- package/lib/image.js +38 -0
- package/lib/image.ws.js +60 -0
- package/lib/input.js +17 -0
- package/lib/input.ws.js +54 -0
- package/lib/italic.js +7 -0
- package/lib/italic.ws.js +26 -0
- package/lib/label.js +7 -0
- package/lib/label.template.js +10 -0
- package/lib/label.ws.js +27 -0
- package/lib/link.js +15 -0
- package/lib/link.template.js +11 -0
- package/lib/link.ws.js +47 -0
- package/lib/list-item.js +9 -0
- package/lib/list-item.template.js +11 -0
- package/lib/list-item.ws.js +26 -0
- package/lib/list.js +6 -0
- package/lib/list.template.js +15 -0
- package/lib/list.ws.js +48 -0
- package/lib/markdown-embed.js +19 -0
- package/lib/markdown-embed.template.js +75 -0
- package/lib/markdown-embed.ws.js +33 -0
- package/lib/metas.js +90 -0
- package/lib/option.js +7 -0
- package/lib/option.ws.js +44 -0
- package/lib/paragraph.js +7 -0
- package/lib/paragraph.template.js +11 -0
- package/lib/paragraph.ws.js +23 -0
- package/lib/props.js +90 -0
- package/lib/radio-button.js +15 -0
- package/lib/radio-button.template.js +14 -0
- package/lib/radio-button.ws.js +40 -0
- package/lib/rich-text-link.ws.js +9 -0
- package/lib/select.js +19 -0
- package/lib/select.template.js +16 -0
- package/lib/select.ws.js +44 -0
- package/lib/separator.js +9 -0
- package/lib/separator.ws.js +48 -0
- package/lib/slot.js +14 -0
- package/lib/slot.ws.js +14 -0
- package/lib/span.js +7 -0
- package/lib/span.ws.js +20 -0
- package/lib/subscript.js +7 -0
- package/lib/subscript.ws.js +20 -0
- package/lib/superscript.js +7 -0
- package/lib/superscript.ws.js +20 -0
- package/lib/templates.js +38 -0
- package/lib/text.js +10 -0
- package/lib/text.template.js +11 -0
- package/lib/text.ws.js +25 -0
- package/lib/textarea.js +7 -0
- package/lib/textarea.ws.js +55 -0
- package/lib/time.js +319 -0
- package/lib/time.ws.js +21 -0
- package/lib/types/__generated__/blockquote.props.d.ts +2 -0
- package/lib/types/__generated__/body.props.d.ts +2 -0
- package/lib/types/__generated__/bold.props.d.ts +2 -0
- package/lib/types/__generated__/box.props.d.ts +2 -0
- package/lib/types/__generated__/button.props.d.ts +2 -0
- package/lib/types/__generated__/checkbox.props.d.ts +2 -0
- package/lib/types/__generated__/code-text.props.d.ts +2 -0
- package/lib/types/__generated__/form.props.d.ts +2 -0
- package/lib/types/__generated__/fragment.props.d.ts +2 -0
- package/lib/types/__generated__/head-link.props.d.ts +2 -0
- package/lib/types/__generated__/head-meta.props.d.ts +2 -0
- package/lib/types/__generated__/head-slot.props.d.ts +2 -0
- package/lib/types/__generated__/head-title.props.d.ts +2 -0
- package/lib/types/__generated__/head.props.d.ts +2 -0
- package/lib/types/__generated__/heading.props.d.ts +2 -0
- package/lib/types/__generated__/html-embed.props.d.ts +2 -0
- package/lib/types/__generated__/image.props.d.ts +2 -0
- package/lib/types/__generated__/input.props.d.ts +2 -0
- package/lib/types/__generated__/italic.props.d.ts +2 -0
- package/lib/types/__generated__/label.props.d.ts +2 -0
- package/lib/types/__generated__/link.props.d.ts +2 -0
- package/lib/types/__generated__/list-item.props.d.ts +2 -0
- package/lib/types/__generated__/list.props.d.ts +2 -0
- package/lib/types/__generated__/markdown-embed.props.d.ts +2 -0
- package/lib/types/__generated__/option.props.d.ts +2 -0
- package/lib/types/__generated__/paragraph.props.d.ts +2 -0
- package/lib/types/__generated__/radio-button.props.d.ts +2 -0
- package/lib/types/__generated__/rich-text-link.props.d.ts +2 -0
- package/lib/types/__generated__/select.props.d.ts +2 -0
- package/lib/types/__generated__/separator.props.d.ts +2 -0
- package/lib/types/__generated__/slot.props.d.ts +2 -0
- package/lib/types/__generated__/span.props.d.ts +2 -0
- package/lib/types/__generated__/subscript.props.d.ts +2 -0
- package/lib/types/__generated__/superscript.props.d.ts +2 -0
- package/lib/types/__generated__/text.props.d.ts +2 -0
- package/lib/types/__generated__/textarea.props.d.ts +2 -0
- package/lib/types/__generated__/time.props.d.ts +2 -0
- package/lib/types/__generated__/vimeo-play-button.props.d.ts +2 -0
- package/lib/types/__generated__/vimeo-preview-image.props.d.ts +2 -0
- package/lib/types/__generated__/vimeo-spinner.props.d.ts +2 -0
- package/lib/types/__generated__/vimeo.props.d.ts +2 -0
- package/lib/types/__generated__/webhook-form.props.d.ts +2 -0
- package/lib/types/__generated__/xml-node.props.d.ts +2 -0
- package/lib/types/__generated__/xml-time.props.d.ts +2 -0
- package/lib/types/__generated__/youtube.props.d.ts +2 -0
- package/lib/types/blockquote.d.ts +2 -0
- package/lib/types/blockquote.template.d.ts +2 -0
- package/lib/types/blockquote.ws.d.ts +3 -0
- package/lib/types/body.d.ts +2 -0
- package/lib/types/body.ws.d.ts +3 -0
- package/lib/types/bold.d.ts +2 -0
- package/lib/types/bold.ws.d.ts +3 -0
- package/lib/types/box.d.ts +8 -0
- package/lib/types/box.ws.d.ts +3 -0
- package/lib/types/button.d.ts +2 -0
- package/lib/types/button.template.d.ts +2 -0
- package/lib/types/button.ws.d.ts +3 -0
- package/lib/types/checkbox.d.ts +4 -0
- package/lib/types/checkbox.template.d.ts +2 -0
- package/lib/types/checkbox.ws.d.ts +3 -0
- package/lib/types/code-text.d.ts +4 -0
- package/lib/types/code-text.ws.d.ts +3 -0
- package/lib/types/components.d.ts +44 -0
- package/lib/types/content-embed.template.d.ts +2 -0
- package/lib/types/form.d.ts +2 -0
- package/lib/types/form.ws.d.ts +3 -0
- package/lib/types/fragment.d.ts +6 -0
- package/lib/types/fragment.ws.d.ts +3 -0
- package/lib/types/head-link.d.ts +8 -0
- package/lib/types/head-link.ws.d.ts +3 -0
- package/lib/types/head-meta.d.ts +2 -0
- package/lib/types/head-meta.ws.d.ts +3 -0
- package/lib/types/head-slot.d.ts +9 -0
- package/lib/types/head-slot.template.d.ts +2 -0
- package/lib/types/head-slot.ws.d.ts +3 -0
- package/lib/types/head-title.d.ts +2 -0
- package/lib/types/head-title.ws.d.ts +3 -0
- package/lib/types/heading.d.ts +8 -0
- package/lib/types/heading.template.d.ts +2 -0
- package/lib/types/heading.ws.d.ts +3 -0
- package/lib/types/hooks.d.ts +2 -0
- package/lib/types/html-embed-patchers.d.ts +2 -0
- package/lib/types/html-embed.d.ts +12 -0
- package/lib/types/html-embed.test.d.ts +1 -0
- package/lib/types/html-embed.ws.d.ts +3 -0
- package/lib/types/image.d.ts +8 -0
- package/lib/types/image.ws.d.ts +3 -0
- package/lib/types/input.d.ts +4 -0
- package/lib/types/input.ws.d.ts +3 -0
- package/lib/types/italic.d.ts +2 -0
- package/lib/types/italic.ws.d.ts +3 -0
- package/lib/types/label.d.ts +2 -0
- package/lib/types/label.template.d.ts +2 -0
- package/lib/types/label.ws.d.ts +3 -0
- package/lib/types/link.d.ts +11 -0
- package/lib/types/link.template.d.ts +2 -0
- package/lib/types/link.ws.d.ts +3 -0
- package/lib/types/list-item.d.ts +2 -0
- package/lib/types/list-item.template.d.ts +2 -0
- package/lib/types/list-item.ws.d.ts +3 -0
- package/lib/types/list.d.ts +10 -0
- package/lib/types/list.template.d.ts +2 -0
- package/lib/types/list.ws.d.ts +3 -0
- package/lib/types/markdown-embed.d.ts +7 -0
- package/lib/types/markdown-embed.template.d.ts +2 -0
- package/lib/types/markdown-embed.ws.d.ts +3 -0
- package/lib/types/metas.d.ts +44 -0
- package/lib/types/option.d.ts +2 -0
- package/lib/types/option.ws.d.ts +3 -0
- package/lib/types/paragraph.d.ts +2 -0
- package/lib/types/paragraph.template.d.ts +2 -0
- package/lib/types/paragraph.ws.d.ts +3 -0
- package/lib/types/props.d.ts +44 -0
- package/lib/types/radio-button.d.ts +4 -0
- package/lib/types/radio-button.template.d.ts +2 -0
- package/lib/types/radio-button.ws.d.ts +3 -0
- package/lib/types/rich-text-link.d.ts +1 -0
- package/lib/types/rich-text-link.ws.d.ts +3 -0
- package/lib/types/select.d.ts +4 -0
- package/lib/types/select.template.d.ts +2 -0
- package/lib/types/select.ws.d.ts +3 -0
- package/lib/types/separator.d.ts +2 -0
- package/lib/types/separator.ws.d.ts +3 -0
- package/lib/types/slot.d.ts +6 -0
- package/lib/types/slot.ws.d.ts +3 -0
- package/lib/types/span.d.ts +2 -0
- package/lib/types/span.ws.d.ts +3 -0
- package/lib/types/subscript.d.ts +2 -0
- package/lib/types/subscript.ws.d.ts +3 -0
- package/lib/types/superscript.d.ts +2 -0
- package/lib/types/superscript.ws.d.ts +3 -0
- package/lib/types/templates.d.ts +18 -0
- package/lib/types/test-utils/cartesian.d.ts +2 -0
- package/lib/types/text.d.ts +8 -0
- package/lib/types/text.template.d.ts +2 -0
- package/lib/types/text.ws.d.ts +3 -0
- package/lib/types/textarea.d.ts +2 -0
- package/lib/types/textarea.ws.d.ts +3 -0
- package/lib/types/time.d.ts +18 -0
- package/lib/types/time.test.d.ts +1 -0
- package/lib/types/time.ws.d.ts +3 -0
- package/lib/types/vimeo-play-button.d.ts +3 -0
- package/lib/types/vimeo-play-button.ws.d.ts +3 -0
- package/lib/types/vimeo-preview-image.d.ts +284 -0
- package/lib/types/vimeo-preview-image.ws.d.ts +3 -0
- package/lib/types/vimeo-spinner.d.ts +1 -0
- package/lib/types/vimeo-spinner.ws.d.ts +3 -0
- package/lib/types/vimeo.d.ts +85 -0
- package/lib/types/vimeo.template.d.ts +2 -0
- package/lib/types/vimeo.ws.d.ts +3 -0
- package/lib/types/webhook-form.d.ts +9 -0
- package/lib/types/webhook-form.template.d.ts +2 -0
- package/lib/types/webhook-form.ws.d.ts +3 -0
- package/lib/types/xml-node.d.ts +13 -0
- package/lib/types/xml-node.ws.d.ts +3 -0
- package/lib/types/xml-time.d.ts +6 -0
- package/lib/types/xml-time.ws.d.ts +3 -0
- 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.js +18 -0
- package/lib/vimeo-play-button.ws.js +31 -0
- package/lib/vimeo-preview-image.js +19 -0
- package/lib/vimeo-preview-image.ws.js +27 -0
- package/lib/vimeo-spinner.js +13 -0
- package/lib/vimeo-spinner.ws.js +25 -0
- package/lib/vimeo.js +216 -0
- package/lib/vimeo.template.js +93 -0
- package/lib/vimeo.ws.js +40 -0
- package/lib/webhook-form.js +9 -0
- package/lib/webhook-form.template.js +49 -0
- package/lib/webhook-form.ws.js +26 -0
- package/lib/xml-node.js +60 -0
- package/lib/xml-node.ws.js +16 -0
- package/lib/xml-time.js +25 -0
- package/lib/xml-time.ws.js +16 -0
- package/lib/youtube.js +206 -0
- package/lib/youtube.template.js +97 -0
- package/lib/youtube.ws.js +51 -0
- package/package.json +77 -0
|
@@ -0,0 +1,31 @@
|
|
|
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
|
+
const r = {
|
|
6
|
+
button: e
|
|
7
|
+
}, p = {
|
|
8
|
+
category: "hidden",
|
|
9
|
+
type: "container",
|
|
10
|
+
constraints: [
|
|
11
|
+
{
|
|
12
|
+
relation: "ancestor",
|
|
13
|
+
component: { $in: ["Vimeo", "YouTube"] }
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
relation: "ancestor",
|
|
17
|
+
component: { $neq: "Button" }
|
|
18
|
+
}
|
|
19
|
+
],
|
|
20
|
+
label: "Play Button",
|
|
21
|
+
icon: o,
|
|
22
|
+
presetStyle: r,
|
|
23
|
+
states: t
|
|
24
|
+
}, c = {
|
|
25
|
+
props: n,
|
|
26
|
+
initialProps: ["id", "className"]
|
|
27
|
+
};
|
|
28
|
+
export {
|
|
29
|
+
p as meta,
|
|
30
|
+
c as propsMeta
|
|
31
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { jsx as m } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as i, useContext as t } from "react";
|
|
3
|
+
import { Image as a } from "./image.js";
|
|
4
|
+
import { VimeoContext as g } from "./vimeo.js";
|
|
5
|
+
const n = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkOAMAANIAzr59FiYAAAAASUVORK5CYII=", s = i(({ src: A, ...e }, o) => {
|
|
6
|
+
const r = t(g);
|
|
7
|
+
return /* @__PURE__ */ m(
|
|
8
|
+
a,
|
|
9
|
+
{
|
|
10
|
+
...e,
|
|
11
|
+
src: String(r.previewImageUrl ?? A ?? n),
|
|
12
|
+
ref: o
|
|
13
|
+
}
|
|
14
|
+
);
|
|
15
|
+
});
|
|
16
|
+
s.displayName = "VimeoPreviewImage";
|
|
17
|
+
export {
|
|
18
|
+
s as VimeoPreviewImage
|
|
19
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { meta as e, propsMeta as o } from "./image.ws.js";
|
|
2
|
+
import { props as r } from "./__generated__/vimeo-preview-image.props.js";
|
|
3
|
+
const i = {
|
|
4
|
+
...e,
|
|
5
|
+
category: "hidden",
|
|
6
|
+
label: "Preview Image",
|
|
7
|
+
constraints: {
|
|
8
|
+
relation: "ancestor",
|
|
9
|
+
component: { $in: ["Vimeo", "YouTube"] }
|
|
10
|
+
}
|
|
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
|
|
23
|
+
};
|
|
24
|
+
export {
|
|
25
|
+
i as meta,
|
|
26
|
+
p as propsMeta
|
|
27
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as r, useContext as i } from "react";
|
|
3
|
+
import { VimeoContext as n } from "./vimeo.js";
|
|
4
|
+
const m = r(
|
|
5
|
+
(o, t) => {
|
|
6
|
+
if (i(n).status === "loading")
|
|
7
|
+
return /* @__PURE__ */ e("div", { ...o, ref: t });
|
|
8
|
+
}
|
|
9
|
+
);
|
|
10
|
+
m.displayName = "VimeoSpinner";
|
|
11
|
+
export {
|
|
12
|
+
m as VimeoSpinner
|
|
13
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
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
|
+
const n = {
|
|
6
|
+
div: t
|
|
7
|
+
}, m = {
|
|
8
|
+
type: "container",
|
|
9
|
+
constraints: {
|
|
10
|
+
relation: "ancestor",
|
|
11
|
+
component: { $in: ["Vimeo", "YouTube"] }
|
|
12
|
+
},
|
|
13
|
+
icon: e,
|
|
14
|
+
states: o,
|
|
15
|
+
presetStyle: n,
|
|
16
|
+
category: "hidden",
|
|
17
|
+
label: "Spinner"
|
|
18
|
+
}, c = {
|
|
19
|
+
props: r,
|
|
20
|
+
initialProps: ["id", "className"]
|
|
21
|
+
};
|
|
22
|
+
export {
|
|
23
|
+
m as meta,
|
|
24
|
+
c as propsMeta
|
|
25
|
+
};
|
package/lib/vimeo.js
ADDED
|
@@ -0,0 +1,216 @@
|
|
|
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
|
+
if (e.url === void 0)
|
|
7
|
+
return;
|
|
8
|
+
let t;
|
|
9
|
+
try {
|
|
10
|
+
const o = new URL(e.url);
|
|
11
|
+
t = new URL(R), t.pathname = `/video${o.pathname}`;
|
|
12
|
+
} catch {
|
|
13
|
+
}
|
|
14
|
+
if (t === void 0)
|
|
15
|
+
return;
|
|
16
|
+
const a = {
|
|
17
|
+
showPortrait: "portrait",
|
|
18
|
+
showByline: "byline",
|
|
19
|
+
showTitle: "title",
|
|
20
|
+
controlsColor: "color",
|
|
21
|
+
showControls: "controls",
|
|
22
|
+
interactiveParams: "interactive_params",
|
|
23
|
+
backgroundMode: "background",
|
|
24
|
+
doNotTrack: "dnt"
|
|
25
|
+
};
|
|
26
|
+
let r;
|
|
27
|
+
for (r in e) {
|
|
28
|
+
const o = e[r];
|
|
29
|
+
if (r === "url" || o === void 0)
|
|
30
|
+
continue;
|
|
31
|
+
const i = a[r] ?? r;
|
|
32
|
+
t.searchParams.append(i, o.toString());
|
|
33
|
+
}
|
|
34
|
+
if (t.searchParams.set("autoplay", "true"), typeof e.controlsColor == "string") {
|
|
35
|
+
const o = z(e.controlsColor).toHex().replace("#", "");
|
|
36
|
+
t.searchParams.set("color", o);
|
|
37
|
+
}
|
|
38
|
+
return e.showPortrait && t.searchParams.set("title", "true"), e.showByline && (t.searchParams.set("portrait", "true"), t.searchParams.set("title", "true")), t.toString();
|
|
39
|
+
}, h = (e) => {
|
|
40
|
+
const t = document.createElement("link");
|
|
41
|
+
t.rel = "preconnect", t.href = e, t.crossOrigin = "true", document.head.appendChild(t);
|
|
42
|
+
};
|
|
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
|
+
try {
|
|
48
|
+
const a = new URL(e).pathname.split("/")[2];
|
|
49
|
+
return a === "" || a == null ? void 0 : a;
|
|
50
|
+
} catch {
|
|
51
|
+
}
|
|
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
|
+
"div",
|
|
57
|
+
{
|
|
58
|
+
style: {
|
|
59
|
+
display: "flex",
|
|
60
|
+
width: "100%",
|
|
61
|
+
height: "100%",
|
|
62
|
+
alignItems: "center",
|
|
63
|
+
justifyContent: "center",
|
|
64
|
+
fontSize: "1.2em"
|
|
65
|
+
},
|
|
66
|
+
children: 'Open the "Settings" panel and paste a video URL, e.g. https://vimeo.com/831343124.'
|
|
67
|
+
}
|
|
68
|
+
), Z = ({
|
|
69
|
+
title: e,
|
|
70
|
+
status: t,
|
|
71
|
+
loading: a,
|
|
72
|
+
videoUrl: r,
|
|
73
|
+
previewImageUrl: o,
|
|
74
|
+
autoplay: i,
|
|
75
|
+
renderer: n,
|
|
76
|
+
showPreview: d,
|
|
77
|
+
onStatusChange: c,
|
|
78
|
+
onPreviewImageUrlChange: l
|
|
79
|
+
}) => {
|
|
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(() => {
|
|
86
|
+
if (r !== void 0) {
|
|
87
|
+
if (d === !1) {
|
|
88
|
+
l(void 0);
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
o === void 0 && W(r).then(l).catch(() => {
|
|
92
|
+
console.error(`Could not load preview image for ${r}`);
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
}, [l, d, r, o]), !(n === "canvas" || t === "initial"))
|
|
96
|
+
return /* @__PURE__ */ s(
|
|
97
|
+
"iframe",
|
|
98
|
+
{
|
|
99
|
+
title: e,
|
|
100
|
+
src: r,
|
|
101
|
+
loading: a,
|
|
102
|
+
allow: "accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture;",
|
|
103
|
+
allowFullScreen: !0,
|
|
104
|
+
style: {
|
|
105
|
+
position: "absolute",
|
|
106
|
+
width: "100%",
|
|
107
|
+
height: "100%",
|
|
108
|
+
opacity: p,
|
|
109
|
+
transition: "opacity 1s",
|
|
110
|
+
border: "none"
|
|
111
|
+
},
|
|
112
|
+
onLoad: () => {
|
|
113
|
+
c("ready"), u(1);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
);
|
|
117
|
+
}, tt = T({
|
|
118
|
+
onInitPlayer: () => {
|
|
119
|
+
},
|
|
120
|
+
status: "initial"
|
|
121
|
+
}), et = q(
|
|
122
|
+
({
|
|
123
|
+
url: e,
|
|
124
|
+
loading: t = "lazy",
|
|
125
|
+
autoplay: a = !1,
|
|
126
|
+
autopause: r = !0,
|
|
127
|
+
showByline: o = !1,
|
|
128
|
+
showControls: i = !0,
|
|
129
|
+
doNotTrack: n = !1,
|
|
130
|
+
keyboard: d = !0,
|
|
131
|
+
loop: c = !1,
|
|
132
|
+
muted: l = !1,
|
|
133
|
+
pip: p = !1,
|
|
134
|
+
playsinline: u = !0,
|
|
135
|
+
showPortrait: S = !0,
|
|
136
|
+
quality: L = "auto",
|
|
137
|
+
responsive: k = !0,
|
|
138
|
+
speed: E = !1,
|
|
139
|
+
showTitle: _ = !1,
|
|
140
|
+
transparent: j = !0,
|
|
141
|
+
showPreview: M = !1,
|
|
142
|
+
autopip: N,
|
|
143
|
+
controlsColor: O,
|
|
144
|
+
interactiveParams: V,
|
|
145
|
+
texttrack: $,
|
|
146
|
+
children: A,
|
|
147
|
+
...y
|
|
148
|
+
}, m) => {
|
|
149
|
+
const [w, g] = v("initial"), [P, B] = v(), { renderer: C } = G(H), I = Y({
|
|
150
|
+
url: e,
|
|
151
|
+
autoplay: a,
|
|
152
|
+
autopause: r,
|
|
153
|
+
showControls: i,
|
|
154
|
+
controlsColor: O,
|
|
155
|
+
doNotTrack: n,
|
|
156
|
+
interactiveParams: V,
|
|
157
|
+
keyboard: d,
|
|
158
|
+
loop: c,
|
|
159
|
+
muted: l,
|
|
160
|
+
pip: p,
|
|
161
|
+
playsinline: u,
|
|
162
|
+
quality: L,
|
|
163
|
+
responsive: k,
|
|
164
|
+
speed: E,
|
|
165
|
+
texttrack: $,
|
|
166
|
+
showTitle: _,
|
|
167
|
+
transparent: j,
|
|
168
|
+
showPortrait: S,
|
|
169
|
+
autopip: N
|
|
170
|
+
});
|
|
171
|
+
return /* @__PURE__ */ s(
|
|
172
|
+
tt.Provider,
|
|
173
|
+
{
|
|
174
|
+
value: {
|
|
175
|
+
status: w,
|
|
176
|
+
previewImageUrl: P,
|
|
177
|
+
onInitPlayer() {
|
|
178
|
+
C !== "canvas" && g("loading");
|
|
179
|
+
}
|
|
180
|
+
},
|
|
181
|
+
children: /* @__PURE__ */ s(
|
|
182
|
+
"div",
|
|
183
|
+
{
|
|
184
|
+
...y,
|
|
185
|
+
ref: (x) => {
|
|
186
|
+
m !== null && (typeof m == "function" ? m(x) : m.current = x);
|
|
187
|
+
},
|
|
188
|
+
children: I === void 0 ? /* @__PURE__ */ s(X, {}) : /* @__PURE__ */ D(F, { children: [
|
|
189
|
+
A,
|
|
190
|
+
/* @__PURE__ */ s(
|
|
191
|
+
Z,
|
|
192
|
+
{
|
|
193
|
+
title: y.title,
|
|
194
|
+
autoplay: a,
|
|
195
|
+
videoUrl: I,
|
|
196
|
+
previewImageUrl: P,
|
|
197
|
+
loading: t,
|
|
198
|
+
showPreview: M,
|
|
199
|
+
renderer: C,
|
|
200
|
+
status: w,
|
|
201
|
+
onStatusChange: g,
|
|
202
|
+
onPreviewImageUrlChange: B
|
|
203
|
+
}
|
|
204
|
+
)
|
|
205
|
+
] })
|
|
206
|
+
}
|
|
207
|
+
)
|
|
208
|
+
}
|
|
209
|
+
);
|
|
210
|
+
}
|
|
211
|
+
);
|
|
212
|
+
et.displayName = "Vimeo";
|
|
213
|
+
export {
|
|
214
|
+
et as Vimeo,
|
|
215
|
+
tt as VimeoContext
|
|
216
|
+
};
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { jsxs as i, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { SpinnerIcon as r, PlayIcon as n } 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: center;
|
|
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: n })
|
|
83
|
+
}
|
|
84
|
+
)
|
|
85
|
+
}
|
|
86
|
+
)
|
|
87
|
+
]
|
|
88
|
+
}
|
|
89
|
+
)
|
|
90
|
+
};
|
|
91
|
+
export {
|
|
92
|
+
p as meta
|
|
93
|
+
};
|
package/lib/vimeo.ws.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { VimeoIcon as o } from "@webstudio-is/icons/svg";
|
|
2
|
+
import { defaultStates as t } from "@webstudio-is/sdk";
|
|
3
|
+
import { div as r } from "@webstudio-is/sdk/normalize.css";
|
|
4
|
+
import { props as i } from "./__generated__/vimeo.props.js";
|
|
5
|
+
const n = {
|
|
6
|
+
div: r
|
|
7
|
+
}, c = {
|
|
8
|
+
type: "container",
|
|
9
|
+
icon: o,
|
|
10
|
+
states: t,
|
|
11
|
+
presetStyle: n,
|
|
12
|
+
constraints: {
|
|
13
|
+
relation: "ancestor",
|
|
14
|
+
component: { $nin: ["Button", "Link", "Heading"] }
|
|
15
|
+
}
|
|
16
|
+
}, e = [
|
|
17
|
+
"id",
|
|
18
|
+
"className",
|
|
19
|
+
"url",
|
|
20
|
+
"title",
|
|
21
|
+
"quality",
|
|
22
|
+
"loading",
|
|
23
|
+
"showPreview",
|
|
24
|
+
"autoplay",
|
|
25
|
+
"doNotTrack",
|
|
26
|
+
"loop",
|
|
27
|
+
"muted",
|
|
28
|
+
"showPortrait",
|
|
29
|
+
"showByline",
|
|
30
|
+
"showTitle",
|
|
31
|
+
"showControls",
|
|
32
|
+
"controlsColor"
|
|
33
|
+
], m = {
|
|
34
|
+
props: i,
|
|
35
|
+
initialProps: e
|
|
36
|
+
};
|
|
37
|
+
export {
|
|
38
|
+
c as meta,
|
|
39
|
+
m as propsMeta
|
|
40
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as e } from "react";
|
|
3
|
+
const i = e(
|
|
4
|
+
({ children: o, state: a = "initial", ...r }, m) => /* @__PURE__ */ t("form", { ...r, ref: m, children: o })
|
|
5
|
+
);
|
|
6
|
+
i.displayName = "WebhookForm";
|
|
7
|
+
export {
|
|
8
|
+
i as WebhookForm
|
|
9
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { jsxs as r, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { Variable as s, $ as e, expression as o, ActionValue as i, PlaceholderValue as a } from "@webstudio-is/template";
|
|
3
|
+
const n = new s("formState", "initial"), w = {
|
|
4
|
+
category: "data",
|
|
5
|
+
order: 1,
|
|
6
|
+
description: "Collect user data and send it to any webhook.",
|
|
7
|
+
template: /* @__PURE__ */ r(
|
|
8
|
+
e.Form,
|
|
9
|
+
{
|
|
10
|
+
state: o`${n}`,
|
|
11
|
+
onStateChange: new i(["state"], o`${n} = state`),
|
|
12
|
+
children: [
|
|
13
|
+
/* @__PURE__ */ r(
|
|
14
|
+
e.Box,
|
|
15
|
+
{
|
|
16
|
+
"ws:label": "Form Content",
|
|
17
|
+
"ws:show": o`${n} === 'initial' || ${n} === 'error'`,
|
|
18
|
+
children: [
|
|
19
|
+
/* @__PURE__ */ t(e.Label, { children: new a("Name") }),
|
|
20
|
+
/* @__PURE__ */ t(e.Input, { name: "name" }),
|
|
21
|
+
/* @__PURE__ */ t(e.Label, { children: new a("Email") }),
|
|
22
|
+
/* @__PURE__ */ t(e.Input, { name: "email" }),
|
|
23
|
+
/* @__PURE__ */ t(e.Button, { children: new a("Submit") })
|
|
24
|
+
]
|
|
25
|
+
}
|
|
26
|
+
),
|
|
27
|
+
/* @__PURE__ */ t(
|
|
28
|
+
e.Box,
|
|
29
|
+
{
|
|
30
|
+
"ws:label": "Success Message",
|
|
31
|
+
"ws:show": o`${n} === 'success'`,
|
|
32
|
+
children: new a("Thank you for getting in touch!")
|
|
33
|
+
}
|
|
34
|
+
),
|
|
35
|
+
/* @__PURE__ */ t(
|
|
36
|
+
e.Box,
|
|
37
|
+
{
|
|
38
|
+
"ws:label": "Error Message",
|
|
39
|
+
"ws:show": o`${n} === 'error'`,
|
|
40
|
+
children: new a("Sorry, something went wrong.")
|
|
41
|
+
}
|
|
42
|
+
)
|
|
43
|
+
]
|
|
44
|
+
}
|
|
45
|
+
)
|
|
46
|
+
};
|
|
47
|
+
export {
|
|
48
|
+
w as meta
|
|
49
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { WebhookFormIcon as o } from "@webstudio-is/icons/svg";
|
|
2
|
+
import { form as t } from "@webstudio-is/sdk/normalize.css";
|
|
3
|
+
import { props as e } from "./__generated__/webhook-form.props.js";
|
|
4
|
+
const n = {
|
|
5
|
+
label: "Webhook Form",
|
|
6
|
+
icon: o,
|
|
7
|
+
type: "container",
|
|
8
|
+
constraints: {
|
|
9
|
+
relation: "ancestor",
|
|
10
|
+
component: { $nin: ["Form", "Button", "Link"] }
|
|
11
|
+
},
|
|
12
|
+
presetStyle: {
|
|
13
|
+
form: t
|
|
14
|
+
},
|
|
15
|
+
states: [
|
|
16
|
+
{ selector: "[data-state=error]", label: "Error" },
|
|
17
|
+
{ selector: "[data-state=success]", label: "Success" }
|
|
18
|
+
]
|
|
19
|
+
}, c = {
|
|
20
|
+
props: e,
|
|
21
|
+
initialProps: ["id", "className", "state", "action"]
|
|
22
|
+
};
|
|
23
|
+
export {
|
|
24
|
+
n as meta,
|
|
25
|
+
c as propsMeta
|
|
26
|
+
};
|
package/lib/xml-node.js
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { jsxs as t, jsx as r, Fragment as u } from "react/jsx-runtime";
|
|
2
|
+
import { ReactSdkContext as g, xmlNodeTagSuffix as x } from "@webstudio-is/react-sdk/runtime";
|
|
3
|
+
import { forwardRef as b, useContext as N, createElement as C, Children as F } from "react";
|
|
4
|
+
const j = b(
|
|
5
|
+
({ tag: c = "", children: l, ...i }, d) => {
|
|
6
|
+
const { renderer: p } = N(g), o = Object.entries(i).filter(
|
|
7
|
+
([e]) => e.startsWith("data-") === !1 && e.startsWith("aria-") === !1
|
|
8
|
+
).filter(([e]) => e.toLowerCase() !== "tabindex").filter(([, e]) => typeof e != "function"), s = c.replace(/^[^\p{L}_]+/u, "").replaceAll(/[^\p{L}\p{N}\-._:]+/gu, "").trim();
|
|
9
|
+
if (p === void 0) {
|
|
10
|
+
const e = Object.fromEntries(o);
|
|
11
|
+
return C(
|
|
12
|
+
`${s}${x}`,
|
|
13
|
+
e,
|
|
14
|
+
l
|
|
15
|
+
);
|
|
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__ */ t("span", { children: [
|
|
18
|
+
" ",
|
|
19
|
+
/* @__PURE__ */ r("span", { style: { color: "#FF0000" }, children: f }),
|
|
20
|
+
/* @__PURE__ */ r("span", { style: { color: "#000000" }, children: "=" }),
|
|
21
|
+
/* @__PURE__ */ t("span", { style: { color: "#0000FF" }, children: [
|
|
22
|
+
'"',
|
|
23
|
+
h,
|
|
24
|
+
'"'
|
|
25
|
+
] })
|
|
26
|
+
] }, y));
|
|
27
|
+
return /* @__PURE__ */ t("div", { ...i, children: [
|
|
28
|
+
/* @__PURE__ */ t("span", { children: [
|
|
29
|
+
/* @__PURE__ */ t("span", { style: { color: "#800000" }, children: [
|
|
30
|
+
"<",
|
|
31
|
+
s
|
|
32
|
+
] }),
|
|
33
|
+
o.length > 0 && m(o),
|
|
34
|
+
n.length === 0 ? /* @__PURE__ */ r("span", { style: { color: "#800000" }, children: "/>" }) : /* @__PURE__ */ r("span", { style: { color: "#800000" }, children: ">" })
|
|
35
|
+
] }),
|
|
36
|
+
n.length > 0 && /* @__PURE__ */ t(u, { children: [
|
|
37
|
+
/* @__PURE__ */ r(
|
|
38
|
+
"div",
|
|
39
|
+
{
|
|
40
|
+
ref: d,
|
|
41
|
+
style: {
|
|
42
|
+
display: a ? "inline" : "block",
|
|
43
|
+
marginLeft: a ? 0 : "1rem"
|
|
44
|
+
},
|
|
45
|
+
children: l
|
|
46
|
+
}
|
|
47
|
+
),
|
|
48
|
+
/* @__PURE__ */ t("span", { style: { color: "#800000" }, children: [
|
|
49
|
+
"</",
|
|
50
|
+
s,
|
|
51
|
+
">"
|
|
52
|
+
] })
|
|
53
|
+
] })
|
|
54
|
+
] });
|
|
55
|
+
}
|
|
56
|
+
);
|
|
57
|
+
j.displayName = "XmlNode";
|
|
58
|
+
export {
|
|
59
|
+
j as XmlNode
|
|
60
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { XmlIcon as o } from "@webstudio-is/icons/svg";
|
|
2
|
+
import { props as r } from "./__generated__/xml-node.props.js";
|
|
3
|
+
const e = {
|
|
4
|
+
category: "xml",
|
|
5
|
+
order: 6,
|
|
6
|
+
type: "container",
|
|
7
|
+
icon: o,
|
|
8
|
+
description: "XML Node"
|
|
9
|
+
}, i = {
|
|
10
|
+
props: r,
|
|
11
|
+
initialProps: ["tag"]
|
|
12
|
+
};
|
|
13
|
+
export {
|
|
14
|
+
e as meta,
|
|
15
|
+
i as propsMeta
|
|
16
|
+
};
|
package/lib/xml-time.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { jsx as f } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as m, useContext as a } from "react";
|
|
3
|
+
import { ReactSdkContext as T } from "@webstudio-is/react-sdk/runtime";
|
|
4
|
+
const l = "short", u = "dateTime attribute is not set", N = "", c = (e) => {
|
|
5
|
+
if (e === "")
|
|
6
|
+
return;
|
|
7
|
+
let t = new Date(e);
|
|
8
|
+
if (Number.isNaN(t.getTime()) === !1)
|
|
9
|
+
return t;
|
|
10
|
+
if (/^\d+$/.test(e)) {
|
|
11
|
+
let o = Number(e);
|
|
12
|
+
e.length === 10 && (o *= 1e3), t = new Date(o);
|
|
13
|
+
}
|
|
14
|
+
if (Number.isNaN(t.getTime()) === !1)
|
|
15
|
+
return t;
|
|
16
|
+
}, d = m(
|
|
17
|
+
({ dateStyle: e = l, datetime: t = u }, o) => {
|
|
18
|
+
const { renderer: i } = a(T), s = t === null ? N : t.toString(), n = c(s);
|
|
19
|
+
let r = s;
|
|
20
|
+
return n && (r = n.toISOString(), e === "short" && (r = r.split("T")[0])), i === void 0 ? r : /* @__PURE__ */ f("time", { ref: o, children: r });
|
|
21
|
+
}
|
|
22
|
+
);
|
|
23
|
+
export {
|
|
24
|
+
d as XmlTime
|
|
25
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { CalendarIcon as t } from "@webstudio-is/icons/svg";
|
|
2
|
+
import { props as e } from "./__generated__/xml-time.props.js";
|
|
3
|
+
const a = {
|
|
4
|
+
category: "xml",
|
|
5
|
+
type: "container",
|
|
6
|
+
description: "Converts machine-readable date and time to ISO format.",
|
|
7
|
+
icon: t,
|
|
8
|
+
order: 7
|
|
9
|
+
}, i = {
|
|
10
|
+
props: e,
|
|
11
|
+
initialProps: ["datetime", "dateStyle"]
|
|
12
|
+
};
|
|
13
|
+
export {
|
|
14
|
+
a as meta,
|
|
15
|
+
i as propsMeta
|
|
16
|
+
};
|