@threadlabs/looma 0.53.13 → 0.53.15

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.13",
783
+ "version": "0.53.15",
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,5 +1,6 @@
1
1
  import { Extension, Mark, Node, markInputRule, markPasteRule, mergeAttributes } from "@tiptap/core";
2
2
  import { Plugin } from "@tiptap/pm/state";
3
+ import { DOMParser } from "@tiptap/pm/model";
3
4
  import { closeHistory, history, redo, undo } from "@tiptap/pm/history";
4
5
  //#region src/editor/extensions/input-rule-history.ts
5
6
  /**
@@ -45,6 +46,23 @@ var LoomaInputRuleHistory = Extension.create({
45
46
  }
46
47
  });
47
48
  //#endregion
49
+ //#region src/editor/extensions/dom-readback.ts
50
+ var EditorDOMParser = class extends DOMParser {
51
+ parse(node, options) {
52
+ return super.parse(node, options?.preserveWhitespace === true ? {
53
+ ...options,
54
+ preserveWhitespace: "full"
55
+ } : options);
56
+ }
57
+ };
58
+ var LoomaDOMReadback = Extension.create({
59
+ name: "loomaDOMReadback",
60
+ addProseMirrorPlugins() {
61
+ const { schema, rules } = DOMParser.fromSchema(this.editor.schema);
62
+ return [new Plugin({ props: { domParser: new EditorDOMParser(schema, rules) } })];
63
+ }
64
+ });
65
+ //#endregion
48
66
  //#region ../../node_modules/.pnpm/@tiptap+extension-document@2.27.2_@tiptap+core@2.27.2_@tiptap+pm@2.27.2_/node_modules/@tiptap/extension-document/dist/index.js
49
67
  /**
50
68
  * The default document node which represents the top level node of the editor.
@@ -435,4 +453,4 @@ var Code = Mark.create({
435
453
  }
436
454
  });
437
455
  //#endregion
438
- export { Bold as a, Document as c, Italic as i, LoomaInputRuleHistory as l, History as n, Text as o, HardBreak as r, Paragraph as s, Code as t };
456
+ export { Bold as a, Document as c, Italic as i, LoomaDOMReadback as l, History as n, Text as o, HardBreak as r, Paragraph as s, Code as t, LoomaInputRuleHistory as u };
@@ -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
  });
@@ -11586,6 +11658,13 @@ function customHeadings(headings) {
11586
11658
  marked.add(next);
11587
11659
  }
11588
11660
  }
11661
+ function softLineBreaks(node) {
11662
+ if (node.type !== "text" || !node.value?.includes("\n")) return [node];
11663
+ return node.value.split(/((?<!\n)\n(?!\n))/).filter(Boolean).map((value) => value === "\n" ? { type: "softBreak" } : {
11664
+ type: "text",
11665
+ value
11666
+ });
11667
+ }
11589
11668
  function toNode(node, path, context) {
11590
11669
  let result = toBareNode(node, path, context);
11591
11670
  if (!node.marks?.length) return result;
@@ -11616,7 +11695,7 @@ function toNode(node, path, context) {
11616
11695
  const definition = typeof attrs.reference === "string" ? context.definitions.get(referenceKey(attrs.reference)) : void 0;
11617
11696
  if (definition && definition.attrs?.href === attrs.href && string(definition.attrs?.title) === string(attrs.title) && !attrs.class) {
11618
11697
  const referenceType = (attrs.referenceType === "collapsed" || attrs.referenceType === "shortcut") && referenceKey(text(result)) !== referenceKey(attrs.reference) ? "full" : string(attrs.referenceType, "full");
11619
- result = compact("linkReference", [result], {
11698
+ result = compact("linkReference", softLineBreaks(result), {
11620
11699
  label: attrs.reference,
11621
11700
  referenceType
11622
11701
  });
@@ -11628,7 +11707,7 @@ function toNode(node, path, context) {
11628
11707
  "rel",
11629
11708
  "class"
11630
11709
  ]) if (attrs[key] !== LINK_DEFAULTS[key]) has(attributes, key, attrs[key]);
11631
- result = compact(type, [result], {
11710
+ result = compact(type, softLineBreaks(result), {
11632
11711
  url: string(attrs.href),
11633
11712
  ...attrs.title ? { title: string(attrs.title) } : {},
11634
11713
  ...Object.keys(attributes).length ? { attributes } : {}
@@ -11639,7 +11718,7 @@ function toNode(node, path, context) {
11639
11718
  type,
11640
11719
  value: result.value ?? ""
11641
11720
  };
11642
- } else result = compact(type, [result], mark.attrs?.color ? { attributes: { color: string(mark.attrs.color) } } : {});
11721
+ } else result = compact(type, softLineBreaks(result), mark.attrs?.color ? { attributes: { color: string(mark.attrs.color) } } : {});
11643
11722
  }
11644
11723
  return result;
11645
11724
  }
@@ -11653,7 +11732,9 @@ function toBareNode(node, path, context) {
11653
11732
  } : child);
11654
11733
  const plain = (type, keys = [], extra = {}) => {
11655
11734
  fields(node, keys, path);
11656
- return compact(type, children(), extra);
11735
+ const result = compact(type, children(), extra);
11736
+ if ((type === "paragraph" || type === "heading") && result.children) result.children = result.children.flatMap(softLineBreaks);
11737
+ return result;
11657
11738
  };
11658
11739
  const block = (type, keys = [], extra = {}) => {
11659
11740
  fields(node, keys, path);
@@ -12746,4 +12827,4 @@ function markdownToEditorDocument(markdown, options = {}) {
12746
12827
  return expressmarkToEditorDocument(document);
12747
12828
  }
12748
12829
  //#endregion
12749
- 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,6 +1,6 @@
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
- import { a as Bold, c as Document, i as Italic, l as LoomaInputRuleHistory, n as History, o as Text$1, r as HardBreak, s as Paragraph, t as Code } from "./dist.js";
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";
5
5
  import { NodeSelection, Plugin, PluginKey, Selection, TextSelection } from "@tiptap/pm/state";
6
6
  import { Decoration, DecorationSet } from "@tiptap/pm/view";
@@ -10479,6 +10479,7 @@ function getDefaultEditorExtensions(options = {}) {
10479
10479
  HardBreak,
10480
10480
  History,
10481
10481
  LoomaInputRuleHistory,
10482
+ LoomaDOMReadback,
10482
10483
  Dropcursor,
10483
10484
  Gapcursor,
10484
10485
  Link.configure({
package/editor/compact.js CHANGED
@@ -1,4 +1,4 @@
1
- import { a as Bold, c as Document, i as Italic, l as LoomaInputRuleHistory, n as History, o as Text, r as HardBreak, s as Paragraph, t as Code } from "./chunks/dist.js";
1
+ import { a as Bold, c as Document, i as Italic, l as LoomaDOMReadback, n as History, o as Text, r as HardBreak, s as Paragraph, t as Code, u as LoomaInputRuleHistory } from "./chunks/dist.js";
2
2
  import { t as createEditorSession } from "./chunks/session.js";
3
3
  //#region src/editor/compact-extensions.ts
4
4
  /** Minimal short-form schema; additional consumer extensions are opt-in. */
