@threadlabs/looma 0.53.3 → 0.53.5

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.
@@ -1,5 +1,5 @@
1
+ import { C as splitLoomaFrontmatter, S as normalizeLoomaChipTone, b as loomaHeadingSlug, d as readPictureHtml, f as LoomaReference, h as referenceDisplay, m as getReferenceDisplay, o as markdownToEditorDocument, p as LoomaReferencePresentation, s as imageHtmlSpec, u as normalizeImageSources, v as LOOMA_CHIP_TONES, x as normalizeLoomaCalloutTone, y as assignLoomaHeadingIds } from "./expressmark.js";
1
2
  import { i as TABLE_CELL_BACKGROUND_PRESETS, n as resolveTableCellAt } from "./table-overlay.js";
2
- import { _ as normalizeLoomaChipTone, c as LoomaReferencePresentation, g as normalizeLoomaCalloutTone, h as loomaHeadingSlug, l as getReferenceDisplay, m as assignLoomaHeadingIds, o as markdownToEditorDocument, p as LOOMA_CHIP_TONES, s as LoomaReference, u as referenceDisplay, v as splitLoomaFrontmatter } from "./expressmark.js";
3
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";
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";
@@ -1004,7 +1004,9 @@ var LoomaLinkDefinition = Node$1.create({
1004
1004
  });
1005
1005
  //#endregion
1006
1006
  //#region src/editor/extensions/line-block.ts
