@webiny/lexical-editor 0.0.0-unstable.ecd8734205 → 5.35.0-beta.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.
- 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.js.map +1 -1
- package/components/AddRichTextEditorPlugin.d.ts +2 -0
- package/components/AddRichTextEditorPlugin.js +4 -2
- package/components/AddRichTextEditorPlugin.js.map +1 -1
- package/components/AddToolbarAction.js.map +1 -1
- package/components/Editor/HeadingEditor.js +2 -1
- package/components/Editor/HeadingEditor.js.map +1 -1
- package/components/Editor/ParagraphEditor.js +3 -3
- package/components/Editor/ParagraphEditor.js.map +1 -1
- package/components/Editor/RichTextEditor.d.ts +4 -1
- package/components/Editor/RichTextEditor.js +37 -6
- package/components/Editor/RichTextEditor.js.map +1 -1
- 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 +8 -1
- package/components/LexicalHtmlRenderer.js +29 -6
- package/components/LexicalHtmlRenderer.js.map +1 -1
- package/components/Toolbar/HeadingToolbar.js.map +1 -1
- package/components/Toolbar/ParagraphToolbar.js.map +1 -1
- package/components/Toolbar/Toolbar.css +9 -0
- package/components/Toolbar/Toolbar.js +25 -5
- package/components/Toolbar/Toolbar.js.map +1 -1
- package/components/ToolbarActions/BoldAction.d.ts +0 -3
- package/components/ToolbarActions/BoldAction.js +8 -3
- package/components/ToolbarActions/BoldAction.js.map +1 -1
- package/components/ToolbarActions/BulletListAction.d.ts +0 -3
- package/components/ToolbarActions/BulletListAction.js +17 -55
- package/components/ToolbarActions/BulletListAction.js.map +1 -1
- package/components/ToolbarActions/CodeHighlightAction.d.ts +0 -4
- package/components/ToolbarActions/CodeHighlightAction.js +8 -4
- package/components/ToolbarActions/CodeHighlightAction.js.map +1 -1
- 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.js +0 -3
- package/components/ToolbarActions/FontSizeAction.js.map +1 -1
- package/components/ToolbarActions/ItalicAction.d.ts +0 -3
- package/components/ToolbarActions/ItalicAction.js +8 -3
- package/components/ToolbarActions/ItalicAction.js.map +1 -1
- package/components/ToolbarActions/LinkAction.d.ts +0 -5
- package/components/ToolbarActions/LinkAction.js +0 -5
- package/components/ToolbarActions/LinkAction.js.map +1 -1
- package/components/ToolbarActions/NumberedListAction.d.ts +0 -3
- package/components/ToolbarActions/NumberedListAction.js +17 -53
- package/components/ToolbarActions/NumberedListAction.js.map +1 -1
- package/components/ToolbarActions/QuoteAction.d.ts +0 -2
- package/components/ToolbarActions/QuoteAction.js +16 -29
- package/components/ToolbarActions/QuoteAction.js.map +1 -1
- 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 +0 -3
- package/components/ToolbarActions/UnderlineAction.js +8 -3
- package/components/ToolbarActions/UnderlineAction.js.map +1 -1
- package/components/ToolbarPresets/HeadingToolbarPreset.js +8 -0
- package/components/ToolbarPresets/HeadingToolbarPreset.js.map +1 -1
- package/components/ToolbarPresets/ParagraphToolbarPreset.js +8 -0
- package/components/ToolbarPresets/ParagraphToolbarPreset.js.map +1 -1
- 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 +10 -0
- package/context/RichTextEditorContext.js +28 -1
- package/context/RichTextEditorContext.js.map +1 -1
- 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.js.map +1 -1
- 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/font-color.svg +1 -0
- package/index.d.ts +7 -1
- package/index.js +44 -2
- package/index.js.map +1 -1
- 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 +6 -1
- package/nodes/webinyNodes.js +8 -2
- package/nodes/webinyNodes.js.map +1 -1
- package/package.json +9 -6
- package/plugins/AutoLinkPlugin/AutoLinkPlugin.js.map +1 -1
- package/plugins/AutoLinkPlugin/index.js.map +1 -1
- package/plugins/BlurEventPlugin/BlurEventPlugin.js.map +1 -1
- package/plugins/ClickableLinkPlugin/ClickableLinkPlugin.js.map +1 -1
- package/plugins/ClickableLinkPlugin/index.js.map +1 -1
- package/plugins/CodeHighlightPlugin/CodeHighlightPlugin.js.map +1 -1
- package/plugins/CodeHighlightPlugin/index.js.map +1 -1
- package/plugins/FloatingLinkEditorPlugin/FloatingLinkEditorPlugin.js.map +1 -1
- package/plugins/FloatingLinkEditorPlugin/index.js.map +1 -1
- 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.js.map +1 -1
- package/plugins/LexicalUpdateStatePlugin/index.js.map +1 -1
- 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 +0 -2
- package/themes/webinyLexicalTheme.d.ts +7 -8
- package/themes/webinyLexicalTheme.js +7 -27
- package/themes/webinyLexicalTheme.js.map +1 -1
- package/types.d.ts +59 -0
- package/types.js +8 -1
- package/types.js.map +1 -1
- package/ui/Divider.js.map +1 -1
- package/ui/DropDown.d.ts +2 -1
- package/ui/DropDown.js +7 -2
- package/ui/DropDown.js.map +1 -1
- package/ui/LinkPreview.js.map +1 -1
- package/ui/Placeholder.js.map +1 -1
- package/ui/TextInput.js.map +1 -1
- package/ui/ToolbarActionDialog.d.ts +12 -0
- package/ui/ToolbarActionDialog.js +106 -0
- package/ui/ToolbarActionDialog.js.map +1 -0
- package/utils/generateInitialLexicalValue.js.map +1 -1
- package/utils/getDOMRangeRect.js.map +1 -1
- package/utils/getLexicalTextSelectionState.d.ts +5 -0
- package/utils/getLexicalTextSelectionState.js +141 -0
- package/utils/getLexicalTextSelectionState.js.map +1 -0
- package/utils/getSelectedNode.js.map +1 -1
- package/utils/isValidJSON.js.map +1 -1
- package/utils/isValidLexicalData.js.map +1 -1
- 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.js.map +1 -1
- package/utils/rect.js.map +1 -1
- package/utils/sanitizeUrl.js.map +1 -1
- package/utils/setFloatingElemPosition.js.map +1 -1
- 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,11 @@
|
|
|
1
|
+
import type { LexicalNode } from "lexical";
|
|
2
|
+
import { WebinyListNode } from "../../nodes/list-node/WebinyListNode";
|
|
3
|
+
import { WebinyListItemNode } from "../../nodes/list-node/WebinyListItemNode";
|
|
4
|
+
export declare function $getListDepth(listNode: WebinyListNode): number;
|
|
5
|
+
export declare function $getTopListNode(listItem: LexicalNode): WebinyListNode;
|
|
6
|
+
export declare function $getAllListItems(node: WebinyListNode): Array<WebinyListItemNode>;
|
|
7
|
+
export declare function isNestedListNode(node: LexicalNode | null | undefined): boolean;
|
|
8
|
+
export declare function findNearestWebinyListItemNode(node: LexicalNode): WebinyListItemNode | null;
|
|
9
|
+
export declare function getUniqueWebinyListItemNodes(nodeList: Array<LexicalNode>): Array<WebinyListItemNode>;
|
|
10
|
+
export declare function $removeHighestEmptyListParent(sublist: WebinyListItemNode | WebinyListNode): void;
|
|
11
|
+
export declare function wrapInListItem(node: LexicalNode): WebinyListItemNode;
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.$getAllListItems = $getAllListItems;
|
|
7
|
+
exports.$getListDepth = $getListDepth;
|
|
8
|
+
exports.$getTopListNode = $getTopListNode;
|
|
9
|
+
exports.$removeHighestEmptyListParent = $removeHighestEmptyListParent;
|
|
10
|
+
exports.findNearestWebinyListItemNode = findNearestWebinyListItemNode;
|
|
11
|
+
exports.getUniqueWebinyListItemNodes = getUniqueWebinyListItemNodes;
|
|
12
|
+
exports.isNestedListNode = isNestedListNode;
|
|
13
|
+
exports.wrapInListItem = wrapInListItem;
|
|
14
|
+
var _WebinyListNode = require("../../nodes/list-node/WebinyListNode");
|
|
15
|
+
var _WebinyListItemNode = require("../../nodes/list-node/WebinyListItemNode");
|
|
16
|
+
function $getListDepth(listNode) {
|
|
17
|
+
var depth = 1;
|
|
18
|
+
var parent = listNode.getParent();
|
|
19
|
+
while (parent !== null) {
|
|
20
|
+
if ((0, _WebinyListItemNode.$isWebinyListItemNode)(parent)) {
|
|
21
|
+
var parentList = parent.getParent();
|
|
22
|
+
if ((0, _WebinyListNode.$isWebinyListNode)(parentList)) {
|
|
23
|
+
depth++;
|
|
24
|
+
parent = (parentList === null || parentList === void 0 ? void 0 : parentList.getParent()) || null;
|
|
25
|
+
continue;
|
|
26
|
+
}
|
|
27
|
+
console.log("A WebinyListItemNode must have a WebinyListNode for a parent.");
|
|
28
|
+
}
|
|
29
|
+
return depth;
|
|
30
|
+
}
|
|
31
|
+
return depth;
|
|
32
|
+
}
|
|
33
|
+
function $getTopListNode(listItem) {
|
|
34
|
+
var list = listItem.getParent();
|
|
35
|
+
if (!(0, _WebinyListNode.$isWebinyListNode)(list)) {
|
|
36
|
+
console.log("A WebinyListItemNode must have a ListNode for a parent.");
|
|
37
|
+
return listItem;
|
|
38
|
+
}
|
|
39
|
+
var parent = list;
|
|
40
|
+
while (parent !== null) {
|
|
41
|
+
parent = parent.getParent();
|
|
42
|
+
if ((0, _WebinyListNode.$isWebinyListNode)(parent)) {
|
|
43
|
+
list = parent;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return list;
|
|
47
|
+
}
|
|
48
|
+
function $getAllListItems(node) {
|
|
49
|
+
var listItemNodes = [];
|
|
50
|
+
var listChildren = node.getChildren().filter(_WebinyListItemNode.$isWebinyListItemNode);
|
|
51
|
+
for (var i = 0; i < listChildren.length; i++) {
|
|
52
|
+
var listItemNode = listChildren[i];
|
|
53
|
+
var firstChild = listItemNode === null || listItemNode === void 0 ? void 0 : listItemNode.getFirstChild();
|
|
54
|
+
if ((0, _WebinyListNode.$isWebinyListNode)(firstChild)) {
|
|
55
|
+
listItemNodes = listItemNodes.concat($getAllListItems(firstChild));
|
|
56
|
+
} else {
|
|
57
|
+
listItemNodes.push(listItemNode);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
return listItemNodes;
|
|
61
|
+
}
|
|
62
|
+
function isNestedListNode(node) {
|
|
63
|
+
return (0, _WebinyListItemNode.$isWebinyListItemNode)(node) && (0, _WebinyListNode.$isWebinyListNode)(node === null || node === void 0 ? void 0 : node.getFirstChild());
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// TODO: rewrite with $findMatchingParent or *nodeOfType
|
|
67
|
+
function findNearestWebinyListItemNode(node) {
|
|
68
|
+
var currentNode = node;
|
|
69
|
+
while (currentNode !== null) {
|
|
70
|
+
if ((0, _WebinyListItemNode.$isWebinyListItemNode)(currentNode)) {
|
|
71
|
+
return currentNode;
|
|
72
|
+
}
|
|
73
|
+
currentNode = currentNode.getParent();
|
|
74
|
+
}
|
|
75
|
+
return null;
|
|
76
|
+
}
|
|
77
|
+
function getUniqueWebinyListItemNodes(nodeList) {
|
|
78
|
+
var keys = new Set();
|
|
79
|
+
for (var i = 0; i < nodeList.length; i++) {
|
|
80
|
+
var node = nodeList[i];
|
|
81
|
+
if ((0, _WebinyListItemNode.$isWebinyListItemNode)(node)) {
|
|
82
|
+
keys.add(node);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return Array.from(keys);
|
|
86
|
+
}
|
|
87
|
+
function $removeHighestEmptyListParent(sublist) {
|
|
88
|
+
// Nodes may be repeatedly indented, to create deeply nested lists that each
|
|
89
|
+
// contain just one bullet.
|
|
90
|
+
// Our goal is to remove these (empty) deeply nested lists. The easiest
|
|
91
|
+
// way to do that is crawl back up the tree until we find a node that has siblings
|
|
92
|
+
// (e.g. is actually part of the list contents) and delete that, or delete
|
|
93
|
+
// the root of the list (if no list nodes have siblings.)
|
|
94
|
+
var emptyListPtr = sublist;
|
|
95
|
+
while (emptyListPtr.getNextSibling() == null && emptyListPtr.getPreviousSibling() == null) {
|
|
96
|
+
var parent = emptyListPtr.getParent();
|
|
97
|
+
if (parent == null || !((0, _WebinyListItemNode.$isWebinyListItemNode)(emptyListPtr) || (0, _WebinyListNode.$isWebinyListNode)(emptyListPtr))) {
|
|
98
|
+
break;
|
|
99
|
+
}
|
|
100
|
+
emptyListPtr = parent;
|
|
101
|
+
}
|
|
102
|
+
emptyListPtr.remove();
|
|
103
|
+
}
|
|
104
|
+
function wrapInListItem(node) {
|
|
105
|
+
var listItemWrapper = (0, _WebinyListItemNode.$createWebinyListItemNode)();
|
|
106
|
+
return listItemWrapper.append(node);
|
|
107
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["$getListDepth","listNode","depth","parent","getParent","$isWebinyListItemNode","parentList","$isWebinyListNode","console","log","$getTopListNode","listItem","list","$getAllListItems","node","listItemNodes","listChildren","getChildren","filter","i","length","listItemNode","firstChild","getFirstChild","concat","push","isNestedListNode","findNearestWebinyListItemNode","currentNode","getUniqueWebinyListItemNodes","nodeList","keys","Set","add","Array","from","$removeHighestEmptyListParent","sublist","emptyListPtr","getNextSibling","getPreviousSibling","remove","wrapInListItem","listItemWrapper","$createWebinyListItemNode","append"],"sources":["list-node.ts"],"sourcesContent":["import type { LexicalNode } from \"lexical\";\n\nimport { $isWebinyListNode, WebinyListNode } from \"~/nodes/list-node/WebinyListNode\";\nimport {\n $createWebinyListItemNode,\n $isWebinyListItemNode,\n WebinyListItemNode\n} from \"~/nodes/list-node/WebinyListItemNode\";\n\nexport function $getListDepth(listNode: WebinyListNode): number {\n let depth = 1;\n let parent = listNode.getParent();\n\n while (parent !== null) {\n if ($isWebinyListItemNode(parent)) {\n const parentList = parent.getParent();\n\n if ($isWebinyListNode(parentList)) {\n depth++;\n parent = parentList?.getParent() || null;\n continue;\n }\n console.log(\"A WebinyListItemNode must have a WebinyListNode for a parent.\");\n }\n\n return depth;\n }\n\n return depth;\n}\n\nexport function $getTopListNode(listItem: LexicalNode): WebinyListNode {\n let list = listItem.getParent<WebinyListNode>();\n\n if (!$isWebinyListNode(list)) {\n console.log(\"A WebinyListItemNode must have a ListNode for a parent.\");\n return listItem as WebinyListNode;\n }\n\n let parent: WebinyListNode | null = list;\n\n while (parent !== null) {\n parent = parent.getParent();\n\n if ($isWebinyListNode(parent)) {\n list = parent;\n }\n }\n\n return list;\n}\n\nexport function $getAllListItems(node: WebinyListNode): Array<WebinyListItemNode> {\n let listItemNodes: Array<WebinyListItemNode> = [];\n const listChildren: Array<WebinyListItemNode> = node\n .getChildren()\n .filter($isWebinyListItemNode);\n\n for (let i = 0; i < listChildren.length; i++) {\n const listItemNode = listChildren[i];\n const firstChild = listItemNode?.getFirstChild();\n\n if ($isWebinyListNode(firstChild)) {\n listItemNodes = listItemNodes.concat($getAllListItems(firstChild));\n } else {\n listItemNodes.push(listItemNode);\n }\n }\n\n return listItemNodes;\n}\n\nexport function isNestedListNode(node: LexicalNode | null | undefined): boolean {\n return $isWebinyListItemNode(node) && $isWebinyListNode(node?.getFirstChild());\n}\n\n// TODO: rewrite with $findMatchingParent or *nodeOfType\nexport function findNearestWebinyListItemNode(node: LexicalNode): WebinyListItemNode | null {\n let currentNode: LexicalNode | null = node;\n\n while (currentNode !== null) {\n if ($isWebinyListItemNode(currentNode)) {\n return currentNode;\n }\n currentNode = currentNode.getParent();\n }\n\n return null;\n}\n\nexport function getUniqueWebinyListItemNodes(\n nodeList: Array<LexicalNode>\n): Array<WebinyListItemNode> {\n const keys = new Set<WebinyListItemNode>();\n\n for (let i = 0; i < nodeList.length; i++) {\n const node = nodeList[i];\n\n if ($isWebinyListItemNode(node)) {\n keys.add(node);\n }\n }\n\n return Array.from(keys);\n}\n\nexport function $removeHighestEmptyListParent(sublist: WebinyListItemNode | WebinyListNode) {\n // Nodes may be repeatedly indented, to create deeply nested lists that each\n // contain just one bullet.\n // Our goal is to remove these (empty) deeply nested lists. The easiest\n // way to do that is crawl back up the tree until we find a node that has siblings\n // (e.g. is actually part of the list contents) and delete that, or delete\n // the root of the list (if no list nodes have siblings.)\n let emptyListPtr = sublist;\n\n while (emptyListPtr.getNextSibling() == null && emptyListPtr.getPreviousSibling() == null) {\n const parent = emptyListPtr.getParent<WebinyListItemNode | WebinyListNode>();\n\n if (\n parent == null ||\n !($isWebinyListItemNode(emptyListPtr) || $isWebinyListNode(emptyListPtr))\n ) {\n break;\n }\n\n emptyListPtr = parent;\n }\n\n emptyListPtr.remove();\n}\n\nexport function wrapInListItem(node: LexicalNode): WebinyListItemNode {\n const listItemWrapper = $createWebinyListItemNode();\n return listItemWrapper.append(node);\n}\n"],"mappings":";;;;;;;;;;;;;AAEA;AACA;AAMO,SAASA,aAAa,CAACC,QAAwB,EAAU;EAC5D,IAAIC,KAAK,GAAG,CAAC;EACb,IAAIC,MAAM,GAAGF,QAAQ,CAACG,SAAS,EAAE;EAEjC,OAAOD,MAAM,KAAK,IAAI,EAAE;IACpB,IAAI,IAAAE,yCAAqB,EAACF,MAAM,CAAC,EAAE;MAC/B,IAAMG,UAAU,GAAGH,MAAM,CAACC,SAAS,EAAE;MAErC,IAAI,IAAAG,iCAAiB,EAACD,UAAU,CAAC,EAAE;QAC/BJ,KAAK,EAAE;QACPC,MAAM,GAAG,CAAAG,UAAU,aAAVA,UAAU,uBAAVA,UAAU,CAAEF,SAAS,EAAE,KAAI,IAAI;QACxC;MACJ;MACAI,OAAO,CAACC,GAAG,CAAC,+DAA+D,CAAC;IAChF;IAEA,OAAOP,KAAK;EAChB;EAEA,OAAOA,KAAK;AAChB;AAEO,SAASQ,eAAe,CAACC,QAAqB,EAAkB;EACnE,IAAIC,IAAI,GAAGD,QAAQ,CAACP,SAAS,EAAkB;EAE/C,IAAI,CAAC,IAAAG,iCAAiB,EAACK,IAAI,CAAC,EAAE;IAC1BJ,OAAO,CAACC,GAAG,CAAC,yDAAyD,CAAC;IACtE,OAAOE,QAAQ;EACnB;EAEA,IAAIR,MAA6B,GAAGS,IAAI;EAExC,OAAOT,MAAM,KAAK,IAAI,EAAE;IACpBA,MAAM,GAAGA,MAAM,CAACC,SAAS,EAAE;IAE3B,IAAI,IAAAG,iCAAiB,EAACJ,MAAM,CAAC,EAAE;MAC3BS,IAAI,GAAGT,MAAM;IACjB;EACJ;EAEA,OAAOS,IAAI;AACf;AA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M,EAAED,CAAC,EAAE,EAAE;IACtC,IAAML,IAAI,GAAGgB,QAAQ,CAACX,CAAC,CAAC;IAExB,IAAI,IAAAd,yCAAqB,EAACS,IAAI,CAAC,EAAE;MAC7BiB,IAAI,CAACE,GAAG,CAACnB,IAAI,CAAC;IAClB;EACJ;EAEA,OAAOoB,KAAK,CAACC,IAAI,CAACJ,IAAI,CAAC;AAC3B;AAEO,SAASK,6BAA6B,CAACC,OAA4C,EAAE;EACxF;EACA;EACA;EACA;EACA;EACA;EACA,IAAIC,YAAY,GAAGD,OAAO;EAE1B,OAAOC,YAAY,CAACC,cAAc,EAAE,IAAI,IAAI,IAAID,YAAY,CAACE,kBAAkB,EAAE,IAAI,IAAI,EAAE;IACvF,IAAMrC,MAAM,GAAGmC,YAAY,CAAClC,SAAS,EAAuC;IAE5E,IACID,MAAM,IAAI,IAAI,IACd,EAAE,IAAAE,yCAAqB,EAACiC,YAAY,CAAC,IAAI,IAAA/B,iCAAiB,EAAC+B,YAAY,CAAC,CAAC,EAC3E;MACE;IACJ;IAEAA,YAAY,GAAGnC,MAAM;EACzB;EAEAmC,YAAY,CAACG,MAAM,EAAE;AACzB;AAEO,SAASC,cAAc,CAAC5B,IAAiB,EAAsB;EAClE,IAAM6B,eAAe,GAAG,IAAAC,6CAAyB,GAAE;EACnD,OAAOD,eAAe,CAACE,MAAM,CAAC/B,IAAI,CAAC;AACvC"}
|
package/utils/point.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Point","x","y","
|
|
1
|
+
{"version":3,"names":["Point","x","y","_x","_y","point","Math","abs","calcDeltaXTo","calcDeltaYTo","sqrt","pow","isPoint"],"sources":["point.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 */\nexport class Point {\n private readonly _x: number;\n private readonly _y: number;\n\n constructor(x: number, y: number) {\n this._x = x;\n this._y = y;\n }\n\n get x(): number {\n return this._x;\n }\n\n get y(): number {\n return this._y;\n }\n\n public equals({ x, y }: Point): boolean {\n return this.x === x && this.y === y;\n }\n\n public calcDeltaXTo({ x }: Point): number {\n return this.x - x;\n }\n\n public calcDeltaYTo({ y }: Point): number {\n return this.y - y;\n }\n\n public calcHorizontalDistanceTo(point: Point): number {\n return Math.abs(this.calcDeltaXTo(point));\n }\n\n public calcVerticalDistance(point: Point): number {\n return Math.abs(this.calcDeltaYTo(point));\n }\n\n public calcDistanceTo(point: Point): number {\n return Math.sqrt(\n Math.pow(this.calcDeltaXTo(point), 2) + Math.pow(this.calcDeltaYTo(point), 2)\n );\n }\n}\n\nexport function isPoint(x: unknown): x is Point {\n return x instanceof Point;\n}\n"],"mappings":";;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AANA,IAOaA,KAAK;EAId,eAAYC,CAAS,EAAEC,CAAS,EAAE;IAAA;IAAA;IAAA;IAC9B,IAAI,CAACC,EAAE,GAAGF,CAAC;IACX,IAAI,CAACG,EAAE,GAAGF,CAAC;EACf;EAAC;IAAA;IAAA,KAED,eAAgB;MACZ,OAAO,IAAI,CAACC,EAAE;IAClB;EAAC;IAAA;IAAA,KAED,eAAgB;MACZ,OAAO,IAAI,CAACC,EAAE;IAClB;EAAC;IAAA;IAAA,OAED,sBAAwC;MAAA,IAAxBH,CAAC,QAADA,CAAC;QAAEC,CAAC,QAADA,CAAC;MAChB,OAAO,IAAI,CAACD,CAAC,KAAKA,CAAC,IAAI,IAAI,CAACC,CAAC,KAAKA,CAAC;IACvC;EAAC;IAAA;IAAA,OAED,6BAA0C;MAAA,IAApBD,CAAC,SAADA,CAAC;MACnB,OAAO,IAAI,CAACA,CAAC,GAAGA,CAAC;IACrB;EAAC;IAAA;IAAA,OAED,6BAA0C;MAAA,IAApBC,CAAC,SAADA,CAAC;MACnB,OAAO,IAAI,CAACA,CAAC,GAAGA,CAAC;IACrB;EAAC;IAAA;IAAA,OAED,kCAAgCG,KAAY,EAAU;MAClD,OAAOC,IAAI,CAACC,GAAG,CAAC,IAAI,CAACC,YAAY,CAACH,KAAK,CAAC,CAAC;IAC7C;EAAC;IAAA;IAAA,OAED,8BAA4BA,KAAY,EAAU;MAC9C,OAAOC,IAAI,CAACC,GAAG,CAAC,IAAI,CAACE,YAAY,CAACJ,KAAK,CAAC,CAAC;IAC7C;EAAC;IAAA;IAAA,OAED,wBAAsBA,KAAY,EAAU;MACxC,OAAOC,IAAI,CAACI,IAAI,CACZJ,IAAI,CAACK,GAAG,CAAC,IAAI,CAACH,YAAY,CAACH,KAAK,CAAC,EAAE,CAAC,CAAC,GAAGC,IAAI,CAACK,GAAG,CAAC,IAAI,CAACF,YAAY,CAACJ,KAAK,CAAC,EAAE,CAAC,CAAC,CAChF;IACL;EAAC;EAAA;AAAA;AAAA;AAGE,SAASO,OAAO,CAACX,CAAU,EAAc;EAC5C,OAAOA,CAAC,YAAYD,KAAK;AAC7B"}
|
package/utils/rect.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_point","require","Rect","left","top","right","bottom","_classCallCheck2","default","_defineProperty2","_ref","_ref2","_slicedToArray2","physicTop","physicBottom","_ref3","_ref4","physicLeft","physicRight","_top","_right","_left","_bottom","_createClass2","key","get","Math","abs","value","equals","_ref5","contains","target","isPoint","x","y","isOnTopSide","isOnBottomSide","isOnLeftSide","isOnRightSide","result","reason","intersectsWith","rect","x1","y1","w1","width","h1","height","x2","y2","w2","h2","maxX","maxY","minX","minY","generateNewRect","_ref6","_ref6$left","_ref6$top","_ref6$right","_ref6$bottom","fromLTRB","fromLWTH","fromPoints","startPoint","endPoint","fromDOM","dom","_dom$getBoundingClien","getBoundingClientRect","exports"],"sources":["rect.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 */\nimport { isPoint, Point } from \"./point\";\n\ntype ContainsPointReturn = {\n result: boolean;\n reason: {\n isOnTopSide: boolean;\n isOnBottomSide: boolean;\n isOnLeftSide: boolean;\n isOnRightSide: boolean;\n };\n};\n\nexport class Rect {\n private readonly _left: number;\n private readonly _top: number;\n private readonly _right: number;\n private readonly _bottom: number;\n\n constructor(left: number, top: number, right: number, bottom: number) {\n const [physicTop, physicBottom] = top <= bottom ? [top, bottom] : [bottom, top];\n\n const [physicLeft, physicRight] = left <= right ? [left, right] : [right, left];\n\n this._top = physicTop;\n this._right = physicRight;\n this._left = physicLeft;\n this._bottom = physicBottom;\n }\n\n get top(): number {\n return this._top;\n }\n\n get right(): number {\n return this._right;\n }\n\n get bottom(): number {\n return this._bottom;\n }\n\n get left(): number {\n return this._left;\n }\n\n get width(): number {\n return Math.abs(this._left - this._right);\n }\n\n get height(): number {\n return Math.abs(this._bottom - this._top);\n }\n\n public equals({ top, left, bottom, right }: Rect): boolean {\n return (\n top === this._top &&\n bottom === this._bottom &&\n left === this._left &&\n right === this._right\n );\n }\n\n public contains({ x, y }: Point): ContainsPointReturn;\n public contains({ top, left, bottom, right }: Rect): boolean;\n public contains(target: Point | Rect): boolean | ContainsPointReturn {\n if (isPoint(target)) {\n const { x, y } = target;\n\n const isOnTopSide = y < this._top;\n const isOnBottomSide = y > this._bottom;\n const isOnLeftSide = x < this._left;\n const isOnRightSide = x > this._right;\n\n const result = !isOnTopSide && !isOnBottomSide && !isOnLeftSide && !isOnRightSide;\n\n return {\n reason: {\n isOnBottomSide,\n isOnLeftSide,\n isOnRightSide,\n isOnTopSide\n },\n result\n };\n } else {\n const { top, left, bottom, right } = target;\n\n return (\n top >= this._top &&\n top <= this._bottom &&\n bottom >= this._top &&\n bottom <= this._bottom &&\n left >= this._left &&\n left <= this._right &&\n right >= this._left &&\n right <= this._right\n );\n }\n }\n\n public intersectsWith(rect: Rect): boolean {\n const { left: x1, top: y1, width: w1, height: h1 } = rect;\n const { left: x2, top: y2, width: w2, height: h2 } = this;\n const maxX = x1 + w1 >= x2 + w2 ? x1 + w1 : x2 + w2;\n const maxY = y1 + h1 >= y2 + h2 ? y1 + h1 : y2 + h2;\n const minX = x1 <= x2 ? x1 : x2;\n const minY = y1 <= y2 ? y1 : y2;\n return maxX - minX <= w1 + w2 && maxY - minY <= h1 + h2;\n }\n\n public generateNewRect({\n left = this.left,\n top = this.top,\n right = this.right,\n bottom = this.bottom\n }): Rect {\n return new Rect(left, top, right, bottom);\n }\n\n static fromLTRB(left: number, top: number, right: number, bottom: number): Rect {\n return new Rect(left, top, right, bottom);\n }\n\n static fromLWTH(left: number, width: number, top: number, height: number): Rect {\n return new Rect(left, top, left + width, top + height);\n }\n\n static fromPoints(startPoint: Point, endPoint: Point): Rect {\n const { y: top, x: left } = startPoint;\n const { y: bottom, x: right } = endPoint;\n return Rect.fromLTRB(left, top, right, bottom);\n }\n\n static fromDOM(dom: HTMLElement): Rect {\n const { top, width, left, height } = dom.getBoundingClientRect();\n return Rect.fromLWTH(left, width, top, height);\n }\n}\n"],"mappings":";;;;;;;;;;;AAOA,IAAAA,MAAA,GAAAC,OAAA;AAPA;AACA;AACA;AACA;AACA;AACA;AACA;AANA,IAmBaC,IAAI;EAMb,SAAAA,KAAYC,IAAY,EAAEC,GAAW,EAAEC,KAAa,EAAEC,MAAc,EAAE;IAAA,IAAAC,gBAAA,CAAAC,OAAA,QAAAN,IAAA;IAAA,IAAAO,gBAAA,CAAAD,OAAA;IAAA,IAAAC,gBAAA,CAAAD,OAAA;IAAA,IAAAC,gBAAA,CAAAD,OAAA;IAAA,IAAAC,gBAAA,CAAAD,OAAA;IAClE,IAAAE,IAAA,GAAkCN,GAAG,IAAIE,MAAM,GAAG,CAACF,GAAG,EAAEE,MAAM,CAAC,GAAG,CAACA,MAAM,EAAEF,GAAG,CAAC;MAAAO,KAAA,OAAAC,eAAA,CAAAJ,OAAA,EAAAE,IAAA;MAAxEG,SAAS,GAAAF,KAAA;MAAEG,YAAY,GAAAH,KAAA;IAE9B,IAAAI,KAAA,GAAkCZ,IA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,CAArBlC,CAAC;MACpB,OAAOhC,IAAI,CAAC8D,QAAQ,CAAC7D,IAAI,EAAEC,GAAG,EAAEC,KAAK,EAAEC,MAAM,CAAC;IAClD;EAAC;IAAAkB,GAAA;IAAAI,KAAA,EAED,SAAAyC,QAAeC,GAAgB,EAAQ;MACnC,IAAAC,qBAAA,GAAqCD,GAAG,CAACE,qBAAqB,EAAE;QAAxDpE,GAAG,GAAAmE,qBAAA,CAAHnE,GAAG;QAAE2C,KAAK,GAAAwB,qBAAA,CAALxB,KAAK;QAAE5C,IAAI,GAAAoE,qBAAA,CAAJpE,IAAI;QAAE8C,MAAM,GAAAsB,qBAAA,CAANtB,MAAM;MAChC,OAAO/C,IAAI,CAAC+D,QAAQ,CAAC9D,IAAI,EAAE4C,KAAK,EAAE3C,GAAG,EAAE6C,MAAM,CAAC;IAClD;EAAC;EAAA,OAAA/C,IAAA;AAAA;AAAAuE,OAAA,CAAAvE,IAAA,GAAAA,IAAA"}
|
|
1
|
+
{"version":3,"names":["Rect","left","top","right","bottom","physicTop","physicBottom","physicLeft","physicRight","_top","_right","_left","_bottom","Math","abs","target","isPoint","x","y","isOnTopSide","isOnBottomSide","isOnLeftSide","isOnRightSide","result","reason","rect","x1","y1","w1","width","h1","height","x2","y2","w2","h2","maxX","maxY","minX","minY","startPoint","endPoint","fromLTRB","dom","getBoundingClientRect","fromLWTH"],"sources":["rect.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 */\nimport { isPoint, Point } from \"./point\";\n\ntype ContainsPointReturn = {\n result: boolean;\n reason: {\n isOnTopSide: boolean;\n isOnBottomSide: boolean;\n isOnLeftSide: boolean;\n isOnRightSide: boolean;\n };\n};\n\nexport class Rect {\n private readonly _left: number;\n private readonly _top: number;\n private readonly _right: number;\n private readonly _bottom: number;\n\n constructor(left: number, top: number, right: number, bottom: number) {\n const [physicTop, physicBottom] = top <= bottom ? [top, bottom] : [bottom, top];\n\n const [physicLeft, physicRight] = left <= right ? [left, right] : [right, left];\n\n this._top = physicTop;\n this._right = physicRight;\n this._left = physicLeft;\n this._bottom = physicBottom;\n }\n\n get top(): number {\n return this._top;\n }\n\n get right(): number {\n return this._right;\n }\n\n get bottom(): number {\n return this._bottom;\n }\n\n get left(): number {\n return this._left;\n }\n\n get width(): number {\n return Math.abs(this._left - this._right);\n }\n\n get height(): number {\n return Math.abs(this._bottom - this._top);\n }\n\n public equals({ top, left, bottom, right }: Rect): boolean {\n return (\n top === this._top &&\n bottom === this._bottom &&\n left === this._left &&\n right === this._right\n );\n }\n\n public contains({ x, y }: Point): ContainsPointReturn;\n public contains({ top, left, bottom, right }: Rect): boolean;\n public contains(target: Point | Rect): boolean | ContainsPointReturn {\n if (isPoint(target)) {\n const { x, y } = target;\n\n const isOnTopSide = y < this._top;\n const isOnBottomSide = y > this._bottom;\n const isOnLeftSide = x < this._left;\n const isOnRightSide = x > this._right;\n\n const result = !isOnTopSide && !isOnBottomSide && !isOnLeftSide && !isOnRightSide;\n\n return {\n reason: {\n isOnBottomSide,\n isOnLeftSide,\n isOnRightSide,\n isOnTopSide\n },\n result\n };\n } else {\n const { top, left, bottom, right } = target;\n\n return (\n top >= this._top &&\n top <= this._bottom &&\n bottom >= this._top &&\n bottom <= this._bottom &&\n left >= this._left &&\n left <= this._right &&\n right >= this._left &&\n right <= this._right\n );\n }\n }\n\n public intersectsWith(rect: Rect): boolean {\n const { left: x1, top: y1, width: w1, height: h1 } = rect;\n const { left: x2, top: y2, width: w2, height: h2 } = this;\n const maxX = x1 + w1 >= x2 + w2 ? x1 + w1 : x2 + w2;\n const maxY = y1 + h1 >= y2 + h2 ? y1 + h1 : y2 + h2;\n const minX = x1 <= x2 ? x1 : x2;\n const minY = y1 <= y2 ? y1 : y2;\n return maxX - minX <= w1 + w2 && maxY - minY <= h1 + h2;\n }\n\n public generateNewRect({\n left = this.left,\n top = this.top,\n right = this.right,\n bottom = this.bottom\n }): Rect {\n return new Rect(left, top, right, bottom);\n }\n\n static fromLTRB(left: number, top: number, right: number, bottom: number): Rect {\n return new Rect(left, top, right, bottom);\n }\n\n static fromLWTH(left: number, width: number, top: number, height: number): Rect {\n return new Rect(left, top, left + width, top + height);\n }\n\n static fromPoints(startPoint: Point, endPoint: Point): Rect {\n const { y: top, x: left } = startPoint;\n const { y: bottom, x: right } = endPoint;\n return Rect.fromLTRB(left, top, right, bottom);\n }\n\n static fromDOM(dom: HTMLElement): Rect {\n const { top, width, left, height } = dom.getBoundingClientRect();\n return Rect.fromLWTH(left, width, top, height);\n }\n}\n"],"mappings":";;;;;;;;;;;AAOA;AAPA;AACA;AACA;AACA;AACA;AACA;AACA;AANA,IAmBaA,IAAI;EAMb,cAAYC,IAAY,EAAEC,GAAW,EAAEC,KAAa,EAAEC,MAAc,EAAE;IAAA;IAAA;IAAA;IAAA;IAAA;IAClE,WAAkCF,GAAG,IAAIE,MAAM,GAAG,CAACF,GAAG,EAAEE,MAAM,CAAC,GAAG,CAACA,MAAM,EAAEF,GAAG,CAAC;MAAA;MAAxEG,SAAS;MAAEC,YAAY;IAE9B,YAAkCL,IAAI,IAAIE,KAAK,GAAG,CAACF,IAAI,EAAEE,KAAK,CAAC,GAAG,CAACA,KAAK,EAAEF,IAAI,CAAC;MAAA;MAAxEM,UAAU;MAAEC,WAAW;IAE9B,IAAI,CAACC,IAAI,GAAGJ,SAAS;IACrB,IAAI,CAACK,MAAM,GAAGF,WAAW;IACzB,IAAI,CAACG,KAAK,GAAGJ,UAAU;IACvB,IAAI,CAACK,OAAO,GAAGN,YAAY;EAC/B;EAAC;IAAA;IAAA,KAED,eAAkB;MACd,OAAO,IAAI,CAACG,IAAI;IACpB;EAAC;IAAA;IAAA,KAED,eAAoB;MAChB,OAAO,IAAI,CAACC,MAAM;IACtB;EAAC;IAAA;IAAA,KAED,eAAqB;MACjB,OAAO,IAAI,CAACE,OAAO;IACvB;EAAC;IAAA;IAAA,KAED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AAI,CAAC0C,QAAQ,CAACzC,IAAI,EAAEC,GAAG,EAAEC,KAAK,EAAEC,MAAM,CAAC;IAClD;EAAC;IAAA;IAAA,OAED,iBAAeuC,GAAgB,EAAQ;MACnC,4BAAqCA,GAAG,CAACC,qBAAqB,EAAE;QAAxD1C,GAAG,yBAAHA,GAAG;QAAE2B,KAAK,yBAALA,KAAK;QAAE5B,IAAI,yBAAJA,IAAI;QAAE8B,MAAM,yBAANA,MAAM;MAChC,OAAO/B,IAAI,CAAC6C,QAAQ,CAAC5C,IAAI,EAAE4B,KAAK,EAAE3B,GAAG,EAAE6B,MAAM,CAAC;IAClD;EAAC;EAAA;AAAA;AAAA"}
|
package/utils/sanitizeUrl.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["sanitizeUrl","url","SAFE_URL_PATTERN","DATA_URL_PATTERN","String","trim","match"
|
|
1
|
+
{"version":3,"names":["sanitizeUrl","url","SAFE_URL_PATTERN","DATA_URL_PATTERN","String","trim","match"],"sources":["sanitizeUrl.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 */\n\nexport const sanitizeUrl = (url: string): string => {\n /** A pattern that matches safe URLs. */\n const SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file|sms):|[^&:/?#]*(?:[/?#]|$))/gi;\n\n /** A pattern that matches safe data URLs. */\n const DATA_URL_PATTERN =\n /^data:(?:image\\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\\/(?:mpeg|mp4|ogg|webm)|audio\\/(?:mp3|oga|ogg|opus));base64,[a-z0-9+/]+=*$/i;\n\n url = String(url).trim();\n\n if (url.match(SAFE_URL_PATTERN) || url.match(DATA_URL_PATTERN)) {\n return url;\n }\n\n return `https://`;\n};\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEO,IAAMA,WAAW,GAAG,SAAdA,WAAW,CAAIC,GAAW,EAAa;EAChD;EACA,IAAMC,gBAAgB,GAAG,iEAAiE;;EAE1F;EACA,IAAMC,gBAAgB,GAClB,qIAAqI;EAEzIF,GAAG,GAAGG,MAAM,CAACH,GAAG,CAAC,CAACI,IAAI,EAAE;EAExB,IAAIJ,GAAG,CAACK,KAAK,CAACJ,gBAAgB,CAAC,IAAID,GAAG,CAACK,KAAK,CAACH,gBAAgB,CAAC,EAAE;IAC5D,OAAOF,GAAG;EACd;EAEA;AACJ,CAAC;AAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["VERTICAL_GAP","HORIZONTAL_OFFSET","setFloatingElemPosition","targetRect","floatingElem","anchorElem","verticalGap","
|
|
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"}
|