@threadlabs/looma 0.53.14 → 0.53.16

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/docs/catalog.json CHANGED
@@ -780,7 +780,7 @@
780
780
  ],
781
781
  "schemaVersion": 1,
782
782
  "package": "@threadlabs/looma",
783
- "version": "0.53.14",
783
+ "version": "0.53.16",
784
784
  "groups": [
785
785
  {
786
786
  "id": "layout",
@@ -3489,6 +3489,17 @@
3489
3489
  },
3490
3490
  "default": false
3491
3491
  },
3492
+ {
3493
+ "name": "fit",
3494
+ "property": "fit",
3495
+ "description": "Keeps a card action at its content width, constrained to the available space. Other boxed actions already size to their content.",
3496
+ "type": "boolean",
3497
+ "valueType": {
3498
+ "kind": "terminal",
3499
+ "name": "boolean"
3500
+ },
3501
+ "default": false
3502
+ },
3492
3503
  {
3493
3504
  "name": "href",
3494
3505
  "property": "href",
@@ -3738,6 +3749,12 @@
3738
3749
  "type": "boolean",
3739
3750
  "default": false
3740
3751
  },
3752
+ {
3753
+ "name": "fit",
3754
+ "description": "Keeps a card action at its content width, constrained to the available space. Other boxed actions already size to their content.",
3755
+ "type": "boolean",
3756
+ "default": false
3757
+ },
3741
3758
  {
3742
3759
  "name": "href",
3743
3760
  "description": "The link's destination. Supplying href automatically renders a native link instead of a button, including an empty href for the current document. A disabled link drops its href and states aria-disabled=\"true\", so it cannot be followed.",
@@ -18455,6 +18472,24 @@
18455
18472
  ],
18456
18473
  "detailDocs": "Emitted when a toggleable control changes checked state."
18457
18474
  },
18475
+ {
18476
+ "name": "file-delete-error",
18477
+ "detailType": "{ readonly error: unknown; readonly file: unknown }",
18478
+ "detailSchema": "object",
18479
+ "fields": [
18480
+ {
18481
+ "path": "error",
18482
+ "type": "unknown",
18483
+ "required": true
18484
+ },
18485
+ {
18486
+ "path": "file",
18487
+ "type": "unknown",
18488
+ "required": true
18489
+ }
18490
+ ],
18491
+ "detailDocs": "Emitted with the declared detail payload."
18492
+ },
18458
18493
  {
18459
18494
  "name": "image-activate",
18460
18495
  "detailType": "{ readonly src: string; readonly trigger: \"pointer\" | \"keyboard\"; readonly [name: string]: unknown }",
@@ -1,6 +1,7 @@
1
1
  import { n as validLinkHref } from "./content.js";
2
2
  import { Extension, Node, mergeAttributes } from "@tiptap/core";
3
3
  import { NodeSelection, Plugin, PluginKey } from "@tiptap/pm/state";
4
+ import { DOMSerializer } from "@tiptap/pm/model";
4
5
  import { parse, stringify } from "expressmark";
5
6
  //#region \0rolldown/runtime.js
6
7
  var __create = Object.create;
@@ -2461,10 +2462,10 @@ function cloneChildren(childs) {
2461
2462
  }
2462
2463
  return children;
2463
2464
  }
