@arbidocs/blocks 0.4.93 → 0.4.95
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 +281 -281
- package/dist/agents/index.js +5 -5
- package/dist/chat/index.cjs +127 -127
- package/dist/chat/index.js +4 -4
- package/dist/{chunk-HOXKR26S.js → chunk-24CS7JWU.js} +3 -3
- package/dist/{chunk-HOXKR26S.js.map → chunk-24CS7JWU.js.map} +1 -1
- package/dist/{chunk-6XS5IJ5R.cjs → chunk-3OXWJ3CZ.cjs} +5 -5
- package/dist/{chunk-6XS5IJ5R.cjs.map → chunk-3OXWJ3CZ.cjs.map} +1 -1
- package/dist/chunk-AF6RDAJF.js +14 -0
- package/dist/chunk-AF6RDAJF.js.map +1 -0
- package/dist/chunk-AOFATOT3.cjs +196 -0
- package/dist/chunk-AOFATOT3.cjs.map +1 -0
- package/dist/{chunk-NYBIKDWI.cjs → chunk-CKYA2IG5.cjs} +11 -5
- package/dist/chunk-CKYA2IG5.cjs.map +1 -0
- package/dist/chunk-D3QPYKZG.js +173 -0
- package/dist/chunk-D3QPYKZG.js.map +1 -0
- package/dist/{chunk-3WW32OUU.cjs → chunk-DCZGYCN2.cjs} +4 -4
- package/dist/{chunk-3WW32OUU.cjs.map → chunk-DCZGYCN2.cjs.map} +1 -1
- package/dist/{chunk-2ZDFVRGV.cjs → chunk-E2AAIMXO.cjs} +975 -61
- package/dist/chunk-E2AAIMXO.cjs.map +1 -0
- package/dist/{chunk-EWSEQEPL.js → chunk-EJAYB7PP.js} +4 -4
- package/dist/{chunk-EWSEQEPL.js.map → chunk-EJAYB7PP.js.map} +1 -1
- package/dist/{chunk-UO74FLRK.js → chunk-EOEDGJ75.js} +22 -53
- package/dist/chunk-EOEDGJ75.js.map +1 -0
- package/dist/{chunk-XMBYDLZQ.cjs → chunk-GNHOB2ZB.cjs} +4 -4
- package/dist/{chunk-XMBYDLZQ.cjs.map → chunk-GNHOB2ZB.cjs.map} +1 -1
- package/dist/{chunk-SF4BDUZS.js → chunk-HUFLBZWI.js} +3 -3
- package/dist/{chunk-SF4BDUZS.js.map → chunk-HUFLBZWI.js.map} +1 -1
- package/dist/{chunk-B4SRYJLM.cjs → chunk-KBPHLW2R.cjs} +3 -3
- package/dist/{chunk-B4SRYJLM.cjs.map → chunk-KBPHLW2R.cjs.map} +1 -1
- package/dist/{chunk-IF6VAYIA.cjs → chunk-OYMYNYFV.cjs} +5 -5
- package/dist/{chunk-IF6VAYIA.cjs.map → chunk-OYMYNYFV.cjs.map} +1 -1
- package/dist/{chunk-ICBAFX5B.js → chunk-PDEHIGJ5.js} +3 -3
- package/dist/{chunk-ICBAFX5B.js.map → chunk-PDEHIGJ5.js.map} +1 -1
- package/dist/{chunk-SJVUKXS6.js → chunk-QQH2NI5U.js} +6 -6
- package/dist/{chunk-SJVUKXS6.js.map → chunk-QQH2NI5U.js.map} +1 -1
- package/dist/chunk-RC25WMVB.cjs +16 -0
- package/dist/chunk-RC25WMVB.cjs.map +1 -0
- package/dist/{chunk-YFPIJUV3.cjs → chunk-RZGVMV6B.cjs} +5 -5
- package/dist/{chunk-YFPIJUV3.cjs.map → chunk-RZGVMV6B.cjs.map} +1 -1
- package/dist/{chunk-AMC5PMJ3.cjs → chunk-TOVSTC2M.cjs} +36 -68
- package/dist/chunk-TOVSTC2M.cjs.map +1 -0
- package/dist/{chunk-R3PDNQYT.js → chunk-UMY6Y6BM.js} +11 -5
- package/dist/chunk-UMY6Y6BM.js.map +1 -0
- package/dist/{chunk-MROSCSPW.cjs → chunk-VQ65UHTV.cjs} +45 -45
- package/dist/{chunk-MROSCSPW.cjs.map → chunk-VQ65UHTV.cjs.map} +1 -1
- package/dist/{chunk-MP6FK43E.cjs → chunk-VYKMBLDX.cjs} +8 -8
- package/dist/{chunk-MP6FK43E.cjs.map → chunk-VYKMBLDX.cjs.map} +1 -1
- package/dist/{chunk-W2R7YVFM.js → chunk-WXLKMEMB.js} +970 -65
- package/dist/chunk-WXLKMEMB.js.map +1 -0
- package/dist/{chunk-XQDM6T6C.js → chunk-YG7DGGCA.js} +3 -3
- package/dist/{chunk-XQDM6T6C.js.map → chunk-YG7DGGCA.js.map} +1 -1
- package/dist/{chunk-BX62HJZU.js → chunk-YPKSLTL5.js} +3 -3
- package/dist/{chunk-BX62HJZU.js.map → chunk-YPKSLTL5.js.map} +1 -1
- package/dist/{chunk-UDLMLU6T.js → chunk-ZNDAXSDP.js} +3 -3
- package/dist/{chunk-UDLMLU6T.js.map → chunk-ZNDAXSDP.js.map} +1 -1
- package/dist/connect/docx.cjs +8 -6
- package/dist/connect/docx.cjs.map +1 -1
- package/dist/connect/docx.js +6 -4
- package/dist/connect/docx.js.map +1 -1
- package/dist/connect/index.cjs +47 -45
- package/dist/connect/index.cjs.map +1 -1
- package/dist/connect/index.js +16 -14
- package/dist/connect/index.js.map +1 -1
- package/dist/docx/NativeDocxEditor.d.ts +6 -0
- package/dist/docx/definitions/DefinedTerms.d.ts +50 -0
- package/dist/docx/definitions/commands.d.ts +78 -0
- package/dist/docx/definitions/fragment.d.ts +29 -0
- package/dist/docx/definitions/port.d.ts +76 -0
- package/dist/docx/index.cjs +53 -15
- package/dist/docx/index.cjs.map +1 -1
- package/dist/docx/index.d.ts +3 -0
- package/dist/docx/index.js +5 -3
- package/dist/docx/index.js.map +1 -1
- package/dist/facts/index.cjs +7 -12
- package/dist/facts/index.cjs.map +1 -1
- package/dist/facts/index.js +3 -10
- package/dist/facts/index.js.map +1 -1
- package/dist/home/CreateTile.d.ts +3 -1
- package/dist/home/index.cjs +10 -4
- package/dist/home/index.cjs.map +1 -1
- package/dist/home/index.js +10 -4
- package/dist/home/index.js.map +1 -1
- package/dist/index.cjs +1207 -1067
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +102 -15
- package/dist/index.js.map +1 -1
- package/dist/settings/PanelFrame.d.ts +3 -1
- package/dist/settings/index.cjs +12 -4
- package/dist/settings/index.cjs.map +1 -1
- package/dist/settings/index.js +12 -4
- package/dist/settings/index.js.map +1 -1
- package/dist/shell/Workspace.d.ts +6 -1
- package/dist/shell/index.cjs +67 -67
- package/dist/shell/index.js +3 -3
- package/dist/studio/index.cjs +7 -7
- package/dist/studio/index.js +6 -6
- package/dist/tags/definitions.d.ts +92 -0
- package/dist/tags/glossary.d.ts +44 -0
- package/dist/tags/index.d.ts +2 -0
- package/dist/tags/ooxml.d.ts +46 -0
- package/dist/tags/tagTableDocx.d.ts +1 -1
- package/dist/workflow-canvas/index.cjs +49 -49
- package/dist/workflow-canvas/index.js +6 -6
- package/package.json +4 -4
- package/src/docx/README.md +11 -0
- package/dist/chunk-2ZDFVRGV.cjs.map +0 -1
- package/dist/chunk-AMC5PMJ3.cjs.map +0 -1
- package/dist/chunk-NYBIKDWI.cjs.map +0 -1
- package/dist/chunk-R3PDNQYT.js.map +0 -1
- package/dist/chunk-UO74FLRK.js.map +0 -1
- package/dist/chunk-W2R7YVFM.js.map +0 -1
|
@@ -2,6 +2,7 @@ import { type DocxMention, type DocxAgentCommentRequest, type DocxMentionDeliver
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { type FontConfiguration } from '@docx-editor.dev/react';
|
|
4
4
|
import type { DocxCollaborationSession } from '@arbidocs/coedit';
|
|
5
|
+
import type { DefinitionSource } from '../tags/definitions';
|
|
5
6
|
/**
|
|
6
7
|
* The editor path of a document's DOCX bytes. A version reference (`doc-…@v2`, a read-only
|
|
7
8
|
* snapshot of an older version) reads that version; a plain id the current one.
|
|
@@ -38,6 +39,11 @@ export interface NativeDocxAdapter {
|
|
|
38
39
|
mentions?: readonly DocxMention[];
|
|
39
40
|
requestAgent?: (documentId: string, request: DocxAgentCommentRequest) => Promise<DocxMentionDelivery | void>;
|
|
40
41
|
getAgentStatus?: (responseId: string) => Promise<DocxAgentRunStatus>;
|
|
42
|
+
/**
|
|
43
|
+
* The workspace's definitions: facts labelled "Definitions". Present: the Insert tab offers
|
|
44
|
+
* Defined term and Update definitions, and typing `@@` in the body opens the term type-ahead.
|
|
45
|
+
*/
|
|
46
|
+
definitions?: () => Promise<DefinitionSource[]>;
|
|
41
47
|
}
|
|
42
48
|
export interface NativeDocxEditorProps {
|
|
43
49
|
adapter: NativeDocxAdapter;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Defined terms in the Word editor: a type-ahead of the workspace's definitions (typing `@@` in the
|
|
3
|
+
* body, or Insert › Defined term), a hover card on an inserted term, and Update definitions. Mount
|
|
4
|
+
* `DefinedTermsProvider` inside `DocxEditor.Root`; the ribbon's buttons read it from context.
|
|
5
|
+
*/
|
|
6
|
+
import React from 'react';
|
|
7
|
+
import { type DefinitionSource } from '../../tags/definitions';
|
|
8
|
+
import { type UpdateDefinitionsResult } from './commands';
|
|
9
|
+
/** Typing this in the body opens the type-ahead. */
|
|
10
|
+
export declare const DEFINED_TERM_TRIGGER = "@@";
|
|
11
|
+
export interface DefinedTermsLabels {
|
|
12
|
+
insert: string;
|
|
13
|
+
update: string;
|
|
14
|
+
search: string;
|
|
15
|
+
allAgreements: string;
|
|
16
|
+
loading: string;
|
|
17
|
+
empty: string;
|
|
18
|
+
noMatch: string;
|
|
19
|
+
hint: string;
|
|
20
|
+
preferred: string;
|
|
21
|
+
alsoIn: (source: string) => string;
|
|
22
|
+
updated: string;
|
|
23
|
+
updateSummary: (r: UpdateDefinitionsResult) => string;
|
|
24
|
+
unusedTitle: string;
|
|
25
|
+
unusedNone: string;
|
|
26
|
+
unknownTitle: string;
|
|
27
|
+
show: string;
|
|
28
|
+
close: string;
|
|
29
|
+
}
|
|
30
|
+
export declare const DEFAULT_DEFINED_TERMS_LABELS: DefinedTermsLabels;
|
|
31
|
+
interface DefinedTermsContextValue {
|
|
32
|
+
/** Open the type-ahead at the caret, with a search box. */
|
|
33
|
+
openPicker: (anchor?: HTMLElement | null) => void;
|
|
34
|
+
/** Update the Definitions section and show what changed. */
|
|
35
|
+
update: () => void;
|
|
36
|
+
labels: DefinedTermsLabels;
|
|
37
|
+
}
|
|
38
|
+
/** The defined-term commands, or `null` where the editor has no definitions to offer. */
|
|
39
|
+
export declare const useDefinedTerms: () => DefinedTermsContextValue | null;
|
|
40
|
+
export interface DefinedTermsProviderProps {
|
|
41
|
+
children: React.ReactNode;
|
|
42
|
+
/** The workspace's definition facts. Absent: no defined-term features. */
|
|
43
|
+
load?: () => Promise<DefinitionSource[]>;
|
|
44
|
+
/** Editing is possible (not a snapshot, a stream or a read-only document). */
|
|
45
|
+
editable: boolean;
|
|
46
|
+
notify?: (message: string, kind: 'success' | 'error') => void;
|
|
47
|
+
labels?: Partial<DefinedTermsLabels>;
|
|
48
|
+
}
|
|
49
|
+
export declare function DefinedTermsProvider({ children, load, editable, notify, labels, }: DefinedTermsProviderProps): React.JSX.Element;
|
|
50
|
+
export {};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The defined-term commands: insert a term as a link to its definition (adding the definition to
|
|
3
|
+
* the document's Definitions section when it is not there yet), and update the section from the
|
|
4
|
+
* definition facts. Written against {@link DefinitionsPort}, so they run on the live editor and on
|
|
5
|
+
* the in-memory model the tests use alike.
|
|
6
|
+
*
|
|
7
|
+
* Where the Definitions section is: the first top-level paragraph titled "Definitions",
|
|
8
|
+
* "Definitions and interpretation", "Interpretation", "Defined terms" or "Glossary" (clause numbers
|
|
9
|
+
* ignored), up to the next heading. A document without one gets a "Definitions" heading at its end:
|
|
10
|
+
* appended, it never splits the clause being drafted, and it is where a reader of a draft looks
|
|
11
|
+
* for a schedule of terms. Inside the section, definitions are kept in alphabetical order.
|
|
12
|
+
*/
|
|
13
|
+
import { type Definition } from '../../tags/definitions';
|
|
14
|
+
import type { DefinitionsPort, DocParagraph, DocPoint } from './port';
|
|
15
|
+
/** Title of a Definitions section the commands create. */
|
|
16
|
+
export declare const DEFINITIONS_HEADING = "Definitions";
|
|
17
|
+
/** Whether a paragraph titles a Definitions section. */
|
|
18
|
+
export declare function isDefinitionsTitle(paragraph: DocParagraph): boolean;
|
|
19
|
+
/** The Definitions section: its title's index and the paragraphs after it, up to the next heading. */
|
|
20
|
+
export interface DefinitionsSection {
|
|
21
|
+
title: number;
|
|
22
|
+
/** First paragraph after the title. */
|
|
23
|
+
start: number;
|
|
24
|
+
/** Index after the section's last paragraph (the next heading, a table, or the end). */
|
|
25
|
+
end: number;
|
|
26
|
+
}
|
|
27
|
+
export declare function findDefinitionsSection(paragraphs: readonly DocParagraph[]): DefinitionsSection | null;
|
|
28
|
+
/**
|
|
29
|
+
* Where a definition of `term` goes in the section, alphabetically: before the first definition
|
|
30
|
+
* whose term sorts after it, else after the last definition (else right after the title).
|
|
31
|
+
*/
|
|
32
|
+
export declare function insertionIndex(paragraphs: readonly DocParagraph[], section: DefinitionsSection, term: string, skip?: ReadonlySet<string>): number;
|
|
33
|
+
/**
|
|
34
|
+
* Add a definition paragraph to the Definitions section (made at the end of the document when there
|
|
35
|
+
* is none), in alphabetical order. Answers where `keep` moved to.
|
|
36
|
+
*/
|
|
37
|
+
export declare function addDefinition(port: DefinitionsPort, definition: Definition, keep?: DocPoint): DocPoint | undefined;
|
|
38
|
+
export interface InsertTermResult {
|
|
39
|
+
/** The definition was not in the document yet and was added to its Definitions section. */
|
|
40
|
+
addedDefinition: boolean;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Insert a defined term at the caret: the term as an internal link to its definition's bookmark
|
|
44
|
+
* (its definition as the link's tooltip), the definition added to the Definitions section first
|
|
45
|
+
* when the document does not have it. `replace` characters before the caret (a typed `@@query`)
|
|
46
|
+
* are removed first. The caret ends after the term.
|
|
47
|
+
*/
|
|
48
|
+
export declare function insertDefinedTerm(port: DefinitionsPort, definition: Definition, options?: {
|
|
49
|
+
replace?: number;
|
|
50
|
+
}): InsertTermResult;
|
|
51
|
+
/** A definition in the section that nothing in the document uses. */
|
|
52
|
+
export interface UnusedDefinition {
|
|
53
|
+
term: string;
|
|
54
|
+
paragraphId: string;
|
|
55
|
+
}
|
|
56
|
+
export interface UpdateDefinitionsResult {
|
|
57
|
+
/** Terms whose definitions were added (linked from the text, missing from the section). */
|
|
58
|
+
added: string[];
|
|
59
|
+
/** Terms whose wording changed to the fact's current text. */
|
|
60
|
+
refreshed: string[];
|
|
61
|
+
/** Terms moved back into alphabetical order. */
|
|
62
|
+
reordered: string[];
|
|
63
|
+
/** Definitions in the section never used in the rest of the document (left in place). */
|
|
64
|
+
unused: UnusedDefinition[];
|
|
65
|
+
/** Linked bookmarks whose definition fact no longer exists or is no longer a definition. */
|
|
66
|
+
unknown: string[];
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Update the Definitions section from the definition facts (`definitions`, by fact id): add the
|
|
70
|
+
* definitions the text links to but the section lacks, refresh the wording of the ones it has,
|
|
71
|
+
* put them back in alphabetical order, and report — without removing anything — the definitions
|
|
72
|
+
* in the section the rest of the document never uses.
|
|
73
|
+
*/
|
|
74
|
+
export declare function updateDefinitions(port: DefinitionsPort, definitions: ReadonlyMap<string, Definition>): UpdateDefinitionsResult;
|
|
75
|
+
/** Term groups keyed for quick lookup of the definition a bookmark points at. */
|
|
76
|
+
export declare function definitionsById(definitions: readonly Definition[]): Map<string, Definition>;
|
|
77
|
+
/** The definition an internal link points at, from its bookmark name. */
|
|
78
|
+
export declare function definitionOfAnchor(anchor: string, definitions: ReadonlyMap<string, Definition>): Definition | undefined;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Defined-term content as WordprocessingML, and the clipboard fragment that carries it into the
|
|
3
|
+
* editor. The engine has no "insert bookmark" command, but its paste lands an embedded `.docx`
|
|
4
|
+
* fragment with everything in it — `w:bookmarkStart`/`w:bookmarkEnd` and `w:hyperlink w:anchor`
|
|
5
|
+
* included — freshening bookmark ids as it goes. So the term link, the bookmarked definition and a
|
|
6
|
+
* new Definitions heading are written here and pasted.
|
|
7
|
+
*/
|
|
8
|
+
import type { Definition } from '../../tags/definitions';
|
|
9
|
+
/** Character style of an inserted term: a dotted underline, so a defined term reads as one. */
|
|
10
|
+
export declare const DEFINED_TERM_STYLE = "DefinedTerm";
|
|
11
|
+
/** What Word shows on hover over a term: its definition, as one line of at most 255 characters. */
|
|
12
|
+
export declare function definitionTooltip(definition: Pick<Definition, 'term' | 'rest'>): string;
|
|
13
|
+
/** The definition paragraph's text as the document shows it: `“Shares” means the issued shares.` */
|
|
14
|
+
export declare const definitionParagraphText: (definition: Pick<Definition, "term" | "rest">) => string;
|
|
15
|
+
/**
|
|
16
|
+
* A definition paragraph: the quoted term in bold, bookmarked (`bookmark`), then the definition as
|
|
17
|
+
* the fact writes it. `id` is the bookmark id inside the fragment; the paste renumbers it.
|
|
18
|
+
*/
|
|
19
|
+
export declare function definitionParagraphXml(definition: Pick<Definition, 'term' | 'rest'>, bookmark: string, id?: number): string;
|
|
20
|
+
/** A heading paragraph: the document's own heading style when it has one, else bold text. */
|
|
21
|
+
export declare function headingParagraphXml(text: string, styleId?: string): string;
|
|
22
|
+
/** The term as an internal link to its definition's bookmark, with the definition as its tooltip. */
|
|
23
|
+
export declare function termLinkXml(term: string, bookmark: string, tooltip: string): string;
|
|
24
|
+
/**
|
|
25
|
+
* Clipboard HTML carrying `body` (paragraph XML) as the editor's own fragment. `covered` says the
|
|
26
|
+
* last paragraph mark is part of it: the paste then ends with a whole paragraph (a block inserted
|
|
27
|
+
* before the caret's paragraph) instead of running into the text after the caret (inline).
|
|
28
|
+
*/
|
|
29
|
+
export declare function fragmentHtml(body: string, covered: boolean): string;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The few things the defined-term commands need from a live Word editor, behind an interface so
|
|
3
|
+
* the commands are tested against a small in-memory model rather than the engine.
|
|
4
|
+
*/
|
|
5
|
+
import type { DocxEditorInstance } from '@docx-editor.dev/core';
|
|
6
|
+
/** A position: a paragraph (the engine's node id) and a UTF-16 offset into its text. */
|
|
7
|
+
export interface DocPoint {
|
|
8
|
+
paragraphId: string;
|
|
9
|
+
offset: number;
|
|
10
|
+
}
|
|
11
|
+
/** An internal link in a paragraph. */
|
|
12
|
+
export interface DocLink {
|
|
13
|
+
anchor: string;
|
|
14
|
+
text: string;
|
|
15
|
+
}
|
|
16
|
+
/** One paragraph, in document order. */
|
|
17
|
+
export interface DocParagraph {
|
|
18
|
+
id: string;
|
|
19
|
+
text: string;
|
|
20
|
+
/** Styled as a heading (a `Heading n` style or an outline level). */
|
|
21
|
+
heading: boolean;
|
|
22
|
+
styleId?: string;
|
|
23
|
+
/** A paragraph of the body itself, not inside a table. */
|
|
24
|
+
topLevel: boolean;
|
|
25
|
+
/** Names of the bookmarks that start in it. */
|
|
26
|
+
bookmarks: string[];
|
|
27
|
+
/** Its internal links (`w:hyperlink w:anchor`). */
|
|
28
|
+
links: DocLink[];
|
|
29
|
+
}
|
|
30
|
+
export interface DefinitionsPort {
|
|
31
|
+
/** Every body paragraph, in document order (table cells included, `topLevel: false`). */
|
|
32
|
+
paragraphs(): DocParagraph[];
|
|
33
|
+
/** The caret, or `null` when the selection is a range or there is none. */
|
|
34
|
+
caret(): DocPoint | null;
|
|
35
|
+
setCaret(point: DocPoint): void;
|
|
36
|
+
/** Delete everything between two points (across paragraphs: the marks between them go too). */
|
|
37
|
+
deleteRange(from: DocPoint, to: DocPoint): void;
|
|
38
|
+
/**
|
|
39
|
+
* Paste paragraph XML at the caret. `covered`: the fragment ends with a whole paragraph, so at
|
|
40
|
+
* the start of a paragraph it lands as paragraphs before it. Otherwise it runs inline.
|
|
41
|
+
*/
|
|
42
|
+
paste(body: string, text: string, covered: boolean): boolean;
|
|
43
|
+
/** Split the caret's paragraph (Enter), the caret moving into the new one. */
|
|
44
|
+
splitParagraph(): void;
|
|
45
|
+
}
|
|
46
|
+
type Node = {
|
|
47
|
+
id: string;
|
|
48
|
+
kind: string;
|
|
49
|
+
localName?: string;
|
|
50
|
+
value?: string;
|
|
51
|
+
attributes?: readonly {
|
|
52
|
+
localName: string;
|
|
53
|
+
value: string;
|
|
54
|
+
}[];
|
|
55
|
+
children?: readonly Node[];
|
|
56
|
+
};
|
|
57
|
+
/** The paragraphs of a part's body, read from the engine's OOXML tree. */
|
|
58
|
+
export declare function readParagraphs(root: Node): DocParagraph[];
|
|
59
|
+
/** The port over a live editor. Writes go through the editor's own commands and paste. */
|
|
60
|
+
export declare function editorPort(editor: DocxEditorInstance): DefinitionsPort;
|
|
61
|
+
/**
|
|
62
|
+
* Run `fn` with direct editing. The engine pastes rich content (bookmarks, links) only outside
|
|
63
|
+
* Suggesting mode, so a suggesting editor switches for the command and back; a read-only one refuses.
|
|
64
|
+
*/
|
|
65
|
+
export declare function withDirectEditing<T>(editor: DocxEditorInstance, fn: () => T): T;
|
|
66
|
+
/**
|
|
67
|
+
* Keep the caret where a command left it across the collaboration room's next re-install.
|
|
68
|
+
*
|
|
69
|
+
* A paste lands as a package-level write; in a collaboration room the engine then re-installs the
|
|
70
|
+
* document, numbering its paragraph nodes afresh by position. The selection keeps its old node id,
|
|
71
|
+
* which after a paragraph was inserted above it names a different paragraph, so the next keystroke
|
|
72
|
+
* would go nowhere. The paragraph's own `w14:paraId` survives the re-install: the caret is put back
|
|
73
|
+
* on it once, unless the person has moved it meanwhile.
|
|
74
|
+
*/
|
|
75
|
+
export declare function holdCaret(editor: DocxEditorInstance, timeoutMs?: number): void;
|
|
76
|
+
export {};
|
package/dist/docx/index.cjs
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
var
|
|
5
|
-
var
|
|
4
|
+
var chunk3OXWJ3CZ_cjs = require('../chunk-3OXWJ3CZ.cjs');
|
|
5
|
+
var chunkE2AAIMXO_cjs = require('../chunk-E2AAIMXO.cjs');
|
|
6
|
+
require('../chunk-AOFATOT3.cjs');
|
|
7
|
+
require('../chunk-RC25WMVB.cjs');
|
|
6
8
|
require('../chunk-7UTB4PHM.cjs');
|
|
7
9
|
require('../chunk-MHVNT4J3.cjs');
|
|
8
10
|
require('../chunk-DES3K4SD.cjs');
|
|
@@ -58,7 +60,7 @@ function NativeDocxComparison({
|
|
|
58
60
|
if (!documentId)
|
|
59
61
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "native-docx-error", role: "status", children: "Comparing Word documents\u2026" });
|
|
60
62
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
61
|
-
|
|
63
|
+
chunkE2AAIMXO_cjs.NativeDocxEditor,
|
|
62
64
|
{
|
|
63
65
|
adapter,
|
|
64
66
|
documentId,
|
|
@@ -70,51 +72,87 @@ function NativeDocxComparison({
|
|
|
70
72
|
|
|
71
73
|
Object.defineProperty(exports, "StreamedWordArtifact", {
|
|
72
74
|
enumerable: true,
|
|
73
|
-
get: function () { return
|
|
75
|
+
get: function () { return chunk3OXWJ3CZ_cjs.StreamedWordArtifact; }
|
|
76
|
+
});
|
|
77
|
+
Object.defineProperty(exports, "DEFAULT_DEFINED_TERMS_LABELS", {
|
|
78
|
+
enumerable: true,
|
|
79
|
+
get: function () { return chunkE2AAIMXO_cjs.DEFAULT_DEFINED_TERMS_LABELS; }
|
|
80
|
+
});
|
|
81
|
+
Object.defineProperty(exports, "DEFINED_TERM_TRIGGER", {
|
|
82
|
+
enumerable: true,
|
|
83
|
+
get: function () { return chunkE2AAIMXO_cjs.DEFINED_TERM_TRIGGER; }
|
|
84
|
+
});
|
|
85
|
+
Object.defineProperty(exports, "DefinedTermsProvider", {
|
|
86
|
+
enumerable: true,
|
|
87
|
+
get: function () { return chunkE2AAIMXO_cjs.DefinedTermsProvider; }
|
|
74
88
|
});
|
|
75
89
|
Object.defineProperty(exports, "DocxCommentActivity", {
|
|
76
90
|
enumerable: true,
|
|
77
|
-
get: function () { return
|
|
91
|
+
get: function () { return chunkE2AAIMXO_cjs.DocxCommentActivity; }
|
|
78
92
|
});
|
|
79
93
|
Object.defineProperty(exports, "DocxEditorReview", {
|
|
80
94
|
enumerable: true,
|
|
81
|
-
get: function () { return
|
|
95
|
+
get: function () { return chunkE2AAIMXO_cjs.DocxEditorReview; }
|
|
82
96
|
});
|
|
83
97
|
Object.defineProperty(exports, "DocxMentions", {
|
|
84
98
|
enumerable: true,
|
|
85
|
-
get: function () { return
|
|
99
|
+
get: function () { return chunkE2AAIMXO_cjs.DocxMentions; }
|
|
86
100
|
});
|
|
87
101
|
Object.defineProperty(exports, "DocxParticipants", {
|
|
88
102
|
enumerable: true,
|
|
89
|
-
get: function () { return
|
|
103
|
+
get: function () { return chunkE2AAIMXO_cjs.DocxParticipants; }
|
|
90
104
|
});
|
|
91
105
|
Object.defineProperty(exports, "DocxRibbon", {
|
|
92
106
|
enumerable: true,
|
|
93
|
-
get: function () { return
|
|
107
|
+
get: function () { return chunkE2AAIMXO_cjs.DocxRibbon; }
|
|
94
108
|
});
|
|
95
109
|
Object.defineProperty(exports, "NativeDocxEditor", {
|
|
96
110
|
enumerable: true,
|
|
97
|
-
get: function () { return
|
|
111
|
+
get: function () { return chunkE2AAIMXO_cjs.NativeDocxEditor; }
|
|
112
|
+
});
|
|
113
|
+
Object.defineProperty(exports, "editorPort", {
|
|
114
|
+
enumerable: true,
|
|
115
|
+
get: function () { return chunkE2AAIMXO_cjs.editorPort; }
|
|
116
|
+
});
|
|
117
|
+
Object.defineProperty(exports, "findDefinitionsSection", {
|
|
118
|
+
enumerable: true,
|
|
119
|
+
get: function () { return chunkE2AAIMXO_cjs.findDefinitionsSection; }
|
|
120
|
+
});
|
|
121
|
+
Object.defineProperty(exports, "insertDefinedTerm", {
|
|
122
|
+
enumerable: true,
|
|
123
|
+
get: function () { return chunkE2AAIMXO_cjs.insertDefinedTerm; }
|
|
98
124
|
});
|
|
99
125
|
Object.defineProperty(exports, "loadDocxFonts", {
|
|
100
126
|
enumerable: true,
|
|
101
|
-
get: function () { return
|
|
127
|
+
get: function () { return chunkE2AAIMXO_cjs.loadDocxFonts; }
|
|
102
128
|
});
|
|
103
129
|
Object.defineProperty(exports, "normalizeDocxExport", {
|
|
104
130
|
enumerable: true,
|
|
105
|
-
get: function () { return
|
|
131
|
+
get: function () { return chunkE2AAIMXO_cjs.normalizeDocxExport; }
|
|
106
132
|
});
|
|
107
133
|
Object.defineProperty(exports, "reviewModule", {
|
|
108
134
|
enumerable: true,
|
|
109
|
-
get: function () { return
|
|
135
|
+
get: function () { return chunkE2AAIMXO_cjs.reviewModule; }
|
|
136
|
+
});
|
|
137
|
+
Object.defineProperty(exports, "updateDefinitions", {
|
|
138
|
+
enumerable: true,
|
|
139
|
+
get: function () { return chunkE2AAIMXO_cjs.updateDefinitions; }
|
|
140
|
+
});
|
|
141
|
+
Object.defineProperty(exports, "useDefinedTerms", {
|
|
142
|
+
enumerable: true,
|
|
143
|
+
get: function () { return chunkE2AAIMXO_cjs.useDefinedTerms; }
|
|
110
144
|
});
|
|
111
145
|
Object.defineProperty(exports, "useReview", {
|
|
112
146
|
enumerable: true,
|
|
113
|
-
get: function () { return
|
|
147
|
+
get: function () { return chunkE2AAIMXO_cjs.useReview; }
|
|
114
148
|
});
|
|
115
149
|
Object.defineProperty(exports, "useReviewItem", {
|
|
116
150
|
enumerable: true,
|
|
117
|
-
get: function () { return
|
|
151
|
+
get: function () { return chunkE2AAIMXO_cjs.useReviewItem; }
|
|
152
|
+
});
|
|
153
|
+
Object.defineProperty(exports, "withDirectEditing", {
|
|
154
|
+
enumerable: true,
|
|
155
|
+
get: function () { return chunkE2AAIMXO_cjs.withDirectEditing; }
|
|
118
156
|
});
|
|
119
157
|
Object.defineProperty(exports, "DocxEditor", {
|
|
120
158
|
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":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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
|
@@ -9,3 +9,6 @@ export { loadDocxFonts } from './fonts';
|
|
|
9
9
|
export { normalizeDocxExport } from './export';
|
|
10
10
|
export { StreamedWordArtifact, type StreamedWordArtifactProps } from './StreamedWordArtifact';
|
|
11
11
|
export { NativeDocxComparison, type NativeDocxComparisonProps } from './NativeDocxComparison';
|
|
12
|
+
export { DefinedTermsProvider, useDefinedTerms, DEFINED_TERM_TRIGGER, DEFAULT_DEFINED_TERMS_LABELS, type DefinedTermsProviderProps, type DefinedTermsLabels, } from './definitions/DefinedTerms';
|
|
13
|
+
export { insertDefinedTerm, updateDefinitions, findDefinitionsSection, type UpdateDefinitionsResult, } from './definitions/commands';
|
|
14
|
+
export { editorPort, withDirectEditing, type DefinitionsPort } from './definitions/port';
|
package/dist/docx/index.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
export { StreamedWordArtifact } from '../chunk-
|
|
3
|
-
import { NativeDocxEditor } from '../chunk-
|
|
4
|
-
export { DocxCommentActivity, DocxEditorReview, DocxMentions, DocxParticipants, DocxRibbon, NativeDocxEditor, loadDocxFonts, normalizeDocxExport, reviewModule, useReview, useReviewItem } from '../chunk-
|
|
2
|
+
export { StreamedWordArtifact } from '../chunk-YPKSLTL5.js';
|
|
3
|
+
import { NativeDocxEditor } from '../chunk-WXLKMEMB.js';
|
|
4
|
+
export { DEFAULT_DEFINED_TERMS_LABELS, DEFINED_TERM_TRIGGER, DefinedTermsProvider, DocxCommentActivity, DocxEditorReview, DocxMentions, DocxParticipants, DocxRibbon, NativeDocxEditor, editorPort, findDefinitionsSection, insertDefinedTerm, loadDocxFonts, normalizeDocxExport, reviewModule, updateDefinitions, useDefinedTerms, useReview, useReviewItem, withDirectEditing } from '../chunk-WXLKMEMB.js';
|
|
5
|
+
import '../chunk-D3QPYKZG.js';
|
|
6
|
+
import '../chunk-AF6RDAJF.js';
|
|
5
7
|
import '../chunk-AA3PT6KR.js';
|
|
6
8
|
import '../chunk-7F6CBP3Z.js';
|
|
7
9
|
import '../chunk-VUNV25KB.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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AM;AAAA,QAAC,CAAC,CAAA;AAAA,MACxF;AAAA,IACF,CAAC,CAAA,CACA,KAAA,CAAM,CAACA,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,uBACE,IAAA,CAAC,KAAA,EAAA,EAAI,SAAA,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"]}
|
package/dist/facts/index.cjs
CHANGED
|
@@ -12,6 +12,7 @@ require('../chunk-C54XEN5T.cjs');
|
|
|
12
12
|
var chunkKDG6FER6_cjs = require('../chunk-KDG6FER6.cjs');
|
|
13
13
|
var chunkIXALYQT7_cjs = require('../chunk-IXALYQT7.cjs');
|
|
14
14
|
require('../chunk-FX3K6LNZ.cjs');
|
|
15
|
+
var chunkRC25WMVB_cjs = require('../chunk-RC25WMVB.cjs');
|
|
15
16
|
var chunkMHVNT4J3_cjs = require('../chunk-MHVNT4J3.cjs');
|
|
16
17
|
require('../chunk-DES3K4SD.cjs');
|
|
17
18
|
var lucideReact = require('lucide-react');
|
|
@@ -19,15 +20,6 @@ var ui = require('@arbidocs/react/ui');
|
|
|
19
20
|
var jsxRuntime = require('react/jsx-runtime');
|
|
20
21
|
var react = require('react');
|
|
21
22
|
|
|
22
|
-
// src/facts/fact-text.ts
|
|
23
|
-
var WHITESPACE_CODE_POINTS = /* @__PURE__ */ new Set([32, 9, 160]);
|
|
24
|
-
function decodeWhitespaceEntities(text) {
|
|
25
|
-
if (!text) return "";
|
|
26
|
-
return text.replace(/&#x([0-9a-f]+);|&#(\d+);/gi, (match, hex, dec) => {
|
|
27
|
-
const code = hex ? parseInt(hex, 16) : parseInt(dec, 10);
|
|
28
|
-
return WHITESPACE_CODE_POINTS.has(code) ? String.fromCodePoint(code) : match;
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
23
|
var DEFAULT_FACT_COLUMN_LABELS = {
|
|
32
24
|
inChatHeaderTooltip: "Facts added to this chat are always in context for this chat",
|
|
33
25
|
inChatTitle: "In this chat \u2014 always in context for it. Click to remove from chat.",
|
|
@@ -144,7 +136,7 @@ function createFactColumns(slots) {
|
|
|
144
136
|
filter: "agTextColumnFilter",
|
|
145
137
|
// Decode the editor's whitespace entities (` ` for a trailing space) so the tooltip
|
|
146
138
|
// reads as typed, not as raw markdown references.
|
|
147
|
-
tooltipValueGetter: (p) => decodeWhitespaceEntities(p.data?.text),
|
|
139
|
+
tooltipValueGetter: (p) => chunkRC25WMVB_cjs.decodeWhitespaceEntities(p.data?.text),
|
|
148
140
|
// Editable only via the grid api (Rename in the row's menu); clicks never open the editor
|
|
149
141
|
// (suppressClickEdit on the grid).
|
|
150
142
|
editable: true,
|
|
@@ -173,7 +165,7 @@ function createFactColumns(slots) {
|
|
|
173
165
|
"data-testid": chunkMHVNT4J3_cjs.testIdOr(ids?.text?.(fact.external_id), {
|
|
174
166
|
testId: `facts-grid-text-${fact.external_id}`
|
|
175
167
|
}),
|
|
176
|
-
children: decodeWhitespaceEntities(fact.text)
|
|
168
|
+
children: chunkRC25WMVB_cjs.decodeWhitespaceEntities(fact.text)
|
|
177
169
|
}
|
|
178
170
|
),
|
|
179
171
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "facts-row-kebab absolute right-0.5 top-1/2 -translate-y-1/2", children: slots.renderRowActions(fact, params) })
|
|
@@ -2272,6 +2264,10 @@ Object.defineProperty(exports, "FactsFilterInput", {
|
|
|
2272
2264
|
enumerable: true,
|
|
2273
2265
|
get: function () { return chunk2EI7NCUA_cjs.FilterInput; }
|
|
2274
2266
|
});
|
|
2267
|
+
Object.defineProperty(exports, "decodeWhitespaceEntities", {
|
|
2268
|
+
enumerable: true,
|
|
2269
|
+
get: function () { return chunkRC25WMVB_cjs.decodeWhitespaceEntities; }
|
|
2270
|
+
});
|
|
2275
2271
|
exports.DEFAULT_FACTS_BULK_BAR_LABELS = DEFAULT_FACTS_BULK_BAR_LABELS;
|
|
2276
2272
|
exports.DEFAULT_FACTS_EMPTY_STATE_LABELS = DEFAULT_FACTS_EMPTY_STATE_LABELS;
|
|
2277
2273
|
exports.DEFAULT_FACTS_FIELDS_BUTTON_LABELS = DEFAULT_FACTS_FIELDS_BUTTON_LABELS;
|
|
@@ -2316,7 +2312,6 @@ exports.FactsToolbar = FactsToolbar;
|
|
|
2316
2312
|
exports.FactsViewToggle = FactsViewToggle;
|
|
2317
2313
|
exports.ISO_DATE_FILTER_PARAMS = ISO_DATE_FILTER_PARAMS;
|
|
2318
2314
|
exports.createFactColumns = createFactColumns;
|
|
2319
|
-
exports.decodeWhitespaceEntities = decodeWhitespaceEntities;
|
|
2320
2315
|
exports.detectTimezone = detectTimezone;
|
|
2321
2316
|
exports.factDateFieldsToSpan = factDateFieldsToSpan;
|
|
2322
2317
|
exports.factDateSpanToFields = factDateSpanToFields;
|