bits-lab 0.0.0-stage → 0.1.0

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 +51 -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 +34 -4
@@ -0,0 +1,142 @@
1
+ 'use client';
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import { useEffect, useInsertionEffect, useRef, useState } from "react";
4
+ const STYLE_ID = "bl-pixel-loader";
5
+ const CSS = `
6
+ .bl-loader { display: grid; justify-items: center; gap: 18px; width: min(var(--bl-width), 100%); color: var(--bl-text); font-family: var(--bl-font, "Press Start 2P", ui-monospace, monospace); text-transform: uppercase; }
7
+ .bl-loader__title { display: flex; align-items: center; gap: 14px; font-size: 14px; }
8
+ .bl-loader__spinner { position: relative; width: 24px; height: 24px; animation: bl-loader-spin 0.8s steps(8) infinite; }
9
+ .bl-loader__spinner i { position: absolute; left: 10px; top: 0; width: 4px; height: 4px; background: var(--bl-accent); transform-origin: 2px 12px; }
10
+ .bl-loader__bar { display: grid; grid-template-columns: repeat(var(--bl-chunks), 1fr); gap: 3px; width: 100%; padding: 6px; background: #0b0b14; box-shadow: 0 0 0 3px var(--bl-frame); }
11
+ .bl-loader__chunk { height: 18px; background: #1a1c2c; }
12
+ .bl-loader__chunk[data-on] { background: var(--bl-accent); box-shadow: inset 0 -5px 0 0 rgba(0, 0, 0, 0.22), inset 0 4px 0 0 rgba(255, 255, 255, 0.25); }
13
+ .bl-loader__chunk[data-new] { animation: bl-loader-pop 160ms steps(2); }
14
+ .bl-loader__meta { display: flex; justify-content: space-between; width: 100%; font-size: 9px; color: var(--bl-muted); }
15
+ .bl-loader__tip { min-height: 3em; max-width: 46ch; font-family: var(--bl-tip-font, ui-monospace, monospace); font-size: 14px; line-height: 1.5; text-transform: none; text-align: center; color: var(--bl-muted); }
16
+ .bl-loader[data-done] .bl-loader__title { animation: bl-loader-flash 120ms steps(1) 6; color: var(--bl-accent); }
17
+ @keyframes bl-loader-spin { to { transform: rotate(360deg); } }
18
+ @keyframes bl-loader-pop { 50% { filter: brightness(1.8); transform: scaleY(1.2); } }
19
+ @keyframes bl-loader-flash { 50% { opacity: 0; } }
20
+ @media (prefers-reduced-motion: reduce) {
21
+ .bl-loader__spinner, .bl-loader__chunk[data-new], .bl-loader[data-done] .bl-loader__title { animation: none; }
22
+ }
23
+ `;
24
+ function useStyles() {
25
+ useInsertionEffect(() => {
26
+ if (typeof document === "undefined") return;
27
+ const style = document.getElementById(STYLE_ID) ?? Object.assign(document.createElement("style"), { id: STYLE_ID });
28
+ style.textContent = CSS;
29
+ if (!style.isConnected) document.head.appendChild(style);
30
+ }, []);
31
+ }
32
+ const DEFAULT_TIPS = [
33
+ "Tip: torches keep the dark at bay.",
34
+ "Tip: you can stack up to 64 blocks in one slot.",
35
+ "Tip: save before you cross the lava.",
36
+ "Tip: night falls faster in the desert."
37
+ ];
38
+ function PixelLoader({
39
+ progress,
40
+ label = "Loading",
41
+ doneLabel = "Complete!",
42
+ tips = DEFAULT_TIPS,
43
+ tipInterval = 3200,
44
+ chunks = 20,
45
+ width = 440,
46
+ accentColor = "#a7f070",
47
+ frameColor = "#566c86",
48
+ textColor = "#f4f4f4",
49
+ mutedColor = "#94b0c2",
50
+ simulateDuration = 6e3,
51
+ loop = true,
52
+ showPercent = true,
53
+ fontFamily,
54
+ onComplete,
55
+ className = "",
56
+ style
57
+ }) {
58
+ useStyles();
59
+ const controlled = typeof progress === "number";
60
+ const [simulated, setSimulated] = useState(0);
61
+ const [tipIndex, setTipIndex] = useState(0);
62
+ const lastChunks = useRef(0);
63
+ const value = Math.min(100, Math.max(0, controlled ? progress : simulated));
64
+ const done = value >= 100;
65
+ useEffect(() => {
66
+ if (controlled) return void 0;
67
+ let timer;
68
+ const tick = () => {
69
+ setSimulated((current) => current >= 100 ? 100 : Math.min(100, current + Math.random() * (1600 / simulateDuration) * 12));
70
+ timer = setTimeout(tick, 120 + Math.random() * 260);
71
+ };
72
+ timer = setTimeout(tick, 300);
73
+ return () => clearTimeout(timer);
74
+ }, [controlled, simulateDuration]);
75
+ useEffect(() => {
76
+ if (controlled || !loop || !done) return void 0;
77
+ const timer = setTimeout(() => setSimulated(0), 1800);
78
+ return () => clearTimeout(timer);
79
+ }, [controlled, loop, done]);
80
+ useEffect(() => {
81
+ if (done) onComplete?.();
82
+ }, [done, onComplete]);
83
+ useEffect(() => {
84
+ if (tips.length < 2) return void 0;
85
+ const timer = setInterval(() => setTipIndex((index) => (index + 1) % tips.length), tipInterval);
86
+ return () => clearInterval(timer);
87
+ }, [tips.length, tipInterval]);
88
+ const filled = Math.round(value / 100 * chunks);
89
+ const previous = lastChunks.current;
90
+ lastChunks.current = filled;
91
+ return /* @__PURE__ */ jsxs(
92
+ "div",
93
+ {
94
+ className: `bl-loader ${className}`,
95
+ "data-done": done || void 0,
96
+ style: {
97
+ "--bl-width": `${width}px`,
98
+ "--bl-accent": accentColor,
99
+ "--bl-frame": frameColor,
100
+ "--bl-text": textColor,
101
+ "--bl-muted": mutedColor,
102
+ "--bl-chunks": chunks,
103
+ ...fontFamily ? { "--bl-font": fontFamily } : null,
104
+ ...style
105
+ },
106
+ children: [
107
+ /* @__PURE__ */ jsxs("div", { className: "bl-loader__title", "aria-hidden": "true", children: [
108
+ !done && /* @__PURE__ */ jsx("span", { className: "bl-loader__spinner", children: Array.from({ length: 8 }, (_, i) => /* @__PURE__ */ jsx("i", { style: { transform: `rotate(${i * 45}deg)`, opacity: 0.25 + i / 8 * 0.75 } }, i)) }),
109
+ /* @__PURE__ */ jsx("span", { children: done ? doneLabel : `${label}\u2026` })
110
+ ] }),
111
+ /* @__PURE__ */ jsx(
112
+ "div",
113
+ {
114
+ className: "bl-loader__bar",
115
+ role: "progressbar",
116
+ "aria-label": label,
117
+ "aria-valuemin": 0,
118
+ "aria-valuemax": 100,
119
+ "aria-valuenow": Math.round(value),
120
+ children: Array.from({ length: chunks }, (_, i) => /* @__PURE__ */ jsx("span", { className: "bl-loader__chunk", "data-on": i < filled || void 0, "data-new": i < filled && i >= previous || void 0 }, i))
121
+ }
122
+ ),
123
+ showPercent && /* @__PURE__ */ jsxs("div", { className: "bl-loader__meta", "aria-hidden": "true", children: [
124
+ /* @__PURE__ */ jsxs("span", { children: [
125
+ Math.round(value),
126
+ "%"
127
+ ] }),
128
+ /* @__PURE__ */ jsxs("span", { children: [
129
+ filled,
130
+ "/",
131
+ chunks,
132
+ " chunks"
133
+ ] })
134
+ ] }),
135
+ tips.length > 0 && /* @__PURE__ */ jsx("p", { className: "bl-loader__tip", "aria-live": "polite", children: tips[tipIndex % tips.length] })
136
+ ]
137
+ }
138
+ );
139
+ }
140
+ export {
141
+ PixelLoader as default
142
+ };
@@ -0,0 +1,41 @@
1
+ import { type CSSProperties, type ReactNode } from 'react';
2
+ export interface ParallaxLayer {
3
+ /** Horizontally tiling image, drawn at the layer's full height. */
4
+ src?: string;
5
+ /** 0 stays fixed, 1 moves the most. Defaults to the layer's position in the list. */
6
+ depth?: number;
7
+ /** Distance from the bottom (px or any CSS length). */
8
+ bottom?: number | string;
9
+ /** Layer height (px or any CSS length); defaults to the full scene. */
10
+ height?: number | string;
11
+ opacity?: number;
12
+ /** Custom content that moves with the layer. */
13
+ node?: ReactNode;
14
+ }
15
+ export interface PixelParallaxProps {
16
+ /** Back to front. */
17
+ layers?: ParallaxLayer[];
18
+ /** Scene height, in px. */
19
+ height?: number;
20
+ /** Pan forever, follow the pointer, or move with the page scroll. */
21
+ mode?: 'auto' | 'mouse' | 'scroll';
22
+ /** Auto mode speed, in px per second for depth 1. */
23
+ speed?: number;
24
+ /** Mouse and scroll mode range, in px. */
25
+ intensity?: number;
26
+ /** Offsets snap to multiples of this, keeping pixel art crisp. */
27
+ pixelSize?: number;
28
+ /** Custom sky background (any CSS background). */
29
+ sky?: string;
30
+ /** Cycle the sky and a color tint through day, dusk and night. */
31
+ dayNight?: boolean;
32
+ /** Length of a full day, in seconds. */
33
+ cycleDuration?: number;
34
+ /** Accessible description of the scene. */
35
+ label?: string;
36
+ /** Centered content over the scene. */
37
+ children?: ReactNode;
38
+ className?: string;
39
+ style?: CSSProperties;
40
+ }
41
+ export default function PixelParallax({ layers, height, mode, speed, intensity, pixelSize, sky, dayNight, cycleDuration, label, children, className, style }: PixelParallaxProps): import("react").JSX.Element;
@@ -0,0 +1,151 @@
1
+ 'use client';
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import { useEffect, useRef } from "react";
4
+ const SKY = {
5
+ day: ["#41a6f6", "#73eff7"],
6
+ dusk: ["#5d275d", "#ef7d57"],
7
+ night: ["#0b0b14", "#29366f"]
8
+ };
9
+ const TINT = { day: "rgba(0,0,0,0)", dusk: "rgba(177,62,83,0.28)", night: "rgba(11,11,40,0.55)" };
10
+ const lerp = (a, b, t) => a + (b - a) * t;
11
+ const hexToRgb = (hex) => [1, 3, 5].map((i) => parseInt(hex.slice(i, i + 2), 16));
12
+ const mixHex = (a, b, t) => `rgb(${hexToRgb(a).map((v, i) => Math.round(lerp(v, hexToRgb(b)[i], t))).join(",")})`;
13
+ const parseRgba = (value) => value.match(/[\d.]+/g).map(Number);
14
+ const mixRgba = (a, b, t) => {
15
+ const [r1, g1, b1, a1] = parseRgba(a);
16
+ const [r2, g2, b2, a2] = parseRgba(b);
17
+ return `rgba(${Math.round(lerp(r1, r2, t))},${Math.round(lerp(g1, g2, t))},${Math.round(lerp(b1, b2, t))},${lerp(a1, a2, t).toFixed(3)})`;
18
+ };
19
+ function phaseAt(t) {
20
+ const p = (t % 1 + 1) % 1 * 4;
21
+ const stops = ["day", "dusk", "night", "dusk", "day"];
22
+ const i = Math.floor(p);
23
+ return { from: stops[i], to: stops[i + 1], t: p - i };
24
+ }
25
+ function PixelParallax({
26
+ layers = [],
27
+ height = 360,
28
+ mode = "auto",
29
+ speed = 40,
30
+ intensity = 60,
31
+ pixelSize = 4,
32
+ sky,
33
+ dayNight = false,
34
+ cycleDuration = 24,
35
+ label = "Pixel landscape",
36
+ children,
37
+ className = "",
38
+ style
39
+ }) {
40
+ const rootRef = useRef(null);
41
+ const layerRefs = useRef([]);
42
+ const skyRef = useRef(null);
43
+ const tintRef = useRef(null);
44
+ useEffect(() => {
45
+ const root = rootRef.current;
46
+ if (!root) return void 0;
47
+ const reduced = window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;
48
+ const pointer = { x: 0.5, y: 0.5, tx: 0.5, ty: 0.5 };
49
+ let visible = true;
50
+ const observer = new IntersectionObserver(([entry]) => {
51
+ visible = entry.isIntersecting;
52
+ });
53
+ observer.observe(root);
54
+ const onMove = (event) => {
55
+ const rect = root.getBoundingClientRect();
56
+ pointer.tx = Math.min(1, Math.max(0, (event.clientX - rect.left) / rect.width));
57
+ pointer.ty = Math.min(1, Math.max(0, (event.clientY - rect.top) / rect.height));
58
+ };
59
+ if (mode === "mouse") window.addEventListener("pointermove", onMove);
60
+ const snap = (value) => Math.round(value / pixelSize) * pixelSize;
61
+ let frame = 0;
62
+ const start = performance.now();
63
+ const render = (now) => {
64
+ const elapsed = (now - start) / 1e3;
65
+ if (visible) {
66
+ pointer.x += (pointer.tx - pointer.x) * 0.08;
67
+ pointer.y += (pointer.ty - pointer.y) * 0.08;
68
+ const rect = root.getBoundingClientRect();
69
+ const scrollProgress = (window.innerHeight - rect.top) / (window.innerHeight + rect.height) - 0.5;
70
+ layers.forEach((layer, index) => {
71
+ const el = layerRefs.current[index];
72
+ if (!el) return;
73
+ const depth = layer.depth ?? index / Math.max(1, layers.length - 1);
74
+ let x = 0;
75
+ let y = 0;
76
+ if (!reduced) {
77
+ if (mode === "auto") x = -elapsed * speed * depth;
78
+ if (mode === "mouse") {
79
+ x = (0.5 - pointer.x) * intensity * depth;
80
+ y = (0.5 - pointer.y) * intensity * 0.25 * depth;
81
+ }
82
+ if (mode === "scroll") y = scrollProgress * intensity * 2 * depth;
83
+ }
84
+ el.style.backgroundPosition = `${snap(x)}px ${snap(y)}px`;
85
+ if (layer.node) el.style.transform = `translate(${snap(x)}px, ${snap(y)}px)`;
86
+ });
87
+ if (dayNight && skyRef.current && tintRef.current) {
88
+ const { from, to, t } = phaseAt(reduced ? 0 : elapsed / cycleDuration);
89
+ skyRef.current.style.background = `linear-gradient(to bottom, ${mixHex(SKY[from][0], SKY[to][0], t)}, ${mixHex(SKY[from][1], SKY[to][1], t)})`;
90
+ tintRef.current.style.background = mixRgba(TINT[from], TINT[to], t);
91
+ }
92
+ }
93
+ frame = requestAnimationFrame(render);
94
+ };
95
+ frame = requestAnimationFrame(render);
96
+ return () => {
97
+ cancelAnimationFrame(frame);
98
+ observer.disconnect();
99
+ window.removeEventListener("pointermove", onMove);
100
+ };
101
+ }, [layers, mode, speed, intensity, pixelSize, dayNight, cycleDuration]);
102
+ return /* @__PURE__ */ jsxs(
103
+ "div",
104
+ {
105
+ ref: rootRef,
106
+ role: "img",
107
+ "aria-label": label,
108
+ className,
109
+ style: { position: "relative", width: "100%", height, overflow: "hidden", imageRendering: "pixelated", ...style },
110
+ children: [
111
+ /* @__PURE__ */ jsx(
112
+ "div",
113
+ {
114
+ ref: skyRef,
115
+ "aria-hidden": "true",
116
+ style: { position: "absolute", inset: 0, background: sky ?? `linear-gradient(to bottom, ${SKY.day[0]}, ${SKY.day[1]})` }
117
+ }
118
+ ),
119
+ layers.map((layer, index) => /* @__PURE__ */ jsx(
120
+ "div",
121
+ {
122
+ ref: (el) => {
123
+ layerRefs.current[index] = el;
124
+ },
125
+ "aria-hidden": "true",
126
+ style: {
127
+ position: "absolute",
128
+ left: 0,
129
+ right: 0,
130
+ bottom: layer.bottom ?? 0,
131
+ height: layer.height ?? "100%",
132
+ backgroundImage: layer.src ? `url(${layer.src})` : void 0,
133
+ backgroundRepeat: "repeat-x",
134
+ backgroundSize: "auto 100%",
135
+ backgroundPosition: "0 0",
136
+ imageRendering: "pixelated",
137
+ opacity: layer.opacity ?? 1
138
+ },
139
+ children: layer.node
140
+ },
141
+ index
142
+ )),
143
+ dayNight && /* @__PURE__ */ jsx("div", { ref: tintRef, "aria-hidden": "true", style: { position: "absolute", inset: 0, mixBlendMode: "multiply", pointerEvents: "none" } }),
144
+ children && /* @__PURE__ */ jsx("div", { style: { position: "absolute", inset: 0, display: "grid", placeItems: "center" }, children })
145
+ ]
146
+ }
147
+ );
148
+ }
149
+ export {
150
+ PixelParallax as default
151
+ };
@@ -0,0 +1,21 @@
1
+ import { type CSSProperties } from 'react';
2
+ export interface PixelSpinnersProps {
3
+ type?: 'blocks' | 'bar' | 'dots' | 'hourglass' | 'orbit';
4
+ /** Announced to screen readers (and shown with showLabel). */
5
+ label?: string;
6
+ showLabel?: boolean;
7
+ /** Pixel size. */
8
+ cell?: number;
9
+ gap?: number;
10
+ /** Seconds per cycle. */
11
+ speed?: number;
12
+ /** Lit pixels. */
13
+ color?: string;
14
+ /** Unlit pixels. */
15
+ dimColor?: string;
16
+ mutedColor?: string;
17
+ fontFamily?: string;
18
+ className?: string;
19
+ style?: CSSProperties;
20
+ }
21
+ export default function PixelSpinners({ type, label, showLabel, cell, gap, speed, color, dimColor, mutedColor, fontFamily, className, style }: PixelSpinnersProps): import("react").JSX.Element;
@@ -0,0 +1,110 @@
1
+ 'use client';
2
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
+ import { useInsertionEffect } from "react";
4
+ const STYLE_ID = "bl-pixel-spinners";
5
+ const CSS = `
6
+ .bl-spin { display: inline-grid; gap: 8px; justify-items: center; color: var(--bl-on); font-family: var(--bl-font); font-size: 12px; }
7
+ .bl-spin__art { position: relative; display: grid; gap: var(--bl-gap); }
8
+ .bl-spin__px { width: var(--bl-cell); height: var(--bl-cell); background: var(--bl-off); }
9
+ .bl-spin__label { color: var(--bl-muted); }
10
+ .bl-spin__sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
11
+
12
+ /* blocks: a 3\xD73 grid, the ring of eight lights up in turn */
13
+ .bl-spin[data-type="blocks"] .bl-spin__art { grid-template-columns: repeat(3, var(--bl-cell)); }
14
+ .bl-spin[data-type="blocks"] .bl-spin__px[data-ring] { animation: bl-spin-chase var(--bl-speed) steps(1) infinite; animation-delay: calc(var(--i) * var(--bl-speed) / 8 - var(--bl-speed)); }
15
+
16
+ /* bar: a row of eight, the bright one bounces */
17
+ .bl-spin[data-type="bar"] .bl-spin__art { grid-auto-flow: column; }
18
+ .bl-spin__runner { position: absolute; top: 0; left: 0; width: var(--bl-cell); height: var(--bl-cell); background: var(--bl-on); animation: bl-spin-run calc(var(--bl-speed) / 2) steps(7) infinite alternate; }
19
+
20
+ /* dots: three hop in turn */
21
+ .bl-spin[data-type="dots"] .bl-spin__art { grid-auto-flow: column; align-items: end; height: calc(var(--bl-cell) * 3); }
22
+ .bl-spin[data-type="dots"] .bl-spin__px { background: var(--bl-on); animation: bl-spin-hop var(--bl-speed) steps(4) infinite; animation-delay: calc(var(--i) * var(--bl-speed) / 6); }
23
+
24
+ /* hourglass: drains top to bottom, then flips */
25
+ .bl-spin[data-type="hourglass"] .bl-spin__art { animation: bl-spin-flip var(--bl-speed) steps(1) infinite; }
26
+ .bl-spin[data-type="hourglass"] svg { display: block; width: calc(var(--bl-cell) * 7); height: calc(var(--bl-cell) * 9); shape-rendering: crispEdges; }
27
+ .bl-spin__glass { fill: var(--bl-off); }
28
+ .bl-spin__sand-top { fill: var(--bl-on); animation: bl-spin-drain var(--bl-speed) steps(4) infinite; transform-origin: 50% 44%; }
29
+ .bl-spin__sand-bottom { fill: var(--bl-on); animation: bl-spin-fill var(--bl-speed) steps(4) infinite; transform-origin: 50% 100%; }
30
+
31
+ /* orbit: four pixels round a centre */
32
+ .bl-spin[data-type="orbit"] .bl-spin__art { width: calc(var(--bl-cell) * 5); height: calc(var(--bl-cell) * 5); animation: bl-spin-turn var(--bl-speed) steps(8) infinite; }
33
+ .bl-spin[data-type="orbit"] .bl-spin__px { position: absolute; background: var(--bl-on); }
34
+ .bl-spin[data-type="orbit"] .bl-spin__px:nth-child(1) { left: calc(var(--bl-cell) * 2); top: 0; }
35
+ .bl-spin[data-type="orbit"] .bl-spin__px:nth-child(2) { right: 0; top: calc(var(--bl-cell) * 2); opacity: 0.75; }
36
+ .bl-spin[data-type="orbit"] .bl-spin__px:nth-child(3) { left: calc(var(--bl-cell) * 2); bottom: 0; opacity: 0.5; }
37
+ .bl-spin[data-type="orbit"] .bl-spin__px:nth-child(4) { left: 0; top: calc(var(--bl-cell) * 2); opacity: 0.25; }
38
+
39
+ @keyframes bl-spin-chase { 0%, 12% { background: var(--bl-on); } 13%, 100% { background: var(--bl-off); } }
40
+ @keyframes bl-spin-run { to { transform: translateX(calc((var(--bl-cell) + var(--bl-gap)) * 7)); } }
41
+ @keyframes bl-spin-hop { 0%, 60%, 100% { transform: none; } 30% { transform: translateY(calc(var(--bl-cell) * -2)); } }
42
+ @keyframes bl-spin-drain { from { transform: scaleY(1); } to { transform: scaleY(0); } }
43
+ @keyframes bl-spin-fill { from { transform: scaleY(0); } to { transform: scaleY(1); } }
44
+ @keyframes bl-spin-flip { 0%, 92% { transform: none; } 93%, 100% { transform: rotate(180deg); } }
45
+ @keyframes bl-spin-turn { to { transform: rotate(360deg); } }
46
+ @keyframes bl-spin-glow { 50% { opacity: 0.45; } }
47
+ @media (prefers-reduced-motion: reduce) { .bl-spin .bl-spin__art, .bl-spin .bl-spin__px, .bl-spin .bl-spin__sand-top, .bl-spin .bl-spin__sand-bottom { animation: none !important; } .bl-spin .bl-spin__runner { animation: none !important; } .bl-spin .bl-spin__art { animation: bl-spin-glow 2.4s ease-in-out infinite !important; } }
48
+ `;
49
+ function useStyles() {
50
+ useInsertionEffect(() => {
51
+ if (typeof document === "undefined") return;
52
+ const style = document.getElementById(STYLE_ID) ?? Object.assign(document.createElement("style"), { id: STYLE_ID });
53
+ style.textContent = CSS;
54
+ if (!style.isConnected) document.head.appendChild(style);
55
+ }, []);
56
+ }
57
+ const RING = [0, 1, 2, 5, 8, 7, 6, 3];
58
+ function Art({ type }) {
59
+ if (type === "blocks") {
60
+ return Array.from({ length: 9 }, (_, cell) => {
61
+ const i = RING.indexOf(cell);
62
+ return /* @__PURE__ */ jsx("span", { className: "bl-spin__px", "data-ring": i >= 0 || void 0, style: { "--i": i } }, cell);
63
+ });
64
+ }
65
+ if (type === "bar") {
66
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
67
+ Array.from({ length: 8 }, (_, i) => /* @__PURE__ */ jsx("span", { className: "bl-spin__px" }, i)),
68
+ /* @__PURE__ */ jsx("span", { className: "bl-spin__runner" })
69
+ ] });
70
+ }
71
+ if (type === "dots") return Array.from({ length: 3 }, (_, i) => /* @__PURE__ */ jsx("span", { className: "bl-spin__px", style: { "--i": i } }, i));
72
+ if (type === "orbit") return Array.from({ length: 4 }, (_, i) => /* @__PURE__ */ jsx("span", { className: "bl-spin__px" }, i));
73
+ return /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 7 9", "aria-hidden": "true", children: [
74
+ /* @__PURE__ */ jsx("path", { className: "bl-spin__glass", d: "M0 0h7v1h-1v2h-1v1h-1v1h1v1h1v2h1v1H0V8h1V6h1V5h1V4H2V3H1V1H0z" }),
75
+ /* @__PURE__ */ jsx("rect", { className: "bl-spin__sand-top", x: "2", y: "1", width: "3", height: "3" }),
76
+ /* @__PURE__ */ jsx("rect", { className: "bl-spin__sand-bottom", x: "1", y: "6", width: "5", height: "2" })
77
+ ] });
78
+ }
79
+ function PixelSpinners({
80
+ type = "blocks",
81
+ label = "Loading",
82
+ showLabel = false,
83
+ cell = 6,
84
+ gap = 2,
85
+ speed = 1.2,
86
+ color = "#73eff7",
87
+ dimColor = "#333c57",
88
+ mutedColor = "#94b0c2",
89
+ fontFamily = "inherit",
90
+ className = "",
91
+ style
92
+ }) {
93
+ useStyles();
94
+ return /* @__PURE__ */ jsxs(
95
+ "span",
96
+ {
97
+ className: `bl-spin ${className}`,
98
+ role: "status",
99
+ "data-type": type,
100
+ style: { "--bl-cell": `${cell}px`, "--bl-gap": `${gap}px`, "--bl-speed": `${speed}s`, "--bl-on": color, "--bl-off": dimColor, "--bl-muted": mutedColor, "--bl-font": fontFamily, ...style },
101
+ children: [
102
+ /* @__PURE__ */ jsx("span", { className: "bl-spin__art", "aria-hidden": "true", children: /* @__PURE__ */ jsx(Art, { type }) }),
103
+ showLabel ? /* @__PURE__ */ jsx("span", { className: "bl-spin__label", children: label }) : /* @__PURE__ */ jsx("span", { className: "bl-spin__sr", children: label })
104
+ ]
105
+ }
106
+ );
107
+ }
108
+ export {
109
+ PixelSpinners as default
110
+ };
@@ -0,0 +1,26 @@
1
+ import { type CSSProperties } from 'react';
2
+ export interface PixelTypeProps {
3
+ text?: string;
4
+ /** Fly in once, or hold, crumble and rebuild on a loop. */
5
+ effect?: 'assemble' | 'crumble';
6
+ /** Block size in px. */
7
+ pixelSize?: number;
8
+ gap?: number;
9
+ /** CSS font family the text is rasterised with. */
10
+ font?: string;
11
+ /** How many pixel rows tall the text is rasterised. */
12
+ rows?: number;
13
+ /** Colour bands from top to bottom. */
14
+ colors?: string[];
15
+ /** How far the pointer scatters blocks, in px. */
16
+ repel?: number;
17
+ stiffness?: number;
18
+ damping?: number;
19
+ /** Crumble: how long the word holds, in ms. */
20
+ hold?: number;
21
+ trigger?: 'view' | 'mount';
22
+ align?: 'center' | 'start' | 'end';
23
+ className?: string;
24
+ style?: CSSProperties;
25
+ }
26
+ export default function PixelType({ text, effect, pixelSize, gap, font, rows, colors, repel, stiffness, damping, hold, trigger, align, className, style }: PixelTypeProps): import("react").JSX.Element;