@zyro-sec/ui 1.0.1 → 1.0.3
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.
- package/AGENTS.md +29 -29
- package/LICENSE +21 -21
- package/bunfig.toml +2 -2
- package/package.json +76 -2
- package/perf/motion.bench.ts +14 -14
- package/perf/motion.ts +16 -16
- package/script/build-oc2-v2-overrides.ts +38 -38
- package/script/colors.txt +288 -288
- package/script/generate-spinner.ts +121 -121
- package/script/pack.ts +5 -5
- package/script/tailwind.ts +24 -24
- package/src/actions/button/button.css +346 -346
- package/src/actions/button/button.stories.tsx +158 -158
- package/src/actions/button/button.tsx +56 -56
- package/src/actions/icon-button/icon-button.css +128 -128
- package/src/actions/icon-button/icon-button.stories.tsx +122 -122
- package/src/actions/icon-button/icon-button.tsx +46 -46
- package/src/actions/split-button/split-button.css +99 -99
- package/src/actions/split-button/split-button.stories.tsx +59 -59
- package/src/actions/split-button/split-button.tsx +51 -51
- package/src/actions/submit.css +81 -81
- package/src/assets/favicon/favicon-v3.svg +6 -6
- package/src/assets/favicon/favicon.svg +6 -6
- package/src/assets/favicon/site.webmanifest +24 -24
- package/src/assets/icons/app/android-studio.svg +369 -369
- package/src/assets/icons/app/antigravity.svg +97 -97
- package/src/assets/icons/app/cursor.svg +16 -16
- package/src/assets/icons/app/file-explorer.svg +20 -20
- package/src/assets/icons/app/ghostty.svg +13 -13
- package/src/assets/icons/app/iterm2.svg +13 -13
- package/src/assets/icons/app/powershell.svg +14 -14
- package/src/assets/icons/app/sublimetext.svg +17 -17
- package/src/assets/icons/app/vscode.svg +39 -39
- package/src/assets/icons/app/windows-terminal.svg +6 -6
- package/src/assets/icons/app/zed-dark.svg +15 -15
- package/src/assets/icons/app/zed.svg +15 -15
- package/src/assets/icons/file-types/auto_light.svg +12 -12
- package/src/assets/icons/file-types/cursor.svg +1 -1
- package/src/assets/icons/file-types/cursor_light.svg +1 -1
- package/src/assets/icons/file-types/drone_light.svg +4 -4
- package/src/assets/icons/file-types/folder-admin-open.svg +6 -6
- package/src/assets/icons/file-types/folder-admin.svg +6 -6
- package/src/assets/icons/file-types/folder-circleci-open.svg +7 -7
- package/src/assets/icons/file-types/folder-circleci.svg +7 -7
- package/src/assets/icons/file-types/folder-flow-open.svg +6 -6
- package/src/assets/icons/file-types/folder-flow.svg +6 -6
- package/src/assets/icons/file-types/folder-gh-workflows-open.svg +6 -6
- package/src/assets/icons/file-types/folder-gh-workflows.svg +6 -6
- package/src/assets/icons/file-types/folder-github-open.svg +6 -6
- package/src/assets/icons/file-types/folder-github.svg +6 -6
- package/src/assets/icons/file-types/folder-intellij-open.svg +39 -39
- package/src/assets/icons/file-types/folder-intellij.svg +39 -39
- package/src/assets/icons/file-types/folder-macos-open.svg +6 -6
- package/src/assets/icons/file-types/folder-macos.svg +6 -6
- package/src/assets/icons/file-types/folder-next-open.svg +6 -6
- package/src/assets/icons/file-types/folder-next.svg +6 -6
- package/src/assets/icons/file-types/folder-nuxt-open.svg +6 -6
- package/src/assets/icons/file-types/folder-nuxt.svg +6 -6
- package/src/assets/icons/file-types/folder-open.svg +5 -5
- package/src/assets/icons/file-types/folder-scripts-open.svg +6 -6
- package/src/assets/icons/file-types/folder-scripts.svg +6 -6
- package/src/assets/icons/file-types/folder-target-open.svg +10 -10
- package/src/assets/icons/file-types/folder-target.svg +10 -10
- package/src/assets/icons/file-types/folder-turborepo-open.svg +15 -15
- package/src/assets/icons/file-types/folder-turborepo.svg +15 -15
- package/src/assets/icons/file-types/folder-vercel-open.svg +5 -5
- package/src/assets/icons/file-types/folder-vercel.svg +5 -5
- package/src/assets/icons/file-types/folder.svg +5 -5
- package/src/assets/icons/file-types/go_gopher.svg +35 -35
- package/src/assets/icons/file-types/nano-staged_light.svg +4 -4
- package/src/assets/icons/file-types/opa.svg +9 -9
- package/src/assets/icons/file-types/quarto.svg +5 -5
- package/src/assets/icons/file-types/rome.svg +6 -6
- package/src/assets/icons/file-types/stitches_light.svg +10 -10
- package/src/assets/icons/file-types/stylelint_light.svg +13 -13
- package/src/assets/icons/file-types/unocss.svg +5 -5
- package/src/assets/icons/file-types/vlang.svg +6 -6
- package/src/assets/icons/provider/302ai.svg +6 -6
- package/src/assets/icons/provider/abacus.svg +14 -14
- package/src/assets/icons/provider/aihubmix.svg +3 -3
- package/src/assets/icons/provider/alibaba-cn.svg +3 -3
- package/src/assets/icons/provider/alibaba-coding-plan-cn.svg +3 -3
- package/src/assets/icons/provider/alibaba-coding-plan.svg +3 -3
- package/src/assets/icons/provider/alibaba.svg +3 -3
- package/src/assets/icons/provider/amazon-bedrock.svg +3 -3
- package/src/assets/icons/provider/anthropic.svg +2 -2
- package/src/assets/icons/provider/azure-cognitive-services.svg +24 -24
- package/src/assets/icons/provider/azure.svg +3 -3
- package/src/assets/icons/provider/bailing.svg +3 -3
- package/src/assets/icons/provider/baseten.svg +3 -3
- package/src/assets/icons/provider/berget.svg +2 -2
- package/src/assets/icons/provider/cerebras.svg +4 -4
- package/src/assets/icons/provider/chutes.svg +24 -24
- package/src/assets/icons/provider/clarifai.svg +24 -24
- package/src/assets/icons/provider/claude-agent.svg +3 -3
- package/src/assets/icons/provider/cloudferro-sherlock.svg +4 -4
- package/src/assets/icons/provider/cloudflare-ai-gateway.svg +4 -4
- package/src/assets/icons/provider/cloudflare-workers-ai.svg +4 -4
- package/src/assets/icons/provider/cohere.svg +5 -5
- package/src/assets/icons/provider/cortecs.svg +24 -24
- package/src/assets/icons/provider/deepinfra.svg +4 -4
- package/src/assets/icons/provider/deepseek.svg +3 -3
- package/src/assets/icons/provider/digitalocean.svg +6 -6
- package/src/assets/icons/provider/dinference.svg +1 -1
- package/src/assets/icons/provider/drun.svg +8 -8
- package/src/assets/icons/provider/evroc.svg +2 -2
- package/src/assets/icons/provider/fastrouter.svg +3 -3
- package/src/assets/icons/provider/fireworks-ai.svg +3 -3
- package/src/assets/icons/provider/firmware.svg +18 -18
- package/src/assets/icons/provider/friendli.svg +3 -3
- package/src/assets/icons/provider/github-copilot.svg +3 -3
- package/src/assets/icons/provider/github-models.svg +3 -3
- package/src/assets/icons/provider/gitlab.svg +3 -3
- package/src/assets/icons/provider/google-vertex-anthropic.svg +24 -24
- package/src/assets/icons/provider/google-vertex.svg +10 -10
- package/src/assets/icons/provider/google.svg +3 -3
- package/src/assets/icons/provider/groq.svg +3 -3
- package/src/assets/icons/provider/helicone.svg +6 -6
- package/src/assets/icons/provider/huggingface.svg +3 -3
- package/src/assets/icons/provider/iflowcn.svg +3 -3
- package/src/assets/icons/provider/inception.svg +4 -4
- package/src/assets/icons/provider/inference.svg +3 -3
- package/src/assets/icons/provider/io-net.svg +5 -5
- package/src/assets/icons/provider/jiekou.svg +4 -4
- package/src/assets/icons/provider/kilo.svg +4 -4
- package/src/assets/icons/provider/kimi-for-coding.svg +3 -3
- package/src/assets/icons/provider/kuae-cloud-coding-plan.svg +3 -3
- package/src/assets/icons/provider/llama.svg +3 -3
- package/src/assets/icons/provider/lmstudio.svg +24 -24
- package/src/assets/icons/provider/lucidquery.svg +3 -3
- package/src/assets/icons/provider/meganova.svg +3 -3
- package/src/assets/icons/provider/meituan.svg +6 -6
- package/src/assets/icons/provider/meta.svg +3 -3
- package/src/assets/icons/provider/minimax-cn-coding-plan.svg +24 -24
- package/src/assets/icons/provider/minimax-cn.svg +3 -3
- package/src/assets/icons/provider/minimax-coding-plan.svg +24 -24
- package/src/assets/icons/provider/minimax.svg +3 -3
- package/src/assets/icons/provider/mistral.svg +3 -3
- package/src/assets/icons/provider/moark.svg +3 -3
- package/src/assets/icons/provider/modelscope.svg +5 -5
- package/src/assets/icons/provider/moonshotai-cn.svg +3 -3
- package/src/assets/icons/provider/moonshotai.svg +3 -3
- package/src/assets/icons/provider/morph.svg +24 -24
- package/src/assets/icons/provider/nano-gpt.svg +2 -2
- package/src/assets/icons/provider/nebius.svg +4 -4
- package/src/assets/icons/provider/nova.svg +3 -3
- package/src/assets/icons/provider/novita-ai.svg +10 -10
- package/src/assets/icons/provider/nvidia.svg +3 -3
- package/src/assets/icons/provider/ollama-cloud.svg +7 -7
- package/src/assets/icons/provider/openai.svg +3 -3
- package/src/assets/icons/provider/opencode-go.svg +3 -3
- package/src/assets/icons/provider/opencode.svg +3 -3
- package/src/assets/icons/provider/openrouter.svg +3 -3
- package/src/assets/icons/provider/ovhcloud.svg +3 -3
- package/src/assets/icons/provider/perplexity-agent.svg +3 -3
- package/src/assets/icons/provider/perplexity.svg +3 -3
- package/src/assets/icons/provider/poe.svg +7 -7
- package/src/assets/icons/provider/privatemode-ai.svg +4 -4
- package/src/assets/icons/provider/qihang-ai.svg +8 -8
- package/src/assets/icons/provider/qiniu-ai.svg +7 -7
- package/src/assets/icons/provider/reflection.svg +3 -3
- package/src/assets/icons/provider/requesty.svg +24 -24
- package/src/assets/icons/provider/sap-ai-core.svg +24 -24
- package/src/assets/icons/provider/scaleway.svg +5 -5
- package/src/assets/icons/provider/siliconflow-cn.svg +3 -3
- package/src/assets/icons/provider/siliconflow.svg +3 -3
- package/src/assets/icons/provider/stackit.svg +4 -4
- package/src/assets/icons/provider/stepfun.svg +16 -16
- package/src/assets/icons/provider/submodel.svg +3 -3
- package/src/assets/icons/provider/synthetic.svg +24 -24
- package/src/assets/icons/provider/tencent-coding-plan.svg +5 -5
- package/src/assets/icons/provider/tencent.svg +3 -3
- package/src/assets/icons/provider/thinkingmachines.svg +3 -3
- package/src/assets/icons/provider/togetherai.svg +4 -4
- package/src/assets/icons/provider/upstage.svg +24 -24
- package/src/assets/icons/provider/v0.svg +3 -3
- package/src/assets/icons/provider/venice.svg +4 -4
- package/src/assets/icons/provider/vercel.svg +3 -3
- package/src/assets/icons/provider/vivgrid.svg +4 -4
- package/src/assets/icons/provider/vultr.svg +6 -6
- package/src/assets/icons/provider/wandb.svg +24 -24
- package/src/assets/icons/provider/xai.svg +3 -3
- package/src/assets/icons/provider/xiaomi.svg +3 -3
- package/src/assets/icons/provider/zai-coding-plan.svg +3 -3
- package/src/assets/icons/provider/zai.svg +3 -3
- package/src/assets/icons/provider/zenmux.svg +4 -4
- package/src/assets/icons/provider/zhipuai-coding-plan.svg +3 -3
- package/src/assets/icons/provider/zhipuai.svg +3 -3
- package/src/components/animated-number-machine.ts +214 -214
- package/src/components/animated-number.css +110 -110
- package/src/components/animated-number.stories.tsx +35 -35
- package/src/components/animated-number.tsx +202 -202
- package/src/components/app-icon.css +5 -5
- package/src/components/app-icon.stories.tsx +73 -73
- package/src/components/app-icon.tsx +89 -89
- package/src/components/app-icons/sprite.svg +114 -114
- package/src/components/app-icons/types.ts +22 -22
- package/src/components/card.css +94 -94
- package/src/components/card.stories.tsx +101 -101
- package/src/components/card.tsx +145 -145
- package/src/components/collapsible.css +139 -139
- package/src/components/collapsible.stories.tsx +76 -76
- package/src/components/collapsible.tsx +62 -62
- package/src/components/context-menu.css +134 -134
- package/src/components/context-menu.stories.tsx +150 -150
- package/src/components/context-menu.tsx +342 -342
- package/src/components/diagram-preview.css +95 -95
- package/src/components/diagram-preview.stories.tsx +62 -62
- package/src/components/diagram-preview.tsx +332 -332
- package/src/components/dock-surface.css +30 -30
- package/src/components/dock-surface.stories.tsx +26 -26
- package/src/components/dock-surface.tsx +40 -40
- package/src/components/document-surface.css +37 -37
- package/src/components/document-surface.stories.tsx +42 -42
- package/src/components/document-surface.tsx +6 -6
- package/src/components/error-details.css +41 -41
- package/src/components/error-details.stories.tsx +72 -72
- package/src/components/error-details.tsx +13 -13
- package/src/components/favicon.stories.tsx +49 -49
- package/src/components/favicon.tsx +13 -13
- package/src/components/file-icon-machine.ts +78 -78
- package/src/components/file-icon.css +6 -6
- package/src/components/file-icon.stories.tsx +93 -93
- package/src/components/file-icon.tsx +186 -186
- package/src/components/file-icons/choose-icon-name.ts +574 -574
- package/src/components/file-icons/sprite.svg +11707 -11707
- package/src/components/file-icons/types.ts +1095 -1095
- package/src/components/font.stories.tsx +48 -48
- package/src/components/font.tsx +1 -1
- package/src/components/hover-card.css +61 -61
- package/src/components/hover-card.stories.tsx +79 -79
- package/src/components/hover-card.tsx +32 -32
- package/src/components/image-flight-machine.ts +247 -247
- package/src/components/image-flight.ts +161 -161
- package/src/components/image-preview.css +202 -202
- package/src/components/image-preview.stories.tsx +392 -392
- package/src/components/image-preview.tsx +908 -908
- package/src/components/image-zoom-machine.ts +191 -191
- package/src/components/image-zoom.ts +124 -124
- package/src/components/list.css +331 -331
- package/src/components/list.stories.tsx +221 -221
- package/src/components/list.tsx +322 -322
- package/src/components/logo.css +4 -4
- package/src/components/logo.stories.tsx +62 -62
- package/src/components/logo.tsx +62 -62
- package/src/components/menu-scroll.css +70 -70
- package/src/components/menu-scroll.stories.tsx +73 -73
- package/src/components/menu-scroll.tsx +202 -202
- package/src/components/motion-spring.tsx +65 -65
- package/src/components/popover-machine.ts +198 -198
- package/src/components/popover.css +66 -66
- package/src/components/popover.stories.tsx +84 -84
- package/src/components/popover.tsx +234 -234
- package/src/components/preview-controls.css +28 -28
- package/src/components/preview-controls.stories.tsx +40 -40
- package/src/components/preview-controls.tsx +53 -53
- package/src/components/progress.css +63 -63
- package/src/components/progress.stories.tsx +69 -69
- package/src/components/progress.tsx +39 -39
- package/src/components/provider-icon.css +5 -5
- package/src/components/provider-icon.stories.tsx +75 -75
- package/src/components/provider-icon.tsx +31 -31
- package/src/components/provider-icons/sprite.svg +1131 -1131
- package/src/components/provider-icons/types.ts +111 -111
- package/src/components/resize-handle-machine.ts +174 -174
- package/src/components/resize-handle.css +81 -81
- package/src/components/resize-handle.stories.tsx +81 -81
- package/src/components/resize-handle.tsx +164 -164
- package/src/components/rolling-number.css +24 -24
- package/src/components/rolling-number.stories.tsx +23 -23
- package/src/components/rolling-number.tsx +135 -135
- package/src/components/scroll-view-machine.ts +244 -244
- package/src/components/scroll-view.css +99 -99
- package/src/components/scroll-view.stories.tsx +68 -68
- package/src/components/scroll-view.tsx +653 -653
- package/src/components/spinner-frames.css +6 -6
- package/src/components/spinner-radar.ts +150 -150
- package/src/components/spinner.css +38 -38
- package/src/components/spinner.stories.tsx +40 -40
- package/src/components/spinner.tsx +43 -43
- package/src/components/sticky-accordion-header.css +11 -11
- package/src/components/sticky-accordion-header.stories.tsx +64 -64
- package/src/components/sticky-accordion-header.tsx +18 -18
- package/src/components/text-field-machine.ts +102 -102
- package/src/components/text-field.css +134 -134
- package/src/components/text-field.stories.tsx +132 -132
- package/src/components/text-field.tsx +196 -196
- package/src/components/text-reveal-machine.ts +184 -184
- package/src/components/text-reveal.css +150 -150
- package/src/components/text-reveal.stories.tsx +363 -363
- package/src/components/text-reveal.tsx +165 -165
- package/src/components/text-strikethrough.css +27 -27
- package/src/components/text-strikethrough.stories.tsx +296 -296
- package/src/components/text-strikethrough.tsx +92 -92
- package/src/components/thinking-heading.stories.tsx +900 -900
- package/src/components/truncated-text.css +25 -25
- package/src/components/truncated-text.stories.tsx +37 -37
- package/src/components/truncated-text.tsx +30 -30
- package/src/components/typewriter-machine.ts +134 -134
- package/src/components/typewriter.css +14 -14
- package/src/components/typewriter.stories.tsx +51 -51
- package/src/components/typewriter.tsx +70 -70
- package/src/context/dialog-machine.ts +281 -281
- package/src/context/dialog.tsx +376 -376
- package/src/context/file.tsx +11 -11
- package/src/context/focus-rescue.tsx +230 -230
- package/src/context/helper.tsx +43 -43
- package/src/context/highlight-theme.tsx +66 -66
- package/src/context/i18n.tsx +144 -144
- package/src/context/index.ts +7 -7
- package/src/context/marked-base.tsx +67 -67
- package/src/context/marked-parser.tsx +154 -154
- package/src/context/overlay-focus.tsx +90 -90
- package/src/custom-elements.d.ts +17 -17
- package/src/data-display/accordion/accordion.css +130 -130
- package/src/data-display/accordion/accordion.stories.tsx +76 -76
- package/src/data-display/accordion/accordion.tsx +106 -106
- package/src/data-display/avatar/avatar.css +70 -70
- package/src/data-display/avatar/avatar.stories.tsx +48 -48
- package/src/data-display/avatar/avatar.tsx +63 -63
- package/src/data-display/badge/badge.css +63 -63
- package/src/data-display/badge/badge.stories.tsx +75 -75
- package/src/data-display/badge/badge.tsx +26 -26
- package/src/data-display/diff-changes/diff-changes.css +47 -47
- package/src/data-display/diff-changes/diff-changes.stories.tsx +63 -63
- package/src/data-display/diff-changes/diff-changes.tsx +43 -43
- package/src/data-display/keybind/keybind.css +84 -84
- package/src/data-display/keybind/keybind.stories.tsx +77 -77
- package/src/data-display/keybind/keybind.tsx +31 -31
- package/src/data-display/line-comment/line-comment.css +341 -341
- package/src/data-display/line-comment/line-comment.stories.tsx +288 -288
- package/src/data-display/line-comment/line-comment.tsx +554 -554
- package/src/data-display/line-comment/machine.ts +400 -400
- package/src/data-display/line-comment/quote-check.svg +3 -3
- package/src/data-display/project-avatar/animation-machine.ts +182 -182
- package/src/data-display/project-avatar/animation.ts +133 -133
- package/src/data-display/project-avatar/generated.ts +225 -225
- package/src/data-display/project-avatar/procedural-craft.ts +1079 -1079
- package/src/data-display/project-avatar/procedural-kit.ts +244 -244
- package/src/data-display/project-avatar/procedural-machine.ts +924 -924
- package/src/data-display/project-avatar/procedural-world.ts +1542 -1542
- package/src/data-display/project-avatar/procedural.ts +1563 -1563
- package/src/data-display/project-avatar/project-avatar.css +189 -189
- package/src/data-display/project-avatar/project-avatar.stories.tsx +102 -102
- package/src/data-display/project-avatar/project-avatar.tsx +246 -246
- package/src/data-display/project-avatar/project-icon-styles.stories.tsx +772 -772
- package/src/feedback/activity-ring/activity-ring.css +5 -5
- package/src/feedback/activity-ring/activity-ring.stories.tsx +20 -20
- package/src/feedback/activity-ring/activity-ring.tsx +15 -15
- package/src/feedback/loader/loader.css +32 -32
- package/src/feedback/loader/loader.stories.tsx +44 -44
- package/src/feedback/loader/loader.tsx +34 -34
- package/src/feedback/progress-circle/progress-circle.css +28 -28
- package/src/feedback/progress-circle/progress-circle.stories.tsx +56 -56
- package/src/feedback/progress-circle/progress-circle.tsx +64 -64
- package/src/feedback/toast/description.ts +10 -10
- package/src/feedback/toast/machine.ts +115 -115
- package/src/feedback/toast/toast.css +234 -234
- package/src/feedback/toast/toast.stories.tsx +186 -186
- package/src/feedback/toast/toast.tsx +317 -317
- package/src/forms/checkbox/checkbox-compact.css +170 -170
- package/src/forms/checkbox/checkbox.css +125 -125
- package/src/forms/checkbox/checkbox.stories.tsx +104 -104
- package/src/forms/checkbox/checkbox.tsx +119 -119
- package/src/forms/field/field.css +94 -94
- package/src/forms/field/field.stories.tsx +129 -129
- package/src/forms/field/field.tsx +271 -271
- package/src/forms/inline-input/inline-input.css +16 -16
- package/src/forms/inline-input/inline-input.stories.tsx +37 -37
- package/src/forms/inline-input/inline-input.tsx +26 -26
- package/src/forms/radio/radio.css +218 -218
- package/src/forms/radio/radio.stories.tsx +145 -145
- package/src/forms/radio/radio.tsx +95 -95
- package/src/forms/redirect-paste/redirect-paste.stories.tsx +101 -101
- package/src/forms/redirect-paste/redirect-paste.tsx +92 -92
- package/src/forms/search-list/navigation.ts +54 -54
- package/src/forms/search-list/search-list.css +249 -249
- package/src/forms/search-list/search-list.stories.tsx +108 -108
- package/src/forms/search-list/search-list.tsx +463 -463
- package/src/forms/select/machine.ts +81 -81
- package/src/forms/select/select.css +312 -312
- package/src/forms/select/select.stories.tsx +208 -208
- package/src/forms/select/select.tsx +281 -281
- package/src/forms/switch/switch.css +281 -281
- package/src/forms/switch/switch.stories.tsx +97 -97
- package/src/forms/switch/switch.tsx +35 -35
- package/src/forms/text-input/text-input.css +229 -229
- package/src/forms/text-input/text-input.stories.tsx +220 -220
- package/src/forms/text-input/text-input.tsx +115 -115
- package/src/forms/textarea/textarea.css +103 -103
- package/src/forms/textarea/textarea.stories.tsx +137 -137
- package/src/forms/textarea/textarea.tsx +33 -33
- package/src/forms/typeahead/controller.ts +59 -59
- package/src/forms/typeahead/machine.ts +253 -253
- package/src/forms/typeahead/typeahead.stories.tsx +113 -113
- package/src/forms/typeahead/typeahead.tsx +239 -239
- package/src/hooks/auto-scroll-machine.ts +261 -261
- package/src/hooks/create-auto-scroll.tsx +196 -196
- package/src/hooks/index.ts +5 -5
- package/src/hooks/list-machine.ts +359 -359
- package/src/hooks/spin-phase.ts +116 -116
- package/src/hooks/use-filtered-list.tsx +132 -132
- package/src/i18n/am.ts +384 -384
- package/src/i18n/ar.ts +547 -547
- package/src/i18n/az.ts +386 -386
- package/src/i18n/bg.ts +386 -386
- package/src/i18n/bn.ts +393 -393
- package/src/i18n/br.ts +444 -444
- package/src/i18n/bs.ts +445 -445
- package/src/i18n/ca.ts +423 -423
- package/src/i18n/cs.ts +457 -457
- package/src/i18n/da.ts +407 -407
- package/src/i18n/de.ts +414 -414
- package/src/i18n/dv.ts +395 -395
- package/src/i18n/dz.ts +393 -393
- package/src/i18n/el.ts +388 -388
- package/src/i18n/en.ts +433 -433
- package/src/i18n/es.ts +443 -443
- package/src/i18n/et.ts +386 -386
- package/src/i18n/fa.ts +388 -388
- package/src/i18n/fi.ts +388 -388
- package/src/i18n/fo.ts +388 -388
- package/src/i18n/fr.ts +447 -447
- package/src/i18n/he.ts +422 -422
- package/src/i18n/hi.ts +392 -392
- package/src/i18n/hr.ts +422 -422
- package/src/i18n/hu.ts +388 -388
- package/src/i18n/hy.ts +389 -389
- package/src/i18n/id.ts +411 -411
- package/src/i18n/is.ts +388 -388
- package/src/i18n/it.ts +425 -425
- package/src/i18n/ja.ts +406 -406
- package/src/i18n/ka.ts +388 -388
- package/src/i18n/km.ts +389 -389
- package/src/i18n/ko.ts +408 -408
- package/src/i18n/lo.ts +387 -387
- package/src/i18n/lt.ts +457 -457
- package/src/i18n/lv.ts +421 -421
- package/src/i18n/mk.ts +387 -387
- package/src/i18n/mn.ts +386 -386
- package/src/i18n/ms.ts +389 -389
- package/src/i18n/my.ts +389 -389
- package/src/i18n/ne.ts +393 -393
- package/src/i18n/nl.ts +388 -388
- package/src/i18n/no.ts +413 -413
- package/src/i18n/pa.ts +394 -394
- package/src/i18n/pl.ts +476 -476
- package/src/i18n/ro.ts +423 -423
- package/src/i18n/ru.ts +475 -475
- package/src/i18n/si.ts +390 -390
- package/src/i18n/sk.ts +457 -457
- package/src/i18n/sl.ts +457 -457
- package/src/i18n/sq.ts +387 -387
- package/src/i18n/sr.ts +422 -422
- package/src/i18n/sv.ts +388 -388
- package/src/i18n/tg.ts +390 -390
- package/src/i18n/th.ts +407 -407
- package/src/i18n/tk.ts +386 -386
- package/src/i18n/tr.ts +412 -412
- package/src/i18n/uk.ts +480 -480
- package/src/i18n/ur.ts +394 -394
- package/src/i18n/uz.ts +390 -390
- package/src/i18n/vi.ts +387 -387
- package/src/i18n/zh.ts +408 -408
- package/src/i18n/zht.ts +408 -408
- package/src/icons/catalog.ts +638 -638
- package/src/icons/icon/icon.css +3 -3
- package/src/icons/icon/icon.stories.tsx +131 -131
- package/src/icons/icon/icon.tsx +106 -106
- package/src/icons/registry.ts +217 -217
- package/src/layout/divider/divider.css +11 -11
- package/src/layout/divider/divider.stories.tsx +38 -38
- package/src/layout/divider/divider.tsx +21 -21
- package/src/motion/README.md +113 -113
- package/src/motion/index.ts +13 -13
- package/src/motion/loop.ts +139 -139
- package/src/motion/reduced.ts +66 -66
- package/src/motion/slider.ts +45 -45
- package/src/motion/solid.ts +309 -309
- package/src/motion/spring.ts +125 -125
- package/src/motion/velocity.ts +46 -46
- package/src/motion/waapi.ts +89 -89
- package/src/motion-tuning-features.ts +161 -161
- package/src/motion-tuning-fields.ts +42 -42
- package/src/motion-tuning.ts +323 -323
- package/src/navigation/menu/machine.ts +109 -109
- package/src/navigation/menu/menu.css +313 -313
- package/src/navigation/menu/menu.stories.tsx +328 -328
- package/src/navigation/menu/menu.tsx +600 -600
- package/src/navigation/menu/submenu-machine.ts +67 -67
- package/src/navigation/segmented-control/machine.ts +72 -72
- package/src/navigation/segmented-control/segmented-control.css +113 -113
- package/src/navigation/segmented-control/segmented-control.stories.tsx +115 -115
- package/src/navigation/segmented-control/segmented-control.tsx +396 -396
- package/src/navigation/tab-state-indicator.stories.tsx +24 -24
- package/src/navigation/tab-state-indicator.tsx +38 -38
- package/src/navigation/tabs/tabs-current.css +244 -244
- package/src/navigation/tabs/tabs.css +676 -676
- package/src/navigation/tabs/tabs.stories.tsx +193 -193
- package/src/navigation/tabs/tabs.tsx +212 -212
- package/src/overlays/dialog/dialog.css +194 -194
- package/src/overlays/dialog/dialog.stories.tsx +365 -365
- package/src/overlays/dialog/dialog.tsx +192 -192
- package/src/overlays/mcp-sign-in/machine.ts +343 -343
- package/src/overlays/mcp-sign-in/mcp-sign-in.ts +159 -159
- package/src/overlays/tooltip/machine.ts +312 -312
- package/src/overlays/tooltip/tooltip.css +102 -102
- package/src/overlays/tooltip/tooltip.stories.tsx +155 -155
- package/src/overlays/tooltip/tooltip.tsx +290 -290
- package/src/storybook/fixtures.ts +51 -51
- package/src/storybook/scaffold.tsx +65 -65
- package/src/styles/animations.css +13 -13
- package/src/styles/base.css +441 -441
- package/src/styles/blue-tokens.stories.tsx +215 -215
- package/src/styles/colors.css +772 -772
- package/src/styles/file-tree.css +285 -285
- package/src/styles/index.css +42 -42
- package/src/styles/scrollbar.css +79 -79
- package/src/styles/tailwind/colors.css +288 -288
- package/src/styles/tailwind/index.css +113 -113
- package/src/styles/tailwind/utilities.css +17 -17
- package/src/styles/theme.css +640 -640
- package/src/styles/tokens/colors.css +172 -172
- package/src/styles/tokens/index.css +2 -2
- package/src/styles/tokens/theme.css +522 -522
- package/src/styles/utilities.css +93 -93
- package/src/theme/color.ts +290 -290
- package/src/theme/context.tsx +361 -361
- package/src/theme/desktop-theme.schema.json +168 -168
- package/src/theme/index.ts +35 -35
- package/src/theme/machine.ts +508 -508
- package/src/theme/resolve.ts +561 -561
- package/src/theme/themes/amoled.json +49 -49
- package/src/theme/themes/aura.json +51 -51
- package/src/theme/themes/ayu.json +51 -51
- package/src/theme/themes/carbonfox.json +53 -53
- package/src/theme/themes/catppuccin-frappe.json +65 -65
- package/src/theme/themes/catppuccin-macchiato.json +65 -65
- package/src/theme/themes/catppuccin.json +45 -45
- package/src/theme/themes/cobalt2.json +87 -87
- package/src/theme/themes/cursor.json +91 -91
- package/src/theme/themes/dracula.json +49 -49
- package/src/theme/themes/everforest.json +89 -89
- package/src/theme/themes/flexoki.json +86 -86
- package/src/theme/themes/github.json +85 -85
- package/src/theme/themes/gruvbox.json +45 -45
- package/src/theme/themes/kanagawa.json +89 -89
- package/src/theme/themes/lucent-orng.json +87 -87
- package/src/theme/themes/material.json +87 -87
- package/src/theme/themes/matrix.json +113 -113
- package/src/theme/themes/mercury.json +86 -86
- package/src/theme/themes/monokai.json +49 -49
- package/src/theme/themes/nightowl.json +46 -46
- package/src/theme/themes/nord.json +46 -46
- package/src/theme/themes/oc-2.json +509 -509
- package/src/theme/themes/one-dark.json +89 -89
- package/src/theme/themes/onedarkpro.json +45 -45
- package/src/theme/themes/orng.json +87 -87
- package/src/theme/themes/osaka-jade.json +88 -88
- package/src/theme/themes/palenight.json +85 -85
- package/src/theme/themes/rosepine.json +85 -85
- package/src/theme/themes/shadesofpurple.json +51 -51
- package/src/theme/themes/solarized.json +49 -49
- package/src/theme/themes/synthwave84.json +87 -87
- package/src/theme/themes/tokyonight.json +47 -47
- package/src/theme/themes/vercel.json +90 -90
- package/src/theme/themes/vesper.json +51 -51
- package/src/theme/themes/zenburn.json +87 -87
- package/src/theme/types.ts +75 -75
- package/src/theme/v2/avatar.ts +48 -48
- package/src/theme/v2/default-primitives.ts +114 -114
- package/src/theme/v2/foreground.ts +69 -69
- package/src/theme/v2/mapping.ts +180 -180
- package/src/theme/v2/resolve.ts +163 -163
- package/src/typography/slash/slash.css +14 -14
- package/src/typography/slash/slash.stories.tsx +26 -26
- package/src/typography/slash/slash.tsx +16 -16
- package/src/typography/text-shimmer/machine.ts +90 -90
- package/src/typography/text-shimmer/text-shimmer.css +152 -152
- package/src/typography/text-shimmer/text-shimmer.stories.tsx +64 -64
- package/src/typography/text-shimmer/text-shimmer.tsx +81 -81
- package/src/typography/wordmark/wordmark.stories.tsx +19 -19
- package/src/typography/wordmark/wordmark.tsx +73 -73
- package/test/solid-jsx.ts +20 -20
- package/tsconfig.build.json +14 -14
- package/tsconfig.json +23 -23
- package/vite.config.ts +61 -61
- package/src/components/animated-number-machine.test.ts +0 -140
- package/src/components/file-icon-machine.test.ts +0 -52
- package/src/components/image-flight-machine.test.ts +0 -184
- package/src/components/image-flight.test.ts +0 -173
- package/src/components/image-zoom-machine.test.ts +0 -154
- package/src/components/image-zoom.test.ts +0 -96
- package/src/components/popover-machine.test.ts +0 -150
- package/src/components/resize-handle-machine.test.ts +0 -164
- package/src/components/scroll-view-machine.test.ts +0 -141
- package/src/components/scroll-view.test.ts +0 -114
- package/src/components/spinner-radar.test.ts +0 -61
- package/src/components/text-field-machine.test.ts +0 -99
- package/src/components/text-reveal-machine.test.ts +0 -157
- package/src/components/typewriter-machine.test.ts +0 -177
- package/src/context/dialog-machine.test.ts +0 -295
- package/src/context/i18n.test.ts +0 -89
- package/src/context/marked-base.test.ts +0 -75
- package/src/context/marked-parser.test.ts +0 -167
- package/src/context/marked-regression.test.ts +0 -12
- package/src/data-display/line-comment/machine.test.ts +0 -385
- package/src/data-display/project-avatar/animation-machine.test.ts +0 -134
- package/src/data-display/project-avatar/generated.test.ts +0 -50
- package/src/data-display/project-avatar/procedural.test.ts +0 -16
- package/src/data-display/project-avatar/project-avatar.test.ts +0 -21
- package/src/feedback/toast/description.test.ts +0 -20
- package/src/feedback/toast/machine.test.ts +0 -106
- package/src/forms/search-list/navigation.test.ts +0 -40
- package/src/forms/select/machine.test.ts +0 -105
- package/src/forms/typeahead/machine.test.ts +0 -143
- package/src/hooks/auto-scroll-machine.test.ts +0 -212
- package/src/hooks/list-machine.test.ts +0 -263
- package/src/hooks/spin-phase.test.ts +0 -32
- package/src/hooks/use-filtered-list.test.ts +0 -41
- package/src/motion/core.test.ts +0 -328
- package/src/motion-tuning-features.test.ts +0 -129
- package/src/motion-tuning.test.ts +0 -68
- package/src/navigation/menu/machine.test.ts +0 -85
- package/src/navigation/menu/submenu-machine.test.ts +0 -71
- package/src/navigation/segmented-control/segmented-control.test.ts +0 -123
- package/src/overlays/mcp-sign-in/machine.test.ts +0 -215
- package/src/overlays/tooltip/machine.test.ts +0 -214
- package/src/theme/machine.test.ts +0 -498
- package/src/theme/v2/resolve.test.ts +0 -120
- package/src/typography/text-shimmer/machine.test.ts +0 -117
|
@@ -1,385 +0,0 @@
|
|
|
1
|
-
import { describe, expect, test } from "bun:test"
|
|
2
|
-
import {
|
|
3
|
-
createLineCommentEditorState,
|
|
4
|
-
parseMentionToken,
|
|
5
|
-
transitionLineCommentEditor,
|
|
6
|
-
viewLineCommentEditor,
|
|
7
|
-
type LineCommentEditorConfig,
|
|
8
|
-
type LineCommentEditorEvent,
|
|
9
|
-
type LineCommentEditorKey,
|
|
10
|
-
type LineCommentEditorState,
|
|
11
|
-
type LineCommentEditorTransition,
|
|
12
|
-
} from "./machine"
|
|
13
|
-
|
|
14
|
-
const config = (patch: Partial<LineCommentEditorConfig> = {}): LineCommentEditorConfig => ({
|
|
15
|
-
value: "",
|
|
16
|
-
allowEmpty: false,
|
|
17
|
-
variant: "compact",
|
|
18
|
-
alternateSubmit: null,
|
|
19
|
-
submitting: false,
|
|
20
|
-
...patch,
|
|
21
|
-
})
|
|
22
|
-
|
|
23
|
-
// The token the driver reads from the textarea with the caret at the end of `value`.
|
|
24
|
-
const typed = (value: string): LineCommentEditorEvent => ({
|
|
25
|
-
type: "mention.synced",
|
|
26
|
-
token: parseMentionToken(value, value.length, value.length),
|
|
27
|
-
})
|
|
28
|
-
|
|
29
|
-
const key = (
|
|
30
|
-
name: string,
|
|
31
|
-
settings: LineCommentEditorConfig,
|
|
32
|
-
patch: Partial<Omit<LineCommentEditorKey, "key">> = {},
|
|
33
|
-
): LineCommentEditorEvent => ({
|
|
34
|
-
type: "key.down",
|
|
35
|
-
target: "textarea",
|
|
36
|
-
key: name,
|
|
37
|
-
ctrl: false,
|
|
38
|
-
meta: false,
|
|
39
|
-
alt: false,
|
|
40
|
-
shift: false,
|
|
41
|
-
repeat: false,
|
|
42
|
-
...patch,
|
|
43
|
-
config: settings,
|
|
44
|
-
})
|
|
45
|
-
|
|
46
|
-
function run(state: LineCommentEditorState, ...events: LineCommentEditorEvent[]) {
|
|
47
|
-
return events.reduce<LineCommentEditorTransition>(
|
|
48
|
-
(result, event) => {
|
|
49
|
-
const next = transitionLineCommentEditor(result.state, event)
|
|
50
|
-
|
|
51
|
-
return { state: next.state, effects: [...result.effects, ...next.effects], handled: next.handled }
|
|
52
|
-
},
|
|
53
|
-
{ state, effects: [], handled: false },
|
|
54
|
-
)
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
const attemptOf = (state: LineCommentEditorState) => (state.status === "disposed" ? -1 : state.attempt)
|
|
58
|
-
|
|
59
|
-
describe("line comment editor machine", () => {
|
|
60
|
-
test("Enter and Tab wait for a refined search only while the previous list is on screen", () => {
|
|
61
|
-
const settings = config({ value: "Check @src/a" })
|
|
62
|
-
|
|
63
|
-
const open = run(createLineCommentEditorState(), typed("Check @src"), {
|
|
64
|
-
type: "mention.loaded",
|
|
65
|
-
attempt: 1,
|
|
66
|
-
items: ["server.ts"],
|
|
67
|
-
})
|
|
68
|
-
|
|
69
|
-
const refining = run(open.state, typed("Check @src/a"))
|
|
70
|
-
|
|
71
|
-
expect(refining.state.status).toBe("mention-loading")
|
|
72
|
-
expect(refining.effects).toEqual([{ type: "mention.load", attempt: 2, query: "src/a" }])
|
|
73
|
-
|
|
74
|
-
for (const name of ["Enter", "Tab"]) {
|
|
75
|
-
const pressed = transitionLineCommentEditor(refining.state, key(name, settings))
|
|
76
|
-
|
|
77
|
-
expect(pressed.handled).toBe(true)
|
|
78
|
-
expect(pressed.effects).toEqual([])
|
|
79
|
-
expect(pressed.state).toBe(refining.state)
|
|
80
|
-
}
|
|
81
|
-
})
|
|
82
|
-
|
|
83
|
-
test("with no list on screen, Enter sends at once and Tab leaves the field while a search runs", () => {
|
|
84
|
-
const settings = config({ value: "mail a@b.com" })
|
|
85
|
-
const loading = run(createLineCommentEditorState(), typed("mail a@b.com"))
|
|
86
|
-
|
|
87
|
-
expect(loading.state.status).toBe("mention-loading")
|
|
88
|
-
|
|
89
|
-
const enter = transitionLineCommentEditor(loading.state, key("Enter", settings))
|
|
90
|
-
|
|
91
|
-
expect(enter.effects).toEqual([{ type: "submit", mode: "primary", value: "mail a@b.com" }])
|
|
92
|
-
expect(enter.state.status).toBe("editing")
|
|
93
|
-
// The search's late answer no longer opens a list.
|
|
94
|
-
expect(
|
|
95
|
-
transitionLineCommentEditor(enter.state, { type: "mention.loaded", attempt: 1, items: ["b.ts"] }).state,
|
|
96
|
-
).toBe(enter.state)
|
|
97
|
-
|
|
98
|
-
const tab = transitionLineCommentEditor(loading.state, key("Tab", settings))
|
|
99
|
-
|
|
100
|
-
expect(tab.handled).toBe(false)
|
|
101
|
-
expect(tab.state).toBe(loading.state)
|
|
102
|
-
})
|
|
103
|
-
|
|
104
|
-
test("a bare @ or a token with no matches leaves Escape to cancel the comment", () => {
|
|
105
|
-
const settings = config({ value: "see @" })
|
|
106
|
-
const bare = run(createLineCommentEditorState(), typed("see @"))
|
|
107
|
-
|
|
108
|
-
expect(bare.state.status).toBe("editing")
|
|
109
|
-
expect(bare.effects).toEqual([])
|
|
110
|
-
|
|
111
|
-
const empty = run(createLineCommentEditorState(), typed("user@example.com"), {
|
|
112
|
-
type: "mention.loaded",
|
|
113
|
-
attempt: 1,
|
|
114
|
-
items: [],
|
|
115
|
-
})
|
|
116
|
-
|
|
117
|
-
expect(empty.state).toMatchObject({ status: "editing", dismissed: { start: 4, query: "example.com" } })
|
|
118
|
-
expect(transitionLineCommentEditor(empty.state, key("Escape", settings)).effects).toEqual([
|
|
119
|
-
{ type: "cancel", blur: true },
|
|
120
|
-
])
|
|
121
|
-
// Moving the caret back to the same token does not search again.
|
|
122
|
-
expect(transitionLineCommentEditor(empty.state, typed("user@example.com")).state).toBe(empty.state)
|
|
123
|
-
})
|
|
124
|
-
|
|
125
|
-
test("the list holds at most ten results and the highlight wraps within them", () => {
|
|
126
|
-
const items = Array.from({ length: 25 }, (_, index) => `src/${index}.ts`)
|
|
127
|
-
const settings = config({ value: "@src" })
|
|
128
|
-
const open = run(createLineCommentEditorState(), typed("@src"), { type: "mention.loaded", attempt: 1, items })
|
|
129
|
-
|
|
130
|
-
expect(viewLineCommentEditor(open.state, settings).mentionItems).toHaveLength(10)
|
|
131
|
-
|
|
132
|
-
const up = transitionLineCommentEditor(open.state, key("ArrowUp", settings))
|
|
133
|
-
|
|
134
|
-
expect(viewLineCommentEditor(up.state, settings).activeMentionPath).toBe("src/9.ts")
|
|
135
|
-
expect(up.handled).toBe(true)
|
|
136
|
-
|
|
137
|
-
const around = run(
|
|
138
|
-
up.state,
|
|
139
|
-
key("ArrowDown", settings),
|
|
140
|
-
key("n", settings, { ctrl: true }),
|
|
141
|
-
key("p", settings, { ctrl: true }),
|
|
142
|
-
)
|
|
143
|
-
|
|
144
|
-
expect(viewLineCommentEditor(around.state, settings).activeMentionPath).toBe("src/0.ts")
|
|
145
|
-
expect(transitionLineCommentEditor(around.state, key("Enter", settings)).effects).toEqual([
|
|
146
|
-
{ type: "mention.insert", path: "src/0.ts", token: { query: "src", start: 0, end: 4 } },
|
|
147
|
-
])
|
|
148
|
-
})
|
|
149
|
-
|
|
150
|
-
test("refining a query keeps the old list on screen but only the new search can complete it", () => {
|
|
151
|
-
const settings = config({ value: "@sr" })
|
|
152
|
-
|
|
153
|
-
const first = run(createLineCommentEditorState(), typed("@s"), {
|
|
154
|
-
type: "mention.loaded",
|
|
155
|
-
attempt: 1,
|
|
156
|
-
items: ["server.ts"],
|
|
157
|
-
})
|
|
158
|
-
|
|
159
|
-
const refined = run(first.state, typed("@sr"))
|
|
160
|
-
|
|
161
|
-
expect(refined.state.status).toBe("mention-loading")
|
|
162
|
-
expect(viewLineCommentEditor(refined.state, settings).mentionItems).toEqual(["server.ts"])
|
|
163
|
-
expect(refined.effects).toEqual([{ type: "mention.load", attempt: 2, query: "sr" }])
|
|
164
|
-
|
|
165
|
-
// Enter would insert the stale `server.ts`.
|
|
166
|
-
const enter = transitionLineCommentEditor(refined.state, key("Enter", settings))
|
|
167
|
-
|
|
168
|
-
expect(enter.effects).toEqual([])
|
|
169
|
-
expect(enter.handled).toBe(true)
|
|
170
|
-
|
|
171
|
-
// A late answer for `@s` changes nothing.
|
|
172
|
-
expect(
|
|
173
|
-
transitionLineCommentEditor(refined.state, { type: "mention.loaded", attempt: 1, items: ["stale.ts"] }).state,
|
|
174
|
-
).toBe(refined.state)
|
|
175
|
-
|
|
176
|
-
const settled = transitionLineCommentEditor(refined.state, { type: "mention.loaded", attempt: 2, items: ["src/"] })
|
|
177
|
-
|
|
178
|
-
expect(viewLineCommentEditor(settled.state, settings).mentionItems).toEqual(["src/"])
|
|
179
|
-
})
|
|
180
|
-
|
|
181
|
-
test("an owner that resets the value, starts submitting, or a footer submit closes the list", () => {
|
|
182
|
-
const settings = config({ value: "@src/a", variant: "default" })
|
|
183
|
-
|
|
184
|
-
const open = run(createLineCommentEditorState(), typed("@src/a"), {
|
|
185
|
-
type: "mention.loaded",
|
|
186
|
-
attempt: 1,
|
|
187
|
-
items: ["src/a.ts"],
|
|
188
|
-
})
|
|
189
|
-
|
|
190
|
-
const reset = transitionLineCommentEditor(open.state, { type: "props.synced", config: config(), token: null })
|
|
191
|
-
|
|
192
|
-
expect(viewLineCommentEditor(reset.state, config()).mentionItems).toEqual([])
|
|
193
|
-
|
|
194
|
-
const submitting = transitionLineCommentEditor(open.state, {
|
|
195
|
-
type: "props.synced",
|
|
196
|
-
config: { ...settings, submitting: true },
|
|
197
|
-
token: parseMentionToken("@src/a", 6, 6),
|
|
198
|
-
})
|
|
199
|
-
|
|
200
|
-
expect(submitting.state.status).toBe("submitting")
|
|
201
|
-
expect(viewLineCommentEditor(submitting.state, settings).mentionItems).toEqual([])
|
|
202
|
-
|
|
203
|
-
const footer = transitionLineCommentEditor(open.state, { type: "submit.requested", config: settings })
|
|
204
|
-
|
|
205
|
-
expect(footer.state.status).toBe("editing")
|
|
206
|
-
expect(footer.effects).toEqual([{ type: "submit", mode: "primary", value: "@src/a" }])
|
|
207
|
-
})
|
|
208
|
-
|
|
209
|
-
test("a submitting editor swallows Enter and Escape without acting", () => {
|
|
210
|
-
const settings = config({ value: "Done", submitting: true })
|
|
211
|
-
|
|
212
|
-
const submitting = transitionLineCommentEditor(createLineCommentEditorState(), {
|
|
213
|
-
type: "props.synced",
|
|
214
|
-
config: settings,
|
|
215
|
-
token: null,
|
|
216
|
-
})
|
|
217
|
-
|
|
218
|
-
for (const name of ["Enter", "Escape"]) {
|
|
219
|
-
expect(transitionLineCommentEditor(submitting.state, key(name, settings))).toEqual({
|
|
220
|
-
state: submitting.state,
|
|
221
|
-
effects: [],
|
|
222
|
-
handled: true,
|
|
223
|
-
})
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
expect(transitionLineCommentEditor(submitting.state, key("Tab", settings)).handled).toBe(false)
|
|
227
|
-
expect(
|
|
228
|
-
transitionLineCommentEditor(submitting.state, { type: "action.clicked", modified: false, config: settings })
|
|
229
|
-
.effects,
|
|
230
|
-
).toEqual([])
|
|
231
|
-
|
|
232
|
-
const done = transitionLineCommentEditor(submitting.state, {
|
|
233
|
-
type: "props.synced",
|
|
234
|
-
config: { ...settings, submitting: false },
|
|
235
|
-
token: null,
|
|
236
|
-
})
|
|
237
|
-
|
|
238
|
-
expect(done.state.status).toBe("editing")
|
|
239
|
-
})
|
|
240
|
-
|
|
241
|
-
test("click submission ignores stale modifiers", () => {
|
|
242
|
-
const settings = config({ value: "Ship it", alternateSubmit: { disabled: false } })
|
|
243
|
-
|
|
244
|
-
const held = transitionLineCommentEditor(createLineCommentEditorState(), {
|
|
245
|
-
type: "modifier.changed",
|
|
246
|
-
active: true,
|
|
247
|
-
config: settings,
|
|
248
|
-
})
|
|
249
|
-
|
|
250
|
-
expect(viewLineCommentEditor(held.state, settings).alternateActive).toBe(true)
|
|
251
|
-
expect(
|
|
252
|
-
transitionLineCommentEditor(held.state, { type: "action.clicked", modified: false, config: settings }).effects,
|
|
253
|
-
).toEqual([{ type: "submit", mode: "primary", value: "Ship it" }])
|
|
254
|
-
|
|
255
|
-
// Entering the action without the modifier clears a stale hold.
|
|
256
|
-
const entered = transitionLineCommentEditor(held.state, {
|
|
257
|
-
type: "modifier.changed",
|
|
258
|
-
active: false,
|
|
259
|
-
config: settings,
|
|
260
|
-
})
|
|
261
|
-
|
|
262
|
-
expect(viewLineCommentEditor(entered.state, settings).alternateActive).toBe(false)
|
|
263
|
-
expect(
|
|
264
|
-
viewLineCommentEditor(transitionLineCommentEditor(held.state, { type: "window.blurred" }).state, settings),
|
|
265
|
-
).toMatchObject({ alternateActive: false })
|
|
266
|
-
|
|
267
|
-
const dropped = transitionLineCommentEditor(held.state, {
|
|
268
|
-
type: "props.synced",
|
|
269
|
-
config: { ...settings, alternateSubmit: null },
|
|
270
|
-
token: null,
|
|
271
|
-
})
|
|
272
|
-
|
|
273
|
-
expect(dropped.state).toMatchObject({ alternate: false })
|
|
274
|
-
|
|
275
|
-
const unsupported = transitionLineCommentEditor(createLineCommentEditorState(), {
|
|
276
|
-
type: "modifier.changed",
|
|
277
|
-
active: true,
|
|
278
|
-
config: { ...settings, alternateSubmit: null },
|
|
279
|
-
})
|
|
280
|
-
|
|
281
|
-
expect(unsupported.state).toMatchObject({ alternate: false })
|
|
282
|
-
})
|
|
283
|
-
|
|
284
|
-
test("a modified click uses the alternate submit without a tracked modifier", () => {
|
|
285
|
-
const settings = config({ value: "Ship it", alternateSubmit: { disabled: false } })
|
|
286
|
-
|
|
287
|
-
expect(
|
|
288
|
-
transitionLineCommentEditor(createLineCommentEditorState(), {
|
|
289
|
-
type: "action.clicked",
|
|
290
|
-
modified: true,
|
|
291
|
-
config: settings,
|
|
292
|
-
}).effects,
|
|
293
|
-
).toEqual([{ type: "submit", mode: "alternate", value: "Ship it" }])
|
|
294
|
-
})
|
|
295
|
-
|
|
296
|
-
test.each([false, true])("empty draft clicks use the event modifier (tracked: %s)", (active) => {
|
|
297
|
-
const settings = config({ alternateSubmit: { disabled: false } })
|
|
298
|
-
|
|
299
|
-
const held = transitionLineCommentEditor(createLineCommentEditorState(), {
|
|
300
|
-
type: "modifier.changed",
|
|
301
|
-
active,
|
|
302
|
-
config: settings,
|
|
303
|
-
})
|
|
304
|
-
|
|
305
|
-
expect(
|
|
306
|
-
transitionLineCommentEditor(held.state, { type: "action.clicked", modified: false, config: settings }).effects,
|
|
307
|
-
).toEqual([{ type: "cancel", blur: false }])
|
|
308
|
-
expect(
|
|
309
|
-
transitionLineCommentEditor(held.state, { type: "action.clicked", modified: true, config: settings }).effects,
|
|
310
|
-
).toEqual([])
|
|
311
|
-
})
|
|
312
|
-
|
|
313
|
-
test("Mod+Enter with the list open sends through the alternate submit", () => {
|
|
314
|
-
const settings = config({ value: "@src", alternateSubmit: { disabled: false } })
|
|
315
|
-
|
|
316
|
-
const open = run(createLineCommentEditorState(), typed("@src"), {
|
|
317
|
-
type: "mention.loaded",
|
|
318
|
-
attempt: 1,
|
|
319
|
-
items: ["src/a.ts"],
|
|
320
|
-
})
|
|
321
|
-
|
|
322
|
-
expect(transitionLineCommentEditor(open.state, key("Enter", settings, { ctrl: true })).effects).toEqual([
|
|
323
|
-
{ type: "submit", mode: "alternate", value: "@src" },
|
|
324
|
-
])
|
|
325
|
-
})
|
|
326
|
-
|
|
327
|
-
test("Mod+Enter in a full-size editor saves while its alternate submit is disabled", () => {
|
|
328
|
-
const settings = config({ value: "Ship it", variant: "default", alternateSubmit: { disabled: true } })
|
|
329
|
-
|
|
330
|
-
expect(
|
|
331
|
-
transitionLineCommentEditor(createLineCommentEditorState(), key("Enter", settings, { ctrl: true })).effects,
|
|
332
|
-
).toEqual([{ type: "submit", mode: "primary", value: "Ship it" }])
|
|
333
|
-
expect(
|
|
334
|
-
transitionLineCommentEditor(
|
|
335
|
-
createLineCommentEditorState(),
|
|
336
|
-
key("Enter", { ...settings, variant: "compact" }, { ctrl: true }),
|
|
337
|
-
).effects,
|
|
338
|
-
).toEqual([])
|
|
339
|
-
})
|
|
340
|
-
|
|
341
|
-
test("Escape closes a visible list once, and the same token stays closed", () => {
|
|
342
|
-
const settings = config({ value: "@src" })
|
|
343
|
-
|
|
344
|
-
const open = run(createLineCommentEditorState(), typed("@src"), {
|
|
345
|
-
type: "mention.loaded",
|
|
346
|
-
attempt: 1,
|
|
347
|
-
items: ["src/a.ts"],
|
|
348
|
-
})
|
|
349
|
-
|
|
350
|
-
const closed = transitionLineCommentEditor(open.state, key("Escape", settings))
|
|
351
|
-
|
|
352
|
-
expect(closed.effects).toEqual([])
|
|
353
|
-
expect(closed.handled).toBe(true)
|
|
354
|
-
expect(transitionLineCommentEditor(closed.state, typed("@src")).state).toBe(closed.state)
|
|
355
|
-
expect(transitionLineCommentEditor(closed.state, key("Escape", settings)).effects).toEqual([
|
|
356
|
-
{ type: "cancel", blur: true },
|
|
357
|
-
])
|
|
358
|
-
})
|
|
359
|
-
|
|
360
|
-
test("a failed or timed-out search ends loading, and stale timeouts do nothing", () => {
|
|
361
|
-
const loading = run(createLineCommentEditorState(), typed("@src"))
|
|
362
|
-
|
|
363
|
-
expect(transitionLineCommentEditor(loading.state, { type: "mention.failed", attempt: 1 }).state.status).toBe(
|
|
364
|
-
"editing",
|
|
365
|
-
)
|
|
366
|
-
expect(transitionLineCommentEditor(loading.state, { type: "mention.timeout", attempt: 1 }).state.status).toBe(
|
|
367
|
-
"editing",
|
|
368
|
-
)
|
|
369
|
-
|
|
370
|
-
const next = run(loading.state, typed("@lib"))
|
|
371
|
-
|
|
372
|
-
expect(attemptOf(next.state)).toBe(2)
|
|
373
|
-
expect(transitionLineCommentEditor(next.state, { type: "mention.timeout", attempt: 1 }).state).toBe(next.state)
|
|
374
|
-
})
|
|
375
|
-
|
|
376
|
-
test("a disposed editor ignores late results", () => {
|
|
377
|
-
const loading = run(createLineCommentEditorState(), typed("@src"))
|
|
378
|
-
const disposed = transitionLineCommentEditor(loading.state, { type: "disposed" })
|
|
379
|
-
|
|
380
|
-
expect(disposed.state).toEqual({ status: "disposed" })
|
|
381
|
-
expect(
|
|
382
|
-
transitionLineCommentEditor(disposed.state, { type: "mention.loaded", attempt: 1, items: ["a"] }).state,
|
|
383
|
-
).toBe(disposed.state)
|
|
384
|
-
})
|
|
385
|
-
})
|
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
import { describe, expect, test } from "bun:test"
|
|
2
|
-
import {
|
|
3
|
-
AVATAR_DISPOSED,
|
|
4
|
-
AVATAR_POINTER_LEFT,
|
|
5
|
-
AVATAR_REFRESH,
|
|
6
|
-
AVATAR_REST_MS,
|
|
7
|
-
createAvatarClock,
|
|
8
|
-
INITIAL_AVATAR_ANIMATION_STATE,
|
|
9
|
-
selectAvatarPaintTime,
|
|
10
|
-
selectAvatarRunning,
|
|
11
|
-
transitionAvatarAnimation,
|
|
12
|
-
type AvatarAnimationEvent,
|
|
13
|
-
type AvatarAnimationState,
|
|
14
|
-
type AvatarAnimationTransition,
|
|
15
|
-
type AvatarClock,
|
|
16
|
-
} from "./animation-machine"
|
|
17
|
-
|
|
18
|
-
const enter = (now: number, reduced = false): AvatarAnimationEvent => ({ type: "pointer.entered", now, reduced })
|
|
19
|
-
|
|
20
|
-
const frame = (now: number): AvatarAnimationEvent => ({ type: "frame", now })
|
|
21
|
-
|
|
22
|
-
const motion = (reduced: boolean): AvatarAnimationEvent => ({ type: "motion.changed", reduced })
|
|
23
|
-
|
|
24
|
-
function run(clock: AvatarClock, state: AvatarAnimationState, ...events: AvatarAnimationEvent[]) {
|
|
25
|
-
return events.reduce<AvatarAnimationTransition>(
|
|
26
|
-
(result, event) => transitionAvatarAnimation(result.state, clock, event),
|
|
27
|
-
{ state, effect: "none" },
|
|
28
|
-
)
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
const animating = (clock: AvatarClock) =>
|
|
32
|
-
run(clock, INITIAL_AVATAR_ANIMATION_STATE, enter(0), frame(AVATAR_REST_MS + 10)).state
|
|
33
|
-
|
|
34
|
-
describe("transitionAvatarAnimation", () => {
|
|
35
|
-
test("waits out the rest delay, then animates", () => {
|
|
36
|
-
const clock = createAvatarClock()
|
|
37
|
-
const resting = run(clock, INITIAL_AVATAR_ANIMATION_STATE, enter(0), frame(80))
|
|
38
|
-
|
|
39
|
-
expect(resting.state.status).toBe("resting")
|
|
40
|
-
expect(resting.effect).toBe("none")
|
|
41
|
-
expect(selectAvatarRunning(resting.state)).toBe(true)
|
|
42
|
-
|
|
43
|
-
const first = run(clock, resting.state, frame(AVATAR_REST_MS + 10))
|
|
44
|
-
|
|
45
|
-
expect(first).toMatchObject({ state: { status: "animating" }, effect: "paint-frame" })
|
|
46
|
-
expect(selectAvatarPaintTime(first.state, clock)).toBeCloseTo(0.08)
|
|
47
|
-
})
|
|
48
|
-
|
|
49
|
-
test("passing over a row stops at once without painting", () => {
|
|
50
|
-
const clock = createAvatarClock()
|
|
51
|
-
const result = run(clock, INITIAL_AVATAR_ANIMATION_STATE, enter(0), frame(30), AVATAR_POINTER_LEFT)
|
|
52
|
-
|
|
53
|
-
expect(result).toMatchObject({ state: INITIAL_AVATAR_ANIMATION_STATE, effect: "none" })
|
|
54
|
-
expect(selectAvatarRunning(result.state)).toBe(false)
|
|
55
|
-
expect(clock).toEqual(createAvatarClock())
|
|
56
|
-
})
|
|
57
|
-
|
|
58
|
-
test("a refresh repaints the static frame while resting, not while animating", () => {
|
|
59
|
-
const clock = createAvatarClock()
|
|
60
|
-
const resting = run(clock, INITIAL_AVATAR_ANIMATION_STATE, enter(0)).state
|
|
61
|
-
|
|
62
|
-
expect(run(clock, INITIAL_AVATAR_ANIMATION_STATE, AVATAR_REFRESH).effect).toBe("paint-static")
|
|
63
|
-
expect(run(clock, resting, AVATAR_REFRESH)).toMatchObject({ state: resting, effect: "paint-static" })
|
|
64
|
-
expect(run(clock, animating(clock), AVATAR_REFRESH).effect).toBe("none")
|
|
65
|
-
})
|
|
66
|
-
|
|
67
|
-
test("reduced motion blocks the hover and stops a running animation", () => {
|
|
68
|
-
const clock = createAvatarClock()
|
|
69
|
-
|
|
70
|
-
expect(run(clock, INITIAL_AVATAR_ANIMATION_STATE, enter(0, true)).state).toBe(INITIAL_AVATAR_ANIMATION_STATE)
|
|
71
|
-
|
|
72
|
-
const resting = run(clock, INITIAL_AVATAR_ANIMATION_STATE, enter(0)).state
|
|
73
|
-
|
|
74
|
-
expect(run(clock, resting, motion(true))).toMatchObject({ state: INITIAL_AVATAR_ANIMATION_STATE, effect: "none" })
|
|
75
|
-
|
|
76
|
-
const stopped = run(clock, animating(clock), motion(true))
|
|
77
|
-
|
|
78
|
-
expect(stopped).toMatchObject({ state: INITIAL_AVATAR_ANIMATION_STATE, effect: "paint-static" })
|
|
79
|
-
expect(clock).toEqual(createAvatarClock())
|
|
80
|
-
expect(run(clock, animating(clock), motion(false)).state.status).toBe("animating")
|
|
81
|
-
})
|
|
82
|
-
|
|
83
|
-
test("eases back after the pointer leaves, resumes without a rest delay, and settles", () => {
|
|
84
|
-
const clock = createAvatarClock()
|
|
85
|
-
const easing = run(clock, animating(clock), AVATAR_POINTER_LEFT)
|
|
86
|
-
|
|
87
|
-
expect(easing).toMatchObject({ state: { status: "easing" }, effect: "none" })
|
|
88
|
-
expect(run(clock, easing.state, enter(170, true)).state).toBe(easing.state)
|
|
89
|
-
|
|
90
|
-
const resumed = run(clock, easing.state, enter(170), frame(186))
|
|
91
|
-
|
|
92
|
-
expect(resumed).toMatchObject({ state: { status: "animating" }, effect: "paint-frame" })
|
|
93
|
-
|
|
94
|
-
const eased = run(clock, resumed.state, AVATAR_POINTER_LEFT, frame(286))
|
|
95
|
-
|
|
96
|
-
expect(eased).toMatchObject({ state: { status: "easing" }, effect: "paint-frame" })
|
|
97
|
-
expect(clock.time).toBeLessThan(0.116)
|
|
98
|
-
|
|
99
|
-
const settled = run(clock, eased.state, frame(386), frame(486), frame(586))
|
|
100
|
-
|
|
101
|
-
expect(settled).toMatchObject({ state: INITIAL_AVATAR_ANIMATION_STATE, effect: "paint-static" })
|
|
102
|
-
})
|
|
103
|
-
|
|
104
|
-
test("a frame step never runs backwards or past the cap", () => {
|
|
105
|
-
const clock = createAvatarClock()
|
|
106
|
-
const state = animating(clock)
|
|
107
|
-
const time = clock.time
|
|
108
|
-
|
|
109
|
-
run(clock, state, frame(0))
|
|
110
|
-
expect(clock.time).toBe(time)
|
|
111
|
-
run(clock, state, frame(10_000))
|
|
112
|
-
expect(clock.time).toBeCloseTo(time + 0.1)
|
|
113
|
-
})
|
|
114
|
-
|
|
115
|
-
test("frames reuse the same frozen transition", () => {
|
|
116
|
-
const clock = createAvatarClock()
|
|
117
|
-
const state = animating(clock)
|
|
118
|
-
const first = transitionAvatarAnimation(state, clock, frame(200))
|
|
119
|
-
|
|
120
|
-
expect(transitionAvatarAnimation(state, clock, frame(216))).toBe(first)
|
|
121
|
-
expect(Object.isFrozen(first)).toBe(true)
|
|
122
|
-
})
|
|
123
|
-
|
|
124
|
-
test("disposing ignores later events", () => {
|
|
125
|
-
const clock = createAvatarClock()
|
|
126
|
-
const disposed = run(clock, animating(clock), AVATAR_DISPOSED).state
|
|
127
|
-
|
|
128
|
-
expect(selectAvatarRunning(disposed)).toBe(false)
|
|
129
|
-
expect(run(clock, disposed, enter(0), frame(500), AVATAR_REFRESH)).toMatchObject({
|
|
130
|
-
state: disposed,
|
|
131
|
-
effect: "none",
|
|
132
|
-
})
|
|
133
|
-
})
|
|
134
|
-
})
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { createHash } from "crypto"
|
|
2
|
-
import { describe, expect, test } from "bun:test"
|
|
3
|
-
import { generateProjectIcon, getProjectAvatarGenerated } from "./project-avatar"
|
|
4
|
-
|
|
5
|
-
describe("generateProjectIcon", () => {
|
|
6
|
-
test("derives the same icon from the same key", () => {
|
|
7
|
-
expect(generateProjectIcon("project-a")).toEqual(generateProjectIcon("project-a"))
|
|
8
|
-
expect(generateProjectIcon("project-a")).not.toEqual(generateProjectIcon("project-b"))
|
|
9
|
-
})
|
|
10
|
-
|
|
11
|
-
// Projects without a stored icon fall back to this output, so it must not drift between releases.
|
|
12
|
-
test("resolves the seed, palette and every drawing parameter", () => {
|
|
13
|
-
expect(generateProjectIcon("9f1c2a7e01")).toEqual({
|
|
14
|
-
style: "mesh",
|
|
15
|
-
version: 1,
|
|
16
|
-
params: {
|
|
17
|
-
scale: 0.95,
|
|
18
|
-
fold: 0.4,
|
|
19
|
-
light: 1,
|
|
20
|
-
tilt: -0.02,
|
|
21
|
-
speed: 0.9,
|
|
22
|
-
grain: 0.14,
|
|
23
|
-
grainSize: 16,
|
|
24
|
-
seedX: 39.46408212184906,
|
|
25
|
-
seedY: 35.76026787981391,
|
|
26
|
-
grainX: 60,
|
|
27
|
-
grainY: 31,
|
|
28
|
-
color0: 0x10451d,
|
|
29
|
-
color1: 0x4c956c,
|
|
30
|
-
color2: 0xd68c45,
|
|
31
|
-
color3: 0xf2e8cf,
|
|
32
|
-
},
|
|
33
|
-
})
|
|
34
|
-
})
|
|
35
|
-
})
|
|
36
|
-
|
|
37
|
-
describe("getProjectAvatarGenerated", () => {
|
|
38
|
-
test("keeps chosen and discovered icons", () => {
|
|
39
|
-
expect(getProjectAvatarGenerated({ id: "abc", icon: { override: "data:custom" } })).toBeUndefined()
|
|
40
|
-
expect(getProjectAvatarGenerated({ id: "abc", icon: { url: "data:auto" } })).toBeUndefined()
|
|
41
|
-
expect(getProjectAvatarGenerated({ id: "abc", icon: { color: "blue" } })).toBeUndefined()
|
|
42
|
-
const opencode = createHash("sha1").update("git-remote:github.com/anomalyco/opencode").digest("hex")
|
|
43
|
-
expect(getProjectAvatarGenerated({ id: opencode, worktree: "/repo" })).toBeUndefined()
|
|
44
|
-
})
|
|
45
|
-
|
|
46
|
-
test("seeds by project ID or, for unidentified projects, by directory", () => {
|
|
47
|
-
expect(getProjectAvatarGenerated({ id: "abc", worktree: "/repo" })).toBe("abc")
|
|
48
|
-
expect(getProjectAvatarGenerated({ id: "global", worktree: "/scratch" })).toBe("/scratch")
|
|
49
|
-
})
|
|
50
|
-
})
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { describe, expect, test } from "bun:test"
|
|
2
|
-
import { PROJECT_ICON_STYLES } from "./procedural"
|
|
3
|
-
|
|
4
|
-
describe("procedural project icon styles", () => {
|
|
5
|
-
test.each(PROJECT_ICON_STYLES.map((style) => [style.id, style] as const))(
|
|
6
|
-
"%s resolves the same finite params from the same key",
|
|
7
|
-
(id, style) => {
|
|
8
|
-
const icon = style.generate("harbor-api")
|
|
9
|
-
|
|
10
|
-
expect(style.generate("harbor-api")).toEqual(icon)
|
|
11
|
-
expect(style.generate("basalt")).not.toEqual(icon)
|
|
12
|
-
expect(icon.style).toBe(id)
|
|
13
|
-
expect(Object.values(icon.params).every(Number.isFinite)).toBe(true)
|
|
14
|
-
},
|
|
15
|
-
)
|
|
16
|
-
})
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { createHash } from "crypto"
|
|
2
|
-
import { describe, expect, test } from "bun:test"
|
|
3
|
-
import { getProjectAvatarSource } from "./project-avatar"
|
|
4
|
-
|
|
5
|
-
describe("getProjectAvatarSource", () => {
|
|
6
|
-
test("prefers a chosen image, then a chosen color, then the automatic icon", () => {
|
|
7
|
-
expect(getProjectAvatarSource("abc", { override: "data:image/png;base64,AA==", url: "data:auto" })).toBe(
|
|
8
|
-
"data:image/png;base64,AA==",
|
|
9
|
-
)
|
|
10
|
-
expect(getProjectAvatarSource("abc", { color: "blue", url: "data:auto" })).toBeUndefined()
|
|
11
|
-
expect(getProjectAvatarSource("abc", { url: "data:auto" })).toBe("data:auto")
|
|
12
|
-
})
|
|
13
|
-
|
|
14
|
-
test("recognizes the OpenCode repository by its remote-derived project ID", () => {
|
|
15
|
-
const id = createHash("sha1").update("git-remote:github.com/anomalyco/opencode").digest("hex")
|
|
16
|
-
|
|
17
|
-
expect(getProjectAvatarSource(id)).toBe("https://opencode.ai/favicon.svg")
|
|
18
|
-
expect(getProjectAvatarSource(id, { override: "data:custom" })).toBe("data:custom")
|
|
19
|
-
expect(getProjectAvatarSource(id, { color: "blue" })).toBeUndefined()
|
|
20
|
-
})
|
|
21
|
-
})
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { describe, expect, test } from "bun:test"
|
|
2
|
-
import { boundToastDescription, toastDescriptionLimit } from "./description"
|
|
3
|
-
|
|
4
|
-
describe("toast description bound", () => {
|
|
5
|
-
test("keeps ordinary descriptions and the options object", () => {
|
|
6
|
-
const options = { title: "Failed", description: "Attachment exceeds the limit" }
|
|
7
|
-
expect(boundToastDescription(options)).toBe(options)
|
|
8
|
-
expect(boundToastDescription({ description: undefined })).toEqual({ description: undefined })
|
|
9
|
-
})
|
|
10
|
-
|
|
11
|
-
test("cuts a description that embeds a whole data URL", () => {
|
|
12
|
-
const description = `Attachment exceeds the limit: data:text/plain;base64,${"Q".repeat(50 * 1024 * 1024)}`
|
|
13
|
-
const bounded = boundToastDescription({ title: "Failed to send prompt", description })
|
|
14
|
-
expect(bounded.description!.length).toBe(toastDescriptionLimit + 1)
|
|
15
|
-
expect(bounded.description!.endsWith("…")).toBe(true)
|
|
16
|
-
expect(bounded.description!.startsWith("Attachment exceeds the limit: data:text/plain;base64,")).toBe(true)
|
|
17
|
-
expect(bounded.title).toBe("Failed to send prompt")
|
|
18
|
-
})
|
|
19
|
-
})
|
|
20
|
-
|