@threadlabs/looma 0.29.12 → 0.29.13

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,3 +1,4 @@
1
1
  import { n as TABLE_CELL_BACKGROUND_PRESETS } from "../chunks/table-backgrounds.js";
2
- import { $ as LoomaActiveBlockPluginKey, A as filterLoomaMentionItems, B as LoomaFigcaption, C as loomaMarkdownToHtml, D as createLoomaMentionExtension, E as LoomaMentionSuggestionPluginKey, F as LoomaTableOfContents, G as LoomaChip, H as LoomaExpand, I as getTableOfContentsEntries, J as LOOMA_CALLOUT_TONES, K as normalizeLoomaChipColor, L as normalizeTableOfContentsConfig, M as LoomaImage, N as normalizeImageDimension, O as DEFAULT_MENTION_RESULT_LIMIT, P as normalizeImagePlacement, Q as LoomaActiveBlock, R as LoomaTab, S as loomaMarkdownFromDoc, T as siteRelativeHref, U as revealLoomaExpandAt, V as LoomaFigure, W as LOOMA_CHIP_COLORS, X as LOOMA_ACTIVE_BLOCK_CLASS, Y as LOOMA_ACTIVE_BLOCK_BLUR_GRACE_MS, Z as LOOMA_ACTIVE_BLOCK_TYPING_IDLE_MS, _ as getActiveTableCellAlignment, a as getActiveTableUiState, b as setActiveTableCellBackground, c as insertTableAtRange, d as LoomaTableKit, f as getDefaultEditorExtensions, g as LoomaTableHeader, h as LoomaTableCell, i as getDefaultSlashCommands, j as normalizeMentionResultLimit, k as MAX_MENTION_RESULT_LIMIT, l as normalizeActiveTableColumnWidths, m as LoomaTable, n as createLoomaSlashCommandExtension, o as handleTableAction, p as getLoomaTableExtensions, q as LoomaCallout, r as filterLoomaSlashCommands, s as handleTableOverlayAction, t as LoomaSlashCommand, u as shouldShowTextFormattingToolbar, v as getActiveTableCellBackground, w as createSiteRelativeLinks, x as LoomaSmartPaste, y as setActiveTableCellAlignment, z as LoomaTabs } from "../chunks/extensions.js";
2
+ import { A as filterLoomaMentionItems, B as LoomaFigcaption, C as loomaMarkdownToHtml, D as createLoomaMentionExtension, E as LoomaMentionSuggestionPluginKey, F as LoomaTableOfContents, G as LoomaChip, H as LoomaExpand, I as getTableOfContentsEntries, J as LOOMA_ACTIVE_BLOCK_BLUR_GRACE_MS, K as normalizeLoomaChipColor, L as normalizeTableOfContentsConfig, M as LoomaImage, N as normalizeImageDimension, O as DEFAULT_MENTION_RESULT_LIMIT, P as normalizeImagePlacement, Q as LoomaActiveBlockPluginKey, R as LoomaTab, S as loomaMarkdownFromDoc, T as siteRelativeHref, U as revealLoomaExpandAt, V as LoomaFigure, W as LOOMA_CHIP_COLORS, X as LOOMA_ACTIVE_BLOCK_TYPING_IDLE_MS, Y as LOOMA_ACTIVE_BLOCK_CLASS, Z as LoomaActiveBlock, _ as getActiveTableCellAlignment, a as getActiveTableUiState, b as setActiveTableCellBackground, c as insertTableAtRange, d as LoomaTableKit, f as getDefaultEditorExtensions, g as LoomaTableHeader, h as LoomaTableCell, i as getDefaultSlashCommands, j as normalizeMentionResultLimit, k as MAX_MENTION_RESULT_LIMIT, l as normalizeActiveTableColumnWidths, m as LoomaTable, n as createLoomaSlashCommandExtension, o as handleTableAction, p as getLoomaTableExtensions, q as LoomaCallout, r as filterLoomaSlashCommands, s as handleTableOverlayAction, t as LoomaSlashCommand, u as shouldShowTextFormattingToolbar, v as getActiveTableCellBackground, w as createSiteRelativeLinks, x as LoomaSmartPaste, y as setActiveTableCellAlignment, z as LoomaTabs } from "../chunks/extensions.js";
3
+ import { t as LOOMA_CALLOUT_TONES } from "../chunks/markdown.js";
3
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, LoomaActiveBlock, LoomaActiveBlockPluginKey, LoomaCallout, LoomaChip, LoomaExpand, LoomaFigcaption, LoomaFigure, LoomaImage, LoomaMentionSuggestionPluginKey, LoomaSlashCommand, LoomaSmartPaste, LoomaTab, LoomaTable, LoomaTableCell, LoomaTableHeader, LoomaTableKit, LoomaTableOfContents, LoomaTabs, MAX_MENTION_RESULT_LIMIT, TABLE_CELL_BACKGROUND_PRESETS, createLoomaMentionExtension, createLoomaSlashCommandExtension, createSiteRelativeLinks, filterLoomaMentionItems, filterLoomaSlashCommands, getActiveTableCellAlignment, getActiveTableCellBackground, getActiveTableUiState, getDefaultEditorExtensions, getDefaultSlashCommands, getLoomaTableExtensions, getTableOfContentsEntries, handleTableAction, handleTableOverlayAction, insertTableAtRange, loomaMarkdownFromDoc, loomaMarkdownToHtml, normalizeActiveTableColumnWidths, normalizeImageDimension, normalizeImagePlacement, normalizeLoomaChipColor, normalizeMentionResultLimit, normalizeTableOfContentsConfig, revealLoomaExpandAt, setActiveTableCellAlignment, setActiveTableCellBackground, shouldShowTextFormattingToolbar, siteRelativeHref };
@@ -50,7 +50,7 @@ declare module "@tiptap/core" {
50
50
  }
