@buoy-gg/network 7.0.11 → 7.0.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/README.md +1 -0
  2. package/lib/commonjs/index.js +13 -0
  3. package/lib/commonjs/network/components/NetworkDetailStepper.js +28 -14
  4. package/lib/commonjs/network/components/NetworkEventDetailView.js +56 -11
  5. package/lib/commonjs/network/components/NetworkHeaderLive.js +6 -1
  6. package/lib/commonjs/network/components/NetworkListScreen.js +9 -4
  7. package/lib/commonjs/network/components/NetworkModal.js +121 -26
  8. package/lib/commonjs/network/components/NetworkSavedScreen.js +12 -15
  9. package/lib/commonjs/network/hooks/useNetworkSelection.js +53 -0
  10. package/lib/commonjs/network/utils/networkSelectionStore.js +193 -0
  11. package/lib/module/index.js +4 -0
  12. package/lib/module/network/components/NetworkDetailStepper.js +29 -15
  13. package/lib/module/network/components/NetworkEventDetailView.js +56 -11
  14. package/lib/module/network/components/NetworkHeaderLive.js +6 -1
  15. package/lib/module/network/components/NetworkListScreen.js +9 -4
  16. package/lib/module/network/components/NetworkModal.js +121 -26
  17. package/lib/module/network/components/NetworkSavedScreen.js +13 -16
  18. package/lib/module/network/hooks/useNetworkSelection.js +46 -0
  19. package/lib/module/network/utils/networkSelectionStore.js +188 -0
  20. package/lib/typescript/index.d.ts +1 -0
  21. package/lib/typescript/index.d.ts.map +1 -1
  22. package/lib/typescript/network/components/NetworkDetailStepper.d.ts +10 -5
  23. package/lib/typescript/network/components/NetworkDetailStepper.d.ts.map +1 -1
  24. package/lib/typescript/network/components/NetworkEventDetailView.d.ts +36 -1
  25. package/lib/typescript/network/components/NetworkEventDetailView.d.ts.map +1 -1
  26. package/lib/typescript/network/components/NetworkHeaderLive.d.ts +5 -2
  27. package/lib/typescript/network/components/NetworkHeaderLive.d.ts.map +1 -1
  28. package/lib/typescript/network/components/NetworkListScreen.d.ts.map +1 -1
  29. package/lib/typescript/network/components/NetworkModal.d.ts.map +1 -1
  30. package/lib/typescript/network/components/NetworkSavedScreen.d.ts +12 -1
  31. package/lib/typescript/network/components/NetworkSavedScreen.d.ts.map +1 -1
  32. package/lib/typescript/network/hooks/useNetworkSelection.d.ts +26 -0
  33. package/lib/typescript/network/hooks/useNetworkSelection.d.ts.map +1 -0
  34. package/lib/typescript/network/utils/networkSelectionStore.d.ts +117 -0
  35. package/lib/typescript/network/utils/networkSelectionStore.d.ts.map +1 -0
  36. package/package.json +2 -2
