bits-lab 0.0.0-stage → 0.1.2

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 (323) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +57 -2
  3. package/dist/Accordion.d.ts +52 -0
  4. package/dist/Accordion.js +192 -0
  5. package/dist/AchievementToast.d.ts +36 -0
  6. package/dist/AchievementToast.js +162 -0
  7. package/dist/AgentCard.d.ts +41 -0
  8. package/dist/AgentCard.js +168 -0
  9. package/dist/ArcadeButtons.d.ts +23 -0
  10. package/dist/ArcadeButtons.js +169 -0
  11. package/dist/AuroraBands.d.ts +19 -0
  12. package/dist/AuroraBands.js +126 -0
  13. package/dist/AvatarTooltips.d.ts +32 -0
  14. package/dist/AvatarTooltips.js +121 -0
  15. package/dist/BarRace.d.ts +39 -0
  16. package/dist/BarRace.js +227 -0
  17. package/dist/BentoGrid.d.ts +50 -0
  18. package/dist/BentoGrid.js +145 -0
  19. package/dist/BootSequence.d.ts +48 -0
  20. package/dist/BootSequence.js +234 -0
  21. package/dist/BreadcrumbTrail.d.ts +31 -0
  22. package/dist/BreadcrumbTrail.js +181 -0
  23. package/dist/CRTPower.d.ts +30 -0
  24. package/dist/CRTPower.js +142 -0
  25. package/dist/CardDeck.d.ts +29 -0
  26. package/dist/CardDeck.js +154 -0
  27. package/dist/ChangelogTimeline.d.ts +35 -0
  28. package/dist/ChangelogTimeline.js +137 -0
  29. package/dist/ChapterProgress.d.ts +23 -0
  30. package/dist/ChapterProgress.js +211 -0
  31. package/dist/ChatBubbles.d.ts +42 -0
  32. package/dist/ChatBubbles.js +198 -0
  33. package/dist/ChiptuneKit.d.ts +158 -0
  34. package/dist/ChiptuneKit.js +207 -0
  35. package/dist/CipherCard.d.ts +22 -0
  36. package/dist/CipherCard.js +91 -0
  37. package/dist/CloudSky.d.ts +28 -0
  38. package/dist/CloudSky.js +222 -0
  39. package/dist/CodeRain.d.ts +24 -0
  40. package/dist/CodeRain.js +158 -0
  41. package/dist/CodeShowcase.d.ts +50 -0
  42. package/dist/CodeShowcase.js +307 -0
  43. package/dist/ColorDial.d.ts +42 -0
  44. package/dist/ColorDial.js +288 -0
  45. package/dist/CommandPalette.d.ts +59 -0
  46. package/dist/CommandPalette.js +349 -0
  47. package/dist/CompareSlider.d.ts +33 -0
  48. package/dist/CompareSlider.js +152 -0
  49. package/dist/Confetti.d.ts +61 -0
  50. package/dist/Confetti.js +176 -0
  51. package/dist/ConnectBeams.d.ts +39 -0
  52. package/dist/ConnectBeams.js +132 -0
  53. package/dist/ContextOrb.d.ts +34 -0
  54. package/dist/ContextOrb.js +269 -0
  55. package/dist/ContourLines.d.ts +20 -0
  56. package/dist/ContourLines.js +159 -0
  57. package/dist/Coverflow.d.ts +27 -0
  58. package/dist/Coverflow.js +167 -0
  59. package/dist/CursorAttractor.d.ts +21 -0
  60. package/dist/CursorAttractor.js +136 -0
  61. package/dist/CutReveal.d.ts +21 -0
  62. package/dist/CutReveal.js +116 -0
  63. package/dist/DateRange.d.ts +45 -0
  64. package/dist/DateRange.js +327 -0
  65. package/dist/DeviceFrame.d.ts +30 -0
  66. package/dist/DeviceFrame.js +145 -0
  67. package/dist/DiffReveal.d.ts +36 -0
  68. package/dist/DiffReveal.js +247 -0
  69. package/dist/DirectionHover.d.ts +15 -0
  70. package/dist/DirectionHover.js +90 -0
  71. package/dist/Discard.d.ts +18 -0
  72. package/dist/Discard.js +61 -0
  73. package/dist/DitherField.d.ts +15 -0
  74. package/dist/DitherField.js +157 -0
  75. package/dist/DotGlobe.d.ts +48 -0
  76. package/dist/DotGlobe.js +312 -0
  77. package/dist/DotMap.d.ts +47 -0
  78. package/dist/DotMap.js +172 -0
  79. package/dist/DropZone.d.ts +57 -0
  80. package/dist/DropZone.js +304 -0
  81. package/dist/DynamicIsland.d.ts +32 -0
  82. package/dist/DynamicIsland.js +92 -0
  83. package/dist/EdgeFX.d.ts +27 -0
  84. package/dist/EdgeFX.js +98 -0
  85. package/dist/ElasticString.d.ts +22 -0
  86. package/dist/ElasticString.js +127 -0
  87. package/dist/ExpandCard.d.ts +44 -0
  88. package/dist/ExpandCard.js +182 -0
  89. package/dist/FeatureTabs.d.ts +34 -0
  90. package/dist/FeatureTabs.js +169 -0
  91. package/dist/FeedList.d.ts +37 -0
  92. package/dist/FeedList.js +163 -0
  93. package/dist/FlickerGrid.d.ts +29 -0
  94. package/dist/FlickerGrid.js +156 -0
  95. package/dist/FocusGrid.d.ts +20 -0
  96. package/dist/FocusGrid.js +48 -0
  97. package/dist/FocusPull.d.ts +26 -0
  98. package/dist/FocusPull.js +106 -0
  99. package/dist/Footprints.d.ts +24 -0
  100. package/dist/Footprints.js +126 -0
  101. package/dist/FunnelFlow.d.ts +34 -0
  102. package/dist/FunnelFlow.js +267 -0
  103. package/dist/GameOver.d.ts +46 -0
  104. package/dist/GameOver.js +191 -0
  105. package/dist/GaugeMeter.d.ts +38 -0
  106. package/dist/GaugeMeter.js +195 -0
  107. package/dist/GlassPanel.d.ts +27 -0
  108. package/dist/GlassPanel.js +80 -0
  109. package/dist/GrainFX.d.ts +34 -0
  110. package/dist/GrainFX.js +122 -0
  111. package/dist/GravityBox.d.ts +30 -0
  112. package/dist/GravityBox.js +220 -0
  113. package/dist/HealthBar.d.ts +33 -0
  114. package/dist/HealthBar.js +140 -0
  115. package/dist/Heatmap.d.ts +42 -0
  116. package/dist/Heatmap.js +232 -0
  117. package/dist/HexField.d.ts +29 -0
  118. package/dist/HexField.js +188 -0
  119. package/dist/HoldToConfirm.d.ts +29 -0
  120. package/dist/HoldToConfirm.js +163 -0
  121. package/dist/HorizontalTrack.d.ts +28 -0
  122. package/dist/HorizontalTrack.js +195 -0
  123. package/dist/HotbarDock.d.ts +40 -0
  124. package/dist/HotbarDock.js +148 -0
  125. package/dist/InkText.d.ts +27 -0
  126. package/dist/InkText.js +65 -0
  127. package/dist/InlineEdit.d.ts +30 -0
  128. package/dist/InlineEdit.js +198 -0
  129. package/dist/InteractiveGrid.d.ts +25 -0
  130. package/dist/InteractiveGrid.js +194 -0
  131. package/dist/InventoryGrid.d.ts +45 -0
  132. package/dist/InventoryGrid.js +272 -0
  133. package/dist/JellyBlob.d.ts +30 -0
  134. package/dist/JellyBlob.js +209 -0
  135. package/dist/KineticHeadline.d.ts +30 -0
  136. package/dist/KineticHeadline.js +133 -0
  137. package/dist/LavaLamp.d.ts +21 -0
  138. package/dist/LavaLamp.js +133 -0
  139. package/dist/LetterSwap.d.ts +20 -0
  140. package/dist/LetterSwap.js +78 -0
  141. package/dist/LevelMap.d.ts +35 -0
  142. package/dist/LevelMap.js +189 -0
  143. package/dist/LightShafts.d.ts +22 -0
  144. package/dist/LightShafts.js +170 -0
  145. package/dist/LightboxGallery.d.ts +26 -0
  146. package/dist/LightboxGallery.js +327 -0
  147. package/dist/LinkPeek.d.ts +36 -0
  148. package/dist/LinkPeek.js +194 -0
  149. package/dist/LogoOrbit.d.ts +37 -0
  150. package/dist/LogoOrbit.js +117 -0
  151. package/dist/Marquee.d.ts +33 -0
  152. package/dist/Marquee.js +148 -0
  153. package/dist/MarqueeLine.d.ts +33 -0
  154. package/dist/MarqueeLine.js +167 -0
  155. package/dist/MasonryWall.d.ts +13 -0
  156. package/dist/MasonryWall.js +90 -0
  157. package/dist/MegaMenu.d.ts +32 -0
  158. package/dist/MegaMenu.js +280 -0
  159. package/dist/MeteorShower.d.ts +24 -0
  160. package/dist/MeteorShower.js +155 -0
  161. package/dist/Minimap.d.ts +21 -0
  162. package/dist/Minimap.js +236 -0
  163. package/dist/MobileTabBar.d.ts +38 -0
  164. package/dist/MobileTabBar.js +148 -0
  165. package/dist/MorphDialog.d.ts +34 -0
  166. package/dist/MorphDialog.js +199 -0
  167. package/dist/MorphPopover.d.ts +33 -0
  168. package/dist/MorphPopover.js +168 -0
  169. package/dist/MorphWords.d.ts +18 -0
  170. package/dist/MorphWords.js +136 -0
  171. package/dist/OTPInput.d.ts +43 -0
  172. package/dist/OTPInput.js +174 -0
  173. package/dist/OverlayKit.d.ts +97 -0
  174. package/dist/OverlayKit.js +466 -0
  175. package/dist/OverlayMenu.d.ts +32 -0
  176. package/dist/OverlayMenu.js +154 -0
  177. package/dist/ParallaxCollage.d.ts +41 -0
  178. package/dist/ParallaxCollage.js +143 -0
  179. package/dist/PasswordMeter.d.ts +44 -0
  180. package/dist/PasswordMeter.js +165 -0
  181. package/dist/PegBoard.d.ts +26 -0
  182. package/dist/PegBoard.js +184 -0
  183. package/dist/PinCard.d.ts +21 -0
  184. package/dist/PinCard.js +84 -0
  185. package/dist/PixelAvatar.d.ts +33 -0
  186. package/dist/PixelAvatar.js +144 -0
  187. package/dist/PixelButton.d.ts +20 -0
  188. package/dist/PixelButton.js +128 -0
  189. package/dist/PixelExplode.d.ts +31 -0
  190. package/dist/PixelExplode.js +164 -0
  191. package/dist/PixelLoader.d.ts +32 -0
  192. package/dist/PixelLoader.js +142 -0
  193. package/dist/PixelParallax.d.ts +41 -0
  194. package/dist/PixelParallax.js +151 -0
  195. package/dist/PixelSpinners.d.ts +21 -0
  196. package/dist/PixelSpinners.js +110 -0
  197. package/dist/PixelType.d.ts +26 -0
  198. package/dist/PixelType.js +220 -0
  199. package/dist/PointerKit.d.ts +23 -0
  200. package/dist/PointerKit.js +222 -0
  201. package/dist/Polaroids.d.ts +41 -0
  202. package/dist/Polaroids.js +293 -0
  203. package/dist/PressStart.d.ts +28 -0
  204. package/dist/PressStart.js +99 -0
  205. package/dist/PricingFlip.d.ts +52 -0
  206. package/dist/PricingFlip.js +190 -0
  207. package/dist/ProximityType.d.ts +26 -0
  208. package/dist/ProximityType.js +135 -0
  209. package/dist/QuestDialog.d.ts +50 -0
  210. package/dist/QuestDialog.js +204 -0
  211. package/dist/QuestLog.d.ts +39 -0
  212. package/dist/QuestLog.js +214 -0
  213. package/dist/RangeDual.d.ts +34 -0
  214. package/dist/RangeDual.js +238 -0
  215. package/dist/RatingPips.d.ts +25 -0
  216. package/dist/RatingPips.js +129 -0
  217. package/dist/RetroHorizon.d.ts +27 -0
  218. package/dist/RetroHorizon.js +169 -0
  219. package/dist/Reveal.d.ts +30 -0
  220. package/dist/Reveal.js +92 -0
  221. package/dist/RingProgress.d.ts +45 -0
  222. package/dist/RingProgress.js +180 -0
  223. package/dist/RollingNumber.d.ts +28 -0
  224. package/dist/RollingNumber.js +108 -0
  225. package/dist/ScanScope.d.ts +24 -0
  226. package/dist/ScanScope.js +164 -0
  227. package/dist/ScoreTicker.d.ts +32 -0
  228. package/dist/ScoreTicker.js +176 -0
  229. package/dist/ScreenScroller.d.ts +24 -0
  230. package/dist/ScreenScroller.js +138 -0
  231. package/dist/Screensaver.d.ts +31 -0
  232. package/dist/Screensaver.js +221 -0
  233. package/dist/ScrollTilt.d.ts +27 -0
  234. package/dist/ScrollTilt.js +100 -0
  235. package/dist/ScrollTypography.d.ts +26 -0
  236. package/dist/ScrollTypography.js +124 -0
  237. package/dist/ScrollZoom.d.ts +31 -0
  238. package/dist/ScrollZoom.js +123 -0
  239. package/dist/ScrubNumber.d.ts +29 -0
  240. package/dist/ScrubNumber.js +152 -0
  241. package/dist/ShadowStack.d.ts +28 -0
  242. package/dist/ShadowStack.js +116 -0
  243. package/dist/SideRail.d.ts +43 -0
  244. package/dist/SideRail.js +253 -0
  245. package/dist/SignalText.d.ts +25 -0
  246. package/dist/SignalText.js +178 -0
  247. package/dist/SkeletonShimmer.d.ts +18 -0
  248. package/dist/SkeletonShimmer.js +111 -0
  249. package/dist/SketchHighlight.d.ts +27 -0
  250. package/dist/SketchHighlight.js +180 -0
  251. package/dist/SlideTabs.d.ts +40 -0
  252. package/dist/SlideTabs.js +190 -0
  253. package/dist/SmartNavbar.d.ts +48 -0
  254. package/dist/SmartNavbar.js +188 -0
  255. package/dist/SparkChart.d.ts +41 -0
  256. package/dist/SparkChart.js +188 -0
  257. package/dist/Spoiler.d.ts +22 -0
  258. package/dist/Spoiler.js +97 -0
  259. package/dist/SpotlightTour.d.ts +38 -0
  260. package/dist/SpotlightTour.js +231 -0
  261. package/dist/SpringDrawer.d.ts +39 -0
  262. package/dist/SpringDrawer.js +360 -0
  263. package/dist/SpriteAnimator.d.ts +41 -0
  264. package/dist/SpriteAnimator.js +124 -0
  265. package/dist/StatCard.d.ts +43 -0
  266. package/dist/StatCard.js +168 -0
  267. package/dist/StepLoader.d.ts +41 -0
  268. package/dist/StepLoader.js +191 -0
  269. package/dist/StepperForm.d.ts +41 -0
  270. package/dist/StepperForm.js +206 -0
  271. package/dist/StickerBoard.d.ts +39 -0
  272. package/dist/StickerBoard.js +209 -0
  273. package/dist/StickyReveal.d.ts +42 -0
  274. package/dist/StickyReveal.js +181 -0
  275. package/dist/StoryViewer.d.ts +36 -0
  276. package/dist/StoryViewer.js +175 -0
  277. package/dist/StreamingText.d.ts +29 -0
  278. package/dist/StreamingText.js +271 -0
  279. package/dist/SuggestionChips.d.ts +32 -0
  280. package/dist/SuggestionChips.js +96 -0
  281. package/dist/SwipeActions.d.ts +30 -0
  282. package/dist/SwipeActions.js +141 -0
  283. package/dist/TagInput.d.ts +30 -0
  284. package/dist/TagInput.js +284 -0
  285. package/dist/TallyUp.d.ts +38 -0
  286. package/dist/TallyUp.js +157 -0
  287. package/dist/TerminalDemo.d.ts +63 -0
  288. package/dist/TerminalDemo.js +214 -0
  289. package/dist/TestimonialWall.d.ts +35 -0
  290. package/dist/TestimonialWall.js +131 -0
  291. package/dist/TextOnPath.d.ts +36 -0
  292. package/dist/TextOnPath.js +130 -0
  293. package/dist/ThinkingShimmer.d.ts +36 -0
  294. package/dist/ThinkingShimmer.js +132 -0
  295. package/dist/ToastStack.d.ts +62 -0
  296. package/dist/ToastStack.js +289 -0
  297. package/dist/ToggleGroup.d.ts +39 -0
  298. package/dist/ToggleGroup.js +190 -0
  299. package/dist/ToggleKit.d.ts +70 -0
  300. package/dist/ToggleKit.js +229 -0
  301. package/dist/TracingLine.d.ts +24 -0
  302. package/dist/TracingLine.js +139 -0
  303. package/dist/TradingCard.d.ts +30 -0
  304. package/dist/TradingCard.js +147 -0
  305. package/dist/VanishInput.d.ts +34 -0
  306. package/dist/VanishInput.js +190 -0
  307. package/dist/VideoHero.d.ts +32 -0
  308. package/dist/VideoHero.js +207 -0
  309. package/dist/VoiceOrb.d.ts +23 -0
  310. package/dist/VoiceOrb.js +182 -0
  311. package/dist/VoxelTiles.d.ts +38 -0
  312. package/dist/VoxelTiles.js +201 -0
  313. package/dist/WarpField.d.ts +18 -0
  314. package/dist/WarpField.js +160 -0
  315. package/dist/WebcamPixels.d.ts +38 -0
  316. package/dist/WebcamPixels.js +292 -0
  317. package/dist/WheelPicker.d.ts +29 -0
  318. package/dist/WheelPicker.js +199 -0
  319. package/dist/WobbleCard.d.ts +23 -0
  320. package/dist/WobbleCard.js +112 -0
  321. package/dist/index.d.ts +158 -0
  322. package/dist/index.js +159 -0
  323. package/package.json +58 -4
