@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.
Files changed (189) hide show
  1. package/lib/commonjs/JsModal.js +57 -22
  2. package/lib/commonjs/hooks/index.js +26 -0
  3. package/lib/commonjs/hooks/safe-area-impl.js +1 -1
  4. package/lib/commonjs/hooks/useChangeLog.js +55 -0
  5. package/lib/commonjs/hooks/useEventStoreEvents.js +65 -0
  6. package/lib/commonjs/hooks/usePersistedState.js +45 -10
  7. package/lib/commonjs/index.js +143 -0
  8. package/lib/commonjs/storage/definePersistedSetting.js +67 -0
  9. package/lib/commonjs/storage/index.js +8 -1
  10. package/lib/commonjs/stores/ChangeLog.js +197 -0
  11. package/lib/commonjs/stores/createToolStore.js +175 -0
  12. package/lib/commonjs/stores/index.js +15 -1
  13. package/lib/commonjs/sync/toolSyncAdapter.js +63 -0
  14. package/lib/commonjs/sync/wireForm.js +172 -0
  15. package/lib/commonjs/tools/defineTool.js +79 -0
  16. package/lib/commonjs/ui/components/ChangeRow.js +110 -0
  17. package/lib/commonjs/ui/components/ChipStrip.js +94 -0
  18. package/lib/commonjs/ui/components/DetailViewToggle.js +130 -0
  19. package/lib/commonjs/ui/components/DevToolsCard.js +3 -1
  20. package/lib/commonjs/ui/components/EntityFilterView.js +354 -0
  21. package/lib/commonjs/ui/components/ExportPreview.js +174 -0
  22. package/lib/commonjs/ui/components/InfoRow.js +90 -0
  23. package/lib/commonjs/ui/components/ModalHeader.js +40 -7
  24. package/lib/commonjs/ui/components/Pill.js +114 -0
  25. package/lib/commonjs/ui/components/ToggleRow.js +116 -0
  26. package/lib/commonjs/ui/components/ToolFooter.js +204 -0
  27. package/lib/commonjs/ui/components/index.js +100 -1
  28. package/lib/commonjs/ui/index.js +24 -2
  29. package/lib/commonjs/ui/listPresets.js +43 -0
  30. package/lib/commonjs/ui/night/primitives.js +3 -1
  31. package/lib/commonjs/utils/snapshotProviderKit.js +167 -0
  32. package/lib/commonjs/utils/stateTools.js +160 -0
  33. package/lib/module/JsModal.js +57 -22
  34. package/lib/module/hooks/index.js +3 -1
  35. package/lib/module/hooks/safe-area-impl.js +1 -1
  36. package/lib/module/hooks/useChangeLog.js +50 -0
  37. package/lib/module/hooks/useEventStoreEvents.js +61 -0
  38. package/lib/module/hooks/usePersistedState.js +44 -10
  39. package/lib/module/index.js +11 -1
  40. package/lib/module/storage/definePersistedSetting.js +63 -0
  41. package/lib/module/storage/index.js +2 -1
  42. package/lib/module/stores/ChangeLog.js +192 -0
  43. package/lib/module/stores/createToolStore.js +171 -0
  44. package/lib/module/stores/index.js +3 -1
  45. package/lib/module/sync/toolSyncAdapter.js +58 -0
  46. package/lib/module/sync/wireForm.js +159 -0
  47. package/lib/module/tools/defineTool.js +74 -0
  48. package/lib/module/ui/components/ChangeRow.js +105 -0
  49. package/lib/module/ui/components/ChipStrip.js +91 -0
  50. package/lib/module/ui/components/DetailViewToggle.js +125 -0
  51. package/lib/module/ui/components/DevToolsCard.js +3 -1
  52. package/lib/module/ui/components/EntityFilterView.js +350 -0
  53. package/lib/module/ui/components/ExportPreview.js +169 -0
  54. package/lib/module/ui/components/InfoRow.js +86 -0
  55. package/lib/module/ui/components/ModalHeader.js +40 -7
  56. package/lib/module/ui/components/Pill.js +110 -0
  57. package/lib/module/ui/components/ToggleRow.js +112 -0
  58. package/lib/module/ui/components/ToolFooter.js +196 -0
  59. package/lib/module/ui/components/index.js +10 -1
  60. package/lib/module/ui/index.js +4 -1
  61. package/lib/module/ui/listPresets.js +39 -0
  62. package/lib/module/ui/night/primitives.js +3 -1
  63. package/lib/module/utils/snapshotProviderKit.js +156 -0
  64. package/lib/module/utils/stateTools.js +154 -0
  65. package/lib/typescript/commonjs/JsModal.d.ts.map +1 -1
  66. package/lib/typescript/commonjs/hooks/index.d.ts +3 -1
  67. package/lib/typescript/commonjs/hooks/index.d.ts.map +1 -1
  68. package/lib/typescript/commonjs/hooks/safe-area-impl.d.ts +1 -1
  69. package/lib/typescript/commonjs/hooks/useChangeLog.d.ts +38 -0
  70. package/lib/typescript/commonjs/hooks/useChangeLog.d.ts.map +1 -0
  71. package/lib/typescript/commonjs/hooks/useEventStoreEvents.d.ts +25 -0
  72. package/lib/typescript/commonjs/hooks/useEventStoreEvents.d.ts.map +1 -0
  73. package/lib/typescript/commonjs/hooks/usePersistedState.d.ts +34 -5
  74. package/lib/typescript/commonjs/hooks/usePersistedState.d.ts.map +1 -1
  75. package/lib/typescript/commonjs/index.d.ts +6 -1
  76. package/lib/typescript/commonjs/index.d.ts.map +1 -1
  77. package/lib/typescript/commonjs/storage/definePersistedSetting.d.ts +39 -0
  78. package/lib/typescript/commonjs/storage/definePersistedSetting.d.ts.map +1 -0
  79. package/lib/typescript/commonjs/storage/index.d.ts +1 -0
  80. package/lib/typescript/commonjs/storage/index.d.ts.map +1 -1
  81. package/lib/typescript/commonjs/stores/ChangeLog.d.ts +100 -0
  82. package/lib/typescript/commonjs/stores/ChangeLog.d.ts.map +1 -0
  83. package/lib/typescript/commonjs/stores/createToolStore.d.ts +92 -0
  84. package/lib/typescript/commonjs/stores/createToolStore.d.ts.map +1 -0
  85. package/lib/typescript/commonjs/stores/index.d.ts +2 -0
  86. package/lib/typescript/commonjs/stores/index.d.ts.map +1 -1
  87. package/lib/typescript/commonjs/sync/toolSyncAdapter.d.ts +66 -0
  88. package/lib/typescript/commonjs/sync/toolSyncAdapter.d.ts.map +1 -0
  89. package/lib/typescript/commonjs/sync/wireForm.d.ts +100 -0
  90. package/lib/typescript/commonjs/sync/wireForm.d.ts.map +1 -0
  91. package/lib/typescript/commonjs/tools/defineTool.d.ts +100 -0
  92. package/lib/typescript/commonjs/tools/defineTool.d.ts.map +1 -0
  93. package/lib/typescript/commonjs/ui/components/ChangeRow.d.ts +52 -0
  94. package/lib/typescript/commonjs/ui/components/ChangeRow.d.ts.map +1 -0
  95. package/lib/typescript/commonjs/ui/components/ChipStrip.d.ts +41 -0
  96. package/lib/typescript/commonjs/ui/components/ChipStrip.d.ts.map +1 -0
  97. package/lib/typescript/commonjs/ui/components/DetailViewToggle.d.ts +36 -0
  98. package/lib/typescript/commonjs/ui/components/DetailViewToggle.d.ts.map +1 -0
  99. package/lib/typescript/commonjs/ui/components/DevToolsCard.d.ts +8 -1
  100. package/lib/typescript/commonjs/ui/components/DevToolsCard.d.ts.map +1 -1
  101. package/lib/typescript/commonjs/ui/components/EntityFilterView.d.ts +51 -0
  102. package/lib/typescript/commonjs/ui/components/EntityFilterView.d.ts.map +1 -0
  103. package/lib/typescript/commonjs/ui/components/ExportPreview.d.ts +48 -0
  104. package/lib/typescript/commonjs/ui/components/ExportPreview.d.ts.map +1 -0
  105. package/lib/typescript/commonjs/ui/components/InfoRow.d.ts +33 -0
  106. package/lib/typescript/commonjs/ui/components/InfoRow.d.ts.map +1 -0
  107. package/lib/typescript/commonjs/ui/components/ModalHeader.d.ts +31 -1
  108. package/lib/typescript/commonjs/ui/components/ModalHeader.d.ts.map +1 -1
  109. package/lib/typescript/commonjs/ui/components/Pill.d.ts +38 -0
  110. package/lib/typescript/commonjs/ui/components/Pill.d.ts.map +1 -0
  111. package/lib/typescript/commonjs/ui/components/ToggleRow.d.ts +33 -0
  112. package/lib/typescript/commonjs/ui/components/ToggleRow.d.ts.map +1 -0
  113. package/lib/typescript/commonjs/ui/components/ToolFooter.d.ts +69 -0
  114. package/lib/typescript/commonjs/ui/components/ToolFooter.d.ts.map +1 -0
  115. package/lib/typescript/commonjs/ui/components/index.d.ts +9 -0
  116. package/lib/typescript/commonjs/ui/components/index.d.ts.map +1 -1
  117. package/lib/typescript/commonjs/ui/index.d.ts +1 -0
  118. package/lib/typescript/commonjs/ui/index.d.ts.map +1 -1
  119. package/lib/typescript/commonjs/ui/listPresets.d.ts +28 -0
  120. package/lib/typescript/commonjs/ui/listPresets.d.ts.map +1 -0
  121. package/lib/typescript/commonjs/ui/night/primitives.d.ts +3 -1
  122. package/lib/typescript/commonjs/ui/night/primitives.d.ts.map +1 -1
  123. package/lib/typescript/commonjs/utils/snapshotProviderKit.d.ts +81 -0
  124. package/lib/typescript/commonjs/utils/snapshotProviderKit.d.ts.map +1 -0
  125. package/lib/typescript/commonjs/utils/stateTools.d.ts +44 -0
  126. package/lib/typescript/commonjs/utils/stateTools.d.ts.map +1 -0
  127. package/lib/typescript/module/JsModal.d.ts.map +1 -1
  128. package/lib/typescript/module/hooks/index.d.ts +3 -1
  129. package/lib/typescript/module/hooks/index.d.ts.map +1 -1
  130. package/lib/typescript/module/hooks/safe-area-impl.d.ts +1 -1
  131. package/lib/typescript/module/hooks/useChangeLog.d.ts +38 -0
  132. package/lib/typescript/module/hooks/useChangeLog.d.ts.map +1 -0
  133. package/lib/typescript/module/hooks/useEventStoreEvents.d.ts +25 -0
  134. package/lib/typescript/module/hooks/useEventStoreEvents.d.ts.map +1 -0
  135. package/lib/typescript/module/hooks/usePersistedState.d.ts +34 -5
  136. package/lib/typescript/module/hooks/usePersistedState.d.ts.map +1 -1
  137. package/lib/typescript/module/index.d.ts +6 -1
  138. package/lib/typescript/module/index.d.ts.map +1 -1
  139. package/lib/typescript/module/storage/definePersistedSetting.d.ts +39 -0
  140. package/lib/typescript/module/storage/definePersistedSetting.d.ts.map +1 -0
  141. package/lib/typescript/module/storage/index.d.ts +1 -0
  142. package/lib/typescript/module/storage/index.d.ts.map +1 -1
  143. package/lib/typescript/module/stores/ChangeLog.d.ts +100 -0
  144. package/lib/typescript/module/stores/ChangeLog.d.ts.map +1 -0
  145. package/lib/typescript/module/stores/createToolStore.d.ts +92 -0
  146. package/lib/typescript/module/stores/createToolStore.d.ts.map +1 -0
  147. package/lib/typescript/module/stores/index.d.ts +2 -0
  148. package/lib/typescript/module/stores/index.d.ts.map +1 -1
  149. package/lib/typescript/module/sync/toolSyncAdapter.d.ts +66 -0
  150. package/lib/typescript/module/sync/toolSyncAdapter.d.ts.map +1 -0
  151. package/lib/typescript/module/sync/wireForm.d.ts +100 -0
  152. package/lib/typescript/module/sync/wireForm.d.ts.map +1 -0
  153. package/lib/typescript/module/tools/defineTool.d.ts +100 -0
  154. package/lib/typescript/module/tools/defineTool.d.ts.map +1 -0
  155. package/lib/typescript/module/ui/components/ChangeRow.d.ts +52 -0
  156. package/lib/typescript/module/ui/components/ChangeRow.d.ts.map +1 -0
  157. package/lib/typescript/module/ui/components/ChipStrip.d.ts +41 -0
  158. package/lib/typescript/module/ui/components/ChipStrip.d.ts.map +1 -0
  159. package/lib/typescript/module/ui/components/DetailViewToggle.d.ts +36 -0
  160. package/lib/typescript/module/ui/components/DetailViewToggle.d.ts.map +1 -0
  161. package/lib/typescript/module/ui/components/DevToolsCard.d.ts +8 -1
  162. package/lib/typescript/module/ui/components/DevToolsCard.d.ts.map +1 -1
  163. package/lib/typescript/module/ui/components/EntityFilterView.d.ts +51 -0
  164. package/lib/typescript/module/ui/components/EntityFilterView.d.ts.map +1 -0
  165. package/lib/typescript/module/ui/components/ExportPreview.d.ts +48 -0
  166. package/lib/typescript/module/ui/components/ExportPreview.d.ts.map +1 -0
  167. package/lib/typescript/module/ui/components/InfoRow.d.ts +33 -0
  168. package/lib/typescript/module/ui/components/InfoRow.d.ts.map +1 -0
  169. package/lib/typescript/module/ui/components/ModalHeader.d.ts +31 -1
  170. package/lib/typescript/module/ui/components/ModalHeader.d.ts.map +1 -1
  171. package/lib/typescript/module/ui/components/Pill.d.ts +38 -0
  172. package/lib/typescript/module/ui/components/Pill.d.ts.map +1 -0
  173. package/lib/typescript/module/ui/components/ToggleRow.d.ts +33 -0
  174. package/lib/typescript/module/ui/components/ToggleRow.d.ts.map +1 -0
  175. package/lib/typescript/module/ui/components/ToolFooter.d.ts +69 -0
  176. package/lib/typescript/module/ui/components/ToolFooter.d.ts.map +1 -0
  177. package/lib/typescript/module/ui/components/index.d.ts +9 -0
  178. package/lib/typescript/module/ui/components/index.d.ts.map +1 -1
  179. package/lib/typescript/module/ui/index.d.ts +1 -0
  180. package/lib/typescript/module/ui/index.d.ts.map +1 -1
  181. package/lib/typescript/module/ui/listPresets.d.ts +28 -0
  182. package/lib/typescript/module/ui/listPresets.d.ts.map +1 -0
  183. package/lib/typescript/module/ui/night/primitives.d.ts +3 -1
  184. package/lib/typescript/module/ui/night/primitives.d.ts.map +1 -1
  185. package/lib/typescript/module/utils/snapshotProviderKit.d.ts +81 -0
  186. package/lib/typescript/module/utils/snapshotProviderKit.d.ts.map +1 -0
  187. package/lib/typescript/module/utils/stateTools.d.ts +44 -0
  188. package/lib/typescript/module/utils/stateTools.d.ts.map +1 -0
  189. package/package.json +4 -4
