myrole-docx-editor 0.1.2 → 0.1.3

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 (35) hide show
  1. package/README.md +81 -8
  2. package/dist/chunks/sdk-BKmEus_j.js +29652 -0
  3. package/dist/chunks/sdk-BKmEus_j.js.map +1 -0
  4. package/dist/chunks/{vars-blockly-C-0oL-Mc.js → vars-blockly-DMblR7c7.js} +2 -2
  5. package/dist/chunks/{vars-blockly-C-0oL-Mc.js.map → vars-blockly-DMblR7c7.js.map} +1 -1
  6. package/dist/index.js +8 -7
  7. package/dist/react.js +44 -28
  8. package/dist/react.js.map +1 -1
  9. package/dist/types/packages/docx-editor/src/chrome.d.ts +11 -0
  10. package/dist/types/packages/docx-editor/src/commands.d.ts +8 -1
  11. package/dist/types/packages/docx-editor/src/drafts.d.ts +7 -0
  12. package/dist/types/packages/docx-editor/src/editor.d.ts +17 -3
  13. package/dist/types/packages/docx-editor/src/feedback.d.ts +73 -0
  14. package/dist/types/packages/docx-editor/src/index.d.ts +5 -0
  15. package/dist/types/packages/docx-editor/src/inspector-ui.d.ts +2 -2
  16. package/dist/types/packages/docx-editor/src/react.d.ts +2 -0
  17. package/dist/types/packages/docx-editor/src/ruler.d.ts +1 -0
  18. package/dist/types/packages/docx-editor/src/sdk.d.ts +37 -8
  19. package/dist/types/packages/docx-editor/src/ui/context-menu.d.ts +4 -0
  20. package/dist/types/packages/docx-editor/src/ui/panels.d.ts +13 -0
  21. package/dist/types/packages/docx-editor/src/ui/popover.d.ts +4 -0
  22. package/dist/types/packages/docx-editor/src/ui/shell.d.ts +10 -1
  23. package/dist/types/packages/docx-editor/src/variables.d.ts +7 -0
  24. package/dist/types/packages/docx-editor/src/vars-complete.d.ts +4 -1
  25. package/dist/types/packages/docx-editor/src/vars-library.d.ts +2 -2
  26. package/dist/types/packages/docx-editor/src/vars-panel.d.ts +4 -0
  27. package/dist/types/packages/docx-model/src/editor.d.ts +21 -1
  28. package/dist/types/packages/docx-model/src/layout.d.ts +9 -0
  29. package/dist/types/packages/docx-model/src/textbox.d.ts +2 -0
  30. package/dist/types/packages/docx-render/src/hyphenation.d.ts +9 -0
  31. package/dist/types/packages/docx-render/src/text.d.ts +7 -0
  32. package/dist/types/packages/docx-render/src/types.d.ts +3 -0
  33. package/package.json +4 -4
  34. package/dist/chunks/sdk-CxT1eC2o.js +0 -16294
  35. package/dist/chunks/sdk-CxT1eC2o.js.map +0 -1
@@ -1,4 +1,5 @@
1
1
  import { type Tag } from '../../docx-tags/src/index';
2
+ import { type LibraryExtras } from './vars-library';
2
3
  /**
3
4
  * Le panneau des variables : lire un tag, l'éditer, en poser un nouveau.
4
5
  *
@@ -20,6 +21,8 @@ import { type Tag } from '../../docx-tags/src/index';
20
21
  * relit. Basculer d'un mode à l'autre ne perd rien.
21
22
  */