@@ -12,7 +12,8 @@ function getCompactEditorExtensions() {
12
12
  Code,
13
13
  HardBreak,
14
14
  History,
15
- LoomaInputRuleHistory
15
+ LoomaInputRuleHistory,
16
+ LoomaDOMReadback
16
17
  ];
17
18
  }
18
19
  //#endregion
@@ -214,6 +214,15 @@
214
214
  :scope:where(:is([component~="ui-button"]:not(template), [data-component~="ui-button"]:not([component])))[data-appearance="card"][size="lg"] {
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-appearance="card"][size="sm"] {
218
+ min-block-size: var(--ui-control-size-sm);
219
+ gap: var(--ui-space-2) !important;
220
+ }
221
+ :scope:where(:is([component~="ui-button"]:not(template), [data-component~="ui-button"]:not([component])))[data-ui-button-state~="fit"][data-appearance="card"] {
222
+ inline-size: fit-content;
223
+ min-inline-size: 0;
224
+ max-inline-size: 100%;
225
+ }
217
226
  :scope:where(:is([component~="ui-button"]:not(template), [data-component~="ui-button"]:not([component])))[data-appearance="card"]:has(.card-icon:empty) {
218
227
  grid-template-columns: minmax(0, 1fr) auto;
219
228
  }
@@ -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;
@@ -0,0 +1,2 @@
1
+ import { Extension } from "@tiptap/core";
2
+ export declare const LoomaDOMReadback: Extension<any, any>;
@@ -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,11 @@
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 one block optimistically; retain a mapped rollback anchor while transport runs. */
11
+ 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";