@threadlabs/looma 0.16.0 → 0.16.2

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.
@@ -172,6 +172,110 @@ var LoomaCallout = Node$1.create({
172
172
  }
173
173
  });
174
174
  //#endregion
175
+ //#region src/editor/extensions/chip.ts
176
+ /** The six palette values a chip may persist; other values fall back to neutral. */
177
+ var LOOMA_CHIP_COLORS = [
178
+ "neutral",
179
+ "blue",
180
+ "green",
181
+ "yellow",
182
+ "red",
183
+ "purple"
184
+ ];
185
+ var CHIP_PLACEHOLDER = "Set a label";
186
+ /** Keep imported or programmatic colors within the supported palette. */
187
+ function normalizeLoomaChipColor(value) {
188
+ return LOOMA_CHIP_COLORS.includes(value) ? value : "neutral";
189
+ }
190
+ /**
191
+ * An inline, atomic label. The editor's popover edits its attributes; its text
192
+ * remains available in serialized HTML and plain-text copy.
193
+ *
194
+ * @invariant Only the label and a supported palette color enter document state;
195
+ * the clickable node view never stores its transient popover controls.
196
+ */
197
+ var LoomaChip = Node$1.create({
198
+ name: "loomaChip",
199
+ group: "inline",
200
+ inline: true,
201
+ atom: true,
202
+ selectable: true,
203
+ addAttributes() {
204
+ return {
205
+ label: {
206
+ default: "",
207
+ parseHTML: (element) => element.getAttribute("data-label") ?? (element.hasAttribute("data-placeholder") ? "" : element.textContent ?? "")
208
+ },
209
+ color: {
210
+ default: "neutral",
211
+ parseHTML: (element) => normalizeLoomaChipColor(element.getAttribute("data-color"))
212
+ }
213
+ };
214
+ },
215
+ parseHTML() {
216
+ return [{ tag: "span[data-looma-chip]" }];
217
+ },
218
+ renderHTML({ node }) {
219
+ const label = String(node.attrs.label ?? "");
220
+ return [
221
+ "span",
222
+ {
223
+ "data-looma-chip": "",
224
+ "data-label": label,
225
+ "data-color": normalizeLoomaChipColor(node.attrs.color),
226
+ ...label ? {} : { "data-placeholder": "" }
227
+ },
228
+ label || CHIP_PLACEHOLDER
229
+ ];
230
+ },
231
+ renderText({ node }) {
232
+ return String(node.attrs.label ?? "");
233
+ },
234
+ addNodeView() {
235
+ return ({ node, editor }) => {
236
+ const dom = document.createElement("span");
237
+ dom.dataset.loomaChip = "";
238
+ dom.contentEditable = "false";
239
+ dom.setAttribute("role", "button");
240
+ dom.setAttribute("aria-disabled", String(!editor.isEditable));
241
+ dom.tabIndex = 0;
242
+ const update = (next) => {
243
+ if (next.type !== node.type) return false;
244
+ const label = String(next.attrs.label ?? "");
245
+ if (dom.dataset.label !== label) {
246
+ dom.dataset.label = label;
247
+ dom.textContent = label || CHIP_PLACEHOLDER;
248
+ dom.setAttribute("aria-label", label ? `Edit chip: ${label}` : "Set chip label");
249
+ if (label) delete dom.dataset.placeholder;
250
+ else dom.dataset.placeholder = "";
251
+ }
252
+ const color = normalizeLoomaChipColor(next.attrs.color);
253
+ if (dom.dataset.color !== color) dom.dataset.color = color;
254
+ return true;
255
+ };
256
+ update(node);
257
+ return {
258
+ dom,
259
+ update,
260
+ stopEvent: (event) => event.type === "click" || event.type === "keydown"
261
+ };
262
+ };
263
+ },
264
+ addCommands() {
265
+ return { insertLoomaChip: (attributes = {}) => ({ commands, state }) => {
266
+ const selection = state.selection;
267
+ const label = attributes.label ?? state.doc.textBetween(selection.from, selection.to);
268
+ return commands.insertContent({
269
+ type: this.name,
270
+ attrs: {
271
+ label,
272
+ color: normalizeLoomaChipColor(attributes.color)
273
+ }
274
+ });
275
+ } };
276
+ }
277
+ });
278
+ //#endregion
175
279
  //#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
