@sophostechne/ui 0.18.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +268 -0
- package/README.md +112 -0
- package/dist/assets/filler-bg0.webp +0 -0
- package/dist/assets.d.ts +38 -0
- package/dist/fonts/Collapse-Bold.woff2 +0 -0
- package/dist/fonts/Collapse-BoldItalic.woff2 +0 -0
- package/dist/fonts/Collapse-Italic.woff2 +0 -0
- package/dist/fonts/Collapse-Light.woff2 +0 -0
- package/dist/fonts/Collapse-LightItalic.woff2 +0 -0
- package/dist/fonts/Collapse-Regular.woff2 +0 -0
- package/dist/fonts/Collapse-Thin.woff2 +0 -0
- package/dist/fonts/Collapse-ThinItalic.woff2 +0 -0
- package/dist/fonts/Mondwest-Regular.woff2 +0 -0
- package/dist/fonts/Neuebit-Bold.woff2 +0 -0
- package/dist/fonts/RulesCompressed-Medium.woff2 +0 -0
- package/dist/fonts/RulesCompressed-Regular.woff2 +0 -0
- package/dist/fonts/RulesExpanded-Bold.woff2 +0 -0
- package/dist/fonts/RulesExpanded-Regular.woff2 +0 -0
- package/dist/fonts.d.ts +6 -0
- package/dist/fonts.js +6 -0
- package/dist/hooks/use-below-breakpoint.d.ts +2 -0
- package/dist/hooks/use-below-breakpoint.js +17 -0
- package/dist/hooks/use-capped-frame.d.ts +2 -0
- package/dist/hooks/use-capped-frame.js +15 -0
- package/dist/hooks/use-confirm-delete.d.ts +10 -0
- package/dist/hooks/use-confirm-delete.js +35 -0
- package/dist/hooks/use-css-var-dims.d.ts +1 -0
- package/dist/hooks/use-css-var-dims.js +29 -0
- package/dist/hooks/use-gpu-tier.d.ts +34 -0
- package/dist/hooks/use-gpu-tier.js +111 -0
- package/dist/hooks/use-render-loop.d.ts +41 -0
- package/dist/hooks/use-render-loop.js +63 -0
- package/dist/hooks/use-smooth-controls.d.ts +16 -0
- package/dist/hooks/use-smooth-controls.js +217 -0
- package/dist/hooks/use-toast.d.ts +7 -0
- package/dist/hooks/use-toast.js +21 -0
- package/dist/index.d.ts +79 -0
- package/dist/index.js +107 -0
- package/dist/ui/basic-page.d.ts +7 -0
- package/dist/ui/basic-page.js +18 -0
- package/dist/ui/build.css +4 -0
- package/dist/ui/components/animated-count.d.ts +10 -0
- package/dist/ui/components/animated-count.js +113 -0
- package/dist/ui/components/ascii.d.ts +10 -0
- package/dist/ui/components/ascii.js +79 -0
- package/dist/ui/components/badge.d.ts +6 -0
- package/dist/ui/components/badge.js +40 -0
- package/dist/ui/components/badges/nous-girl.d.ts +2 -0
- package/dist/ui/components/badges/nous-girl.js +83 -0
- package/dist/ui/components/blend-mode.d.ts +28 -0
- package/dist/ui/components/blend-mode.js +69 -0
- package/dist/ui/components/blink.d.ts +6 -0
- package/dist/ui/components/blink.js +17 -0
- package/dist/ui/components/bottom-sheet.d.ts +15 -0
- package/dist/ui/components/bottom-sheet.js +192 -0
- package/dist/ui/components/button.d.ts +14 -0
- package/dist/ui/components/button.js +147 -0
- package/dist/ui/components/card.d.ts +5 -0
- package/dist/ui/components/card.js +74 -0
- package/dist/ui/components/checkbox.d.ts +2 -0
- package/dist/ui/components/checkbox.js +27 -0
- package/dist/ui/components/command-block.d.ts +24 -0
- package/dist/ui/components/command-block.js +56 -0
- package/dist/ui/components/confirm-dialog.d.ts +13 -0
- package/dist/ui/components/confirm-dialog.js +113 -0
- package/dist/ui/components/cursor.d.ts +3 -0
- package/dist/ui/components/cursor.js +97 -0
- package/dist/ui/components/dialog.d.ts +15 -0
- package/dist/ui/components/dialog.js +171 -0
- package/dist/ui/components/dropdown-menu.d.ts +12 -0
- package/dist/ui/components/dropdown-menu.js +102 -0
- package/dist/ui/components/fit-text/fit-text.css +42 -0
- package/dist/ui/components/fit-text/index.d.ts +9 -0
- package/dist/ui/components/fit-text/index.js +25 -0
- package/dist/ui/components/graphs/bar-chart.d.ts +12 -0
- package/dist/ui/components/graphs/bar-chart.js +129 -0
- package/dist/ui/components/graphs/index.d.ts +3 -0
- package/dist/ui/components/graphs/index.js +4 -0
- package/dist/ui/components/graphs/line-chart.d.ts +14 -0
- package/dist/ui/components/graphs/line-chart.js +175 -0
- package/dist/ui/components/graphs/utils.d.ts +52 -0
- package/dist/ui/components/graphs/utils.js +162 -0
- package/dist/ui/components/grid/grid.css +79 -0
- package/dist/ui/components/grid/index.d.ts +2 -0
- package/dist/ui/components/grid/index.js +17 -0
- package/dist/ui/components/hover-bg.d.ts +1 -0
- package/dist/ui/components/hover-bg.js +14 -0
- package/dist/ui/components/icons/arrow.d.ts +6 -0
- package/dist/ui/components/icons/arrow.js +44 -0
- package/dist/ui/components/icons/check.d.ts +2 -0
- package/dist/ui/components/icons/check.js +13 -0
- package/dist/ui/components/icons/chevron.d.ts +6 -0
- package/dist/ui/components/icons/chevron.js +51 -0
- package/dist/ui/components/icons/discord.d.ts +2 -0
- package/dist/ui/components/icons/discord.js +15 -0
- package/dist/ui/components/icons/eye.d.ts +2 -0
- package/dist/ui/components/icons/eye.js +8 -0
- package/dist/ui/components/icons/gear.d.ts +6 -0
- package/dist/ui/components/icons/gear.js +30 -0
- package/dist/ui/components/icons/github.d.ts +2 -0
- package/dist/ui/components/icons/github.js +15 -0
- package/dist/ui/components/icons/hamburger.d.ts +6 -0
- package/dist/ui/components/icons/hamburger.js +56 -0
- package/dist/ui/components/icons/heart.d.ts +2 -0
- package/dist/ui/components/icons/heart.js +11 -0
- package/dist/ui/components/icons/index.d.ts +12 -0
- package/dist/ui/components/icons/index.js +13 -0
- package/dist/ui/components/icons/link.d.ts +2 -0
- package/dist/ui/components/icons/link.js +13 -0
- package/dist/ui/components/icons/minus.d.ts +2 -0
- package/dist/ui/components/icons/minus.js +13 -0
- package/dist/ui/components/icons/search.d.ts +2 -0
- package/dist/ui/components/icons/search.js +33 -0
- package/dist/ui/components/image-distortion.d.ts +21 -0
- package/dist/ui/components/image-distortion.js +398 -0
- package/dist/ui/components/input.d.ts +1 -0
- package/dist/ui/components/input.js +21 -0
- package/dist/ui/components/label.d.ts +1 -0
- package/dist/ui/components/label.js +18 -0
- package/dist/ui/components/leva-client.d.ts +1 -0
- package/dist/ui/components/leva-client.js +12 -0
- package/dist/ui/components/list-item.d.ts +6 -0
- package/dist/ui/components/list-item.js +27 -0
- package/dist/ui/components/overlays/blend-modes.d.ts +1 -0
- package/dist/ui/components/overlays/blend-modes.js +14 -0
- package/dist/ui/components/overlays/glitch.d.ts +6 -0
- package/dist/ui/components/overlays/glitch.js +209 -0
- package/dist/ui/components/overlays/greys.d.ts +6 -0
- package/dist/ui/components/overlays/greys.js +339 -0
- package/dist/ui/components/overlays/index.d.ts +14 -0
- package/dist/ui/components/overlays/index.js +34 -0
- package/dist/ui/components/overlays/lens-layers.d.ts +14 -0
- package/dist/ui/components/overlays/lens-layers.js +95 -0
- package/dist/ui/components/overlays/lens.d.ts +44 -0
- package/dist/ui/components/overlays/lens.js +60 -0
- package/dist/ui/components/overlays/noise.d.ts +6 -0
- package/dist/ui/components/overlays/noise.js +136 -0
- package/dist/ui/components/overlays/vignette.d.ts +6 -0
- package/dist/ui/components/overlays/vignette.js +47 -0
- package/dist/ui/components/poster.d.ts +62 -0
- package/dist/ui/components/poster.js +256 -0
- package/dist/ui/components/progress.d.ts +9 -0
- package/dist/ui/components/progress.js +53 -0
- package/dist/ui/components/scene-canvas.d.ts +23 -0
- package/dist/ui/components/scene-canvas.js +179 -0
- package/dist/ui/components/scramble.d.ts +9 -0
- package/dist/ui/components/scramble.js +63 -0
- package/dist/ui/components/segmented.d.ts +20 -0
- package/dist/ui/components/segmented.js +51 -0
- package/dist/ui/components/select.d.ts +18 -0
- package/dist/ui/components/select.js +215 -0
- package/dist/ui/components/selection-switcher.d.ts +1 -0
- package/dist/ui/components/selection-switcher.js +34 -0
- package/dist/ui/components/separator.d.ts +5 -0
- package/dist/ui/components/separator.js +22 -0
- package/dist/ui/components/shader.d.ts +7 -0
- package/dist/ui/components/shader.js +60 -0
- package/dist/ui/components/socials.d.ts +20 -0
- package/dist/ui/components/socials.js +21 -0
- package/dist/ui/components/spinner.d.ts +20 -0
- package/dist/ui/components/spinner.js +38 -0
- package/dist/ui/components/stats.d.ts +16 -0
- package/dist/ui/components/stats.js +36 -0
- package/dist/ui/components/switch.d.ts +7 -0
- package/dist/ui/components/switch.js +37 -0
- package/dist/ui/components/tabs.d.ts +14 -0
- package/dist/ui/components/tabs.js +44 -0
- package/dist/ui/components/terminal-demo.d.ts +32 -0
- package/dist/ui/components/terminal-demo.js +125 -0
- package/dist/ui/components/theme-toggle.d.ts +6 -0
- package/dist/ui/components/theme-toggle.js +66 -0
- package/dist/ui/components/tier-card.d.ts +53 -0
- package/dist/ui/components/tier-card.js +146 -0
- package/dist/ui/components/toast.d.ts +8 -0
- package/dist/ui/components/toast.js +39 -0
- package/dist/ui/components/tv.d.ts +3 -0
- package/dist/ui/components/tv.js +239 -0
- package/dist/ui/components/typography/h1.d.ts +11 -0
- package/dist/ui/components/typography/h1.js +18 -0
- package/dist/ui/components/typography/h2.d.ts +11 -0
- package/dist/ui/components/typography/h2.js +18 -0
- package/dist/ui/components/typography/index.d.ts +15 -0
- package/dist/ui/components/typography/index.js +41 -0
- package/dist/ui/components/typography/legend.d.ts +6 -0
- package/dist/ui/components/typography/legend.js +20 -0
- package/dist/ui/components/typography/small.d.ts +2 -0
- package/dist/ui/components/typography/small.js +9 -0
- package/dist/ui/components/watchlist.d.ts +11 -0
- package/dist/ui/components/watchlist.js +80 -0
- package/dist/ui/fonts.css +63 -0
- package/dist/ui/footer.d.ts +20 -0
- package/dist/ui/footer.js +65 -0
- package/dist/ui/globals.css +395 -0
- package/dist/ui/header.d.ts +41 -0
- package/dist/ui/header.js +270 -0
- package/dist/ui/layout-wrapper.d.ts +1 -0
- package/dist/ui/layout-wrapper.js +7 -0
- package/dist/utils/color.d.ts +4 -0
- package/dist/utils/color.js +14 -0
- package/dist/utils/index.d.ts +15 -0
- package/dist/utils/index.js +48 -0
- package/dist/utils/poly.d.ts +8 -0
- package/dist/utils/poly.js +3 -0
- package/package.json +129 -0
- package/src/assets/filler-bg0.webp +0 -0
- package/src/assets.d.ts +38 -0
- package/src/fonts/Collapse-Bold.woff2 +0 -0
- package/src/fonts/Collapse-BoldItalic.woff2 +0 -0
- package/src/fonts/Collapse-Italic.woff2 +0 -0
- package/src/fonts/Collapse-Light.woff2 +0 -0
- package/src/fonts/Collapse-LightItalic.woff2 +0 -0
- package/src/fonts/Collapse-Regular.woff2 +0 -0
- package/src/fonts/Collapse-Thin.woff2 +0 -0
- package/src/fonts/Collapse-ThinItalic.woff2 +0 -0
- package/src/fonts/Mondwest-Regular.woff2 +0 -0
- package/src/fonts/Neuebit-Bold.woff2 +0 -0
- package/src/fonts/RulesCompressed-Medium.woff2 +0 -0
- package/src/fonts/RulesCompressed-Regular.woff2 +0 -0
- package/src/fonts/RulesExpanded-Bold.woff2 +0 -0
- package/src/fonts/RulesExpanded-Regular.woff2 +0 -0
- package/src/fonts.ts +6 -0
- package/src/hooks/use-below-breakpoint.ts +21 -0
- package/src/hooks/use-capped-frame.ts +18 -0
- package/src/hooks/use-confirm-delete.ts +43 -0
- package/src/hooks/use-css-var-dims.ts +39 -0
- package/src/hooks/use-gpu-tier.ts +190 -0
- package/src/hooks/use-render-loop.ts +121 -0
- package/src/hooks/use-smooth-controls.ts +318 -0
- package/src/hooks/use-toast.ts +29 -0
- package/src/index.ts +130 -0
- package/src/ui/basic-page.tsx +34 -0
- package/src/ui/build.css +4 -0
- package/src/ui/components/animated-count.stories.tsx +67 -0
- package/src/ui/components/animated-count.tsx +168 -0
- package/src/ui/components/ascii.stories.tsx +30 -0
- package/src/ui/components/ascii.tsx +110 -0
- package/src/ui/components/badge.stories.tsx +31 -0
- package/src/ui/components/badge.tsx +60 -0
- package/src/ui/components/badges/nous-girl.tsx +52 -0
- package/src/ui/components/blend-mode.stories.tsx +33 -0
- package/src/ui/components/blend-mode.tsx +129 -0
- package/src/ui/components/blink.stories.tsx +32 -0
- package/src/ui/components/blink.tsx +21 -0
- package/src/ui/components/bottom-sheet.stories.tsx +43 -0
- package/src/ui/components/bottom-sheet.tsx +227 -0
- package/src/ui/components/button.stories.tsx +68 -0
- package/src/ui/components/button.tsx +170 -0
- package/src/ui/components/card.stories.tsx +63 -0
- package/src/ui/components/card.tsx +85 -0
- package/src/ui/components/checkbox.stories.tsx +113 -0
- package/src/ui/components/checkbox.tsx +36 -0
- package/src/ui/components/command-block.stories.tsx +52 -0
- package/src/ui/components/command-block.tsx +86 -0
- package/src/ui/components/confirm-dialog.stories.tsx +91 -0
- package/src/ui/components/confirm-dialog.tsx +130 -0
- package/src/ui/components/cursor.tsx +115 -0
- package/src/ui/components/dialog.stories.tsx +169 -0
- package/src/ui/components/dialog.tsx +177 -0
- package/src/ui/components/dropdown-menu.stories.tsx +52 -0
- package/src/ui/components/dropdown-menu.tsx +117 -0
- package/src/ui/components/fit-text/fit-text.css +42 -0
- package/src/ui/components/fit-text/index.stories.tsx +33 -0
- package/src/ui/components/fit-text/index.tsx +45 -0
- package/src/ui/components/forms.stories.tsx +173 -0
- package/src/ui/components/graphs/bar-chart.tsx +153 -0
- package/src/ui/components/graphs/index.stories.tsx +64 -0
- package/src/ui/components/graphs/index.tsx +4 -0
- package/src/ui/components/graphs/line-chart.tsx +213 -0
- package/src/ui/components/graphs/utils.tsx +265 -0
- package/src/ui/components/grid/grid.css +79 -0
- package/src/ui/components/grid/index.tsx +19 -0
- package/src/ui/components/hover-bg.stories.tsx +29 -0
- package/src/ui/components/hover-bg.tsx +15 -0
- package/src/ui/components/icons/arrow.tsx +42 -0
- package/src/ui/components/icons/check.tsx +14 -0
- package/src/ui/components/icons/chevron.tsx +45 -0
- package/src/ui/components/icons/discord.tsx +16 -0
- package/src/ui/components/icons/eye.tsx +12 -0
- package/src/ui/components/icons/gear.tsx +51 -0
- package/src/ui/components/icons/github.tsx +16 -0
- package/src/ui/components/icons/hamburger.tsx +52 -0
- package/src/ui/components/icons/heart.tsx +12 -0
- package/src/ui/components/icons/index.ts +12 -0
- package/src/ui/components/icons/link.tsx +14 -0
- package/src/ui/components/icons/minus.tsx +14 -0
- package/src/ui/components/icons/search.tsx +28 -0
- package/src/ui/components/image-distortion.stories.tsx +120 -0
- package/src/ui/components/image-distortion.tsx +499 -0
- package/src/ui/components/input.stories.tsx +39 -0
- package/src/ui/components/input.tsx +20 -0
- package/src/ui/components/label.stories.tsx +26 -0
- package/src/ui/components/label.tsx +16 -0
- package/src/ui/components/leva-client.tsx +14 -0
- package/src/ui/components/list-item.stories.tsx +83 -0
- package/src/ui/components/list-item.tsx +37 -0
- package/src/ui/components/overlays/blend-modes.ts +13 -0
- package/src/ui/components/overlays/glitch.tsx +243 -0
- package/src/ui/components/overlays/greys.tsx +386 -0
- package/src/ui/components/overlays/index.tsx +47 -0
- package/src/ui/components/overlays/lens-layers.tsx +121 -0
- package/src/ui/components/overlays/lens.ts +91 -0
- package/src/ui/components/overlays/noise.tsx +174 -0
- package/src/ui/components/overlays/vignette.tsx +60 -0
- package/src/ui/components/poster.stories.tsx +513 -0
- package/src/ui/components/poster.tsx +411 -0
- package/src/ui/components/progress.stories.tsx +48 -0
- package/src/ui/components/progress.tsx +56 -0
- package/src/ui/components/scene-canvas.tsx +254 -0
- package/src/ui/components/scramble.stories.tsx +49 -0
- package/src/ui/components/scramble.tsx +95 -0
- package/src/ui/components/segmented.stories.tsx +101 -0
- package/src/ui/components/segmented.tsx +81 -0
- package/src/ui/components/select.stories.tsx +88 -0
- package/src/ui/components/select.tsx +267 -0
- package/src/ui/components/selection-switcher.tsx +44 -0
- package/src/ui/components/separator.stories.tsx +33 -0
- package/src/ui/components/separator.tsx +24 -0
- package/src/ui/components/shader.tsx +83 -0
- package/src/ui/components/socials.tsx +42 -0
- package/src/ui/components/spinner.stories.tsx +101 -0
- package/src/ui/components/spinner.tsx +60 -0
- package/src/ui/components/stats.stories.tsx +24 -0
- package/src/ui/components/stats.tsx +53 -0
- package/src/ui/components/switch.stories.tsx +77 -0
- package/src/ui/components/switch.tsx +48 -0
- package/src/ui/components/tabs.stories.tsx +101 -0
- package/src/ui/components/tabs.tsx +66 -0
- package/src/ui/components/terminal-demo.stories.tsx +67 -0
- package/src/ui/components/terminal-demo.tsx +189 -0
- package/src/ui/components/theme-toggle.stories.tsx +47 -0
- package/src/ui/components/theme-toggle.tsx +66 -0
- package/src/ui/components/tier-card.stories.tsx +217 -0
- package/src/ui/components/tier-card.tsx +190 -0
- package/src/ui/components/toast.stories.tsx +55 -0
- package/src/ui/components/toast.tsx +49 -0
- package/src/ui/components/tv.stories.tsx +37 -0
- package/src/ui/components/tv.tsx +257 -0
- package/src/ui/components/typography/h1.tsx +18 -0
- package/src/ui/components/typography/h2.tsx +18 -0
- package/src/ui/components/typography/index.tsx +54 -0
- package/src/ui/components/typography/legend.tsx +24 -0
- package/src/ui/components/typography/small.tsx +11 -0
- package/src/ui/components/watchlist.stories.tsx +33 -0
- package/src/ui/components/watchlist.tsx +105 -0
- package/src/ui/fonts.css +63 -0
- package/src/ui/footer.tsx +111 -0
- package/src/ui/globals.css +395 -0
- package/src/ui/header.tsx +398 -0
- package/src/ui/layout-wrapper.tsx +11 -0
- package/src/utils/color.ts +21 -0
- package/src/utils/index.ts +62 -0
- package/src/utils/poly.ts +26 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to `@sophostechne/ui` are documented here. Format based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
|
|
4
|
+
|
|
5
|
+
## 0.18.2
|
|
6
|
+
|
|
7
|
+
### Changed
|
|
8
|
+
|
|
9
|
+
- **`filler-bg0` asset replaced** — new HACK//IT themed artwork: a hooded operator at a CRT terminal, with code rain, circuit traces, and a perspective grid floor. Same duotone risograph treatment (cream paper, federal blue ink, ordered-dither stipple, misregistered second pass) and the same 1024×1024 WebP filename, so `Poster`, `ImageDistortion`, and the lens overlays pick it up with no code change.
|
|
10
|
+
|
|
11
|
+
## 0.17.0
|
|
12
|
+
|
|
13
|
+
Promotes reusable components and hooks from `hackit-agent/web` into the shared design system, and consolidates all dialog/modal implementations on Radix UI primitives.
|
|
14
|
+
|
|
15
|
+
### Added
|
|
16
|
+
|
|
17
|
+
- **`Dialog` compound component** — general-purpose modal built on Radix Dialog primitive. Compound API: `Dialog`, `DialogTrigger`, `DialogContent`, `DialogHeader`, `DialogFooter`, `DialogTitle`, `DialogDescription`, `DialogClose`. Dismissible via backdrop click or ESC.
|
|
18
|
+
- **`Input`** — styled text input with focus ring, disabled state, courier font.
|
|
19
|
+
- **`Label`** — form label with mondwest font, uppercase tracking, peer-disabled opacity.
|
|
20
|
+
- **`Separator`** — horizontal/vertical divider with `role="separator"`.
|
|
21
|
+
- **`Card`** compound component — `Card`, `CardHeader`, `CardTitle`, `CardDescription`, `CardContent` with themeable `--component-card-*` CSS custom properties.
|
|
22
|
+
- **`Toast`** — portal-based success/error notification with enter/exit animations.
|
|
23
|
+
- **`BottomSheet`** — mobile-first bottom sheet with drag-to-dismiss, backdrop, reduced-motion support.
|
|
24
|
+
- **`useToast`** — toast state management with auto-dismiss timer.
|
|
25
|
+
- **`useBelowBreakpoint`** — `matchMedia`-based responsive breakpoint query (SSR-safe).
|
|
26
|
+
- **`useConfirmDelete`** — generic confirm-delete flow state machine.
|
|
27
|
+
- **Forms overview story** — showcases all form controls in one view.
|
|
28
|
+
- Toast keyframes (`toast-in`, `toast-out`) in `globals.css`.
|
|
29
|
+
|
|
30
|
+
### Changed
|
|
31
|
+
|
|
32
|
+
- **`ConfirmDialog` rebuilt on Radix AlertDialog** — same external API (`open`, `onCancel`, `onConfirm`, `title`, `description`, `destructive`, `loading`), but ESC handling, focus trapping, scroll lock, and portal rendering are now handled by Radix. Backdrop click does not dismiss (correct for destructive confirms).
|
|
33
|
+
- **`Checkbox` migrated to unified `radix-ui` package** — import changed from `@radix-ui/react-checkbox` to `radix-ui`.
|
|
34
|
+
- **Dependency:** `@radix-ui/react-checkbox` replaced with unified `radix-ui` package.
|
|
35
|
+
- Storybook stories organized into categories (Forms, Feedback, Overlays, Data Display, Layout, Effects).
|
|
36
|
+
- Kitchen-sink demo updated to use new `Dialog`.
|
|
37
|
+
|
|
38
|
+
### Removed
|
|
39
|
+
|
|
40
|
+
- **`Modal` component** (`modal/index.tsx`, `modal.css`) — unused by any consumer app; replaced by `Dialog`.
|
|
41
|
+
- **`useModalBehavior` hook** — functionality now provided natively by Radix Dialog/AlertDialog primitives.
|
|
42
|
+
- Stale `modal.css` import from `globals.css`.
|
|
43
|
+
|
|
44
|
+
### Fixed
|
|
45
|
+
|
|
46
|
+
- Portal text color: dialogs now use `text-foreground-base` for correct rendering outside the blend-mode stack.
|
|
47
|
+
|
|
48
|
+
## 0.16.0
|
|
49
|
+
|
|
50
|
+
Reworks how the brand uppercase + Mondwest styling and color hierarchy are applied, addressing legibility, contrast, and themability complaints from consumers (notably the Hackit Dashboard).
|
|
51
|
+
|
|
52
|
+
### Added
|
|
53
|
+
|
|
54
|
+
- **`text-display` utility** — composable brand display style (`text-transform: uppercase` + `letter-spacing: 0.05em`). Purely typographic; pairs with any font utility.
|
|
55
|
+
- **Semantic text-color tokens** — `text-text-primary`, `text-text-secondary`, `text-text-tertiary`, `text-text-disabled`, `text-text-on-accent`, `text-text-display` with WCAG AA-targeted defaults in `globals.css`.
|
|
56
|
+
|
|
57
|
+
### Changed
|
|
58
|
+
|
|
59
|
+
- **Breaking:** `LayoutWrapper` and Storybook shell no longer apply global `uppercase` or `font-mondwest`. Apply `text-display` (and `font-mondwest` where desired) on brand chrome only.
|
|
60
|
+
- DS components (`Button`, `Badge`, `Tabs`, `Segmented`, `FilterGroup`, `CopyButton`, `Stats`, `TierCard`, `TerminalDemo`, `Watchlist`) use `text-display` instead of hard-coded `uppercase`.
|
|
61
|
+
- Component legibility: micro-type bumped to `text-xs`; inactive/disabled states use semantic tokens instead of stacked opacity.
|
|
62
|
+
|
|
63
|
+
### Tooling
|
|
64
|
+
|
|
65
|
+
- `src/` included in the published tarball.
|
|
66
|
+
- Inline source maps embedded in `dist/ui/*.js`.
|
|
67
|
+
- Storybook: **Display type** story and **Docs → Changelog** page.
|
|
68
|
+
|
|
69
|
+
## 0.15.0
|
|
70
|
+
|
|
71
|
+
### Added
|
|
72
|
+
|
|
73
|
+
- Storybook autodocs enabled for all components ([#21](https://github.com/SophosTechne/design-language/pull/21)).
|
|
74
|
+
|
|
75
|
+
## 0.14.2
|
|
76
|
+
|
|
77
|
+
### Added
|
|
78
|
+
|
|
79
|
+
- `Checkbox` component built on Radix primitive ([#20](https://github.com/SophosTechne/design-language/pull/20)).
|
|
80
|
+
|
|
81
|
+
### Fixed
|
|
82
|
+
|
|
83
|
+
- `defaultChecked` preserved on native input for form reset.
|
|
84
|
+
- Checkbox visuals in uncontrolled mode.
|
|
85
|
+
|
|
86
|
+
## 0.14.1
|
|
87
|
+
|
|
88
|
+
### Changed
|
|
89
|
+
|
|
90
|
+
- `@font-face` declarations moved out of `globals.css` into optional `fonts.css`.
|
|
91
|
+
- Documented optional font stylesheet setup in README.
|
|
92
|
+
|
|
93
|
+
### Fixed
|
|
94
|
+
|
|
95
|
+
- Font variable defaults remain in `globals.css`.
|
|
96
|
+
|
|
97
|
+
## 0.14.0
|
|
98
|
+
|
|
99
|
+
### Added
|
|
100
|
+
|
|
101
|
+
- `unbuild` / `mkdist` library build pipeline.
|
|
102
|
+
- `vite-plugin-static-copy` for asset handling in the build.
|
|
103
|
+
|
|
104
|
+
### Changed
|
|
105
|
+
|
|
106
|
+
- Bundle size reduced (~4.9 MB → ~1.9 MB).
|
|
107
|
+
- Storybook stories reorganized; stories excluded from Vite library entries.
|
|
108
|
+
|
|
109
|
+
## 0.13.2
|
|
110
|
+
|
|
111
|
+
### Added
|
|
112
|
+
|
|
113
|
+
- GitHub Actions workflow for trusted npm publishing on merge to `main`.
|
|
114
|
+
|
|
115
|
+
### Removed
|
|
116
|
+
|
|
117
|
+
- Manual release script and pnpm workspace file.
|
|
118
|
+
|
|
119
|
+
### Fixed
|
|
120
|
+
|
|
121
|
+
- Publish workflow condition syntax.
|
|
122
|
+
|
|
123
|
+
## 0.13.1
|
|
124
|
+
|
|
125
|
+
### Fixed
|
|
126
|
+
|
|
127
|
+
- Text readability improvements.
|
|
128
|
+
|
|
129
|
+
## 0.13.0
|
|
130
|
+
|
|
131
|
+
### Changed
|
|
132
|
+
|
|
133
|
+
- Overlay/canvas performance: pause render loops when hidden/offscreen; cap FPS and DPR.
|
|
134
|
+
|
|
135
|
+
## 0.12.0
|
|
136
|
+
|
|
137
|
+
### Fixed
|
|
138
|
+
|
|
139
|
+
- Eager GPU tier detection to avoid WebGL crash on first render.
|
|
140
|
+
|
|
141
|
+
## 0.11.0
|
|
142
|
+
|
|
143
|
+
### Added
|
|
144
|
+
|
|
145
|
+
- Expanded `Header` component.
|
|
146
|
+
- Icon exports.
|
|
147
|
+
|
|
148
|
+
### Changed
|
|
149
|
+
|
|
150
|
+
- Overlays decoupled from layout concerns.
|
|
151
|
+
- Introduction story updates.
|
|
152
|
+
|
|
153
|
+
## 0.10.0
|
|
154
|
+
|
|
155
|
+
### Added
|
|
156
|
+
|
|
157
|
+
- Unicode/braille spinners.
|
|
158
|
+
|
|
159
|
+
## 0.9.0
|
|
160
|
+
|
|
161
|
+
### Added
|
|
162
|
+
|
|
163
|
+
- `Switch`, `Tabs`, `Segmented`, and `ListItem` components.
|
|
164
|
+
|
|
165
|
+
## 0.8.0
|
|
166
|
+
|
|
167
|
+
### Added
|
|
168
|
+
|
|
169
|
+
- `Select` component.
|
|
170
|
+
|
|
171
|
+
## 0.7.0
|
|
172
|
+
|
|
173
|
+
### Changed
|
|
174
|
+
|
|
175
|
+
- Package renamed `nouse` → `sophos`.
|
|
176
|
+
- Badge support improvements.
|
|
177
|
+
|
|
178
|
+
### Fixed
|
|
179
|
+
|
|
180
|
+
- Button styling.
|
|
181
|
+
|
|
182
|
+
## 0.6.0
|
|
183
|
+
|
|
184
|
+
### Fixed
|
|
185
|
+
|
|
186
|
+
- Button component fixes.
|
|
187
|
+
|
|
188
|
+
## 0.5.0
|
|
189
|
+
|
|
190
|
+
### Added
|
|
191
|
+
|
|
192
|
+
- `Poster` and `TierCard` components.
|
|
193
|
+
|
|
194
|
+
### Fixed
|
|
195
|
+
|
|
196
|
+
- Poster and build fixes.
|
|
197
|
+
|
|
198
|
+
## 0.4.0
|
|
199
|
+
|
|
200
|
+
### Added
|
|
201
|
+
|
|
202
|
+
- Migrated components: image distortion, hamburger icon, terminal demo, theme toggle, click-to-copy command blocks.
|
|
203
|
+
|
|
204
|
+
## 0.3.0
|
|
205
|
+
|
|
206
|
+
### Added
|
|
207
|
+
|
|
208
|
+
- Storybook setup.
|
|
209
|
+
|
|
210
|
+
### Fixed
|
|
211
|
+
|
|
212
|
+
- Removed Next.js dependencies from the package.
|
|
213
|
+
|
|
214
|
+
## 0.2.7
|
|
215
|
+
|
|
216
|
+
### Fixed
|
|
217
|
+
|
|
218
|
+
- Stats flip animation.
|
|
219
|
+
|
|
220
|
+
## 0.2.6
|
|
221
|
+
|
|
222
|
+
### Added
|
|
223
|
+
|
|
224
|
+
- Flip animation on `Stats`.
|
|
225
|
+
|
|
226
|
+
## 0.2.5
|
|
227
|
+
|
|
228
|
+
### Changed
|
|
229
|
+
|
|
230
|
+
- Global font size adjustments.
|
|
231
|
+
|
|
232
|
+
## 0.2.4
|
|
233
|
+
|
|
234
|
+
### Changed
|
|
235
|
+
|
|
236
|
+
- Slightly increased global font size.
|
|
237
|
+
|
|
238
|
+
### Fixed
|
|
239
|
+
|
|
240
|
+
- Hover state for inverted/outlined buttons when foreground alpha is near zero.
|
|
241
|
+
|
|
242
|
+
## 0.2.3
|
|
243
|
+
|
|
244
|
+
### Fixed
|
|
245
|
+
|
|
246
|
+
- Hover state for inverted/outlined on low foreground alpha.
|
|
247
|
+
|
|
248
|
+
## 0.2.2
|
|
249
|
+
|
|
250
|
+
### Fixed
|
|
251
|
+
|
|
252
|
+
- Global CSS selector update.
|
|
253
|
+
|
|
254
|
+
## 0.2.1
|
|
255
|
+
|
|
256
|
+
### Changed
|
|
257
|
+
|
|
258
|
+
- Simplified style setup for consumers.
|
|
259
|
+
|
|
260
|
+
## 0.2.0
|
|
261
|
+
|
|
262
|
+
### Added
|
|
263
|
+
|
|
264
|
+
- Initial tagged release of the shared design system package.
|
|
265
|
+
|
|
266
|
+
## 0.1.x
|
|
267
|
+
|
|
268
|
+
Versions `0.1.0`–`0.1.3` were published to npm before git tags were added in this repository. See [npm version history](https://www.npmjs.com/package/@sophostechne/ui?activeTab=versions) for install pins.
|
package/README.md
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
# sophos ui
|
|
2
|
+
|
|
3
|
+
the shared design system for react ui @ sophos. components, hooks, utils, fonts, overlays, etc.
|
|
4
|
+
|
|
5
|
+
## setup
|
|
6
|
+
|
|
7
|
+
`npm i @sophostechne/ui` or `pnpm i @sophostechne/ui`
|
|
8
|
+
|
|
9
|
+
import the global styles in your app's root css file:
|
|
10
|
+
|
|
11
|
+
```css
|
|
12
|
+
@import 'tailwindcss';
|
|
13
|
+
@import '@sophostechne/ui/styles/globals.css';
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
`globals.css` includes the design-system tokens, utilities, component styles,
|
|
17
|
+
and default `--font-*` variable values, but does not register font files.
|
|
18
|
+
Import the optional font stylesheet first if your app wants CSS-managed
|
|
19
|
+
`@font-face` declarations:
|
|
20
|
+
|
|
21
|
+
```css
|
|
22
|
+
@import 'tailwindcss';
|
|
23
|
+
@import '@sophostechne/ui/styles/fonts.css';
|
|
24
|
+
@import '@sophostechne/ui/styles/globals.css';
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Next.js apps should prefer `next/font/local` with the exported
|
|
28
|
+
`@sophostechne/ui/fonts/*` files and map them to the same `--font-*`
|
|
29
|
+
variables. Apps can also provide their own `--font-*` variables while keeping
|
|
30
|
+
the design-system utilities from `globals.css`.
|
|
31
|
+
|
|
32
|
+
## usage
|
|
33
|
+
|
|
34
|
+
everything exports from the top level export:
|
|
35
|
+
|
|
36
|
+
```tsx
|
|
37
|
+
import {
|
|
38
|
+
Button,
|
|
39
|
+
Grid
|
|
40
|
+
// whatever else!
|
|
41
|
+
} from '@sophostechne/ui'
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## local development
|
|
45
|
+
|
|
46
|
+
two ways to preview components while editing:
|
|
47
|
+
|
|
48
|
+
### storybook (per-component, primary)
|
|
49
|
+
|
|
50
|
+
```
|
|
51
|
+
pnpm storybook # dev server on http://localhost:6006
|
|
52
|
+
pnpm build-storybook # static build → ./storybook-static
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
stories live in `stories/*.stories.tsx`. the **Overview** story re-renders
|
|
56
|
+
the entire `/ds` page, so you always have a kitchen-sink view alongside the
|
|
57
|
+
isolated component stories. the **Lens** toolbar above the preview cycles
|
|
58
|
+
between the lens presets (`0`, `1`, `2`, `3`, `4`, `5`, `5i`, `6`).
|
|
59
|
+
|
|
60
|
+
### next.js showcase (kitchen-sink, secondary)
|
|
61
|
+
|
|
62
|
+
```
|
|
63
|
+
pnpm dev # next dev on http://localhost:3000 → redirects to /ds
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
`app/ds/page.tsx` is the same content the Overview story renders.
|
|
67
|
+
|
|
68
|
+
## publishing
|
|
69
|
+
|
|
70
|
+
```
|
|
71
|
+
pnpm build # tsc → dist/ + copies css / fonts / assets
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
releases are published automatically when PRs merge to `main`. the github
|
|
75
|
+
workflow bumps the package version from the merged PR labels (`major`, `minor`,
|
|
76
|
+
or `patch`), pushes the tag, publishes to npm via trusted publishing, and
|
|
77
|
+
creates a [GitHub Release](https://github.com/SophosTechne/design-language/releases)
|
|
78
|
+
with notes from `CHANGELOG.md`.
|
|
79
|
+
|
|
80
|
+
before merging:
|
|
81
|
+
|
|
82
|
+
1. leave `package.json` at the **current published** version on `main` (CI bumps
|
|
83
|
+
it after merge).
|
|
84
|
+
2. label the PR so the bump matches your changelog section:
|
|
85
|
+
|
|
86
|
+
| PR label | bump from `0.15.0` | changelog heading |
|
|
87
|
+
| --- | --- | --- |
|
|
88
|
+
| `patch` (default) | `0.15.1` | `## 0.15.1` |
|
|
89
|
+
| `minor` | `0.16.0` | `## 0.16.0` |
|
|
90
|
+
| `major` | `1.0.0` | `## 1.0.0` |
|
|
91
|
+
|
|
92
|
+
3. add that `## X.Y.Z` section to [`CHANGELOG.md`](./CHANGELOG.md) — release
|
|
93
|
+
notes are pulled from it for npm and GitHub Releases.
|
|
94
|
+
|
|
95
|
+
the same file is rendered in Storybook under **Docs → Changelog** and shipped in
|
|
96
|
+
the npm tarball.
|
|
97
|
+
|
|
98
|
+
the published tarball ships `dist/`, `src/`, `README.md`, and `CHANGELOG.md`
|
|
99
|
+
(see `files` in `package.json`). inline source maps are embedded in `dist/` so
|
|
100
|
+
consumers can debug into the TypeScript source.
|
|
101
|
+
|
|
102
|
+
## deployment
|
|
103
|
+
|
|
104
|
+
`vercel.json` builds both and serves them on a single Next.js deployment:
|
|
105
|
+
|
|
106
|
+
- `/` and `/ds` — the Next.js showcase (same as `pnpm dev`)
|
|
107
|
+
- `/storybook` — the static Storybook build (copied to `public/storybook/`
|
|
108
|
+
before `next build` so Next serves it like any other static asset)
|
|
109
|
+
|
|
110
|
+
Want Storybook-only? replace `buildCommand` with `pnpm build-storybook` and
|
|
111
|
+
add `"outputDirectory": "storybook-static"`. `app/ds` can stay for local
|
|
112
|
+
`pnpm dev` either way — the Overview story renders the same content.
|
|
Binary file
|
package/dist/assets.d.ts
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
interface StaticImageData {
|
|
2
|
+
src: string
|
|
3
|
+
height: number
|
|
4
|
+
width: number
|
|
5
|
+
blurDataURL?: string
|
|
6
|
+
blurWidth?: number
|
|
7
|
+
blurHeight?: number
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
declare module '*.jpg' {
|
|
11
|
+
const content: StaticImageData
|
|
12
|
+
export default content
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
declare module '*.jpeg' {
|
|
16
|
+
const content: StaticImageData
|
|
17
|
+
export default content
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
declare module '*.png' {
|
|
21
|
+
const content: StaticImageData
|
|
22
|
+
export default content
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
declare module '*.svg' {
|
|
26
|
+
const content: StaticImageData
|
|
27
|
+
export default content
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
declare module '*.gif' {
|
|
31
|
+
const content: StaticImageData
|
|
32
|
+
export default content
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
declare module '*.webp' {
|
|
36
|
+
const content: StaticImageData
|
|
37
|
+
export default content
|
|
38
|
+
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/dist/fonts.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/** CSS variable names for the design language fonts. Set automatically by fonts.css. */
|
|
2
|
+
export declare const FONT_SANS = "--font-sans";
|
|
3
|
+
export declare const FONT_MONO = "--font-mono";
|
|
4
|
+
export declare const FONT_RULES_COMPRESSED = "--font-rules-compressed";
|
|
5
|
+
export declare const FONT_RULES_EXPANDED = "--font-rules-expanded";
|
|
6
|
+
export declare const FONT_MONDWEST = "--font-mondwest";
|
package/dist/fonts.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export const FONT_SANS = "--font-sans";
|
|
2
|
+
export const FONT_MONO = "--font-mono";
|
|
3
|
+
export const FONT_RULES_COMPRESSED = "--font-rules-compressed";
|
|
4
|
+
export const FONT_RULES_EXPANDED = "--font-rules-expanded";
|
|
5
|
+
export const FONT_MONDWEST = "--font-mondwest";
|
|
6
|
+
//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsiPHN0ZGluPiJdLAogICJzb3VyY2VzQ29udGVudCI6IFsiLyoqIENTUyB2YXJpYWJsZSBuYW1lcyBmb3IgdGhlIGRlc2lnbiBsYW5ndWFnZSBmb250cy4gU2V0IGF1dG9tYXRpY2FsbHkgYnkgZm9udHMuY3NzLiAqL1xuZXhwb3J0IGNvbnN0IEZPTlRfU0FOUyA9ICctLWZvbnQtc2FucydcbmV4cG9ydCBjb25zdCBGT05UX01PTk8gPSAnLS1mb250LW1vbm8nXG5leHBvcnQgY29uc3QgRk9OVF9SVUxFU19DT01QUkVTU0VEID0gJy0tZm9udC1ydWxlcy1jb21wcmVzc2VkJ1xuZXhwb3J0IGNvbnN0IEZPTlRfUlVMRVNfRVhQQU5ERUQgPSAnLS1mb250LXJ1bGVzLWV4cGFuZGVkJ1xuZXhwb3J0IGNvbnN0IEZPTlRfTU9ORFdFU1QgPSAnLS1mb250LW1vbmR3ZXN0J1xuIl0sCiAgIm1hcHBpbmdzIjogIkFBQ08sYUFBTSxZQUFZO0FBQ2xCLGFBQU0sWUFBWTtBQUNsQixhQUFNLHdCQUF3QjtBQUM5QixhQUFNLHNCQUFzQjtBQUM1QixhQUFNLGdCQUFnQjsiLAogICJuYW1lcyI6IFtdCn0K
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useEffect, useState } from "react";
|
|
3
|
+
export function useBelowBreakpoint(px) {
|
|
4
|
+
const query = `(max-width: ${px - 1}px)`;
|
|
5
|
+
const [matches, setMatches] = useState(
|
|
6
|
+
() => typeof window !== "undefined" ? window.matchMedia(query).matches : false
|
|
7
|
+
);
|
|
8
|
+
useEffect(() => {
|
|
9
|
+
const mql = window.matchMedia(query);
|
|
10
|
+
const sync = () => setMatches(mql.matches);
|
|
11
|
+
sync();
|
|
12
|
+
mql.addEventListener("change", sync);
|
|
13
|
+
return () => mql.removeEventListener("change", sync);
|
|
14
|
+
}, [query]);
|
|
15
|
+
return matches;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsiPHN0ZGluPiJdLAogICJzb3VyY2VzQ29udGVudCI6IFsiJ3VzZSBjbGllbnQnXG5cbmltcG9ydCB7IHVzZUVmZmVjdCwgdXNlU3RhdGUgfSBmcm9tICdyZWFjdCdcblxuLyoqIFRydWUgd2hlbiB2aWV3cG9ydCB3aWR0aCBpcyBzdHJpY3RseSBiZWxvdyBgcHhgLiAqL1xuZXhwb3J0IGZ1bmN0aW9uIHVzZUJlbG93QnJlYWtwb2ludChweDogbnVtYmVyKSB7XG4gIGNvbnN0IHF1ZXJ5ID0gYChtYXgtd2lkdGg6ICR7cHggLSAxfXB4KWBcbiAgY29uc3QgW21hdGNoZXMsIHNldE1hdGNoZXNdID0gdXNlU3RhdGUoKCkgPT5cbiAgICB0eXBlb2Ygd2luZG93ICE9PSAndW5kZWZpbmVkJyA/IHdpbmRvdy5tYXRjaE1lZGlhKHF1ZXJ5KS5tYXRjaGVzIDogZmFsc2VcbiAgKVxuXG4gIHVzZUVmZmVjdCgoKSA9PiB7XG4gICAgY29uc3QgbXFsID0gd2luZG93Lm1hdGNoTWVkaWEocXVlcnkpXG4gICAgY29uc3Qgc3luYyA9ICgpID0+IHNldE1hdGNoZXMobXFsLm1hdGNoZXMpXG4gICAgc3luYygpXG4gICAgbXFsLmFkZEV2ZW50TGlzdGVuZXIoJ2NoYW5nZScsIHN5bmMpXG4gICAgcmV0dXJuICgpID0+IG1xbC5yZW1vdmVFdmVudExpc3RlbmVyKCdjaGFuZ2UnLCBzeW5jKVxuICB9LCBbcXVlcnldKVxuXG4gIHJldHVybiBtYXRjaGVzXG59XG4iXSwKICAibWFwcGluZ3MiOiAiO0FBRUEsU0FBUyxXQUFXLGdCQUFnQjtBQUc3QixnQkFBUyxtQkFBbUIsSUFBWTtBQUM3QyxRQUFNLFFBQVEsZUFBZSxLQUFLLENBQUM7QUFDbkMsUUFBTSxDQUFDLFNBQVMsVUFBVSxJQUFJO0FBQUEsSUFBUyxNQUNyQyxPQUFPLFdBQVcsY0FBYyxPQUFPLFdBQVcsS0FBSyxFQUFFLFVBQVU7QUFBQSxFQUNyRTtBQUVBLFlBQVUsTUFBTTtBQUNkLFVBQU0sTUFBTSxPQUFPLFdBQVcsS0FBSztBQUNuQyxVQUFNLE9BQU8sTUFBTSxXQUFXLElBQUksT0FBTztBQUN6QyxTQUFLO0FBQ0wsUUFBSSxpQkFBaUIsVUFBVSxJQUFJO0FBQ25DLFdBQU8sTUFBTSxJQUFJLG9CQUFvQixVQUFVLElBQUk7QUFBQSxFQUNyRCxHQUFHLENBQUMsS0FBSyxDQUFDO0FBRVYsU0FBTztBQUNUOyIsCiAgIm5hbWVzIjogW10KfQo=
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useFrame, useThree } from "@react-three/fiber";
|
|
3
|
+
import { useRef } from "react";
|
|
4
|
+
export function useCappedFrame(cb, max) {
|
|
5
|
+
const last = useRef(performance.now());
|
|
6
|
+
const { size } = useThree();
|
|
7
|
+
const interval = 1e3 / (max ?? (size.width < 1024 ? 60 : 120));
|
|
8
|
+
useFrame((st, delta) => {
|
|
9
|
+
if (performance.now() - last.current > interval) {
|
|
10
|
+
last.current = performance.now();
|
|
11
|
+
cb(st, delta);
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsiPHN0ZGluPiJdLAogICJzb3VyY2VzQ29udGVudCI6IFsiJ3VzZSBjbGllbnQnXG5cbmltcG9ydCB7IHVzZUZyYW1lLCB1c2VUaHJlZSB9IGZyb20gJ0ByZWFjdC10aHJlZS9maWJlcidcbmltcG9ydCB0eXBlIHsgUmVuZGVyQ2FsbGJhY2sgfS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-0,0 +1,10 @@
|
|
|
1
|
+
export declare function useConfirmDelete<TId>({ onDelete }: {
|
|
2
|
+
onDelete: (id: TId) => Promise<void>;
|
|
3
|
+
}): {
|
|
4
|
+
readonly cancel: () => void;
|
|
5
|
+
readonly confirm: () => Promise<void>;
|
|
6
|
+
readonly isDeleting: boolean;
|
|
7
|
+
readonly isOpen: boolean;
|
|
8
|
+
readonly pendingId: TId | null;
|
|
9
|
+
readonly requestDelete: (id: TId) => void;
|
|
10
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useCallback, useState } from "react";
|
|
3
|
+
export function useConfirmDelete({
|
|
4
|
+
onDelete
|
|
5
|
+
}) {
|
|
6
|
+
const [pendingId, setPendingId] = useState(null);
|
|
7
|
+
const [isDeleting, setIsDeleting] = useState(false);
|
|
8
|
+
const requestDelete = useCallback((id) => {
|
|
9
|
+
setPendingId(id);
|
|
10
|
+
}, []);
|
|
11
|
+
const cancel = useCallback(() => {
|
|
12
|
+
if (!isDeleting) setPendingId(null);
|
|
13
|
+
}, [isDeleting]);
|
|
14
|
+
const confirm = useCallback(async () => {
|
|
15
|
+
if (pendingId === null) return;
|
|
16
|
+
const id = pendingId;
|
|
17
|
+
setIsDeleting(true);
|
|
18
|
+
try {
|
|
19
|
+
await onDelete(id);
|
|
20
|
+
setPendingId(null);
|
|
21
|
+
} catch {
|
|
22
|
+
} finally {
|
|
23
|
+
setIsDeleting(false);
|
|
24
|
+
}
|
|
25
|
+
}, [pendingId, onDelete]);
|
|
26
|
+
return {
|
|
27
|
+
cancel,
|
|
28
|
+
confirm,
|
|
29
|
+
isDeleting,
|
|
30
|
+
isOpen: pendingId !== null,
|
|
31
|
+
pendingId,
|
|
32
|
+
requestDelete
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsiPHN0ZGluPiJdLAogICJzb3VyY2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LElBQ3RCO0FBQUEsSUFDQTtBQUFBLEVBQ0Y7QUFDRjsiLAogICJuYW1lcyI6IFtdCn0K
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useCssVarDims(name: string, ref: React.RefObject<HTMLElement | null>): void;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useEffect } from "react";
|
|
3
|
+
export function useCssVarDims(name, ref) {
|
|
4
|
+
useEffect(() => {
|
|
5
|
+
if (!ref.current) {
|
|
6
|
+
return;
|
|
7
|
+
}
|
|
8
|
+
const update = (width2, height2) => {
|
|
9
|
+
document.documentElement.style.setProperty(
|
|
10
|
+
`--${name}-width`,
|
|
11
|
+
`${width2}px`
|
|
12
|
+
);
|
|
13
|
+
document.documentElement.style.setProperty(
|
|
14
|
+
`--${name}-height`,
|
|
15
|
+
`${height2}px`
|
|
16
|
+
);
|
|
17
|
+
};
|
|
18
|
+
const { height, width } = ref.current.getBoundingClientRect();
|
|
19
|
+
update(width, height);
|
|
20
|
+
const ro = new ResizeObserver((entries) => {
|
|
21
|
+
for (const entry of entries) {
|
|
22
|
+
update(entry.contentRect.width, entry.contentRect.height);
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
ro.observe(ref.current);
|
|
26
|
+
return () => ro.disconnect();
|
|
27
|
+
}, [name, ref]);
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsiPHN0ZGluPiJdLAogICJzb3VyY2VzQ29udGVudCI6IFsiJ3VzZSBjbGllbnQnXG5cbmltcG9ydCB7IHVzZUVmZmVjdCB9IGZyb20gJ3JlYWN0J1xuXG5leHBvcnQgZnVuY3Rpb24gdXNlQ3NzVmFyRGltcyhcbiAgbmFtZTogc3RyaW5nLFxuICByZWY6IFJlYWN0LlJlZk9iamVjdDxIVE1MRWxlbWVudCB8IG51bGw+XG4pIHtcbiAgdXNlRWZmZWN0KC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0FBRUEsVUFBTSxTQUFTLENBQUNBLFFBQWVDLFlBQW1CO0FBQ2hELGVBQVMsZ0JBQWdCLE1BQU07QUFBQSxRQUM3QixLQUFLLElBQUk7QUFBQSxRQUNULEdBQUdELE1BQUs7QUFBQSxNQUNWO0FBRUEsZUFBUyxnQkFBZ0IsTUFBTTtBQUFBLFFBQzdCLEtBQUssSUFBSTtBQUFBLFFBQ1QsR0FBR0MsT0FBTTtBQUFBLE1BQ1g7QUFBQSxJQUNGO0FBRUEsVUFBTSxFQUFFLFFBQVEsTUFBTSxJQUFJLElBQUksUUFBUSxzQkFBc0I7QUFDNUQsV0FBTyxPQUFPLE1BQU07QUFFcEIsVUFBTSxLQUFLLElBQUksZUFBZSxhQUFXO0FBQ3ZDLGlCQUFXLFNBQVMsU0FBUztBQUMzQixlQUFPLE1BQU0sWUFBWSxPQUFPLE1BQU0sWUFBWSxNQUFNO0FBQUEsTUFDMUQ7QUFBQSxJQUNGLENBQUM7QUFFRCxPQUFHLFFBQVEsSUFBSSxPQUFPO0FBRXRCLFdBQU8sTUFBTSxHQUFHLFdBQVc7QUFBQSxFQUM3QixHQUFHLENBQUMsTUFBTSxHQUFHLENBQUM7QUFDaEI7IiwKICAibmFtZXMiOiBbIndpZHRoIiwgImhlaWdodCJdCn0K
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tiers:
|
|
3
|
+
* 0 — no WebGL / software renderer / prefers-reduced-motion / WebGL ctx
|
|
4
|
+
* creation failed / detection not yet run
|
|
5
|
+
* 1 — low-end GPU (integrated, mobile, or failed perf benchmark)
|
|
6
|
+
* 2 — capable GPU (discrete / high-end integrated)
|
|
7
|
+
*
|
|
8
|
+
* The atom starts **pessimistic** (`0`) and the probe is scheduled to run
|
|
9
|
+
* *after the first paint* (see `scheduleDetection` below), never synchronously
|
|
10
|
+
* at module-evaluation time.
|
|
11
|
+
*
|
|
12
|
+
* Why pessimistic + deferred:
|
|
13
|
+
* - Every consumer gates its `<canvas>` / `THREE.WebGLRenderer` on `tier > 0`
|
|
14
|
+
* (or `=== 2`). Starting at `0` means a consumer reading `$gpuTier` during
|
|
15
|
+
* its first render never attempts to create a renderer before detection has
|
|
16
|
+
* run, so the `THREE.WebGLRenderer: Error creating WebGL context` crash on
|
|
17
|
+
* hardware where context creation fails cannot happen — the component
|
|
18
|
+
* renders its fallback and upgrades once detection resolves to a capable
|
|
19
|
+
* tier. (A previous version made the probe synchronous-at-module-load to
|
|
20
|
+
* dodge this crash; the pessimistic default removes the crash without that
|
|
21
|
+
* cost.)
|
|
22
|
+
* - Probing WebGL is *expensive* on software renderers: creating a context
|
|
23
|
+
* under SwiftShader / llvmpipe can block the main thread for hundreds of
|
|
24
|
+
* milliseconds. Running it synchronously at module load stalled first paint
|
|
25
|
+
* and produced a visible boot-time flash in apps that merely import this
|
|
26
|
+
* hook (e.g. the Hackit dashboard backdrop). Deferring past first paint
|
|
27
|
+
* keeps boot smooth; the tier just upgrades a frame or two later.
|
|
28
|
+
* - For SSR the server keeps the default `0` and the client's first render
|
|
29
|
+
* also reads `0`, so there is no hydration mismatch.
|
|
30
|
+
*/
|
|
31
|
+
export declare const $gpuTier: import("nanostores").PreinitializedWritableAtom<GpuTier> & object;
|
|
32
|
+
export declare function useGpuTier(): GpuTier;
|
|
33
|
+
type GpuTier = 0 | 1 | 2;
|
|
34
|
+
export {};
|