@retor/react-native 0.3.2 → 0.3.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 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +43 -22
- package/dist/index.mjs +43 -22
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -185,7 +185,7 @@ interface HudProps {
|
|
|
185
185
|
declare function Hud({ children }: HudProps): React.JSX.Element;
|
|
186
186
|
|
|
187
187
|
interface ProjectSheetProps {
|
|
188
|
-
/** Snap points. Defaults to ["35%", "
|
|
188
|
+
/** Snap points. Defaults to ["35%", "75%"]. */
|
|
189
189
|
snapPoints?: (string | number)[];
|
|
190
190
|
/** Override the default header (project name + description + arrow button). */
|
|
191
191
|
renderHeader?: (project: {
|
|
@@ -207,7 +207,7 @@ interface LinesCarouselProps {
|
|
|
207
207
|
declare function LinesCarousel({ children, gap, paddingHorizontal }: LinesCarouselProps): React.JSX.Element | null;
|
|
208
208
|
|
|
209
209
|
interface LineDetailSheetProps {
|
|
210
|
-
/** Snap points. Defaults to ["35%", "
|
|
210
|
+
/** Snap points. Defaults to ["35%", "75%"]. */
|
|
211
211
|
snapPoints?: (string | number)[];
|
|
212
212
|
/** Override the header. */
|
|
213
213
|
renderHeader?: (line: RetorLine) => React.ReactNode;
|
package/dist/index.d.ts
CHANGED
|
@@ -185,7 +185,7 @@ interface HudProps {
|
|
|
185
185
|
declare function Hud({ children }: HudProps): React.JSX.Element;
|
|
186
186
|
|
|
187
187
|
interface ProjectSheetProps {
|
|
188
|
-
/** Snap points. Defaults to ["35%", "
|
|
188
|
+
/** Snap points. Defaults to ["35%", "75%"]. */
|
|
189
189
|
snapPoints?: (string | number)[];
|
|
190
190
|
/** Override the default header (project name + description + arrow button). */
|
|
191
191
|
renderHeader?: (project: {
|
|
@@ -207,7 +207,7 @@ interface LinesCarouselProps {
|
|
|
207
207
|
declare function LinesCarousel({ children, gap, paddingHorizontal }: LinesCarouselProps): React.JSX.Element | null;
|
|
208
208
|
|
|
209
209
|
interface LineDetailSheetProps {
|
|
210
|
-
/** Snap points. Defaults to ["35%", "
|
|
210
|
+
/** Snap points. Defaults to ["35%", "75%"]. */
|
|
211
211
|
snapPoints?: (string | number)[];
|
|
212
212
|
/** Override the header. */
|
|
213
213
|
renderHeader?: (line: RetorLine) => React.ReactNode;
|
package/dist/index.js
CHANGED
|
@@ -232,30 +232,47 @@ var Viewer = (0, import_react2.forwardRef)(function Viewer2({ projectId, id = "d
|
|
|
232
232
|
if (!notes || !readyRef.current) return;
|
|
233
233
|
send("set-notes", { notes });
|
|
234
234
|
}, [notes, send]);
|
|
235
|
+
const closestTagIdRef = (0, import_react2.useRef)(closestTagId);
|
|
236
|
+
const addNoteTagIdRef = (0, import_react2.useRef)(addNoteTagId);
|
|
237
|
+
const activeLineIdRef = (0, import_react2.useRef)(activeLineId);
|
|
238
|
+
const linesRef = (0, import_react2.useRef)(lines);
|
|
239
|
+
const onNoteSubmitRef = (0, import_react2.useRef)(onNoteSubmit);
|
|
240
|
+
(0, import_react2.useEffect)(() => {
|
|
241
|
+
closestTagIdRef.current = closestTagId;
|
|
242
|
+
}, [closestTagId]);
|
|
243
|
+
(0, import_react2.useEffect)(() => {
|
|
244
|
+
addNoteTagIdRef.current = addNoteTagId;
|
|
245
|
+
}, [addNoteTagId]);
|
|
246
|
+
(0, import_react2.useEffect)(() => {
|
|
247
|
+
activeLineIdRef.current = activeLineId;
|
|
248
|
+
}, [activeLineId]);
|
|
249
|
+
(0, import_react2.useEffect)(() => {
|
|
250
|
+
linesRef.current = lines;
|
|
251
|
+
}, [lines]);
|
|
252
|
+
(0, import_react2.useEffect)(() => {
|
|
253
|
+
onNoteSubmitRef.current = onNoteSubmit;
|
|
254
|
+
}, [onNoteSubmit]);
|
|
235
255
|
const openAddNote = (0, import_react2.useCallback)((tagId) => {
|
|
236
|
-
setAddNoteTagId(tagId ??
|
|
256
|
+
setAddNoteTagId(tagId ?? closestTagIdRef.current ?? null);
|
|
237
257
|
setIsAddNoteOpen(true);
|
|
238
|
-
}, [
|
|
258
|
+
}, []);
|
|
239
259
|
const closeAddNote = (0, import_react2.useCallback)(() => {
|
|
240
260
|
setIsAddNoteOpen(false);
|
|
241
261
|
}, []);
|
|
242
|
-
const submitNote = (0, import_react2.useCallback)(
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
},
|
|
257
|
-
[addNoteTagId, activeLineId, lines, onNoteSubmit]
|
|
258
|
-
);
|
|
262
|
+
const submitNote = (0, import_react2.useCallback)((text, isPrivate = true) => {
|
|
263
|
+
const tagId = addNoteTagIdRef.current;
|
|
264
|
+
const lineId = activeLineIdRef.current;
|
|
265
|
+
const tag = linesRef.current.find((l) => l._id === lineId)?.tags.find((t) => t._id === tagId);
|
|
266
|
+
const payload = {
|
|
267
|
+
text,
|
|
268
|
+
isPrivate,
|
|
269
|
+
tagId,
|
|
270
|
+
lineId,
|
|
271
|
+
position: tag?.position ?? null
|
|
272
|
+
};
|
|
273
|
+
onNoteSubmitRef.current?.(payload);
|
|
274
|
+
setIsAddNoteOpen(false);
|
|
275
|
+
}, []);
|
|
259
276
|
const handleMessage = (0, import_react2.useCallback)(
|
|
260
277
|
(event) => {
|
|
261
278
|
let data = null;
|
|
@@ -372,7 +389,7 @@ function BlurBackground({ style }) {
|
|
|
372
389
|
}
|
|
373
390
|
|
|
374
391
|
// src/ProjectSheet.tsx
|
|
375
|
-
function ProjectSheet({ snapPoints = ["35%", "
|
|
392
|
+
function ProjectSheet({ snapPoints = ["35%", "75%"], renderHeader, children }) {
|
|
376
393
|
const { project, activeLineId, isAddNoteOpen } = useRetorBridge();
|
|
377
394
|
const sheetRef = (0, import_react5.useRef)(null);
|
|
378
395
|
const snapPointsArr = (0, import_react5.useMemo)(() => snapPoints, [snapPoints]);
|
|
@@ -406,6 +423,7 @@ function ProjectSheet({ snapPoints = ["35%", "85%"], renderHeader, children }) {
|
|
|
406
423
|
snapPoints: snapPointsArr,
|
|
407
424
|
enablePanDownToClose: false,
|
|
408
425
|
enableDismissOnClose: false,
|
|
426
|
+
enableOverDrag: false,
|
|
409
427
|
onChange: handleSheetChange,
|
|
410
428
|
backdropComponent: (props) => /* @__PURE__ */ import_react5.default.createElement(
|
|
411
429
|
import_bottom_sheet2.BottomSheetBackdrop,
|
|
@@ -497,7 +515,7 @@ var import_react_native5 = require("react-native");
|
|
|
497
515
|
var import_bottom_sheet3 = require("@gorhom/bottom-sheet");
|
|
498
516
|
var import_react_native_svg = __toESM(require("react-native-svg"));
|
|
499
517
|
var import_lucide_react_native2 = require("lucide-react-native");
|
|
500
|
-
function LineDetailSheet({ snapPoints = ["35%", "
|
|
518
|
+
function LineDetailSheet({ snapPoints = ["35%", "75%"], renderHeader, children }) {
|
|
501
519
|
const { activeLine, isAddNoteOpen, controls } = useRetorBridge();
|
|
502
520
|
const sheetRef = (0, import_react6.useRef)(null);
|
|
503
521
|
const snapPointsArr = (0, import_react6.useMemo)(() => snapPoints, [snapPoints]);
|
|
@@ -536,6 +554,7 @@ function LineDetailSheet({ snapPoints = ["35%", "85%"], renderHeader, children }
|
|
|
536
554
|
snapPoints: snapPointsArr,
|
|
537
555
|
enablePanDownToClose: false,
|
|
538
556
|
enableDismissOnClose: false,
|
|
557
|
+
enableOverDrag: false,
|
|
539
558
|
onChange: handleSheetChange,
|
|
540
559
|
footerComponent: renderFooter,
|
|
541
560
|
backdropComponent: (props) => /* @__PURE__ */ import_react6.default.createElement(
|
|
@@ -665,10 +684,11 @@ var styles3 = import_react_native5.StyleSheet.create({
|
|
|
665
684
|
justifyContent: "center",
|
|
666
685
|
position: "relative"
|
|
667
686
|
},
|
|
668
|
-
list: {
|
|
687
|
+
list: { paddingBottom: 96, gap: 4 },
|
|
669
688
|
tagItem: {
|
|
670
689
|
flexDirection: "row",
|
|
671
690
|
alignItems: "center",
|
|
691
|
+
marginHorizontal: 16,
|
|
672
692
|
paddingHorizontal: 12,
|
|
673
693
|
paddingVertical: 12,
|
|
674
694
|
borderRadius: 12,
|
|
@@ -753,6 +773,7 @@ function AddNoteSheet({
|
|
|
753
773
|
ref: sheetRef,
|
|
754
774
|
snapPoints: snapPointsArr,
|
|
755
775
|
enablePanDownToClose: true,
|
|
776
|
+
enableOverDrag: false,
|
|
756
777
|
onDismiss: closeAddNote,
|
|
757
778
|
backdropComponent: (props) => /* @__PURE__ */ import_react7.default.createElement(
|
|
758
779
|
import_bottom_sheet4.BottomSheetBackdrop,
|
package/dist/index.mjs
CHANGED
|
@@ -188,30 +188,47 @@ var Viewer = forwardRef(function Viewer2({ projectId, id = "default", baseUrl =
|
|
|
188
188
|
if (!notes || !readyRef.current) return;
|
|
189
189
|
send("set-notes", { notes });
|
|
190
190
|
}, [notes, send]);
|
|
191
|
+
const closestTagIdRef = useRef(closestTagId);
|
|
192
|
+
const addNoteTagIdRef = useRef(addNoteTagId);
|
|
193
|
+
const activeLineIdRef = useRef(activeLineId);
|
|
194
|
+
const linesRef = useRef(lines);
|
|
195
|
+
const onNoteSubmitRef = useRef(onNoteSubmit);
|
|
196
|
+
useEffect(() => {
|
|
197
|
+
closestTagIdRef.current = closestTagId;
|
|
198
|
+
}, [closestTagId]);
|
|
199
|
+
useEffect(() => {
|
|
200
|
+
addNoteTagIdRef.current = addNoteTagId;
|
|
201
|
+
}, [addNoteTagId]);
|
|
202
|
+
useEffect(() => {
|
|
203
|
+
activeLineIdRef.current = activeLineId;
|
|
204
|
+
}, [activeLineId]);
|
|
205
|
+
useEffect(() => {
|
|
206
|
+
linesRef.current = lines;
|
|
207
|
+
}, [lines]);
|
|
208
|
+
useEffect(() => {
|
|
209
|
+
onNoteSubmitRef.current = onNoteSubmit;
|
|
210
|
+
}, [onNoteSubmit]);
|
|
191
211
|
const openAddNote = useCallback((tagId) => {
|
|
192
|
-
setAddNoteTagId(tagId ??
|
|
212
|
+
setAddNoteTagId(tagId ?? closestTagIdRef.current ?? null);
|
|
193
213
|
setIsAddNoteOpen(true);
|
|
194
|
-
}, [
|
|
214
|
+
}, []);
|
|
195
215
|
const closeAddNote = useCallback(() => {
|
|
196
216
|
setIsAddNoteOpen(false);
|
|
197
217
|
}, []);
|
|
198
|
-
const submitNote = useCallback(
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
},
|
|
213
|
-
[addNoteTagId, activeLineId, lines, onNoteSubmit]
|
|
214
|
-
);
|
|
218
|
+
const submitNote = useCallback((text, isPrivate = true) => {
|
|
219
|
+
const tagId = addNoteTagIdRef.current;
|
|
220
|
+
const lineId = activeLineIdRef.current;
|
|
221
|
+
const tag = linesRef.current.find((l) => l._id === lineId)?.tags.find((t) => t._id === tagId);
|
|
222
|
+
const payload = {
|
|
223
|
+
text,
|
|
224
|
+
isPrivate,
|
|
225
|
+
tagId,
|
|
226
|
+
lineId,
|
|
227
|
+
position: tag?.position ?? null
|
|
228
|
+
};
|
|
229
|
+
onNoteSubmitRef.current?.(payload);
|
|
230
|
+
setIsAddNoteOpen(false);
|
|
231
|
+
}, []);
|
|
215
232
|
const handleMessage = useCallback(
|
|
216
233
|
(event) => {
|
|
217
234
|
let data = null;
|
|
@@ -328,7 +345,7 @@ function BlurBackground({ style }) {
|
|
|
328
345
|
}
|
|
329
346
|
|
|
330
347
|
// src/ProjectSheet.tsx
|
|
331
|
-
function ProjectSheet({ snapPoints = ["35%", "
|
|
348
|
+
function ProjectSheet({ snapPoints = ["35%", "75%"], renderHeader, children }) {
|
|
332
349
|
const { project, activeLineId, isAddNoteOpen } = useRetorBridge();
|
|
333
350
|
const sheetRef = useRef2(null);
|
|
334
351
|
const snapPointsArr = useMemo3(() => snapPoints, [snapPoints]);
|
|
@@ -362,6 +379,7 @@ function ProjectSheet({ snapPoints = ["35%", "85%"], renderHeader, children }) {
|
|
|
362
379
|
snapPoints: snapPointsArr,
|
|
363
380
|
enablePanDownToClose: false,
|
|
364
381
|
enableDismissOnClose: false,
|
|
382
|
+
enableOverDrag: false,
|
|
365
383
|
onChange: handleSheetChange,
|
|
366
384
|
backdropComponent: (props) => /* @__PURE__ */ React5.createElement(
|
|
367
385
|
BottomSheetBackdrop,
|
|
@@ -458,7 +476,7 @@ import {
|
|
|
458
476
|
} from "@gorhom/bottom-sheet";
|
|
459
477
|
import Svg, { Circle } from "react-native-svg";
|
|
460
478
|
import { ArrowDown as ArrowDown2, ArrowUp as ArrowUp2, Pause, Play, Plus } from "lucide-react-native";
|
|
461
|
-
function LineDetailSheet({ snapPoints = ["35%", "
|
|
479
|
+
function LineDetailSheet({ snapPoints = ["35%", "75%"], renderHeader, children }) {
|
|
462
480
|
const { activeLine, isAddNoteOpen, controls } = useRetorBridge();
|
|
463
481
|
const sheetRef = useRef3(null);
|
|
464
482
|
const snapPointsArr = useMemo4(() => snapPoints, [snapPoints]);
|
|
@@ -497,6 +515,7 @@ function LineDetailSheet({ snapPoints = ["35%", "85%"], renderHeader, children }
|
|
|
497
515
|
snapPoints: snapPointsArr,
|
|
498
516
|
enablePanDownToClose: false,
|
|
499
517
|
enableDismissOnClose: false,
|
|
518
|
+
enableOverDrag: false,
|
|
500
519
|
onChange: handleSheetChange,
|
|
501
520
|
footerComponent: renderFooter,
|
|
502
521
|
backdropComponent: (props) => /* @__PURE__ */ React6.createElement(
|
|
@@ -626,10 +645,11 @@ var styles3 = StyleSheet5.create({
|
|
|
626
645
|
justifyContent: "center",
|
|
627
646
|
position: "relative"
|
|
628
647
|
},
|
|
629
|
-
list: {
|
|
648
|
+
list: { paddingBottom: 96, gap: 4 },
|
|
630
649
|
tagItem: {
|
|
631
650
|
flexDirection: "row",
|
|
632
651
|
alignItems: "center",
|
|
652
|
+
marginHorizontal: 16,
|
|
633
653
|
paddingHorizontal: 12,
|
|
634
654
|
paddingVertical: 12,
|
|
635
655
|
borderRadius: 12,
|
|
@@ -719,6 +739,7 @@ function AddNoteSheet({
|
|
|
719
739
|
ref: sheetRef,
|
|
720
740
|
snapPoints: snapPointsArr,
|
|
721
741
|
enablePanDownToClose: true,
|
|
742
|
+
enableOverDrag: false,
|
|
722
743
|
onDismiss: closeAddNote,
|
|
723
744
|
backdropComponent: (props) => /* @__PURE__ */ React7.createElement(
|
|
724
745
|
BottomSheetBackdrop3,
|