1007
- /** A paragraph-like block whose authored line boundaries remain significant on export. */
1007
+ /** A paragraph-like block whose authored line boundaries remain significant on export.
1008
+ * @contract Keeps line-block identity through editing, HTML parsing and Markdown export.
1009
+ */
1008
1010
  var LoomaLineBlock = Node$1.create({
1009
1011
  name: "loomaLineBlock",
1010
1012
  group: "block",
@@ -3785,7 +3787,53 @@ var Image = Node$1.create({
3785
3787
  }
3786
3788
  });
3787
3789
  //#endregion
3790
+ //#region src/editor/image-media.ts
3791
+ /** Read the host's transient attributes without adding them to the authored document. */
3792
+ var imageDeliveryAttributes = (decorations) => Object.assign({}, ...decorations.map((decoration) => decoration.spec.loomaImageAttributes ?? {}));
3793
+ /** Projects authored choices and transient delivery onto their native source/img elements. */
3794
+ function createImageMedia() {
3795
+ const dom = document.createElement("picture");
3796
+ const image = document.createElement("img");
3797
+ dom.append(image);
3798
+ let sourceKey = "";
3799
+ let written = /* @__PURE__ */ new Set();
3800
+ return {
3801
+ dom,
3802
+ write(attrs, delivery) {
3803
+ const sources = normalizeImageSources(attrs.sources);
3804
+ const key = JSON.stringify(sources);
3805
+ if (key !== sourceKey) {
3806
+ for (const child of dom.querySelectorAll(":scope > source")) child.remove();
3807
+ for (const values of sources) {
3808
+ const source = document.createElement("source");
3809
+ for (const [name, value] of Object.entries(values)) source.setAttribute(name, String(value));
3810
+ dom.insertBefore(source, image);
3811
+ }
3812
+ sourceKey = key;
3813
+ }
3814
+ const next = Object.entries({
3815
+ src: attrs.src,
3816
+ alt: attrs.alt ?? "",
3817
+ title: attrs.title,
3818
+ width: attrs.width,
3819
+ height: attrs.height,
3820
+ ...delivery
3821
+ }).filter(([, value]) => value !== void 0 && value !== null && value !== false);
3822
+ const names = new Set(next.map(([name]) => name));
3823
+ for (const name of written) if (!names.has(name)) image.removeAttribute(name);
3824
+ for (const [name, value] of next) {
3825
+ const text = value === true ? "" : String(value);
3826
+ if (image.getAttribute(name) !== text) image.setAttribute(name, text);
3827
+ }
3828
+ written = names;
3829
+ }
3830
+ };
3831
+ }
3832
+ //#endregion
3788
3833
  //#region src/editor/extensions/image.ts
3834
+ /** Both forms use the same portable image attributes and host image controls. */
3835
+ var isLoomaImageName = (name) => name === "image" || name === "loomaInlineImage";
3836
+ var imageElement = (element) => element.tagName === "PICTURE" ? element.querySelector("img") ?? element : element;
3789
3837
  /** Accepts only positive, integral CSS-pixel dimensions. */
3790
3838
  function normalizeImageDimension(value) {
3791
3839
  return typeof value === "number" && Number.isSafeInteger(value) && value > 0 ? value : void 0;
@@ -3798,31 +3846,91 @@ function normalizeImagePlacement(value) {
3798
3846
  * @contract Keeps Tiptap's existing `image` name and insertion command. Delivery
3799
3847
  * attributes stay transient; dimensions and placement survive HTML and JSON.
3800
3848
  */
3801
- var LoomaImage = Image.extend({ addAttributes() {
3802
- return {
3803
- ...this.parent?.(),
3804
- width: {
3805
- default: null,
3806
- parseHTML: (element) => normalizeImageDimension(Number(element.getAttribute("width"))) ?? null,
3807
- renderHTML: (attrs) => normalizeImageDimension(attrs.width) ? { width: attrs.width } : {}
3808
- },
3809
- height: {
3810
- default: null,
3811
- parseHTML: (element) => normalizeImageDimension(Number(element.getAttribute("height"))) ?? null,
3812
- renderHTML: (attrs) => normalizeImageDimension(attrs.height) ? { height: attrs.height } : {}
3813
- },
3814
- responsive: {
3815
- default: null,
3816
- parseHTML: (element) => element.hasAttribute("data-looma-responsive") || null,
3817
- renderHTML: (attrs) => attrs.responsive === true ? { "data-looma-responsive": "" } : {}
3818
- },
3819
- placement: {
3820
- default: "block",
3821
- parseHTML: (element) => normalizeImagePlacement(element.getAttribute("data-placement")),
3822
- renderHTML: (attrs) => normalizeImagePlacement(attrs.placement) === "block" ? {} : { "data-placement": normalizeImagePlacement(attrs.placement) }
3823
- }
3824
- };
3825
- } });
3849
+ var LoomaImage = Image.extend({
3850
+ addAttributes() {
3851
+ return {
3852
+ ...this.parent?.(),
3853
+ src: {
3854
+ default: null,
3855
+ parseHTML: (element) => imageElement(element).getAttribute("src")
3856
+ },
3857
+ alt: {
3858
+ default: null,
3859
+ parseHTML: (element) => imageElement(element).getAttribute("alt")
3860
+ },
3861
+ title: {
3862
+ default: null,
3863
+ parseHTML: (element) => imageElement(element).getAttribute("title")
3864
+ },
3865
+ sources: {
3866
+ default: null,
3867
+ parseHTML: (element) => element.tagName === "PICTURE" ? readPictureHtml(element.outerHTML)?.sources ?? null : null,
3868
+ renderHTML: () => ({})
3869
+ },
3870
+ width: {
3871
+ default: null,
3872
+ parseHTML: (element) => normalizeImageDimension(Number(imageElement(element).getAttribute("width"))) ?? null,
3873
+ renderHTML: (attrs) => normalizeImageDimension(attrs.width) ? { width: attrs.width } : {}
3874
+ },
3875
+ height: {
3876
+ default: null,
3877
+ parseHTML: (element) => normalizeImageDimension(Number(imageElement(element).getAttribute("height"))) ?? null,
3878
+ renderHTML: (attrs) => normalizeImageDimension(attrs.height) ? { height: attrs.height } : {}
3879
+ },
3880
+ responsive: {
3881
+ default: null,
3882
+ parseHTML: (element) => imageElement(element).hasAttribute("data-looma-responsive") || null,
3883
+ renderHTML: (attrs) => attrs.responsive === true ? { "data-looma-responsive": "" } : {}
3884
+ },
3885
+ placement: {
3886
+ default: "block",
3887
+ parseHTML: (element) => normalizeImagePlacement(imageElement(element).getAttribute("data-placement")),
3888
+ renderHTML: (attrs) => normalizeImagePlacement(attrs.placement) === "block" ? {} : { "data-placement": normalizeImagePlacement(attrs.placement) }
3889
+ }
3890
+ };
3891
+ },
3892
+ parseHTML() {
3893
+ return [{
3894
+ tag: "picture",
3895
+ getAttrs: (element) => readPictureHtml(element.outerHTML) ?? false
3896
+ }, ...this.parent?.() ?? []];
3897
+ },
3898
+ renderHTML({ node, HTMLAttributes }) {
3899
+ if (!node.attrs.sources && this.name === "image") return ["img", mergeAttributes(this.options.HTMLAttributes, HTMLAttributes)];
3900
+ return imageHtmlSpec(node.attrs, this.name === "loomaInlineImage");
3901
+ }
3902
+ });
3903
+ /** Imported inline images retain their text position.
3904
+ * @contract Uses the same durable attributes as a block image without overriding its insertion command.
3905
+ */
3906
+ var LoomaInlineImage = LoomaImage.extend({
3907
+ name: "loomaInlineImage",
3908
+ priority: 1100,
3909
+ parseHTML() {
3910
+ return [{
3911
+ tag: "picture[data-looma-inline-image]",
3912
+ getAttrs: (element) => readPictureHtml(element.outerHTML) ?? false
3913
+ }, { tag: "img[data-looma-inline-image]" }];
3914
+ },
3915
+ addCommands: () => ({}),
3916
+ addInputRules: () => [],
3917
+ addNodeView() {
3918
+ return ({ node, decorations }) => {
3919
+ const media = createImageMedia();
3920
+ media.dom.setAttribute("data-looma-inline-image", "");
3921
+ media.write(node.attrs, imageDeliveryAttributes(decorations));
3922
+ return {
3923
+ dom: media.dom,
3924
+ update(next, nextDecorations) {
3925
+ if (next.type !== node.type) return false;
3926
+ media.write(next.attrs, imageDeliveryAttributes(nextDecorations));
3927
+ return true;
3928
+ },
3929
+ ignoreMutation: (mutation) => mutation.type !== "selection"
3930
+ };
3931
+ };
3932
+ }
3933
+ }).configure({ inline: true });
3826
3934
  //#endregion
3827
3935
  //#region ../../node_modules/.pnpm/@tiptap+extension-highlight@2.27.2_@tiptap+core@2.27.2_@tiptap+pm@2.27.2_/node_modules/@tiptap/extension-highlight/dist/index.js
3828
3936
  /**
@@ -10317,6 +10425,7 @@ function getDefaultEditorExtensions(options = {}) {
10317
10425
  return [
10318
10426
  Document,
10319
10427
  Paragraph,
10428
+ LoomaInlineImage,
10320
10429
  LoomaLineBlock,
10321
10430
  Text$1,
10322
10431
  LoomaReference,
@@ -11412,4 +11521,4 @@ function createLoomaSlashCommandExtension(options = {}) {
11412
11521
  });
11413
11522
  }
11414
11523
  //#endregion
11415
- export { LoomaFigure as $, createLoomaMentionExtension as A, navigateTableOfContents as B, getActiveTableCellBackground as C, createSiteRelativeLinks as D, LoomaSmartPaste as E, LoomaImage as F, LoomaLineBlock as G, tableOfContentsTree as H, normalizeImageDimension as I, LOOMA_FOOTNOTE_LABEL as J, LoomaLinkDefinition as K, normalizeImagePlacement as L, MAX_MENTION_RESULT_LIMIT as M, filterLoomaMentionItems as N, siteRelativeHref as O, normalizeMentionResultLimit as P, LoomaFigcaption as Q, LoomaTableOfContents as R, getActiveTableCellAlignment as S, setActiveTableCellBackground as T, LoomaTab as U, normalizeTableOfContentsConfig as V, LoomaTabs as W, LoomaFootnoteReference as X, LoomaFootnote as Y, findLoomaFootnote as Z, getDefaultEditorExtensions as _, NO_TABLE_CAPABILITIES as a, LoomaCallout as at, LoomaTableCell as b, handleTableAction as c, LOOMA_ACTIVE_BLOCK_TYPING_IDLE_MS as ct, normalizeActiveTableColumnWidths as d, LoomaExpand as et, shouldShowTextFormattingToolbar as f, LoomaTableKit as g, selectedTableElement as h, getDefaultSlashCommands as i, normalizeLoomaChipColor as it, DEFAULT_MENTION_RESULT_LIMIT as j, LoomaMentionSuggestionPluginKey as k, handleTableOverlayAction as l, LoomaActiveBlock as lt, selectedTableCellElement as m, createLoomaSlashCommandExtension as n, LOOMA_CHIP_COLORS as nt, focusTableOverlayTarget as o, LOOMA_ACTIVE_BLOCK_BLUR_GRACE_MS as ot, menuAnchorRect as p, LOOMA_FOOTNOTE_INSERTED as q, filterLoomaSlashCommands as r, LoomaChip as rt, getActiveTableUiState as s, LOOMA_ACTIVE_BLOCK_CLASS as st, LoomaSlashCommand as t, revealLoomaExpandAt as tt, insertTableAtRange as u, LoomaActiveBlockPluginKey as ut, getLoomaTableExtensions as v, setActiveTableCellAlignment as w, LoomaTableHeader as x, LoomaTable as y, getTableOfContentsEntries as z };
11524
+ export { LoomaFootnote as $, createLoomaMentionExtension as A, createImageMedia as B, getActiveTableCellBackground as C, createSiteRelativeLinks as D, LoomaSmartPaste as E, LoomaImage as F, normalizeTableOfContentsConfig as G, LoomaTableOfContents as H, LoomaInlineImage as I, LoomaTabs as J, tableOfContentsTree as K, isLoomaImageName as L, MAX_MENTION_RESULT_LIMIT as M, filterLoomaMentionItems as N, siteRelativeHref as O, normalizeMentionResultLimit as P, LOOMA_FOOTNOTE_LABEL as Q, normalizeImageDimension as R, getActiveTableCellAlignment as S, setActiveTableCellBackground as T, getTableOfContentsEntries as U, imageDeliveryAttributes as V, navigateTableOfContents as W, LoomaLinkDefinition as X, LoomaLineBlock as Y, LOOMA_FOOTNOTE_INSERTED as Z, getDefaultEditorExtensions as _, NO_TABLE_CAPABILITIES as a, revealLoomaExpandAt as at, LoomaTableCell as b, handleTableAction as c, normalizeLoomaChipColor as ct, normalizeActiveTableColumnWidths as d, LOOMA_ACTIVE_BLOCK_CLASS as dt, LoomaFootnoteReference as et, shouldShowTextFormattingToolbar as f, LOOMA_ACTIVE_BLOCK_TYPING_IDLE_MS as ft, LoomaTableKit as g, selectedTableElement as h, getDefaultSlashCommands as i, LoomaExpand as it, DEFAULT_MENTION_RESULT_LIMIT as j, LoomaMentionSuggestionPluginKey as k, handleTableOverlayAction as l, LoomaCallout as lt, selectedTableCellElement as m, LoomaActiveBlockPluginKey as mt, createLoomaSlashCommandExtension as n, LoomaFigcaption as nt, focusTableOverlayTarget as o, LOOMA_CHIP_COLORS as ot, menuAnchorRect as p, LoomaActiveBlock as pt, LoomaTab as q, filterLoomaSlashCommands as r, LoomaFigure as rt, getActiveTableUiState as s, LoomaChip as st, LoomaSlashCommand as t, findLoomaFootnote as tt, insertTableAtRange as u, LOOMA_ACTIVE_BLOCK_BLUR_GRACE_MS as ut, getLoomaTableExtensions as v, setActiveTableCellAlignment as w, LoomaTableHeader as x, LoomaTable as y, normalizeImagePlacement as z };
@@ -201,6 +201,7 @@ export declare function createDocumentEditorSession(props: DocumentEditorProps,
201
201
  content: JSONContent;
202
202
  };
203
203
  image: {
204
+ inline: boolean;
204
205
  placement: import(".").LoomaImagePlacement;
205
206
  alt: any;
206
207
  target: string;
@@ -1,4 +1,7 @@
1
1
  import { type AnyExtension } from "@tiptap/core";
2
+ export { imageSourceUrls, mapImageSourceUrls, normalizeImageSources, type LoomaImageSource } from "../image-sources.js";
3
+ /** Both forms use the same portable image attributes and host image controls. */
4
+ export declare const isLoomaImageName: (name: string | undefined) => name is "image" | "loomaInlineImage";
2
5
  /** Durable image placement; wrapping applies to block images in reading content. */
3
6
  export type LoomaImagePlacement = "block" | "center" | "wrap-left" | "wrap-right";
4
7
  /** Accepts only positive, integral CSS-pixel dimensions. */
@@ -10,3 +13,7 @@ export declare function normalizeImagePlacement(value: unknown): LoomaImagePlace
10
13
  * attributes stay transient; dimensions and placement survive HTML and JSON.
11
14
  */
12
15
  export declare const LoomaImage: AnyExtension;
16
+ /** Imported inline images retain their text position.
17
+ * @contract Uses the same durable attributes as a block image without overriding its insertion command.
18
+ */
19
+ export declare const LoomaInlineImage: AnyExtension;
@@ -24,4 +24,4 @@ export { LoomaTable, getActiveTableCellAlignment, getActiveTableCellBackground,
24
24
  export { createLoomaMentionExtension, DEFAULT_MENTION_RESULT_LIMIT, filterLoomaMentionItems, LoomaMentionSuggestionPluginKey, MAX_MENTION_RESULT_LIMIT, normalizeMentionResultLimit, type LoomaMentionItem, type LoomaMentionMenuSnapshot, type LoomaMentionOptions, type LoomaMentionProvider, type LoomaMentionProviderContext, } from "./mention.js";
25
25
  export { createLoomaSlashCommandExtension, getDefaultSlashCommands, filterLoomaSlashCommands, LoomaSlashCommand, type LoomaSlashCommand as LoomaSlashCommandItem, type LoomaSlashCommandContext, type LoomaSlashCommandOptions, type LoomaSlashMenuSnapshot, } from "./slash-command.js";
26
26
  export { siteRelativeHref, createSiteRelativeLinks } from "./relative-links.js";
27
- export { LoomaImage, normalizeImageDimension, normalizeImagePlacement, type LoomaImagePlacement } from "./image.js";
27
+ export { LoomaImage, LoomaInlineImage, imageSourceUrls, mapImageSourceUrls, normalizeImageSources, normalizeImageDimension, normalizeImagePlacement, type LoomaImagePlacement, type LoomaImageSource } from "./image.js";
@@ -1,4 +1,4 @@
1
+ import { _ as LOOMA_CALLOUT_TONES, c as imageSourceUrls, f as LoomaReference, g as setReferenceDisplay, h as referenceDisplay, l as mapImageSourceUrls, m as getReferenceDisplay, p as LoomaReferencePresentation, u as normalizeImageSources } from "../chunks/expressmark.js";
1
2
  import { i as TABLE_CELL_BACKGROUND_PRESETS } from "../chunks/table-overlay.js";
2
- import { $ as LoomaFigure, A as createLoomaMentionExtension, C as getActiveTableCellBackground, D as createSiteRelativeLinks, E as LoomaSmartPaste, F as LoomaImage, G as LoomaLineBlock, I as normalizeImageDimension, J as LOOMA_FOOTNOTE_LABEL, K as LoomaLinkDefinition, L as normalizeImagePlacement, M as MAX_MENTION_RESULT_LIMIT, N as filterLoomaMentionItems, O as siteRelativeHref, P as normalizeMentionResultLimit, Q as LoomaFigcaption, R as LoomaTableOfContents, S as getActiveTableCellAlignment, T as setActiveTableCellBackground, U as LoomaTab, V as normalizeTableOfContentsConfig, W as LoomaTabs, X as LoomaFootnoteReference, Y as LoomaFootnote, Z as findLoomaFootnote, _ as getDefaultEditorExtensions, at as LoomaCallout, b as LoomaTableCell, c as handleTableAction, ct as LOOMA_ACTIVE_BLOCK_TYPING_IDLE_MS, d as normalizeActiveTableColumnWidths, et as LoomaExpand, f as shouldShowTextFormattingToolbar, g as LoomaTableKit, i as getDefaultSlashCommands, it as normalizeLoomaChipColor, j as DEFAULT_MENTION_RESULT_LIMIT, k as LoomaMentionSuggestionPluginKey, l as handleTableOverlayAction, lt as LoomaActiveBlock, n as createLoomaSlashCommandExtension, nt as LOOMA_CHIP_COLORS, ot as LOOMA_ACTIVE_BLOCK_BLUR_GRACE_MS, r as filterLoomaSlashCommands, rt as LoomaChip, s as getActiveTableUiState, st as LOOMA_ACTIVE_BLOCK_CLASS, t as LoomaSlashCommand, tt as revealLoomaExpandAt, u as insertTableAtRange, ut as LoomaActiveBlockPluginKey, v as getLoomaTableExtensions, w as setActiveTableCellAlignment, x as LoomaTableHeader, y as LoomaTable, z as getTableOfContentsEntries } from "../chunks/extensions.js";
3
- import { c as LoomaReferencePresentation, d as setReferenceDisplay, f as LOOMA_CALLOUT_TONES, l as getReferenceDisplay, s as LoomaReference, u as referenceDisplay } from "../chunks/expressmark.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, LoomaFootnote, LoomaFootnoteReference, LoomaImage, 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, insertTableAtRange, normalizeActiveTableColumnWidths, normalizeImageDimension, normalizeImagePlacement, normalizeLoomaChipColor, normalizeMentionResultLimit, normalizeTableOfContentsConfig, referenceDisplay, revealLoomaExpandAt, setActiveTableCellAlignment, setActiveTableCellBackground, setReferenceDisplay, shouldShowTextFormattingToolbar, siteRelativeHref };
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, 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 };
@@ -1,3 +1,5 @@
1
1
  import { Node } from "@tiptap/core";
2
- /** A paragraph-like block whose authored line boundaries remain significant on export. */
2
+ /** A paragraph-like block whose authored line boundaries remain significant on export.
3
+ * @contract Keeps line-block identity through editing, HTML parsing and Markdown export.
4
+ */
3
5
  export declare const LoomaLineBlock: Node<any, any>;
@@ -0,0 +1,10 @@
1
+ import type { Decoration } from "@tiptap/pm/view";
2
+ type Attributes = Record<string, unknown>;
3
+ /** Read the host's transient attributes without adding them to the authored document. */
4
+ export declare const imageDeliveryAttributes: (decorations: readonly Decoration[]) => Attributes;
5
+ /** Projects authored choices and transient delivery onto their native source/img elements. */
6
+ export declare function createImageMedia(): {
7
+ dom: HTMLPictureElement;
8
+ write(attrs: Attributes, delivery: Attributes): void;
9
+ };
10
+ export {};
@@ -0,0 +1,23 @@
1
+ import type { DOMOutputSpec } from "@tiptap/pm/model";
2
+ /** Authored image choices are durable content, independent of host delivery renditions. */
3
+ export interface LoomaImageSource {
4
+ srcset: string;
5
+ media?: string;
6
+ type?: string;
7
+ width?: number;
8
+ height?: number;
9
+ }
10
+ /** Validate every candidate with the maintained srcset parser and documentation URL profile. */
11
+ export declare function normalizeImageSources(value: unknown): LoomaImageSource[];
12
+ /** All authored alternatives, for host authorization and asset rewriting. */
13
+ export declare function imageSourceUrls(value: unknown): string[];
14
+ /** Rewrite authored candidates with the same parser used for validation.
15
+ * @ownership Returns new sources; the caller owns URL allocation and the input stays unchanged.
16
+ * @failure Rejects unsafe URLs and rewrites that change candidate boundaries or descriptors.
17
+ */
18
+ export declare function mapImageSourceUrls(value: unknown, rewrite: (url: string) => string): LoomaImageSource[];
19
+ /** Read one safe native picture without reducing its sources to the fallback image. */
20
+ export declare function readPictureHtml(value: string): Record<string, unknown> | null;
21
+ /** Native image markup shared by HTML serialization and Markdown interchange. */
22
+ export declare function imageHtmlSpec(attrs: Record<string, unknown>, inline?: boolean): DOMOutputSpec;
23
+ export declare function pictureHtml(attrs: Record<string, unknown>, inline?: boolean): string;
package/editor/index.js CHANGED
@@ -1,7 +1,7 @@
1
+ import { _ as LOOMA_CALLOUT_TONES, c as imageSourceUrls, f as LoomaReference, g as setReferenceDisplay, h as referenceDisplay, l as mapImageSourceUrls, m as getReferenceDisplay, p as LoomaReferencePresentation, u as normalizeImageSources, w as __exportAll } from "./chunks/expressmark.js";
1
2
  import { i as TABLE_CELL_BACKGROUND_PRESETS, n as resolveTableCellAt, r as TABLE_CELL_BACKGROUND_OPTIONS, t as measureTableOverlayGeometry } from "./chunks/table-overlay.js";
2
3
  import "./ui.js";
3
- import { $ as LoomaFigure, A as createLoomaMentionExtension, B as navigateTableOfContents, C as getActiveTableCellBackground, D as createSiteRelativeLinks, E as LoomaSmartPaste, F as LoomaImage, G as LoomaLineBlock, H as tableOfContentsTree, I as normalizeImageDimension, J as LOOMA_FOOTNOTE_LABEL, K as LoomaLinkDefinition, L as normalizeImagePlacement, M as MAX_MENTION_RESULT_LIMIT, N as filterLoomaMentionItems, O as siteRelativeHref, P as normalizeMentionResultLimit, Q as LoomaFigcaption, R as LoomaTableOfContents, S as getActiveTableCellAlignment, T as setActiveTableCellBackground, U as LoomaTab, V as normalizeTableOfContentsConfig, W as LoomaTabs, X as LoomaFootnoteReference, Y as LoomaFootnote, Z as findLoomaFootnote, _ as getDefaultEditorExtensions, a as NO_TABLE_CAPABILITIES, at as LoomaCallout, b as LoomaTableCell, c as handleTableAction, ct as LOOMA_ACTIVE_BLOCK_TYPING_IDLE_MS, d as normalizeActiveTableColumnWidths, et as LoomaExpand, f as shouldShowTextFormattingToolbar, g as LoomaTableKit, h as selectedTableElement, i as getDefaultSlashCommands, it as normalizeLoomaChipColor, j as DEFAULT_MENTION_RESULT_LIMIT, k as LoomaMentionSuggestionPluginKey, l as handleTableOverlayAction, lt as LoomaActiveBlock, m as selectedTableCellElement, n as createLoomaSlashCommandExtension, nt as LOOMA_CHIP_COLORS, o as focusTableOverlayTarget, ot as LOOMA_ACTIVE_BLOCK_BLUR_GRACE_MS, p as menuAnchorRect, q as LOOMA_FOOTNOTE_INSERTED, r as filterLoomaSlashCommands, rt as LoomaChip, s as getActiveTableUiState, st as LOOMA_ACTIVE_BLOCK_CLASS, t as LoomaSlashCommand, tt as revealLoomaExpandAt, u as insertTableAtRange, ut as LoomaActiveBlockPluginKey, v as getLoomaTableExtensions, w as setActiveTableCellAlignment, x as LoomaTableHeader, y as LoomaTable, z as getTableOfContentsEntries } from "./chunks/extensions.js";
4
- import { c as LoomaReferencePresentation, d as setReferenceDisplay, f as LOOMA_CALLOUT_TONES, l as getReferenceDisplay, s as LoomaReference, u as referenceDisplay } from "./chunks/expressmark.js";
4
+ import { $ as LoomaFootnote, A as createLoomaMentionExtension, B as createImageMedia, C as getActiveTableCellBackground, D as createSiteRelativeLinks, E as LoomaSmartPaste, F as LoomaImage, G as normalizeTableOfContentsConfig, H as LoomaTableOfContents, I as LoomaInlineImage, J as LoomaTabs, K as tableOfContentsTree, L as isLoomaImageName, 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, V as imageDeliveryAttributes, W as navigateTableOfContents, X as LoomaLinkDefinition, Y as LoomaLineBlock, Z as LOOMA_FOOTNOTE_INSERTED, _ as getDefaultEditorExtensions, a as NO_TABLE_CAPABILITIES, 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, h as selectedTableElement, i as getDefaultSlashCommands, it as LoomaExpand, j as DEFAULT_MENTION_RESULT_LIMIT, k as LoomaMentionSuggestionPluginKey, l as handleTableOverlayAction, lt as LoomaCallout, m as selectedTableCellElement, mt as LoomaActiveBlockPluginKey, n as createLoomaSlashCommandExtension, nt as LoomaFigcaption, o as focusTableOverlayTarget, ot as LOOMA_CHIP_COLORS, p as menuAnchorRect, 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";
5
5
  import { n as validLinkHref } from "./chunks/content.js";
6
6
  import { n as selectionSnapshot, t as createEditorSession } from "./chunks/session.js";
7
7
  import { Extension, isNodeSelection, posToDOMRect } from "@tiptap/core";
@@ -13,18 +13,6 @@ import { createLowlight } from "lowlight";
13
13
  import { AlignCenter, AlignLeft, AlignRight, ArrowLeft, Bell, Bold, BookUser, Braces, Calculator, CalendarDays, Check, ChevronDown, ChevronLeft, ChevronRight, CircleCheck, CircleDot, CircleQuestionMark, CircleX, Clock, CodeXml, Columns3, Compass, CreditCard, Ellipsis, Eraser, ExternalLink, FileText, Folder, GripHorizontal, GripVertical, Heading1, Heading2, Heading3, Highlighter, History, Image, Info, Italic, LayoutDashboard, Lightbulb, Link, List, ListOrdered, ListTodo, LoaderCircle, Menu, Merge, MessageSquareWarning, Minus, Monitor, Moon, NotebookPen, PaintBucket, PanelBottom, PanelLeft, PanelRight, PanelTop, Paperclip, Pencil, Pilcrow, Plus, Quote, Receipt, Redo2, Rows3, Search, Settings, Slash, Split, Strikethrough, Sun, Superscript, Table2, Tag, Trash2, TriangleAlert, Truck, Underline, Undo2, Unlink, UserRound, Users, X } from "lucide";
14
14
  import { componentRegistry } from "@nextwebwg/html-next/runtime";
15
15
  import { IndexedList, NONCONFORMING, READY_INPUT, UNRESOLVED_INPUT, acceptProps, activateModule, armElement, attachGeneratedController, awaitInput, buildTemplate, checkBoolean, checkConstrained, checkFormat, checkInteger, checkList, checkNumber, checkObject, checkString, checkedReferenceValue, clearRegion, computedCycle, defineComponent, detailCheck, dispatchDeclared, dispose, equalValue, evaluateInput, fillSlot, formatOf, forwardAttributes, generatedInputs, hostState, initializeSlot, inputRead, keywordFormat, manageProps, notifyPropertySet, project, readIndex, readMember, readonlyView, readsChanged, rec, recordValue, replaceRoot, resetForwardedAttributes, sharePlainSlots, textCall, toAttribute, toText, trackContainer, truthy, writeAttribute, writeUrlAttribute } from "@nextwebwg/html-next/generated-runtime";
16
- //#region \0rolldown/runtime.js
17
- var __defProp = Object.defineProperty;
18
- var __exportAll = (all, no_symbols) => {
19
- let target = {};
20
- for (var name in all) __defProp(target, name, {
21
- get: all[name],
22
- enumerable: true
23
- });
24
- if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
25
- return target;
26
- };
27
- //#endregion
28
16
  //#region src/editor/icons.ts
29
17
  /** The opinionated Lucide set used by Looma's shipped interaction surfaces. */
30
18
  var LOOMA_ICONS = {
@@ -924,7 +912,7 @@ function createDecorations(doc, resolveSource, resolver, failedRenditions, edita
924
912
  const decorations = [];
925
913
  const currentSources = /* @__PURE__ */ new Set();
926
914
  doc.descendants((node, position) => {
927
- if (node.type.name !== "image") return;
915
+ if (!isLoomaImageName(node.type.name)) return;
928
916
  const image = imageDescriptorFromAttrs(node.attrs);
929
917
  if (!image) return;
930
918
  currentSources.add(image.src);
@@ -938,7 +926,7 @@ function rangeContainsImage(doc, from, to) {
938
926
  const end = Math.max(start, Math.min(to + 1, doc.content.size));
939
927
  let found = false;
940
928
  doc.nodesBetween(start, end, (node) => {
941
- if (node.type.name !== "image") return !found;
929
+ if (!isLoomaImageName(node.type.name)) return !found;
942
930
  found = true;
943
931
  return false;
944
932
  });
@@ -14919,8 +14907,6 @@ defineComponent("ui-image", createUiImage, [
14919
14907
  ]);
14920
14908
  //#endregion
14921
14909
  //#region src/editor/node-views/image.ts
14922
- /** The delivery attributes the editor's decorations lay over the stored ones, such as `srcset`. */
14923
- var deliveryAttributes = (decorations) => Object.assign({}, ...decorations.map((decoration) => decoration.spec.loomaImageAttributes ?? {}));
14924
14910
  /**
14925
14911
  * Projects Image's resize into one document transaction, and draws the stored image with the
14926
14912
  * delivery attributes laid over it.
@@ -14931,27 +14917,9 @@ var deliveryAttributes = (decorations) => Object.assign({}, ...decorations.map((
14931
14917
  */
14932
14918
  var imageNodeView = ({ editor, node, getPos, decorations }) => {
14933
14919
  let current = node;
14934
- let delivery = deliveryAttributes(decorations);
14920
+ let delivery = imageDeliveryAttributes(decorations);
14935
14921
  let selected = false;
14936
- const media = document.createElement("img");
14937
- let written = /* @__PURE__ */ new Set();
14938
- const writeMedia = (attrs) => {
14939
- const next = Object.entries({
14940
- src: attrs.src,
14941
- alt: attrs.alt ?? "",
14942
- title: attrs.title,
14943
- width: attrs.width,
14944
- height: attrs.height,
14945
- ...delivery
14946
- }).filter(([, value]) => value !== void 0 && value !== null && value !== false);
14947
- const names = new Set(next.map(([name]) => name));
14948
- for (const name of written) if (!names.has(name)) media.removeAttribute(name);
14949
- for (const [name, value] of next) {
14950
- const text = value === true ? "" : String(value);
14951
- if (media.getAttribute(name) !== text) media.setAttribute(name, text);
14952
- }
14953
- written = names;
14954
- };
14922
+ const media = createImageMedia();
14955
14923
  const props = (next) => ({
14956
14924
  src: delivery.src ?? next.attrs.src,
14957
14925
  alt: next.attrs.alt ?? "",
@@ -14961,18 +14929,18 @@ var imageNodeView = ({ editor, node, getPos, decorations }) => {
14961
14929
  selected: editor.isEditable && selected,
14962
14930
  resizable: editor.isEditable
14963
14931
  });
14964
- writeMedia(node.attrs);
14932
+ media.write(node.attrs, delivery);
14965
14933
  const image = createUiImage({
14966
14934
  ...props(node),
14967
14935
  attributes: {
14968
14936
  contenteditable: "false",
14969
14937
  "data-looma-image-node": ""
14970
14938
  },
14971
- slots: { media: [media] }
14939
+ slots: { media: [media.dom] }
14972
14940
  });
14973
14941
  const dom = element(image);
14974
14942
  const render = () => {
14975
- writeMedia(current.attrs);
14943
+ media.write(current.attrs, delivery);
14976
14944
  componentRegistry.update(dom, props(current));
14977
14945
  };
14978
14946
  dom.addEventListener("click", (event) => {
@@ -15001,7 +14969,7 @@ var imageNodeView = ({ editor, node, getPos, decorations }) => {
15001
14969
  update(next, nextDecorations) {
15002
14970
  if (next.type !== current.type) return false;
15003
14971
  current = next;
15004
- delivery = deliveryAttributes(nextDecorations);
14972
+ delivery = imageDeliveryAttributes(nextDecorations);
15005
14973
  render();
15006
14974
  return true;
15007
14975
  },
@@ -15869,7 +15837,7 @@ function createDocumentEditorSession(props, options) {
15869
15837
  }));
15870
15838
  const imageTargets = /* @__PURE__ */ new WeakMap();
15871
15839
  let imageTargetSequence = 0;
15872
- const selectedImage = (instance) => instance.state.selection instanceof NodeSelection && instance.state.selection.node.type.name === "image" ? instance.state.selection : null;
15840
+ const selectedImage = (instance) => instance.state.selection instanceof NodeSelection && isLoomaImageName(instance.state.selection.node.type.name) ? instance.state.selection : null;
15873
15841
  const updateSelectedImage = (instance, attrs) => {
15874
15842
  const selection = selectedImage(instance);
15875
15843
  if (!selection || !instance.isEditable) return;
@@ -15886,7 +15854,7 @@ function createDocumentEditorSession(props, options) {
15886
15854
  element,
15887
15855
  pluginKey: "looma-image-actions",
15888
15856
  updateDelay: 250,
15889
- shouldShow: ({ editor: menuEditor }) => menuEditor.isEditable && menuEditor.state.selection instanceof NodeSelection && menuEditor.state.selection.node.type.name === "image",
15857
+ shouldShow: ({ editor: menuEditor }) => menuEditor.isEditable && menuEditor.state.selection instanceof NodeSelection && isLoomaImageName(menuEditor.state.selection.node.type.name),
15890
15858
  anchor: () => {
15891
15859
  const dom = instance.view.nodeDOM(instance.state.selection.from);
15892
15860
  return (dom instanceof Element ? dom.querySelector("img") ?? dom : instance.view.dom).getBoundingClientRect();
@@ -15915,7 +15883,7 @@ function createDocumentEditorSession(props, options) {
15915
15883
  const frame = element.closest("[data-looma-image-node]");
15916
15884
  const position = frame?.parentNode ? instance.view.posAtDOM(frame.parentNode, Array.from(frame.parentNode.childNodes).indexOf(frame)) : instance.view.posAtDOM(element, 0);
15917
15885
  const node = instance.state.doc.nodeAt(position);
15918
- return node?.type.name === "image" ? imageDescriptorFromAttrs(node.attrs) : null;
15886
+ return isLoomaImageName(node?.type.name) && node ? imageDescriptorFromAttrs(node.attrs) : null;
15919
15887
  } catch {
15920
15888
  return null;
15921
15889
  }
@@ -16392,6 +16360,7 @@ function createDocumentEditorSession(props, options) {
16392
16360
  content: uiState.footnoteState.note
16393
16361
  },
16394
16362
  image: {
16363
+ inline: image?.type.name === "loomaInlineImage",
16395
16364
  placement: normalizeImagePlacement(image?.attrs.placement),
16396
16365
  alt: image?.attrs.alt ?? "",
16397
16366
  target: imageTarget
@@ -16876,4 +16845,4 @@ function createToolbarTooltip(onChange, delay = () => 400) {
16876
16845
  };
16877
16846
  }
16878
16847
  //#endregion
16879
- 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, LOOMA_ICONS, LoomaActiveBlock, LoomaActiveBlockPluginKey, LoomaCallout, LoomaChip, LoomaExpand, LoomaFigcaption, LoomaFigure, LoomaFootnote, LoomaFootnoteReference, LoomaImage, LoomaLineBlock, LoomaLinkDefinition, LoomaMentionSuggestionPluginKey, LoomaReference, LoomaReferencePresentation, LoomaSlashCommand, LoomaSmartPaste, LoomaTab, LoomaTable, LoomaTableCell, LoomaTableHeader, LoomaTableKit, LoomaTableOfContents, LoomaTabs, MAX_MENTION_RESULT_LIMIT, TABLE_CELL_BACKGROUND_OPTIONS, TABLE_CELL_BACKGROUND_PRESETS, createDocumentEditorSession, createLoomaMentionExtension, createLoomaSlashCommandExtension, createSiteRelativeLinks, createToolbarTooltip, filterLoomaMentionItems, filterLoomaSlashCommands, findLoomaFootnote, getActiveTableCellAlignment, getActiveTableCellBackground, getActiveTableUiState, getDefaultEditorExtensions, getDefaultSlashCommands, getLoomaTableExtensions, getReferenceDisplay, getTableOfContentsEntries, getVisualViewportRect, handleTableAction, handleTableOverlayAction, insertTableAtRange, loomaIconMarkup, measureTableOverlayGeometry, normalizeActiveTableColumnWidths, normalizeImageDimension, normalizeImagePlacement, normalizeLoomaChipColor, normalizeMentionResultLimit, normalizeTableOfContentsConfig, referenceDisplay, resolveTableCellAt, revealLoomaExpandAt, setActiveTableCellAlignment, setActiveTableCellBackground, setReferenceDisplay, shouldShowTextFormattingToolbar, siteRelativeHref };
16848
+ 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, LOOMA_ICONS, LoomaActiveBlock, LoomaActiveBlockPluginKey, LoomaCallout, LoomaChip, LoomaExpand, LoomaFigcaption, LoomaFigure, 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_OPTIONS, TABLE_CELL_BACKGROUND_PRESETS, createDocumentEditorSession, createLoomaMentionExtension, createLoomaSlashCommandExtension, createSiteRelativeLinks, createToolbarTooltip, filterLoomaMentionItems, filterLoomaSlashCommands, findLoomaFootnote, getActiveTableCellAlignment, getActiveTableCellBackground, getActiveTableUiState, getDefaultEditorExtensions, getDefaultSlashCommands, getLoomaTableExtensions, getReferenceDisplay, getTableOfContentsEntries, getVisualViewportRect, handleTableAction, handleTableOverlayAction, imageSourceUrls, insertTableAtRange, loomaIconMarkup, mapImageSourceUrls, measureTableOverlayGeometry, normalizeActiveTableColumnWidths, normalizeImageDimension, normalizeImagePlacement, normalizeImageSources, normalizeLoomaChipColor, normalizeMentionResultLimit, normalizeTableOfContentsConfig, referenceDisplay, resolveTableCellAt, revealLoomaExpandAt, setActiveTableCellAlignment, setActiveTableCellBackground, setReferenceDisplay, shouldShowTextFormattingToolbar, siteRelativeHref };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@threadlabs/looma",
3
- "version": "0.53.3",
3
+ "version": "0.53.5",
4
4
  "type": "module",
5
5
  "description": "HTML Next UI components, native DOM support and design tokens.",
6
6
  "license": "MIT",
@@ -99,10 +99,12 @@
99
99
  "@nextwebwg/html-next": ">=1.0.0-alpha.92",
100
100
  "@js-temporal/polyfill": "^0.5.1",
101
101
  "dompurify": "3.4.15",
102
- "expressmark": ">=0.5.1",
102
+ "expressmark": ">=0.6.1",
103
103
  "highlight.js": "11.11.2",
104
104
  "lowlight": "^3.3.0",
105
- "lucide": "~0.554.0"
105
+ "lucide": "~0.554.0",
106
+ "htmlparser2": "12.0.0",
107
+ "parse-srcset": "1.0.2"
106
108
  },
107
109
  "peerDependencies": {
108
110
  "@tiptap/core": ">=2 <3",
@@ -307,7 +307,7 @@ export function createUiEditor(options = {}, html) {
307
307
  const n = (P10 ??= buildTemplate(T10)).cloneNode(true);
308
308
  const t0 = n.firstChild.nextSibling;
309
309
  const t1 = t0.firstChild.nextSibling;
310
- const r = { n, a1: t1, v0: null, v1: null, v2: null };
310
+ const r = { n, a1: t1, v0: null, v1: null, v2: null, v3: null };
311
311
  I.r["imageShell"] = t0;
312
312
  I.r["imageTools"] = t1;
313
313
  p10(r, -1, d);
@@ -315,15 +315,18 @@ export function createUiEditor(options = {}, html) {
315
315
  };
316
316
  const p10 = (r, c, d) => {
317
317
  if (c & 1073741825) {
318
- const x0 = readMember(readMember(v[0], "image"), "placement");
319
- const s0 = toAttribute(x0, "placement");
320
- if (s0 !== r.v0) writeAttribute(r.a1, "placement", r.v0 = s0);
321
- const x1 = readMember(readMember(v[0], "image"), "alt");
322
- const s1 = toAttribute(x1, "alt");
323
- if (s1 !== r.v1) writeAttribute(r.a1, "alt", r.v1 = s1);
324
- const x2 = readMember(readMember(v[0], "image"), "target");
325
- const s2 = toAttribute(x2, "target");
326
- if (s2 !== r.v2) writeAttribute(r.a1, "target", r.v2 = s2);
318
+ const x0 = readMember(readMember(v[0], "image"), "inline");
319
+ const s0 = toAttribute(x0, "inline");
320
+ if (s0 !== r.v0) writeAttribute(r.a1, "inline", r.v0 = s0);
321
+ const x1 = readMember(readMember(v[0], "image"), "placement");
322
+ const s1 = toAttribute(x1, "placement");
323
+ if (s1 !== r.v1) writeAttribute(r.a1, "placement", r.v1 = s1);
324
+ const x2 = readMember(readMember(v[0], "image"), "alt");
325
+ const s2 = toAttribute(x2, "alt");
326
+ if (s2 !== r.v2) writeAttribute(r.a1, "alt", r.v2 = s2);
327
+ const x3 = readMember(readMember(v[0], "image"), "target");
328
+ const s3 = toAttribute(x3, "target");
329
+ if (s3 !== r.v3) writeAttribute(r.a1, "target", r.v3 = s3);
327
330
  }
328
331
  };
329
332
  const m11 = (d) => {
@@ -14,6 +14,7 @@ export interface UiEditorImageToolbarElement extends HTMLDivElement {
14
14
  }
15
15
  export interface UiEditorImageToolbarProps {
16
16
  alt?: string | null;
17
+ inline?: boolean | null;
17
18
  placement?: "block" | "center" | "wrap-left" | "wrap-right" | null;
18
19
  target?: string | null;
19
20
  attributes?: Readonly<Record<string, string | number | boolean | null | undefined>>;