@arbidocs/blocks 0.4.98 → 0.4.100

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.
Files changed (58) hide show
  1. package/dist/agents/index.cjs +207 -207
  2. package/dist/agents/index.js +2 -2
  3. package/dist/{chunk-LZ5AFAWC.js → chunk-6HZNFOHW.js} +3 -3
  4. package/dist/{chunk-LZ5AFAWC.js.map → chunk-6HZNFOHW.js.map} +1 -1
  5. package/dist/{chunk-FIEAWH4K.js → chunk-72PQ42YI.js} +1040 -88
  6. package/dist/chunk-72PQ42YI.js.map +1 -0
  7. package/dist/{chunk-MIMVRMKC.cjs → chunk-B7P73VHX.cjs} +1040 -83
  8. package/dist/chunk-B7P73VHX.cjs.map +1 -0
  9. package/dist/{chunk-6B2AWE3I.js → chunk-E2QWWLK5.js} +3 -3
  10. package/dist/{chunk-6B2AWE3I.js.map → chunk-E2QWWLK5.js.map} +1 -1
  11. package/dist/{chunk-MUYZP5FB.cjs → chunk-IE55TWIG.cjs} +5 -5
  12. package/dist/{chunk-MUYZP5FB.cjs.map → chunk-IE55TWIG.cjs.map} +1 -1
  13. package/dist/{chunk-5NQIBJPP.js → chunk-NJX774HB.js} +3 -3
  14. package/dist/{chunk-5NQIBJPP.js.map → chunk-NJX774HB.js.map} +1 -1
  15. package/dist/{chunk-DDYXFALG.cjs → chunk-NW3LFDZL.cjs} +3 -3
  16. package/dist/{chunk-DDYXFALG.cjs.map → chunk-NW3LFDZL.cjs.map} +1 -1
  17. package/dist/{chunk-VJO66VVF.cjs → chunk-O24WPHLD.cjs} +5 -5
  18. package/dist/{chunk-VJO66VVF.cjs.map → chunk-O24WPHLD.cjs.map} +1 -1
  19. package/dist/connect/docx.cjs +6 -6
  20. package/dist/connect/docx.js +4 -4
  21. package/dist/connect/index.cjs +3 -3
  22. package/dist/connect/index.js +2 -2
  23. package/dist/docx/NativeDocxEditor.d.ts +6 -1
  24. package/dist/docx/definitions/fragment.d.ts +3 -1
  25. package/dist/docx/definitions/port.d.ts +6 -2
  26. package/dist/docx/index.cjs +51 -31
  27. package/dist/docx/index.d.ts +3 -0
  28. package/dist/docx/index.js +3 -3
  29. package/dist/docx/layout/GenerateImage.d.ts +50 -0
  30. package/dist/docx/layout/LayoutRibbon.d.ts +32 -0
  31. package/dist/docx/layout/LayoutTabs.d.ts +20 -0
  32. package/dist/docx/layout/PictureRibbon.d.ts +23 -0
  33. package/dist/docx/layout/TableKeys.d.ts +25 -0
  34. package/dist/docx/layout/TableRibbon.d.ts +11 -0
  35. package/dist/docx/layout/caption.d.ts +38 -0
  36. package/dist/docx/layout/presets.d.ts +40 -0
  37. package/dist/docx/structural/trackedOrNoted.d.ts +51 -0
  38. package/dist/docx/structural/useTrackedOrNoted.d.ts +5 -0
  39. package/dist/facts/index.cjs +1 -1
  40. package/dist/facts/index.js +1 -1
  41. package/dist/files/index.cjs +1 -1
  42. package/dist/files/index.js +1 -1
  43. package/dist/home/index.cjs +1 -1
  44. package/dist/home/index.js +1 -1
  45. package/dist/index.cjs +253 -253
  46. package/dist/index.js +3 -3
  47. package/dist/shell/index.cjs +1 -1
  48. package/dist/shell/index.js +1 -1
  49. package/dist/studio/index.cjs +1 -1
  50. package/dist/studio/index.js +1 -1
  51. package/dist/workflow-canvas/index.cjs +9 -9
  52. package/dist/workflow-canvas/index.js +2 -2
  53. package/package.json +5 -4
  54. package/src/docx/README.md +22 -0
  55. package/src/docx/layout/layout.css +120 -0
  56. package/src/docx/styles.css +2 -0
  57. package/dist/chunk-FIEAWH4K.js.map +0 -1
  58. package/dist/chunk-MIMVRMKC.cjs.map +0 -1
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Word's Insert Caption: a paragraph in the `Caption` style reading `Figure 1: text`, whose
3
+ * number is a `SEQ Figure` field so Word renumbers every caption when fields update.
4
+ *
5
+ * The engine has no caption command, but its paste lands an embedded `.docx` fragment intact —
6
+ * the `w:fldSimple` and the paragraph style, whose definition is merged into the document when
7
+ * the document has none. The number written as the field's result is the next one in reading
8
+ * order at insertion; the engine paints a SEQ field's stored result rather than recomputing it.
9
+ */
10
+ import { type Revision } from '@arbidocs/coedit/template';
11
+ export declare const CAPTION_LABELS: readonly ["Figure", "Table", "Equation"];
12
+ export type CaptionLabel = (typeof CAPTION_LABELS)[number];
13
+ type Node = {
14
+ id?: string;
15
+ localName?: string;
16
+ kind?: string;
17
+ value?: string;
18
+ attributes?: readonly {
19
+ localName: string;
20
+ value: string;
21
+ }[];
22
+ children?: readonly Node[];
23
+ };
24
+ /** The `SEQ` identifier of a field instruction (`SEQ Figure \* ARABIC` -> `Figure`). */
25
+ export declare function seqIdentifier(instruction: string): string | null;
26
+ /**
27
+ * How many `SEQ <label>` fields the tree holds — simple fields and complex `w:instrText` ones — in
28
+ * reading order up to and including the paragraph `throughId` (all of them when absent).
29
+ */
30
+ export declare function countSeqFields(root: Node, label: string, throughId?: string): number;
31
+ /** The caption paragraph: `Label N` with N a SEQ field, then `: text` when there is text. */
32
+ export declare function captionParagraphXml(label: string, number: number, text: string): string;
33
+ /**
34
+ * Clipboard HTML that pastes the caption as a whole paragraph (the editor's own fragment form),
35
+ * marked as a tracked insertion by `revision` when one is given.
36
+ */
37
+ export declare function captionFragmentHtml(label: string, number: number, text: string, revision?: Revision | null): string;
38
+ export {};
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Word's Layout presets — Margins, Size and Orientation — as page-setup updates in twips, the
3
+ * unit `w:pgSz`/`w:pgMar` and the engine's `setPageSetup` use. Pure, so the ribbon's choices and
4
+ * the preset a section already matches are tested without an editor.
5
+ */
6
+ import type { PageSetup } from '@docx-editor.dev/react';
7
+ export declare const TWIPS_PER_INCH = 1440;
8
+ export interface MarginPreset {
9
+ id: string;
10
+ label: string;
11
+ /** Twips. */
12
+ top: number;
13
+ right: number;
14
+ bottom: number;
15
+ left: number;
16
+ }
17
+ /** Word's Margins gallery (Mirrored is a binding option the engine does not write). */
18
+ export declare const MARGIN_PRESETS: readonly MarginPreset[];
19
+ export interface PaperSize {
20
+ id: string;
21
+ label: string;
22
+ /** Portrait width and height, in twips. */
23
+ width: number;
24
+ height: number;
25
+ }
26
+ /** Word's Size gallery: the paper sizes people actually pick. */
27
+ export declare const PAPER_SIZES: readonly PaperSize[];
28
+ /** The margin preset the section matches, if any (the gallery marks it as current). */
29
+ export declare function matchMargins(setup: PageSetup | null): string | null;
30
+ /** The paper size the section matches in either orientation, if any. */
31
+ export declare function matchPaper(setup: PageSetup | null): string | null;
32
+ /** A paper size's dimensions laid the way the section is turned, so picking a size keeps it. */
33
+ export declare function orientedSize(paper: PaperSize, orientation: PageSetup['orientation'] | undefined): {
34
+ pageWidthTwips: number;
35
+ pageHeightTwips: number;
36
+ };
37
+ /** `1440` -> `1"`, `1080` -> `0.75"`: how the gallery describes a margin. */
38
+ export declare function inches(twips: number): string;
39
+ /** `Letter` -> `8.5" × 11"`. */
40
+ export declare function paperDescription(paper: PaperSize): string;
@@ -0,0 +1,51 @@
1
+ /**
2
+ * Structural inserts (a defined term, a cross-reference, a Quick Part…) in Suggesting mode.
3
+ *
4
+ * The engine pastes rich fragments only with direct editing, so a suggesting editor switches for
5
+ * the paste and back. Done naively the insert then lands untracked. The rule here:
6
+ * - not suggesting: insert as before;
7
+ * - suggesting: insert the fragment as a tracked insertion (`insert` receives the revision to
8
+ * mark it with, see `trackInsertion` in `@arbidocs/coedit/template`), so it shows in the
9
+ * review pane and accept/reject takes all of it;
10
+ * - if no tracked change by that revision came out of it, attach an attributed comment to the
11
+ * inserted range instead ("Inserted defined term: Shares"), so the insert is still reviewable.
12
+ *
13
+ * Written against a small port, not the React editor, so the collaboration service's headless
14
+ * path can apply the same rule.
15
+ */
16
+ import type { DocxEditorInstance } from '@docx-editor.dev/core';
17
+ import type { Revision } from '@arbidocs/coedit/template';
18
+ import type { DocPoint } from '../definitions/port';
19
+ export type { Revision };
20
+ export type EditingMode = 'editing' | 'suggesting' | 'viewing';
21
+ /** What the rule needs from an editor. */
22
+ export interface StructuralPort {
23
+ mode(): EditingMode;
24
+ setMode(mode: EditingMode): void;
25
+ caret(): DocPoint | null;
26
+ /** How many tracked changes in the document carry exactly this author and date. */
27
+ trackedBy(revision: Revision): number;
28
+ /** Comment on the range between two points as the editor's author; false when refused. */
29
+ comment(from: DocPoint, to: DocPoint, text: string): boolean;
30
+ }
31
+ export interface StructuralInsert<T> {
32
+ /** What the comment says when the insert could not be tracked: "Inserted Quick Part: Execution". */
33
+ label: string;
34
+ /** The author tracked changes are attributed to. */
35
+ author: string;
36
+ /** Do the insert, marking it with `revision` when one is given. */
37
+ insert: (revision: Revision | null) => T;
38
+ /** Whether `insert`'s result means something was inserted (default: truthy). */
39
+ inserted?: (result: T) => boolean;
40
+ }
41
+ export interface StructuralOutcome<T> {
42
+ result: T;
43
+ /** `direct`: not suggesting; `tracked`: a suggestion; `noted`: inserted with a comment on it. */
44
+ how: 'direct' | 'tracked' | 'noted';
45
+ }
46
+ /** `w:date` as Word writes it: UTC, to the second. */
47
+ export declare const revisionDate: (at?: Date) => string;
48
+ /** Insert a structural fragment so that, while suggesting, it is reviewable. Throws when read only. */
49
+ export declare function trackedOrNoted<T>(port: StructuralPort, { label, author, insert, inserted }: StructuralInsert<T>): StructuralOutcome<T>;
50
+ /** The port over a live editor. */
51
+ export declare function structuralPort(editor: DocxEditorInstance): StructuralPort;
@@ -0,0 +1,5 @@
1
+ import { type StructuralInsert, type StructuralOutcome } from './trackedOrNoted';
2
+ /** The name the editor attributes changes to (`DocxEditor.Root`'s `author`), for the ribbon's inserts. */
3
+ export declare const DocxAuthorContext: import("react").Context<string>;
4
+ /** `trackedOrNoted` bound to the editor in context and its author; undefined before it is ready. */
5
+ export declare function useTrackedOrNoted(): <T>(spec: Omit<StructuralInsert<T>, "author">) => StructuralOutcome<T> | undefined;
@@ -8,8 +8,8 @@ var chunkRC25WMVB_cjs = require('../chunk-RC25WMVB.cjs');
8
8
  var chunk7RGLTF76_cjs = require('../chunk-7RGLTF76.cjs');
