@buoy-gg/shared-ui 7.0.32 → 7.0.34

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 (237) hide show
  1. package/lib/commonjs/JsModal.js +70 -28
  2. package/lib/commonjs/hooks/index.js +26 -0
  3. package/lib/commonjs/hooks/safe-area-impl.js +1 -1
  4. package/lib/commonjs/hooks/useChangeLog.js +55 -0
  5. package/lib/commonjs/hooks/useEventStoreEvents.js +65 -0
  6. package/lib/commonjs/hooks/usePersistedState.js +45 -10
  7. package/lib/commonjs/index.js +143 -0
  8. package/lib/commonjs/storage/definePersistedSetting.js +67 -0
  9. package/lib/commonjs/storage/devToolsStorageKeys.js +12 -0
  10. package/lib/commonjs/storage/index.js +8 -1
  11. package/lib/commonjs/stores/ChangeLog.js +197 -0
  12. package/lib/commonjs/stores/createToolStore.js +175 -0
  13. package/lib/commonjs/stores/index.js +15 -1
  14. package/lib/commonjs/sync/toolSyncAdapter.js +63 -0
  15. package/lib/commonjs/sync/wireForm.js +172 -0
  16. package/lib/commonjs/tools/defineTool.js +79 -0
  17. package/lib/commonjs/ui/components/ChangeRow.js +110 -0
  18. package/lib/commonjs/ui/components/ChipStrip.js +94 -0
  19. package/lib/commonjs/ui/components/DetailViewToggle.js +130 -0
  20. package/lib/commonjs/ui/components/DevToolsCard.js +3 -1
  21. package/lib/commonjs/ui/components/EmptyState.js +10 -2
  22. package/lib/commonjs/ui/components/EntityFilterView.js +354 -0
  23. package/lib/commonjs/ui/components/ExportPreview.js +174 -0
  24. package/lib/commonjs/ui/components/InfoRow.js +90 -0
  25. package/lib/commonjs/ui/components/ModalHeader.js +40 -7
  26. package/lib/commonjs/ui/components/Pill.js +114 -0
  27. package/lib/commonjs/ui/components/ToggleRow.js +116 -0
  28. package/lib/commonjs/ui/components/ToolEmptyState.js +154 -0
  29. package/lib/commonjs/ui/components/ToolFooter.js +204 -0
  30. package/lib/commonjs/ui/components/WindowControls.js +8 -5
  31. package/lib/commonjs/ui/components/index.js +113 -1
  32. package/lib/commonjs/ui/index.js +36 -2
  33. package/lib/commonjs/ui/listPresets.js +43 -0
  34. package/lib/commonjs/ui/night/primitives.js +3 -1
  35. package/lib/commonjs/ui/otto/OttoSprite.js +510 -0
  36. package/lib/commonjs/ui/otto/index.js +38 -0
  37. package/lib/commonjs/ui/otto/ottoEngine.js +2734 -0
  38. package/lib/commonjs/ui/otto/ottoSheet.js +191 -0
  39. package/lib/commonjs/utils/snapshotProviderKit.js +167 -0
  40. package/lib/commonjs/utils/stateTools.js +160 -0
  41. package/lib/module/JsModal.js +70 -28
  42. package/lib/module/hooks/index.js +3 -1
  43. package/lib/module/hooks/safe-area-impl.js +1 -1
  44. package/lib/module/hooks/useChangeLog.js +50 -0
  45. package/lib/module/hooks/useEventStoreEvents.js +61 -0
  46. package/lib/module/hooks/usePersistedState.js +44 -10
  47. package/lib/module/index.js +11 -1
  48. package/lib/module/storage/definePersistedSetting.js +63 -0
  49. package/lib/module/storage/devToolsStorageKeys.js +12 -0
  50. package/lib/module/storage/index.js +2 -1
  51. package/lib/module/stores/ChangeLog.js +192 -0
  52. package/lib/module/stores/createToolStore.js +171 -0
  53. package/lib/module/stores/index.js +3 -1
  54. package/lib/module/sync/toolSyncAdapter.js +58 -0
  55. package/lib/module/sync/wireForm.js +159 -0
  56. package/lib/module/tools/defineTool.js +74 -0
  57. package/lib/module/ui/components/ChangeRow.js +105 -0
  58. package/lib/module/ui/components/ChipStrip.js +91 -0
  59. package/lib/module/ui/components/DetailViewToggle.js +125 -0
  60. package/lib/module/ui/components/DevToolsCard.js +3 -1
  61. package/lib/module/ui/components/EmptyState.js +10 -2
  62. package/lib/module/ui/components/EntityFilterView.js +350 -0
  63. package/lib/module/ui/components/ExportPreview.js +169 -0
  64. package/lib/module/ui/components/InfoRow.js +86 -0
  65. package/lib/module/ui/components/ModalHeader.js +40 -7
  66. package/lib/module/ui/components/Pill.js +110 -0
  67. package/lib/module/ui/components/ToggleRow.js +112 -0
  68. package/lib/module/ui/components/ToolEmptyState.js +149 -0
  69. package/lib/module/ui/components/ToolFooter.js +196 -0
  70. package/lib/module/ui/components/WindowControls.js +8 -5
  71. package/lib/module/ui/components/index.js +13 -1
  72. package/lib/module/ui/index.js +7 -1
  73. package/lib/module/ui/listPresets.js +39 -0
  74. package/lib/module/ui/night/primitives.js +3 -1
  75. package/lib/module/ui/otto/OttoSprite.js +496 -0
  76. package/lib/module/ui/otto/index.js +20 -0
  77. package/lib/module/ui/otto/ottoEngine.js +2726 -0
  78. package/lib/module/ui/otto/ottoSheet.js +180 -0
  79. package/lib/module/utils/snapshotProviderKit.js +156 -0
  80. package/lib/module/utils/stateTools.js +154 -0
  81. package/lib/typescript/commonjs/JsModal.d.ts.map +1 -1
  82. package/lib/typescript/commonjs/hooks/index.d.ts +3 -1
  83. package/lib/typescript/commonjs/hooks/index.d.ts.map +1 -1
  84. package/lib/typescript/commonjs/hooks/safe-area-impl.d.ts +1 -1
  85. package/lib/typescript/commonjs/hooks/useChangeLog.d.ts +38 -0
  86. package/lib/typescript/commonjs/hooks/useChangeLog.d.ts.map +1 -0
  87. package/lib/typescript/commonjs/hooks/useEventStoreEvents.d.ts +25 -0
  88. package/lib/typescript/commonjs/hooks/useEventStoreEvents.d.ts.map +1 -0
  89. package/lib/typescript/commonjs/hooks/usePersistedState.d.ts +34 -5
  90. package/lib/typescript/commonjs/hooks/usePersistedState.d.ts.map +1 -1
  91. package/lib/typescript/commonjs/index.d.ts +6 -1
  92. package/lib/typescript/commonjs/index.d.ts.map +1 -1
  93. package/lib/typescript/commonjs/storage/definePersistedSetting.d.ts +39 -0
  94. package/lib/typescript/commonjs/storage/definePersistedSetting.d.ts.map +1 -0
  95. package/lib/typescript/commonjs/storage/devToolsStorageKeys.d.ts +12 -0
  96. package/lib/typescript/commonjs/storage/devToolsStorageKeys.d.ts.map +1 -1
  97. package/lib/typescript/commonjs/storage/index.d.ts +1 -0
  98. package/lib/typescript/commonjs/storage/index.d.ts.map +1 -1
  99. package/lib/typescript/commonjs/stores/ChangeLog.d.ts +100 -0
  100. package/lib/typescript/commonjs/stores/ChangeLog.d.ts.map +1 -0
  101. package/lib/typescript/commonjs/stores/createToolStore.d.ts +92 -0
  102. package/lib/typescript/commonjs/stores/createToolStore.d.ts.map +1 -0
  103. package/lib/typescript/commonjs/stores/index.d.ts +2 -0
  104. package/lib/typescript/commonjs/stores/index.d.ts.map +1 -1
  105. package/lib/typescript/commonjs/sync/toolSyncAdapter.d.ts +66 -0
  106. package/lib/typescript/commonjs/sync/toolSyncAdapter.d.ts.map +1 -0
  107. package/lib/typescript/commonjs/sync/wireForm.d.ts +100 -0
  108. package/lib/typescript/commonjs/sync/wireForm.d.ts.map +1 -0
  109. package/lib/typescript/commonjs/tools/defineTool.d.ts +100 -0
  110. package/lib/typescript/commonjs/tools/defineTool.d.ts.map +1 -0
  111. package/lib/typescript/commonjs/ui/components/ChangeRow.d.ts +52 -0
  112. package/lib/typescript/commonjs/ui/components/ChangeRow.d.ts.map +1 -0
  113. package/lib/typescript/commonjs/ui/components/ChipStrip.d.ts +41 -0
  114. package/lib/typescript/commonjs/ui/components/ChipStrip.d.ts.map +1 -0
  115. package/lib/typescript/commonjs/ui/components/DetailViewToggle.d.ts +36 -0
  116. package/lib/typescript/commonjs/ui/components/DetailViewToggle.d.ts.map +1 -0
  117. package/lib/typescript/commonjs/ui/components/DevToolsCard.d.ts +8 -1
  118. package/lib/typescript/commonjs/ui/components/DevToolsCard.d.ts.map +1 -1
  119. package/lib/typescript/commonjs/ui/components/EmptyState.d.ts +14 -1
  120. package/lib/typescript/commonjs/ui/components/EmptyState.d.ts.map +1 -1
  121. package/lib/typescript/commonjs/ui/components/EntityFilterView.d.ts +51 -0
  122. package/lib/typescript/commonjs/ui/components/EntityFilterView.d.ts.map +1 -0
  123. package/lib/typescript/commonjs/ui/components/ExportPreview.d.ts +48 -0
  124. package/lib/typescript/commonjs/ui/components/ExportPreview.d.ts.map +1 -0
  125. package/lib/typescript/commonjs/ui/components/InfoRow.d.ts +33 -0
  126. package/lib/typescript/commonjs/ui/components/InfoRow.d.ts.map +1 -0
  127. package/lib/typescript/commonjs/ui/components/ModalHeader.d.ts +31 -1
  128. package/lib/typescript/commonjs/ui/components/ModalHeader.d.ts.map +1 -1
  129. package/lib/typescript/commonjs/ui/components/Pill.d.ts +38 -0
  130. package/lib/typescript/commonjs/ui/components/Pill.d.ts.map +1 -0
  131. package/lib/typescript/commonjs/ui/components/ToggleRow.d.ts +33 -0
  132. package/lib/typescript/commonjs/ui/components/ToggleRow.d.ts.map +1 -0
  133. package/lib/typescript/commonjs/ui/components/ToolEmptyState.d.ts +113 -0
  134. package/lib/typescript/commonjs/ui/components/ToolEmptyState.d.ts.map +1 -0
  135. package/lib/typescript/commonjs/ui/components/ToolFooter.d.ts +69 -0
  136. package/lib/typescript/commonjs/ui/components/ToolFooter.d.ts.map +1 -0
  137. package/lib/typescript/commonjs/ui/components/WindowControls.d.ts +7 -1
  138. package/lib/typescript/commonjs/ui/components/WindowControls.d.ts.map +1 -1
  139. package/lib/typescript/commonjs/ui/components/index.d.ts +11 -0
  140. package/lib/typescript/commonjs/ui/components/index.d.ts.map +1 -1
  141. package/lib/typescript/commonjs/ui/index.d.ts +2 -0
  142. package/lib/typescript/commonjs/ui/index.d.ts.map +1 -1
  143. package/lib/typescript/commonjs/ui/listPresets.d.ts +28 -0
  144. package/lib/typescript/commonjs/ui/listPresets.d.ts.map +1 -0
  145. package/lib/typescript/commonjs/ui/night/primitives.d.ts +3 -1
  146. package/lib/typescript/commonjs/ui/night/primitives.d.ts.map +1 -1
  147. package/lib/typescript/commonjs/ui/otto/OttoSprite.d.ts +103 -0
  148. package/lib/typescript/commonjs/ui/otto/OttoSprite.d.ts.map +1 -0
  149. package/lib/typescript/commonjs/ui/otto/index.d.ts +19 -0
  150. package/lib/typescript/commonjs/ui/otto/index.d.ts.map +1 -0
  151. package/lib/typescript/commonjs/ui/otto/ottoEngine.d.ts +2205 -0
  152. package/lib/typescript/commonjs/ui/otto/ottoEngine.d.ts.map +1 -0
  153. package/lib/typescript/commonjs/ui/otto/ottoSheet.d.ts +73 -0
  154. package/lib/typescript/commonjs/ui/otto/ottoSheet.d.ts.map +1 -0
  155. package/lib/typescript/commonjs/utils/snapshotProviderKit.d.ts +81 -0
  156. package/lib/typescript/commonjs/utils/snapshotProviderKit.d.ts.map +1 -0
  157. package/lib/typescript/commonjs/utils/stateTools.d.ts +44 -0
  158. package/lib/typescript/commonjs/utils/stateTools.d.ts.map +1 -0
  159. package/lib/typescript/module/JsModal.d.ts.map +1 -1
  160. package/lib/typescript/module/hooks/index.d.ts +3 -1
  161. package/lib/typescript/module/hooks/index.d.ts.map +1 -1
  162. package/lib/typescript/module/hooks/safe-area-impl.d.ts +1 -1
  163. package/lib/typescript/module/hooks/useChangeLog.d.ts +38 -0
  164. package/lib/typescript/module/hooks/useChangeLog.d.ts.map +1 -0
  165. package/lib/typescript/module/hooks/useEventStoreEvents.d.ts +25 -0
  166. package/lib/typescript/module/hooks/useEventStoreEvents.d.ts.map +1 -0
  167. package/lib/typescript/module/hooks/usePersistedState.d.ts +34 -5
  168. package/lib/typescript/module/hooks/usePersistedState.d.ts.map +1 -1
  169. package/lib/typescript/module/index.d.ts +6 -1
  170. package/lib/typescript/module/index.d.ts.map +1 -1
  171. package/lib/typescript/module/storage/definePersistedSetting.d.ts +39 -0
  172. package/lib/typescript/module/storage/definePersistedSetting.d.ts.map +1 -0
  173. package/lib/typescript/module/storage/devToolsStorageKeys.d.ts +12 -0
  174. package/lib/typescript/module/storage/devToolsStorageKeys.d.ts.map +1 -1
  175. package/lib/typescript/module/storage/index.d.ts +1 -0
  176. package/lib/typescript/module/storage/index.d.ts.map +1 -1
  177. package/lib/typescript/module/stores/ChangeLog.d.ts +100 -0
  178. package/lib/typescript/module/stores/ChangeLog.d.ts.map +1 -0
  179. package/lib/typescript/module/stores/createToolStore.d.ts +92 -0
  180. package/lib/typescript/module/stores/createToolStore.d.ts.map +1 -0
  181. package/lib/typescript/module/stores/index.d.ts +2 -0
  182. package/lib/typescript/module/stores/index.d.ts.map +1 -1
  183. package/lib/typescript/module/sync/toolSyncAdapter.d.ts +66 -0
  184. package/lib/typescript/module/sync/toolSyncAdapter.d.ts.map +1 -0
  185. package/lib/typescript/module/sync/wireForm.d.ts +100 -0
  186. package/lib/typescript/module/sync/wireForm.d.ts.map +1 -0
  187. package/lib/typescript/module/tools/defineTool.d.ts +100 -0
  188. package/lib/typescript/module/tools/defineTool.d.ts.map +1 -0
  189. package/lib/typescript/module/ui/components/ChangeRow.d.ts +52 -0
  190. package/lib/typescript/module/ui/components/ChangeRow.d.ts.map +1 -0
  191. package/lib/typescript/module/ui/components/ChipStrip.d.ts +41 -0
  192. package/lib/typescript/module/ui/components/ChipStrip.d.ts.map +1 -0
  193. package/lib/typescript/module/ui/components/DetailViewToggle.d.ts +36 -0
  194. package/lib/typescript/module/ui/components/DetailViewToggle.d.ts.map +1 -0
  195. package/lib/typescript/module/ui/components/DevToolsCard.d.ts +8 -1
  196. package/lib/typescript/module/ui/components/DevToolsCard.d.ts.map +1 -1
  197. package/lib/typescript/module/ui/components/EmptyState.d.ts +14 -1
  198. package/lib/typescript/module/ui/components/EmptyState.d.ts.map +1 -1
  199. package/lib/typescript/module/ui/components/EntityFilterView.d.ts +51 -0
  200. package/lib/typescript/module/ui/components/EntityFilterView.d.ts.map +1 -0
  201. package/lib/typescript/module/ui/components/ExportPreview.d.ts +48 -0
  202. package/lib/typescript/module/ui/components/ExportPreview.d.ts.map +1 -0
  203. package/lib/typescript/module/ui/components/InfoRow.d.ts +33 -0
  204. package/lib/typescript/module/ui/components/InfoRow.d.ts.map +1 -0
  205. package/lib/typescript/module/ui/components/ModalHeader.d.ts +31 -1
  206. package/lib/typescript/module/ui/components/ModalHeader.d.ts.map +1 -1
  207. package/lib/typescript/module/ui/components/Pill.d.ts +38 -0
  208. package/lib/typescript/module/ui/components/Pill.d.ts.map +1 -0
  209. package/lib/typescript/module/ui/components/ToggleRow.d.ts +33 -0
  210. package/lib/typescript/module/ui/components/ToggleRow.d.ts.map +1 -0
  211. package/lib/typescript/module/ui/components/ToolEmptyState.d.ts +113 -0
  212. package/lib/typescript/module/ui/components/ToolEmptyState.d.ts.map +1 -0
  213. package/lib/typescript/module/ui/components/ToolFooter.d.ts +69 -0
  214. package/lib/typescript/module/ui/components/ToolFooter.d.ts.map +1 -0
  215. package/lib/typescript/module/ui/components/WindowControls.d.ts +7 -1
  216. package/lib/typescript/module/ui/components/WindowControls.d.ts.map +1 -1
  217. package/lib/typescript/module/ui/components/index.d.ts +11 -0
  218. package/lib/typescript/module/ui/components/index.d.ts.map +1 -1
  219. package/lib/typescript/module/ui/index.d.ts +2 -0
  220. package/lib/typescript/module/ui/index.d.ts.map +1 -1
  221. package/lib/typescript/module/ui/listPresets.d.ts +28 -0
  222. package/lib/typescript/module/ui/listPresets.d.ts.map +1 -0
  223. package/lib/typescript/module/ui/night/primitives.d.ts +3 -1
  224. package/lib/typescript/module/ui/night/primitives.d.ts.map +1 -1
  225. package/lib/typescript/module/ui/otto/OttoSprite.d.ts +103 -0
  226. package/lib/typescript/module/ui/otto/OttoSprite.d.ts.map +1 -0
  227. package/lib/typescript/module/ui/otto/index.d.ts +19 -0
  228. package/lib/typescript/module/ui/otto/index.d.ts.map +1 -0
  229. package/lib/typescript/module/ui/otto/ottoEngine.d.ts +2205 -0
  230. package/lib/typescript/module/ui/otto/ottoEngine.d.ts.map +1 -0
  231. package/lib/typescript/module/ui/otto/ottoSheet.d.ts +73 -0
  232. package/lib/typescript/module/ui/otto/ottoSheet.d.ts.map +1 -0
  233. package/lib/typescript/module/utils/snapshotProviderKit.d.ts +81 -0
  234. package/lib/typescript/module/utils/snapshotProviderKit.d.ts.map +1 -0
  235. package/lib/typescript/module/utils/stateTools.d.ts +44 -0
  236. package/lib/typescript/module/utils/stateTools.d.ts.map +1 -0
  237. package/package.json +4 -4
