@zyncat/ui 0.13.1 → 0.17.0
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/README.md +46 -157
- package/dist/alert.css +27 -34
- package/dist/alert.js +26 -17
- package/dist/alert.js.map +1 -1
- package/dist/avatar-group.js +2 -2
- package/dist/avatar-group.js.map +1 -1
- package/dist/avatar.css +53 -51
- package/dist/avatar.js +29 -7
- package/dist/avatar.js.map +1 -1
- package/dist/badge.css +31 -37
- package/dist/badge.js +1 -1
- package/dist/bloom-HV23M4AW.js +81 -0
- package/dist/bloom-HV23M4AW.js.map +1 -0
- package/dist/button.css +99 -118
- package/dist/button.js +3 -1
- package/dist/checkbox.css +28 -33
- package/dist/checkbox.js +2 -2
- package/dist/chunk-2YGHPQ66.js +16 -0
- package/dist/chunk-2YGHPQ66.js.map +1 -0
- package/dist/chunk-3MLUH2QL.js +53 -0
- package/dist/chunk-3MLUH2QL.js.map +1 -0
- package/dist/{chunk-RJFGWJ4W.js → chunk-3XRVPCIM.js} +6 -6
- package/dist/chunk-3XRVPCIM.js.map +1 -0
- package/dist/{chunk-FONOS5RN.js → chunk-4PQDVK23.js} +11 -10
- package/dist/chunk-4PQDVK23.js.map +1 -0
- package/dist/{chunk-45R4Z5XN.js → chunk-5VC3TUZ2.js} +4 -4
- package/dist/{chunk-45R4Z5XN.js.map → chunk-5VC3TUZ2.js.map} +1 -1
- package/dist/{chunk-A5WTZACK.js → chunk-5W5TKANX.js} +3 -3
- package/dist/{chunk-A5WTZACK.js.map → chunk-5W5TKANX.js.map} +1 -1
- package/dist/{chunk-227ZW4V7.js → chunk-6IXLW7QA.js} +11 -11
- package/dist/chunk-6IXLW7QA.js.map +1 -0
- package/dist/chunk-7NHY2CRA.js +132 -0
- package/dist/chunk-7NHY2CRA.js.map +1 -0
- package/dist/{chunk-EF6RPXU7.js → chunk-7VTWJL72.js} +43 -35
- package/dist/chunk-7VTWJL72.js.map +1 -0
- package/dist/chunk-7ZSIUUC3.js +50 -0
- package/dist/chunk-7ZSIUUC3.js.map +1 -0
- package/dist/{chunk-TYHR4VNM.js → chunk-AREEMG47.js} +10 -8
- package/dist/chunk-AREEMG47.js.map +1 -0
- package/dist/{chunk-DDRSMHN4.js → chunk-DH7DT6EO.js} +3 -3
- package/dist/{chunk-DDRSMHN4.js.map → chunk-DH7DT6EO.js.map} +1 -1
- package/dist/chunk-EOWWVFBF.js +14 -0
- package/dist/chunk-EOWWVFBF.js.map +1 -0
- package/dist/{chunk-5PZ43DCG.js → chunk-FLDIRXFU.js} +12 -13
- package/dist/chunk-FLDIRXFU.js.map +1 -0
- package/dist/{chunk-I45AU6KH.js → chunk-GGDAMIBH.js} +13 -7
- package/dist/chunk-GGDAMIBH.js.map +1 -0
- package/dist/{chunk-M43IOM5C.js → chunk-GWCBTD63.js} +3 -3
- package/dist/{chunk-M43IOM5C.js.map → chunk-GWCBTD63.js.map} +1 -1
- package/dist/chunk-GZ6UMHCK.js +103 -0
- package/dist/chunk-GZ6UMHCK.js.map +1 -0
- package/dist/chunk-H3X2263Y.js +17 -0
- package/dist/chunk-H3X2263Y.js.map +1 -0
- package/dist/{chunk-IJS7TPGV.js → chunk-HWDIVGME.js} +14 -7
- package/dist/chunk-HWDIVGME.js.map +1 -0
- package/dist/chunk-KSAJ6DED.js +16 -0
- package/dist/chunk-KSAJ6DED.js.map +1 -0
- package/dist/chunk-LH2UIEKN.js +42 -0
- package/dist/chunk-LH2UIEKN.js.map +1 -0
- package/dist/{chunk-JY6A2ZJZ.js → chunk-LNAV5E7S.js} +2 -2
- package/dist/{chunk-JY6A2ZJZ.js.map → chunk-LNAV5E7S.js.map} +1 -1
- package/dist/{chunk-CF4QHO4N.js → chunk-M2A6PZ7J.js} +10 -10
- package/dist/{chunk-CF4QHO4N.js.map → chunk-M2A6PZ7J.js.map} +1 -1
- package/dist/chunk-NYQQH4R5.js +40 -0
- package/dist/chunk-NYQQH4R5.js.map +1 -0
- package/dist/{chunk-TVYH4AN7.js → chunk-ODRO3KS6.js} +13 -13
- package/dist/chunk-ODRO3KS6.js.map +1 -0
- package/dist/chunk-PU3QWBEL.js +39 -0
- package/dist/chunk-PU3QWBEL.js.map +1 -0
- package/dist/{chunk-4BSHB7R3.js → chunk-QDAN43B6.js} +9 -9
- package/dist/chunk-QDAN43B6.js.map +1 -0
- package/dist/{chunk-XNIYSAMJ.js → chunk-RW2A4M2Q.js} +14 -9
- package/dist/chunk-RW2A4M2Q.js.map +1 -0
- package/dist/{chunk-TUTXXC3W.js → chunk-RY35IU3G.js} +3 -3
- package/dist/{chunk-TUTXXC3W.js.map → chunk-RY35IU3G.js.map} +1 -1
- package/dist/{chunk-EAI4POPB.js → chunk-TBLPZQSI.js} +56 -50
- package/dist/chunk-TBLPZQSI.js.map +1 -0
- package/dist/{chunk-AADAJL7D.js → chunk-UKPX3RIP.js} +8 -9
- package/dist/chunk-UKPX3RIP.js.map +1 -0
- package/dist/chunk-VDOBLABP.js +38 -0
- package/dist/chunk-VDOBLABP.js.map +1 -0
- package/dist/chunk-VNVVG47J.js +12 -0
- package/dist/chunk-VNVVG47J.js.map +1 -0
- package/dist/{chunk-4C5RZXBT.js → chunk-VZXML7EH.js} +8 -8
- package/dist/chunk-VZXML7EH.js.map +1 -0
- package/dist/{chunk-43M6GQ4Q.js → chunk-WC45VSST.js} +51 -32
- package/dist/chunk-WC45VSST.js.map +1 -0
- package/dist/{chunk-3MPF7FZV.js → chunk-WCWV5IX6.js} +3 -3
- package/dist/{chunk-3MPF7FZV.js.map → chunk-WCWV5IX6.js.map} +1 -1
- package/dist/chunk-WQKWPI6V.js +196 -0
- package/dist/chunk-WQKWPI6V.js.map +1 -0
- package/dist/{chunk-VAXCXZ53.js → chunk-WZUTBJC4.js} +5 -4
- package/dist/chunk-WZUTBJC4.js.map +1 -0
- package/dist/chunk-ZHMOH62S.js +101 -0
- package/dist/chunk-ZHMOH62S.js.map +1 -0
- package/dist/cli.js +356 -28
- package/dist/collapse.css +21 -33
- package/dist/collapse.js +1 -1
- package/dist/confetti.css +20 -13
- package/dist/confetti.js +7 -6
- package/dist/confetti.js.map +1 -1
- package/dist/count-badge.js +2 -2
- package/dist/date-field.js +22 -19
- package/dist/date-field.js.map +1 -1
- package/dist/date-picker.css +287 -185
- package/dist/date-range-field.js +75 -59
- package/dist/date-range-field.js.map +1 -1
- package/dist/datetime-field.js +26 -23
- package/dist/datetime-field.js.map +1 -1
- package/dist/dialog.css +35 -44
- package/dist/dialog.js +23 -22
- package/dist/dialog.js.map +1 -1
- package/dist/digit-strip.css +17 -17
- package/dist/dropdown.css +37 -28
- package/dist/dropdown.js +77 -40
- package/dist/dropdown.js.map +1 -1
- package/dist/emoji-picker.js +44 -45
- package/dist/emoji-picker.js.map +1 -1
- package/dist/facebook-feed.css +146 -149
- package/dist/facebook-feed.js +106 -102
- package/dist/facebook-feed.js.map +1 -1
- package/dist/flow-field.css +9 -5
- package/dist/flow-field.js +8 -7
- package/dist/flow-field.js.map +1 -1
- package/dist/glide.js +4 -3
- package/dist/icon.css +8 -11
- package/dist/input.css +81 -86
- package/dist/instagram-feed.css +66 -67
- package/dist/instagram-feed.js +61 -44
- package/dist/instagram-feed.js.map +1 -1
- package/dist/lens.css +42 -39
- package/dist/lens.js +17 -16
- package/dist/lens.js.map +1 -1
- package/dist/mcp.js +4 -3
- package/dist/menu-surface.css +55 -35
- package/dist/modal.css +3 -5
- package/dist/modal.js +12 -11
- package/dist/modal.js.map +1 -1
- package/dist/morphing-text.css +27 -17
- package/dist/morphing-text.js +14 -13
- package/dist/morphing-text.js.map +1 -1
- package/dist/motion-devtools.css +118 -69
- package/dist/motion-devtools.js +230 -65
- package/dist/motion-devtools.js.map +1 -1
- package/dist/motion-tokens.js +1 -1
- package/dist/multi-select.js +21 -16
- package/dist/multi-select.js.map +1 -1
- package/dist/number-field.js +15 -15
- package/dist/number-field.js.map +1 -1
- package/dist/odometer.css +23 -17
- package/dist/odometer.js +12 -11
- package/dist/odometer.js.map +1 -1
- package/dist/otp-field.js +3 -3
- package/dist/otp-field.js.map +1 -1
- package/dist/overlay.css +5 -10
- package/dist/pagination.css +11 -16
- package/dist/pagination.js +13 -10
- package/dist/pagination.js.map +1 -1
- package/dist/paint-CJQCM6ZO.js +260 -0
- package/dist/paint-CJQCM6ZO.js.map +1 -0
- package/dist/popover.css +14 -16
- package/dist/popover.js +10 -9
- package/dist/radio-group.css +65 -76
- package/dist/radio-group.js +30 -29
- package/dist/radio-group.js.map +1 -1
- package/dist/select.css +67 -76
- package/dist/select.js +19 -14
- package/dist/select.js.map +1 -1
- package/dist/sheet.css +13 -15
- package/dist/sheet.js +11 -10
- package/dist/spinner.css +115 -0
- package/dist/spinner.js +4 -0
- package/dist/spinner.js.map +1 -0
- package/dist/status-badge.js +9 -9
- package/dist/status-badge.js.map +1 -1
- package/dist/styles.css +35 -35
- package/dist/support-rail.css +110 -256
- package/dist/support-rail.js +116 -123
- package/dist/support-rail.js.map +1 -1
- package/dist/table.css +77 -85
- package/dist/table.js +44 -41
- package/dist/table.js.map +1 -1
- package/dist/tabs.css +81 -93
- package/dist/tabs.js +23 -20
- package/dist/tabs.js.map +1 -1
- package/dist/tag.css +49 -54
- package/dist/tag.js +13 -12
- package/dist/tag.js.map +1 -1
- package/dist/text-field.js +5 -5
- package/dist/textarea.css +47 -50
- package/dist/textarea.js +16 -16
- package/dist/textarea.js.map +1 -1
- package/dist/theme-grid.js +11 -0
- package/dist/theme-grid.js.map +1 -0
- package/dist/theme-switcher.css +107 -0
- package/dist/theme-switcher.js +70 -0
- package/dist/theme-switcher.js.map +1 -0
- package/dist/theme-transition-LLC644ZR.js +346 -0
- package/dist/theme-transition-LLC644ZR.js.map +1 -0
- package/dist/theme-transition.css +48 -0
- package/dist/theme.js +74 -27
- package/dist/theme.js.map +1 -1
- package/dist/tide-DJZMDAFT.js +57 -0
- package/dist/tide-DJZMDAFT.js.map +1 -0
- package/dist/tiktok.css +114 -119
- package/dist/tiktok.js +53 -52
- package/dist/tiktok.js.map +1 -1
- package/dist/time-field.js +26 -20
- package/dist/time-field.js.map +1 -1
- package/dist/toast-store.js +2 -1
- package/dist/toast.css +51 -79
- package/dist/toast.js +34 -26
- package/dist/toast.js.map +1 -1
- package/dist/toggle-tag.js +23 -14
- package/dist/toggle-tag.js.map +1 -1
- package/dist/toggle.css +27 -32
- package/dist/toggle.js +7 -7
- package/dist/toggle.js.map +1 -1
- package/dist/tooltip.css +17 -24
- package/dist/tooltip.js +117 -95
- package/dist/tooltip.js.map +1 -1
- package/dist/trigger.css +4 -4
- package/dist/types/components/composites/alert/Alert.d.ts +1 -2
- package/dist/types/components/composites/date-picker/TimeField.d.ts +1 -2
- package/dist/types/components/composites/date-picker/field-shell.d.ts +1 -1
- package/dist/types/components/composites/date-picker/month-jump.d.ts +11 -0
- package/dist/types/components/composites/date-picker/time-core.d.ts +1 -2
- package/dist/types/components/composites/dropdown/Dropdown.d.ts +9 -1
- package/dist/types/components/composites/dropdown/types.d.ts +14 -0
- package/dist/types/components/composites/emoji-picker/EmojiPickerPanel.d.ts +1 -1
- package/dist/types/components/composites/emoji-picker/data.d.ts +2 -5
- package/dist/types/components/composites/emoji-picker/react/useEmojiPicker.d.ts +0 -11
- package/dist/types/components/composites/emoji-picker/types.d.ts +3 -8
- package/dist/types/components/composites/select/MultiSelect.d.ts +6 -1
- package/dist/types/components/composites/select/Select.d.ts +6 -1
- package/dist/types/components/composites/select/core/index.d.ts +1 -1
- package/dist/types/components/composites/select/core/menu.d.ts +3 -3
- package/dist/types/components/composites/select/core/panel.d.ts +3 -3
- package/dist/types/components/composites/tabs/Tabs.d.ts +7 -10
- package/dist/types/components/composites/theme-switcher/ThemeGrid.d.ts +20 -0
- package/dist/types/components/composites/theme-switcher/ThemeSwitcher.d.ts +24 -0
- package/dist/types/components/composites/toast/Toast.d.ts +1 -1
- package/dist/types/components/composites/tooltip/Tooltip.d.ts +9 -1
- package/dist/types/components/composites/tooltip/tooltip-store.d.ts +5 -6
- package/dist/types/components/compound/support-rail/SupportRail.d.ts +10 -8
- package/dist/types/components/dev/MotionDevtools.d.ts +12 -5
- package/dist/types/components/expressive/theme-transition/bloom.d.ts +2 -0
- package/dist/types/components/expressive/theme-transition/paint.d.ts +2 -0
- package/dist/types/components/expressive/theme-transition/scene.d.ts +24 -0
- package/dist/types/components/expressive/theme-transition/theme-transition.d.ts +19 -0
- package/dist/types/components/expressive/theme-transition/tide.d.ts +2 -0
- package/dist/types/components/internal/hooks/use-host-election.d.ts +8 -0
- package/dist/types/components/internal/icon/Icon.d.ts +2 -3
- package/dist/types/components/internal/menu/highlight.d.ts +7 -0
- package/dist/types/components/internal/utils/activation.d.ts +0 -4
- package/dist/types/components/primitives/avatar/Avatar.d.ts +1 -1
- package/dist/types/components/primitives/button/Button.d.ts +10 -13
- package/dist/types/components/primitives/button/button-style.d.ts +15 -0
- package/dist/types/components/primitives/input/TextField.d.ts +1 -2
- package/dist/types/components/primitives/spinner/Spinner.d.ts +27 -0
- package/dist/types/components/primitives/textarea/Textarea.d.ts +0 -1
- package/dist/types/engine/animate.d.ts +1 -0
- package/dist/types/shared-slot.d.ts +1 -0
- package/dist/types/tokens/component-styles.generated.d.ts +80 -155
- package/dist/types/tokens/motion-defaults.generated.d.ts +34 -0
- package/dist/types/tokens/motion-scale.d.ts +2 -2
- package/dist/types/tokens/motion-tokens.d.ts +7 -0
- package/dist/types/tokens/theme-store.d.ts +47 -0
- package/dist/types/tokens/theme-sync.d.ts +9 -0
- package/dist/types/tokens/theme-tokens.generated.d.ts +693 -1117
- package/dist/types/tokens/theme.d.ts +28 -5
- package/dist/typing-lines.css +18 -11
- package/dist/typing-lines.js +9 -8
- package/dist/typing-lines.js.map +1 -1
- package/dist/weight-field.css +32 -18
- package/dist/weight-field.js +4 -4
- package/dist/weight-field.js.map +1 -1
- package/dist/youtube.css +91 -97
- package/dist/youtube.js +87 -86
- package/dist/youtube.js.map +1 -1
- package/package.json +27 -31
- package/skills/zyncat-ui/SKILL.md +5 -3
- package/skills/zyncat-ui/references/components.md +7 -4
- package/skills/zyncat-ui/references/theming.md +105 -34
- package/src/components/composites/alert/Alert.tsx +15 -12
- package/src/components/composites/alert/alert.css +27 -34
- package/src/components/composites/date-picker/DateField.tsx +1 -1
- package/src/components/composites/date-picker/DateRangeField.tsx +1 -1
- package/src/components/composites/date-picker/DateTimeField.tsx +4 -4
- package/src/components/composites/date-picker/TimeField.tsx +8 -5
- package/src/components/composites/date-picker/calendar-panel.tsx +33 -22
- package/src/components/composites/date-picker/date-picker.css +287 -185
- package/src/components/composites/date-picker/field-shell.tsx +7 -7
- package/src/components/composites/date-picker/month-jump.tsx +192 -0
- package/src/components/composites/date-picker/range-panel.tsx +51 -36
- package/src/components/composites/date-picker/time-core.tsx +4 -6
- package/src/components/composites/date-picker/use-day-focus.ts +1 -1
- package/src/components/composites/dialog/Dialog.tsx +11 -11
- package/src/components/composites/dialog/dialog.css +35 -44
- package/src/components/composites/dropdown/Dropdown.tsx +15 -2
- package/src/components/composites/dropdown/Dropdown.usage.md +7 -4
- package/src/components/composites/dropdown/dropdown.css +37 -28
- package/src/components/composites/dropdown/menu-panel.tsx +56 -27
- package/src/components/composites/dropdown/types.ts +28 -6
- package/src/components/composites/emoji-picker/EmojiPickerPanel.tsx +5 -4
- package/src/components/composites/emoji-picker/EmojiPickerPanel.usage.md +4 -4
- package/src/components/composites/emoji-picker/data.ts +2 -5
- package/src/components/composites/emoji-picker/dom.ts +6 -6
- package/src/components/composites/emoji-picker/react/category-bar.tsx +6 -6
- package/src/components/composites/emoji-picker/react/useEmojiPicker.ts +0 -11
- package/src/components/composites/emoji-picker/scaffold.ts +7 -7
- package/src/components/composites/emoji-picker/search.ts +0 -7
- package/src/components/composites/emoji-picker/styles.css +35 -35
- package/src/components/composites/emoji-picker/types.ts +3 -8
- package/src/components/composites/modal/Modal.tsx +2 -2
- package/src/components/composites/modal/modal.css +3 -5
- package/src/components/composites/pagination/Pagination.tsx +7 -7
- package/src/components/composites/pagination/pagination.css +11 -16
- package/src/components/composites/popover/Popover.tsx +2 -2
- package/src/components/composites/popover/popover.css +14 -16
- package/src/components/composites/select/MultiSelect.tsx +11 -2
- package/src/components/composites/select/MultiSelect.usage.md +2 -1
- package/src/components/composites/select/Select.tsx +10 -1
- package/src/components/composites/select/Select.usage.md +2 -1
- package/src/components/composites/select/core/index.ts +1 -1
- package/src/components/composites/select/core/menu.tsx +19 -4
- package/src/components/composites/select/core/panel.tsx +19 -15
- package/src/components/composites/select/core/trigger.tsx +5 -5
- package/src/components/composites/select/select.css +67 -76
- package/src/components/composites/sheet/Sheet.tsx +2 -2
- package/src/components/composites/sheet/sheet.css +13 -15
- package/src/components/composites/sheet/use-sheet-drag.ts +1 -1
- package/src/components/composites/table/Table.tsx +35 -35
- package/src/components/composites/table/table.css +77 -85
- package/src/components/composites/tabs/Tabs.tsx +20 -21
- package/src/components/composites/tabs/Tabs.usage.md +3 -2
- package/src/components/composites/tabs/tabs.css +81 -93
- package/src/components/composites/theme-switcher/ThemeGrid.tsx +133 -0
- package/src/components/composites/theme-switcher/ThemeGrid.usage.md +20 -0
- package/src/components/composites/theme-switcher/ThemeSwitcher.tsx +75 -0
- package/src/components/composites/theme-switcher/ThemeSwitcher.usage.md +21 -0
- package/src/components/composites/theme-switcher/theme-switcher.css +107 -0
- package/src/components/composites/toast/Toast.tsx +24 -18
- package/src/components/composites/toast/toast-store.ts +8 -6
- package/src/components/composites/toast/toast.css +51 -79
- package/src/components/composites/tooltip/Tooltip.tsx +40 -19
- package/src/components/composites/tooltip/Tooltip.usage.md +9 -1
- package/src/components/composites/tooltip/tooltip-host.tsx +55 -23
- package/src/components/composites/tooltip/tooltip-store.ts +36 -53
- package/src/components/composites/tooltip/tooltip.css +17 -24
- package/src/components/compound/support-rail/SupportRail.tsx +132 -144
- package/src/components/compound/support-rail/SupportRail.usage.md +7 -6
- package/src/components/compound/support-rail/support-rail.css +110 -256
- package/src/components/dev/MotionDevtools.tsx +272 -51
- package/src/components/dev/MotionDevtools.usage.md +12 -4
- package/src/components/dev/motion-devtools.css +118 -69
- package/src/components/dev/slowmo-engine.ts +16 -15
- package/src/components/expressive/confetti/Confetti.tsx +4 -4
- package/src/components/expressive/confetti/confetti.css +20 -13
- package/src/components/expressive/facebook-feed/chrome.tsx +2 -2
- package/src/components/expressive/facebook-feed/facebook-feed.css +146 -149
- package/src/components/expressive/facebook-feed/post.tsx +39 -39
- package/src/components/expressive/facebook-feed/reel.tsx +41 -37
- package/src/components/expressive/facebook-feed/story.tsx +27 -27
- package/src/components/expressive/flow-field/FlowField.tsx +5 -5
- package/src/components/expressive/flow-field/flow-field.css +9 -5
- package/src/components/expressive/instagram-feed/InstagramFeed.tsx +52 -44
- package/src/components/expressive/instagram-feed/instagram-feed.css +66 -67
- package/src/components/expressive/lens/Lens.tsx +14 -14
- package/src/components/expressive/lens/lens.css +42 -39
- package/src/components/expressive/morphing-text/MorphingText.tsx +12 -13
- package/src/components/expressive/morphing-text/morphing-text.css +27 -17
- package/src/components/expressive/odometer/Odometer.tsx +9 -9
- package/src/components/expressive/odometer/odometer.css +23 -17
- package/src/components/expressive/theme-transition/bloom.ts +88 -0
- package/src/components/expressive/theme-transition/paint.ts +296 -0
- package/src/components/expressive/theme-transition/scene.ts +38 -0
- package/src/components/expressive/theme-transition/theme-transition.css +48 -0
- package/src/components/expressive/theme-transition/theme-transition.ts +423 -0
- package/src/components/expressive/theme-transition/tide.ts +65 -0
- package/src/components/expressive/tiktok/TikTok.tsx +54 -54
- package/src/components/expressive/tiktok/tiktok.css +114 -119
- package/src/components/expressive/typing-lines/TypingLines.tsx +0 -0
- package/src/components/expressive/typing-lines/typing-lines.css +18 -11
- package/src/components/expressive/weight-field/WeightField.tsx +4 -4
- package/src/components/expressive/weight-field/weight-field.css +32 -18
- package/src/components/expressive/youtube/YouTube.tsx +4 -4
- package/src/components/expressive/youtube/glyphs.tsx +16 -16
- package/src/components/expressive/youtube/media.tsx +3 -3
- package/src/components/expressive/youtube/post.tsx +28 -28
- package/src/components/expressive/youtube/short.tsx +25 -25
- package/src/components/expressive/youtube/video.tsx +13 -13
- package/src/components/expressive/youtube/youtube.css +91 -97
- package/src/components/internal/glass/glass.css +20 -23
- package/src/components/internal/glass/glint.ts +3 -3
- package/src/components/internal/hooks/use-host-election.ts +46 -0
- package/src/components/internal/icon/Icon.tsx +3 -5
- package/src/components/internal/icon/IconSlot.tsx +1 -1
- package/src/components/internal/icon/icon.css +8 -11
- package/src/components/internal/menu/highlight.ts +12 -0
- package/src/components/internal/menu/menu-row.tsx +5 -5
- package/src/components/internal/menu/menu-surface.css +55 -35
- package/src/components/internal/overlay/layer.tsx +2 -1
- package/src/components/internal/overlay/modal.tsx +5 -4
- package/src/components/internal/overlay/overlay.css +5 -10
- package/src/components/internal/overlay/trigger.css +4 -4
- package/src/components/internal/utils/activation.ts +0 -4
- package/src/components/primitives/avatar/Avatar.tsx +24 -8
- package/src/components/primitives/avatar/AvatarGroup.tsx +4 -4
- package/src/components/primitives/avatar/avatar.css +53 -51
- package/src/components/primitives/badge/Badge.tsx +9 -9
- package/src/components/primitives/badge/StatusBadge.tsx +7 -7
- package/src/components/primitives/badge/badge.css +31 -37
- package/src/components/primitives/badge/digit-strip.css +17 -17
- package/src/components/primitives/badge/digit-strip.tsx +4 -4
- package/src/components/primitives/button/Button.tsx +14 -28
- package/src/components/primitives/button/button-style.ts +28 -0
- package/src/components/primitives/button/button.css +99 -118
- package/src/components/primitives/checkbox/Checkbox.tsx +10 -4
- package/src/components/primitives/checkbox/check-glyph.tsx +5 -5
- package/src/components/primitives/checkbox/checkbox.css +28 -33
- package/src/components/primitives/collapse/Collapse.tsx +2 -2
- package/src/components/primitives/collapse/collapse.css +21 -33
- package/src/components/primitives/collapse/collapse.typecheck.tsx +1 -1
- package/src/components/primitives/input/NumberField.tsx +11 -11
- package/src/components/primitives/input/OtpField.tsx +3 -3
- package/src/components/primitives/input/TextField.tsx +9 -10
- package/src/components/primitives/input/field-chrome.tsx +6 -6
- package/src/components/primitives/input/input.css +81 -86
- package/src/components/primitives/radio-group/RadioGroup.tsx +23 -23
- package/src/components/primitives/radio-group/radio-group.css +65 -76
- package/src/components/primitives/spinner/Spinner.tsx +70 -0
- package/src/components/primitives/spinner/Spinner.usage.md +19 -0
- package/src/components/primitives/spinner/spinner.css +115 -0
- package/src/components/primitives/tag/Tag.tsx +5 -5
- package/src/components/primitives/tag/ToggleTag.tsx +11 -6
- package/src/components/primitives/tag/tag.css +49 -54
- package/src/components/primitives/textarea/Textarea.tsx +13 -14
- package/src/components/primitives/textarea/textarea.css +47 -50
- package/src/components/primitives/toggle/Toggle.tsx +7 -7
- package/src/components/primitives/toggle/toggle.css +27 -32
- package/src/engine/animate.ts +12 -3
- package/src/engine/flip.ts +2 -1
- package/src/mcp/server.ts +5 -2
- package/src/motion/flip.ts +7 -8
- package/src/motion/glide.tsx +41 -26
- package/src/shared-slot.ts +10 -0
- package/src/styles.css +8 -16
- package/src/tokens/base.css +15 -0
- package/src/tokens/color.css +22 -63
- package/src/tokens/component-styles.generated.ts +81 -155
- package/src/tokens/dark.css +58 -0
- package/src/tokens/decisions.css +23 -0
- package/src/tokens/elevation.css +65 -23
- package/src/tokens/fonts.css +0 -2
- package/src/tokens/glass.css +17 -10
- package/src/tokens/motion-defaults.generated.ts +21 -0
- package/src/tokens/motion-scale.ts +2 -2
- package/src/tokens/motion-tokens.ts +65 -40
- package/src/tokens/motion-tokens.usage.md +5 -2
- package/src/tokens/motion.css +18 -28
- package/src/tokens/radius.css +12 -10
- package/src/tokens/reset.css +36 -0
- package/src/tokens/semantic.css +51 -39
- package/src/tokens/spacing.css +6 -7
- package/src/tokens/theme-store.ts +187 -0
- package/src/tokens/theme-sync.tsx +62 -0
- package/src/tokens/theme-tokens.generated.ts +708 -1121
- package/src/tokens/theme.tsx +116 -38
- package/src/tokens/theme.usage.md +26 -19
- package/src/tokens/typography.css +18 -20
- package/tailwind.css +187 -0
- package/dist/chunk-227ZW4V7.js.map +0 -1
- package/dist/chunk-43M6GQ4Q.js.map +0 -1
- package/dist/chunk-4BSHB7R3.js.map +0 -1
- package/dist/chunk-4C5RZXBT.js.map +0 -1
- package/dist/chunk-5PZ43DCG.js.map +0 -1
- package/dist/chunk-7IZJERGA.js +0 -80
- package/dist/chunk-7IZJERGA.js.map +0 -1
- package/dist/chunk-AADAJL7D.js.map +0 -1
- package/dist/chunk-CNWTIMIP.js +0 -39
- package/dist/chunk-CNWTIMIP.js.map +0 -1
- package/dist/chunk-EAI4POPB.js.map +0 -1
- package/dist/chunk-EF6RPXU7.js.map +0 -1
- package/dist/chunk-FONOS5RN.js.map +0 -1
- package/dist/chunk-FQEHSKEI.js +0 -38
- package/dist/chunk-FQEHSKEI.js.map +0 -1
- package/dist/chunk-HY5MPISE.js +0 -52
- package/dist/chunk-HY5MPISE.js.map +0 -1
- package/dist/chunk-I45AU6KH.js.map +0 -1
- package/dist/chunk-IJS7TPGV.js.map +0 -1
- package/dist/chunk-OWNMRMPN.js +0 -14
- package/dist/chunk-OWNMRMPN.js.map +0 -1
- package/dist/chunk-RJFGWJ4W.js.map +0 -1
- package/dist/chunk-TCUCYFT7.js +0 -25
- package/dist/chunk-TCUCYFT7.js.map +0 -1
- package/dist/chunk-TVYH4AN7.js.map +0 -1
- package/dist/chunk-TYHR4VNM.js.map +0 -1
- package/dist/chunk-VAXCXZ53.js.map +0 -1
- package/dist/chunk-XNIYSAMJ.js.map +0 -1
- package/dist/chunk-Y2YA7QRF.js +0 -17
- package/dist/chunk-Y2YA7QRF.js.map +0 -1
- package/src/tokens/avatar.css +0 -24
- package/src/tokens/icons.css +0 -11
- package/src/tokens/layers.css +0 -11
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { motionDefaults } from './motion-defaults.generated';
|
|
1
2
|
import type { DistanceToken, DurationToken, EaseToken, ScaleToken } from './motion-scale';
|
|
2
3
|
|
|
3
4
|
export interface MotionTransition {
|
|
@@ -32,22 +33,32 @@ export interface MotionTokens {
|
|
|
32
33
|
dist: Record<DistanceToken, number>;
|
|
33
34
|
scale: Record<ScaleToken, number>;
|
|
34
35
|
/** ready-made Motion transitions */
|
|
35
|
-
t: {
|
|
36
|
+
t: {
|
|
37
|
+
enter: MotionTransition;
|
|
38
|
+
exit: MotionTransition;
|
|
39
|
+
layout: MotionTransition;
|
|
40
|
+
settle: MotionTransition;
|
|
41
|
+
glide: MotionTransition;
|
|
42
|
+
};
|
|
36
43
|
reduced: boolean;
|
|
37
44
|
}
|
|
38
45
|
|
|
39
46
|
type MotionScales = Pick<MotionTokens, 'dur' | 'ease' | 'dist' | 'scale'>;
|
|
40
47
|
|
|
41
|
-
const
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
+
const DURATION_TOKENS: DurationToken[] = ['fast', 'base', 'slow', 'slower', 'slowest'];
|
|
49
|
+
const EASE_TOKENS: EaseToken[] = ['standard', 'entrance', 'exit', 'spring', 'glide'];
|
|
50
|
+
const DISTANCE_TOKENS: DistanceToken[] = ['sm', 'md', 'lg'];
|
|
51
|
+
const SCALE_TOKENS: ScaleToken[] = ['panel', 'floating', 'chip'];
|
|
52
|
+
|
|
53
|
+
const table = <K extends string, V>(keys: readonly K[], read: (key: K) => V): Record<K, V> =>
|
|
54
|
+
Object.fromEntries(keys.map((key) => [key, read(key)])) as Record<K, V>;
|
|
55
|
+
|
|
56
|
+
const DEFAULTS: MotionScales = {
|
|
57
|
+
dur: table(DURATION_TOKENS, (key) => motionDefaults.duration[key] / 1000),
|
|
58
|
+
ease: table(EASE_TOKENS, (key) => motionDefaults.ease[key]),
|
|
59
|
+
dist: table(DISTANCE_TOKENS, (key) => motionDefaults.distance[key]),
|
|
60
|
+
scale: table(SCALE_TOKENS, (key) => motionDefaults.scale[key]),
|
|
48
61
|
};
|
|
49
|
-
const DEFAULT_DIST: MotionTokens['dist'] = { sm: 8, md: 16, lg: 24 };
|
|
50
|
-
const DEFAULT_SCALE: MotionTokens['scale'] = { panel: 0.98, floating: 0.95, chip: 0.9 };
|
|
51
62
|
|
|
52
63
|
function build(scales: MotionScales): MotionTokens {
|
|
53
64
|
const { dur, ease } = scales;
|
|
@@ -60,13 +71,14 @@ function build(scales: MotionScales): MotionTokens {
|
|
|
60
71
|
exit: { duration: dur.fast, ease: ease.exit },
|
|
61
72
|
layout: { duration: dur.slow, ease: ease.entrance },
|
|
62
73
|
settle: reduced ? { duration: 0 } : { type: 'spring', visualDuration: dur.fast, bounce: 0.25 },
|
|
74
|
+
glide: { duration: dur.base, ease: ease.glide },
|
|
63
75
|
},
|
|
64
76
|
};
|
|
65
77
|
}
|
|
66
78
|
|
|
67
79
|
function readFromDom(): MotionTokens {
|
|
68
|
-
const cs = getComputedStyle(document.documentElement);
|
|
69
|
-
const rootFontSize = parseFloat(
|
|
80
|
+
const cs = getComputedStyle(document.body ?? document.documentElement);
|
|
81
|
+
const rootFontSize = parseFloat(getComputedStyle(document.documentElement).fontSize) || 16;
|
|
70
82
|
const seconds = (name: string, fallback: number): number => {
|
|
71
83
|
const v = cs.getPropertyValue(name).trim();
|
|
72
84
|
const n = v.slice(-2) === 'ms' ? parseFloat(v) / 1000 : parseFloat(v);
|
|
@@ -87,36 +99,49 @@ function readFromDom(): MotionTokens {
|
|
|
87
99
|
return m && m.length === 4 ? (m.map(Number) as Bezier) : fallback;
|
|
88
100
|
};
|
|
89
101
|
return build({
|
|
90
|
-
dur: {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
slower: seconds('--duration-slower', DEFAULT_DUR.slower),
|
|
95
|
-
slowest: seconds('--duration-slowest', DEFAULT_DUR.slowest),
|
|
96
|
-
},
|
|
97
|
-
ease: {
|
|
98
|
-
standard: bezier('--ease-standard', DEFAULT_EASE.standard),
|
|
99
|
-
entrance: bezier('--ease-entrance', DEFAULT_EASE.entrance),
|
|
100
|
-
exit: bezier('--ease-exit', DEFAULT_EASE.exit),
|
|
101
|
-
spring: bezier('--ease-spring', DEFAULT_EASE.spring),
|
|
102
|
-
glide: bezier('--ease-glide', DEFAULT_EASE.glide),
|
|
103
|
-
},
|
|
104
|
-
dist: {
|
|
105
|
-
sm: pixels('--distance-sm', DEFAULT_DIST.sm),
|
|
106
|
-
md: pixels('--distance-md', DEFAULT_DIST.md),
|
|
107
|
-
lg: pixels('--distance-lg', DEFAULT_DIST.lg),
|
|
108
|
-
},
|
|
109
|
-
scale: {
|
|
110
|
-
panel: ratio('--scale-panel', DEFAULT_SCALE.panel),
|
|
111
|
-
floating: ratio('--scale-floating', DEFAULT_SCALE.floating),
|
|
112
|
-
chip: ratio('--scale-chip', DEFAULT_SCALE.chip),
|
|
113
|
-
},
|
|
102
|
+
dur: table(DURATION_TOKENS, (key) => seconds(`--duration-${key}`, DEFAULTS.dur[key])),
|
|
103
|
+
ease: table(EASE_TOKENS, (key) => bezier(`--ease-${key}`, DEFAULTS.ease[key])),
|
|
104
|
+
dist: table(DISTANCE_TOKENS, (key) => pixels(`--distance-${key}`, DEFAULTS.dist[key])),
|
|
105
|
+
scale: table(SCALE_TOKENS, (key) => ratio(`--scale-${key}`, DEFAULTS.scale[key])),
|
|
114
106
|
});
|
|
115
107
|
}
|
|
116
108
|
|
|
117
|
-
|
|
118
|
-
typeof
|
|
119
|
-
|
|
120
|
-
|
|
109
|
+
const isRecord = (value: unknown): value is Record<string, unknown> =>
|
|
110
|
+
typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
111
|
+
|
|
112
|
+
function replaceInto(target: Record<string, unknown>, next: Record<string, unknown>): void {
|
|
113
|
+
for (const key of Object.keys(target)) if (!(key in next)) delete target[key];
|
|
114
|
+
for (const [key, value] of Object.entries(next)) {
|
|
115
|
+
const current = target[key];
|
|
116
|
+
if (isRecord(current) && isRecord(value)) replaceInto(current, value);
|
|
117
|
+
else target[key] = value;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
const hasDom = typeof document !== 'undefined';
|
|
122
|
+
|
|
123
|
+
export const UIMotion: MotionTokens = hasDom ? readFromDom() : build(DEFAULTS);
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Re-reads the motion tokens into `UIMotion` in place, so every held reference sees the new values. Runs on
|
|
127
|
+
* a `data-theme` or `data-polarity` change, a `prefers-reduced-motion` flip and after `ZyncatTheme`
|
|
128
|
+
* renders; call it yourself after injecting a stylesheet that retimes the `--duration-*` tokens.
|
|
129
|
+
*/
|
|
130
|
+
export function refreshMotionTokens(): MotionTokens {
|
|
131
|
+
if (hasDom)
|
|
132
|
+
replaceInto(UIMotion as unknown as Record<string, unknown>, readFromDom() as unknown as Record<string, unknown>);
|
|
133
|
+
return UIMotion;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
if (hasDom) {
|
|
137
|
+
if (typeof matchMedia === 'function')
|
|
138
|
+
matchMedia('(prefers-reduced-motion: reduce)').addEventListener('change', () => refreshMotionTokens());
|
|
139
|
+
if (typeof MutationObserver === 'function')
|
|
140
|
+
new MutationObserver(() => refreshMotionTokens()).observe(document.documentElement, {
|
|
141
|
+
attributes: true,
|
|
142
|
+
attributeFilter: ['data-theme', 'data-polarity'],
|
|
143
|
+
subtree: true,
|
|
144
|
+
});
|
|
145
|
+
}
|
|
121
146
|
|
|
122
147
|
export default UIMotion;
|
|
@@ -6,8 +6,11 @@ TypeScript readers for the motion token vocabulary - duration/ease/distance/scal
|
|
|
6
6
|
|
|
7
7
|
Use it to time your own animation code off the same tokens the components read, so your motion
|
|
8
8
|
retimes with the theme and collapses under reduced motion exactly like the library's. UIMotion
|
|
9
|
-
carries dur/ease/dist/scale maps, ready-made enter/exit/layout/settle transitions on `t`, and
|
|
10
|
-
`reduced`, which reflects prefers-reduced-motion.
|
|
9
|
+
carries dur/ease/dist/scale maps, ready-made enter/exit/layout/settle/glide transitions on `t`, and
|
|
10
|
+
`reduced`, which reflects prefers-reduced-motion. It re-reads in place when `data-theme` changes on any
|
|
11
|
+
element, when prefers-reduced-motion flips and after `ZyncatTheme` renders, so read it at call time rather
|
|
12
|
+
than into a module constant; `refreshMotionTokens()` re-reads it after a stylesheet of your own retimes the `--duration-*`
|
|
13
|
+
tokens.
|
|
11
14
|
|
|
12
15
|
```tsx
|
|
13
16
|
import { UIMotion } from '@zyncat/ui/motion-tokens';
|
package/src/tokens/motion.css
CHANGED
|
@@ -1,59 +1,49 @@
|
|
|
1
|
-
|
|
2
|
-
smooths every layout shift by default. */
|
|
3
|
-
|
|
4
|
-
@layer zyncat.tokens, zyncat.components;
|
|
1
|
+
@layer zyncat.reset, zyncat.tokens, zyncat.components;
|
|
5
2
|
|
|
6
3
|
@layer zyncat.tokens {
|
|
7
4
|
:root {
|
|
8
|
-
--duration-fast: 140ms;
|
|
9
|
-
--duration-base: 200ms;
|
|
10
|
-
--duration-slow: 300ms;
|
|
5
|
+
--duration-fast: 140ms; /* micro feedback - hover washes, presses, control tint */
|
|
6
|
+
--duration-base: 200ms; /* standard element transitions - fades, toggles, badge morphs */
|
|
7
|
+
--duration-slow: 300ms; /* layout-scale movement - Collapse, panel resizes, reordering */
|
|
11
8
|
--duration-slower: 450ms; /* large-surface movement - dialog, sheet, page-scale reveals */
|
|
12
|
-
--duration-slowest: 900ms; /* hero-scale movement - card expansion, container transforms
|
|
13
|
-
--duration-spin:
|
|
14
|
-
--duration-pulse: 1600ms; /* ambient
|
|
9
|
+
--duration-slowest: 900ms; /* hero-scale movement - card expansion, container transforms */
|
|
10
|
+
--duration-spin: 1000ms; /* continuous loaders only, outside the UI-transition scale */
|
|
11
|
+
--duration-pulse: 1600ms; /* ambient breathing, not collapsed under reduced motion */
|
|
15
12
|
|
|
16
13
|
--ease-standard: cubic-bezier(0.2, 0, 0, 1);
|
|
17
14
|
--ease-entrance: cubic-bezier(0.25, 1, 0.4, 1);
|
|
18
15
|
--ease-exit: cubic-bezier(0.4, 0, 1, 1);
|
|
19
16
|
--ease-spring: cubic-bezier(0.34, 1.4, 0.5, 1);
|
|
20
17
|
--ease-glide: cubic-bezier(
|
|
18
|
+
0.32,
|
|
21
19
|
0.55,
|
|
22
20
|
0,
|
|
23
|
-
0.15,
|
|
24
21
|
1
|
|
25
|
-
); /*
|
|
22
|
+
); /* fast out, soft landing - a persistent element moving to a new target, never enter/exit */
|
|
26
23
|
|
|
27
|
-
|
|
28
|
-
spacing spine; pick by how far the surface has conceptually come, not by how big it is. */
|
|
29
|
-
--distance-sm: 0.5rem; /* 8px - settling into place; the surface is already where it belongs */
|
|
24
|
+
--distance-sm: 0.5rem; /* 8px - settling into place */
|
|
30
25
|
--distance-md: 1rem; /* 16px - arriving from an adjacent position - page turns, tab panels, paged ranges */
|
|
31
26
|
--distance-lg: 1.5rem; /* 24px - arriving from outside the surface - a toast joining its stack */
|
|
32
27
|
|
|
33
|
-
/* Rest scale -
|
|
34
|
-
size, not by taste: the same ratio reads as more movement the wider the surface, so a dialog
|
|
35
|
-
needs a smaller one than a tag to land at the same perceived distance. */
|
|
28
|
+
/* Rest scale - the same ratio reads as more movement the wider the surface. */
|
|
36
29
|
--scale-panel: 0.98; /* full-width surfaces - dialog, modal, sheet */
|
|
37
30
|
--scale-floating: 0.96; /* floating surfaces - popover, tooltip, menu, toast, alert */
|
|
38
31
|
--scale-chip: 0.9; /* small inline elements - tag, badge, count */
|
|
32
|
+
}
|
|
39
33
|
|
|
34
|
+
:root,
|
|
35
|
+
[data-theme],
|
|
36
|
+
[data-polarity] {
|
|
40
37
|
--transition-control:
|
|
41
38
|
color var(--duration-fast) var(--ease-standard), background-color var(--duration-fast) var(--ease-standard),
|
|
42
|
-
border-color var(--duration-fast) var(--ease-standard), box-shadow var(--duration-fast) var(--ease-standard)
|
|
39
|
+
border-color var(--duration-fast) var(--ease-standard), box-shadow var(--duration-fast) var(--ease-standard),
|
|
40
|
+
outline-color var(--duration-fast) var(--ease-standard);
|
|
43
41
|
--transition-colors:
|
|
44
42
|
color var(--duration-fast) var(--ease-standard), background-color var(--duration-fast) var(--ease-standard),
|
|
45
43
|
border-color var(--duration-fast) var(--ease-standard);
|
|
46
44
|
--transition-opacity: opacity var(--duration-base) var(--ease-standard);
|
|
47
|
-
--transition-transform: transform var(--duration-base) var(--ease-standard);
|
|
48
|
-
|
|
49
|
-
/* Layout transition - animatable stand-ins for width/height; apply wherever size may change. */
|
|
50
|
-
--transition-layout:
|
|
51
|
-
grid-template-rows var(--duration-slow) var(--ease-entrance),
|
|
52
|
-
grid-template-columns var(--duration-slow) var(--ease-entrance),
|
|
53
|
-
max-height var(--duration-slow) var(--ease-entrance), max-width var(--duration-slow) var(--ease-entrance);
|
|
54
45
|
}
|
|
55
46
|
|
|
56
|
-
/* Accessibility: honor reduced-motion globally - every consumer gets it free. */
|
|
57
47
|
@media (prefers-reduced-motion: reduce) {
|
|
58
48
|
:root {
|
|
59
49
|
--duration-fast: 1ms;
|
|
@@ -61,7 +51,7 @@
|
|
|
61
51
|
--duration-slow: 1ms;
|
|
62
52
|
--duration-slower: 1ms;
|
|
63
53
|
--duration-slowest: 1ms;
|
|
64
|
-
--duration-spin:
|
|
54
|
+
--duration-spin: 2000ms; /* slow the loader, never freeze it (1ms = blur) */
|
|
65
55
|
}
|
|
66
56
|
}
|
|
67
57
|
}
|
package/src/tokens/radius.css
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
@layer zyncat.tokens, zyncat.components;
|
|
1
|
+
@layer zyncat.reset, zyncat.tokens, zyncat.components;
|
|
4
2
|
|
|
5
3
|
@layer zyncat.tokens {
|
|
6
4
|
:root {
|
|
7
|
-
--radius-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
--radius-
|
|
5
|
+
--radius-full: 624.9375rem; /* the pill - a shape, not a step of --radius, so it stays literal */
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
:root,
|
|
9
|
+
[data-theme],
|
|
10
|
+
[data-polarity] {
|
|
11
|
+
--radius-sm: calc(var(--radius) * 0.5);
|
|
12
|
+
--radius-md: calc(var(--radius) * 0.75);
|
|
13
|
+
--radius-lg: var(--radius);
|
|
14
|
+
--radius-xl: calc(var(--radius) * 1.5);
|
|
15
|
+
--radius-2xl: calc(var(--radius) * 2);
|
|
14
16
|
}
|
|
15
17
|
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
@layer zyncat.reset, zyncat.tokens, zyncat.components;
|
|
2
|
+
|
|
3
|
+
@layer zyncat.reset {
|
|
4
|
+
/* Not the default: iOS Safari inflates text in landscape without it. */
|
|
5
|
+
html {
|
|
6
|
+
-webkit-text-size-adjust: 100%;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
*,
|
|
10
|
+
*::before,
|
|
11
|
+
*::after {
|
|
12
|
+
box-sizing: border-box;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
body {
|
|
16
|
+
margin: 0;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/* The font shorthand resets every font longhand, the two settings ones included, and Safari
|
|
20
|
+
withholds letter-spacing from controls; each is restated so the control keeps inheriting. */
|
|
21
|
+
button,
|
|
22
|
+
input,
|
|
23
|
+
optgroup,
|
|
24
|
+
select,
|
|
25
|
+
textarea {
|
|
26
|
+
font: inherit;
|
|
27
|
+
font-feature-settings: inherit;
|
|
28
|
+
font-variation-settings: inherit;
|
|
29
|
+
letter-spacing: inherit;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/* Firefox's UA sheet dims placeholders to 0.54. */
|
|
33
|
+
::placeholder {
|
|
34
|
+
opacity: 1;
|
|
35
|
+
}
|
|
36
|
+
}
|
package/src/tokens/semantic.css
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
@layer zyncat.tokens, zyncat.components;
|
|
1
|
+
@layer zyncat.reset, zyncat.tokens, zyncat.components;
|
|
4
2
|
|
|
5
3
|
@layer zyncat.tokens {
|
|
6
4
|
:root {
|
|
7
|
-
/* The
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
/* The ink on a hue fill - the ramp's lightest rung in either polarity. */
|
|
6
|
+
--text-on-accent: var(--gray-0);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
:root,
|
|
10
|
+
[data-polarity='light'] {
|
|
11
|
+
color-scheme: light;
|
|
12
|
+
|
|
13
|
+
/* Canvas, cards and panels share the top of the ramp, separated by hairlines rather than tint. */
|
|
11
14
|
--bg-app: var(--gray-0);
|
|
12
15
|
--bg-surface: var(--gray-0);
|
|
13
16
|
--bg-surface-raised: var(--gray-0);
|
|
@@ -22,47 +25,56 @@
|
|
|
22
25
|
--text-muted: var(--gray-600);
|
|
23
26
|
--text-subtle: var(--gray-500);
|
|
24
27
|
--text-disabled: var(--gray-400);
|
|
25
|
-
|
|
26
|
-
--text-on-accent: var(--gray-0);
|
|
28
|
+
/* The ink on a strong-ink fill - the canvas colour in either polarity. */
|
|
27
29
|
--text-inverse: var(--gray-0);
|
|
28
30
|
|
|
29
31
|
--border-subtle: var(--gray-150);
|
|
30
32
|
--border-default: var(--gray-200);
|
|
31
33
|
--border-strong: var(--gray-300);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
:root,
|
|
37
|
+
[data-theme],
|
|
38
|
+
[data-polarity] {
|
|
39
|
+
/* The resting face of a filled control. */
|
|
40
|
+
--accent-fill: var(--accent);
|
|
41
|
+
--accent-lift: oklch(from var(--accent) calc(l + 0.075) calc(c - 0.006) h);
|
|
42
|
+
--accent-hover: oklch(from var(--accent) calc(l - 0.07) calc(c - 0.004) h);
|
|
43
|
+
--accent-active: oklch(from var(--accent) calc(l - 0.152) calc(c - 0.018) h);
|
|
44
|
+
--accent-subtle: oklch(from var(--accent) 0.972 0.02 h);
|
|
45
|
+
--accent-border: oklch(from var(--accent) 0.88 0.066 h);
|
|
46
|
+
--accent-disabled: oklch(from var(--accent) 0.795 0.092 h);
|
|
47
|
+
--accent-wash: oklch(from var(--accent) l c h / 0.08);
|
|
48
|
+
--text-accent: var(--accent-active);
|
|
49
|
+
|
|
50
|
+
/* Translucent washes of the ink, never opaque near-whites. */
|
|
51
|
+
--neutral-wash: color-mix(in oklab, var(--text-secondary) 6%, transparent);
|
|
52
|
+
--neutral-wash-press: color-mix(in oklab, var(--text-secondary) 10%, transparent);
|
|
53
|
+
|
|
54
|
+
/* The accent's hue one step down - repoint it for a hue of its own. */
|
|
55
|
+
--info: var(--accent-hover);
|
|
56
|
+
--info-subtle: oklch(from var(--info) 0.972 0.02 h);
|
|
57
|
+
--info-text: oklch(from var(--info) calc(l - 0.082) calc(c - 0.014) h);
|
|
58
|
+
--info-wash: oklch(from var(--info) 0.63 0.118 h / 0.08);
|
|
32
59
|
|
|
33
|
-
--
|
|
34
|
-
--
|
|
35
|
-
--
|
|
36
|
-
--accent-active: var(--teal-700);
|
|
37
|
-
--accent-subtle: var(--teal-50);
|
|
38
|
-
--accent-border: var(--teal-200);
|
|
39
|
-
--accent-disabled: var(--teal-300);
|
|
60
|
+
--success-subtle: oklch(from var(--success) 0.965 0.028 h);
|
|
61
|
+
--success-text: oklch(from var(--success) calc(l - 0.086) calc(c - 0.022) h);
|
|
62
|
+
--success-wash: oklch(from var(--success) 0.62 0.13 h / 0.1);
|
|
40
63
|
|
|
41
|
-
--
|
|
42
|
-
--
|
|
43
|
-
--
|
|
44
|
-
--warning-subtle: var(--amber-50);
|
|
45
|
-
--warning: var(--amber-600);
|
|
46
|
-
--warning-text: var(--amber-700);
|
|
47
|
-
--danger-subtle: var(--red-50);
|
|
48
|
-
--danger: var(--red-600);
|
|
49
|
-
--danger-text: var(--red-700);
|
|
50
|
-
--info-subtle: var(--teal-50);
|
|
51
|
-
--info: var(--teal-600);
|
|
52
|
-
--info-text: var(--teal-700);
|
|
53
|
-
--danger-disabled: var(--red-300);
|
|
64
|
+
--warning-subtle: oklch(from var(--warning) 0.972 0.034 h);
|
|
65
|
+
--warning-text: oklch(from var(--warning) calc(l - 0.14) calc(c - 0.024) h);
|
|
66
|
+
--warning-wash: oklch(from var(--warning) 0.76 0.14 h / 0.12);
|
|
54
67
|
|
|
55
|
-
/*
|
|
56
|
-
|
|
57
|
-
--
|
|
58
|
-
--
|
|
59
|
-
--
|
|
60
|
-
--
|
|
61
|
-
--
|
|
62
|
-
--danger-wash: var(--
|
|
68
|
+
/* The destructive button's hover face, above --danger-fill. */
|
|
69
|
+
--danger-lift: oklch(from var(--danger) 0.64 0.2 h);
|
|
70
|
+
--danger-fill: oklch(from var(--danger) 0.602 0.196 h);
|
|
71
|
+
--danger-active: oklch(from var(--danger) calc(l - 0.067) calc(c - 0.024) h);
|
|
72
|
+
--danger-subtle: oklch(from var(--danger) 0.968 0.02 h);
|
|
73
|
+
--danger-text: var(--danger-active);
|
|
74
|
+
--danger-disabled: oklch(from var(--danger) 0.8 0.09 h);
|
|
75
|
+
--danger-wash: oklch(from var(--danger) 0.602 0.196 h / 0.1);
|
|
63
76
|
|
|
64
|
-
|
|
65
|
-
--glass-tint-neutral: color-mix(in oklab, var(--gray-600) 13%, transparent);
|
|
77
|
+
--glass-tint-neutral: color-mix(in oklab, var(--text-muted) 13%, transparent);
|
|
66
78
|
--glass-tint-info: color-mix(in oklab, var(--info) 17%, transparent);
|
|
67
79
|
--glass-tint-success: color-mix(in oklab, var(--success) 17%, transparent);
|
|
68
80
|
--glass-tint-warning: color-mix(in oklab, var(--warning) 21%, transparent);
|
package/src/tokens/spacing.css
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
@layer zyncat.tokens, zyncat.components;
|
|
1
|
+
@layer zyncat.reset, zyncat.tokens, zyncat.components;
|
|
4
2
|
|
|
5
3
|
@layer zyncat.tokens {
|
|
6
4
|
:root {
|
|
7
5
|
--space-px: 1px;
|
|
8
|
-
--space-0: 0;
|
|
9
6
|
--space-1: 0.25rem;
|
|
10
7
|
--space-2: 0.5rem;
|
|
11
8
|
--space-3: 0.75rem;
|
|
@@ -17,14 +14,16 @@
|
|
|
17
14
|
--space-9: 6rem;
|
|
18
15
|
--space-10: 8rem;
|
|
19
16
|
|
|
20
|
-
--container-max: 72rem;
|
|
21
17
|
--measure-prose: 38rem;
|
|
22
|
-
--sidebar-width: 16rem;
|
|
23
18
|
|
|
24
19
|
--control-height-sm: 1.75rem;
|
|
25
20
|
--control-height: 2rem;
|
|
26
21
|
--control-height-lg: 2.3rem;
|
|
27
22
|
--control-box: 1.125rem;
|
|
28
|
-
--control-switch: 1.25rem; /* switch track
|
|
23
|
+
--control-switch: 1.25rem; /* the switch track - the one control size off the scale */
|
|
24
|
+
|
|
25
|
+
--icon-sm: 17px;
|
|
26
|
+
--icon-md: 20px;
|
|
27
|
+
--icon-lg: 26px;
|
|
29
28
|
}
|
|
30
29
|
}
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
import { sharedSlot } from '../shared-slot';
|
|
2
|
+
|
|
3
|
+
export type Polarity = 'light' | 'dark';
|
|
4
|
+
export type PolarityPreference = Polarity | 'system';
|
|
5
|
+
|
|
6
|
+
export interface ThemeState {
|
|
7
|
+
/** The active palette - `default` when no other is named. */
|
|
8
|
+
theme: string;
|
|
9
|
+
/** The stored side, or `system` to follow the OS setting. */
|
|
10
|
+
polarity: PolarityPreference;
|
|
11
|
+
/** The side the page is painted in - `system` resolved through the OS setting. */
|
|
12
|
+
resolvedPolarity: Polarity;
|
|
13
|
+
/** Every palette `ZyncatTheme` declared, `default` first. */
|
|
14
|
+
themes: readonly string[];
|
|
15
|
+
/** Display name per palette - the palette's `name`, else its key title-cased. */
|
|
16
|
+
themeNames: Readonly<Record<string, string>>;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface ThemeControls extends ThemeState {
|
|
20
|
+
/** Switch the palette; the side stays. */
|
|
21
|
+
setTheme(theme: string): void;
|
|
22
|
+
/** Pick a side, or `system` to follow the OS setting. */
|
|
23
|
+
setPolarity(polarity: PolarityPreference): void;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export type ThemeBootConfig = { key: string; declared: ThemeState };
|
|
27
|
+
|
|
28
|
+
export interface ThemeChange {
|
|
29
|
+
current: ThemeState;
|
|
30
|
+
next: ThemeState;
|
|
31
|
+
origin?: readonly [number, number];
|
|
32
|
+
commit(): void;
|
|
33
|
+
revert(): void;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export interface ThemePreferenceOptions {
|
|
37
|
+
/** Viewport point the change spreads from - the centre of the pressed control. */
|
|
38
|
+
origin?: readonly [number, number];
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export type ThemeTransitionRunner = (change: ThemeChange) => void;
|
|
42
|
+
|
|
43
|
+
export const DEFAULT_THEME = 'default';
|
|
44
|
+
export const THEME_STORAGE_KEY = 'zyncat-theme';
|
|
45
|
+
|
|
46
|
+
/* Serialised with String() into the inline boot script, so it closes over nothing: every name it needs
|
|
47
|
+
arrives in config, and the attribute names and the polarity words stay literal inside it. */
|
|
48
|
+
export function bootTheme(config: ThemeBootConfig, stored?: unknown): Omit<ThemeState, 'themes' | 'themeNames'> {
|
|
49
|
+
let { theme, polarity, themes } = config.declared;
|
|
50
|
+
if (stored === undefined) {
|
|
51
|
+
try {
|
|
52
|
+
stored = JSON.parse(localStorage.getItem(config.key) || 'null');
|
|
53
|
+
/* Named binding, not `catch {}`: the client target downlevels an omitted binding and the server
|
|
54
|
+
target does not, so String(bootTheme) differs and the inline script mismatches on hydration. */
|
|
55
|
+
} catch (error) {}
|
|
56
|
+
}
|
|
57
|
+
const saved = (stored || {}) as { theme?: unknown; polarity?: unknown };
|
|
58
|
+
if (typeof saved.theme === 'string' && themes.includes(saved.theme)) theme = saved.theme;
|
|
59
|
+
if (saved.polarity === 'light' || saved.polarity === 'dark' || saved.polarity === 'system') polarity = saved.polarity;
|
|
60
|
+
const resolvedPolarity: Polarity =
|
|
61
|
+
polarity === 'system' ? (matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light') : polarity;
|
|
62
|
+
const root = document.documentElement;
|
|
63
|
+
if (theme === themes[0]) root.removeAttribute('data-theme');
|
|
64
|
+
else root.setAttribute('data-theme', theme);
|
|
65
|
+
root.setAttribute('data-polarity', resolvedPolarity);
|
|
66
|
+
let meta = document.querySelector('meta[name="theme-color"]') as HTMLMetaElement | null;
|
|
67
|
+
if (!meta) {
|
|
68
|
+
meta = document.head.appendChild(document.createElement('meta'));
|
|
69
|
+
meta.name = 'theme-color';
|
|
70
|
+
meta.setAttribute('data-zyncat-theme-color', '');
|
|
71
|
+
}
|
|
72
|
+
if (meta.hasAttribute('data-zyncat-theme-color')) {
|
|
73
|
+
meta.style.backgroundColor = 'var(--bg-app)';
|
|
74
|
+
const painted = getComputedStyle(meta).backgroundColor;
|
|
75
|
+
meta.style.backgroundColor = '';
|
|
76
|
+
if (painted && painted !== 'rgba(0, 0, 0, 0)') meta.content = painted;
|
|
77
|
+
}
|
|
78
|
+
return { theme, polarity, resolvedPolarity };
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
const DEFAULT_CONFIG: ThemeBootConfig = {
|
|
82
|
+
key: THEME_STORAGE_KEY,
|
|
83
|
+
declared: {
|
|
84
|
+
theme: DEFAULT_THEME,
|
|
85
|
+
polarity: 'system',
|
|
86
|
+
resolvedPolarity: 'light',
|
|
87
|
+
themes: [DEFAULT_THEME],
|
|
88
|
+
themeNames: { [DEFAULT_THEME]: 'Default' },
|
|
89
|
+
},
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
const store = sharedSlot('tokens.theme@1', () => ({
|
|
93
|
+
json: '',
|
|
94
|
+
config: DEFAULT_CONFIG,
|
|
95
|
+
state: null as ThemeState | null,
|
|
96
|
+
attached: false,
|
|
97
|
+
listeners: new Set<() => void>(),
|
|
98
|
+
transition: null as ThemeTransitionRunner | null,
|
|
99
|
+
pending: null as ThemeState | null,
|
|
100
|
+
}));
|
|
101
|
+
|
|
102
|
+
const notify = () => {
|
|
103
|
+
for (const listener of store.listeners) listener();
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
export function configureThemeStore(json: string): void {
|
|
107
|
+
if (json === store.json) return;
|
|
108
|
+
store.json = json;
|
|
109
|
+
store.config = JSON.parse(json);
|
|
110
|
+
store.state = null;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export function applyTheme(stored?: unknown): void {
|
|
114
|
+
const { themes, themeNames } = store.config.declared;
|
|
115
|
+
store.state = { ...bootTheme(store.config, stored), themes, themeNames };
|
|
116
|
+
notify();
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export const getThemeSnapshot = (): ThemeState => store.state ?? store.config.declared;
|
|
120
|
+
export const getThemeTargetSnapshot = (): ThemeState => store.pending ?? getThemeSnapshot();
|
|
121
|
+
export const getServerThemeSnapshot = (): ThemeState => store.config.declared;
|
|
122
|
+
|
|
123
|
+
export function setThemeTransition(runner: ThemeTransitionRunner | null): void {
|
|
124
|
+
store.transition = runner;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
const resolvePolarity = (polarity: PolarityPreference): Polarity =>
|
|
128
|
+
polarity === 'system' ? (matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light') : polarity;
|
|
129
|
+
|
|
130
|
+
const persistTheme = (choice: Pick<ThemeState, 'theme' | 'polarity'>) => {
|
|
131
|
+
try {
|
|
132
|
+
localStorage.setItem(store.config.key, JSON.stringify(choice));
|
|
133
|
+
} catch {}
|
|
134
|
+
applyTheme(choice);
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
const settlePending = (choice: Pick<ThemeState, 'theme' | 'polarity'>) => {
|
|
138
|
+
if (store.pending && store.pending.theme === choice.theme && store.pending.polarity === choice.polarity) {
|
|
139
|
+
store.pending = null;
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
export function setThemePreference(
|
|
144
|
+
patch: Partial<Pick<ThemeState, 'theme' | 'polarity'>>,
|
|
145
|
+
options: ThemePreferenceOptions = {},
|
|
146
|
+
): void {
|
|
147
|
+
const current = getThemeSnapshot();
|
|
148
|
+
const base = store.pending ?? current;
|
|
149
|
+
const theme = patch.theme && current.themes.includes(patch.theme) ? patch.theme : base.theme;
|
|
150
|
+
const polarity = patch.polarity ?? base.polarity;
|
|
151
|
+
const choice = { theme, polarity };
|
|
152
|
+
if (!store.transition) {
|
|
153
|
+
persistTheme(choice);
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
const next: ThemeState = { ...current, theme, polarity, resolvedPolarity: resolvePolarity(polarity) };
|
|
157
|
+
store.pending = next;
|
|
158
|
+
notify();
|
|
159
|
+
store.transition({
|
|
160
|
+
current,
|
|
161
|
+
next,
|
|
162
|
+
origin: options.origin,
|
|
163
|
+
commit: () => {
|
|
164
|
+
settlePending(choice);
|
|
165
|
+
persistTheme(choice);
|
|
166
|
+
},
|
|
167
|
+
revert: () => {
|
|
168
|
+
store.pending = null;
|
|
169
|
+
notify();
|
|
170
|
+
},
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
export function subscribeTheme(listener: () => void): () => void {
|
|
175
|
+
store.listeners.add(listener);
|
|
176
|
+
if (!store.attached) {
|
|
177
|
+
store.attached = true;
|
|
178
|
+
matchMedia('(prefers-color-scheme: dark)').addEventListener('change', () => {
|
|
179
|
+
if (store.state?.polarity === 'system') applyTheme(store.state);
|
|
180
|
+
});
|
|
181
|
+
window.addEventListener('storage', (event) => {
|
|
182
|
+
if (event.key === null || event.key === store.config.key) applyTheme();
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
if (!store.state) applyTheme();
|
|
186
|
+
return () => store.listeners.delete(listener);
|
|
187
|
+
}
|