@vllnt/ui 0.2.1-canary.e1bc2b3 → 0.2.1-canary.e62eaf0

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 (256) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/dist/components/accordion/accordion.js +2 -2
  3. package/dist/components/activity-heatmap/activity-heatmap.js +17 -14
  4. package/dist/components/activity-log/activity-log.js +5 -5
  5. package/dist/components/agent-activity/agent-activity.js +311 -0
  6. package/dist/components/agent-activity/index.js +18 -0
  7. package/dist/components/ai-artifact/ai-artifact.js +422 -0
  8. package/dist/components/ai-artifact/index.js +24 -0
  9. package/dist/components/ai-chat-input/ai-chat-input.js +2 -2
  10. package/dist/components/ai-message-bubble/ai-message-bubble.js +1 -1
  11. package/dist/components/ai-sidebar/ai-sidebar.js +254 -0
  12. package/dist/components/ai-sidebar/index.js +22 -0
  13. package/dist/components/ai-source-citation/ai-source-citation.js +2 -2
  14. package/dist/components/ai-tool-call-display/ai-tool-call-display.js +4 -4
  15. package/dist/components/alert-pulse/alert-pulse.js +93 -0
  16. package/dist/components/alert-pulse/index.js +6 -0
  17. package/dist/components/animated-text/animated-text.js +1 -4
  18. package/dist/components/auto-reload/auto-reload.js +377 -0
  19. package/dist/components/auto-reload/index.js +6 -0
  20. package/dist/components/avatar/avatar.js +1 -1
  21. package/dist/components/avatar-group/avatar-group.js +4 -4
  22. package/dist/components/banner/banner.js +155 -0
  23. package/dist/components/banner/index.js +10 -0
  24. package/dist/components/blog-card/blog-card.js +3 -1
  25. package/dist/components/bottom-activity-strip/bottom-activity-strip.js +91 -0
  26. package/dist/components/bottom-activity-strip/index.js +6 -0
  27. package/dist/components/breadcrumb/breadcrumb.js +33 -26
  28. package/dist/components/button/button.js +1 -1
  29. package/dist/components/calendar/calendar.js +6 -6
  30. package/dist/components/callout/callout.js +1 -1
  31. package/dist/components/candlestick-chart/candlestick-chart.js +3 -2
  32. package/dist/components/canvas-shell/canvas-foundation-demo.js +4 -4
  33. package/dist/components/carousel/carousel.js +18 -10
  34. package/dist/components/chat-dock-section/chat-dock-section.js +1 -1
  35. package/dist/components/checkbox/checkbox.js +2 -2
  36. package/dist/components/checklist/checklist.js +38 -10
  37. package/dist/components/checklist/index.js +8 -2
  38. package/dist/components/choropleth-map/choropleth-map.js +373 -0
  39. package/dist/components/choropleth-map/index.js +10 -0
  40. package/dist/components/chronological-timeline/chronological-timeline.js +338 -0
  41. package/dist/components/chronological-timeline/index.js +8 -0
  42. package/dist/components/civilization-card/civilization-card.js +258 -0
  43. package/dist/components/civilization-card/index.js +8 -0
  44. package/dist/components/code-block/code-block.js +2 -2
  45. package/dist/components/code-playground/code-playground.js +10 -8
  46. package/dist/components/combobox/combobox.js +46 -22
  47. package/dist/components/command/command.js +1 -1
  48. package/dist/components/comment-pin/comment-pin.js +104 -0
  49. package/dist/components/comment-pin/index.js +6 -0
  50. package/dist/components/comparison/comparison.js +11 -10
  51. package/dist/components/completion-dialog/completion-dialog.js +19 -11
  52. package/dist/components/content-intro/content-intro.js +24 -20
  53. package/dist/components/context-lens/context-lens.js +98 -0
  54. package/dist/components/context-lens/index.js +6 -0
  55. package/dist/components/context-menu/context-menu.js +4 -4
  56. package/dist/components/conversation-thread/conversation-thread.js +8 -8
  57. package/dist/components/cookie-consent/cookie-consent.js +1 -1
  58. package/dist/components/copy-button/copy-button.js +189 -0
  59. package/dist/components/copy-button/index.js +8 -0
  60. package/dist/components/countdown-timer/countdown-timer.js +8 -7
  61. package/dist/components/credit-badge/credit-badge.js +1 -7
  62. package/dist/components/curriculum/curriculum.js +10 -10
  63. package/dist/components/data-list/data-list.js +1 -1
  64. package/dist/components/data-table/data-table.js +5 -4
  65. package/dist/components/date-picker/date-picker.js +1 -1
  66. package/dist/components/dialog/dialog.js +1 -1
  67. package/dist/components/document-sibling-nav/document-sibling-nav.js +111 -0
  68. package/dist/components/document-sibling-nav/index.js +8 -0
  69. package/dist/components/dropdown-menu/dropdown-menu.js +3 -3
  70. package/dist/components/empty-state/empty-state.js +93 -0
  71. package/dist/components/empty-state/index.js +8 -0
  72. package/dist/components/era-comparison/era-comparison.js +198 -0
  73. package/dist/components/era-comparison/index.js +16 -0
  74. package/dist/components/exercise/exercise.js +14 -6
  75. package/dist/components/faq/faq.js +8 -4
  76. package/dist/components/file-upload/file-upload.js +3 -3
  77. package/dist/components/filter-bar/filter-bar.js +8 -7
  78. package/dist/components/flashcard/flashcard.js +1 -1
  79. package/dist/components/floating-action-button/floating-action-button.js +1 -1
  80. package/dist/components/floating-toolbar/floating-toolbar.js +66 -0
  81. package/dist/components/floating-toolbar/index.js +6 -0
  82. package/dist/components/flow-diagram/flow-controls.js +9 -9
  83. package/dist/components/flow-diagram/flow-error-boundary.js +2 -2
  84. package/dist/components/flow-diagram/flow-fullscreen.js +2 -2
  85. package/dist/components/follow-mode/follow-mode.js +89 -0
  86. package/dist/components/follow-mode/index.js +6 -0
  87. package/dist/components/gantt-chart/gantt-chart.js +334 -0
  88. package/dist/components/gantt-chart/index.js +6 -0
  89. package/dist/components/geography-quiz-map/geography-quiz-map.js +343 -0
  90. package/dist/components/geography-quiz-map/index.js +12 -0
  91. package/dist/components/globe-3d/globe-3d.js +429 -0
  92. package/dist/components/globe-3d/index.js +10 -0
  93. package/dist/components/handoff-beacon/handoff-beacon.js +78 -0
  94. package/dist/components/handoff-beacon/index.js +6 -0
  95. package/dist/components/heat-map-overlay/heat-map-overlay.js +215 -0
  96. package/dist/components/heat-map-overlay/index.js +6 -0
  97. package/dist/components/heat-overlay/heat-overlay.js +92 -0
  98. package/dist/components/heat-overlay/index.js +6 -0
  99. package/dist/components/historic-timeline/historic-timeline.js +342 -0
  100. package/dist/components/historic-timeline/index.js +6 -0
  101. package/dist/components/historical-figure-card/historical-figure-card.js +270 -0
  102. package/dist/components/historical-figure-card/index.js +6 -0
  103. package/dist/components/horizontal-scroll-row/horizontal-scroll-row.js +6 -5
  104. package/dist/components/index.js +432 -1
  105. package/dist/components/infinite-plane/index.js +6 -0
  106. package/dist/components/infinite-plane/infinite-plane.js +75 -0
  107. package/dist/components/input-otp/input-otp.js +1 -1
  108. package/dist/components/interactive-timeline/index.js +16 -0
  109. package/dist/components/interactive-timeline/interactive-timeline.js +711 -0
  110. package/dist/components/jarvis-dock/index.js +6 -0
  111. package/dist/components/jarvis-dock/jarvis-dock.js +98 -0
  112. package/dist/components/kbd/index.js +5 -0
  113. package/dist/components/kbd/kbd.js +117 -0
  114. package/dist/components/key-concept/key-concept.js +6 -5
  115. package/dist/components/keyboard-shortcuts-help/keyboard-shortcuts-help.js +4 -3
  116. package/dist/components/knowledge-check/index.js +6 -0
  117. package/dist/components/knowledge-check/knowledge-check.js +448 -0
  118. package/dist/components/learning-objectives/learning-objectives.js +14 -13
  119. package/dist/components/live-cursor/index.js +6 -0
  120. package/dist/components/live-cursor/live-cursor.js +62 -0
  121. package/dist/components/live-feed/live-feed.js +16 -14
  122. package/dist/components/map-2d/index.js +20 -0
  123. package/dist/components/map-2d/map-2d.js +455 -0
  124. package/dist/components/map-timeline/index.js +16 -0
  125. package/dist/components/map-timeline/map-timeline.js +506 -0
  126. package/dist/components/market-treemap/market-treemap.js +3 -3
  127. package/dist/components/mdx-content/mdx-content.js +8 -7
  128. package/dist/components/menubar/menubar.js +4 -4
  129. package/dist/components/metric-cluster/index.js +6 -0
  130. package/dist/components/metric-cluster/metric-cluster.js +96 -0
  131. package/dist/components/metric-gauge/metric-gauge.js +1 -1
  132. package/dist/components/model-comparison/index.js +12 -0
  133. package/dist/components/model-comparison/model-comparison.js +211 -0
  134. package/dist/components/model-selector/model-selector.js +2 -2
  135. package/dist/components/multi-select/multi-select.js +3 -3
  136. package/dist/components/multi-select-lasso/index.js +6 -0
  137. package/dist/components/multi-select-lasso/multi-select-lasso.js +76 -0
  138. package/dist/components/navbar-saas/navbar-saas.js +4 -2
  139. package/dist/components/navigation-menu/navigation-menu.js +2 -2
  140. package/dist/components/newsletter-signup/index.js +8 -0
  141. package/dist/components/newsletter-signup/newsletter-signup.js +269 -0
  142. package/dist/components/number-input/number-input.js +1 -1
  143. package/dist/components/number-ticker/number-ticker.js +11 -4
  144. package/dist/components/object-inspector/index.js +6 -0
  145. package/dist/components/object-inspector/object-inspector.js +136 -0
  146. package/dist/components/order-book/order-book.js +2 -2
  147. package/dist/components/parallel-timeline/index.js +6 -0
  148. package/dist/components/parallel-timeline/parallel-timeline.js +251 -0
  149. package/dist/components/password-input/password-input.js +1 -1
  150. package/dist/components/plan-badge/plan-badge.js +1 -7
  151. package/dist/components/playback-ghost/index.js +6 -0
  152. package/dist/components/playback-ghost/playback-ghost.js +83 -0
  153. package/dist/components/policy-delivery-panel/index.js +6 -0
  154. package/dist/components/policy-delivery-panel/policy-delivery-panel.js +99 -0
  155. package/dist/components/presence-stack/index.js +6 -0
  156. package/dist/components/presence-stack/presence-stack.js +108 -0
  157. package/dist/components/presence-sync-indicator/index.js +6 -0
  158. package/dist/components/presence-sync-indicator/presence-sync-indicator.js +73 -0
  159. package/dist/components/pricing-table/index.js +8 -0
  160. package/dist/components/pricing-table/pricing-table.js +247 -0
  161. package/dist/components/primary-source-viewer/index.js +26 -0
  162. package/dist/components/primary-source-viewer/primary-source-viewer.js +439 -0
  163. package/dist/components/pro-tip/pro-tip.js +6 -6
  164. package/dist/components/profile-section/profile-section.js +3 -2
  165. package/dist/components/progress-card/progress-card.js +4 -3
  166. package/dist/components/progress-tracker/progress-tracker.js +19 -11
  167. package/dist/components/prompt-templates/index.js +6 -0
  168. package/dist/components/prompt-templates/prompt-templates.js +403 -0
  169. package/dist/components/property-section/index.js +6 -0
  170. package/dist/components/property-section/property-section.js +101 -0
  171. package/dist/components/quiz/quiz.js +7 -6
  172. package/dist/components/radio-group/radio-group.js +2 -2
  173. package/dist/components/rating/rating.js +3 -3
  174. package/dist/components/relationship-inspector/index.js +6 -0
  175. package/dist/components/relationship-inspector/relationship-inspector.js +102 -0
  176. package/dist/components/resizable/resizable.js +1 -1
  177. package/dist/components/route-map/index.js +6 -0
  178. package/dist/components/route-map/route-map.js +339 -0
  179. package/dist/components/routing-assignment-panel/index.js +6 -0
  180. package/dist/components/routing-assignment-panel/routing-assignment-panel.js +122 -0
  181. package/dist/components/run-timeline/index.js +6 -0
  182. package/dist/components/run-timeline/run-timeline.js +221 -0
  183. package/dist/components/runtime-overview-panel/index.js +6 -0
  184. package/dist/components/runtime-overview-panel/runtime-overview-panel.js +89 -0
  185. package/dist/components/scope-selector/scope-selector.js +7 -7
  186. package/dist/components/search-bar/search-bar.js +24 -2
  187. package/dist/components/search-dialog/search-dialog.js +483 -50
  188. package/dist/components/select/select.js +5 -5
  189. package/dist/components/selection-halo/index.js +6 -0
  190. package/dist/components/selection-halo/selection-halo.js +72 -0
  191. package/dist/components/selection-presence/index.js +6 -0
  192. package/dist/components/selection-presence/selection-presence.js +50 -0
  193. package/dist/components/severity-badge/severity-badge.js +2 -2
  194. package/dist/components/share-dialog/share-dialog.js +2 -2
  195. package/dist/components/share-section/share-section.js +2 -1
  196. package/dist/components/sheet/sheet.js +1 -1
  197. package/dist/components/sidebar/sidebar.js +20 -19
  198. package/dist/components/sidebar-toggle/sidebar-toggle.js +2 -2
  199. package/dist/components/slider/slider.js +1 -1
  200. package/dist/components/slideshow/slideshow.js +14 -12
  201. package/dist/components/snap-guides/index.js +6 -0
  202. package/dist/components/snap-guides/snap-guides.js +45 -0
  203. package/dist/components/social-fab/social-fab.js +12 -11
  204. package/dist/components/sparkline-grid/sparkline-grid.js +1 -1
  205. package/dist/components/spinner/spinner.js +4 -4
  206. package/dist/components/stat-card/stat-card.js +4 -4
  207. package/dist/components/state-badge-overlay/index.js +6 -0
  208. package/dist/components/state-badge-overlay/state-badge-overlay.js +90 -0
  209. package/dist/components/status-board/status-board.js +13 -6
  210. package/dist/components/status-indicator/status-indicator.js +3 -3
  211. package/dist/components/step-by-step/step-by-step.js +10 -8
  212. package/dist/components/step-navigation/step-navigation.js +2 -2
  213. package/dist/components/stepper/stepper.js +3 -3
  214. package/dist/components/sticky-metric/index.js +6 -0
  215. package/dist/components/sticky-metric/sticky-metric.js +83 -0
  216. package/dist/components/story-map/index.js +8 -0
  217. package/dist/components/story-map/story-map.js +414 -0
  218. package/dist/components/subscription-card/subscription-card.js +1 -1
  219. package/dist/components/switch/switch.js +1 -1
  220. package/dist/components/table-of-contents/table-of-contents.js +5 -2
  221. package/dist/components/table-of-contents-panel/table-of-contents-panel.js +8 -6
  222. package/dist/components/tags-input/tags-input.js +12 -4
  223. package/dist/components/terminal/terminal.js +58 -36
  224. package/dist/components/theme-toggle/theme-toggle.js +2 -2
  225. package/dist/components/thinking-block/thinking-block.js +3 -3
  226. package/dist/components/thread-bubble/index.js +6 -0
  227. package/dist/components/thread-bubble/thread-bubble.js +85 -0
  228. package/dist/components/threshold-ring/index.js +6 -0
  229. package/dist/components/threshold-ring/threshold-ring.js +160 -0
  230. package/dist/components/ticker-tape/ticker-tape.js +3 -3
  231. package/dist/components/timeline/index.js +12 -0
  232. package/dist/components/timeline/timeline.js +239 -0
  233. package/dist/components/timeline-scrubber/index.js +6 -0
  234. package/dist/components/timeline-scrubber/timeline-scrubber.js +179 -0
  235. package/dist/components/tldr-section/tldr-section.js +11 -9
  236. package/dist/components/tour/tour.js +1 -1
  237. package/dist/components/transaction-list/index.js +14 -0
  238. package/dist/components/transaction-list/transaction-list.js +247 -0
  239. package/dist/components/tree-view/index.js +6 -0
  240. package/dist/components/tree-view/tree-view.js +298 -0
  241. package/dist/components/tutorial-complete/tutorial-complete.js +15 -13
  242. package/dist/components/tutorial-filters/tutorial-filters.js +1 -1
  243. package/dist/components/tutorial-intro-content/tutorial-intro-content.js +5 -5
  244. package/dist/components/tutorial-mdx/tutorial-mdx.js +5 -5
  245. package/dist/components/usage-breakdown/usage-breakdown.js +9 -5
  246. package/dist/components/video-embed/video-embed.js +2 -2
  247. package/dist/components/viewport-bookmarks/index.js +6 -0
  248. package/dist/components/viewport-bookmarks/viewport-bookmarks.js +116 -0
  249. package/dist/components/wallet-card/wallet-card.js +1 -1
  250. package/dist/components/watchlist/watchlist.js +7 -6
  251. package/dist/components/world-breadcrumbs/index.js +6 -0
  252. package/dist/components/world-breadcrumbs/world-breadcrumbs.js +114 -0
  253. package/dist/components/world-clock-bar/world-clock-bar.js +34 -13
  254. package/dist/index.d.ts +7336 -256
  255. package/dist/index.js +3 -1
  256. package/package.json +4 -4
