@opencode/ui 0.0.0-beta-19275
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/LICENSE +21 -0
- package/dist/actions/button/button.d.ts +10 -0
- package/dist/actions/icon-button/icon-button.d.ts +11 -0
- package/dist/actions/split-button/split-button.d.ts +5 -0
- package/dist/components/animated-number.d.ts +4 -0
- package/dist/components/app-icon.d.ts +6 -0
- package/dist/components/app-icons/types.d.ts +2 -0
- package/dist/components/card.d.ts +22 -0
- package/dist/components/collapsible.d.ts +17 -0
- package/dist/components/context-menu.d.ts +80 -0
- package/dist/components/dock-surface.d.ts +7 -0
- package/dist/components/favicon.d.ts +1 -0
- package/dist/components/file-icon.d.ts +12 -0
- package/dist/components/file-icons/types.d.ts +2 -0
- package/dist/components/font.d.ts +1 -0
- package/dist/components/hover-card.d.ts +9 -0
- package/dist/components/image-preview.d.ts +5 -0
- package/dist/components/list.d.ts +45 -0
- package/dist/components/logo.d.ts +8 -0
- package/dist/components/motion-spring.d.ts +4 -0
- package/dist/components/popover.d.ts +14 -0
- package/dist/components/progress.d.ts +7 -0
- package/dist/components/provider-icon.d.ts +5 -0
- package/dist/components/provider-icons/types.d.ts +2 -0
- package/dist/components/resize-handle.d.ts +14 -0
- package/dist/components/scroll-view.d.ts +42 -0
- package/dist/components/spinner.d.ts +6 -0
- package/dist/components/sticky-accordion-header.d.ts +5 -0
- package/dist/components/text-field.d.ts +13 -0
- package/dist/components/text-reveal.d.ts +13 -0
- package/dist/components/text-strikethrough.d.ts +11 -0
- package/dist/components/typewriter.d.ts +6 -0
- package/dist/context/dialog.d.ts +18 -0
- package/dist/context/file.d.ts +5 -0
- package/dist/context/helper.d.ts +14 -0
- package/dist/context/i18n.d.ts +24 -0
- package/dist/context/index.d.ts +4 -0
- package/dist/context/marked-base.d.ts +3 -0
- package/dist/context/marked-parser.d.ts +1 -0
- package/dist/context/marked-theme-register.d.ts +1 -0
- package/dist/context/marked-theme.d.ts +2 -0
- package/dist/context/marked.d.ts +2 -0
- package/dist/context/worker-pool.d.ts +9 -0
- package/dist/data-display/accordion/accordion.d.ts +24 -0
- package/dist/data-display/avatar/avatar.d.ts +11 -0
- package/dist/data-display/badge/badge.d.ts +7 -0
- package/dist/data-display/diff-changes/diff-changes.d.ts +12 -0
- package/dist/data-display/keybind/keybind.d.ts +7 -0
- package/dist/data-display/line-comment/line-comment.d.ts +32 -0
- package/dist/data-display/project-avatar/project-avatar.d.ts +12 -0
- package/dist/feedback/loader/loader.d.ts +3 -0
- package/dist/feedback/progress-circle/progress-circle.d.ts +9 -0
- package/dist/feedback/toast/toast.d.ts +57 -0
- package/dist/forms/checkbox/checkbox.d.ts +8 -0
- package/dist/forms/field/field.d.ts +22 -0
- package/dist/forms/inline-input/inline-input.d.ts +5 -0
- package/dist/forms/radio/radio.d.ts +16 -0
- package/dist/forms/select/select.d.ts +23 -0
- package/dist/forms/switch/switch.d.ts +9 -0
- package/dist/forms/text-input/text-input.d.ts +24 -0
- package/dist/forms/textarea/textarea.d.ts +7 -0
- package/dist/hooks/create-auto-scroll.d.ts +17 -0
- package/dist/hooks/index.d.ts +2 -0
- package/dist/hooks/use-filtered-list.d.ts +48 -0
- package/dist/i18n/am.d.ts +1 -0
- package/dist/i18n/ar.d.ts +209 -0
- package/dist/i18n/az.d.ts +1 -0
- package/dist/i18n/bg.d.ts +193 -0
- package/dist/i18n/bn.d.ts +1 -0
- package/dist/i18n/br.d.ts +197 -0
- package/dist/i18n/bs.d.ts +197 -0
- package/dist/i18n/ca.d.ts +1 -0
- package/dist/i18n/cs.d.ts +1 -0
- package/dist/i18n/da.d.ts +193 -0
- package/dist/i18n/de.d.ts +193 -0
- package/dist/i18n/dv.d.ts +1 -0
- package/dist/i18n/dz.d.ts +1 -0
- package/dist/i18n/el.d.ts +1 -0
- package/dist/i18n/en.d.ts +244 -0
- package/dist/i18n/es.d.ts +197 -0
- package/dist/i18n/et.d.ts +1 -0
- package/dist/i18n/fa.d.ts +1 -0
- package/dist/i18n/fi.d.ts +1 -0
- package/dist/i18n/fo.d.ts +1 -0
- package/dist/i18n/fr.d.ts +197 -0
- package/dist/i18n/he.d.ts +197 -0
- package/dist/i18n/hi.d.ts +1 -0
- package/dist/i18n/hr.d.ts +1 -0
- package/dist/i18n/hu.d.ts +1 -0
- package/dist/i18n/hy.d.ts +1 -0
- package/dist/i18n/id.d.ts +1 -0
- package/dist/i18n/is.d.ts +1 -0
- package/dist/i18n/it.d.ts +1 -0
- package/dist/i18n/ja.d.ts +193 -0
- package/dist/i18n/ka.d.ts +1 -0
- package/dist/i18n/km.d.ts +193 -0
- package/dist/i18n/ko.d.ts +193 -0
- package/dist/i18n/lo.d.ts +193 -0
- package/dist/i18n/lt.d.ts +1 -0
- package/dist/i18n/lv.d.ts +1 -0
- package/dist/i18n/mk.d.ts +193 -0
- package/dist/i18n/mn.d.ts +193 -0
- package/dist/i18n/ms.d.ts +1 -0
- package/dist/i18n/my.d.ts +193 -0
- package/dist/i18n/ne.d.ts +1 -0
- package/dist/i18n/nl.d.ts +1 -0
- package/dist/i18n/no.d.ts +4 -0
- package/dist/i18n/pa.d.ts +1 -0
- package/dist/i18n/pl.d.ts +201 -0
- package/dist/i18n/ro.d.ts +1 -0
- package/dist/i18n/ru.d.ts +201 -0
- package/dist/i18n/si.d.ts +1 -0
- package/dist/i18n/sk.d.ts +1 -0
- package/dist/i18n/sl.d.ts +1 -0
- package/dist/i18n/sq.d.ts +1 -0
- package/dist/i18n/sr.d.ts +197 -0
- package/dist/i18n/sv.d.ts +1 -0
- package/dist/i18n/tg.d.ts +193 -0
- package/dist/i18n/th.d.ts +193 -0
- package/dist/i18n/tk.d.ts +1 -0
- package/dist/i18n/tr.d.ts +193 -0
- package/dist/i18n/uk.d.ts +1 -0
- package/dist/i18n/ur.d.ts +1 -0
- package/dist/i18n/uz.d.ts +1 -0
- package/dist/i18n/vi.d.ts +1 -0
- package/dist/i18n/zh.d.ts +193 -0
- package/dist/i18n/zht.d.ts +193 -0
- package/dist/icons/icon/additional-icons.d.ts +105 -0
- package/dist/icons/icon/icon.d.ts +216 -0
- package/dist/layout/divider/divider.d.ts +5 -0
- package/dist/navigation/menu/menu.d.ts +59 -0
- package/dist/navigation/segmented-control/segmented-control.d.ts +21 -0
- package/dist/navigation/tab-state-indicator.d.ts +2 -0
- package/dist/navigation/tabs/tabs.d.ts +39 -0
- package/dist/overlays/dialog/dialog.d.ts +26 -0
- package/dist/overlays/tooltip/tooltip.d.ts +15 -0
- package/dist/storybook/fixtures.d.ts +19 -0
- package/dist/storybook/scaffold.d.ts +16 -0
- package/dist/theme/color.d.ts +30 -0
- package/dist/theme/context.d.ts +21 -0
- package/dist/theme/default-themes.d.ts +39 -0
- package/dist/theme/index.d.ts +7 -0
- package/dist/theme/loader.d.ts +6 -0
- package/dist/theme/resolve.d.ts +7 -0
- package/dist/theme/types.d.ts +56 -0
- package/dist/theme/v2/avatar.d.ts +5 -0
- package/dist/theme/v2/default-primitives.d.ts +3 -0
- package/dist/theme/v2/foreground.d.ts +2 -0
- package/dist/theme/v2/mapping.d.ts +3 -0
- package/dist/theme/v2/resolve.d.ts +9 -0
- package/dist/typography/text-shimmer/text-shimmer.d.ts +9 -0
- package/dist/typography/wordmark/wordmark.d.ts +5 -0
- package/package.json +261 -0
- package/src/actions/button/button.css +292 -0
- package/src/actions/button/button.tsx +41 -0
- package/src/actions/icon-button/icon-button.css +177 -0
- package/src/actions/icon-button/icon-button.tsx +32 -0
- package/src/actions/split-button/split-button.css +95 -0
- package/src/actions/split-button/split-button.tsx +48 -0
- package/src/assets/audio/alert-01.aac +0 -0
- package/src/assets/audio/alert-01.mp3 +0 -0
- package/src/assets/audio/alert-02.aac +0 -0
- package/src/assets/audio/alert-02.mp3 +0 -0
- package/src/assets/audio/alert-03.aac +0 -0
- package/src/assets/audio/alert-03.mp3 +0 -0
- package/src/assets/audio/alert-04.aac +0 -0
- package/src/assets/audio/alert-04.mp3 +0 -0
- package/src/assets/audio/alert-05.aac +0 -0
- package/src/assets/audio/alert-05.mp3 +0 -0
- package/src/assets/audio/alert-06.aac +0 -0
- package/src/assets/audio/alert-06.mp3 +0 -0
- package/src/assets/audio/alert-07.aac +0 -0
- package/src/assets/audio/alert-07.mp3 +0 -0
- package/src/assets/audio/alert-08.aac +0 -0
- package/src/assets/audio/alert-08.mp3 +0 -0
- package/src/assets/audio/alert-09.aac +0 -0
- package/src/assets/audio/alert-09.mp3 +0 -0
- package/src/assets/audio/alert-10.aac +0 -0
- package/src/assets/audio/alert-10.mp3 +0 -0
- package/src/assets/audio/bip-bop-01.aac +0 -0
- package/src/assets/audio/bip-bop-01.mp3 +0 -0
- package/src/assets/audio/bip-bop-02.aac +0 -0
- package/src/assets/audio/bip-bop-02.mp3 +0 -0
- package/src/assets/audio/bip-bop-03.aac +0 -0
- package/src/assets/audio/bip-bop-03.mp3 +0 -0
- package/src/assets/audio/bip-bop-04.aac +0 -0
- package/src/assets/audio/bip-bop-04.mp3 +0 -0
- package/src/assets/audio/bip-bop-05.aac +0 -0
- package/src/assets/audio/bip-bop-05.mp3 +0 -0
- package/src/assets/audio/bip-bop-06.aac +0 -0
- package/src/assets/audio/bip-bop-06.mp3 +0 -0
- package/src/assets/audio/bip-bop-07.aac +0 -0
- package/src/assets/audio/bip-bop-07.mp3 +0 -0
- package/src/assets/audio/bip-bop-08.aac +0 -0
- package/src/assets/audio/bip-bop-08.mp3 +0 -0
- package/src/assets/audio/bip-bop-09.aac +0 -0
- package/src/assets/audio/bip-bop-09.mp3 +0 -0
- package/src/assets/audio/bip-bop-10.aac +0 -0
- package/src/assets/audio/bip-bop-10.mp3 +0 -0
- package/src/assets/audio/nope-01.aac +0 -0
- package/src/assets/audio/nope-01.mp3 +0 -0
- package/src/assets/audio/nope-02.aac +0 -0
- package/src/assets/audio/nope-02.mp3 +0 -0
- package/src/assets/audio/nope-03.aac +0 -0
- package/src/assets/audio/nope-03.mp3 +0 -0
- package/src/assets/audio/nope-04.aac +0 -0
- package/src/assets/audio/nope-04.mp3 +0 -0
- package/src/assets/audio/nope-05.aac +0 -0
- package/src/assets/audio/nope-05.mp3 +0 -0
- package/src/assets/audio/nope-06.aac +0 -0
- package/src/assets/audio/nope-06.mp3 +0 -0
- package/src/assets/audio/nope-07.aac +0 -0
- package/src/assets/audio/nope-07.mp3 +0 -0
- package/src/assets/audio/nope-08.aac +0 -0
- package/src/assets/audio/nope-08.mp3 +0 -0
- package/src/assets/audio/nope-09.aac +0 -0
- package/src/assets/audio/nope-09.mp3 +0 -0
- package/src/assets/audio/nope-10.aac +0 -0
- package/src/assets/audio/nope-10.mp3 +0 -0
- package/src/assets/audio/nope-11.aac +0 -0
- package/src/assets/audio/nope-11.mp3 +0 -0
- package/src/assets/audio/nope-12.aac +0 -0
- package/src/assets/audio/nope-12.mp3 +0 -0
- package/src/assets/audio/staplebops-01.aac +0 -0
- package/src/assets/audio/staplebops-01.mp3 +0 -0
- package/src/assets/audio/staplebops-02.aac +0 -0
- package/src/assets/audio/staplebops-02.mp3 +0 -0
- package/src/assets/audio/staplebops-03.aac +0 -0
- package/src/assets/audio/staplebops-03.mp3 +0 -0
- package/src/assets/audio/staplebops-04.aac +0 -0
- package/src/assets/audio/staplebops-04.mp3 +0 -0
- package/src/assets/audio/staplebops-05.aac +0 -0
- package/src/assets/audio/staplebops-05.mp3 +0 -0
- package/src/assets/audio/staplebops-06.aac +0 -0
- package/src/assets/audio/staplebops-06.mp3 +0 -0
- package/src/assets/audio/staplebops-07.aac +0 -0
- package/src/assets/audio/staplebops-07.mp3 +0 -0
- package/src/assets/audio/yup-01.aac +0 -0
- package/src/assets/audio/yup-01.mp3 +0 -0
- package/src/assets/audio/yup-02.aac +0 -0
- package/src/assets/audio/yup-02.mp3 +0 -0
- package/src/assets/audio/yup-03.aac +0 -0
- package/src/assets/audio/yup-03.mp3 +0 -0
- package/src/assets/audio/yup-04.aac +0 -0
- package/src/assets/audio/yup-04.mp3 +0 -0
- package/src/assets/audio/yup-05.aac +0 -0
- package/src/assets/audio/yup-05.mp3 +0 -0
- package/src/assets/audio/yup-06.aac +0 -0
- package/src/assets/audio/yup-06.mp3 +0 -0
- package/src/assets/fonts/Inter.ttf +0 -0
- package/src/assets/fonts/JetBrainsMonoNerdFontMono-Regular.woff2 +0 -0
- package/src/assets/icons/app/android-studio.svg +369 -0
- package/src/assets/icons/app/antigravity.svg +97 -0
- package/src/assets/icons/app/cursor.svg +16 -0
- package/src/assets/icons/app/file-explorer.svg +20 -0
- package/src/assets/icons/app/finder.png +0 -0
- package/src/assets/icons/app/ghostty.svg +13 -0
- package/src/assets/icons/app/iterm2.svg +13 -0
- package/src/assets/icons/app/powershell.svg +14 -0
- package/src/assets/icons/app/sublimetext.svg +17 -0
- package/src/assets/icons/app/terminal.png +0 -0
- package/src/assets/icons/app/textmate.png +0 -0
- package/src/assets/icons/app/vscode.svg +39 -0
- package/src/assets/icons/app/warp.png +0 -0
- package/src/assets/icons/app/xcode.png +0 -0
- package/src/assets/icons/app/zed-dark.svg +15 -0
- package/src/assets/icons/app/zed.svg +15 -0
- package/src/components/animated-number.css +93 -0
- package/src/components/animated-number.tsx +109 -0
- package/src/components/app-icon.css +5 -0
- package/src/components/app-icon.tsx +85 -0
- package/src/components/app-icons/sprite.svg +114 -0
- package/src/components/app-icons/types.ts +21 -0
- package/src/components/card.css +94 -0
- package/src/components/card.tsx +123 -0
- package/src/components/collapsible.css +154 -0
- package/src/components/collapsible.tsx +48 -0
- package/src/components/context-menu.css +134 -0
- package/src/components/context-menu.tsx +308 -0
- package/src/components/dock-surface.css +30 -0
- package/src/components/dock-surface.tsx +54 -0
- package/src/components/favicon.tsx +13 -0
- package/src/components/file-icon.css +26 -0
- package/src/components/file-icon.tsx +588 -0
- package/src/components/file-icons/sprite.svg +11707 -0
- package/src/components/file-icons/types.ts +1095 -0
- package/src/components/font.tsx +1 -0
- package/src/components/hover-card.css +61 -0
- package/src/components/hover-card.tsx +32 -0
- package/src/components/image-preview.css +63 -0
- package/src/components/image-preview.tsx +33 -0
- package/src/components/list.css +331 -0
- package/src/components/list.tsx +396 -0
- package/src/components/logo.css +4 -0
- package/src/components/logo.tsx +62 -0
- package/src/components/motion-spring.tsx +58 -0
- package/src/components/popover.css +98 -0
- package/src/components/popover.tsx +154 -0
- package/src/components/progress.css +63 -0
- package/src/components/progress.tsx +39 -0
- package/src/components/provider-icon.css +5 -0
- package/src/components/provider-icon.tsx +25 -0
- package/src/components/provider-icons/sprite.svg +1110 -0
- package/src/components/provider-icons/types.ts +105 -0
- package/src/components/resize-handle.css +70 -0
- package/src/components/resize-handle.tsx +102 -0
- package/src/components/scroll-view.css +99 -0
- package/src/components/scroll-view.tsx +453 -0
- package/src/components/spinner.css +6 -0
- package/src/components/spinner.tsx +52 -0
- package/src/components/sticky-accordion-header.css +6 -0
- package/src/components/sticky-accordion-header.tsx +18 -0
- package/src/components/text-field.css +134 -0
- package/src/components/text-field.tsx +136 -0
- package/src/components/text-reveal.css +150 -0
- package/src/components/text-reveal.tsx +143 -0
- package/src/components/text-strikethrough.css +27 -0
- package/src/components/text-strikethrough.tsx +84 -0
- package/src/components/typewriter.css +14 -0
- package/src/components/typewriter.tsx +55 -0
- package/src/context/dialog.tsx +198 -0
- package/src/context/file.tsx +10 -0
- package/src/context/helper.tsx +38 -0
- package/src/context/i18n.tsx +77 -0
- package/src/context/index.ts +4 -0
- package/src/context/marked-base.tsx +27 -0
- package/src/context/marked-parser.tsx +58 -0
- package/src/context/marked-theme-register.tsx +10 -0
- package/src/context/marked-theme.tsx +372 -0
- package/src/context/marked.tsx +28 -0
- package/src/context/worker-pool.tsx +20 -0
- package/src/custom-elements.d.ts +17 -0
- package/src/data-display/accordion/accordion.css +121 -0
- package/src/data-display/accordion/accordion.tsx +92 -0
- package/src/data-display/avatar/avatar.css +70 -0
- package/src/data-display/avatar/avatar.tsx +59 -0
- package/src/data-display/badge/badge.css +52 -0
- package/src/data-display/badge/badge.tsx +25 -0
- package/src/data-display/diff-changes/diff-changes.css +47 -0
- package/src/data-display/diff-changes/diff-changes.tsx +33 -0
- package/src/data-display/keybind/keybind.css +76 -0
- package/src/data-display/keybind/keybind.tsx +30 -0
- package/src/data-display/line-comment/line-comment.css +258 -0
- package/src/data-display/line-comment/line-comment.tsx +308 -0
- package/src/data-display/project-avatar/project-avatar.css +132 -0
- package/src/data-display/project-avatar/project-avatar.tsx +66 -0
- package/src/feedback/loader/loader.css +32 -0
- package/src/feedback/loader/loader.tsx +31 -0
- package/src/feedback/progress-circle/progress-circle.css +28 -0
- package/src/feedback/progress-circle/progress-circle.tsx +64 -0
- package/src/feedback/toast/toast.css +225 -0
- package/src/feedback/toast/toast.tsx +283 -0
- package/src/forms/checkbox/checkbox.css +125 -0
- package/src/forms/checkbox/checkbox.tsx +43 -0
- package/src/forms/field/field.css +94 -0
- package/src/forms/field/field.tsx +263 -0
- package/src/forms/inline-input/inline-input.css +17 -0
- package/src/forms/inline-input/inline-input.tsx +22 -0
- package/src/forms/radio/radio.css +202 -0
- package/src/forms/radio/radio.tsx +82 -0
- package/src/forms/select/select.css +291 -0
- package/src/forms/select/select.tsx +219 -0
- package/src/forms/switch/switch.css +272 -0
- package/src/forms/switch/switch.tsx +34 -0
- package/src/forms/text-input/text-input.css +181 -0
- package/src/forms/text-input/text-input.tsx +99 -0
- package/src/forms/textarea/textarea.css +78 -0
- package/src/forms/textarea/textarea.tsx +31 -0
- package/src/hooks/create-auto-scroll.tsx +257 -0
- package/src/hooks/index.ts +2 -0
- package/src/hooks/use-filtered-list.tsx +134 -0
- package/src/i18n/am.ts +194 -0
- package/src/i18n/ar.ts +231 -0
- package/src/i18n/az.ts +195 -0
- package/src/i18n/bg.ts +195 -0
- package/src/i18n/bn.ts +197 -0
- package/src/i18n/br.ts +219 -0
- package/src/i18n/bs.ts +223 -0
- package/src/i18n/ca.ts +199 -0
- package/src/i18n/cs.ts +203 -0
- package/src/i18n/da.ts +214 -0
- package/src/i18n/de.ts +219 -0
- package/src/i18n/dv.ts +196 -0
- package/src/i18n/dz.ts +197 -0
- package/src/i18n/el.ts +195 -0
- package/src/i18n/en.ts +269 -0
- package/src/i18n/es.ts +219 -0
- package/src/i18n/et.ts +195 -0
- package/src/i18n/fa.ts +195 -0
- package/src/i18n/fi.ts +195 -0
- package/src/i18n/fo.ts +195 -0
- package/src/i18n/fr.ts +221 -0
- package/src/i18n/he.ts +199 -0
- package/src/i18n/hi.ts +197 -0
- package/src/i18n/hr.ts +200 -0
- package/src/i18n/hu.ts +197 -0
- package/src/i18n/hy.ts +195 -0
- package/src/i18n/id.ts +217 -0
- package/src/i18n/is.ts +195 -0
- package/src/i18n/it.ts +200 -0
- package/src/i18n/ja.ts +214 -0
- package/src/i18n/ka.ts +195 -0
- package/src/i18n/km.ts +196 -0
- package/src/i18n/ko.ts +216 -0
- package/src/i18n/lo.ts +195 -0
- package/src/i18n/lt.ts +203 -0
- package/src/i18n/lv.ts +199 -0
- package/src/i18n/mk.ts +195 -0
- package/src/i18n/mn.ts +195 -0
- package/src/i18n/ms.ts +195 -0
- package/src/i18n/my.ts +196 -0
- package/src/i18n/ne.ts +197 -0
- package/src/i18n/nl.ts +195 -0
- package/src/i18n/no.ts +219 -0
- package/src/i18n/pa.ts +196 -0
- package/src/i18n/pl.ts +223 -0
- package/src/i18n/ro.ts +199 -0
- package/src/i18n/ru.ts +222 -0
- package/src/i18n/si.ts +195 -0
- package/src/i18n/sk.ts +203 -0
- package/src/i18n/sl.ts +204 -0
- package/src/i18n/sq.ts +195 -0
- package/src/i18n/sr.ts +200 -0
- package/src/i18n/sv.ts +195 -0
- package/src/i18n/tg.ts +195 -0
- package/src/i18n/th.ts +215 -0
- package/src/i18n/tk.ts +195 -0
- package/src/i18n/tr.ts +221 -0
- package/src/i18n/uk.ts +226 -0
- package/src/i18n/ur.ts +196 -0
- package/src/i18n/uz.ts +198 -0
- package/src/i18n/vi.ts +195 -0
- package/src/i18n/zh.ts +217 -0
- package/src/i18n/zht.ts +217 -0
- package/src/icons/icon/additional-icons.ts +115 -0
- package/src/icons/icon/icon.css +3 -0
- package/src/icons/icon/icon.tsx +293 -0
- package/src/layout/divider/divider.css +11 -0
- package/src/layout/divider/divider.tsx +20 -0
- package/src/navigation/menu/menu.css +312 -0
- package/src/navigation/menu/menu.tsx +289 -0
- package/src/navigation/segmented-control/segmented-control.css +80 -0
- package/src/navigation/segmented-control/segmented-control.tsx +209 -0
- package/src/navigation/tab-state-indicator.tsx +37 -0
- package/src/navigation/tabs/tabs-current.css +239 -0
- package/src/navigation/tabs/tabs.css +710 -0
- package/src/navigation/tabs/tabs.tsx +194 -0
- package/src/overlays/dialog/dialog.css +180 -0
- package/src/overlays/dialog/dialog.tsx +115 -0
- package/src/overlays/tooltip/tooltip.css +102 -0
- package/src/overlays/tooltip/tooltip.tsx +154 -0
- package/src/storybook/fixtures.ts +51 -0
- package/src/storybook/scaffold.tsx +62 -0
- package/src/styles/animations.css +141 -0
- package/src/styles/base.css +409 -0
- package/src/styles/colors.css +772 -0
- package/src/styles/file-tree.css +202 -0
- package/src/styles/index.css +37 -0
- package/src/styles/tailwind/colors.css +288 -0
- package/src/styles/tailwind/index.css +95 -0
- package/src/styles/tailwind/utilities.css +131 -0
- package/src/styles/theme.css +631 -0
- package/src/styles/tokens/colors.css +172 -0
- package/src/styles/tokens/index.css +2 -0
- package/src/styles/tokens/theme.css +510 -0
- package/src/styles/utilities.css +118 -0
- package/src/theme/color.ts +299 -0
- package/src/theme/context.tsx +381 -0
- package/src/theme/default-themes.ts +116 -0
- package/src/theme/index.ts +78 -0
- package/src/theme/loader.ts +112 -0
- package/src/theme/resolve.ts +540 -0
- package/src/theme/themes/amoled.json +49 -0
- package/src/theme/themes/aura.json +51 -0
- package/src/theme/themes/ayu.json +51 -0
- package/src/theme/themes/carbonfox.json +53 -0
- package/src/theme/themes/catppuccin-frappe.json +85 -0
- package/src/theme/themes/catppuccin-macchiato.json +85 -0
- package/src/theme/themes/catppuccin.json +45 -0
- package/src/theme/themes/cobalt2.json +87 -0
- package/src/theme/themes/cursor.json +91 -0
- package/src/theme/themes/dracula.json +49 -0
- package/src/theme/themes/everforest.json +89 -0
- package/src/theme/themes/flexoki.json +86 -0
- package/src/theme/themes/github.json +85 -0
- package/src/theme/themes/gruvbox.json +45 -0
- package/src/theme/themes/kanagawa.json +89 -0
- package/src/theme/themes/lucent-orng.json +87 -0
- package/src/theme/themes/material.json +87 -0
- package/src/theme/themes/matrix.json +113 -0
- package/src/theme/themes/mercury.json +86 -0
- package/src/theme/themes/monokai.json +49 -0
- package/src/theme/themes/nightowl.json +46 -0
- package/src/theme/themes/nord.json +46 -0
- package/src/theme/themes/oc-2.json +507 -0
- package/src/theme/themes/one-dark.json +89 -0
- package/src/theme/themes/onedarkpro.json +45 -0
- package/src/theme/themes/opencode.json +89 -0
- package/src/theme/themes/orng.json +87 -0
- package/src/theme/themes/osaka-jade.json +88 -0
- package/src/theme/themes/palenight.json +85 -0
- package/src/theme/themes/rosepine.json +85 -0
- package/src/theme/themes/shadesofpurple.json +51 -0
- package/src/theme/themes/solarized.json +49 -0
- package/src/theme/themes/synthwave84.json +87 -0
- package/src/theme/themes/tokyonight.json +47 -0
- package/src/theme/themes/vercel.json +90 -0
- package/src/theme/themes/vesper.json +51 -0
- package/src/theme/themes/zenburn.json +87 -0
- package/src/theme/types.ts +75 -0
- package/src/theme/v2/avatar.ts +48 -0
- package/src/theme/v2/default-primitives.ts +114 -0
- package/src/theme/v2/foreground.ts +61 -0
- package/src/theme/v2/mapping.ts +176 -0
- package/src/theme/v2/resolve.ts +153 -0
- package/src/typography/text-shimmer/text-shimmer.css +120 -0
- package/src/typography/text-shimmer/text-shimmer.tsx +63 -0
- package/src/typography/wordmark/wordmark.tsx +39 -0
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { TextField as Kobalte } from "@kobalte/core/text-field"
|
|
2
|
+
import { createSignal, Show, splitProps } from "solid-js"
|
|
3
|
+
import type { ComponentProps } from "solid-js"
|
|
4
|
+
import { useI18n } from "../context/i18n"
|
|
5
|
+
import { IconButton } from "@opencode/ui/icon-button"
|
|
6
|
+
import { Icon } from "@opencode/ui/icon"
|
|
7
|
+
import { Tooltip } from "@opencode/ui/tooltip"
|
|
8
|
+
|
|
9
|
+
export interface TextFieldProps
|
|
10
|
+
extends ComponentProps<typeof Kobalte.Input>,
|
|
11
|
+
Partial<
|
|
12
|
+
Pick<
|
|
13
|
+
ComponentProps<typeof Kobalte>,
|
|
14
|
+
| "name"
|
|
15
|
+
| "defaultValue"
|
|
16
|
+
| "value"
|
|
17
|
+
| "onChange"
|
|
18
|
+
| "onKeyDown"
|
|
19
|
+
| "validationState"
|
|
20
|
+
| "required"
|
|
21
|
+
| "disabled"
|
|
22
|
+
| "readOnly"
|
|
23
|
+
>
|
|
24
|
+
> {
|
|
25
|
+
label?: string
|
|
26
|
+
hideLabel?: boolean
|
|
27
|
+
description?: string
|
|
28
|
+
error?: string
|
|
29
|
+
variant?: "normal" | "ghost"
|
|
30
|
+
copyable?: boolean
|
|
31
|
+
copyKind?: "clipboard" | "link"
|
|
32
|
+
multiline?: boolean
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export function TextField(props: TextFieldProps) {
|
|
36
|
+
const i18n = useI18n()
|
|
37
|
+
const [local, others] = splitProps(props, [
|
|
38
|
+
"name",
|
|
39
|
+
"defaultValue",
|
|
40
|
+
"value",
|
|
41
|
+
"onChange",
|
|
42
|
+
"onKeyDown",
|
|
43
|
+
"validationState",
|
|
44
|
+
"required",
|
|
45
|
+
"disabled",
|
|
46
|
+
"readOnly",
|
|
47
|
+
"class",
|
|
48
|
+
"label",
|
|
49
|
+
"hideLabel",
|
|
50
|
+
"description",
|
|
51
|
+
"error",
|
|
52
|
+
"variant",
|
|
53
|
+
"copyable",
|
|
54
|
+
"copyKind",
|
|
55
|
+
"multiline",
|
|
56
|
+
])
|
|
57
|
+
const [copied, setCopied] = createSignal(false)
|
|
58
|
+
|
|
59
|
+
const label = () => {
|
|
60
|
+
if (copied()) return i18n.t("ui.textField.copied")
|
|
61
|
+
if (local.copyKind === "link") return i18n.t("ui.textField.copyLink")
|
|
62
|
+
return i18n.t("ui.textField.copyToClipboard")
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const icon = () => {
|
|
66
|
+
if (copied()) return "check"
|
|
67
|
+
if (local.copyKind === "link") return "link"
|
|
68
|
+
return "copy"
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
async function handleCopy() {
|
|
72
|
+
const value = local.value ?? local.defaultValue ?? ""
|
|
73
|
+
await navigator.clipboard.writeText(value)
|
|
74
|
+
setCopied(true)
|
|
75
|
+
setTimeout(() => setCopied(false), 2000)
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function handleClick() {
|
|
79
|
+
if (local.copyable) void handleCopy()
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
return (
|
|
83
|
+
<Kobalte
|
|
84
|
+
data-component="input"
|
|
85
|
+
data-variant={local.variant || "normal"}
|
|
86
|
+
name={local.name}
|
|
87
|
+
defaultValue={local.defaultValue}
|
|
88
|
+
value={local.value}
|
|
89
|
+
onChange={local.onChange}
|
|
90
|
+
onKeyDown={local.onKeyDown}
|
|
91
|
+
onClick={handleClick}
|
|
92
|
+
required={local.required}
|
|
93
|
+
disabled={local.disabled}
|
|
94
|
+
readOnly={local.readOnly}
|
|
95
|
+
validationState={local.validationState}
|
|
96
|
+
>
|
|
97
|
+
<Show when={local.label}>
|
|
98
|
+
<Kobalte.Label data-slot="input-label" classList={{ "sr-only": local.hideLabel }}>
|
|
99
|
+
{local.label}
|
|
100
|
+
</Kobalte.Label>
|
|
101
|
+
</Show>
|
|
102
|
+
<div data-slot="input-wrapper">
|
|
103
|
+
<Show
|
|
104
|
+
when={local.multiline}
|
|
105
|
+
fallback={<Kobalte.Input {...others} data-slot="input-input" class={local.class} />}
|
|
106
|
+
>
|
|
107
|
+
<Kobalte.TextArea {...others} autoResize data-slot="input-input" class={local.class} />
|
|
108
|
+
</Show>
|
|
109
|
+
<Show when={local.copyable}>
|
|
110
|
+
<Tooltip
|
|
111
|
+
appearance="standard"
|
|
112
|
+
value={label()}
|
|
113
|
+
placement="top"
|
|
114
|
+
gutter={4}
|
|
115
|
+
forceOpen={copied() ? true : undefined}
|
|
116
|
+
skipDelayDuration={0}
|
|
117
|
+
>
|
|
118
|
+
<IconButton
|
|
119
|
+
type="button"
|
|
120
|
+
icon={<Icon name={icon()} />}
|
|
121
|
+
variant="ghost"
|
|
122
|
+
onClick={handleCopy}
|
|
123
|
+
tabIndex={-1}
|
|
124
|
+
data-slot="input-copy-button"
|
|
125
|
+
aria-label={label()}
|
|
126
|
+
/>
|
|
127
|
+
</Tooltip>
|
|
128
|
+
</Show>
|
|
129
|
+
</div>
|
|
130
|
+
<Show when={local.description}>
|
|
131
|
+
<Kobalte.Description data-slot="input-description">{local.description}</Kobalte.Description>
|
|
132
|
+
</Show>
|
|
133
|
+
<Kobalte.ErrorMessage data-slot="input-error">{local.error}</Kobalte.ErrorMessage>
|
|
134
|
+
</Kobalte>
|
|
135
|
+
)
|
|
136
|
+
}
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* TextReveal — mask-position wipe animation
|
|
3
|
+
*
|
|
4
|
+
* Instead of sliding text through a fixed mask (odometer style),
|
|
5
|
+
* the mask itself sweeps across each span to reveal/hide text.
|
|
6
|
+
*
|
|
7
|
+
* Direction: top-to-bottom. New text drops in from above, old text exits downward.
|
|
8
|
+
*
|
|
9
|
+
* Entering: gradient reveals top-to-bottom (top of text appears first).
|
|
10
|
+
* gradient(to bottom, white 33%, transparent 33%+edge)
|
|
11
|
+
* pos 0 100% = transparent covers element = hidden
|
|
12
|
+
* pos 0 0% = white covers element = visible
|
|
13
|
+
*
|
|
14
|
+
* Leaving: gradient hides top-to-bottom (top of text disappears first).
|
|
15
|
+
* gradient(to top, white 33%, transparent 33%+edge)
|
|
16
|
+
* pos 0 100% = white covers element = visible
|
|
17
|
+
* pos 0 0% = transparent covers element = hidden
|
|
18
|
+
*
|
|
19
|
+
* Both transition from 0 100% (swap) → 0 0% (settled).
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
[data-component="text-reveal"] {
|
|
23
|
+
--_edge: var(--text-reveal-edge, 17%);
|
|
24
|
+
--_dur: var(--text-reveal-duration, 450ms);
|
|
25
|
+
--_spring: var(--text-reveal-spring, cubic-bezier(0.34, 1.08, 0.64, 1));
|
|
26
|
+
--_spring-soft: var(--text-reveal-spring-soft, cubic-bezier(0.34, 1, 0.64, 1));
|
|
27
|
+
--_travel: var(--text-reveal-travel, 0px);
|
|
28
|
+
|
|
29
|
+
display: inline-flex;
|
|
30
|
+
align-items: center;
|
|
31
|
+
min-width: 0;
|
|
32
|
+
overflow: visible;
|
|
33
|
+
|
|
34
|
+
[data-slot="text-reveal-track"] {
|
|
35
|
+
display: grid;
|
|
36
|
+
min-height: 20px;
|
|
37
|
+
line-height: 20px;
|
|
38
|
+
justify-items: start;
|
|
39
|
+
align-items: center;
|
|
40
|
+
overflow: visible;
|
|
41
|
+
transition: width var(--_dur) var(--_spring-soft);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
[data-slot="text-reveal-entering"],
|
|
45
|
+
[data-slot="text-reveal-leaving"] {
|
|
46
|
+
grid-area: 1 / 1;
|
|
47
|
+
line-height: 20px;
|
|
48
|
+
white-space: nowrap;
|
|
49
|
+
justify-self: start;
|
|
50
|
+
text-align: start;
|
|
51
|
+
mask-size: 100% 300%;
|
|
52
|
+
-webkit-mask-size: 100% 300%;
|
|
53
|
+
mask-repeat: no-repeat;
|
|
54
|
+
-webkit-mask-repeat: no-repeat;
|
|
55
|
+
transition-duration: var(--_dur);
|
|
56
|
+
transition-timing-function: var(--_spring);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/* ── entering: reveal top-to-bottom ──
|
|
60
|
+
* Gradient(to top): white at bottom, transparent at top of mask.
|
|
61
|
+
* Settled pos 0 100% = white covers element = visible
|
|
62
|
+
* Swap pos 0 0% = transparent covers = hidden
|
|
63
|
+
* Slides from above: translateY(-travel) → translateY(0)
|
|
64
|
+
*/
|
|
65
|
+
[data-slot="text-reveal-entering"] {
|
|
66
|
+
mask-image: linear-gradient(to top, white 33%, transparent calc(33% + var(--_edge)));
|
|
67
|
+
-webkit-mask-image: linear-gradient(to top, white 33%, transparent calc(33% + var(--_edge)));
|
|
68
|
+
mask-position: 0 100%;
|
|
69
|
+
-webkit-mask-position: 0 100%;
|
|
70
|
+
transition-property:
|
|
71
|
+
mask-position,
|
|
72
|
+
-webkit-mask-position,
|
|
73
|
+
transform;
|
|
74
|
+
transform: translateY(0);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/* ── leaving: hide top-to-bottom + slide downward ──
|
|
78
|
+
* Gradient(to bottom): white at top, transparent at bottom of mask.
|
|
79
|
+
* Swap pos 0 0% = white covers element = visible
|
|
80
|
+
* Settled pos 0 100% = transparent covers = hidden
|
|
81
|
+
* Slides down: translateY(0) → translateY(travel)
|
|
82
|
+
*/
|
|
83
|
+
[data-slot="text-reveal-leaving"] {
|
|
84
|
+
mask-image: linear-gradient(to bottom, white 33%, transparent calc(33% + var(--_edge)));
|
|
85
|
+
-webkit-mask-image: linear-gradient(to bottom, white 33%, transparent calc(33% + var(--_edge)));
|
|
86
|
+
mask-position: 0 100%;
|
|
87
|
+
-webkit-mask-position: 0 100%;
|
|
88
|
+
transition-property:
|
|
89
|
+
mask-position,
|
|
90
|
+
-webkit-mask-position,
|
|
91
|
+
transform;
|
|
92
|
+
transform: translateY(var(--_travel));
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/* ── swapping: instant reset ──
|
|
96
|
+
* Snap entering to hidden (above), leaving to visible (center).
|
|
97
|
+
*/
|
|
98
|
+
&[data-swapping="true"] [data-slot="text-reveal-entering"] {
|
|
99
|
+
mask-position: 0 0%;
|
|
100
|
+
-webkit-mask-position: 0 0%;
|
|
101
|
+
transform: translateY(calc(var(--_travel) * -1));
|
|
102
|
+
transition-duration: 0ms !important;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
&[data-swapping="true"] [data-slot="text-reveal-leaving"] {
|
|
106
|
+
mask-position: 0 0%;
|
|
107
|
+
-webkit-mask-position: 0 0%;
|
|
108
|
+
transform: translateY(0);
|
|
109
|
+
transition-duration: 0ms !important;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/* ── not ready: kill all transitions ── */
|
|
113
|
+
&[data-ready="false"] [data-slot="text-reveal-track"] {
|
|
114
|
+
transition-duration: 0ms !important;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
&[data-ready="false"] [data-slot="text-reveal-entering"],
|
|
118
|
+
&[data-ready="false"] [data-slot="text-reveal-leaving"] {
|
|
119
|
+
transition-duration: 0ms !important;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
&[data-truncate="true"] {
|
|
123
|
+
width: 100%;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
&[data-truncate="true"] [data-slot="text-reveal-track"] {
|
|
127
|
+
width: 100%;
|
|
128
|
+
min-width: 0;
|
|
129
|
+
overflow: hidden;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
&[data-truncate="true"] [data-slot="text-reveal-entering"],
|
|
133
|
+
&[data-truncate="true"] [data-slot="text-reveal-leaving"] {
|
|
134
|
+
min-width: 0;
|
|
135
|
+
width: 100%;
|
|
136
|
+
overflow: hidden;
|
|
137
|
+
text-overflow: ellipsis;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
@media (prefers-reduced-motion: reduce) {
|
|
142
|
+
[data-component="text-reveal"] [data-slot="text-reveal-track"] {
|
|
143
|
+
transition-duration: 0ms !important;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
[data-component="text-reveal"] [data-slot="text-reveal-entering"],
|
|
147
|
+
[data-component="text-reveal"] [data-slot="text-reveal-leaving"] {
|
|
148
|
+
transition-duration: 0ms !important;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { createEffect, on, onCleanup, onMount } from "solid-js"
|
|
2
|
+
import { createStore } from "solid-js/store"
|
|
3
|
+
|
|
4
|
+
const px = (value: number | string | undefined, fallback: number) => {
|
|
5
|
+
if (typeof value === "number") return `${value}px`
|
|
6
|
+
if (typeof value === "string") return value
|
|
7
|
+
return `${fallback}px`
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const ms = (value: number | string | undefined, fallback: number) => {
|
|
11
|
+
if (typeof value === "number") return `${value}ms`
|
|
12
|
+
if (typeof value === "string") return value
|
|
13
|
+
return `${fallback}ms`
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const pct = (value: number | undefined, fallback: number) => {
|
|
17
|
+
const v = value ?? fallback
|
|
18
|
+
return `${v}%`
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export function TextReveal(props: {
|
|
22
|
+
text?: string
|
|
23
|
+
class?: string
|
|
24
|
+
duration?: number | string
|
|
25
|
+
/** Gradient edge softness as a percentage of the mask (0 = hard wipe, 17 = soft). */
|
|
26
|
+
edge?: number
|
|
27
|
+
/** Optional small vertical travel for entering text (px). Default 0. */
|
|
28
|
+
travel?: number | string
|
|
29
|
+
spring?: string
|
|
30
|
+
springSoft?: string
|
|
31
|
+
growOnly?: boolean
|
|
32
|
+
truncate?: boolean
|
|
33
|
+
}) {
|
|
34
|
+
const [state, setState] = createStore({
|
|
35
|
+
cur: props.text,
|
|
36
|
+
old: undefined as string | undefined,
|
|
37
|
+
width: "auto",
|
|
38
|
+
ready: false,
|
|
39
|
+
swapping: false,
|
|
40
|
+
})
|
|
41
|
+
const cur = () => state.cur
|
|
42
|
+
const old = () => state.old
|
|
43
|
+
const width = () => state.width
|
|
44
|
+
const ready = () => state.ready
|
|
45
|
+
const swapping = () => state.swapping
|
|
46
|
+
let inRef: HTMLSpanElement | undefined
|
|
47
|
+
let outRef: HTMLSpanElement | undefined
|
|
48
|
+
let rootRef: HTMLSpanElement | undefined
|
|
49
|
+
let frame: number | undefined
|
|
50
|
+
|
|
51
|
+
const win = () => inRef?.scrollWidth ?? 0
|
|
52
|
+
const wout = () => outRef?.scrollWidth ?? 0
|
|
53
|
+
|
|
54
|
+
const widen = (next: number) => {
|
|
55
|
+
if (next <= 0) return
|
|
56
|
+
if (props.growOnly ?? true) {
|
|
57
|
+
const prev = Number.parseFloat(width())
|
|
58
|
+
if (Number.isFinite(prev) && next <= prev) return
|
|
59
|
+
}
|
|
60
|
+
setState("width", `${next}px`)
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
createEffect(
|
|
64
|
+
on(
|
|
65
|
+
() => props.text,
|
|
66
|
+
(next, prev) => {
|
|
67
|
+
if (next === prev) return
|
|
68
|
+
if (typeof next === "string" && typeof prev === "string" && next.startsWith(prev)) {
|
|
69
|
+
setState("cur", next)
|
|
70
|
+
widen(win())
|
|
71
|
+
return
|
|
72
|
+
}
|
|
73
|
+
setState("swapping", true)
|
|
74
|
+
setState("old", prev)
|
|
75
|
+
setState("cur", next)
|
|
76
|
+
|
|
77
|
+
if (typeof requestAnimationFrame !== "function") {
|
|
78
|
+
widen(Math.max(win(), wout()))
|
|
79
|
+
rootRef?.offsetHeight
|
|
80
|
+
setState("swapping", false)
|
|
81
|
+
return
|
|
82
|
+
}
|
|
83
|
+
if (frame !== undefined && typeof cancelAnimationFrame === "function") cancelAnimationFrame(frame)
|
|
84
|
+
frame = requestAnimationFrame(() => {
|
|
85
|
+
widen(Math.max(win(), wout()))
|
|
86
|
+
rootRef?.offsetHeight
|
|
87
|
+
setState("swapping", false)
|
|
88
|
+
frame = undefined
|
|
89
|
+
})
|
|
90
|
+
},
|
|
91
|
+
),
|
|
92
|
+
)
|
|
93
|
+
|
|
94
|
+
onMount(() => {
|
|
95
|
+
widen(win())
|
|
96
|
+
const fonts = typeof document !== "undefined" ? document.fonts : undefined
|
|
97
|
+
if (typeof requestAnimationFrame !== "function") {
|
|
98
|
+
setState("ready", true)
|
|
99
|
+
return
|
|
100
|
+
}
|
|
101
|
+
if (!fonts) {
|
|
102
|
+
requestAnimationFrame(() => setState("ready", true))
|
|
103
|
+
return
|
|
104
|
+
}
|
|
105
|
+
void fonts.ready.finally(() => {
|
|
106
|
+
widen(win())
|
|
107
|
+
requestAnimationFrame(() => setState("ready", true))
|
|
108
|
+
})
|
|
109
|
+
})
|
|
110
|
+
|
|
111
|
+
onCleanup(() => {
|
|
112
|
+
if (frame === undefined || typeof cancelAnimationFrame !== "function") return
|
|
113
|
+
cancelAnimationFrame(frame)
|
|
114
|
+
})
|
|
115
|
+
|
|
116
|
+
return (
|
|
117
|
+
<span
|
|
118
|
+
ref={rootRef}
|
|
119
|
+
data-component="text-reveal"
|
|
120
|
+
data-ready={ready() ? "true" : "false"}
|
|
121
|
+
data-swapping={swapping() ? "true" : "false"}
|
|
122
|
+
data-truncate={props.truncate ? "true" : "false"}
|
|
123
|
+
class={props.class}
|
|
124
|
+
aria-label={props.text ?? ""}
|
|
125
|
+
style={{
|
|
126
|
+
"--text-reveal-duration": ms(props.duration, 450),
|
|
127
|
+
"--text-reveal-edge": pct(props.edge, 17),
|
|
128
|
+
"--text-reveal-travel": px(props.travel, 0),
|
|
129
|
+
"--text-reveal-spring": props.spring ?? "cubic-bezier(0.34, 1.08, 0.64, 1)",
|
|
130
|
+
"--text-reveal-spring-soft": props.springSoft ?? "cubic-bezier(0.34, 1, 0.64, 1)",
|
|
131
|
+
}}
|
|
132
|
+
>
|
|
133
|
+
<span data-slot="text-reveal-track" style={{ width: props.truncate ? "100%" : width() }}>
|
|
134
|
+
<span data-slot="text-reveal-entering" ref={inRef}>
|
|
135
|
+
{cur() ?? "\u00A0"}
|
|
136
|
+
</span>
|
|
137
|
+
<span data-slot="text-reveal-leaving" ref={outRef}>
|
|
138
|
+
{old() ?? "\u00A0"}
|
|
139
|
+
</span>
|
|
140
|
+
</span>
|
|
141
|
+
</span>
|
|
142
|
+
)
|
|
143
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* TextStrikethrough — spring-animated strikethrough line
|
|
3
|
+
*
|
|
4
|
+
* Draws a line-through from left to right using clip-path on a
|
|
5
|
+
* transparent-text overlay that carries the text-decoration.
|
|
6
|
+
* Grid stacking (grid-area: 1/1) layers the overlay on the base text.
|
|
7
|
+
*
|
|
8
|
+
* Key trick: -webkit-text-fill-color hides the glyph paint while
|
|
9
|
+
* keeping `color` (and therefore `currentColor` / text-decoration-color)
|
|
10
|
+
* set to the real inherited text color.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
[data-component="text-strikethrough"] {
|
|
14
|
+
display: grid;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
[data-slot="text-strikethrough-line"] {
|
|
18
|
+
-webkit-text-fill-color: transparent;
|
|
19
|
+
text-decoration-line: line-through;
|
|
20
|
+
pointer-events: none;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@media (prefers-reduced-motion: reduce) {
|
|
24
|
+
[data-slot="text-strikethrough-line"] {
|
|
25
|
+
clip-path: none !important;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import type { JSX } from "solid-js"
|
|
2
|
+
import { onMount } from "solid-js"
|
|
3
|
+
import { createResizeObserver } from "@solid-primitives/resize-observer"
|
|
4
|
+
import { createStore } from "solid-js/store"
|
|
5
|
+
import { useSpring } from "./motion-spring"
|
|
6
|
+
|
|
7
|
+
export function TextStrikethrough(props: {
|
|
8
|
+
/** Whether the strikethrough is active (line drawn across). */
|
|
9
|
+
active: boolean
|
|
10
|
+
/** The text to display. Rendered twice internally (base + decoration overlay). */
|
|
11
|
+
text: string
|
|
12
|
+
/** Spring visual duration in seconds. Default 0.35. */
|
|
13
|
+
visualDuration?: number
|
|
14
|
+
class?: string
|
|
15
|
+
style?: JSX.CSSProperties
|
|
16
|
+
}) {
|
|
17
|
+
const progress = useSpring(
|
|
18
|
+
() => (props.active ? 1 : 0),
|
|
19
|
+
() => ({ visualDuration: props.visualDuration ?? 0.35, bounce: 0 }),
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
let baseRef: HTMLSpanElement | undefined
|
|
23
|
+
let containerRef: HTMLSpanElement | undefined
|
|
24
|
+
const [state, setState] = createStore({
|
|
25
|
+
textWidth: 0,
|
|
26
|
+
containerWidth: 0,
|
|
27
|
+
})
|
|
28
|
+
const textWidth = () => state.textWidth
|
|
29
|
+
const containerWidth = () => state.containerWidth
|
|
30
|
+
|
|
31
|
+
const measure = () => {
|
|
32
|
+
if (baseRef) setState("textWidth", baseRef.scrollWidth)
|
|
33
|
+
if (containerRef) setState("containerWidth", containerRef.offsetWidth)
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
onMount(measure)
|
|
37
|
+
createResizeObserver(() => containerRef, measure)
|
|
38
|
+
|
|
39
|
+
// Revealed pixels from left = progress * textWidth
|
|
40
|
+
const revealedPx = () => {
|
|
41
|
+
const tw = textWidth()
|
|
42
|
+
return tw > 0 ? progress() * tw : 0
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// Overlay clip: hide everything to the right of revealed area
|
|
46
|
+
const overlayClip = () => {
|
|
47
|
+
const cw = containerWidth()
|
|
48
|
+
const tw = textWidth()
|
|
49
|
+
if (cw <= 0 || tw <= 0) return `inset(0 ${(1 - progress()) * 100}% 0 0)`
|
|
50
|
+
const remaining = Math.max(0, cw - revealedPx())
|
|
51
|
+
return `inset(0 ${remaining}px 0 0)`
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// Base clip: hide everything to the left of revealed area (complementary)
|
|
55
|
+
const baseClip = () => {
|
|
56
|
+
const px = revealedPx()
|
|
57
|
+
if (px <= 0.5) return "none"
|
|
58
|
+
return `inset(0 0 0 ${px}px)`
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
return (
|
|
62
|
+
<span
|
|
63
|
+
data-component="text-strikethrough"
|
|
64
|
+
class={props.class}
|
|
65
|
+
style={{ display: "grid", ...props.style }}
|
|
66
|
+
ref={containerRef}
|
|
67
|
+
>
|
|
68
|
+
<span ref={baseRef} style={{ "grid-area": "1 / 1", "clip-path": baseClip() }}>
|
|
69
|
+
{props.text}
|
|
70
|
+
</span>
|
|
71
|
+
<span
|
|
72
|
+
aria-hidden="true"
|
|
73
|
+
style={{
|
|
74
|
+
"grid-area": "1 / 1",
|
|
75
|
+
"text-decoration": "line-through",
|
|
76
|
+
"pointer-events": "none",
|
|
77
|
+
"clip-path": overlayClip(),
|
|
78
|
+
}}
|
|
79
|
+
>
|
|
80
|
+
{props.text}
|
|
81
|
+
</span>
|
|
82
|
+
</span>
|
|
83
|
+
)
|
|
84
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { createEffect, onCleanup, Show, type ValidComponent } from "solid-js"
|
|
2
|
+
import { createStore } from "solid-js/store"
|
|
3
|
+
import { Dynamic } from "solid-js/web"
|
|
4
|
+
|
|
5
|
+
export const Typewriter = <T extends ValidComponent = "p">(props: { text?: string; class?: string; as?: T }) => {
|
|
6
|
+
const [store, setStore] = createStore({
|
|
7
|
+
typing: false,
|
|
8
|
+
displayed: "",
|
|
9
|
+
cursor: true,
|
|
10
|
+
})
|
|
11
|
+
|
|
12
|
+
createEffect(() => {
|
|
13
|
+
const text = props.text
|
|
14
|
+
if (!text) return
|
|
15
|
+
|
|
16
|
+
let i = 0
|
|
17
|
+
const timeouts: ReturnType<typeof setTimeout>[] = []
|
|
18
|
+
setStore("typing", true)
|
|
19
|
+
setStore("displayed", "")
|
|
20
|
+
setStore("cursor", true)
|
|
21
|
+
|
|
22
|
+
const getTypingDelay = () => {
|
|
23
|
+
const random = Math.random()
|
|
24
|
+
if (random < 0.05) return 150 + Math.random() * 100
|
|
25
|
+
if (random < 0.15) return 80 + Math.random() * 60
|
|
26
|
+
return 30 + Math.random() * 50
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const type = () => {
|
|
30
|
+
if (i < text.length) {
|
|
31
|
+
setStore("displayed", text.slice(0, i + 1))
|
|
32
|
+
i++
|
|
33
|
+
timeouts.push(setTimeout(type, getTypingDelay()))
|
|
34
|
+
} else {
|
|
35
|
+
setStore("typing", false)
|
|
36
|
+
timeouts.push(setTimeout(() => setStore("cursor", false), 2000))
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
timeouts.push(setTimeout(type, 200))
|
|
41
|
+
|
|
42
|
+
onCleanup(() => {
|
|
43
|
+
for (const timeout of timeouts) clearTimeout(timeout)
|
|
44
|
+
})
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
return (
|
|
48
|
+
<Dynamic component={props.as || "p"} class={props.class}>
|
|
49
|
+
{store.displayed}
|
|
50
|
+
<Show when={store.cursor}>
|
|
51
|
+
<span classList={{ "blinking-cursor": !store.typing }}>│</span>
|
|
52
|
+
</Show>
|
|
53
|
+
</Dynamic>
|
|
54
|
+
)
|
|
55
|
+
}
|