@buoy-gg/jotai 2.1.12 → 2.1.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/index.js +1 -91
- package/lib/commonjs/jotai/components/JotaiAtomBrowser.js +1 -300
- package/lib/commonjs/jotai/components/JotaiAtomChangeItem.js +1 -113
- package/lib/commonjs/jotai/components/JotaiAtomDetailContent.js +1 -754
- package/lib/commonjs/jotai/components/JotaiEventFilterView.js +1 -305
- package/lib/commonjs/jotai/components/JotaiIcon.js +1 -35
- package/lib/commonjs/jotai/components/JotaiModal.js +1 -567
- package/lib/commonjs/jotai/components/index.js +1 -59
- package/lib/commonjs/jotai/hooks/useJotaiAtomChanges.js +1 -83
- package/lib/commonjs/jotai/index.js +1 -85
- package/lib/commonjs/jotai/utils/jotaiStateStore.js +1 -322
- package/lib/commonjs/jotai/utils/watchAtoms.js +1 -149
- package/lib/commonjs/preset.js +1 -98
- package/lib/module/index.js +1 -74
- package/lib/module/jotai/components/JotaiAtomBrowser.js +1 -296
- package/lib/module/jotai/components/JotaiAtomChangeItem.js +1 -109
- package/lib/module/jotai/components/JotaiAtomDetailContent.js +1 -748
- package/lib/module/jotai/components/JotaiEventFilterView.js +1 -301
- package/lib/module/jotai/components/JotaiIcon.js +1 -31
- package/lib/module/jotai/components/JotaiModal.js +1 -563
- package/lib/module/jotai/components/index.js +1 -8
- package/lib/module/jotai/hooks/useJotaiAtomChanges.js +1 -79
- package/lib/module/jotai/index.js +1 -10
- package/lib/module/jotai/utils/jotaiStateStore.js +1 -318
- package/lib/module/jotai/utils/watchAtoms.js +1 -144
- package/lib/module/preset.js +1 -94
- package/package.json +3 -3
- package/lib/typescript/index.d.ts.map +0 -1
- package/lib/typescript/jotai/components/JotaiAtomBrowser.d.ts.map +0 -1
- package/lib/typescript/jotai/components/JotaiAtomChangeItem.d.ts.map +0 -1
- package/lib/typescript/jotai/components/JotaiAtomDetailContent.d.ts.map +0 -1
- package/lib/typescript/jotai/components/JotaiEventFilterView.d.ts.map +0 -1
- package/lib/typescript/jotai/components/JotaiIcon.d.ts.map +0 -1
- package/lib/typescript/jotai/components/JotaiModal.d.ts.map +0 -1
- package/lib/typescript/jotai/components/index.d.ts.map +0 -1
- package/lib/typescript/jotai/hooks/useJotaiAtomChanges.d.ts.map +0 -1
- package/lib/typescript/jotai/index.d.ts.map +0 -1
- package/lib/typescript/jotai/types/index.d.ts.map +0 -1
- package/lib/typescript/jotai/utils/jotaiStateStore.d.ts.map +0 -1
- package/lib/typescript/jotai/utils/watchAtoms.d.ts.map +0 -1
- package/lib/typescript/preset.d.ts.map +0 -1
|
@@ -1,754 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.JotaiAtomDetailContent = JotaiAtomDetailContent;
|
|
7
|
-
exports.JotaiAtomDetailFooter = JotaiAtomDetailFooter;
|
|
8
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
-
var _reactNative = require("react-native");
|
|
10
|
-
var _sharedUi = require("@buoy-gg/shared-ui");
|
|
11
|
-
var _dataViewer = require("@buoy-gg/shared-ui/dataViewer");
|
|
12
|
-
var _license = require("@buoy-gg/license");
|
|
13
|
-
var _jotaiStateStore = require("../utils/jotaiStateStore");
|
|
14
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
|
-
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); }
|
|
16
|
-
/**
|
|
17
|
-
* JotaiAtomDetailContent
|
|
18
|
-
*
|
|
19
|
-
* Detail view for a Jotai atom change with 3 view modes:
|
|
20
|
-
* - CHANGE: Atom label, timestamp, category, changed keys
|
|
21
|
-
* - VALUE: Full atom value after change
|
|
22
|
-
* - DIFF: Compare prev vs next value
|
|
23
|
-
*
|
|
24
|
-
* Mirrors ZustandStateDetailContent.tsx from @buoy-gg/zustand
|
|
25
|
-
*/
|
|
26
|
-
|
|
27
|
-
// ---- View Toggle ----
|
|
28
|
-
|
|
29
|
-
const VIEW_CONFIGS = [{
|
|
30
|
-
key: "change",
|
|
31
|
-
label: "CHANGE",
|
|
32
|
-
icon: _sharedUi.FileText,
|
|
33
|
-
activeColor: _sharedUi.macOSColors.semantic.warning
|
|
34
|
-
}, {
|
|
35
|
-
key: "value",
|
|
36
|
-
label: "VALUE",
|
|
37
|
-
icon: _sharedUi.Database,
|
|
38
|
-
activeColor: _sharedUi.macOSColors.semantic.info
|
|
39
|
-
}, {
|
|
40
|
-
key: "diff",
|
|
41
|
-
label: "DIFF",
|
|
42
|
-
icon: _sharedUi.GitBranch,
|
|
43
|
-
activeColor: _sharedUi.macOSColors.semantic.success
|
|
44
|
-
}];
|
|
45
|
-
function DetailViewToggle({
|
|
46
|
-
activeView,
|
|
47
|
-
onViewChange,
|
|
48
|
-
diffDisabled
|
|
49
|
-
}) {
|
|
50
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
51
|
-
style: toggleStyles.container,
|
|
52
|
-
children: VIEW_CONFIGS.map(config => {
|
|
53
|
-
const isActive = activeView === config.key;
|
|
54
|
-
const isDisabled = config.key === "diff" && diffDisabled;
|
|
55
|
-
const IconComponent = config.icon;
|
|
56
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TouchableOpacity, {
|
|
57
|
-
style: [toggleStyles.card, isActive && [toggleStyles.cardActive, {
|
|
58
|
-
borderColor: config.activeColor
|
|
59
|
-
}], isDisabled && toggleStyles.cardDisabled],
|
|
60
|
-
onPress: () => !isDisabled && onViewChange(config.key),
|
|
61
|
-
activeOpacity: 0.7,
|
|
62
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
63
|
-
style: toggleStyles.cardContent,
|
|
64
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(IconComponent, {
|
|
65
|
-
size: 14,
|
|
66
|
-
color: isActive ? config.activeColor : isDisabled ? _sharedUi.macOSColors.text.muted : _sharedUi.macOSColors.text.secondary
|
|
67
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
68
|
-
style: [toggleStyles.cardLabel, isActive && {
|
|
69
|
-
color: config.activeColor
|
|
70
|
-
}, isDisabled && {
|
|
71
|
-
color: _sharedUi.macOSColors.text.muted
|
|
72
|
-
}],
|
|
73
|
-
children: config.label
|
|
74
|
-
})]
|
|
75
|
-
})
|
|
76
|
-
}, config.key);
|
|
77
|
-
})
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
// ---- Helpers ----
|
|
82
|
-
|
|
83
|
-
function getCategoryInfo(category) {
|
|
84
|
-
switch (category) {
|
|
85
|
-
case "initial":
|
|
86
|
-
return {
|
|
87
|
-
label: "INITIAL",
|
|
88
|
-
color: _sharedUi.buoyColors.textMuted,
|
|
89
|
-
bgColor: _sharedUi.buoyColors.textMuted + "26"
|
|
90
|
-
};
|
|
91
|
-
default:
|
|
92
|
-
return {
|
|
93
|
-
label: "WRITE",
|
|
94
|
-
color: _sharedUi.buoyColors.success,
|
|
95
|
-
bgColor: _sharedUi.buoyColors.success + "26"
|
|
96
|
-
};
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
function formatTime(timestamp) {
|
|
100
|
-
const date = new Date(timestamp);
|
|
101
|
-
const h = date.getHours().toString().padStart(2, "0");
|
|
102
|
-
const m = date.getMinutes().toString().padStart(2, "0");
|
|
103
|
-
const s = date.getSeconds().toString().padStart(2, "0");
|
|
104
|
-
const ms = date.getMilliseconds().toString().padStart(3, "0");
|
|
105
|
-
return `${h}:${m}:${s}.${ms}`;
|
|
106
|
-
}
|
|
107
|
-
function formatTimestamp(timestamp) {
|
|
108
|
-
return new Date(timestamp).toLocaleTimeString("en-US", {
|
|
109
|
-
hour12: false,
|
|
110
|
-
hour: "2-digit",
|
|
111
|
-
minute: "2-digit",
|
|
112
|
-
second: "2-digit"
|
|
113
|
-
});
|
|
114
|
-
}
|
|
115
|
-
function getValueType(value) {
|
|
116
|
-
if (value === null) return "null";
|
|
117
|
-
if (value === undefined) return "undefined";
|
|
118
|
-
if (Array.isArray(value)) return "array";
|
|
119
|
-
return typeof value;
|
|
120
|
-
}
|
|
121
|
-
function getChangeLabel(category) {
|
|
122
|
-
return category === "initial" ? "INIT" : "WRITE";
|
|
123
|
-
}
|
|
124
|
-
const DIFF_MODE_TABS = [{
|
|
125
|
-
key: "tree",
|
|
126
|
-
label: "TREE VIEW"
|
|
127
|
-
}, {
|
|
128
|
-
key: "split",
|
|
129
|
-
label: "SPLIT VIEW"
|
|
130
|
-
}];
|
|
131
|
-
|
|
132
|
-
// ---- Change Info View (CHANGE tab) ----
|
|
133
|
-
|
|
134
|
-
const JotaiAtomInfoView = /*#__PURE__*/(0, _react.memo)(function JotaiAtomInfoView({
|
|
135
|
-
change
|
|
136
|
-
}) {
|
|
137
|
-
const isPro = (0, _license.useIsPro)();
|
|
138
|
-
const [showProModal, setShowProModal] = (0, _react.useState)(false);
|
|
139
|
-
const categoryInfo = getCategoryInfo(change.category);
|
|
140
|
-
const atomColor = _jotaiStateStore.jotaiStateStore.getAtomColor(change.atomLabel);
|
|
141
|
-
const handleCopyValue = (0, _react.useCallback)(async () => {
|
|
142
|
-
if (!isPro) {
|
|
143
|
-
setShowProModal(true);
|
|
144
|
-
return;
|
|
145
|
-
}
|
|
146
|
-
await (0, _sharedUi.copyToClipboard)(change.nextValue);
|
|
147
|
-
}, [change.nextValue, isPro]);
|
|
148
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.ScrollView, {
|
|
149
|
-
style: infoStyles.container,
|
|
150
|
-
contentContainerStyle: infoStyles.content,
|
|
151
|
-
showsVerticalScrollIndicator: false,
|
|
152
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
153
|
-
style: infoStyles.card,
|
|
154
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
155
|
-
style: infoStyles.sectionHeader,
|
|
156
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
157
|
-
style: infoStyles.sectionHeaderLeft,
|
|
158
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.Info, {
|
|
159
|
-
size: 14,
|
|
160
|
-
color: _sharedUi.buoyColors.primary
|
|
161
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
162
|
-
style: infoStyles.sectionTitle,
|
|
163
|
-
children: "CHANGE INFO"
|
|
164
|
-
})]
|
|
165
|
-
})
|
|
166
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
167
|
-
style: infoStyles.cardContent,
|
|
168
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
169
|
-
style: infoStyles.infoRow,
|
|
170
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
171
|
-
style: infoStyles.infoLabel,
|
|
172
|
-
children: "Atom"
|
|
173
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
174
|
-
style: [infoStyles.infoValue, infoStyles.infoValueMono, {
|
|
175
|
-
color: atomColor
|
|
176
|
-
}],
|
|
177
|
-
numberOfLines: 1,
|
|
178
|
-
ellipsizeMode: "middle",
|
|
179
|
-
children: change.atomLabel
|
|
180
|
-
})]
|
|
181
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
182
|
-
style: infoStyles.infoRow,
|
|
183
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
184
|
-
style: infoStyles.infoLabel,
|
|
185
|
-
children: "Time"
|
|
186
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
187
|
-
style: [infoStyles.infoValue, infoStyles.infoValueMono],
|
|
188
|
-
children: formatTime(change.timestamp)
|
|
189
|
-
})]
|
|
190
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
191
|
-
style: infoStyles.badgeRow,
|
|
192
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
193
|
-
style: [infoStyles.categoryBadge, {
|
|
194
|
-
backgroundColor: categoryInfo.bgColor
|
|
195
|
-
}],
|
|
196
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
197
|
-
style: [infoStyles.categoryText, {
|
|
198
|
-
color: categoryInfo.color
|
|
199
|
-
}],
|
|
200
|
-
children: categoryInfo.label
|
|
201
|
-
})
|
|
202
|
-
}), change.hasValueChange ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
203
|
-
style: infoStyles.changesBadge,
|
|
204
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.Zap, {
|
|
205
|
-
size: 10,
|
|
206
|
-
color: _sharedUi.buoyColors.success
|
|
207
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
208
|
-
style: infoStyles.changesText,
|
|
209
|
-
children: change.diffSummary || "changed"
|
|
210
|
-
})]
|
|
211
|
-
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
212
|
-
style: infoStyles.noChangesBadge,
|
|
213
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
214
|
-
style: infoStyles.noChangesText,
|
|
215
|
-
children: "no change"
|
|
216
|
-
})
|
|
217
|
-
})]
|
|
218
|
-
})]
|
|
219
|
-
})]
|
|
220
|
-
}), change.changedKeys.length > 0 && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
221
|
-
style: infoStyles.card,
|
|
222
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
223
|
-
style: infoStyles.sectionHeader,
|
|
224
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
225
|
-
style: infoStyles.sectionHeaderLeft,
|
|
226
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.Zap, {
|
|
227
|
-
size: 14,
|
|
228
|
-
color: _sharedUi.buoyColors.primary
|
|
229
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
230
|
-
style: infoStyles.sectionTitle,
|
|
231
|
-
children: "CHANGED KEYS"
|
|
232
|
-
})]
|
|
233
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
234
|
-
style: infoStyles.countBadge,
|
|
235
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
236
|
-
style: infoStyles.countText,
|
|
237
|
-
children: change.changedKeys.length
|
|
238
|
-
})
|
|
239
|
-
})]
|
|
240
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
241
|
-
style: infoStyles.cardContent,
|
|
242
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
243
|
-
style: infoStyles.keysContainer,
|
|
244
|
-
children: change.changedKeys.map(key => /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
245
|
-
style: infoStyles.keyBadge,
|
|
246
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
247
|
-
style: infoStyles.keyText,
|
|
248
|
-
children: key
|
|
249
|
-
})
|
|
250
|
-
}, key))
|
|
251
|
-
})
|
|
252
|
-
})]
|
|
253
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
254
|
-
style: infoStyles.actionsRow,
|
|
255
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
256
|
-
style: [infoStyles.actionButton, infoStyles.actionButtonCopy],
|
|
257
|
-
onTouchEnd: handleCopyValue,
|
|
258
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
259
|
-
style: [infoStyles.actionButtonText, {
|
|
260
|
-
color: _sharedUi.buoyColors.primary
|
|
261
|
-
}],
|
|
262
|
-
children: "COPY VALUE"
|
|
263
|
-
})
|
|
264
|
-
})
|
|
265
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.ProUpgradeModal, {
|
|
266
|
-
visible: showProModal,
|
|
267
|
-
onClose: () => setShowProModal(false),
|
|
268
|
-
featureName: "Copy"
|
|
269
|
-
})]
|
|
270
|
-
});
|
|
271
|
-
});
|
|
272
|
-
|
|
273
|
-
// ---- Main Detail Content ----
|
|
274
|
-
|
|
275
|
-
function JotaiAtomDetailContent({
|
|
276
|
-
change,
|
|
277
|
-
changes,
|
|
278
|
-
selectedIndex,
|
|
279
|
-
onIndexChange,
|
|
280
|
-
disableInternalFooter = false
|
|
281
|
-
}) {
|
|
282
|
-
const [activeView, setActiveView] = (0, _react.useState)("change");
|
|
283
|
-
const [diffMode, setDiffMode] = (0, _react.useState)("tree");
|
|
284
|
-
const totalChanges = changes.length;
|
|
285
|
-
const atomColor = _jotaiStateStore.jotaiStateStore.getAtomColor(change.atomLabel);
|
|
286
|
-
const changeLabel = getChangeLabel(change.category);
|
|
287
|
-
const valueType = getValueType((0, _sharedUi.parseValue)(change.nextValue));
|
|
288
|
-
const chronologicalNumber = totalChanges - selectedIndex;
|
|
289
|
-
const prevChangeIndex = selectedIndex < totalChanges - 1 ? selectedIndex + 1 : null;
|
|
290
|
-
const prevChange = prevChangeIndex !== null ? changes[prevChangeIndex] : null;
|
|
291
|
-
const prevChronologicalNumber = chronologicalNumber - 1;
|
|
292
|
-
const leftEvent = (0, _react.useMemo)(() => ({
|
|
293
|
-
index: prevChangeIndex ?? 0,
|
|
294
|
-
label: prevChronologicalNumber > 0 ? `#${prevChronologicalNumber}` : "Initial",
|
|
295
|
-
timestamp: prevChange ? formatTimestamp(prevChange.timestamp) : "",
|
|
296
|
-
relativeTime: prevChange ? (0, _sharedUi.formatRelativeTime)(new Date(prevChange.timestamp)) : "value",
|
|
297
|
-
badge: prevChange ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
298
|
-
style: [styles.changeBadgeSmall, {
|
|
299
|
-
backgroundColor: `${_jotaiStateStore.jotaiStateStore.getAtomColor(prevChange.atomLabel)}20`
|
|
300
|
-
}],
|
|
301
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
302
|
-
style: [styles.changeTextSmall, {
|
|
303
|
-
color: _jotaiStateStore.jotaiStateStore.getAtomColor(prevChange.atomLabel)
|
|
304
|
-
}],
|
|
305
|
-
children: getChangeLabel(prevChange.category)
|
|
306
|
-
})
|
|
307
|
-
}) : undefined
|
|
308
|
-
}), [prevChangeIndex, prevChange, prevChronologicalNumber]);
|
|
309
|
-
const rightEvent = (0, _react.useMemo)(() => ({
|
|
310
|
-
index: selectedIndex,
|
|
311
|
-
label: `#${chronologicalNumber}`,
|
|
312
|
-
timestamp: formatTimestamp(change.timestamp),
|
|
313
|
-
relativeTime: (0, _sharedUi.formatRelativeTime)(new Date(change.timestamp)),
|
|
314
|
-
badge: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
315
|
-
style: [styles.changeBadgeSmall, {
|
|
316
|
-
backgroundColor: `${atomColor}20`
|
|
317
|
-
}],
|
|
318
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
319
|
-
style: [styles.changeTextSmall, {
|
|
320
|
-
color: atomColor
|
|
321
|
-
}],
|
|
322
|
-
children: changeLabel
|
|
323
|
-
})
|
|
324
|
-
})
|
|
325
|
-
}), [selectedIndex, change.timestamp, atomColor, changeLabel, chronologicalNumber]);
|
|
326
|
-
const renderValueView = (0, _react.useCallback)(() => {
|
|
327
|
-
const parsed = (0, _sharedUi.parseValue)(change.nextValue);
|
|
328
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
329
|
-
style: styles.contentCard,
|
|
330
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
331
|
-
style: styles.valueHeader,
|
|
332
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
333
|
-
style: styles.valueLabel,
|
|
334
|
-
children: "VALUE AFTER CHANGE"
|
|
335
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
336
|
-
style: styles.valueHeaderBadges,
|
|
337
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
338
|
-
style: [styles.changeBadge, {
|
|
339
|
-
backgroundColor: `${atomColor}20`
|
|
340
|
-
}],
|
|
341
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
342
|
-
style: [styles.changeText, {
|
|
343
|
-
color: atomColor
|
|
344
|
-
}],
|
|
345
|
-
children: changeLabel
|
|
346
|
-
})
|
|
347
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
348
|
-
style: styles.typeBadge,
|
|
349
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
350
|
-
style: styles.typeText,
|
|
351
|
-
children: valueType.toUpperCase()
|
|
352
|
-
})
|
|
353
|
-
})]
|
|
354
|
-
})]
|
|
355
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
356
|
-
style: infoStyles.dataViewerContainer,
|
|
357
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_dataViewer.DataViewer, {
|
|
358
|
-
title: "",
|
|
359
|
-
data: parsed,
|
|
360
|
-
showTypeFilter: true,
|
|
361
|
-
rawMode: true,
|
|
362
|
-
initialExpanded: true
|
|
363
|
-
})
|
|
364
|
-
})]
|
|
365
|
-
});
|
|
366
|
-
}, [change.nextValue, atomColor, changeLabel, valueType]);
|
|
367
|
-
const renderDiffContent = (0, _react.useCallback)(() => {
|
|
368
|
-
const prevVal = (0, _sharedUi.parseValue)(change.prevValue);
|
|
369
|
-
const nextVal = (0, _sharedUi.parseValue)(change.nextValue);
|
|
370
|
-
if (diffMode === "split") {
|
|
371
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.ScrollView, {
|
|
372
|
-
style: {
|
|
373
|
-
flex: 1
|
|
374
|
-
},
|
|
375
|
-
showsVerticalScrollIndicator: true,
|
|
376
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_dataViewer.SplitDiffViewer, {
|
|
377
|
-
oldValue: prevVal,
|
|
378
|
-
newValue: nextVal,
|
|
379
|
-
theme: _dataViewer.diffThemes.devToolsDefault,
|
|
380
|
-
options: {
|
|
381
|
-
hideLineNumbers: false,
|
|
382
|
-
disableWordDiff: false,
|
|
383
|
-
showDiffOnly: false,
|
|
384
|
-
compareMethod: "words",
|
|
385
|
-
contextLines: 3
|
|
386
|
-
},
|
|
387
|
-
showThemeName: false
|
|
388
|
-
})
|
|
389
|
-
});
|
|
390
|
-
}
|
|
391
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_dataViewer.TreeDiffViewer, {
|
|
392
|
-
oldValue: prevVal,
|
|
393
|
-
newValue: nextVal
|
|
394
|
-
});
|
|
395
|
-
}, [change.prevValue, change.nextValue, diffMode]);
|
|
396
|
-
const handleFooterPrevious = (0, _react.useCallback)(() => {
|
|
397
|
-
onIndexChange(Math.min(totalChanges - 1, selectedIndex + 1));
|
|
398
|
-
}, [selectedIndex, totalChanges, onIndexChange]);
|
|
399
|
-
const handleFooterNext = (0, _react.useCallback)(() => {
|
|
400
|
-
onIndexChange(Math.max(0, selectedIndex - 1));
|
|
401
|
-
}, [selectedIndex, onIndexChange]);
|
|
402
|
-
const diffDisabled = totalChanges <= 1;
|
|
403
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
404
|
-
style: styles.container,
|
|
405
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(DetailViewToggle, {
|
|
406
|
-
activeView: activeView,
|
|
407
|
-
onViewChange: setActiveView,
|
|
408
|
-
diffDisabled: diffDisabled
|
|
409
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
410
|
-
style: styles.contentArea,
|
|
411
|
-
children: [activeView === "change" && /*#__PURE__*/(0, _jsxRuntime.jsx)(JotaiAtomInfoView, {
|
|
412
|
-
change: change
|
|
413
|
-
}), activeView === "value" && /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
414
|
-
style: styles.stateContainer,
|
|
415
|
-
children: renderValueView()
|
|
416
|
-
}), activeView === "diff" && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
417
|
-
style: styles.diffContainer,
|
|
418
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.DiffModeTabs, {
|
|
419
|
-
tabs: DIFF_MODE_TABS,
|
|
420
|
-
activeTab: diffMode,
|
|
421
|
-
onTabChange: setDiffMode
|
|
422
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.CompareBar, {
|
|
423
|
-
leftEvent: leftEvent,
|
|
424
|
-
rightEvent: rightEvent
|
|
425
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
426
|
-
style: styles.diffContent,
|
|
427
|
-
children: renderDiffContent()
|
|
428
|
-
})]
|
|
429
|
-
})]
|
|
430
|
-
}), !disableInternalFooter && totalChanges > 1 && /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.EventStepperFooter, {
|
|
431
|
-
currentIndex: chronologicalNumber - 1,
|
|
432
|
-
totalItems: totalChanges,
|
|
433
|
-
onPrevious: handleFooterPrevious,
|
|
434
|
-
onNext: handleFooterNext,
|
|
435
|
-
itemLabel: "Change",
|
|
436
|
-
subtitle: (0, _sharedUi.formatRelativeTime)(new Date(change.timestamp)),
|
|
437
|
-
absolute: true
|
|
438
|
-
})]
|
|
439
|
-
});
|
|
440
|
-
}
|
|
441
|
-
function JotaiAtomDetailFooter({
|
|
442
|
-
change,
|
|
443
|
-
changes,
|
|
444
|
-
selectedIndex,
|
|
445
|
-
onIndexChange
|
|
446
|
-
}) {
|
|
447
|
-
const totalChanges = changes.length;
|
|
448
|
-
if (totalChanges <= 1) return null;
|
|
449
|
-
const chronologicalNumber = totalChanges - selectedIndex;
|
|
450
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.EventStepperFooter, {
|
|
451
|
-
currentIndex: chronologicalNumber - 1,
|
|
452
|
-
totalItems: totalChanges,
|
|
453
|
-
onPrevious: () => onIndexChange(Math.min(totalChanges - 1, selectedIndex + 1)),
|
|
454
|
-
onNext: () => onIndexChange(Math.max(0, selectedIndex - 1)),
|
|
455
|
-
itemLabel: "Change",
|
|
456
|
-
subtitle: (0, _sharedUi.formatRelativeTime)(new Date(change.timestamp))
|
|
457
|
-
});
|
|
458
|
-
}
|
|
459
|
-
const styles = _reactNative.StyleSheet.create({
|
|
460
|
-
container: {
|
|
461
|
-
flex: 1,
|
|
462
|
-
backgroundColor: _sharedUi.macOSColors.background.base
|
|
463
|
-
},
|
|
464
|
-
contentArea: {
|
|
465
|
-
flex: 1,
|
|
466
|
-
paddingBottom: 96
|
|
467
|
-
},
|
|
468
|
-
stateContainer: {
|
|
469
|
-
flex: 1,
|
|
470
|
-
padding: 14
|
|
471
|
-
},
|
|
472
|
-
contentCard: {
|
|
473
|
-
backgroundColor: _sharedUi.macOSColors.background.card,
|
|
474
|
-
borderRadius: 14,
|
|
475
|
-
padding: 14,
|
|
476
|
-
borderWidth: 1,
|
|
477
|
-
borderColor: _sharedUi.macOSColors.border.default
|
|
478
|
-
},
|
|
479
|
-
valueHeader: {
|
|
480
|
-
flexDirection: "row",
|
|
481
|
-
alignItems: "center",
|
|
482
|
-
justifyContent: "space-between",
|
|
483
|
-
marginBottom: 8
|
|
484
|
-
},
|
|
485
|
-
valueLabel: {
|
|
486
|
-
fontSize: 10,
|
|
487
|
-
color: _sharedUi.macOSColors.text.secondary,
|
|
488
|
-
fontFamily: "monospace",
|
|
489
|
-
letterSpacing: 0.5,
|
|
490
|
-
fontWeight: "600"
|
|
491
|
-
},
|
|
492
|
-
valueHeaderBadges: {
|
|
493
|
-
flexDirection: "row",
|
|
494
|
-
alignItems: "center",
|
|
495
|
-
gap: 6
|
|
496
|
-
},
|
|
497
|
-
changeBadge: {
|
|
498
|
-
paddingHorizontal: 8,
|
|
499
|
-
paddingVertical: 2,
|
|
500
|
-
borderRadius: 4
|
|
501
|
-
},
|
|
502
|
-
changeText: {
|
|
503
|
-
fontSize: 9,
|
|
504
|
-
fontWeight: "700",
|
|
505
|
-
fontFamily: "monospace",
|
|
506
|
-
letterSpacing: 0.3
|
|
507
|
-
},
|
|
508
|
-
typeBadge: {
|
|
509
|
-
paddingHorizontal: 8,
|
|
510
|
-
paddingVertical: 2,
|
|
511
|
-
borderRadius: 4,
|
|
512
|
-
backgroundColor: _sharedUi.macOSColors.background.input
|
|
513
|
-
},
|
|
514
|
-
typeText: {
|
|
515
|
-
fontSize: 9,
|
|
516
|
-
fontWeight: "600",
|
|
517
|
-
color: _sharedUi.macOSColors.text.muted,
|
|
518
|
-
fontFamily: "monospace"
|
|
519
|
-
},
|
|
520
|
-
valueBox: {
|
|
521
|
-
backgroundColor: _sharedUi.macOSColors.background.base,
|
|
522
|
-
borderRadius: 6,
|
|
523
|
-
borderWidth: 1,
|
|
524
|
-
borderColor: _sharedUi.macOSColors.border.input,
|
|
525
|
-
padding: 8
|
|
526
|
-
},
|
|
527
|
-
valueText: {
|
|
528
|
-
fontSize: 12,
|
|
529
|
-
color: _sharedUi.macOSColors.text.primary,
|
|
530
|
-
fontFamily: "monospace",
|
|
531
|
-
lineHeight: 18
|
|
532
|
-
},
|
|
533
|
-
diffContainer: {
|
|
534
|
-
flex: 1
|
|
535
|
-
},
|
|
536
|
-
diffContent: {
|
|
537
|
-
flex: 1,
|
|
538
|
-
paddingHorizontal: 14
|
|
539
|
-
},
|
|
540
|
-
changeBadgeSmall: {
|
|
541
|
-
paddingHorizontal: 6,
|
|
542
|
-
paddingVertical: 1,
|
|
543
|
-
borderRadius: 3
|
|
544
|
-
},
|
|
545
|
-
changeTextSmall: {
|
|
546
|
-
fontSize: 8,
|
|
547
|
-
fontWeight: "700",
|
|
548
|
-
fontFamily: "monospace"
|
|
549
|
-
}
|
|
550
|
-
});
|
|
551
|
-
const toggleStyles = _reactNative.StyleSheet.create({
|
|
552
|
-
container: {
|
|
553
|
-
flexDirection: "row",
|
|
554
|
-
gap: 8,
|
|
555
|
-
padding: 14,
|
|
556
|
-
backgroundColor: _sharedUi.macOSColors.background.base
|
|
557
|
-
},
|
|
558
|
-
card: {
|
|
559
|
-
flex: 1,
|
|
560
|
-
backgroundColor: _sharedUi.macOSColors.background.card,
|
|
561
|
-
borderRadius: 12,
|
|
562
|
-
borderWidth: 1,
|
|
563
|
-
borderColor: _sharedUi.macOSColors.border.default,
|
|
564
|
-
paddingVertical: 10,
|
|
565
|
-
paddingHorizontal: 10,
|
|
566
|
-
justifyContent: "center"
|
|
567
|
-
},
|
|
568
|
-
cardActive: {
|
|
569
|
-
borderWidth: 1.5,
|
|
570
|
-
backgroundColor: "rgba(0, 184, 230, 0.05)"
|
|
571
|
-
},
|
|
572
|
-
cardDisabled: {
|
|
573
|
-
opacity: 0.5
|
|
574
|
-
},
|
|
575
|
-
cardContent: {
|
|
576
|
-
flexDirection: "row",
|
|
577
|
-
alignItems: "center",
|
|
578
|
-
gap: 6
|
|
579
|
-
},
|
|
580
|
-
cardLabel: {
|
|
581
|
-
fontSize: 10,
|
|
582
|
-
fontWeight: "700",
|
|
583
|
-
letterSpacing: 0.5,
|
|
584
|
-
color: _sharedUi.macOSColors.text.secondary
|
|
585
|
-
}
|
|
586
|
-
});
|
|
587
|
-
const infoStyles = _reactNative.StyleSheet.create({
|
|
588
|
-
container: {
|
|
589
|
-
flex: 1
|
|
590
|
-
},
|
|
591
|
-
content: {
|
|
592
|
-
padding: 8,
|
|
593
|
-
paddingBottom: 100,
|
|
594
|
-
gap: 16
|
|
595
|
-
},
|
|
596
|
-
card: {
|
|
597
|
-
backgroundColor: _sharedUi.buoyColors.card,
|
|
598
|
-
borderRadius: 6,
|
|
599
|
-
borderWidth: 1,
|
|
600
|
-
borderColor: _sharedUi.buoyColors.primary + "4D",
|
|
601
|
-
overflow: "hidden",
|
|
602
|
-
shadowColor: _sharedUi.buoyColors.primary,
|
|
603
|
-
shadowOffset: {
|
|
604
|
-
width: 0,
|
|
605
|
-
height: 0
|
|
606
|
-
},
|
|
607
|
-
shadowOpacity: 0.1,
|
|
608
|
-
shadowRadius: 6
|
|
609
|
-
},
|
|
610
|
-
sectionHeader: {
|
|
611
|
-
flexDirection: "row",
|
|
612
|
-
alignItems: "center",
|
|
613
|
-
justifyContent: "space-between",
|
|
614
|
-
paddingHorizontal: 12,
|
|
615
|
-
paddingVertical: 10,
|
|
616
|
-
borderBottomWidth: 1,
|
|
617
|
-
borderBottomColor: _sharedUi.buoyColors.primary + "33",
|
|
618
|
-
backgroundColor: _sharedUi.buoyColors.primary + "15"
|
|
619
|
-
},
|
|
620
|
-
sectionHeaderLeft: {
|
|
621
|
-
flexDirection: "row",
|
|
622
|
-
alignItems: "center",
|
|
623
|
-
gap: 6
|
|
624
|
-
},
|
|
625
|
-
sectionTitle: {
|
|
626
|
-
fontSize: 12,
|
|
627
|
-
fontWeight: "600",
|
|
628
|
-
letterSpacing: 0.5,
|
|
629
|
-
color: _sharedUi.buoyColors.primary,
|
|
630
|
-
fontFamily: "monospace"
|
|
631
|
-
},
|
|
632
|
-
cardContent: {
|
|
633
|
-
padding: 14,
|
|
634
|
-
gap: 10
|
|
635
|
-
},
|
|
636
|
-
infoRow: {
|
|
637
|
-
flexDirection: "row",
|
|
638
|
-
alignItems: "center",
|
|
639
|
-
justifyContent: "space-between"
|
|
640
|
-
},
|
|
641
|
-
infoLabel: {
|
|
642
|
-
fontSize: 11,
|
|
643
|
-
color: _sharedUi.buoyColors.textMuted,
|
|
644
|
-
fontWeight: "500"
|
|
645
|
-
},
|
|
646
|
-
infoValue: {
|
|
647
|
-
fontSize: 11,
|
|
648
|
-
color: _sharedUi.buoyColors.text,
|
|
649
|
-
fontWeight: "500",
|
|
650
|
-
flex: 1,
|
|
651
|
-
textAlign: "right",
|
|
652
|
-
marginLeft: 12
|
|
653
|
-
},
|
|
654
|
-
infoValueMono: {
|
|
655
|
-
fontFamily: "monospace"
|
|
656
|
-
},
|
|
657
|
-
badgeRow: {
|
|
658
|
-
flexDirection: "row",
|
|
659
|
-
flexWrap: "wrap",
|
|
660
|
-
gap: 8,
|
|
661
|
-
marginTop: 6
|
|
662
|
-
},
|
|
663
|
-
categoryBadge: {
|
|
664
|
-
paddingHorizontal: 8,
|
|
665
|
-
paddingVertical: 3,
|
|
666
|
-
borderRadius: 4
|
|
667
|
-
},
|
|
668
|
-
categoryText: {
|
|
669
|
-
fontSize: 9,
|
|
670
|
-
fontWeight: "700",
|
|
671
|
-
letterSpacing: 0.3
|
|
672
|
-
},
|
|
673
|
-
changesBadge: {
|
|
674
|
-
flexDirection: "row",
|
|
675
|
-
alignItems: "center",
|
|
676
|
-
gap: 4,
|
|
677
|
-
paddingHorizontal: 8,
|
|
678
|
-
paddingVertical: 3,
|
|
679
|
-
borderRadius: 4,
|
|
680
|
-
backgroundColor: _sharedUi.buoyColors.success + "26"
|
|
681
|
-
},
|
|
682
|
-
changesText: {
|
|
683
|
-
fontSize: 9,
|
|
684
|
-
fontWeight: "600",
|
|
685
|
-
color: _sharedUi.buoyColors.success
|
|
686
|
-
},
|
|
687
|
-
noChangesBadge: {
|
|
688
|
-
paddingHorizontal: 8,
|
|
689
|
-
paddingVertical: 3,
|
|
690
|
-
borderRadius: 4,
|
|
691
|
-
backgroundColor: _sharedUi.buoyColors.input
|
|
692
|
-
},
|
|
693
|
-
noChangesText: {
|
|
694
|
-
fontSize: 9,
|
|
695
|
-
fontWeight: "600",
|
|
696
|
-
color: _sharedUi.buoyColors.textMuted
|
|
697
|
-
},
|
|
698
|
-
keysContainer: {
|
|
699
|
-
flexDirection: "row",
|
|
700
|
-
flexWrap: "wrap",
|
|
701
|
-
gap: 6
|
|
702
|
-
},
|
|
703
|
-
keyBadge: {
|
|
704
|
-
paddingHorizontal: 8,
|
|
705
|
-
paddingVertical: 4,
|
|
706
|
-
borderRadius: 4,
|
|
707
|
-
backgroundColor: _sharedUi.buoyColors.primary + "20",
|
|
708
|
-
borderWidth: 1,
|
|
709
|
-
borderColor: _sharedUi.buoyColors.primary + "40"
|
|
710
|
-
},
|
|
711
|
-
keyText: {
|
|
712
|
-
fontSize: 11,
|
|
713
|
-
fontWeight: "600",
|
|
714
|
-
color: _sharedUi.buoyColors.primary,
|
|
715
|
-
fontFamily: "monospace"
|
|
716
|
-
},
|
|
717
|
-
countBadge: {
|
|
718
|
-
paddingHorizontal: 8,
|
|
719
|
-
paddingVertical: 3,
|
|
720
|
-
borderRadius: 4,
|
|
721
|
-
backgroundColor: _sharedUi.buoyColors.primary + "26"
|
|
722
|
-
},
|
|
723
|
-
countText: {
|
|
724
|
-
fontSize: 9,
|
|
725
|
-
fontWeight: "700",
|
|
726
|
-
color: _sharedUi.buoyColors.primary,
|
|
727
|
-
fontFamily: "monospace"
|
|
728
|
-
},
|
|
729
|
-
actionsRow: {
|
|
730
|
-
flexDirection: "row",
|
|
731
|
-
gap: 12
|
|
732
|
-
},
|
|
733
|
-
actionButton: {
|
|
734
|
-
paddingHorizontal: 14,
|
|
735
|
-
paddingVertical: 8,
|
|
736
|
-
borderRadius: 8,
|
|
737
|
-
borderWidth: 1
|
|
738
|
-
},
|
|
739
|
-
actionButtonCopy: {
|
|
740
|
-
borderColor: _sharedUi.buoyColors.primary + "40",
|
|
741
|
-
backgroundColor: _sharedUi.buoyColors.primary + "15"
|
|
742
|
-
},
|
|
743
|
-
actionButtonText: {
|
|
744
|
-
fontSize: 10,
|
|
745
|
-
fontWeight: "700",
|
|
746
|
-
fontFamily: "monospace",
|
|
747
|
-
letterSpacing: 0.3
|
|
748
|
-
},
|
|
749
|
-
dataViewerContainer: {
|
|
750
|
-
marginTop: -12,
|
|
751
|
-
marginHorizontal: -12,
|
|
752
|
-
marginBottom: -12
|
|
753
|
-
}
|
|
754
|
-
});
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.JotaiAtomDetailContent=JotaiAtomDetailContent,exports.JotaiAtomDetailFooter=JotaiAtomDetailFooter;var _react=_interopRequireWildcard(require("react")),_reactNative=require("react-native"),_sharedUi=require("@buoy-gg/shared-ui"),_dataViewer=require("@buoy-gg/shared-ui/dataViewer"),_license=require("@buoy-gg/license"),_jotaiStateStore=require("../utils/jotaiStateStore"),_jsxRuntime=require("react/jsx-runtime");function _interopRequireWildcard(e,t){if("function"==typeof WeakMap)var a=new WeakMap,i=new WeakMap;return(_interopRequireWildcard=function(e,t){if(!t&&e&&e.__esModule)return e;var o,r,n={__proto__:null,default:e};if(null===e||"object"!=typeof e&&"function"!=typeof e)return n;if(o=t?i:a){if(o.has(e))return o.get(e);o.set(e,n)}for(const t in e)"default"!==t&&{}.hasOwnProperty.call(e,t)&&((r=(o=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,t))&&(r.get||r.set)?o(n,t,r):n[t]=e[t]);return n})(e,t)}const VIEW_CONFIGS=[{key:"change",label:"CHANGE",icon:_sharedUi.FileText,activeColor:_sharedUi.macOSColors.semantic.warning},{key:"value",label:"VALUE",icon:_sharedUi.Database,activeColor:_sharedUi.macOSColors.semantic.info},{key:"diff",label:"DIFF",icon:_sharedUi.GitBranch,activeColor:_sharedUi.macOSColors.semantic.success}];function DetailViewToggle({activeView:e,onViewChange:t,diffDisabled:a}){return(0,_jsxRuntime.jsx)(_reactNative.View,{style:toggleStyles.container,children:VIEW_CONFIGS.map(i=>{const o=e===i.key,r="diff"===i.key&&a,n=i.icon;return(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{style:[toggleStyles.card,o&&[toggleStyles.cardActive,{borderColor:i.activeColor}],r&&toggleStyles.cardDisabled],onPress:()=>!r&&t(i.key),activeOpacity:.7,children:(0,_jsxRuntime.jsxs)(_reactNative.View,{style:toggleStyles.cardContent,children:[(0,_jsxRuntime.jsx)(n,{size:14,color:o?i.activeColor:r?_sharedUi.macOSColors.text.muted:_sharedUi.macOSColors.text.secondary}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[toggleStyles.cardLabel,o&&{color:i.activeColor},r&&{color:_sharedUi.macOSColors.text.muted}],children:i.label})]})},i.key)})})}function getCategoryInfo(e){return"initial"===e?{label:"INITIAL",color:_sharedUi.buoyColors.textMuted,bgColor:_sharedUi.buoyColors.textMuted+"26"}:{label:"WRITE",color:_sharedUi.buoyColors.success,bgColor:_sharedUi.buoyColors.success+"26"}}function formatTime(e){const t=new Date(e);return`${t.getHours().toString().padStart(2,"0")}:${t.getMinutes().toString().padStart(2,"0")}:${t.getSeconds().toString().padStart(2,"0")}.${t.getMilliseconds().toString().padStart(3,"0")}`}function formatTimestamp(e){return new Date(e).toLocaleTimeString("en-US",{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"})}function getValueType(e){return null===e?"null":void 0===e?"undefined":Array.isArray(e)?"array":typeof e}function getChangeLabel(e){return"initial"===e?"INIT":"WRITE"}const DIFF_MODE_TABS=[{key:"tree",label:"TREE VIEW"},{key:"split",label:"SPLIT VIEW"}],JotaiAtomInfoView=(0,_react.memo)(function({change:e}){const t=(0,_license.useIsPro)(),[a,i]=(0,_react.useState)(!1),o=getCategoryInfo(e.category),r=_jotaiStateStore.jotaiStateStore.getAtomColor(e.atomLabel),n=(0,_react.useCallback)(async()=>{t?await(0,_sharedUi.copyToClipboard)(e.nextValue):i(!0)},[e.nextValue,t]);return(0,_jsxRuntime.jsxs)(_reactNative.ScrollView,{style:infoStyles.container,contentContainerStyle:infoStyles.content,showsVerticalScrollIndicator:!1,children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:infoStyles.card,children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:infoStyles.sectionHeader,children:(0,_jsxRuntime.jsxs)(_reactNative.View,{style:infoStyles.sectionHeaderLeft,children:[(0,_jsxRuntime.jsx)(_sharedUi.Info,{size:14,color:_sharedUi.buoyColors.primary}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:infoStyles.sectionTitle,children:"CHANGE INFO"})]})}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:infoStyles.cardContent,children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:infoStyles.infoRow,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:infoStyles.infoLabel,children:"Atom"}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[infoStyles.infoValue,infoStyles.infoValueMono,{color:r}],numberOfLines:1,ellipsizeMode:"middle",children:e.atomLabel})]}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:infoStyles.infoRow,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:infoStyles.infoLabel,children:"Time"}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[infoStyles.infoValue,infoStyles.infoValueMono],children:formatTime(e.timestamp)})]}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:infoStyles.badgeRow,children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:[infoStyles.categoryBadge,{backgroundColor:o.bgColor}],children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[infoStyles.categoryText,{color:o.color}],children:o.label})}),e.hasValueChange?(0,_jsxRuntime.jsxs)(_reactNative.View,{style:infoStyles.changesBadge,children:[(0,_jsxRuntime.jsx)(_sharedUi.Zap,{size:10,color:_sharedUi.buoyColors.success}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:infoStyles.changesText,children:e.diffSummary||"changed"})]}):(0,_jsxRuntime.jsx)(_reactNative.View,{style:infoStyles.noChangesBadge,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:infoStyles.noChangesText,children:"no change"})})]})]})]}),e.changedKeys.length>0&&(0,_jsxRuntime.jsxs)(_reactNative.View,{style:infoStyles.card,children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:infoStyles.sectionHeader,children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:infoStyles.sectionHeaderLeft,children:[(0,_jsxRuntime.jsx)(_sharedUi.Zap,{size:14,color:_sharedUi.buoyColors.primary}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:infoStyles.sectionTitle,children:"CHANGED KEYS"})]}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:infoStyles.countBadge,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:infoStyles.countText,children:e.changedKeys.length})})]}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:infoStyles.cardContent,children:(0,_jsxRuntime.jsx)(_reactNative.View,{style:infoStyles.keysContainer,children:e.changedKeys.map(e=>(0,_jsxRuntime.jsx)(_reactNative.View,{style:infoStyles.keyBadge,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:infoStyles.keyText,children:e})},e))})})]}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:infoStyles.actionsRow,children:(0,_jsxRuntime.jsx)(_reactNative.View,{style:[infoStyles.actionButton,infoStyles.actionButtonCopy],onTouchEnd:n,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[infoStyles.actionButtonText,{color:_sharedUi.buoyColors.primary}],children:"COPY VALUE"})})}),(0,_jsxRuntime.jsx)(_sharedUi.ProUpgradeModal,{visible:a,onClose:()=>i(!1),featureName:"Copy"})]})});function JotaiAtomDetailContent({change:e,changes:t,selectedIndex:a,onIndexChange:i,disableInternalFooter:o=!1}){const[r,n]=(0,_react.useState)("change"),[s,l]=(0,_react.useState)("tree"),c=t.length,d=_jotaiStateStore.jotaiStateStore.getAtomColor(e.atomLabel),u=getChangeLabel(e.category),m=getValueType((0,_sharedUi.parseValue)(e.nextValue)),y=c-a,x=a<c-1?a+1:null,g=null!==x?t[x]:null,_=y-1,h=(0,_react.useMemo)(()=>({index:x??0,label:_>0?`#${_}`:"Initial",timestamp:g?formatTimestamp(g.timestamp):"",relativeTime:g?(0,_sharedUi.formatRelativeTime)(new Date(g.timestamp)):"value",badge:g?(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.changeBadgeSmall,{backgroundColor:`${_jotaiStateStore.jotaiStateStore.getAtomColor(g.atomLabel)}20`}],children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.changeTextSmall,{color:_jotaiStateStore.jotaiStateStore.getAtomColor(g.atomLabel)}],children:getChangeLabel(g.category)})}):void 0}),[x,g,_]),f=(0,_react.useMemo)(()=>({index:a,label:`#${y}`,timestamp:formatTimestamp(e.timestamp),relativeTime:(0,_sharedUi.formatRelativeTime)(new Date(e.timestamp)),badge:(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.changeBadgeSmall,{backgroundColor:`${d}20`}],children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.changeTextSmall,{color:d}],children:u})})}),[a,e.timestamp,d,u,y]),p=(0,_react.useCallback)(()=>{const t=(0,_sharedUi.parseValue)(e.nextValue);return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.contentCard,children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.valueHeader,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.valueLabel,children:"VALUE AFTER CHANGE"}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.valueHeaderBadges,children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.changeBadge,{backgroundColor:`${d}20`}],children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.changeText,{color:d}],children:u})}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.typeBadge,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.typeText,children:m.toUpperCase()})})]})]}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:infoStyles.dataViewerContainer,children:(0,_jsxRuntime.jsx)(_dataViewer.DataViewer,{title:"",data:t,showTypeFilter:!0,rawMode:!0,initialExpanded:!0})})]})},[e.nextValue,d,u,m]),j=(0,_react.useCallback)(()=>{const t=(0,_sharedUi.parseValue)(e.prevValue),a=(0,_sharedUi.parseValue)(e.nextValue);return"split"===s?(0,_jsxRuntime.jsx)(_reactNative.ScrollView,{style:{flex:1},showsVerticalScrollIndicator:!0,children:(0,_jsxRuntime.jsx)(_dataViewer.SplitDiffViewer,{oldValue:t,newValue:a,theme:_dataViewer.diffThemes.devToolsDefault,options:{hideLineNumbers:!1,disableWordDiff:!1,showDiffOnly:!1,compareMethod:"words",contextLines:3},showThemeName:!1})}):(0,_jsxRuntime.jsx)(_dataViewer.TreeDiffViewer,{oldValue:t,newValue:a})},[e.prevValue,e.nextValue,s]),b=(0,_react.useCallback)(()=>{i(Math.min(c-1,a+1))},[a,c,i]),C=(0,_react.useCallback)(()=>{i(Math.max(0,a-1))},[a,i]),S=c<=1;return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.container,children:[(0,_jsxRuntime.jsx)(DetailViewToggle,{activeView:r,onViewChange:n,diffDisabled:S}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.contentArea,children:["change"===r&&(0,_jsxRuntime.jsx)(JotaiAtomInfoView,{change:e}),"value"===r&&(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.stateContainer,children:p()}),"diff"===r&&(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.diffContainer,children:[(0,_jsxRuntime.jsx)(_sharedUi.DiffModeTabs,{tabs:DIFF_MODE_TABS,activeTab:s,onTabChange:l}),(0,_jsxRuntime.jsx)(_sharedUi.CompareBar,{leftEvent:h,rightEvent:f}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.diffContent,children:j()})]})]}),!o&&c>1&&(0,_jsxRuntime.jsx)(_sharedUi.EventStepperFooter,{currentIndex:y-1,totalItems:c,onPrevious:b,onNext:C,itemLabel:"Change",subtitle:(0,_sharedUi.formatRelativeTime)(new Date(e.timestamp)),absolute:!0})]})}function JotaiAtomDetailFooter({change:e,changes:t,selectedIndex:a,onIndexChange:i}){const o=t.length;if(o<=1)return null;const r=o-a;return(0,_jsxRuntime.jsx)(_sharedUi.EventStepperFooter,{currentIndex:r-1,totalItems:o,onPrevious:()=>i(Math.min(o-1,a+1)),onNext:()=>i(Math.max(0,a-1)),itemLabel:"Change",subtitle:(0,_sharedUi.formatRelativeTime)(new Date(e.timestamp))})}const styles=_reactNative.StyleSheet.create({container:{flex:1,backgroundColor:_sharedUi.macOSColors.background.base},contentArea:{flex:1,paddingBottom:96},stateContainer:{flex:1,padding:14},contentCard:{backgroundColor:_sharedUi.macOSColors.background.card,borderRadius:14,padding:14,borderWidth:1,borderColor:_sharedUi.macOSColors.border.default},valueHeader:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",marginBottom:8},valueLabel:{fontSize:10,color:_sharedUi.macOSColors.text.secondary,fontFamily:"monospace",letterSpacing:.5,fontWeight:"600"},valueHeaderBadges:{flexDirection:"row",alignItems:"center",gap:6},changeBadge:{paddingHorizontal:8,paddingVertical:2,borderRadius:4},changeText:{fontSize:9,fontWeight:"700",fontFamily:"monospace",letterSpacing:.3},typeBadge:{paddingHorizontal:8,paddingVertical:2,borderRadius:4,backgroundColor:_sharedUi.macOSColors.background.input},typeText:{fontSize:9,fontWeight:"600",color:_sharedUi.macOSColors.text.muted,fontFamily:"monospace"},valueBox:{backgroundColor:_sharedUi.macOSColors.background.base,borderRadius:6,borderWidth:1,borderColor:_sharedUi.macOSColors.border.input,padding:8},valueText:{fontSize:12,color:_sharedUi.macOSColors.text.primary,fontFamily:"monospace",lineHeight:18},diffContainer:{flex:1},diffContent:{flex:1,paddingHorizontal:14},changeBadgeSmall:{paddingHorizontal:6,paddingVertical:1,borderRadius:3},changeTextSmall:{fontSize:8,fontWeight:"700",fontFamily:"monospace"}}),toggleStyles=_reactNative.StyleSheet.create({container:{flexDirection:"row",gap:8,padding:14,backgroundColor:_sharedUi.macOSColors.background.base},card:{flex:1,backgroundColor:_sharedUi.macOSColors.background.card,borderRadius:12,borderWidth:1,borderColor:_sharedUi.macOSColors.border.default,paddingVertical:10,paddingHorizontal:10,justifyContent:"center"},cardActive:{borderWidth:1.5,backgroundColor:"rgba(0, 184, 230, 0.05)"},cardDisabled:{opacity:.5},cardContent:{flexDirection:"row",alignItems:"center",gap:6},cardLabel:{fontSize:10,fontWeight:"700",letterSpacing:.5,color:_sharedUi.macOSColors.text.secondary}}),infoStyles=_reactNative.StyleSheet.create({container:{flex:1},content:{padding:8,paddingBottom:100,gap:16},card:{backgroundColor:_sharedUi.buoyColors.card,borderRadius:6,borderWidth:1,borderColor:_sharedUi.buoyColors.primary+"4D",overflow:"hidden",shadowColor:_sharedUi.buoyColors.primary,shadowOffset:{width:0,height:0},shadowOpacity:.1,shadowRadius:6},sectionHeader:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingHorizontal:12,paddingVertical:10,borderBottomWidth:1,borderBottomColor:_sharedUi.buoyColors.primary+"33",backgroundColor:_sharedUi.buoyColors.primary+"15"},sectionHeaderLeft:{flexDirection:"row",alignItems:"center",gap:6},sectionTitle:{fontSize:12,fontWeight:"600",letterSpacing:.5,color:_sharedUi.buoyColors.primary,fontFamily:"monospace"},cardContent:{padding:14,gap:10},infoRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between"},infoLabel:{fontSize:11,color:_sharedUi.buoyColors.textMuted,fontWeight:"500"},infoValue:{fontSize:11,color:_sharedUi.buoyColors.text,fontWeight:"500",flex:1,textAlign:"right",marginLeft:12},infoValueMono:{fontFamily:"monospace"},badgeRow:{flexDirection:"row",flexWrap:"wrap",gap:8,marginTop:6},categoryBadge:{paddingHorizontal:8,paddingVertical:3,borderRadius:4},categoryText:{fontSize:9,fontWeight:"700",letterSpacing:.3},changesBadge:{flexDirection:"row",alignItems:"center",gap:4,paddingHorizontal:8,paddingVertical:3,borderRadius:4,backgroundColor:_sharedUi.buoyColors.success+"26"},changesText:{fontSize:9,fontWeight:"600",color:_sharedUi.buoyColors.success},noChangesBadge:{paddingHorizontal:8,paddingVertical:3,borderRadius:4,backgroundColor:_sharedUi.buoyColors.input},noChangesText:{fontSize:9,fontWeight:"600",color:_sharedUi.buoyColors.textMuted},keysContainer:{flexDirection:"row",flexWrap:"wrap",gap:6},keyBadge:{paddingHorizontal:8,paddingVertical:4,borderRadius:4,backgroundColor:_sharedUi.buoyColors.primary+"20",borderWidth:1,borderColor:_sharedUi.buoyColors.primary+"40"},keyText:{fontSize:11,fontWeight:"600",color:_sharedUi.buoyColors.primary,fontFamily:"monospace"},countBadge:{paddingHorizontal:8,paddingVertical:3,borderRadius:4,backgroundColor:_sharedUi.buoyColors.primary+"26"},countText:{fontSize:9,fontWeight:"700",color:_sharedUi.buoyColors.primary,fontFamily:"monospace"},actionsRow:{flexDirection:"row",gap:12},actionButton:{paddingHorizontal:14,paddingVertical:8,borderRadius:8,borderWidth:1},actionButtonCopy:{borderColor:_sharedUi.buoyColors.primary+"40",backgroundColor:_sharedUi.buoyColors.primary+"15"},actionButtonText:{fontSize:10,fontWeight:"700",fontFamily:"monospace",letterSpacing:.3},dataViewerContainer:{marginTop:-12,marginHorizontal:-12,marginBottom:-12}});
|