superdoc 2.29.0-next.9 → 2.30.0-next.4
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 +127 -25
- package/dist/chunks/{FindReplaceSurface-BKVHzhQ4.es.js → FindReplaceSurface-BEnRLpD9.es.js} +1 -1
- package/dist/chunks/{FindReplaceSurface-BNDrJ6VS.cjs → FindReplaceSurface-DWXgWgg7.cjs} +1 -1
- package/dist/chunks/{PasswordPromptSurface-6mF6Azda.es.js → PasswordPromptSurface-DjV1JgjD.es.js} +1 -1
- package/dist/chunks/{PasswordPromptSurface-BNkaztaP.cjs → PasswordPromptSurface-VFPnQOML.cjs} +1 -1
- package/dist/chunks/{PdfViewer-aOWhUVI7.es.js → PdfViewer-C2r-K8zC.es.js} +4 -10
- package/dist/chunks/{PdfViewer-DmSkZehl.cjs → PdfViewer-DYTbPVUr.cjs} +4 -10
- package/dist/chunks/{_plugin-vue_export-helper-6MBoygIY.cjs → _plugin-vue_export-helper-BzM2_tVU.cjs} +40 -7
- package/dist/chunks/{_plugin-vue_export-helper-CsJQtMvr.es.js → _plugin-vue_export-helper-CmkaJDnr.es.js} +23 -8
- package/dist/chunks/{create-super-doc-ui-DN70aatf.cjs → create-super-doc-ui--kQBNTyt.cjs} +2424 -2302
- package/dist/chunks/{create-super-doc-ui-Bm5kmx0W.es.js → create-super-doc-ui-CbEDXtpm.es.js} +2350 -2228
- package/dist/collaboration-upgrade-engine.cjs +1 -1
- package/dist/collaboration-upgrade-engine.es.js +1 -1
- package/dist/document-api/src/changes/changes.d.ts +26 -0
- package/dist/document-api/src/changes/changes.types.d.ts +156 -0
- package/dist/document-api/src/contract/command-catalog.d.ts +1 -1
- package/dist/document-api/src/contract/operation-definitions.d.ts +51 -1
- package/dist/document-api/src/create/create.d.ts +0 -4
- package/dist/document-api/src/diff/diff.types.d.ts +6 -6
- package/dist/document-api/src/header-footers/header-footers.d.ts +1 -3
- package/dist/document-api/src/index.d.ts +6 -0
- package/dist/document-api/src/inline-semantics/token-sets.d.ts +0 -2
- package/dist/document-api/src/insert/insert.d.ts +0 -1
- package/dist/layout-engine/contracts/src/index.d.ts +3 -1
- package/dist/layout-engine/dom-contract/src/data-attrs.d.ts +4 -0
- package/dist/layout-engine/layout-bridge/src/coupled-footnote-pagination.d.ts +1 -0
- package/dist/layout-engine/layout-bridge/src/footnote-page-certificate.d.ts +1 -0
- package/dist/layout-engine/layout-bridge/src/footnote-page-planner.d.ts +5 -0
- package/dist/layout-engine/layout-bridge/src/incrementalLayout.d.ts +1 -0
- package/dist/layout-engine/layout-engine/src/footnote-page-flow.d.ts +3 -0
- package/dist/layout-engine/layout-engine/src/index.d.ts +7 -0
- package/dist/layout-engine/layout-engine/src/layout-paragraph.d.ts +5 -0
- package/dist/layout-engine/layout-engine/src/layout-table.d.ts +3 -1
- package/dist/layout-engine/layout-engine/src/layout-utils.d.ts +0 -4
- package/dist/layout-engine/layout-engine/src/paginator.d.ts +4 -0
- package/dist/layout-engine/painters/dom/src/paragraph/list-marker.d.ts +1 -1
- package/dist/layout-engine/painters/dom/src/paragraph/renderParagraphContent.d.ts +1 -1
- package/dist/layout-engine/painters/dom/src/styles.d.ts +0 -10
- package/dist/layout-engine/painters/dom/src/svg-utils.d.ts +1 -13
- package/dist/public/ui-react.cjs +1 -1
- package/dist/public/ui-react.es.js +1 -1
- package/dist/public/ui-vue.cjs +1 -1
- package/dist/public/ui-vue.es.js +1 -1
- package/dist/public/ui.cjs +1 -1
- package/dist/public/ui.es.js +1 -1
- package/dist/shared/common/Telemetry.d.ts +50 -0
- package/dist/shared/common/event-types.d.ts +13 -0
- package/dist/shared/font-system/src/bundled-face-names.d.ts +1 -0
- package/dist/shared/font-system/src/resolver.d.ts +1 -0
- package/dist/style.css +1 -1
- package/dist/style.layered.css +1 -1
- package/dist/superdoc/src/components/CommentsLayer/CommentDialog.vue.d.ts +17 -33
- package/dist/superdoc/src/components/CommentsLayer/collect-removed-comment-ids.d.ts +11 -1
- package/dist/superdoc/src/components/CommentsLayer/collect-tracked-change-thread.d.ts +25 -6
- package/dist/superdoc/src/components/CommentsLayer/comment-params.d.ts +84 -0
- package/dist/superdoc/src/components/CommentsLayer/comment-urls.d.ts +1 -1
- package/dist/superdoc/src/components/CommentsLayer/commentsList/super-comments-list.d.ts +23 -20
- package/dist/superdoc/src/components/CommentsLayer/helpers.d.ts +1 -4
- package/dist/superdoc/src/components/CommentsLayer/tracked-change-threading.d.ts +16 -1
- package/dist/superdoc/src/components/CommentsLayer/use-comment.d.ts +15 -95
- package/dist/superdoc/src/components/Whiteboard/WhiteboardLayer.vue.d.ts +4 -5
- package/dist/superdoc/src/components/Whiteboard/WhiteboardPage.vue.d.ts +3 -4
- package/dist/superdoc/src/components/Whiteboard/use-whiteboard.d.ts +30 -9
- package/dist/superdoc/src/components/Whiteboard/whiteboard-types.d.ts +2 -0
- package/dist/superdoc/src/components/surfaces/watermark-surface-runtime.d.ts +7 -7
- package/dist/superdoc/src/composables/use-comment-small-screen.d.ts +11 -7
- package/dist/superdoc/src/composables/use-compact-comment-popover.d.ts +44 -18
- package/dist/superdoc/src/composables/use-document.d.ts +51 -99
- package/dist/superdoc/src/composables/use-find-replace.d.ts +13 -3
- package/dist/superdoc/src/composables/use-password-prompt.d.ts +1 -1
- package/dist/superdoc/src/composables/use-viewport-fit.d.ts +62 -26
- package/dist/superdoc/src/core/SuperDoc.d.ts +15 -6
- package/dist/superdoc/src/core/collaboration/cdn-collaboration-comment-map.d.ts +1 -0
- package/dist/superdoc/src/core/collaboration/collaboration-comment-map.d.ts +2 -0
- package/dist/superdoc/src/core/collaboration/helpers.d.ts +1 -1
- package/dist/superdoc/src/core/document-open-telemetry.d.ts +1 -1
- package/dist/superdoc/src/core/editor-runtime/v2/v2-editor-runtime-adapter.d.ts +1 -0
- package/dist/superdoc/src/core/pdf/pdf-adapter.d.ts +6 -2
- package/dist/superdoc/src/core/types/index.d.ts +108 -43
- package/dist/superdoc/src/core/v2-integration/browser-peer-runtime.d.ts +5 -3
- package/dist/superdoc/src/core/v2-integration/cdn-engine-loader.d.ts +3 -13
- package/dist/superdoc/src/core/v2-integration/internal-vue-runtime.d.ts +64 -59
- package/dist/superdoc/src/helpers/deprecation.d.ts +12 -3
- package/dist/superdoc/src/helpers/object-guards.d.ts +2 -0
- package/dist/superdoc/src/helpers/v2-author-required-rejection.d.ts +8 -11
- package/dist/superdoc/src/helpers/v2-bulk-decision-event.d.ts +9 -7
- package/dist/superdoc/src/helpers/v2-keyboard-edit-rejection.d.ts +8 -7
- package/dist/superdoc/src/helpers/v2-mutation-exception.d.ts +12 -8
- package/dist/superdoc/src/helpers/v2-review-geometry-delivery.d.ts +22 -0
- package/dist/superdoc/src/helpers/v2-review-target.d.ts +11 -1
- package/dist/superdoc/src/helpers/v2-selection-sync.d.ts +40 -14
- package/dist/superdoc/src/helpers/v2-typing-mutation-event.d.ts +14 -5
- package/dist/superdoc/src/icons.d.ts +11 -19
- package/dist/superdoc/src/internal/diagnostics/translate-diagnostic.d.ts +6 -4
- package/dist/superdoc/src/internal/toolbar/built-in/PageNumberMenu.vue.d.ts +25 -15
- package/dist/superdoc/src/internal/toolbar/built-in/ToolbarButton.vue.d.ts +1 -0
- package/dist/superdoc/src/internal/toolbar/built-in/constants.d.ts +3 -1
- package/dist/superdoc/src/internal/toolbar/built-in/font-options.d.ts +15 -1
- package/dist/superdoc/src/internal/toolbar/built-in/font-typeahead.d.ts +37 -7
- package/dist/superdoc/src/internal/toolbar/built-in/general.d.ts +12 -1
- package/dist/superdoc/src/internal/toolbar/built-in/helpers.d.ts +9 -4
- package/dist/superdoc/src/internal/toolbar/built-in/list-style-buttons.d.ts +2 -2
- package/dist/superdoc/src/internal/toolbar/built-in/page-number-feedback.d.ts +4 -5
- package/dist/superdoc/src/internal/toolbar/built-in/scroll-helpers.d.ts +3 -4
- package/dist/superdoc/src/internal/toolbar/built-in/toolbarIcons.d.ts +78 -145
- package/dist/superdoc/src/internal/toolbar/built-in/url-safety.d.ts +11 -3
- package/dist/superdoc/src/internal/toolbar/built-in-toolbar.d.ts +4 -3
- package/dist/superdoc/src/internal/toolbar/image-upload.d.ts +29 -39
- package/dist/superdoc/src/public/content-control-ref.d.ts +12 -0
- package/dist/superdoc/src/public/index.d.cts +16 -0
- package/dist/superdoc/src/public/index.d.ts +3 -0
- package/dist/superdoc/src/public/ui/async-read-cache.d.ts +32 -0
- package/dist/superdoc/src/public/ui/block-commands.d.ts +39 -0
- package/dist/superdoc/src/public/ui/command-results.d.ts +39 -0
- package/dist/superdoc/src/public/ui/create-super-doc-ui.d.ts +1 -17
- package/dist/superdoc/src/public/ui/document-change-records.d.ts +7 -0
- package/dist/superdoc/src/public/ui/entity-rows.d.ts +14 -0
- package/dist/superdoc/src/public/ui/font-options.d.ts +7 -0
- package/dist/superdoc/src/public/ui/format-painter-helpers.d.ts +2 -8
- package/dist/superdoc/src/public/ui/format-painter-state.d.ts +33 -0
- package/dist/superdoc/src/public/ui/heavy-read-policy.d.ts +11 -0
- package/dist/superdoc/src/public/ui/host-events.d.ts +3 -0
- package/dist/superdoc/src/public/ui/inline-values.d.ts +79 -0
- package/dist/superdoc/src/public/ui/loose-record.d.ts +4 -0
- package/dist/superdoc/src/public/ui/selection-targets.d.ts +45 -0
- package/dist/superdoc/src/public/ui/shared-tracked-changes-catalog.d.ts +16 -0
- package/dist/superdoc/src/public/ui/tracked-change-ids.d.ts +51 -0
- package/dist/superdoc/src/public/ui/types.d.ts +12 -2
- package/dist/superdoc/src/public/ui/ui-bench-timing.d.ts +9 -0
- package/dist/superdoc/src/public/ui.d.cts +14 -0
- package/dist/superdoc/src/public/ui.d.ts +1 -1
- package/dist/superdoc/src/stores/comments-store.d.ts +23006 -542
- package/dist/superdoc/src/stores/helpers/comment-document-scope.d.ts +22 -0
- package/dist/superdoc/src/stores/helpers/comment-grouping.d.ts +1 -1
- package/dist/superdoc/src/stores/helpers/comment-identity.d.ts +10 -10
- package/dist/superdoc/src/stores/helpers/pending-selection-snapshot.d.ts +17 -0
- package/dist/superdoc/src/stores/helpers/review-presentation.d.ts +90 -0
- package/dist/superdoc/src/stores/helpers/tracked-change-compaction.d.ts +16 -0
- package/dist/superdoc/src/stores/helpers/tracked-change-decision.d.ts +45 -0
- package/dist/superdoc/src/stores/helpers/tracked-change-identity.d.ts +4 -2
- package/dist/superdoc/src/stores/helpers/tracked-change-row-values.d.ts +1 -8
- package/dist/superdoc/src/stores/helpers/tracked-change-thread-index.d.ts +1 -1
- package/dist/superdoc/src/stores/helpers/v2-review-adapters.d.ts +147 -0
- package/dist/superdoc/src/stores/superdoc-store.d.ts +12 -2895
- package/dist/superdoc.cjs +1019 -844
- package/dist/superdoc.es.js +931 -756
- package/dist/word-layout/src/marker-utils.d.ts +0 -5
- package/dist/word-layout/src/unit-conversions.d.ts +0 -1
- package/dist-cdn/style.layered.css +1 -1
- package/dist-cdn/superdoc.min.css +1 -1
- package/dist-cdn/superdoc.min.js +38 -42
- package/package.json +13 -3
- package/dist/document-api/src/diff/index.d.ts +0 -3
- package/dist/document-api/src/write/locator.d.ts +0 -24
- package/dist/layout-engine/painters/dom/src/features/feature-registry.d.ts +0 -41
- package/dist/superdoc/src/internal/toolbar/built-in/format-negation.d.ts +0 -5
- package/dist/superdoc/src/main.d.ts +0 -1
- package/dist/word-layout/src/tab-layout.d.ts +0 -193
package/package.json
CHANGED
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "superdoc",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.
|
|
5
|
-
"description": "
|
|
4
|
+
"version": "2.30.0-next.4",
|
|
5
|
+
"description": "Browser DOCX editor for reviewing, filling, and editing Word documents.",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"docx editor",
|
|
8
|
+
"docx",
|
|
9
|
+
"ms word",
|
|
10
|
+
"docx api",
|
|
11
|
+
"docx agent",
|
|
12
|
+
"docx sdk",
|
|
13
|
+
"headless"
|
|
14
|
+
],
|
|
6
15
|
"license": "AGPL-3.0",
|
|
7
16
|
"repository": {
|
|
8
17
|
"type": "git",
|
|
@@ -97,7 +106,7 @@
|
|
|
97
106
|
"main": "./dist/superdoc.cjs",
|
|
98
107
|
"module": "./dist/superdoc.es.js",
|
|
99
108
|
"dependencies": {
|
|
100
|
-
"@superdoc/docx-engine": "0.
|
|
109
|
+
"@superdoc/docx-engine": "0.29.0-next.4",
|
|
101
110
|
"@types/ws": "^8.18.1",
|
|
102
111
|
"eventemitter3": "^5.0.1",
|
|
103
112
|
"konva": "^10.2.0",
|
|
@@ -148,6 +157,7 @@
|
|
|
148
157
|
"check:jsdoc": "node ./scripts/check-jsdoc.cjs",
|
|
149
158
|
"check:v2-only": "node ./scripts/check-private-core.cjs",
|
|
150
159
|
"check:vue": "vue-tsc --noEmit -p tsconfig.vue.json",
|
|
160
|
+
"check:test-types": "vue-tsc --noEmit -p tsconfig.test.json",
|
|
151
161
|
"build:es": "pnpm run build",
|
|
152
162
|
"watch:es": "vp build --watch",
|
|
153
163
|
"build:cdn": "node ./scripts/build-public-superdoc.mjs --surface cdn",
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
export type { DiffAdapter, DiffApi } from './diff.js';
|
|
2
|
-
export { executeDiffCapture, executeDiffCompare, executeDiffApply } from './diff.js';
|
|
3
|
-
export type { DiffSnapshot, DiffPayload, DiffPartChange, DiffApplyResult, DiffSummary, DiffCoverage, DiffEngineId, DiffCompareInput, DiffApplyInput, DiffApplyOptions, DiffChangeMode, DiffApplyOperationReceipt, DiffApplyReviewItem, DiffApplyEligibility, DiffApplyModeEligibility, DiffApplyEligibilityBlocker, DiffApplyEligibilityBlockerCode, } from './diff.types.js';
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared internal locator types for friendly target resolution.
|
|
3
|
-
*
|
|
4
|
-
* Point locators are used by insert. Range locators are used by replace,
|
|
5
|
-
* delete, format.apply, comments.create, and comments.patch. Block-ID shorthand
|
|
6
|
-
* is used by create.* and lists.*.
|
|
7
|
-
*
|
|
8
|
-
* NOT exported from the package root: internal use only.
|
|
9
|
-
*/
|
|
10
|
-
/** Block-relative point locator: a block ID with an optional character offset. Used by insert. */
|
|
11
|
-
export interface BlockRelativeLocator {
|
|
12
|
-
blockId: string;
|
|
13
|
-
offset?: number;
|
|
14
|
-
}
|
|
15
|
-
/** Block-relative range locator: a block ID with start and end offsets. Used by replace, delete, format.apply, comments.create/patch. */
|
|
16
|
-
export interface BlockRelativeRange {
|
|
17
|
-
blockId: string;
|
|
18
|
-
start: number;
|
|
19
|
-
end: number;
|
|
20
|
-
}
|
|
21
|
-
/** Block-ID shorthand: a bare node ID that the adapter resolves to a full address. Used by create.*, lists.*. */
|
|
22
|
-
export interface BlockIdShorthand {
|
|
23
|
-
nodeId: string;
|
|
24
|
-
}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Rendering Feature Registry
|
|
3
|
-
*
|
|
4
|
-
* Maps OOXML elements to their rendering feature modules.
|
|
5
|
-
* This is the primary lookup table for agents and developers.
|
|
6
|
-
*
|
|
7
|
-
* To find where an OOXML element renders: search this file.
|
|
8
|
-
* To add a new rendering feature: add an entry here first.
|
|
9
|
-
*
|
|
10
|
-
* Each entry specifies:
|
|
11
|
-
* - feature: human-readable feature name (matches folder name)
|
|
12
|
-
* - module: import path relative to this file
|
|
13
|
-
* - handles: list of OOXML element paths this feature renders
|
|
14
|
-
* - spec: ECMA-376 section reference
|
|
15
|
-
*/
|
|
16
|
-
export declare const RENDERING_FEATURES: {
|
|
17
|
-
readonly 'w:pBdr': {
|
|
18
|
-
readonly feature: "paragraph/borders";
|
|
19
|
-
readonly module: "../paragraph/borders";
|
|
20
|
-
readonly handles: readonly ["w:pBdr/w:top", "w:pBdr/w:bottom", "w:pBdr/w:left", "w:pBdr/w:right", "w:pBdr/w:between", "w:pBdr/w:bar"];
|
|
21
|
-
readonly spec: "§17.3.1.24";
|
|
22
|
-
};
|
|
23
|
-
readonly 'w:shd': {
|
|
24
|
-
readonly feature: "paragraph/borders";
|
|
25
|
-
readonly module: "../paragraph/borders";
|
|
26
|
-
readonly handles: readonly ["w:shd/@w:fill", "w:shd/@w:val", "w:shd/@w:color"];
|
|
27
|
-
readonly spec: "§17.3.1.31";
|
|
28
|
-
};
|
|
29
|
-
readonly 'w:bidi': {
|
|
30
|
-
readonly feature: "inline-direction";
|
|
31
|
-
readonly module: "./inline-direction";
|
|
32
|
-
readonly handles: readonly ["w:pPr/w:bidi", "w:rPr/w:rtl"];
|
|
33
|
-
readonly spec: "§17.3.1.1";
|
|
34
|
-
};
|
|
35
|
-
readonly 'm:oMath': {
|
|
36
|
-
readonly feature: "math";
|
|
37
|
-
readonly module: "./math";
|
|
38
|
-
readonly handles: readonly ["m:oMath", "m:oMathPara", "m:r", "m:t", "m:f", "m:rad", "m:sSup", "m:sSub", "m:sSubSup", "m:sPre", "m:d", "m:nary", "m:acc", "m:bar", "m:groupChr", "m:limLow", "m:limUpp", "m:func", "m:m", "m:eqArr", "m:borderBox", "m:box", "m:phant"];
|
|
39
|
-
readonly spec: "§22.1";
|
|
40
|
-
};
|
|
41
|
-
};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export function isOffValue(value: unknown): boolean;
|
|
2
|
-
/** @type {Record<string, (attrs?: Record<string, unknown>) => boolean>} */
|
|
3
|
-
export const negationChecks: Record<string, (attrs?: Record<string, unknown>) => boolean>;
|
|
4
|
-
export function isNegatedMark(name: string, attrs?: Record<string, unknown>): boolean;
|
|
5
|
-
export default isNegatedMark;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,193 +0,0 @@
|
|
|
1
|
-
import { ParagraphIndent, ResolvedTabStop } from './types.js';
|
|
2
|
-
/**
|
|
3
|
-
* Tab alignment type supporting all Word-compatible alignment modes.
|
|
4
|
-
* Used throughout tab stop processing to ensure type safety.
|
|
5
|
-
*/
|
|
6
|
-
export type TabAlignment = 'start' | 'center' | 'end' | 'decimal' | 'bar' | 'num';
|
|
7
|
-
/**
|
|
8
|
-
* Raw tab stop data as received from various document parsers.
|
|
9
|
-
*
|
|
10
|
-
* Different parsers may use different property names for the same concepts:
|
|
11
|
-
* - `val`, `align`, `alignment`, or `type` for alignment mode
|
|
12
|
-
* - `originalPos` for positions already in twips (no conversion needed)
|
|
13
|
-
* - `pos`, `position`, or `offset` for positions in pixels (require conversion to twips)
|
|
14
|
-
* - `leader` for the optional leader character style
|
|
15
|
-
*
|
|
16
|
-
* This flexible structure allows the normalization functions to handle
|
|
17
|
-
* tab stop data from multiple sources without requiring parser-specific code.
|
|
18
|
-
*/
|
|
19
|
-
export type RawTabStop = {
|
|
20
|
-
val?: string;
|
|
21
|
-
align?: string;
|
|
22
|
-
alignment?: string;
|
|
23
|
-
type?: string;
|
|
24
|
-
originalPos?: number;
|
|
25
|
-
pos?: number;
|
|
26
|
-
position?: number;
|
|
27
|
-
offset?: number;
|
|
28
|
-
leader?: 'none' | 'dot' | 'heavy' | 'hyphen' | 'middleDot' | 'underscore';
|
|
29
|
-
};
|
|
30
|
-
/**
|
|
31
|
-
* Normalized tab stop with positions standardized to twips.
|
|
32
|
-
*
|
|
33
|
-
* This is the intermediate format used during tab stop processing.
|
|
34
|
-
* All position values are guaranteed to be in twips (1/1440 inch),
|
|
35
|
-
* allowing consistent calculations regardless of the original source format.
|
|
36
|
-
* The alignment is validated and normalized to standard values.
|
|
37
|
-
*/
|
|
38
|
-
export type NormalizedTabStopTwips = {
|
|
39
|
-
alignment: TabAlignment;
|
|
40
|
-
positionTwips: number;
|
|
41
|
-
leader?: RawTabStop['leader'];
|
|
42
|
-
};
|
|
43
|
-
/**
|
|
44
|
-
* Options for computing the final set of tab stops.
|
|
45
|
-
*
|
|
46
|
-
* Controls whether to use explicit tab stops or generate default stops,
|
|
47
|
-
* and how to position default stops when generated.
|
|
48
|
-
*/
|
|
49
|
-
export type ComputeTabStopsOptions = {
|
|
50
|
-
/** Pre-normalized explicit tab stops to use instead of generating defaults */
|
|
51
|
-
explicitStops?: NormalizedTabStopTwips[];
|
|
52
|
-
/** Interval between default tab stops in twips (typically 720 = 0.5 inch) */
|
|
53
|
-
defaultTabIntervalTwips?: number;
|
|
54
|
-
/** Starting offset for default tab stop calculation (e.g., left indent) */
|
|
55
|
-
startTwips?: number;
|
|
56
|
-
};
|
|
57
|
-
/**
|
|
58
|
-
* Options for building the complete effective tab stop set.
|
|
59
|
-
*
|
|
60
|
-
* Integrates tab stops from multiple sources: paragraph-level explicit stops,
|
|
61
|
-
* paragraph-level defaults, and document-level defaults. Also handles
|
|
62
|
-
* decimal separator configuration for decimal-aligned tabs.
|
|
63
|
-
*/
|
|
64
|
-
export type BuildEffectiveTabStopsOptions = {
|
|
65
|
-
/** Raw tab stops defined explicitly on the paragraph */
|
|
66
|
-
explicitStops?: RawTabStop[];
|
|
67
|
-
/** Paragraph indentation affecting tab stop positioning */
|
|
68
|
-
paragraphIndent?: ParagraphIndent;
|
|
69
|
-
/** Paragraph-level default tab interval (overrides document default) */
|
|
70
|
-
paragraphTabIntervalTwips?: number;
|
|
71
|
-
/** Document-level default tab interval */
|
|
72
|
-
defaultTabIntervalTwips?: number;
|
|
73
|
-
/** Character to use for decimal alignment (e.g., '.' or ',') */
|
|
74
|
-
decimalSeparator?: string;
|
|
75
|
-
};
|
|
76
|
-
/**
|
|
77
|
-
* Normalizes alignment values from various formats to standard alignment types.
|
|
78
|
-
*
|
|
79
|
-
* Handles case-insensitive alignment names, legacy alignment values (left/right),
|
|
80
|
-
* and unknown values by mapping them to standard alignment types. This ensures
|
|
81
|
-
* consistent alignment handling across different document formats.
|
|
82
|
-
*
|
|
83
|
-
* @param value - Alignment value from document source (may be undefined, empty, or unknown)
|
|
84
|
-
* @returns Normalized TabAlignment, null if no valid alignment provided, or 'start' for unknown values
|
|
85
|
-
*
|
|
86
|
-
* @example
|
|
87
|
-
* ```typescript
|
|
88
|
-
* normalizeAlignment('LEFT') // returns 'start'
|
|
89
|
-
* normalizeAlignment('Right') // returns 'end'
|
|
90
|
-
* normalizeAlignment('decimal') // returns 'decimal'
|
|
91
|
-
* normalizeAlignment('') // returns null
|
|
92
|
-
* normalizeAlignment('unknown') // returns 'start' (fallback)
|
|
93
|
-
* normalizeAlignment(undefined) // returns null
|
|
94
|
-
* ```
|
|
95
|
-
*/
|
|
96
|
-
export declare const normalizeAlignment: (value?: string) => TabAlignment | null;
|
|
97
|
-
/**
|
|
98
|
-
* Normalizes raw tab stop data into a consistent format with positions in twips.
|
|
99
|
-
*
|
|
100
|
-
* This function processes various tab stop representations (which may use different
|
|
101
|
-
* property names and units) into a standardized format suitable for layout calculations.
|
|
102
|
-
* It handles alignment normalization, position unit conversion, and sorting.
|
|
103
|
-
*
|
|
104
|
-
* @param candidateStops - Array of raw tab stop objects from document parsing.
|
|
105
|
-
* May be null, undefined, or contain malformed entries.
|
|
106
|
-
* @returns Array of normalized tab stops sorted by position, with positions in twips
|
|
107
|
-
*
|
|
108
|
-
* @example
|
|
109
|
-
* ```typescript
|
|
110
|
-
* const stops = normalizeExplicitTabStops([
|
|
111
|
-
* { val: 'left', pos: 48 }, // Position in pixels
|
|
112
|
-
* { val: 'right', originalPos: 1440 }, // Position in twips
|
|
113
|
-
* { val: 'decimal', pos: 96, leader: 'dot' }
|
|
114
|
-
* ]);
|
|
115
|
-
*
|
|
116
|
-
* console.log(stops);
|
|
117
|
-
* // [
|
|
118
|
-
* // { alignment: 'start', positionTwips: 720, leader: undefined },
|
|
119
|
-
* // { alignment: 'end', positionTwips: 1440, leader: undefined },
|
|
120
|
-
* // { alignment: 'decimal', positionTwips: 1440, leader: 'dot' }
|
|
121
|
-
* // ]
|
|
122
|
-
* ```
|
|
123
|
-
*/
|
|
124
|
-
export declare const normalizeExplicitTabStops: (candidateStops?: RawTabStop[] | null) => NormalizedTabStopTwips[];
|
|
125
|
-
/**
|
|
126
|
-
* Computes the final list of tab stops, using either explicit stops or generating
|
|
127
|
-
* default stops at regular intervals.
|
|
128
|
-
*
|
|
129
|
-
* When explicit tab stops are provided, they are used directly. Otherwise, this function
|
|
130
|
-
* generates a default set of equally-spaced tab stops based on the default interval.
|
|
131
|
-
*
|
|
132
|
-
* @param options - Configuration for tab stop computation
|
|
133
|
-
* @param options.explicitStops - Pre-normalized explicit tab stops to use
|
|
134
|
-
* @param options.defaultTabIntervalTwips - Interval between default tab stops in twips
|
|
135
|
-
* @param options.startTwips - Starting offset for default tab stop calculation
|
|
136
|
-
* @returns Array of tab stops sorted by position
|
|
137
|
-
*
|
|
138
|
-
* @example
|
|
139
|
-
* ```typescript
|
|
140
|
-
* // Using explicit stops
|
|
141
|
-
* const explicit = computeTabStops({
|
|
142
|
-
* explicitStops: [
|
|
143
|
-
* { alignment: 'start', positionTwips: 720 },
|
|
144
|
-
* { alignment: 'end', positionTwips: 1440 }
|
|
145
|
-
* ]
|
|
146
|
-
* });
|
|
147
|
-
*
|
|
148
|
-
* // Generating default stops
|
|
149
|
-
* const defaults = computeTabStops({
|
|
150
|
-
* defaultTabIntervalTwips: 720,
|
|
151
|
-
* startTwips: 0
|
|
152
|
-
* });
|
|
153
|
-
* // Returns 12 stops at 720, 1440, 2160, ... twips
|
|
154
|
-
* ```
|
|
155
|
-
*/
|
|
156
|
-
export declare const computeTabStops: (options: ComputeTabStopsOptions) => NormalizedTabStopTwips[];
|
|
157
|
-
/**
|
|
158
|
-
* Builds the complete set of effective tab stops in pixels, accounting for paragraph
|
|
159
|
-
* indentation and document defaults.
|
|
160
|
-
*
|
|
161
|
-
* This is the primary tab stop resolution function that integrates all sources of tab
|
|
162
|
-
* configuration: explicit paragraph tab stops, paragraph-level defaults, and document-level
|
|
163
|
-
* defaults. It also handles decimal separator characters for decimal-aligned tabs.
|
|
164
|
-
*
|
|
165
|
-
* @param options - Options for building effective tab stops
|
|
166
|
-
* @param options.explicitStops - Raw tab stops defined on the paragraph
|
|
167
|
-
* @param options.paragraphIndent - Paragraph indentation that affects tab stop positioning
|
|
168
|
-
* @param options.paragraphTabIntervalTwips - Paragraph-level default tab interval
|
|
169
|
-
* @param options.defaultTabIntervalTwips - Document-level default tab interval
|
|
170
|
-
* @param options.decimalSeparator - Character to use for decimal alignment (e.g., '.' or ',')
|
|
171
|
-
* @returns Array of resolved tab stops with positions in pixels
|
|
172
|
-
*
|
|
173
|
-
* @example
|
|
174
|
-
* ```typescript
|
|
175
|
-
* const stops = buildEffectiveTabStopsPx({
|
|
176
|
-
* explicitStops: [
|
|
177
|
-
* { val: 'decimal', pos: 96, leader: 'dot' }
|
|
178
|
-
* ],
|
|
179
|
-
* paragraphIndent: { left: 24 },
|
|
180
|
-
* defaultTabIntervalTwips: 720,
|
|
181
|
-
* decimalSeparator: ','
|
|
182
|
-
* });
|
|
183
|
-
*
|
|
184
|
-
* console.log(stops[0]);
|
|
185
|
-
* // {
|
|
186
|
-
* // alignment: 'decimal',
|
|
187
|
-
* // position: 96,
|
|
188
|
-
* // leader: 'dot',
|
|
189
|
-
* // decimalChar: ','
|
|
190
|
-
* // }
|
|
191
|
-
* ```
|
|
192
|
-
*/
|
|
193
|
-
export declare const buildEffectiveTabStopsPx: (options: BuildEffectiveTabStopsOptions) => ResolvedTabStop[];
|