@buoy-gg/assets 7.0.38 → 7.0.39

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.
Files changed (161) hide show
  1. package/lib/commonjs/capture/expo.js +46 -1
  2. package/lib/commonjs/capture/expo.js.map +1 -0
  3. package/lib/commonjs/capture/install.js +91 -1
  4. package/lib/commonjs/capture/install.js.map +1 -0
  5. package/lib/commonjs/capture/isBuoyAsset.js +23 -1
  6. package/lib/commonjs/capture/isBuoyAsset.js.map +1 -0
  7. package/lib/commonjs/capture/measure.js +186 -1
  8. package/lib/commonjs/capture/measure.js.map +1 -0
  9. package/lib/commonjs/capture/metroGraph.js +175 -1
  10. package/lib/commonjs/capture/metroGraph.js.map +1 -0
  11. package/lib/commonjs/capture/registry.js +127 -1
  12. package/lib/commonjs/capture/registry.js.map +1 -0
  13. package/lib/commonjs/components/AssetDetail.js +211 -1
  14. package/lib/commonjs/components/AssetDetail.js.map +1 -0
  15. package/lib/commonjs/components/AssetImage.js +66 -1
  16. package/lib/commonjs/components/AssetImage.js.map +1 -0
  17. package/lib/commonjs/components/AssetRow.js +232 -1
  18. package/lib/commonjs/components/AssetRow.js.map +1 -0
  19. package/lib/commonjs/components/AssetsFilterBar.js +105 -1
  20. package/lib/commonjs/components/AssetsFilterBar.js.map +1 -0
  21. package/lib/commonjs/components/AssetsHeader.js +73 -1
  22. package/lib/commonjs/components/AssetsHeader.js.map +1 -0
  23. package/lib/commonjs/components/AssetsIcon.js +19 -1
  24. package/lib/commonjs/components/AssetsIcon.js.map +1 -0
  25. package/lib/commonjs/components/AssetsListControls.js +81 -1
  26. package/lib/commonjs/components/AssetsListControls.js.map +1 -0
  27. package/lib/commonjs/components/AssetsModal.js +378 -1
  28. package/lib/commonjs/components/AssetsModal.js.map +1 -0
  29. package/lib/commonjs/components/ScanNotice.js +85 -1
  30. package/lib/commonjs/components/ScanNotice.js.map +1 -0
  31. package/lib/commonjs/components/optionalExpoImage.js +16 -1
  32. package/lib/commonjs/components/optionalExpoImage.js.map +1 -0
  33. package/lib/commonjs/components/optionalExpoImage.web.js +11 -1
  34. package/lib/commonjs/components/optionalExpoImage.web.js.map +1 -0
  35. package/lib/commonjs/export.js +62 -1
  36. package/lib/commonjs/export.js.map +1 -0
  37. package/lib/commonjs/format.js +59 -1
  38. package/lib/commonjs/format.js.map +1 -0
  39. package/lib/commonjs/hooks/useAssetRecords.js +22 -1
  40. package/lib/commonjs/hooks/useAssetRecords.js.map +1 -0
  41. package/lib/commonjs/hooks/useAssetScanStatus.js +28 -1
  42. package/lib/commonjs/hooks/useAssetScanStatus.js.map +1 -0
  43. package/lib/commonjs/index.js +313 -1
  44. package/lib/commonjs/index.js.map +1 -0
  45. package/lib/commonjs/preset.js +39 -1
  46. package/lib/commonjs/preset.js.map +1 -0
  47. package/lib/commonjs/remote.js +68 -1
  48. package/lib/commonjs/remote.js.map +1 -0
  49. package/lib/commonjs/state.js +51 -1
  50. package/lib/commonjs/state.js.map +1 -0
  51. package/lib/commonjs/store/assetStore.js +256 -1
  52. package/lib/commonjs/store/assetStore.js.map +1 -0
  53. package/lib/commonjs/store/baseline.js +175 -1
  54. package/lib/commonjs/store/baseline.js.map +1 -0
  55. package/lib/commonjs/store/insights.js +120 -1
  56. package/lib/commonjs/store/insights.js.map +1 -0
  57. package/lib/commonjs/sync/assetsSyncAdapter.js +157 -1
  58. package/lib/commonjs/sync/assetsSyncAdapter.js.map +1 -0
  59. package/lib/commonjs/types.js +2 -1
  60. package/lib/commonjs/types.js.map +1 -0
  61. package/lib/commonjs/utils/deviceScale.js +50 -1
  62. package/lib/commonjs/utils/deviceScale.js.map +1 -0
  63. package/lib/commonjs/utils/testIDs.js +110 -1
  64. package/lib/commonjs/utils/testIDs.js.map +1 -0
  65. package/lib/module/capture/expo.js +41 -1
  66. package/lib/module/capture/expo.js.map +1 -0
  67. package/lib/module/capture/install.js +85 -1
  68. package/lib/module/capture/install.js.map +1 -0
  69. package/lib/module/capture/isBuoyAsset.js +18 -1
  70. package/lib/module/capture/isBuoyAsset.js.map +1 -0
  71. package/lib/module/capture/measure.js +179 -1
  72. package/lib/module/capture/measure.js.map +1 -0
  73. package/lib/module/capture/metroGraph.js +168 -1
  74. package/lib/module/capture/metroGraph.js.map +1 -0
  75. package/lib/module/capture/registry.js +120 -1
  76. package/lib/module/capture/registry.js.map +1 -0
  77. package/lib/module/components/AssetDetail.js +207 -1
  78. package/lib/module/components/AssetDetail.js.map +1 -0
  79. package/lib/module/components/AssetImage.js +62 -1
  80. package/lib/module/components/AssetImage.js.map +1 -0
  81. package/lib/module/components/AssetRow.js +228 -1
  82. package/lib/module/components/AssetRow.js.map +1 -0
  83. package/lib/module/components/AssetsFilterBar.js +101 -1
  84. package/lib/module/components/AssetsFilterBar.js.map +1 -0
  85. package/lib/module/components/AssetsHeader.js +69 -1
  86. package/lib/module/components/AssetsHeader.js.map +1 -0
  87. package/lib/module/components/AssetsIcon.js +12 -1
  88. package/lib/module/components/AssetsIcon.js.map +1 -0
  89. package/lib/module/components/AssetsListControls.js +77 -1
  90. package/lib/module/components/AssetsListControls.js.map +1 -0
  91. package/lib/module/components/AssetsModal.js +373 -1
  92. package/lib/module/components/AssetsModal.js.map +1 -0
  93. package/lib/module/components/ScanNotice.js +81 -1
  94. package/lib/module/components/ScanNotice.js.map +1 -0
  95. package/lib/module/components/optionalExpoImage.js +12 -1
  96. package/lib/module/components/optionalExpoImage.js.map +1 -0
  97. package/lib/module/components/optionalExpoImage.web.js +7 -1
  98. package/lib/module/components/optionalExpoImage.web.js.map +1 -0
  99. package/lib/module/export.js +57 -1
  100. package/lib/module/export.js.map +1 -0
  101. package/lib/module/format.js +51 -1
  102. package/lib/module/format.js.map +1 -0
  103. package/lib/module/hooks/useAssetRecords.js +18 -1
  104. package/lib/module/hooks/useAssetRecords.js.map +1 -0
  105. package/lib/module/hooks/useAssetScanStatus.js +23 -1
  106. package/lib/module/hooks/useAssetScanStatus.js.map +1 -0
  107. package/lib/module/index.js +63 -1
  108. package/lib/module/index.js.map +1 -0
  109. package/lib/module/preset.js +35 -1
  110. package/lib/module/preset.js.map +1 -0
  111. package/lib/module/remote.js +61 -1
  112. package/lib/module/remote.js.map +1 -0
  113. package/lib/module/state.js +47 -1
  114. package/lib/module/state.js.map +1 -0
  115. package/lib/module/store/assetStore.js +240 -1
  116. package/lib/module/store/assetStore.js.map +1 -0
  117. package/lib/module/store/baseline.js +167 -1
  118. package/lib/module/store/baseline.js.map +1 -0
  119. package/lib/module/store/insights.js +116 -1
  120. package/lib/module/store/insights.js.map +1 -0
  121. package/lib/module/sync/assetsSyncAdapter.js +153 -1
  122. package/lib/module/sync/assetsSyncAdapter.js.map +1 -0
  123. package/lib/module/types.js +2 -1
  124. package/lib/module/types.js.map +1 -0
  125. package/lib/module/utils/deviceScale.js +46 -1
  126. package/lib/module/utils/deviceScale.js.map +1 -0
  127. package/lib/module/utils/testIDs.js +99 -1
  128. package/lib/module/utils/testIDs.js.map +1 -0
  129. package/lib/typescript/capture/expo.d.ts.map +1 -0
  130. package/lib/typescript/capture/install.d.ts.map +1 -0
  131. package/lib/typescript/capture/isBuoyAsset.d.ts.map +1 -0
  132. package/lib/typescript/capture/measure.d.ts.map +1 -0
  133. package/lib/typescript/capture/metroGraph.d.ts.map +1 -0
  134. package/lib/typescript/capture/registry.d.ts.map +1 -0
  135. package/lib/typescript/components/AssetDetail.d.ts.map +1 -0
  136. package/lib/typescript/components/AssetImage.d.ts.map +1 -0
  137. package/lib/typescript/components/AssetRow.d.ts.map +1 -0
  138. package/lib/typescript/components/AssetsFilterBar.d.ts.map +1 -0
  139. package/lib/typescript/components/AssetsHeader.d.ts.map +1 -0
  140. package/lib/typescript/components/AssetsIcon.d.ts.map +1 -0
  141. package/lib/typescript/components/AssetsListControls.d.ts.map +1 -0
  142. package/lib/typescript/components/AssetsModal.d.ts.map +1 -0
  143. package/lib/typescript/components/ScanNotice.d.ts.map +1 -0
  144. package/lib/typescript/components/optionalExpoImage.d.ts.map +1 -0
  145. package/lib/typescript/components/optionalExpoImage.web.d.ts.map +1 -0
  146. package/lib/typescript/export.d.ts.map +1 -0
  147. package/lib/typescript/format.d.ts.map +1 -0
  148. package/lib/typescript/hooks/useAssetRecords.d.ts.map +1 -0
  149. package/lib/typescript/hooks/useAssetScanStatus.d.ts.map +1 -0
  150. package/lib/typescript/index.d.ts.map +1 -0
  151. package/lib/typescript/preset.d.ts.map +1 -0
  152. package/lib/typescript/remote.d.ts.map +1 -0
  153. package/lib/typescript/state.d.ts.map +1 -0
  154. package/lib/typescript/store/assetStore.d.ts.map +1 -0
  155. package/lib/typescript/store/baseline.d.ts.map +1 -0
  156. package/lib/typescript/store/insights.d.ts.map +1 -0
  157. package/lib/typescript/sync/assetsSyncAdapter.d.ts.map +1 -0
  158. package/lib/typescript/types.d.ts.map +1 -0
  159. package/lib/typescript/utils/deviceScale.d.ts.map +1 -0
  160. package/lib/typescript/utils/testIDs.d.ts.map +1 -0
  161. package/package.json +2 -2
