@betteroffice/docx 0.0.1 → 0.0.2
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 +19 -0
- package/dist/chunk-AEQOEQJ7.mjs +57 -0
- package/dist/chunk-AZ52IWB6.mjs +16 -0
- package/dist/{chunk-SINEY6ZF.mjs → chunk-B4IR6YP4.mjs} +1 -1
- package/dist/chunk-IFT6DUJX.mjs +1 -0
- package/dist/{chunk-H3JCIGWK.mjs → chunk-NJHOPXZW.mjs} +1 -1
- package/dist/chunk-NTQM4EYN.mjs +1 -0
- package/dist/{chunk-KXNZFTTK.mjs → chunk-WBH3SXI6.mjs} +1 -1
- package/dist/collaboration/index.d.mts +64 -0
- package/dist/collaboration/index.mjs +1 -0
- package/dist/{content-sSHuWw49.d.mts → content-DLFHRQav.d.mts} +8 -8
- package/dist/core.d.mts +148 -341
- package/dist/core.mjs +1 -1
- package/dist/{displayListQueries-p-ijSzdh.d.mts → displayListQueries-UGc_XBUv.d.mts} +1 -1
- package/dist/docx/index.d.mts +40 -520
- package/dist/docx/index.mjs +2 -2
- package/dist/editor/index.d.mts +35 -151
- package/dist/editor/index.mjs +1 -1
- package/dist/{fontLoader-Bx6DK6-2.d.mts → fontLoader-aSewHMKF.d.mts} +65 -63
- package/dist/{formatting-DoL7KBSL.d.mts → formatting-D1EPSaJP.d.mts} +1 -1
- package/dist/generated/edit/docx_edit_bg.wasm +0 -0
- package/dist/generated/layout/docx_layout_bg.wasm +0 -0
- package/dist/generated/opc/ooxml_opc_bg.wasm +0 -0
- package/dist/generated/parse/docx_parse_bg.wasm +0 -0
- package/dist/index-Bwxm3oiC.d.mts +934 -0
- package/dist/layout/index.d.mts +18 -240
- package/dist/layout/index.mjs +1 -1
- package/dist/layout/pagination/index.d.mts +10 -58
- package/dist/layout/pagination/index.mjs +1 -1
- package/dist/layout/render/index.d.mts +10 -11
- package/dist/layout/render/index.mjs +1 -1
- package/dist/plugin-api/RenderedDomContext.d.mts +8 -9
- package/dist/plugin-api/index.d.mts +191 -6
- package/dist/plugin-api/resolveItemPositions.d.mts +4 -5
- package/dist/{rustDisplayList-dqunvwxH.d.mts → rustDisplayList-CX78djsZ.d.mts} +5 -5
- package/dist/rustMeasureSource-D1KsQvVC.d.mts +106 -0
- package/dist/selectiveSave-CVoajSKE.d.mts +56 -0
- package/dist/styles/index.d.mts +4 -39
- package/dist/styles/index.mjs +1 -1
- package/dist/{styles-VxNcXLdi.d.mts → styles-Dn_o3Vo5.d.mts} +2 -2
- package/dist/types/content.d.mts +2 -2
- package/dist/types/document.d.mts +40 -14
- package/dist/{types-DNrYr6yQ.d.mts → types-DMkDbvEu.d.mts} +3 -71
- package/dist/utils/comments.d.mts +2 -2
- package/dist/utils/index.d.mts +110 -576
- package/dist/utils/index.mjs +1 -84
- package/dist/utils/stylePreview.d.mts +2 -2
- package/dist/utils/units.d.mts +33 -2
- package/dist/wasm-BGQBTR2J.mjs +1 -0
- package/dist/wasm-edit.d.mts +13 -5
- package/dist/wasm-edit.mjs +1 -1
- package/dist/wasm-opc.mjs +1 -1
- package/dist/wasm-parse.mjs +1 -1
- package/dist/yrs/index.d.mts +5 -881
- package/dist/yrs/index.mjs +1 -1
- package/dist/yrs/residentEngineWorker.mjs +1 -1
- package/package.json +16 -139
- package/dist/Subscribable-DOz6Ohoo.d.mts +0 -33
- package/dist/agent/index.d.mts +0 -531
- package/dist/agent/index.mjs +0 -1
- package/dist/chunk-34K66SY4.mjs +0 -1
- package/dist/chunk-4RCISPPE.mjs +0 -1
- package/dist/chunk-52GB3Y42.mjs +0 -1
- package/dist/chunk-6PW4CWUG.mjs +0 -1
- package/dist/chunk-7DEIW7FL.mjs +0 -1
- package/dist/chunk-7PCO5I2O.mjs +0 -1
- package/dist/chunk-BI3B33LI.mjs +0 -1
- package/dist/chunk-BIQWVK5P.mjs +0 -2
- package/dist/chunk-DXKG3HQ5.mjs +0 -16
- package/dist/chunk-FPZBTOD6.mjs +0 -1
- package/dist/chunk-FZIA7OFY.mjs +0 -1
- package/dist/chunk-GWKJ2Y4Y.mjs +0 -1
- package/dist/chunk-HJGAQIU7.mjs +0 -2
- package/dist/chunk-I6KKMUUC.mjs +0 -1
- package/dist/chunk-IL5JZJT7.mjs +0 -1
- package/dist/chunk-JY6ILTNS.mjs +0 -1
- package/dist/chunk-KEE52TT5.mjs +0 -1
- package/dist/chunk-KVKLLTDP.mjs +0 -58
- package/dist/chunk-L5ISVQ3W.mjs +0 -1
- package/dist/chunk-LDUWIM7M.mjs +0 -1
- package/dist/chunk-N5Q3YN64.mjs +0 -1
- package/dist/chunk-NEWOMDTX.mjs +0 -1
- package/dist/chunk-O2QSE2I7.mjs +0 -1
- package/dist/chunk-OJOHXQNQ.mjs +0 -1
- package/dist/chunk-OMR3TWCD.mjs +0 -2
- package/dist/chunk-P3KDV4M2.mjs +0 -1
- package/dist/chunk-Q7PO7V73.mjs +0 -1
- package/dist/chunk-QOUFE3VX.mjs +0 -1
- package/dist/chunk-TYHI7RAD.mjs +0 -1
- package/dist/chunk-UIEJWORW.mjs +0 -1
- package/dist/chunk-VAOUFAUH.mjs +0 -1
- package/dist/chunk-VBOTMRXV.mjs +0 -1
- package/dist/chunk-VCER63GQ.mjs +0 -1
- package/dist/chunk-WAUF2UC7.mjs +0 -2
- package/dist/chunk-X4XDO3LZ.mjs +0 -1
- package/dist/chunk-XQBCCJBO.mjs +0 -9
- package/dist/chunk-XWUOLYRQ.mjs +0 -2
- package/dist/chunk-XYH6XWP3.mjs +0 -10
- package/dist/chunk-YBIM6UJV.mjs +0 -8
- package/dist/chunk-YCIH2Q3E.mjs +0 -1
- package/dist/chunk-ZOV5KL7C.mjs +0 -1
- package/dist/colorResolver-n0o7H7ep.d.mts +0 -290
- package/dist/core-plugins.d.mts +0 -37
- package/dist/core-plugins.mjs +0 -1
- package/dist/docx/parser.d.mts +0 -41
- package/dist/docx/parser.mjs +0 -1
- package/dist/docx/rezip.d.mts +0 -148
- package/dist/docx/rezip.mjs +0 -1
- package/dist/docx/serializer/index.d.mts +0 -42
- package/dist/docx/serializer/index.mjs +0 -1
- package/dist/editorTree-DO5PyDK8.d.mts +0 -37
- package/dist/executor-7O2RBJ2B.mjs +0 -1
- package/dist/headerFooterLayout-0zPT64Qc.d.mts +0 -316
- package/dist/headless.d.mts +0 -69
- package/dist/headless.mjs +0 -1
- package/dist/layout/flow/index.d.mts +0 -149
- package/dist/layout/flow/index.mjs +0 -1
- package/dist/layout/measure/index.d.mts +0 -324
- package/dist/layout/measure/index.mjs +0 -1
- package/dist/layout/pagination/types.d.mts +0 -4
- package/dist/layout/pagination/types.mjs +0 -1
- package/dist/managers/AutoSaveManager.d.mts +0 -81
- package/dist/managers/AutoSaveManager.mjs +0 -1
- package/dist/managers/TableSelectionManager.d.mts +0 -74
- package/dist/managers/TableSelectionManager.mjs +0 -1
- package/dist/managers/types.d.mts +0 -113
- package/dist/managers/types.mjs +0 -0
- package/dist/mcp-cli.mjs +0 -142
- package/dist/mcp.d.mts +0 -162
- package/dist/mcp.mjs +0 -16
- package/dist/measureBlocksPipeline-Df0Bbrwy.d.mts +0 -109
- package/dist/measuredBlock-DZwz8zhD.d.mts +0 -26
- package/dist/plugin-api/types.d.mts +0 -193
- package/dist/plugin-api/types.mjs +0 -0
- package/dist/processTemplate-HDUIZFJ5.mjs +0 -1
- package/dist/registry-DMM5VTdT.d.mts +0 -165
- package/dist/rustPagination-Bj2hq013.d.mts +0 -106
- package/dist/sectionConfigs-DW3J8q0X.d.mts +0 -55
- package/dist/selectionContext-Buc9BCU1.d.mts +0 -570
- package/dist/selectiveSave-oFBJ1n71.d.mts +0 -16
- package/dist/selectiveXmlPatch-ypkxlTD_.d.mts +0 -23
- package/dist/settingsParser-CcGvtmCK.d.mts +0 -33
- package/dist/types/agentApi.d.mts +0 -456
- package/dist/types/agentApi.mjs +0 -1
- package/dist/types-dYdjUZMo.d.mts +0 -311
- package/dist/units-O5Y02RKQ.d.mts +0 -34
- package/dist/utils/headingCollector.d.mts +0 -28
- package/dist/utils/headingCollector.mjs +0 -1
- package/dist/utils/highlightColors.d.mts +0 -14
- package/dist/utils/highlightColors.mjs +0 -1
- package/dist/utils/textSelection.d.mts +0 -92
- package/dist/utils/textSelection.mjs +0 -1
- package/dist/variableDetector-Borj29SF.d.mts +0 -115
- package/dist/wasm-FZQ5XB2Y.mjs +0 -1
- package/dist/watermarkApi-DCxjutkg.d.mts +0 -38
package/dist/core.d.mts
CHANGED
|
@@ -1,66 +1,34 @@
|
|
|
1
|
-
export { parseDocx } from './
|
|
2
|
-
export { serializeDocumentBody, serializeDocument as serializeDocx, serializeSectionProperties } from './docx/serializer/index.mjs';
|
|
3
|
-
export { createDocx, default as repackDocx, updateMultipleFiles } from './docx/rezip.mjs';
|
|
4
|
-
export { a as attemptSelectiveSave } from './selectiveSave-oFBJ1n71.mjs';
|
|
5
|
-
export { b as buildPatchedDocumentXml, v as validatePatchSafety } from './selectiveXmlPatch-ypkxlTD_.mjs';
|
|
6
|
-
export { C as CreateEmptyDocumentOptions, P as ProcessTemplateOptions, a as ProcessTemplateResult, c as colorsEqual, b as createDocumentWithText, d as createEmptyDocument, e as createRgbColor, g as createThemeColor, t as ensureHexPrefix, i as getTemplateTags, j as isBlack, k as isWhite, p as parseColorString, m as processTemplate, o as processTemplateAsBlob, q as processTemplateDetailed, r as resolveHighlightColor, u as resolveHighlightToCss, s as resolveShadingColor, v as validateTemplate } from './colorResolver-n0o7H7ep.mjs';
|
|
7
|
-
export { A as AgentContextOptions, D as DocumentAgent, E as ExtendedSelectionContext, e as SelectionContextOptions, f as buildExtendedSelectionContext, g as buildSelectionContext, k as executeCommand, l as executeCommands, m as getAgentContext, n as getDocumentSummary } from './selectionContext-Buc9BCU1.mjs';
|
|
8
|
-
export { emuToTwips, formatPx, halfPointsToPixels, pixelsToTwips, twipsToEmu, twipsToPixels } from './utils/units.mjs';
|
|
9
|
-
export { I as InsertPosition, c as canRenderFont, a as countPageBreaks, b as createColumnBreak, d as createHorizontalRule, e as createLineBreak, f as createPageBreak, g as createPageBreakParagraph, h as createPageBreakRun, i as findPageBreaks, j as getLoadedFonts, k as hasPageBreakBefore, l as insertHorizontalRule, m as insertPageBreak, n as isBreakContent, o as isColumnBreak, p as isFontLoaded, q as isFontsLoading, r as isGoogleFontsEnabled, s as isLineBreak, t as isPageBreak, u as loadFont, v as loadFontFromBuffer, w as loadFonts, x as onFontsLoaded, y as preloadCommonFonts, z as removePageBreak, A as setGoogleFontsEnabled } from './fontLoader-Bx6DK6-2.mjs';
|
|
10
|
-
export { D as DocxInput, t as toArrayBuffer } from './docxInput-DTbCa48g.mjs';
|
|
11
|
-
export { V as VariableDetectionResult, a as VariableOccurrence, d as detectVariables, b as detectVariablesDetailed, c as detectVariablesInBody, e as detectVariablesInParagraph, f as documentHasVariables, g as extractVariablesFromText, h as formatVariable, i as hasTemplateVariables, j as isValidVariableName, p as parseVariable, r as removeVariables, k as replaceVariables, s as sanitizeVariableName } from './variableDetector-Borj29SF.mjs';
|
|
1
|
+
export { a as attemptSelectiveSave, c as createDocx, p as parseDocx, r as repackDocx, u as updateMultipleFiles } from './selectiveSave-CVoajSKE.mjs';
|
|
12
2
|
import { Document } from './types/document.mjs';
|
|
13
3
|
export { DocxPackage } from './types/document.mjs';
|
|
14
|
-
|
|
15
|
-
export {
|
|
16
|
-
export {
|
|
17
|
-
export {
|
|
18
|
-
export {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
export {
|
|
22
|
-
export {
|
|
23
|
-
export { TABLE_DATA_ATTRIBUTES, TableSelectionManager, deleteTableFromDocument, findTableFromClick, getTableFromDocument, updateTableInDocument } from './managers/TableSelectionManager.mjs';
|
|
24
|
-
import { R as Run } from './content-sSHuWw49.mjs';
|
|
25
|
-
export { B as BlockContent, q as BookmarkEnd, r as BookmarkStart, C as Comment, a as CommentRangeEnd, b as CommentRangeStart, D as Deletion, c as DocumentBody, E as Endnote, a1 as Field, a6 as FooterReference, F as Footnote, m as HeaderFooter, aa as HeaderReference, H as Hyperlink, I as Image, d as Insertion, L as ListLevel, M as MoveFrom, e as MoveTo, N as NumberingDefinitions, P as Paragraph, f as ParagraphContent, g as RunContent, S as SectionProperties, aU as Shape, T as Table, h as TableCell, i as TableRow, bc as TextBox, j as TextContent, k as TrackedChangeInfo, l as TrackedRunChange } from './content-sSHuWw49.mjs';
|
|
26
|
-
export { B as BlockExtent, F as FootnoteContent, a as Layout, e as LayoutBlock, g as Page, a7 as ResolvedLine, a8 as ResolvedSegment } from './types-DNrYr6yQ.mjs';
|
|
27
|
-
export { P as ParagraphFormatting, T as TextFormatting, a as Theme, y as ThemeColorScheme, A as ThemeFont, D as ThemeFontScheme, G as ThemeMatrixCell, b as blendColors, d as darkenColor, H as generateThemeTintShadeMatrix, g as getContrastingColor, I as getThemeTintShadeHex, l as lightenColor, r as resolveColor } from './formatting-DoL7KBSL.mjs';
|
|
28
|
-
export { e as emuToPixels, p as pixelsToEmu, a as pointsToPixels } from './units-O5Y02RKQ.mjs';
|
|
29
|
-
export { C as ConvertFootnoteOptions, a as ConvertHeaderFooterOptions, b as FOOTNOTE_SEPARATOR_HEIGHT, c as FootnoteRefLocation, H as HeaderFooterMetrics, M as MAX_FOOTNOTE_LAYOUT_PASSES, d as MeasureBlocksFn, S as StabilizeFootnoteLayoutArgs, e as StabilizeFootnoteLayoutResult, g as buildFootnoteContentMap, h as buildFootnoteRenderItems, i as calculateFootnoteReservedHeights, k as collectFootnoteRefs, p as convertHeaderFooterToContent, r as footnoteReservedHeightsEqual, s as mapFootnotesToPages, v as stabilizeFootnoteLayout } from './headerFooterLayout-0zPT64Qc.mjs';
|
|
30
|
-
export { R as Relationship, S as Style, a as StyleDefinitions } from './styles-VxNcXLdi.mjs';
|
|
4
|
+
import { h as DocumentBody, S as SectionProperties, b5 as Table } from './content-DLFHRQav.mjs';
|
|
5
|
+
export { B as BlockContent, n as BookmarkEnd, o as BookmarkStart, g as Comment, I as CommentRangeEnd, J as CommentRangeStart, Q as Deletion, k as Endnote, X as Field, a0 as FooterReference, j as Footnote, H as HeaderFooter, a3 as HeaderReference, a4 as Hyperlink, a6 as Image, ai as Insertion, am as ListLevel, ap as MoveFrom, as as MoveTo, i as NumberingDefinitions, f as Paragraph, aE as ParagraphContent, aI as Run, aJ as RunContent, aT as Shape, b6 as TableCell, b9 as TableRow, bc as TextBox, bd as TextContent, bf as TrackedChangeInfo, bg as TrackedRunChange } from './content-DLFHRQav.mjs';
|
|
6
|
+
export { emuToPixels, emuToTwips, formatPx, halfPointsToPixels, pixelsToEmu, pixelsToTwips, pointsToPixels, twipsToEmu, twipsToPixels } from './utils/units.mjs';
|
|
7
|
+
export { c as canRenderFont, a as colorsEqual, b as createRgbColor, d as createThemeColor, e as ensureHexPrefix, g as getLoadedFonts, i as isBlack, f as isFontLoaded, h as isFontsLoading, j as isGoogleFontsEnabled, k as isWhite, l as loadFont, m as loadFontFromBuffer, n as loadFonts, o as onFontsLoaded, p as parseColorString, q as preloadCommonFonts, r as resolveHighlightColor, s as resolveHighlightToCss, t as resolveShadingColor, u as setGoogleFontsEnabled } from './fontLoader-aSewHMKF.mjs';
|
|
8
|
+
export { D as DocxInput, t as toArrayBuffer } from './docxInput-DTbCa48g.mjs';
|
|
9
|
+
export { EditorPluginCore, PanelConfig, PluginPanelProps, PositionCoordinates, RenderedDomContext } from './plugin-api/index.mjs';
|
|
10
|
+
export { B as BlockExtent, F as FootnoteContent, a as Layout, L as LayoutBlock, P as Page, R as ResolvedLine, c as ResolvedSegment } from './types-DMkDbvEu.mjs';
|
|
11
|
+
export { P as ParagraphFormatting, a as TextFormatting, e as Theme, u as ThemeColorScheme, v as ThemeFont, w as ThemeFontScheme, x as ThemeMatrixCell, y as blendColors, z as darkenColor, A as generateThemeTintShadeMatrix, D as getContrastingColor, G as getThemeTintShadeHex, H as lightenColor, I as resolveColor } from './formatting-D1EPSaJP.mjs';
|
|
12
|
+
export { d as Relationship, a as Style, S as StyleDefinitions } from './styles-Dn_o3Vo5.mjs';
|
|
31
13
|
import './docx/wrapTypes.mjs';
|
|
32
|
-
import './settingsParser-CcGvtmCK.mjs';
|
|
33
|
-
import './measuredBlock-DZwz8zhD.mjs';
|
|
34
|
-
import './displayListQueries-p-ijSzdh.mjs';
|
|
35
|
-
import './rustDisplayList-dqunvwxH.mjs';
|
|
36
14
|
|
|
37
15
|
/**
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
readonly isTextblock: boolean;
|
|
46
|
-
readonly nodeSize: number;
|
|
47
|
-
descendants(callback: (node: ParagraphPositionNode, pos: number) => boolean | void): void;
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Position immediately before the first textblock whose `paraId` attribute
|
|
51
|
-
* equals `paraId`.
|
|
52
|
-
* @public
|
|
53
|
-
*/
|
|
54
|
-
declare function findStartPosForParaId(doc: ParagraphPositionNode, paraId: string): number | null;
|
|
55
|
-
/**
|
|
56
|
-
* Position range for the textblock whose `paraId` attribute equals `paraId`.
|
|
16
|
+
* DOCX XML serializers.
|
|
17
|
+
*
|
|
18
|
+
* The public synchronous serializer surface is retained for compatibility, but
|
|
19
|
+
* all OOXML emission is owned by the Rust writer. The fixed context only
|
|
20
|
+
* supplies deterministic IDs to standalone XML calls; package saves use the
|
|
21
|
+
* source-package hash and clock through {@link ../rustSaveFacade}.
|
|
22
|
+
* @packageDocumentation
|
|
57
23
|
* @public
|
|
58
24
|
*/
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
25
|
+
|
|
26
|
+
/** Serialize a complete `word/document.xml` part. */
|
|
27
|
+
declare function serializeDocument(doc: Document): string;
|
|
28
|
+
/** Serialize the contents of `w:body`, without the body tags. */
|
|
29
|
+
declare function serializeDocumentBody(body: DocumentBody): string;
|
|
30
|
+
/** Serialize section properties. */
|
|
31
|
+
declare function serializeSectionProperties(props: SectionProperties | undefined): string;
|
|
64
32
|
|
|
65
33
|
/**
|
|
66
34
|
* Framework-agnostic print helpers shared by the React and Vue
|
|
@@ -109,43 +77,134 @@ declare function formatPageRange(range: {
|
|
|
109
77
|
declare function isPrintSupported(): boolean;
|
|
110
78
|
|
|
111
79
|
/**
|
|
112
|
-
*
|
|
80
|
+
* Subscribable Base Class
|
|
113
81
|
*
|
|
114
|
-
* Framework-agnostic
|
|
115
|
-
*
|
|
82
|
+
* Framework-agnostic base for manager classes that need to notify
|
|
83
|
+
* UI frameworks of state changes.
|
|
116
84
|
*
|
|
117
|
-
*
|
|
118
|
-
* -
|
|
119
|
-
* -
|
|
120
|
-
* - Clipboard read/write operations
|
|
85
|
+
* Compatible with:
|
|
86
|
+
* - React: useSyncExternalStore(manager.subscribe, manager.getSnapshot)
|
|
87
|
+
* - Vue: watchEffect(() => { manager.subscribe(triggerRef) })
|
|
121
88
|
*/
|
|
89
|
+
declare abstract class Subscribable<TSnapshot> {
|
|
90
|
+
private listeners;
|
|
91
|
+
private snapshot;
|
|
92
|
+
constructor(initialSnapshot: TSnapshot);
|
|
93
|
+
/**
|
|
94
|
+
* Subscribe to state changes. Returns an unsubscribe function.
|
|
95
|
+
* Bound method — safe to pass as `useSyncExternalStore(manager.subscribe, ...)`.
|
|
96
|
+
*/
|
|
97
|
+
subscribe: (listener: () => void) => (() => void);
|
|
98
|
+
/**
|
|
99
|
+
* Get the current snapshot. Returns a stable reference unless state has changed.
|
|
100
|
+
* Bound method — safe to pass as `useSyncExternalStore(..., manager.getSnapshot)`.
|
|
101
|
+
*/
|
|
102
|
+
getSnapshot: () => TSnapshot;
|
|
103
|
+
/**
|
|
104
|
+
* Update the snapshot and notify all subscribers.
|
|
105
|
+
* Subclasses should call this whenever their state changes.
|
|
106
|
+
*/
|
|
107
|
+
protected setSnapshot(snapshot: TSnapshot): void;
|
|
108
|
+
private notify;
|
|
109
|
+
}
|
|
122
110
|
|
|
123
|
-
/**
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
111
|
+
/**
|
|
112
|
+
* Manager Types
|
|
113
|
+
*
|
|
114
|
+
* Framework-agnostic interfaces for the editor's manager classes.
|
|
115
|
+
* @packageDocumentation
|
|
116
|
+
* @public
|
|
117
|
+
*/
|
|
118
|
+
/** Cell coordinates in a table */
|
|
119
|
+
interface CellCoordinates {
|
|
120
|
+
tableIndex: number;
|
|
121
|
+
rowIndex: number;
|
|
122
|
+
columnIndex: number;
|
|
123
|
+
}
|
|
124
|
+
/** TableSelectionManager snapshot */
|
|
125
|
+
interface TableSelectionSnapshot {
|
|
126
|
+
/** Currently selected cell, or null if no selection */
|
|
127
|
+
selectedCell: CellCoordinates | null;
|
|
128
|
+
}
|
|
129
|
+
/** Error severity levels */
|
|
130
|
+
type ErrorSeverity = 'error' | 'warning' | 'info';
|
|
131
|
+
/** Error notification */
|
|
132
|
+
interface ErrorNotification {
|
|
133
|
+
id: string;
|
|
134
|
+
message: string;
|
|
135
|
+
severity: ErrorSeverity;
|
|
136
|
+
details?: string;
|
|
137
|
+
timestamp: number;
|
|
138
|
+
dismissed?: boolean;
|
|
139
|
+
}
|
|
140
|
+
/** ErrorManager snapshot */
|
|
141
|
+
interface ErrorManagerSnapshot {
|
|
142
|
+
notifications: ErrorNotification[];
|
|
134
143
|
}
|
|
144
|
+
|
|
135
145
|
/**
|
|
136
|
-
*
|
|
146
|
+
* TableSelectionManager
|
|
147
|
+
*
|
|
148
|
+
* Framework-agnostic class for managing table cell selection state.
|
|
149
|
+
* Extracted from the React `useTableSelection` hook.
|
|
137
150
|
*
|
|
138
|
-
*
|
|
139
|
-
*
|
|
151
|
+
* Handles:
|
|
152
|
+
* - Cell selection via data-attribute queries on the DOM
|
|
153
|
+
* - Table document operations (add/delete rows/columns, merge/split)
|
|
154
|
+
*
|
|
155
|
+
* @remarks
|
|
156
|
+
* Tagged `@internal` post-1.0 cut. Adapters bind to this class today,
|
|
157
|
+
* but consumers should reach for `useTableSelection()` (React/Vue) instead
|
|
158
|
+
* of this raw subpath. The subpath stays in `package.json` `exports` for
|
|
159
|
+
* back-compat; expect it to move behind a public surface in a future major.
|
|
160
|
+
*
|
|
161
|
+
* @packageDocumentation
|
|
162
|
+
* @internal
|
|
140
163
|
*/
|
|
141
|
-
|
|
142
|
-
/**
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* Data attributes for table elements in the rendered DOM
|
|
167
|
+
* @internal
|
|
168
|
+
*/
|
|
169
|
+
declare const TABLE_DATA_ATTRIBUTES: {
|
|
170
|
+
readonly TABLE_INDEX: "data-table-index";
|
|
171
|
+
readonly ROW_INDEX: "data-row";
|
|
172
|
+
readonly COLUMN_INDEX: "data-col";
|
|
173
|
+
readonly TABLE_CELL: "data-table-cell";
|
|
174
|
+
};
|
|
175
|
+
/**
|
|
176
|
+
* Find table cell coordinates from a click target by walking up the DOM
|
|
177
|
+
* and reading data attributes.
|
|
178
|
+
* @internal
|
|
179
|
+
*/
|
|
180
|
+
declare function findTableFromClick(target: EventTarget | null, container?: HTMLElement | null): CellCoordinates | null;
|
|
181
|
+
/**
|
|
182
|
+
* Get a table from the document by index.
|
|
183
|
+
* @internal
|
|
184
|
+
*/
|
|
185
|
+
declare function getTableFromDocument(doc: Document, tableIndex: number): Table | null;
|
|
186
|
+
/**
|
|
187
|
+
* Update a table in the document immutably.
|
|
188
|
+
* @internal
|
|
189
|
+
*/
|
|
190
|
+
declare function updateTableInDocument(doc: Document, tableIndex: number, newTable: Table): Document;
|
|
191
|
+
/**
|
|
192
|
+
* Delete a table from the document immutably.
|
|
193
|
+
* @internal
|
|
194
|
+
*/
|
|
195
|
+
declare function deleteTableFromDocument(doc: Document, tableIndex: number): Document;
|
|
196
|
+
/** @internal */
|
|
197
|
+
declare class TableSelectionManager extends Subscribable<TableSelectionSnapshot> {
|
|
198
|
+
constructor();
|
|
199
|
+
/** Select a specific cell. */
|
|
200
|
+
selectCell(coords: CellCoordinates): void;
|
|
201
|
+
/** Clear the current selection. */
|
|
202
|
+
clearSelection(): void;
|
|
203
|
+
/** Check if a specific cell is selected. */
|
|
204
|
+
isCellSelected(tableIndex: number, rowIndex: number, columnIndex: number): boolean;
|
|
205
|
+
/** Get the currently selected cell coordinates, or null. */
|
|
206
|
+
getSelectedCell(): CellCoordinates | null;
|
|
207
|
+
}
|
|
149
208
|
|
|
150
209
|
/**
|
|
151
210
|
* ErrorManager
|
|
@@ -180,264 +239,12 @@ declare class ErrorManager extends Subscribable<ErrorManagerSnapshot> {
|
|
|
180
239
|
private emitSnapshot;
|
|
181
240
|
}
|
|
182
241
|
|
|
183
|
-
/**
|
|
184
|
-
* PluginLifecycleManager
|
|
185
|
-
*
|
|
186
|
-
* Framework-agnostic class for managing editor plugin lifecycle.
|
|
187
|
-
* Extracted from React's `PluginHost.tsx`.
|
|
188
|
-
*
|
|
189
|
-
* Handles:
|
|
190
|
-
* - Plugin initialization and state tracking
|
|
191
|
-
* - Plugin state updates via `updateStates()`
|
|
192
|
-
* - Plugin destroy/cleanup
|
|
193
|
-
*
|
|
194
|
-
* Does NOT handle (framework hosts are responsible for):
|
|
195
|
-
* - CSS injection (use the exported `injectStyles` utility)
|
|
196
|
-
* - DOM event listeners / dispatch wrapping
|
|
197
|
-
*/
|
|
198
|
-
|
|
199
|
-
/** Inject CSS styles into the document head. Returns a cleanup function. */
|
|
200
|
-
declare function injectStyles(pluginId: string, css: string): () => void;
|
|
201
|
-
declare class PluginLifecycleManager extends Subscribable<PluginLifecycleSnapshot> {
|
|
202
|
-
private plugins;
|
|
203
|
-
private pluginStates;
|
|
204
|
-
private version;
|
|
205
|
-
constructor();
|
|
206
|
-
/**
|
|
207
|
-
* Initialize plugins with the adapter's current editor state.
|
|
208
|
-
* Calls `plugin.initialize(editorState)` for each plugin.
|
|
209
|
-
*
|
|
210
|
-
* Note: CSS injection and DOM event listeners are the responsibility
|
|
211
|
-
* of the framework-specific host (e.g. React PluginHost).
|
|
212
|
-
*/
|
|
213
|
-
initialize(plugins: PluginLifecycleConfig[], editorState: unknown): void;
|
|
214
|
-
/**
|
|
215
|
-
* Update all plugin states by calling `onStateChange` on each plugin.
|
|
216
|
-
* Returns true if any plugin state changed.
|
|
217
|
-
*/
|
|
218
|
-
updateStates(editorState: unknown): boolean;
|
|
219
|
-
/** Get plugin state by ID. */
|
|
220
|
-
getPluginState<T>(pluginId: string): T | undefined;
|
|
221
|
-
/** Set plugin state by ID. */
|
|
222
|
-
setPluginState<T>(pluginId: string, state: T): void;
|
|
223
|
-
/** Destroy all plugins and clean up. */
|
|
224
|
-
destroy(): void;
|
|
225
|
-
private destroyPlugins;
|
|
226
|
-
private emitSnapshot;
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
/**
|
|
230
|
-
* LayoutCoordinator
|
|
231
|
-
*
|
|
232
|
-
* Framework-agnostic class coordinating the PM state → layout engine →
|
|
233
|
-
* layout painter → selection overlay pipeline.
|
|
234
|
-
*
|
|
235
|
-
* Extracted from PagedEditor.tsx. Manages:
|
|
236
|
-
* - Layout pipeline state (blocks, measures, layout)
|
|
237
|
-
* - Selection state (selectionRects, caretPosition)
|
|
238
|
-
* - Drag selection state
|
|
239
|
-
* - Column resize state
|
|
240
|
-
* - Image interaction state
|
|
241
|
-
*
|
|
242
|
-
* Usage with React:
|
|
243
|
-
* ```ts
|
|
244
|
-
* const snapshot = useSyncExternalStore(coordinator.subscribe, coordinator.getSnapshot);
|
|
245
|
-
* ```
|
|
246
|
-
*
|
|
247
|
-
* NOTE: This class defines the state shape and subscription pattern.
|
|
248
|
-
* Full integration with PagedEditor is done incrementally.
|
|
249
|
-
*/
|
|
250
|
-
|
|
251
|
-
/** Selection rectangle for rendering selection overlays */
|
|
252
|
-
interface SelectionRect {
|
|
253
|
-
x: number;
|
|
254
|
-
y: number;
|
|
255
|
-
width: number;
|
|
256
|
-
height: number;
|
|
257
|
-
pageIndex: number;
|
|
258
|
-
}
|
|
259
|
-
/** Caret position for rendering the blinking cursor */
|
|
260
|
-
interface CaretPosition {
|
|
261
|
-
x: number;
|
|
262
|
-
y: number;
|
|
263
|
-
height: number;
|
|
264
|
-
pageIndex: number;
|
|
265
|
-
}
|
|
266
|
-
/** Info about the currently selected/hovered image */
|
|
267
|
-
interface ImageSelectionInfo {
|
|
268
|
-
pmPos: number;
|
|
269
|
-
pageIndex: number;
|
|
270
|
-
rect: {
|
|
271
|
-
x: number;
|
|
272
|
-
y: number;
|
|
273
|
-
width: number;
|
|
274
|
-
height: number;
|
|
275
|
-
};
|
|
276
|
-
widthEmu: number;
|
|
277
|
-
heightEmu: number;
|
|
278
|
-
isInline: boolean;
|
|
279
|
-
}
|
|
280
|
-
/** Column resize tracking state */
|
|
281
|
-
interface ColumnResizeState {
|
|
282
|
-
isResizing: boolean;
|
|
283
|
-
startX: number;
|
|
284
|
-
columnIndex: number;
|
|
285
|
-
tablePmStart: number;
|
|
286
|
-
originalWidths: {
|
|
287
|
-
left: number;
|
|
288
|
-
right: number;
|
|
289
|
-
};
|
|
290
|
-
}
|
|
291
|
-
/** The full snapshot exposed to UI frameworks */
|
|
292
|
-
interface LayoutCoordinatorSnapshot {
|
|
293
|
-
/** Computed page layout, null until first computation */
|
|
294
|
-
hasLayout: boolean;
|
|
295
|
-
/** Selection rectangles for range selection overlay */
|
|
296
|
-
selectionRects: SelectionRect[];
|
|
297
|
-
/** Caret position for cursor overlay */
|
|
298
|
-
caretPosition: CaretPosition | null;
|
|
299
|
-
/** Currently selected/hovered image */
|
|
300
|
-
selectedImageInfo: ImageSelectionInfo | null;
|
|
301
|
-
/** Whether the editor is focused */
|
|
302
|
-
isFocused: boolean;
|
|
303
|
-
/** Whether a text drag is in progress */
|
|
304
|
-
isDragging: boolean;
|
|
305
|
-
/** Whether a column resize is in progress */
|
|
306
|
-
isResizingColumn: boolean;
|
|
307
|
-
/** Whether an image interaction is in progress */
|
|
308
|
-
isImageInteracting: boolean;
|
|
309
|
-
/** Version counter — incremented on every state change */
|
|
310
|
-
version: number;
|
|
311
|
-
}
|
|
312
|
-
declare class LayoutCoordinator extends Subscribable<LayoutCoordinatorSnapshot> {
|
|
313
|
-
private _hasLayout;
|
|
314
|
-
private _selectionRects;
|
|
315
|
-
private _caretPosition;
|
|
316
|
-
private _isDragging;
|
|
317
|
-
private _dragAnchor;
|
|
318
|
-
private _columnResize;
|
|
319
|
-
private _selectedImageInfo;
|
|
320
|
-
private _isImageInteracting;
|
|
321
|
-
private _isFocused;
|
|
322
|
-
private _version;
|
|
323
|
-
constructor();
|
|
324
|
-
/** Notify that layout has been computed. */
|
|
325
|
-
setLayoutReady(hasLayout: boolean): void;
|
|
326
|
-
/** Update selection rectangles and caret position. */
|
|
327
|
-
updateSelection(selectionRects: SelectionRect[], caretPosition: CaretPosition | null): void;
|
|
328
|
-
/** Start a drag selection from the given PM anchor position. */
|
|
329
|
-
startDrag(anchor: number): void;
|
|
330
|
-
/** End drag selection. */
|
|
331
|
-
endDrag(): void;
|
|
332
|
-
/** Get the drag anchor position. */
|
|
333
|
-
getDragAnchor(): number | null;
|
|
334
|
-
/** Start resizing a table column. */
|
|
335
|
-
startColumnResize(tablePmStart: number, columnIndex: number, startX: number, originalWidths: {
|
|
336
|
-
left: number;
|
|
337
|
-
right: number;
|
|
338
|
-
}): void;
|
|
339
|
-
/** End column resize. */
|
|
340
|
-
endColumnResize(): void;
|
|
341
|
-
/** Get current column resize state. */
|
|
342
|
-
getColumnResize(): ColumnResizeState;
|
|
343
|
-
/** Set the currently selected image. */
|
|
344
|
-
setSelectedImage(imageInfo: ImageSelectionInfo | null): void;
|
|
345
|
-
/** Clear the image selection. */
|
|
346
|
-
clearSelectedImage(): void;
|
|
347
|
-
/** Set whether an image interaction (resize/move) is in progress. */
|
|
348
|
-
setImageInteracting(interacting: boolean): void;
|
|
349
|
-
/** Update focus state. */
|
|
350
|
-
setFocused(focused: boolean): void;
|
|
351
|
-
private emitSnapshot;
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
/**
|
|
355
|
-
* EditorCoordinator
|
|
356
|
-
*
|
|
357
|
-
* Framework-agnostic class managing the document editor lifecycle:
|
|
358
|
-
* - Document parsing and loading
|
|
359
|
-
* - Font loading coordination
|
|
360
|
-
* - Zoom level management
|
|
361
|
-
* - Extension manager initialization
|
|
362
|
-
* - Agent command execution
|
|
363
|
-
*
|
|
364
|
-
* Extracted from DocxEditor.tsx.
|
|
365
|
-
*
|
|
366
|
-
* Usage with React:
|
|
367
|
-
* ```ts
|
|
368
|
-
* const snapshot = useSyncExternalStore(coordinator.subscribe, coordinator.getSnapshot);
|
|
369
|
-
* ```
|
|
370
|
-
*
|
|
371
|
-
* NOTE: This class defines the state shape and coordination logic.
|
|
372
|
-
* Full integration with DocxEditor is done incrementally.
|
|
373
|
-
*/
|
|
374
|
-
|
|
375
|
-
/** Editor loading state */
|
|
376
|
-
type EditorLoadingState = 'idle' | 'parsing' | 'loading-fonts' | 'ready' | 'error';
|
|
377
|
-
/** Configuration for EditorCoordinator */
|
|
378
|
-
interface EditorCoordinatorOptions {
|
|
379
|
-
/** Initial zoom level (default: 1.0) */
|
|
380
|
-
initialZoom?: number;
|
|
381
|
-
/** Callback when the document changes */
|
|
382
|
-
onChange?: (document: Document) => void;
|
|
383
|
-
/** Callback when an error occurs */
|
|
384
|
-
onError?: (error: Error) => void;
|
|
385
|
-
}
|
|
386
|
-
/** The full snapshot exposed to UI frameworks */
|
|
387
|
-
interface EditorCoordinatorSnapshot {
|
|
388
|
-
/** Current loading state */
|
|
389
|
-
loadingState: EditorLoadingState;
|
|
390
|
-
/** Error message if loadingState is 'error' */
|
|
391
|
-
parseError: string | null;
|
|
392
|
-
/** Whether the editor is ready for interaction */
|
|
393
|
-
isReady: boolean;
|
|
394
|
-
/** Current zoom level (1.0 = 100%) */
|
|
395
|
-
zoom: number;
|
|
396
|
-
/** Whether fonts have been loaded */
|
|
397
|
-
fontsLoaded: boolean;
|
|
398
|
-
/** Version counter */
|
|
399
|
-
version: number;
|
|
400
|
-
}
|
|
401
|
-
declare class EditorCoordinator extends Subscribable<EditorCoordinatorSnapshot> {
|
|
402
|
-
private _loadingState;
|
|
403
|
-
private _parseError;
|
|
404
|
-
private _zoom;
|
|
405
|
-
private _fontsLoaded;
|
|
406
|
-
private _document;
|
|
407
|
-
private _version;
|
|
408
|
-
private onChangeCallback?;
|
|
409
|
-
private onErrorCallback?;
|
|
410
|
-
constructor(options?: EditorCoordinatorOptions);
|
|
411
|
-
/** Signal that document parsing has started. */
|
|
412
|
-
setParsingStarted(): void;
|
|
413
|
-
/** Signal that document parsing completed successfully. */
|
|
414
|
-
setDocumentLoaded(document: Document): void;
|
|
415
|
-
/** Signal that font loading completed. */
|
|
416
|
-
setFontsLoaded(): void;
|
|
417
|
-
/** Signal that an error occurred during loading. */
|
|
418
|
-
setLoadError(error: Error): void;
|
|
419
|
-
/** Get the current document. */
|
|
420
|
-
getDocument(): Document | null;
|
|
421
|
-
/** Update the document (after edits). */
|
|
422
|
-
updateDocument(document: Document): void;
|
|
423
|
-
/** Set the zoom level (1.0 = 100%). */
|
|
424
|
-
setZoom(zoom: number): void;
|
|
425
|
-
/** Get the current zoom level. */
|
|
426
|
-
getZoom(): number;
|
|
427
|
-
private emitSnapshot;
|
|
428
|
-
}
|
|
429
|
-
|
|
430
242
|
/**
|
|
431
243
|
* @betteroffice/docx (default entry point)
|
|
432
244
|
*
|
|
433
|
-
* Fat barrel that re-exports the parser, serializer,
|
|
434
|
-
*
|
|
435
|
-
*
|
|
436
|
-
* **When to import from `.` vs `./headless`:** identical for Node.js
|
|
437
|
-
* use; `.` is the convenient aggregate, `./headless` is its mirror with
|
|
438
|
-
* a slightly different name suffix. Adapter authors who only need a
|
|
439
|
-
* specific slice should prefer the smaller subpaths (`./docx`, `./agent`,
|
|
440
|
-
* `./prosemirror`, `./layout-*`, `./utils`) — they tree-shake better.
|
|
245
|
+
* Fat barrel that re-exports the parser, serializer, and the most-used types.
|
|
246
|
+
* No React/DOM imports. Adapter authors who only need a specific slice should
|
|
247
|
+
* prefer the smaller subpaths.
|
|
441
248
|
*
|
|
442
249
|
* @example
|
|
443
250
|
* ```ts
|
|
@@ -448,4 +255,4 @@ declare class EditorCoordinator extends Subscribable<EditorCoordinatorSnapshot>
|
|
|
448
255
|
*/
|
|
449
256
|
declare const VERSION = "0.0.2";
|
|
450
257
|
|
|
451
|
-
export { type
|
|
258
|
+
export { type CellCoordinates, Document, DocumentBody, ErrorManager, type ErrorManagerSnapshot, type ErrorNotification, type ErrorSeverity, type PrintOptions, SectionProperties, Subscribable, TABLE_DATA_ATTRIBUTES, Table, TableSelectionManager, type TableSelectionSnapshot, VERSION, deleteTableFromDocument, findTableFromClick, formatPageRange, getDefaultPrintOptions, getTableFromDocument, isPrintSupported, openPrintWindow, parsePageRange, serializeDocumentBody, serializeDocument as serializeDocx, serializeSectionProperties, triggerPrint, updateTableInDocument };
|
package/dist/core.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{a as AutoSaveManager,b as formatLastSaveTime,e as formatStorageSize,c as getAutoSaveStatusLabel,d as getAutoSaveStorageSize,f as isAutoSaveSupported}from'./chunk-VCER63GQ.mjs';export{a as TABLE_DATA_ATTRIBUTES,f as TableSelectionManager,e as deleteTableFromDocument,b as findTableFromClick,c as getTableFromDocument,d as updateTableInDocument}from'./chunk-JY6ILTNS.mjs';import {a}from'./chunk-BI3B33LI.mjs';export{a as Subscribable}from'./chunk-BI3B33LI.mjs';export{a as FOOTNOTE_SEPARATOR_HEIGHT,c as MAX_FOOTNOTE_LAYOUT_PASSES,k as buildFootnoteContentMap,o as buildFootnoteRenderItems,m as calculateFootnoteReservedHeights,f as collectFootnoteRefs,t as convertHeaderFooterToContent,d as footnoteReservedHeightsEqual,g as mapFootnotesToPages,n as stabilizeFootnoteLayout}from'./chunk-P3KDV4M2.mjs';import'./chunk-7DEIW7FL.mjs';import'./chunk-IL5JZJT7.mjs';import'./chunk-GWKJ2Y4Y.mjs';import'./chunk-52GB3Y42.mjs';export{n as countPageBreaks,b as createColumnBreak,g as createHorizontalRule,c as createLineBreak,a as createPageBreak,e as createPageBreakParagraph,d as createPageBreakRun,o as findPageBreaks,m as hasPageBreakBefore,h as insertHorizontalRule,f as insertPageBreak,l as isBreakContent,j as isColumnBreak,k as isLineBreak,i as isPageBreak,p as removePageBreak}from'./chunk-34K66SY4.mjs';import'./chunk-7PCO5I2O.mjs';import'./chunk-X4XDO3LZ.mjs';export{b as createDocumentWithText,a as createEmptyDocument}from'./chunk-VAOUFAUH.mjs';export{j as colorsEqual,g as createRgbColor,f as createThemeColor,h as ensureHexPrefix,c as isBlack,d as isWhite,e as parseColorString,a as resolveHighlightColor,i as resolveHighlightToCss,b as resolveShadingColor}from'./chunk-L5ISVQ3W.mjs';export{b as docxtemplaterPlugin}from'./chunk-XYH6XWP3.mjs';export{e as getTemplateTags,a as processTemplate,c as processTemplateAsBlob,b as processTemplateDetailed,f as validateTemplate}from'./chunk-O2QSE2I7.mjs';import'./chunk-OMR3TWCD.mjs';import'./chunk-XWUOLYRQ.mjs';import'./chunk-HJGAQIU7.mjs';export{b as buildPatchedDocumentXml,a as validatePatchSafety}from'./chunk-KEE52TT5.mjs';export{i as blendColors,g as darkenColor,k as generateThemeTintShadeMatrix,f as getContrastingColor,j as getThemeTintShadeHex,h as lightenColor,d as resolveColor}from'./chunk-FZIA7OFY.mjs';import'./chunk-OBQGPMPQ.mjs';export{a as DocumentAgent,h as buildExtendedSelectionContext,g as buildSelectionContext,d as getAgentContext,f as getDocumentSummary}from'./chunk-XQBCCJBO.mjs';export{a as detectVariables,b as detectVariablesDetailed,c as detectVariablesInBody,d as detectVariablesInParagraph,m as documentHasVariables,e as extractVariablesFromText,i as formatVariable,f as hasTemplateVariables,g as isValidVariableName,j as parseVariable,l as removeVariables,k as replaceVariables,h as sanitizeVariableName}from'./chunk-UIEJWORW.mjs';export{a as executeCommand,b as executeCommands}from'./chunk-6PW4CWUG.mjs';import'./chunk-KXNZFTTK.mjs';export{a as PluginRegistry,b as pluginRegistry,c as registerPlugins}from'./chunk-VBOTMRXV.mjs';export{a as attemptSelectiveSave}from'./chunk-OJOHXQNQ.mjs';export{s as createDocx,h as repackDocx,l as updateMultipleFiles}from'./chunk-KVKLLTDP.mjs';import'./chunk-BIQWVK5P.mjs';export{b as emuToPixels,i as emuToTwips,q as formatPx,k as halfPointsToPixels,c as pixelsToEmu,h as pixelsToTwips,d as pointsToPixels,j as twipsToEmu,g as twipsToPixels}from'./chunk-3UBMCDME.mjs';export{a as parseDocx}from'./chunk-LDUWIM7M.mjs';export{o as canRenderFont,l as getLoadedFonts,h as isFontLoaded,k as isFontsLoading,j as isGoogleFontsEnabled,f as loadFont,p as loadFontFromBuffer,g as loadFonts,m as onFontsLoaded,w as preloadCommonFonts,i as setGoogleFontsEnabled,a as toArrayBuffer}from'./chunk-DXKG3HQ5.mjs';import'./chunk-FPZBTOD6.mjs';import'./chunk-H3JCIGWK.mjs';export{c as serializeDocumentBody,b as serializeDocx,d as serializeSectionProperties}from'./chunk-N5Q3YN64.mjs';import'./chunk-SINEY6ZF.mjs';import'./chunk-T4EZMUXM.mjs';import {b as b$1}from'./chunk-TTRUPDAB.mjs';function kt(r,o){if(!o||!o.trim())return null;let e=null;return r.descendants((t,n)=>e!==null?false:t.attrs?.paraId===o&&t.isTextblock?(e=n,false):true),e}function zt(r,o){if(!o||!o.trim())return null;let e=null;return r.descendants((t,n)=>e!==null?false:t.isTextblock&&t.attrs?.paraId===o?(e={node:t,from:n,to:n+t.nodeSize},false):true),e}var Ot={includeHeaders:true,includeFooters:true,includePageNumbers:true,pageRange:null,scale:1,printBackground:true,margins:"default"};function Nt(){return {...Ot}}function wt(){typeof window<"u"&&window.print();}var Mt="@media print { body { margin: 0; padding: 0; } @page { margin: 0; } }";function Bt(r="Document",o){if(typeof window>"u")return null;let e=window.open("","_blank");if(!e)return null;e.opener=null;let t=e.document;t.title=r;let n=t.createElement("style");n.textContent=Mt,t.head.appendChild(n);let i=new DOMParser().parseFromString(o,"text/html");for(let s of Array.from(i.body.childNodes))t.body.appendChild(t.importNode(s,true));return e}function Ht(r,o){if(!r||!r.trim())return null;let e=r.trim();if(/^\d+$/.test(e)){let n=parseInt(e,10);return n>=1&&n<=o?{start:n,end:n}:null}let t=e.match(/^(\d+)-(\d+)$/);if(t){let n=parseInt(t[1],10),i=parseInt(t[2],10);if(n>=1&&i<=o&&n<=i)return {start:n,end:i}}return null}function Vt(r,o){return r?r.start===r.end?`Page ${r.start}`:`Pages ${r.start}-${r.end}`:`All (${o} pages)`}function Wt(){return typeof window<"u"&&typeof window.print=="function"}function k(r){if(!r||r==="transparent"||r==="inherit")return null;if(r.startsWith("#"))return r.slice(1).toUpperCase();let o=r.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)/);if(o){let e=parseInt(o[1]).toString(16).padStart(2,"0"),t=parseInt(o[2]).toString(16).padStart(2,"0"),n=parseInt(o[3]).toString(16).padStart(2,"0");return (e+t+n).toUpperCase()}return null}function S(r){let o=window.getComputedStyle(r),e={};(o.fontWeight==="bold"||parseInt(o.fontWeight)>=700)&&(e.bold=true),o.fontStyle==="italic"&&(e.italic=true);let t=o.textDecoration||o.textDecorationLine;t&&t.includes("underline")&&(e.underline={style:"single"}),t&&t.includes("line-through")&&(e.strike=true);let n=parseFloat(o.fontSize);!isNaN(n)&&n>0&&(e.fontSize=Math.round(n/1.333*2));let i=o.fontFamily.replace(/["']/g,"").split(",")[0].trim();i&&(e.fontFamily={ascii:i});let s=o.color;if(s&&s!=="rgb(0, 0, 0)"){let m=k(s);m&&(e.color={rgb:m});}let l=o.backgroundColor;if(l&&l!=="transparent"&&l!=="rgba(0, 0, 0, 0)"){let m=x(l);m&&(e.shading={fill:{rgb:m}});}return Object.keys(e).length>0?e:void 0}function $t(r,o){let e=document.createRange();e.selectNodeContents(r);let t=o.compareBoundaryPoints(Range.START_TO_START,e)>=0&&o.compareBoundaryPoints(Range.START_TO_END,e)<=0,n=o.compareBoundaryPoints(Range.END_TO_START,e)>=0&&o.compareBoundaryPoints(Range.END_TO_END,e)<=0;if(t&&n)return o.toString();if(t){let i=document.createRange();return i.setStart(o.startContainer,o.startOffset),i.selectNodeContents(r),i.setEnd(e.endContainer,e.endOffset),i.toString()}else if(n){let i=document.createRange();return i.selectNodeContents(r),i.setEnd(o.endContainer,o.endOffset),i.setStart(e.startContainer,e.startOffset),i.toString()}else if(o.intersectsNode(r))return r.textContent||"";return ""}function A(r){let o=r;for(;o;){if(o.nodeType===Node.ELEMENT_NODE){let e=o;if(e.hasAttribute("data-paragraph-index"))return e}o=o.parentNode;}return null}function b(){let r=window.getSelection();if(!r||r.isCollapsed)return [];let o=[],e=r.getRangeAt(0),t=e.commonAncestorContainer,n=t.nodeType===Node.ELEMENT_NODE?t:t.parentElement;if(!n)return o;if(n.querySelectorAll(".docx-run").forEach(s=>{if(e.intersectsNode(s)){let l=$t(s,e);if(l){let m=S(s);o.push({type:"run",formatting:m,content:[{type:"text",text:l}]});}}}),o.length===0){let s=r.toString();s&&o.push({type:"run",content:[{type:"text",text:s}]});}return o}function z(){let r=window.getSelection();if(!r||r.isCollapsed)return null;let o=b();if(o.length===0)return null;let e=r.toString(),t=r.getRangeAt(0),n=A(t.startContainer),i=A(t.endContainer),s=n?parseInt(n.getAttribute("data-paragraph-index")||"0",10):0,l=i?parseInt(i.getAttribute("data-paragraph-index")||"0",10):0;return {text:e,runs:o,startParagraphIndex:s,startRunIndex:0,startOffset:t.startOffset,endParagraphIndex:l,endRunIndex:0,endOffset:t.endOffset,isMultiParagraph:s!==l}}var x=k;var p=class extends a{constructor(){super({notifications:[]});b$1(this,"notifications",[]);b$1(this,"idCounter",0);b$1(this,"timers",new Set);}showError(e,t){return this.addNotification(e,"error",t)}showWarning(e,t){return this.addNotification(e,"warning",t)}showInfo(e,t){return this.addNotification(e,"info",t)}dismiss(e){this.notifications=this.notifications.map(n=>n.id===e?{...n,dismissed:true}:n),this.emitSnapshot();let t=setTimeout(()=>{this.timers.delete(t),this.notifications=this.notifications.filter(n=>n.id!==e),this.emitSnapshot();},300);this.timers.add(t);}clearAll(){this.notifications=[];for(let e of this.timers)clearTimeout(e);this.timers.clear(),this.emitSnapshot();}destroy(){for(let e of this.timers)clearTimeout(e);this.timers.clear(),this.notifications=[];}addNotification(e,t,n){let i=`error-${++this.idCounter}-${Date.now()}`,s={id:i,message:e,severity:t,details:n,timestamp:Date.now()};if(this.notifications=[...this.notifications,s],this.emitSnapshot(),t!=="error"){let l=setTimeout(()=>{this.timers.delete(l),this.dismiss(i);},5e3);this.timers.add(l);}return i}emitSnapshot(){this.setSnapshot({notifications:this.notifications});}};function O(r,o){let e=`plugin-styles-${r}`,t=document.getElementById(e);t&&t.remove();let n=document.createElement("style");return n.id=e,n.textContent=o,document.head.appendChild(n),()=>{let i=document.getElementById(e);i&&i.remove();}}var g=class extends a{constructor(){super({states:new Map,version:0});b$1(this,"plugins",[]);b$1(this,"pluginStates",new Map);b$1(this,"version",0);}initialize(e,t){this.destroyPlugins(),this.plugins=e;for(let n of e)n.initialize&&!this.pluginStates.has(n.id)&&this.pluginStates.set(n.id,n.initialize(t));this.emitSnapshot();}updateStates(e){let t=false;for(let n of this.plugins)if(n.onStateChange){let i=n.onStateChange(e);i!==void 0&&(this.pluginStates.set(n.id,i),t=true);}return t&&(this.version++,this.emitSnapshot()),t}getPluginState(e){return this.pluginStates.get(e)}setPluginState(e,t){this.pluginStates.set(e,t),this.version++,this.emitSnapshot();}destroy(){this.destroyPlugins(),this.emitSnapshot();}destroyPlugins(){for(let e of this.plugins)e.destroy&&e.destroy();this.pluginStates.clear(),this.plugins=[];}emitSnapshot(){this.setSnapshot({states:new Map(this.pluginStates),version:this.version});}};var f=class extends a{constructor(){super({hasLayout:false,selectionRects:[],caretPosition:null,selectedImageInfo:null,isFocused:false,isDragging:false,isResizingColumn:false,isImageInteracting:false,version:0});b$1(this,"_hasLayout",false);b$1(this,"_selectionRects",[]);b$1(this,"_caretPosition",null);b$1(this,"_isDragging",false);b$1(this,"_dragAnchor",null);b$1(this,"_columnResize",{isResizing:false,startX:0,columnIndex:0,tablePmStart:0,originalWidths:{left:0,right:0}});b$1(this,"_selectedImageInfo",null);b$1(this,"_isImageInteracting",false);b$1(this,"_isFocused",false);b$1(this,"_version",0);}setLayoutReady(e){this._hasLayout=e,this.emitSnapshot();}updateSelection(e,t){this._selectionRects=e,this._caretPosition=t,this.emitSnapshot();}startDrag(e){this._isDragging=true,this._dragAnchor=e,this.emitSnapshot();}endDrag(){this._isDragging=false,this._dragAnchor=null,this.emitSnapshot();}getDragAnchor(){return this._dragAnchor}startColumnResize(e,t,n,i){this._columnResize={isResizing:true,startX:n,columnIndex:t,tablePmStart:e,originalWidths:i},this.emitSnapshot();}endColumnResize(){this._columnResize={...this._columnResize,isResizing:false},this.emitSnapshot();}getColumnResize(){return this._columnResize}setSelectedImage(e){this._selectedImageInfo=e,this.emitSnapshot();}clearSelectedImage(){this._selectedImageInfo=null,this._isImageInteracting=false,this.emitSnapshot();}setImageInteracting(e){this._isImageInteracting=e,this.emitSnapshot();}setFocused(e){this._isFocused=e,this.emitSnapshot();}emitSnapshot(){this._version++,this.setSnapshot({hasLayout:this._hasLayout,selectionRects:this._selectionRects,caretPosition:this._caretPosition,selectedImageInfo:this._selectedImageInfo,isFocused:this._isFocused,isDragging:this._isDragging,isResizingColumn:this._columnResize.isResizing,isImageInteracting:this._isImageInteracting,version:this._version});}};var h=class extends a{constructor(e={}){let t=e.initialZoom??1;super({loadingState:"idle",parseError:null,isReady:false,zoom:t,fontsLoaded:false,version:0});b$1(this,"_loadingState","idle");b$1(this,"_parseError",null);b$1(this,"_zoom");b$1(this,"_fontsLoaded",false);b$1(this,"_document",null);b$1(this,"_version",0);b$1(this,"onChangeCallback");b$1(this,"onErrorCallback");this._zoom=t,this.onChangeCallback=e.onChange,this.onErrorCallback=e.onError;}setParsingStarted(){this._loadingState="parsing",this._parseError=null,this.emitSnapshot();}setDocumentLoaded(e){this._document=e,this._loadingState="loading-fonts",this._parseError=null,this.emitSnapshot();}setFontsLoaded(){this._fontsLoaded=true,this._loadingState="ready",this.emitSnapshot();}setLoadError(e){this._loadingState="error",this._parseError=e.message,this.onErrorCallback?.(e),this.emitSnapshot();}getDocument(){return this._document}updateDocument(e){this._document=e,this.onChangeCallback?.(e),this.emitSnapshot();}setZoom(e){this._zoom=Math.max(.25,Math.min(4,e)),this.emitSnapshot();}getZoom(){return this._zoom}emitSnapshot(){this._version++,this.setSnapshot({loadingState:this._loadingState,parseError:this._parseError,isReady:this._loadingState==="ready",zoom:this._zoom,fontsLoaded:this._fontsLoaded,version:this._version});}};var vo="0.0.2";export{h as EditorCoordinator,p as ErrorManager,f as LayoutCoordinator,g as PluginLifecycleManager,vo as VERSION,z as createSelectionFromDOM,S as extractFormattingFromElement,zt as findParagraphByParaId,kt as findStartPosForParaId,Vt as formatPageRange,Nt as getDefaultPrintOptions,b as getSelectionRuns,O as injectStyles,Wt as isPrintSupported,Bt as openPrintWindow,Ht as parsePageRange,x as rgbToHex,wt as triggerPrint};
|
|
1
|
+
export{i as attemptSelectiveSave,h as createDocx,a as parseDocx,f as repackDocx,c as serializeDocumentBody,b as serializeDocx,d as serializeSectionProperties,g as updateMultipleFiles}from'./chunk-AEQOEQJ7.mjs';export{f as blendColors,r as colorsEqual,o as createRgbColor,n as createThemeColor,d as darkenColor,p as ensureHexPrefix,h as generateThemeTintShadeMatrix,c as getContrastingColor,g as getThemeTintShadeHex,k as isBlack,l as isWhite,e as lightenColor,m as parseColorString,a as resolveColor,i as resolveHighlightColor,q as resolveHighlightToCss,j as resolveShadingColor}from'./chunk-IFT6DUJX.mjs';export{b as emuToPixels,i as emuToTwips,q as formatPx,k as halfPointsToPixels,c as pixelsToEmu,h as pixelsToTwips,d as pointsToPixels,j as twipsToEmu,g as twipsToPixels}from'./chunk-3UBMCDME.mjs';export{o as canRenderFont,l as getLoadedFonts,h as isFontLoaded,k as isFontsLoading,j as isGoogleFontsEnabled,f as loadFont,p as loadFontFromBuffer,g as loadFonts,m as onFontsLoaded,w as preloadCommonFonts,i as setGoogleFontsEnabled,a as toArrayBuffer}from'./chunk-AZ52IWB6.mjs';import'./chunk-NJHOPXZW.mjs';import'./chunk-B4IR6YP4.mjs';import'./chunk-T4EZMUXM.mjs';import {b as b$1}from'./chunk-TTRUPDAB.mjs';var ce={includeHeaders:true,includeFooters:true,includePageNumbers:true,pageRange:null,scale:1,printBackground:true,margins:"default"};function me(){return {...ce}}function de(){typeof window<"u"&&window.print();}var fe="@media print { body { margin: 0; padding: 0; } @page { margin: 0; } }";function ge(t="Document",r){if(typeof window>"u")return null;let e=window.open("","_blank");if(!e)return null;e.opener=null;let n=e.document;n.title=t;let o=n.createElement("style");o.textContent=fe,n.head.appendChild(o);let i=new DOMParser().parseFromString(r,"text/html");for(let l of Array.from(i.body.childNodes))n.body.appendChild(n.importNode(l,true));return e}function he(t,r){if(!t||!t.trim())return null;let e=t.trim();if(/^\d+$/.test(e)){let o=parseInt(e,10);return o>=1&&o<=r?{start:o,end:o}:null}let n=e.match(/^(\d+)-(\d+)$/);if(n){let o=parseInt(n[1],10),i=parseInt(n[2],10);if(o>=1&&i<=r&&o<=i)return {start:o,end:i}}return null}function Te(t,r){return t?t.start===t.end?`Page ${t.start}`:`Pages ${t.start}-${t.end}`:`All (${r} pages)`}function be(){return typeof window<"u"&&typeof window.print=="function"}var s=class{constructor(r){b$1(this,"listeners",new Set);b$1(this,"snapshot");b$1(this,"subscribe",r=>(this.listeners.add(r),()=>{this.listeners.delete(r);}));b$1(this,"getSnapshot",()=>this.snapshot);this.snapshot=r;}setSnapshot(r){this.snapshot=r,this.notify();}notify(){for(let r of this.listeners)r();}};var c={TABLE_INDEX:"data-table-index",ROW_INDEX:"data-row",COLUMN_INDEX:"data-col",TABLE_CELL:"data-table-cell"};function g(t,r){if(!(t instanceof Element))return null;let e=t;for(;e&&e!==r;){if(e.tagName==="TD"||e.tagName==="TH"){let n=e.getAttribute(c.ROW_INDEX),o=e.getAttribute(c.COLUMN_INDEX);if(n!==null&&o!==null){let i=e;for(;i&&i!==r;){if(i.tagName==="TABLE"){let l=i.getAttribute(c.TABLE_INDEX);if(l!==null)return {tableIndex:parseInt(l,10),rowIndex:parseInt(n,10),columnIndex:parseInt(o,10)};break}i=i.parentElement;}}break}e=e.parentElement;}return null}function h(t,r){if(!t.package?.document?.content)return null;let e=0;for(let n of t.package.document.content)if(n.type==="table"){if(e===r)return n;e++;}return null}function T(t,r,e){if(!t.package?.document?.content)return t;let n=0,o=t.package.document.content.map(i=>{if(i.type==="table"){if(n===r)return n++,e;n++;}return i});return {...t,package:{...t.package,document:{...t.package.document,content:o}}}}function b(t,r){if(!t.package?.document?.content)return t;let e=0,n=t.package.document.content.filter(o=>{if(o.type==="table"){let i=e===r;return e++,!i}return true});return {...t,package:{...t.package,document:{...t.package.document,content:n}}}}var m=class extends s{constructor(){super({selectedCell:null});}selectCell(r){this.setSnapshot({selectedCell:r});}clearSelection(){this.setSnapshot({selectedCell:null});}isCellSelected(r,e,n){let{selectedCell:o}=this.getSnapshot();return o?o.tableIndex===r&&o.rowIndex===e&&o.columnIndex===n:false}getSelectedCell(){return this.getSnapshot().selectedCell}};var d=class extends s{constructor(){super({notifications:[]});b$1(this,"notifications",[]);b$1(this,"idCounter",0);b$1(this,"timers",new Set);}showError(e,n){return this.addNotification(e,"error",n)}showWarning(e,n){return this.addNotification(e,"warning",n)}showInfo(e,n){return this.addNotification(e,"info",n)}dismiss(e){this.notifications=this.notifications.map(o=>o.id===e?{...o,dismissed:true}:o),this.emitSnapshot();let n=setTimeout(()=>{this.timers.delete(n),this.notifications=this.notifications.filter(o=>o.id!==e),this.emitSnapshot();},300);this.timers.add(n);}clearAll(){this.notifications=[];for(let e of this.timers)clearTimeout(e);this.timers.clear(),this.emitSnapshot();}destroy(){for(let e of this.timers)clearTimeout(e);this.timers.clear(),this.notifications=[];}addNotification(e,n,o){let i=`error-${++this.idCounter}-${Date.now()}`,l={id:i,message:e,severity:n,details:o,timestamp:Date.now()};if(this.notifications=[...this.notifications,l],this.emitSnapshot(),n!=="error"){let f=setTimeout(()=>{this.timers.delete(f),this.dismiss(i);},5e3);this.timers.add(f);}return i}emitSnapshot(){this.setSnapshot({notifications:this.notifications});}};var Me="0.0.2";export{d as ErrorManager,s as Subscribable,c as TABLE_DATA_ATTRIBUTES,m as TableSelectionManager,Me as VERSION,b as deleteTableFromDocument,g as findTableFromClick,Te as formatPageRange,me as getDefaultPrintOptions,h as getTableFromDocument,be as isPrintSupported,ge as openPrintWindow,he as parsePageRange,de as triggerPrint,T as updateTableInDocument};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { I as ImagePrimitive,
|
|
1
|
+
import { I as ImagePrimitive, a as DisplayList, R as RustDisplayListQueryEngine } from './rustDisplayList-CX78djsZ.mjs';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Locate an image primitive in a built DisplayList by its document position.
|