@webstudio-is/sdk-components-react 0.197.0 → 0.199.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.
Files changed (46) hide show
  1. package/lib/__generated__/head-link.props.js +620 -0
  2. package/lib/__generated__/head-meta.props.js +532 -0
  3. package/lib/__generated__/head-title.props.js +508 -0
  4. package/lib/__generated__/head.props.js +508 -0
  5. package/lib/code-text.ws.js +1 -1
  6. package/lib/components.js +52 -44
  7. package/lib/head-link.js +23 -0
  8. package/lib/head-link.ws.js +20 -0
  9. package/lib/head-meta.js +23 -0
  10. package/lib/head-meta.ws.js +20 -0
  11. package/lib/head-slot.js +54 -0
  12. package/lib/head-slot.template.js +15 -0
  13. package/lib/head-slot.ws.js +26 -0
  14. package/lib/head-title.js +23 -0
  15. package/lib/head-title.ws.js +19 -0
  16. package/lib/hooks.js +3 -2
  17. package/lib/html-embed.ws.js +1 -1
  18. package/lib/metas.js +50 -42
  19. package/lib/props.js +40 -32
  20. package/lib/separator.ws.js +1 -1
  21. package/lib/slot.ws.js +1 -1
  22. package/lib/templates.js +18 -16
  23. package/lib/types/__generated__/head-link.props.d.ts +2 -0
  24. package/lib/types/__generated__/head-meta.props.d.ts +2 -0
  25. package/lib/types/__generated__/head-slot.props.d.ts +2 -0
  26. package/lib/types/__generated__/head-title.props.d.ts +2 -0
  27. package/lib/types/__generated__/head.props.d.ts +2 -0
  28. package/lib/types/components.d.ts +4 -0
  29. package/lib/types/head-link.d.ts +8 -0
  30. package/lib/types/head-link.ws.d.ts +3 -0
  31. package/lib/types/head-meta.d.ts +2 -0
  32. package/lib/types/head-meta.ws.d.ts +3 -0
  33. package/lib/types/head-slot.d.ts +9 -0
  34. package/lib/types/head-slot.template.d.ts +2 -0
  35. package/lib/types/head-slot.ws.d.ts +3 -0
  36. package/lib/types/head-title.d.ts +2 -0
  37. package/lib/types/head-title.ws.d.ts +3 -0
  38. package/lib/types/metas.d.ts +4 -0
  39. package/lib/types/props.d.ts +4 -0
  40. package/lib/types/templates.d.ts +1 -0
  41. package/lib/types/webhook-form.d.ts +1 -0
  42. package/lib/vimeo.template.js +3 -3
  43. package/lib/xml-node.js +51 -39
  44. package/lib/youtube.template.js +15 -15
  45. package/lib/youtube.ws.js +1 -1
  46. package/package.json +9 -7
@@ -1,5 +1,5 @@
1
1
  import { jsxs as i, jsx as t } from "react/jsx-runtime";
2
- import { SpinnerIcon as r, PlayIcon as a } from "@webstudio-is/icons/svg";
2
+ import { SpinnerIcon as r, PlayIcon as n } from "@webstudio-is/icons/svg";
3
3
  import { $ as e, css as o } from "@webstudio-is/template";
4
4
  const p = {
5
5
  category: "media",
@@ -20,7 +20,7 @@ const p = {
20
20
  "ws:style": o`
21
21
  position: absolute;
22
22
  object-fit: cover;
23
- object-position: cover;
23
+ object-position: center;
24
24
  width: 100%;
25
25
  height: 100%;
26
26
  border-radius: 20px;
@@ -79,7 +79,7 @@ const p = {
79
79
  height: 60px;
80
80
  `,
81
81
  "aria-hidden": !0,
82
- children: /* @__PURE__ */ t(e.HtmlEmbed, { "ws:label": "Play SVG", code: a })
82
+ children: /* @__PURE__ */ t(e.HtmlEmbed, { "ws:label": "Play SVG", code: n })
83
83
  }
84
84
  )
85
85
  }
