@betteroffice/docx 0.4.2 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +108 -598
- package/dist/chunk-25WGDXBF.mjs +1 -0
- package/dist/chunk-2CCPNW44.mjs +1 -0
- package/dist/chunk-32A4I3T4.mjs +1 -0
- package/dist/chunk-4LO3PSLZ.mjs +2 -0
- package/dist/chunk-67MGRMP3.mjs +1 -0
- package/dist/chunk-6AUR4AA2.mjs +1 -0
- package/dist/chunk-6WT6HKAY.mjs +1 -0
- package/dist/chunk-77ZWGQZN.mjs +1 -0
- package/dist/chunk-7C3Y7LIH.mjs +1 -0
- package/dist/chunk-7WIUNGQW.mjs +1 -0
- package/dist/chunk-7WWFGMMF.mjs +1 -0
- package/dist/chunk-AK2NG7PT.mjs +1 -0
- package/dist/chunk-BR5BFOHF.mjs +1 -0
- package/dist/chunk-CDNWHQH2.mjs +1 -0
- package/dist/chunk-CRTTEHZN.mjs +1 -0
- package/dist/chunk-ETDMQ5GE.mjs +1 -0
- package/dist/{wasm-QXYYV7LU.mjs → chunk-GBOHQ3CJ.mjs} +1 -1
- package/dist/chunk-H7K4SJKK.mjs +1 -0
- package/dist/chunk-ICJH7QUY.mjs +1 -0
- package/dist/chunk-IHETKRDA.mjs +1 -0
- package/dist/chunk-ISBZLVIF.mjs +1 -0
- package/dist/chunk-JSYH6HNV.mjs +2 -0
- package/dist/chunk-KICHSQFN.mjs +1 -0
- package/dist/chunk-KXIGXLFA.mjs +5 -0
- package/dist/chunk-KXLTK7AT.mjs +57 -0
- package/dist/chunk-L3JRNJ34.mjs +1 -0
- package/dist/chunk-LKDHP22R.mjs +1 -0
- package/dist/chunk-LPOEM5WH.mjs +1 -0
- package/dist/chunk-M44BABH2.mjs +1 -0
- package/dist/chunk-MAYPJU23.mjs +1 -0
- package/dist/chunk-N5RE2S3U.mjs +2 -0
- package/dist/chunk-NLYHFVF5.mjs +1 -0
- package/dist/chunk-ONYCW7VV.mjs +4 -0
- package/dist/chunk-QGZ2AB3M.mjs +1 -0
- package/dist/chunk-QWHU7YIW.mjs +2 -0
- package/dist/{chunk-VH7P4734.mjs → chunk-QX2CDKPG.mjs} +1 -1
- package/dist/chunk-RGDE6YQB.mjs +1 -0
- package/dist/chunk-TE3AU2JK.mjs +1 -0
- package/dist/chunk-UDVEZ722.mjs +1 -0
- package/dist/chunk-UQSVFDRV.mjs +2 -0
- package/dist/chunk-VHOOSS4D.mjs +1 -0
- package/dist/chunk-WIDM4EMT.mjs +1 -0
- package/dist/chunk-YITJ4QAO.mjs +1 -0
- package/dist/collaboration/index.d.mts +111 -11
- package/dist/collaboration/index.mjs +1 -1
- package/dist/{content-DSb-6a9T.d.mts → content-DVT06V_6.d.mts} +24 -3
- package/dist/core.d.mts +9 -9
- package/dist/core.mjs +1 -1
- package/dist/displayListQueries-6XjS7B5e.d.mts +1473 -0
- package/dist/docx/index.d.mts +8 -7
- package/dist/docx/index.mjs +1 -2
- package/dist/docxWorker.mjs +1 -0
- package/dist/editor/index.d.mts +14 -12
- package/dist/editor/index.mjs +1 -1
- package/dist/{fontLoader-BNSs0E8K.d.mts → fontLoader-CBkmh4ps.d.mts} +1 -1
- package/dist/{formatting-gqLFeJ9X.d.mts → formatting-p5MneNuy.d.mts} +32 -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-C-KKULi5.d.mts +5596 -0
- package/dist/layout/index.d.mts +4 -4
- package/dist/layout/index.mjs +1 -1
- package/dist/layout/pagination/index.d.mts +4 -4
- package/dist/layout/render/index.d.mts +37 -53
- package/dist/layout/render/index.mjs +3 -1
- package/dist/{pagedExport-BmSlEhoP.d.mts → pagedExport-DDgA5O7E.d.mts} +92 -9
- package/dist/plugin-api/RenderedDomContext.d.mts +5 -7
- package/dist/plugin-api/index.d.mts +3 -3
- package/dist/plugin-api/resolveItemPositions.d.mts +3 -3
- package/dist/{rezip-Bxiq4Z_R.d.mts → rezip-CfwAYdV4.d.mts} +7 -1
- package/dist/styles/index.d.mts +3 -3
- package/dist/styles/index.mjs +1 -1
- package/dist/{styles-AryxLAhx.d.mts → styles-DZZz2oRy.d.mts} +2 -2
- package/dist/types/content.d.mts +2 -2
- package/dist/types/document.d.mts +6 -6
- package/dist/{types-Cz7S77Ut.d.mts → types-bvPg3KsF.d.mts} +16 -3
- package/dist/utils/comments.d.mts +2 -2
- package/dist/utils/findReplace.mjs +1 -2
- package/dist/utils/index.d.mts +5 -5
- package/dist/utils/index.mjs +1 -1
- package/dist/utils/listState.d.mts +2 -5
- package/dist/utils/stylePreview.d.mts +2 -2
- package/dist/utils/stylePreview.mjs +1 -1
- package/dist/wasm-edit.d.mts +233 -48
- package/dist/wasm-edit.mjs +1 -1
- package/dist/wasm-layout.d.mts +7 -1
- package/dist/wasm-layout.mjs +1 -1
- package/dist/wasm-opc.mjs +1 -1
- package/dist/wasm-parse.d.mts +7 -1
- package/dist/wasm-parse.mjs +1 -1
- package/dist/worker.d.mts +60 -0
- package/dist/worker.mjs +1 -0
- package/dist/yrs/docxWorker.d.mts +20 -0
- package/dist/yrs/docxWorker.mjs +3 -0
- package/dist/yrs/index.d.mts +12 -7
- package/dist/yrs/index.mjs +1 -1
- package/package.json +14 -4
- package/dist/chunk-47Q2FMFF.mjs +0 -1
- package/dist/chunk-4PRCO6EC.mjs +0 -1
- package/dist/chunk-5Z22FORG.mjs +0 -1
- package/dist/chunk-7SUVUKWT.mjs +0 -1
- package/dist/chunk-7ZV6P6NZ.mjs +0 -57
- package/dist/chunk-AXFMDV66.mjs +0 -1
- package/dist/chunk-EBYC3CX7.mjs +0 -1
- package/dist/chunk-GKWXOZZH.mjs +0 -1
- package/dist/chunk-LIOWZSE7.mjs +0 -1
- package/dist/chunk-ML6E23W2.mjs +0 -1
- package/dist/chunk-MLEMGJP7.mjs +0 -1
- package/dist/chunk-QBMNRD5V.mjs +0 -2
- package/dist/chunk-RNNTXPXC.mjs +0 -1
- package/dist/compareDocx-CWOYEBCE.mjs +0 -1
- package/dist/computeLayout-ZTO6TBWX.mjs +0 -1
- package/dist/displayListQueries-BVBDVXoP.d.mts +0 -306
- package/dist/frameDelta-CLeO7K5z.d.mts +0 -807
- package/dist/index-DzZVJC8-.d.mts +0 -2467
- package/dist/parseWasm-BESKFFA3.mjs +0 -1
- package/dist/rustDisplayList-B7uPoItK.d.mts +0 -315
- package/dist/wasm-GFT55YT6.mjs +0 -1
- package/dist/wasm-QI7MWC5D.mjs +0 -1
- package/dist/yrs/residentEngineWorker.d.mts +0 -2
- package/dist/yrs/residentEngineWorker.mjs +0 -1
|
@@ -1,3 +1,24 @@
|
|
|
1
|
+
import { f as SectionProperties } from './content-DVT06V_6.mjs';
|
|
2
|
+
|
|
3
|
+
type SectionStartKind = 'nextPage' | 'continuous' | 'evenPage' | 'oddPage';
|
|
4
|
+
interface SectionPropertyPatch {
|
|
5
|
+
orientation?: 'portrait' | 'landscape';
|
|
6
|
+
pageWidth?: number;
|
|
7
|
+
pageHeight?: number;
|
|
8
|
+
margins?: Partial<Record<'top' | 'bottom' | 'left' | 'right' | 'header' | 'footer' | 'gutter', number>>;
|
|
9
|
+
}
|
|
10
|
+
interface SectionInfo {
|
|
11
|
+
closingParagraphId: string;
|
|
12
|
+
firstParagraph: number;
|
|
13
|
+
lastParagraph: number;
|
|
14
|
+
authored: SectionProperties;
|
|
15
|
+
resolved: SectionProperties;
|
|
16
|
+
}
|
|
17
|
+
declare class DocxSectionError extends Error {
|
|
18
|
+
readonly code: string;
|
|
19
|
+
constructor(code: string, message: string);
|
|
20
|
+
}
|
|
21
|
+
|
|
1
22
|
/**
|
|
2
23
|
* Result envelopes shared by the formats' host edit APIs. Targets, steps, receipts and failure
|
|
3
24
|
* codes stay format-owned; these shapes only fix how every format reports success and refusal.
|
|
@@ -493,14 +514,35 @@ type DocxContentControlsResult = {
|
|
|
493
514
|
} | OperationRefusal<DocxContentControlReadFailure>;
|
|
494
515
|
|
|
495
516
|
/**
|
|
496
|
-
*
|
|
497
|
-
*
|
|
498
|
-
*
|
|
499
|
-
* Offsets are half-open UTF-16 positions into a paragraph's projected text. Each inline atom
|
|
500
|
-
* (hard break, image, content control, note reference, field or other embed) occupies one
|
|
501
|
-
* U+FFFC, tabs stay `\t`, and paragraph marks are not part of the text. The accepted view shows
|
|
502
|
-
* pending insertions and hides pending deletions; the original view does the reverse.
|
|
517
|
+
* What a session story holds. Comment bodies live outside the session's stories, so there is no
|
|
518
|
+
* comment kind; `other` is a story the session cannot place, such as a header or footer story
|
|
519
|
+
* whose part it does not know.
|
|
503
520
|
*/
|
|
521
|
+
type DocxStoryInfoKind = 'body' | 'tableCell' | 'contentControl' | 'header' | 'footer' | 'footnote' | 'endnote' | 'other';
|
|
522
|
+
/** A section that references a header or footer part, as the structured export reports it. */
|
|
523
|
+
type DocxStoryUse = DocxExportStory['uses'][number];
|
|
524
|
+
interface DocxStoryInfo {
|
|
525
|
+
story: string;
|
|
526
|
+
kind: DocxStoryInfoKind;
|
|
527
|
+
/** The story a table cell or block content control sits in. */
|
|
528
|
+
parent?: string;
|
|
529
|
+
/** The top-level story this one belongs to; itself for a top-level story. */
|
|
530
|
+
root: string;
|
|
531
|
+
/** A header's or footer's package part, when the session was opened from DOCX bytes. */
|
|
532
|
+
part?: string;
|
|
533
|
+
/**
|
|
534
|
+
* A header's or footer's sections whose properties reference the part, inheritance applied,
|
|
535
|
+
* whether or not a page shows it; plugin anchor geometry tells where it is painted. A
|
|
536
|
+
* first-page preview reads only the sections it holds, so its uses may be incomplete.
|
|
537
|
+
*/
|
|
538
|
+
uses?: DocxStoryUse[];
|
|
539
|
+
}
|
|
540
|
+
/** Every story of the session at one version, sorted by id. */
|
|
541
|
+
interface DocxListStoriesResult {
|
|
542
|
+
ok: true;
|
|
543
|
+
version: string;
|
|
544
|
+
stories: DocxStoryInfo[];
|
|
545
|
+
}
|
|
504
546
|
|
|
505
547
|
type DocxTextView = 'accepted' | 'original';
|
|
506
548
|
/** Provenance only: history and revision authorship are chosen separately. */
|
|
@@ -586,6 +628,14 @@ type DocxEditOperation = {
|
|
|
586
628
|
story: string;
|
|
587
629
|
firstParaId: string;
|
|
588
630
|
lastParaId: string;
|
|
631
|
+
} | {
|
|
632
|
+
op: 'insertSectionBreakAfter';
|
|
633
|
+
target: DocxParagraphTarget;
|
|
634
|
+
kind: SectionStartKind;
|
|
635
|
+
} | {
|
|
636
|
+
op: 'setSectionProperties';
|
|
637
|
+
section: string;
|
|
638
|
+
properties: SectionPropertyPatch;
|
|
589
639
|
} | {
|
|
590
640
|
op: 'setParagraphStyle';
|
|
591
641
|
target: DocxParagraphTarget;
|
|
@@ -688,6 +738,39 @@ type DocxReadParagraphsResult = {
|
|
|
688
738
|
view: DocxTextView;
|
|
689
739
|
paragraphs: DocxParagraphText[];
|
|
690
740
|
} | DocxEditRefusal;
|
|
741
|
+
interface DocxReadStoriesRequest {
|
|
742
|
+
/**
|
|
743
|
+
* `'all'` (the default) reads every story in id order. Listed entries are read in their order
|
|
744
|
+
* without repeats; an entry naming a kind stands for its stories in id order.
|
|
745
|
+
*/
|
|
746
|
+
stories?: 'all' | ReadonlyArray<DocxStoryInfoKind | (string & {})>;
|
|
747
|
+
/** Matches listed kinds against each story's root, so `header` also selects header cells. */
|
|
748
|
+
byRoot?: boolean;
|
|
749
|
+
view: DocxTextView;
|
|
750
|
+
/** Refuses with `stale-version` when the document is at another version. */
|
|
751
|
+
expectVersion?: string;
|
|
752
|
+
}
|
|
753
|
+
/** One story's paragraphs, or why it could not be read. */
|
|
754
|
+
type DocxStoryText = {
|
|
755
|
+
story: string;
|
|
756
|
+
ok: true;
|
|
757
|
+
paragraphs: DocxParagraphText[];
|
|
758
|
+
} | {
|
|
759
|
+
story: string;
|
|
760
|
+
ok: false;
|
|
761
|
+
failure: DocxEditFailure;
|
|
762
|
+
};
|
|
763
|
+
type DocxReadStoriesResult = {
|
|
764
|
+
ok: true;
|
|
765
|
+
version: string;
|
|
766
|
+
view: DocxTextView;
|
|
767
|
+
stories: DocxStoryText[];
|
|
768
|
+
/**
|
|
769
|
+
* The read limits stopped the read before the next selected story. A story larger than the
|
|
770
|
+
* limits on its own reports `limit-exceeded` instead; page it with `readParagraphs` `paraIds`.
|
|
771
|
+
*/
|
|
772
|
+
truncated: boolean;
|
|
773
|
+
} | DocxEditRefusal;
|
|
691
774
|
interface DocxFindTextRequest {
|
|
692
775
|
text: string;
|
|
693
776
|
within: DocxSearchScope;
|
|
@@ -858,7 +941,7 @@ interface DocxFragmentGeometry {
|
|
|
858
941
|
}>;
|
|
859
942
|
}
|
|
860
943
|
interface DocxPageDiagnostic {
|
|
861
|
-
code: 'unmapped-content' | 'anchor-only' | 'not-laid-out' | 'unsupported-numbering' | 'unsupported-note-layout' | 'clipped-content' | 'geometry-unavailable' | 'truncated';
|
|
944
|
+
code: 'unmapped-content' | 'anchor-only' | 'not-laid-out' | 'unsupported-numbering' | 'unsupported-note-layout' | 'clipped-content' | 'geometry-unavailable' | 'truncated' | 'note-layout-fallback';
|
|
862
945
|
nodeId: string | null;
|
|
863
946
|
pageIndex: number | null;
|
|
864
947
|
message: string;
|
|
@@ -904,4 +987,4 @@ interface DocxHeadlessLayoutOptions {
|
|
|
904
987
|
};
|
|
905
988
|
}
|
|
906
989
|
|
|
907
|
-
export type
|
|
990
|
+
export { type DocxUnlocatedReason as $, type DocxExportDiagnostic as A, type DocxExportDiagnosticCode as B, type DocxExportFailureCode as C, type DocxExportFailure as D, type DocxExportInline as E, type DocxExportPage as F, type DocxExportRefusal as G, type DocxExportResult as H, type DocxExportStory as I, type DocxExportTable as J, type DocxFormattingMark as K, type DocxFragmentGeometry as L, type DocxHeadingInfo as M, type DocxHeadlessFont as N, type DocxInlineRevision as O, type DocxLayoutProvenance as P, type DocxListInfo as Q, type DocxPageDiagnostic as R, type DocxPageFragment as S, type DocxPageMapContent as T, type DocxParagraphData as U, type DocxParagraphHeading as V, type DocxRevisionView as W, type DocxSnapshotLayoutProvenance as X, type DocxStoryKind as Y, type DocxStoryOccurrence as Z, type DocxStorySelection as _, type DocxExportOptions as a, type DocxEditSuggestion as a0, type DocxEditFailure as a1, type DocxEditFailureCode as a2, type DocxFindTextRequest as a3, type DocxFindTextResult as a4, type DocxReadParagraphsRequest as a5, type DocxReadParagraphsResult as a6, type DocxEditRequest as a7, type DocxEditResult as a8, type DocxTextRange as a9, type DocxStoryInfo as aA, type DocxStoryInfoKind as aB, type DocxStoryText as aC, type DocxStoryUse as aD, type DocxTextAtom as aE, type DocxTextMatch as aF, type DocxTextPosition as aG, type DocxTextView as aH, type EditSuccess as aI, type OperationFailure as aJ, type OperationRefusal as aK, type ValidationSuccess as aL, type DocxReadStoriesRequest as aa, type DocxValidationResult as ab, type DocxListStoriesResult as ac, type DocxReadStoriesResult as ad, type SectionStartKind as ae, type SectionPropertyPatch as af, type SectionInfo as ag, type DocxTextTarget as ah, type DocxEditRefusal as ai, type DocxAtomKind as aj, type DocxEditFailureReason as ak, type DocxEditGuard as al, type DocxEditHistory as am, type DocxEditOperation as an, type DocxEditPreview as ao, type DocxEditReceipt as ap, type DocxEditSource as aq, type DocxEditStep as ar, type DocxEditTarget as as, type DocxParagraphInput as at, type DocxParagraphTarget as au, type DocxParagraphText as av, type DocxResolvedControl as aw, type DocxSearchScope as ax, DocxSectionError as ay, type DocxSetContentControlTextStep as az, type DocxMarkdownContent as b, type DocxStructuredContent as c, type DocxPageExportOptions as d, type DocxHeadlessLayoutOptions as e, type DocxPagedStructuredContent as f, type DocxSnapshotLayoutMap as g, type DocxMarkdownOptions as h, type DocxLayoutMap as i, type DocxPageMarkdownOptions as j, type DocxContentControlReadFailure as k, type DocxContentControlQuery as l, type DocxContentControlsOptions as m, type DocxContentControlsSnapshot as n, type DocxAnchor as o, type DocxAnchorScope as p, type DocxCachedResult as q, type DocxCommentMetadata as r, type DocxContentControl as s, type DocxContentControlDiagnostic as t, type DocxContentControlSelector as u, type DocxContentControlValue as v, type DocxContentControlsResult as w, type DocxControlMetadata as x, type DocxExportBlock as y, type DocxExportCell as z };
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import { RenderedDomContext, PositionCoordinates, PointPosition } from './index.mjs';
|
|
2
|
-
import { D as DisplayListRect, a as DisplayListQueries } from '../displayListQueries-
|
|
2
|
+
import { D as DisplayListRect, a as DisplayListQueries } from '../displayListQueries-6XjS7B5e.mjs';
|
|
3
3
|
import '../types/document.mjs';
|
|
4
|
-
import '../content-
|
|
5
|
-
import '../formatting-
|
|
4
|
+
import '../content-DVT06V_6.mjs';
|
|
5
|
+
import '../formatting-p5MneNuy.mjs';
|
|
6
6
|
import '../docx/wrapTypes.mjs';
|
|
7
|
-
import '../styles-
|
|
8
|
-
import '../
|
|
9
|
-
import '../rustDisplayList-B7uPoItK.mjs';
|
|
10
|
-
import '../types-Cz7S77Ut.mjs';
|
|
7
|
+
import '../styles-DZZz2oRy.mjs';
|
|
8
|
+
import '../types-bvPg3KsF.mjs';
|
|
11
9
|
import '../layout/pagination/index.mjs';
|
|
12
10
|
|
|
13
11
|
/**
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Document } from '../types/document.mjs';
|
|
2
|
-
import '../content-
|
|
3
|
-
import '../formatting-
|
|
2
|
+
import '../content-DVT06V_6.mjs';
|
|
3
|
+
import '../formatting-p5MneNuy.mjs';
|
|
4
4
|
import '../docx/wrapTypes.mjs';
|
|
5
|
-
import '../styles-
|
|
5
|
+
import '../styles-DZZz2oRy.mjs';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Framework-Agnostic Plugin Interface for the DOCX Editor
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { SidebarItem, RenderedDomContext } from './index.mjs';
|
|
2
2
|
import '../types/document.mjs';
|
|
3
|
-
import '../content-
|
|
4
|
-
import '../formatting-
|
|
3
|
+
import '../content-DVT06V_6.mjs';
|
|
4
|
+
import '../formatting-p5MneNuy.mjs';
|
|
5
5
|
import '../docx/wrapTypes.mjs';
|
|
6
|
-
import '../styles-
|
|
6
|
+
import '../styles-DZZz2oRy.mjs';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Pure layout algorithm: given a list of sidebar items + their
|
|
@@ -18,7 +18,13 @@ interface RepackOptions {
|
|
|
18
18
|
}
|
|
19
19
|
/** Repack a public Document through the Rust package writer. */
|
|
20
20
|
declare function repackDocx(doc: Document, options?: RepackOptions): Promise<ArrayBuffer>;
|
|
21
|
+
interface RepackResult {
|
|
22
|
+
buffer: ArrayBuffer;
|
|
23
|
+
warnings: string[];
|
|
24
|
+
}
|
|
25
|
+
/** [`repackDocx`], also returning the non-fatal save diagnostics. */
|
|
26
|
+
declare function repackDocxWithWarnings(doc: Document, options?: RepackOptions): Promise<RepackResult>;
|
|
21
27
|
declare function updateMultipleFiles(originalBuffer: ArrayBuffer, updates: Map<string, string | ArrayBuffer>, options?: RepackOptions): Promise<ArrayBuffer>;
|
|
22
28
|
declare function createDocx(doc: Document): Promise<ArrayBuffer>;
|
|
23
29
|
|
|
24
|
-
export { type
|
|
30
|
+
export { type RepackResult as R, repackDocxWithWarnings as a, type RepackOptions as b, createDocx as c, repackDocx as r, updateMultipleFiles as u };
|
package/dist/styles/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { S as StyleDefinitions, a as Style, D as DocDefaults } from '../styles-
|
|
1
|
+
import { P as ParagraphFormatting, T as TextFormatting } from '../formatting-p5MneNuy.mjs';
|
|
2
|
+
import { S as StyleDefinitions, a as Style, D as DocDefaults } from '../styles-DZZz2oRy.mjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Style Resolver
|
|
@@ -54,7 +54,7 @@ declare class StyleResolver {
|
|
|
54
54
|
* @param styleId - The style ID to resolve (e.g., 'Heading1', 'Normal')
|
|
55
55
|
* @returns Resolved paragraph and run formatting
|
|
56
56
|
*/
|
|
57
|
-
resolveParagraphStyle(styleId: string | undefined | null, tableParagraphFormatting?: ParagraphFormatting): ResolvedParagraphStyle;
|
|
57
|
+
resolveParagraphStyle(styleId: string | undefined | null, tableParagraphFormatting?: ParagraphFormatting, tableRunFormatting?: TextFormatting): ResolvedParagraphStyle;
|
|
58
58
|
/**
|
|
59
59
|
* Resolve the style applied to the paragraph that follows one styled with
|
|
60
60
|
* `styleId` when the user presses Enter (OOXML `w:next`, §17.7.4.10).
|
package/dist/styles/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{
|
|
1
|
+
export{d as StyleResolver,e as createStyleResolver}from'../chunk-ISBZLVIF.mjs';import'../chunk-TTRUPDAB.mjs';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { T as TextFormatting, P as ParagraphFormatting, c as TableFormatting, d as TableRowFormatting, e as TableCellFormatting } from './formatting-p5MneNuy.mjs';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Styles, Theme, Font Table, Relationships & Media Types
|
|
@@ -58,7 +58,7 @@ interface Style {
|
|
|
58
58
|
tcPr?: TableCellFormatting;
|
|
59
59
|
/** Conditional table style parts */
|
|
60
60
|
tblStylePr?: Array<{
|
|
61
|
-
type: 'band1Horz' | 'band1Vert' | 'band2Horz' | 'band2Vert' | 'firstCol' | 'firstRow' | 'lastCol' | 'lastRow' | 'neCell' | 'nwCell' | 'seCell' | 'swCell';
|
|
61
|
+
type: 'wholeTable' | 'band1Horz' | 'band1Vert' | 'band2Horz' | 'band2Vert' | 'firstCol' | 'firstRow' | 'lastCol' | 'lastRow' | 'neCell' | 'nwCell' | 'seCell' | 'swCell';
|
|
62
62
|
pPr?: ParagraphFormatting;
|
|
63
63
|
rPr?: TextFormatting;
|
|
64
64
|
tblPr?: TableFormatting;
|
package/dist/types/content.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { B as BlockContent, l as BlockSdt, m as BookmarkEnd, n as BookmarkStart, o as BreakContent, d as Chart, p as ChartAxis, q as ChartContent, t as ChartLegend, x as ChartSeries, y as ChartType, z as Column, e as Comment, J as CommentRangeEnd, K as CommentRangeStart, M as ComplexField, Q as DEFAULT_WATERMARK_PRESETS, T as Deletion, g as DocumentBody, U as DrawingContent, j as Endnote, X as EndnotePosition, E as EndnoteProperties, Y as Field, Z as FieldCharContent, a0 as FieldType, a1 as FooterReference, i as Footnote, a2 as FootnotePosition, F as FootnoteProperties, H as HeaderFooter, a3 as HeaderFooterType, a4 as HeaderReference, a6 as Hyperlink, a8 as Image, a9 as ImageCrop, ac as ImagePadding, ad as ImagePosition, af as ImageSize, ag as ImageTransform, ah as ImageWrap, aj as InlineSdt, ak as Insertion, al as InstrTextContent, an as LineNumberRestart, aq as MathEquation, ar as MoveFrom, as as MoveFromRangeEnd, at as MoveFromRangeStart, au as MoveTo, av as MoveToRangeEnd, aw as MoveToRangeStart, ax as NoBreakHyphenContent, ay as NoteNumberRestart, az as NoteRefMarkContent, aA as NoteReferenceContent,
|
|
2
|
-
export {
|
|
1
|
+
export { B as BlockContent, l as BlockSdt, m as BookmarkEnd, n as BookmarkStart, o as BreakContent, d as Chart, p as ChartAxis, q as ChartContent, t as ChartLegend, x as ChartSeries, y as ChartType, z as Column, e as Comment, J as CommentRangeEnd, K as CommentRangeStart, M as ComplexField, Q as DEFAULT_WATERMARK_PRESETS, T as Deletion, g as DocumentBody, U as DrawingContent, j as Endnote, X as EndnotePosition, E as EndnoteProperties, Y as Field, Z as FieldCharContent, a0 as FieldType, a1 as FooterReference, i as Footnote, a2 as FootnotePosition, F as FootnoteProperties, H as HeaderFooter, a3 as HeaderFooterType, a4 as HeaderReference, a6 as Hyperlink, a8 as Image, a9 as ImageCrop, ac as ImagePadding, ad as ImagePosition, af as ImageSize, ag as ImageTransform, ah as ImageWrap, aj as InlineSdt, ak as Insertion, al as InstrTextContent, an as LineNumberRestart, aq as MathEquation, ar as MoveFrom, as as MoveFromRangeEnd, at as MoveFromRangeStart, au as MoveTo, av as MoveToRangeEnd, aw as MoveToRangeStart, ax as NoBreakHyphenContent, ay as NoteNumberRestart, az as NoteRefMarkContent, aA as NoteReferenceContent, aE as OpaqueDrawingContent, aG as PageOrientation, P as Paragraph, aH as ParagraphContent, aI as ParagraphPropertyChange, aJ as PictureWatermark, aK as PropertyChangeInfo, bj as RawXml, aL as Run, aM as RunContent, aN as RunPropertyChange, aP as SdtDataBinding, a as SdtProperties, aS as SdtType, aT as Section, f as SectionProperties, aU as SectionStart, aV as SeparatorContent, aW as Shape, aX as ShapeContent, a_ as ShapeTextBody, a$ as SimpleField, b0 as SoftHyphenContent, b3 as SymbolContent, b4 as TabContent, b5 as Table, b6 as TableCell, b7 as TableCellPropertyChange, b8 as TablePropertyChange, b9 as TableRow, ba as TableRowPropertyChange, bb as TableStructuralChangeInfo, bc as TextBox, bd as TextContent, be as TextWatermark, bf as TrackedChangeInfo, bg as TrackedRunChange, bh as VerticalAlign, W as Watermark, bi as pictureWatermarkDisplayEmu } from '../content-DVT06V_6.mjs';
|
|
2
|
+
export { m as ShapeFill, n as ShapeOutline, o as ShapeType } from '../formatting-p5MneNuy.mjs';
|
|
3
3
|
import '../docx/wrapTypes.mjs';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { F as FootnoteProperties, E as EndnoteProperties, g as DocumentBody, h as NumberingDefinitions, i as Footnote, j as Endnote, H as HeaderFooter, d as Chart, k as BookmarkRange } from '../content-
|
|
2
|
-
export { A as AbstractNumbering, B as BlockContent, l as BlockSdt, m as BookmarkEnd, n as BookmarkStart, o as BreakContent, p as ChartAxis, q as ChartContent, r as ChartDataLabels, s as ChartGrouping, t as ChartLegend, u as ChartPlotGroup, v as ChartPoint, w as ChartPointLabel, x as ChartSeries, y as ChartType, z as Column, e as Comment, G as CommentAnchorRange, I as CommentAuthor, J as CommentRangeEnd, K as CommentRangeStart, L as CommentReferenceContent, M as ComplexField, O as ContentPosition, Q as DEFAULT_WATERMARK_PRESETS, T as Deletion, U as DrawingContent, D as DrawingScene, V as DrawingSceneNode, X as EndnotePosition, Y as Field, Z as FieldCharContent, _ as FieldFormData, $ as FieldInlineContent, a0 as FieldType, a1 as FooterReference, a2 as FootnotePosition, a3 as HeaderFooterType, a4 as HeaderReference, a5 as HorizontalRuleContent, a6 as Hyperlink, a7 as HyperlinkContent, a8 as Image, a9 as ImageCrop, aa as ImageEffect, ab as ImageHyperlink, ac as ImagePadding, ad as ImagePosition, ae as ImageRotationBounds, af as ImageSize, ag as ImageTransform, ah as ImageWrap, ai as ImageWrapPoint, aj as InlineSdt, ak as Insertion, al as InstrTextContent, am as LevelSuffix, an as LineNumberRestart, ao as ListLevel, ap as ListRendering, aq as MathEquation, ar as MoveFrom, as as MoveFromRangeEnd, at as MoveFromRangeStart, au as MoveTo, av as MoveToRangeEnd, aw as MoveToRangeStart, ax as NoBreakHyphenContent, N as NoteKind, ay as NoteNumberRestart, az as NoteRefMarkContent, aA as NoteReferenceContent, aB as NoteSeparatorReference, aC as NumberFormat, aD as NumberingInstance, aE as
|
|
3
|
-
import { f as Theme, C as ColorValue } from '../formatting-
|
|
4
|
-
export { B as BorderSpec, g as CellMargins, h as ConditionalFormatStyle, E as EmphasisMark, F as FloatingTableProperties, L as LineSpacingRule,
|
|
5
|
-
import { S as StyleDefinitions, F as FontTable, R as RelationshipMap, M as MediaFile } from '../styles-
|
|
6
|
-
export { D as DocDefaults, b as FontEmbed, c as FontInfo, d as Relationship, e as RelationshipType, a as Style, f as StyleType } from '../styles-
|
|
1
|
+
import { F as FootnoteProperties, E as EndnoteProperties, g as DocumentBody, h as NumberingDefinitions, i as Footnote, j as Endnote, H as HeaderFooter, d as Chart, k as BookmarkRange } from '../content-DVT06V_6.mjs';
|
|
2
|
+
export { A as AbstractNumbering, B as BlockContent, l as BlockSdt, m as BookmarkEnd, n as BookmarkStart, o as BreakContent, p as ChartAxis, q as ChartContent, r as ChartDataLabels, s as ChartGrouping, t as ChartLegend, u as ChartPlotGroup, v as ChartPoint, w as ChartPointLabel, x as ChartSeries, y as ChartType, z as Column, e as Comment, G as CommentAnchorRange, I as CommentAuthor, J as CommentRangeEnd, K as CommentRangeStart, L as CommentReferenceContent, M as ComplexField, O as ContentPosition, Q as DEFAULT_WATERMARK_PRESETS, T as Deletion, U as DrawingContent, D as DrawingScene, V as DrawingSceneNode, X as EndnotePosition, Y as Field, Z as FieldCharContent, _ as FieldFormData, $ as FieldInlineContent, a0 as FieldType, a1 as FooterReference, a2 as FootnotePosition, a3 as HeaderFooterType, a4 as HeaderReference, a5 as HorizontalRuleContent, a6 as Hyperlink, a7 as HyperlinkContent, a8 as Image, a9 as ImageCrop, aa as ImageEffect, ab as ImageHyperlink, ac as ImagePadding, ad as ImagePosition, ae as ImageRotationBounds, af as ImageSize, ag as ImageTransform, ah as ImageWrap, ai as ImageWrapPoint, aj as InlineSdt, ak as Insertion, al as InstrTextContent, am as LevelSuffix, an as LineNumberRestart, ao as ListLevel, ap as ListRendering, aq as MathEquation, ar as MoveFrom, as as MoveFromRangeEnd, at as MoveFromRangeStart, au as MoveTo, av as MoveToRangeEnd, aw as MoveToRangeStart, ax as NoBreakHyphenContent, N as NoteKind, ay as NoteNumberRestart, az as NoteRefMarkContent, aA as NoteReferenceContent, aB as NoteSeparatorReference, aC as NumberFormat, aD as NumberingInstance, aE as OpaqueDrawingContent, aF as PageNumberingProperties, aG as PageOrientation, P as Paragraph, aH as ParagraphContent, aI as ParagraphPropertyChange, aJ as PictureWatermark, aK as PropertyChangeInfo, aL as Run, aM as RunContent, aN as RunPropertyChange, aO as SdtCheckboxGlyph, S as SdtControlState, aP as SdtDataBinding, aQ as SdtDateState, aR as SdtGalleryState, a as SdtProperties, aS as SdtType, aT as Section, f as SectionProperties, aU as SectionStart, aV as SeparatorContent, aW as Shape, aX as ShapeContent, b as ShapeEffect, aY as ShapeFillPaint, aZ as ShapeStrokePaint, a_ as ShapeTextBody, c as ShapeTextBodyProperties, a$ as SimpleField, b0 as SoftHyphenContent, b1 as StructuredFieldContent, b2 as StructuredFieldTree, b3 as SymbolContent, b4 as TabContent, b5 as Table, b6 as TableCell, b7 as TableCellPropertyChange, b8 as TablePropertyChange, b9 as TableRow, ba as TableRowPropertyChange, bb as TableStructuralChangeInfo, bc as TextBox, bd as TextContent, be as TextWatermark, bf as TrackedChangeInfo, bg as TrackedRunChange, bh as VerticalAlign, W as Watermark, bi as pictureWatermarkDisplayEmu } from '../content-DVT06V_6.mjs';
|
|
3
|
+
import { f as Theme, C as ColorValue } from '../formatting-p5MneNuy.mjs';
|
|
4
|
+
export { B as BorderSpec, g as CellMargins, h as ColorTransform, i as ConditionalFormatStyle, E as EmphasisMark, F as FloatingTableProperties, L as LineSpacingRule, j as ParagraphAlignment, k as ParagraphCnfStyle, P as ParagraphFormatting, R as RunFontHint, l as RunLanguage, S as ShadingProperties, m as ShapeFill, n as ShapeOutline, o as ShapeType, p as TabLeader, q as TabStop, r as TabStopAlignment, s as TableBorders, e as TableCellFormatting, c as TableFormatting, t as TableLook, u as TableMeasurement, d as TableRowFormatting, v as TableStyleCascade, w as TableStyleRegion, x as TableWidthType, y as TextEffect, T as TextFormatting, a as TextModernEffects, z as ThemeColorScheme, A as ThemeColorSlot, D as ThemeFont, G as ThemeFontScheme, U as UnderlineStyle } from '../formatting-p5MneNuy.mjs';
|
|
5
|
+
import { S as StyleDefinitions, F as FontTable, R as RelationshipMap, M as MediaFile } from '../styles-DZZz2oRy.mjs';
|
|
6
|
+
export { D as DocDefaults, b as FontEmbed, c as FontInfo, d as Relationship, e as RelationshipType, a as Style, f as StyleType } from '../styles-DZZz2oRy.mjs';
|
|
7
7
|
import '../docx/wrapTypes.mjs';
|
|
8
8
|
|
|
9
9
|
interface CompatibilityFlags {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { S as SdtControlState, a as SdtProperties, R as RevisionInfo, C as CellMarker, D as DrawingScene, b as ShapeEffect, c as ShapeTextBodyProperties, d as Chart, W as Watermark, F as FootnoteProperties, E as EndnoteProperties } from './content-
|
|
2
|
-
import {
|
|
1
|
+
import { S as SdtControlState, a as SdtProperties, R as RevisionInfo, C as CellMarker, D as DrawingScene, b as ShapeEffect, c as ShapeTextBodyProperties, d as Chart, W as Watermark, F as FootnoteProperties, E as EndnoteProperties } from './content-DVT06V_6.mjs';
|
|
2
|
+
import { a as TextModernEffects, b as PresetGeometryPathCommand, B as BorderSpec } from './formatting-p5MneNuy.mjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Inline SDT widget metadata carried by a painted text run.
|
|
@@ -301,6 +301,9 @@ type ImageRun = {
|
|
|
301
301
|
allowOverlap?: boolean;
|
|
302
302
|
/** `wp:anchor/@layoutInCell`; undefined = true. */
|
|
303
303
|
layoutInCell?: boolean;
|
|
304
|
+
noChangeAspect?: boolean;
|
|
305
|
+
/** VML `o:hr` picture: alone on its line, the line is the picture's height. */
|
|
306
|
+
horizontalRule?: boolean;
|
|
304
307
|
/** Effect extent in px. Undefined = zero. */
|
|
305
308
|
effectExtent?: {
|
|
306
309
|
top?: number;
|
|
@@ -532,6 +535,7 @@ type CellBorderSpec = {
|
|
|
532
535
|
width?: number;
|
|
533
536
|
color?: string;
|
|
534
537
|
style?: string;
|
|
538
|
+
ooxmlStyle?: string;
|
|
535
539
|
};
|
|
536
540
|
/**
|
|
537
541
|
* Border edges of a single cell.
|
|
@@ -655,8 +659,10 @@ type TableBlock = {
|
|
|
655
659
|
value?: number;
|
|
656
660
|
type?: 'auto' | 'pct' | 'dxa' | 'nil';
|
|
657
661
|
};
|
|
658
|
-
/**
|
|
662
|
+
/** Width layout policy; undefined preserves the legacy resolver. */
|
|
659
663
|
layoutMode?: 'fixed' | 'autofit';
|
|
664
|
+
/** DOCX `w:tblLayout`, applied only when all cell content widths are known. */
|
|
665
|
+
tableLayout?: 'fixed' | 'autofit';
|
|
660
666
|
/** Intrinsic sizing policy. Undefined = legacy fill-available-width. */
|
|
661
667
|
widthAlgorithm?: 'legacy' | 'fixed' | 'autofit';
|
|
662
668
|
/** Resolved table-style provenance/conditionals. */
|
|
@@ -1291,6 +1297,12 @@ type TableFragment = FragmentBase & {
|
|
|
1291
1297
|
* visible band of that single row is `[clipTop, clipBottom)`.
|
|
1292
1298
|
*/
|
|
1293
1299
|
clipBottom?: number;
|
|
1300
|
+
cellClips?: {
|
|
1301
|
+
row: number;
|
|
1302
|
+
cell: number;
|
|
1303
|
+
top: number;
|
|
1304
|
+
bottom: number;
|
|
1305
|
+
}[];
|
|
1294
1306
|
};
|
|
1295
1307
|
/**
|
|
1296
1308
|
* An image placed on a page.
|
|
@@ -1509,6 +1521,7 @@ type HeaderFooterLayout = {
|
|
|
1509
1521
|
* The paginator's complete result — everything the painter needs.
|
|
1510
1522
|
*/
|
|
1511
1523
|
type Layout = {
|
|
1524
|
+
summaryOnly?: true;
|
|
1512
1525
|
/** Serialization contract version. Undefined reads as legacy version 0. */
|
|
1513
1526
|
contractVersion?: number;
|
|
1514
1527
|
/** Default page size for the document. */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { P as Paragraph, B as BlockContent, e as Comment } from '../content-
|
|
2
|
-
import '../formatting-
|
|
1
|
+
import { P as Paragraph, B as BlockContent, e as Comment } from '../content-DVT06V_6.mjs';
|
|
2
|
+
import '../formatting-p5MneNuy.mjs';
|
|
3
3
|
import '../docx/wrapTypes.mjs';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
`);return e}function d(t){if(!t||!t.content)return "";let e="";for(let n of t.content)if(n.type==="run")e+=u(n);else if(n.type==="hyperlink")for(let r of n.children||[])r.type==="run"&&(e+=u(r));return e}function E(t,e,n){if(!t||!e)return [];let r=[],o=t.package?.document||t.package?.document;if(!o||!o.content)return r;let c=0;for(let i of o.content)if(i.type==="paragraph"){let a=x(i,e,n,c);r.push(...a),c++;}else if(i.type==="table")for(let a of i.rows||[])for(let s of a.cells||[])for(let f of s.content||[])f.type;return r}function x(t,e,n,r){let o=[],c=d(t);if(!c)return o;let i=l(c,e,n);for(let a of i){let s=m(t,a.start);o.push({paragraphIndex:r,contentIndex:s.contentIndex,startOffset:s.offsetInContent,endOffset:s.offsetInContent+(a.end-a.start),text:c.substring(a.start,a.end)});}return o}function m(t,e){if(!t||!t.content)return {contentIndex:0,runIndex:0,offsetInContent:e};let n=0,r=0;for(let o of t.content){let c="";if(o.type==="run")c=u(o);else if(o.type==="hyperlink")for(let a of o.children||[])a.type==="run"&&(c+=u(a));let i=c.length;if(n+i>e)return {contentIndex:r,runIndex:r,offsetInContent:e-n};n+=i,r++;}return {contentIndex:Math.max(0,t.content.length-1),runIndex:Math.max(0,t.content.length-1),offsetInContent:0}}function w(t,e){if(!t||!e)return;let n=t.querySelector(`[data-paragraph-index="${e.paragraphIndex}"]`);n&&n.scrollIntoView({behavior:"smooth",block:"center"});}export{F as createDefaultFindOptions,p as createSearchPattern,g as escapeRegexString,l as findAllMatches,E as findInDocument,x as findInParagraph,R as getDefaultHighlightOptions,M as getMatchCountText,O as isEmptySearch,y as replaceAllInContent,C as replaceFirstInContent,w as scrollToMatch};
|
|
1
|
+
export{a as createDefaultFindOptions,c as createSearchPattern,b as escapeRegexString,d as findAllMatches,j as findInDocument,k as findInParagraph,i as getDefaultHighlightOptions,g as getMatchCountText,h as isEmptySearch,e as replaceAllInContent,f as replaceFirstInContent,l as scrollToMatch}from'../chunk-N5RE2S3U.mjs';import'../chunk-TTRUPDAB.mjs';
|
package/dist/utils/index.d.mts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
export { PIXELS_PER_INCH, TWIPS_PER_INCH, clamp, eighthsToPixels, emuToPixels, emuToTwips, formatPx, halfPointsToPixels, halfPointsToPoints, pixelsToEmu, pixelsToTwips, pointsToHalfPoints, pointsToPixels, roundPixels, twipsToEmu, twipsToPixels } from './units.mjs';
|
|
2
|
-
import { F as FontLoadScope } from '../fontLoader-
|
|
3
|
-
export { C as BufferFaceInput, D as FONT_MAPPING, E as FontDefinition, T as ThemeMatrixCell, b as blendColors, c as canRenderFont, a as colorsEqual, G as createFontLoadScope, d as createRgbColor, e as createThemeColor, f as darkenColor, g as ensureHexPrefix, H as extractFontsFromDocument, h as generateThemeTintShadeMatrix, i as getContrastingColor, I as getGoogleFontEquivalent, j as getLoadedFonts, k as getThemeTintShadeHex, l as isBlack, m as isFontLoaded, o as isGoogleFontsEnabled, n as isLoading, p as isWhite, q as lightenColor, J as loadDocumentFonts, r as loadFont, K as loadFontDefinitions, s as loadFontFromBuffer, L as loadFontFromUrl, M as loadFontWithMapping, t as loadFonts, N as loadFontsWithMapping, O as onFontError, u as onFontsLoaded, v as parseColorString, w as preloadCommonFonts, P as registerDocumentFaces, x as resolveColor, Q as resolveColorToHex, y as resolveHighlightColor, z as resolveHighlightToCss, A as resolveShadingColor, B as setGoogleFontsEnabled } from '../fontLoader-
|
|
2
|
+
import { F as FontLoadScope } from '../fontLoader-CBkmh4ps.mjs';
|
|
3
|
+
export { C as BufferFaceInput, D as FONT_MAPPING, E as FontDefinition, T as ThemeMatrixCell, b as blendColors, c as canRenderFont, a as colorsEqual, G as createFontLoadScope, d as createRgbColor, e as createThemeColor, f as darkenColor, g as ensureHexPrefix, H as extractFontsFromDocument, h as generateThemeTintShadeMatrix, i as getContrastingColor, I as getGoogleFontEquivalent, j as getLoadedFonts, k as getThemeTintShadeHex, l as isBlack, m as isFontLoaded, o as isGoogleFontsEnabled, n as isLoading, p as isWhite, q as lightenColor, J as loadDocumentFonts, r as loadFont, K as loadFontDefinitions, s as loadFontFromBuffer, L as loadFontFromUrl, M as loadFontWithMapping, t as loadFonts, N as loadFontsWithMapping, O as onFontError, u as onFontsLoaded, v as parseColorString, w as preloadCommonFonts, P as registerDocumentFaces, x as resolveColor, Q as resolveColorToHex, y as resolveHighlightColor, z as resolveHighlightToCss, A as resolveShadingColor, B as setGoogleFontsEnabled } from '../fontLoader-CBkmh4ps.mjs';
|
|
4
4
|
export { D as DocxInput, t as toArrayBuffer } from '../docxInput-DTbCa48g.mjs';
|
|
5
|
-
import { F as FontTable } from '../styles-
|
|
5
|
+
import { F as FontTable } from '../styles-DZZz2oRy.mjs';
|
|
6
6
|
import { Document } from '../types/document.mjs';
|
|
7
7
|
import { FontOption } from './fontOptions.mjs';
|
|
8
8
|
export { MIN_CARD_GAP, SIDEBAR_DOCUMENT_SHIFT, SIDEBAR_PAGE_GAP, SIDEBAR_WIDTH } from './sidebarConstants.mjs';
|
|
9
|
-
import { e as Comment } from '../content-
|
|
10
|
-
import '../formatting-
|
|
9
|
+
import { e as Comment } from '../content-DVT06V_6.mjs';
|
|
10
|
+
import '../formatting-p5MneNuy.mjs';
|
|
11
11
|
import '../docx/wrapTypes.mjs';
|
|
12
12
|
|
|
13
13
|
/**
|
package/dist/utils/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{d as MIN_CARD_GAP,c as SIDEBAR_DOCUMENT_SHIFT,b as SIDEBAR_PAGE_GAP,a as SIDEBAR_WIDTH}from'../chunk-YUOKI2HB.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,b as resolveColorToHex,i as resolveHighlightColor,q as resolveHighlightToCss,j as resolveShadingColor}from'../chunk-LTVVQMHB.mjs';export{a as PIXELS_PER_INCH,e as TWIPS_PER_INCH,p as clamp,n as eighthsToPixels,b as emuToPixels,i as emuToTwips,q as formatPx,k as halfPointsToPixels,l as halfPointsToPoints,c as pixelsToEmu,h as pixelsToTwips,m as pointsToHalfPoints,d as pointsToPixels,o as roundPixels,j as twipsToEmu,g as twipsToPixels}from'../chunk-CTBUQRYQ.mjs';import {n,d}from'../chunk-VH7P4734.mjs';export{s as FONT_MAPPING,n as canRenderFont,z as createFontLoadScope,c as deobfuscateFont,C as extractEmbeddedFontFaces,x as extractFontsFromDocument,B as getEmbeddedFontFaces,A as getEmbeddedFontFamilies,t as getGoogleFontEquivalent,k as getLoadedFonts,g as isFontLoaded,i as isGoogleFontsEnabled,j as isLoading,b as isValidFontKey,y as loadDocumentFonts,E as loadEmbeddedFontFamilies,D as loadEmbeddedFonts,e as loadFont,r as loadFontDefinitions,o as loadFontFromBuffer,q as loadFontFromUrl,u as loadFontWithMapping,f as loadFonts,v as loadFontsWithMapping,m as onFontError,l as onFontsLoaded,w as preloadCommonFonts,p as registerDocumentFaces,h as setGoogleFontsEnabled,a as toArrayBuffer}from'../chunk-VH7P4734.mjs';import'../chunk-EBYC3CX7.mjs';import {a}from'../chunk-UBUTIWXN.mjs';import'../chunk-LT2GCWZ3.mjs';import'../chunk-HPZFJGGM.mjs';import'../chunk-AXFMDV66.mjs';import'../chunk-GKWXOZZH.mjs';import'../chunk-HGKSOBXK.mjs';import'../chunk-DLXIZBB6.mjs';import'../chunk-TTRUPDAB.mjs';function L(e){let t=new Set,o=e.package;if(o.theme&&it(o.theme,t),o.styles&<(o.styles,t),o.document)for(let n of o.document.content)y(n,t);if(o.headers)for(let n of o.headers.values())H(n,t);if(o.footers)for(let n of o.footers.values())H(n,t);if(o.footnotes)for(let n of o.footnotes)ht(n,t);if(o.endnotes)for(let n of o.endnotes)xt(n,t);return Array.from(t).sort()}function it(e,t){let o=e.fontScheme;o&&(o.majorFont&&O(o.majorFont,t),o.minorFont&&O(o.minorFont,t));}function O(e,t){if(e.latin&&t.add(e.latin),e.ea&&t.add(e.ea),e.cs&&t.add(e.cs),e.fonts)for(let o of Object.values(e.fonts))o&&t.add(o);}function lt(e,t){e.docDefaults&&(e.docDefaults.rPr&&x(e.docDefaults.rPr,t),e.docDefaults.pPr?.runProperties&&x(e.docDefaults.pPr.runProperties,t));for(let o of e.styles)o.rPr&&x(o.rPr,t),o.pPr?.runProperties&&x(o.pPr.runProperties,t);}function x(e,t){let o=e.fontFamily;o&&(o.ascii&&t.add(o.ascii),o.hAnsi&&t.add(o.hAnsi),o.eastAsia&&t.add(o.eastAsia),o.cs&&t.add(o.cs));}function ct(e,t){e.runProperties&&x(e.runProperties,t);}function y(e,t){e.type==="paragraph"?ft(e,t):e.type==="table"&&mt(e,t);}function ft(e,t){e.formatting&&ct(e.formatting,t);for(let o of e.content)dt(o,t);}function dt(e,t){if(e.type==="run")h(e,t);else if(e.type==="hyperlink")ut(e,t),a(e,o=>{o.type==="run"&&h(o,t);});else if(e.type==="inlineSdt"||e.type==="insertion"||e.type==="deletion"||e.type==="moveFrom"||e.type==="moveTo")a(e,o=>{o.type==="run"&&h(o,t);});else if(e.type==="simpleField"||e.type==="complexField"){if("content"in e)for(let o of e.content)o.type==="run"&&h(o,t);if("fieldResult"in e)for(let o of e.fieldResult)h(o,t);a(e,o=>{o.type==="run"&&h(o,t);});}}function h(e,t){e.formatting&&x(e.formatting,t);}function ut(e,t){for(let o of e.children)o.type==="run"&&h(o,t);}function mt(e,t){for(let o of e.rows)pt(o,t);}function pt(e,t){for(let o of e.cells)gt(o,t);}function gt(e,t){for(let o of e.content)y(o,t);}function H(e,t){for(let o of e.content)y(o,t);}function ht(e,t){for(let o of e.content)y(o,t);}function xt(e,t){for(let o of e.content)y(o,t);}var Ft=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui"]);function N(e,t={}){let o=t.canRender??n,n$1=new Set;for(let i of t.exclude??[])n$1.add(i.trim().toLowerCase());let r=new Set;for(let i of t.embeddedFamilies??[])r.add(i.trim().toLowerCase());let s=[],a=new Set;for(let i of e){let c=i.trim(),f=c.toLowerCase();!c||Ft.has(f)||n$1.has(f)||a.has(f)||!r.has(f)&&!o(c)||(a.add(f),s.push({name:c,fontFamily:d(c).cssFallback,category:"other"}));}return s}function Tt(e,t={}){return N(L(e),t)}function yt(e,t){if(!e||e.length===0)return [];let o=new Set;for(let s of t)o.add(s.trim().toLowerCase());let n=new Set,r=[];for(let s of e){let a=s.name.trim().toLowerCase();o.has(a)||n.has(a)||(n.add(a),r.push(s));}return r}function bt(e){let t=[];return e.descendants((o,n)=>{if(o.type.name==="paragraph"){let r=o.attrs.outlineLevel,s=o.attrs.styleId,a=r;if(a==null&&s){let i=s.match(/^[Hh]eading(\d)$/);i&&(a=parseInt(i[1],10)-1);}if(a!=null&&a>=0&&a<=8){let i="";o.forEach(c=>{c.isText&&(i+=c.text||"");}),i.trim()&&t.push({text:i.trim(),level:a,pmPos:n});}}}),t}var k="rgba(255, 235, 59, 0.55)",Ct=1200,C="docx-paragraph-flash",E=new WeakMap;function At(e){let t=globalThis;return typeof t.CSS?.escape=="function"?t.CSS.escape(e):e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}function St(e){return e?.color?.trim()||k}function Et(e){let t=e?.durationMs;return t==null||!Number.isFinite(t)||t<0?1200:t}function W(e,t){if(!t||!t.trim())return [];let o=At(t);return Array.from(e.querySelectorAll(`.layout-paragraph[data-para-id="${o}"]`))}function B(e,t){let o=0,n=St(t),r=Et(t);for(let s of e){o++;let a=E.get(s);a!==void 0&&clearTimeout(a),s.classList.remove(C),s.offsetWidth,s.style.setProperty("--docx-paragraph-flash-color",n),s.style.setProperty("--docx-paragraph-flash-duration",`${r}ms`),s.classList.add(C);let i=setTimeout(()=>{s.classList.remove(C),s.style.removeProperty("--docx-paragraph-flash-color"),s.style.removeProperty("--docx-paragraph-flash-duration"),E.delete(s);},r);E.set(s,i);}return o}function wt(e,t,o){let n=W(e,t);return B(n,o)>0}function G(e,t,o){let n=0;for(let r=t;r<t+o&&r<e.length;r++)n+=e[r];return n}function Pt(e,t,o,n){let r=G(e,t,o),s=Math.floor(r/Math.max(n,1)),a=r-s*n,i=Array.from({length:n},(c,f)=>s+(f<a?1:0));return [...e.slice(0,t),...i,...e.slice(t+o)]}function Rt(e,t,o,n,r,s){let a=o-t.rowspan,i=n-t.colspan,c=r+a,f=t.row+t.rowspan,T=t.col+t.colspan,p=[];for(let l of e){if(l===t)continue;let g=l.row+l.rowspan,A=l.col+l.colspan,I=l.row<f&&g>t.row,M=l.col<T&&A>t.col;p.push({data:l.data,row:l.row>=f?l.row+a:l.row,col:l.col>=T?l.col+i:l.col,rowspan:l.rowspan+(a>0&&I&&!M?a:0),colspan:l.colspan+(i>0&&M&&!I?i:0)});}for(let l=0;l<o;l++)for(let g=0;g<n;g++){let A=l===0&&g===0;p.push({data:s(A,l,g),row:t.row+l,col:t.col+g,rowspan:1,colspan:1});}return {anchors:p,deltaRows:a,deltaCols:i,newRowCount:c}}function Dt(e){let t=new Map,o=new Map;for(let n of e){t.set(`${n.row}-${n.col}`,n);for(let r=n.row;r<n.row+n.rowspan;r++)for(let s=n.col;s<n.col+n.colspan;s++)o.set(`${r}-${s}`,n);}return {byStart:t,byCoveredSlot:o}}function vt(e,t){let o=e>1||t>1;return {minRows:e,minCols:t,initialRows:e,initialCols:o?t:t+1}}var It=/[\p{L}\p{N}\p{M}_''\-]/u,Mt=/\s/;function w(e){return !e||e.length===0?false:It.test(e)}function P(e){return !e||e.length===0?false:Mt.test(e)}function m(e,t){if(!e||e.length===0)return [0,0];t=Math.max(0,Math.min(t,e.length-1));let o=e[t];if(P(o)){let n=t,r=t;for(;n>0&&P(e[n-1]);)n--;for(;r<e.length&&P(e[r]);)r++;return [n,r]}if(w(o)){let n=t,r=t;for(;n>0&&w(e[n-1]);)n--;for(;r<e.length&&w(e[r]);)r++;return [n,r]}return [t,t+1]}function _t(e,t){let[o,n]=m(e,t);return e.slice(o,n)}function Ot(e,t){let[o,n]=m(e,t);return {word:e.slice(o,n),startIndex:o,endIndex:n}}function v(){let e=window.getSelection();if(!e||e.rangeCount===0)return false;let t=e.getRangeAt(0),o=t.startContainer;if(o.nodeType===Node.TEXT_NODE){let n=o.textContent||"",r=t.startOffset,[s,a]=m(n,r);if(a>s)return t.setStart(o,s),t.setEnd(o,a),e.removeAllRanges(),e.addRange(t),true}if(o.nodeType===Node.ELEMENT_NODE){let n=o,r=U(n);if(r.length>0){let s=t.startOffset,a=null,i=s;if(s<n.childNodes.length){let c=n.childNodes[s];if(c.nodeType===Node.TEXT_NODE)a=c,i=0;else if(c instanceof Element){let f=U(c);f.length>0&&(a=f[0],i=0);}}if(!a&&r.length>0&&(a=r[0],i=0),a){let c=a.textContent||"",[f,T]=m(c,i);if(T>f){let p=document.createRange();return p.setStart(a,f),p.setEnd(a,T),e.removeAllRanges(),e.addRange(p),true}}}}return false}function Ht(e,t){let o=window.getSelection();if(!o)return false;let n=e.textContent||"",[r,s]=m(n,t);if(s>r){let a=document.createRange();return a.setStart(e,r),a.setEnd(e,s),o.removeAllRanges(),o.addRange(a),true}return false}function Lt(){let e=window.getSelection();if(!e||e.rangeCount===0)return false;let t=e.getRangeAt(0);if(t.collapsed)return v();let o=t.startContainer,n=t.endContainer,r=t.startOffset,s=t.endOffset;if(o.nodeType===Node.TEXT_NODE){let a=o.textContent||"",[i]=m(a,t.startOffset);r=i;}if(n.nodeType===Node.TEXT_NODE){let a=n.textContent||"",i=Math.max(0,t.endOffset-1),[,c]=m(a,i);s=c;}try{return t.setStart(o,r),t.setEnd(n,s),e.removeAllRanges(),e.addRange(t),!0}catch(a){return console.warn("Could not expand selection to word boundaries:",a),false}}function K(){let e=window.getSelection();if(!e||e.rangeCount===0)return false;let o=e.getRangeAt(0).commonAncestorContainer,n=Nt(o);if(n){let r=document.createRange();return r.selectNodeContents(n),e.removeAllRanges(),e.addRange(r),true}return false}function Nt(e){if(!e)return null;let t=e;for(;t;){if(t instanceof Element&&t.hasAttribute("data-paragraph-index"))return t;t=t.parentNode;}return null}function U(e){let t=[],o=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,null),n;for(;n=o.nextNode();)n.nodeType===Node.TEXT_NODE&&t.push(n);return t}var R=0,F=null,D=null,kt=500;function X(){R=0,D=null,F&&(clearTimeout(F),F=null);}function $(e){return e.target!==D&&X(),R++,D=e.target,F&&clearTimeout(F),F=setTimeout(X,kt),Math.min(R,3)}function Wt(){return e=>{e.ctrlKey||e.metaKey||e.altKey||v();}}function Bt(){return e=>{if($(e)===3){if(e.ctrlKey||e.metaKey||e.altKey)return;K();}}}async function Gt(e){let t=e.target;if(!t||!t.files)return null;let o=t.files[0];return t.value="",o?{buffer:await o.arrayBuffer(),name:o.name.replace(/\.docx$/i,"")}:null}var z="(prefers-color-scheme: dark)";function j(){return typeof window<"u"&&typeof window.matchMedia=="function"}function Ut(){return j()?window.matchMedia(z).matches:false}function Xt(e,t){return e==="dark"||e==="system"&&t}function Kt(e){if(!j())return ()=>{};let t=window.matchMedia(z);e(t.matches);let o=n=>e(n.matches);return t.addEventListener("change",o),()=>t.removeEventListener("change",o)}var $t=-1;function zt(){let e=1;return {next:()=>e++,seedAbove(t){t>=e&&(e=t+1);}}}function jt(e,t,o,n){return {id:e.next(),author:o,date:new Date().toISOString(),content:[{type:"paragraph",formatting:{},content:[{type:"run",formatting:{},content:[{type:"text",text:t}]}]}],...n!==void 0&&{parentId:n}}}var qt=/^[a-z][a-z0-9+.-]*:/i,Qt=/^(https?|mailto|tel|ftp):/i;function Vt(e){if(!e)return;let t=e.replace(/[\t\n\r]/g,"").replace(/^[\x00-\x20]+/,"");if(t)return qt.test(t)?Qt.test(t)?e:void 0:e}export{k as DEFAULT_PARAGRAPH_FLASH_COLOR,Ct as DEFAULT_PARAGRAPH_FLASH_DURATION_MS,C as PARAGRAPH_FLASH_CLASS_NAME,$t as PENDING_COMMENT_ID,Dt as buildAnchorMaps,bt as collectHeadings,vt as computeSplitDialogDefaults,Rt as computeSplitLayout,jt as createComment,zt as createCommentIdAllocator,Wt as createDoubleClickWordSelector,Bt as createTripleClickParagraphSelector,yt as excludeFontsByName,Lt as expandSelectionToWordBoundaries,W as findParagraphFragmentsByParaId,Ot as findWordAt,m as findWordBoundaries,B as flashParagraphElements,wt as flashParagraphFragmentsByParaId,Tt as getRenderableDocumentFonts,_t as getWordAt,$ as handleClickForMultiClick,Ut as prefersColorSchemeDark,Gt as readDocxFileFromInput,Pt as redistributeColumnWidths,Xt as resolveIsDark,Vt as sanitizeHref,K as selectParagraphAtCursor,N as selectRenderableFonts,v as selectWordAtCursor,Ht as selectWordInTextNode,Kt as subscribeSystemDark,G as sumColumnWidths};
|
|
1
|
+
export{i as createDoubleClickWordSelector,j as createTripleClickParagraphSelector,f as expandSelectionToWordBoundaries,c as findWordAt,a as findWordBoundaries,b as getWordAt,h as handleClickForMultiClick,g as selectParagraphAtCursor,d as selectWordAtCursor,e as selectWordInTextNode}from'../chunk-32A4I3T4.mjs';export{d as MIN_CARD_GAP,c as SIDEBAR_DOCUMENT_SHIFT,b as SIDEBAR_PAGE_GAP,a as SIDEBAR_WIDTH}from'../chunk-YUOKI2HB.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,b as resolveColorToHex,i as resolveHighlightColor,q as resolveHighlightToCss,j as resolveShadingColor}from'../chunk-LTVVQMHB.mjs';export{a as PIXELS_PER_INCH,e as TWIPS_PER_INCH,p as clamp,n as eighthsToPixels,b as emuToPixels,i as emuToTwips,q as formatPx,k as halfPointsToPixels,l as halfPointsToPoints,c as pixelsToEmu,h as pixelsToTwips,m as pointsToHalfPoints,d as pointsToPixels,o as roundPixels,j as twipsToEmu,g as twipsToPixels}from'../chunk-CTBUQRYQ.mjs';import {n,d}from'../chunk-QX2CDKPG.mjs';export{s as FONT_MAPPING,n as canRenderFont,z as createFontLoadScope,c as deobfuscateFont,C as extractEmbeddedFontFaces,x as extractFontsFromDocument,B as getEmbeddedFontFaces,A as getEmbeddedFontFamilies,t as getGoogleFontEquivalent,k as getLoadedFonts,g as isFontLoaded,i as isGoogleFontsEnabled,j as isLoading,b as isValidFontKey,y as loadDocumentFonts,E as loadEmbeddedFontFamilies,D as loadEmbeddedFonts,e as loadFont,r as loadFontDefinitions,o as loadFontFromBuffer,q as loadFontFromUrl,u as loadFontWithMapping,f as loadFonts,v as loadFontsWithMapping,m as onFontError,l as onFontsLoaded,w as preloadCommonFonts,p as registerDocumentFaces,h as setGoogleFontsEnabled,a as toArrayBuffer}from'../chunk-QX2CDKPG.mjs';import'../chunk-HPZFJGGM.mjs';import'../chunk-QGZ2AB3M.mjs';import'../chunk-LT2GCWZ3.mjs';import'../chunk-YITJ4QAO.mjs';import {a}from'../chunk-UBUTIWXN.mjs';import'../chunk-7WIUNGQW.mjs';import'../chunk-DLXIZBB6.mjs';import'../chunk-HGKSOBXK.mjs';import'../chunk-TTRUPDAB.mjs';function D(t){let e=new Set,o=t.package;if(o.theme&&at(o.theme,e),o.styles&&st(o.styles,e),o.document)for(let r of o.document.content)F(r,e);if(o.headers)for(let r of o.headers.values())E(r,e);if(o.footers)for(let r of o.footers.values())E(r,e);if(o.footnotes)for(let r of o.footnotes)gt(r,e);if(o.endnotes)for(let r of o.endnotes)Ft(r,e);return Array.from(e).sort()}function at(t,e){let o=t.fontScheme;o&&(o.majorFont&&R(o.majorFont,e),o.minorFont&&R(o.minorFont,e));}function R(t,e){if(t.latin&&e.add(t.latin),t.ea&&e.add(t.ea),t.cs&&e.add(t.cs),t.fonts)for(let o of Object.values(t.fonts))o&&e.add(o);}function st(t,e){t.docDefaults&&(t.docDefaults.rPr&&g(t.docDefaults.rPr,e),t.docDefaults.pPr?.runProperties&&g(t.docDefaults.pPr.runProperties,e));for(let o of t.styles)o.rPr&&g(o.rPr,e),o.pPr?.runProperties&&g(o.pPr.runProperties,e);}function g(t,e){let o=t.fontFamily;o&&(o.ascii&&e.add(o.ascii),o.hAnsi&&e.add(o.hAnsi),o.eastAsia&&e.add(o.eastAsia),o.cs&&e.add(o.cs));}function lt(t,e){t.runProperties&&g(t.runProperties,e);}function F(t,e){t.type==="paragraph"?ct(t,e):t.type==="table"&&mt(t,e);}function ct(t,e){t.formatting&<(t.formatting,e);for(let o of t.content)ft(o,e);}function ft(t,e){if(t.type==="run")u(t,e);else if(t.type==="hyperlink")dt(t,e),a(t,o=>{o.type==="run"&&u(o,e);});else if(t.type==="inlineSdt"||t.type==="insertion"||t.type==="deletion"||t.type==="moveFrom"||t.type==="moveTo")a(t,o=>{o.type==="run"&&u(o,e);});else if(t.type==="simpleField"||t.type==="complexField"){if("content"in t)for(let o of t.content)o.type==="run"&&u(o,e);if("fieldResult"in t)for(let o of t.fieldResult)u(o,e);a(t,o=>{o.type==="run"&&u(o,e);});}}function u(t,e){t.formatting&&g(t.formatting,e);}function dt(t,e){for(let o of t.children)o.type==="run"&&u(o,e);}function mt(t,e){for(let o of t.rows)pt(o,e);}function pt(t,e){for(let o of t.cells)ut(o,e);}function ut(t,e){for(let o of t.content)F(o,e);}function E(t,e){for(let o of t.content)F(o,e);}function gt(t,e){for(let o of t.content)F(o,e);}function Ft(t,e){for(let o of t.content)F(o,e);}var ht=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui"]);function v(t,e={}){let o=e.canRender??n,r=new Set;for(let l of e.exclude??[])r.add(l.trim().toLowerCase());let i=new Set;for(let l of e.embeddedFamilies??[])i.add(l.trim().toLowerCase());let n$1=[],a=new Set;for(let l of t){let c=l.trim(),f=c.toLowerCase();!c||ht.has(f)||r.has(f)||a.has(f)||!i.has(f)&&!o(c)||(a.add(f),n$1.push({name:c,fontFamily:d(c).cssFallback,category:"other"}));}return n$1}function xt(t,e={}){return v(D(t),e)}function yt(t,e){if(!t||t.length===0)return [];let o=new Set;for(let n of e)o.add(n.trim().toLowerCase());let r=new Set,i=[];for(let n of t){let a=n.name.trim().toLowerCase();o.has(a)||r.has(a)||(r.add(a),i.push(n));}return i}function bt(t){let e=[];return t.descendants((o,r)=>{if(o.type.name==="paragraph"){let i=o.attrs.outlineLevel,n=o.attrs.styleId,a=i;if(a==null&&n){let l=n.match(/^[Hh]eading(\d)$/);l&&(a=parseInt(l[1],10)-1);}if(a!=null&&a>=0&&a<=8){let l="";o.forEach(c=>{c.isText&&(l+=c.text||"");}),l.trim()&&e.push({text:l.trim(),level:a,pmPos:r});}}}),e}var I="rgba(255, 235, 59, 0.55)",At=1200,x="docx-paragraph-flash",S=new WeakMap;function St(t){let e=globalThis;return typeof e.CSS?.escape=="function"?e.CSS.escape(t):t.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}function Tt(t){return t?.color?.trim()||I}function Pt(t){let e=t?.durationMs;return e==null||!Number.isFinite(e)||e<0?1200:e}function H(t,e){if(!e||!e.trim())return [];let o=St(e);return Array.from(t.querySelectorAll(`.layout-paragraph[data-para-id="${o}"]`))}function L(t,e){let o=0,r=Tt(e),i=Pt(e);for(let n of t){o++;let a=S.get(n);a!==void 0&&clearTimeout(a),n.classList.remove(x),n.offsetWidth,n.style.setProperty("--docx-paragraph-flash-color",r),n.style.setProperty("--docx-paragraph-flash-duration",`${i}ms`),n.classList.add(x);let l=setTimeout(()=>{n.classList.remove(x),n.style.removeProperty("--docx-paragraph-flash-color"),n.style.removeProperty("--docx-paragraph-flash-duration"),S.delete(n);},i);S.set(n,l);}return o}function Ct(t,e,o){let r=H(t,e);return L(r,o)>0}function M(t,e,o){let r=0;for(let i=e;i<e+o&&i<t.length;i++)r+=t[i];return r}function wt(t,e,o,r){let i=M(t,e,o),n=Math.floor(i/Math.max(r,1)),a=i-n*r,l=Array.from({length:r},(c,f)=>n+(f<a?1:0));return [...t.slice(0,e),...l,...t.slice(e+o)]}function Rt(t,e,o,r,i,n){let a=o-e.rowspan,l=r-e.colspan,c=i+a,f=e.row+e.rowspan,T=e.col+e.colspan,y=[];for(let s of t){if(s===e)continue;let p=s.row+s.rowspan,b=s.col+s.colspan,P=s.row<f&&p>e.row,C=s.col<T&&b>e.col;y.push({data:s.data,row:s.row>=f?s.row+a:s.row,col:s.col>=T?s.col+l:s.col,rowspan:s.rowspan+(a>0&&P&&!C?a:0),colspan:s.colspan+(l>0&&C&&!P?l:0)});}for(let s=0;s<o;s++)for(let p=0;p<r;p++){let b=s===0&&p===0;y.push({data:n(b,s,p),row:e.row+s,col:e.col+p,rowspan:1,colspan:1});}return {anchors:y,deltaRows:a,deltaCols:l,newRowCount:c}}function Et(t){let e=new Map,o=new Map;for(let r of t){e.set(`${r.row}-${r.col}`,r);for(let i=r.row;i<r.row+r.rowspan;i++)for(let n=r.col;n<r.col+r.colspan;n++)o.set(`${i}-${n}`,r);}return {byStart:e,byCoveredSlot:o}}function Dt(t,e){let o=t>1||e>1;return {minRows:t,minCols:e,initialRows:t,initialCols:o?e:e+1}}async function vt(t){let e=t.target;if(!e||!e.files)return null;let o=e.files[0];return e.value="",o?{buffer:await o.arrayBuffer(),name:o.name.replace(/\.docx$/i,"")}:null}var _="(prefers-color-scheme: dark)";function O(){return typeof window<"u"&&typeof window.matchMedia=="function"}function It(){return O()?window.matchMedia(_).matches:false}function Ht(t,e){return t==="dark"||t==="system"&&e}function Lt(t){if(!O())return ()=>{};let e=window.matchMedia(_);t(e.matches);let o=r=>t(r.matches);return e.addEventListener("change",o),()=>e.removeEventListener("change",o)}var Mt=-1;function _t(){let t=1;return {next:()=>t++,seedAbove(e){e>=t&&(t=e+1);}}}function Ot(t,e,o,r){return {id:t.next(),author:o,date:new Date().toISOString(),content:[{type:"paragraph",formatting:{},content:[{type:"run",formatting:{},content:[{type:"text",text:e}]}]}],...r!==void 0&&{parentId:r}}}var kt=/^[a-z][a-z0-9+.-]*:/i,Nt=/^(https?|mailto|tel|ftp):/i;function Bt(t){if(!t)return;let e=t.replace(/[\t\n\r]/g,"").replace(/^[\x00-\x20]+/,"");if(e)return kt.test(e)?Nt.test(e)?t:void 0:t}export{I as DEFAULT_PARAGRAPH_FLASH_COLOR,At as DEFAULT_PARAGRAPH_FLASH_DURATION_MS,x as PARAGRAPH_FLASH_CLASS_NAME,Mt as PENDING_COMMENT_ID,Et as buildAnchorMaps,bt as collectHeadings,Dt as computeSplitDialogDefaults,Rt as computeSplitLayout,Ot as createComment,_t as createCommentIdAllocator,yt as excludeFontsByName,H as findParagraphFragmentsByParaId,L as flashParagraphElements,Ct as flashParagraphFragmentsByParaId,xt as getRenderableDocumentFonts,It as prefersColorSchemeDark,vt as readDocxFileFromInput,wt as redistributeColumnWidths,Ht as resolveIsDark,Bt as sanitizeHref,v as selectRenderableFonts,Lt as subscribeSystemDark,M as sumColumnWidths};
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Pure list-state helpers
|
|
3
|
-
*
|
|
4
|
-
* indent level. Lifted from packages/docx-react/src/components/ui/
|
|
5
|
-
* ListButtons.tsx so the React + Vue toolbars share identical
|
|
6
|
-
* state-mutation logic.
|
|
2
|
+
* Pure list-state helpers that track whether the selection is in a
|
|
3
|
+
* bullet or numbered list and at what indent level.
|
|
7
4
|
* @packageDocumentation
|
|
8
5
|
* @public
|
|
9
6
|
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as Style } from '../styles-
|
|
2
|
-
import '../formatting-
|
|
1
|
+
import { a as Style } from '../styles-DZZz2oRy.mjs';
|
|
2
|
+
import '../formatting-p5MneNuy.mjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Paragraph-style preview + option resolution — shared between the React and
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export{d as HEADING_COLOR,b as STYLE_DEFAULT_BOLD,c as STYLE_DEFAULT_COLOR,a as STYLE_PREVIEW_SIZES,e as getStylePreviewProps,f as resolveParagraphStyleOptions}from'../chunk-UDVEZ722.mjs';import'../chunk-TTRUPDAB.mjs';
|