@kopexa/extension-table 17.0.46 → 17.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (209) hide show
  1. package/dist/chunk-2NBDRVYL.mjs +428 -0
  2. package/dist/chunk-3SWV7BGP.mjs +638 -0
  3. package/dist/chunk-4QSZXHZO.mjs +276 -0
  4. package/dist/chunk-5B5XIL2G.mjs +457 -0
  5. package/dist/chunk-62B2LU2Q.mjs +603 -0
  6. package/dist/chunk-6FHFDGJO.mjs +251 -0
  7. package/dist/chunk-CD62W5C3.mjs +165 -0
  8. package/dist/chunk-CN73TYHV.mjs +190 -0
  9. package/dist/chunk-CPDSPBS6.mjs +276 -0
  10. package/dist/chunk-E7W2KRZG.mjs +49 -0
  11. package/dist/chunk-G6GHC2WO.mjs +276 -0
  12. package/dist/chunk-GBTQVIN5.mjs +174 -0
  13. package/dist/chunk-GDEXPEW5.mjs +52 -0
  14. package/dist/chunk-GQLZBIWF.mjs +198 -0
  15. package/dist/chunk-IRJ6RAVQ.mjs +116 -0
  16. package/dist/chunk-J4VOSZCZ.mjs +59 -0
  17. package/dist/chunk-KIYFW7MP.mjs +122 -0
  18. package/dist/chunk-KTRZVXJC.mjs +306 -0
  19. package/dist/chunk-LUA32VH4.mjs +35 -0
  20. package/dist/{chunk-2L3HZWWG.mjs → chunk-MB52MZQ4.mjs} +7 -8
  21. package/dist/chunk-PTX5UYV6.mjs +10 -0
  22. package/dist/chunk-TEGO6KUS.mjs +96 -0
  23. package/dist/chunk-VIBVRWS4.mjs +197 -0
  24. package/dist/chunk-VQV757EG.mjs +113 -0
  25. package/dist/chunk-XRNQXADK.mjs +149 -0
  26. package/dist/chunk-ZVPJDJBO.mjs +134 -0
  27. package/dist/{kit.d.mts → extensions/kit.d.mts} +1 -3
  28. package/dist/{kit.d.ts → extensions/kit.d.ts} +1 -3
  29. package/dist/extensions/kit.js +1041 -0
  30. package/dist/extensions/kit.mjs +15 -0
  31. package/dist/extensions/table-cell.d.mts +6 -0
  32. package/dist/extensions/table-cell.d.ts +6 -0
  33. package/dist/extensions/table-cell.js +70 -0
  34. package/dist/extensions/table-cell.mjs +8 -0
  35. package/dist/extensions/table-handle-plugin.d.mts +46 -0
  36. package/dist/extensions/table-handle-plugin.d.ts +46 -0
  37. package/dist/extensions/table-handle-plugin.js +1100 -0
  38. package/dist/extensions/table-handle-plugin.mjs +18 -0
  39. package/dist/extensions/table-handle.d.mts +19 -0
  40. package/dist/extensions/table-handle.d.ts +19 -0
  41. package/dist/extensions/table-handle.js +865 -0
  42. package/dist/extensions/table-handle.mjs +11 -0
  43. package/dist/{table → extensions}/table.d.mts +2 -2
  44. package/dist/{table → extensions}/table.d.ts +2 -2
  45. package/dist/extensions/table.js +138 -0
  46. package/dist/extensions/table.mjs +9 -0
  47. package/dist/hooks/use-resize-overlay.d.mts +5 -0
  48. package/dist/hooks/use-resize-overlay.d.ts +5 -0
  49. package/dist/hooks/use-resize-overlay.js +83 -0
  50. package/dist/hooks/use-resize-overlay.mjs +9 -0
  51. package/dist/hooks/use-table-add-row-column.d.mts +57 -0
  52. package/dist/hooks/use-table-add-row-column.d.ts +57 -0
  53. package/dist/hooks/use-table-add-row-column.js +551 -0
  54. package/dist/hooks/use-table-add-row-column.mjs +11 -0
  55. package/dist/hooks/use-table-align-cell.d.mts +148 -0
  56. package/dist/hooks/use-table-align-cell.d.ts +148 -0
  57. package/dist/hooks/use-table-align-cell.js +655 -0
  58. package/dist/hooks/use-table-align-cell.mjs +13 -0
  59. package/dist/hooks/use-table-clear-row-column-content.d.mts +103 -0
  60. package/dist/hooks/use-table-clear-row-column-content.d.ts +103 -0
  61. package/dist/hooks/use-table-clear-row-column-content.js +681 -0
  62. package/dist/hooks/use-table-clear-row-column-content.mjs +11 -0
  63. package/dist/hooks/use-table-delete-row-column.d.mts +87 -0
  64. package/dist/hooks/use-table-delete-row-column.d.ts +87 -0
  65. package/dist/hooks/use-table-delete-row-column.js +459 -0
  66. package/dist/hooks/use-table-delete-row-column.mjs +11 -0
  67. package/dist/hooks/use-table-duplicate-row-column.d.mts +49 -0
  68. package/dist/hooks/use-table-duplicate-row-column.d.ts +49 -0
  69. package/dist/hooks/use-table-duplicate-row-column.js +758 -0
  70. package/dist/hooks/use-table-duplicate-row-column.mjs +11 -0
  71. package/dist/hooks/use-table-handle-positioning.d.mts +42 -0
  72. package/dist/hooks/use-table-handle-positioning.d.ts +42 -0
  73. package/dist/hooks/use-table-handle-positioning.js +190 -0
  74. package/dist/hooks/use-table-handle-positioning.mjs +10 -0
  75. package/dist/hooks/use-table-handle-state.d.mts +28 -0
  76. package/dist/hooks/use-table-handle-state.d.ts +28 -0
  77. package/dist/hooks/use-table-handle-state.js +76 -0
  78. package/dist/hooks/use-table-handle-state.mjs +9 -0
  79. package/dist/hooks/use-table-header-row-column.d.mts +58 -0
  80. package/dist/hooks/use-table-header-row-column.d.ts +58 -0
  81. package/dist/hooks/use-table-header-row-column.js +603 -0
  82. package/dist/hooks/use-table-header-row-column.mjs +13 -0
  83. package/dist/hooks/use-table-merge-split-cell.d.mts +123 -0
  84. package/dist/hooks/use-table-merge-split-cell.d.ts +123 -0
  85. package/dist/hooks/use-table-merge-split-cell.js +331 -0
  86. package/dist/hooks/use-table-merge-split-cell.mjs +12 -0
  87. package/dist/hooks/use-table-move-row-column.d.mts +101 -0
  88. package/dist/hooks/use-table-move-row-column.d.ts +101 -0
  89. package/dist/hooks/use-table-move-row-column.js +621 -0
  90. package/dist/hooks/use-table-move-row-column.mjs +13 -0
  91. package/dist/hooks/use-table-sort-row-column.d.mts +118 -0
  92. package/dist/hooks/use-table-sort-row-column.d.ts +118 -0
  93. package/dist/hooks/use-table-sort-row-column.js +623 -0
  94. package/dist/hooks/use-table-sort-row-column.mjs +13 -0
  95. package/dist/index.d.mts +17 -6
  96. package/dist/index.d.ts +17 -6
  97. package/dist/index.js +4947 -660
  98. package/dist/index.mjs +43 -21
  99. package/dist/lib/constants.d.mts +4 -0
  100. package/dist/lib/constants.d.ts +4 -0
  101. package/dist/{table/lib/is-cell-selection.js → lib/constants.js} +10 -10
  102. package/dist/lib/constants.mjs +10 -0
  103. package/dist/lib/create-image.d.mts +12 -0
  104. package/dist/lib/create-image.d.ts +12 -0
  105. package/dist/lib/create-image.js +221 -0
  106. package/dist/lib/create-image.mjs +8 -0
  107. package/dist/lib/table-utils.d.mts +263 -0
  108. package/dist/lib/table-utils.d.ts +263 -0
  109. package/dist/lib/table-utils.js +488 -0
  110. package/dist/lib/table-utils.mjs +40 -0
  111. package/dist/messages.d.mts +174 -0
  112. package/dist/messages.d.ts +174 -0
  113. package/dist/messages.js +213 -0
  114. package/dist/{table-row.mjs → messages.mjs} +3 -3
  115. package/dist/ui/table-alignment-menu.d.mts +25 -0
  116. package/dist/ui/table-alignment-menu.d.ts +25 -0
  117. package/dist/ui/table-alignment-menu.js +758 -0
  118. package/dist/ui/table-alignment-menu.mjs +14 -0
  119. package/dist/ui/table-cell-handle-menu.d.mts +12 -0
  120. package/dist/ui/table-cell-handle-menu.d.ts +12 -0
  121. package/dist/ui/table-cell-handle-menu.js +1317 -0
  122. package/dist/ui/table-cell-handle-menu.mjs +17 -0
  123. package/dist/ui/table-handle-menu.d.mts +23 -0
  124. package/dist/ui/table-handle-menu.d.ts +23 -0
  125. package/dist/ui/table-handle-menu.js +2598 -0
  126. package/dist/ui/table-handle-menu.mjs +21 -0
  127. package/dist/ui/table-handle.d.mts +48 -0
  128. package/dist/ui/table-handle.d.ts +48 -0
  129. package/dist/ui/table-handle.js +3126 -0
  130. package/dist/ui/table-handle.mjs +22 -0
  131. package/dist/ui/table-selection-overlay.d.mts +14 -0
  132. package/dist/ui/table-selection-overlay.d.ts +14 -0
  133. package/dist/ui/table-selection-overlay.js +553 -0
  134. package/dist/ui/table-selection-overlay.mjs +11 -0
  135. package/package.json +12 -7
  136. package/dist/chunk-3XEOCAHB.mjs +0 -41
  137. package/dist/chunk-5W5ARI64.mjs +0 -11
  138. package/dist/chunk-BTJ3DCGC.mjs +0 -113
  139. package/dist/chunk-DR2GZJH6.mjs +0 -70
  140. package/dist/chunk-GHOJLOCF.mjs +0 -247
  141. package/dist/chunk-HWVA6DOK.mjs +0 -20
  142. package/dist/chunk-KLUH6EZS.mjs +0 -40
  143. package/dist/chunk-KNOMCS6F.mjs +0 -57
  144. package/dist/chunk-LPHCE6EI.mjs +0 -92
  145. package/dist/chunk-POJFNXG7.mjs +0 -44
  146. package/dist/chunk-QHD3QTD2.mjs +0 -61
  147. package/dist/chunk-RPPUD4R5.mjs +0 -1
  148. package/dist/kit.js +0 -764
  149. package/dist/kit.mjs +0 -19
  150. package/dist/table/index.d.mts +0 -6
  151. package/dist/table/index.d.ts +0 -6
  152. package/dist/table/index.js +0 -625
  153. package/dist/table/index.mjs +0 -18
  154. package/dist/table/lib/col-style.d.mts +0 -3
  155. package/dist/table/lib/col-style.d.ts +0 -3
  156. package/dist/table/lib/col-style.js +0 -36
  157. package/dist/table/lib/col-style.mjs +0 -13
  158. package/dist/table/lib/delete-table-when-all-cells-selected.d.mts +0 -5
  159. package/dist/table/lib/delete-table-when-all-cells-selected.d.ts +0 -5
  160. package/dist/table/lib/delete-table-when-all-cells-selected.js +0 -66
  161. package/dist/table/lib/delete-table-when-all-cells-selected.mjs +0 -40
  162. package/dist/table/lib/get-table-node-types.d.mts +0 -7
  163. package/dist/table/lib/get-table-node-types.d.ts +0 -7
  164. package/dist/table/lib/get-table-node-types.js +0 -44
  165. package/dist/table/lib/get-table-node-types.mjs +0 -21
  166. package/dist/table/lib/icons.d.mts +0 -13
  167. package/dist/table/lib/icons.d.ts +0 -13
  168. package/dist/table/lib/icons.js +0 -81
  169. package/dist/table/lib/icons.mjs +0 -58
  170. package/dist/table/lib/insert-line-above-table-action.d.mts +0 -5
  171. package/dist/table/lib/insert-line-above-table-action.d.ts +0 -5
  172. package/dist/table/lib/insert-line-above-table-action.js +0 -64
  173. package/dist/table/lib/insert-line-above-table-action.mjs +0 -8
  174. package/dist/table/lib/insert-line-below-table-action.d.mts +0 -5
  175. package/dist/table/lib/insert-line-below-table-action.d.ts +0 -5
  176. package/dist/table/lib/insert-line-below-table-action.js +0 -63
  177. package/dist/table/lib/insert-line-below-table-action.mjs +0 -8
  178. package/dist/table/lib/is-cell-selection.d.mts +0 -5
  179. package/dist/table/lib/is-cell-selection.d.ts +0 -5
  180. package/dist/table/lib/is-cell-selection.mjs +0 -8
  181. package/dist/table/lib/table-controls.d.mts +0 -15
  182. package/dist/table/lib/table-controls.d.ts +0 -15
  183. package/dist/table/lib/table-controls.js +0 -131
  184. package/dist/table/lib/table-controls.mjs +0 -8
  185. package/dist/table/table.js +0 -621
  186. package/dist/table/table.mjs +0 -14
  187. package/dist/table/views/table-column-menu.d.mts +0 -11
  188. package/dist/table/views/table-column-menu.d.ts +0 -11
  189. package/dist/table/views/table-column-menu.js +0 -84
  190. package/dist/table/views/table-column-menu.mjs +0 -8
  191. package/dist/table/views/table-node-view.d.mts +0 -25
  192. package/dist/table/views/table-node-view.d.ts +0 -25
  193. package/dist/table/views/table-node-view.js +0 -370
  194. package/dist/table/views/table-node-view.mjs +0 -10
  195. package/dist/table/views/table-row-menu.d.mts +0 -11
  196. package/dist/table/views/table-row-menu.d.ts +0 -11
  197. package/dist/table/views/table-row-menu.js +0 -80
  198. package/dist/table/views/table-row-menu.mjs +0 -8
  199. package/dist/table-cell.d.mts +0 -8
  200. package/dist/table-cell.d.ts +0 -8
  201. package/dist/table-cell.js +0 -93
  202. package/dist/table-cell.mjs +0 -8
  203. package/dist/table-header.d.mts +0 -6
  204. package/dist/table-header.d.ts +0 -6
  205. package/dist/table-header.js +0 -67
  206. package/dist/table-header.mjs +0 -8
  207. package/dist/table-row.d.mts +0 -6
  208. package/dist/table-row.d.ts +0 -6
  209. package/dist/table-row.js +0 -43
@@ -0,0 +1,11 @@
1
+ "use client";
2
+ import {
3
+ TableHandleExtension
4
+ } from "../chunk-LUA32VH4.mjs";
5
+ import "../chunk-3SWV7BGP.mjs";
6
+ import "../chunk-GQLZBIWF.mjs";
7
+ import "../chunk-5B5XIL2G.mjs";
8
+ import "../chunk-WKV76XOR.mjs";
9
+ export {
10
+ TableHandleExtension
11
+ };
@@ -1,6 +1,6 @@
1
1
  import * as _tiptap_core from '@tiptap/core';
2
2
  import { ParentConfig } from '@tiptap/core';
3
- import * as _tiptap_extension_table from '@tiptap/extension-table';
3
+ import { TableOptions } from '@tiptap/extension-table';
4
4
 
5
5
  declare module "@tiptap/core" {
6
6
  interface NodeConfig<Options, Storage> {
@@ -12,6 +12,6 @@ declare module "@tiptap/core" {
12
12
  }) => string);
13
13
  }
14
14
  }
15
- declare const Table: _tiptap_core.Node<_tiptap_extension_table.TableOptions, any>;
15
+ declare const Table: _tiptap_core.Node<TableOptions, any>;
16
16
 
17
17
  export { Table };
@@ -1,6 +1,6 @@
1
1
  import * as _tiptap_core from '@tiptap/core';
2
2
  import { ParentConfig } from '@tiptap/core';
3
- import * as _tiptap_extension_table from '@tiptap/extension-table';
3
+ import { TableOptions } from '@tiptap/extension-table';
4
4
 
5
5
  declare module "@tiptap/core" {
6
6
  interface NodeConfig<Options, Storage> {
@@ -12,6 +12,6 @@ declare module "@tiptap/core" {
12
12
  }) => string);
13
13
  }
14
14
  }
15
- declare const Table: _tiptap_core.Node<_tiptap_extension_table.TableOptions, any>;
15
+ declare const Table: _tiptap_core.Node<TableOptions, any>;
16
16
 
17
17
  export { Table };
@@ -0,0 +1,138 @@
1
+ "use client";
2
+ "use strict";
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
21
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
22
+
23
+ // src/extensions/table.ts
24
+ var table_exports = {};
25
+ __export(table_exports, {
26
+ Table: () => Table
27
+ });
28
+ module.exports = __toCommonJS(table_exports);
29
+ var import_extension_table = require("@tiptap/extension-table");
30
+ var import_tables = require("@tiptap/pm/tables");
31
+
32
+ // src/lib/constants.ts
33
+ var EMPTY_CELL_WIDTH = 120;
34
+ var RESIZE_MIN_WIDTH = 35;
35
+
36
+ // src/extensions/table.ts
37
+ var Table = import_extension_table.Table.configure({
38
+ resizable: true
39
+ }).extend({
40
+ addProseMirrorPlugins() {
41
+ const isResizable = this.options.resizable && this.editor.isEditable;
42
+ const defaultCellMinWidth = this.options.cellMinWidth < EMPTY_CELL_WIDTH ? EMPTY_CELL_WIDTH : this.options.cellMinWidth;
43
+ return [
44
+ ...isResizable ? [
45
+ (0, import_tables.columnResizing)({
46
+ handleWidth: this.options.handleWidth,
47
+ cellMinWidth: RESIZE_MIN_WIDTH,
48
+ defaultCellMinWidth,
49
+ View: null,
50
+ lastColumnResizable: this.options.lastColumnResizable
51
+ })
52
+ ] : [],
53
+ (0, import_tables.tableEditing)({
54
+ allowTableNodeSelection: this.options.allowTableNodeSelection
55
+ })
56
+ ];
57
+ },
58
+ addNodeView() {
59
+ return ({ node, HTMLAttributes }) => {
60
+ class TiptapTableView extends import_tables.TableView {
61
+ constructor(node2, minCellWidth, containerAttributes) {
62
+ super(node2, minCellWidth);
63
+ __publicField(this, "blockContainer");
64
+ __publicField(this, "innerTableContainer");
65
+ __publicField(this, "widgetsContainer");
66
+ __publicField(this, "overlayContainer");
67
+ __publicField(this, "containerAttributes");
68
+ this.containerAttributes = containerAttributes != null ? containerAttributes : {};
69
+ this.blockContainer = this.createBlockContainer();
70
+ this.innerTableContainer = this.createInnerTableContainer();
71
+ this.widgetsContainer = this.createWidgetsContainer();
72
+ this.overlayContainer = this.createOverlayContainer();
73
+ this.setupDOMStructure();
74
+ }
75
+ createBlockContainer() {
76
+ const container = document.createElement("div");
77
+ container.setAttribute("data-content-type", "table");
78
+ container.style.position = "relative";
79
+ this.applyContainerAttributes(container);
80
+ return container;
81
+ }
82
+ createInnerTableContainer() {
83
+ const container = document.createElement("div");
84
+ container.className = "table-container";
85
+ return container;
86
+ }
87
+ createWidgetsContainer() {
88
+ const container = document.createElement("div");
89
+ container.className = "table-controls";
90
+ container.style.position = "absolute";
91
+ container.style.inset = "0";
92
+ container.style.pointerEvents = "none";
93
+ return container;
94
+ }
95
+ createOverlayContainer() {
96
+ const container = document.createElement("div");
97
+ container.className = "table-selection-overlay-container";
98
+ container.style.position = "absolute";
99
+ container.style.inset = "0";
100
+ container.style.pointerEvents = "none";
101
+ return container;
102
+ }
103
+ applyContainerAttributes(element) {
104
+ Object.entries(this.containerAttributes).forEach(([key, value]) => {
105
+ if (key !== "class") {
106
+ element.setAttribute(key, value);
107
+ }
108
+ });
109
+ }
110
+ setupDOMStructure() {
111
+ const originalTable = this.dom;
112
+ const tableElement = originalTable.firstChild;
113
+ if (tableElement) {
114
+ this.innerTableContainer.appendChild(tableElement);
115
+ }
116
+ originalTable.appendChild(this.innerTableContainer);
117
+ this.blockContainer.appendChild(originalTable);
118
+ this.blockContainer.appendChild(this.widgetsContainer);
119
+ this.blockContainer.appendChild(this.overlayContainer);
120
+ this.dom = this.blockContainer;
121
+ }
122
+ ignoreMutation(mutation) {
123
+ const target = mutation.target;
124
+ if (!target.closest(".table-container")) {
125
+ return true;
126
+ }
127
+ return super.ignoreMutation(mutation);
128
+ }
129
+ }
130
+ const cellMinWidth = this.options.cellMinWidth < EMPTY_CELL_WIDTH ? EMPTY_CELL_WIDTH : this.options.cellMinWidth;
131
+ return new TiptapTableView(node, cellMinWidth, HTMLAttributes);
132
+ };
133
+ }
134
+ });
135
+ // Annotate the CommonJS export names for ESM import in node:
136
+ 0 && (module.exports = {
137
+ Table
138
+ });
@@ -0,0 +1,9 @@
1
+ "use client";
2
+ import {
3
+ Table
4
+ } from "../chunk-IRJ6RAVQ.mjs";
5
+ import "../chunk-PTX5UYV6.mjs";
6
+ import "../chunk-WKV76XOR.mjs";
7
+ export {
8
+ Table
9
+ };
@@ -0,0 +1,5 @@
1
+ import { Editor } from '@tiptap/react';
2
+
3
+ declare function useResizeOverlay(editor: Editor | null, updateSelectionRect: () => void): void;
4
+
5
+ export { useResizeOverlay };
@@ -0,0 +1,5 @@
1
+ import { Editor } from '@tiptap/react';
2
+
3
+ declare function useResizeOverlay(editor: Editor | null, updateSelectionRect: () => void): void;
4
+
5
+ export { useResizeOverlay };
@@ -0,0 +1,83 @@
1
+ "use client";
2
+ "use strict";
3
+ "use client";
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
21
+
22
+ // src/hooks/use-resize-overlay.ts
23
+ var use_resize_overlay_exports = {};
24
+ __export(use_resize_overlay_exports, {
25
+ useResizeOverlay: () => useResizeOverlay
26
+ });
27
+ module.exports = __toCommonJS(use_resize_overlay_exports);
28
+ var import_tables = require("@tiptap/pm/tables");
29
+ var import_react = require("react");
30
+ function useResizeOverlay(editor, updateSelectionRect) {
31
+ const rafId = (0, import_react.useRef)(null);
32
+ const updateRef = (0, import_react.useRef)(updateSelectionRect);
33
+ updateRef.current = updateSelectionRect;
34
+ const stopLoop = (0, import_react.useCallback)(() => {
35
+ if (rafId.current != null) {
36
+ cancelAnimationFrame(rafId.current);
37
+ rafId.current = null;
38
+ }
39
+ }, []);
40
+ const startLoop = (0, import_react.useCallback)(() => {
41
+ if (rafId.current != null) return;
42
+ const tick = () => {
43
+ if (!(editor == null ? void 0 : editor.state)) return;
44
+ const st = import_tables.columnResizingPluginKey.getState(editor.state);
45
+ const dragging = !!(st == null ? void 0 : st.dragging);
46
+ updateRef.current();
47
+ if (dragging) {
48
+ rafId.current = requestAnimationFrame(tick);
49
+ } else {
50
+ stopLoop();
51
+ updateRef.current();
52
+ }
53
+ };
54
+ rafId.current = requestAnimationFrame(tick);
55
+ }, [editor, stopLoop]);
56
+ (0, import_react.useEffect)(() => {
57
+ if (!editor) return;
58
+ const onTx = ({ transaction }) => {
59
+ updateRef.current();
60
+ const meta = transaction.getMeta(import_tables.columnResizingPluginKey);
61
+ if (!meta) return;
62
+ if (Object.hasOwn(meta, "setDragging") && meta.setDragging) {
63
+ startLoop();
64
+ }
65
+ if (Object.hasOwn(meta, "setDragging") && meta.setDragging == null) {
66
+ stopLoop();
67
+ updateRef.current();
68
+ }
69
+ if (Object.hasOwn(meta, "setHandle")) {
70
+ updateRef.current();
71
+ }
72
+ };
73
+ editor.on("transaction", onTx);
74
+ return () => {
75
+ editor.off("transaction", onTx);
76
+ stopLoop();
77
+ };
78
+ }, [editor, startLoop, stopLoop]);
79
+ }
80
+ // Annotate the CommonJS export names for ESM import in node:
81
+ 0 && (module.exports = {
82
+ useResizeOverlay
83
+ });
@@ -0,0 +1,9 @@
1
+ "use client";
2
+ "use client";
3
+ import {
4
+ useResizeOverlay
5
+ } from "../chunk-J4VOSZCZ.mjs";
6
+ import "../chunk-WKV76XOR.mjs";
7
+ export {
8
+ useResizeOverlay
9
+ };
@@ -0,0 +1,57 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import * as _kopexa_icons from '@kopexa/icons';
3
+ import { Editor } from '@tiptap/react';
4
+ import { Orientation } from '../lib/table-utils.mjs';
5
+ import '@tiptap/pm/model';
6
+ import '@tiptap/pm/state';
7
+ import '@tiptap/pm/tables';
8
+
9
+ type RowSide = "above" | "below";
10
+ type ColSide = "left" | "right";
11
+ interface UseTableAddRowColumnConfig {
12
+ /**
13
+ * The Tiptap editor instance. If omitted, the hook will use
14
+ * the context/editor from `useTiptapEditor`.
15
+ */
16
+ editor?: Editor | null;
17
+ /**
18
+ * The index of the row or column to add relative to.
19
+ * If omitted, will use the current selection.
20
+ */
21
+ index?: number;
22
+ /**
23
+ * Whether you're adding a row or a column.
24
+ * If omitted, will use the current selection.
25
+ */
26
+ orientation?: Orientation;
27
+ /**
28
+ * The side to add on - above/below for rows, left/right for columns.
29
+ */
30
+ side: RowSide | ColSide;
31
+ /**
32
+ * The position of the table in the document.
33
+ */
34
+ tablePos?: number;
35
+ /**
36
+ * Hide the button when addition isn't currently possible.
37
+ * @default false
38
+ */
39
+ hideWhenUnavailable?: boolean;
40
+ /**
41
+ * Callback function called after a successful addition.
42
+ */
43
+ onAdded?: () => void;
44
+ }
45
+ /**
46
+ * Custom hook that provides **table row/column addition**
47
+ * functionality for the Tiptap editor.
48
+ */
49
+ declare function useTableAddRowColumn(config: UseTableAddRowColumnConfig): {
50
+ isVisible: boolean;
51
+ canAddRowColumn: boolean;
52
+ handleAdd: () => boolean;
53
+ label: string;
54
+ Icon: ({ size, ...props }: _kopexa_icons.IconSvgProps) => react_jsx_runtime.JSX.Element;
55
+ };
56
+
57
+ export { type ColSide, type RowSide, type UseTableAddRowColumnConfig, useTableAddRowColumn };
@@ -0,0 +1,57 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import * as _kopexa_icons from '@kopexa/icons';
3
+ import { Editor } from '@tiptap/react';
4
+ import { Orientation } from '../lib/table-utils.js';
5
+ import '@tiptap/pm/model';
6
+ import '@tiptap/pm/state';
7
+ import '@tiptap/pm/tables';
8
+
9
+ type RowSide = "above" | "below";
10
+ type ColSide = "left" | "right";
11
+ interface UseTableAddRowColumnConfig {
12
+ /**
13
+ * The Tiptap editor instance. If omitted, the hook will use
14
+ * the context/editor from `useTiptapEditor`.
15
+ */
16
+ editor?: Editor | null;
17
+ /**
18
+ * The index of the row or column to add relative to.
19
+ * If omitted, will use the current selection.
20
+ */
21
+ index?: number;
22
+ /**
23
+ * Whether you're adding a row or a column.
24
+ * If omitted, will use the current selection.
25
+ */
26
+ orientation?: Orientation;
27
+ /**
28
+ * The side to add on - above/below for rows, left/right for columns.
29
+ */
30
+ side: RowSide | ColSide;
31
+ /**
32
+ * The position of the table in the document.
33
+ */
34
+ tablePos?: number;
35
+ /**
36
+ * Hide the button when addition isn't currently possible.
37
+ * @default false
38
+ */
39
+ hideWhenUnavailable?: boolean;
40
+ /**
41
+ * Callback function called after a successful addition.
42
+ */
43
+ onAdded?: () => void;
44
+ }
45
+ /**
46
+ * Custom hook that provides **table row/column addition**
47
+ * functionality for the Tiptap editor.
48
+ */
49
+ declare function useTableAddRowColumn(config: UseTableAddRowColumnConfig): {
50
+ isVisible: boolean;
51
+ canAddRowColumn: boolean;
52
+ handleAdd: () => boolean;
53
+ label: string;
54
+ Icon: ({ size, ...props }: _kopexa_icons.IconSvgProps) => react_jsx_runtime.JSX.Element;
55
+ };
56
+
57
+ export { type ColSide, type RowSide, type UseTableAddRowColumnConfig, useTableAddRowColumn };