@tomaszjarosz/react-visualizers 0.4.9 → 0.4.10
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/index.cjs +34 -19
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +34 -19
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -7823,7 +7823,7 @@ const TreeSetInterviewVisualizerComponent = ({
|
|
|
7823
7823
|
/* @__PURE__ */ jsxRuntime.jsx("code", { className: "bg-white px-2 py-0.5 rounded", children: "left < node < right" })
|
|
7824
7824
|
] }) }),
|
|
7825
7825
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mb-4", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "bg-gray-50 rounded-lg p-2 overflow-x-auto", children: tree ? /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "300", height: "250", className: "mx-auto", children: renderTree(tree) }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-32 flex items-center justify-center text-gray-400 text-sm", children: "Empty tree" }) }) }),
|
|
7826
|
-
|
|
7826
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mb-4 p-3 bg-gray-100 rounded-lg min-h-[44px]", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-xs text-gray-600", children: path.length > 0 ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
7827
7827
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-medium", children: "Path:" }),
|
|
7828
7828
|
" ",
|
|
7829
7829
|
path.map((v, idx) => /* @__PURE__ */ jsxRuntime.jsxs(React.Fragment, { children: [
|
|
@@ -7836,7 +7836,7 @@ const TreeSetInterviewVisualizerComponent = ({
|
|
|
7836
7836
|
}
|
|
7837
7837
|
)
|
|
7838
7838
|
] }, idx))
|
|
7839
|
-
] }) })
|
|
7839
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-gray-400 italic", children: "Path will appear here..." }) }) })
|
|
7840
7840
|
] });
|
|
7841
7841
|
const sidePanel = mode === "interview" ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
7842
7842
|
InterviewModePanel,
|
|
@@ -8135,13 +8135,13 @@ const SortingInterviewVisualizerComponent = ({
|
|
|
8135
8135
|
"]"
|
|
8136
8136
|
] })
|
|
8137
8137
|
] }, index)) }) }),
|
|
8138
|
-
|
|
8138
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mb-4 p-3 bg-purple-50 rounded-lg border border-purple-200 min-h-[44px]", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-sm text-purple-800", children: pivot !== void 0 ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
8139
8139
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-medium", children: "Pivot:" }),
|
|
8140
8140
|
" ",
|
|
8141
8141
|
array[pivot],
|
|
8142
8142
|
" at index ",
|
|
8143
8143
|
pivot
|
|
8144
|
-
] }) })
|
|
8144
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-purple-400 italic", children: "Pivot will be selected..." }) }) })
|
|
8145
8145
|
] });
|
|
8146
8146
|
const modeToggle = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-1 bg-gray-200 rounded-lg p-0.5", children: [
|
|
8147
8147
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -8940,15 +8940,15 @@ const BloomFilterInterviewVisualizerComponent = ({
|
|
|
8940
8940
|
);
|
|
8941
8941
|
}) })
|
|
8942
8942
|
] }),
|
|
8943
|
-
|
|
8943
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
8944
8944
|
"div",
|
|
8945
8945
|
{
|
|
8946
|
-
className: `mb-4 p-3 rounded-lg border ${result === "probably_yes" ? "bg-amber-50 border-amber-200" : "bg-green-50 border-green-200"}`,
|
|
8946
|
+
className: `mb-4 p-3 rounded-lg border min-h-[44px] ${result === "probably_yes" ? "bg-amber-50 border-amber-200" : result === "definitely_no" ? "bg-green-50 border-green-200" : "bg-gray-50 border-gray-200"}`,
|
|
8947
8947
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
8948
8948
|
"div",
|
|
8949
8949
|
{
|
|
8950
|
-
className: `text-sm font-medium text-center ${result === "probably_yes" ? "text-amber-800" : "text-green-800"}`,
|
|
8951
|
-
children: result === "probably_yes" ? "⚠️ Probably in set (could be false positive)" : "✓ Definitely NOT in set"
|
|
8950
|
+
className: `text-sm font-medium text-center ${result === "probably_yes" ? "text-amber-800" : result === "definitely_no" ? "text-green-800" : "text-gray-400 italic"}`,
|
|
8951
|
+
children: result === "probably_yes" ? "⚠️ Probably in set (could be false positive)" : result === "definitely_no" ? "✓ Definitely NOT in set" : "Query result will appear here..."
|
|
8952
8952
|
}
|
|
8953
8953
|
)
|
|
8954
8954
|
}
|
|
@@ -10191,7 +10191,7 @@ const DPInterviewVisualizerComponent = ({
|
|
|
10191
10191
|
row.map((cell, w) => /* @__PURE__ */ jsxRuntime.jsx("td", { className: `p-1 text-center rounded ${getCellStyle(i, w)}`, children: cell }, w))
|
|
10192
10192
|
] }, i)) })
|
|
10193
10193
|
] }) }),
|
|
10194
|
-
|
|
10194
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mb-4 text-center min-h-[32px] flex items-center justify-center", children: currentI > 0 && currentW > 0 && decision ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: `px-3 py-1 rounded-full font-bold text-sm ${decision === "take" ? "bg-green-100 text-green-700" : "bg-amber-100 text-amber-700"}`, children: decision === "take" ? "✓ TAKE" : "✗ SKIP" }) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-gray-400 text-xs italic", children: "Decision will appear here..." }) })
|
|
10195
10195
|
] });
|
|
10196
10196
|
const modeToggle = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-1 bg-gray-200 rounded-lg p-0.5", children: [
|
|
10197
10197
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -10618,13 +10618,13 @@ const ConsistentHashingInterviewVisualizerComponent = ({
|
|
|
10618
10618
|
},
|
|
10619
10619
|
server
|
|
10620
10620
|
)) }),
|
|
10621
|
-
|
|
10621
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mb-4 overflow-x-auto min-h-[100px]", children: /* @__PURE__ */ jsxRuntime.jsxs("table", { className: "w-full text-xs", children: [
|
|
10622
10622
|
/* @__PURE__ */ jsxRuntime.jsx("thead", { children: /* @__PURE__ */ jsxRuntime.jsxs("tr", { className: "bg-gray-100", children: [
|
|
10623
10623
|
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-2 py-1 text-left", children: "Key" }),
|
|
10624
10624
|
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-2 py-1 text-left", children: "Hash" }),
|
|
10625
10625
|
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-2 py-1 text-left", children: "Server" })
|
|
10626
10626
|
] }) }),
|
|
10627
|
-
/* @__PURE__ */ jsxRuntime.jsx("tbody", { children: dataKeys.map((key) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
10627
|
+
/* @__PURE__ */ jsxRuntime.jsx("tbody", { children: dataKeys.length > 0 ? dataKeys.map((key) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
10628
10628
|
"tr",
|
|
10629
10629
|
{
|
|
10630
10630
|
className: `${highlightKey === key.key ? "bg-yellow-100" : ""} ${(movingKeys == null ? void 0 : movingKeys.includes(key.key)) ? "bg-red-100" : ""}`,
|
|
@@ -10638,7 +10638,7 @@ const ConsistentHashingInterviewVisualizerComponent = ({
|
|
|
10638
10638
|
]
|
|
10639
10639
|
},
|
|
10640
10640
|
key.key
|
|
10641
|
-
)) })
|
|
10641
|
+
)) : /* @__PURE__ */ jsxRuntime.jsx("tr", { children: /* @__PURE__ */ jsxRuntime.jsx("td", { colSpan: 3, className: "px-2 py-4 text-center text-gray-400 italic", children: "Keys will be added here..." }) }) })
|
|
10642
10642
|
] }) })
|
|
10643
10643
|
] });
|
|
10644
10644
|
const modeToggle = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-1 bg-gray-200 rounded-lg p-0.5", children: [
|
|
@@ -11068,10 +11068,10 @@ const RaftInterviewVisualizerComponent = ({
|
|
|
11068
11068
|
] }, node.id);
|
|
11069
11069
|
})
|
|
11070
11070
|
] }) }),
|
|
11071
|
-
|
|
11071
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mb-4 text-center min-h-[32px] flex items-center justify-center", children: stepData.messageType ? /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "px-3 py-1 bg-purple-100 text-purple-700 rounded-full text-sm font-medium", children: [
|
|
11072
11072
|
"📨 ",
|
|
11073
11073
|
stepData.messageType
|
|
11074
|
-
] }) }),
|
|
11074
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-gray-400 text-xs italic", children: "Message type will appear here..." }) }),
|
|
11075
11075
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mb-4 overflow-x-auto", children: /* @__PURE__ */ jsxRuntime.jsxs("table", { className: "w-full text-xs", children: [
|
|
11076
11076
|
/* @__PURE__ */ jsxRuntime.jsx("thead", { children: /* @__PURE__ */ jsxRuntime.jsxs("tr", { className: "bg-gray-100", children: [
|
|
11077
11077
|
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-2 py-1 text-left", children: "Node" }),
|
|
@@ -11561,11 +11561,11 @@ const TrieInterviewVisualizerComponent = ({
|
|
|
11561
11561
|
depth: 0
|
|
11562
11562
|
}
|
|
11563
11563
|
) }),
|
|
11564
|
-
|
|
11564
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-2 p-2 rounded border min-h-[36px] flex items-center justify-center bg-purple-50 border-purple-200", children: stepData.matchedWords && stepData.matchedWords.length > 0 && stepData.operation !== "done" ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-xs text-purple-700", children: [
|
|
11565
11565
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-medium", children: "Found:" }),
|
|
11566
11566
|
" ",
|
|
11567
11567
|
stepData.matchedWords.join(", ")
|
|
11568
|
-
] }) })
|
|
11568
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-purple-400 text-xs italic", children: "Matched words will appear here..." }) })
|
|
11569
11569
|
] });
|
|
11570
11570
|
const modeToggle = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-1 bg-gray-200 rounded-lg p-0.5", children: [
|
|
11571
11571
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -21452,7 +21452,7 @@ function generateGCSteps() {
|
|
|
21452
21452
|
variables: { edenUsed: eden.length },
|
|
21453
21453
|
activeSurvivor
|
|
21454
21454
|
});
|
|
21455
|
-
for (let gc = 0; gc <
|
|
21455
|
+
for (let gc = 0; gc < 4; gc++) {
|
|
21456
21456
|
steps.push({
|
|
21457
21457
|
operation: "minor_gc",
|
|
21458
21458
|
objects: objects.map((o) => ({ ...o })),
|
|
@@ -21517,12 +21517,27 @@ function generateGCSteps() {
|
|
|
21517
21517
|
activeSurvivor: activeSurvivor === 0 ? 1 : 0
|
|
21518
21518
|
});
|
|
21519
21519
|
activeSurvivor = activeSurvivor === 0 ? 1 : 0;
|
|
21520
|
-
if (gc <
|
|
21520
|
+
if (gc < 3) {
|
|
21521
|
+
const newObjs = [];
|
|
21521
21522
|
for (let i = 0; i < 3; i++) {
|
|
21522
|
-
const obj = createObject(true);
|
|
21523
|
+
const obj = createObject(gc < 2 ? true : i === 0);
|
|
21523
21524
|
objects.push(obj);
|
|
21524
21525
|
eden.push(obj.id);
|
|
21526
|
+
newObjs.push(obj);
|
|
21525
21527
|
}
|
|
21528
|
+
steps.push({
|
|
21529
|
+
operation: "allocate",
|
|
21530
|
+
objects: objects.map((o) => ({ ...o })),
|
|
21531
|
+
eden: [...eden],
|
|
21532
|
+
survivor0: [...survivor0],
|
|
21533
|
+
survivor1: [...survivor1],
|
|
21534
|
+
old: [...old],
|
|
21535
|
+
description: `Allocated ${newObjs.length} new objects in Eden.`,
|
|
21536
|
+
codeLine: 3,
|
|
21537
|
+
variables: { edenUsed: eden.length },
|
|
21538
|
+
highlightObjects: newObjs.map((o) => o.id),
|
|
21539
|
+
activeSurvivor
|
|
21540
|
+
});
|
|
21526
21541
|
}
|
|
21527
21542
|
}
|
|
21528
21543
|
const oldObjs = objects.filter((o) => old.includes(o.id));
|