superdoc-macros 0.5.0 → 0.7.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 +2 -2
- package/dist/host/superdoc-host.js +61 -0
- package/dist/index.d.ts +4 -4
- package/dist/index.js +4 -4
- package/dist/manager.d.ts +46 -3
- package/dist/manager.js +202 -88
- package/dist/messages.d.ts +3 -0
- package/dist/messages.js +6 -0
- package/dist/recorder/recorder.d.ts +43 -18
- package/dist/recorder/recorder.js +108 -13
- package/dist/shortcuts.d.ts +21 -0
- package/dist/shortcuts.js +38 -1
- package/dist/snippets/autotext.js +39 -8
- package/dist/snippets/snippets.d.ts +6 -0
- package/dist/snippets/snippets.js +11 -5
- package/dist/storage.d.ts +15 -5
- package/dist/storage.js +44 -8
- package/dist/types.d.ts +23 -0
- package/package.json +1 -1
package/dist/types.d.ts
CHANGED
|
@@ -38,6 +38,15 @@ export type TextInputEvent = {
|
|
|
38
38
|
kind: 'delete-backward';
|
|
39
39
|
} | {
|
|
40
40
|
kind: 'delete-forward';
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* The caret moved by pointer or navigation keys. Not an edit — the
|
|
44
|
+
* recorder records no step — but both consumers depend on it: auto-text
|
|
45
|
+
* resets its typed-word buffer (the buffer no longer describes what sits
|
|
46
|
+
* before the caret), and the recorder stops coalescing across it.
|
|
47
|
+
*/
|
|
48
|
+
| {
|
|
49
|
+
kind: 'caret-moved';
|
|
41
50
|
};
|
|
42
51
|
/**
|
|
43
52
|
* What the toolkit needs from the editor. The SuperDoc v2 implementation is
|
|
@@ -62,6 +71,20 @@ export interface MacroHost {
|
|
|
62
71
|
getSelection(options?: {
|
|
63
72
|
includeText?: boolean;
|
|
64
73
|
}): Promise<SelectionSnapshot>;
|
|
74
|
+
/**
|
|
75
|
+
* The `count` characters immediately before the caret, or `null` when the
|
|
76
|
+
* host cannot tell. Auto-text verifies the document actually holds the
|
|
77
|
+
* trigger word before deleting it — the buffer alone can lie after a
|
|
78
|
+
* caret move the host failed to report.
|
|
79
|
+
*/
|
|
80
|
+
getTextBefore?(count: number): Promise<string | null>;
|
|
81
|
+
/**
|
|
82
|
+
* Atomically replaces the `expected.length` characters before the caret
|
|
83
|
+
* with `replacement` — verifying they equal `expected` first, all inside
|
|
84
|
+
* one engine transaction. Auto-text prefers this over delete+insert: two
|
|
85
|
+
* operations leave the trigger deleted when the second fails.
|
|
86
|
+
*/
|
|
87
|
+
replaceTextBefore?(expected: string, replacement: string): Promise<MacroOutcome>;
|
|
65
88
|
/** Replaces every occurrence of `query` with `replacement`. Returns how many were replaced. */
|
|
66
89
|
replaceAll(query: string, replacement: string): Promise<{
|
|
67
90
|
ok: boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "superdoc-macros",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "Macro toolkit for SuperDoc-based editors: sandboxed scripted macros, a Word-style macro recorder, and snippets with auto-text expansion.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|