@qarakash/blockwriteai 1.0.7

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.
@@ -0,0 +1,197 @@
1
+ export interface BlockWriteAIBlock<TData = Record<string, unknown>> {
2
+ id?: string;
3
+ type: string;
4
+ data: TData;
5
+ }
6
+
7
+ export interface BlockWriteAIDocument {
8
+ time?: number;
9
+ version?: string;
10
+ blocks: BlockWriteAIBlock[];
11
+ signatures?: Record<string, unknown>;
12
+ [key: string]: unknown;
13
+ }
14
+
15
+ export interface BlockWriteAIUploadResult {
16
+ url: string;
17
+ name?: string;
18
+ size?: number;
19
+ type?: string;
20
+ alt?: string;
21
+ caption?: string;
22
+ base64?: string;
23
+ upload?: Record<string, unknown>;
24
+ [key: string]: unknown;
25
+ }
26
+
27
+ export interface BlockWriteAIUploadHandlers {
28
+ image?: (file: File) => Promise<BlockWriteAIUploadResult> | BlockWriteAIUploadResult;
29
+ file?: (file: File) => Promise<BlockWriteAIUploadResult> | BlockWriteAIUploadResult;
30
+ }
31
+
32
+ export interface BlockWriteAIAutosaveOptions {
33
+ key: string;
34
+ load?: boolean;
35
+ }
36
+
37
+ export interface BlockWriteAIAIOptions {
38
+ endpoint?: string;
39
+ }
40
+
41
+ export interface BlockWriteAIPremiumState {
42
+ status: "missing" | "pending" | "valid" | "invalid" | "disabled" | string;
43
+ valid: boolean;
44
+ message?: string;
45
+ features: Record<"drawing" | "mermaid" | "signature" | "signature_flow" | "ai", boolean> & Record<string, boolean>;
46
+ limits?: Record<string, unknown>;
47
+ usage?: Record<string, unknown>;
48
+ organization?: Record<string, unknown> | null;
49
+ subscription?: Record<string, unknown> | null;
50
+ license?: Record<string, unknown> | null;
51
+ }
52
+
53
+ export interface BlockWriteAIPremiumOptions {
54
+ disabled?: boolean;
55
+ licenseKey?: string;
56
+ license_key?: string;
57
+ key?: string;
58
+ verifyEndpoint?: string;
59
+ verify?: string;
60
+ endpoint?: string;
61
+ usageEndpoint?: string;
62
+ usage?: string;
63
+ pluginEndpoint?: string;
64
+ pluginsEndpoint?: string;
65
+ bundleEndpoint?: string;
66
+ features?: string[];
67
+ pluginFeatures?: string[];
68
+ autoLoadPlugins?: boolean;
69
+ loadPlugins?: boolean;
70
+ }
71
+
72
+ export interface BlockWriteAIPremiumPluginLoadOptions {
73
+ licenseKey?: string;
74
+ license_key?: string;
75
+ license?: string;
76
+ endpoint?: string;
77
+ pluginEndpoint?: string;
78
+ pluginsEndpoint?: string;
79
+ bundleEndpoint?: string;
80
+ features?: string[];
81
+ }
82
+
83
+ export type BlockWriteAIToolConfig = string[] | Record<string, boolean>;
84
+ export type BlockWriteAIUploadOutput = "base64" | "upload";
85
+
86
+ export interface BlockWriteAIExportOptions {
87
+ html?: boolean;
88
+ buttons?: boolean;
89
+ exportToHTML?: boolean;
90
+ exportButtons?: boolean;
91
+ "Export To HTML"?: boolean;
92
+ "Export Buttons"?: boolean;
93
+ }
94
+
95
+ export interface BlockWriteAIShellOptions {
96
+ title?: string;
97
+ subtitle?: string | false;
98
+ heading?: string;
99
+ status?: string;
100
+ logo?: string | false;
101
+ maxWidth?: string | number;
102
+ className?: string;
103
+ }
104
+
105
+ export interface BlockWriteAIOptions {
106
+ holder: string | HTMLElement;
107
+ data?: BlockWriteAIDocument;
108
+ placeholder?: string;
109
+ minHeight?: string;
110
+ maxWidth?: string | number;
111
+ editorMaxWidth?: string | number;
112
+ shell?: boolean | BlockWriteAIShellOptions;
113
+ shellTitle?: string;
114
+ shellSubtitle?: string | false;
115
+ shellHeading?: string;
116
+ shellStatus?: string;
117
+ shellLogo?: string | false;
118
+ shellClassName?: string;
119
+ autofocus?: boolean;
120
+ readOnly?: boolean;
121
+ tools?: BlockWriteAIToolConfig;
122
+ autosave?: BlockWriteAIAutosaveOptions;
123
+ upload?: BlockWriteAIUploadHandlers;
124
+ uploadOutput?: BlockWriteAIUploadOutput | BlockWriteAIUploadOutput[];
125
+ "upload output"?: BlockWriteAIUploadOutput | BlockWriteAIUploadOutput[];
126
+ export?: BlockWriteAIExportOptions;
127
+ Export?: BlockWriteAIExportOptions;
128
+ exportButton?: boolean;
129
+ exportHtmlButton?: boolean;
130
+ historyPanel?: boolean;
131
+ saveButton?: boolean;
132
+ licenseKey?: string;
133
+ license_key?: string;
134
+ license?: string;
135
+ licenseVerifyEndpoint?: string;
136
+ aiUsageEndpoint?: string;
137
+ premiumPluginEndpoint?: string;
138
+ premiumPluginFeatures?: string[];
139
+ autoLoadPremiumPlugins?: boolean;
140
+ premium?: false | BlockWriteAIPremiumOptions;
141
+ Premium?: false | BlockWriteAIPremiumOptions;
142
+ ai?: false | BlockWriteAIAIOptions;
143
+ onChange?: (data: BlockWriteAIDocument, editor: BlockWriteAI) => void;
144
+ onSave?: (data: BlockWriteAIDocument, editor: BlockWriteAI) => void | Promise<void>;
145
+ }
146
+
147
+ export default class BlockWriteAI {
148
+ constructor(options: BlockWriteAIOptions);
149
+
150
+ readonly readOnly: boolean;
151
+
152
+ save(): Promise<BlockWriteAIDocument>;
153
+ getData(): BlockWriteAIDocument;
154
+ render(data: BlockWriteAIDocument): void;
155
+ clear(): void;
156
+ exportHTML(): string;
157
+ exportMarkdown(): string;
158
+ importHTML(html: string): void;
159
+ setReadOnly(readOnly: boolean): void;
160
+ setShellStatus(status: string): void;
161
+ verifyPremiumLicense(): Promise<BlockWriteAIPremiumState>;
162
+ loadPremiumPlugins(features?: string[]): Promise<{ ok: boolean; features: string[] }>;
163
+ getPremiumState(): BlockWriteAIPremiumState;
164
+ isPremiumFeatureEnabled(feature: "drawing" | "mermaid" | "signature" | "signature_flow" | "ai" | string): boolean;
165
+ consumePremiumUsage(feature: "ai" | string): Promise<BlockWriteAIPremiumState>;
166
+ undo(): void;
167
+ redo(): void;
168
+ openAI(): this | null;
169
+ destroy(): void;
170
+
171
+ static version: string;
172
+ static configure(options: Partial<BlockWriteAIOptions>): typeof BlockWriteAI;
173
+ static loadPremiumPlugins(options: BlockWriteAIPremiumPluginLoadOptions): Promise<{ ok: boolean; features: string[] }>;
174
+ static enableAI(options?: BlockWriteAIAIOptions): typeof BlockWriteAI;
175
+ static registerTool(name: string, tool: unknown): void;
176
+ static getTool(name: string): unknown;
177
+ static normalizePreviewData(payload: unknown): BlockWriteAIDocument;
178
+ static toHTML(data: BlockWriteAIDocument | { data?: BlockWriteAIDocument }, options?: Partial<BlockWriteAIOptions>): string;
179
+ static initPreviewPlugins(root?: HTMLElement | Document): HTMLElement | Document | undefined;
180
+ static primeSignatureData(signatures?: Record<string, unknown>): Record<string, unknown> | undefined;
181
+ static renderPreview(holder: string | HTMLElement, data: BlockWriteAIDocument | { data?: BlockWriteAIDocument }, options?: Partial<BlockWriteAIOptions>): HTMLElement | null;
182
+ static mountPreviews(options?: {
183
+ selector?: string;
184
+ source?: string;
185
+ data?: BlockWriteAIDocument | { data?: BlockWriteAIDocument };
186
+ force?: boolean;
187
+ editor?: Partial<BlockWriteAIOptions>;
188
+ }): Promise<HTMLElement[]>;
189
+ static helpers: Record<string, unknown>;
190
+ }
191
+
192
+ declare global {
193
+ interface Window {
194
+ BlockWriteAI: typeof BlockWriteAI;
195
+ RichBlockEditor: typeof BlockWriteAI;
196
+ }
197
+ }