@buoy-gg/shared-ui 7.0.33 → 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 +57 -22
- 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/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/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/ToolFooter.js +204 -0
- package/lib/commonjs/ui/components/index.js +100 -1
- package/lib/commonjs/ui/index.js +24 -2
- package/lib/commonjs/ui/listPresets.js +43 -0
- package/lib/commonjs/ui/night/primitives.js +3 -1
- package/lib/commonjs/utils/snapshotProviderKit.js +167 -0
- package/lib/commonjs/utils/stateTools.js +160 -0
- package/lib/module/JsModal.js +57 -22
- 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/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/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/ToolFooter.js +196 -0
- package/lib/module/ui/components/index.js +10 -1
- package/lib/module/ui/index.js +4 -1
- package/lib/module/ui/listPresets.js +39 -0
- package/lib/module/ui/night/primitives.js +3 -1
- 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/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/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/ToolFooter.d.ts +69 -0
- package/lib/typescript/commonjs/ui/components/ToolFooter.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/components/index.d.ts +9 -0
- package/lib/typescript/commonjs/ui/components/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/index.d.ts +1 -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/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/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/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/ToolFooter.d.ts +69 -0
- package/lib/typescript/module/ui/components/ToolFooter.d.ts.map +1 -0
- package/lib/typescript/module/ui/components/index.d.ts +9 -0
- package/lib/typescript/module/ui/components/index.d.ts.map +1 -1
- package/lib/typescript/module/ui/index.d.ts +1 -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/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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/stores/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EACL,cAAc,EACd,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,qBAAqB,GAC3B,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACL,oBAAoB,EACpB,kBAAkB,EAClB,wBAAwB,EACxB,YAAY,EACZ,KAAK,cAAc,EACnB,KAAK,uBAAuB,EAC5B,KAAK,wBAAwB,GAC9B,MAAM,wBAAwB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/stores/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EACL,cAAc,EACd,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,qBAAqB,GAC3B,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACL,oBAAoB,EACpB,kBAAkB,EAClB,wBAAwB,EACxB,YAAY,EACZ,KAAK,cAAc,EACnB,KAAK,uBAAuB,EAC5B,KAAK,wBAAwB,GAC9B,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EACL,eAAe,EACf,KAAK,SAAS,EACd,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACnB,KAAK,iBAAiB,GACvB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACL,SAAS,EACT,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,KAAK,UAAU,GAChB,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ToolSyncAdapter — the contract a tool implements to sync to Buoy Desktop /
|
|
3
|
+
* the MCP server, plus `createSyncAdapter`, the one way to build one.
|
|
4
|
+
*
|
|
5
|
+
* Every tool package used to declare its adapter as a bare object literal
|
|
6
|
+
* with the comment "structurally matches external-sync's ToolSyncAdapter so
|
|
7
|
+
* this package doesn't need a dependency on it". That kept the packages
|
|
8
|
+
* decoupled but left the contract unchecked: storage shipped `version: 3`
|
|
9
|
+
* while every sibling was on 2 and nothing noticed. The type now lives here,
|
|
10
|
+
* in shared (which every tool already depends on), and external-sync
|
|
11
|
+
* re-exports it — one definition, checked everywhere.
|
|
12
|
+
*
|
|
13
|
+
* `createSyncAdapter` is deliberately thin. It:
|
|
14
|
+
* - type-checks the literal against the contract (a wrong `subscribe`
|
|
15
|
+
* signature or a non-function action fails at compile time),
|
|
16
|
+
* - keeps the CONCRETE `actions` type, so `adapter.actions.getChangeDetail()`
|
|
17
|
+
* stays typed for tests and callers,
|
|
18
|
+
* - merges several change sources into one `subscribe` (a store plus its
|
|
19
|
+
* registry, envelopes plus drops) — the second most-copied block.
|
|
20
|
+
*/
|
|
21
|
+
/** A remote-invocable action. Thrown errors are reported back to the dashboard. */
|
|
22
|
+
export type ToolAction = (params: unknown) => unknown | Promise<unknown>;
|
|
23
|
+
/** Anything that can tell the bridge "something changed". */
|
|
24
|
+
export type ChangeSource = (onChange: () => void) => () => void;
|
|
25
|
+
/**
|
|
26
|
+
* The contract each dev tool implements to become remotely syncable.
|
|
27
|
+
* Works with BaseEventStore, ChangeLog, createToolStore, or any pattern
|
|
28
|
+
* exposing subscribe + getSnapshot.
|
|
29
|
+
*
|
|
30
|
+
* Payloads (snapshots and action results) must be JSON-serializable —
|
|
31
|
+
* no functions, circular references, or class instances.
|
|
32
|
+
*/
|
|
33
|
+
export interface ToolSyncAdapter {
|
|
34
|
+
/** Version of this tool's payload shape. Bump on breaking changes. */
|
|
35
|
+
version: number;
|
|
36
|
+
/** Current full state — sent when a dashboard starts watching or requests state. */
|
|
37
|
+
getSnapshot: () => unknown;
|
|
38
|
+
/**
|
|
39
|
+
* Fires on state changes. Only called while at least one dashboard is
|
|
40
|
+
* watching this tool; the bridge subscribes/unsubscribes on demand so
|
|
41
|
+
* stores with auto start/stop lifecycles stay idle when unwatched.
|
|
42
|
+
*/
|
|
43
|
+
subscribe: ChangeSource;
|
|
44
|
+
/** Remote-invocable actions, keyed by action name. */
|
|
45
|
+
actions?: Record<string, ToolAction>;
|
|
46
|
+
}
|
|
47
|
+
export interface SyncAdapterDefinition<TSnapshot, TActions extends Record<string, ToolAction> | undefined> {
|
|
48
|
+
version: number;
|
|
49
|
+
getSnapshot: () => TSnapshot;
|
|
50
|
+
/** One source, or several that are merged into a single subscription. */
|
|
51
|
+
subscribe: ChangeSource | ChangeSource[];
|
|
52
|
+
actions?: TActions;
|
|
53
|
+
}
|
|
54
|
+
export type SyncAdapter<TSnapshot, TActions extends Record<string, ToolAction> | undefined> = {
|
|
55
|
+
version: number;
|
|
56
|
+
getSnapshot: () => TSnapshot;
|
|
57
|
+
subscribe: ChangeSource;
|
|
58
|
+
} & (TActions extends undefined ? {
|
|
59
|
+
actions?: undefined;
|
|
60
|
+
} : {
|
|
61
|
+
actions: TActions;
|
|
62
|
+
});
|
|
63
|
+
/** Subscribe to every source; the returned function unsubscribes from all. */
|
|
64
|
+
export declare function mergeChangeSources(sources: ChangeSource[]): ChangeSource;
|
|
65
|
+
export declare function createSyncAdapter<TSnapshot, TActions extends Record<string, ToolAction> | undefined = undefined>(definition: SyncAdapterDefinition<TSnapshot, TActions>): SyncAdapter<TSnapshot, TActions>;
|
|
66
|
+
//# sourceMappingURL=toolSyncAdapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toolSyncAdapter.d.ts","sourceRoot":"","sources":["../../../../src/sync/toolSyncAdapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,mFAAmF;AACnF,MAAM,MAAM,UAAU,GAAG,CAAC,MAAM,EAAE,OAAO,KAAK,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;AAEzE,6DAA6D;AAC7D,MAAM,MAAM,YAAY,GAAG,CAAC,QAAQ,EAAE,MAAM,IAAI,KAAK,MAAM,IAAI,CAAC;AAEhE;;;;;;;GAOG;AACH,MAAM,WAAW,eAAe;IAC9B,sEAAsE;IACtE,OAAO,EAAE,MAAM,CAAC;IAChB,oFAAoF;IACpF,WAAW,EAAE,MAAM,OAAO,CAAC;IAC3B;;;;OAIG;IACH,SAAS,EAAE,YAAY,CAAC;IACxB,sDAAsD;IACtD,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;CACtC;AAED,MAAM,WAAW,qBAAqB,CACpC,SAAS,EACT,QAAQ,SAAS,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,GAAG,SAAS;IAEvD,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,SAAS,CAAC;IAC7B,yEAAyE;IACzE,SAAS,EAAE,YAAY,GAAG,YAAY,EAAE,CAAC;IACzC,OAAO,CAAC,EAAE,QAAQ,CAAC;CACpB;AAED,MAAM,MAAM,WAAW,CACrB,SAAS,EACT,QAAQ,SAAS,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,GAAG,SAAS,IACrD;IACF,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,SAAS,CAAC;IAC7B,SAAS,EAAE,YAAY,CAAC;CACzB,GAAG,CAAC,QAAQ,SAAS,SAAS,GAAG;IAAE,OAAO,CAAC,EAAE,SAAS,CAAA;CAAE,GAAG;IAAE,OAAO,EAAE,QAAQ,CAAA;CAAE,CAAC,CAAC;AAEnF,8EAA8E;AAC9E,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,YAAY,EAAE,GAAG,YAAY,CAQxE;AAED,wBAAgB,iBAAiB,CAC/B,SAAS,EACT,QAAQ,SAAS,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,GAAG,SAAS,GAAG,SAAS,EACnE,UAAU,EAAE,qBAAqB,CAAC,SAAS,EAAE,QAAQ,CAAC,GAAG,WAAW,CAAC,SAAS,EAAE,QAAQ,CAAC,CAW1F"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* wireForm — how a tool turns what it holds into what it may put on the wire.
|
|
3
|
+
*
|
|
4
|
+
* Every adapter that ships large values faces the same four problems, and
|
|
5
|
+
* nine of them solved each one separately:
|
|
6
|
+
*
|
|
7
|
+
* 1. A per-item cap on the snapshot stream (16 KB), with a MARKER left in
|
|
8
|
+
* the value's place so the dashboard knows to fetch it on demand.
|
|
9
|
+
* 2. A much larger cap on that on-demand detail fetch (8 MB), with a
|
|
10
|
+
* TRUNCATION NOTE when even that is exceeded.
|
|
11
|
+
* 3. An identity-keyed cache for the wire form, because a snapshot is
|
|
12
|
+
* rebuilt ~5×/sec while a dashboard watches and stores never mutate a
|
|
13
|
+
* recorded item — so converting each item once is correct and cheap.
|
|
14
|
+
* 4. For tools whose items are individually fat (console, sentry), a
|
|
15
|
+
* newest-first walk that keeps as many items as fit a snapshot budget.
|
|
16
|
+
*
|
|
17
|
+
* Marker KEY NAMES are part of the wire protocol — Buoy Desktop and the
|
|
18
|
+
* tool stores test for `__buoyStateOnDevice`, `__buoyPayloadOnDevice`,
|
|
19
|
+
* `__buoyValueOnDevice` — so the factory builds exactly those keys.
|
|
20
|
+
*/
|
|
21
|
+
/** Per-item budget on the snapshot stream. Anything larger stays on-device. */
|
|
22
|
+
export declare const WIRE_INLINE_LIMIT_BYTES: number;
|
|
23
|
+
/**
|
|
24
|
+
* Upper bound for one on-demand detail response. Generous — this is a single
|
|
25
|
+
* explicit fetch, not a per-item stream — but still guarded so a pathological
|
|
26
|
+
* tree can't OOM the device through the reply emit.
|
|
27
|
+
*/
|
|
28
|
+
export declare const WIRE_DETAIL_LIMIT_BYTES: number;
|
|
29
|
+
/** A frozen `{ __buoy<Kind>OnDevice: true, note }` marker. */
|
|
30
|
+
export type OnDeviceMarker<K extends string> = Readonly<{
|
|
31
|
+
[P in `__buoy${K}OnDevice`]: true;
|
|
32
|
+
} & {
|
|
33
|
+
note: string;
|
|
34
|
+
}>;
|
|
35
|
+
/**
|
|
36
|
+
* Build the sentinel a wire-form snapshot carries in place of a value that
|
|
37
|
+
* stays on the device. `kind` names the value ("State", "Payload", "Value",
|
|
38
|
+
* "Params", "Data", …) and becomes the key the reader tests for.
|
|
39
|
+
*/
|
|
40
|
+
export declare function onDeviceMarker<K extends string>(kind: K, note: string): OnDeviceMarker<K>;
|
|
41
|
+
/** True when `value` is the on-device marker for `kind`. */
|
|
42
|
+
export declare function isOnDeviceMarker(value: unknown, kind: string): boolean;
|
|
43
|
+
/** The note a detail fetch returns when a single field exceeds the detail cap. */
|
|
44
|
+
export declare function truncatedNote(limitBytes?: number): {
|
|
45
|
+
__buoyTruncated: true;
|
|
46
|
+
note: string;
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* The value itself if it fits `limit` (and is serializable), else `marker`.
|
|
50
|
+
* `undefined` passes through untouched: an absent field must stay absent.
|
|
51
|
+
*/
|
|
52
|
+
export declare function toWire<T>(value: unknown, marker: T, limit?: number): unknown;
|
|
53
|
+
/** Detail-fetch cap: the value, or a truncation note when it is too big. */
|
|
54
|
+
export declare function capDetail(value: unknown, limit?: number): unknown;
|
|
55
|
+
/**
|
|
56
|
+
* Memoize a wire-form conversion by item identity. Correct for any store
|
|
57
|
+
* that prepends and never mutates a recorded item — the cache self-invalidates
|
|
58
|
+
* when the item is dropped from the buffer.
|
|
59
|
+
*/
|
|
60
|
+
export declare function memoByIdentity<T extends object, R>(convert: (item: T) => R): (item: T) => R;
|
|
61
|
+
export interface WireSized<T> {
|
|
62
|
+
value: T;
|
|
63
|
+
bytes: number;
|
|
64
|
+
}
|
|
65
|
+
export interface NewestFittingOptions<T, W> {
|
|
66
|
+
/** Convert one item to its wire form and its byte cost. Memoize with `memoByIdentity`. */
|
|
67
|
+
toWire: (item: T) => WireSized<W>;
|
|
68
|
+
/** Snapshot byte budget. */
|
|
69
|
+
budget: number;
|
|
70
|
+
/** Bytes the envelope around the list costs (`{"entries":[]}` ≈ 16). */
|
|
71
|
+
baseBytes?: number;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Walk `items` (oldest-first) from the newest end, keeping every item until
|
|
75
|
+
* the budget is spent. Always keeps at least one so an over-budget newest
|
|
76
|
+
* item still reaches the dashboard as a stub rather than an empty panel.
|
|
77
|
+
* Returns oldest-first, matching the input.
|
|
78
|
+
*/
|
|
79
|
+
export declare function newestFitting<T, W>(items: T[], options: NewestFittingOptions<T, W>): W[];
|
|
80
|
+
/**
|
|
81
|
+
* Size one wire-form item against a per-item cap, substituting a stub when it
|
|
82
|
+
* is too fat. One walk decides both "too big?" and "what does it cost".
|
|
83
|
+
*/
|
|
84
|
+
export declare function sizeOrStub<W>(wired: W, limit: number, stub: () => W): WireSized<W>;
|
|
85
|
+
/** `(params as T | undefined) ?? {}` — the first line of every action. */
|
|
86
|
+
export declare function readParams<T extends object>(params: unknown): Partial<T>;
|
|
87
|
+
export type DetailResult<R extends object> = {
|
|
88
|
+
found: false;
|
|
89
|
+
reason: "missing id" | "unknown id";
|
|
90
|
+
} | ({
|
|
91
|
+
found: true;
|
|
92
|
+
id: string;
|
|
93
|
+
} & R);
|
|
94
|
+
/**
|
|
95
|
+
* The on-demand detail action every change-log tool exposes: look one item
|
|
96
|
+
* up by id, and return its detail fields size-capped. Replaces the
|
|
97
|
+
* `missing id` / `unknown id` boilerplate copied into each adapter.
|
|
98
|
+
*/
|
|
99
|
+
export declare function detailByIdAction<T, R extends object>(lookup: (id: string) => T | undefined, detail: (item: T, cap: (value: unknown) => unknown) => R, limit?: number): (params?: unknown) => DetailResult<R>;
|
|
100
|
+
//# sourceMappingURL=wireForm.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wireForm.d.ts","sourceRoot":"","sources":["../../../../src/sync/wireForm.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAIH,+EAA+E;AAC/E,eAAO,MAAM,uBAAuB,QAAY,CAAC;AAEjD;;;;GAIG;AACH,eAAO,MAAM,uBAAuB,QAAkB,CAAC;AAEvD,8DAA8D;AAC9D,MAAM,MAAM,cAAc,CAAC,CAAC,SAAS,MAAM,IAAI,QAAQ,CACrD;KAAG,CAAC,IAAI,SAAS,CAAC,UAAU,GA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H,wBAAgB,aAAa,CAAC,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,OAAO,EAAE,oBAAoB,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,EAAE,CAWxF;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,CAKlF;AAED,0EAA0E;AAC1E,wBAAgB,UAAU,CAAC,CAAC,SAAS,MAAM,EAAE,MAAM,EAAE,OAAO,GAAG,OAAO,CAAC,CAAC,CAAC,CAExE;AAED,MAAM,MAAM,YAAY,CAAC,CAAC,SAAS,MAAM,IACrC;IAAE,KAAK,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,YAAY,GAAG,YAAY,CAAA;CAAE,GACrD,CAAC;IAAE,KAAK,EAAE,IAAI,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,GAAG,CAAC,CAAC,CAAC;AAEtC;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,EAClD,MAAM,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,CAAC,GAAG,SAAS,EACrC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,OAAO,KAAK,CAAC,EACxD,KAAK,GAAE,MAAgC,GACtC,CAAC,MAAM,CAAC,EAAE,OAAO,KAAK,YAAY,CAAC,CAAC,CAAC,CASvC"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* defineToolPreset / createToolFactory — the typed way to declare a tool.
|
|
3
|
+
*
|
|
4
|
+
* Every tool package exports a `xToolPreset` object literal and a
|
|
5
|
+
* `createXTool(options)` factory that restates the same literal with
|
|
6
|
+
* `options?.name || default` on each field. None of the 23 presets was
|
|
7
|
+
* annotated with core's `InstalledApp`, so a preset that drifted from the
|
|
8
|
+
* contract (a bad `slot`, a missing `component`) failed at runtime in the
|
|
9
|
+
* dial, not at compile time.
|
|
10
|
+
*
|
|
11
|
+
* `ToolPreset` is that contract, declared here in shared (which every tool
|
|
12
|
+
* already depends on) and structurally identical to core's `InstalledApp`.
|
|
13
|
+
* `defineToolPreset` is an identity function that type-checks the literal;
|
|
14
|
+
* `createToolFactory` derives the `createXTool` function from the preset so
|
|
15
|
+
* the defaults live in exactly one place.
|
|
16
|
+
*
|
|
17
|
+
* Auto-discovery (core's `autoDiscoverPresets` / `autoExternalSync`) stays
|
|
18
|
+
* as hand-written `require()` blocks on purpose: Metro needs each package
|
|
19
|
+
* name as a static string lexically inside its own try, so a manifest can't
|
|
20
|
+
* replace them.
|
|
21
|
+
*/
|
|
22
|
+
import type { ComponentType, ReactNode } from "react";
|
|
23
|
+
import type { ToolSyncAdapter } from "../sync/toolSyncAdapter";
|
|
24
|
+
/** Where a tool should render within the floating menu surface. */
|
|
25
|
+
export type ToolSlot = "row" | "dial" | "both";
|
|
26
|
+
/** What an icon renderer receives. Mirrors core's `FloatingMenuRenderCtx`. */
|
|
27
|
+
export interface ToolIconContext {
|
|
28
|
+
slot: ToolSlot;
|
|
29
|
+
size: number;
|
|
30
|
+
color?: string;
|
|
31
|
+
state?: Record<string, unknown>;
|
|
32
|
+
actions?: Record<string, (...args: any[]) => void>;
|
|
33
|
+
}
|
|
34
|
+
/** Declarative modal chrome for a body-only tool. Mirrors core's `ToolModalConfig`. */
|
|
35
|
+
export interface ToolModalChrome {
|
|
36
|
+
title?: string;
|
|
37
|
+
subtitle?: string;
|
|
38
|
+
searchable?: boolean;
|
|
39
|
+
searchPlaceholder?: string;
|
|
40
|
+
headerActions?: ReactNode;
|
|
41
|
+
initialMode?: "bottomSheet" | "floating";
|
|
42
|
+
}
|
|
43
|
+
export type ToolLaunchMode = "self-modal" | "host-modal" | "inline" | "toggle-only";
|
|
44
|
+
/**
|
|
45
|
+
* The shape the floating menu installs. Structurally identical to core's
|
|
46
|
+
* `InstalledApp`; declared here so tool packages can type their presets
|
|
47
|
+
* without depending on core.
|
|
48
|
+
*/
|
|
49
|
+
export interface ToolPreset<P extends Record<string, unknown> | undefined = Record<string, unknown> | undefined> {
|
|
50
|
+
/** Unique identifier used for persistence and settings. */
|
|
51
|
+
id: string;
|
|
52
|
+
/** Human readable name shown in accessibility labels and modal headers. */
|
|
53
|
+
name: string;
|
|
54
|
+
/** Brief description of what this tool does, shown in settings. */
|
|
55
|
+
description?: string;
|
|
56
|
+
/** A text icon, a node, or a renderer that adapts to slot and size. */
|
|
57
|
+
icon: ReactNode | ((ctx: ToolIconContext) => ReactNode);
|
|
58
|
+
/** Preferred layout slot; defaults to `"both"`. */
|
|
59
|
+
slot?: ToolSlot;
|
|
60
|
+
/** Optional accent color for the tool. */
|
|
61
|
+
color?: string;
|
|
62
|
+
/** The launched component. */
|
|
63
|
+
component: ComponentType<any>;
|
|
64
|
+
/** When set, `component` is a body rendered inside the shared modal shell. */
|
|
65
|
+
modal?: ToolModalChrome;
|
|
66
|
+
/** Sync adapter: the tool syncs to Buoy Desktop and is drivable over MCP. */
|
|
67
|
+
sync?: ToolSyncAdapter;
|
|
68
|
+
/** Props passed to the launched component. */
|
|
69
|
+
props?: P;
|
|
70
|
+
launchMode?: ToolLaunchMode;
|
|
71
|
+
/** Prevent more than one instance of this app at a time. */
|
|
72
|
+
singleton?: boolean;
|
|
73
|
+
onPress?: (actions?: Record<string, (...args: any[]) => void>) => void;
|
|
74
|
+
}
|
|
75
|
+
/** Identity with a type check: the literal must satisfy `ToolPreset`. */
|
|
76
|
+
export declare function defineToolPreset<T extends ToolPreset<Record<string, unknown> | undefined>>(preset: T): T;
|
|
77
|
+
/** The overrides every `createXTool` accepted. */
|
|
78
|
+
export interface ToolPresetOverrides {
|
|
79
|
+
/** Custom tool ID. */
|
|
80
|
+
id?: string;
|
|
81
|
+
/** Tool name shown in the menu. */
|
|
82
|
+
name?: string;
|
|
83
|
+
/** Tool description. */
|
|
84
|
+
description?: string;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Derive `createXTool(options)` from a preset: id/name/description overrides
|
|
88
|
+
* apply on top, and `mapProps` turns tool-specific options into `props`
|
|
89
|
+
* (merged over the preset's defaults).
|
|
90
|
+
*
|
|
91
|
+
* ```ts
|
|
92
|
+
* export const createNetworkTool = createToolFactory(networkToolPreset, (o: { enableSharedModalDimensions?: boolean }) => ({
|
|
93
|
+
* enableSharedModalDimensions: o.enableSharedModalDimensions ?? false,
|
|
94
|
+
* }));
|
|
95
|
+
* ```
|
|
96
|
+
*/
|
|
97
|
+
export declare function createToolFactory<T extends ToolPreset<Record<string, unknown> | undefined>, O extends object = Record<never, never>>(preset: T, mapProps?: (options: O) => Partial<NonNullable<T["props"]>>,
|
|
98
|
+
/** Last word on any other preset field (a recolored icon, say). */
|
|
99
|
+
extend?: (options: O, preset: T) => Partial<T>): (options?: O & ToolPresetOverrides) => T;
|
|
100
|
+
//# sourceMappingURL=defineTool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defineTool.d.ts","sourceRoot":"","sources":["../../../../src/tools/defineTool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACtD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE/D,mEAAmE;AACnE,MAAM,MAAM,QAAQ,GAAG,KAAK,GAAG,MAAM,GAAG,MAAM,CAAC;AAE/C,8EAA8E;AAC9E,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,QAAQ,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;I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5B,4DAA4D;IAC5D,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,CAAC,KAAK,IAAI,CAAC;CACxE;AAED,yEAAyE;AACzE,wBAAgB,gBAAgB,CAAC,CAAC,SAAS,UAAU,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC,GAAG,CAAC,CAExG;AAED,kDAAkD;AAClD,MAAM,WAAW,mBAAmB;IAClC,sBAAsB;IACtB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,mCAAmC;IACnC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,wBAAwB;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,CAC/B,CAAC,SAAS,UAAU,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAC,EAIzD,CAAC,SAAS,MAAM,GAAG,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,EAEvC,MAAM,EAAE,CAAC,EACT,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,KAAK,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;AAC3D,mEAAmE;AACnE,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,GAC7C,CAAC,OAAO,CAAC,EAAE,CAAC,GAAG,mBAAmB,KAAK,CAAC,CAgB1C"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ChangeRow — one recorded change in a state tool's history list.
|
|
3
|
+
*
|
|
4
|
+
* redux, zustand and jotai each drew the same row on top of `CompactRow`:
|
|
5
|
+
* a colored status word (the slice / store / atom), a sublabel ("1.2ms ·
|
|
6
|
+
* 3 keys changed"), the primary line (changed keys or a value preview), a
|
|
7
|
+
* relative timestamp, and a right-hand badge made of a mono verb (SET,
|
|
8
|
+
* WRITE, ADDITEM) plus an icon — a lightning bolt when state actually
|
|
9
|
+
* changed, a clock when the update was slow. The three copies differed
|
|
10
|
+
* only in how they computed those strings. This component owns the drawing;
|
|
11
|
+
* tools own the strings.
|
|
12
|
+
*
|
|
13
|
+
* testID convention (unchanged from the originals): `${testID}-badge`,
|
|
14
|
+
* `${testID}-change`, `${testID}-slow`, `${testID}-status`,
|
|
15
|
+
* `${testID}-sublabel`, `${testID}-keys`.
|
|
16
|
+
*/
|
|
17
|
+
import React, { type ReactNode } from "react";
|
|
18
|
+
export interface ChangeRowProps {
|
|
19
|
+
/** Status dot + status word color (a category color or the entity's color). */
|
|
20
|
+
statusColor: string;
|
|
21
|
+
/** The status word: "Cart", "Replace", "Pending", … */
|
|
22
|
+
statusLabel: string;
|
|
23
|
+
/** Line under the status word: duration and diff summary. */
|
|
24
|
+
sublabel?: string;
|
|
25
|
+
/** The row's main line: changed keys, a preview, an action type. */
|
|
26
|
+
primaryText: string;
|
|
27
|
+
/** Capture time; rendered as a self-ticking relative time. */
|
|
28
|
+
timestamp: number;
|
|
29
|
+
/** Mono verb drawn in `statusColor` on the right: "SET", "WRITE", "ADDITEM". */
|
|
30
|
+
badgeText?: string;
|
|
31
|
+
/** Draws the ⚡ indicator (state actually changed). */
|
|
32
|
+
changed?: boolean;
|
|
33
|
+
/** Draws the 🕒 indicator instead of ⚡ (update exceeded the frame budget). */
|
|
34
|
+
slow?: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Tool-specific badge content drawn BEFORE the verb (redux's async
|
|
37
|
+
* "1/2 #3" sequence chip). When set together with `badgeText`, both render.
|
|
38
|
+
*/
|
|
39
|
+
badgePrefix?: ReactNode;
|
|
40
|
+
/** Replace the whole badge. Wins over badgeText / changed / slow. */
|
|
41
|
+
customBadge?: ReactNode;
|
|
42
|
+
/**
|
|
43
|
+
* Let CompactRow draw its own plain badge with this text when there is
|
|
44
|
+
* nothing else to show (no verb, no indicator, no custom badge).
|
|
45
|
+
*/
|
|
46
|
+
plainBadgeText?: string;
|
|
47
|
+
onPress?: () => void;
|
|
48
|
+
testID?: string;
|
|
49
|
+
accessibilityLabel?: string;
|
|
50
|
+
}
|
|
51
|
+
export declare function ChangeRow({ statusColor, statusLabel, sublabel, primaryText, timestamp, badgeText, changed, slow, badgePrefix, customBadge, plainBadgeText, onPress, testID, accessibilityLabel, }: ChangeRowProps): React.JSX.Element;
|
|
52
|
+
//# sourceMappingURL=ChangeRow.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChangeRow.d.ts","sourceRoot":"","sources":["../../../../../src/ui/components/ChangeRow.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAO9C,MAAM,WAAW,cAAc;IAC7B,+EAA+E;IAC/E,WAAW,EAAE,MAAM,CAAC;IACpB,uDAAuD;IACvD,WAAW,EAAE,MAAM,CAAC;IACpB,6DAA6D;IAC7D,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,oEAAoE;IACpE,WAAW,EAAE,MAAM,CAAC;IACpB,8DAA8D;IAC9D,SAAS,EAAE,MAAM,CAAC;IAClB,gFAAgF;IAChF,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,sDAAsD;IACtD,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,8EAA8E;IAC9E,IAAI,CAAC,EAAE,OAAO,CAAC;IACf;;;OAGG;IACH,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,qEAAqE;IACrE,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED,wBAAgB,SAAS,CAAC,EACxB,WAAW,EACX,WAAW,EACX,QAAQ,EACR,WAAW,EACX,SAAS,EACT,SAAS,EACT,OAAe,EACf,IAAY,EACZ,WAAW,EACX,WAAW,EACX,cAAc,EACd,OAAO,EACP,MAAM,EACN,kBAAkB,GACnB,EAAE,cAAc,qBAiDhB"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ChipStrip — a horizontally scrolling row of filter chips whose taps
|
|
3
|
+
* don't misfire while the strip is being panned.
|
|
4
|
+
*
|
|
5
|
+
* react-query drew this three times (query status, mutation status, storage
|
|
6
|
+
* type) with the same 5-point / 300 ms swipe-vs-tap discrimination. The
|
|
7
|
+
* strip and the discrimination live here; the chip is whatever the tool
|
|
8
|
+
* renders, wired through `useChipTap`.
|
|
9
|
+
*/
|
|
10
|
+
import { type ReactNode } from "react";
|
|
11
|
+
import { type GestureResponderEvent, type StyleProp, type ViewStyle } from "react-native";
|
|
12
|
+
export interface ChipTap {
|
|
13
|
+
/** Spread onto the ScrollView (or pass `scrollProps` to `ChipStrip`). */
|
|
14
|
+
scrollProps: {
|
|
15
|
+
onScrollBeginDrag: () => void;
|
|
16
|
+
onScrollEndDrag: () => void;
|
|
17
|
+
onMomentumScrollBegin: () => void;
|
|
18
|
+
onMomentumScrollEnd: () => void;
|
|
19
|
+
};
|
|
20
|
+
/** Give each chip this as `onTouchStart`. */
|
|
21
|
+
onTouchStart: (event: GestureResponderEvent) => void;
|
|
22
|
+
/** In a chip's `onPress`: run the action only when this returns true. */
|
|
23
|
+
isTap: (event?: GestureResponderEvent) => boolean;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Swipe-vs-tap discrimination for chips inside a horizontal ScrollView.
|
|
27
|
+
* A press that moved more than a few points, or landed while the strip was
|
|
28
|
+
* still scrolling, is a pan — not a filter toggle.
|
|
29
|
+
*/
|
|
30
|
+
export declare function useChipTap(): ChipTap;
|
|
31
|
+
export interface ChipStripProps {
|
|
32
|
+
children: ReactNode;
|
|
33
|
+
/** From `useChipTap()`. */
|
|
34
|
+
scrollProps: ChipTap["scrollProps"];
|
|
35
|
+
/** Sentry label for the scroll view. */
|
|
36
|
+
sentryLabel?: string;
|
|
37
|
+
style?: StyleProp<ViewStyle>;
|
|
38
|
+
contentStyle?: StyleProp<ViewStyle>;
|
|
39
|
+
}
|
|
40
|
+
export declare function ChipStrip({ children, scrollProps, sentryLabel, style, contentStyle }: ChipStripProps): import("react").JSX.Element;
|
|
41
|
+
//# sourceMappingURL=ChipStrip.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChipStrip.d.ts","sourceRoot":"","sources":["../../../../../src/ui/components/ChipStrip.tsx"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAiC,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AACtE,OAAO,EAIL,KAAK,qBAAqB,EAC1B,KAAK,SAAS,EACd,KAAK,SAAS,EACf,MAAM,cAAc,CAAC;AAOtB,MAAM,WAAW,OAAO;IACtB,yEAAyE;IACzE,WAAW,EAAE;QACX,iBAAiB,EAAE,MAAM,IAAI,CAAC;QAC9B,eAAe,EAAE,MAAM,IAAI,CAAC;QAC5B,qBAAqB,EAAE,MAAM,IAAI,CAAC;QAClC,mBAAmB,EAAE,MAAM,IAAI,CAAC;KACjC,CAAC;IACF,6CAA6C;IAC7C,YAAY,EAAE,CAAC,KAAK,EAAE,qBAAqB,KAAK,IAAI,CAAC;IACrD,yEAAyE;IACzE,KAAK,EAAE,CAAC,KAAK,CAAC,EAAE,qBAAqB,KAAK,OAAO,CAAC;CACnD;AAED;;;;GAIG;AACH,wBAAgB,UAAU,IAAI,OAAO,CAmCpC;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,SAAS,CAAC;IACpB,2BAA2B;IAC3B,WAAW,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC;IACpC,wCAAwC;IACxC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B,YAAY,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CACrC;AAED,wBAAgB,SAAS,CAAC,EAAE,QAAQ,EAAE,WAAW,EAAE,WAAW,EAAE,KAAK,EAAE,YAAY,EAAE,EAAE,cAAc,+BAepG"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DetailViewToggle — the row of view cards at the top of a detail screen
|
|
3
|
+
* (ACTION · STATE · DIFF, CHANGE · STATE · DIFF, …).
|
|
4
|
+
*
|
|
5
|
+
* redux, zustand and jotai each shipped their own copy, differing only in
|
|
6
|
+
* the view keys, labels and testID prefix. The cards, the accent chrome,
|
|
7
|
+
* the disabled state (diff with nothing to compare) and the a11y contract
|
|
8
|
+
* are all one component now; tools pass their `views`.
|
|
9
|
+
*/
|
|
10
|
+
import React, { type ComponentType } from "react";
|
|
11
|
+
export interface DetailViewOption<K extends string = string> {
|
|
12
|
+
key: K;
|
|
13
|
+
/** Uppercase short label, e.g. "ACTION". */
|
|
14
|
+
label: string;
|
|
15
|
+
/** One-line hint under the label. Omit for the compact (label-only) card. */
|
|
16
|
+
description?: string;
|
|
17
|
+
icon: ComponentType<{
|
|
18
|
+
size: number;
|
|
19
|
+
color: string;
|
|
20
|
+
}>;
|
|
21
|
+
/** Card accent when active. Default: the night accent. */
|
|
22
|
+
activeColor?: string;
|
|
23
|
+
}
|
|
24
|
+
export interface DetailViewToggleProps<K extends string = string> {
|
|
25
|
+
views: readonly DetailViewOption<K>[];
|
|
26
|
+
activeView: K;
|
|
27
|
+
onViewChange: (view: K) => void;
|
|
28
|
+
/** Keys that cannot be selected right now (e.g. "diff" with no previous state). */
|
|
29
|
+
disabledKeys?: readonly K[];
|
|
30
|
+
/** `${testIDPrefix}-view-${key}` on each card. */
|
|
31
|
+
testIDPrefix?: string;
|
|
32
|
+
}
|
|
33
|
+
declare function DetailViewToggleImpl<K extends string>({ views, activeView, onViewChange, disabledKeys, testIDPrefix, }: DetailViewToggleProps<K>): React.JSX.Element;
|
|
34
|
+
export declare const DetailViewToggle: typeof DetailViewToggleImpl;
|
|
35
|
+
export {};
|
|
36
|
+
//# sourceMappingURL=DetailViewToggle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DetailViewToggle.d.ts","sourceRoot":"","sources":["../../../../../src/ui/components/DetailViewToggle.tsx"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,EAAQ,KAAK,aAAa,EAAE,MAAM,OAAO,CAAC;AAIxD,MAAM,WAAW,gBAAgB,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM;IACzD,GAAG,EAAE,CAAC,CAAC;IACP,4CAA4C;IAC5C,KAAK,EAAE,MAAM,CAAC;IACd,6EAA6E;IAC7E,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,aAAa,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACrD,0DAA0D;IAC1D,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,qBAAqB,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM;IAC9D,KAAK,EAAE,SAAS,gBAAgB,CAAC,CAAC,CAAC,EAAE,CAAC;IACtC,UAAU,EAAE,CAAC,CAAC;IACd,YAAY,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,IAAI,CAAC;IAChC,mFAAmF;IACnF,YAAY,CAAC,EAAE,SAAS,CAAC,EAAE,CAAC;IAC5B,kDAAkD;IAClD,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,iBAAS,oBAAoB,CAAC,CAAC,SAAS,MAAM,EAAE,EAC9C,KAAK,EACL,UAAU,EACV,YAAY,EACZ,YAAY,EACZ,YAAY,GACb,EAAE,qBAAqB,CAAC,CAAC,CAAC,qBA8D1B;AAED,eAAO,MAAM,gBAAgB,EAAiC,OAAO,oBAAoB,CAAC"}
|
|
@@ -51,6 +51,13 @@ export interface DevToolsCardProps {
|
|
|
51
51
|
testID?: string;
|
|
52
52
|
/** Accessibility label for agents / VoiceOver */
|
|
53
53
|
accessibilityLabel?: string;
|
|
54
|
+
/**
|
|
55
|
+
* Collapse the card into ONE accessibility element, so its label is what a
|
|
56
|
+
* reader (or an agent, or a test) gets instead of the children's text. Only
|
|
57
|
+
* meaningful on a non-interactive card — an interactive one is already an
|
|
58
|
+
* element in its own right.
|
|
59
|
+
*/
|
|
60
|
+
accessible?: boolean;
|
|
54
61
|
}
|
|
55
|
-
export declare function DevToolsCard({ children, onPress, onLongPress, isSelected, disabled, activeOpacity, style, contentStyle, testID, accessibilityLabel, }: DevToolsCardProps): import("react").JSX.Element;
|
|
62
|
+
export declare function DevToolsCard({ children, onPress, onLongPress, isSelected, disabled, activeOpacity, style, contentStyle, testID, accessibilityLabel, accessible, }: DevToolsCardProps): import("react").JSX.Element;
|
|
56
63
|
//# sourceMappingURL=DevToolsCard.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DevToolsCard.d.ts","sourceRoot":"","sources":["../../../../../src/ui/components/DevToolsCard.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,EAIL,SAAS,EACT,SAAS,EACV,MAAM,cAAc,CAAC;AAGtB;;GAEG;AACH,eAAO,MAAM,uBAAuB;IAClC,yCAAyC;;IAEzC,qDAAqD;;IAErD,oCAAoC;;IAEpC,yBAAyB;;IAEzB,yDAAyD;;IAEzD,mBAAmB;;CAEX,CAAC;AAEX,MAAM,WAA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AO,CAAC;IACnB,2CAA2C;IAC3C,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,0CAA0C;IAC1C,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B,sDAAsD;IACtD,YAAY,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IACpC,0BAA0B;IAC1B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,iDAAiD;IACjD,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B;;;;;OAKG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,wBAAgB,YAAY,CAAC,EAC3B,QAAQ,EACR,OAAO,EACP,WAAW,EACX,UAAkB,EAClB,QAAgB,EAChB,aAAmB,EACnB,KAAK,EACL,YAAY,EACZ,MAAM,EACN,kBAAkB,EAClB,UAAU,GACX,EAAE,iBAAiB,+BAmCnB"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* EntityFilterView — the "hide these by name" filter screen the state tools
|
|
3
|
+
* share: a list of registered entities (stores, atoms) you can tap to hide,
|
|
4
|
+
* the active name patterns with a remove ✕, an add-pattern affordance, and
|
|
5
|
+
* a how-it-works card.
|
|
6
|
+
*
|
|
7
|
+
* zustand and jotai each shipped their own copy (~370 lines apiece). The
|
|
8
|
+
* tool supplies the entities, the nouns and the testID prefix; the screen
|
|
9
|
+
* is drawn once.
|
|
10
|
+
*
|
|
11
|
+
* testID convention (unchanged from zustand's):
|
|
12
|
+
* `${prefix}-filters-scroll`, `${prefix}-filters-${entityKey}-count`,
|
|
13
|
+
* `${prefix}-filters-${entityKey}-${slug(name)}`, `${prefix}-filters-count`,
|
|
14
|
+
* `${prefix}-filters-add-open`, `${prefix}-filters-add-input`,
|
|
15
|
+
* `${prefix}-filters-chip-${slug(pattern)}`.
|
|
16
|
+
*/
|
|
17
|
+
export interface FilterableEntity {
|
|
18
|
+
/** The name a pattern is matched against and the label shown. */
|
|
19
|
+
name: string;
|
|
20
|
+
/** The entity's color (dot + label). */
|
|
21
|
+
color: string;
|
|
22
|
+
}
|
|
23
|
+
export interface EntityFilterViewProps {
|
|
24
|
+
/** Registered entities; tap one to hide it. */
|
|
25
|
+
entities: FilterableEntity[];
|
|
26
|
+
/** Active hide patterns. */
|
|
27
|
+
ignoredPatterns: Set<string>;
|
|
28
|
+
/** Tapping an active pattern removes it. */
|
|
29
|
+
onTogglePattern: (pattern: string) => void;
|
|
30
|
+
onAddPattern: (pattern: string) => void;
|
|
31
|
+
/** Plural noun in caps for the headers: "STORES", "ATOMS". */
|
|
32
|
+
entityNoun: string;
|
|
33
|
+
/** Singular noun for copy: "store", "atom". */
|
|
34
|
+
entitySingular: string;
|
|
35
|
+
/** Segment used in the per-entity testIDs: "store", "atom". */
|
|
36
|
+
entityKey: string;
|
|
37
|
+
/** testID prefix, e.g. "buoy-zustand". */
|
|
38
|
+
testIDPrefix: string;
|
|
39
|
+
/** Slug an entity name / pattern for a testID. */
|
|
40
|
+
slug: (value: string) => string;
|
|
41
|
+
/** The how-it-works paragraph. */
|
|
42
|
+
howItWorks: string;
|
|
43
|
+
/** Example bullet lines (rendered as given). */
|
|
44
|
+
examples: string[];
|
|
45
|
+
/** Optional override for the add-pattern placeholder. */
|
|
46
|
+
addPlaceholder?: string;
|
|
47
|
+
/** Shown (with `${prefix}-filters-${entityKey}s-empty`) when there are no entities. */
|
|
48
|
+
emptyMessage?: string;
|
|
49
|
+
}
|
|
50
|
+
export declare function EntityFilterView({ entities, ignoredPatterns, onTogglePattern, onAddPattern, entityNoun, entitySingular, entityKey, testIDPrefix, slug, howItWorks, examples, addPlaceholder, emptyMessage, }: EntityFilterViewProps): import("react").JSX.Element;
|
|
51
|
+
//# sourceMappingURL=EntityFilterView.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EntityFilterView.d.ts","sourceRoot":"","sources":["../../../../../src/ui/components/EntityFilterView.tsx"],"names":[],"mappings":"AAAA;;;;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
* Collapsed, it is a card: an eye icon, "Show Preview", a one-line summary
|
|
6
|
+
* ("14 events · ~12.3 KB (mock data)"), a chevron — and, when the estimated
|
|
7
|
+
* payload is big, an amber or red size warning under it. Expanded, it is a
|
|
8
|
+
* "Hide Preview" bar over whatever the tool renders (a DataViewer for JSON,
|
|
9
|
+
* a mono text block otherwise).
|
|
10
|
+
*
|
|
11
|
+
* network, events and highlight-updates each drew this (~120 lines apiece).
|
|
12
|
+
* Tools keep their own summary string, warning copy and body; the chrome
|
|
13
|
+
* and the size-threshold ladder live here.
|
|
14
|
+
*/
|
|
15
|
+
import type { ReactNode } from "react";
|
|
16
|
+
export type SizeWarningLevel = "none" | "warning" | "danger";
|
|
17
|
+
/** The two-step ladder every copy view used (thresholds differ per tool). */
|
|
18
|
+
export declare function sizeWarningLevel(bytes: number, thresholds: {
|
|
19
|
+
warning: number;
|
|
20
|
+
danger: number;
|
|
21
|
+
}): SizeWarningLevel;
|
|
22
|
+
export interface ExportPreviewTestIDs {
|
|
23
|
+
expand?: string;
|
|
24
|
+
collapse?: string;
|
|
25
|
+
summary?: string;
|
|
26
|
+
warning?: string;
|
|
27
|
+
}
|
|
28
|
+
export interface ExportPreviewProps {
|
|
29
|
+
expanded: boolean;
|
|
30
|
+
onExpandedChange: (next: boolean) => void;
|
|
31
|
+
/** One line under "Show Preview": counts, size, "(mock data)". */
|
|
32
|
+
summary: string;
|
|
33
|
+
warningLevel?: SizeWarningLevel;
|
|
34
|
+
/** Copy for the warning band. Defaults name "payload". */
|
|
35
|
+
warningText?: {
|
|
36
|
+
warning: string;
|
|
37
|
+
danger: string;
|
|
38
|
+
};
|
|
39
|
+
testIDs?: ExportPreviewTestIDs;
|
|
40
|
+
/**
|
|
41
|
+
* Builds the expanded body. A function, not children, so the export text
|
|
42
|
+
* is only generated once the user asks for it — building it eagerly for
|
|
43
|
+
* a large capture is what used to crash these screens.
|
|
44
|
+
*/
|
|
45
|
+
renderBody: () => ReactNode;
|
|
46
|
+
}
|
|
47
|
+
export declare function ExportPreview({ expanded, onExpandedChange, summary, warningLevel, warningText, testIDs, renderBody, }: ExportPreviewProps): import("react").JSX.Element;
|
|
48
|
+
//# sourceMappingURL=ExportPreview.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExportPreview.d.ts","sourceRoot":"","sources":["../../../../../src/ui/components/ExportPreview.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAKvC,MAAM,MAAM,gBAAgB,GAAG,MAAM,GAAG,SAAS,GAAG,QAAQ,CAAC;AAE7D,6EAA6E;AAC7E,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,MAAM,EACb,UAAU,EAAE;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAC9C,gBAAgB,CAIlB;AAED,MAAM,WAAW,oBAAoB;IACnC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,OAAO,CAAC;IAClB,gBAAgB,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IAC1C,kEAAkE;IAClE,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,gBAAgB,CAAC;IAChC,0DAA0D;IAC1D,WAAW,CAAC,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IAClD,OAAO,CAAC,EAAE,oBAAoB,CAAC;IAC/B;;;;OAIG;IACH,UAAU,EAAE,MAAM,SAAS,CAAC;CAC7B;AAOD,wBAAgB,aAAa,CAAC,EAC5B,QAAQ,EACR,gBAAgB,EAChB,OAAO,EACP,YAAqB,EACrB,WAA6B,EAC7B,OAAO,EACP,UAAU,GACX,EAAE,kBAAkB,+BA2DpB"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* InfoRow — the label / value line of every detail screen.
|
|
3
|
+
*
|
|
4
|
+
* Thirteen tools hand-rolled this (redux and zustand byte-for-byte). The
|
|
5
|
+
* night-theme recipe below is theirs: 11 px, tertiary label on the left,
|
|
6
|
+
* right-aligned value that truncates in the MIDDLE so both ends of an id or
|
|
7
|
+
* a path stay readable, optional monospace, optional color.
|
|
8
|
+
*
|
|
9
|
+
* `ellipsizeMode="middle"` truncates the RENDERED text and iOS reports the
|
|
10
|
+
* truncated string back, so anything a test reads off one of these rows has
|
|
11
|
+
* to be short enough to fit on the line.
|
|
12
|
+
*/
|
|
13
|
+
import type { ReactNode } from "react";
|
|
14
|
+
import { type StyleProp, type TextStyle, type ViewStyle } from "react-native";
|
|
15
|
+
export interface InfoRowProps {
|
|
16
|
+
label: string;
|
|
17
|
+
/** A string/number is rendered as text; a node is rendered as-is. */
|
|
18
|
+
value?: string | number | ReactNode;
|
|
19
|
+
/** Override the value color (a status, a warning). */
|
|
20
|
+
valueColor?: string;
|
|
21
|
+
/** Monospace value (ids, paths, JSON fragments). */
|
|
22
|
+
mono?: boolean;
|
|
23
|
+
/** Show a small copy button for a text value. */
|
|
24
|
+
copyable?: boolean;
|
|
25
|
+
/** Lines the value may take before truncating. Default 1. */
|
|
26
|
+
numberOfLines?: number;
|
|
27
|
+
testID?: string;
|
|
28
|
+
style?: StyleProp<ViewStyle>;
|
|
29
|
+
labelStyle?: StyleProp<TextStyle>;
|
|
30
|
+
valueStyle?: StyleProp<TextStyle>;
|
|
31
|
+
}
|
|
32
|
+
export declare function InfoRow({ label, value, valueColor, mono, copyable, numberOfLines, testID, style, labelStyle, valueStyle, }: InfoRowProps): import("react").JSX.Element;
|
|
33
|
+
//# sourceMappingURL=InfoRow.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InfoRow.d.ts","sourceRoot":"","sources":["../../../../../src/ui/components/InfoRow.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAA0B,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAItG,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,qEAAqE;IACrE,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;IACpC,sDAAsD;IACtD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,oDAAoD;IACpD,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,iDAAiD;IACjD,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,6DAA6D;IAC7D,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B,UAAU,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAClC,UAAU,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CACnC;AAED,wBAAgB,OAAO,CAAC,EACtB,KAAK,EACL,KAAK,EACL,UAAU,EACV,IAAY,EACZ,QAAgB,EAChB,aAAiB,EACjB,MAAM,EACN,KAAK,EACL,UAAU,EACV,UAAU,GACX,EAAE,YAAY,+BA6Bd"}
|