@@ -0,0 +1,79 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.createToolFactory = createToolFactory;
7
+ exports.defineToolPreset = defineToolPreset;
8
+ /**
9
+ * defineToolPreset / createToolFactory — the typed way to declare a tool.
10
+ *
11
+ * Every tool package exports a `xToolPreset` object literal and a
12
+ * `createXTool(options)` factory that restates the same literal with
13
+ * `options?.name || default` on each field. None of the 23 presets was
14
+ * annotated with core's `InstalledApp`, so a preset that drifted from the
15
+ * contract (a bad `slot`, a missing `component`) failed at runtime in the
16
+ * dial, not at compile time.
17
+ *
18
+ * `ToolPreset` is that contract, declared here in shared (which every tool
19
+ * already depends on) and structurally identical to core's `InstalledApp`.
20
+ * `defineToolPreset` is an identity function that type-checks the literal;
21
+ * `createToolFactory` derives the `createXTool` function from the preset so
22
+ * the defaults live in exactly one place.
23
+ *
24
+ * Auto-discovery (core's `autoDiscoverPresets` / `autoExternalSync`) stays
25
+ * as hand-written `require()` blocks on purpose: Metro needs each package
26
+ * name as a static string lexically inside its own try, so a manifest can't
27
+ * replace them.
28
+ */
29
+
30
+ /** Where a tool should render within the floating menu surface. */
31
+
32
+ /** What an icon renderer receives. Mirrors core's `FloatingMenuRenderCtx`. */
33
+
34
+ /** Declarative modal chrome for a body-only tool. Mirrors core's `ToolModalConfig`. */
35
+
36
+ /**
37
+ * The shape the floating menu installs. Structurally identical to core's
38
+ * `InstalledApp`; declared here so tool packages can type their presets
39
+ * without depending on core.
40
+ */
41
+
42
+ /** Identity with a type check: the literal must satisfy `ToolPreset`. */
43
+ function defineToolPreset(preset) {
44
+ return preset;
45
+ }
46
+
47
+ /** The overrides every `createXTool` accepted. */
48
+
49
+ /**
50
+ * Derive `createXTool(options)` from a preset: id/name/description overrides
51
+ * apply on top, and `mapProps` turns tool-specific options into `props`
52
+ * (merged over the preset's defaults).
53
+ *
54
+ * ```ts
55
+ * export const createNetworkTool = createToolFactory(networkToolPreset, (o: { enableSharedModalDimensions?: boolean }) => ({
56
+ * enableSharedModalDimensions: o.enableSharedModalDimensions ?? false,
57
+ * }));
58
+ * ```
59
+ */
60
+ function createToolFactory(preset, mapProps, /** Last word on any other preset field (a recolored icon, say). */
61
+ extend) {
62
+ return options => {
63
+ const overrides = options ?? {};
64
+ const props = preset.props === undefined && !mapProps ? undefined : {
65
+ ...(preset.props ?? {}),
66
+ ...(mapProps ? mapProps(overrides) : {})
67
+ };
68
+ return {
69
+ ...preset,
70
+ id: overrides.id || preset.id,
71
+ name: overrides.name || preset.name,
72
+ description: overrides.description || preset.description,
73
+ ...(props !== undefined ? {
74
+ props
75
+ } : {}),
76
+ ...(extend ? extend(overrides, preset) : {})
77
+ };
78
+ };
79
+ }
@@ -0,0 +1,110 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.ChangeRow = ChangeRow;
7
+ var _react = _interopRequireDefault(require("react"));
8
+ var _reactNative = require("react-native");
9
+ var _gameUIColors = require("../gameUI/constants/gameUIColors.js");
10
+ var _CompactRow = require("./CompactRow.js");
11
+ var _index = require("../../icons/index.js");
12
+ var _RelativeTime = require("../../utils/time/RelativeTime.js");
13
+ var _jsxRuntime = require("react/jsx-runtime");
14
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
15
+ /**
16
+ * ChangeRow — one recorded change in a state tool's history list.
17
+ *
18
+ * redux, zustand and jotai each drew the same row on top of `CompactRow`:
19
+ * a colored status word (the slice / store / atom), a sublabel ("1.2ms ·
20
+ * 3 keys changed"), the primary line (changed keys or a value preview), a
21
+ * relative timestamp, and a right-hand badge made of a mono verb (SET,
22
+ * WRITE, ADDITEM) plus an icon — a lightning bolt when state actually
23
+ * changed, a clock when the update was slow. The three copies differed
24
+ * only in how they computed those strings. This component owns the drawing;
25
+ * tools own the strings.
26
+ *
27
+ * testID convention (unchanged from the originals): `${testID}-badge`,
28
+ * `${testID}-change`, `${testID}-slow`, `${testID}-status`,
29
+ * `${testID}-sublabel`, `${testID}-keys`.
30
+ */
31
+
32
+ function ChangeRow({
33
+ statusColor,
34
+ statusLabel,
35
+ sublabel,
36
+ primaryText,
37
+ timestamp,
38
+ badgeText,
39
+ changed = false,
40
+ slow = false,
41
+ badgePrefix,
42
+ customBadge,
43
+ plainBadgeText,
44
+ onPress,
45
+ testID,
46
+ accessibilityLabel
47
+ }) {
48
+ // Always a custom badge, even when there is no icon to hang off it. The
49
+ // alternative — letting CompactRow draw `badgeText` itself — leaves the one
50
+ // row whose badge matters most (a write that changed NOTHING) as the only
51
+ // row in the list with no handle on its badge.
52
+ const badge = customBadge ?? (badgeText !== undefined || badgePrefix || changed || slow ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
53
+ style: styles.badgeContainer,
54
+ children: [badgePrefix, badgeText !== undefined ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
55
+ style: [styles.badgeText, {
56
+ color: statusColor
57
+ }],
58
+ testID: testID ? `${testID}-badge` : undefined,
59
+ children: badgeText
60
+ }) : null, slow ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
61
+ style: styles.iconBadge,
62
+ testID: testID ? `${testID}-slow` : undefined,
63
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_index.Clock, {
64
+ size: 12,
65
+ color: _gameUIColors.buoyColors.error
66
+ })
67
+ }) : changed ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
68
+ style: styles.iconBadge,
69
+ testID: testID ? `${testID}-change` : undefined,
70
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_index.Zap, {
71
+ size: 12,
72
+ color: _gameUIColors.buoyColors.warning
73
+ })
74
+ }) : null]
75
+ }) : undefined);
76
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_CompactRow.CompactRow, {
77
+ statusDotColor: statusColor,
78
+ statusLabel: statusLabel,
79
+ statusSublabel: sublabel,
80
+ primaryText: primaryText,
81
+ bottomRightText: /*#__PURE__*/(0, _jsxRuntime.jsx)(_RelativeTime.RelativeTime, {
82
+ timestamp: timestamp
83
+ }),
84
+ customBadge: badge,
85
+ badgeText: badge ? undefined : plainBadgeText,
86
+ badgeColor: statusColor,
87
+ showChevron: true,
88
+ onPress: onPress,
89
+ testID: testID,
90
+ statusTestID: testID ? `${testID}-status` : undefined,
91
+ statusSublabelTestID: testID ? `${testID}-sublabel` : undefined,
92
+ primaryTestID: testID ? `${testID}-keys` : undefined,
93
+ accessibilityLabel: accessibilityLabel
94
+ });
95
+ }
96
+ const styles = _reactNative.StyleSheet.create({
97
+ badgeContainer: {
98
+ flexDirection: "row",
99
+ alignItems: "center",
100
+ gap: 4
101
+ },
102
+ badgeText: {
103
+ fontSize: 11,
104
+ fontWeight: "600",
105
+ fontFamily: "monospace"
106
+ },
107
+ iconBadge: {
108
+ paddingHorizontal: 4
109
+ }
110
+ });
@@ -0,0 +1,94 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.ChipStrip = ChipStrip;
7
+ exports.useChipTap = useChipTap;
8
+ var _react = require("react");
9
+ var _reactNative = require("react-native");
10
+ var _jsxRuntime = require("react/jsx-runtime");
11
+ /**
12
+ * ChipStrip — a horizontally scrolling row of filter chips whose taps
13
+ * don't misfire while the strip is being panned.
14
+ *
15
+ * react-query drew this three times (query status, mutation status, storage
16
+ * type) with the same 5-point / 300 ms swipe-vs-tap discrimination. The
17
+ * strip and the discrimination live here; the chip is whatever the tool
18
+ * renders, wired through `useChipTap`.
19
+ */
20
+
21
+ /** How far a touch may travel and still count as a tap. */const TAP_SLOP_PX = 5;
22
+ /** How long after a scroll ends taps stay suppressed. */
23
+ const SCROLL_SETTLE_MS = 300;
24
+ /**
25
+ * Swipe-vs-tap discrimination for chips inside a horizontal ScrollView.
26
+ * A press that moved more than a few points, or landed while the strip was
27
+ * still scrolling, is a pan — not a filter toggle.
28
+ */
29
+ function useChipTap() {
30
+ const [isScrolling, setIsScrolling] = (0, _react.useState)(false);
31
+ const touchStartX = (0, _react.useRef)(0);
32
+ const touchStartY = (0, _react.useRef)(0);
33
+ const onTouchStart = (0, _react.useCallback)(event => {
34
+ touchStartX.current = event.nativeEvent.pageX;
35
+ touchStartY.current = event.nativeEvent.pageY;
36
+ }, []);
37
+ const isTap = (0, _react.useCallback)(event => {
38
+ if (!event) return true;
39
+ const dx = Math.abs(event.nativeEvent.pageX - touchStartX.current);
40
+ const dy = Math.abs(event.nativeEvent.pageY - touchStartY.current);
41
+ return !(dx > TAP_SLOP_PX || dy > TAP_SLOP_PX || isScrolling);
42
+ }, [isScrolling]);
43
+ const settle = (0, _react.useCallback)(() => {
44
+ setTimeout(() => setIsScrolling(false), SCROLL_SETTLE_MS);
45
+ }, []);
46
+ const begin = (0, _react.useCallback)(() => setIsScrolling(true), []);
47
+ return {
48
+ scrollProps: {
49
+ onScrollBeginDrag: begin,
50
+ onScrollEndDrag: settle,
51
+ onMomentumScrollBegin: begin,
52
+ onMomentumScrollEnd: settle
53
+ },
54
+ onTouchStart,
55
+ isTap
56
+ };
57
+ }
58
+ function ChipStrip({
59
+ children,
60
+ scrollProps,
61
+ sentryLabel,
62
+ style,
63
+ contentStyle
64
+ }) {
65
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
66
+ style: [styles.container, style],
67
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.ScrollView, {
68
+ "sentry-label": sentryLabel,
69
+ horizontal: true,
70
+ showsHorizontalScrollIndicator: false,
71
+ style: styles.scrollView,
72
+ contentContainerStyle: [styles.scrollContent, contentStyle],
73
+ ...scrollProps,
74
+ children: children
75
+ })
76
+ });
77
+ }
78
+ const styles = _reactNative.StyleSheet.create({
79
+ container: {
80
+ flex: 1,
81
+ minWidth: 0
82
+ },
83
+ scrollView: {
84
+ flex: 1
85
+ },
86
+ scrollContent: {
87
+ flexDirection: "row",
88
+ alignItems: "center",
89
+ gap: 8,
90
+ paddingHorizontal: 4,
91
+ paddingVertical: 4,
92
+ flexGrow: 1
93
+ }
94
+ });
@@ -0,0 +1,130 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.DetailViewToggle = void 0;
7
+ var _react = _interopRequireWildcard(require("react"));
8
+ var _reactNative = require("react-native");
9
+ var _nightTheme = require("../night/nightTheme.js");
10
+ var _jsxRuntime = require("react/jsx-runtime");
11
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
12
+ /**
13
+ * DetailViewToggle — the row of view cards at the top of a detail screen
14
+ * (ACTION · STATE · DIFF, CHANGE · STATE · DIFF, …).
15
+ *
16
+ * redux, zustand and jotai each shipped their own copy, differing only in
17
+ * the view keys, labels and testID prefix. The cards, the accent chrome,
18
+ * the disabled state (diff with nothing to compare) and the a11y contract
19
+ * are all one component now; tools pass their `views`.
20
+ */
21
+
22
+ function DetailViewToggleImpl({
23
+ views,
24
+ activeView,
25
+ onViewChange,
26
+ disabledKeys,
27
+ testIDPrefix
28
+ }) {
29
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
30
+ style: styles.container,
31
+ children: views.map(view => {
32
+ const isActive = activeView === view.key;
33
+ const isDisabled = disabledKeys?.includes(view.key) ?? false;
34
+ const activeColor = view.activeColor ?? _nightTheme.night.color.accent;
35
+ const IconComponent = view.icon;
36
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.TouchableOpacity, {
37
+ style: [styles.card, isActive && [styles.cardActive, {
38
+ borderColor: activeColor
39
+ }], isDisabled && styles.cardDisabled],
40
+ onPress: () => !isDisabled && onViewChange(view.key),
41
+ activeOpacity: isDisabled ? 1 : 0.8,
42
+ disabled: isDisabled,
43
+ testID: testIDPrefix ? `${testIDPrefix}-view-${view.key}` : undefined,
44
+ accessibilityRole: "button",
45
+ accessibilityLabel: view.label,
46
+ accessibilityState: {
47
+ selected: isActive,
48
+ disabled: isDisabled
49
+ },
50
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
51
+ style: styles.cardContent,
52
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(IconComponent, {
53
+ size: 14,
54
+ color: isActive ? activeColor : isDisabled ? _nightTheme.night.color.textTertiary : _nightTheme.night.color.textSecondary
55
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
56
+ style: [styles.cardLabel, isActive && [styles.cardLabelActive, {
57
+ color: activeColor
58
+ }], isDisabled && styles.cardLabelDisabled],
59
+ children: view.label
60
+ })]
61
+ }), view.description ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
62
+ style: [styles.cardDescription, isActive && styles.cardDescriptionActive, isDisabled && styles.cardDescriptionDisabled],
63
+ children: view.description
64
+ }) : null]
65
+ }, view.key);
66
+ })
67
+ });
68
+ }
69
+ const DetailViewToggle = exports.DetailViewToggle = /*#__PURE__*/(0, _react.memo)(DetailViewToggleImpl);
70
+ const styles = _reactNative.StyleSheet.create({
71
+ container: {
72
+ flexDirection: "row",
73
+ gap: 8,
74
+ padding: 14,
75
+ // Transparent so the night sheet's star field shows through.
76
+ backgroundColor: "transparent"
77
+ },
78
+ card: {
79
+ flex: 1,
80
+ backgroundColor: _nightTheme.night.color.surface,
81
+ borderRadius: 12,
82
+ borderWidth: 1,
83
+ borderColor: _nightTheme.night.color.border,
84
+ padding: 10,
85
+ gap: 4
86
+ },
87
+ cardActive: {
88
+ borderWidth: 1.5,
89
+ backgroundColor: _nightTheme.night.color.accentSoft,
90
+ shadowColor: _nightTheme.night.color.accent,
91
+ shadowOffset: {
92
+ width: 0,
93
+ height: 2
94
+ },
95
+ shadowOpacity: 0.1,
96
+ shadowRadius: 8,
97
+ elevation: 3
98
+ },
99
+ cardDisabled: {
100
+ opacity: 0.5
101
+ },
102
+ cardContent: {
103
+ flexDirection: "row",
104
+ alignItems: "center",
105
+ gap: 6
106
+ },
107
+ cardLabel: {
108
+ fontSize: 10,
109
+ fontWeight: "700",
110
+ letterSpacing: 0.5,
111
+ color: _nightTheme.night.color.textSecondary
112
+ },
113
+ cardLabelActive: {
114
+ color: _nightTheme.night.color.text
115
+ },
116
+ cardLabelDisabled: {
117
+ color: _nightTheme.night.color.textTertiary
118
+ },
119
+ cardDescription: {
120
+ fontSize: 9,
121
+ color: _nightTheme.night.color.textTertiary,
122
+ lineHeight: 12
123
+ },
124
+ cardDescriptionActive: {
125
+ color: _nightTheme.night.color.textSecondary
126
+ },
127
+ cardDescriptionDisabled: {
128
+ color: _nightTheme.night.color.textTertiary
129
+ }
130
+ });
@@ -49,7 +49,8 @@ function DevToolsCard({
49
49
  style,
50
50
  contentStyle,
51
51
  testID,
52
- accessibilityLabel
52
+ accessibilityLabel,
53
+ accessible
53
54
  }) {
54
55
  const isInteractive = !!onPress || !!onLongPress;
55
56
 
@@ -58,6 +59,7 @@ function DevToolsCard({
58
59
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
59
60
  style: [styles.wrapper, style],
60
61
  testID: testID,
62
+ accessible: accessible,
61
63
  accessibilityLabel: accessibilityLabel,
62
64
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
63
65
  style: [styles.card, isSelected && styles.selectedCard, contentStyle],