@threadlabs/looma 0.2.17 → 0.2.19

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@threadlabs/looma",
3
- "version": "0.2.17",
3
+ "version": "0.2.19",
4
4
  "type": "module",
5
5
  "description": "Looma declarative components, responsive layout primitives, a complete editor, and supported Vue adapters.",
6
6
  "license": "MIT",
@@ -338,6 +338,26 @@ var EMPTY_CAPABILITIES = {
338
338
  function sameDocument(left, right) {
339
339
  return JSON.stringify(left) === JSON.stringify(right);
340
340
  }
341
+ function managedMenuAnchorRect(rect) {
342
+ if (!rect) return null;
343
+ return {
344
+ left: rect.left,
345
+ top: rect.top,
346
+ right: rect.right,
347
+ bottom: rect.bottom,
348
+ x: rect.x,
349
+ y: rect.y,
350
+ width: rect.width,
351
+ height: rect.height
352
+ };
353
+ }
354
+ function managedSlashMenuItems(items) {
355
+ return items.map(({ title, description, icon }) => ({
356
+ title,
357
+ description,
358
+ icon
359
+ }));
360
+ }
341
361
  function selectedTableElement(editor) {
342
362
  const { node } = editor.view.domAtPos(editor.state.selection.from);
343
363
  const element = node instanceof HTMLElement ? node : node.parentElement;
@@ -1076,9 +1096,9 @@ var LoomaEditor = defineComponent2({
1076
1096
  slash.active && slash.items.length > 0 ? h2(EditorSlashMenu, {
1077
1097
  open: true,
1078
1098
  query: slash.query,
1079
- items: slash.items,
1099
+ items: managedSlashMenuItems(slash.items),
1080
1100
  selectedIndex: slash.selectedIndex,
1081
- anchorRect: slash.rect,
1101
+ anchorRect: managedMenuAnchorRect(slash.rect),
1082
1102
  onSlashMenuHighlight: ({ index }) => {
1083
1103
  slash.selectedIndex = index;
1084
1104
  },
@@ -1092,7 +1112,7 @@ var LoomaEditor = defineComponent2({
1092
1112
  query: mention.query,
1093
1113
  items: mention.items,
1094
1114
  selectedIndex: mention.selectedIndex,
1095
- anchorRect: mention.rect,
1115
+ anchorRect: managedMenuAnchorRect(mention.rect),
1096
1116
  loading: mention.loading,
1097
1117
  onMentionMenuHighlight: ({ index }) => {
1098
1118
  mention.selectedIndex = index;