176
280
  /**
177
281
  * The default document node which represents the top level node of the editor.
@@ -8512,6 +8616,17 @@ function looksLikeMarkdown(value) {
8512
8616
  ].includes(child.type)));
8513
8617
  });
8514
8618
  }
8619
+ function hasRichClipboardStructure(value) {
8620
+ if (!value.trim()) return false;
8621
+ const body = new globalThis.DOMParser().parseFromString(value, "text/html").body;
8622
+ const pre = body.querySelector("pre");
8623
+ if (pre && body.textContent?.trim() === pre.textContent?.trim()) return false;
8624
+ const outsideSource = (selector) => [...body.querySelectorAll(selector)].some((element) => !element.closest("pre, code"));
8625
+ if (outsideSource("h1, h2, h3, h4, h5, h6, ul, ol, li, blockquote, table, th, td, strong, em, b, i, a, img, hr, [data-looma-chip], [data-looma-mention]")) return true;
8626
+ if (outsideSource("[style]")) return true;
8627
+ if (body.querySelector("[data-pm-slice]") && !body.querySelector("pre")) return true;
8628
+ return body.querySelectorAll("p").length > 1;
8629
+ }
8515
8630
  function parseHtmlSlice(schema, value) {
8516
8631
  const parsed = new globalThis.DOMParser().parseFromString(value, "text/html");
8517
8632
  if (parsed.body.style.display === "none") return Slice.empty;
@@ -8558,6 +8673,7 @@ var LoomaSmartPaste = Extension.create({
8558
8673
  if (selectionIsInsideCodeBlock(view.state.selection.$from.parent.type.name)) return false;
8559
8674
  const plainText = event.clipboardData.getData("text/plain");
8560
8675
  if (!plainText.trim()) return false;
8676
+ if (hasRichClipboardStructure(event.clipboardData.getData("text/html"))) return false;
8561
8677
  const slice = documentSlice(view.state.schema, plainText);
8562
8678
  if (!slice) return false;
8563
8679
  if (slice.size === 0) return true;
@@ -9132,6 +9248,7 @@ function getDefaultEditorExtensions(options = {}) {
9132
9248
  TaskItem.configure({ nested: false }),
9133
9249
  Blockquote,
9134
9250
  LoomaCallout,
9251
+ LoomaChip,
9135
9252
  HorizontalRule,
9136
9253
  HardBreak,
9137
9254
  History,
@@ -9582,7 +9699,7 @@ var CALLOUT_COMMANDS = [
9582
9699
  * @ownership Returned command objects belong to the caller and are recreated
9583
9700
  * per call so one editor cannot mutate another editor's command inventory.
9584
9701
  */
