@tomaszjarosz/react-visualizers 0.4.3 → 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 CHANGED
@@ -2323,7 +2323,7 @@ const BinarySearchVisualizerComponent = ({
2323
2323
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-center text-green-700 font-bold mb-2", children: "target ∈ arr[left..right]" }),
2324
2324
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-xs text-gray-500 text-center", children: "If target exists, it must be within current search bounds" })
2325
2325
  ] }),
2326
- left <= right && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mt-3 p-2 bg-white rounded-lg border border-green-200", children: [
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: [
2327
2327
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-between items-center text-xs", children: [
2328
2328
  /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
2329
2329
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-semibold text-green-700", children: "Search space:" }),
@@ -2355,8 +2355,7 @@ const BinarySearchVisualizerComponent = ({
2355
2355
  ") / 2⌋ = ",
2356
2356
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-bold text-purple-600", children: mid })
2357
2357
  ] })
2358
- ] }),
2359
- 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: [
2360
2359
  "✓ Found in ",
2361
2360
  currentStep,
2362
2361
  " steps (log₂",
@@ -2364,8 +2363,7 @@ const BinarySearchVisualizerComponent = ({
2364
2363
  " ≈ ",
2365
2364
  Math.ceil(Math.log2(array.length)),
2366
2365
  " max)"
2367
- ] }) }),
2368
- 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..." }) })
2369
2367
  ] }),
2370
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: [
2371
2369
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -4110,7 +4108,7 @@ const DijkstraVisualizerComponent = ({
4110
4108
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-green-600 font-bold", children: "update dist[v]" })
4111
4109
  ] })
4112
4110
  ] }),
4113
- /* @__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: [
4114
4112
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 mb-2", children: [
4115
4113
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm font-semibold text-orange-800", children: "Priority Queue (min-heap)" }),
4116
4114
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs text-orange-600", children: "(node:distance)" })
@@ -14438,6 +14436,35 @@ const ArrayListVisualizerComponent = ({
14438
14436
  return copyUrlToClipboard({ step: currentStep });
14439
14437
  }, [copyUrlToClipboard, currentStep]);
14440
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
+ ] }),
14441
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: [
14442
14469
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-sm font-bold text-red-700 mb-3 flex items-center gap-2", children: [
14443
14470
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xl", children: "⚠️" }),
@@ -14503,35 +14530,6 @@ const ArrayListVisualizerComponent = ({
14503
14530
  "]"
14504
14531
  ] })
14505
14532
  ] }, idx)) }) })
14506
- ] }),
14507
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-4 p-3 bg-gray-100 rounded-lg", children: [
14508
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-6 text-xs", children: [
14509
- /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
14510
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-medium text-gray-700", children: "size:" }),
14511
- " ",
14512
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-orange-600 font-mono", children: size })
14513
- ] }),
14514
- /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
14515
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-medium text-gray-700", children: "capacity:" }),
14516
- " ",
14517
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-amber-600 font-mono", children: capacity })
14518
- ] }),
14519
- /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
14520
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-medium text-gray-700", children: "load:" }),
14521
- " ",
14522
- /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "font-mono", children: [
14523
- Math.round(size / capacity * 100),
14524
- "%"
14525
- ] })
14526
- ] })
14527
- ] }),
14528
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-2 h-2 bg-gray-200 rounded-full overflow-hidden", children: /* @__PURE__ */ jsxRuntime.jsx(
14529
- "div",
14530
- {
14531
- className: "h-full bg-orange-500 transition-all",
14532
- style: { width: `${size / capacity * 100}%` }
14533
- }
14534
- ) })
14535
14533
  ] })
14536
14534
  ] });
14537
14535
  return /* @__PURE__ */ jsxRuntime.jsx(
@@ -15372,23 +15370,12 @@ const TreeSetVisualizerComponent = ({
15372
15370
  ] }),
15373
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" })
15374
15372
  ] }),
15375
- currentStepData.operation === "add" && currentStepData.value !== void 0 && currentNode !== void 0 && currentNode !== 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: [
15376
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-semibold text-emerald-700", children: "Comparing:" }),
15377
- " ",
15378
- /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "font-mono", children: [
15379
- currentStepData.value,
15380
- " ",
15381
- currentStepData.value < currentNode ? "<" : ">",
15382
- " ",
15383
- currentNode
15384
- ] }),
15385
- " → ",
15386
- /* @__PURE__ */ jsxRuntime.jsxs("span", { className: `font-bold ${currentStepData.value < currentNode ? "text-blue-600" : "text-orange-600"}`, children: [
15387
- "Go ",
15388
- currentStepData.value < currentNode ? "LEFT" : "RIGHT"
15389
- ] })
15390
- ] }) }),
15391
- 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: [
15392
15379
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-semibold text-emerald-700", children: "Comparing:" }),
15393
15380
  " ",
15394
15381
  /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "font-mono", children: [
@@ -15403,14 +15390,7 @@ const TreeSetVisualizerComponent = ({
15403
15390
  "Go ",
15404
15391
  currentStepData.value < currentNode ? "LEFT" : "RIGHT"
15405
15392
  ] })
15406
- ] }) }),
15407
- 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: [
15408
- "✓ Found! ",
15409
- currentStepData.value,
15410
- " == ",
15411
- currentNode
15412
- ] }) }),
15413
- 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..." }) })
15414
15394
  ] }),
15415
15395
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-4", children: [
15416
15396
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-sm font-medium text-gray-700 mb-2", children: "Binary Search Tree" }),