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/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.5.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",