@medway-ui/native 1.2.0 → 1.3.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 (33) hide show
  1. package/lib/commonjs/editor/NoteEditor.js +710 -0
  2. package/lib/commonjs/editor/NoteEditor.js.map +1 -0
  3. package/lib/commonjs/editor/editorHtml.generated.js +21 -0
  4. package/lib/commonjs/editor/editorHtml.generated.js.map +1 -0
  5. package/lib/commonjs/editor/index.js +33 -0
  6. package/lib/commonjs/editor/index.js.map +1 -0
  7. package/lib/commonjs/editor/protocol.js +88 -0
  8. package/lib/commonjs/editor/protocol.js.map +1 -0
  9. package/lib/module/editor/NoteEditor.js +705 -0
  10. package/lib/module/editor/NoteEditor.js.map +1 -0
  11. package/lib/module/editor/editorHtml.generated.js +17 -0
  12. package/lib/module/editor/editorHtml.generated.js.map +1 -0
  13. package/lib/module/editor/index.js +5 -0
  14. package/lib/module/editor/index.js.map +1 -0
  15. package/lib/module/editor/protocol.js +83 -0
  16. package/lib/module/editor/protocol.js.map +1 -0
  17. package/lib/module/index.js +6 -0
  18. package/lib/module/index.js.map +1 -1
  19. package/lib/typescript/editor/NoteEditor.d.ts +82 -0
  20. package/lib/typescript/editor/NoteEditor.d.ts.map +1 -0
  21. package/lib/typescript/editor/editorHtml.generated.d.ts +13 -0
  22. package/lib/typescript/editor/editorHtml.generated.d.ts.map +1 -0
  23. package/lib/typescript/editor/index.d.ts +6 -0
  24. package/lib/typescript/editor/index.d.ts.map +1 -0
  25. package/lib/typescript/editor/protocol.d.ts +153 -0
  26. package/lib/typescript/editor/protocol.d.ts.map +1 -0
  27. package/package.json +24 -1
  28. package/setup/metro.js +27 -5
  29. package/src/editor/NoteEditor.tsx +802 -0
  30. package/src/editor/editorHtml.generated.ts +14 -0
  31. package/src/editor/index.ts +13 -0
  32. package/src/editor/protocol.ts +184 -0
  33. package/src/index.ts +6 -0
