@opencode-ai/ui 0.0.0-beta-202606251302

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 (346) hide show
  1. package/LICENSE +21 -0
  2. package/package.json +110 -0
  3. package/src/assets/audio/alert-01.aac +0 -0
  4. package/src/assets/audio/alert-01.mp3 +0 -0
  5. package/src/assets/audio/alert-02.aac +0 -0
  6. package/src/assets/audio/alert-02.mp3 +0 -0
  7. package/src/assets/audio/alert-03.aac +0 -0
  8. package/src/assets/audio/alert-03.mp3 +0 -0
  9. package/src/assets/audio/alert-04.aac +0 -0
  10. package/src/assets/audio/alert-04.mp3 +0 -0
  11. package/src/assets/audio/alert-05.aac +0 -0
  12. package/src/assets/audio/alert-05.mp3 +0 -0
  13. package/src/assets/audio/alert-06.aac +0 -0
  14. package/src/assets/audio/alert-06.mp3 +0 -0
  15. package/src/assets/audio/alert-07.aac +0 -0
  16. package/src/assets/audio/alert-07.mp3 +0 -0
  17. package/src/assets/audio/alert-08.aac +0 -0
  18. package/src/assets/audio/alert-08.mp3 +0 -0
  19. package/src/assets/audio/alert-09.aac +0 -0
  20. package/src/assets/audio/alert-09.mp3 +0 -0
  21. package/src/assets/audio/alert-10.aac +0 -0
  22. package/src/assets/audio/alert-10.mp3 +0 -0
  23. package/src/assets/audio/bip-bop-01.aac +0 -0
  24. package/src/assets/audio/bip-bop-01.mp3 +0 -0
  25. package/src/assets/audio/bip-bop-02.aac +0 -0
  26. package/src/assets/audio/bip-bop-02.mp3 +0 -0
  27. package/src/assets/audio/bip-bop-03.aac +0 -0
  28. package/src/assets/audio/bip-bop-03.mp3 +0 -0
  29. package/src/assets/audio/bip-bop-04.aac +0 -0
  30. package/src/assets/audio/bip-bop-04.mp3 +0 -0
  31. package/src/assets/audio/bip-bop-05.aac +0 -0
  32. package/src/assets/audio/bip-bop-05.mp3 +0 -0
  33. package/src/assets/audio/bip-bop-06.aac +0 -0
  34. package/src/assets/audio/bip-bop-06.mp3 +0 -0
  35. package/src/assets/audio/bip-bop-07.aac +0 -0
  36. package/src/assets/audio/bip-bop-07.mp3 +0 -0
  37. package/src/assets/audio/bip-bop-08.aac +0 -0
  38. package/src/assets/audio/bip-bop-08.mp3 +0 -0
  39. package/src/assets/audio/bip-bop-09.aac +0 -0
  40. package/src/assets/audio/bip-bop-09.mp3 +0 -0
  41. package/src/assets/audio/bip-bop-10.aac +0 -0
  42. package/src/assets/audio/bip-bop-10.mp3 +0 -0
  43. package/src/assets/audio/nope-01.aac +0 -0
  44. package/src/assets/audio/nope-01.mp3 +0 -0
  45. package/src/assets/audio/nope-02.aac +0 -0
  46. package/src/assets/audio/nope-02.mp3 +0 -0
  47. package/src/assets/audio/nope-03.aac +0 -0
  48. package/src/assets/audio/nope-03.mp3 +0 -0
  49. package/src/assets/audio/nope-04.aac +0 -0
  50. package/src/assets/audio/nope-04.mp3 +0 -0
  51. package/src/assets/audio/nope-05.aac +0 -0
  52. package/src/assets/audio/nope-05.mp3 +0 -0
  53. package/src/assets/audio/nope-06.aac +0 -0
  54. package/src/assets/audio/nope-06.mp3 +0 -0
  55. package/src/assets/audio/nope-07.aac +0 -0
  56. package/src/assets/audio/nope-07.mp3 +0 -0
  57. package/src/assets/audio/nope-08.aac +0 -0
  58. package/src/assets/audio/nope-08.mp3 +0 -0
  59. package/src/assets/audio/nope-09.aac +0 -0
  60. package/src/assets/audio/nope-09.mp3 +0 -0
  61. package/src/assets/audio/nope-10.aac +0 -0
  62. package/src/assets/audio/nope-10.mp3 +0 -0
  63. package/src/assets/audio/nope-11.aac +0 -0
  64. package/src/assets/audio/nope-11.mp3 +0 -0
  65. package/src/assets/audio/nope-12.aac +0 -0
  66. package/src/assets/audio/nope-12.mp3 +0 -0
  67. package/src/assets/audio/staplebops-01.aac +0 -0
  68. package/src/assets/audio/staplebops-01.mp3 +0 -0
  69. package/src/assets/audio/staplebops-02.aac +0 -0
  70. package/src/assets/audio/staplebops-02.mp3 +0 -0
  71. package/src/assets/audio/staplebops-03.aac +0 -0
  72. package/src/assets/audio/staplebops-03.mp3 +0 -0
  73. package/src/assets/audio/staplebops-04.aac +0 -0
  74. package/src/assets/audio/staplebops-04.mp3 +0 -0
  75. package/src/assets/audio/staplebops-05.aac +0 -0
  76. package/src/assets/audio/staplebops-05.mp3 +0 -0
  77. package/src/assets/audio/staplebops-06.aac +0 -0
  78. package/src/assets/audio/staplebops-06.mp3 +0 -0
  79. package/src/assets/audio/staplebops-07.aac +0 -0
  80. package/src/assets/audio/staplebops-07.mp3 +0 -0
  81. package/src/assets/audio/yup-01.aac +0 -0
  82. package/src/assets/audio/yup-01.mp3 +0 -0
  83. package/src/assets/audio/yup-02.aac +0 -0
  84. package/src/assets/audio/yup-02.mp3 +0 -0
  85. package/src/assets/audio/yup-03.aac +0 -0
  86. package/src/assets/audio/yup-03.mp3 +0 -0
  87. package/src/assets/audio/yup-04.aac +0 -0
  88. package/src/assets/audio/yup-04.mp3 +0 -0
  89. package/src/assets/audio/yup-05.aac +0 -0
  90. package/src/assets/audio/yup-05.mp3 +0 -0
  91. package/src/assets/audio/yup-06.aac +0 -0
  92. package/src/assets/audio/yup-06.mp3 +0 -0
  93. package/src/assets/fonts/Inter.ttf +0 -0
  94. package/src/assets/fonts/JetBrainsMonoNerdFontMono-Regular.woff2 +0 -0
  95. package/src/assets/icons/app/android-studio.svg +369 -0
  96. package/src/assets/icons/app/antigravity.svg +97 -0
  97. package/src/assets/icons/app/cursor.svg +16 -0
  98. package/src/assets/icons/app/file-explorer.svg +20 -0
  99. package/src/assets/icons/app/finder.png +0 -0
  100. package/src/assets/icons/app/ghostty.svg +13 -0
  101. package/src/assets/icons/app/iterm2.svg +13 -0
  102. package/src/assets/icons/app/powershell.svg +14 -0
  103. package/src/assets/icons/app/sublimetext.svg +17 -0
  104. package/src/assets/icons/app/terminal.png +0 -0
  105. package/src/assets/icons/app/textmate.png +0 -0
  106. package/src/assets/icons/app/vscode.svg +39 -0
  107. package/src/assets/icons/app/warp.png +0 -0
  108. package/src/assets/icons/app/xcode.png +0 -0
  109. package/src/assets/icons/app/zed-dark.svg +15 -0
  110. package/src/assets/icons/app/zed.svg +15 -0
  111. package/src/components/accordion.css +123 -0
  112. package/src/components/accordion.tsx +92 -0
  113. package/src/components/animated-number.css +75 -0
  114. package/src/components/animated-number.tsx +109 -0
  115. package/src/components/app-icon.css +5 -0
  116. package/src/components/app-icon.tsx +85 -0
  117. package/src/components/app-icons/sprite.svg +114 -0
  118. package/src/components/app-icons/types.ts +21 -0
  119. package/src/components/avatar.css +49 -0
  120. package/src/components/avatar.tsx +55 -0
  121. package/src/components/button.css +194 -0
  122. package/src/components/button.tsx +33 -0
  123. package/src/components/card.css +94 -0
  124. package/src/components/card.tsx +123 -0
  125. package/src/components/checkbox.css +131 -0
  126. package/src/components/checkbox.tsx +43 -0
  127. package/src/components/collapsible.css +148 -0
  128. package/src/components/collapsible.tsx +48 -0
  129. package/src/components/context-menu.css +134 -0
  130. package/src/components/context-menu.tsx +308 -0
  131. package/src/components/dialog.css +181 -0
  132. package/src/components/dialog.tsx +72 -0
  133. package/src/components/diff-changes.css +42 -0
  134. package/src/components/diff-changes.tsx +115 -0
  135. package/src/components/dock-surface.css +23 -0
  136. package/src/components/dock-surface.tsx +54 -0
  137. package/src/components/dropdown-menu.css +135 -0
  138. package/src/components/dropdown-menu.tsx +308 -0
  139. package/src/components/favicon.tsx +13 -0
  140. package/src/components/file-icon.css +26 -0
  141. package/src/components/file-icon.tsx +588 -0
  142. package/src/components/file-icons/sprite.svg +11707 -0
  143. package/src/components/file-icons/types.ts +1095 -0
  144. package/src/components/font.tsx +1 -0
  145. package/src/components/hover-card.css +61 -0
  146. package/src/components/hover-card.tsx +32 -0
  147. package/src/components/icon-button.css +181 -0
  148. package/src/components/icon-button.tsx +29 -0
  149. package/src/components/icon.css +34 -0
  150. package/src/components/icon.tsx +169 -0
  151. package/src/components/image-preview.css +63 -0
  152. package/src/components/image-preview.tsx +32 -0
  153. package/src/components/inline-input.css +17 -0
  154. package/src/components/inline-input.tsx +22 -0
  155. package/src/components/keybind.css +18 -0
  156. package/src/components/keybind.tsx +20 -0
  157. package/src/components/list.css +331 -0
  158. package/src/components/list.tsx +394 -0
  159. package/src/components/logo.css +4 -0
  160. package/src/components/logo.tsx +62 -0
  161. package/src/components/motion-spring.tsx +58 -0
  162. package/src/components/popover.css +98 -0
  163. package/src/components/popover.tsx +153 -0
  164. package/src/components/progress-circle.css +12 -0
  165. package/src/components/progress-circle.tsx +57 -0
  166. package/src/components/progress.css +63 -0
  167. package/src/components/progress.tsx +39 -0
  168. package/src/components/provider-icon.css +5 -0
  169. package/src/components/provider-icon.tsx +25 -0
  170. package/src/components/provider-icons/sprite.svg +1135 -0
  171. package/src/components/provider-icons/types.ts +105 -0
  172. package/src/components/radio-group.css +187 -0
  173. package/src/components/radio-group.tsx +83 -0
  174. package/src/components/resize-handle.css +58 -0
  175. package/src/components/resize-handle.tsx +82 -0
  176. package/src/components/scroll-view.css +66 -0
  177. package/src/components/scroll-view.tsx +250 -0
  178. package/src/components/select.css +202 -0
  179. package/src/components/select.tsx +174 -0
  180. package/src/components/spinner.css +6 -0
  181. package/src/components/spinner.tsx +52 -0
  182. package/src/components/sticky-accordion-header.css +6 -0
  183. package/src/components/sticky-accordion-header.tsx +18 -0
  184. package/src/components/switch.css +132 -0
  185. package/src/components/switch.tsx +29 -0
  186. package/src/components/tabs.css +635 -0
  187. package/src/components/tabs.tsx +125 -0
  188. package/src/components/tag.css +37 -0
  189. package/src/components/tag.tsx +22 -0
  190. package/src/components/text-field.css +134 -0
  191. package/src/components/text-field.tsx +128 -0
  192. package/src/components/text-reveal.css +150 -0
  193. package/src/components/text-reveal.tsx +143 -0
  194. package/src/components/text-shimmer.css +119 -0
  195. package/src/components/text-shimmer.tsx +62 -0
  196. package/src/components/text-strikethrough.css +27 -0
  197. package/src/components/text-strikethrough.tsx +84 -0
  198. package/src/components/toast.css +236 -0
  199. package/src/components/toast.tsx +185 -0
  200. package/src/components/tooltip.css +74 -0
  201. package/src/components/tooltip.tsx +161 -0
  202. package/src/components/typewriter.css +14 -0
  203. package/src/components/typewriter.tsx +55 -0
  204. package/src/context/dialog.tsx +197 -0
  205. package/src/context/file.tsx +10 -0
  206. package/src/context/helper.tsx +38 -0
  207. package/src/context/i18n.tsx +38 -0
  208. package/src/context/index.ts +4 -0
  209. package/src/context/marked.tsx +522 -0
  210. package/src/context/worker-pool.tsx +20 -0
  211. package/src/custom-elements.d.ts +17 -0
  212. package/src/hooks/create-auto-scroll.tsx +237 -0
  213. package/src/hooks/index.ts +2 -0
  214. package/src/hooks/use-filtered-list.tsx +134 -0
  215. package/src/i18n/ar.ts +168 -0
  216. package/src/i18n/br.ts +168 -0
  217. package/src/i18n/bs.ts +172 -0
  218. package/src/i18n/da.ts +167 -0
  219. package/src/i18n/de.ts +173 -0
  220. package/src/i18n/en.ts +176 -0
  221. package/src/i18n/es.ts +168 -0
  222. package/src/i18n/fr.ts +168 -0
  223. package/src/i18n/ja.ts +167 -0
  224. package/src/i18n/ko.ts +168 -0
  225. package/src/i18n/no.ts +171 -0
  226. package/src/i18n/pl.ts +167 -0
  227. package/src/i18n/ru.ts +167 -0
  228. package/src/i18n/th.ts +169 -0
  229. package/src/i18n/tr.ts +174 -0
  230. package/src/i18n/uk.ts +167 -0
  231. package/src/i18n/zh.ts +171 -0
  232. package/src/i18n/zht.ts +171 -0
  233. package/src/storybook/fixtures.ts +51 -0
  234. package/src/storybook/scaffold.tsx +62 -0
  235. package/src/styles/animations.css +141 -0
  236. package/src/styles/base.css +404 -0
  237. package/src/styles/colors.css +772 -0
  238. package/src/styles/index.css +53 -0
  239. package/src/styles/tailwind/colors.css +285 -0
  240. package/src/styles/tailwind/index.css +78 -0
  241. package/src/styles/tailwind/utilities.css +131 -0
  242. package/src/styles/theme.css +609 -0
  243. package/src/styles/utilities.css +118 -0
  244. package/src/theme/color.ts +299 -0
  245. package/src/theme/context.tsx +370 -0
  246. package/src/theme/default-themes.ts +116 -0
  247. package/src/theme/index.ts +78 -0
  248. package/src/theme/loader.ts +112 -0
  249. package/src/theme/resolve.ts +540 -0
  250. package/src/theme/themes/amoled.json +49 -0
  251. package/src/theme/themes/aura.json +51 -0
  252. package/src/theme/themes/ayu.json +51 -0
  253. package/src/theme/themes/carbonfox.json +53 -0
  254. package/src/theme/themes/catppuccin-frappe.json +85 -0
  255. package/src/theme/themes/catppuccin-macchiato.json +85 -0
  256. package/src/theme/themes/catppuccin.json +45 -0
  257. package/src/theme/themes/cobalt2.json +87 -0
  258. package/src/theme/themes/cursor.json +91 -0
  259. package/src/theme/themes/dracula.json +49 -0
  260. package/src/theme/themes/everforest.json +89 -0
  261. package/src/theme/themes/flexoki.json +86 -0
  262. package/src/theme/themes/github.json +85 -0
  263. package/src/theme/themes/gruvbox.json +45 -0
  264. package/src/theme/themes/kanagawa.json +89 -0
  265. package/src/theme/themes/lucent-orng.json +87 -0
  266. package/src/theme/themes/material.json +87 -0
  267. package/src/theme/themes/matrix.json +113 -0
  268. package/src/theme/themes/mercury.json +86 -0
  269. package/src/theme/themes/monokai.json +49 -0
  270. package/src/theme/themes/nightowl.json +46 -0
  271. package/src/theme/themes/nord.json +46 -0
  272. package/src/theme/themes/oc-2.json +468 -0
  273. package/src/theme/themes/one-dark.json +89 -0
  274. package/src/theme/themes/onedarkpro.json +45 -0
  275. package/src/theme/themes/opencode.json +89 -0
  276. package/src/theme/themes/orng.json +87 -0
  277. package/src/theme/themes/osaka-jade.json +88 -0
  278. package/src/theme/themes/palenight.json +85 -0
  279. package/src/theme/themes/rosepine.json +85 -0
  280. package/src/theme/themes/shadesofpurple.json +51 -0
  281. package/src/theme/themes/solarized.json +49 -0
  282. package/src/theme/themes/synthwave84.json +87 -0
  283. package/src/theme/themes/tokyonight.json +47 -0
  284. package/src/theme/themes/vercel.json +90 -0
  285. package/src/theme/themes/vesper.json +51 -0
  286. package/src/theme/themes/zenburn.json +87 -0
  287. package/src/theme/types.ts +75 -0
  288. package/src/theme/v2/avatar.ts +48 -0
  289. package/src/theme/v2/default-primitives.ts +114 -0
  290. package/src/theme/v2/foreground.ts +60 -0
  291. package/src/theme/v2/mapping.ts +138 -0
  292. package/src/theme/v2/resolve.ts +153 -0
  293. package/src/v2/components/accordion-v2.css +139 -0
  294. package/src/v2/components/accordion-v2.tsx +86 -0
  295. package/src/v2/components/avatar-v2.css +70 -0
  296. package/src/v2/components/avatar-v2.tsx +59 -0
  297. package/src/v2/components/badge-v2.css +27 -0
  298. package/src/v2/components/badge-v2.tsx +20 -0
  299. package/src/v2/components/button-v2.css +186 -0
  300. package/src/v2/components/button-v2.tsx +35 -0
  301. package/src/v2/components/checkbox-v2.css +184 -0
  302. package/src/v2/components/checkbox-v2.tsx +65 -0
  303. package/src/v2/components/dialog-v2.css +150 -0
  304. package/src/v2/components/dialog-v2.tsx +93 -0
  305. package/src/v2/components/diff-changes-v2.css +24 -0
  306. package/src/v2/components/diff-changes-v2.tsx +28 -0
  307. package/src/v2/components/field-v2.css +94 -0
  308. package/src/v2/components/field-v2.tsx +265 -0
  309. package/src/v2/components/icon-button-v2.css +155 -0
  310. package/src/v2/components/icon-button-v2.tsx +37 -0
  311. package/src/v2/components/icon.tsx +129 -0
  312. package/src/v2/components/inline-input-v2.css +218 -0
  313. package/src/v2/components/inline-input-v2.tsx +90 -0
  314. package/src/v2/components/keybind-v2.css +76 -0
  315. package/src/v2/components/keybind-v2.tsx +30 -0
  316. package/src/v2/components/line-comment-v2.css +204 -0
  317. package/src/v2/components/line-comment-v2.tsx +155 -0
  318. package/src/v2/components/menu-v2.css +190 -0
  319. package/src/v2/components/menu-v2.tsx +225 -0
  320. package/src/v2/components/project-avatar-v2.css +126 -0
  321. package/src/v2/components/project-avatar-v2.tsx +64 -0
  322. package/src/v2/components/radio-v2.css +202 -0
  323. package/src/v2/components/radio-v2.tsx +72 -0
  324. package/src/v2/components/segmented-control-v2.css +80 -0
  325. package/src/v2/components/segmented-control-v2.tsx +208 -0
  326. package/src/v2/components/select-v2.css +285 -0
  327. package/src/v2/components/select-v2.tsx +208 -0
  328. package/src/v2/components/switch-v2.css +154 -0
  329. package/src/v2/components/switch-v2.tsx +28 -0
  330. package/src/v2/components/tab-state-indicator.tsx +37 -0
  331. package/src/v2/components/tabs-v2.css +225 -0
  332. package/src/v2/components/tabs-v2.tsx +147 -0
  333. package/src/v2/components/text-input-v2.css +145 -0
  334. package/src/v2/components/text-input-v2.tsx +67 -0
  335. package/src/v2/components/text-shimmer-v2.css +125 -0
  336. package/src/v2/components/text-shimmer-v2.tsx +63 -0
  337. package/src/v2/components/textarea-v2.css +78 -0
  338. package/src/v2/components/textarea-v2.tsx +31 -0
  339. package/src/v2/components/toast-v2.css +215 -0
  340. package/src/v2/components/toast-v2.tsx +144 -0
  341. package/src/v2/components/tooltip-v2.css +53 -0
  342. package/src/v2/components/tooltip-v2.tsx +146 -0
  343. package/src/v2/components/wordmark-v2.tsx +92 -0
  344. package/src/v2/styles/colors.css +172 -0
  345. package/src/v2/styles/tailwind.css +2 -0
  346. package/src/v2/styles/theme.css +441 -0