51
51
  }
52
52
  /**
53
- * Automatic whole-document navigation with durable configuration only.
53
+ * Automatic navigation, or an explicitly authored navigation body imported from a document.
54
54
  * @ownership The schema owns configuration/anchors; node views derive entries.
55
55
  * @lifecycle Headless views subscribe to transactions and unsubscribe on destroy.
56
56
  */
package/editor/index.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import { n as TABLE_CELL_BACKGROUND_PRESETS, t as TABLE_CELL_BACKGROUND_OPTIONS } from "./chunks/table-backgrounds.js";
2
2
  import { n as resolveTableCellAt, t as measureTableOverlayGeometry } from "./chunks/ui.js";
3
- import { $ as LoomaActiveBlockPluginKey, A as filterLoomaMentionItems, B as LoomaFigcaption, C as loomaMarkdownToHtml, D as createLoomaMentionExtension, E as LoomaMentionSuggestionPluginKey, F as LoomaTableOfContents, G as LoomaChip, H as LoomaExpand, I as getTableOfContentsEntries, J as LOOMA_CALLOUT_TONES, K as normalizeLoomaChipColor, L as normalizeTableOfContentsConfig, M as LoomaImage, N as normalizeImageDimension, O as DEFAULT_MENTION_RESULT_LIMIT, P as normalizeImagePlacement, Q as LoomaActiveBlock, R as LoomaTab, S as loomaMarkdownFromDoc, T as siteRelativeHref, U as revealLoomaExpandAt, V as LoomaFigure, W as LOOMA_CHIP_COLORS, X as LOOMA_ACTIVE_BLOCK_CLASS, Y as LOOMA_ACTIVE_BLOCK_BLUR_GRACE_MS, Z as LOOMA_ACTIVE_BLOCK_TYPING_IDLE_MS, _ as getActiveTableCellAlignment, a as getActiveTableUiState, b as setActiveTableCellBackground, c as insertTableAtRange, d as LoomaTableKit, f as getDefaultEditorExtensions, g as LoomaTableHeader, h as LoomaTableCell, i as getDefaultSlashCommands, j as normalizeMentionResultLimit, k as MAX_MENTION_RESULT_LIMIT, l as normalizeActiveTableColumnWidths, m as LoomaTable, n as createLoomaSlashCommandExtension, o as handleTableAction, p as getLoomaTableExtensions, q as LoomaCallout, r as filterLoomaSlashCommands, s as handleTableOverlayAction, t as LoomaSlashCommand, u as shouldShowTextFormattingToolbar, v as getActiveTableCellBackground, w as createSiteRelativeLinks, x as LoomaSmartPaste, y as setActiveTableCellAlignment, z as LoomaTabs } from "./chunks/extensions.js";
3
+ import { A as filterLoomaMentionItems, B as LoomaFigcaption, C as loomaMarkdownToHtml, D as createLoomaMentionExtension, E as LoomaMentionSuggestionPluginKey, F as LoomaTableOfContents, G as LoomaChip, H as LoomaExpand, I as getTableOfContentsEntries, J as LOOMA_ACTIVE_BLOCK_BLUR_GRACE_MS, K as normalizeLoomaChipColor, L as normalizeTableOfContentsConfig, M as LoomaImage, N as normalizeImageDimension, O as DEFAULT_MENTION_RESULT_LIMIT, P as normalizeImagePlacement, Q as LoomaActiveBlockPluginKey, R as LoomaTab, S as loomaMarkdownFromDoc, T as siteRelativeHref, U as revealLoomaExpandAt, V as LoomaFigure, W as LOOMA_CHIP_COLORS, X as LOOMA_ACTIVE_BLOCK_TYPING_IDLE_MS, Y as LOOMA_ACTIVE_BLOCK_CLASS, Z as LoomaActiveBlock, _ as getActiveTableCellAlignment, a as getActiveTableUiState, b as setActiveTableCellBackground, c as insertTableAtRange, d as LoomaTableKit, f as getDefaultEditorExtensions, g as LoomaTableHeader, h as LoomaTableCell, i as getDefaultSlashCommands, j as normalizeMentionResultLimit, k as MAX_MENTION_RESULT_LIMIT, l as normalizeActiveTableColumnWidths, m as LoomaTable, n as createLoomaSlashCommandExtension, o as handleTableAction, p as getLoomaTableExtensions, q as LoomaCallout, r as filterLoomaSlashCommands, s as handleTableOverlayAction, t as LoomaSlashCommand, u as shouldShowTextFormattingToolbar, v as getActiveTableCellBackground, w as createSiteRelativeLinks, x as LoomaSmartPaste, y as setActiveTableCellAlignment, z as LoomaTabs } from "./chunks/extensions.js";
4
+ import { t as LOOMA_CALLOUT_TONES } from "./chunks/markdown.js";
4
5
  import { AlignCenter, AlignLeft, AlignRight, ArrowLeft, Bell, Bold, BookUser, Braces, Calculator, Check, ChevronDown, ChevronLeft, ChevronRight, CircleCheck, CircleDot, CircleQuestionMark, CircleX, 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, Merge, MessageSquareWarning, Minus, NotebookPen, PaintBucket, PanelBottom, PanelLeft, PanelRight, PanelTop, Pencil, Pilcrow, Plus, Quote, Receipt, Redo2, Rows3, Search, Settings, Split, Strikethrough, Table2, Tag, Trash2, TriangleAlert, Truck, Underline, Undo2, Unlink, UserRound, Users, X } from "lucide";
