@arbidocs/blocks 0.4.102 → 0.4.104
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/dist/agents/index.cjs +207 -207
- package/dist/agents/index.js +2 -2
- package/dist/{chunk-AOFATOT3.cjs → chunk-2A4MDHJR.cjs} +7 -5
- package/dist/chunk-2A4MDHJR.cjs.map +1 -0
- package/dist/{chunk-G5JH2YMQ.js → chunk-4GFB5U3K.js} +3 -3
- package/dist/{chunk-G5JH2YMQ.js.map → chunk-4GFB5U3K.js.map} +1 -1
- package/dist/chunk-5FYU7ZIU.cjs +139 -0
- package/dist/chunk-5FYU7ZIU.cjs.map +1 -0
- package/dist/{chunk-Y5XW57U4.cjs → chunk-7LLLQUM7.cjs} +5 -5
- package/dist/{chunk-Y5XW57U4.cjs.map → chunk-7LLLQUM7.cjs.map} +1 -1
- package/dist/{chunk-D3QPYKZG.js → chunk-EPHGD4YV.js} +7 -6
- package/dist/chunk-EPHGD4YV.js.map +1 -0
- package/dist/chunk-HFZ45FD3.js +133 -0
- package/dist/chunk-HFZ45FD3.js.map +1 -0
- package/dist/{chunk-5NQIBJPP.js → chunk-NJX774HB.js} +3 -3
- package/dist/{chunk-5NQIBJPP.js.map → chunk-NJX774HB.js.map} +1 -1
- package/dist/{chunk-DDYXFALG.cjs → chunk-NW3LFDZL.cjs} +3 -3
- package/dist/{chunk-DDYXFALG.cjs.map → chunk-NW3LFDZL.cjs.map} +1 -1
- package/dist/{chunk-YGREW5TZ.js → chunk-PIT2YZCK.js} +3 -3
- package/dist/{chunk-YGREW5TZ.js.map → chunk-PIT2YZCK.js.map} +1 -1
- package/dist/{chunk-Z3G65XHZ.js → chunk-S55VDTX3.js} +3 -3
- package/dist/{chunk-Z3G65XHZ.js.map → chunk-S55VDTX3.js.map} +1 -1
- package/dist/{chunk-LENXDIMY.cjs → chunk-SKSE4OT6.cjs} +22 -22
- package/dist/{chunk-LENXDIMY.cjs.map → chunk-SKSE4OT6.cjs.map} +1 -1
- package/dist/{chunk-ZT2EBBSC.cjs → chunk-TP3FAP5J.cjs} +5 -5
- package/dist/{chunk-ZT2EBBSC.cjs.map → chunk-TP3FAP5J.cjs.map} +1 -1
- package/dist/{chunk-MYALCKDR.js → chunk-W2RTZOK3.js} +1533 -263
- package/dist/chunk-W2RTZOK3.js.map +1 -0
- package/dist/{chunk-FAGQTB3D.cjs → chunk-ZWWN4CUL.cjs} +1690 -408
- package/dist/chunk-ZWWN4CUL.cjs.map +1 -0
- package/dist/connect/docx.cjs +8 -7
- package/dist/connect/docx.cjs.map +1 -1
- package/dist/connect/docx.js +6 -5
- package/dist/connect/docx.js.map +1 -1
- package/dist/connect/index.cjs +12 -11
- package/dist/connect/index.cjs.map +1 -1
- package/dist/connect/index.js +5 -4
- package/dist/connect/index.js.map +1 -1
- package/dist/docx/LinkHoverCard.d.ts +24 -0
- package/dist/docx/NativeDocxEditor.d.ts +6 -0
- package/dist/docx/RibbonMenu.d.ts +4 -1
- package/dist/docx/RibbonOverflow.d.ts +27 -0
- package/dist/docx/WordReferences.d.ts +3 -2
- package/dist/docx/beforeSave.d.ts +9 -0
- package/dist/docx/definitions/fragment.d.ts +19 -1
- package/dist/docx/definitions/port.d.ts +43 -11
- package/dist/docx/index.cjs +85 -36
- package/dist/docx/index.cjs.map +1 -1
- package/dist/docx/index.d.ts +6 -0
- package/dist/docx/index.js +5 -4
- package/dist/docx/index.js.map +1 -1
- package/dist/docx/noteStyles.d.ts +46 -0
- package/dist/docx/overflowPlan.d.ts +15 -0
- package/dist/docx/references/CrossReferences.d.ts +97 -0
- package/dist/docx/references/EditorMenus.d.ts +10 -0
- package/dist/docx/references/commands.d.ts +119 -0
- package/dist/docx/references/numbering.d.ts +49 -0
- package/dist/docx/references/passages.d.ts +32 -0
- package/dist/docx/references/port.d.ts +20 -0
- package/dist/facts/index.cjs +22 -129
- package/dist/facts/index.cjs.map +1 -1
- package/dist/facts/index.js +3 -125
- package/dist/facts/index.js.map +1 -1
- package/dist/files/index.cjs +1 -1
- package/dist/files/index.js +1 -1
- package/dist/home/index.cjs +1 -1
- package/dist/home/index.js +1 -1
- package/dist/index.cjs +314 -314
- package/dist/index.js +8 -8
- package/dist/shell/index.cjs +1 -1
- package/dist/shell/index.js +1 -1
- package/dist/studio/index.cjs +1 -1
- package/dist/studio/index.js +1 -1
- package/dist/tags/ooxml.d.ts +4 -0
- package/dist/workflow-canvas/index.cjs +9 -9
- package/dist/workflow-canvas/index.js +2 -2
- package/node_modules/@arbidocs/coedit/package.json +1 -1
- package/package.json +4 -4
- package/src/docx/README.md +32 -0
- package/src/docx/styles.css +73 -5
- package/dist/chunk-AOFATOT3.cjs.map +0 -1
- package/dist/chunk-D3QPYKZG.js.map +0 -1
- package/dist/chunk-FAGQTB3D.cjs.map +0 -1
- package/dist/chunk-MYALCKDR.js.map +0 -1
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A card over a painted link in the Word editor, for the links a feature inserts: a defined term
|
|
3
|
+
* shows its definition, a cross-reference the text it points at. The link's own tooltip (what Word
|
|
4
|
+
* shows on hover) is held back while the card shows. Typing, clicking or scrolling hides it, since
|
|
5
|
+
* a repaint can replace the link under the pointer without a mouseout.
|
|
6
|
+
*/
|
|
7
|
+
import React from 'react';
|
|
8
|
+
export interface LinkHoverContent {
|
|
9
|
+
title?: string;
|
|
10
|
+
body: string;
|
|
11
|
+
footer?: string;
|
|
12
|
+
}
|
|
13
|
+
export interface LinkHoverCardProps {
|
|
14
|
+
/** The element the painted pages are inside (the editor). */
|
|
15
|
+
root: Element | null;
|
|
16
|
+
/** Whether this card handles a link (by its `href`). */
|
|
17
|
+
matches: (href: string, link: HTMLAnchorElement) => boolean;
|
|
18
|
+
/** The card's content for a link, or null to show the link's own tooltip. */
|
|
19
|
+
resolve: (href: string) => LinkHoverContent | null | undefined;
|
|
20
|
+
/** Called on the first hover (e.g. to load what `resolve` reads). */
|
|
21
|
+
onFirstHover?: () => void;
|
|
22
|
+
testId: string;
|
|
23
|
+
}
|
|
24
|
+
export declare function LinkHoverCard({ root, matches, resolve, onFirstHover, testId, }: LinkHoverCardProps): React.ReactPortal | null;
|
|
@@ -3,6 +3,7 @@ import React from 'react';
|
|
|
3
3
|
import { type FontConfiguration } from '@docx-editor.dev/react';
|
|
4
4
|
import type { DocxCollaborationSession } from '@arbidocs/coedit';
|
|
5
5
|
import type { DefinitionSource } from '../tags/definitions';
|
|
6
|
+
import { type DocxReferencesAdapter } from './references/CrossReferences';
|
|
6
7
|
import { type DocxImageGeneration } from './layout/GenerateImage';
|
|
7
8
|
import { type HouseTemplateHost } from './template/HouseTemplate';
|
|
8
9
|
/**
|
|
@@ -46,6 +47,11 @@ export interface NativeDocxAdapter {
|
|
|
46
47
|
* Defined term, and typing `@@` in the body opens the term type-ahead.
|
|
47
48
|
*/
|
|
48
49
|
definitions?: () => Promise<DefinitionSource[]>;
|
|
50
|
+
/**
|
|
51
|
+
* References to the workspace's other documents. Present: Insert cross-reference also offers a
|
|
52
|
+
* passage of another document, inserted as a link that opens it there.
|
|
53
|
+
*/
|
|
54
|
+
references?: DocxReferencesAdapter;
|
|
49
55
|
/** The platform's image generation. Present: the Insert tab offers Generate image. */
|
|
50
56
|
imageGeneration?: DocxImageGeneration;
|
|
51
57
|
/**
|
|
@@ -5,7 +5,7 @@ import React from 'react';
|
|
|
5
5
|
* press outside it. `children` may be a function that receives `close`, for panels that close
|
|
6
6
|
* themselves once the user has picked something.
|
|
7
7
|
*/
|
|
8
|
-
export declare function RibbonMenu({ label, icon, children, className, testId, title, }: {
|
|
8
|
+
export declare function RibbonMenu({ label, icon, children, className, testId, title, keepMounted, popoverClassName, }: {
|
|
9
9
|
label: string;
|
|
10
10
|
/** Tooltip; defaults to `label`. */
|
|
11
11
|
title?: string;
|
|
@@ -14,4 +14,7 @@ export declare function RibbonMenu({ label, icon, children, className, testId, t
|
|
|
14
14
|
children: React.ReactNode | ((close: () => void) => React.ReactNode);
|
|
15
15
|
className?: string;
|
|
16
16
|
testId?: string;
|
|
17
|
+
/** Keep the panel's content mounted (hidden) while closed, so its controls keep their state. */
|
|
18
|
+
keepMounted?: boolean;
|
|
19
|
+
popoverClassName?: string;
|
|
17
20
|
}): React.JSX.Element;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A ribbon tab's row of controls that never crowds: what does not fit collapses into a trailing
|
|
3
|
+
* "…" (More) menu, as Word's ribbon does. Each control is a `RibbonItem` with a label and a
|
|
4
|
+
* priority; the row measures the controls (ResizeObserver) and collapses the lowest priority
|
|
5
|
+
* first, the rightmost first among equals. A collapsed control is the same component, moved by a
|
|
6
|
+
* portal into its row of the More menu, beside its label, so it keeps working (and keeps its
|
|
7
|
+
* state while the menu is closed).
|
|
8
|
+
*/
|
|
9
|
+
import React from 'react';
|
|
10
|
+
/**
|
|
11
|
+
* The row of one ribbon tab. `tab` names the tab shown, so the More menu closes and the row is
|
|
12
|
+
* measured afresh when it changes.
|
|
13
|
+
*/
|
|
14
|
+
export declare function RibbonOverflow({ tab, children }: {
|
|
15
|
+
tab: string;
|
|
16
|
+
children: React.ReactNode;
|
|
17
|
+
}): React.JSX.Element;
|
|
18
|
+
/**
|
|
19
|
+
* One control of a ribbon row. `label` names it in the More menu; `priority` (default 0) decides
|
|
20
|
+
* what collapses first. Outside a `RibbonOverflow` it renders its children as they are.
|
|
21
|
+
*/
|
|
22
|
+
export declare function RibbonItem({ id, label, priority, children, }: {
|
|
23
|
+
id: string;
|
|
24
|
+
label: string;
|
|
25
|
+
priority?: number;
|
|
26
|
+
children: React.ReactNode;
|
|
27
|
+
}): React.JSX.Element;
|
|
@@ -6,8 +6,9 @@
|
|
|
6
6
|
* and its note in `footnotes.xml` (creating the part on a document that has none), moves the caret
|
|
7
7
|
* into the note so the user types it straight away, numbers notes in document order, and lays
|
|
8
8
|
* them out at the foot of the page, where an existing note is edited in place. What it leaves out
|
|
9
|
-
* is Word
|
|
10
|
-
* "
|
|
9
|
+
* is what Word adds around a new note: the note styles in a document that has none (without
|
|
10
|
+
* "footnote reference" the reference and the number are painted at body size on the baseline),
|
|
11
|
+
* the note's "footnote text" (or "endnote text") paragraph style, and the space after its number.
|
|
11
12
|
*/
|
|
12
13
|
import React, { type RefObject } from 'react';
|
|
13
14
|
/** References tab: Insert footnote, Insert endnote. */
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Work to do on a document just before it is saved or downloaded (e.g. bringing cross-reference
|
|
3
|
+
* results up to date, so the stored .docx reads right in Word). Features register against the
|
|
4
|
+
* editor instance; the widget runs them before Save version and DOCX download.
|
|
5
|
+
*/
|
|
6
|
+
/** Run `fn` before each save of `editor`'s document. Answers the unregister function. */
|
|
7
|
+
export declare function onBeforeSave(editor: object, fn: () => void): () => void;
|
|
8
|
+
/** Run the registered work; one failing does not stop the save. */
|
|
9
|
+
export declare function runBeforeSave(editor: object | null | undefined): void;
|
|
@@ -9,6 +9,18 @@ import type { Definition } from '../../tags/definitions';
|
|
|
9
9
|
import { type Revision } from '@arbidocs/coedit/template';
|
|
10
10
|
/** Character style of an inserted term: a dotted underline, so a defined term reads as one. */
|
|
11
11
|
export declare const DEFINED_TERM_STYLE = "DefinedTerm";
|
|
12
|
+
/** Character style of a cross-reference: a muted blue with a dotted underline (Word's name). */
|
|
13
|
+
export declare const CROSS_REFERENCE_STYLE = "CrossReference";
|
|
14
|
+
/** Character style of a cross-reference whose target is gone: its last text, flagged. */
|
|
15
|
+
export declare const BROKEN_CROSS_REFERENCE_STYLE = "CrossReferenceBroken";
|
|
16
|
+
/**
|
|
17
|
+
* The character styles the inserted content uses. A paste brings a style the document does not
|
|
18
|
+
* define; one it already defines (a house template's) is used as it is, so only the missing ones
|
|
19
|
+
* go into a fragment (see {@link stylesUsed}).
|
|
20
|
+
*/
|
|
21
|
+
export declare const CHARACTER_STYLES: Record<string, string>;
|
|
22
|
+
/** The character styles a fragment's runs use (`w:rStyle`), as ids. */
|
|
23
|
+
export declare function stylesUsed(body: string): string[];
|
|
12
24
|
/** What Word shows on hover over a term: its definition, as one line of at most 255 characters. */
|
|
13
25
|
export declare function definitionTooltip(definition: Pick<Definition, 'term' | 'rest'>): string;
|
|
14
26
|
/** The definition paragraph's text as the document shows it: `“Shares” means the issued shares.` */
|
|
@@ -28,4 +40,10 @@ export declare function termLinkXml(term: string, bookmark: string, tooltip: str
|
|
|
28
40
|
* before the caret's paragraph) instead of running into the text after the caret (inline).
|
|
29
41
|
* With a `revision`, the fragment is one tracked insertion by it.
|
|
30
42
|
*/
|
|
31
|
-
export declare function fragmentHtml(body: string, covered: boolean, revision
|
|
43
|
+
export declare function fragmentHtml(body: string, covered: boolean, { revision, relationships, styles, }?: {
|
|
44
|
+
revision?: Revision | null;
|
|
45
|
+
/** Relationships the body refers to (a hyperlink's target). */
|
|
46
|
+
relationships?: string;
|
|
47
|
+
/** The character styles to bring (default: every one the body uses). */
|
|
48
|
+
styles?: readonly string[];
|
|
49
|
+
}): string;
|
|
@@ -27,6 +27,24 @@ export interface DocParagraph {
|
|
|
27
27
|
bookmarks: string[];
|
|
28
28
|
/** Its internal links (`w:hyperlink w:anchor`). */
|
|
29
29
|
links: DocLink[];
|
|
30
|
+
/** Its complex fields: where each sits (its one-character offset), its instruction and result. */
|
|
31
|
+
fields?: DocField[];
|
|
32
|
+
/** Its runs in a watched character style (a broken cross-reference's mark), with their text. */
|
|
33
|
+
marks?: DocMark[];
|
|
34
|
+
}
|
|
35
|
+
/** A stretch of a paragraph's text in a watched character style. */
|
|
36
|
+
export interface DocMark {
|
|
37
|
+
styleId: string;
|
|
38
|
+
offset: number;
|
|
39
|
+
text: string;
|
|
40
|
+
}
|
|
41
|
+
/** Character styles whose runs a paragraph read reports as marks. */
|
|
42
|
+
export declare const WATCHED_STYLES: Set<string>;
|
|
43
|
+
/** A complex field of a paragraph. */
|
|
44
|
+
export interface DocField {
|
|
45
|
+
offset: number;
|
|
46
|
+
instruction: string;
|
|
47
|
+
result: string;
|
|
30
48
|
}
|
|
31
49
|
export interface DefinitionsPort {
|
|
32
50
|
/** Every body paragraph, in document order (table cells included, `topLevel: false`). */
|
|
@@ -40,11 +58,13 @@ export interface DefinitionsPort {
|
|
|
40
58
|
* Paste paragraph XML at the caret. `covered`: the fragment ends with a whole paragraph, so at
|
|
41
59
|
* the start of a paragraph it lands as paragraphs before it. Otherwise it runs inline.
|
|
42
60
|
*/
|
|
43
|
-
paste(body: string, text: string, covered: boolean): boolean;
|
|
61
|
+
paste(body: string, text: string, covered: boolean, relationships?: string): boolean;
|
|
44
62
|
/** Split the caret's paragraph (Enter), the caret moving into the new one. */
|
|
45
63
|
splitParagraph(): void;
|
|
64
|
+
/** Type plain text at the caret. */
|
|
65
|
+
typeText(text: string): void;
|
|
46
66
|
}
|
|
47
|
-
type
|
|
67
|
+
export type OoxmlNodeLike = {
|
|
48
68
|
id: string;
|
|
49
69
|
kind: string;
|
|
50
70
|
localName?: string;
|
|
@@ -53,10 +73,14 @@ type Node = {
|
|
|
53
73
|
localName: string;
|
|
54
74
|
value: string;
|
|
55
75
|
}[];
|
|
56
|
-
children?: readonly
|
|
76
|
+
children?: readonly OoxmlNodeLike[];
|
|
57
77
|
};
|
|
78
|
+
/** How a field counts in a paragraph's text (the engine's model vocabulary). */
|
|
79
|
+
export declare const FIELD_ATOM = "\uFFFC";
|
|
58
80
|
/** The paragraphs of a part's body, read from the engine's OOXML tree. */
|
|
59
|
-
export declare function readParagraphs(root:
|
|
81
|
+
export declare function readParagraphs(root: OoxmlNodeLike): DocParagraph[];
|
|
82
|
+
/** The style ids a document's styles part defines. */
|
|
83
|
+
export declare function documentStyleIds(root: OoxmlNodeLike | null | undefined): Set<string>;
|
|
60
84
|
/**
|
|
61
85
|
* The port over a live editor. Writes go through the editor's own commands and paste; with a
|
|
62
86
|
* `revision`, what it pastes is a tracked insertion by it (see `trackedOrNoted`).
|
|
@@ -68,13 +92,21 @@ export declare function editorPort(editor: DocxEditorInstance, revision?: Revisi
|
|
|
68
92
|
*/
|
|
69
93
|
export declare function withDirectEditing<T>(editor: DocxEditorInstance, fn: () => T): T;
|
|
70
94
|
/**
|
|
71
|
-
* Keep the caret where a command left it
|
|
95
|
+
* Keep the caret where a command left it while the collaboration room settles after the command.
|
|
72
96
|
*
|
|
73
97
|
* A paste lands as a package-level write; in a collaboration room the engine then re-installs the
|
|
74
|
-
* document, numbering its paragraph nodes afresh
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
*
|
|
98
|
+
* document, numbering its paragraph nodes afresh. Keystrokes typed in between would address the
|
|
99
|
+
* old nodes and be lost, so for a moment (until the document has been quiet for `settleMs`, at most
|
|
100
|
+
* `maxMs`) typed characters are held back; then the caret is put back on its paragraph — found by
|
|
101
|
+
* its `w14:paraId`, which survives the re-install — and what was typed goes in there. Any other key
|
|
102
|
+
* or a click ends the wait at once.
|
|
103
|
+
*/
|
|
104
|
+
export declare function holdCaret(editor: DocxEditorInstance, { settleMs, maxMs }?: {
|
|
105
|
+
settleMs?: number;
|
|
106
|
+
maxMs?: number;
|
|
107
|
+
}): void;
|
|
108
|
+
/**
|
|
109
|
+
* Run `fn` (an edit elsewhere in the document) and put the caret back where it was: on its
|
|
110
|
+
* paragraph, found by its `w14:paraId` (which survives the edits), at the same offset.
|
|
78
111
|
*/
|
|
79
|
-
export declare function
|
|
80
|
-
export {};
|
|
112
|
+
export declare function preservingCaret<T>(editor: DocxEditorInstance, fn: () => T): T;
|
package/dist/docx/index.cjs
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
require('../chunk-
|
|
4
|
+
var chunkTP3FAP5J_cjs = require('../chunk-TP3FAP5J.cjs');
|
|
5
|
+
var chunkZWWN4CUL_cjs = require('../chunk-ZWWN4CUL.cjs');
|
|
6
|
+
require('../chunk-5FYU7ZIU.cjs');
|
|
7
|
+
require('../chunk-2A4MDHJR.cjs');
|
|
7
8
|
require('../chunk-RC25WMVB.cjs');
|
|
8
9
|
require('../chunk-7UTB4PHM.cjs');
|
|
9
10
|
require('../chunk-MHVNT4J3.cjs');
|
|
@@ -60,7 +61,7 @@ function NativeDocxComparison({
|
|
|
60
61
|
if (!documentId)
|
|
61
62
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "native-docx-error", role: "status", children: "Comparing Word documents\u2026" });
|
|
62
63
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
63
|
-
|
|
64
|
+
chunkZWWN4CUL_cjs.NativeDocxEditor,
|
|
64
65
|
{
|
|
65
66
|
adapter,
|
|
66
67
|
documentId,
|
|
@@ -72,131 +73,179 @@ function NativeDocxComparison({
|
|
|
72
73
|
|
|
73
74
|
Object.defineProperty(exports, "StreamedWordArtifact", {
|
|
74
75
|
enumerable: true,
|
|
75
|
-
get: function () { return
|
|
76
|
+
get: function () { return chunkTP3FAP5J_cjs.StreamedWordArtifact; }
|
|
76
77
|
});
|
|
77
78
|
Object.defineProperty(exports, "BUILTIN_TEMPLATE_NAME", {
|
|
78
79
|
enumerable: true,
|
|
79
|
-
get: function () { return
|
|
80
|
+
get: function () { return chunkZWWN4CUL_cjs.BUILTIN_TEMPLATE_NAME; }
|
|
81
|
+
});
|
|
82
|
+
Object.defineProperty(exports, "CrossReferenceDialog", {
|
|
83
|
+
enumerable: true,
|
|
84
|
+
get: function () { return chunkZWWN4CUL_cjs.CrossReferenceDialog; }
|
|
85
|
+
});
|
|
86
|
+
Object.defineProperty(exports, "CrossReferencesProvider", {
|
|
87
|
+
enumerable: true,
|
|
88
|
+
get: function () { return chunkZWWN4CUL_cjs.CrossReferencesProvider; }
|
|
89
|
+
});
|
|
90
|
+
Object.defineProperty(exports, "DEFAULT_CROSS_REFERENCES_LABELS", {
|
|
91
|
+
enumerable: true,
|
|
92
|
+
get: function () { return chunkZWWN4CUL_cjs.DEFAULT_CROSS_REFERENCES_LABELS; }
|
|
80
93
|
});
|
|
81
94
|
Object.defineProperty(exports, "DEFAULT_DEFINED_TERMS_LABELS", {
|
|
82
95
|
enumerable: true,
|
|
83
|
-
get: function () { return
|
|
96
|
+
get: function () { return chunkZWWN4CUL_cjs.DEFAULT_DEFINED_TERMS_LABELS; }
|
|
84
97
|
});
|
|
85
98
|
Object.defineProperty(exports, "DEFINED_TERM_TRIGGER", {
|
|
86
99
|
enumerable: true,
|
|
87
|
-
get: function () { return
|
|
100
|
+
get: function () { return chunkZWWN4CUL_cjs.DEFINED_TERM_TRIGGER; }
|
|
88
101
|
});
|
|
89
102
|
Object.defineProperty(exports, "DefinedTermsProvider", {
|
|
90
103
|
enumerable: true,
|
|
91
|
-
get: function () { return
|
|
104
|
+
get: function () { return chunkZWWN4CUL_cjs.DefinedTermsProvider; }
|
|
92
105
|
});
|
|
93
106
|
Object.defineProperty(exports, "DocxAuthorContext", {
|
|
94
107
|
enumerable: true,
|
|
95
|
-
get: function () { return
|
|
108
|
+
get: function () { return chunkZWWN4CUL_cjs.DocxAuthorContext; }
|
|
96
109
|
});
|
|
97
110
|
Object.defineProperty(exports, "DocxCommentActivity", {
|
|
98
111
|
enumerable: true,
|
|
99
|
-
get: function () { return
|
|
112
|
+
get: function () { return chunkZWWN4CUL_cjs.DocxCommentActivity; }
|
|
100
113
|
});
|
|
101
114
|
Object.defineProperty(exports, "DocxEditorReview", {
|
|
102
115
|
enumerable: true,
|
|
103
|
-
get: function () { return
|
|
116
|
+
get: function () { return chunkZWWN4CUL_cjs.DocxEditorReview; }
|
|
104
117
|
});
|
|
105
118
|
Object.defineProperty(exports, "DocxMentions", {
|
|
106
119
|
enumerable: true,
|
|
107
|
-
get: function () { return
|
|
120
|
+
get: function () { return chunkZWWN4CUL_cjs.DocxMentions; }
|
|
108
121
|
});
|
|
109
122
|
Object.defineProperty(exports, "DocxParticipants", {
|
|
110
123
|
enumerable: true,
|
|
111
|
-
get: function () { return
|
|
124
|
+
get: function () { return chunkZWWN4CUL_cjs.DocxParticipants; }
|
|
112
125
|
});
|
|
113
126
|
Object.defineProperty(exports, "DocxRibbon", {
|
|
114
127
|
enumerable: true,
|
|
115
|
-
get: function () { return
|
|
128
|
+
get: function () { return chunkZWWN4CUL_cjs.DocxRibbon; }
|
|
116
129
|
});
|
|
117
130
|
Object.defineProperty(exports, "GenerateImageButton", {
|
|
118
131
|
enumerable: true,
|
|
119
|
-
get: function () { return
|
|
132
|
+
get: function () { return chunkZWWN4CUL_cjs.GenerateImageButton; }
|
|
120
133
|
});
|
|
121
134
|
Object.defineProperty(exports, "HouseTemplateProvider", {
|
|
122
135
|
enumerable: true,
|
|
123
|
-
get: function () { return
|
|
136
|
+
get: function () { return chunkZWWN4CUL_cjs.HouseTemplateProvider; }
|
|
137
|
+
});
|
|
138
|
+
Object.defineProperty(exports, "LinkHoverCard", {
|
|
139
|
+
enumerable: true,
|
|
140
|
+
get: function () { return chunkZWWN4CUL_cjs.LinkHoverCard; }
|
|
124
141
|
});
|
|
125
142
|
Object.defineProperty(exports, "NativeDocxEditor", {
|
|
126
143
|
enumerable: true,
|
|
127
|
-
get: function () { return
|
|
144
|
+
get: function () { return chunkZWWN4CUL_cjs.NativeDocxEditor; }
|
|
128
145
|
});
|
|
129
146
|
Object.defineProperty(exports, "builtinHouseTemplate", {
|
|
130
147
|
enumerable: true,
|
|
131
|
-
get: function () { return
|
|
148
|
+
get: function () { return chunkZWWN4CUL_cjs.builtinHouseTemplate; }
|
|
132
149
|
});
|
|
133
150
|
Object.defineProperty(exports, "contentPath", {
|
|
134
151
|
enumerable: true,
|
|
135
|
-
get: function () { return
|
|
152
|
+
get: function () { return chunkZWWN4CUL_cjs.contentPath; }
|
|
136
153
|
});
|
|
137
154
|
Object.defineProperty(exports, "editorPort", {
|
|
138
155
|
enumerable: true,
|
|
139
|
-
get: function () { return
|
|
156
|
+
get: function () { return chunkZWWN4CUL_cjs.editorPort; }
|
|
140
157
|
});
|
|
141
158
|
Object.defineProperty(exports, "findDefinitionsSection", {
|
|
142
159
|
enumerable: true,
|
|
143
|
-
get: function () { return
|
|
160
|
+
get: function () { return chunkZWWN4CUL_cjs.findDefinitionsSection; }
|
|
161
|
+
});
|
|
162
|
+
Object.defineProperty(exports, "insertCrossReference", {
|
|
163
|
+
enumerable: true,
|
|
164
|
+
get: function () { return chunkZWWN4CUL_cjs.insertCrossReference; }
|
|
144
165
|
});
|
|
145
166
|
Object.defineProperty(exports, "insertDefinedTerm", {
|
|
146
167
|
enumerable: true,
|
|
147
|
-
get: function () { return
|
|
168
|
+
get: function () { return chunkZWWN4CUL_cjs.insertDefinedTerm; }
|
|
169
|
+
});
|
|
170
|
+
Object.defineProperty(exports, "insertDocumentReference", {
|
|
171
|
+
enumerable: true,
|
|
172
|
+
get: function () { return chunkZWWN4CUL_cjs.insertDocumentReference; }
|
|
173
|
+
});
|
|
174
|
+
Object.defineProperty(exports, "listTargets", {
|
|
175
|
+
enumerable: true,
|
|
176
|
+
get: function () { return chunkZWWN4CUL_cjs.listTargets; }
|
|
148
177
|
});
|
|
149
178
|
Object.defineProperty(exports, "loadDocxFonts", {
|
|
150
179
|
enumerable: true,
|
|
151
|
-
get: function () { return
|
|
180
|
+
get: function () { return chunkZWWN4CUL_cjs.loadDocxFonts; }
|
|
152
181
|
});
|
|
153
182
|
Object.defineProperty(exports, "normalizeDocxExport", {
|
|
154
183
|
enumerable: true,
|
|
155
|
-
get: function () { return
|
|
184
|
+
get: function () { return chunkZWWN4CUL_cjs.normalizeDocxExport; }
|
|
185
|
+
});
|
|
186
|
+
Object.defineProperty(exports, "paragraphNumber", {
|
|
187
|
+
enumerable: true,
|
|
188
|
+
get: function () { return chunkZWWN4CUL_cjs.paragraphNumber; }
|
|
189
|
+
});
|
|
190
|
+
Object.defineProperty(exports, "referenceText", {
|
|
191
|
+
enumerable: true,
|
|
192
|
+
get: function () { return chunkZWWN4CUL_cjs.referenceText; }
|
|
193
|
+
});
|
|
194
|
+
Object.defineProperty(exports, "referencesPort", {
|
|
195
|
+
enumerable: true,
|
|
196
|
+
get: function () { return chunkZWWN4CUL_cjs.referencesPort; }
|
|
156
197
|
});
|
|
157
198
|
Object.defineProperty(exports, "resolveHouseTemplate", {
|
|
158
199
|
enumerable: true,
|
|
159
|
-
get: function () { return
|
|
200
|
+
get: function () { return chunkZWWN4CUL_cjs.resolveHouseTemplate; }
|
|
160
201
|
});
|
|
161
202
|
Object.defineProperty(exports, "reviewModule", {
|
|
162
203
|
enumerable: true,
|
|
163
|
-
get: function () { return
|
|
204
|
+
get: function () { return chunkZWWN4CUL_cjs.reviewModule; }
|
|
205
|
+
});
|
|
206
|
+
Object.defineProperty(exports, "shortTitle", {
|
|
207
|
+
enumerable: true,
|
|
208
|
+
get: function () { return chunkZWWN4CUL_cjs.shortTitle; }
|
|
164
209
|
});
|
|
165
210
|
Object.defineProperty(exports, "structuralPort", {
|
|
166
211
|
enumerable: true,
|
|
167
|
-
get: function () { return
|
|
212
|
+
get: function () { return chunkZWWN4CUL_cjs.structuralPort; }
|
|
168
213
|
});
|
|
169
214
|
Object.defineProperty(exports, "templateFileName", {
|
|
170
215
|
enumerable: true,
|
|
171
|
-
get: function () { return
|
|
216
|
+
get: function () { return chunkZWWN4CUL_cjs.templateFileName; }
|
|
172
217
|
});
|
|
173
218
|
Object.defineProperty(exports, "trackedOrNoted", {
|
|
174
219
|
enumerable: true,
|
|
175
|
-
get: function () { return
|
|
220
|
+
get: function () { return chunkZWWN4CUL_cjs.trackedOrNoted; }
|
|
221
|
+
});
|
|
222
|
+
Object.defineProperty(exports, "useCrossReferences", {
|
|
223
|
+
enumerable: true,
|
|
224
|
+
get: function () { return chunkZWWN4CUL_cjs.useCrossReferences; }
|
|
176
225
|
});
|
|
177
226
|
Object.defineProperty(exports, "useDefinedTerms", {
|
|
178
227
|
enumerable: true,
|
|
179
|
-
get: function () { return
|
|
228
|
+
get: function () { return chunkZWWN4CUL_cjs.useDefinedTerms; }
|
|
180
229
|
});
|
|
181
230
|
Object.defineProperty(exports, "useHouseTemplate", {
|
|
182
231
|
enumerable: true,
|
|
183
|
-
get: function () { return
|
|
232
|
+
get: function () { return chunkZWWN4CUL_cjs.useHouseTemplate; }
|
|
184
233
|
});
|
|
185
234
|
Object.defineProperty(exports, "useReview", {
|
|
186
235
|
enumerable: true,
|
|
187
|
-
get: function () { return
|
|
236
|
+
get: function () { return chunkZWWN4CUL_cjs.useReview; }
|
|
188
237
|
});
|
|
189
238
|
Object.defineProperty(exports, "useReviewItem", {
|
|
190
239
|
enumerable: true,
|
|
191
|
-
get: function () { return
|
|
240
|
+
get: function () { return chunkZWWN4CUL_cjs.useReviewItem; }
|
|
192
241
|
});
|
|
193
242
|
Object.defineProperty(exports, "useTrackedOrNoted", {
|
|
194
243
|
enumerable: true,
|
|
195
|
-
get: function () { return
|
|
244
|
+
get: function () { return chunkZWWN4CUL_cjs.useTrackedOrNoted; }
|
|
196
245
|
});
|
|
197
246
|
Object.defineProperty(exports, "withDirectEditing", {
|
|
198
247
|
enumerable: true,
|
|
199
|
-
get: function () { return
|
|
248
|
+
get: function () { return chunkZWWN4CUL_cjs.withDirectEditing; }
|
|
200
249
|
});
|
|
201
250
|
Object.defineProperty(exports, "DocxEditor", {
|
|
202
251
|
enumerable: true,
|
package/dist/docx/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/docx/NativeDocxComparison.tsx"],"names":["parseVersionRef","useRef","useState","useEffect","error","jsxs","jsx","NativeDocxEditor"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/docx/NativeDocxComparison.tsx"],"names":["parseVersionRef","useRef","useState","useEffect","error","jsxs","jsx","NativeDocxEditor"],"mappings":";;;;;;;;;;;;;;;;AAaA,SAAS,YAAA,CAAa,QAAgB,SAAA,EAAoC;AACxE,EAAA,MAAM,IAAA,GAAOA,0BAAgB,MAAM,CAAA;AACnC,EAAA,MAAM,OAAA,GAAUA,0BAAgB,SAAS,CAAA;AACzC,EAAA,MAAM,KAAA,GAAQ,IAAI,eAAA,C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AA,IAAA;AAAA,MAEC,OAAA;AAAA,MACA,UAAA;AAAA,MACA,OAAO,CAAA,EAAG,KAAA,CAAM,OAAA,CAAQ,UAAA,EAAY,EAAE,CAAC,CAAA,eAAA;AAAA,KAAA;AAAA,IAHlC;AAAA,GAIP;AAEJ","file":"index.cjs","sourcesContent":["import { useEffect, useRef, useState } from 'react'\nimport { parseVersionRef } from '@arbidocs/react/artifacts'\nimport { NativeDocxEditor, type NativeDocxAdapter } from './NativeDocxEditor'\n\nexport interface NativeDocxComparisonProps {\n adapter: NativeDocxAdapter\n baseId: string\n revisedId: string\n title: string\n onCompared?: (documentId: string) => void | Promise<void>\n}\n\n/** A `doc-…@v{n}` side names an older version: the endpoint takes its document and version apart. */\nfunction redlineQuery(baseId: string, revisedId: string): URLSearchParams {\n const base = parseVersionRef(baseId)\n const revised = parseVersionRef(revisedId)\n const query = new URLSearchParams({ base_ext_id: base.docId, revised_ext_id: revised.docId })\n if (base.version) query.set('base_version', String(base.version))\n if (revised.version) query.set('revised_version', String(revised.version))\n return query\n}\n\n/** Word comparison through the host's authenticated transport and LibreOffice service. */\nexport function NativeDocxComparison({\n adapter,\n baseId,\n revisedId,\n title,\n onCompared,\n}: NativeDocxComparisonProps) {\n const host = useRef({ adapter, onCompared })\n host.current = { adapter, onCompared }\n const [documentId, setDocumentId] = useState('')\n const [error, setError] = useState('')\n const [attempt, setAttempt] = useState(0)\n useEffect(() => {\n let cancelled = false\n setDocumentId('')\n setError('')\n void host.current.adapter\n .request(`/redline?${redlineQuery(baseId, revisedId)}`, { method: 'POST' })\n .then((response) => response.json())\n .then((result: { document_ext_id: string }) => {\n if (!result.document_ext_id) throw new Error('Comparison did not return a Word document.')\n if (!cancelled) {\n setDocumentId(result.document_ext_id)\n void Promise.resolve(host.current.onCompared?.(result.document_ext_id)).catch(() => {})\n }\n })\n .catch((error) => {\n if (!cancelled) setError(error instanceof Error ? error.message : String(error))\n })\n return () => {\n cancelled = true\n }\n }, [baseId, revisedId, attempt])\n if (error)\n return (\n <div className=\"native-docx-error\" role=\"alert\">\n <p>{error}</p>\n <button onClick={() => setAttempt((value) => value + 1)}>Retry comparison</button>\n </div>\n )\n if (!documentId)\n return (\n <div className=\"native-docx-error\" role=\"status\">\n Comparing Word documents…\n </div>\n )\n return (\n <NativeDocxEditor\n key={documentId}\n adapter={adapter}\n documentId={documentId}\n title={`${title.replace(/\\.[^.]+$/, '')} (redline).docx`}\n />\n )\n}\n"]}
|
package/dist/docx/index.d.ts
CHANGED
|
@@ -12,6 +12,12 @@ export { NativeDocxComparison, type NativeDocxComparisonProps } from './NativeDo
|
|
|
12
12
|
export { DefinedTermsProvider, useDefinedTerms, DEFINED_TERM_TRIGGER, DEFAULT_DEFINED_TERMS_LABELS, type DefinedTermsProviderProps, type DefinedTermsLabels, } from './definitions/DefinedTerms';
|
|
13
13
|
export { insertDefinedTerm, findDefinitionsSection } from './definitions/commands';
|
|
14
14
|
export { editorPort, withDirectEditing, type DefinitionsPort } from './definitions/port';
|
|
15
|
+
export { CrossReferencesProvider, CrossReferenceDialog, useCrossReferences, DEFAULT_CROSS_REFERENCES_LABELS, type DocxReferencesAdapter, type CrossReferencesLabels, } from './references/CrossReferences';
|
|
16
|
+
export { insertCrossReference, insertDocumentReference, type CrossReferenceMode, } from './references/commands';
|
|
17
|
+
export { listTargets, paragraphNumber, type CrossReferenceTarget } from './references/numbering';
|
|
18
|
+
export { referenceText, shortTitle, type DocumentPassage, type DocumentPassageTarget, type ReferenceDocument, } from './references/passages';
|
|
19
|
+
export { referencesPort, type ReferencesPort } from './references/port';
|
|
20
|
+
export { LinkHoverCard, type LinkHoverContent } from './LinkHoverCard';
|
|
15
21
|
export { GenerateImageButton, type DocxImageGeneration } from './layout/GenerateImage';
|
|
16
22
|
export { structuralPort, trackedOrNoted, type StructuralInsert, type StructuralOutcome, type StructuralPort, } from './structural/trackedOrNoted';
|
|
17
23
|
export { DocxAuthorContext, useTrackedOrNoted } from './structural/useTrackedOrNoted';
|
package/dist/docx/index.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
export { StreamedWordArtifact } from '../chunk-
|
|
3
|
-
import { NativeDocxEditor } from '../chunk-
|
|
4
|
-
export { BUILTIN_TEMPLATE_NAME, DEFAULT_DEFINED_TERMS_LABELS, DEFINED_TERM_TRIGGER, DefinedTermsProvider, DocxAuthorContext, DocxCommentActivity, DocxEditorReview, DocxMentions, DocxParticipants, DocxRibbon, GenerateImageButton, HouseTemplateProvider, NativeDocxEditor, builtinHouseTemplate, contentPath, editorPort, findDefinitionsSection, insertDefinedTerm, loadDocxFonts, normalizeDocxExport, resolveHouseTemplate, reviewModule, structuralPort, templateFileName, trackedOrNoted, useDefinedTerms, useHouseTemplate, useReview, useReviewItem, useTrackedOrNoted, withDirectEditing } from '../chunk-
|
|
5
|
-
import '../chunk-
|
|
2
|
+
export { StreamedWordArtifact } from '../chunk-PIT2YZCK.js';
|
|
3
|
+
import { NativeDocxEditor } from '../chunk-W2RTZOK3.js';
|
|
4
|
+
export { BUILTIN_TEMPLATE_NAME, CrossReferenceDialog, CrossReferencesProvider, DEFAULT_CROSS_REFERENCES_LABELS, DEFAULT_DEFINED_TERMS_LABELS, DEFINED_TERM_TRIGGER, DefinedTermsProvider, DocxAuthorContext, DocxCommentActivity, DocxEditorReview, DocxMentions, DocxParticipants, DocxRibbon, GenerateImageButton, HouseTemplateProvider, LinkHoverCard, NativeDocxEditor, builtinHouseTemplate, contentPath, editorPort, findDefinitionsSection, insertCrossReference, insertDefinedTerm, insertDocumentReference, listTargets, loadDocxFonts, normalizeDocxExport, paragraphNumber, referenceText, referencesPort, resolveHouseTemplate, reviewModule, shortTitle, structuralPort, templateFileName, trackedOrNoted, useCrossReferences, useDefinedTerms, useHouseTemplate, useReview, useReviewItem, useTrackedOrNoted, withDirectEditing } from '../chunk-W2RTZOK3.js';
|
|
5
|
+
import '../chunk-HFZ45FD3.js';
|
|
6
|
+
import '../chunk-EPHGD4YV.js';
|
|
6
7
|
import '../chunk-AF6RDAJF.js';
|
|
7
8
|
import '../chunk-AA3PT6KR.js';
|
|
8
9
|
import '../chunk-7F6CBP3Z.js';
|
package/dist/docx/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/docx/NativeDocxComparison.tsx"],"names":["error"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/docx/NativeDocxComparison.tsx"],"names":["error"],"mappings":";;;;;;;;;;;;;;;AAaA,SAAS,YAAA,CAAa,QAAgB,SAAA,EAAoC;AACxE,EAAA,MAAM,IAAA,GAAO,gBAAgB,MAAM,CAAA;AACnC,EAAA,MAAM,OAAA,GAAU,gBAAgB,SAAS,CAAA;AACzC,EAAA,MAAM,KAAA,GAAQ,IAAI,eAAA,CAAgB,EAAE,WAAA,EAAa,KAAK,KAAA,EAAO,cAAA,EAAgB,OAAA,CAAQ,KAAA,EAAO,CAAA;AAC5F,EAAA,IAAI,IAAA,CAAK,SAAS,KAAA,CAAM,GAAA,CAAI,gBAAgB,MAAA,CAAO,IAAA,CAAK,OAAO,CAAC,CAAA;AAChE,EAAA,IAAI,OAAA,CAAQ,SAAS,KAAA,CAAM,GAAA,CAAI,mBAAmB,MAAA,CAAO,OAAA,CAAQ,OAAO,CAAC,CAAA;AACzE,EAAA,OAAO,KAAA;AACT;AAGO,SAAS,oBAAA,CAAqB;AAAA,EACnC,OAAA;AAAA,EACA,MAAA;AAAA,EACA,SAAA;AAAA,EACA,KAAA;AAAA,EACA;AACF,CAAA,EAA8B;AAC5B,EAAA,MAAM,IAAA,GAAO,MAAA,CAAO,EAAE,OAAA,EAAS,YAAY,CAAA;AAC3C,EAAA,IAAA,CAAK,OAAA,GAAU,EAAE,OAAA,EAAS,UAAA,EAAW;AACrC,EAAA,MAAM,CAAC,UAAA,EAAY,aAAa,CAAA,GAAI,SAAS,EAAE,CAAA;AAC/C,EAAA,MAAM,CAAC,KAAA,EAAO,QAAQ,CAAA,GAAI,SA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AAA,EAAU,mBAAA,EAAoB,MAAK,OAAA,EACtC,QAAA,EAAA;AAAA,sBAAA,GAAA,CAAC,OAAG,QAAA,EAAA,KAAA,EAAM,CAAA;AAAA,sBACV,GAAA,CAAC,QAAA,EAAA,EAAO,OAAA,EAAS,MAAM,UAAA,CAAW,CAAC,KAAA,KAAU,KAAA,GAAQ,CAAC,CAAA,EAAG,QAAA,EAAA,kBAAA,EAAgB;AAAA,KAAA,EAC3E,CAAA;AAEJ,EAAA,IAAI,CAAC,UAAA;AACH,IAAA,2BACG,KAAA,EAAA,EAAI,SAAA,EAAU,mBAAA,EAAoB,IAAA,EAAK,UAAS,QAAA,EAAA,gCAAA,EAEjD,CAAA;AAEJ,EAAA,uBACE,GAAA;AAAA,IAAC,gBAAA;AAAA,IAAA;AAAA,MAEC,OAAA;AAAA,MACA,UAAA;AAAA,MACA,OAAO,CAAA,EAAG,KAAA,CAAM,OAAA,CAAQ,UAAA,EAAY,EAAE,CAAC,CAAA,eAAA;AAAA,KAAA;AAAA,IAHlC;AAAA,GAIP;AAEJ","file":"index.js","sourcesContent":["import { useEffect, useRef, useState } from 'react'\nimport { parseVersionRef } from '@arbidocs/react/artifacts'\nimport { NativeDocxEditor, type NativeDocxAdapter } from './NativeDocxEditor'\n\nexport interface NativeDocxComparisonProps {\n adapter: NativeDocxAdapter\n baseId: string\n revisedId: string\n title: string\n onCompared?: (documentId: string) => void | Promise<void>\n}\n\n/** A `doc-…@v{n}` side names an older version: the endpoint takes its document and version apart. */\nfunction redlineQuery(baseId: string, revisedId: string): URLSearchParams {\n const base = parseVersionRef(baseId)\n const revised = parseVersionRef(revisedId)\n const query = new URLSearchParams({ base_ext_id: base.docId, revised_ext_id: revised.docId })\n if (base.version) query.set('base_version', String(base.version))\n if (revised.version) query.set('revised_version', String(revised.version))\n return query\n}\n\n/** Word comparison through the host's authenticated transport and LibreOffice service. */\nexport function NativeDocxComparison({\n adapter,\n baseId,\n revisedId,\n title,\n onCompared,\n}: NativeDocxComparisonProps) {\n const host = useRef({ adapter, onCompared })\n host.current = { adapter, onCompared }\n const [documentId, setDocumentId] = useState('')\n const [error, setError] = useState('')\n const [attempt, setAttempt] = useState(0)\n useEffect(() => {\n let cancelled = false\n setDocumentId('')\n setError('')\n void host.current.adapter\n .request(`/redline?${redlineQuery(baseId, revisedId)}`, { method: 'POST' })\n .then((response) => response.json())\n .then((result: { document_ext_id: string }) => {\n if (!result.document_ext_id) throw new Error('Comparison did not return a Word document.')\n if (!cancelled) {\n setDocumentId(result.document_ext_id)\n void Promise.resolve(host.current.onCompared?.(result.document_ext_id)).catch(() => {})\n }\n })\n .catch((error) => {\n if (!cancelled) setError(error instanceof Error ? error.message : String(error))\n })\n return () => {\n cancelled = true\n }\n }, [baseId, revisedId, attempt])\n if (error)\n return (\n <div className=\"native-docx-error\" role=\"alert\">\n <p>{error}</p>\n <button onClick={() => setAttempt((value) => value + 1)}>Retry comparison</button>\n </div>\n )\n if (!documentId)\n return (\n <div className=\"native-docx-error\" role=\"status\">\n Comparing Word documents…\n </div>\n )\n return (\n <NativeDocxEditor\n key={documentId}\n adapter={adapter}\n documentId={documentId}\n title={`${title.replace(/\\.[^.]+$/, '')} (redline).docx`}\n />\n )\n}\n"]}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
export type NoteKind = 'footnote' | 'endnote';
|
|
2
|
+
/** A style the document defines, as the engine lists them (`getDocumentStyles`). */
|
|
3
|
+
export interface DocumentStyle {
|
|
4
|
+
readonly styleId: string;
|
|
5
|
+
readonly name: string;
|
|
6
|
+
readonly type: string;
|
|
7
|
+
}
|
|
8
|
+
/** The note text style among `styles`: by Word's built-in name, else by its standard id. */
|
|
9
|
+
export declare function noteTextStyle(styles: readonly DocumentStyle[], kind: NoteKind): string | undefined;
|
|
10
|
+
/**
|
|
11
|
+
* The definitions of the note styles `styles` lacks, in `styles.xml` form ([] when none). The
|
|
12
|
+
* reference style is matched by id, the id the engine writes on the reference; the text style by
|
|
13
|
+
* Word's built-in name too, which a document saved in another language keeps under its own id.
|
|
14
|
+
*/
|
|
15
|
+
export declare function missingNoteStyles(styles: readonly DocumentStyle[], kind: NoteKind): string[];
|
|
16
|
+
/**
|
|
17
|
+
* A fragment that carries only `styles`: one empty, open paragraph, so pasting it at the caret
|
|
18
|
+
* inserts nothing and the editor's paste merges the styles the document lacks (as it does for a
|
|
19
|
+
* Quick Part's).
|
|
20
|
+
*/
|
|
21
|
+
export declare function stylesOnlyClipboardHtml(styles: readonly string[]): string;
|
|
22
|
+
/** The editor surface `ensureNoteStyles` needs. */
|
|
23
|
+
interface NoteStyleEditor {
|
|
24
|
+
can(command: {
|
|
25
|
+
type: 'insertNote';
|
|
26
|
+
noteKind: NoteKind;
|
|
27
|
+
}): {
|
|
28
|
+
ok: boolean;
|
|
29
|
+
};
|
|
30
|
+
getDocumentStyles(): readonly DocumentStyle[];
|
|
31
|
+
exec(command: {
|
|
32
|
+
type: 'paste';
|
|
33
|
+
text: string;
|
|
34
|
+
html: string;
|
|
35
|
+
}): {
|
|
36
|
+
ok: boolean;
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Before a note is inserted: add Word's note styles the document lacks, so the reference and the
|
|
41
|
+
* note number are superscript and the note text is Word's smaller footnote text. `direct` runs
|
|
42
|
+
* the write untracked, as Word adds styles. Returns the id of the document's note text style
|
|
43
|
+
* ("footnote text" / "endnote text"), for the new note's paragraph.
|
|
44
|
+
*/
|
|
45
|
+
export declare function ensureNoteStyles(editor: NoteStyleEditor, kind: NoteKind, direct?: <T>(fn: () => T) => T): string | undefined;
|
|
46
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** What a ribbon row collapses into its More menu (see `RibbonOverflow`). */
|
|
2
|
+
/** One control as the row measured it, in ribbon order. */
|
|
3
|
+
export interface OverflowItem {
|
|
4
|
+
id: string;
|
|
5
|
+
/** Width in the row, including the gap after it. */
|
|
6
|
+
width: number;
|
|
7
|
+
/** Higher stays in the row longer. */
|
|
8
|
+
priority: number;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* The controls to collapse so the rest fit in `available` beside a More trigger `moreWidth`
|
|
12
|
+
* wide: none when everything fits; otherwise the lowest priority first, and among equal
|
|
13
|
+
* priorities the rightmost first.
|
|
14
|
+
*/
|
|
15
|
+
export declare function planOverflow(items: readonly OverflowItem[], available: number, moreWidth: number): Set<string>;
|