package/lib/xml-node.js CHANGED
@@ -1,48 +1,60 @@
1
- import { jsxs as n, jsx as p } from "react/jsx-runtime";
2
- import { ReactSdkContext as y, xmlNodeTagSuffix as g } from "@webstudio-is/react-sdk/runtime";
3
- import { forwardRef as u, useContext as x, createElement as b, Children as h } from "react";
4
- const N = u(
5
- ({ tag: a = "", children: e, ...o }, c) => {
6
- const { renderer: f } = x(y), s = Object.entries(o).filter(
7
- ([t]) => t.startsWith("data-") === !1 && t.startsWith("aria-") === !1
8
- ).filter(([t]) => t !== "tabIndex").filter(([, t]) => typeof t != "function"), r = a.replace(/^[^\p{L}_]+/u, "").replaceAll(/[^\p{L}\p{N}\-._:]+/gu, "").trim();
9
- if (f === void 0) {
10
- const t = Object.fromEntries(s);
11
- return b(
12
- `${r}${g}`,
13
- t,
14
- e
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
15
  );
16
16
  }
17
- const i = h.toArray(e), l = i.length > 0 && i.every((t) => typeof t == "string"), m = s.map(
18
- ([t, d]) => `${t}=${JSON.stringify(d)}`
19
- );
20
- return /* @__PURE__ */ n("div", { ...o, children: [
21
- /* @__PURE__ */ n("span", { style: { color: "rgb(16, 23, 233)" }, children: [
22
- "<",
23
- [r, ...m].join(" "),
24
- ">"
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: ">" })
25
35
  ] }),
26
- i.length > 0 && /* @__PURE__ */ p(
27
- "div",
28
- {
29
- ref: c,
30
- style: {
31
- display: l ? "inline" : "block",
32
- marginLeft: l ? 0 : "1rem"
33
- },
34
- children: e
35
- }
36
- ),
37
- /* @__PURE__ */ n("span", { style: { color: "rgb(16, 23, 233)" }, children: [
38
- "</",
39
- r,
40
- ">"
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
+ ] })
41
53
  ] })
42
54
  ] });
43
55
  }
44
56
  );
45
- N.displayName = "XmlNode";
57
+ j.displayName = "XmlNode";
46
58
  export {
47
- N as XmlNode
59
+ j as XmlNode
48
60
  };
@@ -1,6 +1,6 @@
1
- import { jsxs as i, jsx as o } from "react/jsx-runtime";
1
+ import { jsxs as i, jsx as t } from "react/jsx-runtime";
2
2
  import { SpinnerIcon as r, PlayIcon as l } from "@webstudio-is/icons/svg";