9585
- function getDefaultSlashCommands(onOpenImagePicker) {
9702
+ function getDefaultSlashCommands(onOpenImagePicker, onOpenChipEditor) {
9586
9703
  return [
9587
9704
  {
9588
9705
  title: "Text",
@@ -9679,6 +9796,20 @@ function getDefaultSlashCommands(onOpenImagePicker) {
9679
9796
  editor.chain().focus().deleteRange(range).setLoomaCallout(tone).run();
9680
9797
  }
9681
9798
  })),
9799
+ {
9800
+ title: "Chip",
9801
+ description: "Inline label with text and color",
9802
+ icon: "tag",
9803
+ keywords: [
9804
+ "chip",
9805
+ "label",
9806
+ "badge",
9807
+ "tag"
9808
+ ],
9809
+ command: ({ editor, range }) => {
9810
+ if (editor.chain().focus().deleteRange(range).setTextSelection(range.from).insertLoomaChip({ label: "" }).run()) onOpenChipEditor?.(editor, range.from);
9811
+ }
9812
+ },
9682
9813
  {
9683
9814
  title: "Inline code",
9684
9815
  description: "Monospace code span",
@@ -9801,7 +9932,7 @@ var LoomaSlashCommand = Extension.create({
9801
9932
  startOfLine: false,
9802
9933
  items: ({ query }) => {
9803
9934
  const normalized = query.toLowerCase().trim();
9804
- const commands = this.options.commands.length > 0 ? this.options.commands : getDefaultSlashCommands(this.options.onOpenImagePicker);
9935
+ const commands = this.options.commands.length > 0 ? this.options.commands : getDefaultSlashCommands(this.options.onOpenImagePicker, this.options.onOpenChipEditor);
9805
9936
  if (!normalized) return commands;
9806
9937
  return commands.filter((command) => command.title.toLowerCase().includes(normalized) || command.keywords.some((keyword) => keyword.includes(normalized)));
9807
9938
  },
@@ -9864,10 +9995,11 @@ var LoomaSlashCommand = Extension.create({
9864
9995
  */
9865
9996
  function createLoomaSlashCommandExtension(options = {}) {
9866
9997
  const onOpenImagePicker = options.onOpenImagePicker;
9998
+ const onOpenChipEditor = options.onOpenChipEditor;
9867
9999
  return LoomaSlashCommand.configure({
9868
10000
  ...options,
9869
- commands: options.commands ?? getDefaultSlashCommands(onOpenImagePicker)
10001
+ commands: options.commands ?? getDefaultSlashCommands(onOpenImagePicker, onOpenChipEditor)
9870
10002
  });
9871
10003
  }
9872
10004
  //#endregion
9873
- export { LOOMA_ACTIVE_BLOCK_CLASS as A, DEFAULT_MENTION_RESULT_LIMIT as C, LOOMA_CALLOUT_TONES as D, normalizeMentionResultLimit as E, LoomaActiveBlock as M, LoomaActiveBlockPluginKey as N, LoomaCallout as O, createLoomaMentionExtension as S, filterLoomaMentionItems as T, getActiveTableCellBackground as _, handleTableAction as a, LoomaSmartPaste as b, normalizeActiveTableColumnWidths as c, getDefaultEditorExtensions as d, getLoomaTableExtensions as f, getActiveTableCellAlignment as g, LoomaTableHeader as h, getActiveTableUiState as i, LOOMA_ACTIVE_BLOCK_TYPING_IDLE_MS as j, LOOMA_ACTIVE_BLOCK_BLUR_GRACE_MS as k, shouldShowTextFormattingToolbar as l, LoomaTableCell as m, createLoomaSlashCommandExtension as n, handleTableOverlayAction as o, LoomaTable as p, getDefaultSlashCommands as r, insertTableAtRange as s, LoomaSlashCommand as t, LoomaTableKit as u, setActiveTableCellAlignment as v, MAX_MENTION_RESULT_LIMIT as w, LoomaMentionSuggestionPluginKey as x, setActiveTableCellBackground as y };
10005
+ export { LOOMA_CALLOUT_TONES as A, DEFAULT_MENTION_RESULT_LIMIT as C, LOOMA_CHIP_COLORS as D, normalizeMentionResultLimit as E, LoomaActiveBlock as F, LoomaActiveBlockPluginKey as I, LOOMA_ACTIVE_BLOCK_BLUR_GRACE_MS as M, LOOMA_ACTIVE_BLOCK_CLASS as N, LoomaChip as O, LOOMA_ACTIVE_BLOCK_TYPING_IDLE_MS as P, createLoomaMentionExtension as S, filterLoomaMentionItems as T, getActiveTableCellBackground as _, handleTableAction as a, LoomaSmartPaste as b, normalizeActiveTableColumnWidths as c, getDefaultEditorExtensions as d, getLoomaTableExtensions as f, getActiveTableCellAlignment as g, LoomaTableHeader as h, getActiveTableUiState as i, LoomaCallout as j, normalizeLoomaChipColor as k, shouldShowTextFormattingToolbar as l, LoomaTableCell as m, createLoomaSlashCommandExtension as n, handleTableOverlayAction as o, LoomaTable as p, getDefaultSlashCommands as r, insertTableAtRange as s, LoomaSlashCommand as t, LoomaTableKit as u, setActiveTableCellAlignment as v, MAX_MENTION_RESULT_LIMIT as w, LoomaMentionSuggestionPluginKey as x, setActiveTableCellBackground as y };
@@ -0,0 +1,26 @@
1
+ import { Node } from "@tiptap/core";
2
+ /** The six palette values a chip may persist; other values fall back to neutral. */
3
+ export declare const LOOMA_CHIP_COLORS: readonly ["neutral", "blue", "green", "yellow", "red", "purple"];
4
+ /** A persisted chip color shared by the headless extension and its editor UI. */
5
+ export type LoomaChipColor = typeof LOOMA_CHIP_COLORS[number];
6
+ /** Keep imported or programmatic colors within the supported palette. */
7
+ export declare function normalizeLoomaChipColor(value: unknown): LoomaChipColor;
8
+ declare module "@tiptap/core" {
9
+ interface Commands<ReturnType> {
10
+ loomaChip: {
11
+ /** Replace selected text, or insert at the caret, with an inline chip. */
12
+ insertLoomaChip: (attributes?: {
13
+ label?: string;
14
+ color?: LoomaChipColor;
15
+ }) => ReturnType;
16
+ };
17
+ }
18
+ }
19
+ /**
20
+ * An inline, atomic label. The editor's popover edits its attributes; its text
21
+ * remains available in serialized HTML and plain-text copy.
22
+ *
23
+ * @invariant Only the label and a supported palette color enter document state;
24
+ * the clickable node view never stores its transient popover controls.
25
+ */
26
+ export declare const LoomaChip: Node<any, any>;
@@ -8,6 +8,7 @@
8
8
  */
9
9
  export { LOOMA_ACTIVE_BLOCK_BLUR_GRACE_MS, LOOMA_ACTIVE_BLOCK_CLASS, LOOMA_ACTIVE_BLOCK_TYPING_IDLE_MS, LoomaActiveBlock, LoomaActiveBlockPluginKey, } from "./active-block.js";
10
10
  export { LoomaCallout, LOOMA_CALLOUT_TONES, type LoomaCalloutTone, } from "./callout.js";
11
+ export { LoomaChip, LOOMA_CHIP_COLORS, normalizeLoomaChipColor, type LoomaChipColor } from "./chip.js";
11
12
  export { getDefaultEditorExtensions, getLoomaTableExtensions, LoomaTableKit, type DefaultEditorExtensionsOptions, } from "./preset.js";
12
13
  export { LoomaSmartPaste } from "./smart-paste.js";
13
14
  export { getActiveTableUiState, handleTableAction, handleTableOverlayAction, insertTableAtRange, normalizeActiveTableColumnWidths, shouldShowTextFormattingToolbar, type ActiveTableUiState, type InsertTableAtRangeOptions, type TableActionCapabilities, } from "./table-commands.js";
@@ -1,3 +1,3 @@
1
1
  import { n as TABLE_CELL_BACKGROUND_PRESETS } from "../chunks/table-backgrounds.js";
2
- import { A as LOOMA_ACTIVE_BLOCK_CLASS, C as DEFAULT_MENTION_RESULT_LIMIT, D as LOOMA_CALLOUT_TONES, E as normalizeMentionResultLimit, M as LoomaActiveBlock, N as LoomaActiveBlockPluginKey, O as LoomaCallout, S as createLoomaMentionExtension, T as filterLoomaMentionItems, _ as getActiveTableCellBackground, a as handleTableAction, b as LoomaSmartPaste, c as normalizeActiveTableColumnWidths, d as getDefaultEditorExtensions, f as getLoomaTableExtensions, g as getActiveTableCellAlignment, h as LoomaTableHeader, i as getActiveTableUiState, j as LOOMA_ACTIVE_BLOCK_TYPING_IDLE_MS, k as LOOMA_ACTIVE_BLOCK_BLUR_GRACE_MS, l as shouldShowTextFormattingToolbar, m as LoomaTableCell, n as createLoomaSlashCommandExtension, o as handleTableOverlayAction, p as LoomaTable, r as getDefaultSlashCommands, s as insertTableAtRange, t as LoomaSlashCommand, u as LoomaTableKit, v as setActiveTableCellAlignment, w as MAX_MENTION_RESULT_LIMIT, x as LoomaMentionSuggestionPluginKey, y as setActiveTableCellBackground } from "../chunks/extensions.js";
3
- export { DEFAULT_MENTION_RESULT_LIMIT, LOOMA_ACTIVE_BLOCK_BLUR_GRACE_MS, LOOMA_ACTIVE_BLOCK_CLASS, LOOMA_ACTIVE_BLOCK_TYPING_IDLE_MS, LOOMA_CALLOUT_TONES, LoomaActiveBlock, LoomaActiveBlockPluginKey, LoomaCallout, LoomaMentionSuggestionPluginKey, LoomaSlashCommand, LoomaSmartPaste, LoomaTable, LoomaTableCell, LoomaTableHeader, LoomaTableKit, MAX_MENTION_RESULT_LIMIT, TABLE_CELL_BACKGROUND_PRESETS, createLoomaMentionExtension, createLoomaSlashCommandExtension, filterLoomaMentionItems, getActiveTableCellAlignment, getActiveTableCellBackground, getActiveTableUiState, getDefaultEditorExtensions, getDefaultSlashCommands, getLoomaTableExtensions, handleTableAction, handleTableOverlayAction, insertTableAtRange, normalizeActiveTableColumnWidths, normalizeMentionResultLimit, setActiveTableCellAlignment, setActiveTableCellBackground, shouldShowTextFormattingToolbar };
2
+ import { A as LOOMA_CALLOUT_TONES, C as DEFAULT_MENTION_RESULT_LIMIT, D as LOOMA_CHIP_COLORS, E as normalizeMentionResultLimit, F as LoomaActiveBlock, I as LoomaActiveBlockPluginKey, M as LOOMA_ACTIVE_BLOCK_BLUR_GRACE_MS, N as LOOMA_ACTIVE_BLOCK_CLASS, O as LoomaChip, P as LOOMA_ACTIVE_BLOCK_TYPING_IDLE_MS, S as createLoomaMentionExtension, T as filterLoomaMentionItems, _ as getActiveTableCellBackground, a as handleTableAction, b as LoomaSmartPaste, c as normalizeActiveTableColumnWidths, d as getDefaultEditorExtensions, f as getLoomaTableExtensions, g as getActiveTableCellAlignment, h as LoomaTableHeader, i as getActiveTableUiState, j as LoomaCallout, k as normalizeLoomaChipColor, l as shouldShowTextFormattingToolbar, m as LoomaTableCell, n as createLoomaSlashCommandExtension, o as handleTableOverlayAction, p as LoomaTable, r as getDefaultSlashCommands, s as insertTableAtRange, t as LoomaSlashCommand, u as LoomaTableKit, v as setActiveTableCellAlignment, w as MAX_MENTION_RESULT_LIMIT, x as LoomaMentionSuggestionPluginKey, y as setActiveTableCellBackground } from "../chunks/extensions.js";
3
+ 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, LoomaMentionSuggestionPluginKey, LoomaSlashCommand, LoomaSmartPaste, LoomaTable, LoomaTableCell, LoomaTableHeader, LoomaTableKit, MAX_MENTION_RESULT_LIMIT, TABLE_CELL_BACKGROUND_PRESETS, createLoomaMentionExtension, createLoomaSlashCommandExtension, filterLoomaMentionItems, getActiveTableCellAlignment, getActiveTableCellBackground, getActiveTableUiState, getDefaultEditorExtensions, getDefaultSlashCommands, getLoomaTableExtensions, handleTableAction, handleTableOverlayAction, insertTableAtRange, normalizeActiveTableColumnWidths, normalizeLoomaChipColor, normalizeMentionResultLimit, setActiveTableCellAlignment, setActiveTableCellBackground, shouldShowTextFormattingToolbar };
@@ -48,6 +48,7 @@ export interface LoomaSlashCommandOptions {
48
48
  commands: LoomaSlashCommand[];
49
49
  onStateChange?: (state: LoomaSlashMenuSnapshot) => void;
50
50
  onOpenImagePicker?: () => void;
51
+ onOpenChipEditor?: (editor: Editor, position: number) => void;
51
52
  }
52
53
  /**
53
54
  * Builds Looma's default command policy as fresh objects for one editor.
@@ -57,7 +58,7 @@ export interface LoomaSlashCommandOptions {
57
58
  * @ownership Returned command objects belong to the caller and are recreated
58
59
  * per call so one editor cannot mutate another editor's command inventory.
59
60
  */
60
- export declare function getDefaultSlashCommands(onOpenImagePicker?: () => void): LoomaSlashCommand[];
61
+ export declare function getDefaultSlashCommands(onOpenImagePicker?: () => void, onOpenChipEditor?: (editor: Editor, position: number) => void): LoomaSlashCommand[];
61
62
  /**
62
63
  * Framework-neutral slash-command extension used by the turnkey editor.
63
64
  * Consumers embedding Looma into their own Tiptap instance can configure the
package/editor/icons.d.ts CHANGED
@@ -56,6 +56,7 @@ export declare const LOOMA_ICONS: {
56
56
  settings: IconNode;
57
57
  split: IconNode;
58
58
  strikethrough: IconNode;
59
+ tag: IconNode;
59
60
  table: IconNode;
60
61
  trash: IconNode;
61
62
  'triangle-alert': IconNode;
package/editor/index.js CHANGED
@@ -1,7 +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 { A as LOOMA_ACTIVE_BLOCK_CLASS, C as DEFAULT_MENTION_RESULT_LIMIT, D as LOOMA_CALLOUT_TONES, E as normalizeMentionResultLimit, M as LoomaActiveBlock, N as LoomaActiveBlockPluginKey, O as LoomaCallout, S as createLoomaMentionExtension, T as filterLoomaMentionItems, _ as getActiveTableCellBackground, a as handleTableAction, b as LoomaSmartPaste, c as normalizeActiveTableColumnWidths, d as getDefaultEditorExtensions, f as getLoomaTableExtensions, g as getActiveTableCellAlignment, h as LoomaTableHeader, i as getActiveTableUiState, j as LOOMA_ACTIVE_BLOCK_TYPING_IDLE_MS, k as LOOMA_ACTIVE_BLOCK_BLUR_GRACE_MS, l as shouldShowTextFormattingToolbar, m as LoomaTableCell, n as createLoomaSlashCommandExtension, o as handleTableOverlayAction, p as LoomaTable, r as getDefaultSlashCommands, s as insertTableAtRange, t as LoomaSlashCommand, u as LoomaTableKit, v as setActiveTableCellAlignment, w as MAX_MENTION_RESULT_LIMIT, x as LoomaMentionSuggestionPluginKey, y as setActiveTableCellBackground } from "./chunks/extensions.js";
4
- import { AlignCenter, AlignLeft, AlignRight, ArrowLeft, Bold, BookUser, Braces, Calculator, Check, ChevronDown, ChevronLeft, ChevronRight, CircleCheck, CircleDot, CircleQuestionMark, CircleX, CodeXml, Columns3, CreditCard, Ellipsis, Eraser, FileText, Folder, GripHorizontal, GripVertical, Heading1, Heading2, Heading3, Highlighter, Image, Info, Italic, LayoutDashboard, Link, List, ListOrdered, ListTodo, LoaderCircle, Merge, Minus, NotebookPen, PaintBucket, PanelBottom, PanelLeft, PanelRight, PanelTop, Pilcrow, Plus, Quote, Receipt, Redo2, Rows3, Settings, Split, Strikethrough, Table2, Trash2, TriangleAlert, Truck, Underline, Undo2, UserRound, Users, X } from "lucide";
3
+ import { A as LOOMA_CALLOUT_TONES, C as DEFAULT_MENTION_RESULT_LIMIT, D as LOOMA_CHIP_COLORS, E as normalizeMentionResultLimit, F as LoomaActiveBlock, I as LoomaActiveBlockPluginKey, M as LOOMA_ACTIVE_BLOCK_BLUR_GRACE_MS, N as LOOMA_ACTIVE_BLOCK_CLASS, O as LoomaChip, P as LOOMA_ACTIVE_BLOCK_TYPING_IDLE_MS, S as createLoomaMentionExtension, T as filterLoomaMentionItems, _ as getActiveTableCellBackground, a as handleTableAction, b as LoomaSmartPaste, c as normalizeActiveTableColumnWidths, d as getDefaultEditorExtensions, f as getLoomaTableExtensions, g as getActiveTableCellAlignment, h as LoomaTableHeader, i as getActiveTableUiState, j as LoomaCallout, k as normalizeLoomaChipColor, l as shouldShowTextFormattingToolbar, m as LoomaTableCell, n as createLoomaSlashCommandExtension, o as handleTableOverlayAction, p as LoomaTable, r as getDefaultSlashCommands, s as insertTableAtRange, t as LoomaSlashCommand, u as LoomaTableKit, v as setActiveTableCellAlignment, w as MAX_MENTION_RESULT_LIMIT, x as LoomaMentionSuggestionPluginKey, y as setActiveTableCellBackground } from "./chunks/extensions.js";
4
+ import { AlignCenter, AlignLeft, AlignRight, ArrowLeft, Bold, BookUser, Braces, Calculator, Check, ChevronDown, ChevronLeft, ChevronRight, CircleCheck, CircleDot, CircleQuestionMark, CircleX, CodeXml, Columns3, CreditCard, Ellipsis, Eraser, FileText, Folder, GripHorizontal, GripVertical, Heading1, Heading2, Heading3, Highlighter, Image, Info, Italic, LayoutDashboard, Link, List, ListOrdered, ListTodo, LoaderCircle, Merge, Minus, NotebookPen, PaintBucket, PanelBottom, PanelLeft, PanelRight, PanelTop, Pilcrow, Plus, Quote, Receipt, Redo2, Rows3, Settings, Split, Strikethrough, Table2, Tag, Trash2, TriangleAlert, Truck, Underline, Undo2, UserRound, Users, X } from "lucide";
5
5
  //#region src/editor/icons.ts
6
6
  /** The opinionated Lucide set used by Looma's shipped interaction surfaces. */
7
7
  var LOOMA_ICONS = {
@@ -60,6 +60,7 @@ var LOOMA_ICONS = {
60
60
  settings: Settings,
61
61
  split: Split,
62
62
  strikethrough: Strikethrough,
63
+ tag: Tag,
63
64
  table: Table2,
64
65
  trash: Trash2,
65
66
  "triangle-alert": TriangleAlert,
@@ -113,4 +114,4 @@ function getVisualViewportRect(owner = window) {
113
114
  };
114
115
  }
115
116
  //#endregion
116
- 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_ICONS, LoomaActiveBlock, LoomaActiveBlockPluginKey, LoomaCallout, LoomaMentionSuggestionPluginKey, LoomaSlashCommand, LoomaSmartPaste, LoomaTable, LoomaTableCell, LoomaTableHeader, LoomaTableKit, MAX_MENTION_RESULT_LIMIT, TABLE_CELL_BACKGROUND_OPTIONS, TABLE_CELL_BACKGROUND_PRESETS, createLoomaMentionExtension, createLoomaSlashCommandExtension, filterLoomaMentionItems, getActiveTableCellAlignment, getActiveTableCellBackground, getActiveTableUiState, getDefaultEditorExtensions, getDefaultSlashCommands, getLoomaTableExtensions, getVisualViewportRect, handleTableAction, handleTableOverlayAction, insertTableAtRange, loomaIconMarkup, measureTableOverlayGeometry, normalizeActiveTableColumnWidths, normalizeMentionResultLimit, resolveTableCellAt, setActiveTableCellAlignment, setActiveTableCellBackground, shouldShowTextFormattingToolbar };
117
+ 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_ICONS, LoomaActiveBlock, LoomaActiveBlockPluginKey, LoomaCallout, LoomaChip, LoomaMentionSuggestionPluginKey, LoomaSlashCommand, LoomaSmartPaste, LoomaTable, LoomaTableCell, LoomaTableHeader, LoomaTableKit, MAX_MENTION_RESULT_LIMIT, TABLE_CELL_BACKGROUND_OPTIONS, TABLE_CELL_BACKGROUND_PRESETS, createLoomaMentionExtension, createLoomaSlashCommandExtension, filterLoomaMentionItems, getActiveTableCellAlignment, getActiveTableCellBackground, getActiveTableUiState, getDefaultEditorExtensions, getDefaultSlashCommands, getLoomaTableExtensions, getVisualViewportRect, handleTableAction, handleTableOverlayAction, insertTableAtRange, loomaIconMarkup, measureTableOverlayGeometry, normalizeActiveTableColumnWidths, normalizeLoomaChipColor, normalizeMentionResultLimit, resolveTableCellAt, setActiveTableCellAlignment, setActiveTableCellBackground, shouldShowTextFormattingToolbar };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@threadlabs/looma",
3
- "version": "0.16.0",
3
+ "version": "0.16.2",
4
4
  "type": "module",
5
5
  "description": "Looma components as HTML, Vue, and plain DOM, with design tokens.",
6
6
  "license": "MIT",
@@ -49,8 +49,8 @@
49
49
  :scope {
50
50
  --_badge-surface: var(--ui-surface-subtle);
51
51
  --_badge-text: var(--ui-text-secondary);
52
- /* Every tone's edge is its fill, so it is unseen until forced colors draw it. */
53
- --_badge-border: var(--ui-surface-subtle);
52
+ /* Sit between the soft fill and its stronger theme ink. */
53
+ --_badge-border: color-mix(in srgb, var(--_badge-surface) 75%, var(--_badge-text) 25%);
54
54
  /* --ui-badge-color derives a wash and an ink from one colour, between the tone and the explicit
55
55
  surface, text, and border hooks. Each value is invalid, so the tone shows, while it is unset. The
56
56
  mixes keep 4.5:1 text contrast for any colour, in a light theme or a dark one. */
@@ -58,7 +58,7 @@
58
58
  --_badge-color-wash: color-mix(in oklab, var(--_ui-badge-color) 15%, var(--ui-surface-default));
59
59
  --_badge-color-ink: color-mix(in oklab, var(--_ui-badge-color) 35%, var(--ui-text-primary));
60
60
  --_badge-color-surface: var(--_badge-color-wash);
61
- --_badge-color-border: var(--_badge-color-wash);
61
+ --_badge-color-border: color-mix(in srgb, var(--_badge-color-wash) 75%, var(--_badge-color-ink) 25%);
62
62
  --_badge-color-text: var(--_badge-color-ink);
63
63
  --_badge-outline-surface: var(--ui-badge-surface, var(--_badge-color-surface, var(--_badge-surface)));
64
64
 
@@ -124,31 +124,26 @@
124
124
 
125
125
  :scope[data-ui-badge-state~="variant=subtle"][data-ui-badge-state~="tone=accent"] {
126
126
  --_badge-surface: var(--ui-accent-soft);
127
- --_badge-border: var(--ui-accent-soft);
128
127
  --_badge-text: var(--ui-accent-subtle-text, var(--ui-accent-solid));
129
128
  }
130
129
 
131
130
  :scope[data-ui-badge-state~="variant=subtle"][data-ui-badge-state~="tone=danger"] {
132
131
  --_badge-surface: var(--ui-danger-soft);
133
- --_badge-border: var(--ui-danger-soft);
134
132
  --_badge-text: var(--ui-danger-subtle-text, var(--ui-danger-solid));
135
133
  }
136
134
 
137
135
  :scope[data-ui-badge-state~="variant=subtle"][data-ui-badge-state~="tone=success"] {
138
136
  --_badge-surface: var(--ui-success-soft);
139
- --_badge-border: var(--ui-success-soft);
140
137
  --_badge-text: var(--ui-success-subtle-text, var(--ui-success-solid));
141
138
  }
142
139
 
143
140
  :scope[data-ui-badge-state~="variant=subtle"][data-ui-badge-state~="tone=warning"] {
144
141
  --_badge-surface: var(--ui-warning-soft);
145
- --_badge-border: var(--ui-warning-soft);
146
142
  --_badge-text: var(--ui-warning-subtle-text, var(--ui-warning-solid));
147
143
  }
148
144
 
149
145
  :scope[data-ui-badge-state~="variant=subtle"][data-ui-badge-state~="tone=info"] {
150
146
  --_badge-surface: var(--ui-info-soft);
151
- --_badge-border: var(--ui-info-soft);
152
147
  --_badge-text: var(--ui-info-subtle-text, var(--ui-info-solid));
153
148
  }
154
149