9
9
  var chunkV4ISCZJ7_cjs = require('../chunk-V4ISCZJ7.cjs');
10
10
  var chunk2EI7NCUA_cjs = require('../chunk-2EI7NCUA.cjs');
11
- var chunkPPCATBOY_cjs = require('../chunk-PPCATBOY.cjs');
12
11
  require('../chunk-C54XEN5T.cjs');
12
+ var chunkPPCATBOY_cjs = require('../chunk-PPCATBOY.cjs');
13
13
  var chunkKDG6FER6_cjs = require('../chunk-KDG6FER6.cjs');
14
14
  var chunkIXALYQT7_cjs = require('../chunk-IXALYQT7.cjs');
15
15
  require('../chunk-FX3K6LNZ.cjs');
@@ -8,8 +8,8 @@ import { TabHeader } from '../chunk-4WWM3GQ5.js';
8
8
  import { SelectionBar, SelectionBarAction } from '../chunk-NUNKSZKU.js';
9
9
  import { FilterInput } from '../chunk-YU2KUMGE.js';
10
10
  export { DEFAULT_FILTER_INPUT_LABELS as DEFAULT_FACTS_FILTER_INPUT_LABELS, DEFAULT_FILTER_FIELDS as FACTS_SEARCH_FIELD_OPTIONS, FilterInput as FactsFilterInput } from '../chunk-YU2KUMGE.js';
