@cloudparse/up-miniapps-sdk 0.6.8 → 0.7.3
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/README.md +15 -3
- package/dist/index.browser.min.js +104 -101
- package/dist/index.browser.min.js.map +1 -1
- package/dist/index.cjs +955 -989
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +71 -3
- package/dist/index.d.ts +71 -3
- package/dist/index.js +922 -955
- package/dist/index.js.map +1 -1
- package/dist/style.css +96 -18
- package/package.json +3 -1
package/dist/index.js
CHANGED
|
@@ -72,6 +72,59 @@ function isRunningInsideNativeShell() {
|
|
|
72
72
|
// src/bridge.ts
|
|
73
73
|
var BridgeTimeoutError = class extends Error {
|
|
74
74
|
};
|
|
75
|
+
var MOCK_ACHIEVEMENTS = [
|
|
76
|
+
{
|
|
77
|
+
completed: true,
|
|
78
|
+
description: "Complete your first navigation journey.",
|
|
79
|
+
playerActionCount: 1,
|
|
80
|
+
priority: 1,
|
|
81
|
+
slug: "first-journey",
|
|
82
|
+
title: "First Steps",
|
|
83
|
+
totalActionCount: 1,
|
|
84
|
+
upReward: 20,
|
|
85
|
+
xpReward: 40
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
completed: false,
|
|
89
|
+
description: "Discover 5 points of interest around Annecy.",
|
|
90
|
+
playerActionCount: 3,
|
|
91
|
+
priority: 2,
|
|
92
|
+
slug: "explore-5-pois",
|
|
93
|
+
title: "Explorer",
|
|
94
|
+
totalActionCount: 5,
|
|
95
|
+
upReward: 50,
|
|
96
|
+
xpReward: 100
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
completed: false,
|
|
100
|
+
description: "Scan 10 QR codes at partner venues.",
|
|
101
|
+
playerActionCount: 4,
|
|
102
|
+
priority: 3,
|
|
103
|
+
slug: "scan-10-qrcodes",
|
|
104
|
+
title: "Code Breaker",
|
|
105
|
+
totalActionCount: 10,
|
|
106
|
+
upReward: 80,
|
|
107
|
+
xpReward: 150
|
|
108
|
+
}
|
|
109
|
+
];
|
|
110
|
+
function mockAchievement(slug) {
|
|
111
|
+
const found = MOCK_ACHIEVEMENTS.find((a) => a.slug === slug);
|
|
112
|
+
if (found) return found;
|
|
113
|
+
return {
|
|
114
|
+
completed: false,
|
|
115
|
+
description: "Mocked achievement (no native shell attached).",
|
|
116
|
+
playerActionCount: 0,
|
|
117
|
+
priority: 1,
|
|
118
|
+
slug: slug || "unknown-achievement",
|
|
119
|
+
title: slug || "Unknown Achievement",
|
|
120
|
+
totalActionCount: 1,
|
|
121
|
+
upReward: 0,
|
|
122
|
+
xpReward: 0
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
function mockAchievements() {
|
|
126
|
+
return MOCK_ACHIEVEMENTS;
|
|
127
|
+
}
|
|
75
128
|
var Bridge = class {
|
|
76
129
|
callbacks = /* @__PURE__ */ new Map();
|
|
77
130
|
eventListeners = /* @__PURE__ */ new Map();
|
|
@@ -222,6 +275,12 @@ var Bridge = class {
|
|
|
222
275
|
return this.mockSaveImage(
|
|
223
276
|
payload
|
|
224
277
|
);
|
|
278
|
+
case "GET_ACHIEVEMENT":
|
|
279
|
+
return Promise.resolve(
|
|
280
|
+
mockAchievement(payload?.slug)
|
|
281
|
+
);
|
|
282
|
+
case "GET_ACHIEVEMENTS":
|
|
283
|
+
return Promise.resolve(mockAchievements());
|
|
225
284
|
default:
|
|
226
285
|
console.warn(
|
|
227
286
|
`[Bridge] Mock mode active: Unhandled message type ${type}`
|
|
@@ -408,420 +467,29 @@ var SheetDescription = React2.forwardRef(({ className, ...props }, ref) => /* @_
|
|
|
408
467
|
SheetDescription.displayName = SheetPrimitive.Description.displayName;
|
|
409
468
|
|
|
410
469
|
// src/components/Map/components/MapDrawer.tsx
|
|
411
|
-
import {
|
|
412
|
-
forwardRef as forwardRef3,
|
|
413
|
-
useEffect,
|
|
414
|
-
useImperativeHandle,
|
|
415
|
-
useRef,
|
|
416
|
-
useState
|
|
417
|
-
} from "react";
|
|
470
|
+
import { forwardRef as forwardRef3, useImperativeHandle, useRef, useState } from "react";
|
|
418
471
|
import { Fragment, jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
419
|
-
var resolveHeightToPixels = (height, containerHeight) => {
|
|
420
|
-
if (typeof height === "number") {
|
|
421
|
-
return height;
|
|
422
|
-
}
|
|
423
|
-
if (height.endsWith("%")) {
|
|
424
|
-
return parseFloat(height) / 100 * containerHeight;
|
|
425
|
-
}
|
|
426
|
-
return parseFloat(height);
|
|
427
|
-
};
|
|
428
|
-
var CONTENT_EDGE_PULL_THRESHOLD_PX = 24;
|
|
429
|
-
var HANDLE_BAR_HEIGHT_PX = 32;
|
|
430
|
-
var HANDLE_TAP_CLICK_SUPPRESSION_MS = 400;
|
|
431
472
|
var MapDrawer = forwardRef3(
|
|
432
473
|
({
|
|
433
474
|
menuItems,
|
|
434
475
|
state,
|
|
435
476
|
onChangeState,
|
|
436
|
-
side,
|
|
437
|
-
etaBarHeight = 0,
|
|
438
|
-
etaData,
|
|
439
|
-
touchStartY,
|
|
440
|
-
setTouchStartY,
|
|
441
|
-
currentTouchY,
|
|
442
|
-
setCurrentTouchY,
|
|
443
|
-
isDragging,
|
|
444
|
-
clampedDragOffset,
|
|
445
|
-
drawerPeekHeight,
|
|
446
|
-
drawerFullHeight,
|
|
447
|
-
drawerAutoMaxHeight,
|
|
448
|
-
containerHeight,
|
|
449
477
|
menuContent,
|
|
450
|
-
enableTouchDrag = false,
|
|
451
|
-
handleVisible = true,
|
|
452
|
-
onAutoContentHeightChange,
|
|
453
478
|
showScrollToTopButton = true,
|
|
454
|
-
scrollToTopThreshold = 300
|
|
455
|
-
safeAreaInsets = { bottom: 0, left: 0, right: 0, top: 0 }
|
|
479
|
+
scrollToTopThreshold = 300
|
|
456
480
|
}, ref) => {
|
|
457
481
|
const scrollContainerRef = useRef(null);
|
|
458
|
-
const containerRef = useRef(null);
|
|
459
|
-
const handleBarRef = useRef(null);
|
|
460
|
-
const contentAreaRef = useRef(null);
|
|
461
482
|
useImperativeHandle(
|
|
462
483
|
ref,
|
|
463
484
|
() => scrollContainerRef.current
|
|
464
485
|
);
|
|
465
|
-
const handleHandleClick = () => {
|
|
466
|
-
if (side === "left") {
|
|
467
|
-
onChangeState(state === "closed" ? "full" : "closed");
|
|
468
|
-
} else {
|
|
469
|
-
if (state === "closed") {
|
|
470
|
-
onChangeState("peek");
|
|
471
|
-
} else if (state === "peek") {
|
|
472
|
-
onChangeState("full");
|
|
473
|
-
} else if (state === "auto") {
|
|
474
|
-
onChangeState("closed");
|
|
475
|
-
} else {
|
|
476
|
-
onChangeState("peek");
|
|
477
|
-
}
|
|
478
|
-
}
|
|
479
|
-
};
|
|
480
|
-
const handleHandleClickRef = useRef(handleHandleClick);
|
|
481
|
-
handleHandleClickRef.current = handleHandleClick;
|
|
482
|
-
const [autoContentPx, setAutoContentPx] = useState(0);
|
|
483
|
-
useEffect(() => {
|
|
484
|
-
if (state !== "auto") return;
|
|
485
|
-
const scrollEl = scrollContainerRef.current;
|
|
486
|
-
const contentAreaEl = contentAreaRef.current;
|
|
487
|
-
if (!scrollEl || !contentAreaEl) return;
|
|
488
|
-
const handleHeight = handleVisible ? handleBarRef.current?.offsetHeight ?? 0 : 0;
|
|
489
|
-
const contentEl = scrollEl.firstElementChild;
|
|
490
|
-
const measure = () => {
|
|
491
|
-
const contentAreaStyle = window.getComputedStyle(contentAreaEl);
|
|
492
|
-
const verticalPadding = parseFloat(contentAreaStyle.paddingTop || "0") + parseFloat(contentAreaStyle.paddingBottom || "0");
|
|
493
|
-
const contentHeight = contentEl?.scrollHeight ?? scrollEl.scrollHeight;
|
|
494
|
-
const px = handleHeight + verticalPadding + contentHeight;
|
|
495
|
-
setAutoContentPx(px);
|
|
496
|
-
onAutoContentHeightChange?.(px);
|
|
497
|
-
};
|
|
498
|
-
measure();
|
|
499
|
-
const ro = new ResizeObserver(measure);
|
|
500
|
-
ro.observe(contentEl ?? scrollEl);
|
|
501
|
-
return () => ro.disconnect();
|
|
502
|
-
}, [state, handleVisible, onAutoContentHeightChange]);
|
|
503
486
|
const [showScrollTop, setShowScrollTop] = useState(false);
|
|
504
487
|
const handleScroll = (e) => {
|
|
505
488
|
const scrollTop = e.currentTarget.scrollTop;
|
|
506
489
|
setShowScrollTop(state !== "closed" && scrollTop > scrollToTopThreshold);
|
|
507
490
|
};
|
|
508
|
-
|
|
509
|
-
if (state === "closed") {
|
|
510
|
-
setShowScrollTop(false);
|
|
511
|
-
} else {
|
|
512
|
-
const scrollTop = scrollContainerRef.current?.scrollTop || 0;
|
|
513
|
-
setShowScrollTop(scrollTop > scrollToTopThreshold);
|
|
514
|
-
}
|
|
515
|
-
}, [state, scrollToTopThreshold]);
|
|
516
|
-
const isDraggingSheet = useRef(false);
|
|
517
|
-
const hasDeterminedDirection = useRef(false);
|
|
518
|
-
const isTouchOnContent = useRef(false);
|
|
519
|
-
const isTouchOnHandle = useRef(false);
|
|
520
|
-
const suppressNextClickRef = useRef(false);
|
|
521
|
-
const contentAtTopSinceY = useRef(null);
|
|
522
|
-
const contentAtBottomSinceY = useRef(null);
|
|
523
|
-
const dragStartYRef = useRef(null);
|
|
524
|
-
const dragBaseHeightPxRef = useRef(0);
|
|
525
|
-
const stateRef = useRef(state);
|
|
526
|
-
const touchStartYRef = useRef(touchStartY);
|
|
527
|
-
const currentTouchYRef = useRef(currentTouchY);
|
|
528
|
-
useEffect(() => {
|
|
529
|
-
stateRef.current = state;
|
|
530
|
-
}, [state]);
|
|
531
|
-
useEffect(() => {
|
|
532
|
-
touchStartYRef.current = touchStartY;
|
|
533
|
-
}, [touchStartY]);
|
|
534
|
-
useEffect(() => {
|
|
535
|
-
currentTouchYRef.current = currentTouchY;
|
|
536
|
-
}, [currentTouchY]);
|
|
537
|
-
useEffect(() => {
|
|
538
|
-
const container = containerRef.current;
|
|
539
|
-
if (!container || side !== "bottom" || !enableTouchDrag) return;
|
|
540
|
-
const handleNativeTouchStart = (e) => {
|
|
541
|
-
const clientY = e.targetTouches[0].clientY;
|
|
542
|
-
setTouchStartY(clientY);
|
|
543
|
-
setCurrentTouchY(clientY);
|
|
544
|
-
isDraggingSheet.current = false;
|
|
545
|
-
hasDeterminedDirection.current = false;
|
|
546
|
-
contentAtTopSinceY.current = null;
|
|
547
|
-
contentAtBottomSinceY.current = null;
|
|
548
|
-
dragStartYRef.current = null;
|
|
549
|
-
const target = e.target;
|
|
550
|
-
isTouchOnContent.current = scrollContainerRef.current ? scrollContainerRef.current.contains(target) : false;
|
|
551
|
-
isTouchOnHandle.current = handleBarRef.current ? handleBarRef.current.contains(target) : false;
|
|
552
|
-
};
|
|
553
|
-
const handleNativeTouchMove = (e) => {
|
|
554
|
-
const startY = touchStartYRef.current;
|
|
555
|
-
if (startY === null) return;
|
|
556
|
-
const currentY = e.targetTouches[0].clientY;
|
|
557
|
-
const deltaY = startY - currentY;
|
|
558
|
-
const scrollTop = scrollContainerRef.current ? scrollContainerRef.current.scrollTop : 0;
|
|
559
|
-
const clientHeight = scrollContainerRef.current ? scrollContainerRef.current.clientHeight : 0;
|
|
560
|
-
const scrollHeight = scrollContainerRef.current ? scrollContainerRef.current.scrollHeight : 0;
|
|
561
|
-
const isAtBottom = scrollTop + clientHeight >= scrollHeight - 1;
|
|
562
|
-
const currentState = stateRef.current;
|
|
563
|
-
const containerHForHeights = containerHeight || container.parentElement?.getBoundingClientRect().height || window.innerHeight;
|
|
564
|
-
const fullPxNow = resolveHeightToPixels(
|
|
565
|
-
drawerFullHeight || "85%",
|
|
566
|
-
containerHForHeights
|
|
567
|
-
);
|
|
568
|
-
const peekPxNow = resolveHeightToPixels(
|
|
569
|
-
drawerPeekHeight || "15%",
|
|
570
|
-
containerHForHeights
|
|
571
|
-
);
|
|
572
|
-
const closedPxNow = (handleVisible ? HANDLE_BAR_HEIGHT_PX : 0) + (currentState === "closed" ? safeAreaInsets.bottom : 0);
|
|
573
|
-
const autoMaxPxNow = resolveHeightToPixels(
|
|
574
|
-
drawerAutoMaxHeight || "100%",
|
|
575
|
-
containerHForHeights
|
|
576
|
-
);
|
|
577
|
-
const autoPxNow = Math.min(autoMaxPxNow, autoContentPx);
|
|
578
|
-
const baselineHeightPxForState = (s) => {
|
|
579
|
-
if (s === "full") return fullPxNow;
|
|
580
|
-
if (s === "peek") return peekPxNow;
|
|
581
|
-
if (s === "auto") return autoPxNow;
|
|
582
|
-
return closedPxNow;
|
|
583
|
-
};
|
|
584
|
-
const commitDrag = () => {
|
|
585
|
-
isDraggingSheet.current = true;
|
|
586
|
-
dragStartYRef.current = currentY;
|
|
587
|
-
dragBaseHeightPxRef.current = baselineHeightPxForState(currentState);
|
|
588
|
-
};
|
|
589
|
-
if (scrollTop <= 0) {
|
|
590
|
-
if (contentAtTopSinceY.current === null) {
|
|
591
|
-
contentAtTopSinceY.current = currentY;
|
|
592
|
-
}
|
|
593
|
-
} else {
|
|
594
|
-
contentAtTopSinceY.current = null;
|
|
595
|
-
}
|
|
596
|
-
if (isAtBottom) {
|
|
597
|
-
if (contentAtBottomSinceY.current === null) {
|
|
598
|
-
contentAtBottomSinceY.current = currentY;
|
|
599
|
-
}
|
|
600
|
-
} else {
|
|
601
|
-
contentAtBottomSinceY.current = null;
|
|
602
|
-
}
|
|
603
|
-
const pullPastTop = contentAtTopSinceY.current !== null ? currentY - contentAtTopSinceY.current : 0;
|
|
604
|
-
const pullPastBottom = contentAtBottomSinceY.current !== null ? contentAtBottomSinceY.current - currentY : 0;
|
|
605
|
-
if (!hasDeterminedDirection.current) {
|
|
606
|
-
if (!isTouchOnContent.current) {
|
|
607
|
-
if (Math.abs(deltaY) < CONTENT_EDGE_PULL_THRESHOLD_PX) {
|
|
608
|
-
return;
|
|
609
|
-
}
|
|
610
|
-
commitDrag();
|
|
611
|
-
hasDeterminedDirection.current = true;
|
|
612
|
-
} else if (currentState !== "full") {
|
|
613
|
-
if (deltaY > 0 && isAtBottom && pullPastBottom >= CONTENT_EDGE_PULL_THRESHOLD_PX) {
|
|
614
|
-
commitDrag();
|
|
615
|
-
hasDeterminedDirection.current = true;
|
|
616
|
-
} else if (deltaY < 0 && scrollTop <= 0 && pullPastTop >= CONTENT_EDGE_PULL_THRESHOLD_PX) {
|
|
617
|
-
commitDrag();
|
|
618
|
-
hasDeterminedDirection.current = true;
|
|
619
|
-
} else if (deltaY > 0 && isAtBottom || deltaY < 0 && scrollTop <= 0) {
|
|
620
|
-
return;
|
|
621
|
-
} else {
|
|
622
|
-
isDraggingSheet.current = false;
|
|
623
|
-
hasDeterminedDirection.current = true;
|
|
624
|
-
}
|
|
625
|
-
} else {
|
|
626
|
-
if (deltaY < 0 && scrollTop <= 0 && pullPastTop >= CONTENT_EDGE_PULL_THRESHOLD_PX) {
|
|
627
|
-
commitDrag();
|
|
628
|
-
hasDeterminedDirection.current = true;
|
|
629
|
-
} else if (deltaY < 0 && scrollTop <= 0) {
|
|
630
|
-
return;
|
|
631
|
-
} else {
|
|
632
|
-
isDraggingSheet.current = false;
|
|
633
|
-
hasDeterminedDirection.current = true;
|
|
634
|
-
}
|
|
635
|
-
}
|
|
636
|
-
} else if (!isDraggingSheet.current && isTouchOnContent.current) {
|
|
637
|
-
if (deltaY < 0 && scrollTop <= 0 && pullPastTop >= CONTENT_EDGE_PULL_THRESHOLD_PX) {
|
|
638
|
-
commitDrag();
|
|
639
|
-
return;
|
|
640
|
-
}
|
|
641
|
-
if (deltaY > 0 && isAtBottom && currentState !== "full" && pullPastBottom >= CONTENT_EDGE_PULL_THRESHOLD_PX) {
|
|
642
|
-
commitDrag();
|
|
643
|
-
return;
|
|
644
|
-
}
|
|
645
|
-
}
|
|
646
|
-
if (isDraggingSheet.current) {
|
|
647
|
-
if (e.cancelable) {
|
|
648
|
-
e.preventDefault();
|
|
649
|
-
}
|
|
650
|
-
const parentContainer = container.parentElement;
|
|
651
|
-
if (parentContainer) {
|
|
652
|
-
const dragOffset = currentY - (dragStartYRef.current ?? currentY);
|
|
653
|
-
let localClamped = dragOffset;
|
|
654
|
-
if (currentState === "full") {
|
|
655
|
-
localClamped = Math.max(
|
|
656
|
-
0,
|
|
657
|
-
Math.min(fullPxNow - closedPxNow, dragOffset)
|
|
658
|
-
);
|
|
659
|
-
} else if (currentState === "peek") {
|
|
660
|
-
localClamped = Math.max(
|
|
661
|
-
-(fullPxNow - peekPxNow),
|
|
662
|
-
Math.min(peekPxNow - closedPxNow, dragOffset)
|
|
663
|
-
);
|
|
664
|
-
} else if (currentState === "closed") {
|
|
665
|
-
localClamped = Math.min(
|
|
666
|
-
0,
|
|
667
|
-
Math.max(-(fullPxNow - closedPxNow), dragOffset)
|
|
668
|
-
);
|
|
669
|
-
} else if (currentState === "auto") {
|
|
670
|
-
localClamped = Math.max(0, dragOffset);
|
|
671
|
-
}
|
|
672
|
-
parentContainer.style.setProperty(
|
|
673
|
-
"--drag-offset",
|
|
674
|
-
`${localClamped}px`
|
|
675
|
-
);
|
|
676
|
-
}
|
|
677
|
-
}
|
|
678
|
-
};
|
|
679
|
-
const handleNativeTouchEnd = (e) => {
|
|
680
|
-
const startY = touchStartYRef.current;
|
|
681
|
-
const currentY = currentTouchYRef.current;
|
|
682
|
-
const parentContainer = container.parentElement;
|
|
683
|
-
if (startY === null || currentY === null) {
|
|
684
|
-
if (parentContainer) {
|
|
685
|
-
parentContainer.style.setProperty("--drag-offset", "0px");
|
|
686
|
-
}
|
|
687
|
-
return;
|
|
688
|
-
}
|
|
689
|
-
if (!isDraggingSheet.current) {
|
|
690
|
-
if (isTouchOnHandle.current) {
|
|
691
|
-
handleHandleClickRef.current();
|
|
692
|
-
suppressNextClickRef.current = true;
|
|
693
|
-
setTimeout(() => {
|
|
694
|
-
suppressNextClickRef.current = false;
|
|
695
|
-
}, HANDLE_TAP_CLICK_SUPPRESSION_MS);
|
|
696
|
-
}
|
|
697
|
-
setTouchStartY(null);
|
|
698
|
-
setCurrentTouchY(null);
|
|
699
|
-
if (parentContainer) {
|
|
700
|
-
parentContainer.style.setProperty("--drag-offset", "0px");
|
|
701
|
-
}
|
|
702
|
-
return;
|
|
703
|
-
}
|
|
704
|
-
const touchEndY = e.changedTouches[0].clientY;
|
|
705
|
-
const dragStartY = dragStartYRef.current ?? startY;
|
|
706
|
-
const dragDistance = Math.abs(touchEndY - dragStartY);
|
|
707
|
-
if (dragDistance < 10) {
|
|
708
|
-
setTouchStartY(null);
|
|
709
|
-
setCurrentTouchY(null);
|
|
710
|
-
if (parentContainer) {
|
|
711
|
-
parentContainer.style.setProperty("--drag-offset", "0px");
|
|
712
|
-
}
|
|
713
|
-
return;
|
|
714
|
-
}
|
|
715
|
-
const containerH2 = containerHeight || (parentContainer ? parentContainer.getBoundingClientRect().height : window.innerHeight);
|
|
716
|
-
const fullPx2 = resolveHeightToPixels(
|
|
717
|
-
drawerFullHeight || "85%",
|
|
718
|
-
containerH2
|
|
719
|
-
);
|
|
720
|
-
const peekPx2 = resolveHeightToPixels(
|
|
721
|
-
drawerPeekHeight || "15%",
|
|
722
|
-
containerH2
|
|
723
|
-
);
|
|
724
|
-
const currentState = stateRef.current;
|
|
725
|
-
const closedPx = (handleVisible ? HANDLE_BAR_HEIGHT_PX : 0) + (currentState === "closed" ? safeAreaInsets.bottom : 0);
|
|
726
|
-
const dragDelta = touchEndY - dragStartY;
|
|
727
|
-
const drawerHeightFromBottom = dragBaseHeightPxRef.current - dragDelta;
|
|
728
|
-
const distToClosed = Math.abs(drawerHeightFromBottom - closedPx);
|
|
729
|
-
let targetState2;
|
|
730
|
-
if (currentState === "auto") {
|
|
731
|
-
const autoMaxPx2 = resolveHeightToPixels(
|
|
732
|
-
drawerAutoMaxHeight || "100%",
|
|
733
|
-
containerH2
|
|
734
|
-
);
|
|
735
|
-
const autoPx2 = Math.min(autoMaxPx2, autoContentPx);
|
|
736
|
-
const distToAuto = Math.abs(drawerHeightFromBottom - autoPx2);
|
|
737
|
-
targetState2 = distToAuto <= distToClosed ? "auto" : "closed";
|
|
738
|
-
} else {
|
|
739
|
-
const distToFull = Math.abs(drawerHeightFromBottom - fullPx2);
|
|
740
|
-
const distToPeek = Math.abs(drawerHeightFromBottom - peekPx2);
|
|
741
|
-
const minDist = Math.min(distToFull, distToPeek, distToClosed);
|
|
742
|
-
if (minDist === distToFull) {
|
|
743
|
-
targetState2 = "full";
|
|
744
|
-
} else if (minDist === distToPeek) {
|
|
745
|
-
targetState2 = "peek";
|
|
746
|
-
} else {
|
|
747
|
-
targetState2 = "closed";
|
|
748
|
-
}
|
|
749
|
-
}
|
|
750
|
-
setTouchStartY(null);
|
|
751
|
-
setCurrentTouchY(null);
|
|
752
|
-
onChangeState(targetState2);
|
|
753
|
-
requestAnimationFrame(() => {
|
|
754
|
-
if (parentContainer) {
|
|
755
|
-
parentContainer.style.setProperty("--drag-offset", "0px");
|
|
756
|
-
}
|
|
757
|
-
});
|
|
758
|
-
};
|
|
759
|
-
const handleNativeClickCapture = (e) => {
|
|
760
|
-
if (!suppressNextClickRef.current) return;
|
|
761
|
-
suppressNextClickRef.current = false;
|
|
762
|
-
e.preventDefault();
|
|
763
|
-
e.stopPropagation();
|
|
764
|
-
};
|
|
765
|
-
container.addEventListener("touchstart", handleNativeTouchStart, {
|
|
766
|
-
passive: true
|
|
767
|
-
});
|
|
768
|
-
container.addEventListener("touchmove", handleNativeTouchMove, {
|
|
769
|
-
passive: false
|
|
770
|
-
});
|
|
771
|
-
container.addEventListener("touchend", handleNativeTouchEnd, {
|
|
772
|
-
passive: true
|
|
773
|
-
});
|
|
774
|
-
container.addEventListener("click", handleNativeClickCapture, {
|
|
775
|
-
capture: true
|
|
776
|
-
});
|
|
777
|
-
return () => {
|
|
778
|
-
container.removeEventListener("touchstart", handleNativeTouchStart);
|
|
779
|
-
container.removeEventListener("touchmove", handleNativeTouchMove);
|
|
780
|
-
container.removeEventListener("touchend", handleNativeTouchEnd);
|
|
781
|
-
container.removeEventListener("click", handleNativeClickCapture, {
|
|
782
|
-
capture: true
|
|
783
|
-
});
|
|
784
|
-
};
|
|
785
|
-
}, [
|
|
786
|
-
side,
|
|
787
|
-
enableTouchDrag,
|
|
788
|
-
containerHeight,
|
|
789
|
-
drawerFullHeight,
|
|
790
|
-
drawerPeekHeight,
|
|
791
|
-
drawerAutoMaxHeight,
|
|
792
|
-
safeAreaInsets,
|
|
793
|
-
onChangeState,
|
|
794
|
-
setTouchStartY,
|
|
795
|
-
setCurrentTouchY,
|
|
796
|
-
autoContentPx,
|
|
797
|
-
handleVisible
|
|
798
|
-
]);
|
|
799
|
-
const isBackdropActive = state === "full" || state === "auto";
|
|
491
|
+
const isBackdropActive = state !== "closed";
|
|
800
492
|
const backdropStyles = isBackdropActive ? "opacity-100 pointer-events-auto" : "opacity-0 pointer-events-none";
|
|
801
|
-
const containerH = containerHeight || window.innerHeight;
|
|
802
|
-
const fullPx = resolveHeightToPixels(drawerFullHeight || "85%", containerH);
|
|
803
|
-
const peekPx = resolveHeightToPixels(drawerPeekHeight || "15%", containerH);
|
|
804
|
-
const autoMaxPx = resolveHeightToPixels(
|
|
805
|
-
drawerAutoMaxHeight || "100%",
|
|
806
|
-
containerH
|
|
807
|
-
);
|
|
808
|
-
const shiftPx = fullPx - peekPx;
|
|
809
|
-
const autoPx = Math.min(autoMaxPx, autoContentPx);
|
|
810
|
-
const autoShiftPx = Math.max(fullPx - autoPx, 0);
|
|
811
|
-
const getBottomDrawerTransform = () => {
|
|
812
|
-
if (state === "full") {
|
|
813
|
-
return "translateY(var(--drag-offset, 0px))";
|
|
814
|
-
}
|
|
815
|
-
if (state === "peek") {
|
|
816
|
-
return `translateY(calc(${shiftPx}px + var(--drag-offset, 0px)))`;
|
|
817
|
-
}
|
|
818
|
-
if (state === "auto") {
|
|
819
|
-
return `translateY(calc(${autoShiftPx}px + var(--drag-offset, 0px)))`;
|
|
820
|
-
}
|
|
821
|
-
const closedVisibleHeight = handleVisible ? HANDLE_BAR_HEIGHT_PX : 0;
|
|
822
|
-
const closedShiftPx = fullPx - closedVisibleHeight;
|
|
823
|
-
return `translateY(calc(${closedShiftPx}px + var(--drag-offset, 0px)))`;
|
|
824
|
-
};
|
|
825
493
|
return /* @__PURE__ */ jsxs2(Fragment, { children: [
|
|
826
494
|
/* @__PURE__ */ jsx3("style", { children: `
|
|
827
495
|
.no-scrollbar {
|
|
@@ -839,233 +507,113 @@ var MapDrawer = forwardRef3(
|
|
|
839
507
|
onClick: () => onChangeState("closed")
|
|
840
508
|
}
|
|
841
509
|
),
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
children:
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
children: menuContent ? menuContent : /* @__PURE__ */ jsx3("div", { className: "flex flex-col gap-1.5", children: menuItems.map((item) => /* @__PURE__ */ jsxs2(
|
|
890
|
-
Button,
|
|
891
|
-
{
|
|
892
|
-
className: `flex items-center gap-3 w-full py-3 px-3.5 rounded-xl text-left cursor-pointer transition-all duration-150 justify-start hover:bg-white/5 hover:text-white active:bg-white/10 text-white ${item.disabled ? "opacity-45 cursor-not-allowed pointer-events-none" : ""}`,
|
|
893
|
-
disabled: item.disabled,
|
|
894
|
-
onClick: () => {
|
|
895
|
-
if (!item.disabled) {
|
|
896
|
-
item.onPress();
|
|
897
|
-
onChangeState("closed");
|
|
898
|
-
}
|
|
899
|
-
},
|
|
900
|
-
variant: "ghost",
|
|
901
|
-
children: [
|
|
902
|
-
/* @__PURE__ */ jsxs2("div", { className: "relative flex items-center justify-center w-8 h-8 rounded-lg bg-white/5 text-zinc-300", children: [
|
|
903
|
-
item.icon,
|
|
904
|
-
item.badge !== void 0 && /* @__PURE__ */ jsx3("span", { className: "absolute -top-1 -right-1 bg-cyan-500 text-black text-[9px] font-extrabold min-w-[15px] h-3.5 rounded-full flex items-center justify-center px-1 border border-zinc-950 shadow", children: item.badge })
|
|
905
|
-
] }),
|
|
906
|
-
/* @__PURE__ */ jsx3("span", { className: "text-sm font-medium tracking-wide flex-1", children: item.label })
|
|
907
|
-
]
|
|
908
|
-
},
|
|
909
|
-
item.id
|
|
910
|
-
)) })
|
|
911
|
-
}
|
|
912
|
-
),
|
|
913
|
-
showScrollToTopButton && showScrollTop && /* @__PURE__ */ jsx3(
|
|
914
|
-
Button,
|
|
915
|
-
{
|
|
916
|
-
className: "absolute bottom-6 right-6 z-50 flex items-center justify-center w-10 h-10 rounded-full bg-cyan-500 hover:bg-cyan-400 active:scale-95 text-black hover:text-black shadow-lg shadow-cyan-500/25 transition-all duration-200 cursor-pointer p-0!",
|
|
917
|
-
onClick: () => {
|
|
918
|
-
scrollContainerRef.current?.scrollTo({
|
|
919
|
-
behavior: "smooth",
|
|
920
|
-
top: 0
|
|
921
|
-
});
|
|
922
|
-
},
|
|
923
|
-
variant: "ghost",
|
|
924
|
-
children: /* @__PURE__ */ jsx3(
|
|
925
|
-
"svg",
|
|
926
|
-
{
|
|
927
|
-
fill: "none",
|
|
928
|
-
height: "20",
|
|
929
|
-
stroke: "currentColor",
|
|
930
|
-
strokeLinecap: "round",
|
|
931
|
-
strokeLinejoin: "round",
|
|
932
|
-
strokeWidth: "2.5",
|
|
933
|
-
viewBox: "0 0 24 24",
|
|
934
|
-
width: "20",
|
|
935
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
936
|
-
children: /* @__PURE__ */ jsx3("polyline", { points: "18 15 12 9 6 15" })
|
|
937
|
-
}
|
|
938
|
-
)
|
|
939
|
-
}
|
|
940
|
-
)
|
|
941
|
-
]
|
|
942
|
-
}
|
|
943
|
-
)
|
|
944
|
-
}
|
|
945
|
-
)
|
|
946
|
-
] }) : (
|
|
947
|
-
/* Bottom Sheet Panel - Hardware accelerated translateY transitions */
|
|
948
|
-
/* @__PURE__ */ jsxs2(
|
|
949
|
-
"div",
|
|
950
|
-
{
|
|
951
|
-
className: `absolute w-full bg-zinc-950/85 backdrop-blur-md border border-white/10 rounded-t-2xl shadow-2xl flex flex-col z-40 select-none ${isDragging ? "transition-none" : "transition-transform duration-300 ease-out"}`,
|
|
952
|
-
ref: containerRef,
|
|
953
|
-
style: {
|
|
954
|
-
bottom: "0px",
|
|
955
|
-
// Box height must stay exactly fullPx for "closed"/"peek"/
|
|
956
|
-
// "full" — every other transform calc in this component
|
|
957
|
-
// assumes the box IS fullPx tall. Only "auto" grows it (up to
|
|
958
|
-
// autoMaxPx) when content needs more room than fullPx offers;
|
|
959
|
-
// getBottomDrawerTransform()'s auto branch is derived to match
|
|
960
|
-
// (shift = max(fullPx - autoPx, 0), so a taller box needs zero
|
|
961
|
-
// extra shift to fully reveal itself).
|
|
962
|
-
height: `${state === "auto" ? Math.max(fullPx, autoPx) : fullPx}px`,
|
|
963
|
-
marginBottom: state === "closed" ? `${safeAreaInsets.bottom}px` : "0px",
|
|
964
|
-
transform: getBottomDrawerTransform(),
|
|
965
|
-
// `height` is animated too (not just transform/margin-bottom):
|
|
966
|
-
// entering/leaving "auto" with content taller than fullPx
|
|
967
|
-
// changes the box's actual CSS height, and without this it
|
|
968
|
-
// would snap instantly while transform eases in over 300ms —
|
|
969
|
-
// a visible pop of content before the slide animation catches
|
|
970
|
-
// up.
|
|
971
|
-
transition: isDragging ? "none" : "transform 300ms ease-out, height 300ms ease-out, margin-bottom 250ms ease-in-out"
|
|
972
|
-
},
|
|
973
|
-
children: [
|
|
974
|
-
handleVisible && /* @__PURE__ */ jsx3(
|
|
975
|
-
"div",
|
|
976
|
-
{
|
|
977
|
-
className: "w-full h-8 flex flex-col items-center justify-center cursor-pointer hover:bg-white/5 rounded-t-2xl transition-colors border-b border-white/5",
|
|
978
|
-
onClick: () => {
|
|
979
|
-
if (suppressNextClickRef.current) return;
|
|
980
|
-
handleHandleClick();
|
|
981
|
-
},
|
|
982
|
-
ref: handleBarRef,
|
|
983
|
-
children: /* @__PURE__ */ jsx3("div", { className: "w-12 h-1 bg-white/25 rounded-full" })
|
|
984
|
-
}
|
|
985
|
-
),
|
|
986
|
-
/* @__PURE__ */ jsxs2(
|
|
987
|
-
"div",
|
|
988
|
-
{
|
|
989
|
-
className: "flex-1 flex flex-col overflow-hidden px-4 pb-4 pt-2 transition-[margin-top] duration-250 ease-in-out relative",
|
|
990
|
-
ref: contentAreaRef,
|
|
991
|
-
style: {
|
|
992
|
-
marginTop: state === "closed" ? `${safeAreaInsets.bottom}px` : "0px"
|
|
993
|
-
},
|
|
994
|
-
children: [
|
|
995
|
-
/* @__PURE__ */ jsx3(
|
|
996
|
-
"div",
|
|
997
|
-
{
|
|
998
|
-
className: "flex-1 overflow-y-auto no-scrollbar",
|
|
999
|
-
onScroll: handleScroll,
|
|
1000
|
-
ref: scrollContainerRef,
|
|
1001
|
-
style: {
|
|
1002
|
-
paddingBottom: state === "peek" ? `${shiftPx}px` : "0px"
|
|
1003
|
-
},
|
|
1004
|
-
children: menuContent ? menuContent : /* @__PURE__ */ jsx3("div", { className: "flex flex-col gap-1", children: menuItems.map((item) => /* @__PURE__ */ jsxs2(
|
|
1005
|
-
Button,
|
|
1006
|
-
{
|
|
1007
|
-
className: `flex items-center gap-3 w-full py-3 px-3.5 rounded-xl text-left cursor-pointer transition-all duration-150 justify-start hover:bg-white/5 hover:text-white active:bg-white/10 text-white ${item.disabled ? "opacity-45 cursor-not-allowed pointer-events-none" : ""}`,
|
|
1008
|
-
disabled: item.disabled,
|
|
1009
|
-
onClick: () => {
|
|
1010
|
-
if (!item.disabled) {
|
|
1011
|
-
item.onPress();
|
|
1012
|
-
onChangeState("closed");
|
|
1013
|
-
}
|
|
1014
|
-
},
|
|
1015
|
-
variant: "ghost",
|
|
1016
|
-
children: [
|
|
1017
|
-
/* @__PURE__ */ jsxs2("div", { className: "relative flex items-center justify-center w-8 h-8 rounded-lg bg-white/5 text-zinc-300", children: [
|
|
1018
|
-
item.icon,
|
|
1019
|
-
item.badge !== void 0 && /* @__PURE__ */ jsx3("span", { className: "absolute -top-1 -right-1 bg-cyan-500 text-black text-[9px] font-extrabold min-w-[15px] h-3.5 rounded-full flex items-center justify-center px-1 border border-zinc-950 shadow", children: item.badge })
|
|
1020
|
-
] }),
|
|
1021
|
-
/* @__PURE__ */ jsx3("span", { className: "text-sm font-medium tracking-wide", children: item.label })
|
|
1022
|
-
]
|
|
1023
|
-
},
|
|
1024
|
-
item.id
|
|
1025
|
-
)) })
|
|
1026
|
-
}
|
|
1027
|
-
),
|
|
1028
|
-
showScrollToTopButton && showScrollTop && /* @__PURE__ */ jsx3(
|
|
510
|
+
state === "closed" && /* @__PURE__ */ jsx3(
|
|
511
|
+
Button,
|
|
512
|
+
{
|
|
513
|
+
className: "absolute top-4 left-4 z-40 w-12 h-12 rounded-full bg-zinc-950/80 backdrop-blur-md border border-white/10 shadow-lg flex items-center justify-center text-white active:scale-95 transition-all cursor-pointer hover:bg-zinc-900 hover:text-white p-0!",
|
|
514
|
+
onClick: () => onChangeState("full"),
|
|
515
|
+
variant: "ghost",
|
|
516
|
+
children: /* @__PURE__ */ jsxs2(
|
|
517
|
+
"svg",
|
|
518
|
+
{
|
|
519
|
+
fill: "none",
|
|
520
|
+
height: "24",
|
|
521
|
+
stroke: "currentColor",
|
|
522
|
+
strokeLinecap: "round",
|
|
523
|
+
strokeLinejoin: "round",
|
|
524
|
+
strokeWidth: "2",
|
|
525
|
+
viewBox: "0 0 24 24",
|
|
526
|
+
width: "24",
|
|
527
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
528
|
+
children: [
|
|
529
|
+
/* @__PURE__ */ jsx3("line", { x1: "4", x2: "20", y1: "12", y2: "12" }),
|
|
530
|
+
/* @__PURE__ */ jsx3("line", { x1: "4", x2: "20", y1: "6", y2: "6" }),
|
|
531
|
+
/* @__PURE__ */ jsx3("line", { x1: "4", x2: "20", y1: "18", y2: "18" })
|
|
532
|
+
]
|
|
533
|
+
}
|
|
534
|
+
)
|
|
535
|
+
}
|
|
536
|
+
),
|
|
537
|
+
/* @__PURE__ */ jsx3(
|
|
538
|
+
Sheet,
|
|
539
|
+
{
|
|
540
|
+
onOpenChange: (open) => onChangeState(open ? "full" : "closed"),
|
|
541
|
+
open: state !== "closed",
|
|
542
|
+
children: /* @__PURE__ */ jsxs2(
|
|
543
|
+
SheetContent,
|
|
544
|
+
{
|
|
545
|
+
className: "w-80 bg-zinc-950/85 backdrop-blur-md border-r border-y border-white/10 rounded-r-2xl shadow-2xl p-4 text-white flex flex-col h-full overflow-hidden",
|
|
546
|
+
portal: false,
|
|
547
|
+
side: "left",
|
|
548
|
+
children: [
|
|
549
|
+
/* @__PURE__ */ jsx3(SheetHeader, { className: "pb-3 border-b border-white/10 mb-2 text-left", children: /* @__PURE__ */ jsx3(SheetTitle, { className: "text-sm font-bold tracking-wider text-zinc-400 uppercase", children: "Menu" }) }),
|
|
550
|
+
/* @__PURE__ */ jsx3(
|
|
551
|
+
"div",
|
|
552
|
+
{
|
|
553
|
+
className: "flex-1 overflow-y-auto no-scrollbar pr-2",
|
|
554
|
+
onScroll: handleScroll,
|
|
555
|
+
ref: scrollContainerRef,
|
|
556
|
+
children: menuContent ? menuContent : /* @__PURE__ */ jsx3("div", { className: "flex flex-col gap-1.5", children: menuItems.map((item) => /* @__PURE__ */ jsxs2(
|
|
1029
557
|
Button,
|
|
1030
558
|
{
|
|
1031
|
-
className:
|
|
559
|
+
className: `flex items-center gap-3 w-full py-3 px-3.5 rounded-xl text-left cursor-pointer transition-all duration-150 justify-start hover:bg-white/5 hover:text-white active:bg-white/10 text-white ${item.disabled ? "opacity-45 cursor-not-allowed pointer-events-none" : ""}`,
|
|
560
|
+
disabled: item.disabled,
|
|
1032
561
|
onClick: () => {
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
}
|
|
1037
|
-
},
|
|
1038
|
-
style: {
|
|
1039
|
-
bottom: state === "peek" ? `calc(${24 + shiftPx}px + var(--drag-offset, 0px))` : `calc(24px + var(--drag-offset, 0px))`
|
|
562
|
+
if (!item.disabled) {
|
|
563
|
+
item.onPress();
|
|
564
|
+
onChangeState("closed");
|
|
565
|
+
}
|
|
1040
566
|
},
|
|
1041
567
|
variant: "ghost",
|
|
1042
|
-
children:
|
|
1043
|
-
"
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
568
|
+
children: [
|
|
569
|
+
/* @__PURE__ */ jsxs2("div", { className: "relative flex items-center justify-center w-8 h-8 rounded-lg bg-white/5 text-zinc-300", children: [
|
|
570
|
+
item.icon,
|
|
571
|
+
item.badge !== void 0 && /* @__PURE__ */ jsx3("span", { className: "absolute -top-1 -right-1 bg-cyan-500 text-black text-[9px] font-extrabold min-w-[15px] h-3.5 rounded-full flex items-center justify-center px-1 border border-zinc-950 shadow", children: item.badge })
|
|
572
|
+
] }),
|
|
573
|
+
/* @__PURE__ */ jsx3("span", { className: "text-sm font-medium tracking-wide flex-1", children: item.label })
|
|
574
|
+
]
|
|
575
|
+
},
|
|
576
|
+
item.id
|
|
577
|
+
)) })
|
|
578
|
+
}
|
|
579
|
+
),
|
|
580
|
+
showScrollToTopButton && showScrollTop && /* @__PURE__ */ jsx3(
|
|
581
|
+
Button,
|
|
582
|
+
{
|
|
583
|
+
className: "absolute bottom-6 right-6 z-50 flex items-center justify-center w-10 h-10 rounded-full bg-cyan-500 hover:bg-cyan-400 active:scale-95 text-black hover:text-black shadow-lg shadow-cyan-500/25 transition-all duration-200 cursor-pointer p-0!",
|
|
584
|
+
onClick: () => {
|
|
585
|
+
scrollContainerRef.current?.scrollTo({
|
|
586
|
+
behavior: "smooth",
|
|
587
|
+
top: 0
|
|
588
|
+
});
|
|
589
|
+
},
|
|
590
|
+
variant: "ghost",
|
|
591
|
+
children: /* @__PURE__ */ jsx3(
|
|
592
|
+
"svg",
|
|
593
|
+
{
|
|
594
|
+
fill: "none",
|
|
595
|
+
height: "20",
|
|
596
|
+
stroke: "currentColor",
|
|
597
|
+
strokeLinecap: "round",
|
|
598
|
+
strokeLinejoin: "round",
|
|
599
|
+
strokeWidth: "2.5",
|
|
600
|
+
viewBox: "0 0 24 24",
|
|
601
|
+
width: "20",
|
|
602
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
603
|
+
children: /* @__PURE__ */ jsx3("polyline", { points: "18 15 12 9 6 15" })
|
|
1057
604
|
}
|
|
1058
605
|
)
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
606
|
+
}
|
|
607
|
+
)
|
|
608
|
+
]
|
|
609
|
+
}
|
|
610
|
+
)
|
|
611
|
+
}
|
|
1065
612
|
)
|
|
1066
613
|
] });
|
|
1067
614
|
}
|
|
1068
615
|
);
|
|
616
|
+
MapDrawer.displayName = "MapDrawer";
|
|
1069
617
|
|
|
1070
618
|
// src/components/ui/card.tsx
|
|
1071
619
|
import * as React3 from "react";
|
|
@@ -1516,40 +1064,348 @@ var MapRightControls = ({
|
|
|
1516
1064
|
);
|
|
1517
1065
|
};
|
|
1518
1066
|
|
|
1519
|
-
// src/components/Map/
|
|
1067
|
+
// src/components/Map/components/MobileBottomDrawer.tsx
|
|
1068
|
+
import { interpolate, useTransform } from "motion/react";
|
|
1520
1069
|
import {
|
|
1521
|
-
|
|
1070
|
+
forwardRef as forwardRef5,
|
|
1522
1071
|
useCallback,
|
|
1523
|
-
|
|
1072
|
+
useEffect,
|
|
1073
|
+
useImperativeHandle as useImperativeHandle2,
|
|
1524
1074
|
useMemo,
|
|
1525
1075
|
useRef as useRef2,
|
|
1526
1076
|
useState as useState2
|
|
1527
1077
|
} from "react";
|
|
1528
|
-
import {
|
|
1078
|
+
import { Sheet as Sheet2 } from "react-modal-sheet";
|
|
1079
|
+
import { Fragment as Fragment2, jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1080
|
+
var resolveHeightToPixels = (height, containerHeight) => {
|
|
1081
|
+
if (typeof height === "number") {
|
|
1082
|
+
return height;
|
|
1083
|
+
}
|
|
1084
|
+
if (height.endsWith("%")) {
|
|
1085
|
+
return parseFloat(height) / 100 * containerHeight;
|
|
1086
|
+
}
|
|
1087
|
+
return parseFloat(height);
|
|
1088
|
+
};
|
|
1089
|
+
var HANDLE_HEIGHT_PX = 32;
|
|
1090
|
+
var SHEET_TWEEN_CONFIG = {
|
|
1091
|
+
duration: 0.4,
|
|
1092
|
+
ease: [0.32, 0.72, 0, 1]
|
|
1093
|
+
};
|
|
1094
|
+
var SHEET_DRAG_VELOCITY_THRESHOLD = 1700;
|
|
1095
|
+
var MobileBottomDrawer = forwardRef5(
|
|
1096
|
+
({
|
|
1097
|
+
menuItems,
|
|
1098
|
+
state,
|
|
1099
|
+
onChangeState,
|
|
1100
|
+
drawerPeekHeight,
|
|
1101
|
+
drawerFullHeight,
|
|
1102
|
+
drawerAutoMaxHeight,
|
|
1103
|
+
containerHeight,
|
|
1104
|
+
menuContent,
|
|
1105
|
+
enableTouchDrag = true,
|
|
1106
|
+
handleVisible = true,
|
|
1107
|
+
onAutoContentHeightChange,
|
|
1108
|
+
showScrollToTopButton = true,
|
|
1109
|
+
scrollToTopThreshold = 300,
|
|
1110
|
+
safeAreaInsets = { bottom: 0, left: 0, right: 0, top: 0 }
|
|
1111
|
+
}, ref) => {
|
|
1112
|
+
const scrollRef = useRef2(null);
|
|
1113
|
+
useImperativeHandle2(ref, () => scrollRef.current);
|
|
1114
|
+
const headerRef = useRef2(null);
|
|
1115
|
+
const contentWrapperRef = useRef2(null);
|
|
1116
|
+
const [viewportHeight, setViewportHeight] = useState2(
|
|
1117
|
+
() => containerHeight ?? (typeof window !== "undefined" ? window.innerHeight : 800)
|
|
1118
|
+
);
|
|
1119
|
+
useEffect(() => {
|
|
1120
|
+
if (containerHeight) {
|
|
1121
|
+
setViewportHeight(containerHeight);
|
|
1122
|
+
return;
|
|
1123
|
+
}
|
|
1124
|
+
if (typeof window === "undefined") return;
|
|
1125
|
+
const update = () => setViewportHeight(window.innerHeight);
|
|
1126
|
+
update();
|
|
1127
|
+
window.addEventListener("resize", update);
|
|
1128
|
+
return () => window.removeEventListener("resize", update);
|
|
1129
|
+
}, [containerHeight]);
|
|
1130
|
+
const [autoContentPx, setAutoContentPx] = useState2(0);
|
|
1131
|
+
useEffect(() => {
|
|
1132
|
+
const contentEl = contentWrapperRef.current;
|
|
1133
|
+
if (!contentEl) return;
|
|
1134
|
+
const measure = () => {
|
|
1135
|
+
const headerHeight = handleVisible ? headerRef.current?.offsetHeight ?? 0 : 0;
|
|
1136
|
+
const px = headerHeight + contentEl.scrollHeight;
|
|
1137
|
+
setAutoContentPx(px);
|
|
1138
|
+
onAutoContentHeightChange?.(px);
|
|
1139
|
+
};
|
|
1140
|
+
measure();
|
|
1141
|
+
const ro = new ResizeObserver(measure);
|
|
1142
|
+
ro.observe(contentEl);
|
|
1143
|
+
return () => ro.disconnect();
|
|
1144
|
+
}, [handleVisible, onAutoContentHeightChange]);
|
|
1145
|
+
const closedPx = (handleVisible ? HANDLE_HEIGHT_PX : 0) + safeAreaInsets.bottom;
|
|
1146
|
+
const peekPx = resolveHeightToPixels(
|
|
1147
|
+
drawerPeekHeight ?? "15%",
|
|
1148
|
+
viewportHeight
|
|
1149
|
+
);
|
|
1150
|
+
const autoMaxPx = resolveHeightToPixels(
|
|
1151
|
+
drawerAutoMaxHeight ?? "100%",
|
|
1152
|
+
viewportHeight
|
|
1153
|
+
);
|
|
1154
|
+
const autoPx = Math.min(autoMaxPx, Math.max(autoContentPx, closedPx + 1));
|
|
1155
|
+
const { snapPoints, snapLabels, backdropOutput } = useMemo(() => {
|
|
1156
|
+
const normalize = (raw) => raw > 0 && raw <= 1 ? raw * viewportHeight : raw;
|
|
1157
|
+
const unsorted = [
|
|
1158
|
+
{ label: "closed", raw: 0 },
|
|
1159
|
+
{ label: "closed", raw: closedPx },
|
|
1160
|
+
{ label: "peek", raw: peekPx },
|
|
1161
|
+
{ label: "auto", raw: autoPx },
|
|
1162
|
+
{ label: "full", raw: 1 }
|
|
1163
|
+
];
|
|
1164
|
+
const entries = unsorted.sort(
|
|
1165
|
+
(a, b) => normalize(a.raw) - normalize(b.raw)
|
|
1166
|
+
);
|
|
1167
|
+
const deduped = [];
|
|
1168
|
+
for (const entry of entries) {
|
|
1169
|
+
const prev = deduped[deduped.length - 1];
|
|
1170
|
+
if (prev && Math.abs(normalize(prev.raw) - normalize(entry.raw)) < 0.5) {
|
|
1171
|
+
deduped[deduped.length - 1] = entry;
|
|
1172
|
+
continue;
|
|
1173
|
+
}
|
|
1174
|
+
deduped.push(entry);
|
|
1175
|
+
}
|
|
1176
|
+
return {
|
|
1177
|
+
backdropOutput: deduped.map(
|
|
1178
|
+
(d) => d.label === "full" || d.label === "auto" ? 1 : 0
|
|
1179
|
+
),
|
|
1180
|
+
snapLabels: deduped.map((d) => d.label),
|
|
1181
|
+
snapPoints: deduped.map((d) => d.raw)
|
|
1182
|
+
};
|
|
1183
|
+
}, [closedPx, peekPx, autoPx, viewportHeight]);
|
|
1184
|
+
const currentIndex = Math.max(0, snapLabels.lastIndexOf(state));
|
|
1185
|
+
const sheetRef = useRef2(null);
|
|
1186
|
+
useEffect(() => {
|
|
1187
|
+
let cancelled = false;
|
|
1188
|
+
let attempts = 0;
|
|
1189
|
+
const trySnap = () => {
|
|
1190
|
+
if (cancelled) return;
|
|
1191
|
+
const ref2 = sheetRef.current;
|
|
1192
|
+
if (ref2 && ref2.snapPoints.length > 0) {
|
|
1193
|
+
ref2.snapTo(currentIndex);
|
|
1194
|
+
return;
|
|
1195
|
+
}
|
|
1196
|
+
attempts += 1;
|
|
1197
|
+
if (attempts > 60) return;
|
|
1198
|
+
requestAnimationFrame(trySnap);
|
|
1199
|
+
};
|
|
1200
|
+
trySnap();
|
|
1201
|
+
return () => {
|
|
1202
|
+
cancelled = true;
|
|
1203
|
+
};
|
|
1204
|
+
}, [currentIndex]);
|
|
1205
|
+
const handleSnap = useCallback(
|
|
1206
|
+
(index) => {
|
|
1207
|
+
const label = snapLabels[index] ?? "closed";
|
|
1208
|
+
if (label !== state) onChangeState(label);
|
|
1209
|
+
},
|
|
1210
|
+
[snapLabels, state, onChangeState]
|
|
1211
|
+
);
|
|
1212
|
+
const handleHandleClick = () => {
|
|
1213
|
+
if (state === "closed") {
|
|
1214
|
+
onChangeState("peek");
|
|
1215
|
+
} else if (state === "peek") {
|
|
1216
|
+
onChangeState("full");
|
|
1217
|
+
} else if (state === "auto") {
|
|
1218
|
+
onChangeState("closed");
|
|
1219
|
+
} else {
|
|
1220
|
+
onChangeState("peek");
|
|
1221
|
+
}
|
|
1222
|
+
};
|
|
1223
|
+
const [showScrollTop, setShowScrollTop] = useState2(false);
|
|
1224
|
+
useEffect(() => {
|
|
1225
|
+
const el = scrollRef.current;
|
|
1226
|
+
if (!el) return;
|
|
1227
|
+
const onScroll = () => {
|
|
1228
|
+
setShowScrollTop(
|
|
1229
|
+
state !== "closed" && el.scrollTop > scrollToTopThreshold
|
|
1230
|
+
);
|
|
1231
|
+
};
|
|
1232
|
+
el.addEventListener("scroll", onScroll);
|
|
1233
|
+
return () => el.removeEventListener("scroll", onScroll);
|
|
1234
|
+
}, [state, scrollToTopThreshold]);
|
|
1235
|
+
useEffect(() => {
|
|
1236
|
+
if (state === "closed") setShowScrollTop(false);
|
|
1237
|
+
}, [state]);
|
|
1238
|
+
const dragDisabled = !enableTouchDrag;
|
|
1239
|
+
return /* @__PURE__ */ jsxs5(Fragment2, { children: [
|
|
1240
|
+
/* @__PURE__ */ jsx7("style", { children: `
|
|
1241
|
+
.no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }
|
|
1242
|
+
.no-scrollbar::-webkit-scrollbar { display: none; }
|
|
1243
|
+
` }),
|
|
1244
|
+
/* @__PURE__ */ jsxs5(
|
|
1245
|
+
Sheet2,
|
|
1246
|
+
{
|
|
1247
|
+
disableDismiss: true,
|
|
1248
|
+
disableDrag: dragDisabled,
|
|
1249
|
+
dragVelocityThreshold: SHEET_DRAG_VELOCITY_THRESHOLD,
|
|
1250
|
+
initialSnap: currentIndex,
|
|
1251
|
+
isOpen: true,
|
|
1252
|
+
onClose: () => onChangeState("closed"),
|
|
1253
|
+
onSnap: handleSnap,
|
|
1254
|
+
ref: sheetRef,
|
|
1255
|
+
snapPoints,
|
|
1256
|
+
tweenConfig: SHEET_TWEEN_CONFIG,
|
|
1257
|
+
children: [
|
|
1258
|
+
/* @__PURE__ */ jsxs5(
|
|
1259
|
+
Sheet2.Container,
|
|
1260
|
+
{
|
|
1261
|
+
className: "!bg-zinc-950/85 !backdrop-blur-md !border !border-white/10 !border-b-0 !rounded-t-2xl !shadow-2xl ",
|
|
1262
|
+
style: { paddingBottom: safeAreaInsets.bottom },
|
|
1263
|
+
children: [
|
|
1264
|
+
handleVisible && /* @__PURE__ */ jsx7(
|
|
1265
|
+
Sheet2.Header,
|
|
1266
|
+
{
|
|
1267
|
+
className: "!bg-transparent cursor-pointer hover:!bg-white/5 transition-colors",
|
|
1268
|
+
onClick: handleHandleClick,
|
|
1269
|
+
ref: headerRef
|
|
1270
|
+
}
|
|
1271
|
+
),
|
|
1272
|
+
/* @__PURE__ */ jsxs5(
|
|
1273
|
+
Sheet2.Content,
|
|
1274
|
+
{
|
|
1275
|
+
className: "!bg-transparent",
|
|
1276
|
+
disableDrag: (info) => dragDisabled || info.scrollPosition === "middle",
|
|
1277
|
+
disableScroll: (info) => !dragDisabled && info.currentSnap !== snapPoints.length - 1,
|
|
1278
|
+
scrollClassName: "no-scrollbar",
|
|
1279
|
+
scrollRef,
|
|
1280
|
+
children: [
|
|
1281
|
+
/* @__PURE__ */ jsx7("div", { className: "px-4 pb-4 pt-2 relative", ref: contentWrapperRef, children: menuContent ? menuContent : /* @__PURE__ */ jsx7("div", { className: "flex flex-col gap-1", children: menuItems.map((item) => /* @__PURE__ */ jsxs5(
|
|
1282
|
+
Button,
|
|
1283
|
+
{
|
|
1284
|
+
className: `flex items-center gap-3 w-full py-3 px-3.5 rounded-xl text-left cursor-pointer transition-all duration-150 justify-start hover:bg-white/5 hover:text-white active:bg-white/10 text-white ${item.disabled ? "opacity-45 cursor-not-allowed pointer-events-none" : ""}`,
|
|
1285
|
+
disabled: item.disabled,
|
|
1286
|
+
onClick: () => {
|
|
1287
|
+
if (!item.disabled) {
|
|
1288
|
+
item.onPress();
|
|
1289
|
+
onChangeState("closed");
|
|
1290
|
+
}
|
|
1291
|
+
},
|
|
1292
|
+
variant: "ghost",
|
|
1293
|
+
children: [
|
|
1294
|
+
/* @__PURE__ */ jsxs5("div", { className: "relative flex items-center justify-center w-8 h-8 rounded-lg bg-white/5 text-zinc-300", children: [
|
|
1295
|
+
item.icon,
|
|
1296
|
+
item.badge !== void 0 && /* @__PURE__ */ jsx7("span", { className: "absolute -top-1 -right-1 bg-cyan-500 text-black text-[9px] font-extrabold min-w-[15px] h-3.5 rounded-full flex items-center justify-center px-1 border border-zinc-950 shadow", children: item.badge })
|
|
1297
|
+
] }),
|
|
1298
|
+
/* @__PURE__ */ jsx7("span", { className: "text-sm font-medium tracking-wide", children: item.label })
|
|
1299
|
+
]
|
|
1300
|
+
},
|
|
1301
|
+
item.id
|
|
1302
|
+
)) }) }),
|
|
1303
|
+
showScrollToTopButton && showScrollTop && /* @__PURE__ */ jsx7(
|
|
1304
|
+
Button,
|
|
1305
|
+
{
|
|
1306
|
+
className: "absolute bottom-4 right-6 z-50 flex items-center justify-center w-10 h-10 rounded-full bg-cyan-500 hover:bg-cyan-400 active:scale-95 text-black hover:text-black shadow-lg shadow-cyan-500/25 transition-all duration-200 cursor-pointer p-0!",
|
|
1307
|
+
onClick: () => {
|
|
1308
|
+
scrollRef.current?.scrollTo({ behavior: "smooth", top: 0 });
|
|
1309
|
+
},
|
|
1310
|
+
variant: "ghost",
|
|
1311
|
+
children: /* @__PURE__ */ jsx7(
|
|
1312
|
+
"svg",
|
|
1313
|
+
{
|
|
1314
|
+
fill: "none",
|
|
1315
|
+
height: "20",
|
|
1316
|
+
stroke: "currentColor",
|
|
1317
|
+
strokeLinecap: "round",
|
|
1318
|
+
strokeLinejoin: "round",
|
|
1319
|
+
strokeWidth: "2.5",
|
|
1320
|
+
viewBox: "0 0 24 24",
|
|
1321
|
+
width: "20",
|
|
1322
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1323
|
+
children: /* @__PURE__ */ jsx7("polyline", { points: "18 15 12 9 6 15" })
|
|
1324
|
+
}
|
|
1325
|
+
)
|
|
1326
|
+
}
|
|
1327
|
+
)
|
|
1328
|
+
]
|
|
1329
|
+
}
|
|
1330
|
+
)
|
|
1331
|
+
]
|
|
1332
|
+
}
|
|
1333
|
+
),
|
|
1334
|
+
/* @__PURE__ */ jsx7(
|
|
1335
|
+
DrawerBackdrop,
|
|
1336
|
+
{
|
|
1337
|
+
active: state === "full" || state === "auto",
|
|
1338
|
+
onTap: () => onChangeState("closed"),
|
|
1339
|
+
output: backdropOutput
|
|
1340
|
+
}
|
|
1341
|
+
)
|
|
1342
|
+
]
|
|
1343
|
+
}
|
|
1344
|
+
)
|
|
1345
|
+
] });
|
|
1346
|
+
}
|
|
1347
|
+
);
|
|
1348
|
+
MobileBottomDrawer.displayName = "MobileBottomDrawer";
|
|
1349
|
+
function DrawerBackdrop({
|
|
1350
|
+
active,
|
|
1351
|
+
output,
|
|
1352
|
+
onTap
|
|
1353
|
+
}) {
|
|
1354
|
+
const { y, snapPoints } = Sheet2.useContext();
|
|
1355
|
+
const opacity = useTransform(y, (value) => {
|
|
1356
|
+
if (snapPoints.length === 0 || output.length !== snapPoints.length) {
|
|
1357
|
+
return 0;
|
|
1358
|
+
}
|
|
1359
|
+
const mix = interpolate(
|
|
1360
|
+
snapPoints.map((point) => point.snapValueY),
|
|
1361
|
+
output
|
|
1362
|
+
);
|
|
1363
|
+
return mix(value) * 0.45;
|
|
1364
|
+
});
|
|
1365
|
+
return /* @__PURE__ */ jsx7(
|
|
1366
|
+
Sheet2.Backdrop,
|
|
1367
|
+
{
|
|
1368
|
+
className: "!bg-black !backdrop-blur-[1px]",
|
|
1369
|
+
onTap: active ? onTap : void 0,
|
|
1370
|
+
style: { opacity }
|
|
1371
|
+
}
|
|
1372
|
+
);
|
|
1373
|
+
}
|
|
1374
|
+
|
|
1375
|
+
// src/components/Map/MapContext.tsx
|
|
1376
|
+
import {
|
|
1377
|
+
createContext as createContext2,
|
|
1378
|
+
useCallback as useCallback2,
|
|
1379
|
+
useContext as useContext2,
|
|
1380
|
+
useMemo as useMemo2,
|
|
1381
|
+
useRef as useRef3,
|
|
1382
|
+
useState as useState3
|
|
1383
|
+
} from "react";
|
|
1384
|
+
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
1529
1385
|
var MapControlsContext = createContext2(
|
|
1530
1386
|
null
|
|
1531
1387
|
);
|
|
1532
1388
|
var SDKMapProvider = ({
|
|
1533
1389
|
children
|
|
1534
1390
|
}) => {
|
|
1535
|
-
const [isFollowing, setIsFollowing] =
|
|
1536
|
-
const [bearing, setBearingState] =
|
|
1537
|
-
const [pitch, setPitchState] =
|
|
1538
|
-
const [drawerState, setDrawerStateInternal] =
|
|
1539
|
-
const drawerContentRef =
|
|
1540
|
-
const setDrawerState =
|
|
1391
|
+
const [isFollowing, setIsFollowing] = useState3(true);
|
|
1392
|
+
const [bearing, setBearingState] = useState3(0);
|
|
1393
|
+
const [pitch, setPitchState] = useState3(0);
|
|
1394
|
+
const [drawerState, setDrawerStateInternal] = useState3("closed");
|
|
1395
|
+
const drawerContentRef = useRef3(null);
|
|
1396
|
+
const setDrawerState = useCallback2((val) => {
|
|
1541
1397
|
setDrawerStateInternal(val);
|
|
1542
1398
|
}, []);
|
|
1543
|
-
const [drawerHandleVisible, setDrawerHandleVisibleState] =
|
|
1544
|
-
const setDrawerHandleVisible =
|
|
1399
|
+
const [drawerHandleVisible, setDrawerHandleVisibleState] = useState3(true);
|
|
1400
|
+
const setDrawerHandleVisible = useCallback2((val) => {
|
|
1545
1401
|
setDrawerHandleVisibleState((prev) => prev === val ? prev : val);
|
|
1546
1402
|
}, []);
|
|
1547
|
-
const [hasControls, setHasControlsState] =
|
|
1548
|
-
const setHasControls =
|
|
1403
|
+
const [hasControls, setHasControlsState] = useState3(false);
|
|
1404
|
+
const setHasControls = useCallback2((val) => {
|
|
1549
1405
|
setHasControlsState((prev) => prev === val ? prev : val);
|
|
1550
1406
|
}, []);
|
|
1551
|
-
const [etaData, setEtaDataState] =
|
|
1552
|
-
const setEtaData =
|
|
1407
|
+
const [etaData, setEtaDataState] = useState3(void 0);
|
|
1408
|
+
const setEtaData = useCallback2((newData) => {
|
|
1553
1409
|
setEtaDataState((prev) => {
|
|
1554
1410
|
if (!prev && !newData) return prev;
|
|
1555
1411
|
if (!prev || !newData) return newData;
|
|
@@ -1559,29 +1415,29 @@ var SDKMapProvider = ({
|
|
|
1559
1415
|
return newData;
|
|
1560
1416
|
});
|
|
1561
1417
|
}, []);
|
|
1562
|
-
const [insets, setInsetsState] =
|
|
1418
|
+
const [insets, setInsetsState] = useState3({
|
|
1563
1419
|
bottom: 0,
|
|
1564
1420
|
left: 0,
|
|
1565
1421
|
right: 0,
|
|
1566
1422
|
top: 0
|
|
1567
1423
|
});
|
|
1568
|
-
const setInsets =
|
|
1424
|
+
const setInsets = useCallback2((newInsets) => {
|
|
1569
1425
|
setInsetsState((prev) => ({ ...prev, ...newInsets }));
|
|
1570
1426
|
}, []);
|
|
1571
|
-
const centerCallbackRef =
|
|
1572
|
-
const resetBearingCallbackRef =
|
|
1573
|
-
const flyToCallbackRef =
|
|
1574
|
-
const centerOnUser =
|
|
1427
|
+
const centerCallbackRef = useRef3(null);
|
|
1428
|
+
const resetBearingCallbackRef = useRef3(null);
|
|
1429
|
+
const flyToCallbackRef = useRef3(null);
|
|
1430
|
+
const centerOnUser = useCallback2((params) => {
|
|
1575
1431
|
if (centerCallbackRef.current) {
|
|
1576
1432
|
centerCallbackRef.current(params);
|
|
1577
1433
|
}
|
|
1578
1434
|
}, []);
|
|
1579
|
-
const resetBearing =
|
|
1435
|
+
const resetBearing = useCallback2((params) => {
|
|
1580
1436
|
if (resetBearingCallbackRef.current) {
|
|
1581
1437
|
resetBearingCallbackRef.current(params);
|
|
1582
1438
|
}
|
|
1583
1439
|
}, []);
|
|
1584
|
-
const flyTo =
|
|
1440
|
+
const flyTo = useCallback2(
|
|
1585
1441
|
(coords, params) => {
|
|
1586
1442
|
if (flyToCallbackRef.current) {
|
|
1587
1443
|
flyToCallbackRef.current(coords, params);
|
|
@@ -1589,31 +1445,31 @@ var SDKMapProvider = ({
|
|
|
1589
1445
|
},
|
|
1590
1446
|
[]
|
|
1591
1447
|
);
|
|
1592
|
-
const _registerCenterCallback =
|
|
1448
|
+
const _registerCenterCallback = useCallback2(
|
|
1593
1449
|
(cb) => {
|
|
1594
1450
|
centerCallbackRef.current = cb;
|
|
1595
1451
|
},
|
|
1596
1452
|
[]
|
|
1597
1453
|
);
|
|
1598
|
-
const _registerResetBearingCallback =
|
|
1454
|
+
const _registerResetBearingCallback = useCallback2(
|
|
1599
1455
|
(cb) => {
|
|
1600
1456
|
resetBearingCallbackRef.current = cb;
|
|
1601
1457
|
},
|
|
1602
1458
|
[]
|
|
1603
1459
|
);
|
|
1604
|
-
const _registerFlyToCallback =
|
|
1460
|
+
const _registerFlyToCallback = useCallback2(
|
|
1605
1461
|
(cb) => {
|
|
1606
1462
|
flyToCallbackRef.current = cb;
|
|
1607
1463
|
},
|
|
1608
1464
|
[]
|
|
1609
1465
|
);
|
|
1610
|
-
const setBearing =
|
|
1466
|
+
const setBearing = useCallback2((b) => {
|
|
1611
1467
|
setBearingState(b);
|
|
1612
1468
|
}, []);
|
|
1613
|
-
const setPitch =
|
|
1469
|
+
const setPitch = useCallback2((p) => {
|
|
1614
1470
|
setPitchState(p);
|
|
1615
1471
|
}, []);
|
|
1616
|
-
const contextValue =
|
|
1472
|
+
const contextValue = useMemo2(
|
|
1617
1473
|
() => ({
|
|
1618
1474
|
_registerCenterCallback,
|
|
1619
1475
|
_registerFlyToCallback,
|
|
@@ -1663,7 +1519,7 @@ var SDKMapProvider = ({
|
|
|
1663
1519
|
setInsets
|
|
1664
1520
|
]
|
|
1665
1521
|
);
|
|
1666
|
-
return /* @__PURE__ */
|
|
1522
|
+
return /* @__PURE__ */ jsx8(MapControlsContext.Provider, { value: contextValue, children });
|
|
1667
1523
|
};
|
|
1668
1524
|
var useMapControls = () => {
|
|
1669
1525
|
const context = useContext2(MapControlsContext);
|
|
@@ -1674,8 +1530,8 @@ var useMapControls = () => {
|
|
|
1674
1530
|
};
|
|
1675
1531
|
|
|
1676
1532
|
// src/components/Map/components/MapControls.tsx
|
|
1677
|
-
import { useCallback as
|
|
1678
|
-
import { Fragment as
|
|
1533
|
+
import { useCallback as useCallback3, useContext as useContext3, useEffect as useEffect2, useRef as useRef4, useState as useState4 } from "react";
|
|
1534
|
+
import { Fragment as Fragment3, jsx as jsx9, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1679
1535
|
var resolveHeightToPixels2 = (height, containerHeight) => {
|
|
1680
1536
|
if (typeof height === "number") {
|
|
1681
1537
|
return height;
|
|
@@ -1713,7 +1569,7 @@ var MapControls = ({
|
|
|
1713
1569
|
}) => {
|
|
1714
1570
|
const mapContext = useContext3(MapControlsContext);
|
|
1715
1571
|
const contextRef = mapContext?.drawerContentRef;
|
|
1716
|
-
const mergedRef =
|
|
1572
|
+
const mergedRef = useCallback3(
|
|
1717
1573
|
(node) => {
|
|
1718
1574
|
if (drawerContentRef) {
|
|
1719
1575
|
if (typeof drawerContentRef === "function") {
|
|
@@ -1728,11 +1584,11 @@ var MapControls = ({
|
|
|
1728
1584
|
},
|
|
1729
1585
|
[drawerContentRef, contextRef]
|
|
1730
1586
|
);
|
|
1731
|
-
const [localDrawerState, setLocalDrawerState] =
|
|
1587
|
+
const [localDrawerState, setLocalDrawerState] = useState4(
|
|
1732
1588
|
defaultState ?? "closed"
|
|
1733
1589
|
);
|
|
1734
1590
|
const drawerState = mapContext ? mapContext.drawerState : localDrawerState;
|
|
1735
|
-
const setDrawerState =
|
|
1591
|
+
const setDrawerState = useCallback3(
|
|
1736
1592
|
(state) => {
|
|
1737
1593
|
if (mapContext) {
|
|
1738
1594
|
mapContext.setDrawerState(state);
|
|
@@ -1747,9 +1603,9 @@ var MapControls = ({
|
|
|
1747
1603
|
mapContext.setDrawerState(defaultState);
|
|
1748
1604
|
}
|
|
1749
1605
|
}, []);
|
|
1750
|
-
const [side, setSide] =
|
|
1751
|
-
const containerRef =
|
|
1752
|
-
const [mapHeight, setMapHeight] =
|
|
1606
|
+
const [side, setSide] = useState4("left");
|
|
1607
|
+
const containerRef = useRef4(null);
|
|
1608
|
+
const [mapHeight, setMapHeight] = useState4(600);
|
|
1753
1609
|
useEffect2(() => {
|
|
1754
1610
|
const parent = containerRef.current?.parentElement;
|
|
1755
1611
|
if (!parent) return;
|
|
@@ -1788,9 +1644,7 @@ var MapControls = ({
|
|
|
1788
1644
|
};
|
|
1789
1645
|
const mapPitch = mapContext ? mapContext.pitch : 0;
|
|
1790
1646
|
const resolvedEtaData = etaData !== void 0 ? etaData : mapContext?.etaData;
|
|
1791
|
-
const [
|
|
1792
|
-
const [currentTouchY, setCurrentTouchY] = useState3(null);
|
|
1793
|
-
const [autoContentPx, setAutoContentPx] = useState3(0);
|
|
1647
|
+
const [autoContentPx, setAutoContentPx] = useState4(0);
|
|
1794
1648
|
useEffect2(() => {
|
|
1795
1649
|
if (typeof window === "undefined") return;
|
|
1796
1650
|
const checkLayout = () => {
|
|
@@ -1808,8 +1662,8 @@ var MapControls = ({
|
|
|
1808
1662
|
window.addEventListener("resize", checkLayout);
|
|
1809
1663
|
return () => window.removeEventListener("resize", checkLayout);
|
|
1810
1664
|
}, [drawerSide]);
|
|
1811
|
-
const isDragging =
|
|
1812
|
-
const
|
|
1665
|
+
const isDragging = false;
|
|
1666
|
+
const clampedDragOffset = 0;
|
|
1813
1667
|
const fullPx = resolveHeightToPixels2(drawerFullHeight || "85%", mapHeight);
|
|
1814
1668
|
const peekPx = resolveHeightToPixels2(drawerPeekHeight || "15%", mapHeight);
|
|
1815
1669
|
const autoMaxPx = resolveHeightToPixels2(
|
|
@@ -1819,22 +1673,6 @@ var MapControls = ({
|
|
|
1819
1673
|
const autoPx = Math.min(autoMaxPx, autoContentPx);
|
|
1820
1674
|
const bottomInset = mapContext?.insets.bottom || 0;
|
|
1821
1675
|
const handleVisible = mapContext ? mapContext.drawerHandleVisible : true;
|
|
1822
|
-
const closedPx = (handleVisible ? 32 : 0) + (drawerState === "closed" ? bottomInset : 0);
|
|
1823
|
-
let clampedDragOffset = dragOffset;
|
|
1824
|
-
if (drawerState === "full") {
|
|
1825
|
-
clampedDragOffset = Math.max(0, Math.min(fullPx - closedPx, dragOffset));
|
|
1826
|
-
} else if (drawerState === "peek") {
|
|
1827
|
-
clampedDragOffset = Math.max(
|
|
1828
|
-
-(fullPx - peekPx),
|
|
1829
|
-
// up to full
|
|
1830
|
-
Math.min(peekPx - closedPx, dragOffset)
|
|
1831
|
-
// down to closed
|
|
1832
|
-
);
|
|
1833
|
-
} else if (drawerState === "closed") {
|
|
1834
|
-
clampedDragOffset = Math.min(0, Math.max(-(fullPx - closedPx), dragOffset));
|
|
1835
|
-
} else if (drawerState === "auto") {
|
|
1836
|
-
clampedDragOffset = Math.max(0, dragOffset);
|
|
1837
|
-
}
|
|
1838
1676
|
let baseHeight = handleVisible ? 32 : 0;
|
|
1839
1677
|
if (drawerState === "peek") {
|
|
1840
1678
|
baseHeight = peekPx;
|
|
@@ -1843,7 +1681,7 @@ var MapControls = ({
|
|
|
1843
1681
|
} else if (drawerState === "auto") {
|
|
1844
1682
|
baseHeight = autoPx;
|
|
1845
1683
|
}
|
|
1846
|
-
const currentDrawerHeight = baseHeight
|
|
1684
|
+
const currentDrawerHeight = baseHeight;
|
|
1847
1685
|
const startFadeHeight = peekPx + 20;
|
|
1848
1686
|
const endFadeHeight = peekPx + (fullPx - peekPx) * 0.35;
|
|
1849
1687
|
let etaOpacity = 1;
|
|
@@ -1863,22 +1701,17 @@ var MapControls = ({
|
|
|
1863
1701
|
etaOpacity = drawerState === "full" ? 0 : 1;
|
|
1864
1702
|
etaBottomStyle = `calc(1rem + ${bottomInset}px)`;
|
|
1865
1703
|
}
|
|
1866
|
-
return /* @__PURE__ */
|
|
1867
|
-
/* @__PURE__ */
|
|
1868
|
-
/* @__PURE__ */
|
|
1869
|
-
|
|
1704
|
+
return /* @__PURE__ */ jsxs6(Fragment3, { children: [
|
|
1705
|
+
/* @__PURE__ */ jsx9("div", { ref: containerRef, style: { display: "none" } }),
|
|
1706
|
+
side === "bottom" ? /* @__PURE__ */ jsx9(
|
|
1707
|
+
MobileBottomDrawer,
|
|
1870
1708
|
{
|
|
1871
|
-
clampedDragOffset,
|
|
1872
1709
|
containerHeight: mapHeight,
|
|
1873
|
-
currentTouchY,
|
|
1874
1710
|
drawerAutoMaxHeight,
|
|
1875
1711
|
drawerFullHeight,
|
|
1876
1712
|
drawerPeekHeight,
|
|
1877
1713
|
enableTouchDrag,
|
|
1878
|
-
etaBarHeight,
|
|
1879
|
-
etaData: resolvedEtaData,
|
|
1880
1714
|
handleVisible,
|
|
1881
|
-
isDragging,
|
|
1882
1715
|
menuContent: children || menuContent,
|
|
1883
1716
|
menuItems,
|
|
1884
1717
|
onAutoContentHeightChange: setAutoContentPx,
|
|
@@ -1886,15 +1719,22 @@ var MapControls = ({
|
|
|
1886
1719
|
ref: mergedRef,
|
|
1887
1720
|
safeAreaInsets: mapContext?.insets,
|
|
1888
1721
|
scrollToTopThreshold,
|
|
1889
|
-
setCurrentTouchY,
|
|
1890
|
-
setTouchStartY,
|
|
1891
1722
|
showScrollToTopButton,
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1723
|
+
state: drawerState
|
|
1724
|
+
}
|
|
1725
|
+
) : /* @__PURE__ */ jsx9(
|
|
1726
|
+
MapDrawer,
|
|
1727
|
+
{
|
|
1728
|
+
menuContent: children || menuContent,
|
|
1729
|
+
menuItems,
|
|
1730
|
+
onChangeState: setDrawerState,
|
|
1731
|
+
ref: mergedRef,
|
|
1732
|
+
scrollToTopThreshold,
|
|
1733
|
+
showScrollToTopButton,
|
|
1734
|
+
state: drawerState
|
|
1895
1735
|
}
|
|
1896
1736
|
),
|
|
1897
|
-
/* @__PURE__ */
|
|
1737
|
+
/* @__PURE__ */ jsx9(
|
|
1898
1738
|
MapRightControls,
|
|
1899
1739
|
{
|
|
1900
1740
|
bottomOffset: controlsBottomOffset,
|
|
@@ -1917,7 +1757,7 @@ var MapControls = ({
|
|
|
1917
1757
|
side
|
|
1918
1758
|
}
|
|
1919
1759
|
),
|
|
1920
|
-
resolvedEtaData && /* @__PURE__ */
|
|
1760
|
+
resolvedEtaData && /* @__PURE__ */ jsx9(
|
|
1921
1761
|
MapEtaPanel,
|
|
1922
1762
|
{
|
|
1923
1763
|
etaData: resolvedEtaData,
|
|
@@ -1936,9 +1776,9 @@ var MapControls = ({
|
|
|
1936
1776
|
|
|
1937
1777
|
// src/components/Map/components/MapMenu.tsx
|
|
1938
1778
|
import { useContext as useContext4 } from "react";
|
|
1939
|
-
import { jsx as
|
|
1779
|
+
import { jsx as jsx10, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1940
1780
|
var MapMenu = ({ children }) => {
|
|
1941
|
-
return /* @__PURE__ */
|
|
1781
|
+
return /* @__PURE__ */ jsx10("div", { className: "flex flex-col gap-1.5", children });
|
|
1942
1782
|
};
|
|
1943
1783
|
var MapMenuItem = ({
|
|
1944
1784
|
id,
|
|
@@ -1957,7 +1797,7 @@ var MapMenuItem = ({
|
|
|
1957
1797
|
context.setDrawerState("closed");
|
|
1958
1798
|
}
|
|
1959
1799
|
};
|
|
1960
|
-
return /* @__PURE__ */
|
|
1800
|
+
return /* @__PURE__ */ jsxs7(
|
|
1961
1801
|
"button",
|
|
1962
1802
|
{
|
|
1963
1803
|
className: `flex items-center gap-3 w-full py-3 px-3.5 rounded-xl text-left cursor-pointer transition-all duration-150 ${disabled ? "opacity-45 cursor-not-allowed pointer-events-none" : "hover:bg-white/5 active:bg-white/10 text-white"}`,
|
|
@@ -1965,12 +1805,12 @@ var MapMenuItem = ({
|
|
|
1965
1805
|
onClick: handleClick,
|
|
1966
1806
|
type: "button",
|
|
1967
1807
|
children: [
|
|
1968
|
-
icon && /* @__PURE__ */
|
|
1808
|
+
icon && /* @__PURE__ */ jsxs7("div", { className: "relative flex items-center justify-center w-8 h-8 rounded-lg bg-white/5 text-zinc-300", children: [
|
|
1969
1809
|
icon,
|
|
1970
|
-
badge !== void 0 && /* @__PURE__ */
|
|
1810
|
+
badge !== void 0 && /* @__PURE__ */ jsx10("span", { className: "absolute -top-1 -right-1 bg-cyan-500 text-black text-[9px] font-extrabold min-w-[15px] h-3.5 rounded-full flex items-center justify-center px-1 border border-zinc-950 shadow", children: badge })
|
|
1971
1811
|
] }),
|
|
1972
|
-
/* @__PURE__ */
|
|
1973
|
-
/* @__PURE__ */
|
|
1812
|
+
/* @__PURE__ */ jsxs7("div", { className: "flex-1 flex flex-col justify-center", children: [
|
|
1813
|
+
/* @__PURE__ */ jsx10("span", { className: "text-sm font-medium tracking-wide flex-1", children: label }),
|
|
1974
1814
|
children
|
|
1975
1815
|
] })
|
|
1976
1816
|
]
|
|
@@ -1984,7 +1824,7 @@ var MapMenuTitle = ({
|
|
|
1984
1824
|
showDivider = true,
|
|
1985
1825
|
className = ""
|
|
1986
1826
|
}) => {
|
|
1987
|
-
return /* @__PURE__ */
|
|
1827
|
+
return /* @__PURE__ */ jsx10(
|
|
1988
1828
|
"div",
|
|
1989
1829
|
{
|
|
1990
1830
|
className: `flex items-center justify-between pb-3 first:mt-0 px-3.5 ${className} ${showDivider ? "border-b border-white/10 mb-2 mt-4" : ""}`,
|
|
@@ -1996,14 +1836,14 @@ MapMenuTitle.displayName = "MapMenuTitle";
|
|
|
1996
1836
|
var MapMenuDivider = ({
|
|
1997
1837
|
className = ""
|
|
1998
1838
|
}) => {
|
|
1999
|
-
return /* @__PURE__ */
|
|
1839
|
+
return /* @__PURE__ */ jsx10("div", { className: `h-[1px] bg-white/10 my-3 mx-3.5 ${className}` });
|
|
2000
1840
|
};
|
|
2001
1841
|
MapMenuDivider.displayName = "MapMenuDivider";
|
|
2002
1842
|
var MapMenuFooter = ({
|
|
2003
1843
|
children,
|
|
2004
1844
|
className = ""
|
|
2005
1845
|
}) => {
|
|
2006
|
-
return /* @__PURE__ */
|
|
1846
|
+
return /* @__PURE__ */ jsx10(
|
|
2007
1847
|
"div",
|
|
2008
1848
|
{
|
|
2009
1849
|
className: `mt-auto pt-4 border-t border-white/10 px-3.5 text-xs text-zinc-500 font-medium ${className}`,
|
|
@@ -2031,7 +1871,7 @@ var GlobalEvent = /* @__PURE__ */ ((GlobalEvent2) => {
|
|
|
2031
1871
|
})(GlobalEvent || {});
|
|
2032
1872
|
|
|
2033
1873
|
// src/components/Map/hooks/useUserLocation.ts
|
|
2034
|
-
import { useEffect as useEffect3, useState as
|
|
1874
|
+
import { useEffect as useEffect3, useState as useState5 } from "react";
|
|
2035
1875
|
var LERP_FACTOR = 0.12;
|
|
2036
1876
|
var EMPTY_STATE = {
|
|
2037
1877
|
accuracy: null,
|
|
@@ -2152,7 +1992,7 @@ function stopSharedStream() {
|
|
|
2152
1992
|
currentInterpolated = { coords: null, heading: null };
|
|
2153
1993
|
}
|
|
2154
1994
|
var useUserLocation = () => {
|
|
2155
|
-
const [locationState, setLocationState] =
|
|
1995
|
+
const [locationState, setLocationState] = useState5(getSnapshot);
|
|
2156
1996
|
useEffect3(() => {
|
|
2157
1997
|
refCount++;
|
|
2158
1998
|
if (refCount === 1) {
|
|
@@ -2173,7 +2013,7 @@ var useUserLocation = () => {
|
|
|
2173
2013
|
};
|
|
2174
2014
|
|
|
2175
2015
|
// src/components/Map/hooks/useLiveRouting.ts
|
|
2176
|
-
import { useCallback as
|
|
2016
|
+
import { useCallback as useCallback4, useEffect as useEffect4, useMemo as useMemo3, useRef as useRef5, useState as useState6 } from "react";
|
|
2177
2017
|
var useLiveRouting = ({
|
|
2178
2018
|
origin: manualOrigin,
|
|
2179
2019
|
destination,
|
|
@@ -2182,19 +2022,19 @@ var useLiveRouting = ({
|
|
|
2182
2022
|
enabled = true,
|
|
2183
2023
|
initialMode = "preview"
|
|
2184
2024
|
}) => {
|
|
2185
|
-
const [route, setRoute] =
|
|
2186
|
-
const [totalDistance, setTotalDistance] =
|
|
2187
|
-
const [isCalculating, setIsCalculating] =
|
|
2188
|
-
const [error, setError] =
|
|
2189
|
-
const [mode, setMode] =
|
|
2025
|
+
const [route, setRoute] = useState6(null);
|
|
2026
|
+
const [totalDistance, setTotalDistance] = useState6(null);
|
|
2027
|
+
const [isCalculating, setIsCalculating] = useState6(false);
|
|
2028
|
+
const [error, setError] = useState6(null);
|
|
2029
|
+
const [mode, setMode] = useState6(initialMode);
|
|
2190
2030
|
const userLocationState = useUserLocation();
|
|
2191
2031
|
const calculationOrigin = manualOrigin || userLocationState.coords;
|
|
2192
2032
|
const trackingLocation = userLocationState.coords || manualOrigin;
|
|
2193
|
-
const lastCalcOrigin =
|
|
2194
|
-
const lastCalcDest =
|
|
2195
|
-
const isRequestInProgress =
|
|
2196
|
-
const lastResetDestKey =
|
|
2197
|
-
const getDistance =
|
|
2033
|
+
const lastCalcOrigin = useRef5(null);
|
|
2034
|
+
const lastCalcDest = useRef5(null);
|
|
2035
|
+
const isRequestInProgress = useRef5(false);
|
|
2036
|
+
const lastResetDestKey = useRef5(null);
|
|
2037
|
+
const getDistance = useCallback4(
|
|
2198
2038
|
(p1, p2) => {
|
|
2199
2039
|
const R = 6371e3;
|
|
2200
2040
|
const \u03C61 = p1[1] * Math.PI / 180;
|
|
@@ -2207,7 +2047,7 @@ var useLiveRouting = ({
|
|
|
2207
2047
|
},
|
|
2208
2048
|
[]
|
|
2209
2049
|
);
|
|
2210
|
-
const currentDistanceMeters =
|
|
2050
|
+
const currentDistanceMeters = useMemo3(() => {
|
|
2211
2051
|
if (!trackingLocation || !route || route.geometry.coordinates.length < 2) {
|
|
2212
2052
|
if (trackingLocation && destination) {
|
|
2213
2053
|
return getDistance(trackingLocation, destination);
|
|
@@ -2234,7 +2074,7 @@ var useLiveRouting = ({
|
|
|
2234
2074
|
}
|
|
2235
2075
|
return dist;
|
|
2236
2076
|
}, [trackingLocation, route, destination, getDistance]);
|
|
2237
|
-
const calculate =
|
|
2077
|
+
const calculate = useCallback4(
|
|
2238
2078
|
async (origin, dest, isNewDest) => {
|
|
2239
2079
|
if (isRequestInProgress.current) return;
|
|
2240
2080
|
isRequestInProgress.current = true;
|
|
@@ -2325,9 +2165,9 @@ var useLiveRouting = ({
|
|
|
2325
2165
|
};
|
|
2326
2166
|
};
|
|
2327
2167
|
var useRoute = (origin, destination, profile = "driving") => {
|
|
2328
|
-
const [route, setRoute] =
|
|
2329
|
-
const [isCalculating, setIsCalculating] =
|
|
2330
|
-
const [error, setError] =
|
|
2168
|
+
const [route, setRoute] = useState6(null);
|
|
2169
|
+
const [isCalculating, setIsCalculating] = useState6(false);
|
|
2170
|
+
const [error, setError] = useState6(null);
|
|
2331
2171
|
useEffect4(() => {
|
|
2332
2172
|
if (!origin || !destination) {
|
|
2333
2173
|
setRoute(null);
|
|
@@ -2355,11 +2195,11 @@ var useRoute = (origin, destination, profile = "driving") => {
|
|
|
2355
2195
|
};
|
|
2356
2196
|
|
|
2357
2197
|
// src/components/Map/hooks/useJourney.ts
|
|
2358
|
-
import { useCallback as
|
|
2198
|
+
import { useCallback as useCallback5, useEffect as useEffect5, useRef as useRef6, useState as useState7 } from "react";
|
|
2359
2199
|
var useJourney = (options = {}) => {
|
|
2360
2200
|
const { navigation, onAbort, onModeChange } = options;
|
|
2361
|
-
const [progNav, setProgNav] =
|
|
2362
|
-
const [isAborted, setIsAborted] =
|
|
2201
|
+
const [progNav, setProgNav] = useState7(null);
|
|
2202
|
+
const [isAborted, setIsAborted] = useState7(false);
|
|
2363
2203
|
useEffect5(() => {
|
|
2364
2204
|
const unsubCreate = sdk.on("SDK_NAVIGATION_CREATE", (payload) => {
|
|
2365
2205
|
setIsAborted(false);
|
|
@@ -2388,7 +2228,7 @@ var useJourney = (options = {}) => {
|
|
|
2388
2228
|
profile: effectiveOptions?.profile || "driving",
|
|
2389
2229
|
recalculateThreshold: effectiveOptions?.recalculateThreshold || 50
|
|
2390
2230
|
});
|
|
2391
|
-
const prevDest =
|
|
2231
|
+
const prevDest = useRef6(null);
|
|
2392
2232
|
const currentDest = effectiveOptions?.destination;
|
|
2393
2233
|
useEffect5(() => {
|
|
2394
2234
|
if (currentDest && (!prevDest.current || prevDest.current[0] !== currentDest[0] || prevDest.current[1] !== currentDest[1])) {
|
|
@@ -2396,7 +2236,7 @@ var useJourney = (options = {}) => {
|
|
|
2396
2236
|
}
|
|
2397
2237
|
prevDest.current = currentDest;
|
|
2398
2238
|
}, [currentDest]);
|
|
2399
|
-
const onModeChangeRef =
|
|
2239
|
+
const onModeChangeRef = useRef6(onModeChange);
|
|
2400
2240
|
onModeChangeRef.current = onModeChange;
|
|
2401
2241
|
useEffect5(() => {
|
|
2402
2242
|
onModeChangeRef.current?.(internalNav.mode);
|
|
@@ -2420,13 +2260,13 @@ var useJourney = (options = {}) => {
|
|
|
2420
2260
|
(totalDistanceMeters - remainingMeters) / totalDistanceMeters * 100
|
|
2421
2261
|
)
|
|
2422
2262
|
) : 0;
|
|
2423
|
-
const cancel =
|
|
2263
|
+
const cancel = useCallback5(() => {
|
|
2424
2264
|
setIsAborted(true);
|
|
2425
2265
|
setProgNav(null);
|
|
2426
2266
|
sdk.navigation.abort();
|
|
2427
2267
|
if (onAbort) onAbort();
|
|
2428
2268
|
}, [onAbort]);
|
|
2429
|
-
const start =
|
|
2269
|
+
const start = useCallback5(() => {
|
|
2430
2270
|
sdk.navigation.start();
|
|
2431
2271
|
internalNav.start();
|
|
2432
2272
|
}, [internalNav.start]);
|
|
@@ -2448,9 +2288,9 @@ var useJourney = (options = {}) => {
|
|
|
2448
2288
|
};
|
|
2449
2289
|
|
|
2450
2290
|
// src/components/Map/hooks/useTrimmedRoute.ts
|
|
2451
|
-
import { useMemo as
|
|
2291
|
+
import { useMemo as useMemo4 } from "react";
|
|
2452
2292
|
var useTrimmedRoute = (route, userLocation) => {
|
|
2453
|
-
return
|
|
2293
|
+
return useMemo4(() => {
|
|
2454
2294
|
if (!route || !userLocation || route.coordinates.length < 2) return route;
|
|
2455
2295
|
const coords = route.coordinates;
|
|
2456
2296
|
let minDistance = Infinity;
|
|
@@ -2475,7 +2315,7 @@ var useTrimmedRoute = (route, userLocation) => {
|
|
|
2475
2315
|
|
|
2476
2316
|
// src/components/Map/layers/RouteLayer.tsx
|
|
2477
2317
|
import { Layer, Source } from "@vis.gl/react-maplibre";
|
|
2478
|
-
import { jsx as
|
|
2318
|
+
import { jsx as jsx11, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
2479
2319
|
var RouteLayer = ({
|
|
2480
2320
|
geometry,
|
|
2481
2321
|
color = "#3b82f6",
|
|
@@ -2488,8 +2328,8 @@ var RouteLayer = ({
|
|
|
2488
2328
|
properties: {},
|
|
2489
2329
|
type: "Feature"
|
|
2490
2330
|
};
|
|
2491
|
-
return /* @__PURE__ */
|
|
2492
|
-
/* @__PURE__ */
|
|
2331
|
+
return /* @__PURE__ */ jsxs8(Source, { data, id: "sdk-route-source", type: "geojson", children: [
|
|
2332
|
+
/* @__PURE__ */ jsx11(
|
|
2493
2333
|
Layer,
|
|
2494
2334
|
{
|
|
2495
2335
|
id: "sdk-route-layer-casing",
|
|
@@ -2502,7 +2342,7 @@ var RouteLayer = ({
|
|
|
2502
2342
|
type: "line"
|
|
2503
2343
|
}
|
|
2504
2344
|
),
|
|
2505
|
-
/* @__PURE__ */
|
|
2345
|
+
/* @__PURE__ */ jsx11(
|
|
2506
2346
|
Layer,
|
|
2507
2347
|
{
|
|
2508
2348
|
id: "sdk-route-layer",
|
|
@@ -2545,8 +2385,8 @@ var buildGeoCircle = (center, radiusMeters, points = 64) => {
|
|
|
2545
2385
|
|
|
2546
2386
|
// src/components/Map/layers/MockRadiusLayer.tsx
|
|
2547
2387
|
import { Layer as Layer2, Source as Source2 } from "@vis.gl/react-maplibre";
|
|
2548
|
-
import { useMemo as
|
|
2549
|
-
import { jsx as
|
|
2388
|
+
import { useMemo as useMemo5 } from "react";
|
|
2389
|
+
import { jsx as jsx12, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
2550
2390
|
var MockRadiusLayer = ({
|
|
2551
2391
|
center,
|
|
2552
2392
|
radiusMeters,
|
|
@@ -2559,12 +2399,12 @@ var MockRadiusLayer = ({
|
|
|
2559
2399
|
// pastel palette with no neon accents at all).
|
|
2560
2400
|
color = "#e2e8f0"
|
|
2561
2401
|
}) => {
|
|
2562
|
-
const data =
|
|
2402
|
+
const data = useMemo5(
|
|
2563
2403
|
() => buildGeoCircle(center, radiusMeters),
|
|
2564
2404
|
[center, radiusMeters]
|
|
2565
2405
|
);
|
|
2566
|
-
return /* @__PURE__ */
|
|
2567
|
-
/* @__PURE__ */
|
|
2406
|
+
return /* @__PURE__ */ jsxs9(Source2, { data, id: "sdk-mock-radius-source", type: "geojson", children: [
|
|
2407
|
+
/* @__PURE__ */ jsx12(
|
|
2568
2408
|
Layer2,
|
|
2569
2409
|
{
|
|
2570
2410
|
id: "sdk-mock-radius-fill",
|
|
@@ -2575,7 +2415,7 @@ var MockRadiusLayer = ({
|
|
|
2575
2415
|
type: "fill"
|
|
2576
2416
|
}
|
|
2577
2417
|
),
|
|
2578
|
-
/* @__PURE__ */
|
|
2418
|
+
/* @__PURE__ */ jsx12(
|
|
2579
2419
|
Layer2,
|
|
2580
2420
|
{
|
|
2581
2421
|
id: "sdk-mock-radius-outline",
|
|
@@ -2592,8 +2432,8 @@ var MockRadiusLayer = ({
|
|
|
2592
2432
|
|
|
2593
2433
|
// src/components/Map/layers/POILayers.tsx
|
|
2594
2434
|
import { Layer as Layer3, Source as Source3, useMap } from "@vis.gl/react-maplibre";
|
|
2595
|
-
import { useEffect as useEffect6, useMemo as
|
|
2596
|
-
import { jsx as
|
|
2435
|
+
import { useEffect as useEffect6, useMemo as useMemo6, useState as useState8 } from "react";
|
|
2436
|
+
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
2597
2437
|
function createEmojiIcon(emoji, size = 64) {
|
|
2598
2438
|
const canvas = document.createElement("canvas");
|
|
2599
2439
|
canvas.width = size;
|
|
@@ -2606,9 +2446,9 @@ function createEmojiIcon(emoji, size = 64) {
|
|
|
2606
2446
|
return ctx.getImageData(0, 0, size, size);
|
|
2607
2447
|
}
|
|
2608
2448
|
var POILayers = ({ pois }) => {
|
|
2609
|
-
const [loadedImages, setLoadedImages] =
|
|
2449
|
+
const [loadedImages, setLoadedImages] = useState8(0);
|
|
2610
2450
|
const { current: map } = useMap();
|
|
2611
|
-
const glPois =
|
|
2451
|
+
const glPois = useMemo6(
|
|
2612
2452
|
() => pois.filter((p) => !p.displayMode || p.displayMode === "gl"),
|
|
2613
2453
|
[pois]
|
|
2614
2454
|
);
|
|
@@ -2652,7 +2492,7 @@ var POILayers = ({ pois }) => {
|
|
|
2652
2492
|
setLoadedImages((prev) => prev + updates);
|
|
2653
2493
|
}
|
|
2654
2494
|
}, [map, glPois]);
|
|
2655
|
-
const geojson =
|
|
2495
|
+
const geojson = useMemo6(
|
|
2656
2496
|
() => ({
|
|
2657
2497
|
features: glPois.map((poi) => ({
|
|
2658
2498
|
geometry: {
|
|
@@ -2670,7 +2510,7 @@ var POILayers = ({ pois }) => {
|
|
|
2670
2510
|
}),
|
|
2671
2511
|
[glPois]
|
|
2672
2512
|
);
|
|
2673
|
-
return /* @__PURE__ */
|
|
2513
|
+
return /* @__PURE__ */ jsx13(Source3, { data: geojson, id: "sdk-pois", type: "geojson", children: /* @__PURE__ */ jsx13(
|
|
2674
2514
|
Layer3,
|
|
2675
2515
|
{
|
|
2676
2516
|
id: "sdk-poi-layer",
|
|
@@ -2707,11 +2547,11 @@ var POILayers = ({ pois }) => {
|
|
|
2707
2547
|
|
|
2708
2548
|
// src/components/Map/layers/POIMarkers.tsx
|
|
2709
2549
|
import { Marker } from "@vis.gl/react-maplibre";
|
|
2710
|
-
import { Fragment as
|
|
2550
|
+
import { Fragment as Fragment4, jsx as jsx14, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
2711
2551
|
var POIMarkers = ({ pois, onClick }) => {
|
|
2712
2552
|
const markerPois = pois.filter((p) => p.displayMode === "marker");
|
|
2713
2553
|
if (markerPois.length === 0) return null;
|
|
2714
|
-
return /* @__PURE__ */
|
|
2554
|
+
return /* @__PURE__ */ jsx14(Fragment4, { children: markerPois.map((poi) => /* @__PURE__ */ jsx14(
|
|
2715
2555
|
Marker,
|
|
2716
2556
|
{
|
|
2717
2557
|
anchor: "bottom",
|
|
@@ -2721,7 +2561,7 @@ var POIMarkers = ({ pois, onClick }) => {
|
|
|
2721
2561
|
e.originalEvent.stopPropagation();
|
|
2722
2562
|
if (onClick) onClick(poi);
|
|
2723
2563
|
},
|
|
2724
|
-
children: poi.markerComponent ? poi.markerComponent : /* @__PURE__ */
|
|
2564
|
+
children: poi.markerComponent ? poi.markerComponent : /* @__PURE__ */ jsxs10(
|
|
2725
2565
|
"div",
|
|
2726
2566
|
{
|
|
2727
2567
|
style: {
|
|
@@ -2730,7 +2570,7 @@ var POIMarkers = ({ pois, onClick }) => {
|
|
|
2730
2570
|
transform: "transition-transform duration-200 hover:scale-110"
|
|
2731
2571
|
},
|
|
2732
2572
|
children: [
|
|
2733
|
-
/* @__PURE__ */
|
|
2573
|
+
/* @__PURE__ */ jsx14(
|
|
2734
2574
|
"div",
|
|
2735
2575
|
{
|
|
2736
2576
|
style: {
|
|
@@ -2743,7 +2583,7 @@ var POIMarkers = ({ pois, onClick }) => {
|
|
|
2743
2583
|
justifyContent: "center",
|
|
2744
2584
|
width: "32px"
|
|
2745
2585
|
},
|
|
2746
|
-
children: poi.emoji ? /* @__PURE__ */
|
|
2586
|
+
children: poi.emoji ? /* @__PURE__ */ jsx14("span", { style: { fontSize: "16px" }, children: poi.emoji }) : /* @__PURE__ */ jsx14(
|
|
2747
2587
|
"div",
|
|
2748
2588
|
{
|
|
2749
2589
|
style: {
|
|
@@ -2756,7 +2596,7 @@ var POIMarkers = ({ pois, onClick }) => {
|
|
|
2756
2596
|
)
|
|
2757
2597
|
}
|
|
2758
2598
|
),
|
|
2759
|
-
/* @__PURE__ */
|
|
2599
|
+
/* @__PURE__ */ jsx14(
|
|
2760
2600
|
"div",
|
|
2761
2601
|
{
|
|
2762
2602
|
style: {
|
|
@@ -2779,19 +2619,19 @@ var POIMarkers = ({ pois, onClick }) => {
|
|
|
2779
2619
|
|
|
2780
2620
|
// src/components/Map/layers/UserLocationLayer.tsx
|
|
2781
2621
|
import { Marker as Marker2 } from "@vis.gl/react-maplibre";
|
|
2782
|
-
import { jsx as
|
|
2622
|
+
import { jsx as jsx15, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
2783
2623
|
var UserLocationLayer = ({
|
|
2784
2624
|
forcedLocation,
|
|
2785
2625
|
heading
|
|
2786
2626
|
}) => {
|
|
2787
2627
|
if (!forcedLocation) return null;
|
|
2788
|
-
return /* @__PURE__ */
|
|
2628
|
+
return /* @__PURE__ */ jsx15(
|
|
2789
2629
|
Marker2,
|
|
2790
2630
|
{
|
|
2791
2631
|
anchor: "center",
|
|
2792
2632
|
latitude: forcedLocation[1],
|
|
2793
2633
|
longitude: forcedLocation[0],
|
|
2794
|
-
children: /* @__PURE__ */
|
|
2634
|
+
children: /* @__PURE__ */ jsxs11(
|
|
2795
2635
|
"div",
|
|
2796
2636
|
{
|
|
2797
2637
|
style: {
|
|
@@ -2801,7 +2641,7 @@ var UserLocationLayer = ({
|
|
|
2801
2641
|
position: "relative"
|
|
2802
2642
|
},
|
|
2803
2643
|
children: [
|
|
2804
|
-
/* @__PURE__ */
|
|
2644
|
+
/* @__PURE__ */ jsx15(
|
|
2805
2645
|
"div",
|
|
2806
2646
|
{
|
|
2807
2647
|
style: {
|
|
@@ -2814,7 +2654,7 @@ var UserLocationLayer = ({
|
|
|
2814
2654
|
}
|
|
2815
2655
|
}
|
|
2816
2656
|
),
|
|
2817
|
-
heading !== void 0 && heading !== null && /* @__PURE__ */
|
|
2657
|
+
heading !== void 0 && heading !== null && /* @__PURE__ */ jsx15(
|
|
2818
2658
|
"div",
|
|
2819
2659
|
{
|
|
2820
2660
|
style: {
|
|
@@ -2824,13 +2664,13 @@ var UserLocationLayer = ({
|
|
|
2824
2664
|
width: "60px",
|
|
2825
2665
|
zIndex: 0
|
|
2826
2666
|
},
|
|
2827
|
-
children: /* @__PURE__ */
|
|
2667
|
+
children: /* @__PURE__ */ jsxs11(
|
|
2828
2668
|
"svg",
|
|
2829
2669
|
{
|
|
2830
2670
|
style: { height: "100%", width: "100%" },
|
|
2831
2671
|
viewBox: "0 0 100 100",
|
|
2832
2672
|
children: [
|
|
2833
|
-
/* @__PURE__ */
|
|
2673
|
+
/* @__PURE__ */ jsx15("defs", { children: /* @__PURE__ */ jsxs11(
|
|
2834
2674
|
"radialGradient",
|
|
2835
2675
|
{
|
|
2836
2676
|
cx: "50%",
|
|
@@ -2840,7 +2680,7 @@ var UserLocationLayer = ({
|
|
|
2840
2680
|
id: "grad1",
|
|
2841
2681
|
r: "50%",
|
|
2842
2682
|
children: [
|
|
2843
|
-
/* @__PURE__ */
|
|
2683
|
+
/* @__PURE__ */ jsx15(
|
|
2844
2684
|
"stop",
|
|
2845
2685
|
{
|
|
2846
2686
|
offset: "0%",
|
|
@@ -2850,7 +2690,7 @@ var UserLocationLayer = ({
|
|
|
2850
2690
|
}
|
|
2851
2691
|
}
|
|
2852
2692
|
),
|
|
2853
|
-
/* @__PURE__ */
|
|
2693
|
+
/* @__PURE__ */ jsx15(
|
|
2854
2694
|
"stop",
|
|
2855
2695
|
{
|
|
2856
2696
|
offset: "100%",
|
|
@@ -2863,7 +2703,7 @@ var UserLocationLayer = ({
|
|
|
2863
2703
|
]
|
|
2864
2704
|
}
|
|
2865
2705
|
) }),
|
|
2866
|
-
/* @__PURE__ */
|
|
2706
|
+
/* @__PURE__ */ jsx15(
|
|
2867
2707
|
"path",
|
|
2868
2708
|
{
|
|
2869
2709
|
d: "M 50 50 L 35 0 A 50 50 0 0 1 65 0 Z",
|
|
@@ -2875,7 +2715,7 @@ var UserLocationLayer = ({
|
|
|
2875
2715
|
)
|
|
2876
2716
|
}
|
|
2877
2717
|
),
|
|
2878
|
-
/* @__PURE__ */
|
|
2718
|
+
/* @__PURE__ */ jsx15(
|
|
2879
2719
|
"div",
|
|
2880
2720
|
{
|
|
2881
2721
|
style: {
|
|
@@ -2889,7 +2729,7 @@ var UserLocationLayer = ({
|
|
|
2889
2729
|
width: "20px",
|
|
2890
2730
|
zIndex: 1
|
|
2891
2731
|
},
|
|
2892
|
-
children: /* @__PURE__ */
|
|
2732
|
+
children: /* @__PURE__ */ jsx15(
|
|
2893
2733
|
"div",
|
|
2894
2734
|
{
|
|
2895
2735
|
style: {
|
|
@@ -2903,7 +2743,7 @@ var UserLocationLayer = ({
|
|
|
2903
2743
|
)
|
|
2904
2744
|
}
|
|
2905
2745
|
),
|
|
2906
|
-
/* @__PURE__ */
|
|
2746
|
+
/* @__PURE__ */ jsx15("style", { children: `@keyframes pulse { 0% { transform: scale(0.95); opacity: 0.7; } 70% { transform: scale(1.5); opacity: 0; } 100% { transform: scale(0.95); opacity: 0; } }` })
|
|
2907
2747
|
]
|
|
2908
2748
|
}
|
|
2909
2749
|
)
|
|
@@ -2914,15 +2754,15 @@ var UserLocationLayer = ({
|
|
|
2914
2754
|
// src/components/Map/Map.tsx
|
|
2915
2755
|
import { Map as MapLibre, MapProvider } from "@vis.gl/react-maplibre";
|
|
2916
2756
|
import React4, {
|
|
2917
|
-
useCallback as
|
|
2757
|
+
useCallback as useCallback6,
|
|
2918
2758
|
useContext as useContext5,
|
|
2919
2759
|
useEffect as useEffect7,
|
|
2920
|
-
useMemo as
|
|
2921
|
-
useRef as
|
|
2922
|
-
useState as
|
|
2760
|
+
useMemo as useMemo7,
|
|
2761
|
+
useRef as useRef7,
|
|
2762
|
+
useState as useState9
|
|
2923
2763
|
} from "react";
|
|
2924
2764
|
import "maplibre-gl/dist/maplibre-gl.css";
|
|
2925
|
-
import { Fragment as
|
|
2765
|
+
import { Fragment as Fragment5, jsx as jsx16, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
2926
2766
|
var MapInternal = ({
|
|
2927
2767
|
initialViewState = {
|
|
2928
2768
|
latitude: 45.90583599233422,
|
|
@@ -2962,7 +2802,7 @@ var MapInternal = ({
|
|
|
2962
2802
|
}) => {
|
|
2963
2803
|
const mapControls = useContext5(MapControlsContext);
|
|
2964
2804
|
const mockLocation = useContext5(MockLocationContext);
|
|
2965
|
-
const mapRef =
|
|
2805
|
+
const mapRef = useRef7(null);
|
|
2966
2806
|
const userLocationState = useUserLocation();
|
|
2967
2807
|
const journey = useJourney({
|
|
2968
2808
|
navigation,
|
|
@@ -2980,24 +2820,24 @@ var MapInternal = ({
|
|
|
2980
2820
|
const showNavigationUI = hasIntegratedNav ? externalShowNavigationUI !== false && navigation?.showUI !== false : externalShowNavigationUI;
|
|
2981
2821
|
const mode = navigationData?.mode || "preview";
|
|
2982
2822
|
const resolvedInitialFollow = mapControls ? mapControls.isFollowing : initialFollowUser;
|
|
2983
|
-
const isFollowingRef =
|
|
2984
|
-
const isFlyingRef =
|
|
2985
|
-
const flyingGenerationRef =
|
|
2986
|
-
const lockFlying =
|
|
2823
|
+
const isFollowingRef = useRef7(resolvedInitialFollow);
|
|
2824
|
+
const isFlyingRef = useRef7(false);
|
|
2825
|
+
const flyingGenerationRef = useRef7(0);
|
|
2826
|
+
const lockFlying = useCallback6(() => {
|
|
2987
2827
|
isFlyingRef.current = true;
|
|
2988
2828
|
return ++flyingGenerationRef.current;
|
|
2989
2829
|
}, []);
|
|
2990
|
-
const releaseFlyingIfCurrent =
|
|
2830
|
+
const releaseFlyingIfCurrent = useCallback6((flightId) => {
|
|
2991
2831
|
if (flyingGenerationRef.current === flightId) {
|
|
2992
2832
|
isFlyingRef.current = false;
|
|
2993
2833
|
}
|
|
2994
2834
|
}, []);
|
|
2995
|
-
const [localIsFollowingUI, setLocalIsFollowingUI] =
|
|
2835
|
+
const [localIsFollowingUI, setLocalIsFollowingUI] = useState9(
|
|
2996
2836
|
resolvedInitialFollow
|
|
2997
2837
|
);
|
|
2998
2838
|
const isFollowingUI = mapControls ? mapControls.isFollowing : localIsFollowingUI;
|
|
2999
2839
|
const setIsFollowingCtx = mapControls?.setIsFollowing;
|
|
3000
|
-
const setFollowMode =
|
|
2840
|
+
const setFollowMode = useCallback6(
|
|
3001
2841
|
(follow) => {
|
|
3002
2842
|
isFollowingRef.current = follow;
|
|
3003
2843
|
setLocalIsFollowingUI(follow);
|
|
@@ -3016,7 +2856,7 @@ var MapInternal = ({
|
|
|
3016
2856
|
if (pois.length > 0 && !mergedInteractiveLayerIds.includes("sdk-poi-layer")) {
|
|
3017
2857
|
mergedInteractiveLayerIds.push("sdk-poi-layer");
|
|
3018
2858
|
}
|
|
3019
|
-
const prevInitialFollow =
|
|
2859
|
+
const prevInitialFollow = useRef7(initialFollowUser);
|
|
3020
2860
|
useEffect7(() => {
|
|
3021
2861
|
if (initialFollowUser !== prevInitialFollow.current) {
|
|
3022
2862
|
setFollowMode(initialFollowUser);
|
|
@@ -3041,8 +2881,8 @@ var MapInternal = ({
|
|
|
3041
2881
|
lockFlying,
|
|
3042
2882
|
releaseFlyingIfCurrent
|
|
3043
2883
|
]);
|
|
3044
|
-
const lastAutoLockedRouteRef =
|
|
3045
|
-
const lastModeRef =
|
|
2884
|
+
const lastAutoLockedRouteRef = useRef7(null);
|
|
2885
|
+
const lastModeRef = useRef7(null);
|
|
3046
2886
|
useEffect7(() => {
|
|
3047
2887
|
if (!route || !mapRef.current) {
|
|
3048
2888
|
if (!route) lastAutoLockedRouteRef.current = null;
|
|
@@ -3155,7 +2995,7 @@ var MapInternal = ({
|
|
|
3155
2995
|
}
|
|
3156
2996
|
}, [propDrawerState, setDrawerStateCtx]);
|
|
3157
2997
|
const resolvedMenuItems = menuItems ?? [];
|
|
3158
|
-
const { mapLibreChildren, menuContentFromChildren } =
|
|
2998
|
+
const { mapLibreChildren, menuContentFromChildren } = useMemo7(() => {
|
|
3159
2999
|
const mapLibreChildren2 = [];
|
|
3160
3000
|
const extractedMenuItems = [];
|
|
3161
3001
|
React4.Children.forEach(children, (child) => {
|
|
@@ -3187,7 +3027,7 @@ var MapInternal = ({
|
|
|
3187
3027
|
mapLibreChildren2.push(child);
|
|
3188
3028
|
}
|
|
3189
3029
|
});
|
|
3190
|
-
const menuContentFromChildren2 = extractedMenuItems.length > 0 ? /* @__PURE__ */
|
|
3030
|
+
const menuContentFromChildren2 = extractedMenuItems.length > 0 ? /* @__PURE__ */ jsx16(MapMenu, { children: extractedMenuItems }) : null;
|
|
3191
3031
|
return { mapLibreChildren: mapLibreChildren2, menuContentFromChildren: menuContentFromChildren2 };
|
|
3192
3032
|
}, [children]);
|
|
3193
3033
|
const handleMapClick = (e) => {
|
|
@@ -3215,7 +3055,7 @@ var MapInternal = ({
|
|
|
3215
3055
|
}
|
|
3216
3056
|
if (onClick) onClick(e);
|
|
3217
3057
|
};
|
|
3218
|
-
const handleCenterOnUser =
|
|
3058
|
+
const handleCenterOnUser = useCallback6(
|
|
3219
3059
|
(payload) => {
|
|
3220
3060
|
if (userLocationState.coords && mapRef.current) {
|
|
3221
3061
|
setFollowMode(true);
|
|
@@ -3240,7 +3080,7 @@ var MapInternal = ({
|
|
|
3240
3080
|
releaseFlyingIfCurrent
|
|
3241
3081
|
]
|
|
3242
3082
|
);
|
|
3243
|
-
const handleFlyTo =
|
|
3083
|
+
const handleFlyTo = useCallback6(
|
|
3244
3084
|
(coords, params) => {
|
|
3245
3085
|
const map = mapRef.current;
|
|
3246
3086
|
if (!map) return;
|
|
@@ -3260,7 +3100,7 @@ var MapInternal = ({
|
|
|
3260
3100
|
},
|
|
3261
3101
|
[setFollowMode, lockFlying, releaseFlyingIfCurrent]
|
|
3262
3102
|
);
|
|
3263
|
-
const handleResetBearing =
|
|
3103
|
+
const handleResetBearing = useCallback6((params) => {
|
|
3264
3104
|
if (mapRef.current) {
|
|
3265
3105
|
mapRef.current.easeTo({
|
|
3266
3106
|
bearing: 0,
|
|
@@ -3277,7 +3117,7 @@ var MapInternal = ({
|
|
|
3277
3117
|
mapControls._registerFlyToCallback(handleFlyTo);
|
|
3278
3118
|
}
|
|
3279
3119
|
}, [mapControls, handleCenterOnUser, handleResetBearing, handleFlyTo]);
|
|
3280
|
-
const handleMove =
|
|
3120
|
+
const handleMove = useCallback6(() => {
|
|
3281
3121
|
if (mapRef.current && mapControls) {
|
|
3282
3122
|
mapControls.setBearing(mapRef.current.getBearing());
|
|
3283
3123
|
mapControls.setPitch(mapRef.current.getPitch());
|
|
@@ -3292,13 +3132,13 @@ var MapInternal = ({
|
|
|
3292
3132
|
}
|
|
3293
3133
|
}
|
|
3294
3134
|
};
|
|
3295
|
-
return /* @__PURE__ */
|
|
3135
|
+
return /* @__PURE__ */ jsxs12(
|
|
3296
3136
|
"div",
|
|
3297
3137
|
{
|
|
3298
3138
|
className: `w-full h-full overflow-hidden relative ${mockLocation?.isPlacingLocation ? "cursor-crosshair" : ""} ${className}`,
|
|
3299
3139
|
style,
|
|
3300
3140
|
children: [
|
|
3301
|
-
/* @__PURE__ */
|
|
3141
|
+
/* @__PURE__ */ jsxs12(
|
|
3302
3142
|
MapLibre,
|
|
3303
3143
|
{
|
|
3304
3144
|
attributionControl: false,
|
|
@@ -3328,30 +3168,30 @@ var MapInternal = ({
|
|
|
3328
3168
|
showUserLocation && userLocationState.coords && (renderUserLocation ? renderUserLocation({
|
|
3329
3169
|
coords: userLocationState.coords,
|
|
3330
3170
|
heading: userLocationState.heading
|
|
3331
|
-
}) : /* @__PURE__ */
|
|
3171
|
+
}) : /* @__PURE__ */ jsx16(
|
|
3332
3172
|
UserLocationLayer,
|
|
3333
3173
|
{
|
|
3334
3174
|
forcedLocation: userLocationState.coords,
|
|
3335
3175
|
heading: userLocationState.heading
|
|
3336
3176
|
}
|
|
3337
3177
|
)),
|
|
3338
|
-
mockLocation && mockLocation.radiusMeters > 0 && userLocationState.coords && /* @__PURE__ */
|
|
3178
|
+
mockLocation && mockLocation.radiusMeters > 0 && userLocationState.coords && /* @__PURE__ */ jsx16(
|
|
3339
3179
|
MockRadiusLayer,
|
|
3340
3180
|
{
|
|
3341
3181
|
center: userLocationState.coords,
|
|
3342
3182
|
radiusMeters: mockLocation.radiusMeters
|
|
3343
3183
|
}
|
|
3344
3184
|
),
|
|
3345
|
-
displayRoute && /* @__PURE__ */
|
|
3346
|
-
pois.length > 0 && /* @__PURE__ */
|
|
3347
|
-
/* @__PURE__ */
|
|
3348
|
-
/* @__PURE__ */
|
|
3185
|
+
displayRoute && /* @__PURE__ */ jsx16(RouteLayer, { geometry: displayRoute }),
|
|
3186
|
+
pois.length > 0 && /* @__PURE__ */ jsxs12(Fragment5, { children: [
|
|
3187
|
+
/* @__PURE__ */ jsx16(POILayers, { pois }),
|
|
3188
|
+
/* @__PURE__ */ jsx16(POIMarkers, { onClick: onPoiClick, pois })
|
|
3349
3189
|
] }),
|
|
3350
3190
|
mapLibreChildren
|
|
3351
3191
|
]
|
|
3352
3192
|
}
|
|
3353
3193
|
),
|
|
3354
|
-
showControls && mapControls && !mapControls.hasControls && /* @__PURE__ */
|
|
3194
|
+
showControls && mapControls && !mapControls.hasControls && /* @__PURE__ */ jsx16(
|
|
3355
3195
|
MapControls,
|
|
3356
3196
|
{
|
|
3357
3197
|
drawerContentRef,
|
|
@@ -3373,12 +3213,12 @@ var SDKMapProviderWrapper = ({
|
|
|
3373
3213
|
}) => {
|
|
3374
3214
|
const context = useContext5(MapControlsContext);
|
|
3375
3215
|
if (context) {
|
|
3376
|
-
return /* @__PURE__ */
|
|
3216
|
+
return /* @__PURE__ */ jsx16(Fragment5, { children });
|
|
3377
3217
|
}
|
|
3378
|
-
return /* @__PURE__ */
|
|
3218
|
+
return /* @__PURE__ */ jsx16(SDKMapProvider, { children });
|
|
3379
3219
|
};
|
|
3380
3220
|
var Map2 = (props) => {
|
|
3381
|
-
return /* @__PURE__ */
|
|
3221
|
+
return /* @__PURE__ */ jsx16(SDKMapProviderWrapper, { children: /* @__PURE__ */ jsx16(MapProvider, { children: /* @__PURE__ */ jsx16(MapInternal, { ...props }) }) });
|
|
3382
3222
|
};
|
|
3383
3223
|
|
|
3384
3224
|
// src/components/MapWrapper.tsx
|
|
@@ -3567,7 +3407,7 @@ var loadImage2 = (src) => new Promise((resolve, reject) => {
|
|
|
3567
3407
|
});
|
|
3568
3408
|
|
|
3569
3409
|
// package.json
|
|
3570
|
-
var version = "0.
|
|
3410
|
+
var version = "0.7.3";
|
|
3571
3411
|
|
|
3572
3412
|
// src/sdk.ts
|
|
3573
3413
|
function deepFreeze(obj) {
|
|
@@ -3802,7 +3642,7 @@ var MiniAppSDK = class {
|
|
|
3802
3642
|
}
|
|
3803
3643
|
});
|
|
3804
3644
|
/**
|
|
3805
|
-
* Fidelity &
|
|
3645
|
+
* Fidelity & Points program integration.
|
|
3806
3646
|
*/
|
|
3807
3647
|
fidelity = Object.freeze({
|
|
3808
3648
|
/** Returns current fidelity balance. */
|
|
@@ -3913,6 +3753,8 @@ var MiniAppSDK = class {
|
|
|
3913
3753
|
);
|
|
3914
3754
|
this.initialize = this.initialize.bind(this);
|
|
3915
3755
|
this.getEnv = this.getEnv.bind(this);
|
|
3756
|
+
this.achievement = this.achievement.bind(this);
|
|
3757
|
+
this.achievements = this.achievements.bind(this);
|
|
3916
3758
|
this.on = this.on.bind(this);
|
|
3917
3759
|
this.off = this.off.bind(this);
|
|
3918
3760
|
}
|
|
@@ -3953,6 +3795,23 @@ var MiniAppSDK = class {
|
|
|
3953
3795
|
getEnv() {
|
|
3954
3796
|
return lastKnownEnv;
|
|
3955
3797
|
}
|
|
3798
|
+
/**
|
|
3799
|
+
* Fetches a single Achievement's current progress by slug — read-only, for
|
|
3800
|
+
* rendering things like a progress bar. Progress is reported server-side
|
|
3801
|
+
* by the mini-app's own backend calling the Hub's M2M endpoint directly;
|
|
3802
|
+
* there is no corresponding "report progress" method on this SDK.
|
|
3803
|
+
* @param slug Unique slug identifying the Achievement.
|
|
3804
|
+
*/
|
|
3805
|
+
achievement(slug) {
|
|
3806
|
+
return this.bridge.send("GET_ACHIEVEMENT", { slug });
|
|
3807
|
+
}
|
|
3808
|
+
/**
|
|
3809
|
+
* Fetches every Achievement (with current progress) visible to this
|
|
3810
|
+
* mini-app — read-only, same boundary as {@link MiniAppSDK.achievement}.
|
|
3811
|
+
*/
|
|
3812
|
+
achievements() {
|
|
3813
|
+
return this.bridge.send("GET_ACHIEVEMENTS");
|
|
3814
|
+
}
|
|
3956
3815
|
/**
|
|
3957
3816
|
* Registers a callback for a specific event from the native shell.
|
|
3958
3817
|
* @param event The name of the event to listen for.
|
|
@@ -3974,8 +3833,43 @@ var MiniAppSDK = class {
|
|
|
3974
3833
|
var sdk = deepFreeze(new MiniAppSDK());
|
|
3975
3834
|
|
|
3976
3835
|
// src/components/BridgeMocker.tsx
|
|
3977
|
-
import { useCallback as
|
|
3978
|
-
import { jsx as
|
|
3836
|
+
import { useCallback as useCallback7, useEffect as useEffect8, useMemo as useMemo8, useRef as useRef8, useState as useState10 } from "react";
|
|
3837
|
+
import { jsx as jsx17, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
3838
|
+
var MOCK_ACHIEVEMENTS2 = [
|
|
3839
|
+
{
|
|
3840
|
+
completed: true,
|
|
3841
|
+
description: "Complete your first navigation journey.",
|
|
3842
|
+
playerActionCount: 1,
|
|
3843
|
+
priority: 1,
|
|
3844
|
+
slug: "first-journey",
|
|
3845
|
+
title: "First Steps",
|
|
3846
|
+
totalActionCount: 1,
|
|
3847
|
+
upReward: 20,
|
|
3848
|
+
xpReward: 40
|
|
3849
|
+
},
|
|
3850
|
+
{
|
|
3851
|
+
completed: false,
|
|
3852
|
+
description: "Discover 5 points of interest around Annecy.",
|
|
3853
|
+
playerActionCount: 3,
|
|
3854
|
+
priority: 2,
|
|
3855
|
+
slug: "explore-5-pois",
|
|
3856
|
+
title: "Explorer",
|
|
3857
|
+
totalActionCount: 5,
|
|
3858
|
+
upReward: 50,
|
|
3859
|
+
xpReward: 100
|
|
3860
|
+
},
|
|
3861
|
+
{
|
|
3862
|
+
completed: false,
|
|
3863
|
+
description: "Scan 10 QR codes at partner venues.",
|
|
3864
|
+
playerActionCount: 4,
|
|
3865
|
+
priority: 3,
|
|
3866
|
+
slug: "scan-10-qrcodes",
|
|
3867
|
+
title: "Code Breaker",
|
|
3868
|
+
totalActionCount: 10,
|
|
3869
|
+
upReward: 80,
|
|
3870
|
+
xpReward: 150
|
|
3871
|
+
}
|
|
3872
|
+
];
|
|
3979
3873
|
var AVATAR_MOUTH_VARIANTS = [
|
|
3980
3874
|
"variant03",
|
|
3981
3875
|
"variant07",
|
|
@@ -4062,19 +3956,19 @@ var BridgeMocker = ({
|
|
|
4062
3956
|
mockJWTToken,
|
|
4063
3957
|
children
|
|
4064
3958
|
}) => {
|
|
4065
|
-
const [autoMove, setAutoMove] =
|
|
4066
|
-
const [location, setLocation] =
|
|
4067
|
-
const [heading, setHeading] =
|
|
4068
|
-
const [speedMultiplier, setSpeedMultiplier] =
|
|
4069
|
-
const [isReady, setIsReady] =
|
|
4070
|
-
const [isMinimized, setIsMinimized] =
|
|
4071
|
-
const [radiusMeters, setRadiusMeters] =
|
|
4072
|
-
const [radiusUnit, setRadiusUnit] =
|
|
4073
|
-
const [isPlacingLocation, setIsPlacingLocation] =
|
|
4074
|
-
const streamIntervalRef =
|
|
4075
|
-
const pathIndexRef =
|
|
4076
|
-
const activeConfigRef =
|
|
4077
|
-
const stateRef =
|
|
3959
|
+
const [autoMove, setAutoMove] = useState10(isMoving);
|
|
3960
|
+
const [location, setLocation] = useState10(initialLocation);
|
|
3961
|
+
const [heading, setHeading] = useState10(0);
|
|
3962
|
+
const [speedMultiplier, setSpeedMultiplier] = useState10(simulationSpeed);
|
|
3963
|
+
const [isReady, setIsReady] = useState10(false);
|
|
3964
|
+
const [isMinimized, setIsMinimized] = useState10(true);
|
|
3965
|
+
const [radiusMeters, setRadiusMeters] = useState10(0);
|
|
3966
|
+
const [radiusUnit, setRadiusUnit] = useState10("m");
|
|
3967
|
+
const [isPlacingLocation, setIsPlacingLocation] = useState10(false);
|
|
3968
|
+
const streamIntervalRef = useRef8(null);
|
|
3969
|
+
const pathIndexRef = useRef8(0);
|
|
3970
|
+
const activeConfigRef = useRef8(null);
|
|
3971
|
+
const stateRef = useRef8({
|
|
4078
3972
|
autoMove,
|
|
4079
3973
|
heading,
|
|
4080
3974
|
location,
|
|
@@ -4086,7 +3980,7 @@ var BridgeMocker = ({
|
|
|
4086
3980
|
simulationPath,
|
|
4087
3981
|
speedMultiplier
|
|
4088
3982
|
});
|
|
4089
|
-
const pushLocationUpdateFor =
|
|
3983
|
+
const pushLocationUpdateFor = useCallback7(
|
|
4090
3984
|
(coords, headingDeg) => {
|
|
4091
3985
|
const currentState = stateRef.current;
|
|
4092
3986
|
const payload = {
|
|
@@ -4118,11 +4012,11 @@ var BridgeMocker = ({
|
|
|
4118
4012
|
},
|
|
4119
4013
|
[]
|
|
4120
4014
|
);
|
|
4121
|
-
const pushLocationUpdate =
|
|
4015
|
+
const pushLocationUpdate = useCallback7(() => {
|
|
4122
4016
|
const currentState = stateRef.current;
|
|
4123
4017
|
pushLocationUpdateFor(currentState.location, currentState.heading);
|
|
4124
4018
|
}, [pushLocationUpdateFor]);
|
|
4125
|
-
const placeLocation =
|
|
4019
|
+
const placeLocation = useCallback7(
|
|
4126
4020
|
(coords) => {
|
|
4127
4021
|
setLocation(coords);
|
|
4128
4022
|
setIsPlacingLocation(false);
|
|
@@ -4332,6 +4226,25 @@ var BridgeMocker = ({
|
|
|
4332
4226
|
if (type === "GET_FIDELITY_BALANCE") {
|
|
4333
4227
|
return Promise.resolve({ balance: 1337, currency: "FPoints" });
|
|
4334
4228
|
}
|
|
4229
|
+
if (type === "GET_ACHIEVEMENTS") {
|
|
4230
|
+
return Promise.resolve(MOCK_ACHIEVEMENTS2);
|
|
4231
|
+
}
|
|
4232
|
+
if (type === "GET_ACHIEVEMENT") {
|
|
4233
|
+
const slug = payload?.slug;
|
|
4234
|
+
return Promise.resolve(
|
|
4235
|
+
MOCK_ACHIEVEMENTS2.find((a) => a.slug === slug) ?? {
|
|
4236
|
+
completed: false,
|
|
4237
|
+
description: "Mocked achievement (no native shell attached).",
|
|
4238
|
+
playerActionCount: 0,
|
|
4239
|
+
priority: 1,
|
|
4240
|
+
slug: slug || "unknown-achievement",
|
|
4241
|
+
title: slug || "Unknown Achievement",
|
|
4242
|
+
totalActionCount: 1,
|
|
4243
|
+
upReward: 0,
|
|
4244
|
+
xpReward: 0
|
|
4245
|
+
}
|
|
4246
|
+
);
|
|
4247
|
+
}
|
|
4335
4248
|
if (type === "PAYMENT_REQUEST") {
|
|
4336
4249
|
return Promise.resolve({
|
|
4337
4250
|
success: true,
|
|
@@ -4350,7 +4263,7 @@ var BridgeMocker = ({
|
|
|
4350
4263
|
};
|
|
4351
4264
|
}, [appId]);
|
|
4352
4265
|
const radiusInMeters = radiusUnit === "km" ? radiusMeters * 1e3 : radiusMeters;
|
|
4353
|
-
const mockLocationContextValue =
|
|
4266
|
+
const mockLocationContextValue = useMemo8(
|
|
4354
4267
|
() => ({
|
|
4355
4268
|
isPlacingLocation,
|
|
4356
4269
|
placeLocation,
|
|
@@ -4359,9 +4272,9 @@ var BridgeMocker = ({
|
|
|
4359
4272
|
[isPlacingLocation, placeLocation, radiusInMeters]
|
|
4360
4273
|
);
|
|
4361
4274
|
if (!isReady) return null;
|
|
4362
|
-
return /* @__PURE__ */
|
|
4363
|
-
/* @__PURE__ */
|
|
4364
|
-
isMinimized ? /* @__PURE__ */
|
|
4275
|
+
return /* @__PURE__ */ jsxs13("div", { className: "relative w-full h-full", children: [
|
|
4276
|
+
/* @__PURE__ */ jsx17("div", { className: "w-full h-full", children: /* @__PURE__ */ jsx17(MockLocationContext.Provider, { value: mockLocationContextValue, children }) }),
|
|
4277
|
+
isMinimized ? /* @__PURE__ */ jsx17(
|
|
4365
4278
|
Button,
|
|
4366
4279
|
{
|
|
4367
4280
|
className: "fixed bottom-4 right-4 w-8 h-8 rounded-full bg-slate-900/60 backdrop-blur-sm border border-slate-700/50 flex items-center justify-center text-slate-400 hover:text-blue-400 hover:bg-slate-900/80 z-[9999] transition-all shadow-lg group p-0!",
|
|
@@ -4369,7 +4282,7 @@ var BridgeMocker = ({
|
|
|
4369
4282
|
title: "Open Simulation Controls",
|
|
4370
4283
|
type: "button",
|
|
4371
4284
|
variant: "ghost",
|
|
4372
|
-
children: /* @__PURE__ */
|
|
4285
|
+
children: /* @__PURE__ */ jsxs13(
|
|
4373
4286
|
"svg",
|
|
4374
4287
|
{
|
|
4375
4288
|
className: "group-hover:scale-110 transition-transform",
|
|
@@ -4383,34 +4296,34 @@ var BridgeMocker = ({
|
|
|
4383
4296
|
width: "14",
|
|
4384
4297
|
xmlns: "http://www.w3.org/2000/svg",
|
|
4385
4298
|
children: [
|
|
4386
|
-
/* @__PURE__ */
|
|
4387
|
-
/* @__PURE__ */
|
|
4388
|
-
/* @__PURE__ */
|
|
4389
|
-
/* @__PURE__ */
|
|
4390
|
-
/* @__PURE__ */
|
|
4391
|
-
/* @__PURE__ */
|
|
4392
|
-
/* @__PURE__ */
|
|
4299
|
+
/* @__PURE__ */ jsx17("path", { d: "M21 4H3" }),
|
|
4300
|
+
/* @__PURE__ */ jsx17("path", { d: "M10 8H3" }),
|
|
4301
|
+
/* @__PURE__ */ jsx17("path", { d: "M21 12H3" }),
|
|
4302
|
+
/* @__PURE__ */ jsx17("path", { d: "M10 16H3" }),
|
|
4303
|
+
/* @__PURE__ */ jsx17("path", { d: "M21 20H3" }),
|
|
4304
|
+
/* @__PURE__ */ jsx17("circle", { cx: "14", cy: "8", r: "2" }),
|
|
4305
|
+
/* @__PURE__ */ jsx17("circle", { cx: "14", cy: "16", r: "2" })
|
|
4393
4306
|
]
|
|
4394
4307
|
}
|
|
4395
4308
|
)
|
|
4396
4309
|
}
|
|
4397
|
-
) : /* @__PURE__ */
|
|
4310
|
+
) : /* @__PURE__ */ jsxs13(
|
|
4398
4311
|
"div",
|
|
4399
4312
|
{
|
|
4400
4313
|
className: "fixed bottom-4 right-4 bg-slate-900 text-slate-300 font-mono text-xs rounded-xl shadow-2xl border border-slate-700 pointer-events-auto flex flex-col w-80 overflow-hidden animate-in slide-in-from-right duration-300",
|
|
4401
4314
|
style: { zIndex: 9998 },
|
|
4402
4315
|
children: [
|
|
4403
|
-
/* @__PURE__ */
|
|
4316
|
+
/* @__PURE__ */ jsxs13(
|
|
4404
4317
|
"div",
|
|
4405
4318
|
{
|
|
4406
4319
|
className: "flex justify-between items-center p-3 border-b border-slate-800 cursor-pointer bg-slate-800/50 hover:bg-slate-800 transition-colors",
|
|
4407
4320
|
onClick: () => setIsMinimized(true),
|
|
4408
4321
|
children: [
|
|
4409
|
-
/* @__PURE__ */
|
|
4410
|
-
/* @__PURE__ */
|
|
4322
|
+
/* @__PURE__ */ jsxs13("span", { className: "font-bold text-slate-100 flex items-center gap-2", children: [
|
|
4323
|
+
/* @__PURE__ */ jsx17("span", { className: "text-lg", children: "\u{1F6E0}\uFE0F" }),
|
|
4411
4324
|
" Simulation Controls"
|
|
4412
4325
|
] }),
|
|
4413
|
-
/* @__PURE__ */
|
|
4326
|
+
/* @__PURE__ */ jsx17(
|
|
4414
4327
|
Button,
|
|
4415
4328
|
{
|
|
4416
4329
|
className: "text-slate-500 hover:text-white p-0 h-auto hover:bg-transparent cursor-pointer",
|
|
@@ -4422,10 +4335,10 @@ var BridgeMocker = ({
|
|
|
4422
4335
|
]
|
|
4423
4336
|
}
|
|
4424
4337
|
),
|
|
4425
|
-
/* @__PURE__ */
|
|
4426
|
-
/* @__PURE__ */
|
|
4427
|
-
/* @__PURE__ */
|
|
4428
|
-
/* @__PURE__ */
|
|
4338
|
+
/* @__PURE__ */ jsxs13("div", { className: "p-4 flex flex-col gap-3", children: [
|
|
4339
|
+
/* @__PURE__ */ jsxs13("div", { className: "flex justify-between items-center", children: [
|
|
4340
|
+
/* @__PURE__ */ jsxs13("label", { className: "flex items-center gap-2 cursor-pointer", children: [
|
|
4341
|
+
/* @__PURE__ */ jsx17(
|
|
4429
4342
|
"input",
|
|
4430
4343
|
{
|
|
4431
4344
|
checked: autoMove,
|
|
@@ -4434,20 +4347,20 @@ var BridgeMocker = ({
|
|
|
4434
4347
|
type: "checkbox"
|
|
4435
4348
|
}
|
|
4436
4349
|
),
|
|
4437
|
-
/* @__PURE__ */
|
|
4350
|
+
/* @__PURE__ */ jsxs13("span", { className: "text-slate-200 font-bold", children: [
|
|
4438
4351
|
"Auto-Move ",
|
|
4439
4352
|
simulationPath ? "(Path)" : "(Random)"
|
|
4440
4353
|
] })
|
|
4441
4354
|
] }),
|
|
4442
|
-
/* @__PURE__ */
|
|
4443
|
-
/* @__PURE__ */
|
|
4444
|
-
/* @__PURE__ */
|
|
4355
|
+
/* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-2", children: [
|
|
4356
|
+
/* @__PURE__ */ jsx17("span", { className: "text-[10px] text-slate-500", children: "Speed:" }),
|
|
4357
|
+
/* @__PURE__ */ jsx17(
|
|
4445
4358
|
"select",
|
|
4446
4359
|
{
|
|
4447
4360
|
className: "bg-slate-800 border border-slate-700 rounded px-1 py-0.5 text-white focus:outline-none focus:border-blue-500 text-[10px]",
|
|
4448
4361
|
onChange: (e) => setSpeedMultiplier(Number(e.target.value)),
|
|
4449
4362
|
value: speedMultiplier,
|
|
4450
|
-
children: [1, 2, 5, 10, 50, 100, 250].map((s) => /* @__PURE__ */
|
|
4363
|
+
children: [1, 2, 5, 10, 50, 100, 250].map((s) => /* @__PURE__ */ jsxs13("option", { value: s, children: [
|
|
4451
4364
|
s,
|
|
4452
4365
|
"x"
|
|
4453
4366
|
] }, s))
|
|
@@ -4455,10 +4368,10 @@ var BridgeMocker = ({
|
|
|
4455
4368
|
)
|
|
4456
4369
|
] })
|
|
4457
4370
|
] }),
|
|
4458
|
-
/* @__PURE__ */
|
|
4459
|
-
/* @__PURE__ */
|
|
4460
|
-
/* @__PURE__ */
|
|
4461
|
-
/* @__PURE__ */
|
|
4371
|
+
/* @__PURE__ */ jsxs13("div", { className: "grid grid-cols-2 gap-2", children: [
|
|
4372
|
+
/* @__PURE__ */ jsxs13("div", { className: "flex flex-col gap-1", children: [
|
|
4373
|
+
/* @__PURE__ */ jsx17("span", { className: "text-[10px] text-slate-500 text-left", children: "Lng" }),
|
|
4374
|
+
/* @__PURE__ */ jsx17(
|
|
4462
4375
|
"input",
|
|
4463
4376
|
{
|
|
4464
4377
|
className: "bg-slate-800 border border-slate-700 rounded px-2 py-1 text-white focus:outline-none focus:border-blue-500",
|
|
@@ -4473,9 +4386,9 @@ var BridgeMocker = ({
|
|
|
4473
4386
|
}
|
|
4474
4387
|
)
|
|
4475
4388
|
] }),
|
|
4476
|
-
/* @__PURE__ */
|
|
4477
|
-
/* @__PURE__ */
|
|
4478
|
-
/* @__PURE__ */
|
|
4389
|
+
/* @__PURE__ */ jsxs13("div", { className: "flex flex-col gap-1", children: [
|
|
4390
|
+
/* @__PURE__ */ jsx17("span", { className: "text-[10px] text-slate-500 text-left", children: "Lat" }),
|
|
4391
|
+
/* @__PURE__ */ jsx17(
|
|
4479
4392
|
"input",
|
|
4480
4393
|
{
|
|
4481
4394
|
className: "bg-slate-800 border border-slate-700 rounded px-2 py-1 text-white focus:outline-none focus:border-blue-500",
|
|
@@ -4490,9 +4403,9 @@ var BridgeMocker = ({
|
|
|
4490
4403
|
}
|
|
4491
4404
|
)
|
|
4492
4405
|
] }),
|
|
4493
|
-
/* @__PURE__ */
|
|
4494
|
-
/* @__PURE__ */
|
|
4495
|
-
/* @__PURE__ */
|
|
4406
|
+
/* @__PURE__ */ jsxs13("div", { className: "flex flex-col gap-1 col-span-2", children: [
|
|
4407
|
+
/* @__PURE__ */ jsx17("span", { className: "text-[10px] text-slate-500", children: "Heading (Degrees)" }),
|
|
4408
|
+
/* @__PURE__ */ jsx17(
|
|
4496
4409
|
"input",
|
|
4497
4410
|
{
|
|
4498
4411
|
className: "w-full accent-blue-500",
|
|
@@ -4506,13 +4419,13 @@ var BridgeMocker = ({
|
|
|
4506
4419
|
value: heading
|
|
4507
4420
|
}
|
|
4508
4421
|
),
|
|
4509
|
-
/* @__PURE__ */
|
|
4422
|
+
/* @__PURE__ */ jsxs13("div", { className: "text-right text-slate-400", children: [
|
|
4510
4423
|
heading,
|
|
4511
4424
|
"\xB0"
|
|
4512
4425
|
] })
|
|
4513
4426
|
] })
|
|
4514
4427
|
] }),
|
|
4515
|
-
/* @__PURE__ */
|
|
4428
|
+
/* @__PURE__ */ jsx17(
|
|
4516
4429
|
Button,
|
|
4517
4430
|
{
|
|
4518
4431
|
className: `w-full rounded px-2 py-1.5 text-[10px] font-bold border cursor-pointer ${isPlacingLocation ? "bg-blue-500/20 border-blue-500 text-blue-300" : "bg-slate-800 border-slate-700 text-slate-200 hover:bg-slate-700"}`,
|
|
@@ -4522,11 +4435,11 @@ var BridgeMocker = ({
|
|
|
4522
4435
|
children: isPlacingLocation ? "\u{1F4CD} Click the map to drop location\u2026" : "\u{1F4CD} Drop location on map"
|
|
4523
4436
|
}
|
|
4524
4437
|
),
|
|
4525
|
-
/* @__PURE__ */
|
|
4526
|
-
/* @__PURE__ */
|
|
4527
|
-
/* @__PURE__ */
|
|
4528
|
-
/* @__PURE__ */
|
|
4529
|
-
/* @__PURE__ */
|
|
4438
|
+
/* @__PURE__ */ jsxs13("div", { className: "flex flex-col gap-1 border-t border-slate-800 pt-3", children: [
|
|
4439
|
+
/* @__PURE__ */ jsxs13("div", { className: "flex justify-between items-center", children: [
|
|
4440
|
+
/* @__PURE__ */ jsx17("span", { className: "text-[10px] text-slate-500", children: "Scan Radius" }),
|
|
4441
|
+
/* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-1", children: [
|
|
4442
|
+
/* @__PURE__ */ jsx17(
|
|
4530
4443
|
"input",
|
|
4531
4444
|
{
|
|
4532
4445
|
className: "w-16 bg-slate-800 border border-slate-700 rounded px-1.5 py-0.5 text-white text-[10px] focus:outline-none focus:border-blue-500",
|
|
@@ -4536,21 +4449,21 @@ var BridgeMocker = ({
|
|
|
4536
4449
|
value: radiusMeters
|
|
4537
4450
|
}
|
|
4538
4451
|
),
|
|
4539
|
-
/* @__PURE__ */
|
|
4452
|
+
/* @__PURE__ */ jsxs13(
|
|
4540
4453
|
"select",
|
|
4541
4454
|
{
|
|
4542
4455
|
className: "bg-slate-800 border border-slate-700 rounded px-1 py-0.5 text-white text-[10px] focus:outline-none focus:border-blue-500",
|
|
4543
4456
|
onChange: (e) => setRadiusUnit(e.target.value),
|
|
4544
4457
|
value: radiusUnit,
|
|
4545
4458
|
children: [
|
|
4546
|
-
/* @__PURE__ */
|
|
4547
|
-
/* @__PURE__ */
|
|
4459
|
+
/* @__PURE__ */ jsx17("option", { value: "m", children: "m" }),
|
|
4460
|
+
/* @__PURE__ */ jsx17("option", { value: "km", children: "km" })
|
|
4548
4461
|
]
|
|
4549
4462
|
}
|
|
4550
4463
|
)
|
|
4551
4464
|
] })
|
|
4552
4465
|
] }),
|
|
4553
|
-
/* @__PURE__ */
|
|
4466
|
+
/* @__PURE__ */ jsx17(
|
|
4554
4467
|
"input",
|
|
4555
4468
|
{
|
|
4556
4469
|
className: "w-full accent-blue-500",
|
|
@@ -4562,7 +4475,7 @@ var BridgeMocker = ({
|
|
|
4562
4475
|
value: radiusMeters
|
|
4563
4476
|
}
|
|
4564
4477
|
),
|
|
4565
|
-
/* @__PURE__ */
|
|
4478
|
+
/* @__PURE__ */ jsx17("div", { className: "text-right text-slate-400", children: radiusMeters === 0 ? "hidden" : `${radiusMeters}${radiusUnit} radius around user` })
|
|
4566
4479
|
] })
|
|
4567
4480
|
] })
|
|
4568
4481
|
]
|
|
@@ -4572,20 +4485,20 @@ var BridgeMocker = ({
|
|
|
4572
4485
|
};
|
|
4573
4486
|
|
|
4574
4487
|
// src/components/DebugConsole.tsx
|
|
4575
|
-
import { useCallback as
|
|
4576
|
-
import { jsx as
|
|
4488
|
+
import { useCallback as useCallback8, useEffect as useEffect9, useRef as useRef9, useState as useState11 } from "react";
|
|
4489
|
+
import { jsx as jsx18, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
4577
4490
|
var DebugConsole = ({
|
|
4578
4491
|
isOpen: initialOpen = false,
|
|
4579
4492
|
onClose
|
|
4580
4493
|
}) => {
|
|
4581
|
-
const [showConsole, setShowConsole] =
|
|
4582
|
-
const [logs, setLogs] =
|
|
4583
|
-
const scrollRef =
|
|
4494
|
+
const [showConsole, setShowConsole] = useState11(initialOpen);
|
|
4495
|
+
const [logs, setLogs] = useState11([]);
|
|
4496
|
+
const scrollRef = useRef9(null);
|
|
4584
4497
|
useEffect9(() => {
|
|
4585
4498
|
setShowConsole(initialOpen);
|
|
4586
4499
|
}, [initialOpen]);
|
|
4587
4500
|
const clearLogs = () => setLogs([]);
|
|
4588
|
-
const addLog =
|
|
4501
|
+
const addLog = useCallback8((label, data) => {
|
|
4589
4502
|
if (label.includes("LOCATION_STREAM_UPDATE" /* LOCATION_STREAM_UPDATE */)) return;
|
|
4590
4503
|
const entry = {
|
|
4591
4504
|
content: typeof data === "string" ? data : JSON.stringify(data, null, 2),
|
|
@@ -4617,7 +4530,7 @@ var DebugConsole = ({
|
|
|
4617
4530
|
};
|
|
4618
4531
|
}, [addLog]);
|
|
4619
4532
|
if (!showConsole) {
|
|
4620
|
-
return /* @__PURE__ */
|
|
4533
|
+
return /* @__PURE__ */ jsx18(
|
|
4621
4534
|
Button,
|
|
4622
4535
|
{
|
|
4623
4536
|
className: "fixed bottom-4 left-4 w-8 h-8 rounded-full bg-slate-900/60 backdrop-blur-sm border border-slate-700/50 flex items-center justify-center text-slate-400 hover:text-emerald-400 hover:bg-slate-900/80 transition-all z-[9998] shadow-lg group p-0!",
|
|
@@ -4625,7 +4538,7 @@ var DebugConsole = ({
|
|
|
4625
4538
|
title: "Open Debug Console",
|
|
4626
4539
|
type: "button",
|
|
4627
4540
|
variant: "ghost",
|
|
4628
|
-
children: /* @__PURE__ */
|
|
4541
|
+
children: /* @__PURE__ */ jsxs14(
|
|
4629
4542
|
"svg",
|
|
4630
4543
|
{
|
|
4631
4544
|
className: "group-hover:scale-110 transition-transform",
|
|
@@ -4639,31 +4552,31 @@ var DebugConsole = ({
|
|
|
4639
4552
|
width: "14",
|
|
4640
4553
|
xmlns: "http://www.w3.org/2000/svg",
|
|
4641
4554
|
children: [
|
|
4642
|
-
/* @__PURE__ */
|
|
4643
|
-
/* @__PURE__ */
|
|
4644
|
-
/* @__PURE__ */
|
|
4645
|
-
/* @__PURE__ */
|
|
4646
|
-
/* @__PURE__ */
|
|
4647
|
-
/* @__PURE__ */
|
|
4648
|
-
/* @__PURE__ */
|
|
4649
|
-
/* @__PURE__ */
|
|
4650
|
-
/* @__PURE__ */
|
|
4651
|
-
/* @__PURE__ */
|
|
4652
|
-
/* @__PURE__ */
|
|
4555
|
+
/* @__PURE__ */ jsx18("path", { d: "m8 2 1.88 1.88" }),
|
|
4556
|
+
/* @__PURE__ */ jsx18("path", { d: "M14.12 3.88 16 2" }),
|
|
4557
|
+
/* @__PURE__ */ jsx18("path", { d: "M9 7.13v-1a3.003 3.003 0 1 1 6 0v1" }),
|
|
4558
|
+
/* @__PURE__ */ jsx18("path", { d: "M12 20c-3.3 0-6-2.7-6-6v-3a4 4 0 0 1 4-4h4a4 4 0 0 1 4 4v3c0 3.3-2.7 6-6 6" }),
|
|
4559
|
+
/* @__PURE__ */ jsx18("path", { d: "M12 20v-9" }),
|
|
4560
|
+
/* @__PURE__ */ jsx18("path", { d: "M6.53 9C4.6 8.8 3 7.1 3 5" }),
|
|
4561
|
+
/* @__PURE__ */ jsx18("path", { d: "M6 13H2" }),
|
|
4562
|
+
/* @__PURE__ */ jsx18("path", { d: "M3 21c0-2.1 1.7-3.9 3.8-4" }),
|
|
4563
|
+
/* @__PURE__ */ jsx18("path", { d: "M20.97 5c0 2.1-1.6 3.8-3.5 4" }),
|
|
4564
|
+
/* @__PURE__ */ jsx18("path", { d: "M22 13h-4" }),
|
|
4565
|
+
/* @__PURE__ */ jsx18("path", { d: "M17.2 17c2.1.1 3.8 1.9 3.8 4" })
|
|
4653
4566
|
]
|
|
4654
4567
|
}
|
|
4655
4568
|
)
|
|
4656
4569
|
}
|
|
4657
4570
|
);
|
|
4658
4571
|
}
|
|
4659
|
-
return /* @__PURE__ */
|
|
4660
|
-
/* @__PURE__ */
|
|
4661
|
-
/* @__PURE__ */
|
|
4662
|
-
/* @__PURE__ */
|
|
4572
|
+
return /* @__PURE__ */ jsxs14("div", { className: "fixed inset-x-0 bottom-0 w-full bg-[#0a080f] border-t border-slate-800 z-[9998] p-4 shadow-2xl flex flex-col animate-in slide-in-from-bottom duration-300", children: [
|
|
4573
|
+
/* @__PURE__ */ jsxs14("div", { className: "flex items-center justify-between mb-2", children: [
|
|
4574
|
+
/* @__PURE__ */ jsxs14("span", { className: "text-[10px] font-bold uppercase tracking-widest text-slate-400 flex items-center gap-2", children: [
|
|
4575
|
+
/* @__PURE__ */ jsx18("span", { className: "w-2 h-2 rounded-full bg-emerald-500 animate-pulse" }),
|
|
4663
4576
|
"UP SDK Debug Console"
|
|
4664
4577
|
] }),
|
|
4665
|
-
/* @__PURE__ */
|
|
4666
|
-
/* @__PURE__ */
|
|
4578
|
+
/* @__PURE__ */ jsxs14("div", { className: "flex gap-4", children: [
|
|
4579
|
+
/* @__PURE__ */ jsx18(
|
|
4667
4580
|
Button,
|
|
4668
4581
|
{
|
|
4669
4582
|
className: "text-[10px] text-slate-500 font-bold uppercase hover:text-slate-300 hover:bg-transparent transition-colors p-0 h-auto cursor-pointer",
|
|
@@ -4673,7 +4586,7 @@ var DebugConsole = ({
|
|
|
4673
4586
|
children: "Clear"
|
|
4674
4587
|
}
|
|
4675
4588
|
),
|
|
4676
|
-
/* @__PURE__ */
|
|
4589
|
+
/* @__PURE__ */ jsx18(
|
|
4677
4590
|
Button,
|
|
4678
4591
|
{
|
|
4679
4592
|
className: "text-[10px] text-pink-500 font-bold uppercase hover:text-pink-400 hover:bg-transparent transition-colors p-0 h-auto cursor-pointer",
|
|
@@ -4688,21 +4601,21 @@ var DebugConsole = ({
|
|
|
4688
4601
|
)
|
|
4689
4602
|
] })
|
|
4690
4603
|
] }),
|
|
4691
|
-
/* @__PURE__ */
|
|
4604
|
+
/* @__PURE__ */ jsx18(
|
|
4692
4605
|
"div",
|
|
4693
4606
|
{
|
|
4694
4607
|
className: "bg-black/80 rounded-xl p-3 font-mono text-[10px] text-emerald-400 min-h-[120px] max-h-[240px] overflow-y-auto border border-slate-900 custom-scrollbar",
|
|
4695
4608
|
ref: scrollRef,
|
|
4696
|
-
children: logs.length === 0 ? /* @__PURE__ */
|
|
4609
|
+
children: logs.length === 0 ? /* @__PURE__ */ jsx18("div", { className: "text-slate-600 italic text-center py-8", children: "No logs yet. Interacting with the SDK will show events here." }) : logs.map((log) => /* @__PURE__ */ jsxs14(
|
|
4697
4610
|
"div",
|
|
4698
4611
|
{
|
|
4699
4612
|
className: "mb-3 pb-3 border-b border-slate-900/50 last:border-0 last:mb-0 last:pb-0",
|
|
4700
4613
|
children: [
|
|
4701
|
-
/* @__PURE__ */
|
|
4702
|
-
/* @__PURE__ */
|
|
4703
|
-
/* @__PURE__ */
|
|
4614
|
+
/* @__PURE__ */ jsxs14("div", { className: "flex gap-2 text-slate-500 mb-1 items-center", children: [
|
|
4615
|
+
/* @__PURE__ */ jsx18("span", { className: "text-[8px]", children: log.time }),
|
|
4616
|
+
/* @__PURE__ */ jsx18("span", { className: "font-bold text-white uppercase text-[8px] bg-slate-800 px-1.5 py-0.5 rounded leading-none", children: log.label })
|
|
4704
4617
|
] }),
|
|
4705
|
-
/* @__PURE__ */
|
|
4618
|
+
/* @__PURE__ */ jsx18("pre", { className: "whitespace-pre-wrap break-all opacity-90", children: log.content })
|
|
4706
4619
|
]
|
|
4707
4620
|
},
|
|
4708
4621
|
log.id
|
|
@@ -4713,8 +4626,8 @@ var DebugConsole = ({
|
|
|
4713
4626
|
};
|
|
4714
4627
|
|
|
4715
4628
|
// src/components/PullToRefresh.tsx
|
|
4716
|
-
import { useEffect as useEffect10, useRef as
|
|
4717
|
-
import { jsx as
|
|
4629
|
+
import { useEffect as useEffect10, useRef as useRef10, useState as useState12 } from "react";
|
|
4630
|
+
import { jsx as jsx19, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
4718
4631
|
var DEFAULT_PULL_THRESHOLD = 64;
|
|
4719
4632
|
var DEFAULT_MAX_PULL = 96;
|
|
4720
4633
|
var RESISTANCE = 0.5;
|
|
@@ -4725,7 +4638,7 @@ function DefaultIndicator({
|
|
|
4725
4638
|
progress,
|
|
4726
4639
|
isRefreshing
|
|
4727
4640
|
}) {
|
|
4728
|
-
return /* @__PURE__ */
|
|
4641
|
+
return /* @__PURE__ */ jsxs15(
|
|
4729
4642
|
"div",
|
|
4730
4643
|
{
|
|
4731
4644
|
style: {
|
|
@@ -4740,7 +4653,7 @@ function DefaultIndicator({
|
|
|
4740
4653
|
width: 28
|
|
4741
4654
|
},
|
|
4742
4655
|
children: [
|
|
4743
|
-
/* @__PURE__ */
|
|
4656
|
+
/* @__PURE__ */ jsxs15(
|
|
4744
4657
|
"svg",
|
|
4745
4658
|
{
|
|
4746
4659
|
height: 14,
|
|
@@ -4752,8 +4665,8 @@ function DefaultIndicator({
|
|
|
4752
4665
|
viewBox: "0 0 24 24",
|
|
4753
4666
|
width: 14,
|
|
4754
4667
|
children: [
|
|
4755
|
-
/* @__PURE__ */
|
|
4756
|
-
/* @__PURE__ */
|
|
4668
|
+
/* @__PURE__ */ jsx19("title", { children: "Refreshing" }),
|
|
4669
|
+
/* @__PURE__ */ jsx19(
|
|
4757
4670
|
"path",
|
|
4758
4671
|
{
|
|
4759
4672
|
d: "M21 12a9 9 0 1 1-2.64-6.36",
|
|
@@ -4766,7 +4679,7 @@ function DefaultIndicator({
|
|
|
4766
4679
|
]
|
|
4767
4680
|
}
|
|
4768
4681
|
),
|
|
4769
|
-
/* @__PURE__ */
|
|
4682
|
+
/* @__PURE__ */ jsx19("style", { children: "@keyframes up-sdk-ptr-spin { to { transform: rotate(360deg); } }" })
|
|
4770
4683
|
]
|
|
4771
4684
|
}
|
|
4772
4685
|
);
|
|
@@ -4780,26 +4693,45 @@ var PullToRefresh = ({
|
|
|
4780
4693
|
maxPull = DEFAULT_MAX_PULL,
|
|
4781
4694
|
renderIndicator
|
|
4782
4695
|
}) => {
|
|
4783
|
-
const containerRef =
|
|
4784
|
-
const startYRef =
|
|
4785
|
-
const lastYRef =
|
|
4786
|
-
const lastMoveTimeRef =
|
|
4787
|
-
const velocityRef =
|
|
4788
|
-
const pointerIdRef =
|
|
4789
|
-
const isPullingRef =
|
|
4790
|
-
const pullDistanceRef =
|
|
4791
|
-
const flingRafRef =
|
|
4792
|
-
const [pullDistance, setPullDistance] =
|
|
4793
|
-
const [isRefreshing, setIsRefreshing] =
|
|
4794
|
-
const [isTracking, setIsTracking] =
|
|
4795
|
-
const disabledRef =
|
|
4696
|
+
const containerRef = useRef10(null);
|
|
4697
|
+
const startYRef = useRef10(null);
|
|
4698
|
+
const lastYRef = useRef10(0);
|
|
4699
|
+
const lastMoveTimeRef = useRef10(0);
|
|
4700
|
+
const velocityRef = useRef10(0);
|
|
4701
|
+
const pointerIdRef = useRef10(null);
|
|
4702
|
+
const isPullingRef = useRef10(false);
|
|
4703
|
+
const pullDistanceRef = useRef10(0);
|
|
4704
|
+
const flingRafRef = useRef10(null);
|
|
4705
|
+
const [pullDistance, setPullDistance] = useState12(0);
|
|
4706
|
+
const [isRefreshing, setIsRefreshing] = useState12(false);
|
|
4707
|
+
const [isTracking, setIsTracking] = useState12(false);
|
|
4708
|
+
const disabledRef = useRef10(disabled);
|
|
4796
4709
|
disabledRef.current = disabled;
|
|
4797
|
-
const onRefreshRef =
|
|
4710
|
+
const onRefreshRef = useRef10(onRefresh);
|
|
4798
4711
|
onRefreshRef.current = onRefresh;
|
|
4799
|
-
const pullThresholdRef =
|
|
4712
|
+
const pullThresholdRef = useRef10(pullThreshold);
|
|
4800
4713
|
pullThresholdRef.current = pullThreshold;
|
|
4801
|
-
const maxPullRef =
|
|
4714
|
+
const maxPullRef = useRef10(maxPull);
|
|
4802
4715
|
maxPullRef.current = maxPull;
|
|
4716
|
+
useEffect10(() => {
|
|
4717
|
+
const el = containerRef.current;
|
|
4718
|
+
if (!el || typeof window === "undefined") return;
|
|
4719
|
+
const checkScrollChain = () => {
|
|
4720
|
+
const noInternalOverflow = el.scrollHeight <= el.clientHeight;
|
|
4721
|
+
const tallerThanViewport = el.clientHeight > window.innerHeight;
|
|
4722
|
+
if (noInternalOverflow && tallerThanViewport) {
|
|
4723
|
+
console.warn(
|
|
4724
|
+
"[PullToRefresh] This container is taller than the viewport but has no internal scroll (scrollHeight <= clientHeight). Because this component disables native touch scrolling entirely (touch-action: none), scrolling is now completely broken here. This almost always means either: (1) an ancestor's flex-1 item is missing `min-h-0` (a flex item defaults to min-height:auto and refuses to shrink below its content size), or (2) an ancestor uses `min-h-screen`/`min-h-full` (a floor, not a ceiling) instead of `h-full`/`h-screen`/`h-dvh`. See the vault skill js/pull-to-refresh-scroll-chain.md for the fix pattern."
|
|
4725
|
+
);
|
|
4726
|
+
}
|
|
4727
|
+
};
|
|
4728
|
+
const raf = requestAnimationFrame(checkScrollChain);
|
|
4729
|
+
window.addEventListener("resize", checkScrollChain);
|
|
4730
|
+
return () => {
|
|
4731
|
+
cancelAnimationFrame(raf);
|
|
4732
|
+
window.removeEventListener("resize", checkScrollChain);
|
|
4733
|
+
};
|
|
4734
|
+
}, []);
|
|
4803
4735
|
useEffect10(() => {
|
|
4804
4736
|
const el = containerRef.current;
|
|
4805
4737
|
if (!el) return;
|
|
@@ -4931,7 +4863,7 @@ var PullToRefresh = ({
|
|
|
4931
4863
|
const indicatorHeight = isRefreshing ? pullThreshold : pullDistance;
|
|
4932
4864
|
const progress = Math.min(indicatorHeight / pullThreshold, 1);
|
|
4933
4865
|
const isSettling = pullDistance === 0 && !isRefreshing && !isTracking;
|
|
4934
|
-
return /* @__PURE__ */
|
|
4866
|
+
return /* @__PURE__ */ jsxs15(
|
|
4935
4867
|
"div",
|
|
4936
4868
|
{
|
|
4937
4869
|
className: `up-sdk-pull-to-refresh ${className}`,
|
|
@@ -4942,8 +4874,8 @@ var PullToRefresh = ({
|
|
|
4942
4874
|
touchAction: "none"
|
|
4943
4875
|
},
|
|
4944
4876
|
children: [
|
|
4945
|
-
/* @__PURE__ */
|
|
4946
|
-
/* @__PURE__ */
|
|
4877
|
+
/* @__PURE__ */ jsx19("style", { children: ".up-sdk-pull-to-refresh::-webkit-scrollbar { display: none; } .up-sdk-pull-to-refresh { scrollbar-width: none; -ms-overflow-style: none; }" }),
|
|
4878
|
+
/* @__PURE__ */ jsx19(
|
|
4947
4879
|
"div",
|
|
4948
4880
|
{
|
|
4949
4881
|
style: {
|
|
@@ -4956,7 +4888,7 @@ var PullToRefresh = ({
|
|
|
4956
4888
|
userSelect: "none",
|
|
4957
4889
|
width: "100%"
|
|
4958
4890
|
},
|
|
4959
|
-
children: renderIndicator ? renderIndicator({ isRefreshing, progress }) : /* @__PURE__ */
|
|
4891
|
+
children: renderIndicator ? renderIndicator({ isRefreshing, progress }) : /* @__PURE__ */ jsx19(DefaultIndicator, { isRefreshing, progress })
|
|
4960
4892
|
}
|
|
4961
4893
|
),
|
|
4962
4894
|
children
|
|
@@ -4967,15 +4899,15 @@ var PullToRefresh = ({
|
|
|
4967
4899
|
|
|
4968
4900
|
// src/components/QRScanner.tsx
|
|
4969
4901
|
import jsQR2 from "jsqr";
|
|
4970
|
-
import { useEffect as useEffect11, useRef as
|
|
4971
|
-
import { jsx as
|
|
4902
|
+
import { useEffect as useEffect11, useRef as useRef11, useState as useState13 } from "react";
|
|
4903
|
+
import { jsx as jsx20, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
4972
4904
|
function QRScanner({ onScan, onError, className = "" }) {
|
|
4973
|
-
const videoRef =
|
|
4974
|
-
const canvasRef =
|
|
4975
|
-
const streamRef =
|
|
4976
|
-
const tickRequestRef =
|
|
4977
|
-
const hasScannedRef =
|
|
4978
|
-
const [isReady, setIsReady] =
|
|
4905
|
+
const videoRef = useRef11(null);
|
|
4906
|
+
const canvasRef = useRef11(null);
|
|
4907
|
+
const streamRef = useRef11(null);
|
|
4908
|
+
const tickRequestRef = useRef11(null);
|
|
4909
|
+
const hasScannedRef = useRef11(false);
|
|
4910
|
+
const [isReady, setIsReady] = useState13(false);
|
|
4979
4911
|
useEffect11(() => {
|
|
4980
4912
|
let cancelled = false;
|
|
4981
4913
|
hasScannedRef.current = false;
|
|
@@ -5059,7 +4991,7 @@ function QRScanner({ onScan, onError, className = "" }) {
|
|
|
5059
4991
|
cleanup();
|
|
5060
4992
|
};
|
|
5061
4993
|
}, []);
|
|
5062
|
-
return /* @__PURE__ */
|
|
4994
|
+
return /* @__PURE__ */ jsxs16(
|
|
5063
4995
|
"div",
|
|
5064
4996
|
{
|
|
5065
4997
|
className,
|
|
@@ -5071,7 +5003,7 @@ function QRScanner({ onScan, onError, className = "" }) {
|
|
|
5071
5003
|
position: "relative"
|
|
5072
5004
|
},
|
|
5073
5005
|
children: [
|
|
5074
|
-
/* @__PURE__ */
|
|
5006
|
+
/* @__PURE__ */ jsx20(
|
|
5075
5007
|
"video",
|
|
5076
5008
|
{
|
|
5077
5009
|
playsInline: true,
|
|
@@ -5079,8 +5011,8 @@ function QRScanner({ onScan, onError, className = "" }) {
|
|
|
5079
5011
|
style: { height: "100%", objectFit: "cover", width: "100%" }
|
|
5080
5012
|
}
|
|
5081
5013
|
),
|
|
5082
|
-
/* @__PURE__ */
|
|
5083
|
-
isReady && /* @__PURE__ */
|
|
5014
|
+
/* @__PURE__ */ jsx20("canvas", { ref: canvasRef, style: { display: "none" } }),
|
|
5015
|
+
isReady && /* @__PURE__ */ jsx20(
|
|
5084
5016
|
"div",
|
|
5085
5017
|
{
|
|
5086
5018
|
style: {
|
|
@@ -5101,8 +5033,8 @@ function QRScanner({ onScan, onError, className = "" }) {
|
|
|
5101
5033
|
}
|
|
5102
5034
|
|
|
5103
5035
|
// src/components/SDKProvider.tsx
|
|
5104
|
-
import { createContext as createContext3, useContext as useContext6, useMemo as
|
|
5105
|
-
import { Fragment as
|
|
5036
|
+
import { createContext as createContext3, useContext as useContext6, useMemo as useMemo9 } from "react";
|
|
5037
|
+
import { Fragment as Fragment6, jsx as jsx21, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
5106
5038
|
var SDKContext = createContext3({ isMocked: false });
|
|
5107
5039
|
var useIsMocked = () => useContext6(SDKContext).isMocked;
|
|
5108
5040
|
var SDKProvider = ({
|
|
@@ -5111,25 +5043,25 @@ var SDKProvider = ({
|
|
|
5111
5043
|
...mockerProps
|
|
5112
5044
|
}) => {
|
|
5113
5045
|
const isMocked = typeof window !== "undefined" && !(window.__UP_REACT_NATIVE_APP__ === true || !!window.ReactNativeWebView);
|
|
5114
|
-
const value =
|
|
5115
|
-
const content = /* @__PURE__ */
|
|
5046
|
+
const value = useMemo9(() => ({ isMocked }), [isMocked]);
|
|
5047
|
+
const content = /* @__PURE__ */ jsxs17(Fragment6, { children: [
|
|
5116
5048
|
children,
|
|
5117
|
-
(debug || isMocked) && /* @__PURE__ */
|
|
5049
|
+
(debug || isMocked) && /* @__PURE__ */ jsx21(DebugConsole, {})
|
|
5118
5050
|
] });
|
|
5119
5051
|
if (isMocked) {
|
|
5120
|
-
return /* @__PURE__ */
|
|
5052
|
+
return /* @__PURE__ */ jsx21(SDKContext.Provider, { value, children: /* @__PURE__ */ jsx21(BridgeMocker, { ...mockerProps, children: content }) });
|
|
5121
5053
|
}
|
|
5122
|
-
return /* @__PURE__ */
|
|
5054
|
+
return /* @__PURE__ */ jsx21(SDKContext.Provider, { value, children: content });
|
|
5123
5055
|
};
|
|
5124
5056
|
|
|
5125
5057
|
// src/components/SwipeCarousel.tsx
|
|
5126
5058
|
import {
|
|
5127
5059
|
useEffect as useEffect12,
|
|
5128
5060
|
useLayoutEffect,
|
|
5129
|
-
useRef as
|
|
5130
|
-
useState as
|
|
5061
|
+
useRef as useRef12,
|
|
5062
|
+
useState as useState14
|
|
5131
5063
|
} from "react";
|
|
5132
|
-
import { jsx as
|
|
5064
|
+
import { jsx as jsx22 } from "react/jsx-runtime";
|
|
5133
5065
|
var DIRECTION_LOCK_THRESHOLD_PX = 8;
|
|
5134
5066
|
var SWIPE_DISTANCE_THRESHOLD_PX = 40;
|
|
5135
5067
|
var SWIPE_VELOCITY_THRESHOLD = 0.4;
|
|
@@ -5156,21 +5088,21 @@ var SwipeCarousel = ({
|
|
|
5156
5088
|
overscan = DEFAULT_OVERSCAN,
|
|
5157
5089
|
visibleOverscan = DEFAULT_VISIBLE_OVERSCAN
|
|
5158
5090
|
}) => {
|
|
5159
|
-
const containerRef =
|
|
5160
|
-
const [containerWidth, setContainerWidth] =
|
|
5161
|
-
const [dragX, setDragX] =
|
|
5162
|
-
const [dragY, setDragY] =
|
|
5163
|
-
const [isDraggingX, setIsDraggingX] =
|
|
5164
|
-
const [isDraggingY, setIsDraggingY] =
|
|
5165
|
-
const touchStateRef =
|
|
5166
|
-
const [internalIndex, setInternalIndex] =
|
|
5091
|
+
const containerRef = useRef12(null);
|
|
5092
|
+
const [containerWidth, setContainerWidth] = useState14(0);
|
|
5093
|
+
const [dragX, setDragX] = useState14(0);
|
|
5094
|
+
const [dragY, setDragY] = useState14(0);
|
|
5095
|
+
const [isDraggingX, setIsDraggingX] = useState14(false);
|
|
5096
|
+
const [isDraggingY, setIsDraggingY] = useState14(false);
|
|
5097
|
+
const touchStateRef = useRef12(null);
|
|
5098
|
+
const [internalIndex, setInternalIndex] = useState14(
|
|
5167
5099
|
() => Math.max(
|
|
5168
5100
|
0,
|
|
5169
5101
|
items.findIndex((item) => item.id === activeId)
|
|
5170
5102
|
)
|
|
5171
5103
|
);
|
|
5172
|
-
const prevActiveIdRef =
|
|
5173
|
-
const [timingWaiting, setTimingWaiting] =
|
|
5104
|
+
const prevActiveIdRef = useRef12(activeId);
|
|
5105
|
+
const [timingWaiting, setTimingWaiting] = useState14(true);
|
|
5174
5106
|
useEffect12(() => {
|
|
5175
5107
|
const timer = setTimeout(() => {
|
|
5176
5108
|
setTimingWaiting(false);
|
|
@@ -5306,7 +5238,7 @@ var SwipeCarousel = ({
|
|
|
5306
5238
|
};
|
|
5307
5239
|
const windowStart = Math.max(0, activeIndex - overscan);
|
|
5308
5240
|
const windowEnd = Math.min(items.length - 1, activeIndex + overscan);
|
|
5309
|
-
return /* @__PURE__ */
|
|
5241
|
+
return /* @__PURE__ */ jsx22(
|
|
5310
5242
|
"div",
|
|
5311
5243
|
{
|
|
5312
5244
|
className: `relative overflow-hidden touch-pan-y ${className ?? ""}`,
|
|
@@ -5315,7 +5247,7 @@ var SwipeCarousel = ({
|
|
|
5315
5247
|
onTouchMove: handleTouchMove,
|
|
5316
5248
|
onTouchStart: handleTouchStart,
|
|
5317
5249
|
ref: containerRef,
|
|
5318
|
-
children: /* @__PURE__ */
|
|
5250
|
+
children: /* @__PURE__ */ jsx22(
|
|
5319
5251
|
"div",
|
|
5320
5252
|
{
|
|
5321
5253
|
className: "relative h-full",
|
|
@@ -5330,7 +5262,7 @@ var SwipeCarousel = ({
|
|
|
5330
5262
|
const verticalOffset = isActive ? dragY : 0;
|
|
5331
5263
|
const distance = Math.abs(index - activeIndex);
|
|
5332
5264
|
const isVisible = distance <= visibleOverscan;
|
|
5333
|
-
return /* @__PURE__ */
|
|
5265
|
+
return /* @__PURE__ */ jsx22(
|
|
5334
5266
|
"div",
|
|
5335
5267
|
{
|
|
5336
5268
|
className: `absolute top-0 left-0 h-full shrink-0 ${itemClassName ?? ""} ${item.className ?? ""}`,
|
|
@@ -5358,6 +5290,40 @@ var SwipeCarousel = ({
|
|
|
5358
5290
|
);
|
|
5359
5291
|
};
|
|
5360
5292
|
|
|
5293
|
+
// src/hooks/useTapAction.ts
|
|
5294
|
+
import { useRef as useRef13 } from "react";
|
|
5295
|
+
var TAP_MOVE_TOLERANCE_PX = 10;
|
|
5296
|
+
var CLICK_SUPPRESS_WINDOW_MS = 500;
|
|
5297
|
+
var useTapAction = (action) => {
|
|
5298
|
+
const startRef = useRef13(null);
|
|
5299
|
+
const handledByTouchRef = useRef13(false);
|
|
5300
|
+
const onTouchStart = (e) => {
|
|
5301
|
+
const touch = e.targetTouches[0];
|
|
5302
|
+
startRef.current = touch ? { x: touch.clientX, y: touch.clientY } : null;
|
|
5303
|
+
};
|
|
5304
|
+
const onTouchEnd = (e) => {
|
|
5305
|
+
const start = startRef.current;
|
|
5306
|
+
const touch = e.changedTouches[0];
|
|
5307
|
+
startRef.current = null;
|
|
5308
|
+
if (!start || !touch) return;
|
|
5309
|
+
const moved = Math.hypot(touch.clientX - start.x, touch.clientY - start.y);
|
|
5310
|
+
if (moved > TAP_MOVE_TOLERANCE_PX) return;
|
|
5311
|
+
handledByTouchRef.current = true;
|
|
5312
|
+
setTimeout(() => {
|
|
5313
|
+
handledByTouchRef.current = false;
|
|
5314
|
+
}, CLICK_SUPPRESS_WINDOW_MS);
|
|
5315
|
+
action();
|
|
5316
|
+
};
|
|
5317
|
+
const onClick = () => {
|
|
5318
|
+
if (handledByTouchRef.current) {
|
|
5319
|
+
handledByTouchRef.current = false;
|
|
5320
|
+
return;
|
|
5321
|
+
}
|
|
5322
|
+
action();
|
|
5323
|
+
};
|
|
5324
|
+
return { onClick, onTouchEnd, onTouchStart };
|
|
5325
|
+
};
|
|
5326
|
+
|
|
5361
5327
|
// src/services/apiService.ts
|
|
5362
5328
|
function buildUrl(baseUrl, path) {
|
|
5363
5329
|
if (path.startsWith("http://") || path.startsWith("https://")) {
|
|
@@ -5626,6 +5592,7 @@ export {
|
|
|
5626
5592
|
useMapControls,
|
|
5627
5593
|
useMockLocation,
|
|
5628
5594
|
useRoute,
|
|
5595
|
+
useTapAction,
|
|
5629
5596
|
useTrimmedRoute,
|
|
5630
5597
|
useUserLocation
|
|
5631
5598
|
};
|