5
6
  //#region src/editor/icons.ts
6
7
  /** The opinionated Lucide set used by Looma's shipped interaction surfaces. */
@@ -3,6 +3,6 @@ import type { NodeViewRenderer } from "@tiptap/core";
3
3
  * Composes a table of contents and its settings from Looma's components.
4
4
  * @lifecycle The view follows the document and rebuilds its entries when they change; the components
5
5
  * disconnect once ProseMirror removes its element, and destroying the view stops following the editor.
6
- * Only the saved configuration enters editor state.
6
+ * Imported authored links stay in the node body; automatic TOCs store only configuration.
7
7
  */
8
8
  export declare const tableOfContentsNodeView: NodeViewRenderer;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@threadlabs/looma",
3
- "version": "0.29.12",
3
+ "version": "0.29.13",
4
4
  "type": "module",
5
5
  "description": "Looma components as HTML, Vue, and plain DOM, with design tokens.",
6
6
  "license": "MIT",
@@ -77,6 +77,11 @@
77
77
  "types": "./vue/editor/compact/index.d.ts",
78
78
  "import": "./vue/editor/compact/index.js",
79
79
  "default": "./vue/editor/compact/index.js"
80
+ },
81
+ "./editor/expressmark": {
82
+ "types": "./editor/expressmark.d.ts",
83
+ "import": "./editor/expressmark.js",
84
+ "default": "./editor/expressmark.js"
80
85
  }
