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
package/dist/Reveal.js ADDED
@@ -0,0 +1,92 @@
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-reveal";
5
+ const CSS = `
6
+ .bl-reveal { position: relative; }
7
+ .bl-reveal__part { display: block; transition: opacity var(--bl-dur) cubic-bezier(.2,.8,.2,1), transform var(--bl-dur) cubic-bezier(.2,.8,.2,1), clip-path var(--bl-dur) steps(var(--bl-steps)); transition-delay: calc(var(--bl-delay) + var(--i, 0) * var(--bl-stagger)); }
8
+ .bl-reveal:not([data-shown])[data-effect="fade"] .bl-reveal__part { opacity: 0; }
9
+ .bl-reveal:not([data-shown])[data-effect="rise"] .bl-reveal__part { opacity: 0; transform: translateY(var(--bl-distance)); }
10
+ .bl-reveal:not([data-shown])[data-effect="zoom"] .bl-reveal__part { opacity: 0; transform: scale(0.92); }
11
+ .bl-reveal:not([data-shown])[data-effect="wipe"] .bl-reveal__part { clip-path: inset(0 100% 0 0); }
12
+ .bl-reveal__cover { position: absolute; inset: 0; z-index: 1; display: grid; grid-template-columns: repeat(var(--bl-cols), 1fr); grid-template-rows: repeat(var(--bl-rows), 1fr); pointer-events: none; }
13
+ .bl-reveal__block { background: var(--bl-cover); transition: opacity 1ms linear; transition-delay: calc(var(--bl-delay) + var(--d) * var(--bl-dur)); }
14
+ .bl-reveal[data-shown] .bl-reveal__block { opacity: 0; }
15
+ @media (prefers-reduced-motion: reduce) { .bl-reveal .bl-reveal__part { opacity: 1 !important; transform: none !important; clip-path: none !important; transition: none !important; } .bl-reveal .bl-reveal__cover { display: none; } }
16
+ `;
17
+ function useStyles() {
18
+ useInsertionEffect(() => {
19
+ if (typeof document === "undefined") return;
20
+ const style = document.getElementById(STYLE_ID) ?? Object.assign(document.createElement("style"), { id: STYLE_ID });
21
+ style.textContent = CSS;
22
+ if (!style.isConnected) document.head.appendChild(style);
23
+ }, []);
24
+ }
25
+ const scatter = (i) => {
26
+ const x = Math.sin((i + 1) * 91.345) * 47453.13;
27
+ return x - Math.floor(x);
28
+ };
29
+ function Reveal({
30
+ children,
31
+ as: Tag = "div",
32
+ effect = "rise",
33
+ cascade = false,
34
+ trigger = "view",
35
+ once = true,
36
+ threshold = 0.2,
37
+ duration = 600,
38
+ delay = 0,
39
+ stagger = 90,
40
+ distance = 24,
41
+ steps = 8,
42
+ blocks = [8, 5],
43
+ coverColor = "#0b0b14",
44
+ onReveal,
45
+ className = "",
46
+ style
47
+ }) {
48
+ useStyles();
49
+ const rootRef = useRef(null);
50
+ const revealRef = useRef(onReveal);
51
+ revealRef.current = onReveal;
52
+ const [shown, setShown] = useState(false);
53
+ useEffect(() => {
54
+ if (trigger === "mount") {
55
+ const id = requestAnimationFrame(() => requestAnimationFrame(() => setShown(true)));
56
+ return () => cancelAnimationFrame(id);
57
+ }
58
+ const observer = new IntersectionObserver(
59
+ ([entry]) => {
60
+ if (entry.isIntersecting) {
61
+ setShown(true);
62
+ if (once) observer.disconnect();
63
+ } else if (!once) setShown(false);
64
+ },
65
+ { threshold }
66
+ );
67
+ observer.observe(rootRef.current);
68
+ return () => observer.disconnect();
69
+ }, [trigger, once, threshold]);
70
+ useEffect(() => {
71
+ if (shown) revealRef.current?.();
72
+ }, [shown]);
73
+ const parts = cascade ? Children.toArray(children) : [children];
74
+ const [cols, rows] = blocks;
75
+ return /* @__PURE__ */ jsxs(
76
+ Tag,
77
+ {
78
+ ref: rootRef,
79
+ className: `bl-reveal ${className}`,
80
+ "data-effect": effect,
81
+ "data-shown": shown || void 0,
82
+ style: { "--bl-dur": `${duration}ms`, "--bl-delay": `${delay}ms`, "--bl-stagger": `${stagger}ms`, "--bl-distance": `${distance}px`, "--bl-steps": steps, "--bl-cols": cols, "--bl-rows": rows, "--bl-cover": coverColor, ...style },
83
+ children: [
84
+ parts.map((part, i) => /* @__PURE__ */ jsx("div", { className: "bl-reveal__part", style: { "--i": i }, children: part }, i)),
85
+ effect === "blocks" && /* @__PURE__ */ jsx("div", { className: "bl-reveal__cover", "aria-hidden": "true", children: Array.from({ length: cols * rows }, (_, i) => /* @__PURE__ */ jsx("span", { className: "bl-reveal__block", style: { "--d": scatter(i).toFixed(3) } }, i)) })
86
+ ]
87
+ }
88
+ );
89
+ }
90
+ export {
91
+ Reveal as default
92
+ };
@@ -0,0 +1,45 @@
1
+ import { type CSSProperties, type ReactNode } from 'react';
2
+ export interface Ring {
3
+ value: number;
4
+ /** Defaults to 100. */
5
+ max?: number;
6
+ label?: string;
7
+ /** Overrides the color from `colors`. */
8
+ color?: string;
9
+ }
10
+ export interface RingProgressProps {
11
+ /** Outer ring first. Values clamp to 0–max. */
12
+ rings?: Ring[];
13
+ /** Diameter, in px. */
14
+ size?: number;
15
+ /** Ring width, in px. */
16
+ thickness?: number;
17
+ /** Space between rings, in px. */
18
+ gap?: number;
19
+ /** Fill animation length, in ms. */
20
+ duration?: number;
21
+ /** Delay between rings, in ms. */
22
+ stagger?: number;
23
+ /** Where rings start, in degrees (0 = top). */
24
+ startAngle?: number;
25
+ /** Lighter-to-full gradient of each ring's own hue. */
26
+ gradient?: boolean;
27
+ /** Defaults to on for two or more rings. */
28
+ showLegend?: boolean;
29
+ /** Centre caption while nothing is focused. */
30
+ centerLabel?: ReactNode;
31
+ /** Text in the centre and the legend; also read aloud, so it must be plain text. */
32
+ formatValue?: (ring: Ring) => string;
33
+ /** Ring colors in order (the default three are validated for a dark surface). */
34
+ colors?: string[];
35
+ /** Opacity of each ring's track (same hue). */
36
+ trackOpacity?: number;
37
+ textColor?: string;
38
+ mutedColor?: string;
39
+ hoverColor?: string;
40
+ focusColor?: string;
41
+ fontFamily?: string;
42
+ className?: string;
43
+ style?: CSSProperties;
44
+ }
45
+ export default function RingProgress({ rings, size, thickness, gap, duration, stagger, startAngle, gradient, showLegend, centerLabel, formatValue, colors, trackOpacity, textColor, mutedColor, hoverColor, focusColor, fontFamily, className, style }: RingProgressProps): import("react").JSX.Element;
@@ -0,0 +1,180 @@
1
+ 'use client';
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import { useEffect, useId, useInsertionEffect, useState } from "react";
4
+ const STYLE_ID = "bl-ring-progress";
5
+ const CSS = `
6
+ .bl-ring { position: relative; display: inline-flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 22px; max-width: 100%; color: var(--bl-ink); font-family: var(--bl-font); }
7
+ .bl-ring__figure { position: relative; flex: 0 0 auto; width: var(--bl-size); max-width: 100%; aspect-ratio: 1; }
8
+ .bl-ring__figure svg { display: block; width: 100%; height: 100%; overflow: visible; }
9
+ .bl-ring__arc { fill: none; stroke-linecap: round; transition: stroke-dashoffset var(--bl-dur) cubic-bezier(.2,.9,.25,1) var(--bl-delay), opacity 200ms; }
10
+ .bl-ring__track { fill: none; transition: opacity 200ms; }
11
+ /* A zero-length arc would still draw its round caps as a dot, so hide it. */
12
+ .bl-ring .bl-ring__arc[data-empty] { opacity: 0; }
13
+ .bl-ring__hit { fill: none; stroke: transparent; cursor: default; pointer-events: stroke; }
14
+ .bl-ring[data-focus] .bl-ring__layer:not([data-focused]) .bl-ring__arc, .bl-ring[data-focus] .bl-ring__layer:not([data-focused]) .bl-ring__track { opacity: 0.3; }
15
+ .bl-ring__center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; pointer-events: none; }
16
+ .bl-ring__value { font-size: var(--bl-value-size); font-weight: 700; line-height: 1.05; }
17
+ .bl-ring__label { margin-top: 4px; color: var(--bl-muted); font-size: 12px; }
18
+ .bl-ring__legend { display: grid; gap: 4px; margin: 0; padding: 0; list-style: none; }
19
+ .bl-ring__item { display: grid; grid-template-columns: 14px auto auto; align-items: center; gap: 10px; padding: 6px 10px; border-radius: 8px; outline: none; cursor: default; }
20
+ .bl-ring__item:hover, .bl-ring__item:focus-visible, .bl-ring__item[data-focused] { background: var(--bl-hover); }
21
+ .bl-ring__item:focus-visible { box-shadow: inset 0 0 0 2px var(--bl-focus); }
22
+ .bl-ring__key { width: 14px; height: 4px; border-radius: 2px; }
23
+ .bl-ring__name { color: var(--bl-muted); font-size: 13px; }
24
+ .bl-ring__num { justify-self: end; font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; }
25
+ @media (prefers-reduced-motion: reduce) { .bl-ring__arc { transition: opacity 200ms; } }
26
+ `;
27
+ function useStyles() {
28
+ useInsertionEffect(() => {
29
+ if (typeof document === "undefined") return;
30
+ const style = document.getElementById(STYLE_ID) ?? Object.assign(document.createElement("style"), { id: STYLE_ID });
31
+ style.textContent = CSS;
32
+ if (!style.isConnected) document.head.appendChild(style);
33
+ }, []);
34
+ }
35
+ const DEFAULT_COLORS = ["#3987e5", "#d95926", "#199e70"];
36
+ const percent = (ring) => Math.max(0, Math.min(1, ring.value / (ring.max || 100)));
37
+ const defaultFormat = (ring) => `${Math.round(percent(ring) * 100)}%`;
38
+ function RingProgress({
39
+ rings = [{ value: 72, label: "Progress" }],
40
+ size = 180,
41
+ thickness = 14,
42
+ gap = 6,
43
+ duration = 1100,
44
+ stagger = 120,
45
+ startAngle = 0,
46
+ gradient = true,
47
+ showLegend,
48
+ centerLabel,
49
+ formatValue = defaultFormat,
50
+ colors = DEFAULT_COLORS,
51
+ trackOpacity = 0.18,
52
+ textColor = "#f4f4f4",
53
+ mutedColor = "#94b0c2",
54
+ hoverColor = "rgba(255,255,255,0.06)",
55
+ focusColor = "#73eff7",
56
+ fontFamily = "ui-sans-serif, system-ui, sans-serif",
57
+ className = "",
58
+ style
59
+ }) {
60
+ useStyles();
61
+ const uid = useId().replace(/[^a-zA-Z0-9_-]/g, "");
62
+ const [drawn, setDrawn] = useState(false);
63
+ const [focus, setFocus] = useState(null);
64
+ const legend = showLegend ?? rings.length > 1;
65
+ useEffect(() => {
66
+ const timer = setTimeout(() => setDrawn(true), 30);
67
+ return () => clearTimeout(timer);
68
+ }, []);
69
+ const view = 100;
70
+ const center = view / 2;
71
+ const unit = view / size;
72
+ const stroke = thickness * unit;
73
+ const step = (thickness + gap) * unit;
74
+ const shown = focus ?? 0;
75
+ const primary = rings[shown];
76
+ const inner = size - 2 * rings.length * (thickness + gap) + 2 * gap;
77
+ const centerText = primary ? String(formatValue(primary)) : "";
78
+ const valueSize = Math.max(12, Math.min(Math.round(size * 0.17), Math.floor(inner * 0.78 / Math.max(2, centerText.length * 0.62))));
79
+ return /* @__PURE__ */ jsxs(
80
+ "div",
81
+ {
82
+ className: `bl-ring ${className}`,
83
+ "data-focus": focus !== null || void 0,
84
+ style: {
85
+ "--bl-size": `${size}px`,
86
+ "--bl-dur": `${duration}ms`,
87
+ "--bl-ink": textColor,
88
+ "--bl-muted": mutedColor,
89
+ "--bl-hover": hoverColor,
90
+ "--bl-focus": focusColor,
91
+ "--bl-font": fontFamily,
92
+ "--bl-value-size": `${valueSize}px`,
93
+ ...style
94
+ },
95
+ children: [
96
+ /* @__PURE__ */ jsxs("div", { className: "bl-ring__figure", children: [
97
+ /* @__PURE__ */ jsxs("svg", { viewBox: `0 0 ${view} ${view}`, "aria-hidden": "true", children: [
98
+ /* @__PURE__ */ jsx("defs", { children: rings.map((ring, i) => {
99
+ const c = ring.color ?? colors[i % colors.length];
100
+ return /* @__PURE__ */ jsxs("linearGradient", { id: `${uid}-g${i}`, x1: "0", y1: "0", x2: "1", y2: "1", children: [
101
+ /* @__PURE__ */ jsx("stop", { offset: "0", style: { stopColor: `color-mix(in srgb, ${c} 70%, white)` } }),
102
+ /* @__PURE__ */ jsx("stop", { offset: "1", style: { stopColor: c } })
103
+ ] }, i);
104
+ }) }),
105
+ rings.map((ring, i) => {
106
+ const c = ring.color ?? colors[i % colors.length];
107
+ const r = center - stroke / 2 - i * step;
108
+ if (r <= stroke / 2) return null;
109
+ const circumference = 2 * Math.PI * r;
110
+ const fraction = drawn ? percent(ring) : 0;
111
+ const transform = `rotate(${startAngle - 90} ${center} ${center})`;
112
+ return /* @__PURE__ */ jsxs("g", { className: "bl-ring__layer", "data-focused": focus === i || void 0, onPointerEnter: () => setFocus(i), onPointerLeave: () => setFocus(null), children: [
113
+ /* @__PURE__ */ jsx("circle", { className: "bl-ring__track", cx: center, cy: center, r, stroke: c, strokeOpacity: trackOpacity, strokeWidth: stroke }),
114
+ /* @__PURE__ */ jsx(
115
+ "circle",
116
+ {
117
+ className: "bl-ring__arc",
118
+ cx: center,
119
+ cy: center,
120
+ r,
121
+ stroke: gradient ? `url(#${uid}-g${i})` : c,
122
+ strokeWidth: stroke,
123
+ strokeDasharray: circumference,
124
+ strokeDashoffset: circumference * (1 - fraction),
125
+ transform,
126
+ "data-empty": fraction === 0 || void 0,
127
+ style: { "--bl-delay": `${i * stagger}ms` }
128
+ }
129
+ ),
130
+ /* @__PURE__ */ jsx("circle", { className: "bl-ring__hit", cx: center, cy: center, r, strokeWidth: step })
131
+ ] }, i);
132
+ })
133
+ ] }),
134
+ primary && /* @__PURE__ */ jsxs("div", { className: "bl-ring__center", children: [
135
+ /* @__PURE__ */ jsx("div", { className: "bl-ring__value", children: formatValue(primary) }),
136
+ /* @__PURE__ */ jsx("div", { className: "bl-ring__label", children: focus === null && centerLabel !== void 0 ? centerLabel : primary.label })
137
+ ] })
138
+ ] }),
139
+ legend ? /* @__PURE__ */ jsx("ul", { className: "bl-ring__legend", children: rings.map((ring, i) => /* @__PURE__ */ jsxs(
140
+ "li",
141
+ {
142
+ className: "bl-ring__item",
143
+ tabIndex: 0,
144
+ role: "meter",
145
+ "aria-label": ring.label ?? `Ring ${i + 1}`,
146
+ "aria-valuemin": 0,
147
+ "aria-valuemax": ring.max || 100,
148
+ "aria-valuenow": ring.value,
149
+ "aria-valuetext": formatValue(ring),
150
+ "data-focused": focus === i || void 0,
151
+ onPointerEnter: () => setFocus(i),
152
+ onPointerLeave: () => setFocus(null),
153
+ onFocus: () => setFocus(i),
154
+ onBlur: () => setFocus(null),
155
+ children: [
156
+ /* @__PURE__ */ jsx("span", { className: "bl-ring__key", style: { background: ring.color ?? colors[i % colors.length] }, "aria-hidden": "true" }),
157
+ /* @__PURE__ */ jsx("span", { className: "bl-ring__name", children: ring.label ?? `Ring ${i + 1}` }),
158
+ /* @__PURE__ */ jsx("span", { className: "bl-ring__num", children: formatValue(ring) })
159
+ ]
160
+ },
161
+ i
162
+ )) }) : primary && /* @__PURE__ */ jsx(
163
+ "span",
164
+ {
165
+ role: "meter",
166
+ "aria-label": primary.label ?? "Progress",
167
+ "aria-valuemin": 0,
168
+ "aria-valuemax": primary.max || 100,
169
+ "aria-valuenow": primary.value,
170
+ "aria-valuetext": formatValue(primary),
171
+ style: { position: "absolute", width: 1, height: 1, overflow: "hidden", clip: "rect(0 0 0 0)" }
172
+ }
173
+ )
174
+ ]
175
+ }
176
+ );
177
+ }
178
+ export {
179
+ RingProgress as default
180
+ };
@@ -0,0 +1,28 @@
1
+ import { type CSSProperties } from 'react';
2
+ export interface RollingNumberProps {
3
+ /** The number to show. Changes roll each digit to its new place. */
4
+ value?: number;
5
+ /** Start here and roll to `value` when the number scrolls into view. */
6
+ from?: number;
7
+ /** BCP 47 locale for formatting (defaults to the browser's). */
8
+ locale?: string | string[];
9
+ /** Any Intl.NumberFormat options: currency, percent, compact, fraction digits… */
10
+ format?: Intl.NumberFormatOptions;
11
+ prefix?: string;
12
+ suffix?: string;
13
+ /** Roll length, in ms. */
14
+ duration?: number;
15
+ /** Delay added per digit from the left, in ms. */
16
+ stagger?: number;
17
+ /** With `from`, wait until visible before rolling. */
18
+ startOnView?: boolean;
19
+ /** Announce changes politely to screen readers. */
20
+ announce?: boolean;
21
+ /** Digit cell height, in em. */
22
+ lineHeight?: number;
23
+ /** Digit color (defaults to the inherited text color). */
24
+ color?: string;
25
+ className?: string;
26
+ style?: CSSProperties;
27
+ }
28
+ export default function RollingNumber({ value, from, locale, format, prefix, suffix, duration, stagger, startOnView, announce, lineHeight, color, className, style }: RollingNumberProps): import("react").JSX.Element;
@@ -0,0 +1,108 @@
1
+ 'use client';
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import { useEffect, useInsertionEffect, useMemo, useRef, useState } from "react";
4
+ const STYLE_ID = "bl-rolling-number";
5
+ const CSS = `
6
+ .bl-rn { position: relative; display: inline-flex; align-items: baseline; color: var(--bl-ink); font-variant-numeric: tabular-nums; line-height: var(--bl-lh); white-space: nowrap; }
7
+ .bl-rn__col { position: relative; display: inline-block; height: calc(var(--bl-lh) * 1em); overflow: hidden; }
8
+ .bl-rn__strip { display: flex; flex-direction: column; transform: translateY(calc(var(--bl-digit) * -10%)); transition: transform var(--bl-dur) var(--bl-ease) var(--bl-delay); }
9
+ .bl-rn__strip > span { display: block; height: calc(var(--bl-lh) * 1em); text-align: center; }
10
+ .bl-rn__sym { display: inline-block; }
11
+ .bl-rn__col[data-enter], .bl-rn__sym[data-enter] { animation: bl-rn-in var(--bl-dur) var(--bl-ease); }
12
+ .bl-rn__sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
13
+ @keyframes bl-rn-in { from { opacity: 0; transform: translateY(40%); } }
14
+ @media (prefers-reduced-motion: reduce) { .bl-rn__strip { transition: none; } .bl-rn__col[data-enter], .bl-rn__sym[data-enter] { animation: none; } }
15
+ `;
16
+ function useStyles() {
17
+ useInsertionEffect(() => {
18
+ if (typeof document === "undefined") return;
19
+ const style = document.getElementById(STYLE_ID) ?? Object.assign(document.createElement("style"), { id: STYLE_ID });
20
+ style.textContent = CSS;
21
+ if (!style.isConnected) document.head.appendChild(style);
22
+ }, []);
23
+ }
24
+ const DIGITS = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"];
25
+ function tokenize(text) {
26
+ const chars = [...text];
27
+ let digitIndex = 0;
28
+ let symbolIndex = 0;
29
+ const tokens = [];
30
+ for (let i = chars.length - 1; i >= 0; i--) {
31
+ const char = chars[i];
32
+ if (char >= "0" && char <= "9") tokens.unshift({ key: `d${digitIndex++}`, digit: Number(char), char });
33
+ else tokens.unshift({ key: `s${symbolIndex++}-${char}`, char });
34
+ }
35
+ return tokens;
36
+ }
37
+ function RollingNumber({
38
+ value = 0,
39
+ from,
40
+ locale,
41
+ format,
42
+ prefix = "",
43
+ suffix = "",
44
+ duration = 900,
45
+ stagger = 40,
46
+ startOnView = true,
47
+ announce = false,
48
+ lineHeight = 1.1,
49
+ color,
50
+ className = "",
51
+ style
52
+ }) {
53
+ useStyles();
54
+ const ref = useRef(null);
55
+ const [shown, setShown] = useState(from ?? value);
56
+ const [started, setStarted] = useState(!startOnView || from === void 0);
57
+ const mounted = useRef(false);
58
+ useEffect(() => {
59
+ if (started) return void 0;
60
+ const node = ref.current;
61
+ if (!node || typeof IntersectionObserver === "undefined") {
62
+ setStarted(true);
63
+ return void 0;
64
+ }
65
+ const observer = new IntersectionObserver(([entry]) => entry.isIntersecting && setStarted(true), { threshold: 0.3 });
66
+ observer.observe(node);
67
+ return () => observer.disconnect();
68
+ }, [started]);
69
+ useEffect(() => {
70
+ if (!started) return void 0;
71
+ const timer = setTimeout(() => setShown(value), mounted.current ? 0 : 30);
72
+ mounted.current = true;
73
+ return () => clearTimeout(timer);
74
+ }, [value, started]);
75
+ const formatter = useMemo(() => new Intl.NumberFormat(locale, format), [locale, JSON.stringify(format)]);
76
+ const text = `${prefix}${formatter.format(shown)}${suffix}`;
77
+ const tokens = tokenize(text);
78
+ const known = useRef(/* @__PURE__ */ new Set());
79
+ const rendered = tokens.map((token) => {
80
+ const entering = mounted.current && !known.current.has(token.key);
81
+ return { ...token, entering };
82
+ });
83
+ useEffect(() => {
84
+ known.current = new Set(tokens.map((token) => token.key));
85
+ });
86
+ let digitOrder = 0;
87
+ return /* @__PURE__ */ jsxs(
88
+ "span",
89
+ {
90
+ ref,
91
+ className: `bl-rn ${className}`,
92
+ style: { "--bl-lh": lineHeight, "--bl-dur": `${duration}ms`, "--bl-ease": "cubic-bezier(.2,.9,.25,1)", ...color ? { "--bl-ink": color } : { "--bl-ink": "currentColor" }, ...style },
93
+ children: [
94
+ /* @__PURE__ */ jsx("span", { "aria-hidden": "true", style: { display: "inline-flex", alignItems: "baseline" }, children: rendered.map((token) => {
95
+ if (token.digit === void 0) {
96
+ return /* @__PURE__ */ jsx("span", { className: "bl-rn__sym", "data-enter": token.entering || void 0, children: token.char }, token.key);
97
+ }
98
+ const delay = digitOrder++ * stagger;
99
+ return /* @__PURE__ */ jsx("span", { className: "bl-rn__col", "data-enter": token.entering || void 0, children: /* @__PURE__ */ jsx("span", { className: "bl-rn__strip", style: { "--bl-digit": token.digit, "--bl-delay": `${delay}ms` }, children: DIGITS.map((d) => /* @__PURE__ */ jsx("span", { children: d }, d)) }) }, token.key);
100
+ }) }),
101
+ /* @__PURE__ */ jsx("span", { className: "bl-rn__sr", "aria-live": announce ? "polite" : void 0, children: `${prefix}${formatter.format(value)}${suffix}` })
102
+ ]
103
+ }
104
+ );
105
+ }
106
+ export {
107
+ RollingNumber as default
108
+ };
@@ -0,0 +1,24 @@
1
+ import { type CSSProperties } from 'react';
2
+ export interface ScanScopeProps {
3
+ /** A rotating sweep over range rings, or a bar scanning down. */
4
+ mode?: 'radar' | 'line';
5
+ /** A count to scatter, or positions in 0–1 of the area. */
6
+ blips?: number | {
7
+ x: number;
8
+ y: number;
9
+ }[];
10
+ /** Seconds per sweep. */
11
+ period?: number;
12
+ /** Length of the fading wake (share of a turn, or of the height). */
13
+ trail?: number;
14
+ rings?: number;
15
+ gridSize?: number;
16
+ pixelSize?: number;
17
+ color?: string;
18
+ blipColor?: string;
19
+ gridColor?: string;
20
+ backgroundColor?: string;
21
+ className?: string;
22
+ style?: CSSProperties;
23
+ }
24
+ export default function ScanScope({ mode, blips, period, trail, rings, gridSize, pixelSize, color, blipColor, gridColor, backgroundColor, className, style }: ScanScopeProps): import("react").JSX.Element;
@@ -0,0 +1,164 @@
1
+ 'use client';
2
+ import { jsx } from "react/jsx-runtime";
3
+ import { useEffect, useRef } from "react";
4
+ const hexToRgb = (hex) => {
5
+ const n = parseInt(hex.replace("#", "").replace(/^(.)(.)(.)$/, "$1$1$2$2$3$3"), 16);
6
+ return [n >> 16 & 255, n >> 8 & 255, n & 255];
7
+ };
8
+ const rgba = ([r, g, b], a) => `rgba(${r},${g},${b},${a})`;
9
+ function ScanScope({
10
+ mode = "radar",
11
+ blips = 9,
12
+ period = 4,
13
+ trail = 0.22,
14
+ rings = 4,
15
+ gridSize = 28,
16
+ pixelSize = 2,
17
+ color = "#38b764",
18
+ blipColor = "#ffcd75",
19
+ gridColor = "#262b44",
20
+ backgroundColor = "#0b0b14",
21
+ className = "",
22
+ style
23
+ }) {
24
+ const canvasRef = useRef(null);
25
+ const blipKey = Array.isArray(blips) ? blips.map((b) => `${b.x},${b.y}`).join(";") : String(blips);
26
+ useEffect(() => {
27
+ const canvas = canvasRef.current;
28
+ const ctx = canvas.getContext("2d");
29
+ const reduced = window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;
30
+ const beam = hexToRgb(color);
31
+ const dot = hexToRgb(blipColor);
32
+ const grid = hexToRgb(gridColor);
33
+ const points = (Array.isArray(blips) ? blips : Array.from({ length: blips }, (_, i) => ({ x: 0.15 + (Math.sin(i * 91.7) * 0.5 + 0.5) * 0.7, y: 0.15 + (Math.sin(i * 37.3 + 2) * 0.5 + 0.5) * 0.7 }))).map((p) => ({ ...p, litAt: -1e9 }));
34
+ let W = 0;
35
+ let H = 0;
36
+ let dpr = 1;
37
+ let t = 0;
38
+ let raf = 0;
39
+ let last = 0;
40
+ let visible = true;
41
+ let prevSweep = 0;
42
+ const fit = () => {
43
+ dpr = Math.min(2, window.devicePixelRatio || 1);
44
+ W = canvas.clientWidth;
45
+ H = canvas.clientHeight;
46
+ canvas.width = Math.round(W * dpr);
47
+ canvas.height = Math.round(H * dpr);
48
+ };
49
+ const snap = (v) => Math.round(v / pixelSize) * pixelSize;
50
+ const drawGrid = (cx, cy, radius) => {
51
+ ctx.fillStyle = rgba(grid, 1);
52
+ for (let x = snap(W % gridSize / 2); x < W; x += gridSize) for (let y = 0; y < H; y += pixelSize * 2) ctx.fillRect(x, y, 1, pixelSize);
53
+ for (let y = snap(H % gridSize / 2); y < H; y += gridSize) for (let x = 0; x < W; x += pixelSize * 2) ctx.fillRect(x, y, pixelSize, 1);
54
+ if (mode !== "radar") return;
55
+ ctx.fillStyle = rgba(beam, 0.35);
56
+ for (let r = 1; r <= rings; r++) {
57
+ const rr = radius * r / rings;
58
+ const steps = Math.ceil(rr * Math.PI * 2 / (pixelSize * 2));
59
+ for (let k = 0; k < steps; k++) {
60
+ const a = k / steps * Math.PI * 2;
61
+ ctx.fillRect(snap(cx + Math.cos(a) * rr), snap(cy + Math.sin(a) * rr), pixelSize, pixelSize);
62
+ }
63
+ }
64
+ };
65
+ const draw = (now) => {
66
+ ctx.setTransform(dpr, 0, 0, dpr, 0, 0);
67
+ ctx.fillStyle = backgroundColor;
68
+ ctx.fillRect(0, 0, W, H);
69
+ const cx = W / 2;
70
+ const cy = H / 2;
71
+ const radius = Math.min(W, H) * 0.46;
72
+ drawGrid(cx, cy, radius);
73
+ const turn = t / period % 1;
74
+ if (!reduced) {
75
+ if (mode === "radar") {
76
+ const slices = 28;
77
+ for (let s = 0; s < slices; s++) {
78
+ const a0 = (turn - trail * (s + 1) / slices) * Math.PI * 2;
79
+ const a1 = (turn - trail * s / slices) * Math.PI * 2;
80
+ ctx.fillStyle = rgba(beam, 0.35 * (1 - s / slices) ** 2);
81
+ ctx.beginPath();
82
+ ctx.moveTo(cx, cy);
83
+ ctx.arc(cx, cy, radius, a0, a1);
84
+ ctx.closePath();
85
+ ctx.fill();
86
+ }
87
+ } else {
88
+ const y = turn * H;
89
+ const glow = ctx.createLinearGradient(0, y - H * trail, 0, y);
90
+ glow.addColorStop(0, rgba(beam, 0));
91
+ glow.addColorStop(1, rgba(beam, 0.35));
92
+ ctx.fillStyle = glow;
93
+ ctx.fillRect(0, y - H * trail, W, H * trail);
94
+ ctx.fillStyle = rgba(beam, 0.9);
95
+ ctx.fillRect(0, snap(y), W, pixelSize);
96
+ }
97
+ }
98
+ points.forEach((p) => {
99
+ const x = mode === "radar" ? cx + (p.x - 0.5) * radius * 2 : p.x * W;
100
+ const y = mode === "radar" ? cy + (p.y - 0.5) * radius * 2 : p.y * H;
101
+ if (mode === "radar" && Math.hypot(x - cx, y - cy) > radius) return;
102
+ const age = reduced ? 0 : (now - p.litAt) / (period * 1e3);
103
+ if (age >= 1) return;
104
+ const a = 1 - age;
105
+ const s = pixelSize * 3;
106
+ ctx.fillStyle = rgba(dot, a);
107
+ ctx.fillRect(snap(x) - s / 2, snap(y) - s / 2, s, s);
108
+ if (age < 0.25 && !reduced) {
109
+ const rr = 4 + age / 0.25 * 18;
110
+ ctx.fillStyle = rgba(dot, (1 - age / 0.25) * 0.8);
111
+ const steps = 16;
112
+ for (let k = 0; k < steps; k++) {
113
+ const ang = k / steps * Math.PI * 2;
114
+ ctx.fillRect(snap(x + Math.cos(ang) * rr), snap(y + Math.sin(ang) * rr), pixelSize, pixelSize);
115
+ }
116
+ }
117
+ });
118
+ };
119
+ const tick = (now) => {
120
+ t += Math.max(0, Math.min(0.05, (now - last) / 1e3));
121
+ last = now;
122
+ const turn = t / period % 1;
123
+ points.forEach((p) => {
124
+ let at;
125
+ if (mode === "radar") at = (Math.atan2(p.y - 0.5, p.x - 0.5) / (Math.PI * 2) + 1) % 1;
126
+ else at = p.y;
127
+ const crossed = prevSweep <= turn ? at > prevSweep && at <= turn : at > prevSweep || at <= turn;
128
+ if (crossed) p.litAt = now;
129
+ });
130
+ prevSweep = turn;
131
+ draw(now);
132
+ raf = visible && !document.hidden ? requestAnimationFrame(tick) : 0;
133
+ };
134
+ const start = () => {
135
+ if (raf || reduced || !visible || document.hidden) return;
136
+ last = performance.now();
137
+ raf = requestAnimationFrame(tick);
138
+ };
139
+ const resize = new ResizeObserver(() => {
140
+ fit();
141
+ draw(performance.now());
142
+ });
143
+ resize.observe(canvas);
144
+ const observer = new IntersectionObserver(([entry]) => {
145
+ visible = entry.isIntersecting;
146
+ start();
147
+ });
148
+ observer.observe(canvas);
149
+ document.addEventListener("visibilitychange", start);
150
+ fit();
151
+ draw(performance.now());
152
+ start();
153
+ return () => {
154
+ cancelAnimationFrame(raf);
155
+ resize.disconnect();
156
+ observer.disconnect();
157
+ document.removeEventListener("visibilitychange", start);
158
+ };
159
+ }, [mode, blipKey, period, trail, rings, gridSize, pixelSize, color, blipColor, gridColor, backgroundColor]);
160
+ return /* @__PURE__ */ jsx("canvas", { ref: canvasRef, "aria-hidden": "true", className, style: { display: "block", width: "100%", height: "100%", background: backgroundColor, ...style } });
161
+ }
162
+ export {
163
+ ScanScope as default
164
+ };
@@ -0,0 +1,32 @@
1
+ import { type CSSProperties } from 'react';
2
+ export interface ScoreTickerProps {
3
+ /** The score; drums roll forward to it, decreases roll back. */
4
+ value?: number;
5
+ /** Zero-padded width; caps at all nines. */
6
+ digits?: number;
7
+ label?: string;
8
+ /** Shows HI, and beating it flashes NEW HIGH SCORE. */
9
+ highScore?: number;
10
+ /** Above 1, gain popups add "×N COMBO". */
11
+ combo?: number;
12
+ showPopups?: boolean;
13
+ /** Smallest gain that shakes the panel. */
14
+ shakeAt?: number;
15
+ /** Roll time in ms. */
16
+ duration?: number;
17
+ /** Digit size in px. */
18
+ size?: number;
19
+ textColor?: string;
20
+ dimColor?: string;
21
+ mutedColor?: string;
22
+ panelColor?: string;
23
+ edgeColor?: string;
24
+ drumColor?: string;
25
+ accentColor?: string;
26
+ comboColor?: string;
27
+ highColor?: string;
28
+ fontFamily?: string;
29
+ className?: string;
30
+ style?: CSSProperties;
31
+ }
32
+ export default function ScoreTicker({ value, digits, label, highScore, combo, showPopups, shakeAt, duration, size, textColor, dimColor, mutedColor, panelColor, edgeColor, drumColor, accentColor, comboColor, highColor, fontFamily, className, style }: ScoreTickerProps): import("react").JSX.Element;