@zyncat/ui 0.21.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 +10 -9
- package/dist/alert.js.map +1 -1
- package/dist/avatar.css +1 -1
- package/dist/badge.css +1 -1
- package/dist/badge.js +5 -100
- package/dist/badge.js.map +1 -1
- 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-3HE7N3UK.js → chunk-2GYZ3HP3.js} +3 -3
- package/dist/chunk-2GYZ3HP3.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-BWGK3OD6.js → chunk-AK2AXGEC.js} +33 -6
- 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-AXZBD7LY.js → chunk-CF6ZFXRV.js} +16 -11
- package/dist/chunk-CF6ZFXRV.js.map +1 -0
- package/dist/{chunk-AQMR7ZYO.js → chunk-DOAR4PJ3.js} +4 -4
- package/dist/{chunk-AQMR7ZYO.js.map → chunk-DOAR4PJ3.js.map} +1 -1
- package/dist/chunk-EUAXI6OF.js +16 -0
- package/dist/chunk-EUAXI6OF.js.map +1 -0
- package/dist/{chunk-AOEO2LCZ.js → chunk-G2TOUG2A.js} +6 -5
- package/dist/chunk-G2TOUG2A.js.map +1 -0
- package/dist/{chunk-CYZKPUCG.js → chunk-HRP4UFWN.js} +3 -3
- 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-GM7IPTTT.js → chunk-JJHEVW4M.js} +5 -5
- package/dist/{chunk-GM7IPTTT.js.map → chunk-JJHEVW4M.js.map} +1 -1
- package/dist/{chunk-7NHY2CRA.js → chunk-JUC35N3C.js} +2 -2
- package/dist/chunk-JUC35N3C.js.map +1 -0
- package/dist/{chunk-LC6NQQER.js → chunk-LFJ4C7ZP.js} +7 -7
- package/dist/chunk-LFJ4C7ZP.js.map +1 -0
- package/dist/{chunk-JQZ3FTHP.js → chunk-MCOIR3CK.js} +3 -3
- package/dist/{chunk-JQZ3FTHP.js.map → chunk-MCOIR3CK.js.map} +1 -1
- package/dist/{chunk-TXJQUN7C.js → chunk-NATK4DDW.js} +15 -15
- package/dist/{chunk-TXJQUN7C.js.map → chunk-NATK4DDW.js.map} +1 -1
- 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-47OMFFIB.js → chunk-ODO2TCTS.js} +27 -13
- package/dist/chunk-ODO2TCTS.js.map +1 -0
- package/dist/{chunk-LV442ZOR.js → chunk-P3QSWNED.js} +11 -11
- package/dist/{chunk-LV442ZOR.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-ZSP4ZTII.js → chunk-RLRZJAF7.js} +20 -8
- package/dist/chunk-RLRZJAF7.js.map +1 -0
- package/dist/{chunk-V4ZN5RD4.js → chunk-SY5UA6WS.js} +29 -9
- package/dist/chunk-SY5UA6WS.js.map +1 -0
- package/dist/{chunk-SPFHWHJ6.js → chunk-TFC5SCAB.js} +32 -13
- 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-2W7FOMWE.js → chunk-VXQ7A6ZI.js} +8 -8
- package/dist/{chunk-2W7FOMWE.js.map → chunk-VXQ7A6ZI.js.map} +1 -1
- package/dist/{chunk-TBLPZQSI.js → chunk-W7CHDHRV.js} +114 -42
- package/dist/chunk-W7CHDHRV.js.map +1 -0
- package/dist/{chunk-DEZIQTBW.js → chunk-WBWVOOKM.js} +58 -53
- 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-TBIY5YR5.js → chunk-WMTOAYGP.js} +9 -9
- package/dist/{chunk-TBIY5YR5.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-PNFFK5HY.js → chunk-XCTMTOGT.js} +5 -5
- package/dist/{chunk-PNFFK5HY.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-XFZLFLT7.js → crossfade-UHUQBUVG.js} +53 -11
- package/dist/crossfade-UHUQBUVG.js.map +1 -0
- package/dist/date-field.js +23 -20
- package/dist/date-field.js.map +1 -1
- package/dist/date-picker.css +25 -40
- package/dist/date-range-field.js +458 -276
- package/dist/date-range-field.js.map +1 -1
- package/dist/datetime-field.js +24 -21
- 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 +42 -40
- package/dist/dialog.js.map +1 -1
- package/dist/dropdown.css +2 -2
- package/dist/dropdown.js +56 -31
- package/dist/dropdown.js.map +1 -1
- package/dist/emoji-picker.js +20 -19
- 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/modal.js +10 -9
- 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 +6 -5
- package/dist/multi-select.js +41 -20
- package/dist/multi-select.js.map +1 -1
- package/dist/number-field.js +121 -74
- package/dist/number-field.js.map +1 -1
- package/dist/odometer.css +12 -7
- package/dist/odometer.js +158 -39
- package/dist/odometer.js.map +1 -1
- package/dist/otp-field.js +32 -3
- 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/popover.js +11 -10
- package/dist/radio-group.css +1 -2
- 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 +22 -1
- package/dist/select.js +15 -14
- package/dist/select.js.map +1 -1
- package/dist/sheet.js +11 -10
- package/dist/support-rail.css +2 -2
- package/dist/support-rail.js +15 -13
- package/dist/support-rail.js.map +1 -1
- package/dist/table-detail.css +27 -0
- package/dist/table.css +35 -13
- package/dist/table.js +341 -172
- package/dist/table.js.map +1 -1
- package/dist/tabs.css +16 -11
- package/dist/tabs.js +68 -56
- 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 +15 -42
- package/dist/textarea.js +24 -26
- package/dist/textarea.js.map +1 -1
- package/dist/theme-grid.js +8 -7
- package/dist/theme-switcher.js +17 -16
- package/dist/theme-switcher.js.map +1 -1
- package/dist/{theme-transition-FDF2REFD.js → theme-transition-F3CBENM5.js} +5 -5
- package/dist/{theme-transition-FDF2REFD.js.map → theme-transition-F3CBENM5.js.map} +1 -1
- package/dist/theme.js +5 -4
- package/dist/theme.js.map +1 -1
- package/dist/tiktok.js +3 -3
- package/dist/time-field.js +13 -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.map +1 -1
- package/dist/toggle.css +0 -1
- package/dist/tooltip.css +1 -1
- package/dist/tooltip.js +21 -15
- package/dist/tooltip.js.map +1 -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 +4 -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 +9 -3
- package/dist/types/components/composites/dropdown/types.d.ts +4 -1
- package/dist/types/components/composites/scroll-area/ScrollArea.d.ts +29 -0
- package/dist/types/components/composites/select/MultiSelect.d.ts +9 -3
- package/dist/types/components/composites/select/core/menu.d.ts +3 -1
- package/dist/types/components/composites/select/core/panel.d.ts +4 -3
- package/dist/types/components/composites/select/core/use-listbox.d.ts +5 -5
- 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 +3 -71
- 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/roll.d.ts +9 -11
- package/dist/types/components/expressive/odometer/spring.d.ts +11 -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/support/types.d.ts +1 -1
- 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 +5 -1
- 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 +3 -1
- 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 +2 -1
- package/dist/types/motion/element.d.ts +14 -5
- package/dist/types/motion/flip.d.ts +6 -3
- package/dist/types/motion/holders.d.ts +4 -0
- package/dist/types/motion/use-motion.d.ts +3 -1
- 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 +43 -31
- 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 +11 -1
- package/skills/zyncat-ui/SKILL.md +6 -6
- package/skills/zyncat-ui/references/components.md +4 -2
- package/skills/zyncat-ui/references/recipes.md +1 -1
- 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 +2 -0
- package/src/components/composites/date-picker/DateRangeField.tsx +13 -18
- package/src/components/composites/date-picker/DateTimeField.tsx +2 -0
- package/src/components/composites/date-picker/TimeField.tsx +10 -4
- package/src/components/composites/date-picker/date-picker.css +25 -40
- package/src/components/composites/date-picker/date-utils.ts +4 -0
- package/src/components/composites/date-picker/field-shell.tsx +31 -7
- 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 +31 -6
- package/src/components/composites/dropdown/dropdown.css +2 -2
- package/src/components/composites/dropdown/menu-panel.tsx +22 -14
- package/src/components/composites/dropdown/types.ts +4 -1
- 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 +15 -7
- package/src/components/composites/select/core/menu.tsx +6 -2
- package/src/components/composites/select/core/panel.tsx +9 -7
- package/src/components/composites/select/core/trigger.tsx +1 -3
- package/src/components/composites/select/core/use-listbox.ts +35 -28
- package/src/components/composites/select/presets.tsx +47 -0
- package/src/components/composites/select/select.css +22 -1
- 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 +35 -13
- 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 +21 -191
- package/src/components/composites/tabs/tab-panel.tsx +63 -0
- package/src/components/composites/tabs/tabs.css +16 -11
- 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 +9 -5
- 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 +38 -12
- package/src/components/expressive/odometer/odometer.css +12 -7
- package/src/components/expressive/odometer/roll.ts +85 -40
- package/src/components/expressive/odometer/spring.ts +86 -0
- 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/overlay/overlay.css +1 -0
- package/src/components/internal/overlay/track-anchor.ts +1 -1
- package/src/components/internal/support/types.ts +1 -1
- package/src/components/internal/utils/activation.ts +2 -2
- package/src/components/primitives/avatar/avatar.css +1 -1
- package/src/components/primitives/badge/badge.css +1 -1
- 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 +35 -2
- 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 +1 -2
- 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 +24 -6
- package/src/components/primitives/textarea/char-meter.tsx +1 -16
- package/src/components/primitives/textarea/textarea.css +15 -42
- package/src/components/primitives/toggle/toggle.css +0 -1
- package/src/engine/animate.ts +5 -3
- package/src/engine/flip.ts +23 -3
- 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 +54 -8
- package/src/motion/element.tsx +22 -4
- package/src/motion/flip.ts +69 -37
- package/src/motion/holders.ts +10 -0
- package/src/motion/presence.tsx +18 -9
- package/src/motion/use-motion.ts +38 -4
- package/src/tokens/base.css +0 -5
- package/src/tokens/dark.css +5 -5
- 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 +8 -8
- 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 +44 -31
- package/src/tokens/theme.tsx +1 -1
- package/tailwind.css +4 -0
- package/dist/chunk-3HE7N3UK.js.map +0 -1
- package/dist/chunk-47OMFFIB.js.map +0 -1
- package/dist/chunk-6BY5G7BI.js +0 -122
- package/dist/chunk-6BY5G7BI.js.map +0 -1
- package/dist/chunk-6H3IJ752.js.map +0 -1
- package/dist/chunk-7NHY2CRA.js.map +0 -1
- package/dist/chunk-AOEO2LCZ.js.map +0 -1
- package/dist/chunk-AXZBD7LY.js.map +0 -1
- package/dist/chunk-BWGK3OD6.js.map +0 -1
- package/dist/chunk-CYZKPUCG.js.map +0 -1
- package/dist/chunk-DEZIQTBW.js.map +0 -1
- package/dist/chunk-KSAJ6DED.js +0 -16
- package/dist/chunk-KSAJ6DED.js.map +0 -1
- package/dist/chunk-LC6NQQER.js.map +0 -1
- package/dist/chunk-ODRO3KS6.js.map +0 -1
- package/dist/chunk-QDAN43B6.js.map +0 -1
- package/dist/chunk-SPFHWHJ6.js.map +0 -1
- package/dist/chunk-TBLPZQSI.js.map +0 -1
- package/dist/chunk-V4ZN5RD4.js.map +0 -1
- package/dist/chunk-ZSP4ZTII.js.map +0 -1
- package/dist/crossfade-XFZLFLT7.js.map +0 -1
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { useState } from 'react';
|
|
4
|
+
|
|
5
|
+
import { useControllable } from '../../internal/hooks/use-controllable';
|
|
6
|
+
|
|
7
|
+
interface NumberValueOptions {
|
|
8
|
+
value?: number | string;
|
|
9
|
+
defaultValue: number;
|
|
10
|
+
onChange?: (value: number) => void;
|
|
11
|
+
min: number;
|
|
12
|
+
max: number;
|
|
13
|
+
step: number;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function useNumberValue({ value, defaultValue, onChange, min, max, step }: NumberValueOptions) {
|
|
17
|
+
const resolvedValue = value === undefined ? undefined : typeof value === 'number' ? value : parseFloat(value) || 0;
|
|
18
|
+
const [num, setNum] = useControllable<number>(resolvedValue, defaultValue, onChange);
|
|
19
|
+
const [draft, setDraft] = useState<string | null>(null);
|
|
20
|
+
const v = draft !== null ? parseFloat(draft) || 0 : num;
|
|
21
|
+
const snap = (n: number) => parseFloat(n.toFixed(10));
|
|
22
|
+
const clamp = (n: number) => Math.min(max, Math.max(min, snap(n)));
|
|
23
|
+
const commit = (n: number) => {
|
|
24
|
+
setDraft(null);
|
|
25
|
+
setNum(clamp(n));
|
|
26
|
+
};
|
|
27
|
+
const stepBy = (direction: 1 | -1) => {
|
|
28
|
+
const next = clamp(v + direction * step);
|
|
29
|
+
commit(next);
|
|
30
|
+
return next !== v;
|
|
31
|
+
};
|
|
32
|
+
const type = (raw: string) => {
|
|
33
|
+
const text = raw.replace(/[^\d.-]/g, '');
|
|
34
|
+
setDraft(text);
|
|
35
|
+
setNum(clamp(parseFloat(text) || 0));
|
|
36
|
+
};
|
|
37
|
+
return { v, text: draft ?? String(num), commit, stepBy, type };
|
|
38
|
+
}
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
}
|
|
53
53
|
.zc-rg__label + .zc-rg__options,
|
|
54
54
|
.zc-rg__helper + .zc-rg__options {
|
|
55
|
-
margin-top: var(--space-
|
|
55
|
+
margin-top: var(--space-2);
|
|
56
56
|
}
|
|
57
57
|
.zc-rg--horizontal .zc-rg__options {
|
|
58
58
|
display: flex;
|
|
@@ -81,7 +81,6 @@
|
|
|
81
81
|
border-radius: var(--radius-md);
|
|
82
82
|
cursor: pointer;
|
|
83
83
|
transition: var(--transition-colors);
|
|
84
|
-
-webkit-tap-highlight-color: transparent;
|
|
85
84
|
}
|
|
86
85
|
.zc-rg__hover {
|
|
87
86
|
opacity: 0;
|
|
@@ -39,7 +39,7 @@ interface TagOwnProps {
|
|
|
39
39
|
onRemove?: (() => void) | null;
|
|
40
40
|
/** Accessible label for the remove button. Defaults to "Remove {label}" for string labels. */
|
|
41
41
|
removeLabel?: string;
|
|
42
|
-
/** 'md'
|
|
42
|
+
/** 'md' sits on `--control-height-sm`; 'sm' is 24px, for dense rows. @default 'md' */
|
|
43
43
|
size?: 'md' | 'sm';
|
|
44
44
|
/** Set `data-disabled` on the tag and disable its remove button. @default false */
|
|
45
45
|
disabled?: boolean;
|
|
@@ -21,9 +21,9 @@ interface ToggleTagOwnProps {
|
|
|
21
21
|
onChange?: (selected: boolean) => void;
|
|
22
22
|
/** Your own icon node; replaces the tick. Selected state reads from the wash. */
|
|
23
23
|
icon?: ReactNode | null;
|
|
24
|
-
/** Optional result count - rendered
|
|
24
|
+
/** Optional result count - rendered with tabular figures. */
|
|
25
25
|
count?: ReactNode;
|
|
26
|
-
/** 'md'
|
|
26
|
+
/** 'md' sits on `--control-height-sm`; 'sm' is 24px, for dense rows. @default 'md' */
|
|
27
27
|
size?: 'md' | 'sm';
|
|
28
28
|
/** Disable the button, blocking toggles. @default false */
|
|
29
29
|
disabled?: boolean;
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
.zc-tag__count {
|
|
59
|
-
font-family: var(--font-
|
|
59
|
+
font-family: var(--font-body);
|
|
60
60
|
font-size: var(--size-micro);
|
|
61
61
|
font-variant-numeric: tabular-nums;
|
|
62
62
|
color: var(--text-subtle);
|
|
@@ -78,7 +78,6 @@
|
|
|
78
78
|
color: var(--text-subtle);
|
|
79
79
|
cursor: pointer;
|
|
80
80
|
appearance: none;
|
|
81
|
-
-webkit-tap-highlight-color: transparent;
|
|
82
81
|
transition:
|
|
83
82
|
color var(--duration-fast) var(--ease-standard),
|
|
84
83
|
background-color var(--duration-fast) var(--ease-standard),
|
|
@@ -113,7 +112,6 @@
|
|
|
113
112
|
.zc-tag--toggle {
|
|
114
113
|
cursor: pointer;
|
|
115
114
|
appearance: none;
|
|
116
|
-
-webkit-tap-highlight-color: transparent;
|
|
117
115
|
transition:
|
|
118
116
|
var(--transition-control),
|
|
119
117
|
transform var(--duration-fast) var(--ease-standard);
|
|
@@ -139,7 +137,7 @@
|
|
|
139
137
|
--tag-shadow: 0 1px 2px 0 rgb(var(--shadow-rgb) / 0.05);
|
|
140
138
|
}
|
|
141
139
|
.zc-tag--toggle[aria-pressed='true']:hover:not(:disabled) {
|
|
142
|
-
color: var(--accent
|
|
140
|
+
color: var(--text-accent);
|
|
143
141
|
border-color: var(--accent-border);
|
|
144
142
|
background: var(--accent-wash);
|
|
145
143
|
}
|
|
@@ -41,6 +41,8 @@ interface TextareaOwnProps extends FieldMessagingProps, TextareaNative {
|
|
|
41
41
|
onSubmit?: (value: string) => void;
|
|
42
42
|
/** Soft char limit: shows the meter + over-limit highlight. Does NOT truncate (use native maxLength for a hard stop). */
|
|
43
43
|
max?: number;
|
|
44
|
+
/** How much one character (a code point) counts toward `max`, e.g. its UTF-8 byte length. @default its UTF-16 length */
|
|
45
|
+
charWeight?: (char: string) => number;
|
|
44
46
|
/** Rows shown before auto-grow kicks in. @default 3 */
|
|
45
47
|
minRows?: number;
|
|
46
48
|
/** Row cap - grows up to this, then the box scrolls. @default 10 */
|
|
@@ -62,6 +64,20 @@ export interface TextareaProps extends TextareaOwnProps {
|
|
|
62
64
|
htmlProps?: Omit<TextareaHTMLAttributes<HTMLTextAreaElement>, keyof TextareaOwnProps | 'rows'> & DataAttributes;
|
|
63
65
|
}
|
|
64
66
|
|
|
67
|
+
const utf16Weight = (char: string) => char.length;
|
|
68
|
+
|
|
69
|
+
function weigh(text: string, max: number, charWeight: (char: string) => number) {
|
|
70
|
+
let count = 0;
|
|
71
|
+
let fitEnd = -1;
|
|
72
|
+
let at = 0;
|
|
73
|
+
for (const char of text) {
|
|
74
|
+
count += charWeight(char);
|
|
75
|
+
if (fitEnd < 0 && count > max) fitEnd = at;
|
|
76
|
+
at += char.length;
|
|
77
|
+
}
|
|
78
|
+
return { count, fitEnd: fitEnd < 0 ? text.length : fitEnd };
|
|
79
|
+
}
|
|
80
|
+
|
|
65
81
|
export function Textarea({
|
|
66
82
|
id,
|
|
67
83
|
label,
|
|
@@ -77,6 +93,7 @@ export function Textarea({
|
|
|
77
93
|
onKeyDown,
|
|
78
94
|
onSubmit,
|
|
79
95
|
max,
|
|
96
|
+
charWeight = utf16Weight,
|
|
80
97
|
minRows = 3,
|
|
81
98
|
maxRows = 10,
|
|
82
99
|
warnAt = 20,
|
|
@@ -92,7 +109,7 @@ export function Textarea({
|
|
|
92
109
|
const stackRef = useRef<HTMLDivElement>(null);
|
|
93
110
|
const mirrorRef = useRef<HTMLDivElement>(null);
|
|
94
111
|
const text = value ?? '';
|
|
95
|
-
const count = text
|
|
112
|
+
const { count, fitEnd } = weigh(text, max ?? Infinity, charWeight);
|
|
96
113
|
const over = max ? Math.max(count - max, 0) : 0;
|
|
97
114
|
const lastMax = useRef(max);
|
|
98
115
|
if (max) lastMax.current = max;
|
|
@@ -100,7 +117,8 @@ export function Textarea({
|
|
|
100
117
|
|
|
101
118
|
const { state, msg, msgIcon } = resolveFieldMessage(error, warning, success, helper);
|
|
102
119
|
const autoId = useId();
|
|
103
|
-
const
|
|
120
|
+
const fieldId = id ?? autoId;
|
|
121
|
+
const msgId = fieldMessageId(fieldId, msg);
|
|
104
122
|
|
|
105
123
|
const resize = () => {
|
|
106
124
|
const el = taRef.current,
|
|
@@ -152,16 +170,16 @@ export function Textarea({
|
|
|
152
170
|
|
|
153
171
|
return (
|
|
154
172
|
<div className={cls} style={style}>
|
|
155
|
-
<FieldLabel id={
|
|
173
|
+
<FieldLabel id={fieldId} label={label} required={required} optional={optional} />
|
|
156
174
|
<div className={boxCls} style={{ '--txa-min-rows': minRows, '--txa-max-rows': maxRows } as CSSProperties}>
|
|
157
175
|
<div className="zc-txa__stack" ref={stackRef}>
|
|
158
176
|
<div className="zc-txa__mirror" ref={mirrorRef} aria-hidden="true">
|
|
159
|
-
{over ? text.slice(0,
|
|
160
|
-
{over ? <mark>{text.slice(
|
|
177
|
+
{over ? text.slice(0, fitEnd) : text}
|
|
178
|
+
{over ? <mark>{text.slice(fitEnd)}</mark> : null}
|
|
161
179
|
{'\n'}
|
|
162
180
|
</div>
|
|
163
181
|
<textarea
|
|
164
|
-
id={
|
|
182
|
+
id={fieldId}
|
|
165
183
|
className="zc-txa__input"
|
|
166
184
|
ref={taRef}
|
|
167
185
|
rows={minRows}
|
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import type { CSSProperties } from 'react';
|
|
4
|
-
|
|
5
3
|
import { cx } from '../../internal/utils/cx';
|
|
6
4
|
|
|
7
|
-
const RING_C = (2 * Math.PI * 7).toFixed(2);
|
|
8
|
-
|
|
9
5
|
export interface CharMeterProps {
|
|
10
6
|
count: number;
|
|
11
7
|
max: number;
|
|
@@ -18,17 +14,6 @@ export function CharMeter({ count, max, warnAt }: CharMeterProps) {
|
|
|
18
14
|
const state = over ? 'zc-is-over' : remaining <= warnAt ? 'zc-is-near' : '';
|
|
19
15
|
|
|
20
16
|
return (
|
|
21
|
-
<span className={cx('zc-
|
|
22
|
-
<span className="zc-txa__count">{over || remaining <= warnAt ? remaining : `${count} / ${max}`}</span>
|
|
23
|
-
<svg
|
|
24
|
-
className="zc-txa__ring"
|
|
25
|
-
viewBox="0 0 16 16"
|
|
26
|
-
aria-hidden="true"
|
|
27
|
-
style={{ '--txa-ring-c': RING_C, '--txa-ring-p': Math.min(count / max, 1) } as CSSProperties}
|
|
28
|
-
>
|
|
29
|
-
<circle className="zc-txa__ring-trk" cx="8" cy="8" r="7" />
|
|
30
|
-
<circle className="zc-txa__ring-prg" cx="8" cy="8" r="7" />
|
|
31
|
-
</svg>
|
|
32
|
-
</span>
|
|
17
|
+
<span className={cx('zc-txa__count', state)}>{over || remaining <= warnAt ? remaining : `${count} / ${max}`}</span>
|
|
33
18
|
);
|
|
34
19
|
}
|
|
@@ -100,12 +100,7 @@
|
|
|
100
100
|
display: flex;
|
|
101
101
|
align-items: center;
|
|
102
102
|
gap: var(--space-3);
|
|
103
|
-
padding: var(--
|
|
104
|
-
border-top: var(--border-hairline) solid var(--border-subtle);
|
|
105
|
-
transition: border-color var(--duration-fast) var(--ease-standard);
|
|
106
|
-
}
|
|
107
|
-
.zc-txa:focus-within .zc-txa__bar {
|
|
108
|
-
border-top-color: var(--border-default);
|
|
103
|
+
padding: 0 var(--txa-pad-x) var(--space-2);
|
|
109
104
|
}
|
|
110
105
|
.zc-txa__hint {
|
|
111
106
|
font: var(--type-micro);
|
|
@@ -123,13 +118,9 @@
|
|
|
123
118
|
margin-left: auto;
|
|
124
119
|
flex: none;
|
|
125
120
|
}
|
|
126
|
-
.zc-txa__meter {
|
|
127
|
-
display: inline-flex;
|
|
128
|
-
align-items: center;
|
|
129
|
-
gap: var(--space-2);
|
|
130
|
-
}
|
|
131
121
|
.zc-txa__count {
|
|
132
|
-
|
|
122
|
+
display: block;
|
|
123
|
+
font-family: var(--font-body);
|
|
133
124
|
font-size: var(--size-micro);
|
|
134
125
|
line-height: 1;
|
|
135
126
|
font-variant-numeric: tabular-nums;
|
|
@@ -137,38 +128,10 @@
|
|
|
137
128
|
white-space: nowrap;
|
|
138
129
|
transition: color var(--duration-fast) var(--ease-standard);
|
|
139
130
|
}
|
|
140
|
-
.zc-
|
|
141
|
-
width: var(--icon-sm);
|
|
142
|
-
height: var(--icon-sm);
|
|
143
|
-
flex: none;
|
|
144
|
-
transform: rotate(-90deg);
|
|
145
|
-
}
|
|
146
|
-
.zc-txa__ring circle {
|
|
147
|
-
fill: none;
|
|
148
|
-
stroke-width: 2;
|
|
149
|
-
}
|
|
150
|
-
.zc-txa__ring .zc-txa__ring-trk {
|
|
151
|
-
stroke: var(--border-default);
|
|
152
|
-
}
|
|
153
|
-
.zc-txa__ring .zc-txa__ring-prg {
|
|
154
|
-
stroke: var(--accent);
|
|
155
|
-
stroke-linecap: round;
|
|
156
|
-
stroke-dasharray: var(--txa-ring-c);
|
|
157
|
-
stroke-dashoffset: calc(var(--txa-ring-c) * (1 - var(--txa-ring-p, 0)));
|
|
158
|
-
transition:
|
|
159
|
-
stroke-dashoffset var(--duration-base) var(--ease-standard),
|
|
160
|
-
stroke var(--duration-fast) var(--ease-standard);
|
|
161
|
-
}
|
|
162
|
-
.zc-txa__meter.zc-is-near .zc-txa__ring-prg {
|
|
163
|
-
stroke: var(--warning);
|
|
164
|
-
}
|
|
165
|
-
.zc-txa__meter.zc-is-near .zc-txa__count {
|
|
131
|
+
.zc-txa__count.zc-is-near {
|
|
166
132
|
color: var(--warning-text);
|
|
167
133
|
}
|
|
168
|
-
.zc-
|
|
169
|
-
stroke: var(--danger);
|
|
170
|
-
}
|
|
171
|
-
.zc-txa__meter.zc-is-over .zc-txa__count {
|
|
134
|
+
.zc-txa__count.zc-is-over {
|
|
172
135
|
color: var(--danger-text);
|
|
173
136
|
font-weight: var(--weight-medium);
|
|
174
137
|
}
|
|
@@ -219,4 +182,14 @@
|
|
|
219
182
|
.zc-fld--txa.zc-fld--lg .zc-txa__mirror {
|
|
220
183
|
font: var(--type-body-lg);
|
|
221
184
|
}
|
|
185
|
+
|
|
186
|
+
@media (pointer: coarse) {
|
|
187
|
+
.zc-fld.zc-fld--txa .zc-txa {
|
|
188
|
+
--txa-lh: var(--leading-body-lg);
|
|
189
|
+
}
|
|
190
|
+
.zc-fld.zc-fld--txa .zc-txa__input,
|
|
191
|
+
.zc-fld.zc-fld--txa .zc-txa__mirror {
|
|
192
|
+
font: var(--type-body-lg);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
222
195
|
}
|
package/src/engine/animate.ts
CHANGED
|
@@ -118,12 +118,14 @@ function play(el: HTMLElement, layer: Layer): Playback | null {
|
|
|
118
118
|
if (!keys.length) return null;
|
|
119
119
|
|
|
120
120
|
const timing = layer.timing;
|
|
121
|
+
const fill = timing?.fill ?? 'both';
|
|
121
122
|
const resolved = resolveTiming(timing);
|
|
122
123
|
|
|
123
124
|
if (resolved.duration <= 0) {
|
|
124
125
|
claim(el, keys, null);
|
|
125
|
-
if (
|
|
126
|
-
for (const key of keys)
|
|
126
|
+
if (fill === 'both' || fill === 'forwards')
|
|
127
|
+
for (const key of keys)
|
|
128
|
+
el.style.setProperty(cssName(key), autoKeys.includes(key) ? 'auto' : frames[key][frames[key].length - 1]);
|
|
127
129
|
return null;
|
|
128
130
|
}
|
|
129
131
|
|
|
@@ -135,7 +137,7 @@ function play(el: HTMLElement, layer: Layer): Playback | null {
|
|
|
135
137
|
duration: resolved.duration,
|
|
136
138
|
delay: resolved.delay,
|
|
137
139
|
easing: resolved.easing,
|
|
138
|
-
fill
|
|
140
|
+
fill,
|
|
139
141
|
composite: layer.composite,
|
|
140
142
|
});
|
|
141
143
|
animation.playbackRate = 1 / clock.scale;
|
package/src/engine/flip.ts
CHANGED
|
@@ -12,17 +12,33 @@ export interface Box {
|
|
|
12
12
|
const MOVE_EPSILON = 0.5;
|
|
13
13
|
const SCALE_EPSILON = 0.01;
|
|
14
14
|
const TOP_LEFT = { x: 0, y: 0 };
|
|
15
|
+
const OFFSCREEN_MARGIN_PX = 100;
|
|
15
16
|
|
|
16
17
|
function transformOrigin(el: HTMLElement): { x: number; y: number } {
|
|
17
18
|
const [x, y] = getComputedStyle(el).transformOrigin.split(' ');
|
|
18
19
|
return { x: parseFloat(x), y: parseFloat(y) };
|
|
19
20
|
}
|
|
20
21
|
|
|
22
|
+
const writesTranslate = (animation: Animation): boolean =>
|
|
23
|
+
animation.effect instanceof KeyframeEffect && animation.effect.getKeyframes().some((frame) => 'translate' in frame);
|
|
24
|
+
|
|
25
|
+
const untranslated = (el: HTMLElement): boolean =>
|
|
26
|
+
getComputedStyle(el).translate === 'none' && !el.getAnimations().some(writesTranslate);
|
|
27
|
+
|
|
21
28
|
export function measure(el: HTMLElement): Box {
|
|
22
29
|
const rect = el.getBoundingClientRect();
|
|
23
30
|
return { left: rect.left + window.scrollX, top: rect.top + window.scrollY, width: rect.width, height: rect.height };
|
|
24
31
|
}
|
|
25
32
|
|
|
33
|
+
export function offscreen(margin = OFFSCREEN_MARGIN_PX, a: Box, b: Box = a): boolean {
|
|
34
|
+
const outside = (start: number, end: number, scroll: number, span: number): boolean =>
|
|
35
|
+
end < scroll - margin || start > scroll + span + margin;
|
|
36
|
+
return (
|
|
37
|
+
outside(Math.min(a.top, b.top), Math.max(a.top + a.height, b.top + b.height), window.scrollY, window.innerHeight) ||
|
|
38
|
+
outside(Math.min(a.left, b.left), Math.max(a.left + a.width, b.left + b.width), window.scrollX, window.innerWidth)
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
|
|
26
42
|
const shared = sharedSlot('engine.flip-shared@1', () => new Map<string, Box>());
|
|
27
43
|
|
|
28
44
|
export function keepShared(key: string, box: Box): void {
|
|
@@ -44,7 +60,11 @@ export interface FlipOptions {
|
|
|
44
60
|
}
|
|
45
61
|
|
|
46
62
|
export function flip(el: HTMLElement, from: Box, options: FlipOptions = {}): Playback | null {
|
|
47
|
-
const
|
|
63
|
+
const layers = flipLayers(el, from, measure(el), options);
|
|
64
|
+
return layers && animate(el, ...layers);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export function flipLayers(el: HTMLElement, from: Box, to: Box, options: FlipOptions = {}): Layer[] | null {
|
|
48
68
|
if (!to.width || !to.height) return null;
|
|
49
69
|
|
|
50
70
|
const size = options.size ?? 'scale';
|
|
@@ -65,7 +85,7 @@ export function flip(el: HTMLElement, from: Box, options: FlipOptions = {}): Pla
|
|
|
65
85
|
...options.timing,
|
|
66
86
|
fill: options.timing?.fill ?? (holdsStartThroughDelay ? 'backwards' : 'none'),
|
|
67
87
|
};
|
|
68
|
-
const layers: Layer[] = [{ x: [dx, 0], y: [dy, 0], timing, composite: 'add' }];
|
|
88
|
+
const layers: Layer[] = [{ x: [dx, 0], y: [dy, 0], timing, composite: untranslated(el) ? 'replace' : 'add' }];
|
|
69
89
|
if (scaling)
|
|
70
90
|
layers.push({
|
|
71
91
|
scale: [
|
|
@@ -77,5 +97,5 @@ export function flip(el: HTMLElement, from: Box, options: FlipOptions = {}): Pla
|
|
|
77
97
|
if (resized && size === 'morph')
|
|
78
98
|
layers.push({ width: [from.width, to.width], height: [from.height, to.height], timing });
|
|
79
99
|
|
|
80
|
-
return
|
|
100
|
+
return layers;
|
|
81
101
|
}
|
package/src/engine/index.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { animate, set, clock, type Layer, type Placement, type Playback } from './animate';
|
|
2
|
-
export { loop, type LoopOptions, type SimulationFrame } from './loop';
|
|
3
|
-
export { flip, measure, keepShared, readShared, dropShared, type Box, type FlipOptions } from './flip';
|
|
2
|
+
export { loop, type LoopOptions, type LoopPlayback, type SimulationFrame } from './loop';
|
|
3
|
+
export { flip, measure, offscreen, keepShared, readShared, dropShared, type Box, type FlipOptions } from './flip';
|
|
4
4
|
export { startDrag, type PanInfo } from './drag';
|
package/src/engine/loop.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { UIMotion } from '../tokens/motion-tokens';
|
|
2
2
|
import { claim, clock, release, type Playback, type PropertyHolder } from './animate';
|
|
3
3
|
|
|
4
|
-
export type SimulationFrame = (k: number, dt: number, now: number) => void;
|
|
4
|
+
export type SimulationFrame = (k: number, dt: number, now: number) => boolean | void;
|
|
5
5
|
|
|
6
6
|
export interface LoopOptions {
|
|
7
7
|
el?: HTMLElement;
|
|
@@ -13,9 +13,13 @@ export interface LoopOptions {
|
|
|
13
13
|
const MAX_FRAME_MS = 34;
|
|
14
14
|
const BASE_FRAME_MS = 1000 / 60;
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
export interface LoopPlayback extends Playback {
|
|
17
|
+
wake(): void;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const settled: LoopPlayback = { stop() {}, wake() {}, finished: Promise.resolve() };
|
|
17
21
|
|
|
18
|
-
export function loop(frame: SimulationFrame, options: LoopOptions = {}):
|
|
22
|
+
export function loop(frame: SimulationFrame, options: LoopOptions = {}): LoopPlayback {
|
|
19
23
|
if (UIMotion.reduced) {
|
|
20
24
|
options.snap?.();
|
|
21
25
|
return settled;
|
|
@@ -26,6 +30,7 @@ export function loop(frame: SimulationFrame, options: LoopOptions = {}): Playbac
|
|
|
26
30
|
|
|
27
31
|
let raf = 0;
|
|
28
32
|
let stopped = false;
|
|
33
|
+
let parked = false;
|
|
29
34
|
let hidden = document.visibilityState === 'hidden';
|
|
30
35
|
let inView = true;
|
|
31
36
|
let running = false;
|
|
@@ -40,12 +45,13 @@ export function loop(frame: SimulationFrame, options: LoopOptions = {}): Playbac
|
|
|
40
45
|
last = now;
|
|
41
46
|
const rate = Number(speed ? speed() : 1);
|
|
42
47
|
const effective = (isFinite(rate) && rate >= 0 ? rate : 1) / clock.scale;
|
|
43
|
-
frame((dt / BASE_FRAME_MS) * effective, dt * effective, now);
|
|
48
|
+
parked = frame((dt / BASE_FRAME_MS) * effective, dt * effective, now) === false;
|
|
49
|
+
sync();
|
|
44
50
|
if (running) raf = requestAnimationFrame(step);
|
|
45
51
|
};
|
|
46
52
|
|
|
47
53
|
const sync = () => {
|
|
48
|
-
const next = !stopped && !hidden && inView;
|
|
54
|
+
const next = !stopped && !parked && !hidden && inView;
|
|
49
55
|
if (next === running) return;
|
|
50
56
|
running = next;
|
|
51
57
|
if (running) {
|
|
@@ -91,7 +97,12 @@ export function loop(frame: SimulationFrame, options: LoopOptions = {}): Playbac
|
|
|
91
97
|
|
|
92
98
|
if (keys && el) claim(el, keys, holder);
|
|
93
99
|
|
|
100
|
+
const wake = () => {
|
|
101
|
+
parked = false;
|
|
102
|
+
sync();
|
|
103
|
+
};
|
|
104
|
+
|
|
94
105
|
sync();
|
|
95
106
|
|
|
96
|
-
return { stop, finished };
|
|
107
|
+
return { stop, wake, finished };
|
|
97
108
|
}
|
package/src/mcp/server.ts
CHANGED
|
@@ -67,19 +67,24 @@ function resolveModules(d: Db, inputs: string[]): UsageModule[] {
|
|
|
67
67
|
for (const [name, m] of candidates) if (name.includes(q) || q.includes(name)) loose.add(m);
|
|
68
68
|
if (loose.size === 1) found.push([...loose][0]);
|
|
69
69
|
else if (loose.size > 1) misses.push(`"${input}" (ambiguous: ${[...loose].map((m) => m.subpath).join(', ')})`);
|
|
70
|
-
else misses.push(`"${input}"`);
|
|
70
|
+
else misses.push(`"${input}"${nearest(d, input)}`);
|
|
71
71
|
}
|
|
72
72
|
if (misses.length) {
|
|
73
|
-
throw new Error(`No component matches ${misses.join(', ')}.
|
|
73
|
+
throw new Error(`No component matches ${misses.join(', ')}. search_api("*") lists every component.`);
|
|
74
74
|
}
|
|
75
75
|
return [...new Set(found)];
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
+
function nearest(d: Db, input: string): string {
|
|
79
|
+
const name = input.toLowerCase().replace(/^@zyncat\/ui\//, '');
|
|
80
|
+
const names = rank(d, name.match(/[a-z0-9]+/g) ?? []).ranked.map((h) => h.module.subpath);
|
|
81
|
+
return names.length ? ` (nearest by keyword: ${names.slice(0, 3).join(', ')})` : '';
|
|
82
|
+
}
|
|
83
|
+
|
|
78
84
|
const RELATIVE_SPEC_RE = /(?:from\s+['"]|import\(['"])(\.[^'"]+)['"]/g;
|
|
79
85
|
|
|
80
|
-
function readTypes(root: string, typesPath: string): string {
|
|
86
|
+
function readTypes(root: string, typesPath: string, seen = new Set<string>()): string {
|
|
81
87
|
const out: string[] = [];
|
|
82
|
-
const seen = new Set<string>();
|
|
83
88
|
const walk = (path: string) => {
|
|
84
89
|
const full = resolve(root, path);
|
|
85
90
|
if (seen.has(full) || !existsSync(full)) return;
|
|
@@ -105,7 +110,7 @@ function readTypes(root: string, typesPath: string): string {
|
|
|
105
110
|
return out.join('\n\n');
|
|
106
111
|
}
|
|
107
112
|
|
|
108
|
-
function renderModule(d: Db, m: UsageModule): string {
|
|
113
|
+
function renderModule(d: Db, m: UsageModule, printed: Set<string>): string {
|
|
109
114
|
const out: string[] = [];
|
|
110
115
|
if (m.usage) {
|
|
111
116
|
out.push(`# ${m.usage.title} - @zyncat/ui/${m.subpath}`, '');
|
|
@@ -119,16 +124,18 @@ function renderModule(d: Db, m: UsageModule): string {
|
|
|
119
124
|
} else {
|
|
120
125
|
out.push(`# @zyncat/ui/${m.subpath}`, '', 'No usage doc - this module is documented by its types below.', '');
|
|
121
126
|
}
|
|
122
|
-
|
|
127
|
+
const types = readTypes(d.root, m.typesPath, printed);
|
|
128
|
+
out.push('## Complete prop types (entry .d.ts + shared chunks, each printed once per call)', '', types);
|
|
123
129
|
return out.join('\n');
|
|
124
130
|
}
|
|
125
131
|
|
|
126
132
|
function getComponent(raw: unknown): string {
|
|
127
133
|
const inputs = (Array.isArray(raw) ? raw : [raw]).filter((v): v is string => typeof v === 'string');
|
|
128
|
-
if (!inputs.length) throw new Error('Pass
|
|
134
|
+
if (!inputs.length) throw new Error('Pass "components": a component name or a list of names.');
|
|
129
135
|
const d = db();
|
|
130
136
|
const modules = resolveModules(d, inputs);
|
|
131
|
-
|
|
137
|
+
const printed = new Set<string>();
|
|
138
|
+
return modules.map((m) => renderModule(d, m, printed)).join('\n\n');
|
|
132
139
|
}
|
|
133
140
|
|
|
134
141
|
const DECISIONS_FILE = 'decisions.css';
|
|
@@ -158,11 +165,7 @@ function corpusFor(d: Db, m: UsageModule): { label: string; text: string }[] {
|
|
|
158
165
|
return parts;
|
|
159
166
|
}
|
|
160
167
|
|
|
161
|
-
function
|
|
162
|
-
const words = query.toLowerCase().split(/\s+/).filter(Boolean);
|
|
163
|
-
if (!words.length) throw new Error('Pass one or more keywords, e.g. "searchable" or "drag dismiss".');
|
|
164
|
-
const d = db();
|
|
165
|
-
|
|
168
|
+
function rank(d: Db, words: string[]): { ranked: Hit[]; everyWord: boolean } {
|
|
166
169
|
const hits: Hit[] = [];
|
|
167
170
|
for (const m of d.modules) {
|
|
168
171
|
const hit: Hit = { module: m, score: 0, matched: new Set(), lines: [] };
|
|
@@ -193,9 +196,17 @@ function searchApi(query: string): string {
|
|
|
193
196
|
}
|
|
194
197
|
if (hit.matched.size) hits.push(hit);
|
|
195
198
|
}
|
|
196
|
-
|
|
197
199
|
const full = hits.filter((h) => h.matched.size === words.length);
|
|
198
200
|
const ranked = (full.length ? full : hits).sort((a, b) => b.score - a.score).slice(0, 8);
|
|
201
|
+
return { ranked, everyWord: full.length > 0 };
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
function searchApi(query: string): string {
|
|
205
|
+
const words = query.toLowerCase().split(/\s+/).filter(Boolean);
|
|
206
|
+
if (!words.length) throw new Error('Pass one or more keywords, e.g. "searchable" or "drag dismiss".');
|
|
207
|
+
const d = db();
|
|
208
|
+
if (query.trim() === '*') return d.index;
|
|
209
|
+
const { ranked, everyWord } = rank(d, words);
|
|
199
210
|
|
|
200
211
|
const tokenHits: string[] = [];
|
|
201
212
|
for (const f of tokenFiles(d.root)) {
|
|
@@ -206,11 +217,11 @@ function searchApi(query: string): string {
|
|
|
206
217
|
}
|
|
207
218
|
|
|
208
219
|
if (!ranked.length && !tokenHits.length) {
|
|
209
|
-
return `No
|
|
220
|
+
return `No component or token mentions "${query}". search_api("*") lists every component.`;
|
|
210
221
|
}
|
|
211
222
|
|
|
212
223
|
const out: string[] = [];
|
|
213
|
-
if (!
|
|
224
|
+
if (!everyWord && ranked.length) out.push(`No component matches every word of "${query}"; closest by keyword:`, '');
|
|
214
225
|
for (const h of ranked) {
|
|
215
226
|
out.push(`## ${h.module.usage?.title ?? h.module.subpath} - @zyncat/ui/${h.module.subpath}`);
|
|
216
227
|
if (h.module.usage) out.push(h.module.usage.summary);
|
|
@@ -218,7 +229,7 @@ function searchApi(query: string): string {
|
|
|
218
229
|
out.push('');
|
|
219
230
|
}
|
|
220
231
|
if (tokenHits.length) out.push('## Design tokens', ...tokenHits.map((l) => ` ${l}`), '');
|
|
221
|
-
out.push(`Follow up with get_component([...names]) for complete APIs.`);
|
|
232
|
+
out.push(`Follow up with get_component({ components: [...names] }) for complete APIs.`);
|
|
222
233
|
return out.join('\n');
|
|
223
234
|
}
|
|
224
235
|
|
|
@@ -313,7 +324,7 @@ const CONSUMER_TOOLS = [
|
|
|
313
324
|
'its neighbours, example, live docs page URL) plus the complete TypeScript prop types with doc comments, ' +
|
|
314
325
|
'shared type chunks inlined. Accepts a list - pass every component the change touches in ONE call. This is ' +
|
|
315
326
|
'the only reliable source for props: call it before writing any Zyncat UI JSX. An unknown name returns the ' +
|
|
316
|
-
'
|
|
327
|
+
'nearest components by keyword, so a wrong guess still orients you.',
|
|
317
328
|
inputSchema: {
|
|
318
329
|
type: 'object',
|
|
319
330
|
properties: {
|
|
@@ -332,8 +343,7 @@ const CONSUMER_TOOLS = [
|
|
|
332
343
|
description:
|
|
333
344
|
'Ranked keyword search across every component’s usage doc, prop types and the design-token CSS. Finds ' +
|
|
334
345
|
'which component owns a prop, behavior or token (e.g. "drag dismiss", "searchable", "DurationToken", ' +
|
|
335
|
-
'"--accent").
|
|
336
|
-
'get_component.',
|
|
346
|
+
'"--accent"). A miss says so in one line; "*" returns the whole catalog. Follow up with get_component.',
|
|
337
347
|
inputSchema: {
|
|
338
348
|
type: 'object',
|
|
339
349
|
properties: { query: { type: 'string', description: 'One or more keywords.' } },
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
type Read = () => (() => void) | undefined;
|
|
2
|
+
|
|
3
|
+
const stops: (() => void)[] = [];
|
|
4
|
+
const reads: Read[] = [];
|
|
5
|
+
|
|
6
|
+
export function beforePaint(read: Read, stop?: () => void): void {
|
|
7
|
+
if (!reads.length) queueMicrotask(flushBeforePaint);
|
|
8
|
+
reads.push(read);
|
|
9
|
+
if (stop) stops.push(stop);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function flushBeforePaint(): void {
|
|
13
|
+
for (const stop of stops.splice(0)) stop();
|
|
14
|
+
for (const write of reads.splice(0).map((read) => read())) write?.();
|
|
15
|
+
}
|