@drghaliasri/butex 4.4.0 → 5.0.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 +3 -1
- package/dist/document2.d.mts +191 -80
- package/dist/document2.d.ts +191 -80
- package/dist/document2.js +683 -101
- package/dist/document2.js.map +1 -1
- package/dist/document2.mjs +660 -101
- package/dist/document2.mjs.map +1 -1
- package/dist/react-document2.d.mts +160 -83
- package/dist/react-document2.d.ts +160 -83
- package/dist/react-document2.js +2039 -686
- package/dist/react-document2.js.map +1 -1
- package/dist/react-document2.mjs +2002 -649
- package/dist/react-document2.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -48,6 +48,82 @@ declare class ChainNode {
|
|
|
48
48
|
toArabicLatex(): string;
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
+
type EditorSide = 'english' | 'arabic';
|
|
52
|
+
type EditorNodeKind = 'char' | 'number' | 'operator' | 'delimiter' | 'frac' | 'sqrt' | 'env' | 'atomicCommand' | 'atomicOperatorCommand';
|
|
53
|
+
type MatrixEnvStyle = 'matrix' | 'pmatrix' | 'bmatrix' | 'Bmatrix' | 'vmatrix' | 'Vmatrix';
|
|
54
|
+
type GridEnvName = MatrixEnvStyle | 'array' | 'aligned';
|
|
55
|
+
type EnvColumnAlignment = 'l' | 'c' | 'r';
|
|
56
|
+
type CharacterFontId = 'default' | 'takween' | 'diwani' | 'diwaniOutline';
|
|
57
|
+
type DigitFormId = 'western' | 'arabicIndic' | 'persianIndic';
|
|
58
|
+
type EditorSyncState = 'synced' | 'diverged';
|
|
59
|
+
type EditorChain = {
|
|
60
|
+
id: string;
|
|
61
|
+
nodes: EditorNode[];
|
|
62
|
+
};
|
|
63
|
+
type EditorNode = {
|
|
64
|
+
id: string;
|
|
65
|
+
kind: EditorNodeKind;
|
|
66
|
+
expr: string;
|
|
67
|
+
characterFont?: CharacterFontId;
|
|
68
|
+
superscript: EditorChain | null;
|
|
69
|
+
subscript: EditorChain | null;
|
|
70
|
+
leftDelimExpr: string;
|
|
71
|
+
rightDelimExpr: string;
|
|
72
|
+
innerExpr: EditorChain | null;
|
|
73
|
+
numerator: EditorChain | null;
|
|
74
|
+
denominator: EditorChain | null;
|
|
75
|
+
radicand: EditorChain | null;
|
|
76
|
+
rootIndex: EditorChain | null;
|
|
77
|
+
envName: GridEnvName | null;
|
|
78
|
+
matrixStyle: MatrixEnvStyle | null;
|
|
79
|
+
matrixRows: EditorChain[][] | null;
|
|
80
|
+
columnAlignments: EnvColumnAlignment[] | null;
|
|
81
|
+
};
|
|
82
|
+
type EditorCaret = {
|
|
83
|
+
chainId: string;
|
|
84
|
+
index: number;
|
|
85
|
+
};
|
|
86
|
+
type EditorSelectionRange = {
|
|
87
|
+
chainId: string;
|
|
88
|
+
anchorIndex: number;
|
|
89
|
+
focusIndex: number;
|
|
90
|
+
};
|
|
91
|
+
type EditorSyncMap = Record<string, {
|
|
92
|
+
expr: EditorSyncState;
|
|
93
|
+
}>;
|
|
94
|
+
type EditorDebugEntry = {
|
|
95
|
+
timestamp: string;
|
|
96
|
+
command: string;
|
|
97
|
+
activeSide: EditorSide;
|
|
98
|
+
englishLatex: string;
|
|
99
|
+
arabicLatex: string;
|
|
100
|
+
renderOk: boolean;
|
|
101
|
+
renderError: string | null;
|
|
102
|
+
note: string;
|
|
103
|
+
};
|
|
104
|
+
type EditorSession = {
|
|
105
|
+
englishTree: EditorChain;
|
|
106
|
+
arabicTree: EditorChain;
|
|
107
|
+
activeSide: EditorSide;
|
|
108
|
+
/** When true, each typed letter/digit inserts a new char/number leaf; when false, merge into adjacent same-kind leaves. */
|
|
109
|
+
splitLeafTyping: boolean;
|
|
110
|
+
/** One-shot: when true, the next insertChar/insertNumber bypasses leaf-merge (used by Space in merge mode). */
|
|
111
|
+
forceSplitNextLeaf: boolean;
|
|
112
|
+
/** When true and active side is Arabic, merged number typing prepends digits (RTL-style); still mirrored on EN/AR. */
|
|
113
|
+
arabicReverseNumberTyping: boolean;
|
|
114
|
+
/** Font applied to newly typed char nodes. */
|
|
115
|
+
currentCharacterFont: CharacterFontId;
|
|
116
|
+
/** Digit glyph form used for editor display and LaTeX preview output. */
|
|
117
|
+
currentDigitForm: DigitFormId;
|
|
118
|
+
caret: EditorCaret;
|
|
119
|
+
/** Whole-node range selection inside a single chain (anchor==focus means no selection). */
|
|
120
|
+
selection: EditorSelectionRange | null;
|
|
121
|
+
selectedNodeId: string | null;
|
|
122
|
+
selectedStructureNodeId: string | null;
|
|
123
|
+
sync: EditorSyncMap;
|
|
124
|
+
debugLog: EditorDebugEntry[];
|
|
125
|
+
};
|
|
126
|
+
|
|
51
127
|
type MathNode = {
|
|
52
128
|
nodeType: 'MathObject';
|
|
53
129
|
mathMode: string;
|
|
@@ -63,13 +139,24 @@ type MathObject2Json = {
|
|
|
63
139
|
lines: ChainJson[];
|
|
64
140
|
closing: string;
|
|
65
141
|
};
|
|
142
|
+
type Reference2Json = {
|
|
143
|
+
key: string;
|
|
144
|
+
authors?: string;
|
|
145
|
+
title?: string;
|
|
146
|
+
year?: string;
|
|
147
|
+
url?: string;
|
|
148
|
+
venue?: string;
|
|
149
|
+
};
|
|
66
150
|
type Document2Json = {
|
|
67
151
|
node_type: 'DocumentObject';
|
|
152
|
+
references?: Reference2Json[];
|
|
68
153
|
blocks: Document2BlockJson[];
|
|
69
154
|
};
|
|
70
155
|
type Document2BlockJson = {
|
|
71
156
|
command: string;
|
|
72
157
|
value?: string;
|
|
158
|
+
/** Stable host asset identity (e.g. S3 key / UUID); optional for \\includegraphics. */
|
|
159
|
+
asset_id?: string;
|
|
73
160
|
math_objects?: MathObject2Json[];
|
|
74
161
|
options?: Record<string, string>;
|
|
75
162
|
closing?: string;
|
|
@@ -87,6 +174,15 @@ type Document2Diagnostic = {
|
|
|
87
174
|
message: string;
|
|
88
175
|
path: string;
|
|
89
176
|
};
|
|
177
|
+
type Reference2 = {
|
|
178
|
+
id: string;
|
|
179
|
+
key: string;
|
|
180
|
+
authors: string;
|
|
181
|
+
title: string;
|
|
182
|
+
year: string;
|
|
183
|
+
url: string;
|
|
184
|
+
venue: string;
|
|
185
|
+
};
|
|
90
186
|
type TextToken2 = {
|
|
91
187
|
id: string;
|
|
92
188
|
kind: 'text';
|
|
@@ -105,7 +201,12 @@ type MathToken2 = {
|
|
|
105
201
|
reason?: string;
|
|
106
202
|
sourceOwner: 'imported-structured' | 'raw' | 'editor';
|
|
107
203
|
};
|
|
108
|
-
type
|
|
204
|
+
type CiteToken2 = {
|
|
205
|
+
id: string;
|
|
206
|
+
kind: 'cite';
|
|
207
|
+
keys: string[];
|
|
208
|
+
};
|
|
209
|
+
type InlineToken2 = TextToken2 | MathToken2 | CiteToken2;
|
|
109
210
|
type InlineField2 = {
|
|
110
211
|
id: string;
|
|
111
212
|
tokens: InlineToken2[];
|
|
@@ -141,17 +242,26 @@ type ImageBlock2 = {
|
|
|
141
242
|
kind: 'image';
|
|
142
243
|
command: '\\includegraphics';
|
|
143
244
|
value: string;
|
|
245
|
+
/** Host asset identity from wire `asset_id`; preserved across value edits. */
|
|
246
|
+
assetId?: string;
|
|
144
247
|
options: Record<string, string>;
|
|
145
248
|
};
|
|
249
|
+
type BibliographyBlock2 = {
|
|
250
|
+
id: string;
|
|
251
|
+
kind: 'bibliography';
|
|
252
|
+
command: '\\begin{thebibliography}';
|
|
253
|
+
closing: '\\end{thebibliography}';
|
|
254
|
+
};
|
|
146
255
|
type RawBlock2 = {
|
|
147
256
|
id: string;
|
|
148
257
|
kind: 'raw';
|
|
149
258
|
command: '\\raw';
|
|
150
259
|
value: string;
|
|
151
260
|
};
|
|
152
|
-
type Document2Block = TextBlock2 | ListBlock2 | TableBlock2 | ImageBlock2 | RawBlock2;
|
|
261
|
+
type Document2Block = TextBlock2 | ListBlock2 | TableBlock2 | ImageBlock2 | BibliographyBlock2 | RawBlock2;
|
|
153
262
|
type Document2Node = {
|
|
154
263
|
nodeType: 'DocumentObject';
|
|
264
|
+
references: Reference2[];
|
|
155
265
|
blocks: Document2Block[];
|
|
156
266
|
diagnostics: Document2Diagnostic[];
|
|
157
267
|
};
|
|
@@ -165,6 +275,11 @@ type PreviewInline2 = {
|
|
|
165
275
|
display: boolean;
|
|
166
276
|
output: Document2MathOutput;
|
|
167
277
|
editable: boolean;
|
|
278
|
+
} | {
|
|
279
|
+
kind: 'cite';
|
|
280
|
+
id: string;
|
|
281
|
+
keys: string[];
|
|
282
|
+
label: string;
|
|
168
283
|
};
|
|
169
284
|
type PreviewBlock2 = {
|
|
170
285
|
kind: 'heading';
|
|
@@ -192,7 +307,21 @@ type PreviewBlock2 = {
|
|
|
192
307
|
kind: 'image';
|
|
193
308
|
id: string;
|
|
194
309
|
src: string;
|
|
310
|
+
assetId?: string;
|
|
195
311
|
options: Record<string, string>;
|
|
312
|
+
} | {
|
|
313
|
+
kind: 'bibliography';
|
|
314
|
+
id: string;
|
|
315
|
+
items: Array<{
|
|
316
|
+
id: string;
|
|
317
|
+
numberLabel: string;
|
|
318
|
+
key: string;
|
|
319
|
+
authors: string;
|
|
320
|
+
title: string;
|
|
321
|
+
year: string;
|
|
322
|
+
url: string;
|
|
323
|
+
venue: string;
|
|
324
|
+
}>;
|
|
196
325
|
}
|
|
197
326
|
/** Preview-only: raw / unknown blocks are omitted from preview until we add proper rendering. */
|
|
198
327
|
| {
|
|
@@ -200,82 +329,6 @@ type PreviewBlock2 = {
|
|
|
200
329
|
id: string;
|
|
201
330
|
};
|
|
202
331
|
|
|
203
|
-
type EditorSide = 'english' | 'arabic';
|
|
204
|
-
type EditorNodeKind = 'char' | 'number' | 'operator' | 'delimiter' | 'frac' | 'sqrt' | 'env' | 'atomicCommand' | 'atomicOperatorCommand';
|
|
205
|
-
type MatrixEnvStyle = 'matrix' | 'pmatrix' | 'bmatrix' | 'Bmatrix' | 'vmatrix' | 'Vmatrix';
|
|
206
|
-
type GridEnvName = MatrixEnvStyle | 'array' | 'aligned';
|
|
207
|
-
type EnvColumnAlignment = 'l' | 'c' | 'r';
|
|
208
|
-
type CharacterFontId = 'default' | 'takween' | 'diwani' | 'diwaniOutline';
|
|
209
|
-
type DigitFormId = 'western' | 'arabicIndic' | 'persianIndic';
|
|
210
|
-
type EditorSyncState = 'synced' | 'diverged';
|
|
211
|
-
type EditorChain = {
|
|
212
|
-
id: string;
|
|
213
|
-
nodes: EditorNode[];
|
|
214
|
-
};
|
|
215
|
-
type EditorNode = {
|
|
216
|
-
id: string;
|
|
217
|
-
kind: EditorNodeKind;
|
|
218
|
-
expr: string;
|
|
219
|
-
characterFont?: CharacterFontId;
|
|
220
|
-
superscript: EditorChain | null;
|
|
221
|
-
subscript: EditorChain | null;
|
|
222
|
-
leftDelimExpr: string;
|
|
223
|
-
rightDelimExpr: string;
|
|
224
|
-
innerExpr: EditorChain | null;
|
|
225
|
-
numerator: EditorChain | null;
|
|
226
|
-
denominator: EditorChain | null;
|
|
227
|
-
radicand: EditorChain | null;
|
|
228
|
-
rootIndex: EditorChain | null;
|
|
229
|
-
envName: GridEnvName | null;
|
|
230
|
-
matrixStyle: MatrixEnvStyle | null;
|
|
231
|
-
matrixRows: EditorChain[][] | null;
|
|
232
|
-
columnAlignments: EnvColumnAlignment[] | null;
|
|
233
|
-
};
|
|
234
|
-
type EditorCaret = {
|
|
235
|
-
chainId: string;
|
|
236
|
-
index: number;
|
|
237
|
-
};
|
|
238
|
-
type EditorSelectionRange = {
|
|
239
|
-
chainId: string;
|
|
240
|
-
anchorIndex: number;
|
|
241
|
-
focusIndex: number;
|
|
242
|
-
};
|
|
243
|
-
type EditorSyncMap = Record<string, {
|
|
244
|
-
expr: EditorSyncState;
|
|
245
|
-
}>;
|
|
246
|
-
type EditorDebugEntry = {
|
|
247
|
-
timestamp: string;
|
|
248
|
-
command: string;
|
|
249
|
-
activeSide: EditorSide;
|
|
250
|
-
englishLatex: string;
|
|
251
|
-
arabicLatex: string;
|
|
252
|
-
renderOk: boolean;
|
|
253
|
-
renderError: string | null;
|
|
254
|
-
note: string;
|
|
255
|
-
};
|
|
256
|
-
type EditorSession = {
|
|
257
|
-
englishTree: EditorChain;
|
|
258
|
-
arabicTree: EditorChain;
|
|
259
|
-
activeSide: EditorSide;
|
|
260
|
-
/** When true, each typed letter/digit inserts a new char/number leaf; when false, merge into adjacent same-kind leaves. */
|
|
261
|
-
splitLeafTyping: boolean;
|
|
262
|
-
/** One-shot: when true, the next insertChar/insertNumber bypasses leaf-merge (used by Space in merge mode). */
|
|
263
|
-
forceSplitNextLeaf: boolean;
|
|
264
|
-
/** When true and active side is Arabic, merged number typing prepends digits (RTL-style); still mirrored on EN/AR. */
|
|
265
|
-
arabicReverseNumberTyping: boolean;
|
|
266
|
-
/** Font applied to newly typed char nodes. */
|
|
267
|
-
currentCharacterFont: CharacterFontId;
|
|
268
|
-
/** Digit glyph form used for editor display and LaTeX preview output. */
|
|
269
|
-
currentDigitForm: DigitFormId;
|
|
270
|
-
caret: EditorCaret;
|
|
271
|
-
/** Whole-node range selection inside a single chain (anchor==focus means no selection). */
|
|
272
|
-
selection: EditorSelectionRange | null;
|
|
273
|
-
selectedNodeId: string | null;
|
|
274
|
-
selectedStructureNodeId: string | null;
|
|
275
|
-
sync: EditorSyncMap;
|
|
276
|
-
debugLog: EditorDebugEntry[];
|
|
277
|
-
};
|
|
278
|
-
|
|
279
332
|
type ButexUiLocale = 'ar' | 'en';
|
|
280
333
|
|
|
281
334
|
type ButexDocumentEditor2Props = {
|
|
@@ -289,6 +342,14 @@ type ButexDocumentEditor2Props = {
|
|
|
289
342
|
previewOnly?: boolean;
|
|
290
343
|
uiLocale?: ButexUiLocale;
|
|
291
344
|
mathOutput?: Document2MathOutput;
|
|
345
|
+
/** Digit shaping for citation and bibliography numbers (western / arabicIndic / persianIndic). */
|
|
346
|
+
digitForm?: DigitFormId;
|
|
347
|
+
onDigitFormChange?: (digitForm: DigitFormId) => void;
|
|
348
|
+
/** Host maps assetId / literal value to a browser-loadable image URL (S3, CDN, local). */
|
|
349
|
+
resolveImageUrl?: (ref: {
|
|
350
|
+
assetId?: string;
|
|
351
|
+
value: string;
|
|
352
|
+
}) => string;
|
|
292
353
|
onDocumentChange?: (document: Document2Node) => void;
|
|
293
354
|
onLatexChange?: (latex: string) => void;
|
|
294
355
|
};
|
|
@@ -297,13 +358,14 @@ type Document2InitialState = {
|
|
|
297
358
|
error: string | null;
|
|
298
359
|
};
|
|
299
360
|
declare function resolveInitialDocument2(initialDocument: Document2Json | Document2Node | undefined, uiLocale?: ButexUiLocale): Document2InitialState;
|
|
300
|
-
declare function ButexDocumentEditor2({ initialDocument, className, debug, documentDirection, equationSide, editableEquations, previewOnly, uiLocale, mathOutput, onDocumentChange, onLatexChange, }: ButexDocumentEditor2Props): react_jsx_runtime.JSX.Element;
|
|
361
|
+
declare function ButexDocumentEditor2({ initialDocument, className, debug, documentDirection, equationSide, editableEquations, previewOnly, uiLocale, mathOutput, digitForm: digitFormProp, onDigitFormChange, resolveImageUrl, onDocumentChange, onLatexChange, }: ButexDocumentEditor2Props): react_jsx_runtime.JSX.Element;
|
|
301
362
|
|
|
302
363
|
type DocumentInsertToolbarProps = {
|
|
303
364
|
canUndo: boolean;
|
|
304
365
|
canRedo: boolean;
|
|
305
366
|
editableEquations?: boolean;
|
|
306
367
|
uiLocale?: ButexUiLocale;
|
|
368
|
+
digitForm?: DigitFormId;
|
|
307
369
|
onUndo: () => void;
|
|
308
370
|
onRedo: () => void;
|
|
309
371
|
onAddSection: () => void;
|
|
@@ -316,14 +378,23 @@ type DocumentInsertToolbarProps = {
|
|
|
316
378
|
onAddList: () => void;
|
|
317
379
|
onAddEnumerate: () => void;
|
|
318
380
|
onAddFigure: () => void;
|
|
381
|
+
onInsertCitation: () => void;
|
|
382
|
+
onInsertBibliography: () => void;
|
|
383
|
+
onManageReferences: () => void;
|
|
384
|
+
onDigitFormChange: (digitForm: DigitFormId) => void;
|
|
319
385
|
};
|
|
320
|
-
declare function DocumentInsertToolbar({ canUndo, canRedo, editableEquations, uiLocale, onUndo, onRedo, onAddSection, onAddSubsection, onAddSubsubsection, onAddParagraph, onAddInlineEquation, onAddDisplayEquation, onAddTable, onAddList, onAddEnumerate, onAddFigure, }: DocumentInsertToolbarProps): react_jsx_runtime.JSX.Element;
|
|
386
|
+
declare function DocumentInsertToolbar({ canUndo, canRedo, editableEquations, uiLocale, digitForm, onUndo, onRedo, onAddSection, onAddSubsection, onAddSubsubsection, onAddParagraph, onAddInlineEquation, onAddDisplayEquation, onAddTable, onAddList, onAddEnumerate, onAddFigure, onInsertCitation, onInsertBibliography, onManageReferences, onDigitFormChange, }: DocumentInsertToolbarProps): react_jsx_runtime.JSX.Element;
|
|
321
387
|
|
|
322
|
-
|
|
388
|
+
type ResolveDocument2ImageUrl = (ref: {
|
|
389
|
+
assetId?: string;
|
|
390
|
+
value: string;
|
|
391
|
+
}) => string;
|
|
392
|
+
declare function DocumentPreview({ blocks, output, documentDirection, uiLocale, resolveImageUrl, }: {
|
|
323
393
|
blocks: PreviewBlock2[];
|
|
324
394
|
output: Document2MathOutput;
|
|
325
395
|
documentDirection?: 'rtl' | 'ltr';
|
|
326
396
|
uiLocale?: ButexUiLocale;
|
|
397
|
+
resolveImageUrl?: ResolveDocument2ImageUrl;
|
|
327
398
|
}): react_jsx_runtime.JSX.Element;
|
|
328
399
|
|
|
329
400
|
type EquationMathMode = 'inline' | 'display';
|
|
@@ -344,19 +415,25 @@ declare function EquationDrawer({ session, reason, mathMode, canDelete, equation
|
|
|
344
415
|
type InlineFieldProps = {
|
|
345
416
|
field: InlineField2;
|
|
346
417
|
blockId?: string;
|
|
418
|
+
references?: Reference2[];
|
|
347
419
|
documentDirection?: 'rtl' | 'ltr';
|
|
420
|
+
digitForm?: DigitFormId;
|
|
348
421
|
mathOutput?: Document2MathOutput;
|
|
349
422
|
equationSide?: EditorSide;
|
|
350
423
|
editableEquations?: boolean;
|
|
424
|
+
editableCitations?: boolean;
|
|
351
425
|
uiLocale?: ButexUiLocale;
|
|
352
426
|
onTextChange: (fieldId: string, tokenId: string, text: string) => void;
|
|
353
427
|
onOpenMath: (token: MathToken2) => void;
|
|
354
428
|
onDeleteMath?: (tokenId: string) => void;
|
|
429
|
+
onOpenCite?: (token: CiteToken2) => void;
|
|
430
|
+
onDeleteCite?: (tokenId: string) => void;
|
|
355
431
|
onFieldFocus?: (blockId: string, fieldId: string, textTokenId: string, caretOffset: number) => void;
|
|
356
432
|
onMathFocus?: (blockId: string, fieldId: string, tokenId: string) => void;
|
|
433
|
+
onCiteFocus?: (blockId: string, fieldId: string, tokenId: string) => void;
|
|
357
434
|
onFieldBlur?: () => void;
|
|
358
435
|
};
|
|
359
|
-
declare function InlineField({ field, blockId, documentDirection, mathOutput, equationSide, editableEquations, uiLocale, onTextChange, onOpenMath, onDeleteMath, onFieldFocus, onMathFocus, onFieldBlur, }: InlineFieldProps): react_jsx_runtime.JSX.Element;
|
|
436
|
+
declare function InlineField({ field, blockId, references, documentDirection, digitForm, mathOutput, equationSide, editableEquations, editableCitations, uiLocale, onTextChange, onOpenMath, onDeleteMath, onOpenCite, onDeleteCite, onFieldFocus, onMathFocus, onCiteFocus, onFieldBlur, }: InlineFieldProps): react_jsx_runtime.JSX.Element;
|
|
360
437
|
|
|
361
438
|
type MathChipProps = {
|
|
362
439
|
token: MathToken2;
|
|
@@ -384,7 +461,7 @@ type MathIslandProps = {
|
|
|
384
461
|
};
|
|
385
462
|
declare function MathIsland({ id, tex, display, output }: MathIslandProps): react_jsx_runtime.JSX.Element;
|
|
386
463
|
|
|
387
|
-
declare const DOCUMENT2_WIDGET_CSS = "\n.butex-document2-widget {\n --butex-document2-bg: var(--butex-bg, #f8fafc);\n --butex-document2-fg: var(--butex-fg, #0f172a);\n --butex-document2-muted: var(--butex-muted, #64748b);\n --butex-document2-panel: var(--butex-panel, #ffffff);\n --butex-document2-border: var(--butex-border, #e2e8f0);\n --butex-document2-accent: var(--butex-accent, #0d9488);\n --butex-document2-accent-bg: var(--butex-toolbar-hover-bg, rgba(13, 148, 136, 0.08));\n --butex-document2-focus-shadow: var(--butex-focus-shadow, rgba(13, 148, 136, 0.16));\n --butex-document2-danger: var(--butex-danger, #dc2626);\n --butex-document2-error: var(--butex-error, #b91c1c);\n --butex-document2-error-bg: var(--butex-error-bg, #fef2f2);\n --butex-document2-preview-bg: var(--butex-preview-bg, #ffffff);\n --butex-document2-preview-fg: var(--butex-preview-fg, var(--butex-document2-fg));\n --butex-document2-preview-font: \"Amiri\", \"Noto Serif Arabic\", Georgia, \"Times New Roman\", serif;\n --butex-document2-drawer-bg: var(--butex-document2-panel);\n --butex-document2-input-bg: #ffffff;\n --butex-document2-raw-bg: #f8fafc;\n --butex-document2-math-bg: var(--butex-document2-accent-bg);\n --butex-document2-math-border: rgba(13, 148, 136, 0.35);\n --butex-document2-text-token-bg: var(--butex-text-token-bg, color-mix(in srgb, var(--butex-document2-panel) 86%, var(--butex-document2-bg)));\n --butex-document2-text-token-border: var(--butex-text-token-border, color-mix(in srgb, var(--butex-document2-border) 86%, var(--butex-document2-muted)));\n --butex-document2-math-inline-bg: var(--butex-math-inline-bg, color-mix(in srgb, var(--butex-document2-accent) 10%, var(--butex-document2-panel)));\n --butex-document2-math-display-bg: var(--butex-math-display-bg, color-mix(in srgb, var(--butex-document2-accent) 7%, var(--butex-document2-bg)));\n --butex-document2-collapse-bg: var(--butex-collapse-bg, color-mix(in srgb, var(--butex-document2-muted) 8%, var(--butex-document2-panel)));\n --butex-document2-dev-bg: var(--butex-dev-bg, #fffbeb);\n --butex-document2-dev-border: var(--butex-dev-border, #fcd34d);\n --butex-document2-dev-code-bg: var(--butex-dev-inset-bg, #ffffff);\n --butex-document2-dev-code-fg: var(--butex-dev-inset-fg, var(--butex-document2-fg));\n box-sizing: border-box;\n color: var(--butex-document2-fg);\n direction: rtl;\n font-family: ui-sans-serif, system-ui, \"Segoe UI\", Tahoma, Arial, sans-serif;\n line-height: 1.45;\n}\n\n.butex-document2-widget *,\n.butex-document2-widget *::before,\n.butex-document2-widget *::after {\n box-sizing: inherit;\n}\n\n.butex-document2-widget__shell,\n.butex-document2-widget__editor-panel,\n.butex-document2-widget__blocks,\n.butex-document2-widget__dev,\n.butex-document2-widget__field {\n display: grid;\n gap: 10px;\n min-width: 0;\n}\n\n.butex-document2-widget__toolbar,\n.butex-document2-widget__panel,\n.butex-document2-widget__block,\n.butex-document2-widget__dev {\n background: var(--butex-document2-panel);\n border: 1px solid var(--butex-document2-border);\n border-radius: 12px;\n min-width: 0;\n padding: 12px;\n}\n\n.butex-document2-widget__toolbar {\n position: sticky;\n top: 0;\n z-index: 20;\n box-shadow: 0 4px 16px color-mix(in srgb, var(--butex-document2-fg) 6%, transparent);\n gap: 6px;\n}\n\n.butex-document2-widget__toolbar-insert {\n align-items: center;\n display: flex;\n flex: 1 1 auto;\n flex-wrap: wrap;\n gap: 6px;\n min-width: 0;\n}\n\n.butex-document2-widget__toolbar-group {\n align-items: center;\n border-inline-start: 1px solid color-mix(in srgb, var(--butex-document2-border) 75%, transparent);\n display: flex;\n flex-wrap: wrap;\n gap: 4px;\n padding-inline-start: 6px;\n}\n\n.butex-document2-widget__toolbar-group:first-child {\n border-inline-start: 0;\n padding-inline-start: 0;\n}\n\n.butex-document2-widget__icon-btn {\n align-items: center;\n background: var(--butex-document2-panel);\n border: 1px solid var(--butex-document2-border);\n border-radius: 8px;\n color: var(--butex-document2-fg);\n cursor: pointer;\n display: inline-flex;\n font-weight: 700;\n justify-content: center;\n line-height: 1;\n min-height: 30px;\n min-width: 30px;\n padding: 0 6px;\n}\n\n.butex-document2-widget__icon-btn:hover:not(:disabled),\n.butex-document2-widget__icon-btn[aria-pressed=\"true\"] {\n background: var(--butex-document2-accent-bg);\n border-color: var(--butex-document2-accent);\n}\n\n.butex-document2-widget__icon-btn:disabled {\n cursor: not-allowed;\n opacity: 0.45;\n}\n\n.butex-document2-widget__icon-btn--h1 {\n font-size: 1.15rem;\n}\n\n.butex-document2-widget__icon-btn--h2 {\n font-size: 1rem;\n}\n\n.butex-document2-widget__icon-btn--h3 {\n font-size: 0.88rem;\n}\n\n.butex-document2-widget__icon-math-inline {\n font-family: ui-monospace, Consolas, monospace;\n font-size: 0.78rem;\n font-weight: 600;\n}\n\n.butex-document2-widget__icon-math-display {\n font-size: 0.82rem;\n font-weight: 700;\n}\n\n.butex-document2-widget__block-actions {\n align-items: center;\n display: flex;\n flex-wrap: wrap;\n gap: 6px;\n}\n\n.butex-document2-widget button.butex-document2-widget__block-collapse {\n align-items: center;\n background: var(--butex-document2-collapse-bg);\n border-color: color-mix(in srgb, var(--butex-document2-border) 70%, var(--butex-document2-muted));\n display: inline-flex;\n font-weight: 800;\n justify-content: center;\n min-height: 26px;\n min-width: 26px;\n padding: 0;\n}\n\n.butex-document2-widget__math-chip-wrap {\n align-items: center;\n display: inline-flex;\n gap: 2px;\n}\n\n.butex-document2-widget__math-chip-wrap[data-display=\"true\"] {\n flex: 1 1 100%;\n justify-content: center;\n width: 100%;\n}\n\n.butex-document2-widget__math-chip-delete {\n background: transparent;\n border: 1px solid color-mix(in srgb, var(--butex-document2-danger) 35%, var(--butex-document2-border));\n border-radius: 6px;\n color: var(--butex-document2-danger);\n cursor: pointer;\n font-size: 0.85rem;\n line-height: 1;\n min-height: 24px;\n min-width: 24px;\n padding: 0;\n}\n\n.butex-document2-widget__table-cell {\n flex: 1 1 8rem;\n min-width: 8rem;\n}\n\n.butex-document2-widget__block--table .butex-document2-widget__inline-text {\n min-height: 3.5em;\n min-width: min(12ch, 100%);\n}\n\n.butex-document2-widget__table-popover {\n display: inline-block;\n position: relative;\n}\n\n.butex-document2-widget__table-popover-panel {\n background: var(--butex-document2-panel);\n border: 1px solid var(--butex-document2-border);\n border-radius: 10px;\n box-shadow: 0 8px 24px color-mix(in srgb, var(--butex-document2-fg) 12%, transparent);\n display: grid;\n gap: 8px;\n inset-inline-end: 0;\n padding: 10px;\n position: absolute;\n top: calc(100% + 6px);\n width: min(220px, 70vw);\n z-index: 30;\n}\n\n.butex-document2-widget__table-popover-panel label {\n color: var(--butex-document2-muted);\n display: grid;\n font-size: 0.82rem;\n gap: 4px;\n}\n\n.butex-document2-widget__toolbar-row {\n align-items: center;\n border-block-end: 1px solid color-mix(in srgb, var(--butex-document2-border) 70%, transparent);\n display: flex;\n flex-wrap: wrap;\n gap: 8px;\n margin-block-end: 8px;\n padding-block-end: 8px;\n width: 100%;\n}\n\n.butex-document2-widget__toolbar-row:last-child {\n border-block-end: 0;\n margin-block-end: 0;\n padding-block-end: 0;\n}\n\n.butex-document2-widget__toolbar-label {\n color: var(--butex-document2-muted);\n font-size: 0.78rem;\n font-weight: 600;\n margin-inline-end: 4px;\n white-space: nowrap;\n}\n\n.butex-document2-widget__block-header {\n align-items: center;\n border-block-end: 1px solid color-mix(in srgb, var(--butex-document2-border) 80%, transparent);\n display: flex;\n flex-wrap: wrap;\n gap: 8px;\n justify-content: space-between;\n margin-block-end: 10px;\n padding-block-end: 8px;\n}\n\n.butex-document2-widget__block-title {\n align-items: center;\n color: var(--butex-document2-fg);\n display: inline-flex;\n gap: 8px;\n font-weight: 700;\n}\n\n.butex-document2-widget__block--section .butex-document2-widget__block-title {\n font-size: 1.12rem;\n}\n\n.butex-document2-widget__block--subsection .butex-document2-widget__block-title {\n font-size: 1.04rem;\n}\n\n.butex-document2-widget__block--subsubsection .butex-document2-widget__block-title {\n font-size: 0.98rem;\n}\n\n.butex-document2-widget__block--paragraph .butex-document2-widget__block-title {\n color: var(--butex-document2-muted);\n font-size: 0.86rem;\n font-weight: 600;\n}\n\n.butex-document2-widget__block--list .butex-document2-widget__block-title,\n.butex-document2-widget__block--table .butex-document2-widget__block-title,\n.butex-document2-widget__block--image .butex-document2-widget__block-title,\n.butex-document2-widget__block--raw .butex-document2-widget__block-title {\n font-size: 0.9rem;\n}\n\n.butex-document2-widget__block--section {\n background: color-mix(in srgb, var(--butex-document2-accent) 9%, var(--butex-document2-panel));\n border-inline-start: 4px solid var(--butex-document2-accent);\n}\n\n.butex-document2-widget__block--subsection {\n background: color-mix(in srgb, var(--butex-document2-accent) 6%, var(--butex-document2-panel));\n border-inline-start: 3px solid color-mix(in srgb, var(--butex-document2-accent) 78%, var(--butex-document2-border));\n}\n\n.butex-document2-widget__block--subsubsection {\n background: color-mix(in srgb, var(--butex-document2-accent) 4%, var(--butex-document2-panel));\n border-inline-start: 3px solid var(--butex-document2-border);\n}\n\n.butex-document2-widget__block--paragraph {\n border-inline-start: 2px solid color-mix(in srgb, var(--butex-document2-muted) 35%, transparent);\n}\n\n.butex-document2-widget__block--list {\n background: color-mix(in srgb, var(--butex-document2-bg) 55%, var(--butex-document2-panel));\n border-inline-start: 3px solid color-mix(in srgb, var(--butex-document2-accent) 55%, var(--butex-document2-border));\n}\n\n.butex-document2-widget__block--table {\n background: color-mix(in srgb, var(--butex-document2-bg) 40%, var(--butex-document2-panel));\n border-inline-start: 3px solid var(--butex-document2-border);\n}\n\n.butex-document2-widget__block--image {\n background: color-mix(in srgb, var(--butex-document2-muted) 6%, var(--butex-document2-panel));\n border-inline-start: 3px dashed color-mix(in srgb, var(--butex-document2-muted) 45%, var(--butex-document2-border));\n}\n\n.butex-document2-widget__block--raw {\n background: color-mix(in srgb, var(--butex-document2-muted) 8%, var(--butex-document2-panel));\n border-inline-start: 3px dashed var(--butex-document2-muted);\n}\n\n.butex-document2-widget__block--collapsed {\n background: var(--butex-document2-collapse-bg);\n}\n\n.butex-document2-widget__block--collapsed .butex-document2-widget__block-header {\n margin-block-end: 8px;\n}\n\n.butex-document2-widget__block-summary {\n background: color-mix(in srgb, var(--butex-document2-panel) 72%, transparent);\n border: 1px dashed color-mix(in srgb, var(--butex-document2-border) 70%, var(--butex-document2-muted));\n border-radius: 8px;\n color: var(--butex-document2-muted);\n font-size: 0.86rem;\n line-height: 1.5;\n min-width: 0;\n overflow-wrap: anywhere;\n padding: 8px 10px;\n}\n\n.butex-document2-widget__list-item-actions {\n align-items: center;\n display: flex;\n flex-wrap: wrap;\n gap: 6px;\n margin-block-start: 6px;\n}\n\n.butex-document2-widget__list-item-content {\n display: grid;\n gap: 8px;\n min-width: 0;\n}\n\n.butex-document2-widget__list-footer {\n border-block-start: 1px dashed color-mix(in srgb, var(--butex-document2-border) 85%, transparent);\n margin-block-start: 10px;\n padding-block-start: 10px;\n}\n\n.butex-document2-widget__button--danger:hover {\n border-color: var(--butex-document2-danger);\n color: var(--butex-document2-danger);\n}\n\n.butex-document2-widget__image-src-label {\n color: var(--butex-document2-muted);\n display: block;\n font-size: 0.82rem;\n margin-block-end: 4px;\n}\n\n.butex-document2-widget__toolbar,\n.butex-document2-widget__row {\n align-items: center;\n display: flex;\n flex-wrap: wrap;\n gap: 8px;\n}\n\n.butex-document2-widget button {\n background: var(--butex-document2-panel);\n border: 1px solid var(--butex-document2-border);\n border-radius: 8px;\n color: var(--butex-document2-fg);\n cursor: pointer;\n min-height: 32px;\n padding: 0 10px;\n}\n\n.butex-document2-widget button:hover,\n.butex-document2-widget button[aria-pressed=\"true\"] {\n background: var(--butex-document2-accent-bg);\n border-color: var(--butex-document2-accent);\n}\n\n.butex-document2-widget button:focus-visible,\n.butex-document2-widget input:focus-visible,\n.butex-document2-widget textarea:focus-visible {\n border-color: var(--butex-document2-accent);\n box-shadow: 0 0 0 3px var(--butex-document2-focus-shadow);\n outline: none;\n}\n\n.butex-document2-widget input {\n background: var(--butex-document2-input-bg);\n border: 1px solid var(--butex-document2-border);\n border-radius: 8px;\n color: var(--butex-document2-fg);\n font: inherit;\n min-height: 34px;\n padding: 7px 9px;\n}\n\n.butex-document2-widget textarea {\n background: var(--butex-document2-input-bg);\n border: 1px solid var(--butex-document2-border);\n border-radius: 8px;\n color: var(--butex-document2-fg);\n font: inherit;\n line-height: 1.45;\n padding: 7px 9px;\n}\n\n.butex-document2-widget__layout {\n align-items: start;\n display: grid;\n gap: 12px;\n grid-template-columns: minmax(0, 1fr) minmax(280px, 0.9fr);\n transition: grid-template-columns 0.22s ease;\n}\n\n.butex-document2-widget__layout--editor-open.butex-document2-widget__layout--preview-open {\n grid-template-columns: minmax(0, 1fr) minmax(280px, 0.9fr);\n}\n\n/* One visible panel: a single track so the panel fills the widget (previewOnly / hide editor / hide preview). */\n.butex-document2-widget__layout--editor-open.butex-document2-widget__layout--preview-closed,\n.butex-document2-widget__layout--editor-closed.butex-document2-widget__layout--preview-open,\n.butex-document2-widget__layout--editor-closed.butex-document2-widget__layout--preview-closed {\n grid-template-columns: minmax(0, 1fr);\n}\n\n.butex-document2-widget__editor-panel,\n.butex-document2-widget__preview-panel {\n min-width: 0;\n opacity: 1;\n overflow-x: hidden;\n overflow-y: auto;\n transform: translateX(0);\n transition:\n opacity 0.18s ease,\n transform 0.22s ease,\n padding 0.22s ease,\n border-width 0.22s ease,\n box-shadow 0.22s ease;\n}\n\n/* When previewOnly (or display:none) leaves a lone panel, span the full grid. */\n.butex-document2-widget__editor-panel:only-child,\n.butex-document2-widget__preview-panel:only-child {\n grid-column: 1 / -1;\n width: 100%;\n}\n\n.butex-document2-widget__layout--editor-closed .butex-document2-widget__editor-panel,\n.butex-document2-widget__layout--preview-closed .butex-document2-widget__preview-panel {\n display: none;\n}\n\n.butex-document2-widget__inline-field {\n align-items: center;\n display: flex;\n flex-wrap: wrap;\n gap: 6px;\n max-width: 100%;\n min-width: 0;\n width: 100%;\n}\n\n.butex-document2-widget__inline-text {\n background: var(--butex-document2-text-token-bg);\n border-color: var(--butex-document2-text-token-border);\n box-sizing: border-box;\n flex: 0 1 auto;\n max-width: 100%;\n min-height: 2.75em;\n min-width: 3ch;\n overflow-wrap: break-word;\n overflow-y: hidden;\n resize: none;\n text-align: start;\n white-space: pre-wrap;\n width: auto;\n word-break: break-word;\n}\n\n.butex-document2-widget__inline-text:hover {\n border-color: color-mix(in srgb, var(--butex-document2-text-token-border) 55%, var(--butex-document2-accent));\n}\n\n.butex-document2-widget__inline-field input {\n min-width: 12ch;\n}\n\n.butex-document2-widget__math-chip {\n background: var(--butex-document2-math-inline-bg);\n border-color: color-mix(in srgb, var(--butex-document2-math-border) 70%, var(--butex-document2-accent));\n border-width: 1.5px;\n direction: ltr;\n display: inline-flex;\n font-family: inherit;\n gap: 4px;\n max-width: 100%;\n min-height: 30px;\n overflow: visible;\n padding: 3px 7px;\n unicode-bidi: isolate;\n}\n\n.butex-document2-widget__math-chip:hover,\n.butex-document2-widget__math-chip:focus-visible {\n background: color-mix(in srgb, var(--butex-document2-accent) 12%, var(--butex-document2-panel));\n border-color: var(--butex-document2-accent);\n}\n\n.butex-document2-widget__math-chip[data-editable=\"false\"] {\n border-style: dashed;\n color: var(--butex-document2-muted);\n}\n\n.butex-document2-widget__math-chip[data-display=\"true\"] {\n background: var(--butex-document2-math-display-bg);\n border-color: color-mix(in srgb, var(--butex-document2-accent) 50%, var(--butex-document2-border));\n border-width: 1.5px;\n border-radius: 10px;\n box-shadow: 0 5px 16px color-mix(in srgb, var(--butex-document2-fg) 8%, transparent);\n justify-content: center;\n margin-block: 4px;\n min-height: 54px;\n padding: 10px 12px;\n width: min(100%, 36rem);\n}\n\n.butex-document2-widget__preview {\n background: var(--butex-document2-preview-bg);\n color: var(--butex-document2-preview-fg);\n font-family: var(--butex-document2-preview-font);\n font-size: 1.08rem;\n line-height: 1.9;\n max-width: 100%;\n min-width: 0;\n overflow-wrap: break-word;\n text-align: start;\n word-break: break-word;\n}\n\n.butex-document2-widget__preview h1,\n.butex-document2-widget__preview h2,\n.butex-document2-widget__preview h3,\n.butex-document2-widget__preview p,\n.butex-document2-widget__preview li {\n max-width: 100%;\n overflow-wrap: break-word;\n white-space: normal;\n word-break: break-word;\n}\n\n.butex-document2-widget__preview h1 {\n font-size: 1.75rem;\n font-weight: 700;\n line-height: 1.35;\n margin: 0 0 14px;\n}\n\n.butex-document2-widget__preview h2 {\n font-size: 1.4rem;\n font-weight: 600;\n line-height: 1.4;\n margin: 0 0 12px;\n}\n\n.butex-document2-widget__preview h3 {\n font-size: 1.2rem;\n font-weight: 600;\n line-height: 1.45;\n margin: 0 0 10px;\n}\n\n.butex-document2-widget__preview p {\n margin: 0 0 12px;\n}\n\n.butex-document2-widget__preview ul,\n.butex-document2-widget__preview ol {\n margin: 0 0 12px;\n padding-inline-start: 24px;\n}\n\n.butex-document2-widget__preview ul {\n list-style-type: disc;\n}\n\n.butex-document2-widget__preview ol {\n list-style-type: decimal;\n}\n\n.butex-document2-widget__preview img {\n display: block;\n height: auto;\n max-width: 100%;\n}\n\n.butex-document2-widget__preview table {\n border-collapse: collapse;\n border: 1px solid #000000;\n margin: 12px 0;\n max-width: 100%;\n table-layout: fixed;\n width: 100%;\n}\n\n.butex-document2-widget__preview td {\n border: 1px solid #000000;\n max-width: 100%;\n overflow-wrap: break-word;\n padding: 6px 8px;\n white-space: normal;\n word-break: break-word;\n}\n\n.butex-document2-widget__math-island {\n direction: ltr;\n display: inline-block;\n line-height: normal;\n margin: 0 2px;\n overflow: visible;\n unicode-bidi: isolate;\n vertical-align: middle;\n}\n\n/* Guard against host CSS resets (e.g. Tailwind Preflight's `svg { display: block }`).\n * MathJax v4 inline line-breaking emits an equation as several sibling <svg> chunks;\n * a block-level svg reset stacks them vertically inside the island. */\n.butex-document2-widget mjx-container svg {\n display: inline;\n}\n\n.butex-document2-widget__math-chip .butex-document2-widget__math-island {\n margin: 0;\n}\n\n.butex-document2-widget__math-island[data-render-state=\"loading\"] {\n opacity: 0.72;\n}\n\n.butex-document2-widget__math-island[data-render-state=\"error\"] {\n color: var(--butex-document2-error);\n font-family: ui-monospace, SFMono-Regular, Consolas, monospace;\n font-size: 0.88rem;\n max-width: 100%;\n overflow-wrap: anywhere;\n white-space: normal;\n}\n\n.butex-document2-widget__math-island[data-display=\"true\"] {\n display: block;\n margin: 10px 0;\n text-align: center;\n}\n\n.butex-document2-widget__math-chip .butex-document2-widget__math-island[data-display=\"true\"] {\n margin: 0;\n}\n\n.butex-document2-widget__raw {\n background: var(--butex-document2-raw-bg);\n border-radius: 8px;\n direction: ltr;\n padding: 8px;\n text-align: left;\n white-space: pre-wrap;\n}\n\n.butex-document2-widget__error {\n background: var(--butex-document2-error-bg);\n border: 1px solid var(--butex-document2-error);\n border-radius: 8px;\n color: var(--butex-document2-error);\n padding: 10px;\n}\n\n.butex-document2-widget__equation-modal {\n align-items: center;\n display: flex;\n inset: 0;\n justify-content: center;\n padding: 16px;\n position: fixed;\n z-index: 30;\n}\n\n.butex-document2-widget__equation-modal-backdrop {\n background: color-mix(in srgb, var(--butex-document2-fg) 34%, transparent);\n border: 0;\n cursor: pointer;\n display: block;\n height: 100%;\n inset: 0;\n margin: 0;\n padding: 0;\n position: absolute;\n width: 100%;\n}\n\n.butex-document2-widget__equation-modal-panel {\n background: var(--butex-document2-drawer-bg);\n border: 1px solid var(--butex-document2-border);\n border-radius: 12px;\n box-shadow: 0 18px 48px color-mix(in srgb, var(--butex-document2-fg) 18%, transparent);\n display: grid;\n gap: 12px;\n max-height: min(90vh, 900px);\n max-width: min(720px, 100%);\n overflow: auto;\n padding: 14px;\n position: relative;\n width: min(680px, 100%);\n z-index: 1;\n}\n\n/* Map document v2 tokens onto BuTeX equation editor chrome when embedded in this modal. */\n.butex-document2-widget__equation-modal-panel .butex-widget {\n --butex-bg: var(--butex-document2-bg);\n --butex-fg: var(--butex-document2-fg);\n --butex-muted: var(--butex-document2-muted);\n --butex-accent: var(--butex-document2-accent);\n --butex-accent-hover: color-mix(in srgb, var(--butex-document2-accent) 82%, #000000);\n --butex-toolbar-hover-bg: var(--butex-document2-accent-bg);\n --butex-toolbar-hover-border: var(--butex-document2-accent);\n --butex-danger: var(--butex-document2-danger);\n --butex-danger-bg: color-mix(in srgb, var(--butex-document2-danger) 12%, transparent);\n --butex-danger-border: color-mix(in srgb, var(--butex-document2-danger) 48%, transparent);\n --butex-on-accent: #ffffff;\n --butex-border: var(--butex-document2-border);\n --butex-panel: var(--butex-document2-panel);\n --butex-preview-bg: var(--butex-document2-preview-bg);\n --butex-preview-fg: var(--butex-document2-preview-fg);\n --butex-error: var(--butex-document2-error);\n --butex-error-bg: var(--butex-document2-error-bg);\n --butex-error-border: color-mix(in srgb, var(--butex-document2-error) 32%, var(--butex-document2-panel));\n --butex-shadow-md: 0 4px 14px color-mix(in srgb, var(--butex-document2-fg) 10%, transparent);\n --butex-dev-bg: var(--butex-document2-dev-bg);\n --butex-dev-border: var(--butex-document2-dev-border);\n --butex-dev-badge: var(--butex-dev-badge, #b45309);\n --butex-dev-badge-fg: var(--butex-dev-badge-fg, #ffffff);\n --butex-dev-muted: var(--butex-dev-muted, #92400e);\n --butex-dev-inset-bg: var(--butex-document2-dev-code-bg);\n --butex-dev-inset-border: color-mix(in srgb, var(--butex-document2-dev-border) 45%, transparent);\n --butex-dev-inset-fg: var(--butex-document2-dev-code-fg);\n --butex-surface-bg: linear-gradient(\n 180deg,\n var(--butex-document2-panel) 0%,\n color-mix(in srgb, var(--butex-document2-panel) 88%, var(--butex-document2-bg)) 100%\n );\n --butex-surface-fg: var(--butex-document2-fg);\n --butex-focus-border: color-mix(in srgb, var(--butex-document2-accent) 45%, transparent);\n --butex-focus-shadow: var(--butex-document2-focus-shadow);\n --butex-slot-hover: var(--butex-document2-accent-bg);\n --butex-selection-bg: color-mix(in srgb, var(--butex-document2-accent) 34%, transparent);\n --butex-selection-border: color-mix(in srgb, var(--butex-document2-accent) 90%, #0f172a);\n --butex-caret: var(--butex-document2-fg);\n --butex-node-hover: color-mix(in srgb, var(--butex-document2-muted) 14%, transparent);\n --butex-node-selected-bg: var(--butex-document2-accent-bg);\n --butex-node-selected-border: color-mix(in srgb, var(--butex-document2-accent) 45%, transparent);\n --butex-script-border: var(--butex-document2-border);\n --butex-script-bg: color-mix(in srgb, var(--butex-document2-bg) 35%, var(--butex-document2-panel));\n --butex-script-color: var(--butex-document2-muted);\n --butex-delim-color: var(--butex-document2-muted);\n --butex-frac-bar: currentColor;\n}\n\n.butex-document2-widget__dev {\n background: var(--butex-document2-dev-bg);\n border-color: var(--butex-document2-dev-border);\n}\n\n.butex-document2-widget__dev pre {\n background: var(--butex-document2-dev-code-bg);\n color: var(--butex-document2-dev-code-fg);\n direction: ltr;\n margin: 0;\n max-height: 220px;\n overflow: auto;\n padding: 10px;\n text-align: left;\n white-space: pre-wrap;\n}\n\n.butex-document2-widget__dev-diagnostic {\n background: rgba(251, 191, 36, 0.18);\n border: 1px solid rgba(217, 119, 6, 0.4);\n border-radius: 8px;\n color: #92400e;\n margin: 0;\n padding: 8px 10px;\n}\n\n@media (max-width: 900px) {\n .butex-document2-widget__layout,\n .butex-document2-widget__layout--editor-open.butex-document2-widget__layout--preview-open,\n .butex-document2-widget__layout--editor-open.butex-document2-widget__layout--preview-closed,\n .butex-document2-widget__layout--editor-closed.butex-document2-widget__layout--preview-open,\n .butex-document2-widget__layout--editor-closed.butex-document2-widget__layout--preview-closed {\n grid-template-columns: minmax(0, 1fr);\n }\n}\n\n@media (prefers-reduced-motion: reduce) {\n .butex-document2-widget__layout,\n .butex-document2-widget__editor-panel,\n .butex-document2-widget__preview-panel {\n transition: none;\n }\n}\n";
|
|
464
|
+
declare const DOCUMENT2_WIDGET_CSS = "\n.butex-document2-widget {\n --butex-document2-bg: var(--butex-bg, #f8fafc);\n --butex-document2-fg: var(--butex-fg, #0f172a);\n --butex-document2-muted: var(--butex-muted, #64748b);\n --butex-document2-panel: var(--butex-panel, #ffffff);\n --butex-document2-border: var(--butex-border, #e2e8f0);\n --butex-document2-accent: var(--butex-accent, #0d9488);\n --butex-document2-accent-bg: var(--butex-toolbar-hover-bg, rgba(13, 148, 136, 0.08));\n --butex-document2-focus-shadow: var(--butex-focus-shadow, rgba(13, 148, 136, 0.16));\n --butex-document2-danger: var(--butex-danger, #dc2626);\n --butex-document2-error: var(--butex-error, #b91c1c);\n --butex-document2-error-bg: var(--butex-error-bg, #fef2f2);\n --butex-document2-preview-bg: var(--butex-preview-bg, #ffffff);\n --butex-document2-preview-fg: var(--butex-preview-fg, var(--butex-document2-fg));\n --butex-document2-preview-font: \"Amiri\", \"Noto Serif Arabic\", Georgia, \"Times New Roman\", serif;\n --butex-document2-drawer-bg: var(--butex-document2-panel);\n --butex-document2-input-bg: #ffffff;\n --butex-document2-raw-bg: #f8fafc;\n --butex-document2-math-bg: var(--butex-document2-accent-bg);\n --butex-document2-math-border: rgba(13, 148, 136, 0.35);\n --butex-document2-text-token-bg: var(--butex-text-token-bg, color-mix(in srgb, var(--butex-document2-panel) 86%, var(--butex-document2-bg)));\n --butex-document2-text-token-border: var(--butex-text-token-border, color-mix(in srgb, var(--butex-document2-border) 86%, var(--butex-document2-muted)));\n --butex-document2-math-inline-bg: var(--butex-math-inline-bg, color-mix(in srgb, var(--butex-document2-accent) 10%, var(--butex-document2-panel)));\n --butex-document2-math-display-bg: var(--butex-math-display-bg, color-mix(in srgb, var(--butex-document2-accent) 7%, var(--butex-document2-bg)));\n --butex-document2-collapse-bg: var(--butex-collapse-bg, color-mix(in srgb, var(--butex-document2-muted) 8%, var(--butex-document2-panel)));\n --butex-document2-dev-bg: var(--butex-dev-bg, #fffbeb);\n --butex-document2-dev-border: var(--butex-dev-border, #fcd34d);\n --butex-document2-dev-code-bg: var(--butex-dev-inset-bg, #ffffff);\n --butex-document2-dev-code-fg: var(--butex-dev-inset-fg, var(--butex-document2-fg));\n box-sizing: border-box;\n color: var(--butex-document2-fg);\n direction: rtl;\n font-family: ui-sans-serif, system-ui, \"Segoe UI\", Tahoma, Arial, sans-serif;\n line-height: 1.45;\n}\n\n.butex-document2-widget *,\n.butex-document2-widget *::before,\n.butex-document2-widget *::after {\n box-sizing: inherit;\n}\n\n.butex-document2-widget__shell,\n.butex-document2-widget__editor-panel,\n.butex-document2-widget__blocks,\n.butex-document2-widget__dev,\n.butex-document2-widget__field {\n display: grid;\n gap: 10px;\n min-width: 0;\n}\n\n.butex-document2-widget__toolbar,\n.butex-document2-widget__panel,\n.butex-document2-widget__block,\n.butex-document2-widget__dev {\n background: var(--butex-document2-panel);\n border: 1px solid var(--butex-document2-border);\n border-radius: 12px;\n min-width: 0;\n padding: 12px;\n}\n\n.butex-document2-widget__toolbar {\n position: sticky;\n top: 0;\n z-index: 20;\n box-shadow: 0 4px 16px color-mix(in srgb, var(--butex-document2-fg) 6%, transparent);\n gap: 6px;\n}\n\n.butex-document2-widget__toolbar-insert {\n align-items: center;\n display: flex;\n flex: 1 1 auto;\n flex-wrap: wrap;\n gap: 6px;\n min-width: 0;\n}\n\n.butex-document2-widget__toolbar-group {\n align-items: center;\n border-inline-start: 1px solid color-mix(in srgb, var(--butex-document2-border) 75%, transparent);\n display: flex;\n flex-wrap: wrap;\n gap: 4px;\n padding-inline-start: 6px;\n}\n\n.butex-document2-widget__toolbar-group:first-child {\n border-inline-start: 0;\n padding-inline-start: 0;\n}\n\n.butex-document2-widget__icon-btn {\n align-items: center;\n background: var(--butex-document2-panel);\n border: 1px solid var(--butex-document2-border);\n border-radius: 8px;\n color: var(--butex-document2-fg);\n cursor: pointer;\n display: inline-flex;\n font-weight: 700;\n justify-content: center;\n line-height: 1;\n min-height: 30px;\n min-width: 30px;\n padding: 0 6px;\n}\n\n.butex-document2-widget__icon-btn:hover:not(:disabled),\n.butex-document2-widget__icon-btn[aria-pressed=\"true\"] {\n background: var(--butex-document2-accent-bg);\n border-color: var(--butex-document2-accent);\n}\n\n.butex-document2-widget__icon-btn:disabled {\n cursor: not-allowed;\n opacity: 0.45;\n}\n\n.butex-document2-widget__icon-btn--h1 {\n font-size: 1.15rem;\n}\n\n.butex-document2-widget__icon-btn--h2 {\n font-size: 1rem;\n}\n\n.butex-document2-widget__icon-btn--h3 {\n font-size: 0.88rem;\n}\n\n.butex-document2-widget__icon-math-inline {\n font-family: ui-monospace, Consolas, monospace;\n font-size: 0.78rem;\n font-weight: 600;\n}\n\n.butex-document2-widget__icon-math-display {\n font-size: 0.82rem;\n font-weight: 700;\n}\n\n.butex-document2-widget__block-actions {\n align-items: center;\n display: flex;\n flex-wrap: wrap;\n gap: 6px;\n}\n\n.butex-document2-widget button.butex-document2-widget__block-collapse {\n align-items: center;\n background: var(--butex-document2-collapse-bg);\n border-color: color-mix(in srgb, var(--butex-document2-border) 70%, var(--butex-document2-muted));\n display: inline-flex;\n font-weight: 800;\n justify-content: center;\n min-height: 26px;\n min-width: 26px;\n padding: 0;\n}\n\n.butex-document2-widget__math-chip-wrap {\n align-items: center;\n display: inline-flex;\n gap: 2px;\n}\n\n.butex-document2-widget__math-chip-wrap[data-display=\"true\"] {\n flex: 1 1 100%;\n justify-content: center;\n width: 100%;\n}\n\n.butex-document2-widget__math-chip-delete {\n background: transparent;\n border: 1px solid color-mix(in srgb, var(--butex-document2-danger) 35%, var(--butex-document2-border));\n border-radius: 6px;\n color: var(--butex-document2-danger);\n cursor: pointer;\n font-size: 0.85rem;\n line-height: 1;\n min-height: 24px;\n min-width: 24px;\n padding: 0;\n}\n\n.butex-document2-widget__table-cell {\n flex: 1 1 8rem;\n min-width: 8rem;\n}\n\n.butex-document2-widget__block--table .butex-document2-widget__inline-text {\n min-height: 3.5em;\n min-width: min(12ch, 100%);\n}\n\n.butex-document2-widget__table-popover {\n display: inline-block;\n position: relative;\n}\n\n.butex-document2-widget__table-popover-panel {\n background: var(--butex-document2-panel);\n border: 1px solid var(--butex-document2-border);\n border-radius: 10px;\n box-shadow: 0 8px 24px color-mix(in srgb, var(--butex-document2-fg) 12%, transparent);\n display: grid;\n gap: 8px;\n inset-inline-end: 0;\n padding: 10px;\n position: absolute;\n top: calc(100% + 6px);\n width: min(220px, 70vw);\n z-index: 30;\n}\n\n.butex-document2-widget__table-popover-panel label {\n color: var(--butex-document2-muted);\n display: grid;\n font-size: 0.82rem;\n gap: 4px;\n}\n\n.butex-document2-widget__toolbar-row {\n align-items: center;\n border-block-end: 1px solid color-mix(in srgb, var(--butex-document2-border) 70%, transparent);\n display: flex;\n flex-wrap: wrap;\n gap: 8px;\n margin-block-end: 8px;\n padding-block-end: 8px;\n width: 100%;\n}\n\n.butex-document2-widget__toolbar-row:last-child {\n border-block-end: 0;\n margin-block-end: 0;\n padding-block-end: 0;\n}\n\n.butex-document2-widget__toolbar-label {\n color: var(--butex-document2-muted);\n font-size: 0.78rem;\n font-weight: 600;\n margin-inline-end: 4px;\n white-space: nowrap;\n}\n\n.butex-document2-widget__block-header {\n align-items: center;\n border-block-end: 1px solid color-mix(in srgb, var(--butex-document2-border) 80%, transparent);\n display: flex;\n flex-wrap: wrap;\n gap: 8px;\n justify-content: space-between;\n margin-block-end: 10px;\n padding-block-end: 8px;\n}\n\n.butex-document2-widget__block-title {\n align-items: center;\n color: var(--butex-document2-fg);\n display: inline-flex;\n gap: 8px;\n font-weight: 700;\n}\n\n.butex-document2-widget__block--section .butex-document2-widget__block-title {\n font-size: 1.12rem;\n}\n\n.butex-document2-widget__block--subsection .butex-document2-widget__block-title {\n font-size: 1.04rem;\n}\n\n.butex-document2-widget__block--subsubsection .butex-document2-widget__block-title {\n font-size: 0.98rem;\n}\n\n.butex-document2-widget__block--paragraph .butex-document2-widget__block-title {\n color: var(--butex-document2-muted);\n font-size: 0.86rem;\n font-weight: 600;\n}\n\n.butex-document2-widget__block--list .butex-document2-widget__block-title,\n.butex-document2-widget__block--table .butex-document2-widget__block-title,\n.butex-document2-widget__block--image .butex-document2-widget__block-title,\n.butex-document2-widget__block--raw .butex-document2-widget__block-title {\n font-size: 0.9rem;\n}\n\n.butex-document2-widget__block--section {\n background: color-mix(in srgb, var(--butex-document2-accent) 9%, var(--butex-document2-panel));\n border-inline-start: 4px solid var(--butex-document2-accent);\n}\n\n.butex-document2-widget__block--subsection {\n background: color-mix(in srgb, var(--butex-document2-accent) 6%, var(--butex-document2-panel));\n border-inline-start: 3px solid color-mix(in srgb, var(--butex-document2-accent) 78%, var(--butex-document2-border));\n}\n\n.butex-document2-widget__block--subsubsection {\n background: color-mix(in srgb, var(--butex-document2-accent) 4%, var(--butex-document2-panel));\n border-inline-start: 3px solid var(--butex-document2-border);\n}\n\n.butex-document2-widget__block--paragraph {\n border-inline-start: 2px solid color-mix(in srgb, var(--butex-document2-muted) 35%, transparent);\n}\n\n.butex-document2-widget__block--list {\n background: color-mix(in srgb, var(--butex-document2-bg) 55%, var(--butex-document2-panel));\n border-inline-start: 3px solid color-mix(in srgb, var(--butex-document2-accent) 55%, var(--butex-document2-border));\n}\n\n.butex-document2-widget__block--table {\n background: color-mix(in srgb, var(--butex-document2-bg) 40%, var(--butex-document2-panel));\n border-inline-start: 3px solid var(--butex-document2-border);\n}\n\n.butex-document2-widget__block--image {\n background: color-mix(in srgb, var(--butex-document2-muted) 6%, var(--butex-document2-panel));\n border-inline-start: 3px dashed color-mix(in srgb, var(--butex-document2-muted) 45%, var(--butex-document2-border));\n}\n\n.butex-document2-widget__block--raw {\n background: color-mix(in srgb, var(--butex-document2-muted) 8%, var(--butex-document2-panel));\n border-inline-start: 3px dashed var(--butex-document2-muted);\n}\n\n.butex-document2-widget__block--collapsed {\n background: var(--butex-document2-collapse-bg);\n}\n\n.butex-document2-widget__block--collapsed .butex-document2-widget__block-header {\n margin-block-end: 8px;\n}\n\n.butex-document2-widget__block-summary {\n background: color-mix(in srgb, var(--butex-document2-panel) 72%, transparent);\n border: 1px dashed color-mix(in srgb, var(--butex-document2-border) 70%, var(--butex-document2-muted));\n border-radius: 8px;\n color: var(--butex-document2-muted);\n font-size: 0.86rem;\n line-height: 1.5;\n min-width: 0;\n overflow-wrap: anywhere;\n padding: 8px 10px;\n}\n\n.butex-document2-widget__list-item-actions {\n align-items: center;\n display: flex;\n flex-wrap: wrap;\n gap: 6px;\n margin-block-start: 6px;\n}\n\n.butex-document2-widget__list-item-content {\n display: grid;\n gap: 8px;\n min-width: 0;\n}\n\n.butex-document2-widget__list-footer {\n border-block-start: 1px dashed color-mix(in srgb, var(--butex-document2-border) 85%, transparent);\n margin-block-start: 10px;\n padding-block-start: 10px;\n}\n\n.butex-document2-widget__button--danger:hover {\n border-color: var(--butex-document2-danger);\n color: var(--butex-document2-danger);\n}\n\n.butex-document2-widget__image-src-label {\n color: var(--butex-document2-muted);\n display: block;\n font-size: 0.82rem;\n margin-block-end: 4px;\n}\n\n.butex-document2-widget__toolbar,\n.butex-document2-widget__row {\n align-items: center;\n display: flex;\n flex-wrap: wrap;\n gap: 8px;\n}\n\n.butex-document2-widget button {\n background: var(--butex-document2-panel);\n border: 1px solid var(--butex-document2-border);\n border-radius: 8px;\n color: var(--butex-document2-fg);\n cursor: pointer;\n min-height: 32px;\n padding: 0 10px;\n}\n\n.butex-document2-widget button:hover,\n.butex-document2-widget button[aria-pressed=\"true\"] {\n background: var(--butex-document2-accent-bg);\n border-color: var(--butex-document2-accent);\n}\n\n.butex-document2-widget button:focus-visible,\n.butex-document2-widget input:focus-visible,\n.butex-document2-widget textarea:focus-visible {\n border-color: var(--butex-document2-accent);\n box-shadow: 0 0 0 3px var(--butex-document2-focus-shadow);\n outline: none;\n}\n\n.butex-document2-widget input {\n background: var(--butex-document2-input-bg);\n border: 1px solid var(--butex-document2-border);\n border-radius: 8px;\n color: var(--butex-document2-fg);\n font: inherit;\n min-height: 34px;\n padding: 7px 9px;\n}\n\n.butex-document2-widget textarea {\n background: var(--butex-document2-input-bg);\n border: 1px solid var(--butex-document2-border);\n border-radius: 8px;\n color: var(--butex-document2-fg);\n font: inherit;\n line-height: 1.45;\n padding: 7px 9px;\n}\n\n.butex-document2-widget__layout {\n align-items: start;\n display: grid;\n gap: 12px;\n grid-template-columns: minmax(0, 1fr) minmax(280px, 0.9fr);\n transition: grid-template-columns 0.22s ease;\n}\n\n.butex-document2-widget__layout--editor-open.butex-document2-widget__layout--preview-open {\n grid-template-columns: minmax(0, 1fr) minmax(280px, 0.9fr);\n}\n\n/* One visible panel: a single track so the panel fills the widget (previewOnly / hide editor / hide preview). */\n.butex-document2-widget__layout--editor-open.butex-document2-widget__layout--preview-closed,\n.butex-document2-widget__layout--editor-closed.butex-document2-widget__layout--preview-open,\n.butex-document2-widget__layout--editor-closed.butex-document2-widget__layout--preview-closed {\n grid-template-columns: minmax(0, 1fr);\n}\n\n.butex-document2-widget__editor-panel,\n.butex-document2-widget__preview-panel {\n min-width: 0;\n opacity: 1;\n overflow-x: hidden;\n overflow-y: auto;\n transform: translateX(0);\n transition:\n opacity 0.18s ease,\n transform 0.22s ease,\n padding 0.22s ease,\n border-width 0.22s ease,\n box-shadow 0.22s ease;\n}\n\n/* When previewOnly (or display:none) leaves a lone panel, span the full grid. */\n.butex-document2-widget__editor-panel:only-child,\n.butex-document2-widget__preview-panel:only-child {\n grid-column: 1 / -1;\n width: 100%;\n}\n\n.butex-document2-widget__layout--editor-closed .butex-document2-widget__editor-panel,\n.butex-document2-widget__layout--preview-closed .butex-document2-widget__preview-panel {\n display: none;\n}\n\n.butex-document2-widget__inline-field {\n align-items: center;\n display: flex;\n flex-wrap: wrap;\n gap: 6px;\n max-width: 100%;\n min-width: 0;\n width: 100%;\n}\n\n.butex-document2-widget__inline-text {\n background: var(--butex-document2-text-token-bg);\n border-color: var(--butex-document2-text-token-border);\n box-sizing: border-box;\n flex: 0 1 auto;\n max-width: 100%;\n min-height: 2.75em;\n min-width: 3ch;\n overflow-wrap: break-word;\n overflow-y: hidden;\n resize: none;\n text-align: start;\n white-space: pre-wrap;\n width: auto;\n word-break: break-word;\n}\n\n.butex-document2-widget__inline-text:hover {\n border-color: color-mix(in srgb, var(--butex-document2-text-token-border) 55%, var(--butex-document2-accent));\n}\n\n.butex-document2-widget__inline-field input {\n min-width: 12ch;\n}\n\n.butex-document2-widget__math-chip {\n background: var(--butex-document2-math-inline-bg);\n border-color: color-mix(in srgb, var(--butex-document2-math-border) 70%, var(--butex-document2-accent));\n border-width: 1.5px;\n direction: ltr;\n display: inline-flex;\n font-family: inherit;\n gap: 4px;\n max-width: 100%;\n min-height: 30px;\n overflow: visible;\n padding: 3px 7px;\n unicode-bidi: isolate;\n}\n\n.butex-document2-widget__math-chip:hover,\n.butex-document2-widget__math-chip:focus-visible {\n background: color-mix(in srgb, var(--butex-document2-accent) 12%, var(--butex-document2-panel));\n border-color: var(--butex-document2-accent);\n}\n\n.butex-document2-widget__math-chip[data-editable=\"false\"] {\n border-style: dashed;\n color: var(--butex-document2-muted);\n}\n\n.butex-document2-widget__math-chip[data-display=\"true\"] {\n background: var(--butex-document2-math-display-bg);\n border-color: color-mix(in srgb, var(--butex-document2-accent) 50%, var(--butex-document2-border));\n border-width: 1.5px;\n border-radius: 10px;\n box-shadow: 0 5px 16px color-mix(in srgb, var(--butex-document2-fg) 8%, transparent);\n justify-content: center;\n margin-block: 4px;\n min-height: 54px;\n padding: 10px 12px;\n width: min(100%, 36rem);\n}\n\n.butex-document2-widget__preview {\n background: var(--butex-document2-preview-bg);\n color: var(--butex-document2-preview-fg);\n font-family: var(--butex-document2-preview-font);\n font-size: 1.08rem;\n line-height: 1.9;\n max-width: 100%;\n min-width: 0;\n overflow-wrap: break-word;\n text-align: start;\n word-break: break-word;\n}\n\n.butex-document2-widget__preview h1,\n.butex-document2-widget__preview h2,\n.butex-document2-widget__preview h3,\n.butex-document2-widget__preview p,\n.butex-document2-widget__preview li {\n max-width: 100%;\n overflow-wrap: break-word;\n white-space: normal;\n word-break: break-word;\n}\n\n.butex-document2-widget__preview h1 {\n font-size: 1.75rem;\n font-weight: 700;\n line-height: 1.35;\n margin: 0 0 14px;\n}\n\n.butex-document2-widget__preview h2 {\n font-size: 1.4rem;\n font-weight: 600;\n line-height: 1.4;\n margin: 0 0 12px;\n}\n\n.butex-document2-widget__preview h3 {\n font-size: 1.2rem;\n font-weight: 600;\n line-height: 1.45;\n margin: 0 0 10px;\n}\n\n.butex-document2-widget__preview p {\n margin: 0 0 12px;\n}\n\n.butex-document2-widget__preview ul,\n.butex-document2-widget__preview ol {\n margin: 0 0 12px;\n padding-inline-start: 24px;\n}\n\n.butex-document2-widget__preview ul {\n list-style-type: disc;\n}\n\n.butex-document2-widget__preview ol {\n list-style-type: decimal;\n}\n\n.butex-document2-widget__preview img {\n display: block;\n height: auto;\n max-width: 100%;\n}\n\n.butex-document2-widget__preview table {\n border-collapse: collapse;\n border: 1px solid #000000;\n margin: 12px 0;\n max-width: 100%;\n table-layout: fixed;\n width: 100%;\n}\n\n.butex-document2-widget__preview td {\n border: 1px solid #000000;\n max-width: 100%;\n overflow-wrap: break-word;\n padding: 6px 8px;\n white-space: normal;\n word-break: break-word;\n}\n\n.butex-document2-widget__math-island {\n direction: ltr;\n display: inline-block;\n line-height: normal;\n margin: 0 2px;\n overflow: visible;\n unicode-bidi: isolate;\n vertical-align: middle;\n}\n\n/* Guard against host CSS resets (e.g. Tailwind Preflight's `svg { display: block }`).\n * MathJax v4 inline line-breaking emits an equation as several sibling <svg> chunks;\n * a block-level svg reset stacks them vertically inside the island. */\n.butex-document2-widget mjx-container svg {\n display: inline;\n}\n\n.butex-document2-widget__math-chip .butex-document2-widget__math-island {\n margin: 0;\n}\n\n.butex-document2-widget__math-island[data-render-state=\"loading\"] {\n opacity: 0.72;\n}\n\n.butex-document2-widget__math-island[data-render-state=\"error\"] {\n color: var(--butex-document2-error);\n font-family: ui-monospace, SFMono-Regular, Consolas, monospace;\n font-size: 0.88rem;\n max-width: 100%;\n overflow-wrap: anywhere;\n white-space: normal;\n}\n\n.butex-document2-widget__math-island[data-display=\"true\"] {\n display: block;\n margin: 10px 0;\n text-align: center;\n}\n\n.butex-document2-widget__math-chip .butex-document2-widget__math-island[data-display=\"true\"] {\n margin: 0;\n}\n\n.butex-document2-widget__raw {\n background: var(--butex-document2-raw-bg);\n border-radius: 8px;\n direction: ltr;\n padding: 8px;\n text-align: left;\n white-space: pre-wrap;\n}\n\n.butex-document2-widget__error {\n background: var(--butex-document2-error-bg);\n border: 1px solid var(--butex-document2-error);\n border-radius: 8px;\n color: var(--butex-document2-error);\n padding: 10px;\n}\n\n.butex-document2-widget__equation-modal {\n align-items: center;\n display: flex;\n inset: 0;\n justify-content: center;\n padding: 16px;\n position: fixed;\n z-index: 30;\n}\n\n.butex-document2-widget__equation-modal-backdrop {\n background: color-mix(in srgb, var(--butex-document2-fg) 34%, transparent);\n border: 0;\n cursor: pointer;\n display: block;\n height: 100%;\n inset: 0;\n margin: 0;\n padding: 0;\n position: absolute;\n width: 100%;\n}\n\n.butex-document2-widget__equation-modal-panel {\n background: var(--butex-document2-drawer-bg);\n border: 1px solid var(--butex-document2-border);\n border-radius: 12px;\n box-shadow: 0 18px 48px color-mix(in srgb, var(--butex-document2-fg) 18%, transparent);\n display: grid;\n gap: 12px;\n max-height: min(90vh, 900px);\n max-width: min(720px, 100%);\n overflow: auto;\n padding: 14px;\n position: relative;\n width: min(680px, 100%);\n z-index: 1;\n}\n\n/* Map document v2 tokens onto BuTeX equation editor chrome when embedded in this modal. */\n.butex-document2-widget__equation-modal-panel .butex-widget {\n --butex-bg: var(--butex-document2-bg);\n --butex-fg: var(--butex-document2-fg);\n --butex-muted: var(--butex-document2-muted);\n --butex-accent: var(--butex-document2-accent);\n --butex-accent-hover: color-mix(in srgb, var(--butex-document2-accent) 82%, #000000);\n --butex-toolbar-hover-bg: var(--butex-document2-accent-bg);\n --butex-toolbar-hover-border: var(--butex-document2-accent);\n --butex-danger: var(--butex-document2-danger);\n --butex-danger-bg: color-mix(in srgb, var(--butex-document2-danger) 12%, transparent);\n --butex-danger-border: color-mix(in srgb, var(--butex-document2-danger) 48%, transparent);\n --butex-on-accent: #ffffff;\n --butex-border: var(--butex-document2-border);\n --butex-panel: var(--butex-document2-panel);\n --butex-preview-bg: var(--butex-document2-preview-bg);\n --butex-preview-fg: var(--butex-document2-preview-fg);\n --butex-error: var(--butex-document2-error);\n --butex-error-bg: var(--butex-document2-error-bg);\n --butex-error-border: color-mix(in srgb, var(--butex-document2-error) 32%, var(--butex-document2-panel));\n --butex-shadow-md: 0 4px 14px color-mix(in srgb, var(--butex-document2-fg) 10%, transparent);\n --butex-dev-bg: var(--butex-document2-dev-bg);\n --butex-dev-border: var(--butex-document2-dev-border);\n --butex-dev-badge: var(--butex-dev-badge, #b45309);\n --butex-dev-badge-fg: var(--butex-dev-badge-fg, #ffffff);\n --butex-dev-muted: var(--butex-dev-muted, #92400e);\n --butex-dev-inset-bg: var(--butex-document2-dev-code-bg);\n --butex-dev-inset-border: color-mix(in srgb, var(--butex-document2-dev-border) 45%, transparent);\n --butex-dev-inset-fg: var(--butex-document2-dev-code-fg);\n --butex-surface-bg: linear-gradient(\n 180deg,\n var(--butex-document2-panel) 0%,\n color-mix(in srgb, var(--butex-document2-panel) 88%, var(--butex-document2-bg)) 100%\n );\n --butex-surface-fg: var(--butex-document2-fg);\n --butex-focus-border: color-mix(in srgb, var(--butex-document2-accent) 45%, transparent);\n --butex-focus-shadow: var(--butex-document2-focus-shadow);\n --butex-slot-hover: var(--butex-document2-accent-bg);\n --butex-selection-bg: color-mix(in srgb, var(--butex-document2-accent) 34%, transparent);\n --butex-selection-border: color-mix(in srgb, var(--butex-document2-accent) 90%, #0f172a);\n --butex-caret: var(--butex-document2-fg);\n --butex-node-hover: color-mix(in srgb, var(--butex-document2-muted) 14%, transparent);\n --butex-node-selected-bg: var(--butex-document2-accent-bg);\n --butex-node-selected-border: color-mix(in srgb, var(--butex-document2-accent) 45%, transparent);\n --butex-script-border: var(--butex-document2-border);\n --butex-script-bg: color-mix(in srgb, var(--butex-document2-bg) 35%, var(--butex-document2-panel));\n --butex-script-color: var(--butex-document2-muted);\n --butex-delim-color: var(--butex-document2-muted);\n --butex-frac-bar: currentColor;\n}\n\n.butex-document2-widget__dev {\n background: var(--butex-document2-dev-bg);\n border-color: var(--butex-document2-dev-border);\n}\n\n.butex-document2-widget__dev pre {\n background: var(--butex-document2-dev-code-bg);\n color: var(--butex-document2-dev-code-fg);\n direction: ltr;\n margin: 0;\n max-height: 220px;\n overflow: auto;\n padding: 10px;\n text-align: left;\n white-space: pre-wrap;\n}\n\n.butex-document2-widget__dev-diagnostic {\n background: rgba(251, 191, 36, 0.18);\n border: 1px solid rgba(217, 119, 6, 0.4);\n border-radius: 8px;\n color: #92400e;\n margin: 0;\n padding: 8px 10px;\n}\n\n@media (max-width: 900px) {\n .butex-document2-widget__layout,\n .butex-document2-widget__layout--editor-open.butex-document2-widget__layout--preview-open,\n .butex-document2-widget__layout--editor-open.butex-document2-widget__layout--preview-closed,\n .butex-document2-widget__layout--editor-closed.butex-document2-widget__layout--preview-open,\n .butex-document2-widget__layout--editor-closed.butex-document2-widget__layout--preview-closed {\n grid-template-columns: minmax(0, 1fr);\n }\n}\n\n@media (prefers-reduced-motion: reduce) {\n .butex-document2-widget__layout,\n .butex-document2-widget__editor-panel,\n .butex-document2-widget__preview-panel {\n transition: none;\n }\n}\n\n.butex-document2-widget__cite-chip-wrap {\n align-items: center;\n display: inline-flex;\n gap: 2px;\n margin-inline: 2px;\n max-width: 100%;\n vertical-align: baseline;\n}\n\n.butex-document2-widget__cite-chip {\n background: color-mix(in srgb, var(--butex-document2-accent) 8%, var(--butex-document2-panel));\n border: 1.5px solid color-mix(in srgb, var(--butex-document2-accent) 45%, var(--butex-document2-border));\n border-radius: 6px;\n color: inherit;\n cursor: pointer;\n display: inline-flex;\n font: inherit;\n font-variant-numeric: tabular-nums;\n line-height: 1.3;\n min-height: 28px;\n padding: 2px 8px;\n}\n\n.butex-document2-widget__cite-chip[data-editable=\"false\"] {\n border-style: dashed;\n cursor: default;\n}\n\n.butex-document2-widget__cite-chip:hover,\n.butex-document2-widget__cite-chip:focus-visible {\n background: color-mix(in srgb, var(--butex-document2-accent) 14%, var(--butex-document2-panel));\n border-color: var(--butex-document2-accent);\n}\n\n.butex-document2-widget__cite-chip-delete {\n background: transparent;\n border: none;\n color: var(--butex-document2-muted);\n cursor: pointer;\n font: inherit;\n line-height: 1;\n padding: 0 4px;\n}\n\n.butex-document2-widget__preview-cite {\n color: inherit;\n font-variant-numeric: tabular-nums;\n white-space: nowrap;\n}\n\n.butex-document2-widget__preview-bibliography,\n.butex-document2-widget__bibliography-editor {\n display: grid;\n gap: 0.5rem;\n list-style: none;\n margin: 0;\n padding: 0;\n}\n\n.butex-document2-widget__preview-bibliography li,\n.butex-document2-widget__bibliography-editor li {\n display: grid;\n gap: 0.25rem;\n grid-template-columns: auto 1fr;\n}\n\n.butex-document2-widget__preview-bib-number {\n font-variant-numeric: tabular-nums;\n}\n\n.butex-document2-widget__block--bibliography {\n border-color: color-mix(in srgb, var(--butex-document2-accent) 35%, var(--butex-document2-border));\n}\n\n.butex-document2-widget__digit-form-menu {\n position: relative;\n}\n\n.butex-document2-widget__digit-form-options {\n background: var(--butex-document2-panel);\n border: 1px solid var(--butex-document2-border);\n border-radius: 8px;\n box-shadow: 0 8px 24px color-mix(in srgb, #000 16%, transparent);\n display: grid;\n gap: 2px;\n inset-inline-start: 0;\n margin-top: 4px;\n padding: 4px;\n position: absolute;\n top: 100%;\n z-index: 5;\n}\n\n.butex-document2-widget__digit-form-option {\n background: transparent;\n border: none;\n border-radius: 6px;\n color: inherit;\n cursor: pointer;\n font: inherit;\n padding: 6px 10px;\n text-align: start;\n}\n\n.butex-document2-widget__digit-form-option[aria-selected=\"true\"],\n.butex-document2-widget__digit-form-option:hover {\n background: color-mix(in srgb, var(--butex-document2-accent) 12%, var(--butex-document2-panel));\n}\n\n.butex-document2-widget__cite-picker-backdrop,\n.butex-document2-widget__refs-backdrop {\n align-items: center;\n background: color-mix(in srgb, #000 35%, transparent);\n display: flex;\n inset: 0;\n justify-content: center;\n padding: 1rem;\n position: fixed;\n z-index: 40;\n}\n\n.butex-document2-widget__cite-picker,\n.butex-document2-widget__refs-panel {\n background: var(--butex-document2-panel);\n border: 1px solid var(--butex-document2-border);\n border-radius: 12px;\n box-shadow: 0 16px 40px color-mix(in srgb, #000 22%, transparent);\n display: grid;\n gap: 0.75rem;\n max-height: min(80vh, 640px);\n max-width: 560px;\n overflow: auto;\n padding: 1rem;\n width: min(100%, 560px);\n}\n\n.butex-document2-widget__cite-picker-header,\n.butex-document2-widget__refs-header,\n.butex-document2-widget__cite-picker-footer,\n.butex-document2-widget__refs-item-head {\n align-items: center;\n display: flex;\n gap: 0.5rem;\n justify-content: space-between;\n}\n\n.butex-document2-widget__cite-picker-list,\n.butex-document2-widget__refs-list {\n display: grid;\n gap: 0.5rem;\n list-style: none;\n margin: 0;\n padding: 0;\n}\n\n.butex-document2-widget__cite-picker-item,\n.butex-document2-widget__refs-field {\n display: grid;\n gap: 0.25rem;\n}\n\n.butex-document2-widget__cite-picker-item {\n align-items: start;\n grid-template-columns: auto 1fr;\n}\n\n.butex-document2-widget__cite-picker-meta,\n.butex-document2-widget__cite-picker-empty {\n color: var(--butex-document2-muted);\n display: block;\n font-size: 0.92em;\n}\n\n.butex-document2-widget__refs-grid {\n display: grid;\n gap: 0.5rem;\n grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));\n}\n\n.butex-document2-widget__refs-field input {\n background: var(--butex-document2-input-bg, var(--butex-document2-panel));\n border: 1px solid var(--butex-document2-border);\n border-radius: 6px;\n color: inherit;\n font: inherit;\n padding: 0.4rem 0.55rem;\n width: 100%;\n}\n\n.butex-document2-widget__refs-item {\n border: 1px solid var(--butex-document2-border);\n border-radius: 10px;\n display: grid;\n gap: 0.5rem;\n padding: 0.75rem;\n}\n\n.butex-document2-widget__refs-item-actions {\n display: inline-flex;\n gap: 0.25rem;\n}\n\n.butex-document2-widget__primary-btn {\n background: var(--butex-document2-accent);\n border: none;\n border-radius: 8px;\n color: #fff;\n cursor: pointer;\n font: inherit;\n padding: 0.45rem 0.8rem;\n}\n\n.butex-document2-widget__primary-btn:disabled {\n cursor: not-allowed;\n opacity: 0.55;\n}\n";
|
|
388
465
|
declare function injectBuTeXDocument2Styles(doc?: Document): void;
|
|
389
466
|
|
|
390
467
|
export { ButexDocumentEditor2, type ButexDocumentEditor2Props, type ButexUiLocale, DOCUMENT2_WIDGET_CSS, type Document2InitialState, DocumentInsertToolbar, type DocumentInsertToolbarProps, DocumentPreview, EquationDrawer, InlineField, MathChip, MathIsland, injectBuTeXDocument2Styles, resolveInitialDocument2 };
|