11
- import { observeResize } from '../chunk-NPLYHR2E.js';
12
11
  import '../chunk-76JDDMSP.js';
12
+ import { observeResize } from '../chunk-NPLYHR2E.js';
13
13
  import { initials } from '../chunk-OXF2IFXG.js';
14
14
  import { GridView } from '../chunk-ZPLG7QYF.js';
15
15
  import '../chunk-SLSBJRWW.js';
@@ -12,8 +12,8 @@ var chunk32HW2Q33_cjs = require('../chunk-32HW2Q33.cjs');
12
12
  var chunkV4ISCZJ7_cjs = require('../chunk-V4ISCZJ7.cjs');
13
13
  var chunk2EI7NCUA_cjs = require('../chunk-2EI7NCUA.cjs');
14
14
  var chunkOB5F4577_cjs = require('../chunk-OB5F4577.cjs');
15
- require('../chunk-PPCATBOY.cjs');
16
15
  require('../chunk-C54XEN5T.cjs');
16
+ require('../chunk-PPCATBOY.cjs');
17
17
  var chunkKDG6FER6_cjs = require('../chunk-KDG6FER6.cjs');
18
18
  var chunkVLCY46K6_cjs = require('../chunk-VLCY46K6.cjs');
19
19
  var chunkULWRNGGE_cjs = require('../chunk-ULWRNGGE.cjs');