3
- import { $ as e, css as t } from "@webstudio-is/template";
3
+ import { $ as e, css as o } from "@webstudio-is/template";
4
4
  const p = {
5
5
  label: "YouTube",
6
6
  category: "media",
@@ -10,34 +10,34 @@ const p = {
10
10
  e.YouTube,
11
11
  {
12
12
  "ws:label": "YouTube",
13
- "ws:style": t`
13
+ "ws:style": o`
14
14
  position: relative;
15
15
  aspect-ratio: 640/360;
16
16
  width: 100%;
17
17
  `,
18
18
  children: [
19
- /* @__PURE__ */ o(
19
+ /* @__PURE__ */ t(
20
20
  e.VimeoPreviewImage,
21
21
  {
22
22
  "ws:label": "Preview Image",
23
- "ws:style": t`
23
+ "ws:style": o`
24
24
  position: absolute;
25
25
  object-fit: cover;
26
- object-position: cover;
26
+ object-position: center;
27
27
  width: 100%;
28
28
  height: 100%;
29
29
  border-radius: 20px;
30
30
  `,
31
- alt: "Vimeo video preview image",
31
+ alt: "YouTube video preview image",
32
32
  sizes: "100vw",
33
33
  optimize: !0
34
34
  }
35
35
  ),
36
- /* @__PURE__ */ o(
36
+ /* @__PURE__ */ t(
37
37
  e.VimeoSpinner,
38
38
  {
39
39
  "ws:label": "Spinner",
40
- "ws:style": t`
40
+ "ws:style": o`
41
41
  position: absolute;
42
42
  top: 50%;
43
43
  left: 50%;
@@ -46,14 +46,14 @@ const p = {
46
46
  margin-top: -35px;
47
47
  margin-left: -35px;
48
48
  `,
49
- children: /* @__PURE__ */ o(e.HtmlEmbed, { "ws:label": "Spinner SVG", code: r })
49
+ children: /* @__PURE__ */ t(e.HtmlEmbed, { "ws:label": "Spinner SVG", code: r })
50
50
  }
51
51
  ),
52
- /* @__PURE__ */ o(
52
+ /* @__PURE__ */ t(
53
53
  e.VimeoPlayButton,
54
54
  {
55
55
  "ws:label": "Play Button",
56
- "ws:style": t`
56
+ "ws:style": o`
57
57
  position: absolute;
58
58
  width: 140px;
59
59
  height: 80px;
@@ -74,16 +74,16 @@ const p = {
74
74
  }
75
75
  `,
76
76
  "aria-label": "Play button",
77
- children: /* @__PURE__ */ o(
77
+ children: /* @__PURE__ */ t(
78
78
  e.Box,
79
79
  {
80
80
  "ws:label": "Play Icon",
81
- "ws:style": t`
81
+ "ws:style": o`
82
82
  width: 60px;
83
83
  height: 60px;
84
84
  `,
85
85
  "aria-hidden": !0,
86
- children: /* @__PURE__ */ o(e.HtmlEmbed, { "ws:label": "Play SVG", code: l })
86
+ children: /* @__PURE__ */ t(e.HtmlEmbed, { "ws:label": "Play SVG", code: l })
87
87
  }
88
88
  )
89
89
  }
package/lib/youtube.ws.js CHANGED
@@ -1,4 +1,4 @@
1
- import { Youtube1cIcon as o } from "@webstudio-is/icons/svg";
1
+ import { YoutubeIcon as o } from "@webstudio-is/icons/svg";
2
2
  import { defaultStates as t } from "@webstudio-is/sdk";
3
3
  import { div as e } from "@webstudio-is/sdk/normalize.css";
4
4
  import { props as n } from "./__generated__/youtube.props.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webstudio-is/sdk-components-react",
3
- "version": "0.197.0",
3
+ "version": "0.199.0",
4
4
  "description": "Webstudio default library for react",
5
5
  "author": "Webstudio <github@webstudio.is>",
6
6
  "homepage": "https://webstudio.is",
@@ -49,10 +49,10 @@
49
49
  "colord": "^2.9.3",
50
50
  "micromark": "^4.0.1",
51
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"
52
+ "@webstudio-is/icons": "0.199.0",
53
+ "@webstudio-is/react-sdk": "0.199.0",
54
+ "@webstudio-is/image": "0.199.0",
55
+ "@webstudio-is/sdk": "0.199.0"
56
56
  },
57
57
  "devDependencies": {
58
58
  "@testing-library/react": "^14.2.2",
@@ -60,14 +60,16 @@
60
60
  "@types/react-dom": "^18.2.25",
61
61
  "react": "18.3.0-canary-14898b6a9-20240318",
62
62
  "react-dom": "18.3.0-canary-14898b6a9-20240318",
63
- "vitest": "^2.1.8",
63
+ "vitest": "^3.0.2",
64
64
  "@webstudio-is/generate-arg-types": "0.0.0",
65
- "@webstudio-is/template": "0.197.0",
65
+ "@webstudio-is/sdk-cli": "0.94.0",
66
+ "@webstudio-is/template": "0.199.0",
66
67
  "@webstudio-is/tsconfig": "1.0.7"
67
68
  },
68
69
  "scripts": {
69
70
  "build": "vite build --config ../../vite.sdk-components.config.ts",
70
71
  "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\"",
72
+ "build:stories": "webstudio-sdk generate-stories && prettier --write \"src/__generated__/*.stories.tsx\"",
71
73
  "dts": "tsc --project tsconfig.dts.json",
72
74
  "test": "vitest run",
73
75
  "typecheck": "tsc"