@kopexa/tiptap 1.0.0 → 2.0.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 (213) hide show
  1. package/dist/{chunk-AASYBJDX.mjs → chunk-2SI7MRAE.mjs} +1 -1
  2. package/dist/{chunk-6W7J7PHZ.mjs → chunk-B2DHYFSH.mjs} +6 -7
  3. package/dist/{chunk-RQPJU4UB.mjs → chunk-B7WJOQ3X.mjs} +1 -1
  4. package/dist/{chunk-ACWAVTTK.mjs → chunk-BEV5U2DK.mjs} +6 -6
  5. package/dist/{chunk-TGQP45HH.mjs → chunk-EHY2NAW7.mjs} +1 -3
  6. package/dist/{chunk-O5P45H3I.mjs → chunk-GYIYX2JH.mjs} +1 -1
  7. package/dist/{chunk-QCULSZRZ.mjs → chunk-IOB3REX6.mjs} +1 -3
  8. package/dist/{chunk-ILPDDC4W.mjs → chunk-IQERE7KP.mjs} +1 -4
  9. package/dist/{chunk-6SS62RYU.mjs → chunk-JNL4KY45.mjs} +1 -3
  10. package/dist/{chunk-R2RRQUU5.mjs → chunk-LHXRE26G.mjs} +2 -2
  11. package/dist/{chunk-F2HHFSM4.mjs → chunk-LNVWG34E.mjs} +1 -4
  12. package/dist/chunk-NUCXXNTA.mjs +131 -0
  13. package/dist/{chunk-GLQRF7PR.mjs → chunk-OEVR5N7X.mjs} +2 -10
  14. package/dist/{chunk-YYHNT322.mjs → chunk-OZWCQMRA.mjs} +27 -19
  15. package/dist/{chunk-OX2A52WL.mjs → chunk-Q7DFJ5NI.mjs} +2 -4
  16. package/dist/{chunk-ODBSAQ5V.mjs → chunk-QF3YHPWM.mjs} +2 -4
  17. package/dist/{chunk-R5AMMJTQ.mjs → chunk-REJEJXOZ.mjs} +3 -3
  18. package/dist/chunk-TZQQ6C2Q.mjs +101 -0
  19. package/dist/{chunk-KI3YOPAA.mjs → chunk-UJ4BNZ63.mjs} +1 -4
  20. package/dist/{chunk-4LAWYE7B.mjs → chunk-V6TAZMQN.mjs} +2 -4
  21. package/dist/{chunk-QP2LCU5N.mjs → chunk-VX3HSJ76.mjs} +2 -2
  22. package/dist/{chunk-WCBSINO5.mjs → chunk-W2FLOOJ6.mjs} +1 -1
  23. package/dist/{chunk-JHMEXFB3.mjs → chunk-WHJ4B43N.mjs} +1 -1
  24. package/dist/{chunk-YD56B5SG.mjs → chunk-WPRDVMPN.mjs} +19 -18
  25. package/dist/{chunk-44V2Y6IU.mjs → chunk-XL5FS7LN.mjs} +3 -3
  26. package/dist/{chunk-ZSYXHD7D.mjs → chunk-YJAHZXLG.mjs} +1 -4
  27. package/dist/{chunk-T7LL5ZSR.mjs → chunk-ZVTJ6XD7.mjs} +1 -3
  28. package/dist/{chunk-I7WKP3OM.mjs → chunk-ZZ4OU46C.mjs} +6 -6
  29. package/dist/context/editor-context.d.mts +4 -4
  30. package/dist/context/editor-context.d.ts +4 -4
  31. package/dist/context/editor-context.js +5 -5
  32. package/dist/context/editor-context.mjs +5 -6
  33. package/dist/extensions/link/index.mjs +0 -1
  34. package/dist/extensions/selection/index.mjs +0 -1
  35. package/dist/extensions/trailing-node/index.mjs +0 -1
  36. package/dist/extensions/ui-state/index.mjs +0 -1
  37. package/dist/hooks/use-create-editor.d.mts +16 -5
  38. package/dist/hooks/use-create-editor.d.ts +16 -5
  39. package/dist/hooks/use-create-editor.js +84 -1062
  40. package/dist/hooks/use-create-editor.mjs +5 -18
  41. package/dist/hooks/use-cursor-visibility.mjs +0 -1
  42. package/dist/hooks/use-floating-element.mjs +0 -1
  43. package/dist/hooks/use-floating-toolbar-visibility.mjs +0 -1
  44. package/dist/hooks/use-menu-navigation.mjs +0 -1
  45. package/dist/hooks/use-tiptap-editor.mjs +0 -1
  46. package/dist/hooks/use-ui-editor-state.mjs +0 -1
  47. package/dist/hooks/use-window-size.mjs +0 -1
  48. package/dist/index.d.mts +6 -5
  49. package/dist/index.d.ts +6 -5
  50. package/dist/index.js +483 -1584
  51. package/dist/index.mjs +39 -60
  52. package/dist/presets/basic/editor-header.js +112 -167
  53. package/dist/presets/basic/editor-header.mjs +25 -25
  54. package/dist/presets/basic/index.d.mts +6 -3
  55. package/dist/presets/basic/index.d.ts +6 -3
  56. package/dist/presets/basic/index.js +386 -1468
  57. package/dist/presets/basic/index.mjs +32 -46
  58. package/dist/ui/blockquote-button/blockquote-button.js +12 -67
  59. package/dist/ui/blockquote-button/blockquote-button.mjs +2 -4
  60. package/dist/ui/blockquote-button/index.js +12 -67
  61. package/dist/ui/blockquote-button/index.mjs +2 -4
  62. package/dist/ui/blockquote-button/use-blockquote.js +12 -65
  63. package/dist/ui/blockquote-button/use-blockquote.mjs +1 -3
  64. package/dist/ui/codeblock-button/code-block-button.js +13 -76
  65. package/dist/ui/codeblock-button/code-block-button.mjs +2 -4
  66. package/dist/ui/codeblock-button/index.js +13 -76
  67. package/dist/ui/codeblock-button/index.mjs +2 -4
  68. package/dist/ui/codeblock-button/use-code-block.js +12 -65
  69. package/dist/ui/codeblock-button/use-code-block.mjs +1 -3
  70. package/dist/ui/color-highlight-button/color-highlight-button.js +3 -23
  71. package/dist/ui/color-highlight-button/color-highlight-button.mjs +2 -4
  72. package/dist/ui/color-highlight-button/index.js +3 -23
  73. package/dist/ui/color-highlight-button/index.mjs +2 -4
  74. package/dist/ui/color-highlight-button/use-color-highlight.js +3 -21
  75. package/dist/ui/color-highlight-button/use-color-highlight.mjs +1 -3
  76. package/dist/ui/color-highlight-popover/color-highlight-popover.js +4 -24
  77. package/dist/ui/color-highlight-popover/color-highlight-popover.mjs +3 -5
  78. package/dist/ui/color-highlight-popover/index.js +4 -24
  79. package/dist/ui/color-highlight-popover/index.mjs +3 -5
  80. package/dist/ui/copy-anchor-link-button/use-scroll-to-hash.js +2 -18
  81. package/dist/ui/copy-anchor-link-button/use-scroll-to-hash.mjs +1 -3
  82. package/dist/ui/heading-button/index.js +2 -9
  83. package/dist/ui/heading-button/index.mjs +1 -3
  84. package/dist/ui/heading-button/utils.mjs +0 -1
  85. package/dist/ui/heading-dropdown-menu/index.js +4 -10
  86. package/dist/ui/heading-dropdown-menu/index.mjs +2 -4
  87. package/dist/ui/link-popover/index.js +2 -6
  88. package/dist/ui/link-popover/index.mjs +3 -4
  89. package/dist/ui/link-popover/link-popover.js +2 -6
  90. package/dist/ui/link-popover/link-popover.mjs +3 -4
  91. package/dist/ui/link-popover/use-link-popover.js +2 -6
  92. package/dist/ui/link-popover/use-link-popover.mjs +2 -3
  93. package/dist/ui/list-button/index.js +2 -9
  94. package/dist/ui/list-button/index.mjs +1 -3
  95. package/dist/ui/list-dropdown-menu/index.js +4 -10
  96. package/dist/ui/list-dropdown-menu/index.mjs +2 -4
  97. package/dist/ui/mark-button/index.js +3 -21
  98. package/dist/ui/mark-button/index.mjs +1 -3
  99. package/dist/ui/reset-all-formatting-button/index.mjs +0 -1
  100. package/dist/ui/reset-all-formatting-button/reset-all-formatting-button.mjs +0 -1
  101. package/dist/ui/reset-all-formatting-button/use-reset-all-formatting.mjs +0 -1
  102. package/dist/ui/slash-dropdown-menu/index.js +27 -129
  103. package/dist/ui/slash-dropdown-menu/index.mjs +3 -5
  104. package/dist/ui/slash-dropdown-menu/slash-dropdown-menu.js +27 -129
  105. package/dist/ui/slash-dropdown-menu/slash-dropdown-menu.mjs +3 -5
  106. package/dist/ui/slash-dropdown-menu/use-slash-dropdown-menu.js +23 -116
  107. package/dist/ui/slash-dropdown-menu/use-slash-dropdown-menu.mjs +2 -4
  108. package/dist/ui/suggestion-menu/index.mjs +0 -1
  109. package/dist/ui/suggestion-menu/suggestion-menu-utils.mjs +0 -1
  110. package/dist/ui/suggestion-menu/suggestion-menu.mjs +0 -1
  111. package/dist/ui/table-button/index.js +4 -24
  112. package/dist/ui/table-button/index.mjs +2 -4
  113. package/dist/ui/table-button/use-table.js +3 -21
  114. package/dist/ui/table-button/use-table.mjs +1 -3
  115. package/dist/ui/text-align-button/index.js +3 -32
  116. package/dist/ui/text-align-button/index.mjs +2 -4
  117. package/dist/ui/text-align-button/text-align-button.js +3 -32
  118. package/dist/ui/text-align-button/text-align-button.mjs +2 -4
  119. package/dist/ui/text-align-button/use-text-align.js +3 -30
  120. package/dist/ui/text-align-button/use-text-align.mjs +1 -3
  121. package/dist/ui/undo-redo-button/index.js +2 -18
  122. package/dist/ui/undo-redo-button/index.mjs +2 -4
  123. package/dist/ui/undo-redo-button/undo-redo-button.js +2 -18
  124. package/dist/ui/undo-redo-button/undo-redo-button.mjs +2 -4
  125. package/dist/ui/undo-redo-button/use-undo-redo.js +2 -16
  126. package/dist/ui/undo-redo-button/use-undo-redo.mjs +1 -3
  127. package/dist/utils/index.d.mts +1 -101
  128. package/dist/utils/index.d.ts +1 -101
  129. package/dist/utils/index.js +0 -166
  130. package/dist/utils/index.mjs +1 -28
  131. package/dist/utils/safe-parse.mjs +0 -1
  132. package/package.json +36 -30
  133. package/dist/chunk-4HTILXJM.mjs +0 -104
  134. package/dist/chunk-4IIGLBTD.mjs +0 -81
  135. package/dist/chunk-574UV65T.mjs +0 -111
  136. package/dist/chunk-7HC7D256.mjs +0 -91
  137. package/dist/chunk-AC22DSDA.mjs +0 -540
  138. package/dist/chunk-AGOMESFC.mjs +0 -1
  139. package/dist/chunk-BXPGSCTT.mjs +0 -39
  140. package/dist/chunk-C6M3CDOK.mjs +0 -254
  141. package/dist/chunk-EN3J5AMF.mjs +0 -12
  142. package/dist/chunk-HYDS6H67.mjs +0 -58
  143. package/dist/chunk-KRLE4MMD.mjs +0 -116
  144. package/dist/chunk-LKOQAQPZ.mjs +0 -13
  145. package/dist/chunk-LXZ53XU7.mjs +0 -1
  146. package/dist/chunk-T6P7CS4F.mjs +0 -42
  147. package/dist/chunk-TVFWG7IC.mjs +0 -43
  148. package/dist/chunk-VULWMVYS.mjs +0 -11
  149. package/dist/chunk-WKV76XOR.mjs +0 -8
  150. package/dist/extensions/table/index.d.mts +0 -8
  151. package/dist/extensions/table/index.d.ts +0 -8
  152. package/dist/extensions/table/index.js +0 -1044
  153. package/dist/extensions/table/index.mjs +0 -33
  154. package/dist/extensions/table/kit.d.mts +0 -30
  155. package/dist/extensions/table/kit.d.ts +0 -30
  156. package/dist/extensions/table/kit.js +0 -1034
  157. package/dist/extensions/table/kit.mjs +0 -20
  158. package/dist/extensions/table/table/icons.d.mts +0 -13
  159. package/dist/extensions/table/table/icons.d.ts +0 -13
  160. package/dist/extensions/table/table/icons.js +0 -81
  161. package/dist/extensions/table/table/icons.mjs +0 -8
  162. package/dist/extensions/table/table/index.d.mts +0 -3
  163. package/dist/extensions/table/table/index.d.ts +0 -3
  164. package/dist/extensions/table/table/index.js +0 -818
  165. package/dist/extensions/table/table/index.mjs +0 -16
  166. package/dist/extensions/table/table/table-controls.d.mts +0 -10
  167. package/dist/extensions/table/table/table-controls.d.ts +0 -10
  168. package/dist/extensions/table/table/table-controls.js +0 -129
  169. package/dist/extensions/table/table/table-controls.mjs +0 -8
  170. package/dist/extensions/table/table/table-view.d.mts +0 -43
  171. package/dist/extensions/table/table/table-view.d.ts +0 -43
  172. package/dist/extensions/table/table/table-view.js +0 -610
  173. package/dist/extensions/table/table/table-view.mjs +0 -12
  174. package/dist/extensions/table/table/table.d.mts +0 -17
  175. package/dist/extensions/table/table/table.d.ts +0 -17
  176. package/dist/extensions/table/table/table.js +0 -816
  177. package/dist/extensions/table/table/table.mjs +0 -15
  178. package/dist/extensions/table/table/utilities/col-style.d.mts +0 -3
  179. package/dist/extensions/table/table/utilities/col-style.d.ts +0 -3
  180. package/dist/extensions/table/table/utilities/col-style.js +0 -36
  181. package/dist/extensions/table/table/utilities/col-style.mjs +0 -8
  182. package/dist/extensions/table/table/utilities/delete-table-when-all-cells-selected.d.mts +0 -5
  183. package/dist/extensions/table/table/utilities/delete-table-when-all-cells-selected.d.ts +0 -5
  184. package/dist/extensions/table/table/utilities/delete-table-when-all-cells-selected.js +0 -66
  185. package/dist/extensions/table/table/utilities/delete-table-when-all-cells-selected.mjs +0 -40
  186. package/dist/extensions/table/table/utilities/get-table-node-types.d.mts +0 -7
  187. package/dist/extensions/table/table/utilities/get-table-node-types.d.ts +0 -7
  188. package/dist/extensions/table/table/utilities/get-table-node-types.js +0 -44
  189. package/dist/extensions/table/table/utilities/get-table-node-types.mjs +0 -21
  190. package/dist/extensions/table/table/utilities/insert-line-above-table-action.d.mts +0 -5
  191. package/dist/extensions/table/table/utilities/insert-line-above-table-action.d.ts +0 -5
  192. package/dist/extensions/table/table/utilities/insert-line-above-table-action.js +0 -80
  193. package/dist/extensions/table/table/utilities/insert-line-above-table-action.mjs +0 -9
  194. package/dist/extensions/table/table/utilities/insert-line-below-table-action.d.mts +0 -5
  195. package/dist/extensions/table/table/utilities/insert-line-below-table-action.d.ts +0 -5
  196. package/dist/extensions/table/table/utilities/insert-line-below-table-action.js +0 -79
  197. package/dist/extensions/table/table/utilities/insert-line-below-table-action.mjs +0 -9
  198. package/dist/extensions/table/table/utilities/is-cell-selection.d.mts +0 -5
  199. package/dist/extensions/table/table/utilities/is-cell-selection.d.ts +0 -5
  200. package/dist/extensions/table/table/utilities/is-cell-selection.js +0 -34
  201. package/dist/extensions/table/table/utilities/is-cell-selection.mjs +0 -8
  202. package/dist/extensions/table/table-cell.d.mts +0 -8
  203. package/dist/extensions/table/table-cell.d.ts +0 -8
  204. package/dist/extensions/table/table-cell.js +0 -139
  205. package/dist/extensions/table/table-cell.mjs +0 -8
  206. package/dist/extensions/table/table-header.d.mts +0 -6
  207. package/dist/extensions/table/table-header.d.ts +0 -6
  208. package/dist/extensions/table/table-header.js +0 -104
  209. package/dist/extensions/table/table-header.mjs +0 -8
  210. package/dist/extensions/table/table-row.d.mts +0 -6
  211. package/dist/extensions/table/table-row.d.ts +0 -6
  212. package/dist/extensions/table/table-row.js +0 -35
  213. package/dist/extensions/table/table-row.mjs +0 -8
