@threadlabs/looma 0.2.18 → 0.2.20

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.
@@ -2360,6 +2360,7 @@ if (typeof HTMLElement !== "undefined") {
2360
2360
  this.#rows = this.#readBoundedNumber("rows", DEFAULT_ROWS);
2361
2361
  this.#cols = this.#readBoundedNumber("cols", DEFAULT_COLS);
2362
2362
  this.render();
2363
+ this.addEventListener("mousedown", this.onMouseDown);
2363
2364
  this.addEventListener("click", this.onClick);
2364
2365
  this.addEventListener("pointerover", this.onPointerOver);
2365
2366
  this.addEventListener("pointerout", this.onPointerOut);
@@ -2371,6 +2372,7 @@ if (typeof HTMLElement !== "undefined") {
2371
2372
  });
2372
2373
  }
2373
2374
  disconnectedCallback() {
2375
+ this.removeEventListener("mousedown", this.onMouseDown);
2374
2376
  this.removeEventListener("click", this.onClick);
2375
2377
  this.removeEventListener("pointerover", this.onPointerOver);
2376
2378
  this.removeEventListener("pointerout", this.onPointerOut);
@@ -2427,6 +2429,10 @@ if (typeof HTMLElement !== "undefined") {
2427
2429
  { detail, bubbles: true, composed: true }
2428
2430
  ));
2429
2431
  }
2432
+ onMouseDown = (event) => {
2433
+ const target = event.target instanceof Element ? event.target.closest("button[data-action]") : null;
2434
+ if (target) event.preventDefault();
2435
+ };
2430
2436
  onClick = (event) => {
2431
2437
  const target = event.target.closest("button[data-action]");
2432
2438
  if (!target) return;
package/editor/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  measureTableOverlayGeometry,
3
3
  resolveTableCellAt
4
- } from "./chunk-WI7ZA44X.js";
4
+ } from "./chunk-VAXI7Q6T.js";
5
5
  import {
6
6
  DEFAULT_MENTION_RESULT_LIMIT,
7
7
  LOOMA_CALLOUT_TONES,
package/editor/ui.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  measureTableOverlayGeometry,
3
3
  resolveTableCellAt
4
- } from "./chunk-WI7ZA44X.js";
4
+ } from "./chunk-VAXI7Q6T.js";
5
5
  import {
6
6
  TABLE_CELL_BACKGROUND_OPTIONS,
7
7
  TABLE_CELL_BACKGROUND_PRESETS
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@threadlabs/looma",
3
- "version": "0.2.18",
3
+ "version": "0.2.20",
4
4
  "type": "module",
5
5
  "description": "Looma declarative components, responsive layout primitives, a complete editor, and supported Vue adapters.",
6
6
  "license": "MIT",
@@ -351,6 +351,13 @@ function managedMenuAnchorRect(rect) {
351
351
  height: rect.height
352
352
  };
353
353
  }
354
+ function managedSlashMenuItems(items) {
355
+ return items.map(({ title, description, icon }) => ({
356
+ title,
357
+ description,
358
+ icon
359
+ }));
360
+ }
354
361
  function selectedTableElement(editor) {
355
362
  const { node } = editor.view.domAtPos(editor.state.selection.from);
356
363
  const element = node instanceof HTMLElement ? node : node.parentElement;
@@ -903,6 +910,10 @@ var LoomaEditor = defineComponent2({
903
910
  hoveredTableCell = null;
904
911
  nextTick(updateTableUi);
905
912
  };
913
+ const onTableOverlayMouseDown = (event) => {
914
+ const action = event.target instanceof Element ? event.target.closest("button[data-action]") : null;
915
+ if (action) event.preventDefault();
916
+ };
906
917
  const commandButton = (label, icon, active, disabled, run) => {
907
918
  const syncNativeDisabled = (vnode) => {
908
919
  if (!(vnode.el instanceof Element)) return;
@@ -1089,7 +1100,7 @@ var LoomaEditor = defineComponent2({
1089
1100
  slash.active && slash.items.length > 0 ? h2(EditorSlashMenu, {
1090
1101
  open: true,
1091
1102
  query: slash.query,
1092
- items: slash.items,
1103
+ items: managedSlashMenuItems(slash.items),
1093
1104
  selectedIndex: slash.selectedIndex,
1094
1105
  anchorRect: managedMenuAnchorRect(slash.rect),
1095
1106
  onSlashMenuHighlight: ({ index }) => {
@@ -1124,6 +1135,7 @@ var LoomaEditor = defineComponent2({
1124
1135
  ref: tableOverlayShell,
1125
1136
  class: "looma-editor__table-overlay-shell",
1126
1137
  style: tableUi.overlayStyle,
1138
+ onMousedown: onTableOverlayMouseDown,
1127
1139
  onPointerleave: onTableOverlayPointerLeave
1128
1140
  }, [h2(EditorTableOverlay, {
1129
1141
  open: true,