@uva-glass/component-library 3.42.2 → 3.42.4
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/dist/{Lexical.prod-C1B_JvcI.js → Lexical.prod-qYl_ifJ6.js} +221 -221
- package/dist/Lexical.prod-qYl_ifJ6.js.map +1 -0
- package/dist/{LexicalClipboard.prod-Dd64YQH0.js → LexicalClipboard.prod-DIGbXq4v.js} +25 -25
- package/dist/{LexicalClipboard.prod-Dd64YQH0.js.map → LexicalClipboard.prod-DIGbXq4v.js.map} +1 -1
- package/dist/{LexicalComposerContext.prod-DLlRM5wP.js → LexicalComposerContext.prod-DOyoZx0P.js} +3 -3
- package/dist/{LexicalComposerContext.prod-DLlRM5wP.js.map → LexicalComposerContext.prod-DOyoZx0P.js.map} +1 -1
- package/dist/{LexicalLink.prod-ldhpNY9X.js → LexicalLink.prod-ZZwC5ABn.js} +14 -14
- package/dist/{LexicalLink.prod-ldhpNY9X.js.map → LexicalLink.prod-ZZwC5ABn.js.map} +1 -1
- package/dist/{LexicalList.prod-7DmvPZ_J.js → LexicalList.prod-UurCu6DK.js} +30 -30
- package/dist/{LexicalList.prod-7DmvPZ_J.js.map → LexicalList.prod-UurCu6DK.js.map} +1 -1
- package/dist/{LexicalSelection.prod-Dmiwka3x.js → LexicalSelection.prod-DXruZeFN.js} +2 -2
- package/dist/{LexicalSelection.prod-Dmiwka3x.js.map → LexicalSelection.prod-DXruZeFN.js.map} +1 -1
- package/dist/{LexicalTable.prod-iqHmKv_G.js → LexicalTable.prod-COFf1Spn.js} +115 -115
- package/dist/{LexicalTable.prod-iqHmKv_G.js.map → LexicalTable.prod-COFf1Spn.js.map} +1 -1
- package/dist/{LexicalUtils.prod-w0fZ_Z8S.js → LexicalUtils.prod-C3To3vrm.js} +5 -5
- package/dist/{LexicalUtils.prod-w0fZ_Z8S.js.map → LexicalUtils.prod-C3To3vrm.js.map} +1 -1
- package/dist/SortableProvider-l8-7ClBJ.js.map +1 -1
- package/dist/TableCellResizerPlugin-B9MT1fxA.js +248 -0
- package/dist/TableCellResizerPlugin-B9MT1fxA.js.map +1 -0
- package/dist/{TablePlugin-cMMBdz-x.js → TablePlugin-FQQwnq2m.js} +7 -7
- package/dist/{TablePlugin-cMMBdz-x.js.map → TablePlugin-FQQwnq2m.js.map} +1 -1
- package/dist/{client-BIzWgcD3.js → client-BK9NlSVR.js} +13 -13
- package/dist/{client-BIzWgcD3.js.map → client-BK9NlSVR.js.map} +1 -1
- package/dist/components/Accordion/Accordion.js.map +1 -1
- package/dist/components/Accordion/Accordion.test.js +3 -3
- package/dist/components/Accordion/Accordion.test.js.map +1 -1
- package/dist/components/AccordionCard/AccordionCard.js.map +1 -1
- package/dist/components/AccordionCard/AccordionCard.test.js +3 -3
- package/dist/components/AccordionCard/AccordionCard.test.js.map +1 -1
- package/dist/components/ActionList/ActionList.js.map +1 -1
- package/dist/components/ActionList/ActionList.test.js +3 -3
- package/dist/components/ActionList/ActionList.test.js.map +1 -1
- package/dist/components/AppStatusBar/AppStatusBar.test.js +2 -2
- package/dist/components/AppStatusBar/AppStatusBar.test.js.map +1 -1
- package/dist/components/Attention/Attention.test.js +2 -2
- package/dist/components/Attention/Attention.test.js.map +1 -1
- package/dist/components/Backdrop/Backdrop.test.js +2 -2
- package/dist/components/Backdrop/Backdrop.test.js.map +1 -1
- package/dist/components/Buttons/Button.stories.js +1 -1
- package/dist/components/Buttons/Button.test.js +2 -2
- package/dist/components/Buttons/Button.test.js.map +1 -1
- package/dist/components/Buttons/LinkButton.stories.js +1 -1
- package/dist/components/Buttons/LinkButton.test.js +2 -2
- package/dist/components/Buttons/LinkButton.test.js.map +1 -1
- package/dist/components/Buttons/MenuButton.stories.js +1 -1
- package/dist/components/Buttons/MenuButton.test.js +2 -2
- package/dist/components/Buttons/MenuButton.test.js.map +1 -1
- package/dist/components/Card/Card.test.js +2 -2
- package/dist/components/Card/Card.test.js.map +1 -1
- package/dist/components/Checkbox/Checkbox.stories.js +1 -1
- package/dist/components/Checkbox/Checkbox.test.js +3 -3
- package/dist/components/Checkbox/Checkbox.test.js.map +1 -1
- package/dist/components/CheckboxButtonBar/CheckboxButtonBar.js.map +1 -1
- package/dist/components/CheckboxButtonBar/CheckboxButtonBar.stories.js +1 -1
- package/dist/components/CheckboxButtonBar/CheckboxButtonBar.test.js +2 -2
- package/dist/components/CheckboxButtonBar/CheckboxButtonBar.test.js.map +1 -1
- package/dist/components/CheckboxTree/CheckboxTree.js +2 -2
- package/dist/components/CheckboxTree/CheckboxTree.js.map +1 -1
- package/dist/components/CheckboxTree/CheckboxTree.stories.js +2 -2
- package/dist/components/CheckboxTree/CheckboxTree.stories.js.map +1 -1
- package/dist/components/Chip/Chip.stories.js +1 -1
- package/dist/components/ControlsButton/ControlsButton.stories.js +1 -1
- package/dist/components/Drawer/Drawer.js.map +1 -1
- package/dist/components/Drawer/Drawer.stories.js +1 -1
- package/dist/components/FeedbackBar/FeedbackBar.js.map +1 -1
- package/dist/components/FeedbackBar/FeedbackBar.test.js +2 -2
- package/dist/components/FeedbackBar/FeedbackBar.test.js.map +1 -1
- package/dist/components/FormInput/FormInput.js +2 -2
- package/dist/components/FormInput/FormInput.js.map +1 -1
- package/dist/components/FormInput/FormInput.stories.js +1 -1
- package/dist/components/IconButton/IconButton.stories.js +1 -1
- package/dist/components/InputField/InputField.js.map +1 -1
- package/dist/components/InputField/InputField.stories.js +3 -3
- package/dist/components/InputField/InputField.stories.js.map +1 -1
- package/dist/components/Label/Label.test.js +2 -2
- package/dist/components/Label/Label.test.js.map +1 -1
- package/dist/components/MenuLink/MenuLink.js.map +1 -1
- package/dist/components/ModalDialog/ModalDialog.js.map +1 -1
- package/dist/components/ModalDialog/ModalDialog.stories.js +1 -1
- package/dist/components/MultiSelect/MultiSelect.js +1 -1
- package/dist/components/MultiSelect/MultiSelect.stories.js +2 -2
- package/dist/components/MultiSelect/MultiSelect.stories.js.map +1 -1
- package/dist/components/MultiSelect/components/MultiSelectHeader.js +2 -2
- package/dist/components/MultiSelect/index.js +1 -1
- package/dist/components/MultiSelectBox/MultiSelectBox.js.map +1 -1
- package/dist/components/MultiSelectBox/MultiSelectBox.stories.js +1 -1
- package/dist/components/MultiSelectBox/MultiSelectBox.test.js +2 -2
- package/dist/components/MultiSelectBox/MultiSelectBox.test.js.map +1 -1
- package/dist/components/Notification/Notification.js.map +1 -1
- package/dist/components/Notification/Notification.stories.js +1 -1
- package/dist/components/Notification/Notification.test.js +2 -2
- package/dist/components/Notification/Notification.test.js.map +1 -1
- package/dist/components/OverlayCloseButton/OverlayCloseButton.stories.js +1 -1
- package/dist/components/OverlayStepBar/OverlayStepBar.js.map +1 -1
- package/dist/components/OverlayStepBar/OverlayStepBar.stories.js.map +1 -1
- package/dist/components/PageOverlay/PageOverlay.js.map +1 -1
- package/dist/components/PageOverlay/PageOverlay.stories.js.map +1 -1
- package/dist/components/PeriodSelector/PeriodSelector.js +2 -2
- package/dist/components/PeriodSelector/PeriodSelector.js.map +1 -1
- package/dist/components/PeriodSelector/PeriodSelector.stories.js +1 -1
- package/dist/components/Periods/Periods.js.map +1 -1
- package/dist/components/ProgrammeCard/ProgrammeCard.js.map +1 -1
- package/dist/components/ProgrammeCard/ProgrammeCard.stories.js +2 -2
- package/dist/components/RadioGroup/RadioGroup.js.map +1 -1
- package/dist/components/RadioGroup/RadioGroup.stories.js +1 -1
- package/dist/components/RadioGroup/Radiogroup.test.js +2 -2
- package/dist/components/RadioGroup/Radiogroup.test.js.map +1 -1
- package/dist/components/RadioTabSelector/RadioTabSelector.js +2 -2
- package/dist/components/RadioTabSelector/RadioTabSelector.js.map +1 -1
- package/dist/components/RadioTabSelector/RadioTabSelector.stories.js +1 -1
- package/dist/components/RteEditor/EditorHeader/EditorHeader.js +2 -2
- package/dist/components/RteEditor/Plugins/BlockFormatPlugin/BlockFormatPlugin.js +2 -2
- package/dist/components/RteEditor/Plugins/BlockFormatPlugin/BlockFormatPlugin.js.map +1 -1
- package/dist/components/RteEditor/Plugins/HistoryPlugin/HistoryPlugin.js +4 -4
- package/dist/components/RteEditor/Plugins/HistoryPlugin/HistoryPlugin.js.map +1 -1
- package/dist/components/RteEditor/Plugins/LinkPlugin/AddLinkForm/AddLinkFrom.js +3 -3
- package/dist/components/RteEditor/Plugins/LinkPlugin/LinkContextMenu/LinkContextMenu.js +1 -1
- package/dist/components/RteEditor/Plugins/LinkPlugin/LinkContextMenu/LinkContextMenu.js.map +1 -1
- package/dist/components/RteEditor/Plugins/LinkPlugin/LinkPlugin.js +6 -6
- package/dist/components/RteEditor/Plugins/LinkPlugin/LinkPlugin.js.map +1 -1
- package/dist/components/RteEditor/Plugins/LinkPlugin/helpers.js +1 -1
- package/dist/components/RteEditor/Plugins/ListPlugin/ListPlugin.js +4 -4
- package/dist/components/RteEditor/Plugins/ListPlugin/ListPlugin.js.map +1 -1
- package/dist/components/RteEditor/Plugins/PasteHandlerPlugin/PasteHandlerPlugin.js +5 -5
- package/dist/components/RteEditor/Plugins/PasteHandlerPlugin/PasteHandlerPlugin.js.map +1 -1
- package/dist/components/RteEditor/Plugins/TableCellResizerPlugin/TableCellResizerPlugin.js +7 -6
- package/dist/components/RteEditor/Plugins/TableCellResizerPlugin/TableCellResizerPlugin.js.map +1 -1
- package/dist/components/RteEditor/Plugins/TableCellResizerPlugin/index.js +1 -1
- package/dist/components/RteEditor/Plugins/TablePlugin/AddTableFrom.js +2 -2
- package/dist/components/RteEditor/Plugins/TablePlugin/TableCellContextMenu/TableCellContextMenu.js +1 -1
- package/dist/components/RteEditor/Plugins/TablePlugin/TableCellContextMenu/TableCellContextMenu.js.map +1 -1
- package/dist/components/RteEditor/Plugins/TablePlugin/TablePlugin.js +6 -6
- package/dist/components/RteEditor/Plugins/TablePlugin/helpers.d.ts +2 -1
- package/dist/components/RteEditor/Plugins/TablePlugin/helpers.js +39 -29
- package/dist/components/RteEditor/Plugins/TablePlugin/helpers.js.map +1 -1
- package/dist/components/RteEditor/Plugins/TablePlugin/index.js +1 -1
- package/dist/components/RteEditor/Plugins/ToolbarPlugin/ToolbarPlugin.js +5 -5
- package/dist/components/RteEditor/Plugins/ToolbarPlugin/ToolbarPlugin.js.map +1 -1
- package/dist/components/RteEditor/Plugins/index.js +2 -2
- package/dist/components/RteEditor/Providers/LanguageProvider.js.map +1 -1
- package/dist/components/RteEditor/RteEditor.js +149 -149
- package/dist/components/RteEditor/RteEditor.js.map +1 -1
- package/dist/components/RteEditor/helpers.js +32 -34
- package/dist/components/RteEditor/helpers.js.map +1 -1
- package/dist/components/RteEditor/hooks/useFlyout.js.map +1 -1
- package/dist/components/RteEditor/nodes/TableWrapperNode/TableWrapperNode.js +4 -4
- package/dist/components/RteEditor/nodes/TableWrapperNode/TableWrapperNode.js.map +1 -1
- package/dist/components/SelectListbox/SelectListBox.stories.js +1 -1
- package/dist/components/SelectListbox/SelectProvider.js.map +1 -1
- package/dist/components/SelectListbox/components/SelectButton.js.map +1 -1
- package/dist/components/SelectListbox/components/SelectContainer.js.map +1 -1
- package/dist/components/SelectListbox/components/SelectOption.js.map +1 -1
- package/dist/components/Sortable/Sortable.stories.js +1 -1
- package/dist/components/Sortable/components/SortableItem.js.map +1 -1
- package/dist/components/Sortable/sortableReducer.js.map +1 -1
- package/dist/components/Spinner/Spinner.js.map +1 -1
- package/dist/components/StatusBadge/StatusBadge.test.js +2 -2
- package/dist/components/StatusBadge/StatusBadge.test.js.map +1 -1
- package/dist/components/TextArea/TextArea.js.map +1 -1
- package/dist/components/TextArea/TextArea.stories.js +1 -1
- package/dist/components/TextArea/TextArea.test.js +3 -3
- package/dist/components/TextArea/TextArea.test.js.map +1 -1
- package/dist/components/ToggleSwitch/ToggleSwitch.stories.js +1 -1
- package/dist/components/Tooltip/Tooltip.js.map +1 -1
- package/dist/components/VarIndicator/VarIndicator.stories.js +1 -1
- package/dist/components/VarIndicator/VarIndicator.test.js +3 -3
- package/dist/components/VarIndicator/VarIndicator.test.js.map +1 -1
- package/dist/components/hooks/useDebounce.js +2 -2
- package/dist/components/hooks/useDebounce.js.map +1 -1
- package/dist/components/hooks/useOnClickOutside.js.map +1 -1
- package/dist/components/hooks/usePositionedFloaters.js.map +1 -1
- package/dist/components/hooks/useResponsive.js.map +1 -1
- package/dist/components/index.js +1 -1
- package/dist/{helpers-BO6Gg9y6.js → helpers-D3SODeVc.js} +19 -19
- package/dist/{helpers-BO6Gg9y6.js.map → helpers-D3SODeVc.js.map} +1 -1
- package/dist/{index-BwBhYsdx.js → index-B32mP_-H.js} +2219 -2342
- package/dist/index-B32mP_-H.js.map +1 -0
- package/dist/{index-B7xrLR5N.js → index-BVrrnUn0.js} +16 -16
- package/dist/{index-B7xrLR5N.js.map → index-BVrrnUn0.js.map} +1 -1
- package/dist/{index-BYGu3RV5.js → index-BamlKH-k.js} +43 -43
- package/dist/{index-BYGu3RV5.js.map → index-BamlKH-k.js.map} +1 -1
- package/dist/{index-BeAF9HWV.js → index-iImjiPdB.js} +16 -16
- package/dist/{index-BeAF9HWV.js.map → index-iImjiPdB.js.map} +1 -1
- package/dist/{index-nrPtQ1dv.js → index-yEhaxKq-.js} +3 -3
- package/dist/{index-nrPtQ1dv.js.map → index-yEhaxKq-.js.map} +1 -1
- package/dist/index.js +1 -1
- package/dist/{react-18-CbXtwYTX.js → react-18-DXfB7ZX7.js} +2 -2
- package/dist/{react-18-CbXtwYTX.js.map → react-18-DXfB7ZX7.js.map} +1 -1
- package/dist/{react.esm-CJKnSGEF.js → react.esm-WLX_DeH0.js} +19 -19
- package/dist/react.esm-WLX_DeH0.js.map +1 -0
- package/dist/setupTests.js +1 -1
- package/dist/setupTests.js.map +1 -1
- package/dist/storyComponents/ClipboardButton/ClipboardButton.js.map +1 -1
- package/dist/storybook__react.d.js +13 -13
- package/dist/storybook__react.d.js.map +1 -1
- package/dist/{test-utils-ea_YDVtd.js → test-utils-BP59mSnn.js} +3 -3
- package/dist/{test-utils-ea_YDVtd.js.map → test-utils-BP59mSnn.js.map} +1 -1
- package/package.json +1 -1
- package/dist/Lexical.prod-C1B_JvcI.js.map +0 -1
- package/dist/TableCellResizerPlugin-Bao8R6Lv.js +0 -241
- package/dist/TableCellResizerPlugin-Bao8R6Lv.js.map +0 -1
- package/dist/index-BwBhYsdx.js.map +0 -1
- package/dist/react.esm-CJKnSGEF.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ah as p, x as s, o as u, ai as x, aa as L, P as S, F as b, _ as P, a7 as A, ac as g, B as m, ad as C, ab as _, O as B, aj as E, ak as M, al as d, am as R, an as j } from "./Lexical.prod-
|
|
1
|
+
import { ah as p, x as s, o as u, ai as x, aa as L, P as S, F as b, _ as P, a7 as A, ac as g, B as m, ad as C, ab as _, O as B, aj as E, ak as M, al as d, am as R, an as j } from "./Lexical.prod-qYl_ifJ6.js";
|
|
2
2
|
function h(e, ...n) {
|
|
3
3
|
const t = new URL("https://lexical.dev/docs/error"), r = new URLSearchParams();
|
|
4
4
|
r.append("code", e);
|
|
@@ -36,7 +36,7 @@ function H(e, n) {
|
|
|
36
36
|
return null;
|
|
37
37
|
}
|
|
38
38
|
function J(e) {
|
|
39
|
-
const n = O(e, (t) => s(t) && !t.isInline());
|
|
39
|
+
const n = O(e, ((t) => s(t) && !t.isInline()));
|
|
40
40
|
return s(n) || h(4, e.__key), n;
|
|
41
41
|
}
|
|
42
42
|
const O = (e, n) => {
|
|
@@ -75,7 +75,7 @@ function V(e, n) {
|
|
|
75
75
|
let l = !(F || !k) && void 0;
|
|
76
76
|
function X(e) {
|
|
77
77
|
let n = 1;
|
|
78
|
-
if (function() {
|
|
78
|
+
if ((function() {
|
|
79
79
|
if (l === void 0) {
|
|
80
80
|
const t = document.createElement("div");
|
|
81
81
|
t.style.cssText = "position: absolute; opacity: 0; width: 100px; left: -1000px;", document.body.appendChild(t);
|
|
@@ -83,7 +83,7 @@ function X(e) {
|
|
|
83
83
|
t.style.setProperty("zoom", "2"), l = t.getBoundingClientRect().width === r.width, document.body.removeChild(t);
|
|
84
84
|
}
|
|
85
85
|
return l;
|
|
86
|
-
}()) for (; e; ) n *= Number(window.getComputedStyle(e).getPropertyValue("zoom")), e = e.parentElement;
|
|
86
|
+
})()) for (; e; ) n *= Number(window.getComputedStyle(e).getPropertyValue("zoom")), e = e.parentElement;
|
|
87
87
|
return n;
|
|
88
88
|
}
|
|
89
89
|
function G(e, n) {
|
|
@@ -120,4 +120,4 @@ export {
|
|
|
120
120
|
O as w,
|
|
121
121
|
J as y
|
|
122
122
|
};
|
|
123
|
-
//# sourceMappingURL=LexicalUtils.prod-
|
|
123
|
+
//# sourceMappingURL=LexicalUtils.prod-C3To3vrm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LexicalUtils.prod-w0fZ_Z8S.js","sources":["../node_modules/@lexical/utils/LexicalUtils.prod.mjs"],"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\nimport{isHTMLElement as t,$getSelection as e,$isRangeSelection as n,$isElementNode as o,getDOMTextNode as r,$getRoot as i,$getChildCaret as l,$getSiblingCaret as u,$getAdjacentChildCaret as s,$getChildCaretOrSelf as c,makeStepwiseIterator as f,$isChildCaret as a,$cloneWithProperties as d,$setSelection as g,$getPreviousSelection as p,$caretFromPoint as m,$createParagraphNode as h,$normalizeCaret as v,$setSelectionFromCaretRange as y,$getCollapsedCaretRange as w,$getCaretInDirection as x,$splitAtPointCaretNext as E,$isTextPointCaret as S,$isSiblingCaret as A,$rewindSiblingCaret as C,$getState as L,$setState as P}from\"lexical\";export{$splitNode,isBlockDomNode,isHTMLAnchorElement,isHTMLElement,isInlineDomNode}from\"lexical\";import{createRectsFromDOMRange as b}from\"@lexical/selection\";function N(t,...e){const n=new URL(\"https://lexical.dev/docs/error\"),o=new URLSearchParams;o.append(\"code\",t);for(const t of e)o.append(\"v\",t);throw n.search=o.toString(),Error(`Minified Lexical error #${t}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}const M=\"undefined\"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement,R=M&&\"documentMode\"in document?document.documentMode:null,T=M&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),B=M&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),_=!(!M||!(\"InputEvent\"in window)||R)&&\"getTargetRanges\"in new window.InputEvent(\"input\"),k=M&&/Version\\/[\\d.]+.*Safari/.test(navigator.userAgent),K=M&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,H=M&&/Android/.test(navigator.userAgent),O=M&&/^(?=.*Chrome).*/i.test(navigator.userAgent),$=M&&H&&O,D=M&&/AppleWebKit\\/[\\d.]+/.test(navigator.userAgent)&&!O;function I(...t){const e=[];for(const n of t)if(n&&\"string\"==typeof n)for(const[t]of n.matchAll(/\\S+/g))e.push(t);return e}function j(...t){return()=>{for(let e=t.length-1;e>=0;e--)t[e]();t.length=0}}function F(t){return`${t}px`}const U={attributes:!0,characterData:!0,childList:!0,subtree:!0};function z(e,n,o){let r=null,i=null,l=null,u=[];const s=document.createElement(\"div\");function c(){null===r&&N(182),null===i&&N(183);const{left:t,top:l}=i.getBoundingClientRect(),c=b(e,n);var f,a;s.isConnected||(a=s,(f=i).insertBefore(a,f.firstChild));let d=!1;for(let e=0;e<c.length;e++){const n=c[e],o=u[e]||document.createElement(\"div\"),r=o.style;\"absolute\"!==r.position&&(r.position=\"absolute\",d=!0);const i=F(n.left-t);r.left!==i&&(r.left=i,d=!0);const f=F(n.top-l);r.top!==f&&(o.style.top=f,d=!0);const a=F(n.width);r.width!==a&&(o.style.width=a,d=!0);const g=F(n.height);r.height!==g&&(o.style.height=g,d=!0),o.parentNode!==s&&(s.append(o),d=!0),u[e]=o}for(;u.length>c.length;)u.pop();d&&o(u)}function f(){i=null,r=null,null!==l&&l.disconnect(),l=null,s.remove();for(const t of u)t.remove();u=[]}s.style.position=\"relative\";const a=e.registerRootListener((function n(){const o=e.getRootElement();if(null===o)return f();const u=o.parentElement;if(!t(u))return f();f(),r=o,i=u,l=new MutationObserver((t=>{const o=e.getRootElement(),l=o&&o.parentElement;if(o!==r||l!==i)return n();for(const e of t)if(!s.contains(e.target))return c()})),l.observe(u,U),c()}));return()=>{a(),f()}}function V(t,e,n){if(\"text\"!==t.type&&o(e)){const o=e.getDOMSlot(n);return[o.element,o.getFirstChildOffset()+t.offset]}return[r(n)||n,t.offset]}function W(t,o){let r=null,i=null,l=null,u=null,s=null,c=null,f=()=>{};function a(a){a.read((()=>{const a=e();if(!n(a))return r=null,l=null,u=null,c=null,f(),void(f=()=>{});const[d,g]=function(t){const e=t.getStartEndPoints();return t.isBackward()?[e[1],e[0]]:e}(a),p=d.getNode(),m=p.getKey(),h=d.offset,v=g.getNode(),y=v.getKey(),w=g.offset,x=t.getElementByKey(m),E=t.getElementByKey(y),S=null===r||x!==i||h!==l||m!==r.getKey(),A=null===u||E!==s||w!==c||y!==u.getKey();if((S||A)&&null!==x&&null!==E){const e=function(t,e,n,o,r,i,l){const u=(t._window?t._window.document:document).createRange();return u.setStart(...V(e,n,o)),u.setEnd(...V(r,i,l)),u}(t,d,p,x,g,v,E);f(),f=z(t,e,(t=>{if(void 0===o)for(const e of t){const t=e.style;\"Highlight\"!==t.background&&(t.background=\"Highlight\"),\"HighlightText\"!==t.color&&(t.color=\"HighlightText\"),t.marginTop!==F(-1.5)&&(t.marginTop=F(-1.5)),t.paddingTop!==F(4)&&(t.paddingTop=F(4)),t.paddingBottom!==F(0)&&(t.paddingBottom=F(0))}else o(t)}))}r=p,i=x,l=h,u=v,s=E,c=w}))}return a(t.getEditorState()),j(t.registerUpdateListener((({editorState:t})=>a(t))),(()=>{f()}))}function G(t){let e=null;const n=()=>{const n=getSelection(),o=n&&n.anchorNode,r=t.getRootElement();null!==o&&null!==r&&r.contains(o)?null!==e&&(e(),e=null):null===e&&(e=W(t))};return document.addEventListener(\"selectionchange\",n),()=>{null!==e&&e(),document.removeEventListener(\"selectionchange\",n)}}const q=_,J=M,Q=H,X=$,Y=T,Z=D,tt=O,et=B,nt=K,ot=k;function rt(t,...e){const n=I(...e);n.length>0&&t.classList.add(...n)}function it(t,...e){const n=I(...e);n.length>0&&t.classList.remove(...n)}function lt(t,e){for(const n of e)if(t.type.startsWith(n))return!0;return!1}function ut(t,e){const n=t[Symbol.iterator]();return new Promise(((t,o)=>{const r=[],i=()=>{const{done:l,value:u}=n.next();if(l)return t(r);const s=new FileReader;s.addEventListener(\"error\",o),s.addEventListener(\"load\",(()=>{const t=s.result;\"string\"==typeof t&&r.push({file:u,result:t}),i()})),lt(u,e)?s.readAsDataURL(u):i()};i()}))}function st(t,e){return Array.from(at(t,e))}function ct(t){return t?t.getAdjacentCaret():null}function ft(t,e){return Array.from(ht(t,e))}function at(t,e){return dt(\"next\",t,e)}function dt(t,e,n){const r=i(),d=e||r,g=o(d)?l(d,t):u(d,t),p=pt(d),m=n?s(c(u(n,t))):function(t,e){const n=$t(u(t,e));return n&&n[0]}(d,t);let h=p;return f({hasNext:t=>null!==t,initial:g,map:t=>({depth:h,node:t.origin}),step:t=>{if(t.isSameNodeCaret(m))return null;a(t)&&h++;const e=$t(t);return!e||e[0].isSameNodeCaret(m)?null:(h+=e[1],e[0])}})}function gt(t){const e=$t(u(t,\"next\"));return e&&[e[0].origin,e[1]]}function pt(t){let e=-1;for(let n=t;null!==n;n=n.getParent())e++;return e}function mt(t){const e=$t(c(u(t,\"previous\")),\"root\");return e&&e[0].origin}function ht(t,e){return dt(\"previous\",t,e)}function vt(t,e){let n=t;for(;null!=n;){if(n instanceof e)return n;n=n.getParent()}return null}function yt(t){const e=wt(t,(t=>o(t)&&!t.isInline()));return o(e)||N(4,t.__key),e}const wt=(t,e)=>{let n=t;for(;n!==i()&&null!=n;){if(e(n))return n;n=n.getParent()}return null};function xt(t,e,n,o){const r=t=>t instanceof e;return t.registerNodeTransform(e,(t=>{const e=(t=>{const e=t.getChildren();for(let t=0;t<e.length;t++){const n=e[t];if(r(n))return null}let n=t,o=t;for(;null!==n;)if(o=n,n=n.getParent(),r(n))return{child:o,parent:n};return null})(t);if(null!==e){const{child:r,parent:i}=e;if(r.is(t)){o(i,t);const e=r.getNextSiblings(),l=e.length;if(i.insertAfter(r),0!==l){const t=n(i);r.insertAfter(t);for(let n=0;n<l;n++)t.append(e[n])}i.canBeEmpty()||0!==i.getChildrenSize()||i.remove()}}}))}function Et(t,e){const n=new Map,o=t._pendingEditorState;for(const[t,o]of e._nodeMap)n.set(t,d(o));o&&(o._nodeMap=n),t._dirtyType=2;const r=e._selection;g(null===r?null:r.clone())}function St(t){const o=e()||p();let r;if(n(o))r=m(o.focus,\"next\");else{if(null!=o){const t=o.getNodes(),e=t[t.length-1];e&&(r=u(e,\"next\"))}r=r||l(i(),\"previous\").getFlipped().insert(h())}const c=At(t,r),f=s(c),d=a(f)?v(f):c;return y(w(d)),t.getLatest()}function At(t,e,n){let o=x(e,\"next\");for(let t=o;t;t=E(t,n))o=t;return S(o)&&N(283),o.insert(t.isInline()?h().append(t):t),x(u(t.getLatest(),\"next\"),e.direction)}function Ct(t,e){const n=e();return t.replace(n),n.append(t),n}function Lt(t,e){return null!==t&&Object.getPrototypeOf(t).constructor.name===e.name}function Pt(t,e){const n=[];for(let o=0;o<t.length;o++){const r=e(t[o]);null!==r&&n.push(r)}return n}function bt(t,e){l(t,\"next\").insert(e)}let Nt=!(et||!J)&&void 0;function Mt(t){let e=1;if(function(){if(void 0===Nt){const t=document.createElement(\"div\");t.style.cssText=\"position: absolute; opacity: 0; width: 100px; left: -1000px;\",document.body.appendChild(t);const e=t.getBoundingClientRect();t.style.setProperty(\"zoom\",\"2\"),Nt=t.getBoundingClientRect().width===e.width,document.body.removeChild(t)}return Nt}())for(;t;)e*=Number(window.getComputedStyle(t).getPropertyValue(\"zoom\")),t=t.parentElement;return e}function Rt(t){return null!==t._parentEditor}function Tt(t,e){return Bt(t,e,null)}function Bt(t,e,n){let r=!1;for(const i of Kt(t))e(i)?null!==n&&n(i):(r=!0,o(i)&&Bt(i,e,n||(t=>i.insertAfter(t))),i.remove());return r}function _t(t,e){const n=[],r=Array.from(t).reverse();for(let t=r.pop();void 0!==t;t=r.pop())if(e(t))n.push(t);else if(o(t))for(const e of Kt(t))r.push(e);return n}function kt(t){return Ht(l(t,\"next\"))}function Kt(t){return Ht(l(t,\"previous\"))}function Ht(t){return f({hasNext:A,initial:t.getAdjacentCaret(),map:t=>t.origin.getLatest(),step:t=>t.getAdjacentCaret()})}function Ot(t){C(u(t,\"next\")).splice(1,t.getChildren())}function $t(t,e=\"root\"){let n=0,o=t,r=s(o);for(;null===r;){if(n--,r=o.getParentCaret(e),!r)return null;o=r,r=s(o)}return r&&[r,n]}function Dt(t){const e=e=>L(e,t),n=(e,n)=>P(e,t,n);return{$get:e,$set:n,accessors:[e,n],makeGetterMethod:()=>function(){return e(this)},makeSetterMethod:()=>function(t){return n(this,t)},stateConfig:t}}export{_t as $descendantsMatching,st as $dfs,at as $dfsIterator,Pt as $filter,wt as $findMatchingParent,kt as $firstToLastIterator,ct as $getAdjacentCaret,$t as $getAdjacentSiblingOrParentSiblingCaret,pt as $getDepth,yt as $getNearestBlockElementAncestorOrThrow,vt as $getNearestNodeOfType,mt as $getNextRightPreorderNode,gt as $getNextSiblingOrParentSibling,bt as $insertFirst,St as $insertNodeToNearestRoot,At as $insertNodeToNearestRootAtCaret,Rt as $isEditorIsNestedEditor,Kt as $lastToFirstIterator,Et as $restoreEditorState,ft as $reverseDfs,ht as $reverseDfsIterator,Tt as $unwrapAndFilterDescendants,Ot as $unwrapNode,Ct as $wrapNodeInElement,q as CAN_USE_BEFORE_INPUT,J as CAN_USE_DOM,Q as IS_ANDROID,X as IS_ANDROID_CHROME,Y as IS_APPLE,Z as IS_APPLE_WEBKIT,tt as IS_CHROME,et as IS_FIREFOX,nt as IS_IOS,ot as IS_SAFARI,rt as addClassNamesToElement,Mt as calculateZoomLevel,lt as isMimeType,Dt as makeStateWrapper,W as markSelection,ut as mediaFileReader,j as mergeRegister,Lt as objectKlassEquals,z as positionNodeOnRange,xt as registerNestedElementResolver,it as removeClassNamesFromElement,G as selectionAlwaysOnDisplay};\n"],"names":["N","t","e","n","o","M","R","B","I","j","J","et","rt","it","vt","yt","wt","i","St","p","r","m","u","l","h","c","At","f","s","d","a","v","y","w","x","E","S","Lt","bt","Nt","Mt","Tt","Bt","Kt","_t","Ht","A"],"mappings":";AAQsxB,SAASA,EAAEC,MAAKC,GAAE;AAAC,QAAMC,IAAE,IAAI,IAAI,gCAAgC,GAAEC,IAAE,IAAI;AAAgB,EAAAA,EAAE,OAAO,QAAOH,CAAC;AAAE,aAAUA,KAAKC,EAAE,CAAAE,EAAE,OAAO,KAAIH,CAAC;AAAE,QAAME,EAAE,SAAOC,EAAE,SAAQ,GAAG,MAAM,2BAA2BH,CAAC,WAAWE,EAAE,SAAQ,CAAE,gHAAgH;AAAC;AAAM,MAACE,IAAe,OAAO,SAApB,OAAqC,OAAO,aAAhB,UAAmC,OAAO,SAAS,kBAAzB,QAAuCC,IAAED,KAAG,kBAAiB,WAAS,SAAS,eAAa,MAA0DE,IAAEF,KAAG,mCAAmC,KAAK,UAAU,SAAS;AAAI,EAAE,CAACA,KAAG,EAAE,gBAAe,WAASC,MAAI,qBAAoB,IAAI,OAAO,WAAW,OAAO;AAA6R,SAASE,KAAKP,GAAE;AAAC,QAAMC,IAAE,CAAA;AAAG,aAAUC,KAAKF,EAAE,KAAGE,KAAa,OAAOA,KAAjB,SAAmB,YAAS,CAACF,CAAC,KAAIE,EAAE,SAAS,MAAM,EAAE,CAAAD,EAAE,KAAKD,CAAC;AAAE,SAAOC;AAAC;AAAC,SAASO,KAAKR,GAAE;AAAC,SAAM,MAAI;AAAC,aAAQC,IAAED,EAAE,SAAO,GAAEC,KAAG,GAAEA,IAAI,CAAAD,EAAEC,CAAC,EAAC;AAAG,IAAAD,EAAE,SAAO;AAAA,EAAC;AAAC;AAAoxF,MAAKS,IAAEL,GAAuBM,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m.js","sources":["../node_modules/@lexical/utils/LexicalUtils.prod.mjs"],"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\nimport{isHTMLElement as t,$getSelection as e,$isRangeSelection as n,$isElementNode as o,getDOMTextNode as r,$getRoot as i,$getChildCaret as l,$getSiblingCaret as u,$getAdjacentChildCaret as s,$getChildCaretOrSelf as c,makeStepwiseIterator as f,$isChildCaret as a,$cloneWithProperties as d,$setSelection as g,$getPreviousSelection as p,$caretFromPoint as m,$createParagraphNode as h,$normalizeCaret as v,$setSelectionFromCaretRange as y,$getCollapsedCaretRange as w,$getCaretInDirection as x,$splitAtPointCaretNext as E,$isTextPointCaret as S,$isSiblingCaret as A,$rewindSiblingCaret as C,$getState as L,$setState as P}from\"lexical\";export{$splitNode,isBlockDomNode,isHTMLAnchorElement,isHTMLElement,isInlineDomNode}from\"lexical\";import{createRectsFromDOMRange as b}from\"@lexical/selection\";function N(t,...e){const n=new URL(\"https://lexical.dev/docs/error\"),o=new URLSearchParams;o.append(\"code\",t);for(const t of e)o.append(\"v\",t);throw n.search=o.toString(),Error(`Minified Lexical error #${t}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}const M=\"undefined\"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement,R=M&&\"documentMode\"in document?document.documentMode:null,T=M&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),B=M&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),_=!(!M||!(\"InputEvent\"in window)||R)&&\"getTargetRanges\"in new window.InputEvent(\"input\"),k=M&&/Version\\/[\\d.]+.*Safari/.test(navigator.userAgent),K=M&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,H=M&&/Android/.test(navigator.userAgent),O=M&&/^(?=.*Chrome).*/i.test(navigator.userAgent),$=M&&H&&O,D=M&&/AppleWebKit\\/[\\d.]+/.test(navigator.userAgent)&&!O;function I(...t){const e=[];for(const n of t)if(n&&\"string\"==typeof n)for(const[t]of n.matchAll(/\\S+/g))e.push(t);return e}function j(...t){return()=>{for(let e=t.length-1;e>=0;e--)t[e]();t.length=0}}function F(t){return`${t}px`}const U={attributes:!0,characterData:!0,childList:!0,subtree:!0};function z(e,n,o){let r=null,i=null,l=null,u=[];const s=document.createElement(\"div\");function c(){null===r&&N(182),null===i&&N(183);const{left:t,top:l}=i.getBoundingClientRect(),c=b(e,n);var f,a;s.isConnected||(a=s,(f=i).insertBefore(a,f.firstChild));let d=!1;for(let e=0;e<c.length;e++){const n=c[e],o=u[e]||document.createElement(\"div\"),r=o.style;\"absolute\"!==r.position&&(r.position=\"absolute\",d=!0);const i=F(n.left-t);r.left!==i&&(r.left=i,d=!0);const f=F(n.top-l);r.top!==f&&(o.style.top=f,d=!0);const a=F(n.width);r.width!==a&&(o.style.width=a,d=!0);const g=F(n.height);r.height!==g&&(o.style.height=g,d=!0),o.parentNode!==s&&(s.append(o),d=!0),u[e]=o}for(;u.length>c.length;)u.pop();d&&o(u)}function f(){i=null,r=null,null!==l&&l.disconnect(),l=null,s.remove();for(const t of u)t.remove();u=[]}s.style.position=\"relative\";const a=e.registerRootListener((function n(){const o=e.getRootElement();if(null===o)return f();const u=o.parentElement;if(!t(u))return f();f(),r=o,i=u,l=new MutationObserver((t=>{const o=e.getRootElement(),l=o&&o.parentElement;if(o!==r||l!==i)return n();for(const e of t)if(!s.contains(e.target))return c()})),l.observe(u,U),c()}));return()=>{a(),f()}}function V(t,e,n){if(\"text\"!==t.type&&o(e)){const o=e.getDOMSlot(n);return[o.element,o.getFirstChildOffset()+t.offset]}return[r(n)||n,t.offset]}function W(t,o){let r=null,i=null,l=null,u=null,s=null,c=null,f=()=>{};function a(a){a.read((()=>{const a=e();if(!n(a))return r=null,l=null,u=null,c=null,f(),void(f=()=>{});const[d,g]=function(t){const e=t.getStartEndPoints();return t.isBackward()?[e[1],e[0]]:e}(a),p=d.getNode(),m=p.getKey(),h=d.offset,v=g.getNode(),y=v.getKey(),w=g.offset,x=t.getElementByKey(m),E=t.getElementByKey(y),S=null===r||x!==i||h!==l||m!==r.getKey(),A=null===u||E!==s||w!==c||y!==u.getKey();if((S||A)&&null!==x&&null!==E){const e=function(t,e,n,o,r,i,l){const u=(t._window?t._window.document:document).createRange();return u.setStart(...V(e,n,o)),u.setEnd(...V(r,i,l)),u}(t,d,p,x,g,v,E);f(),f=z(t,e,(t=>{if(void 0===o)for(const e of t){const t=e.style;\"Highlight\"!==t.background&&(t.background=\"Highlight\"),\"HighlightText\"!==t.color&&(t.color=\"HighlightText\"),t.marginTop!==F(-1.5)&&(t.marginTop=F(-1.5)),t.paddingTop!==F(4)&&(t.paddingTop=F(4)),t.paddingBottom!==F(0)&&(t.paddingBottom=F(0))}else o(t)}))}r=p,i=x,l=h,u=v,s=E,c=w}))}return a(t.getEditorState()),j(t.registerUpdateListener((({editorState:t})=>a(t))),(()=>{f()}))}function G(t){let e=null;const n=()=>{const n=getSelection(),o=n&&n.anchorNode,r=t.getRootElement();null!==o&&null!==r&&r.contains(o)?null!==e&&(e(),e=null):null===e&&(e=W(t))};return document.addEventListener(\"selectionchange\",n),()=>{null!==e&&e(),document.removeEventListener(\"selectionchange\",n)}}const q=_,J=M,Q=H,X=$,Y=T,Z=D,tt=O,et=B,nt=K,ot=k;function rt(t,...e){const n=I(...e);n.length>0&&t.classList.add(...n)}function it(t,...e){const n=I(...e);n.length>0&&t.classList.remove(...n)}function lt(t,e){for(const n of e)if(t.type.startsWith(n))return!0;return!1}function ut(t,e){const n=t[Symbol.iterator]();return new Promise(((t,o)=>{const r=[],i=()=>{const{done:l,value:u}=n.next();if(l)return t(r);const s=new FileReader;s.addEventListener(\"error\",o),s.addEventListener(\"load\",(()=>{const t=s.result;\"string\"==typeof t&&r.push({file:u,result:t}),i()})),lt(u,e)?s.readAsDataURL(u):i()};i()}))}function st(t,e){return Array.from(at(t,e))}function ct(t){return t?t.getAdjacentCaret():null}function ft(t,e){return Array.from(ht(t,e))}function at(t,e){return dt(\"next\",t,e)}function dt(t,e,n){const r=i(),d=e||r,g=o(d)?l(d,t):u(d,t),p=pt(d),m=n?s(c(u(n,t))):function(t,e){const n=$t(u(t,e));return n&&n[0]}(d,t);let h=p;return f({hasNext:t=>null!==t,initial:g,map:t=>({depth:h,node:t.origin}),step:t=>{if(t.isSameNodeCaret(m))return null;a(t)&&h++;const e=$t(t);return!e||e[0].isSameNodeCaret(m)?null:(h+=e[1],e[0])}})}function gt(t){const e=$t(u(t,\"next\"));return e&&[e[0].origin,e[1]]}function pt(t){let e=-1;for(let n=t;null!==n;n=n.getParent())e++;return e}function mt(t){const e=$t(c(u(t,\"previous\")),\"root\");return e&&e[0].origin}function ht(t,e){return dt(\"previous\",t,e)}function vt(t,e){let n=t;for(;null!=n;){if(n instanceof e)return n;n=n.getParent()}return null}function yt(t){const e=wt(t,(t=>o(t)&&!t.isInline()));return o(e)||N(4,t.__key),e}const wt=(t,e)=>{let n=t;for(;n!==i()&&null!=n;){if(e(n))return n;n=n.getParent()}return null};function xt(t,e,n,o){const r=t=>t instanceof e;return t.registerNodeTransform(e,(t=>{const e=(t=>{const e=t.getChildren();for(let t=0;t<e.length;t++){const n=e[t];if(r(n))return null}let n=t,o=t;for(;null!==n;)if(o=n,n=n.getParent(),r(n))return{child:o,parent:n};return null})(t);if(null!==e){const{child:r,parent:i}=e;if(r.is(t)){o(i,t);const e=r.getNextSiblings(),l=e.length;if(i.insertAfter(r),0!==l){const t=n(i);r.insertAfter(t);for(let n=0;n<l;n++)t.append(e[n])}i.canBeEmpty()||0!==i.getChildrenSize()||i.remove()}}}))}function Et(t,e){const n=new Map,o=t._pendingEditorState;for(const[t,o]of e._nodeMap)n.set(t,d(o));o&&(o._nodeMap=n),t._dirtyType=2;const r=e._selection;g(null===r?null:r.clone())}function St(t){const o=e()||p();let r;if(n(o))r=m(o.focus,\"next\");else{if(null!=o){const t=o.getNodes(),e=t[t.length-1];e&&(r=u(e,\"next\"))}r=r||l(i(),\"previous\").getFlipped().insert(h())}const c=At(t,r),f=s(c),d=a(f)?v(f):c;return y(w(d)),t.getLatest()}function At(t,e,n){let o=x(e,\"next\");for(let t=o;t;t=E(t,n))o=t;return S(o)&&N(283),o.insert(t.isInline()?h().append(t):t),x(u(t.getLatest(),\"next\"),e.direction)}function Ct(t,e){const n=e();return t.replace(n),n.append(t),n}function Lt(t,e){return null!==t&&Object.getPrototypeOf(t).constructor.name===e.name}function Pt(t,e){const n=[];for(let o=0;o<t.length;o++){const r=e(t[o]);null!==r&&n.push(r)}return n}function bt(t,e){l(t,\"next\").insert(e)}let Nt=!(et||!J)&&void 0;function Mt(t){let e=1;if(function(){if(void 0===Nt){const t=document.createElement(\"div\");t.style.cssText=\"position: absolute; opacity: 0; width: 100px; left: -1000px;\",document.body.appendChild(t);const e=t.getBoundingClientRect();t.style.setProperty(\"zoom\",\"2\"),Nt=t.getBoundingClientRect().width===e.width,document.body.removeChild(t)}return Nt}())for(;t;)e*=Number(window.getComputedStyle(t).getPropertyValue(\"zoom\")),t=t.parentElement;return e}function Rt(t){return null!==t._parentEditor}function Tt(t,e){return Bt(t,e,null)}function Bt(t,e,n){let r=!1;for(const i of Kt(t))e(i)?null!==n&&n(i):(r=!0,o(i)&&Bt(i,e,n||(t=>i.insertAfter(t))),i.remove());return r}function _t(t,e){const n=[],r=Array.from(t).reverse();for(let t=r.pop();void 0!==t;t=r.pop())if(e(t))n.push(t);else if(o(t))for(const e of Kt(t))r.push(e);return n}function kt(t){return Ht(l(t,\"next\"))}function Kt(t){return Ht(l(t,\"previous\"))}function Ht(t){return f({hasNext:A,initial:t.getAdjacentCaret(),map:t=>t.origin.getLatest(),step:t=>t.getAdjacentCaret()})}function Ot(t){C(u(t,\"next\")).splice(1,t.getChildren())}function $t(t,e=\"root\"){let n=0,o=t,r=s(o);for(;null===r;){if(n--,r=o.getParentCaret(e),!r)return null;o=r,r=s(o)}return r&&[r,n]}function Dt(t){const e=e=>L(e,t),n=(e,n)=>P(e,t,n);return{$get:e,$set:n,accessors:[e,n],makeGetterMethod:()=>function(){return e(this)},makeSetterMethod:()=>function(t){return n(this,t)},stateConfig:t}}export{_t as $descendantsMatching,st as $dfs,at as $dfsIterator,Pt as $filter,wt as $findMatchingParent,kt as $firstToLastIterator,ct as $getAdjacentCaret,$t as $getAdjacentSiblingOrParentSiblingCaret,pt as $getDepth,yt as $getNearestBlockElementAncestorOrThrow,vt as $getNearestNodeOfType,mt as $getNextRightPreorderNode,gt as $getNextSiblingOrParentSibling,bt as $insertFirst,St as $insertNodeToNearestRoot,At as $insertNodeToNearestRootAtCaret,Rt as $isEditorIsNestedEditor,Kt as $lastToFirstIterator,Et as $restoreEditorState,ft as $reverseDfs,ht as $reverseDfsIterator,Tt as $unwrapAndFilterDescendants,Ot as $unwrapNode,Ct as $wrapNodeInElement,q as CAN_USE_BEFORE_INPUT,J as CAN_USE_DOM,Q as IS_ANDROID,X as IS_ANDROID_CHROME,Y as IS_APPLE,Z as IS_APPLE_WEBKIT,tt as IS_CHROME,et as IS_FIREFOX,nt as IS_IOS,ot as IS_SAFARI,rt as addClassNamesToElement,Mt as calculateZoomLevel,lt as isMimeType,Dt as makeStateWrapper,W as markSelection,ut as mediaFileReader,j as mergeRegister,Lt as objectKlassEquals,z as positionNodeOnRange,xt as registerNestedElementResolver,it as removeClassNamesFromElement,G as selectionAlwaysOnDisplay};\n"],"names":["N","t","e","n","o","M","R","B","I","j","J","et","rt","it","vt","yt","wt","i","St","p","r","m","u","l","h","c","At","f","s","d","a","v","y","w","x","E","S","Lt","bt","Nt","Mt","Tt","Bt","Kt","_t","Ht","A"],"mappings":";AAQsxB,SAASA,EAAEC,MAAKC,GAAE;AAAC,QAAMC,IAAE,IAAI,IAAI,gCAAgC,GAAEC,IAAE,IAAI;AAAgB,EAAAA,EAAE,OAAO,QAAOH,CAAC;AAAE,aAAUA,KAAKC,EAAE,CAAAE,EAAE,OAAO,KAAIH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,GAAEC,MAAI,CAAAF,MAAGgB,EAAE,YAAYhB,CAAC,EAAE,GAAEgB,EAAE,OAAM;AAAI,SAAO;AAAC;AAAC,SAAS2B,EAAG3C,GAAEC,GAAE;AAAC,QAAMC,IAAE,CAAA,GAAG,IAAE,MAAM,KAAKF,CAAC,EAAE,QAAO;AAAG,WAAQA,IAAE,EAAE,IAAG,GAAYA,MAAT,QAAWA,IAAE,EAAE,IAAG,EAAG,KAAGC,EAAED,CAAC,EAAE,CAAAE,EAAE,KAAKF,CAAC;AAAA,WAAUG,EAAEH,CAAC,EAAE,YAAUC,KAAKyC,EAAG1C,CAAC,EAAE,GAAE,KAAKC,CAAC;AAAE,SAAOC;AAAC;AAAuC,SAASwC,EAAG1C,GAAE;AAAC,SAAO4C,EAAGtB,EAAEtB,GAAE,UAAU,CAAC;AAAC;AAAC,SAAS4C,EAAG5C,GAAE;AAAC,SAAO0B,EAAE,EAAC,SAAQmB,GAAE,SAAQ7C,EAAE,iBAAgB,GAAG,KAAI,CAAAA,MAAGA,EAAE,OAAO,UAAS,GAAG,MAAK,CAAAA,MAAGA,EAAE,iBAAgB,EAAE,CAAC;AAAC;","x_google_ignoreList":[0]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SortableProvider-l8-7ClBJ.js","sources":["../src/components/Sortable/components/SortableContainer.tsx","../src/components/Sortable/SortableProvider.tsx"],"sourcesContent":["import { cloneElement, useEffect, useRef } from 'react';\nimport { clsx } from 'clsx';\n\nimport type { DragEvent } from 'react';\n\nimport styles from 'components/Sortable/Sortable.module.css';\nimport { useSortable } from 'components/Sortable/SortableProvider';\n\nexport type OnSort = (indices: number[]) => void;\n\ninterface SortableContainerProps {\n scrollable?: boolean;\n hideNumbers?: boolean;\n onSort?: OnSort;\n}\n\nexport function SortableContainer({ scrollable, hideNumbers, onSort }: SortableContainerProps) {\n const { clone, draggingTarget, drop, sortableItems, setDraggingTarget, reset, indices } = useSortable();\n const containerRef = useRef<HTMLUListElement>(null);\n const wrapperRef = useRef<HTMLDivElement>(null);\n const indicesRef = useRef<number[]>(indices);\n\n function getTargetIndex(event: DragEvent<HTMLLIElement>) {\n const sortableContainer = containerRef.current;\n\n if (!sortableContainer?.hasChildNodes()) return;\n\n const listItemNode = event.currentTarget;\n const childNodes = Array.from(sortableContainer.childNodes);\n const targetIndex = childNodes.findIndex((node) => node.isEqualNode(listItemNode));\n\n return targetIndex;\n }\n\n function handleDrop(event: DragEvent<HTMLLIElement>) {\n const targetIndex = getTargetIndex(event);\n\n if (targetIndex === undefined) return;\n\n if (clone && wrapperRef.current) wrapperRef.current.removeChild(clone);\n\n drop(targetIndex);\n }\n\n function handleDragOver(event: DragEvent<HTMLLIElement>) {\n // Prevent default to allow drop\n event.preventDefault();\n event.dataTransfer.dropEffect = 'move';\n\n if (clone) {\n const { clientX, clientY } = event;\n const { x, y, width, height } = event.currentTarget.getBoundingClientRect();\n // eslint-disable-next-line @typescript-eslint/no-magic-numbers\n const grabPosition = height / 2 - (clientY - y);\n\n // lock drag image movement to x-axis and mouse pointer\n clone.setAttribute(\n 'style',\n `\n left: ${clientX - (clientX - x)}px;\n top: ${y - grabPosition}px;\n height: ${height}px;\n width: ${width}px;\n visibility: visible;\n `\n );\n }\n\n const targetIndex = getTargetIndex(event);\n\n if (targetIndex === undefined || targetIndex === draggingTarget) return;\n\n setDraggingTarget(targetIndex);\n }\n\n function handleContainerDragLeave(event: DragEvent<HTMLUListElement>) {\n const { relatedTarget } = event;\n\n const within = relatedTarget !== null && containerRef.current?.contains(relatedTarget as Node);\n\n if (!within) {\n reset();\n\n if (clone) {\n clone.setAttribute('style', 'visibility: hidden;');\n }\n }\n }\n\n useEffect(() => {\n if (!clone || !wrapperRef.current) return;\n\n wrapperRef.current.appendChild(clone);\n\n return function () {\n clone.remove();\n };\n }, [clone]);\n\n useEffect(() => {\n if (!onSort) return;\n\n if (indices.valueOf() !== indicesRef.current.valueOf()) {\n onSort(indices);\n\n indicesRef.current = indices;\n }\n }, [indices, indicesRef, onSort]);\n\n return (\n <div\n className={clsx(styles['sortable__wrapper'], { [styles['sortable__wrapper--scrollable']]: scrollable })}\n ref={wrapperRef}\n >\n <ul\n className={clsx(styles['sortable__container'], {\n [styles['sortable__container--drag-over']]: clone !== undefined,\n })}\n onDragLeave={handleContainerDragLeave}\n ref={containerRef}\n role=\"presentation\"\n >\n {sortableItems.map((child, index) => (\n <li\n className={clsx(styles['sortable__drop-target'], {\n [styles['sortable__drop-target--no-number']]: hideNumbers,\n })}\n draggable={false}\n key={index}\n onDragOver={handleDragOver}\n onDrop={handleDrop}\n role=\"presentation\"\n >\n {cloneElement(child, { index })}\n </li>\n ))}\n </ul>\n </div>\n );\n}\n","import { createContext, useContext, useReducer, useRef } from 'react';\n\nimport type { ReactElement, ReactNode } from 'react';\nimport type { SortableStateType } from './sortableReducer';\nimport type { SortableItem, SortableItemProps } from './components/SortableItem';\n\nimport { sortableReducer, initialState } from './sortableReducer';\nimport { SortableContainer } from './components/SortableContainer';\nimport * as actions from './actions';\n\ntype SortableContextType = {\n clearDraggingSource: () => void;\n clearDraggingTarget: () => void;\n dragEnd: () => void;\n dragStart: (index: number) => void;\n drop: (index: number) => void;\n moveToPosition: (index: number) => void;\n reset: () => void;\n setClone: (node: Element) => void;\n setDraggingSource: (index: number) => void;\n setDraggingTarget: (index: number) => void;\n};\n\nconst SortableContext = createContext<(SortableContextType & SortableStateType) | undefined>(undefined);\n\ntype SortableItems = ReactElement<SortableItemProps, typeof SortableItem>[];\n\ninterface Props<T = unknown> {\n renderItems: SortableItems;\n dataItems: T[];\n scrollable?: boolean;\n hideNumbers?: boolean;\n onSort?: (items: T[]) => void;\n children?: ReactNode;\n}\n\nfunction isReactElementWithIndex(value: string | ReactElement): value is ReactElement<{ index: number }> {\n return typeof value !== 'string';\n}\n\nconst init = (renderItems: SortableItems): SortableStateType => {\n const reactChildren = renderItems.filter(isReactElementWithIndex);\n\n return {\n ...initialState,\n indices: reactChildren.map(({ props }) => props.index),\n maxIndex: reactChildren.length - 1,\n sortableItems: reactChildren,\n };\n};\n\nexport function SortableProvider<T>({ renderItems, dataItems, scrollable, hideNumbers, onSort }: Props<T>) {\n const persistentItems = useRef(dataItems);\n\n const [state, dispatch] = useReducer(sortableReducer, renderItems, init);\n\n function setDraggingSource(index: number) {\n dispatch(actions.setDraggingSource(index));\n }\n\n function setDraggingTarget(index: number) {\n dispatch(actions.setDraggingTarget(index));\n }\n\n function moveToPosition(index: number) {\n dispatch(actions.moveToPosition(index));\n }\n\n function clearDraggingTarget() {\n dispatch(actions.clearDraggingTarget());\n }\n\n function clearDraggingSource() {\n dispatch(actions.clearDraggingSource());\n }\n\n function drop(index: number) {\n dispatch(actions.drop(index));\n }\n\n function dragStart(index: number) {\n dispatch(actions.dragStart(index));\n }\n\n function dragEnd() {\n dispatch(actions.dragEnd());\n }\n\n function reset() {\n dispatch(actions.reset());\n }\n\n function setClone(node: Element) {\n dispatch(actions.setClone(node));\n }\n\n function onHandleSort(sortedIndices: number[]) {\n const sortedData = sortedIndices.map((index) => persistentItems.current[index]);\n onSort && onSort(sortedData);\n }\n\n return (\n <SortableContext.Provider\n value={{\n ...state,\n clearDraggingSource,\n clearDraggingTarget,\n dragEnd,\n dragStart,\n drop,\n moveToPosition,\n reset,\n setClone,\n setDraggingSource,\n setDraggingTarget,\n }}\n >\n <SortableContainer scrollable={scrollable} hideNumbers={hideNumbers} onSort={onHandleSort} />\n </SortableContext.Provider>\n );\n}\n\nexport function useSortable() {\n const context = useContext(SortableContext);\n\n if (context === undefined) {\n throw new Error('useSortable must be used within a SortableProvider');\n }\n\n return context;\n}\n"],"names":["SortableContainer","scrollable","hideNumbers","onSort","clone","draggingTarget","drop","sortableItems","setDraggingTarget","reset","indices","useSortable","containerRef","useRef","wrapperRef","indicesRef","getTargetIndex","event","sortableContainer","listItemNode","node","handleDrop","targetIndex","handleDragOver","clientX","clientY","x","y","width","height","grabPosition","handleContainerDragLeave","relatedTarget","useEffect","jsx","clsx","styles","child","index","cloneElement","SortableContext","createContext","isReactElementWithIndex","value","init","renderItems","reactChildren","initialState","props","SortableProvider","dataItems","persistentItems","state","dispatch","useReducer","sortableReducer","setDraggingSource","actions.setDraggingSource","actions.setDraggingTarget","moveToPosition","actions.moveToPosition","clearDraggingTarget","actions.clearDraggingTarget","clearDraggingSource","actions.clearDraggingSource","actions.drop","dragStart","actions.dragStart","dragEnd","actions.dragEnd","actions.reset","setClone","actions.setClone","onHandleSort","sortedIndices","sortedData","context","useContext"],"mappings":";;;;;;AAgBO,SAASA,EAAkB,EAAE,YAAAC,GAAY,aAAAC,GAAa,QAAAC,KAAkC;AAC7F,QAAM,EAAE,OAAAC,GAAO,gBAAAC,GAAgB,MAAAC,GAAM,eAAAC,GAAe,mBAAAC,GAAmB,OAAAC,GAAO,SAAAC,EAAA,IAAYC,EAAA,GACpFC,IAAeC,EAAyB,IAAI,GAC5CC,IAAaD,EAAuB,IAAI,GACxCE,IAAaF,EAAiBH,CAAO;AAE3C,WAASM,EAAeC,GAAiC;AACvD,UAAMC,IAAoBN,EAAa;AAEvC,QAAI,CAACM,GAAmB,gBAAiB;AAEzC,UAAMC,IAAeF,EAAM;AAI3B,WAHmB,MAAM,KAAKC,EAAkB,UAAU,EAC3B,UAAU,CAACE,MAASA,EAAK,YAAYD,CAAY,CAAC;AAAA,EAE1E;AAGT,WAASE,EAAWJ,GAAiC;AACnD,UAAMK,IAAcN,EAAeC,CAAK;AAExC,IAAIK,MAAgB,WAEhBlB,KAASU,EAAW,WAASA,EAAW,QAAQ,YAAYV,CAAK,GAErEE,EAAKgB,CAAW;AAAA,EAAA;AAGlB,WAASC,EAAeN,GAAiC;AAKvD,QAHAA,EAAM,eAAA,GACNA,EAAM,aAAa,aAAa,QAE5Bb,GAAO;AACT,YAAM,EAAE,SAAAoB,GAAS,SAAAC,EAAA,IAAYR,GACvB,EAAE,GAAAS,GAAG,GAAAC,GAAG,OAAAC,GAAO,QAAAC,MAAWZ,EAAM,cAAc,sBAAA,GAE9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8-7ClBJ.js","sources":["../src/components/Sortable/components/SortableContainer.tsx","../src/components/Sortable/SortableProvider.tsx"],"sourcesContent":["import { cloneElement, useEffect, useRef } from 'react';\nimport { clsx } from 'clsx';\n\nimport type { DragEvent } from 'react';\n\nimport styles from 'components/Sortable/Sortable.module.css';\nimport { useSortable } from 'components/Sortable/SortableProvider';\n\nexport type OnSort = (indices: number[]) => void;\n\ninterface SortableContainerProps {\n scrollable?: boolean;\n hideNumbers?: boolean;\n onSort?: OnSort;\n}\n\nexport function SortableContainer({ scrollable, hideNumbers, onSort }: SortableContainerProps) {\n const { clone, draggingTarget, drop, sortableItems, setDraggingTarget, reset, indices } = useSortable();\n const containerRef = useRef<HTMLUListElement>(null);\n const wrapperRef = useRef<HTMLDivElement>(null);\n const indicesRef = useRef<number[]>(indices);\n\n function getTargetIndex(event: DragEvent<HTMLLIElement>) {\n const sortableContainer = containerRef.current;\n\n if (!sortableContainer?.hasChildNodes()) return;\n\n const listItemNode = event.currentTarget;\n const childNodes = Array.from(sortableContainer.childNodes);\n const targetIndex = childNodes.findIndex((node) => node.isEqualNode(listItemNode));\n\n return targetIndex;\n }\n\n function handleDrop(event: DragEvent<HTMLLIElement>) {\n const targetIndex = getTargetIndex(event);\n\n if (targetIndex === undefined) return;\n\n if (clone && wrapperRef.current) wrapperRef.current.removeChild(clone);\n\n drop(targetIndex);\n }\n\n function handleDragOver(event: DragEvent<HTMLLIElement>) {\n // Prevent default to allow drop\n event.preventDefault();\n event.dataTransfer.dropEffect = 'move';\n\n if (clone) {\n const { clientX, clientY } = event;\n const { x, y, width, height } = event.currentTarget.getBoundingClientRect();\n // eslint-disable-next-line @typescript-eslint/no-magic-numbers\n const grabPosition = height / 2 - (clientY - y);\n\n // lock drag image movement to x-axis and mouse pointer\n clone.setAttribute(\n 'style',\n `\n left: ${clientX - (clientX - x)}px;\n top: ${y - grabPosition}px;\n height: ${height}px;\n width: ${width}px;\n visibility: visible;\n `\n );\n }\n\n const targetIndex = getTargetIndex(event);\n\n if (targetIndex === undefined || targetIndex === draggingTarget) return;\n\n setDraggingTarget(targetIndex);\n }\n\n function handleContainerDragLeave(event: DragEvent<HTMLUListElement>) {\n const { relatedTarget } = event;\n\n const within = relatedTarget !== null && containerRef.current?.contains(relatedTarget as Node);\n\n if (!within) {\n reset();\n\n if (clone) {\n clone.setAttribute('style', 'visibility: hidden;');\n }\n }\n }\n\n useEffect(() => {\n if (!clone || !wrapperRef.current) return;\n\n wrapperRef.current.appendChild(clone);\n\n return function () {\n clone.remove();\n };\n }, [clone]);\n\n useEffect(() => {\n if (!onSort) return;\n\n if (indices.valueOf() !== indicesRef.current.valueOf()) {\n onSort(indices);\n\n indicesRef.current = indices;\n }\n }, [indices, indicesRef, onSort]);\n\n return (\n <div\n className={clsx(styles['sortable__wrapper'], { [styles['sortable__wrapper--scrollable']]: scrollable })}\n ref={wrapperRef}\n >\n <ul\n className={clsx(styles['sortable__container'], {\n [styles['sortable__container--drag-over']]: clone !== undefined,\n })}\n onDragLeave={handleContainerDragLeave}\n ref={containerRef}\n role=\"presentation\"\n >\n {sortableItems.map((child, index) => (\n <li\n className={clsx(styles['sortable__drop-target'], {\n [styles['sortable__drop-target--no-number']]: hideNumbers,\n })}\n draggable={false}\n key={index}\n onDragOver={handleDragOver}\n onDrop={handleDrop}\n role=\"presentation\"\n >\n {cloneElement(child, { index })}\n </li>\n ))}\n </ul>\n </div>\n );\n}\n","import { createContext, useContext, useReducer, useRef } from 'react';\n\nimport type { ReactElement, ReactNode } from 'react';\nimport type { SortableStateType } from './sortableReducer';\nimport type { SortableItem, SortableItemProps } from './components/SortableItem';\n\nimport { sortableReducer, initialState } from './sortableReducer';\nimport { SortableContainer } from './components/SortableContainer';\nimport * as actions from './actions';\n\ntype SortableContextType = {\n clearDraggingSource: () => void;\n clearDraggingTarget: () => void;\n dragEnd: () => void;\n dragStart: (index: number) => void;\n drop: (index: number) => void;\n moveToPosition: (index: number) => void;\n reset: () => void;\n setClone: (node: Element) => void;\n setDraggingSource: (index: number) => void;\n setDraggingTarget: (index: number) => void;\n};\n\nconst SortableContext = createContext<(SortableContextType & SortableStateType) | undefined>(undefined);\n\ntype SortableItems = ReactElement<SortableItemProps, typeof SortableItem>[];\n\ninterface Props<T = unknown> {\n renderItems: SortableItems;\n dataItems: T[];\n scrollable?: boolean;\n hideNumbers?: boolean;\n onSort?: (items: T[]) => void;\n children?: ReactNode;\n}\n\nfunction isReactElementWithIndex(value: string | ReactElement): value is ReactElement<{ index: number }> {\n return typeof value !== 'string';\n}\n\nconst init = (renderItems: SortableItems): SortableStateType => {\n const reactChildren = renderItems.filter(isReactElementWithIndex);\n\n return {\n ...initialState,\n indices: reactChildren.map(({ props }) => props.index),\n maxIndex: reactChildren.length - 1,\n sortableItems: reactChildren,\n };\n};\n\nexport function SortableProvider<T>({ renderItems, dataItems, scrollable, hideNumbers, onSort }: Props<T>) {\n const persistentItems = useRef(dataItems);\n\n const [state, dispatch] = useReducer(sortableReducer, renderItems, init);\n\n function setDraggingSource(index: number) {\n dispatch(actions.setDraggingSource(index));\n }\n\n function setDraggingTarget(index: number) {\n dispatch(actions.setDraggingTarget(index));\n }\n\n function moveToPosition(index: number) {\n dispatch(actions.moveToPosition(index));\n }\n\n function clearDraggingTarget() {\n dispatch(actions.clearDraggingTarget());\n }\n\n function clearDraggingSource() {\n dispatch(actions.clearDraggingSource());\n }\n\n function drop(index: number) {\n dispatch(actions.drop(index));\n }\n\n function dragStart(index: number) {\n dispatch(actions.dragStart(index));\n }\n\n function dragEnd() {\n dispatch(actions.dragEnd());\n }\n\n function reset() {\n dispatch(actions.reset());\n }\n\n function setClone(node: Element) {\n dispatch(actions.setClone(node));\n }\n\n function onHandleSort(sortedIndices: number[]) {\n const sortedData = sortedIndices.map((index) => persistentItems.current[index]);\n onSort && onSort(sortedData);\n }\n\n return (\n <SortableContext.Provider\n value={{\n ...state,\n clearDraggingSource,\n clearDraggingTarget,\n dragEnd,\n dragStart,\n drop,\n moveToPosition,\n reset,\n setClone,\n setDraggingSource,\n setDraggingTarget,\n }}\n >\n <SortableContainer scrollable={scrollable} hideNumbers={hideNumbers} onSort={onHandleSort} />\n </SortableContext.Provider>\n );\n}\n\nexport function useSortable() {\n const context = useContext(SortableContext);\n\n if (context === undefined) {\n throw new Error('useSortable must be used within a SortableProvider');\n }\n\n return context;\n}\n"],"names":["SortableContainer","scrollable","hideNumbers","onSort","clone","draggingTarget","drop","sortableItems","setDraggingTarget","reset","indices","useSortable","containerRef","useRef","wrapperRef","indicesRef","getTargetIndex","event","sortableContainer","listItemNode","node","handleDrop","targetIndex","handleDragOver","clientX","clientY","x","y","width","height","grabPosition","handleContainerDragLeave","relatedTarget","useEffect","jsx","clsx","styles","child","index","cloneElement","SortableContext","createContext","isReactElementWithIndex","value","init","renderItems","reactChildren","initialState","props","SortableProvider","dataItems","persistentItems","state","dispatch","useReducer","sortableReducer","setDraggingSource","actions.setDraggingSource","actions.setDraggingTarget","moveToPosition","actions.moveToPosition","clearDraggingTarget","actions.clearDraggingTarget","clearDraggingSource","actions.clearDraggingSource","actions.drop","dragStart","actions.dragStart","dragEnd","actions.dragEnd","actions.reset","setClone","actions.setClone","onHandleSort","sortedIndices","sortedData","context","useContext"],"mappings":";;;;;;AAgBO,SAASA,EAAkB,EAAE,YAAAC,GAAY,aAAAC,GAAa,QAAAC,KAAkC;AAC7F,QAAM,EAAE,OAAAC,GAAO,gBAAAC,GAAgB,MAAAC,GAAM,eAAAC,GAAe,mBAAAC,GAAmB,OAAAC,GAAO,SAAAC,EAAA,IAAYC,EAAA,GACpFC,IAAeC,EAAyB,IAAI,GAC5CC,IAAaD,EAAuB,IAAI,GACxCE,IAAaF,EAAiBH,CAAO;AAE3C,WAASM,EAAeC,GAAiC;AACvD,UAAMC,IAAoBN,EAAa;AAEvC,QAAI,CAACM,GAAmB,gBAAiB;AAEzC,UAAMC,IAAeF,EAAM;AAI3B,WAHmB,MAAM,KAAKC,EAAkB,UAAU,EAC3B,UAAU,CAACE,MAASA,EAA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AF;AAAAA,QAAA,MACA5D;AAAAA,QAAA,gBACAqD;AAAAA,QAAA,OACAlD;AAAAA,QAAA,UACA8D;AAAAA,QAAA,mBACAf;AAAAA,QAAA,mBACAhD;AAAAA,MAAA;AAAA,MAGF,UAAA,gBAAA0B,EAAClC,GAAA,EAAkB,YAAAC,GAAwB,aAAAC,GAA0B,QAAQuE,EAAA,CAAc;AAAA,IAAA;AAAA,EAAA;AAGjG;AAEO,SAAS9D,IAAc;AAC5B,QAAMiE,IAAUC,EAAWrC,CAAe;AAE1C,MAAIoC,MAAY;AACd,UAAM,IAAI,MAAM,oDAAoD;AAGtE,SAAOA;AACT;"}
|
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
import { jsx as T, jsxs as J, Fragment as Q } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo as F, useState as x, useRef as E, useLayoutEffect as Z, useEffect as L, useCallback as b } from "react";
|
|
3
|
+
import { o as A } from "./LexicalComposerContext.prod-DOyoZx0P.js";
|
|
4
|
+
import { b as ee, y as te, R as Y, H, P as ne, E as oe, h as re, M as le, c as se } from "./LexicalTable.prod-COFf1Spn.js";
|
|
5
|
+
import { v as ie, M as K } from "./LexicalUtils.prod-C3To3vrm.js";
|
|
6
|
+
import { T as _, k as ce } from "./Lexical.prod-qYl_ifJ6.js";
|
|
7
|
+
import { createPortal as ue } from "react-dom";
|
|
8
|
+
import { tableHasContent as ae, getEditorParrentCellWidth as de, getEditorContentWidth as fe } from "./components/RteEditor/Plugins/TablePlugin/helpers.js";
|
|
9
|
+
import { TableWrapperNode as he, $createTableWrapperNode as ge } from "./components/RteEditor/nodes/TableWrapperNode/TableWrapperNode.js";
|
|
10
|
+
import './assets/TableCellResizerPlugin.css';const we = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0 ? Z : L;
|
|
11
|
+
function pe(l) {
|
|
12
|
+
return { initialValueFn: () => l.isEditable(), subscribe: (d) => l.registerEditableListener(d) };
|
|
13
|
+
}
|
|
14
|
+
function me() {
|
|
15
|
+
return (function(l) {
|
|
16
|
+
const [d] = A(), p = F((() => l(d)), [d, l]), [m, g] = x((() => p.initialValueFn())), w = E(m);
|
|
17
|
+
return we((() => {
|
|
18
|
+
const { initialValueFn: R, subscribe: c } = p, C = R();
|
|
19
|
+
return w.current !== C && (w.current = C, g(C)), c(((z) => {
|
|
20
|
+
w.current = z, g(z);
|
|
21
|
+
}));
|
|
22
|
+
}), [p, l]), m;
|
|
23
|
+
})(pe);
|
|
24
|
+
}
|
|
25
|
+
const S = {
|
|
26
|
+
"table-cell-resizer__resizer": "_table-cell-resizer__resizer_2hhfo_17"
|
|
27
|
+
}, Ce = 33, W = 32, B = 2;
|
|
28
|
+
function be({ editor: l }) {
|
|
29
|
+
const d = E(null), p = E(null), m = E(null), g = E(null), [w, R] = x(null), [c, C] = x(null), [z, M] = x(!1), [a, D] = x(null), v = b(() => {
|
|
30
|
+
C(null), d.current = null, D(null), g.current = null, m.current = null;
|
|
31
|
+
}, []), U = (e) => (e.buttons & 1) === 1;
|
|
32
|
+
L(() => l.registerNodeTransform(ee, (e) => {
|
|
33
|
+
if (!e.getColWidths()) {
|
|
34
|
+
const t = e.getChildren(), n = e.getColumnCount(), i = new Array(n).fill(void 0);
|
|
35
|
+
t[0].getChildren().forEach((o, u) => {
|
|
36
|
+
const f = l.getElementByKey(o.getKey());
|
|
37
|
+
if (f && f.style.width)
|
|
38
|
+
i[u] = parseInt(f.style.width, 10), f.style.width = "";
|
|
39
|
+
else if (ae(e)) {
|
|
40
|
+
const h = e ? ie(e, te) : null, y = (h ? de(h, n, l) : fe(l)) / n;
|
|
41
|
+
i[u] = Math.max(y, W);
|
|
42
|
+
} else
|
|
43
|
+
i[u] = W;
|
|
44
|
+
}), e.setColWidths(i);
|
|
45
|
+
}
|
|
46
|
+
if (e && !(e.getParent() instanceof he)) {
|
|
47
|
+
const t = ge();
|
|
48
|
+
e.replace(t), t.append(e);
|
|
49
|
+
}
|
|
50
|
+
return e;
|
|
51
|
+
}), [l]), L(() => {
|
|
52
|
+
const e = (s) => {
|
|
53
|
+
const r = s.target;
|
|
54
|
+
if (ce(r)) {
|
|
55
|
+
if (a) {
|
|
56
|
+
R({
|
|
57
|
+
x: s.clientX,
|
|
58
|
+
y: s.clientY
|
|
59
|
+
});
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
if (M(U(s)), !(p.current && p.current.contains(r)) && d.current !== r) {
|
|
63
|
+
d.current = r;
|
|
64
|
+
const o = le(r);
|
|
65
|
+
o && c !== o ? l.getEditorState().read(
|
|
66
|
+
() => {
|
|
67
|
+
const u = _(o.elem);
|
|
68
|
+
if (!u)
|
|
69
|
+
throw new Error("TableCellResizer: Table cell node not found.");
|
|
70
|
+
const f = H(u), h = se(f, l.getElementByKey(f.getKey()));
|
|
71
|
+
if (!h)
|
|
72
|
+
throw new Error("TableCellResizer: Table element not found.");
|
|
73
|
+
d.current = r, m.current = h.getBoundingClientRect(), C(o);
|
|
74
|
+
},
|
|
75
|
+
{ editor: l }
|
|
76
|
+
) : o == null && v();
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}, t = () => {
|
|
80
|
+
M(!0);
|
|
81
|
+
}, n = () => {
|
|
82
|
+
M(!1);
|
|
83
|
+
}, i = l.registerRootListener((s, r) => {
|
|
84
|
+
r?.removeEventListener("mousemove", e), r?.removeEventListener("mousedown", t), r?.removeEventListener("mouseup", n), s?.addEventListener("mousemove", e), s?.addEventListener("mousedown", t), s?.addEventListener("mouseup", n);
|
|
85
|
+
});
|
|
86
|
+
return () => {
|
|
87
|
+
i();
|
|
88
|
+
};
|
|
89
|
+
}, [c, a, l, v]);
|
|
90
|
+
const I = (e) => e === "bottom", O = b(
|
|
91
|
+
(e) => {
|
|
92
|
+
if (!c)
|
|
93
|
+
throw new Error("TableCellResizer: Expected active cell.");
|
|
94
|
+
l.update(
|
|
95
|
+
() => {
|
|
96
|
+
const t = _(c.elem);
|
|
97
|
+
if (!Y(t))
|
|
98
|
+
throw new Error("TableCellResizer: Table cell node not found.");
|
|
99
|
+
const n = H(t), i = ne(t) + t.getRowSpan() - 1, s = n.getChildren();
|
|
100
|
+
if (i >= s.length || i < 0)
|
|
101
|
+
throw new Error("Expected table cell to be inside of table row.");
|
|
102
|
+
const r = s[i];
|
|
103
|
+
if (!oe(r))
|
|
104
|
+
throw new Error("Expected table row");
|
|
105
|
+
let o = r.getHeight();
|
|
106
|
+
if (o === void 0) {
|
|
107
|
+
const f = r.getChildren();
|
|
108
|
+
o = Math.min(...f.map((h) => V(h, l) ?? 1 / 0));
|
|
109
|
+
}
|
|
110
|
+
const u = Math.max(o + e, Ce);
|
|
111
|
+
r.setHeight(u);
|
|
112
|
+
},
|
|
113
|
+
{ tag: "skip-scroll-into-view" }
|
|
114
|
+
);
|
|
115
|
+
},
|
|
116
|
+
[c, l]
|
|
117
|
+
), V = (e, t) => t.getElementByKey(e.getKey())?.clientHeight, j = (e, t) => {
|
|
118
|
+
for (let n = 0; n < t.length; n++)
|
|
119
|
+
for (let i = 0; i < t[n].length; i++)
|
|
120
|
+
if (t[n][i].cell === e)
|
|
121
|
+
return i;
|
|
122
|
+
return -1;
|
|
123
|
+
}, P = b(
|
|
124
|
+
(e) => {
|
|
125
|
+
if (!c)
|
|
126
|
+
throw new Error("TableCellResizer: Expected active cell.");
|
|
127
|
+
l.update(
|
|
128
|
+
() => {
|
|
129
|
+
const t = _(c.elem);
|
|
130
|
+
if (!Y(t))
|
|
131
|
+
throw new Error("TableCellResizer: Table cell node not found.");
|
|
132
|
+
const n = H(t), [i] = re(n, null, null), s = j(t, i);
|
|
133
|
+
if (s === void 0)
|
|
134
|
+
throw new Error("TableCellResizer: Table column not found.");
|
|
135
|
+
const r = n.getColWidths();
|
|
136
|
+
if (!r)
|
|
137
|
+
return;
|
|
138
|
+
const o = r[s];
|
|
139
|
+
if (o === void 0)
|
|
140
|
+
return;
|
|
141
|
+
const u = [...r], f = Math.max(o + e, W);
|
|
142
|
+
if (u[s] = f, n.setColWidths(u), s < n.getColumnCount() - 1) {
|
|
143
|
+
const h = n.getColWidths();
|
|
144
|
+
if (!h)
|
|
145
|
+
return;
|
|
146
|
+
const $ = [...h], y = s + 1, G = h[y], q = Math.max(G - e, W);
|
|
147
|
+
$[y] = q, n.setColWidths($);
|
|
148
|
+
}
|
|
149
|
+
},
|
|
150
|
+
{ tag: "skip-scroll-into-view" }
|
|
151
|
+
);
|
|
152
|
+
},
|
|
153
|
+
[c, l]
|
|
154
|
+
), N = b(
|
|
155
|
+
(e) => {
|
|
156
|
+
const t = (n) => {
|
|
157
|
+
if (n.preventDefault(), n.stopPropagation(), !c)
|
|
158
|
+
throw new Error("TableCellResizer: Expected active cell.");
|
|
159
|
+
if (g.current) {
|
|
160
|
+
const { x: i, y: s } = g.current;
|
|
161
|
+
if (c === null)
|
|
162
|
+
return;
|
|
163
|
+
const r = K(n.target);
|
|
164
|
+
if (I(e)) {
|
|
165
|
+
const o = (n.clientY - s) / r;
|
|
166
|
+
O(o);
|
|
167
|
+
} else {
|
|
168
|
+
const o = (n.clientX - i) / r;
|
|
169
|
+
P(o);
|
|
170
|
+
}
|
|
171
|
+
v(), document.removeEventListener("mouseup", t);
|
|
172
|
+
}
|
|
173
|
+
};
|
|
174
|
+
return t;
|
|
175
|
+
},
|
|
176
|
+
[c, v, P, O]
|
|
177
|
+
), k = b(
|
|
178
|
+
(e) => (t) => {
|
|
179
|
+
if (t.preventDefault(), t.stopPropagation(), !c)
|
|
180
|
+
throw new Error("TableCellResizer: Expected active cell.");
|
|
181
|
+
g.current = {
|
|
182
|
+
x: t.clientX,
|
|
183
|
+
y: t.clientY
|
|
184
|
+
}, R(g.current), D(e), document.addEventListener("mouseup", N(e));
|
|
185
|
+
},
|
|
186
|
+
[c, N]
|
|
187
|
+
), X = b(() => {
|
|
188
|
+
if (c) {
|
|
189
|
+
const { height: e, width: t, top: n, left: i } = c.elem.getBoundingClientRect(), s = K(c.elem), r = 10, o = {
|
|
190
|
+
bottom: {
|
|
191
|
+
backgroundColor: "none",
|
|
192
|
+
cursor: "ns-resize",
|
|
193
|
+
height: `${r}px`,
|
|
194
|
+
left: `${window.pageXOffset + i}px`,
|
|
195
|
+
top: `${window.pageYOffset + n + e - r / B}px`,
|
|
196
|
+
width: `${t}px`,
|
|
197
|
+
zIndex: 5e3
|
|
198
|
+
},
|
|
199
|
+
right: {
|
|
200
|
+
backgroundColor: "none",
|
|
201
|
+
cursor: "ew-resize",
|
|
202
|
+
height: `${e}px`,
|
|
203
|
+
left: `${window.pageXOffset + i + t - r / B}px`,
|
|
204
|
+
top: `${window.pageYOffset + n}px`,
|
|
205
|
+
width: `${r}px`,
|
|
206
|
+
zIndex: 5e3
|
|
207
|
+
}
|
|
208
|
+
}, u = m.current;
|
|
209
|
+
return a && w && u && (I(a) ? (o[a].left = `${window.pageXOffset + u.left}px`, o[a].top = `${window.pageYOffset + w.y / s}px`, o[a].height = "3px", o[a].width = `${u.width}px`) : (o[a].top = `${window.pageYOffset + u.top}px`, o[a].left = `${window.pageXOffset + w.x / s}px`, o[a].width = "3px", o[a].height = `${u.height}px`), o[a].backgroundColor = "#adf"), o;
|
|
210
|
+
}
|
|
211
|
+
return {
|
|
212
|
+
bottom: null,
|
|
213
|
+
left: null,
|
|
214
|
+
right: null,
|
|
215
|
+
top: null
|
|
216
|
+
};
|
|
217
|
+
}, [c, a, w])();
|
|
218
|
+
return /* @__PURE__ */ T("div", { ref: p, children: c != null && !z && /* @__PURE__ */ J(Q, { children: [
|
|
219
|
+
/* @__PURE__ */ T(
|
|
220
|
+
"div",
|
|
221
|
+
{
|
|
222
|
+
className: S["table-cell-resizer__resizer"],
|
|
223
|
+
style: X.right || void 0,
|
|
224
|
+
onMouseDown: k("right")
|
|
225
|
+
}
|
|
226
|
+
),
|
|
227
|
+
/* @__PURE__ */ T(
|
|
228
|
+
"div",
|
|
229
|
+
{
|
|
230
|
+
className: S["table-cell-resizer__resizer"],
|
|
231
|
+
style: X.bottom || void 0,
|
|
232
|
+
onMouseDown: k("bottom")
|
|
233
|
+
}
|
|
234
|
+
)
|
|
235
|
+
] }) });
|
|
236
|
+
}
|
|
237
|
+
const He = () => {
|
|
238
|
+
const [l] = A(), d = me();
|
|
239
|
+
return F(
|
|
240
|
+
() => d ? ue(/* @__PURE__ */ T(be, { editor: l }), document.body) : null,
|
|
241
|
+
[l, d]
|
|
242
|
+
);
|
|
243
|
+
};
|
|
244
|
+
export {
|
|
245
|
+
He as T,
|
|
246
|
+
me as a
|
|
247
|
+
};
|
|
248
|
+
//# sourceMappingURL=TableCellResizerPlugin-B9MT1fxA.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TableCellResizerPlugin-B9MT1fxA.js","sources":["../node_modules/@lexical/react/useLexicalEditable.prod.mjs","../src/components/RteEditor/Plugins/TableCellResizerPlugin/TableCellResizerPlugin.tsx"],"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\nimport{useLexicalComposerContext as e}from\"@lexical/react/LexicalComposerContext\";import{useLayoutEffect as n,useEffect as t,useMemo as i,useState as r,useRef as o}from\"react\";const c=\"undefined\"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement?n:t;function u(e){return{initialValueFn:()=>e.isEditable(),subscribe:n=>e.registerEditableListener(n)}}function a(){return function(n){const[t]=e(),u=i((()=>n(t)),[t,n]),[a,l]=r((()=>u.initialValueFn())),d=o(a);return c((()=>{const{initialValueFn:e,subscribe:n}=u,t=e();return d.current!==t&&(d.current=t,l(t)),n((e=>{d.current=e,l(e)}))}),[u,n]),a}(u)}export{a as useLexicalEditable};\n","/* eslint-disable jsx-a11y/no-static-element-interactions */\r\n/**\r\n * Copyright (c) Meta Platforms, Inc. and affiliates.\r\n *\r\n * This source code is licensed under the MIT license found in the\r\n * LICENSE file in the root directory of this source tree.\r\n *\r\n * Modified from original to fit project needs wim jurriaans.\r\n *\r\n *\r\n */\r\nimport { useCallback, useEffect, useMemo, useRef, useState } from 'react';\r\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';\r\nimport { useLexicalEditable } from '@lexical/react/useLexicalEditable';\r\nimport {\r\n $computeTableMapSkipCellCheck,\r\n $getTableNodeFromLexicalNodeOrThrow,\r\n $getTableRowIndexFromTableCellNode,\r\n $isTableCellNode,\r\n $isTableRowNode,\r\n TableNode,\r\n getDOMCellFromTarget,\r\n getTableElement,\r\n TableCellNode,\r\n} from '@lexical/table';\r\nimport { $getNearestNodeOfType, calculateZoomLevel } from '@lexical/utils';\r\nimport { $getNearestNodeFromDOMNode, isHTMLElement } from 'lexical';\r\nimport { createPortal } from 'react-dom';\r\n\r\nimport type { LexicalEditor } from 'lexical';\r\nimport type { TableDOMCell, TableMapType, TableRowNode } from '@lexical/table';\r\nimport type { JSX, MouseEventHandler, ReactPortal } from 'react';\r\n\r\nimport styles from './TableCellResizerPlugin.module.css';\r\n\r\nimport {\r\n getEditorContentWidth,\r\n getEditorParrentCellWidth,\r\n tableHasContent,\r\n} from 'components/RteEditor/Plugins/TablePlugin/helpers';\r\nimport { $createTableWrapperNode, TableWrapperNode } from 'components/RteEditor/nodes';\r\n\r\ntype MousePosition = {\r\n x: number;\r\n y: number;\r\n};\r\n\r\ntype MouseDraggingDirection = 'right' | 'bottom';\r\n\r\nconst MIN_ROW_HEIGHT = 33;\r\nconst MIN_COLUMN_WIDTH = 32;\r\nconst HALF = 2;\r\n\r\nfunction TableCellResizer({ editor }: { editor: LexicalEditor }): JSX.Element {\r\n const targetRef = useRef<HTMLElement | null>(null);\r\n const resizerRef = useRef<HTMLDivElement | null>(null);\r\n const tableRectRef = useRef<DOMRect | null>(null);\r\n\r\n const mouseStartPosRef = useRef<MousePosition | null>(null);\r\n const [mouseCurrentPos, updateMouseCurrentPos] = useState<MousePosition | null>(null);\r\n\r\n const [activeCell, updateActiveCell] = useState<TableDOMCell | null>(null);\r\n const [isMouseDown, updateIsMouseDown] = useState<boolean>(false);\r\n const [draggingDirection, updateDraggingDirection] = useState<MouseDraggingDirection | null>(null);\r\n\r\n const resetState = useCallback(() => {\r\n updateActiveCell(null);\r\n targetRef.current = null;\r\n updateDraggingDirection(null);\r\n mouseStartPosRef.current = null;\r\n tableRectRef.current = null;\r\n }, []);\r\n\r\n const isMouseDownOnEvent = (event: MouseEvent) => {\r\n return (event.buttons & 1) === 1;\r\n };\r\n\r\n useEffect(() => {\r\n return editor.registerNodeTransform(TableNode, (tableNode) => {\r\n // modification: set default column widths if not defined or table cells of imported tables has the width set\r\n if (!tableNode.getColWidths()) {\r\n const tableRows = tableNode.getChildren();\r\n const columnCount = tableNode.getColumnCount();\r\n const colWidths = new Array(columnCount).fill(undefined);\r\n\r\n const firstRow = tableRows[0] as TableRowNode;\r\n const cells = firstRow.getChildren();\r\n cells.forEach((cell, colIdx) => {\r\n const domCell = editor.getElementByKey(cell.getKey());\r\n if (domCell && domCell.style.width) {\r\n colWidths[colIdx] = parseInt(domCell.style.width, 10);\r\n domCell.style.width = '';\r\n } else if (tableHasContent(tableNode)) {\r\n const isNested = tableNode ? $getNearestNodeOfType(tableNode, TableCellNode) : null;\r\n\r\n const availableWidth = isNested\r\n ? getEditorParrentCellWidth(isNested, columnCount, editor)\r\n : getEditorContentWidth(editor);\r\n const newColWidth = availableWidth / columnCount;\r\n colWidths[colIdx] = Math.max(newColWidth, MIN_COLUMN_WIDTH);\r\n } else {\r\n colWidths[colIdx] = MIN_COLUMN_WIDTH;\r\n }\r\n });\r\n\r\n tableNode.setColWidths(colWidths);\r\n }\r\n\r\n // modification: wrap table node in a wrapper node if there is no wrapper node present\r\n if (tableNode && !(tableNode.getParent() instanceof TableWrapperNode)) {\r\n const wrapperNode = $createTableWrapperNode();\r\n tableNode.replace(wrapperNode);\r\n wrapperNode.append(tableNode);\r\n }\r\n\r\n return tableNode;\r\n });\r\n }, [editor]);\r\n\r\n useEffect(() => {\r\n const onMouseMove = (event: MouseEvent) => {\r\n const target = event.target;\r\n if (!isHTMLElement(target)) {\r\n return;\r\n }\r\n\r\n if (draggingDirection) {\r\n updateMouseCurrentPos({\r\n x: event.clientX,\r\n y: event.clientY,\r\n });\r\n return;\r\n }\r\n updateIsMouseDown(isMouseDownOnEvent(event));\r\n if (resizerRef.current && resizerRef.current.contains(target)) {\r\n return;\r\n }\r\n\r\n if (targetRef.current !== target) {\r\n targetRef.current = target;\r\n const cell = getDOMCellFromTarget(target);\r\n\r\n if (cell && activeCell !== cell) {\r\n editor.getEditorState().read(\r\n () => {\r\n const tableCellNode = $getNearestNodeFromDOMNode(cell.elem);\r\n if (!tableCellNode) {\r\n throw new Error('TableCellResizer: Table cell node not found.');\r\n }\r\n\r\n const tableNode = $getTableNodeFromLexicalNodeOrThrow(tableCellNode);\r\n const tableElement = getTableElement(tableNode, editor.getElementByKey(tableNode.getKey()));\r\n\r\n if (!tableElement) {\r\n throw new Error('TableCellResizer: Table element not found.');\r\n }\r\n\r\n targetRef.current = target;\r\n tableRectRef.current = tableElement.getBoundingClientRect();\r\n updateActiveCell(cell);\r\n },\r\n { editor }\r\n );\r\n } else if (cell == null) {\r\n resetState();\r\n }\r\n }\r\n };\r\n\r\n const onMouseDown = () => {\r\n updateIsMouseDown(true);\r\n };\r\n\r\n const onMouseUp = () => {\r\n updateIsMouseDown(false);\r\n };\r\n\r\n const removeRootListener = editor.registerRootListener((rootElement, prevRootElement) => {\r\n prevRootElement?.removeEventListener('mousemove', onMouseMove);\r\n prevRootElement?.removeEventListener('mousedown', onMouseDown);\r\n prevRootElement?.removeEventListener('mouseup', onMouseUp);\r\n rootElement?.addEventListener('mousemove', onMouseMove);\r\n rootElement?.addEventListener('mousedown', onMouseDown);\r\n rootElement?.addEventListener('mouseup', onMouseUp);\r\n });\r\n\r\n return () => {\r\n removeRootListener();\r\n };\r\n }, [activeCell, draggingDirection, editor, resetState]);\r\n\r\n const isHeightChanging = (direction: MouseDraggingDirection) => {\r\n if (direction === 'bottom') {\r\n return true;\r\n }\r\n return false;\r\n };\r\n\r\n const updateRowHeight = useCallback(\r\n (heightChange: number) => {\r\n if (!activeCell) {\r\n throw new Error('TableCellResizer: Expected active cell.');\r\n }\r\n\r\n editor.update(\r\n () => {\r\n const tableCellNode = $getNearestNodeFromDOMNode(activeCell.elem);\r\n if (!$isTableCellNode(tableCellNode)) {\r\n throw new Error('TableCellResizer: Table cell node not found.');\r\n }\r\n\r\n const tableNode = $getTableNodeFromLexicalNodeOrThrow(tableCellNode);\r\n\r\n const tableRowIndex = $getTableRowIndexFromTableCellNode(tableCellNode) + tableCellNode.getRowSpan() - 1;\r\n\r\n const tableRows = tableNode.getChildren();\r\n\r\n if (tableRowIndex >= tableRows.length || tableRowIndex < 0) {\r\n throw new Error('Expected table cell to be inside of table row.');\r\n }\r\n\r\n const tableRow = tableRows[tableRowIndex];\r\n\r\n if (!$isTableRowNode(tableRow)) {\r\n throw new Error('Expected table row');\r\n }\r\n\r\n let height = tableRow.getHeight();\r\n if (height === undefined) {\r\n const rowCells = tableRow.getChildren<TableCellNode>();\r\n height = Math.min(...rowCells.map((cell) => getCellNodeHeight(cell, editor) ?? Infinity));\r\n }\r\n\r\n const newHeight = Math.max(height + heightChange, MIN_ROW_HEIGHT);\r\n tableRow.setHeight(newHeight);\r\n },\r\n { tag: 'skip-scroll-into-view' }\r\n );\r\n },\r\n [activeCell, editor]\r\n );\r\n\r\n const getCellNodeHeight = (cell: TableCellNode, activeEditor: LexicalEditor): number | undefined => {\r\n const domCellNode = activeEditor.getElementByKey(cell.getKey());\r\n return domCellNode?.clientHeight;\r\n };\r\n\r\n const getCellColumnIndex = (tableCellNode: TableCellNode, tableMap: TableMapType) => {\r\n for (let row = 0; row < tableMap.length; row++) {\r\n for (let column = 0; column < tableMap[row].length; column++) {\r\n if (tableMap[row][column].cell === tableCellNode) {\r\n return column;\r\n }\r\n }\r\n }\r\n return -1;\r\n };\r\n\r\n const updateColumnWidth = useCallback(\r\n (widthChange: number) => {\r\n if (!activeCell) {\r\n throw new Error('TableCellResizer: Expected active cell.');\r\n }\r\n editor.update(\r\n () => {\r\n const tableCellNode = $getNearestNodeFromDOMNode(activeCell.elem);\r\n if (!$isTableCellNode(tableCellNode)) {\r\n throw new Error('TableCellResizer: Table cell node not found.');\r\n }\r\n\r\n const tableNode = $getTableNodeFromLexicalNodeOrThrow(tableCellNode);\r\n const [tableMap] = $computeTableMapSkipCellCheck(tableNode, null, null);\r\n const columnIndex = getCellColumnIndex(tableCellNode, tableMap);\r\n if (columnIndex === undefined) {\r\n throw new Error('TableCellResizer: Table column not found.');\r\n }\r\n\r\n const colWidths = tableNode.getColWidths();\r\n if (!colWidths) {\r\n return;\r\n }\r\n const width = colWidths[columnIndex];\r\n if (width === undefined) {\r\n return;\r\n }\r\n const newColWidths = [...colWidths];\r\n const newWidth = Math.max(width + widthChange, MIN_COLUMN_WIDTH);\r\n newColWidths[columnIndex] = newWidth;\r\n tableNode.setColWidths(newColWidths);\r\n\r\n // modification: when resizing a column, also resize the next column so the table doesn't overflow\r\n if (columnIndex < tableNode.getColumnCount() - 1) {\r\n const nextColWidths = tableNode.getColWidths();\r\n if (!nextColWidths) {\r\n return;\r\n }\r\n const newNextColWidths = [...nextColWidths];\r\n const newColumnIndex = columnIndex + 1;\r\n const newNextWidth = nextColWidths[newColumnIndex];\r\n const nextWidth = Math.max(newNextWidth - widthChange, MIN_COLUMN_WIDTH);\r\n newNextColWidths[newColumnIndex] = nextWidth;\r\n tableNode.setColWidths(newNextColWidths);\r\n }\r\n },\r\n { tag: 'skip-scroll-into-view' }\r\n );\r\n },\r\n [activeCell, editor]\r\n );\r\n\r\n const mouseUpHandler = useCallback(\r\n (direction: MouseDraggingDirection) => {\r\n const handler = (event: MouseEvent) => {\r\n event.preventDefault();\r\n event.stopPropagation();\r\n\r\n if (!activeCell) {\r\n throw new Error('TableCellResizer: Expected active cell.');\r\n }\r\n\r\n if (mouseStartPosRef.current) {\r\n const { x, y } = mouseStartPosRef.current;\r\n\r\n if (activeCell === null) {\r\n return;\r\n }\r\n const zoom = calculateZoomLevel(event.target as Element);\r\n\r\n if (isHeightChanging(direction)) {\r\n const heightChange = (event.clientY - y) / zoom;\r\n updateRowHeight(heightChange);\r\n } else {\r\n const widthChange = (event.clientX - x) / zoom;\r\n updateColumnWidth(widthChange);\r\n }\r\n\r\n resetState();\r\n document.removeEventListener('mouseup', handler);\r\n }\r\n };\r\n return handler;\r\n },\r\n [activeCell, resetState, updateColumnWidth, updateRowHeight]\r\n );\r\n\r\n const toggleResize = useCallback(\r\n (direction: MouseDraggingDirection): MouseEventHandler<HTMLDivElement> =>\r\n (event) => {\r\n event.preventDefault();\r\n event.stopPropagation();\r\n\r\n if (!activeCell) {\r\n throw new Error('TableCellResizer: Expected active cell.');\r\n }\r\n\r\n mouseStartPosRef.current = {\r\n x: event.clientX,\r\n y: event.clientY,\r\n };\r\n updateMouseCurrentPos(mouseStartPosRef.current);\r\n updateDraggingDirection(direction);\r\n\r\n document.addEventListener('mouseup', mouseUpHandler(direction));\r\n },\r\n [activeCell, mouseUpHandler]\r\n );\r\n\r\n const getResizers = useCallback(() => {\r\n if (activeCell) {\r\n const { height, width, top, left } = activeCell.elem.getBoundingClientRect();\r\n const zoom = calculateZoomLevel(activeCell.elem);\r\n const zoneWidth = 10; // Pixel width of the zone where you can drag the edge\r\n const styles = {\r\n bottom: {\r\n backgroundColor: 'none',\r\n cursor: 'ns-resize',\r\n height: `${zoneWidth}px`,\r\n left: `${window.pageXOffset + left}px`,\r\n top: `${window.pageYOffset + top + height - zoneWidth / HALF}px`,\r\n width: `${width}px`,\r\n zIndex: 5000,\r\n },\r\n right: {\r\n backgroundColor: 'none',\r\n cursor: 'ew-resize',\r\n height: `${height}px`,\r\n left: `${window.pageXOffset + left + width - zoneWidth / HALF}px`,\r\n top: `${window.pageYOffset + top}px`,\r\n width: `${zoneWidth}px`,\r\n zIndex: 5000,\r\n },\r\n };\r\n\r\n const tableRect = tableRectRef.current;\r\n\r\n if (draggingDirection && mouseCurrentPos && tableRect) {\r\n if (isHeightChanging(draggingDirection)) {\r\n styles[draggingDirection].left = `${window.pageXOffset + tableRect.left}px`;\r\n styles[draggingDirection].top = `${window.pageYOffset + mouseCurrentPos.y / zoom}px`;\r\n styles[draggingDirection].height = '3px';\r\n styles[draggingDirection].width = `${tableRect.width}px`;\r\n } else {\r\n styles[draggingDirection].top = `${window.pageYOffset + tableRect.top}px`;\r\n styles[draggingDirection].left = `${window.pageXOffset + mouseCurrentPos.x / zoom}px`;\r\n styles[draggingDirection].width = '3px';\r\n styles[draggingDirection].height = `${tableRect.height}px`;\r\n }\r\n\r\n styles[draggingDirection].backgroundColor = '#adf';\r\n }\r\n\r\n return styles;\r\n }\r\n\r\n return {\r\n bottom: null,\r\n left: null,\r\n right: null,\r\n top: null,\r\n };\r\n }, [activeCell, draggingDirection, mouseCurrentPos]);\r\n\r\n const resizerStyles = getResizers();\r\n\r\n return (\r\n <div ref={resizerRef}>\r\n {activeCell != null && !isMouseDown && (\r\n <>\r\n <div\r\n className={styles['table-cell-resizer__resizer']}\r\n style={resizerStyles.right || undefined}\r\n onMouseDown={toggleResize('right')}\r\n />\r\n <div\r\n className={styles['table-cell-resizer__resizer']}\r\n style={resizerStyles.bottom || undefined}\r\n onMouseDown={toggleResize('bottom')}\r\n />\r\n </>\r\n )}\r\n </div>\r\n );\r\n}\r\n\r\nexport const TableCellResizerPlugin = (): null | ReactPortal => {\r\n const [editor] = useLexicalComposerContext();\r\n const isEditable = useLexicalEditable();\r\n\r\n return useMemo(\r\n () => (isEditable ? createPortal(<TableCellResizer editor={editor} />, document.body) : null),\r\n [editor, isEditable]\r\n );\r\n};\r\n"],"names":["c","n","t","u","e","a","i","l","r","d","o","MIN_ROW_HEIGHT","MIN_COLUMN_WIDTH","HALF","TableCellResizer","editor","targetRef","useRef","resizerRef","tableRectRef","mouseStartPosRef","mouseCurrentPos","updateMouseCurrentPos","useState","activeCell","updateActiveCell","isMouseDown","updateIsMouseDown","draggingDirection","updateDraggingDirection","resetState","useCallback","isMouseDownOnEvent","event","useEffect","TableNode","tableNode","tableRows","columnCount","colWidths","cell","colIdx","domCell","tableHasContent","isNested","$getNearestNodeOfType","TableCellNode","newColWidth","getEditorParrentCellWidth","getEditorContentWidth","TableWrapperNode","wrapperNode","$createTableWrapperNode","onMouseMove","target","isHTMLElement","getDOMCellFromTarget","tableCellNode","$getNearestNodeFromDOMNode","$getTableNodeFromLexicalNodeOrThrow","tableElement","getTableElement","onMouseDown","onMouseUp","removeRootListener","rootElement","prevRootElement","isHeightChanging","direction","updateRowHeight","heightChange","$isTableCellNode","tableRowIndex","$getTableRowIndexFromTableCellNode","tableRow","$isTableRowNode","height","rowCells","getCellNodeHeight","newHeight","activeEditor","getCellColumnIndex","tableMap","row","column","updateColumnWidth","widthChange","$computeTableMapSkipCellCheck","columnIndex","width","newColWidths","newWidth","nextColWidths","newNextColWidths","newColumnIndex","newNextWidth","nextWidth","mouseUpHandler","handler","x","y","zoom","calculateZoomLevel","toggleResize","resizerStyles","top","left","zoneWidth","styles","tableRect","jsx","jsxs","Fragment","TableCellResizerPlugin","useLexicalComposerContext","isEditable","useLexicalEditable","useMemo","createPortal"],"mappings":";;;;;;;;;AAQgL,MAAMA,KAAe,OAAO,SAApB,OAAqC,OAAO,aAAhB,UAAmC,OAAO,SAAS,kBAAzB,SAAuCC,IAAEC;AAAE,SAASC,GAAEC,GAAE;AAAC,SAAM,EAAC,gBAAe,MAAIA,EAAE,WAAU,GAAG,WAAU,CAAAH,MAAGG,EAAE,yBAAyBH,CAAC,EAAC;AAAC;AAAC,SAASI,KAAG;AAAC,UAAO,SAASJ,GAAE;AAAC,UAAK,CAACC,CAAC,IAAEE,EAAC,GAAGD,IAAEG,GAAG,MAAIL,EAAEC,CAAC,IAAG,CAACA,GAAED,CAAC,CAAC,GAAE,CAACI,GAAEE,CAAC,IAAEC,GAAG,MAAIL,EAAE,eAAc,EAAE,GAAGM,IAAEC,EAAEL,CAAC;AAAE,WAAOL,IAAG,MAAI;AAAC,YAAK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AAF;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,WAAWF,EAAO,6BAA6B;AAAA,QAC/C,OAAOJ,EAAc,SAAS;AAAA,QAC9B,aAAaD,EAAa,OAAO;AAAA,MAAA;AAAA,IAAA;AAAA,IAEnC,gBAAAO;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,WAAWF,EAAO,6BAA6B;AAAA,QAC/C,OAAOJ,EAAc,UAAU;AAAA,QAC/B,aAAaD,EAAa,QAAQ;AAAA,MAAA;AAAA,IAAA;AAAA,EACpC,EAAA,CACF,EAAA,CAEJ;AAEJ;AAEO,MAAMU,KAAyB,MAA0B;AAC9D,QAAM,CAAClG,CAAM,IAAImG,EAAA,GACXC,IAAaC,GAAA;AAEnB,SAAOC;AAAA,IACL,MAAOF,IAAaG,GAAa,gBAAAR,EAAChG,MAAiB,QAAAC,EAAA,CAAgB,GAAI,SAAS,IAAI,IAAI;AAAA,IACxF,CAACA,GAAQoG,CAAU;AAAA,EAAA;AAEvB;","x_google_ignoreList":[0]}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsxs as c, jsx as e, Fragment as Z } from "react/jsx-runtime";
|
|
2
|
-
import { o as ee } from "./LexicalComposerContext.prod-
|
|
2
|
+
import { o as ee } from "./LexicalComposerContext.prod-DOyoZx0P.js";
|
|
3
3
|
import { c as z } from "./clsx-OuTLNxxd.js";
|
|
4
|
-
import { W as te, R as oe, y as re } from "./LexicalTable.prod-
|
|
5
|
-
import { as as le, J as ne, P as J, _ as O, y as ie, ah as ae } from "./Lexical.prod-
|
|
6
|
-
import { v as se } from "./LexicalUtils.prod-
|
|
4
|
+
import { W as te, R as oe, y as re } from "./LexicalTable.prod-COFf1Spn.js";
|
|
5
|
+
import { as as le, J as ne, P as J, _ as O, y as ie, ah as ae } from "./Lexical.prod-qYl_ifJ6.js";
|
|
6
|
+
import { v as se } from "./LexicalUtils.prod-C3To3vrm.js";
|
|
7
7
|
import { forwardRef as V, useState as C, useRef as g, useId as A, useImperativeHandle as K, useEffect as R } from "react";
|
|
8
8
|
import "./components/Accordion/Accordion.js";
|
|
9
9
|
import { Button as I } from "./components/Buttons/Button.js";
|
|
@@ -23,7 +23,7 @@ import { InputField as U } from "./components/InputField/InputField.js";
|
|
|
23
23
|
import "react-router";
|
|
24
24
|
import { s as L, M as ce } from "./MultiSelectItem-DbOdEllV.js";
|
|
25
25
|
import "./components/RteEditor/Providers/LanguageProvider.js";
|
|
26
|
-
import { e as me, v as de } from "./helpers-
|
|
26
|
+
import { e as me, v as de } from "./helpers-D3SODeVc.js";
|
|
27
27
|
import { Icon as G } from "./components/Icon/Icon.js";
|
|
28
28
|
import { FeedbackBox as Y } from "./components/FeedbackBox/FeedbackBox.js";
|
|
29
29
|
import { useTranslation as j } from "./components/RteEditor/hooks/useTranslation.js";
|
|
@@ -34,7 +34,7 @@ import { $createTableWrapperNode as Ce } from "./components/RteEditor/nodes/Tabl
|
|
|
34
34
|
import { useFlyout as Ne } from "./components/RteEditor/hooks/useFlyout.js";
|
|
35
35
|
import { s as M } from "./RteEditor.module-dE9wQTC9.js";
|
|
36
36
|
import "react-dom";
|
|
37
|
-
import "./index-
|
|
37
|
+
import "./index-yEhaxKq-.js";
|
|
38
38
|
import "./components/SelectListbox/SelectListbox.js";
|
|
39
39
|
import "./components/SelectListbox/SelectProvider.js";
|
|
40
40
|
import "./components/Sortable/components/SortableItem.js";
|
|
@@ -303,4 +303,4 @@ export {
|
|
|
303
303
|
ge as a,
|
|
304
304
|
Se as b
|
|
305
305
|
};
|
|
306
|
-
//# sourceMappingURL=TablePlugin-
|
|
306
|
+
//# sourceMappingURL=TablePlugin-FQQwnq2m.js.map
|