@@ -0,0 +1,338 @@
1
+ "use client";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import {
4
+ createContext,
5
+ forwardRef,
6
+ useCallback,
7
+ useContext,
8
+ useEffect,
9
+ useId,
10
+ useMemo,
11
+ useRef,
12
+ useState
13
+ } from "react";
14
+ import { cn } from "../../lib/utils";
15
+ const ChronoContext = createContext(null);
16
+ function useChronoContext() {
17
+ const ctx = useContext(ChronoContext);
18
+ if (!ctx) {
19
+ throw new Error("ChronoEvent used outside ChronologicalTimeline.");
20
+ }
21
+ return ctx;
22
+ }
23
+ function ImageMedia({ media }) {
24
+ return /* @__PURE__ */ jsxs("figure", { className: "overflow-hidden rounded-xl border bg-muted", children: [
25
+ /* @__PURE__ */ jsx(
26
+ "img",
27
+ {
28
+ alt: media.alt,
29
+ className: "aspect-video w-full object-cover",
30
+ loading: "lazy",
31
+ src: media.src
32
+ }
33
+ ),
34
+ media.caption || media.credit ? /* @__PURE__ */ jsxs("figcaption", { className: "border-t bg-background px-3 py-2 text-xs text-muted-foreground", children: [
35
+ media.caption ? /* @__PURE__ */ jsx("span", { className: "block", children: media.caption }) : null,
36
+ media.credit ? /* @__PURE__ */ jsx("span", { className: "block italic", children: media.credit }) : null
37
+ ] }) : null
38
+ ] });
39
+ }
40
+ function VideoMedia({ media }) {
41
+ const iframeTitle = media.title || "Embedded timeline video";
42
+ return /* @__PURE__ */ jsxs("figure", { className: "overflow-hidden rounded-xl border bg-muted", children: [
43
+ /* @__PURE__ */ jsx("div", { className: "aspect-video w-full", children: /* @__PURE__ */ jsx(
44
+ "iframe",
45
+ {
46
+ allow: "accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture",
47
+ allowFullScreen: true,
48
+ className: "h-full w-full",
49
+ src: media.src,
50
+ title: iframeTitle
51
+ }
52
+ ) }),
53
+ media.caption || media.credit ? /* @__PURE__ */ jsxs("figcaption", { className: "border-t bg-background px-3 py-2 text-xs text-muted-foreground", children: [
54
+ media.caption ? /* @__PURE__ */ jsx("span", { className: "block", children: media.caption }) : null,
55
+ media.credit ? /* @__PURE__ */ jsx("span", { className: "block italic", children: media.credit }) : null
56
+ ] }) : null
57
+ ] });
58
+ }
59
+ function AudioMedia({ media }) {
60
+ return /* @__PURE__ */ jsxs("figure", { className: "overflow-hidden rounded-xl border bg-muted p-3", children: [
61
+ /* @__PURE__ */ jsx(
62
+ "audio",
63
+ {
64
+ "aria-label": media.alt,
65
+ className: "w-full",
66
+ controls: true,
67
+ preload: "metadata",
68
+ src: media.src,
69
+ children: /* @__PURE__ */ jsx("track", { kind: "captions" })
70
+ }
71
+ ),
72
+ media.caption || media.credit ? /* @__PURE__ */ jsxs("figcaption", { className: "pt-2 text-xs text-muted-foreground", children: [
73
+ media.caption ? /* @__PURE__ */ jsx("span", { className: "block", children: media.caption }) : null,
74
+ media.credit ? /* @__PURE__ */ jsx("span", { className: "block italic", children: media.credit }) : null
75
+ ] }) : null
76
+ ] });
77
+ }
78
+ function Media({ media }) {
79
+ if (media.type === "image") return /* @__PURE__ */ jsx(ImageMedia, { media });
80
+ if (media.type === "video") return /* @__PURE__ */ jsx(VideoMedia, { media });
81
+ return /* @__PURE__ */ jsx(AudioMedia, { media });
82
+ }
83
+ function DateColumn({ date }) {
84
+ return /* @__PURE__ */ jsx("div", { className: "hidden items-start justify-end pr-4 text-right text-xs font-semibold uppercase tracking-wide text-muted-foreground md:flex md:group-[[data-side='right']]:order-3 md:group-[[data-side='right']]:justify-start md:group-[[data-side='right']]:pl-4 md:group-[[data-side='right']]:text-left", children: /* @__PURE__ */ jsx("time", { className: "pt-2", children: date }) });
85
+ }
86
+ function RailColumn({ featured }) {
87
+ return /* @__PURE__ */ jsxs(
88
+ "div",
89
+ {
90
+ "aria-hidden": "true",
91
+ className: "relative hidden md:flex md:w-6 md:items-start md:justify-center",
92
+ children: [
93
+ /* @__PURE__ */ jsx("span", { className: "absolute inset-y-0 left-1/2 w-px -translate-x-1/2 bg-border" }),
94
+ /* @__PURE__ */ jsx(
95
+ "span",
96
+ {
97
+ className: cn(
98
+ "relative z-10 mt-3 block size-3 rounded-full border-2 border-background bg-primary",
99
+ featured ? "size-4" : ""
100
+ )
101
+ }
102
+ )
103
+ ]
104
+ }
105
+ );
106
+ }
107
+ function EventCard({
108
+ children,
109
+ date,
110
+ eventId,
111
+ featured,
112
+ media,
113
+ subtitle,
114
+ title
115
+ }) {
116
+ return /* @__PURE__ */ jsxs(
117
+ "div",
118
+ {
119
+ className: cn(
120
+ "rounded-2xl border bg-background p-5 shadow-sm md:group-[[data-side='right']]:order-1",
121
+ featured ? "ring-1 ring-primary/30" : ""
122
+ ),
123
+ children: [
124
+ /* @__PURE__ */ jsxs("header", { className: "mb-3 flex flex-col gap-1", children: [
125
+ /* @__PURE__ */ jsx("time", { className: "text-xs font-semibold uppercase tracking-wide text-muted-foreground md:hidden", children: date }),
126
+ /* @__PURE__ */ jsx(
127
+ "h3",
128
+ {
129
+ className: cn(
130
+ "font-semibold text-foreground",
131
+ featured ? "text-xl" : "text-lg"
132
+ ),
133
+ id: `${eventId}-title`,
134
+ children: title
135
+ }
136
+ ),
137
+ subtitle ? /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: subtitle }) : null
138
+ ] }),
139
+ media ? /* @__PURE__ */ jsx("div", { className: "mb-3", children: /* @__PURE__ */ jsx(Media, { media }) }) : null,
140
+ children ? /* @__PURE__ */ jsx("div", { className: "space-y-2 text-sm leading-relaxed text-foreground [&_blockquote]:my-3 [&_blockquote]:border-l-2 [&_blockquote]:border-primary [&_blockquote]:pl-3 [&_blockquote]:italic [&_blockquote]:text-muted-foreground", children }) : null
141
+ ]
142
+ }
143
+ );
144
+ }
145
+ const ChronoEvent = forwardRef(
146
+ (props, forwardedRef) => {
147
+ const {
148
+ children,
149
+ className,
150
+ date,
151
+ featured = false,
152
+ id,
153
+ media,
154
+ subtitle,
155
+ title,
156
+ ...rest
157
+ } = props;
158
+ const generatedId = useId();
159
+ const eventId = id ?? generatedId;
160
+ const ref = useRef(null);
161
+ const { registerEvent, setActiveId } = useChronoContext();
162
+ const refCallback = useCallback(
163
+ (node) => {
164
+ ref.current = node;
165
+ registerEvent(eventId, node);
166
+ if (typeof forwardedRef === "function") forwardedRef(node);
167
+ else if (forwardedRef) forwardedRef.current = node;
168
+ },
169
+ [eventId, forwardedRef, registerEvent]
170
+ );
171
+ const handleFocusEvent = useCallback(() => {
172
+ setActiveId(eventId);
173
+ }, [eventId, setActiveId]);
174
+ return /* @__PURE__ */ jsxs(
175
+ "article",
176
+ {
177
+ "aria-labelledby": `${eventId}-title`,
178
+ className: cn(
179
+ "group relative grid gap-4 py-6 md:grid-cols-[1fr_auto_1fr] md:gap-8",
180
+ className
181
+ ),
182
+ "data-event-id": eventId,
183
+ "data-featured": featured ? "true" : void 0,
184
+ id: eventId,
185
+ onFocus: handleFocusEvent,
186
+ ref: refCallback,
187
+ ...rest,
188
+ children: [
189
+ /* @__PURE__ */ jsx(DateColumn, { date }),
190
+ /* @__PURE__ */ jsx(RailColumn, { featured }),
191
+ /* @__PURE__ */ jsx(
192
+ EventCard,
193
+ {
194
+ date,
195
+ eventId,
196
+ featured,
197
+ media,
198
+ subtitle,
199
+ title,
200
+ children
201
+ }
202
+ )
203
+ ]
204
+ }
205
+ );
206
+ }
207
+ );
208
+ ChronoEvent.displayName = "ChronoEvent";
209
+ function ProgressStrip({
210
+ activeId,
211
+ ids,
212
+ label
213
+ }) {
214
+ if (ids.length === 0) return null;
215
+ const activeIndex = activeId ? ids.indexOf(activeId) : -1;
216
+ const ratio = activeIndex < 0 ? 0 : (activeIndex + 1) / ids.length;
217
+ return /* @__PURE__ */ jsx(
218
+ "div",
219
+ {
220
+ "aria-label": label,
221
+ "aria-valuemax": 100,
222
+ "aria-valuemin": 0,
223
+ "aria-valuenow": Math.round(ratio * 100),
224
+ className: "sticky top-0 z-10 h-1 w-full bg-border",
225
+ role: "progressbar",
226
+ children: /* @__PURE__ */ jsx(
227
+ "span",
228
+ {
229
+ className: "block h-full bg-primary transition-[width] duration-200",
230
+ style: { width: `${(ratio * 100).toString()}%` }
231
+ }
232
+ )
233
+ }
234
+ );
235
+ }
236
+ function useChronoActiveTracker() {
237
+ const eventsRef = useRef(/* @__PURE__ */ new Map());
238
+ const [ids, setIds] = useState([]);
239
+ const [activeId, setActiveId] = useState();
240
+ const registerEvent = useCallback((id, node) => {
241
+ const map = eventsRef.current;
242
+ if (node) map.set(id, node);
243
+ else map.delete(id);
244
+ setIds([...map.keys()]);
245
+ }, []);
246
+ useEffect(() => {
247
+ if (typeof IntersectionObserver === "undefined") return;
248
+ const observer = new IntersectionObserver(
249
+ (entries) => {
250
+ const visible = entries.filter((entry) => entry.isIntersecting).sort((a, b) => a.boundingClientRect.top - b.boundingClientRect.top);
251
+ const first = visible[0];
252
+ if (first) {
253
+ const target = first.target;
254
+ if (target instanceof HTMLElement) {
255
+ const eventId = target.dataset.eventId;
256
+ if (eventId) setActiveId(eventId);
257
+ }
258
+ }
259
+ },
260
+ { rootMargin: "-30% 0px -50% 0px", threshold: 0.1 }
261
+ );
262
+ [...eventsRef.current.values()].forEach((node) => {
263
+ observer.observe(node);
264
+ });
265
+ return () => {
266
+ observer.disconnect();
267
+ };
268
+ }, [ids]);
269
+ return { activeId, ids, registerEvent, setActiveId };
270
+ }
271
+ function EventList({ activeId, children }) {
272
+ if (!Array.isArray(children)) {
273
+ return /* @__PURE__ */ jsx("ol", { className: "relative flex flex-col px-4 pb-6 md:px-6", children });
274
+ }
275
+ return /* @__PURE__ */ jsx("ol", { className: "relative flex flex-col px-4 pb-6 md:px-6", children: children.map((child, index) => /* @__PURE__ */ jsx(
276
+ "li",
277
+ {
278
+ className: "block list-none",
279
+ "data-active": isReactElementWithEventId(child, activeId) ? "true" : void 0,
280
+ "data-side": index % 2 === 0 ? "left" : "right",
281
+ children: child
282
+ },
283
+ getChildKey(child, index)
284
+ )) });
285
+ }
286
+ const ChronologicalTimeline = forwardRef((props, ref) => {
287
+ const {
288
+ children,
289
+ className,
290
+ progressLabel = "Timeline progress",
291
+ title,
292
+ ...rest
293
+ } = props;
294
+ const titleId = useId();
295
+ const { activeId, ids, registerEvent, setActiveId } = useChronoActiveTracker();
296
+ const ctx = useMemo(
297
+ () => ({ registerEvent, setActiveId, titleId }),
298
+ [registerEvent, setActiveId, titleId]
299
+ );
300
+ return /* @__PURE__ */ jsx(ChronoContext.Provider, { value: ctx, children: /* @__PURE__ */ jsxs(
301
+ "section",
302
+ {
303
+ "aria-labelledby": title ? titleId : void 0,
304
+ className: cn(
305
+ "relative mx-auto flex w-full max-w-4xl flex-col overflow-hidden rounded-2xl border bg-background text-foreground",
306
+ className
307
+ ),
308
+ ref,
309
+ ...rest,
310
+ children: [
311
+ /* @__PURE__ */ jsx(ProgressStrip, { activeId, ids, label: progressLabel }),
312
+ title ? /* @__PURE__ */ jsx("header", { className: "p-6", children: /* @__PURE__ */ jsx("h2", { className: "text-2xl font-semibold tracking-tight", id: titleId, children: title }) }) : null,
313
+ /* @__PURE__ */ jsx(EventList, { activeId, children })
314
+ ]
315
+ }
316
+ ) });
317
+ });
318
+ ChronologicalTimeline.displayName = "ChronologicalTimeline";
319
+ function isReactElementWithEventId(child, activeId) {
320
+ if (!activeId) return false;
321
+ if (typeof child !== "object" || child === null) return false;
322
+ if (!("props" in child)) return false;
323
+ const props = child.props;
324
+ if (typeof props !== "object" || props === null) return false;
325
+ const id = props.id;
326
+ return typeof id === "string" && id === activeId;
327
+ }
328
+ function getChildKey(child, fallback) {
329
+ if (typeof child !== "object" || child === null) return fallback;
330
+ if (!("key" in child)) return fallback;
331
+ const key = child.key;
332
+ if (typeof key === "string" || typeof key === "number") return key;
333
+ return fallback;
334
+ }
335
+ export {
336
+ ChronoEvent,
337
+ ChronologicalTimeline
338
+ };
@@ -0,0 +1,8 @@
1
+ import {
2
+ ChronoEvent,
3
+ ChronologicalTimeline
4
+ } from "./chronological-timeline";
5
+ export {
6
+ ChronoEvent,
7
+ ChronologicalTimeline
8
+ };
@@ -0,0 +1,258 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import {
3
+ forwardRef
4
+ } from "react";
5
+ import { Globe } from "lucide-react";
6
+ import { cn } from "../../lib/utils";
7
+ import { Badge } from "../badge/badge";
8
+ const CIVILIZATION_COLOR_VARIANTS = {
9
+ amber: {
10
+ gradient: "from-amber-500/20 to-amber-700/40",
11
+ ring: "ring-amber-500/30"
12
+ },
13
+ blue: {
14
+ gradient: "from-blue-500/20 to-blue-700/40",
15
+ ring: "ring-blue-500/30"
16
+ },
17
+ emerald: {
18
+ gradient: "from-emerald-500/20 to-emerald-700/40",
19
+ ring: "ring-emerald-500/30"
20
+ },
21
+ neutral: {
22
+ gradient: "from-muted to-muted-foreground/10",
23
+ ring: "ring-border"
24
+ },
25
+ purple: {
26
+ gradient: "from-purple-500/20 to-purple-700/40",
27
+ ring: "ring-purple-500/30"
28
+ },
29
+ red: {
30
+ gradient: "from-red-500/20 to-red-700/40",
31
+ ring: "ring-red-500/30"
32
+ }
33
+ };
34
+ const DEFAULT_LABELS = {
35
+ achievements: "Achievements",
36
+ capital: "Capital",
37
+ duration: "Duration",
38
+ leaders: "Notable leaders",
39
+ peakPopulation: "Peak population",
40
+ timeline: "Era timeline"
41
+ };
42
+ function formatEraYear(year) {
43
+ if (year < 0) return `${Math.abs(year).toString()} BCE`;
44
+ return `${year.toString()} CE`;
45
+ }
46
+ function formatEra(era) {
47
+ const start = formatEraYear(era.start);
48
+ if (era.end === void 0) return `${start} \u2013 present`;
49
+ return `${start} \u2013 ${formatEraYear(era.end)}`;
50
+ }
51
+ function getDuration(era) {
52
+ if (!era) return void 0;
53
+ const end = era.end ?? (/* @__PURE__ */ new Date()).getFullYear();
54
+ const years = end - era.start;
55
+ if (years <= 0) return void 0;
56
+ return `${years.toString()} years`;
57
+ }
58
+ function CivilizationHero({ color, image, imageAlt }) {
59
+ const palette = CIVILIZATION_COLOR_VARIANTS[color];
60
+ return /* @__PURE__ */ jsx(
61
+ "div",
62
+ {
63
+ className: cn(
64
+ "relative h-32 w-full overflow-hidden rounded-t-2xl bg-gradient-to-br",
65
+ palette.gradient
66
+ ),
67
+ children: image ? /* @__PURE__ */ jsx(
68
+ "img",
69
+ {
70
+ alt: imageAlt ?? "",
71
+ className: "h-full w-full object-cover mix-blend-multiply",
72
+ src: image
73
+ }
74
+ ) : /* @__PURE__ */ jsx("div", { className: "flex h-full w-full items-center justify-center text-muted-foreground/50", children: /* @__PURE__ */ jsx(Globe, { "aria-hidden": "true", className: "size-12" }) })
75
+ }
76
+ );
77
+ }
78
+ function EraTimeline({ era, label }) {
79
+ const eraLabel = formatEra(era);
80
+ return /* @__PURE__ */ jsxs(
81
+ "div",
82
+ {
83
+ "aria-label": `${label}: ${eraLabel}`,
84
+ className: "flex flex-col gap-1",
85
+ role: "img",
86
+ children: [
87
+ /* @__PURE__ */ jsx("span", { className: "text-xs font-medium uppercase tracking-wide text-muted-foreground", children: eraLabel }),
88
+ /* @__PURE__ */ jsx("div", { className: "h-1.5 w-full rounded-full bg-muted", children: /* @__PURE__ */ jsx("span", { className: "block h-full w-2/3 rounded-full bg-primary" }) })
89
+ ]
90
+ }
91
+ );
92
+ }
93
+ function CivilizationStats({
94
+ capital,
95
+ capitalCaption,
96
+ durationCaption,
97
+ durationValue,
98
+ peakCaption,
99
+ peakPopulation
100
+ }) {
101
+ const items = [];
102
+ if (capital) items.push({ caption: capitalCaption, value: capital });
103
+ if (peakPopulation) {
104
+ items.push({ caption: peakCaption, value: peakPopulation });
105
+ }
106
+ if (durationValue) {
107
+ items.push({ caption: durationCaption, value: durationValue });
108
+ }
109
+ if (items.length === 0) return null;
110
+ return /* @__PURE__ */ jsx("dl", { className: "grid grid-cols-2 gap-x-3 gap-y-2 text-sm", children: items.map((item) => /* @__PURE__ */ jsxs("div", { className: "flex flex-col", children: [
111
+ /* @__PURE__ */ jsx("dt", { className: "text-xs font-medium uppercase tracking-wide text-muted-foreground", children: item.caption }),
112
+ /* @__PURE__ */ jsx("dd", { className: "font-medium text-foreground", children: item.value })
113
+ ] }, item.caption)) });
114
+ }
115
+ function CivilizationListBlock({
116
+ heading,
117
+ items,
118
+ variant
119
+ }) {
120
+ if (items.length === 0) return null;
121
+ return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
122
+ /* @__PURE__ */ jsx("h4", { className: "text-xs font-semibold uppercase tracking-wide text-muted-foreground", children: heading }),
123
+ variant === "badge" ? /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-1.5", children: items.map((item, index) => /* @__PURE__ */ jsx(Badge, { variant: "secondary", children: item }, `${heading}-${index.toString()}`)) }) : /* @__PURE__ */ jsx("ul", { className: "flex flex-col gap-1 text-sm text-foreground", children: items.map((item, index) => /* @__PURE__ */ jsx(
124
+ "li",
125
+ {
126
+ className: "leading-tight",
127
+ children: item
128
+ },
129
+ `${heading}-${index.toString()}`
130
+ )) })
131
+ ] });
132
+ }
133
+ function CivilizationBody({
134
+ achievements,
135
+ actionHref,
136
+ capital,
137
+ era,
138
+ labels,
139
+ leaders,
140
+ name,
141
+ peakPopulation,
142
+ region
143
+ }) {
144
+ const durationValue = getDuration(era);
145
+ return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-4 p-5", children: [
146
+ /* @__PURE__ */ jsxs("header", { className: "flex flex-col gap-1", children: [
147
+ /* @__PURE__ */ jsx("h3", { className: "text-lg font-semibold leading-tight tracking-tight", children: name }),
148
+ region ? /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: region }) : null
149
+ ] }),
150
+ era ? /* @__PURE__ */ jsx(EraTimeline, { era, label: labels.timeline }) : null,
151
+ /* @__PURE__ */ jsx(
152
+ CivilizationStats,
153
+ {
154
+ capital,
155
+ capitalCaption: labels.capital,
156
+ durationCaption: labels.duration,
157
+ durationValue,
158
+ peakCaption: labels.peakPopulation,
159
+ peakPopulation
160
+ }
161
+ ),
162
+ achievements && achievements.length > 0 ? /* @__PURE__ */ jsx(
163
+ CivilizationListBlock,
164
+ {
165
+ heading: labels.achievements,
166
+ items: achievements,
167
+ variant: "badge"
168
+ }
169
+ ) : null,
170
+ leaders && leaders.length > 0 ? /* @__PURE__ */ jsx(
171
+ CivilizationListBlock,
172
+ {
173
+ heading: labels.leaders,
174
+ items: leaders,
175
+ variant: "list"
176
+ }
177
+ ) : null,
178
+ actionHref ? /* @__PURE__ */ jsx(
179
+ "a",
180
+ {
181
+ className: "text-sm font-medium text-primary underline-offset-4 hover:underline",
182
+ href: actionHref,
183
+ children: "Explore \u2192"
184
+ }
185
+ ) : null
186
+ ] });
187
+ }
188
+ const CivilizationCard = forwardRef(
189
+ (props, ref) => {
190
+ const {
191
+ achievements,
192
+ actionHref,
193
+ capital,
194
+ className,
195
+ color = "neutral",
196
+ era,
197
+ image,
198
+ labels,
199
+ leaders,
200
+ name,
201
+ peakPopulation,
202
+ region,
203
+ ...rest
204
+ } = props;
205
+ const resolvedLabels = { ...DEFAULT_LABELS, ...labels };
206
+ const palette = CIVILIZATION_COLOR_VARIANTS[color];
207
+ const altName = typeof name === "string" ? name : void 0;
208
+ return /* @__PURE__ */ jsxs(
209
+ "article",
210
+ {
211
+ className: cn(
212
+ "flex flex-col overflow-hidden rounded-2xl border bg-background text-foreground shadow-sm ring-1",
213
+ palette.ring,
214
+ className
215
+ ),
216
+ ref,
217
+ ...rest,
218
+ children: [
219
+ /* @__PURE__ */ jsx(CivilizationHero, { color, image, imageAlt: altName }),
220
+ /* @__PURE__ */ jsx(
221
+ CivilizationBody,
222
+ {
223
+ achievements,
224
+ actionHref,
225
+ capital,
226
+ era,
227
+ labels: resolvedLabels,
228
+ leaders,
229
+ name,
230
+ peakPopulation,
231
+ region
232
+ }
233
+ )
234
+ ]
235
+ }
236
+ );
237
+ }
238
+ );
239
+ CivilizationCard.displayName = "CivilizationCard";
240
+ const CivilizationComparison = forwardRef(({ children, className, ...rest }, ref) => {
241
+ return /* @__PURE__ */ jsx(
242
+ "div",
243
+ {
244
+ className: cn(
245
+ "grid grid-cols-1 gap-4 md:grid-cols-2 lg:grid-cols-3",
246
+ className
247
+ ),
248
+ ref,
249
+ ...rest,
250
+ children
251
+ }
252
+ );
253
+ });
254
+ CivilizationComparison.displayName = "CivilizationComparison";
255
+ export {
256
+ CivilizationCard,
257
+ CivilizationComparison
258
+ };
@@ -0,0 +1,8 @@
1
+ import {
2
+ CivilizationCard,
3
+ CivilizationComparison
4
+ } from "./civilization-card";
5
+ export {
6
+ CivilizationCard,
7
+ CivilizationComparison
8
+ };
@@ -107,11 +107,11 @@ function CodeBlock({
107
107
  /* @__PURE__ */ jsx(
108
108
  Button,
109
109
  {
110
- className: "h-8 w-8",
110
+ className: "size-8",
111
111
  onClick: handleCopy,
112
112
  size: "icon",
113
113
  variant: "ghost",
114
- children: copied ? /* @__PURE__ */ jsx(Check, { className: "h-3 w-3" }) : /* @__PURE__ */ jsx(Copy, { className: "h-3 w-3" })
114
+ children: copied ? /* @__PURE__ */ jsx(Check, { className: "size-3" }) : /* @__PURE__ */ jsx(Copy, { className: "size-3" })
115
115
  }
116
116
  )
117
117
  ] })