@@ -12,8 +12,8 @@ import { SelectionBar, SelectionBarAction } from '../chunk-NUNKSZKU.js';
12
12
  export { DEFAULT_SELECTION_BAR_LABELS, SelectionBar, SelectionBarAction } from '../chunk-NUNKSZKU.js';
13
13
  import { FilterInput } from '../chunk-YU2KUMGE.js';
14
14
  import { ActionLink } from '../chunk-S7PSMMRG.js';
15
- import '../chunk-NPLYHR2E.js';
16
15
  import '../chunk-76JDDMSP.js';
16
+ import '../chunk-NPLYHR2E.js';
17
17
  import { formatCount } from '../chunk-OXF2IFXG.js';
18
18
  import { ShareControl } from '../chunk-K4BGOPGG.js';
19
19
  import { ModalSection, ModalSectionTitle, ModalHeader } from '../chunk-TX2ZICS7.js';
@@ -6,8 +6,8 @@ var chunkPCB2BPN3_cjs = require('../chunk-PCB2BPN3.cjs');
6
6
  var chunkZ5VUZ6YD_cjs = require('../chunk-Z5VUZ6YD.cjs');
7
7
  var chunk7D737FLE_cjs = require('../chunk-7D737FLE.cjs');
8
8
  var chunkOB5F4577_cjs = require('../chunk-OB5F4577.cjs');
9
- require('../chunk-PPCATBOY.cjs');
10
9
  require('../chunk-C54XEN5T.cjs');
10
+ require('../chunk-PPCATBOY.cjs');
11
11
  require('../chunk-KDG6FER6.cjs');
12
12
  var chunkMHVNT4J3_cjs = require('../chunk-MHVNT4J3.cjs');
13
13
  require('../chunk-DES3K4SD.cjs');
@@ -5,8 +5,8 @@ import { SectionHeader, EmptyStrip, QuickActionDialogHeader } from '../chunk-DDF
5
5
  export { AddFilesFirst, DEFAULT_ADD_FILES_FIRST_LABELS, DEFAULT_SCOPE_PICKER_LABELS, EmptyStrip, QuickActionDialogHeader, ScopePicker, SectionHeader, SectionLabel, StartTiles, useScopeSelection } from '../chunk-DDF5GPIJ.js';
6
6
  export { FoldSection } from '../chunk-XD2M6LIG.js';
7
7
  import { ActionLink } from '../chunk-S7PSMMRG.js';
8
- import '../chunk-NPLYHR2E.js';
9
8
  import '../chunk-76JDDMSP.js';
9
+ import '../chunk-NPLYHR2E.js';
10
10
  import '../chunk-OXF2IFXG.js';
11
11
  import { testIdOr, prefixedTestId } from '../chunk-7F6CBP3Z.js';
12
12
  import '../chunk-VUNV25KB.js';