@webstudio-is/sdk-components-react 0.0.1-c87cdba.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 (280) hide show
  1. package/LICENSE +661 -0
  2. package/README.md +3 -0
  3. package/lib/__generated__/blockquote.props.js +514 -0
  4. package/lib/__generated__/body.props.js +508 -0
  5. package/lib/__generated__/bold.props.js +508 -0
  6. package/lib/__generated__/box.props.js +527 -0
  7. package/lib/__generated__/button.props.js +570 -0
  8. package/lib/__generated__/checkbox.props.js +672 -0
  9. package/lib/__generated__/code-text.props.js +509 -0
  10. package/lib/__generated__/form.props.js +556 -0
  11. package/lib/__generated__/heading.props.js +516 -0
  12. package/lib/__generated__/html-embed.props.js +13 -0
  13. package/lib/__generated__/image.props.js +593 -0
  14. package/lib/__generated__/input.props.js +696 -0
  15. package/lib/__generated__/italic.props.js +508 -0
  16. package/lib/__generated__/label.props.js +520 -0
  17. package/lib/__generated__/link.props.js +578 -0
  18. package/lib/__generated__/list-item.props.js +514 -0
  19. package/lib/__generated__/list.props.js +534 -0
  20. package/lib/__generated__/markdown-embed.props.js +7 -0
  21. package/lib/__generated__/option.props.js +532 -0
  22. package/lib/__generated__/paragraph.props.js +508 -0
  23. package/lib/__generated__/radio-button.props.js +672 -0
  24. package/lib/__generated__/select.props.js +556 -0
  25. package/lib/__generated__/separator.props.js +508 -0
  26. package/lib/__generated__/span.props.js +508 -0
  27. package/lib/__generated__/subscript.props.js +508 -0
  28. package/lib/__generated__/superscript.props.js +508 -0
  29. package/lib/__generated__/text.props.js +516 -0
  30. package/lib/__generated__/textarea.props.js +587 -0
  31. package/lib/__generated__/time.props.js +312 -0
  32. package/lib/__generated__/vimeo-play-button.props.js +569 -0
  33. package/lib/__generated__/vimeo-preview-image.props.js +591 -0
  34. package/lib/__generated__/vimeo-spinner.props.js +508 -0
  35. package/lib/__generated__/vimeo.props.js +673 -0
  36. package/lib/__generated__/webhook-form.props.js +569 -0
  37. package/lib/__generated__/xml-node.props.js +21 -0
  38. package/lib/__generated__/xml-time.props.js +18 -0
  39. package/lib/blockquote.js +9 -0
  40. package/lib/blockquote.template.js +11 -0
  41. package/lib/blockquote.ws.js +63 -0
  42. package/lib/body.js +7 -0
  43. package/lib/body.ws.js +29 -0
  44. package/lib/bold.js +7 -0
  45. package/lib/bold.ws.js +20 -0
  46. package/lib/box.js +9 -0
  47. package/lib/box.ws.js +31 -0
  48. package/lib/button.js +9 -0
  49. package/lib/button.template.js +11 -0
  50. package/lib/button.ws.js +27 -0
  51. package/lib/checkbox.js +15 -0
  52. package/lib/checkbox.template.js +14 -0
  53. package/lib/checkbox.ws.js +38 -0
  54. package/lib/code-text.js +10 -0
  55. package/lib/code-text.ws.js +59 -0
  56. package/lib/components.js +79 -0
  57. package/lib/content-embed.template.js +83 -0
  58. package/lib/form.js +7 -0
  59. package/lib/form.ws.js +30 -0
  60. package/lib/fragment.js +7 -0
  61. package/lib/fragment.ws.js +11 -0
  62. package/lib/heading.js +9 -0
  63. package/lib/heading.template.js +11 -0
  64. package/lib/heading.ws.js +28 -0
  65. package/lib/home_wsKvRSqvkajPPBeycZ-C8.svg +3 -0
  66. package/lib/hooks.js +5 -0
  67. package/lib/html-embed-patchers.js +29 -0
  68. package/lib/html-embed.js +112 -0
  69. package/lib/html-embed.ws.js +46 -0
  70. package/lib/image.js +38 -0
  71. package/lib/image.ws.js +60 -0
  72. package/lib/input.js +17 -0
  73. package/lib/input.ws.js +54 -0
  74. package/lib/italic.js +7 -0
  75. package/lib/italic.ws.js +26 -0
  76. package/lib/label.js +7 -0
  77. package/lib/label.template.js +10 -0
  78. package/lib/label.ws.js +27 -0
  79. package/lib/link.js +15 -0
  80. package/lib/link.template.js +11 -0
  81. package/lib/link.ws.js +47 -0
  82. package/lib/list-item.js +9 -0
  83. package/lib/list-item.template.js +11 -0
  84. package/lib/list-item.ws.js +26 -0
  85. package/lib/list.js +6 -0
  86. package/lib/list.template.js +15 -0
  87. package/lib/list.ws.js +48 -0
  88. package/lib/markdown-embed.js +19 -0
  89. package/lib/markdown-embed.template.js +75 -0
  90. package/lib/markdown-embed.ws.js +33 -0
  91. package/lib/metas.js +80 -0
  92. package/lib/option.js +7 -0
  93. package/lib/option.ws.js +45 -0
  94. package/lib/paragraph.js +7 -0
  95. package/lib/paragraph.template.js +11 -0
  96. package/lib/paragraph.ws.js +23 -0
  97. package/lib/props.js +80 -0
  98. package/lib/radio-button.js +15 -0
  99. package/lib/radio-button.template.js +14 -0
  100. package/lib/radio-button.ws.js +40 -0
  101. package/lib/rich-text-link.ws.js +9 -0
  102. package/lib/select.js +19 -0
  103. package/lib/select.template.js +16 -0
  104. package/lib/select.ws.js +44 -0
  105. package/lib/separator.js +9 -0
  106. package/lib/separator.ws.js +48 -0
  107. package/lib/slot.js +14 -0
  108. package/lib/slot.ws.js +15 -0
  109. package/lib/span.js +7 -0
  110. package/lib/span.ws.js +20 -0
  111. package/lib/subscript.js +7 -0
  112. package/lib/subscript.ws.js +20 -0
  113. package/lib/superscript.js +7 -0
  114. package/lib/superscript.ws.js +20 -0
  115. package/lib/templates.js +32 -0
  116. package/lib/text.js +10 -0
  117. package/lib/text.template.js +11 -0
  118. package/lib/text.ws.js +25 -0
  119. package/lib/textarea.js +7 -0
  120. package/lib/textarea.ws.js +55 -0
  121. package/lib/time.js +319 -0
  122. package/lib/time.ws.js +21 -0
  123. package/lib/types/__generated__/blockquote.props.d.ts +2 -0
  124. package/lib/types/__generated__/body.props.d.ts +2 -0
  125. package/lib/types/__generated__/bold.props.d.ts +2 -0
  126. package/lib/types/__generated__/box.props.d.ts +2 -0
  127. package/lib/types/__generated__/button.props.d.ts +2 -0
  128. package/lib/types/__generated__/checkbox.props.d.ts +2 -0
  129. package/lib/types/__generated__/code-text.props.d.ts +2 -0
  130. package/lib/types/__generated__/form.props.d.ts +2 -0
  131. package/lib/types/__generated__/fragment.props.d.ts +2 -0
  132. package/lib/types/__generated__/heading.props.d.ts +2 -0
  133. package/lib/types/__generated__/html-embed.props.d.ts +2 -0
  134. package/lib/types/__generated__/image.props.d.ts +2 -0
  135. package/lib/types/__generated__/input.props.d.ts +2 -0
  136. package/lib/types/__generated__/italic.props.d.ts +2 -0
  137. package/lib/types/__generated__/label.props.d.ts +2 -0
  138. package/lib/types/__generated__/link.props.d.ts +2 -0
  139. package/lib/types/__generated__/list-item.props.d.ts +2 -0
  140. package/lib/types/__generated__/list.props.d.ts +2 -0
  141. package/lib/types/__generated__/local-date.props.d.ts +2 -0
  142. package/lib/types/__generated__/markdown-embed.props.d.ts +2 -0
  143. package/lib/types/__generated__/option.props.d.ts +2 -0
  144. package/lib/types/__generated__/paragraph.props.d.ts +2 -0
  145. package/lib/types/__generated__/radio-button.props.d.ts +2 -0
  146. package/lib/types/__generated__/rich-text-link.props.d.ts +2 -0
  147. package/lib/types/__generated__/select.props.d.ts +2 -0
  148. package/lib/types/__generated__/separator.props.d.ts +2 -0
  149. package/lib/types/__generated__/slot.props.d.ts +2 -0
  150. package/lib/types/__generated__/span.props.d.ts +2 -0
  151. package/lib/types/__generated__/subscript.props.d.ts +2 -0
  152. package/lib/types/__generated__/superscript.props.d.ts +2 -0
  153. package/lib/types/__generated__/text.props.d.ts +2 -0
  154. package/lib/types/__generated__/textarea.props.d.ts +2 -0
  155. package/lib/types/__generated__/time.props.d.ts +2 -0
  156. package/lib/types/__generated__/vimeo-play-button.props.d.ts +2 -0
  157. package/lib/types/__generated__/vimeo-preview-image.props.d.ts +2 -0
  158. package/lib/types/__generated__/vimeo-spinner.props.d.ts +2 -0
  159. package/lib/types/__generated__/vimeo.props.d.ts +2 -0
  160. package/lib/types/__generated__/webhook-form.props.d.ts +2 -0
  161. package/lib/types/__generated__/xml-node.props.d.ts +2 -0
  162. package/lib/types/__generated__/xml-time.props.d.ts +2 -0
  163. package/lib/types/blockquote.d.ts +2 -0
  164. package/lib/types/blockquote.template.d.ts +2 -0
  165. package/lib/types/blockquote.ws.d.ts +3 -0
  166. package/lib/types/body.d.ts +2 -0
  167. package/lib/types/body.ws.d.ts +3 -0
  168. package/lib/types/bold.d.ts +2 -0
  169. package/lib/types/bold.ws.d.ts +3 -0
  170. package/lib/types/box.d.ts +8 -0
  171. package/lib/types/box.ws.d.ts +3 -0
  172. package/lib/types/button.d.ts +2 -0
  173. package/lib/types/button.template.d.ts +2 -0
  174. package/lib/types/button.ws.d.ts +3 -0
  175. package/lib/types/checkbox.d.ts +4 -0
  176. package/lib/types/checkbox.template.d.ts +2 -0
  177. package/lib/types/checkbox.ws.d.ts +3 -0
  178. package/lib/types/code-text.d.ts +4 -0
  179. package/lib/types/code-text.ws.d.ts +3 -0
  180. package/lib/types/components.d.ts +39 -0
  181. package/lib/types/content-embed.template.d.ts +2 -0
  182. package/lib/types/form.d.ts +2 -0
  183. package/lib/types/form.ws.d.ts +3 -0
  184. package/lib/types/fragment.d.ts +6 -0
  185. package/lib/types/fragment.ws.d.ts +3 -0
  186. package/lib/types/heading.d.ts +8 -0
  187. package/lib/types/heading.template.d.ts +2 -0
  188. package/lib/types/heading.ws.d.ts +3 -0
  189. package/lib/types/hooks.d.ts +2 -0
  190. package/lib/types/html-embed-patchers.d.ts +2 -0
  191. package/lib/types/html-embed.d.ts +12 -0
  192. package/lib/types/html-embed.test.d.ts +1 -0
  193. package/lib/types/html-embed.ws.d.ts +3 -0
  194. package/lib/types/image.d.ts +8 -0
  195. package/lib/types/image.ws.d.ts +3 -0
  196. package/lib/types/input.d.ts +4 -0
  197. package/lib/types/input.ws.d.ts +3 -0
  198. package/lib/types/italic.d.ts +2 -0
  199. package/lib/types/italic.ws.d.ts +3 -0
  200. package/lib/types/label.d.ts +2 -0
  201. package/lib/types/label.template.d.ts +2 -0
  202. package/lib/types/label.ws.d.ts +3 -0
  203. package/lib/types/link.d.ts +11 -0
  204. package/lib/types/link.template.d.ts +2 -0
  205. package/lib/types/link.ws.d.ts +3 -0
  206. package/lib/types/list-item.d.ts +2 -0
  207. package/lib/types/list-item.template.d.ts +2 -0
  208. package/lib/types/list-item.ws.d.ts +3 -0
  209. package/lib/types/list.d.ts +10 -0
  210. package/lib/types/list.template.d.ts +2 -0
  211. package/lib/types/list.ws.d.ts +3 -0
  212. package/lib/types/markdown-embed.d.ts +7 -0
  213. package/lib/types/markdown-embed.template.d.ts +2 -0
  214. package/lib/types/markdown-embed.ws.d.ts +3 -0
  215. package/lib/types/metas.d.ts +39 -0
  216. package/lib/types/option.d.ts +2 -0
  217. package/lib/types/option.ws.d.ts +3 -0
  218. package/lib/types/paragraph.d.ts +2 -0
  219. package/lib/types/paragraph.template.d.ts +2 -0
  220. package/lib/types/paragraph.ws.d.ts +3 -0
  221. package/lib/types/props.d.ts +39 -0
  222. package/lib/types/radio-button.d.ts +4 -0
  223. package/lib/types/radio-button.template.d.ts +2 -0
  224. package/lib/types/radio-button.ws.d.ts +3 -0
  225. package/lib/types/rich-text-link.d.ts +1 -0
  226. package/lib/types/rich-text-link.ws.d.ts +3 -0
  227. package/lib/types/select.d.ts +4 -0
  228. package/lib/types/select.template.d.ts +2 -0
  229. package/lib/types/select.ws.d.ts +3 -0
  230. package/lib/types/separator.d.ts +2 -0
  231. package/lib/types/separator.ws.d.ts +3 -0
  232. package/lib/types/slot.d.ts +6 -0
  233. package/lib/types/slot.ws.d.ts +3 -0
  234. package/lib/types/span.d.ts +2 -0
  235. package/lib/types/span.ws.d.ts +3 -0
  236. package/lib/types/subscript.d.ts +2 -0
  237. package/lib/types/subscript.ws.d.ts +3 -0
  238. package/lib/types/superscript.d.ts +2 -0
  239. package/lib/types/superscript.ws.d.ts +3 -0
  240. package/lib/types/templates.d.ts +15 -0
  241. package/lib/types/test-utils/cartesian.d.ts +2 -0
  242. package/lib/types/text.d.ts +8 -0
  243. package/lib/types/text.template.d.ts +2 -0
  244. package/lib/types/text.ws.d.ts +3 -0
  245. package/lib/types/textarea.d.ts +2 -0
  246. package/lib/types/textarea.ws.d.ts +3 -0
  247. package/lib/types/time.d.ts +18 -0
  248. package/lib/types/time.test.d.ts +1 -0
  249. package/lib/types/time.ws.d.ts +3 -0
  250. package/lib/types/vimeo-play-button.d.ts +3 -0
  251. package/lib/types/vimeo-play-button.ws.d.ts +3 -0
  252. package/lib/types/vimeo-preview-image.d.ts +284 -0
  253. package/lib/types/vimeo-preview-image.ws.d.ts +3 -0
  254. package/lib/types/vimeo-spinner.d.ts +1 -0
  255. package/lib/types/vimeo-spinner.ws.d.ts +3 -0
  256. package/lib/types/vimeo.d.ts +75 -0
  257. package/lib/types/vimeo.template.d.ts +2 -0
  258. package/lib/types/vimeo.ws.d.ts +3 -0
  259. package/lib/types/webhook-form.d.ts +8 -0
  260. package/lib/types/webhook-form.ws.d.ts +3 -0
  261. package/lib/types/xml-node.d.ts +13 -0
  262. package/lib/types/xml-node.ws.d.ts +3 -0
  263. package/lib/types/xml-time.d.ts +6 -0
  264. package/lib/types/xml-time.ws.d.ts +3 -0
  265. package/lib/vimeo-play-button.js +18 -0
  266. package/lib/vimeo-play-button.ws.js +31 -0
  267. package/lib/vimeo-preview-image.js +19 -0
  268. package/lib/vimeo-preview-image.ws.js +28 -0
  269. package/lib/vimeo-spinner.js +13 -0
  270. package/lib/vimeo-spinner.ws.js +25 -0
  271. package/lib/vimeo.js +213 -0
  272. package/lib/vimeo.template.js +92 -0
  273. package/lib/vimeo.ws.js +39 -0
  274. package/lib/webhook-form.js +9 -0
  275. package/lib/webhook-form.ws.js +127 -0
  276. package/lib/xml-node.js +44 -0
  277. package/lib/xml-node.ws.js +18 -0
  278. package/lib/xml-time.js +25 -0
  279. package/lib/xml-time.ws.js +18 -0
  280. package/package.json +75 -0
