@zyro-sec/ui 1.0.0 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (256) hide show
  1. package/AGENTS.md +29 -0
  2. package/bunfig.toml +2 -0
  3. package/package.json +21 -40
  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,363 @@
1
+ import { createEffect, For, onCleanup } from "solid-js"
2
+ import { createStore } from "solid-js/store"
3
+ import { TextReveal } from "./text-reveal"
4
+
5
+ const defaults = {
6
+ text: "Refactor ToolStatusTitle DOM measurement",
7
+ growOnly: true,
8
+ truncate: false,
9
+ duration: 600,
10
+ bounce: 1,
11
+ bounceSoft: 1,
12
+ hybridTravel: 25,
13
+ hybridEdge: 17,
14
+ edge: 17,
15
+ revealTravel: 0,
16
+ }
17
+
18
+ export default {
19
+ title: "UI/TextReveal",
20
+ id: "components-text-reveal",
21
+ tags: ["autodocs"],
22
+ component: TextReveal,
23
+ args: defaults,
24
+ argTypes: {
25
+ duration: { control: { type: "range", min: 100, max: 1400, step: 10 } },
26
+ bounce: { control: { type: "range", min: 1, max: 2, step: 0.01 } },
27
+ bounceSoft: { control: { type: "range", min: 1, max: 1.5, step: 0.01 } },
28
+ hybridTravel: { control: { type: "range", min: 0, max: 40, step: 1 } },
29
+ hybridEdge: { control: { type: "range", min: 0, max: 40, step: 1 } },
30
+ edge: { control: { type: "range", min: 0, max: 40, step: 1 } },
31
+ revealTravel: { control: { type: "range", min: 0, max: 16, step: 1 } },
32
+ },
33
+ parameters: {
34
+ docs: {
35
+ description: {
36
+ component: `### Overview
37
+ Playground for the TextReveal text transition component.
38
+
39
+ **Hybrid** — mask wipe + vertical slide: gradient sweeps AND text moves downward.
40
+
41
+ **Wipe only** — pure mask wipe: gradient sweeps top-to-bottom, text stays in place.`,
42
+ },
43
+ },
44
+ },
45
+ }
46
+
47
+ const TEXTS = [
48
+ defaults.text,
49
+ "Remove inline measure nodes",
50
+ "Run typechecks and report changes",
51
+ "Verify reduced-motion behavior",
52
+ "Review diff for animation edge cases",
53
+ "Check keyboard semantics",
54
+ undefined,
55
+ "Planning key generation details",
56
+ "Analyzing error handling",
57
+ "Considering edge cases",
58
+ ]
59
+
60
+ const btn = (accent?: boolean) =>
61
+ ({
62
+ padding: "5px 12px",
63
+ "border-radius": "6px",
64
+ border: accent ? "1px solid var(--color-accent, #58f)" : "1px solid var(--color-divider, #333)",
65
+ background: accent ? "var(--color-accent, #58f)" : "var(--color-fill-element, #222)",
66
+ color: "var(--color-text, #eee)",
67
+ cursor: "pointer",
68
+ "font-size": "12px",
69
+ }) as const
70
+
71
+ const sliderLabel = {
72
+ width: "90px",
73
+ "font-size": "12px",
74
+ color: "var(--color-text-secondary, #a3a3a3)",
75
+ "flex-shrink": "0",
76
+ } as const
77
+
78
+ const cardStyle = {
79
+ padding: "20px 24px",
80
+ "border-radius": "10px",
81
+ border: "1px solid var(--color-divider, #333)",
82
+ background: "var(--color-fill-element, #1a1a1a)",
83
+ display: "grid",
84
+ gap: "12px",
85
+ } as const
86
+
87
+ const cardLabel = {
88
+ "font-size": "11px",
89
+ "font-family": "monospace",
90
+ color: "var(--color-text-weak, #666)",
91
+ } as const
92
+
93
+ const previewRow = {
94
+ display: "flex",
95
+ "align-items": "center",
96
+ gap: "8px",
97
+ "font-size": "14px",
98
+ "font-weight": "500",
99
+ "line-height": "20px",
100
+ color: "var(--text-weak, #aaa)",
101
+ "min-height": "20px",
102
+ overflow: "visible",
103
+ } as const
104
+
105
+ const headingSlot = {
106
+ "min-width": "0",
107
+ overflow: "visible",
108
+ color: "var(--text-weaker, #888)",
109
+ "font-weight": "400",
110
+ } as const
111
+
112
+ export const Playground = {
113
+ render: (args: typeof defaults) => {
114
+ const [state, setState] = createStore({
115
+ ...defaults,
116
+ index: 0,
117
+ cycling: false,
118
+ })
119
+
120
+ for (const key of [
121
+ "duration",
122
+ "bounce",
123
+ "bounceSoft",
124
+ "hybridTravel",
125
+ "hybridEdge",
126
+ "edge",
127
+ "revealTravel",
128
+ ] as const) {
129
+ createEffect(() => setState(key, args[key]))
130
+ }
131
+
132
+ createEffect(() => setState("growOnly", args.growOnly))
133
+ createEffect(() => {
134
+ setState("text", args.text)
135
+ setState("index", 0)
136
+ })
137
+
138
+ const index = () => state.index
139
+ const cycling = () => state.cycling
140
+ const growOnly = () => state.growOnly
141
+ const duration = () => state.duration
142
+ const bounce = () => state.bounce
143
+ const bounceSoft = () => state.bounceSoft
144
+ const hybridTravel = () => state.hybridTravel
145
+ const hybridEdge = () => state.hybridEdge
146
+ const edge = () => state.edge
147
+ const revealTravel = () => state.revealTravel
148
+
149
+ let timer: number | undefined
150
+ const text = () => (index() === 0 ? state.text || undefined : TEXTS[index()])
151
+ const next = () => setState("index", (value) => (value + 1) % TEXTS.length)
152
+ const prev = () => setState("index", (value) => (value - 1 + TEXTS.length) % TEXTS.length)
153
+
154
+ const toggleCycle = () => {
155
+ if (cycling()) {
156
+ if (timer) clearTimeout(timer)
157
+ timer = undefined
158
+ setState("cycling", false)
159
+
160
+ return
161
+ }
162
+
163
+ setState("cycling", true)
164
+
165
+ const tick = () => {
166
+ next()
167
+ timer = window.setTimeout(tick, 700 + Math.floor(Math.random() * 600))
168
+ }
169
+
170
+ timer = window.setTimeout(tick, 700 + Math.floor(Math.random() * 600))
171
+ }
172
+
173
+ onCleanup(() => {
174
+ if (timer) clearTimeout(timer)
175
+ })
176
+
177
+ const spring = () => `cubic-bezier(0.34, ${bounce()}, 0.64, 1)`
178
+ const springSoft = () => `cubic-bezier(0.34, ${bounceSoft()}, 0.64, 1)`
179
+
180
+ return (
181
+ <div style={{ display: "grid", gap: "24px", padding: "20px", "max-width": "700px" }}>
182
+ <div style={{ display: "grid", gap: "16px" }}>
183
+ <div style={cardStyle}>
184
+ <span style={cardLabel}>text-reveal (mask wipe + slide)</span>
185
+ <div style={previewRow}>
186
+ <span>Thinking</span>
187
+ <span style={{ ...headingSlot, width: args.truncate ? "180px" : undefined }}>
188
+ <TextReveal
189
+ class="text-14-regular"
190
+ text={text()}
191
+ duration={duration()}
192
+ edge={hybridEdge()}
193
+ travel={hybridTravel()}
194
+ spring={spring()}
195
+ springSoft={springSoft()}
196
+ growOnly={growOnly()}
197
+ truncate={args.truncate}
198
+ />
199
+ </span>
200
+ </div>
201
+ </div>
202
+
203
+ <div style={cardStyle}>
204
+ <span style={cardLabel}>text-reveal (mask wipe only)</span>
205
+ <div style={previewRow}>
206
+ <span>Thinking</span>
207
+ <span style={{ ...headingSlot, width: args.truncate ? "180px" : undefined }}>
208
+ <TextReveal
209
+ class="text-14-regular"
210
+ text={text()}
211
+ duration={duration()}
212
+ edge={edge()}
213
+ travel={revealTravel()}
214
+ spring={spring()}
215
+ springSoft={springSoft()}
216
+ growOnly={growOnly()}
217
+ truncate={args.truncate}
218
+ />
219
+ </span>
220
+ </div>
221
+ </div>
222
+ </div>
223
+
224
+ <div style={{ display: "flex", gap: "6px", "flex-wrap": "wrap" }}>
225
+ <For each={TEXTS}>
226
+ {(t, i) => (
227
+ <button onClick={() => setState("index", i())} style={btn(index() === i())}>
228
+ {(i() === 0 ? state.text : t) || "(none)"}
229
+ </button>
230
+ )}
231
+ </For>
232
+ </div>
233
+
234
+ <div style={{ display: "flex", gap: "8px", "flex-wrap": "wrap" }}>
235
+ <button onClick={prev} style={btn()}>
236
+ Prev
237
+ </button>
238
+ <button onClick={next} style={btn()}>
239
+ Next
240
+ </button>
241
+ <button onClick={toggleCycle} style={btn(cycling())}>
242
+ {cycling() ? "Stop cycle" : "Auto cycle"}
243
+ </button>
244
+ <button onClick={() => setState("growOnly", (value) => !value)} style={btn(growOnly())}>
245
+ {growOnly() ? "growOnly: on" : "growOnly: off"}
246
+ </button>
247
+ </div>
248
+
249
+ <div style={{ display: "grid", gap: "8px", "max-width": "480px" }}>
250
+ <div style={{ "font-size": "11px", color: "var(--color-text-weak, #666)" }}>Hybrid (wipe + slide)</div>
251
+
252
+ <label style={{ display: "flex", "align-items": "center", gap: "12px" }}>
253
+ <span style={sliderLabel}>edge</span>
254
+ <input
255
+ type="range"
256
+ min="1"
257
+ max="40"
258
+ step="1"
259
+ value={hybridEdge()}
260
+ onInput={(e) => setState("hybridEdge", e.currentTarget.valueAsNumber)}
261
+ style={{ flex: 1 }}
262
+ />
263
+ <span style={{ width: "60px", "text-align": "right", "font-size": "12px" }}>{hybridEdge()}%</span>
264
+ </label>
265
+
266
+ <label style={{ display: "flex", "align-items": "center", gap: "12px" }}>
267
+ <span style={sliderLabel}>travel</span>
268
+ <input
269
+ type="range"
270
+ min="0"
271
+ max="40"
272
+ step="1"
273
+ value={hybridTravel()}
274
+ onInput={(e) => setState("hybridTravel", e.currentTarget.valueAsNumber)}
275
+ style={{ flex: 1 }}
276
+ />
277
+ <span style={{ width: "60px", "text-align": "right", "font-size": "12px" }}>{hybridTravel()}px</span>
278
+ </label>
279
+
280
+ <div style={{ "font-size": "11px", color: "var(--color-text-weak, #666)", "margin-top": "8px" }}>Shared</div>
281
+
282
+ <label style={{ display: "flex", "align-items": "center", gap: "12px" }}>
283
+ <span style={sliderLabel}>duration</span>
284
+ <input
285
+ type="range"
286
+ min="100"
287
+ max="1400"
288
+ step="10"
289
+ value={duration()}
290
+ onInput={(e) => setState("duration", e.currentTarget.valueAsNumber)}
291
+ style={{ flex: 1 }}
292
+ />
293
+ <span style={{ width: "60px", "text-align": "right", "font-size": "12px" }}>{duration()}ms</span>
294
+ </label>
295
+
296
+ <label style={{ display: "flex", "align-items": "center", gap: "12px" }}>
297
+ <span style={sliderLabel}>bounce</span>
298
+ <input
299
+ type="range"
300
+ min="1"
301
+ max="2"
302
+ step="0.01"
303
+ value={bounce()}
304
+ onInput={(e) => setState("bounce", e.currentTarget.valueAsNumber)}
305
+ style={{ flex: 1 }}
306
+ />
307
+ <span style={{ width: "60px", "text-align": "right", "font-size": "12px" }}>{bounce().toFixed(2)}</span>
308
+ </label>
309
+
310
+ <label style={{ display: "flex", "align-items": "center", gap: "12px" }}>
311
+ <span style={sliderLabel}>bounce soft</span>
312
+ <input
313
+ type="range"
314
+ min="1"
315
+ max="1.5"
316
+ step="0.01"
317
+ value={bounceSoft()}
318
+ onInput={(e) => setState("bounceSoft", e.currentTarget.valueAsNumber)}
319
+ style={{ flex: 1 }}
320
+ />
321
+ <span style={{ width: "60px", "text-align": "right", "font-size": "12px" }}>{bounceSoft().toFixed(2)}</span>
322
+ </label>
323
+
324
+ <div style={{ "font-size": "11px", color: "var(--color-text-weak, #666)", "margin-top": "8px" }}>
325
+ Wipe only
326
+ </div>
327
+
328
+ <label style={{ display: "flex", "align-items": "center", gap: "12px" }}>
329
+ <span style={sliderLabel}>edge</span>
330
+ <input
331
+ type="range"
332
+ min="1"
333
+ max="40"
334
+ step="1"
335
+ value={edge()}
336
+ onInput={(e) => setState("edge", e.currentTarget.valueAsNumber)}
337
+ style={{ flex: 1 }}
338
+ />
339
+ <span style={{ width: "60px", "text-align": "right", "font-size": "12px" }}>{edge()}%</span>
340
+ </label>
341
+
342
+ <label style={{ display: "flex", "align-items": "center", gap: "12px" }}>
343
+ <span style={sliderLabel}>travel</span>
344
+ <input
345
+ type="range"
346
+ min="0"
347
+ max="16"
348
+ step="1"
349
+ value={revealTravel()}
350
+ onInput={(e) => setState("revealTravel", e.currentTarget.valueAsNumber)}
351
+ style={{ flex: 1 }}
352
+ />
353
+ <span style={{ width: "60px", "text-align": "right", "font-size": "12px" }}>{revealTravel()}px</span>
354
+ </label>
355
+ </div>
356
+
357
+ <div style={{ "font-size": "11px", color: "var(--color-text-weak, #888)", "font-family": "monospace" }}>
358
+ text: {text() ?? "(none)"} · growOnly: {growOnly() ? "on" : "off"}
359
+ </div>
360
+ </div>
361
+ )
362
+ },
363
+ }
@@ -0,0 +1,296 @@
1
+ import { createEffect, createSignal, onMount } from "solid-js"
2
+ import { createResizeObserver } from "@solid-primitives/resize-observer"
3
+ import { createStore } from "solid-js/store"
4
+ import { useSpring } from "./motion-spring"
5
+ import { TextStrikethrough } from "./text-strikethrough"
6
+
7
+ const TEXT_SHORT = "Remove inline measure nodes"
8
+
9
+ const TEXT_MED = "Remove inline measure nodes and keep width morph behavior intact"
10
+
11
+ const TEXT_LONG =
12
+ "Refactor ToolStatusTitle DOM measurement to offscreen global measurer (unconstrained by timeline layout)"
13
+
14
+ const btn = (active?: boolean) =>
15
+ ({
16
+ padding: "8px 18px",
17
+ "border-radius": "6px",
18
+ border: "1px solid var(--color-divider, #444)",
19
+ background: active ? "var(--color-accent, #58f)" : "var(--color-fill-element, #222)",
20
+ color: "var(--color-text, #eee)",
21
+ cursor: "pointer",
22
+ "font-size": "14px",
23
+ "font-weight": "500",
24
+ }) as const
25
+
26
+ const heading = {
27
+ "font-size": "11px",
28
+ "font-weight": "600",
29
+ "text-transform": "uppercase" as const,
30
+ "letter-spacing": "0.05em",
31
+ color: "var(--text-weak, #888)",
32
+ "margin-bottom": "4px",
33
+ }
34
+
35
+ const card = {
36
+ padding: "16px 20px",
37
+ "border-radius": "10px",
38
+ border: "1px solid var(--border-weak-base, #333)",
39
+ background: "var(--surface-base, #1a1a1a)",
40
+ }
41
+
42
+ /* ─── Variant A: scaleX pseudo-line at 50% ─── */
43
+ function VariantA(props: { active: boolean; text: string }) {
44
+ const progress = useSpring(
45
+ () => (props.active ? 1 : 0),
46
+ () => ({ visualDuration: 0.35, bounce: 0 }),
47
+ )
48
+
49
+ return (
50
+ <span
51
+ style={{
52
+ position: "relative",
53
+ display: "block",
54
+ color: props.active ? "var(--text-weak, #888)" : "var(--text-strong, #eee)",
55
+ transition: "color 220ms ease",
56
+ }}
57
+ >
58
+ {props.text}
59
+ <span
60
+ style={{
61
+ position: "absolute",
62
+ left: "0",
63
+ right: "0",
64
+ top: "50%",
65
+ height: "1.5px",
66
+ background: "currentColor",
67
+ "transform-origin": "left center",
68
+ transform: `scaleX(${progress()})`,
69
+ "pointer-events": "none",
70
+ }}
71
+ />
72
+ </span>
73
+ )
74
+ }
75
+
76
+ /* ─── Variant D: background-image line ─── */
77
+ function VariantD(props: { active: boolean; text: string }) {
78
+ const progress = useSpring(
79
+ () => (props.active ? 1 : 0),
80
+ () => ({ visualDuration: 0.35, bounce: 0 }),
81
+ )
82
+
83
+ return (
84
+ <span
85
+ style={{
86
+ display: "block",
87
+ color: props.active ? "var(--text-weak, #888)" : "var(--text-strong, #eee)",
88
+ transition: "color 220ms ease",
89
+ "background-image": "linear-gradient(currentColor, currentColor)",
90
+ "background-repeat": "no-repeat",
91
+ "background-size": `${progress() * 100}% 1.5px`,
92
+ "background-position": "left center",
93
+ }}
94
+ >
95
+ {props.text}
96
+ </span>
97
+ )
98
+ }
99
+
100
+ /* ─── Variant E: grid stacking + clip-path (container %) ─── */
101
+ function VariantE(props: { active: boolean; text: string }) {
102
+ const progress = useSpring(
103
+ () => (props.active ? 1 : 0),
104
+ () => ({ visualDuration: 0.35, bounce: 0 }),
105
+ )
106
+
107
+ return (
108
+ <span
109
+ style={{
110
+ display: "grid",
111
+ color: props.active ? "var(--text-weak, #888)" : "var(--text-strong, #eee)",
112
+ transition: "color 220ms ease",
113
+ }}
114
+ >
115
+ <span style={{ "grid-area": "1 / 1" }}>{props.text}</span>
116
+ <span
117
+ aria-hidden="true"
118
+ style={{
119
+ "grid-area": "1 / 1",
120
+ "text-decoration": "line-through",
121
+ "pointer-events": "none",
122
+ "clip-path": `inset(0 ${(1 - progress()) * 100}% 0 0)`,
123
+ }}
124
+ >
125
+ {props.text}
126
+ </span>
127
+ </span>
128
+ )
129
+ }
130
+
131
+ /* ─── Variant F: grid stacking + clip-path mapped to text width ─── */
132
+ function VariantF(props: { active: boolean; text: string }) {
133
+ const progress = useSpring(
134
+ () => (props.active ? 1 : 0),
135
+ () => ({ visualDuration: 0.35, bounce: 0 }),
136
+ )
137
+
138
+ let baseRef: HTMLSpanElement | undefined
139
+ let containerRef: HTMLSpanElement | undefined
140
+
141
+ const [state, setState] = createStore({
142
+ textWidth: 0,
143
+ containerWidth: 0,
144
+ })
145
+
146
+ const textWidth = () => state.textWidth
147
+ const containerWidth = () => state.containerWidth
148
+
149
+ const measure = () => {
150
+ if (baseRef) setState("textWidth", baseRef.scrollWidth)
151
+
152
+ if (containerRef) setState("containerWidth", containerRef.offsetWidth)
153
+ }
154
+
155
+ onMount(measure)
156
+ createResizeObserver(() => containerRef, measure)
157
+
158
+ const clipRight = () => {
159
+ const cw = containerWidth()
160
+ const tw = textWidth()
161
+
162
+ if (cw <= 0 || tw <= 0) return `${(1 - progress()) * 100}%`
163
+ const revealed = progress() * tw
164
+ const remaining = Math.max(0, cw - revealed)
165
+
166
+ return `${remaining}px`
167
+ }
168
+
169
+ return (
170
+ <span
171
+ ref={containerRef}
172
+ style={{
173
+ display: "grid",
174
+ color: props.active ? "var(--text-weak, #888)" : "var(--text-strong, #eee)",
175
+ transition: "color 220ms ease",
176
+ }}
177
+ >
178
+ <span ref={baseRef} style={{ "grid-area": "1 / 1" }}>
179
+ {props.text}
180
+ </span>
181
+ <span
182
+ aria-hidden="true"
183
+ style={{
184
+ "grid-area": "1 / 1",
185
+ "text-decoration": "line-through",
186
+ "pointer-events": "none",
187
+ "clip-path": `inset(0 ${clipRight()} 0 0)`,
188
+ }}
189
+ >
190
+ {props.text}
191
+ </span>
192
+ </span>
193
+ )
194
+ }
195
+
196
+ export default {
197
+ title: "UI/Text Strikethrough",
198
+ id: "components-text-strikethrough",
199
+ tags: ["autodocs"],
200
+ component: TextStrikethrough,
201
+ args: { active: false, text: TEXT_SHORT, visualDuration: 0.35 },
202
+ argTypes: { visualDuration: { control: { type: "range", min: 0.05, max: 1.5, step: 0.05 } } },
203
+ parameters: {
204
+ docs: {
205
+ description: {
206
+ component: `### Animated Strikethrough Variants
207
+
208
+ - **A** — scaleX line at 50% (single line only)
209
+ - **D** — background-image line (single line only)
210
+ - **E** — grid stacking + clip-path (container %)
211
+ - **F** — grid stacking + clip-path mapped to text width (the real component)`,
212
+ },
213
+ },
214
+ },
215
+ }
216
+
217
+ export const Playground = {
218
+ render: (args: { active: boolean; text: string; visualDuration: number }) => {
219
+ const [active, setActive] = createSignal(args.active)
220
+ createEffect(() => setActive(args.active))
221
+ const toggle = () => setActive((v) => !v)
222
+
223
+ return (
224
+ <div style={{ display: "grid", gap: "24px", padding: "24px", "max-width": "700px" }}>
225
+ <button onClick={toggle} style={btn(active())}>
226
+ {active() ? "Undo strikethrough" : "Strike through all"}
227
+ </button>
228
+
229
+ <div style={card}>
230
+ <div style={heading}>F — grid stacking + clip mapped to text width (THE COMPONENT)</div>
231
+ <TextStrikethrough
232
+ active={active()}
233
+ text={args.text}
234
+ visualDuration={args.visualDuration}
235
+ style={{
236
+ color: active() ? "var(--text-weak, #888)" : "var(--text-strong, #eee)",
237
+ transition: "color 220ms ease",
238
+ }}
239
+ />
240
+ <div style={{ "margin-top": "12px" }} />
241
+ <TextStrikethrough
242
+ active={active()}
243
+ text={TEXT_MED}
244
+ visualDuration={args.visualDuration}
245
+ style={{
246
+ color: active() ? "var(--text-weak, #888)" : "var(--text-strong, #eee)",
247
+ transition: "color 220ms ease",
248
+ }}
249
+ />
250
+ <div style={{ "margin-top": "12px" }} />
251
+ <TextStrikethrough
252
+ active={active()}
253
+ text={TEXT_LONG}
254
+ visualDuration={args.visualDuration}
255
+ style={{
256
+ color: active() ? "var(--text-weak, #888)" : "var(--text-strong, #eee)",
257
+ transition: "color 220ms ease",
258
+ }}
259
+ />
260
+ </div>
261
+
262
+ <div style={card}>
263
+ <div style={heading}>F (inline) — same but just inline variants</div>
264
+ <VariantF active={active()} text={args.text} />
265
+ <div style={{ "margin-top": "12px" }} />
266
+ <VariantF active={active()} text={TEXT_MED} />
267
+ <div style={{ "margin-top": "12px" }} />
268
+ <VariantF active={active()} text={TEXT_LONG} />
269
+ </div>
270
+
271
+ <div style={card}>
272
+ <div style={heading}>E — grid stacking + clip-path (container %)</div>
273
+ <VariantE active={active()} text={args.text} />
274
+ <div style={{ "margin-top": "12px" }} />
275
+ <VariantE active={active()} text={TEXT_MED} />
276
+ <div style={{ "margin-top": "12px" }} />
277
+ <VariantE active={active()} text={TEXT_LONG} />
278
+ </div>
279
+
280
+ <div style={card}>
281
+ <div style={heading}>A — scaleX line at 50%</div>
282
+ <VariantA active={active()} text={args.text} />
283
+ <div style={{ "margin-top": "12px" }} />
284
+ <VariantA active={active()} text={TEXT_LONG} />
285
+ </div>
286
+
287
+ <div style={card}>
288
+ <div style={heading}>D — background-image line</div>
289
+ <VariantD active={active()} text={args.text} />
290
+ <div style={{ "margin-top": "12px" }} />
291
+ <VariantD active={active()} text={TEXT_LONG} />
292
+ </div>
293
+ </div>
294
+ )
295
+ },
296
+ }