@vllnt/ui 0.2.1-canary.25c4600 → 0.2.1-canary.2994ef2

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.
Files changed (33) hide show
  1. package/dist/components/auto-reload/auto-reload.js +1 -1
  2. package/dist/components/carousel/carousel.js +14 -6
  3. package/dist/components/checklist/checklist.js +31 -6
  4. package/dist/components/checklist/index.js +8 -2
  5. package/dist/components/completion-dialog/completion-dialog.js +14 -9
  6. package/dist/components/content-intro/content-intro.js +12 -11
  7. package/dist/components/conversation-thread/conversation-thread.js +3 -3
  8. package/dist/components/filter-bar/filter-bar.js +6 -6
  9. package/dist/components/gantt-chart/gantt-chart.js +8 -7
  10. package/dist/components/globe-3d/globe-3d.js +16 -4
  11. package/dist/components/interactive-timeline/interactive-timeline.js +6 -3
  12. package/dist/components/live-feed/live-feed.js +1 -1
  13. package/dist/components/map-2d/map-2d.js +1 -1
  14. package/dist/components/map-timeline/map-timeline.js +1 -1
  15. package/dist/components/mdx-content/mdx-content.js +3 -3
  16. package/dist/components/number-ticker/number-ticker.js +1 -1
  17. package/dist/components/progress-tracker/progress-tracker.js +12 -6
  18. package/dist/components/sidebar/sidebar.js +1 -1
  19. package/dist/components/social-fab/social-fab.js +4 -4
  20. package/dist/components/spinner/spinner.js +1 -1
  21. package/dist/components/stat-card/stat-card.js +1 -1
  22. package/dist/components/status-board/status-board.js +10 -4
  23. package/dist/components/tags-input/tags-input.js +11 -3
  24. package/dist/components/terminal/terminal.js +10 -2
  25. package/dist/components/theme-toggle/theme-toggle.js +2 -2
  26. package/dist/components/thinking-block/thinking-block.js +2 -2
  27. package/dist/components/tldr-section/tldr-section.js +9 -7
  28. package/dist/components/transaction-list/transaction-list.js +2 -2
  29. package/dist/components/tutorial-complete/tutorial-complete.js +1 -1
  30. package/dist/components/tutorial-intro-content/tutorial-intro-content.js +1 -1
  31. package/dist/components/tutorial-mdx/tutorial-mdx.js +1 -1
  32. package/dist/components/world-clock-bar/world-clock-bar.js +2 -2
  33. package/package.json +1 -1