@@ -0,0 +1,112 @@
1
+ import { jsx as i } from "react/jsx-runtime";
2
+ import { forwardRef as R, useContext as S, useState as b, useSyncExternalStore as x, useRef as f, useMemo as E, useEffect as k } from "react";
3
+ import { mergeRefs as T } from "@react-aria/utils";
4
+ import { ReactSdkContext as g } from "@webstudio-is/react-sdk/runtime";
5
+ import { patchDomEvents as L, executeDomEvents as _ } from "./html-embed-patchers.js";
6
+ const C = {
7
+ scriptTestIdPrefix: "client-"
8
+ }, w = (e) => new Promise((t, n) => {
9
+ const r = document.createElement("script"), s = e.hasAttribute("src"), a = e.type === "module";
10
+ for (const { name: c, value: o } of e.attributes)
11
+ r.setAttribute(c, o);
12
+ if (r.dataset.testid !== void 0 && (r.dataset.testid = `${C.scriptTestIdPrefix}${r.dataset.testid}`), s)
13
+ r.addEventListener("load", () => {
14
+ t();
15
+ }), r.addEventListener("error", n);
16
+ else {
17
+ if (a) {
18
+ const c = new Blob([e.innerText], {
19
+ type: "text/javascript"
20
+ }), o = URL.createObjectURL(c);
21
+ import(
22
+ /* @vite-ignore */
23
+ o
24
+ ).then(t).catch(n).finally(() => {
25
+ URL.revokeObjectURL(o);
26
+ });
27
+ return;
28
+ }
29
+ r.textContent = e.innerText;
30
+ }
31
+ e.replaceWith(r), s === !1 && t();
32
+ }), l = [];
33
+ let d = !1;
34
+ const O = async (e) => {
35
+ if (l.push(...e), await Promise.resolve(), !d) {
36
+ for (L(), d = !0; l.length > 0; )
37
+ await l.shift()();
38
+ _(), d = !1;
39
+ }
40
+ }, H = (e) => {
41
+ const t = e.querySelectorAll("script"), n = [], r = [];
42
+ t.forEach((s) => {
43
+ (s.hasAttribute("async") ? r : n).push(() => w(s));
44
+ });
45
+ for (const s of r)
46
+ s();
47
+ O(n);
48
+ }, I = (e) => {
49
+ const { code: t, innerRef: n, ...r } = e;
50
+ return /* @__PURE__ */ i("div", { ref: n, ...r, style: { display: "block", padding: 20 }, children: 'Open the "Settings" panel to insert HTML code.' });
51
+ }, h = () => x(
52
+ () => () => {
53
+ },
54
+ () => !1,
55
+ () => !0
56
+ ), u = (e) => {
57
+ if (!h())
58
+ return e.children;
59
+ }, m = (e) => {
60
+ const { code: t, innerRef: n, ...r } = e, s = f(null), a = f(!0), c = E(
61
+ () => ({
62
+ __html: t ?? ""
63
+ }),
64
+ [t]
65
+ );
66
+ return k(() => {
67
+ const o = s.current;
68
+ o && a.current && (a.current = !1, H(o));
69
+ }, []), /* @__PURE__ */ i(
70
+ "div",
71
+ {
72
+ ...r,
73
+ ref: T(n, s),
74
+ dangerouslySetInnerHTML: c
75
+ }
76
+ );
77
+ }, p = (e) => {
78
+ const { code: t, innerRef: n, ...r } = e;
79
+ return /* @__PURE__ */ i(
80
+ "div",
81
+ {
82
+ ...r,
83
+ ref: n,
84
+ dangerouslySetInnerHTML: { __html: t ?? "" }
85
+ }
86
+ );
87
+ }, M = p, P = R(
88
+ (e, t) => {
89
+ const { code: n, executeScriptOnCanvas: r, clientOnly: s, children: a, ...c } = e, { renderer: o } = S(g), v = h(), [y] = b(v);
90
+ return n === void 0 || String(n).trim().length === 0 ? /* @__PURE__ */ i(I, { innerRef: t, ...c }) : y ? s !== !0 ? /* @__PURE__ */ i(p, { innerRef: t, code: n, ...c }) : /* @__PURE__ */ i(u, { children: /* @__PURE__ */ i(m, { innerRef: t, code: n, ...c }) }) : o === "canvas" && r !== !0 ? /* @__PURE__ */ i(u, { children: /* @__PURE__ */ i(
91
+ M,
92
+ {
93
+ innerRef: t,
94
+ code: n,
95
+ ...c
96
+ }
97
+ ) }) : /* @__PURE__ */ i(u, { children: /* @__PURE__ */ i(
98
+ m,
99
+ {
100
+ innerRef: t,
101
+ code: n,
102
+ ...c
103
+ },
104
+ n
105
+ ) });
106
+ }
107
+ );
108
+ P.displayName = "HtmlEmbed";
109
+ export {
110
+ P as HtmlEmbed,
111
+ C as __testing__
112
+ };
@@ -0,0 +1,46 @@
1
+ import { EmbedIcon as t } from "@webstudio-is/icons/svg";
2
+ import { props as e } from "./__generated__/html-embed.props.js";
3
+ const i = {
4
+ div: [
5
+ {
6
+ property: "display",
7
+ value: { type: "keyword", value: "contents" }
8
+ },
9
+ {
10
+ property: "whiteSpaceCollapse",
11
+ value: { type: "keyword", value: "collapse" }
12
+ }
13
+ ]
14
+ }, a = {
15
+ category: "general",
16
+ type: "embed",
17
+ label: "HTML Embed",
18
+ description: "Used to add HTML code to the page, such as an SVG or script.",
19
+ icon: t,
20
+ presetStyle: i,
21
+ order: 8
22
+ }, r = {
23
+ props: {
24
+ ...e,
25
+ clientOnly: {
26
+ ...e.clientOnly,
27
+ description: "Activate it for any scripts that can mutate the DOM or introduce interactivity. This only affects the published site."
28
+ },
29
+ executeScriptOnCanvas: {
30
+ ...e.executeScriptOnCanvas,
31
+ label: "Run scripts on canvas",
32
+ description: "Dangerously allow script execution on canvas without switching to preview mode. This only affects build mode, but may result in unwanted side effects inside builder!"
33
+ },
34
+ code: {
35
+ required: !0,
36
+ control: "code",
37
+ language: "html",
38
+ type: "string"
39
+ }
40
+ },
41
+ initialProps: ["className", "clientOnly", "executeScriptOnCanvas"]
42
+ };
43
+ export {
44
+ a as meta,
45
+ r as propsMeta
46
+ };
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
+ };
@@ -0,0 +1,60 @@
1
+ import { ImageIcon as e } from "@webstudio-is/icons/svg";
2
+ import { defaultStates as t } from "@webstudio-is/react-sdk";
3
+ import { img as o } from "@webstudio-is/sdk/normalize.css";
4
+ import { props as r } from "./__generated__/image.props.js";
5
+ const a = {
6
+ img: [
7
+ ...o,
8
+ // Otherwise on new image insert onto canvas it can overfit screen size multiple times
9
+ {
10
+ property: "maxWidth",
11
+ value: { type: "unit", unit: "%", value: 100 }
12
+ },
13
+ // inline | inline-block is not suitable because without line-height: 0 on the parent you get unsuitable spaces/margins
14
+ // see https://stackoverflow.com/questions/24771194/is-the-margin-of-inline-block-4px-is-static-for-all-browsers
15
+ {
16
+ property: "display",
17
+ value: { type: "keyword", value: "block" }
18
+ },
19
+ // Set image height to "auto" to reduce layout shift, improving compatibility across browsers like Safari.
20
+ // Unlike "fit-content," "auto" preserves the aspect ratio when the width exceeds max-width. (in Safari)
21
+ // See https://web.dev/articles/optimize-cls#best_practice_for_setting_image_dimensions
22
+ {
23
+ property: "height",
24
+ value: { type: "keyword", value: "auto" }
25
+ }
26
+ ]
27
+ }, l = {
28
+ category: "media",
29
+ type: "embed",
30
+ description: "Add an image asset to the page. Webstudio automatically converts images to WebP or AVIF format and makes them responsive for best performance.",
31
+ icon: e,
32
+ states: t,
33
+ presetStyle: a,
34
+ order: 0
35
+ }, d = {
36
+ props: {
37
+ ...r,
38
+ // Automatically generated props don't have the right control.
39
+ src: {
40
+ type: "string",
41
+ control: "file",
42
+ label: "Source",
43
+ required: !1
44
+ }
45
+ },
46
+ initialProps: [
47
+ "id",
48
+ "className",
49
+ "src",
50
+ "width",
51
+ "height",
52
+ "alt",
53
+ "loading",
54
+ "optimize"
55
+ ]
56
+ };
57
+ export {
58
+ l as meta,
59
+ d as propsMeta
60
+ };
package/lib/input.js ADDED
@@ -0,0 +1,17 @@
1
+ import { jsx as i } from "react/jsx-runtime";
2
+ import { forwardRef as n } from "react";
3
+ const a = n(
4
+ ({ children: d, type: t = "text", value: r, defaultValue: e, ...o }, p) => /* @__PURE__ */ i(
5
+ "input",
6
+ {
7
+ ...o,
8
+ defaultValue: r ?? e,
9
+ type: t,
10
+ ref: p
11
+ }
12
+ )
13
+ );
14
+ a.displayName = "Input";
15
+ export {
16
+ a as Input
17
+ };
@@ -0,0 +1,54 @@
1
+ import { FormTextFieldIcon as e } from "@webstudio-is/icons/svg";
2
+ import { defaultStates as t } from "@webstudio-is/react-sdk";
3
+ import { input as o } from "@webstudio-is/sdk/normalize.css";
4
+ import { props as l } from "./__generated__/input.props.js";
5
+ const r = {
6
+ input: [
7
+ ...o,
8
+ {
9
+ property: "display",
10
+ value: { type: "keyword", value: "block" }
11
+ }
12
+ ]
13
+ }, p = {
14
+ category: "forms",
15
+ constraints: {
16
+ relation: "ancestor",
17
+ component: { $nin: ["Button", "Link"] }
18
+ },
19
+ type: "control",
20
+ label: "Text Input",
21
+ description: "A single-line text input for collecting string data from your users.",
22
+ icon: e,
23
+ presetStyle: r,
24
+ order: 3,
25
+ states: [
26
+ ...t,
27
+ { selector: "::placeholder", label: "Placeholder" },
28
+ { selector: ":valid", label: "Valid" },
29
+ { selector: ":invalid", label: "Invalid" },
30
+ { selector: ":required", label: "Required" },
31
+ { selector: ":optional", label: "Optional" }
32
+ // Additional states will go into submenu
33
+ //{ selector: ":disabled", label: "Disabled" },
34
+ //{ selector: ":enabled", label: "Enabled" },
35
+ //{ selector: ":read-only", label: "Read Only" },
36
+ //{ selector: ":read-write", label: "Read Write" },
37
+ ]
38
+ }, c = {
39
+ props: l,
40
+ initialProps: [
41
+ "id",
42
+ "className",
43
+ "name",
44
+ "value",
45
+ "type",
46
+ "placeholder",
47
+ "required",
48
+ "autoFocus"
49
+ ]
50
+ };
51
+ export {
52
+ p as meta,
53
+ c as propsMeta
54
+ };
package/lib/italic.js ADDED
@@ -0,0 +1,7 @@
1
+ import { jsx as i } from "react/jsx-runtime";
2
+ import { forwardRef as t } from "react";
3
+ const a = t((o, r) => /* @__PURE__ */ i("i", { ...o, ref: r }));
4
+ a.displayName = "Italic";
5
+ export {
6
+ a as Italic
7
+ };
@@ -0,0 +1,26 @@
1
+ import { TextItalicIcon as t } from "@webstudio-is/icons/svg";
2
+ import { defaultStates as e } from "@webstudio-is/react-sdk";
3
+ import { i as o } from "@webstudio-is/sdk/normalize.css";
4
+ import { props as i } from "./__generated__/italic.props.js";
5
+ const r = {
6
+ i: [
7
+ ...o,
8
+ {
9
+ property: "fontStyle",
10
+ value: { type: "keyword", value: "italic" }
11
+ }
12
+ ]
13
+ }, c = {
14
+ type: "rich-text-child",
15
+ label: "Italic Text",
16
+ icon: t,
17
+ states: e,
18
+ presetStyle: r
19
+ }, m = {
20
+ props: i,
21
+ initialProps: ["id", "className"]
22
+ };
23
+ export {
24
+ c as meta,
25
+ m as propsMeta
26
+ };
package/lib/label.js ADDED
@@ -0,0 +1,7 @@
1
+ import { jsx as a } from "react/jsx-runtime";
2
+ import { forwardRef as e } from "react";
3
+ const l = e((o, r) => /* @__PURE__ */ a("label", { ...o, ref: r }));
4
+ l.displayName = "Label";
5
+ export {
6
+ l as Label
7
+ };
@@ -0,0 +1,10 @@
1
+ import { jsx as e } from "react/jsx-runtime";
2
+ import { $ as r, PlaceholderValue as o } from "@webstudio-is/template";
3
+ const a = {
4
+ category: "forms",
5
+ order: 2,
6
+ template: /* @__PURE__ */ e(r.Label, { children: new o("Form Label") })
7
+ };
8
+ export {
9
+ a as meta
10
+ };
@@ -0,0 +1,27 @@
1
+ import { LabelIcon as t } from "@webstudio-is/icons/svg";
2
+ import { defaultStates as o } from "@webstudio-is/react-sdk";
3
+ import { label as e } from "@webstudio-is/sdk/normalize.css";
4
+ import { props as r } from "./__generated__/label.props.js";
5
+ const a = {
6
+ label: [
7
+ ...e,
8
+ { property: "display", value: { type: "keyword", value: "block" } }
9
+ ]
10
+ }, i = {
11
+ constraints: {
12
+ relation: "ancestor",
13
+ component: { $nin: ["Button", "Link"] }
14
+ },
15
+ type: "container",
16
+ label: "Input Label",
17
+ icon: t,
18
+ states: o,
19
+ presetStyle: a
20
+ }, m = {
21
+ props: r,
22
+ initialProps: ["id", "className", "htmlFor"]
23
+ };
24
+ export {
25
+ i as meta,
26
+ m as propsMeta
27
+ };
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
+ };
@@ -0,0 +1,11 @@
1
+ import { jsx as e } from "react/jsx-runtime";
2
+ import { $ as o } from "@webstudio-is/template";
3
+ const n = {
4
+ category: "general",
5
+ description: "Use a link to send your users to another page, section, or resource. Configure links in the Settings panel.",
6
+ order: 1,
7
+ template: /* @__PURE__ */ e(o.Link, {})
8
+ };
9
+ export {
10
+ n as meta
11
+ };
package/lib/link.ws.js ADDED
@@ -0,0 +1,47 @@
1
+ import { LinkIcon as e } from "@webstudio-is/icons/svg";
2
+ import { defaultStates as t } from "@webstudio-is/react-sdk";
3
+ import { a as r } from "@webstudio-is/sdk/normalize.css";
4
+ import { props as o } from "./__generated__/link.props.js";
5
+ const a = {
6
+ a: [
7
+ ...r,
8
+ {
9
+ property: "display",
10
+ value: { type: "keyword", value: "inline-block" }
11
+ }
12
+ ]
13
+ }, l = {
14
+ type: "container",
15
+ icon: e,
16
+ constraints: {
17
+ relation: "ancestor",
18
+ component: { $nin: ["Button", "Link"] }
19
+ },
20
+ presetStyle: a,
21
+ states: [
22
+ ...t,
23
+ {
24
+ selector: ":visited",
25
+ label: "Visited"
26
+ },
27
+ {
28
+ category: "component-states",
29
+ selector: "[aria-current=page]",
30
+ label: "Current page"
31
+ }
32
+ ]
33
+ }, c = {
34
+ props: {
35
+ ...o,
36
+ href: {
37
+ type: "string",
38
+ control: "url",
39
+ required: !1
40
+ }
41
+ },
42
+ initialProps: ["id", "className", "href", "target", "prefetch", "download"]
43
+ };
44
+ export {
45
+ l as meta,
46
+ c as propsMeta
47
+ };
@@ -0,0 +1,9 @@
1
+ import { jsx as o } from "react/jsx-runtime";
2
+ import { forwardRef as e } from "react";
3
+ const i = e(
4
+ ({ children: r, ...t }, m) => /* @__PURE__ */ o("li", { ...t, ref: m, children: r })
5
+ );
6
+ i.displayName = "ListItem";
7
+ export {
8
+ i as ListItem
9
+ };
@@ -0,0 +1,11 @@
1
+ import { jsx as t } from "react/jsx-runtime";
2
+ import { $ as e } from "@webstudio-is/template";
3
+ const i = {
4
+ category: "typography",
5
+ description: "Adds a new item to an existing list.",
6
+ order: 5,
7
+ template: /* @__PURE__ */ t(e.ListItem, {})
8
+ };
9
+ export {
10
+ i as meta
11
+ };
@@ -0,0 +1,26 @@
1
+ import { ListItemIcon as t } from "@webstudio-is/icons/svg";
2
+ import { defaultStates as o } from "@webstudio-is/react-sdk";
3
+ import { li as e } from "@webstudio-is/sdk/normalize.css";
4
+ import { props as r } from "./__generated__/list-item.props.js";
5
+ const s = {
6
+ li: e
7
+ }, m = {
8
+ type: "container",
9
+ constraints: {
10
+ // cannot use parent relation here
11
+ // because list item can be put inside of collection or slot
12
+ // perhaps can be eventually fixed with tag matchers
13
+ relation: "ancestor",
14
+ component: { $eq: "List" }
15
+ },
16
+ icon: t,
17
+ states: o,
18
+ presetStyle: s
19
+ }, c = {
20
+ props: r,
21
+ initialProps: ["id", "className"]
22
+ };
23
+ export {
24
+ m as meta,
25
+ c as propsMeta
26
+ };
package/lib/list.js ADDED
@@ -0,0 +1,6 @@
1
+ import { forwardRef as o, createElement as a } from "react";
2
+ const s = "ul", n = "ol", d = o(({ ordered: e = !1, ...t }, r) => a(e ? n : s, { ...t, ref: r }));
3
+ d.displayName = "List";
4
+ export {
5
+ d as List
6
+ };
@@ -0,0 +1,15 @@
1
+ import { jsxs as n, jsx as t } from "react/jsx-runtime";
2
+ import { $ as e, PlaceholderValue as i } from "@webstudio-is/template";
3
+ const s = {
4
+ category: "typography",
5
+ description: "Groups content, like links in a menu or steps in a recipe.",
6
+ order: 4,
7
+ template: /* @__PURE__ */ n(e.List, { children: [
8
+ /* @__PURE__ */ t(e.ListItem, { children: new i("List Item text you can edit") }),
9
+ /* @__PURE__ */ t(e.ListItem, { children: new i("List Item text you can edit") }),
10
+ /* @__PURE__ */ t(e.ListItem, { children: new i("List Item text you can edit") })
11
+ ] })
12
+ };
13
+ export {
14
+ s as meta
15
+ };
package/lib/list.ws.js ADDED
@@ -0,0 +1,48 @@
1
+ import { ListIcon as e } from "@webstudio-is/icons/svg";
2
+ import { defaultStates as r } from "@webstudio-is/react-sdk";
3
+ import { ol as t, ul as o } from "@webstudio-is/sdk/normalize.css";
4
+ import { props as p } from "./__generated__/list.props.js";
5
+ const a = {
6
+ ol: [
7
+ ...t,
8
+ {
9
+ property: "marginTop",
10
+ value: { type: "keyword", value: "0" }
11
+ },
12
+ {
13
+ property: "marginBottom",
14
+ value: { type: "keyword", value: "10px" }
15
+ },
16
+ {
17
+ property: "paddingLeft",
18
+ value: { type: "keyword", value: "40px" }
19
+ }
20
+ ],
21
+ ul: [
22
+ ...o,
23
+ {
24
+ property: "marginTop",
25
+ value: { type: "keyword", value: "0" }
26
+ },
27
+ {
28
+ property: "marginBottom",
29
+ value: { type: "keyword", value: "10px" }
30
+ },
31
+ {
32
+ property: "paddingLeft",
33
+ value: { type: "keyword", value: "40px" }
34
+ }
35
+ ]
36
+ }, d = {
37
+ type: "container",
38
+ icon: e,
39
+ states: r,
40
+ presetStyle: a
41
+ }, s = {
42
+ props: p,
43
+ initialProps: ["id", "className", "ordered", "start", "reversed"]
44
+ };
45
+ export {
46
+ d as meta,
47
+ s as propsMeta
48
+ };
@@ -0,0 +1,19 @@
1
+ import { jsx as n } from "react/jsx-runtime";
2
+ import { micromark as s } from "micromark";
3
+ import { gfmTable as l, gfmTableHtml 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: [l()],
11
+ htmlExtensions: [i()]
12
+ }),
13
+ [o]
14
+ );
15
+ return /* @__PURE__ */ n("div", { ...t, ref: e, dangerouslySetInnerHTML: { __html: m } });
16
+ });
17
+ export {
18
+ h as MarkdownEmbed
19
+ };