@threadlabs/looma 0.15.7 → 0.16.1

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.
@@ -9132,6 +9236,7 @@ function getDefaultEditorExtensions(options = {}) {
9132
9236
  TaskItem.configure({ nested: false }),
9133
9237
  Blockquote,
9134
9238
  LoomaCallout,
9239
+ LoomaChip,
9135
9240
  HorizontalRule,
9136
9241
  HardBreak,
9137
9242
  History,
@@ -9582,7 +9687,7 @@ var CALLOUT_COMMANDS = [
9582
9687
  * @ownership Returned command objects belong to the caller and are recreated
9583
9688
  * per call so one editor cannot mutate another editor's command inventory.
9584
9689
  */
9585
- function getDefaultSlashCommands(onOpenImagePicker) {
9690
+ function getDefaultSlashCommands(onOpenImagePicker, onOpenChipEditor) {
9586
9691
  return [
9587
9692
  {
9588
9693
  title: "Text",
@@ -9679,6 +9784,20 @@ function getDefaultSlashCommands(onOpenImagePicker) {
9679
9784
  editor.chain().focus().deleteRange(range).setLoomaCallout(tone).run();
9680
9785
  }
9681
9786
  })),
9787
+ {
9788
+ title: "Chip",
9789
+ description: "Inline label with text and color",
9790
+ icon: "tag",
9791
+ keywords: [
9792
+ "chip",
9793
+ "label",
9794
+ "badge",
9795
+ "tag"
9796
+ ],
9797
+ command: ({ editor, range }) => {
9798
+ if (editor.chain().focus().deleteRange(range).setTextSelection(range.from).insertLoomaChip({ label: "" }).run()) onOpenChipEditor?.(editor, range.from);
9799
+ }
9800
+ },
9682
9801
  {
9683
9802
  title: "Inline code",
9684
9803
  description: "Monospace code span",
@@ -9801,7 +9920,7 @@ var LoomaSlashCommand = Extension.create({
9801
9920
  startOfLine: false,
9802
9921
  items: ({ query }) => {
9803
9922
  const normalized = query.toLowerCase().trim();
9804
- const commands = this.options.commands.length > 0 ? this.options.commands : getDefaultSlashCommands(this.options.onOpenImagePicker);
9923
+ const commands = this.options.commands.length > 0 ? this.options.commands : getDefaultSlashCommands(this.options.onOpenImagePicker, this.options.onOpenChipEditor);
9805
9924
  if (!normalized) return commands;
9806
9925
  return commands.filter((command) => command.title.toLowerCase().includes(normalized) || command.keywords.some((keyword) => keyword.includes(normalized)));
9807
9926
  },
@@ -9864,10 +9983,11 @@ var LoomaSlashCommand = Extension.create({
9864
9983
  */
9865
9984
  function createLoomaSlashCommandExtension(options = {}) {
9866
9985
  const onOpenImagePicker = options.onOpenImagePicker;
9986
+ const onOpenChipEditor = options.onOpenChipEditor;
9867
9987
  return LoomaSlashCommand.configure({
9868
9988
  ...options,
9869
- commands: options.commands ?? getDefaultSlashCommands(onOpenImagePicker)
9989
+ commands: options.commands ?? getDefaultSlashCommands(onOpenImagePicker, onOpenChipEditor)
9870
9990
  });
9871
9991
  }
9872
9992
  //#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 };
9993
+ 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.15.7",
3
+ "version": "0.16.1",
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
 
@@ -12,6 +12,7 @@ export interface UiDialogProps {
12
12
  closedby?: "any" | "closerequest" | "none" | null;
13
13
  for?: string | null;
14
14
  label?: string | null;
15
+ modal?: boolean | null;
15
16
  modeless?: boolean | null;
16
17
  open?: boolean | null;
17
18
  size?: "sm" | "md" | "lg" | "fullscreen" | null;
@@ -3,7 +3,7 @@ import { manageComponentLifecycle } from "@nextwebwg/html-next/runtime";
3
3
  import * as controller from "../components/ui-dialog/ui-dialog.js";
4
4
  import "../styles/ui-dialog.css";
5
5
 
6
- const definition = {...{"contract":{"tag":"ui-dialog","props":{"alert":{"type":"boolean","required":false,"target":{"attribute":"alert"},"default":false},"closedby":{"type":{"enum":["any","closerequest","none"]},"required":false,"target":{"attribute":"closedby"},"default":"closerequest"},"for":{"type":"string","required":false,"target":{"attribute":"for"},"default":""},"label":{"type":"string","required":false,"target":{"attribute":"label"}},"modeless":{"type":"boolean","required":false,"target":{"attribute":"modeless"},"default":false},"open":{"type":"boolean","required":false,"target":{"attribute":"open"},"default":false},"size":{"type":{"enum":["sm","md","lg","fullscreen"]},"required":false,"target":{"attribute":"size"},"default":"md"}}},"template":{"kind":"element","name":"dialog","attributes":[{"kind":"attribute","name":"aria-label","expression":"accessibleLabel","expressionPlan":{"source":"accessibleLabel","ast":{"kind":"id","name":"accessibleLabel"},"dependencies":["accessibleLabel"]}}],"children":[{"kind":"element","name":"header","attributes":[],"children":[{"kind":"element","name":"h2","attributes":[{"kind":"literal","name":"class","value":"title"},{"kind":"directive","name":"value","expression":"label","expressionPlan":{"source":"label","ast":{"kind":"id","name":"label"},"dependencies":["label"]}}],"children":[],"flow":{"kind":"if","test":"label","testPlan":{"source":"label","ast":{"kind":"id","name":"label"},"dependencies":["label"]}}},{"kind":"element","name":"button","attributes":[{"kind":"literal","name":"class","value":"close"},{"kind":"literal","name":"type","value":"button"},{"kind":"literal","name":"aria-label","value":"Close"}],"children":[],"ref":"close"}]},{"kind":"element","name":"div","attributes":[{"kind":"literal","name":"class","value":"body"}],"children":[{"kind":"slot"}]},{"kind":"element","name":"footer","attributes":[],"children":[{"kind":"slot","fallback":[],"name":"actions"}]}]},"declarations":[{"kind":"state","name":"internalOpen","expression":{"source":"false","ast":{"kind":"literal","value":false},"dependencies":[]}},{"kind":"state","name":"accessibleLabel","expression":{"source":"'Dialog'","ast":{"kind":"literal","value":"Dialog"},"dependencies":[]}},{"kind":"event","name":"open","type":"object({ open: boolean, reason: action | programmatic, trigger: keyboard | pointer | programmatic })","bubbles":true,"composed":true,"cancelable":false},{"kind":"event","name":"close","type":"object({ open: boolean, reason: action | programmatic | light-dismiss | escape, trigger: keyboard | pointer | programmatic })","bubbles":true,"composed":true,"cancelable":false}],"root":{"kind":"native","element":"dialog","choices":["dialog"]}},source:{file:import.meta.url},css:""};
6
+ const definition = {...{"contract":{"tag":"ui-dialog","props":{"alert":{"type":"boolean","required":false,"target":{"attribute":"alert"},"default":false},"closedby":{"type":{"enum":["any","closerequest","none"]},"required":false,"target":{"attribute":"closedby"}},"for":{"type":"string","required":false,"target":{"attribute":"for"},"default":""},"label":{"type":"string","required":false,"target":{"attribute":"label"}},"modal":{"type":"boolean","required":false,"target":{"attribute":"modal"},"default":false},"modeless":{"type":"boolean","required":false,"target":{"attribute":"modeless"},"default":false},"open":{"type":"boolean","required":false,"target":{"attribute":"open"},"default":false},"size":{"type":{"enum":["sm","md","lg","fullscreen"]},"required":false,"target":{"attribute":"size"},"default":"md"}}},"template":{"kind":"element","name":"dialog","attributes":[{"kind":"attribute","name":"aria-label","expression":"accessibleLabel","expressionPlan":{"source":"accessibleLabel","ast":{"kind":"id","name":"accessibleLabel"},"dependencies":["accessibleLabel"]}}],"children":[{"kind":"element","name":"header","attributes":[],"children":[{"kind":"element","name":"h2","attributes":[{"kind":"literal","name":"class","value":"title"},{"kind":"directive","name":"value","expression":"label","expressionPlan":{"source":"label","ast":{"kind":"id","name":"label"},"dependencies":["label"]}}],"children":[],"flow":{"kind":"if","test":"label","testPlan":{"source":"label","ast":{"kind":"id","name":"label"},"dependencies":["label"]}}},{"kind":"element","name":"button","attributes":[{"kind":"literal","name":"class","value":"close"},{"kind":"literal","name":"type","value":"button"},{"kind":"literal","name":"aria-label","value":"Close"}],"children":[],"ref":"close"}]},{"kind":"element","name":"div","attributes":[{"kind":"literal","name":"class","value":"body"}],"children":[{"kind":"slot"}]},{"kind":"element","name":"footer","attributes":[],"children":[{"kind":"slot","fallback":[],"name":"actions"}]}]},"declarations":[{"kind":"state","name":"internalOpen","expression":{"source":"false","ast":{"kind":"literal","value":false},"dependencies":[]}},{"kind":"state","name":"accessibleLabel","expression":{"source":"'Dialog'","ast":{"kind":"literal","value":"Dialog"},"dependencies":[]}},{"kind":"event","name":"open","type":"object({ open: boolean, reason: action | programmatic, trigger: keyboard | pointer | programmatic })","bubbles":true,"composed":true,"cancelable":false},{"kind":"event","name":"close","type":"object({ open: boolean, reason: action | programmatic | light-dismiss | escape, trigger: keyboard | pointer | programmatic })","bubbles":true,"composed":true,"cancelable":false}],"root":{"kind":"native","element":"dialog","choices":["dialog"]}},source:{file:import.meta.url},css:""};
7
7
 
8
8
  export function createUiDialog(options = {}) {
9
9
  const { attributes = {}, children = [], slots = {}, ...componentProps } = options;