@webstudio-is/react-sdk 0.51.0 → 0.53.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 (346) hide show
  1. package/lib/cjs/components/{blockquote.cjs → blockquote.js} +2 -1
  2. package/lib/cjs/components/{blockquote.ws.cjs → blockquote.ws.js} +57 -35
  3. package/lib/cjs/components/{body.cjs → body.js} +2 -1
  4. package/lib/cjs/components/{body.ws.cjs → body.ws.js} +30 -46
  5. package/lib/cjs/components/{bold.cjs → bold.js} +2 -1
  6. package/lib/cjs/components/{bold.ws.cjs → bold.ws.js} +6 -1
  7. package/lib/cjs/components/{box.ws.cjs → box.ws.js} +11 -4
  8. package/lib/cjs/components/{button.cjs → button.js} +2 -1
  9. package/lib/cjs/components/{button.ws.cjs → button.ws.js} +6 -1
  10. package/lib/cjs/components/{code.cjs → code.js} +1 -0
  11. package/lib/cjs/components/{code.ws.cjs → code.ws.js} +31 -25
  12. package/lib/cjs/components/{form.cjs → form.js} +2 -1
  13. package/lib/cjs/components/{form.ws.cjs → form.ws.js} +8 -8
  14. package/lib/cjs/components/{heading.ws.cjs → heading.ws.js} +11 -1
  15. package/lib/cjs/components/{image.cjs → image.js} +2 -1
  16. package/lib/cjs/components/{image.ws.cjs → image.ws.js} +15 -11
  17. package/lib/cjs/components/{input.cjs → input.js} +2 -1
  18. package/lib/cjs/components/{input.ws.cjs → input.ws.js} +6 -1
  19. package/lib/cjs/components/{italic.cjs → italic.js} +2 -1
  20. package/lib/cjs/components/{italic.ws.cjs → italic.ws.js} +8 -4
  21. package/lib/cjs/components/{link-block.cjs → link-block.js} +3 -1
  22. package/lib/cjs/components/{link-block.ws.cjs → link-block.ws.js} +7 -7
  23. package/lib/cjs/components/{link.cjs → link.js} +3 -1
  24. package/lib/cjs/components/{link.ws.cjs → link.ws.js} +13 -9
  25. package/lib/cjs/components/{list-item.cjs → list-item.js} +2 -1
  26. package/lib/cjs/components/{list-item.ws.cjs → list-item.ws.js} +6 -1
  27. package/lib/cjs/components/{list.ws.cjs → list.ws.js} +29 -10
  28. package/lib/cjs/components/{paragraph.cjs → paragraph.js} +2 -1
  29. package/lib/cjs/components/{paragraph.ws.cjs → paragraph.ws.js} +6 -1
  30. package/lib/cjs/components/{separator.cjs → separator.js} +2 -1
  31. package/lib/cjs/components/{separator.ws.cjs → separator.ws.js} +27 -11
  32. package/lib/cjs/components/{span.cjs → span.js} +2 -1
  33. package/lib/cjs/components/{span.ws.cjs → span.ws.js} +6 -1
  34. package/lib/cjs/components/{subscript.cjs → subscript.js} +2 -1
  35. package/lib/cjs/components/{subscript.ws.cjs → subscript.ws.js} +6 -1
  36. package/lib/cjs/components/{superscript.cjs → superscript.js} +2 -1
  37. package/lib/cjs/components/{superscript.ws.cjs → superscript.ws.js} +6 -1
  38. package/lib/cjs/components/{text-block.cjs → text-block.js} +2 -1
  39. package/lib/cjs/components/{text-block.ws.cjs → text-block.ws.js} +9 -5
  40. package/lib/cjs/css/css.js +64 -0
  41. package/lib/cjs/css/global-rules.js +37 -0
  42. package/lib/cjs/css/{index.cjs → index.js} +3 -1
  43. package/lib/cjs/css/normalize-type-check.js +26 -0
  44. package/lib/cjs/css/normalize.js +358 -0
  45. package/lib/cjs/css/presets.js +61 -0
  46. package/lib/cjs/css/style-rules.js +62 -0
  47. package/lib/cjs/package.json +1 -0
  48. package/lib/cjs/pubsub/{create.cjs → create.js} +6 -35
  49. package/lib/cjs/pubsub/raf-queue.js +45 -0
  50. package/lib/cjs/tree/{webstudio-component.cjs → webstudio-component.js} +1 -0
  51. package/lib/components/blockquote.js +2 -1
  52. package/lib/components/blockquote.ws.js +57 -35
  53. package/lib/components/body.js +2 -1
  54. package/lib/components/body.ws.js +30 -46
  55. package/lib/components/bold.js +2 -1
  56. package/lib/components/bold.ws.js +7 -2
  57. package/lib/components/box.ws.js +22 -4
  58. package/lib/components/button.js +2 -1
  59. package/lib/components/button.ws.js +7 -2
  60. package/lib/components/code.js +1 -0
  61. package/lib/components/code.ws.js +31 -25
  62. package/lib/components/form.js +2 -1
  63. package/lib/components/form.ws.js +8 -8
  64. package/lib/components/heading.ws.js +11 -1
  65. package/lib/components/image.js +2 -1
  66. package/lib/components/image.ws.js +15 -11
  67. package/lib/components/input.js +2 -1
  68. package/lib/components/input.ws.js +7 -2
  69. package/lib/components/italic.js +2 -1
  70. package/lib/components/italic.ws.js +9 -5
  71. package/lib/components/link-block.js +3 -1
  72. package/lib/components/link-block.ws.js +7 -7
  73. package/lib/components/link.js +3 -1
  74. package/lib/components/link.ws.js +14 -10
  75. package/lib/components/list-item.js +2 -1
  76. package/lib/components/list-item.ws.js +6 -1
  77. package/lib/components/list.ws.js +29 -10
  78. package/lib/components/paragraph.js +2 -1
  79. package/lib/components/paragraph.ws.js +6 -1
  80. package/lib/components/separator.js +2 -1
  81. package/lib/components/separator.ws.js +27 -11
  82. package/lib/components/span.js +2 -1
  83. package/lib/components/span.ws.js +7 -2
  84. package/lib/components/subscript.js +2 -1
  85. package/lib/components/subscript.ws.js +6 -1
  86. package/lib/components/superscript.js +2 -1
  87. package/lib/components/superscript.ws.js +6 -1
  88. package/lib/components/text-block.js +2 -1
  89. package/lib/components/text-block.ws.js +10 -6
  90. package/lib/css/css.js +44 -0
  91. package/lib/css/get-browser-style.js +3 -1
  92. package/lib/css/global-rules.js +20 -0
  93. package/lib/css/index.js +3 -1
  94. package/lib/css/normalize-type-check.js +3 -0
  95. package/lib/css/normalize.js +338 -0
  96. package/lib/css/presets.js +41 -0
  97. package/lib/css/style-rules.js +42 -0
  98. package/lib/pubsub/create.js +6 -25
  99. package/lib/pubsub/raf-queue.js +25 -0
  100. package/lib/tree/webstudio-component.js +1 -0
  101. package/lib/types/app/custom-components/image.d.ts +6 -0
  102. package/lib/types/app/custom-components/index.d.ts +26 -0
  103. package/lib/types/app/custom-components/link-block.d.ts +6 -0
  104. package/lib/types/app/custom-components/link.d.ts +6 -0
  105. package/lib/types/app/custom-components/rich-text-link.d.ts +6 -0
  106. package/lib/types/app/custom-components/shared/remix-link.d.ts +10 -0
  107. package/lib/types/app/handle-request.server.d.ts +2 -0
  108. package/lib/types/app/index.d.ts +3 -0
  109. package/lib/types/app/params.d.ts +5 -0
  110. package/lib/types/app/root.d.ts +8 -0
  111. package/lib/types/components/__generated__/blockquote.props.d.ts +2 -0
  112. package/lib/types/components/__generated__/body.props.d.ts +2 -0
  113. package/lib/types/components/__generated__/bold.props.d.ts +2 -0
  114. package/lib/types/components/__generated__/box.props.d.ts +2 -0
  115. package/lib/types/components/__generated__/button.props.d.ts +2 -0
  116. package/lib/types/components/__generated__/code.props.d.ts +2 -0
  117. package/lib/types/components/__generated__/form.props.d.ts +2 -0
  118. package/lib/types/components/__generated__/fragment.props.d.ts +2 -0
  119. package/lib/types/components/__generated__/heading.props.d.ts +2 -0
  120. package/lib/types/components/__generated__/image.props.d.ts +2 -0
  121. package/lib/types/components/__generated__/input.props.d.ts +2 -0
  122. package/lib/types/components/__generated__/italic.props.d.ts +2 -0
  123. package/lib/types/components/__generated__/link-block.props.d.ts +2 -0
  124. package/lib/types/components/__generated__/link.props.d.ts +2 -0
  125. package/lib/types/components/__generated__/list-item.props.d.ts +2 -0
  126. package/lib/types/components/__generated__/list.props.d.ts +2 -0
  127. package/lib/types/components/__generated__/paragraph.props.d.ts +2 -0
  128. package/lib/types/components/__generated__/rich-text-link.props.d.ts +2 -0
  129. package/lib/types/components/__generated__/separator.props.d.ts +2 -0
  130. package/lib/types/components/__generated__/slot.props.d.ts +2 -0
  131. package/lib/types/components/__generated__/span.props.d.ts +2 -0
  132. package/lib/types/components/__generated__/subscript.props.d.ts +2 -0
  133. package/lib/types/components/__generated__/superscript.props.d.ts +2 -0
  134. package/lib/types/components/__generated__/text-block.props.d.ts +2 -0
  135. package/lib/types/components/blockquote.d.ts +3 -0
  136. package/lib/types/components/blockquote.stories.d.ts +5 -0
  137. package/lib/types/components/blockquote.ws.d.ts +3 -0
  138. package/lib/types/components/body.d.ts +3 -0
  139. package/lib/types/components/body.stories.d.ts +6 -0
  140. package/lib/types/components/body.ws.d.ts +3 -0
  141. package/lib/types/components/bold.d.ts +3 -0
  142. package/lib/types/components/bold.stories.d.ts +5 -0
  143. package/lib/types/components/bold.ws.d.ts +3 -0
  144. package/lib/types/components/box.d.ts +7 -0
  145. package/lib/types/components/box.stories.d.ts +9 -0
  146. package/lib/types/components/box.ws.d.ts +3 -0
  147. package/lib/types/components/button.d.ts +7 -0
  148. package/lib/types/components/button.stories.d.ts +9 -0
  149. package/lib/types/components/button.ws.d.ts +3 -0
  150. package/lib/types/components/code.d.ts +9 -0
  151. package/lib/types/components/code.stories.d.ts +11 -0
  152. package/lib/types/components/code.ws.d.ts +3 -0
  153. package/lib/types/components/component-meta.d.ts +605 -0
  154. package/lib/types/components/components-utils.d.ts +34 -0
  155. package/lib/types/components/components.d.ts +31 -0
  156. package/lib/types/components/form.d.ts +3 -0
  157. package/lib/types/components/form.stories.d.ts +5 -0
  158. package/lib/types/components/form.ws.d.ts +3 -0
  159. package/lib/types/components/fragment.d.ts +6 -0
  160. package/lib/types/components/fragment.ws.d.ts +3 -0
  161. package/lib/types/components/heading.d.ts +7 -0
  162. package/lib/types/components/heading.stories.d.ts +9 -0
  163. package/lib/types/components/heading.ws.d.ts +3 -0
  164. package/lib/types/components/image.d.ts +3 -0
  165. package/lib/types/components/image.stories.d.ts +5 -0
  166. package/lib/types/components/image.ws.d.ts +3 -0
  167. package/lib/types/components/index.d.ts +17 -0
  168. package/lib/types/components/input.d.ts +3 -0
  169. package/lib/types/components/input.stories.d.ts +5 -0
  170. package/lib/types/components/input.ws.d.ts +3 -0
  171. package/lib/types/components/italic.d.ts +3 -0
  172. package/lib/types/components/italic.stories.d.ts +5 -0
  173. package/lib/types/components/italic.ws.d.ts +3 -0
  174. package/lib/types/components/link-block.d.ts +3 -0
  175. package/lib/types/components/link-block.stories.d.ts +13 -0
  176. package/lib/types/components/link-block.ws.d.ts +3 -0
  177. package/lib/types/components/link.d.ts +9 -0
  178. package/lib/types/components/link.stories.d.ts +13 -0
  179. package/lib/types/components/link.ws.d.ts +3 -0
  180. package/lib/types/components/list-item.d.ts +3 -0
  181. package/lib/types/components/list-item.stories.d.ts +5 -0
  182. package/lib/types/components/list-item.ws.d.ts +3 -0
  183. package/lib/types/components/list.d.ts +9 -0
  184. package/lib/types/components/list.stories.d.ts +9 -0
  185. package/lib/types/components/list.ws.d.ts +3 -0
  186. package/lib/types/components/paragraph.d.ts +3 -0
  187. package/lib/types/components/paragraph.stories.d.ts +5 -0
  188. package/lib/types/components/paragraph.ws.d.ts +3 -0
  189. package/lib/types/components/rich-text-link.d.ts +2 -0
  190. package/lib/types/components/rich-text-link.stories.d.ts +13 -0
  191. package/lib/types/components/rich-text-link.ws.d.ts +3 -0
  192. package/lib/types/components/separator.d.ts +3 -0
  193. package/lib/types/components/separator.stories.d.ts +5 -0
  194. package/lib/types/components/separator.ws.d.ts +3 -0
  195. package/lib/types/components/slot.d.ts +6 -0
  196. package/lib/types/components/slot.stories.d.ts +9 -0
  197. package/lib/types/components/slot.ws.d.ts +3 -0
  198. package/lib/types/components/span.d.ts +3 -0
  199. package/lib/types/components/span.stories.d.ts +5 -0
  200. package/lib/types/components/span.ws.d.ts +3 -0
  201. package/lib/types/components/subscript.d.ts +3 -0
  202. package/lib/types/components/subscript.stories.d.ts +5 -0
  203. package/lib/types/components/subscript.ws.d.ts +3 -0
  204. package/lib/types/components/superscript.d.ts +3 -0
  205. package/lib/types/components/superscript.stories.d.ts +5 -0
  206. package/lib/types/components/superscript.ws.d.ts +3 -0
  207. package/lib/types/components/text-block.d.ts +3 -0
  208. package/lib/types/components/text-block.stories.d.ts +5 -0
  209. package/lib/types/components/text-block.ws.d.ts +3 -0
  210. package/lib/types/context.d.ts +9 -0
  211. package/lib/types/css/css.d.ts +10 -0
  212. package/lib/types/css/get-browser-style.d.ts +2 -0
  213. package/lib/types/css/global-rules.d.ts +44 -0
  214. package/lib/types/css/index.d.ts +4 -0
  215. package/lib/types/css/normalize-type-check.d.ts +1 -0
  216. package/lib/types/css/normalize.d.ts +2429 -0
  217. package/lib/types/css/presets.d.ts +38 -0
  218. package/lib/types/css/style-rules.d.ts +248 -0
  219. package/lib/types/css/style-rules.test.d.ts +1 -0
  220. package/lib/types/index.d.ts +9 -0
  221. package/lib/types/props.d.ts +97 -0
  222. package/lib/types/props.test.d.ts +1 -0
  223. package/lib/types/pubsub/create.d.ts +28 -0
  224. package/lib/types/pubsub/index.d.ts +1 -0
  225. package/lib/types/pubsub/raf-queue.d.ts +1 -0
  226. package/lib/types/tree/create-elements-tree.d.ts +16 -0
  227. package/lib/types/tree/index.d.ts +3 -0
  228. package/lib/types/tree/root.d.ts +25 -0
  229. package/lib/types/tree/session-storage-polyfill.d.ts +2 -0
  230. package/lib/types/tree/webstudio-component.d.ts +15 -0
  231. package/package.json +20 -19
  232. package/src/components/blockquote.tsx +1 -1
  233. package/src/components/blockquote.ws.tsx +63 -36
  234. package/src/components/body.tsx +1 -1
  235. package/src/components/body.ws.tsx +39 -47
  236. package/src/components/bold.tsx +1 -1
  237. package/src/components/bold.ws.tsx +10 -2
  238. package/src/components/box.ws.ts +28 -5
  239. package/src/components/button.tsx +1 -1
  240. package/src/components/button.ws.tsx +10 -2
  241. package/src/components/code.tsx +1 -1
  242. package/src/components/code.ws.tsx +36 -28
  243. package/src/components/component-meta.ts +4 -1
  244. package/src/components/form.tsx +1 -1
  245. package/src/components/form.ws.tsx +11 -9
  246. package/src/components/heading.ws.tsx +16 -0
  247. package/src/components/image.tsx +1 -1
  248. package/src/components/image.ws.tsx +19 -12
  249. package/src/components/input.tsx +1 -1
  250. package/src/components/input.ws.tsx +10 -2
  251. package/src/components/italic.tsx +1 -1
  252. package/src/components/italic.ws.tsx +12 -6
  253. package/src/components/link-block.tsx +1 -0
  254. package/src/components/link-block.ws.tsx +10 -8
  255. package/src/components/link.tsx +2 -0
  256. package/src/components/link.ws.tsx +17 -11
  257. package/src/components/list-item.tsx +1 -1
  258. package/src/components/list-item.ws.tsx +8 -0
  259. package/src/components/list.tsx +2 -0
  260. package/src/components/list.ws.tsx +32 -11
  261. package/src/components/paragraph.tsx +1 -1
  262. package/src/components/paragraph.ws.tsx +8 -0
  263. package/src/components/separator.tsx +1 -1
  264. package/src/components/separator.ws.tsx +33 -12
  265. package/src/components/span.tsx +1 -1
  266. package/src/components/span.ws.tsx +10 -2
  267. package/src/components/subscript.tsx +1 -1
  268. package/src/components/subscript.ws.tsx +8 -0
  269. package/src/components/superscript.tsx +1 -1
  270. package/src/components/superscript.ws.tsx +8 -0
  271. package/src/components/text-block.tsx +1 -1
  272. package/src/components/text-block.ws.tsx +14 -7
  273. package/src/context.tsx +2 -1
  274. package/src/css/css.ts +57 -0
  275. package/src/css/get-browser-style.ts +6 -1
  276. package/src/css/global-rules.ts +29 -0
  277. package/src/css/index.ts +3 -1
  278. package/src/css/normalize-type-check.ts +13 -0
  279. package/src/css/normalize.ts +519 -0
  280. package/src/css/presets.ts +42 -0
  281. package/src/css/style-rules.test.ts +147 -0
  282. package/src/css/style-rules.ts +66 -0
  283. package/src/props.ts +0 -2
  284. package/src/pubsub/create.ts +7 -38
  285. package/src/pubsub/raf-queue.ts +31 -0
  286. package/src/tree/create-elements-tree.tsx +2 -1
  287. package/src/tree/webstudio-component.tsx +1 -0
  288. package/lib/cjs/css/categories.cjs +0 -250
  289. package/lib/css/categories.js +0 -230
  290. package/src/css/categories.ts +0 -254
  291. /package/lib/cjs/app/custom-components/{image.cjs → image.js} +0 -0
  292. /package/lib/cjs/app/custom-components/{index.cjs → index.js} +0 -0
  293. /package/lib/cjs/app/custom-components/{link-block.cjs → link-block.js} +0 -0
  294. /package/lib/cjs/app/custom-components/{link.cjs → link.js} +0 -0
  295. /package/lib/cjs/app/custom-components/{rich-text-link.cjs → rich-text-link.js} +0 -0
  296. /package/lib/cjs/app/custom-components/shared/{remix-link.cjs → remix-link.js} +0 -0
  297. /package/lib/cjs/app/{handle-request.server.cjs → handle-request.server.js} +0 -0
  298. /package/lib/cjs/app/{index.cjs → index.js} +0 -0
  299. /package/lib/cjs/app/{params.cjs → params.js} +0 -0
  300. /package/lib/cjs/app/{root.cjs → root.js} +0 -0
  301. /package/lib/cjs/components/__generated__/{blockquote.props.cjs → blockquote.props.js} +0 -0
  302. /package/lib/cjs/components/__generated__/{body.props.cjs → body.props.js} +0 -0
  303. /package/lib/cjs/components/__generated__/{bold.props.cjs → bold.props.js} +0 -0
  304. /package/lib/cjs/components/__generated__/{box.props.cjs → box.props.js} +0 -0
  305. /package/lib/cjs/components/__generated__/{button.props.cjs → button.props.js} +0 -0
  306. /package/lib/cjs/components/__generated__/{code.props.cjs → code.props.js} +0 -0
  307. /package/lib/cjs/components/__generated__/{form.props.cjs → form.props.js} +0 -0
  308. /package/lib/cjs/components/__generated__/{fragment.props.cjs → fragment.props.js} +0 -0
  309. /package/lib/cjs/components/__generated__/{heading.props.cjs → heading.props.js} +0 -0
  310. /package/lib/cjs/components/__generated__/{image.props.cjs → image.props.js} +0 -0
  311. /package/lib/cjs/components/__generated__/{input.props.cjs → input.props.js} +0 -0
  312. /package/lib/cjs/components/__generated__/{italic.props.cjs → italic.props.js} +0 -0
  313. /package/lib/cjs/components/__generated__/{link-block.props.cjs → link-block.props.js} +0 -0
  314. /package/lib/cjs/components/__generated__/{link.props.cjs → link.props.js} +0 -0
  315. /package/lib/cjs/components/__generated__/{list-item.props.cjs → list-item.props.js} +0 -0
  316. /package/lib/cjs/components/__generated__/{list.props.cjs → list.props.js} +0 -0
  317. /package/lib/cjs/components/__generated__/{paragraph.props.cjs → paragraph.props.js} +0 -0
  318. /package/lib/cjs/components/__generated__/{rich-text-link.props.cjs → rich-text-link.props.js} +0 -0
  319. /package/lib/cjs/components/__generated__/{separator.props.cjs → separator.props.js} +0 -0
  320. /package/lib/cjs/components/__generated__/{slot.props.cjs → slot.props.js} +0 -0
  321. /package/lib/cjs/components/__generated__/{span.props.cjs → span.props.js} +0 -0
  322. /package/lib/cjs/components/__generated__/{subscript.props.cjs → subscript.props.js} +0 -0
  323. /package/lib/cjs/components/__generated__/{superscript.props.cjs → superscript.props.js} +0 -0
  324. /package/lib/cjs/components/__generated__/{text-block.props.cjs → text-block.props.js} +0 -0
  325. /package/lib/cjs/components/{box.cjs → box.js} +0 -0
  326. /package/lib/cjs/components/{component-meta.cjs → component-meta.js} +0 -0
  327. /package/lib/cjs/components/{components-utils.cjs → components-utils.js} +0 -0
  328. /package/lib/cjs/components/{components.cjs → components.js} +0 -0
  329. /package/lib/cjs/components/{fragment.cjs → fragment.js} +0 -0
  330. /package/lib/cjs/components/{fragment.ws.cjs → fragment.ws.js} +0 -0
  331. /package/lib/cjs/components/{heading.cjs → heading.js} +0 -0
  332. /package/lib/cjs/components/{index.cjs → index.js} +0 -0
  333. /package/lib/cjs/components/{list.cjs → list.js} +0 -0
  334. /package/lib/cjs/components/{rich-text-link.cjs → rich-text-link.js} +0 -0
  335. /package/lib/cjs/components/{rich-text-link.ws.cjs → rich-text-link.ws.js} +0 -0
  336. /package/lib/cjs/components/{slot.cjs → slot.js} +0 -0
  337. /package/lib/cjs/components/{slot.ws.cjs → slot.ws.js} +0 -0
  338. /package/lib/cjs/{context.cjs → context.js} +0 -0
  339. /package/lib/cjs/css/{get-browser-style.cjs → get-browser-style.js} +0 -0
  340. /package/lib/cjs/{index.cjs → index.js} +0 -0
  341. /package/lib/cjs/{props.cjs → props.js} +0 -0
  342. /package/lib/cjs/pubsub/{index.cjs → index.js} +0 -0
  343. /package/lib/cjs/tree/{create-elements-tree.cjs → create-elements-tree.js} +0 -0
  344. /package/lib/cjs/tree/{index.cjs → index.js} +0 -0
  345. /package/lib/cjs/tree/{root.cjs → root.js} +0 -0
  346. /package/lib/cjs/tree/{session-storage-polyfill.cjs → session-storage-polyfill.js} +0 -0