@@ -0,0 +1,172 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.WIRE_INLINE_LIMIT_BYTES = exports.WIRE_DETAIL_LIMIT_BYTES = void 0;
7
+ exports.capDetail = capDetail;
8
+ exports.detailByIdAction = detailByIdAction;
9
+ exports.isOnDeviceMarker = isOnDeviceMarker;
10
+ exports.memoByIdentity = memoByIdentity;
11
+ exports.newestFitting = newestFitting;
12
+ exports.onDeviceMarker = onDeviceMarker;
13
+ exports.readParams = readParams;
14
+ exports.sizeOrStub = sizeOrStub;
15
+ exports.toWire = toWire;
16
+ exports.truncatedNote = truncatedNote;
17
+ var _wireBudget = require("./wireBudget.js");
18
+ /**
19
+ * wireForm — how a tool turns what it holds into what it may put on the wire.
20
+ *
21
+ * Every adapter that ships large values faces the same four problems, and
22
+ * nine of them solved each one separately:
23
+ *
24
+ * 1. A per-item cap on the snapshot stream (16 KB), with a MARKER left in
25
+ * the value's place so the dashboard knows to fetch it on demand.
26
+ * 2. A much larger cap on that on-demand detail fetch (8 MB), with a
27
+ * TRUNCATION NOTE when even that is exceeded.
28
+ * 3. An identity-keyed cache for the wire form, because a snapshot is
29
+ * rebuilt ~5×/sec while a dashboard watches and stores never mutate a
30
+ * recorded item — so converting each item once is correct and cheap.
31
+ * 4. For tools whose items are individually fat (console, sentry), a
32
+ * newest-first walk that keeps as many items as fit a snapshot budget.
33
+ *
34
+ * Marker KEY NAMES are part of the wire protocol — Buoy Desktop and the
35
+ * tool stores test for `__buoyStateOnDevice`, `__buoyPayloadOnDevice`,
36
+ * `__buoyValueOnDevice` — so the factory builds exactly those keys.
37
+ */
38
+
39
+ /** Per-item budget on the snapshot stream. Anything larger stays on-device. */
40
+ const WIRE_INLINE_LIMIT_BYTES = exports.WIRE_INLINE_LIMIT_BYTES = 16 * 1024;
41
+
42
+ /**
43
+ * Upper bound for one on-demand detail response. Generous — this is a single
44
+ * explicit fetch, not a per-item stream — but still guarded so a pathological
45
+ * tree can't OOM the device through the reply emit.
46
+ */
47
+ const WIRE_DETAIL_LIMIT_BYTES = exports.WIRE_DETAIL_LIMIT_BYTES = 8 * 1024 * 1024;
48
+
49
+ /** A frozen `{ __buoy<Kind>OnDevice: true, note }` marker. */
50
+
51
+ /**
52
+ * Build the sentinel a wire-form snapshot carries in place of a value that
53
+ * stays on the device. `kind` names the value ("State", "Payload", "Value",
54
+ * "Params", "Data", …) and becomes the key the reader tests for.
55
+ */
56
+ function onDeviceMarker(kind, note) {
57
+ return Object.freeze({
58
+ [`__buoy${kind}OnDevice`]: true,
59
+ note
60
+ });
61
+ }
62
+
63
+ /** True when `value` is the on-device marker for `kind`. */
64
+ function isOnDeviceMarker(value, kind) {
65
+ return typeof value === "object" && value !== null && value[`__buoy${kind}OnDevice`] === true;
66
+ }
67
+
68
+ /** The note a detail fetch returns when a single field exceeds the detail cap. */
69
+ function truncatedNote(limitBytes = WIRE_DETAIL_LIMIT_BYTES) {
70
+ const mb = limitBytes / (1024 * 1024);
71
+ return {
72
+ __buoyTruncated: true,
73
+ note: `Exceeds the ${mb}MB detail limit — inspect it on-device.`
74
+ };
75
+ }
76
+
77
+ /**
78
+ * The value itself if it fits `limit` (and is serializable), else `marker`.
79
+ * `undefined` passes through untouched: an absent field must stay absent.
80
+ */
81
+ function toWire(value, marker, limit = WIRE_INLINE_LIMIT_BYTES) {
82
+ if (value === undefined) return value;
83
+ return (0, _wireBudget.isOverWireBudget)(value, limit) ? marker : value;
84
+ }
85
+
86
+ /** Detail-fetch cap: the value, or a truncation note when it is too big. */
87
+ function capDetail(value, limit = WIRE_DETAIL_LIMIT_BYTES) {
88
+ return (0, _wireBudget.isOverWireBudget)(value, limit) ? truncatedNote(limit) : value;
89
+ }
90
+
91
+ /**
92
+ * Memoize a wire-form conversion by item identity. Correct for any store
93
+ * that prepends and never mutates a recorded item — the cache self-invalidates
94
+ * when the item is dropped from the buffer.
95
+ */
96
+ function memoByIdentity(convert) {
97
+ const cache = new WeakMap();
98
+ return item => {
99
+ const cached = cache.get(item);
100
+ if (cached !== undefined) return cached;
101
+ const converted = convert(item);
102
+ cache.set(item, converted);
103
+ return converted;
104
+ };
105
+ }
106
+ /**
107
+ * Walk `items` (oldest-first) from the newest end, keeping every item until
108
+ * the budget is spent. Always keeps at least one so an over-budget newest
109
+ * item still reaches the dashboard as a stub rather than an empty panel.
110
+ * Returns oldest-first, matching the input.
111
+ */
112
+ function newestFitting(items, options) {
113
+ const out = [];
114
+ let bytes = options.baseBytes ?? 16;
115
+ for (let i = items.length - 1; i >= 0; i--) {
116
+ const wired = options.toWire(items[i]);
117
+ if (bytes + wired.bytes > options.budget && out.length > 0) break;
118
+ out.push(wired.value);
119
+ bytes += wired.bytes;
120
+ }
121
+ out.reverse();
122
+ return out;
123
+ }
124
+
125
+ /**
126
+ * Size one wire-form item against a per-item cap, substituting a stub when it
127
+ * is too fat. One walk decides both "too big?" and "what does it cost".
128
+ */
129
+ function sizeOrStub(wired, limit, stub) {
130
+ const size = (0, _wireBudget.approxJsonSize)(wired, limit);
131
+ if (size.bytes <= limit) return {
132
+ value: wired,
133
+ bytes: size.bytes
134
+ };
135
+ const stubbed = stub();
136
+ return {
137
+ value: stubbed,
138
+ bytes: (0, _wireBudget.approxJsonSize)(stubbed, limit).bytes
139
+ };
140
+ }
141
+
142
+ /** `(params as T | undefined) ?? {}` — the first line of every action. */
143
+ function readParams(params) {
144
+ return params ?? {};
145
+ }
146
+ /**
147
+ * The on-demand detail action every change-log tool exposes: look one item
148
+ * up by id, and return its detail fields size-capped. Replaces the
149
+ * `missing id` / `unknown id` boilerplate copied into each adapter.
150
+ */
151
+ function detailByIdAction(lookup, detail, limit = WIRE_DETAIL_LIMIT_BYTES) {
152
+ const cap = value => capDetail(value, limit);
153
+ return params => {
154
+ const {
155
+ id
156
+ } = readParams(params);
157
+ if (!id) return {
158
+ found: false,
159
+ reason: "missing id"
160
+ };
161
+ const item = lookup(id);
162
+ if (!item) return {
163
+ found: false,
164
+ reason: "unknown id"
165
+ };
166
+ return {
167
+ found: true,
168
+ id,
169
+ ...detail(item, cap)
170
+ };
171
+ };
172
+ }
@@ -0,0 +1,79 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.createToolFactory = createToolFactory;
7
+ exports.defineToolPreset = defineToolPreset;
8
+ /**
9
+ * defineToolPreset / createToolFactory — the typed way to declare a tool.
10
+ *
11
+ * Every tool package exports a `xToolPreset` object literal and a
12
+ * `createXTool(options)` factory that restates the same literal with
13
+ * `options?.name || default` on each field. None of the 23 presets was
14
+ * annotated with core's `InstalledApp`, so a preset that drifted from the
15
+ * contract (a bad `slot`, a missing `component`) failed at runtime in the
16
+ * dial, not at compile time.
17
+ *
18
+ * `ToolPreset` is that contract, declared here in shared (which every tool
19
+ * already depends on) and structurally identical to core's `InstalledApp`.
20
+ * `defineToolPreset` is an identity function that type-checks the literal;
21
+ * `createToolFactory` derives the `createXTool` function from the preset so
22
+ * the defaults live in exactly one place.
23
+ *
24
+ * Auto-discovery (core's `autoDiscoverPresets` / `autoExternalSync`) stays
25
+ * as hand-written `require()` blocks on purpose: Metro needs each package
26
+ * name as a static string lexically inside its own try, so a manifest can't
27
+ * replace them.
28
+ */
29
+
30
+ /** Where a tool should render within the floating menu surface. */
31
+
32
+ /** What an icon renderer receives. Mirrors core's `FloatingMenuRenderCtx`. */
33
+
34
+ /** Declarative modal chrome for a body-only tool. Mirrors core's `ToolModalConfig`. */
35
+
36
+ /**
37
+ * The shape the floating menu installs. Structurally identical to core's
38
+ * `InstalledApp`; declared here so tool packages can type their presets
39
+ * without depending on core.
40
+ */
41
+
42
+ /** Identity with a type check: the literal must satisfy `ToolPreset`. */
43
+ function defineToolPreset(preset) {
44
+ return preset;
45
+ }
46
+
47
+ /** The overrides every `createXTool` accepted. */
48
+
49
+ /**
50
+ * Derive `createXTool(options)` from a preset: id/name/description overrides
51
+ * apply on top, and `mapProps` turns tool-specific options into `props`
52
+ * (merged over the preset's defaults).
53
+ *
54
+ * ```ts
55
+ * export const createNetworkTool = createToolFactory(networkToolPreset, (o: { enableSharedModalDimensions?: boolean }) => ({
56
+ * enableSharedModalDimensions: o.enableSharedModalDimensions ?? false,
57
+ * }));
58
+ * ```
59
+ */
60
+ function createToolFactory(preset, mapProps, /** Last word on any other preset field (a recolored icon, say). */
61
+ extend) {
62
+ return options => {
63
+ const overrides = options ?? {};
64
+ const props = preset.props === undefined && !mapProps ? undefined : {
65
+ ...(preset.props ?? {}),
66
+ ...(mapProps ? mapProps(overrides) : {})
67
+ };
68
+ return {
69
+ ...preset,
70
+ id: overrides.id || preset.id,
71
+ name: overrides.name || preset.name,
72
+ description: overrides.description || preset.description,
73
+ ...(props !== undefined ? {
74
+ props
75
+ } : {}),
76
+ ...(extend ? extend(overrides, preset) : {})
77
+ };
78
+ };
79
+ }
@@ -0,0 +1,110 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.ChangeRow = ChangeRow;
7
+ var _react = _interopRequireDefault(require("react"));
8
+ var _reactNative = require("react-native");
9
+ var _gameUIColors = require("../gameUI/constants/gameUIColors.js");
10
+ var _CompactRow = require("./CompactRow.js");
11
+ var _index = require("../../icons/index.js");
12
+ var _RelativeTime = require("../../utils/time/RelativeTime.js");
13
+ var _jsxRuntime = require("react/jsx-runtime");
14
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
15
+ /**
16
+ * ChangeRow — one recorded change in a state tool's history list.
17
+ *
18
+ * redux, zustand and jotai each drew the same row on top of `CompactRow`:
19
+ * a colored status word (the slice / store / atom), a sublabel ("1.2ms ·
20
+ * 3 keys changed"), the primary line (changed keys or a value preview), a
21
+ * relative timestamp, and a right-hand badge made of a mono verb (SET,
22
+ * WRITE, ADDITEM) plus an icon — a lightning bolt when state actually
23
+ * changed, a clock when the update was slow. The three copies differed
24
+ * only in how they computed those strings. This component owns the drawing;
25
+ * tools own the strings.
26
+ *
27
+ * testID convention (unchanged from the originals): `${testID}-badge`,
28
+ * `${testID}-change`, `${testID}-slow`, `${testID}-status`,
29
+ * `${testID}-sublabel`, `${testID}-keys`.
30
+ */
31
+
32
+ function ChangeRow({
33
+ statusColor,
34
+ statusLabel,
35
+ sublabel,
36
+ primaryText,
37
+ timestamp,
38
+ badgeText,
39
+ changed = false,
40
+ slow = false,
41
+ badgePrefix,
42
+ customBadge,
43
+ plainBadgeText,
44
+ onPress,
45
+ testID,
46
+ accessibilityLabel
47
+ }) {
48
+ // Always a custom badge, even when there is no icon to hang off it. The
49
+ // alternative — letting CompactRow draw `badgeText` itself — leaves the one
50
+ // row whose badge matters most (a write that changed NOTHING) as the only
51
+ // row in the list with no handle on its badge.
52
+ const badge = customBadge ?? (badgeText !== undefined || badgePrefix || changed || slow ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
53
+ style: styles.badgeContainer,
54
+ children: [badgePrefix, badgeText !== undefined ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
55
+ style: [styles.badgeText, {
56
+ color: statusColor
57
+ }],
58
+ testID: testID ? `${testID}-badge` : undefined,
59
+ children: badgeText
60
+ }) : null, slow ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
61
+ style: styles.iconBadge,
62
+ testID: testID ? `${testID}-slow` : undefined,
63
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_index.Clock, {
64
+ size: 12,
65
+ color: _gameUIColors.buoyColors.error
66
+ })
67
+ }) : changed ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
68
+ style: styles.iconBadge,
69
+ testID: testID ? `${testID}-change` : undefined,
70
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_index.Zap, {
71
+ size: 12,
72
+ color: _gameUIColors.buoyColors.warning
73
+ })
74
+ }) : null]
75
+ }) : undefined);
76
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_CompactRow.CompactRow, {
77
+ statusDotColor: statusColor,
78
+ statusLabel: statusLabel,
79
+ statusSublabel: sublabel,
80
+ primaryText: primaryText,
81
+ bottomRightText: /*#__PURE__*/(0, _jsxRuntime.jsx)(_RelativeTime.RelativeTime, {
82
+ timestamp: timestamp
83
+ }),
84
+ customBadge: badge,
85
+ badgeText: badge ? undefined : plainBadgeText,
86
+ badgeColor: statusColor,
87
+ showChevron: true,
88
+ onPress: onPress,
89
+ testID: testID,
90
+ statusTestID: testID ? `${testID}-status` : undefined,
91
+ statusSublabelTestID: testID ? `${testID}-sublabel` : undefined,
92
+ primaryTestID: testID ? `${testID}-keys` : undefined,
93
+ accessibilityLabel: accessibilityLabel
94
+ });
95
+ }
96
+ const styles = _reactNative.StyleSheet.create({
97
+ badgeContainer: {
98
+ flexDirection: "row",
99
+ alignItems: "center",
100
+ gap: 4
101
+ },
102
+ badgeText: {
103
+ fontSize: 11,
104
+ fontWeight: "600",
105
+ fontFamily: "monospace"
106
+ },
107
+ iconBadge: {
108
+ paddingHorizontal: 4
109
+ }
110
+ });
@@ -0,0 +1,94 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.ChipStrip = ChipStrip;
7
+ exports.useChipTap = useChipTap;
8
+ var _react = require("react");
9
+ var _reactNative = require("react-native");
10
+ var _jsxRuntime = require("react/jsx-runtime");
11
+ /**
12
+ * ChipStrip — a horizontally scrolling row of filter chips whose taps
13
+ * don't misfire while the strip is being panned.
14
+ *
15
+ * react-query drew this three times (query status, mutation status, storage
16
+ * type) with the same 5-point / 300 ms swipe-vs-tap discrimination. The
17
+ * strip and the discrimination live here; the chip is whatever the tool
18
+ * renders, wired through `useChipTap`.
19
+ */
20
+
21
+ /** How far a touch may travel and still count as a tap. */const TAP_SLOP_PX = 5;
22
+ /** How long after a scroll ends taps stay suppressed. */
23
+ const SCROLL_SETTLE_MS = 300;
24
+ /**
25
+ * Swipe-vs-tap discrimination for chips inside a horizontal ScrollView.
26
+ * A press that moved more than a few points, or landed while the strip was
27
+ * still scrolling, is a pan — not a filter toggle.
28
+ */
29
+ function useChipTap() {
30
+ const [isScrolling, setIsScrolling] = (0, _react.useState)(false);
31
+ const touchStartX = (0, _react.useRef)(0);
32
+ const touchStartY = (0, _react.useRef)(0);
33
+ const onTouchStart = (0, _react.useCallback)(event => {
34
+ touchStartX.current = event.nativeEvent.pageX;
35
+ touchStartY.current = event.nativeEvent.pageY;
36
+ }, []);
37
+ const isTap = (0, _react.useCallback)(event => {
38
+ if (!event) return true;
39
+ const dx = Math.abs(event.nativeEvent.pageX - touchStartX.current);
40
+ const dy = Math.abs(event.nativeEvent.pageY - touchStartY.current);
41
+ return !(dx > TAP_SLOP_PX || dy > TAP_SLOP_PX || isScrolling);
42
+ }, [isScrolling]);
43
+ const settle = (0, _react.useCallback)(() => {
44
+ setTimeout(() => setIsScrolling(false), SCROLL_SETTLE_MS);
45
+ }, []);
46
+ const begin = (0, _react.useCallback)(() => setIsScrolling(true), []);
47
+ return {
48
+ scrollProps: {
49
+ onScrollBeginDrag: begin,
50
+ onScrollEndDrag: settle,
51
+ onMomentumScrollBegin: begin,
52
+ onMomentumScrollEnd: settle
53
+ },
54
+ onTouchStart,
55
+ isTap
56
+ };
57
+ }
58
+ function ChipStrip({
59
+ children,
60
+ scrollProps,
61
+ sentryLabel,
62
+ style,
63
+ contentStyle
64
+ }) {
65
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
66
+ style: [styles.container, style],
67
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.ScrollView, {
68
+ "sentry-label": sentryLabel,
69
+ horizontal: true,
70
+ showsHorizontalScrollIndicator: false,
71
+ style: styles.scrollView,
72
+ contentContainerStyle: [styles.scrollContent, contentStyle],
73
+ ...scrollProps,
74
+ children: children
75
+ })
76
+ });
77
+ }
78
+ const styles = _reactNative.StyleSheet.create({
79
+ container: {
80
+ flex: 1,
81
+ minWidth: 0
82
+ },
83
+ scrollView: {
84
+ flex: 1
85
+ },
86
+ scrollContent: {
87
+ flexDirection: "row",
88
+ alignItems: "center",
89
+ gap: 8,
90
+ paddingHorizontal: 4,
91
+ paddingVertical: 4,
92
+ flexGrow: 1
93
+ }
94
+ });
@@ -0,0 +1,130 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.DetailViewToggle = void 0;
7
+ var _react = _interopRequireWildcard(require("react"));
8
+ var _reactNative = require("react-native");
9
+ var _nightTheme = require("../night/nightTheme.js");
10
+ var _jsxRuntime = require("react/jsx-runtime");
11
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
12
+ /**
13
+ * DetailViewToggle — the row of view cards at the top of a detail screen
14
+ * (ACTION · STATE · DIFF, CHANGE · STATE · DIFF, …).
15
+ *
16
+ * redux, zustand and jotai each shipped their own copy, differing only in
17
+ * the view keys, labels and testID prefix. The cards, the accent chrome,
18
+ * the disabled state (diff with nothing to compare) and the a11y contract
19
+ * are all one component now; tools pass their `views`.
20
+ */
21
+
22
+ function DetailViewToggleImpl({
23
+ views,
24
+ activeView,
25
+ onViewChange,
26
+ disabledKeys,
27
+ testIDPrefix
28
+ }) {
29
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
30
+ style: styles.container,
31
+ children: views.map(view => {
32
+ const isActive = activeView === view.key;
33
+ const isDisabled = disabledKeys?.includes(view.key) ?? false;
34
+ const activeColor = view.activeColor ?? _nightTheme.night.color.accent;
35
+ const IconComponent = view.icon;
36
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.TouchableOpacity, {
37
+ style: [styles.card, isActive && [styles.cardActive, {
38
+ borderColor: activeColor
39
+ }], isDisabled && styles.cardDisabled],
40
+ onPress: () => !isDisabled && onViewChange(view.key),
41
+ activeOpacity: isDisabled ? 1 : 0.8,
42
+ disabled: isDisabled,
43
+ testID: testIDPrefix ? `${testIDPrefix}-view-${view.key}` : undefined,
44
+ accessibilityRole: "button",
45
+ accessibilityLabel: view.label,
46
+ accessibilityState: {
47
+ selected: isActive,
48
+ disabled: isDisabled
49
+ },
50
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
51
+ style: styles.cardContent,
52
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(IconComponent, {
53
+ size: 14,
54
+ color: isActive ? activeColor : isDisabled ? _nightTheme.night.color.textTertiary : _nightTheme.night.color.textSecondary
55
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
56
+ style: [styles.cardLabel, isActive && [styles.cardLabelActive, {
57
+ color: activeColor
58
+ }], isDisabled && styles.cardLabelDisabled],
59
+ children: view.label
60
+ })]
61
+ }), view.description ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
62
+ style: [styles.cardDescription, isActive && styles.cardDescriptionActive, isDisabled && styles.cardDescriptionDisabled],
63
+ children: view.description
64
+ }) : null]
65
+ }, view.key);
66
+ })
67
+ });
68
+ }
69
+ const DetailViewToggle = exports.DetailViewToggle = /*#__PURE__*/(0, _react.memo)(DetailViewToggleImpl);
70
+ const styles = _reactNative.StyleSheet.create({
71
+ container: {
72
+ flexDirection: "row",
73
+ gap: 8,
74
+ padding: 14,
75
+ // Transparent so the night sheet's star field shows through.
76
+ backgroundColor: "transparent"
77
+ },
78
+ card: {
79
+ flex: 1,
80
+ backgroundColor: _nightTheme.night.color.surface,
81
+ borderRadius: 12,
82
+ borderWidth: 1,
83
+ borderColor: _nightTheme.night.color.border,
84
+ padding: 10,
85
+ gap: 4
86
+ },
87
+ cardActive: {
88
+ borderWidth: 1.5,
89
+ backgroundColor: _nightTheme.night.color.accentSoft,
90
+ shadowColor: _nightTheme.night.color.accent,
91
+ shadowOffset: {
92
+ width: 0,
93
+ height: 2
94
+ },
95
+ shadowOpacity: 0.1,
96
+ shadowRadius: 8,
97
+ elevation: 3
98
+ },
99
+ cardDisabled: {
100
+ opacity: 0.5
101
+ },
102
+ cardContent: {
103
+ flexDirection: "row",
104
+ alignItems: "center",
105
+ gap: 6
106
+ },
107
+ cardLabel: {
108
+ fontSize: 10,
109
+ fontWeight: "700",
110
+ letterSpacing: 0.5,
111
+ color: _nightTheme.night.color.textSecondary
112
+ },
113
+ cardLabelActive: {
114
+ color: _nightTheme.night.color.text
115
+ },
116
+ cardLabelDisabled: {
117
+ color: _nightTheme.night.color.textTertiary
118
+ },
119
+ cardDescription: {
120
+ fontSize: 9,
121
+ color: _nightTheme.night.color.textTertiary,
122
+ lineHeight: 12
123
+ },
124
+ cardDescriptionActive: {
125
+ color: _nightTheme.night.color.textSecondary
126
+ },
127
+ cardDescriptionDisabled: {
128
+ color: _nightTheme.night.color.textTertiary
129
+ }
130
+ });
@@ -49,7 +49,8 @@ function DevToolsCard({
49
49
  style,
50
50
  contentStyle,
51
51
  testID,
52
- accessibilityLabel
52
+ accessibilityLabel,
53
+ accessible
53
54
  }) {
54
55
  const isInteractive = !!onPress || !!onLongPress;
55
56
 
@@ -58,6 +59,7 @@ function DevToolsCard({
58
59
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
59
60
  style: [styles.wrapper, style],
60
61
  testID: testID,
62
+ accessible: accessible,
61
63
  accessibilityLabel: accessibilityLabel,
62
64
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
63
65
  style: [styles.card, isSelected && styles.selectedCard, contentStyle],
@@ -9,11 +9,13 @@ exports.NoResultsEmptyState = NoResultsEmptyState;
9
9
  exports.NoSearchResultsEmptyState = NoSearchResultsEmptyState;
10
10
  var _reactNative = require("react-native");
11
11
  var _macOSDesignSystemColors = require("../gameUI/constants/macOSDesignSystemColors.js");
12
+ var _index = require("../otto/index.js");
12
13
  var _jsxRuntime = require("react/jsx-runtime");
13
14
  /**
14
15
  * Reusable empty state component for consistent empty/no-data displays
15
16
  */
16
17
  function EmptyState({
18
+ otto,
17
19
  title,
18
20
  description,
19
21
  icon: Icon,
@@ -28,13 +30,19 @@ function EmptyState({
28
30
  style: containerStyle,
29
31
  children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
30
32
  style: styles.content,
31
- children: [Icon && /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
33
+ children: [otto ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
34
+ style: styles.iconContainer,
35
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_index.Otto, {
36
+ state: otto,
37
+ pixelSize: Math.max(2, Math.round(iconSize / 16))
38
+ })
39
+ }) : Icon ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
32
40
  style: styles.iconContainer,
33
41
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(Icon, {
34
42
  size: iconSize,
35
43
  color: iconColor
36
44
  })
37
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
45
+ }) : null, /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
38
46
  style: styles.title,
39
47
  children: title
40
48
  }), description && /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {