@threadlabs/looma 0.23.21 → 0.23.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/shared/overlay.js +1 -1
- package/components/ui-button/ui-button.html +68 -2
- package/components/ui-image/ui-image.html +177 -0
- package/components/ui-image/ui-image.js +107 -0
- package/components/ui-menu/ui-menu.js +1 -1
- package/components/ui-popover/ui-popover.js +4 -1
- package/components/ui-separator/ui-separator.html +26 -2
- package/dist/index.js +24 -23
- package/editor/chunks/extensions.js +633 -20
- package/editor/extensions/block-selection.d.ts +6 -0
- package/editor/extensions/expand.d.ts +31 -0
- package/editor/extensions/image.d.ts +12 -0
- package/editor/extensions/index.d.ts +4 -1
- package/editor/extensions/index.js +2 -2
- package/editor/extensions/preset.d.ts +8 -0
- package/editor/extensions/slash-command.d.ts +31 -3
- package/editor/extensions/table-of-contents.d.ts +58 -0
- package/editor/index.js +2 -2
- package/package.json +1 -1
- package/styles/ui-button.css +39 -0
- package/styles/ui-image.css +153 -0
- package/styles/ui-separator.css +22 -2
- package/vanilla/UiButton.d.ts +1 -1
- package/vanilla/UiButton.js +126 -10
- package/vanilla/UiImage.d.ts +21 -0
- package/vanilla/UiImage.js +84 -0
- package/vanilla/UiSeparator.d.ts +3 -0
- package/vanilla/UiSeparator.js +14 -4
- package/vanilla/index.js +1 -0
- package/vue/UiButton.d.ts +18 -6
- package/vue/UiButton.vue +269 -8
- package/vue/UiImage.d.ts +100 -0
- package/vue/UiImage.js +2 -0
- package/vue/UiImage.vue +463 -0
- package/vue/UiListItem.d.ts +1 -1
- package/vue/UiSection.d.ts +1 -1
- package/vue/UiSeparator.d.ts +27 -0
- package/vue/UiSeparator.vue +94 -3
- package/vue/UiSidebar.d.ts +1 -1
- package/vue/chunks/UiButton.js +196 -12
- package/vue/chunks/UiImage.js +313 -0
- package/vue/chunks/UiSeparator.js +106 -22
- package/vue/components.css +252 -53
- package/vue/editor/LoomaEditor.d.ts +19 -2
- package/vue/editor/divider.d.ts +6 -0
- package/vue/editor/expand.d.ts +7 -0
- package/vue/editor/image-controls.d.ts +19 -0
- package/vue/editor/image-delivery.d.ts +2 -2
- package/vue/editor/image.d.ts +7 -0
- package/vue/editor/index.d.ts +1 -1
- package/vue/editor/index.js +1188 -52
- package/vue/editor/table-of-contents.d.ts +7 -0
- package/vue/index.d.ts +1 -0
- package/vue/index.js +2 -1
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Extension } from "@tiptap/core";
|
|
2
|
+
/** Selects atomic visual blocks by pointer and keeps text Tab input in the document.
|
|
3
|
+
* @contract List and table keymaps run first; Shift-Tab outside a list remains
|
|
4
|
+
* browser navigation so keyboard users can leave the editing surface.
|
|
5
|
+
*/
|
|
6
|
+
export declare const LoomaBlockSelection: Extension<any, any>;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Node, type Editor, type NodeViewRenderer } from "@tiptap/core";
|
|
2
|
+
/** Saved presentation; a reader's temporary toggle never changes these values. */
|
|
3
|
+
export interface LoomaExpandAttributes {
|
|
4
|
+
summary: string;
|
|
5
|
+
open: boolean;
|
|
6
|
+
}
|
|
7
|
+
interface ExpandOptions {
|
|
8
|
+
nodeView: NodeViewRenderer | null;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Reveals collapsed ancestors before a host navigates to a document position.
|
|
12
|
+
* @contract Navigation changes presentation only, including in read-only mode.
|
|
13
|
+
*/
|
|
14
|
+
export declare function revealLoomaExpandAt(editor: Editor, position: number): Promise<void>;
|
|
15
|
+
declare module "@tiptap/core" {
|
|
16
|
+
interface Commands<ReturnType> {
|
|
17
|
+
loomaExpand: {
|
|
18
|
+
/** Insert an independent section and place the caret in its body. */
|
|
19
|
+
insertLoomaExpand: (attributes?: Partial<LoomaExpandAttributes>) => ReturnType;
|
|
20
|
+
/** Leave an enclosing section by creating an ordinary paragraph after it. */
|
|
21
|
+
exitLoomaExpand: () => ReturnType;
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* A block container whose summary and initial expansion survive serialization.
|
|
27
|
+
* @ownership The document owns attributes/body; node views own reader toggles.
|
|
28
|
+
* @lifecycle Default views unregister their editor subscriptions on destroy.
|
|
29
|
+
*/
|
|
30
|
+
export declare const LoomaExpand: Node<ExpandOptions, any>;
|
|
31
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type AnyExtension } from "@tiptap/core";
|
|
2
|
+
/** Durable image placement; wrapping applies to block images in reading content. */
|
|
3
|
+
export type LoomaImagePlacement = "block" | "center" | "wrap-left" | "wrap-right";
|
|
4
|
+
/** Accepts only positive, integral CSS-pixel dimensions. */
|
|
5
|
+
export declare function normalizeImageDimension(value: unknown): number | undefined;
|
|
6
|
+
/** Unknown legacy values retain ordinary block placement. */
|
|
7
|
+
export declare function normalizeImagePlacement(value: unknown): LoomaImagePlacement;
|
|
8
|
+
/** Portable image attributes shared by every editor adapter.
|
|
9
|
+
* @contract Keeps Tiptap's existing `image` name and insertion command. Delivery
|
|
10
|
+
* attributes stay transient; dimensions and placement survive HTML and JSON.
|
|
11
|
+
*/
|
|
12
|
+
export declare const LoomaImage: AnyExtension;
|
|
@@ -9,10 +9,13 @@
|
|
|
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
11
|
export { LoomaChip, LOOMA_CHIP_COLORS, normalizeLoomaChipColor, type LoomaChipColor } from "./chip.js";
|
|
12
|
+
export { LoomaExpand, revealLoomaExpandAt, type LoomaExpandAttributes } from "./expand.js";
|
|
13
|
+
export { LoomaTableOfContents, getTableOfContentsEntries, normalizeTableOfContentsConfig, type LoomaTableOfContentsConfig, type LoomaTableOfContentsEntry, type LoomaTableOfContentsFormat, } from "./table-of-contents.js";
|
|
12
14
|
export { getDefaultEditorExtensions, getLoomaTableExtensions, LoomaTableKit, type DefaultEditorExtensionsOptions, type LoomaCodeLanguages, } from "./preset.js";
|
|
13
15
|
export { LoomaSmartPaste } from "./smart-paste.js";
|
|
14
16
|
export { getActiveTableUiState, handleTableAction, handleTableOverlayAction, insertTableAtRange, normalizeActiveTableColumnWidths, shouldShowTextFormattingToolbar, type ActiveTableUiState, type InsertTableAtRangeOptions, type TableActionCapabilities, } from "./table-commands.js";
|
|
15
17
|
export { LoomaTable, getActiveTableCellAlignment, getActiveTableCellBackground, LoomaTableCell, LoomaTableHeader, setActiveTableCellAlignment, setActiveTableCellBackground, TABLE_CELL_BACKGROUND_PRESETS, type TableCellAlignment, type TableCellBackground, } from "./table-formatting.js";
|
|
16
18
|
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";
|
|
17
|
-
export { createLoomaSlashCommandExtension, getDefaultSlashCommands, LoomaSlashCommand, type LoomaSlashCommand as LoomaSlashCommandItem, type LoomaSlashCommandContext, type LoomaSlashCommandOptions, type LoomaSlashMenuSnapshot, } from "./slash-command.js";
|
|
19
|
+
export { createLoomaSlashCommandExtension, getDefaultSlashCommands, filterLoomaSlashCommands, LoomaSlashCommand, type LoomaSlashCommand as LoomaSlashCommandItem, type LoomaSlashCommandContext, type LoomaSlashCommandOptions, type LoomaSlashMenuSnapshot, } from "./slash-command.js";
|
|
18
20
|
export { siteRelativeHref, createSiteRelativeLinks } from "./relative-links.js";
|
|
21
|
+
export { LoomaImage, normalizeImageDimension, normalizeImagePlacement, type LoomaImagePlacement } from "./image.js";
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { n as TABLE_CELL_BACKGROUND_PRESETS } from "../chunks/table-backgrounds.js";
|
|
2
|
-
import { A as
|
|
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, createSiteRelativeLinks, filterLoomaMentionItems, getActiveTableCellAlignment, getActiveTableCellBackground, getActiveTableUiState, getDefaultEditorExtensions, getDefaultSlashCommands, getLoomaTableExtensions, handleTableAction, handleTableOverlayAction, insertTableAtRange, normalizeActiveTableColumnWidths, normalizeLoomaChipColor, normalizeMentionResultLimit, setActiveTableCellAlignment, setActiveTableCellBackground, shouldShowTextFormattingToolbar, siteRelativeHref };
|
|
2
|
+
import { A as LoomaImage, B as normalizeLoomaChipColor, C as siteRelativeHref, D as MAX_MENTION_RESULT_LIMIT, E as DEFAULT_MENTION_RESULT_LIMIT, F as normalizeTableOfContentsConfig, G as LOOMA_ACTIVE_BLOCK_TYPING_IDLE_MS, H as LoomaCallout, I as LoomaExpand, K as LoomaActiveBlock, L as revealLoomaExpandAt, M as normalizeImagePlacement, N as LoomaTableOfContents, O as filterLoomaMentionItems, P as getTableOfContentsEntries, R as LOOMA_CHIP_COLORS, S as createSiteRelativeLinks, T as createLoomaMentionExtension, U as LOOMA_ACTIVE_BLOCK_BLUR_GRACE_MS, V as LOOMA_CALLOUT_TONES, W as LOOMA_ACTIVE_BLOCK_CLASS, _ 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 normalizeImageDimension, k as normalizeMentionResultLimit, l as normalizeActiveTableColumnWidths, m as LoomaTable, n as createLoomaSlashCommandExtension, o as handleTableAction, p as getLoomaTableExtensions, q as LoomaActiveBlockPluginKey, r as filterLoomaSlashCommands, s as handleTableOverlayAction, t as LoomaSlashCommand, u as shouldShowTextFormattingToolbar, v as getActiveTableCellBackground, w as LoomaMentionSuggestionPluginKey, x as LoomaSmartPaste, y as setActiveTableCellAlignment, z as LoomaChip } 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, LoomaExpand, LoomaImage, LoomaMentionSuggestionPluginKey, LoomaSlashCommand, LoomaSmartPaste, LoomaTable, LoomaTableCell, LoomaTableHeader, LoomaTableKit, LoomaTableOfContents, MAX_MENTION_RESULT_LIMIT, TABLE_CELL_BACKGROUND_PRESETS, createLoomaMentionExtension, createLoomaSlashCommandExtension, createSiteRelativeLinks, filterLoomaMentionItems, filterLoomaSlashCommands, getActiveTableCellAlignment, getActiveTableCellBackground, getActiveTableUiState, getDefaultEditorExtensions, getDefaultSlashCommands, getLoomaTableExtensions, getTableOfContentsEntries, handleTableAction, handleTableOverlayAction, insertTableAtRange, normalizeActiveTableColumnWidths, normalizeImageDimension, normalizeImagePlacement, normalizeLoomaChipColor, normalizeMentionResultLimit, normalizeTableOfContentsConfig, revealLoomaExpandAt, setActiveTableCellAlignment, setActiveTableCellBackground, shouldShowTextFormattingToolbar, siteRelativeHref };
|
|
@@ -20,6 +20,10 @@ export interface DefaultEditorExtensionsOptions {
|
|
|
20
20
|
linkBaseUrl?: string;
|
|
21
21
|
/** Passed to Tiptap Image; block images are the default document policy. */
|
|
22
22
|
imageInline?: boolean;
|
|
23
|
+
/** Optional image selection and sizing UI; durable formatting stays in the shared schema. */
|
|
24
|
+
imageNodeView?: NodeViewRenderer;
|
|
25
|
+
/** Optional selected-state UI for document dividers. */
|
|
26
|
+
dividerNodeView?: NodeViewRenderer;
|
|
23
27
|
/** Custom mention extension, the Looma default, or false to omit mentions. */
|
|
24
28
|
mention?: AnyExtension | false;
|
|
25
29
|
/**
|
|
@@ -35,6 +39,10 @@ export interface DefaultEditorExtensionsOptions {
|
|
|
35
39
|
codeLowlight?: ReturnType<typeof createLowlight>;
|
|
36
40
|
/** Optional presentation for a code block; the Vue editor supplies its language control. */
|
|
37
41
|
codeBlockNodeView?: NodeViewRenderer;
|
|
42
|
+
/** Optional TOC settings UI; schema, entries, and heading anchors remain shared. */
|
|
43
|
+
tableOfContentsNodeView?: NodeViewRenderer;
|
|
44
|
+
/** Optional section settings; the shared schema owns summary and body content. */
|
|
45
|
+
expandNodeView?: NodeViewRenderer;
|
|
38
46
|
}
|
|
39
47
|
/**
|
|
40
48
|
* Complete Looma table schema as one Tiptap extension.
|
|
@@ -13,11 +13,17 @@ export interface LoomaSlashCommandContext {
|
|
|
13
13
|
* built-ins without coupling the headless suggestion lifecycle to Tiptap nodes.
|
|
14
14
|
*/
|
|
15
15
|
export interface LoomaSlashCommand {
|
|
16
|
+
/** Stable identity, especially when two commands share a visible title. */
|
|
17
|
+
id?: string;
|
|
18
|
+
/** Optional visible category; absent categories render as ordinary rows. */
|
|
19
|
+
group?: string;
|
|
16
20
|
title: string;
|
|
17
21
|
description: string;
|
|
18
22
|
icon: LoomaIconName;
|
|
19
23
|
keywords: string[];
|
|
20
24
|
command: (context: LoomaSlashCommandContext) => void;
|
|
25
|
+
/** Pure capability/context check. An unavailable command is omitted. */
|
|
26
|
+
isAvailable?: (context: LoomaSlashCommandContext) => boolean;
|
|
21
27
|
}
|
|
22
28
|
/**
|
|
23
29
|
* Ephemeral render model published to any slash-menu UI.
|
|
@@ -34,6 +40,8 @@ export interface LoomaSlashMenuSnapshot {
|
|
|
34
40
|
query: string;
|
|
35
41
|
rect: DOMRect | null;
|
|
36
42
|
select: ((index: number) => void) | null;
|
|
43
|
+
/** Keeps editor keyboard selection synchronized with a UI's hovered row. */
|
|
44
|
+
highlight?: ((index: number) => void) | null;
|
|
37
45
|
}
|
|
38
46
|
/**
|
|
39
47
|
* Application-owned command inventory and integration callbacks.
|
|
@@ -51,16 +59,32 @@ export interface LoomaSlashCommandOptions {
|
|
|
51
59
|
onOpenChipEditor?: (editor: Editor, position: number) => void;
|
|
52
60
|
onOpenLinkEditor?: () => void;
|
|
53
61
|
}
|
|
62
|
+
declare module "@tiptap/core" {
|
|
63
|
+
interface Commands<ReturnType> {
|
|
64
|
+
loomaSlashCommand: {
|
|
65
|
+
/** Dismiss current suggestions without removing the writer's query. */
|
|
66
|
+
dismissLoomaSlashMenu: () => ReturnType;
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
}
|
|
54
70
|
/**
|
|
55
71
|
* Builds Looma's default command policy as fresh objects for one editor.
|
|
56
72
|
* Image and link commands delegate their picker because Looma does not own
|
|
57
73
|
* upload, persistence, or destination search. Link appears only when a picker
|
|
58
|
-
* callback is supplied, so a headless
|
|
74
|
+
* callback is supplied. Image follows the same rule, so a headless inventory
|
|
75
|
+
* has no dead picker actions.
|
|
59
76
|
*
|
|
60
77
|
* @ownership Returned command objects belong to the caller and are recreated
|
|
61
78
|
* per call so one editor cannot mutate another editor's command inventory.
|
|
62
79
|
*/
|
|
63
80
|
export declare function getDefaultSlashCommands(onOpenImagePicker?: () => void, onOpenChipEditor?: (editor: Editor, position: number) => void, onOpenLinkEditor?: () => void): LoomaSlashCommand[];
|
|
81
|
+
/**
|
|
82
|
+
* Ranks exact names/aliases before partial matches, then matching categories.
|
|
83
|
+
* Other ties retain inventory order.
|
|
84
|
+
* @contract Capability checks run against the current range; a failing host
|
|
85
|
+
* predicate omits that command rather than exposing an action that may destroy text.
|
|
86
|
+
*/
|
|
87
|
+
export declare function filterLoomaSlashCommands(commands: LoomaSlashCommand[], query: string, context?: LoomaSlashCommandContext): LoomaSlashCommand[];
|
|
64
88
|
/**
|
|
65
89
|
* Framework-neutral slash-command extension used by the turnkey editor.
|
|
66
90
|
* Consumers embedding Looma into their own Tiptap instance can configure the
|
|
@@ -71,7 +95,9 @@ export declare function getDefaultSlashCommands(onOpenImagePicker?: () => void,
|
|
|
71
95
|
* @lifecycle Snapshot callbacks are valid only for the suggestion range that
|
|
72
96
|
* produced them and are replaced on every update or exit.
|
|
73
97
|
*/
|
|
74
|
-
export declare const LoomaSlashCommand: Extension<LoomaSlashCommandOptions,
|
|
98
|
+
export declare const LoomaSlashCommand: Extension<LoomaSlashCommandOptions, {
|
|
99
|
+
dismiss: () => void;
|
|
100
|
+
}>;
|
|
75
101
|
/**
|
|
76
102
|
* Creates an independently configured extension instance.
|
|
77
103
|
* Prefer this factory when callbacks or commands are editor-specific; the
|
|
@@ -80,4 +106,6 @@ export declare const LoomaSlashCommand: Extension<LoomaSlashCommandOptions, any>
|
|
|
80
106
|
* @ownership The caller owns supplied commands and callbacks. The returned
|
|
81
107
|
* extension captures them for one configuration without mutating the inventory.
|
|
82
108
|
*/
|
|
83
|
-
export declare function createLoomaSlashCommandExtension(options?: Partial<LoomaSlashCommandOptions>): Extension<LoomaSlashCommandOptions,
|
|
109
|
+
export declare function createLoomaSlashCommandExtension(options?: Partial<LoomaSlashCommandOptions>): Extension<LoomaSlashCommandOptions, {
|
|
110
|
+
dismiss: () => void;
|
|
111
|
+
}>;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { Node, type NodeViewRenderer } from "@tiptap/core";
|
|
2
|
+
import { type Node as ProseMirrorNode } from "@tiptap/pm/model";
|
|
3
|
+
/** Formatting affects presentation only; heading order remains document order. */
|
|
4
|
+
export type LoomaTableOfContentsFormat = "plain" | "bulleted" | "numbered";
|
|
5
|
+
/** Persisted TOC choices; entries themselves are always derived from headings. */
|
|
6
|
+
export interface LoomaTableOfContentsConfig {
|
|
7
|
+
format: LoomaTableOfContentsFormat;
|
|
8
|
+
depth: 1 | 2 | 3;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* One current heading for navigation or host projections.
|
|
12
|
+
* @lifecycle Positions belong to the supplied document; recompute after edits.
|
|
13
|
+
* IDs stay with headings across renames and moves once a TOC assigns anchors.
|
|
14
|
+
*/
|
|
15
|
+
export interface LoomaTableOfContentsEntry {
|
|
16
|
+
id: string;
|
|
17
|
+
text: string;
|
|
18
|
+
level: number;
|
|
19
|
+
depth: number;
|
|
20
|
+
position: number;
|
|
21
|
+
}
|
|
22
|
+
/** Normalize loaded configuration without persisting unsupported presentation values. */
|
|
23
|
+
export declare function normalizeTableOfContentsConfig(attributes: Record<string, unknown>): LoomaTableOfContentsConfig;
|
|
24
|
+
/**
|
|
25
|
+
* Derives nonempty headings throughout the document, independent of TOC placement.
|
|
26
|
+
* @contract Depth is a maximum heading level. Relative nesting follows existing
|
|
27
|
+
* ancestors rather than inserting artificial entries for skipped levels.
|
|
28
|
+
*/
|
|
29
|
+
export declare function getTableOfContentsEntries(doc: ProseMirrorNode, depth?: number): LoomaTableOfContentsEntry[];
|
|
30
|
+
interface Branch {
|
|
31
|
+
entry: LoomaTableOfContentsEntry;
|
|
32
|
+
children: Branch[];
|
|
33
|
+
}
|
|
34
|
+
/** Shared nesting for semantic HTML and the adapter's component composition. */
|
|
35
|
+
export declare function tableOfContentsTree(entries: LoomaTableOfContentsEntry[]): Branch[];
|
|
36
|
+
/**
|
|
37
|
+
* Scrolls within this editor so multiple documents cannot cross-navigate by ID.
|
|
38
|
+
* @contract Reader navigation does not edit content or invoke link-editing UI.
|
|
39
|
+
*/
|
|
40
|
+
export declare function navigateTableOfContents(editor: import("@tiptap/core").Editor, id: string): Promise<void>;
|
|
41
|
+
interface TableOfContentsOptions {
|
|
42
|
+
nodeView: NodeViewRenderer | null;
|
|
43
|
+
}
|
|
44
|
+
declare module "@tiptap/core" {
|
|
45
|
+
interface Commands<ReturnType> {
|
|
46
|
+
loomaTableOfContents: {
|
|
47
|
+
/** Insert configuration; headings and links are derived from the document. */
|
|
48
|
+
insertLoomaTableOfContents: (config?: Partial<LoomaTableOfContentsConfig>) => ReturnType;
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Automatic whole-document navigation with durable configuration only.
|
|
54
|
+
* @ownership The schema owns configuration/anchors; node views derive entries.
|
|
55
|
+
* @lifecycle Headless views subscribe to transactions and unsubscribe on destroy.
|
|
56
|
+
*/
|
|
57
|
+
export declare const LoomaTableOfContents: Node<TableOfContentsOptions, any>;
|
|
58
|
+
export {};
|
package/editor/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
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
|
|
3
|
+
import { A as LoomaImage, B as normalizeLoomaChipColor, C as siteRelativeHref, D as MAX_MENTION_RESULT_LIMIT, E as DEFAULT_MENTION_RESULT_LIMIT, F as normalizeTableOfContentsConfig, G as LOOMA_ACTIVE_BLOCK_TYPING_IDLE_MS, H as LoomaCallout, I as LoomaExpand, K as LoomaActiveBlock, L as revealLoomaExpandAt, M as normalizeImagePlacement, N as LoomaTableOfContents, O as filterLoomaMentionItems, P as getTableOfContentsEntries, R as LOOMA_CHIP_COLORS, S as createSiteRelativeLinks, T as createLoomaMentionExtension, U as LOOMA_ACTIVE_BLOCK_BLUR_GRACE_MS, V as LOOMA_CALLOUT_TONES, W as LOOMA_ACTIVE_BLOCK_CLASS, _ 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 normalizeImageDimension, k as normalizeMentionResultLimit, l as normalizeActiveTableColumnWidths, m as LoomaTable, n as createLoomaSlashCommandExtension, o as handleTableAction, p as getLoomaTableExtensions, q as LoomaActiveBlockPluginKey, r as filterLoomaSlashCommands, s as handleTableOverlayAction, t as LoomaSlashCommand, u as shouldShowTextFormattingToolbar, v as getActiveTableCellBackground, w as LoomaMentionSuggestionPluginKey, x as LoomaSmartPaste, y as setActiveTableCellAlignment, z as LoomaChip } from "./chunks/extensions.js";
|
|
4
4
|
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, Link, List, ListOrdered, ListTodo, LoaderCircle, Merge, 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
5
|
//#region src/editor/icons.ts
|
|
6
6
|
/** The opinionated Lucide set used by Looma's shipped interaction surfaces. */
|
|
@@ -121,4 +121,4 @@ function getVisualViewportRect(owner = window) {
|
|
|
121
121
|
};
|
|
122
122
|
}
|
|
123
123
|
//#endregion
|
|
124
|
-
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, createSiteRelativeLinks, filterLoomaMentionItems, getActiveTableCellAlignment, getActiveTableCellBackground, getActiveTableUiState, getDefaultEditorExtensions, getDefaultSlashCommands, getLoomaTableExtensions, getVisualViewportRect, handleTableAction, handleTableOverlayAction, insertTableAtRange, loomaIconMarkup, measureTableOverlayGeometry, normalizeActiveTableColumnWidths, normalizeLoomaChipColor, normalizeMentionResultLimit, resolveTableCellAt, setActiveTableCellAlignment, setActiveTableCellBackground, shouldShowTextFormattingToolbar, siteRelativeHref };
|
|
124
|
+
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, LoomaExpand, LoomaImage, LoomaMentionSuggestionPluginKey, LoomaSlashCommand, LoomaSmartPaste, LoomaTable, LoomaTableCell, LoomaTableHeader, LoomaTableKit, LoomaTableOfContents, MAX_MENTION_RESULT_LIMIT, TABLE_CELL_BACKGROUND_OPTIONS, TABLE_CELL_BACKGROUND_PRESETS, createLoomaMentionExtension, createLoomaSlashCommandExtension, createSiteRelativeLinks, filterLoomaMentionItems, filterLoomaSlashCommands, getActiveTableCellAlignment, getActiveTableCellBackground, getActiveTableUiState, getDefaultEditorExtensions, getDefaultSlashCommands, getLoomaTableExtensions, getTableOfContentsEntries, getVisualViewportRect, handleTableAction, handleTableOverlayAction, insertTableAtRange, loomaIconMarkup, measureTableOverlayGeometry, normalizeActiveTableColumnWidths, normalizeImageDimension, normalizeImagePlacement, normalizeLoomaChipColor, normalizeMentionResultLimit, normalizeTableOfContentsConfig, resolveTableCellAt, revealLoomaExpandAt, setActiveTableCellAlignment, setActiveTableCellBackground, shouldShowTextFormattingToolbar, siteRelativeHref };
|
package/package.json
CHANGED
package/styles/ui-button.css
CHANGED
|
@@ -172,6 +172,42 @@
|
|
|
172
172
|
font-size: var(--ui-font-size-md);
|
|
173
173
|
}
|
|
174
174
|
|
|
175
|
+
/* Card actions inherit Button's palette and behavior; only their shared layout changes.
|
|
176
|
+
The icon may contain any decorative composition. Empty icons remove their column. */
|
|
177
|
+
:scope[data-ui-button-state~="variant=card"] {
|
|
178
|
+
display: grid;
|
|
179
|
+
grid-template-columns: auto minmax(0, 1fr) auto;
|
|
180
|
+
align-items: start;
|
|
181
|
+
gap: var(--ui-space-3);
|
|
182
|
+
inline-size: 100%;
|
|
183
|
+
min-block-size: max(var(--ui-control-min-block-size), var(--ui-control-size-md));
|
|
184
|
+
text-align: start;
|
|
185
|
+
white-space: normal;
|
|
186
|
+
box-shadow: none;
|
|
187
|
+
background-image: none;
|
|
188
|
+
}
|
|
189
|
+
:scope[data-ui-button-state~="variant=card"][data-ui-button-state~="size=lg"] {
|
|
190
|
+
min-block-size: max(var(--ui-control-min-block-size), var(--ui-control-size-lg));
|
|
191
|
+
}
|
|
192
|
+
:scope[data-ui-button-state~="variant=card"]:has(.card-icon:empty) {
|
|
193
|
+
grid-template-columns: minmax(0, 1fr) auto;
|
|
194
|
+
}
|
|
195
|
+
.card-icon {
|
|
196
|
+
display: flex;
|
|
197
|
+
align-items: flex-start;
|
|
198
|
+
}
|
|
199
|
+
.card-icon:empty {
|
|
200
|
+
display: none;
|
|
201
|
+
}
|
|
202
|
+
.card-content {
|
|
203
|
+
min-inline-size: 0;
|
|
204
|
+
}
|
|
205
|
+
.card-action {
|
|
206
|
+
display: flex;
|
|
207
|
+
align-items: center;
|
|
208
|
+
align-self: center;
|
|
209
|
+
}
|
|
210
|
+
|
|
175
211
|
/* A link is never :enabled, so interactive states test "not unavailable" instead: for a button that
|
|
176
212
|
is exactly :enabled, at the same specificity, and it also matches a link that can be followed. */
|
|
177
213
|
:scope:hover:not(:disabled, [aria-disabled="true"]) {
|
|
@@ -388,6 +424,9 @@
|
|
|
388
424
|
@supports (text-box-trim: trim-both) {
|
|
389
425
|
}
|
|
390
426
|
|
|
427
|
+
/* Card actions inherit Button's palette and behavior; only their shared layout changes.
|
|
428
|
+
The icon may contain any decorative composition. Empty icons remove their column. */
|
|
429
|
+
|
|
391
430
|
/* A link is never :enabled, so interactive states test "not unavailable" instead: for a button that
|
|
392
431
|
is exactly :enabled, at the same specificity, and it also matches a link that can be followed. */
|
|
393
432
|
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
/* Generated by HTML Next 1.0.0-alpha.26. Do not edit. */
|
|
2
|
+
@scope ([data-component~="ui-image"]) to ([data-component], [data-slotted]) {
|
|
3
|
+
:scope {
|
|
4
|
+
display: flex;
|
|
5
|
+
justify-content: flex-start;
|
|
6
|
+
box-sizing: border-box;
|
|
7
|
+
max-inline-size: 100%;
|
|
8
|
+
min-inline-size: 0;
|
|
9
|
+
margin: 0;
|
|
10
|
+
padding: var(--ui-space-3) 0;
|
|
11
|
+
}
|
|
12
|
+
:scope[data-ui-image-state~="placement=center"] {
|
|
13
|
+
justify-content: center;
|
|
14
|
+
}
|
|
15
|
+
:scope[data-ui-image-state~="placement=wrap-left"] {
|
|
16
|
+
float: left;
|
|
17
|
+
padding-inline-end: var(--ui-space-4);
|
|
18
|
+
}
|
|
19
|
+
:scope[data-ui-image-state~="placement=wrap-right"] {
|
|
20
|
+
float: right;
|
|
21
|
+
padding-inline-start: var(--ui-space-4);
|
|
22
|
+
}
|
|
23
|
+
:scope:is(:scope[data-ui-image-state~="placement=wrap-left"], :scope[data-ui-image-state~="placement=wrap-right"]) {
|
|
24
|
+
inline-size: calc(var(--_ui-image-width, calc(100% / 3)) + var(--ui-space-4));
|
|
25
|
+
}
|
|
26
|
+
:scope:is(:scope[data-ui-image-state~="placement=wrap-left"], :scope[data-ui-image-state~="placement=wrap-right"]) .frame {
|
|
27
|
+
inline-size: 100%;
|
|
28
|
+
}
|
|
29
|
+
.frame {
|
|
30
|
+
position: relative;
|
|
31
|
+
flex: 0 1 auto;
|
|
32
|
+
inline-size: var(--_ui-image-width, fit-content);
|
|
33
|
+
max-inline-size: 100%;
|
|
34
|
+
min-inline-size: 0;
|
|
35
|
+
align-self: flex-start;
|
|
36
|
+
border-radius: var(--ui-radius-md);
|
|
37
|
+
}
|
|
38
|
+
:scope[data-ui-image-state~="selected"] .frame {
|
|
39
|
+
outline: var(--ui-focus-width) solid var(--ui-focus-ring);
|
|
40
|
+
outline-offset: var(--ui-border-width);
|
|
41
|
+
}
|
|
42
|
+
.handle {
|
|
43
|
+
position: absolute;
|
|
44
|
+
z-index: 1;
|
|
45
|
+
inline-size: 24px;
|
|
46
|
+
block-size: 24px;
|
|
47
|
+
padding: 0;
|
|
48
|
+
border: 0;
|
|
49
|
+
background: transparent;
|
|
50
|
+
touch-action: none;
|
|
51
|
+
}
|
|
52
|
+
.handle::after {
|
|
53
|
+
content: "";
|
|
54
|
+
position: absolute;
|
|
55
|
+
inset: 8px;
|
|
56
|
+
background: var(--ui-surface);
|
|
57
|
+
border: var(--ui-border-width) solid var(--ui-focus-ring);
|
|
58
|
+
border-radius: var(--ui-radius-sm);
|
|
59
|
+
}
|
|
60
|
+
.handle:focus-visible {
|
|
61
|
+
outline: var(--ui-focus-width) solid var(--ui-focus-ring);
|
|
62
|
+
border-radius: var(--ui-radius-sm);
|
|
63
|
+
}
|
|
64
|
+
.handle[data-corner="top-left"] {
|
|
65
|
+
top: -12px;
|
|
66
|
+
left: -12px;
|
|
67
|
+
cursor: nwse-resize;
|
|
68
|
+
}
|
|
69
|
+
.handle[data-corner="top-right"] {
|
|
70
|
+
top: -12px;
|
|
71
|
+
right: -12px;
|
|
72
|
+
cursor: nesw-resize;
|
|
73
|
+
}
|
|
74
|
+
.handle[data-corner="bottom-left"] {
|
|
75
|
+
bottom: -12px;
|
|
76
|
+
left: -12px;
|
|
77
|
+
cursor: nesw-resize;
|
|
78
|
+
}
|
|
79
|
+
.handle[data-corner="bottom-right"] {
|
|
80
|
+
bottom: -12px;
|
|
81
|
+
right: -12px;
|
|
82
|
+
cursor: nwse-resize;
|
|
83
|
+
}
|
|
84
|
+
.handles[hidden], :scope[hidden] {
|
|
85
|
+
display: none;
|
|
86
|
+
}
|
|
87
|
+
@media (max-width: 767px) {
|
|
88
|
+
:scope:is(:scope[data-ui-image-state~="placement=wrap-left"], :scope[data-ui-image-state~="placement=wrap-right"]) {
|
|
89
|
+
float: none;
|
|
90
|
+
inline-size: 100%;
|
|
91
|
+
padding-inline: 0;
|
|
92
|
+
}
|
|
93
|
+
:scope:is(:scope[data-ui-image-state~="placement=wrap-left"], :scope[data-ui-image-state~="placement=wrap-right"]) .handles {
|
|
94
|
+
display: none;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
@media (pointer: coarse) {
|
|
98
|
+
.handle {
|
|
99
|
+
inline-size: 44px;
|
|
100
|
+
block-size: 44px;
|
|
101
|
+
}
|
|
102
|
+
.handle::after {
|
|
103
|
+
inset: 18px;
|
|
104
|
+
}
|
|
105
|
+
.handle[data-corner="top-left"] {
|
|
106
|
+
top: -22px;
|
|
107
|
+
left: -22px;
|
|
108
|
+
}
|
|
109
|
+
.handle[data-corner="top-right"] {
|
|
110
|
+
top: -22px;
|
|
111
|
+
right: -22px;
|
|
112
|
+
}
|
|
113
|
+
.handle[data-corner="bottom-left"] {
|
|
114
|
+
bottom: -22px;
|
|
115
|
+
left: -22px;
|
|
116
|
+
}
|
|
117
|
+
.handle[data-corner="bottom-right"] {
|
|
118
|
+
bottom: -22px;
|
|
119
|
+
right: -22px;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
@media (forced-colors: active) {
|
|
123
|
+
:scope[data-ui-image-state~="selected"] .frame, .handle:focus-visible {
|
|
124
|
+
outline-color: Highlight;
|
|
125
|
+
}
|
|
126
|
+
.handle::after {
|
|
127
|
+
border-color: Highlight;
|
|
128
|
+
background: Canvas;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
@scope ([data-component~="ui-image"]) to ([data-component]) {
|
|
133
|
+
:scope:is(:scope[data-ui-image-state~="placement=wrap-left"], :scope[data-ui-image-state~="placement=wrap-right"]) .frame img,
|
|
134
|
+
:scope:is(:scope[data-ui-image-state~="placement=wrap-left"], :scope[data-ui-image-state~="placement=wrap-right"]) .frame :where([data-slotted], [data-slotted] *):is(img) {
|
|
135
|
+
inline-size: 100%;
|
|
136
|
+
}
|
|
137
|
+
.frame img, .frame :where([data-slotted], [data-slotted] *):is(img) {
|
|
138
|
+
display: block;
|
|
139
|
+
max-inline-size: 100%;
|
|
140
|
+
block-size: auto;
|
|
141
|
+
margin: 0;
|
|
142
|
+
border-radius: inherit;
|
|
143
|
+
}
|
|
144
|
+
:scope[data-resizing] .frame img, :scope[data-resizing] .frame :where([data-slotted], [data-slotted] *):is(img) {
|
|
145
|
+
inline-size: 100%;
|
|
146
|
+
}
|
|
147
|
+
@media (max-width: 767px) {
|
|
148
|
+
}
|
|
149
|
+
@media (pointer: coarse) {
|
|
150
|
+
}
|
|
151
|
+
@media (forced-colors: active) {
|
|
152
|
+
}
|
|
153
|
+
}
|
package/styles/ui-separator.css
CHANGED
|
@@ -12,13 +12,33 @@
|
|
|
12
12
|
align-self: stretch;
|
|
13
13
|
margin: 0;
|
|
14
14
|
border: 0;
|
|
15
|
-
border-block-start: var(--ui-border-width) solid var(--ui-separator-color, var(--ui-border-divider));
|
|
15
|
+
border-block-start: var(--ui-border-width) solid var(--ui-separator-color, var(--_separator-color, var(--ui-border-divider)));
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
:scope[data-ui-separator-state~="emphasis=strong"] {
|
|
19
|
+
--_separator-color: var(--ui-border-strong);
|
|
16
20
|
}
|
|
17
21
|
|
|
18
22
|
:scope[aria-orientation="vertical"] {
|
|
19
23
|
block-size: auto;
|
|
20
24
|
border-block-start: 0;
|
|
21
|
-
border-inline-start: var(--ui-border-width) solid var(--ui-separator-color, var(--ui-border-divider));
|
|
25
|
+
border-inline-start: var(--ui-border-width) solid var(--ui-separator-color, var(--_separator-color, var(--ui-border-divider)));
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
:scope[data-ui-separator-state~="selectable"] {
|
|
29
|
+
min-block-size: var(--ui-control-size-sm);
|
|
30
|
+
border: 0;
|
|
31
|
+
background: linear-gradient(var(--ui-separator-color, var(--ui-border-divider)), var(--ui-separator-color, var(--ui-border-divider))) center / 100%
|
|
32
|
+
var(--ui-border-width) no-repeat;
|
|
33
|
+
cursor: pointer;
|
|
34
|
+
}
|
|
35
|
+
:scope[data-ui-separator-state~="selectable"]:hover {
|
|
36
|
+
background-color: var(--ui-surface-hover);
|
|
37
|
+
}
|
|
38
|
+
:scope[data-ui-separator-state~="selected"] {
|
|
39
|
+
outline: var(--ui-focus-width) solid var(--ui-focus-ring);
|
|
40
|
+
outline-offset: var(--ui-focus-width);
|
|
41
|
+
border-radius: var(--ui-radius-sm);
|
|
22
42
|
}
|
|
23
43
|
}
|
|
24
44
|
@scope ([data-component~="ui-separator"]) to ([data-component]) {
|
package/vanilla/UiButton.d.ts
CHANGED
|
@@ -19,7 +19,7 @@ export interface UiButtonProps {
|
|
|
19
19
|
target?: string | null;
|
|
20
20
|
tone?: "accent" | "neutral" | "danger" | "success" | "warning" | "info" | null;
|
|
21
21
|
type?: "button" | "submit" | "reset" | null;
|
|
22
|
-
variant?: "outline" | "solid" | "danger" | "ghost" | "link" | null;
|
|
22
|
+
variant?: "outline" | "solid" | "danger" | "ghost" | "link" | "card" | null;
|
|
23
23
|
attributes?: Readonly<Record<string, string | number | boolean | null | undefined>>;
|
|
24
24
|
children?: readonly (string | Node)[];
|
|
25
25
|
slots?: Readonly<Record<string, readonly (string | Node)[]>>;
|