@@ -0,0 +1 @@
1
+ {"version":3,"names":["EDITOR_HTML"],"sourceRoot":"../../../src","sources":["editor/editorHtml.generated.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAO,MAAMA,WAAmB,GAAG,i5haAAi5ha","ignoreList":[]}
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ export { default as NoteEditor } from "./NoteEditor";
4
+ export { EDITOR_PROTOCOL_VERSION, EDITOR_RECEIVE_HANDLER, isEditorMessage } from "./protocol";
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["default","NoteEditor","EDITOR_PROTOCOL_VERSION","EDITOR_RECEIVE_HANDLER","isEditorMessage"],"sourceRoot":"../../../src","sources":["editor/index.ts"],"mappings":";;AAAA,SAASA,OAAO,IAAIC,UAAU,QAAQ,cAAc;AAIpD,SACEC,uBAAuB,EACvBC,sBAAsB,EACtBC,eAAe,QACV,YAAY","ignoreList":[]}
@@ -0,0 +1,83 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * Transport between React Native and the Tiptap editor inside the WebView. Both
5
+ * sides compile against this file — the bundle imports it through the `@/`
6
+ * alias in `editor-bundle/vite.config.ts`.
7
+ *
8
+ * Invariants:
9
+ * - The document never crosses the bridge on keystrokes: the editor emits
10
+ * `change` with a revision counter, and the native side asks with
11
+ * `getDocument`.
12
+ * - Every message is validated on arrival (`isEditorMessage`: envelope plus the
13
+ * required fields of its variant) — the WebView renders student content, so
14
+ * its output is untrusted input. Documents get a second pass through
15
+ * `normalizeDocument` before reaching the host.
16
+ */
17
+
18
+ /**
19
+ * Bumped whenever the message shapes below change. The native side refuses to
20
+ * talk to a bundle that reports a different version, which turns a stale
21
+ * `editorHtml.generated.ts` into a clear error instead of silent breakage.
22
+ */
23
+ export const EDITOR_PROTOCOL_VERSION = 3;
24
+
25
+ /** Name of the global the WebView bundle installs to receive native messages. */
26
+ export const EDITOR_RECEIVE_HANDLER = '__medwayNoteEditorReceive';
27
+ const isRecord = value => typeof value === 'object' && value !== null && !Array.isArray(value);
28
+ const isString = value => typeof value === 'string';
29
+
30
+ /** Rejects `NaN` and the infinities, which `JSON.parse` can still produce. */
31
+ const isFiniteNumber = value => typeof value === 'number' && Number.isFinite(value);
32
+
33
+ /*
34
+ * `Record<Union, …>` rather than an array so it is exhaustive: adding a variant
35
+ * to `EditorToNativeMessage` without listing it here stops compiling, instead
36
+ * of letting `isEditorMessage` reject the new type at runtime — which would
37
+ * look like the message never arrived, not like a build error.
38
+ *
39
+ * Each entry checks the fields its own variant declares, so narrowing to the
40
+ * union is backed by the payload and not by `type` alone: a `document` without
41
+ * `doc`/`requestId`, or a `ready` without `protocol`, is rejected here instead
42
+ * of blowing up at the use site.
43
+ *
44
+ * `state`, `slash` and `doc` are checked as objects rather than field by field:
45
+ * their shapes belong to `@medway-ui/notes-core` and are validated there — for
46
+ * `doc`, by the `normalizeDocument` pass the native side runs before handing a
47
+ * document to the host.
48
+ */
49
+ const EDITOR_MESSAGE_VALIDATORS = {
50
+ ready: message => isFiniteNumber(message.protocol),
51
+ state: message => isRecord(message.state),
52
+ change: message => isFiniteNumber(message.revision),
53
+ document: message => isString(message.requestId) && isFiniteNumber(message.revision) && isRecord(message.doc),
54
+ slash: message => isRecord(message.slash),
55
+ resize: message => isFiniteNumber(message.height),
56
+ linkPress: message => isString(message.href),
57
+ backspaceAtDocStart: () => true,
58
+ imageRemoved: message => isString(message.src),
59
+ error: message => isString(message.message)
60
+ };
61
+
62
+ /**
63
+ * Guard for anything arriving from the WebView: checks the envelope *and* the
64
+ * required fields of the variant its `type` names. Establishes the shape, not
65
+ * the contents — a `document` payload's `doc` still goes through
66
+ * `normalizeDocument` before the native side hands it to the host.
67
+ */
68
+ export const isEditorMessage = value => {
69
+ if (!isRecord(value)) return false;
70
+ const {
71
+ type
72
+ } = value;
73
+ if (typeof type !== 'string') return false;
74
+
75
+ // `hasOwnProperty`, not `in`: `in` walks the prototype chain, so a `type` of
76
+ // `"toString"` or `"constructor"` matches any plain object literal.
77
+ // `Object.hasOwn` would read better but is ES2022 and `lib` here is ES2020.
78
+ if (!Object.prototype.hasOwnProperty.call(EDITOR_MESSAGE_VALIDATORS, type)) {
79
+ return false;
80
+ }
81
+ return EDITOR_MESSAGE_VALIDATORS[type](value);
82
+ };
83
+ //# sourceMappingURL=protocol.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["EDITOR_PROTOCOL_VERSION","EDITOR_RECEIVE_HANDLER","isRecord","value","Array","isArray","isString","isFiniteNumber","Number","isFinite","EDITOR_MESSAGE_VALIDATORS","ready","message","protocol","state","change","revision","document","requestId","doc","slash","resize","height","linkPress","href","backspaceAtDocStart","imageRemoved","src","error","isEditorMessage","type","Object","prototype","hasOwnProperty","call"],"sourceRoot":"../../../src","sources":["editor/protocol.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAWA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMA,uBAAuB,GAAG,CAAC;;AAExC;AACA,OAAO,MAAMC,sBAAsB,GAAG,2BAA2B;AAmFjE,MAAMC,QAAQ,GAAIC,KAAc,IAC9B,OAAOA,KAAK,KAAK,QAAQ,IAAIA,KAAK,KAAK,IAAI,IAAI,CAACC,KAAK,CAACC,OAAO,CAACF,KAAK,CAAC;AAEtE,MAAMG,QAAQ,GAAIH,KAAc,IAAsB,OAAOA,KAAK,KAAK,QAAQ;;AAE/E;AACA,MAAMI,cAAc,GAAIJ,KAAc,IACpC,OAAOA,KAAK,KAAK,QAAQ,IAAIK,MAAM,CAACC,QAAQ,CAACN,KAAK,CAAC;;AAErD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMO,yBAGL,GAAG;EACFC,KAAK,EAAGC,OAAO,IAAKL,cAAc,CAACK,OAAO,CAACC,QAAQ,CAAC;EACpDC,KAAK,EAAGF,OAAO,IAAKV,QAAQ,CAACU,OAAO,CAACE,KAAK,CAAC;EAC3CC,MAAM,EAAGH,OAAO,IAAKL,cAAc,CAACK,OAAO,CAACI,QAAQ,CAAC;EACrDC,QAAQ,EAAGL,OAAO,IAChBN,QAAQ,CAACM,OAAO,CAACM,SAAS,CAAC,IAC3BX,cAAc,CAACK,OAAO,CAACI,QAAQ,CAAC,IAChCd,QAAQ,CAACU,OAAO,CAACO,GAAG,CAAC;EACvBC,KAAK,EAAGR,OAAO,IAAKV,QAAQ,CAACU,OAAO,CAACQ,KAAK,CAAC;EAC3CC,MAAM,EAAGT,OAAO,IAAKL,cAAc,CAACK,OAAO,CAACU,MAAM,CAAC;EACnDC,SAAS,EAAGX,OAAO,IAAKN,QAAQ,CAACM,OAAO,CAACY,IAAI,CAAC;EAC9CC,mBAAmB,EAAEA,CAAA,KAAM,IAAI;EAC/BC,YAAY,EAAGd,OAAO,IAAKN,QAAQ,CAACM,OAAO,CAACe,GAAG,CAAC;EAChDC,KAAK,EAAGhB,OAAO,IAAKN,QAAQ,CAACM,OAAO,CAACA,OAAO;AAC9C,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMiB,eAAe,GAC1B1B,KAAc,IACqB;EACnC,IAAI,CAACD,QAAQ,CAACC,KAAK,CAAC,EAAE,OAAO,KAAK;EAElC,MAAM;IAAE2B;EAAK,CAAC,GAAG3B,KAAK;EACtB,IAAI,OAAO2B,IAAI,KAAK,QAAQ,EAAE,OAAO,KAAK;;EAE1C;EACA;EACA;EACA,IAAI,CAACC,MAAM,CAACC,SAAS,CAACC,cAAc,CAACC,IAAI,CAACxB,yBAAyB,EAAEoB,IAAI,CAAC,EAAE;IAC1E,OAAO,KAAK;EACd;EAEA,OAAOpB,yBAAyB,CAACoB,IAAI,CAAkC,CACrE3B,KACF,CAAC;AACH,CAAC","ignoreList":[]}
@@ -77,4 +77,10 @@ export { useToast, toast } from "@/hooks/use-toast";
77
77
  export { useThemeColor } from "@/hooks/useThemeColor";