@@ -0,0 +1,154 @@
1
+ 'use client';
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import { Children, useEffect, useInsertionEffect, useRef, useState } from "react";
4
+ const STYLE_ID = "bl-card-deck";
5
+ const CSS = `
6
+ .bl-deck { display: grid; justify-items: center; gap: 14px; font-family: var(--bl-font); color: var(--bl-ink); }
7
+ .bl-deck__pile { position: relative; width: var(--bl-w); max-width: 100%; height: var(--bl-h); touch-action: pan-y; outline: none; }
8
+ .bl-deck__pile:focus-visible { outline: 2px solid var(--bl-accent); outline-offset: 8px; border-radius: var(--bl-radius); }
9
+ .bl-deck__card { position: absolute; inset: 0; overflow: hidden; border-radius: var(--bl-radius); background: var(--bl-card); box-shadow: 0 0 0 2px var(--bl-line), 0 10px 22px -12px rgba(0,0,0,0.8); transform: translate(calc(var(--d) * var(--bl-offset)), calc(var(--d) * var(--bl-offset))) rotate(calc(var(--d) * var(--bl-fan) * var(--side))); transition: transform 360ms cubic-bezier(.3,1.3,.5,1), opacity 300ms; user-select: none; }
10
+ .bl-deck__card[data-top] { cursor: grab; }
11
+ .bl-deck__card[data-dragging] { cursor: grabbing; transition: none; }
12
+ .bl-deck__card[data-hidden] { opacity: 0; }
13
+ .bl-deck__card[data-flying] { transition: transform 420ms cubic-bezier(.4,0,.6,1), opacity 420ms; opacity: 0; }
14
+ .bl-deck__bar { display: flex; align-items: center; gap: 12px; font-size: 14px; color: var(--bl-muted); }
15
+ .bl-deck__btn { display: grid; place-items: center; width: 38px; height: 38px; padding: 0; border: 0; border-radius: 10px; background: var(--bl-chip); color: var(--bl-ink); cursor: pointer; }
16
+ .bl-deck__btn:hover { background: var(--bl-line); }
17
+ .bl-deck__btn:focus-visible { outline: 2px solid var(--bl-accent); outline-offset: 2px; }
18
+ .bl-deck__btn:disabled { opacity: 0.4; cursor: not-allowed; }
19
+ .bl-deck__count { min-width: 64px; text-align: center; font-variant-numeric: tabular-nums; }
20
+ @media (prefers-reduced-motion: reduce) { .bl-deck__card { transition: none !important; } }
21
+ `;
22
+ function useStyles() {
23
+ useInsertionEffect(() => {
24
+ if (typeof document === "undefined") return;
25
+ const style = document.getElementById(STYLE_ID) ?? Object.assign(document.createElement("style"), { id: STYLE_ID });
26
+ style.textContent = CSS;
27
+ if (!style.isConnected) document.head.appendChild(style);
28
+ }, []);
29
+ }
30
+ const Arrow = ({ flip }) => /* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", style: { transform: flip ? "scaleX(-1)" : void 0 }, children: /* @__PURE__ */ jsx("path", { d: "M6 3l5 5-5 5" }) });
31
+ function CardDeck({
32
+ children,
33
+ width = 280,
34
+ height = 380,
35
+ visible = 4,
36
+ offset = 6,
37
+ fan = 2.5,
38
+ threshold = 0.3,
39
+ loop = true,
40
+ onChange,
41
+ label = "Card deck",
42
+ radius = 16,
43
+ cardColor = "#262b44",
44
+ textColor = "#f4f4f4",
45
+ mutedColor = "#94b0c2",
46
+ lineColor = "#333c57",
47
+ chipColor = "rgba(255,255,255,0.08)",
48
+ accentColor = "#73eff7",
49
+ fontFamily = "inherit",
50
+ className = "",
51
+ style
52
+ }) {
53
+ useStyles();
54
+ const cards = Children.toArray(children);
55
+ const n = cards.length;
56
+ const [top, setTop] = useState(0);
57
+ const [flying, setFlying] = useState(null);
58
+ const [drag, setDrag] = useState(null);
59
+ const pileRef = useRef(null);
60
+ const changeRef = useRef(onChange);
61
+ changeRef.current = onChange;
62
+ useEffect(() => {
63
+ if (top >= n && n) setTop(0);
64
+ }, [n, top]);
65
+ const go = (step, throwX = step * 1, throwY = 0) => {
66
+ if (!n || flying) return;
67
+ const next = loop ? (top + step + n) % n : Math.max(0, Math.min(n - 1, top + step));
68
+ if (next === top) return;
69
+ const reduced = window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;
70
+ if (step > 0 && !reduced) {
71
+ const w = pileRef.current?.offsetWidth ?? width;
72
+ setFlying({ index: top, dx: Math.sign(throwX || 1) * w * 1.4, dy: throwY * 0.5, spin: Math.sign(throwX || 1) * 24 });
73
+ setTimeout(() => {
74
+ setFlying(null);
75
+ setTop(next);
76
+ changeRef.current?.(next);
77
+ }, 380);
78
+ } else {
79
+ setTop(next);
80
+ changeRef.current?.(next);
81
+ }
82
+ };
83
+ const onPointerDown = (event) => {
84
+ if (event.button > 0 || flying) return;
85
+ event.currentTarget.setPointerCapture?.(event.pointerId);
86
+ setDrag({ x: event.clientX, y: event.clientY, dx: 0, dy: 0 });
87
+ };
88
+ const onPointerMove = (event) => {
89
+ if (!drag) return;
90
+ setDrag((d) => ({ ...d, dx: event.clientX - d.x, dy: event.clientY - d.y }));
91
+ };
92
+ const onPointerUp = () => {
93
+ if (!drag) return;
94
+ const w = pileRef.current?.offsetWidth ?? width;
95
+ const far = Math.abs(drag.dx) > w * threshold;
96
+ setDrag(null);
97
+ if (far) go(1, drag.dx, drag.dy);
98
+ };
99
+ const onKeyDown = (event) => {
100
+ if (event.key === "ArrowRight") {
101
+ event.preventDefault();
102
+ go(1);
103
+ } else if (event.key === "ArrowLeft") {
104
+ event.preventDefault();
105
+ go(-1);
106
+ }
107
+ };
108
+ return /* @__PURE__ */ jsxs(
109
+ "div",
110
+ {
111
+ className: `bl-deck ${className}`,
112
+ style: { "--bl-w": `${width}px`, "--bl-h": `${height}px`, "--bl-offset": `${offset}px`, "--bl-fan": `${fan}deg`, "--bl-radius": `${radius}px`, "--bl-card": cardColor, "--bl-ink": textColor, "--bl-muted": mutedColor, "--bl-line": lineColor, "--bl-chip": chipColor, "--bl-accent": accentColor, "--bl-font": fontFamily, ...style },
113
+ children: [
114
+ /* @__PURE__ */ jsx("div", { ref: pileRef, className: "bl-deck__pile", role: "group", "aria-roledescription": "card deck", "aria-label": `${label}: card ${n ? top + 1 : 0} of ${n}`, tabIndex: 0, onKeyDown, children: cards.map((card, i) => {
115
+ const d = (i - top + n) % n;
116
+ const isTop = d === 0;
117
+ const fly = flying && flying.index === i;
118
+ const transform = fly ? `translate(${flying.dx}px, ${flying.dy}px) rotate(${flying.spin}deg)` : isTop && drag ? `translate(${drag.dx}px, ${drag.dy * 0.4}px) rotate(${drag.dx * 0.06}deg)` : void 0;
119
+ return /* @__PURE__ */ jsx(
120
+ "div",
121
+ {
122
+ className: "bl-deck__card",
123
+ "data-top": isTop || void 0,
124
+ "data-dragging": isTop && drag || void 0,
125
+ "data-flying": fly || void 0,
126
+ "data-hidden": d >= visible || void 0,
127
+ "aria-hidden": !isTop || void 0,
128
+ inert: !isTop || void 0,
129
+ onPointerDown: isTop ? onPointerDown : void 0,
130
+ onPointerMove: isTop ? onPointerMove : void 0,
131
+ onPointerUp: isTop ? onPointerUp : void 0,
132
+ onPointerCancel: isTop ? onPointerUp : void 0,
133
+ style: { "--d": Math.min(d, visible), "--side": d % 2 ? -1 : 1, zIndex: fly ? n + 1 : n - d, transform },
134
+ children: card
135
+ },
136
+ card.key ?? i
137
+ );
138
+ }) }),
139
+ /* @__PURE__ */ jsxs("div", { className: "bl-deck__bar", children: [
140
+ /* @__PURE__ */ jsx("button", { type: "button", className: "bl-deck__btn", "aria-label": "Previous card", disabled: !loop && top === 0, onClick: () => go(-1), children: /* @__PURE__ */ jsx(Arrow, { flip: true }) }),
141
+ /* @__PURE__ */ jsxs("span", { className: "bl-deck__count", "aria-live": "polite", children: [
142
+ n ? top + 1 : 0,
143
+ " / ",
144
+ n
145
+ ] }),
146
+ /* @__PURE__ */ jsx("button", { type: "button", className: "bl-deck__btn", "aria-label": "Next card", disabled: !loop && top === n - 1, onClick: () => go(1), children: /* @__PURE__ */ jsx(Arrow, {}) })
147
+ ] })
148
+ ]
149
+ }
150
+ );
151
+ }
152
+ export {
153
+ CardDeck as default
154
+ };
@@ -0,0 +1,35 @@
1
+ import { type CSSProperties, type ReactNode, type RefObject } from 'react';
2
+ export interface ChangelogEntry {
3
+ id?: string;
4
+ date: ReactNode;
5
+ /** Machine-readable date for the <time> element. */
6
+ dateTime?: string;
7
+ title: ReactNode;
8
+ /** A version or label pill. */
9
+ tag?: ReactNode;
10
+ body?: ReactNode;
11
+ /** An image URL, or any node (video, embed). */
12
+ media?: ReactNode;
13
+ mediaAlt?: string;
14
+ }
15
+ export interface ChangelogTimelineProps {
16
+ entries?: ChangelogEntry[];
17
+ /** The scroller to measure against, when it is not the page. */
18
+ scrollRoot?: RefObject<HTMLElement | null>;
19
+ /** Where the beam tip sits, as a share of the viewport height. */
20
+ anchor?: number;
21
+ dateColumn?: number;
22
+ stickyTop?: number;
23
+ width?: number;
24
+ backgroundColor?: string;
25
+ textColor?: string;
26
+ mutedColor?: string;
27
+ trackColor?: string;
28
+ accentColor?: string;
29
+ mediaRadius?: number;
30
+ fontFamily?: string;
31
+ label?: string;
32
+ className?: string;
33
+ style?: CSSProperties;
34
+ }
35
+ export default function ChangelogTimeline({ entries, scrollRoot, anchor, dateColumn, stickyTop, width, backgroundColor, textColor, mutedColor, trackColor, accentColor, mediaRadius, fontFamily, label, className, style }: ChangelogTimelineProps): import("react").JSX.Element;
@@ -0,0 +1,137 @@
1
+ 'use client';
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import { useEffect, useId, useInsertionEffect, useRef, useState } from "react";
4
+ const STYLE_ID = "bl-changelog";
5
+ const CSS = `
6
+ .bl-log { position: relative; container-type: inline-size; width: 100%; max-width: var(--bl-w); margin: 0 auto; color: var(--bl-ink); font-family: var(--bl-font); }
7
+ .bl-log__list { position: relative; margin: 0; padding: 0; list-style: none; }
8
+ .bl-log__line { position: absolute; top: 6px; bottom: 6px; left: var(--bl-x); width: 2px; margin-left: -1px; background: var(--bl-track); }
9
+ .bl-log__beam { position: absolute; inset: 0 0 auto 0; height: calc(var(--bl-p, 0) * 100%); background: linear-gradient(transparent, var(--bl-accent) 40px); box-shadow: 0 0 12px var(--bl-accent); }
10
+ .bl-log__entry { position: relative; display: grid; grid-template-columns: calc(var(--bl-x) - 28px) 56px minmax(0, 1fr); padding-bottom: 48px; }
11
+ .bl-log__entry:last-child { padding-bottom: 0; }
12
+ .bl-log__date { position: sticky; top: var(--bl-sticky); align-self: start; padding-top: 2px; color: var(--bl-muted); font-size: 13px; text-align: right; }
13
+ .bl-log__dot { position: sticky; top: calc(var(--bl-sticky) + 4px); align-self: start; justify-self: center; width: 12px; height: 12px; border-radius: 50%; background: var(--bl-bg); box-shadow: 0 0 0 2px var(--bl-track); transition: background-color 200ms, box-shadow 200ms; }
14
+ .bl-log__entry[data-reached] .bl-log__dot { background: var(--bl-accent); box-shadow: 0 0 0 2px var(--bl-accent), 0 0 0 6px color-mix(in srgb, var(--bl-accent) 25%, transparent); }
15
+ .bl-log__body { min-width: 0; opacity: 0.25; transform: translateY(16px); transition: opacity 500ms cubic-bezier(.2,.9,.25,1), transform 500ms cubic-bezier(.2,.9,.25,1); }
16
+ .bl-log__entry[data-reached] .bl-log__body { opacity: 1; transform: none; }
17
+ .bl-log__head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 8px; }
18
+ .bl-log__title { margin: 0; font-size: 18px; font-weight: 700; line-height: 1.3; }
19
+ .bl-log__tag { padding: 2px 8px; border-radius: 999px; background: color-mix(in srgb, var(--bl-accent) 16%, transparent); color: var(--bl-accent); font-size: 12px; font-weight: 600; }
20
+ .bl-log__text { color: var(--bl-muted); font-size: 15px; line-height: 1.6; }
21
+ .bl-log__text > * { margin: 0 0 10px; }
22
+ .bl-log__text > :last-child { margin-bottom: 0; }
23
+ .bl-log__media { margin-top: 14px; overflow: hidden; border-radius: var(--bl-radius); box-shadow: 0 0 0 1px var(--bl-track); }
24
+ .bl-log__media img, .bl-log__media video { display: block; width: 100%; height: auto; }
25
+ @container (max-width: 600px) {
26
+ .bl-log__line { left: 6px; }
27
+ .bl-log__entry { grid-template-columns: 12px minmax(0, 1fr); column-gap: 18px; }
28
+ .bl-log__date { position: static; grid-column: 2; grid-row: 1; margin-bottom: 4px; text-align: left; }
29
+ .bl-log__dot { grid-column: 1; grid-row: 1 / span 2; }
30
+ .bl-log__body { grid-column: 2; }
31
+ }
32
+ @media (prefers-reduced-motion: reduce) { .bl-log__body { transition: none; opacity: 1; transform: none; } .bl-log__dot { transition: none; } }
33
+ `;
34
+ function useStyles() {
35
+ useInsertionEffect(() => {
36
+ if (typeof document === "undefined") return;
37
+ const style = document.getElementById(STYLE_ID) ?? Object.assign(document.createElement("style"), { id: STYLE_ID });
38
+ style.textContent = CSS;
39
+ if (!style.isConnected) document.head.appendChild(style);
40
+ }, []);
41
+ }
42
+ function ChangelogTimeline({
43
+ entries = [],
44
+ scrollRoot,
45
+ anchor = 0.6,
46
+ dateColumn = 140,
47
+ stickyTop = 24,
48
+ width = 760,
49
+ backgroundColor = "#1a1c2c",
50
+ textColor = "#f4f4f4",
51
+ mutedColor = "#94b0c2",
52
+ trackColor = "#333c57",
53
+ accentColor = "#73eff7",
54
+ mediaRadius = 12,
55
+ fontFamily = "ui-sans-serif, system-ui, sans-serif",
56
+ label = "Changelog",
57
+ className = "",
58
+ style
59
+ }) {
60
+ useStyles();
61
+ const uid = useId().replace(/[^a-zA-Z0-9_-]/g, "");
62
+ const listRef = useRef(null);
63
+ const lineRef = useRef(null);
64
+ const [reached, setReached] = useState(0);
65
+ useEffect(() => {
66
+ const list = listRef.current;
67
+ const line = lineRef.current;
68
+ const reduced = window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;
69
+ let frame = 0;
70
+ const update = () => {
71
+ frame = 0;
72
+ const view = scrollRoot?.current?.getBoundingClientRect() ?? { top: 0, height: window.innerHeight };
73
+ const tip = view.top + view.height * anchor;
74
+ const box = line.getBoundingClientRect();
75
+ const progress = reduced ? 1 : Math.max(0, Math.min(1, (tip - box.top) / Math.max(1, box.height)));
76
+ line.style.setProperty("--bl-p", String(progress));
77
+ const items = list.querySelectorAll(":scope > .bl-log__entry");
78
+ let count = 0;
79
+ items.forEach((item) => {
80
+ if (reduced || item.getBoundingClientRect().top + 8 <= tip) count++;
81
+ });
82
+ setReached(count);
83
+ };
84
+ const schedule = () => {
85
+ if (!frame) frame = requestAnimationFrame(update);
86
+ };
87
+ window.addEventListener("scroll", schedule, { capture: true, passive: true });
88
+ window.addEventListener("resize", schedule);
89
+ const resize = new ResizeObserver(schedule);
90
+ resize.observe(list);
91
+ update();
92
+ return () => {
93
+ cancelAnimationFrame(frame);
94
+ window.removeEventListener("scroll", schedule, { capture: true });
95
+ window.removeEventListener("resize", schedule);
96
+ resize.disconnect();
97
+ };
98
+ }, [scrollRoot, anchor, entries.length]);
99
+ return /* @__PURE__ */ jsxs(
100
+ "section",
101
+ {
102
+ className: `bl-log ${className}`,
103
+ "aria-label": label,
104
+ style: {
105
+ "--bl-w": `${width}px`,
106
+ "--bl-x": `${dateColumn + 28}px`,
107
+ "--bl-sticky": `${stickyTop}px`,
108
+ "--bl-bg": backgroundColor,
109
+ "--bl-ink": textColor,
110
+ "--bl-muted": mutedColor,
111
+ "--bl-track": trackColor,
112
+ "--bl-accent": accentColor,
113
+ "--bl-radius": `${mediaRadius}px`,
114
+ "--bl-font": fontFamily,
115
+ ...style
116
+ },
117
+ children: [
118
+ /* @__PURE__ */ jsx("div", { ref: lineRef, className: "bl-log__line", "aria-hidden": "true", children: /* @__PURE__ */ jsx("div", { className: "bl-log__beam" }) }),
119
+ /* @__PURE__ */ jsx("ol", { ref: listRef, className: "bl-log__list", children: entries.map((entry, i) => /* @__PURE__ */ jsxs("li", { className: "bl-log__entry", "data-reached": i < reached || void 0, "aria-labelledby": `${uid}-${i}`, children: [
120
+ /* @__PURE__ */ jsx("time", { className: "bl-log__date", dateTime: entry.dateTime, children: entry.date }),
121
+ /* @__PURE__ */ jsx("span", { className: "bl-log__dot", "aria-hidden": "true" }),
122
+ /* @__PURE__ */ jsxs("div", { className: "bl-log__body", children: [
123
+ /* @__PURE__ */ jsxs("div", { className: "bl-log__head", children: [
124
+ /* @__PURE__ */ jsx("h3", { id: `${uid}-${i}`, className: "bl-log__title", children: entry.title }),
125
+ entry.tag && /* @__PURE__ */ jsx("span", { className: "bl-log__tag", children: entry.tag })
126
+ ] }),
127
+ entry.body && /* @__PURE__ */ jsx("div", { className: "bl-log__text", children: typeof entry.body === "string" ? /* @__PURE__ */ jsx("p", { children: entry.body }) : entry.body }),
128
+ entry.media && /* @__PURE__ */ jsx("div", { className: "bl-log__media", children: typeof entry.media === "string" ? /* @__PURE__ */ jsx("img", { src: entry.media, alt: entry.mediaAlt ?? "", loading: "lazy" }) : entry.media })
129
+ ] })
130
+ ] }, entry.id ?? i)) })
131
+ ]
132
+ }
133
+ );
134
+ }
135
+ export {
136
+ ChangelogTimeline as default
137
+ };
@@ -0,0 +1,23 @@
1
+ import { type CSSProperties, type RefObject } from 'react';
2
+ export interface ChapterProgressProps {
3
+ /** The article to track. */
4
+ target?: RefObject<HTMLElement | null>;
5
+ /** Which headings count as chapters. */
6
+ selector?: string;
7
+ /** Space a heading keeps below the top when jumped to, in px. */
8
+ offset?: number;
9
+ wordsPerMinute?: number;
10
+ showTime?: boolean;
11
+ listLabel?: string;
12
+ label?: string;
13
+ backgroundColor?: string;
14
+ textColor?: string;
15
+ mutedColor?: string;
16
+ trackColor?: string;
17
+ lineColor?: string;
18
+ accentColor?: string;
19
+ fontFamily?: string;
20
+ className?: string;
21
+ style?: CSSProperties;
22
+ }
23
+ export default function ChapterProgress({ target, selector, offset, wordsPerMinute, showTime, listLabel, label, backgroundColor, textColor, mutedColor, trackColor, lineColor, accentColor, fontFamily, className, style }: ChapterProgressProps): import("react").JSX.Element;
@@ -0,0 +1,211 @@
1
+ 'use client';
2
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
+ import { useEffect, useId, useInsertionEffect, useRef, useState } from "react";
4
+ const STYLE_ID = "bl-chapter-progress";
5
+ const CSS = `
6
+ .bl-chap { position: relative; z-index: 10; display: grid; gap: 8px; padding: 10px 14px 12px; background: var(--bl-bg); color: var(--bl-ink); font-family: var(--bl-font); font-size: 13px; box-shadow: 0 1px 0 var(--bl-line), 0 10px 24px -18px rgba(0,0,0,0.8); }
7
+ .bl-chap__row { display: flex; align-items: center; gap: 12px; min-width: 0; }
8
+ .bl-chap__current { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
9
+ .bl-chap__current b { color: var(--bl-accent); font-weight: 700; }
10
+ .bl-chap__meta { flex: 0 0 auto; color: var(--bl-muted); font-variant-numeric: tabular-nums; }
11
+ .bl-chap__toggle { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border: 0; border-radius: 999px; background: var(--bl-track); color: var(--bl-ink); font: inherit; cursor: pointer; }
12
+ .bl-chap__toggle:hover { filter: brightness(1.2); }
13
+ .bl-chap__toggle:focus-visible, .bl-chap__link:focus-visible { outline: 2px solid var(--bl-accent); outline-offset: 2px; }
14
+ .bl-chap__toggle svg { transition: transform 200ms; }
15
+ .bl-chap__toggle[aria-expanded="true"] svg { transform: rotate(180deg); }
16
+ .bl-chap__bar { position: relative; height: 6px; border-radius: 999px; background: var(--bl-track); }
17
+ .bl-chap__fill { position: absolute; inset: 0; border-radius: inherit; background: var(--bl-accent); transform-origin: left; transform: scaleX(var(--bl-p, 0)); }
18
+ .bl-chap__tick { position: absolute; top: 50%; left: calc(var(--at) * 100%); width: 14px; height: 14px; margin: -7px 0 0 -7px; padding: 0; border: 0; border-radius: 50%; background: var(--bl-bg); box-shadow: inset 0 0 0 3px var(--bl-track); cursor: pointer; transition: transform 160ms, box-shadow 160ms; }
19
+ .bl-chap__tick[data-passed] { box-shadow: inset 0 0 0 3px var(--bl-accent); }
20
+ .bl-chap__tick[data-current] { background: var(--bl-accent); }
21
+ .bl-chap__tick:hover { transform: scale(1.3); }
22
+ .bl-chap__tick::after { content: attr(data-title); position: absolute; left: 50%; top: calc(100% + 8px); padding: 3px 8px; border-radius: 6px; background: var(--bl-ink); color: var(--bl-bg); font-size: 12px; white-space: nowrap; transform: translateX(-50%); opacity: 0; pointer-events: none; transition: opacity 120ms; }
23
+ .bl-chap__tick:hover::after { opacity: 1; }
24
+ .bl-chap__menu { position: absolute; top: calc(100% + 6px); right: 10px; display: grid; gap: 2px; min-width: 220px; max-width: calc(100% - 20px); max-height: 60vh; margin: 0; padding: 6px; overflow: auto; border-radius: 10px; background: var(--bl-bg); box-shadow: 0 0 0 1px var(--bl-line), 0 20px 40px -16px rgba(0,0,0,0.8); list-style: none; }
25
+ .bl-chap__link { display: flex; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: 6px; background: transparent; color: var(--bl-ink); font: inherit; text-align: left; cursor: pointer; }
26
+ .bl-chap__link:hover { background: var(--bl-track); }
27
+ .bl-chap__link[aria-current="true"] { color: var(--bl-accent); }
28
+ .bl-chap__link span { color: var(--bl-muted); font-variant-numeric: tabular-nums; }
29
+ @media (prefers-reduced-motion: reduce) { .bl-chap__tick, .bl-chap__toggle svg { transition: none; } }
30
+ `;
31
+ function useStyles() {
32
+ useInsertionEffect(() => {
33
+ if (typeof document === "undefined") return;
34
+ const style = document.getElementById(STYLE_ID) ?? Object.assign(document.createElement("style"), { id: STYLE_ID });
35
+ style.textContent = CSS;
36
+ if (!style.isConnected) document.head.appendChild(style);
37
+ }, []);
38
+ }
39
+ function scrollParent(node) {
40
+ for (let el = node?.parentElement; el; el = el.parentElement) {
41
+ if (/(auto|scroll|overlay)/.test(getComputedStyle(el).overflowY) && el.scrollHeight > el.clientHeight) return el;
42
+ }
43
+ return window;
44
+ }
45
+ function ChapterProgress({
46
+ target,
47
+ selector = "h2",
48
+ offset = 72,
49
+ wordsPerMinute = 220,
50
+ showTime = true,
51
+ listLabel = "Chapters",
52
+ label = "Reading progress",
53
+ backgroundColor = "#1a1c2c",
54
+ textColor = "#f4f4f4",
55
+ mutedColor = "#94b0c2",
56
+ trackColor = "#333c57",
57
+ lineColor = "#333c57",
58
+ accentColor = "#73eff7",
59
+ fontFamily = "ui-sans-serif, system-ui, sans-serif",
60
+ className = "",
61
+ style
62
+ }) {
63
+ useStyles();
64
+ const uid = useId().replace(/[^a-zA-Z0-9_-]/g, "");
65
+ const rootRef = useRef(null);
66
+ const fillRef = useRef(null);
67
+ const [chapters, setChapters] = useState([]);
68
+ const [current, setCurrent] = useState(-1);
69
+ const [percent, setPercent] = useState(0);
70
+ const [minutesLeft, setMinutesLeft] = useState(0);
71
+ const [open, setOpen] = useState(false);
72
+ const headings = useRef([]);
73
+ const scrollerRef = useRef(null);
74
+ useEffect(() => {
75
+ const article = target?.current;
76
+ if (!article) return void 0;
77
+ const scroller = scrollParent(article);
78
+ scrollerRef.current = scroller;
79
+ const isWindow = scroller === window;
80
+ let frame = 0;
81
+ let words = 0;
82
+ let layout = { top: 0, travel: 1, marks: [] };
83
+ const viewTop = () => isWindow ? 0 : scroller.getBoundingClientRect().top;
84
+ const viewHeight = () => isWindow ? window.innerHeight : scroller.clientHeight;
85
+ const measure = () => {
86
+ headings.current = [...article.querySelectorAll(selector)];
87
+ const scrollTop = isWindow ? window.scrollY : scroller.scrollTop;
88
+ const top = article.getBoundingClientRect().top - viewTop() + scrollTop;
89
+ const travel = Math.max(1, article.offsetHeight - viewHeight());
90
+ const marks = headings.current.map((h) => h.getBoundingClientRect().top - viewTop() + scrollTop - offset);
91
+ layout = { top, travel, marks };
92
+ words = (article.innerText || "").split(/\s+/).filter(Boolean).length;
93
+ setChapters(headings.current.map((h, i) => ({ title: h.textContent.trim(), at: Math.max(0, Math.min(1, (marks[i] - top) / travel)) })));
94
+ update();
95
+ };
96
+ const update = () => {
97
+ frame = 0;
98
+ const scrollTop = isWindow ? window.scrollY : scroller.scrollTop;
99
+ const p = Math.max(0, Math.min(1, (scrollTop - layout.top) / layout.travel));
100
+ fillRef.current?.style.setProperty("--bl-p", String(p));
101
+ let index = -1;
102
+ layout.marks.forEach((mark, i) => {
103
+ if (scrollTop >= mark - 2) index = i;
104
+ });
105
+ setCurrent(index);
106
+ setPercent(Math.round(p * 100));
107
+ setMinutesLeft(Math.ceil(words * (1 - p) / wordsPerMinute));
108
+ };
109
+ const schedule = () => {
110
+ if (!frame) frame = requestAnimationFrame(update);
111
+ };
112
+ let timer = 0;
113
+ const remeasure = () => {
114
+ clearTimeout(timer);
115
+ timer = setTimeout(measure, 100);
116
+ };
117
+ scroller.addEventListener("scroll", schedule, { passive: true });
118
+ window.addEventListener("resize", remeasure);
119
+ const resize = new ResizeObserver(remeasure);
120
+ resize.observe(article);
121
+ measure();
122
+ return () => {
123
+ cancelAnimationFrame(frame);
124
+ clearTimeout(timer);
125
+ scroller.removeEventListener("scroll", schedule);
126
+ window.removeEventListener("resize", remeasure);
127
+ resize.disconnect();
128
+ };
129
+ }, [target, selector, offset, wordsPerMinute]);
130
+ useEffect(() => {
131
+ if (!open) return void 0;
132
+ const onKey = (event) => {
133
+ if (event.key === "Escape") {
134
+ setOpen(false);
135
+ rootRef.current?.querySelector(".bl-chap__toggle")?.focus();
136
+ }
137
+ };
138
+ const onDown = (event) => {
139
+ if (!rootRef.current?.contains(event.target)) setOpen(false);
140
+ };
141
+ document.addEventListener("keydown", onKey);
142
+ document.addEventListener("pointerdown", onDown);
143
+ return () => {
144
+ document.removeEventListener("keydown", onKey);
145
+ document.removeEventListener("pointerdown", onDown);
146
+ };
147
+ }, [open]);
148
+ const jump = (index) => {
149
+ const heading = headings.current[index];
150
+ const scroller = scrollerRef.current;
151
+ if (!heading || !scroller) return;
152
+ const isWindow = scroller === window;
153
+ const viewTop = isWindow ? 0 : scroller.getBoundingClientRect().top;
154
+ const scrollTop = isWindow ? window.scrollY : scroller.scrollTop;
155
+ const top = heading.getBoundingClientRect().top - viewTop + scrollTop - offset + 1;
156
+ const behavior = window.matchMedia?.("(prefers-reduced-motion: reduce)").matches ? "auto" : "smooth";
157
+ scroller.scrollTo({ top, behavior });
158
+ if (!heading.hasAttribute("tabindex")) heading.setAttribute("tabindex", "-1");
159
+ heading.focus({ preventScroll: true });
160
+ setOpen(false);
161
+ };
162
+ const chapter = chapters[current];
163
+ return /* @__PURE__ */ jsxs(
164
+ "nav",
165
+ {
166
+ ref: rootRef,
167
+ className: `bl-chap ${className}`,
168
+ "aria-label": label,
169
+ style: { "--bl-bg": backgroundColor, "--bl-ink": textColor, "--bl-muted": mutedColor, "--bl-track": trackColor, "--bl-line": lineColor, "--bl-accent": accentColor, "--bl-font": fontFamily, ...style },
170
+ children: [
171
+ /* @__PURE__ */ jsxs("div", { className: "bl-chap__row", children: [
172
+ /* @__PURE__ */ jsx("span", { className: "bl-chap__current", "aria-live": "polite", children: chapter ? /* @__PURE__ */ jsxs(Fragment, { children: [
173
+ /* @__PURE__ */ jsx("b", { children: current + 1 }),
174
+ " \xB7 ",
175
+ chapter.title
176
+ ] }) : "Introduction" }),
177
+ showTime && /* @__PURE__ */ jsx("span", { className: "bl-chap__meta", "aria-hidden": "true", children: percent >= 100 ? "Done" : `${minutesLeft} min left` }),
178
+ chapters.length > 0 && /* @__PURE__ */ jsxs("button", { type: "button", className: "bl-chap__toggle", "aria-expanded": open, "aria-controls": `${uid}-menu`, onClick: () => setOpen((o) => !o), children: [
179
+ listLabel,
180
+ /* @__PURE__ */ jsx("svg", { width: "10", height: "10", viewBox: "0 0 10 10", fill: "none", stroke: "currentColor", strokeWidth: "1.8", "aria-hidden": "true", children: /* @__PURE__ */ jsx("path", { d: "M2 3.5 5 6.5 8 3.5" }) })
181
+ ] })
182
+ ] }),
183
+ /* @__PURE__ */ jsxs("div", { className: "bl-chap__bar", role: "progressbar", "aria-label": label, "aria-valuemin": 0, "aria-valuemax": 100, "aria-valuenow": percent, children: [
184
+ /* @__PURE__ */ jsx("div", { ref: fillRef, className: "bl-chap__fill" }),
185
+ chapters.map((c, i) => /* @__PURE__ */ jsx(
186
+ "button",
187
+ {
188
+ type: "button",
189
+ tabIndex: -1,
190
+ "aria-hidden": "true",
191
+ className: "bl-chap__tick",
192
+ style: { "--at": c.at },
193
+ "data-title": c.title,
194
+ "data-passed": i <= current || void 0,
195
+ "data-current": i === current || void 0,
196
+ onClick: () => jump(i)
197
+ },
198
+ i
199
+ ))
200
+ ] }),
201
+ open && /* @__PURE__ */ jsx("ol", { id: `${uid}-menu`, className: "bl-chap__menu", children: chapters.map((c, i) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsxs("button", { type: "button", className: "bl-chap__link", "aria-current": i === current || void 0, onClick: () => jump(i), children: [
202
+ /* @__PURE__ */ jsx("span", { children: i + 1 }),
203
+ c.title
204
+ ] }) }, i)) })
205
+ ]
206
+ }
207
+ );
208
+ }
209
+ export {
210
+ ChapterProgress as default
211
+ };
@@ -0,0 +1,42 @@
1
+ import { type CSSProperties, type ReactNode } from 'react';
2
+ export interface ChatMessage {
3
+ id: string | number;
4
+ from: 'me' | 'them';
5
+ text: ReactNode;
6
+ author?: string;
7
+ /** Avatar content (image, sprite or initials); defaults to the author's initial. */
8
+ avatar?: ReactNode;
9
+ time?: string;
10
+ /** Reactions already on the message. */
11
+ reactions?: string[];
12
+ }
13
+ export interface ChatBubblesProps {
14
+ messages?: ChatMessage[];
15
+ /** Show the typing indicator. */
16
+ typing?: boolean;
17
+ typingName?: string;
18
+ /** Picker options; double-click adds the first. */
19
+ reactions?: string[];
20
+ /** Called when you toggle a reaction. */
21
+ onReact?: (id: ChatMessage['id'], emoji: string, on: boolean) => void;
22
+ /** Thread height (px or any CSS length). */
23
+ height?: number | string;
24
+ radius?: number;
25
+ /** Accessible name of the live log. */
26
+ label?: string;
27
+ backgroundColor?: string;
28
+ meColor?: string;
29
+ meTextColor?: string;
30
+ themColor?: string;
31
+ themTextColor?: string;
32
+ textColor?: string;
33
+ mutedColor?: string;
34
+ chipColor?: string;
35
+ pickerColor?: string;
36
+ lineColor?: string;
37
+ accentColor?: string;
38
+ fontFamily?: string;
39
+ className?: string;
40
+ style?: CSSProperties;
41
+ }
42
+ export default function ChatBubbles({ messages, typing, typingName, reactions, onReact, height, radius, label, backgroundColor, meColor, meTextColor, themColor, themTextColor, textColor, mutedColor, chipColor, pickerColor, lineColor, accentColor, fontFamily, className, style }: ChatBubblesProps): import("react").JSX.Element;