@docmentis/udoc-editor 0.0.1 → 0.8.1
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/LICENSE-APACHE +202 -0
- package/LICENSE-MIT +21 -0
- package/README.md +48 -0
- package/dist/arrange.d.ts +37 -0
- package/dist/arrange.d.ts.map +1 -0
- package/dist/arrange.js +431 -0
- package/dist/arrange.js.map +1 -0
- package/dist/clipboard.d.ts +12 -0
- package/dist/clipboard.d.ts.map +1 -0
- package/dist/clipboard.js +101 -0
- package/dist/clipboard.js.map +1 -0
- package/dist/commands.d.ts +12 -0
- package/dist/commands.d.ts.map +1 -0
- package/dist/commands.js +225 -0
- package/dist/commands.js.map +1 -0
- package/dist/components/ComboBox.d.ts +38 -0
- package/dist/components/ComboBox.d.ts.map +1 -0
- package/dist/components/ComboBox.js +57 -0
- package/dist/components/ComboBox.js.map +1 -0
- package/dist/components/ModeSwitch.d.ts +15 -0
- package/dist/components/ModeSwitch.d.ts.map +1 -0
- package/dist/components/ModeSwitch.js +94 -0
- package/dist/components/ModeSwitch.js.map +1 -0
- package/dist/components/NewSlideModal.d.ts +41 -0
- package/dist/components/NewSlideModal.d.ts.map +1 -0
- package/dist/components/NewSlideModal.js +136 -0
- package/dist/components/NewSlideModal.js.map +1 -0
- package/dist/components/PageControls.d.ts +78 -0
- package/dist/components/PageControls.d.ts.map +1 -0
- package/dist/components/PageControls.js +201 -0
- package/dist/components/PageControls.js.map +1 -0
- package/dist/components/PageSettingsModal.d.ts +27 -0
- package/dist/components/PageSettingsModal.d.ts.map +1 -0
- package/dist/components/PageSettingsModal.js +273 -0
- package/dist/components/PageSettingsModal.js.map +1 -0
- package/dist/components/PaintOptionsModal.d.ts +19 -0
- package/dist/components/PaintOptionsModal.d.ts.map +1 -0
- package/dist/components/PaintOptionsModal.js +103 -0
- package/dist/components/PaintOptionsModal.js.map +1 -0
- package/dist/components/TextControls.d.ts +49 -0
- package/dist/components/TextControls.d.ts.map +1 -0
- package/dist/components/TextControls.js +452 -0
- package/dist/components/TextControls.js.map +1 -0
- package/dist/context-menu.d.ts +46 -0
- package/dist/context-menu.d.ts.map +1 -0
- package/dist/context-menu.js +144 -0
- package/dist/context-menu.js.map +1 -0
- package/dist/edit-client.d.ts +121 -0
- package/dist/edit-client.d.ts.map +1 -0
- package/dist/edit-client.js +154 -0
- package/dist/edit-client.js.map +1 -0
- package/dist/edit-command.d.ts +7 -0
- package/dist/edit-command.d.ts.map +1 -0
- package/dist/edit-command.js +18 -0
- package/dist/edit-command.js.map +1 -0
- package/dist/edit-mode.d.ts +19 -0
- package/dist/edit-mode.d.ts.map +1 -0
- package/dist/edit-mode.js +214 -0
- package/dist/edit-mode.js.map +1 -0
- package/dist/editor.d.ts +101 -0
- package/dist/editor.d.ts.map +1 -0
- package/dist/editor.js +101 -0
- package/dist/editor.js.map +1 -0
- package/dist/fonts/faces.d.ts +28 -0
- package/dist/fonts/faces.d.ts.map +1 -0
- package/dist/fonts/faces.js +38 -0
- package/dist/fonts/faces.js.map +1 -0
- package/dist/fonts/preview.d.ts +98 -0
- package/dist/fonts/preview.d.ts.map +1 -0
- package/dist/fonts/preview.js +149 -0
- package/dist/fonts/preview.js.map +1 -0
- package/dist/formatting-marks.d.ts +23 -0
- package/dist/formatting-marks.d.ts.map +1 -0
- package/dist/formatting-marks.js +55 -0
- package/dist/formatting-marks.js.map +1 -0
- package/dist/grips.d.ts +14 -0
- package/dist/grips.d.ts.map +1 -0
- package/dist/grips.js +459 -0
- package/dist/grips.js.map +1 -0
- package/dist/i18n/ar.d.ts +4 -0
- package/dist/i18n/ar.d.ts.map +1 -0
- package/dist/i18n/ar.js +175 -0
- package/dist/i18n/ar.js.map +1 -0
- package/dist/i18n/de.d.ts +4 -0
- package/dist/i18n/de.d.ts.map +1 -0
- package/dist/i18n/de.js +175 -0
- package/dist/i18n/de.js.map +1 -0
- package/dist/i18n/en.d.ts +5 -0
- package/dist/i18n/en.d.ts.map +1 -0
- package/dist/i18n/en.js +176 -0
- package/dist/i18n/en.js.map +1 -0
- package/dist/i18n/es.d.ts +4 -0
- package/dist/i18n/es.d.ts.map +1 -0
- package/dist/i18n/es.js +175 -0
- package/dist/i18n/es.js.map +1 -0
- package/dist/i18n/fr.d.ts +4 -0
- package/dist/i18n/fr.d.ts.map +1 -0
- package/dist/i18n/fr.js +175 -0
- package/dist/i18n/fr.js.map +1 -0
- package/dist/i18n/index.d.ts +21 -0
- package/dist/i18n/index.d.ts.map +1 -0
- package/dist/i18n/index.js +42 -0
- package/dist/i18n/index.js.map +1 -0
- package/dist/i18n/ja.d.ts +4 -0
- package/dist/i18n/ja.d.ts.map +1 -0
- package/dist/i18n/ja.js +175 -0
- package/dist/i18n/ja.js.map +1 -0
- package/dist/i18n/ko.d.ts +4 -0
- package/dist/i18n/ko.d.ts.map +1 -0
- package/dist/i18n/ko.js +175 -0
- package/dist/i18n/ko.js.map +1 -0
- package/dist/i18n/messages.d.ts +316 -0
- package/dist/i18n/messages.d.ts.map +1 -0
- package/dist/i18n/messages.js +2 -0
- package/dist/i18n/messages.js.map +1 -0
- package/dist/i18n/pt-BR.d.ts +4 -0
- package/dist/i18n/pt-BR.d.ts.map +1 -0
- package/dist/i18n/pt-BR.js +175 -0
- package/dist/i18n/pt-BR.js.map +1 -0
- package/dist/i18n/ru.d.ts +4 -0
- package/dist/i18n/ru.d.ts.map +1 -0
- package/dist/i18n/ru.js +175 -0
- package/dist/i18n/ru.js.map +1 -0
- package/dist/i18n/zh-CN.d.ts +4 -0
- package/dist/i18n/zh-CN.d.ts.map +1 -0
- package/dist/i18n/zh-CN.js +175 -0
- package/dist/i18n/zh-CN.js.map +1 -0
- package/dist/i18n/zh-TW.d.ts +4 -0
- package/dist/i18n/zh-TW.d.ts.map +1 -0
- package/dist/i18n/zh-TW.js +175 -0
- package/dist/i18n/zh-TW.js.map +1 -0
- package/dist/icons.d.ts +97 -0
- package/dist/icons.d.ts.map +1 -0
- package/dist/icons.js +103 -0
- package/dist/icons.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +14 -0
- package/dist/index.js.map +1 -0
- package/dist/insert.d.ts +21 -0
- package/dist/insert.d.ts.map +1 -0
- package/dist/insert.js +129 -0
- package/dist/insert.js.map +1 -0
- package/dist/menu-action.d.ts +73 -0
- package/dist/menu-action.d.ts.map +1 -0
- package/dist/menu-action.js +89 -0
- package/dist/menu-action.js.map +1 -0
- package/dist/mode.d.ts +21 -0
- package/dist/mode.d.ts.map +1 -0
- package/dist/mode.js +17 -0
- package/dist/mode.js.map +1 -0
- package/dist/new-slide.d.ts +21 -0
- package/dist/new-slide.d.ts.map +1 -0
- package/dist/new-slide.js +63 -0
- package/dist/new-slide.js.map +1 -0
- package/dist/page-controls.d.ts +20 -0
- package/dist/page-controls.d.ts.map +1 -0
- package/dist/page-controls.js +99 -0
- package/dist/page-controls.js.map +1 -0
- package/dist/paint.d.ts +52 -0
- package/dist/paint.d.ts.map +1 -0
- package/dist/paint.js +262 -0
- package/dist/paint.js.map +1 -0
- package/dist/ruler.d.ts +10 -0
- package/dist/ruler.d.ts.map +1 -0
- package/dist/ruler.js +97 -0
- package/dist/ruler.js.map +1 -0
- package/dist/state.d.ts +85 -0
- package/dist/state.d.ts.map +1 -0
- package/dist/state.js +28 -0
- package/dist/state.js.map +1 -0
- package/dist/styles.d.ts +2 -0
- package/dist/styles.d.ts.map +1 -0
- package/dist/styles.js +758 -0
- package/dist/styles.js.map +1 -0
- package/dist/tabs.d.ts +11 -0
- package/dist/tabs.d.ts.map +1 -0
- package/dist/tabs.js +153 -0
- package/dist/tabs.js.map +1 -0
- package/dist/text-format.d.ts +114 -0
- package/dist/text-format.d.ts.map +1 -0
- package/dist/text-format.js +315 -0
- package/dist/text-format.js.map +1 -0
- package/dist/tools.d.ts +35 -0
- package/dist/tools.d.ts.map +1 -0
- package/dist/tools.js +41 -0
- package/dist/tools.js.map +1 -0
- package/dist/version.d.ts +2 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +7 -0
- package/dist/version.js.map +1 -0
- package/dist/worker/handlers.d.ts +11 -0
- package/dist/worker/handlers.d.ts.map +1 -0
- package/dist/worker/handlers.js +127 -0
- package/dist/worker/handlers.js.map +1 -0
- package/dist/worker/protocol.d.ts +190 -0
- package/dist/worker/protocol.d.ts.map +1 -0
- package/dist/worker/protocol.js +2 -0
- package/dist/worker/protocol.js.map +1 -0
- package/dist/worker/worker-source.d.ts +3 -0
- package/dist/worker/worker-source.d.ts.map +1 -0
- package/dist/worker/worker-source.js +11 -0
- package/dist/worker/worker.d.ts +2 -0
- package/dist/worker/worker.d.ts.map +1 -0
- package/dist/worker/worker.js +6 -0
- package/dist/worker/worker.js.map +1 -0
- package/package.json +68 -5
package/dist/tools.d.ts
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { ArrangeEdits } from "./arrange.js";
|
|
2
|
+
import type { Clipboard } from "./clipboard.js";
|
|
3
|
+
import type { EditHost } from "./edit-client.js";
|
|
4
|
+
import type { FontPreviewLoader } from "./fonts/preview.js";
|
|
5
|
+
import type { I18n } from "./i18n/index.js";
|
|
6
|
+
import type { PaintEdits, PaintMemory } from "./paint.js";
|
|
7
|
+
import type { ListKind, ListStyle, TextEdits } from "./text-format.js";
|
|
8
|
+
export interface EditTools {
|
|
9
|
+
readonly host: EditHost;
|
|
10
|
+
readonly i18n: I18n;
|
|
11
|
+
readonly paint: PaintEdits;
|
|
12
|
+
readonly text: TextEdits;
|
|
13
|
+
readonly arrange: ArrangeEdits;
|
|
14
|
+
readonly clipboard: Clipboard;
|
|
15
|
+
readonly paintMemory: PaintMemory;
|
|
16
|
+
/** The style each list button's main region applies. */
|
|
17
|
+
readonly lastListStyle: Record<ListKind, ListStyle>;
|
|
18
|
+
/** The font picker's specimens. One loader for edit mode's life — a face
|
|
19
|
+
* loaded into the browser stays loaded across documents. */
|
|
20
|
+
readonly fontPreviews: FontPreviewLoader;
|
|
21
|
+
/** Call `listener` on each batch of specimens landing; returns the unlisten. */
|
|
22
|
+
onSpecimens(listener: () => void): () => void;
|
|
23
|
+
/**
|
|
24
|
+
* Pull the loaded font families — the picker's first section.
|
|
25
|
+
*
|
|
26
|
+
* Unlike the full list this is *not* cached on open: fonts materialize
|
|
27
|
+
* lazily, so the set grows all through a session as compose-ahead walks the
|
|
28
|
+
* document and as fonts are picked. The picker re-pulls on every open, which
|
|
29
|
+
* is a cheap read and the only moment the answer is looked at.
|
|
30
|
+
*/
|
|
31
|
+
refreshLoadedFontFamilies(): Promise<void>;
|
|
32
|
+
}
|
|
33
|
+
/** The {@link EditTools} over `host`. */
|
|
34
|
+
export declare function createEditTools(host: EditHost, i18n: I18n): EditTools;
|
|
35
|
+
//# sourceMappingURL=tools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAEjD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAEhD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAEjD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAE5C,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAG1D,OAAO,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAEvE,MAAM,WAAW,SAAS;IACtB,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;IACpB,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAC;IAC3B,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IACzB,QAAQ,CAAC,OAAO,EAAE,YAAY,CAAC;IAC/B,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC;IAC9B,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAC;IAClC,wDAAwD;IACxD,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;IACpD;iEAC6D;IAC7D,QAAQ,CAAC,YAAY,EAAE,iBAAiB,CAAC;IACzC,gFAAgF;IAChF,WAAW,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC;IAC9C;;;;;;;OAOG;IACH,yBAAyB,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAC9C;AAED,yCAAyC;AACzC,wBAAgB,eAAe,CAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,GAAG,SAAS,CA2BrE"}
|
package/dist/tools.js
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// What edit mode builds on the shell's host once mounted: the edits the ribbon's
|
|
2
|
+
// controls and the menus make, the clipboard, and the write-side memory they
|
|
3
|
+
// share.
|
|
4
|
+
import { createArrangeEdits } from "./arrange.js";
|
|
5
|
+
import { createClipboard } from "./clipboard.js";
|
|
6
|
+
import { createLastListStyle, FONT_SPECIMEN_EM } from "./components/TextControls.js";
|
|
7
|
+
import { createFontPreviewLoader } from "./fonts/preview.js";
|
|
8
|
+
import { createPaintEdits, createPaintMemory } from "./paint.js";
|
|
9
|
+
import { updateEditState } from "./state.js";
|
|
10
|
+
import { createTextEdits } from "./text-format.js";
|
|
11
|
+
/** The {@link EditTools} over `host`. */
|
|
12
|
+
export function createEditTools(host, i18n) {
|
|
13
|
+
const specimenListeners = new Set();
|
|
14
|
+
return {
|
|
15
|
+
host,
|
|
16
|
+
i18n,
|
|
17
|
+
paint: createPaintEdits(host),
|
|
18
|
+
text: createTextEdits(host, i18n),
|
|
19
|
+
arrange: createArrangeEdits(host),
|
|
20
|
+
clipboard: createClipboard(host),
|
|
21
|
+
paintMemory: createPaintMemory(),
|
|
22
|
+
lastListStyle: createLastListStyle(),
|
|
23
|
+
fontPreviews: createFontPreviewLoader({
|
|
24
|
+
render: (family, size) => host.edit.renderFontPreview(family, false, false, family, size).catch(() => null),
|
|
25
|
+
size: FONT_SPECIMEN_EM,
|
|
26
|
+
googleFontEndpoint: host.client.googleFontEndpoint,
|
|
27
|
+
onSpecimens: () => {
|
|
28
|
+
for (const listener of specimenListeners)
|
|
29
|
+
listener();
|
|
30
|
+
},
|
|
31
|
+
}),
|
|
32
|
+
onSpecimens(listener) {
|
|
33
|
+
specimenListeners.add(listener);
|
|
34
|
+
return () => specimenListeners.delete(listener);
|
|
35
|
+
},
|
|
36
|
+
async refreshLoadedFontFamilies() {
|
|
37
|
+
updateEditState(host.store, { loadedFontFamilyNames: await host.edit.loadedFontFamilyNames() });
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=tools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tools.js","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAAA,iFAAiF;AACjF,6EAA6E;AAC7E,SAAS;AACT,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAElD,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEjD,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAErF,OAAO,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAG7D,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAEjE,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AA6BnD,yCAAyC;AACzC,MAAM,UAAU,eAAe,CAAC,IAAc,EAAE,IAAU;IACtD,MAAM,iBAAiB,GAAG,I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C"}
|
package/dist/version.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// Generated by scripts/gen-version.mjs — do not edit.
|
|
2
|
+
//
|
|
3
|
+
// This package's version, reported to the engine as the wrapper version so a
|
|
4
|
+
// permit request and a usage event can name what produced them. Generated from
|
|
5
|
+
// package.json, which is the one place a release bumps.
|
|
6
|
+
export const WRAPPER_VERSION = "0.8.1";
|
|
7
|
+
//# sourceMappingURL=version.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA,sDAAsD;AACtD,EAAE;AACF,6EAA6E;AAC7E,+EAA+E;AAC/E,wDAAwD;AACxD,MAAM,CAAC,MAAM,eAAe,GAAG,OAAO,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { WorkerHandler } from "@docmentis/udoc-ui/worker";
|
|
2
|
+
import type { EditRequest } from "./protocol.js";
|
|
3
|
+
/** A handler for each of edit mode's requests, by type. */
|
|
4
|
+
type EditHandlers = {
|
|
5
|
+
readonly [T in EditRequest["type"]]: WorkerHandler<Extract<EditRequest, {
|
|
6
|
+
type: T;
|
|
7
|
+
}>>;
|
|
8
|
+
};
|
|
9
|
+
export declare const EDIT_HANDLERS: EditHandlers;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=handlers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handlers.d.ts","sourceRoot":"","sources":["../../src/worker/handlers.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAI/D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAEjD,2DAA2D;AAC3D,KAAK,YAAY,GAAG;IAAE,QAAQ,EAAE,CAAC,IAAI,WAAW,CAAC,MAAM,CAAC,GAAG,aAAa,CAAC,OAAO,CAAC,WAAW,EAAE;QAAE,IAAI,EAAE,CAAC,CAAA;KAAE,CAAC,CAAC;CAAE,CAAC;AAE9G,eAAO,MAAM,aAAa,EAAE,YA+H3B,CAAC"}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { Transferring } from "@docmentis/udoc-ui/worker";
|
|
2
|
+
export const EDIT_HANDLERS = {
|
|
3
|
+
setOverflowVisible: {
|
|
4
|
+
sticky: true,
|
|
5
|
+
handle(request, worker) {
|
|
6
|
+
// Sticky in Rust, like the scroll mode. Only the clip changes, so
|
|
7
|
+
// a full repaint paints off-page content in (or clips it out).
|
|
8
|
+
worker.session?.setOverflowVisible(request.visible);
|
|
9
|
+
worker.scheduleFrame();
|
|
10
|
+
},
|
|
11
|
+
},
|
|
12
|
+
setPlaceholderPrompts: {
|
|
13
|
+
sticky: true,
|
|
14
|
+
handle(request, worker) {
|
|
15
|
+
// Sticky in Rust, like the backdrop. Only presentations draw
|
|
16
|
+
// prompts; a full repaint shows/clears them on the next frame.
|
|
17
|
+
worker.session?.setPlaceholderPrompts(request.on);
|
|
18
|
+
worker.scheduleFrame();
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
setFormattingMarks: {
|
|
22
|
+
sticky: true,
|
|
23
|
+
handle(request, worker) {
|
|
24
|
+
// Sticky in Rust, like the backdrop; a full repaint shows or
|
|
25
|
+
// clears the marks on the next frame.
|
|
26
|
+
worker.session?.setFormattingMarks(request.on);
|
|
27
|
+
worker.scheduleFrame();
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
themePalette: {
|
|
31
|
+
// The document's resolved theme palette — a slide's for a deck, the
|
|
32
|
+
// single document theme for a word doc — a pure read. `null` when no
|
|
33
|
+
// document is open or the doc type carries no theme (PDF / image); the
|
|
34
|
+
// host then keeps its stand-in.
|
|
35
|
+
handle(_request, { session }) {
|
|
36
|
+
const json = session?.themePalette();
|
|
37
|
+
return json !== undefined ? JSON.parse(json) : null;
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
fontFamilySummaries: {
|
|
41
|
+
// The whole picker list: a name and a vendor per family, without the
|
|
42
|
+
// faces. `[]` with no document or a doc type with no text font registry
|
|
43
|
+
// (PDF/image).
|
|
44
|
+
handle: (_request, { session }) => (session ? session.fontFamilySummaries() : []),
|
|
45
|
+
},
|
|
46
|
+
loadedFontFamilyNames: {
|
|
47
|
+
// The subset needing no download — read fresh each time, since
|
|
48
|
+
// binaries land throughout the session.
|
|
49
|
+
handle: (_request, { session }) => (session ? session.loadedFontFamilyNames() : []),
|
|
50
|
+
},
|
|
51
|
+
fontFamilies: {
|
|
52
|
+
// The same list carrying each family's faces — for a picker that greys
|
|
53
|
+
// out bold and italic per family. Ours reads the summaries above
|
|
54
|
+
// instead.
|
|
55
|
+
handle: (_request, { session }) => (session ? session.fontFamilies() : []),
|
|
56
|
+
},
|
|
57
|
+
renderFontPreview: {
|
|
58
|
+
// A specimen the browser can't draw itself — an embedded or bundled
|
|
59
|
+
// face, rasterized here as a PNG alpha mask. Small (one short line of
|
|
60
|
+
// text), so it runs inline like the reads above rather than queueing
|
|
61
|
+
// as background work, as the thumbnail strip's renders do.
|
|
62
|
+
//
|
|
63
|
+
// Like `renderThumbnail`, the bytes are moved out of the wasm handle
|
|
64
|
+
// and `slice()`d into a standalone transferable buffer before the
|
|
65
|
+
// handle is freed.
|
|
66
|
+
handle(request, { session }) {
|
|
67
|
+
const image = session?.renderFontPreview(request.family, request.bold, request.italic, request.text, request.size);
|
|
68
|
+
if (!image)
|
|
69
|
+
return null;
|
|
70
|
+
const width = image.width;
|
|
71
|
+
const height = image.height;
|
|
72
|
+
const bleed = image.bleed;
|
|
73
|
+
const png = image.takePng().slice().buffer;
|
|
74
|
+
image.free();
|
|
75
|
+
return new Transferring({ png, width, height, bleed }, [png]);
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
selectionHandlePreview: {
|
|
79
|
+
// Where a dragged geometry handle actually lands — the engine solves its
|
|
80
|
+
// guide, so the host can draw the grip on its own track instead of under
|
|
81
|
+
// the raw cursor. A pure read, no edit, no repaint; `null` when the
|
|
82
|
+
// selection offers no such handle.
|
|
83
|
+
handle: (request, { session }) => session ? (session.selectionHandlePreview(request.index, request.x, request.y) ?? null) : null,
|
|
84
|
+
},
|
|
85
|
+
slideMastersSummary: {
|
|
86
|
+
// A pure read: every slide master, summarized for the New-Slide picker.
|
|
87
|
+
// Empty when there's no open / non-presentation doc. Loads every slide
|
|
88
|
+
// master (to learn its slide layouts), so `&mut`-backed. Lenient like
|
|
89
|
+
// the engine's own reads: a throw reads as none.
|
|
90
|
+
handle(_request, { session }) {
|
|
91
|
+
try {
|
|
92
|
+
return session?.presentation.model.slideMasters.summary() ?? [];
|
|
93
|
+
}
|
|
94
|
+
catch {
|
|
95
|
+
return [];
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
paste: {
|
|
100
|
+
handle(request, worker) {
|
|
101
|
+
const { session } = worker;
|
|
102
|
+
if (!session)
|
|
103
|
+
throw new Error("engine worker: paste before open");
|
|
104
|
+
// Re-insert the fragment's objects with fresh ids — an
|
|
105
|
+
// `InsertObjects` under the hood, so it commits as one undo step
|
|
106
|
+
// and the pasted objects become the selection. The fragment is
|
|
107
|
+
// already doc-type-tagged (from `copy`), so it crosses as-is. A
|
|
108
|
+
// committing edit like `execute`: the layout rides back, the
|
|
109
|
+
// selection re-posts, history updates, repaint.
|
|
110
|
+
session.paste(request.fragment);
|
|
111
|
+
return worker.committed(session);
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
insertImage: {
|
|
115
|
+
handle(request, worker) {
|
|
116
|
+
const { session } = worker;
|
|
117
|
+
if (!session)
|
|
118
|
+
throw new Error("engine worker: insertImage before open");
|
|
119
|
+
// A committing edit like `execute`: the picture lands on the
|
|
120
|
+
// current page and is selected, so the layout rides back, the
|
|
121
|
+
// selection re-posts, history updates, and a repaint redraws.
|
|
122
|
+
session.insertImage(new Uint8Array(request.bytes), request.contentType);
|
|
123
|
+
return worker.committed(session);
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
};
|
|
127
|
+
//# sourceMappingURL=handlers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handlers.js","sourceRoot":"","sources":["../../src/worker/handlers.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAQzD,MAAM,CAAC,MAAM,aAAa,GAAiB;IACvC,kBAAkB,EAAE;QAChB,MAAM,EAAE,IAAI;QACZ,MAAM,CAAC,OAAO,EAAE,MAAM;YAClB,kEAAkE;YAClE,+DAA+D;YAC/D,MAAM,CAAC,OAAO,EAAE,kBAAkB,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;YACpD,MAAM,CAAC,aAAa,EAAE,CAAC;QAC3B,CAAC;KACJ;IACD,qBAAqB,EAAE;QACnB,MAAM,EAAE,IAAI;QACZ,MAAM,CAAC,OAAO,EAAE,MAAM;YAClB,6DAA6D;YAC7D,+DAA+D;YAC/D,MAAM,CAAC,OAAO,EAAE,qBAAqB,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;YAClD,MAAM,CAAC,aAAa,EAAE,CAAC;QAC3B,CAAC;KACJ;IACD,kBAAkB,EAAE;QAChB,MAAM,EAAE,IAAI;QACZ,MAAM,CAAC,OAAO,EAAE,MAAM;YAClB,6DAA6D;YAC7D,sCAAsC;YACtC,MAAM,CAAC,OAAO,EAAE,kBAAkB,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;YAC/C,MAAM,CAAC,aAAa,EAAE,CAAC;QAC3B,CAAC;KACJ;IACD,YAAY,EAAE;QACV,oEAAoE;QACpE,qEAAqE;QACrE,uEAAuE;QACvE,gCAAgC;QAChC,MAAM,CAAC,QAAQ,EAAE,EAAE,OAAO,EAAE;YACxB,MAAM,IAAI,GAAG,OAAO,EAAE,YAAY,EAAE,CAAC;YACrC,OAAO,IAAI,KAAK,SAAS,CAAC,CAAC,CAAE,IAAI,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OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;YAChC,OAAO,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;QACrC,CAAC;KACJ;IACD,WAAW,EAAE;QACT,MAAM,CAAC,OAAO,EAAE,MAAM;YAClB,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,CAAC;YAC3B,IAAI,CAAC,OAAO;gBAAE,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAC;YACxE,6DAA6D;YAC7D,8DAA8D;YAC9D,8DAA8D;YAC9D,OAAO,CAAC,WAAW,CAAC,IAAI,UAAU,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;YACxE,OAAO,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;QACrC,CAAC;KACJ;CACJ,CAAC"}
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
import type { UDocFragment } from "@docmentis/udoc-wasm";
|
|
2
|
+
/**
|
|
3
|
+
* Set whether content overflowing the page bounds is drawn. When on, an object
|
|
4
|
+
* that runs off the page stays visible within the spread (the viewport in paged
|
|
5
|
+
* view, or the page plus half the inter-page gap in continuous); when off it is
|
|
6
|
+
* clipped to the page. Sticky like the view mode — re-applied to every
|
|
7
|
+
* subsequently opened document. Latest-wins, fire-and-forget.
|
|
8
|
+
*/
|
|
9
|
+
export interface SetOverflowVisibleRequest {
|
|
10
|
+
type: "setOverflowVisible";
|
|
11
|
+
visible: boolean;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Toggle empty-placeholder authoring chrome — the dashed frame and "Click to
|
|
15
|
+
* add …" prompt an empty presentation placeholder shows while being edited. On
|
|
16
|
+
* in edit mode, off in a reading view (an empty placeholder then renders blank).
|
|
17
|
+
* Sticky like the backdrop: re-applied to every subsequently opened document.
|
|
18
|
+
* A no-op for doc types without placeholders. Latest-wins, fire-and-forget.
|
|
19
|
+
*/
|
|
20
|
+
export interface SetPlaceholderPromptsRequest {
|
|
21
|
+
type: "setPlaceholderPrompts";
|
|
22
|
+
on: boolean;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Toggle formatting marks — `¶` at each paragraph mark, a dot in each space, an
|
|
26
|
+
* arrow in each tab and `↵` at each line break — drawn over composed text in the
|
|
27
|
+
* space it already holds, so showing them never reflows. On while the user asks
|
|
28
|
+
* for them in edit mode. Sticky like the backdrop: re-applied to every
|
|
29
|
+
* subsequently opened document. Latest-wins, fire-and-forget.
|
|
30
|
+
*/
|
|
31
|
+
export interface SetFormattingMarksRequest {
|
|
32
|
+
type: "setFormattingMarks";
|
|
33
|
+
on: boolean;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Read the current slide's resolved theme color palette — the mapped scheme
|
|
37
|
+
* slots the color picker shows as "Theme Colors" — a pure read. Replies with a
|
|
38
|
+
* `ThemePalette`, or `null` for a doc type
|
|
39
|
+
* without a theme (only presentations carry one). Re-pulled on open and
|
|
40
|
+
* whenever the viewed slide changes, since a multi-master deck re-themes per
|
|
41
|
+
* slide.
|
|
42
|
+
*/
|
|
43
|
+
export interface ThemePaletteRequest {
|
|
44
|
+
type: "themePalette";
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Read every font family available to the open document, sorted by name, with
|
|
48
|
+
* its `sourceType` and **without** its faces — the picker's list. Replies with a
|
|
49
|
+
* `FontFamilySummary[]`; empty when no document is open or the doc type has no
|
|
50
|
+
* text font registry (PDF composes its own embedded font programs; an image has
|
|
51
|
+
* no text).
|
|
52
|
+
*
|
|
53
|
+
* A picker draws a row per family and needs two things: what to call it, and
|
|
54
|
+
* which vendor it comes from — `Local` / `Url` / `Google` the browser can load
|
|
55
|
+
* into its own text stack, and the rest go through
|
|
56
|
+
* {@link RenderFontPreviewRequest}. {@link FontFamiliesRequest} is the same list
|
|
57
|
+
* carrying the faces too, for a picker that greys out bold and italic per
|
|
58
|
+
* family; at ~1800 families those are three quarters of the payload. Stable
|
|
59
|
+
* across the session, so pull this once on open and cache it.
|
|
60
|
+
*/
|
|
61
|
+
export interface FontFamilySummariesRequest {
|
|
62
|
+
type: "fontFamilySummaries";
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Read the families that are **loaded** — parsed and in hand this moment — a
|
|
66
|
+
* subset of {@link FontFamilySummariesRequest}'s answer, in the same order. Replies
|
|
67
|
+
* with a `string[]`.
|
|
68
|
+
*
|
|
69
|
+
* The set the document has actually used: fonts materialize lazily, so a family
|
|
70
|
+
* arrives here when something resolves to it, whether it was bundled all along
|
|
71
|
+
* or just finished downloading. Unlike the full list this is **not** stable — it
|
|
72
|
+
* grows as the document composes and as fonts are picked — so pull it whenever
|
|
73
|
+
* the picker is about to be shown rather than caching it on open. It orders the
|
|
74
|
+
* list and gates nothing.
|
|
75
|
+
*/
|
|
76
|
+
export interface LoadedFontFamilyNamesRequest {
|
|
77
|
+
type: "loadedFontFamilyNames";
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Read every font family available to the open document, sorted by name, each
|
|
81
|
+
* with its faces and its **default source type** — the picker's list when it
|
|
82
|
+
* needs more than the names. Replies with a `FontFamily[]`; empty when no
|
|
83
|
+
* document is open or the doc type has no text font registry.
|
|
84
|
+
*
|
|
85
|
+
* `sourceType` is what a picker showing specimens reads: `Local` / `Url` /
|
|
86
|
+
* `Google` are families the browser can load into its own text stack, and
|
|
87
|
+
* `Embedded` / `OfficeCompatible` / `AdobeStandard` have no bytes outside wasm
|
|
88
|
+
* and go through {@link RenderFontPreviewRequest}. Stable across the session,
|
|
89
|
+
* so pull it once on open and cache it.
|
|
90
|
+
*/
|
|
91
|
+
export interface FontFamiliesRequest {
|
|
92
|
+
type: "fontFamilies";
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Draw one family's name in its own face, as a PNG **alpha mask** — the picker
|
|
96
|
+
* row for a family the browser can't load itself. Replies with the PNG bytes
|
|
97
|
+
* plus the CSS box to draw them in, or `null` when nothing shaped.
|
|
98
|
+
*
|
|
99
|
+
* The color is flat black and carries nothing; only the coverage matters. The
|
|
100
|
+
* host points a CSS `mask-image` at it over `currentColor`, so the specimen
|
|
101
|
+
* takes the theme's text color and a light/dark switch needs no redraw. The PNG
|
|
102
|
+
* is rendered at the device pixel ratio behind the returned box.
|
|
103
|
+
*/
|
|
104
|
+
export interface RenderFontPreviewRequest {
|
|
105
|
+
type: "renderFontPreview";
|
|
106
|
+
family: string;
|
|
107
|
+
bold: boolean;
|
|
108
|
+
italic: boolean;
|
|
109
|
+
/** What to draw — usually the family's own name. */
|
|
110
|
+
text: string;
|
|
111
|
+
/** The em, in CSS px. */
|
|
112
|
+
size: number;
|
|
113
|
+
}
|
|
114
|
+
/** {@link RenderFontPreviewRequest}'s answer: a PNG mask and its CSS box. */
|
|
115
|
+
export interface FontPreviewImage {
|
|
116
|
+
/** PNG bytes whose alpha channel is the glyph coverage — transferred, like
|
|
117
|
+
* a thumbnail's pixels, rather than copied. */
|
|
118
|
+
png: ArrayBuffer;
|
|
119
|
+
/** The width to give the element, in CSS px. */
|
|
120
|
+
width: number;
|
|
121
|
+
/** The height to give the element, in CSS px. */
|
|
122
|
+
height: number;
|
|
123
|
+
/**
|
|
124
|
+
* The transparent bleed baked into every side, in CSS px.
|
|
125
|
+
*
|
|
126
|
+
* The box is grown all round to hold ink that overhangs the advances (an
|
|
127
|
+
* italic's ascender, a script face's tail), so the raster's left edge sits
|
|
128
|
+
* one of these left of where the pen started. Offset the element by
|
|
129
|
+
* `-bleed` to line the specimen up with ordinary text at the same em.
|
|
130
|
+
*/
|
|
131
|
+
bleed: number;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Read every slide master, summarized for the New-Slide picker: its id, its
|
|
135
|
+
* slide layouts' ids, and the layout **plane** it renders on. A pure read
|
|
136
|
+
* (though it loads every slide master to learn its slide layouts). Replies with
|
|
137
|
+
* the parsed {@link import("@docmentis/udoc-wasm").SlideMasterSummary} list.
|
|
138
|
+
*/
|
|
139
|
+
export interface SlideMastersSummaryRequest {
|
|
140
|
+
type: "slideMastersSummary";
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Paste a {@link import("@docmentis/udoc-wasm").UDocFragment} the host
|
|
144
|
+
* read back off the system clipboard — the fragment's objects are re-inserted with
|
|
145
|
+
* fresh ids onto the selection's page (else the current page) and become the
|
|
146
|
+
* selection. A committing edit (one undo step), so it replies with the document's
|
|
147
|
+
* layout like udoc-ui's `ExecuteRequest`, schedules a repaint, and re-posts the
|
|
148
|
+
* selection in a `SelectionReport`.
|
|
149
|
+
*/
|
|
150
|
+
export interface PasteRequest {
|
|
151
|
+
type: "paste";
|
|
152
|
+
fragment: UDocFragment;
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Insert the image file `bytes` as a picture on the current page, centred and
|
|
156
|
+
* scaled down to fit, and select it. `contentType` is the file's MIME type
|
|
157
|
+
* (`image/png`, …); an empty one is read from the bytes' own signature. The
|
|
158
|
+
* image is an opaque part (docs/design/core-editor-opaque-part.md): its bytes never enter
|
|
159
|
+
* the CRDT. A committing edit (one undo step), so it replies with the
|
|
160
|
+
* document's layout like udoc-ui's `ExecuteRequest`, schedules a repaint, and
|
|
161
|
+
* re-posts the selection in a `SelectionReport`.
|
|
162
|
+
*/
|
|
163
|
+
export interface InsertImageRequest {
|
|
164
|
+
type: "insertImage";
|
|
165
|
+
bytes: ArrayBuffer;
|
|
166
|
+
contentType: string;
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Where geometry handle `index` of the selection's `handles` would land if it
|
|
170
|
+
* were dragged to `(x, y)` — a point in that handle's **own local space**
|
|
171
|
+
* (document points, the space the streamed handle's `point` is in), not CSS px.
|
|
172
|
+
*
|
|
173
|
+
* A handle doesn't follow the pointer: it travels the track its geometry
|
|
174
|
+
* describes (a corner radius along one edge, a callout's tail on an arc) and
|
|
175
|
+
* stops at the ends of its range. Only the engine can say where it lands, so the
|
|
176
|
+
* host asks rather than drawing the grip under the raw cursor. A pure read —
|
|
177
|
+
* nothing is written until the drag commits — called **latest-wins** on pointer
|
|
178
|
+
* move, one in flight. Replies with the whole `SelectionHandle`, so the
|
|
179
|
+
* caller substitutes it for the streamed one and draws it through the same
|
|
180
|
+
* projection; `null` when the selection offers no such handle.
|
|
181
|
+
*/
|
|
182
|
+
export interface SelectionHandlePreviewRequest {
|
|
183
|
+
type: "selectionHandlePreview";
|
|
184
|
+
index: number;
|
|
185
|
+
x: number;
|
|
186
|
+
y: number;
|
|
187
|
+
}
|
|
188
|
+
/** A request edit mode's worker answers beyond the engine's own. */
|
|
189
|
+
export type EditRequest = SetOverflowVisibleRequest | SetPlaceholderPromptsRequest | SetFormattingMarksRequest | ThemePaletteRequest | FontFamilySummariesRequest | LoadedFontFamilyNamesRequest | FontFamiliesRequest | RenderFontPreviewRequest | SlideMastersSummaryRequest | PasteRequest | InsertImageRequest | SelectionHandlePreviewRequest;
|
|
190
|
+
//# sourceMappingURL=protocol.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../../src/worker/protocol.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEzD;;;;;;GAMG;AACH,MAAM,WAAW,yBAAyB;IACtC,IAAI,EAAE,oBAAoB,CAAC;IAC3B,OAAO,EAAE,OAAO,CAAC;CACpB;AAED;;;;;;GAMG;AACH,MAAM,WAAW,4BAA4B;IACzC,IAAI,EAAE,uBAAuB,CAAC;IAC9B,EAAE,EAAE,OAAO,CAAC;CACf;AAED;;;;;;GAMG;AACH,MAAM,WAAW,yBAAyB;IACtC,IAAI,EAAE,oBAAoB,CAAC;IAC3B,EAAE,EAAE,OAAO,CAAC;CACf;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,mBAAmB;IAChC,IAAI,EAAE,cAAc,CAAC;CACxB;AAED;;;;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MAAM,CAAC;CACb;AAED,oEAAoE;AACpE,MAAM,MAAM,WAAW,GACjB,yBAAyB,GACzB,4BAA4B,GAC5B,yBAAyB,GACzB,mBAAmB,GACnB,0BAA0B,GAC1B,4BAA4B,GAC5B,mBAAmB,GACnB,wBAAwB,GACxB,0BAA0B,GAC1B,YAAY,GACZ,kBAAkB,GAClB,6BAA6B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"protocol.js","sourceRoot":"","sources":["../../src/worker/protocol.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"worker-source.d.ts","sourceRoot":"","sources":["../../src/worker/worker-source.ts"],"names":[],"mappings":"AAcA,6CAA6C;AAC7C,wBAAgB,iBAAiB,IAAI,MAAM,CAE1C"}
|