@buoy-gg/network 7.0.41 → 7.0.43
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/README.md +11 -85
- package/lib/commonjs/index.js +1 -332
- package/lib/commonjs/index.web.js +1 -420
- package/lib/commonjs/network/components/DataViewer.web.js +1 -879
- package/lib/commonjs/network/components/NetworkCopyScreen.web.js +1 -48
- package/lib/commonjs/network/components/NetworkCopySettingsView.js +27 -755
- package/lib/commonjs/network/components/NetworkCopySettingsView.web.js +14 -1242
- package/lib/commonjs/network/components/NetworkDetailScreen.web.js +1 -101
- package/lib/commonjs/network/components/NetworkDetailStepper.js +1 -108
- package/lib/commonjs/network/components/NetworkDetailStepper.web.js +1 -298
- package/lib/commonjs/network/components/NetworkEventDetailView.js +15 -1130
- package/lib/commonjs/network/components/NetworkEventDetailView.web.js +15 -1484
- package/lib/commonjs/network/components/NetworkEventItemCompact.js +2 -401
- package/lib/commonjs/network/components/NetworkEventItemCompact.web.js +2 -820
- package/lib/commonjs/network/components/NetworkFilterScreen.web.js +1 -55
- package/lib/commonjs/network/components/NetworkFilterViewV3.js +1 -442
- package/lib/commonjs/network/components/NetworkFilterViewV3.web.js +1 -1310
- package/lib/commonjs/network/components/NetworkHeaderLive.js +1 -375
- package/lib/commonjs/network/components/NetworkHeaderLive.web.js +1 -623
- package/lib/commonjs/network/components/NetworkHeaderMenu.js +1 -190
- package/lib/commonjs/network/components/NetworkListScreen.js +1 -403
- package/lib/commonjs/network/components/NetworkListScreen.web.js +1 -624
- package/lib/commonjs/network/components/NetworkModal.js +1 -786
- package/lib/commonjs/network/components/NetworkNumberPrompt.js +1 -178
- package/lib/commonjs/network/components/NetworkNumberPrompt.web.js +1 -232
- package/lib/commonjs/network/components/NetworkOverrideEditor.js +1 -814
- package/lib/commonjs/network/components/NetworkOverrideEditor.web.js +1 -942
- package/lib/commonjs/network/components/NetworkOverrideHeaderButton.js +1 -107
- package/lib/commonjs/network/components/NetworkOverrideHeaderButton.web.js +1 -133
- package/lib/commonjs/network/components/NetworkOverridesButton.js +1 -90
- package/lib/commonjs/network/components/NetworkOverridesButton.web.js +1 -143
- package/lib/commonjs/network/components/NetworkOverridesScreen.js +1 -543
- package/lib/commonjs/network/components/NetworkOverridesScreen.web.js +1 -830
- package/lib/commonjs/network/components/NetworkSavedScreen.js +1 -226
- package/lib/commonjs/network/components/NetworkSavedScreen.web.js +1 -463
- package/lib/commonjs/network/components/NetworkUpgradeBanner.js +1 -76
- package/lib/commonjs/network/components/response-editor/Explorer.js +1 -973
- package/lib/commonjs/network/components/response-editor/Explorer.web.js +1 -1136
- package/lib/commonjs/network/components/response-editor/deleteNestedDataByPath.js +1 -56
- package/lib/commonjs/network/components/response-editor/editorContext.js +1 -33
- package/lib/commonjs/network/components/response-editor/updateNestedDataByPath.js +1 -61
- package/lib/commonjs/network/conditions/NetworkConditionsControl.js +1 -235
- package/lib/commonjs/network/conditions/NetworkConditionsControl.test.js +1 -136
- package/lib/commonjs/network/conditions/NetworkConditionsIcon.js +1 -33
- package/lib/commonjs/network/conditions/NetworkFloatingTool.js +1 -310
- package/lib/commonjs/network/conditions/NetworkFloatingTool.test.js +1 -219
- package/lib/commonjs/network/conditions/store.js +1 -75
- package/lib/commonjs/network/conditions/wait.js +1 -43
- package/lib/commonjs/network/conditions/xhr.js +1 -135
- package/lib/commonjs/network/hooks/useLiveNetworkEvent.js +1 -62
- package/lib/commonjs/network/hooks/useNetworkBadgeCounts.js +1 -83
- package/lib/commonjs/network/hooks/useNetworkEventList.js +1 -108
- package/lib/commonjs/network/hooks/useNetworkEvents.js +1 -318
- package/lib/commonjs/network/hooks/useNetworkHasMatches.js +1 -56
- package/lib/commonjs/network/hooks/useNetworkSaved.js +1 -38
- package/lib/commonjs/network/hooks/useNetworkSelection.js +1 -53
- package/lib/commonjs/network/hooks/useOverrideRules.js +1 -36
- package/lib/commonjs/network/hooks/useTickEveryMinute.js +1 -21
- package/lib/commonjs/network/overrides/applyToFetch.js +1 -80
- package/lib/commonjs/network/overrides/applyToXhr.js +2 -510
- package/lib/commonjs/network/overrides/engine.js +1 -93
- package/lib/commonjs/network/overrides/matchRule.js +1 -87
- package/lib/commonjs/network/overrides/overriddenRows.js +1 -37
- package/lib/commonjs/network/overrides/overrideRulesStore.js +1 -550
- package/lib/commonjs/network/overrides/presets.js +1 -70
- package/lib/commonjs/network/overrides/resolveOverride.js +1 -158
- package/lib/commonjs/network/overrides/types.js +1 -90
- package/lib/commonjs/network/sync/networkBodyResolver.js +1 -39
- package/lib/commonjs/network/sync/networkSyncAdapter.js +1 -882
- package/lib/commonjs/network/sync/overrideHonesty.release.test.js +1 -36
- package/lib/commonjs/network/types/index.js +1 -5
- package/lib/commonjs/network/utils/extractOperationName.js +1 -80
- package/lib/commonjs/network/utils/filterNetworkEvents.js +1 -96
- package/lib/commonjs/network/utils/formatGraphQLVariables.js +1 -219
- package/lib/commonjs/network/utils/formatting.js +1 -30
- package/lib/commonjs/network/utils/generateCurl.js +2 -71
- package/lib/commonjs/network/utils/generateNetworkCopyText.js +37 -166
- package/lib/commonjs/network/utils/httpCompletion.js +1 -37
- package/lib/commonjs/network/utils/networkEventStore.js +1 -411
- package/lib/commonjs/network/utils/networkListener.js +4 -1352
- package/lib/commonjs/network/utils/networkSavedStore.js +3 -577
- package/lib/commonjs/network/utils/networkSelectionStore.js +1 -193
- package/lib/commonjs/network/utils/realNow.js +1 -0
- package/lib/commonjs/network/utils/requestId.js +1 -16
- package/lib/commonjs/network/utils/resolveRequestUrl.js +1 -15
- package/lib/commonjs/network/utils/selectSavedEvents.js +1 -39
- package/lib/commonjs/network/utils/startNetworkCapture.js +1 -24
- package/lib/commonjs/network/utils/withPinnedFirst.js +1 -32
- package/lib/commonjs/preset.js +1 -93
- package/lib/module/index.js +1 -104
- package/lib/module/index.web.js +1 -82
- package/lib/module/network/components/DataViewer.web.js +1 -875
- package/lib/module/network/components/NetworkCopyScreen.web.js +1 -44
- package/lib/module/network/components/NetworkCopySettingsView.js +27 -750
- package/lib/module/network/components/NetworkCopySettingsView.web.js +14 -1237
- package/lib/module/network/components/NetworkDetailScreen.web.js +1 -97
- package/lib/module/network/components/NetworkDetailStepper.js +1 -104
- package/lib/module/network/components/NetworkDetailStepper.web.js +1 -296
- package/lib/module/network/components/NetworkEventDetailView.js +15 -1129
- package/lib/module/network/components/NetworkEventDetailView.web.js +15 -1482
- package/lib/module/network/components/NetworkEventItemCompact.js +2 -398
- package/lib/module/network/components/NetworkEventItemCompact.web.js +2 -818
- package/lib/module/network/components/NetworkFilterScreen.web.js +1 -51
- package/lib/module/network/components/NetworkFilterViewV3.js +1 -438
- package/lib/module/network/components/NetworkFilterViewV3.web.js +1 -1306
- package/lib/module/network/components/NetworkHeaderLive.js +1 -366
- package/lib/module/network/components/NetworkHeaderLive.web.js +1 -617
- package/lib/module/network/components/NetworkHeaderMenu.js +1 -184
- package/lib/module/network/components/NetworkListScreen.js +1 -399
- package/lib/module/network/components/NetworkListScreen.web.js +1 -622
- package/lib/module/network/components/NetworkModal.js +1 -781
- package/lib/module/network/components/NetworkNumberPrompt.js +1 -174
- package/lib/module/network/components/NetworkNumberPrompt.web.js +1 -230
- package/lib/module/network/components/NetworkOverrideEditor.js +1 -811
- package/lib/module/network/components/NetworkOverrideEditor.web.js +1 -939
- package/lib/module/network/components/NetworkOverrideHeaderButton.js +1 -104
- package/lib/module/network/components/NetworkOverrideHeaderButton.web.js +1 -131
- package/lib/module/network/components/NetworkOverridesButton.js +1 -87
- package/lib/module/network/components/NetworkOverridesButton.web.js +1 -141
- package/lib/module/network/components/NetworkOverridesScreen.js +1 -539
- package/lib/module/network/components/NetworkOverridesScreen.web.js +1 -826
- package/lib/module/network/components/NetworkSavedScreen.js +1 -222
- package/lib/module/network/components/NetworkSavedScreen.web.js +1 -461
- package/lib/module/network/components/NetworkUpgradeBanner.js +1 -72
- package/lib/module/network/components/response-editor/Explorer.js +1 -972
- package/lib/module/network/components/response-editor/Explorer.web.js +1 -1133
- package/lib/module/network/components/response-editor/deleteNestedDataByPath.js +1 -51
- package/lib/module/network/components/response-editor/editorContext.js +1 -29
- package/lib/module/network/components/response-editor/updateNestedDataByPath.js +1 -56
- package/lib/module/network/conditions/NetworkConditionsControl.js +1 -231
- package/lib/module/network/conditions/NetworkConditionsControl.test.js +1 -135
- package/lib/module/network/conditions/NetworkConditionsIcon.js +1 -29
- package/lib/module/network/conditions/NetworkFloatingTool.js +1 -304
- package/lib/module/network/conditions/NetworkFloatingTool.test.js +1 -218
- package/lib/module/network/conditions/store.js +1 -65
- package/lib/module/network/conditions/wait.js +1 -38
- package/lib/module/network/conditions/xhr.js +1 -131
- package/lib/module/network/hooks/useLiveNetworkEvent.js +1 -58
- package/lib/module/network/hooks/useNetworkBadgeCounts.js +1 -79
- package/lib/module/network/hooks/useNetworkEventList.js +1 -104
- package/lib/module/network/hooks/useNetworkEvents.js +1 -314
- package/lib/module/network/hooks/useNetworkHasMatches.js +1 -52
- package/lib/module/network/hooks/useNetworkSaved.js +1 -34
- package/lib/module/network/hooks/useNetworkSelection.js +1 -46
- package/lib/module/network/hooks/useOverrideRules.js +1 -32
- package/lib/module/network/hooks/useTickEveryMinute.js +1 -11
- package/lib/module/network/overrides/applyToFetch.js +1 -72
- package/lib/module/network/overrides/applyToXhr.js +2 -502
- package/lib/module/network/overrides/engine.js +1 -85
- package/lib/module/network/overrides/matchRule.js +1 -81
- package/lib/module/network/overrides/overriddenRows.js +1 -33
- package/lib/module/network/overrides/overrideRulesStore.js +1 -547
- package/lib/module/network/overrides/presets.js +1 -65
- package/lib/module/network/overrides/resolveOverride.js +1 -152
- package/lib/module/network/overrides/types.js +1 -86
- package/lib/module/network/sync/networkBodyResolver.js +1 -34
- package/lib/module/network/sync/networkSyncAdapter.js +1 -880
- package/lib/module/network/sync/overrideHonesty.release.test.js +1 -35
- package/lib/module/network/types/index.js +1 -3
- package/lib/module/network/utils/extractOperationName.js +1 -76
- package/lib/module/network/utils/filterNetworkEvents.js +1 -92
- package/lib/module/network/utils/formatGraphQLVariables.js +1 -213
- package/lib/module/network/utils/formatting.js +1 -9
- package/lib/module/network/utils/generateCurl.js +2 -67
- package/lib/module/network/utils/generateNetworkCopyText.js +37 -162
- package/lib/module/network/utils/httpCompletion.js +1 -32
- package/lib/module/network/utils/networkEventStore.js +1 -409
- package/lib/module/network/utils/networkListener.js +4 -1341
- package/lib/module/network/utils/networkSavedStore.js +3 -572
- package/lib/module/network/utils/networkSelectionStore.js +1 -188
- package/lib/module/network/utils/realNow.js +1 -0
- package/lib/module/network/utils/requestId.js +1 -12
- package/lib/module/network/utils/resolveRequestUrl.js +1 -11
- package/lib/module/network/utils/selectSavedEvents.js +1 -35
- package/lib/module/network/utils/startNetworkCapture.js +1 -21
- package/lib/module/network/utils/withPinnedFirst.js +1 -28
- package/lib/module/preset.js +1 -91
- package/lib/typescript/network/overrides/engine.d.ts +1 -1
- package/lib/typescript/network/overrides/matchRule.d.ts +1 -1
- package/lib/typescript/network/overrides/resolveOverride.d.ts +2 -2
- package/lib/typescript/network/overrides/types.d.ts +9 -0
- package/lib/typescript/network/utils/networkListener.d.ts +11 -0
- package/lib/typescript/network/utils/realNow.d.ts +18 -0
- package/lib/web/index.mjs +73 -74
- package/package.json +3 -6
- package/lib/typescript/index.d.ts.map +0 -1
- package/lib/typescript/index.web.d.ts.map +0 -1
- package/lib/typescript/network/components/DataViewer.web.d.ts.map +0 -1
- package/lib/typescript/network/components/NetworkCopyScreen.web.d.ts.map +0 -1
- package/lib/typescript/network/components/NetworkCopySettingsView.d.ts.map +0 -1
- package/lib/typescript/network/components/NetworkCopySettingsView.web.d.ts.map +0 -1
- package/lib/typescript/network/components/NetworkDetailScreen.web.d.ts.map +0 -1
- package/lib/typescript/network/components/NetworkDetailStepper.d.ts.map +0 -1
- package/lib/typescript/network/components/NetworkDetailStepper.web.d.ts.map +0 -1
- package/lib/typescript/network/components/NetworkEventDetailView.d.ts.map +0 -1
- package/lib/typescript/network/components/NetworkEventDetailView.web.d.ts.map +0 -1
- package/lib/typescript/network/components/NetworkEventItemCompact.d.ts.map +0 -1
- package/lib/typescript/network/components/NetworkEventItemCompact.web.d.ts.map +0 -1
- package/lib/typescript/network/components/NetworkFilterScreen.web.d.ts.map +0 -1
- package/lib/typescript/network/components/NetworkFilterViewV3.d.ts.map +0 -1
- package/lib/typescript/network/components/NetworkFilterViewV3.web.d.ts.map +0 -1
- package/lib/typescript/network/components/NetworkHeaderLive.d.ts.map +0 -1
- package/lib/typescript/network/components/NetworkHeaderLive.web.d.ts.map +0 -1
- package/lib/typescript/network/components/NetworkHeaderMenu.d.ts.map +0 -1
- package/lib/typescript/network/components/NetworkListScreen.d.ts.map +0 -1
- package/lib/typescript/network/components/NetworkListScreen.web.d.ts.map +0 -1
- package/lib/typescript/network/components/NetworkModal.d.ts.map +0 -1
- package/lib/typescript/network/components/NetworkNumberPrompt.d.ts.map +0 -1
- package/lib/typescript/network/components/NetworkNumberPrompt.web.d.ts.map +0 -1
- package/lib/typescript/network/components/NetworkOverrideEditor.d.ts.map +0 -1
- package/lib/typescript/network/components/NetworkOverrideEditor.web.d.ts.map +0 -1
- package/lib/typescript/network/components/NetworkOverrideHeaderButton.d.ts.map +0 -1
- package/lib/typescript/network/components/NetworkOverrideHeaderButton.web.d.ts.map +0 -1
- package/lib/typescript/network/components/NetworkOverridesButton.d.ts.map +0 -1
- package/lib/typescript/network/components/NetworkOverridesButton.web.d.ts.map +0 -1
- package/lib/typescript/network/components/NetworkOverridesScreen.d.ts.map +0 -1
- package/lib/typescript/network/components/NetworkOverridesScreen.web.d.ts.map +0 -1
- package/lib/typescript/network/components/NetworkSavedScreen.d.ts.map +0 -1
- package/lib/typescript/network/components/NetworkSavedScreen.web.d.ts.map +0 -1
- package/lib/typescript/network/components/NetworkUpgradeBanner.d.ts.map +0 -1
- package/lib/typescript/network/components/response-editor/Explorer.d.ts.map +0 -1
- package/lib/typescript/network/components/response-editor/Explorer.web.d.ts.map +0 -1
- package/lib/typescript/network/components/response-editor/deleteNestedDataByPath.d.ts.map +0 -1
- package/lib/typescript/network/components/response-editor/editorContext.d.ts.map +0 -1
- package/lib/typescript/network/components/response-editor/updateNestedDataByPath.d.ts.map +0 -1
- package/lib/typescript/network/conditions/NetworkConditionsControl.d.ts.map +0 -1
- package/lib/typescript/network/conditions/NetworkConditionsControl.test.d.ts.map +0 -1
- package/lib/typescript/network/conditions/NetworkConditionsIcon.d.ts.map +0 -1
- package/lib/typescript/network/conditions/NetworkFloatingTool.d.ts.map +0 -1
- package/lib/typescript/network/conditions/NetworkFloatingTool.test.d.ts.map +0 -1
- package/lib/typescript/network/conditions/store.d.ts.map +0 -1
- package/lib/typescript/network/conditions/wait.d.ts.map +0 -1
- package/lib/typescript/network/conditions/xhr.d.ts.map +0 -1
- package/lib/typescript/network/hooks/useLiveNetworkEvent.d.ts.map +0 -1
- package/lib/typescript/network/hooks/useNetworkBadgeCounts.d.ts.map +0 -1
- package/lib/typescript/network/hooks/useNetworkEventList.d.ts.map +0 -1
- package/lib/typescript/network/hooks/useNetworkEvents.d.ts.map +0 -1
- package/lib/typescript/network/hooks/useNetworkHasMatches.d.ts.map +0 -1
- package/lib/typescript/network/hooks/useNetworkSaved.d.ts.map +0 -1
- package/lib/typescript/network/hooks/useNetworkSelection.d.ts.map +0 -1
- package/lib/typescript/network/hooks/useOverrideRules.d.ts.map +0 -1
- package/lib/typescript/network/hooks/useTickEveryMinute.d.ts.map +0 -1
- package/lib/typescript/network/overrides/applyToFetch.d.ts.map +0 -1
- package/lib/typescript/network/overrides/applyToXhr.d.ts.map +0 -1
- package/lib/typescript/network/overrides/engine.d.ts.map +0 -1
- package/lib/typescript/network/overrides/matchRule.d.ts.map +0 -1
- package/lib/typescript/network/overrides/overriddenRows.d.ts.map +0 -1
- package/lib/typescript/network/overrides/overrideRulesStore.d.ts.map +0 -1
- package/lib/typescript/network/overrides/presets.d.ts.map +0 -1
- package/lib/typescript/network/overrides/resolveOverride.d.ts.map +0 -1
- package/lib/typescript/network/overrides/types.d.ts.map +0 -1
- package/lib/typescript/network/sync/networkBodyResolver.d.ts.map +0 -1
- package/lib/typescript/network/sync/networkSyncAdapter.d.ts.map +0 -1
- package/lib/typescript/network/sync/overrideHonesty.release.test.d.ts.map +0 -1
- package/lib/typescript/network/types/index.d.ts.map +0 -1
- package/lib/typescript/network/utils/extractOperationName.d.ts.map +0 -1
- package/lib/typescript/network/utils/filterNetworkEvents.d.ts.map +0 -1
- package/lib/typescript/network/utils/formatGraphQLVariables.d.ts.map +0 -1
- package/lib/typescript/network/utils/formatting.d.ts.map +0 -1
- package/lib/typescript/network/utils/generateCurl.d.ts.map +0 -1
- package/lib/typescript/network/utils/generateNetworkCopyText.d.ts.map +0 -1
- package/lib/typescript/network/utils/httpCompletion.d.ts.map +0 -1
- package/lib/typescript/network/utils/networkEventStore.d.ts.map +0 -1
- package/lib/typescript/network/utils/networkListener.d.ts.map +0 -1
- package/lib/typescript/network/utils/networkSavedStore.d.ts.map +0 -1
- package/lib/typescript/network/utils/networkSelectionStore.d.ts.map +0 -1
- package/lib/typescript/network/utils/requestId.d.ts.map +0 -1
- package/lib/typescript/network/utils/resolveRequestUrl.d.ts.map +0 -1
- package/lib/typescript/network/utils/selectSavedEvents.d.ts.map +0 -1
- package/lib/typescript/network/utils/startNetworkCapture.d.ts.map +0 -1
- package/lib/typescript/network/utils/withPinnedFirst.d.ts.map +0 -1
- package/lib/typescript/preset.d.ts.map +0 -1
|
@@ -1,875 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* DataViewer.web — DOM twin of the shared-ui data-viewer stack, exactly as the
|
|
5
|
-
* network DETAIL view consumes it (`rawMode` + type-filter legend +
|
|
6
|
-
* `initialExpanded`). The web shim exposes none of this chrome, so it is
|
|
7
|
-
* replicated here as DOM with provenance:
|
|
8
|
-
*
|
|
9
|
-
* - `DataViewer` — shared/src/dataViewer/DataViewer.tsx (type-filter chips +
|
|
10
|
-
* the `flattenByType` filtered projection, algorithms copied verbatim).
|
|
11
|
-
* - Tree rows — shared/src/dataViewer/VirtualizedDataExplorer.tsx, rawMode
|
|
12
|
-
* path: synthetic "root" row, 24px rows, 16px indent per depth, chevron
|
|
13
|
-
* expander, `key:` in monospace, values colored by type
|
|
14
|
-
* (macOSColors.dataTypes via the gameUIColors macOS theme), expandable rows
|
|
15
|
-
* reading "object (3 items)", per-row copy button, MAX_ITEMS_PER_LEVEL 500 /
|
|
16
|
-
* MAX_DEPTH_LIMIT 15 caps and the circular-reference guard.
|
|
17
|
-
* - Indent guides — shared/src/dataViewer/IndentGuidesOverlay.tsx (same
|
|
18
|
-
* segment computation, 1px lines at (depth-0.5)*16, primary @ ~30% alpha).
|
|
19
|
-
* - Type chips — shared/src/dataViewer/TypeLegend.tsx (`getTypeColor` copied
|
|
20
|
-
* verbatim).
|
|
21
|
-
* - `CopyButton` / `InlineCopyButton` — shared/src/ui/components/
|
|
22
|
-
* CopyButton.tsx: idle/success/error states, 1500ms feedback, lazy function
|
|
23
|
-
* values resolved at press time, object values pretty-printed (2-space,
|
|
24
|
-
* circular-safe — clipboard/copyToClipboard.ts's safeStringify semantics).
|
|
25
|
-
*
|
|
26
|
-
* Intentional deviations (all logged):
|
|
27
|
-
* - FlatList virtualization + the chunked/debounced async flatten
|
|
28
|
-
* ("Processing data…") → a synchronous flatten over plain DOM rows. The
|
|
29
|
-
* same 500-per-level/15-deep caps bound the work, and web rows are cheap;
|
|
30
|
-
* the settle-window in `networkSelectionStore` (see `showBodies` on the
|
|
31
|
-
* detail view) is what keeps stepping fast, exactly as on native.
|
|
32
|
-
* - Row selection / double-tap inline editing / `DataTreeActionBar` are NOT
|
|
33
|
-
* ported — that is the response-EDITOR surface (overrides), a later port
|
|
34
|
-
* feature. Read-only rows toggle expansion on press, as native does when no
|
|
35
|
-
* `onSelectionChange` is wired.
|
|
36
|
-
* - `CopyButton`'s Pro upgrade modal + first-copy hint banner are not ported
|
|
37
|
-
* (license gating isn't part of the web port); `disableCopy` is accepted
|
|
38
|
-
* for API compatibility and ignored, same as the native explorer.
|
|
39
|
-
* - `displayValue`'s minimal-SuperJSON serialization → JSON.stringify; for
|
|
40
|
-
* the JSON payloads this tool renders the output is identical.
|
|
41
|
-
*
|
|
42
|
-
* @platform React DOM Web
|
|
43
|
-
*/
|
|
44
|
-
|
|
45
|
-
import { memo, useEffect, useMemo, useRef, useState } from "react";
|
|
46
|
-
|
|
47
|
-
// =============================
|
|
48
|
-
// Native palettes (provenance)
|
|
49
|
-
// =============================
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* gameUIColors, macOS theme — shared/src/ui/gameUI/constants/gameUIColors.ts
|
|
53
|
-
* resolves to `macOSGameUIColors` (macOSDesignSystemColors.ts), verbatim
|
|
54
|
-
* subset. `primary`/`primaryLight` are the macOS text primary, NOT white.
|
|
55
|
-
*/
|
|
56
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
57
|
-
const gameUI = {
|
|
58
|
-
primary: "#F5F5F7",
|
|
59
|
-
// macOSColors.text.primary
|
|
60
|
-
primaryLight: "#F5F5F7",
|
|
61
|
-
secondary: "#A1A1A6",
|
|
62
|
-
// macOSColors.text.secondary
|
|
63
|
-
muted: "#8E8E93",
|
|
64
|
-
success: "#34C759",
|
|
65
|
-
warning: "#FFEB3B",
|
|
66
|
-
error: "#FF453A",
|
|
67
|
-
info: "#00B8E6",
|
|
68
|
-
critical: "#FF453A",
|
|
69
|
-
// macOS theme maps critical → semantic.error
|
|
70
|
-
optional: "#BF5AF2",
|
|
71
|
-
// macOS theme maps optional → semantic.debug
|
|
72
|
-
dataTypes: {
|
|
73
|
-
object: "#00B8E6",
|
|
74
|
-
array: "#FFEB3B",
|
|
75
|
-
string: "#34C759",
|
|
76
|
-
number: "#FF9F0A",
|
|
77
|
-
boolean: "#BF5AF2",
|
|
78
|
-
function: "#5E5CE6",
|
|
79
|
-
undefined: "#8E8E93",
|
|
80
|
-
null: "#FF453A"
|
|
81
|
-
}
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
/** macOSColors subset — shared/src/ui/gameUI/constants/macOSDesignSystemColors.ts, verbatim. */
|
|
85
|
-
const macOSColors = {
|
|
86
|
-
background: {
|
|
87
|
-
hover: "#1D1D1F",
|
|
88
|
-
input: "#26262A"
|
|
89
|
-
},
|
|
90
|
-
text: {
|
|
91
|
-
primary: "#F5F5F7",
|
|
92
|
-
secondary: "#A1A1A6"
|
|
93
|
-
},
|
|
94
|
-
semantic: {
|
|
95
|
-
error: "#FF453A",
|
|
96
|
-
debug: "#BF5AF2"
|
|
97
|
-
}
|
|
98
|
-
};
|
|
99
|
-
|
|
100
|
-
// Stable constants — VirtualizedDataExplorer.tsx, verbatim.
|
|
101
|
-
const ITEM_HEIGHT = 24;
|
|
102
|
-
const MAX_DEPTH_LIMIT = 15;
|
|
103
|
-
const MAX_ITEMS_PER_LEVEL = 500;
|
|
104
|
-
const INDENT_WIDTH = 16;
|
|
105
|
-
/** IndentGuidesOverlay.tsx — ~30% alpha on the primary color. */
|
|
106
|
-
const GUIDE_ALPHA = "4D";
|
|
107
|
-
|
|
108
|
-
// =============================
|
|
109
|
-
// Inline lucide icons (shared-ui icons are lucide re-exports)
|
|
110
|
-
// =============================
|
|
111
|
-
|
|
112
|
-
function Svg({
|
|
113
|
-
size = 14,
|
|
114
|
-
color = "currentColor",
|
|
115
|
-
style,
|
|
116
|
-
children
|
|
117
|
-
}) {
|
|
118
|
-
return /*#__PURE__*/_jsx("svg", {
|
|
119
|
-
width: size,
|
|
120
|
-
height: size,
|
|
121
|
-
viewBox: "0 0 24 24",
|
|
122
|
-
fill: "none",
|
|
123
|
-
stroke: color,
|
|
124
|
-
strokeWidth: 2,
|
|
125
|
-
strokeLinecap: "round",
|
|
126
|
-
strokeLinejoin: "round",
|
|
127
|
-
style: {
|
|
128
|
-
flexShrink: 0,
|
|
129
|
-
display: "block",
|
|
130
|
-
...style
|
|
131
|
-
},
|
|
132
|
-
children: children
|
|
133
|
-
});
|
|
134
|
-
}
|
|
135
|
-
const ChevronRight = p => /*#__PURE__*/_jsx(Svg, {
|
|
136
|
-
...p,
|
|
137
|
-
children: /*#__PURE__*/_jsx("path", {
|
|
138
|
-
d: "m9 18 6-6-6-6"
|
|
139
|
-
})
|
|
140
|
-
});
|
|
141
|
-
const CopyIcon = p => /*#__PURE__*/_jsxs(Svg, {
|
|
142
|
-
...p,
|
|
143
|
-
children: [/*#__PURE__*/_jsx("rect", {
|
|
144
|
-
width: "14",
|
|
145
|
-
height: "14",
|
|
146
|
-
x: "8",
|
|
147
|
-
y: "8",
|
|
148
|
-
rx: "2",
|
|
149
|
-
ry: "2"
|
|
150
|
-
}), /*#__PURE__*/_jsx("path", {
|
|
151
|
-
d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"
|
|
152
|
-
})]
|
|
153
|
-
});
|
|
154
|
-
const CheckCircle2 = p => /*#__PURE__*/_jsxs(Svg, {
|
|
155
|
-
...p,
|
|
156
|
-
children: [/*#__PURE__*/_jsx("circle", {
|
|
157
|
-
cx: "12",
|
|
158
|
-
cy: "12",
|
|
159
|
-
r: "10"
|
|
160
|
-
}), /*#__PURE__*/_jsx("path", {
|
|
161
|
-
d: "m9 12 2 2 4-4"
|
|
162
|
-
})]
|
|
163
|
-
});
|
|
164
|
-
const AlertTriangle = p => /*#__PURE__*/_jsxs(Svg, {
|
|
165
|
-
...p,
|
|
166
|
-
children: [/*#__PURE__*/_jsx("path", {
|
|
167
|
-
d: "m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 20h16a2 2 0 0 0 1.73-2Z"
|
|
168
|
-
}), /*#__PURE__*/_jsx("path", {
|
|
169
|
-
d: "M12 9v4"
|
|
170
|
-
}), /*#__PURE__*/_jsx("path", {
|
|
171
|
-
d: "M12 17h.01"
|
|
172
|
-
})]
|
|
173
|
-
});
|
|
174
|
-
|
|
175
|
-
// =============================
|
|
176
|
-
// CopyButton twin (shared/src/ui/components/CopyButton.tsx)
|
|
177
|
-
// =============================
|
|
178
|
-
|
|
179
|
-
/**
|
|
180
|
-
* Circular-safe pretty printer — clipboard/copyToClipboard.ts semantics
|
|
181
|
-
* (strings pass through; objects pretty-print at 2 spaces; everything else is
|
|
182
|
-
* stringified). safeStringify's cycle guard is a WeakSet replacer here.
|
|
183
|
-
*/
|
|
184
|
-
function stringifyForClipboard(value) {
|
|
185
|
-
if (typeof value === "string") return value;
|
|
186
|
-
if (typeof value === "object" && value !== null) {
|
|
187
|
-
const seen = new WeakSet();
|
|
188
|
-
try {
|
|
189
|
-
return JSON.stringify(value, (_key, v) => {
|
|
190
|
-
if (typeof v === "object" && v !== null) {
|
|
191
|
-
if (seen.has(v)) return "[Circular]";
|
|
192
|
-
seen.add(v);
|
|
193
|
-
}
|
|
194
|
-
if (typeof v === "bigint") return `${v}n`;
|
|
195
|
-
return v;
|
|
196
|
-
}, 2);
|
|
197
|
-
} catch {
|
|
198
|
-
return String(value);
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
return String(value);
|
|
202
|
-
}
|
|
203
|
-
/**
|
|
204
|
-
* Copy button with idle/success/error feedback (1500ms), same icon set and
|
|
205
|
-
* state colors as native. No Pro modal / hint banner — see the deviations log.
|
|
206
|
-
*/
|
|
207
|
-
export const CopyButton = /*#__PURE__*/memo(function CopyButton({
|
|
208
|
-
value,
|
|
209
|
-
size = 16,
|
|
210
|
-
buttonStyle,
|
|
211
|
-
colors = {},
|
|
212
|
-
"aria-label": ariaLabel
|
|
213
|
-
}) {
|
|
214
|
-
const [copyState, setCopyState] = useState("idle");
|
|
215
|
-
const valueRef = useRef(value);
|
|
216
|
-
valueRef.current = value;
|
|
217
|
-
const timeoutRef = useRef(null);
|
|
218
|
-
useEffect(() => () => {
|
|
219
|
-
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
220
|
-
}, []);
|
|
221
|
-
const settle = state => {
|
|
222
|
-
setCopyState(state);
|
|
223
|
-
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
224
|
-
// 1500ms — native `feedbackDuration` default.
|
|
225
|
-
timeoutRef.current = setTimeout(() => {
|
|
226
|
-
setCopyState("idle");
|
|
227
|
-
timeoutRef.current = null;
|
|
228
|
-
}, 1500);
|
|
229
|
-
};
|
|
230
|
-
const handlePress = async () => {
|
|
231
|
-
try {
|
|
232
|
-
const resolved = typeof valueRef.current === "function" ? valueRef.current() : valueRef.current;
|
|
233
|
-
await navigator.clipboard.writeText(stringifyForClipboard(resolved));
|
|
234
|
-
settle("success");
|
|
235
|
-
} catch {
|
|
236
|
-
settle("error");
|
|
237
|
-
}
|
|
238
|
-
};
|
|
239
|
-
const color = copyState === "success" ? colors.success || gameUI.success : copyState === "error" ? colors.error || gameUI.error : colors.idle || gameUI.secondary;
|
|
240
|
-
return /*#__PURE__*/_jsx("button", {
|
|
241
|
-
type: "button",
|
|
242
|
-
onClick: copyState === "idle" ? handlePress : undefined,
|
|
243
|
-
"aria-label": ariaLabel ?? (copyState === "idle" ? "Copy to clipboard" : copyState === "success" ? "Copied to clipboard" : "Failed to copy"),
|
|
244
|
-
style: {
|
|
245
|
-
...copyStyles.button,
|
|
246
|
-
...buttonStyle
|
|
247
|
-
},
|
|
248
|
-
children: copyState === "success" ? /*#__PURE__*/_jsx(CheckCircle2, {
|
|
249
|
-
size: size,
|
|
250
|
-
color: color
|
|
251
|
-
}) : copyState === "error" ? /*#__PURE__*/_jsx(AlertTriangle, {
|
|
252
|
-
size: size,
|
|
253
|
-
color: color
|
|
254
|
-
}) : /*#__PURE__*/_jsx(CopyIcon, {
|
|
255
|
-
size: size,
|
|
256
|
-
color: color
|
|
257
|
-
})
|
|
258
|
-
});
|
|
259
|
-
});
|
|
260
|
-
|
|
261
|
-
/** Preset copy button for inline use (smaller size) — native `InlineCopyButton`. */
|
|
262
|
-
export const InlineCopyButton = /*#__PURE__*/memo(function InlineCopyButton(props) {
|
|
263
|
-
return /*#__PURE__*/_jsx(CopyButton, {
|
|
264
|
-
size: 12,
|
|
265
|
-
...props
|
|
266
|
-
});
|
|
267
|
-
});
|
|
268
|
-
const copyStyles = {
|
|
269
|
-
// Native CopyButton `styles.button`, verbatim.
|
|
270
|
-
button: {
|
|
271
|
-
display: "inline-flex",
|
|
272
|
-
padding: 4,
|
|
273
|
-
justifyContent: "center",
|
|
274
|
-
alignItems: "center",
|
|
275
|
-
background: "none",
|
|
276
|
-
border: "none",
|
|
277
|
-
cursor: "pointer",
|
|
278
|
-
margin: 0
|
|
279
|
-
}
|
|
280
|
-
};
|
|
281
|
-
|
|
282
|
-
// =============================
|
|
283
|
-
// Tree flattening (VirtualizedDataExplorer.tsx, verbatim algorithm minus the
|
|
284
|
-
// chunked async yields — see the deviations log)
|
|
285
|
-
// =============================
|
|
286
|
-
|
|
287
|
-
const getValueType = value => {
|
|
288
|
-
if (value === null) return "null";
|
|
289
|
-
if (value === undefined) return "undefined";
|
|
290
|
-
if (Array.isArray(value)) return "array";
|
|
291
|
-
if (value instanceof Date) return "date";
|
|
292
|
-
if (value instanceof Error) return "error";
|
|
293
|
-
if (value instanceof Map) return "map";
|
|
294
|
-
if (value instanceof Set) return "set";
|
|
295
|
-
if (value instanceof RegExp) return "regexp";
|
|
296
|
-
if (typeof value === "function") return "function";
|
|
297
|
-
if (typeof value === "symbol") return "symbol";
|
|
298
|
-
if (typeof value === "bigint") return "bigint";
|
|
299
|
-
if (typeof value === "object") return "object";
|
|
300
|
-
return typeof value;
|
|
301
|
-
};
|
|
302
|
-
const getValueCount = (value, valueType) => {
|
|
303
|
-
if (value === null) return 0;
|
|
304
|
-
switch (valueType) {
|
|
305
|
-
case "array":
|
|
306
|
-
return Array.isArray(value) ? value.length : 0;
|
|
307
|
-
case "object":
|
|
308
|
-
return typeof value === "object" ? Object.keys(value).length : 0;
|
|
309
|
-
case "map":
|
|
310
|
-
return value instanceof Map ? value.size : 0;
|
|
311
|
-
case "set":
|
|
312
|
-
return value instanceof Set ? value.size : 0;
|
|
313
|
-
default:
|
|
314
|
-
return 0;
|
|
315
|
-
}
|
|
316
|
-
};
|
|
317
|
-
|
|
318
|
-
// Format value for display — VirtualizedDataExplorer `formatValue`, verbatim
|
|
319
|
-
// (default branch: displayValue → JSON.stringify, see deviations).
|
|
320
|
-
const formatValue = (value, valueType) => {
|
|
321
|
-
if (value === null) return "null";
|
|
322
|
-
if (value === undefined) return "undefined";
|
|
323
|
-
switch (valueType) {
|
|
324
|
-
case "string":
|
|
325
|
-
return `"${String(value)}"`;
|
|
326
|
-
case "boolean":
|
|
327
|
-
return value === true ? "true" : "false";
|
|
328
|
-
case "function":
|
|
329
|
-
return typeof value === "function" ? value.toString().slice(0, 50) + "..." : "undefined";
|
|
330
|
-
case "symbol":
|
|
331
|
-
return typeof value === "symbol" ? String(value) : "undefined";
|
|
332
|
-
case "date":
|
|
333
|
-
return value instanceof Date ? value.toISOString() : "undefined";
|
|
334
|
-
case "regexp":
|
|
335
|
-
return value instanceof RegExp ? value.toString() : "undefined";
|
|
336
|
-
case "bigint":
|
|
337
|
-
return typeof value === "bigint" ? value.toString() + "n" : "undefined";
|
|
338
|
-
case "error":
|
|
339
|
-
return value instanceof Error ? `${value.name}: ${value.message}` : "undefined";
|
|
340
|
-
default:
|
|
341
|
-
try {
|
|
342
|
-
return JSON.stringify(value) ?? String(value);
|
|
343
|
-
} catch {
|
|
344
|
-
return String(value);
|
|
345
|
-
}
|
|
346
|
-
}
|
|
347
|
-
};
|
|
348
|
-
|
|
349
|
-
// Type color lookup — VirtualizedDataExplorer TYPE_COLOR_CACHE, verbatim.
|
|
350
|
-
const TYPE_COLOR_CACHE = new Map([["string", gameUI.dataTypes.string], ["number", gameUI.dataTypes.number], ["bigint", gameUI.optional], ["boolean", gameUI.dataTypes.boolean], ["null", gameUI.dataTypes.null], ["undefined", gameUI.dataTypes.undefined], ["function", gameUI.dataTypes.function], ["symbol", gameUI.critical], ["date", gameUI.critical], ["error", gameUI.error], ["array", gameUI.dataTypes.array], ["object", gameUI.dataTypes.object], ["map", gameUI.info], ["set", gameUI.success], ["circular", gameUI.warning]]);
|
|
351
|
-
const getRowTypeColor = valueType => TYPE_COLOR_CACHE.get(valueType) || gameUI.dataTypes.array;
|
|
352
|
-
function flattenData(value, expandedSet, maxDepth, circularCache, key = "root", depth = 0, path = []) {
|
|
353
|
-
if (depth > Math.min(maxDepth, MAX_DEPTH_LIMIT)) return [];
|
|
354
|
-
const currentPath = [...path, key];
|
|
355
|
-
const id = currentPath.join(".");
|
|
356
|
-
const valueType = getValueType(value);
|
|
357
|
-
const isExpandable = ["object", "array", "map", "set"].includes(valueType) && value !== null;
|
|
358
|
-
const childCount = Math.min(isExpandable ? getValueCount(value, valueType) : 0, MAX_ITEMS_PER_LEVEL);
|
|
359
|
-
if (value && typeof value === "object") {
|
|
360
|
-
if (circularCache.has(value)) {
|
|
361
|
-
return [{
|
|
362
|
-
id,
|
|
363
|
-
key,
|
|
364
|
-
value: "[Circular Reference]",
|
|
365
|
-
valueType: "circular",
|
|
366
|
-
depth,
|
|
367
|
-
isExpandable: false,
|
|
368
|
-
isExpanded: false,
|
|
369
|
-
childCount: 0
|
|
370
|
-
}];
|
|
371
|
-
}
|
|
372
|
-
circularCache.add(value);
|
|
373
|
-
}
|
|
374
|
-
const result = [{
|
|
375
|
-
id,
|
|
376
|
-
key,
|
|
377
|
-
value,
|
|
378
|
-
valueType,
|
|
379
|
-
depth,
|
|
380
|
-
isExpandable,
|
|
381
|
-
isExpanded: expandedSet.has(id),
|
|
382
|
-
childCount
|
|
383
|
-
}];
|
|
384
|
-
if (isExpandable && expandedSet.has(id) && depth < Math.min(maxDepth, MAX_DEPTH_LIMIT)) {
|
|
385
|
-
try {
|
|
386
|
-
let entries = [];
|
|
387
|
-
switch (valueType) {
|
|
388
|
-
case "array":
|
|
389
|
-
entries = value.map((item, index) => [index.toString(), item]);
|
|
390
|
-
break;
|
|
391
|
-
case "object":
|
|
392
|
-
entries = Object.entries(value);
|
|
393
|
-
break;
|
|
394
|
-
case "map":
|
|
395
|
-
entries = Array.from(value.entries()).map(([k, v]) => [String(k), v]);
|
|
396
|
-
break;
|
|
397
|
-
case "set":
|
|
398
|
-
entries = Array.from(value.values()).map((v, index) => [index.toString(), v]);
|
|
399
|
-
break;
|
|
400
|
-
}
|
|
401
|
-
for (const [childKey, childValue] of entries.slice(0, childCount)) {
|
|
402
|
-
result.push(...flattenData(childValue, expandedSet, maxDepth, circularCache, childKey, depth + 1, currentPath));
|
|
403
|
-
}
|
|
404
|
-
} catch {
|
|
405
|
-
// Skip malformed data (same silent-skip as native).
|
|
406
|
-
}
|
|
407
|
-
}
|
|
408
|
-
return result;
|
|
409
|
-
}
|
|
410
|
-
|
|
411
|
-
// =============================
|
|
412
|
-
// Indent guides (IndentGuidesOverlay.tsx — same segment computation, drawn
|
|
413
|
-
// over the full list since the web tree isn't virtualized)
|
|
414
|
-
// =============================
|
|
415
|
-
|
|
416
|
-
function IndentGuides({
|
|
417
|
-
items
|
|
418
|
-
}) {
|
|
419
|
-
const columns = useMemo(() => {
|
|
420
|
-
let maxDepth = 0;
|
|
421
|
-
for (const item of items) if (item.depth > maxDepth) maxDepth = item.depth;
|
|
422
|
-
const results = [];
|
|
423
|
-
for (let depth = 1; depth <= maxDepth; depth++) {
|
|
424
|
-
// Center of the indent column, snapped for a crisp 1px line.
|
|
425
|
-
const left = Math.round((depth - 0.5) * INDENT_WIDTH) + 0.5;
|
|
426
|
-
const segments = [];
|
|
427
|
-
let segStart = -1;
|
|
428
|
-
let segEnd = -1;
|
|
429
|
-
for (let i = 0; i < items.length; i++) {
|
|
430
|
-
if ((items[i]?.depth ?? 0) >= depth) {
|
|
431
|
-
if (segStart === -1) segStart = i;
|
|
432
|
-
segEnd = i;
|
|
433
|
-
} else if (segStart !== -1) {
|
|
434
|
-
segments.push({
|
|
435
|
-
startIndex: segStart,
|
|
436
|
-
endIndex: segEnd
|
|
437
|
-
});
|
|
438
|
-
segStart = -1;
|
|
439
|
-
segEnd = -1;
|
|
440
|
-
}
|
|
441
|
-
}
|
|
442
|
-
if (segStart !== -1) segments.push({
|
|
443
|
-
startIndex: segStart,
|
|
444
|
-
endIndex: segEnd
|
|
445
|
-
});
|
|
446
|
-
if (segments.length > 0) results.push({
|
|
447
|
-
depth,
|
|
448
|
-
left,
|
|
449
|
-
segments
|
|
450
|
-
});
|
|
451
|
-
}
|
|
452
|
-
return results;
|
|
453
|
-
}, [items]);
|
|
454
|
-
return /*#__PURE__*/_jsx("div", {
|
|
455
|
-
style: styles.guidesOverlay,
|
|
456
|
-
"aria-hidden": true,
|
|
457
|
-
children: columns.map(col => col.segments.map((seg, idx) => /*#__PURE__*/_jsx("div", {
|
|
458
|
-
style: {
|
|
459
|
-
...styles.guideLine,
|
|
460
|
-
left: col.left,
|
|
461
|
-
top: seg.startIndex * ITEM_HEIGHT,
|
|
462
|
-
height: (seg.endIndex - seg.startIndex + 1) * ITEM_HEIGHT,
|
|
463
|
-
backgroundColor: `${gameUI.primary}${GUIDE_ALPHA}`
|
|
464
|
-
}
|
|
465
|
-
}, `${col.depth}-${idx}`)))
|
|
466
|
-
});
|
|
467
|
-
}
|
|
468
|
-
|
|
469
|
-
// =============================
|
|
470
|
-
// Tree row (VirtualizedItemComponent, read-only mode)
|
|
471
|
-
// =============================
|
|
472
|
-
|
|
473
|
-
const TreeRow = /*#__PURE__*/memo(function TreeRow({
|
|
474
|
-
item,
|
|
475
|
-
onToggleExpanded
|
|
476
|
-
}) {
|
|
477
|
-
const [isPressed, setIsPressed] = useState(false);
|
|
478
|
-
const color = getRowTypeColor(item.valueType);
|
|
479
|
-
return /*#__PURE__*/_jsxs("div", {
|
|
480
|
-
style: {
|
|
481
|
-
...styles.itemContainer,
|
|
482
|
-
marginLeft: item.depth * INDENT_WIDTH
|
|
483
|
-
},
|
|
484
|
-
children: [/*#__PURE__*/_jsxs("button", {
|
|
485
|
-
type: "button",
|
|
486
|
-
style: {
|
|
487
|
-
...styles.itemTouchable,
|
|
488
|
-
...(isPressed ? styles.itemTouchablePressed : null),
|
|
489
|
-
cursor: item.isExpandable ? "pointer" : "default"
|
|
490
|
-
},
|
|
491
|
-
onClick: item.isExpandable ? () => onToggleExpanded(item.id) : undefined,
|
|
492
|
-
onPointerDown: () => setIsPressed(true),
|
|
493
|
-
onPointerUp: () => setIsPressed(false),
|
|
494
|
-
onPointerLeave: () => setIsPressed(false),
|
|
495
|
-
disabled: !item.isExpandable,
|
|
496
|
-
"aria-expanded": item.isExpandable ? item.isExpanded : undefined,
|
|
497
|
-
children: [/*#__PURE__*/_jsx("span", {
|
|
498
|
-
style: styles.expanderContainer,
|
|
499
|
-
children: item.isExpandable ? /*#__PURE__*/_jsx(ChevronRight, {
|
|
500
|
-
size: 12,
|
|
501
|
-
color: gameUI.secondary,
|
|
502
|
-
style: {
|
|
503
|
-
transform: item.isExpanded ? "rotate(90deg)" : "rotate(0deg)"
|
|
504
|
-
}
|
|
505
|
-
}) : null
|
|
506
|
-
}), /*#__PURE__*/_jsxs("span", {
|
|
507
|
-
style: styles.labelContainer,
|
|
508
|
-
children: [/*#__PURE__*/_jsxs("span", {
|
|
509
|
-
style: styles.labelText,
|
|
510
|
-
children: [item.key, ":"]
|
|
511
|
-
}), item.isExpandable ? /*#__PURE__*/_jsxs("span", {
|
|
512
|
-
style: {
|
|
513
|
-
...styles.valueText,
|
|
514
|
-
color: gameUI.secondary
|
|
515
|
-
},
|
|
516
|
-
children: [item.valueType, " (", item.childCount, " ", item.childCount === 1 ? "item" : "items", ")"]
|
|
517
|
-
}) : /*#__PURE__*/_jsx("span", {
|
|
518
|
-
style: {
|
|
519
|
-
...styles.valueText,
|
|
520
|
-
color
|
|
521
|
-
},
|
|
522
|
-
children: formatValue(item.value, item.valueType)
|
|
523
|
-
})]
|
|
524
|
-
})]
|
|
525
|
-
}), item.value !== undefined ? /*#__PURE__*/_jsx(CopyButton, {
|
|
526
|
-
value: item.value,
|
|
527
|
-
size: 14,
|
|
528
|
-
buttonStyle: {
|
|
529
|
-
marginLeft: 8,
|
|
530
|
-
marginRight: 8
|
|
531
|
-
}
|
|
532
|
-
}) : null]
|
|
533
|
-
});
|
|
534
|
-
});
|
|
535
|
-
|
|
536
|
-
// =============================
|
|
537
|
-
// Raw-mode explorer (VirtualizedDataExplorer rawMode path)
|
|
538
|
-
// =============================
|
|
539
|
-
|
|
540
|
-
function RawExplorer({
|
|
541
|
-
data,
|
|
542
|
-
maxDepth,
|
|
543
|
-
initialExpanded
|
|
544
|
-
}) {
|
|
545
|
-
// Initial expansion — `getInitialExpanded`, verbatim: root + first level.
|
|
546
|
-
const [expandedItems, setExpandedItems] = useState(() => {
|
|
547
|
-
const initial = new Set(["root"]);
|
|
548
|
-
if (initialExpanded && data && typeof data === "object") {
|
|
549
|
-
if (Array.isArray(data)) {
|
|
550
|
-
data.forEach((_, index) => initial.add(`root.${index}`));
|
|
551
|
-
} else {
|
|
552
|
-
Object.keys(data).forEach(key => initial.add(`root.${key}`));
|
|
553
|
-
}
|
|
554
|
-
}
|
|
555
|
-
return initial;
|
|
556
|
-
});
|
|
557
|
-
const flatData = useMemo(() => flattenData(data, expandedItems, maxDepth, new WeakSet()), [data, expandedItems, maxDepth]);
|
|
558
|
-
const toggleExpanded = id => {
|
|
559
|
-
setExpandedItems(prev => {
|
|
560
|
-
const next = new Set(prev);
|
|
561
|
-
if (next.has(id)) next.delete(id);else next.add(id);
|
|
562
|
-
return next;
|
|
563
|
-
});
|
|
564
|
-
};
|
|
565
|
-
const hasData = data !== null && data !== undefined && (typeof data === "string" ? data.length > 0 : typeof data === "number" || typeof data === "boolean" ? true : Array.isArray(data) ? data.length > 0 : typeof data === "object" ? Object.keys(data).length > 0 : false);
|
|
566
|
-
if (!hasData) {
|
|
567
|
-
return /*#__PURE__*/_jsx("div", {
|
|
568
|
-
style: styles.noDataContainer,
|
|
569
|
-
children: /*#__PURE__*/_jsx("span", {
|
|
570
|
-
style: styles.noDataText,
|
|
571
|
-
children: "No data available"
|
|
572
|
-
})
|
|
573
|
-
});
|
|
574
|
-
}
|
|
575
|
-
return /*#__PURE__*/_jsxs("div", {
|
|
576
|
-
style: styles.rawRoot,
|
|
577
|
-
children: [/*#__PURE__*/_jsx(IndentGuides, {
|
|
578
|
-
items: flatData
|
|
579
|
-
}), flatData.map(item => /*#__PURE__*/_jsx(TreeRow, {
|
|
580
|
-
item: item,
|
|
581
|
-
onToggleExpanded: toggleExpanded
|
|
582
|
-
}, item.id))]
|
|
583
|
-
});
|
|
584
|
-
}
|
|
585
|
-
|
|
586
|
-
// =============================
|
|
587
|
-
// Type legend with filter (dataViewer/TypeLegend.tsx)
|
|
588
|
-
// =============================
|
|
589
|
-
|
|
590
|
-
/** Type color mapping — dataViewer/TypeLegend.tsx `getTypeColor`, verbatim. */
|
|
591
|
-
const getLegendTypeColor = type => {
|
|
592
|
-
const colors = {
|
|
593
|
-
string: gameUI.dataTypes.string,
|
|
594
|
-
number: gameUI.dataTypes.number,
|
|
595
|
-
bigint: macOSColors.semantic.debug,
|
|
596
|
-
boolean: gameUI.dataTypes.boolean,
|
|
597
|
-
null: gameUI.dataTypes.null,
|
|
598
|
-
undefined: gameUI.dataTypes.undefined,
|
|
599
|
-
function: gameUI.dataTypes.function,
|
|
600
|
-
symbol: macOSColors.semantic.error,
|
|
601
|
-
date: macOSColors.semantic.error,
|
|
602
|
-
error: macOSColors.semantic.error,
|
|
603
|
-
array: gameUI.dataTypes.array,
|
|
604
|
-
object: gameUI.dataTypes.object
|
|
605
|
-
};
|
|
606
|
-
return colors[type] || macOSColors.text.secondary;
|
|
607
|
-
};
|
|
608
|
-
function TypeLegend({
|
|
609
|
-
types,
|
|
610
|
-
activeFilter,
|
|
611
|
-
onFilterChange
|
|
612
|
-
}) {
|
|
613
|
-
if (types.length === 0) return null;
|
|
614
|
-
return /*#__PURE__*/_jsx("div", {
|
|
615
|
-
style: styles.typeLegend,
|
|
616
|
-
children: types.map(type => {
|
|
617
|
-
const color = getLegendTypeColor(type);
|
|
618
|
-
const isActive = activeFilter === type;
|
|
619
|
-
return /*#__PURE__*/_jsxs("button", {
|
|
620
|
-
type: "button",
|
|
621
|
-
style: {
|
|
622
|
-
...styles.typeBadge,
|
|
623
|
-
...(isActive ? styles.typeBadgeActive : null),
|
|
624
|
-
border: `1px solid ${isActive ? color : macOSColors.text.primary + "1A"}`
|
|
625
|
-
},
|
|
626
|
-
onClick: () => onFilterChange(activeFilter === type ? null : type),
|
|
627
|
-
"aria-label": `Filter by ${type} values`,
|
|
628
|
-
children: [/*#__PURE__*/_jsx("span", {
|
|
629
|
-
style: {
|
|
630
|
-
...styles.typeColor,
|
|
631
|
-
backgroundColor: color
|
|
632
|
-
}
|
|
633
|
-
}), /*#__PURE__*/_jsx("span", {
|
|
634
|
-
style: {
|
|
635
|
-
...styles.typeName,
|
|
636
|
-
...(isActive ? {
|
|
637
|
-
color
|
|
638
|
-
} : null)
|
|
639
|
-
},
|
|
640
|
-
children: type
|
|
641
|
-
})]
|
|
642
|
-
}, type);
|
|
643
|
-
})
|
|
644
|
-
});
|
|
645
|
-
}
|
|
646
|
-
|
|
647
|
-
// =============================
|
|
648
|
-
// DataViewer (dataViewer/DataViewer.tsx)
|
|
649
|
-
// =============================
|
|
650
|
-
|
|
651
|
-
const isPlainObject = value => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
652
|
-
export function DataViewer({
|
|
653
|
-
title: _title,
|
|
654
|
-
data,
|
|
655
|
-
maxDepth = 10,
|
|
656
|
-
rawMode: _rawMode = true,
|
|
657
|
-
showTypeFilter = true,
|
|
658
|
-
initialExpanded = false,
|
|
659
|
-
disableCopy: _disableCopy = false
|
|
660
|
-
}) {
|
|
661
|
-
const [activeFilter, setActiveFilter] = useState(null);
|
|
662
|
-
|
|
663
|
-
// Calculate visible types in the data — DataViewer.tsx, verbatim.
|
|
664
|
-
const visibleTypes = useMemo(() => {
|
|
665
|
-
if (!data || !showTypeFilter) return [];
|
|
666
|
-
const types = [];
|
|
667
|
-
const processValue = (value, depth = 0) => {
|
|
668
|
-
if (depth > 3) return;
|
|
669
|
-
const type = Array.isArray(value) ? "array" : value === null ? "null" : typeof value;
|
|
670
|
-
types.push(type);
|
|
671
|
-
if (type === "object" && isPlainObject(value)) {
|
|
672
|
-
Object.values(value).forEach(v => processValue(v, depth + 1));
|
|
673
|
-
} else if (Array.isArray(value)) {
|
|
674
|
-
value.forEach(v => processValue(v, depth + 1));
|
|
675
|
-
}
|
|
676
|
-
};
|
|
677
|
-
processValue(data);
|
|
678
|
-
return Array.from(new Set(types)).slice(0, 8);
|
|
679
|
-
}, [data, showTypeFilter]);
|
|
680
|
-
|
|
681
|
-
// Filtered projection by type — DataViewer.tsx `flattenByType`, verbatim.
|
|
682
|
-
const getFilteredData = useMemo(() => {
|
|
683
|
-
if (!activeFilter || !data) return null;
|
|
684
|
-
const filteredObject = {};
|
|
685
|
-
let itemCount = 0;
|
|
686
|
-
const flattenByType = (obj, targetType, path = "", depth = 0) => {
|
|
687
|
-
if (depth > 10 || itemCount > 100) return;
|
|
688
|
-
if (Array.isArray(obj)) {
|
|
689
|
-
obj.forEach((item, index) => {
|
|
690
|
-
const currentPath = path ? `${path}[${index}]` : `[${index}]`;
|
|
691
|
-
const itemType = item === null ? "null" : typeof item;
|
|
692
|
-
if (itemType === targetType) {
|
|
693
|
-
filteredObject[currentPath] = item;
|
|
694
|
-
itemCount++;
|
|
695
|
-
}
|
|
696
|
-
if (itemType === "object" && item !== null || Array.isArray(item)) {
|
|
697
|
-
flattenByType(item, targetType, currentPath, depth + 1);
|
|
698
|
-
}
|
|
699
|
-
});
|
|
700
|
-
} else if (obj && typeof obj === "object") {
|
|
701
|
-
Object.entries(obj).forEach(([key, value]) => {
|
|
702
|
-
const currentPath = path ? `${path}.${key}` : key;
|
|
703
|
-
const valueType = Array.isArray(value) ? "array" : value === null ? "null" : typeof value;
|
|
704
|
-
if (valueType === targetType) {
|
|
705
|
-
filteredObject[currentPath] = value;
|
|
706
|
-
itemCount++;
|
|
707
|
-
}
|
|
708
|
-
if (valueType === "object" && value !== null || valueType === "array") {
|
|
709
|
-
flattenByType(value, targetType, currentPath, depth + 1);
|
|
710
|
-
}
|
|
711
|
-
});
|
|
712
|
-
}
|
|
713
|
-
};
|
|
714
|
-
flattenByType(data, activeFilter);
|
|
715
|
-
return {
|
|
716
|
-
filteredObject,
|
|
717
|
-
itemCount
|
|
718
|
-
};
|
|
719
|
-
}, [activeFilter, data]);
|
|
720
|
-
return /*#__PURE__*/_jsxs("div", {
|
|
721
|
-
children: [showTypeFilter && /*#__PURE__*/_jsx("div", {
|
|
722
|
-
style: styles.header,
|
|
723
|
-
children: /*#__PURE__*/_jsx(TypeLegend, {
|
|
724
|
-
types: visibleTypes,
|
|
725
|
-
activeFilter: activeFilter,
|
|
726
|
-
onFilterChange: setActiveFilter
|
|
727
|
-
})
|
|
728
|
-
}), activeFilter && getFilteredData ? /*#__PURE__*/_jsx(RawExplorer, {
|
|
729
|
-
data: getFilteredData.filteredObject,
|
|
730
|
-
maxDepth: maxDepth,
|
|
731
|
-
initialExpanded: initialExpanded
|
|
732
|
-
}) : /*#__PURE__*/_jsx(RawExplorer, {
|
|
733
|
-
data: data,
|
|
734
|
-
maxDepth: maxDepth,
|
|
735
|
-
initialExpanded: initialExpanded
|
|
736
|
-
})]
|
|
737
|
-
});
|
|
738
|
-
}
|
|
739
|
-
|
|
740
|
-
// Values mirror the native StyleSheet blocks 1:1.
|
|
741
|
-
const styles = {
|
|
742
|
-
header: {
|
|
743
|
-
display: "flex",
|
|
744
|
-
flexDirection: "row",
|
|
745
|
-
justifyContent: "space-between",
|
|
746
|
-
alignItems: "center"
|
|
747
|
-
},
|
|
748
|
-
rawRoot: {
|
|
749
|
-
position: "relative"
|
|
750
|
-
},
|
|
751
|
-
guidesOverlay: {
|
|
752
|
-
position: "absolute",
|
|
753
|
-
left: 0,
|
|
754
|
-
right: 0,
|
|
755
|
-
top: 0,
|
|
756
|
-
bottom: 0,
|
|
757
|
-
zIndex: 1,
|
|
758
|
-
pointerEvents: "none"
|
|
759
|
-
},
|
|
760
|
-
guideLine: {
|
|
761
|
-
position: "absolute",
|
|
762
|
-
width: 1
|
|
763
|
-
},
|
|
764
|
-
itemContainer: {
|
|
765
|
-
minHeight: ITEM_HEIGHT,
|
|
766
|
-
height: ITEM_HEIGHT,
|
|
767
|
-
boxSizing: "border-box",
|
|
768
|
-
backgroundColor: "transparent",
|
|
769
|
-
position: "relative",
|
|
770
|
-
display: "flex",
|
|
771
|
-
flexDirection: "row",
|
|
772
|
-
alignItems: "flex-start"
|
|
773
|
-
},
|
|
774
|
-
itemTouchable: {
|
|
775
|
-
flex: 1,
|
|
776
|
-
minWidth: 0,
|
|
777
|
-
display: "flex",
|
|
778
|
-
flexDirection: "row",
|
|
779
|
-
alignItems: "flex-start",
|
|
780
|
-
padding: "2px 16px 2px 0",
|
|
781
|
-
minHeight: ITEM_HEIGHT,
|
|
782
|
-
boxSizing: "border-box",
|
|
783
|
-
background: "none",
|
|
784
|
-
border: "none",
|
|
785
|
-
margin: 0,
|
|
786
|
-
textAlign: "left",
|
|
787
|
-
font: "inherit"
|
|
788
|
-
},
|
|
789
|
-
itemTouchablePressed: {
|
|
790
|
-
backgroundColor: `${gameUI.primary}0A`
|
|
791
|
-
},
|
|
792
|
-
expanderContainer: {
|
|
793
|
-
width: 16,
|
|
794
|
-
display: "inline-flex",
|
|
795
|
-
alignItems: "center",
|
|
796
|
-
justifyContent: "center",
|
|
797
|
-
marginTop: 4,
|
|
798
|
-
flexShrink: 0
|
|
799
|
-
},
|
|
800
|
-
labelContainer: {
|
|
801
|
-
flex: 1,
|
|
802
|
-
minWidth: 0,
|
|
803
|
-
display: "flex",
|
|
804
|
-
flexDirection: "row",
|
|
805
|
-
alignItems: "flex-start",
|
|
806
|
-
paddingLeft: 2
|
|
807
|
-
},
|
|
808
|
-
labelText: {
|
|
809
|
-
color: gameUI.primary,
|
|
810
|
-
fontSize: 12,
|
|
811
|
-
fontWeight: 500,
|
|
812
|
-
fontFamily: "ui-monospace, Menlo, monospace",
|
|
813
|
-
marginRight: 8,
|
|
814
|
-
flexShrink: 1,
|
|
815
|
-
whiteSpace: "nowrap",
|
|
816
|
-
overflow: "hidden",
|
|
817
|
-
textOverflow: "ellipsis"
|
|
818
|
-
},
|
|
819
|
-
valueText: {
|
|
820
|
-
fontSize: 12,
|
|
821
|
-
fontFamily: "ui-monospace, Menlo, monospace",
|
|
822
|
-
flex: 1,
|
|
823
|
-
minWidth: 0,
|
|
824
|
-
color: gameUI.primaryLight,
|
|
825
|
-
whiteSpace: "nowrap",
|
|
826
|
-
overflow: "hidden",
|
|
827
|
-
textOverflow: "ellipsis"
|
|
828
|
-
},
|
|
829
|
-
noDataContainer: {
|
|
830
|
-
display: "flex",
|
|
831
|
-
flex: 1,
|
|
832
|
-
justifyContent: "center",
|
|
833
|
-
alignItems: "center",
|
|
834
|
-
padding: 20
|
|
835
|
-
},
|
|
836
|
-
noDataText: {
|
|
837
|
-
color: gameUI.secondary,
|
|
838
|
-
fontSize: 12
|
|
839
|
-
},
|
|
840
|
-
// dataViewer/TypeLegend.tsx styles, verbatim.
|
|
841
|
-
typeLegend: {
|
|
842
|
-
display: "flex",
|
|
843
|
-
flexDirection: "row",
|
|
844
|
-
flexWrap: "wrap",
|
|
845
|
-
gap: 6,
|
|
846
|
-
width: "100%",
|
|
847
|
-
padding: 8,
|
|
848
|
-
boxSizing: "border-box"
|
|
849
|
-
},
|
|
850
|
-
typeBadge: {
|
|
851
|
-
display: "inline-flex",
|
|
852
|
-
flexDirection: "row",
|
|
853
|
-
alignItems: "center",
|
|
854
|
-
backgroundColor: macOSColors.background.hover,
|
|
855
|
-
padding: "4px 8px",
|
|
856
|
-
borderRadius: 12,
|
|
857
|
-
cursor: "pointer",
|
|
858
|
-
margin: 0
|
|
859
|
-
},
|
|
860
|
-
typeBadgeActive: {
|
|
861
|
-
backgroundColor: macOSColors.background.input
|
|
862
|
-
},
|
|
863
|
-
typeColor: {
|
|
864
|
-
width: 8,
|
|
865
|
-
height: 8,
|
|
866
|
-
borderRadius: 4,
|
|
867
|
-
marginRight: 6,
|
|
868
|
-
display: "inline-block"
|
|
869
|
-
},
|
|
870
|
-
typeName: {
|
|
871
|
-
color: macOSColors.text.secondary,
|
|
872
|
-
fontSize: 11,
|
|
873
|
-
fontWeight: 500
|
|
874
|
-
}
|
|
875
|
-
};
|
|
1
|
+
"use strict";import{memo as M,useEffect as _,useMemo as j,useRef as R,useState as I}from"react";import{jsx as i,jsxs as m}from"react/jsx-runtime";const r={primary:"#F5F5F7",primaryLight:"#F5F5F7",secondary:"#A1A1A6",muted:"#8E8E93",success:"#34C759",warning:"#FFEB3B",error:"#FF453A",info:"#00B8E6",critical:"#FF453A",optional:"#BF5AF2",dataTypes:{object:"#00B8E6",array:"#FFEB3B",string:"#34C759",number:"#FF9F0A",boolean:"#BF5AF2",function:"#5E5CE6",undefined:"#8E8E93",null:"#FF453A"}};const A={background:{hover:"#1D1D1F",input:"#26262A"},text:{primary:"#F5F5F7",secondary:"#A1A1A6"},semantic:{error:"#FF453A",debug:"#BF5AF2"}};const F=24;const B=15;const P=500;const L=16;const z="4D";function k({size:e=14,color:n="currentColor",style:s,children:t}){return i("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:n,strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0,display:"block",...s},children:t})}const W=e=>i(k,{...e,children:i("path",{d:"m9 18 6-6-6-6"})});const H=e=>m(k,{...e,children:[i("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),i("path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"})]});const V=e=>m(k,{...e,children:[i("circle",{cx:"12",cy:"12",r:"10"}),i("path",{d:"m9 12 2 2 4-4"})]});const N=e=>m(k,{...e,children:[i("path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 20h16a2 2 0 0 0 1.73-2Z"}),i("path",{d:"M12 9v4"}),i("path",{d:"M12 17h.01"})]});function G(e){if(typeof e==="string")return e;if(typeof e==="object"&&e!==null){const n=new WeakSet;try{return JSON.stringify(e,(s,t)=>{if(typeof t==="object"&&t!==null){if(n.has(t))return"[Circular]";n.add(t)}if(typeof t==="bigint")return`${t}n`;return t},2)}catch{return String(e)}}return String(e)}export const CopyButton=M(function e({value:n,size:s=16,buttonStyle:t,colors:o={},"aria-label":l}){const[p,d]=I("idle");const a=R(n);a.current=n;const c=R(null);_(()=>()=>{if(c.current)clearTimeout(c.current)},[]);const g=f=>{d(f);if(c.current)clearTimeout(c.current);c.current=setTimeout(()=>{d("idle");c.current=null},1500)};const x=async()=>{try{const f=typeof a.current==="function"?a.current():a.current;await navigator.clipboard.writeText(G(f));g("success")}catch{g("error")}};const b=p==="success"?o.success||r.success:p==="error"?o.error||r.error:o.idle||r.secondary;return i("button",{type:"button",onClick:p==="idle"?x:void 0,"aria-label":l??(p==="idle"?"Copy to clipboard":p==="success"?"Copied to clipboard":"Failed to copy"),style:{...U.button,...t},children:p==="success"?i(V,{size:s,color:b}):p==="error"?i(N,{size:s,color:b}):i(H,{size:s,color:b})})});export const InlineCopyButton=M(function e(n){return i(CopyButton,{size:12,...n})});const U={button:{display:"inline-flex",padding:4,justifyContent:"center",alignItems:"center",background:"none",border:"none",cursor:"pointer",margin:0}};const J=e=>{if(e===null)return"null";if(e===void 0)return"undefined";if(Array.isArray(e))return"array";if(e instanceof Date)return"date";if(e instanceof Error)return"error";if(e instanceof Map)return"map";if(e instanceof Set)return"set";if(e instanceof RegExp)return"regexp";if(typeof e==="function")return"function";if(typeof e==="symbol")return"symbol";if(typeof e==="bigint")return"bigint";if(typeof e==="object")return"object";return typeof e};const X=(e,n)=>{if(e===null)return 0;switch(n){case"array":return Array.isArray(e)?e.length:0;case"object":return typeof e==="object"?Object.keys(e).length:0;case"map":return e instanceof Map?e.size:0;case"set":return e instanceof Set?e.size:0;default:return 0}};const K=(e,n)=>{if(e===null)return"null";if(e===void 0)return"undefined";switch(n){case"string":return`"${String(e)}"`;case"boolean":return e===true?"true":"false";case"function":return typeof e==="function"?e.toString().slice(0,50)+"...":"undefined";case"symbol":return typeof e==="symbol"?String(e):"undefined";case"date":return e instanceof Date?e.toISOString():"undefined";case"regexp":return e instanceof RegExp?e.toString():"undefined";case"bigint":return typeof e==="bigint"?e.toString()+"n":"undefined";case"error":return e instanceof Error?`${e.name}: ${e.message}`:"undefined";default:try{return JSON.stringify(e)??String(e)}catch{return String(e)}}};const Y=new Map([["string",r.dataTypes.string],["number",r.dataTypes.number],["bigint",r.optional],["boolean",r.dataTypes.boolean],["null",r.dataTypes.null],["undefined",r.dataTypes.undefined],["function",r.dataTypes.function],["symbol",r.critical],["date",r.critical],["error",r.error],["array",r.dataTypes.array],["object",r.dataTypes.object],["map",r.info],["set",r.success],["circular",r.warning]]);const Z=e=>Y.get(e)||r.dataTypes.array;function O(e,n,s,t,o="root",l=0,p=[]){if(l>Math.min(s,B))return[];const d=[...p,o];const a=d.join(".");const c=J(e);const g=["object","array","map","set"].includes(c)&&e!==null;const x=Math.min(g?X(e,c):0,P);if(e&&typeof e==="object"){if(t.has(e)){return[{id:a,key:o,value:"[Circular Reference]",valueType:"circular",depth:l,isExpandable:false,isExpanded:false,childCount:0}]}t.add(e)}const b=[{id:a,key:o,value:e,valueType:c,depth:l,isExpandable:g,isExpanded:n.has(a),childCount:x}];if(g&&n.has(a)&&l<Math.min(s,B)){try{let f=[];switch(c){case"array":f=e.map((y,h)=>[h.toString(),y]);break;case"object":f=Object.entries(e);break;case"map":f=Array.from(e.entries()).map(([y,h])=>[String(y),h]);break;case"set":f=Array.from(e.values()).map((y,h)=>[h.toString(),y]);break}for(const[y,h]of f.slice(0,x)){b.push(...O(h,n,s,t,y,l+1,d))}}catch{}}return b}function q({items:e}){const n=j(()=>{let s=0;for(const o of e)if(o.depth>s)s=o.depth;const t=[];for(let o=1;o<=s;o++){const l=Math.round((o-.5)*L)+.5;const p=[];let d=-1;let a=-1;for(let c=0;c<e.length;c++){if((e[c]?.depth??0)>=o){if(d===-1)d=c;a=c}else if(d!==-1){p.push({startIndex:d,endIndex:a});d=-1;a=-1}}if(d!==-1)p.push({startIndex:d,endIndex:a});if(p.length>0)t.push({depth:o,left:l,segments:p})}return t},[e]);return i("div",{style:u.guidesOverlay,"aria-hidden":true,children:n.map(s=>s.segments.map((t,o)=>i("div",{style:{...u.guideLine,left:s.left,top:t.startIndex*F,height:(t.endIndex-t.startIndex+1)*F,backgroundColor:`${r.primary}${z}`}},`${s.depth}-${o}`)))})}const Q=M(function e({item:n,onToggleExpanded:s}){const[t,o]=I(false);const l=Z(n.valueType);return m("div",{style:{...u.itemContainer,marginLeft:n.depth*L},children:[m("button",{type:"button",style:{...u.itemTouchable,...t?u.itemTouchablePressed:null,cursor:n.isExpandable?"pointer":"default"},onClick:n.isExpandable?()=>s(n.id):void 0,onPointerDown:()=>o(true),onPointerUp:()=>o(false),onPointerLeave:()=>o(false),disabled:!n.isExpandable,"aria-expanded":n.isExpandable?n.isExpanded:void 0,children:[i("span",{style:u.expanderContainer,children:n.isExpandable?i(W,{size:12,color:r.secondary,style:{transform:n.isExpanded?"rotate(90deg)":"rotate(0deg)"}}):null}),m("span",{style:u.labelContainer,children:[m("span",{style:u.labelText,children:[n.key,":"]}),n.isExpandable?m("span",{style:{...u.valueText,color:r.secondary},children:[n.valueType," (",n.childCount," ",n.childCount===1?"item":"items",")"]}):i("span",{style:{...u.valueText,color:l},children:K(n.value,n.valueType)})]})]}),n.value!==void 0?i(CopyButton,{value:n.value,size:14,buttonStyle:{marginLeft:8,marginRight:8}}):null]})});function $({data:e,maxDepth:n,initialExpanded:s}){const[t,o]=I(()=>{const a=new Set(["root"]);if(s&&e&&typeof e==="object"){if(Array.isArray(e)){e.forEach((c,g)=>a.add(`root.${g}`))}else{Object.keys(e).forEach(c=>a.add(`root.${c}`))}}return a});const l=j(()=>O(e,t,n,new WeakSet),[e,t,n]);const p=a=>{o(c=>{const g=new Set(c);if(g.has(a))g.delete(a);else g.add(a);return g})};const d=e!==null&&e!==void 0&&(typeof e==="string"?e.length>0:typeof e==="number"||typeof e==="boolean"?true:Array.isArray(e)?e.length>0:typeof e==="object"?Object.keys(e).length>0:false);if(!d){return i("div",{style:u.noDataContainer,children:i("span",{style:u.noDataText,children:"No data available"})})}return m("div",{style:u.rawRoot,children:[i(q,{items:l}),l.map(a=>i(Q,{item:a,onToggleExpanded:p},a.id))]})}const v=e=>{const n={string:r.dataTypes.string,number:r.dataTypes.number,bigint:A.semantic.debug,boolean:r.dataTypes.boolean,null:r.dataTypes.null,undefined:r.dataTypes.undefined,function:r.dataTypes.function,symbol:A.semantic.error,date:A.semantic.error,error:A.semantic.error,array:r.dataTypes.array,object:r.dataTypes.object};return n[e]||A.text.secondary};function ee({types:e,activeFilter:n,onFilterChange:s}){if(e.length===0)return null;return i("div",{style:u.typeLegend,children:e.map(t=>{const o=v(t);const l=n===t;return m("button",{type:"button",style:{...u.typeBadge,...l?u.typeBadgeActive:null,border:`1px solid ${l?o:A.text.primary+"1A"}`},onClick:()=>s(n===t?null:t),"aria-label":`Filter by ${t} values`,children:[i("span",{style:{...u.typeColor,backgroundColor:o}}),i("span",{style:{...u.typeName,...l?{color:o}:null},children:t})]},t)})})}const ne=e=>typeof e==="object"&&e!==null&&!Array.isArray(e);export function DataViewer({title:e,data:n,maxDepth:s=10,rawMode:t=true,showTypeFilter:o=true,initialExpanded:l=false,disableCopy:p=false}){const[d,a]=I(null);const c=j(()=>{if(!n||!o)return[];const x=[];const b=(f,y=0)=>{if(y>3)return;const h=Array.isArray(f)?"array":f===null?"null":typeof f;x.push(h);if(h==="object"&&ne(f)){Object.values(f).forEach(E=>b(E,y+1))}else if(Array.isArray(f)){f.forEach(E=>b(E,y+1))}};b(n);return Array.from(new Set(x)).slice(0,8)},[n,o]);const g=j(()=>{if(!d||!n)return null;const x={};let b=0;const f=(y,h,E="",D=0)=>{if(D>10||b>100)return;if(Array.isArray(y)){y.forEach((C,T)=>{const S=E?`${E}[${T}]`:`[${T}]`;const w=C===null?"null":typeof C;if(w===h){x[S]=C;b++}if(w==="object"&&C!==null||Array.isArray(C)){f(C,h,S,D+1)}})}else if(y&&typeof y==="object"){Object.entries(y).forEach(([C,T])=>{const S=E?`${E}.${C}`:C;const w=Array.isArray(T)?"array":T===null?"null":typeof T;if(w===h){x[S]=T;b++}if(w==="object"&&T!==null||w==="array"){f(T,h,S,D+1)}})}};f(n,d);return{filteredObject:x,itemCount:b}},[d,n]);return m("div",{children:[o&&i("div",{style:u.header,children:i(ee,{types:c,activeFilter:d,onFilterChange:a})}),d&&g?i($,{data:g.filteredObject,maxDepth:s,initialExpanded:l}):i($,{data:n,maxDepth:s,initialExpanded:l})]})}const u={header:{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center"},rawRoot:{position:"relative"},guidesOverlay:{position:"absolute",left:0,right:0,top:0,bottom:0,zIndex:1,pointerEvents:"none"},guideLine:{position:"absolute",width:1},itemContainer:{minHeight:F,height:F,boxSizing:"border-box",backgroundColor:"transparent",position:"relative",display:"flex",flexDirection:"row",alignItems:"flex-start"},itemTouchable:{flex:1,minWidth:0,display:"flex",flexDirection:"row",alignItems:"flex-start",padding:"2px 16px 2px 0",minHeight:F,boxSizing:"border-box",background:"none",border:"none",margin:0,textAlign:"left",font:"inherit"},itemTouchablePressed:{backgroundColor:`${r.primary}0A`},expanderContainer:{width:16,display:"inline-flex",alignItems:"center",justifyContent:"center",marginTop:4,flexShrink:0},labelContainer:{flex:1,minWidth:0,display:"flex",flexDirection:"row",alignItems:"flex-start",paddingLeft:2},labelText:{color:r.primary,fontSize:12,fontWeight:500,fontFamily:"ui-monospace, Menlo, monospace",marginRight:8,flexShrink:1,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},valueText:{fontSize:12,fontFamily:"ui-monospace, Menlo, monospace",flex:1,minWidth:0,color:r.primaryLight,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},noDataContainer:{display:"flex",flex:1,justifyContent:"center",alignItems:"center",padding:20},noDataText:{color:r.secondary,fontSize:12},typeLegend:{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:6,width:"100%",padding:8,boxSizing:"border-box"},typeBadge:{display:"inline-flex",flexDirection:"row",alignItems:"center",backgroundColor:A.background.hover,padding:"4px 8px",borderRadius:12,cursor:"pointer",margin:0},typeBadgeActive:{backgroundColor:A.background.input},typeColor:{width:8,height:8,borderRadius:4,marginRight:6,display:"inline-block"},typeName:{color:A.text.secondary,fontSize:11,fontWeight:500}};
|