@docx-editor.dev/core 0.0.1-placeholder → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +92 -2
- package/THIRD_PARTY_NOTICES.md +18 -0
- package/dist/automation.cjs +1 -0
- package/dist/automation.d.cts +74 -0
- package/dist/automation.d.ts +74 -0
- package/dist/automation.js +1 -0
- package/dist/binding.cjs +1 -0
- package/dist/binding.d.cts +82 -0
- package/dist/binding.d.ts +82 -0
- package/dist/binding.js +1 -0
- package/dist/chunk-5KSCB2OZ.js +2 -0
- package/dist/chunk-BSC44TIT.js +5 -0
- package/dist/chunk-DLPL5DAG.js +12 -0
- package/dist/chunk-DOEIARE2.js +2 -0
- package/dist/chunk-G7YCQBZE.cjs +5 -0
- package/dist/chunk-HBL3NNH5.cjs +1 -0
- package/dist/chunk-HR7K3W6A.js +1 -0
- package/dist/chunk-HVAV2JSN.js +11 -0
- package/dist/chunk-MYH2HCUJ.cjs +2 -0
- package/dist/chunk-NSM75TN6.cjs +1 -0
- package/dist/chunk-PHDVKUWZ.js +1 -0
- package/dist/chunk-QADYGK5L.cjs +12 -0
- package/dist/chunk-REZUWYB7.js +1 -0
- package/dist/chunk-RNBHTPW7.js +10 -0
- package/dist/chunk-UD2ZXLFI.cjs +2 -0
- package/dist/chunk-VYAVK2AH.cjs +1 -0
- package/dist/chunk-YUK46A2N.cjs +11 -0
- package/dist/chunk-ZMIX42J7.cjs +10 -0
- package/dist/chunk-ZT55Q52J.cjs +2 -0
- package/dist/chunk-ZUALAR4M.js +2 -0
- package/dist/content-control-walk-CbTqHq6O.d.cts +56 -0
- package/dist/content-control-walk-D06GijR0.d.ts +56 -0
- package/dist/contracts/document.cjs +1 -0
- package/dist/contracts/document.d.cts +246 -0
- package/dist/contracts/document.d.ts +246 -0
- package/dist/contracts/document.js +0 -0
- package/dist/contracts/editor.cjs +1 -0
- package/dist/contracts/editor.d.cts +11 -0
- package/dist/contracts/editor.d.ts +11 -0
- package/dist/contracts/editor.js +1 -0
- package/dist/contracts/interaction.cjs +1 -0
- package/dist/contracts/interaction.d.cts +11 -0
- package/dist/contracts/interaction.d.ts +11 -0
- package/dist/contracts/interaction.js +0 -0
- package/dist/contracts/modules.cjs +1 -0
- package/dist/contracts/modules.d.cts +90 -0
- package/dist/contracts/modules.d.ts +90 -0
- package/dist/contracts/modules.js +1 -0
- package/dist/contracts/types.cjs +1 -0
- package/dist/contracts/types.d.cts +452 -0
- package/dist/contracts/types.d.ts +452 -0
- package/dist/contracts/types.js +0 -0
- package/dist/editor-C1QRi1v4.d.ts +1671 -0
- package/dist/editor-D0UDock4.d.cts +1671 -0
- package/dist/editor.cjs +1 -0
- package/dist/editor.css +6017 -0
- package/dist/editor.d.cts +271 -0
- package/dist/editor.d.ts +271 -0
- package/dist/editor.js +1 -0
- package/dist/hf-references-BdjsQNE_.d.ts +71 -0
- package/dist/hf-references-CgEOSw3i.d.cts +71 -0
- package/dist/image-resources-BJnTpG66.d.ts +195 -0
- package/dist/image-resources-BpIydXtU.d.cts +195 -0
- package/dist/index-CrW-IxXt.d.cts +2515 -0
- package/dist/index-ZqBEOrTV.d.ts +2515 -0
- package/dist/index.cjs +1 -0
- package/dist/index.d.cts +22 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.js +1 -0
- package/dist/layout.cjs +1 -0
- package/dist/layout.d.cts +2316 -0
- package/dist/layout.d.ts +2316 -0
- package/dist/layout.js +1 -0
- package/dist/note-nodes-BPSTVDMr.d.ts +108 -0
- package/dist/note-nodes-C6DLxlvj.d.cts +108 -0
- package/dist/note-properties-CnmCoory.d.cts +68 -0
- package/dist/note-properties-m75hmP70.d.ts +68 -0
- package/dist/ooxml-package-CR5us6ad.d.cts +354 -0
- package/dist/ooxml-package-D_CtywTW.d.ts +354 -0
- package/dist/ooxml-tree-BU0e3DVi.d.cts +871 -0
- package/dist/ooxml-tree-BU0e3DVi.d.ts +871 -0
- package/dist/output.cjs +1 -0
- package/dist/output.d.cts +158 -0
- package/dist/output.d.ts +158 -0
- package/dist/output.js +1 -0
- package/dist/protocol-CAkOBBGE.d.cts +1201 -0
- package/dist/protocol-oxHaWmt4.d.ts +1201 -0
- package/dist/review-support-DS8DYX2a.d.cts +326 -0
- package/dist/review-support-Fy3vdIea.d.ts +326 -0
- package/dist/revision-projection-72ZApe-g.d.cts +84 -0
- package/dist/revision-projection-DHAkcD_L.d.ts +84 -0
- package/dist/semantic-cell-selection-CZjBSmMv.d.cts +427 -0
- package/dist/semantic-cell-selection-DsmHmLJ5.d.ts +427 -0
- package/dist/semantic-interaction-D-Dszxrn.d.cts +187 -0
- package/dist/semantic-interaction-Dy-dCUFF.d.ts +187 -0
- package/dist/semantic-paint-drawings-BA3z9jl8.d.ts +21 -0
- package/dist/semantic-paint-drawings-D7qbB0E2.d.cts +21 -0
- package/dist/semantic-records-CJR3BvHs.d.cts +1432 -0
- package/dist/semantic-records-CWodBJsz.d.ts +1432 -0
- package/dist/shaped-measurer-B-TAtcQU.d.ts +613 -0
- package/dist/shaped-measurer-CNIT_svZ.d.cts +613 -0
- package/dist/store.cjs +1 -0
- package/dist/store.d.cts +2247 -0
- package/dist/store.d.ts +2247 -0
- package/dist/store.js +1 -0
- package/dist/tree-op-types-CwOeiaQ8.d.ts +1431 -0
- package/dist/tree-op-types-DMiW6nIH.d.cts +1431 -0
- package/dist/tree-package-store-D5S7VKs5.d.ts +708 -0
- package/dist/tree-package-store-DOKMtCnh.d.cts +708 -0
- package/dist/tree-session-CiUel5Kz.d.ts +542 -0
- package/dist/tree-session-D47_imvR.d.cts +542 -0
- package/dist/tree-store-CxifqwIv.d.cts +273 -0
- package/dist/tree-store-hLtjeyWE.d.ts +273 -0
- package/package.json +105 -15
- package/index.js +0 -1
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
import { F as FontConfiguration, E as EditorFontError, a as EditorCommand, C as CanResult } from './editor-D0UDock4.cjs';
|
|
2
|
+
export { I as ImageContext, b as ImageCropPercent, c as ImageCropPermille, S as SelectedImageState, d as cropPercentFromCropPermille, e as cropPercentFromPermille, f as cropPercentFromSourceCrop, g as cropPermilleFromCropPercent, h as cropPermilleFromPercent, s as sourceCropFromCropPercent, v as validateImageCropPercent } from './editor-D0UDock4.cjs';
|
|
3
|
+
import { L as LayoutShapingOptions } from './shaped-measurer-CNIT_svZ.cjs';
|
|
4
|
+
import { P as PaginatedSurfaceOptions, O as OpenPaginatedResult, a as PaginatedSurface, T as TableCommandPlan, D as DocxEditorInstance } from './index-CrW-IxXt.cjs';
|
|
5
|
+
export { A as AnchorFrameOrigin, C as CHROME_GROUPS, b as CHROME_MENUS, c as CHROME_UNAVAILABLE_KEY, d as ChromeControl, e as ChromeControlId, f as ChromeControlState, g as ChromeGroup, h as ChromeGroupId, i as ChromeMenu, j as ChromeMenuEntry, k as ChromeMenuId, l as ChromeMenuItemEntry, m as ChromeMenuSeparatorEntry, n as ChromeMenuSubmenuEntry, o as ChromeSlotId, p as DEFAULT_TABLE_CHROME_DRAFT, q as DocxEditorConfig, E as EMU_PER_POINT, F as FinalizedImageOverlayInteraction, r as FontConfigurationBase, s as FontConfigurationFragment, t as FontLoadFailure, u as FontLoadFailureReason, v as FontMeasurementState, w as FontResolutionRequest, x as FontResolver, y as FontUrlSource, H as HyperlinkActivation, z as HyperlinkChromeHandlers, B as HyperlinkOps, I as IMAGE_OVERLAY_NUDGE_PT, G as IMAGE_OVERLAY_NUDGE_SHIFT_PT, J as ImageInteractionSession, K as ImageOverlayScrollPort, L as ImageResizeHandle, M as ImageResizeResult, N as LoadFontsRequest, Q as LoadFontsResult, R as MAX_RESOLVER_FAMILIES, S as OverlayFrameRect, U as PaginatedSurfaceState, V as RunTableChromeCommandResult, W as SelectedDrawingOverlayTarget, X as SurfaceFormatting, Y as SurfaceHyperlink, Z as SurfaceNavigation, _ as SurfaceOverlayCoordinates, $ as TABLE_BORDER_STYLE_OPTIONS, a0 as TABLE_BORDER_TARGET_OPTIONS, a1 as TABLE_BORDER_WIDTH_OPTIONS, a2 as TABLE_CHROME_SLOT_IDS, a3 as TableBorderStyleOption, a4 as TableBorderTargetOption, a5 as TableBorderTargetValue, a6 as TableBorderWidthOption, a7 as TableChromeDraft, a8 as TableChromePick, a9 as TableChromeSlotId, aa as TableInteractionLabelKey, ab as ToolbarCommandState, ac as WORD_DEFAULT_FONT, ad as applyTableChromePick, ae as blankDocumentBytes, af as canExecuteImageCommand, ag as captureImageMutationPreconditions, ah as chromeControlCount, ai as chromeMenuSlots, aj as chromeProbeForSlot, ak as chromeSlotId, al as commandForSlot, am as commandForSlotValue, an as commandForTableChromeSlotValue, ao as composeFontConfiguration, ap as computeImageResizeResult, aq as computeMovedImagePosition, ar as computeResizedImageExtentEmu, as as createDocxEditor, at as createFontSource, au as createImageOverlayScrollPort, av as cssPixelsToLayoutPoints, aw as defaultChromeGroups, ax as defaultTableLabel, ay as emuToOverlayPoints, az as executeImageCommand, aA as finalizeImageOverlayInteraction, aB as formattingBarChromeGroups, aC as isStaleImageInteractionCommit, aD as isTableChromeSlot, aE as layoutPointsToCssPixels, aF as loadFonts, aG as overlayFrameToSheetCssPixels, aH as pointsToEmu, aI as probeTableChromeCommand, aJ as resizePreservesAspect, aK as runSave, aL as runTableChromeCommand, aM as runTableCommand, aN as runToolbarCommand, aO as selectedDrawingOverlayTargetOf, aP as selectedImageStateOf, aQ as surfacePaintScale, aR as tableChromeIconPaths, aS as tableChromeLabelKeyForTarget, aT as tableChromeToolbarState, aU as tableChromeVisible, aV as tableCommandToolbarState, aW as toolbarCommandState, aX as toolbarCommandStates } from './index-CrW-IxXt.cjs';
|
|
6
|
+
import { A as AutomationCapabilities, a as AutomationHost } from './protocol-CAkOBBGE.cjs';
|
|
7
|
+
export { CollectReviewItems, EditorModule, EditorModuleRegistry, ReviewModuleContribution, resolveEditorModules } from './contracts/modules.cjs';
|
|
8
|
+
import { ColorValue } from './contracts/types.cjs';
|
|
9
|
+
import { h as TreeDocColorValue, d as DrawingPositionInput } from './tree-op-types-DMiW6nIH.cjs';
|
|
10
|
+
export { i as IMAGE_WRAP_TARGETS, b as ImageWrapTarget } from './tree-op-types-DMiW6nIH.cjs';
|
|
11
|
+
import { f as DocumentThemeColorEntry } from './tree-session-D47_imvR.cjs';
|
|
12
|
+
import { S as SemanticLayout } from './semantic-records-CJR3BvHs.cjs';
|
|
13
|
+
export { T as TextMeasurer } from './semantic-records-CJR3BvHs.cjs';
|
|
14
|
+
export { D as DEFAULT_IMAGE_RESOURCE_LIMITS, b as ImageDecodePort, c as ImageResourceLimits, R as RenderableImageMime, S as SupportedImageMime, a as VectorImageMime, r as resolveImageResourceLimits, d as resolveSvgIntrinsicSize, s as sniffImageMime, v as validateRasterHeader } from './image-resources-BpIydXtU.cjs';
|
|
15
|
+
export { S as SectionProperties } from './semantic-cell-selection-CZjBSmMv.cjs';
|
|
16
|
+
export { R as ReviewModelInput } from './review-support-DS8DYX2a.cjs';
|
|
17
|
+
export { N as NavigationCommand, S as SemanticPosition, a as SemanticSelection } from './semantic-interaction-D-Dszxrn.cjs';
|
|
18
|
+
import './contracts/document.cjs';
|
|
19
|
+
import './revision-projection-72ZApe-g.cjs';
|
|
20
|
+
import './ooxml-tree-BU0e3DVi.cjs';
|
|
21
|
+
import './note-properties-CnmCoory.cjs';
|
|
22
|
+
import './ooxml-package-CR5us6ad.cjs';
|
|
23
|
+
import './tree-package-store-DOKMtCnh.cjs';
|
|
24
|
+
import './hf-references-CgEOSw3i.cjs';
|
|
25
|
+
import './note-nodes-C6DLxlvj.cjs';
|
|
26
|
+
import './tree-store-CxifqwIv.cjs';
|
|
27
|
+
import './semantic-paint-drawings-D7qbB0E2.cjs';
|
|
28
|
+
import 'prosemirror-model';
|
|
29
|
+
|
|
30
|
+
interface LayoutShapingInstrumentation {
|
|
31
|
+
readonly onFontByteCopy?: () => void;
|
|
32
|
+
readonly onFontHash?: () => void;
|
|
33
|
+
readonly onFontAdmission?: () => void;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Normalize anything thrown during font work into an {@link EditorFontError}.
|
|
37
|
+
*
|
|
38
|
+
* One error type reaches consumers whether the failure came from resolution, admission or
|
|
39
|
+
* shaping, so a host branches on `code` rather than on which layer happened to throw.
|
|
40
|
+
*/
|
|
41
|
+
declare function toEditorFontError(error: unknown): EditorFontError;
|
|
42
|
+
/** Adapt the published byte-source contract to the private deterministic layout snapshot. */
|
|
43
|
+
declare function createLayoutShaping(configuration: FontConfiguration, instrumentation?: LayoutShapingInstrumentation): Promise<LayoutShapingOptions>;
|
|
44
|
+
/**
|
|
45
|
+
* Release a shaping environment's native resources.
|
|
46
|
+
*
|
|
47
|
+
* The shaper holds WASM memory that garbage collection cannot reclaim on its own, so a host that
|
|
48
|
+
* builds shaping options must dispose them when the editor goes away. Safe on a shaper that has
|
|
49
|
+
* no `dispose`.
|
|
50
|
+
*/
|
|
51
|
+
declare function disposeLayoutShaping(shaping: LayoutShapingOptions): void;
|
|
52
|
+
|
|
53
|
+
/** The engine paints at 96 px per inch (twips / 15, 1440 twips per inch). */
|
|
54
|
+
declare const PX_PER_INCH = 96;
|
|
55
|
+
/** Painted pixels per centimetre, derived from {@link PX_PER_INCH}. */
|
|
56
|
+
declare const PX_PER_CM: number;
|
|
57
|
+
/** Which measurement system the ruler shows. Drives both tick cadence and drag snapping. */
|
|
58
|
+
type RulerUnit = 'inch' | 'cm';
|
|
59
|
+
/** One tick on the ruler: where it sits, how tall it is, and its label if it carries one. */
|
|
60
|
+
interface RulerTick {
|
|
61
|
+
/** Offset along the ruler in content pixels. */
|
|
62
|
+
readonly position: number;
|
|
63
|
+
readonly height: number;
|
|
64
|
+
/** Whole-unit label, omitted at the origin and on minor ticks. */
|
|
65
|
+
readonly label?: string;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Ticks across one page dimension, matching the legacy cadence: eighth-inch
|
|
69
|
+
* minors with labelled inches, or millimetre minors with labelled centimetres.
|
|
70
|
+
*/
|
|
71
|
+
declare function generateRulerTicks(lengthPx: number, unit: RulerUnit): RulerTick[];
|
|
72
|
+
/** The first page's box, which the rulers measure against. */
|
|
73
|
+
declare function rulerPageBox(pages: readonly {
|
|
74
|
+
readonly index: number;
|
|
75
|
+
readonly box: {
|
|
76
|
+
width: number;
|
|
77
|
+
height: number;
|
|
78
|
+
};
|
|
79
|
+
}[]): {
|
|
80
|
+
width: number;
|
|
81
|
+
height: number;
|
|
82
|
+
} | null;
|
|
83
|
+
|
|
84
|
+
/** Twips per inch, as OOXML defines them. */
|
|
85
|
+
declare const TWIPS_PER_INCH = 1440;
|
|
86
|
+
/** Twips per centimetre, as Word rounds them. */
|
|
87
|
+
declare const TWIPS_PER_CM = 567;
|
|
88
|
+
/** Word snaps ruler drags to the eighth-inch grid its ticks already draw. */
|
|
89
|
+
declare const SNAP_TWIPS_INCH: number;
|
|
90
|
+
/** The centimetre ruler's grid is the millimetre. */
|
|
91
|
+
declare const SNAP_TWIPS_CM: number;
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* The four handles Word's ruler carries.
|
|
95
|
+
*
|
|
96
|
+
* `hanging` and `left` sit at the SAME position and differ only in what a drag takes with
|
|
97
|
+
* them — the box moves the whole paragraph, the triangle leaves the first line where it is.
|
|
98
|
+
*/
|
|
99
|
+
type RulerIndentHandle = 'firstLine' | 'hanging' | 'left' | 'right';
|
|
100
|
+
/** A paragraph's indent as the ruler works with it. Twips; `firstLine` signed. */
|
|
101
|
+
interface RulerIndent {
|
|
102
|
+
readonly left: number;
|
|
103
|
+
readonly right: number;
|
|
104
|
+
readonly firstLine: number;
|
|
105
|
+
}
|
|
106
|
+
/** The page the handles are placed against. Twips. */
|
|
107
|
+
interface RulerPageMetrics {
|
|
108
|
+
readonly pageWidth: number;
|
|
109
|
+
readonly leftMargin: number;
|
|
110
|
+
readonly rightMargin: number;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* How a ruler drag resolves: which grid it snaps to, and whether it snaps at all.
|
|
114
|
+
*
|
|
115
|
+
* @public
|
|
116
|
+
*/
|
|
117
|
+
interface RulerDragOptions {
|
|
118
|
+
/** Which snap grid applies. Defaults to inches. */
|
|
119
|
+
readonly unit?: RulerUnit;
|
|
120
|
+
/** Alt held: continuous, twip-precision drag, bypassing the snap grid — as in Word. */
|
|
121
|
+
readonly precise?: boolean;
|
|
122
|
+
}
|
|
123
|
+
/** Where a handle sits, in twips from the page's LEFT SHEET EDGE (not the margin). */
|
|
124
|
+
declare function handlePosition(handle: RulerIndentHandle, indent: RulerIndent, page: RulerPageMetrics): number;
|
|
125
|
+
/** Round to the ruler's grid, or to the twip when the drag is precise. */
|
|
126
|
+
declare function snapTwips(value: number, unit: RulerUnit, precise: boolean): number;
|
|
127
|
+
/**
|
|
128
|
+
* The indent a drag of `handle` to `positionTwips` produces.
|
|
129
|
+
*
|
|
130
|
+
* Clamps differ from the MARGIN drags this ruler also carries, and deliberately:
|
|
131
|
+
*
|
|
132
|
+
* - Indents may go NEGATIVE, pulling text into the margin, which Word allows. The floor is
|
|
133
|
+
* the sheet edge, not the margin.
|
|
134
|
+
* - There is no minimum text width. The 720-twip floor the margin drags use mirrors an
|
|
135
|
+
* engine refusal that does not exist for indents, and enforcing one here would make a
|
|
136
|
+
* narrow pull-quote unreachable. Left and right markers may MEET; they may not cross.
|
|
137
|
+
* - The left box needs a first-line clamp of its own. It does not move `firstLine`, so on a
|
|
138
|
+
* hanging paragraph dragging the box left can push the first-line marker off the sheet
|
|
139
|
+
* while the box itself is still in range. The drag stops when the LEADING marker lands.
|
|
140
|
+
*/
|
|
141
|
+
declare function dragIndent(handle: RulerIndentHandle, positionTwips: number, indent: RulerIndent, page: RulerPageMetrics, options?: RulerDragOptions): RulerIndent;
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Mount a paginated surface over DOCX bytes.
|
|
145
|
+
*
|
|
146
|
+
* Returns a typed rejection rather than throwing: a failure here is a property of the file,
|
|
147
|
+
* and a host must be able to tell "not a package" from "no body" without parsing an error
|
|
148
|
+
* message.
|
|
149
|
+
*/
|
|
150
|
+
declare function mountPaginatedSurface(container: HTMLElement, bytes: Uint8Array, options?: PaginatedSurfaceOptions): OpenPaginatedResult;
|
|
151
|
+
|
|
152
|
+
/** Planner-backed can/plan pair — production gate for table commands. Task 9 maps chrome slots. */
|
|
153
|
+
declare function tableCommandState(command: EditorCommand, surface: PaginatedSurface): {
|
|
154
|
+
readonly can: CanResult;
|
|
155
|
+
readonly plan: TableCommandPlan;
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* What a browser host can do.
|
|
160
|
+
*
|
|
161
|
+
* `selection`, `scrolling` and `layout` are true because a mounted editor genuinely has a
|
|
162
|
+
* caret, a scroll container and paginated layout — a consumer may branch on them. The
|
|
163
|
+
* DOCUMENT operations behave identically to the headless host regardless; the extra
|
|
164
|
+
* capabilities widen what may be asked later, never what an existing operation means.
|
|
165
|
+
*/
|
|
166
|
+
declare const BROWSER_AUTOMATION_CAPABILITIES: AutomationCapabilities;
|
|
167
|
+
/**
|
|
168
|
+
* An automation host over a live editor.
|
|
169
|
+
*
|
|
170
|
+
* The editor keeps its own lifetime: `dispose()` on the returned host releases the change
|
|
171
|
+
* subscription this adapter took and leaves the editor mounted and editable.
|
|
172
|
+
*/
|
|
173
|
+
declare function createBrowserAutomationHost(editor: DocxEditorInstance): AutomationHost;
|
|
174
|
+
|
|
175
|
+
/** Clamp and validate an OOXML theme modifier fraction (0, 1]. */
|
|
176
|
+
declare function validateThemeModifier(value: unknown): value is number;
|
|
177
|
+
/** Blend toward white. `keep` is the fraction of the base colour retained (OOXML themeTint byte). */
|
|
178
|
+
declare function applyThemeTint(hex: string, keep: number): string;
|
|
179
|
+
/** Blend toward black. `keep` is the fraction of the base colour retained (OOXML themeShade byte). */
|
|
180
|
+
declare function applyThemeShade(hex: string, keep: number): string;
|
|
181
|
+
/** Resolve a theme colour to literal hex. When both tint and shade are present, ECMA-376
|
|
182
|
+
* §17.3.2.6 / §17.3.4 / §17.3.5 require tint precedence — shade is ignored for paint. */
|
|
183
|
+
declare function resolveThemeColorHex(color: Extract<ColorValue, {
|
|
184
|
+
kind: 'theme';
|
|
185
|
+
}>, themeColors: readonly DocumentThemeColorEntry[]): {
|
|
186
|
+
ok: true;
|
|
187
|
+
hex: string;
|
|
188
|
+
} | {
|
|
189
|
+
ok: false;
|
|
190
|
+
reason: string;
|
|
191
|
+
};
|
|
192
|
+
type ColorLowerRefusal = {
|
|
193
|
+
readonly ok: false;
|
|
194
|
+
readonly reason: string;
|
|
195
|
+
};
|
|
196
|
+
/**
|
|
197
|
+
* A public colour lowered for a border or fill op, or the reason it could not be.
|
|
198
|
+
*
|
|
199
|
+
* Refusals happen because paint needs a literal: a theme colour the document's theme does not
|
|
200
|
+
* define has no hex to draw, and inventing one would show a border in a colour the file never
|
|
201
|
+
* named.
|
|
202
|
+
*/
|
|
203
|
+
type ColorLowerResult = {
|
|
204
|
+
readonly ok: true;
|
|
205
|
+
readonly color: TreeDocColorValue;
|
|
206
|
+
} | ColorLowerRefusal;
|
|
207
|
+
/**
|
|
208
|
+
* Lower a public colour for table border ops. Theme colours require a resolved literal for
|
|
209
|
+
* paint; `auto` preserves OOXML automatic semantics with a black render fallback.
|
|
210
|
+
*/
|
|
211
|
+
declare function lowerColorValueForBorder(color: ColorValue, themeColors: readonly DocumentThemeColorEntry[]): ColorLowerResult;
|
|
212
|
+
/**
|
|
213
|
+
* Lower a public colour for cell fill. `auto` refuses because the cascade literal
|
|
214
|
+
* cannot be named honestly at commit time.
|
|
215
|
+
*/
|
|
216
|
+
declare function lowerColorValueForFill(color: ColorValue, themeColors: readonly DocumentThemeColorEntry[]): ColorLowerResult;
|
|
217
|
+
/** Resolve any public colour to a CSS `#RRGGBB` string for chrome display. */
|
|
218
|
+
declare function resolveColorValueToCss(color: ColorValue | undefined | null, themeColors: readonly DocumentThemeColorEntry[], defaultHex?: string): string;
|
|
219
|
+
|
|
220
|
+
/** Surface sizing derived from layout records, in layout points (not CSS pixels). */
|
|
221
|
+
interface SurfaceExtent {
|
|
222
|
+
/** Width the surface container should occupy. */
|
|
223
|
+
readonly width: number;
|
|
224
|
+
/** Total document height (always from every page, for scroll extent). */
|
|
225
|
+
readonly height: number;
|
|
226
|
+
/**
|
|
227
|
+
* Extra horizontal offset per page, in layout points, so narrower sheets centre inside a
|
|
228
|
+
* mixed-width materialized window. Absent entries mean no offset beyond layout `box.x`.
|
|
229
|
+
*/
|
|
230
|
+
readonly pageOffsetX: ReadonlyMap<number, number>;
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* How wide and tall the paginated surface should be.
|
|
234
|
+
*
|
|
235
|
+
* When `materialize` is set — virtualization is active — width follows only those pages so a
|
|
236
|
+
* distant landscape section does not stretch a portrait viewport. Without it (print, export,
|
|
237
|
+
* tests with no scroller) every page contributes, which is the safe reading.
|
|
238
|
+
*/
|
|
239
|
+
declare function surfaceExtent(layout: SemanticLayout, materialize: ReadonlySet<number> | undefined): SurfaceExtent;
|
|
240
|
+
|
|
241
|
+
/** Validate a position input, refusing offsets or bases outside what OOXML allows. */
|
|
242
|
+
declare function validateDrawingPositionInput(position: DrawingPositionInput): boolean;
|
|
243
|
+
/** Legal `relativeFrom` bases for a horizontal offset (page, margin, column, character, …). */
|
|
244
|
+
declare const DRAWING_REL_FROM_H: readonly string[];
|
|
245
|
+
/** Legal `relativeFrom` bases for a vertical offset (page, margin, paragraph, line, …). */
|
|
246
|
+
declare const DRAWING_REL_FROM_V: readonly string[];
|
|
247
|
+
/** Whether an image-properties command carries any positioning fields at all. */
|
|
248
|
+
declare function propertiesCommandHasPositionFields(command: {
|
|
249
|
+
readonly horizontalEmu?: number;
|
|
250
|
+
readonly verticalEmu?: number;
|
|
251
|
+
readonly relativeToH?: string;
|
|
252
|
+
readonly relativeToV?: string;
|
|
253
|
+
}): boolean;
|
|
254
|
+
/** Extract the position input from an image-properties command, or null when it carries none. */
|
|
255
|
+
declare function positionInputFromPropertiesCommand(command: {
|
|
256
|
+
readonly horizontalEmu?: number;
|
|
257
|
+
readonly verticalEmu?: number;
|
|
258
|
+
readonly relativeToH?: string;
|
|
259
|
+
readonly relativeToV?: string;
|
|
260
|
+
}, selected: {
|
|
261
|
+
readonly position?: DrawingPositionInput | null;
|
|
262
|
+
} | null): DrawingPositionInput;
|
|
263
|
+
/** Validate a set-position command before it reaches the store. */
|
|
264
|
+
declare function validateSetImagePositionCommand(command: {
|
|
265
|
+
readonly horizontalEmu?: number;
|
|
266
|
+
readonly verticalEmu?: number;
|
|
267
|
+
readonly relativeToH?: string;
|
|
268
|
+
readonly relativeToV?: string;
|
|
269
|
+
}, mode: 'frame' | 'simple'): boolean;
|
|
270
|
+
|
|
271
|
+
export { BROWSER_AUTOMATION_CAPABILITIES, type ColorLowerResult, DRAWING_REL_FROM_H, DRAWING_REL_FROM_V, DocxEditorInstance, DrawingPositionInput, OpenPaginatedResult, PX_PER_CM, PX_PER_INCH, PaginatedSurface, PaginatedSurfaceOptions, type RulerDragOptions, type RulerIndent, type RulerIndentHandle, type RulerPageMetrics, type RulerTick, type RulerUnit, SNAP_TWIPS_CM, SNAP_TWIPS_INCH, type SurfaceExtent, TWIPS_PER_CM, TWIPS_PER_INCH, applyThemeShade, applyThemeTint, createBrowserAutomationHost, createLayoutShaping, disposeLayoutShaping, dragIndent, generateRulerTicks, handlePosition, lowerColorValueForBorder, lowerColorValueForFill, mountPaginatedSurface, positionInputFromPropertiesCommand, propertiesCommandHasPositionFields, resolveColorValueToCss, resolveThemeColorHex, rulerPageBox, snapTwips, surfaceExtent, tableCommandState, toEditorFontError, validateDrawingPositionInput, validateSetImagePositionCommand, validateThemeModifier };
|
package/dist/editor.d.ts
ADDED
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
import { F as FontConfiguration, E as EditorFontError, a as EditorCommand, C as CanResult } from './editor-C1QRi1v4.js';
|
|
2
|
+
export { I as ImageContext, b as ImageCropPercent, c as ImageCropPermille, S as SelectedImageState, d as cropPercentFromCropPermille, e as cropPercentFromPermille, f as cropPercentFromSourceCrop, g as cropPermilleFromCropPercent, h as cropPermilleFromPercent, s as sourceCropFromCropPercent, v as validateImageCropPercent } from './editor-C1QRi1v4.js';
|
|
3
|
+
import { L as LayoutShapingOptions } from './shaped-measurer-B-TAtcQU.js';
|
|
4
|
+
import { P as PaginatedSurfaceOptions, O as OpenPaginatedResult, a as PaginatedSurface, T as TableCommandPlan, D as DocxEditorInstance } from './index-ZqBEOrTV.js';
|
|
5
|
+
export { A as AnchorFrameOrigin, C as CHROME_GROUPS, b as CHROME_MENUS, c as CHROME_UNAVAILABLE_KEY, d as ChromeControl, e as ChromeControlId, f as ChromeControlState, g as ChromeGroup, h as ChromeGroupId, i as ChromeMenu, j as ChromeMenuEntry, k as ChromeMenuId, l as ChromeMenuItemEntry, m as ChromeMenuSeparatorEntry, n as ChromeMenuSubmenuEntry, o as ChromeSlotId, p as DEFAULT_TABLE_CHROME_DRAFT, q as DocxEditorConfig, E as EMU_PER_POINT, F as FinalizedImageOverlayInteraction, r as FontConfigurationBase, s as FontConfigurationFragment, t as FontLoadFailure, u as FontLoadFailureReason, v as FontMeasurementState, w as FontResolutionRequest, x as FontResolver, y as FontUrlSource, H as HyperlinkActivation, z as HyperlinkChromeHandlers, B as HyperlinkOps, I as IMAGE_OVERLAY_NUDGE_PT, G as IMAGE_OVERLAY_NUDGE_SHIFT_PT, J as ImageInteractionSession, K as ImageOverlayScrollPort, L as ImageResizeHandle, M as ImageResizeResult, N as LoadFontsRequest, Q as LoadFontsResult, R as MAX_RESOLVER_FAMILIES, S as OverlayFrameRect, U as PaginatedSurfaceState, V as RunTableChromeCommandResult, W as SelectedDrawingOverlayTarget, X as SurfaceFormatting, Y as SurfaceHyperlink, Z as SurfaceNavigation, _ as SurfaceOverlayCoordinates, $ as TABLE_BORDER_STYLE_OPTIONS, a0 as TABLE_BORDER_TARGET_OPTIONS, a1 as TABLE_BORDER_WIDTH_OPTIONS, a2 as TABLE_CHROME_SLOT_IDS, a3 as TableBorderStyleOption, a4 as TableBorderTargetOption, a5 as TableBorderTargetValue, a6 as TableBorderWidthOption, a7 as TableChromeDraft, a8 as TableChromePick, a9 as TableChromeSlotId, aa as TableInteractionLabelKey, ab as ToolbarCommandState, ac as WORD_DEFAULT_FONT, ad as applyTableChromePick, ae as blankDocumentBytes, af as canExecuteImageCommand, ag as captureImageMutationPreconditions, ah as chromeControlCount, ai as chromeMenuSlots, aj as chromeProbeForSlot, ak as chromeSlotId, al as commandForSlot, am as commandForSlotValue, an as commandForTableChromeSlotValue, ao as composeFontConfiguration, ap as computeImageResizeResult, aq as computeMovedImagePosition, ar as computeResizedImageExtentEmu, as as createDocxEditor, at as createFontSource, au as createImageOverlayScrollPort, av as cssPixelsToLayoutPoints, aw as defaultChromeGroups, ax as defaultTableLabel, ay as emuToOverlayPoints, az as executeImageCommand, aA as finalizeImageOverlayInteraction, aB as formattingBarChromeGroups, aC as isStaleImageInteractionCommit, aD as isTableChromeSlot, aE as layoutPointsToCssPixels, aF as loadFonts, aG as overlayFrameToSheetCssPixels, aH as pointsToEmu, aI as probeTableChromeCommand, aJ as resizePreservesAspect, aK as runSave, aL as runTableChromeCommand, aM as runTableCommand, aN as runToolbarCommand, aO as selectedDrawingOverlayTargetOf, aP as selectedImageStateOf, aQ as surfacePaintScale, aR as tableChromeIconPaths, aS as tableChromeLabelKeyForTarget, aT as tableChromeToolbarState, aU as tableChromeVisible, aV as tableCommandToolbarState, aW as toolbarCommandState, aX as toolbarCommandStates } from './index-ZqBEOrTV.js';
|
|
6
|
+
import { A as AutomationCapabilities, a as AutomationHost } from './protocol-oxHaWmt4.js';
|
|
7
|
+
export { CollectReviewItems, EditorModule, EditorModuleRegistry, ReviewModuleContribution, resolveEditorModules } from './contracts/modules.js';
|
|
8
|
+
import { ColorValue } from './contracts/types.js';
|
|
9
|
+
import { h as TreeDocColorValue, d as DrawingPositionInput } from './tree-op-types-CwOeiaQ8.js';
|
|
10
|
+
export { i as IMAGE_WRAP_TARGETS, b as ImageWrapTarget } from './tree-op-types-CwOeiaQ8.js';
|
|
11
|
+
import { f as DocumentThemeColorEntry } from './tree-session-CiUel5Kz.js';
|
|
12
|
+
import { S as SemanticLayout } from './semantic-records-CWodBJsz.js';
|
|
13
|
+
export { T as TextMeasurer } from './semantic-records-CWodBJsz.js';
|
|
14
|
+
export { D as DEFAULT_IMAGE_RESOURCE_LIMITS, b as ImageDecodePort, c as ImageResourceLimits, R as RenderableImageMime, S as SupportedImageMime, a as VectorImageMime, r as resolveImageResourceLimits, d as resolveSvgIntrinsicSize, s as sniffImageMime, v as validateRasterHeader } from './image-resources-BJnTpG66.js';
|
|
15
|
+
export { S as SectionProperties } from './semantic-cell-selection-DsmHmLJ5.js';
|
|
16
|
+
export { R as ReviewModelInput } from './review-support-Fy3vdIea.js';
|
|
17
|
+
export { N as NavigationCommand, S as SemanticPosition, a as SemanticSelection } from './semantic-interaction-Dy-dCUFF.js';
|
|
18
|
+
import './contracts/document.js';
|
|
19
|
+
import './revision-projection-DHAkcD_L.js';
|
|
20
|
+
import './ooxml-tree-BU0e3DVi.js';
|
|
21
|
+
import './note-properties-m75hmP70.js';
|
|
22
|
+
import './ooxml-package-D_CtywTW.js';
|
|
23
|
+
import './tree-package-store-D5S7VKs5.js';
|
|
24
|
+
import './hf-references-BdjsQNE_.js';
|
|
25
|
+
import './note-nodes-BPSTVDMr.js';
|
|
26
|
+
import './tree-store-hLtjeyWE.js';
|
|
27
|
+
import './semantic-paint-drawings-BA3z9jl8.js';
|
|
28
|
+
import 'prosemirror-model';
|
|
29
|
+
|
|
30
|
+
interface LayoutShapingInstrumentation {
|
|
31
|
+
readonly onFontByteCopy?: () => void;
|
|
32
|
+
readonly onFontHash?: () => void;
|
|
33
|
+
readonly onFontAdmission?: () => void;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Normalize anything thrown during font work into an {@link EditorFontError}.
|
|
37
|
+
*
|
|
38
|
+
* One error type reaches consumers whether the failure came from resolution, admission or
|
|
39
|
+
* shaping, so a host branches on `code` rather than on which layer happened to throw.
|
|
40
|
+
*/
|
|
41
|
+
declare function toEditorFontError(error: unknown): EditorFontError;
|
|
42
|
+
/** Adapt the published byte-source contract to the private deterministic layout snapshot. */
|
|
43
|
+
declare function createLayoutShaping(configuration: FontConfiguration, instrumentation?: LayoutShapingInstrumentation): Promise<LayoutShapingOptions>;
|
|
44
|
+
/**
|
|
45
|
+
* Release a shaping environment's native resources.
|
|
46
|
+
*
|
|
47
|
+
* The shaper holds WASM memory that garbage collection cannot reclaim on its own, so a host that
|
|
48
|
+
* builds shaping options must dispose them when the editor goes away. Safe on a shaper that has
|
|
49
|
+
* no `dispose`.
|
|
50
|
+
*/
|
|
51
|
+
declare function disposeLayoutShaping(shaping: LayoutShapingOptions): void;
|
|
52
|
+
|
|
53
|
+
/** The engine paints at 96 px per inch (twips / 15, 1440 twips per inch). */
|
|
54
|
+
declare const PX_PER_INCH = 96;
|
|
55
|
+
/** Painted pixels per centimetre, derived from {@link PX_PER_INCH}. */
|
|
56
|
+
declare const PX_PER_CM: number;
|
|
57
|
+
/** Which measurement system the ruler shows. Drives both tick cadence and drag snapping. */
|
|
58
|
+
type RulerUnit = 'inch' | 'cm';
|
|
59
|
+
/** One tick on the ruler: where it sits, how tall it is, and its label if it carries one. */
|
|
60
|
+
interface RulerTick {
|
|
61
|
+
/** Offset along the ruler in content pixels. */
|
|
62
|
+
readonly position: number;
|
|
63
|
+
readonly height: number;
|
|
64
|
+
/** Whole-unit label, omitted at the origin and on minor ticks. */
|
|
65
|
+
readonly label?: string;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Ticks across one page dimension, matching the legacy cadence: eighth-inch
|
|
69
|
+
* minors with labelled inches, or millimetre minors with labelled centimetres.
|
|
70
|
+
*/
|
|
71
|
+
declare function generateRulerTicks(lengthPx: number, unit: RulerUnit): RulerTick[];
|
|
72
|
+
/** The first page's box, which the rulers measure against. */
|
|
73
|
+
declare function rulerPageBox(pages: readonly {
|
|
74
|
+
readonly index: number;
|
|
75
|
+
readonly box: {
|
|
76
|
+
width: number;
|
|
77
|
+
height: number;
|
|
78
|
+
};
|
|
79
|
+
}[]): {
|
|
80
|
+
width: number;
|
|
81
|
+
height: number;
|
|
82
|
+
} | null;
|
|
83
|
+
|
|
84
|
+
/** Twips per inch, as OOXML defines them. */
|
|
85
|
+
declare const TWIPS_PER_INCH = 1440;
|
|
86
|
+
/** Twips per centimetre, as Word rounds them. */
|
|
87
|
+
declare const TWIPS_PER_CM = 567;
|
|
88
|
+
/** Word snaps ruler drags to the eighth-inch grid its ticks already draw. */
|
|
89
|
+
declare const SNAP_TWIPS_INCH: number;
|
|
90
|
+
/** The centimetre ruler's grid is the millimetre. */
|
|
91
|
+
declare const SNAP_TWIPS_CM: number;
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* The four handles Word's ruler carries.
|
|
95
|
+
*
|
|
96
|
+
* `hanging` and `left` sit at the SAME position and differ only in what a drag takes with
|
|
97
|
+
* them — the box moves the whole paragraph, the triangle leaves the first line where it is.
|
|
98
|
+
*/
|
|
99
|
+
type RulerIndentHandle = 'firstLine' | 'hanging' | 'left' | 'right';
|
|
100
|
+
/** A paragraph's indent as the ruler works with it. Twips; `firstLine` signed. */
|
|
101
|
+
interface RulerIndent {
|
|
102
|
+
readonly left: number;
|
|
103
|
+
readonly right: number;
|
|
104
|
+
readonly firstLine: number;
|
|
105
|
+
}
|
|
106
|
+
/** The page the handles are placed against. Twips. */
|
|
107
|
+
interface RulerPageMetrics {
|
|
108
|
+
readonly pageWidth: number;
|
|
109
|
+
readonly leftMargin: number;
|
|
110
|
+
readonly rightMargin: number;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* How a ruler drag resolves: which grid it snaps to, and whether it snaps at all.
|
|
114
|
+
*
|
|
115
|
+
* @public
|
|
116
|
+
*/
|
|
117
|
+
interface RulerDragOptions {
|
|
118
|
+
/** Which snap grid applies. Defaults to inches. */
|
|
119
|
+
readonly unit?: RulerUnit;
|
|
120
|
+
/** Alt held: continuous, twip-precision drag, bypassing the snap grid — as in Word. */
|
|
121
|
+
readonly precise?: boolean;
|
|
122
|
+
}
|
|
123
|
+
/** Where a handle sits, in twips from the page's LEFT SHEET EDGE (not the margin). */
|
|
124
|
+
declare function handlePosition(handle: RulerIndentHandle, indent: RulerIndent, page: RulerPageMetrics): number;
|
|
125
|
+
/** Round to the ruler's grid, or to the twip when the drag is precise. */
|
|
126
|
+
declare function snapTwips(value: number, unit: RulerUnit, precise: boolean): number;
|
|
127
|
+
/**
|
|
128
|
+
* The indent a drag of `handle` to `positionTwips` produces.
|
|
129
|
+
*
|
|
130
|
+
* Clamps differ from the MARGIN drags this ruler also carries, and deliberately:
|
|
131
|
+
*
|
|
132
|
+
* - Indents may go NEGATIVE, pulling text into the margin, which Word allows. The floor is
|
|
133
|
+
* the sheet edge, not the margin.
|
|
134
|
+
* - There is no minimum text width. The 720-twip floor the margin drags use mirrors an
|
|
135
|
+
* engine refusal that does not exist for indents, and enforcing one here would make a
|
|
136
|
+
* narrow pull-quote unreachable. Left and right markers may MEET; they may not cross.
|
|
137
|
+
* - The left box needs a first-line clamp of its own. It does not move `firstLine`, so on a
|
|
138
|
+
* hanging paragraph dragging the box left can push the first-line marker off the sheet
|
|
139
|
+
* while the box itself is still in range. The drag stops when the LEADING marker lands.
|
|
140
|
+
*/
|
|
141
|
+
declare function dragIndent(handle: RulerIndentHandle, positionTwips: number, indent: RulerIndent, page: RulerPageMetrics, options?: RulerDragOptions): RulerIndent;
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Mount a paginated surface over DOCX bytes.
|
|
145
|
+
*
|
|
146
|
+
* Returns a typed rejection rather than throwing: a failure here is a property of the file,
|
|
147
|
+
* and a host must be able to tell "not a package" from "no body" without parsing an error
|
|
148
|
+
* message.
|
|
149
|
+
*/
|
|
150
|
+
declare function mountPaginatedSurface(container: HTMLElement, bytes: Uint8Array, options?: PaginatedSurfaceOptions): OpenPaginatedResult;
|
|
151
|
+
|
|
152
|
+
/** Planner-backed can/plan pair — production gate for table commands. Task 9 maps chrome slots. */
|
|
153
|
+
declare function tableCommandState(command: EditorCommand, surface: PaginatedSurface): {
|
|
154
|
+
readonly can: CanResult;
|
|
155
|
+
readonly plan: TableCommandPlan;
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* What a browser host can do.
|
|
160
|
+
*
|
|
161
|
+
* `selection`, `scrolling` and `layout` are true because a mounted editor genuinely has a
|
|
162
|
+
* caret, a scroll container and paginated layout — a consumer may branch on them. The
|
|
163
|
+
* DOCUMENT operations behave identically to the headless host regardless; the extra
|
|
164
|
+
* capabilities widen what may be asked later, never what an existing operation means.
|
|
165
|
+
*/
|
|
166
|
+
declare const BROWSER_AUTOMATION_CAPABILITIES: AutomationCapabilities;
|
|
167
|
+
/**
|
|
168
|
+
* An automation host over a live editor.
|
|
169
|
+
*
|
|
170
|
+
* The editor keeps its own lifetime: `dispose()` on the returned host releases the change
|
|
171
|
+
* subscription this adapter took and leaves the editor mounted and editable.
|
|
172
|
+
*/
|
|
173
|
+
declare function createBrowserAutomationHost(editor: DocxEditorInstance): AutomationHost;
|
|
174
|
+
|
|
175
|
+
/** Clamp and validate an OOXML theme modifier fraction (0, 1]. */
|
|
176
|
+
declare function validateThemeModifier(value: unknown): value is number;
|
|
177
|
+
/** Blend toward white. `keep` is the fraction of the base colour retained (OOXML themeTint byte). */
|
|
178
|
+
declare function applyThemeTint(hex: string, keep: number): string;
|
|
179
|
+
/** Blend toward black. `keep` is the fraction of the base colour retained (OOXML themeShade byte). */
|
|
180
|
+
declare function applyThemeShade(hex: string, keep: number): string;
|
|
181
|
+
/** Resolve a theme colour to literal hex. When both tint and shade are present, ECMA-376
|
|
182
|
+
* §17.3.2.6 / §17.3.4 / §17.3.5 require tint precedence — shade is ignored for paint. */
|
|
183
|
+
declare function resolveThemeColorHex(color: Extract<ColorValue, {
|
|
184
|
+
kind: 'theme';
|
|
185
|
+
}>, themeColors: readonly DocumentThemeColorEntry[]): {
|
|
186
|
+
ok: true;
|
|
187
|
+
hex: string;
|
|
188
|
+
} | {
|
|
189
|
+
ok: false;
|
|
190
|
+
reason: string;
|
|
191
|
+
};
|
|
192
|
+
type ColorLowerRefusal = {
|
|
193
|
+
readonly ok: false;
|
|
194
|
+
readonly reason: string;
|
|
195
|
+
};
|
|
196
|
+
/**
|
|
197
|
+
* A public colour lowered for a border or fill op, or the reason it could not be.
|
|
198
|
+
*
|
|
199
|
+
* Refusals happen because paint needs a literal: a theme colour the document's theme does not
|
|
200
|
+
* define has no hex to draw, and inventing one would show a border in a colour the file never
|
|
201
|
+
* named.
|
|
202
|
+
*/
|
|
203
|
+
type ColorLowerResult = {
|
|
204
|
+
readonly ok: true;
|
|
205
|
+
readonly color: TreeDocColorValue;
|
|
206
|
+
} | ColorLowerRefusal;
|
|
207
|
+
/**
|
|
208
|
+
* Lower a public colour for table border ops. Theme colours require a resolved literal for
|
|
209
|
+
* paint; `auto` preserves OOXML automatic semantics with a black render fallback.
|
|
210
|
+
*/
|
|
211
|
+
declare function lowerColorValueForBorder(color: ColorValue, themeColors: readonly DocumentThemeColorEntry[]): ColorLowerResult;
|
|
212
|
+
/**
|
|
213
|
+
* Lower a public colour for cell fill. `auto` refuses because the cascade literal
|
|
214
|
+
* cannot be named honestly at commit time.
|
|
215
|
+
*/
|
|
216
|
+
declare function lowerColorValueForFill(color: ColorValue, themeColors: readonly DocumentThemeColorEntry[]): ColorLowerResult;
|
|
217
|
+
/** Resolve any public colour to a CSS `#RRGGBB` string for chrome display. */
|
|
218
|
+
declare function resolveColorValueToCss(color: ColorValue | undefined | null, themeColors: readonly DocumentThemeColorEntry[], defaultHex?: string): string;
|
|
219
|
+
|
|
220
|
+
/** Surface sizing derived from layout records, in layout points (not CSS pixels). */
|
|
221
|
+
interface SurfaceExtent {
|
|
222
|
+
/** Width the surface container should occupy. */
|
|
223
|
+
readonly width: number;
|
|
224
|
+
/** Total document height (always from every page, for scroll extent). */
|
|
225
|
+
readonly height: number;
|
|
226
|
+
/**
|
|
227
|
+
* Extra horizontal offset per page, in layout points, so narrower sheets centre inside a
|
|
228
|
+
* mixed-width materialized window. Absent entries mean no offset beyond layout `box.x`.
|
|
229
|
+
*/
|
|
230
|
+
readonly pageOffsetX: ReadonlyMap<number, number>;
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* How wide and tall the paginated surface should be.
|
|
234
|
+
*
|
|
235
|
+
* When `materialize` is set — virtualization is active — width follows only those pages so a
|
|
236
|
+
* distant landscape section does not stretch a portrait viewport. Without it (print, export,
|
|
237
|
+
* tests with no scroller) every page contributes, which is the safe reading.
|
|
238
|
+
*/
|
|
239
|
+
declare function surfaceExtent(layout: SemanticLayout, materialize: ReadonlySet<number> | undefined): SurfaceExtent;
|
|
240
|
+
|
|
241
|
+
/** Validate a position input, refusing offsets or bases outside what OOXML allows. */
|
|
242
|
+
declare function validateDrawingPositionInput(position: DrawingPositionInput): boolean;
|
|
243
|
+
/** Legal `relativeFrom` bases for a horizontal offset (page, margin, column, character, …). */
|
|
244
|
+
declare const DRAWING_REL_FROM_H: readonly string[];
|
|
245
|
+
/** Legal `relativeFrom` bases for a vertical offset (page, margin, paragraph, line, …). */
|
|
246
|
+
declare const DRAWING_REL_FROM_V: readonly string[];
|
|
247
|
+
/** Whether an image-properties command carries any positioning fields at all. */
|
|
248
|
+
declare function propertiesCommandHasPositionFields(command: {
|
|
249
|
+
readonly horizontalEmu?: number;
|
|
250
|
+
readonly verticalEmu?: number;
|
|
251
|
+
readonly relativeToH?: string;
|
|
252
|
+
readonly relativeToV?: string;
|
|
253
|
+
}): boolean;
|
|
254
|
+
/** Extract the position input from an image-properties command, or null when it carries none. */
|
|
255
|
+
declare function positionInputFromPropertiesCommand(command: {
|
|
256
|
+
readonly horizontalEmu?: number;
|
|
257
|
+
readonly verticalEmu?: number;
|
|
258
|
+
readonly relativeToH?: string;
|
|
259
|
+
readonly relativeToV?: string;
|
|
260
|
+
}, selected: {
|
|
261
|
+
readonly position?: DrawingPositionInput | null;
|
|
262
|
+
} | null): DrawingPositionInput;
|
|
263
|
+
/** Validate a set-position command before it reaches the store. */
|
|
264
|
+
declare function validateSetImagePositionCommand(command: {
|
|
265
|
+
readonly horizontalEmu?: number;
|
|
266
|
+
readonly verticalEmu?: number;
|
|
267
|
+
readonly relativeToH?: string;
|
|
268
|
+
readonly relativeToV?: string;
|
|
269
|
+
}, mode: 'frame' | 'simple'): boolean;
|
|
270
|
+
|
|
271
|
+
export { BROWSER_AUTOMATION_CAPABILITIES, type ColorLowerResult, DRAWING_REL_FROM_H, DRAWING_REL_FROM_V, DocxEditorInstance, DrawingPositionInput, OpenPaginatedResult, PX_PER_CM, PX_PER_INCH, PaginatedSurface, PaginatedSurfaceOptions, type RulerDragOptions, type RulerIndent, type RulerIndentHandle, type RulerPageMetrics, type RulerTick, type RulerUnit, SNAP_TWIPS_CM, SNAP_TWIPS_INCH, type SurfaceExtent, TWIPS_PER_CM, TWIPS_PER_INCH, applyThemeShade, applyThemeTint, createBrowserAutomationHost, createLayoutShaping, disposeLayoutShaping, dragIndent, generateRulerTicks, handlePosition, lowerColorValueForBorder, lowerColorValueForFill, mountPaginatedSurface, positionInputFromPropertiesCommand, propertiesCommandHasPositionFields, resolveColorValueToCss, resolveThemeColorHex, rulerPageBox, snapTwips, surfaceExtent, tableCommandState, toEditorFontError, validateDrawingPositionInput, validateSetImagePositionCommand, validateThemeModifier };
|
package/dist/editor.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{Da as BROWSER_AUTOMATION_CAPABILITIES,sa as CHROME_GROUPS,wa as CHROME_MENUS,za as CHROME_UNAVAILABLE_KEY,W as DEFAULT_TABLE_CHROME_DRAFT,O as EMU_PER_POINT,M as IMAGE_OVERLAY_NUDGE_PT,N as IMAGE_OVERLAY_NUDGE_SHIFT_PT,d as MAX_RESOLVER_FAMILIES,k as PX_PER_CM,j as PX_PER_INCH,q as SNAP_TWIPS_CM,p as SNAP_TWIPS_INCH,aa as TABLE_BORDER_STYLE_OPTIONS,$ as TABLE_BORDER_TARGET_OPTIONS,ba as TABLE_BORDER_WIDTH_OPTIONS,X as TABLE_CHROME_SLOT_IDS,o as TWIPS_PER_CM,n as TWIPS_PER_INCH,e as WORD_DEFAULT_FONT,ca as applyTableChromePick,w as applyThemeShade,v as applyThemeTint,g as blankDocumentBytes,K as canExecuteImageCommand,J as captureImageMutationPreconditions,ya as chromeControlCount,xa as chromeMenuSlots,ga as chromeProbeForSlot,ta as chromeSlotId,ha as commandForSlot,ja as commandForSlotValue,ia as commandForTableChromeSlotValue,f as composeFontConfiguration,Ka as computeImageResizeResult,T as computeMovedImagePosition,S as computeResizedImageExtentEmu,Ea as createBrowserAutomationHost,Ca as createDocxEditor,i as createFontSource,La as createImageOverlayScrollPort,b as createLayoutShaping,G as cropPercentFromCropPermille,E as cropPercentFromPermille,B as cropPercentFromSourceCrop,F as cropPermilleFromCropPercent,D as cropPermilleFromPercent,Ha as cssPixelsToLayoutPoints,ua as defaultChromeGroups,Y as defaultTableLabel,c as disposeLayoutShaping,t as dragIndent,R as emuToOverlayPoints,L as executeImageCommand,Ma as finalizeImageOverlayInteraction,va as formattingBarChromeGroups,l as generateRulerTicks,r as handlePosition,U as isStaleImageInteractionCommit,Z as isTableChromeSlot,Ga as layoutPointsToCssPixels,h as loadFonts,y as lowerColorValueForBorder,z as lowerColorValueForFill,Ba as mountPaginatedSurface,Ia as overlayFrameToSheetCssPixels,Q as pointsToEmu,da as probeTableChromeCommand,Ja as resizePreservesAspect,A as resolveColorValueToCss,x as resolveThemeColorHex,m as rulerPageBox,pa as runSave,na as runTableChromeCommand,ra as runTableCommand,oa as runToolbarCommand,P as selectedDrawingOverlayTargetOf,I as selectedImageStateOf,s as snapTwips,C as sourceCropFromCropPercent,Aa as surfaceExtent,Fa as surfacePaintScale,fa as tableChromeIconPaths,ea as tableChromeLabelKeyForTarget,ka as tableChromeToolbarState,_ as tableChromeVisible,V as tableCommandState,qa as tableCommandToolbarState,a as toEditorFontError,la as toolbarCommandState,ma as toolbarCommandStates,H as validateImageCropPercent,u as validateThemeModifier}from'./chunk-DLPL5DAG.js';import'./chunk-5KSCB2OZ.js';import'./chunk-HVAV2JSN.js';import'./chunk-PHDVKUWZ.js';import'./chunk-BSC44TIT.js';import'./chunk-ZUALAR4M.js';import'./chunk-DOEIARE2.js';export{D as DEFAULT_IMAGE_RESOURCE_LIMITS,Re as DRAWING_REL_FROM_H,Se as DRAWING_REL_FROM_V,Wa as IMAGE_WRAP_TARGETS,Ue as positionInputFromPropertiesCommand,Te as propertiesCommandHasPositionFields,E as resolveImageResourceLimits,mb as resolveSvgIntrinsicSize,ib as sniffImageMime,Qe as validateDrawingPositionInput,nb as validateRasterHeader,Ve as validateSetImagePositionCommand}from'./chunk-RNBHTPW7.js';import'./chunk-REZUWYB7.js';export{a as resolveEditorModules}from'./chunk-HR7K3W6A.js';
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { e as OoxmlPart, O as OoxmlNode, a as OoxmlElement } from './ooxml-tree-BU0e3DVi.js';
|
|
2
|
+
import { O as OoxmlPackage } from './ooxml-package-D_CtywTW.js';
|
|
3
|
+
|
|
4
|
+
/** `w:headerReference w:type` vocabulary (ECMA-376 §17.10.5): default, first page, even pages. */
|
|
5
|
+
type HeaderFooterVariant = 'default' | 'first' | 'even';
|
|
6
|
+
/** Header vs footer region kind for chrome and lifecycle ops. */
|
|
7
|
+
type HeaderFooterKind = 'header' | 'footer';
|
|
8
|
+
/**
|
|
9
|
+
* A section's resolved header and footer parts, by variant.
|
|
10
|
+
*
|
|
11
|
+
* The `even` variant is only honoured when `w:evenAndOddHeaders` is set in settings.xml —
|
|
12
|
+
* without it Word ignores an authored even header, and so does this.
|
|
13
|
+
*/
|
|
14
|
+
interface HeaderFooterParts {
|
|
15
|
+
readonly headers: ReadonlyMap<HeaderFooterVariant, OoxmlPart>;
|
|
16
|
+
readonly footers: ReadonlyMap<HeaderFooterVariant, OoxmlPart>;
|
|
17
|
+
/** `w:evenAndOddHeaders` in settings.xml — without it the `even` variant is ignored. */
|
|
18
|
+
readonly evenAndOddHeaders: boolean;
|
|
19
|
+
/** Whether this section enables first-page header/footer furniture (`w:titlePg`). */
|
|
20
|
+
readonly titlePage: boolean;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* One resolved furniture slot with enough metadata for "Same as previous" chrome.
|
|
24
|
+
*
|
|
25
|
+
* `inherited: true` means this section has no declared reference for the slot and the
|
|
26
|
+
* part comes from a predecessor. The first section never reports inherited — omitting a
|
|
27
|
+
* ref there is blank furniture, not inheritance from a later section.
|
|
28
|
+
*/
|
|
29
|
+
interface HeaderFooterSlotMeta {
|
|
30
|
+
readonly part: OoxmlPart;
|
|
31
|
+
readonly partName: string;
|
|
32
|
+
readonly rId: string;
|
|
33
|
+
readonly inherited: boolean;
|
|
34
|
+
}
|
|
35
|
+
/** Per-section resolution including declared-vs-inherited metadata. */
|
|
36
|
+
interface HeaderFooterSectionResolution {
|
|
37
|
+
readonly headers: ReadonlyMap<HeaderFooterVariant, HeaderFooterSlotMeta>;
|
|
38
|
+
readonly footers: ReadonlyMap<HeaderFooterVariant, HeaderFooterSlotMeta>;
|
|
39
|
+
readonly evenAndOddHeaders: boolean;
|
|
40
|
+
readonly titlePage: boolean;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* `w:sectPr` nodes in section order, aligned with layout's `enumerateDocumentSections`.
|
|
44
|
+
*
|
|
45
|
+
* `null` means a section with no `w:sectPr` node (Word defaults, inherits HF from previous).
|
|
46
|
+
* Paragraph-level breaks first; the final entry covers remaining blocks (body-level or null).
|
|
47
|
+
*/
|
|
48
|
+
declare function collectSectionPropertyNodes(root: OoxmlNode): Array<OoxmlElement | null>;
|
|
49
|
+
/**
|
|
50
|
+
* Resolve header/footer parts for every section with declared-vs-inherited metadata.
|
|
51
|
+
*
|
|
52
|
+
* Index aligns with `enumerateDocumentSections` in the layout package. Existing merged
|
|
53
|
+
* maps stay available via {@link resolveHeaderFooterPartsBySection}.
|
|
54
|
+
*/
|
|
55
|
+
declare function resolveHeaderFooterResolutionBySection(pkg: OoxmlPackage): readonly HeaderFooterSectionResolution[];
|
|
56
|
+
/**
|
|
57
|
+
* Resolve header/footer parts for every section, applying OOXML inheritance.
|
|
58
|
+
*
|
|
59
|
+
* Index aligns with `enumerateDocumentSections` in the layout package.
|
|
60
|
+
*/
|
|
61
|
+
declare function resolveHeaderFooterPartsBySection(pkg: OoxmlPackage): readonly HeaderFooterParts[];
|
|
62
|
+
/**
|
|
63
|
+
* Resolve the main-document header/footer references to their parts, gated by the
|
|
64
|
+
* settings the section actually declares.
|
|
65
|
+
*
|
|
66
|
+
* Returns the FINAL section's effective parts (after inheritance). Multi-section hosts
|
|
67
|
+
* should prefer `resolveHeaderFooterPartsBySection`.
|
|
68
|
+
*/
|
|
69
|
+
declare function resolveHeaderFooterParts(pkg: OoxmlPackage): HeaderFooterParts;
|
|
70
|
+
|
|
71
|
+
export { type HeaderFooterVariant as H, type HeaderFooterParts as a, type HeaderFooterSectionResolution as b, type HeaderFooterKind as c, type HeaderFooterSlotMeta as d, collectSectionPropertyNodes as e, resolveHeaderFooterPartsBySection as f, resolveHeaderFooterResolutionBySection as g, resolveHeaderFooterParts as r };
|