81
86
  },
82
87
  "files": [
@@ -89,7 +94,8 @@
89
94
  "styles/",
90
95
  "*.css",
91
96
  "README.md",
92
- "LICENSE"
97
+ "LICENSE",
98
+ "EXPRESSIVE-MARKDOWN.md"
93
99
  ],
94
100
  "sideEffects": [
95
101
  "./dist/index.js",
@@ -102,7 +108,8 @@
102
108
  "highlight.js": "11.11.2",
103
109
  "lowlight": "^3.3.0",
104
110
  "markdown-it": "14.3.1",
105
- "lucide": "~0.554.0"
111
+ "lucide": "~0.554.0",
112
+ "expressmark": "0.1.0"
106
113
  },
107
114
  "peerDependencies": {
108
115
  "@nextwebwg/html-next": "1.0.0-alpha.57",
package/vue/UiTabs.vue CHANGED
@@ -41,7 +41,7 @@ const propValidityContract = {
41
41
  required: false,
42
42
  target: { attribute: 'group' },
43
43
  description:
44
- 'Tabs with the same nonempty group share one selection: choosing a tab selects the tab with the same label in every other Tabs of that group in the\n document, and the choice is remembered for the next visit. Use it for alternatives a reader picks once, such as a package manager or language.',
44
+ 'Tabs with the same nonempty group share one selection: choosing a tab selects the tab with the same data-value (or label when no value is authored) in every other Tabs of that group in the\n document, and the choice is remembered for the next visit. Use it for alternatives a reader picks once, such as a package manager or language.',
45
45
  default: '',
46
46
  },
47
47
  label: {
@@ -74,7 +74,7 @@ const propValidityContract = {
74
74
  required: false,
75
75
  target: { attribute: 'value' },
76
76
  description:
77
- 'The id of the selected panel, initially or when set externally; empty selects the first panel. Choosing a tab updates it from there and reports a select\n event. A panel without an id is given a generated one.',
77
+ 'The id or authored data-value of the selected panel, initially or when set externally; empty selects the first panel. Choosing a tab updates it from there and reports a select\n event. A panel without an id is given a generated one.',
78
78
  default: '',
79
79
  },
80
80
  },
@@ -86,7 +86,7 @@ var UiTabs_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE_
86
86
  },
87
87
  required: false,
88
88
  target: { attribute: "group" },
89
- description: "Tabs with the same nonempty group share one selection: choosing a tab selects the tab with the same label in every other Tabs of that group in the\n document, and the choice is remembered for the next visit. Use it for alternatives a reader picks once, such as a package manager or language.",
89
+ description: "Tabs with the same nonempty group share one selection: choosing a tab selects the tab with the same data-value (or label when no value is authored) in every other Tabs of that group in the\n document, and the choice is remembered for the next visit. Use it for alternatives a reader picks once, such as a package manager or language.",
90
90
  default: ""