22
23
  export interface VarsPanelHost {
24
+ library?: LibraryExtras;
25
+ readOnly?(): boolean;
23
26
  /** Remplace la plage d'un tag par ce texte, à travers l'éditeur. */
24
27
  apply(tag: Tag, text: string): void;
25
28
  /** Pose ce texte au curseur. */
@@ -34,5 +37,6 @@ export interface VarsPanel {
34
37
  library(): void;
35
38
  current(): Tag | null;
36
39
  open(): boolean;
40
+ destroy(): void;
37
41
  }
38
42
  export declare function mountVarsPanel(root: HTMLElement, host: VarsPanelHost): VarsPanel;
@@ -166,8 +166,15 @@ export interface ParaPatch {
166
166
  spaceBeforePt?: number | null;
167
167
  spaceAfterPt?: number | null;
168
168
  styleId?: string | null;
169
+ lineHeight?: number | null;
170
+ keepNext?: boolean | null;
171
+ keepLines?: boolean | null;
172
+ widowControl?: boolean | null;
173
+ pageBreakBefore?: boolean | null;
174
+ numId?: number | null;
175
+ listLevel?: number;
169
176
  }
170
- /** Applique une mise en forme au paragraphe entier. */
177
+ /** Applique une mise en forme au paragraphe entier. Un style explicite remplace les surcharges dominantes. */
171
178
  export declare function formatParagraph(doc: DocxDocument, para: number, patch: ParaPatch, part?: string): boolean;
172
179
  /** Marges d'une section, en points. Chaque champ omis reste inchangé. */
173
180
  export interface MarginPatch {
@@ -277,3 +284,16 @@ export declare function wordAt(text: string, off: number, locale?: string): {
277
284
  from: number;
278
285
  to: number;
279
286
  };
287
+ /** A selection's original XML, including paragraph/run properties and inline containers. */
288
+ export declare function copyFragment(doc: DocxDocument, a: DocPos, b: DocPos): XmlNode[];
289
+ export declare function insertFragment(doc: DocxDocument, at: DocPos, fragment: XmlNode[]): DocPos | null;
290
+ export interface CellPatch {
291
+ fill?: string;
292
+ align?: 'top' | 'center' | 'bottom';
293
+ marginPt?: number;
294
+ borderPt?: number;
295
+ borderColor?: string;
296
+ }
297
+ export declare function formatCell(doc: DocxDocument, para: number, patch: CellPatch): boolean;
298
+ /** Merge with the next cell without dropping its paragraphs. Vertical merges are protected. */
299
+ export declare function mergeNextCell(doc: DocxDocument, para: number): boolean;
@@ -7,6 +7,11 @@ import { type DocxDocument } from './index';
7
7
  * passe par la cascade de styles (styles.ts) avant lecture.
8
8
  */
9
9
  export interface ParagraphStyle {
10
+ hyphenation?: {
11
+ zonePt: number;
12
+ consecutiveLimit: number;
13
+ capitals: boolean;
14
+ };
10
15
  /** identifiant de style Word, ex. `Titre1` */
11
16
  styleId?: string;
12
17
  /** niveau de titre déduit du style, 1..6 */
@@ -210,6 +215,10 @@ export interface RunStyle {
210
215
  bold?: boolean;
211
216
  italic?: boolean;
212
217
  underline?: boolean;
218
+ underlineStyle?: string;
219
+ underlineColor?: string;
220
+ shadingFill?: string;
221
+ language?: string;
213
222
  strike?: boolean;
214
223
  dstrike?: boolean;
215
224
  /** taille en points */
@@ -58,8 +58,10 @@ export interface TextBoxInfo {
58
58
  */
59
59
  export interface ShapeAppearance {
60
60
  fillColor?: string;
61
+ fillOpacity?: number;
61
62
  outline?: {
62
63
  color: string;
64
+ opacity?: number;
63
65
  widthPt: number;
64
66
  dash: string;
65
67
  };
@@ -0,0 +1,9 @@
1
+ import { type Tok } from './text';
2
+ /** Split a whole word, including its run boundaries, without editing the model.
3
+ * ponytail: French and English dictionaries cover the current corpus; other
4
+ * languages stay unhyphenated until their dictionary and Word probe are added.
5
+ */
6
+ export declare function hyphenatedUnit(ctx: CanvasRenderingContext2D, unit: Tok[], room: number, capitals: boolean): {
7
+ head: Tok[];
8
+ tail: Tok[];
9
+ } | undefined;
@@ -65,6 +65,13 @@ export interface Tok {
65
65
  underline: boolean;
66
66
  strike: boolean;
67
67
  highlight?: string;
68
+ underlineStyle?: string;
69
+ underlineColor?: string;
70
+ shadingFill?: string;
71
+ dstrike?: boolean;
72
+ language?: string;
73
+ /** A displayed discretionary hyphen consumes no model character. */
74
+ autoHyphen?: boolean;
68
75
  /**
69
76
  * Corps qui décide de la boîte de ligne, avant la réduction visuelle d'un
70
77
  * exposant ou d'un indice. Word réduit le glyphe à 65 %, mais réserve les
@@ -443,6 +443,7 @@ export interface LineTrace {
443
443
  text: string;
444
444
  off?: number;
445
445
  font?: string;
446
+ logicalLength?: number;
446
447
  }>;
447
448
  }
448
449
  /**
@@ -506,8 +507,10 @@ export interface PlacedTextBox {
506
507
  /** Fond et contour explicites de la forme rectangulaire porteuse. */
507
508
  appearance?: {
508
509
  fillColor?: string;
510
+ fillOpacity?: number;
509
511
  outline?: {
510
512
  color: string;
513
+ opacity?: number;
511
514
  widthPt: number;
512
515
  dash: string;
513
516
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "myrole-docx-editor",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "Word-faithful .docx editor and renderer on canvas — the MyRole engine as an embeddable SDK, with a React component.",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",
@@ -45,11 +45,11 @@
45
45
  "react": "^19.2.8",
46
46
  "react-dom": "^19.2.8",
47
47
  "vite": "^6.4.3",
48
- "@myrole/docx-vars": "0.0.0",
48
+ "@myrole/docx-model": "0.0.0",
49
+ "@myrole/docx-tags": "0.0.0",
49
50
  "@myrole/fonts": "0.1.0",
50
51
  "@myrole/docx-render": "0.0.0",
51
- "@myrole/docx-model": "0.0.0",
52
- "@myrole/docx-tags": "0.0.0"
52
+ "@myrole/docx-vars": "0.0.0"
53
53
  },
54
54
  "publishConfig": {
55
55
  "access": "public"