@buoy-gg/assets 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 +12 -73
- package/bundlers/vite.mjs +1 -53
- package/lib/commonjs/autoCapture.js +1 -5
- package/lib/commonjs/autoCapture.web.js +1 -6
- package/lib/commonjs/capture/assetLifecycle.js +1 -11
- package/lib/commonjs/capture/assetLifecycle.web.js +1 -20
- package/lib/commonjs/capture/browserAssets.js +1 -83
- package/lib/commonjs/capture/expo.js +1 -46
- package/lib/commonjs/capture/expo.web.js +1 -19
- package/lib/commonjs/capture/install.js +1 -91
- package/lib/commonjs/capture/install.web.js +1 -75
- package/lib/commonjs/capture/isBuoyAsset.js +1 -23
- package/lib/commonjs/capture/measure.js +1 -187
- package/lib/commonjs/capture/metroGraph.js +1 -175
- package/lib/commonjs/capture/metroGraph.web.js +1 -27
- package/lib/commonjs/capture/registry.js +1 -127
- package/lib/commonjs/components/AssetDetail.js +1 -211
- package/lib/commonjs/components/AssetImage.js +1 -66
- package/lib/commonjs/components/AssetRow.js +1 -232
- package/lib/commonjs/components/AssetsFilterBar.js +1 -105
- package/lib/commonjs/components/AssetsHeader.js +1 -73
- package/lib/commonjs/components/AssetsIcon.js +1 -19
- package/lib/commonjs/components/AssetsListControls.js +1 -81
- package/lib/commonjs/components/AssetsModal.js +1 -378
- package/lib/commonjs/components/ScanNotice.js +1 -86
- package/lib/commonjs/components/optionalExpoImage.js +1 -16
- package/lib/commonjs/components/optionalExpoImage.web.js +1 -10
- package/lib/commonjs/export.js +1 -62
- package/lib/commonjs/format.js +1 -59
- package/lib/commonjs/hooks/useAssetRecords.js +1 -22
- package/lib/commonjs/hooks/useAssetScanStatus.js +1 -28
- package/lib/commonjs/index.js +1 -294
- package/lib/commonjs/preset.js +1 -39
- package/lib/commonjs/remote.js +1 -68
- package/lib/commonjs/state.js +1 -51
- package/lib/commonjs/store/assetStore.js +1 -256
- package/lib/commonjs/store/baseline.js +1 -175
- package/lib/commonjs/store/insights.js +1 -120
- package/lib/commonjs/sync/assetsSyncAdapter.js +1 -157
- package/lib/commonjs/types.js +0 -1
- package/lib/commonjs/utils/deviceScale.js +1 -50
- package/lib/commonjs/utils/testIDs.js +1 -110
- package/lib/module/autoCapture.js +1 -5
- package/lib/module/autoCapture.web.js +1 -5
- package/lib/module/capture/assetLifecycle.js +1 -7
- package/lib/module/capture/assetLifecycle.web.js +1 -16
- package/lib/module/capture/browserAssets.js +1 -75
- package/lib/module/capture/expo.js +1 -41
- package/lib/module/capture/expo.web.js +1 -14
- package/lib/module/capture/install.js +1 -85
- package/lib/module/capture/install.web.js +1 -68
- package/lib/module/capture/isBuoyAsset.js +1 -18
- package/lib/module/capture/measure.js +1 -180
- package/lib/module/capture/metroGraph.js +1 -168
- package/lib/module/capture/metroGraph.web.js +1 -21
- package/lib/module/capture/registry.js +1 -120
- package/lib/module/components/AssetDetail.js +1 -207
- package/lib/module/components/AssetImage.js +1 -62
- package/lib/module/components/AssetRow.js +1 -228
- package/lib/module/components/AssetsFilterBar.js +1 -101
- package/lib/module/components/AssetsHeader.js +1 -69
- package/lib/module/components/AssetsIcon.js +1 -12
- package/lib/module/components/AssetsListControls.js +1 -77
- package/lib/module/components/AssetsModal.js +1 -373
- package/lib/module/components/ScanNotice.js +1 -82
- package/lib/module/components/optionalExpoImage.js +1 -12
- package/lib/module/components/optionalExpoImage.web.js +1 -6
- package/lib/module/export.js +1 -57
- package/lib/module/format.js +1 -51
- package/lib/module/hooks/useAssetRecords.js +1 -18
- package/lib/module/hooks/useAssetScanStatus.js +1 -23
- package/lib/module/index.js +1 -64
- package/lib/module/preset.js +1 -35
- package/lib/module/remote.js +1 -61
- package/lib/module/state.js +1 -47
- package/lib/module/store/assetStore.js +1 -240
- package/lib/module/store/baseline.js +1 -167
- package/lib/module/store/insights.js +1 -116
- package/lib/module/sync/assetsSyncAdapter.js +1 -153
- package/lib/module/types.js +0 -1
- package/lib/module/utils/deviceScale.js +1 -46
- package/lib/module/utils/testIDs.js +1 -99
- package/lib/web/index.mjs +3 -4
- package/package.json +3 -8
- package/lib/commonjs/autoCapture.js.map +0 -1
- package/lib/commonjs/autoCapture.web.js.map +0 -1
- package/lib/commonjs/capture/assetLifecycle.js.map +0 -1
- package/lib/commonjs/capture/assetLifecycle.web.js.map +0 -1
- package/lib/commonjs/capture/browserAssets.js.map +0 -1
- package/lib/commonjs/capture/expo.js.map +0 -1
- package/lib/commonjs/capture/expo.web.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/isBuoyAsset.js.map +0 -1
- package/lib/commonjs/capture/measure.js.map +0 -1
- package/lib/commonjs/capture/metroGraph.js.map +0 -1
- package/lib/commonjs/capture/metroGraph.web.js.map +0 -1
- package/lib/commonjs/capture/registry.js.map +0 -1
- package/lib/commonjs/components/AssetDetail.js.map +0 -1
- package/lib/commonjs/components/AssetImage.js.map +0 -1
- package/lib/commonjs/components/AssetRow.js.map +0 -1
- package/lib/commonjs/components/AssetsFilterBar.js.map +0 -1
- package/lib/commonjs/components/AssetsHeader.js.map +0 -1
- package/lib/commonjs/components/AssetsIcon.js.map +0 -1
- package/lib/commonjs/components/AssetsListControls.js.map +0 -1
- package/lib/commonjs/components/AssetsModal.js.map +0 -1
- package/lib/commonjs/components/ScanNotice.js.map +0 -1
- package/lib/commonjs/components/optionalExpoImage.js.map +0 -1
- package/lib/commonjs/components/optionalExpoImage.web.js.map +0 -1
- package/lib/commonjs/export.js.map +0 -1
- package/lib/commonjs/format.js.map +0 -1
- package/lib/commonjs/hooks/useAssetRecords.js.map +0 -1
- package/lib/commonjs/hooks/useAssetScanStatus.js.map +0 -1
- package/lib/commonjs/index.js.map +0 -1
- package/lib/commonjs/preset.js.map +0 -1
- package/lib/commonjs/remote.js.map +0 -1
- package/lib/commonjs/state.js.map +0 -1
- package/lib/commonjs/store/assetStore.js.map +0 -1
- package/lib/commonjs/store/baseline.js.map +0 -1
- package/lib/commonjs/store/insights.js.map +0 -1
- package/lib/commonjs/sync/assetsSyncAdapter.js.map +0 -1
- package/lib/commonjs/types.js.map +0 -1
- package/lib/commonjs/utils/deviceScale.js.map +0 -1
- package/lib/commonjs/utils/testIDs.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/assetLifecycle.js.map +0 -1
- package/lib/module/capture/assetLifecycle.web.js.map +0 -1
- package/lib/module/capture/browserAssets.js.map +0 -1
- package/lib/module/capture/expo.js.map +0 -1
- package/lib/module/capture/expo.web.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/isBuoyAsset.js.map +0 -1
- package/lib/module/capture/measure.js.map +0 -1
- package/lib/module/capture/metroGraph.js.map +0 -1
- package/lib/module/capture/metroGraph.web.js.map +0 -1
- package/lib/module/capture/registry.js.map +0 -1
- package/lib/module/components/AssetDetail.js.map +0 -1
- package/lib/module/components/AssetImage.js.map +0 -1
- package/lib/module/components/AssetRow.js.map +0 -1
- package/lib/module/components/AssetsFilterBar.js.map +0 -1
- package/lib/module/components/AssetsHeader.js.map +0 -1
- package/lib/module/components/AssetsIcon.js.map +0 -1
- package/lib/module/components/AssetsListControls.js.map +0 -1
- package/lib/module/components/AssetsModal.js.map +0 -1
- package/lib/module/components/ScanNotice.js.map +0 -1
- package/lib/module/components/optionalExpoImage.js.map +0 -1
- package/lib/module/components/optionalExpoImage.web.js.map +0 -1
- package/lib/module/export.js.map +0 -1
- package/lib/module/format.js.map +0 -1
- package/lib/module/hooks/useAssetRecords.js.map +0 -1
- package/lib/module/hooks/useAssetScanStatus.js.map +0 -1
- package/lib/module/index.js.map +0 -1
- package/lib/module/preset.js.map +0 -1
- package/lib/module/remote.js.map +0 -1
- package/lib/module/state.js.map +0 -1
- package/lib/module/store/assetStore.js.map +0 -1
- package/lib/module/store/baseline.js.map +0 -1
- package/lib/module/store/insights.js.map +0 -1
- package/lib/module/sync/assetsSyncAdapter.js.map +0 -1
- package/lib/module/types.js.map +0 -1
- package/lib/module/utils/deviceScale.js.map +0 -1
- package/lib/module/utils/testIDs.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/assetLifecycle.d.ts.map +0 -1
- package/lib/typescript/capture/assetLifecycle.web.d.ts.map +0 -1
- package/lib/typescript/capture/browserAssets.d.ts.map +0 -1
- package/lib/typescript/capture/expo.d.ts.map +0 -1
- package/lib/typescript/capture/expo.web.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/isBuoyAsset.d.ts.map +0 -1
- package/lib/typescript/capture/measure.d.ts.map +0 -1
- package/lib/typescript/capture/metroGraph.d.ts.map +0 -1
- package/lib/typescript/capture/metroGraph.web.d.ts.map +0 -1
- package/lib/typescript/capture/registry.d.ts.map +0 -1
- package/lib/typescript/components/AssetDetail.d.ts.map +0 -1
- package/lib/typescript/components/AssetImage.d.ts.map +0 -1
- package/lib/typescript/components/AssetRow.d.ts.map +0 -1
- package/lib/typescript/components/AssetsFilterBar.d.ts.map +0 -1
- package/lib/typescript/components/AssetsHeader.d.ts.map +0 -1
- package/lib/typescript/components/AssetsIcon.d.ts.map +0 -1
- package/lib/typescript/components/AssetsListControls.d.ts.map +0 -1
- package/lib/typescript/components/AssetsModal.d.ts.map +0 -1
- package/lib/typescript/components/ScanNotice.d.ts.map +0 -1
- package/lib/typescript/components/optionalExpoImage.d.ts.map +0 -1
- package/lib/typescript/components/optionalExpoImage.web.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/useAssetRecords.d.ts.map +0 -1
- package/lib/typescript/hooks/useAssetScanStatus.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/remote.d.ts.map +0 -1
- package/lib/typescript/state.d.ts.map +0 -1
- package/lib/typescript/store/assetStore.d.ts.map +0 -1
- package/lib/typescript/store/baseline.d.ts.map +0 -1
- package/lib/typescript/store/insights.d.ts.map +0 -1
- package/lib/typescript/sync/assetsSyncAdapter.d.ts.map +0 -1
- package/lib/typescript/types.d.ts.map +0 -1
- package/lib/typescript/utils/deviceScale.d.ts.map +0 -1
- package/lib/typescript/utils/testIDs.d.ts.map +0 -1
|
@@ -1,73 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.AssetsHeader = AssetsHeader;
|
|
7
|
-
var _sharedUi = require("@buoy-gg/shared-ui");
|
|
8
|
-
var _format = require("../format");
|
|
9
|
-
var _testIDs = require("../utils/testIDs");
|
|
10
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
|
-
/**
|
|
12
|
-
* AssetsHeader — shared ModalHeader wiring, matching the Images/Console
|
|
13
|
-
* header pattern. List mode shows inventory totals plus the shared
|
|
14
|
-
* ToolbarCopyButton (full markdown report); detail mode shows back
|
|
15
|
-
* navigation and the single-asset report.
|
|
16
|
-
*/
|
|
17
|
-
|
|
18
|
-
function AssetsHeader({
|
|
19
|
-
stats,
|
|
20
|
-
measuring,
|
|
21
|
-
discovering = false,
|
|
22
|
-
detailOpen,
|
|
23
|
-
detailIndex = -1,
|
|
24
|
-
detailTotal = 0,
|
|
25
|
-
onCloseDetail,
|
|
26
|
-
onClear,
|
|
27
|
-
getReport,
|
|
28
|
-
onBack
|
|
29
|
-
}) {
|
|
30
|
-
if (detailOpen) {
|
|
31
|
-
const counter = detailIndex >= 0 && detailTotal > 0 ? `${detailIndex + 1} of ${detailTotal}` : undefined;
|
|
32
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_sharedUi.ModalHeader, {
|
|
33
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.ModalHeader.Navigation, {
|
|
34
|
-
onBack: onCloseDetail
|
|
35
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.ModalHeader.Content, {
|
|
36
|
-
title: "Asset detail",
|
|
37
|
-
subtitle: counter,
|
|
38
|
-
testID: _testIDs.ASSETS_TEST_IDS.title
|
|
39
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.ModalHeader.Actions, {
|
|
40
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.ToolbarCopyButton, {
|
|
41
|
-
value: getReport,
|
|
42
|
-
testID: _testIDs.ASSETS_TEST_IDS.copy
|
|
43
|
-
})
|
|
44
|
-
})]
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
const subtitleParts = [`${stats.total} assets${discovering ? " so far" : ""}`];
|
|
48
|
-
// A mid-measure byte total reads as nonsense ("653 B+") — wait it out.
|
|
49
|
-
if (stats.totalBytes > 0 && !measuring && !discovering) {
|
|
50
|
-
const partial = stats.measuredCount < stats.total ? "+" : "";
|
|
51
|
-
subtitleParts.push(`${(0, _format.formatBytes)(stats.totalBytes)}${partial}`);
|
|
52
|
-
}
|
|
53
|
-
if (stats.neverLoaded > 0) subtitleParts.push(`${stats.neverLoaded} not observed`);
|
|
54
|
-
if (stats.fontFamilies > 0) subtitleParts.push(`${stats.fontFamilies} fonts`);
|
|
55
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_sharedUi.ModalHeader, {
|
|
56
|
-
children: [onBack ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.ModalHeader.Navigation, {
|
|
57
|
-
onBack: onBack
|
|
58
|
-
}) : null, /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.ModalHeader.Content, {
|
|
59
|
-
title: "Assets",
|
|
60
|
-
subtitle: subtitleParts.join(" · "),
|
|
61
|
-
testID: _testIDs.ASSETS_TEST_IDS.title
|
|
62
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_sharedUi.ModalHeader.Actions, {
|
|
63
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.ToolbarCopyButton, {
|
|
64
|
-
value: getReport,
|
|
65
|
-
testID: _testIDs.ASSETS_TEST_IDS.copy
|
|
66
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.ToolbarClearButton, {
|
|
67
|
-
onPress: onClear,
|
|
68
|
-
testID: _testIDs.ASSETS_TEST_IDS.clear
|
|
69
|
-
})]
|
|
70
|
-
})]
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
//# sourceMappingURL=AssetsHeader.js.map
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.AssetsHeader=AssetsHeader;var _sharedUi=require("@buoy-gg/shared-ui");var _format=require("../format");var _testIDs=require("../utils/testIDs");var _jsxRuntime=require("react/jsx-runtime");function AssetsHeader({stats:e,measuring:n,discovering:o=false,detailOpen:u,detailIndex:s=-1,detailTotal:a=0,onCloseDetail:d,onClear:S,getReport:i,onBack:l}){if(u){const r=s>=0&&a>0?`${s+1} of ${a}`:void 0;return(0,_jsxRuntime.jsxs)(_sharedUi.ModalHeader,{children:[(0,_jsxRuntime.jsx)(_sharedUi.ModalHeader.Navigation,{onBack:d}),(0,_jsxRuntime.jsx)(_sharedUi.ModalHeader.Content,{title:"Asset detail",subtitle:r,testID:_testIDs.ASSETS_TEST_IDS.title}),(0,_jsxRuntime.jsx)(_sharedUi.ModalHeader.Actions,{children:(0,_jsxRuntime.jsx)(_sharedUi.ToolbarCopyButton,{value:i,testID:_testIDs.ASSETS_TEST_IDS.copy})})]})}const t=[`${e.total} assets${o?" so far":""}`];if(e.totalBytes>0&&!n&&!o){const r=e.measuredCount<e.total?"+":"";t.push(`${(0,_format.formatBytes)(e.totalBytes)}${r}`)}if(e.neverLoaded>0)t.push(`${e.neverLoaded} not observed`);if(e.fontFamilies>0)t.push(`${e.fontFamilies} fonts`);return(0,_jsxRuntime.jsxs)(_sharedUi.ModalHeader,{children:[l?(0,_jsxRuntime.jsx)(_sharedUi.ModalHeader.Navigation,{onBack:l}):null,(0,_jsxRuntime.jsx)(_sharedUi.ModalHeader.Content,{title:"Assets",subtitle:t.join(" \xB7 "),testID:_testIDs.ASSETS_TEST_IDS.title}),(0,_jsxRuntime.jsxs)(_sharedUi.ModalHeader.Actions,{children:[(0,_jsxRuntime.jsx)(_sharedUi.ToolbarCopyButton,{value:i,testID:_testIDs.ASSETS_TEST_IDS.copy}),(0,_jsxRuntime.jsx)(_sharedUi.ToolbarClearButton,{onPress:S,testID:_testIDs.ASSETS_TEST_IDS.clear})]})]})}
|
|
@@ -1,19 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
Object.defineProperty(exports, "ASSETS_ICON_COLOR", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function () {
|
|
9
|
-
return _sharedUi.ASSETS_ICON_COLOR;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
Object.defineProperty(exports, "AssetsIcon", {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
get: function () {
|
|
15
|
-
return _sharedUi.AssetsIcon;
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
var _sharedUi = require("@buoy-gg/shared-ui");
|
|
19
|
-
//# sourceMappingURL=AssetsIcon.js.map
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"ASSETS_ICON_COLOR",{enumerable:true,get:function(){return _sharedUi.ASSETS_ICON_COLOR}});Object.defineProperty(exports,"AssetsIcon",{enumerable:true,get:function(){return _sharedUi.AssetsIcon}});var _sharedUi=require("@buoy-gg/shared-ui");
|
|
@@ -1,81 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.AssetsListControls = AssetsListControls;
|
|
7
|
-
var _reactNative = require("react-native");
|
|
8
|
-
var _sharedUi = require("@buoy-gg/shared-ui");
|
|
9
|
-
var _testIDs = require("../utils/testIDs");
|
|
10
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
|
-
/** Asset list search and sort controls. */
|
|
12
|
-
|
|
13
|
-
const NEXT_SORT = {
|
|
14
|
-
size: "name",
|
|
15
|
-
name: "type",
|
|
16
|
-
type: "size"
|
|
17
|
-
};
|
|
18
|
-
function AssetsListControls({
|
|
19
|
-
query,
|
|
20
|
-
onQueryChange,
|
|
21
|
-
sort,
|
|
22
|
-
onSortChange
|
|
23
|
-
}) {
|
|
24
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
25
|
-
style: styles.row,
|
|
26
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TextInput, {
|
|
27
|
-
style: styles.input,
|
|
28
|
-
value: query,
|
|
29
|
-
onChangeText: onQueryChange,
|
|
30
|
-
placeholder: "Search assets\u2026",
|
|
31
|
-
placeholderTextColor: _sharedUi.night.color.placeholder,
|
|
32
|
-
autoCapitalize: "none",
|
|
33
|
-
autoCorrect: false,
|
|
34
|
-
testID: _testIDs.ASSETS_TEST_IDS.search
|
|
35
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TouchableOpacity, {
|
|
36
|
-
style: styles.button,
|
|
37
|
-
onPress: () => onSortChange(NEXT_SORT[sort]),
|
|
38
|
-
testID: _testIDs.ASSETS_TEST_IDS.sort,
|
|
39
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Text, {
|
|
40
|
-
style: styles.buttonText,
|
|
41
|
-
testID: `${_testIDs.ASSETS_TEST_IDS.sort}-label`,
|
|
42
|
-
children: ["\u2193 ", sort.toUpperCase()]
|
|
43
|
-
})
|
|
44
|
-
})]
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
const styles = _reactNative.StyleSheet.create({
|
|
48
|
-
row: {
|
|
49
|
-
flexDirection: "row",
|
|
50
|
-
alignItems: "center",
|
|
51
|
-
gap: 8,
|
|
52
|
-
paddingHorizontal: 10,
|
|
53
|
-
paddingBottom: 8
|
|
54
|
-
},
|
|
55
|
-
input: {
|
|
56
|
-
flex: 1,
|
|
57
|
-
backgroundColor: _sharedUi.night.color.surfaceElevated,
|
|
58
|
-
borderWidth: 1,
|
|
59
|
-
borderColor: _sharedUi.night.color.border,
|
|
60
|
-
borderRadius: 8,
|
|
61
|
-
paddingHorizontal: 10,
|
|
62
|
-
paddingVertical: 6,
|
|
63
|
-
color: _sharedUi.night.color.text,
|
|
64
|
-
fontSize: 12
|
|
65
|
-
},
|
|
66
|
-
button: {
|
|
67
|
-
backgroundColor: _sharedUi.night.color.surface,
|
|
68
|
-
borderWidth: 1,
|
|
69
|
-
borderColor: _sharedUi.night.color.border,
|
|
70
|
-
borderRadius: 8,
|
|
71
|
-
paddingHorizontal: 10,
|
|
72
|
-
paddingVertical: 7
|
|
73
|
-
},
|
|
74
|
-
buttonText: {
|
|
75
|
-
color: _sharedUi.night.color.textSecondary,
|
|
76
|
-
fontSize: 10,
|
|
77
|
-
fontWeight: "700",
|
|
78
|
-
letterSpacing: 0.5
|
|
79
|
-
}
|
|
80
|
-
});
|
|
81
|
-
//# sourceMappingURL=AssetsListControls.js.map
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.AssetsListControls=AssetsListControls;var _reactNative=require("react-native");var _sharedUi=require("@buoy-gg/shared-ui");var _testIDs=require("../utils/testIDs");var _jsxRuntime=require("react/jsx-runtime");const NEXT_SORT={size:"name",name:"type",type:"size"};function AssetsListControls({query:t,onQueryChange:r,sort:e,onSortChange:o}){return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.row,children:[(0,_jsxRuntime.jsx)(_reactNative.TextInput,{style:styles.input,value:t,onChangeText:r,placeholder:"Search assets\u2026",placeholderTextColor:_sharedUi.night.color.placeholder,autoCapitalize:"none",autoCorrect:false,testID:_testIDs.ASSETS_TEST_IDS.search}),(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{style:styles.button,onPress:()=>o(NEXT_SORT[e]),testID:_testIDs.ASSETS_TEST_IDS.sort,children:(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:styles.buttonText,testID:`${_testIDs.ASSETS_TEST_IDS.sort}-label`,children:["\u2193 ",e.toUpperCase()]})})]})}const styles=_reactNative.StyleSheet.create({row:{flexDirection:"row",alignItems:"center",gap:8,paddingHorizontal:10,paddingBottom:8},input:{flex:1,backgroundColor:_sharedUi.night.color.surfaceElevated,borderWidth:1,borderColor:_sharedUi.night.color.border,borderRadius:8,paddingHorizontal:10,paddingVertical:6,color:_sharedUi.night.color.text,fontSize:12},button:{backgroundColor:_sharedUi.night.color.surface,borderWidth:1,borderColor:_sharedUi.night.color.border,borderRadius:8,paddingHorizontal:10,paddingVertical:7},buttonText:{color:_sharedUi.night.color.textSecondary,fontSize:10,fontWeight:"700",letterSpacing:.5}});
|
|
@@ -1,378 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.AssetsModal = AssetsModal;
|
|
7
|
-
exports.AssetsToolView = AssetsToolView;
|
|
8
|
-
var _react = require("react");
|
|
9
|
-
var _reactNative = require("react-native");
|
|
10
|
-
var _sharedUi = require("@buoy-gg/shared-ui");
|
|
11
|
-
var _install = require("../capture/install");
|
|
12
|
-
var _export = require("../export");
|
|
13
|
-
var _useAssetRecords = require("../hooks/useAssetRecords");
|
|
14
|
-
var _useAssetScanStatus = require("../hooks/useAssetScanStatus");
|
|
15
|
-
var _remote = require("../remote");
|
|
16
|
-
var _assetStore = require("../store/assetStore");
|
|
17
|
-
var _baseline = require("../store/baseline");
|
|
18
|
-
var _AssetDetail = require("./AssetDetail");
|
|
19
|
-
var _AssetRow = require("./AssetRow");
|
|
20
|
-
var _AssetsFilterBar = require("./AssetsFilterBar");
|
|
21
|
-
var _AssetsHeader = require("./AssetsHeader");
|
|
22
|
-
var _AssetsListControls = require("./AssetsListControls");
|
|
23
|
-
var _ScanNotice = require("./ScanNotice");
|
|
24
|
-
var _testIDs = require("../utils/testIDs");
|
|
25
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
26
|
-
/**
|
|
27
|
-
* AssetsModal — bottom-sheet wrapper rendered by FloatingDevTools when the
|
|
28
|
-
* Assets tool is opened. Inventory list (largest first) → tap for detail.
|
|
29
|
-
* Opening triggers a full rescan (registry walk + Metro graph + size
|
|
30
|
-
* measurement); merely installing the package never hits the network.
|
|
31
|
-
*/
|
|
32
|
-
|
|
33
|
-
function FontFamilies({
|
|
34
|
-
names
|
|
35
|
-
}) {
|
|
36
|
-
const families = [...new Set(names)];
|
|
37
|
-
if (!families.length) return null;
|
|
38
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
39
|
-
style: styles.fontsBox,
|
|
40
|
-
testID: _testIDs.ASSETS_TEST_IDS.fonts,
|
|
41
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Text, {
|
|
42
|
-
style: styles.fontsTitle,
|
|
43
|
-
testID: _testIDs.ASSETS_TEST_IDS.fontsTitle,
|
|
44
|
-
children: ["LOADED FONT FAMILIES (", families.length, ")"]
|
|
45
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
46
|
-
style: styles.fontsWrap,
|
|
47
|
-
children: families.map(family => /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
48
|
-
style: styles.fontChip,
|
|
49
|
-
testID: (0, _testIDs.assetFontChipTestID)(family),
|
|
50
|
-
children: family
|
|
51
|
-
}, family))
|
|
52
|
-
})]
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
function EmptyState({
|
|
56
|
-
duplicates = false
|
|
57
|
-
}) {
|
|
58
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.ToolEmptyState, {
|
|
59
|
-
testID: _testIDs.ASSETS_TEST_IDS.empty
|
|
60
|
-
// scanning: a scan ran and found nothing — the copy says "try Rescan".
|
|
61
|
-
,
|
|
62
|
-
otto: "scanning",
|
|
63
|
-
title: duplicates ? "No duplicates found" : "No assets found yet",
|
|
64
|
-
message: duplicates ? "No assets in this view share a content hash." : "Every bundled asset — images, fonts, video, audio — appears here with sizes, scale coverage, and runtime registration status. Try Rescan after navigating around the app."
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
/** Largest first — measured bytes, falling back to decoded estimate. */
|
|
69
|
-
function bySizeDesc(a, b) {
|
|
70
|
-
return (b.sizeBytes ?? (0, _assetStore.estDecodedBytes)(b)) - (a.sizeBytes ?? (0, _assetStore.estDecodedBytes)(a));
|
|
71
|
-
}
|
|
72
|
-
const COMPARATORS = {
|
|
73
|
-
size: bySizeDesc,
|
|
74
|
-
name: (a, b) => a.name.localeCompare(b.name) || a.type.localeCompare(b.type),
|
|
75
|
-
type: (a, b) => a.type.localeCompare(b.type) || bySizeDesc(a, b)
|
|
76
|
-
};
|
|
77
|
-
function AssetsModal({
|
|
78
|
-
visible,
|
|
79
|
-
onClose,
|
|
80
|
-
onBack,
|
|
81
|
-
onMinimize,
|
|
82
|
-
persistenceKey,
|
|
83
|
-
inline = false
|
|
84
|
-
}) {
|
|
85
|
-
// Safety net: the index import normally installed this already.
|
|
86
|
-
(0, _install.installAssetCapture)();
|
|
87
|
-
const {
|
|
88
|
-
records,
|
|
89
|
-
stats,
|
|
90
|
-
insights
|
|
91
|
-
} = (0, _useAssetRecords.useAssetRecords)();
|
|
92
|
-
const status = (0, _useAssetScanStatus.useAssetScanStatus)();
|
|
93
|
-
const [remoteError, setRemoteError] = (0, _react.useState)(false);
|
|
94
|
-
(0, _react.useEffect)(() => {
|
|
95
|
-
setRemoteError(false);
|
|
96
|
-
}, [status.graphFetchInFlight, status.lastScanAt]);
|
|
97
|
-
const retry = () => {
|
|
98
|
-
setRemoteError(false);
|
|
99
|
-
const remote = (0, _remote.remoteAssetsDispatch)();
|
|
100
|
-
if (remote) void remote("rescan").catch(() => setRemoteError(true));else void (0, _install.rescan)();
|
|
101
|
-
};
|
|
102
|
-
const [selectedId, setSelectedId] = (0, _react.useState)(null);
|
|
103
|
-
const [filter, setFilter] = (0, _react.useState)("all");
|
|
104
|
-
const [query, setQuery] = (0, _react.useState)("");
|
|
105
|
-
const [sort, setSort] = (0, _react.useState)("size");
|
|
106
|
-
const selected = selectedId != null ? (0, _assetStore.getRecord)(selectedId) : undefined;
|
|
107
|
-
|
|
108
|
-
// Full scan on open — locally on device, forwarded on dashboard mirrors.
|
|
109
|
-
// The baseline load is async and re-renders through the store emit.
|
|
110
|
-
(0, _react.useEffect)(() => {
|
|
111
|
-
if (!visible) return;
|
|
112
|
-
void (0, _baseline.loadBaseline)();
|
|
113
|
-
setRemoteError(false);
|
|
114
|
-
const remote = (0, _remote.remoteAssetsDispatch)();
|
|
115
|
-
if (remote) {
|
|
116
|
-
remote("rescan").catch(() => setRemoteError(true));
|
|
117
|
-
} else {
|
|
118
|
-
void (0, _install.rescan)();
|
|
119
|
-
}
|
|
120
|
-
}, [visible]);
|
|
121
|
-
const duplicateIds = new Set(insights.duplicates.flatMap(group => group.ids));
|
|
122
|
-
const sorted = [...records].sort(COMPARATORS[sort]);
|
|
123
|
-
const trimmedQuery = query.trim().toLowerCase();
|
|
124
|
-
const filtered = sorted.filter(r => {
|
|
125
|
-
if (filter === "unused" && r.loaded) return false;
|
|
126
|
-
if (filter === "duplicates" && !duplicateIds.has(r.id)) return false;
|
|
127
|
-
if (filter !== "all" && filter !== "unused" && filter !== "duplicates" && r.kind !== filter) return false;
|
|
128
|
-
if (trimmedQuery && !`${r.name}.${r.type}`.toLowerCase().includes(trimmedQuery)) {
|
|
129
|
-
return false;
|
|
130
|
-
}
|
|
131
|
-
return true;
|
|
132
|
-
});
|
|
133
|
-
const selectedIndex = selected ? filtered.findIndex(r => r.id === selected.id) : -1;
|
|
134
|
-
const stepTo = index => {
|
|
135
|
-
const target = filtered[index];
|
|
136
|
-
if (target) setSelectedId(target.id);
|
|
137
|
-
};
|
|
138
|
-
|
|
139
|
-
// Set lookups so each row's badge checks are O(1).
|
|
140
|
-
const flagSets = {
|
|
141
|
-
scaleGaps: new Set(insights.scaleGaps),
|
|
142
|
-
scaleAnomalies: new Set(insights.scaleAnomalies),
|
|
143
|
-
duplicates: duplicateIds,
|
|
144
|
-
webpCandidates: new Set(insights.webpCandidates),
|
|
145
|
-
overDecode: new Set(insights.overDecode),
|
|
146
|
-
heavy: new Set([...insights.heavyGifs, ...insights.heavyFonts])
|
|
147
|
-
};
|
|
148
|
-
|
|
149
|
-
// The proportional size bar is relative to the largest asset in view.
|
|
150
|
-
let maxBytes = 0;
|
|
151
|
-
for (const r of filtered) {
|
|
152
|
-
const bytes = r.sizeBytes ?? (0, _assetStore.estDecodedBytes)(r);
|
|
153
|
-
if (bytes > maxBytes) maxBytes = bytes;
|
|
154
|
-
}
|
|
155
|
-
const getReport = () => selected ? (0, _export.formatAssetMarkdown)(selected) : (0, _export.formatInventoryMarkdown)(sorted, stats, insights, (0, _install.getScanStatus)(), (0, _baseline.getDiff)());
|
|
156
|
-
const headerContent = /*#__PURE__*/(0, _jsxRuntime.jsx)(_AssetsHeader.AssetsHeader, {
|
|
157
|
-
stats: stats,
|
|
158
|
-
measuring: status.measuring,
|
|
159
|
-
discovering: status.graphFetchInFlight,
|
|
160
|
-
detailOpen: selected != null,
|
|
161
|
-
detailIndex: selectedIndex,
|
|
162
|
-
detailTotal: filtered.length,
|
|
163
|
-
onCloseDetail: () => setSelectedId(null),
|
|
164
|
-
onClear: _assetStore.clearRecords,
|
|
165
|
-
getReport: getReport,
|
|
166
|
-
onBack: onBack
|
|
167
|
-
});
|
|
168
|
-
const body = selected ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
169
|
-
style: styles.detailContainer,
|
|
170
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_AssetDetail.AssetDetail, {
|
|
171
|
-
record: selected,
|
|
172
|
-
insights: insights
|
|
173
|
-
}), selectedIndex >= 0 ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.EventStepperFooter, {
|
|
174
|
-
currentIndex: selectedIndex,
|
|
175
|
-
totalItems: filtered.length,
|
|
176
|
-
itemLabel: "Asset",
|
|
177
|
-
onPrevious: () => stepTo(selectedIndex - 1),
|
|
178
|
-
onNext: () => stepTo(selectedIndex + 1)
|
|
179
|
-
}) : null]
|
|
180
|
-
}) : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
181
|
-
style: styles.listContainer,
|
|
182
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_AssetsFilterBar.AssetsFilterBar, {
|
|
183
|
-
stats: stats,
|
|
184
|
-
duplicateCount: duplicateIds.size,
|
|
185
|
-
filter: filter,
|
|
186
|
-
onChange: next => {
|
|
187
|
-
setFilter(next);
|
|
188
|
-
if (next === "duplicates") setQuery("");
|
|
189
|
-
}
|
|
190
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_AssetsListControls.AssetsListControls, {
|
|
191
|
-
query: query,
|
|
192
|
-
onQueryChange: setQuery,
|
|
193
|
-
sort: sort,
|
|
194
|
-
onSortChange: setSort
|
|
195
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ScanNotice.ScanNotice, {
|
|
196
|
-
status: status,
|
|
197
|
-
total: stats.total,
|
|
198
|
-
onRetry: retry
|
|
199
|
-
}), remoteError && !status.graphFetchInFlight ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
200
|
-
style: styles.notice,
|
|
201
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
202
|
-
style: styles.noticeText,
|
|
203
|
-
children: "Couldn't request an asset scan from the device."
|
|
204
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TouchableOpacity, {
|
|
205
|
-
accessibilityRole: "button",
|
|
206
|
-
onPress: retry,
|
|
207
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
208
|
-
style: styles.retryText,
|
|
209
|
-
children: "Retry"
|
|
210
|
-
})
|
|
211
|
-
})]
|
|
212
|
-
}) : null, filter === "unused" ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
213
|
-
style: styles.notice,
|
|
214
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
215
|
-
style: styles.noticeText,
|
|
216
|
-
children: "Not seen in React Native's asset registry this app run. Assets loaded through other paths may appear here; this does not prove they are unused."
|
|
217
|
-
})
|
|
218
|
-
}) : null, filter === "font" ? /*#__PURE__*/(0, _jsxRuntime.jsx)(FontFamilies, {
|
|
219
|
-
names: status.fontFamilies
|
|
220
|
-
}) : null, /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.FlatList, {
|
|
221
|
-
testID: _testIDs.ASSETS_TEST_IDS.list,
|
|
222
|
-
data: filtered,
|
|
223
|
-
keyExtractor: item => String(item.id),
|
|
224
|
-
contentContainerStyle: styles.listContent,
|
|
225
|
-
renderItem: ({
|
|
226
|
-
item
|
|
227
|
-
}) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_AssetRow.AssetRow, {
|
|
228
|
-
record: item,
|
|
229
|
-
flags: {
|
|
230
|
-
scaleGap: flagSets.scaleGaps.has(item.id),
|
|
231
|
-
scaleAnomaly: flagSets.scaleAnomalies.has(item.id),
|
|
232
|
-
duplicate: flagSets.duplicates.has(item.id),
|
|
233
|
-
webp: flagSets.webpCandidates.has(item.id),
|
|
234
|
-
oversize: flagSets.overDecode.has(item.id),
|
|
235
|
-
heavy: flagSets.heavy.has(item.id)
|
|
236
|
-
},
|
|
237
|
-
sizeFraction: maxBytes > 0 ? (item.sizeBytes ?? (0, _assetStore.estDecodedBytes)(item)) / maxBytes : 0
|
|
238
|
-
// Guarded: programmatic invocations (automation) can call this
|
|
239
|
-
// with an event object instead of an id.
|
|
240
|
-
,
|
|
241
|
-
onPress: id => setSelectedId(typeof id === "number" ? id : null)
|
|
242
|
-
}),
|
|
243
|
-
ListEmptyComponent: status.graphFetchInFlight ? null : /*#__PURE__*/(0, _jsxRuntime.jsx)(EmptyState, {
|
|
244
|
-
duplicates: filter === "duplicates"
|
|
245
|
-
})
|
|
246
|
-
})]
|
|
247
|
-
});
|
|
248
|
-
|
|
249
|
-
// The ONLY difference between phone and desktop is which shell the header
|
|
250
|
-
// and body go in (same pattern as ImagesModal).
|
|
251
|
-
if (inline) {
|
|
252
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
253
|
-
style: styles.inlineRoot,
|
|
254
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
255
|
-
style: styles.inlineHeader,
|
|
256
|
-
..._sharedUi.windowDragProps,
|
|
257
|
-
children: headerContent
|
|
258
|
-
}), body]
|
|
259
|
-
});
|
|
260
|
-
}
|
|
261
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.JsModal, {
|
|
262
|
-
visible: visible,
|
|
263
|
-
onClose: onClose,
|
|
264
|
-
onMinimize: onMinimize,
|
|
265
|
-
persistenceKey: persistenceKey,
|
|
266
|
-
header: {
|
|
267
|
-
showToggleButton: true,
|
|
268
|
-
customContent: headerContent
|
|
269
|
-
},
|
|
270
|
-
enablePersistence: true,
|
|
271
|
-
initialMode: "bottomSheet",
|
|
272
|
-
disableScrollWrapper: true,
|
|
273
|
-
children: body
|
|
274
|
-
});
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
/**
|
|
278
|
-
* The same Assets tool rendered INLINE for hosts that place tools in a panel
|
|
279
|
-
* rather than a modal (the desktop dashboard). One implementation only.
|
|
280
|
-
*/
|
|
281
|
-
function AssetsToolView(props = {}) {
|
|
282
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(AssetsModal, {
|
|
283
|
-
...props,
|
|
284
|
-
inline: true,
|
|
285
|
-
visible: true,
|
|
286
|
-
onClose: () => {}
|
|
287
|
-
});
|
|
288
|
-
}
|
|
289
|
-
const styles = _reactNative.StyleSheet.create({
|
|
290
|
-
inlineRoot: {
|
|
291
|
-
flex: 1,
|
|
292
|
-
minHeight: 0,
|
|
293
|
-
// Transparent so the desktop workbench's hoisted sky (one field spanning
|
|
294
|
-
// sidebar + panel) shows through — the shell paints its base beneath it.
|
|
295
|
-
backgroundColor: "transparent"
|
|
296
|
-
},
|
|
297
|
-
inlineHeader: {
|
|
298
|
-
paddingHorizontal: 12,
|
|
299
|
-
paddingVertical: 8,
|
|
300
|
-
borderBottomWidth: 1,
|
|
301
|
-
borderBottomColor: _sharedUi.macOSColors.border.default,
|
|
302
|
-
// Clear, like Bench — the host's hoisted sky shows through the header.
|
|
303
|
-
backgroundColor: "transparent"
|
|
304
|
-
},
|
|
305
|
-
listContainer: {
|
|
306
|
-
flex: 1
|
|
307
|
-
},
|
|
308
|
-
listContent: {
|
|
309
|
-
paddingBottom: 16
|
|
310
|
-
},
|
|
311
|
-
detailContainer: {
|
|
312
|
-
flex: 1
|
|
313
|
-
},
|
|
314
|
-
notice: {
|
|
315
|
-
marginHorizontal: 10,
|
|
316
|
-
marginBottom: 8,
|
|
317
|
-
padding: 10,
|
|
318
|
-
borderRadius: 8,
|
|
319
|
-
borderWidth: 1,
|
|
320
|
-
borderColor: _sharedUi.night.color.border,
|
|
321
|
-
backgroundColor: _sharedUi.night.color.surface,
|
|
322
|
-
gap: 4
|
|
323
|
-
},
|
|
324
|
-
noticeText: {
|
|
325
|
-
color: _sharedUi.night.color.textSecondary,
|
|
326
|
-
fontSize: 11
|
|
327
|
-
},
|
|
328
|
-
retryText: {
|
|
329
|
-
color: _sharedUi.night.color.text,
|
|
330
|
-
fontSize: 12,
|
|
331
|
-
paddingVertical: 6
|
|
332
|
-
},
|
|
333
|
-
fontsBox: {
|
|
334
|
-
marginHorizontal: 10,
|
|
335
|
-
marginTop: 8,
|
|
336
|
-
padding: 10,
|
|
337
|
-
borderRadius: 8,
|
|
338
|
-
backgroundColor: _sharedUi.night.color.surface,
|
|
339
|
-
gap: 6
|
|
340
|
-
},
|
|
341
|
-
fontsTitle: {
|
|
342
|
-
color: _sharedUi.night.color.textTertiary,
|
|
343
|
-
fontSize: 9,
|
|
344
|
-
fontWeight: "700",
|
|
345
|
-
letterSpacing: 0.5
|
|
346
|
-
},
|
|
347
|
-
fontsWrap: {
|
|
348
|
-
flexDirection: "row",
|
|
349
|
-
flexWrap: "wrap",
|
|
350
|
-
gap: 6
|
|
351
|
-
},
|
|
352
|
-
fontChip: {
|
|
353
|
-
color: _sharedUi.night.color.textSecondary,
|
|
354
|
-
fontSize: 10,
|
|
355
|
-
backgroundColor: _sharedUi.night.color.bg,
|
|
356
|
-
borderRadius: 999,
|
|
357
|
-
paddingHorizontal: 8,
|
|
358
|
-
paddingVertical: 3,
|
|
359
|
-
overflow: "hidden"
|
|
360
|
-
},
|
|
361
|
-
empty: {
|
|
362
|
-
alignItems: "center",
|
|
363
|
-
padding: 32,
|
|
364
|
-
gap: 8
|
|
365
|
-
},
|
|
366
|
-
emptyTitle: {
|
|
367
|
-
color: _sharedUi.night.color.text,
|
|
368
|
-
fontSize: 13,
|
|
369
|
-
fontWeight: "600"
|
|
370
|
-
},
|
|
371
|
-
emptyText: {
|
|
372
|
-
color: _sharedUi.night.color.textSecondary,
|
|
373
|
-
fontSize: 11,
|
|
374
|
-
textAlign: "center",
|
|
375
|
-
lineHeight: 16
|
|
376
|
-
}
|
|
377
|
-
});
|
|
378
|
-
//# sourceMappingURL=AssetsModal.js.map
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.AssetsModal=AssetsModal;exports.AssetsToolView=AssetsToolView;var _react=require("react");var _reactNative=require("react-native");var _sharedUi=require("@buoy-gg/shared-ui");var _install=require("../capture/install");var _export=require("../export");var _useAssetRecords=require("../hooks/useAssetRecords");var _useAssetScanStatus=require("../hooks/useAssetScanStatus");var _remote=require("../remote");var _assetStore=require("../store/assetStore");var _baseline=require("../store/baseline");var _AssetDetail=require("./AssetDetail");var _AssetRow=require("./AssetRow");var _AssetsFilterBar=require("./AssetsFilterBar");var _AssetsHeader=require("./AssetsHeader");var _AssetsListControls=require("./AssetsListControls");var _ScanNotice=require("./ScanNotice");var _testIDs=require("../utils/testIDs");var _jsxRuntime=require("react/jsx-runtime");function FontFamilies({names:t}){const s=[...new Set(t)];if(!s.length)return null;return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.fontsBox,testID:_testIDs.ASSETS_TEST_IDS.fonts,children:[(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:styles.fontsTitle,testID:_testIDs.ASSETS_TEST_IDS.fontsTitle,children:["LOADED FONT FAMILIES (",s.length,")"]}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.fontsWrap,children:s.map(d=>(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.fontChip,testID:(0,_testIDs.assetFontChipTestID)(d),children:d},d))})]})}function EmptyState({duplicates:t=false}){return(0,_jsxRuntime.jsx)(_sharedUi.ToolEmptyState,{testID:_testIDs.ASSETS_TEST_IDS.empty,otto:"scanning",title:t?"No duplicates found":"No assets found yet",message:t?"No assets in this view share a content hash.":"Every bundled asset \u2014 images, fonts, video, audio \u2014 appears here with sizes, scale coverage, and runtime registration status. Try Rescan after navigating around the app."})}function bySizeDesc(t,s){return(s.sizeBytes??(0,_assetStore.estDecodedBytes)(s))-(t.sizeBytes??(0,_assetStore.estDecodedBytes)(t))}const COMPARATORS={size:bySizeDesc,name:(t,s)=>t.name.localeCompare(s.name)||t.type.localeCompare(s.type),type:(t,s)=>t.type.localeCompare(s.type)||bySizeDesc(t,s)};function AssetsModal({visible:t,onClose:s,onBack:d,onMinimize:j,persistenceKey:I,inline:_=false}){(0,_install.installAssetCapture)();const{records:R,stats:p,insights:o}=(0,_useAssetRecords.useAssetRecords)();const n=(0,_useAssetScanStatus.useAssetScanStatus)();const[z,u]=(0,_react.useState)(false);(0,_react.useEffect)(()=>{u(false)},[n.graphFetchInFlight,n.lastScanAt]);const S=()=>{u(false);const e=(0,_remote.remoteAssetsDispatch)();if(e)void e("rescan").catch(()=>u(true));else void(0,_install.rescan)()};const[x,f]=(0,_react.useState)(null);const[r,F]=(0,_react.useState)("all");const[m,v]=(0,_react.useState)("");const[A,q]=(0,_react.useState)("size");const i=x!=null?(0,_assetStore.getRecord)(x):void 0;(0,_react.useEffect)(()=>{if(!t)return;void(0,_baseline.loadBaseline)();u(false);const e=(0,_remote.remoteAssetsDispatch)();if(e){e("rescan").catch(()=>u(true))}else{void(0,_install.rescan)()}},[t]);const y=new Set(o.duplicates.flatMap(e=>e.ids));const C=[...R].sort(COMPARATORS[A]);const T=m.trim().toLowerCase();const l=C.filter(e=>{if(r==="unused"&&e.loaded)return false;if(r==="duplicates"&&!y.has(e.id))return false;if(r!=="all"&&r!=="unused"&&r!=="duplicates"&&e.kind!==r)return false;if(T&&!`${e.name}.${e.type}`.toLowerCase().includes(T)){return false}return true});const h=i?l.findIndex(e=>e.id===i.id):-1;const w=e=>{const a=l[e];if(a)f(a.id)};const c={scaleGaps:new Set(o.scaleGaps),scaleAnomalies:new Set(o.scaleAnomalies),duplicates:y,webpCandidates:new Set(o.webpCandidates),overDecode:new Set(o.overDecode),heavy:new Set([...o.heavyGifs,...o.heavyFonts])};let g=0;for(const e of l){const a=e.sizeBytes??(0,_assetStore.estDecodedBytes)(e);if(a>g)g=a}const B=()=>i?(0,_export.formatAssetMarkdown)(i):(0,_export.formatInventoryMarkdown)(C,p,o,(0,_install.getScanStatus)(),(0,_baseline.getDiff)());const b=(0,_jsxRuntime.jsx)(_AssetsHeader.AssetsHeader,{stats:p,measuring:n.measuring,discovering:n.graphFetchInFlight,detailOpen:i!=null,detailIndex:h,detailTotal:l.length,onCloseDetail:()=>f(null),onClear:_assetStore.clearRecords,getReport:B,onBack:d});const D=i?(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.detailContainer,children:[(0,_jsxRuntime.jsx)(_AssetDetail.AssetDetail,{record:i,insights:o}),h>=0?(0,_jsxRuntime.jsx)(_sharedUi.EventStepperFooter,{currentIndex:h,totalItems:l.length,itemLabel:"Asset",onPrevious:()=>w(h-1),onNext:()=>w(h+1)}):null]}):(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.listContainer,children:[(0,_jsxRuntime.jsx)(_AssetsFilterBar.AssetsFilterBar,{stats:p,duplicateCount:y.size,filter:r,onChange:e=>{F(e);if(e==="duplicates")v("")}}),(0,_jsxRuntime.jsx)(_AssetsListControls.AssetsListControls,{query:m,onQueryChange:v,sort:A,onSortChange:q}),(0,_jsxRuntime.jsx)(_ScanNotice.ScanNotice,{status:n,total:p.total,onRetry:S}),z&&!n.graphFetchInFlight?(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.notice,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.noticeText,children:"Couldn't request an asset scan from the device."}),(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{accessibilityRole:"button",onPress:S,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.retryText,children:"Retry"})})]}):null,r==="unused"?(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.notice,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.noticeText,children:"Not seen in React Native's asset registry this app run. Assets loaded through other paths may appear here; this does not prove they are unused."})}):null,r==="font"?(0,_jsxRuntime.jsx)(FontFamilies,{names:n.fontFamilies}):null,(0,_jsxRuntime.jsx)(_reactNative.FlatList,{testID:_testIDs.ASSETS_TEST_IDS.list,data:l,keyExtractor:e=>String(e.id),contentContainerStyle:styles.listContent,renderItem:({item:e})=>(0,_jsxRuntime.jsx)(_AssetRow.AssetRow,{record:e,flags:{scaleGap:c.scaleGaps.has(e.id),scaleAnomaly:c.scaleAnomalies.has(e.id),duplicate:c.duplicates.has(e.id),webp:c.webpCandidates.has(e.id),oversize:c.overDecode.has(e.id),heavy:c.heavy.has(e.id)},sizeFraction:g>0?(e.sizeBytes??(0,_assetStore.estDecodedBytes)(e))/g:0,onPress:a=>f(typeof a==="number"?a:null)}),ListEmptyComponent:n.graphFetchInFlight?null:(0,_jsxRuntime.jsx)(EmptyState,{duplicates:r==="duplicates"})})]});if(_){return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.inlineRoot,children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.inlineHeader,..._sharedUi.windowDragProps,children:b}),D]})}return(0,_jsxRuntime.jsx)(_sharedUi.JsModal,{visible:t,onClose:s,onMinimize:j,persistenceKey:I,header:{showToggleButton:true,customContent:b},enablePersistence:true,initialMode:"bottomSheet",disableScrollWrapper:true,children:D})}function AssetsToolView(t={}){return(0,_jsxRuntime.jsx)(AssetsModal,{...t,inline:true,visible:true,onClose:()=>{}})}const styles=_reactNative.StyleSheet.create({inlineRoot:{flex:1,minHeight:0,backgroundColor:"transparent"},inlineHeader:{paddingHorizontal:12,paddingVertical:8,borderBottomWidth:1,borderBottomColor:_sharedUi.macOSColors.border.default,backgroundColor:"transparent"},listContainer:{flex:1},listContent:{paddingBottom:16},detailContainer:{flex:1},notice:{marginHorizontal:10,marginBottom:8,padding:10,borderRadius:8,borderWidth:1,borderColor:_sharedUi.night.color.border,backgroundColor:_sharedUi.night.color.surface,gap:4},noticeText:{color:_sharedUi.night.color.textSecondary,fontSize:11},retryText:{color:_sharedUi.night.color.text,fontSize:12,paddingVertical:6},fontsBox:{marginHorizontal:10,marginTop:8,padding:10,borderRadius:8,backgroundColor:_sharedUi.night.color.surface,gap:6},fontsTitle:{color:_sharedUi.night.color.textTertiary,fontSize:9,fontWeight:"700",letterSpacing:.5},fontsWrap:{flexDirection:"row",flexWrap:"wrap",gap:6},fontChip:{color:_sharedUi.night.color.textSecondary,fontSize:10,backgroundColor:_sharedUi.night.color.bg,borderRadius:999,paddingHorizontal:8,paddingVertical:3,overflow:"hidden"},empty:{alignItems:"center",padding:32,gap:8},emptyTitle:{color:_sharedUi.night.color.text,fontSize:13,fontWeight:"600"},emptyText:{color:_sharedUi.night.color.textSecondary,fontSize:11,textAlign:"center",lineHeight:16}});
|
|
@@ -1,86 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.ScanNotice = ScanNotice;
|
|
7
|
-
var _react = require("react");
|
|
8
|
-
var _reactNative = require("react-native");
|
|
9
|
-
var _sharedUi = require("@buoy-gg/shared-ui");
|
|
10
|
-
var _testIDs = require("../utils/testIDs");
|
|
11
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
|
-
function ScanNotice({
|
|
13
|
-
status,
|
|
14
|
-
total,
|
|
15
|
-
onRetry
|
|
16
|
-
}) {
|
|
17
|
-
const [slow, setSlow] = (0, _react.useState)(false);
|
|
18
|
-
(0, _react.useEffect)(() => {
|
|
19
|
-
setSlow(false);
|
|
20
|
-
if (!status.graphFetchInFlight) return;
|
|
21
|
-
// Start locally for older snapshots that omit the device timestamp.
|
|
22
|
-
const elapsed = status.graphFetchStartedAt == null ? 0 : Math.max(0, Date.now() - status.graphFetchStartedAt);
|
|
23
|
-
const timer = setTimeout(() => setSlow(true), Math.max(0, 8_000 - elapsed));
|
|
24
|
-
return () => clearTimeout(timer);
|
|
25
|
-
}, [status.graphFetchInFlight, status.graphFetchStartedAt]);
|
|
26
|
-
const notices = [];
|
|
27
|
-
if (status.browser && !status.graphSupported) notices.push('Showing resources this page has loaded. Add an asset manifest to include files the page has not requested.');
|
|
28
|
-
if (status.graphFetchInFlight) {
|
|
29
|
-
notices.push(`Finding assets… ${total} found so far.`);
|
|
30
|
-
if (slow) notices.push("Still finding assets. This is taking longer than usual.");
|
|
31
|
-
}
|
|
32
|
-
if (!status.registryAvailable) {
|
|
33
|
-
notices.push("The asset registry is unavailable in this environment.");
|
|
34
|
-
}
|
|
35
|
-
if (!status.graphFetchInFlight && !status.graphSupported && status.graphError) {
|
|
36
|
-
notices.push("Showing runtime-registered assets only. A development server is needed to find more assets and measure their sizes.");
|
|
37
|
-
}
|
|
38
|
-
const failed = !status.graphFetchInFlight && status.graphSupported && !!status.graphError;
|
|
39
|
-
if (failed) notices.push(`Couldn't finish finding assets. Showing ${total} assets found so far.`);
|
|
40
|
-
if (status.measuring && !status.graphFetchInFlight) notices.push("Checking asset sizes…");
|
|
41
|
-
if (notices.length === 0) return null;
|
|
42
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
43
|
-
style: styles.notice,
|
|
44
|
-
testID: _testIDs.ASSETS_TEST_IDS.notice,
|
|
45
|
-
children: [status.graphFetchInFlight ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.ActivityIndicator, {
|
|
46
|
-
size: "small",
|
|
47
|
-
color: _sharedUi.night.color.textSecondary,
|
|
48
|
-
accessibilityLabel: "Finding assets",
|
|
49
|
-
testID: _testIDs.ASSETS_TEST_IDS.discoverySpinner
|
|
50
|
-
}) : null, notices.map(n => /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
51
|
-
style: styles.noticeText,
|
|
52
|
-
testID: _testIDs.ASSETS_TEST_IDS.noticeText,
|
|
53
|
-
children: n
|
|
54
|
-
}, n)), failed ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TouchableOpacity, {
|
|
55
|
-
accessibilityRole: "button",
|
|
56
|
-
onPress: onRetry,
|
|
57
|
-
testID: _testIDs.ASSETS_TEST_IDS.retry,
|
|
58
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
59
|
-
style: styles.retryText,
|
|
60
|
-
children: "Retry"
|
|
61
|
-
})
|
|
62
|
-
}) : null]
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
const styles = _reactNative.StyleSheet.create({
|
|
66
|
-
notice: {
|
|
67
|
-
marginHorizontal: 10,
|
|
68
|
-
marginBottom: 8,
|
|
69
|
-
padding: 10,
|
|
70
|
-
borderRadius: 8,
|
|
71
|
-
borderWidth: 1,
|
|
72
|
-
borderColor: _sharedUi.night.color.border,
|
|
73
|
-
backgroundColor: _sharedUi.night.color.surface,
|
|
74
|
-
gap: 4
|
|
75
|
-
},
|
|
76
|
-
noticeText: {
|
|
77
|
-
color: _sharedUi.night.color.textSecondary,
|
|
78
|
-
fontSize: 11
|
|
79
|
-
},
|
|
80
|
-
retryText: {
|
|
81
|
-
color: _sharedUi.night.color.text,
|
|
82
|
-
fontSize: 12,
|
|
83
|
-
paddingVertical: 6
|
|
84
|
-
}
|
|
85
|
-
});
|
|
86
|
-
//# sourceMappingURL=ScanNotice.js.map
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.ScanNotice=ScanNotice;var _react=require("react");var _reactNative=require("react-native");var _sharedUi=require("@buoy-gg/shared-ui");var _testIDs=require("../utils/testIDs");var _jsxRuntime=require("react/jsx-runtime");function ScanNotice({status:e,total:i,onRetry:s}){const[a,n]=(0,_react.useState)(false);(0,_react.useEffect)(()=>{n(false);if(!e.graphFetchInFlight)return;const t=e.graphFetchStartedAt==null?0:Math.max(0,Date.now()-e.graphFetchStartedAt);const h=setTimeout(()=>n(true),Math.max(0,8e3-t));return()=>clearTimeout(h)},[e.graphFetchInFlight,e.graphFetchStartedAt]);const r=[];if(e.browser&&!e.graphSupported)r.push("Showing resources this page has loaded. Add an asset manifest to include files the page has not requested.");if(e.graphFetchInFlight){r.push(`Finding assets\u2026 ${i} found so far.`);if(a)r.push("Still finding assets. This is taking longer than usual.")}if(!e.registryAvailable){r.push("The asset registry is unavailable in this environment.")}if(!e.graphFetchInFlight&&!e.graphSupported&&e.graphError){r.push("Showing runtime-registered assets only. A development server is needed to find more assets and measure their sizes.")}const o=!e.graphFetchInFlight&&e.graphSupported&&!!e.graphError;if(o)r.push(`Couldn't finish finding assets. Showing ${i} assets found so far.`);if(e.measuring&&!e.graphFetchInFlight)r.push("Checking asset sizes\u2026");if(r.length===0)return null;return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.notice,testID:_testIDs.ASSETS_TEST_IDS.notice,children:[e.graphFetchInFlight?(0,_jsxRuntime.jsx)(_reactNative.ActivityIndicator,{size:"small",color:_sharedUi.night.color.textSecondary,accessibilityLabel:"Finding assets",testID:_testIDs.ASSETS_TEST_IDS.discoverySpinner}):null,r.map(t=>(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.noticeText,testID:_testIDs.ASSETS_TEST_IDS.noticeText,children:t},t)),o?(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{accessibilityRole:"button",onPress:s,testID:_testIDs.ASSETS_TEST_IDS.retry,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.retryText,children:"Retry"})}):null]})}const styles=_reactNative.StyleSheet.create({notice:{marginHorizontal:10,marginBottom:8,padding:10,borderRadius:8,borderWidth:1,borderColor:_sharedUi.night.color.border,backgroundColor:_sharedUi.night.color.surface,gap:4},noticeText:{color:_sharedUi.night.color.textSecondary,fontSize:11},retryText:{color:_sharedUi.night.color.text,fontSize:12,paddingVertical:6}});
|