@zyro-sec/ui 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (256) hide show
  1. package/AGENTS.md +29 -0
  2. package/bunfig.toml +2 -0
  3. package/package.json +21 -114
  4. package/perf/motion.bench.ts +14 -0
  5. package/perf/motion.ts +16 -0
  6. package/script/build-oc2-v2-overrides.ts +38 -0
  7. package/script/colors.txt +288 -0
  8. package/script/generate-spinner.ts +121 -0
  9. package/script/pack.ts +5 -0
  10. package/script/tailwind.ts +24 -0
  11. package/src/actions/button/button.stories.tsx +158 -0
  12. package/src/actions/icon-button/icon-button.stories.tsx +122 -0
  13. package/src/actions/split-button/split-button.stories.tsx +59 -0
  14. package/src/assets/favicon/apple-touch-icon-v3.png +0 -0
  15. package/src/assets/favicon/apple-touch-icon.png +0 -0
  16. package/src/assets/favicon/favicon-96x96-v3.png +0 -0
  17. package/src/assets/favicon/favicon-96x96.png +0 -0
  18. package/src/assets/favicon/favicon-v3.ico +0 -0
  19. package/src/assets/favicon/favicon-v3.svg +7 -0
  20. package/src/assets/favicon/favicon.ico +0 -0
  21. package/src/assets/favicon/favicon.svg +7 -0
  22. package/src/assets/favicon/site.webmanifest +24 -0
  23. package/src/assets/favicon/web-app-manifest-192x192.png +0 -0
  24. package/src/assets/favicon/web-app-manifest-512x512.png +0 -0
  25. package/src/assets/icons/provider/302ai.svg +7 -0
  26. package/src/assets/icons/provider/abacus.svg +14 -0
  27. package/src/assets/icons/provider/aihubmix.svg +3 -0
  28. package/src/assets/icons/provider/alibaba-cn.svg +3 -0
  29. package/src/assets/icons/provider/alibaba-coding-plan-cn.svg +3 -0
  30. package/src/assets/icons/provider/alibaba-coding-plan.svg +3 -0
  31. package/src/assets/icons/provider/alibaba.svg +3 -0
  32. package/src/assets/icons/provider/amazon-bedrock.svg +3 -0
  33. package/src/assets/icons/provider/anthropic.svg +3 -0
  34. package/src/assets/icons/provider/azure-cognitive-services.svg +24 -0
  35. package/src/assets/icons/provider/azure.svg +3 -0
  36. package/src/assets/icons/provider/bailing.svg +3 -0
  37. package/src/assets/icons/provider/baseten.svg +3 -0
  38. package/src/assets/icons/provider/berget.svg +3 -0
  39. package/src/assets/icons/provider/cerebras.svg +4 -0
  40. package/src/assets/icons/provider/chutes.svg +24 -0
  41. package/src/assets/icons/provider/clarifai.svg +24 -0
  42. package/src/assets/icons/provider/claude-agent.svg +3 -0
  43. package/src/assets/icons/provider/cloudferro-sherlock.svg +5 -0
  44. package/src/assets/icons/provider/cloudflare-ai-gateway.svg +4 -0
  45. package/src/assets/icons/provider/cloudflare-workers-ai.svg +4 -0
  46. package/src/assets/icons/provider/cohere.svg +5 -0
  47. package/src/assets/icons/provider/cortecs.svg +24 -0
  48. package/src/assets/icons/provider/deepinfra.svg +4 -0
  49. package/src/assets/icons/provider/deepseek.svg +3 -0
  50. package/src/assets/icons/provider/digitalocean.svg +6 -0
  51. package/src/assets/icons/provider/dinference.svg +1 -0
  52. package/src/assets/icons/provider/drun.svg +8 -0
  53. package/src/assets/icons/provider/evroc.svg +3 -0
  54. package/src/assets/icons/provider/fastrouter.svg +3 -0
  55. package/src/assets/icons/provider/fireworks-ai.svg +3 -0
  56. package/src/assets/icons/provider/firmware.svg +18 -0
  57. package/src/assets/icons/provider/friendli.svg +3 -0
  58. package/src/assets/icons/provider/github-copilot.svg +3 -0
  59. package/src/assets/icons/provider/github-models.svg +3 -0
  60. package/src/assets/icons/provider/gitlab.svg +3 -0
  61. package/src/assets/icons/provider/google-vertex-anthropic.svg +24 -0
  62. package/src/assets/icons/provider/google-vertex.svg +10 -0
  63. package/src/assets/icons/provider/google.svg +3 -0
  64. package/src/assets/icons/provider/groq.svg +3 -0
  65. package/src/assets/icons/provider/helicone.svg +6 -0
  66. package/src/assets/icons/provider/huggingface.svg +3 -0
  67. package/src/assets/icons/provider/iflowcn.svg +3 -0
  68. package/src/assets/icons/provider/inception.svg +4 -0
  69. package/src/assets/icons/provider/inference.svg +3 -0
  70. package/src/assets/icons/provider/io-net.svg +5 -0
  71. package/src/assets/icons/provider/jiekou.svg +4 -0
  72. package/src/assets/icons/provider/kilo.svg +4 -0
  73. package/src/assets/icons/provider/kimi-for-coding.svg +3 -0
  74. package/src/assets/icons/provider/kuae-cloud-coding-plan.svg +3 -0
  75. package/src/assets/icons/provider/llama.svg +3 -0
  76. package/src/assets/icons/provider/lmstudio.svg +24 -0
  77. package/src/assets/icons/provider/lucidquery.svg +3 -0
  78. package/src/assets/icons/provider/meganova.svg +3 -0
  79. package/src/assets/icons/provider/meituan.svg +6 -0
  80. package/src/assets/icons/provider/meta.svg +3 -0
  81. package/src/assets/icons/provider/minimax-cn-coding-plan.svg +24 -0
  82. package/src/assets/icons/provider/minimax-cn.svg +3 -0
  83. package/src/assets/icons/provider/minimax-coding-plan.svg +24 -0
  84. package/src/assets/icons/provider/minimax.svg +3 -0
  85. package/src/assets/icons/provider/mistral.svg +3 -0
  86. package/src/assets/icons/provider/moark.svg +3 -0
  87. package/src/assets/icons/provider/modelscope.svg +5 -0
  88. package/src/assets/icons/provider/moonshotai-cn.svg +3 -0
  89. package/src/assets/icons/provider/moonshotai.svg +3 -0
  90. package/src/assets/icons/provider/morph.svg +24 -0
  91. package/src/assets/icons/provider/nano-gpt.svg +3 -0
  92. package/src/assets/icons/provider/nebius.svg +4 -0
  93. package/src/assets/icons/provider/nova.svg +3 -0
  94. package/src/assets/icons/provider/novita-ai.svg +10 -0
  95. package/src/assets/icons/provider/nvidia.svg +3 -0
  96. package/src/assets/icons/provider/ollama-cloud.svg +7 -0
  97. package/src/assets/icons/provider/openai.svg +3 -0
  98. package/src/assets/icons/provider/opencode-go.svg +3 -0
  99. package/src/assets/icons/provider/opencode.svg +3 -0
  100. package/src/assets/icons/provider/openrouter.svg +3 -0
  101. package/src/assets/icons/provider/ovhcloud.svg +3 -0
  102. package/src/assets/icons/provider/perplexity-agent.svg +3 -0
  103. package/src/assets/icons/provider/perplexity.svg +3 -0
  104. package/src/assets/icons/provider/poe.svg +7 -0
  105. package/src/assets/icons/provider/privatemode-ai.svg +5 -0
  106. package/src/assets/icons/provider/qihang-ai.svg +9 -0
  107. package/src/assets/icons/provider/qiniu-ai.svg +7 -0
  108. package/src/assets/icons/provider/reflection.svg +3 -0
  109. package/src/assets/icons/provider/requesty.svg +24 -0
  110. package/src/assets/icons/provider/sap-ai-core.svg +24 -0
  111. package/src/assets/icons/provider/scaleway.svg +5 -0
  112. package/src/assets/icons/provider/siliconflow-cn.svg +3 -0
  113. package/src/assets/icons/provider/siliconflow.svg +3 -0
  114. package/src/assets/icons/provider/stackit.svg +4 -0
  115. package/src/assets/icons/provider/stepfun.svg +16 -0
  116. package/src/assets/icons/provider/submodel.svg +3 -0
  117. package/src/assets/icons/provider/synthetic.svg +24 -0
  118. package/src/assets/icons/provider/tencent-coding-plan.svg +5 -0
  119. package/src/assets/icons/provider/tencent.svg +3 -0
  120. package/src/assets/icons/provider/thinkingmachines.svg +3 -0
  121. package/src/assets/icons/provider/togetherai.svg +4 -0
  122. package/src/assets/icons/provider/upstage.svg +24 -0
  123. package/src/assets/icons/provider/v0.svg +3 -0
  124. package/src/assets/icons/provider/venice.svg +4 -0
  125. package/src/assets/icons/provider/vercel.svg +3 -0
  126. package/src/assets/icons/provider/vivgrid.svg +4 -0
  127. package/src/assets/icons/provider/vultr.svg +6 -0
  128. package/src/assets/icons/provider/wandb.svg +24 -0
  129. package/src/assets/icons/provider/xai.svg +3 -0
  130. package/src/assets/icons/provider/xiaomi.svg +3 -0
  131. package/src/assets/icons/provider/zai-coding-plan.svg +3 -0
  132. package/src/assets/icons/provider/zai.svg +3 -0
  133. package/src/assets/icons/provider/zenmux.svg +4 -0
  134. package/src/assets/icons/provider/zhipuai-coding-plan.svg +3 -0
  135. package/src/assets/icons/provider/zhipuai.svg +3 -0
  136. package/src/assets/images/social-share-black.png +0 -0
  137. package/src/assets/images/social-share-zen.png +0 -0
  138. package/src/assets/images/social-share.png +0 -0
  139. package/src/components/animated-number-machine.test.ts +140 -0
  140. package/src/components/animated-number.stories.tsx +35 -0
  141. package/src/components/app-icon.stories.tsx +73 -0
  142. package/src/components/card.stories.tsx +101 -0
  143. package/src/components/collapsible.stories.tsx +76 -0
  144. package/src/components/context-menu.stories.tsx +150 -0
  145. package/src/components/diagram-preview.stories.tsx +62 -0
  146. package/src/components/dock-surface.stories.tsx +26 -0
  147. package/src/components/document-surface.stories.tsx +42 -0
  148. package/src/components/error-details.stories.tsx +72 -0
  149. package/src/components/favicon.stories.tsx +49 -0
  150. package/src/components/file-icon-machine.test.ts +52 -0
  151. package/src/components/file-icon.stories.tsx +93 -0
  152. package/src/components/file-icons/sprite.svg +11707 -0
  153. package/src/components/font.stories.tsx +48 -0
  154. package/src/components/hover-card.stories.tsx +79 -0
  155. package/src/components/image-flight-machine.test.ts +184 -0
  156. package/src/components/image-flight.test.ts +173 -0
  157. package/src/components/image-preview.stories.tsx +392 -0
  158. package/src/components/image-zoom-machine.test.ts +154 -0
  159. package/src/components/image-zoom.test.ts +96 -0
  160. package/src/components/list.stories.tsx +221 -0
  161. package/src/components/logo.stories.tsx +62 -0
  162. package/src/components/menu-scroll.stories.tsx +73 -0
  163. package/src/components/popover-machine.test.ts +150 -0
  164. package/src/components/popover.stories.tsx +84 -0
  165. package/src/components/preview-controls.stories.tsx +40 -0
  166. package/src/components/progress.stories.tsx +69 -0
  167. package/src/components/provider-icon.stories.tsx +75 -0
  168. package/src/components/resize-handle-machine.test.ts +164 -0
  169. package/src/components/resize-handle.stories.tsx +81 -0
  170. package/src/components/rolling-number.stories.tsx +23 -0
  171. package/src/components/scroll-view-machine.test.ts +141 -0
  172. package/src/components/scroll-view.stories.tsx +68 -0
  173. package/src/components/scroll-view.test.ts +114 -0
  174. package/src/components/spinner-radar.test.ts +61 -0
  175. package/src/components/spinner.stories.tsx +40 -0
  176. package/src/components/sticky-accordion-header.stories.tsx +64 -0
  177. package/src/components/text-field-machine.test.ts +99 -0
  178. package/src/components/text-field.stories.tsx +132 -0
  179. package/src/components/text-reveal-machine.test.ts +157 -0
  180. package/src/components/text-reveal.stories.tsx +363 -0
  181. package/src/components/text-strikethrough.stories.tsx +296 -0
  182. package/src/components/thinking-heading.stories.tsx +900 -0
  183. package/src/components/truncated-text.stories.tsx +37 -0
  184. package/src/components/typewriter-machine.test.ts +177 -0
  185. package/src/components/typewriter.stories.tsx +51 -0
  186. package/src/context/dialog-machine.test.ts +295 -0
  187. package/src/context/i18n.test.ts +89 -0
  188. package/src/context/marked-base.test.ts +75 -0
  189. package/src/context/marked-parser.test.ts +167 -0
  190. package/src/context/marked-regression.test.ts +12 -0
  191. package/src/data-display/accordion/accordion.stories.tsx +76 -0
  192. package/src/data-display/avatar/avatar.stories.tsx +48 -0
  193. package/src/data-display/badge/badge.stories.tsx +75 -0
  194. package/src/data-display/diff-changes/diff-changes.stories.tsx +63 -0
  195. package/src/data-display/keybind/keybind.stories.tsx +77 -0
  196. package/src/data-display/line-comment/line-comment.stories.tsx +288 -0
  197. package/src/data-display/line-comment/machine.test.ts +385 -0
  198. package/src/data-display/project-avatar/animation-machine.test.ts +134 -0
  199. package/src/data-display/project-avatar/generated.test.ts +50 -0
  200. package/src/data-display/project-avatar/procedural.test.ts +16 -0
  201. package/src/data-display/project-avatar/project-avatar.stories.tsx +102 -0
  202. package/src/data-display/project-avatar/project-avatar.test.ts +21 -0
  203. package/src/data-display/project-avatar/project-icon-styles.stories.tsx +772 -0
  204. package/src/feedback/activity-ring/activity-ring.stories.tsx +20 -0
  205. package/src/feedback/loader/loader.stories.tsx +44 -0
  206. package/src/feedback/progress-circle/progress-circle.stories.tsx +56 -0
  207. package/src/feedback/toast/description.test.ts +20 -0
  208. package/src/feedback/toast/machine.test.ts +106 -0
  209. package/src/feedback/toast/toast.stories.tsx +186 -0
  210. package/src/forms/checkbox/checkbox.stories.tsx +104 -0
  211. package/src/forms/field/field.stories.tsx +129 -0
  212. package/src/forms/inline-input/inline-input.stories.tsx +37 -0
  213. package/src/forms/radio/radio.stories.tsx +145 -0
  214. package/src/forms/redirect-paste/redirect-paste.stories.tsx +101 -0
  215. package/src/forms/search-list/navigation.test.ts +40 -0
  216. package/src/forms/search-list/search-list.stories.tsx +108 -0
  217. package/src/forms/select/machine.test.ts +105 -0
  218. package/src/forms/select/select.stories.tsx +208 -0
  219. package/src/forms/switch/switch.stories.tsx +97 -0
  220. package/src/forms/text-input/text-input.stories.tsx +220 -0
  221. package/src/forms/textarea/textarea.stories.tsx +137 -0
  222. package/src/forms/typeahead/machine.test.ts +143 -0
  223. package/src/forms/typeahead/typeahead.stories.tsx +113 -0
  224. package/src/hooks/auto-scroll-machine.test.ts +212 -0
  225. package/src/hooks/list-machine.test.ts +263 -0
  226. package/src/hooks/spin-phase.test.ts +32 -0
  227. package/src/hooks/use-filtered-list.test.ts +41 -0
  228. package/src/icons/icon/icon.stories.tsx +131 -0
  229. package/src/layout/divider/divider.stories.tsx +38 -0
  230. package/src/motion/README.md +113 -0
  231. package/src/motion/core.test.ts +328 -0
  232. package/src/motion-tuning-features.test.ts +129 -0
  233. package/src/motion-tuning.test.ts +68 -0
  234. package/src/navigation/menu/machine.test.ts +85 -0
  235. package/src/navigation/menu/menu.stories.tsx +328 -0
  236. package/src/navigation/menu/submenu-machine.test.ts +71 -0
  237. package/src/navigation/segmented-control/segmented-control.stories.tsx +115 -0
  238. package/src/navigation/segmented-control/segmented-control.test.ts +123 -0
  239. package/src/navigation/tab-state-indicator.stories.tsx +24 -0
  240. package/src/navigation/tabs/tabs.stories.tsx +193 -0
  241. package/src/overlays/dialog/dialog.stories.tsx +365 -0
  242. package/src/overlays/mcp-sign-in/machine.test.ts +215 -0
  243. package/src/overlays/tooltip/machine.test.ts +214 -0
  244. package/src/overlays/tooltip/tooltip.stories.tsx +155 -0
  245. package/src/styles/blue-tokens.stories.tsx +215 -0
  246. package/src/theme/desktop-theme.schema.json +168 -0
  247. package/src/theme/machine.test.ts +498 -0
  248. package/src/theme/v2/resolve.test.ts +120 -0
  249. package/src/typography/slash/slash.stories.tsx +26 -0
  250. package/src/typography/text-shimmer/machine.test.ts +117 -0
  251. package/src/typography/text-shimmer/text-shimmer.stories.tsx +64 -0
  252. package/src/typography/wordmark/wordmark.stories.tsx +19 -0
  253. package/test/solid-jsx.ts +20 -0
  254. package/tsconfig.build.json +14 -0
  255. package/tsconfig.json +23 -0
  256. package/vite.config.ts +61 -0
