@zyncat/ui 0.20.0 → 0.22.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/dist/alert.js +11 -10
- package/dist/alert.js.map +1 -1
- package/dist/avatar.css +1 -1
- package/dist/badge.css +20 -11
- package/dist/badge.js +4 -1
- package/dist/{bloom-HV23M4AW.js → bloom-5MZXLNKG.js} +23 -5
- package/dist/bloom-5MZXLNKG.js.map +1 -0
- package/dist/button.css +24 -27
- package/dist/button.js +3 -3
- package/dist/checkbox.css +0 -1
- package/dist/chunk-2EPNCOLN.js +177 -0
- package/dist/chunk-2EPNCOLN.js.map +1 -0
- package/dist/{chunk-LNAV5E7S.js → chunk-2GYZ3HP3.js} +8 -4
- package/dist/chunk-2GYZ3HP3.js.map +1 -0
- package/dist/chunk-4M5FMCFJ.js +16 -0
- package/dist/chunk-4M5FMCFJ.js.map +1 -0
- package/dist/{chunk-ODRO3KS6.js → chunk-7GTACTZD.js} +8 -6
- package/dist/chunk-7GTACTZD.js.map +1 -0
- package/dist/{chunk-V6QAAOA5.js → chunk-AK2AXGEC.js} +38 -8
- package/dist/chunk-AK2AXGEC.js.map +1 -0
- package/dist/{chunk-5VC3TUZ2.js → chunk-BA4ALXQW.js} +2 -2
- package/dist/{chunk-5VC3TUZ2.js.map → chunk-BA4ALXQW.js.map} +1 -1
- package/dist/{chunk-N43NDSME.js → chunk-CF6ZFXRV.js} +19 -11
- package/dist/chunk-CF6ZFXRV.js.map +1 -0
- package/dist/{chunk-BRKGYLEQ.js → chunk-DOAR4PJ3.js} +9 -4
- package/dist/chunk-DOAR4PJ3.js.map +1 -0
- package/dist/{tide-DJZMDAFT.js → chunk-DVLKB3CZ.js} +15 -12
- package/dist/chunk-DVLKB3CZ.js.map +1 -0
- package/dist/chunk-EUAXI6OF.js +16 -0
- package/dist/chunk-EUAXI6OF.js.map +1 -0
- package/dist/{chunk-RLNCRDAL.js → chunk-G2TOUG2A.js} +7 -6
- package/dist/chunk-G2TOUG2A.js.map +1 -0
- package/dist/{chunk-VQFILXQN.js → chunk-HRP4UFWN.js} +70 -8
- package/dist/chunk-HRP4UFWN.js.map +1 -0
- package/dist/chunk-INK2GJTA.js +102 -0
- package/dist/chunk-INK2GJTA.js.map +1 -0
- package/dist/chunk-ITW5UCVU.js +24 -0
- package/dist/chunk-ITW5UCVU.js.map +1 -0
- package/dist/{chunk-F64Z42PJ.js → chunk-JJHEVW4M.js} +5 -6
- package/dist/chunk-JJHEVW4M.js.map +1 -0
- package/dist/{chunk-7NHY2CRA.js → chunk-JUC35N3C.js} +2 -2
- package/dist/chunk-JUC35N3C.js.map +1 -0
- package/dist/{chunk-PXQBJMPJ.js → chunk-LFJ4C7ZP.js} +7 -7
- package/dist/chunk-LFJ4C7ZP.js.map +1 -0
- package/dist/{chunk-TDHLZY6I.js → chunk-MCOIR3CK.js} +77 -18
- package/dist/chunk-MCOIR3CK.js.map +1 -0
- package/dist/chunk-NATK4DDW.js +108 -0
- package/dist/chunk-NATK4DDW.js.map +1 -0
- package/dist/{chunk-BIDVNLJO.js → chunk-O3RMSMBP.js} +8 -3
- package/dist/{chunk-BIDVNLJO.js.map → chunk-O3RMSMBP.js.map} +1 -1
- package/dist/{chunk-UKPX3RIP.js → chunk-ODO2TCTS.js} +27 -13
- package/dist/chunk-ODO2TCTS.js.map +1 -0
- package/dist/{chunk-M2KGLH2G.js → chunk-P3QSWNED.js} +11 -11
- package/dist/{chunk-M2KGLH2G.js.map → chunk-P3QSWNED.js.map} +1 -1
- package/dist/{chunk-QDAN43B6.js → chunk-Q4K337QY.js} +6 -6
- package/dist/chunk-Q4K337QY.js.map +1 -0
- package/dist/{chunk-2YGHPQ66.js → chunk-Q5N24VII.js} +2 -2
- package/dist/{chunk-2YGHPQ66.js.map → chunk-Q5N24VII.js.map} +1 -1
- package/dist/{chunk-VJXP256V.js → chunk-RLRZJAF7.js} +20 -8
- package/dist/chunk-RLRZJAF7.js.map +1 -0
- package/dist/{chunk-VZXML7EH.js → chunk-SY5UA6WS.js} +39 -10
- package/dist/chunk-SY5UA6WS.js.map +1 -0
- package/dist/{chunk-XKDR22VE.js → chunk-TFC5SCAB.js} +37 -14
- package/dist/chunk-TFC5SCAB.js.map +1 -0
- package/dist/{chunk-HBWRKEW4.js → chunk-VBALIMST.js} +3 -3
- package/dist/{chunk-HBWRKEW4.js.map → chunk-VBALIMST.js.map} +1 -1
- package/dist/{chunk-JINATP4N.js → chunk-VXQ7A6ZI.js} +8 -9
- package/dist/chunk-VXQ7A6ZI.js.map +1 -0
- package/dist/{chunk-TBLPZQSI.js → chunk-W7CHDHRV.js} +114 -42
- package/dist/chunk-W7CHDHRV.js.map +1 -0
- package/dist/{chunk-AIAPXRCI.js → chunk-WBWVOOKM.js} +201 -123
- package/dist/chunk-WBWVOOKM.js.map +1 -0
- package/dist/{chunk-6H3IJ752.js → chunk-WJEZWKEY.js} +20 -10
- package/dist/chunk-WJEZWKEY.js.map +1 -0
- package/dist/{chunk-TRPAKUIB.js → chunk-WMTOAYGP.js} +9 -9
- package/dist/{chunk-TRPAKUIB.js.map → chunk-WMTOAYGP.js.map} +1 -1
- package/dist/{chunk-C3D32LE3.js → chunk-WTHIUPVJ.js} +3 -3
- package/dist/{chunk-C3D32LE3.js.map → chunk-WTHIUPVJ.js.map} +1 -1
- package/dist/{chunk-F2TB3TT6.js → chunk-XCTMTOGT.js} +5 -5
- package/dist/{chunk-F2TB3TT6.js.map → chunk-XCTMTOGT.js.map} +1 -1
- package/dist/chunk-XMJ343KF.js +18 -0
- package/dist/chunk-XMJ343KF.js.map +1 -0
- package/dist/collapse.js +1 -1
- package/dist/combobox.css +7 -0
- package/dist/combobox.js +183 -0
- package/dist/combobox.js.map +1 -0
- package/dist/confetti.js +2 -2
- package/dist/crossfade-UHUQBUVG.js +133 -0
- package/dist/crossfade-UHUQBUVG.js.map +1 -0
- package/dist/date-field.js +27 -22
- package/dist/date-field.js.map +1 -1
- package/dist/date-picker.css +25 -41
- package/dist/date-range-field.js +463 -279
- package/dist/date-range-field.js.map +1 -1
- package/dist/datetime-field.js +28 -23
- package/dist/datetime-field.js.map +1 -1
- package/dist/dialog-sheet.css +31 -0
- package/dist/dialog.css +3 -0
- package/dist/dialog.js +44 -42
- package/dist/dialog.js.map +1 -1
- package/dist/dropdown.css +14 -11
- package/dist/dropdown.js +79 -37
- package/dist/dropdown.js.map +1 -1
- package/dist/emoji-picker.js +22 -21
- package/dist/emoji-picker.js.map +1 -1
- package/dist/flow-field.js +2 -2
- package/dist/glide.js +3 -3
- package/dist/input.css +54 -34
- package/dist/instagram-feed.js +3 -3
- package/dist/lens.js +184 -160
- package/dist/lens.js.map +1 -1
- package/dist/mcp.js +29 -22
- package/dist/menu-surface.css +81 -7
- package/dist/modal.js +11 -10
- package/dist/modal.js.map +1 -1
- package/dist/morphing-text.js +2 -2
- package/dist/motion-devtools.css +6 -5
- package/dist/motion-devtools.js +6 -6
- package/dist/motion-tokens.js +1 -1
- package/dist/motion.js +10 -0
- package/dist/motion.js.map +1 -0
- package/dist/multi-select.js +63 -24
- package/dist/multi-select.js.map +1 -1
- package/dist/number-field.js +122 -75
- package/dist/number-field.js.map +1 -1
- package/dist/odometer.css +27 -16
- package/dist/odometer.js +225 -73
- package/dist/odometer.js.map +1 -1
- package/dist/otp-field.js +49 -12
- package/dist/otp-field.js.map +1 -1
- package/dist/overlay.css +1 -0
- package/dist/pagination.css +1 -1
- package/dist/pagination.js +6 -6
- package/dist/{paint-CJQCM6ZO.js → paint-NLTI6TEF.js} +5 -3
- package/dist/paint-NLTI6TEF.js.map +1 -0
- package/dist/popover.js +12 -11
- package/dist/radio-group.css +9 -6
- package/dist/radio-group.js +9 -8
- package/dist/radio-group.js.map +1 -1
- package/dist/range-sheet-days.css +35 -0
- package/dist/range-sheet.css +80 -0
- package/dist/range-summary.css +67 -0
- package/dist/scroll-area.css +150 -0
- package/dist/scroll-area.js +85 -0
- package/dist/scroll-area.js.map +1 -0
- package/dist/select.css +55 -7
- package/dist/select.js +29 -15
- package/dist/select.js.map +1 -1
- package/dist/sheet.js +12 -11
- package/dist/support-rail.css +2 -2
- package/dist/support-rail.js +17 -15
- package/dist/support-rail.js.map +1 -1
- package/dist/table-detail.css +27 -0
- package/dist/table.css +41 -14
- package/dist/table.js +341 -172
- package/dist/table.js.map +1 -1
- package/dist/tabs.css +32 -13
- package/dist/tabs.js +69 -55
- package/dist/tabs.js.map +1 -1
- package/dist/tag.css +2 -4
- package/dist/tag.js +8 -7
- package/dist/tag.js.map +1 -1
- package/dist/text-field.js +4 -4
- package/dist/textarea.css +26 -41
- package/dist/textarea.js +43 -32
- package/dist/textarea.js.map +1 -1
- package/dist/theme-grid.js +8 -7
- package/dist/theme-switcher.js +19 -18
- package/dist/theme-switcher.js.map +1 -1
- package/dist/{theme-transition-VGLPZDJI.js → theme-transition-F3CBENM5.js} +29 -9
- package/dist/theme-transition-F3CBENM5.js.map +1 -0
- package/dist/theme-transition.css +49 -0
- package/dist/theme.js +5 -4
- package/dist/theme.js.map +1 -1
- package/dist/tide-AGGMQEJV.js +4 -0
- package/dist/tide-AGGMQEJV.js.map +1 -0
- package/dist/tiktok.js +3 -3
- package/dist/time-field.js +15 -8
- package/dist/time-field.js.map +1 -1
- package/dist/toast.css +1 -1
- package/dist/toast.js +11 -10
- package/dist/toast.js.map +1 -1
- package/dist/toggle-tag.js +2 -2
- package/dist/toggle-tag.js.map +1 -1
- package/dist/toggle.css +0 -1
- package/dist/toggle.js +4 -15
- package/dist/toggle.js.map +1 -1
- package/dist/tooltip.css +1 -1
- package/dist/tooltip.js +22 -17
- package/dist/tooltip.js.map +1 -1
- package/dist/trigger.css +0 -1
- package/dist/types/components/composites/combobox/Combobox.d.ts +51 -0
- package/dist/types/components/composites/combobox/caret.d.ts +8 -0
- package/dist/types/components/composites/combobox/use-combobox.d.ts +52 -0
- package/dist/types/components/composites/date-picker/DateField.d.ts +1 -1
- package/dist/types/components/composites/date-picker/DateRangeField.d.ts +6 -3
- package/dist/types/components/composites/date-picker/DateTimeField.d.ts +1 -1
- package/dist/types/components/composites/date-picker/TimeField.d.ts +1 -1
- package/dist/types/components/composites/date-picker/date-utils.d.ts +2 -0
- package/dist/types/components/composites/date-picker/field-shell.d.ts +8 -1
- package/dist/types/components/composites/date-picker/month-swipe.d.ts +3 -0
- package/dist/types/components/composites/date-picker/range-day.d.ts +11 -0
- package/dist/types/components/composites/date-picker/range-month.d.ts +14 -0
- package/dist/types/components/composites/date-picker/range-panel.d.ts +4 -18
- package/dist/types/components/composites/date-picker/range-presets.d.ts +24 -0
- package/dist/types/components/composites/date-picker/range-sheet.d.ts +12 -0
- package/dist/types/components/composites/date-picker/range-summary.d.ts +9 -0
- package/dist/types/components/composites/date-picker/typed-key.d.ts +3 -0
- package/dist/types/components/composites/date-picker/use-month-view.d.ts +14 -0
- package/dist/types/components/composites/date-picker/use-range-panel.d.ts +44 -0
- package/dist/types/components/composites/dialog/Dialog.d.ts +3 -2
- package/dist/types/components/composites/dialog/surface.d.ts +17 -0
- package/dist/types/components/composites/dropdown/Dropdown.d.ts +21 -4
- package/dist/types/components/composites/dropdown/types.d.ts +9 -3
- package/dist/types/components/composites/scroll-area/ScrollArea.d.ts +29 -0
- package/dist/types/components/composites/select/MultiSelect.d.ts +31 -5
- package/dist/types/components/composites/select/Select.d.ts +20 -4
- package/dist/types/components/composites/select/core/index.d.ts +2 -1
- package/dist/types/components/composites/select/core/menu.d.ts +10 -5
- package/dist/types/components/composites/select/core/panel.d.ts +7 -4
- package/dist/types/components/composites/select/core/trigger.d.ts +7 -2
- package/dist/types/components/composites/select/core/types.d.ts +9 -0
- package/dist/types/components/composites/select/core/use-listbox.d.ts +8 -6
- package/dist/types/components/composites/select/presets.d.ts +17 -0
- package/dist/types/components/composites/table/Table.d.ts +3 -74
- package/dist/types/components/composites/table/body.d.ts +15 -0
- package/dist/types/components/composites/table/detail.d.ts +24 -0
- package/dist/types/components/composites/table/head.d.ts +16 -0
- package/dist/types/components/composites/table/types.d.ts +86 -0
- package/dist/types/components/composites/table/use-scroller.d.ts +12 -0
- package/dist/types/components/composites/table/use-table-state.d.ts +16 -0
- package/dist/types/components/composites/tabs/Tabs.d.ts +4 -69
- package/dist/types/components/composites/tabs/tab-panel.d.ts +26 -0
- package/dist/types/components/composites/tabs/types.d.ts +48 -0
- package/dist/types/components/composites/tabs/use-ink.d.ts +5 -0
- package/dist/types/components/composites/tooltip/Tooltip.d.ts +1 -1
- package/dist/types/components/compound/support-rail/SupportRail.d.ts +1 -1
- package/dist/types/components/expressive/lens/Lens.d.ts +1 -1
- package/dist/types/components/expressive/lens/input.d.ts +2 -0
- package/dist/types/components/expressive/lens/optics.d.ts +37 -0
- package/dist/types/components/expressive/lens/paint.d.ts +2 -0
- package/dist/types/components/expressive/lens/use-lens.d.ts +10 -0
- package/dist/types/components/expressive/odometer/Odometer.d.ts +1 -1
- package/dist/types/components/expressive/odometer/roll.d.ts +18 -0
- package/dist/types/components/expressive/odometer/spring.d.ts +11 -0
- package/dist/types/components/expressive/theme-transition/scene.d.ts +3 -0
- package/dist/types/components/internal/hooks/use-hold-repeat.d.ts +8 -0
- package/dist/types/components/internal/icon/Icon.d.ts +2 -0
- package/dist/types/components/internal/menu/highlight.d.ts +9 -1
- package/dist/types/components/internal/menu/menu-row.d.ts +4 -0
- package/dist/types/components/internal/menu/use-anchor-width.d.ts +2 -0
- package/dist/types/components/internal/overlay/layer.d.ts +5 -8
- package/dist/types/components/internal/overlay/track-anchor.d.ts +5 -0
- package/dist/types/components/internal/support/types.d.ts +1 -1
- package/dist/types/components/internal/utils/activation.d.ts +1 -0
- package/dist/types/components/primitives/badge/Badge.d.ts +17 -8
- package/dist/types/components/primitives/badge/morph-label.d.ts +3 -0
- package/dist/types/components/primitives/badge/use-glint-on-change.d.ts +2 -0
- package/dist/types/components/primitives/button/Button.d.ts +4 -8
- package/dist/types/components/primitives/button/button-style.d.ts +8 -4
- package/dist/types/components/primitives/collapse/Collapse.d.ts +3 -2
- package/dist/types/components/primitives/input/NumberField.d.ts +1 -1
- package/dist/types/components/primitives/input/OtpField.d.ts +7 -3
- package/dist/types/components/primitives/input/TextField.d.ts +1 -1
- package/dist/types/components/primitives/input/field-chrome.d.ts +2 -1
- package/dist/types/components/primitives/input/use-number-value.d.ts +16 -0
- package/dist/types/components/primitives/tag/Tag.d.ts +1 -1
- package/dist/types/components/primitives/tag/ToggleTag.d.ts +2 -2
- package/dist/types/components/primitives/textarea/Textarea.d.ts +5 -3
- package/dist/types/components/primitives/textarea/char-meter.d.ts +6 -0
- package/dist/types/components/primitives/toggle/switch-glyph.d.ts +6 -0
- package/dist/types/engine/flip.d.ts +3 -1
- package/dist/types/engine/index.d.ts +2 -2
- package/dist/types/engine/loop.d.ts +5 -2
- package/dist/types/motion/before-paint.d.ts +4 -0
- package/dist/types/motion/crossfade.d.ts +4 -0
- package/dist/types/motion/element.d.ts +16 -4
- package/dist/types/motion/flip.d.ts +12 -3
- package/dist/types/motion/holders.d.ts +4 -0
- package/dist/types/motion/motion.d.ts +7 -0
- package/dist/types/motion/use-motion.d.ts +3 -1
- package/dist/types/theme-scope.d.ts +5 -0
- package/dist/types/tokens/component-styles.generated.d.ts +0 -2
- package/dist/types/tokens/motion-defaults.generated.d.ts +2 -0
- package/dist/types/tokens/motion-scale.d.ts +18 -15
- package/dist/types/tokens/motion-tokens.d.ts +1 -1
- package/dist/types/tokens/theme-store.d.ts +4 -4
- package/dist/types/tokens/theme-tokens.generated.d.ts +77 -59
- package/dist/types/tokens/theme.d.ts +1 -1
- package/dist/typing-lines.js +2 -2
- package/dist/youtube.js +3 -3
- package/package.json +16 -11
- package/skills/zyncat-ui/SKILL.md +8 -8
- package/skills/zyncat-ui/references/components.md +6 -5
- package/skills/zyncat-ui/references/recipes.md +1 -1
- package/skills/zyncat-ui/references/theming.md +3 -3
- package/src/components/composites/combobox/Combobox.tsx +100 -0
- package/src/components/composites/combobox/Combobox.usage.md +32 -0
- package/src/components/composites/combobox/caret.ts +41 -0
- package/src/components/composites/combobox/combobox.css +7 -0
- package/src/components/composites/combobox/use-combobox.ts +112 -0
- package/src/components/composites/date-picker/DateField.tsx +4 -0
- package/src/components/composites/date-picker/DateRangeField.tsx +15 -18
- package/src/components/composites/date-picker/DateTimeField.tsx +4 -0
- package/src/components/composites/date-picker/TimeField.tsx +12 -4
- package/src/components/composites/date-picker/date-picker.css +25 -41
- package/src/components/composites/date-picker/date-utils.ts +4 -0
- package/src/components/composites/date-picker/field-shell.tsx +45 -8
- package/src/components/composites/date-picker/month-swipe.ts +41 -0
- package/src/components/composites/date-picker/range-day.tsx +112 -0
- package/src/components/composites/date-picker/range-month.tsx +79 -0
- package/src/components/composites/date-picker/range-panel.tsx +30 -356
- package/src/components/composites/date-picker/range-presets.tsx +104 -0
- package/src/components/composites/date-picker/range-sheet-days.css +35 -0
- package/src/components/composites/date-picker/range-sheet.css +80 -0
- package/src/components/composites/date-picker/range-sheet.tsx +72 -0
- package/src/components/composites/date-picker/range-summary.css +67 -0
- package/src/components/composites/date-picker/range-summary.tsx +69 -0
- package/src/components/composites/date-picker/time-core.tsx +23 -17
- package/src/components/composites/date-picker/typed-key.ts +9 -0
- package/src/components/composites/date-picker/use-month-view.ts +32 -0
- package/src/components/composites/date-picker/use-range-panel.ts +145 -0
- package/src/components/composites/dialog/Dialog.tsx +28 -110
- package/src/components/composites/dialog/dialog-sheet.css +31 -0
- package/src/components/composites/dialog/dialog.css +3 -0
- package/src/components/composites/dialog/surface.tsx +93 -0
- package/src/components/composites/dropdown/Dropdown.tsx +49 -7
- package/src/components/composites/dropdown/Dropdown.usage.md +2 -0
- package/src/components/composites/dropdown/dropdown.css +14 -11
- package/src/components/composites/dropdown/menu-panel.tsx +49 -26
- package/src/components/composites/dropdown/types.ts +9 -3
- package/src/components/composites/pagination/pagination.css +1 -1
- package/src/components/composites/scroll-area/ScrollArea.tsx +114 -0
- package/src/components/composites/scroll-area/ScrollArea.usage.md +28 -0
- package/src/components/composites/scroll-area/scroll-area.css +150 -0
- package/src/components/composites/select/MultiSelect.tsx +71 -12
- package/src/components/composites/select/MultiSelect.usage.md +10 -0
- package/src/components/composites/select/Select.tsx +32 -2
- package/src/components/composites/select/Select.usage.md +13 -1
- package/src/components/composites/select/core/index.ts +2 -1
- package/src/components/composites/select/core/menu.tsx +34 -17
- package/src/components/composites/select/core/panel.tsx +62 -55
- package/src/components/composites/select/core/trigger.tsx +44 -13
- package/src/components/composites/select/core/types.ts +10 -0
- package/src/components/composites/select/core/use-listbox.ts +91 -38
- package/src/components/composites/select/presets.tsx +47 -0
- package/src/components/composites/select/select.css +55 -7
- package/src/components/composites/sheet/use-sheet-drag.ts +13 -0
- package/src/components/composites/table/Table.tsx +65 -305
- package/src/components/composites/table/Table.usage.md +19 -2
- package/src/components/composites/table/body.tsx +147 -0
- package/src/components/composites/table/detail.tsx +76 -0
- package/src/components/composites/table/head.tsx +90 -0
- package/src/components/composites/table/table-detail.css +27 -0
- package/src/components/composites/table/table.css +41 -14
- package/src/components/composites/table/types.ts +97 -0
- package/src/components/composites/table/use-scroller.ts +53 -0
- package/src/components/composites/table/use-table-state.ts +98 -0
- package/src/components/composites/tabs/Tabs.tsx +23 -188
- package/src/components/composites/tabs/tab-panel.tsx +63 -0
- package/src/components/composites/tabs/tabs.css +32 -13
- package/src/components/composites/tabs/types.ts +51 -0
- package/src/components/composites/tabs/use-ink.ts +87 -0
- package/src/components/composites/toast/toast.css +1 -1
- package/src/components/composites/tooltip/Tooltip.tsx +6 -5
- package/src/components/composites/tooltip/tooltip-host.tsx +10 -6
- package/src/components/composites/tooltip/tooltip.css +1 -1
- package/src/components/compound/support-rail/SupportRail.tsx +3 -2
- package/src/components/compound/support-rail/support-rail.css +2 -2
- package/src/components/dev/motion-devtools.css +6 -5
- package/src/components/expressive/lens/Lens.tsx +11 -368
- package/src/components/expressive/lens/input.ts +91 -0
- package/src/components/expressive/lens/optics.ts +119 -0
- package/src/components/expressive/lens/paint.ts +60 -0
- package/src/components/expressive/lens/use-lens.ts +121 -0
- package/src/components/expressive/odometer/Odometer.tsx +78 -99
- package/src/components/expressive/odometer/Odometer.usage.md +2 -2
- package/src/components/expressive/odometer/odometer.css +27 -16
- package/src/components/expressive/odometer/roll.ts +139 -0
- package/src/components/expressive/odometer/spring.ts +86 -0
- package/src/components/expressive/theme-transition/bloom.ts +22 -2
- package/src/components/expressive/theme-transition/paint.ts +2 -0
- package/src/components/expressive/theme-transition/scene.ts +3 -0
- package/src/components/expressive/theme-transition/theme-transition.css +49 -0
- package/src/components/expressive/theme-transition/theme-transition.ts +21 -1
- package/src/components/expressive/theme-transition/tide.ts +15 -10
- package/src/components/internal/hooks/use-hold-repeat.ts +43 -0
- package/src/components/internal/hooks/use-scroll-edges.ts +6 -1
- package/src/components/internal/icon/Icon.tsx +4 -0
- package/src/components/internal/menu/highlight.ts +20 -2
- package/src/components/internal/menu/menu-row.tsx +36 -8
- package/src/components/internal/menu/menu-surface.css +81 -7
- package/src/components/internal/menu/use-anchor-width.ts +26 -0
- package/src/components/internal/overlay/layer.tsx +11 -23
- package/src/components/internal/overlay/overlay.css +1 -0
- package/src/components/internal/overlay/position.ts +17 -6
- package/src/components/internal/overlay/track-anchor.ts +69 -0
- package/src/components/internal/overlay/trigger.css +0 -1
- package/src/components/internal/support/types.ts +1 -1
- package/src/components/internal/utils/activation.ts +7 -2
- package/src/components/primitives/avatar/avatar.css +1 -1
- package/src/components/primitives/badge/Badge.tsx +38 -15
- package/src/components/primitives/badge/Badge.usage.md +12 -5
- package/src/components/primitives/badge/badge.css +20 -11
- package/src/components/primitives/badge/morph-label.tsx +71 -0
- package/src/components/primitives/badge/use-glint-on-change.ts +16 -0
- package/src/components/primitives/button/Button.tsx +5 -8
- package/src/components/primitives/button/Button.usage.md +5 -4
- package/src/components/primitives/button/button-style.ts +11 -5
- package/src/components/primitives/button/button.css +24 -27
- package/src/components/primitives/checkbox/checkbox.css +0 -1
- package/src/components/primitives/collapse/Collapse.tsx +3 -2
- package/src/components/primitives/input/NumberField.tsx +38 -46
- package/src/components/primitives/input/OtpField.tsx +52 -11
- package/src/components/primitives/input/OtpField.usage.md +2 -1
- package/src/components/primitives/input/TextField.tsx +5 -3
- package/src/components/primitives/input/field-chrome.tsx +3 -2
- package/src/components/primitives/input/input.css +54 -34
- package/src/components/primitives/input/use-number-value.ts +38 -0
- package/src/components/primitives/radio-group/radio-group.css +9 -6
- package/src/components/primitives/tag/Tag.tsx +1 -1
- package/src/components/primitives/tag/ToggleTag.tsx +2 -2
- package/src/components/primitives/tag/tag.css +2 -4
- package/src/components/primitives/textarea/Textarea.tsx +44 -30
- package/src/components/primitives/textarea/char-meter.tsx +19 -0
- package/src/components/primitives/textarea/textarea.css +26 -41
- package/src/components/primitives/toggle/Toggle.tsx +3 -12
- package/src/components/primitives/toggle/switch-glyph.tsx +25 -0
- package/src/components/primitives/toggle/toggle.css +0 -1
- package/src/engine/animate.ts +5 -3
- package/src/engine/flip.ts +28 -4
- package/src/engine/index.ts +2 -2
- package/src/engine/loop.ts +17 -6
- package/src/mcp/server.ts +30 -20
- package/src/motion/before-paint.ts +15 -0
- package/src/motion/crossfade.ts +143 -0
- package/src/motion/element.tsx +29 -8
- package/src/motion/flip.ts +102 -31
- package/src/motion/glide.tsx +5 -0
- package/src/motion/holders.ts +10 -0
- package/src/motion/motion.ts +7 -0
- package/src/motion/motion.usage.md +34 -0
- package/src/motion/presence.tsx +22 -9
- package/src/motion/use-motion.ts +45 -6
- package/src/theme-scope.ts +19 -0
- package/src/tokens/base.css +7 -5
- package/src/tokens/color.css +17 -15
- package/src/tokens/component-styles.generated.ts +0 -2
- package/src/tokens/dark.css +8 -5
- package/src/tokens/decisions.css +5 -3
- package/src/tokens/motion-defaults.generated.ts +15 -8
- package/src/tokens/motion-scale.ts +18 -15
- package/src/tokens/motion-tokens.ts +4 -4
- package/src/tokens/motion.css +19 -11
- package/src/tokens/reset.css +1 -0
- package/src/tokens/semantic.css +20 -14
- package/src/tokens/spacing.css +5 -3
- package/src/tokens/theme-store.ts +4 -4
- package/src/tokens/theme-sync.tsx +4 -2
- package/src/tokens/theme-tokens.generated.ts +78 -59
- package/src/tokens/theme.tsx +1 -1
- package/tailwind.css +6 -0
- package/dist/bloom-HV23M4AW.js.map +0 -1
- package/dist/chunk-2DNKZ57E.js +0 -72
- package/dist/chunk-2DNKZ57E.js.map +0 -1
- package/dist/chunk-6H3IJ752.js.map +0 -1
- package/dist/chunk-7NHY2CRA.js.map +0 -1
- package/dist/chunk-AIAPXRCI.js.map +0 -1
- package/dist/chunk-BRKGYLEQ.js.map +0 -1
- package/dist/chunk-F64Z42PJ.js.map +0 -1
- package/dist/chunk-JINATP4N.js.map +0 -1
- package/dist/chunk-KSAJ6DED.js +0 -16
- package/dist/chunk-KSAJ6DED.js.map +0 -1
- package/dist/chunk-LNAV5E7S.js.map +0 -1
- package/dist/chunk-N43NDSME.js.map +0 -1
- package/dist/chunk-ODRO3KS6.js.map +0 -1
- package/dist/chunk-PXQBJMPJ.js.map +0 -1
- package/dist/chunk-QDAN43B6.js.map +0 -1
- package/dist/chunk-RJENXXTI.js +0 -93
- package/dist/chunk-RJENXXTI.js.map +0 -1
- package/dist/chunk-RLNCRDAL.js.map +0 -1
- package/dist/chunk-RW2A4M2Q.js +0 -57
- package/dist/chunk-RW2A4M2Q.js.map +0 -1
- package/dist/chunk-TBLPZQSI.js.map +0 -1
- package/dist/chunk-TDHLZY6I.js.map +0 -1
- package/dist/chunk-UKPX3RIP.js.map +0 -1
- package/dist/chunk-V6QAAOA5.js.map +0 -1
- package/dist/chunk-VDOBLABP.js +0 -38
- package/dist/chunk-VDOBLABP.js.map +0 -1
- package/dist/chunk-VJXP256V.js.map +0 -1
- package/dist/chunk-VQFILXQN.js.map +0 -1
- package/dist/chunk-VZXML7EH.js.map +0 -1
- package/dist/chunk-XKDR22VE.js.map +0 -1
- package/dist/count-badge.js +0 -13
- package/dist/count-badge.js.map +0 -1
- package/dist/paint-CJQCM6ZO.js.map +0 -1
- package/dist/status-badge.js +0 -72
- package/dist/status-badge.js.map +0 -1
- package/dist/theme-transition-VGLPZDJI.js.map +0 -1
- package/dist/tide-DJZMDAFT.js.map +0 -1
- package/dist/types/components/primitives/badge/CountBadge.d.ts +0 -8
- package/dist/types/components/primitives/badge/StatusBadge.d.ts +0 -15
- package/src/components/primitives/badge/CountBadge.tsx +0 -20
- package/src/components/primitives/badge/CountBadge.usage.md +0 -13
- package/src/components/primitives/badge/StatusBadge.tsx +0 -113
- package/src/components/primitives/badge/StatusBadge.usage.md +0 -14
package/src/motion/flip.ts
CHANGED
|
@@ -1,79 +1,150 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import { useLayoutEffect, useRef, type RefObject } from 'react';
|
|
3
|
+
import { useLayoutEffect, useRef, type EffectCallback, type RefObject } from 'react';
|
|
4
4
|
|
|
5
5
|
import {
|
|
6
|
+
animate,
|
|
6
7
|
dropShared,
|
|
7
|
-
flip,
|
|
8
8
|
keepShared,
|
|
9
9
|
measure,
|
|
10
|
+
offscreen,
|
|
10
11
|
readShared,
|
|
11
12
|
type Box,
|
|
12
13
|
type FlipOptions,
|
|
13
14
|
type Playback,
|
|
14
15
|
} from '../engine';
|
|
15
|
-
import {
|
|
16
|
+
import { flipLayers } from '../engine/flip';
|
|
16
17
|
import { UIMotion } from '../tokens/motion-tokens';
|
|
18
|
+
import { beforePaint } from './before-paint';
|
|
19
|
+
import { leaving, measureHolders, sharedOwner } from './holders';
|
|
17
20
|
|
|
18
|
-
export
|
|
21
|
+
export interface FlipTuning extends FlipOptions {
|
|
22
|
+
/** Keep the element that last held the `layoutId` on screen through the handoff: a copy of it takes the same path and fades out while this one fades in. */
|
|
23
|
+
crossfade?: boolean;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const SAME_BOX_PX = 0.5;
|
|
27
|
+
|
|
28
|
+
let loadedCrossfade: typeof import('./crossfade') | null = null;
|
|
19
29
|
|
|
20
|
-
const
|
|
30
|
+
const loadCrossfade = (): void => {
|
|
31
|
+
if (!loadedCrossfade) void import('./crossfade').then((module) => (loadedCrossfade = module));
|
|
32
|
+
};
|
|
21
33
|
|
|
22
34
|
const usable = (box: Box | null): box is Box => !!box && box.width > 0 && box.height > 0;
|
|
23
35
|
|
|
36
|
+
const sameBox = (a: Box, b: Box): boolean =>
|
|
37
|
+
(['left', 'top', 'width', 'height'] as const).every((side) => Math.abs(a[side] - b[side]) < SAME_BOX_PX);
|
|
38
|
+
|
|
24
39
|
export function useFlip<T extends HTMLElement>(
|
|
25
40
|
sharedId: string | null,
|
|
26
|
-
tuning: FlipTuning = {},
|
|
27
|
-
|
|
28
|
-
): RefObject<T | null
|
|
41
|
+
tuning: FlipTuning & { offscreenMargin?: number } = {},
|
|
42
|
+
inPlace: boolean,
|
|
43
|
+
): { ref: RefObject<T | null>; play: EffectCallback; snapshot: () => void } {
|
|
29
44
|
const ref = useRef<T | null>(null);
|
|
45
|
+
const lastCommitted = useRef<Box | null>(null);
|
|
30
46
|
const playing = useRef<{ play: Playback; el: T } | null>(null);
|
|
47
|
+
const superseded = useRef<Playback | null>(null);
|
|
48
|
+
const queued = useRef<object | null>(null);
|
|
49
|
+
const held = useRef<string | null>(null);
|
|
31
50
|
const interrupted = useRef<Box | null>(null);
|
|
32
|
-
const
|
|
33
|
-
const
|
|
51
|
+
const origin = useRef<Box | null>(null);
|
|
52
|
+
const latest = useRef(tuning);
|
|
53
|
+
latest.current = tuning;
|
|
54
|
+
const { size, timing, crossfade, offscreenMargin } = tuning;
|
|
55
|
+
const enabled = inPlace || sharedId !== null;
|
|
56
|
+
if (enabled) measureHolders();
|
|
57
|
+
const holder = sharedId === null ? undefined : sharedOwner.get(sharedId);
|
|
58
|
+
if (holder && holder !== ref.current && holder.isConnected) leaving.set(holder, measure(holder));
|
|
34
59
|
|
|
35
60
|
useLayoutEffect(() => {
|
|
36
61
|
const el = ref.current;
|
|
37
62
|
if (!el || !enabled) return;
|
|
63
|
+
leaving.clear();
|
|
64
|
+
if (crossfade) loadCrossfade();
|
|
38
65
|
const live = playing.current;
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
66
|
+
const midFlight = live?.el === el;
|
|
67
|
+
const moved = !!lastCommitted.current && !sameBox(lastCommitted.current, measure(el));
|
|
68
|
+
if (midFlight && !moved) return;
|
|
69
|
+
let from = moved ? lastCommitted.current : null;
|
|
70
|
+
if (sharedId !== null && !midFlight) {
|
|
71
|
+
if (interrupted.current) from = interrupted.current;
|
|
72
|
+
else if (sharedOwner.get(sharedId) !== el) from = readShared(sharedId);
|
|
73
|
+
}
|
|
74
|
+
superseded.current = live?.play ?? null;
|
|
75
|
+
playing.current = null;
|
|
76
|
+
interrupted.current = null;
|
|
45
77
|
if (sharedId !== null) {
|
|
46
78
|
keepShared(sharedId, measure(el));
|
|
47
79
|
sharedOwner.set(sharedId, el);
|
|
48
80
|
}
|
|
49
|
-
|
|
50
|
-
playing.current = next ? { play: next, el } : null;
|
|
51
|
-
interrupted.current = next ? from : null;
|
|
52
|
-
next?.finished.then(() => {
|
|
53
|
-
if (playing.current?.play === next) {
|
|
54
|
-
playing.current = null;
|
|
55
|
-
interrupted.current = null;
|
|
56
|
-
}
|
|
57
|
-
});
|
|
81
|
+
origin.current ??= from;
|
|
58
82
|
});
|
|
59
83
|
|
|
60
84
|
useLayoutEffect(() => {
|
|
61
|
-
if (
|
|
85
|
+
if (sharedId === null) return;
|
|
86
|
+
held.current = sharedId;
|
|
62
87
|
return () => {
|
|
88
|
+
held.current = null;
|
|
63
89
|
const live = playing.current;
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
playing.current = null;
|
|
90
|
+
measureHolders();
|
|
91
|
+
let box: Box | null = (ref.current && leaving.get(ref.current)) ?? (live ? measure(live.el) : null);
|
|
67
92
|
if (!usable(box)) box = ref.current ? measure(ref.current) : null;
|
|
93
|
+
const painted = !origin.current;
|
|
94
|
+
if (painted && latest.current.crossfade && loadedCrossfade && ref.current && usable(box) && !UIMotion.reduced)
|
|
95
|
+
loadedCrossfade.keep(sharedId, ref.current, box, latest.current.timing, latest.current.offscreenMargin);
|
|
68
96
|
if (usable(box)) keepShared(sharedId, box);
|
|
69
97
|
const mine = readShared(sharedId);
|
|
70
98
|
queueMicrotask(() => {
|
|
99
|
+
if (held.current === sharedId) return;
|
|
100
|
+
if (live && !live.el.isConnected) live.play.stop();
|
|
71
101
|
if (readShared(sharedId) === mine) dropShared(sharedId);
|
|
72
102
|
const owner = sharedOwner.get(sharedId);
|
|
73
103
|
if (owner && !owner.isConnected) sharedOwner.delete(sharedId);
|
|
74
104
|
});
|
|
75
105
|
};
|
|
76
|
-
}, [sharedId
|
|
106
|
+
}, [sharedId]);
|
|
107
|
+
|
|
108
|
+
const play = () => {
|
|
109
|
+
const stale = superseded.current;
|
|
110
|
+
superseded.current = null;
|
|
111
|
+
if (!origin.current && !stale) return;
|
|
112
|
+
const job = {};
|
|
113
|
+
queued.current = job;
|
|
114
|
+
beforePaint(() => {
|
|
115
|
+
if (queued.current !== job) return;
|
|
116
|
+
const el = ref.current;
|
|
117
|
+
const from = origin.current;
|
|
118
|
+
origin.current = null;
|
|
119
|
+
if (!el || !usable(from) || UIMotion.reduced) return;
|
|
120
|
+
const to = measure(el);
|
|
121
|
+
if (offscreen(offscreenMargin, from, to)) return;
|
|
122
|
+
const layers = flipLayers(el, from, to, { size, timing });
|
|
123
|
+
return () => {
|
|
124
|
+
const handoff =
|
|
125
|
+
sharedId !== null && crossfade && loadedCrossfade
|
|
126
|
+
? loadedCrossfade.play(sharedId, el, from, { timing })
|
|
127
|
+
: undefined;
|
|
128
|
+
const next = handoff === undefined ? layers && animate(el, ...layers) : handoff;
|
|
129
|
+
if (!next) return;
|
|
130
|
+
playing.current = { play: next, el };
|
|
131
|
+
interrupted.current = from;
|
|
132
|
+
next.finished.then(() => {
|
|
133
|
+
if (playing.current?.play === next) {
|
|
134
|
+
playing.current = null;
|
|
135
|
+
interrupted.current = null;
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
};
|
|
139
|
+
}, stale?.stop);
|
|
140
|
+
return () => {
|
|
141
|
+
queued.current = null;
|
|
142
|
+
};
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
const snapshot = () => {
|
|
146
|
+
lastCommitted.current = ref.current && (inPlace || playing.current) ? measure(ref.current) : null;
|
|
147
|
+
};
|
|
77
148
|
|
|
78
|
-
return ref;
|
|
149
|
+
return { ref, play, snapshot };
|
|
79
150
|
}
|
package/src/motion/glide.tsx
CHANGED
|
@@ -28,6 +28,7 @@ function layoutBox(target: HTMLElement, container: HTMLElement): Box | null {
|
|
|
28
28
|
export function useGlide<T extends HTMLElement>(containerRef: RefObject<T | null>) {
|
|
29
29
|
const ref = useRef<HTMLSpanElement | null>(null);
|
|
30
30
|
const visible = useRef(false);
|
|
31
|
+
const tracked = useRef<HTMLElement | null>(null);
|
|
31
32
|
|
|
32
33
|
const enter = useCallback(
|
|
33
34
|
(target: HTMLElement | null) => {
|
|
@@ -38,7 +39,10 @@ export function useGlide<T extends HTMLElement>(containerRef: RefObject<T | null
|
|
|
38
39
|
if (!at) return;
|
|
39
40
|
const motion = motionFor(box);
|
|
40
41
|
const was = measure(pill);
|
|
42
|
+
const arrived = tracked.current !== target;
|
|
43
|
+
tracked.current = target;
|
|
41
44
|
set(pill, { x: [at.left], y: [at.top], width: [at.width], height: [at.height] });
|
|
45
|
+
if (!arrived) return;
|
|
42
46
|
animate(pill, { opacity: [1], timing: { duration: motion.dur.fast, ease: motion.ease.standard } });
|
|
43
47
|
const glided = visible.current && !motion.reduced && was.width > 0 && was.height > 0;
|
|
44
48
|
visible.current = true;
|
|
@@ -49,6 +53,7 @@ export function useGlide<T extends HTMLElement>(containerRef: RefObject<T | null
|
|
|
49
53
|
|
|
50
54
|
const leave = useCallback(() => {
|
|
51
55
|
visible.current = false;
|
|
56
|
+
tracked.current = null;
|
|
52
57
|
if (!ref.current) return;
|
|
53
58
|
const motion = motionFor(containerRef.current);
|
|
54
59
|
animate(ref.current, { opacity: [0], timing: { duration: motion.dur.fast, ease: motion.ease.exit } });
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { measure, type Box } from '../engine';
|
|
2
|
+
import { sharedSlot } from '../shared-slot';
|
|
3
|
+
|
|
4
|
+
export const sharedOwner = sharedSlot('motion.flip-owner@1', () => new Map<string, HTMLElement>());
|
|
5
|
+
export const leaving = sharedSlot('motion.flip-leaving@1', () => new Map<HTMLElement, Box>());
|
|
6
|
+
|
|
7
|
+
export function measureHolders(): void {
|
|
8
|
+
if (leaving.size || !sharedOwner.size) return;
|
|
9
|
+
for (const holder of sharedOwner.values()) if (holder.isConnected) leaving.set(holder, measure(holder));
|
|
10
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export type { Layer, Playback } from '../engine';
|
|
2
|
+
export { Motion, type MotionProps } from './element';
|
|
3
|
+
export type { FlipTuning } from './flip';
|
|
4
|
+
export { usePresence, type PresenceState } from './presence-context';
|
|
5
|
+
export { Presence, type PresenceProps } from './presence';
|
|
6
|
+
export { popIn, popOut, slideIn } from './presets';
|
|
7
|
+
export { useMotion, type MotionSpec, type MotionSpecs, type Plays } from './use-motion';
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# Motion / Presence - @zyncat/ui/motion
|
|
2
|
+
|
|
3
|
+
Group: primitives
|
|
4
|
+
|
|
5
|
+
The React layer over the engine: animate an element you render, and hold a leaving one mounted until its exit finishes.
|
|
6
|
+
|
|
7
|
+
`<Motion>` renders the tag in `as` and plays `animate` on mount, then again whenever `deps` change.
|
|
8
|
+
`exit` plays when a parent `<Presence>` drops the child, which stays mounted until it finishes - a
|
|
9
|
+
child with no `exit` is dropped at once. `layout` and `layoutId` FLIP the box from where it last was
|
|
10
|
+
instead of animating a value. Every spec is a `Layer`, a `Layer[]`, or a function returning the
|
|
11
|
+
`Playback`s to wait on.
|
|
12
|
+
|
|
13
|
+
`<Presence>` needs keyed children; `mode="wait"` holds the entering child back until the outgoing one
|
|
14
|
+
has left, and `initial={false}` skips the entrance for children present at its own first paint.
|
|
15
|
+
|
|
16
|
+
`useMotion(ref, specs)` is the same machinery for an element you hold a ref to but do not render.
|
|
17
|
+
`usePresence()` reads whether the current child is leaving. `popIn` / `popOut` / `slideIn` are the
|
|
18
|
+
named presets - feed them `UIMotion.scale` and `UIMotion.dist` from `@zyncat/ui/motion-tokens`, never
|
|
19
|
+
literals.
|
|
20
|
+
|
|
21
|
+
```tsx
|
|
22
|
+
<Presence mode="wait" onExitComplete={clearStep}>
|
|
23
|
+
{step && (
|
|
24
|
+
<Motion
|
|
25
|
+
key={step.id}
|
|
26
|
+
animate={popIn(UIMotion.scale.panel, UIMotion.t.enter)}
|
|
27
|
+
exit={popOut(UIMotion.scale.panel, UIMotion.t.exit)}
|
|
28
|
+
deps={[step.id]}
|
|
29
|
+
>
|
|
30
|
+
{step.body}
|
|
31
|
+
</Motion>
|
|
32
|
+
)}
|
|
33
|
+
</Presence>
|
|
34
|
+
```
|
package/src/motion/presence.tsx
CHANGED
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
type ReactNode,
|
|
13
13
|
} from 'react';
|
|
14
14
|
|
|
15
|
-
import { PresenceContext } from './presence-context';
|
|
15
|
+
import { PresenceContext, type PresenceState } from './presence-context';
|
|
16
16
|
|
|
17
17
|
interface Entry {
|
|
18
18
|
key: string;
|
|
@@ -64,6 +64,7 @@ export function Presence({ children, initial = true, mode = 'sync', onExitComple
|
|
|
64
64
|
const signature = incoming.map((entry) => entry.key).join('|');
|
|
65
65
|
const claims = useRef<Claims>(new Map());
|
|
66
66
|
const latest = useRef<Latest>(new Map());
|
|
67
|
+
const values = useRef({ membership: '', byKey: new Map<string, PresenceState>() });
|
|
67
68
|
for (const entry of incoming) latest.current.set(entry.key, entry.node);
|
|
68
69
|
const [tracked, setTracked] = useState<Tracked>({ shown: incoming, signature });
|
|
69
70
|
const bornAtMount = useRef(new Set(incoming.map((entry) => entry.key)));
|
|
@@ -103,6 +104,10 @@ export function Presence({ children, initial = true, mode = 'sync', onExitComple
|
|
|
103
104
|
|
|
104
105
|
const leaving = shown.some((entry) => entry.exiting);
|
|
105
106
|
|
|
107
|
+
useEffect(() => {
|
|
108
|
+
bornAtMount.current.clear();
|
|
109
|
+
}, []);
|
|
110
|
+
|
|
106
111
|
useEffect(() => {
|
|
107
112
|
if (wasExiting.current && !leaving) complete.current?.();
|
|
108
113
|
wasExiting.current = leaving;
|
|
@@ -111,20 +116,28 @@ export function Presence({ children, initial = true, mode = 'sync', onExitComple
|
|
|
111
116
|
const fresh = new Map(incoming.map((entry) => [entry.key, entry.node]));
|
|
112
117
|
const visible = mode === 'wait' && leaving ? shown.filter((entry) => entry.exiting) : shown;
|
|
113
118
|
|
|
119
|
+
const membership = visible.map((entry) => entry.key).join('|');
|
|
120
|
+
const reflowed = values.current.membership !== membership;
|
|
121
|
+
const priorValues = values.current.byKey;
|
|
122
|
+
values.current = { membership, byKey: new Map() };
|
|
123
|
+
const valueFor = ({ key, exiting }: Entry): PresenceState => {
|
|
124
|
+
const born = initial || !bornAtMount.current.has(key);
|
|
125
|
+
const kept = reflowed ? undefined : priorValues.get(key);
|
|
126
|
+
const value =
|
|
127
|
+
kept?.isPresent === !exiting && kept.initial === born
|
|
128
|
+
? kept
|
|
129
|
+
: { isPresent: !exiting, initial: born, claimExit: claimExit(key) };
|
|
130
|
+
values.current.byKey.set(key, value);
|
|
131
|
+
return value;
|
|
132
|
+
};
|
|
133
|
+
|
|
114
134
|
return createElement(
|
|
115
135
|
Fragment,
|
|
116
136
|
null,
|
|
117
137
|
visible.map((entry) =>
|
|
118
138
|
createElement(
|
|
119
139
|
PresenceContext.Provider,
|
|
120
|
-
{
|
|
121
|
-
key: entry.key,
|
|
122
|
-
value: {
|
|
123
|
-
isPresent: !entry.exiting,
|
|
124
|
-
initial: initial || !bornAtMount.current.has(entry.key),
|
|
125
|
-
claimExit: claimExit(entry.key),
|
|
126
|
-
},
|
|
127
|
-
},
|
|
140
|
+
{ key: entry.key, value: valueFor(entry) },
|
|
128
141
|
fresh.get(entry.key) ?? entry.node,
|
|
129
142
|
),
|
|
130
143
|
),
|
package/src/motion/use-motion.ts
CHANGED
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
import { useLayoutEffect, useRef, type RefObject } from 'react';
|
|
4
4
|
|
|
5
|
-
import { animate, type Layer, type Playback } from '../engine';
|
|
5
|
+
import { animate, measure, offscreen, type Layer, type Playback } from '../engine';
|
|
6
|
+
import { beforePaint } from './before-paint';
|
|
6
7
|
import { usePresence } from './presence-context';
|
|
7
8
|
|
|
8
9
|
export type Plays = Playback | Playback[] | null | undefined | void;
|
|
@@ -16,6 +17,12 @@ export function run(spec: MotionSpec | undefined, el: HTMLElement): Playback[] {
|
|
|
16
17
|
return [Array.isArray(spec) ? animate(el, ...spec) : animate(el, spec)];
|
|
17
18
|
}
|
|
18
19
|
|
|
20
|
+
const landed = (layers: Layer[]): Layer[] =>
|
|
21
|
+
layers.map((layer) => ({ ...layer, timing: { duration: 0, fill: layer.timing?.fill } }));
|
|
22
|
+
|
|
23
|
+
const sameDeps = (a: unknown[], b: unknown[]): boolean =>
|
|
24
|
+
a.length === b.length && a.every((v, i) => Object.is(v, b[i]));
|
|
25
|
+
|
|
19
26
|
const allSettled = (plays: Playback[]): Promise<void> =>
|
|
20
27
|
plays.length ? Promise.all(plays.map((play) => play.finished)).then((): void => {}) : Promise.resolve();
|
|
21
28
|
|
|
@@ -28,13 +35,20 @@ export interface MotionSpecs {
|
|
|
28
35
|
initial?: boolean;
|
|
29
36
|
/** Replay `animate` when these change. Must keep a stable length. @default [] */
|
|
30
37
|
deps?: unknown[];
|
|
38
|
+
/** How far outside the viewport, in px, this element still animates; further out, `animate` and layout moves land on their end state at once. `Infinity` always animates. @default 100 */
|
|
39
|
+
offscreenMargin?: number;
|
|
31
40
|
}
|
|
32
41
|
|
|
33
42
|
/** Drives `<Motion>`; use it directly on elements you hold a ref to but do not render. */
|
|
34
|
-
export function useMotion(
|
|
43
|
+
export function useMotion(
|
|
44
|
+
ref: RefObject<HTMLElement | null>,
|
|
45
|
+
{ animate, exit, initial, deps, offscreenMargin }: MotionSpecs,
|
|
46
|
+
): void {
|
|
35
47
|
const presence = usePresence();
|
|
36
48
|
const playing = useRef<Playback[]>([]);
|
|
49
|
+
const pending = useRef<object | null>(null);
|
|
37
50
|
const mounted = useRef(false);
|
|
51
|
+
const ran = useRef<unknown[] | null>(null);
|
|
38
52
|
const exiting = useRef(false);
|
|
39
53
|
const spec = useRef({ animate, exit, initial });
|
|
40
54
|
spec.current = { animate, exit, initial };
|
|
@@ -42,6 +56,7 @@ export function useMotion(ref: RefObject<HTMLElement | null>, { animate, exit, i
|
|
|
42
56
|
const ownsExit = !!exit;
|
|
43
57
|
|
|
44
58
|
const stop = () => {
|
|
59
|
+
pending.current = null;
|
|
45
60
|
for (const play of playing.current) play.stop();
|
|
46
61
|
playing.current = [];
|
|
47
62
|
};
|
|
@@ -57,12 +72,28 @@ export function useMotion(ref: RefObject<HTMLElement | null>, { animate, exit, i
|
|
|
57
72
|
|
|
58
73
|
useLayoutEffect(() => {
|
|
59
74
|
const el = ref.current;
|
|
60
|
-
const atMount = !mounted.current;
|
|
61
|
-
mounted.current = true;
|
|
62
75
|
if (!el) return;
|
|
76
|
+
const current = deps ?? [];
|
|
77
|
+
const previous = ran.current;
|
|
78
|
+
ran.current = current;
|
|
79
|
+
const atMount = !previous || sameDeps(previous, current);
|
|
80
|
+
if (previous && atMount && (pending.current || playing.current.length)) return;
|
|
63
81
|
if (atMount && (spec.current.initial ?? presence.initial) === false) return;
|
|
64
82
|
stop();
|
|
65
|
-
|
|
83
|
+
const animation = spec.current.animate;
|
|
84
|
+
if (!animation || typeof animation === 'function') {
|
|
85
|
+
playing.current = run(animation, el);
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
const token = {};
|
|
89
|
+
pending.current = token;
|
|
90
|
+
beforePaint(() => {
|
|
91
|
+
if (pending.current !== token) return;
|
|
92
|
+
const layers = offscreen(offscreenMargin, measure(el)) ? landed([animation].flat()) : animation;
|
|
93
|
+
return () => {
|
|
94
|
+
playing.current = run(layers, el);
|
|
95
|
+
};
|
|
96
|
+
});
|
|
66
97
|
}, deps ?? []); // eslint-disable-line react-hooks/exhaustive-deps
|
|
67
98
|
|
|
68
99
|
useLayoutEffect(() => {
|
|
@@ -84,5 +115,13 @@ export function useMotion(ref: RefObject<HTMLElement | null>, { animate, exit, i
|
|
|
84
115
|
});
|
|
85
116
|
}, [presence.isPresent]); // eslint-disable-line react-hooks/exhaustive-deps
|
|
86
117
|
|
|
87
|
-
useLayoutEffect(() =>
|
|
118
|
+
useLayoutEffect(() => {
|
|
119
|
+
mounted.current = true;
|
|
120
|
+
return () => {
|
|
121
|
+
mounted.current = false;
|
|
122
|
+
queueMicrotask(() => {
|
|
123
|
+
if (!mounted.current) stop();
|
|
124
|
+
});
|
|
125
|
+
};
|
|
126
|
+
}, []);
|
|
88
127
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
const nearestTheme = (el: Element | null | undefined, attr: string): string | null =>
|
|
2
|
+
el?.closest(`[${attr}]`)?.getAttribute(attr) ?? null;
|
|
3
|
+
|
|
4
|
+
const themeDifferingFromPage = (scope: Element | null | undefined, attr: string): string | undefined => {
|
|
5
|
+
const own = nearestTheme(scope, attr);
|
|
6
|
+
return own !== null && own !== nearestTheme(document.body, attr) ? own : undefined;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export interface InheritedThemeAttrs {
|
|
10
|
+
'data-theme'?: string;
|
|
11
|
+
'data-polarity'?: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export function inheritedThemeAttrs(scope: Element | null | undefined): InheritedThemeAttrs {
|
|
15
|
+
return {
|
|
16
|
+
'data-theme': themeDifferingFromPage(scope, 'data-theme'),
|
|
17
|
+
'data-polarity': themeDifferingFromPage(scope, 'data-polarity'),
|
|
18
|
+
};
|
|
19
|
+
}
|
package/src/tokens/base.css
CHANGED
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
@layer zyncat.reset, zyncat.tokens, zyncat.base, zyncat.components;
|
|
2
2
|
|
|
3
3
|
@layer zyncat.base {
|
|
4
|
-
/* Drives native scrollbars, caret, select popups, and autofill background. */
|
|
5
|
-
:root {
|
|
6
|
-
color-scheme: light dark;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
4
|
/* Only reaches these four; scoped so it stops inheriting everywhere. */
|
|
10
5
|
:where(input[type='checkbox'], input[type='radio'], input[type='range'], progress) {
|
|
11
6
|
accent-color: var(--accent);
|
|
@@ -63,6 +58,13 @@
|
|
|
63
58
|
outline-color: var(--ring-color-accent);
|
|
64
59
|
}
|
|
65
60
|
|
|
61
|
+
/* Both rules above skip tabindex="-1", so a programmatic focus target - a listbox scroller, a menu
|
|
62
|
+
surface, a modal panel - would otherwise fall through to the UA outline. Its indicator is the
|
|
63
|
+
active descendant, not the container. */
|
|
64
|
+
:where([tabindex='-1']):focus {
|
|
65
|
+
outline: none;
|
|
66
|
+
}
|
|
67
|
+
|
|
66
68
|
/* Chrome forces both at paint time, so neither color nor background-color reaches them. */
|
|
67
69
|
:is(:autofill, :-webkit-autofill) {
|
|
68
70
|
-webkit-text-fill-color: var(--text-strong);
|
package/src/tokens/color.css
CHANGED
|
@@ -4,25 +4,27 @@
|
|
|
4
4
|
:root,
|
|
5
5
|
[data-theme],
|
|
6
6
|
[data-polarity] {
|
|
7
|
-
/*
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
--gray-
|
|
11
|
-
--gray-
|
|
12
|
-
--gray-
|
|
13
|
-
--gray-
|
|
14
|
-
--gray-
|
|
15
|
-
--gray-
|
|
16
|
-
--gray-
|
|
17
|
-
--gray-
|
|
18
|
-
--gray-
|
|
19
|
-
--gray-
|
|
20
|
-
--gray-
|
|
7
|
+
/* Stripe's neutral ramp, rung for rung: --neutral is its midpoint, and every step holds that
|
|
8
|
+
hue's distance from it, so a new --neutral carries the whole ramp with it. The top rung is
|
|
9
|
+
pure white - the only rung Stripe leaves untinted. */
|
|
10
|
+
--gray-0: oklch(from var(--neutral) 1 0 h);
|
|
11
|
+
--gray-50: oklch(from var(--neutral) 0.978 0.0034 calc(h - 12.4));
|
|
12
|
+
--gray-100: oklch(from var(--neutral) 0.948 0.0052 calc(h - 12.4));
|
|
13
|
+
--gray-150: oklch(from var(--neutral) 0.889 0.0105 calc(h - 12.3));
|
|
14
|
+
--gray-200: oklch(from var(--neutral) 0.83 0.0165 calc(h - 6.4));
|
|
15
|
+
--gray-300: oklch(from var(--neutral) 0.742 0.0226 calc(h - 1.1));
|
|
16
|
+
--gray-400: oklch(from var(--neutral) 0.651 0.0247 calc(h + 0.4));
|
|
17
|
+
--gray-500: oklch(from var(--neutral) 0.553 0.031 h);
|
|
18
|
+
--gray-600: oklch(from var(--neutral) 0.466 0.0267 calc(h + 11.4));
|
|
19
|
+
--gray-700: oklch(from var(--neutral) 0.392 0.0226 calc(h + 11.6));
|
|
20
|
+
--gray-800: oklch(from var(--neutral) 0.317 0.0214 calc(h + 21.1));
|
|
21
|
+
--gray-900: oklch(from var(--neutral) 0.226 0.0194 calc(h + 20));
|
|
22
|
+
--gray-950: oklch(from var(--neutral) 0.181 0.0185 calc(h + 19.2));
|
|
21
23
|
}
|
|
22
24
|
|
|
23
25
|
:root,
|
|
24
26
|
[data-polarity='light'] {
|
|
25
27
|
/* Cool near-black on the white canvas. */
|
|
26
|
-
--shadow-rgb:
|
|
28
|
+
--shadow-rgb: 16 17 26;
|
|
27
29
|
}
|
|
28
30
|
}
|
|
@@ -109,8 +109,6 @@ export interface OdometerStyle extends CSSProperties {
|
|
|
109
109
|
'--odometer-gap'?: string | number;
|
|
110
110
|
/** `--odometer-ink` - Digit ink. Default: `var(--text-strong)`. */
|
|
111
111
|
'--odometer-ink'?: string | number;
|
|
112
|
-
/** `--odometer-accent` - The tint digits take while they roll fast. Default: `var(--accent)`. */
|
|
113
|
-
'--odometer-accent'?: string | number;
|
|
114
112
|
/** `--odometer-separator-ink` - The thousands separator. Default: `var(--text-muted)`. */
|
|
115
113
|
'--odometer-separator-ink'?: string | number;
|
|
116
114
|
/** `--odometer-size` - Digit size. Default: `var(--size-display)`. */
|
package/src/tokens/dark.css
CHANGED
|
@@ -24,6 +24,9 @@
|
|
|
24
24
|
--border-default: oklch(from var(--neutral) 0.315 0.009 h);
|
|
25
25
|
--border-strong: oklch(from var(--neutral) 0.4 0.011 h);
|
|
26
26
|
|
|
27
|
+
--bg-hover: color-mix(in oklab, var(--text-secondary) 6%, transparent);
|
|
28
|
+
--bg-press: color-mix(in oklab, var(--text-secondary) 10%, transparent);
|
|
29
|
+
|
|
27
30
|
--shadow-rgb: 0 0 0;
|
|
28
31
|
--shadow-strength: 3.5;
|
|
29
32
|
--sheen-strength: 0.2;
|
|
@@ -31,15 +34,15 @@
|
|
|
31
34
|
|
|
32
35
|
/* A light face reads as a light source on dark, so the fills drop a step while the lift stays put. */
|
|
33
36
|
--accent-fill: oklch(from var(--accent) calc(l - 0.06) calc(c - 0.01) h);
|
|
34
|
-
--accent-subtle: oklch(from var(--accent) 0.27 0.045 h);
|
|
35
|
-
--accent-border: oklch(from var(--accent) 0.45 0.09 h);
|
|
36
|
-
--accent-disabled: oklch(from var(--accent) 0.42 0.06 h);
|
|
37
|
+
--accent-subtle: oklch(from var(--accent) 0.27 min(c, 0.045) h);
|
|
38
|
+
--accent-border: oklch(from var(--accent) 0.45 min(c, 0.09) h);
|
|
39
|
+
--accent-disabled: oklch(from var(--accent) 0.42 min(c, 0.06) h);
|
|
37
40
|
--accent-wash: oklch(from var(--accent) l c h / 0.14);
|
|
38
41
|
--text-accent: oklch(from var(--accent) calc(l + 0.14) calc(c - 0.012) h);
|
|
39
42
|
|
|
40
|
-
--info-subtle: oklch(from var(--info) 0.265 0.045 h);
|
|
43
|
+
--info-subtle: oklch(from var(--info) 0.265 min(c, 0.045) h);
|
|
41
44
|
--info-text: oklch(from var(--info) calc(l + 0.22) calc(c - 0.014) h);
|
|
42
|
-
--info-wash: oklch(from var(--info) 0.63 0.118 h / 0.14);
|
|
45
|
+
--info-wash: oklch(from var(--info) 0.63 min(c, 0.118) h / 0.14);
|
|
43
46
|
|
|
44
47
|
--success-subtle: oklch(from var(--success) 0.265 0.05 h);
|
|
45
48
|
--success-text: oklch(from var(--success) calc(l + 0.23) calc(c - 0.02) h);
|
package/src/tokens/decisions.css
CHANGED
|
@@ -4,15 +4,17 @@
|
|
|
4
4
|
:root,
|
|
5
5
|
[data-theme='default'] {
|
|
6
6
|
/* The brand hue - hover, active, lift, subtle, border, wash, the focus ring and info follow. */
|
|
7
|
-
--accent: oklch(0.
|
|
7
|
+
--accent: oklch(0.7 0.118 198);
|
|
8
8
|
/* Positive status - its subtle, text and wash follow. */
|
|
9
9
|
--success: oklch(0.548 0.122 152);
|
|
10
10
|
/* Caution - its subtle, text and wash follow. */
|
|
11
11
|
--warning: oklch(0.7 0.142 75);
|
|
12
12
|
/* Destructive actions and errors - the danger button ladder, ring, subtle, text and wash follow. */
|
|
13
13
|
--danger: oklch(0.545 0.196 27);
|
|
14
|
-
/* The gray ramp
|
|
15
|
-
|
|
14
|
+
/* The middle of the gray ramp - every rung holds its hue distance from this one, so moving it
|
|
15
|
+
retints the whole ramp. Stripe's gray-500 lightness and chroma over the accent's hue, so the
|
|
16
|
+
grays carry the brand temperature; give it a literal hue for a ramp that does not follow. */
|
|
17
|
+
--neutral: oklch(from var(--accent) 0.553 0.031 h);
|
|
16
18
|
/* Roundness - every --radius-<step> is a fixed ratio of it, 0 squaring every corner. */
|
|
17
19
|
--radius: 0.5rem;
|
|
18
20
|
/* The body face - every --type-* bundle follows. The package loads no webfont; point this at yours. */
|
|
@@ -5,16 +5,23 @@
|
|
|
5
5
|
* Generated from the token and component CSS by `scripts/gen-theme.mjs` - `pnpm sync` rebuilds it.
|
|
6
6
|
*/
|
|
7
7
|
export const motionDefaults = {
|
|
8
|
-
duration: {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
duration: {
|
|
9
|
+
fast: 140,
|
|
10
|
+
base: 240,
|
|
11
|
+
moderate: 320,
|
|
12
|
+
slow: 420,
|
|
13
|
+
slower: 600,
|
|
14
|
+
slowest: 800,
|
|
15
|
+
spin: 1000,
|
|
16
|
+
pulse: 1600,
|
|
17
|
+
} satisfies Record<string, number>,
|
|
12
18
|
ease: {
|
|
13
19
|
standard: [0.2, 0, 0, 1],
|
|
14
|
-
entrance: [0.
|
|
15
|
-
exit: [0.
|
|
16
|
-
spring: [0.
|
|
17
|
-
glide: [0.
|
|
20
|
+
entrance: [0.22, 1, 0.36, 1],
|
|
21
|
+
exit: [0.3, 0, 0.3, 1],
|
|
22
|
+
spring: [0.3, 1.5, 0.5, 1],
|
|
23
|
+
glide: [0.22, 1, 0.36, 1],
|
|
24
|
+
move: [0.55, 0, 0.15, 1],
|
|
18
25
|
} satisfies Record<string, [number, number, number, number]>,
|
|
19
26
|
distance: { sm: 8, md: 16, lg: 24 } satisfies Record<string, number>,
|
|
20
27
|
scale: { panel: 0.98, floating: 0.96, chip: 0.9 } satisfies Record<string, number>,
|