@@ -1 +1,207 @@
1
- "use strict";import{ScrollView,StyleSheet,Text,View}from"react-native";import{night}from"@buoy-gg/shared-ui";import{AssetImage}from"./AssetImage";import{formatBytes,formatDimensions,formatScales}from"../format";import{estDecodedBytes}from"../store/assetStore";import{ASSETS_TEST_IDS,assetDetailRowTestID,assetFindingTestID}from"../utils/testIDs";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";function Row({label:e,value:t}){const s=assetDetailRowTestID(e);return _jsxs(View,{style:styles.kvRow,testID:s,children:[_jsx(Text,{style:styles.kvLabel,children:e}),_jsx(Text,{style:styles.kvValue,selectable:!0,testID:`${s}-value`,children:t})]})}function Preview({record:e}){return"image"===e.kind?_jsx(View,{style:styles.previewBox,testID:ASSETS_TEST_IDS.detailPreview,children:_jsx(AssetImage,{testID:"buoy-internal-assets-preview",record:e,style:styles.previewImage})}):"font"===e.kind?_jsx(View,{style:styles.previewBox,testID:ASSETS_TEST_IDS.detailFontPreview,children:_jsx(Text,{style:[styles.fontPreview,{fontFamily:e.name}],children:"The quick brown fox jumps over the lazy dog 0123456789"})}):null}export function AssetDetail({record:e,insights:t}){const s=[];t.neverLoaded.includes(e.id)&&s.push("Not observed in the runtime registry this app run. This does not prove the asset is unused."),t.scaleGaps.includes(e.id)&&s.push("Scale gap — no variant covers this device's pixel ratio"),t.webpCandidates.includes(e.id)&&s.push("WebP candidate — large png/jpeg, converting typically saves 20–40%");const i=t.duplicates.find(t=>t.ids.includes(e.id));i&&s.push(`Duplicate content — identical bytes shipped ${i.ids.length} times`),t.overDecode.includes(e.id)&&s.push("Decodes larger than 2× this entire screen — resize the source, no view can need this many pixels"),t.heavyGifs.includes(e.id)&&s.push("Heavy GIF — every frame decodes into memory; a video or Lottie is typically ~90% smaller"),t.heavyFonts.includes(e.id)&&s.push("Heavy font — likely an unsubset icon font; subsetting to used glyphs usually saves most of it"),t.scaleAnomalies.includes(e.id)&&s.push("Scale anomaly — a higher-resolution variant is smaller in bytes than a lower one; check the exports");const l=estDecodedBytes(e);return _jsxs(ScrollView,{style:styles.scroll,contentContainerStyle:styles.content,testID:ASSETS_TEST_IDS.detailScroll,children:[_jsx(Preview,{record:e}),s.length>0?_jsx(View,{style:styles.findings,testID:ASSETS_TEST_IDS.detailFindings,children:s.map((e,t)=>_jsx(Text,{style:styles.findingText,testID:assetFindingTestID(t),children:e},e))}):null,_jsx(Row,{label:"Name",value:`${e.name}.${e.type}`}),_jsx(Row,{label:"Kind",value:e.kind}),_jsx(Row,{label:"Status",value:e.loaded?"Loaded (registered at runtime)":"Not observed in the runtime registry"}),"image"===e.kind?_jsx(Row,{label:"Dimensions",value:`${formatDimensions(e)} (logical)`}):null,"image"===e.kind&&e.scales.length?_jsx(Row,{label:"Scales",value:formatScales(e.scales)}):null,e.sizesByScale?Object.entries(e.sizesByScale).map(([e,t])=>_jsx(Row,{label:`Size @${e}x`,value:formatBytes(t)},e)):null,null!=e.sizeBytes&&"measured"===e.sizeSource?_jsx(Row,{label:"Total size",value:formatBytes(e.sizeBytes)}):null,l>0?_jsx(Row,{label:"Decoded memory",value:`~${formatBytes(l)} (RGBA)`}):null,null!=e.registryId?_jsx(Row,{label:"Registry id",value:String(e.registryId)}):null,e.hash?_jsx(Row,{label:"Hash",value:e.hash}):null,e.httpServerLocation?_jsx(Row,{label:"Location",value:e.httpServerLocation}):null,e.fileSystemLocation?_jsx(Row,{label:"Source dir",value:e.fileSystemLocation}):null,e.resolvedUri?_jsx(Row,{label:"Resolved URI",value:e.resolvedUri}):null]})}const styles=StyleSheet.create({scroll:{flex:1},content:{padding:12,gap:8},previewBox:{borderRadius:8,backgroundColor:night.color.bg,padding:12,alignItems:"center",justifyContent:"center",minHeight:96},previewImage:{width:"100%",height:140},fontPreview:{color:night.color.text,fontSize:16,textAlign:"center"},findings:{borderRadius:8,borderWidth:1,borderColor:night.color.border,backgroundColor:night.color.surface,padding:10,gap:6},findingText:{color:night.color.textSecondary,fontSize:11,lineHeight:15},kvRow:{gap:2},kvLabel:{color:night.color.textTertiary,fontSize:9,fontWeight:"700",letterSpacing:.5,textTransform:"uppercase"},kvValue:{color:night.color.text,fontSize:12}});
1
+ "use strict";
2
+
3
+ /**
4
+ * AssetDetail — full metadata for one asset: preview, identity, dimensions,
5
+ * per-scale sizes, resolution info, and which audit findings apply.
6
+ *
7
+ * Image previews use registry ids or asset URLs, with optional expo-image for
8
+ * native SVGs; fonts render a pangram with fontFamily set to the asset name
9
+ * — a best-effort guess (family ≠ filename for many fonts) that falls back
10
+ * to the system font silently when it misses.
11
+ */
12
+
13
+ import { ScrollView, StyleSheet, Text, View } from "react-native";
14
+ import { night } from "@buoy-gg/shared-ui";
15
+ import { AssetImage } from "./AssetImage";
16
+ import { formatBytes, formatDimensions, formatScales } from "../format";
17
+ import { estDecodedBytes } from "../store/assetStore";
18
+ import { ASSETS_TEST_IDS, assetDetailRowTestID, assetFindingTestID } from "../utils/testIDs";
19
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
20
+ function Row({
21
+ label,
22
+ value
23
+ }) {
24
+ const testID = assetDetailRowTestID(label);
25
+ return /*#__PURE__*/_jsxs(View, {
26
+ style: styles.kvRow,
27
+ testID: testID,
28
+ children: [/*#__PURE__*/_jsx(Text, {
29
+ style: styles.kvLabel,
30
+ children: label
31
+ }), /*#__PURE__*/_jsx(Text, {
32
+ style: styles.kvValue,
33
+ selectable: true,
34
+ testID: `${testID}-value`,
35
+ children: value
36
+ })]
37
+ });
38
+ }
39
+ function Preview({
40
+ record
41
+ }) {
42
+ if (record.kind === "image") {
43
+ return /*#__PURE__*/_jsx(View, {
44
+ style: styles.previewBox,
45
+ testID: ASSETS_TEST_IDS.detailPreview,
46
+ children: /*#__PURE__*/_jsx(AssetImage, {
47
+ testID: "buoy-internal-assets-preview",
48
+ record: record,
49
+ style: styles.previewImage
50
+ })
51
+ });
52
+ }
53
+ if (record.kind === "font") {
54
+ return /*#__PURE__*/_jsx(View, {
55
+ style: styles.previewBox,
56
+ testID: ASSETS_TEST_IDS.detailFontPreview,
57
+ children: /*#__PURE__*/_jsx(Text, {
58
+ style: [styles.fontPreview, {
59
+ fontFamily: record.name
60
+ }],
61
+ children: "The quick brown fox jumps over the lazy dog 0123456789"
62
+ })
63
+ });
64
+ }
65
+ return null;
66
+ }
67
+ export function AssetDetail({
68
+ record,
69
+ insights
70
+ }) {
71
+ const findings = [];
72
+ if (insights.neverLoaded.includes(record.id)) {
73
+ findings.push("Not observed in the runtime registry this app run. This does not prove the asset is unused.");
74
+ }
75
+ if (insights.scaleGaps.includes(record.id)) {
76
+ findings.push("Scale gap — no variant covers this device's pixel ratio");
77
+ }
78
+ if (insights.webpCandidates.includes(record.id)) {
79
+ findings.push("WebP candidate — large png/jpeg, converting typically saves 20–40%");
80
+ }
81
+ const duplicate = insights.duplicates.find(d => d.ids.includes(record.id));
82
+ if (duplicate) {
83
+ findings.push(`Duplicate content — identical bytes shipped ${duplicate.ids.length} times`);
84
+ }
85
+ if (insights.overDecode.includes(record.id)) {
86
+ findings.push("Decodes larger than 2× this entire screen — resize the source, no view can need this many pixels");
87
+ }
88
+ if (insights.heavyGifs.includes(record.id)) {
89
+ findings.push("Heavy GIF — every frame decodes into memory; a video or Lottie is typically ~90% smaller");
90
+ }
91
+ if (insights.heavyFonts.includes(record.id)) {
92
+ findings.push("Heavy font — likely an unsubset icon font; subsetting to used glyphs usually saves most of it");
93
+ }
94
+ if (insights.scaleAnomalies.includes(record.id)) {
95
+ findings.push("Scale anomaly — a higher-resolution variant is smaller in bytes than a lower one; check the exports");
96
+ }
97
+ const estimate = estDecodedBytes(record);
98
+ return /*#__PURE__*/_jsxs(ScrollView, {
99
+ style: styles.scroll,
100
+ contentContainerStyle: styles.content,
101
+ testID: ASSETS_TEST_IDS.detailScroll,
102
+ children: [/*#__PURE__*/_jsx(Preview, {
103
+ record: record
104
+ }), findings.length > 0 ? /*#__PURE__*/_jsx(View, {
105
+ style: styles.findings,
106
+ testID: ASSETS_TEST_IDS.detailFindings,
107
+ children: findings.map((finding, index) => /*#__PURE__*/_jsx(Text, {
108
+ style: styles.findingText,
109
+ testID: assetFindingTestID(index),
110
+ children: finding
111
+ }, finding))
112
+ }) : null, /*#__PURE__*/_jsx(Row, {
113
+ label: "Name",
114
+ value: `${record.name}.${record.type}`
115
+ }), /*#__PURE__*/_jsx(Row, {
116
+ label: "Kind",
117
+ value: record.kind
118
+ }), /*#__PURE__*/_jsx(Row, {
119
+ label: "Status",
120
+ value: record.loaded ? "Loaded (registered at runtime)" : "Not observed in the runtime registry"
121
+ }), record.kind === "image" ? /*#__PURE__*/_jsx(Row, {
122
+ label: "Dimensions",
123
+ value: `${formatDimensions(record)} (logical)`
124
+ }) : null, record.kind === "image" && record.scales.length ? /*#__PURE__*/_jsx(Row, {
125
+ label: "Scales",
126
+ value: formatScales(record.scales)
127
+ }) : null, record.sizesByScale ? Object.entries(record.sizesByScale).map(([scale, bytes]) => /*#__PURE__*/_jsx(Row, {
128
+ label: `Size @${scale}x`,
129
+ value: formatBytes(bytes)
130
+ }, scale)) : null, record.sizeBytes != null && record.sizeSource === "measured" ? /*#__PURE__*/_jsx(Row, {
131
+ label: "Total size",
132
+ value: formatBytes(record.sizeBytes)
133
+ }) : null, estimate > 0 ? /*#__PURE__*/_jsx(Row, {
134
+ label: "Decoded memory",
135
+ value: `~${formatBytes(estimate)} (RGBA)`
136
+ }) : null, record.registryId != null ? /*#__PURE__*/_jsx(Row, {
137
+ label: "Registry id",
138
+ value: String(record.registryId)
139
+ }) : null, record.hash ? /*#__PURE__*/_jsx(Row, {
140
+ label: "Hash",
141
+ value: record.hash
142
+ }) : null, record.httpServerLocation ? /*#__PURE__*/_jsx(Row, {
143
+ label: "Location",
144
+ value: record.httpServerLocation
145
+ }) : null, record.fileSystemLocation ? /*#__PURE__*/_jsx(Row, {
146
+ label: "Source dir",
147
+ value: record.fileSystemLocation
148
+ }) : null, record.resolvedUri ? /*#__PURE__*/_jsx(Row, {
149
+ label: "Resolved URI",
150
+ value: record.resolvedUri
151
+ }) : null]
152
+ });
153
+ }
154
+ const styles = StyleSheet.create({
155
+ scroll: {
156
+ flex: 1
157
+ },
158
+ content: {
159
+ padding: 12,
160
+ gap: 8
161
+ },
162
+ previewBox: {
163
+ borderRadius: 8,
164
+ backgroundColor: night.color.bg,
165
+ padding: 12,
166
+ alignItems: "center",
167
+ justifyContent: "center",
168
+ minHeight: 96
169
+ },
170
+ previewImage: {
171
+ width: "100%",
172
+ height: 140
173
+ },
174
+ fontPreview: {
175
+ color: night.color.text,
176
+ fontSize: 16,
177
+ textAlign: "center"
178
+ },
179
+ findings: {
180
+ borderRadius: 8,
181
+ borderWidth: 1,
182
+ borderColor: night.color.border,
183
+ backgroundColor: night.color.surface,
184
+ padding: 10,
185
+ gap: 6
186
+ },
187
+ findingText: {
188
+ color: night.color.textSecondary,
189
+ fontSize: 11,
190
+ lineHeight: 15
191
+ },
192
+ kvRow: {
193
+ gap: 2
194
+ },
195
+ kvLabel: {
196
+ color: night.color.textTertiary,
197
+ fontSize: 9,
198
+ fontWeight: "700",
199
+ letterSpacing: 0.5,
200
+ textTransform: "uppercase"
201
+ },
202
+ kvValue: {
203
+ color: night.color.text,
204
+ fontSize: 12
205
+ }
206
+ });
207
+ //# sourceMappingURL=AssetDetail.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["ScrollView","StyleSheet","Text","View","night","AssetImage","formatBytes","formatDimensions","formatScales","estDecodedBytes","ASSETS_TEST_IDS","assetDetailRowTestID","assetFindingTestID","jsx","_jsx","jsxs","_jsxs","Row","label","value","testID","style","styles","kvRow","children","kvLabel","kvValue","selectable","Preview","record","kind","previewBox","detailPreview","previewImage","detailFontPreview","fontPreview","fontFamily","name","AssetDetail","insights","findings","neverLoaded","includes","id","push","scaleGaps","webpCandidates","duplicate","duplicates","find","d","ids","length","overDecode","heavyGifs","heavyFonts","scaleAnomalies","estimate","scroll","contentContainerStyle","content","detailScroll","detailFindings","map","finding","index","findingText","type","loaded","scales","sizesByScale","Object","entries","scale","bytes","sizeBytes","sizeSource","registryId","String","hash","httpServerLocation","fileSystemLocation","resolvedUri","create","flex","padding","gap","borderRadius","backgroundColor","color","bg","alignItems","justifyContent","minHeight","width","height","text","fontSize","textAlign","borderWidth","borderColor","border","surface","textSecondary","lineHeight","textTertiary","fontWeight","letterSpacing","textTransform"],"sourceRoot":"../../../src","sources":["components/AssetDetail.tsx"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,UAAU,EAAEC,UAAU,EAAEC,IAAI,EAAEC,IAAI,QAAQ,cAAc;AACjE,SAASC,KAAK,QAAQ,oBAAoB;AAC1C,SAASC,UAAU,QAAQ,cAAc;AACzC,SAASC,WAAW,EAAEC,gBAAgB,EAAEC,YAAY,QAAQ,WAAW;AACvE,SAASC,eAAe,QAAQ,qBAAqB;AACrD,SACEC,eAAe,EACfC,oBAAoB,EACpBC,kBAAkB,QACb,kBAAkB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAA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CAACqF,KAAK,CAACY,MAAM;IAC/Bb,eAAe,EAAEpF,KAAK,CAACqF,KAAK,CAACa,OAAO;IACpCjB,OAAO,EAAE,EAAE;IACXC,GAAG,EAAE;EACP,CAAC;EACDpB,WAAW,EAAE;IACXuB,KAAK,EAAErF,KAAK,CAACqF,KAAK,CAACc,aAAa;IAChCN,QAAQ,EAAE,EAAE;IACZO,UAAU,EAAE;EACd,CAAC;EACDjF,KAAK,EAAE;IACL+D,GAAG,EAAE;EACP,CAAC;EACD7D,OAAO,EAAE;IACPgE,KAAK,EAAErF,KAAK,CAACqF,KAAK,CAACgB,YAAY;IAC/BR,QAAQ,EAAE,CAAC;IACXS,UAAU,EAAE,KAAK;IACjBC,aAAa,EAAE,GAAG;IAClBC,aAAa,EAAE;EACjB,CAAC;EACDlF,OAAO,EAAE;IACP+D,KAAK,EAAErF,KAAK,CAACqF,KAAK,CAACO,IAAI;IACvBC,QAAQ,EAAE;EACZ;AACF,CAAC,CAAC","ignoreList":[]}
@@ -1 +1,62 @@
1
- "use strict";import{useState}from"react";import{Image,Platform,StyleSheet,Text,View}from"react-native";import{night}from"@buoy-gg/shared-ui";import{displaySource}from"../capture/measure";import{getExpoPreviewImage}from"./optionalExpoImage";import{jsx as _jsx}from"react/jsx-runtime";export function AssetImage({record:e,style:t,testID:r,compact:o=!1}){const s=displaySource(e),a="svg"===e.type.toLowerCase(),i=a&&"web"!==Platform.OS?getExpoPreviewImage():null,l=`${e.key}:${e.hash??""}:${"number"==typeof s?s:s?.uri??""}`,[n,c]=useState(null);if(null==s||n===l||a&&"web"!==Platform.OS&&!i){const e=a?"SVG preview unavailable":"Image preview unavailable";return _jsx(View,{style:[t,styles.fallback],accessibilityLabel:e,testID:`${r}-unavailable`,children:_jsx(Text,{style:styles.text,children:o?a?"SVG":"IMG":e})})}const m=()=>c(l);return i?_jsx(i,{source:s,style:t,contentFit:"contain",onError:m,testID:r}):_jsx(Image,{source:s,style:t,resizeMode:"contain",onError:m,testID:r})}const styles=StyleSheet.create({fallback:{alignItems:"center",justifyContent:"center"},text:{color:night.color.textSecondary,fontSize:10,textAlign:"center"}});
1
+ "use strict";
2
+
3
+ import { useState } from "react";
4
+ import { Image, Platform, StyleSheet, Text, View } from "react-native";
5
+ import { night } from "@buoy-gg/shared-ui";
6
+ import { displaySource } from "../capture/measure";
7
+ import { getExpoPreviewImage } from "./optionalExpoImage";
8
+ import { jsx as _jsx } from "react/jsx-runtime";
9
+ export function AssetImage({
10
+ record,
11
+ style,
12
+ testID,
13
+ compact = false
14
+ }) {
15
+ const source = displaySource(record);
16
+ const svg = record.type.toLowerCase() === "svg";
17
+ const ExpoImage = svg && Platform.OS !== "web" ? getExpoPreviewImage() : null;
18
+ const sourceKey = `${record.key}:${record.hash ?? ""}:${typeof source === "number" ? source : source?.uri ?? ""}`;
19
+ const [failedSource, setFailedSource] = useState(null);
20
+ const unavailable = source == null || failedSource === sourceKey || svg && Platform.OS !== "web" && !ExpoImage;
21
+ if (unavailable) {
22
+ const label = svg ? "SVG preview unavailable" : "Image preview unavailable";
23
+ return /*#__PURE__*/_jsx(View, {
24
+ style: [style, styles.fallback],
25
+ accessibilityLabel: label,
26
+ testID: `${testID}-unavailable`,
27
+ children: /*#__PURE__*/_jsx(Text, {
28
+ style: styles.text,
29
+ children: compact ? svg ? "SVG" : "IMG" : label
30
+ })
31
+ });
32
+ }
33
+ const onError = () => setFailedSource(sourceKey);
34
+ if (ExpoImage) {
35
+ return /*#__PURE__*/_jsx(ExpoImage, {
36
+ source: source,
37
+ style: style,
38
+ contentFit: "contain",
39
+ onError: onError,
40
+ testID: testID
41
+ });
42
+ }
43
+ return /*#__PURE__*/_jsx(Image, {
44
+ source: source,
45
+ style: style,
46
+ resizeMode: "contain",
47
+ onError: onError,
48
+ testID: testID
49
+ });
50
+ }
51
+ const styles = StyleSheet.create({
52
+ fallback: {
53
+ alignItems: "center",
54
+ justifyContent: "center"
55
+ },
56
+ text: {
57
+ color: night.color.textSecondary,
58
+ fontSize: 10,
59
+ textAlign: "center"
60
+ }
61
+ });
62
+ //# sourceMappingURL=AssetImage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useState","Image","Platform","StyleSheet","Text","View","night","displaySource","getExpoPreviewImage","jsx","_jsx","AssetImage","record","style","testID","compact","source","svg","type","toLowerCase","ExpoImage","OS","sourceKey","key","hash","uri","failedSource","setFailedSource","unavailable","label","styles","fallback","accessibilityLabel","children","text","onError","contentFit","resizeMode","create","alignItems","justifyContent","color","textSecondary","fontSize","textAlign"],"sourceRoot":"../../../src","sources":["components/AssetImage.tsx"],"mappings":";;AAAA,SAASA,QAAQ,QAAQ,OAAO;AAChC,SAASC,KAAK,EAAEC,QAAQ,EAAEC,UAAU,EAAEC,IAAI,EAAEC,IAAI,QAAQ,cAAc;AAEtE,SAASC,KAAK,QAAQ,oBAAoB;AAC1C,SAASC,aAAa,QAAQ,oBAAoB;AAElD,SAASC,mBAAmB,QAAQ,qBAAqB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAE1D,OAAO,SAASC,UAAUA,CAAC;EAAEC,MAAM;EAAEC,KAAK;EAAEC,MAAM;EAAEC,OAAO,GAAG;AAK9D,CAAC,EAAE;EACD,MAAMC,MAAM,GAAGT,aAAa,CAACK,MAAM,CAAC;EACpC,MAAMK,GAAG,GAAGL,MAAM,CAACM,IAAI,CAACC,WAAW,CAAC,CAAC,KAAK,KAAK;EAC/C,MAAMC,SAAS,GAAGH,GAAG,IAAIf,QAAQ,CAACmB,EAAE,KAAK,KAAK,GAAGb,mBAAmB,CAAC,CAAC,GAAG,IAAI;EAC7E,MAAMc,SAAS,GAAG,GAAGV,MAAM,CAACW,GAAG,IAAIX,MAAM,CAACY,IAAI,IAAI,EAAE,IAAI,OAAOR,MAAM,KAAK,QAAQ,GAAGA,MAAM,GAAGA,MAAM,EAAES,GAAG,IAAI,EAAE,EAAE;EACjH,MAAM,CAACC,YAAY,EAAEC,eAAe,CAAC,GAAG3B,QAAQ,CAAgB,IAAI,CA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,CAACC,aAAa;IAAEC,QAAQ,EAAE,EAAE;IAAEC,SAAS,EAAE;EAAS;AAC9E,CAAC,CAAC","ignoreList":[]}
@@ -1 +1,228 @@
1
- "use strict";import{StyleSheet,Text,TouchableOpacity,View}from"react-native";import{macOSColors,night,Pill}from"@buoy-gg/shared-ui";import{AssetImage}from"./AssetImage";import{formatDimensions,formatScales,formatSize,KIND_COLORS,KIND_LABELS}from"../format";import{estDecodedBytes}from"../store/assetStore";import{assetBadgeTestID,assetRowTestID}from"../utils/testIDs";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";function Badge({label:e,color:t,testID:s}){return _jsx(Pill,{label:e,color:t,variant:"quiet",dot:Boolean(t),style:{paddingVertical:2.5},testID:s})}export function AssetRow({record:e,flags:t,sizeFraction:s,onPress:o}){const l=KIND_COLORS[e.kind],r=[];return e.loaded||r.push({label:"NOT OBSERVED"}),t.oversize&&r.push({label:"OVERSIZE",color:macOSColors.semantic.error}),t.duplicate&&r.push({label:"DUP"}),t.heavy&&r.push({label:"HEAVY"}),t.scaleAnomaly?r.push({label:"BAD SCALE",color:macOSColors.semantic.error}):t.scaleGap&&r.push({label:"LOW-RES"}),t.webp&&r.push({label:"WEBP",color:macOSColors.semantic.info}),_jsxs(TouchableOpacity,{style:styles.card,testID:assetRowTestID(e.name,e.type),onPress:()=>o(e.id),activeOpacity:.7,children:[_jsxs(View,{style:styles.body,children:[_jsx(View,{style:styles.thumbBox,children:"image"===e.kind?_jsx(AssetImage,{testID:"buoy-internal-assets-thumb",record:e,style:styles.thumb,compact:!0}):_jsx(Text,{style:[styles.thumbFallback,{color:l}],children:KIND_LABELS[e.kind]})}),_jsxs(View,{style:styles.main,children:[_jsxs(Text,{style:styles.name,numberOfLines:1,testID:`${assetRowTestID(e.name,e.type)}-name`,children:[e.name,_jsxs(Text,{style:styles.ext,children:[".",e.type]})]}),_jsxs(View,{style:styles.metaRow,children:["image"===e.kind&&null!=e.width?_jsx(Text,{style:styles.meta,children:formatDimensions(e)}):null,"image"===e.kind&&e.scales.length?_jsx(Text,{style:styles.meta,children:formatScales(e.scales)}):null]})]}),_jsxs(View,{style:styles.right,children:[_jsx(Text,{style:styles.size,testID:`${assetRowTestID(e.name,e.type)}-size`,children:formatSize(e,estDecodedBytes(e))}),r.length?_jsx(View,{style:styles.badgeRow,children:r.slice(0,3).map(t=>_jsx(Badge,{label:t.label,color:t.color,testID:assetBadgeTestID(e.name,e.type,t.label)},t.label))}):null]})]}),s>0?_jsx(View,{style:styles.sizeTrack,children:_jsx(View,{style:[styles.sizeFill,{backgroundColor:l,width:`${Math.max(2,Math.round(100*s))}%`}]})}):null]})}const styles=StyleSheet.create({card:{marginHorizontal:10,marginTop:6,borderRadius:10,backgroundColor:night.color.surface,borderWidth:1,borderColor:night.color.border,overflow:"hidden"},body:{flexDirection:"row",alignItems:"center",paddingVertical:8,paddingHorizontal:12,gap:10},thumbBox:{width:40,height:40,borderRadius:8,backgroundColor:"rgba(255,255,255,0.10)",borderWidth:1,borderColor:night.color.border,alignItems:"center",justifyContent:"center",overflow:"hidden"},thumb:{width:34,height:34},thumbFallback:{fontSize:9,fontWeight:"700",letterSpacing:.5},main:{flex:1,gap:3},name:{color:night.color.text,fontSize:12,fontWeight:"600"},ext:{color:night.color.textTertiary,fontWeight:"400"},metaRow:{flexDirection:"row",alignItems:"center",gap:8},meta:{color:night.color.textSecondary,fontSize:10,fontVariant:["tabular-nums"]},right:{alignItems:"flex-end",gap:4},size:{color:night.color.text,fontSize:12,fontWeight:"700",fontVariant:["tabular-nums"]},badgeRow:{flexDirection:"row",gap:4},sizeTrack:{height:2,backgroundColor:"transparent"},sizeFill:{height:2,opacity:.45,borderTopRightRadius:2}});
1
+ "use strict";
2
+
3
+ /**
4
+ * AssetRow — one bundled asset as a family-style card (matching the network
5
+ * tool's rows): rounded card, colored accent edge per kind, thumbnail, name,
6
+ * quiet metadata, bold right-aligned size, and finding badges ONLY when a
7
+ * finding exists. A thin proportional bar along the card bottom makes the
8
+ * heavy assets feel heavy at a glance.
9
+ *
10
+ * Thumbnails render through the NUMERIC registry id when available — that
11
+ * routes through resolveAssetSource natively, so it works in dev, iOS
12
+ * release (file://) and Android release (bare resource id) alike. They carry
13
+ * the buoy-internal testID so the images tool never records our own UI.
14
+ */
15
+
16
+ import { StyleSheet, Text, TouchableOpacity, View } from "react-native";
17
+ import { macOSColors, night, Pill } from "@buoy-gg/shared-ui";
18
+ import { AssetImage } from "./AssetImage";
19
+ import { formatDimensions, formatScales, formatSize, KIND_COLORS, KIND_LABELS } from "../format";
20
+ import { estDecodedBytes } from "../store/assetStore";
21
+ import { assetBadgeTestID, assetRowTestID } from "../utils/testIDs";
22
+
23
+ /** Which audit findings apply to this record (drives the row badges). */
24
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
25
+ function Badge({
26
+ label,
27
+ color,
28
+ testID
29
+ }) {
30
+ // Quiet chip: legibility from light-gray text on a neutral fill. Only the
31
+ // serious tiers (red) and WEBP (blue) carry a small dot; the rest are plain.
32
+ return /*#__PURE__*/_jsx(Pill, {
33
+ label: label,
34
+ color: color,
35
+ variant: "quiet",
36
+ dot: Boolean(color),
37
+ style: {
38
+ paddingVertical: 2.5
39
+ },
40
+ testID: testID
41
+ });
42
+ }
43
+ export function AssetRow({
44
+ record,
45
+ flags,
46
+ sizeFraction,
47
+ onPress
48
+ }) {
49
+ const accent = KIND_COLORS[record.kind];
50
+ const badges = [];
51
+ if (!record.loaded) badges.push({
52
+ label: "NOT OBSERVED"
53
+ });
54
+ if (flags.oversize) badges.push({
55
+ label: "OVERSIZE",
56
+ color: macOSColors.semantic.error
57
+ });
58
+ if (flags.duplicate) badges.push({
59
+ label: "DUP"
60
+ });
61
+ if (flags.heavy) badges.push({
62
+ label: "HEAVY"
63
+ });
64
+ if (flags.scaleAnomaly) badges.push({
65
+ label: "BAD SCALE",
66
+ color: macOSColors.semantic.error
67
+ });else if (flags.scaleGap) badges.push({
68
+ label: "LOW-RES"
69
+ });
70
+ if (flags.webp) badges.push({
71
+ label: "WEBP",
72
+ color: macOSColors.semantic.info
73
+ });
74
+ return /*#__PURE__*/_jsxs(TouchableOpacity, {
75
+ style: styles.card,
76
+ testID: assetRowTestID(record.name, record.type),
77
+ onPress: () => onPress(record.id),
78
+ activeOpacity: 0.7,
79
+ children: [/*#__PURE__*/_jsxs(View, {
80
+ style: styles.body,
81
+ children: [/*#__PURE__*/_jsx(View, {
82
+ style: styles.thumbBox,
83
+ children: record.kind === "image" ? /*#__PURE__*/_jsx(AssetImage
84
+ // buoy-internal- prefix: the images tool skips its own toolchain's
85
+ // views, so previewing an asset never records a render of itself.
86
+ , {
87
+ testID: "buoy-internal-assets-thumb",
88
+ record: record,
89
+ style: styles.thumb,
90
+ compact: true
91
+ }) : /*#__PURE__*/_jsx(Text, {
92
+ style: [styles.thumbFallback, {
93
+ color: accent
94
+ }],
95
+ children: KIND_LABELS[record.kind]
96
+ })
97
+ }), /*#__PURE__*/_jsxs(View, {
98
+ style: styles.main,
99
+ children: [/*#__PURE__*/_jsxs(Text, {
100
+ style: styles.name,
101
+ numberOfLines: 1,
102
+ testID: `${assetRowTestID(record.name, record.type)}-name`,
103
+ children: [record.name, /*#__PURE__*/_jsxs(Text, {
104
+ style: styles.ext,
105
+ children: [".", record.type]
106
+ })]
107
+ }), /*#__PURE__*/_jsxs(View, {
108
+ style: styles.metaRow,
109
+ children: [record.kind === "image" && record.width != null ? /*#__PURE__*/_jsx(Text, {
110
+ style: styles.meta,
111
+ children: formatDimensions(record)
112
+ }) : null, record.kind === "image" && record.scales.length ? /*#__PURE__*/_jsx(Text, {
113
+ style: styles.meta,
114
+ children: formatScales(record.scales)
115
+ }) : null]
116
+ })]
117
+ }), /*#__PURE__*/_jsxs(View, {
118
+ style: styles.right,
119
+ children: [/*#__PURE__*/_jsx(Text, {
120
+ style: styles.size,
121
+ testID: `${assetRowTestID(record.name, record.type)}-size`,
122
+ children: formatSize(record, estDecodedBytes(record))
123
+ }), badges.length ? /*#__PURE__*/_jsx(View, {
124
+ style: styles.badgeRow,
125
+ children: badges.slice(0, 3).map(b => /*#__PURE__*/_jsx(Badge, {
126
+ label: b.label,
127
+ color: b.color,
128
+ testID: assetBadgeTestID(record.name, record.type, b.label)
129
+ }, b.label))
130
+ }) : null]
131
+ })]
132
+ }), sizeFraction > 0 ? /*#__PURE__*/_jsx(View, {
133
+ style: styles.sizeTrack,
134
+ children: /*#__PURE__*/_jsx(View, {
135
+ style: [styles.sizeFill, {
136
+ backgroundColor: accent,
137
+ width: `${Math.max(2, Math.round(sizeFraction * 100))}%`
138
+ }]
139
+ })
140
+ }) : null]
141
+ });
142
+ }
143
+ const styles = StyleSheet.create({
144
+ card: {
145
+ marginHorizontal: 10,
146
+ marginTop: 6,
147
+ borderRadius: 10,
148
+ backgroundColor: night.color.surface,
149
+ borderWidth: 1,
150
+ borderColor: night.color.border,
151
+ overflow: "hidden"
152
+ },
153
+ body: {
154
+ flexDirection: "row",
155
+ alignItems: "center",
156
+ paddingVertical: 8,
157
+ paddingHorizontal: 12,
158
+ gap: 10
159
+ },
160
+ thumbBox: {
161
+ width: 40,
162
+ height: 40,
163
+ borderRadius: 8,
164
+ // Light plate so dark glyph assets stay visible on the dark card.
165
+ backgroundColor: "rgba(255,255,255,0.10)",
166
+ borderWidth: 1,
167
+ borderColor: night.color.border,
168
+ alignItems: "center",
169
+ justifyContent: "center",
170
+ overflow: "hidden"
171
+ },
172
+ thumb: {
173
+ width: 34,
174
+ height: 34
175
+ },
176
+ thumbFallback: {
177
+ fontSize: 9,
178
+ fontWeight: "700",
179
+ letterSpacing: 0.5
180
+ },
181
+ main: {
182
+ flex: 1,
183
+ gap: 3
184
+ },
185
+ name: {
186
+ color: night.color.text,
187
+ fontSize: 12,
188
+ fontWeight: "600"
189
+ },
190
+ ext: {
191
+ color: night.color.textTertiary,
192
+ fontWeight: "400"
193
+ },
194
+ metaRow: {
195
+ flexDirection: "row",
196
+ alignItems: "center",
197
+ gap: 8
198
+ },
199
+ meta: {
200
+ color: night.color.textSecondary,
201
+ fontSize: 10,
202
+ fontVariant: ["tabular-nums"]
203
+ },
204
+ right: {
205
+ alignItems: "flex-end",
206
+ gap: 4
207
+ },
208
+ size: {
209
+ color: night.color.text,
210
+ fontSize: 12,
211
+ fontWeight: "700",
212
+ fontVariant: ["tabular-nums"]
213
+ },
214
+ badgeRow: {
215
+ flexDirection: "row",
216
+ gap: 4
217
+ },
218
+ sizeTrack: {
219
+ height: 2,
220
+ backgroundColor: "transparent"
221
+ },
222
+ sizeFill: {
223
+ height: 2,
224
+ opacity: 0.45,
225
+ borderTopRightRadius: 2
226
+ }
227
+ });
228
+ //# sourceMappingURL=AssetRow.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["StyleSheet","Text","TouchableOpacity","View","macOSColors","night","Pill","AssetImage","formatDimensions","formatScales","formatSize","KIND_COLORS","KIND_LABELS","estDecodedBytes","assetBadgeTestID","assetRowTestID","jsx","_jsx","jsxs","_jsxs","Badge","label","color","testID","variant","dot","Boolean","style","paddingVertical","AssetRow","record","flags","sizeFraction","onPress","accent","kind","badges","loaded","push","oversize","semantic","error","duplicate","heavy","scaleAnomaly","scaleGap","webp","info","styles","card","name","type","id","activeOpacity","children","body","thumbBox","thumb","compact","thumbFallback","main","numberOfLines","ext","metaRow","width","meta","scales","length","right","size","badgeRow","slice","map","b","sizeTrack","sizeFill","backgroundColor","Math","max","round","create","marginHorizontal","marginTop","borderRadius","surface","borderWidth","borderColor","border","overflow","flexDirection","alignItems","paddingHorizontal","gap","height","justifyContent","fontSize","fontWeight","letterSpacing","flex","text","textTertiary","textSecondary","fontVariant","opacity","borderTopRightRadius"],"sourceRoot":"../../../src","sources":["components/AssetRow.tsx"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,UAAU,EAAEC,IAAI,EAAEC,gBAAgB,EAAEC,IAAI,QAAQ,cAAc;AACvE,SAASC,WAAW,EAAEC,KA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EAAE,QAAQ;IACpBE,GAAG,EAAE;EACP,CAAC;EACD3B,IAAI,EAAE;IACJ3C,KAAK,EAAEjB,KAAK,CAACiB,KAAK,CAAC+E,aAAa;IAChCN,QAAQ,EAAE,EAAE;IACZO,WAAW,EAAE,CAAC,cAAc;EAC9B,CAAC;EACDlC,KAAK,EAAE;IACLsB,UAAU,EAAE,UAAU;IACtBE,GAAG,EAAE;EACP,CAAC;EACDvB,IAAI,EAAE;IACJ/C,KAAK,EAAEjB,KAAK,CAACiB,KAAK,CAAC6E,IAAI;IACvBJ,QAAQ,EAAE,EAAE;IACZC,UAAU,EAAE,KAAK;IACjBM,WAAW,EAAE,CAAC,cAAc;EAC9B,CAAC;EACDhC,QAAQ,EAAE;IACRmB,aAAa,EAAE,KAAK;IACpBG,GAAG,EAAE;EACP,CAAC;EACDlB,SAAS,EAAE;IACTmB,MAAM,EAAE,CAAC;IACTjB,eAAe,EAAE;EACnB,CAAC;EACDD,QAAQ,EAAE;IACRkB,MAAM,EAAE,CAAC;IACTU,OAAO,EAAE,IAAI;IACbC,oBAAoB,EAAE;EACxB;AACF,CAAC,CAAC","ignoreList":[]}
@@ -1 +1,101 @@
1
- "use strict";import{StyleSheet,Text,TouchableOpacity,View}from"react-native";import{night}from"@buoy-gg/shared-ui";import{KIND_COLORS,KIND_LABELS}from"../format";import{ASSETS_TEST_IDS,assetFilterTestID}from"../utils/testIDs";import{jsx as _jsx}from"react/jsx-runtime";export function AssetsFilterBar({stats:e,duplicateCount:t,filter:r,onChange:o}){const l=[{key:"all",label:`ALL ${e.total}`,accent:night.color.textSecondary},{key:"duplicates",label:`DUPLICATES ${t}`,accent:"#FF9F1C"}];for(const t of Object.keys(e.byKind)){const r=e.byKind[t];r.count>0&&l.push({key:t,label:`${KIND_LABELS[t]} ${r.count}`,accent:KIND_COLORS[t]})}return e.neverLoaded>0&&l.push({key:"unused",label:`NOT OBSERVED ${e.neverLoaded}`,accent:"#FF9F1C"}),l.length<=1?null:_jsx(View,{style:styles.bar,testID:ASSETS_TEST_IDS.filterBar,children:l.map(e=>{const t=e.key===r;return _jsx(TouchableOpacity,{accessibilityRole:"button",accessibilityState:{selected:t},testID:assetFilterTestID(e.key),style:[styles.chip,t&&{borderColor:e.accent,backgroundColor:`${e.accent}1A`}],onPress:()=>o(t?"all":e.key),children:_jsx(Text,{testID:`${assetFilterTestID(e.key)}-label`,style:[styles.chipText,{color:t?e.accent:night.color.textSecondary}],children:e.label})},e.key)})})}const styles=StyleSheet.create({bar:{flexDirection:"row",flexWrap:"wrap",gap:6,paddingHorizontal:10,paddingVertical:8},chip:{borderWidth:1,borderColor:night.color.border,backgroundColor:night.color.surface,borderRadius:999,paddingHorizontal:10,paddingVertical:5},chipText:{fontSize:10,fontWeight:"700",letterSpacing:.4,lineHeight:13}});
1
+ "use strict";
2
+
3
+ /**
4
+ * AssetsFilterBar — kind filter pills with counts, styled like the network
5
+ * tool's bordered pills: outlined, kind-accent-colored when active. Wrapping
6
+ * row, not a horizontal ScrollView (same height-measurement pitfall the
7
+ * images tool documents).
8
+ */
9
+
10
+ import { StyleSheet, Text, TouchableOpacity, View } from "react-native";
11
+ import { night } from "@buoy-gg/shared-ui";
12
+ import { KIND_COLORS, KIND_LABELS } from "../format";
13
+ import { ASSETS_TEST_IDS, assetFilterTestID } from "../utils/testIDs";
14
+ import { jsx as _jsx } from "react/jsx-runtime";
15
+ export function AssetsFilterBar({
16
+ stats,
17
+ duplicateCount,
18
+ filter,
19
+ onChange
20
+ }) {
21
+ const chips = [{
22
+ key: "all",
23
+ label: `ALL ${stats.total}`,
24
+ accent: night.color.textSecondary
25
+ }, {
26
+ key: "duplicates",
27
+ label: `DUPLICATES ${duplicateCount}`,
28
+ accent: "#FF9F1C"
29
+ }];
30
+ for (const kind of Object.keys(stats.byKind)) {
31
+ const entry = stats.byKind[kind];
32
+ if (entry.count > 0) {
33
+ chips.push({
34
+ key: kind,
35
+ label: `${KIND_LABELS[kind]} ${entry.count}`,
36
+ accent: KIND_COLORS[kind]
37
+ });
38
+ }
39
+ }
40
+ if (stats.neverLoaded > 0) {
41
+ // Amber, not semantic.warning — the bright yellow reads as an alarm.
42
+ chips.push({
43
+ key: "unused",
44
+ label: `NOT OBSERVED ${stats.neverLoaded}`,
45
+ accent: "#FF9F1C"
46
+ });
47
+ }
48
+ if (chips.length <= 1) return null;
49
+ return /*#__PURE__*/_jsx(View, {
50
+ style: styles.bar,
51
+ testID: ASSETS_TEST_IDS.filterBar,
52
+ children: chips.map(chip => {
53
+ const active = chip.key === filter;
54
+ return /*#__PURE__*/_jsx(TouchableOpacity, {
55
+ accessibilityRole: "button",
56
+ accessibilityState: {
57
+ selected: active
58
+ },
59
+ testID: assetFilterTestID(chip.key),
60
+ style: [styles.chip, active && {
61
+ borderColor: chip.accent,
62
+ backgroundColor: `${chip.accent}1A`
63
+ }]
64
+ // Tapping the active chip again untoggles back to ALL.
65
+ ,
66
+ onPress: () => onChange(active ? "all" : chip.key),
67
+ children: /*#__PURE__*/_jsx(Text, {
68
+ testID: `${assetFilterTestID(chip.key)}-label`,
69
+ style: [styles.chipText, {
70
+ color: active ? chip.accent : night.color.textSecondary
71
+ }],
72
+ children: chip.label
73
+ })
74
+ }, chip.key);
75
+ })
76
+ });
77
+ }
78
+ const styles = StyleSheet.create({
79
+ bar: {
80
+ flexDirection: "row",
81
+ flexWrap: "wrap",
82
+ gap: 6,
83
+ paddingHorizontal: 10,
84
+ paddingVertical: 8
85
+ },
86
+ chip: {
87
+ borderWidth: 1,
88
+ borderColor: night.color.border,
89
+ backgroundColor: night.color.surface,
90
+ borderRadius: 999,
91
+ paddingHorizontal: 10,
92
+ paddingVertical: 5
93
+ },
94
+ chipText: {
95
+ fontSize: 10,
96
+ fontWeight: "700",
97
+ letterSpacing: 0.4,
98
+ lineHeight: 13
99
+ }
100
+ });
101
+ //# sourceMappingURL=AssetsFilterBar.js.map