91
91
  },
92
92
  label: {
@@ -127,7 +127,7 @@ var UiTabs_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE_
127
127
  },
128
128
  required: false,
129
129
  target: { attribute: "value" },
130
- description: "The id of the selected panel, initially or when set externally; empty selects the first panel. Choosing a tab updates it from there and reports a select\n event. A panel without an id is given a generated one.",
130
+ description: "The id or authored data-value of the selected panel, initially or when set externally; empty selects the first panel. Choosing a tab updates it from there and reports a select\n event. A panel without an id is given a generated one.",
131
131
  default: ""
132
132
  }
133
133
  } };
@@ -317,6 +317,6 @@ var UiTabs_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE_
317
317
  }]]);
318
318
  };
319
319
  }
320
- }), [["__scopeId", "data-v-ca8d7194"]]);
320
+ }), [["__scopeId", "data-v-d0e7c6e5"]]);
321
321
  //#endregion
322
322
  export { UiTabs_default as t };
@@ -10,8 +10,8 @@ import { RequestEvent, updateComponentProps } from "@nextwebwg/html-next/runtime
10
10
  import "@tiptap/pm/tables";
11
11
  import "@tiptap/pm/transform";
12
12
  import { closeHistory } from "@tiptap/pm/history";
13
- import { IndexedList, NONCONFORMING, acceptProps, armElement, attachGeneratedController, buildTemplate, checkBoolean, checkConstrained, checkFormat, checkInteger, checkNumber, checkObject, checkSelected, checkString, clearRegion, computedCycle, detailCheck, dispatchDeclared, dispose, fillSlot, formatOf, hostState, keywordFormat, manageProps, project, readIndex, readMember, readonlyView, readsChanged, rec, replaceRoot, textCall, toAttribute, toText, trackContainer, truthy, writeAttribute, writeUrlAttribute } from "@nextwebwg/html-next/generated-runtime";
14
13
  import { DOMParser, DOMSerializer, Fragment as Fragment$1 } from "@tiptap/pm/model";
14
+ import { IndexedList, NONCONFORMING, acceptProps, armElement, attachGeneratedController, buildTemplate, checkBoolean, checkConstrained, checkFormat, checkInteger, checkNumber, checkObject, checkSelected, checkString, clearRegion, computedCycle, detailCheck, dispatchDeclared, dispose, fillSlot, formatOf, hostState, keywordFormat, manageProps, project, readIndex, readMember, readonlyView, readsChanged, rec, replaceRoot, textCall, toAttribute, toText, trackContainer, truthy, writeAttribute, writeUrlAttribute } from "@nextwebwg/html-next/generated-runtime";
15
15
  export * from "@threadlabs/looma/editor";
16
16
  //#region src/vue/editor/primitives.ts
17
17
  /** Each Vue editor component's element tag, for tooling that enumerates them. */
@@ -10398,9 +10398,13 @@ async function navigateTableOfContents(editor, id) {
10398
10398
  target.tabIndex = -1;
10399
10399
  target.focus({ preventScroll: true });
10400
10400
  }
