@underverse-ui/underverse 2.0.26 → 2.0.27

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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "package": "@underverse-ui/underverse",
3
- "version": "2.0.26",
3
+ "version": "2.0.27",
4
4
  "sourceEntry": "src/index.ts",
5
5
  "totalExports": 263,
6
6
  "exports": [
@@ -41,6 +41,12 @@ import {
41
41
  getRelativeCellMetrics,
42
42
  getRelativeSelectedCellsMetrics,
43
43
  getSelectionTableCell,
44
+ isCrossRealmElement,
45
+ isCrossRealmHTMLElement,
46
+ isCrossRealmNode,
47
+ isCrossRealmTable,
48
+ isCrossRealmTableCell,
49
+ isCrossRealmTableRow,
44
50
  isPointOverRenderedText,
45
51
  isRowResizeHotspot,
46
52
  isRowResizingGlobal,
@@ -55,7 +61,7 @@ import {
55
61
  sanitizeUEditorUrl,
56
62
  useEditorColors,
57
63
  useSharedEditorUiRenderState
58
- } from "./chunk-OJF3XRN7.js";
64
+ } from "./chunk-BDRCOIYR.js";
59
65
  import {
60
66
  Tooltip,
61
67
  UEditorPortalProvider,
@@ -3365,8 +3371,7 @@ function setColumnStyle(column, width) {
3365
3371
  column.style.minWidth = "";
3366
3372
  }
3367
3373
  function isTableColumnElement(node) {
3368
- const realm = node?.ownerDocument?.defaultView;
3369
- return Boolean(realm && node instanceof realm.HTMLTableColElement && node.tagName.toLowerCase() === "col");
3374
+ return isCrossRealmElement(node) && String(node.tagName).toUpperCase() === "COL";
3370
3375
  }
3371
3376
  function updateDynamicColumns(node, colgroup, table, ownerDocument, overrideCol, overrideValue) {
3372
3377
  let totalWidth = 0;
@@ -3439,8 +3444,7 @@ function getCurrentColWidth(view, cellPos, { colspan, colwidth }) {
3439
3444
  if (width) return width;
3440
3445
  const dom = view.domAtPos(cellPos);
3441
3446
  const cellElement = dom.node.childNodes[dom.offset];
3442
- const realm = view.dom.ownerDocument.defaultView;
3443
- let domWidth = realm && cellElement instanceof realm.HTMLElement ? cellElement.offsetWidth : 0;
3447
+ let domWidth = isCrossRealmHTMLElement(cellElement) ? cellElement.offsetWidth : 0;
3444
3448
  let parts = Math.max(1, colspan);
3445
3449
  if (colwidth) {
3446
3450
  for (let index = 0; index < colspan; index += 1) {
@@ -3454,14 +3458,13 @@ function getCurrentColWidth(view, cellPos, { colspan, colwidth }) {
3454
3458
  return domWidth / Math.max(1, parts);
3455
3459
  }
3456
3460
  function domCellAround(view, target) {
3457
- const realm = view.dom.ownerDocument.defaultView;
3458
- let node = realm && target instanceof realm.Node ? target : null;
3461
+ let node = isCrossRealmNode(target) ? target : null;
3459
3462
  while (node && node.nodeName !== "TD" && node.nodeName !== "TH") {
3460
- const element = realm && node instanceof realm.Element ? node : null;
3463
+ const element = isCrossRealmElement(node) ? node : null;
3461
3464
  if (element?.classList.contains("ProseMirror")) return null;
3462
3465
  node = node.parentNode;
3463
3466
  }
3464
- return realm && node instanceof realm.HTMLElement ? node : null;
3467
+ return isCrossRealmHTMLElement(node) ? node : null;
3465
3468
  }
3466
3469
  function edgeCell(view, event, side, handleWidth) {
3467
3470
  const offset = side === "right" ? -handleWidth : handleWidth;
@@ -3607,8 +3610,7 @@ function getTableElementAtCell(view, cell) {
3607
3610
  const $cell = view.state.doc.resolve(cell);
3608
3611
  let dom = view.domAtPos($cell.start(-1)).node;
3609
3612
  while (dom && dom.nodeName !== "TABLE") dom = dom.parentNode;
3610
- const realm = view.dom.ownerDocument.defaultView;
3611
- return realm && dom instanceof realm.HTMLTableElement ? dom : null;
3613
+ return isCrossRealmTable(dom) ? dom : null;
3612
3614
  }
3613
3615
  function showColumnResizeGhost(view, cell, dragging, width) {
3614
3616
  const table = getTableElementAtCell(view, cell);
@@ -11551,20 +11553,16 @@ import {
11551
11553
  var FALLBACK_TABLE_ROW_HEIGHT = DEFAULT_TABLE_ROW_HEIGHT;
11552
11554
  var FALLBACK_TABLE_COLUMN_WIDTH = 160;
11553
11555
  function isTableCellElement(element) {
11554
- const realm = element?.ownerDocument?.defaultView;
11555
- return Boolean(realm && element instanceof realm.HTMLTableCellElement);
11556
+ return isCrossRealmTableCell(element);
11556
11557
  }
11557
11558
  function isTableRowElement(element) {
11558
- const realm = element?.ownerDocument?.defaultView;
11559
- return Boolean(realm && element instanceof realm.HTMLTableRowElement);
11559
+ return isCrossRealmTableRow(element);
11560
11560
  }
11561
11561
  function isTableElement(element) {
11562
- const realm = element?.ownerDocument?.defaultView;
11563
- return Boolean(realm && element instanceof realm.HTMLTableElement);
11562
+ return isCrossRealmTable(element);
11564
11563
  }
11565
11564
  function isHTMLElement(element) {
11566
- const realm = element?.ownerDocument?.defaultView;
11567
- return Boolean(realm && element instanceof realm.HTMLElement);
11565
+ return isCrossRealmHTMLElement(element);
11568
11566
  }
11569
11567
  function getVisibleTableBounds(layout) {
11570
11568
  const left = Math.max(layout.tableLeft, layout.wrapperLeft);
@@ -11848,8 +11846,7 @@ var ADD_COLUMN_HOVER_WIDTH = 24;
11848
11846
  var ADD_ROW_HOVER_HEIGHT = 24;
11849
11847
  var HANDLE_HOVER_RADIUS = 14;
11850
11848
  function isHTMLElement2(element) {
11851
- const realm = element?.ownerDocument?.defaultView;
11852
- return Boolean(realm && element instanceof realm.HTMLElement);
11849
+ return isCrossRealmHTMLElement(element);
11853
11850
  }
11854
11851
  var DEFAULT_TABLE_HOVER_STATE = {
11855
11852
  menuVisible: false,
@@ -12568,7 +12565,7 @@ function getSelectedCell(editor) {
12568
12565
  const browserSelection = editorWindow?.getSelection();
12569
12566
  const anchorElement = resolveEventElement(browserSelection?.anchorNode ?? null);
12570
12567
  const anchorCell = anchorElement?.closest?.("th,td");
12571
- if (editorWindow && anchorCell instanceof editorWindow.HTMLTableCellElement) {
12568
+ if (isCrossRealmTableCell(anchorCell)) {
12572
12569
  return anchorCell;
12573
12570
  }
12574
12571
  const domAtPos = editor.view.domAtPos(editor.state.selection.from);
@@ -13631,12 +13628,12 @@ function useUEditorTableInteractions(editor, editable = true) {
13631
13628
  return;
13632
13629
  }
13633
13630
  const target = resolveEventElement(event.target);
13634
- if (!(target instanceof editorWindow.Element)) {
13631
+ if (!isCrossRealmElement(target)) {
13635
13632
  clearAllTableResizeHover();
13636
13633
  return;
13637
13634
  }
13638
13635
  const cell = target.closest("th,td");
13639
- if (!(cell instanceof editorWindow.HTMLElement)) {
13636
+ if (!isCrossRealmHTMLElement(cell)) {
13640
13637
  clearHoveredTableCell();
13641
13638
  clearAllTableResizeHover();
13642
13639
  return;
@@ -13644,7 +13641,7 @@ function useUEditorTableInteractions(editor, editable = true) {
13644
13641
  setHoveredTableCell(cell);
13645
13642
  const row = cell.closest("tr");
13646
13643
  const table = cell.closest("table");
13647
- if (!(row instanceof editorWindow.HTMLTableRowElement) || !(table instanceof editorWindow.HTMLTableElement)) {
13644
+ if (!isCrossRealmTableRow(row) || !isCrossRealmTable(table)) {
13648
13645
  clearHoveredTableCell();
13649
13646
  clearAllTableResizeHover();
13650
13647
  return;
@@ -13700,18 +13697,18 @@ function useUEditorTableInteractions(editor, editable = true) {
13700
13697
  const handleEditorMouseDown = (event) => {
13701
13698
  if (event.button !== 0) return;
13702
13699
  const target = resolveEventElement(event.target);
13703
- if (!(target instanceof editorWindow.Element)) {
13700
+ if (!isCrossRealmElement(target)) {
13704
13701
  clearActiveTableCell();
13705
13702
  return;
13706
13703
  }
13707
13704
  const cell = target.closest("th,td");
13708
- if (!(cell instanceof editorWindow.HTMLTableCellElement)) {
13705
+ if (!isCrossRealmTableCell(cell)) {
13709
13706
  clearActiveTableCell();
13710
13707
  return;
13711
13708
  }
13712
13709
  const row = cell.closest("tr");
13713
13710
  const table = cell.closest("table");
13714
- if (!(row instanceof editorWindow.HTMLTableRowElement) || !(table instanceof editorWindow.HTMLTableElement)) return;
13711
+ if (!isCrossRealmTableRow(row) || !isCrossRealmTable(table)) return;
13715
13712
  const rowTarget = resolveRowResizeTarget(cell, event.clientX, event.clientY);
13716
13713
  if (rowTarget) {
13717
13714
  event.preventDefault();
@@ -14541,7 +14538,7 @@ function useUEditorOutput({
14541
14538
  // src/components/UEditor/UEditor.tsx
14542
14539
  import { jsx as jsx20, jsxs as jsxs17 } from "react/jsx-runtime";
14543
14540
  var LazyMenuBar = React15.lazy(async () => {
14544
- const { MenuBar } = await import("./menu-bar-4FM4Y273.js");
14541
+ const { MenuBar } = await import("./menu-bar-GKJEVLQU.js");
14545
14542
  return { default: MenuBar };
14546
14543
  });
14547
14544
  var UEditor = React15.forwardRef(({
@@ -15010,4 +15007,4 @@ export {
15010
15007
  prepareUEditorContentForSave,
15011
15008
  UEditor_default
15012
15009
  };
15013
- //# sourceMappingURL=chunk-GS24SZVS.js.map
15010
+ //# sourceMappingURL=chunk-5ODK33CL.js.map