@tomaszjarosz/react-visualizers 0.1.1 → 0.1.3

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
@@ -314,7 +314,7 @@ const CodePanel = ({
314
314
  /* @__PURE__ */ jsxRuntime.jsx("div", { children: code.map((line, idx) => /* @__PURE__ */ jsxRuntime.jsxs(
315
315
  "div",
316
316
  {
317
- className: `px-0.5 rounded transition-all whitespace-pre ${idx === activeLine ? "bg-yellow-500/30 text-yellow-200 border-l border-yellow-400" : "text-gray-400 border-l border-transparent"}`,
317
+ className: `px-0.5 rounded transition-colors whitespace-pre ${idx === activeLine ? "bg-yellow-500/30 text-yellow-200 border-l border-yellow-400" : "text-gray-400 border-l border-transparent"}`,
318
318
  children: [
319
319
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-gray-600 mr-1 select-none text-[9px]", children: idx + 1 }),
320
320
  line || " "
@@ -322,9 +322,9 @@ const CodePanel = ({
322
322
  },
323
323
  idx
324
324
  )) }),
325
- variables && Object.keys(variables).length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mt-1 pt-1 border-t border-gray-700", children: [
325
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mt-1 pt-1 border-t border-gray-700 min-h-[36px]", children: [
326
326
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-[8px] text-gray-500 uppercase tracking-wide mb-0.5", children: "Vars" }),
327
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-wrap gap-0.5", children: Object.entries(variables).map(([key, value]) => /* @__PURE__ */ jsxRuntime.jsxs(
327
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-wrap gap-0.5", children: variables && Object.keys(variables).length > 0 ? Object.entries(variables).map(([key, value]) => /* @__PURE__ */ jsxRuntime.jsxs(
328
328
  "span",
329
329
  {
330
330
  className: "px-0.5 bg-gray-800 rounded text-[9px] text-gray-300",
@@ -335,7 +335,7 @@ const CodePanel = ({
335
335
  ]
336
336
  },
337
337
  key
338
- )) })
338
+ )) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[9px] text-gray-600", children: "—" }) })
339
339
  ] })
340
340
  ] });
341
341
  const HelpPanel = () => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "bg-gray-100 rounded-lg p-2 text-[10px]", children: [
@@ -4831,48 +4831,39 @@ const HashTableVisualizerComponent = ({
4831
4831
  buckets.length,
4832
4832
  " buckets):"
4833
4833
  ] }),
4834
- /* @__PURE__ */ jsxRuntime.jsx(
4834
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid grid-cols-4 gap-2", children: buckets.map((bucket, idx) => /* @__PURE__ */ jsxRuntime.jsxs(
4835
4835
  "div",
4836
4836
  {
4837
- className: "grid gap-2",
4838
- style: {
4839
- gridTemplateColumns: `repeat(auto-fill, minmax(120px, 1fr))`
4840
- },
4841
- children: buckets.map((bucket, idx) => /* @__PURE__ */ jsxRuntime.jsxs(
4842
- "div",
4843
- {
4844
- className: `p-2 rounded border-2 min-h-[60px] transition-colors ${getBucketStyle(idx)}`,
4845
- children: [
4846
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-xs font-mono text-gray-500 mb-1", children: [
4847
- "[",
4848
- idx,
4849
- "]"
4850
- ] }),
4851
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-wrap gap-1", children: bucket.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs text-gray-400 italic", children: "empty" }) : bucket.map((bucketKey, keyIdx) => /* @__PURE__ */ jsxRuntime.jsx(
4852
- "span",
4853
- {
4854
- className: `px-1.5 py-0.5 text-xs rounded border ${getKeyStyle(bucketKey)}`,
4855
- children: bucketKey
4856
- },
4857
- keyIdx
4858
- )) })
4859
- ]
4860
- },
4861
- idx
4862
- ))
4863
- }
4864
- )
4837
+ className: `p-2 rounded border-2 min-h-[60px] transition-colors ${getBucketStyle(idx)}`,
4838
+ children: [
4839
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-xs font-mono text-gray-500 mb-1", children: [
4840
+ "[",
4841
+ idx,
4842
+ "]"
4843
+ ] }),
4844
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-wrap gap-1", children: bucket.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs text-gray-400 italic", children: "empty" }) : bucket.map((bucketKey, keyIdx) => /* @__PURE__ */ jsxRuntime.jsx(
4845
+ "span",
4846
+ {
4847
+ className: `px-1.5 py-0.5 text-xs rounded border ${getKeyStyle(bucketKey)}`,
4848
+ children: bucketKey
4849
+ },
4850
+ keyIdx
4851
+ )) })
4852
+ ]
4853
+ },
4854
+ idx
4855
+ )) })
4865
4856
  ] }),
4866
- operation === "insert" && key && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-4 p-3 bg-gray-100 rounded-lg", children: [
4857
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-4 p-3 bg-gray-100 rounded-lg min-h-[52px]", children: [
4867
4858
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-sm font-medium text-gray-700 mb-1", children: "Hash Calculation:" }),
4868
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "font-mono text-sm", children: [
4859
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "font-mono text-sm", children: operation === "insert" && key ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
4869
4860
  'hash("',
4870
4861
  key,
4871
4862
  '") mod ',
4872
4863
  buckets.length,
4873
4864
  " = ",
4874
4865
  bucketIndex
4875
- ] })
4866
+ ] }) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-gray-400", children: "—" }) })
4876
4867
  ] }),
4877
4868
  /* @__PURE__ */ jsxRuntime.jsx(
4878
4869
  StatusPanel,