@@ -11,11 +11,13 @@ function CodeLine({ highlightLines, line, lineNumber }) {
11
11
  /* @__PURE__ */ jsx("span", { children: line })
12
12
  ] });
13
13
  }
14
+ const EMPTY_HIGHLIGHT_LINES = [];
14
15
  function CodePlayground({
16
+ as: Heading = "h4",
15
17
  children,
16
18
  description,
17
19
  filename,
18
- highlightLines = [],
20
+ highlightLines = EMPTY_HIGHLIGHT_LINES,
19
21
  language = "typescript",
20
22
  showLineNumbers = false,
21
23
  title
@@ -33,25 +35,25 @@ function CodePlayground({
33
35
  return /* @__PURE__ */ jsxs("div", { className: "my-6 rounded-lg border bg-card overflow-hidden", children: [
34
36
  /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between px-4 py-3 border-b bg-muted/30", children: [
35
37
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
36
- /* @__PURE__ */ jsx("div", { className: "flex h-8 w-8 items-center justify-center rounded bg-primary/10", children: /* @__PURE__ */ jsx(Code, { className: "h-4 w-4 text-primary" }) }),
38
+ /* @__PURE__ */ jsx("div", { className: "flex size-8 items-center justify-center rounded bg-primary/10", children: /* @__PURE__ */ jsx(Code, { className: "size-4 text-primary" }) }),
37
39
  /* @__PURE__ */ jsxs("div", { children: [
38
- /* @__PURE__ */ jsx("h4", { className: "font-semibold text-sm", children: title }),
40
+ /* @__PURE__ */ jsx(Heading, { className: "font-semibold text-sm", children: title }),
39
41
  description ? /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: description }) : null
40
42
  ] })
41
43
  ] }),
42
44
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
43
45
  filename ? /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1 text-xs text-muted-foreground", children: [
44
- /* @__PURE__ */ jsx(FileCode, { className: "h-3 w-3" }),
46
+ /* @__PURE__ */ jsx(FileCode, { className: "size-3" }),
45
47
  /* @__PURE__ */ jsx("span", { className: "font-mono", children: filename })
46
48
  ] }) : null,
