@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.
- package/LICENSE +21 -0
- package/README.md +17 -0
- package/commands/webiny-list.d.ts +7 -0
- package/commands/webiny-list.js +13 -0
- package/commands/webiny-list.js.map +1 -0
- package/commands/webiny-quote.d.ts +5 -0
- package/commands/webiny-quote.js +9 -0
- package/commands/webiny-quote.js.map +1 -0
- package/components/AddRichTextEditorNodeType.d.ts +6 -0
- package/components/AddRichTextEditorNodeType.js +28 -0
- package/components/AddRichTextEditorNodeType.js.map +1 -0
- package/components/AddRichTextEditorPlugin.d.ts +12 -0
- package/components/AddRichTextEditorPlugin.js +33 -0
- package/components/AddRichTextEditorPlugin.js.map +1 -0
- package/components/AddToolbarAction.d.ts +7 -0
- package/components/AddToolbarAction.js +33 -0
- package/components/AddToolbarAction.js.map +1 -0
- package/components/Editor/HeadingEditor.d.ts +7 -0
- package/components/Editor/HeadingEditor.js +29 -0
- package/components/Editor/HeadingEditor.js.map +1 -0
- package/components/Editor/ParagraphEditor.d.ts +7 -0
- package/components/Editor/ParagraphEditor.js +30 -0
- package/components/Editor/ParagraphEditor.js.map +1 -0
- package/components/Editor/RichTextEditor.d.ts +26 -0
- package/components/Editor/RichTextEditor.js +138 -0
- package/components/Editor/RichTextEditor.js.map +1 -0
- package/components/LexicalEditorConfig/LexicalEditorConfig.d.ts +9 -0
- package/components/LexicalEditorConfig/LexicalEditorConfig.js +17 -0
- package/components/LexicalEditorConfig/LexicalEditorConfig.js.map +1 -0
- package/components/LexicalHtmlRenderer.d.ts +16 -0
- package/components/LexicalHtmlRenderer.js +67 -0
- package/components/LexicalHtmlRenderer.js.map +1 -0
- package/components/Toolbar/HeadingToolbar.d.ts +12 -0
- package/components/Toolbar/HeadingToolbar.js +23 -0
- package/components/Toolbar/HeadingToolbar.js.map +1 -0
- package/components/Toolbar/ParagraphToolbar.d.ts +12 -0
- package/components/Toolbar/ParagraphToolbar.js +23 -0
- package/components/Toolbar/ParagraphToolbar.js.map +1 -0
- package/components/Toolbar/Toolbar.css +423 -0
- package/components/Toolbar/Toolbar.d.ts +13 -0
- package/components/Toolbar/Toolbar.js +181 -0
- package/components/Toolbar/Toolbar.js.map +1 -0
- package/components/ToolbarActions/BoldAction.d.ts +2 -0
- package/components/ToolbarActions/BoldAction.js +43 -0
- package/components/ToolbarActions/BoldAction.js.map +1 -0
- package/components/ToolbarActions/BulletListAction.d.ts +2 -0
- package/components/ToolbarActions/BulletListAction.js +51 -0
- package/components/ToolbarActions/BulletListAction.js.map +1 -0
- package/components/ToolbarActions/CodeHighlightAction.d.ts +2 -0
- package/components/ToolbarActions/CodeHighlightAction.js +43 -0
- package/components/ToolbarActions/CodeHighlightAction.js.map +1 -0
- package/components/ToolbarActions/FontColorAction.d.ts +11 -0
- package/components/ToolbarActions/FontColorAction.js +83 -0
- package/components/ToolbarActions/FontColorAction.js.map +1 -0
- package/components/ToolbarActions/FontSizeAction.d.ts +2 -0
- package/components/ToolbarActions/FontSizeAction.js +101 -0
- package/components/ToolbarActions/FontSizeAction.js.map +1 -0
- package/components/ToolbarActions/ItalicAction.d.ts +2 -0
- package/components/ToolbarActions/ItalicAction.js +43 -0
- package/components/ToolbarActions/ItalicAction.js.map +1 -0
- package/components/ToolbarActions/LinkAction.d.ts +2 -0
- package/components/ToolbarActions/LinkAction.js +64 -0
- package/components/ToolbarActions/LinkAction.js.map +1 -0
- package/components/ToolbarActions/NumberedListAction.d.ts +2 -0
- package/components/ToolbarActions/NumberedListAction.js +53 -0
- package/components/ToolbarActions/NumberedListAction.js.map +1 -0
- package/components/ToolbarActions/QuoteAction.d.ts +2 -0
- package/components/ToolbarActions/QuoteAction.js +53 -0
- package/components/ToolbarActions/QuoteAction.js.map +1 -0
- package/components/ToolbarActions/TypographyAction.d.ts +11 -0
- package/components/ToolbarActions/TypographyAction.js +118 -0
- package/components/ToolbarActions/TypographyAction.js.map +1 -0
- package/components/ToolbarActions/UnderlineAction.d.ts +2 -0
- package/components/ToolbarActions/UnderlineAction.js +43 -0
- package/components/ToolbarActions/UnderlineAction.js.map +1 -0
- package/components/ToolbarPresets/HeadingToolbarPreset.d.ts +2 -0
- package/components/ToolbarPresets/HeadingToolbarPreset.js +52 -0
- package/components/ToolbarPresets/HeadingToolbarPreset.js.map +1 -0
- package/components/ToolbarPresets/ParagraphToolbarPreset.d.ts +2 -0
- package/components/ToolbarPresets/ParagraphToolbarPreset.js +67 -0
- package/components/ToolbarPresets/ParagraphToolbarPreset.js.map +1 -0
- package/context/FontColorActionContext.d.ts +6 -0
- package/context/FontColorActionContext.js +10 -0
- package/context/FontColorActionContext.js.map +1 -0
- package/context/RichTextEditorContext.d.ts +21 -0
- package/context/RichTextEditorContext.js +56 -0
- package/context/RichTextEditorContext.js.map +1 -0
- package/context/SharedHistoryContext.d.ts +11 -0
- package/context/SharedHistoryContext.js +26 -0
- package/context/SharedHistoryContext.js.map +1 -0
- package/context/TypographyActionContext.d.ts +7 -0
- package/context/TypographyActionContext.js +10 -0
- package/context/TypographyActionContext.js.map +1 -0
- package/hooks/useFontColorPicker.d.ts +2 -0
- package/hooks/useFontColorPicker.js +15 -0
- package/hooks/useFontColorPicker.js.map +1 -0
- package/hooks/useRichTextEditor.d.ts +2 -0
- package/hooks/useRichTextEditor.js +15 -0
- package/hooks/useRichTextEditor.js.map +1 -0
- package/hooks/useTypographyAction.d.ts +1 -0
- package/hooks/useTypographyAction.js +15 -0
- package/hooks/useTypographyAction.js.map +1 -0
- package/hooks/useWebinyList.d.ts +2 -0
- package/hooks/useWebinyList.js +39 -0
- package/hooks/useWebinyList.js.map +1 -0
- package/hooks/useWebinyQuote.d.ts +2 -0
- package/hooks/useWebinyQuote.js +20 -0
- package/hooks/useWebinyQuote.js.map +1 -0
- package/images/icons/LICENSE.md +5 -0
- package/images/icons/chat-square-quote.svg +1 -0
- package/images/icons/chevron-down.svg +1 -0
- package/images/icons/code.svg +1 -0
- package/images/icons/font-color.svg +1 -0
- package/images/icons/link.svg +1 -0
- package/images/icons/list-ol.svg +1 -0
- package/images/icons/list-ul.svg +1 -0
- package/images/icons/pencil-fill.svg +1 -0
- package/images/icons/text-center.svg +1 -0
- package/images/icons/text-left.svg +1 -0
- package/images/icons/text-paragraph.svg +1 -0
- package/images/icons/text-right.svg +1 -0
- package/images/icons/type-bold.svg +1 -0
- package/images/icons/type-h1.svg +1 -0
- package/images/icons/type-h2.svg +1 -0
- package/images/icons/type-h3.svg +1 -0
- package/images/icons/type-h4.svg +1 -0
- package/images/icons/type-h5.svg +1 -0
- package/images/icons/type-h6.svg +1 -0
- package/images/icons/type-italic.svg +1 -0
- package/images/icons/type-strikethrough.svg +1 -0
- package/images/icons/type-underline.svg +1 -0
- package/images/icons/unlink_icon.svg +1 -0
- package/index.d.ts +40 -0
- package/index.js +281 -0
- package/index.js.map +1 -0
- package/nodes/FontColorNode.d.ts +43 -0
- package/nodes/FontColorNode.js +127 -0
- package/nodes/FontColorNode.js.map +1 -0
- package/nodes/TypographyElementNode.d.ts +42 -0
- package/nodes/TypographyElementNode.js +154 -0
- package/nodes/TypographyElementNode.js.map +1 -0
- package/nodes/WebinyQuoteNode.d.ts +29 -0
- package/nodes/WebinyQuoteNode.js +148 -0
- package/nodes/WebinyQuoteNode.js.map +1 -0
- package/nodes/list-node/WebinyListItemNode.d.ts +46 -0
- package/nodes/list-node/WebinyListItemNode.js +441 -0
- package/nodes/list-node/WebinyListItemNode.js.map +1 -0
- package/nodes/list-node/WebinyListNode.d.ts +38 -0
- package/nodes/list-node/WebinyListNode.js +253 -0
- package/nodes/list-node/WebinyListNode.js.map +1 -0
- package/nodes/list-node/formatList.d.ts +12 -0
- package/nodes/list-node/formatList.js +423 -0
- package/nodes/list-node/formatList.js.map +1 -0
- package/nodes/webinyNodes.d.ts +7 -0
- package/nodes/webinyNodes.js +21 -0
- package/nodes/webinyNodes.js.map +1 -0
- package/package.json +41 -0
- package/plugins/AutoLinkPlugin/AutoLinkPlugin.d.ts +11 -0
- package/plugins/AutoLinkPlugin/AutoLinkPlugin.js +46 -0
- package/plugins/AutoLinkPlugin/AutoLinkPlugin.js.map +1 -0
- package/plugins/AutoLinkPlugin/index.d.ts +1 -0
- package/plugins/AutoLinkPlugin/index.js +16 -0
- package/plugins/AutoLinkPlugin/index.js.map +1 -0
- package/plugins/BlurEventPlugin/BlurEventPlugin.d.ts +7 -0
- package/plugins/BlurEventPlugin/BlurEventPlugin.js +28 -0
- package/plugins/BlurEventPlugin/BlurEventPlugin.js.map +1 -0
- package/plugins/ClickableLinkPlugin/ClickableLinkPlugin.d.ts +17 -0
- package/plugins/ClickableLinkPlugin/ClickableLinkPlugin.js +88 -0
- package/plugins/ClickableLinkPlugin/ClickableLinkPlugin.js.map +1 -0
- package/plugins/ClickableLinkPlugin/index.d.ts +1 -0
- package/plugins/ClickableLinkPlugin/index.js +16 -0
- package/plugins/ClickableLinkPlugin/index.js.map +1 -0
- package/plugins/CodeHighlightPlugin/CodeHighlightPlugin.d.ts +1 -0
- package/plugins/CodeHighlightPlugin/CodeHighlightPlugin.js +20 -0
- package/plugins/CodeHighlightPlugin/CodeHighlightPlugin.js.map +1 -0
- package/plugins/CodeHighlightPlugin/index.d.ts +1 -0
- package/plugins/CodeHighlightPlugin/index.js +16 -0
- package/plugins/CodeHighlightPlugin/index.js.map +1 -0
- package/plugins/FloatingLinkEditorPlugin/FloatingLinkEditorPlugin.css +118 -0
- package/plugins/FloatingLinkEditorPlugin/FloatingLinkEditorPlugin.d.ts +7 -0
- package/plugins/FloatingLinkEditorPlugin/FloatingLinkEditorPlugin.js +222 -0
- package/plugins/FloatingLinkEditorPlugin/FloatingLinkEditorPlugin.js.map +1 -0
- package/plugins/FloatingLinkEditorPlugin/index.d.ts +1 -0
- package/plugins/FloatingLinkEditorPlugin/index.js +16 -0
- package/plugins/FloatingLinkEditorPlugin/index.js.map +1 -0
- package/plugins/FontColorPlugin/FontColorPlugin.d.ts +2 -0
- package/plugins/FontColorPlugin/FontColorPlugin.js +38 -0
- package/plugins/FontColorPlugin/FontColorPlugin.js.map +1 -0
- package/plugins/LexicalUpdateStatePlugin/LexicalUpdateStatePlugin.d.ts +8 -0
- package/plugins/LexicalUpdateStatePlugin/LexicalUpdateStatePlugin.js +34 -0
- package/plugins/LexicalUpdateStatePlugin/LexicalUpdateStatePlugin.js.map +1 -0
- package/plugins/LexicalUpdateStatePlugin/index.d.ts +1 -0
- package/plugins/LexicalUpdateStatePlugin/index.js +16 -0
- package/plugins/LexicalUpdateStatePlugin/index.js.map +1 -0
- package/plugins/TypographyPlugin/TypographyPlugin.d.ts +2 -0
- package/plugins/TypographyPlugin/TypographyPlugin.js +31 -0
- package/plugins/TypographyPlugin/TypographyPlugin.js.map +1 -0
- package/plugins/WebinyListPLugin/WebinyListPlugin.d.ts +1 -0
- package/plugins/WebinyListPLugin/WebinyListPlugin.js +25 -0
- package/plugins/WebinyListPLugin/WebinyListPlugin.js.map +1 -0
- package/plugins/WebinyQuoteNodePlugin/WebinyQuoteNodePlugin.d.ts +1 -0
- package/plugins/WebinyQuoteNodePlugin/WebinyQuoteNodePlugin.js +24 -0
- package/plugins/WebinyQuoteNodePlugin/WebinyQuoteNodePlugin.js.map +1 -0
- package/themes/webinyLexicalTheme.css +420 -0
- package/themes/webinyLexicalTheme.d.ts +9 -0
- package/themes/webinyLexicalTheme.js +87 -0
- package/themes/webinyLexicalTheme.js.map +1 -0
- package/types.d.ts +61 -0
- package/types.js +12 -0
- package/types.js.map +1 -0
- package/ui/Divider.d.ts +2 -0
- package/ui/Divider.js +13 -0
- package/ui/Divider.js.map +1 -0
- package/ui/DropDown.d.ts +26 -0
- package/ui/DropDown.js +173 -0
- package/ui/DropDown.js.map +1 -0
- package/ui/Input.css +32 -0
- package/ui/LinkPreview.css +69 -0
- package/ui/LinkPreview.d.ts +12 -0
- package/ui/LinkPreview.js +101 -0
- package/ui/LinkPreview.js.map +1 -0
- package/ui/Placeholder.css +23 -0
- package/ui/Placeholder.d.ts +13 -0
- package/ui/Placeholder.js +24 -0
- package/ui/Placeholder.js.map +1 -0
- package/ui/TextInput.d.ts +18 -0
- package/ui/TextInput.js +39 -0
- package/ui/TextInput.js.map +1 -0
- package/ui/ToolbarActionDialog.d.ts +12 -0
- package/ui/ToolbarActionDialog.js +106 -0
- package/ui/ToolbarActionDialog.js.map +1 -0
- package/utils/generateInitialLexicalValue.d.ts +5 -0
- package/utils/generateInitialLexicalValue.js +29 -0
- package/utils/generateInitialLexicalValue.js.map +1 -0
- package/utils/getDOMRangeRect.d.ts +10 -0
- package/utils/getDOMRangeRect.js +27 -0
- package/utils/getDOMRangeRect.js.map +1 -0
- package/utils/getLexicalTextSelectionState.d.ts +5 -0
- package/utils/getLexicalTextSelectionState.js +141 -0
- package/utils/getLexicalTextSelectionState.js.map +1 -0
- package/utils/getSelectedNode.d.ts +2 -0
- package/utils/getSelectedNode.js +30 -0
- package/utils/getSelectedNode.js.map +1 -0
- package/utils/isValidJSON.d.ts +1 -0
- package/utils/isValidJSON.js +18 -0
- package/utils/isValidJSON.js.map +1 -0
- package/utils/isValidLexicalData.d.ts +2 -0
- package/utils/isValidLexicalData.js +24 -0
- package/utils/isValidLexicalData.js.map +1 -0
- package/utils/nodes/clearNodeFormating.d.ts +2 -0
- package/utils/nodes/clearNodeFormating.js +28 -0
- package/utils/nodes/clearNodeFormating.js.map +1 -0
- package/utils/nodes/formatToParagraph.d.ts +2 -0
- package/utils/nodes/formatToParagraph.js +19 -0
- package/utils/nodes/formatToParagraph.js.map +1 -0
- package/utils/nodes/formatToQuote.d.ts +2 -0
- package/utils/nodes/formatToQuote.js +20 -0
- package/utils/nodes/formatToQuote.js.map +1 -0
- package/utils/nodes/list-node.d.ts +11 -0
- package/utils/nodes/list-node.js +107 -0
- package/utils/nodes/list-node.js.map +1 -0
- package/utils/point.d.ts +21 -0
- package/utils/point.js +77 -0
- package/utils/point.js.map +1 -0
- package/utils/rect.d.ts +47 -0
- package/utils/rect.js +169 -0
- package/utils/rect.js.map +1 -0
- package/utils/sanitizeUrl.d.ts +8 -0
- package/utils/sanitizeUrl.js +27 -0
- package/utils/sanitizeUrl.js.map +1 -0
- package/utils/setFloatingElemPosition.d.ts +3 -0
- package/utils/setFloatingElemPosition.js +40 -0
- package/utils/setFloatingElemPosition.js.map +1 -0
- package/utils/styleObjectToString.d.ts +2 -0
- package/utils/styleObjectToString.js +22 -0
- package/utils/styleObjectToString.js.map +1 -0
- package/utils/toTypographyEmotionMap.d.ts +3 -0
- package/utils/toTypographyEmotionMap.js +36 -0
- 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,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,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"}
|