bippy 0.2.6 → 0.2.7
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/dist/{chunk-A425RZH5.cjs → chunk-7H6RTVXX.cjs} +18 -6
- package/dist/{chunk-DCVQB6TW.js → chunk-ZF32UKFC.js} +17 -7
- package/dist/core.cjs +57 -57
- package/dist/core.d.cts +195 -3
- package/dist/core.d.ts +195 -3
- package/dist/core.js +1 -1
- package/dist/index.cjs +70 -66
- package/dist/index.d.cts +10 -5
- package/dist/index.d.ts +10 -5
- package/dist/index.js +1 -1
- package/dist/inspect.cjs +427 -87
- package/dist/inspect.js +400 -60
- package/dist/sw.cjs +38 -0
- package/dist/sw.d.cts +69 -0
- package/dist/sw.d.ts +69 -0
- package/dist/sw.global.js +9 -0
- package/dist/sw.js +36 -0
- package/package.json +11 -1
- package/dist/core-VaoADixi.d.cts +0 -260
- package/dist/core-VaoADixi.d.ts +0 -260
- package/dist/index.global.js +0 -9
package/dist/inspect.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import './chunk-6TJRMCM3.js';
|
|
2
|
-
import { getFiberId, HostRootTag, HostTextTag, getDisplayName, FragmentTag, isHostFiber, getNearestHostFiber, getFiberFromHostInstance, traverseFiber, getFiberStack, isCompositeFiber, isInstrumentationActive, hasRDTHook,
|
|
2
|
+
import { getFiberId, HostRootTag, HostTextTag, getDisplayName, FragmentTag, isHostFiber, getNearestHostFiber, onCommitFiberRoot, traverseRenderedFibers, getRDTHook, getFiberFromHostInstance, traverseFiber, getFiberStack, isCompositeFiber, isInstrumentationActive, hasRDTHook, detectReactBuildType } from './chunk-ZF32UKFC.js';
|
|
3
3
|
import React17, { createContext, memo, Children, useContext, useCallback, useState, useLayoutEffect, useRef, useMemo, useEffect } from 'react';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -4576,6 +4576,8 @@ function zoom_default2() {
|
|
|
4576
4576
|
}
|
|
4577
4577
|
|
|
4578
4578
|
// src/inspect.tsx
|
|
4579
|
+
var renderCounts = /* @__PURE__ */ new WeakMap();
|
|
4580
|
+
var fiberStates = /* @__PURE__ */ new Map();
|
|
4579
4581
|
var FIBER_PROP_EXPLANATIONS = {
|
|
4580
4582
|
tag: "Numeric type identifier for this fiber (e.g. 1=FunctionComponent, 5=HostComponent)",
|
|
4581
4583
|
elementType: "The original function/class/element type",
|
|
@@ -4788,6 +4790,21 @@ var FiberGraph = React17.memo(
|
|
|
4788
4790
|
const zoomRef = useRef();
|
|
4789
4791
|
const linksGroupRef = useRef(null);
|
|
4790
4792
|
const nodesGroupRef = useRef(null);
|
|
4793
|
+
const renderedFibersRef = useRef(/* @__PURE__ */ new Set());
|
|
4794
|
+
const flashTimeoutRef = useRef();
|
|
4795
|
+
const [timelineIndex, setTimelineIndex] = useState(-1);
|
|
4796
|
+
const [isPlaying, setIsPlaying] = useState(false);
|
|
4797
|
+
const playIntervalRef = useRef();
|
|
4798
|
+
const [activeTab, setActiveTab] = useState("graph");
|
|
4799
|
+
const [tooltip, setTooltip] = useState(null);
|
|
4800
|
+
const handlePropertyHover = (e, propName) => {
|
|
4801
|
+
if (!isDialogMode) return;
|
|
4802
|
+
const explanation = FIBER_PROP_EXPLANATIONS[propName];
|
|
4803
|
+
setTooltip(explanation || null);
|
|
4804
|
+
};
|
|
4805
|
+
const handlePropertyLeave = () => {
|
|
4806
|
+
setTooltip(null);
|
|
4807
|
+
};
|
|
4791
4808
|
const { nodes, links } = useMemo(() => {
|
|
4792
4809
|
const nodes2 = [];
|
|
4793
4810
|
const links2 = [];
|
|
@@ -4983,16 +5000,21 @@ var FiberGraph = React17.memo(
|
|
|
4983
5000
|
const isRoot = d.data.id === nodes[0].id;
|
|
4984
5001
|
const isPreview = !isDialogMode;
|
|
4985
5002
|
const scale = isRoot ? isPreview ? 2 : 1.75 : 1;
|
|
4986
|
-
const
|
|
5003
|
+
const isRendered = renderedFibersRef.current.has(
|
|
5004
|
+
getFiberId(d.data.fiber).toString()
|
|
5005
|
+
);
|
|
5006
|
+
const rect = g.selectAll("rect").data([d]).join("rect").attr("x", -75 * scale).attr("y", -30 * scale).attr("width", 150 * scale).attr("height", 60 * scale).attr("rx", 6 * scale).attr("fill", isCompositeFiber(d.data.fiber) ? "#FFF" : "#232323").attr("stroke", isRendered ? "#FFC799" : "#505050").attr("stroke-width", isRoot ? "3" : "2");
|
|
4987
5007
|
rect.on("mouseover", function() {
|
|
4988
5008
|
select_default2(this).attr("stroke", "#808080").attr("stroke-width", isRoot ? "4" : "3");
|
|
4989
5009
|
}).on("mouseout", function() {
|
|
4990
|
-
select_default2(this).attr("stroke", "#505050").attr("stroke-width", isRoot ? "3" : "2");
|
|
5010
|
+
select_default2(this).attr("stroke", isRendered ? "#FFC799" : "#505050").attr("stroke-width", isRoot ? "3" : "2");
|
|
4991
5011
|
});
|
|
5012
|
+
const renderCount = renderCounts.get(d.data.fiber) || 0;
|
|
5013
|
+
const renderText = renderCount > 0 ? ` \xD7${renderCount}` : "";
|
|
4992
5014
|
g.selectAll("text.name").data([d]).join("text").attr("class", "name").attr("text-anchor", "middle").attr("dy", `${-0.6 * scale}em`).attr("fill", isCompositeFiber(d.data.fiber) ? "#000" : "#FFF").attr("font-weight", "500").attr(
|
|
4993
5015
|
"font-size",
|
|
4994
5016
|
isRoot ? isPreview ? "1.75em" : "1.5em" : "1em"
|
|
4995
|
-
).text(d.data.name);
|
|
5017
|
+
).text(d.data.name + renderText);
|
|
4996
5018
|
g.selectAll("text.props").data([d]).join("text").attr("class", "props").attr("text-anchor", "middle").attr("dy", `${0.9 * scale}em`).attr("fill", isCompositeFiber(d.data.fiber) ? "#666" : "#999").attr(
|
|
4997
5019
|
"font-size",
|
|
4998
5020
|
isRoot ? isPreview ? "1.25em" : "1.1em" : "0.75em"
|
|
@@ -5057,7 +5079,173 @@ var FiberGraph = React17.memo(
|
|
|
5057
5079
|
setTimeout(handleFit, 0);
|
|
5058
5080
|
}
|
|
5059
5081
|
}, [nodes.length, handleFit]);
|
|
5060
|
-
|
|
5082
|
+
useEffect(() => {
|
|
5083
|
+
onCommitFiberRoot((root2) => {
|
|
5084
|
+
if (flashTimeoutRef.current) {
|
|
5085
|
+
clearTimeout(flashTimeoutRef.current);
|
|
5086
|
+
}
|
|
5087
|
+
renderedFibersRef.current = /* @__PURE__ */ new Set();
|
|
5088
|
+
traverseRenderedFibers(root2, (renderedFiber) => {
|
|
5089
|
+
const fiberId = getFiberId(renderedFiber).toString();
|
|
5090
|
+
renderedFibersRef.current.add(fiberId);
|
|
5091
|
+
const states = fiberStates.get(fiberId) || [];
|
|
5092
|
+
states.push({
|
|
5093
|
+
props: renderedFiber.memoizedProps ?? {},
|
|
5094
|
+
hookState: renderedFiber.memoizedState ?? {},
|
|
5095
|
+
timestamp: Date.now()
|
|
5096
|
+
});
|
|
5097
|
+
fiberStates.set(fiberId, states);
|
|
5098
|
+
renderCounts.set(renderedFiber, (renderCounts.get(renderedFiber) || 0) + 1);
|
|
5099
|
+
});
|
|
5100
|
+
if (nodesGroupRef.current) {
|
|
5101
|
+
const nodeElements = select_default2(nodesGroupRef.current).selectAll("g");
|
|
5102
|
+
nodeElements.each(function(d) {
|
|
5103
|
+
const isRendered = renderedFibersRef.current.has(
|
|
5104
|
+
getFiberId(d.data.fiber).toString()
|
|
5105
|
+
);
|
|
5106
|
+
if (isRendered) {
|
|
5107
|
+
const rect = select_default2(this).select("rect");
|
|
5108
|
+
rect.attr("stroke", "#FFC799").style("filter", "drop-shadow(0 0 8px #FFC799)").transition().duration(400).style("filter", "none").attr("stroke", "#505050");
|
|
5109
|
+
const renderCount = renderCounts.get(d.data.fiber) || 0;
|
|
5110
|
+
const renderText = renderCount > 0 ? ` \xD7${renderCount}` : "";
|
|
5111
|
+
select_default2(this).select("text.name").text(d.data.name + renderText);
|
|
5112
|
+
}
|
|
5113
|
+
});
|
|
5114
|
+
}
|
|
5115
|
+
flashTimeoutRef.current = setTimeout(() => {
|
|
5116
|
+
renderedFibersRef.current = /* @__PURE__ */ new Set();
|
|
5117
|
+
}, 400);
|
|
5118
|
+
});
|
|
5119
|
+
return () => {
|
|
5120
|
+
if (flashTimeoutRef.current) {
|
|
5121
|
+
clearTimeout(flashTimeoutRef.current);
|
|
5122
|
+
}
|
|
5123
|
+
};
|
|
5124
|
+
}, []);
|
|
5125
|
+
const handleTimelineChange = useCallback((index) => {
|
|
5126
|
+
setTimelineIndex(index);
|
|
5127
|
+
const fiberId = getFiberId(fiber).toString();
|
|
5128
|
+
const states = fiberStates.get(fiberId);
|
|
5129
|
+
if (states?.[index]) {
|
|
5130
|
+
const rdtHook = getRDTHook();
|
|
5131
|
+
if (rdtHook?.renderers.size > 0) {
|
|
5132
|
+
const renderer = Array.from(rdtHook.renderers.values())?.[0];
|
|
5133
|
+
const overrideProps = renderer?.currentDispatcherRef?.current?.overrideProps;
|
|
5134
|
+
const overrideHookState = renderer?.currentDispatcherRef?.current?.overrideHookState;
|
|
5135
|
+
const state = states?.[index];
|
|
5136
|
+
if (state) {
|
|
5137
|
+
if (overrideProps) {
|
|
5138
|
+
overrideProps(fiber, state.props);
|
|
5139
|
+
}
|
|
5140
|
+
if (overrideHookState) {
|
|
5141
|
+
overrideHookState(fiber, state.hookState);
|
|
5142
|
+
}
|
|
5143
|
+
}
|
|
5144
|
+
}
|
|
5145
|
+
}
|
|
5146
|
+
}, [fiber]);
|
|
5147
|
+
const handlePlayPause = useCallback(() => {
|
|
5148
|
+
setIsPlaying((prev) => !prev);
|
|
5149
|
+
}, []);
|
|
5150
|
+
const handleStepForward = useCallback(() => {
|
|
5151
|
+
const states = fiberStates.get(getFiberId(fiber).toString());
|
|
5152
|
+
if (states) {
|
|
5153
|
+
const nextIndex = Math.min(timelineIndex + 1, states.length - 1);
|
|
5154
|
+
handleTimelineChange(nextIndex);
|
|
5155
|
+
}
|
|
5156
|
+
}, [fiber, timelineIndex, handleTimelineChange]);
|
|
5157
|
+
const handleStepBack = useCallback(() => {
|
|
5158
|
+
const states = fiberStates.get(getFiberId(fiber).toString());
|
|
5159
|
+
if (states) {
|
|
5160
|
+
const prevIndex = Math.max(timelineIndex - 1, 0);
|
|
5161
|
+
handleTimelineChange(prevIndex);
|
|
5162
|
+
}
|
|
5163
|
+
}, [fiber, timelineIndex, handleTimelineChange]);
|
|
5164
|
+
useEffect(() => {
|
|
5165
|
+
if (isPlaying) {
|
|
5166
|
+
playIntervalRef.current = setInterval(() => {
|
|
5167
|
+
const states = fiberStates.get(getFiberId(fiber).toString());
|
|
5168
|
+
if (states) {
|
|
5169
|
+
const nextIndex = timelineIndex + 1;
|
|
5170
|
+
if (nextIndex >= states.length) {
|
|
5171
|
+
setIsPlaying(false);
|
|
5172
|
+
} else {
|
|
5173
|
+
handleTimelineChange(nextIndex);
|
|
5174
|
+
}
|
|
5175
|
+
}
|
|
5176
|
+
}, 1e3);
|
|
5177
|
+
} else if (playIntervalRef.current) {
|
|
5178
|
+
clearInterval(playIntervalRef.current);
|
|
5179
|
+
}
|
|
5180
|
+
return () => {
|
|
5181
|
+
if (playIntervalRef.current) {
|
|
5182
|
+
clearInterval(playIntervalRef.current);
|
|
5183
|
+
}
|
|
5184
|
+
};
|
|
5185
|
+
}, [isPlaying, fiber, timelineIndex, handleTimelineChange]);
|
|
5186
|
+
return /* @__PURE__ */ React17.createElement("div", { style: { height: "50ch", marginTop: "2ch", display: "flex", flexDirection: "column", position: "relative" } }, isDialogMode && /* @__PURE__ */ React17.createElement("div", { style: {
|
|
5187
|
+
display: "flex",
|
|
5188
|
+
gap: "0.5ch",
|
|
5189
|
+
marginBottom: "1ch",
|
|
5190
|
+
padding: "0 1ch",
|
|
5191
|
+
borderBottom: "1px solid #282828"
|
|
5192
|
+
} }, /* @__PURE__ */ React17.createElement(
|
|
5193
|
+
"button",
|
|
5194
|
+
{
|
|
5195
|
+
type: "button",
|
|
5196
|
+
onClick: () => setActiveTab("graph"),
|
|
5197
|
+
style: {
|
|
5198
|
+
background: "transparent",
|
|
5199
|
+
border: "none",
|
|
5200
|
+
color: activeTab === "graph" ? "#FFC799" : "#A0A0A0",
|
|
5201
|
+
padding: "1ch",
|
|
5202
|
+
cursor: "pointer",
|
|
5203
|
+
position: "relative",
|
|
5204
|
+
fontSize: "0.875rem",
|
|
5205
|
+
fontWeight: activeTab === "graph" ? 500 : 400
|
|
5206
|
+
}
|
|
5207
|
+
},
|
|
5208
|
+
"Graph View",
|
|
5209
|
+
activeTab === "graph" && /* @__PURE__ */ React17.createElement("div", { style: {
|
|
5210
|
+
position: "absolute",
|
|
5211
|
+
bottom: "-1px",
|
|
5212
|
+
left: 0,
|
|
5213
|
+
right: 0,
|
|
5214
|
+
height: "2px",
|
|
5215
|
+
background: "#FFC799",
|
|
5216
|
+
borderRadius: "2px 2px 0 0"
|
|
5217
|
+
} })
|
|
5218
|
+
), /* @__PURE__ */ React17.createElement(
|
|
5219
|
+
"button",
|
|
5220
|
+
{
|
|
5221
|
+
type: "button",
|
|
5222
|
+
onClick: () => setActiveTab("fiber"),
|
|
5223
|
+
style: {
|
|
5224
|
+
background: "transparent",
|
|
5225
|
+
border: "none",
|
|
5226
|
+
color: activeTab === "fiber" ? "#FFC799" : "#A0A0A0",
|
|
5227
|
+
padding: "1ch",
|
|
5228
|
+
cursor: "pointer",
|
|
5229
|
+
position: "relative",
|
|
5230
|
+
fontSize: "0.875rem",
|
|
5231
|
+
fontWeight: activeTab === "fiber" ? 500 : 400
|
|
5232
|
+
}
|
|
5233
|
+
},
|
|
5234
|
+
"Fiber View",
|
|
5235
|
+
activeTab === "fiber" && /* @__PURE__ */ React17.createElement("div", { style: {
|
|
5236
|
+
position: "absolute",
|
|
5237
|
+
bottom: "-1px",
|
|
5238
|
+
left: 0,
|
|
5239
|
+
right: 0,
|
|
5240
|
+
height: "2px",
|
|
5241
|
+
background: "#FFC799",
|
|
5242
|
+
borderRadius: "2px 2px 0 0"
|
|
5243
|
+
} })
|
|
5244
|
+
)), /* @__PURE__ */ React17.createElement("div", { style: { position: "relative", flex: 1 } }, /* @__PURE__ */ React17.createElement("div", { style: {
|
|
5245
|
+
position: "absolute",
|
|
5246
|
+
inset: 0,
|
|
5247
|
+
display: activeTab === "graph" ? "block" : "none"
|
|
5248
|
+
} }, /* @__PURE__ */ React17.createElement(
|
|
5061
5249
|
Controls,
|
|
5062
5250
|
{
|
|
5063
5251
|
onZoomIn: handleZoomIn,
|
|
@@ -5082,7 +5270,213 @@ var FiberGraph = React17.memo(
|
|
|
5082
5270
|
},
|
|
5083
5271
|
/* @__PURE__ */ React17.createElement("title", null, "Fiber Tree Visualization"),
|
|
5084
5272
|
/* @__PURE__ */ React17.createElement("g", { ref: svgGroupRef }, /* @__PURE__ */ React17.createElement("g", { ref: linksGroupRef, className: "links" }), /* @__PURE__ */ React17.createElement("g", { ref: nodesGroupRef, className: "nodes" }))
|
|
5085
|
-
))
|
|
5273
|
+
)), /* @__PURE__ */ React17.createElement("div", { style: {
|
|
5274
|
+
position: "absolute",
|
|
5275
|
+
inset: 0,
|
|
5276
|
+
display: activeTab === "fiber" ? "block" : "none",
|
|
5277
|
+
overflow: "auto",
|
|
5278
|
+
background: "#101010",
|
|
5279
|
+
borderRadius: "0.25rem",
|
|
5280
|
+
padding: "1ch"
|
|
5281
|
+
} }, /* @__PURE__ */ React17.createElement(
|
|
5282
|
+
Inspector,
|
|
5283
|
+
{
|
|
5284
|
+
theme: theme3,
|
|
5285
|
+
data: fiber,
|
|
5286
|
+
expandLevel: isDialogMode ? 1 : 0,
|
|
5287
|
+
table: false,
|
|
5288
|
+
nodeRenderer: (props) => {
|
|
5289
|
+
const Component = props.depth === 0 ? ObjectRootLabel : ObjectLabel;
|
|
5290
|
+
return /* @__PURE__ */ React17.createElement(
|
|
5291
|
+
"span",
|
|
5292
|
+
{
|
|
5293
|
+
onMouseEnter: (e) => handlePropertyHover(e, props.name),
|
|
5294
|
+
onMouseLeave: handlePropertyLeave,
|
|
5295
|
+
style: {
|
|
5296
|
+
cursor: FIBER_PROP_EXPLANATIONS[props.name] ? "help" : "default",
|
|
5297
|
+
padding: "1px 0",
|
|
5298
|
+
display: "inline-block",
|
|
5299
|
+
fontWeight: FIBER_PROP_EXPLANATIONS[props.name] ? 500 : "normal"
|
|
5300
|
+
}
|
|
5301
|
+
},
|
|
5302
|
+
/* @__PURE__ */ React17.createElement(
|
|
5303
|
+
Component,
|
|
5304
|
+
{
|
|
5305
|
+
name: props.name,
|
|
5306
|
+
data: props.data,
|
|
5307
|
+
isNonenumerable: props.isNonenumerable
|
|
5308
|
+
}
|
|
5309
|
+
)
|
|
5310
|
+
);
|
|
5311
|
+
}
|
|
5312
|
+
}
|
|
5313
|
+
), tooltip && /* @__PURE__ */ React17.createElement("div", { style: {
|
|
5314
|
+
position: "absolute",
|
|
5315
|
+
zIndex: 1001,
|
|
5316
|
+
backgroundColor: "#161616",
|
|
5317
|
+
color: "#FFF",
|
|
5318
|
+
bottom: "2ch",
|
|
5319
|
+
right: "2ch",
|
|
5320
|
+
pointerEvents: "none",
|
|
5321
|
+
overflowY: "auto",
|
|
5322
|
+
padding: "1ch",
|
|
5323
|
+
fontSize: "1ch",
|
|
5324
|
+
border: "1px solid #282828",
|
|
5325
|
+
borderRadius: "0.25ch"
|
|
5326
|
+
} }, tooltip))), isDialogMode && /* @__PURE__ */ React17.createElement("div", { style: {
|
|
5327
|
+
background: "#161616",
|
|
5328
|
+
padding: "1ch",
|
|
5329
|
+
margin: "1ch 1ch 0 1ch",
|
|
5330
|
+
borderRadius: "0.25rem",
|
|
5331
|
+
border: "1px solid #282828",
|
|
5332
|
+
display: "flex",
|
|
5333
|
+
flexDirection: "column",
|
|
5334
|
+
gap: "0.5ch",
|
|
5335
|
+
opacity: fiberStates.get(getFiberId(fiber).toString())?.length ? 1 : 0.5
|
|
5336
|
+
} }, /* @__PURE__ */ React17.createElement("div", { style: { display: "flex", alignItems: "center", gap: "0.5ch" } }, /* @__PURE__ */ React17.createElement(
|
|
5337
|
+
"button",
|
|
5338
|
+
{
|
|
5339
|
+
type: "button",
|
|
5340
|
+
onClick: handleStepBack,
|
|
5341
|
+
disabled: !fiberStates.get(getFiberId(fiber).toString())?.length,
|
|
5342
|
+
style: {
|
|
5343
|
+
background: "transparent",
|
|
5344
|
+
border: "1px solid #282828",
|
|
5345
|
+
color: "#FFF",
|
|
5346
|
+
borderRadius: "0.25rem",
|
|
5347
|
+
cursor: fiberStates.get(getFiberId(fiber).toString())?.length ? "pointer" : "not-allowed",
|
|
5348
|
+
padding: "0.25ch 0.5ch"
|
|
5349
|
+
}
|
|
5350
|
+
},
|
|
5351
|
+
"\u23EE"
|
|
5352
|
+
), /* @__PURE__ */ React17.createElement(
|
|
5353
|
+
"button",
|
|
5354
|
+
{
|
|
5355
|
+
type: "button",
|
|
5356
|
+
onClick: handlePlayPause,
|
|
5357
|
+
disabled: !fiberStates.get(getFiberId(fiber).toString())?.length,
|
|
5358
|
+
style: {
|
|
5359
|
+
background: "transparent",
|
|
5360
|
+
border: "1px solid #282828",
|
|
5361
|
+
color: "#FFF",
|
|
5362
|
+
borderRadius: "0.25rem",
|
|
5363
|
+
cursor: fiberStates.get(getFiberId(fiber).toString())?.length ? "pointer" : "not-allowed",
|
|
5364
|
+
padding: "0.25ch 0.5ch"
|
|
5365
|
+
}
|
|
5366
|
+
},
|
|
5367
|
+
isPlaying ? "\u23F8" : "\u25B6\uFE0F"
|
|
5368
|
+
), /* @__PURE__ */ React17.createElement(
|
|
5369
|
+
"button",
|
|
5370
|
+
{
|
|
5371
|
+
type: "button",
|
|
5372
|
+
onClick: handleStepForward,
|
|
5373
|
+
disabled: !fiberStates.get(getFiberId(fiber).toString())?.length,
|
|
5374
|
+
style: {
|
|
5375
|
+
background: "transparent",
|
|
5376
|
+
border: "1px solid #282828",
|
|
5377
|
+
color: "#FFF",
|
|
5378
|
+
borderRadius: "0.25rem",
|
|
5379
|
+
cursor: fiberStates.get(getFiberId(fiber).toString())?.length ? "pointer" : "not-allowed",
|
|
5380
|
+
padding: "0.25ch 0.5ch"
|
|
5381
|
+
}
|
|
5382
|
+
},
|
|
5383
|
+
"\u23ED"
|
|
5384
|
+
), /* @__PURE__ */ React17.createElement("span", { style: { color: "#A0A0A0", fontSize: "0.75rem" } }, timelineIndex >= 0 && fiberStates.get(getFiberId(fiber).toString())?.[timelineIndex]?.timestamp ? new Date(fiberStates.get(getFiberId(fiber).toString())?.[timelineIndex]?.timestamp ?? 0).toLocaleTimeString() : "--:--:--"), !fiberStates.get(getFiberId(fiber).toString())?.length && /* @__PURE__ */ React17.createElement("span", { style: { color: "#A0A0A0", fontSize: "0.75rem", marginLeft: "auto" } }, "No state changes recorded yet")), /* @__PURE__ */ React17.createElement("div", { style: {
|
|
5385
|
+
display: "flex",
|
|
5386
|
+
alignItems: "center",
|
|
5387
|
+
gap: "0.25ch",
|
|
5388
|
+
height: "2ch",
|
|
5389
|
+
position: "relative"
|
|
5390
|
+
} }, (fiberStates.get(getFiberId(fiber).toString()) ?? []).map((state, i) => {
|
|
5391
|
+
const isActive = i === timelineIndex;
|
|
5392
|
+
return /* @__PURE__ */ React17.createElement(
|
|
5393
|
+
"div",
|
|
5394
|
+
{
|
|
5395
|
+
key: state.timestamp,
|
|
5396
|
+
onClick: () => handleTimelineChange(i),
|
|
5397
|
+
onKeyDown: (e) => {
|
|
5398
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
5399
|
+
handleTimelineChange(i);
|
|
5400
|
+
}
|
|
5401
|
+
},
|
|
5402
|
+
role: "button",
|
|
5403
|
+
tabIndex: 0,
|
|
5404
|
+
style: {
|
|
5405
|
+
flex: 1,
|
|
5406
|
+
height: "100%",
|
|
5407
|
+
background: isActive ? "#FFC799" : "#282828",
|
|
5408
|
+
cursor: "pointer",
|
|
5409
|
+
position: "relative",
|
|
5410
|
+
borderRadius: "0.125rem",
|
|
5411
|
+
transition: "background-color 150ms",
|
|
5412
|
+
outline: "none"
|
|
5413
|
+
},
|
|
5414
|
+
onMouseEnter: (e) => {
|
|
5415
|
+
const target = e.currentTarget;
|
|
5416
|
+
const tooltip2 = document.createElement("div");
|
|
5417
|
+
tooltip2.style.position = "absolute";
|
|
5418
|
+
tooltip2.style.bottom = "100%";
|
|
5419
|
+
tooltip2.style.left = "50%";
|
|
5420
|
+
tooltip2.style.transform = "translateX(-50%)";
|
|
5421
|
+
tooltip2.style.background = "#161616";
|
|
5422
|
+
tooltip2.style.color = "#FFF";
|
|
5423
|
+
tooltip2.style.padding = "0.5ch";
|
|
5424
|
+
tooltip2.style.borderRadius = "0.25rem";
|
|
5425
|
+
tooltip2.style.fontSize = "0.75rem";
|
|
5426
|
+
tooltip2.style.whiteSpace = "nowrap";
|
|
5427
|
+
tooltip2.style.pointerEvents = "none";
|
|
5428
|
+
tooltip2.style.border = "1px solid #282828";
|
|
5429
|
+
tooltip2.style.zIndex = "1000";
|
|
5430
|
+
const changes = [];
|
|
5431
|
+
const states = fiberStates.get(getFiberId(fiber).toString());
|
|
5432
|
+
const prevState = i > 0 && states ? states[i - 1] : null;
|
|
5433
|
+
if (prevState) {
|
|
5434
|
+
const propChanges = Object.keys(state.props).filter(
|
|
5435
|
+
(key) => state.props[key] !== prevState.props[key]
|
|
5436
|
+
);
|
|
5437
|
+
if (propChanges.length > 0) {
|
|
5438
|
+
changes.push(`Props: ${propChanges.join(", ")}`);
|
|
5439
|
+
}
|
|
5440
|
+
const hookChanges = Object.keys(state.hookState).filter(
|
|
5441
|
+
(key) => state.hookState[key] !== prevState.hookState[key]
|
|
5442
|
+
);
|
|
5443
|
+
if (hookChanges.length > 0) {
|
|
5444
|
+
changes.push(`State: ${hookChanges.join(", ")}`);
|
|
5445
|
+
}
|
|
5446
|
+
}
|
|
5447
|
+
tooltip2.textContent = changes.length > 0 ? changes.join(" | ") : prevState ? "No changes" : "Initial state";
|
|
5448
|
+
target.appendChild(tooltip2);
|
|
5449
|
+
},
|
|
5450
|
+
onMouseLeave: (e) => {
|
|
5451
|
+
const tooltip2 = e.currentTarget.querySelector("div");
|
|
5452
|
+
if (tooltip2) {
|
|
5453
|
+
tooltip2.remove();
|
|
5454
|
+
}
|
|
5455
|
+
}
|
|
5456
|
+
}
|
|
5457
|
+
);
|
|
5458
|
+
}), !fiberStates.get(getFiberId(fiber).toString())?.length && /* @__PURE__ */ React17.createElement("div", { style: {
|
|
5459
|
+
flex: 1,
|
|
5460
|
+
height: "100%",
|
|
5461
|
+
background: "#282828",
|
|
5462
|
+
borderRadius: "0.125rem",
|
|
5463
|
+
opacity: 0.5
|
|
5464
|
+
} })), /* @__PURE__ */ React17.createElement(
|
|
5465
|
+
"input",
|
|
5466
|
+
{
|
|
5467
|
+
type: "range",
|
|
5468
|
+
min: 0,
|
|
5469
|
+
max: (fiberStates.get(getFiberId(fiber).toString())?.length ?? 1) - 1,
|
|
5470
|
+
value: timelineIndex,
|
|
5471
|
+
onChange: (e) => handleTimelineChange(Number(e.target.value)),
|
|
5472
|
+
disabled: !fiberStates.get(getFiberId(fiber).toString())?.length,
|
|
5473
|
+
style: {
|
|
5474
|
+
width: "100%",
|
|
5475
|
+
accentColor: "#FFC799",
|
|
5476
|
+
opacity: fiberStates.get(getFiberId(fiber).toString())?.length ? 1 : 0.5
|
|
5477
|
+
}
|
|
5478
|
+
}
|
|
5479
|
+
)));
|
|
5086
5480
|
}
|
|
5087
5481
|
);
|
|
5088
5482
|
var Inspector2 = React17.memo(
|
|
@@ -5103,14 +5497,6 @@ var Inspector2 = React17.memo(
|
|
|
5103
5497
|
const fiber2 = getFiberFromHostInstance(element);
|
|
5104
5498
|
return fiber2;
|
|
5105
5499
|
}, [selectedFiber, element]);
|
|
5106
|
-
const handlePropertyHover = (_e, propName) => {
|
|
5107
|
-
if (!isDialogMode) return;
|
|
5108
|
-
const explanation = FIBER_PROP_EXPLANATIONS[propName];
|
|
5109
|
-
setTooltip(explanation || null);
|
|
5110
|
-
};
|
|
5111
|
-
const handlePropertyLeave = () => {
|
|
5112
|
-
setTooltip(null);
|
|
5113
|
-
};
|
|
5114
5500
|
const handleFiberSelect = (fiber2) => {
|
|
5115
5501
|
if (fiber2 !== selectedFiber) {
|
|
5116
5502
|
if (!isDialogMode) {
|
|
@@ -5416,52 +5802,6 @@ var Inspector2 = React17.memo(
|
|
|
5416
5802
|
isDialogMode
|
|
5417
5803
|
}
|
|
5418
5804
|
),
|
|
5419
|
-
/* @__PURE__ */ React17.createElement(
|
|
5420
|
-
"div",
|
|
5421
|
-
{
|
|
5422
|
-
onMouseLeave: handlePropertyLeave,
|
|
5423
|
-
style: {
|
|
5424
|
-
flex: isDialogMode ? 1 : "none",
|
|
5425
|
-
overflow: "auto",
|
|
5426
|
-
marginTop: "1ch",
|
|
5427
|
-
borderTop: "1px solid #282828",
|
|
5428
|
-
paddingTop: "1ch"
|
|
5429
|
-
}
|
|
5430
|
-
},
|
|
5431
|
-
/* @__PURE__ */ React17.createElement(
|
|
5432
|
-
Inspector,
|
|
5433
|
-
{
|
|
5434
|
-
theme: theme3,
|
|
5435
|
-
data: fiber,
|
|
5436
|
-
expandLevel: isDialogMode ? 1 : 0,
|
|
5437
|
-
table: false,
|
|
5438
|
-
nodeRenderer: (props) => {
|
|
5439
|
-
const Component = props.depth === 0 ? ObjectRootLabel : ObjectLabel;
|
|
5440
|
-
return /* @__PURE__ */ React17.createElement(
|
|
5441
|
-
"span",
|
|
5442
|
-
{
|
|
5443
|
-
onMouseEnter: (e) => handlePropertyHover(e, props.name),
|
|
5444
|
-
onMouseLeave: handlePropertyLeave,
|
|
5445
|
-
style: {
|
|
5446
|
-
cursor: FIBER_PROP_EXPLANATIONS[props.name] ? "help" : "default",
|
|
5447
|
-
padding: "1px 0",
|
|
5448
|
-
display: "inline-block",
|
|
5449
|
-
fontWeight: FIBER_PROP_EXPLANATIONS[props.name] ? 500 : "normal"
|
|
5450
|
-
}
|
|
5451
|
-
},
|
|
5452
|
-
/* @__PURE__ */ React17.createElement(
|
|
5453
|
-
Component,
|
|
5454
|
-
{
|
|
5455
|
-
name: props.name,
|
|
5456
|
-
data: props.data,
|
|
5457
|
-
isNonenumerable: props.isNonenumerable
|
|
5458
|
-
}
|
|
5459
|
-
)
|
|
5460
|
-
);
|
|
5461
|
-
}
|
|
5462
|
-
}
|
|
5463
|
-
)
|
|
5464
|
-
),
|
|
5465
5805
|
tooltip && /* @__PURE__ */ React17.createElement(
|
|
5466
5806
|
"div",
|
|
5467
5807
|
{
|
package/dist/sw.cjs
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @license bippy
|
|
5
|
+
*
|
|
6
|
+
* Copyright (c) Aiden Bai, Million Software, Inc.
|
|
7
|
+
*
|
|
8
|
+
* This source code is licensed under the MIT license found in the
|
|
9
|
+
* LICENSE file in the root directory of this source tree.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
// src/sw.ts
|
|
13
|
+
(() => {
|
|
14
|
+
try {
|
|
15
|
+
const NO_OP = () => {
|
|
16
|
+
};
|
|
17
|
+
const renderers = /* @__PURE__ */ new Map();
|
|
18
|
+
let id = 0;
|
|
19
|
+
globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__ = {
|
|
20
|
+
checkDCE: NO_OP,
|
|
21
|
+
supportsFiber: true,
|
|
22
|
+
supportsFlight: true,
|
|
23
|
+
hasUnsupportedRendererAttached: false,
|
|
24
|
+
renderers,
|
|
25
|
+
onCommitFiberRoot: NO_OP,
|
|
26
|
+
onCommitFiberUnmount: NO_OP,
|
|
27
|
+
onPostCommitFiberRoot: NO_OP,
|
|
28
|
+
inject(renderer) {
|
|
29
|
+
const nextID = ++id;
|
|
30
|
+
renderers.set(nextID, renderer);
|
|
31
|
+
globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__._instrumentationIsActive = true;
|
|
32
|
+
return nextID;
|
|
33
|
+
},
|
|
34
|
+
_instrumentationIsActive: false
|
|
35
|
+
};
|
|
36
|
+
} catch {
|
|
37
|
+
}
|
|
38
|
+
})();
|
package/dist/sw.d.cts
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { FiberRoot, Fiber as Fiber$1, ReactContext, Lanes } from 'react-reconciler';
|
|
2
|
+
|
|
3
|
+
interface ReactDevToolsGlobalHook {
|
|
4
|
+
checkDCE: (fn: unknown) => void;
|
|
5
|
+
supportsFiber: boolean;
|
|
6
|
+
supportsFlight: boolean;
|
|
7
|
+
renderers: Map<number, ReactRenderer>;
|
|
8
|
+
hasUnsupportedRendererAttached: boolean;
|
|
9
|
+
onCommitFiberRoot: (rendererID: number, root: FiberRoot, priority: void | number) => void;
|
|
10
|
+
onCommitFiberUnmount: (rendererID: number, fiber: Fiber) => void;
|
|
11
|
+
onPostCommitFiberRoot: (rendererID: number, root: FiberRoot) => void;
|
|
12
|
+
inject: (renderer: ReactRenderer) => number;
|
|
13
|
+
_instrumentationSource?: string;
|
|
14
|
+
_instrumentationIsActive?: boolean;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Represents a react-internal Fiber node.
|
|
18
|
+
*/
|
|
19
|
+
type Fiber<T = any> = Omit<Fiber$1, 'stateNode' | 'dependencies' | 'child' | 'sibling' | 'return' | 'alternate' | 'memoizedProps' | 'pendingProps' | 'memoizedState' | 'updateQueue'> & {
|
|
20
|
+
stateNode: T;
|
|
21
|
+
dependencies: Dependencies | null;
|
|
22
|
+
child: Fiber | null;
|
|
23
|
+
sibling: Fiber | null;
|
|
24
|
+
return: Fiber | null;
|
|
25
|
+
alternate: Fiber | null;
|
|
26
|
+
memoizedProps: Props;
|
|
27
|
+
pendingProps: Props;
|
|
28
|
+
memoizedState: MemoizedState;
|
|
29
|
+
updateQueue: {
|
|
30
|
+
lastEffect: Effect | null;
|
|
31
|
+
[key: string]: unknown;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
interface ReactRenderer {
|
|
35
|
+
version: string;
|
|
36
|
+
bundleType: 0 | 1;
|
|
37
|
+
findFiberByHostInstance?: (hostInstance: unknown) => Fiber | null;
|
|
38
|
+
}
|
|
39
|
+
interface ContextDependency<T> {
|
|
40
|
+
context: ReactContext<T>;
|
|
41
|
+
memoizedValue: T;
|
|
42
|
+
observedBits: number;
|
|
43
|
+
next: ContextDependency<unknown> | null;
|
|
44
|
+
}
|
|
45
|
+
interface Dependencies {
|
|
46
|
+
lanes: Lanes;
|
|
47
|
+
firstContext: ContextDependency<unknown> | null;
|
|
48
|
+
}
|
|
49
|
+
interface Effect {
|
|
50
|
+
next: Effect | null;
|
|
51
|
+
create: (...args: unknown[]) => unknown;
|
|
52
|
+
destroy: ((...args: unknown[]) => unknown) | null;
|
|
53
|
+
deps: unknown[] | null;
|
|
54
|
+
tag: number;
|
|
55
|
+
[key: string]: unknown;
|
|
56
|
+
}
|
|
57
|
+
interface MemoizedState {
|
|
58
|
+
memoizedState: unknown;
|
|
59
|
+
next: MemoizedState | null;
|
|
60
|
+
[key: string]: unknown;
|
|
61
|
+
}
|
|
62
|
+
interface Props {
|
|
63
|
+
[key: string]: unknown;
|
|
64
|
+
}
|
|
65
|
+
declare global {
|
|
66
|
+
var __REACT_DEVTOOLS_GLOBAL_HOOK__: ReactDevToolsGlobalHook;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export type { ContextDependency as C, Dependencies as D, Effect as E, Fiber as F, MemoizedState as M, Props as P, ReactDevToolsGlobalHook as R, ReactRenderer as a };
|