@opengeni/react-native 4.2.1-canary.39593846423001 → 4.3.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.
Files changed (41) hide show
  1. package/android/build.gradle +15 -0
  2. package/android/src/main/AndroidManifest.xml +1 -0
  3. package/android/src/main/java/dev/opengeni/textselection/OpenGeniTextSelectionModule.kt +274 -0
  4. package/dist/{chunk-D3MFBDVR.js → chunk-2RNMGRTB.js} +3 -3
  5. package/dist/{chunk-D3MFBDVR.js.map → chunk-2RNMGRTB.js.map} +1 -1
  6. package/dist/{chunk-2W74OY6I.js → chunk-FHPMRXIG.js} +16 -2
  7. package/dist/chunk-FHPMRXIG.js.map +1 -0
  8. package/dist/{chunk-63PZ52YJ.js → chunk-QFV5DISV.js} +38 -5
  9. package/dist/chunk-QFV5DISV.js.map +1 -0
  10. package/dist/{chunk-U5L2CUMJ.js → chunk-ZZNZBZWV.js} +3 -3
  11. package/dist/{chunk-U5L2CUMJ.js.map → chunk-ZZNZBZWV.js.map} +1 -1
  12. package/dist/index.js +2 -2
  13. package/dist/timeline/activity.d.ts +3 -1
  14. package/dist/timeline/annotations.d.ts +81 -0
  15. package/dist/timeline/icon-nodes.generated.d.ts +5 -0
  16. package/dist/timeline/index.d.ts +2 -0
  17. package/dist/timeline/index.js +1223 -203
  18. package/dist/timeline/index.js.map +1 -1
  19. package/dist/timeline/markdown.js +5 -2
  20. package/dist/timeline/markdown.js.map +1 -1
  21. package/dist/timeline/message-timeline.d.ts +20 -2
  22. package/dist/timeline/previews.js +2 -2
  23. package/dist/timeline/primitives.d.ts +7 -1
  24. package/dist/timeline/queue-dock.d.ts +4 -1
  25. package/dist/timeline/text-selection.d.ts +44 -0
  26. package/expo-module.config.json +5 -2
  27. package/ios/OpenGeniTextSelectionModule.swift +560 -0
  28. package/package.json +6 -4
  29. package/src/timeline/activity.tsx +76 -21
  30. package/src/timeline/annotations.tsx +877 -0
  31. package/src/timeline/icon-nodes.generated.ts +14 -0
  32. package/src/timeline/index.ts +2 -0
  33. package/src/timeline/markdown.tsx +7 -0
  34. package/src/timeline/message-timeline.tsx +340 -174
  35. package/src/timeline/primitives.tsx +50 -1
  36. package/src/timeline/queue-dock.tsx +36 -0
  37. package/src/timeline/session-screen.tsx +122 -4
  38. package/src/timeline/sheet.tsx +3 -2
  39. package/src/timeline/text-selection.ts +115 -0
  40. package/dist/chunk-2W74OY6I.js.map +0 -1
  41. package/dist/chunk-63PZ52YJ.js.map +0 -1
