@buoy-gg/images 7.0.41 → 7.0.43
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 +11 -70
- package/lib/commonjs/autoCapture.js +1 -4
- package/lib/commonjs/autoCapture.web.js +1 -6
- package/lib/commonjs/capture/actions.js +1 -243
- package/lib/commonjs/capture/install.js +1 -45
- package/lib/commonjs/capture/install.web.js +1 -250
- package/lib/commonjs/capture/installExpoImage.js +1 -99
- package/lib/commonjs/capture/installRnImage.js +1 -132
- package/lib/commonjs/capture/nativeImageModules.js +1 -30
- package/lib/commonjs/capture/nativeImageModules.web.js +1 -18
- package/lib/commonjs/capture/overrides.js +1 -346
- package/lib/commonjs/capture/rnDecoratorEarly.js +1 -55
- package/lib/commonjs/capture/savings.js +1 -209
- package/lib/commonjs/capture/savings.web.js +1 -71
- package/lib/commonjs/capture/shared.js +1 -378
- package/lib/commonjs/components/ImageDetail.js +1 -455
- package/lib/commonjs/components/ImageDetailFooter.js +1 -158
- package/lib/commonjs/components/ImageRow.js +1 -156
- package/lib/commonjs/components/ImagesHeader.js +1 -63
- package/lib/commonjs/components/ImagesIcon.js +1 -19
- package/lib/commonjs/components/ImagesListFooter.js +1 -126
- package/lib/commonjs/components/ImagesModal.js +1 -240
- package/lib/commonjs/components/ImagesRoot.js +1 -24
- package/lib/commonjs/components/ImagesRoot.web.js +1 -13
- package/lib/commonjs/components/InsightsBar.js +1 -59
- package/lib/commonjs/export.js +1 -81
- package/lib/commonjs/format.js +1 -117
- package/lib/commonjs/hooks/useImageRecords.js +1 -20
- package/lib/commonjs/index.js +1 -261
- package/lib/commonjs/preset.js +1 -39
- package/lib/commonjs/register.js +1 -19
- package/lib/commonjs/registerEarly.js +1 -14
- package/lib/commonjs/remote.js +1 -42
- package/lib/commonjs/state.js +1 -58
- package/lib/commonjs/store/imageEventStore.js +1 -238
- package/lib/commonjs/store/insights.js +1 -76
- package/lib/commonjs/sync/imagesSyncAdapter.js +1 -361
- package/lib/commonjs/types.js +0 -1
- package/lib/module/autoCapture.js +1 -4
- package/lib/module/autoCapture.web.js +1 -5
- package/lib/module/capture/actions.js +1 -230
- package/lib/module/capture/install.js +1 -40
- package/lib/module/capture/install.web.js +1 -243
- package/lib/module/capture/installExpoImage.js +1 -94
- package/lib/module/capture/installRnImage.js +1 -125
- package/lib/module/capture/nativeImageModules.js +1 -24
- package/lib/module/capture/nativeImageModules.web.js +1 -12
- package/lib/module/capture/overrides.js +1 -329
- package/lib/module/capture/rnDecoratorEarly.js +1 -50
- package/lib/module/capture/savings.js +1 -205
- package/lib/module/capture/savings.web.js +1 -67
- package/lib/module/capture/shared.js +1 -369
- package/lib/module/components/ImageDetail.js +1 -451
- package/lib/module/components/ImageDetailFooter.js +1 -154
- package/lib/module/components/ImageRow.js +1 -152
- package/lib/module/components/ImagesHeader.js +1 -59
- package/lib/module/components/ImagesIcon.js +1 -12
- package/lib/module/components/ImagesListFooter.js +1 -122
- package/lib/module/components/ImagesModal.js +1 -235
- package/lib/module/components/ImagesRoot.js +1 -20
- package/lib/module/components/ImagesRoot.web.js +1 -9
- package/lib/module/components/InsightsBar.js +1 -55
- package/lib/module/export.js +1 -76
- package/lib/module/format.js +1 -108
- package/lib/module/hooks/useImageRecords.js +1 -16
- package/lib/module/index.js +1 -79
- package/lib/module/preset.js +1 -35
- package/lib/module/register.js +1 -19
- package/lib/module/registerEarly.js +1 -14
- package/lib/module/remote.js +1 -36
- package/lib/module/state.js +1 -54
- package/lib/module/store/imageEventStore.js +1 -221
- package/lib/module/store/insights.js +1 -71
- package/lib/module/sync/imagesSyncAdapter.js +1 -356
- package/lib/module/types.js +0 -1
- package/lib/web/chunks/chunk-TTS5EH4R.mjs +1 -2
- package/lib/web/index.mjs +3 -4
- package/lib/web/register.mjs +1 -2
- package/package.json +3 -7
- package/register.js +1 -15
- package/lib/commonjs/autoCapture.js.map +0 -1
- package/lib/commonjs/autoCapture.web.js.map +0 -1
- package/lib/commonjs/capture/actions.js.map +0 -1
- package/lib/commonjs/capture/install.js.map +0 -1
- package/lib/commonjs/capture/install.web.js.map +0 -1
- package/lib/commonjs/capture/installExpoImage.js.map +0 -1
- package/lib/commonjs/capture/installRnImage.js.map +0 -1
- package/lib/commonjs/capture/nativeImageModules.js.map +0 -1
- package/lib/commonjs/capture/nativeImageModules.web.js.map +0 -1
- package/lib/commonjs/capture/overrides.js.map +0 -1
- package/lib/commonjs/capture/rnDecoratorEarly.js.map +0 -1
- package/lib/commonjs/capture/savings.js.map +0 -1
- package/lib/commonjs/capture/savings.web.js.map +0 -1
- package/lib/commonjs/capture/shared.js.map +0 -1
- package/lib/commonjs/components/ImageDetail.js.map +0 -1
- package/lib/commonjs/components/ImageDetailFooter.js.map +0 -1
- package/lib/commonjs/components/ImageRow.js.map +0 -1
- package/lib/commonjs/components/ImagesHeader.js.map +0 -1
- package/lib/commonjs/components/ImagesIcon.js.map +0 -1
- package/lib/commonjs/components/ImagesListFooter.js.map +0 -1
- package/lib/commonjs/components/ImagesModal.js.map +0 -1
- package/lib/commonjs/components/ImagesRoot.js.map +0 -1
- package/lib/commonjs/components/ImagesRoot.web.js.map +0 -1
- package/lib/commonjs/components/InsightsBar.js.map +0 -1
- package/lib/commonjs/export.js.map +0 -1
- package/lib/commonjs/format.js.map +0 -1
- package/lib/commonjs/hooks/useImageRecords.js.map +0 -1
- package/lib/commonjs/index.js.map +0 -1
- package/lib/commonjs/preset.js.map +0 -1
- package/lib/commonjs/register.js.map +0 -1
- package/lib/commonjs/registerEarly.js.map +0 -1
- package/lib/commonjs/remote.js.map +0 -1
- package/lib/commonjs/state.js.map +0 -1
- package/lib/commonjs/store/imageEventStore.js.map +0 -1
- package/lib/commonjs/store/insights.js.map +0 -1
- package/lib/commonjs/sync/imagesSyncAdapter.js.map +0 -1
- package/lib/commonjs/types.js.map +0 -1
- package/lib/module/autoCapture.js.map +0 -1
- package/lib/module/autoCapture.web.js.map +0 -1
- package/lib/module/capture/actions.js.map +0 -1
- package/lib/module/capture/install.js.map +0 -1
- package/lib/module/capture/install.web.js.map +0 -1
- package/lib/module/capture/installExpoImage.js.map +0 -1
- package/lib/module/capture/installRnImage.js.map +0 -1
- package/lib/module/capture/nativeImageModules.js.map +0 -1
- package/lib/module/capture/nativeImageModules.web.js.map +0 -1
- package/lib/module/capture/overrides.js.map +0 -1
- package/lib/module/capture/rnDecoratorEarly.js.map +0 -1
- package/lib/module/capture/savings.js.map +0 -1
- package/lib/module/capture/savings.web.js.map +0 -1
- package/lib/module/capture/shared.js.map +0 -1
- package/lib/module/components/ImageDetail.js.map +0 -1
- package/lib/module/components/ImageDetailFooter.js.map +0 -1
- package/lib/module/components/ImageRow.js.map +0 -1
- package/lib/module/components/ImagesHeader.js.map +0 -1
- package/lib/module/components/ImagesIcon.js.map +0 -1
- package/lib/module/components/ImagesListFooter.js.map +0 -1
- package/lib/module/components/ImagesModal.js.map +0 -1
- package/lib/module/components/ImagesRoot.js.map +0 -1
- package/lib/module/components/ImagesRoot.web.js.map +0 -1
- package/lib/module/components/InsightsBar.js.map +0 -1
- package/lib/module/export.js.map +0 -1
- package/lib/module/format.js.map +0 -1
- package/lib/module/hooks/useImageRecords.js.map +0 -1
- package/lib/module/index.js.map +0 -1
- package/lib/module/preset.js.map +0 -1
- package/lib/module/register.js.map +0 -1
- package/lib/module/registerEarly.js.map +0 -1
- package/lib/module/remote.js.map +0 -1
- package/lib/module/state.js.map +0 -1
- package/lib/module/store/imageEventStore.js.map +0 -1
- package/lib/module/store/insights.js.map +0 -1
- package/lib/module/sync/imagesSyncAdapter.js.map +0 -1
- package/lib/module/types.js.map +0 -1
- package/lib/typescript/autoCapture.d.ts.map +0 -1
- package/lib/typescript/autoCapture.web.d.ts.map +0 -1
- package/lib/typescript/capture/actions.d.ts.map +0 -1
- package/lib/typescript/capture/install.d.ts.map +0 -1
- package/lib/typescript/capture/install.web.d.ts.map +0 -1
- package/lib/typescript/capture/installExpoImage.d.ts.map +0 -1
- package/lib/typescript/capture/installRnImage.d.ts.map +0 -1
- package/lib/typescript/capture/nativeImageModules.d.ts.map +0 -1
- package/lib/typescript/capture/nativeImageModules.web.d.ts.map +0 -1
- package/lib/typescript/capture/overrides.d.ts.map +0 -1
- package/lib/typescript/capture/rnDecoratorEarly.d.ts.map +0 -1
- package/lib/typescript/capture/savings.d.ts.map +0 -1
- package/lib/typescript/capture/savings.web.d.ts.map +0 -1
- package/lib/typescript/capture/shared.d.ts.map +0 -1
- package/lib/typescript/components/ImageDetail.d.ts.map +0 -1
- package/lib/typescript/components/ImageDetailFooter.d.ts.map +0 -1
- package/lib/typescript/components/ImageRow.d.ts.map +0 -1
- package/lib/typescript/components/ImagesHeader.d.ts.map +0 -1
- package/lib/typescript/components/ImagesIcon.d.ts.map +0 -1
- package/lib/typescript/components/ImagesListFooter.d.ts.map +0 -1
- package/lib/typescript/components/ImagesModal.d.ts.map +0 -1
- package/lib/typescript/components/ImagesRoot.d.ts.map +0 -1
- package/lib/typescript/components/ImagesRoot.web.d.ts.map +0 -1
- package/lib/typescript/components/InsightsBar.d.ts.map +0 -1
- package/lib/typescript/export.d.ts.map +0 -1
- package/lib/typescript/format.d.ts.map +0 -1
- package/lib/typescript/hooks/useImageRecords.d.ts.map +0 -1
- package/lib/typescript/index.d.ts.map +0 -1
- package/lib/typescript/preset.d.ts.map +0 -1
- package/lib/typescript/register.d.ts.map +0 -1
- package/lib/typescript/registerEarly.d.ts.map +0 -1
- package/lib/typescript/remote.d.ts.map +0 -1
- package/lib/typescript/state.d.ts.map +0 -1
- package/lib/typescript/store/imageEventStore.d.ts.map +0 -1
- package/lib/typescript/store/insights.d.ts.map +0 -1
- package/lib/typescript/sync/imagesSyncAdapter.d.ts.map +0 -1
- package/lib/typescript/types.d.ts.map +0 -1
- package/lib/web/chunks/chunk-7CWLRQ2L.mjs +0 -2
- package/lib/web/chunks/chunk-B5A6CYSS.mjs +0 -2
- package/lib/web/chunks/chunk-LKTR6X2V.mjs +0 -2
|
@@ -1,455 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.ImageDetail = ImageDetail;
|
|
7
|
-
var _nativeImageModules = require("../capture/nativeImageModules");
|
|
8
|
-
var _react = require("react");
|
|
9
|
-
var _reactNative = require("react-native");
|
|
10
|
-
var _sharedUi = require("@buoy-gg/shared-ui");
|
|
11
|
-
var _overrides = require("../capture/overrides");
|
|
12
|
-
var _savings = require("../capture/savings");
|
|
13
|
-
var _remote = require("../remote");
|
|
14
|
-
var _imageEventStore = require("../store/imageEventStore");
|
|
15
|
-
var _format = require("../format");
|
|
16
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
17
|
-
/**
|
|
18
|
-
* ImageDetail — full record view: preview, source, load timeline, dimensions
|
|
19
|
-
* with the oversize verdict + estimated decoded/wasted memory, cache verdict,
|
|
20
|
-
* and error details (including HTTP status/headers when the platform provides
|
|
21
|
-
* them). Cache actions live here too (expo-image global clears).
|
|
22
|
-
*/
|
|
23
|
-
|
|
24
|
-
function Section({
|
|
25
|
-
title,
|
|
26
|
-
children
|
|
27
|
-
}) {
|
|
28
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
29
|
-
style: styles.section,
|
|
30
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
31
|
-
style: styles.sectionTitle,
|
|
32
|
-
children: title
|
|
33
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
34
|
-
style: styles.sectionBody,
|
|
35
|
-
children: children
|
|
36
|
-
})]
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
function Row({
|
|
40
|
-
label,
|
|
41
|
-
value,
|
|
42
|
-
color
|
|
43
|
-
}) {
|
|
44
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
45
|
-
style: styles.kvRow,
|
|
46
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
47
|
-
style: styles.kvLabel,
|
|
48
|
-
children: label
|
|
49
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
50
|
-
style: [styles.kvValue, color ? {
|
|
51
|
-
color
|
|
52
|
-
} : null],
|
|
53
|
-
selectable: true,
|
|
54
|
-
children: value
|
|
55
|
-
})]
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
/** expo-image global cache clears (no-ops if expo-image is absent). */
|
|
60
|
-
function clearExpoCache(kind) {
|
|
61
|
-
// Mirror mode: the caches live on the synced device.
|
|
62
|
-
const remote = (0, _remote.remoteImagesDispatch)();
|
|
63
|
-
if (remote) {
|
|
64
|
-
void remote("clearExpoCaches", {
|
|
65
|
-
memory: kind === "memory",
|
|
66
|
-
disk: kind === "disk"
|
|
67
|
-
});
|
|
68
|
-
return;
|
|
69
|
-
}
|
|
70
|
-
try {
|
|
71
|
-
const expo = (0, _nativeImageModules.loadExpoImage)();
|
|
72
|
-
if (kind === "memory") void expo.Image.clearMemoryCache();else void expo.Image.clearDiskCache();
|
|
73
|
-
} catch {
|
|
74
|
-
// expo-image not installed
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
/** Free-text source swap: test another URL/format/CDN param on the live view. */
|
|
79
|
-
function SwapUrlSection({
|
|
80
|
-
record
|
|
81
|
-
}) {
|
|
82
|
-
const [url, setUrl] = (0, _react.useState)(record.uri);
|
|
83
|
-
const trimmed = url.trim();
|
|
84
|
-
const canApply = record.mounted && trimmed.length > 0 && trimmed !== record.uri;
|
|
85
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(Section, {
|
|
86
|
-
title: "SWAP SOURCE URL",
|
|
87
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TextInput, {
|
|
88
|
-
style: styles.urlInput,
|
|
89
|
-
value: url,
|
|
90
|
-
onChangeText: setUrl,
|
|
91
|
-
placeholder: "https://\u2026",
|
|
92
|
-
placeholderTextColor: _sharedUi.night.color.placeholder,
|
|
93
|
-
autoCapitalize: "none",
|
|
94
|
-
autoCorrect: false,
|
|
95
|
-
multiline: true
|
|
96
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
97
|
-
style: styles.actionsRow,
|
|
98
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TouchableOpacity, {
|
|
99
|
-
style: [styles.actionButton, !canApply && styles.actionDisabled],
|
|
100
|
-
disabled: !canApply,
|
|
101
|
-
onPress: () => (0, _overrides.setOverride)(record.id, {
|
|
102
|
-
source: {
|
|
103
|
-
type: "url",
|
|
104
|
-
uri: trimmed
|
|
105
|
-
},
|
|
106
|
-
label: "URL swapped"
|
|
107
|
-
}),
|
|
108
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
109
|
-
style: styles.actionText,
|
|
110
|
-
children: "Apply"
|
|
111
|
-
})
|
|
112
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TouchableOpacity, {
|
|
113
|
-
style: styles.actionButton,
|
|
114
|
-
onPress: () => setUrl(record.uri),
|
|
115
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
116
|
-
style: styles.actionText,
|
|
117
|
-
children: "Reset field"
|
|
118
|
-
})
|
|
119
|
-
})]
|
|
120
|
-
})]
|
|
121
|
-
});
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
/**
|
|
125
|
-
* Real, on-device savings proof: re-encode at displayed size as WebP via
|
|
126
|
-
* expo-image-manipulator, report actual bytes, offer an in-place preview.
|
|
127
|
-
*/
|
|
128
|
-
function SavingsSection({
|
|
129
|
-
record
|
|
130
|
-
}) {
|
|
131
|
-
const [busy, setBusy] = (0, _react.useState)(false);
|
|
132
|
-
const [result, setResult] = (0, _react.useState)(null);
|
|
133
|
-
const run = () => {
|
|
134
|
-
setBusy(true);
|
|
135
|
-
(0, _savings.proveSavings)(record).then(setResult).catch(error => setResult({
|
|
136
|
-
ok: false,
|
|
137
|
-
message: String(error?.message ?? error)
|
|
138
|
-
})).finally(() => setBusy(false));
|
|
139
|
-
};
|
|
140
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Section, {
|
|
141
|
-
title: "PROVE SAVINGS (re-encode on device)",
|
|
142
|
-
children: result == null ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
143
|
-
style: styles.actionsRow,
|
|
144
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TouchableOpacity, {
|
|
145
|
-
style: styles.actionButton,
|
|
146
|
-
onPress: run,
|
|
147
|
-
disabled: busy,
|
|
148
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
149
|
-
style: styles.actionText,
|
|
150
|
-
children: busy ? "Re-encoding…" : "Re-encode at displayed size (WebP)"
|
|
151
|
-
})
|
|
152
|
-
})
|
|
153
|
-
}) : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
154
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(Row, {
|
|
155
|
-
label: "Result",
|
|
156
|
-
value: result.message || (result.ok ? "done" : "failed"),
|
|
157
|
-
color: result.ok ? _sharedUi.macOSColors.semantic.success : _sharedUi.macOSColors.semantic.error
|
|
158
|
-
}), result.originalBytes != null ? /*#__PURE__*/(0, _jsxRuntime.jsx)(Row, {
|
|
159
|
-
label: "Original",
|
|
160
|
-
value: `${(0, _format.formatBytes)(result.originalBytes)} (${result.originalBytesSource})`
|
|
161
|
-
}) : null, result.optimizedBytes != null ? /*#__PURE__*/(0, _jsxRuntime.jsx)(Row, {
|
|
162
|
-
label: "Optimized",
|
|
163
|
-
value: `${(0, _format.formatBytes)(result.optimizedBytes)} — ${result.optimizedDims?.width}×${result.optimizedDims?.height} WebP`,
|
|
164
|
-
color: _sharedUi.macOSColors.semantic.success
|
|
165
|
-
}) : null, result.savedBytes != null ? /*#__PURE__*/(0, _jsxRuntime.jsx)(Row, {
|
|
166
|
-
label: "Saved",
|
|
167
|
-
value: `${(0, _format.formatBytes)(result.savedBytes)} (${result.savedPct}%)`,
|
|
168
|
-
color: _sharedUi.macOSColors.semantic.success
|
|
169
|
-
}) : null, /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
170
|
-
style: styles.actionsRow,
|
|
171
|
-
children: [result.ok && result.optimizedUri && record.mounted ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TouchableOpacity, {
|
|
172
|
-
style: styles.actionButton,
|
|
173
|
-
onPress: () => (0, _overrides.setOverride)(record.id, {
|
|
174
|
-
source: {
|
|
175
|
-
type: "url",
|
|
176
|
-
uri: result.optimizedUri
|
|
177
|
-
},
|
|
178
|
-
label: "Optimized preview"
|
|
179
|
-
}),
|
|
180
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
181
|
-
style: styles.actionText,
|
|
182
|
-
children: "Preview in place"
|
|
183
|
-
})
|
|
184
|
-
}) : null, /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TouchableOpacity, {
|
|
185
|
-
style: styles.actionButton,
|
|
186
|
-
onPress: run,
|
|
187
|
-
disabled: busy,
|
|
188
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
189
|
-
style: styles.actionText,
|
|
190
|
-
children: busy ? "Re-encoding…" : "Re-run"
|
|
191
|
-
})
|
|
192
|
-
})]
|
|
193
|
-
})]
|
|
194
|
-
})
|
|
195
|
-
});
|
|
196
|
-
}
|
|
197
|
-
function ImageDetail({
|
|
198
|
-
record
|
|
199
|
-
}) {
|
|
200
|
-
const verdict = (0, _format.sizeVerdict)(record);
|
|
201
|
-
const cache = (0, _format.cacheBadge)(record);
|
|
202
|
-
const needed = (0, _imageEventStore.neededPixels)(record);
|
|
203
|
-
const decoded = (0, _imageEventStore.estDecodedBytes)(record);
|
|
204
|
-
const wasted = (0, _imageEventStore.estWastedBytes)(record);
|
|
205
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.ScrollView, {
|
|
206
|
-
style: styles.container,
|
|
207
|
-
contentContainerStyle: styles.content,
|
|
208
|
-
children: [record.overrideLabel ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
209
|
-
style: styles.overrideBanner,
|
|
210
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Text, {
|
|
211
|
-
style: styles.overrideText,
|
|
212
|
-
children: ["Simulation active: ", record.overrideLabel, " \u2014 stats below describe the override, not the original source."]
|
|
213
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TouchableOpacity, {
|
|
214
|
-
onPress: () => (0, _overrides.clearOverride)(record.id),
|
|
215
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
216
|
-
style: styles.overrideRestore,
|
|
217
|
-
children: "RESTORE"
|
|
218
|
-
})
|
|
219
|
-
})]
|
|
220
|
-
}) : null, record.uri && record.sourceKind !== "data" ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
221
|
-
style: styles.previewBox,
|
|
222
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Image, {
|
|
223
|
-
testID: "buoy-internal-images-preview",
|
|
224
|
-
source: {
|
|
225
|
-
uri: record.uri
|
|
226
|
-
},
|
|
227
|
-
style: styles.preview,
|
|
228
|
-
resizeMode: "contain"
|
|
229
|
-
})
|
|
230
|
-
}) : null, /*#__PURE__*/(0, _jsxRuntime.jsxs)(Section, {
|
|
231
|
-
title: "SOURCE",
|
|
232
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(Row, {
|
|
233
|
-
label: "URI",
|
|
234
|
-
value: record.uri || "(none)"
|
|
235
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(Row, {
|
|
236
|
-
label: "Kind",
|
|
237
|
-
value: record.sourceKind
|
|
238
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(Row, {
|
|
239
|
-
label: "Library",
|
|
240
|
-
value: record.lib === "web" ? "Browser <img>" : record.lib === "expo" ? "expo-image" : "RN <Image>"
|
|
241
|
-
}), record.hasAltText === false ? /*#__PURE__*/(0, _jsxRuntime.jsx)(Row, {
|
|
242
|
-
label: "Alt text",
|
|
243
|
-
value: "missing \u2014 add alt/accessibilityLabel",
|
|
244
|
-
color: _sharedUi.macOSColors.semantic.warning
|
|
245
|
-
}) : null, record.mediaType != null ? /*#__PURE__*/(0, _jsxRuntime.jsx)(Row, {
|
|
246
|
-
label: "Media type",
|
|
247
|
-
value: String(record.mediaType)
|
|
248
|
-
}) : null, record.isAnimated != null ? /*#__PURE__*/(0, _jsxRuntime.jsx)(Row, {
|
|
249
|
-
label: "Animated",
|
|
250
|
-
value: record.isAnimated ? "yes" : "no"
|
|
251
|
-
}) : null]
|
|
252
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(Section, {
|
|
253
|
-
title: "LOAD",
|
|
254
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(Row, {
|
|
255
|
-
label: "Status",
|
|
256
|
-
value: record.status,
|
|
257
|
-
color: record.status === "error" ? _sharedUi.macOSColors.semantic.error : record.status === "loaded" ? _sharedUi.macOSColors.semantic.success : _sharedUi.macOSColors.semantic.warning
|
|
258
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(Row, {
|
|
259
|
-
label: "Duration",
|
|
260
|
-
value: (0, _format.formatMs)(record.durationMs)
|
|
261
|
-
}), record.displayedAt && record.loadedAt ? /*#__PURE__*/(0, _jsxRuntime.jsx)(Row, {
|
|
262
|
-
label: "Decode \u2192 display",
|
|
263
|
-
value: (0, _format.formatMs)(Math.max(0, record.displayedAt - record.loadedAt))
|
|
264
|
-
}) : null, /*#__PURE__*/(0, _jsxRuntime.jsx)(Row, {
|
|
265
|
-
label: "Cache",
|
|
266
|
-
value: `${cache.label}`,
|
|
267
|
-
color: cache.color
|
|
268
|
-
}), record.cacheVerdictSource ? /*#__PURE__*/(0, _jsxRuntime.jsx)(Row, {
|
|
269
|
-
label: "Cache source",
|
|
270
|
-
value: record.cacheVerdictSource === "event" ? "reported by expo-image onLoad" : "Image.queryCache after load"
|
|
271
|
-
}) : null, record.progressSeen ? /*#__PURE__*/(0, _jsxRuntime.jsx)(Row, {
|
|
272
|
-
label: "Downloaded",
|
|
273
|
-
value: record.bytesTotal ? `${(0, _format.formatBytes)(record.bytesLoaded ?? 0)} / ${(0, _format.formatBytes)(record.bytesTotal)}` : "network transfer observed"
|
|
274
|
-
}) : null, /*#__PURE__*/(0, _jsxRuntime.jsx)(Row, {
|
|
275
|
-
label: "Load cycles",
|
|
276
|
-
value: String(record.loadCount)
|
|
277
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(Row, {
|
|
278
|
-
label: "Still mounted",
|
|
279
|
-
value: record.mounted ? "yes" : "no"
|
|
280
|
-
})]
|
|
281
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(Section, {
|
|
282
|
-
title: "DIMENSIONS",
|
|
283
|
-
children: [record.intrinsic ? /*#__PURE__*/(0, _jsxRuntime.jsx)(Row, {
|
|
284
|
-
label: "Decoded",
|
|
285
|
-
value: `${record.intrinsic.width}×${record.intrinsic.height} px`
|
|
286
|
-
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(Row, {
|
|
287
|
-
label: "Decoded",
|
|
288
|
-
value: "unknown"
|
|
289
|
-
}), record.layout ? /*#__PURE__*/(0, _jsxRuntime.jsx)(Row, {
|
|
290
|
-
label: "Displayed",
|
|
291
|
-
value: `${Math.round(record.layout.width)}×${Math.round(record.layout.height)} dp (needs ${needed ? `${needed.width}×${needed.height}` : "?"} px @${Math.round((0, _imageEventStore.effectivePixelRatio)() * 100) / 100}x)`
|
|
292
|
-
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(Row, {
|
|
293
|
-
label: "Displayed",
|
|
294
|
-
value: "no layout yet"
|
|
295
|
-
}), verdict.label ? /*#__PURE__*/(0, _jsxRuntime.jsx)(Row, {
|
|
296
|
-
label: "Verdict",
|
|
297
|
-
value: verdict.label,
|
|
298
|
-
color: verdict.color
|
|
299
|
-
}) : null, decoded > 0 ? /*#__PURE__*/(0, _jsxRuntime.jsx)(Row, {
|
|
300
|
-
label: "Est. decoded memory",
|
|
301
|
-
value: (0, _format.formatBytes)(decoded)
|
|
302
|
-
}) : null, wasted > 0 ? /*#__PURE__*/(0, _jsxRuntime.jsx)(Row, {
|
|
303
|
-
label: "Est. wasted",
|
|
304
|
-
value: `${(0, _format.formatBytes)(wasted)} — resize the source to ${needed ? `${needed.width}×${needed.height}` : "the displayed size"}`,
|
|
305
|
-
color: _sharedUi.macOSColors.semantic.warning
|
|
306
|
-
}) : null, (record.layoutShifts ?? 0) > 0 ? /*#__PURE__*/(0, _jsxRuntime.jsx)(Row, {
|
|
307
|
-
label: "Layout shifts",
|
|
308
|
-
value: `${record.layoutShifts} — box resized after load; reserve explicit width/height`,
|
|
309
|
-
color: _sharedUi.macOSColors.semantic.warning
|
|
310
|
-
}) : null]
|
|
311
|
-
}), record.sourceKind === "network" || record.sourceKind === "asset" ? /*#__PURE__*/(0, _jsxRuntime.jsx)(SavingsSection, {
|
|
312
|
-
record: record
|
|
313
|
-
}, `savings-${record.id}`) : null, record.status === "error" ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(Section, {
|
|
314
|
-
title: "ERROR",
|
|
315
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(Row, {
|
|
316
|
-
label: "Message",
|
|
317
|
-
value: record.error ?? "unknown",
|
|
318
|
-
color: _sharedUi.macOSColors.semantic.error
|
|
319
|
-
}), record.errorCode != null ? /*#__PURE__*/(0, _jsxRuntime.jsx)(Row, {
|
|
320
|
-
label: "HTTP status",
|
|
321
|
-
value: String(record.errorCode)
|
|
322
|
-
}) : null, record.errorHeaders ? Object.entries(record.errorHeaders).map(([k, v]) => /*#__PURE__*/(0, _jsxRuntime.jsx)(Row, {
|
|
323
|
-
label: k,
|
|
324
|
-
value: String(v)
|
|
325
|
-
}, k)) : null]
|
|
326
|
-
}) : null, record.sourceKind === "network" && record.mounted ? /*#__PURE__*/(0, _jsxRuntime.jsx)(SwapUrlSection, {
|
|
327
|
-
record: record
|
|
328
|
-
}, record.id) : null, record.lib === "expo" ? /*#__PURE__*/(0, _jsxRuntime.jsx)(Section, {
|
|
329
|
-
title: "CACHE ACTIONS (expo-image, global)",
|
|
330
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
331
|
-
style: styles.actionsRow,
|
|
332
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TouchableOpacity, {
|
|
333
|
-
style: styles.actionButton,
|
|
334
|
-
onPress: () => clearExpoCache("memory"),
|
|
335
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
336
|
-
style: styles.actionText,
|
|
337
|
-
children: "Clear memory cache"
|
|
338
|
-
})
|
|
339
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TouchableOpacity, {
|
|
340
|
-
style: styles.actionButton,
|
|
341
|
-
onPress: () => clearExpoCache("disk"),
|
|
342
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
343
|
-
style: styles.actionText,
|
|
344
|
-
children: "Clear disk cache"
|
|
345
|
-
})
|
|
346
|
-
})]
|
|
347
|
-
})
|
|
348
|
-
}) : null]
|
|
349
|
-
});
|
|
350
|
-
}
|
|
351
|
-
const styles = _reactNative.StyleSheet.create({
|
|
352
|
-
container: {
|
|
353
|
-
flex: 1
|
|
354
|
-
},
|
|
355
|
-
content: {
|
|
356
|
-
padding: 12,
|
|
357
|
-
gap: 12
|
|
358
|
-
},
|
|
359
|
-
previewBox: {
|
|
360
|
-
height: 140,
|
|
361
|
-
borderRadius: 8,
|
|
362
|
-
backgroundColor: _sharedUi.night.color.bg,
|
|
363
|
-
overflow: "hidden"
|
|
364
|
-
},
|
|
365
|
-
preview: {
|
|
366
|
-
width: "100%",
|
|
367
|
-
height: "100%"
|
|
368
|
-
},
|
|
369
|
-
section: {
|
|
370
|
-
gap: 6
|
|
371
|
-
},
|
|
372
|
-
sectionTitle: {
|
|
373
|
-
color: _sharedUi.night.color.textTertiary,
|
|
374
|
-
fontSize: 10,
|
|
375
|
-
fontWeight: "700",
|
|
376
|
-
letterSpacing: 0.8
|
|
377
|
-
},
|
|
378
|
-
sectionBody: {
|
|
379
|
-
backgroundColor: _sharedUi.night.color.surface,
|
|
380
|
-
borderRadius: 8,
|
|
381
|
-
borderWidth: _reactNative.StyleSheet.hairlineWidth,
|
|
382
|
-
borderColor: _sharedUi.night.color.border,
|
|
383
|
-
paddingHorizontal: 10,
|
|
384
|
-
paddingVertical: 4
|
|
385
|
-
},
|
|
386
|
-
kvRow: {
|
|
387
|
-
flexDirection: "row",
|
|
388
|
-
paddingVertical: 5,
|
|
389
|
-
gap: 12
|
|
390
|
-
},
|
|
391
|
-
kvLabel: {
|
|
392
|
-
color: _sharedUi.night.color.textSecondary,
|
|
393
|
-
fontSize: 11,
|
|
394
|
-
width: 110
|
|
395
|
-
},
|
|
396
|
-
kvValue: {
|
|
397
|
-
color: _sharedUi.night.color.text,
|
|
398
|
-
fontSize: 11,
|
|
399
|
-
flex: 1
|
|
400
|
-
},
|
|
401
|
-
actionsRow: {
|
|
402
|
-
flexDirection: "row",
|
|
403
|
-
gap: 8,
|
|
404
|
-
paddingVertical: 8
|
|
405
|
-
},
|
|
406
|
-
actionButton: {
|
|
407
|
-
backgroundColor: _sharedUi.night.color.surfaceElevated,
|
|
408
|
-
borderRadius: 6,
|
|
409
|
-
paddingHorizontal: 10,
|
|
410
|
-
paddingVertical: 6,
|
|
411
|
-
borderWidth: _reactNative.StyleSheet.hairlineWidth,
|
|
412
|
-
borderColor: _sharedUi.night.color.border
|
|
413
|
-
},
|
|
414
|
-
actionText: {
|
|
415
|
-
color: _sharedUi.night.color.text,
|
|
416
|
-
fontSize: 11,
|
|
417
|
-
fontWeight: "600"
|
|
418
|
-
},
|
|
419
|
-
actionDisabled: {
|
|
420
|
-
opacity: 0.4
|
|
421
|
-
},
|
|
422
|
-
urlInput: {
|
|
423
|
-
color: _sharedUi.night.color.text,
|
|
424
|
-
fontSize: 11,
|
|
425
|
-
fontFamily: _sharedUi.monoFont,
|
|
426
|
-
backgroundColor: _sharedUi.night.color.surfaceElevated,
|
|
427
|
-
borderRadius: 6,
|
|
428
|
-
borderWidth: _reactNative.StyleSheet.hairlineWidth,
|
|
429
|
-
borderColor: _sharedUi.night.color.border,
|
|
430
|
-
paddingHorizontal: 8,
|
|
431
|
-
paddingVertical: 6,
|
|
432
|
-
marginTop: 8
|
|
433
|
-
},
|
|
434
|
-
overrideBanner: {
|
|
435
|
-
flexDirection: "row",
|
|
436
|
-
alignItems: "center",
|
|
437
|
-
gap: 10,
|
|
438
|
-
padding: 10,
|
|
439
|
-
borderRadius: 8,
|
|
440
|
-
backgroundColor: _sharedUi.night.color.warningSoft
|
|
441
|
-
},
|
|
442
|
-
overrideText: {
|
|
443
|
-
flex: 1,
|
|
444
|
-
color: _sharedUi.night.color.warning,
|
|
445
|
-
fontSize: 11,
|
|
446
|
-
lineHeight: 15
|
|
447
|
-
},
|
|
448
|
-
overrideRestore: {
|
|
449
|
-
color: _sharedUi.night.color.warning,
|
|
450
|
-
fontSize: 11,
|
|
451
|
-
fontWeight: "700",
|
|
452
|
-
letterSpacing: 0.5
|
|
453
|
-
}
|
|
454
|
-
});
|
|
455
|
-
//# sourceMappingURL=ImageDetail.js.map
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.ImageDetail=ImageDetail;var _nativeImageModules=require("../capture/nativeImageModules");var _react=require("react");var _reactNative=require("react-native");var _sharedUi=require("@buoy-gg/shared-ui");var _overrides=require("../capture/overrides");var _savings=require("../capture/savings");var _remote=require("../remote");var _imageEventStore=require("../store/imageEventStore");var _format=require("../format");var _jsxRuntime=require("react/jsx-runtime");function Section({title:e,children:l}){return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.section,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.sectionTitle,children:e}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.sectionBody,children:l})]})}function Row({label:e,value:l,color:i}){return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.kvRow,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.kvLabel,children:e}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.kvValue,i?{color:i}:null],selectable:true,children:l})]})}function clearExpoCache(e){const l=(0,_remote.remoteImagesDispatch)();if(l){void l("clearExpoCaches",{memory:e==="memory",disk:e==="disk"});return}try{const i=(0,_nativeImageModules.loadExpoImage)();if(e==="memory")void i.Image.clearMemoryCache();else void i.Image.clearDiskCache()}catch{}}function SwapUrlSection({record:e}){const[l,i]=(0,_react.useState)(e.uri);const t=l.trim();const a=e.mounted&&t.length>0&&t!==e.uri;return(0,_jsxRuntime.jsxs)(Section,{title:"SWAP SOURCE URL",children:[(0,_jsxRuntime.jsx)(_reactNative.TextInput,{style:styles.urlInput,value:l,onChangeText:i,placeholder:"https://\u2026",placeholderTextColor:_sharedUi.night.color.placeholder,autoCapitalize:"none",autoCorrect:false,multiline:true}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.actionsRow,children:[(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{style:[styles.actionButton,!a&&styles.actionDisabled],disabled:!a,onPress:()=>(0,_overrides.setOverride)(e.id,{source:{type:"url",uri:t},label:"URL swapped"}),children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.actionText,children:"Apply"})}),(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{style:styles.actionButton,onPress:()=>i(e.uri),children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.actionText,children:"Reset field"})})]})]})}function SavingsSection({record:e}){const[l,i]=(0,_react.useState)(false);const[t,a]=(0,_react.useState)(null);const s=()=>{i(true);(0,_savings.proveSavings)(e).then(a).catch(o=>a({ok:false,message:String(o?.message??o)})).finally(()=>i(false))};return(0,_jsxRuntime.jsx)(Section,{title:"PROVE SAVINGS (re-encode on device)",children:t==null?(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.actionsRow,children:(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{style:styles.actionButton,onPress:s,disabled:l,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.actionText,children:l?"Re-encoding\u2026":"Re-encode at displayed size (WebP)"})})}):(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[(0,_jsxRuntime.jsx)(Row,{label:"Result",value:t.message||(t.ok?"done":"failed"),color:t.ok?_sharedUi.macOSColors.semantic.success:_sharedUi.macOSColors.semantic.error}),t.originalBytes!=null?(0,_jsxRuntime.jsx)(Row,{label:"Original",value:`${(0,_format.formatBytes)(t.originalBytes)} (${t.originalBytesSource})`}):null,t.optimizedBytes!=null?(0,_jsxRuntime.jsx)(Row,{label:"Optimized",value:`${(0,_format.formatBytes)(t.optimizedBytes)} \u2014 ${t.optimizedDims?.width}\xD7${t.optimizedDims?.height} WebP`,color:_sharedUi.macOSColors.semantic.success}):null,t.savedBytes!=null?(0,_jsxRuntime.jsx)(Row,{label:"Saved",value:`${(0,_format.formatBytes)(t.savedBytes)} (${t.savedPct}%)`,color:_sharedUi.macOSColors.semantic.success}):null,(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.actionsRow,children:[t.ok&&t.optimizedUri&&e.mounted?(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{style:styles.actionButton,onPress:()=>(0,_overrides.setOverride)(e.id,{source:{type:"url",uri:t.optimizedUri},label:"Optimized preview"}),children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.actionText,children:"Preview in place"})}):null,(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{style:styles.actionButton,onPress:s,disabled:l,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.actionText,children:l?"Re-encoding\u2026":"Re-run"})})]})]})})}function ImageDetail({record:e}){const l=(0,_format.sizeVerdict)(e);const i=(0,_format.cacheBadge)(e);const t=(0,_imageEventStore.neededPixels)(e);const a=(0,_imageEventStore.estDecodedBytes)(e);const s=(0,_imageEventStore.estWastedBytes)(e);return(0,_jsxRuntime.jsxs)(_reactNative.ScrollView,{style:styles.container,contentContainerStyle:styles.content,children:[e.overrideLabel?(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.overrideBanner,children:[(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:styles.overrideText,children:["Simulation active: ",e.overrideLabel," \u2014 stats below describe the override, not the original source."]}),(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{onPress:()=>(0,_overrides.clearOverride)(e.id),children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.overrideRestore,children:"RESTORE"})})]}):null,e.uri&&e.sourceKind!=="data"?(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.previewBox,children:(0,_jsxRuntime.jsx)(_reactNative.Image,{testID:"buoy-internal-images-preview",source:{uri:e.uri},style:styles.preview,resizeMode:"contain"})}):null,(0,_jsxRuntime.jsxs)(Section,{title:"SOURCE",children:[(0,_jsxRuntime.jsx)(Row,{label:"URI",value:e.uri||"(none)"}),(0,_jsxRuntime.jsx)(Row,{label:"Kind",value:e.sourceKind}),(0,_jsxRuntime.jsx)(Row,{label:"Library",value:e.lib==="web"?"Browser <img>":e.lib==="expo"?"expo-image":"RN <Image>"}),e.hasAltText===false?(0,_jsxRuntime.jsx)(Row,{label:"Alt text",value:"missing \u2014 add alt/accessibilityLabel",color:_sharedUi.macOSColors.semantic.warning}):null,e.mediaType!=null?(0,_jsxRuntime.jsx)(Row,{label:"Media type",value:String(e.mediaType)}):null,e.isAnimated!=null?(0,_jsxRuntime.jsx)(Row,{label:"Animated",value:e.isAnimated?"yes":"no"}):null]}),(0,_jsxRuntime.jsxs)(Section,{title:"LOAD",children:[(0,_jsxRuntime.jsx)(Row,{label:"Status",value:e.status,color:e.status==="error"?_sharedUi.macOSColors.semantic.error:e.status==="loaded"?_sharedUi.macOSColors.semantic.success:_sharedUi.macOSColors.semantic.warning}),(0,_jsxRuntime.jsx)(Row,{label:"Duration",value:(0,_format.formatMs)(e.durationMs)}),e.displayedAt&&e.loadedAt?(0,_jsxRuntime.jsx)(Row,{label:"Decode \u2192 display",value:(0,_format.formatMs)(Math.max(0,e.displayedAt-e.loadedAt))}):null,(0,_jsxRuntime.jsx)(Row,{label:"Cache",value:`${i.label}`,color:i.color}),e.cacheVerdictSource?(0,_jsxRuntime.jsx)(Row,{label:"Cache source",value:e.cacheVerdictSource==="event"?"reported by expo-image onLoad":"Image.queryCache after load"}):null,e.progressSeen?(0,_jsxRuntime.jsx)(Row,{label:"Downloaded",value:e.bytesTotal?`${(0,_format.formatBytes)(e.bytesLoaded??0)} / ${(0,_format.formatBytes)(e.bytesTotal)}`:"network transfer observed"}):null,(0,_jsxRuntime.jsx)(Row,{label:"Load cycles",value:String(e.loadCount)}),(0,_jsxRuntime.jsx)(Row,{label:"Still mounted",value:e.mounted?"yes":"no"})]}),(0,_jsxRuntime.jsxs)(Section,{title:"DIMENSIONS",children:[e.intrinsic?(0,_jsxRuntime.jsx)(Row,{label:"Decoded",value:`${e.intrinsic.width}\xD7${e.intrinsic.height} px`}):(0,_jsxRuntime.jsx)(Row,{label:"Decoded",value:"unknown"}),e.layout?(0,_jsxRuntime.jsx)(Row,{label:"Displayed",value:`${Math.round(e.layout.width)}\xD7${Math.round(e.layout.height)} dp (needs ${t?`${t.width}\xD7${t.height}`:"?"} px @${Math.round((0,_imageEventStore.effectivePixelRatio)()*100)/100}x)`}):(0,_jsxRuntime.jsx)(Row,{label:"Displayed",value:"no layout yet"}),l.label?(0,_jsxRuntime.jsx)(Row,{label:"Verdict",value:l.label,color:l.color}):null,a>0?(0,_jsxRuntime.jsx)(Row,{label:"Est. decoded memory",value:(0,_format.formatBytes)(a)}):null,s>0?(0,_jsxRuntime.jsx)(Row,{label:"Est. wasted",value:`${(0,_format.formatBytes)(s)} \u2014 resize the source to ${t?`${t.width}\xD7${t.height}`:"the displayed size"}`,color:_sharedUi.macOSColors.semantic.warning}):null,(e.layoutShifts??0)>0?(0,_jsxRuntime.jsx)(Row,{label:"Layout shifts",value:`${e.layoutShifts} \u2014 box resized after load; reserve explicit width/height`,color:_sharedUi.macOSColors.semantic.warning}):null]}),e.sourceKind==="network"||e.sourceKind==="asset"?(0,_jsxRuntime.jsx)(SavingsSection,{record:e},`savings-${e.id}`):null,e.status==="error"?(0,_jsxRuntime.jsxs)(Section,{title:"ERROR",children:[(0,_jsxRuntime.jsx)(Row,{label:"Message",value:e.error??"unknown",color:_sharedUi.macOSColors.semantic.error}),e.errorCode!=null?(0,_jsxRuntime.jsx)(Row,{label:"HTTP status",value:String(e.errorCode)}):null,e.errorHeaders?Object.entries(e.errorHeaders).map(([o,n])=>(0,_jsxRuntime.jsx)(Row,{label:o,value:String(n)},o)):null]}):null,e.sourceKind==="network"&&e.mounted?(0,_jsxRuntime.jsx)(SwapUrlSection,{record:e},e.id):null,e.lib==="expo"?(0,_jsxRuntime.jsx)(Section,{title:"CACHE ACTIONS (expo-image, global)",children:(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.actionsRow,children:[(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{style:styles.actionButton,onPress:()=>clearExpoCache("memory"),children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.actionText,children:"Clear memory cache"})}),(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{style:styles.actionButton,onPress:()=>clearExpoCache("disk"),children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.actionText,children:"Clear disk cache"})})]})}):null]})}const styles=_reactNative.StyleSheet.create({container:{flex:1},content:{padding:12,gap:12},previewBox:{height:140,borderRadius:8,backgroundColor:_sharedUi.night.color.bg,overflow:"hidden"},preview:{width:"100%",height:"100%"},section:{gap:6},sectionTitle:{color:_sharedUi.night.color.textTertiary,fontSize:10,fontWeight:"700",letterSpacing:.8},sectionBody:{backgroundColor:_sharedUi.night.color.surface,borderRadius:8,borderWidth:_reactNative.StyleSheet.hairlineWidth,borderColor:_sharedUi.night.color.border,paddingHorizontal:10,paddingVertical:4},kvRow:{flexDirection:"row",paddingVertical:5,gap:12},kvLabel:{color:_sharedUi.night.color.textSecondary,fontSize:11,width:110},kvValue:{color:_sharedUi.night.color.text,fontSize:11,flex:1},actionsRow:{flexDirection:"row",gap:8,paddingVertical:8},actionButton:{backgroundColor:_sharedUi.night.color.surfaceElevated,borderRadius:6,paddingHorizontal:10,paddingVertical:6,borderWidth:_reactNative.StyleSheet.hairlineWidth,borderColor:_sharedUi.night.color.border},actionText:{color:_sharedUi.night.color.text,fontSize:11,fontWeight:"600"},actionDisabled:{opacity:.4},urlInput:{color:_sharedUi.night.color.text,fontSize:11,fontFamily:_sharedUi.monoFont,backgroundColor:_sharedUi.night.color.surfaceElevated,borderRadius:6,borderWidth:_reactNative.StyleSheet.hairlineWidth,borderColor:_sharedUi.night.color.border,paddingHorizontal:8,paddingVertical:6,marginTop:8},overrideBanner:{flexDirection:"row",alignItems:"center",gap:10,padding:10,borderRadius:8,backgroundColor:_sharedUi.night.color.warningSoft},overrideText:{flex:1,color:_sharedUi.night.color.warning,fontSize:11,lineHeight:15},overrideRestore:{color:_sharedUi.night.color.warning,fontSize:11,fontWeight:"700",letterSpacing:.5}});
|
|
@@ -1,158 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.ImageDetailFooter = ImageDetailFooter;
|
|
7
|
-
var _react = require("react");
|
|
8
|
-
var _reactNative = require("react-native");
|
|
9
|
-
var _sharedUi = require("@buoy-gg/shared-ui");
|
|
10
|
-
var _actions = require("../capture/actions");
|
|
11
|
-
var _overrides = require("../capture/overrides");
|
|
12
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
|
-
/**
|
|
14
|
-
* ImageDetailFooter — bottom navbar for the detail view: previous/next
|
|
15
|
-
* stepping through the captured list at the edges, per-image actions in the
|
|
16
|
-
* middle (hard reload / retry), with inline action feedback. Styling matches
|
|
17
|
-
* shared-ui's EventStepperFooter so it reads like the rest of Buoy.
|
|
18
|
-
*
|
|
19
|
-
* Mount with key={record.id} so action feedback resets when stepping.
|
|
20
|
-
*/
|
|
21
|
-
|
|
22
|
-
function ImageDetailFooter({
|
|
23
|
-
record,
|
|
24
|
-
hasPrevious,
|
|
25
|
-
hasNext,
|
|
26
|
-
onPrevious,
|
|
27
|
-
onNext
|
|
28
|
-
}) {
|
|
29
|
-
const [message, setMessage] = (0, _react.useState)(null);
|
|
30
|
-
const runAction = action => {
|
|
31
|
-
setMessage("…");
|
|
32
|
-
action().then(result => setMessage(result.message)).catch(error => setMessage(String(error?.message ?? error)));
|
|
33
|
-
};
|
|
34
|
-
const actionsDisabled = !record.mounted;
|
|
35
|
-
const overrideActive = record.overrideLabel != null;
|
|
36
|
-
const simulate = (source, label) => {
|
|
37
|
-
(0, _overrides.setOverride)(record.id, {
|
|
38
|
-
source,
|
|
39
|
-
label
|
|
40
|
-
});
|
|
41
|
-
setMessage(`${label} — Restore to undo`);
|
|
42
|
-
};
|
|
43
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_sharedUi.ToolFooter, {
|
|
44
|
-
children: [message ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.FooterMessage, {
|
|
45
|
-
children: message
|
|
46
|
-
}) : actionsDisabled ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.FooterMessage, {
|
|
47
|
-
tone: "muted",
|
|
48
|
-
children: "Instance unmounted \u2014 reload actions need the image on screen."
|
|
49
|
-
}) : null, /*#__PURE__*/(0, _jsxRuntime.jsxs)(_sharedUi.FooterRow, {
|
|
50
|
-
style: {
|
|
51
|
-
gap: 8
|
|
52
|
-
},
|
|
53
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TouchableOpacity, {
|
|
54
|
-
onPress: onPrevious,
|
|
55
|
-
disabled: !hasPrevious,
|
|
56
|
-
style: [styles.navButton, !hasPrevious && styles.disabled],
|
|
57
|
-
activeOpacity: 0.7,
|
|
58
|
-
accessibilityLabel: "Previous image",
|
|
59
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.ChevronLeft, {
|
|
60
|
-
size: 20,
|
|
61
|
-
color: hasPrevious ? _sharedUi.night.color.accent : _sharedUi.night.color.textTertiary
|
|
62
|
-
})
|
|
63
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.FooterButton, {
|
|
64
|
-
label: "Hard reload",
|
|
65
|
-
size: "md",
|
|
66
|
-
disabled: actionsDisabled,
|
|
67
|
-
icon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.RefreshCw, {
|
|
68
|
-
size: 13,
|
|
69
|
-
color: actionsDisabled ? _sharedUi.night.color.textTertiary : _sharedUi.night.color.info
|
|
70
|
-
}),
|
|
71
|
-
onPress: () => runAction(() => (0, _actions.hardReloadRecord)(record))
|
|
72
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.FooterButton, {
|
|
73
|
-
label: record.status === "error" ? "Retry" : "Reload",
|
|
74
|
-
size: "md",
|
|
75
|
-
disabled: actionsDisabled,
|
|
76
|
-
onPress: () => runAction(() => (0, _actions.retryRecord)(record))
|
|
77
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TouchableOpacity, {
|
|
78
|
-
onPress: onNext,
|
|
79
|
-
disabled: !hasNext,
|
|
80
|
-
style: [styles.navButton, !hasNext && styles.disabled],
|
|
81
|
-
activeOpacity: 0.7,
|
|
82
|
-
accessibilityLabel: "Next image",
|
|
83
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.ChevronRight, {
|
|
84
|
-
size: 20,
|
|
85
|
-
color: hasNext ? _sharedUi.night.color.accent : _sharedUi.night.color.textTertiary
|
|
86
|
-
})
|
|
87
|
-
})]
|
|
88
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_sharedUi.FooterRow, {
|
|
89
|
-
style: {
|
|
90
|
-
gap: 8
|
|
91
|
-
},
|
|
92
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(SimButton, {
|
|
93
|
-
label: "Error",
|
|
94
|
-
disabled: actionsDisabled,
|
|
95
|
-
onPress: () => simulate({
|
|
96
|
-
type: "error"
|
|
97
|
-
}, "Forced error")
|
|
98
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(SimButton, {
|
|
99
|
-
label: "Loading",
|
|
100
|
-
disabled: actionsDisabled,
|
|
101
|
-
onPress: () => simulate({
|
|
102
|
-
type: "hang"
|
|
103
|
-
}, "Forced loading")
|
|
104
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(SimButton, {
|
|
105
|
-
label: "Blank",
|
|
106
|
-
disabled: actionsDisabled,
|
|
107
|
-
onPress: () => simulate({
|
|
108
|
-
type: "blank"
|
|
109
|
-
}, "Blanked")
|
|
110
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(SimButton, {
|
|
111
|
-
label: "Find",
|
|
112
|
-
disabled: actionsDisabled,
|
|
113
|
-
onPress: () => {
|
|
114
|
-
(0, _overrides.flashRecord)(record.id);
|
|
115
|
-
setMessage("Flashing a red border on the image (2.5s)");
|
|
116
|
-
}
|
|
117
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(SimButton, {
|
|
118
|
-
label: "Restore",
|
|
119
|
-
accent: true,
|
|
120
|
-
disabled: !overrideActive,
|
|
121
|
-
onPress: () => {
|
|
122
|
-
(0, _overrides.clearOverride)(record.id);
|
|
123
|
-
setMessage("Override removed — original source restored");
|
|
124
|
-
}
|
|
125
|
-
})]
|
|
126
|
-
})]
|
|
127
|
-
});
|
|
128
|
-
}
|
|
129
|
-
function SimButton({
|
|
130
|
-
label,
|
|
131
|
-
onPress,
|
|
132
|
-
disabled,
|
|
133
|
-
accent
|
|
134
|
-
}) {
|
|
135
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.FooterButton, {
|
|
136
|
-
label: label,
|
|
137
|
-
onPress: onPress,
|
|
138
|
-
disabled: disabled,
|
|
139
|
-
accent: accent,
|
|
140
|
-
style: {
|
|
141
|
-
paddingVertical: 7
|
|
142
|
-
}
|
|
143
|
-
});
|
|
144
|
-
}
|
|
145
|
-
const styles = _reactNative.StyleSheet.create({
|
|
146
|
-
navButton: {
|
|
147
|
-
paddingHorizontal: 10,
|
|
148
|
-
paddingVertical: 8,
|
|
149
|
-
borderRadius: 6,
|
|
150
|
-
backgroundColor: _sharedUi.night.color.button,
|
|
151
|
-
alignItems: "center",
|
|
152
|
-
justifyContent: "center"
|
|
153
|
-
},
|
|
154
|
-
disabled: {
|
|
155
|
-
opacity: 0.4
|
|
156
|
-
}
|
|
157
|
-
});
|
|
158
|
-
//# sourceMappingURL=ImageDetailFooter.js.map
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.ImageDetailFooter=ImageDetailFooter;var _react=require("react");var _reactNative=require("react-native");var _sharedUi=require("@buoy-gg/shared-ui");var _actions=require("../capture/actions");var _overrides=require("../capture/overrides");var _jsxRuntime=require("react/jsx-runtime");function ImageDetailFooter({record:e,hasPrevious:s,hasNext:a,onPrevious:i,onNext:u}){const[d,o]=(0,_react.useState)(null);const c=l=>{o("\u2026");l().then(r=>o(r.message)).catch(r=>o(String(r?.message??r)))};const t=!e.mounted;const b=e.overrideLabel!=null;const n=(l,r)=>{(0,_overrides.setOverride)(e.id,{source:l,label:r});o(`${r} \u2014 Restore to undo`)};return(0,_jsxRuntime.jsxs)(_sharedUi.ToolFooter,{children:[d?(0,_jsxRuntime.jsx)(_sharedUi.FooterMessage,{children:d}):t?(0,_jsxRuntime.jsx)(_sharedUi.FooterMessage,{tone:"muted",children:"Instance unmounted \u2014 reload actions need the image on screen."}):null,(0,_jsxRuntime.jsxs)(_sharedUi.FooterRow,{style:{gap:8},children:[(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{onPress:i,disabled:!s,style:[styles.navButton,!s&&styles.disabled],activeOpacity:.7,accessibilityLabel:"Previous image",children:(0,_jsxRuntime.jsx)(_sharedUi.ChevronLeft,{size:20,color:s?_sharedUi.night.color.accent:_sharedUi.night.color.textTertiary})}),(0,_jsxRuntime.jsx)(_sharedUi.FooterButton,{label:"Hard reload",size:"md",disabled:t,icon:(0,_jsxRuntime.jsx)(_sharedUi.RefreshCw,{size:13,color:t?_sharedUi.night.color.textTertiary:_sharedUi.night.color.info}),onPress:()=>c(()=>(0,_actions.hardReloadRecord)(e))}),(0,_jsxRuntime.jsx)(_sharedUi.FooterButton,{label:e.status==="error"?"Retry":"Reload",size:"md",disabled:t,onPress:()=>c(()=>(0,_actions.retryRecord)(e))}),(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{onPress:u,disabled:!a,style:[styles.navButton,!a&&styles.disabled],activeOpacity:.7,accessibilityLabel:"Next image",children:(0,_jsxRuntime.jsx)(_sharedUi.ChevronRight,{size:20,color:a?_sharedUi.night.color.accent:_sharedUi.night.color.textTertiary})})]}),(0,_jsxRuntime.jsxs)(_sharedUi.FooterRow,{style:{gap:8},children:[(0,_jsxRuntime.jsx)(SimButton,{label:"Error",disabled:t,onPress:()=>n({type:"error"},"Forced error")}),(0,_jsxRuntime.jsx)(SimButton,{label:"Loading",disabled:t,onPress:()=>n({type:"hang"},"Forced loading")}),(0,_jsxRuntime.jsx)(SimButton,{label:"Blank",disabled:t,onPress:()=>n({type:"blank"},"Blanked")}),(0,_jsxRuntime.jsx)(SimButton,{label:"Find",disabled:t,onPress:()=>{(0,_overrides.flashRecord)(e.id);o("Flashing a red border on the image (2.5s)")}}),(0,_jsxRuntime.jsx)(SimButton,{label:"Restore",accent:true,disabled:!b,onPress:()=>{(0,_overrides.clearOverride)(e.id);o("Override removed \u2014 original source restored")}})]})]})}function SimButton({label:e,onPress:s,disabled:a,accent:i}){return(0,_jsxRuntime.jsx)(_sharedUi.FooterButton,{label:e,onPress:s,disabled:a,accent:i,style:{paddingVertical:7}})}const styles=_reactNative.StyleSheet.create({navButton:{paddingHorizontal:10,paddingVertical:8,borderRadius:6,backgroundColor:_sharedUi.night.color.button,alignItems:"center",justifyContent:"center"},disabled:{opacity:.4}});
|