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