@@ -1,610 +0,0 @@
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/table/table-view.tsx
24
- var table_view_exports = {};
25
- __export(table_view_exports, {
26
- TableView: () => TableView,
27
- updateColumns: () => updateColumns
28
- });
29
- module.exports = __toCommonJS(table_view_exports);
30
- var import_dom = require("@floating-ui/dom");
31
- var import_tables = require("@tiptap/pm/tables");
32
- var import_jsx_dom_cjs = require("jsx-dom-cjs");
33
-
34
- // src/extensions/table/table/icons.ts
35
- var icons = {
36
- colorPicker: `<svg xmlns="http://www.w3.org/2000/svg" length="24" viewBox="0 0 24 24" style="transform: ;msFilter:;"><path fill="rgb(var(--color-text-300))" d="M20 14c-.092.064-2 2.083-2 3.5 0 1.494.949 2.448 2 2.5.906.044 2-.891 2-2.5 0-1.5-1.908-3.436-2-3.5zM9.586 20c.378.378.88.586 1.414.586s1.036-.208 1.414-.586l7-7-.707-.707L11 4.586 8.707 2.293 7.293 3.707 9.586 6 4 11.586c-.378.378-.586.88-.586 1.414s.208 1.036.586 1.414L9.586 20zM11 7.414 16.586 13H5.414L11 7.414z"></path></svg>`,
37
- deleteColumn: `<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-trash-2"><path d="M3 6h18"/><path d="M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"/><path d="M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"/><line x1="10" x2="10" y1="11" y2="17"/><line x1="14" x2="14" y1="11" y2="17"/></svg>`,
38
- deleteRow: `<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-trash-2"><path d="M3 6h18"/><path d="M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"/><path d="M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"/><line x1="10" x2="10" y1="11" y2="17"/><line x1="14" x2="14" y1="11" y2="17"/></svg>`,
39
- insertLeftTableIcon: `<svg
40
- xmlns="http://www.w3.org/2000/svg"
41
- length={12}
42
- viewBox="0 -960 960 960"
43
- >
44
- <path
45
- d="M224.617-140.001q-30.307 0-51.307-21-21-21-21-51.308v-535.382q0-30.308 21-51.308t51.307-21H360q30.307 0 51.307 21 21 21 21 51.308v535.382q0 30.308-21 51.308t-51.307 21H224.617Zm375.383 0q-30.307 0-51.307-21-21-21-21-51.308v-535.382q0-30.308 21-51.308t51.307-21h135.383q30.307 0 51.307 21 21 21 21 51.308v535.382q0 30.308-21 51.308t-51.307 21H600Zm147.691-607.69q0-4.616-3.846-8.463-3.846-3.846-8.462-3.846H600q-4.616 0-8.462 3.846-3.847 3.847-3.847 8.463v535.382q0 4.616 3.847 8.463Q595.384-200 600-200h135.383q4.616 0 8.462-3.846 3.846-3.847 3.846-8.463v-535.382ZM587.691-200h160-160Z"
46
- fill="rgb(var(--color-text-300))"
47
- />
48
- </svg>
49
- `,
50
- insertRightTableIcon: `<svg
51
- xmlns="http://www.w3.org/2000/svg"
52
- length={12}
53
- viewBox="0 -960 960 960"
54
- >
55
- <path
56
- d="M600-140.001q-30.307 0-51.307-21-21-21-21-51.308v-535.382q0-30.308 21-51.308t51.307-21h135.383q30.307 0 51.307 21 21 21 21 51.308v535.382q0 30.308-21 51.308t-51.307 21H600Zm-375.383 0q-30.307 0-51.307-21-21-21-21-51.308v-535.382q0-30.308 21-51.308t51.307-21H360q30.307 0 51.307 21 21 21 21 51.308v535.382q0 30.308-21 51.308t-51.307 21H224.617Zm-12.308-607.69v535.382q0 4.616 3.846 8.463 3.846 3.846 8.462 3.846H360q4.616 0 8.462-3.846 3.847-3.847 3.847-8.463v-535.382q0-4.616-3.847-8.463Q364.616-760 360-760H224.617q-4.616 0-8.462 3.846-3.846 3.847-3.846 8.463Zm160 547.691h-160 160Z"
57
- fill="rgb(var(--color-text-300))"
58
- />
59
- </svg>
60
- `,
61
- insertTopTableIcon: `<svg
62
- xmlns="http://www.w3.org/2000/svg"
63
- length={24}
64
- viewBox="0 -960 960 960"
65
- >
66
- <path
67
- d="M212.309-527.693q-30.308 0-51.308-21t-21-51.307v-135.383q0-30.307 21-51.307 21-21 51.308-21h535.382q30.308 0 51.308 21t21 51.307V-600q0 30.307-21 51.307-21 21-51.308 21H212.309Zm0 375.383q-30.308 0-51.308-21t-21-51.307V-360q0-30.307 21-51.307 21-21 51.308-21h535.382q30.308 0 51.308 21t21 51.307v135.383q0 30.307-21 51.307-21 21-51.308 21H212.309Zm0-59.999h535.382q4.616 0 8.463-3.846 3.846-3.846 3.846-8.462V-360q0-4.616-3.846-8.462-3.847-3.847-8.463-3.847H212.309q-4.616 0-8.463 3.847Q200-364.616 200-360v135.383q0 4.616 3.846 8.462 3.847 3.846 8.463 3.846Zm-12.309-160v160-160Z"
68
- fill="rgb(var(--color-text-300))"
69
- />
70
- </svg>
71
- `,
72
- toggleColumnHeader: `<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-toggle-right"><rect width="20" height="12" x="2" y="6" rx="6" ry="6"/><circle cx="16" cy="12" r="2"/></svg>`,
73
- toggleRowHeader: `<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-toggle-right"><rect width="20" height="12" x="2" y="6" rx="6" ry="6"/><circle cx="16" cy="12" r="2"/></svg>`,
74
- insertBottomTableIcon: `<svg
75
- xmlns="http://www.w3.org/2000/svg"
76
- length={24}
77
- viewBox="0 -960 960 960"
78
- >
79
- <path
80
- d="M212.309-152.31q-30.308 0-51.308-21t-21-51.307V-360q0-30.307 21-51.307 21-21 51.308-21h535.382q30.308 0 51.308 21t21 51.307v135.383q0 30.307-21 51.307-21 21-51.308 21H212.309Zm0-375.383q-30.308 0-51.308-21t-21-51.307v-135.383q0-30.307 21-51.307 21-21 51.308-21h535.382q30.308 0 51.308 21t21 51.307V-600q0 30.307-21 51.307-21 21-51.308 21H212.309Zm535.382-219.998H212.309q-4.616 0-8.463 3.846-3.846 3.846-3.846 8.462V-600q0 4.616 3.846 8.462 3.847 3.847 8.463 3.847h535.382q4.616 0 8.463-3.847Q760-595.384 760-600v-135.383q0-4.616-3.846-8.462-3.847-3.846-8.463-3.846ZM200-587.691v-160 160Z"
81
- fill="rgb(var(--color-text-300))"
82
- />
83
- </svg>
84
- `
85
- };
86
-
87
- // src/extensions/table/table/utilities/col-style.ts
88
- function getColStyleDeclaration(minWidth, width) {
89
- if (width) {
90
- return ["width", `${Math.max(width, minWidth)}px`];
91
- }
92
- return ["min-width", `${minWidth}px`];
93
- }
94
-
95
- // src/extensions/table/table/table-view.tsx
96
- var Popover = class {
97
- constructor(content, opts) {
98
- __publicField(this, "reference");
99
- __publicField(this, "floating");
100
- __publicField(this, "cleanupAutoUpdate", null);
101
- __publicField(this, "onDocClick", (e) => {
102
- if (!this.floating.contains(e.target) && !this.reference.contains(e.target)) {
103
- this.hide();
104
- }
105
- });
106
- __publicField(this, "onEsc", (e) => {
107
- if (e.key === "Escape") this.hide();
108
- });
109
- __publicField(this, "_placement");
110
- __publicField(this, "_offsetPx");
111
- // biome-ignore lint/correctness/noUnusedPrivateClassMembers: backwards. will be used later
112
- __publicField(this, "_interactive");
113
- var _a, _b, _c, _d;
114
- this.reference = opts.reference;
115
- this.floating = document.createElement("div");
116
- this.floating.setAttribute("role", "dialog");
117
- this.floating.setAttribute("aria-modal", "false");
118
- this.floating.style.position = "fixed";
119
- this.floating.style.zIndex = "9999";
120
- this.floating.style.display = "none";
121
- this.floating.className = "rounded-md border bg-background px-2 py-2.5 text-xs shadow-sm min-w-[12rem] whitespace-nowrap";
122
- this.floating.appendChild(content);
123
- const host = (_a = opts.container) != null ? _a : document.body;
124
- host.appendChild(this.floating);
125
- this._placement = (_b = opts.placement) != null ? _b : "right";
126
- this._offsetPx = (_c = opts.offsetPx) != null ? _c : 6;
127
- this._interactive = (_d = opts.interactive) != null ? _d : true;
128
- }
129
- async _updatePosition() {
130
- const { x, y } = await (0, import_dom.computePosition)(this.reference, this.floating, {
131
- placement: this._placement,
132
- middleware: [(0, import_dom.offset)(this._offsetPx), (0, import_dom.flip)(), (0, import_dom.shift)({ padding: 8 })]
133
- });
134
- Object.assign(this.floating.style, { left: `${x}px`, top: `${y}px` });
135
- }
136
- show() {
137
- if (this.floating.style.display !== "none") return;
138
- this.floating.style.display = "block";
139
- this.cleanupAutoUpdate = (0, import_dom.autoUpdate)(
140
- this.reference,
141
- this.floating,
142
- () => this._updatePosition()
143
- );
144
- document.addEventListener("keydown", this.onEsc, { passive: true });
145
- document.addEventListener("mousedown", this.onDocClick, { capture: true });
146
- requestAnimationFrame(() => this._updatePosition());
147
- }
148
- hide() {
149
- var _a;
150
- if (this.floating.style.display === "none") return;
151
- this.floating.style.display = "none";
152
- (_a = this.cleanupAutoUpdate) == null ? void 0 : _a.call(this);
153
- this.cleanupAutoUpdate = null;
154
- document.removeEventListener("keydown", this.onEsc);
155
- document.removeEventListener("mousedown", this.onDocClick, {
156
- capture: true
157
- });
158
- }
159
- toggle() {
160
- if (this.floating.style.display === "none") this.show();
161
- else this.hide();
162
- }
163
- destroy() {
164
- this.hide();
165
- this.floating.remove();
166
- }
167
- get el() {
168
- return this.floating;
169
- }
170
- };
171
- function updateColumns(node, colgroup, table, cellMinWidth, overrideCol, overrideValue) {
172
- var _a;
173
- let totalWidth = 0;
174
- let fixedWidth = true;
175
- let nextDOM = colgroup.firstChild;
176
- const row = node.firstChild;
177
- if (row !== null) {
178
- for (let i = 0, col = 0; i < row.childCount; i += 1) {
179
- const { colspan, colwidth } = row.child(i).attrs;
180
- for (let j = 0; j < colspan; j += 1, col += 1) {
181
- const hasWidth = overrideCol === col ? overrideValue : colwidth == null ? void 0 : colwidth[j];
182
- const cssWidth = hasWidth ? `${hasWidth}px` : "";
183
- totalWidth += hasWidth || cellMinWidth;
184
- if (!hasWidth) fixedWidth = false;
185
- if (!nextDOM) {
186
- const colElement = document.createElement("col");
187
- const [key, val] = getColStyleDeclaration(cellMinWidth, hasWidth);
188
- colElement.style.setProperty(key, val);
189
- colgroup.appendChild(colElement);
190
- } else {
191
- const colEl = nextDOM;
192
- if (colEl.style.width !== cssWidth) {
193
- const [key, val] = getColStyleDeclaration(cellMinWidth, hasWidth);
194
- colEl.style.setProperty(key, val);
195
- }
196
- nextDOM = nextDOM.nextSibling;
197
- }
198
- }
199
- }
200
- }
201
- while (nextDOM) {
202
- const after = nextDOM.nextSibling;
203
- (_a = nextDOM.parentNode) == null ? void 0 : _a.removeChild(nextDOM);
204
- nextDOM = after;
205
- }
206
- if (fixedWidth) {
207
- table.style.width = `${totalWidth}px`;
208
- table.style.minWidth = "";
209
- } else {
210
- table.style.width = "";
211
- table.style.minWidth = `${totalWidth}px`;
212
- }
213
- }
214
- function setCellsBackgroundColor(editor, color) {
215
- return editor.chain().focus().updateAttributes("tableCell", {
216
- background: color.backgroundColor,
217
- textColor: color.textColor
218
- }).run();
219
- }
220
- function setTableRowBackgroundColor(editor, color) {
221
- const { state, dispatch } = editor.view;
222
- const { selection } = state;
223
- if (!(selection instanceof import_tables.CellSelection)) return false;
224
- const hoveredCell = selection.$headCell || selection.$anchorCell;
225
- let rowDepth = hoveredCell.depth;
226
- while (rowDepth > 0 && hoveredCell.node(rowDepth).type.name !== "tableRow") {
227
- rowDepth--;
228
- }
229
- if (hoveredCell.node(rowDepth).type.name !== "tableRow") return false;
230
- const rowStartPos = hoveredCell.start(rowDepth);
231
- const tr = state.tr.setNodeMarkup(rowStartPos - 1, null, {
232
- ...hoveredCell.node(rowDepth).attrs,
233
- background: color.backgroundColor,
234
- textColor: color.textColor
235
- });
236
- dispatch(tr);
237
- return true;
238
- }
239
- var columnsToolboxItems = [
240
- {
241
- label: "Toggle column header",
242
- icon: icons.toggleColumnHeader,
243
- action: ({ editor }) => editor.chain().focus().toggleHeaderColumn().run()
244
- },
245
- {
246
- label: "Add column before",
247
- icon: icons.insertLeftTableIcon,
248
- action: ({ editor }) => editor.chain().focus().addColumnBefore().run()
249
- },
250
- {
251
- label: "Add column after",
252
- icon: icons.insertRightTableIcon,
253
- action: ({ editor }) => editor.chain().focus().addColumnAfter().run()
254
- },
255
- { label: "Pick color", icon: "", action: () => {
256
- } },
257
- {
258
- label: "Delete column",
259
- icon: icons.deleteColumn,
260
- action: ({ editor }) => editor.chain().focus().deleteColumn().run()
261
- }
262
- ];
263
- var rowsToolboxItems = [
264
- {
265
- label: "Toggle row header",
266
- icon: icons.toggleRowHeader,
267
- action: ({ editor }) => editor.chain().focus().toggleHeaderRow().run()
268
- },
269
- {
270
- label: "Add row above",
271
- icon: icons.insertTopTableIcon,
272
- action: ({ editor }) => editor.chain().focus().addRowBefore().run()
273
- },
274
- {
275
- label: "Add row below",
276
- icon: icons.insertBottomTableIcon,
277
- action: ({ editor }) => editor.chain().focus().addRowAfter().run()
278
- },
279
- { label: "Pick color", icon: "", action: () => {
280
- } },
281
- {
282
- label: "Delete row",
283
- icon: icons.deleteRow,
284
- action: ({ editor }) => editor.chain().focus().deleteRow().run()
285
- }
286
- ];
287
- function buildToolboxContent({
288
- items,
289
- onClickItem,
290
- onSelectColor,
291
- colors
292
- }) {
293
- return (0, import_jsx_dom_cjs.h)(
294
- "div",
295
- { className: "space-y-2" },
296
- items.map((item) => {
297
- if (item.label === "Pick color") {
298
- return (0, import_jsx_dom_cjs.h)("div", { className: "flex flex-col" }, [
299
- (0, import_jsx_dom_cjs.h)("hr", { className: "!my-2 border" }),
300
- (0, import_jsx_dom_cjs.h)("div", { className: "text-foreground text-sm" }, item.label),
301
- (0, import_jsx_dom_cjs.h)(
302
- "div",
303
- { className: "grid grid-cols-6 gap-x-1 gap-y-2.5 mt-2" },
304
- Object.entries(colors).map(
305
- ([_, colorValue]) => {
306
- var _a;
307
- return (0, import_jsx_dom_cjs.h)("button", {
308
- // @ts-expect-error JSX
309
- type: "button",
310
- className: "grid place-items-center size-6 rounded outline-none ring-offset-2 focus-visible:ring",
311
- style: `background-color:${colorValue.backgroundColor};color:${colorValue.textColor || "inherit"};`,
312
- innerHTML: (_a = colorValue.icon) != null ? _a : `<span class="text-md" style="color:${colorValue.textColor || "inherit"}">A</span>`,
313
- onClick: (e) => {
314
- e.stopPropagation();
315
- onSelectColor(colorValue);
316
- }
317
- });
318
- }
319
- )
320
- ),
321
- (0, import_jsx_dom_cjs.h)("hr", { className: "!my-2 border" })
322
- ]);
323
- }
324
- return (0, import_jsx_dom_cjs.h)(
325
- "button",
326
- {
327
- // @ts-expect-error JSX
328
- type: "button",
329
- className: "w-full flex items-center gap-2 px-1 py-1.5 bg-background hover:bg-muted text-sm text-foreground rounded",
330
- onClick: (e) => {
331
- e.stopPropagation();
332
- onClickItem(item);
333
- }
334
- },
335
- [
336
- (0, import_jsx_dom_cjs.h)("span", { className: "h-3 w-3 shrink-0", innerHTML: item.icon }),
337
- (0, import_jsx_dom_cjs.h)("div", { className: "label" }, item.label)
338
- ]
339
- );
340
- })
341
- );
342
- }
343
- function createToolbox({
344
- triggerButton,
345
- items,
346
- onSelectColor,
347
- onClickItem,
348
- colors,
349
- appendTo
350
- }) {
351
- if (!triggerButton) {
352
- return null;
353
- }
354
- const content = buildToolboxContent({
355
- items,
356
- onClickItem,
357
- onSelectColor,
358
- colors
359
- });
360
- const pop = new Popover(content, {
361
- reference: triggerButton,
362
- container: appendTo != null ? appendTo : void 0,
363
- placement: "right",
364
- offsetPx: 6,
365
- interactive: true
366
- });
367
- const onTrigger = (e) => {
368
- e.stopPropagation();
369
- pop.toggle();
370
- };
371
- triggerButton.addEventListener("click", onTrigger);
372
- return {
373
- show: () => pop.show(),
374
- hide: () => pop.hide(),
375
- destroy: () => {
376
- pop.destroy();
377
- triggerButton.removeEventListener("click", onTrigger);
378
- }
379
- };
380
- }
381
- var TableView = class {
382
- constructor(node, cellMinWidth, decorations, editor, getPos) {
383
- __publicField(this, "node");
384
- __publicField(this, "cellMinWidth");
385
- __publicField(this, "decorations");
386
- __publicField(this, "editor");
387
- __publicField(this, "getPos");
388
- __publicField(this, "hoveredCell", null);
389
- __publicField(this, "map");
390
- __publicField(this, "root");
391
- __publicField(this, "table");
392
- __publicField(this, "colgroup");
393
- __publicField(this, "tbody");
394
- __publicField(this, "rowsControl");
395
- __publicField(this, "columnsControl");
396
- __publicField(this, "columnsToolbox");
397
- __publicField(this, "rowsToolbox");
398
- __publicField(this, "controls");
399
- var _a, _b, _c, _d;
400
- this.node = node;
401
- this.cellMinWidth = cellMinWidth;
402
- this.decorations = decorations.slice();
403
- this.editor = editor;
404
- this.getPos = getPos;
405
- this.hoveredCell = null;
406
- this.map = import_tables.TableMap.get(node);
407
- if (editor.isEditable) {
408
- this.rowsControl = (0, import_jsx_dom_cjs.h)(
409
- "div",
410
- { className: "rows-control" },
411
- (0, import_jsx_dom_cjs.h)("button", {
412
- // @ts-expect-error JSX
413
- type: "button",
414
- className: "rows-control-div",
415
- onClick: () => this.selectRow(),
416
- "aria-label": "Row actions"
417
- })
418
- );
419
- this.columnsControl = (0, import_jsx_dom_cjs.h)(
420
- "div",
421
- { className: "columns-control" },
422
- (0, import_jsx_dom_cjs.h)("button", {
423
- // @ts-expect-error JSX
424
- type: "button",
425
- className: "columns-control-div",
426
- onClick: () => this.selectColumn(),
427
- "aria-label": "Column actions"
428
- })
429
- );
430
- this.controls = (0, import_jsx_dom_cjs.h)(
431
- "div",
432
- { className: "table-controls", contentEditable: "false" },
433
- this.rowsControl,
434
- this.columnsControl
435
- );
436
- const palette = {
437
- Blue: { backgroundColor: "#D9E4FF", textColor: "#171717" },
438
- Orange: { backgroundColor: "#FFEDD5", textColor: "#171717" },
439
- Grey: { backgroundColor: "#F1F1F1", textColor: "#171717" },
440
- Yellow: { backgroundColor: "#FEF3C7", textColor: "#171717" },
441
- Green: { backgroundColor: "#DCFCE7", textColor: "#171717" },
442
- Red: { backgroundColor: "#FFDDDD", textColor: "#171717" },
443
- Pink: { backgroundColor: "#FFE8FA", textColor: "#171717" },
444
- Purple: { backgroundColor: "#E8DAFB", textColor: "#171717" },
445
- None: {
446
- backgroundColor: "transparent",
447
- textColor: "inherit",
448
- icon: `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="gray" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-ban"><circle cx="12" cy="12" r="10"/><path d="m4.9 4.9 14.2 14.2"/></svg>`
449
- }
450
- };
451
- this.columnsToolbox = createToolbox({
452
- triggerButton: (_a = this.columnsControl) == null ? void 0 : _a.querySelector(
453
- ".columns-control-div"
454
- ),
455
- items: columnsToolboxItems,
456
- colors: palette,
457
- appendTo: (_b = this.controls) != null ? _b : null,
458
- onSelectColor: (color) => setCellsBackgroundColor(this.editor, color),
459
- onClickItem: (item) => {
460
- var _a2, _b2;
461
- item.action({
462
- editor: this.editor,
463
- triggerButton: (_a2 = this.columnsControl) == null ? void 0 : _a2.firstElementChild,
464
- controlsContainer: this.controls
465
- });
466
- (_b2 = this.columnsToolbox) == null ? void 0 : _b2.hide();
467
- }
468
- });
469
- this.rowsToolbox = createToolbox({
470
- triggerButton: (_c = this.rowsControl) == null ? void 0 : _c.querySelector(
471
- ".rows-control-div"
472
- ),
473
- items: rowsToolboxItems,
474
- colors: palette,
475
- appendTo: (_d = this.controls) != null ? _d : null,
476
- onSelectColor: (color) => setTableRowBackgroundColor(editor, color),
477
- onClickItem: (item) => {
478
- var _a2, _b2;
479
- item.action({
480
- editor: this.editor,
481
- triggerButton: (_a2 = this.rowsControl) == null ? void 0 : _a2.firstElementChild,
482
- controlsContainer: this.controls
483
- });
484
- (_b2 = this.rowsToolbox) == null ? void 0 : _b2.hide();
485
- }
486
- });
487
- }
488
- this.colgroup = (0, import_jsx_dom_cjs.h)(
489
- "colgroup",
490
- null,
491
- Array.from({ length: this.map.width }, () => 1).map(() => (0, import_jsx_dom_cjs.h)("col"))
492
- );
493
- this.tbody = (0, import_jsx_dom_cjs.h)("tbody");
494
- this.table = (0, import_jsx_dom_cjs.h)(
495
- "table",
496
- null,
497
- this.colgroup,
498
- this.tbody
499
- );
500
- this.root = (0, import_jsx_dom_cjs.h)(
501
- "div",
502
- {
503
- className: "table-wrapper horizontal-scrollbar scrollbar-md controls--disabled"
504
- },
505
- this.controls,
506
- this.table
507
- );
508
- this.render();
509
- }
510
- get dom() {
511
- return this.root;
512
- }
513
- get contentDOM() {
514
- return this.tbody;
515
- }
516
- update(node, decorations) {
517
- if (node.type !== this.node.type) return false;
518
- this.node = node;
519
- this.decorations = [...decorations];
520
- this.map = import_tables.TableMap.get(this.node);
521
- if (this.editor.isEditable) this.updateControls();
522
- this.render();
523
- return true;
524
- }
525
- render() {
526
- if (this.colgroup.children.length !== this.map.width) {
527
- const cols = Array.from({ length: this.map.width }, () => 1).map(
528
- () => (0, import_jsx_dom_cjs.h)("col")
529
- );
530
- this.colgroup.replaceChildren(...cols);
531
- }
532
- (0, import_tables.updateColumnsOnResize)(
533
- this.node,
534
- this.colgroup,
535
- this.table,
536
- this.cellMinWidth
537
- );
538
- }
539
- ignoreMutation() {
540
- return true;
541
- }
542
- updateControls() {
543
- var _a;
544
- const { hoveredTable: table, hoveredCell: cell } = Object.values(
545
- this.decorations
546
- ).reduce(
547
- (acc, curr) => {
548
- if (curr.spec.hoveredCell !== void 0)
549
- acc.hoveredCell = curr.spec.hoveredCell;
550
- if (curr.spec.hoveredTable !== void 0)
551
- acc.hoveredTable = curr.spec.hoveredTable;
552
- return acc;
553
- },
554
- {}
555
- );
556
- if (table === void 0 || cell === void 0) {
557
- this.root.classList.add("controls--disabled");
558
- return;
559
- }
560
- this.root.classList.remove("controls--disabled");
561
- this.hoveredCell = cell;
562
- const cellDom = this.editor.view.nodeDOM(cell.pos);
563
- if (!this.table || !cellDom) return;
564
- const tableRect = this.table.getBoundingClientRect();
565
- const cellRect = cellDom.getBoundingClientRect();
566
- if (this.columnsControl) {
567
- this.columnsControl.style.left = `${cellRect.left - tableRect.left - (((_a = this.table.parentElement) == null ? void 0 : _a.scrollLeft) || 0)}px`;
568
- this.columnsControl.style.width = `${cellRect.width}px`;
569
- }
570
- if (this.rowsControl) {
571
- this.rowsControl.style.top = `${cellRect.top - tableRect.top}px`;
572
- this.rowsControl.style.height = `${cellRect.height}px`;
573
- }
574
- }
575
- selectColumn() {
576
- if (!this.hoveredCell) return;
577
- const colIndex = this.map.colCount(
578
- this.hoveredCell.pos - (this.getPos() + 1)
579
- );
580
- const anchorCellPos = this.hoveredCell.pos;
581
- const headCellPos = this.map.map[colIndex + this.map.width * (this.map.height - 1)] + (this.getPos() + 1);
582
- const cellSelection = import_tables.CellSelection.create(
583
- this.editor.view.state.doc,
584
- anchorCellPos,
585
- headCellPos
586
- );
587
- this.editor.view.dispatch(this.editor.state.tr.setSelection(cellSelection));
588
- }
589
- selectRow() {
590
- if (!this.hoveredCell) return;
591
- const anchorCellPos = this.hoveredCell.pos;
592
- const anchorCellIndex = this.map.map.indexOf(
593
- anchorCellPos - (this.getPos() + 1)
594
- );
595
- const headCellPos = this.map.map[anchorCellIndex + (this.map.width - 1)] + (this.getPos() + 1);
596
- const cellSelection = import_tables.CellSelection.create(
597
- this.editor.state.doc,
598
- anchorCellPos,
599
- headCellPos
600
- );
601
- this.editor.view.dispatch(
602
- this.editor.view.state.tr.setSelection(cellSelection)
603
- );
604
- }
605
- };
606
- // Annotate the CommonJS export names for ESM import in node:
607
- 0 && (module.exports = {
608
- TableView,
609
- updateColumns
610
- });
@@ -1,12 +0,0 @@
1
- "use client";
2
- import {
3
- TableView,
4
- updateColumns
5
- } from "../../../chunk-AC22DSDA.mjs";
6
- import "../../../chunk-LKOQAQPZ.mjs";
7
- import "../../../chunk-HYDS6H67.mjs";
8
- import "../../../chunk-WKV76XOR.mjs";
9
- export {
10
- TableView,
11
- updateColumns
12
- };
@@ -1,17 +0,0 @@
1
- import * as _tiptap_core from '@tiptap/core';
2
- import { ParentConfig } from '@tiptap/core';
3
- import * as _tiptap_extension_table from '@tiptap/extension-table';
4
-
5
- declare module "@tiptap/core" {
6
- interface NodeConfig<Options, Storage> {
7
- tableRole?: string | ((this: {
8
- name: string;
9
- options: Options;
10
- storage: Storage;
11
- parent: ParentConfig<NodeConfig<Options>>["tableRole"];
12
- }) => string);
13
- }
14
- }
15
- declare const Table: _tiptap_core.Node<_tiptap_extension_table.TableOptions, any>;
16
-
17
- export { Table };
@@ -1,17 +0,0 @@
1
- import * as _tiptap_core from '@tiptap/core';
2
- import { ParentConfig } from '@tiptap/core';
3
- import * as _tiptap_extension_table from '@tiptap/extension-table';
4
-
5
- declare module "@tiptap/core" {
6
- interface NodeConfig<Options, Storage> {
7
- tableRole?: string | ((this: {
8
- name: string;
9
- options: Options;
10
- storage: Storage;
11
- parent: ParentConfig<NodeConfig<Options>>["tableRole"];
12
- }) => string);
13
- }
14
- }
15
- declare const Table: _tiptap_core.Node<_tiptap_extension_table.TableOptions, any>;
16
-
17
- export { Table };