78
78
  // Theme-aware icon helper
79
79
  export { ThemedIcon } from "@/components/ThemedIcon";
80
+
81
+ // NoteEditor is deliberately absent from this barrel: it pulls in
82
+ // `react-native-webview` (an optional peer) and the 428 KB inlined editor HTML,
83
+ // which Metro does not reliably tree-shake — every consumer of this package
84
+ // would carry both. It ships as the `@medway-ui/native/note-editor` subpath
85
+ // instead. Message types alone live at `@medway-ui/native/editor/protocol`.
80
86
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["Alert","AlertActions","AlertButton","alertButtonVariants","AlertContainer","AlertContent","AlertDescription","AlertIcon","AlertTitle","alertVariants","Badge","badgeVariants","Avatar","AvatarFallback","AvatarImage","avatarVariants","FallbackImage","CardNews","CardNewsAuthor","CardNewsBody","CardNewsContent","CardNewsDate","CardNewsDescription","CardNewsFooter","CardNewsHeader","CardNewsImage","CardNewsResourceItem","CardNewsResources","CardNewsSkeleton","CardNewsTags","CardNewsTitle","EmptyState","PageHeader","Carousel","CarouselMediaSlide","CarouselMetricSlide","DropdownMenu","DropdownMenuContent","DropdownMenuGroup","DropdownMenuItem","DropdownMenuSeparator","DropdownMenuTrigger","Feed","FeedComposer","FeedTitle","FeedNotice","InvitePopover","InvitePopoverCard","InvitePopoverClose","InvitePopoverContent","InvitePopoverDivider","InvitePopoverEmailRow","InvitePopoverSendButton","InvitePopoverShareButton","InvitePopoverTitle","InvitePopoverTrigger","LeaderboardCard","LeaderboardCardHeader","LeaderboardCardList","MemberRow","memberRowVariants","rankIndicatorVariants","PostForm","PostFormCheckboxOption","PostFormDateTimeField","PostFormDescription","PostFormHeader","PostFormMediaPicker","PrizeCollection","PrizeCollectionStats","PrizeCollectionStatsItem","PrizeItem","PrizeRow","PrizeShelf","Text","resolveMontserratFamily","SectionHeader","Button","buttonVariants","buttonTextVariants","Checkbox","checkboxVariants","Input","InputAdornment","applyInputIconSize","InputEndIcon","InputField","InputLabel","InputNumeric","InputPassword","InputStartIcon","InputText","InputWrapper","inputVariants","Label","labelVariants","labelTextVariants","Loading","Skeleton","RadioGroup","RadioGroupItem","RadioGroupList","RadioGroupListItem","radioGroupVariants","Select","SelectContent","SelectGroup","SelectHeader","SelectItem","SelectLabel","SelectScrollDownButton","SelectScrollUpButton","SelectSeparator","SelectText","SelectTrigger","SelectValue","SelectWrapper","selectVariants","Separator","Switch","switchVariants","AlertDialog","AlertDialogAction","AlertDialogCancel","AlertDialogContent","AlertDialogDescription","AlertDialogFooter","AlertDialogHeader","AlertDialogIcon","AlertDialogOverlay","AlertDialogPortal","AlertDialogTag","AlertDialogTitle","AlertDialogTrigger","Dialog","DialogClose","DialogContainer","DialogContent","DialogDescription","DialogFooter","DialogHeader","DialogOverlay","DialogPortal","DialogTitle","DialogTrigger","Popover","PopoverClose","PopoverContent","PopoverTrigger","Sheet","SheetClose","SheetContainer","SheetContent","SheetDescription","SheetFooter","SheetHeader","SheetTitle","SheetTrigger","Tag","tagVariants","tagTextVariants","Tabs","TabsContent","TabsList","TabsTrigger","tabsTriggerVariants","Toast","ToastAction","ToastClose","ToastDescription","ToastProvider","ToastTitle","ToastViewport","toastVariants","Tooltip","TooltipContent","TooltipProvider","TooltipTrigger","useToast","toast","useThemeColor","ThemedIcon"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;AAAA;AACA,SACEA,KAAK,EACLC,YAAY,EACZC,WAAW,EACXC,mBAAmB,EACnBC,cAAc,EACdC,YAAY,EACZC,gBAAgB,EAChBC,SAAS,EACTC,UAAU,EACVC,aAAa,QACR,oBAAoB;AAG3B;AACA,SAASC,KAAK,EAAEC,aAAa,QAAQ,oBAAoB;AAGzD;AACA,SACEC,MAAM,EACNC,cAAc,EACdC,WAAW,EACXC,cAAc,QACT,qBAAqB;AAO5B;AACA,SAASC,aAAa,QAAQ,4BAA4B;AAG1D;AACA,SACEC,QAAQ,EACRC,cAAc,EACdC,YAAY,EACZC,eAAe,EACfC,YAAY,EACZC,mBAAmB,EACnBC,cAAc,EACdC,cAAc,EACdC,aAAa,EACbC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UAAU,EACVC,YAAY,QACP,oBAAoB;AAQ3B;AACA,SAASC,GAAG,EAAEC,WAAW,EAAEC,eAAe,QAAQ,kBAAkB;AAGpE;AACA,SACEC,IAAI,EACJC,WAAW,EACXC,QAAQ,EACRC,WAAW,EACXC,mBAAmB,QACd,mBAAmB;AAS1B;AACA,SACEC,KAAK,EACLC,WAAW,EACXC,UAAU,EACVC,gBAAgB,EAChBC,aAAa,EACbC,UAAU,EACVC,aAAa,EACbC,aAAa,QACR,oBAAoB;AAG3B;AACA,SACEC,OAAO,EACPC,cAAc,EACdC,eAAe,EACfC,cAAc,QACT,sBAAsB;AAG7B;AACA,SAASC,QAAQ,EAAEC,KAAK,QAAQ,mBAAmB;AACnD,SAASC,aAAa,QAAQ,uBAAuB;AAGrD;AACA,SAASC,UAAU,QAAQ,yBAAyB","ignoreList":[]}
1
+ {"version":3,"names":["Alert","AlertActions","AlertButton","alertButtonVariants","AlertContainer","AlertContent","AlertDescription","AlertIcon","AlertTitle","alertVariants","Badge","badgeVariants","Avatar","AvatarFallback","AvatarImage","avatarVariants","FallbackImage","CardNews","CardNewsAuthor","CardNewsBody","CardNewsContent","CardNewsDate","CardNewsDescription","CardNewsFooter","CardNewsHeader","CardNewsImage","CardNewsResourceItem","CardNewsResources","CardNewsSkeleton","CardNewsTags","CardNewsTitle","EmptyState","PageHeader","Carousel","CarouselMediaSlide","CarouselMetricSlide","DropdownMenu","DropdownMenuContent","DropdownMenuGroup","DropdownMenuItem","DropdownMenuSeparator","DropdownMenuTrigger","Feed","FeedComposer","FeedTitle","FeedNotice","InvitePopover","InvitePopoverCard","InvitePopoverClose","InvitePopoverContent","InvitePopoverDivider","InvitePopoverEmailRow","InvitePopoverSendButton","InvitePopoverShareButton","InvitePopoverTitle","InvitePopoverTrigger","LeaderboardCard","LeaderboardCardHeader","LeaderboardCardList","MemberRow","memberRowVariants","rankIndicatorVariants","PostForm","PostFormCheckboxOption","PostFormDateTimeField","PostFormDescription","PostFormHeader","PostFormMediaPicker","PrizeCollection","PrizeCollectionStats","PrizeCollectionStatsItem","PrizeItem","PrizeRow","PrizeShelf","Text","resolveMontserratFamily","SectionHeader","Button","buttonVariants","buttonTextVariants","Checkbox","checkboxVariants","Input","InputAdornment","applyInputIconSize","InputEndIcon","InputField","InputLabel","InputNumeric","InputPassword","InputStartIcon","InputText","InputWrapper","inputVariants","Label","labelVariants","labelTextVariants","Loading","Skeleton","RadioGroup","RadioGroupItem","RadioGroupList","RadioGroupListItem","radioGroupVariants","Select","SelectContent","SelectGroup","SelectHeader","SelectItem","SelectLabel","SelectScrollDownButton","SelectScrollUpButton","SelectSeparator","SelectText","SelectTrigger","SelectValue","SelectWrapper","selectVariants","Separator","Switch","switchVariants","AlertDialog","AlertDialogAction","AlertDialogCancel","AlertDialogContent","AlertDialogDescription","AlertDialogFooter","AlertDialogHeader","AlertDialogIcon","AlertDialogOverlay","AlertDialogPortal","AlertDialogTag","AlertDialogTitle","AlertDialogTrigger","Dialog","DialogClose","DialogContainer","DialogContent","DialogDescription","DialogFooter","DialogHeader","DialogOverlay","DialogPortal","DialogTitle","DialogTrigger","Popover","PopoverClose","PopoverContent","PopoverTrigger","Sheet","SheetClose","SheetContainer","SheetContent","SheetDescription","SheetFooter","SheetHeader","SheetTitle","SheetTrigger","Tag","tagVariants","tagTextVariants","Tabs","TabsContent","TabsList","TabsTrigger","tabsTriggerVariants","Toast","ToastAction","ToastClose","ToastDescription","ToastProvider","ToastTitle","ToastViewport","toastVariants","Tooltip","TooltipContent","TooltipProvider","TooltipTrigger","useToast","toast","useThemeColor","ThemedIcon"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;AAAA;AACA,SACEA,KAAK,EACLC,YAAY,EACZC,WAAW,EACXC,mBAAmB,EACnBC,cAAc,EACdC,YAAY,EACZC,gBAAgB,EAChBC,SAAS,EACTC,UAAU,EACVC,aAAa,QACR,oBAAoB;AAG3B;AACA,SAASC,KAAK,EAAEC,aAAa,QAAQ,oBAAoB;AAGzD;AACA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a,EACbC,YAAY,EACZC,WAAW,EACXC,aAAa,QACR,qBAAqB;AAQ5B;AACA,SACEC,OAAO,EACPC,YAAY,EACZC,cAAc,EACdC,cAAc,QACT,sBAAsB;AAG7B;AACA,SACEC,KAAK,EACLC,UAAU,EACVC,cAAc,EACdC,YAAY,EACZC,gBAAgB,EAChBC,WAAW,EACXC,WAAW,EACXC,UAAU,EACVC,YAAY,QACP,oBAAoB;AAQ3B;AACA,SAASC,GAAG,EAAEC,WAAW,EAAEC,eAAe,QAAQ,kBAAkB;AAGpE;AACA,SACEC,IAAI,EACJC,WAAW,EACXC,QAAQ,EACRC,WAAW,EACXC,mBAAmB,QACd,mBAAmB;AAS1B;AACA,SACEC,KAAK,EACLC,WAAW,EACXC,UAAU,EACVC,gBAAgB,EAChBC,aAAa,EACbC,UAAU,EACVC,aAAa,EACbC,aAAa,QACR,oBAAoB;AAG3B;AACA,SACEC,OAAO,EACPC,cAAc,EACdC,eAAe,EACfC,cAAc,QACT,sBAAsB;AAG7B;AACA,SAASC,QAAQ,EAAEC,KAAK,QAAQ,mBAAmB;AACnD,SAASC,aAAa,QAAQ,uBAAuB;AAGrD;AACA,SAASC,UAAU,QAAQ,yBAAyB;;AAGpD;AACA;AACA;AACA;AACA","ignoreList":[]}
@@ -0,0 +1,82 @@
1
+ import type { EditorDocument } from "@medway-ui/notes-core";
2
+ /**
3
+ * What `getSaveData` returns. No `html` field, unlike web: generating HTML needs
4
+ * a DOM, which never exists outside the WebView here. Persist `json` and render
5
+ * HTML backend-side if needed.
6
+ */
7
+ export type NoteEditorValue = {
8
+ title: string;
9
+ json: EditorDocument;
10
+ };
11
+ /**
12
+ * Same shape as the web `NoteEditor`'s handle, minus `editor` (no in-process
13
+ * Tiptap instance to hand out) and with the document getters async, since
14
+ * reading the document is a bridge round trip here.
15
+ */
16
+ export type NoteEditorHandle = {
17
+ focus: (position?: "start" | "end") => void;
18
+ blur: () => void;
19
+ getDocument: () => Promise<EditorDocument>;
20
+ getSaveData: () => Promise<NoteEditorValue>;
21
+ setDocument: (doc: EditorDocument | string, options?: {
22
+ focus?: boolean;
23
+ }) => void;
24
+ };
25
+ type NoteEditorProps = {
26
+ /**
27
+ * Initial document: the note's JSON, or an HTML string (parsed bundle-side,
28
+ * the only side with a DOM). Changing it replaces the content but keeps the
29
+ * instance — pass a new React `key` for a fresh undo stack, as when
30
+ * switching notes.
31
+ */
32
+ document?: EditorDocument | string;
33
+ /** Initial title, shown above the content in its own always-visible area. */
34
+ initialTitle?: string;
35
+ titlePlaceholder?: string;
36
+ onChange?: (doc: EditorDocument) => void;
37
+ editable?: boolean;
38
+ /** Focuses the title if `initialTitle` is empty, otherwise the content. */
39
+ autofocus?: boolean | "start" | "end";
40
+ /** Shows the formatting bar above the editor. */
41
+ toolbar?: boolean;
42
+ /**
43
+ * Resolves with the URL to use as the image's `src`, or `null` if the host's
44
+ * picker was cancelled. **Different shape from the web prop**: there is no
45
+ * file input here and this package carries no image-picker dependency, so
46
+ * picking the file is the host's job. Providing it is what enables the
47
+ * toolbar "Imagem" button and the `/Imagem` slash command.
48
+ */
49
+ onImageUpload?: () => Promise<{
50
+ src: string;
51
+ alt?: string | null;
52
+ } | null>;
53
+ /**
54
+ * Fires when an image inserted this session leaves the document and stays out
55
+ * past the grace period. Tracked bundle-side (`editor-bundle/src/main.ts`).
56
+ */
57
+ onImageRemoved?: (src: string) => void;
58
+ /** Default 4000ms. */
59
+ imageDeleteGraceMs?: number;
60
+ /**
61
+ * Native-only. The WebView never navigates, so the host decides what to open
62
+ * (e.g. `Linking.openURL` after validating the URL).
63
+ */
64
+ onLinkPress?: (href: string) => void;
65
+ /**
66
+ * Native-only. Starting height in dp for embedded mode: the editor sits in a
67
+ * native scroll container, does not scroll itself, and is resized to the
68
+ * height it reports over the bridge. Omit to let the WebView fill and scroll
69
+ * its own parent.
70
+ */
71
+ height?: number;
72
+ /**
73
+ * Native-only. Applied to the container and the WebView; match the host theme
74
+ * to avoid a flash before the WebView paints its own document background
75
+ * (Android is particularly sensitive).
76
+ */
77
+ backgroundColor?: string;
78
+ testID?: string;
79
+ };
80
+ declare const _default: import("react").NamedExoticComponent<NoteEditorProps & import("react").RefAttributes<NoteEditorHandle>>;
81
+ export default _default;
82
+ //# sourceMappingURL=NoteEditor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NoteEditor.d.ts","sourceRoot":"","sources":["../../../src/editor/NoteEditor.tsx"],"names":[],"mappings":"AA6BA,OAAO,KAAK,EAEV,cAAc,EAKf,MAAM,uBAAuB,CAAC;AAiE/B;;;;GAIG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,cAAc,CAAC;CACtB,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,KAAK,EAAE,CAAC,QAAQ,CAAC,EAAE,OAAO,GAAG,KAAK,KAAK,IAAI,CAAC;IAC5C,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,WAAW,EAAE,MAAM,OAAO,CAAC,cAAc,CAAC,CAAC;IAC3C,WAAW,EAAE,MAAM,OAAO,CAAC,eAAe,CAAC,CAAC;IAC5C,WAAW,EAAE,CACX,GAAG,EAAE,cAAc,GAAG,MAAM,EAC5B,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE,KAC1B,IAAI,CAAC;CACX,CAAC;AAEF,KAAK,eAAe,GAAG;IACrB;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,cAAc,GAAG,MAAM,CAAC;IACnC,6EAA6E;IAC7E,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,EAAE,CAAC,GAAG,EAAE,cAAc,KAAK,IAAI,CAAC;IACzC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,2EAA2E;IAC3E,SAAS,CAAC,EAAE,OAAO,GAAG,OAAO,GAAG,KAAK,CAAC;IACtC,iDAAiD;IACjD,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;;;OAMG;IACH,aAAa,CAAC,EAAE,MAAM,OAAO,CAAC;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,GAAG,IAAI,CAAC,CAAC;IAC3E;;;OAGG;IACH,cAAc,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,sBAAsB;IACtB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B;;;OAGG;IACH,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC;;;;;OAKG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;OAIG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;;AA+mBF,wBAAgC"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * GENERATED FILE — DO NOT EDIT.
3
+ *
4
+ * Single-file build of the Tiptap editor that runs inside the WebView rendered
5
+ * by `@medway-ui/native/NoteEditor`. Regenerate with:
6
+ *
7
+ * cd editor-bundle && npm install && npm run build
8
+ *
9
+ * Source lives in `editor-bundle/src`. The bridge protocol it speaks is defined
10
+ * in `../native/src/editor/protocol.ts`, which both sides compile against.
11
+ */
12
+ export declare const EDITOR_HTML: string;
13
+ //# sourceMappingURL=editorHtml.generated.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"editorHtml.generated.d.ts","sourceRoot":"","sources":["../../../src/editor/editorHtml.generated.ts"],"names":[],"mappings":"AACA;;;;;;;;;;GAUG;AAEH,eAAO,MAAM,WAAW,EAAE,MAA05ha,CAAC"}
@@ -0,0 +1,6 @@
1
+ export { default as NoteEditor } from "./NoteEditor";
2
+ export type { NoteEditorHandle } from "./NoteEditor";
3
+ export type { WebViewMessageEvent } from "react-native-webview";
4
+ export { EDITOR_PROTOCOL_VERSION, EDITOR_RECEIVE_HANDLER, isEditorMessage, } from "./protocol";
5
+ export type { EditorToNativeMessage, NativeToEditorMessage, } from "./protocol";
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/editor/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,cAAc,CAAC;AACrD,YAAY,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACrD,YAAY,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAEhE,OAAO,EACL,uBAAuB,EACvB,sBAAsB,EACtB,eAAe,GAChB,MAAM,YAAY,CAAC;AACpB,YAAY,EACV,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,YAAY,CAAC"}
@@ -0,0 +1,153 @@
1
+ /**
2
+ * Transport between React Native and the Tiptap editor inside the WebView. Both
3
+ * sides compile against this file — the bundle imports it through the `@/`
4
+ * alias in `editor-bundle/vite.config.ts`.
5
+ *
6
+ * Invariants:
7
+ * - The document never crosses the bridge on keystrokes: the editor emits
8
+ * `change` with a revision counter, and the native side asks with
9
+ * `getDocument`.
10
+ * - Every message is validated on arrival (`isEditorMessage`: envelope plus the
11
+ * required fields of its variant) — the WebView renders student content, so
12
+ * its output is untrusted input. Documents get a second pass through
13
+ * `normalizeDocument` before reaching the host.
14
+ */
15
+ import type { EditorCommand, EditorDocument, EditorSelectionState, EditorTheme, SlashCommandId, SlashMenuState } from '@medway-ui/notes-core';
16
+ /**
17
+ * Bumped whenever the message shapes below change. The native side refuses to
18
+ * talk to a bundle that reports a different version, which turns a stale
19
+ * `editorHtml.generated.ts` into a clear error instead of silent breakage.
20
+ */
21
+ export declare const EDITOR_PROTOCOL_VERSION = 3;
22
+ /** Name of the global the WebView bundle installs to receive native messages. */
23
+ export declare const EDITOR_RECEIVE_HANDLER = "__medwayNoteEditorReceive";
24
+ export type NativeToEditorMessage =
25
+ /**
26
+ * `reset` rebuilds the editor instance instead of replacing the running one's
27
+ * content — required when opening a *different* note, since replacing content
28
+ * carries the previous note's undo stack over.
29
+ *
30
+ * `doc` accepts HTML as well as JSON; parse (`generateJSON`) and whitelist
31
+ * (`normalizeDocument`) happen bundle-side, the only side with a DOM.
32
+ *
33
+ * `focusPosition` defaults to `"end"`. `imageDeleteGraceMs` seeds the bundle's
34
+ * image-removal bookkeeping; read once, not reactive.
35
+ */
36
+ {
37
+ type: 'setContent';
38
+ doc: EditorDocument | string;
39
+ focus: boolean;
40
+ focusPosition?: 'start' | 'end';
41
+ reset?: boolean;
42
+ imageDeleteGraceMs?: number;
43
+ /**
44
+ * Read only on the `reset` path. Set here instead of creating editable
45
+ * and following up with `setEditable`, which would let a read-only note
46
+ * flash as editable for one frame. Defaults to `true`.
47
+ */
48
+ editable?: boolean;
49
+ } | {
50
+ type: 'setEditable';
51
+ editable: boolean;
52
+ } | {
53
+ type: 'setTheme';
54
+ theme: EditorTheme;
55
+ }
56
+ /**
57
+ * `embedded` means the editor is inside a native scroll container: it stops
58
+ * filling the viewport and starts reporting `resize`, so React Native can
59
+ * size the WebView to the document instead of nesting two scrollers.
60
+ */
61
+ | {
62
+ type: 'setLayout';
63
+ embedded: boolean;
64
+ } | {
65
+ type: 'scrollCaretIntoView';
66
+ } | {
67
+ type: 'command';
68
+ command: EditorCommand;
69
+ } | {
70
+ type: 'getDocument';
71
+ requestId: string;
72
+ } | {
73
+ type: 'runSlashCommand';
74
+ commandId: SlashCommandId;
75
+ } | {
76
+ type: 'dismissSlash';
77
+ } | {
78
+ type: 'focus';
79
+ position: 'start' | 'end';
80
+ } | {
81
+ type: 'blur';
82
+ }
83
+ /**
84
+ * Inserts an image node at the current selection, once the host's
85
+ * `onImageUpload` resolved with a `src`. The bundle also starts tracking that
86
+ * `src` as "uploaded this session" — see `imageRemoved` below.
87
+ */
88
+ | {
89
+ type: 'insertImage';
90
+ src: string;
91
+ alt?: string | null;
92
+ };
93
+ export type EditorToNativeMessage = {
94
+ type: 'ready';
95
+ protocol: number;
96
+ } | {
97
+ type: 'state';
98
+ state: EditorSelectionState;
99
+ }
100
+ /** Content changed. `revision` increases monotonically, never resets. */
101
+ | {
102
+ type: 'change';
103
+ revision: number;
104
+ } | {
105
+ type: 'document';
106
+ requestId: string;
107
+ revision: number;
108
+ doc: EditorDocument;
109
+ } | {
110
+ type: 'slash';
111
+ slash: SlashMenuState;
112
+ }
113
+ /**
114
+ * Height of the rendered document, in CSS pixels. Only meaningful when
115
+ * embedded: the WebView does not scroll there, so React Native has to size it
116
+ * to its content.
117
+ */
118
+ | {
119
+ type: 'resize';
120
+ height: number;
121
+ }
122
+ /** A link inside the note was tapped; the native side decides what to open. */
123
+ | {
124
+ type: 'linkPress';
125
+ href: string;
126
+ }
127
+ /**
128
+ * Backspace with the selection collapsed at the first cursor position of the
129
+ * document. `NoteEditor` uses this to hand focus back to its title field —
130
+ * the inverse of the title's own Enter handler.
131
+ */
132
+ | {
133
+ type: 'backspaceAtDocStart';
134
+ }
135
+ /**
136
+ * A `src` that `insertImage` added this session left the document and stayed
137
+ * out past the grace period (`imageDeleteGraceMs`).
138
+ */
139
+ | {
140
+ type: 'imageRemoved';
141
+ src: string;
142
+ } | {
143
+ type: 'error';
144
+ message: string;
145
+ };
146
+ /**
147
+ * Guard for anything arriving from the WebView: checks the envelope *and* the
148
+ * required fields of the variant its `type` names. Establishes the shape, not
149
+ * the contents — a `document` payload's `doc` still goes through
150
+ * `normalizeDocument` before the native side hands it to the host.
151
+ */
152
+ export declare const isEditorMessage: (value: unknown) => value is EditorToNativeMessage;
153
+ //# sourceMappingURL=protocol.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../../../src/editor/protocol.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EACV,aAAa,EACb,cAAc,EACd,oBAAoB,EAC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C,GAAG,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,CAAC;AAE9D,MAAM,MAAM,qBAAqB,GAC7B;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,GACnC;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,oBAAoB,CAAA;CAAE;AAChD,yEAAyE;GACvE;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,GACpC;IACE,IAAI,EAAE,UAAU,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,GAAG,EAAE,cAAc,CAAC;CACrB,GACD;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,cAAc,CAAA;CAAE;AAC1C;;;;GAIG;GACD;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE;AACpC,+EAA+E;GAC7E;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE;AACrC;;;;GAIG;GACD;IAAE,IAAI,EAAE,qBAAqB,CAAA;CAAE;AACjC;;;GAGG;GACD;IAAE,IAAI,EAAE,cAAc,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,GACrC;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AA8CvC;;;;;GAKG;AACH,eAAO,MAAM,eAAe,GAC1B,OAAO,OAAO,KACb,KAAK,IAAI,qBAgBX,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@medway-ui/native",
3
- "version": "1.2.0",
3
+ "version": "1.3.0",
4
4
  "description": "Medway UI components for React Native (iOS/Android via Expo)",
5
5
  "author": "Alekcarvalho",
6
6
  "license": "MIT",
@@ -16,6 +16,18 @@
16
16
  "require": "./lib/commonjs/index.js",
17
17
  "default": "./lib/module/index.js"
18
18
  },
19
+ "./note-editor": {
20
+ "types": "./lib/typescript/editor/index.d.ts",
21
+ "react-native": "./lib/module/editor/index.js",
22
+ "require": "./lib/commonjs/editor/index.js",
23
+ "default": "./lib/module/editor/index.js"
24
+ },
25
+ "./editor/protocol": {
26
+ "types": "./lib/typescript/editor/protocol.d.ts",
27
+ "react-native": "./lib/module/editor/protocol.js",
28
+ "require": "./lib/commonjs/editor/protocol.js",
29
+ "default": "./lib/module/editor/protocol.js"
30
+ },
19
31
  "./setup": {
20
32
  "types": "./setup/index.ts",
21
33
  "react-native": "./setup/index.ts",
@@ -38,7 +50,9 @@
38
50
  "./setup/global.css"
39
51
  ],
40
52
  "scripts": {
53
+ "prebuild:lib": "npm --prefix .. run build:notes-core",
41
54
  "build:lib": "bob build",
55
+ "pretypecheck": "npm --prefix .. run build:notes-core",
42
56
  "typecheck": "tsc --noEmit",
43
57
  "release": "yarn build:lib && npm publish --access public"
44
58
  },
@@ -60,6 +74,7 @@
60
74
  "peerDependencies": {
61
75
  "@medway-ui/core": ">=1.0.0",
62
76
  "@medway-ui/icons": "^1.0.2",
77
+ "@medway-ui/notes-core": ">=0.1.0",
63
78
  "@react-navigation/native": ">=6.0.0",
64
79
  "@react-navigation/native-stack": ">=6.0.0",
65
80
  "class-variance-authority": "^0.7.1",
@@ -69,6 +84,7 @@
69
84
  "react-native": ">=0.73.0",
70
85
  "react-native-reanimated": ">=3.0.0",
71
86
  "react-native-svg": ">=15.0.0",
87
+ "react-native-webview": ">=13.0.0",
72
88
  "tailwind-merge": "^3.2.0"
73
89
  },
74
90
  "peerDependenciesMeta": {
@@ -84,8 +100,14 @@
84
100
  "@medway-ui/core": {
85
101
  "optional": true
86
102
  },
103
+ "@medway-ui/notes-core": {
104
+ "optional": true
105
+ },
87
106
  "@react-navigation/native-stack": {
88
107
  "optional": true
108
+ },
109
+ "react-native-webview": {
110
+ "optional": true
89
111
  }
90
112
  },
91
113
  "devDependencies": {
@@ -101,6 +123,7 @@
101
123
  "react-native-builder-bob": "^0.30.0",
102
124
  "react-native-reanimated": "^4.4.0",
103
125
  "react-native-svg": "^15.15.5",
126
+ "react-native-webview": "^14.0.1",
104
127
  "tailwind-merge": "^3.2.0",
105
128
  "typescript": "^5"
106
129
  },
package/setup/metro.js CHANGED
@@ -1,6 +1,18 @@
1
1
  const fs = require('fs');
2
2
  const path = require('path');
3
3
 
4
+ /**
5
+ * Subpaths whose `exports` entry points at `lib/` — the bob build output, which
6
+ * is gitignored and therefore absent in a `file:`/sibling checkout. They get the
7
+ * same source redirect as the package root, keyed explicitly rather than by
8
+ * prefix so that `setup`, `metro`, `tailwind` and `babel-brownfield` — published
9
+ * as-is, not built — keep resolving normally.
10
+ */
11
+ const NATIVE_SOURCE_SUBPATHS = {
12
+ '@medway-ui/native/note-editor': 'editor/index.ts',
13
+ '@medway-ui/native/editor/protocol': 'editor/protocol.ts',
14
+ };
15
+
4
16
  function loadWithNativeWind(projectRoot) {
5
17
  return require(require.resolve('nativewind/metro', { paths: [projectRoot] }))
6
18
  .withNativeWind;
@@ -215,11 +227,21 @@ function withMedwayUi(config, options = {}) {
215
227
  const defaultResolveRequest = config.resolver.resolveRequest;
216
228
 
217
229
  config.resolver.resolveRequest = (context, moduleName, platform) => {
218
- if (resolveNativeSource && moduleName === '@medway-ui/native') {
219
- return {
220
- filePath: path.resolve(medwayUiNativeSrc, 'index.ts'),
221
- type: 'sourceFile',
222
- };
230
+ if (resolveNativeSource) {
231
+ if (moduleName === '@medway-ui/native') {
232
+ return {
233
+ filePath: path.resolve(medwayUiNativeSrc, 'index.ts'),
234
+ type: 'sourceFile',
235
+ };
236
+ }
237
+
238
+ const sourceSubpath = NATIVE_SOURCE_SUBPATHS[moduleName];
239
+ if (sourceSubpath) {
240
+ return {
241
+ filePath: path.resolve(medwayUiNativeSrc, sourceSubpath),
242
+ type: 'sourceFile',
243
+ };
244
+ }
223
245
  }
224
246
 
225
247
  if (isMedwayUiOrigin(context.originModulePath)) {