@webstudio-is/sdk-components-react 0.0.0-017f1bd
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 +4 -0
- package/lib/__generated__/body.props.js +4 -0
- package/lib/__generated__/bold.props.js +4 -0
- package/lib/__generated__/box.props.js +6 -0
- package/lib/__generated__/button.props.js +4 -0
- package/lib/__generated__/checkbox.props.js +11 -0
- package/lib/__generated__/code-text.props.js +6 -0
- package/lib/__generated__/form.props.js +4 -0
- package/lib/__generated__/head-link.props.js +4 -0
- package/lib/__generated__/head-meta.props.js +4 -0
- package/lib/__generated__/head-slot.props.js +4 -0
- package/lib/__generated__/head-title.props.js +4 -0
- package/lib/__generated__/heading.props.js +6 -0
- package/lib/__generated__/html-embed.props.js +18 -0
- package/lib/__generated__/image.props.js +13 -0
- package/lib/__generated__/input.props.js +4 -0
- package/lib/__generated__/italic.props.js +4 -0
- package/lib/__generated__/label.props.js +4 -0
- package/lib/__generated__/link.props.js +27 -0
- package/lib/__generated__/list-item.props.js +4 -0
- package/lib/__generated__/list.props.js +12 -0
- package/lib/__generated__/markdown-embed.props.js +6 -0
- package/lib/__generated__/option.props.js +4 -0
- package/lib/__generated__/paragraph.props.js +4 -0
- package/lib/__generated__/radio-button.props.js +11 -0
- package/lib/__generated__/select.props.js +4 -0
- package/lib/__generated__/separator.props.js +4 -0
- package/lib/__generated__/span.props.js +4 -0
- package/lib/__generated__/subscript.props.js +4 -0
- package/lib/__generated__/superscript.props.js +4 -0
- package/lib/__generated__/text.props.js +6 -0
- package/lib/__generated__/textarea.props.js +4 -0
- package/lib/__generated__/time.props.js +305 -0
- package/lib/__generated__/video.props.js +4 -0
- package/lib/__generated__/vimeo-play-button.props.js +4 -0
- package/lib/__generated__/vimeo-preview-image.props.js +12 -0
- package/lib/__generated__/vimeo-spinner.props.js +4 -0
- package/lib/__generated__/vimeo.props.js +170 -0
- package/lib/__generated__/webhook-form.props.js +13 -0
- package/lib/__generated__/xml-node.props.js +26 -0
- package/lib/__generated__/xml-time.props.js +19 -0
- package/lib/__generated__/youtube.props.js +168 -0
- package/lib/blockquote.js +9 -0
- package/lib/blockquote.ws.js +56 -0
- package/lib/body.js +7 -0
- package/lib/body.ws.js +10 -0
- package/lib/bold.js +7 -0
- package/lib/bold.ws.js +11 -0
- package/lib/box.js +12 -0
- package/lib/box.ws.js +41 -0
- package/lib/button.js +9 -0
- package/lib/button.ws.js +10 -0
- package/lib/checkbox.js +15 -0
- package/lib/checkbox.ws.js +20 -0
- package/lib/code-text.js +10 -0
- package/lib/code-text.ws.js +51 -0
- package/lib/components.js +91 -0
- package/lib/content-embed.template.js +83 -0
- package/lib/form.js +7 -0
- package/lib/form.ws.js +16 -0
- package/lib/fragment.js +7 -0
- package/lib/fragment.ws.js +4 -0
- package/lib/head-link.js +23 -0
- package/lib/head-link.ws.js +14 -0
- package/lib/head-meta.js +23 -0
- package/lib/head-meta.ws.js +14 -0
- package/lib/head-slot.js +53 -0
- package/lib/head-slot.template.js +15 -0
- package/lib/head-slot.ws.js +14 -0
- package/lib/head-title.js +23 -0
- package/lib/head-title.ws.js +13 -0
- package/lib/heading.js +12 -0
- package/lib/heading.ws.js +25 -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 +48 -0
- package/lib/image.js +38 -0
- package/lib/image.ws.js +53 -0
- package/lib/input.js +21 -0
- package/lib/input.ws.js +28 -0
- package/lib/italic.js +7 -0
- package/lib/italic.ws.js +11 -0
- package/lib/label.js +7 -0
- package/lib/label.ws.js +16 -0
- package/lib/link.js +15 -0
- package/lib/link.ws.js +26 -0
- package/lib/list-item.js +9 -0
- package/lib/list-item.ws.js +10 -0
- package/lib/list.js +6 -0
- package/lib/list.ws.js +41 -0
- package/lib/markdown-embed.js +19 -0
- package/lib/markdown-embed.template.js +75 -0
- package/lib/markdown-embed.ws.js +35 -0
- package/lib/metas.js +92 -0
- package/lib/option.js +9 -0
- package/lib/option.ws.js +35 -0
- package/lib/paragraph.js +7 -0
- package/lib/paragraph.ws.js +10 -0
- package/lib/radio-button.js +15 -0
- package/lib/radio-button.ws.js +21 -0
- package/lib/rich-text-link.ws.js +5 -0
- package/lib/select.js +32 -0
- package/lib/select.ws.js +26 -0
- package/lib/separator.js +9 -0
- package/lib/separator.ws.js +38 -0
- package/lib/shared/video.js +13 -0
- package/lib/slot.js +14 -0
- package/lib/slot.ws.js +10 -0
- package/lib/span.js +7 -0
- package/lib/span.ws.js +13 -0
- package/lib/subscript.js +7 -0
- package/lib/subscript.ws.js +11 -0
- package/lib/superscript.js +7 -0
- package/lib/superscript.ws.js +11 -0
- package/lib/templates.js +14 -0
- package/lib/text.js +12 -0
- package/lib/text.ws.js +28 -0
- package/lib/textarea.js +18 -0
- package/lib/textarea.ws.js +33 -0
- package/lib/time.js +320 -0
- package/lib/time.ws.js +18 -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__/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__/video.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.ws.d.ts +2 -0
- package/lib/types/body.d.ts +2 -0
- package/lib/types/body.ws.d.ts +2 -0
- package/lib/types/bold.d.ts +2 -0
- package/lib/types/bold.ws.d.ts +2 -0
- package/lib/types/box.d.ts +7 -0
- package/lib/types/box.ws.d.ts +2 -0
- package/lib/types/button.d.ts +2 -0
- package/lib/types/button.ws.d.ts +2 -0
- package/lib/types/checkbox.d.ts +4 -0
- package/lib/types/checkbox.ws.d.ts +2 -0
- package/lib/types/code-text.d.ts +4 -0
- package/lib/types/code-text.ws.d.ts +2 -0
- package/lib/types/components.d.ts +45 -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 +2 -0
- package/lib/types/fragment.d.ts +6 -0
- package/lib/types/fragment.ws.d.ts +2 -0
- package/lib/types/head-link.d.ts +8 -0
- package/lib/types/head-link.ws.d.ts +2 -0
- package/lib/types/head-meta.d.ts +2 -0
- package/lib/types/head-meta.ws.d.ts +2 -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 +2 -0
- package/lib/types/head-title.d.ts +2 -0
- package/lib/types/head-title.ws.d.ts +2 -0
- package/lib/types/heading.d.ts +7 -0
- package/lib/types/heading.ws.d.ts +2 -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 +2 -0
- package/lib/types/image.d.ts +8 -0
- package/lib/types/image.ws.d.ts +2 -0
- package/lib/types/input.d.ts +1 -0
- package/lib/types/input.ws.d.ts +2 -0
- package/lib/types/italic.d.ts +2 -0
- package/lib/types/italic.ws.d.ts +2 -0
- package/lib/types/label.d.ts +2 -0
- package/lib/types/label.ws.d.ts +2 -0
- package/lib/types/link.d.ts +11 -0
- package/lib/types/link.ws.d.ts +2 -0
- package/lib/types/list-item.d.ts +2 -0
- package/lib/types/list-item.ws.d.ts +2 -0
- package/lib/types/list.d.ts +10 -0
- package/lib/types/list.ws.d.ts +2 -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 +2 -0
- package/lib/types/metas.d.ts +45 -0
- package/lib/types/option.d.ts +1 -0
- package/lib/types/option.ws.d.ts +2 -0
- package/lib/types/paragraph.d.ts +2 -0
- package/lib/types/paragraph.ws.d.ts +2 -0
- package/lib/types/radio-button.d.ts +4 -0
- package/lib/types/radio-button.ws.d.ts +2 -0
- package/lib/types/rich-text-link.d.ts +1 -0
- package/lib/types/rich-text-link.ws.d.ts +2 -0
- package/lib/types/select.d.ts +3 -0
- package/lib/types/select.ws.d.ts +2 -0
- package/lib/types/separator.d.ts +2 -0
- package/lib/types/separator.ws.d.ts +2 -0
- package/lib/types/shared/video.d.ts +7 -0
- package/lib/types/slot.d.ts +6 -0
- package/lib/types/slot.ws.d.ts +2 -0
- package/lib/types/span.d.ts +2 -0
- package/lib/types/span.ws.d.ts +2 -0
- package/lib/types/subscript.d.ts +2 -0
- package/lib/types/subscript.ws.d.ts +2 -0
- package/lib/types/superscript.d.ts +2 -0
- package/lib/types/superscript.ws.d.ts +2 -0
- package/lib/types/templates.d.ts +6 -0
- package/lib/types/test-utils/cartesian.d.ts +2 -0
- package/lib/types/text.d.ts +7 -0
- package/lib/types/text.ws.d.ts +2 -0
- package/lib/types/textarea.d.ts +1 -0
- package/lib/types/textarea.ws.d.ts +2 -0
- package/lib/types/time.d.ts +16 -0
- package/lib/types/time.test.d.ts +1 -0
- package/lib/types/time.ws.d.ts +2 -0
- package/lib/types/video.d.ts +9 -0
- package/lib/types/video.ws.d.ts +2 -0
- package/lib/types/vimeo-play-button.d.ts +3 -0
- package/lib/types/vimeo-play-button.ws.d.ts +2 -0
- package/lib/types/vimeo-preview-image.d.ts +284 -0
- package/lib/types/vimeo-preview-image.ws.d.ts +2 -0
- package/lib/types/vimeo-spinner.d.ts +1 -0
- package/lib/types/vimeo-spinner.ws.d.ts +2 -0
- package/lib/types/vimeo.d.ts +79 -0
- package/lib/types/vimeo.template.d.ts +2 -0
- package/lib/types/vimeo.ws.d.ts +2 -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 +2 -0
- package/lib/types/xml-node.d.ts +13 -0
- package/lib/types/xml-node.ws.d.ts +2 -0
- package/lib/types/xml-time.d.ts +6 -0
- package/lib/types/xml-time.ws.d.ts +2 -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 +2 -0
- package/lib/video.js +53 -0
- package/lib/video.ws.js +44 -0
- package/lib/vimeo-play-button.js +18 -0
- package/lib/vimeo-play-button.ws.js +18 -0
- package/lib/vimeo-preview-image.js +19 -0
- package/lib/vimeo-preview-image.ws.js +25 -0
- package/lib/vimeo-spinner.js +13 -0
- package/lib/vimeo-spinner.ws.js +18 -0
- package/lib/vimeo.js +215 -0
- package/lib/vimeo.template.js +94 -0
- package/lib/vimeo.ws.js +35 -0
- package/lib/webhook-form.js +9 -0
- package/lib/webhook-form.template.js +88 -0
- package/lib/webhook-form.ws.js +27 -0
- package/lib/xml-node.js +61 -0
- package/lib/xml-node.ws.js +13 -0
- package/lib/xml-time.js +25 -0
- package/lib/xml-time.ws.js +13 -0
- package/lib/youtube.js +227 -0
- package/lib/youtube.template.js +98 -0
- package/lib/youtube.ws.js +45 -0
- package/package.json +74 -0
package/lib/image.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { jsx as g } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as l, useContext as u } from "react";
|
|
3
|
+
import { Image as v } from "@webstudio-is/image";
|
|
4
|
+
import { ReactSdkContext as x } from "@webstudio-is/react-sdk/runtime";
|
|
5
|
+
const y = l(
|
|
6
|
+
({
|
|
7
|
+
loading: a = "lazy",
|
|
8
|
+
width: e,
|
|
9
|
+
height: r,
|
|
10
|
+
optimize: m = !0,
|
|
11
|
+
decoding: c,
|
|
12
|
+
// @todo: it's a hack made for the builder and should't be in the runtime at all.
|
|
13
|
+
$webstudio$canvasOnly$assetId: d,
|
|
14
|
+
...s
|
|
15
|
+
}, f) => {
|
|
16
|
+
const o = String(s.src ?? ""), { imageLoader: i, renderer: N } = u(x);
|
|
17
|
+
let n = c, t = o;
|
|
18
|
+
return N === "canvas" && (a = "eager", n = "sync", t = d ?? o, e !== void 0 && r !== void 0 && Number.isNaN(e) && Number.isNaN(r) && (m = !1, e = void 0, r = void 0)), /* @__PURE__ */ g(
|
|
19
|
+
v,
|
|
20
|
+
{
|
|
21
|
+
loading: a,
|
|
22
|
+
decoding: n,
|
|
23
|
+
optimize: m,
|
|
24
|
+
width: e,
|
|
25
|
+
height: r,
|
|
26
|
+
...s,
|
|
27
|
+
loader: i,
|
|
28
|
+
src: o,
|
|
29
|
+
ref: f
|
|
30
|
+
},
|
|
31
|
+
t
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
);
|
|
35
|
+
y.displayName = "Image";
|
|
36
|
+
export {
|
|
37
|
+
y as Image
|
|
38
|
+
};
|
package/lib/image.ws.js
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { img as e } from "@webstudio-is/sdk/normalize.css";
|
|
2
|
+
import { props as t } from "./__generated__/image.props.js";
|
|
3
|
+
const o = {
|
|
4
|
+
img: [
|
|
5
|
+
...e,
|
|
6
|
+
// Otherwise on new image insert onto canvas it can overfit screen size multiple times
|
|
7
|
+
{
|
|
8
|
+
property: "max-width",
|
|
9
|
+
value: { type: "unit", unit: "%", value: 100 }
|
|
10
|
+
},
|
|
11
|
+
// inline | inline-block is not suitable because without line-height: 0 on the parent you get unsuitable spaces/margins
|
|
12
|
+
// see https://stackoverflow.com/questions/24771194/is-the-margin-of-inline-block-4px-is-static-for-all-browsers
|
|
13
|
+
{
|
|
14
|
+
property: "display",
|
|
15
|
+
value: { type: "keyword", value: "block" }
|
|
16
|
+
},
|
|
17
|
+
// Set image height to "auto" to reduce layout shift, improving compatibility across browsers like Safari.
|
|
18
|
+
// Unlike "fit-content," "auto" preserves the aspect ratio when the width exceeds max-width. (in Safari)
|
|
19
|
+
// See https://web.dev/articles/optimize-cls#best_practice_for_setting_image_dimensions
|
|
20
|
+
{
|
|
21
|
+
property: "height",
|
|
22
|
+
value: { type: "keyword", value: "auto" }
|
|
23
|
+
}
|
|
24
|
+
]
|
|
25
|
+
}, i = {
|
|
26
|
+
category: "media",
|
|
27
|
+
description: "Add an image asset to the page. Webstudio automatically converts images to WebP or AVIF format and makes them responsive for best performance.",
|
|
28
|
+
presetStyle: o,
|
|
29
|
+
order: 0,
|
|
30
|
+
initialProps: [
|
|
31
|
+
"id",
|
|
32
|
+
"class",
|
|
33
|
+
"src",
|
|
34
|
+
"width",
|
|
35
|
+
"height",
|
|
36
|
+
"alt",
|
|
37
|
+
"loading",
|
|
38
|
+
"optimize"
|
|
39
|
+
],
|
|
40
|
+
props: {
|
|
41
|
+
...t,
|
|
42
|
+
// Automatically generated props don't have the right control.
|
|
43
|
+
src: {
|
|
44
|
+
type: "string",
|
|
45
|
+
control: "file",
|
|
46
|
+
label: "Source",
|
|
47
|
+
required: !1
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
export {
|
|
52
|
+
i as meta
|
|
53
|
+
};
|
package/lib/input.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { forwardRef as m, useContext as s, createElement as c } from "react";
|
|
2
|
+
import { ReactSdkContext as d } from "@webstudio-is/react-sdk/runtime";
|
|
3
|
+
const f = m(
|
|
4
|
+
({ value: t, defaultValue: r, checked: n, defaultChecked: e, ...o }, i) => {
|
|
5
|
+
const { renderer: p } = s(d), a = p === "canvas" ? String(t ?? r) + String(n ?? e) : void 0;
|
|
6
|
+
return /* @__PURE__ */ c(
|
|
7
|
+
"input",
|
|
8
|
+
{
|
|
9
|
+
...o,
|
|
10
|
+
key: a,
|
|
11
|
+
defaultValue: t ?? r,
|
|
12
|
+
defaultChecked: n ?? e,
|
|
13
|
+
ref: i
|
|
14
|
+
}
|
|
15
|
+
);
|
|
16
|
+
}
|
|
17
|
+
);
|
|
18
|
+
f.displayName = "Input";
|
|
19
|
+
export {
|
|
20
|
+
f as Input
|
|
21
|
+
};
|
package/lib/input.ws.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { input as e } from "@webstudio-is/sdk/normalize.css";
|
|
2
|
+
import { props as t } from "./__generated__/input.props.js";
|
|
3
|
+
const p = {
|
|
4
|
+
input: [
|
|
5
|
+
...e,
|
|
6
|
+
{
|
|
7
|
+
property: "display",
|
|
8
|
+
value: { type: "keyword", value: "block" }
|
|
9
|
+
}
|
|
10
|
+
]
|
|
11
|
+
}, l = {
|
|
12
|
+
label: "Text Input",
|
|
13
|
+
presetStyle: p,
|
|
14
|
+
initialProps: [
|
|
15
|
+
"id",
|
|
16
|
+
"class",
|
|
17
|
+
"name",
|
|
18
|
+
"value",
|
|
19
|
+
"type",
|
|
20
|
+
"placeholder",
|
|
21
|
+
"required",
|
|
22
|
+
"autofocus"
|
|
23
|
+
],
|
|
24
|
+
props: t
|
|
25
|
+
};
|
|
26
|
+
export {
|
|
27
|
+
l as meta
|
|
28
|
+
};
|
package/lib/italic.js
ADDED
package/lib/italic.ws.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { i as t } from "@webstudio-is/sdk/normalize.css";
|
|
2
|
+
import { props as i } from "./__generated__/italic.props.js";
|
|
3
|
+
const e = {
|
|
4
|
+
label: "Italic Text",
|
|
5
|
+
presetStyle: { i: t },
|
|
6
|
+
initialProps: ["id", "class"],
|
|
7
|
+
props: i
|
|
8
|
+
};
|
|
9
|
+
export {
|
|
10
|
+
e as meta
|
|
11
|
+
};
|
package/lib/label.js
ADDED
package/lib/label.ws.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { label as e } from "@webstudio-is/sdk/normalize.css";
|
|
2
|
+
import { props as l } from "./__generated__/label.props.js";
|
|
3
|
+
const o = {
|
|
4
|
+
label: [
|
|
5
|
+
...e,
|
|
6
|
+
{ property: "display", value: { type: "keyword", value: "block" } }
|
|
7
|
+
]
|
|
8
|
+
}, t = {
|
|
9
|
+
label: "Input Label",
|
|
10
|
+
presetStyle: o,
|
|
11
|
+
initialProps: ["id", "class", "for"],
|
|
12
|
+
props: l
|
|
13
|
+
};
|
|
14
|
+
export {
|
|
15
|
+
t as meta
|
|
16
|
+
};
|
package/lib/link.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as n } from "react";
|
|
3
|
+
const a = n((e, o) => {
|
|
4
|
+
const {
|
|
5
|
+
children: s,
|
|
6
|
+
// @todo: it's a hack made for Image component for the builder and should't be in the runtime at all.
|
|
7
|
+
$webstudio$canvasOnly$assetId: i,
|
|
8
|
+
...r
|
|
9
|
+
} = e;
|
|
10
|
+
return /* @__PURE__ */ t("a", { ...r, href: r.href ?? "#", ref: o, children: s });
|
|
11
|
+
});
|
|
12
|
+
a.displayName = "Link";
|
|
13
|
+
export {
|
|
14
|
+
a as Link
|
|
15
|
+
};
|
package/lib/link.ws.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { a as e } from "@webstudio-is/sdk/normalize.css";
|
|
2
|
+
import { props as r } from "./__generated__/link.props.js";
|
|
3
|
+
const t = {
|
|
4
|
+
a: [
|
|
5
|
+
...e,
|
|
6
|
+
{
|
|
7
|
+
property: "display",
|
|
8
|
+
value: { type: "keyword", value: "inline-block" }
|
|
9
|
+
}
|
|
10
|
+
]
|
|
11
|
+
}, p = {
|
|
12
|
+
presetStyle: t,
|
|
13
|
+
states: [{ label: "Current page", selector: "[aria-current=page]" }],
|
|
14
|
+
initialProps: ["id", "class", "href", "target", "prefetch", "download"],
|
|
15
|
+
props: {
|
|
16
|
+
...r,
|
|
17
|
+
href: {
|
|
18
|
+
type: "string",
|
|
19
|
+
control: "url",
|
|
20
|
+
required: !1
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
export {
|
|
25
|
+
p as meta
|
|
26
|
+
};
|
package/lib/list-item.js
ADDED
package/lib/list.js
ADDED
package/lib/list.ws.js
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { ul as e, ol as r } from "@webstudio-is/sdk/normalize.css";
|
|
2
|
+
import { props as p } from "./__generated__/list.props.js";
|
|
3
|
+
const t = {
|
|
4
|
+
ol: [
|
|
5
|
+
...r,
|
|
6
|
+
{
|
|
7
|
+
property: "margin-top",
|
|
8
|
+
value: { type: "keyword", value: "0" }
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
property: "margin-bottom",
|
|
12
|
+
value: { type: "keyword", value: "10px" }
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
property: "padding-left",
|
|
16
|
+
value: { type: "keyword", value: "40px" }
|
|
17
|
+
}
|
|
18
|
+
],
|
|
19
|
+
ul: [
|
|
20
|
+
...e,
|
|
21
|
+
{
|
|
22
|
+
property: "margin-top",
|
|
23
|
+
value: { type: "keyword", value: "0" }
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
property: "margin-bottom",
|
|
27
|
+
value: { type: "keyword", value: "10px" }
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
property: "padding-left",
|
|
31
|
+
value: { type: "keyword", value: "40px" }
|
|
32
|
+
}
|
|
33
|
+
]
|
|
34
|
+
}, l = {
|
|
35
|
+
presetStyle: t,
|
|
36
|
+
initialProps: ["id", "class", "ordered", "start", "reversed"],
|
|
37
|
+
props: p
|
|
38
|
+
};
|
|
39
|
+
export {
|
|
40
|
+
l as meta
|
|
41
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { micromark as s } from "micromark";
|
|
3
|
+
import { gfmTableHtml as l, gfmTable as i } from "micromark-extension-gfm-table";
|
|
4
|
+
import { forwardRef as a, useMemo as f } from "react";
|
|
5
|
+
const h = /* @__PURE__ */ a((r, e) => {
|
|
6
|
+
const { code: o, children: c, ...t } = r, m = f(
|
|
7
|
+
// support data uri protocol in images
|
|
8
|
+
() => s(o ?? "", {
|
|
9
|
+
allowDangerousProtocol: !0,
|
|
10
|
+
extensions: [i()],
|
|
11
|
+
htmlExtensions: [l()]
|
|
12
|
+
}),
|
|
13
|
+
[o]
|
|
14
|
+
);
|
|
15
|
+
return /* @__PURE__ */ n("div", { ...t, ref: e, dangerouslySetInnerHTML: { __html: m } });
|
|
16
|
+
});
|
|
17
|
+
export {
|
|
18
|
+
h as MarkdownEmbed
|
|
19
|
+
};
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { jsxs as t, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { $ as a, ws as l } from "@webstudio-is/template";
|
|
3
|
+
import { imagePlaceholderDataUrl as s } from "@webstudio-is/image";
|
|
4
|
+
const n = `
|
|
5
|
+
# Styling Markdown with Markdown Embed
|
|
6
|
+
|
|
7
|
+
Markdown Embed allows styling of Markdown, which primarily comes from external data.
|
|
8
|
+
|
|
9
|
+
## How to Use Markdown Embed
|
|
10
|
+
|
|
11
|
+
- Every element is shown in the Navigator.
|
|
12
|
+
- Apply styles and Tokens to each element.
|
|
13
|
+
- Adjustments to elements apply universally within this embed, ensuring consistency across your content.
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## This sample text contains all the elements that can be styled.
|
|
18
|
+
|
|
19
|
+
Any elements that were not used above are used below.
|
|
20
|
+
|
|
21
|
+
### Heading 3
|
|
22
|
+
#### Heading 4
|
|
23
|
+
##### Heading 5
|
|
24
|
+
###### Heading 6
|
|
25
|
+
|
|
26
|
+
[Links](#) connect your content to relevant resources.
|
|
27
|
+
|
|
28
|
+
**Bold text** makes your important points stand out.
|
|
29
|
+
|
|
30
|
+
*Italic text* is great for emphasizing terms.
|
|
31
|
+
|
|
32
|
+
1. First Step
|
|
33
|
+
2. Second Step
|
|
34
|
+
|
|
35
|
+

|
|
36
|
+
|
|
37
|
+
> Capture attention with a powerful quote.
|
|
38
|
+
|
|
39
|
+
Using \`console.log("Hello World");\` will log to the console.
|
|
40
|
+
|
|
41
|
+
| Header 1 | Header 2 | Header 3 |
|
|
42
|
+
|------------|------------|------------|
|
|
43
|
+
| Cell 1.1 | Cell 1.2 | Cell 1.3 |
|
|
44
|
+
| Cell 2.1 | Cell 2.2 | Cell 2.3 |
|
|
45
|
+
| Cell 3.1 | Cell 3.2 | Cell 3.3 |
|
|
46
|
+
`.trim(), c = {
|
|
47
|
+
category: "data",
|
|
48
|
+
description: "Used to add markdown code to the page",
|
|
49
|
+
order: 4,
|
|
50
|
+
template: /* @__PURE__ */ t(a.MarkdownEmbed, { code: n, children: [
|
|
51
|
+
/* @__PURE__ */ e(l.descendant, { "ws:label": "Paragraph", selector: " p" }),
|
|
52
|
+
/* @__PURE__ */ e(l.descendant, { "ws:label": "Heading 1", selector: " h1" }),
|
|
53
|
+
/* @__PURE__ */ e(l.descendant, { "ws:label": "Heading 2", selector: " h2" }),
|
|
54
|
+
/* @__PURE__ */ e(l.descendant, { "ws:label": "Heading 3", selector: " h3" }),
|
|
55
|
+
/* @__PURE__ */ e(l.descendant, { "ws:label": "Heading 4", selector: " h4" }),
|
|
56
|
+
/* @__PURE__ */ e(l.descendant, { "ws:label": "Heading 5", selector: " h5" }),
|
|
57
|
+
/* @__PURE__ */ e(l.descendant, { "ws:label": "Heading 6", selector: " h6" }),
|
|
58
|
+
/* @__PURE__ */ e(l.descendant, { "ws:label": "Bold", selector: " :where(strong, b)" }),
|
|
59
|
+
/* @__PURE__ */ e(l.descendant, { "ws:label": "Italic", selector: " :where(em, i)" }),
|
|
60
|
+
/* @__PURE__ */ e(l.descendant, { "ws:label": "Link", selector: " a" }),
|
|
61
|
+
/* @__PURE__ */ e(l.descendant, { "ws:label": "Image", selector: " img" }),
|
|
62
|
+
/* @__PURE__ */ e(l.descendant, { "ws:label": "Blockquote", selector: " blockquote" }),
|
|
63
|
+
/* @__PURE__ */ e(l.descendant, { "ws:label": "Code Text", selector: " code" }),
|
|
64
|
+
/* @__PURE__ */ e(l.descendant, { "ws:label": "List", selector: " :where(ul, ol)" }),
|
|
65
|
+
/* @__PURE__ */ e(l.descendant, { "ws:label": "List Item", selector: " li" }),
|
|
66
|
+
/* @__PURE__ */ e(l.descendant, { "ws:label": "Separator", selector: " hr" }),
|
|
67
|
+
/* @__PURE__ */ e(l.descendant, { "ws:label": "Table", selector: " table" }),
|
|
68
|
+
/* @__PURE__ */ e(l.descendant, { "ws:label": "Table Row", selector: " tr" }),
|
|
69
|
+
/* @__PURE__ */ e(l.descendant, { "ws:label": "Table Header Cell", selector: " th" }),
|
|
70
|
+
/* @__PURE__ */ e(l.descendant, { "ws:label": "Table Cell", selector: " td" })
|
|
71
|
+
] })
|
|
72
|
+
};
|
|
73
|
+
export {
|
|
74
|
+
c as meta
|
|
75
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { MarkdownEmbedIcon as e } from "@webstudio-is/icons/svg";
|
|
2
|
+
import { descendantComponent as o } from "@webstudio-is/sdk";
|
|
3
|
+
import { props as r } from "./__generated__/markdown-embed.props.js";
|
|
4
|
+
const a = {
|
|
5
|
+
icon: e,
|
|
6
|
+
contentModel: {
|
|
7
|
+
category: "instance",
|
|
8
|
+
children: [o]
|
|
9
|
+
},
|
|
10
|
+
presetStyle: {
|
|
11
|
+
div: [
|
|
12
|
+
{
|
|
13
|
+
property: "display",
|
|
14
|
+
value: { type: "keyword", value: "contents" }
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
property: "white-space-collapse",
|
|
18
|
+
value: { type: "keyword", value: "collapse" }
|
|
19
|
+
}
|
|
20
|
+
]
|
|
21
|
+
},
|
|
22
|
+
initialProps: ["class"],
|
|
23
|
+
props: {
|
|
24
|
+
...r,
|
|
25
|
+
code: {
|
|
26
|
+
required: !0,
|
|
27
|
+
control: "code",
|
|
28
|
+
language: "markdown",
|
|
29
|
+
type: "string"
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
export {
|
|
34
|
+
a as meta
|
|
35
|
+
};
|
package/lib/metas.js
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { meta as o } from "./slot.ws.js";
|
|
2
|
+
import { meta as m } from "./fragment.ws.js";
|
|
3
|
+
import { meta as p } from "./html-embed.ws.js";
|
|
4
|
+
import { meta as s } from "./markdown-embed.ws.js";
|
|
5
|
+
import { meta as i } from "./body.ws.js";
|
|
6
|
+
import { meta as n } from "./box.ws.js";
|
|
7
|
+
import { meta as u } from "./text.ws.js";
|
|
8
|
+
import { meta as T } from "./heading.ws.js";
|
|
9
|
+
import { meta as B } from "./paragraph.ws.js";
|
|
10
|
+
import { meta as k } from "./link.ws.js";
|
|
11
|
+
import { meta as L } from "./rich-text-link.ws.js";
|
|
12
|
+
import { meta as I } from "./span.ws.js";
|
|
13
|
+
import { meta as h } from "./bold.ws.js";
|
|
14
|
+
import { meta as P } from "./italic.ws.js";
|
|
15
|
+
import { meta as w } from "./superscript.ws.js";
|
|
16
|
+
import { meta as C } from "./subscript.ws.js";
|
|
17
|
+
import { meta as M } from "./button.ws.js";
|
|
18
|
+
import { meta as q } from "./input.ws.js";
|
|
19
|
+
import { meta as N } from "./webhook-form.ws.js";
|
|
20
|
+
import { meta as Y } from "./form.ws.js";
|
|
21
|
+
import { meta as z } from "./image.ws.js";
|
|
22
|
+
import { meta as D } from "./blockquote.ws.js";
|
|
23
|
+
import { meta as J } from "./list.ws.js";
|
|
24
|
+
import { meta as Q } from "./list-item.ws.js";
|
|
25
|
+
import { meta as W } from "./separator.ws.js";
|
|
26
|
+
import { meta as _ } from "./code-text.ws.js";
|
|
27
|
+
import { meta as ee } from "./label.ws.js";
|
|
28
|
+
import { meta as oe } from "./textarea.ws.js";
|
|
29
|
+
import { meta as me } from "./radio-button.ws.js";
|
|
30
|
+
import { meta as pe } from "./checkbox.ws.js";
|
|
31
|
+
import { meta as se } from "./vimeo.ws.js";
|
|
32
|
+
import { meta as ie } from "./youtube.ws.js";
|
|
33
|
+
import { meta as ne } from "./vimeo-preview-image.ws.js";
|
|
34
|
+
import { meta as ue } from "./vimeo-play-button.ws.js";
|
|
35
|
+
import { meta as Te } from "./vimeo-spinner.ws.js";
|
|
36
|
+
import { meta as Be } from "./xml-node.ws.js";
|
|
37
|
+
import { meta as ke } from "./xml-time.ws.js";
|
|
38
|
+
import { meta as Le } from "./time.ws.js";
|
|
39
|
+
import { meta as Ie } from "./select.ws.js";
|
|
40
|
+
import { meta as he } from "./option.ws.js";
|
|
41
|
+
import { meta as Pe } from "./head-slot.ws.js";
|
|
42
|
+
import { meta as we } from "./head-link.ws.js";
|
|
43
|
+
import { meta as Ce } from "./head-meta.ws.js";
|
|
44
|
+
import { meta as Me } from "./head-title.ws.js";
|
|
45
|
+
import { meta as qe } from "./video.ws.js";
|
|
46
|
+
export {
|
|
47
|
+
D as Blockquote,
|
|
48
|
+
i as Body,
|
|
49
|
+
h as Bold,
|
|
50
|
+
n as Box,
|
|
51
|
+
M as Button,
|
|
52
|
+
pe as Checkbox,
|
|
53
|
+
_ as CodeText,
|
|
54
|
+
N as Form,
|
|
55
|
+
m as Fragment,
|
|
56
|
+
we as HeadLink,
|
|
57
|
+
Ce as HeadMeta,
|
|
58
|
+
Pe as HeadSlot,
|
|
59
|
+
Me as HeadTitle,
|
|
60
|
+
T as Heading,
|
|
61
|
+
p as HtmlEmbed,
|
|
62
|
+
z as Image,
|
|
63
|
+
q as Input,
|
|
64
|
+
P as Italic,
|
|
65
|
+
ee as Label,
|
|
66
|
+
k as Link,
|
|
67
|
+
J as List,
|
|
68
|
+
Q as ListItem,
|
|
69
|
+
s as MarkdownEmbed,
|
|
70
|
+
he as Option,
|
|
71
|
+
B as Paragraph,
|
|
72
|
+
me as RadioButton,
|
|
73
|
+
Y as RemixForm,
|
|
74
|
+
L as RichTextLink,
|
|
75
|
+
Ie as Select,
|
|
76
|
+
W as Separator,
|
|
77
|
+
o as Slot,
|
|
78
|
+
I as Span,
|
|
79
|
+
C as Subscript,
|
|
80
|
+
w as Superscript,
|
|
81
|
+
u as Text,
|
|
82
|
+
oe as Textarea,
|
|
83
|
+
Le as Time,
|
|
84
|
+
qe as Video,
|
|
85
|
+
se as Vimeo,
|
|
86
|
+
ue as VimeoPlayButton,
|
|
87
|
+
ne as VimeoPreviewImage,
|
|
88
|
+
Te as VimeoSpinner,
|
|
89
|
+
Be as XmlNode,
|
|
90
|
+
ke as XmlTime,
|
|
91
|
+
ie as YouTube
|
|
92
|
+
};
|
package/lib/option.js
ADDED
package/lib/option.ws.js
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { props as e } from "./__generated__/option.props.js";
|
|
2
|
+
const l = {
|
|
3
|
+
option: [
|
|
4
|
+
{
|
|
5
|
+
property: "background-color",
|
|
6
|
+
state: ":checked",
|
|
7
|
+
value: {
|
|
8
|
+
type: "rgb",
|
|
9
|
+
alpha: 1,
|
|
10
|
+
r: 209,
|
|
11
|
+
g: 209,
|
|
12
|
+
b: 209
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
]
|
|
16
|
+
}, a = {
|
|
17
|
+
category: "hidden",
|
|
18
|
+
description: "An item within a drop-down menu that users can select as their chosen value.",
|
|
19
|
+
presetStyle: l,
|
|
20
|
+
states: [
|
|
21
|
+
// Applies when option is being activated (clicked)
|
|
22
|
+
{ selector: ":active", label: "Active" },
|
|
23
|
+
// Applies to the currently selected option
|
|
24
|
+
{ selector: ":checked", label: "Checked" },
|
|
25
|
+
// For <option> elements: The :default pseudo-class selects the <option> that has the selected attribute when the page loads. This is true even if the user later selects a different option.
|
|
26
|
+
{ selector: ":default", label: "Default" },
|
|
27
|
+
{ selector: ":hover", label: "Hover" },
|
|
28
|
+
{ selector: ":disabled", label: "Disabled" }
|
|
29
|
+
],
|
|
30
|
+
initialProps: ["label", "value", "label", "disabled"],
|
|
31
|
+
props: e
|
|
32
|
+
};
|
|
33
|
+
export {
|
|
34
|
+
a as meta
|
|
35
|
+
};
|
package/lib/paragraph.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as i } from "react";
|
|
3
|
+
const a = i(({ children: n, checked: o, defaultChecked: t, ...r }, d) => /* @__PURE__ */ e(
|
|
4
|
+
"input",
|
|
5
|
+
{
|
|
6
|
+
...r,
|
|
7
|
+
defaultChecked: o ?? t,
|
|
8
|
+
type: "radio",
|
|
9
|
+
ref: d
|
|
10
|
+
}
|
|
11
|
+
));
|
|
12
|
+
a.displayName = "RadioButton";
|
|
13
|
+
export {
|
|
14
|
+
a as RadioButton
|
|
15
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { RadioCheckedIcon as e } from "@webstudio-is/icons/svg";
|
|
2
|
+
import { radio as i } from "@webstudio-is/sdk/normalize.css";
|
|
3
|
+
import { props as o } from "./__generated__/radio-button.props.js";
|
|
4
|
+
const r = {
|
|
5
|
+
input: [
|
|
6
|
+
...i,
|
|
7
|
+
{
|
|
8
|
+
property: "margin-right",
|
|
9
|
+
value: { type: "unit", unit: "em", value: 0.5 }
|
|
10
|
+
}
|
|
11
|
+
]
|
|
12
|
+
}, m = {
|
|
13
|
+
label: "Radio",
|
|
14
|
+
icon: e,
|
|
15
|
+
presetStyle: r,
|
|
16
|
+
initialProps: ["id", "class", "name", "value", "required", "checked"],
|
|
17
|
+
props: o
|
|
18
|
+
};
|
|
19
|
+
export {
|
|
20
|
+
m as meta
|
|
21
|
+
};
|
package/lib/select.js
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { forwardRef as r, useContext as s, createElement as i } from "react";
|
|
2
|
+
import { ReactSdkContext as l } from "@webstudio-is/react-sdk/runtime";
|
|
3
|
+
const p = r(
|
|
4
|
+
({ value: o, defaultValue: n, ...e }, t) => {
|
|
5
|
+
const { renderer: c } = s(l), a = c === "canvas" ? String(o ?? n) : void 0;
|
|
6
|
+
return /* @__PURE__ */ i(
|
|
7
|
+
"select",
|
|
8
|
+
{
|
|
9
|
+
...e,
|
|
10
|
+
key: a,
|
|
11
|
+
defaultValue: o ?? n,
|
|
12
|
+
ref: t
|
|
13
|
+
}
|
|
14
|
+
);
|
|
15
|
+
}
|
|
16
|
+
);
|
|
17
|
+
p.displayName = "Select";
|
|
18
|
+
const S = {
|
|
19
|
+
onNavigatorUnselect: (o, n) => {
|
|
20
|
+
for (const e of n.instancePath)
|
|
21
|
+
(e.component === "Select" || e.tag === "select") && o.setMemoryProp(e, "value", void 0);
|
|
22
|
+
},
|
|
23
|
+
onNavigatorSelect: (o, n) => {
|
|
24
|
+
let e;
|
|
25
|
+
for (const t of n.instancePath)
|
|
26
|
+
(t.component === "Option" || t.tag === "option") && (e = o.getPropValue(t, "value")), (t.component === "Select" || t.tag === "select") && o.setMemoryProp(t, "value", e);
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
export {
|
|
30
|
+
p as Select,
|
|
31
|
+
S as hooksSelect
|
|
32
|
+
};
|