10401
+ function importAuthoredNavigation(element, schema) {
10402
+ return DOMParser.fromSchema(schema).parse(element).content;
10403
+ }
10401
10404
  Node$1.create({
10402
10405
  name: "loomaTableOfContents",
10403
10406
  group: "block",
10407
+ content: "block*",
10404
10408
  atom: true,
10405
10409
  selectable: true,
10406
10410
  isolating: true,
@@ -10420,8 +10424,25 @@ Node$1.create({
10420
10424
  }
10421
10425
  };
10422
10426
  },
10423
- parseHTML: () => [{ tag: "nav[data-looma-toc]" }],
10427
+ parseHTML: () => [{
10428
+ tag: "nav[data-looma-toc]",
10429
+ getContent: (element, schema) => {
10430
+ if (!(element instanceof HTMLElement) || !element.hasAttribute("data-authored-body")) return Fragment$1.empty;
10431
+ return importAuthoredNavigation(element, schema);
10432
+ }
10433
+ }],
10424
10434
  renderHTML({ node }) {
10435
+ if (node.childCount) return [
10436
+ "nav",
10437
+ {
10438
+ "data-looma-toc": "",
10439
+ "data-authored-body": "",
10440
+ "data-format": node.attrs.format,
10441
+ "data-depth": node.attrs.depth,
10442
+ "aria-label": "Table of contents"
10443
+ },
10444
+ 0
10445
+ ];
10425
10446
  return contentsHtml(this.editor?.view?.state.doc ?? node, normalizeTableOfContentsConfig$1(node.attrs));
10426
10447
  },
10427
10448
  addCommands() {
@@ -10437,8 +10458,15 @@ Node$1.create({
10437
10458
  dom.contentEditable = "false";
10438
10459
  let current = node;
10439
10460
  const render = () => {
10440
- const { dom: content } = DOMSerializer.renderSpec(document, contentsHtml(editor.state.doc, normalizeTableOfContentsConfig$1(current.attrs)));
10441
- dom.replaceChildren(content);
10461
+ if (current.childCount) {
10462
+ const nav = document.createElement("nav");
10463
+ nav.setAttribute("aria-label", "Table of contents");
10464
+ nav.append(DOMSerializer.fromSchema(editor.schema).serializeFragment(current.content));
10465
+ dom.replaceChildren(nav);
10466
+ } else {
10467
+ const { dom: content } = DOMSerializer.renderSpec(document, contentsHtml(editor.state.doc, normalizeTableOfContentsConfig$1(current.attrs)));
10468
+ dom.replaceChildren(content);
10469
+ }
10442
10470
  };
10443
10471
  dom.addEventListener("click", (event) => {
10444
10472
  const anchor = event.target.closest("a");
@@ -10498,7 +10526,7 @@ var choiceLabel = (field, config) => field === "format" ? FORMAT_LABELS[config.f
10498
10526
  * Composes a table of contents and its settings from Looma's components.
10499
10527
  * @lifecycle The view follows the document and rebuilds its entries when they change; the components
10500
10528
  * disconnect once ProseMirror removes its element, and destroying the view stops following the editor.
10501
- * Only the saved configuration enters editor state.
10529
+ * Imported authored links stay in the node body; automatic TOCs store only configuration.
10502
10530
  */
10503
10531
  var tableOfContentsNodeView = ({ editor, node, getPos }) => {
10504
10532
  const id = `looma-toc-${++tocSequence}`;
@@ -10536,6 +10564,14 @@ var tableOfContentsNodeView = ({ editor, node, getPos }) => {
10536
10564
  }));
10537
10565
  const renderEntries = () => {
10538
10566
  const { format, depth } = config();
10567
+ if (current.childCount) {
10568
+ const signature = JSON.stringify(current.content.toJSON());
10569
+ if (signature !== shown) {
10570
+ shown = signature;
10571
+ entries.replaceChildren(DOMSerializer.fromSchema(editor.schema).serializeFragment(current.content));
10572
+ }
10573
+ return;
10574
+ }
10539
10575
  const found = getTableOfContentsEntries(editor.state.doc, depth);
10540
10576
  const signature = JSON.stringify([format, found.map(({ id: entryId, text, level }) => [
10541
10577
  entryId,
@@ -10709,7 +10745,7 @@ var tableOfContentsNodeView = ({ editor, node, getPos }) => {
10709
10745
  settingsButton,
10710
10746
  popover,
10711
10747
  tooltip
10712
- ]) author.hidden = !editable;
10748
+ ]) author.hidden = !editable || current.childCount > 0;
10713
10749
  if (!editable) setSettingsOpen(false);
10714
10750
  renderEntries();
10715
10751
  };