@arbidocs/blocks 0.4.103 → 0.4.105
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/agents/runs/AgentSteps.d.ts +3 -3
- package/dist/chat/ModelPicker.d.ts +7 -7
- package/dist/chat/index.cjs +65 -65
- package/dist/chat/index.js +1 -1
- package/dist/{chunk-IF6VAYIA.cjs → chunk-24ND4S6Y.cjs} +8 -8
- package/dist/chunk-24ND4S6Y.cjs.map +1 -0
- package/dist/{chunk-AOFATOT3.cjs → chunk-2A4MDHJR.cjs} +7 -5
- package/dist/chunk-2A4MDHJR.cjs.map +1 -0
- package/dist/{chunk-DDYXFALG.cjs → chunk-3PCHGUL5.cjs} +5 -5
- package/dist/{chunk-DDYXFALG.cjs.map → chunk-3PCHGUL5.cjs.map} +1 -1
- package/dist/{chunk-GQTIAATM.js → chunk-4GFB5U3K.js} +3 -3
- package/dist/{chunk-GQTIAATM.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-TFDU2KGS.cjs → chunk-7LLLQUM7.cjs} +5 -5
- package/dist/{chunk-TFDU2KGS.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-IU542FPZ.js} +5 -5
- package/dist/{chunk-5NQIBJPP.js.map → chunk-IU542FPZ.js.map} +1 -1
- package/dist/{chunk-H6DFXG5N.js → chunk-PIT2YZCK.js} +3 -3
- package/dist/{chunk-H6DFXG5N.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-ICBAFX5B.js → chunk-S7RHJI5Q.js} +8 -8
- package/dist/chunk-S7RHJI5Q.js.map +1 -0
- 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-N36PWG7A.cjs → chunk-TP3FAP5J.cjs} +5 -5
- package/dist/{chunk-N36PWG7A.cjs.map → chunk-TP3FAP5J.cjs.map} +1 -1
- package/dist/{chunk-CVYY4X5R.js → chunk-W2RTZOK3.js} +1232 -193
- package/dist/chunk-W2RTZOK3.js.map +1 -0
- package/dist/{chunk-O33EBMIX.cjs → chunk-ZWWN4CUL.cjs} +1410 -359
- 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 +13 -12
- package/dist/connect/index.cjs.map +1 -1
- package/dist/connect/index.js +6 -5
- 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/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/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 +21 -128
- package/dist/facts/index.cjs.map +1 -1
- package/dist/facts/index.js +2 -124
- package/dist/facts/index.js.map +1 -1
- package/dist/index.cjs +342 -342
- package/dist/index.js +8 -8
- package/dist/settings/Billing.d.ts +1 -1
- package/dist/settings/PlanCard.d.ts +2 -2
- package/dist/settings/QuotaMeter.d.ts +1 -1
- package/dist/settings/{ReferralCredit.d.ts → ReferralReward.d.ts} +15 -15
- package/dist/settings/SubscriptionParts.d.ts +3 -3
- package/dist/settings/Usage.d.ts +7 -11
- package/dist/settings/WelcomeDialog.d.ts +1 -1
- package/dist/settings/index.cjs +33 -39
- package/dist/settings/index.cjs.map +1 -1
- package/dist/settings/index.d.ts +2 -2
- package/dist/settings/index.js +31 -36
- package/dist/settings/index.js.map +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 +22 -0
- package/dist/chunk-AOFATOT3.cjs.map +0 -1
- package/dist/chunk-CVYY4X5R.js.map +0 -1
- package/dist/chunk-D3QPYKZG.js.map +0 -1
- package/dist/chunk-ICBAFX5B.js.map +0 -1
- package/dist/chunk-IF6VAYIA.cjs.map +0 -1
- package/dist/chunk-O33EBMIX.cjs.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
|
/**
|
|
@@ -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,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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M,MAAM;AAAA,QAAC,CAAC,CAAA;AAAA,MACxF;AAAA,IACF,CAAC,CAAA,CACA,KAAA,CAAM,CAACC,MAAAA,KAAU;AAChB,MAAA,IAAI,CAAC,WAAW,QAAA,CAASA,MAAAA,YAAiB,QAAQA,MAAAA,CAAM,OAAA,GAAU,MAAA,CAAOA,MAAK,CAAC,CAAA;AAAA,IACjF,CAAC,CAAA;AACH,IAAA,OAAO,MAAM;AACX,MAAA,SAAA,GAAY,IAAA;AAAA,IACd,CAAA;AAAA,EACF,CAAA,EAAG,CAAC,MAAA,EAAQ,SAAA,EAAW,OAAO,CAAC,CAAA;AAC/B,EAAA,IAAI,KAAA;AACF,IAAA,uBACEC,eAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAU,mBAAA,EAAoB,MAAK,OAAA,EACtC,QAAA,EAAA;AAAA,sBAAAC,cAAA,CAAC,OAAG,QAAA,EAAA,KAAA,EAAM,CAAA;AAAA,sBACVA,cAAA,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,sCACG,KAAA,EAAA,EAAI,SAAA,EAAU,mBAAA,EAAoB,IAAA,EAAK,UAAS,QAAA,EAAA,gCAAA,EAEjD,CAAA;AAEJ,EAAA,uBACEA,cAAA;AAAA,IAACC,kCAAA;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.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"],"mapp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AAA;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,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cross-references in the Word editor: the Insert cross-reference dialog (within this document,
|
|
3
|
+
* to a numbered clause or a heading; or to a passage of another document of the workspace), a
|
|
4
|
+
* hover card on an inserted reference showing what it points at, and in-app navigation when a
|
|
5
|
+
* reference to another document is clicked. Mount `CrossReferencesProvider` inside
|
|
6
|
+
* `DocxEditor.Root`; the ribbon and the context menu read it from context.
|
|
7
|
+
*/
|
|
8
|
+
import React, { type ReactNode } from 'react';
|
|
9
|
+
import { type CrossReferenceMode } from './commands';
|
|
10
|
+
import { type CrossReferenceTarget } from './numbering';
|
|
11
|
+
import { type DocumentPassage, type DocumentPassageTarget, type ReferenceDocument } from './passages';
|
|
12
|
+
/** What the host supplies for references to its other documents. */
|
|
13
|
+
export interface DocxReferencesAdapter {
|
|
14
|
+
/** The documents a reference can point into (the open one is left out). */
|
|
15
|
+
documents: () => Promise<ReferenceDocument[]>;
|
|
16
|
+
/** A document's passages, in document order. */
|
|
17
|
+
passages: (documentId: string) => Promise<DocumentPassage[]>;
|
|
18
|
+
/** The address a reference links to (the app's link to that passage, so it works from Word). */
|
|
19
|
+
linkFor: (target: DocumentPassageTarget) => string;
|
|
20
|
+
/** The passage a link addresses, or null for any other link. */
|
|
21
|
+
targetOf: (href: string) => DocumentPassageTarget | null;
|
|
22
|
+
/** Open the document at that passage, highlighted. */
|
|
23
|
+
open: (target: DocumentPassageTarget) => void;
|
|
24
|
+
/** The app's name, for a reference's screen tip ("… opens in ARBI"). Default ARBI. */
|
|
25
|
+
appName?: string;
|
|
26
|
+
/** The host's document picker, as a slot (receives the chosen document id). */
|
|
27
|
+
renderDocumentPicker?: (onSelect: (documentId: string) => void, selectedId: string | null) => ReactNode;
|
|
28
|
+
}
|
|
29
|
+
export interface CrossReferencesLabels {
|
|
30
|
+
insert: string;
|
|
31
|
+
title: string;
|
|
32
|
+
description: string;
|
|
33
|
+
thisDocument: string;
|
|
34
|
+
otherDocument: string;
|
|
35
|
+
filterTargets: string;
|
|
36
|
+
noTargets: string;
|
|
37
|
+
number: string;
|
|
38
|
+
text: string;
|
|
39
|
+
insertAs: string;
|
|
40
|
+
chooseDocument: string;
|
|
41
|
+
filterPassages: string;
|
|
42
|
+
loadingPassages: string;
|
|
43
|
+
noPassages: string;
|
|
44
|
+
referenceText: string;
|
|
45
|
+
insertButton: string;
|
|
46
|
+
cancel: string;
|
|
47
|
+
clause: (number: string) => string;
|
|
48
|
+
heading: string;
|
|
49
|
+
update: string;
|
|
50
|
+
updated: string;
|
|
51
|
+
updateSummary: (refreshed: number) => string;
|
|
52
|
+
brokenTitle: string;
|
|
53
|
+
brokenNone: string;
|
|
54
|
+
brokenHelp: string;
|
|
55
|
+
brokenCard: string;
|
|
56
|
+
brokenCardBody: string;
|
|
57
|
+
show: string;
|
|
58
|
+
close: string;
|
|
59
|
+
}
|
|
60
|
+
export declare const DEFAULT_CROSS_REFERENCES_LABELS: CrossReferencesLabels;
|
|
61
|
+
interface CrossReferencesContextValue {
|
|
62
|
+
/** Open the Insert cross-reference dialog for the caret. */
|
|
63
|
+
openDialog: () => void;
|
|
64
|
+
/** Update every cross-reference and show what changed and what is broken. */
|
|
65
|
+
update: () => void;
|
|
66
|
+
labels: CrossReferencesLabels;
|
|
67
|
+
}
|
|
68
|
+
/** The cross-reference commands, or `null` where the editor cannot take them. */
|
|
69
|
+
export declare const useCrossReferences: () => CrossReferencesContextValue | null;
|
|
70
|
+
export interface CrossReferencesProviderProps {
|
|
71
|
+
children: ReactNode;
|
|
72
|
+
/** Editing is possible (not a snapshot, a stream or a read-only document). */
|
|
73
|
+
editable: boolean;
|
|
74
|
+
/** References to other documents; absent, only this document's clauses are offered. */
|
|
75
|
+
references?: DocxReferencesAdapter;
|
|
76
|
+
/** The open document, left out of the documents to refer to. */
|
|
77
|
+
documentId?: string;
|
|
78
|
+
notify?: (message: string, kind: 'success' | 'error') => void;
|
|
79
|
+
labels?: Partial<CrossReferencesLabels>;
|
|
80
|
+
}
|
|
81
|
+
export declare function CrossReferencesProvider({ children, editable, references, documentId, notify, labels, }: CrossReferencesProviderProps): React.JSX.Element;
|
|
82
|
+
export interface CrossReferenceDialogProps {
|
|
83
|
+
targets: CrossReferenceTarget[];
|
|
84
|
+
references?: DocxReferencesAdapter;
|
|
85
|
+
documentId?: string;
|
|
86
|
+
passages: Record<string, DocumentPassage[] | 'loading'>;
|
|
87
|
+
loadPassages: (documentId: string) => void;
|
|
88
|
+
labels?: Partial<CrossReferencesLabels>;
|
|
89
|
+
onCancel: () => void;
|
|
90
|
+
onInsertTarget: (target: CrossReferenceTarget, mode: CrossReferenceMode) => void;
|
|
91
|
+
onInsertPassage: (target: DocumentPassageTarget, text: string) => void;
|
|
92
|
+
/** After the dialog has closed: focus goes here (the document), not back to what opened it. */
|
|
93
|
+
onClosed?: () => void;
|
|
94
|
+
}
|
|
95
|
+
/** The Insert cross-reference dialog: a target of this document, or a passage of another one. */
|
|
96
|
+
export declare function CrossReferenceDialog({ targets, references, documentId, passages, loadPassages, labels, onCancel, onInsertTarget, onInsertPassage, onClosed, }: CrossReferenceDialogProps): React.JSX.Element;
|
|
97
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where the defined-term and cross-reference commands sit in the editor's chrome: an Insert-tab
|
|
3
|
+
* button, and rows appended to the editor's own right-click menu (its Cut, Copy, Paste… stay).
|
|
4
|
+
*/
|
|
5
|
+
/** Insert tab: Insert cross-reference. */
|
|
6
|
+
export declare function CrossReferenceButton(): import("react").JSX.Element | null;
|
|
7
|
+
/** References tab: Update cross-references (numbers brought up to date, broken ones listed). */
|
|
8
|
+
export declare function UpdateCrossReferencesButton(): import("react").JSX.Element | null;
|
|
9
|
+
/** Rows for the editor's right-click menu: Insert defined term, Insert cross-reference. */
|
|
10
|
+
export declare function DocxContextMenuExtras(): import("react").JSX.Element | null;
|