@threadlabs/looma 0.1.5 → 0.1.7

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 (62) hide show
  1. package/README.md +5 -4
  2. package/dist/{chunk-3PASQ7DE.js → chunk-UMFO4QNN.js} +26 -26
  3. package/dist/cjs/loader.cjs.js +1 -1
  4. package/dist/cjs/looma.cjs.js +1 -1
  5. package/dist/cjs/ui-dialog.cjs.entry.js +3 -1
  6. package/dist/collection/components/ui-dialog/ui-dialog.js +22 -1
  7. package/dist/components/ui-dialog.js +1 -1
  8. package/dist/esm/loader.js +1 -1
  9. package/dist/esm/looma.js +1 -1
  10. package/dist/esm/ui-dialog.entry.js +3 -1
  11. package/dist/index.cjs +4 -2
  12. package/dist/index.js +2 -2
  13. package/dist/looma/looma.esm.js +1 -1
  14. package/dist/looma/p-5df568d8.entry.js +1 -0
  15. package/dist/types/components/ui-dialog/ui-dialog.d.ts +2 -0
  16. package/dist/types/components.d.ts +9 -0
  17. package/dist/{ui-avatar-group.entry-DBVLQ4KB.js → ui-avatar-group.entry-S6DFXYB7.js} +1 -1
  18. package/dist/{ui-avatar.entry-2WTBM2EC.js → ui-avatar.entry-MDRGXLWQ.js} +1 -1
  19. package/dist/{ui-badge.entry-XKIGBK5V.js → ui-badge.entry-RLL4YKPD.js} +1 -1
  20. package/dist/{ui-button.entry-PWT56MPD.js → ui-button.entry-IYMYLBFY.js} +1 -1
  21. package/dist/{ui-checkbox.entry-QT5S7EEL.js → ui-checkbox.entry-K5FGWDG2.js} +1 -1
  22. package/dist/{ui-context-menu.entry-NGWR3LOZ.js → ui-context-menu.entry-KWXXJ3ZV.js} +1 -1
  23. package/dist/{ui-dialog.entry-PEDDIALQ.js → ui-dialog.entry-RKHLQLQM.js} +4 -2
  24. package/dist/{ui-disclosure.entry-UKO7MAZM.js → ui-disclosure.entry-FRZKGEJP.js} +1 -1
  25. package/dist/{ui-floating-action-button.entry-SSGHRMCO.js → ui-floating-action-button.entry-BH4FDSTL.js} +1 -1
  26. package/dist/{ui-form-field.entry-6TZCWPYL.js → ui-form-field.entry-3CR2KSUH.js} +1 -1
  27. package/dist/{ui-icon-button.entry-WMCYMK2H.js → ui-icon-button.entry-LB54U25M.js} +1 -1
  28. package/dist/{ui-input.entry-AZ5BGQNA.js → ui-input.entry-5PQR37HS.js} +1 -1
  29. package/dist/{ui-menu-item.entry-L4NJDBKF.js → ui-menu-item.entry-2T3QWHLK.js} +1 -1
  30. package/dist/{ui-menu.entry-DGUYAE3Q.js → ui-menu.entry-Q5Z5YO5P.js} +1 -1
  31. package/dist/{ui-popover.entry-A54EKVZG.js → ui-popover.entry-4P2NWWAY.js} +1 -1
  32. package/dist/{ui-radio-group.entry-6YP4LY4N.js → ui-radio-group.entry-QKPRNV26.js} +1 -1
  33. package/dist/{ui-radio.entry-CGYNK7PN.js → ui-radio.entry-O4DOMFNU.js} +1 -1
  34. package/dist/{ui-search-result-row.entry-DGKSI2QM.js → ui-search-result-row.entry-BR5O3UCH.js} +1 -1
  35. package/dist/{ui-search-shell.entry-3F5ASGTW.js → ui-search-shell.entry-2ZBP7SA3.js} +1 -1
  36. package/dist/{ui-select.entry-SXSZPVXA.js → ui-select.entry-L75HQY72.js} +1 -1
  37. package/dist/{ui-switch.entry-AD4EVUWM.js → ui-switch.entry-L5QWD3BT.js} +1 -1
  38. package/dist/{ui-tabs.entry-WLKO5G5N.js → ui-tabs.entry-KWRD6Y7J.js} +1 -1
  39. package/dist/{ui-textarea.entry-IHPC7Q4R.js → ui-textarea.entry-JC3HPEBS.js} +1 -1
  40. package/dist/{ui-toast-region.entry-GCW2LJAC.js → ui-toast-region.entry-C6KK4OM4.js} +1 -1
  41. package/dist/{ui-tooltip.entry-EU2G6BH5.js → ui-tooltip.entry-G5EOCWP4.js} +1 -1
  42. package/dist/{ui-top-bar.entry-NMAFXVET.js → ui-top-bar.entry-YLKVAQFH.js} +1 -1
  43. package/editor/chunk-CX4QDKSV.js +22 -0
  44. package/editor/{chunk-YGJLGDQC.js → chunk-NJ2KAMS2.js} +2203 -17
  45. package/editor/{chunk-CWCXYQMT.js → chunk-OK5NARJI.js} +59 -28
  46. package/editor/extensions/index.d.ts +74 -20
  47. package/editor/extensions/index.js +22 -4
  48. package/editor/index.d.ts +3 -3
  49. package/editor/index.js +25 -5
  50. package/editor/table-overlay-Bq0F5xPg.d.ts +64 -0
  51. package/editor/ui.d.ts +2 -12
  52. package/editor/ui.js +9 -1
  53. package/editor.css +375 -4
  54. package/package.json +9 -2
  55. package/tokens.css +17 -0
  56. package/vue/chunk-KDA4RFLQ.js +203 -0
  57. package/vue/editor/index.d.ts +93 -3
  58. package/vue/editor/index.js +565 -30
  59. package/vue/index.js +38 -82
  60. package/dist/looma/p-a7be33fd.entry.js +0 -1
  61. package/editor/table-overlay-DTr3KC9e.d.ts +0 -12
  62. package/vue/chunk-P72L3GWE.js +0 -84
