@pixerate/editor 0.25.0 → 0.26.1
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 +30 -0
- package/THIRD_PARTY_NOTICES.md +11 -0
- package/dist/agent/index.cjs +174 -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 +167 -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 +3917 -19
- package/dist/canvas/index.cjs.map +1 -1
- package/dist/canvas/index.d.cts +1232 -7
- package/dist/canvas/index.d.ts +1232 -7
- package/dist/canvas/index.js +3916 -18
- 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-7WISYZFO.cjs → chunk-66IMF6OD.cjs} +174 -67
- package/dist/chunk-66IMF6OD.cjs.map +1 -0
- package/dist/{chunk-AL6JMGWW.cjs → chunk-CS6NZWWA.cjs} +24 -24
- package/dist/{chunk-AL6JMGWW.cjs.map → chunk-CS6NZWWA.cjs.map} +1 -1
- package/dist/{chunk-C7P22VIP.cjs → chunk-EWCOFSCQ.cjs} +17 -6
- 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-V3CHHWOE.cjs → chunk-HNDSPZ5T.cjs} +4 -4
- package/dist/{chunk-V3CHHWOE.cjs.map → chunk-HNDSPZ5T.cjs.map} +1 -1
- package/dist/{chunk-X4N4WUKB.cjs → chunk-IFHKKVXH.cjs} +150 -38
- package/dist/chunk-IFHKKVXH.cjs.map +1 -0
- package/dist/chunk-KRGXUQ2Y.js +1696 -0
- package/dist/chunk-KRGXUQ2Y.js.map +1 -0
- package/dist/{chunk-PO6A6QQH.cjs → chunk-LN2POBHT.cjs} +742 -970
- package/dist/chunk-LN2POBHT.cjs.map +1 -0
- package/dist/chunk-MR2764X2.js +831 -0
- package/dist/chunk-MR2764X2.js.map +1 -0
- package/dist/{chunk-WSQKHXW7.cjs → chunk-NQF32I6Z.cjs} +1209 -457
- package/dist/chunk-NQF32I6Z.cjs.map +1 -0
- package/dist/{chunk-NAXVVS5I.js → chunk-QJSOZFCZ.js} +2 -2
- package/dist/{chunk-UAKDG62Z.js → chunk-SWE3NPOU.js} +116 -4
- 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-ECCCYKGL.js → chunk-UKI64KUD.js} +147 -40
- package/dist/chunk-UKI64KUD.js.map +1 -0
- package/dist/{chunk-QGYDWPRM.js → chunk-WON34HKM.js} +2 -2
- package/dist/{chunk-RR7F5GUM.js → chunk-X7HXL2SB.js} +941 -189
- package/dist/chunk-X7HXL2SB.js.map +1 -0
- package/dist/{chunk-IXHSYOVY.js → chunk-XQFHLT53.js} +638 -866
- package/dist/chunk-XQFHLT53.js.map +1 -0
- package/dist/{chunk-FH6F67DN.js → chunk-ZRNHGAQT.js} +17 -6
- package/dist/{chunk-FH6F67DN.js.map → chunk-ZRNHGAQT.js.map} +1 -1
- package/dist/commands/index.cjs +352 -4
- package/dist/commands/index.cjs.map +1 -1
- package/dist/commands/index.d.cts +37 -108
- package/dist/commands/index.d.ts +37 -108
- package/dist/commands/index.js +351 -3
- package/dist/commands/index.js.map +1 -1
- package/dist/compare/index.cjs +3 -3
- package/dist/compare/index.js +2 -2
- package/dist/{controller-BIJiNoVs.d.cts → controller-CxXGOEmy.d.cts} +209 -13
- package/dist/{controller-BIJiNoVs.d.ts → controller-CxXGOEmy.d.ts} +209 -13
- 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 +54 -6
- package/dist/extensions/index.cjs.map +1 -1
- package/dist/extensions/index.d.cts +7 -2
- package/dist/extensions/index.d.ts +7 -2
- package/dist/extensions/index.js +59 -11
- package/dist/{index-7a6bHTLy.d.ts → index-B273Zllk.d.ts} +211 -207
- package/dist/{index-Csd5qI8u.d.cts → index-jcJwmBYt.d.cts} +211 -207
- package/dist/index.cjs +146 -32
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +50 -14
- package/dist/index.d.ts +50 -14
- package/dist/index.js +138 -24
- package/dist/index.js.map +1 -1
- package/dist/registry-CED5C0lA.d.cts +204 -0
- package/dist/registry-CED5C0lA.d.ts +204 -0
- 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 +6 -4
- package/dist/serializers/index.cjs.map +1 -1
- package/dist/serializers/index.d.cts +15 -4
- package/dist/serializers/index.d.ts +15 -4
- package/dist/serializers/index.js +5 -3
- package/dist/spreadsheet/index.cjs +33 -3
- package/dist/spreadsheet/index.cjs.map +1 -1
- package/dist/spreadsheet/index.d.cts +106 -3
- package/dist/spreadsheet/index.d.ts +106 -3
- package/dist/spreadsheet/index.js +32 -2
- package/package.json +10 -1
- package/dist/chunk-7WISYZFO.cjs.map +0 -1
- package/dist/chunk-C7P22VIP.cjs.map +0 -1
- package/dist/chunk-ECCCYKGL.js.map +0 -1
- package/dist/chunk-IXHSYOVY.js.map +0 -1
- package/dist/chunk-PO6A6QQH.cjs.map +0 -1
- package/dist/chunk-RR7F5GUM.js.map +0 -1
- package/dist/chunk-UAKDG62Z.js.map +0 -1
- package/dist/chunk-WSQKHXW7.cjs.map +0 -1
- package/dist/chunk-X4N4WUKB.cjs.map +0 -1
- package/dist/types-DX4Mh4SL.d.cts +0 -217
- package/dist/types-DX4Mh4SL.d.ts +0 -217
- /package/dist/{chunk-NAXVVS5I.js.map → chunk-QJSOZFCZ.js.map} +0 -0
- /package/dist/{chunk-QGYDWPRM.js.map → chunk-WON34HKM.js.map} +0 -0
|
@@ -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 };
|
|
@@ -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 };
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _chunkHNDSPZ5Tcjs = require('../chunk-HNDSPZ5T.cjs');
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
|
|
@@ -26,14 +26,16 @@ var _chunkV3CHHWOEcjs = require('../chunk-V3CHHWOE.cjs');
|
|
|
26
26
|
|
|
27
27
|
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
|
|
30
|
+
var _chunk66IMF6ODcjs = require('../chunk-66IMF6OD.cjs');
|
|
30
31
|
|
|
31
32
|
|
|
32
33
|
|
|
33
34
|
|
|
34
35
|
|
|
35
36
|
var _chunkBVP3TSLHcjs = require('../chunk-BVP3TSLH.cjs');
|
|
36
|
-
require('../chunk-
|
|
37
|
+
require('../chunk-IFHKKVXH.cjs');
|
|
38
|
+
|
|
37
39
|
|
|
38
40
|
|
|
39
41
|
|
|
@@ -63,5 +65,5 @@ require('../chunk-X4N4WUKB.cjs');
|
|
|
63
65
|
|
|
64
66
|
|
|
65
67
|
|
|
66
|
-
exports.MARKDOWN_MENTION_SPLIT_REGEX =
|
|
68
|
+
exports.MARKDOWN_MENTION_SPLIT_REGEX = _chunk66IMF6ODcjs.MARKDOWN_MENTION_SPLIT_REGEX; exports.MENTION_REGEX = _chunkBVP3TSLHcjs.MENTION_REGEX; exports.PIXERATE_DOCUMENT_MIME = _chunkHNDSPZ5Tcjs.PIXERATE_DOCUMENT_MIME; exports.escapeHtml = _chunk66IMF6ODcjs.escapeHtml; exports.extractMentions = _chunk66IMF6ODcjs.extractMentions; exports.extractMentionsFromDoc = _chunk66IMF6ODcjs.extractMentionsFromDoc; exports.findTextMentions = _chunkBVP3TSLHcjs.findTextMentions; exports.formatMentionText = _chunkBVP3TSLHcjs.formatMentionText; exports.getClipboardData = _chunkHNDSPZ5Tcjs.getClipboardData; exports.getEditorMarkdown = _chunk66IMF6ODcjs.getEditorMarkdown; exports.getEditorText = _chunk66IMF6ODcjs.getEditorText; exports.getSchemaSignature = _chunkHNDSPZ5Tcjs.getSchemaSignature; exports.htmlToPlainText = _chunk66IMF6ODcjs.htmlToPlainText; exports.markdownToTipTapHtml = _chunk66IMF6ODcjs.markdownToTipTapHtml; exports.parseMentionSegments = _chunk66IMF6ODcjs.parseMentionSegments; exports.parseRichClipboardPayload = _chunkHNDSPZ5Tcjs.parseRichClipboardPayload; exports.plainTextToParagraphHtml = _chunkHNDSPZ5Tcjs.plainTextToParagraphHtml; exports.plainTextToSlice = _chunk66IMF6ODcjs.plainTextToSlice; exports.plainTextToTipTapHtml = _chunk66IMF6ODcjs.plainTextToTipTapHtml; exports.preprocessMarkdownFileLinks = _chunk66IMF6ODcjs.preprocessMarkdownFileLinks; exports.preprocessMarkdownMentions = _chunk66IMF6ODcjs.preprocessMarkdownMentions; exports.readRichClipboard = _chunkHNDSPZ5Tcjs.readRichClipboard; exports.rtfToPlainText = _chunkHNDSPZ5Tcjs.rtfToPlainText; exports.sanitizeHtml = _chunk66IMF6ODcjs.sanitizeHtml; exports.sanitizeImportedHtml = _chunkHNDSPZ5Tcjs.sanitizeImportedHtml; exports.serializeRichClipboardPayload = _chunkHNDSPZ5Tcjs.serializeRichClipboardPayload; exports.setMentionRoleInText = _chunkBVP3TSLHcjs.setMentionRoleInText; exports.splitMarkdownMentionParts = _chunk66IMF6ODcjs.splitMarkdownMentionParts; exports.stripMarkdownCode = _chunk66IMF6ODcjs.stripMarkdownCode;
|
|
67
69
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/editor/editor/packages/core/dist/serializers/index.cjs"],"names":[],"mappings":"AAAA,0GAA8B;AAC9B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,yDAA8B;AAC9B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,yDAA8B;AAC9B;AACE;AACA;AACA;AACA;AACF,yDAA8B;AAC9B,iCAA8B;AAC9B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/editor/editor/packages/core/dist/serializers/index.cjs"],"names":[],"mappings":"AAAA,0GAA8B;AAC9B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,yDAA8B;AAC9B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,yDAA8B;AAC9B;AACE;AACA;AACA;AACA;AACF,yDAA8B;AAC9B,iCAA8B;AAC9B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,w9DAAC","file":"/home/runner/work/editor/editor/packages/core/dist/serializers/index.cjs"}
|
|
@@ -34,7 +34,8 @@ declare function plainTextToTipTapHtml(text: string): string;
|
|
|
34
34
|
*/
|
|
35
35
|
declare function plainTextToSlice(text: string, schema: Schema): Slice;
|
|
36
36
|
/**
|
|
37
|
-
* Extracts plain text from an HTML string or TipTap HTML, preserving newlines
|
|
37
|
+
* Extracts plain text from an HTML string or TipTap HTML, preserving newlines
|
|
38
|
+
* between block tags. Table rows become lines of tab-separated cells.
|
|
38
39
|
*/
|
|
39
40
|
declare function htmlToPlainText(html: string, options?: PlainTextOptions): string;
|
|
40
41
|
/**
|
|
@@ -60,10 +61,20 @@ interface ExtractedMention {
|
|
|
60
61
|
declare function extractMentionsFromDoc(docOrEditor: any): ExtractedMention[];
|
|
61
62
|
|
|
62
63
|
/**
|
|
63
|
-
* Split regex identifying markdown code blocks, inline code, URLs, and existing HTML tags
|
|
64
|
-
*
|
|
64
|
+
* Split regex identifying markdown code blocks, inline code, URLs, and existing HTML tags:
|
|
65
|
+
* the regions preprocessMarkdownMentions leaves untouched. Kept as the reference definition;
|
|
66
|
+
* preprocessMarkdownMentions uses {@link splitMarkdownMentionParts}, because this regex is
|
|
67
|
+
* quadratic (lazy closers) and cubic (mention spans) on malformed input.
|
|
65
68
|
*/
|
|
66
69
|
declare const MARKDOWN_MENTION_SPLIT_REGEX: RegExp;
|
|
70
|
+
/**
|
|
71
|
+
* `text.split(MARKDOWN_MENTION_SPLIT_REGEX)` in linear time: alternating plain text and
|
|
72
|
+
* protected parts (code fences, `<pre>` / `<code>`, inline code, mention spans, HTML tags,
|
|
73
|
+
* markdown link targets, URLs), starting and ending with text (possibly empty). Each
|
|
74
|
+
* closer is found through a cached "next occurrence" that only moves forward, so
|
|
75
|
+
* unclosed fences or tags cost O(1) per position instead of a scan to the end.
|
|
76
|
+
*/
|
|
77
|
+
declare function splitMarkdownMentionParts(text: string): string[];
|
|
67
78
|
interface MentionSegment {
|
|
68
79
|
type: "text" | "mention";
|
|
69
80
|
value: string;
|
|
@@ -285,4 +296,4 @@ declare function getClipboardData(event: unknown): ClipboardDataLike | null;
|
|
|
285
296
|
*/
|
|
286
297
|
declare function readRichClipboard(event: unknown, schema: Schema, mimeType?: string): Slice | null;
|
|
287
298
|
|
|
288
|
-
export { type ClipboardDataLike, type ExtractMentionsOptions, type ExtractedMention, MARKDOWN_MENTION_SPLIT_REGEX, type MarkdownToHtmlOptions, type MentionDetail, MentionRoleSyntax, type MentionSegment, PIXERATE_DOCUMENT_MIME, type PlainTextOptions, type PreprocessMarkdownMentionsOptions, type RichClipboardPayload, type SanitizeHtmlOptions, escapeHtml, extractMentions, extractMentionsFromDoc, getClipboardData, getEditorMarkdown, getEditorText, getSchemaSignature, htmlToPlainText, markdownToTipTapHtml, parseMentionSegments, parseRichClipboardPayload, plainTextToParagraphHtml, plainTextToSlice, plainTextToTipTapHtml, preprocessMarkdownFileLinks, preprocessMarkdownMentions, readRichClipboard, rtfToPlainText, sanitizeHtml, sanitizeImportedHtml, serializeRichClipboardPayload, stripMarkdownCode };
|
|
299
|
+
export { type ClipboardDataLike, type ExtractMentionsOptions, type ExtractedMention, MARKDOWN_MENTION_SPLIT_REGEX, type MarkdownToHtmlOptions, type MentionDetail, MentionRoleSyntax, type MentionSegment, PIXERATE_DOCUMENT_MIME, type PlainTextOptions, type PreprocessMarkdownMentionsOptions, type RichClipboardPayload, type SanitizeHtmlOptions, escapeHtml, extractMentions, extractMentionsFromDoc, getClipboardData, getEditorMarkdown, getEditorText, getSchemaSignature, htmlToPlainText, markdownToTipTapHtml, parseMentionSegments, parseRichClipboardPayload, plainTextToParagraphHtml, plainTextToSlice, plainTextToTipTapHtml, preprocessMarkdownFileLinks, preprocessMarkdownMentions, readRichClipboard, rtfToPlainText, sanitizeHtml, sanitizeImportedHtml, serializeRichClipboardPayload, splitMarkdownMentionParts, stripMarkdownCode };
|
|
@@ -34,7 +34,8 @@ declare function plainTextToTipTapHtml(text: string): string;
|
|
|
34
34
|
*/
|
|
35
35
|
declare function plainTextToSlice(text: string, schema: Schema): Slice;
|
|
36
36
|
/**
|
|
37
|
-
* Extracts plain text from an HTML string or TipTap HTML, preserving newlines
|
|
37
|
+
* Extracts plain text from an HTML string or TipTap HTML, preserving newlines
|
|
38
|
+
* between block tags. Table rows become lines of tab-separated cells.
|
|
38
39
|
*/
|
|
39
40
|
declare function htmlToPlainText(html: string, options?: PlainTextOptions): string;
|
|
40
41
|
/**
|
|
@@ -60,10 +61,20 @@ interface ExtractedMention {
|
|
|
60
61
|
declare function extractMentionsFromDoc(docOrEditor: any): ExtractedMention[];
|
|
61
62
|
|
|
62
63
|
/**
|
|
63
|
-
* Split regex identifying markdown code blocks, inline code, URLs, and existing HTML tags
|
|
64
|
-
*
|
|
64
|
+
* Split regex identifying markdown code blocks, inline code, URLs, and existing HTML tags:
|
|
65
|
+
* the regions preprocessMarkdownMentions leaves untouched. Kept as the reference definition;
|
|
66
|
+
* preprocessMarkdownMentions uses {@link splitMarkdownMentionParts}, because this regex is
|
|
67
|
+
* quadratic (lazy closers) and cubic (mention spans) on malformed input.
|
|
65
68
|
*/
|
|
66
69
|
declare const MARKDOWN_MENTION_SPLIT_REGEX: RegExp;
|
|
70
|
+
/**
|
|
71
|
+
* `text.split(MARKDOWN_MENTION_SPLIT_REGEX)` in linear time: alternating plain text and
|
|
72
|
+
* protected parts (code fences, `<pre>` / `<code>`, inline code, mention spans, HTML tags,
|
|
73
|
+
* markdown link targets, URLs), starting and ending with text (possibly empty). Each
|
|
74
|
+
* closer is found through a cached "next occurrence" that only moves forward, so
|
|
75
|
+
* unclosed fences or tags cost O(1) per position instead of a scan to the end.
|
|
76
|
+
*/
|
|
77
|
+
declare function splitMarkdownMentionParts(text: string): string[];
|
|
67
78
|
interface MentionSegment {
|
|
68
79
|
type: "text" | "mention";
|
|
69
80
|
value: string;
|
|
@@ -285,4 +296,4 @@ declare function getClipboardData(event: unknown): ClipboardDataLike | null;
|
|
|
285
296
|
*/
|
|
286
297
|
declare function readRichClipboard(event: unknown, schema: Schema, mimeType?: string): Slice | null;
|
|
287
298
|
|
|
288
|
-
export { type ClipboardDataLike, type ExtractMentionsOptions, type ExtractedMention, MARKDOWN_MENTION_SPLIT_REGEX, type MarkdownToHtmlOptions, type MentionDetail, MentionRoleSyntax, type MentionSegment, PIXERATE_DOCUMENT_MIME, type PlainTextOptions, type PreprocessMarkdownMentionsOptions, type RichClipboardPayload, type SanitizeHtmlOptions, escapeHtml, extractMentions, extractMentionsFromDoc, getClipboardData, getEditorMarkdown, getEditorText, getSchemaSignature, htmlToPlainText, markdownToTipTapHtml, parseMentionSegments, parseRichClipboardPayload, plainTextToParagraphHtml, plainTextToSlice, plainTextToTipTapHtml, preprocessMarkdownFileLinks, preprocessMarkdownMentions, readRichClipboard, rtfToPlainText, sanitizeHtml, sanitizeImportedHtml, serializeRichClipboardPayload, stripMarkdownCode };
|
|
299
|
+
export { type ClipboardDataLike, type ExtractMentionsOptions, type ExtractedMention, MARKDOWN_MENTION_SPLIT_REGEX, type MarkdownToHtmlOptions, type MentionDetail, MentionRoleSyntax, type MentionSegment, PIXERATE_DOCUMENT_MIME, type PlainTextOptions, type PreprocessMarkdownMentionsOptions, type RichClipboardPayload, type SanitizeHtmlOptions, escapeHtml, extractMentions, extractMentionsFromDoc, getClipboardData, getEditorMarkdown, getEditorText, getSchemaSignature, htmlToPlainText, markdownToTipTapHtml, parseMentionSegments, parseRichClipboardPayload, plainTextToParagraphHtml, plainTextToSlice, plainTextToTipTapHtml, preprocessMarkdownFileLinks, preprocessMarkdownMentions, readRichClipboard, rtfToPlainText, sanitizeHtml, sanitizeImportedHtml, serializeRichClipboardPayload, splitMarkdownMentionParts, stripMarkdownCode };
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
rtfToPlainText,
|
|
10
10
|
sanitizeImportedHtml,
|
|
11
11
|
serializeRichClipboardPayload
|
|
12
|
-
} from "../chunk-
|
|
12
|
+
} from "../chunk-WON34HKM.js";
|
|
13
13
|
import {
|
|
14
14
|
MARKDOWN_MENTION_SPLIT_REGEX,
|
|
15
15
|
escapeHtml,
|
|
@@ -25,15 +25,16 @@ import {
|
|
|
25
25
|
preprocessMarkdownFileLinks,
|
|
26
26
|
preprocessMarkdownMentions,
|
|
27
27
|
sanitizeHtml,
|
|
28
|
+
splitMarkdownMentionParts,
|
|
28
29
|
stripMarkdownCode
|
|
29
|
-
} from "../chunk-
|
|
30
|
+
} from "../chunk-UKI64KUD.js";
|
|
30
31
|
import {
|
|
31
32
|
MENTION_REGEX,
|
|
32
33
|
findTextMentions,
|
|
33
34
|
formatMentionText,
|
|
34
35
|
setMentionRoleInText
|
|
35
36
|
} from "../chunk-O5RYH2PG.js";
|
|
36
|
-
import "../chunk-
|
|
37
|
+
import "../chunk-SWE3NPOU.js";
|
|
37
38
|
export {
|
|
38
39
|
MARKDOWN_MENTION_SPLIT_REGEX,
|
|
39
40
|
MENTION_REGEX,
|
|
@@ -62,6 +63,7 @@ export {
|
|
|
62
63
|
sanitizeImportedHtml,
|
|
63
64
|
serializeRichClipboardPayload,
|
|
64
65
|
setMentionRoleInText,
|
|
66
|
+
splitMarkdownMentionParts,
|
|
65
67
|
stripMarkdownCode
|
|
66
68
|
};
|
|
67
69
|
//# sourceMappingURL=index.js.map
|