@@ -5,7 +5,7 @@ import {
5
5
  type ComponentProps,
6
6
  } from "react";
7
7
 
8
- const defaultTag = "blockquote";
8
+ export const defaultTag = "blockquote";
9
9
 
10
10
  type Props = ComponentProps<typeof defaultTag>;
11
11
 
@@ -1,45 +1,72 @@
1
+ import type { Style } from "@webstudio-is/css-data";
1
2
  import { BlockquoteIcon } from "@webstudio-is/icons";
3
+ import type { defaultTag } from "./blockquote";
2
4
  import type { WsComponentMeta, WsComponentPropsMeta } from "./component-meta";
3
5
  import { props } from "./__generated__/blockquote.props";
4
6
 
5
7
  const presetStyle = {
6
- margin: {
7
- type: "keyword",
8
- value: "0",
9
- },
10
- marginBottom: {
11
- type: "keyword",
12
- value: "10px",
13
- },
14
- paddingTop: {
15
- type: "keyword",
16
- value: "10px",
17
- },
18
- paddingBottom: {
19
- type: "keyword",
20
- value: "10px",
21
- },
22
- paddingLeft: {
23
- type: "keyword",
24
- value: "20px",
25
- },
26
- paddingRight: {
27
- type: "keyword",
28
- value: "20px",
29
- },
30
- borderLeftWidth: {
31
- type: "keyword",
32
- value: "5px",
33
- },
34
- borderLeftStyle: {
35
- type: "keyword",
36
- value: "solid",
37
- },
38
- borderLeftColor: {
39
- type: "keyword",
40
- value: "#e2e2e2",
8
+ blockquote: {
9
+ marginTop: {
10
+ type: "unit",
11
+ value: 0,
12
+ unit: "number",
13
+ },
14
+ marginRight: {
15
+ type: "unit",
16
+ value: 0,
17
+ unit: "number",
18
+ },
19
+ marginBottom: {
20
+ type: "unit",
21
+ value: 10,
22
+ unit: "px",
23
+ },
24
+ marginLeft: {
25
+ type: "unit",
26
+ value: 0,
27
+ unit: "number",
28
+ },
29
+
30
+ paddingTop: {
31
+ type: "unit",
32
+ value: 10,
33
+ unit: "px",
34
+ },
35
+ paddingBottom: {
36
+ type: "unit",
37
+ value: 10,
38
+ unit: "px",
39
+ },
40
+ paddingLeft: {
41
+ type: "unit",
42
+ value: 20,
43
+ unit: "px",
44
+ },
45
+ paddingRight: {
46
+ type: "unit",
47
+ value: 20,
48
+ unit: "px",
49
+ },
50
+
51
+ borderLeftWidth: {
52
+ type: "unit",
53
+ value: 5,
54
+ unit: "px",
55
+ },
56
+ borderLeftStyle: {
57
+ type: "keyword",
58
+ value: "solid",
59
+ },
60
+
61
+ borderLeftColor: {
62
+ type: "rgb",
63
+ r: 226,
64
+ g: 226,
65
+ b: 226,
66
+ alpha: 1,
67
+ },
41
68
  },
42
- } as const;
69
+ } as const satisfies Record<typeof defaultTag, Style>;
43
70
 