@@ -0,0 +1,81 @@
1
+ import type { DraftTimelineAnnotation, TimelineAnnotation, TimelineAnnotationSource } from "@opengeni/sdk";
2
+ import { type ComponentRef, type ReactNode } from "react";
3
+ import { View, type StyleProp, type ViewStyle } from "react-native";
4
+ import { type QuoteAnchorQuery } from "./text-selection.js";
5
+ export type NativeAnnotationLike = DraftTimelineAnnotation | TimelineAnnotation;
6
+ /**
7
+ * Reveals a quote in the timeline: scrolls its words into view and flashes
8
+ * them (the whole message when they can't be located). False when the
9
+ * message is not loaded.
10
+ */
11
+ export type AnnotationReveal = (source: TimelineAnnotationSource, quote?: QuoteAnchorQuery) => boolean;
12
+ /** The text a revealed quote is found by. */
13
+ export declare function annotationQuoteQuery(annotation: NativeAnnotationLike): QuoteAnchorQuery;
14
+ type DraftMarker = {
15
+ id: string;
16
+ ordinal: number;
17
+ incomplete: boolean;
18
+ quote: string;
19
+ before: string;
20
+ after: string;
21
+ };
22
+ export type AnnotationSourceNode = ComponentRef<typeof View>;
23
+ type AnnotationSourcesValue = {
24
+ register: (sourceKey: string, node: AnnotationSourceNode | null) => void;
25
+ flash: AnnotationFlash | null;
26
+ drafts: ReadonlyMap<string, readonly DraftMarker[]>;
27
+ onSelectDraft?: ((id: string) => void) | undefined;
28
+ };
29
+ /** A reveal's highlight: one message, and the quote in it when known. */
30
+ export type AnnotationFlash = {
31
+ sourceKey: string;
32
+ token: number;
33
+ quote?: QuoteAnchorQuery;
34
+ };
35
+ export declare const AnnotationSourcesContext: import("react").Context<AnnotationSourcesValue | null>;
36
+ /** Draft annotations grouped by the message they quote. */
37
+ export declare function draftMarkersBySource(annotations: readonly DraftTimelineAnnotation[] | undefined): Map<string, DraftMarker[]>;
38
+ /**
39
+ * A message body that can be quoted: marks its text for native selection
40
+ * (Add note), shows a numbered badge where each draft quote ends (the web's
41
+ * annotation markers) and briefly highlights when a quote of it is revealed.
42
+ */
43
+ export declare function AnnotationSourceView({ sourceKey, children, style, }: {
44
+ sourceKey: string | undefined;
45
+ children: ReactNode;
46
+ style?: StyleProp<ViewStyle>;
47
+ }): import("react").JSX.Element;
48
+ /** The quotes and notes a sent message carries, inside its bubble. */
49
+ export declare function SentAnnotationCards({ annotations, onReveal, }: {
50
+ annotations: readonly NativeAnnotationLike[];
51
+ onReveal?: AnnotationReveal | undefined;
52
+ }): import("react").JSX.Element | null;
53
+ /**
54
+ * The "N annotations" chip: in the composer (editable, with remove all) or on
55
+ * a queued message (compact). Tinted while a quote still needs its note.
56
+ */
57
+ export declare function AnnotationsChip({ annotations, onPress, onClear, compact, }: {
58
+ annotations: readonly NativeAnnotationLike[];
59
+ onPress: () => void;
60
+ onClear?: (() => void) | undefined;
61
+ compact?: boolean | undefined;
62
+ }): import("react").JSX.Element | null;
63
+ /**
64
+ * Every quote with its note, as the web's annotations dialog: editable in the
65
+ * composer (write, remove; Return moves to the next empty note, then back to
66
+ * the message), read-only for a queued message. A quote reveals its message.
67
+ */
68
+ export declare function AnnotationsSheet({ open, onClose, annotations, editable, focusId, onFocusConsumed, onUpdate, onRemove, onReveal, onCommit, }: {
69
+ open: boolean;
70
+ onClose: () => void;
71
+ annotations: readonly NativeAnnotationLike[];
72
+ editable: boolean;
73
+ focusId?: string | null | undefined;
74
+ onFocusConsumed?: (() => void) | undefined;
75
+ onUpdate?: ((id: string, note: string) => void) | undefined;
76
+ onRemove?: ((id: string) => void) | undefined;
77
+ onReveal?: AnnotationReveal | undefined;
78
+ /** Every note is written: back to the message. */
79
+ onCommit?: (() => void) | undefined;
80
+ }): import("react").JSX.Element;
81
+ export {};
@@ -383,6 +383,11 @@ export declare const iconNodes: {
383
383
  }], readonly ["path", {
384
384
  readonly d: "M 12 5v14";
385
385
  }]];
386
+ readonly quote: readonly [readonly ["path", {
387
+ readonly d: "M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z";
388
+ }], readonly ["path", {
389
+ readonly d: "M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z";
390
+ }]];
386
391
  readonly search: readonly [readonly ["path", {
387
392
  readonly d: "m21 21-4.34-4.34";
388
393
  }], readonly ["circle", {
@@ -16,6 +16,8 @@ export type { NativeTimelineMessages } from "./messages.js";
16
16
  export { ComposerPill, SessionComposer } from "./composer.js";
17
17
  export { ModelPickerSheet } from "./model-picker.js";
18
18
  export { BottomSheet } from "./sheet.js";
19
+ export { AnnotationsChip, AnnotationsSheet } from "./annotations.js";
20
+ export type { AnnotationReveal, NativeAnnotationLike } from "./annotations.js";
19
21
  export { SessionActionsButton } from "./session-actions.js";
20
22
  export type { SessionAction, SessionActionsClient, SessionActionsProps } from "./session-actions.js";
21
23
  export type { ModelPickerSheetProps } from "./model-picker.js";