@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.
Files changed (297) hide show
  1. package/LICENSE +661 -0
  2. package/README.md +3 -0
  3. package/lib/__generated__/blockquote.props.js +4 -0
  4. package/lib/__generated__/body.props.js +4 -0
  5. package/lib/__generated__/bold.props.js +4 -0
  6. package/lib/__generated__/box.props.js +6 -0
  7. package/lib/__generated__/button.props.js +4 -0
  8. package/lib/__generated__/checkbox.props.js +11 -0
  9. package/lib/__generated__/code-text.props.js +6 -0
  10. package/lib/__generated__/form.props.js +4 -0
  11. package/lib/__generated__/head-link.props.js +4 -0
  12. package/lib/__generated__/head-meta.props.js +4 -0
  13. package/lib/__generated__/head-slot.props.js +4 -0
  14. package/lib/__generated__/head-title.props.js +4 -0
  15. package/lib/__generated__/heading.props.js +6 -0
  16. package/lib/__generated__/html-embed.props.js +18 -0
  17. package/lib/__generated__/image.props.js +13 -0
  18. package/lib/__generated__/input.props.js +4 -0
  19. package/lib/__generated__/italic.props.js +4 -0
  20. package/lib/__generated__/label.props.js +4 -0
  21. package/lib/__generated__/link.props.js +27 -0
  22. package/lib/__generated__/list-item.props.js +4 -0
  23. package/lib/__generated__/list.props.js +12 -0
  24. package/lib/__generated__/markdown-embed.props.js +6 -0
  25. package/lib/__generated__/option.props.js +4 -0
  26. package/lib/__generated__/paragraph.props.js +4 -0
  27. package/lib/__generated__/radio-button.props.js +11 -0
  28. package/lib/__generated__/select.props.js +4 -0
  29. package/lib/__generated__/separator.props.js +4 -0
  30. package/lib/__generated__/span.props.js +4 -0
  31. package/lib/__generated__/subscript.props.js +4 -0
  32. package/lib/__generated__/superscript.props.js +4 -0
  33. package/lib/__generated__/text.props.js +6 -0
  34. package/lib/__generated__/textarea.props.js +4 -0
  35. package/lib/__generated__/time.props.js +305 -0
  36. package/lib/__generated__/video.props.js +4 -0
  37. package/lib/__generated__/vimeo-play-button.props.js +4 -0
  38. package/lib/__generated__/vimeo-preview-image.props.js +12 -0
  39. package/lib/__generated__/vimeo-spinner.props.js +4 -0
  40. package/lib/__generated__/vimeo.props.js +170 -0
  41. package/lib/__generated__/webhook-form.props.js +13 -0
  42. package/lib/__generated__/xml-node.props.js +26 -0
  43. package/lib/__generated__/xml-time.props.js +19 -0
  44. package/lib/__generated__/youtube.props.js +168 -0
  45. package/lib/blockquote.js +9 -0
  46. package/lib/blockquote.ws.js +56 -0
  47. package/lib/body.js +7 -0
  48. package/lib/body.ws.js +10 -0
  49. package/lib/bold.js +7 -0
  50. package/lib/bold.ws.js +11 -0
  51. package/lib/box.js +12 -0
  52. package/lib/box.ws.js +41 -0
  53. package/lib/button.js +9 -0
  54. package/lib/button.ws.js +10 -0
  55. package/lib/checkbox.js +15 -0
  56. package/lib/checkbox.ws.js +20 -0
  57. package/lib/code-text.js +10 -0
  58. package/lib/code-text.ws.js +51 -0
  59. package/lib/components.js +91 -0
  60. package/lib/content-embed.template.js +83 -0
  61. package/lib/form.js +7 -0
  62. package/lib/form.ws.js +16 -0
  63. package/lib/fragment.js +7 -0
  64. package/lib/fragment.ws.js +4 -0
  65. package/lib/head-link.js +23 -0
  66. package/lib/head-link.ws.js +14 -0
  67. package/lib/head-meta.js +23 -0
  68. package/lib/head-meta.ws.js +14 -0
  69. package/lib/head-slot.js +53 -0
  70. package/lib/head-slot.template.js +15 -0
  71. package/lib/head-slot.ws.js +14 -0
  72. package/lib/head-title.js +23 -0
  73. package/lib/head-title.ws.js +13 -0
  74. package/lib/heading.js +12 -0
  75. package/lib/heading.ws.js +25 -0
  76. package/lib/home_wsKvRSqvkajPPBeycZ-C8.svg +3 -0
  77. package/lib/hooks.js +6 -0
  78. package/lib/html-embed-patchers.js +29 -0
  79. package/lib/html-embed.js +112 -0
  80. package/lib/html-embed.ws.js +48 -0
  81. package/lib/image.js +38 -0
  82. package/lib/image.ws.js +53 -0
  83. package/lib/input.js +21 -0
  84. package/lib/input.ws.js +28 -0
  85. package/lib/italic.js +7 -0
  86. package/lib/italic.ws.js +11 -0
  87. package/lib/label.js +7 -0
  88. package/lib/label.ws.js +16 -0
  89. package/lib/link.js +15 -0
  90. package/lib/link.ws.js +26 -0
  91. package/lib/list-item.js +9 -0
  92. package/lib/list-item.ws.js +10 -0
  93. package/lib/list.js +6 -0
  94. package/lib/list.ws.js +41 -0
  95. package/lib/markdown-embed.js +19 -0
  96. package/lib/markdown-embed.template.js +75 -0
  97. package/lib/markdown-embed.ws.js +35 -0
  98. package/lib/metas.js +92 -0
  99. package/lib/option.js +9 -0
  100. package/lib/option.ws.js +35 -0
  101. package/lib/paragraph.js +7 -0
  102. package/lib/paragraph.ws.js +10 -0
  103. package/lib/radio-button.js +15 -0
  104. package/lib/radio-button.ws.js +21 -0
  105. package/lib/rich-text-link.ws.js +5 -0
  106. package/lib/select.js +32 -0
  107. package/lib/select.ws.js +26 -0
  108. package/lib/separator.js +9 -0
  109. package/lib/separator.ws.js +38 -0
  110. package/lib/shared/video.js +13 -0
  111. package/lib/slot.js +14 -0
  112. package/lib/slot.ws.js +10 -0
  113. package/lib/span.js +7 -0
  114. package/lib/span.ws.js +13 -0
  115. package/lib/subscript.js +7 -0
  116. package/lib/subscript.ws.js +11 -0
  117. package/lib/superscript.js +7 -0
  118. package/lib/superscript.ws.js +11 -0
  119. package/lib/templates.js +14 -0
  120. package/lib/text.js +12 -0
  121. package/lib/text.ws.js +28 -0
  122. package/lib/textarea.js +18 -0
  123. package/lib/textarea.ws.js +33 -0
  124. package/lib/time.js +320 -0
  125. package/lib/time.ws.js +18 -0
  126. package/lib/types/__generated__/blockquote.props.d.ts +2 -0
  127. package/lib/types/__generated__/body.props.d.ts +2 -0
  128. package/lib/types/__generated__/bold.props.d.ts +2 -0
  129. package/lib/types/__generated__/box.props.d.ts +2 -0
  130. package/lib/types/__generated__/button.props.d.ts +2 -0
  131. package/lib/types/__generated__/checkbox.props.d.ts +2 -0
  132. package/lib/types/__generated__/code-text.props.d.ts +2 -0
  133. package/lib/types/__generated__/form.props.d.ts +2 -0
  134. package/lib/types/__generated__/fragment.props.d.ts +2 -0
  135. package/lib/types/__generated__/head-link.props.d.ts +2 -0
  136. package/lib/types/__generated__/head-meta.props.d.ts +2 -0
  137. package/lib/types/__generated__/head-slot.props.d.ts +2 -0
  138. package/lib/types/__generated__/head-title.props.d.ts +2 -0
  139. package/lib/types/__generated__/heading.props.d.ts +2 -0
  140. package/lib/types/__generated__/html-embed.props.d.ts +2 -0
  141. package/lib/types/__generated__/image.props.d.ts +2 -0
  142. package/lib/types/__generated__/input.props.d.ts +2 -0
  143. package/lib/types/__generated__/italic.props.d.ts +2 -0
  144. package/lib/types/__generated__/label.props.d.ts +2 -0
  145. package/lib/types/__generated__/link.props.d.ts +2 -0
  146. package/lib/types/__generated__/list-item.props.d.ts +2 -0
  147. package/lib/types/__generated__/list.props.d.ts +2 -0
  148. package/lib/types/__generated__/markdown-embed.props.d.ts +2 -0
  149. package/lib/types/__generated__/option.props.d.ts +2 -0
  150. package/lib/types/__generated__/paragraph.props.d.ts +2 -0
  151. package/lib/types/__generated__/radio-button.props.d.ts +2 -0
  152. package/lib/types/__generated__/rich-text-link.props.d.ts +2 -0
  153. package/lib/types/__generated__/select.props.d.ts +2 -0
  154. package/lib/types/__generated__/separator.props.d.ts +2 -0
  155. package/lib/types/__generated__/slot.props.d.ts +2 -0
  156. package/lib/types/__generated__/span.props.d.ts +2 -0
  157. package/lib/types/__generated__/subscript.props.d.ts +2 -0
  158. package/lib/types/__generated__/superscript.props.d.ts +2 -0
  159. package/lib/types/__generated__/text.props.d.ts +2 -0
  160. package/lib/types/__generated__/textarea.props.d.ts +2 -0
  161. package/lib/types/__generated__/time.props.d.ts +2 -0
  162. package/lib/types/__generated__/video.props.d.ts +2 -0
  163. package/lib/types/__generated__/vimeo-play-button.props.d.ts +2 -0
  164. package/lib/types/__generated__/vimeo-preview-image.props.d.ts +2 -0
  165. package/lib/types/__generated__/vimeo-spinner.props.d.ts +2 -0
  166. package/lib/types/__generated__/vimeo.props.d.ts +2 -0
  167. package/lib/types/__generated__/webhook-form.props.d.ts +2 -0
  168. package/lib/types/__generated__/xml-node.props.d.ts +2 -0
  169. package/lib/types/__generated__/xml-time.props.d.ts +2 -0
  170. package/lib/types/__generated__/youtube.props.d.ts +2 -0
  171. package/lib/types/blockquote.d.ts +2 -0
  172. package/lib/types/blockquote.ws.d.ts +2 -0
  173. package/lib/types/body.d.ts +2 -0
  174. package/lib/types/body.ws.d.ts +2 -0
  175. package/lib/types/bold.d.ts +2 -0
  176. package/lib/types/bold.ws.d.ts +2 -0
  177. package/lib/types/box.d.ts +7 -0
  178. package/lib/types/box.ws.d.ts +2 -0
  179. package/lib/types/button.d.ts +2 -0
  180. package/lib/types/button.ws.d.ts +2 -0
  181. package/lib/types/checkbox.d.ts +4 -0
  182. package/lib/types/checkbox.ws.d.ts +2 -0
  183. package/lib/types/code-text.d.ts +4 -0
  184. package/lib/types/code-text.ws.d.ts +2 -0
  185. package/lib/types/components.d.ts +45 -0
  186. package/lib/types/content-embed.template.d.ts +2 -0
  187. package/lib/types/form.d.ts +2 -0
  188. package/lib/types/form.ws.d.ts +2 -0
  189. package/lib/types/fragment.d.ts +6 -0
  190. package/lib/types/fragment.ws.d.ts +2 -0
  191. package/lib/types/head-link.d.ts +8 -0
  192. package/lib/types/head-link.ws.d.ts +2 -0
  193. package/lib/types/head-meta.d.ts +2 -0
  194. package/lib/types/head-meta.ws.d.ts +2 -0
  195. package/lib/types/head-slot.d.ts +9 -0
  196. package/lib/types/head-slot.template.d.ts +2 -0
  197. package/lib/types/head-slot.ws.d.ts +2 -0
  198. package/lib/types/head-title.d.ts +2 -0
  199. package/lib/types/head-title.ws.d.ts +2 -0
  200. package/lib/types/heading.d.ts +7 -0
  201. package/lib/types/heading.ws.d.ts +2 -0
  202. package/lib/types/hooks.d.ts +2 -0
  203. package/lib/types/html-embed-patchers.d.ts +2 -0
  204. package/lib/types/html-embed.d.ts +12 -0
  205. package/lib/types/html-embed.test.d.ts +1 -0
  206. package/lib/types/html-embed.ws.d.ts +2 -0
  207. package/lib/types/image.d.ts +8 -0
  208. package/lib/types/image.ws.d.ts +2 -0
  209. package/lib/types/input.d.ts +1 -0
  210. package/lib/types/input.ws.d.ts +2 -0
  211. package/lib/types/italic.d.ts +2 -0
  212. package/lib/types/italic.ws.d.ts +2 -0
  213. package/lib/types/label.d.ts +2 -0
  214. package/lib/types/label.ws.d.ts +2 -0
  215. package/lib/types/link.d.ts +11 -0
  216. package/lib/types/link.ws.d.ts +2 -0
  217. package/lib/types/list-item.d.ts +2 -0
  218. package/lib/types/list-item.ws.d.ts +2 -0
  219. package/lib/types/list.d.ts +10 -0
  220. package/lib/types/list.ws.d.ts +2 -0
  221. package/lib/types/markdown-embed.d.ts +7 -0
  222. package/lib/types/markdown-embed.template.d.ts +2 -0
  223. package/lib/types/markdown-embed.ws.d.ts +2 -0
  224. package/lib/types/metas.d.ts +45 -0
  225. package/lib/types/option.d.ts +1 -0
  226. package/lib/types/option.ws.d.ts +2 -0
  227. package/lib/types/paragraph.d.ts +2 -0
  228. package/lib/types/paragraph.ws.d.ts +2 -0
  229. package/lib/types/radio-button.d.ts +4 -0
  230. package/lib/types/radio-button.ws.d.ts +2 -0
  231. package/lib/types/rich-text-link.d.ts +1 -0
  232. package/lib/types/rich-text-link.ws.d.ts +2 -0
  233. package/lib/types/select.d.ts +3 -0
  234. package/lib/types/select.ws.d.ts +2 -0
  235. package/lib/types/separator.d.ts +2 -0
  236. package/lib/types/separator.ws.d.ts +2 -0
  237. package/lib/types/shared/video.d.ts +7 -0
  238. package/lib/types/slot.d.ts +6 -0
  239. package/lib/types/slot.ws.d.ts +2 -0
  240. package/lib/types/span.d.ts +2 -0
  241. package/lib/types/span.ws.d.ts +2 -0
  242. package/lib/types/subscript.d.ts +2 -0
  243. package/lib/types/subscript.ws.d.ts +2 -0
  244. package/lib/types/superscript.d.ts +2 -0
  245. package/lib/types/superscript.ws.d.ts +2 -0
  246. package/lib/types/templates.d.ts +6 -0
  247. package/lib/types/test-utils/cartesian.d.ts +2 -0
  248. package/lib/types/text.d.ts +7 -0
  249. package/lib/types/text.ws.d.ts +2 -0
  250. package/lib/types/textarea.d.ts +1 -0
  251. package/lib/types/textarea.ws.d.ts +2 -0
  252. package/lib/types/time.d.ts +16 -0
  253. package/lib/types/time.test.d.ts +1 -0
  254. package/lib/types/time.ws.d.ts +2 -0
  255. package/lib/types/video.d.ts +9 -0
  256. package/lib/types/video.ws.d.ts +2 -0
  257. package/lib/types/vimeo-play-button.d.ts +3 -0
  258. package/lib/types/vimeo-play-button.ws.d.ts +2 -0
  259. package/lib/types/vimeo-preview-image.d.ts +284 -0
  260. package/lib/types/vimeo-preview-image.ws.d.ts +2 -0
  261. package/lib/types/vimeo-spinner.d.ts +1 -0
  262. package/lib/types/vimeo-spinner.ws.d.ts +2 -0
  263. package/lib/types/vimeo.d.ts +79 -0
  264. package/lib/types/vimeo.template.d.ts +2 -0
  265. package/lib/types/vimeo.ws.d.ts +2 -0
  266. package/lib/types/webhook-form.d.ts +9 -0
  267. package/lib/types/webhook-form.template.d.ts +2 -0
  268. package/lib/types/webhook-form.ws.d.ts +2 -0
  269. package/lib/types/xml-node.d.ts +13 -0
  270. package/lib/types/xml-node.ws.d.ts +2 -0
  271. package/lib/types/xml-time.d.ts +6 -0
  272. package/lib/types/xml-time.ws.d.ts +2 -0
  273. package/lib/types/youtube.d.ts +143 -0
  274. package/lib/types/youtube.template.d.ts +2 -0
  275. package/lib/types/youtube.ws.d.ts +2 -0
  276. package/lib/video.js +53 -0
  277. package/lib/video.ws.js +44 -0
  278. package/lib/vimeo-play-button.js +18 -0
  279. package/lib/vimeo-play-button.ws.js +18 -0
  280. package/lib/vimeo-preview-image.js +19 -0
  281. package/lib/vimeo-preview-image.ws.js +25 -0
  282. package/lib/vimeo-spinner.js +13 -0
  283. package/lib/vimeo-spinner.ws.js +18 -0
  284. package/lib/vimeo.js +215 -0
  285. package/lib/vimeo.template.js +94 -0
  286. package/lib/vimeo.ws.js +35 -0
  287. package/lib/webhook-form.js +9 -0
  288. package/lib/webhook-form.template.js +88 -0
  289. package/lib/webhook-form.ws.js +27 -0
  290. package/lib/xml-node.js +61 -0
  291. package/lib/xml-node.ws.js +13 -0
  292. package/lib/xml-time.js +25 -0
  293. package/lib/xml-time.ws.js +13 -0
  294. package/lib/youtube.js +227 -0
  295. package/lib/youtube.template.js +98 -0
  296. package/lib/youtube.ws.js +45 -0
  297. 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
