@retor/react-native 0.4.3 → 0.4.4
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/index.d.mts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +10 -1
- package/dist/index.mjs +10 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -63,6 +63,8 @@ interface ViewerHandle {
|
|
|
63
63
|
openLine: (lineId: string) => void;
|
|
64
64
|
exitLine: () => void;
|
|
65
65
|
scrollToTag: (tagId: string) => void;
|
|
66
|
+
/** Scroll the active line's camera to a 0..1 position. Use for notes (which aren't indexed by tagId on the server). */
|
|
67
|
+
scrollToProgress: (t: number) => void;
|
|
66
68
|
toggleAutoplay: () => void;
|
|
67
69
|
setAutoplay: (playing: boolean) => void;
|
|
68
70
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -63,6 +63,8 @@ interface ViewerHandle {
|
|
|
63
63
|
openLine: (lineId: string) => void;
|
|
64
64
|
exitLine: () => void;
|
|
65
65
|
scrollToTag: (tagId: string) => void;
|
|
66
|
+
/** Scroll the active line's camera to a 0..1 position. Use for notes (which aren't indexed by tagId on the server). */
|
|
67
|
+
scrollToProgress: (t: number) => void;
|
|
66
68
|
toggleAutoplay: () => void;
|
|
67
69
|
setAutoplay: (playing: boolean) => void;
|
|
68
70
|
}
|
package/dist/index.js
CHANGED
|
@@ -67,6 +67,7 @@ var noopHandle = {
|
|
|
67
67
|
openLine: noop,
|
|
68
68
|
exitLine: noop,
|
|
69
69
|
scrollToTag: noop,
|
|
70
|
+
scrollToProgress: noop,
|
|
70
71
|
toggleAutoplay: noop,
|
|
71
72
|
setAutoplay: noop
|
|
72
73
|
};
|
|
@@ -176,6 +177,9 @@ function useViewer(target = "default") {
|
|
|
176
177
|
scrollToTag: (tagId) => {
|
|
177
178
|
resolve()?.scrollToTag(tagId);
|
|
178
179
|
},
|
|
180
|
+
scrollToProgress: (t) => {
|
|
181
|
+
resolve()?.scrollToProgress(t);
|
|
182
|
+
},
|
|
179
183
|
toggleAutoplay: () => {
|
|
180
184
|
resolve()?.toggleAutoplay();
|
|
181
185
|
},
|
|
@@ -236,6 +240,7 @@ var Viewer = (0, import_react2.forwardRef)(function Viewer2({ projectId, id = "d
|
|
|
236
240
|
openLine: (lineId) => send("open-line", { lineId }),
|
|
237
241
|
exitLine: () => send("exit-line"),
|
|
238
242
|
scrollToTag: (tagId) => send("scroll-to-tag", { tagId }),
|
|
243
|
+
scrollToProgress: (t) => send("scroll-to-progress", { t }),
|
|
239
244
|
// Bridge owns autoplay state — it'll emit `autoplay-state` back, which
|
|
240
245
|
// we use to update isPlaying. No optimistic local update.
|
|
241
246
|
toggleAutoplay: () => send("toggle-autoplay"),
|
|
@@ -731,10 +736,14 @@ function DefaultLineTagList({ listHeader }) {
|
|
|
731
736
|
function DefaultTagItem({ tag, isActive }) {
|
|
732
737
|
const { controls, openAddNote } = useRetorBridge();
|
|
733
738
|
const initial = tag.authorName?.trim().charAt(0).toUpperCase();
|
|
739
|
+
const handlePress = () => {
|
|
740
|
+
if (typeof tag.progress === "number") controls.scrollToProgress(tag.progress);
|
|
741
|
+
else controls.scrollToTag(tag._id);
|
|
742
|
+
};
|
|
734
743
|
return /* @__PURE__ */ import_react6.default.createElement(
|
|
735
744
|
import_react_native5.Pressable,
|
|
736
745
|
{
|
|
737
|
-
onPress:
|
|
746
|
+
onPress: handlePress,
|
|
738
747
|
style: [styles3.tagItem, isActive && styles3.tagItemActive]
|
|
739
748
|
},
|
|
740
749
|
tag.avatarUrl ? /* @__PURE__ */ import_react6.default.createElement(import_react_native5.Image, { source: { uri: tag.avatarUrl }, style: styles3.tagAvatar }) : initial ? /* @__PURE__ */ import_react6.default.createElement(import_react_native5.View, { style: styles3.tagInitial }, /* @__PURE__ */ import_react6.default.createElement(import_react_native5.Text, { style: styles3.tagInitialText }, initial)) : null,
|
package/dist/index.mjs
CHANGED
|
@@ -14,6 +14,7 @@ var noopHandle = {
|
|
|
14
14
|
openLine: noop,
|
|
15
15
|
exitLine: noop,
|
|
16
16
|
scrollToTag: noop,
|
|
17
|
+
scrollToProgress: noop,
|
|
17
18
|
toggleAutoplay: noop,
|
|
18
19
|
setAutoplay: noop
|
|
19
20
|
};
|
|
@@ -132,6 +133,9 @@ function useViewer(target = "default") {
|
|
|
132
133
|
scrollToTag: (tagId) => {
|
|
133
134
|
resolve()?.scrollToTag(tagId);
|
|
134
135
|
},
|
|
136
|
+
scrollToProgress: (t) => {
|
|
137
|
+
resolve()?.scrollToProgress(t);
|
|
138
|
+
},
|
|
135
139
|
toggleAutoplay: () => {
|
|
136
140
|
resolve()?.toggleAutoplay();
|
|
137
141
|
},
|
|
@@ -192,6 +196,7 @@ var Viewer = forwardRef(function Viewer2({ projectId, id = "default", baseUrl =
|
|
|
192
196
|
openLine: (lineId) => send("open-line", { lineId }),
|
|
193
197
|
exitLine: () => send("exit-line"),
|
|
194
198
|
scrollToTag: (tagId) => send("scroll-to-tag", { tagId }),
|
|
199
|
+
scrollToProgress: (t) => send("scroll-to-progress", { t }),
|
|
195
200
|
// Bridge owns autoplay state — it'll emit `autoplay-state` back, which
|
|
196
201
|
// we use to update isPlaying. No optimistic local update.
|
|
197
202
|
toggleAutoplay: () => send("toggle-autoplay"),
|
|
@@ -692,10 +697,14 @@ function DefaultLineTagList({ listHeader }) {
|
|
|
692
697
|
function DefaultTagItem({ tag, isActive }) {
|
|
693
698
|
const { controls, openAddNote } = useRetorBridge();
|
|
694
699
|
const initial = tag.authorName?.trim().charAt(0).toUpperCase();
|
|
700
|
+
const handlePress = () => {
|
|
701
|
+
if (typeof tag.progress === "number") controls.scrollToProgress(tag.progress);
|
|
702
|
+
else controls.scrollToTag(tag._id);
|
|
703
|
+
};
|
|
695
704
|
return /* @__PURE__ */ React6.createElement(
|
|
696
705
|
Pressable2,
|
|
697
706
|
{
|
|
698
|
-
onPress:
|
|
707
|
+
onPress: handlePress,
|
|
699
708
|
style: [styles3.tagItem, isActive && styles3.tagItemActive]
|
|
700
709
|
},
|
|
701
710
|
tag.avatarUrl ? /* @__PURE__ */ React6.createElement(Image, { source: { uri: tag.avatarUrl }, style: styles3.tagAvatar }) : initial ? /* @__PURE__ */ React6.createElement(View5, { style: styles3.tagInitial }, /* @__PURE__ */ React6.createElement(Text2, { style: styles3.tagInitialText }, initial)) : null,
|