@@ -0,0 +1,143 @@
1
+ import { createEffect, on, onCleanup, onMount } from "solid-js"
2
+ import { createStore } from "solid-js/store"
3
+
4
+ const px = (value: number | string | undefined, fallback: number) => {
5
+ if (typeof value === "number") return `${value}px`
6
+ if (typeof value === "string") return value
7
+ return `${fallback}px`
8
+ }
9
+
10
+ const ms = (value: number | string | undefined, fallback: number) => {
11
+ if (typeof value === "number") return `${value}ms`
12
+ if (typeof value === "string") return value
13
+ return `${fallback}ms`
14
+ }
15
+
16
+ const pct = (value: number | undefined, fallback: number) => {
17
+ const v = value ?? fallback
18
+ return `${v}%`
19
+ }
20
+
21
+ export function TextReveal(props: {
22
+ text?: string
23
+ class?: string
24
+ duration?: number | string
25
+ /** Gradient edge softness as a percentage of the mask (0 = hard wipe, 17 = soft). */
26
+ edge?: number
27
+ /** Optional small vertical travel for entering text (px). Default 0. */
28
+ travel?: number | string
29
+ spring?: string
30
+ springSoft?: string
31
+ growOnly?: boolean
32
+ truncate?: boolean
33
+ }) {
34
+ const [state, setState] = createStore({
35
+ cur: props.text,
36
+ old: undefined as string | undefined,
37
+ width: "auto",
38
+ ready: false,
39
+ swapping: false,
40
+ })
41
+ const cur = () => state.cur
42
+ const old = () => state.old
43
+ const width = () => state.width
44
+ const ready = () => state.ready
45
+ const swapping = () => state.swapping
46
+ let inRef: HTMLSpanElement | undefined
47
+ let outRef: HTMLSpanElement | undefined
48
+ let rootRef: HTMLSpanElement | undefined
49
+ let frame: number | undefined
50
+
51
+ const win = () => inRef?.scrollWidth ?? 0
52
+ const wout = () => outRef?.scrollWidth ?? 0
53
+
54
+ const widen = (next: number) => {
55
+ if (next <= 0) return
56
+ if (props.growOnly ?? true) {
57
+ const prev = Number.parseFloat(width())
58
+ if (Number.isFinite(prev) && next <= prev) return
59
+ }
60
+ setState("width", `${next}px`)
61
+ }
62
+
63
+ createEffect(
64
+ on(
65
+ () => props.text,
66
+ (next, prev) => {
67
+ if (next === prev) return
68
+ if (typeof next === "string" && typeof prev === "string" && next.startsWith(prev)) {
69
+ setState("cur", next)
70
+ widen(win())
71
+ return
72
+ }
73
+ setState("swapping", true)
74
+ setState("old", prev)
75
+ setState("cur", next)
76
+
77
+ if (typeof requestAnimationFrame !== "function") {
78
+ widen(Math.max(win(), wout()))
79
+ rootRef?.offsetHeight
80
+ setState("swapping", false)
81
+ return
82
+ }
83
+ if (frame !== undefined && typeof cancelAnimationFrame === "function") cancelAnimationFrame(frame)
84
+ frame = requestAnimationFrame(() => {
85
+ widen(Math.max(win(), wout()))
86
+ rootRef?.offsetHeight
87
+ setState("swapping", false)
88
+ frame = undefined
89
+ })
90
+ },
91
+ ),
92
+ )
93
+
94
+ onMount(() => {
95
+ widen(win())
96
+ const fonts = typeof document !== "undefined" ? document.fonts : undefined
97
+ if (typeof requestAnimationFrame !== "function") {
98
+ setState("ready", true)
99
+ return
100
+ }
101
+ if (!fonts) {
102
+ requestAnimationFrame(() => setState("ready", true))
103
+ return
104
+ }
105
+ void fonts.ready.finally(() => {
106
+ widen(win())
107
+ requestAnimationFrame(() => setState("ready", true))
108
+ })
109
+ })
110
+
111
+ onCleanup(() => {
112
+ if (frame === undefined || typeof cancelAnimationFrame !== "function") return
113
+ cancelAnimationFrame(frame)
114
+ })
115
+
116
+ return (
117
+ <span
118
+ ref={rootRef}
119
+ data-component="text-reveal"
120
+ data-ready={ready() ? "true" : "false"}
121
+ data-swapping={swapping() ? "true" : "false"}
122
+ data-truncate={props.truncate ? "true" : "false"}
123
+ class={props.class}
124
+ aria-label={props.text ?? ""}
125
+ style={{
126
+ "--text-reveal-duration": ms(props.duration, 450),
127
+ "--text-reveal-edge": pct(props.edge, 17),
128
+ "--text-reveal-travel": px(props.travel, 0),
129
+ "--text-reveal-spring": props.spring ?? "cubic-bezier(0.34, 1.08, 0.64, 1)",
130
+ "--text-reveal-spring-soft": props.springSoft ?? "cubic-bezier(0.34, 1, 0.64, 1)",
131
+ }}
132
+ >
133
+ <span data-slot="text-reveal-track" style={{ width: props.truncate ? "100%" : width() }}>
134
+ <span data-slot="text-reveal-entering" ref={inRef}>
135
+ {cur() ?? "\u00A0"}
136
+ </span>
137
+ <span data-slot="text-reveal-leaving" ref={outRef}>
138
+ {old() ?? "\u00A0"}
139
+ </span>
140
+ </span>
141
+ </span>
142
+ )
143
+ }
@@ -0,0 +1,119 @@
1
+ [data-component="text-shimmer"] {
2
+ --text-shimmer-step: 45ms;
3
+ --text-shimmer-duration: 1200ms;
4
+ --text-shimmer-swap: 220ms;
5
+ --text-shimmer-index: 0;
6
+ --text-shimmer-angle: 90deg;
7
+ --text-shimmer-spread: 5.2ch;
8
+ --text-shimmer-size: 360%;
9
+ --text-shimmer-base-color: var(--text-weak);
10
+ --text-shimmer-peak-color: var(--text-strong);
11
+ --text-shimmer-sweep: linear-gradient(
12
+ var(--text-shimmer-angle),
13
+ transparent calc(50% - var(--text-shimmer-spread)),
14
+ var(--text-shimmer-peak-color) 50%,
15
+ transparent calc(50% + var(--text-shimmer-spread))
16
+ );
17
+ --text-shimmer-base: linear-gradient(var(--text-shimmer-base-color), var(--text-shimmer-base-color));
18
+
19
+ display: inline-flex;
20
+ align-items: baseline;
21
+ font: inherit;
22
+ letter-spacing: inherit;
23
+ line-height: inherit;
24
+ }
25
+
26
+ [data-component="text-shimmer"] [data-slot="text-shimmer-char"] {
27
+ display: inline-grid;
28
+ white-space: pre;
29
+ font: inherit;
30
+ letter-spacing: inherit;
31
+ line-height: inherit;
32
+ }
33
+
34
+ [data-component="text-shimmer"] [data-slot="text-shimmer-char-base"],
35
+ [data-component="text-shimmer"] [data-slot="text-shimmer-char-shimmer"] {
36
+ grid-area: 1 / 1;
37
+ white-space: pre;
38
+ transition: opacity var(--text-shimmer-swap) ease-out;
39
+ font: inherit;
40
+ letter-spacing: inherit;
41
+ line-height: inherit;
42
+ }
43
+
44
+ [data-component="text-shimmer"] [data-slot="text-shimmer-char-base"] {
45
+ color: inherit;
46
+ opacity: 1;
47
+ }
48
+
49
+ [data-component="text-shimmer"] [data-slot="text-shimmer-char-shimmer"] {
50
+ color: var(--text-weaker);
51
+ opacity: 0;
52
+ }
53
+
54
+ [data-component="text-shimmer"][data-active="true"] [data-slot="text-shimmer-char-shimmer"] {
55
+ opacity: 1;
56
+ }
57
+
58
+ [data-component="text-shimmer"] [data-slot="text-shimmer-char-shimmer"][data-run="true"] {
59
+ animation-name: text-shimmer-sweep;
60
+ animation-duration: var(--text-shimmer-duration);
61
+ animation-iteration-count: infinite;
62
+ animation-timing-function: linear;
63
+ animation-fill-mode: both;
64
+ animation-delay: calc(var(--text-shimmer-step) * var(--text-shimmer-index) * -1);
65
+ will-change: background-position;
66
+ }
67
+
68
+ @keyframes text-shimmer-sweep {
69
+ 0% {
70
+ background-position:
71
+ 100% 0,
72
+ 0 0;
73
+ }
74
+
75
+ 100% {
76
+ background-position:
77
+ 0% 0,
78
+ 0 0;
79
+ }
80
+ }
81
+
82
+ @supports ((-webkit-background-clip: text) or (background-clip: text)) {
83
+ [data-component="text-shimmer"] [data-slot="text-shimmer-char-shimmer"] {
84
+ color: transparent;
85
+ -webkit-text-fill-color: transparent;
86
+ background-image: var(--text-shimmer-sweep), var(--text-shimmer-base);
87
+ background-size:
88
+ var(--text-shimmer-size) 100%,
89
+ 100% 100%;
90
+ background-position:
91
+ 100% 0,
92
+ 0 0;
93
+ background-repeat: no-repeat;
94
+ -webkit-background-clip: text;
95
+ background-clip: text;
96
+ }
97
+
98
+ [data-component="text-shimmer"][data-active="true"] [data-slot="text-shimmer-char-base"] {
99
+ opacity: 0;
100
+ }
101
+ }
102
+
103
+ @media (prefers-reduced-motion: reduce) {
104
+ [data-component="text-shimmer"] [data-slot="text-shimmer-char-base"],
105
+ [data-component="text-shimmer"] [data-slot="text-shimmer-char-shimmer"] {
106
+ transition-duration: 0ms;
107
+ }
108
+
109
+ [data-component="text-shimmer"] [data-slot="text-shimmer-char-shimmer"] {
110
+ animation: none !important;
111
+ color: inherit;
112
+ -webkit-text-fill-color: currentColor;
113
+ background-image: none;
114
+ }
115
+
116
+ [data-component="text-shimmer"] [data-slot="text-shimmer-char-base"] {
117
+ opacity: 1 !important;
118
+ }
119
+ }
@@ -0,0 +1,62 @@
1
+ import { createEffect, createMemo, createSignal, onCleanup, type ValidComponent } from "solid-js"
2
+ import { Dynamic } from "solid-js/web"
3
+
4
+ export const TextShimmer = <T extends ValidComponent = "span">(props: {
5
+ text: string
6
+ class?: string
7
+ as?: T
8
+ active?: boolean
9
+ offset?: number
10
+ }) => {
11
+ const text = createMemo(() => props.text ?? "")
12
+ const active = createMemo(() => props.active ?? true)
13
+ const offset = createMemo(() => props.offset ?? 0)
14
+ const [run, setRun] = createSignal(active())
15
+ const swap = 220
16
+ let timer: ReturnType<typeof setTimeout> | undefined
17
+
18
+ createEffect(() => {
19
+ if (timer) {
20
+ clearTimeout(timer)
21
+ timer = undefined
22
+ }
23
+
24
+ if (active()) {
25
+ setRun(true)
26
+ return
27
+ }
28
+
29
+ timer = setTimeout(() => {
30
+ timer = undefined
31
+ setRun(false)
32
+ }, swap)
33
+ })
34
+
35
+ onCleanup(() => {
36
+ if (!timer) return
37
+ clearTimeout(timer)
38
+ })
39
+
40
+ return (
41
+ <Dynamic
42
+ component={props.as ?? "span"}
43
+ data-component="text-shimmer"
44
+ data-active={active() ? "true" : "false"}
45
+ class={props.class}
46
+ aria-label={text()}
47
+ style={{
48
+ "--text-shimmer-swap": `${swap}ms`,
49
+ "--text-shimmer-index": `${offset()}`,
50
+ }}
51
+ >
52
+ <span data-slot="text-shimmer-char">
53
+ <span data-slot="text-shimmer-char-base" aria-hidden="true">
54
+ {text()}
55
+ </span>
56
+ <span data-slot="text-shimmer-char-shimmer" data-run={run() ? "true" : "false"} aria-hidden="true">
57
+ {text()}
58
+ </span>
59
+ </span>
60
+ </Dynamic>
61
+ )
62
+ }
@@ -0,0 +1,27 @@
1
+ /*
2
+ * TextStrikethrough — spring-animated strikethrough line
3
+ *
4
+ * Draws a line-through from left to right using clip-path on a
5
+ * transparent-text overlay that carries the text-decoration.
6
+ * Grid stacking (grid-area: 1/1) layers the overlay on the base text.
7
+ *
8
+ * Key trick: -webkit-text-fill-color hides the glyph paint while
9
+ * keeping `color` (and therefore `currentColor` / text-decoration-color)
10
+ * set to the real inherited text color.
11
+ */
12
+
13
+ [data-component="text-strikethrough"] {
14
+ display: grid;
15
+ }
16
+
17
+ [data-slot="text-strikethrough-line"] {
18
+ -webkit-text-fill-color: transparent;
19
+ text-decoration-line: line-through;
20
+ pointer-events: none;
21
+ }
22
+
23
+ @media (prefers-reduced-motion: reduce) {
24
+ [data-slot="text-strikethrough-line"] {
25
+ clip-path: none !important;
26
+ }
27
+ }
@@ -0,0 +1,84 @@
1
+ import type { JSX } from "solid-js"
2
+ import { onMount } from "solid-js"
3
+ import { createResizeObserver } from "@solid-primitives/resize-observer"
4
+ import { createStore } from "solid-js/store"
5
+ import { useSpring } from "./motion-spring"
6
+
7
+ export function TextStrikethrough(props: {
8
+ /** Whether the strikethrough is active (line drawn across). */
9
+ active: boolean
10
+ /** The text to display. Rendered twice internally (base + decoration overlay). */
11
+ text: string
12
+ /** Spring visual duration in seconds. Default 0.35. */
13
+ visualDuration?: number
14
+ class?: string
15
+ style?: JSX.CSSProperties
16
+ }) {
17
+ const progress = useSpring(
18
+ () => (props.active ? 1 : 0),
19
+ () => ({ visualDuration: props.visualDuration ?? 0.35, bounce: 0 }),
20
+ )
21
+
22
+ let baseRef: HTMLSpanElement | undefined
23
+ let containerRef: HTMLSpanElement | undefined
24
+ const [state, setState] = createStore({
25
+ textWidth: 0,
26
+ containerWidth: 0,
27
+ })
28
+ const textWidth = () => state.textWidth
29
+ const containerWidth = () => state.containerWidth
30
+
31
+ const measure = () => {
32
+ if (baseRef) setState("textWidth", baseRef.scrollWidth)
33
+ if (containerRef) setState("containerWidth", containerRef.offsetWidth)
34
+ }
35
+
36
+ onMount(measure)
37
+ createResizeObserver(() => containerRef, measure)
38
+
39
+ // Revealed pixels from left = progress * textWidth
40
+ const revealedPx = () => {
41
+ const tw = textWidth()
42
+ return tw > 0 ? progress() * tw : 0
43
+ }
44
+
45
+ // Overlay clip: hide everything to the right of revealed area
46
+ const overlayClip = () => {
47
+ const cw = containerWidth()
48
+ const tw = textWidth()
49
+ if (cw <= 0 || tw <= 0) return `inset(0 ${(1 - progress()) * 100}% 0 0)`
50
+ const remaining = Math.max(0, cw - revealedPx())
51
+ return `inset(0 ${remaining}px 0 0)`
52
+ }
53
+
54
+ // Base clip: hide everything to the left of revealed area (complementary)
55
+ const baseClip = () => {
56
+ const px = revealedPx()
57
+ if (px <= 0.5) return "none"
58
+ return `inset(0 0 0 ${px}px)`
59
+ }
60
+
61
+ return (
62
+ <span
63
+ data-component="text-strikethrough"
64
+ class={props.class}
65
+ style={{ display: "grid", ...props.style }}
66
+ ref={containerRef}
67
+ >
68
+ <span ref={baseRef} style={{ "grid-area": "1 / 1", "clip-path": baseClip() }}>
69
+ {props.text}
70
+ </span>
71
+ <span
72
+ aria-hidden="true"
73
+ style={{
74
+ "grid-area": "1 / 1",
75
+ "text-decoration": "line-through",
76
+ "pointer-events": "none",
77
+ "clip-path": overlayClip(),
78
+ }}
79
+ >
80
+ {props.text}
81
+ </span>
82
+ </span>
83
+ )
84
+ }
@@ -0,0 +1,236 @@
1
+ [data-component="toast-region"] {
2
+ position: fixed;
3
+ bottom: 48px;
4
+ right: 32px;
5
+ z-index: 1000;
6
+ display: flex;
7
+ flex-direction: column;
8
+ gap: 8px;
9
+ max-width: min(400px, calc(100vw - 64px));
10
+ max-height: calc(100dvh - 96px);
11
+ width: 100%;
12
+ overflow: hidden;
13
+ pointer-events: none;
14
+
15
+ [data-slot="toast-list"] {
16
+ display: flex;
17
+ flex-direction: column;
18
+ gap: 8px;
19
+ list-style: none;
20
+ margin: 0;
21
+ padding: 0;
22
+ max-height: 100%;
23
+ overflow-y: auto;
24
+ scrollbar-width: none;
25
+
26
+ &::-webkit-scrollbar {
27
+ display: none;
28
+ }
29
+ }
30
+ }
31
+
32
+ [data-component="toast"] {
33
+ position: relative;
34
+ display: flex;
35
+ align-items: flex-start;
36
+ gap: 20px;
37
+ padding: 16px 20px;
38
+ max-height: min(420px, calc(100dvh - 96px));
39
+ overflow: hidden;
40
+ pointer-events: auto;
41
+ transition: all 150ms ease-out;
42
+
43
+ border-radius: var(--radius-lg);
44
+ border: 1px solid var(--border-weak-base);
45
+ background: var(--surface-float-base);
46
+ color: var(--text-invert-base);
47
+ box-shadow: var(--shadow-md);
48
+
49
+ [data-slot="toast-inner"] {
50
+ display: flex;
51
+ align-items: flex-start;
52
+ gap: 10px;
53
+ }
54
+
55
+ &[data-opened] {
56
+ animation: toastPopIn 150ms ease-out;
57
+ }
58
+
59
+ &[data-closed] {
60
+ animation: toastPopOut 100ms ease-in forwards;
61
+ }
62
+
63
+ &[data-swipe="move"] {
64
+ transform: translateX(var(--kb-toast-swipe-move-x));
65
+ }
66
+
67
+ &[data-swipe="cancel"] {
68
+ transform: translateX(0);
69
+ transition: transform 200ms ease-out;
70
+ }
71
+
72
+ &[data-swipe="end"] {
73
+ animation: toastSwipeOut 100ms ease-out forwards;
74
+ }
75
+
76
+ /* &[data-variant="success"] { */
77
+ /* border-color: var(--color-semantic-positive); */
78
+ /* } */
79
+ /**/
80
+ /* &[data-variant="error"] { */
81
+ /* border-color: var(--color-semantic-danger); */
82
+ /* } */
83
+ /**/
84
+ /* &[data-variant="loading"] { */
85
+ /* border-color: var(--color-semantic-info); */
86
+ /* } */
87
+
88
+ [data-slot="toast-icon"] {
89
+ flex-shrink: 0;
90
+ display: flex;
91
+ align-items: center;
92
+ justify-content: center;
93
+
94
+ [data-component="icon"] {
95
+ color: var(--text-invert-stronger);
96
+ /* color: var(--icon-invert-base); */
97
+ }
98
+ }
99
+
100
+ [data-slot="toast-content"] {
101
+ flex: 1;
102
+ display: flex;
103
+ flex-direction: column;
104
+ gap: 2px;
105
+ min-height: 0;
106
+ min-width: 0;
107
+ overflow-x: hidden;
108
+ overflow-y: auto;
109
+ scrollbar-width: none;
110
+
111
+ &::-webkit-scrollbar {
112
+ display: none;
113
+ }
114
+ }
115
+
116
+ [data-slot="toast-title"] {
117
+ color: var(--text-invert-strong);
118
+ overflow: hidden;
119
+ text-overflow: ellipsis;
120
+ white-space: nowrap;
121
+
122
+ /* text-14-medium */
123
+ font-family: var(--font-family-sans);
124
+ font-size: 14px;
125
+ font-style: normal;
126
+ font-weight: var(--font-weight-medium);
127
+ line-height: var(--line-height-large); /* 142.857% */
128
+ letter-spacing: var(--letter-spacing-normal);
129
+
130
+ margin: 0;
131
+ }
132
+
133
+ [data-slot="toast-description"] {
134
+ color: var(--text-invert-base);
135
+ text-wrap-style: pretty;
136
+ overflow-wrap: anywhere;
137
+ word-break: break-word;
138
+
139
+ /* text-14-regular */
140
+ font-family: var(--font-family-sans);
141
+ font-size: var(--font-size-base);
142
+ font-style: normal;
143
+ font-weight: var(--font-weight-regular);
144
+ line-height: var(--line-height-x-large); /* 171.429% */
145
+ letter-spacing: var(--letter-spacing-normal);
146
+
147
+ margin: 0;
148
+ }
149
+
150
+ [data-slot="toast-actions"] {
151
+ display: flex;
152
+ flex-wrap: wrap;
153
+ gap: 16px;
154
+ margin-top: 8px;
155
+ }
156
+
157
+ [data-slot="toast-action"] {
158
+ background: none;
159
+ border: none;
160
+ padding: 0;
161
+ cursor: pointer;
162
+ min-width: 0;
163
+ max-width: 100%;
164
+ overflow: hidden;
165
+ text-overflow: ellipsis;
166
+ white-space: nowrap;
167
+
168
+ color: var(--text-invert-weak);
169
+ font-family: var(--font-family-sans);
170
+ font-size: var(--font-size-base);
171
+ font-weight: var(--font-weight-medium);
172
+ line-height: var(--line-height-large);
173
+ letter-spacing: var(--letter-spacing-normal);
174
+
175
+ &:hover {
176
+ text-decoration: underline;
177
+ }
178
+
179
+ &:first-child {
180
+ color: var(--text-invert-strong);
181
+ }
182
+ }
183
+
184
+ [data-slot="toast-close-button"] {
185
+ flex-shrink: 0;
186
+ }
187
+
188
+ [data-slot="toast-progress-track"] {
189
+ position: absolute;
190
+ bottom: 0;
191
+ left: 0;
192
+ right: 0;
193
+ height: 3px;
194
+ background-color: var(--surface-base);
195
+ border-radius: 0 0 var(--radius-lg) var(--radius-lg);
196
+ overflow: hidden;
197
+ }
198
+
199
+ [data-slot="toast-progress-fill"] {
200
+ height: 100%;
201
+ width: var(--kb-toast-progress-fill-width);
202
+ background-color: var(--color-primary);
203
+ transition: width 250ms linear;
204
+ }
205
+ }
206
+
207
+ @keyframes toastPopIn {
208
+ from {
209
+ opacity: 0;
210
+ transform: translateY(20px);
211
+ }
212
+ to {
213
+ opacity: 1;
214
+ transform: translateY(0);
215
+ }
216
+ }
217
+
218
+ @keyframes toastPopOut {
219
+ from {
220
+ opacity: 1;
221
+ transform: translateY(0);
222
+ }
223
+ to {
224
+ opacity: 0;
225
+ transform: translateY(20px);
226
+ }
227
+ }
228
+
229
+ @keyframes toastSwipeOut {
230
+ from {
231
+ transform: translateX(var(--kb-toast-swipe-end-x));
232
+ }
233
+ to {
234
+ transform: translateX(100%);
235
+ }
236
+ }