@tomaszjarosz/react-visualizers 0.4.4 → 0.4.6
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 +57 -54
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +57 -54
- package/dist/index.js.map +1 -1
- package/dist/react-visualizers.css +52 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -5249,6 +5249,7 @@ const AStarVisualizerComponent = ({
|
|
|
5249
5249
|
showCode = true,
|
|
5250
5250
|
className = ""
|
|
5251
5251
|
}) => {
|
|
5252
|
+
var _a;
|
|
5252
5253
|
const VISUALIZER_ID2 = "astar-visualizer";
|
|
5253
5254
|
const { copyUrlToClipboard } = useUrlState({ prefix: "astar", scrollToId: VISUALIZER_ID2 });
|
|
5254
5255
|
const generateSteps = React.useMemo(() => generateAStarSteps$1, []);
|
|
@@ -5274,8 +5275,8 @@ const AStarVisualizerComponent = ({
|
|
|
5274
5275
|
description: ""
|
|
5275
5276
|
};
|
|
5276
5277
|
const getCellState = (row, col) => {
|
|
5277
|
-
var
|
|
5278
|
-
const cell = (
|
|
5278
|
+
var _a2, _b, _c, _d;
|
|
5279
|
+
const cell = (_a2 = stepData.grid[row]) == null ? void 0 : _a2[col];
|
|
5279
5280
|
if (!cell) return "default";
|
|
5280
5281
|
if (cell.isStart) return "start";
|
|
5281
5282
|
if (cell.isEnd) return "end";
|
|
@@ -5354,7 +5355,7 @@ const AStarVisualizerComponent = ({
|
|
|
5354
5355
|
colIdx
|
|
5355
5356
|
);
|
|
5356
5357
|
}) }, rowIdx)) }) }),
|
|
5357
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-4 justify-center mb-4 text-sm", children: [
|
|
5358
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-4 justify-center mb-4 text-sm min-h-[32px]", children: [
|
|
5358
5359
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "px-3 py-1 bg-blue-100 rounded", children: [
|
|
5359
5360
|
"Open: ",
|
|
5360
5361
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-bold", children: stepData.openSet.length })
|
|
@@ -5363,9 +5364,9 @@ const AStarVisualizerComponent = ({
|
|
|
5363
5364
|
"Closed: ",
|
|
5364
5365
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-bold", children: stepData.closedSet.length })
|
|
5365
5366
|
] }),
|
|
5366
|
-
|
|
5367
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: `px-3 py-1 bg-purple-100 rounded ${!stepData.path ? "invisible" : ""}`, children: [
|
|
5367
5368
|
"Path: ",
|
|
5368
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-bold", children: stepData.path.length }),
|
|
5369
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-bold", children: ((_a = stepData.path) == null ? void 0 : _a.length) || 0 }),
|
|
5369
5370
|
" cells"
|
|
5370
5371
|
] })
|
|
5371
5372
|
] })
|
|
@@ -5734,7 +5735,7 @@ const TopologicalSortVisualizerComponent = ({
|
|
|
5734
5735
|
] }, node.id))
|
|
5735
5736
|
] }) }),
|
|
5736
5737
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-4 mb-4", children: [
|
|
5737
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-1 p-3 bg-blue-50 rounded-lg border border-blue-200", children: [
|
|
5738
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-1 p-3 bg-blue-50 rounded-lg border border-blue-200 min-h-[72px]", children: [
|
|
5738
5739
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-xs font-medium text-blue-800 mb-2", children: "Queue (in-degree = 0)" }),
|
|
5739
5740
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex gap-1 min-h-[32px]", children: stepData.queue.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-blue-400 text-sm", children: "Empty" }) : stepData.queue.map((id) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
5740
5741
|
"span",
|
|
@@ -5745,7 +5746,7 @@ const TopologicalSortVisualizerComponent = ({
|
|
|
5745
5746
|
id
|
|
5746
5747
|
)) })
|
|
5747
5748
|
] }),
|
|
5748
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-1 p-3 bg-green-50 rounded-lg border border-green-200", children: [
|
|
5749
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-1 p-3 bg-green-50 rounded-lg border border-green-200 min-h-[72px]", children: [
|
|
5749
5750
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-xs font-medium text-green-800 mb-2", children: "Result (sorted order)" }),
|
|
5750
5751
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex gap-1 min-h-[32px]", children: stepData.result.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-green-400 text-sm", children: "Empty" }) : stepData.result.map((id, idx) => /* @__PURE__ */ jsxRuntime.jsxs(React.Fragment, { children: [
|
|
5751
5752
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "w-8 h-8 flex items-center justify-center bg-green-400 text-white rounded font-bold", children: id }),
|
|
@@ -6032,7 +6033,7 @@ const HashMapVisualizerComponent = ({
|
|
|
6032
6033
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-center text-indigo-700 font-bold mb-2", children: "index = hashCode(key) % capacity" }),
|
|
6033
6034
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-xs text-gray-500 text-center", children: "Same key → same index (deterministic) • Different keys may collide → chaining" })
|
|
6034
6035
|
] }),
|
|
6035
|
-
|
|
6036
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-3 p-3 bg-white rounded-lg border border-indigo-200 min-h-[80px]", children: stepData.hash !== void 0 && stepData.key ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-xs text-center", children: [
|
|
6036
6037
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "font-mono mb-1", children: [
|
|
6037
6038
|
"hashCode(",
|
|
6038
6039
|
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-indigo-600 font-bold", children: [
|
|
@@ -6055,7 +6056,7 @@ const HashMapVisualizerComponent = ({
|
|
|
6055
6056
|
stepData.bucketIndex,
|
|
6056
6057
|
"]"
|
|
6057
6058
|
] })
|
|
6058
|
-
] }) })
|
|
6059
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-xs text-gray-400 text-center py-4", children: "Ready to hash..." }) })
|
|
6059
6060
|
] }),
|
|
6060
6061
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-4", children: [
|
|
6061
6062
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-sm font-medium text-gray-700 mb-2", children: [
|
|
@@ -13665,7 +13666,7 @@ const LinkedListVisualizerComponent = ({
|
|
|
13665
13666
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-xs text-gray-500 font-mono ml-2", children: "← tail" })
|
|
13666
13667
|
] }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-16 flex items-center justify-center text-gray-400 text-sm", children: "Empty list (head = tail = null)" }) })
|
|
13667
13668
|
] }),
|
|
13668
|
-
|
|
13669
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mb-4 p-3 bg-gray-100 rounded-lg min-h-[44px]", children: nodes.length > 0 ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-xs text-gray-600 flex gap-4", children: [
|
|
13669
13670
|
/* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
|
|
13670
13671
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-medium", children: "head:" }),
|
|
13671
13672
|
" ",
|
|
@@ -13681,7 +13682,7 @@ const LinkedListVisualizerComponent = ({
|
|
|
13681
13682
|
" ",
|
|
13682
13683
|
nodes.length
|
|
13683
13684
|
] })
|
|
13684
|
-
] }) })
|
|
13685
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-xs text-gray-400 text-center", children: "head = tail = null, size = 0" }) })
|
|
13685
13686
|
] });
|
|
13686
13687
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
13687
13688
|
BaseVisualizerLayout,
|
|
@@ -14162,7 +14163,7 @@ const LinkedHashMapVisualizerComponent = ({
|
|
|
14162
14163
|
linkedOrder.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-2 pt-2 border-t border-orange-200 text-[10px] text-gray-500 text-center", children: "Doubly linked: each entry has prev/next pointers" })
|
|
14163
14164
|
] })
|
|
14164
14165
|
] }),
|
|
14165
|
-
|
|
14166
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mb-4 p-3 bg-blue-50 rounded-lg min-h-[52px]", children: accessOrder ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-xs text-blue-700", children: [
|
|
14166
14167
|
/* @__PURE__ */ jsxRuntime.jsx("strong", { children: "LRU Cache Usage:" }),
|
|
14167
14168
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-1 text-[11px]", children: linkedOrder.length > 0 ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
14168
14169
|
"Least Recently Used: ",
|
|
@@ -14170,7 +14171,7 @@ const LinkedHashMapVisualizerComponent = ({
|
|
|
14170
14171
|
" | Most Recently Used: ",
|
|
14171
14172
|
/* @__PURE__ */ jsxRuntime.jsx("strong", { children: linkedOrder[linkedOrder.length - 1] })
|
|
14172
14173
|
] }) : "Cache empty" })
|
|
14173
|
-
] }) })
|
|
14174
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-xs text-gray-400 text-center", children: "Insertion order mode (switch to access order for LRU behavior)" }) })
|
|
14174
14175
|
] });
|
|
14175
14176
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
14176
14177
|
BaseVisualizerLayout,
|
|
@@ -14952,9 +14953,9 @@ const ArrayDequeVisualizerComponent = ({
|
|
|
14952
14953
|
] }, idx)) })
|
|
14953
14954
|
)
|
|
14954
14955
|
] }),
|
|
14955
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-4 p-3 bg-gray-50 rounded-lg", children: [
|
|
14956
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-4 p-3 bg-gray-50 rounded-lg min-h-[60px]", children: [
|
|
14956
14957
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-xs text-gray-600 mb-2", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-medium", children: "Logical Order (front → back):" }) }),
|
|
14957
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-wrap items-center gap-1", children: getLogicalElements().length > 0 ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
14958
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-wrap items-center gap-1 min-h-[24px]", children: getLogicalElements().length > 0 ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
14958
14959
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[10px] text-teal-600", children: "FRONT →" }),
|
|
14959
14960
|
getLogicalElements().map((val, idx) => /* @__PURE__ */ jsxRuntime.jsxs(React.Fragment, { children: [
|
|
14960
14961
|
idx > 0 && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-gray-400", children: "→" }),
|
|
@@ -15687,7 +15688,7 @@ const EnumSetVisualizerComponent = ({
|
|
|
15687
15688
|
day
|
|
15688
15689
|
);
|
|
15689
15690
|
}) }),
|
|
15690
|
-
|
|
15691
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: `p-3 bg-gray-900 rounded-lg text-sm font-mono min-h-[76px] ${showBinary ? "" : "hidden"}`, children: [
|
|
15691
15692
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 text-gray-400", children: [
|
|
15692
15693
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-green-400", children: "elements" }),
|
|
15693
15694
|
/* @__PURE__ */ jsxRuntime.jsx("span", { children: "=" }),
|
|
@@ -15701,29 +15702,31 @@ const EnumSetVisualizerComponent = ({
|
|
|
15701
15702
|
" in decimal)"
|
|
15702
15703
|
] })
|
|
15703
15704
|
] }),
|
|
15704
|
-
|
|
15705
|
-
/* @__PURE__ */ jsxRuntime.
|
|
15706
|
-
|
|
15707
|
-
|
|
15708
|
-
|
|
15709
|
-
|
|
15710
|
-
|
|
15711
|
-
/* @__PURE__ */ jsxRuntime.
|
|
15712
|
-
|
|
15713
|
-
|
|
15714
|
-
|
|
15715
|
-
|
|
15716
|
-
|
|
15717
|
-
/* @__PURE__ */ jsxRuntime.
|
|
15718
|
-
|
|
15719
|
-
|
|
15720
|
-
|
|
15705
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mt-2 min-h-[20px]", children: [
|
|
15706
|
+
stepData.operation === "add" && highlightBit !== void 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-blue-300", children: [
|
|
15707
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-gray-500", children: "// Set bit: " }),
|
|
15708
|
+
"elements |= (1L << ",
|
|
15709
|
+
highlightBit,
|
|
15710
|
+
")"
|
|
15711
|
+
] }),
|
|
15712
|
+
stepData.operation === "remove" && highlightBit !== void 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-orange-300", children: [
|
|
15713
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-gray-500", children: "// Clear bit: " }),
|
|
15714
|
+
"elements &= ~(1L << ",
|
|
15715
|
+
highlightBit,
|
|
15716
|
+
")"
|
|
15717
|
+
] }),
|
|
15718
|
+
stepData.operation === "contains" && highlightBit !== void 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-purple-300", children: [
|
|
15719
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-gray-500", children: "// Check bit: " }),
|
|
15720
|
+
"(elements & (1L << ",
|
|
15721
|
+
highlightBit,
|
|
15722
|
+
")) != 0"
|
|
15723
|
+
] })
|
|
15721
15724
|
] })
|
|
15722
15725
|
] })
|
|
15723
15726
|
] }),
|
|
15724
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-4 p-3 bg-gray-50 rounded-lg", children: [
|
|
15727
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-4 p-3 bg-gray-50 rounded-lg min-h-[68px]", children: [
|
|
15725
15728
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-xs text-gray-600 mb-2", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-medium", children: "Set Contents:" }) }),
|
|
15726
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-wrap gap-1", children: [
|
|
15729
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-wrap gap-1 min-h-[24px]", children: [
|
|
15727
15730
|
DAYS_OF_WEEK.filter((_, idx) => (bitmask & 1 << idx) !== 0).map(
|
|
15728
15731
|
(day) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
15729
15732
|
"span",
|
|
@@ -16192,7 +16195,7 @@ const PriorityQueueVisualizerComponent = ({ showControls = true, showCode = true
|
|
|
16192
16195
|
] })
|
|
16193
16196
|
] })
|
|
16194
16197
|
] }),
|
|
16195
|
-
|
|
16198
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-3 p-2 bg-white rounded-lg border border-purple-200 min-h-[36px]", children: currentIndex !== void 0 && currentIndex >= 0 ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-xs text-gray-600 text-center", children: [
|
|
16196
16199
|
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "font-semibold text-purple-700", children: [
|
|
16197
16200
|
"Current: i = ",
|
|
16198
16201
|
currentIndex
|
|
@@ -16211,7 +16214,7 @@ const PriorityQueueVisualizerComponent = ({ showControls = true, showCode = true
|
|
|
16211
16214
|
") = ",
|
|
16212
16215
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-purple-600 font-bold", children: 2 * currentIndex + 1 })
|
|
16213
16216
|
] })
|
|
16214
|
-
] }) })
|
|
16217
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-xs text-gray-400 text-center", children: "Ready for heap operations..." }) })
|
|
16215
16218
|
] }),
|
|
16216
16219
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-4", children: [
|
|
16217
16220
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-sm font-medium text-gray-700 mb-2", children: "Binary Heap Structure" }),
|
|
@@ -16659,7 +16662,7 @@ const ConcurrentHashMapVisualizerComponent = ({ showControls = true, showCode =
|
|
|
16659
16662
|
seg.lockOwner
|
|
16660
16663
|
] })
|
|
16661
16664
|
] }),
|
|
16662
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-1", children: seg.entries.length > 0 ? seg.entries.map((entry, eIdx) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
16665
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-1 min-h-[60px]", children: seg.entries.length > 0 ? seg.entries.map((entry, eIdx) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
16663
16666
|
"div",
|
|
16664
16667
|
{
|
|
16665
16668
|
className: "flex justify-between px-2 py-1 bg-white rounded text-xs border border-gray-200",
|
|
@@ -17387,7 +17390,7 @@ const CopyOnWriteVisualizerComponent = ({
|
|
|
17387
17390
|
] }),
|
|
17388
17391
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-2 text-[10px] text-gray-600 text-center", children: "Best for: Read-heavy, rarely-modified collections • Iterators never throw ConcurrentModificationException" })
|
|
17389
17392
|
] }),
|
|
17390
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mb-4 p-4 bg-gray-50 rounded-lg", children: showCopy ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-4", children: [
|
|
17393
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mb-4 p-4 bg-gray-50 rounded-lg min-h-[100px]", children: showCopy ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-4", children: [
|
|
17391
17394
|
renderArray(oldArray, "Old Array (readers use this)"),
|
|
17392
17395
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-2xl text-gray-400", children: "→" }),
|
|
17393
17396
|
renderArray(newArray, "New Array (being created)", true)
|
|
@@ -17639,13 +17642,13 @@ const ImmutableCollectionsVisualizerComponent = ({ showControls = true, showCode
|
|
|
17639
17642
|
return "default";
|
|
17640
17643
|
};
|
|
17641
17644
|
const visualization = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
17642
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-4 space-y-4", children: [
|
|
17643
|
-
|
|
17645
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-4 space-y-4 min-h-[180px]", children: [
|
|
17646
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: `p-4 bg-violet-50 rounded-lg border-2 border-violet-200 min-h-[80px] ${original.length === 0 ? "hidden" : ""}`, children: [
|
|
17644
17647
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 mb-2", children: [
|
|
17645
17648
|
/* @__PURE__ */ jsxRuntime.jsx(Lock, { className: "w-4 h-4 text-violet-600" }),
|
|
17646
17649
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm font-medium text-violet-700", children: "Immutable List (List.of)" })
|
|
17647
17650
|
] }),
|
|
17648
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-2", children: [
|
|
17651
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-2 min-h-[48px]", children: [
|
|
17649
17652
|
original.map((item, idx) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
17650
17653
|
"div",
|
|
17651
17654
|
{
|
|
@@ -17657,10 +17660,10 @@ const ImmutableCollectionsVisualizerComponent = ({ showControls = true, showCode
|
|
|
17657
17660
|
error && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center text-red-600 text-sm font-medium ml-2", children: "✗ Cannot modify!" })
|
|
17658
17661
|
] })
|
|
17659
17662
|
] }),
|
|
17660
|
-
|
|
17663
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: `p-4 bg-green-50 rounded-lg border-2 border-green-200 min-h-[80px] ${!(showDerived && derived) ? "invisible" : ""}`, children: [
|
|
17661
17664
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center gap-2 mb-2", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm font-medium text-green-700", children: "Mutable Copy (ArrayList)" }) }),
|
|
17662
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-2", children: [
|
|
17663
|
-
derived.map((item, idx) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
17665
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-2 min-h-[48px]", children: [
|
|
17666
|
+
derived && derived.map((item, idx) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
17664
17667
|
"div",
|
|
17665
17668
|
{
|
|
17666
17669
|
className: `w-12 h-12 flex items-center justify-center rounded-lg border-2 font-bold ${idx === derived.length - 1 && derived.length > original.length ? "bg-green-500 border-green-600 text-white" : "bg-green-100 border-green-300 text-green-700"}`,
|
|
@@ -17668,7 +17671,7 @@ const ImmutableCollectionsVisualizerComponent = ({ showControls = true, showCode
|
|
|
17668
17671
|
},
|
|
17669
17672
|
idx
|
|
17670
17673
|
)),
|
|
17671
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center text-green-600 text-sm font-medium ml-2", children: "✓ Modifiable" })
|
|
17674
|
+
showDerived && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center text-green-600 text-sm font-medium ml-2", children: "✓ Modifiable" })
|
|
17672
17675
|
] })
|
|
17673
17676
|
] })
|
|
17674
17677
|
] }),
|
|
@@ -18978,16 +18981,16 @@ const TrieVisualizerComponent = ({
|
|
|
18978
18981
|
depth: 0
|
|
18979
18982
|
}
|
|
18980
18983
|
) }),
|
|
18981
|
-
|
|
18984
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mt-4 p-3 bg-purple-50 rounded-lg border border-purple-200 min-h-[64px]", children: [
|
|
18982
18985
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-xs font-medium text-purple-800 mb-2", children: "Words found:" }),
|
|
18983
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-wrap gap-2", children: stepData.matchedWords.map((word) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
18986
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-wrap gap-2 min-h-[28px]", children: stepData.matchedWords && stepData.matchedWords.length > 0 ? stepData.matchedWords.map((word) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
18984
18987
|
"span",
|
|
18985
18988
|
{
|
|
18986
18989
|
className: "px-2 py-1 bg-purple-100 text-purple-700 text-sm rounded font-mono",
|
|
18987
18990
|
children: word
|
|
18988
18991
|
},
|
|
18989
18992
|
word
|
|
18990
|
-
)) })
|
|
18993
|
+
)) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs text-purple-400 italic", children: "No words matched yet..." }) })
|
|
18991
18994
|
] })
|
|
18992
18995
|
] });
|
|
18993
18996
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -19355,7 +19358,7 @@ const UnionFindVisualizerComponent = ({
|
|
|
19355
19358
|
groups.size !== 1 ? "s" : "",
|
|
19356
19359
|
")"
|
|
19357
19360
|
] }),
|
|
19358
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-wrap gap-2", children: Array.from(groups.entries()).map(([root, members], idx) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
19361
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-wrap gap-2 min-h-[60px]", children: Array.from(groups.entries()).map(([root, members], idx) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
19359
19362
|
"div",
|
|
19360
19363
|
{
|
|
19361
19364
|
className: `px-3 py-2 rounded-lg border ${groupColors[idx % groupColors.length]} border-gray-300`,
|
|
@@ -20149,7 +20152,7 @@ const SegmentTreeVisualizerComponent = ({
|
|
|
20149
20152
|
idx
|
|
20150
20153
|
);
|
|
20151
20154
|
}) }),
|
|
20152
|
-
|
|
20155
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-center text-xs text-gray-600 mt-2 min-h-[20px]", children: stepData.queryRange ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
20153
20156
|
"Query range: [",
|
|
20154
20157
|
stepData.queryRange[0],
|
|
20155
20158
|
", ",
|
|
@@ -20159,7 +20162,7 @@ const SegmentTreeVisualizerComponent = ({
|
|
|
20159
20162
|
"= ",
|
|
20160
20163
|
stepData.queryResult
|
|
20161
20164
|
] })
|
|
20162
|
-
] })
|
|
20165
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-gray-400", children: "Ready for query..." }) })
|
|
20163
20166
|
] }),
|
|
20164
20167
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mb-4 overflow-x-auto", children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
20165
20168
|
"svg",
|
|
@@ -21209,10 +21212,10 @@ const RaftVisualizerComponent = ({
|
|
|
21209
21212
|
] }, node.id);
|
|
21210
21213
|
})
|
|
21211
21214
|
] }) }),
|
|
21212
|
-
|
|
21215
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mb-4 text-center min-h-[32px]", 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: [
|
|
21213
21216
|
"📨 ",
|
|
21214
21217
|
stepData.messageType
|
|
21215
|
-
] }) }),
|
|
21218
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-gray-300 text-sm", children: "—" }) }),
|
|
21216
21219
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mb-4 overflow-x-auto", children: /* @__PURE__ */ jsxRuntime.jsxs("table", { className: "w-full text-xs", children: [
|
|
21217
21220
|
/* @__PURE__ */ jsxRuntime.jsx("thead", { children: /* @__PURE__ */ jsxRuntime.jsxs("tr", { className: "bg-gray-100", children: [
|
|
21218
21221
|
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-2 py-1 text-left", children: "Node" }),
|