@webiny/lexical-editor 0.0.0-unstable.1145e7667f

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 (279) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +17 -0
  3. package/commands/webiny-list.d.ts +7 -0
  4. package/commands/webiny-list.js +13 -0
  5. package/commands/webiny-list.js.map +1 -0
  6. package/commands/webiny-quote.d.ts +5 -0
  7. package/commands/webiny-quote.js +9 -0
  8. package/commands/webiny-quote.js.map +1 -0
  9. package/components/AddRichTextEditorNodeType.d.ts +6 -0
  10. package/components/AddRichTextEditorNodeType.js +28 -0
  11. package/components/AddRichTextEditorNodeType.js.map +1 -0
  12. package/components/AddRichTextEditorPlugin.d.ts +12 -0
  13. package/components/AddRichTextEditorPlugin.js +33 -0
  14. package/components/AddRichTextEditorPlugin.js.map +1 -0
  15. package/components/AddToolbarAction.d.ts +7 -0
  16. package/components/AddToolbarAction.js +33 -0
  17. package/components/AddToolbarAction.js.map +1 -0
  18. package/components/Editor/HeadingEditor.d.ts +7 -0
  19. package/components/Editor/HeadingEditor.js +29 -0
  20. package/components/Editor/HeadingEditor.js.map +1 -0
  21. package/components/Editor/ParagraphEditor.d.ts +7 -0
  22. package/components/Editor/ParagraphEditor.js +30 -0
  23. package/components/Editor/ParagraphEditor.js.map +1 -0
  24. package/components/Editor/RichTextEditor.d.ts +26 -0
  25. package/components/Editor/RichTextEditor.js +138 -0
  26. package/components/Editor/RichTextEditor.js.map +1 -0
  27. package/components/LexicalEditorConfig/LexicalEditorConfig.d.ts +9 -0
  28. package/components/LexicalEditorConfig/LexicalEditorConfig.js +17 -0
  29. package/components/LexicalEditorConfig/LexicalEditorConfig.js.map +1 -0
  30. package/components/LexicalHtmlRenderer.d.ts +16 -0
  31. package/components/LexicalHtmlRenderer.js +67 -0
  32. package/components/LexicalHtmlRenderer.js.map +1 -0
  33. package/components/Toolbar/HeadingToolbar.d.ts +12 -0
  34. package/components/Toolbar/HeadingToolbar.js +23 -0
  35. package/components/Toolbar/HeadingToolbar.js.map +1 -0
  36. package/components/Toolbar/ParagraphToolbar.d.ts +12 -0
  37. package/components/Toolbar/ParagraphToolbar.js +23 -0
  38. package/components/Toolbar/ParagraphToolbar.js.map +1 -0
  39. package/components/Toolbar/Toolbar.css +423 -0
  40. package/components/Toolbar/Toolbar.d.ts +13 -0
  41. package/components/Toolbar/Toolbar.js +181 -0
  42. package/components/Toolbar/Toolbar.js.map +1 -0
  43. package/components/ToolbarActions/BoldAction.d.ts +2 -0
  44. package/components/ToolbarActions/BoldAction.js +43 -0
  45. package/components/ToolbarActions/BoldAction.js.map +1 -0
  46. package/components/ToolbarActions/BulletListAction.d.ts +2 -0
  47. package/components/ToolbarActions/BulletListAction.js +51 -0
  48. package/components/ToolbarActions/BulletListAction.js.map +1 -0
  49. package/components/ToolbarActions/CodeHighlightAction.d.ts +2 -0
  50. package/components/ToolbarActions/CodeHighlightAction.js +43 -0
  51. package/components/ToolbarActions/CodeHighlightAction.js.map +1 -0
  52. package/components/ToolbarActions/FontColorAction.d.ts +11 -0
  53. package/components/ToolbarActions/FontColorAction.js +83 -0
  54. package/components/ToolbarActions/FontColorAction.js.map +1 -0
  55. package/components/ToolbarActions/FontSizeAction.d.ts +2 -0
  56. package/components/ToolbarActions/FontSizeAction.js +101 -0
  57. package/components/ToolbarActions/FontSizeAction.js.map +1 -0
  58. package/components/ToolbarActions/ItalicAction.d.ts +2 -0
  59. package/components/ToolbarActions/ItalicAction.js +43 -0
  60. package/components/ToolbarActions/ItalicAction.js.map +1 -0
  61. package/components/ToolbarActions/LinkAction.d.ts +2 -0
  62. package/components/ToolbarActions/LinkAction.js +64 -0
  63. package/components/ToolbarActions/LinkAction.js.map +1 -0
  64. package/components/ToolbarActions/NumberedListAction.d.ts +2 -0
  65. package/components/ToolbarActions/NumberedListAction.js +53 -0
  66. package/components/ToolbarActions/NumberedListAction.js.map +1 -0
  67. package/components/ToolbarActions/QuoteAction.d.ts +2 -0
  68. package/components/ToolbarActions/QuoteAction.js +53 -0
  69. package/components/ToolbarActions/QuoteAction.js.map +1 -0
  70. package/components/ToolbarActions/TypographyAction.d.ts +11 -0
  71. package/components/ToolbarActions/TypographyAction.js +118 -0
  72. package/components/ToolbarActions/TypographyAction.js.map +1 -0
  73. package/components/ToolbarActions/UnderlineAction.d.ts +2 -0
  74. package/components/ToolbarActions/UnderlineAction.js +43 -0
  75. package/components/ToolbarActions/UnderlineAction.js.map +1 -0
  76. package/components/ToolbarPresets/HeadingToolbarPreset.d.ts +2 -0
  77. package/components/ToolbarPresets/HeadingToolbarPreset.js +52 -0
  78. package/components/ToolbarPresets/HeadingToolbarPreset.js.map +1 -0
  79. package/components/ToolbarPresets/ParagraphToolbarPreset.d.ts +2 -0
  80. package/components/ToolbarPresets/ParagraphToolbarPreset.js +67 -0
  81. package/components/ToolbarPresets/ParagraphToolbarPreset.js.map +1 -0
  82. package/context/FontColorActionContext.d.ts +6 -0
  83. package/context/FontColorActionContext.js +10 -0
  84. package/context/FontColorActionContext.js.map +1 -0
  85. package/context/RichTextEditorContext.d.ts +21 -0
  86. package/context/RichTextEditorContext.js +56 -0
  87. package/context/RichTextEditorContext.js.map +1 -0
  88. package/context/SharedHistoryContext.d.ts +11 -0
  89. package/context/SharedHistoryContext.js +26 -0
  90. package/context/SharedHistoryContext.js.map +1 -0
  91. package/context/TypographyActionContext.d.ts +7 -0
  92. package/context/TypographyActionContext.js +10 -0
  93. package/context/TypographyActionContext.js.map +1 -0
  94. package/hooks/useFontColorPicker.d.ts +2 -0
  95. package/hooks/useFontColorPicker.js +15 -0
  96. package/hooks/useFontColorPicker.js.map +1 -0
  97. package/hooks/useRichTextEditor.d.ts +2 -0
  98. package/hooks/useRichTextEditor.js +15 -0
  99. package/hooks/useRichTextEditor.js.map +1 -0
  100. package/hooks/useTypographyAction.d.ts +1 -0
  101. package/hooks/useTypographyAction.js +15 -0
  102. package/hooks/useTypographyAction.js.map +1 -0
  103. package/hooks/useWebinyList.d.ts +2 -0
  104. package/hooks/useWebinyList.js +39 -0
  105. package/hooks/useWebinyList.js.map +1 -0
  106. package/hooks/useWebinyQuote.d.ts +2 -0
  107. package/hooks/useWebinyQuote.js +20 -0
  108. package/hooks/useWebinyQuote.js.map +1 -0
  109. package/images/icons/LICENSE.md +5 -0
  110. package/images/icons/chat-square-quote.svg +1 -0
  111. package/images/icons/chevron-down.svg +1 -0
  112. package/images/icons/code.svg +1 -0
  113. package/images/icons/font-color.svg +1 -0
  114. package/images/icons/link.svg +1 -0
  115. package/images/icons/list-ol.svg +1 -0
  116. package/images/icons/list-ul.svg +1 -0
  117. package/images/icons/pencil-fill.svg +1 -0
  118. package/images/icons/text-center.svg +1 -0
  119. package/images/icons/text-left.svg +1 -0
  120. package/images/icons/text-paragraph.svg +1 -0
  121. package/images/icons/text-right.svg +1 -0
  122. package/images/icons/type-bold.svg +1 -0
  123. package/images/icons/type-h1.svg +1 -0
  124. package/images/icons/type-h2.svg +1 -0
  125. package/images/icons/type-h3.svg +1 -0
  126. package/images/icons/type-h4.svg +1 -0
  127. package/images/icons/type-h5.svg +1 -0
  128. package/images/icons/type-h6.svg +1 -0
  129. package/images/icons/type-italic.svg +1 -0
  130. package/images/icons/type-strikethrough.svg +1 -0
  131. package/images/icons/type-underline.svg +1 -0
  132. package/images/icons/unlink_icon.svg +1 -0
  133. package/index.d.ts +40 -0
  134. package/index.js +281 -0
  135. package/index.js.map +1 -0
  136. package/nodes/FontColorNode.d.ts +43 -0
  137. package/nodes/FontColorNode.js +127 -0
  138. package/nodes/FontColorNode.js.map +1 -0
  139. package/nodes/TypographyElementNode.d.ts +42 -0
  140. package/nodes/TypographyElementNode.js +154 -0
  141. package/nodes/TypographyElementNode.js.map +1 -0
  142. package/nodes/WebinyQuoteNode.d.ts +29 -0
  143. package/nodes/WebinyQuoteNode.js +148 -0
  144. package/nodes/WebinyQuoteNode.js.map +1 -0
  145. package/nodes/list-node/WebinyListItemNode.d.ts +46 -0
  146. package/nodes/list-node/WebinyListItemNode.js +441 -0
  147. package/nodes/list-node/WebinyListItemNode.js.map +1 -0
  148. package/nodes/list-node/WebinyListNode.d.ts +38 -0
  149. package/nodes/list-node/WebinyListNode.js +253 -0
  150. package/nodes/list-node/WebinyListNode.js.map +1 -0
  151. package/nodes/list-node/formatList.d.ts +12 -0
  152. package/nodes/list-node/formatList.js +423 -0
  153. package/nodes/list-node/formatList.js.map +1 -0
  154. package/nodes/webinyNodes.d.ts +7 -0
  155. package/nodes/webinyNodes.js +21 -0
  156. package/nodes/webinyNodes.js.map +1 -0
  157. package/package.json +41 -0
  158. package/plugins/AutoLinkPlugin/AutoLinkPlugin.d.ts +11 -0
  159. package/plugins/AutoLinkPlugin/AutoLinkPlugin.js +46 -0
  160. package/plugins/AutoLinkPlugin/AutoLinkPlugin.js.map +1 -0
  161. package/plugins/AutoLinkPlugin/index.d.ts +1 -0
  162. package/plugins/AutoLinkPlugin/index.js +16 -0
  163. package/plugins/AutoLinkPlugin/index.js.map +1 -0
  164. package/plugins/BlurEventPlugin/BlurEventPlugin.d.ts +7 -0
  165. package/plugins/BlurEventPlugin/BlurEventPlugin.js +28 -0
  166. package/plugins/BlurEventPlugin/BlurEventPlugin.js.map +1 -0
  167. package/plugins/ClickableLinkPlugin/ClickableLinkPlugin.d.ts +17 -0
  168. package/plugins/ClickableLinkPlugin/ClickableLinkPlugin.js +88 -0
  169. package/plugins/ClickableLinkPlugin/ClickableLinkPlugin.js.map +1 -0
  170. package/plugins/ClickableLinkPlugin/index.d.ts +1 -0
  171. package/plugins/ClickableLinkPlugin/index.js +16 -0
  172. package/plugins/ClickableLinkPlugin/index.js.map +1 -0
  173. package/plugins/CodeHighlightPlugin/CodeHighlightPlugin.d.ts +1 -0
  174. package/plugins/CodeHighlightPlugin/CodeHighlightPlugin.js +20 -0
  175. package/plugins/CodeHighlightPlugin/CodeHighlightPlugin.js.map +1 -0
  176. package/plugins/CodeHighlightPlugin/index.d.ts +1 -0
  177. package/plugins/CodeHighlightPlugin/index.js +16 -0
  178. package/plugins/CodeHighlightPlugin/index.js.map +1 -0
  179. package/plugins/FloatingLinkEditorPlugin/FloatingLinkEditorPlugin.css +118 -0
  180. package/plugins/FloatingLinkEditorPlugin/FloatingLinkEditorPlugin.d.ts +7 -0
  181. package/plugins/FloatingLinkEditorPlugin/FloatingLinkEditorPlugin.js +222 -0
  182. package/plugins/FloatingLinkEditorPlugin/FloatingLinkEditorPlugin.js.map +1 -0
  183. package/plugins/FloatingLinkEditorPlugin/index.d.ts +1 -0
  184. package/plugins/FloatingLinkEditorPlugin/index.js +16 -0
  185. package/plugins/FloatingLinkEditorPlugin/index.js.map +1 -0
  186. package/plugins/FontColorPlugin/FontColorPlugin.d.ts +2 -0
  187. package/plugins/FontColorPlugin/FontColorPlugin.js +38 -0
  188. package/plugins/FontColorPlugin/FontColorPlugin.js.map +1 -0
  189. package/plugins/LexicalUpdateStatePlugin/LexicalUpdateStatePlugin.d.ts +8 -0
  190. package/plugins/LexicalUpdateStatePlugin/LexicalUpdateStatePlugin.js +34 -0
  191. package/plugins/LexicalUpdateStatePlugin/LexicalUpdateStatePlugin.js.map +1 -0
  192. package/plugins/LexicalUpdateStatePlugin/index.d.ts +1 -0
  193. package/plugins/LexicalUpdateStatePlugin/index.js +16 -0
  194. package/plugins/LexicalUpdateStatePlugin/index.js.map +1 -0
  195. package/plugins/TypographyPlugin/TypographyPlugin.d.ts +2 -0
  196. package/plugins/TypographyPlugin/TypographyPlugin.js +31 -0
  197. package/plugins/TypographyPlugin/TypographyPlugin.js.map +1 -0
  198. package/plugins/WebinyListPLugin/WebinyListPlugin.d.ts +1 -0
  199. package/plugins/WebinyListPLugin/WebinyListPlugin.js +25 -0
  200. package/plugins/WebinyListPLugin/WebinyListPlugin.js.map +1 -0
  201. package/plugins/WebinyQuoteNodePlugin/WebinyQuoteNodePlugin.d.ts +1 -0
  202. package/plugins/WebinyQuoteNodePlugin/WebinyQuoteNodePlugin.js +24 -0
  203. package/plugins/WebinyQuoteNodePlugin/WebinyQuoteNodePlugin.js.map +1 -0
  204. package/themes/webinyLexicalTheme.css +420 -0
  205. package/themes/webinyLexicalTheme.d.ts +9 -0
  206. package/themes/webinyLexicalTheme.js +87 -0
  207. package/themes/webinyLexicalTheme.js.map +1 -0
  208. package/types.d.ts +61 -0
  209. package/types.js +12 -0
  210. package/types.js.map +1 -0
  211. package/ui/Divider.d.ts +2 -0
  212. package/ui/Divider.js +13 -0
  213. package/ui/Divider.js.map +1 -0
  214. package/ui/DropDown.d.ts +26 -0
  215. package/ui/DropDown.js +173 -0
  216. package/ui/DropDown.js.map +1 -0
  217. package/ui/Input.css +32 -0
  218. package/ui/LinkPreview.css +69 -0
  219. package/ui/LinkPreview.d.ts +12 -0
  220. package/ui/LinkPreview.js +101 -0
  221. package/ui/LinkPreview.js.map +1 -0
  222. package/ui/Placeholder.css +23 -0
  223. package/ui/Placeholder.d.ts +13 -0
  224. package/ui/Placeholder.js +24 -0
  225. package/ui/Placeholder.js.map +1 -0
  226. package/ui/TextInput.d.ts +18 -0
  227. package/ui/TextInput.js +39 -0
  228. package/ui/TextInput.js.map +1 -0
  229. package/ui/ToolbarActionDialog.d.ts +12 -0
  230. package/ui/ToolbarActionDialog.js +106 -0
  231. package/ui/ToolbarActionDialog.js.map +1 -0
  232. package/utils/generateInitialLexicalValue.d.ts +5 -0
  233. package/utils/generateInitialLexicalValue.js +29 -0
  234. package/utils/generateInitialLexicalValue.js.map +1 -0
  235. package/utils/getDOMRangeRect.d.ts +10 -0
  236. package/utils/getDOMRangeRect.js +27 -0
  237. package/utils/getDOMRangeRect.js.map +1 -0
  238. package/utils/getLexicalTextSelectionState.d.ts +5 -0
  239. package/utils/getLexicalTextSelectionState.js +141 -0
  240. package/utils/getLexicalTextSelectionState.js.map +1 -0
  241. package/utils/getSelectedNode.d.ts +2 -0
  242. package/utils/getSelectedNode.js +30 -0
  243. package/utils/getSelectedNode.js.map +1 -0
  244. package/utils/isValidJSON.d.ts +1 -0
  245. package/utils/isValidJSON.js +18 -0
  246. package/utils/isValidJSON.js.map +1 -0
  247. package/utils/isValidLexicalData.d.ts +2 -0
  248. package/utils/isValidLexicalData.js +24 -0
  249. package/utils/isValidLexicalData.js.map +1 -0
  250. package/utils/nodes/clearNodeFormating.d.ts +2 -0
  251. package/utils/nodes/clearNodeFormating.js +28 -0
  252. package/utils/nodes/clearNodeFormating.js.map +1 -0
  253. package/utils/nodes/formatToParagraph.d.ts +2 -0
  254. package/utils/nodes/formatToParagraph.js +19 -0
  255. package/utils/nodes/formatToParagraph.js.map +1 -0
  256. package/utils/nodes/formatToQuote.d.ts +2 -0
  257. package/utils/nodes/formatToQuote.js +20 -0
  258. package/utils/nodes/formatToQuote.js.map +1 -0
  259. package/utils/nodes/list-node.d.ts +11 -0
  260. package/utils/nodes/list-node.js +107 -0
  261. package/utils/nodes/list-node.js.map +1 -0
  262. package/utils/point.d.ts +21 -0
  263. package/utils/point.js +77 -0
  264. package/utils/point.js.map +1 -0
  265. package/utils/rect.d.ts +47 -0
  266. package/utils/rect.js +169 -0
  267. package/utils/rect.js.map +1 -0
  268. package/utils/sanitizeUrl.d.ts +8 -0
  269. package/utils/sanitizeUrl.js +27 -0
  270. package/utils/sanitizeUrl.js.map +1 -0
  271. package/utils/setFloatingElemPosition.d.ts +3 -0
  272. package/utils/setFloatingElemPosition.js +40 -0
  273. package/utils/setFloatingElemPosition.js.map +1 -0
  274. package/utils/styleObjectToString.d.ts +2 -0
  275. package/utils/styleObjectToString.js +22 -0
  276. package/utils/styleObjectToString.js.map +1 -0
  277. package/utils/toTypographyEmotionMap.d.ts +3 -0
  278. package/utils/toTypographyEmotionMap.js +36 -0
  279. package/utils/toTypographyEmotionMap.js.map +1 -0
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.setFloatingElemPosition = setFloatingElemPosition;
7
+ /**
8
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
9
+ *
10
+ * This source code is licensed under the MIT license found in the
11
+ * LICENSE file in the root directory of this source tree.
12
+ *
13
+ */
14
+ var VERTICAL_GAP = 10;
15
+ var HORIZONTAL_OFFSET = 5;
16
+ function setFloatingElemPosition(targetRect, floatingElem, anchorElem) {
17
+ var verticalGap = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : VERTICAL_GAP;
18
+ var horizontalOffset = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : HORIZONTAL_OFFSET;
19
+ var scrollerElem = anchorElem.parentElement;
20
+ if (targetRect === null || !scrollerElem) {
21
+ floatingElem.style.opacity = "0";
22
+ floatingElem.style.transform = "translate(-10000px, -10000px)";
23
+ return;
24
+ }
25
+ var floatingElemRect = floatingElem.getBoundingClientRect();
26
+ var anchorElementRect = anchorElem.getBoundingClientRect();
27
+ var editorScrollerRect = scrollerElem.getBoundingClientRect();
28
+ var top = targetRect.top - floatingElemRect.height - verticalGap;
29
+ var left = targetRect.left - horizontalOffset;
30
+ if (top < editorScrollerRect.top) {
31
+ top += floatingElemRect.height + targetRect.height + verticalGap * 2;
32
+ }
33
+ if (left + floatingElemRect.width > editorScrollerRect.right) {
34
+ left = editorScrollerRect.right - floatingElemRect.width - horizontalOffset;
35
+ }
36
+ top -= anchorElementRect.top;
37
+ left -= anchorElementRect.left;
38
+ floatingElem.style.opacity = "1";
39
+ floatingElem.style.transform = "translate(".concat(left, "px, ").concat(top, "px)");
40
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"names":["VERTICAL_GAP","HORIZONTAL_OFFSET","setFloatingElemPosition","targetRect","floatingElem","anchorElem","verticalGap","horizontalOffset","scrollerElem","parentElement","style","opacity","transform","floatingElemRect","getBoundingClientRect","anchorElementRect","editorScrollerRect","top","height","left","width","right"],"sources":["setFloatingElemPosition.ts"],"sourcesContent":["/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\nconst VERTICAL_GAP = 10;\nconst HORIZONTAL_OFFSET = 5;\n\nexport function setFloatingElemPosition(\n targetRect: ClientRect | null,\n floatingElem: HTMLElement,\n anchorElem: HTMLElement,\n verticalGap: number = VERTICAL_GAP,\n horizontalOffset: number = HORIZONTAL_OFFSET\n): void {\n const scrollerElem = anchorElem.parentElement;\n\n if (targetRect === null || !scrollerElem) {\n floatingElem.style.opacity = \"0\";\n floatingElem.style.transform = \"translate(-10000px, -10000px)\";\n return;\n }\n\n const floatingElemRect = floatingElem.getBoundingClientRect();\n const anchorElementRect = anchorElem.getBoundingClientRect();\n const editorScrollerRect = scrollerElem.getBoundingClientRect();\n\n let top = targetRect.top - floatingElemRect.height - verticalGap;\n let left = targetRect.left - horizontalOffset;\n\n if (top < editorScrollerRect.top) {\n top += floatingElemRect.height + targetRect.height + verticalGap * 2;\n }\n\n if (left + floatingElemRect.width > editorScrollerRect.right) {\n left = editorScrollerRect.right - floatingElemRect.width - horizontalOffset;\n }\n\n top -= anchorElementRect.top;\n left -= anchorElementRect.left;\n\n floatingElem.style.opacity = \"1\";\n floatingElem.style.transform = `translate(${left}px, ${top}px)`;\n}\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAMA,YAAY,GAAG,EAAE;AACvB,IAAMC,iBAAiB,GAAG,CAAC;AAEpB,SAASC,uBAAuB,CACnCC,UAA6B,EAC7BC,YAAyB,EACzBC,UAAuB,EAGnB;EAAA,IAFJC,WAAmB,uEAAGN,YAAY;EAAA,IAClCO,gBAAwB,uEAAGN,iBAAiB;EAE5C,IAAMO,YAAY,GAAGH,UAAU,CAACI,aAAa;EAE7C,IAAIN,UAAU,KAAK,IAAI,IAAI,CAACK,YAAY,EAAE;IACtCJ,YAAY,CAACM,KAAK,CAACC,OAAO,GAAG,GAAG;IAChCP,YAAY,CAACM,KAAK,CAACE,SAAS,GAAG,+BAA+B;IAC9D;EACJ;EAEA,IAAMC,gBAAgB,GAAGT,YAAY,CAACU,qBAAqB,EAAE;EAC7D,IAAMC,iBAAiB,GAAGV,UAAU,CAACS,qBAAqB,EAAE;EAC5D,IAAME,kBAAkB,GAAGR,YAAY,CAACM,qBAAqB,EAAE;EAE/D,IAAIG,GAAG,GAAGd,UAAU,CAACc,GAAG,GAAGJ,gBAAgB,CAACK,MAAM,GAAGZ,WAAW;EAChE,IAAIa,IAAI,GAAGhB,UAAU,CAACgB,IAAI,GAAGZ,gBAAgB;EAE7C,IAAIU,GAAG,GAAGD,kBAAkB,CAACC,GAAG,EAAE;IAC9BA,GAAG,IAAIJ,gBAAgB,CAACK,MAAM,GAAGf,UAAU,CAACe,MAAM,GAAGZ,WAAW,GAAG,CAAC;EACxE;EAEA,IAAIa,IAAI,GAAGN,gBAAgB,CAACO,KAAK,GAAGJ,kBAAkB,CAACK,KAAK,EAAE;IAC1DF,IAAI,GAAGH,kBAAkB,CAACK,KAAK,GAAGR,gBAAgB,CAACO,KAAK,GAAGb,gBAAgB;EAC/E;EAEAU,GAAG,IAAIF,iBAAiB,CAACE,GAAG;EAC5BE,IAAI,IAAIJ,iBAAiB,CAACI,IAAI;EAE9Bf,YAAY,CAACM,KAAK,CAACC,OAAO,GAAG,GAAG;EAChCP,YAAY,CAACM,KAAK,CAACE,SAAS,uBAAgBO,IAAI,iBAAOF,GAAG,QAAK;AACnE"}
@@ -0,0 +1,2 @@
1
+ import { CSSObject } from "@emotion/react";
2
+ export declare const styleObjectToString: (styleObject: CSSObject) => string;
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.styleObjectToString = void 0;
8
+ var _reactStyleObjectToCss = _interopRequireDefault(require("react-style-object-to-css"));
9
+ // @ts-ignore - There are no types "@types/react-style-object-to-css" for this lib.
10
+
11
+ /*
12
+ * Converts CSS style objects to string
13
+ * Example:
14
+ * { fontSize: '10px' } => "font-size: 10px"
15
+ * */
16
+ var styleObjectToString = function styleObjectToString(styleObject) {
17
+ if (!styleObject) {
18
+ return styleObject;
19
+ }
20
+ return (0, _reactStyleObjectToCss.default)(styleObject);
21
+ };
22
+ exports.styleObjectToString = styleObjectToString;
@@ -0,0 +1 @@
1
+ {"version":3,"names":["styleObjectToString","styleObject","reactToCSS"],"sources":["styleObjectToString.ts"],"sourcesContent":["// @ts-ignore - There are no types \"@types/react-style-object-to-css\" for this lib.\nimport reactToCSS from \"react-style-object-to-css\";\nimport { CSSObject } from \"@emotion/react\";\n\n/*\n * Converts CSS style objects to string\n * Example:\n * { fontSize: '10px' } => \"font-size: 10px\"\n * */\nexport const styleObjectToString = (styleObject: CSSObject): string => {\n if (!styleObject) {\n return styleObject;\n }\n return reactToCSS(styleObject);\n};\n"],"mappings":";;;;;;;AACA;AADA;;AAIA;AACA;AACA;AACA;AACA;AACO,IAAMA,mBAAmB,GAAG,SAAtBA,mBAAmB,CAAIC,WAAsB,EAAa;EACnE,IAAI,CAACA,WAAW,EAAE;IACd,OAAOA,WAAW;EACtB;EACA,OAAO,IAAAC,8BAAU,EAACD,WAAW,CAAC;AAClC,CAAC;AAAC"}
@@ -0,0 +1,3 @@
1
+ import { ThemeEmotionMap } from "../types";
2
+ import { WebinyTheme } from "../themes/webinyLexicalTheme";
3
+ export declare const toTypographyEmotionMap: (css: (cssStyle: Record<string, any>) => string, theme: WebinyTheme) => ThemeEmotionMap | {};
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.toTypographyEmotionMap = void 0;
8
+ var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
9
+ /*
10
+ * Creates a map of style key ID's and typography style objects that include 'className' property which contains the
11
+ * CSS class name generated by the Emotion from typography styles object.
12
+ */
13
+ var toTypographyEmotionMap = function toTypographyEmotionMap(css, theme) {
14
+ var _theme$styles;
15
+ var map = {};
16
+ var typographyStyles = (_theme$styles = theme.styles) === null || _theme$styles === void 0 ? void 0 : _theme$styles.typography;
17
+ if (!typographyStyles) {
18
+ return {};
19
+ }
20
+ for (var key in typographyStyles) {
21
+ var typographyTypeData = typographyStyles[key];
22
+ if (typographyTypeData) {
23
+ typographyTypeData.forEach(function (styleItem) {
24
+ // 'lx' (abbreviation of lexical) variable will lead to generate shorter class names.
25
+ // for example: instead of default 'css-181qz4b-453f345f'
26
+ // the last segment will always end with 'lx' or 'css-181qz4b-lx'
27
+ var lx = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, styleItem), {}, {
28
+ className: [/*#__PURE__*/css(styleItem.styles, "label:lx;")].filter(Boolean).join(" ")
29
+ });
30
+ map[styleItem.id] = lx;
31
+ });
32
+ }
33
+ }
34
+ return map;
35
+ };
36
+ exports.toTypographyEmotionMap = toTypographyEmotionMap;
@@ -0,0 +1 @@
1
+ {"version":3,"names":["toTypographyEmotionMap","css","theme","map","typographyStyles","styles","typography","key","typographyTypeData","forEach","styleItem","lx","className","filter","Boolean","join","id"],"sources":["toTypographyEmotionMap.ts"],"sourcesContent":["import { ThemeEmotionMap, TypographyHTMLTag } from \"~/types\";\nimport { WebinyTheme } from \"~/themes/webinyLexicalTheme\";\n\n/*\n * Creates a map of style key ID's and typography style objects that include 'className' property which contains the\n * CSS class name generated by the Emotion from typography styles object.\n */\nexport const toTypographyEmotionMap = (\n css: (cssStyle: Record<string, any>) => string,\n theme: WebinyTheme\n): ThemeEmotionMap | {} => {\n const map: ThemeEmotionMap = {};\n const typographyStyles = theme.styles?.typography;\n if (!typographyStyles) {\n return {};\n }\n\n for (const key in typographyStyles) {\n const typographyTypeData = typographyStyles[key] as {\n id: string;\n tag: TypographyHTMLTag;\n name: string;\n styles: Record<string, any>;\n }[];\n if (typographyTypeData) {\n typographyTypeData.forEach(styleItem => {\n // 'lx' (abbreviation of lexical) variable will lead to generate shorter class names.\n // for example: instead of default 'css-181qz4b-453f345f'\n // the last segment will always end with 'lx' or 'css-181qz4b-lx'\n const lx = {\n ...styleItem,\n className: [css(styleItem.styles)].filter(Boolean).join(\" \")\n };\n map[styleItem.id] = lx;\n });\n }\n }\n\n return map;\n};\n"],"mappings":";;;;;;;;AAGA;AACA;AACA;AACA;AACO,IAAMA,sBAAsB,GAAG,SAAzBA,sBAAsB,CAC/BC,GAA8C,EAC9CC,KAAkB,EACK;EAAA;EACvB,IAAMC,GAAoB,GAAG,CAAC,CAAC;EAC/B,IAAMC,gBAAgB,oBAAGF,KAAK,CAACG,MAAM,kDAAZ,cAAcC,UAAU;EACjD,IAAI,CAACF,gBAAgB,EAAE;IACnB,OAAO,CAAC,CAAC;EACb;EAEA,KAAK,IAAMG,GAAG,IAAIH,gBAAgB,EAAE;IAChC,IAAMI,kBAAkB,GAAGJ,gBAAgB,CAACG,GAAG,CAK5C;IACH,IAAIC,kBAAkB,EAAE;MACpBA,kBAAkB,CAACC,OAAO,CAAC,UAAAC,SAAS,EAAI;QACpC;QACA;QACA;QACA,IAAMC,EAAE,+DACDD,SAAS;UACZE,SAAS,EAAE,cAACX,GAAG,CAACS,SAAS,CAACL,MAAM,cAAC,CAAC,CAACQ,MAAM,CAACC,OAAO,CAAC,CAACC,IAAI,CAAC,GAAG;QAAC,EAC/D;QACDZ,GAAG,CAACO,SAAS,CAACM,EAAE,CAAC,GAAGL,EAAE;MAC1B,CAAC,CAAC;IACN;EACJ;EAEA,OAAOR,GAAG;AACd,CAAC;AAAC"}