47
49
  /* @__PURE__ */ jsx(
48
50
  Button,
49
51
  {
50
- className: "h-8 w-8",
52
+ className: "size-8",
51
53
  onClick: handleCopy,
52
54
  size: "icon",
53
55
  variant: "ghost",
54
- children: copied ? /* @__PURE__ */ jsx(Check, { className: "h-3 w-3" }) : /* @__PURE__ */ jsx(Copy, { className: "h-3 w-3" })
56
+ children: copied ? /* @__PURE__ */ jsx(Check, { className: "size-3" }) : /* @__PURE__ */ jsx(Copy, { className: "size-3" })
55
57
  }
56
58
  )
57
59
  ] })
@@ -63,7 +65,7 @@ function CodePlayground({
63
65
  line,
64
66
  lineNumber: index + 1
65
67
  },
66
- index
68
+ `${line}-${index + 1}`
67
69
  )) }) : /* @__PURE__ */ jsx("code", { children: code }) }) }),
68
70
  /* @__PURE__ */ jsx("div", { className: "px-4 py-2 border-t bg-muted/30", children: /* @__PURE__ */ jsx("span", { className: "text-xs font-mono text-muted-foreground uppercase tracking-wider", children: language }) })
69
71
  ] });
@@ -74,7 +76,7 @@ function FileTree({
74
76
  }) {
75
77
  return /* @__PURE__ */ jsxs("div", { className: "my-6 rounded-lg border bg-card overflow-hidden", children: [
76
78
  /* @__PURE__ */ jsx("div", { className: "px-4 py-2 border-b bg-muted/30", children: /* @__PURE__ */ jsxs("h4", { className: "font-semibold text-sm flex items-center gap-2", children: [
77
- /* @__PURE__ */ jsx(FileCode, { className: "h-4 w-4" }),
79
+ /* @__PURE__ */ jsx(FileCode, { className: "size-4" }),
78
80
  title
79
81
  ] }) }),
80
82
  /* @__PURE__ */ jsx("div", { className: "p-4 font-mono text-sm [&>ul]:m-0 [&>ul]:list-none [&_ul]:ml-4 [&_ul]:list-none [&_li]:text-muted-foreground", children })