@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,295 +0,0 @@
|
|
|
1
|
-
import { describe, expect, test } from "bun:test"
|
|
2
|
-
import {
|
|
3
|
-
createDialogStackState,
|
|
4
|
-
selectLayerClosing,
|
|
5
|
-
selectLayerIndex,
|
|
6
|
-
selectLayerModal,
|
|
7
|
-
selectTopDialog,
|
|
8
|
-
transitionDialogStack,
|
|
9
|
-
type DialogStackEffect,
|
|
10
|
-
type DialogStackEvent,
|
|
11
|
-
type DialogStackState,
|
|
12
|
-
} from "./dialog-machine"
|
|
13
|
-
|
|
14
|
-
type Event = DialogStackEvent<string, string>
|
|
15
|
-
|
|
16
|
-
// Focus is where it was when the open was asked for; the request names the content the driver would mount.
|
|
17
|
-
const open = (mode: "show" | "push", id: string, aborted = false): Event => ({
|
|
18
|
-
type: "open",
|
|
19
|
-
mode,
|
|
20
|
-
id,
|
|
21
|
-
aborted,
|
|
22
|
-
focus: `before ${id}`,
|
|
23
|
-
request: id,
|
|
24
|
-
})
|
|
25
|
-
|
|
26
|
-
const push = (id: string) => open("push", id)
|
|
27
|
-
|
|
28
|
-
const show = (id: string) => open("show", id)
|
|
29
|
-
|
|
30
|
-
function run(state: DialogStackState<string>, ...events: Event[]) {
|
|
31
|
-
return events.reduce<{ state: DialogStackState<string>; effects: readonly DialogStackEffect<string, string>[] }>(
|
|
32
|
-
(result, event) => transitionDialogStack(result.state, event),
|
|
33
|
-
{ state, effects: [] },
|
|
34
|
-
)
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
function closed(attempt: number, delayMs: number, focus?: string): DialogStackEffect<string, string>[] {
|
|
38
|
-
return [
|
|
39
|
-
{ type: "timer.start", attempt, delayMs },
|
|
40
|
-
{ type: "notify.close", attempt },
|
|
41
|
-
...(focus ? [{ type: "focus.return" as const, attempt, focus }] : []),
|
|
42
|
-
]
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
const statuses = (state: DialogStackState<string>) =>
|
|
46
|
-
state.status === "active" ? state.entries.map((entry) => `${entry.id}:${entry.status}`) : []
|
|
47
|
-
|
|
48
|
-
describe("closing a lower dialog by id", () => {
|
|
49
|
-
// A at the bottom plays the image preview's 960 ms flight out; B on top must close at once, however it is closed.
|
|
50
|
-
const below = run(
|
|
51
|
-
createDialogStackState(),
|
|
52
|
-
push("a"),
|
|
53
|
-
{ type: "layer.exit-duration", attempt: 1, exitMs: 960 },
|
|
54
|
-
push("b"),
|
|
55
|
-
{ type: "close", id: "a" },
|
|
56
|
-
)
|
|
57
|
-
|
|
58
|
-
test("starts only that dialog's exit and leaves focus with the top dialog", () => {
|
|
59
|
-
expect(below.effects).toEqual(closed(1, 960))
|
|
60
|
-
expect(statuses(below.state)).toEqual(["a:closing", "b:open"])
|
|
61
|
-
expect(selectTopDialog(below.state)?.id).toBe("b")
|
|
62
|
-
})
|
|
63
|
-
|
|
64
|
-
test.each<[string, Event]>([
|
|
65
|
-
["Escape", { type: "dismiss" }],
|
|
66
|
-
["a backdrop click", { type: "backdrop.click", attempt: 2 }],
|
|
67
|
-
["its close button", { type: "layer.dismiss", attempt: 2 }],
|
|
68
|
-
["an un-keyed close", { type: "close" }],
|
|
69
|
-
["a dismissal by id", { type: "dismiss", id: "b" }],
|
|
70
|
-
])("does not block %s on the top dialog", (_, event) => {
|
|
71
|
-
const next = transitionDialogStack(below.state, event)
|
|
72
|
-
|
|
73
|
-
expect(next.effects).toEqual(closed(2, 100, "before b"))
|
|
74
|
-
expect(statuses(next.state)).toEqual(["a:closing", "b:closing"])
|
|
75
|
-
})
|
|
76
|
-
})
|
|
77
|
-
|
|
78
|
-
describe("while the top dialog plays its exit animation", () => {
|
|
79
|
-
const exiting = run(createDialogStackState(), push("a"), push("b"), { type: "dismiss" })
|
|
80
|
-
|
|
81
|
-
test("the dialog below is the top dialog and owns the focus trap", () => {
|
|
82
|
-
expect(selectTopDialog(exiting.state)?.id).toBe("a")
|
|
83
|
-
expect(selectLayerModal(exiting.state, 1, false)).toBe(true)
|
|
84
|
-
expect(selectLayerModal(exiting.state, 2, false)).toBe(false)
|
|
85
|
-
expect(selectLayerModal(exiting.state, 1, true)).toBe(false)
|
|
86
|
-
})
|
|
87
|
-
|
|
88
|
-
test.each<[string, Event]>([
|
|
89
|
-
["its close button", { type: "layer.dismiss", attempt: 2 }],
|
|
90
|
-
["its backdrop", { type: "backdrop.click", attempt: 2 }],
|
|
91
|
-
["a dismissal by its id", { type: "dismiss", id: "b" }],
|
|
92
|
-
["a second un-keyed close", { type: "close" }],
|
|
93
|
-
["a second close from inside it", { type: "close", layer: 2 }],
|
|
94
|
-
])("%s does nothing more", (_, event) => {
|
|
95
|
-
const next = transitionDialogStack(exiting.state, event)
|
|
96
|
-
|
|
97
|
-
expect(next.state).toBe(exiting.state)
|
|
98
|
-
expect(next.effects).toEqual([])
|
|
99
|
-
})
|
|
100
|
-
|
|
101
|
-
test.each<[string, Event]>([
|
|
102
|
-
["Escape", { type: "dismiss" }],
|
|
103
|
-
["a dismissal by its id", { type: "dismiss", id: "a" }],
|
|
104
|
-
["its close button", { type: "layer.dismiss", attempt: 1 }],
|
|
105
|
-
["its backdrop", { type: "backdrop.click", attempt: 1 }],
|
|
106
|
-
["a close by its id", { type: "close", id: "a" }],
|
|
107
|
-
["its own Cancel (a close from inside it)", { type: "close", layer: 1 }],
|
|
108
|
-
])("%s closes the dialog below at once", (_, event) => {
|
|
109
|
-
const next = transitionDialogStack(exiting.state, event)
|
|
110
|
-
|
|
111
|
-
expect(next.effects).toEqual(closed(1, 100, "before a"))
|
|
112
|
-
expect(statuses(next.state)).toEqual(["a:closing", "b:closing"])
|
|
113
|
-
})
|
|
114
|
-
|
|
115
|
-
test("an un-keyed close from outside every dialog waits for the exit, then closes the dialog below", () => {
|
|
116
|
-
const next = run(exiting.state, { type: "exit.completed", attempt: 2 }, { type: "close" })
|
|
117
|
-
|
|
118
|
-
expect(next.effects).toEqual(closed(1, 100, "before a"))
|
|
119
|
-
})
|
|
120
|
-
})
|
|
121
|
-
|
|
122
|
-
describe("a close without an id from inside a dialog", () => {
|
|
123
|
-
const stacked = run(createDialogStackState(), push("a"), push("b"))
|
|
124
|
-
|
|
125
|
-
test("closes that dialog, not the one on top, and leaves focus with the top dialog", () => {
|
|
126
|
-
const next = transitionDialogStack(stacked.state, { type: "close", layer: 1 })
|
|
127
|
-
|
|
128
|
-
expect(next.effects).toEqual(closed(1, 100))
|
|
129
|
-
expect(statuses(next.state)).toEqual(["a:closing", "b:open"])
|
|
130
|
-
})
|
|
131
|
-
|
|
132
|
-
test("closes only itself on a double click, never the dialog below", () => {
|
|
133
|
-
const first = transitionDialogStack(stacked.state, { type: "close", layer: 2 })
|
|
134
|
-
const second = transitionDialogStack(first.state, { type: "close", layer: 2 })
|
|
135
|
-
|
|
136
|
-
expect(first.effects).toEqual(closed(2, 100, "before b"))
|
|
137
|
-
expect(second.state).toBe(first.state)
|
|
138
|
-
expect(second.effects).toEqual([])
|
|
139
|
-
})
|
|
140
|
-
|
|
141
|
-
test("from a dialog a show replaced, closes the replacement, along a chain of replacements", () => {
|
|
142
|
-
const replaced = run(stacked.state, show("c"))
|
|
143
|
-
|
|
144
|
-
expect(transitionDialogStack(replaced.state, { type: "close", layer: 1 }).effects).toEqual(closed(3, 100, "before a"))
|
|
145
|
-
|
|
146
|
-
const again = run(replaced.state, show("d"))
|
|
147
|
-
|
|
148
|
-
expect(transitionDialogStack(again.state, { type: "close", layer: 1 }).effects).toEqual(closed(4, 100, "before a"))
|
|
149
|
-
expect(transitionDialogStack(again.state, { type: "close", layer: 3 }).effects).toEqual(closed(4, 100, "before a"))
|
|
150
|
-
})
|
|
151
|
-
|
|
152
|
-
test.each<[string, Event[]]>([
|
|
153
|
-
// Escape closed it, its exit ended, and another dialog opened before its async work called close().
|
|
154
|
-
["closed and gone", [push("a"), { type: "dismiss" }, { type: "exit.completed", attempt: 1 }, push("b")]],
|
|
155
|
-
["closed, then torn down by a show", [push("a"), push("x"), { type: "close", id: "a" }, show("b")]],
|
|
156
|
-
])("from a dialog already %s, closes nothing", (_, events) => {
|
|
157
|
-
const before = run(createDialogStackState(), ...events)
|
|
158
|
-
const next = transitionDialogStack(before.state, { type: "close", layer: 1 })
|
|
159
|
-
|
|
160
|
-
expect(next.state).toBe(before.state)
|
|
161
|
-
expect(next.effects).toEqual([])
|
|
162
|
-
})
|
|
163
|
-
})
|
|
164
|
-
|
|
165
|
-
test("a layer reads closing as soon as its close starts, before its exit animation ends", () => {
|
|
166
|
-
const opened = run(createDialogStackState(), push("a"))
|
|
167
|
-
const closing = run(opened.state, { type: "dismiss" })
|
|
168
|
-
|
|
169
|
-
expect(selectLayerClosing(opened.state, 1)).toBe(false)
|
|
170
|
-
expect(selectLayerClosing(closing.state, 1)).toBe(true)
|
|
171
|
-
// Escape stops being captured, though the dialog stays mounted for its exit animation.
|
|
172
|
-
expect(selectTopDialog(closing.state)).toBeUndefined()
|
|
173
|
-
expect(statuses(closing.state)).toEqual(["a:closing"])
|
|
174
|
-
|
|
175
|
-
const gone = run(closing.state, { type: "exit.completed", attempt: 1 })
|
|
176
|
-
|
|
177
|
-
expect(gone.effects).toEqual([{ type: "dispose", attempt: 1, notify: false }])
|
|
178
|
-
expect(statuses(gone.state)).toEqual([])
|
|
179
|
-
})
|
|
180
|
-
|
|
181
|
-
test("an id reused while its earlier dialog exits names only the new dialog", () => {
|
|
182
|
-
const reused = run(createDialogStackState(), push("x"), { type: "close", id: "x" }, push("x"))
|
|
183
|
-
|
|
184
|
-
expect(selectTopDialog(reused.state)?.attempt).toBe(2)
|
|
185
|
-
expect(selectLayerClosing(reused.state, 1)).toBe(true)
|
|
186
|
-
expect(selectLayerClosing(reused.state, 2)).toBe(false)
|
|
187
|
-
|
|
188
|
-
const exited = run(reused.state, { type: "exit.completed", attempt: 1 })
|
|
189
|
-
|
|
190
|
-
expect(exited.effects).toEqual([{ type: "dispose", attempt: 1, notify: false }])
|
|
191
|
-
expect(statuses(exited.state)).toEqual(["x:open"])
|
|
192
|
-
expect(selectLayerIndex(exited.state, 2)).toBe(0)
|
|
193
|
-
expect(run(exited.state, { type: "close", id: "x" }).effects).toEqual(closed(2, 100, "before x"))
|
|
194
|
-
})
|
|
195
|
-
|
|
196
|
-
describe("a dialog that opts out of backdrop dismissal", () => {
|
|
197
|
-
const kept = run(createDialogStackState(), push("a"), { type: "layer.backdrop-dismiss", attempt: 1, enabled: false })
|
|
198
|
-
|
|
199
|
-
test("stays open on a backdrop click", () => {
|
|
200
|
-
const next = transitionDialogStack(kept.state, { type: "backdrop.click", attempt: 1 })
|
|
201
|
-
|
|
202
|
-
expect(next.state).toBe(kept.state)
|
|
203
|
-
expect(next.effects).toEqual([])
|
|
204
|
-
})
|
|
205
|
-
|
|
206
|
-
test.each<[string, Event]>([
|
|
207
|
-
["Escape", { type: "dismiss" }],
|
|
208
|
-
["its close button", { type: "layer.dismiss", attempt: 1 }],
|
|
209
|
-
["an un-keyed close", { type: "close" }],
|
|
210
|
-
])("still closes on %s", (_, event) => {
|
|
211
|
-
expect(transitionDialogStack(kept.state, event).effects).toEqual(closed(1, 100, "before a"))
|
|
212
|
-
})
|
|
213
|
-
|
|
214
|
-
test("an unchanged setting writes nothing", () => {
|
|
215
|
-
const next = transitionDialogStack(kept.state, { type: "layer.backdrop-dismiss", attempt: 1, enabled: false })
|
|
216
|
-
|
|
217
|
-
expect(next.state).toBe(kept.state)
|
|
218
|
-
})
|
|
219
|
-
})
|
|
220
|
-
|
|
221
|
-
test("a replacing dialog returns focus to the origin and never notifies a closing dialog again", () => {
|
|
222
|
-
const before = run(createDialogStackState(), push("a"), push("b"), { type: "close", id: "b" })
|
|
223
|
-
const next = transitionDialogStack(before.state, show("c"))
|
|
224
|
-
|
|
225
|
-
expect(next.effects).toEqual([
|
|
226
|
-
{ type: "dispose", attempt: 1, notify: true },
|
|
227
|
-
{ type: "timer.stop", attempt: 2 },
|
|
228
|
-
{ type: "dispose", attempt: 2, notify: false },
|
|
229
|
-
{ type: "mount", attempt: 3, id: "c", request: "c" },
|
|
230
|
-
])
|
|
231
|
-
expect(statuses(next.state)).toEqual(["c:open"])
|
|
232
|
-
expect(run(next.state, { type: "dismiss" }).effects).toEqual(closed(3, 100, "before a"))
|
|
233
|
-
})
|
|
234
|
-
|
|
235
|
-
test("an open whose signal aborted neither mounts nor replaces, and its caller hears onClose", () => {
|
|
236
|
-
const before = run(createDialogStackState(), push("a"))
|
|
237
|
-
const next = transitionDialogStack(before.state, open("show", "b", true))
|
|
238
|
-
|
|
239
|
-
expect(next.state).toBe(before.state)
|
|
240
|
-
expect(next.effects).toEqual([{ type: "discard", request: "b", notify: true }])
|
|
241
|
-
})
|
|
242
|
-
|
|
243
|
-
describe("exit timers and disposal", () => {
|
|
244
|
-
test.each<[string, Event[]]>([
|
|
245
|
-
["an open dialog", [push("a")]],
|
|
246
|
-
["a dialog already gone", [push("a"), { type: "dismiss" }, { type: "exit.completed", attempt: 1 }]],
|
|
247
|
-
["a replaced dialog", [push("a"), { type: "dismiss" }, show("b")]],
|
|
248
|
-
])("ignore a late exit for %s", (_, events) => {
|
|
249
|
-
const before = run(createDialogStackState(), ...events)
|
|
250
|
-
const next = transitionDialogStack(before.state, { type: "exit.completed", attempt: 1 })
|
|
251
|
-
|
|
252
|
-
expect(next.state).toBe(before.state)
|
|
253
|
-
expect(next.effects).toEqual([])
|
|
254
|
-
})
|
|
255
|
-
|
|
256
|
-
test("a longer exit asked for after the close starts does not change the running timer", () => {
|
|
257
|
-
const before = run(createDialogStackState(), push("a"), { type: "dismiss" })
|
|
258
|
-
const next = transitionDialogStack(before.state, { type: "layer.exit-duration", attempt: 1, exitMs: 960 })
|
|
259
|
-
|
|
260
|
-
expect(next.state).toBe(before.state)
|
|
261
|
-
})
|
|
262
|
-
|
|
263
|
-
test("the provider going away stops exit timers, disposes every dialog silently and ignores what follows", () => {
|
|
264
|
-
const before = run(createDialogStackState(), push("a"), push("b"), { type: "dismiss" })
|
|
265
|
-
const gone = transitionDialogStack(before.state, { type: "disposed" })
|
|
266
|
-
|
|
267
|
-
expect(gone.effects).toEqual([
|
|
268
|
-
{ type: "dispose", attempt: 1, notify: false },
|
|
269
|
-
{ type: "timer.stop", attempt: 2 },
|
|
270
|
-
{ type: "dispose", attempt: 2, notify: false },
|
|
271
|
-
])
|
|
272
|
-
expect(selectTopDialog(gone.state)).toBeUndefined()
|
|
273
|
-
expect(selectLayerClosing(gone.state, 1)).toBe(true)
|
|
274
|
-
|
|
275
|
-
const late = [
|
|
276
|
-
{ type: "dismiss" },
|
|
277
|
-
{ type: "close" },
|
|
278
|
-
{ type: "exit.completed", attempt: 2 },
|
|
279
|
-
{ type: "disposed" },
|
|
280
|
-
] satisfies Event[]
|
|
281
|
-
|
|
282
|
-
late.forEach((event) => {
|
|
283
|
-
const next = transitionDialogStack(gone.state, event)
|
|
284
|
-
|
|
285
|
-
expect(next.state).toBe(gone.state)
|
|
286
|
-
expect(next.effects).toEqual([])
|
|
287
|
-
})
|
|
288
|
-
expect(transitionDialogStack(gone.state, push("c")).effects).toEqual([
|
|
289
|
-
{ type: "discard", request: "c", notify: false },
|
|
290
|
-
])
|
|
291
|
-
expect(transitionDialogStack(gone.state, open("push", "c", true)).effects).toEqual([
|
|
292
|
-
{ type: "discard", request: "c", notify: true },
|
|
293
|
-
])
|
|
294
|
-
})
|
|
295
|
-
})
|
package/src/context/i18n.test.ts
DELETED
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import { describe, expect, test } from "bun:test"
|
|
2
|
-
import { createUiI18n, localizedListSeparator, pluralCategory, resolveTemplate, type UiI18nSource } from "./i18n"
|
|
3
|
-
|
|
4
|
-
const i18n = (locale: string, translated: string) => {
|
|
5
|
-
const source: UiI18nSource = {
|
|
6
|
-
locale: () => locale,
|
|
7
|
-
t: () => translated,
|
|
8
|
-
plural: () => "",
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
return createUiI18n(source)
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
describe("pluralCategory", () => {
|
|
15
|
-
test.each([
|
|
16
|
-
["en", 0, "other"],
|
|
17
|
-
["en", 1, "one"],
|
|
18
|
-
["fr", 0, "one"],
|
|
19
|
-
["fr", 1_000_000, "many"],
|
|
20
|
-
["ru", 1, "one"],
|
|
21
|
-
["ru", 2, "few"],
|
|
22
|
-
["ru", 5, "many"],
|
|
23
|
-
["ru", 21, "one"],
|
|
24
|
-
["ar", 0, "zero"],
|
|
25
|
-
["ar", 1, "one"],
|
|
26
|
-
["ar", 2, "two"],
|
|
27
|
-
["ar", 3, "few"],
|
|
28
|
-
["ar", 11, "many"],
|
|
29
|
-
["ar", 100, "other"],
|
|
30
|
-
["ja", 1, "other"],
|
|
31
|
-
] as const)("selects %s for %d as %s", (locale, count, expected) => {
|
|
32
|
-
expect(pluralCategory(locale, count)).toBe(expected)
|
|
33
|
-
})
|
|
34
|
-
})
|
|
35
|
-
|
|
36
|
-
describe("dynamic source copy", () => {
|
|
37
|
-
test("keeps runtime copy for English locale tags", () => {
|
|
38
|
-
expect(
|
|
39
|
-
i18n("en-US", "Dictionary copy").tDynamic("dialog.usageExceeded.freeTier.title", "Runtime {{name}}", {
|
|
40
|
-
name: "copy",
|
|
41
|
-
}),
|
|
42
|
-
).toBe("Runtime copy")
|
|
43
|
-
})
|
|
44
|
-
|
|
45
|
-
test("uses dictionary copy for non-English locales", () => {
|
|
46
|
-
expect(i18n("fr", "Texte traduit").tDynamic("dialog.usageExceeded.freeTier.title", "Runtime copy")).toBe(
|
|
47
|
-
"Texte traduit",
|
|
48
|
-
)
|
|
49
|
-
})
|
|
50
|
-
})
|
|
51
|
-
|
|
52
|
-
describe("localizedListSeparator", () => {
|
|
53
|
-
test("uses locale list punctuation and conjunctions", () => {
|
|
54
|
-
expect(localizedListSeparator("en", 1, 3)).toBe(", ")
|
|
55
|
-
expect(localizedListSeparator("en", 2, 3)).toBe(", and ")
|
|
56
|
-
expect(localizedListSeparator("de", 1, 2)).toBe(" und ")
|
|
57
|
-
})
|
|
58
|
-
|
|
59
|
-
test("formats a complete localized list", () => {
|
|
60
|
-
expect(i18n("en", "").list(["Read", "Search", "List"])).toBe("Read, Search, List")
|
|
61
|
-
expect(i18n("en-US", "").list(["Read", "Search"])).toBe("Read, Search")
|
|
62
|
-
expect(i18n("en", "").listSeparator(2, 3)).toBe(",")
|
|
63
|
-
expect(i18n("de", "").list(["Lesen", "Suchen"])).toBe("Lesen und Suchen")
|
|
64
|
-
})
|
|
65
|
-
})
|
|
66
|
-
|
|
67
|
-
describe("resolveTemplate", () => {
|
|
68
|
-
test("fills params with optional inner spacing and repeats", () => {
|
|
69
|
-
expect(resolveTemplate("Hello {{name}}, {{ name }} and {{ other }}", { name: "Ada", other: 2 })).toBe(
|
|
70
|
-
"Hello Ada, Ada and 2",
|
|
71
|
-
)
|
|
72
|
-
})
|
|
73
|
-
|
|
74
|
-
test("stringifies numbers and booleans, including zero and false", () => {
|
|
75
|
-
expect(resolveTemplate("{{count}} {{done}}", { count: 0, done: false })).toBe("0 false")
|
|
76
|
-
})
|
|
77
|
-
|
|
78
|
-
test("returns the text untouched without params", () => {
|
|
79
|
-
expect(resolveTemplate("Hello {{name}}")).toBe("Hello {{name}}")
|
|
80
|
-
})
|
|
81
|
-
|
|
82
|
-
test("does not treat $ in a value as a replacement pattern", () => {
|
|
83
|
-
expect(resolveTemplate("file {{name}}", { name: "a$&b$1" })).toBe("file a$&b$1")
|
|
84
|
-
})
|
|
85
|
-
|
|
86
|
-
test("blanks a placeholder whose param is missing", () => {
|
|
87
|
-
expect(resolveTemplate("a {{missing}} b", { other: "x" })).toBe("a b")
|
|
88
|
-
})
|
|
89
|
-
})
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import { expect, test } from "bun:test"
|
|
2
|
-
import { createMarkdownBase, parseSmallMarkdown } from "./marked-base"
|
|
3
|
-
|
|
4
|
-
test.each([
|
|
5
|
-
"Plain response.",
|
|
6
|
-
"The grade cost $0.5664, and the original run is preserved.",
|
|
7
|
-
"The issue is fixed: all 13 queries succeeded.",
|
|
8
|
-
"Completion is 100%…",
|
|
9
|
-
"https://example.com",
|
|
10
|
-
"Plain response. ",
|
|
11
|
-
"Plain response.\t",
|
|
12
|
-
"\nPlain response.\n",
|
|
13
|
-
"\u00a0Plain response.\u00a0",
|
|
14
|
-
"A paragraph\r---",
|
|
15
|
-
"A paragraph \rwith a hard break.",
|
|
16
|
-
"We can—Code Mode would be useful.\n\nI’ll enable the read-only tools.",
|
|
17
|
-
"A paragraph\nwith a soft break.",
|
|
18
|
-
"A paragraph\r\n\r\nAnother paragraph.",
|
|
19
|
-
"A paragraph\n\n\nAnother paragraph.\n",
|
|
20
|
-
"Quotes: \"yes\" and 'no'.",
|
|
21
|
-
"She said \"yes\" and 'no'.",
|
|
22
|
-
"日本語の文章。",
|
|
23
|
-
"Простой текст.",
|
|
24
|
-
"١. العربية",
|
|
25
|
-
"Hello & goodbye <world>.",
|
|
26
|
-
"A paragraph \nwith a hard break.",
|
|
27
|
-
"Title\n---",
|
|
28
|
-
"- A list\n- Another item",
|
|
29
|
-
"1. A list\n2. Another item",
|
|
30
|
-
"www.example.com",
|
|
31
|
-
"Bold **text** and `code`.",
|
|
32
|
-
"**Done.** The judge made **13 evidence queries**.",
|
|
33
|
-
"The tool is `candidate_evidence`.\n\nIt can query messages.",
|
|
34
|
-
"***Strong emphasis*** and _emphasis_.",
|
|
35
|
-
"A [link](https://example.com) and .",
|
|
36
|
-
"A reference [link][id].\n\n[id]: https://example.com",
|
|
37
|
-
"A paragraph\n# Heading",
|
|
38
|
-
"### Heading",
|
|
39
|
-
"####### Paragraph",
|
|
40
|
-
"***",
|
|
41
|
-
"_ _ _",
|
|
42
|
-
"**",
|
|
43
|
-
"*",
|
|
44
|
-
"+ Item",
|
|
45
|
-
"> Quote",
|
|
46
|
-
"A paragraph\n---",
|
|
47
|
-
"A paragraph\n===",
|
|
48
|
-
"a | b\n--- | ---\nc | d",
|
|
49
|
-
"<div>HTML</div>",
|
|
50
|
-
"A paragraph\n with indentation.",
|
|
51
|
-
"~~Struck~~ text and www.example.com.",
|
|
52
|
-
"A **bold\nsoft break**.",
|
|
53
|
-
"An escaped \\*asterisk\\*.",
|
|
54
|
-
" indented code",
|
|
55
|
-
"\n indented code",
|
|
56
|
-
" ",
|
|
57
|
-
])("preserves the Markdown parser's meaning for %j", (text) => {
|
|
58
|
-
const expected = createMarkdownBase().parse(text, { async: false })
|
|
59
|
-
|
|
60
|
-
if (text.includes("indented code")) {
|
|
61
|
-
expect(parseSmallMarkdown(text)).toBeUndefined()
|
|
62
|
-
|
|
63
|
-
return
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
expect(parseSmallMarkdown(text)).toBe(expected)
|
|
67
|
-
})
|
|
68
|
-
|
|
69
|
-
test("keeps code blocks, math, and large messages on the worker path", () => {
|
|
70
|
-
expect(parseSmallMarkdown("```ts\nconst value = 1\n```")).toBeUndefined()
|
|
71
|
-
expect(parseSmallMarkdown("~~~ts\nconst value = 1\n~~~")).toBeUndefined()
|
|
72
|
-
expect(parseSmallMarkdown("\\(x + y\\)")).toBeUndefined()
|
|
73
|
-
expect(parseSmallMarkdown("$$x + y$$")).toBeUndefined()
|
|
74
|
-
expect(parseSmallMarkdown("a".repeat(1025))).toBeUndefined()
|
|
75
|
-
})
|
|
@@ -1,167 +0,0 @@
|
|
|
1
|
-
import { expect, test } from "bun:test"
|
|
2
|
-
import { createMarkdownParser } from "./marked-parser"
|
|
3
|
-
import { parseSmallMarkdown } from "./marked-base"
|
|
4
|
-
|
|
5
|
-
const parser = createMarkdownParser()
|
|
6
|
-
|
|
7
|
-
test.each([
|
|
8
|
-
["OpenCode", "OpenCode"],
|
|
9
|
-
["**`#123`**", "<strong><code>#123</code></strong>"],
|
|
10
|
-
["*Review* ~~draft~~", "<em>Review</em> <del>draft</del>"],
|
|
11
|
-
["`<example>`", "<code><example></code>"],
|
|
12
|
-
["\\*literal\\*", "*literal*"],
|
|
13
|
-
])("renders link label %s with application attributes", async (label, html) => {
|
|
14
|
-
const markdown = `[${label}](https://opencode.ai)`
|
|
15
|
-
const expected = `<p><a href="https://opencode.ai" class="external-link" target="_blank" rel="noopener noreferrer">${html}</a></p>\n`
|
|
16
|
-
|
|
17
|
-
expect(await parser.parse(markdown)).toBe(expected)
|
|
18
|
-
expect(parseSmallMarkdown(markdown)).toBe(expected)
|
|
19
|
-
})
|
|
20
|
-
|
|
21
|
-
test("keeps fragment links in the page", async () => {
|
|
22
|
-
const markdown = "See [Host services](#host-services)"
|
|
23
|
-
const expected = '<p>See <a href="#host-services">Host services</a></p>\n'
|
|
24
|
-
|
|
25
|
-
expect(await parser.parse(markdown)).toBe(expected)
|
|
26
|
-
expect(parseSmallMarkdown(markdown)).toBe(expected)
|
|
27
|
-
})
|
|
28
|
-
|
|
29
|
-
test("renders inline and block math", async () => {
|
|
30
|
-
expect(await parser.parse("\\(x^2\\)")).toContain('<span class="katex">')
|
|
31
|
-
expect(await parser.parse("$$\nx^2\n$$\n")).toContain('<span class="katex-display">')
|
|
32
|
-
})
|
|
33
|
-
|
|
34
|
-
test.each([
|
|
35
|
-
"Energy is $E = mc^2$.",
|
|
36
|
-
"因此 $x^2$ 是正数",
|
|
37
|
-
"因此$x^2$是正数",
|
|
38
|
-
"$a_1$ and $b_1$.",
|
|
39
|
-
"where (i.e. $x$) holds",
|
|
40
|
-
"the $x$-axis",
|
|
41
|
-
"is $x$; y",
|
|
42
|
-
"$x$'s value",
|
|
43
|
-
"ack ($440\\text{ ms}$ IPC p50)",
|
|
44
|
-
])("renders dollar inline math: %s", async (text) => {
|
|
45
|
-
const html = await parser.parse(text)
|
|
46
|
-
expect(html).toContain('<span class="katex">')
|
|
47
|
-
expect(html).not.toContain("$")
|
|
48
|
-
})
|
|
49
|
-
|
|
50
|
-
test("renders every dollar span in a line", async () => {
|
|
51
|
-
const html = await parser.parse("ack ($440\\text{ ms}$ IPC p50, $413\\text{ MB} \\rightarrow 98\\text{ MB}$)")
|
|
52
|
-
expect(html.match(/<span class="katex">/g)).toHaveLength(2)
|
|
53
|
-
expect(html).not.toContain("$")
|
|
54
|
-
})
|
|
55
|
-
|
|
56
|
-
test("keeps an escaped dollar inside dollar math", async () => {
|
|
57
|
-
const html = await parser.parse("Escaped $a\\$b$ dollar")
|
|
58
|
-
expect(html.match(/<span class="katex">/g)).toHaveLength(1)
|
|
59
|
-
expect(html).toContain('<annotation encoding="application/x-tex">a\\$b</annotation>')
|
|
60
|
-
})
|
|
61
|
-
|
|
62
|
-
test.each(["$$E = mc^2$$", "Inline $$x$$ display", "($$x$$)", "$$\na\n\nb\n$$\n"])(
|
|
63
|
-
"renders dollar display math: %s",
|
|
64
|
-
async (text) => {
|
|
65
|
-
const html = await parser.parse(text)
|
|
66
|
-
expect(html).toContain('<span class="katex-display">')
|
|
67
|
-
expect(html).not.toContain("$$")
|
|
68
|
-
},
|
|
69
|
-
)
|
|
70
|
-
|
|
71
|
-
test.each([
|
|
72
|
-
"It costs $5 and $10.",
|
|
73
|
-
"From $5-$10 a month",
|
|
74
|
-
"It costs $5, originally $10, ranging from $1,000 to $2,000.",
|
|
75
|
-
"It costs $5 (or $6) now",
|
|
76
|
-
"between $5 and $6 dollars",
|
|
77
|
-
"paid $5/$6.",
|
|
78
|
-
"Use $HOME and $PATH",
|
|
79
|
-
"Use $HOME/$USER or $PATH:$HOME",
|
|
80
|
-
"Use `$x$` as a placeholder",
|
|
81
|
-
"An escaped \\$x$ dollar",
|
|
82
|
-
"$ x $ has space inside its delimiters",
|
|
83
|
-
])("leaves prices, shell variables, and code as text: %s", async (text) => {
|
|
84
|
-
expect(await parser.parse(text)).not.toContain("katex")
|
|
85
|
-
})
|
|
86
|
-
|
|
87
|
-
// Each repeated unit took seconds at this size when `start` retried the dollar regex from every `$` for every text token.
|
|
88
|
-
test("lexes dollar-heavy paragraphs in near-linear time", () => {
|
|
89
|
-
const units = ["`a` $5 ", "$a ", "\\$$a", "$a\\\\\\ ", "It costs $5, ", "with `c` $x_1$ and "]
|
|
90
|
-
const startedAt = performance.now()
|
|
91
|
-
units.forEach((unit) => parser.lexer(unit.repeat(Math.ceil(10_000 / unit.length))))
|
|
92
|
-
expect(performance.now() - startedAt).toBeLessThan(500)
|
|
93
|
-
})
|
|
94
|
-
|
|
95
|
-
test("highlights fenced code with the app theme variables", async () => {
|
|
96
|
-
const html = await parser.parse("```ts\nconst value = 1\n```\n")
|
|
97
|
-
|
|
98
|
-
expect(html).toStartWith('<pre class="highlights" style="background-color:var(--color-background-stronger)')
|
|
99
|
-
expect(html).toContain('<code class="language-ts">')
|
|
100
|
-
expect(html).toContain('<span style="color:var(--syntax-keyword)">const </span>')
|
|
101
|
-
})
|
|
102
|
-
|
|
103
|
-
test.each(["latex", "math", "LaTeX", "latex title=\"Score\""])("renders a %s fence as display math", async (lang) => {
|
|
104
|
-
const html = await parser.parse(
|
|
105
|
-
`\`\`\`${lang}\nS_{\\text{adj}} = \\min\\!\\left(10,\\; S \\cdot \\left(\\frac{T_0}{T}\\right)^{\\alpha}\\right)\n\`\`\`\n`,
|
|
106
|
-
)
|
|
107
|
-
|
|
108
|
-
expect(html).toStartWith('<span class="katex-display">')
|
|
109
|
-
expect(html).not.toContain("<pre")
|
|
110
|
-
})
|
|
111
|
-
|
|
112
|
-
test("renders a math fence inside a list item", async () => {
|
|
113
|
-
expect(await parser.parse("- Score:\n\n ```latex\n x^2\n ```\n")).toContain('<span class="katex-display">')
|
|
114
|
-
})
|
|
115
|
-
|
|
116
|
-
test.each(["\\frac{1}{", "\\notacommand{x}", ""])("keeps a math fence KaTeX cannot parse as code: %p", async (source) => {
|
|
117
|
-
const html = await parser.parse(`\`\`\`latex\n${source}\n\`\`\`\n`)
|
|
118
|
-
|
|
119
|
-
expect(html).toContain('<code class="language-latex">')
|
|
120
|
-
expect(html).not.toContain("katex")
|
|
121
|
-
})
|
|
122
|
-
|
|
123
|
-
test("keeps the fence language for code without a lexer", async () => {
|
|
124
|
-
const html = await parser.parse("```mermaid\ngraph TD; A-->B\n```\n")
|
|
125
|
-
|
|
126
|
-
expect(html).toContain('<code class="language-mermaid">graph TD; A-->B</code>')
|
|
127
|
-
})
|
|
128
|
-
|
|
129
|
-
test.each(["```", "~~~"])("recognizes an empty %s fence at EOF", async (fence) => {
|
|
130
|
-
expect(await parser.parse(`foo\n${fence}`)).toContain('<p>foo</p>\n<pre class="highlights"')
|
|
131
|
-
expect(await parser.parse(`foo\n${fence}`)).toContain('<code class="language-text"></code>')
|
|
132
|
-
})
|
|
133
|
-
|
|
134
|
-
test("preserves emphasis when rejecting an outer reference link", async () => {
|
|
135
|
-
expect(await parser.parse("[foo *bar [baz](/url) qux*][ref]\n\n[ref]: /uri")).toBe(
|
|
136
|
-
'<p>[foo <em>bar <a href="/url" class="external-link" target="_blank" rel="noopener noreferrer">baz</a> qux</em>]<a href="/uri" class="external-link" target="_blank" rel="noopener noreferrer">ref</a></p>\n',
|
|
137
|
-
)
|
|
138
|
-
})
|
|
139
|
-
|
|
140
|
-
test.each([
|
|
141
|
-
"Plain text with **bold**, *emphasis*, ~~deleted~~, and `inline code`.",
|
|
142
|
-
"## Heading\n\n> Quote\n\n- Done\n- Nested\n - item",
|
|
143
|
-
"| A | B |\n| --- | ---: |\n| one | two |",
|
|
144
|
-
'[link](https://example.com "Title") and <https://example.com>',
|
|
145
|
-
"[reference][key]\n\n[key]: https://example.com",
|
|
146
|
-
"[foo *bar [baz](/url) qux*][ref]\n\n[ref]: /uri",
|
|
147
|
-
'<img src="image.png" onerror="alert(1)"><script>alert(2)</script>',
|
|
148
|
-
"hello\r\n\r\nworld",
|
|
149
|
-
])("small Markdown uses the same rendering rules: %s", async (text) => {
|
|
150
|
-
expect(parseSmallMarkdown(text)).toBe(await parser.parse(text))
|
|
151
|
-
})
|
|
152
|
-
|
|
153
|
-
test.each([
|
|
154
|
-
"```ts\nconst answer = 42\n```",
|
|
155
|
-
"- [x] Done\n- [ ] Pending",
|
|
156
|
-
"~~~\ncode\n~~~",
|
|
157
|
-
" indented code",
|
|
158
|
-
"> ```ts\n> const nested = true\n> ```",
|
|
159
|
-
"- item\n\n nested code",
|
|
160
|
-
"foo\n```",
|
|
161
|
-
"\\(x^2\\)",
|
|
162
|
-
"$$\nx^2\n$$\n",
|
|
163
|
-
"Energy is $E = mc^2$.",
|
|
164
|
-
"a".repeat(1025),
|
|
165
|
-
])("leaves code, math, and large Markdown to the worker: %s", (text) => {
|
|
166
|
-
expect(parseSmallMarkdown(text)).toBeUndefined()
|
|
167
|
-
})
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { expect, test } from "bun:test"
|
|
2
|
-
import { Marked } from "marked"
|
|
3
|
-
|
|
4
|
-
test("preserves code spans adjacent to tildes", async () => {
|
|
5
|
-
const marked = new Marked()
|
|
6
|
-
|
|
7
|
-
expect(await marked.parse("~`0.1576` to measurement-window-only `0.00092`")).toBe(
|
|
8
|
-
"<p>~<code>0.1576</code> to measurement-window-only <code>0.00092</code></p>\n",
|
|
9
|
-
)
|
|
10
|
-
expect(await marked.parse("`before`~`after`")).toBe("<p><code>before</code>~<code>after</code></p>\n")
|
|
11
|
-
expect(await marked.parse("~~`deleted code`~~")).toBe("<p><del><code>deleted code</code></del></p>\n")
|
|
12
|
-
})
|