@pixerate/editor 0.24.0 → 0.26.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 +101 -1
- package/THIRD_PARTY_NOTICES.md +40 -0
- package/dist/agent/index.cjs +175 -11
- package/dist/agent/index.cjs.map +1 -1
- package/dist/agent/index.d.cts +18 -4
- package/dist/agent/index.d.ts +18 -4
- package/dist/agent/index.js +168 -4
- package/dist/agent/index.js.map +1 -1
- package/dist/{arrangeShortcuts-B8O3f8-P.d.cts → arrange-BICutYPk.d.cts} +243 -29
- package/dist/{arrangeShortcuts-sLlD2rSX.d.ts → arrange-BICutYPk.d.ts} +243 -29
- package/dist/builtins-CdPcLwwF.d.cts +176 -0
- package/dist/builtins-Chj6zv_O.d.ts +176 -0
- package/dist/canvas/index.cjs +8588 -1857
- package/dist/canvas/index.cjs.map +1 -1
- package/dist/canvas/index.d.cts +1847 -9
- package/dist/canvas/index.d.ts +1847 -9
- package/dist/canvas/index.js +8577 -1846
- package/dist/canvas/index.js.map +1 -1
- package/dist/chunk-3CC7OPUQ.cjs +831 -0
- package/dist/chunk-3CC7OPUQ.cjs.map +1 -0
- package/dist/chunk-4BVP64JJ.cjs +1406 -0
- package/dist/chunk-4BVP64JJ.cjs.map +1 -0
- package/dist/chunk-BVP3TSLH.cjs +69 -0
- package/dist/chunk-BVP3TSLH.cjs.map +1 -0
- package/dist/{chunk-OLZJXL4R.cjs → chunk-CS6NZWWA.cjs} +59 -25
- package/dist/chunk-CS6NZWWA.cjs.map +1 -0
- package/dist/{chunk-MCSJFWAO.cjs → chunk-EWCOFSCQ.cjs} +685 -100
- package/dist/chunk-EWCOFSCQ.cjs.map +1 -0
- package/dist/chunk-HDYMLS3X.cjs +409 -0
- package/dist/chunk-HDYMLS3X.cjs.map +1 -0
- package/dist/chunk-HRMEDT2L.js +1406 -0
- package/dist/chunk-HRMEDT2L.js.map +1 -0
- package/dist/{chunk-D27YFC46.cjs → chunk-IFHKKVXH.cjs} +382 -63
- package/dist/chunk-IFHKKVXH.cjs.map +1 -0
- package/dist/{chunk-PGNZKFQS.js → chunk-JOIREKL7.js} +137 -58
- package/dist/chunk-JOIREKL7.js.map +1 -0
- package/dist/chunk-KRGXUQ2Y.js +1696 -0
- package/dist/chunk-KRGXUQ2Y.js.map +1 -0
- package/dist/{chunk-3LV6RRPH.js → chunk-MHEPLBFB.js} +2 -2
- package/dist/chunk-MR2764X2.js +831 -0
- package/dist/chunk-MR2764X2.js.map +1 -0
- package/dist/{chunk-XNORY7M6.cjs → chunk-NFVBT3UZ.cjs} +166 -87
- package/dist/chunk-NFVBT3UZ.cjs.map +1 -0
- package/dist/chunk-NQF32I6Z.cjs +6478 -0
- package/dist/chunk-NQF32I6Z.cjs.map +1 -0
- package/dist/chunk-O5RYH2PG.js +69 -0
- package/dist/chunk-O5RYH2PG.js.map +1 -0
- package/dist/{chunk-ITBSKI26.js → chunk-Q2OHWD2A.js} +1064 -360
- package/dist/chunk-Q2OHWD2A.js.map +1 -0
- package/dist/{chunk-FODNLX5N.js → chunk-QJSOZFCZ.js} +38 -4
- package/dist/chunk-QJSOZFCZ.js.map +1 -0
- package/dist/{chunk-SML64VJG.cjs → chunk-RRREAOVM.cjs} +4 -4
- package/dist/{chunk-SML64VJG.cjs.map → chunk-RRREAOVM.cjs.map} +1 -1
- package/dist/{chunk-5S3Z4PPF.js → chunk-SWE3NPOU.js} +347 -28
- package/dist/chunk-SWE3NPOU.js.map +1 -0
- package/dist/chunk-TXXNBDQX.cjs +1696 -0
- package/dist/chunk-TXXNBDQX.cjs.map +1 -0
- package/dist/chunk-UBCFIABU.js +409 -0
- package/dist/chunk-UBCFIABU.js.map +1 -0
- package/dist/chunk-X7HXL2SB.js +6478 -0
- package/dist/chunk-X7HXL2SB.js.map +1 -0
- package/dist/{chunk-SBCZ6RN5.cjs → chunk-YOMYSFJU.cjs} +1163 -459
- package/dist/chunk-YOMYSFJU.cjs.map +1 -0
- package/dist/{chunk-3CN2WD3X.js → chunk-ZRNHGAQT.js} +661 -76
- package/dist/chunk-ZRNHGAQT.js.map +1 -0
- package/dist/commands/index.cjs +425 -4
- package/dist/commands/index.cjs.map +1 -1
- package/dist/commands/index.d.cts +39 -77
- package/dist/commands/index.d.ts +39 -77
- package/dist/commands/index.js +424 -3
- package/dist/commands/index.js.map +1 -1
- package/dist/compare/index.cjs +3 -3
- package/dist/compare/index.d.cts +1 -1
- package/dist/compare/index.d.ts +1 -1
- package/dist/compare/index.js +2 -2
- package/dist/controller-CxXGOEmy.d.cts +2038 -0
- package/dist/controller-CxXGOEmy.d.ts +2038 -0
- package/dist/{documents-BQjzJNe2.d.ts → documents-CHT1U5Vs.d.ts} +10 -0
- package/dist/{documents-KRTPhvst.d.cts → documents-Gp7wb0Me.d.cts} +10 -0
- package/dist/export/index.cjs +36 -0
- package/dist/export/index.cjs.map +1 -0
- package/dist/export/index.d.cts +243 -0
- package/dist/export/index.d.ts +243 -0
- package/dist/export/index.js +36 -0
- package/dist/export/index.js.map +1 -0
- package/dist/extensions/index.cjs +101 -6
- package/dist/extensions/index.cjs.map +1 -1
- package/dist/extensions/index.d.cts +18 -5
- package/dist/extensions/index.d.ts +18 -5
- package/dist/extensions/index.js +101 -6
- package/dist/generation/index.cjs +1013 -69
- package/dist/generation/index.cjs.map +1 -1
- package/dist/generation/index.d.cts +474 -13
- package/dist/generation/index.d.ts +474 -13
- package/dist/generation/index.js +976 -32
- package/dist/generation/index.js.map +1 -1
- package/dist/image-editor/index.cjs +3385 -1275
- package/dist/image-editor/index.cjs.map +1 -1
- package/dist/image-editor/index.d.cts +693 -128
- package/dist/image-editor/index.d.ts +693 -128
- package/dist/image-editor/index.js +3325 -1215
- package/dist/image-editor/index.js.map +1 -1
- package/dist/{index-fJrlkJCd.d.ts → index-B273Zllk.d.ts} +500 -7
- package/dist/{index-BhJBSm2d.d.cts → index-jcJwmBYt.d.cts} +500 -7
- package/dist/index.cjs +1603 -45
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +154 -27
- package/dist/index.d.ts +154 -27
- package/dist/index.js +1584 -26
- package/dist/index.js.map +1 -1
- package/dist/mention-text-CDnCFd3c.d.cts +53 -0
- package/dist/mention-text-CDnCFd3c.d.ts +53 -0
- package/dist/model-C1zApQM8.d.cts +219 -0
- package/dist/model-C1zApQM8.d.ts +219 -0
- package/dist/persistence/index.d.cts +3 -120
- package/dist/persistence/index.d.ts +3 -120
- package/dist/registry-CED5C0lA.d.cts +204 -0
- package/dist/registry-CED5C0lA.d.ts +204 -0
- package/dist/{registry-GJI4gToU.d.cts → registry-CEgwXED1.d.cts} +12 -1
- package/dist/{registry-GJI4gToU.d.ts → registry-CEgwXED1.d.ts} +12 -1
- package/dist/{registry-D32LpIc4.d.cts → registry-D0GADKc7.d.cts} +1 -1
- package/dist/{registry-evKTP4ls.d.ts → registry-DhVUZioj.d.ts} +1 -1
- package/dist/serializers/index.cjs +12 -4
- package/dist/serializers/index.cjs.map +1 -1
- package/dist/serializers/index.d.cts +41 -13
- package/dist/serializers/index.d.ts +41 -13
- package/dist/serializers/index.js +12 -4
- package/dist/spreadsheet/index.cjs +157 -3
- package/dist/spreadsheet/index.cjs.map +1 -1
- package/dist/spreadsheet/index.d.cts +534 -11
- package/dist/spreadsheet/index.d.ts +534 -11
- package/dist/spreadsheet/index.js +157 -3
- package/dist/storage-BpFfspHm.d.cts +120 -0
- package/dist/storage-BpFfspHm.d.ts +120 -0
- package/dist/tokens/index.cjs +115 -0
- package/dist/tokens/index.cjs.map +1 -0
- package/dist/tokens/index.d.cts +212 -0
- package/dist/tokens/index.d.ts +212 -0
- package/dist/tokens/index.js +115 -0
- package/dist/tokens/index.js.map +1 -0
- package/dist/{track-changes-BK5sVf4_.d.cts → track-changes-D_VAPELi.d.cts} +95 -11
- package/dist/{track-changes-CDjCrwKe.d.ts → track-changes-Db_fGEvx.d.ts} +95 -11
- package/package.json +15 -1
- package/dist/chunk-3CN2WD3X.js.map +0 -1
- package/dist/chunk-5S3Z4PPF.js.map +0 -1
- package/dist/chunk-D27YFC46.cjs.map +0 -1
- package/dist/chunk-FODNLX5N.js.map +0 -1
- package/dist/chunk-ITBSKI26.js.map +0 -1
- package/dist/chunk-MA2F5KHF.cjs +0 -3223
- package/dist/chunk-MA2F5KHF.cjs.map +0 -1
- package/dist/chunk-MCSJFWAO.cjs.map +0 -1
- package/dist/chunk-OLZJXL4R.cjs.map +0 -1
- package/dist/chunk-PGNZKFQS.js.map +0 -1
- package/dist/chunk-SBCZ6RN5.cjs.map +0 -1
- package/dist/chunk-U5KWZU4X.js +0 -3223
- package/dist/chunk-U5KWZU4X.js.map +0 -1
- package/dist/chunk-XNORY7M6.cjs.map +0 -1
- package/dist/controller-BhLLAoi8.d.cts +0 -1000
- package/dist/controller-BhLLAoi8.d.ts +0 -1000
- package/dist/types-DX4Mh4SL.d.cts +0 -217
- package/dist/types-DX4Mh4SL.d.ts +0 -217
- /package/dist/{chunk-3LV6RRPH.js.map → chunk-MHEPLBFB.js.map} +0 -0
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { S as StorageAdapter } from '../storage-BpFfspHm.js';
|
|
2
|
+
export { I as IdbFactoryLike, a as IndexedDbAdapterOptions, b as InjectedStorageError, L as LocalStorageAdapterOptions, M as MemoryStorage, O as OpfsAdapterOptions, c as OpfsDirectoryLike, d as OpfsFileLike, e as StorageAdapterOptions, f as StorageFailureMode, g as StorageOperation, h as StorageUnavailableError, W as WebStorageLike, i as createIndexedDbAdapter, j as createLocalStorageAdapter, k as createMemoryStorage, l as createOpfsAdapter, m as isIndexedDbAvailable, n as isLocalStorageAvailable, o as isOpfsAvailable, w as withStorageFailures } from '../storage-BpFfspHm.js';
|
|
1
3
|
export { J as JsonObject, L as LoadDocumentOptions, a as LoadDocumentResult, b as LoadReport, c as LoadSectionsOptions, d as LoadSectionsResult, M as MigrateOptions, e as MigrateResult, f as MigrationStep, R as ReadOnlyReason, S as SectionProblem, g as SectionSpec, h as SectionSpecs, i as createLoadReport, j as hasLoadProblems, l as loadDocument, k as loadSections, m as migrateDocument } from '../migrate-iTlm3a8h.js';
|
|
2
4
|
|
|
3
5
|
/**
|
|
@@ -63,125 +65,6 @@ declare function exponentialBackoff(failures: number, base?: number, max?: numbe
|
|
|
63
65
|
*/
|
|
64
66
|
declare function createRecoveryPolicy(options?: RecoveryPolicyOptions): RecoveryPolicy;
|
|
65
67
|
|
|
66
|
-
/**
|
|
67
|
-
* Key/value storage adapters for autosave and crash recovery. Every adapter is
|
|
68
|
-
* async, stores strings, feature-detects its backend (an unavailable backend
|
|
69
|
-
* rejects every call with `StorageUnavailableError` instead of throwing at
|
|
70
|
-
* construction, so SSR and old browsers are safe) and accepts an injectable
|
|
71
|
-
* failure mode for tests.
|
|
72
|
-
*/
|
|
73
|
-
type StorageOperation = "get" | "set" | "remove";
|
|
74
|
-
/**
|
|
75
|
-
* Injected failure: return `true` (or an `Error`) to make that operation fail.
|
|
76
|
-
* Example: `failure: (op) => op === "set"` simulates a full disk.
|
|
77
|
-
*/
|
|
78
|
-
type StorageFailureMode = (operation: StorageOperation, key: string) => boolean | Error | undefined | void;
|
|
79
|
-
interface StorageAdapter {
|
|
80
|
-
/** Short backend name, e.g. `"memory"`, `"localStorage"`, `"indexedDB"`, `"opfs"`. */
|
|
81
|
-
readonly kind: string;
|
|
82
|
-
/** Whether the backend was found. When `false`, every call rejects. */
|
|
83
|
-
readonly available: boolean;
|
|
84
|
-
get(key: string): Promise<string | null>;
|
|
85
|
-
set(key: string, value: string): Promise<void>;
|
|
86
|
-
remove(key: string): Promise<void>;
|
|
87
|
-
}
|
|
88
|
-
interface StorageAdapterOptions {
|
|
89
|
-
failure?: StorageFailureMode;
|
|
90
|
-
}
|
|
91
|
-
declare class StorageUnavailableError extends Error {
|
|
92
|
-
constructor(kind: string);
|
|
93
|
-
}
|
|
94
|
-
declare class InjectedStorageError extends Error {
|
|
95
|
-
constructor(operation: StorageOperation, key: string);
|
|
96
|
-
}
|
|
97
|
-
/** Wraps an adapter so `failure` can make any of its operations fail. */
|
|
98
|
-
declare function withStorageFailures(inner: StorageAdapter, failure: StorageFailureMode): StorageAdapter;
|
|
99
|
-
interface MemoryStorage extends StorageAdapter {
|
|
100
|
-
/** The underlying map (inspect it in tests). */
|
|
101
|
-
readonly entries: Map<string, string>;
|
|
102
|
-
}
|
|
103
|
-
/** In-memory storage (tests, SSR, or a session-only fallback). */
|
|
104
|
-
declare function createMemoryStorage(options?: StorageAdapterOptions & {
|
|
105
|
-
initial?: Record<string, string>;
|
|
106
|
-
}): MemoryStorage;
|
|
107
|
-
/** Minimal `Storage` surface used by the localStorage adapter. */
|
|
108
|
-
interface WebStorageLike {
|
|
109
|
-
getItem(key: string): string | null;
|
|
110
|
-
setItem(key: string, value: string): void;
|
|
111
|
-
removeItem(key: string): void;
|
|
112
|
-
}
|
|
113
|
-
interface LocalStorageAdapterOptions extends StorageAdapterOptions {
|
|
114
|
-
/** Storage to use (default `globalThis.localStorage`, e.g. pass `sessionStorage`). */
|
|
115
|
-
storage?: WebStorageLike;
|
|
116
|
-
}
|
|
117
|
-
/** Whether `localStorage` can be used (it throws when site data is blocked). */
|
|
118
|
-
declare function isLocalStorageAvailable(): boolean;
|
|
119
|
-
/**
|
|
120
|
-
* `localStorage` adapter; every key is prefixed with `prefix`. Writes are
|
|
121
|
-
* synchronous under the hood, so they complete even inside `pagehide`.
|
|
122
|
-
* A full quota rejects the `set` (`QuotaExceededError`).
|
|
123
|
-
*/
|
|
124
|
-
declare function createLocalStorageAdapter(prefix?: string, options?: LocalStorageAdapterOptions): StorageAdapter;
|
|
125
|
-
/** Minimal `IDBFactory` surface (the real `indexedDB`, or a fake in tests). */
|
|
126
|
-
interface IdbFactoryLike {
|
|
127
|
-
open(name: string, version?: number): any;
|
|
128
|
-
}
|
|
129
|
-
interface IndexedDbAdapterOptions extends StorageAdapterOptions {
|
|
130
|
-
/** Object store name (default `"kv"`). */
|
|
131
|
-
store?: string;
|
|
132
|
-
/** Factory to use (default `globalThis.indexedDB`). */
|
|
133
|
-
indexedDB?: IdbFactoryLike;
|
|
134
|
-
}
|
|
135
|
-
/** Whether `indexedDB` exists in this environment. */
|
|
136
|
-
declare function isIndexedDbAvailable(): boolean;
|
|
137
|
-
/**
|
|
138
|
-
* IndexedDB adapter: one database `name` with a single key/value object store.
|
|
139
|
-
* A `set` resolves when its transaction completes (not merely when the request
|
|
140
|
-
* succeeds), so a resolved write is durable.
|
|
141
|
-
*/
|
|
142
|
-
declare function createIndexedDbAdapter(name?: string, options?: IndexedDbAdapterOptions): StorageAdapter;
|
|
143
|
-
/** Minimal `FileSystemDirectoryHandle` surface used by the OPFS adapter. */
|
|
144
|
-
interface OpfsDirectoryLike {
|
|
145
|
-
getDirectoryHandle(name: string, options?: {
|
|
146
|
-
create?: boolean;
|
|
147
|
-
}): Promise<OpfsDirectoryLike>;
|
|
148
|
-
getFileHandle(name: string, options?: {
|
|
149
|
-
create?: boolean;
|
|
150
|
-
}): Promise<OpfsFileLike>;
|
|
151
|
-
removeEntry(name: string): Promise<void>;
|
|
152
|
-
}
|
|
153
|
-
interface OpfsFileLike {
|
|
154
|
-
getFile(): Promise<{
|
|
155
|
-
text(): Promise<string>;
|
|
156
|
-
}>;
|
|
157
|
-
createWritable?(): Promise<{
|
|
158
|
-
write(data: string): Promise<void>;
|
|
159
|
-
close(): Promise<void>;
|
|
160
|
-
}>;
|
|
161
|
-
/** Rename in place (Chromium, Safari). Used for temp-file + rename writes. */
|
|
162
|
-
move?(name: string): Promise<void>;
|
|
163
|
-
}
|
|
164
|
-
interface OpfsAdapterOptions extends StorageAdapterOptions {
|
|
165
|
-
/** Root directory (default `navigator.storage.getDirectory()`). */
|
|
166
|
-
root?: () => Promise<OpfsDirectoryLike>;
|
|
167
|
-
/** Force the write-then-pointer-swap strategy even when `move` exists. */
|
|
168
|
-
disableRename?: boolean;
|
|
169
|
-
}
|
|
170
|
-
/** Whether the Origin Private File System exists (`navigator.storage.getDirectory`). */
|
|
171
|
-
declare function isOpfsAvailable(): boolean;
|
|
172
|
-
/**
|
|
173
|
-
* Origin Private File System adapter. Values are files in `dir` (created on
|
|
174
|
-
* demand), named after the URI-encoded key.
|
|
175
|
-
*
|
|
176
|
-
* Writes never leave a half-written value behind: where file handles support
|
|
177
|
-
* `move`, the value is written to `<file>.tmp` and renamed over `<file>`;
|
|
178
|
-
* otherwise it alternates between two slots (`<file>.a` / `<file>.b`) and then
|
|
179
|
-
* swaps a pointer file (`<file>.ptr`), so a crash mid-write keeps the previous
|
|
180
|
-
* value. Main-thread writes need `createWritable` (missing in some Safari
|
|
181
|
-
* versions); without it, `set` rejects with `StorageUnavailableError`.
|
|
182
|
-
*/
|
|
183
|
-
declare function createOpfsAdapter(dir?: string, options?: OpfsAdapterOptions): StorageAdapter;
|
|
184
|
-
|
|
185
68
|
type AutosaveStatus = "idle" | "dirty" | "saving" | "saved" | "error";
|
|
186
69
|
interface AutosaveStatusInfo {
|
|
187
70
|
status: AutosaveStatus;
|
|
@@ -344,4 +227,4 @@ interface RevisionTracker {
|
|
|
344
227
|
*/
|
|
345
228
|
declare function createRevisionTracker(options?: RevisionTrackerOptions): RevisionTracker;
|
|
346
229
|
|
|
347
|
-
export { type AutosaveController, type AutosaveControllerOptions, type AutosaveRecovery, type AutosaveStatus, type AutosaveStatusInfo, type DirtyFlagSource, type
|
|
230
|
+
export { type AutosaveController, type AutosaveControllerOptions, type AutosaveRecovery, type AutosaveStatus, type AutosaveStatusInfo, type DirtyFlagSource, type RecoveryAction, type RecoveryMeta, type RecoveryPolicy, type RecoveryPolicyOptions, type RecoveryTickOptions, type RevisionChangeSource, type RevisionTracker, type RevisionTrackerOptions, StorageAdapter, createAutosaveController, createRecoveryPolicy, createRevisionTracker, exponentialBackoff, formatRecoveryMessage, recoveryMetaKey };
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
/** Paragraph styles format whole blocks; character styles format runs of text. */
|
|
2
|
+
type StyleKind = "paragraph" | "character";
|
|
3
|
+
/** Character formatting of a style (CSS values). */
|
|
4
|
+
interface CharacterFormat {
|
|
5
|
+
fontFamily?: string;
|
|
6
|
+
/** CSS length, e.g. `"1.5em"` or `"18px"`. */
|
|
7
|
+
fontSize?: string;
|
|
8
|
+
bold?: boolean;
|
|
9
|
+
italic?: boolean;
|
|
10
|
+
underline?: boolean;
|
|
11
|
+
strike?: boolean;
|
|
12
|
+
color?: string;
|
|
13
|
+
backgroundColor?: string;
|
|
14
|
+
letterSpacing?: string;
|
|
15
|
+
textTransform?: "none" | "uppercase" | "lowercase" | "capitalize";
|
|
16
|
+
smallCaps?: boolean;
|
|
17
|
+
}
|
|
18
|
+
/** Paragraph formatting of a style (CSS values). */
|
|
19
|
+
interface ParagraphFormat {
|
|
20
|
+
textAlign?: "left" | "center" | "right" | "justify";
|
|
21
|
+
lineHeight?: string;
|
|
22
|
+
spaceBefore?: string;
|
|
23
|
+
spaceAfter?: string;
|
|
24
|
+
indentLeft?: string;
|
|
25
|
+
indentRight?: string;
|
|
26
|
+
indentFirstLine?: string;
|
|
27
|
+
/** CSS border shorthand, e.g. `"3px solid currentColor"`. */
|
|
28
|
+
borderLeft?: string;
|
|
29
|
+
paddingLeft?: string;
|
|
30
|
+
backgroundColor?: string;
|
|
31
|
+
}
|
|
32
|
+
/** The block node a paragraph style uses (`heading` with `level` for Heading N). */
|
|
33
|
+
interface StyleBlock {
|
|
34
|
+
type: string;
|
|
35
|
+
attrs?: Record<string, any>;
|
|
36
|
+
}
|
|
37
|
+
interface StyleDefinition {
|
|
38
|
+
/** Stable id (`Heading1`): letters, digits, `_` and `-`, starting with a letter. */
|
|
39
|
+
id: string;
|
|
40
|
+
/** Display name (`Heading 1`). */
|
|
41
|
+
name: string;
|
|
42
|
+
kind: StyleKind;
|
|
43
|
+
/** Style this one inherits from; what it sets wins over its base. */
|
|
44
|
+
basedOn?: string | null;
|
|
45
|
+
/** Style of the paragraph after this one when Enter is pressed at its end (paragraph styles). */
|
|
46
|
+
next?: string | null;
|
|
47
|
+
/** Linked style: a paragraph style's character style, or a character style's paragraph style. */
|
|
48
|
+
linked?: string | null;
|
|
49
|
+
paragraph?: ParagraphFormat;
|
|
50
|
+
character?: CharacterFormat;
|
|
51
|
+
/** Block node of a paragraph style. Inherited along `basedOn`; `paragraph` by default. */
|
|
52
|
+
block?: StyleBlock | null;
|
|
53
|
+
/** Gallery order (lower first). */
|
|
54
|
+
priority?: number;
|
|
55
|
+
/** Shown in the styles gallery. */
|
|
56
|
+
quick?: boolean;
|
|
57
|
+
hidden?: boolean;
|
|
58
|
+
/** Built in (cannot be removed). */
|
|
59
|
+
builtin?: boolean;
|
|
60
|
+
}
|
|
61
|
+
/** A style with its `basedOn` chain and the defaults merged. */
|
|
62
|
+
interface ResolvedStyle {
|
|
63
|
+
id: string;
|
|
64
|
+
paragraph: ParagraphFormat;
|
|
65
|
+
character: CharacterFormat;
|
|
66
|
+
block: StyleBlock;
|
|
67
|
+
/** Id of the style after Enter at the end of a paragraph. */
|
|
68
|
+
next: string;
|
|
69
|
+
}
|
|
70
|
+
interface StyleDefaults {
|
|
71
|
+
paragraph?: ParagraphFormat;
|
|
72
|
+
character?: CharacterFormat;
|
|
73
|
+
}
|
|
74
|
+
interface StyleRegistryOptions {
|
|
75
|
+
/** Styles added to (or replacing) the built-in ones. */
|
|
76
|
+
styles?: readonly StyleDefinition[];
|
|
77
|
+
/** Include the built-in styles. Default `true`. */
|
|
78
|
+
builtins?: boolean;
|
|
79
|
+
/** Document defaults, applied below every style. */
|
|
80
|
+
defaults?: StyleDefaults;
|
|
81
|
+
}
|
|
82
|
+
interface StyleRegistrySnapshot {
|
|
83
|
+
styles: readonly StyleDefinition[];
|
|
84
|
+
defaults: StyleDefaults;
|
|
85
|
+
/** Increases on every change. */
|
|
86
|
+
version: number;
|
|
87
|
+
}
|
|
88
|
+
/** Serializable registry content (`registry.toJSON()`). */
|
|
89
|
+
interface StyleRegistryJSON {
|
|
90
|
+
styles: StyleDefinition[];
|
|
91
|
+
defaults: StyleDefaults;
|
|
92
|
+
}
|
|
93
|
+
interface StyleCSSOptions {
|
|
94
|
+
/** Selector the rules are scoped to. Default `.ProseMirror`. */
|
|
95
|
+
scope?: string;
|
|
96
|
+
/**
|
|
97
|
+
* Element selector of blocks that use a style without naming it
|
|
98
|
+
* (`data-style` absent), e.g. `h2` for Heading 2. Return `null` for none.
|
|
99
|
+
*/
|
|
100
|
+
tagFor?: (block: StyleBlock) => string | null;
|
|
101
|
+
}
|
|
102
|
+
declare const NORMAL_STYLE_ID = "Normal";
|
|
103
|
+
/** Whether `id` is a valid style id. */
|
|
104
|
+
declare function isValidStyleId(id: unknown): id is string;
|
|
105
|
+
/** The built-in styles: Normal, Title, Subtitle, Heading 1–6, Quote, Code, List Paragraph and character styles. */
|
|
106
|
+
declare const DEFAULT_STYLES: readonly StyleDefinition[];
|
|
107
|
+
/**
|
|
108
|
+
* Style definitions with `basedOn` inheritance, next-style and linked
|
|
109
|
+
* character/paragraph styles, resolved in cascade order: document defaults →
|
|
110
|
+
* style chain (base first) → direct formatting. Chains are cycle-safe.
|
|
111
|
+
*
|
|
112
|
+
* `subscribe` calls the listener immediately and on every change (Svelte
|
|
113
|
+
* store contract); `getSnapshot` is stable between changes.
|
|
114
|
+
*/
|
|
115
|
+
declare class StyleRegistry {
|
|
116
|
+
private styles;
|
|
117
|
+
private defaults;
|
|
118
|
+
private version;
|
|
119
|
+
private snapshot;
|
|
120
|
+
private listeners;
|
|
121
|
+
constructor(options?: StyleRegistryOptions);
|
|
122
|
+
get(id: string | null | undefined): StyleDefinition | undefined;
|
|
123
|
+
/** Finds a style by id or display name (case-insensitive). */
|
|
124
|
+
find(nameOrId: string): StyleDefinition | undefined;
|
|
125
|
+
/** All styles (optionally of one kind) in gallery order. */
|
|
126
|
+
list(kind?: StyleKind): StyleDefinition[];
|
|
127
|
+
/** Styles shown in the gallery (`quick`, not hidden), paragraph styles by default. */
|
|
128
|
+
gallery(kind?: StyleKind): StyleDefinition[];
|
|
129
|
+
/** The `basedOn` chain from the root style down to `id` (cycle-safe, bounded). */
|
|
130
|
+
chain(id: string): StyleDefinition[];
|
|
131
|
+
/**
|
|
132
|
+
* Resolves a paragraph style: defaults, then each style of the chain (base
|
|
133
|
+
* first). Unknown ids resolve to the defaults in a `paragraph` block.
|
|
134
|
+
*/
|
|
135
|
+
resolve(id: string): ResolvedStyle;
|
|
136
|
+
/** Character formatting a paragraph style's chain sets (without defaults). */
|
|
137
|
+
private paragraphCharacter;
|
|
138
|
+
/**
|
|
139
|
+
* Character formatting of a character style's chain. A style linked to a
|
|
140
|
+
* paragraph style takes that style's character formatting first.
|
|
141
|
+
*/
|
|
142
|
+
resolveCharacterStyle(id: string): CharacterFormat;
|
|
143
|
+
/**
|
|
144
|
+
* Character formatting of text: defaults → paragraph style chain →
|
|
145
|
+
* character style chain → direct formatting.
|
|
146
|
+
*/
|
|
147
|
+
resolveText(input: {
|
|
148
|
+
paragraphStyle?: string | null;
|
|
149
|
+
characterStyle?: string | null;
|
|
150
|
+
direct?: CharacterFormat;
|
|
151
|
+
}): CharacterFormat;
|
|
152
|
+
/** The style after Enter at the end of a paragraph of `id` (itself when unset or unknown). */
|
|
153
|
+
nextStyleId(id: string): string;
|
|
154
|
+
/** The linked character style of a paragraph style, if any. */
|
|
155
|
+
linkedCharacterStyle(id: string): StyleDefinition | undefined;
|
|
156
|
+
/**
|
|
157
|
+
* The style a block uses when it names none: Normal for paragraphs,
|
|
158
|
+
* Heading N for headings of level N, Code for code blocks (the built-in
|
|
159
|
+
* style whose own `block` matches).
|
|
160
|
+
*/
|
|
161
|
+
defaultStyleFor(type: string, attrs?: Record<string, any>): string | null;
|
|
162
|
+
/** The style of a block: its `styleId` when known, otherwise the block's default style. */
|
|
163
|
+
styleOfBlock(type: string, attrs?: Record<string, any>): string | null;
|
|
164
|
+
getSnapshot: () => StyleRegistrySnapshot;
|
|
165
|
+
subscribe: (listener: (snapshot: StyleRegistrySnapshot) => void) => (() => void);
|
|
166
|
+
toJSON(): StyleRegistryJSON;
|
|
167
|
+
/** Adds or replaces a style. Throws on an invalid id. */
|
|
168
|
+
upsert(style: StyleDefinition): StyleDefinition;
|
|
169
|
+
/** Merges `patch` into a style (formats are merged key by key). Returns `undefined` for unknown ids. */
|
|
170
|
+
update(id: string, patch: Partial<Omit<StyleDefinition, "id">>): StyleDefinition | undefined;
|
|
171
|
+
/**
|
|
172
|
+
* Removes a style and returns it. Built-in styles cannot be removed. Styles
|
|
173
|
+
* based on it are rebased onto its own base, and `next`/`linked`
|
|
174
|
+
* references to it are dropped.
|
|
175
|
+
*/
|
|
176
|
+
remove(id: string): StyleDefinition | undefined;
|
|
177
|
+
/** Replaces the document defaults. */
|
|
178
|
+
setDefaults(defaults: StyleDefaults): void;
|
|
179
|
+
/** An unused id derived from a display name (`My Style` → `MyStyle`, then `MyStyle1`, …). */
|
|
180
|
+
newId(name: string): string;
|
|
181
|
+
/** CSS declarations (`property: value`) of a resolved paragraph or character style. */
|
|
182
|
+
cssDeclarations(id: string): Record<string, string>;
|
|
183
|
+
/**
|
|
184
|
+
* Declarations for previewing a style in a menu or gallery: font family,
|
|
185
|
+
* weight, style, color, decoration, case and letter spacing (no sizes,
|
|
186
|
+
* margins or borders).
|
|
187
|
+
*/
|
|
188
|
+
previewDeclarations(id: string): Record<string, string>;
|
|
189
|
+
/**
|
|
190
|
+
* A stylesheet for the styles: `[data-style="Id"]` rules for paragraph
|
|
191
|
+
* styles (plus the plain element of blocks that use their default style,
|
|
192
|
+
* e.g. `h2:not([data-style])`), `[data-char-style="Id"]` for character
|
|
193
|
+
* styles and the defaults on the scope element.
|
|
194
|
+
*/
|
|
195
|
+
toCSS(options?: StyleCSSOptions): string;
|
|
196
|
+
private put;
|
|
197
|
+
private changed;
|
|
198
|
+
}
|
|
199
|
+
/** A CSS value, or `undefined` when it is unsafe or empty. */
|
|
200
|
+
declare function safeCSSValue(value: unknown): string | undefined;
|
|
201
|
+
/** Creates a style registry with the built-in styles (unless `builtins: false`) and `styles`. */
|
|
202
|
+
declare function createStyleRegistry(options?: StyleRegistryOptions | StyleRegistryJSON): StyleRegistry;
|
|
203
|
+
|
|
204
|
+
export { type CharacterFormat as C, DEFAULT_STYLES as D, NORMAL_STYLE_ID as N, type ParagraphFormat as P, type ResolvedStyle as R, type StyleBlock as S, type StyleCSSOptions as a, type StyleDefaults as b, type StyleDefinition as c, type StyleKind as d, StyleRegistry as e, type StyleRegistryJSON as f, type StyleRegistryOptions as g, type StyleRegistrySnapshot as h, createStyleRegistry as i, isValidStyleId as j, safeCSSValue as s };
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
/** Paragraph styles format whole blocks; character styles format runs of text. */
|
|
2
|
+
type StyleKind = "paragraph" | "character";
|
|
3
|
+
/** Character formatting of a style (CSS values). */
|
|
4
|
+
interface CharacterFormat {
|
|
5
|
+
fontFamily?: string;
|
|
6
|
+
/** CSS length, e.g. `"1.5em"` or `"18px"`. */
|
|
7
|
+
fontSize?: string;
|
|
8
|
+
bold?: boolean;
|
|
9
|
+
italic?: boolean;
|
|
10
|
+
underline?: boolean;
|
|
11
|
+
strike?: boolean;
|
|
12
|
+
color?: string;
|
|
13
|
+
backgroundColor?: string;
|
|
14
|
+
letterSpacing?: string;
|
|
15
|
+
textTransform?: "none" | "uppercase" | "lowercase" | "capitalize";
|
|
16
|
+
smallCaps?: boolean;
|
|
17
|
+
}
|
|
18
|
+
/** Paragraph formatting of a style (CSS values). */
|
|
19
|
+
interface ParagraphFormat {
|
|
20
|
+
textAlign?: "left" | "center" | "right" | "justify";
|
|
21
|
+
lineHeight?: string;
|
|
22
|
+
spaceBefore?: string;
|
|
23
|
+
spaceAfter?: string;
|
|
24
|
+
indentLeft?: string;
|
|
25
|
+
indentRight?: string;
|
|
26
|
+
indentFirstLine?: string;
|
|
27
|
+
/** CSS border shorthand, e.g. `"3px solid currentColor"`. */
|
|
28
|
+
borderLeft?: string;
|
|
29
|
+
paddingLeft?: string;
|
|
30
|
+
backgroundColor?: string;
|
|
31
|
+
}
|
|
32
|
+
/** The block node a paragraph style uses (`heading` with `level` for Heading N). */
|
|
33
|
+
interface StyleBlock {
|
|
34
|
+
type: string;
|
|
35
|
+
attrs?: Record<string, any>;
|
|
36
|
+
}
|
|
37
|
+
interface StyleDefinition {
|
|
38
|
+
/** Stable id (`Heading1`): letters, digits, `_` and `-`, starting with a letter. */
|
|
39
|
+
id: string;
|
|
40
|
+
/** Display name (`Heading 1`). */
|
|
41
|
+
name: string;
|
|
42
|
+
kind: StyleKind;
|
|
43
|
+
/** Style this one inherits from; what it sets wins over its base. */
|
|
44
|
+
basedOn?: string | null;
|
|
45
|
+
/** Style of the paragraph after this one when Enter is pressed at its end (paragraph styles). */
|
|
46
|
+
next?: string | null;
|
|
47
|
+
/** Linked style: a paragraph style's character style, or a character style's paragraph style. */
|
|
48
|
+
linked?: string | null;
|
|
49
|
+
paragraph?: ParagraphFormat;
|
|
50
|
+
character?: CharacterFormat;
|
|
51
|
+
/** Block node of a paragraph style. Inherited along `basedOn`; `paragraph` by default. */
|
|
52
|
+
block?: StyleBlock | null;
|
|
53
|
+
/** Gallery order (lower first). */
|
|
54
|
+
priority?: number;
|
|
55
|
+
/** Shown in the styles gallery. */
|
|
56
|
+
quick?: boolean;
|
|
57
|
+
hidden?: boolean;
|
|
58
|
+
/** Built in (cannot be removed). */
|
|
59
|
+
builtin?: boolean;
|
|
60
|
+
}
|
|
61
|
+
/** A style with its `basedOn` chain and the defaults merged. */
|
|
62
|
+
interface ResolvedStyle {
|
|
63
|
+
id: string;
|
|
64
|
+
paragraph: ParagraphFormat;
|
|
65
|
+
character: CharacterFormat;
|
|
66
|
+
block: StyleBlock;
|
|
67
|
+
/** Id of the style after Enter at the end of a paragraph. */
|
|
68
|
+
next: string;
|
|
69
|
+
}
|
|
70
|
+
interface StyleDefaults {
|
|
71
|
+
paragraph?: ParagraphFormat;
|
|
72
|
+
character?: CharacterFormat;
|
|
73
|
+
}
|
|
74
|
+
interface StyleRegistryOptions {
|
|
75
|
+
/** Styles added to (or replacing) the built-in ones. */
|
|
76
|
+
styles?: readonly StyleDefinition[];
|
|
77
|
+
/** Include the built-in styles. Default `true`. */
|
|
78
|
+
builtins?: boolean;
|
|
79
|
+
/** Document defaults, applied below every style. */
|
|
80
|
+
defaults?: StyleDefaults;
|
|
81
|
+
}
|
|
82
|
+
interface StyleRegistrySnapshot {
|
|
83
|
+
styles: readonly StyleDefinition[];
|
|
84
|
+
defaults: StyleDefaults;
|
|
85
|
+
/** Increases on every change. */
|
|
86
|
+
version: number;
|
|
87
|
+
}
|
|
88
|
+
/** Serializable registry content (`registry.toJSON()`). */
|
|
89
|
+
interface StyleRegistryJSON {
|
|
90
|
+
styles: StyleDefinition[];
|
|
91
|
+
defaults: StyleDefaults;
|
|
92
|
+
}
|
|
93
|
+
interface StyleCSSOptions {
|
|
94
|
+
/** Selector the rules are scoped to. Default `.ProseMirror`. */
|
|
95
|
+
scope?: string;
|
|
96
|
+
/**
|
|
97
|
+
* Element selector of blocks that use a style without naming it
|
|
98
|
+
* (`data-style` absent), e.g. `h2` for Heading 2. Return `null` for none.
|
|
99
|
+
*/
|
|
100
|
+
tagFor?: (block: StyleBlock) => string | null;
|
|
101
|
+
}
|
|
102
|
+
declare const NORMAL_STYLE_ID = "Normal";
|
|
103
|
+
/** Whether `id` is a valid style id. */
|
|
104
|
+
declare function isValidStyleId(id: unknown): id is string;
|
|
105
|
+
/** The built-in styles: Normal, Title, Subtitle, Heading 1–6, Quote, Code, List Paragraph and character styles. */
|
|
106
|
+
declare const DEFAULT_STYLES: readonly StyleDefinition[];
|
|
107
|
+
/**
|
|
108
|
+
* Style definitions with `basedOn` inheritance, next-style and linked
|
|
109
|
+
* character/paragraph styles, resolved in cascade order: document defaults →
|
|
110
|
+
* style chain (base first) → direct formatting. Chains are cycle-safe.
|
|
111
|
+
*
|
|
112
|
+
* `subscribe` calls the listener immediately and on every change (Svelte
|
|
113
|
+
* store contract); `getSnapshot` is stable between changes.
|
|
114
|
+
*/
|
|
115
|
+
declare class StyleRegistry {
|
|
116
|
+
private styles;
|
|
117
|
+
private defaults;
|
|
118
|
+
private version;
|
|
119
|
+
private snapshot;
|
|
120
|
+
private listeners;
|
|
121
|
+
constructor(options?: StyleRegistryOptions);
|
|
122
|
+
get(id: string | null | undefined): StyleDefinition | undefined;
|
|
123
|
+
/** Finds a style by id or display name (case-insensitive). */
|
|
124
|
+
find(nameOrId: string): StyleDefinition | undefined;
|
|
125
|
+
/** All styles (optionally of one kind) in gallery order. */
|
|
126
|
+
list(kind?: StyleKind): StyleDefinition[];
|
|
127
|
+
/** Styles shown in the gallery (`quick`, not hidden), paragraph styles by default. */
|
|
128
|
+
gallery(kind?: StyleKind): StyleDefinition[];
|
|
129
|
+
/** The `basedOn` chain from the root style down to `id` (cycle-safe, bounded). */
|
|
130
|
+
chain(id: string): StyleDefinition[];
|
|
131
|
+
/**
|
|
132
|
+
* Resolves a paragraph style: defaults, then each style of the chain (base
|
|
133
|
+
* first). Unknown ids resolve to the defaults in a `paragraph` block.
|
|
134
|
+
*/
|
|
135
|
+
resolve(id: string): ResolvedStyle;
|
|
136
|
+
/** Character formatting a paragraph style's chain sets (without defaults). */
|
|
137
|
+
private paragraphCharacter;
|
|
138
|
+
/**
|
|
139
|
+
* Character formatting of a character style's chain. A style linked to a
|
|
140
|
+
* paragraph style takes that style's character formatting first.
|
|
141
|
+
*/
|
|
142
|
+
resolveCharacterStyle(id: string): CharacterFormat;
|
|
143
|
+
/**
|
|
144
|
+
* Character formatting of text: defaults → paragraph style chain →
|
|
145
|
+
* character style chain → direct formatting.
|
|
146
|
+
*/
|
|
147
|
+
resolveText(input: {
|
|
148
|
+
paragraphStyle?: string | null;
|
|
149
|
+
characterStyle?: string | null;
|
|
150
|
+
direct?: CharacterFormat;
|
|
151
|
+
}): CharacterFormat;
|
|
152
|
+
/** The style after Enter at the end of a paragraph of `id` (itself when unset or unknown). */
|
|
153
|
+
nextStyleId(id: string): string;
|
|
154
|
+
/** The linked character style of a paragraph style, if any. */
|
|
155
|
+
linkedCharacterStyle(id: string): StyleDefinition | undefined;
|
|
156
|
+
/**
|
|
157
|
+
* The style a block uses when it names none: Normal for paragraphs,
|
|
158
|
+
* Heading N for headings of level N, Code for code blocks (the built-in
|
|
159
|
+
* style whose own `block` matches).
|
|
160
|
+
*/
|
|
161
|
+
defaultStyleFor(type: string, attrs?: Record<string, any>): string | null;
|
|
162
|
+
/** The style of a block: its `styleId` when known, otherwise the block's default style. */
|
|
163
|
+
styleOfBlock(type: string, attrs?: Record<string, any>): string | null;
|
|
164
|
+
getSnapshot: () => StyleRegistrySnapshot;
|
|
165
|
+
subscribe: (listener: (snapshot: StyleRegistrySnapshot) => void) => (() => void);
|
|
166
|
+
toJSON(): StyleRegistryJSON;
|
|
167
|
+
/** Adds or replaces a style. Throws on an invalid id. */
|
|
168
|
+
upsert(style: StyleDefinition): StyleDefinition;
|
|
169
|
+
/** Merges `patch` into a style (formats are merged key by key). Returns `undefined` for unknown ids. */
|
|
170
|
+
update(id: string, patch: Partial<Omit<StyleDefinition, "id">>): StyleDefinition | undefined;
|
|
171
|
+
/**
|
|
172
|
+
* Removes a style and returns it. Built-in styles cannot be removed. Styles
|
|
173
|
+
* based on it are rebased onto its own base, and `next`/`linked`
|
|
174
|
+
* references to it are dropped.
|
|
175
|
+
*/
|
|
176
|
+
remove(id: string): StyleDefinition | undefined;
|
|
177
|
+
/** Replaces the document defaults. */
|
|
178
|
+
setDefaults(defaults: StyleDefaults): void;
|
|
179
|
+
/** An unused id derived from a display name (`My Style` → `MyStyle`, then `MyStyle1`, …). */
|
|
180
|
+
newId(name: string): string;
|
|
181
|
+
/** CSS declarations (`property: value`) of a resolved paragraph or character style. */
|
|
182
|
+
cssDeclarations(id: string): Record<string, string>;
|
|
183
|
+
/**
|
|
184
|
+
* Declarations for previewing a style in a menu or gallery: font family,
|
|
185
|
+
* weight, style, color, decoration, case and letter spacing (no sizes,
|
|
186
|
+
* margins or borders).
|
|
187
|
+
*/
|
|
188
|
+
previewDeclarations(id: string): Record<string, string>;
|
|
189
|
+
/**
|
|
190
|
+
* A stylesheet for the styles: `[data-style="Id"]` rules for paragraph
|
|
191
|
+
* styles (plus the plain element of blocks that use their default style,
|
|
192
|
+
* e.g. `h2:not([data-style])`), `[data-char-style="Id"]` for character
|
|
193
|
+
* styles and the defaults on the scope element.
|
|
194
|
+
*/
|
|
195
|
+
toCSS(options?: StyleCSSOptions): string;
|
|
196
|
+
private put;
|
|
197
|
+
private changed;
|
|
198
|
+
}
|
|
199
|
+
/** A CSS value, or `undefined` when it is unsafe or empty. */
|
|
200
|
+
declare function safeCSSValue(value: unknown): string | undefined;
|
|
201
|
+
/** Creates a style registry with the built-in styles (unless `builtins: false`) and `styles`. */
|
|
202
|
+
declare function createStyleRegistry(options?: StyleRegistryOptions | StyleRegistryJSON): StyleRegistry;
|
|
203
|
+
|
|
204
|
+
export { type CharacterFormat as C, DEFAULT_STYLES as D, NORMAL_STYLE_ID as N, type ParagraphFormat as P, type ResolvedStyle as R, type StyleBlock as S, type StyleCSSOptions as a, type StyleDefaults as b, type StyleDefinition as c, type StyleKind as d, StyleRegistry as e, type StyleRegistryJSON as f, type StyleRegistryOptions as g, type StyleRegistrySnapshot as h, createStyleRegistry as i, isValidStyleId as j, safeCSSValue as s };
|
|
@@ -35,6 +35,11 @@ interface ImportContext {
|
|
|
35
35
|
* exports) can import nested files with the same adapters.
|
|
36
36
|
*/
|
|
37
37
|
registry?: ImportAdapterRegistry;
|
|
38
|
+
/**
|
|
39
|
+
* Per-import options for this adapter: `ImportFileOptions.adapterOptions[adapter.id]`.
|
|
40
|
+
* Adapters document what they accept (e.g. the PDF adapter's `{ structure: false }`).
|
|
41
|
+
*/
|
|
42
|
+
options?: unknown;
|
|
38
43
|
}
|
|
39
44
|
interface ImportAdapter<TResult = unknown> {
|
|
40
45
|
/** Unique id, e.g. `markdown`, `html`, `csv`. */
|
|
@@ -65,6 +70,11 @@ interface ImportFileOptions {
|
|
|
65
70
|
fileName?: string;
|
|
66
71
|
/** Overrides the input's own `type`. */
|
|
67
72
|
mimeType?: string;
|
|
73
|
+
/**
|
|
74
|
+
* Options for individual adapters, keyed by adapter id; the matching entry
|
|
75
|
+
* reaches the adapter as `context.options`. Example: `{ pdf: { structure: false } }`.
|
|
76
|
+
*/
|
|
77
|
+
adapterOptions?: Record<string, unknown>;
|
|
68
78
|
}
|
|
69
79
|
interface ImportOutcome<TResult = unknown> {
|
|
70
80
|
adapterId: string;
|
|
@@ -96,6 +106,7 @@ declare function createImportContext(input: ImportInput, details: {
|
|
|
96
106
|
mimeType?: string;
|
|
97
107
|
target: ImportTarget;
|
|
98
108
|
registry?: ImportAdapterRegistry;
|
|
109
|
+
options?: unknown;
|
|
99
110
|
}): ImportContext;
|
|
100
111
|
/**
|
|
101
112
|
* A set of import adapters with type matching. Use the default registry via
|
|
@@ -136,4 +147,4 @@ declare class ImportAdapterRegistry {
|
|
|
136
147
|
importFile<TResult = unknown>(input: ImportInput, options?: ImportFileOptions): Promise<ImportOutcome<TResult>>;
|
|
137
148
|
}
|
|
138
149
|
|
|
139
|
-
export { type FileLike as F, ImportAdapterRegistry as I, type RegisterImportAdapterOptions as R, type ImportOutcome as a, type
|
|
150
|
+
export { type FileLike as F, ImportAdapterRegistry as I, type RegisterImportAdapterOptions as R, type ImportOutcome as a, type ImportAdapter as b, type FindImportAdapterQuery as c, type ImportContext as d, ImportError as e, type ImportErrorCode as f, type ImportFileOptions as g, type ImportInput as h, type ImportTarget as i, createImportContext as j };
|
|
@@ -35,6 +35,11 @@ interface ImportContext {
|
|
|
35
35
|
* exports) can import nested files with the same adapters.
|
|
36
36
|
*/
|
|
37
37
|
registry?: ImportAdapterRegistry;
|
|
38
|
+
/**
|
|
39
|
+
* Per-import options for this adapter: `ImportFileOptions.adapterOptions[adapter.id]`.
|
|
40
|
+
* Adapters document what they accept (e.g. the PDF adapter's `{ structure: false }`).
|
|
41
|
+
*/
|
|
42
|
+
options?: unknown;
|
|
38
43
|
}
|
|
39
44
|
interface ImportAdapter<TResult = unknown> {
|
|
40
45
|
/** Unique id, e.g. `markdown`, `html`, `csv`. */
|
|
@@ -65,6 +70,11 @@ interface ImportFileOptions {
|
|
|
65
70
|
fileName?: string;
|
|
66
71
|
/** Overrides the input's own `type`. */
|
|
67
72
|
mimeType?: string;
|
|
73
|
+
/**
|
|
74
|
+
* Options for individual adapters, keyed by adapter id; the matching entry
|
|
75
|
+
* reaches the adapter as `context.options`. Example: `{ pdf: { structure: false } }`.
|
|
76
|
+
*/
|
|
77
|
+
adapterOptions?: Record<string, unknown>;
|
|
68
78
|
}
|
|
69
79
|
interface ImportOutcome<TResult = unknown> {
|
|
70
80
|
adapterId: string;
|
|
@@ -96,6 +106,7 @@ declare function createImportContext(input: ImportInput, details: {
|
|
|
96
106
|
mimeType?: string;
|
|
97
107
|
target: ImportTarget;
|
|
98
108
|
registry?: ImportAdapterRegistry;
|
|
109
|
+
options?: unknown;
|
|
99
110
|
}): ImportContext;
|
|
100
111
|
/**
|
|
101
112
|
* A set of import adapters with type matching. Use the default registry via
|
|
@@ -136,4 +147,4 @@ declare class ImportAdapterRegistry {
|
|
|
136
147
|
importFile<TResult = unknown>(input: ImportInput, options?: ImportFileOptions): Promise<ImportOutcome<TResult>>;
|
|
137
148
|
}
|
|
138
149
|
|
|
139
|
-
export { type FileLike as F, ImportAdapterRegistry as I, type RegisterImportAdapterOptions as R, type ImportOutcome as a, type
|
|
150
|
+
export { type FileLike as F, ImportAdapterRegistry as I, type RegisterImportAdapterOptions as R, type ImportOutcome as a, type ImportAdapter as b, type FindImportAdapterQuery as c, type ImportContext as d, ImportError as e, type ImportErrorCode as f, type ImportFileOptions as g, type ImportInput as h, type ImportTarget as i, createImportContext as j };
|
|
@@ -351,4 +351,4 @@ declare function createCommandRegistry<TContext = any>(options?: CommandRegistry
|
|
|
351
351
|
/** Identity helper that types a command spec. */
|
|
352
352
|
declare function defineCommand<TContext = any, TParams = any, TResult = unknown>(spec: CommandSpec<TContext, TParams, TResult>): CommandSpec<TContext, TParams, TResult>;
|
|
353
353
|
|
|
354
|
-
export { formatShortcut as A, isEditableEventTarget as B,
|
|
354
|
+
export { formatShortcut as A, isEditableEventTarget as B, type CommandSpec as C, keyToCode as D, type EffectiveChord as E, normalizeChord as F, parseChord as G, shortcutCode as H, toShortcutBindings as I, type KeyboardEventLike as K, type Platform as P, type ShortcutBinding as S, CommandRegistry as a, type CommandResult as b, type CommandEntry as c, type Chord as d, type CommandErrorCode as e, type CommandHistoryTarget as f, type CommandListOptions as g, type CommandParamsSchema as h, CommandRegistryError as i, type CommandRegistryOptions as j, PLATFORMS as k, type ShortcutConflict as l, type ShortcutInput as m, ShortcutMap as n, type ShortcutMapOptions as o, type ShortcutMatch as p, type ShortcutResolveOptions as q, chordToString as r, codeFromKey as s, codeToKeyText as t, createCommandRegistry as u, defineCommand as v, detectPlatform as w, effectiveChord as x, effectiveChordKey as y, eventCode as z };
|
|
@@ -351,4 +351,4 @@ declare function createCommandRegistry<TContext = any>(options?: CommandRegistry
|
|
|
351
351
|
/** Identity helper that types a command spec. */
|
|
352
352
|
declare function defineCommand<TContext = any, TParams = any, TResult = unknown>(spec: CommandSpec<TContext, TParams, TResult>): CommandSpec<TContext, TParams, TResult>;
|
|
353
353
|
|
|
354
|
-
export { formatShortcut as A, isEditableEventTarget as B,
|
|
354
|
+
export { formatShortcut as A, isEditableEventTarget as B, type CommandSpec as C, keyToCode as D, type EffectiveChord as E, normalizeChord as F, parseChord as G, shortcutCode as H, toShortcutBindings as I, type KeyboardEventLike as K, type Platform as P, type ShortcutBinding as S, CommandRegistry as a, type CommandResult as b, type CommandEntry as c, type Chord as d, type CommandErrorCode as e, type CommandHistoryTarget as f, type CommandListOptions as g, type CommandParamsSchema as h, CommandRegistryError as i, type CommandRegistryOptions as j, PLATFORMS as k, type ShortcutConflict as l, type ShortcutInput as m, ShortcutMap as n, type ShortcutMapOptions as o, type ShortcutMatch as p, type ShortcutResolveOptions as q, chordToString as r, codeFromKey as s, codeToKeyText as t, createCommandRegistry as u, defineCommand as v, detectPlatform as w, effectiveChord as x, effectiveChordKey as y, eventCode as z };
|