+ };
@@ -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
+ };
@@ -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
@@ -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,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
@@ -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,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
+ };
@@ -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,10 @@
1
+ import { li as o } from "@webstudio-is/sdk/normalize.css";
2
+ import { props as r } from "./__generated__/list-item.props.js";
3
+ const p = {
4
+ presetStyle: { li: o },
5
+ initialProps: ["id", "class"],
6
+ props: r
7
+ };
8
+ export {
9
+ p as meta
10
+ };
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
+ };
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
+ ![Image placeholder](${s})
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
@@ -0,0 +1,9 @@
1
+ import { jsx as r } from "react/jsx-runtime";
2
+ import { forwardRef as t } from "react";
3
+ const i = t(
4
+ (o, p) => /* @__PURE__ */ r("option", { ...o, ref: p })
5
+ );
6
+ i.displayName = "Option";
7
+ export {
8
+ i as Option
9
+ };
@@ -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
+ };
@@ -0,0 +1,7 @@
1
+ import { jsx as p } from "react/jsx-runtime";
2
+ import { forwardRef as m } from "react";
3
+ const f = m(({ children: r, ...a }, o) => /* @__PURE__ */ p("p", { ...a, ref: o, children: r }));
4
+ f.displayName = "Paragraph";
5
+ export {
6
+ f as Paragraph
7
+ };
@@ -0,0 +1,10 @@
1
+ import { p as o } from "@webstudio-is/sdk/normalize.css";
2
+ import { props as p } from "./__generated__/paragraph.props.js";
3
+ const i = {
4
+ presetStyle: { p: o },
5
+ initialProps: ["id", "class"],
6
+ props: p
7
+ };
8
+ export {
9
+ i as meta
10
+ };
@@ -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
+ };
@@ -0,0 +1,5 @@
1
+ import { meta as t } from "./link.ws.js";
2
+ const a = t;
3
+ export {
4
+ a as meta
5
+ };
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
+ };