@pixerate/editor 0.21.0 → 0.22.0
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/README.md +20 -11
- package/dist/agent/index.cjs +8 -8
- package/dist/agent/index.d.cts +2 -2
- package/dist/agent/index.d.ts +2 -2
- package/dist/agent/index.js +2 -2
- package/dist/canvas/index.cjs +1269 -13
- package/dist/canvas/index.cjs.map +1 -1
- package/dist/canvas/index.d.cts +432 -6
- package/dist/canvas/index.d.ts +432 -6
- package/dist/canvas/index.js +1264 -8
- package/dist/canvas/index.js.map +1 -1
- package/dist/{chunk-U6NDQFOK.cjs → chunk-6M3BCTBD.cjs} +427 -138
- package/dist/chunk-6M3BCTBD.cjs.map +1 -0
- package/dist/{chunk-TVRC4KVT.cjs → chunk-AA4ZEVCC.cjs} +845 -90
- package/dist/chunk-AA4ZEVCC.cjs.map +1 -0
- package/dist/{chunk-LA7PEGU3.cjs → chunk-CL37JGFW.cjs} +4 -4
- package/dist/{chunk-LA7PEGU3.cjs.map → chunk-CL37JGFW.cjs.map} +1 -1
- package/dist/{chunk-A7DKIA72.js → chunk-DENSCKFC.js} +642 -69
- package/dist/chunk-DENSCKFC.js.map +1 -0
- package/dist/{chunk-4QPLEUL2.cjs → chunk-GVSMRPHB.cjs} +1046 -54
- package/dist/chunk-GVSMRPHB.cjs.map +1 -0
- package/dist/{chunk-KYRZDWM4.js → chunk-JJDLPEWL.js} +2 -2
- package/dist/{chunk-3TYMNULT.js → chunk-MJZBNWG7.js} +807 -52
- package/dist/chunk-MJZBNWG7.js.map +1 -0
- package/dist/{chunk-CYFJCKC4.js → chunk-QGHGJ56O.js} +997 -5
- package/dist/chunk-QGHGJ56O.js.map +1 -0
- package/dist/{chunk-GVW4P7BG.js → chunk-RU52I7QO.js} +305 -16
- package/dist/chunk-RU52I7QO.js.map +1 -0
- package/dist/{chunk-JYRIOFEN.cjs → chunk-SAZRENEZ.cjs} +647 -74
- package/dist/chunk-SAZRENEZ.cjs.map +1 -0
- package/dist/{controller-OUdxPY-X.d.ts → controller-B7GIybc4.d.cts} +139 -7
- package/dist/{controller-OUdxPY-X.d.cts → controller-B7GIybc4.d.ts} +139 -7
- package/dist/extensions/index.cjs +14 -4
- package/dist/extensions/index.cjs.map +1 -1
- package/dist/extensions/index.d.cts +3 -3
- package/dist/extensions/index.d.ts +3 -3
- package/dist/extensions/index.js +13 -3
- package/dist/{index-k3mFbPx_.d.cts → index-CCr_z9kF.d.cts} +3 -3
- package/dist/{index-Ng1pG7JE.d.ts → index-Ck6ajwXh.d.ts} +3 -3
- package/dist/index.cjs +250 -16
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +294 -8
- package/dist/index.d.ts +294 -8
- package/dist/index.js +241 -7
- package/dist/index.js.map +1 -1
- package/dist/{registry-iAHbqkYt.d.cts → registry-GJI4gToU.d.cts} +15 -4
- package/dist/{registry-iAHbqkYt.d.ts → registry-GJI4gToU.d.ts} +15 -4
- package/dist/serializers/index.cjs +3 -3
- package/dist/serializers/index.d.cts +1 -1
- package/dist/serializers/index.d.ts +1 -1
- package/dist/serializers/index.js +2 -2
- package/dist/spreadsheet/index.cjs +7 -3
- package/dist/spreadsheet/index.cjs.map +1 -1
- package/dist/spreadsheet/index.d.cts +33 -4
- package/dist/spreadsheet/index.d.ts +33 -4
- package/dist/spreadsheet/index.js +6 -2
- package/dist/{track-changes-G8JcWB8b.d.cts → track-changes-BSF58RK0.d.cts} +92 -9
- package/dist/{track-changes-G8JcWB8b.d.ts → track-changes-BSF58RK0.d.ts} +92 -9
- package/dist/{types-DMe0vFB1.d.cts → types-CJ4U-HHI.d.cts} +1 -1
- package/dist/{types-DMe0vFB1.d.ts → types-CJ4U-HHI.d.ts} +1 -1
- package/package.json +1 -1
- package/dist/chunk-3TYMNULT.js.map +0 -1
- package/dist/chunk-4QPLEUL2.cjs.map +0 -1
- package/dist/chunk-A7DKIA72.js.map +0 -1
- package/dist/chunk-CYFJCKC4.js.map +0 -1
- package/dist/chunk-GVW4P7BG.js.map +0 -1
- package/dist/chunk-JYRIOFEN.cjs.map +0 -1
- package/dist/chunk-TVRC4KVT.cjs.map +0 -1
- package/dist/chunk-U6NDQFOK.cjs.map +0 -1
- /package/dist/{chunk-KYRZDWM4.js.map → chunk-JJDLPEWL.js.map} +0 -0
package/dist/index.d.ts
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { T as Token } from './tokens-CyLZmIei.js';
|
|
2
2
|
export { C as ColorGradient, a as ConditionalKind, I as INSTRUCTION_REGEX, P as PromptDiagnostic, b as PromptDiagnosticCode, c as PromptValue, d as PromptValues, e as TEMPLATE_REGEX, f as Template, g as TemplateVersion, h as TokenType, V as VARIABLE_REGEX, i as instructionRegex, t as templateRegex, v as variableRegex } from './tokens-CyLZmIei.js';
|
|
3
3
|
export { ConditionalTagLike, ConditionalTagMatch, EvaluatedToken, ExtractVariablesOptions, ParsedVariableBody, ResolvePromptOptions, ResolvePromptResult, ResolveTemplatesOptions, SourceMapSegment, TEMPLATE_DEPTH_ERROR, TEMPLATE_LOOP_ERROR, TokenizeResult, VariableDescriptor, VariableFormField, compactVariableValues, escapeVariableText, evaluateCondition, evaluatePromptTokens, extractInstructionNames, extractTemplateNames, extractVariableNames, extractVariables, getLatestVersion, getPromptDiagnostics, getSuppliedValue, getTemplateBody, getVariableFormFields, isPromptValueSet, mapRawOffsetToResolved, mapResolvedOffsetToRaw, matchConditionalTags, parseVariableBody, resolvePrompt, resolveTemplates, resolveTemplatesWithMapping, resolveVariables, tokenizePrompt, tokenizePromptWithDiagnostics, unescapeVariableText } from './grammar/index.js';
|
|
4
|
-
import { D as DocumentImport } from './index-
|
|
5
|
-
export { A as AddCommentOptions,
|
|
6
|
-
export { C as CommentAnchor, a as CommentReply, b as CommentStore, c as CommentStoreListener, d as CommentStoreOptions, e as CommentStoreSnapshot, f as CommentThread, g as CreateThreadInput, D as DELETION_MARK_NAME, I as INSERTION_MARK_NAME, M as Mention, h as MentionEntity, i as MentionOptions, R as ReviewAuthor, S as SerializedComments, T as TRACK_CHANGES_SKIP_META, j as TrackChanges, k as TrackChangesOptions, l as TrackChangesSnapshot, m as TrackChangesStorage, n as TrackChangesStore, o as
|
|
4
|
+
import { D as DocumentImport, a as DocumentImportAdapter } from './index-Ck6ajwXh.js';
|
|
5
|
+
export { A as AddCommentOptions, b as Autocorrect, c as AutocorrectContext, d as AutocorrectCorrection, e as AutocorrectOptions, f as AutocorrectRule, g as AutocorrectStorage, B as BUILT_IN_IMPORT_ADAPTERS, h as Bookmark, i as BookmarkInfo, j as BookmarkOptions, C as COMMENT_MARK_NAME, k as ColorHighlighter, l as CommentRange, m as Comments, n as CommentsOptions, o as CommentsStorage, p as CreateImportAdapterRegistryOptions, q as CrossReference, r as CrossReferenceOptions, s as CrossReferenceTarget, t as CrossReferenceTargetType, u as DEFAULT_AUTOCORRECT_EXCEPTIONS, v as DocumentStructureCommandArgs, w as DocumentStructureCommandItem, F as FileImport, x as FileImportOptions, y as FocusHeadingOptions, z as FontSize, E as Footnote, G as FootnoteInfo, H as FootnoteReference, I as Footnotes, J as FootnotesOptions, K as GradientText, L as GradientTextOptions, M as Image, N as ImageOptions, O as InsertFootnoteOptions, P as InsertTableOfContentsOptions, Q as LoadingNode, R as Markdown, S as Outline, T as OutlineHeading, U as OutlineOptions, V as OutlineSnapshot, W as OutlineStorage, X as OutlineStore, Y as OutlineTreeItem, Z as RichClipboard, _ as RichClipboardOptions, $ as RichClipboardStorage, a0 as RichTextPresetOptions, a1 as SMILIE_REPLACEMENTS, a2 as SetBookmarkOptions, a3 as SlashCommandMatchData, a4 as SlashCommands, a5 as SlashCommandsOptions, a6 as SmilieReplacer, a7 as TableOfContents, a8 as TableOfContentsEntry, a9 as TableOfContentsOptions, aa as TemplateSuggestions, ab as TemplateSuggestionsOptions, ac as autocorrectPluginKey, ad as buildOutlineTree, ae as capitalizeSentenceRules, af as commentsPluginKey, ag as computeOutline, ah as createImportAdapterRegistry, ai as createOutlineStore, aj as createRichTextPreset, ak as crossReferencePluginKey, al as defaultAutocorrectRules, am as defaultImportRegistry, an as documentStructureCommandItems, ao as fileImportPluginKey, ap as findAutocorrection, aq as findCommentRanges, ar as findHexColors, as as findImportAdapter, at as footnotesMarkdownIt, au as footnotesPluginKey, av as fractionRules, aw as getActiveHeading, ax as getBookmarks, ay as getCommentAnchors, az as getCommentAuthor, aA as getCommentIdsAt, aB as getCommentStore, aC as getCrossReferenceTargets, aD as getDocumentStructureCommandItems, aE as getFootnotes, aF as getImportAccept, aG as getOutline, aH as getTableOfContentsEntries, aI as handleImageInsertion, aJ as htmlImportAdapter, aK as imagePastePluginKey, aL as importFile, aM as insertImageNode, aN as isInsidePromptToken, aO as markdownImportAdapter, aP as navigateToHeading, aQ as outlinePluginKey, aR as plainTextImportAdapter, aS as registerImportAdapter, aT as removeImageNode, aU as richClipboardPluginKey, aV as rtfImportAdapter, aW as smartQuoteRules, aX as smilieAutocorrectRules, aY as symbolRules, aZ as syncFootnotes, a_ as tableOfContentsMarkdownIt, a$ as tableOfContentsPluginKey, b0 as twoInitialCapitalsRules, b1 as unregisterImportAdapter, b2 as updateImageSrc, b3 as writeRichClipboard } from './index-Ck6ajwXh.js';
|
|
6
|
+
export { B as BLOCK_CHANGE_ATTRIBUTE, C as CommentAnchor, a as CommentReply, b as CommentStore, c as CommentStoreListener, d as CommentStoreOptions, e as CommentStoreSnapshot, f as CommentThread, g as CreateThreadInput, D as DELETION_MARK_NAME, F as FORMAT_CHANGE_MARK_NAME, I as INSERTION_MARK_NAME, M as Mention, h as MentionEntity, i as MentionOptions, R as ReviewAuthor, S as SerializedComments, T as TRACK_CHANGES_SKIP_META, j as TrackChanges, k as TrackChangesOptions, l as TrackChangesSnapshot, m as TrackChangesStorage, n as TrackChangesStore, o as TrackedBlockChangeAttributes, p as TrackedBlockSnapshot, q as TrackedChange, r as TrackedChangeAttributes, s as TrackedChangeType, t as TrackedChangesView, u as TrackedDeletion, v as TrackedFormatChange, w as TrackedFormatChangeAttributes, x as TrackedFormatSummary, y as TrackedInsertion, z as TrackedMark, A as createCommentStore, E as createMentionExtension, G as createReviewId, H as describeBlockChange, J as describeFormatChange, K as formatReviewTime, L as getTrackChangesStore, N as getTrackedChangeAt, O as getTrackedChanges, P as isTrackChangesEnabled, Q as resolveTrackedChanges, U as trackChangesPluginKey } from './track-changes-BSF58RK0.js';
|
|
7
7
|
export { ClipboardDataLike, ExtractedMention, MARKDOWN_MENTION_SPLIT_REGEX, MENTION_REGEX, MarkdownToHtmlOptions, MentionSegment, PIXERATE_DOCUMENT_MIME, PlainTextOptions, PreprocessMarkdownMentionsOptions, RichClipboardPayload, SanitizeHtmlOptions, escapeHtml, extractMentions, extractMentionsFromDoc, getClipboardData, getEditorMarkdown, getEditorText, getSchemaSignature, htmlToPlainText, markdownToTipTapHtml, parseMentionSegments, parseRichClipboardPayload, plainTextToParagraphHtml, plainTextToSlice, plainTextToTipTapHtml, preprocessMarkdownFileLinks, preprocessMarkdownMentions, readRichClipboard, rtfToPlainText, sanitizeHtml, sanitizeImportedHtml, serializeRichClipboardPayload, stripMarkdownCode } from './serializers/index.js';
|
|
8
8
|
import { Editor, EditorOptions, Content, Extensions } from '@tiptap/core';
|
|
9
9
|
export { Content, Editor, EditorOptions, Extensions } from '@tiptap/core';
|
|
10
|
-
export { A as ASTNode, B as BinaryOpNode, C as CellCoordinate, a as CellData, b as CellDep, c as CellFormat, d as CellPosition, e as CellRange, f as CellRefNode, g as CellValueReader, h as ColumnBinding, i as ColumnType, j as CsvExportOptions, k as CsvImportOptions, D as DEFAULT_COLUMN_WIDTH, l as DEFAULT_ROW_HEIGHT, m as DataSourceBinder, n as DependencyGraph, E as EvaluationContext, F as FORMULA_ERRORS, o as FilterOperator, p as FilterRule, q as FormulaDiagnostic, r as FormulaErrorCode, s as FormulaEvaluationResult, t as FormulaEvaluator, u as FormulaParser, v as FormulaRange, w as FormulaToken, x as FormulaTokenType, y as FunctionCallNode, G as GroupAggregate, z as GroupSummary, L as LiteralNode, N as NewFilterRule, P as ParsedSpreadsheetClipboard,
|
|
11
|
-
export { CsvParseOptions, CsvSerializeOptions, FillDirection, FormulaActiveCall, FormulaArgument, FormulaArgumentSpec, FormulaArgumentType, FormulaCaretContext, FormulaCriteriaPredicate, FormulaFunctionCategory, FormulaFunctionContext, FormulaFunctionDefinition, FormulaFunctionSuggestion, FormulaHints, FormulaSignaturePart, ImportFileIntoSpreadsheetOptions, SPREADSHEET_IMPORT_ADAPTERS, SPREADSHEET_TABLE_ACTIONS, SpreadsheetImport, SpreadsheetImportAdapter, SpreadsheetMenuItem, SpreadsheetTableActionName, SpreadsheetTableActions, aggregateValues, applyFormulaSuggestion, bindSpreadsheetTableActions, checkFormulaArgumentCount, compareCellValues, computeFillTarget, csvImportAdapter, escapeCsvField, fillSeries, formatValueWithCode, getFillDirection, getFormulaArgumentSpecIndex, getFormulaCaretContext, getFormulaFunction, getFormulaHints, getFormulaSignature, getFormulaSignatureParts, getSpreadsheetMenuItems, importFileIntoSpreadsheet, isBlankValue, isSingleCellRange, listFormulaFunctions, matchesFilterRule, normalizeRange, parseCriteria, parseCsv, parseTsv, rangeContains, rangeContainsRange, rangesIntersect, registerFormulaFunction, registerSpreadsheetImportAdapters, roundFloat, searchFormulaFunctions, serializeCsv, serializeTsv, toNumber, tsvImportAdapter, unregisterFormulaFunction, wildcardToRegExp } from './spreadsheet/index.js';
|
|
10
|
+
export { A as ASTNode, B as BinaryOpNode, C as CellCoordinate, a as CellData, b as CellDep, c as CellFormat, d as CellPosition, e as CellRange, f as CellRefNode, g as CellValueReader, h as ColumnBinding, i as ColumnType, j as CsvExportOptions, k as CsvImportOptions, D as DEFAULT_COLUMN_WIDTH, l as DEFAULT_ROW_HEIGHT, m as DataSourceBinder, n as DependencyGraph, E as EvaluationContext, F as FORMULA_ERRORS, o as FilterOperator, p as FilterRule, q as FormulaDiagnostic, r as FormulaErrorCode, s as FormulaEvaluationResult, t as FormulaEvaluator, u as FormulaParser, v as FormulaRange, w as FormulaToken, x as FormulaTokenType, y as FunctionCallNode, G as GroupAggregate, z as GroupSummary, L as LiteralNode, M as MAX_FORMULA_ARRAY_SIZE, N as NameNode, H as NewFilterRule, P as ParsedSpreadsheetClipboard, I as PropertyRefNode, R as RangeNode, J as RowType, K as SPREADSHEET_CLIPBOARD_MIME, O as SortDirection, Q as SortKey, T as SpillRefNode, U as SpreadsheetCellSpan, V as SpreadsheetClipboardCell, W as SpreadsheetClipboardData, X as SpreadsheetClipboardPayload, Y as SpreadsheetClipboardSource, Z as SpreadsheetColumn, S as SpreadsheetController, _ as SpreadsheetControllerOptions, $ as SpreadsheetDataSource, a0 as SpreadsheetDataSourceField, a1 as SpreadsheetDocument, a2 as SpreadsheetFilterState, a3 as SpreadsheetGrouping, a4 as SpreadsheetRow, a5 as SpreadsheetRowGroup, a6 as SpreadsheetRowSection, a7 as SpreadsheetSpill, a8 as SpreadsheetTableSettings, a9 as SpreadsheetViewColumn, aa as SpreadsheetViewModel, ab as SpreadsheetViewRow, ac as StructuralChange, ad as UnaryOpNode, ae as WHOLE_COLUMN_END_ROW, af as buildSpreadsheetView, ag as colNameToIndex, ah as columnDependencyKey, ai as computeRowGroups, aj as createSpreadsheetClipboardData, ak as describeFormulaError, al as extractCellDependencies, am as getRowSection, an as getTableSections, ao as indexToColName, ap as isFormulaError, aq as mapFormulaReferences, ar as offsetFormulaReferences, as as parseCellReference, at as parseFormula, au as parseHtmlTable, av as parseRange, aw as readSpreadsheetClipboard, ax as rebaseClipboardRows, ay as remapFormulaReferences, az as rowPassesFilters, aA as serializeHtmlTable, aB as shiftFormulaReferences, aC as tokenizeFormula } from './controller-B7GIybc4.js';
|
|
11
|
+
export { CsvParseOptions, CsvSerializeOptions, FillDirection, FormulaActiveCall, FormulaArgument, FormulaArgumentSpec, FormulaArgumentType, FormulaCaretContext, FormulaCriteriaPredicate, FormulaFunctionCategory, FormulaFunctionContext, FormulaFunctionDefinition, FormulaFunctionSuggestion, FormulaHints, FormulaSignaturePart, ImportFileIntoSpreadsheetOptions, SPREADSHEET_IMPORT_ADAPTERS, SPREADSHEET_TABLE_ACTIONS, SpreadsheetImport, SpreadsheetImportAdapter, SpreadsheetMenuItem, SpreadsheetTableActionName, SpreadsheetTableActions, aggregateValues, applyFormulaSuggestion, bindSpreadsheetTableActions, checkFormulaArgumentCount, clampMenuPosition, compareCellValues, computeFillTarget, csvImportAdapter, escapeCsvField, fillSeries, formatValueWithCode, getFillDirection, getFormulaArgumentSpecIndex, getFormulaCaretContext, getFormulaFunction, getFormulaHints, getFormulaSignature, getFormulaSignatureParts, getSpreadsheetMenuItems, importFileIntoSpreadsheet, isBlankValue, isSingleCellRange, listFormulaFunctions, matchesFilterRule, normalizeRange, parseCriteria, parseCsv, parseTsv, rangeContains, rangeContainsRange, rangesIntersect, registerFormulaFunction, registerSpreadsheetImportAdapters, roundFloat, searchFormulaFunctions, serializeCsv, serializeTsv, toNumber, tsvImportAdapter, unregisterFormulaFunction, wildcardToRegExp } from './spreadsheet/index.js';
|
|
12
12
|
export { C as Command, H as HistoryManagerOptions, a as HistoryState, M as MergedExecutionOptions, S as SnapshotCommandOptions } from './types-BZgcDsC5.js';
|
|
13
13
|
export { HistoryManager, createHistoryManager } from './history/index.js';
|
|
14
|
-
import { I as ImportAdapterRegistry, a as ImportOutcome, F as FileLike } from './registry-
|
|
15
|
-
export { b as FindImportAdapterQuery, c as ImportAdapter, d as ImportContext, e as ImportError, f as ImportErrorCode, g as ImportFileOptions, h as ImportInput, i as ImportTarget, R as RegisterImportAdapterOptions, j as createImportContext } from './registry-
|
|
14
|
+
import { I as ImportAdapterRegistry, a as ImportOutcome, F as FileLike } from './registry-GJI4gToU.js';
|
|
15
|
+
export { b as FindImportAdapterQuery, c as ImportAdapter, d as ImportContext, e as ImportError, f as ImportErrorCode, g as ImportFileOptions, h as ImportInput, i as ImportTarget, R as RegisterImportAdapterOptions, j as createImportContext } from './registry-GJI4gToU.js';
|
|
16
16
|
import { Schema, Slice } from '@tiptap/pm/model';
|
|
17
17
|
import { EditorView } from '@tiptap/pm/view';
|
|
18
18
|
export { MarkdownOptions } from 'tiptap-markdown';
|
|
@@ -230,4 +230,290 @@ declare class FileImportController {
|
|
|
230
230
|
}
|
|
231
231
|
declare function createFileImportController(getTarget: () => ImportEditorTarget | null | undefined, options?: FileImportControllerOptions): FileImportController;
|
|
232
232
|
|
|
233
|
-
|
|
233
|
+
/**
|
|
234
|
+
* Minimal, dependency-free ZIP reader used by the DOCX and zipped-export
|
|
235
|
+
* import adapters.
|
|
236
|
+
*
|
|
237
|
+
* - Reads the central directory (including ZIP64 end records and extra
|
|
238
|
+
* fields), so sizes come from the authoritative directory rather than local
|
|
239
|
+
* headers or data descriptors.
|
|
240
|
+
* - Supports stored (method 0) and deflate (method 8) entries; deflate is
|
|
241
|
+
* inflated with the platform `DecompressionStream("deflate-raw")` (modern
|
|
242
|
+
* browsers, Node ≥ 18).
|
|
243
|
+
* - Guards against zip bombs (entry-count and total-uncompressed-size caps,
|
|
244
|
+
* enforced on the bytes actually inflated, not only the declared sizes),
|
|
245
|
+
* path traversal in entry names and encrypted entries.
|
|
246
|
+
* - Verifies CRC-32 checksums of extracted entries.
|
|
247
|
+
*/
|
|
248
|
+
type ZipErrorCode =
|
|
249
|
+
/** Not a ZIP archive, or its directory is truncated / inconsistent. */
|
|
250
|
+
"invalid_archive"
|
|
251
|
+
/** Compression method other than stored/deflate, multi-disk archives, … */
|
|
252
|
+
| "unsupported_feature"
|
|
253
|
+
/** The entry is encrypted (general-purpose flag bit 0). */
|
|
254
|
+
| "encrypted"
|
|
255
|
+
/** An entry name is absolute or contains `..` segments. */
|
|
256
|
+
| "unsafe_path"
|
|
257
|
+
/** More entries than `maxEntries`. */
|
|
258
|
+
| "too_many_entries"
|
|
259
|
+
/** Extracting would exceed `maxTotalSize` uncompressed bytes. */
|
|
260
|
+
| "too_large"
|
|
261
|
+
/** The entry data is corrupt (bad header, size or CRC mismatch, bad deflate stream). */
|
|
262
|
+
| "corrupt_entry"
|
|
263
|
+
/** No entry with the requested name. */
|
|
264
|
+
| "entry_not_found"
|
|
265
|
+
/** `DecompressionStream` is unavailable in this environment. */
|
|
266
|
+
| "unsupported_environment";
|
|
267
|
+
declare class ZipError extends Error {
|
|
268
|
+
readonly code: ZipErrorCode;
|
|
269
|
+
readonly entryName?: string;
|
|
270
|
+
constructor(code: ZipErrorCode, message: string, details?: {
|
|
271
|
+
entryName?: string;
|
|
272
|
+
cause?: unknown;
|
|
273
|
+
});
|
|
274
|
+
}
|
|
275
|
+
interface ZipEntry {
|
|
276
|
+
/** Entry path with `/` separators (backslashes are normalized). */
|
|
277
|
+
name: string;
|
|
278
|
+
/** Whether the entry is a directory (name ends with `/`). */
|
|
279
|
+
isDirectory: boolean;
|
|
280
|
+
/** Whether the entry is encrypted; reading it throws `ZipError("encrypted")`. */
|
|
281
|
+
encrypted: boolean;
|
|
282
|
+
/** Compression method (0 = stored, 8 = deflate). */
|
|
283
|
+
method: number;
|
|
284
|
+
/** Declared compressed size in bytes. */
|
|
285
|
+
compressedSize: number;
|
|
286
|
+
/** Declared uncompressed size in bytes. */
|
|
287
|
+
size: number;
|
|
288
|
+
/** CRC-32 of the uncompressed data. */
|
|
289
|
+
crc32: number;
|
|
290
|
+
/** Offset of the entry's local file header. */
|
|
291
|
+
localHeaderOffset: number;
|
|
292
|
+
}
|
|
293
|
+
interface ZipReadOptions {
|
|
294
|
+
/** Maximum number of entries in the central directory (default 10 000). */
|
|
295
|
+
maxEntries?: number;
|
|
296
|
+
/**
|
|
297
|
+
* Maximum number of uncompressed bytes extracted from the archive, summed
|
|
298
|
+
* over every `read` call (default 256 MiB). Enforced while inflating.
|
|
299
|
+
*/
|
|
300
|
+
maxTotalSize?: number;
|
|
301
|
+
/**
|
|
302
|
+
* What to do with entries whose names are absolute or contain `..`
|
|
303
|
+
* segments: `"error"` (default) rejects the archive, `"skip"` leaves them
|
|
304
|
+
* out of `entries`.
|
|
305
|
+
*/
|
|
306
|
+
unsafePaths?: "error" | "skip";
|
|
307
|
+
}
|
|
308
|
+
declare const DEFAULT_ZIP_MAX_ENTRIES = 10000;
|
|
309
|
+
declare const DEFAULT_ZIP_MAX_TOTAL_SIZE: number;
|
|
310
|
+
/** CRC-32 (IEEE 802.3), as used by ZIP. */
|
|
311
|
+
declare function zipCrc32(data: Uint8Array): number;
|
|
312
|
+
/** Whether `name` is absolute, has a drive letter, or contains `..` / NUL. */
|
|
313
|
+
declare function isUnsafeZipPath(name: string): boolean;
|
|
314
|
+
/**
|
|
315
|
+
* A parsed ZIP archive. Entry data is extracted lazily with {@link read}.
|
|
316
|
+
* Create it with {@link readZip}.
|
|
317
|
+
*/
|
|
318
|
+
declare class ZipArchive {
|
|
319
|
+
private readonly bytes;
|
|
320
|
+
private readonly maxTotalSize;
|
|
321
|
+
/** Entries in central-directory order. */
|
|
322
|
+
readonly entries: readonly ZipEntry[];
|
|
323
|
+
private readonly byName;
|
|
324
|
+
private extracted;
|
|
325
|
+
constructor(bytes: Uint8Array, entries: ZipEntry[], maxTotalSize: number);
|
|
326
|
+
/** Looks up an entry by exact name (a leading `/` is ignored). */
|
|
327
|
+
get(name: string): ZipEntry | undefined;
|
|
328
|
+
has(name: string): boolean;
|
|
329
|
+
/** Uncompressed bytes extracted so far (counted against `maxTotalSize`). */
|
|
330
|
+
get extractedSize(): number;
|
|
331
|
+
/** Extracts an entry's data, verifying its size and CRC-32. */
|
|
332
|
+
read(entryOrName: ZipEntry | string): Promise<Uint8Array>;
|
|
333
|
+
/** Extracts an entry and decodes it as UTF-8 (a leading BOM is removed). */
|
|
334
|
+
readText(entryOrName: ZipEntry | string): Promise<string>;
|
|
335
|
+
}
|
|
336
|
+
/**
|
|
337
|
+
* Parses a ZIP archive's central directory. Entry data is not extracted until
|
|
338
|
+
* {@link ZipArchive.read} is called. Throws {@link ZipError}.
|
|
339
|
+
*/
|
|
340
|
+
declare function readZip(data: ArrayBuffer | ArrayBufferView, options?: ZipReadOptions): Promise<ZipArchive>;
|
|
341
|
+
|
|
342
|
+
/**
|
|
343
|
+
* Dependency-free DOCX (Office Open XML WordprocessingML) import.
|
|
344
|
+
*
|
|
345
|
+
* Reads the main document part (located through `_rels/.rels`), its
|
|
346
|
+
* relationships, `styles.xml`, `numbering.xml`, `footnotes.xml` and
|
|
347
|
+
* `endnotes.xml` with the platform `DOMParser`, and maps them to TipTap HTML:
|
|
348
|
+
* paragraphs, headings (`Heading1`–`Heading6` / `Title` styles and outline
|
|
349
|
+
* levels), bold / italic / underline / strike / super- and subscript,
|
|
350
|
+
* hyperlinks (relationships, anchors and `HYPERLINK` fields), nested bulleted
|
|
351
|
+
* and numbered lists, simple tables (`colspan` / `rowspan`), line breaks,
|
|
352
|
+
* tabs, footnotes / endnotes and embedded PNG / JPEG / GIF / WebP images as
|
|
353
|
+
* data URLs. The result goes through `sanitizeImportedHtml`.
|
|
354
|
+
*
|
|
355
|
+
* Tracked changes are imported as if accepted (`w:ins` kept, `w:del` dropped)
|
|
356
|
+
* unless `trackedChanges: "original"` is passed. Text boxes, charts, shapes,
|
|
357
|
+
* equations, comments and page layout are not imported.
|
|
358
|
+
*/
|
|
359
|
+
declare const DOCX_MIME_TYPES: readonly ["application/vnd.openxmlformats-officedocument.wordprocessingml.document", "application/vnd.openxmlformats-officedocument.wordprocessingml.template", "application/vnd.ms-word.document.macroenabled.12"];
|
|
360
|
+
interface DocxImportOptions {
|
|
361
|
+
/** Adapter id (default `"docx"`). */
|
|
362
|
+
id?: string;
|
|
363
|
+
/**
|
|
364
|
+
* `DOMParser` constructor used to read the XML parts. Defaults to the global
|
|
365
|
+
* one (browsers, jsdom); pass e.g. jsdom's or `@xmldom/xmldom`'s in Node.
|
|
366
|
+
*/
|
|
367
|
+
DOMParser?: {
|
|
368
|
+
new (): DOMParser;
|
|
369
|
+
};
|
|
370
|
+
/**
|
|
371
|
+
* Tracked changes: `"accepted"` (default) imports insertions and drops
|
|
372
|
+
* deletions; `"original"` does the opposite (as if all were rejected).
|
|
373
|
+
*/
|
|
374
|
+
trackedChanges?: "accepted" | "original";
|
|
375
|
+
/** Embed images from `word/media` as data URLs (default `true`). */
|
|
376
|
+
images?: boolean;
|
|
377
|
+
/** Images larger than this many bytes are skipped (default 10 MiB). */
|
|
378
|
+
maxImageSize?: number;
|
|
379
|
+
/** Limits for reading the DOCX container (default: 100 MiB extracted, 5 000 entries). */
|
|
380
|
+
zip?: ZipReadOptions;
|
|
381
|
+
}
|
|
382
|
+
declare const DEFAULT_DOCX_MAX_IMAGE_SIZE: number;
|
|
383
|
+
/**
|
|
384
|
+
* Converts a DOCX file to sanitized TipTap HTML and plain text. Throws
|
|
385
|
+
* {@link ImportError} (`invalid_file` / `unsupported_environment`) or
|
|
386
|
+
* `ZipError` for damaged or oversized containers.
|
|
387
|
+
*/
|
|
388
|
+
declare function docxToDocumentImport(data: ArrayBuffer | ArrayBufferView, options?: DocxImportOptions): Promise<DocumentImport>;
|
|
389
|
+
/** Creates a DOCX `document` adapter with custom options. */
|
|
390
|
+
declare function createDocxImportAdapter(options?: DocxImportOptions): DocumentImportAdapter;
|
|
391
|
+
/** DOCX adapter with default options; registered in the default registry. */
|
|
392
|
+
declare const docxImportAdapter: DocumentImportAdapter;
|
|
393
|
+
|
|
394
|
+
/**
|
|
395
|
+
* PDF text import through an injected pdf.js-compatible library. The editor
|
|
396
|
+
* ships no PDF parser; consumers that already bundle `pdfjs-dist` register
|
|
397
|
+
* the adapter themselves:
|
|
398
|
+
*
|
|
399
|
+
* ```ts
|
|
400
|
+
* import * as pdfjs from "pdfjs-dist";
|
|
401
|
+
* registerImportAdapter(createPdfImportAdapter(pdfjs));
|
|
402
|
+
* ```
|
|
403
|
+
*
|
|
404
|
+
* Text items are grouped into lines by baseline (`transform[5]`) and lines
|
|
405
|
+
* into paragraphs by vertical gaps larger than the page's typical line
|
|
406
|
+
* spacing (or blank `hasEOL` lines). Only text is imported: no images,
|
|
407
|
+
* tables, links or styling.
|
|
408
|
+
*/
|
|
409
|
+
/** A text item from `page.getTextContent()` (marked-content items have no `str`). */
|
|
410
|
+
interface PdfJsTextItem {
|
|
411
|
+
str: string;
|
|
412
|
+
/** `[a, b, c, d, x, y]` transform; `x` / `y` are the baseline origin. */
|
|
413
|
+
transform?: readonly number[];
|
|
414
|
+
width?: number;
|
|
415
|
+
height?: number;
|
|
416
|
+
/** pdf.js sets this when a line break follows the item. */
|
|
417
|
+
hasEOL?: boolean;
|
|
418
|
+
}
|
|
419
|
+
interface PdfJsTextContent {
|
|
420
|
+
items: ReadonlyArray<PdfJsTextItem | {
|
|
421
|
+
type: string;
|
|
422
|
+
}>;
|
|
423
|
+
}
|
|
424
|
+
interface PdfJsPage {
|
|
425
|
+
getTextContent(): Promise<PdfJsTextContent>;
|
|
426
|
+
cleanup?(): unknown;
|
|
427
|
+
}
|
|
428
|
+
interface PdfJsDocument {
|
|
429
|
+
numPages: number;
|
|
430
|
+
getPage(pageNumber: number): Promise<PdfJsPage>;
|
|
431
|
+
destroy?(): unknown;
|
|
432
|
+
}
|
|
433
|
+
/** The subset of the pdf.js API the adapter uses (`pdfjs-dist` satisfies it). */
|
|
434
|
+
interface PdfJsLike {
|
|
435
|
+
getDocument(source: {
|
|
436
|
+
data: Uint8Array;
|
|
437
|
+
[option: string]: unknown;
|
|
438
|
+
}): {
|
|
439
|
+
promise: Promise<PdfJsDocument>;
|
|
440
|
+
};
|
|
441
|
+
}
|
|
442
|
+
interface PdfTextOptions {
|
|
443
|
+
/**
|
|
444
|
+
* A line gap larger than this multiple of the page's typical line spacing
|
|
445
|
+
* starts a new paragraph (default `1.4`).
|
|
446
|
+
*/
|
|
447
|
+
paragraphGap?: number;
|
|
448
|
+
}
|
|
449
|
+
interface PdfImportOptions extends PdfTextOptions {
|
|
450
|
+
/** Adapter id (default `"pdf"`). */
|
|
451
|
+
id?: string;
|
|
452
|
+
/** Import at most this many pages (default: all). */
|
|
453
|
+
maxPages?: number;
|
|
454
|
+
/** Extra `getDocument` parameters, e.g. `{ disableFontFace: true }`. */
|
|
455
|
+
documentParams?: Record<string, unknown>;
|
|
456
|
+
}
|
|
457
|
+
/**
|
|
458
|
+
* Groups one page's pdf.js text items into paragraphs. Exposed for custom
|
|
459
|
+
* adapters and tests.
|
|
460
|
+
*/
|
|
461
|
+
declare function pdfTextItemsToParagraphs(items: ReadonlyArray<PdfJsTextItem | {
|
|
462
|
+
type: string;
|
|
463
|
+
}>, options?: PdfTextOptions): string[];
|
|
464
|
+
/** Creates a PDF `document` adapter backed by an injected pdf.js-compatible library. */
|
|
465
|
+
declare function createPdfImportAdapter(pdfjs: PdfJsLike, options?: PdfImportOptions): DocumentImportAdapter;
|
|
466
|
+
|
|
467
|
+
/**
|
|
468
|
+
* Zipped document exports (Notion, Confluence, Obsidian, static-site dumps):
|
|
469
|
+
* a `.zip` of markdown / HTML / text / DOCX files. Each entry is imported
|
|
470
|
+
* with the registry's other `document` adapters and the results are
|
|
471
|
+
* concatenated, with a heading per file.
|
|
472
|
+
*
|
|
473
|
+
* Not registered by default: `.zip` is a generic container, and claiming
|
|
474
|
+
* every dropped archive as a document would steal drops from other handlers
|
|
475
|
+
* (e.g. attachment uploads). Opt in with
|
|
476
|
+
* `registerImportAdapter(zipImportAdapter)`.
|
|
477
|
+
*/
|
|
478
|
+
interface ZipDocumentImport extends DocumentImport {
|
|
479
|
+
/** Imported entries in document order, with the adapter that handled each. */
|
|
480
|
+
files: {
|
|
481
|
+
name: string;
|
|
482
|
+
adapterId: string;
|
|
483
|
+
}[];
|
|
484
|
+
/** Entries that were left out, with the reason. */
|
|
485
|
+
skipped: {
|
|
486
|
+
name: string;
|
|
487
|
+
reason: string;
|
|
488
|
+
}[];
|
|
489
|
+
}
|
|
490
|
+
interface ZipImportOptions {
|
|
491
|
+
/** Adapter id (default `"zip"`). */
|
|
492
|
+
id?: string;
|
|
493
|
+
/**
|
|
494
|
+
* Registry used for the entries. Defaults to the registry running the
|
|
495
|
+
* import (`context.registry`), then the default registry.
|
|
496
|
+
*/
|
|
497
|
+
registry?: ImportAdapterRegistry;
|
|
498
|
+
/** Add a heading with each file's title before its content (default `true`). */
|
|
499
|
+
headings?: boolean;
|
|
500
|
+
/** Heading level for file titles (default `2`). */
|
|
501
|
+
headingLevel?: 1 | 2 | 3 | 4 | 5 | 6;
|
|
502
|
+
/** Import at most this many files (default 500); the rest are reported as skipped. */
|
|
503
|
+
maxFiles?: number;
|
|
504
|
+
/** Archive limits (default: 100 MiB extracted, 5 000 entries). */
|
|
505
|
+
zip?: ZipReadOptions;
|
|
506
|
+
}
|
|
507
|
+
/** File title: the name without extension, path or a trailing Notion-style id. */
|
|
508
|
+
declare function zipEntryTitle(path: string): string;
|
|
509
|
+
/**
|
|
510
|
+
* Orders entries for import: index / README files first (shallowest first),
|
|
511
|
+
* then by path with natural number ordering (`2` before `10`).
|
|
512
|
+
*/
|
|
513
|
+
declare function sortZipEntryNames(names: readonly string[]): string[];
|
|
514
|
+
/** Creates a `document` adapter for zipped exports. */
|
|
515
|
+
declare function createZipImportAdapter(options?: ZipImportOptions): DocumentImportAdapter;
|
|
516
|
+
/** Zipped-export adapter with default options. Opt in with `registerImportAdapter(zipImportAdapter)`. */
|
|
517
|
+
declare const zipImportAdapter: DocumentImportAdapter;
|
|
518
|
+
|
|
519
|
+
export { type BaseSlotProps, type ButtonSlotProps, DEFAULT_DOCX_MAX_IMAGE_SIZE, DEFAULT_ZIP_MAX_ENTRIES, DEFAULT_ZIP_MAX_TOTAL_SIZE, DOCX_MIME_TYPES, DirtyTracker, type DirtyTrackerOptions, DocumentImport, DocumentImportAdapter, type DocxImportOptions, EditorController, type EditorControllerOptions, type EditorSlotsMap, FileImportController, type FileImportControllerOptions, type FileImportState, FileLike, ImportAdapterRegistry, type ImportEditorTarget, type ImportFilesIntoEditorOptions, ImportOutcome, type InsertImportedDocumentOptions, type NodeHeaderSlotProps, type PdfImportOptions, type PdfJsDocument, type PdfJsLike, type PdfJsPage, type PdfJsTextContent, type PdfJsTextItem, type PdfTextOptions, Token, type TooltipSlotProps, ZipArchive, type ZipDocumentImport, type ZipEntry, ZipError, type ZipErrorCode, type ZipImportOptions, type ZipReadOptions, createDirtyTracker, createDocxImportAdapter, createEditor, createFileImportController, createPdfImportAdapter, createZipImportAdapter, defaultIsEqual, docxImportAdapter, docxToDocumentImport, htmlToSlice, importFilesIntoEditor, insertImportedDocument, isUnsafeZipPath, pdfTextItemsToParagraphs, pickImportFiles, readZip, sortZipEntryNames, zipCrc32, zipEntryTitle, zipImportAdapter };
|