@@ -43,7 +43,6 @@ interface NetworkSavedButtonProps {
43
43
  */
44
44
  export declare function NetworkSavedButton({ onPress }: NetworkSavedButtonProps): import("react").JSX.Element;
45
45
  interface NetworkDetailPinActionsProps {
46
- eventId: string | null;
47
46
  isPro: boolean;
48
47
  onUpgradePress: () => void;
49
48
  }
@@ -60,8 +59,12 @@ interface NetworkDetailPinActionsProps {
60
59
  * The event object is resolved at PRESS time rather than held as a prop: the
61
60
  * live store has the fresh copy while the request is in flight, and the saved
62
61
  * store is the only copy once it has been cleared or aged out.
62
+ *
63
+ * The selected id is SUBSCRIBED here rather than passed down, so stepping
64
+ * through requests doesn't have to re-render the modal root just to rebuild
65
+ * the header around a new prop.
63
66
  */
64
- export declare function NetworkDetailPinActions({ eventId, isPro, onUpgradePress, }: NetworkDetailPinActionsProps): import("react").JSX.Element;
67
+ export declare function NetworkDetailPinActions({ isPro, onUpgradePress, }: NetworkDetailPinActionsProps): import("react").JSX.Element;
65
68
  interface NetworkHeaderCopyButtonProps {
66
69
  isPro: boolean;
67
70
  filter: NetworkFilter;
@@ -1 +1 @@
1
- {"version":3,"file":"NetworkHeaderLive.d.ts","sourceRoot":"","sources":["../../../../src/network/components/NetworkHeaderLive.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAGH,OAAO,EAUL,KAAK,cAAc,EACpB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,KAAK,E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,EACtC,KAAK,EACL,MAAM,EACN,eAAe,EACf,YAAY,EACZ,MAAM,EACN,cAAc,GACf,EAAE,4BAA4B,+BAiD9B"}
1
+ {"version":3,"file":"NetworkHeaderLive.d.ts","sourceRoot":"","sources":["../../../../src/network/components/NetworkHeaderLive.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAGH,OAAO,EAUL,KAAK,cAAc,EACpB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAsB9D,KAAK,YAAY,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,CAAC;AAEpD,UAAU,wBAAwB;IAChC,YAAY,EAAE,aAAa,CAAC,QAAQ,CAAC,CAAC;IACtC,cAAc,EAAE,CAAC,MAAM,EAAE,YAAY,KAAK,IAAI,CAAC;IAC/C,eAAe,EAAE,SAAS,cAAc,EAAE,CAAC;IAC3C,MAAM,EAAE,OAAO,CAAC;CACjB;AAED,yEAAyE;AACzE,wBAAgB,mBAAmB,CAAC,EAClC,YAAY,EACZ,cAAc,EACd,eAAe,EACf,MAAM,GACP,EAAE,wBAAwB,+BA4D1B;AAED,UAAU,uBAAuB;IAC/B,MAAM,EAAE,OAAO,CAAC;CACjB;AAED;;iDAEiD;AACjD,wBAAgB,kBAAkB,CAAC,EAAE,MAAM,EAAE,EAAE,uBAAuB,+BAqBrE;AAED,UAAU,uBAAuB;IAC/B,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,EAAE,OAAO,EAAE,EAAE,uBAAuB,+BAwBtE;AAED,UAAU,4BAA4B;IACpC,KAAK,EAAE,OAAO,CAAC;IACf,cAAc,EAAE,MAAM,IAAI,CAAC;CAC5B;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,uBAAuB,CAAC,EACtC,KAAK,EACL,cAAc,GACf,EAAE,4BAA4B,+BAuF9B;AAED,UAAU,4BAA4B;IACpC,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,aAAa,CAAC;IACtB,eAAe,EAAE,SAAS,cAAc,EAAE,CAAC;IAC3C,YAAY,EAAE,YAAY,CAAC;IAC3B,MAAM,EAAE,OAAO,CAAC;IAChB,cAAc,EAAE,MAAM,IAAI,CAAC;CAC5B;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,EACtC,KAAK,EACL,MAAM,EACN,eAAe,EACf,YAAY,EACZ,MAAM,EACN,cAAc,GACf,EAAE,4BAA4B,+BAiD9B"}
@@ -1 +1 @@
1
- {"version":3,"file":"NetworkListScreen.d.ts","sourceRoot":"","sources":["../../../../src/network/components/NetworkListScreen.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAIH,OAAO,EAKL,KAAK,cAAc,EACpB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AA4E5D,UAAU,sBAAsB;IAC9B,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,OAAO,CAAC;IAChB,MAAM,EAAE,aAAa,CAAC;IACtB,eAAe,EAAE,SAAS,cAAc,EAAE,CAAC;IAC3C,KAAK,EAAE,OAAO,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,wEAAwE;IACxE,YAAY,EAAE,CAAC,KAAK,EAAE,YAAY,KAAK,IAAI,CAAC;IAC5C,cAAc,EAAE,MAAM,IAAI,CAAC;CAC5B;AAED,wBAAgB,iBAAiB,CAAC,EAChC,OAAO,EACP,MAAM,EACN,MAAM,EACN,eAAe,EACf,KAAK,EACL,UAAU,EACV,YAAY,EACZ,cAAc,GACf,EAAE,sBAAsB,sCAkHxB"}
1
+ {"version":3,"file":"NetworkListScreen.d.ts","sourceRoot":"","sources":["../../../../src/network/components/NetworkListScreen.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAIH,OAAO,EAKL,KAAK,cAAc,EACpB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AA4E5D,UAAU,sBAAsB;IAC9B,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,OAAO,CAAC;IAChB,MAAM,EAAE,aAAa,CAAC;IACtB,eAAe,EAAE,SAAS,cAAc,EAAE,CAAC;IAC3C,KAAK,EAAE,OAAO,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,wEAAwE;IACxE,YAAY,EAAE,CAAC,KAAK,EAAE,YAAY,KAAK,IAAI,CAAC;IAC5C,cAAc,EAAE,MAAM,IAAI,CAAC;CAC5B;AAED,wBAAgB,iBAAiB,CAAC,EAChC,OAAO,EACP,MAAM,EACN,MAAM,EACN,eAAe,EACf,KAAK,EACL,UAAU,EACV,YAAY,EACZ,cAAc,GACf,EAAE,sBAAsB,sCAuHxB"}
@@ -1 +1 @@
1
- {"version":3,"file":"NetworkModal.d.ts","sourceRoot":"","sources":["../../../../src/network/components/NetworkModal.tsx"],"names":[],"mappings":"AAiDA,UAAU,iBAAiB;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,UAAU,CAAC,EAAE,CAAC,UAAU,EAAE,GAAG,KAAK,IAAI,CAAC;IACvC,2BAA2B,CAAC,EAAE,OAAO,CAAC;IACtC;;;;;;;;OAQG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;;;;OAKG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;CAC5C;AA0lBD;;;GAGG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,+BAMpD;AAED,MAAM,WAAW,oBAAoB;IACnC,+EAA+E;IAC/E,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;CAC5C;AAED;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAAC,KAAK,GAAE,oBAAyB,+BAa/D"}
1
+ {"version":3,"file":"NetworkModal.d.ts","sourceRoot":"","sources":["../../../../src/network/components/NetworkModal.tsx"],"names":[],"mappings":"AAwDA,UAAU,iBAAiB;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,UAAU,CAAC,EAAE,CAAC,UAAU,EAAE,GAAG,KAAK,IAAI,CAAC;IACvC,2BAA2B,CAAC,EAAE,OAAO,CAAC;IACtC;;;;;;;;OAQG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;;;;OAKG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;CAC5C;AA6rBD;;;GAGG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,+BAMpD;AAED,MAAM,WAAW,oBAAoB;IACnC,+EAA+E;IAC/E,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;CAC5C;AAED;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAAC,KAAK,GAAE,oBAAyB,+BAa/D"}
@@ -20,10 +20,21 @@ interface NetworkSavedScreenProps {
20
20
  visible: boolean;
21
21
  isPro: boolean;
22
22
  copySettings: CopySettings;
23
+ /**
24
+ * Controlled search box — pass both halves or neither, same deal as
25
+ * NetworkModal's `paused`.
26
+ *
27
+ * NetworkModal controls it because the detail screen's prev/next footer
28
+ * steps through THIS list, and this screen is unmounted while a detail is
29
+ * open (see NetworkDetailStepper). A host rendering the screen on its own
30
+ * can omit both and keep the local state.
31
+ */
32
+ search?: string;
33
+ onSearchChange?: (search: string) => void;
23
34
  /** Row tap — the root's setSelectedEvent (inherently stable setter). */
24
35
  onEventPress: (event: NetworkEvent) => void;
25
36
  onUpgradePress: () => void;
26
37
  }
27
- export declare function NetworkSavedScreen({ visible, isPro, copySettings, onEventPress, onUpgradePress, }: NetworkSavedScreenProps): import("react").JSX.Element | null;
38
+ export declare function NetworkSavedScreen({ visible, isPro, copySettings, search: searchProp, onSearchChange, onEventPress, onUpgradePress, }: NetworkSavedScreenProps): import("react").JSX.Element | null;
28
39
  export {};
29
40
  //# sourceMappingURL=NetworkSavedScreen.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"NetworkSavedScreen.d.ts","sourceRoot":"","sources":["../../../../src/network/components/NetworkSavedScreen.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAWH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAG7C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAyB9D,UAAU,uBAAuB;IAC/B,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,OAAO,CAAC;IACf,YAAY,EAAE,YAAY,CAAC;IAC3B,wEAAwE;IACxE,YAAY,EAAE,CAAC,KAAK,EAAE,YAAY,KAAK,IAAI,CAAC;IAC5C,cAAc,EAAE,MAAM,IAAI,CAAC;CAC5B;AAED,wBAAgB,kBAAkB,CAAC,EACjC,OAAO,EACP,KAAK,EACL,YAAY,EACZ,YAAY,EACZ,cAAc,GACf,EAAE,uBAAuB,sCAgIzB"}
1
+ {"version":3,"file":"NetworkSavedScreen.d.ts","sourceRoot":"","sources":["../../../../src/network/components/NetworkSavedScreen.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAWH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAG7C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAqB9D,UAAU,uBAAuB;IAC/B,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,OAAO,CAAC;IACf,YAAY,EAAE,YAAY,CAAC;IAC3B;;;;;;;;OAQG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1C,wEAAwE;IACxE,YAAY,EAAE,CAAC,KAAK,EAAE,YAAY,KAAK,IAAI,CAAC;IAC5C,cAAc,EAAE,MAAM,IAAI,CAAC;CAC5B;AAED,wBAAgB,kBAAkB,CAAC,EACjC,OAAO,EACP,KAAK,EACL,YAAY,EACZ,MAAM,EAAE,UAAU,EAClB,cAAc,EACd,YAAY,EACZ,cAAc,GACf,EAAE,uBAAuB,sCA2HzB"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Narrow subscriptions to the prev/next cursor (`networkSelectionStore`).
3
+ *
4
+ * One hook per consumer, each returning the SMALLEST value that consumer
5
+ * renders — that is the whole point of moving the cursor into a store. The
6
+ * modal root takes `useHasNetworkSelection()` (a boolean that flips twice a
7
+ * session), so a step no longer re-renders `JsModal`, the header and all five
8
+ * screens; the footer and the body take the parts that actually change.
9
+ */
10
+ /**
11
+ * Is ANYTHING selected — i.e. is the detail screen up?
12
+ *
13
+ * `useSyncExternalStore` compares the selector's result, so the root only
14
+ * re-renders when this boolean flips, not on every step.
15
+ */
16
+ export declare function useHasNetworkSelection(): boolean;
17
+ /** Where the USER is. Moves synchronously on tap — footer, header pin actions. */
18
+ export declare function useSelectedNetworkEventId(): string | null;
19
+ /** What the BODY may render. Lags `selectedId` — see networkSelectionStore. */
20
+ export declare function useNetworkBodyEventId(): string | null;
21
+ /** Cursor position + list length, for the "REQUEST n OF m" counter. */
22
+ export declare function useNetworkCursor(): {
23
+ index: number;
24
+ total: number;
25
+ };
26
+ //# sourceMappingURL=useNetworkSelection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useNetworkSelection.d.ts","sourceRoot":"","sources":["../../../../src/network/hooks/useNetworkSelection.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAaH;;;;;GAKG;AACH,wBAAgB,sBAAsB,IAAI,OAAO,CAMhD;AAED,kFAAkF;AAClF,wBAAgB,yBAAyB,IAAI,MAAM,GAAG,IAAI,CAMzD;AAED,+EAA+E;AAC/E,wBAAgB,qBAAqB,IAAI,MAAM,GAAG,IAAI,CAMrD;AAED,uEAAuE;AACvE,wBAAgB,gBAAgB,IAAI;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAYnE"}
@@ -0,0 +1,117 @@
1
+ /**
2
+ * Which request the detail view is showing, and where it sits in the list —
3
+ * the prev/next CURSOR.
4
+ *
5
+ * ## Why this is a store and not `useState` in the modal
6
+ *
7
+ * It used to be `useState` in `NetworkModalInner`. Every tap on Previous/Next
8
+ * therefore dirtied the modal ROOT, which re-rendered `JsModal` (1833 lines,
9
+ * nine useStates, animations/gestures/persistence — and it can never bail out,
10
+ * because its `header` prop is a fresh object literal every render), the whole
11
+ * header, and all five screens. None of them care which request is selected;
12
+ * they only care THAT one is.
13
+ *
14
+ * This is the same argument `NetworkModal`'s own header comment already makes
15
+ * about network events ("with the subscription here, 15 events re-rendered
16
+ * JsModal + every header button 15×"). Stepping is that same class of
17
+ * high-frequency churn, and it was sitting in the same wrong place. Now the
18
+ * root subscribes to `hasSelection` — a boolean that flips twice a session —
19
+ * while the footer, the body and the header's pin actions subscribe to the
20
+ * parts they actually render.
21
+ *
22
+ * ## The three cursors
23
+ *
24
+ * `selectedId` is where the USER is. It moves on the tap, synchronously.
25
+ *
26
+ * `bodyId` is what the detail body is allowed to render, and it deliberately
27
+ * LAGS: drawing a request means handing its payload to the virtualized data
28
+ * viewer to flatten, and that has no business blocking the next tap. It
29
+ * catches up only once the selection has held still for `settleMs`, so a
30
+ * burst of taps renders the request you land on and none of the ones you flew
31
+ * past. (`useDeferredValue` was tried here first and is the wrong tool — it
32
+ * lowers the priority of that work without preventing it, so every settled
33
+ * step still queued a flatten and each one delayed the touch behind it.)
34
+ *
35
+ * `renderedId` is what actually made it to the screen, reported by the detail
36
+ * screen after commit. Nothing in the product reads it; it exists so the
37
+ * benchmark harness can measure "time until request N was really painted"
38
+ * separately from "time until the cursor reached N".
39
+ */
40
+ import type { NetworkEvent } from "../types";
41
+ export interface NetworkSelectionState {
42
+ /** Navigable order — exactly what the list screen renders. */
43
+ ids: readonly string[];
44
+ /** Cursor position in `ids`, or -1 when the selection isn't in the list. */
45
+ index: number;
46
+ /** Where the user is. Moves synchronously on tap. */
47
+ selectedId: string | null;
48
+ /** What the body may render. Lags `selectedId` by `settleMs`. */
49
+ bodyId: string | null;
50
+ /** What the body actually committed. Benchmark instrumentation only. */
51
+ renderedId: string | null;
52
+ }
53
+ export type NetworkSelectionSubscriber = (state: NetworkSelectionState) => void;
54
+ /**
55
+ * How long the selection must hold still before the body renders it. Short
56
+ * enough that a single step reads as immediate (the footer and header have
57
+ * already moved), long enough that a burst collapses to one render.
58
+ */
59
+ export declare const DEFAULT_SETTLE_MS = 120;
60
+ declare class NetworkSelectionStore {
61
+ private ids;
62
+ private index;
63
+ private selectedId;
64
+ private bodyId;
65
+ private renderedId;
66
+ private settleMs;
67
+ private settleTimer;
68
+ private subscribers;
69
+ private snapshot;
70
+ private buildSnapshot;
71
+ /**
72
+ * One immutable snapshot per mutation, so subscribers can identity-compare
73
+ * and `useSyncExternalStore` stays happy.
74
+ */
75
+ private emit;
76
+ getState(): NetworkSelectionState;
77
+ subscribe(subscriber: NetworkSelectionSubscriber): () => void;
78
+ /**
79
+ * Publish the navigable order. Called by the stepper whenever its derived
80
+ * list changes (filter, search, pins, new requests arriving).
81
+ *
82
+ * The cursor is re-anchored BY ID, not by position: the live list is
83
+ * newest-first and new requests are prepended, so holding an index would
84
+ * silently slide the selection onto a different request every time one
85
+ * landed.
86
+ */
87
+ setIds(ids: readonly string[]): void;
88
+ select(id: string | null): void;
89
+ clear(): void;
90
+ /**
91
+ * Move the cursor. O(1) — the whole reason `index` is stored rather than
92
+ * re-derived with a `findIndex` on every render.
93
+ *
94
+ * Returns the id it landed on, or null if the move was out of bounds (the
95
+ * footer disables its arrows at the ends, but the benchmark driver calls
96
+ * this directly and needs to know when it has run off the end).
97
+ */
98
+ step(delta: number): string | null;
99
+ /**
100
+ * Opening and closing skip the settle delay: there is no in-flight render to
101
+ * protect on a null↔id transition, and waiting there just reads as a hang.
102
+ * Only id → id steps debounce.
103
+ */
104
+ private scheduleBody;
105
+ /** Benchmark toggle — `?settle=0` measures the gate's contribution. */
106
+ setSettleMs(ms: number): void;
107
+ getSettleMs(): number;
108
+ /** Reported by the detail screen after commit. Instrumentation only. */
109
+ reportRendered(id: string | null): void;
110
+ /** Test/bench helper — drop all cursor state without touching the events. */
111
+ reset(): void;
112
+ }
113
+ export declare const networkSelectionStore: NetworkSelectionStore;
114
+ /** Convenience for publishing an event list as the navigable order. */
115
+ export declare function toSelectionIds(events: readonly NetworkEvent[]): string[];
116
+ export {};
117
+ //# sourceMappingURL=networkSelectionStore.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"networkSelectionStore.d.ts","sourceRoot":"","sources":["../../../../src/network/utils/networkSelectionStore.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAE7C,MAAM,WAAW,qBAAqB;IACpC,8DAA8D;IAC9D,GAAG,EAAE,SAAS,MAAM,EAAE,CAAC;IACvB,4EAA4E;IAC5E,KAAK,EAAE,MAAM,CAAC;IACd,qDAAqD;IACrD,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,iEAAiE;IACjE,MAAM,EAAE,MAAM,GAAG,IA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,CAAC,MAAM,EAAE,SAAS,YAAY,EAAE,GAAG,MAAM,EAAE,CAExE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@buoy-gg/network",
3
- "version": "7.0.11",
3
+ "version": "7.0.13",
4
4
  "description": "In-app network inspector for React Native — requests, responses, timing & errors live, with GraphQL operation parsing. Part of Buoy devtools.",
5
5
  "main": "lib/commonjs/index.js",
6
6
  "module": "lib/module/index.js",
@@ -26,7 +26,7 @@
26
26
  ],
27
27
  "sideEffects": false,
28
28
  "dependencies": {
29
- "@buoy-gg/shared-ui": "^7.0.11"
29
+ "@buoy-gg/shared-ui": "^7.0.13"
30
30
  },
31
31
  "peerDependencies": {
32
32
  "react": "*",