@@ -39,7 +39,7 @@ function getCurrencyFormatter(locale, currency) {
39
39
  const key = `${locale}|${currency}`;
40
40
  let formatter = CURRENCY_FORMATTER_CACHE.get(key);
41
41
  if (!formatter) {
42
- formatter = new Intl.NumberFormat(locale, {
42
+ formatter = Intl.NumberFormat(locale, {
43
43
  currency,
44
44
  style: "currency"
45
45
  });
@@ -7,6 +7,7 @@ import {
7
7
  useContext,
8
8
  useEffect,
9
9
  useMemo,
10
+ useRef,
10
11
  useState
11
12
  } from "react";
12
13
  import useEmblaCarousel from "embla-carousel-react";
@@ -43,6 +44,10 @@ function useCarouselLogic({
43
44
  setCanScrollPrevious(api2.canScrollPrev());
44
45
  setCanScrollNext(api2.canScrollNext());
45
46
  }, []);
47
+ const onSelectReference = useRef(onSelect);
48
+ useEffect(() => {
49
+ onSelectReference.current = onSelect;
50
+ }, [onSelect]);
46
51
  const scrollPrevious = useCallback(() => {
47
52
  api?.scrollPrev();
48
53
  }, [api]);
@@ -71,17 +76,20 @@ function useCarouselLogic({
71
76
  if (!api) {
72
77
  return;
73
78
  }
74
- api.on("reInit", onSelect);
75
- api.on("select", onSelect);
79
+ const notifySelection = (selectedApi) => {
80
+ onSelectReference.current(selectedApi);
81
+ };
82
+ api.on("reInit", notifySelection);
83
+ api.on("select", notifySelection);
76
84
  const rafId = requestAnimationFrame(() => {
77
- onSelect(api);
85
+ notifySelection(api);
78
86
  });
79
87
  return () => {
80
- api?.off("select", onSelect);
81
- api?.off("reInit", onSelect);
88
+ api?.off("select", notifySelection);
89
+ api?.off("reInit", notifySelection);
82
90
  cancelAnimationFrame(rafId);
83
91
  };
84
- }, [api, onSelect]);
92
+ }, [api]);
85
93
  return {
86
94
  api,
87
95
  canScrollNext,
@@ -3,6 +3,31 @@ import { jsx, jsxs } from "react/jsx-runtime";
3
3
  import { useState } from "react";
4
4
  import { cn } from "../../lib/utils";
5
5
  const CHECKLIST_PROGRESS_EVENT = "vllnt:checklist-progress-change";
6
+ const CHECKLIST_STORAGE_VERSION = 1;
7
+ function stringItemsFromUnknown(value) {
8
+ return Array.isArray(value) ? value.filter((item) => typeof item === "string") : [];
9
+ }
10
+ function parseChecklistStorageValue(saved) {
11
+ try {
12
+ const parsed = JSON.parse(saved);
13
+ if (Array.isArray(parsed)) {
14
+ return stringItemsFromUnknown(parsed);
15
+ }
16
+ if (typeof parsed === "object" && parsed !== null && "version" in parsed && "checked" in parsed && parsed.version === CHECKLIST_STORAGE_VERSION) {
17
+ return stringItemsFromUnknown(parsed.checked);
18
+ }
19
+ } catch {
20
+ return [];
21
+ }
22
+ return [];
23
+ }
24
+ function createChecklistStorageValue(ids) {
25
+ const payload = {
26
+ checked: [...ids],
27
+ version: CHECKLIST_STORAGE_VERSION
28
+ };
29
+ return JSON.stringify(payload);
30
+ }
6
31
  function ChecklistItemRow({
7
32
  isChecked,
8
33
  item,
@@ -117,10 +142,7 @@ function Checklist({
117
142
  if (typeof window !== "undefined" && persistKey) {
118
143
  const saved = localStorage.getItem(`checklist:${persistKey}`);
119
144
  if (saved) {
120
- try {
121
- return new Set(JSON.parse(saved));
122
- } catch {
123
- }
145
+ return new Set(parseChecklistStorageValue(saved));
124
146
  }
125
147
  }
126
148
  return /* @__PURE__ */ new Set();
@@ -134,7 +156,7 @@ function Checklist({
134
156
  try {
135
157
  localStorage.setItem(
136
158
  `checklist:${persistKey}`,
137
- JSON.stringify([...newChecked])
159
+ createChecklistStorageValue(newChecked)
138
160
  );
139
161
  window.dispatchEvent(
140
162
  new CustomEvent(CHECKLIST_PROGRESS_EVENT, {
@@ -187,5 +209,8 @@ function Checklist({
187
209
  }
188
210
  export {
189
211
  CHECKLIST_PROGRESS_EVENT,
190
- Checklist
212
+ CHECKLIST_STORAGE_VERSION,
213
+ Checklist,
214
+ createChecklistStorageValue,
215
+ parseChecklistStorageValue
191
216
  };
@@ -1,8 +1,14 @@
1
1
  import {
2
2
  Checklist,
3
- CHECKLIST_PROGRESS_EVENT
3
+ CHECKLIST_PROGRESS_EVENT,
4
+ CHECKLIST_STORAGE_VERSION,
5
+ createChecklistStorageValue,
6
+ parseChecklistStorageValue
4
7
  } from "./checklist";
5
8
  export {
6
9
  CHECKLIST_PROGRESS_EVENT,
7
- Checklist
10
+ CHECKLIST_STORAGE_VERSION,
11
+ Checklist,
12
+ createChecklistStorageValue,
13
+ parseChecklistStorageValue
8
14
  };
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  import { jsx, jsxs } from "react/jsx-runtime";
3
- import { memo, useCallback, useEffect, useRef } from "react";
3
+ import { memo, useEffect, useRef } from "react";
4
4
  import { cn } from "../../lib/utils";
5
5
  import { Button } from "../button";
6
6
  function DialogContent({
@@ -98,8 +98,11 @@ function CompletionDialogImpl({
98
98
  onConfirm,
99
99
  title
100
100
  }) {
101
- const handleKeyDown = useCallback(
102
- (event) => {
101
+ const keyDownHandlerRef = useRef(() => {
102
+ return;
103
+ });
104
+ useEffect(() => {
105
+ keyDownHandlerRef.current = (event) => {
103
106
  if (!isOpen) return;
104
107
  if (event.key === "Escape") {
105
108
  event.preventDefault();
@@ -118,16 +121,18 @@ function CompletionDialogImpl({
118
121
  event.stopPropagation();
119
122
  onCancel();
120
123
  }
121
- },
122
- [isOpen, onClose, onConfirm, onCancel, confirmShortcut, cancelShortcut]
123
- );
124
+ };
125
+ }, [cancelShortcut, confirmShortcut, isOpen, onCancel, onClose, onConfirm]);
124
126
  useEffect(() => {
125
127
  if (!isOpen) return;
126
- document.addEventListener("keydown", handleKeyDown, true);
128
+ const onDocumentKeyDown = (event) => {
129
+ keyDownHandlerRef.current(event);
130
+ };
131
+ document.addEventListener("keydown", onDocumentKeyDown, true);
127
132
  return () => {
128
- document.removeEventListener("keydown", handleKeyDown, true);
133
+ document.removeEventListener("keydown", onDocumentKeyDown, true);
129
134
  };
130
- }, [isOpen, handleKeyDown]);
135
+ }, [isOpen]);
131
136
  if (!isOpen) return null;
132
137
  return /* @__PURE__ */ jsxs(
133
138
  "div",
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
- import { memo, useCallback, useEffect } from "react";
3
+ import { memo, useEffect, useRef } from "react";
4
4
  import { cn } from "../../lib/utils";
5
5
  import { Button } from "../button";
6
6
  const DEFAULT_LABELS = {
@@ -25,21 +25,22 @@ function ContentIntroImpl({
25
25
  }) {
26
26
  const mergedLabels = { ...DEFAULT_LABELS, ...labels };
27
27
  const hasProgress = completedSections.size > 0;
28
- const handleKeyDown = useCallback(
29
- (event) => {
28
+ const onStartRef = useRef(onStart);
29
+ useEffect(() => {
30
+ onStartRef.current = onStart;
31
+ }, [onStart]);
32
+ useEffect(() => {
33
+ const onDocumentKeyDown = (event) => {
30
34
  if (event.key === "Enter") {
31
35
  event.preventDefault();
32
- onStart();
36
+ onStartRef.current();
33
37
  }
34
- },
35
- [onStart]
36
- );
37
- useEffect(() => {
38
- document.addEventListener("keydown", handleKeyDown);
38
+ };
39
+ document.addEventListener("keydown", onDocumentKeyDown);
39
40
  return () => {
40
- document.removeEventListener("keydown", handleKeyDown);
41
+ document.removeEventListener("keydown", onDocumentKeyDown);
41
42
  };
42
- }, [handleKeyDown]);
43
+ }, []);
43
44
  return /* @__PURE__ */ jsxs(Fragment, { children: [
44
45
  /* @__PURE__ */ jsxs("div", { className: "animate-in fade-in-0 duration-500 pb-24", children: [
45
46
  /* @__PURE__ */ jsxs("section", { className: "py-6", children: [
@@ -319,18 +319,18 @@ const ConversationLoading = forwardRef(({ className }, reference) => {
319
319
  /* @__PURE__ */ jsx(
320
320
  "span",
321
321
  {
322
- className: "size-2 animate-bounce rounded-full bg-muted-foreground",
322
+ className: "size-2 animate-pulse rounded-full bg-muted-foreground",
323
323
  style: { animationDelay: "-0.3s" }
324
324
  }
325
325
  ),
326
326
  /* @__PURE__ */ jsx(
327
327
  "span",
328
328
  {
329
- className: "size-2 animate-bounce rounded-full bg-muted-foreground",
329
+ className: "size-2 animate-pulse rounded-full bg-muted-foreground",
330
330
  style: { animationDelay: "-0.15s" }
331
331
  }
332
332
  ),
333
- /* @__PURE__ */ jsx("span", { className: "size-2 animate-bounce rounded-full bg-muted-foreground" })
333
+ /* @__PURE__ */ jsx("span", { className: "size-2 animate-pulse rounded-full bg-muted-foreground" })
334
334
  ]
335
335
  }
336
336
  );
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  import { jsx, jsxs } from "react/jsx-runtime";
3
- import { memo, useCallback, useState } from "react";
3
+ import { memo, useCallback, useTransition } from "react";
4
4
  import { cn } from "../../lib/utils";
5
5
  import { Badge } from "../badge";
6
6
  function SearchInput({
@@ -160,15 +160,15 @@ function FilterBarImpl({
160
160
  searchQuery,
161
161
  tags
162
162
  }) {
163
- const [isPending, setIsPending] = useState(false);
163
+ const [isPending, startTransition] = useTransition();
164
164
  const mergedLabels = { ...DEFAULT_LABELS, ...labels };
165
165
  const handleDifficultyChange = useCallback(
166
166
  (difficulty) => {
167
- setIsPending(true);
168
- onFiltersChange({ difficulty });
169
- setIsPending(false);
167
+ startTransition(() => {
168
+ onFiltersChange({ difficulty });
169
+ });
170
170
  },
171
- [onFiltersChange]
171
+ [onFiltersChange, startTransition]
172
172
  );
173
173
  const handleSearchChange = useCallback(
174
174
  (search) => {
@@ -56,7 +56,7 @@ function getTickDateTimeFormatter(locale, scale) {
56
56
  let formatter = TICK_FORMATTER_CACHE.get(key);
57
57
  if (!formatter) {
58
58
  const options = scale === "month" ? { month: "short", year: "numeric" } : { day: "2-digit", month: "short" };
59
- formatter = new Intl.DateTimeFormat(locale, options);
59
+ formatter = Intl.DateTimeFormat(locale, options);
60
60
  TICK_FORMATTER_CACHE.set(key, formatter);
61
61
  }
62
62
  return formatter;
@@ -93,13 +93,14 @@ function buildTicks(input) {
93
93
  const formatter = buildTickFormatter(scale, locale);
94
94
  const stepDays = getTickStep(scale);
95
95
  const tickCount = Math.floor(totalDays / stepDays);
96
- return Array.from({ length: tickCount + 1 }).map((_, index) => {
96
+ return Array.from({ length: tickCount + 1 }).reduce((ticks, _, index) => {
97
97
  const day = index * stepDays;
98
- return {
99
- date: new Date(start.getTime() + day * MS_PER_DAY),
100
- offset: day
101
- };
102
- }).filter((tick) => tick.date.getTime() <= end.getTime()).map((tick) => ({ label: formatter(tick.date), offset: tick.offset }));
98
+ const date = new Date(start.getTime() + day * MS_PER_DAY);
99
+ if (date.getTime() <= end.getTime()) {
100
+ ticks.push({ label: formatter(date), offset: day });
101
+ }
102
+ return ticks;
103
+ }, []);
103
104
  }
104
105
  function useChartGeometry(options) {
105
106
  const { endDate, locale, scale, startDate } = options;
@@ -161,9 +161,12 @@ const GlobeArc = forwardRef(
161
161
  GlobeArc.displayName = "GlobeArc";
162
162
  function buildLine(arguments_) {
163
163
  const { points, rotationLat, rotationLng } = arguments_;
164
- return points.map((coord) => project(coord, rotationLng, rotationLat)).reduce(
165
- (state, projected) => {
166
- if (!projected.visible) return { path: state.path, pen: "up" };
164
+ return points.reduce(
165
+ (state, coord) => {
166
+ const projected = project(coord, rotationLng, rotationLat);
167
+ if (!projected.visible) {
168
+ return { path: state.path, pen: "up" };
169
+ }
167
170
  const head = state.pen === "up" ? "M" : "L";
168
171
  const separator = state.path.length > 0 ? " " : "";
169
172
  return {
@@ -185,7 +188,16 @@ function Graticule({ rotationLat, rotationLng }) {
185
188
  const meridians = range(-150, 180, 30).map(
186
189
  (lng) => range(-85, 85, 5).map((lat) => ({ lat, lng }))
187
190
  );
188
- const lines = [...parallels, ...meridians].map((points) => buildLine({ points, rotationLat, rotationLng })).filter((path) => path.length > 0);
191
+ const lines = [...parallels, ...meridians].reduce(
192
+ (paths, points) => {
193
+ const path = buildLine({ points, rotationLat, rotationLng });
194
+ if (path.length > 0) {
195
+ paths.push(path);
196
+ }
197
+ return paths;
198
+ },
199
+ []
200
+ );
189
201
  return /* @__PURE__ */ jsx(
190
202
  "g",
191
203
  {
@@ -607,9 +607,12 @@ function useTimelineContextValue(arguments_) {
607
607
  function useTimelineFilter(categories, events) {
608
608
  const [hidden, setHidden] = useState(() => /* @__PURE__ */ new Set());
609
609
  const visibleCategories = useMemo(
610
- () => new Set(
611
- categories.filter((category) => !hidden.has(category.id)).map((category) => category.id)
612
- ),
610
+ () => categories.reduce((visible, category) => {
611
+ if (!hidden.has(category.id)) {
612
+ visible.add(category.id);
613
+ }
614
+ return visible;
615
+ }, /* @__PURE__ */ new Set()),
613
616
  [categories, hidden]
614
617
  );
615
618
  const toggleCategory = useCallback((id) => {
@@ -131,7 +131,7 @@ const LiveFeed = React.forwardRef(
131
131
  [events, maxItems]
132
132
  );
133
133
  return /* @__PURE__ */ jsxs(Card, { className: cn("shadow-sm", className), ref, ...props, children: [
134
- /* @__PURE__ */ jsxs(CardHeader, { className: "flex flex-row items-start justify-between gap-3 space-y-0 pb-3", children: [
134
+ /* @__PURE__ */ jsxs(CardHeader, { className: "flex flex-row items-start justify-between gap-3 gap-y-0 pb-3", children: [
135
135
  /* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
136
136
  /* @__PURE__ */ jsx(CardTitle, { className: "text-base", children: title }),
137
137
  description ? /* @__PURE__ */ jsx(CardDescription, { children: description }) : null
@@ -53,7 +53,7 @@ function useMapState(arguments_) {
53
53
  }, [center]);
54
54
  const [pan, setPan] = useState(initialPan);
55
55
  const [zoom, setZoom] = useState(
56
- clamp(initialZoom, MIN_ZOOM, MAX_ZOOM)
56
+ () => clamp(initialZoom, MIN_ZOOM, MAX_ZOOM)
57
57
  );
58
58
  const zoomIn = useCallback(() => {
59
59
  setZoom((current) => clamp(current * ZOOM_STEP, MIN_ZOOM, MAX_ZOOM));
@@ -301,7 +301,7 @@ function useTimelineCtx(arguments_) {
301
301
  function useTimelineState(arguments_) {
302
302
  const { endYear, initialYear, onYearChange, startYear } = arguments_;
303
303
  const [year, setYear] = useState(
304
- clamp(initialYear ?? startYear, startYear, endYear)
304
+ () => clamp(initialYear ?? startYear, startYear, endYear)
305
305
  );
306
306
  const [isPlaying, setIsPlaying] = useState(false);
307
307
  const updateYear = useCallback(
@@ -16,7 +16,7 @@ const MDXComponents = {
16
16
  blockquote: ({ children, ...props }) => /* @__PURE__ */ jsx(
17
17
  "blockquote",
18
18
  {
19
- className: "border-l-4 border-primary pl-4 italic text-muted-foreground my-6 py-2 text-sm",
19
+ className: "border-l border-primary pl-4 italic text-muted-foreground my-6 py-2 text-sm",
20
20
  ...props,
21
21
  children
22
22
  }
@@ -89,8 +89,8 @@ const proseClasses = [
89
89
  "prose-strong:font-semibold prose-em:italic",
90
90
  "prose-a:text-primary prose-a:underline prose-a:underline-offset-4 hover:prose-a:text-primary/80",
91
91
  "prose-code:bg-muted prose-code:px-1 prose-code:py-0.5 prose-code:rounded prose-code:text-sm prose-code:font-mono",
92
- "prose-pre:my-6 prose-pre:overflow-x-auto prose-pre:rounded-lg prose-pre:border prose-pre:bg-black prose-pre:py-4 prose-pre:font-mono prose-pre:text-sm prose-pre:text-white prose-pre:shadow-lg dark:prose-pre:bg-zinc-900",
93
- "prose-blockquote:border-l-4 prose-blockquote:border-primary prose-blockquote:pl-4 prose-blockquote:italic prose-blockquote:text-muted-foreground prose-blockquote:my-6 prose-blockquote:py-2",
92
+ "prose-pre:my-6 prose-pre:overflow-x-auto prose-pre:rounded-lg prose-pre:border prose-pre:bg-zinc-950 prose-pre:py-4 prose-pre:font-mono prose-pre:text-sm prose-pre:text-white prose-pre:shadow-lg dark:prose-pre:bg-zinc-900",
93
+ "prose-blockquote:border-l prose-blockquote:border-primary prose-blockquote:pl-4 prose-blockquote:italic prose-blockquote:text-muted-foreground prose-blockquote:my-6 prose-blockquote:py-2",
94
94
  "prose-hr:my-8 prose-hr:border-border",
95
95
  "prose-table:w-full prose-table:border-collapse prose-table:border prose-table:border-border",
96
96
  "prose-th:border prose-th:border-border prose-th:bg-muted prose-th:p-2 prose-th:text-left prose-th:font-medium",
@@ -7,7 +7,7 @@ function getNumberTickerFormatter(locale, formatOptions) {
7
7
  const key = `${locale ?? ""}|${formatOptions ? JSON.stringify(formatOptions) : ""}`;
8
8
  let formatter = NUMBER_FORMATTER_CACHE.get(key);
9
9
  if (!formatter) {
10
- formatter = new Intl.NumberFormat(locale, formatOptions);
10
+ formatter = Intl.NumberFormat(locale, formatOptions);
11
11
  NUMBER_FORMATTER_CACHE.set(key, formatter);
12
12
  }
13
13
  return formatter;
@@ -10,7 +10,10 @@ import {
10
10
  CardHeader,
11
11
  CardTitle
12
12
  } from "../card";
13
- import { CHECKLIST_PROGRESS_EVENT } from "../checklist";
13
+ import {
14
+ CHECKLIST_PROGRESS_EVENT,
15
+ parseChecklistStorageValue
16
+ } from "../checklist";
14
17
  import { ProgressBar } from "../progress-bar";
15
18
  const ProgressTrackerContext = React.createContext(null);
16
19
  function clampPercentage(value) {
@@ -41,15 +44,13 @@ function readPersistedChecklistItems(persistKey) {
41
44
  try {
42
45
  const saved = localStorage.getItem(`checklist:${persistKey}`);
43
46
  if (!saved) return [];
44
- const parsed = JSON.parse(saved);
45
- return Array.isArray(parsed) ? parsed.filter((item) => typeof item === "string") : [];
47
+ return parseChecklistStorageValue(saved);
46
48
  } catch {
47
49
  return [];
48
50
  }
49
51
  }
50
52
  function areStringArraysEqual(left, right) {
51
- if (left.length !== right.length) return false;
52
- return left.every((value, index) => value === right[index]);
53
+ return left.length === right.length && left.every((value, index) => value === right[index]);
53
54
  }
54
55
  function getChecklistPersistKey(event) {
55
56
  if (!(event instanceof CustomEvent)) return null;
@@ -162,7 +163,12 @@ function ProgressTrackerOverview({
162
163
  }) {
163
164
  const { modules, overallProgress, streak, title } = useProgressTrackerContext();
164
165
  const trackedPersistKeys = React.useMemo(
165
- () => modules.map((module) => module.persistKey).filter(Boolean),
166
+ () => modules.reduce((keys, module) => {
167
+ if (module.persistKey) {
168
+ keys.push(module.persistKey);
169
+ }
170
+ return keys;
171
+ }, []),
166
172
  [modules]
167
173
  );
168
174
  const [, forceChecklistRefresh] = React.useState(0);
@@ -37,7 +37,7 @@ function useScrollFade(containerReference) {
37
37
  setShowBottomFade(scrollTop < scrollHeight - clientHeight - 1);
38
38
  };
39
39
  checkScroll();
40
- container.addEventListener("scroll", checkScroll);
40
+ container.addEventListener("scroll", checkScroll, { passive: true });
41
41
  return () => {
42
42
  container.removeEventListener("scroll", checkScroll);
43
43
  };
@@ -7,7 +7,7 @@ function ShareMenu({
7
7
  onPlatformSelect,
8
8
  platforms
9
9
  }) {
10
- return /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-0.5 rounded-md border border-gray-300 bg-background p-1.5 shadow-md dark:border-gray-600", children: platforms.map((p) => {
10
+ return /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-0.5 rounded-md border border-zinc-300 bg-background p-1.5 shadow-md dark:border-zinc-600", children: platforms.map((p) => {
11
11
  const handleSelectSharePlatform = () => {
12
12
  onPlatformSelect(p.key);
13
13
  };
@@ -47,7 +47,7 @@ function ActionPanel({
47
47
  const handleShareClick = shareAction?.onClick;
48
48
  const handleShareMouseEnter = isMobile ? void 0 : onShareHover;
49
49
  const handleShareMouseLeave = isMobile ? void 0 : onShareLeave;
50
- return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-0.5 rounded-md border border-gray-300 bg-background p-1.5 shadow-md dark:border-gray-600", children: [
50
+ return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-0.5 rounded-md border border-zinc-300 bg-background p-1.5 shadow-md dark:border-zinc-600", children: [
51
51
  shareAction ? /* @__PURE__ */ jsx(
52
52
  "button",
53
53
  {
@@ -77,9 +77,9 @@ function MainFabButton({
77
77
  "aria-label": isExpanded ? labels.close : labels.share,
78
78
  className: cn(
79
79
  "flex size-10 items-center justify-center rounded-md",
80
- "border border-gray-300 bg-background dark:border-gray-600",
80
+ "border border-zinc-300 bg-background dark:border-zinc-600",
81
81
  "transition-all duration-200 ease-out",
82
- "hover:-translate-y-0.5 hover:border-gray-400 hover:shadow-md dark:hover:border-gray-500"
82
+ "hover:-translate-y-0.5 hover:border-zinc-400 hover:shadow-md dark:hover:border-zinc-500"
83
83
  ),
84
84
  onClick: handleToggleSharePanel,
85
85
  type: "button",
@@ -14,7 +14,7 @@ function Spinner({ className, size = "md", ...props }) {
14
14
  className
15
15
  ),
16
16
  ...props,
17
- children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Loading..." })
17
+ children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Loading\u2026" })
18
18
  }
19
19
  );
20
20
  }
@@ -74,7 +74,7 @@ const StatCard = React.forwardRef(
74
74
  ...props,
75
75
  children: [
76
76
  /* @__PURE__ */ jsx("div", { className: accentVariants({ tone }) }),
77
- /* @__PURE__ */ jsxs(CardHeader, { className: "flex flex-row items-start justify-between gap-4 space-y-0 pb-3", children: [
77
+ /* @__PURE__ */ jsxs(CardHeader, { className: "flex flex-row items-start justify-between gap-4 gap-y-0 pb-3", children: [
78
78
  /* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
79
79
  /* @__PURE__ */ jsx(CardDescription, { className: "text-xs font-medium uppercase tracking-[0.14em]", children: label }),
80
80
  /* @__PURE__ */ jsx("div", { className: "text-3xl font-semibold tracking-tight", children: value })
@@ -71,10 +71,16 @@ function getSummary(items) {
71
71
  warning: 0
72
72
  }
73
73
  );
74
- return STATUS_ORDER.map((status) => ({
75
- count: counts[status],
76
- status
77
- })).filter((entry) => entry.count > 0);
74
+ return STATUS_ORDER.reduce(
75
+ (summary, status) => {
76
+ const count = counts[status];
77
+ if (count > 0) {
78
+ summary.push({ count, status });
79
+ }
80
+ return summary;
81
+ },
82
+ []
83
+ );
78
84
  }
79
85
  function StatusBoardSummary({ items }) {
80
86
  return /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-2", children: getSummary(items).map(({ count, status }) => {
@@ -7,9 +7,17 @@ function normalizeTag(tag) {
7
7
  return tag.trim();
8
8
  }
9
9
  function getNormalizedTags(tags) {
10
- return tags.map(normalizeTag).filter(
11
- (tag, index, values) => tag.length > 0 && values.indexOf(tag) === index
12
- );
10
+ return tags.reduce(
11
+ (state, tag) => {
12
+ const normalizedTag = normalizeTag(tag);
13
+ if (normalizedTag.length > 0 && !state.seen.has(normalizedTag)) {
14
+ state.seen.add(normalizedTag);
15
+ state.tags.push(normalizedTag);
16
+ }
17
+ return state;
18
+ },
19
+ { seen: /* @__PURE__ */ new Set(), tags: [] }
20
+ ).tags;
13
21
  }
14
22
  function shouldAddTagFromKey(key) {
15
23
  return key === "Enter" || key === ",";
@@ -3,13 +3,21 @@ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
3
  import { useState } from "react";
4
4
  import { Check, Copy, Terminal as TerminalIcon } from "lucide-react";
5
5
  import { Button } from "../button";
6
+ function getCommandContents(lines) {
7
+ return lines.reduce((commands, line) => {
8
+ if (line.type === "command") {
9
+ commands.push(line.content);
10
+ }
11
+ return commands;
12
+ }, []);
13
+ }
6
14
  function Terminal({
7
15
  copyable = true,
8
16
  lines,
9
17
  title = "Terminal"
10
18
  }) {
11
19
  const [copied, setCopied] = useState(false);
12
- const commands = lines.filter((l) => l.type === "command").map((l) => l.content);
20
+ const commands = getCommandContents(lines);
13
21
  const handleCopy = async () => {
14
22
  await navigator.clipboard.writeText(commands.join("\n"));
15
23
  setCopied(true);
@@ -75,7 +83,7 @@ function SimpleTerminal({
75
83
  }
76
84
  return { content: line, type: "output" };
77
85
  });
78
- const commands = lines.filter((l) => l.type === "command").map((l) => l.content);
86
+ const commands = getCommandContents(lines);
79
87
  const handleCopy = async () => {
80
88
  await navigator.clipboard.writeText(commands.join("\n"));
81
89
  setCopied(true);
@@ -20,7 +20,7 @@ function ThemeButton({
20
20
  Button,
21
21
  {
22
22
  "aria-label": ariaLabel,
23
- className: "bg-background text-foreground border border-gray-300 dark:border-gray-600 hover:border-gray-400 dark:hover:border-gray-500 transition-colors",
23
+ className: "bg-background text-foreground border border-zinc-300 dark:border-zinc-600 hover:border-zinc-400 dark:hover:border-zinc-500 transition-colors",
24
24
  size: "icon",
25
25
  variant: "outline",
26
26
  ...props,
@@ -120,7 +120,7 @@ function ThemeToggle({ dict }) {
120
120
  DropdownMenuContent,
121
121
  {
122
122
  align: "end",
123
- className: "bg-background border border-gray-300 dark:border-gray-600",
123
+ className: "bg-background border border-zinc-300 dark:border-zinc-600",
124
124
  onMouseEnter: () => {
125
125
  isHoveringOverMenuAreaReference.current = true;
126
126
  clearCloseTimer();
@@ -33,7 +33,7 @@ function ThinkingBlock({
33
33
  isExpanded ? /* @__PURE__ */ jsx(ChevronDown, { className: "size-3" }) : /* @__PURE__ */ jsx(ChevronRight, { className: "size-3" }),
34
34
  /* @__PURE__ */ jsxs("span", { children: [
35
35
  "Thinking",
36
- isStreaming ? /* @__PURE__ */ jsx("span", { className: "ml-1 animate-pulse", children: "..." }) : null
36
+ isStreaming ? /* @__PURE__ */ jsx("span", { className: "ml-1 animate-pulse", children: "\u2026" }) : null
37
37
  ] })
38
38
  ]
39
39
  }
@@ -41,7 +41,7 @@ function ThinkingBlock({
41
41
  isExpanded ? /* @__PURE__ */ jsxs(
42
42
  "div",
43
43
  {
44
- className: "mt-2 p-3 bg-muted/50 rounded text-xs text-muted-foreground whitespace-pre-wrap border-l-2 border-muted-foreground/30 max-h-48 overflow-y-auto",
44
+ className: "mt-2 p-3 bg-muted/50 rounded text-xs text-muted-foreground whitespace-pre-wrap border-l border-muted-foreground/30 max-h-48 overflow-y-auto",
45
45
  id: contentId,
46
46
  children: [
47
47
  thinking,
@@ -3,20 +3,20 @@ import { jsx, jsxs } from "react/jsx-runtime";
3
3
  import { useEffect, useRef, useState } from "react";
4
4
  function TLDRSection({ children, label }) {
5
5
  const [isExpanded, setIsExpanded] = useState(false);
6
- const [isLoading, setIsLoading] = useState(false);
7
- const [hasBeenOpened, setHasBeenOpened] = useState(false);
6
+ const [showSkeleton, setShowSkeleton] = useState(false);
7
+ const hasBeenOpenedRef = useRef(false);
8
8
  const timerReference = useRef(null);
9
9
  useEffect(() => {
10
- if (isExpanded && !hasBeenOpened) {
10
+ if (isExpanded && !hasBeenOpenedRef.current) {
11
11
  if (timerReference.current) {
12
12
  clearTimeout(timerReference.current);
13
13
  }
14
14
  const rafId = requestAnimationFrame(() => {
15
- setIsLoading(true);
16
- setHasBeenOpened(true);
15
+ setShowSkeleton(true);
16
+ hasBeenOpenedRef.current = true;
17
17
  });
18
18
  timerReference.current = setTimeout(() => {
19
- setIsLoading(false);
19
+ setShowSkeleton(false);
20
20
  timerReference.current = null;
21
21
  }, 800);
22
22
  return () => {
@@ -25,6 +25,7 @@ function TLDRSection({ children, label }) {
25
25
  clearTimeout(timerReference.current);
26
26
  timerReference.current = null;
27
27
  }
28
+ setShowSkeleton(false);
28
29
  };
29
30
  }
30
31
  return () => {
@@ -32,6 +33,7 @@ function TLDRSection({ children, label }) {
32
33
  clearTimeout(timerReference.current);
33
34
  timerReference.current = null;
34
35
  }
36
+ setShowSkeleton(false);
35
37
  };
36
38
  }, [isExpanded]);
37
39
  return /* @__PURE__ */ jsxs("div", { className: "my-8 rounded-lg border border-border bg-muted/30 overflow-hidden", children: [
@@ -88,7 +90,7 @@ function TLDRSection({ children, label }) {
88
90
  ]
89
91
  }
90
92
  ),
91
- isExpanded ? /* @__PURE__ */ jsx("div", { className: "px-4 pb-4 pt-2 border-t border-border", children: isLoading ? /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
93
+ isExpanded ? /* @__PURE__ */ jsx("div", { className: "px-4 pb-4 pt-2 border-t border-border", children: showSkeleton ? /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
92
94
  /* @__PURE__ */ jsx("div", { className: "relative h-4 bg-muted/50 rounded overflow-hidden", children: /* @__PURE__ */ jsx("div", { className: "absolute inset-0 bg-gradient-to-r from-transparent via-amber-400/40 to-transparent animate-shimmer" }) }),
93
95
  /* @__PURE__ */ jsx("div", { className: "relative h-4 bg-muted/50 rounded overflow-hidden w-5/6", children: /* @__PURE__ */ jsx("div", { className: "absolute inset-0 bg-gradient-to-r from-transparent via-amber-400/40 to-transparent animate-shimmer" }) }),
94
96
  /* @__PURE__ */ jsx("div", { className: "relative h-4 bg-muted/50 rounded overflow-hidden w-4/5", children: /* @__PURE__ */ jsx("div", { className: "absolute inset-0 bg-gradient-to-r from-transparent via-amber-400/40 to-transparent animate-shimmer" }) }),
@@ -12,7 +12,7 @@ function getCurrencyFormatter(locale, currency) {
12
12
  const key = `${locale}|${currency}`;
13
13
  let formatter = CURRENCY_FORMATTER_CACHE.get(key);
14
14
  if (!formatter) {
15
- formatter = new Intl.NumberFormat(locale, {
15
+ formatter = Intl.NumberFormat(locale, {
16
16
  currency,
17
17
  style: "currency"
18
18
  });
@@ -24,7 +24,7 @@ const DATE_FORMATTER_CACHE = /* @__PURE__ */ new Map();
24
24
  function getTransactionDateFormatter(locale) {
25
25
  let formatter = DATE_FORMATTER_CACHE.get(locale);
26
26
  if (!formatter) {
27
- formatter = new Intl.DateTimeFormat(locale, {
27
+ formatter = Intl.DateTimeFormat(locale, {
28
28
  day: "numeric",
29
29
  month: "short",
30
30
  year: "numeric"
@@ -119,7 +119,7 @@ function TutorialCompleteImpl({
119
119
  /* @__PURE__ */ jsx("div", { className: "text-center pt-8", children: /* @__PURE__ */ jsx(
120
120
  LinkComponent,
121
121
  {
122
- className: "inline-flex items-center space-x-2 text-muted-foreground hover:text-foreground transition-colors",
122
+ className: "inline-flex items-center gap-x-2 text-muted-foreground hover:text-foreground transition-colors",
123
123
  href: backHref,
124
124
  children: /* @__PURE__ */ jsxs("span", { children: [
125
125
  "\u2190 ",
@@ -21,7 +21,7 @@ const serverMarkdownComponents = {
21
21
  }) => /* @__PURE__ */ jsx(
22
22
  "blockquote",
23
23
  {
24
- className: "border-l-4 border-primary pl-4 italic text-muted-foreground my-6 py-2 text-sm",
24
+ className: "border-l border-primary pl-4 italic text-muted-foreground my-6 py-2 text-sm",
25
25
  ...props,
26
26
  children
27
27
  }
@@ -95,7 +95,7 @@ const markdownComponents = {
95
95
  blockquote: ({ children, ...props }) => /* @__PURE__ */ jsx(
96
96
  "blockquote",
97
97
  {
98
- className: "border-l-4 border-primary pl-4 italic text-muted-foreground my-6 py-2 text-sm",
98
+ className: "border-l border-primary pl-4 italic text-muted-foreground my-6 py-2 text-sm",
99
99
  ...props,
100
100
  children
101
101
  }
@@ -34,7 +34,7 @@ function getTimeFormatter(locale, timeZone) {
34
34
  const key = `${locale}|${timeZone}`;
35
35
  let formatter = TIME_FORMATTER_CACHE.get(key);
36
36
  if (!formatter) {
37
- formatter = new Intl.DateTimeFormat(locale, {
37
+ formatter = Intl.DateTimeFormat(locale, {
38
38
  hour: "numeric",
39
39
  minute: "2-digit",
40
40
  timeZone,
@@ -49,7 +49,7 @@ function getDateFormatter(locale, timeZone) {
49
49
  const key = `${locale}|${timeZone}`;
50
50
  let formatter = DATE_FORMATTER_CACHE.get(key);
51
51
  if (!formatter) {
52
- formatter = new Intl.DateTimeFormat(locale, {
52
+ formatter = Intl.DateTimeFormat(locale, {
53
53
  day: "numeric",
54
54
  month: "short",
55
55
  timeZone,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vllnt/ui",
3
- "version": "0.2.1-canary.25c4600",
3
+ "version": "0.2.1-canary.2994ef2",
4
4
  "description": "React component library — 225 components built on Radix UI, Tailwind CSS, and CVA",
5
5
  "license": "MIT",
6
6
  "author": "vllnt",