@@ -1,3 +1,7 @@
1
+ import {
2
+ TABLE_CELL_BACKGROUND_OPTIONS
3
+ } from "./chunk-CX4QDKSV.js";
4
+
1
5
  // src/table-context-menu.ts
2
6
  var TAG = "ui-editor-table-context-menu";
3
7
  function dispatchTableAction(element, action) {
@@ -34,10 +38,14 @@ if (typeof HTMLElement !== "undefined") {
34
38
  this.render();
35
39
  this.addEventListener("click", this.onClick);
36
40
  window.addEventListener("resize", this.scheduleViewportPosition);
41
+ window.visualViewport?.addEventListener("resize", this.scheduleViewportPosition);
42
+ window.visualViewport?.addEventListener("scroll", this.scheduleViewportPosition);
37
43
  }
38
44
  disconnectedCallback() {
39
45
  this.removeEventListener("click", this.onClick);
40
46
  window.removeEventListener("resize", this.scheduleViewportPosition);
47
+ window.visualViewport?.removeEventListener("resize", this.scheduleViewportPosition);
48
+ window.visualViewport?.removeEventListener("scroll", this.scheduleViewportPosition);
41
49
  if (this.positionFrame !== null) {
42
50
  cancelAnimationFrame(this.positionFrame);
43
51
  this.positionFrame = null;
@@ -61,10 +69,13 @@ if (typeof HTMLElement !== "undefined") {
61
69
  menu.style.translate = "";
62
70
  const rect = menu.getBoundingClientRect();
63
71
  const gutter = 12;
64
- const viewportWidth = window.visualViewport?.width ?? window.innerWidth;
65
- const viewportHeight = window.visualViewport?.height ?? window.innerHeight;
66
- const offsetX = rect.right > viewportWidth - gutter ? viewportWidth - gutter - rect.right : Math.max(0, gutter - rect.left);
67
- const offsetY = rect.bottom > viewportHeight - gutter ? viewportHeight - gutter - rect.bottom : Math.max(0, gutter - rect.top);
72
+ const visualViewport = window.visualViewport;
73
+ const viewportLeft = visualViewport?.offsetLeft ?? 0;
74
+ const viewportTop = visualViewport?.offsetTop ?? 0;
75
+ const viewportRight = viewportLeft + (visualViewport?.width ?? window.innerWidth);
76
+ const viewportBottom = viewportTop + (visualViewport?.height ?? window.innerHeight);
77
+ const offsetX = rect.right > viewportRight - gutter ? viewportRight - gutter - rect.right : Math.max(0, viewportLeft + gutter - rect.left);
78
+ const offsetY = rect.bottom > viewportBottom - gutter ? viewportBottom - gutter - rect.bottom : Math.max(0, viewportTop + gutter - rect.top);
68
79
  if (offsetX !== 0 || offsetY !== 0) {
69
80
  menu.style.translate = `${offsetX}px ${offsetY}px`;
70
81
  }
@@ -79,18 +90,10 @@ if (typeof HTMLElement !== "undefined") {
79
90
  this.hidden = !open;
80
91
  if (!open) return;
81
92
  const currentBackground = this.getAttribute("cell-background");
82
- const backgroundActions = [
83
- { action: "background-none", label: "Default", value: null, swatch: null },
84
- { action: "background-gray", label: "Gray", value: "#f3f4f6", swatch: "#f3f4f6" },
85
- { action: "background-yellow", label: "Yellow", value: "#fef3c7", swatch: "#fef3c7" },
86
- { action: "background-blue", label: "Blue", value: "#dbeafe", swatch: "#dbeafe" },
87
- { action: "background-green", label: "Green", value: "#dcfce7", swatch: "#dcfce7" },
88
- { action: "background-red", label: "Red", value: "#fee2e2", swatch: "#fee2e2" }
89
- ];
90
93
  const sections = [
91
94
  {
92
95
  heading: "Cell background",
93
- backgrounds: backgroundActions
96
+ backgrounds: TABLE_CELL_BACKGROUND_OPTIONS
94
97
  },
95
98
  {
96
99
  heading: "Structure",
@@ -176,6 +179,7 @@ if (typeof HTMLElement !== "undefined") {
176
179
  return [
177
180
  "open",
178
181
  "cell-alignment",
182
+ "cell-background",
179
183
  "can-add-row-after",
180
184
  "can-add-column-after",
181
185
  "can-add-row-before",
@@ -252,6 +256,7 @@ if (typeof HTMLElement !== "undefined") {
252
256
  return;
253
257
  }
254
258
  const activeAlignment = this.getAlignmentAttr();
259
+ const currentBackground = this.getAttribute("cell-background");
255
260
  const alignmentActions = [
256
261
  { action: "align-left", label: "Left" },
257
262
  { action: "align-center", label: "Center" },
@@ -269,6 +274,13 @@ if (typeof HTMLElement !== "undefined") {
269
274
  { action: "add-column-before", label: "Add column left", can: "can-add-column-before" }
270
275
  ]
271
276
  },
277
+ {
278
+ heading: "Cells",
279
+ actions: [
280
+ { action: "merge-cells", label: "Merge selected cells", can: "can-merge-cells" },
281
+ { action: "split-cell", label: "Split merged cell", can: "can-split-cell" }
282
+ ]
283
+ },
272
284
  {
273
285
  heading: "Table",
274
286
  actions: [
@@ -295,14 +307,23 @@ if (typeof HTMLElement !== "undefined") {
295
307
  (action) => `<button type="button" data-action="${action.action}">${action.label}</button>`
296
308
  ).join(""),
297
309
  structuralActions.length > 0 ? "</div>" : "",
298
- availableOverflowSections.length > 0 ? '<div class="ui-editor-table-toolbar__sep" aria-hidden="true"></div>' : "",
299
- availableOverflowSections.length > 0 ? '<div class="ui-editor-table-toolbar__overflow">' : "",
300
- availableOverflowSections.length > 0 ? `<button type="button" class="ui-editor-table-toolbar__more" data-action="toggle-overflow" aria-haspopup="menu" aria-expanded="${this.#overflowOpen ? "true" : "false"}">Table options</button>` : "",
301
- availableOverflowSections.length > 0 && this.#overflowOpen ? [
310
+ '<div class="ui-editor-table-toolbar__sep" aria-hidden="true"></div>',
311
+ '<div class="ui-editor-table-toolbar__overflow">',
312
+ `<button type="button" class="ui-editor-table-toolbar__more" data-action="toggle-overflow" aria-haspopup="menu" aria-expanded="${this.#overflowOpen ? "true" : "false"}">Table options</button>`,
313
+ this.#overflowOpen ? [
302
314
  '<div class="ui-editor-table-toolbar__menu" role="menu" aria-label="More table actions">',
315
+ '<div class="ui-editor-table-toolbar__menu-section" role="none">',
316
+ '<div class="ui-editor-table-toolbar__menu-heading" role="presentation">Background</div>',
317
+ '<div class="ui-editor-table-toolbar__swatches" role="group" aria-label="Cell background">',
318
+ TABLE_CELL_BACKGROUND_OPTIONS.map((background) => {
319
+ const isSelected = (background.value ?? "") === (currentBackground ?? "");
320
+ return `<button type="button" class="ui-editor-table-toolbar__swatch-button" role="menuitemradio" aria-checked="${isSelected ? "true" : "false"}" data-action="${background.action}"${isSelected ? ' data-selected="true"' : ""}><span class="ui-editor-table-toolbar__swatch${background.swatch ? "" : " ui-editor-table-toolbar__swatch--default"}"${background.swatch ? ` style="--ui-editor-table-toolbar-swatch:${background.swatch}"` : ""}></span><span>${background.label}</span></button>`;
321
+ }).join(""),
322
+ "</div>",
323
+ "</div>",
303
324
  availableOverflowSections.map(
304
325
  (section) => [
305
- '<div class="ui-editor-table-toolbar__menu-section" role="none">',
326
+ '<div class="ui-editor-table-toolbar__menu-section ui-editor-table-toolbar__menu-section--divided" role="none">',
306
327
  `<div class="ui-editor-table-toolbar__menu-heading" role="presentation">${section.heading}</div>`,
307
328
  section.actions.map((action) => {
308
329
  const tone = "tone" in action ? action.tone : void 0;
@@ -313,7 +334,7 @@ if (typeof HTMLElement !== "undefined") {
313
334
  ).join(""),
314
335
  "</div>"
315
336
  ].join("") : "",
316
- availableOverflowSections.length > 0 ? "</div>" : "",
337
+ "</div>",
317
338
  "</div>"
318
339
  ].join("");
319
340
  }
@@ -659,6 +680,8 @@ if (typeof HTMLElement !== "undefined") {
659
680
  this.addEventListener("mouseover", this.onMouseOver);
660
681
  window.addEventListener("resize", this.onViewportChange);
661
682
  window.addEventListener("scroll", this.onViewportChange, true);
683
+ window.visualViewport?.addEventListener("resize", this.onViewportChange);
684
+ window.visualViewport?.addEventListener("scroll", this.onViewportChange);
662
685
  this.render();
663
686
  }
664
687
  disconnectedCallback() {
@@ -667,6 +690,8 @@ if (typeof HTMLElement !== "undefined") {
667
690
  this.removeEventListener("mouseover", this.onMouseOver);
668
691
  window.removeEventListener("resize", this.onViewportChange);
669
692
  window.removeEventListener("scroll", this.onViewportChange, true);
693
+ window.visualViewport?.removeEventListener("resize", this.onViewportChange);
694
+ window.visualViewport?.removeEventListener("scroll", this.onViewportChange);
670
695
  }
671
696
  onMouseDown = (event) => {
672
697
  event.preventDefault();
@@ -712,18 +737,24 @@ if (typeof HTMLElement !== "undefined") {
712
737
  this.style.display = "none";
713
738
  return;
714
739
  }
715
- const viewportWidth = window.innerWidth;
716
- const viewportHeight = window.innerHeight;
740
+ const visualViewport = window.visualViewport;
741
+ const viewportWidth = visualViewport?.width ?? window.innerWidth;
742
+ const viewportHeight = visualViewport?.height ?? window.innerHeight;
717
743
  this.style.display = "block";
718
744
  this.style.position = "fixed";
719
745
  this.style.zIndex = "500";
720
- if (viewportWidth < MOBILE_BREAKPOINT) {
721
- this.style.left = "0";
722
- this.style.right = "0";
723
- this.style.bottom = "0";
724
- this.style.top = "";
725
- this.style.width = "100%";
726
- this.style.maxHeight = "60dvh";
746
+ if (window.innerWidth < MOBILE_BREAKPOINT) {
747
+ const toolbarReserve = 56;
748
+ const menuHeight = Math.min(
749
+ MENU_HEIGHT_ESTIMATE,
750
+ Math.max(0, viewportHeight - toolbarReserve)
751
+ );
752
+ this.style.left = `${visualViewport?.offsetLeft ?? 0}px`;
753
+ this.style.right = "";
754
+ this.style.bottom = "";
755
+ this.style.top = `${(visualViewport?.offsetTop ?? 0) + viewportHeight - menuHeight - toolbarReserve}px`;
756
+ this.style.width = `${viewportWidth}px`;
757
+ this.style.maxHeight = `${menuHeight}px`;
727
758
  return;
728
759
  }
729
760
  let top;
@@ -1,5 +1,6 @@
1
- import { AnyExtension, Editor, Range } from '@tiptap/core';
2
- import { a as TableOverlayActionEventDetail } from '../table-overlay-DTr3KC9e.js';
1
+ import { AnyExtension, Editor, Range, Extension } from '@tiptap/core';
2
+ import { d as TableContextMenuActionEventDetail, f as TableOverlayActionEventDetail } from '../table-overlay-Bq0F5xPg.js';
3
+ export { a as TABLE_CELL_BACKGROUND_PRESETS } from '../table-overlay-Bq0F5xPg.js';
3
4
 
4
5
  /**
5
6
  * Default Tiptap extension preset for Looma editor.
@@ -11,12 +12,26 @@ interface DefaultEditorExtensionsOptions {
11
12
  linkOpenOnClick?: boolean;
12
13
  imageInline?: boolean;
13
14
  }
15
+ /** Complete Looma table support as one Tiptap extension. */
16
+ declare const LoomaTableKit: AnyExtension;
17
+ /** Individual table extensions for consumers that prefer an explicit extension list. */
18
+ declare function getLoomaTableExtensions(): AnyExtension[];
14
19
  /**
15
20
  * Returns the default Looma editor extensions (Vanilla Tiptap).
16
21
  * Use with new Editor({ extensions: getDefaultEditorExtensions(), ... }) or framework useEditor().
17
22
  */
18
23
  declare function getDefaultEditorExtensions(options?: DefaultEditorExtensionsOptions): AnyExtension[];
19
24
 
25
+ type TableCellAlignment = "left" | "center" | "right";
26
+ type TableCellBackground = string | null;
27
+ declare const LoomaTable: AnyExtension;
28
+ declare const LoomaTableHeader: AnyExtension;
29
+ declare const LoomaTableCell: AnyExtension;
30
+ declare function getActiveTableCellAlignment(editor: Editor): TableCellAlignment;
31
+ declare function getActiveTableCellBackground(editor: Editor): TableCellBackground;
32
+ declare function setActiveTableCellAlignment(editor: Editor, alignment: TableCellAlignment): boolean;
33
+ declare function setActiveTableCellBackground(editor: Editor, backgroundColor: TableCellBackground): boolean;
34
+
20
35
  /**
21
36
  * Table overlay action handler — maps boundaryIndex to Tiptap table commands.
22
37
  * Use with looma-editor-table-overlay-action: call this from the adapter's handler.
@@ -27,6 +42,30 @@ interface InsertTableAtRangeOptions {
27
42
  cols?: number;
28
43
  withHeaderRow?: boolean;
29
44
  }
45
+ interface TableActionCapabilities {
46
+ canAddRowBefore: boolean;
47
+ canAddRowAfter: boolean;
48
+ canAddColumnBefore: boolean;
49
+ canAddColumnAfter: boolean;
50
+ canDeleteRow: boolean;
51
+ canDeleteColumn: boolean;
52
+ canDeleteTable: boolean;
53
+ canMergeCells: boolean;
54
+ canSplitCell: boolean;
55
+ }
56
+ interface ActiveTableUiState {
57
+ active: boolean;
58
+ showToolbar: boolean;
59
+ cellAlignment: TableCellAlignment;
60
+ cellBackground: TableCellBackground;
61
+ capabilities: TableActionCapabilities;
62
+ }
63
+ /** Text formatting belongs to actual text selections, not table CellSelections. */
64
+ declare function shouldShowTextFormattingToolbar(editor: Editor, from?: number, to?: number): boolean;
65
+ /** Returns Looma's complete interaction state for the table containing the selection. */
66
+ declare function getActiveTableUiState(editor: Editor): ActiveTableUiState;
67
+ /** Executes a toolbar/context-menu action using Looma's table behavior policy. */
68
+ declare function handleTableAction(editor: Editor, detail: TableContextMenuActionEventDetail): boolean;
30
69
  /**
31
70
  * Deletes a slash-command range (or other inline trigger text) and inserts a table.
32
71
  * Use this when apps want a stable default `/table` behavior without owning table policy.
@@ -53,22 +92,37 @@ declare function normalizeActiveTableColumnWidths(editor: Editor, tableElement:
53
92
  */
54
93
  declare function handleTableOverlayAction(editor: Editor, detail: TableOverlayActionEventDetail): boolean;
55
94
 
56
- type TableCellAlignment = "left" | "center" | "right";
57
- type TableCellBackground = string | null;
58
- declare const TABLE_CELL_BACKGROUND_PRESETS: {
59
- readonly none: null;
60
- readonly gray: "#f3f4f6";
61
- readonly yellow: "#fef3c7";
62
- readonly blue: "#dbeafe";
63
- readonly green: "#dcfce7";
64
- readonly red: "#fee2e2";
65
- };
66
- declare const LoomaTable: AnyExtension;
67
- declare const LoomaTableHeader: AnyExtension;
68
- declare const LoomaTableCell: AnyExtension;
69
- declare function getActiveTableCellAlignment(editor: Editor): TableCellAlignment;
70
- declare function getActiveTableCellBackground(editor: Editor): TableCellBackground;
71
- declare function setActiveTableCellAlignment(editor: Editor, alignment: TableCellAlignment): boolean;
72
- declare function setActiveTableCellBackground(editor: Editor, backgroundColor: TableCellBackground): boolean;
95
+ interface LoomaSlashCommandContext {
96
+ editor: Editor;
97
+ range: Range;
98
+ }
99
+ interface LoomaSlashMenuSnapshot {
100
+ active: boolean;
101
+ items: LoomaSlashCommand[];
102
+ selectedIndex: number;
103
+ query: string;
104
+ rect: DOMRect | null;
105
+ select: ((index: number) => void) | null;
106
+ }
107
+ interface LoomaSlashCommandOptions {
108
+ commands: LoomaSlashCommand[];
109
+ onStateChange?: (state: LoomaSlashMenuSnapshot) => void;
110
+ onOpenImagePicker?: () => void;
111
+ }
112
+ declare function getDefaultSlashCommands(onOpenImagePicker?: () => void): LoomaSlashCommand[];
113
+ interface LoomaSlashCommand {
114
+ title: string;
115
+ description: string;
116
+ icon: string;
117
+ keywords: string[];
118
+ command: (context: LoomaSlashCommandContext) => void;
119
+ }
120
+ /**
121
+ * Framework-neutral slash-command extension used by the turnkey editor.
122
+ * Consumers embedding Looma into their own Tiptap instance can configure the
123
+ * same behavior and render any menu they choose from `onStateChange`.
124
+ */
125
+ declare const LoomaSlashCommand: Extension<LoomaSlashCommandOptions, any>;
126
+ declare function createLoomaSlashCommandExtension(options?: Partial<LoomaSlashCommandOptions>): Extension<LoomaSlashCommandOptions, any>;
73
127
 
74
- export { type DefaultEditorExtensionsOptions, type InsertTableAtRangeOptions, LoomaTable, LoomaTableCell, LoomaTableHeader, TABLE_CELL_BACKGROUND_PRESETS, type TableCellAlignment, type TableCellBackground, getActiveTableCellAlignment, getActiveTableCellBackground, getDefaultEditorExtensions, handleTableOverlayAction, insertTableAtRange, normalizeActiveTableColumnWidths, setActiveTableCellAlignment, setActiveTableCellBackground };
128
+ export { type ActiveTableUiState, type DefaultEditorExtensionsOptions, type InsertTableAtRangeOptions, LoomaSlashCommand, type LoomaSlashCommandContext, LoomaSlashCommand as LoomaSlashCommandItem, type LoomaSlashCommandOptions, type LoomaSlashMenuSnapshot, LoomaTable, LoomaTableCell, LoomaTableHeader, LoomaTableKit, type TableActionCapabilities, type TableCellAlignment, type TableCellBackground, createLoomaSlashCommandExtension, getActiveTableCellAlignment, getActiveTableCellBackground, getActiveTableUiState, getDefaultEditorExtensions, getDefaultSlashCommands, getLoomaTableExtensions, handleTableAction, handleTableOverlayAction, insertTableAtRange, normalizeActiveTableColumnWidths, setActiveTableCellAlignment, setActiveTableCellBackground, shouldShowTextFormattingToolbar };
@@ -1,28 +1,46 @@
1
1
  import {
2
+ LoomaSlashCommand,
2
3
  LoomaTable,
3
4
  LoomaTableCell,
4
5
  LoomaTableHeader,
5
- TABLE_CELL_BACKGROUND_PRESETS,
6
+ LoomaTableKit,
7
+ createLoomaSlashCommandExtension,
6
8
  getActiveTableCellAlignment,
7
9
  getActiveTableCellBackground,
10
+ getActiveTableUiState,
8
11
  getDefaultEditorExtensions,
12
+ getDefaultSlashCommands,
13
+ getLoomaTableExtensions,
14
+ handleTableAction,
9
15
  handleTableOverlayAction,
10
16
  insertTableAtRange,
11
17
  normalizeActiveTableColumnWidths,
12
18
  setActiveTableCellAlignment,
13
- setActiveTableCellBackground
14
- } from "../chunk-YGJLGDQC.js";
19
+ setActiveTableCellBackground,
20
+ shouldShowTextFormattingToolbar
21
+ } from "../chunk-NJ2KAMS2.js";
22
+ import {
23
+ TABLE_CELL_BACKGROUND_PRESETS
24
+ } from "../chunk-CX4QDKSV.js";
15
25
  export {
26
+ LoomaSlashCommand,
16
27
  LoomaTable,
17
28
  LoomaTableCell,
18
29
  LoomaTableHeader,
30
+ LoomaTableKit,
19
31
  TABLE_CELL_BACKGROUND_PRESETS,
32
+ createLoomaSlashCommandExtension,
20
33
  getActiveTableCellAlignment,
21
34
  getActiveTableCellBackground,
35
+ getActiveTableUiState,
22
36
  getDefaultEditorExtensions,
37
+ getDefaultSlashCommands,
38
+ getLoomaTableExtensions,
39
+ handleTableAction,
23
40
  handleTableOverlayAction,
24
41
  insertTableAtRange,
25
42
  normalizeActiveTableColumnWidths,
26
43
  setActiveTableCellAlignment,
27
- setActiveTableCellBackground
44
+ setActiveTableCellBackground,
45
+ shouldShowTextFormattingToolbar
28
46
  };
package/editor/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { InsertTableEventDetail, SlashMenuAnchorRect, SlashMenuHighlightEventDetail, SlashMenuItem, SlashMenuSelectEventDetail, TableContextMenuAction, TableContextMenuActionEventDetail, TableContextMenuActionEventDetail as TableToolbarActionEventDetail } from './ui.js';
2
- export { T as TableOverlayAction, a as TableOverlayActionEventDetail } from './table-overlay-DTr3KC9e.js';
3
- export { DefaultEditorExtensionsOptions, InsertTableAtRangeOptions, LoomaTable, LoomaTableCell, LoomaTableHeader, TABLE_CELL_BACKGROUND_PRESETS, TableCellAlignment, TableCellBackground, getActiveTableCellAlignment, getActiveTableCellBackground, getDefaultEditorExtensions, handleTableOverlayAction, insertTableAtRange, normalizeActiveTableColumnWidths, setActiveTableCellAlignment, setActiveTableCellBackground } from './extensions/index.js';
1
+ export { T as TABLE_CELL_BACKGROUND_OPTIONS, a as TABLE_CELL_BACKGROUND_PRESETS, b as TableCellBackgroundAction, c as TableContextMenuAction, d as TableContextMenuActionEventDetail, e as TableOverlayAction, f as TableOverlayActionEventDetail, d as TableToolbarActionEventDetail } from './table-overlay-Bq0F5xPg.js';
2
+ export { InsertTableEventDetail, SlashMenuAnchorRect, SlashMenuHighlightEventDetail, SlashMenuItem, SlashMenuSelectEventDetail } from './ui.js';
3
+ export { ActiveTableUiState, DefaultEditorExtensionsOptions, InsertTableAtRangeOptions, LoomaSlashCommand, LoomaSlashCommandContext, LoomaSlashCommand as LoomaSlashCommandItem, LoomaSlashCommandOptions, LoomaSlashMenuSnapshot, LoomaTable, LoomaTableCell, LoomaTableHeader, LoomaTableKit, TableActionCapabilities, TableCellAlignment, TableCellBackground, createLoomaSlashCommandExtension, getActiveTableCellAlignment, getActiveTableCellBackground, getActiveTableUiState, getDefaultEditorExtensions, getDefaultSlashCommands, getLoomaTableExtensions, handleTableAction, handleTableOverlayAction, insertTableAtRange, normalizeActiveTableColumnWidths, setActiveTableCellAlignment, setActiveTableCellBackground, shouldShowTextFormattingToolbar } from './extensions/index.js';
4
4
  import '@tiptap/core';
package/editor/index.js CHANGED
@@ -1,29 +1,49 @@
1
- import "./chunk-CWCXYQMT.js";
1
+ import "./chunk-OK5NARJI.js";
2
2
  import {
3
+ LoomaSlashCommand,
3
4
  LoomaTable,
4
5
  LoomaTableCell,
5
6
  LoomaTableHeader,
6
- TABLE_CELL_BACKGROUND_PRESETS,
7
+ LoomaTableKit,
8
+ createLoomaSlashCommandExtension,
7
9
  getActiveTableCellAlignment,
8
10
  getActiveTableCellBackground,
11
+ getActiveTableUiState,
9
12
  getDefaultEditorExtensions,
13
+ getDefaultSlashCommands,
14
+ getLoomaTableExtensions,
15
+ handleTableAction,
10
16
  handleTableOverlayAction,
11
17
  insertTableAtRange,
12
18
  normalizeActiveTableColumnWidths,
13
19
  setActiveTableCellAlignment,
14
- setActiveTableCellBackground
15
- } from "./chunk-YGJLGDQC.js";
20
+ setActiveTableCellBackground,
21
+ shouldShowTextFormattingToolbar
22
+ } from "./chunk-NJ2KAMS2.js";
23
+ import {
24
+ TABLE_CELL_BACKGROUND_OPTIONS,
25
+ TABLE_CELL_BACKGROUND_PRESETS
26
+ } from "./chunk-CX4QDKSV.js";
16
27
  export {
28
+ LoomaSlashCommand,
17
29
  LoomaTable,
18
30
  LoomaTableCell,
19
31
  LoomaTableHeader,
32
+ LoomaTableKit,
33
+ TABLE_CELL_BACKGROUND_OPTIONS,
20
34
  TABLE_CELL_BACKGROUND_PRESETS,
35
+ createLoomaSlashCommandExtension,
21
36
  getActiveTableCellAlignment,
22
37
  getActiveTableCellBackground,
38
+ getActiveTableUiState,
23
39
  getDefaultEditorExtensions,
40
+ getDefaultSlashCommands,
41
+ getLoomaTableExtensions,
42
+ handleTableAction,
24
43
  handleTableOverlayAction,
25
44
  insertTableAtRange,
26
45
  normalizeActiveTableColumnWidths,
27
46
  setActiveTableCellAlignment,
28
- setActiveTableCellBackground
47
+ setActiveTableCellBackground,
48
+ shouldShowTextFormattingToolbar
29
49
  };
@@ -0,0 +1,64 @@
1
+ declare const TABLE_CELL_BACKGROUND_PRESETS: {
2
+ readonly none: null;
3
+ readonly gray: "#f3f4f6";
4
+ readonly yellow: "#fef3c7";
5
+ readonly blue: "#dbeafe";
6
+ readonly green: "#dcfce7";
7
+ readonly red: "#fee2e2";
8
+ };
9
+ declare const TABLE_CELL_BACKGROUND_OPTIONS: readonly [{
10
+ readonly action: "background-none";
11
+ readonly label: "Default";
12
+ readonly value: null;
13
+ readonly swatch: null;
14
+ }, {
15
+ readonly action: "background-gray";
16
+ readonly label: "Gray";
17
+ readonly value: "#f3f4f6";
18
+ readonly swatch: "#f3f4f6";
19
+ }, {
20
+ readonly action: "background-yellow";
21
+ readonly label: "Yellow";
22
+ readonly value: "#fef3c7";
23
+ readonly swatch: "#fef3c7";
24
+ }, {
25
+ readonly action: "background-blue";
26
+ readonly label: "Blue";
27
+ readonly value: "#dbeafe";
28
+ readonly swatch: "#dbeafe";
29
+ }, {
30
+ readonly action: "background-green";
31
+ readonly label: "Green";
32
+ readonly value: "#dcfce7";
33
+ readonly swatch: "#dcfce7";
34
+ }, {
35
+ readonly action: "background-red";
36
+ readonly label: "Red";
37
+ readonly value: "#fee2e2";
38
+ readonly swatch: "#fee2e2";
39
+ }];
40
+ type TableCellBackgroundAction = typeof TABLE_CELL_BACKGROUND_OPTIONS[number]["action"];
41
+
42
+ /**
43
+ * ui-editor-table-context-menu — web component for table cell context menu.
44
+ * Emits custom events for each action; the adapter (Vue/React) wires Tiptap commands.
45
+ * Domain-neutral: no Tiptap dependency.
46
+ */
47
+
48
+ type TableContextMenuAction = "align-left" | "align-center" | "align-right" | TableCellBackgroundAction | "add-row-before" | "add-row-after" | "add-column-before" | "add-column-after" | "delete-row" | "delete-column" | "delete-table" | "merge-cells" | "split-cell";
49
+ interface TableContextMenuActionEventDetail {
50
+ action: TableContextMenuAction;
51
+ }
52
+
53
+ /**
54
+ * ui-editor-table-overlay — table edge controls for row/column insertion.
55
+ * Emits looma-editor-table-overlay-action with insertion intent.
56
+ * Domain-neutral: no Tiptap dependency.
57
+ */
58
+ type TableOverlayAction = "add-row-before" | "add-row-after" | "add-column-before" | "add-column-after";
59
+ interface TableOverlayActionEventDetail {
60
+ action: TableOverlayAction;
61
+ boundaryIndex: number;
62
+ }
63
+
64
+ export { TABLE_CELL_BACKGROUND_OPTIONS as T, TABLE_CELL_BACKGROUND_PRESETS as a, type TableCellBackgroundAction as b, type TableContextMenuAction as c, type TableContextMenuActionEventDetail as d, type TableOverlayAction as e, type TableOverlayActionEventDetail as f };
package/editor/ui.d.ts CHANGED
@@ -1,14 +1,4 @@
1
- export { T as TableOverlayAction, a as TableOverlayActionEventDetail } from './table-overlay-DTr3KC9e.js';
2
-
3
- /**
4
- * ui-editor-table-context-menu — web component for table cell context menu.
5
- * Emits custom events for each action; the adapter (Vue/React) wires Tiptap commands.
6
- * Domain-neutral: no Tiptap dependency.
7
- */
8
- type TableContextMenuAction = "align-left" | "align-center" | "align-right" | "background-none" | "background-gray" | "background-yellow" | "background-blue" | "background-green" | "background-red" | "add-row-before" | "add-row-after" | "add-column-before" | "add-column-after" | "delete-row" | "delete-column" | "delete-table" | "merge-cells" | "split-cell";
9
- interface TableContextMenuActionEventDetail {
10
- action: TableContextMenuAction;
11
- }
1
+ export { T as TABLE_CELL_BACKGROUND_OPTIONS, a as TABLE_CELL_BACKGROUND_PRESETS, b as TableCellBackgroundAction, c as TableContextMenuAction, d as TableContextMenuActionEventDetail, e as TableOverlayAction, f as TableOverlayActionEventDetail, d as TableToolbarActionEventDetail } from './table-overlay-Bq0F5xPg.js';
12
2
 
13
3
  /**
14
4
  * ui-editor-insert-table-grid — web component for picking table dimensions.
@@ -45,4 +35,4 @@ interface SlashMenuSelectEventDetail {
45
35
  */
46
36
  type SlashMenuAnchorRect = Pick<DOMRectReadOnly, "left" | "top" | "right" | "bottom"> | Pick<DOMRectReadOnly, "x" | "y" | "width" | "height">;
47
37
 
48
- export type { InsertTableEventDetail, SlashMenuAnchorRect, SlashMenuHighlightEventDetail, SlashMenuItem, SlashMenuSelectEventDetail, TableContextMenuAction, TableContextMenuActionEventDetail, TableContextMenuActionEventDetail as TableToolbarActionEventDetail };
38
+ export type { InsertTableEventDetail, SlashMenuAnchorRect, SlashMenuHighlightEventDetail, SlashMenuItem, SlashMenuSelectEventDetail };
package/editor/ui.js CHANGED
@@ -1 +1,9 @@
1
- import "./chunk-CWCXYQMT.js";
1
+ import "./chunk-OK5NARJI.js";
2
+ import {
3
+ TABLE_CELL_BACKGROUND_OPTIONS,
4
+ TABLE_CELL_BACKGROUND_PRESETS
5
+ } from "./chunk-CX4QDKSV.js";
6
+ export {
7
+ TABLE_CELL_BACKGROUND_OPTIONS,
8
+ TABLE_CELL_BACKGROUND_PRESETS
9
+ };