2464
- var Node$1, DataNode, Text, Comment, ProcessingInstruction, NodeWithChildren, CDATA, Document, Element;
2465
+ var Node$2, DataNode, Text, Comment, ProcessingInstruction, NodeWithChildren, CDATA, Document, Element;
2465
2466
  var init_node = __esmMin((() => {
2466
2467
  init_dist$5();
2467
- Node$1 = class {
2468
+ Node$2 = class {
2468
2469
  /** Parent of the node */
2469
2470
  parent = null;
2470
2471
  /** Previous sibling */
@@ -2514,7 +2515,7 @@ var init_node = __esmMin((() => {
2514
2515
  return cloneNode(this, recursive);
2515
2516
  }
2516
2517
  };
2517
- DataNode = class extends Node$1 {
2518
+ DataNode = class extends Node$2 {
2518
2519
  data;
2519
2520
  /**
2520
2521
  * @param data The content of the data node
@@ -2563,7 +2564,7 @@ var init_node = __esmMin((() => {
2563
2564
  /** If this is a doctype, the document type system identifier (parse5 only). */
2564
2565
  "x-systemId";
2565
2566
  };
2566
- NodeWithChildren = class extends Node$1 {
2567
+ NodeWithChildren = class extends Node$2 {
2567
2568
  children;
2568
2569
  /**
2569
2570
  * @param children Children of the node. Only certain node types can have children.
@@ -3937,9 +3938,25 @@ function fileAttachmentAttrs(value) {
3937
3938
  }
3938
3939
  /** The same decimal byte units used by upload receipts. */
3939
3940
  function fileAttachmentSize(size) {
3940
- if (size < 1e3) return `${size} B`;
3941
- if (size < 1e6) return `${Number((size / 1e3).toFixed(1))} KB`;
3942
- return `${Number((size / 1e6).toFixed(1))} MB`;
3941
+ const units = [
3942
+ "B",
3943
+ "KB",
3944
+ "MB",
3945
+ "GB",
3946
+ "TB",
3947
+ "PB"
3948
+ ];
3949
+ let value = size, unit = 0;
3950
+ while (value >= 1e3 && unit < units.length - 1) {
3951
+ value /= 1e3;
3952
+ unit += 1;
3953
+ }
3954
+ value = Number(value.toFixed(unit ? 1 : 0));
3955
+ if (value >= 1e3 && unit < units.length - 1) {
3956
+ value = 1;
3957
+ unit += 1;
3958
+ }
3959
+ return `${value} ${units[unit]}`;
3943
3960
  }
3944
3961
  var escape$1 = (value) => String(value).replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
3945
3962
  /** Portable HTML keeps the original link, filename and byte count without editor chrome. */
@@ -3980,7 +3997,9 @@ function readFileAttachmentHtml(html) {
3980
3997
  ].includes(key)) || Object.keys(size.attribs).length || plain(link.children) !== a.name || plain(size.children) !== fileAttachmentSize(a.size)) throw new Error("Unsupported attachment content");
3981
3998
  return a;
3982
3999
  }
3983
- /** A movable, atomic file block. Its rich view composes the standard card action. */
4000
+ /** A movable, atomic file block. Its rich view composes the standard card action.
4001
+ * @ownership Hosts retain original bytes and publish file availability separately from authored metadata.
4002
+ */
3984
4003
  var LoomaFileAttachment = Node.create({
3985
4004
  name: "loomaFileAttachment",
3986
4005
  group: "block",
@@ -4077,6 +4096,12 @@ function setReferenceDisplay(editor, references) {
4077
4096
  function getReferenceDisplay(editor) {
4078
4097
  return editor.storage.loomaReferencePresentation?.references ?? {};
4079
4098
  }
4099
+ /** Observe host presentation and editability without changing authored content or history. */
4100
+ function observeReferenceDisplay(editor, render) {
4101
+ const listeners = editor.storage.loomaReferencePresentation.listeners;
4102
+ listeners.add(render);
4103
+ return () => listeners.delete(render);
4104
+ }
4080
4105
  /**
4081
4106
  * Reads current host presentation, with a durable insertion-time fallback for offline copies.
4082
4107
  * @failure Unsafe cached destinations fall back to the saved safe URL or no destination.
@@ -4161,7 +4186,10 @@ var LoomaReferencePresentation = Extension.create({
4161
4186
  mentions: false
4162
4187
  }),
4163
4188
  addStorage() {
4164
- return { references: this.options.references };
4189
+ return {
4190
+ references: this.options.references,
4191
+ listeners: /* @__PURE__ */ new Set()
4192
+ };
4165
4193
  },
4166
4194
  addProseMirrorPlugins() {
4167
4195
  const initial = this.options.references;
@@ -4230,10 +4258,54 @@ var LoomaReferencePresentation = Extension.create({
4230
4258
  return next;
4231
4259
  }
4232
4260
  },
4233
- props: { nodeViews },
4234
- view: () => ({ update: (view, previous) => {
4235
- if (referenceDisplayKey.getState(view.state) !== referenceDisplayKey.getState(previous)) refresh.forEach((render) => render());
4236
- } })
4261
+ props: {
4262
+ nodeViews,
4263
+ markViews: { link: (mark, view) => {
4264
+ const rendered = DOMSerializer.renderSpec(document, mark.type.spec.toDOM(mark, true));
4265
+ const link = rendered.dom, contentDOM = rendered.contentDOM ?? link;
4266
+ const href = typeof mark.attrs.href === "string" ? mark.attrs.href : "";
4267
+ if (!href.startsWith("/api/files/")) return {
4268
+ dom: link,
4269
+ contentDOM
4270
+ };
4271
+ const dom = document.createElement("span"), suffix = document.createTextNode("");
4272
+ dom.setAttribute("data-looma-file-reference", "");
4273
+ dom.append(link, suffix);
4274
+ const render = () => {
4275
+ const display = referenceDisplayKey.getState(view.state)?.[`attachment:${href}`];
4276
+ if (display?.status === "deleted" || display?.status === "pending") {
4277
+ link.removeAttribute("href");
4278
+ link.setAttribute("aria-disabled", "true");
4279
+ link.setAttribute("role", "link");
4280
+ } else {
4281
+ link.setAttribute("href", href);
4282
+ link.removeAttribute("aria-disabled");
4283
+ link.removeAttribute("role");
4284
+ }
4285
+ suffix.data = display?.status === "deleted" ? " (deleted)" : "";
4286
+ };
4287
+ refresh.add(render);
4288
+ render();
4289
+ return {
4290
+ dom,
4291
+ contentDOM,
4292
+ ignoreMutation: (mutation) => mutation.type !== "selection" && (mutation.type === "attributes" || !contentDOM.contains(mutation.target)),
4293
+ destroy: () => {
4294
+ refresh.delete(render);
4295
+ }
4296
+ };
4297
+ } }
4298
+ },
4299
+ view: (view) => {
4300
+ let editable = view.editable;
4301
+ this.storage.listeners.forEach((render) => render());
4302
+ return { update: (view, previous) => {
4303
+ const changed = referenceDisplayKey.getState(view.state) !== referenceDisplayKey.getState(previous);
4304
+ if (changed) refresh.forEach((render) => render());
4305
+ if (changed || editable !== view.editable) this.storage.listeners.forEach((render) => render());
4306
+ editable = view.editable;
4307
+ } };
4308
+ }
4237
4309
  })];
4238
4310
  }
4239
4311
  });
@@ -12755,4 +12827,4 @@ function markdownToEditorDocument(markdown, options = {}) {
12755
12827
  return expressmarkToEditorDocument(document);
12756
12828
  }
12757
12829
  //#endregion
12758
- export { assignLoomaHeadingIds as C, splitLoomaFrontmatter as D, normalizeLoomaChipTone as E, __exportAll as O, LOOMA_CHIP_TONES as S, normalizeLoomaCalloutTone as T, setReferenceDisplay as _, expressmarkToEditorDocument as a, fileAttachmentSize as b, imageSourceUrls as c, readPictureHtml as d, isHeadingAlignment as f, referenceDisplay as g, getReferenceDisplay as h, editorToMarkdown as i, mapImageSourceUrls as l, LoomaReferencePresentation as m, editorDocumentToExpressmark as n, markdownToEditorDocument as o, LoomaReference as p, editorDocumentToMarkdown as r, imageHtmlSpec as s, EditorMarkdownConversionError as t, normalizeImageSources as u, LoomaFileAttachment as v, loomaHeadingSlug as w, LOOMA_CALLOUT_TONES as x, fileAttachmentAttrs as y };
12830
+ export { LOOMA_CHIP_TONES as C, normalizeLoomaChipTone as D, normalizeLoomaCalloutTone as E, splitLoomaFrontmatter as O, LOOMA_CALLOUT_TONES as S, loomaHeadingSlug as T, referenceDisplay as _, expressmarkToEditorDocument as a, fileAttachmentAttrs as b, imageSourceUrls as c, readPictureHtml as d, isHeadingAlignment as f, observeReferenceDisplay as g, getReferenceDisplay as h, editorToMarkdown as i, __exportAll as k, mapImageSourceUrls as l, LoomaReferencePresentation as m, editorDocumentToExpressmark as n, markdownToEditorDocument as o, LoomaReference as p, editorDocumentToMarkdown as r, imageHtmlSpec as s, EditorMarkdownConversionError as t, normalizeImageSources as u, setReferenceDisplay as v, assignLoomaHeadingIds as w, fileAttachmentSize as x, LoomaFileAttachment as y };
@@ -1,4 +1,4 @@
1
- import { C as assignLoomaHeadingIds, D as splitLoomaFrontmatter, E as normalizeLoomaChipTone, S as LOOMA_CHIP_TONES, T as normalizeLoomaCalloutTone, d as readPictureHtml, f as isHeadingAlignment, g as referenceDisplay, h as getReferenceDisplay, m as LoomaReferencePresentation, o as markdownToEditorDocument, p as LoomaReference, s as imageHtmlSpec, u as normalizeImageSources, v as LoomaFileAttachment, w as loomaHeadingSlug } from "./expressmark.js";
1
+ import { C as LOOMA_CHIP_TONES, D as normalizeLoomaChipTone, E as normalizeLoomaCalloutTone, O as splitLoomaFrontmatter, T as loomaHeadingSlug, _ as referenceDisplay, d as readPictureHtml, f as isHeadingAlignment, h as getReferenceDisplay, m as LoomaReferencePresentation, o as markdownToEditorDocument, p as LoomaReference, s as imageHtmlSpec, u as normalizeImageSources, w as assignLoomaHeadingIds, y as LoomaFileAttachment } from "./expressmark.js";
2
2
  import { i as TABLE_CELL_BACKGROUND_PRESETS, n as resolveTableCellAt } from "./table-overlay.js";
3
3
  import { a as Bold, c as Document, i as Italic, l as LoomaDOMReadback, n as History, o as Text$1, r as HardBreak, s as Paragraph, t as Code, u as LoomaInputRuleHistory } from "./dist.js";
4
4
  import { Extension, InputRule, Mark, Node as Node$1, PasteRule, callOrReturn, canInsertNode, combineTransactionSteps, escapeForRegEx, findChildren, findChildrenInRange, findParentNodeClosestToPos, getAttributes, getChangedRanges, getExtensionField, getMarksBetween, getText, getTextSerializersFromSchema, isNodeEmpty, isNodeSelection, markInputRule, markPasteRule, mergeAttributes, nodeInputRule, textInputRule, textblockTypeInputRule, wrappingInputRule } from "@tiptap/core";
@@ -211,9 +211,19 @@
211
211
  box-shadow: none;
212
212
  background-image: none;
213
213
  }
214
- :scope:where(:is([component~="ui-button"]:not(template), [data-component~="ui-button"]:not([component])))[data-appearance="card"][size="lg"] {
214
+ :scope:where(:is([component~="ui-button"]:not(template), [data-component~="ui-button"]:not([component])))[data-ui-button-state~="size=lg"][data-appearance="card"] {
215
215
  min-block-size: max(var(--ui-control-min-block-size), var(--ui-control-size-lg));
216
216
  }
217
+ :scope:where(:is([component~="ui-button"]:not(template), [data-component~="ui-button"]:not([component])))[data-ui-button-state~="size=sm"][data-appearance="card"] {
218
+ min-block-size: var(--ui-control-size-sm);
219
+ align-items: center !important;
220
+ gap: var(--ui-space-2) !important;
221
+ }
222
+ :scope:where(:is([component~="ui-button"]:not(template), [data-component~="ui-button"]:not([component])))[data-ui-button-state~="fit"][data-appearance="card"] {
223
+ inline-size: fit-content;
224
+ min-inline-size: 0;
225
+ max-inline-size: 100%;
226
+ }
217
227
  :scope:where(:is([component~="ui-button"]:not(template), [data-component~="ui-button"]:not([component])))[data-appearance="card"]:has(.card-icon:empty) {
218
228
  grid-template-columns: minmax(0, 1fr) auto;
219
229
  }
@@ -81,6 +81,18 @@ export type LoomaImageUploader = LoomaResponder<LoomaImageUploadDetail, LoomaIma
81
81
  export type LoomaFileUploader = LoomaResponder<{
82
82
  file: File;
83
83
  }, LoomaFileDescriptor>;
84
+ /** Confirm a permanent deletion before the editor removes its file block. */
85
+ export type LoomaFileDeletionConfirmation = LoomaResponder<{
86
+ file: LoomaFileDescriptor;
87
+ }, {
88
+ confirmed: boolean;
89
+ }>;
90
+ /** Delete the retained original; rejection restores the removed block. */
91
+ export type LoomaFileDeleter = LoomaResponder<{
92
+ file: LoomaFileDescriptor;
93
+ }, {
94
+ deleted: boolean;
95
+ }>;
84
96
  /** Data inputs and creation-time service policy for a document session. Component adapters resolve services through requests. */
85
97
  export interface DocumentEditorProps {
86
98
  content: JSONContent;
@@ -14,5 +14,7 @@ export declare function fileAttachmentSize(size: number): string;
14
14
  export declare function fileAttachmentHtml(value: Record<string, unknown>): string;
15
15
  /** Read only the complete authored attachment shape; refuse extra executable or lost content. */
16
16
  export declare function readFileAttachmentHtml(html: string): FileAttachmentAttrs | null;
17
- /** A movable, atomic file block. Its rich view composes the standard card action. */
17
+ /** A movable, atomic file block. Its rich view composes the standard card action.
18
+ * @ownership Hosts retain original bytes and publish file availability separately from authored metadata.
19
+ */
18
20
  export declare const LoomaFileAttachment: Node<any, any>;
@@ -13,7 +13,7 @@ export { LoomaExpand, revealLoomaExpandAt, type LoomaExpandAttributes } from "./
13
13
  export { LoomaFigcaption, LoomaFigure } from "./figure.js";
14
14
  export { findLoomaFootnote, LOOMA_FOOTNOTE_LABEL, LoomaFootnote, LoomaFootnoteReference } from "./footnote.js";
15
15
  export { LoomaLinkDefinition } from "./link-definition.js";
16
- export { LoomaFileAttachment } from './file-attachment';
16
+ export { LoomaFileAttachment, fileAttachmentSize } from './file-attachment';
17
17
  export { LoomaLineBlock } from "./line-block.js";
18
18
  export { LoomaTab, LoomaTabs } from "./tabs.js";
19
19
  export { LoomaTableOfContents, getTableOfContentsEntries, normalizeTableOfContentsConfig, type LoomaTableOfContentsConfig, type LoomaTableOfContentsEntry, type LoomaTableOfContentsFormat, } from "./table-of-contents.js";
@@ -1,4 +1,4 @@
1
- import { _ as setReferenceDisplay, c as imageSourceUrls, g as referenceDisplay, h as getReferenceDisplay, l as mapImageSourceUrls, m as LoomaReferencePresentation, p as LoomaReference, u as normalizeImageSources, v as LoomaFileAttachment, x as LOOMA_CALLOUT_TONES } from "../chunks/expressmark.js";
1
+ import { S as LOOMA_CALLOUT_TONES, _ as referenceDisplay, c as imageSourceUrls, h as getReferenceDisplay, l as mapImageSourceUrls, m as LoomaReferencePresentation, p as LoomaReference, u as normalizeImageSources, v as setReferenceDisplay, x as fileAttachmentSize, y as LoomaFileAttachment } from "../chunks/expressmark.js";
2
2
  import { i as TABLE_CELL_BACKGROUND_PRESETS } from "../chunks/table-overlay.js";
3
3
  import { $ as LoomaFootnote, A as createLoomaMentionExtension, C as getActiveTableCellBackground, D as createSiteRelativeLinks, E as LoomaSmartPaste, F as LoomaImage, G as normalizeTableOfContentsConfig, H as LoomaTableOfContents, I as LoomaInlineImage, J as LoomaTabs, M as MAX_MENTION_RESULT_LIMIT, N as filterLoomaMentionItems, O as siteRelativeHref, P as normalizeMentionResultLimit, Q as LOOMA_FOOTNOTE_LABEL, R as normalizeImageDimension, S as getActiveTableCellAlignment, T as setActiveTableCellBackground, U as getTableOfContentsEntries, X as LoomaLinkDefinition, Y as LoomaLineBlock, _ as getDefaultEditorExtensions, at as revealLoomaExpandAt, b as LoomaTableCell, c as handleTableAction, ct as normalizeLoomaChipColor, d as normalizeActiveTableColumnWidths, dt as LOOMA_ACTIVE_BLOCK_CLASS, et as LoomaFootnoteReference, f as shouldShowTextFormattingToolbar, ft as LOOMA_ACTIVE_BLOCK_TYPING_IDLE_MS, g as LoomaTableKit, i as getDefaultSlashCommands, it as LoomaExpand, j as DEFAULT_MENTION_RESULT_LIMIT, k as LoomaMentionSuggestionPluginKey, l as handleTableOverlayAction, lt as LoomaCallout, mt as LoomaActiveBlockPluginKey, n as createLoomaSlashCommandExtension, nt as LoomaFigcaption, ot as LOOMA_CHIP_COLORS, pt as LoomaActiveBlock, q as LoomaTab, r as filterLoomaSlashCommands, rt as LoomaFigure, s as getActiveTableUiState, st as LoomaChip, t as LoomaSlashCommand, tt as findLoomaFootnote, u as insertTableAtRange, ut as LOOMA_ACTIVE_BLOCK_BLUR_GRACE_MS, v as getLoomaTableExtensions, w as setActiveTableCellAlignment, x as LoomaTableHeader, y as LoomaTable, z as normalizeImagePlacement } from "../chunks/extensions.js";
4
- export { DEFAULT_MENTION_RESULT_LIMIT, LOOMA_ACTIVE_BLOCK_BLUR_GRACE_MS, LOOMA_ACTIVE_BLOCK_CLASS, LOOMA_ACTIVE_BLOCK_TYPING_IDLE_MS, LOOMA_CALLOUT_TONES, LOOMA_CHIP_COLORS, LOOMA_FOOTNOTE_LABEL, LoomaActiveBlock, LoomaActiveBlockPluginKey, LoomaCallout, LoomaChip, LoomaExpand, LoomaFigcaption, LoomaFigure, LoomaFileAttachment, LoomaFootnote, LoomaFootnoteReference, LoomaImage, LoomaInlineImage, LoomaLineBlock, LoomaLinkDefinition, LoomaMentionSuggestionPluginKey, LoomaReference, LoomaReferencePresentation, LoomaSlashCommand, LoomaSmartPaste, LoomaTab, LoomaTable, LoomaTableCell, LoomaTableHeader, LoomaTableKit, LoomaTableOfContents, LoomaTabs, MAX_MENTION_RESULT_LIMIT, TABLE_CELL_BACKGROUND_PRESETS, createLoomaMentionExtension, createLoomaSlashCommandExtension, createSiteRelativeLinks, filterLoomaMentionItems, filterLoomaSlashCommands, findLoomaFootnote, getActiveTableCellAlignment, getActiveTableCellBackground, getActiveTableUiState, getDefaultEditorExtensions, getDefaultSlashCommands, getLoomaTableExtensions, getReferenceDisplay, getTableOfContentsEntries, handleTableAction, handleTableOverlayAction, imageSourceUrls, insertTableAtRange, mapImageSourceUrls, normalizeActiveTableColumnWidths, normalizeImageDimension, normalizeImagePlacement, normalizeImageSources, normalizeLoomaChipColor, normalizeMentionResultLimit, normalizeTableOfContentsConfig, referenceDisplay, revealLoomaExpandAt, setActiveTableCellAlignment, setActiveTableCellBackground, setReferenceDisplay, shouldShowTextFormattingToolbar, siteRelativeHref };
4
+ export { DEFAULT_MENTION_RESULT_LIMIT, LOOMA_ACTIVE_BLOCK_BLUR_GRACE_MS, LOOMA_ACTIVE_BLOCK_CLASS, LOOMA_ACTIVE_BLOCK_TYPING_IDLE_MS, LOOMA_CALLOUT_TONES, LOOMA_CHIP_COLORS, LOOMA_FOOTNOTE_LABEL, LoomaActiveBlock, LoomaActiveBlockPluginKey, LoomaCallout, LoomaChip, LoomaExpand, LoomaFigcaption, LoomaFigure, LoomaFileAttachment, LoomaFootnote, LoomaFootnoteReference, LoomaImage, LoomaInlineImage, LoomaLineBlock, LoomaLinkDefinition, LoomaMentionSuggestionPluginKey, LoomaReference, LoomaReferencePresentation, LoomaSlashCommand, LoomaSmartPaste, LoomaTab, LoomaTable, LoomaTableCell, LoomaTableHeader, LoomaTableKit, LoomaTableOfContents, LoomaTabs, MAX_MENTION_RESULT_LIMIT, TABLE_CELL_BACKGROUND_PRESETS, createLoomaMentionExtension, createLoomaSlashCommandExtension, createSiteRelativeLinks, fileAttachmentSize, filterLoomaMentionItems, filterLoomaSlashCommands, findLoomaFootnote, getActiveTableCellAlignment, getActiveTableCellBackground, getActiveTableUiState, getDefaultEditorExtensions, getDefaultSlashCommands, getLoomaTableExtensions, getReferenceDisplay, getTableOfContentsEntries, handleTableAction, handleTableOverlayAction, imageSourceUrls, insertTableAtRange, mapImageSourceUrls, normalizeActiveTableColumnWidths, normalizeImageDimension, normalizeImagePlacement, normalizeImageSources, normalizeLoomaChipColor, normalizeMentionResultLimit, normalizeTableOfContentsConfig, referenceDisplay, revealLoomaExpandAt, setActiveTableCellAlignment, setActiveTableCellBackground, setReferenceDisplay, shouldShowTextFormattingToolbar, siteRelativeHref };
@@ -0,0 +1,13 @@
1
+ import type { Editor } from '@tiptap/core';
2
+ import type { LoomaFileDescriptor } from './file-uploads';
3
+ /** Host confirmation and storage transport; document removal belongs to the editor. */
4
+ export interface FileDeletionServices {
5
+ enabled: () => boolean;
6
+ confirm: (file: LoomaFileDescriptor, signal: AbortSignal) => Promise<boolean>;
7
+ remove: (file: LoomaFileDescriptor, signal: AbortSignal) => Promise<boolean>;
8
+ onError: (error: unknown, file: LoomaFileDescriptor) => void;
9
+ }
10
+ /** Remove an authored reference without changing the original file's availability. */
11
+ export declare function removeFileBlock(editor: Editor, position: () => number | undefined): void;
12
+ /** Remove one block optimistically; retain a mapped rollback anchor while transport runs. */
13
+ export declare function deleteFileBlock(editor: Editor, position: () => number | undefined, file: LoomaFileDescriptor, services: FileDeletionServices): Promise<void>;
package/editor/index.d.ts CHANGED
@@ -6,7 +6,7 @@ export * from "./ui.js";
6
6
  export * from "./extensions/index.js";
7
7
  export { LOOMA_ICONS, loomaIconMarkup, type LoomaIconName, type LoomaIconNode } from "./icons.js";
8
8
  export { getVisualViewportRect, type ViewportRect } from "./viewport.js";
9
- export { createDocumentEditorSession, type DocumentEditorProps, type DocumentEditorPort, type LoomaEditorToolbarMode, type LoomaEditorExtensions, type LoomaEditorSlashCommands, type LoomaSlashCommandsDetail, type LoomaLinkSearch, type LoomaLinkSearchDetail, type LoomaLinkResolve, type LoomaLinkResolveDetail, type LoomaMentionQuery, type LoomaMentionQueryDetail, type LoomaImageUploader, type LoomaFileUploader, type LoomaImageUploadDetail, type LoomaRequestInit, type LoomaResponder, type LoomaEditorSelectionAction, type LoomaEditorSelectionActionDetail, type LoomaEditorRangeAction, type LoomaEditorRangeActionDetail, } from "./document-session.js";
9
+ export { createDocumentEditorSession, type DocumentEditorProps, type DocumentEditorPort, type LoomaEditorToolbarMode, type LoomaEditorExtensions, type LoomaEditorSlashCommands, type LoomaSlashCommandsDetail, type LoomaLinkSearch, type LoomaLinkSearchDetail, type LoomaLinkResolve, type LoomaLinkResolveDetail, type LoomaMentionQuery, type LoomaMentionQueryDetail, type LoomaImageUploader, type LoomaFileUploader, type LoomaFileDeleter, type LoomaFileDeletionConfirmation, type LoomaImageUploadDetail, type LoomaRequestInit, type LoomaResponder, type LoomaEditorSelectionAction, type LoomaEditorSelectionActionDetail, type LoomaEditorRangeAction, type LoomaEditorRangeActionDetail, } from "./document-session.js";
10
10
  export type { LoomaImageDescriptor, LoomaImageSourceResolver, LoomaImageAttributeResolver, LoomaImageActivationDetail, LoomaImageActivationTrigger, LoomaImageRenditionErrorDetail, LoomaImageRenditionAttributes, } from "./image-delivery.js";
11
11
  export type { LoomaFileDescriptor } from "./file-uploads.js";
12
12
  export { createToolbarTooltip } from "./toolbar-tooltip.js";