@@ -0,0 +1,117 @@
1
+ import { describe, expect, test } from "bun:test"
2
+ import {
3
+ createTextShimmerState,
4
+ DISPOSED_TEXT_SHIMMER_EVENT,
5
+ DISPOSED_TEXT_SHIMMER_STATE,
6
+ INITIAL_ACTIVE_TEXT_SHIMMER_STATE,
7
+ INITIAL_INACTIVE_TEXT_SHIMMER_STATE,
8
+ selectTextShimmerActive,
9
+ selectTextShimmerRunning,
10
+ syncTextShimmerEvent,
11
+ transitionTextShimmer,
12
+ type TextShimmerEvent,
13
+ type TextShimmerState,
14
+ } from "./machine"
15
+
16
+ const run = (state: TextShimmerState, ...events: TextShimmerEvent[]) => events.reduce(transitionTextShimmer, state)
17
+
18
+ const view = (state: TextShimmerState) => ({
19
+ active: selectTextShimmerActive(state),
20
+ running: selectTextShimmerRunning(state),
21
+ })
22
+
23
+ const activate = syncTextShimmerEvent(true, false)
24
+
25
+ const deactivate = syncTextShimmerEvent(false, false)
26
+
27
+ const deactivateReduced = syncTextShimmerEvent(false, true)
28
+
29
+ describe("mount", () => {
30
+ test("an inactive shimmer has nothing to fade, so it stays put without a settle timer", () => {
31
+ // Before the machine, every inactive mount scheduled a 220 ms timer to turn the sweep from off to off.
32
+ const state = createTextShimmerState(false)
33
+
34
+ expect(state).toBe(INITIAL_INACTIVE_TEXT_SHIMMER_STATE)
35
+ expect(view(state)).toEqual({ active: false, running: false })
36
+ expect(transitionTextShimmer(state, deactivate)).toBe(state)
37
+ expect(transitionTextShimmer(state, deactivateReduced)).toBe(state)
38
+ expect(transitionTextShimmer(state, { type: "settled", attempt: 0 })).toBe(state)
39
+ })
40
+
41
+ test("an active shimmer shows and runs the sweep", () => {
42
+ const state = createTextShimmerState(true)
43
+
44
+ expect(state).toBe(INITIAL_ACTIVE_TEXT_SHIMMER_STATE)
45
+ expect(view(state)).toEqual({ active: true, running: true })
46
+ expect(transitionTextShimmer(state, activate)).toBe(state)
47
+ })
48
+
49
+ test("sync events are shared singletons", () => {
50
+ expect(syncTextShimmerEvent(true, false)).toBe(syncTextShimmerEvent(true, false))
51
+ expect(syncTextShimmerEvent(false, true)).toBe(syncTextShimmerEvent(false, true))
52
+ expect(Object.isFrozen(syncTextShimmerEvent(false, false))).toBe(true)
53
+ })
54
+ })
55
+
56
+ describe("crossfade", () => {
57
+ test("deactivating fades out, keeps the sweep running, then settles", () => {
58
+ const fading = transitionTextShimmer(INITIAL_ACTIVE_TEXT_SHIMMER_STATE, deactivate)
59
+
60
+ expect(fading).toEqual({ status: "fading", attempt: 1 })
61
+ expect(view(fading)).toEqual({ active: false, running: true })
62
+ expect(transitionTextShimmer(fading, deactivate)).toBe(fading)
63
+
64
+ const settled = transitionTextShimmer(fading, { type: "settled", attempt: 1 })
65
+ expect(settled).toEqual({ status: "inactive", attempts: 1 })
66
+ expect(view(settled)).toEqual({ active: false, running: false })
67
+ })
68
+
69
+ test("reduced motion has no crossfade, so the sweep stops at once", () => {
70
+ // Before the machine, the sweep kept running for 220 ms although the crossfade took 0 ms.
71
+ const state = transitionTextShimmer(INITIAL_ACTIVE_TEXT_SHIMMER_STATE, deactivateReduced)
72
+
73
+ expect(state).toBe(INITIAL_INACTIVE_TEXT_SHIMMER_STATE)
74
+ expect(view(state)).toEqual({ active: false, running: false })
75
+ })
76
+
77
+ test("reduced motion during a fade settles it at once", () => {
78
+ const state = run(INITIAL_ACTIVE_TEXT_SHIMMER_STATE, deactivate, deactivateReduced)
79
+
80
+ expect(state).toEqual({ status: "inactive", attempts: 1 })
81
+ })
82
+
83
+ test("reactivating cancels the fade, and only the current fade's settle applies", () => {
84
+ const reactivated = run(INITIAL_ACTIVE_TEXT_SHIMMER_STATE, deactivate, activate)
85
+
86
+ expect(reactivated).toEqual({ status: "active", attempts: 1 })
87
+ expect(transitionTextShimmer(reactivated, { type: "settled", attempt: 1 })).toBe(reactivated)
88
+
89
+ const fading = transitionTextShimmer(reactivated, deactivate)
90
+ expect(fading).toEqual({ status: "fading", attempt: 2 })
91
+ expect(transitionTextShimmer(fading, { type: "settled", attempt: 1 })).toBe(fading)
92
+ expect(transitionTextShimmer(fading, { type: "settled", attempt: 2 })).toEqual({ status: "inactive", attempts: 2 })
93
+ })
94
+
95
+ test("activating after a settled fade keeps counting attempts", () => {
96
+ const state = run(INITIAL_ACTIVE_TEXT_SHIMMER_STATE, deactivate, { type: "settled", attempt: 1 }, activate)
97
+
98
+ expect(state).toEqual({ status: "active", attempts: 1 })
99
+ expect(transitionTextShimmer(state, deactivate)).toEqual({ status: "fading", attempt: 2 })
100
+ })
101
+ })
102
+
103
+ describe("disposal", () => {
104
+ test.each([
105
+ ["inactive", INITIAL_INACTIVE_TEXT_SHIMMER_STATE],
106
+ ["active", INITIAL_ACTIVE_TEXT_SHIMMER_STATE],
107
+ ["fading", transitionTextShimmer(INITIAL_ACTIVE_TEXT_SHIMMER_STATE, deactivate)],
108
+ ] as const)("disposing while %s ignores every later event", (_, state) => {
109
+ const disposed = transitionTextShimmer(state, DISPOSED_TEXT_SHIMMER_EVENT)
110
+
111
+ expect(disposed).toBe(DISPOSED_TEXT_SHIMMER_STATE)
112
+ expect(view(disposed)).toEqual({ active: false, running: false })
113
+ ;[activate, deactivate, { type: "settled", attempt: 1 } as const, DISPOSED_TEXT_SHIMMER_EVENT].forEach((event) =>
114
+ expect(transitionTextShimmer(disposed, event)).toBe(disposed),
115
+ )
116
+ })
117
+ })
@@ -0,0 +1,64 @@
1
+ import { TextShimmer } from "./text-shimmer"
2
+
3
+ type Args = { text: string; active: boolean; offset: number; as: "span" | "div" }
4
+
5
+ const typography = { "font-size": "13px", "font-weight": "440", "font-family": "var(--font-family-sans)" }
6
+
7
+ const docs = `### Overview
8
+ Animated shimmer effect for loading text placeholders.
9
+
10
+ ### API
11
+ - Required: \`text\` string.
12
+ - Optional: \`as\`, \`active\`, \`offset\`, \`class\`.
13
+
14
+ ### Behavior
15
+ - Uses a moving gradient sweep clipped to text.
16
+ - \`offset\` lets multiple shimmers run out-of-phase.
17
+
18
+ ### Accessibility
19
+ - Uses \`aria-label\` with the full text.
20
+
21
+ ### Theming
22
+ - Uses \`data-component="text-shimmer"\` and CSS custom properties for timing and colors.
23
+ `
24
+
25
+ export default {
26
+ title: "UI/TextShimmer",
27
+ id: "ui-text-shimmer",
28
+ component: TextShimmer,
29
+ tags: ["autodocs"],
30
+ args: { text: "Loading...", active: true, offset: 0, as: "span" },
31
+ argTypes: {
32
+ as: { control: "select", options: ["span", "div"] },
33
+ offset: { control: { type: "range", min: 0, max: 30, step: 1 } },
34
+ },
35
+ render: (args: Args) => (
36
+ <div style={typography}>
37
+ <TextShimmer {...args} />
38
+ </div>
39
+ ),
40
+ parameters: {
41
+ frameBackground: "#fff",
42
+ layout: "padded",
43
+ docs: {
44
+ description: {
45
+ component: docs,
46
+ },
47
+ },
48
+ },
49
+ }
50
+
51
+ export const Active = {}
52
+
53
+ export const Inactive = { args: { text: "Static text", active: false } }
54
+
55
+ export const WithOffset = {
56
+ args: { text: "First line", offset: 5 },
57
+ render: (args: Args) => (
58
+ <div style={{ ...typography, display: "grid", gap: "8px" }}>
59
+ <TextShimmer {...args} offset={0} />
60
+ <TextShimmer {...args} text="Second line" />
61
+ <TextShimmer {...args} text="Third line" offset={args.offset * 2} />
62
+ </div>
63
+ ),
64
+ }
@@ -0,0 +1,19 @@
1
+ import type { ComponentProps } from "solid-js"
2
+ import { Wordmark } from "./wordmark"
3
+
4
+ export default {
5
+ title: "UI/Wordmark",
6
+ id: "ui-wordmark",
7
+ component: Wordmark,
8
+ tags: ["autodocs"],
9
+ args: { fade: true, muted: true, outline: false },
10
+ render: (args: ComponentProps<typeof Wordmark>) => (
11
+ <div style={{ width: "360px", color: "var(--text-base)" }}>
12
+ <Wordmark {...args} />
13
+ </div>
14
+ ),
15
+ }
16
+
17
+ export const Basic = {}
18
+
19
+ export const Outline = { args: { outline: true, muted: false, fade: false } }
@@ -0,0 +1,20 @@
1
+ import { plugin } from "bun"
2
+
3
+ // Bun transpiles TSX against the tsconfig `jsxImportSource`, but `solid-js/jsx-runtime` has no runtime
4
+ // exports because Solid's compiler normally replaces JSX. Tests run without that compiler, so compile
5
+ // JSX against Solid's hyperscript runtime instead.
6
+ const transpiler = new Bun.Transpiler({
7
+ loader: "tsx",
8
+ trimUnusedImports: true,
9
+ tsconfig: { compilerOptions: { jsx: "react-jsx", jsxImportSource: "solid-js/h" } },
10
+ })
11
+
12
+ plugin({
13
+ name: "solid-jsx-runtime",
14
+ setup(build) {
15
+ build.onLoad({ filter: /\.[jt]sx$/ }, async (args) => ({
16
+ contents: transpiler.transformSync(await Bun.file(args.path).text()),
17
+ loader: "js",
18
+ }))
19
+ },
20
+ })
@@ -0,0 +1,14 @@
1
+ {
2
+ "$schema": "https://json.schemastore.org/tsconfig",
3
+ "extends": "./tsconfig.json",
4
+ "compilerOptions": {
5
+ "rootDir": "src",
6
+ "outDir": "dist",
7
+ "noEmit": false,
8
+ // Publish declarations so consumer compiler options do not typecheck our TSX implementation.
9
+ "declaration": true,
10
+ "emitDeclarationOnly": true
11
+ },
12
+ "include": ["src"],
13
+ "exclude": ["**/*.stories.*", "**/*.test.*", "**/*.mdx"]
14
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,23 @@
1
+ {
2
+ "$schema": "https://json.schemastore.org/tsconfig",
3
+ "extends": "@tsconfig/node22/tsconfig.json",
4
+ "compilerOptions": {
5
+ "noUnusedLocals": true,
6
+ // General
7
+ "jsx": "preserve",
8
+ "jsxImportSource": "solid-js",
9
+ "target": "ESNext",
10
+ // Modules
11
+ "allowSyntheticDefaultImports": true,
12
+ "esModuleInterop": true,
13
+ "isolatedModules": true,
14
+ "module": "ESNext",
15
+ "moduleResolution": "bundler",
16
+ "noEmit": true,
17
+ "lib": ["es2023", "dom", "dom.iterable"],
18
+ // Type Checking & Safety
19
+ "strict": true,
20
+ "types": ["vite/client", "bun"]
21
+ },
22
+ "exclude": ["**/*.stories.*", "**/*.mdx"]
23
+ }
package/vite.config.ts ADDED
@@ -0,0 +1,61 @@
1
+ import { defineConfig } from "vite"
2
+ import solidPlugin from "vite-plugin-solid"
3
+ import { iconsSpritesheet } from "vite-plugin-icons-spritesheet"
4
+ import fs from "fs"
5
+
6
+ export default defineConfig({
7
+ plugins: [
8
+ solidPlugin(),
9
+ providerIconsPlugin(),
10
+ iconsSpritesheet([
11
+ {
12
+ withTypes: true,
13
+ inputDir: "src/assets/icons/file-types",
14
+ outputDir: "src/components/file-icons",
15
+ formatter: "prettier",
16
+ },
17
+ {
18
+ withTypes: true,
19
+ inputDir: "src/assets/icons/provider",
20
+ outputDir: "src/components/provider-icons",
21
+ formatter: "prettier",
22
+ iconNameTransformer: (iconName) => iconName,
23
+ },
24
+ ]),
25
+ ],
26
+ server: { port: 3001 },
27
+ build: {
28
+ target: "esnext",
29
+ },
30
+ worker: {
31
+ format: "es",
32
+ },
33
+ })
34
+
35
+ function providerIconsPlugin() {
36
+ return {
37
+ name: "provider-icons-plugin",
38
+ configureServer() {
39
+ void fetchProviderIcons()
40
+ },
41
+ buildStart() {
42
+ void fetchProviderIcons()
43
+ },
44
+ }
45
+ }
46
+
47
+ async function fetchProviderIcons() {
48
+ const url = process.env.OPENCODE_MODELS_URL || "https://models.opencode.ai"
49
+
50
+ const providers = await fetch(`${url}/api.json`)
51
+ .then((res) => res.json())
52
+ .then((json) => Object.keys(json))
53
+
54
+ await Promise.all(
55
+ providers.map((provider) =>
56
+ fetch(`${url}/logos/${provider}.svg`)
57
+ .then((res) => res.text())
58
+ .then((svg) => fs.writeFileSync(`./src/assets/icons/provider/${provider}.svg`, svg)),
59
+ ),
60
+ )
61
+ }