44
71
  export const meta: WsComponentMeta = {
45
72
  category: "typography",
@@ -1,6 +1,6 @@
1
1
  import { forwardRef, type ElementRef, type ComponentProps } from "react";
2
2
 
3
- const defaultTag = "body";
3
+ export const defaultTag = "body";
4
4
 
5
5
  export const Body = forwardRef<
6
6
  ElementRef<typeof defaultTag>,
@@ -1,56 +1,48 @@
1
1
  import { BodyIcon } from "@webstudio-is/icons";
2
+ import { body } from "../css/normalize";
2
3
  import type { WsComponentMeta, WsComponentPropsMeta } from "./component-meta";
3
4
  import { props } from "./__generated__/body.props";
5
+ import type { defaultTag } from "./body";
6
+ import type { Style } from "@webstudio-is/css-data";
4
7
 
5
8
  const presetStyle = {
6
- marginTop: {
7
- type: "unit",
8
- unit: "px",
9
- value: 0,
10
- },
11
- marginRight: {
12
- type: "unit",
13
- unit: "px",
14
- value: 0,
15
- },
16
- marginBottom: {
17
- type: "unit",
18
- unit: "px",
19
- value: 0,
20
- },
21
- marginLeft: {
22
- type: "unit",
23
- unit: "px",
24
- value: 0,
25
- },
26
- minHeight: {
27
- type: "unit",
28
- unit: "%",
29
- value: 100,
30
- },
31
- backgroundColor: {
32
- type: "keyword",
33
- value: "white",
34
- },
35
- fontFamily: {
36
- type: "keyword",
37
- value: "Arial",
38
- },
39
- fontSize: {
40
- type: "unit",
41
- unit: "px",
42
- value: 14,
43
- },
44
- lineHeight: {
45
- type: "unit",
46
- unit: "number",
47
- value: 1.5,
48
- },
49
- color: {
50
- type: "keyword",
51
- value: "#232323",
9
+ body: {
10
+ ...body,
11
+
12
+ minHeight: {
13
+ type: "unit",
14
+ unit: "%",
15
+ value: 100,
16
+ },
17
+
18
+ backgroundColor: {
19
+ type: "keyword",
20
+ value: "white",
21
+ },
22
+
23
+ fontFamily: {
24
+ type: "keyword",
25
+ value: "Arial",
26
+ },
27
+
28
+ fontSize: {
29
+ type: "unit",
30
+ unit: "px",
31
+ value: 14,
32
+ },
33
+
34
+ lineHeight: {
35
+ type: "unit",
36
+ unit: "number",
37
+ value: 1.5,
38
+ },
39
+
40
+ color: {
41
+ type: "keyword",
42
+ value: "#232323",
43
+ },
52
44
  },
53
- } as const;
45
+ } as const satisfies Record<typeof defaultTag, Style>;
54
46
 
55
47
  export const meta: WsComponentMeta = {
56
48
  type: "container",
@@ -1,6 +1,6 @@
1
1
  import { forwardRef, type ElementRef, type ComponentProps } from "react";
2
2
 
3
- const defaultTag = "b";
3
+ export const defaultTag = "b";
4
4
 
5
5
  export const Bold = forwardRef<
6
6
  ElementRef<typeof defaultTag>,
@@ -1,11 +1,19 @@
1
- import { FontBoldIcon } from "@webstudio-is/icons";
1
+ import { BoldIcon } from "@webstudio-is/icons";
2
2
  import type { WsComponentMeta, WsComponentPropsMeta } from "./component-meta";
3
3
  import { props } from "./__generated__/bold.props";
4
+ import { b } from "../css/normalize";
5
+ import type { Style } from "@webstudio-is/css-data";
6
+ import type { defaultTag } from "./bold";
7
+
8
+ const presetStyle = {
9
+ b,
10
+ } as const satisfies Record<typeof defaultTag, Style>;
4
11
 
5
12
  export const meta: WsComponentMeta = {
6
13
  type: "rich-text-child",
7
14
  label: "Bold Text",
8
- Icon: FontBoldIcon,
15
+ Icon: BoldIcon,
16
+ presetStyle,
9
17
  };
10
18
 
11
19
  export const propsMeta: WsComponentPropsMeta = {
@@ -1,13 +1,36 @@
1
1
  import { BoxIcon } from "@webstudio-is/icons";
2
2
  import type { WsComponentMeta, WsComponentPropsMeta } from "./component-meta";
3
3
  import { props } from "./__generated__/box.props";
4
+ import type { Box } from "./box";
5
+ import type { ComponentProps } from "react";
6
+ import type { Style } from "@webstudio-is/css-data";
7
+ import {
8
+ div,
9
+ address,
10
+ article,
11
+ aside,
12
+ figure,
13
+ footer,
14
+ header,
15
+ main,
16
+ nav,
17
+ section,
18
+ } from "../css/normalize";
19
+
20
+ type BoxTags = NonNullable<ComponentProps<typeof Box>["tag"]>;
4
21
 
5
22
  const presetStyle = {
6
- boxSizing: {
7
- type: "keyword",
8
- value: "border-box",
9
- },
10
- } as const;
23
+ div,
24
+ address,
25
+ article,
26
+ aside,
27
+ figure,
28
+ footer,
29
+ header,
30
+ main,
31
+ nav,
32
+ section,
33
+ } as const satisfies Record<BoxTags, Style>;
11
34
 
12
35
  export const meta: WsComponentMeta = {
13
36
  category: "general",
@@ -1,6 +1,6 @@
1
1
  import { forwardRef, type ElementRef, type ComponentProps } from "react";
2
2
 
3
- const defaultTag = "button";
3
+ export const defaultTag = "button";
4
4
 
5
5
  type ButtonProps = ComponentProps<typeof defaultTag> & { innerText?: string };
6
6
 
@@ -1,12 +1,20 @@
1
- import { ButtonIcon } from "@webstudio-is/icons";
1
+ import { ButtonElementIcon } from "@webstudio-is/icons";
2
2
  import type { WsComponentMeta, WsComponentPropsMeta } from "./component-meta";
3
3
  import { props } from "./__generated__/button.props";
4
+ import { button } from "../css/normalize";
5
+ import type { defaultTag } from "./button";
6
+ import type { Style } from "@webstudio-is/css-data";
7
+
8
+ const presetStyle = {
9
+ button,
10
+ } as const satisfies Record<typeof defaultTag, Style>;
4
11
 
5
12
  export const meta: WsComponentMeta = {
6
13
  category: "forms",
7
14
  type: "container",
8
15
  label: "Button",
9
- Icon: ButtonIcon,
16
+ Icon: ButtonElementIcon,
17
+ presetStyle,
10
18
  };
11
19
 
12
20
  export const propsMeta: WsComponentPropsMeta = {
@@ -6,7 +6,7 @@ import {
6
6
  } from "react";
7
7
  import { cssVars } from "@webstudio-is/css-vars";
8
8
 
9
- const defaultTag = "code";
9
+ export const defaultTag = "code";
10
10
 
11
11
  export const displayVarNamespace = cssVars.unique("code-display");
12
12
 
@@ -1,37 +1,45 @@
1
1
  import { CodeIcon } from "@webstudio-is/icons";
2
2
  import type { WsComponentMeta, WsComponentPropsMeta } from "./component-meta";
3
- import { displayVarNamespace } from "./code";
3
+ import { type defaultTag, displayVarNamespace } from "./code";
4
4
  import { props } from "./__generated__/code.props";
5
+ import type { Style, StyleValue } from "@webstudio-is/css-data";
6
+ import { code } from "../css/normalize";
5
7
 
6
- const presetStyle: WsComponentMeta["presetStyle"] = {
7
- display: {
8
- type: "var",
9
- value: displayVarNamespace,
10
- fallbacks: [
11
- {
12
- type: "keyword",
13
- value: "inline-block",
14
- },
15
- ],
16
- },
17
- paddingLeft: {
18
- type: "keyword",
19
- value: "0.2em",
20
- },
21
- paddingRight: {
22
- type: "keyword",
23
- value: "0.2em",
24
- },
25
- backgroundColor: {
26
- type: "keyword",
27
- value: "#eee",
28
- },
29
- fontFamily: {
30
- type: "keyword",
31
- value: "monospace",
32
- },
8
+ const display: StyleValue = {
9
+ type: "var",
10
+ value: displayVarNamespace,
11
+ fallbacks: [
12
+ {
13
+ type: "keyword",
14
+ value: "inline-block",
15
+ },
16
+ ],
33
17
  };
34
18
 
19
+ const presetStyle = {
20
+ code: {
21
+ ...code,
22
+ display,
23
+ paddingLeft: {
24
+ type: "unit",
25
+ value: 0.2,
26
+ unit: "em",
27
+ },
28
+ paddingRight: {
29
+ type: "unit",
30
+ value: 0.2,
31
+ unit: "em",
32
+ },
33
+ backgroundColor: {
34
+ type: "rgb",
35
+ r: 238,
36
+ g: 238,
37
+ b: 238,
38
+ alpha: 1,
39
+ },
40
+ },
41
+ } as const satisfies Record<typeof defaultTag, Style>;
42
+
35
43
  export const meta: WsComponentMeta = {
36
44
  category: "general",
37
45
  type: "rich-text",
@@ -3,6 +3,9 @@ import type { FunctionComponent } from "react";
3
3
  import type { IconProps } from "@webstudio-is/icons";
4
4
  import type { Style } from "@webstudio-is/css-data";
5
5
  import { PropMeta } from "@webstudio-is/generate-arg-types";
6
+ import type { htmlTags as HtmlTags } from "html-tags";
7
+
8
+ type PresetStyle = Partial<Record<HtmlTags, Style>>;
6
9
 
7
10
  // props are separated from the rest of the meta
8
11
  // so they can be exported separately and potentially tree-shaken
@@ -44,6 +47,6 @@ export type WsComponentMeta = Omit<
44
47
  z.infer<typeof WsComponentMeta>,
45
48
  "presetStyle" | "Icon"
46
49
  > & {
47
- presetStyle?: Style;
50
+ presetStyle?: PresetStyle;
48
51
  Icon: FunctionComponent<IconProps>;
49
52
  };
@@ -1,6 +1,6 @@
1
1
  import { forwardRef, type ElementRef, type ComponentProps } from "react";
2
2
 
3
- const defaultTag = "form";
3
+ export const defaultTag = "form";
4
4
 
5
5
  export const Form = forwardRef<
6
6
  ElementRef<typeof defaultTag>,
@@ -1,18 +1,20 @@
1
+ import type { Style } from "@webstudio-is/css-data";
1
2
  import { FormIcon } from "@webstudio-is/icons";
3
+ import { form } from "../css/normalize";
2
4
  import type { WsComponentMeta, WsComponentPropsMeta } from "./component-meta";
5
+ import type { defaultTag } from "./form";
3
6
  import { props } from "./__generated__/form.props";
4
7
 
5
8
  const presetStyle = {
6
- minHeight: {
7
- type: "unit",
8
- unit: "px",
9
- value: 20,
9
+ form: {
10
+ ...form,
11
+ minHeight: {
12
+ type: "unit",
13
+ unit: "px",
14
+ value: 20,
15
+ },
10
16
  },
11
- boxSizing: {
12
- type: "keyword",
13
- value: "border-box",
14
- },
15
- } as const;
17
+ } as const satisfies Record<typeof defaultTag, Style>;
16
18
 
17
19
  export const meta: WsComponentMeta = {
18
20
  category: "forms",
@@ -1,13 +1,29 @@
1
+ import type { Style } from "@webstudio-is/css-data";
1
2
  import { HeadingIcon } from "@webstudio-is/icons";
3
+ import type { ComponentProps } from "react";
4
+ import { h1, h2, h3, h4, h5, h6 } from "../css/normalize";
2
5
  import type { WsComponentMeta, WsComponentPropsMeta } from "./component-meta";
6
+ import type { Heading } from "./heading";
3
7
  import { props } from "./__generated__/heading.props";
4
8
 
9
+ type HeadingTags = NonNullable<ComponentProps<typeof Heading>["tag"]>;
10
+
11
+ const presetStyle = {
12
+ h1,
13
+ h2,
14
+ h3,
15
+ h4,
16
+ h5,
17
+ h6,
18
+ } as const satisfies Record<HeadingTags, Style>;
19
+
5
20
  export const meta: WsComponentMeta = {
6
21
  category: "typography",
7
22
  type: "rich-text",
8
23
  label: "Heading",
9
24
  Icon: HeadingIcon,
10
25
  children: ["Heading you can edit"],
26
+ presetStyle,
11
27
  };
12
28
 
13
29
  export const propsMeta: WsComponentPropsMeta = {
@@ -1,6 +1,6 @@
1
1
  import { forwardRef, type ElementRef, type ComponentProps } from "react";
2
2
 
3
- const defaultTag = "img";
3
+ export const defaultTag = "img";
4
4
 
5
5
  // quality and optimize can be overwritten and used by asset transform
6
6
  // Or we need and additional way to pass them upper level
@@ -1,21 +1,28 @@
1
+ import type { Style } from "@webstudio-is/css-data";
1
2
  import { ImageIcon } from "@webstudio-is/icons";
3
+ import { img } from "../css/normalize";
2
4
  import type { WsComponentMeta, WsComponentPropsMeta } from "./component-meta";
5
+ import type { defaultTag } from "./image";
3
6
  import { props } from "./__generated__/image.props";
4
7
 
5
8
  const presetStyle = {
6
- // Otherwise on new image insert onto canvas it can overfit screen size multiple times
7
- maxWidth: {
8
- type: "unit",
9
- unit: "%",
10
- value: 100,
11
- },
12
- // inline | inline-block is not suitable because without line-height: 0 on the parent you get unsuitable spaces/margins
13
- // see https://stackoverflow.com/questions/24771194/is-the-margin-of-inline-block-4px-is-static-for-all-browsers
14
- display: {
15
- type: "keyword",
16
- value: "block",
9
+ img: {
10
+ ...img,
11
+
12
+ // Otherwise on new image insert onto canvas it can overfit screen size multiple times
13
+ maxWidth: {
14
+ type: "unit",
15
+ unit: "%",
16
+ value: 100,
17
+ },
18
+ // inline | inline-block is not suitable because without line-height: 0 on the parent you get unsuitable spaces/margins
19
+ // see https://stackoverflow.com/questions/24771194/is-the-margin-of-inline-block-4px-is-static-for-all-browsers
20
+ display: {
21
+ type: "keyword",
22
+ value: "block",
23
+ },
17
24
  },
18
- } as const;
25
+ } as const satisfies Record<typeof defaultTag, Style>;
19
26
 
20
27
  export const meta: WsComponentMeta = {
21
28
  category: "media",
@@ -1,6 +1,6 @@
1
1
  import { forwardRef, type ElementRef, type ComponentProps } from "react";
2
2
 
3
- const defaultTag = "input";
3
+ export const defaultTag = "input";
4
4
 
5
5
  export const Input = forwardRef<
6
6
  ElementRef<typeof defaultTag>,
@@ -1,12 +1,20 @@
1
- import { InputIcon } from "@webstudio-is/icons";
1
+ import type { Style } from "@webstudio-is/css-data";
2
+ import { FormTextFieldIcon } from "@webstudio-is/icons";
3
+ import { input } from "../css/normalize";
2
4
  import type { WsComponentMeta, WsComponentPropsMeta } from "./component-meta";
5
+ import type { defaultTag } from "./input";
3
6
  import { props } from "./__generated__/input.props";
4
7
 
8
+ const presetStyle = {
9
+ input,
10
+ } as const satisfies Record<typeof defaultTag, Style>;
11
+
5
12
  export const meta: WsComponentMeta = {
6
13
  category: "forms",
7
14
  type: "control",
8
15
  label: "Input",
9
- Icon: InputIcon,
16
+ Icon: FormTextFieldIcon,
17
+ presetStyle,
10
18
  };
11
19
 
12
20
  export const propsMeta: WsComponentPropsMeta = {
@@ -1,6 +1,6 @@
1
1
  import { forwardRef, type ElementRef, type ComponentProps } from "react";
2
2
 
3
- const defaultTag = "i";
3
+ export const defaultTag = "i";
4
4
 
5
5
  export const Italic = forwardRef<
6
6
  ElementRef<typeof defaultTag>,
@@ -1,18 +1,24 @@
1
- import { FontItalicIcon } from "@webstudio-is/icons";
1
+ import type { Style } from "@webstudio-is/css-data";
2
+ import { TextItalicIcon } from "@webstudio-is/icons";
3
+ import type { defaultTag } from "./italic";
2
4
  import type { WsComponentMeta, WsComponentPropsMeta } from "./component-meta";
3
5
  import { props } from "./__generated__/italic.props";
6
+ import { i } from "../css/normalize";
4
7
 
5
8
  const presetStyle = {
6
- fontStyle: {
7
- type: "keyword",
8
- value: "italic",
9
+ i: {
10
+ ...i,
11
+ fontStyle: {
12
+ type: "keyword",
13
+ value: "italic",
14
+ },
9
15
  },
10
- } as const;
16
+ } as const satisfies Record<typeof defaultTag, Style>;
11
17
 
12
18
  export const meta: WsComponentMeta = {
13
19
  type: "rich-text-child",
14
20
  label: "Italic Text",
15
- Icon: FontItalicIcon,
21
+ Icon: TextItalicIcon,
16
22
  presetStyle,
17
23
  };
18
24
 
@@ -1,5 +1,6 @@
1
1
  import { forwardRef } from "react";
2
2
  import { Link } from "./link";
3
+ export { defaultTag } from "./link";
3
4
 
4
5
  export const LinkBlock: typeof Link = forwardRef((props, ref) => (
5
6
  <Link {...props} ref={ref} />
@@ -2,17 +2,19 @@ import { BoxLinkIcon } from "@webstudio-is/icons";
2
2
  import type { WsComponentMeta, WsComponentPropsMeta } from "./component-meta";
3
3
  import { props } from "./__generated__/link-block.props";
4
4
  import { propsMeta as linkPropsMeta } from "./link.ws";
5
+ import type { defaultTag } from "./link-block";
6
+ import type { Style } from "@webstudio-is/css-data";
7
+ import { a } from "../css/normalize";
5
8
 
6
9
  const presetStyle = {
7
- boxSizing: {
8
- type: "keyword",
9
- value: "border-box",
10
+ a: {
11
+ ...a,
12
+ display: {
13
+ type: "keyword",
14
+ value: "inline-block",
15
+ },
10
16
  },
11
- display: {
12
- type: "keyword",
13
- value: "inline-block",
14
- },
15
- } as const;
17
+ } as const satisfies Record<typeof defaultTag, Style>;
16
18
 
17
19
  export const meta: WsComponentMeta = {
18
20
  category: "general",