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