@medway-ui/native 1.11.0 → 1.13.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.
Files changed (36) hide show
  1. package/README.md +1 -0
  2. package/lib/commonjs/components/TextMarker.js +485 -0
  3. package/lib/commonjs/components/TextMarker.js.map +1 -0
  4. package/lib/commonjs/editor/NoteEditor.js +29 -152
  5. package/lib/commonjs/editor/NoteEditor.js.map +1 -1
  6. package/lib/commonjs/editor/editorHtml.generated.js +1 -1
  7. package/lib/commonjs/editor/editorHtml.generated.js.map +1 -1
  8. package/lib/commonjs/editor/protocol.js +2 -3
  9. package/lib/commonjs/editor/protocol.js.map +1 -1
  10. package/lib/commonjs/index.js +19 -0
  11. package/lib/commonjs/index.js.map +1 -1
  12. package/lib/module/components/TextMarker.js +479 -0
  13. package/lib/module/components/TextMarker.js.map +1 -0
  14. package/lib/module/editor/NoteEditor.js +32 -155
  15. package/lib/module/editor/NoteEditor.js.map +1 -1
  16. package/lib/module/editor/editorHtml.generated.js +1 -1
  17. package/lib/module/editor/editorHtml.generated.js.map +1 -1
  18. package/lib/module/editor/protocol.js +2 -3
  19. package/lib/module/editor/protocol.js.map +1 -1
  20. package/lib/module/index.js +2 -0
  21. package/lib/module/index.js.map +1 -1
  22. package/lib/typescript/components/TextMarker.d.ts +94 -0
  23. package/lib/typescript/components/TextMarker.d.ts.map +1 -0
  24. package/lib/typescript/editor/NoteEditor.d.ts +1 -1
  25. package/lib/typescript/editor/NoteEditor.d.ts.map +1 -1
  26. package/lib/typescript/editor/editorHtml.generated.d.ts.map +1 -1
  27. package/lib/typescript/editor/protocol.d.ts +2 -10
  28. package/lib/typescript/editor/protocol.d.ts.map +1 -1
  29. package/lib/typescript/index.d.ts +2 -0
  30. package/lib/typescript/index.d.ts.map +1 -1
  31. package/package.json +2 -2
  32. package/src/components/TextMarker.tsx +696 -0
  33. package/src/editor/NoteEditor.tsx +10 -192
  34. package/src/editor/editorHtml.generated.ts +1 -1
  35. package/src/editor/protocol.ts +2 -8
  36. package/src/index.ts +14 -0
@@ -18,8 +18,6 @@ import type {
18
18
  EditorDocument,
19
19
  EditorSelectionState,
20
20
  EditorTheme,
21
- SlashCommandId,
22
- SlashMenuState,
23
21
  } from '@medway-ui/notes-core';
24
22
 
25
23
  /**
@@ -27,7 +25,7 @@ import type {
27
25
  * talk to a bundle that reports a different version, which turns a stale
28
26
  * `editorHtml.generated.ts` into a clear error instead of silent breakage.
29
27
  */
30
- export const EDITOR_PROTOCOL_VERSION = 4;
28
+ export const EDITOR_PROTOCOL_VERSION = 5;
31
29
 
32
30
  /** Name of the global the WebView bundle installs to receive native messages. */
33
31
  export const EDITOR_RECEIVE_HANDLER = '__medwayNoteEditorReceive';
@@ -67,8 +65,6 @@ export type NativeToEditorMessage =
67
65
  | { type: 'scrollCaretIntoView' }
68
66
  | { type: 'command'; command: EditorCommand }
69
67
  | { type: 'getDocument'; requestId: string }
70
- | { type: 'runSlashCommand'; commandId: SlashCommandId }
71
- | { type: 'dismissSlash' }
72
68
  | { type: 'focus'; position: 'start' | 'end' }
73
69
  | { type: 'blur' }
74
70
  /**
@@ -89,7 +85,6 @@ export type EditorToNativeMessage =
89
85
  revision: number;
90
86
  doc: EditorDocument;
91
87
  }
92
- | { type: 'slash'; slash: SlashMenuState }
93
88
  /**
94
89
  * Height of the rendered document, in CSS pixels. Only meaningful when
95
90
  * embedded: the WebView does not scroll there, so React Native has to size it
@@ -126,7 +121,7 @@ const isFiniteNumber = (value: unknown): value is number =>
126
121
  * `doc`/`requestId`, or a `ready` without `protocol`, is rejected here instead
127
122
  * of blowing up at the use site.
128
123
  *
129
- * `state`, `slash` and `doc` are checked as objects rather than field by field:
124
+ * `state` and `doc` are checked as objects rather than field by field:
130
125
  * their shapes belong to `@medway-ui/notes-core` and are validated there — for
131
126
  * `doc`, by the `normalizeDocument` pass the native side runs before handing a
132
127
  * document to the host.
@@ -142,7 +137,6 @@ const EDITOR_MESSAGE_VALIDATORS: Record<
142
137
  isString(message.requestId) &&
143
138
  isFiniteNumber(message.revision) &&
144
139
  isRecord(message.doc),
145
- slash: (message) => isRecord(message.slash),
146
140
  resize: (message) => isFiniteNumber(message.height),
147
141
  linkPress: (message) => isString(message.href),
148
142
  backspaceAtDocStart: () => true,
package/src/index.ts CHANGED
@@ -459,6 +459,20 @@ export type {
459
459
  ToastVariant,
460
460
  } from "@/components/Toast";
461
461
 
462
+ // TextMarker
463
+ export {
464
+ TEXT_MARKER_COLORS,
465
+ TextMarker,
466
+ textMarkerMarkVariants,
467
+ } from "@/components/TextMarker";
468
+ export type {
469
+ TextMarkerAnchor,
470
+ TextMarkerColor,
471
+ TextMarkerLabels,
472
+ TextMarkerMode,
473
+ TextMarkerProps,
474
+ } from "@/components/TextMarker";
475
+
462
476
  // Tooltip
463
477
  export {
464
478
  Tooltip,