@buoy-gg/shared-ui 2.1.9 → 2.1.11
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/lib/commonjs/dataViewer/DataViewer.js +1 -3
- package/lib/commonjs/dataViewer/VirtualizedDataExplorer.js +3 -4
- package/lib/commonjs/hooks/safe-area-impl.js +1 -1
- package/lib/commonjs/icons/ImageOverlayIcon.js +142 -0
- package/lib/commonjs/icons/index.js +8 -0
- package/lib/commonjs/ui/components/EventHistoryViewer/EventHistoryViewer.js +2 -1
- package/lib/commonjs/ui/components/WindowControls.js +307 -46
- package/lib/commonjs/ui/components/index.js +6 -0
- package/lib/commonjs/utils/time/TickContext.js +43 -0
- package/lib/commonjs/utils/time/index.js +21 -1
- package/lib/commonjs/utils/time/useRelativeTime.js +36 -0
- package/lib/module/dataViewer/DataViewer.js +1 -3
- package/lib/module/dataViewer/VirtualizedDataExplorer.js +3 -4
- package/lib/module/hooks/safe-area-impl.js +1 -1
- package/lib/module/icons/ImageOverlayIcon.js +137 -0
- package/lib/module/icons/index.js +1 -0
- package/lib/module/ui/components/EventHistoryViewer/EventHistoryViewer.js +3 -2
- package/lib/module/ui/components/WindowControls.js +308 -48
- package/lib/module/ui/components/index.js +1 -1
- package/lib/module/utils/time/TickContext.js +38 -0
- package/lib/module/utils/time/index.js +3 -1
- package/lib/module/utils/time/useRelativeTime.js +33 -0
- package/lib/typescript/commonjs/dataViewer/VirtualizedDataExplorer.d.ts.map +1 -1
- package/lib/typescript/commonjs/hooks/safe-area-impl.d.ts +1 -1
- package/lib/typescript/commonjs/icons/ImageOverlayIcon.d.ts +14 -0
- package/lib/typescript/commonjs/icons/ImageOverlayIcon.d.ts.map +1 -0
- package/lib/typescript/commonjs/icons/index.d.ts +1 -0
- package/lib/typescript/commonjs/icons/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/WindowControls.d.ts +8 -3
- package/lib/typescript/commonjs/ui/components/WindowControls.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/index.d.ts +1 -1
- package/lib/typescript/commonjs/ui/components/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/utils/time/TickContext.d.ts +21 -0
- package/lib/typescript/commonjs/utils/time/TickContext.d.ts.map +1 -0
- package/lib/typescript/commonjs/utils/time/index.d.ts +2 -0
- package/lib/typescript/commonjs/utils/time/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/utils/time/useRelativeTime.d.ts +11 -0
- package/lib/typescript/commonjs/utils/time/useRelativeTime.d.ts.map +1 -0
- package/lib/typescript/module/dataViewer/VirtualizedDataExplorer.d.ts.map +1 -1
- package/lib/typescript/module/hooks/safe-area-impl.d.ts +1 -1
- package/lib/typescript/module/icons/ImageOverlayIcon.d.ts +14 -0
- package/lib/typescript/module/icons/ImageOverlayIcon.d.ts.map +1 -0
- package/lib/typescript/module/icons/index.d.ts +1 -0
- package/lib/typescript/module/icons/index.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/WindowControls.d.ts +8 -3
- package/lib/typescript/module/ui/components/WindowControls.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/index.d.ts +1 -1
- package/lib/typescript/module/ui/components/index.d.ts.map +1 -1
- package/lib/typescript/module/utils/time/TickContext.d.ts +21 -0
- package/lib/typescript/module/utils/time/TickContext.d.ts.map +1 -0
- package/lib/typescript/module/utils/time/index.d.ts +2 -0
- package/lib/typescript/module/utils/time/index.d.ts.map +1 -1
- package/lib/typescript/module/utils/time/useRelativeTime.d.ts +11 -0
- package/lib/typescript/module/utils/time/useRelativeTime.d.ts.map +1 -0
- package/package.json +14 -13
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.TickProvider = TickProvider;
|
|
7
|
+
exports.useTick = useTick;
|
|
8
|
+
var _react = require("react");
|
|
9
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
10
|
+
const TickContext = /*#__PURE__*/(0, _react.createContext)(null);
|
|
11
|
+
/**
|
|
12
|
+
* Provides a shared clock tick to all descendants.
|
|
13
|
+
* Wrap each devtools modal/screen in a single TickProvider so that all list items
|
|
14
|
+
* share one timer instead of each item creating its own interval.
|
|
15
|
+
*
|
|
16
|
+
* Only mounted (visible) items consume the context, so FlatList virtualization
|
|
17
|
+
* ensures off-screen items don't re-render.
|
|
18
|
+
*/
|
|
19
|
+
function TickProvider({
|
|
20
|
+
children,
|
|
21
|
+
intervalMs = 5_000
|
|
22
|
+
}) {
|
|
23
|
+
const [tick, setTick] = (0, _react.useState)(() => Date.now());
|
|
24
|
+
(0, _react.useEffect)(() => {
|
|
25
|
+
const id = setInterval(() => {
|
|
26
|
+
setTick(Date.now());
|
|
27
|
+
}, intervalMs);
|
|
28
|
+
return () => {
|
|
29
|
+
clearInterval(id);
|
|
30
|
+
};
|
|
31
|
+
}, [intervalMs]);
|
|
32
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(TickContext.Provider, {
|
|
33
|
+
value: tick,
|
|
34
|
+
children: children
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Returns the current tick from the nearest TickProvider, or null if none exists.
|
|
40
|
+
*/
|
|
41
|
+
function useTick() {
|
|
42
|
+
return (0, _react.useContext)(TickContext);
|
|
43
|
+
}
|
|
@@ -3,10 +3,30 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
Object.defineProperty(exports, "TickProvider", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _TickContext.TickProvider;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
6
12
|
Object.defineProperty(exports, "formatRelativeTime", {
|
|
7
13
|
enumerable: true,
|
|
8
14
|
get: function () {
|
|
9
15
|
return _formatRelativeTime.formatRelativeTime;
|
|
10
16
|
}
|
|
11
17
|
});
|
|
12
|
-
|
|
18
|
+
Object.defineProperty(exports, "useRelativeTime", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () {
|
|
21
|
+
return _useRelativeTime.useRelativeTime;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
Object.defineProperty(exports, "useTick", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function () {
|
|
27
|
+
return _TickContext.useTick;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
var _formatRelativeTime = require("./formatRelativeTime.js");
|
|
31
|
+
var _useRelativeTime = require("./useRelativeTime.js");
|
|
32
|
+
var _TickContext = require("./TickContext.js");
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useRelativeTime = useRelativeTime;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var _formatRelativeTime = require("./formatRelativeTime.js");
|
|
9
|
+
var _TickContext = require("./TickContext.js");
|
|
10
|
+
/**
|
|
11
|
+
* Hook that returns a live-updating relative time string (e.g., "5s ago", "2m ago").
|
|
12
|
+
*
|
|
13
|
+
* When inside a `<TickProvider>`, uses the shared tick — no per-item timer.
|
|
14
|
+
* When used standalone (no provider), falls back to its own interval.
|
|
15
|
+
*
|
|
16
|
+
* @param timestamp - The timestamp to format (Date, number in ms, or nullish)
|
|
17
|
+
* @returns Formatted relative time string, or empty string if no timestamp
|
|
18
|
+
*/
|
|
19
|
+
function useRelativeTime(timestamp) {
|
|
20
|
+
const contextTick = (0, _TickContext.useTick)();
|
|
21
|
+
const hasProvider = contextTick !== null;
|
|
22
|
+
const [fallbackNow, setFallbackNow] = (0, _react.useState)(() => Date.now());
|
|
23
|
+
const timestampMs = timestamp ? timestamp instanceof Date ? timestamp.getTime() : timestamp : 0;
|
|
24
|
+
|
|
25
|
+
// Only run a per-item interval when there's no TickProvider
|
|
26
|
+
(0, _react.useEffect)(() => {
|
|
27
|
+
if (hasProvider || !timestampMs) return;
|
|
28
|
+
const id = setInterval(() => {
|
|
29
|
+
setFallbackNow(Date.now());
|
|
30
|
+
}, 5_000);
|
|
31
|
+
return () => clearInterval(id);
|
|
32
|
+
}, [hasProvider, timestampMs]);
|
|
33
|
+
if (!timestampMs) return "";
|
|
34
|
+
const now = hasProvider ? contextTick : fallbackNow;
|
|
35
|
+
return (0, _formatRelativeTime.formatRelativeTime)(timestampMs, now);
|
|
36
|
+
}
|
|
@@ -57,7 +57,6 @@ const STABLE_STYLES = StyleSheet.create({
|
|
|
57
57
|
borderRadius: 8,
|
|
58
58
|
borderWidth: 1,
|
|
59
59
|
borderColor: gameUIColors.primary + "14" // border-white/[0.08]
|
|
60
|
-
// Remove flex: 1 and minHeight to allow natural sizing
|
|
61
60
|
},
|
|
62
61
|
header: {
|
|
63
62
|
flexDirection: "column",
|
|
@@ -885,7 +884,7 @@ export const VirtualizedDataExplorer = ({
|
|
|
885
884
|
|
|
886
885
|
// Simple keyExtractor without useCallback [[memory:4875251]]
|
|
887
886
|
const keyExtractor = item => item.id;
|
|
888
|
-
const hasData = data && (typeof data === "
|
|
887
|
+
const hasData = data !== null && data !== undefined && (typeof data === "string" ? data.length > 0 : typeof data === "number" || typeof data === "boolean" ? true : Array.isArray(data) ? data.length > 0 : typeof data === "object" ? Object.keys(data).length > 0 : false);
|
|
889
888
|
|
|
890
889
|
// Raw mode: render data directly without header/container
|
|
891
890
|
if (rawMode) {
|
|
@@ -905,7 +904,7 @@ export const VirtualizedDataExplorer = ({
|
|
|
905
904
|
}
|
|
906
905
|
return /*#__PURE__*/_jsx(View, {
|
|
907
906
|
style: {
|
|
908
|
-
|
|
907
|
+
minHeight: isProcessing ? 40 : flatData.length * ITEM_HEIGHT
|
|
909
908
|
},
|
|
910
909
|
children: isProcessing ? /*#__PURE__*/_jsx(View, {
|
|
911
910
|
style: {
|
|
@@ -1020,7 +1019,7 @@ export const VirtualizedDataExplorer = ({
|
|
|
1020
1019
|
})
|
|
1021
1020
|
}) : /*#__PURE__*/_jsxs(View, {
|
|
1022
1021
|
style: {
|
|
1023
|
-
height:
|
|
1022
|
+
height: flatData.length * ITEM_HEIGHT,
|
|
1024
1023
|
position: "relative"
|
|
1025
1024
|
},
|
|
1026
1025
|
children: [/*#__PURE__*/_jsx(IndentGuidesOverlay, {
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { View } from "react-native";
|
|
4
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
5
|
+
/**
|
|
6
|
+
* ImageOverlayIcon - Icon for the Image Overlay dev tool
|
|
7
|
+
* Shows layered image frames with a mountain/sun motif,
|
|
8
|
+
* representing design mockup overlay functionality.
|
|
9
|
+
*/
|
|
10
|
+
export const ImageOverlayIcon = ({
|
|
11
|
+
size = 24,
|
|
12
|
+
color = "#A855F7",
|
|
13
|
+
glowColor
|
|
14
|
+
}) => {
|
|
15
|
+
const scale = size / 24;
|
|
16
|
+
const activeColor = color;
|
|
17
|
+
const activeGlow = glowColor || color;
|
|
18
|
+
return /*#__PURE__*/_jsxs(View, {
|
|
19
|
+
style: {
|
|
20
|
+
width: size,
|
|
21
|
+
height: size,
|
|
22
|
+
position: "relative",
|
|
23
|
+
alignItems: "center",
|
|
24
|
+
justifyContent: "center"
|
|
25
|
+
},
|
|
26
|
+
children: [/*#__PURE__*/_jsx(View, {
|
|
27
|
+
style: {
|
|
28
|
+
position: "absolute",
|
|
29
|
+
width: 14 * scale,
|
|
30
|
+
height: 14 * scale,
|
|
31
|
+
borderRadius: 2 * scale,
|
|
32
|
+
borderWidth: 1.5 * scale,
|
|
33
|
+
borderColor: activeGlow,
|
|
34
|
+
backgroundColor: "transparent",
|
|
35
|
+
left: 2 * scale,
|
|
36
|
+
top: 2 * scale,
|
|
37
|
+
opacity: 0.25
|
|
38
|
+
}
|
|
39
|
+
}), /*#__PURE__*/_jsx(View, {
|
|
40
|
+
style: {
|
|
41
|
+
position: "absolute",
|
|
42
|
+
width: 15 * scale,
|
|
43
|
+
height: 15 * scale,
|
|
44
|
+
borderRadius: 2.5 * scale,
|
|
45
|
+
backgroundColor: activeGlow,
|
|
46
|
+
left: 7 * scale,
|
|
47
|
+
top: 7 * scale,
|
|
48
|
+
opacity: 0.12
|
|
49
|
+
}
|
|
50
|
+
}), /*#__PURE__*/_jsx(View, {
|
|
51
|
+
style: {
|
|
52
|
+
position: "absolute",
|
|
53
|
+
width: 14 * scale,
|
|
54
|
+
height: 14 * scale,
|
|
55
|
+
borderRadius: 2 * scale,
|
|
56
|
+
borderWidth: 1.5 * scale,
|
|
57
|
+
borderColor: activeColor,
|
|
58
|
+
backgroundColor: "transparent",
|
|
59
|
+
left: 8 * scale,
|
|
60
|
+
top: 8 * scale,
|
|
61
|
+
opacity: 0.9
|
|
62
|
+
}
|
|
63
|
+
}), /*#__PURE__*/_jsx(View, {
|
|
64
|
+
style: {
|
|
65
|
+
position: "absolute",
|
|
66
|
+
width: 3 * scale,
|
|
67
|
+
height: 3 * scale,
|
|
68
|
+
borderRadius: 1.5 * scale,
|
|
69
|
+
backgroundColor: activeColor,
|
|
70
|
+
left: 11 * scale,
|
|
71
|
+
top: 11 * scale,
|
|
72
|
+
opacity: 0.8
|
|
73
|
+
}
|
|
74
|
+
}), /*#__PURE__*/_jsx(View, {
|
|
75
|
+
style: {
|
|
76
|
+
position: "absolute",
|
|
77
|
+
width: 6 * scale,
|
|
78
|
+
height: 1.5 * scale,
|
|
79
|
+
backgroundColor: activeColor,
|
|
80
|
+
left: 9 * scale,
|
|
81
|
+
top: 18.5 * scale,
|
|
82
|
+
opacity: 0.7,
|
|
83
|
+
transform: [{
|
|
84
|
+
rotate: "-35deg"
|
|
85
|
+
}],
|
|
86
|
+
transformOrigin: "right center",
|
|
87
|
+
borderRadius: 0.5 * scale
|
|
88
|
+
}
|
|
89
|
+
}), /*#__PURE__*/_jsx(View, {
|
|
90
|
+
style: {
|
|
91
|
+
position: "absolute",
|
|
92
|
+
width: 6 * scale,
|
|
93
|
+
height: 1.5 * scale,
|
|
94
|
+
backgroundColor: activeColor,
|
|
95
|
+
left: 14.5 * scale,
|
|
96
|
+
top: 18.5 * scale,
|
|
97
|
+
opacity: 0.7,
|
|
98
|
+
transform: [{
|
|
99
|
+
rotate: "35deg"
|
|
100
|
+
}],
|
|
101
|
+
transformOrigin: "left center",
|
|
102
|
+
borderRadius: 0.5 * scale
|
|
103
|
+
}
|
|
104
|
+
}), [{
|
|
105
|
+
x: 2,
|
|
106
|
+
y: 2
|
|
107
|
+
}, {
|
|
108
|
+
x: 16,
|
|
109
|
+
y: 2
|
|
110
|
+
}, {
|
|
111
|
+
x: 2,
|
|
112
|
+
y: 16
|
|
113
|
+
}].map((pos, i) => /*#__PURE__*/_jsx(View, {
|
|
114
|
+
style: {
|
|
115
|
+
position: "absolute",
|
|
116
|
+
width: 2 * scale,
|
|
117
|
+
height: 2 * scale,
|
|
118
|
+
borderRadius: 1 * scale,
|
|
119
|
+
backgroundColor: activeGlow,
|
|
120
|
+
left: (pos.x - 1) * scale,
|
|
121
|
+
top: (pos.y - 1) * scale,
|
|
122
|
+
opacity: 0.5
|
|
123
|
+
}
|
|
124
|
+
}, `dot-${i}`)), /*#__PURE__*/_jsx(View, {
|
|
125
|
+
style: {
|
|
126
|
+
position: "absolute",
|
|
127
|
+
width: 8 * scale,
|
|
128
|
+
height: 1.5 * scale,
|
|
129
|
+
borderRadius: 0.75 * scale,
|
|
130
|
+
backgroundColor: "#fff",
|
|
131
|
+
left: 11 * scale,
|
|
132
|
+
top: 8.5 * scale,
|
|
133
|
+
opacity: 0.15
|
|
134
|
+
}
|
|
135
|
+
})]
|
|
136
|
+
});
|
|
137
|
+
};
|
|
@@ -17,6 +17,7 @@ export { RouteMapIcon, RouteIcon, NavigationIcon } from "./RouteMapIcon.js";
|
|
|
17
17
|
export { StackPulseIcon, RenderPulseIcon, HighlightUpdatesIcon } from "./StackPulseIcon.js";
|
|
18
18
|
export { RenderCountIcon } from "./RenderCountIcon.js";
|
|
19
19
|
export { BenchmarkIcon } from "./BenchmarkIcon.js";
|
|
20
|
+
export { ImageOverlayIcon } from "./ImageOverlayIcon.js";
|
|
20
21
|
export { IconBackground } from "./IconBackground.js";
|
|
21
22
|
|
|
22
23
|
// Export lucide icons
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
import React, { memo } from "react";
|
|
12
|
-
import { View, StyleSheet } from "react-native";
|
|
12
|
+
import { View, ScrollView, StyleSheet } from "react-native";
|
|
13
13
|
import { macOSColors } from "../../gameUI/constants/macOSDesignSystemColors.js";
|
|
14
14
|
import { EventStepperFooter } from "../EventStepperFooter.js";
|
|
15
15
|
import { ViewToggleCards } from "./ViewToggleCards.js";
|
|
@@ -77,8 +77,9 @@ export const EventHistoryViewer = /*#__PURE__*/memo(function EventHistoryViewer(
|
|
|
77
77
|
diffDescription: diffViewDescription,
|
|
78
78
|
diffIcon: diffViewIcon,
|
|
79
79
|
diffDisabled: diffDisabled
|
|
80
|
-
}), activeView === "current" && /*#__PURE__*/_jsx(
|
|
80
|
+
}), activeView === "current" && /*#__PURE__*/_jsx(ScrollView, {
|
|
81
81
|
style: styles.contentSection,
|
|
82
|
+
showsVerticalScrollIndicator: true,
|
|
82
83
|
children: renderCurrentView()
|
|
83
84
|
}), activeView === "diff" && /*#__PURE__*/_jsxs(View, {
|
|
84
85
|
style: styles.contentSection,
|