@tomaszjarosz/react-visualizers 0.4.1 → 0.4.4
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 +75 -93
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +75 -93
- package/dist/index.js.map +1 -1
- package/dist/react-visualizers.css +16 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -713,23 +713,12 @@ const StatusPanel = ({
|
|
|
713
713
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
714
714
|
"div",
|
|
715
715
|
{
|
|
716
|
-
className: "p-3 bg-gray-50 rounded-lg
|
|
716
|
+
className: "p-3 bg-gray-50 rounded-lg",
|
|
717
717
|
role: "status",
|
|
718
718
|
"aria-live": "polite",
|
|
719
719
|
"aria-atomic": "true",
|
|
720
720
|
children: [
|
|
721
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
722
|
-
"div",
|
|
723
|
-
{
|
|
724
|
-
className: `text-sm font-medium ${VARIANT_STYLES$1[variant]} flex items-center gap-1.5 transition-all duration-150 ${isAnimating ? "opacity-0 translate-y-1" : "opacity-100 translate-y-0"}`,
|
|
725
|
-
children: [
|
|
726
|
-
Icon2 && /* @__PURE__ */ jsxRuntime.jsx(Icon2, { className: "w-4 h-4 flex-shrink-0 animate-in fade-in duration-300", "aria-hidden": "true" }),
|
|
727
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: srPrefix }),
|
|
728
|
-
displayedDescription
|
|
729
|
-
]
|
|
730
|
-
}
|
|
731
|
-
),
|
|
732
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mt-2 flex items-center gap-2", children: [
|
|
721
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 mb-2", children: [
|
|
733
722
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1 h-1 bg-gray-200 rounded-full overflow-hidden", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
734
723
|
"div",
|
|
735
724
|
{
|
|
@@ -749,7 +738,18 @@ const StatusPanel = ({
|
|
|
749
738
|
]
|
|
750
739
|
}
|
|
751
740
|
)
|
|
752
|
-
] })
|
|
741
|
+
] }),
|
|
742
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
743
|
+
"div",
|
|
744
|
+
{
|
|
745
|
+
className: `text-sm font-medium ${VARIANT_STYLES$1[variant]} flex items-start gap-1.5 transition-all duration-150 ${isAnimating ? "opacity-0 translate-y-1" : "opacity-100 translate-y-0"}`,
|
|
746
|
+
children: [
|
|
747
|
+
Icon2 && /* @__PURE__ */ jsxRuntime.jsx(Icon2, { className: "w-4 h-4 flex-shrink-0 animate-in fade-in duration-300 mt-0.5", "aria-hidden": "true" }),
|
|
748
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: srPrefix }),
|
|
749
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: displayedDescription })
|
|
750
|
+
]
|
|
751
|
+
}
|
|
752
|
+
)
|
|
753
753
|
]
|
|
754
754
|
}
|
|
755
755
|
);
|
|
@@ -1146,13 +1146,15 @@ const ShareButton = ({
|
|
|
1146
1146
|
const VisualizationArea = ({
|
|
1147
1147
|
children,
|
|
1148
1148
|
minHeight = 300,
|
|
1149
|
+
fixedHeight = false,
|
|
1149
1150
|
className = ""
|
|
1150
1151
|
}) => {
|
|
1152
|
+
const style = fixedHeight ? { height: `${minHeight}px`, minHeight: `${minHeight}px`, maxHeight: `${minHeight}px` } : { minHeight: `${minHeight}px` };
|
|
1151
1153
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1152
1154
|
"div",
|
|
1153
1155
|
{
|
|
1154
|
-
className: `relative ${className}`,
|
|
1155
|
-
style
|
|
1156
|
+
className: `relative ${fixedHeight ? "overflow-auto" : ""} ${className}`,
|
|
1157
|
+
style,
|
|
1156
1158
|
children
|
|
1157
1159
|
}
|
|
1158
1160
|
);
|
|
@@ -1252,6 +1254,7 @@ const BaseVisualizerLayout = ({
|
|
|
1252
1254
|
onShare,
|
|
1253
1255
|
children,
|
|
1254
1256
|
minHeight = 400,
|
|
1257
|
+
fixedHeight = false,
|
|
1255
1258
|
sidePanel,
|
|
1256
1259
|
status,
|
|
1257
1260
|
controls,
|
|
@@ -1290,11 +1293,9 @@ const BaseVisualizerLayout = ({
|
|
|
1290
1293
|
),
|
|
1291
1294
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "p-4", children: [
|
|
1292
1295
|
infoBox,
|
|
1296
|
+
status && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mb-4", children: /* @__PURE__ */ jsxRuntime.jsx(StatusPanel, { ...status }) }),
|
|
1293
1297
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: `flex gap-4 ${hasSidePanel ? "flex-col lg:flex-row lg:items-start" : ""}`, children: [
|
|
1294
|
-
/* @__PURE__ */ jsxRuntime.
|
|
1295
|
-
children,
|
|
1296
|
-
status && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-4", children: /* @__PURE__ */ jsxRuntime.jsx(StatusPanel, { ...status }) })
|
|
1297
|
-
] }),
|
|
1298
|
+
/* @__PURE__ */ jsxRuntime.jsx(VisualizationArea, { minHeight, fixedHeight, className: "flex-1", children }),
|
|
1298
1299
|
hasSidePanel && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "lg:w-80 flex-shrink-0 flex flex-col gap-4 lg:sticky lg:top-4", children: [
|
|
1299
1300
|
hasCodePanel && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1300
1301
|
CodePanel,
|
|
@@ -2322,7 +2323,7 @@ const BinarySearchVisualizerComponent = ({
|
|
|
2322
2323
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-center text-green-700 font-bold mb-2", children: "target ∈ arr[left..right]" }),
|
|
2323
2324
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-xs text-gray-500 text-center", children: "If target exists, it must be within current search bounds" })
|
|
2324
2325
|
] }),
|
|
2325
|
-
|
|
2326
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-3 p-2 bg-white rounded-lg border border-green-200 min-h-[60px]", children: left <= right ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
2326
2327
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-between items-center text-xs", children: [
|
|
2327
2328
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2328
2329
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-semibold text-green-700", children: "Search space:" }),
|
|
@@ -2354,8 +2355,7 @@ const BinarySearchVisualizerComponent = ({
|
|
|
2354
2355
|
") / 2⌋ = ",
|
|
2355
2356
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-bold text-purple-600", children: mid })
|
|
2356
2357
|
] })
|
|
2357
|
-
] }),
|
|
2358
|
-
found === true && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-3 p-2 bg-green-100 rounded-lg border border-green-300 text-center", children: /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-green-800 font-bold", children: [
|
|
2358
|
+
] }) : found === true ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-center py-1", children: /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-green-800 font-bold", children: [
|
|
2359
2359
|
"✓ Found in ",
|
|
2360
2360
|
currentStep,
|
|
2361
2361
|
" steps (log₂",
|
|
@@ -2363,8 +2363,7 @@ const BinarySearchVisualizerComponent = ({
|
|
|
2363
2363
|
" ≈ ",
|
|
2364
2364
|
Math.ceil(Math.log2(array.length)),
|
|
2365
2365
|
" max)"
|
|
2366
|
-
] }) }),
|
|
2367
|
-
found === false && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-3 p-2 bg-red-100 rounded-lg border border-red-300 text-center", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-red-800 font-bold", children: "✗ Not found - search space exhausted" }) })
|
|
2366
|
+
] }) }) : found === false ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-center py-1", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-red-800 font-bold", children: "✗ Not found - search space exhausted" }) }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-center text-xs text-gray-400 py-2", children: "Ready to search..." }) })
|
|
2368
2367
|
] }),
|
|
2369
2368
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-center gap-1 flex-wrap mb-4", children: array.map((value, index) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col items-center", children: [
|
|
2370
2369
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -4109,7 +4108,7 @@ const DijkstraVisualizerComponent = ({
|
|
|
4109
4108
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-green-600 font-bold", children: "update dist[v]" })
|
|
4110
4109
|
] })
|
|
4111
4110
|
] }),
|
|
4112
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-4 p-3 bg-orange-50 rounded-lg border border-orange-200", children: [
|
|
4111
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-4 p-3 bg-orange-50 rounded-lg border border-orange-200 min-h-[72px]", children: [
|
|
4113
4112
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 mb-2", children: [
|
|
4114
4113
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm font-semibold text-orange-800", children: "Priority Queue (min-heap)" }),
|
|
4115
4114
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs text-orange-600", children: "(node:distance)" })
|
|
@@ -14437,6 +14436,35 @@ const ArrayListVisualizerComponent = ({
|
|
|
14437
14436
|
return copyUrlToClipboard({ step: currentStep });
|
|
14438
14437
|
}, [copyUrlToClipboard, currentStep]);
|
|
14439
14438
|
const visualization = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
14439
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-4 p-3 bg-gray-100 rounded-lg", children: [
|
|
14440
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-2 bg-gray-200 rounded-full overflow-hidden mb-2", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
14441
|
+
"div",
|
|
14442
|
+
{
|
|
14443
|
+
className: "h-full bg-orange-500 transition-all",
|
|
14444
|
+
style: { width: `${size / capacity * 100}%` }
|
|
14445
|
+
}
|
|
14446
|
+
) }),
|
|
14447
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-6 text-xs", children: [
|
|
14448
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
14449
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-medium text-gray-700", children: "size:" }),
|
|
14450
|
+
" ",
|
|
14451
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-orange-600 font-mono", children: size })
|
|
14452
|
+
] }),
|
|
14453
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
14454
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-medium text-gray-700", children: "capacity:" }),
|
|
14455
|
+
" ",
|
|
14456
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-amber-600 font-mono", children: capacity })
|
|
14457
|
+
] }),
|
|
14458
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
14459
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-medium text-gray-700", children: "load:" }),
|
|
14460
|
+
" ",
|
|
14461
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "font-mono", children: [
|
|
14462
|
+
Math.round(size / capacity * 100),
|
|
14463
|
+
"%"
|
|
14464
|
+
] })
|
|
14465
|
+
] })
|
|
14466
|
+
] })
|
|
14467
|
+
] }),
|
|
14440
14468
|
operation === "resize" && oldArray && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-4 p-4 bg-gradient-to-r from-red-50 to-orange-50 rounded-xl border-2 border-red-200", children: [
|
|
14441
14469
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-sm font-bold text-red-700 mb-3 flex items-center gap-2", children: [
|
|
14442
14470
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xl", children: "⚠️" }),
|
|
@@ -14502,35 +14530,6 @@ const ArrayListVisualizerComponent = ({
|
|
|
14502
14530
|
"]"
|
|
14503
14531
|
] })
|
|
14504
14532
|
] }, idx)) }) })
|
|
14505
|
-
] }),
|
|
14506
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-4 p-3 bg-gray-100 rounded-lg", children: [
|
|
14507
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-6 text-xs", children: [
|
|
14508
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
14509
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-medium text-gray-700", children: "size:" }),
|
|
14510
|
-
" ",
|
|
14511
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-orange-600 font-mono", children: size })
|
|
14512
|
-
] }),
|
|
14513
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
14514
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-medium text-gray-700", children: "capacity:" }),
|
|
14515
|
-
" ",
|
|
14516
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-amber-600 font-mono", children: capacity })
|
|
14517
|
-
] }),
|
|
14518
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
14519
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-medium text-gray-700", children: "load:" }),
|
|
14520
|
-
" ",
|
|
14521
|
-
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "font-mono", children: [
|
|
14522
|
-
Math.round(size / capacity * 100),
|
|
14523
|
-
"%"
|
|
14524
|
-
] })
|
|
14525
|
-
] })
|
|
14526
|
-
] }),
|
|
14527
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-2 h-2 bg-gray-200 rounded-full overflow-hidden", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
14528
|
-
"div",
|
|
14529
|
-
{
|
|
14530
|
-
className: "h-full bg-orange-500 transition-all",
|
|
14531
|
-
style: { width: `${size / capacity * 100}%` }
|
|
14532
|
-
}
|
|
14533
|
-
) })
|
|
14534
14533
|
] })
|
|
14535
14534
|
] });
|
|
14536
14535
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -15371,23 +15370,12 @@ const TreeSetVisualizerComponent = ({
|
|
|
15371
15370
|
] }),
|
|
15372
15371
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-xs text-gray-500 text-center", children: "All values in left subtree are smaller • All values in right subtree are larger" })
|
|
15373
15372
|
] }),
|
|
15374
|
-
|
|
15375
|
-
|
|
15376
|
-
|
|
15377
|
-
|
|
15378
|
-
|
|
15379
|
-
|
|
15380
|
-
currentStepData.value < currentNode ? "<" : ">",
|
|
15381
|
-
" ",
|
|
15382
|
-
currentNode
|
|
15383
|
-
] }),
|
|
15384
|
-
" → ",
|
|
15385
|
-
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: `font-bold ${currentStepData.value < currentNode ? "text-blue-600" : "text-orange-600"}`, children: [
|
|
15386
|
-
"Go ",
|
|
15387
|
-
currentStepData.value < currentNode ? "LEFT" : "RIGHT"
|
|
15388
|
-
] })
|
|
15389
|
-
] }) }),
|
|
15390
|
-
currentStepData.operation === "contains" && currentStepData.value !== void 0 && currentNode !== void 0 && !found && path.length > 0 && path[path.length - 1] !== currentStepData.value && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-3 p-2 bg-white rounded-lg border border-emerald-200", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-xs text-center", children: [
|
|
15373
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-3 p-2 bg-white rounded-lg border border-emerald-200 min-h-[40px]", children: found === true ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-xs text-center text-green-800 font-bold bg-green-100 rounded p-1", children: [
|
|
15374
|
+
"✓ Found! ",
|
|
15375
|
+
currentStepData.value,
|
|
15376
|
+
" == ",
|
|
15377
|
+
currentNode
|
|
15378
|
+
] }) : found === false ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-xs text-center text-red-800 font-bold bg-red-100 rounded p-1", children: "✗ Not found! Reached null (no more children to check)" }) : (currentStepData.operation === "add" || currentStepData.operation === "contains") && currentStepData.value !== void 0 && currentNode !== void 0 && currentNode !== currentStepData.value ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-xs text-center", children: [
|
|
15391
15379
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-semibold text-emerald-700", children: "Comparing:" }),
|
|
15392
15380
|
" ",
|
|
15393
15381
|
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "font-mono", children: [
|
|
@@ -15402,14 +15390,7 @@ const TreeSetVisualizerComponent = ({
|
|
|
15402
15390
|
"Go ",
|
|
15403
15391
|
currentStepData.value < currentNode ? "LEFT" : "RIGHT"
|
|
15404
15392
|
] })
|
|
15405
|
-
] }) })
|
|
15406
|
-
found === true && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-3 p-2 bg-green-100 rounded-lg border border-green-300", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-xs text-center text-green-800 font-bold", children: [
|
|
15407
|
-
"✓ Found! ",
|
|
15408
|
-
currentStepData.value,
|
|
15409
|
-
" == ",
|
|
15410
|
-
currentNode
|
|
15411
|
-
] }) }),
|
|
15412
|
-
found === false && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-3 p-2 bg-red-100 rounded-lg border border-red-300", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-xs text-center text-red-800 font-bold", children: "✗ Not found! Reached null (no more children to check)" }) })
|
|
15393
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-xs text-center text-gray-400", children: "Ready for operation..." }) })
|
|
15413
15394
|
] }),
|
|
15414
15395
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-4", children: [
|
|
15415
15396
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-sm font-medium text-gray-700 mb-2", children: "Binary Search Tree" }),
|
|
@@ -17027,6 +17008,10 @@ const BlockingQueueVisualizerComponent = ({ showControls = true, showCode = true
|
|
|
17027
17008
|
] })
|
|
17028
17009
|
] })
|
|
17029
17010
|
] }),
|
|
17011
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-center gap-8 text-gray-400 text-lg mb-4", children: [
|
|
17012
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: "→ put()" }),
|
|
17013
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: "take() →" })
|
|
17014
|
+
] }),
|
|
17030
17015
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between gap-4 mb-4", children: [
|
|
17031
17016
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-1", children: [
|
|
17032
17017
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-xs font-medium text-gray-500 mb-2 text-center", children: "Producers" }),
|
|
@@ -17051,6 +17036,13 @@ const BlockingQueueVisualizerComponent = ({ showControls = true, showCode = true
|
|
|
17051
17036
|
")"
|
|
17052
17037
|
] }),
|
|
17053
17038
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "bg-gray-100 rounded-lg p-2 min-h-[100px]", children: [
|
|
17039
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mb-2 h-1.5 bg-gray-200 rounded-full overflow-hidden", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
17040
|
+
"div",
|
|
17041
|
+
{
|
|
17042
|
+
className: `h-full transition-colors ${queue.length === capacity ? "bg-red-500" : "bg-cyan-500"}`,
|
|
17043
|
+
style: { width: `${queue.length / capacity * 100}%` }
|
|
17044
|
+
}
|
|
17045
|
+
) }),
|
|
17054
17046
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col gap-1", children: queue.length > 0 ? queue.map((item, idx) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
17055
17047
|
"div",
|
|
17056
17048
|
{
|
|
@@ -17058,14 +17050,7 @@ const BlockingQueueVisualizerComponent = ({ showControls = true, showCode = true
|
|
|
17058
17050
|
children: item.value
|
|
17059
17051
|
},
|
|
17060
17052
|
item.id
|
|
17061
|
-
)) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-center text-gray-400 text-xs py-4", children: "Empty" }) })
|
|
17062
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-2 h-1.5 bg-gray-200 rounded-full overflow-hidden", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
17063
|
-
"div",
|
|
17064
|
-
{
|
|
17065
|
-
className: `h-full transition-colors ${queue.length === capacity ? "bg-red-500" : "bg-cyan-500"}`,
|
|
17066
|
-
style: { width: `${queue.length / capacity * 100}%` }
|
|
17067
|
-
}
|
|
17068
|
-
) })
|
|
17053
|
+
)) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-center text-gray-400 text-xs py-4", children: "Empty" }) })
|
|
17069
17054
|
] })
|
|
17070
17055
|
] }),
|
|
17071
17056
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-1", children: [
|
|
@@ -17082,10 +17067,6 @@ const BlockingQueueVisualizerComponent = ({ showControls = true, showCode = true
|
|
|
17082
17067
|
c
|
|
17083
17068
|
)) })
|
|
17084
17069
|
] })
|
|
17085
|
-
] }),
|
|
17086
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-center gap-8 text-gray-400 text-lg mb-4", children: [
|
|
17087
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { children: "→ put()" }),
|
|
17088
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { children: "take() →" })
|
|
17089
17070
|
] })
|
|
17090
17071
|
] });
|
|
17091
17072
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -17096,7 +17077,8 @@ const BlockingQueueVisualizerComponent = ({ showControls = true, showCode = true
|
|
|
17096
17077
|
badges: BADGES$c,
|
|
17097
17078
|
gradient: "cyan",
|
|
17098
17079
|
className,
|
|
17099
|
-
minHeight:
|
|
17080
|
+
minHeight: 420,
|
|
17081
|
+
fixedHeight: true,
|
|
17100
17082
|
status: {
|
|
17101
17083
|
description,
|
|
17102
17084
|
currentStep,
|