@threadlabs/looma 0.23.21 → 0.23.22
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-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 +18 -0
- 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-image.css +153 -0
- package/styles/ui-separator.css +16 -0
- package/vanilla/UiImage.d.ts +21 -0
- package/vanilla/UiImage.js +84 -0
- package/vanilla/UiSeparator.d.ts +2 -0
- package/vanilla/UiSeparator.js +10 -2
- package/vanilla/index.js +1 -0
- package/vue/UiImage.d.ts +100 -0
- package/vue/UiImage.js +2 -0
- package/vue/UiImage.vue +463 -0
- package/vue/UiSeparator.d.ts +18 -0
- package/vue/UiSeparator.vue +66 -1
- package/vue/UiSidebar.d.ts +1 -1
- package/vue/chunks/UiImage.js +313 -0
- package/vue/chunks/UiSeparator.js +79 -22
- package/vue/components.css +169 -9
- 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
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "./looma-editor.css";
|
|
2
2
|
import type { AnyExtension, Editor, JSONContent } from "@tiptap/core";
|
|
3
3
|
import { type PropType, type VNode } from "vue";
|
|
4
|
-
import { type LoomaMentionItem, type LoomaMentionProvider, type LoomaCodeLanguages } from "@threadlabs/looma/editor";
|
|
4
|
+
import { type LoomaSlashCommand, type LoomaMentionItem, type LoomaMentionProvider, type LoomaCodeLanguages } from "@threadlabs/looma/editor";
|
|
5
5
|
import { type LoomaImageActivationDetail, type LoomaImageAttributeResolver, type LoomaImageDescriptor, type LoomaImageRenditionErrorDetail } from "./image-delivery.js";
|
|
6
6
|
/**
|
|
7
7
|
* Host upload result normalized into the editor's durable image descriptor.
|
|
@@ -27,6 +27,12 @@ export type LoomaImageUploader = (file: File) => Promise<string | LoomaImageUplo
|
|
|
27
27
|
* as well as a selection; it does not alter document commands or stored content.
|
|
28
28
|
*/
|
|
29
29
|
export type LoomaEditorToolbarMode = "bubble" | "sticky" | "popover" | "contextual";
|
|
30
|
+
/**
|
|
31
|
+
* Replace the slash inventory, or return retained defaults plus host commands.
|
|
32
|
+
* @ownership The host owns its command objects and mutations; Looma supplies
|
|
33
|
+
* fresh defaults and invokes this factory when the inventory prop changes.
|
|
34
|
+
*/
|
|
35
|
+
export type LoomaEditorSlashCommands = LoomaSlashCommand[] | ((defaults: LoomaSlashCommand[]) => LoomaSlashCommand[]);
|
|
30
36
|
/** A destination supplied by the host application, such as a page or record. */
|
|
31
37
|
export interface LoomaLinkTarget {
|
|
32
38
|
id: string;
|
|
@@ -91,6 +97,11 @@ export declare const LoomaEditor: import("vue").DefineComponent<import("vue").Ex
|
|
|
91
97
|
type: PropType<AnyExtension[]>;
|
|
92
98
|
default: () => never[];
|
|
93
99
|
};
|
|
100
|
+
/** One inventory for the existing slash extension; an empty array intentionally supplies no commands. */
|
|
101
|
+
slashCommands: {
|
|
102
|
+
type: PropType<LoomaEditorSlashCommands>;
|
|
103
|
+
default: undefined;
|
|
104
|
+
};
|
|
94
105
|
/** Override the lazy built-in catalog with application-owned code grammars. An empty object disables highlighting. */
|
|
95
106
|
codeLanguages: {
|
|
96
107
|
type: PropType<LoomaCodeLanguages | null>;
|
|
@@ -202,6 +213,11 @@ export declare const LoomaEditor: import("vue").DefineComponent<import("vue").Ex
|
|
|
202
213
|
type: PropType<AnyExtension[]>;
|
|
203
214
|
default: () => never[];
|
|
204
215
|
};
|
|
216
|
+
/** One inventory for the existing slash extension; an empty array intentionally supplies no commands. */
|
|
217
|
+
slashCommands: {
|
|
218
|
+
type: PropType<LoomaEditorSlashCommands>;
|
|
219
|
+
default: undefined;
|
|
220
|
+
};
|
|
205
221
|
/** Override the lazy built-in catalog with application-owned code grammars. An empty object disables highlighting. */
|
|
206
222
|
codeLanguages: {
|
|
207
223
|
type: PropType<LoomaCodeLanguages | null>;
|
|
@@ -271,9 +287,9 @@ export declare const LoomaEditor: import("vue").DefineComponent<import("vue").Ex
|
|
|
271
287
|
default: boolean;
|
|
272
288
|
};
|
|
273
289
|
}>> & Readonly<{
|
|
290
|
+
onUpdate?: ((_value: JSONContent) => any) | undefined;
|
|
274
291
|
"onUpdate:modelValue"?: ((_value: JSONContent) => any) | undefined;
|
|
275
292
|
"onUpdate:toolbarOpen"?: ((_value: boolean) => any) | undefined;
|
|
276
|
-
onUpdate?: ((_value: JSONContent) => any) | undefined;
|
|
277
293
|
onReady?: ((_editor: Editor) => any) | undefined;
|
|
278
294
|
onUploadError?: ((_error: unknown, _file: File) => any) | undefined;
|
|
279
295
|
onImageActivate?: ((_detail: LoomaImageActivationDetail) => any) | undefined;
|
|
@@ -287,6 +303,7 @@ export declare const LoomaEditor: import("vue").DefineComponent<import("vue").Ex
|
|
|
287
303
|
modelValue: JSONContent;
|
|
288
304
|
editable: boolean;
|
|
289
305
|
extensions: AnyExtension[];
|
|
306
|
+
slashCommands: LoomaEditorSlashCommands;
|
|
290
307
|
mentionItems: LoomaMentionItem[];
|
|
291
308
|
mentionProvider: LoomaMentionProvider | undefined;
|
|
292
309
|
mentionLimit: number;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { NodeViewRenderer } from "@tiptap/core";
|
|
2
|
+
/** A pointer-sized document divider using the shared separator's selected state.
|
|
3
|
+
* @lifecycle The editor owns the node and deletion; destroying the view releases
|
|
4
|
+
* its Vue app and editability subscription.
|
|
5
|
+
*/
|
|
6
|
+
export declare const dividerNodeView: NodeViewRenderer;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { NodeViewRenderer } from "@tiptap/core";
|
|
2
|
+
/**
|
|
3
|
+
* Composes a section's transient disclosure and saved settings from shared controls.
|
|
4
|
+
* @lifecycle The content DOM remains owned by ProseMirror; Vue owns surrounding
|
|
5
|
+
* controls. Unmount removes the app, listeners, and editor subscription.
|
|
6
|
+
*/
|
|
7
|
+
export declare const expandNodeView: NodeViewRenderer;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Editor } from "@tiptap/core";
|
|
2
|
+
import { type PropType } from "vue";
|
|
3
|
+
/** One contextual editing bar; sizing belongs to the image's corner handles.
|
|
4
|
+
* @contract Placement applies immediately. Alt text is a secondary draft with
|
|
5
|
+
* Save/Cancel; editing another node cancels it rather than changing that node.
|
|
6
|
+
*/
|
|
7
|
+
export declare const ImageControls: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
8
|
+
editor: {
|
|
9
|
+
type: PropType<Editor>;
|
|
10
|
+
required: true;
|
|
11
|
+
};
|
|
12
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
13
|
+
[key: string]: any;
|
|
14
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
15
|
+
editor: {
|
|
16
|
+
type: PropType<Editor>;
|
|
17
|
+
required: true;
|
|
18
|
+
};
|
|
19
|
+
}>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Extension, type Editor, type JSONContent } from "@tiptap/core";
|
|
2
|
+
export { normalizeImageDimension } from "../../editor/extensions/image.js";
|
|
2
3
|
/** What caused an overlay to open or close. */
|
|
3
4
|
type OverlayTrigger = "keyboard" | "pointer" | "programmatic";
|
|
4
5
|
/**
|
|
@@ -49,8 +50,8 @@ export interface LoomaImageRenditionErrorDetail extends LoomaImageDescriptor {
|
|
|
49
50
|
}
|
|
50
51
|
interface LoomaImageDeliveryExtensionOptions {
|
|
51
52
|
resolveAttributes: () => LoomaImageAttributeResolver | undefined;
|
|
53
|
+
isEditable: () => boolean;
|
|
52
54
|
}
|
|
53
|
-
export declare function normalizeImageDimension(value: unknown): number | undefined;
|
|
54
55
|
export declare function imageDescriptorFromAttrs(attrs: Record<string, unknown>): LoomaImageDescriptor | null;
|
|
55
56
|
export declare function createLoomaImageDeliveryController(options: LoomaImageDeliveryExtensionOptions): {
|
|
56
57
|
extension: Extension;
|
|
@@ -58,4 +59,3 @@ export declare function createLoomaImageDeliveryController(options: LoomaImageDe
|
|
|
58
59
|
reset: (editor: Editor) => void;
|
|
59
60
|
};
|
|
60
61
|
export declare function imageUploadContent(image: LoomaImageDescriptor): JSONContent;
|
|
61
|
-
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { NodeViewRenderer } from "@tiptap/core";
|
|
2
|
+
/** Projects the shared image's resize intent into a single document transaction.
|
|
3
|
+
* @ownership Delivery decorations belong to the inner image, never the figure;
|
|
4
|
+
* persisted attributes remain independent of host renditions and drag previews.
|
|
5
|
+
* @lifecycle Each atom owns a Vue app and an editability subscription.
|
|
6
|
+
*/
|
|
7
|
+
export declare const imageNodeView: NodeViewRenderer;
|
package/vue/editor/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export * from "@threadlabs/looma/editor";
|
|
2
2
|
export * from "./primitives.js";
|
|
3
|
-
export { LoomaEditor, type LoomaEditorToolbarMode, type LoomaLinkTarget, type LoomaLinkSearch, type LoomaLinkResolve, type LoomaImageUploader, type LoomaImageUploadResult, } from "./LoomaEditor.js";
|
|
3
|
+
export { LoomaEditor, type LoomaEditorToolbarMode, type LoomaEditorSlashCommands, type LoomaLinkTarget, type LoomaLinkSearch, type LoomaLinkResolve, type LoomaImageUploader, type LoomaImageUploadResult, } from "./LoomaEditor.js";
|
|
4
4
|
export type { LoomaImageActivationDetail, LoomaImageActivationTrigger, LoomaImageAttributeResolver, LoomaImageDescriptor, LoomaImageRenditionErrorDetail, LoomaImageRenditionAttributes, } from "./image-delivery.js";
|