myrole-docx-editor 0.1.0
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/README.md +107 -0
- package/dist/chunks/sdk-BKkeAoJT.js +15065 -0
- package/dist/chunks/sdk-BKkeAoJT.js.map +1 -0
- package/dist/chunks/vars-blockly-C-cJRHx8.js +42 -0
- package/dist/chunks/vars-blockly-C-cJRHx8.js.map +1 -0
- package/dist/index.js +53 -0
- package/dist/index.js.map +1 -0
- package/dist/react.js +36 -0
- package/dist/react.js.map +1 -0
- package/dist/types/packages/docx-editor/src/chrome.d.ts +28 -0
- package/dist/types/packages/docx-editor/src/commands.d.ts +16 -0
- package/dist/types/packages/docx-editor/src/comments.d.ts +24 -0
- package/dist/types/packages/docx-editor/src/editor.d.ts +293 -0
- package/dist/types/packages/docx-editor/src/embed.d.ts +7 -0
- package/dist/types/packages/docx-editor/src/font-manifest.d.ts +7 -0
- package/dist/types/packages/docx-editor/src/fonts.d.ts +5 -0
- package/dist/types/packages/docx-editor/src/html.d.ts +13 -0
- package/dist/types/packages/docx-editor/src/index.d.ts +20 -0
- package/dist/types/packages/docx-editor/src/inspector-ui.d.ts +6 -0
- package/dist/types/packages/docx-editor/src/inspector.d.ts +101 -0
- package/dist/types/packages/docx-editor/src/react.d.ts +24 -0
- package/dist/types/packages/docx-editor/src/ruler.d.ts +4 -0
- package/dist/types/packages/docx-editor/src/sdk.d.ts +85 -0
- package/dist/types/packages/docx-editor/src/ui/icons.d.ts +2 -0
- package/dist/types/packages/docx-editor/src/ui/shell.d.ts +57 -0
- package/dist/types/packages/docx-editor/src/variables.d.ts +68 -0
- package/dist/types/packages/docx-editor/src/vars-blockly.d.ts +9 -0
- package/dist/types/packages/docx-editor/src/vars-complete.d.ts +60 -0
- package/dist/types/packages/docx-editor/src/vars-library.d.ts +59 -0
- package/dist/types/packages/docx-editor/src/vars-panel.d.ts +38 -0
- package/dist/types/packages/docx-model/src/edit.d.ts +64 -0
- package/dist/types/packages/docx-model/src/editor.d.ts +254 -0
- package/dist/types/packages/docx-model/src/fonts.d.ts +60 -0
- package/dist/types/packages/docx-model/src/heal.d.ts +28 -0
- package/dist/types/packages/docx-model/src/index.d.ts +113 -0
- package/dist/types/packages/docx-model/src/insert.d.ts +30 -0
- package/dist/types/packages/docx-model/src/layout.d.ts +411 -0
- package/dist/types/packages/docx-model/src/numbering.d.ts +63 -0
- package/dist/types/packages/docx-model/src/paste.d.ts +51 -0
- package/dist/types/packages/docx-model/src/rels.d.ts +18 -0
- package/dist/types/packages/docx-model/src/spans.d.ts +69 -0
- package/dist/types/packages/docx-model/src/styles.d.ts +42 -0
- package/dist/types/packages/docx-model/src/tables.d.ts +196 -0
- package/dist/types/packages/docx-model/src/textbox.d.ts +61 -0
- package/dist/types/packages/docx-render/src/border.d.ts +39 -0
- package/dist/types/packages/docx-render/src/document.d.ts +55 -0
- package/dist/types/packages/docx-render/src/font-advances.d.ts +1 -0
- package/dist/types/packages/docx-render/src/hit.d.ts +94 -0
- package/dist/types/packages/docx-render/src/index.d.ts +12 -0
- package/dist/types/packages/docx-render/src/metrics.d.ts +6 -0
- package/dist/types/packages/docx-render/src/node-ctx.d.ts +36 -0
- package/dist/types/packages/docx-render/src/paragraph.d.ts +18 -0
- package/dist/types/packages/docx-render/src/parts.d.ts +40 -0
- package/dist/types/packages/docx-render/src/renderer.d.ts +251 -0
- package/dist/types/packages/docx-render/src/table.d.ts +15 -0
- package/dist/types/packages/docx-render/src/text.d.ts +396 -0
- package/dist/types/packages/docx-render/src/types.d.ts +514 -0
- package/dist/types/packages/docx-tags/src/add-comments.d.ts +2 -0
- package/dist/types/packages/docx-tags/src/comments.d.ts +19 -0
- package/dist/types/packages/docx-tags/src/grammar.d.ts +71 -0
- package/dist/types/packages/docx-tags/src/highlight.d.ts +22 -0
- package/dist/types/packages/docx-tags/src/index.d.ts +4 -0
- package/dist/types/packages/docx-tags/src/scan.d.ts +27 -0
- package/dist/types/packages/docx-vars/src/audit.d.ts +44 -0
- package/dist/types/packages/docx-vars/src/blockify.d.ts +61 -0
- package/dist/types/packages/docx-vars/src/blocks.d.ts +46 -0
- package/dist/types/packages/docx-vars/src/describe.d.ts +21 -0
- package/dist/types/packages/docx-vars/src/generate.d.ts +11 -0
- package/dist/types/packages/docx-vars/src/icons.d.ts +52 -0
- package/dist/types/packages/docx-vars/src/idioms.d.ts +36 -0
- package/dist/types/packages/docx-vars/src/index.d.ts +31 -0
- package/dist/types/packages/docx-vars/src/labels.d.ts +42 -0
- package/dist/types/packages/docx-vars/src/library.d.ts +47 -0
- package/dist/types/packages/docx-vars/src/phrase.d.ts +3 -0
- package/dist/types/packages/docx-vars/src/picker.d.ts +19 -0
- package/dist/types/packages/docx-vars/src/plugin.d.ts +126 -0
- package/dist/types/packages/docx-vars/src/plugins.d.ts +29 -0
- package/dist/types/packages/docx-vars/src/preview.d.ts +25 -0
- package/dist/types/packages/docx-vars/src/scenario.d.ts +20 -0
- package/dist/types/packages/docx-vars/src/substitute.d.ts +28 -0
- package/dist/types/packages/docx-vars/src/sync.d.ts +56 -0
- package/dist/types/packages/docx-vars/src/target-canvas.d.ts +66 -0
- package/dist/types/packages/docx-vars/src/tokens.d.ts +18 -0
- package/dist/types/packages/fonts/src/advances.d.ts +90 -0
- package/dist/types/packages/fonts/src/aliases.d.ts +27 -0
- package/dist/types/packages/fonts/src/families.d.ts +1 -0
- package/dist/types/packages/fonts/src/load.d.ts +25 -0
- package/dist/types/packages/fonts/src/metrics.d.ts +44 -0
- package/fonts/ttf/abadi-mt-condensed-extra-bold-400-normal.ttf +0 -0
- package/fonts/ttf/abadi-mt-condensed-light-400-normal.ttf +0 -0
- package/fonts/ttf/angsana-new-400-italic.ttf +0 -0
- package/fonts/ttf/angsana-new-400-normal.ttf +0 -0
- package/fonts/ttf/angsana-new-700-italic.ttf +0 -0
- package/fonts/ttf/angsana-new-700-normal.ttf +0 -0
- package/fonts/ttf/apple-color-emoji-400-normal.ttf +0 -0
- package/fonts/ttf/apple-symbols-400-normal.ttf +0 -0
- package/fonts/ttf/aptos-400-italic.ttf +0 -0
- package/fonts/ttf/aptos-400-normal.ttf +0 -0
- package/fonts/ttf/aptos-700-italic.ttf +0 -0
- package/fonts/ttf/aptos-700-normal.ttf +0 -0
- package/fonts/ttf/aptos-narrow-400-italic.ttf +0 -0
- package/fonts/ttf/aptos-narrow-400-normal.ttf +0 -0
- package/fonts/ttf/aptos-narrow-700-italic.ttf +0 -0
- package/fonts/ttf/aptos-narrow-700-normal.ttf +0 -0
- package/fonts/ttf/arial-400-italic.ttf +0 -0
- package/fonts/ttf/arial-400-normal.ttf +0 -0
- package/fonts/ttf/arial-700-italic.ttf +0 -0
- package/fonts/ttf/arial-700-normal.ttf +0 -0
- package/fonts/ttf/arial-black-700-normal.ttf +0 -0
- package/fonts/ttf/arial-hebrew-400-normal.ttf +0 -0
- package/fonts/ttf/arial-hebrew-700-normal.ttf +0 -0
- package/fonts/ttf/arial-narrow-400-italic.ttf +0 -0
- package/fonts/ttf/arial-narrow-400-normal.ttf +0 -0
- package/fonts/ttf/arial-narrow-700-italic.ttf +0 -0
- package/fonts/ttf/arial-narrow-700-normal.ttf +0 -0
- package/fonts/ttf/arial-rounded-mt-bold-400-normal.ttf +0 -0
- package/fonts/ttf/arial-unicode-ms-400-normal.ttf +0 -0
- package/fonts/ttf/avenir-400-italic.ttf +0 -0
- package/fonts/ttf/avenir-400-normal.ttf +0 -0
- package/fonts/ttf/avenir-700-normal.ttf +0 -0
- package/fonts/ttf/avenir-black-700-normal.ttf +0 -0
- package/fonts/ttf/avenir-book-400-normal.ttf +0 -0
- package/fonts/ttf/avenir-heavy-700-italic.ttf +0 -0
- package/fonts/ttf/avenir-heavy-700-normal.ttf +0 -0
- package/fonts/ttf/avenir-light-400-italic.ttf +0 -0
- package/fonts/ttf/avenir-light-400-normal.ttf +0 -0
- package/fonts/ttf/avenir-next-400-italic.ttf +0 -0
- package/fonts/ttf/avenir-next-400-normal.ttf +0 -0
- package/fonts/ttf/avenir-next-700-italic.ttf +0 -0
- package/fonts/ttf/avenir-next-700-normal.ttf +0 -0
- package/fonts/ttf/baskerville-old-face-400-normal.ttf +0 -0
- package/fonts/ttf/batang-400-normal.ttf +0 -0
- package/fonts/ttf/bauhaus-93-400-normal.ttf +0 -0
- package/fonts/ttf/big-caslon-400-normal.ttf +0 -0
- package/fonts/ttf/bookman-old-style-400-italic.ttf +0 -0
- package/fonts/ttf/bookman-old-style-400-normal.ttf +0 -0
- package/fonts/ttf/bookman-old-style-700-italic.ttf +0 -0
- package/fonts/ttf/bookman-old-style-700-normal.ttf +0 -0
- package/fonts/ttf/calibri-400-italic.ttf +0 -0
- package/fonts/ttf/calibri-400-normal.ttf +0 -0
- package/fonts/ttf/calibri-700-italic.ttf +0 -0
- package/fonts/ttf/calibri-700-normal.ttf +0 -0
- package/fonts/ttf/calibri-light-400-italic.ttf +0 -0
- package/fonts/ttf/calibri-light-400-normal.ttf +0 -0
- package/fonts/ttf/cambria-400-italic.ttf +0 -0
- package/fonts/ttf/cambria-400-normal.ttf +0 -0
- package/fonts/ttf/cambria-700-italic.ttf +0 -0
- package/fonts/ttf/cambria-700-normal.ttf +0 -0
- package/fonts/ttf/cambria-math-400-normal.ttf +0 -0
- package/fonts/ttf/candara-400-italic.ttf +0 -0
- package/fonts/ttf/candara-400-normal.ttf +0 -0
- package/fonts/ttf/candara-700-italic.ttf +0 -0
- package/fonts/ttf/candara-700-normal.ttf +0 -0
- package/fonts/ttf/century-400-normal.ttf +0 -0
- package/fonts/ttf/century-gothic-400-italic.ttf +0 -0
- package/fonts/ttf/century-gothic-400-normal.ttf +0 -0
- package/fonts/ttf/century-gothic-700-italic.ttf +0 -0
- package/fonts/ttf/century-gothic-700-normal.ttf +0 -0
- package/fonts/ttf/century-schoolbook-400-italic.ttf +0 -0
- package/fonts/ttf/century-schoolbook-400-normal.ttf +0 -0
- package/fonts/ttf/century-schoolbook-700-italic.ttf +0 -0
- package/fonts/ttf/century-schoolbook-700-normal.ttf +0 -0
- package/fonts/ttf/comic-sans-ms-400-normal.ttf +0 -0
- package/fonts/ttf/comic-sans-ms-700-normal.ttf +0 -0
- package/fonts/ttf/consolas-400-italic.ttf +0 -0
- package/fonts/ttf/consolas-400-normal.ttf +0 -0
- package/fonts/ttf/consolas-700-normal.ttf +0 -0
- package/fonts/ttf/corbel-400-italic.ttf +0 -0
- package/fonts/ttf/corbel-400-normal.ttf +0 -0
- package/fonts/ttf/corbel-700-italic.ttf +0 -0
- package/fonts/ttf/corbel-700-normal.ttf +0 -0
- package/fonts/ttf/cordia-new-400-italic.ttf +0 -0
- package/fonts/ttf/cordia-new-400-normal.ttf +0 -0
- package/fonts/ttf/cordia-new-700-italic.ttf +0 -0
- package/fonts/ttf/cordia-new-700-normal.ttf +0 -0
- package/fonts/ttf/courier-400-normal.ttf +0 -0
- package/fonts/ttf/courier-new-400-italic.ttf +0 -0
- package/fonts/ttf/courier-new-400-normal.ttf +0 -0
- package/fonts/ttf/courier-new-700-normal.ttf +0 -0
- package/fonts/ttf/dengxian-400-normal.ttf +0 -0
- package/fonts/ttf/dengxian-700-normal.ttf +0 -0
- package/fonts/ttf/dengxian-light-400-normal.ttf +0 -0
- package/fonts/ttf/didot-400-italic.ttf +0 -0
- package/fonts/ttf/didot-400-normal.ttf +0 -0
- package/fonts/ttf/didot-700-normal.ttf +0 -0
- package/fonts/ttf/edwardian-script-itc-400-normal.ttf +0 -0
- package/fonts/ttf/euphemia-ucas-400-italic.ttf +0 -0
- package/fonts/ttf/euphemia-ucas-400-normal.ttf +0 -0
- package/fonts/ttf/euphemia-ucas-700-normal.ttf +0 -0
- package/fonts/ttf/eurostile-400-normal.ttf +0 -0
- package/fonts/ttf/eurostile-700-normal.ttf +0 -0
- package/fonts/ttf/franklin-gothic-book-400-italic.ttf +0 -0
- package/fonts/ttf/franklin-gothic-book-400-normal.ttf +0 -0
- package/fonts/ttf/franklin-gothic-demi-400-italic.ttf +0 -0
- package/fonts/ttf/franklin-gothic-demi-400-normal.ttf +0 -0
- package/fonts/ttf/franklin-gothic-demi-cond-400-normal.ttf +0 -0
- package/fonts/ttf/franklin-gothic-medium-400-italic.ttf +0 -0
- package/fonts/ttf/franklin-gothic-medium-400-normal.ttf +0 -0
- package/fonts/ttf/franklin-gothic-medium-cond-400-normal.ttf +0 -0
- package/fonts/ttf/futura-400-italic.ttf +0 -0
- package/fonts/ttf/futura-400-normal.ttf +0 -0
- package/fonts/ttf/futura-700-normal.ttf +0 -0
- package/fonts/ttf/garamond-400-italic.ttf +0 -0
- package/fonts/ttf/garamond-400-normal.ttf +0 -0
- package/fonts/ttf/garamond-700-italic.ttf +0 -0
- package/fonts/ttf/garamond-700-normal.ttf +0 -0
- package/fonts/ttf/geneva-400-normal.ttf +0 -0
- package/fonts/ttf/georgia-400-italic.ttf +0 -0
- package/fonts/ttf/georgia-400-normal.ttf +0 -0
- package/fonts/ttf/georgia-700-normal.ttf +0 -0
- package/fonts/ttf/gill-sans-400-italic.ttf +0 -0
- package/fonts/ttf/gill-sans-400-normal.ttf +0 -0
- package/fonts/ttf/gill-sans-700-italic.ttf +0 -0
- package/fonts/ttf/gill-sans-700-normal.ttf +0 -0
- package/fonts/ttf/gill-sans-light-400-italic.ttf +0 -0
- package/fonts/ttf/gill-sans-light-400-normal.ttf +0 -0
- package/fonts/ttf/gill-sans-mt-400-italic.ttf +0 -0
- package/fonts/ttf/gill-sans-mt-400-normal.ttf +0 -0
- package/fonts/ttf/gill-sans-mt-700-italic.ttf +0 -0
- package/fonts/ttf/gill-sans-mt-700-normal.ttf +0 -0
- package/fonts/ttf/helvetica-400-italic.ttf +0 -0
- package/fonts/ttf/helvetica-400-normal.ttf +0 -0
- package/fonts/ttf/helvetica-700-italic.ttf +0 -0
- package/fonts/ttf/helvetica-700-normal.ttf +0 -0
- package/fonts/ttf/helvetica-neue-400-italic.ttf +0 -0
- package/fonts/ttf/helvetica-neue-400-normal.ttf +0 -0
- package/fonts/ttf/helvetica-neue-700-italic.ttf +0 -0
- package/fonts/ttf/helvetica-neue-700-normal.ttf +0 -0
- package/fonts/ttf/hoefler-text-400-italic.ttf +0 -0
- package/fonts/ttf/hoefler-text-400-normal.ttf +0 -0
- package/fonts/ttf/hoefler-text-700-italic.ttf +0 -0
- package/fonts/ttf/hoefler-text-700-normal.ttf +0 -0
- package/fonts/ttf/lucida-grande-400-normal.ttf +0 -0
- package/fonts/ttf/lucida-grande-700-normal.ttf +0 -0
- package/fonts/ttf/lucida-sans-400-italic.ttf +0 -0
- package/fonts/ttf/lucida-sans-400-normal.ttf +0 -0
- package/fonts/ttf/lucida-sans-700-italic.ttf +0 -0
- package/fonts/ttf/lucida-sans-700-normal.ttf +0 -0
- package/fonts/ttf/lucida-sans-unicode-400-normal.ttf +0 -0
- package/fonts/ttf/malgun-gothic-400-normal.ttf +0 -0
- package/fonts/ttf/malgun-gothic-700-normal.ttf +0 -0
- package/fonts/ttf/mangal-400-normal.ttf +0 -0
- package/fonts/ttf/mangal-700-normal.ttf +0 -0
- package/fonts/ttf/microsoft-sans-serif-400-normal.ttf +0 -0
- package/fonts/ttf/microsoft-yahei-400-normal.ttf +0 -0
- package/fonts/ttf/microsoft-yahei-700-normal.ttf +0 -0
- package/fonts/ttf/microsoft-yi-baiti-400-normal.ttf +0 -0
- package/fonts/ttf/monotype-sorts-400-normal.ttf +0 -0
- package/fonts/ttf/ms-gothic-400-normal.ttf +0 -0
- package/fonts/ttf/ms-mincho-400-normal.ttf +0 -0
- package/fonts/ttf/ms-ui-gothic-400-normal.ttf +0 -0
- package/fonts/ttf/new-york-400-italic.ttf +0 -0
- package/fonts/ttf/new-york-400-normal.ttf +0 -0
- package/fonts/ttf/news-gothic-mt-400-italic.ttf +0 -0
- package/fonts/ttf/news-gothic-mt-400-normal.ttf +0 -0
- package/fonts/ttf/news-gothic-mt-700-italic.ttf +0 -0
- package/fonts/ttf/news-gothic-mt-700-normal.ttf +0 -0
- package/fonts/ttf/nsimsun-400-normal.ttf +0 -0
- package/fonts/ttf/optima-400-italic.ttf +0 -0
- package/fonts/ttf/optima-400-normal.ttf +0 -0
- package/fonts/ttf/optima-700-italic.ttf +0 -0
- package/fonts/ttf/optima-700-normal.ttf +0 -0
- package/fonts/ttf/palatino-400-italic.ttf +0 -0
- package/fonts/ttf/palatino-400-normal.ttf +0 -0
- package/fonts/ttf/palatino-700-italic.ttf +0 -0
- package/fonts/ttf/palatino-700-normal.ttf +0 -0
- package/fonts/ttf/palatino-linotype-400-italic.ttf +0 -0
- package/fonts/ttf/palatino-linotype-400-normal.ttf +0 -0
- package/fonts/ttf/palatino-linotype-700-italic.ttf +0 -0
- package/fonts/ttf/palatino-linotype-700-normal.ttf +0 -0
- package/fonts/ttf/pmingliu-400-normal.ttf +0 -0
- package/fonts/ttf/pt-mono-400-normal.ttf +0 -0
- package/fonts/ttf/pt-mono-700-normal.ttf +0 -0
- package/fonts/ttf/segoe-ui-symbol-400-normal.ttf +0 -0
- package/fonts/ttf/simsun-400-normal.ttf +0 -0
- package/fonts/ttf/skia-400-normal.ttf +0 -0
- package/fonts/ttf/stencil-400-normal.ttf +0 -0
- package/fonts/ttf/symbol-400-normal.ttf +0 -0
- package/fonts/ttf/tahoma-400-normal.ttf +0 -0
- package/fonts/ttf/tahoma-700-normal.ttf +0 -0
- package/fonts/ttf/times-400-italic.ttf +0 -0
- package/fonts/ttf/times-400-normal.ttf +0 -0
- package/fonts/ttf/times-700-italic.ttf +0 -0
- package/fonts/ttf/times-700-normal.ttf +0 -0
- package/fonts/ttf/times-new-roman-400-italic.ttf +0 -0
- package/fonts/ttf/times-new-roman-400-normal.ttf +0 -0
- package/fonts/ttf/times-new-roman-700-italic.ttf +0 -0
- package/fonts/ttf/times-new-roman-700-normal.ttf +0 -0
- package/fonts/ttf/trebuchet-ms-400-italic.ttf +0 -0
- package/fonts/ttf/trebuchet-ms-400-normal.ttf +0 -0
- package/fonts/ttf/trebuchet-ms-700-italic.ttf +0 -0
- package/fonts/ttf/trebuchet-ms-700-normal.ttf +0 -0
- package/fonts/ttf/tw-cen-mt-400-normal.ttf +0 -0
- package/fonts/ttf/tw-cen-mt-700-normal.ttf +0 -0
- package/fonts/ttf/tw-cen-mt-condensed-400-normal.ttf +0 -0
- package/fonts/ttf/tw-cen-mt-condensed-700-normal.ttf +0 -0
- package/fonts/ttf/verdana-400-italic.ttf +0 -0
- package/fonts/ttf/verdana-400-normal.ttf +0 -0
- package/fonts/ttf/verdana-700-italic.ttf +0 -0
- package/fonts/ttf/verdana-700-normal.ttf +0 -0
- package/fonts/ttf/webdings-400-normal.ttf +0 -0
- package/fonts/ttf/wingdings-2-400-normal.ttf +0 -0
- package/fonts/ttf/wingdings-3-400-normal.ttf +0 -0
- package/fonts/ttf/wingdings-400-normal.ttf +0 -0
- package/fonts/ttf/yu-gothic-light-400-normal.ttf +0 -0
- package/fonts/ttf/yu-mincho-400-normal.ttf +0 -0
- package/fonts/ttf/yu-mincho-700-normal.ttf +0 -0
- package/package.json +63 -0
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import * as s from "blockly";
|
|
2
|
+
import { k as p, T as u, m, n as f, o as g, p as h } from "./sdk-BKkeAoJT.js";
|
|
3
|
+
let r = !1;
|
|
4
|
+
function b(o, n, i) {
|
|
5
|
+
r || (p(), r = !0), o.replaceChildren();
|
|
6
|
+
const t = document.createElement("div");
|
|
7
|
+
t.className = "vp-canvas-host", o.append(t);
|
|
8
|
+
const e = s.inject(t, {
|
|
9
|
+
// La boîte à outils : sans elle, on peut lire une expression et la
|
|
10
|
+
// rebrancher, mais pas y AJOUTER quoi que ce soit — c'est la moitié de ce
|
|
11
|
+
// qu'on vient chercher dans un canvas de blocs.
|
|
12
|
+
toolbox: m,
|
|
13
|
+
theme: u,
|
|
14
|
+
renderer: "geras",
|
|
15
|
+
trashcan: !0,
|
|
16
|
+
sounds: !1,
|
|
17
|
+
grid: { spacing: 20, length: 1, colour: "#e8e9ed", snap: !1 },
|
|
18
|
+
zoom: { controls: !0, wheel: !0, startScale: 0.95, minScale: 0.3, maxScale: 2 },
|
|
19
|
+
move: { scrollbars: !0, drag: !0, wheel: !0 }
|
|
20
|
+
});
|
|
21
|
+
return e.addChangeListener((a) => {
|
|
22
|
+
a.isUiEvent || n();
|
|
23
|
+
}), {
|
|
24
|
+
load(a) {
|
|
25
|
+
const c = f(i());
|
|
26
|
+
g(c.flatMap((d) => d.fields.map((l) => ({ path: l.path, label: l.label })))), s.serialization.workspaces.load({ blocks: { languageVersion: 0, blocks: [a] } }, e), h(e), s.svgResize(e);
|
|
27
|
+
},
|
|
28
|
+
read() {
|
|
29
|
+
return s.serialization.workspaces.save(e)?.blocks?.blocks?.[0] ?? null;
|
|
30
|
+
},
|
|
31
|
+
resize() {
|
|
32
|
+
s.svgResize(e);
|
|
33
|
+
},
|
|
34
|
+
dispose() {
|
|
35
|
+
e.dispose();
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
export {
|
|
40
|
+
b as mountBlockly
|
|
41
|
+
};
|
|
42
|
+
//# sourceMappingURL=vars-blockly-C-cJRHx8.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vars-blockly-C-cJRHx8.js","sources":["../../src/vars-blockly.ts"],"sourcesContent":["import * as Blockly from 'blockly'\nimport {\n decorate, defineBlocks, fieldLibrary, setFields, THEME, TOOLBOX,\n type BlockJson,\n} from '@myrole/docx-vars'\nimport type { Tag } from '@myrole/docx-tags'\n\n/**\n * Le mode Blockly, chargé à la demande.\n *\n * Le canvas ne se replie pas — c'est ce qui a fait choisir le rendu DOM par\n * défaut — mais il sait ce que le DOM ne fait pas encore aussi bien :\n * restructurer librement une expression au glisser-déposer, avec sa poubelle,\n * son annulation et ses connexions typées.\n *\n * Il vit dans son propre module pour ne peser que si on l'ouvre : un\n * mégaoctet et demi qu'un utilisateur qui ne bascule jamais ne télécharge pas.\n */\n\nlet defined = false\n\nexport interface BlocklyView {\n load(tree: BlockJson): void\n read(): BlockJson | null\n resize(): void\n dispose(): void\n}\n\nexport function mountBlockly(\n holder: HTMLElement, onChange: () => void, tags: () => Tag[],\n): BlocklyView {\n if (!defined) { defineBlocks(); defined = true }\n holder.replaceChildren()\n const host = document.createElement('div')\n host.className = 'vp-canvas-host'\n holder.append(host)\n\n const ws = Blockly.inject(host, {\n // La boîte à outils : sans elle, on peut lire une expression et la\n // rebrancher, mais pas y AJOUTER quoi que ce soit — c'est la moitié de ce\n // qu'on vient chercher dans un canvas de blocs.\n toolbox: TOOLBOX,\n theme: THEME,\n renderer: 'geras',\n trashcan: true,\n sounds: false,\n grid: { spacing: 20, length: 1, colour: '#e8e9ed', snap: false },\n zoom: { controls: true, wheel: true, startScale: 0.95, minScale: 0.3, maxScale: 2 },\n move: { scrollbars: true, drag: true, wheel: true },\n })\n ws.addChangeListener((e) => { if (!e.isUiEvent) onChange() })\n\n return {\n load(tree) {\n // `setFields` alimente le sélecteur du bloc « champ » : sans lui, un clic\n // sur un champ n'ouvre rien.\n const groups = fieldLibrary(tags())\n setFields(groups.flatMap((g) => g.fields.map((f) => ({ path: f.path, label: f.label }))))\n Blockly.serialization.workspaces.load({ blocks: { languageVersion: 0, blocks: [tree] } }, ws)\n decorate(ws)\n Blockly.svgResize(ws)\n },\n read() {\n const state = Blockly.serialization.workspaces.save(ws) as {\n blocks?: { blocks?: BlockJson[] }\n }\n return state?.blocks?.blocks?.[0] ?? null\n },\n resize() { Blockly.svgResize(ws) },\n dispose() { ws.dispose() },\n }\n}\n"],"names":["defined","mountBlockly","holder","onChange","tags","defineBlocks","host","ws","Blockly","TOOLBOX","THEME","e","tree","groups","fieldLibrary","setFields","g","f","decorate"],"mappings":";;AAmBA,IAAIA,IAAU;AASP,SAASC,EACdC,GAAqBC,GAAsBC,GAC9B;AACb,EAAKJ,MAAWK,EAAA,GAAgBL,IAAU,KAC1CE,EAAO,gBAAA;AACP,QAAMI,IAAO,SAAS,cAAc,KAAK;AACzC,EAAAA,EAAK,YAAY,kBACjBJ,EAAO,OAAOI,CAAI;AAElB,QAAMC,IAAKC,EAAQ,OAAOF,GAAM;AAAA;AAAA;AAAA;AAAA,IAI9B,SAASG;AAAA,IACT,OAAOC;AAAA,IACP,UAAU;AAAA,IACV,UAAU;AAAA,IACV,QAAQ;AAAA,IACR,MAAM,EAAE,SAAS,IAAI,QAAQ,GAAG,QAAQ,WAAW,MAAM,GAAA;AAAA,IACzD,MAAM,EAAE,UAAU,IAAM,OAAO,IAAM,YAAY,MAAM,UAAU,KAAK,UAAU,EAAA;AAAA,IAChF,MAAM,EAAE,YAAY,IAAM,MAAM,IAAM,OAAO,GAAA;AAAA,EAAK,CACnD;AACD,SAAAH,EAAG,kBAAkB,CAACI,MAAM;AAAE,IAAKA,EAAE,aAAWR,EAAA;AAAA,EAAW,CAAC,GAErD;AAAA,IACL,KAAKS,GAAM;AAGT,YAAMC,IAASC,EAAaV,GAAM;AAClC,MAAAW,EAAUF,EAAO,QAAQ,CAACG,MAAMA,EAAE,OAAO,IAAI,CAACC,OAAO,EAAE,MAAMA,EAAE,MAAM,OAAOA,EAAE,MAAA,EAAQ,CAAC,CAAC,GACxFT,EAAQ,cAAc,WAAW,KAAK,EAAE,QAAQ,EAAE,iBAAiB,GAAG,QAAQ,CAACI,CAAI,EAAA,EAAE,GAAKL,CAAE,GAC5FW,EAASX,CAAE,GACXC,EAAQ,UAAUD,CAAE;AAAA,IACtB;AAAA,IACA,OAAO;AAIL,aAHcC,EAAQ,cAAc,WAAW,KAAKD,CAAE,GAGxC,QAAQ,SAAS,CAAC,KAAK;AAAA,IACvC;AAAA,IACA,SAAS;AAAE,MAAAC,EAAQ,UAAUD,CAAE;AAAA,IAAE;AAAA,IACjC,UAAU;AAAE,MAAAA,EAAG,QAAA;AAAA,IAAU;AAAA,EAAA;AAE7B;"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { i as d, r as m, e as p, f as g, l as u, a as w, b as h, c as y, d as b } from "./chunks/sdk-BKkeAoJT.js";
|
|
2
|
+
import { g as D, h as U, j, s as B } from "./chunks/sdk-BKkeAoJT.js";
|
|
3
|
+
async function x(t) {
|
|
4
|
+
const a = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map();
|
|
5
|
+
for (const [r] of Object.entries(t.xml)) {
|
|
6
|
+
if (!r.endsWith(".rels")) continue;
|
|
7
|
+
const c = r.replace("/_rels/", "/").replace(".rels", "");
|
|
8
|
+
for (const [, e] of b(t, c)) {
|
|
9
|
+
if (e.type !== "image" || e.external) continue;
|
|
10
|
+
const i = t.bin[e.target];
|
|
11
|
+
if (!i) continue;
|
|
12
|
+
let o = a.get(e.target);
|
|
13
|
+
if (!o)
|
|
14
|
+
try {
|
|
15
|
+
o = await createImageBitmap(new Blob([i])), a.set(e.target, o);
|
|
16
|
+
} catch {
|
|
17
|
+
continue;
|
|
18
|
+
}
|
|
19
|
+
s.set(e.target, o);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
return s;
|
|
23
|
+
}
|
|
24
|
+
async function F(t, a, s = {}) {
|
|
25
|
+
const r = performance.now(), [c] = await Promise.all([
|
|
26
|
+
typeof t == "string" ? fetch(t).then((n) => n.ok ? n.arrayBuffer() : Promise.reject(new Error(`${n.status} ${t}`))) : Promise.resolve(t),
|
|
27
|
+
d(s.fontsUrl)
|
|
28
|
+
]), e = m(new Uint8Array(c));
|
|
29
|
+
for (const n of p(e))
|
|
30
|
+
try {
|
|
31
|
+
const l = g(n), f = new FontFace(l.family, n.data, { weight: l.weight, style: l.style });
|
|
32
|
+
await f.load(), document.fonts.add(f);
|
|
33
|
+
} catch {
|
|
34
|
+
}
|
|
35
|
+
const [i, o] = await Promise.all([x(e), u(s.fontsUrl)]);
|
|
36
|
+
return a.replaceChildren(), w({
|
|
37
|
+
...y(e),
|
|
38
|
+
container: a,
|
|
39
|
+
images: i,
|
|
40
|
+
lineRatios: o,
|
|
41
|
+
footnotes: h(e),
|
|
42
|
+
devicePixelRatio: window.devicePixelRatio || 1
|
|
43
|
+
}), { pages: [...a.querySelectorAll("canvas")], ms: Math.round(performance.now() - r) };
|
|
44
|
+
}
|
|
45
|
+
export {
|
|
46
|
+
D as createDocxEditor,
|
|
47
|
+
U as defaultFontsUrl,
|
|
48
|
+
j as evaluateTags,
|
|
49
|
+
d as installFonts,
|
|
50
|
+
F as renderDocx,
|
|
51
|
+
B as sampleValues
|
|
52
|
+
};
|
|
53
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/embed.ts"],"sourcesContent":["/**\n * The renderer, embeddable in ANY page served by the studio.\n *\n * The review dashboard shows a document next to Word's render: with this\n * module the canvas side is the engine composing the document LIVE in the\n * page, not a PNG the bench cached — so a change in the engine shows on the\n * next reload, and the slider compares what the editor would draw.\n *\n * const { pages } = await renderDocx('/corpus/<name>.docx', hiddenDiv)\n *\n * Fed by `buildRenderInput`, like the editor and the bench: the third surface\n * that mounts the renderer starts from there, as CLAUDE.md asks. What it adds\n * is the platform: fonts loaded before any measurement, embedded fonts of the\n * document, images decoded by the browser.\n */\nimport { embeddedFonts, fontFaceDescriptor, readDocx, relationships, type DocxDocument } from '@myrole/docx-model'\nimport { buildRenderInput, footnoteContent, render, type ImageMap } from '@myrole/docx-render'\nimport { installFonts, lineRatios } from './fonts'\n\nasync function preloadImages(doc: DocxDocument): Promise<ImageMap> {\n const byTarget = new Map<string, ImageBitmap>()\n const map: ImageMap = new Map()\n for (const [path] of Object.entries(doc.xml)) {\n if (!path.endsWith('.rels')) continue\n const partPath = path.replace('/_rels/', '/').replace('.rels', '')\n for (const [, rel] of relationships(doc, partPath)) {\n if (rel.type !== 'image' || rel.external) continue\n const bin = doc.bin[rel.target]\n if (!bin) continue\n let bitmap = byTarget.get(rel.target)\n if (!bitmap) {\n try { bitmap = await createImageBitmap(new Blob([bin as BlobPart])); byTarget.set(rel.target, bitmap) }\n catch { continue }\n }\n map.set(rel.target, bitmap)\n }\n }\n return map\n}\n\nexport interface Rendered {\n pages: HTMLCanvasElement[]\n ms: number\n}\n\nexport async function renderDocx(\n url: string | ArrayBuffer | Uint8Array, container: HTMLElement, opts: { fontsUrl?: string } = {},\n): Promise<Rendered> {\n const t0 = performance.now()\n const [buf] = await Promise.all([\n typeof url === 'string'\n ? fetch(url).then((r) => (r.ok ? r.arrayBuffer() : Promise.reject(new Error(`${r.status} ${url}`))))\n : Promise.resolve(url),\n installFonts(opts.fontsUrl),\n ])\n const doc = readDocx(new Uint8Array(buf))\n for (const f of embeddedFonts(doc)) {\n try {\n const d = fontFaceDescriptor(f)\n const face = new FontFace(d.family, f.data as BufferSource, { weight: d.weight, style: d.style })\n await face.load()\n document.fonts.add(face)\n } catch { /* police corrompue ou format non supporté */ }\n }\n const [images, ratios] = await Promise.all([preloadImages(doc), lineRatios(opts.fontsUrl)])\n container.replaceChildren()\n render({\n ...buildRenderInput(doc),\n container,\n images,\n lineRatios: ratios,\n footnotes: footnoteContent(doc),\n devicePixelRatio: window.devicePixelRatio || 1,\n })\n return { pages: [...container.querySelectorAll('canvas')], ms: Math.round(performance.now() - t0) }\n}\n"],"names":["preloadImages","doc","byTarget","map","path","partPath","rel","relationships","bin","bitmap","renderDocx","url","container","opts","t0","buf","r","installFonts","readDocx","f","embeddedFonts","d","fontFaceDescriptor","face","images","ratios","lineRatios","render","buildRenderInput","footnoteContent"],"mappings":";;AAmBA,eAAeA,EAAcC,GAAsC;AACjE,QAAMC,wBAAe,IAAA,GACfC,wBAAoB,IAAA;AAC1B,aAAW,CAACC,CAAI,KAAK,OAAO,QAAQH,EAAI,GAAG,GAAG;AAC5C,QAAI,CAACG,EAAK,SAAS,OAAO,EAAG;AAC7B,UAAMC,IAAWD,EAAK,QAAQ,WAAW,GAAG,EAAE,QAAQ,SAAS,EAAE;AACjE,eAAW,CAAA,EAAGE,CAAG,KAAKC,EAAcN,GAAKI,CAAQ,GAAG;AAClD,UAAIC,EAAI,SAAS,WAAWA,EAAI,SAAU;AAC1C,YAAME,IAAMP,EAAI,IAAIK,EAAI,MAAM;AAC9B,UAAI,CAACE,EAAK;AACV,UAAIC,IAASP,EAAS,IAAII,EAAI,MAAM;AACpC,UAAI,CAACG;AACH,YAAI;AAAE,UAAAA,IAAS,MAAM,kBAAkB,IAAI,KAAK,CAACD,CAAe,CAAC,CAAC,GAAGN,EAAS,IAAII,EAAI,QAAQG,CAAM;AAAA,QAAE,QAChG;AAAE;AAAA,QAAS;AAEnB,MAAAN,EAAI,IAAIG,EAAI,QAAQG,CAAM;AAAA,IAC5B;AAAA,EACF;AACA,SAAON;AACT;AAOA,eAAsBO,EACpBC,GAAwCC,GAAwBC,IAA8B,CAAA,GAC3E;AACnB,QAAMC,IAAK,YAAY,IAAA,GACjB,CAACC,CAAG,IAAI,MAAM,QAAQ,IAAI;AAAA,IAC9B,OAAOJ,KAAQ,WACX,MAAMA,CAAG,EAAE,KAAK,CAACK,MAAOA,EAAE,KAAKA,EAAE,YAAA,IAAgB,QAAQ,OAAO,IAAI,MAAM,GAAGA,EAAE,MAAM,IAAIL,CAAG,EAAE,CAAC,CAAE,IACjG,QAAQ,QAAQA,CAAG;AAAA,IACvBM,EAAaJ,EAAK,QAAQ;AAAA,EAAA,CAC3B,GACKZ,IAAMiB,EAAS,IAAI,WAAWH,CAAG,CAAC;AACxC,aAAWI,KAAKC,EAAcnB,CAAG;AAC/B,QAAI;AACF,YAAMoB,IAAIC,EAAmBH,CAAC,GACxBI,IAAO,IAAI,SAASF,EAAE,QAAQF,EAAE,MAAsB,EAAE,QAAQE,EAAE,QAAQ,OAAOA,EAAE,OAAO;AAChG,YAAME,EAAK,KAAA,GACX,SAAS,MAAM,IAAIA,CAAI;AAAA,IACzB,QAAQ;AAAA,IAAgD;AAE1D,QAAM,CAACC,GAAQC,CAAM,IAAI,MAAM,QAAQ,IAAI,CAACzB,EAAcC,CAAG,GAAGyB,EAAWb,EAAK,QAAQ,CAAC,CAAC;AAC1F,SAAAD,EAAU,gBAAA,GACVe,EAAO;AAAA,IACL,GAAGC,EAAiB3B,CAAG;AAAA,IACvB,WAAAW;AAAA,IACA,QAAAY;AAAA,IACA,YAAYC;AAAA,IACZ,WAAWI,EAAgB5B,CAAG;AAAA,IAC9B,kBAAkB,OAAO,oBAAoB;AAAA,EAAA,CAC9C,GACM,EAAE,OAAO,CAAC,GAAGW,EAAU,iBAAiB,QAAQ,CAAC,GAAG,IAAI,KAAK,MAAM,YAAY,IAAA,IAAQE,CAAE,EAAA;AAClG;"}
|
package/dist/react.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { jsx as g } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as v, useRef as n, useEffect as s } from "react";
|
|
3
|
+
import { g as x } from "./chunks/sdk-BKkeAoJT.js";
|
|
4
|
+
const C = v(function({ src: r, className: a, style: d, onReady: h, ...u }, e) {
|
|
5
|
+
const i = n(null), o = n(null), c = n(u);
|
|
6
|
+
c.current = u;
|
|
7
|
+
const f = (t) => {
|
|
8
|
+
typeof e == "function" ? e(t) : e && (e.current = t);
|
|
9
|
+
};
|
|
10
|
+
s(() => {
|
|
11
|
+
const t = x(i.current, {
|
|
12
|
+
...u,
|
|
13
|
+
onSave: (m) => c.current.onSave?.(m),
|
|
14
|
+
onChange: () => c.current.onChange?.()
|
|
15
|
+
});
|
|
16
|
+
return o.current = t, f(t), h?.(t), r && t.load(r), () => {
|
|
17
|
+
t.destroy(), o.current = null, f(null);
|
|
18
|
+
};
|
|
19
|
+
}, []);
|
|
20
|
+
const l = n(!0);
|
|
21
|
+
return s(() => {
|
|
22
|
+
if (l.current) {
|
|
23
|
+
l.current = !1;
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
r && o.current && o.current.load(r);
|
|
27
|
+
}, [r]), /* @__PURE__ */ g("div", { ref: i, className: a, style: { height: "100%", minHeight: 480, ...d } });
|
|
28
|
+
});
|
|
29
|
+
function R() {
|
|
30
|
+
return n(null);
|
|
31
|
+
}
|
|
32
|
+
export {
|
|
33
|
+
C as DocxEditor,
|
|
34
|
+
R as useDocxEditor
|
|
35
|
+
};
|
|
36
|
+
//# sourceMappingURL=react.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"react.js","sources":["../src/react.tsx"],"sourcesContent":["/**\n * The React face of the SDK.\n *\n * <DocxEditor src={file} onSave={(bytes) => upload(bytes)} style={{ height: '100vh' }} />\n *\n * The component owns one `createDocxEditor` for its lifetime; `src` changes\n * reload the document in place, every other option is read at mount. React is\n * an optional peer: nothing here runs unless `myrole-docx-editor/react` is\n * imported.\n */\nimport { useEffect, useRef, forwardRef, type CSSProperties } from 'react'\nimport { createDocxEditor, type DocxEditorHandle, type DocxEditorOptions } from './sdk'\n\nexport interface DocxEditorProps extends Omit<DocxEditorOptions, 'onReady'> {\n /** the document: bytes, a Blob/File, or a URL */\n src?: ArrayBuffer | Uint8Array | Blob | string\n className?: string\n style?: CSSProperties\n /** the handle, once mounted */\n onReady?: (editor: DocxEditorHandle) => void\n}\n\nexport const DocxEditor = forwardRef<DocxEditorHandle | null, DocxEditorProps>(function DocxEditor(\n { src, className, style, onReady, ...options }, ref,\n) {\n const host = useRef<HTMLDivElement>(null)\n const handle = useRef<DocxEditorHandle | null>(null)\n // The latest callbacks, without remounting the editor when they change.\n const latest = useRef(options)\n latest.current = options\n\n // The forwarded ref is filled HERE, not by useImperativeHandle: that one\n // runs in the layout phase, before this effect has created anything, and\n // would hand the parent a null for the component's whole life.\n const give = (h: DocxEditorHandle | null) => {\n if (typeof ref === 'function') ref(h)\n else if (ref) ref.current = h\n }\n\n useEffect(() => {\n const h = createDocxEditor(host.current!, {\n ...options,\n onSave: (b) => latest.current.onSave?.(b),\n onChange: () => latest.current.onChange?.(),\n })\n handle.current = h\n give(h)\n onReady?.(h)\n if (src) void h.load(src)\n return () => { h.destroy(); handle.current = null; give(null) }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [])\n\n const first = useRef(true)\n useEffect(() => {\n if (first.current) { first.current = false; return }\n if (src && handle.current) void handle.current.load(src)\n }, [src])\n\n return <div ref={host} className={className} style={{ height: '100%', minHeight: 480, ...style }} />\n})\n\n/** A ref to hand to `<DocxEditor ref={…}>`, and the handle once it exists. */\nexport function useDocxEditor() {\n return useRef<DocxEditorHandle | null>(null)\n}\n\nexport type { DocxEditorHandle, DocxEditorOptions } from './sdk'\n"],"names":["DocxEditor","forwardRef","src","className","style","onReady","options","ref","host","useRef","handle","latest","give","h","useEffect","createDocxEditor","b","first","jsx","useDocxEditor"],"mappings":";;;AAsBO,MAAMA,IAAaC,EAAqD,SAC7E,EAAE,KAAAC,GAAK,WAAAC,GAAW,OAAAC,GAAO,SAAAC,GAAS,GAAGC,EAAA,GAAWC,GAChD;AACA,QAAMC,IAAOC,EAAuB,IAAI,GAClCC,IAASD,EAAgC,IAAI,GAE7CE,IAASF,EAAOH,CAAO;AAC7B,EAAAK,EAAO,UAAUL;AAKjB,QAAMM,IAAO,CAACC,MAA+B;AAC3C,IAAI,OAAON,KAAQ,aAAYA,EAAIM,CAAC,IAC3BN,QAAS,UAAUM;AAAA,EAC9B;AAEA,EAAAC,EAAU,MAAM;AACd,UAAMD,IAAIE,EAAiBP,EAAK,SAAU;AAAA,MACxC,GAAGF;AAAA,MACH,QAAQ,CAACU,MAAML,EAAO,QAAQ,SAASK,CAAC;AAAA,MACxC,UAAU,MAAML,EAAO,QAAQ,WAAA;AAAA,IAAW,CAC3C;AACD,WAAAD,EAAO,UAAUG,GACjBD,EAAKC,CAAC,GACNR,IAAUQ,CAAC,GACPX,KAAUW,EAAE,KAAKX,CAAG,GACjB,MAAM;AAAE,MAAAW,EAAE,QAAA,GAAWH,EAAO,UAAU,MAAME,EAAK,IAAI;AAAA,IAAE;AAAA,EAEhE,GAAG,CAAA,CAAE;AAEL,QAAMK,IAAQR,EAAO,EAAI;AACzB,SAAAK,EAAU,MAAM;AACd,QAAIG,EAAM,SAAS;AAAE,MAAAA,EAAM,UAAU;AAAO;AAAA,IAAO;AACnD,IAAIf,KAAOQ,EAAO,WAAcA,EAAO,QAAQ,KAAKR,CAAG;AAAA,EACzD,GAAG,CAACA,CAAG,CAAC,GAED,gBAAAgB,EAAC,OAAA,EAAI,KAAKV,GAAM,WAAAL,GAAsB,OAAO,EAAE,QAAQ,QAAQ,WAAW,KAAK,GAAGC,IAAM,CAAG;AACpG,CAAC;AAGM,SAASe,IAAgB;AAC9B,SAAOV,EAAgC,IAAI;AAC7C;"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { EditContext } from '../../docx-model/src/index';
|
|
2
|
+
import type { Editor } from './editor';
|
|
3
|
+
import type { Shell } from './ui/shell';
|
|
4
|
+
export interface ChromeHost {
|
|
5
|
+
shell: Shell;
|
|
6
|
+
zoom: {
|
|
7
|
+
get(): number;
|
|
8
|
+
set(z: number): void;
|
|
9
|
+
};
|
|
10
|
+
styles(): {
|
|
11
|
+
id: string;
|
|
12
|
+
name: string;
|
|
13
|
+
}[];
|
|
14
|
+
preview: {
|
|
15
|
+
get(): boolean;
|
|
16
|
+
set(on: boolean): void;
|
|
17
|
+
};
|
|
18
|
+
readOnly: {
|
|
19
|
+
get(): boolean;
|
|
20
|
+
set(on: boolean): void;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
export interface Chrome {
|
|
24
|
+
refresh(ctx: EditContext | null, hasSel: boolean): void;
|
|
25
|
+
/** Redraw the ribbon — when an extension adds a command, or a setting changes. */
|
|
26
|
+
rebuild(): void;
|
|
27
|
+
}
|
|
28
|
+
export declare function mountChrome(root: HTMLElement, editor: Editor, host: ChromeHost): Chrome;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Command } from './editor';
|
|
2
|
+
/**
|
|
3
|
+
* Les commandes de l'éditeur.
|
|
4
|
+
*
|
|
5
|
+
* Toutes passent par `editor.registerCommand` — y compris celles-ci. C'est
|
|
6
|
+
* volontaire : une extension qui ajoute un bouton emprunte exactement le même
|
|
7
|
+
* chemin que le gras, et l'hôte n'a rien à savoir de ce qu'on lui ajoute.
|
|
8
|
+
*
|
|
9
|
+
* `active` et `enabled` sont des FONCTIONS relues à chaque composition. Un état
|
|
10
|
+
* d'interface qu'on maintiendrait à la main finit toujours par mentir.
|
|
11
|
+
*/
|
|
12
|
+
export declare const FONTS: string[];
|
|
13
|
+
export declare const SIZES: number[];
|
|
14
|
+
/** Quatre traits, décalés selon l'alignement — l'icône de Word, en SVG. */
|
|
15
|
+
export declare function alignIcon(align: string): SVGElement;
|
|
16
|
+
export declare function builtinCommands(): Command[];
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Word's comments, and where they sit in the text.
|
|
3
|
+
*
|
|
4
|
+
* `word/comments.xml` holds the comments; the body marks each range with
|
|
5
|
+
* `w:commentRangeStart` / `w:commentRangeEnd` between the runs. The offsets
|
|
6
|
+
* are counted the way `paragraphText` counts — `w:t` text, a tab, a break —
|
|
7
|
+
* so a comment's range is addressable by the editor like any selection.
|
|
8
|
+
*/
|
|
9
|
+
import { type DocxDocument } from '../../docx-model/src/index';
|
|
10
|
+
export interface Comment {
|
|
11
|
+
id: string;
|
|
12
|
+
author: string;
|
|
13
|
+
date?: string;
|
|
14
|
+
text: string;
|
|
15
|
+
}
|
|
16
|
+
export interface CommentRange extends Comment {
|
|
17
|
+
para: number;
|
|
18
|
+
from: number;
|
|
19
|
+
to: number;
|
|
20
|
+
}
|
|
21
|
+
/** The comments, in the order comments.xml declares them. */
|
|
22
|
+
export declare function commentsOf(doc: DocxDocument): Comment[];
|
|
23
|
+
/** Each comment with its range in the body — a comment whose range is not in the flow is left out. */
|
|
24
|
+
export declare function commentRanges(doc: DocxDocument): CommentRange[];
|
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
import { type MarginPatch, type DocViews, type DocxDocument, type DocPos, type EditContext, type PageSetup, type ParaPatch, type RunPatch } from '../../docx-model/src/index';
|
|
2
|
+
import { type ImageRect, type LineTrace, type MarkRect, type ResumeState, type SelRect, type TableRect } from '../../docx-render/src/index';
|
|
3
|
+
export interface EditorHooks {
|
|
4
|
+
/** appelé après chaque composition, avec ce qu'il faut pour la barre d'outils */
|
|
5
|
+
onContext?(ctx: EditContext | null, hasSelection: boolean): void;
|
|
6
|
+
onStatus?(text: string): void;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Ce que la composition rend en plus de sa trace : les rectangles de ce qui
|
|
10
|
+
* n'a pas d'adresse de caractère — une image, un tableau.
|
|
11
|
+
*/
|
|
12
|
+
export interface ComposeOut {
|
|
13
|
+
image(r: ImageRect): void;
|
|
14
|
+
table(r: TableRect): void;
|
|
15
|
+
/**
|
|
16
|
+
* Boîte réservée à un affichage d'extension.
|
|
17
|
+
*
|
|
18
|
+
* Le renderer l'a écartée dans le flux comme un mot insécable, sans rien y
|
|
19
|
+
* peindre : c'est l'hôte qui vient poser dedans. Voir extensions.md.
|
|
20
|
+
*/
|
|
21
|
+
mark(r: MarkRect): void;
|
|
22
|
+
}
|
|
23
|
+
/** Ce que l'hôte fournit : comment composer le document, et où. */
|
|
24
|
+
export interface EditorSetup {
|
|
25
|
+
container: HTMLElement;
|
|
26
|
+
doc: DocxDocument;
|
|
27
|
+
/** compose le document et renvoie les lignes tracées */
|
|
28
|
+
compose(views: DocViews, container: HTMLElement, paintFrom: number, out: ComposeOut, resume?: ResumeState): LineTrace[];
|
|
29
|
+
/** recalcule les vues dérivées après un changement de structure */
|
|
30
|
+
derive(doc: DocxDocument): DocViews;
|
|
31
|
+
/**
|
|
32
|
+
* Re-style UN paragraphe.
|
|
33
|
+
*
|
|
34
|
+
* Une frappe ne change la cascade que d'un paragraphe ; la refaire pour tout
|
|
35
|
+
* le document coûte 106 ms sur un contrat de 42 pages, à chaque touche.
|
|
36
|
+
* L'hôte s'en charge parce que lui seul sait résoudre les `rId` d'image.
|
|
37
|
+
*/
|
|
38
|
+
styleOne(doc: DocxDocument, para: number): DocViews['styled'][number] | undefined;
|
|
39
|
+
/** Format d'une section — la règle en a besoin, l'éditeur ne le calcule pas. */
|
|
40
|
+
pageSetupOf(doc: DocxDocument, section: number): PageSetup | null;
|
|
41
|
+
/** Ajoute une image décodée à la carte que la composition utilise. */
|
|
42
|
+
addImage?(path: string, bitmap: ImageBitmap): void;
|
|
43
|
+
/**
|
|
44
|
+
* Où envoyer le document quand il a changé.
|
|
45
|
+
*
|
|
46
|
+
* L'éditeur décide QUAND — après une accalmie, et au changement d'onglet —
|
|
47
|
+
* l'hôte décide OÙ. Une exception ici laisse le document « à enregistrer » :
|
|
48
|
+
* on ne fait pas semblant d'avoir réussi.
|
|
49
|
+
*/
|
|
50
|
+
persist?(bytes: Uint8Array): void | Promise<void>;
|
|
51
|
+
hooks?: EditorHooks;
|
|
52
|
+
}
|
|
53
|
+
export declare function createEditor(setup: EditorSetup): {
|
|
54
|
+
compose: (dirty?: number) => void;
|
|
55
|
+
/** Pages réellement recomposées au dernier appel — ce que la reprise a épargné. */
|
|
56
|
+
lastComposed: () => {
|
|
57
|
+
at: number | undefined;
|
|
58
|
+
from: number | undefined;
|
|
59
|
+
to: number | undefined;
|
|
60
|
+
pages: number;
|
|
61
|
+
snaps: number | undefined;
|
|
62
|
+
bounds: number | undefined;
|
|
63
|
+
};
|
|
64
|
+
/** remplace le document — au chargement d'un fichier */
|
|
65
|
+
load(next: DocxDocument): void;
|
|
66
|
+
readonly lines: LineTrace[];
|
|
67
|
+
readonly views: DocViews;
|
|
68
|
+
readonly document: DocxDocument;
|
|
69
|
+
readonly pages: number;
|
|
70
|
+
/** Texte d'un paragraphe, lu dans le modèle — jamais en retard d'une frappe. */
|
|
71
|
+
textOf: (para: number, part?: string) => string;
|
|
72
|
+
paragraphCount: () => number;
|
|
73
|
+
context: () => EditContext | null;
|
|
74
|
+
hasSelection: () => boolean;
|
|
75
|
+
/** Rectangles des images dessinées — ce que la souris vise. */
|
|
76
|
+
imageRects: () => {
|
|
77
|
+
para: number;
|
|
78
|
+
index: number;
|
|
79
|
+
page: number;
|
|
80
|
+
x: number;
|
|
81
|
+
y: number;
|
|
82
|
+
width: number;
|
|
83
|
+
height: number;
|
|
84
|
+
anchored: boolean;
|
|
85
|
+
}[];
|
|
86
|
+
/**
|
|
87
|
+
* Le champ invisible qui reçoit la frappe.
|
|
88
|
+
*
|
|
89
|
+
* Une extension qui veut passer AVANT l'éditeur au clavier — une liste de
|
|
90
|
+
* complétion, par exemple — n'a pas d'autre point d'accroche : c'est lui
|
|
91
|
+
* qui porte l'écoute, et une capture posée dessus s'exécute d'abord.
|
|
92
|
+
*/
|
|
93
|
+
inputEl: () => HTMLTextAreaElement;
|
|
94
|
+
/** Boîtes réservées aux affichages d'extension, telles que dessinées. */
|
|
95
|
+
markRects: () => {
|
|
96
|
+
mark: string;
|
|
97
|
+
page: number;
|
|
98
|
+
x: number;
|
|
99
|
+
y: number;
|
|
100
|
+
width: number;
|
|
101
|
+
height: number;
|
|
102
|
+
fontPx: number;
|
|
103
|
+
}[];
|
|
104
|
+
/**
|
|
105
|
+
* Pose un peintre de calque : il reçoit les couches et les boîtes réservées
|
|
106
|
+
* après chaque nettoyage, et y dépose ce qu'il veut. Rend de quoi le retirer.
|
|
107
|
+
*/
|
|
108
|
+
registerLayerPainter(fn: (layers: HTMLElement[], marks: MarkRect[]) => void): () => boolean;
|
|
109
|
+
/** Rectangles des tableaux dessinés, un par page occupée. */
|
|
110
|
+
tableRects: () => {
|
|
111
|
+
table: number;
|
|
112
|
+
page: number;
|
|
113
|
+
x: number;
|
|
114
|
+
y: number;
|
|
115
|
+
width: number;
|
|
116
|
+
height: number;
|
|
117
|
+
}[];
|
|
118
|
+
/** Objet sélectionné — une image ou un tableau pris comme un tout, ou `null`. */
|
|
119
|
+
selectedObject: () => {
|
|
120
|
+
kind: "image";
|
|
121
|
+
para: number;
|
|
122
|
+
index: number;
|
|
123
|
+
} | {
|
|
124
|
+
kind: "table";
|
|
125
|
+
table: number;
|
|
126
|
+
} | {
|
|
127
|
+
kind: "extern";
|
|
128
|
+
id: string;
|
|
129
|
+
} | null;
|
|
130
|
+
/** Sélectionne une image par son paragraphe et son rang. */
|
|
131
|
+
selectObject(para: number, index: number): void;
|
|
132
|
+
/**
|
|
133
|
+
* Prend un objet d'EXTENSION, sur la plage de texte qu'il occupe.
|
|
134
|
+
*
|
|
135
|
+
* La plage est posée — la suppression, la copie et le remplacement en
|
|
136
|
+
* dépendent — mais rien n'est dessiné : ni curseur, ni surlignage. C'est
|
|
137
|
+
* l'extension qui montre ce qui est pris.
|
|
138
|
+
*/
|
|
139
|
+
selectExternal(id: string, anchor: DocPos, focus?: DocPos): void;
|
|
140
|
+
/** Sélectionne un TABLEAU entier, par son rang dans `views.tables`. */
|
|
141
|
+
selectTable(table: number): void;
|
|
142
|
+
/** Déplace le tableau sélectionné devant le bloc qui porte ce paragraphe. */
|
|
143
|
+
moveTable(target: number): boolean;
|
|
144
|
+
/** Pose la taille d'une image, en points. */
|
|
145
|
+
setImageSize: (para: number, index: number, wPt: number, hPt: number) => void;
|
|
146
|
+
/** La sélection courante et son texte — de quoi la piloter du dehors. */
|
|
147
|
+
selection: () => {
|
|
148
|
+
anchor: {
|
|
149
|
+
para: number;
|
|
150
|
+
off: number;
|
|
151
|
+
part?: string;
|
|
152
|
+
};
|
|
153
|
+
focus: {
|
|
154
|
+
para: number;
|
|
155
|
+
off: number;
|
|
156
|
+
part?: string;
|
|
157
|
+
};
|
|
158
|
+
text: string;
|
|
159
|
+
} | null;
|
|
160
|
+
/** Pose la sélection. Une seule adresse donne un simple curseur. */
|
|
161
|
+
selectRange(anchor: DocPos, focus?: DocPos): void;
|
|
162
|
+
selectAll: () => void;
|
|
163
|
+
/** Bornes du paragraphe entier, telles que la mise en page les a dessinées. */
|
|
164
|
+
paragraphRange: (para: number) => {
|
|
165
|
+
from: number;
|
|
166
|
+
to: number;
|
|
167
|
+
} | null;
|
|
168
|
+
/** Insère du texte au curseur, ou remplace la sélection. */
|
|
169
|
+
insert: (text: string) => void;
|
|
170
|
+
deleteSelection: () => void;
|
|
171
|
+
splitAtCaret: () => void;
|
|
172
|
+
format: (patch: RunPatch) => void;
|
|
173
|
+
formatPara: (patch: ParaPatch) => void;
|
|
174
|
+
table: (what: "row" | "col", how: "above" | "below" | "left" | "right" | "delete") => void;
|
|
175
|
+
resizeImage: (index: number, factor: number) => void;
|
|
176
|
+
insertBreak: (kind: "page" | "column" | "line") => void;
|
|
177
|
+
insertImage: (data: Uint8Array, ext: string) => Promise<boolean>;
|
|
178
|
+
setMargins: (patch: MarginPatch, section?: number) => void;
|
|
179
|
+
setTableColumn: (col: number, widthPt: number) => void;
|
|
180
|
+
/** Format d'une section — celle du curseur par défaut. */
|
|
181
|
+
pageSetup: (section?: number) => PageSetup | null;
|
|
182
|
+
/** Section à laquelle appartient une page dessinée — ce que la règle suit. */
|
|
183
|
+
sectionOfPage(page: number): number;
|
|
184
|
+
undo: () => void;
|
|
185
|
+
redo: () => void;
|
|
186
|
+
canUndo: () => boolean;
|
|
187
|
+
canRedo: () => boolean;
|
|
188
|
+
save: () => Uint8Array<ArrayBufferLike>;
|
|
189
|
+
/** État de l'enregistrement, tel que la barre d'état le montre. */
|
|
190
|
+
saveState: () => "à jour" | "à enregistrer" | "enregistrement…" | "échec";
|
|
191
|
+
/** Force l'envoi maintenant, sans attendre l'accalmie. */
|
|
192
|
+
saveNow: () => Promise<void>;
|
|
193
|
+
focus: () => void;
|
|
194
|
+
/** Agrandit l'affichage. Le canvas n'est pas recomposé : c'est du CSS. */
|
|
195
|
+
setZoom(z: number): void;
|
|
196
|
+
getZoom: () => number;
|
|
197
|
+
/** Lock the document: navigation and copy stay, every edit is refused. */
|
|
198
|
+
setReadOnly(on: boolean): void;
|
|
199
|
+
isReadOnly: () => boolean;
|
|
200
|
+
/**
|
|
201
|
+
* Detach from the page. The window listeners would otherwise outlive the
|
|
202
|
+
* element — a React remount would then drive two editors with one mouse.
|
|
203
|
+
*/
|
|
204
|
+
dispose(): void;
|
|
205
|
+
/**
|
|
206
|
+
* Enregistre une commande.
|
|
207
|
+
*
|
|
208
|
+
* Elle devient utilisable par son identifiant (`run`), et la barre d'outils
|
|
209
|
+
* la propose si on lui donne un `group`. C'est le seul point d'entrée pour
|
|
210
|
+
* ajouter quelque chose : l'hôte n'a pas à connaître ce qu'on ajoute.
|
|
211
|
+
*/
|
|
212
|
+
registerCommand(cmd: Command): () => void;
|
|
213
|
+
commands: () => Command[];
|
|
214
|
+
/**
|
|
215
|
+
* Enregistre un fournisseur de décorations.
|
|
216
|
+
*
|
|
217
|
+
* Il est rappelé à chaque peinture et rend les marques à poser, chacune
|
|
218
|
+
* ancrée à une plage de caractères. L'hôte les matérialise là où le
|
|
219
|
+
* renderer a dessiné ce texte — l'extension ne peint jamais sur le canvas.
|
|
220
|
+
*/
|
|
221
|
+
registerDecorations(provider: DecorationProvider): () => void;
|
|
222
|
+
/** Rectangles réellement dessinés pour une ancre — le `measure` du contrat. */
|
|
223
|
+
rectsFor: (a: {
|
|
224
|
+
para: number;
|
|
225
|
+
from: number;
|
|
226
|
+
to: number;
|
|
227
|
+
}) => SelRect[];
|
|
228
|
+
/** Position du curseur, dans les termes du contrat d'extension. */
|
|
229
|
+
caret: () => {
|
|
230
|
+
para: number;
|
|
231
|
+
offset: number;
|
|
232
|
+
} | null;
|
|
233
|
+
/** Exécute une commande par son identifiant. */
|
|
234
|
+
run(id: string, arg?: unknown): boolean;
|
|
235
|
+
/** S'abonne à un événement. Rend la fonction de désabonnement. */
|
|
236
|
+
on(ev: EditorEvent, fn: (payload: never) => void): () => boolean;
|
|
237
|
+
off(ev: EditorEvent, fn: (payload: never) => void): void;
|
|
238
|
+
};
|
|
239
|
+
export type Editor = ReturnType<typeof createEditor>;
|
|
240
|
+
/**
|
|
241
|
+
* Ce qu'une extension peut écouter.
|
|
242
|
+
*
|
|
243
|
+
* `change` court après toute modification du document, `selection` après tout
|
|
244
|
+
* déplacement du curseur, `render` après chaque composition, `context` avec
|
|
245
|
+
* l'état complet sous le curseur, `commands` quand le registre bouge.
|
|
246
|
+
*/
|
|
247
|
+
export type EditorEvent = 'change' | 'selection' | 'render' | 'context' | 'commands' | 'load' | 'save';
|
|
248
|
+
/**
|
|
249
|
+
* Une commande ajoutée par l'hôte ou par une extension.
|
|
250
|
+
*
|
|
251
|
+
* `group` la place dans la barre d'outils ; sans lui elle reste appelable par
|
|
252
|
+
* `editor.run(id)` sans rien afficher. `active` et `enabled` sont relus à
|
|
253
|
+
* chaque composition — un état d'interface maintenu à la main finit par mentir.
|
|
254
|
+
*/
|
|
255
|
+
/**
|
|
256
|
+
* Une marque ancrée à une plage de caractères.
|
|
257
|
+
*
|
|
258
|
+
* C'est la moitié « décoration » du contrat d'extension, celle qui manquait ici :
|
|
259
|
+
* le registre de commandes décrit des ACTIONS, une décoration décrit une
|
|
260
|
+
* MARQUE. Les deux sont complémentaires, pas concurrents.
|
|
261
|
+
*
|
|
262
|
+
* L'ancre est celle du POC variables — `{para, from, to}` — pour qu'un badge
|
|
263
|
+
* écrit là-bas se pose ici sans rien changer.
|
|
264
|
+
*/
|
|
265
|
+
export interface Decoration {
|
|
266
|
+
id: string;
|
|
267
|
+
anchor: {
|
|
268
|
+
para: number;
|
|
269
|
+
from: number;
|
|
270
|
+
to: number;
|
|
271
|
+
};
|
|
272
|
+
/** classe CSS posée sur le rectangle */
|
|
273
|
+
className?: string;
|
|
274
|
+
/** contenu, posé sur le premier rectangle seulement */
|
|
275
|
+
render?(): Node;
|
|
276
|
+
onSelect?(): void;
|
|
277
|
+
}
|
|
278
|
+
/** Rappelé à chaque peinture ; rend les marques à poser. */
|
|
279
|
+
export type DecorationProvider = (editor: Editor) => Decoration[];
|
|
280
|
+
export interface Command {
|
|
281
|
+
id: string;
|
|
282
|
+
label: string;
|
|
283
|
+
title?: string;
|
|
284
|
+
/** groupe de la barre d'outils : `edition`, `police`, `paragraphe`, `inserer`… */
|
|
285
|
+
group?: string;
|
|
286
|
+
/** icône dessinée, sinon le libellé sert de texte */
|
|
287
|
+
icon?: () => Node;
|
|
288
|
+
run(editor: Editor, arg?: unknown): void;
|
|
289
|
+
/** bouton enfoncé ? relu à chaque composition */
|
|
290
|
+
active?(editor: Editor): boolean;
|
|
291
|
+
/** bouton disponible ? relu à chaque composition */
|
|
292
|
+
enabled?(editor: Editor): boolean;
|
|
293
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare function defaultFontsUrl(): string;
|
|
2
|
+
/** Declare every shipped face once, then wait for them like the app did. */
|
|
3
|
+
export declare function installFonts(fontsUrl?: string): Promise<void>;
|
|
4
|
+
/** Line-height ratios read in the served TTFs — `fontLineRatios` on our directory. */
|
|
5
|
+
export declare function lineRatios(fontsUrl?: string): Promise<Partial<Record<"Times New Roman" | "New York" | "Arial" | "Symbol" | "Calibri" | "Avenir Book" | "Avenir" | "Avenir Next" | "Gill Sans Light" | "Century Gothic" | "Verdana" | "Century Schoolbook" | "Avenir Heavy" | "Bookman Old Style" | "Aptos" | "Consolas" | "Abadi MT Condensed Extra Bold" | "Abadi MT Condensed Light" | "Angsana New" | "Apple Color Emoji" | "Apple Symbols" | "Aptos Narrow" | "Arial Hebrew" | "Arial Narrow" | "Arial Rounded MT Bold" | "Arial Unicode MS" | "Avenir Light" | "Baskerville Old Face" | "Batang" | "Bauhaus 93" | "Big Caslon" | "Calibri Light" | "Cambria" | "Cambria Math" | "Candara" | "Century" | "Comic Sans MS" | "Corbel" | "Cordia New" | "Courier" | "Courier New" | "DengXian" | "DengXian Light" | "Didot" | "Edwardian Script ITC" | "Euphemia UCAS" | "Eurostile" | "Franklin Gothic Book" | "Franklin Gothic Demi" | "Franklin Gothic Demi Cond" | "Franklin Gothic Medium" | "Franklin Gothic Medium Cond" | "Futura" | "Garamond" | "Geneva" | "Georgia" | "Gill Sans" | "Gill Sans MT" | "Helvetica" | "Helvetica Neue" | "Hoefler Text" | "Lucida Grande" | "Lucida Sans" | "Lucida Sans Unicode" | "MS Gothic" | "MS Mincho" | "MS UI Gothic" | "Malgun Gothic" | "Mangal" | "Microsoft Sans Serif" | "Microsoft YaHei" | "Microsoft Yi Baiti" | "Monotype Sorts" | "NSimSun" | "News Gothic MT" | "Optima" | "PMingLiU" | "PT Mono" | "Palatino" | "Palatino Linotype" | "Segoe UI Symbol" | "SimSun" | "Skia" | "Stencil" | "Tahoma" | "Times" | "Trebuchet MS" | "Tw Cen MT" | "Tw Cen MT Condensed" | "Webdings" | "Wingdings" | "Wingdings 2" | "Wingdings 3" | "Yu Gothic Light" | "Yu Mincho" | "Arial Black" | "Avenir Black", number>>>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { PastedBlock } from '../../docx-model/src/index';
|
|
2
|
+
/** Décode une URI `data:` en octets, ou rend `null` si ce n'en est pas une. */
|
|
3
|
+
export declare function dataUri(src: string): {
|
|
4
|
+
data: Uint8Array;
|
|
5
|
+
ext: string;
|
|
6
|
+
} | null;
|
|
7
|
+
/**
|
|
8
|
+
* Découpe le HTML en blocs : paragraphes, listes, tableaux, images.
|
|
9
|
+
*
|
|
10
|
+
* Les espaces sont normalisées comme le ferait un navigateur — le HTML de Word
|
|
11
|
+
* est plein de retours à la ligne et d'indentation qui ne sont pas du texte.
|
|
12
|
+
*/
|
|
13
|
+
export declare function htmlToBlocks(html: string): PastedBlock[];
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* myrole-docx-editor — the MyRole engine as an SDK.
|
|
3
|
+
*
|
|
4
|
+
* import { createDocxEditor } from 'myrole-docx-editor'
|
|
5
|
+
* const editor = createDocxEditor(document.getElementById('app'), { onSave })
|
|
6
|
+
* await editor.load(file)
|
|
7
|
+
*
|
|
8
|
+
* React: `import { DocxEditor } from 'myrole-docx-editor/react'`.
|
|
9
|
+
*/
|
|
10
|
+
export { createDocxEditor } from './sdk';
|
|
11
|
+
export type { DocxEditorHandle, DocxEditorOptions, DocxEditorEvent, ChromeMode, Theme } from './sdk';
|
|
12
|
+
export { renderDocx } from './embed';
|
|
13
|
+
export type { Rendered } from './embed';
|
|
14
|
+
export { installFonts, defaultFontsUrl } from './fonts';
|
|
15
|
+
export type { Editor, EditorEvent, Command, Decoration, DecorationProvider } from './editor';
|
|
16
|
+
export type { Tag } from '../../docx-tags/src/index';
|
|
17
|
+
export type { DocxDocument, DocPos, EditContext, RunPatch, ParaPatch, MarginPatch } from '../../docx-model/src/index';
|
|
18
|
+
export { sampleValues, evaluateTags } from '../../docx-vars/src/index';
|
|
19
|
+
export type { LibraryExtras, LibraryField, LibrarySnippet } from './vars-library';
|
|
20
|
+
export type { Comment, CommentRange } from './comments';
|