@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/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';
|
|
@@ -60,8 +80,12 @@ export function flip(el: HTMLElement, from: Box, options: FlipOptions = {}): Pla
|
|
|
60
80
|
const dx = from.left - to.left + pivot.x * (sx - 1);
|
|
61
81
|
const dy = from.top - to.top + pivot.y * (sy - 1);
|
|
62
82
|
|
|
63
|
-
const
|
|
64
|
-
const
|
|
83
|
+
const holdsStartThroughDelay = (options.timing?.delay ?? 0) > 0;
|
|
84
|
+
const timing: Timing = {
|
|
85
|
+
...options.timing,
|
|
86
|
+
fill: options.timing?.fill ?? (holdsStartThroughDelay ? 'backwards' : 'none'),
|
|
87
|
+
};
|
|
88
|
+
const layers: Layer[] = [{ x: [dx, 0], y: [dy, 0], timing, composite: untranslated(el) ? 'replace' : 'add' }];
|
|
65
89
|
if (scaling)
|
|
66
90
|
layers.push({
|
|
67
91
|
scale: [
|
|
@@ -73,5 +97,5 @@ export function flip(el: HTMLElement, from: Box, options: FlipOptions = {}): Pla
|
|
|
73
97
|
if (resized && size === 'morph')
|
|
74
98
|
layers.push({ width: [from.width, to.width], height: [from.height, to.height], timing });
|
|
75
99
|
|
|
76
|
-
return
|
|
100
|
+
return layers;
|
|
77
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
|
+
}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { animate, measure, offscreen, type Box, type FlipOptions, type Layer, type Playback } from '../engine';
|
|
2
|
+
import { claim } from '../engine/animate';
|
|
3
|
+
import type { Timing } from '../engine/ease';
|
|
4
|
+
import { sharedSlot } from '../shared-slot';
|
|
5
|
+
import { inheritedThemeAttrs } from '../theme-scope';
|
|
6
|
+
import { flushBeforePaint } from './before-paint';
|
|
7
|
+
|
|
8
|
+
const SHOWN_BY = 0.45;
|
|
9
|
+
const GONE_BY = 0.5;
|
|
10
|
+
|
|
11
|
+
interface Copy {
|
|
12
|
+
el: HTMLElement;
|
|
13
|
+
box: Box;
|
|
14
|
+
of: HTMLElement;
|
|
15
|
+
play?: Playback;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const kept = sharedSlot('motion.crossfade@2', () => new Map<string, Copy>());
|
|
19
|
+
const riding = new WeakMap<HTMLElement, Copy>();
|
|
20
|
+
const twins = new WeakMap<HTMLElement, HTMLElement>();
|
|
21
|
+
|
|
22
|
+
function onto(el: HTMLElement, box: Box, target: Box): { x: number; y: number; scale: number } {
|
|
23
|
+
const [px, py] = getComputedStyle(el).transformOrigin.split(' ').map(parseFloat);
|
|
24
|
+
const scale = target.width / box.width;
|
|
25
|
+
return {
|
|
26
|
+
x: target.left - box.left + (target.width - box.width) / 2 + (box.width / 2 - px) * (1 - scale),
|
|
27
|
+
y: target.top - box.top + (target.height - box.height) / 2 + (box.height / 2 - py) * (1 - scale),
|
|
28
|
+
scale,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function copyOf(el: HTMLElement, box: Box, look: HTMLElement = el): HTMLElement {
|
|
33
|
+
const copy = el.cloneNode(true) as HTMLElement;
|
|
34
|
+
for (const node of [copy, ...copy.querySelectorAll('[id]')]) node.removeAttribute('id');
|
|
35
|
+
for (const [name, value] of Object.entries(inheritedThemeAttrs(el))) if (value) copy.setAttribute(name, value);
|
|
36
|
+
const { font, color, opacity } = getComputedStyle(look);
|
|
37
|
+
Object.assign(copy.style, {
|
|
38
|
+
position: 'fixed',
|
|
39
|
+
left: `${box.left - window.scrollX}px`,
|
|
40
|
+
top: `${box.top - window.scrollY}px`,
|
|
41
|
+
width: `${box.width}px`,
|
|
42
|
+
height: `${box.height}px`,
|
|
43
|
+
boxSizing: 'border-box',
|
|
44
|
+
margin: '0',
|
|
45
|
+
pointerEvents: 'none',
|
|
46
|
+
translate: 'none',
|
|
47
|
+
scale: 'none',
|
|
48
|
+
transform: 'none',
|
|
49
|
+
font,
|
|
50
|
+
color,
|
|
51
|
+
opacity,
|
|
52
|
+
});
|
|
53
|
+
copy.inert = true;
|
|
54
|
+
copy.setAttribute('aria-hidden', 'true');
|
|
55
|
+
document.body.append(copy);
|
|
56
|
+
return copy;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function clipping(from: Element | null): Element | null {
|
|
60
|
+
for (let node = from; node; node = node.parentElement) {
|
|
61
|
+
const { overflowX, overflowY } = getComputedStyle(node);
|
|
62
|
+
if (overflowX !== 'visible' || overflowY !== 'visible') return node;
|
|
63
|
+
}
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function clipTo(copy: HTMLElement, box: Box, stage: Element | null): void {
|
|
68
|
+
const x = box.left - window.scrollX;
|
|
69
|
+
const y = box.top - window.scrollY;
|
|
70
|
+
let [top, right, bottom, left] = [0, 0, 0, 0];
|
|
71
|
+
for (let node = stage; node; node = clipping(node.parentElement)) {
|
|
72
|
+
const rect = node.getBoundingClientRect();
|
|
73
|
+
top = Math.max(top, rect.top - y);
|
|
74
|
+
right = Math.max(right, x + box.width - rect.right);
|
|
75
|
+
bottom = Math.max(bottom, y + box.height - rect.bottom);
|
|
76
|
+
left = Math.max(left, rect.left - x);
|
|
77
|
+
}
|
|
78
|
+
if (top || right || bottom || left) copy.style.clipPath = `inset(${top}px ${right}px ${bottom}px ${left}px)`;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export function keep(id: string, el: HTMLElement, box: Box, timing?: Timing, margin?: number): void {
|
|
82
|
+
const twin = twins.get(el);
|
|
83
|
+
const copy = copyOf(el, box, twin?.isConnected ? twin : el);
|
|
84
|
+
const stage = clipping(el.parentElement);
|
|
85
|
+
const entry: Copy = { el: copy, box, of: el };
|
|
86
|
+
kept.set(id, entry);
|
|
87
|
+
queueMicrotask(() => {
|
|
88
|
+
flushBeforePaint();
|
|
89
|
+
if (kept.get(id) !== entry) {
|
|
90
|
+
if (!entry.play) copy.remove();
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
kept.delete(id);
|
|
94
|
+
if (el.isConnected || stage?.isConnected === false || offscreen(margin, box)) copy.remove();
|
|
95
|
+
else {
|
|
96
|
+
clipTo(copy, box, stage);
|
|
97
|
+
animate(copy, { opacity: [0], timing }).finished.then(() => copy.remove());
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export function play(id: string, el: HTMLElement, from: Box, { timing }: FlipOptions): Playback | undefined {
|
|
103
|
+
const next = kept.get(id);
|
|
104
|
+
if (!next) return undefined;
|
|
105
|
+
const replay = next.of === el;
|
|
106
|
+
const copy = replay ? riding.get(el) : next;
|
|
107
|
+
if (!copy) return undefined;
|
|
108
|
+
claim(el, ['translate', 'scale', 'opacity'], null);
|
|
109
|
+
const to = measure(el);
|
|
110
|
+
if (!to.width || !to.height) return undefined;
|
|
111
|
+
kept.delete(id);
|
|
112
|
+
if (replay) next.el.remove();
|
|
113
|
+
copy.play?.stop();
|
|
114
|
+
const rest = Number(getComputedStyle(el).opacity);
|
|
115
|
+
const out = onto(copy.el, copy.box, to);
|
|
116
|
+
const back = onto(el, to, from);
|
|
117
|
+
const run = animate(copy.el, {
|
|
118
|
+
x: [0, out.x],
|
|
119
|
+
y: [0, out.y],
|
|
120
|
+
scale: [1, out.scale],
|
|
121
|
+
opacity: [Number(copy.el.style.opacity), 0, 0],
|
|
122
|
+
timing: { fill: 'backwards', ...timing, times: [0, GONE_BY, 1] },
|
|
123
|
+
});
|
|
124
|
+
copy.play = run;
|
|
125
|
+
riding.set(el, copy);
|
|
126
|
+
run.finished.then(() => {
|
|
127
|
+
if (copy.play === run) copy.el.remove();
|
|
128
|
+
});
|
|
129
|
+
const arrive = (opacity: number[]): Layer => ({
|
|
130
|
+
x: [back.x, 0],
|
|
131
|
+
y: [back.y, 0],
|
|
132
|
+
scale: [back.scale, 1],
|
|
133
|
+
opacity,
|
|
134
|
+
timing: { fill: 'backwards', ...timing, times: [0, SHOWN_BY, 1] },
|
|
135
|
+
});
|
|
136
|
+
const twin = copyOf(el, to);
|
|
137
|
+
twin.style.zIndex = 'var(--layer-infinity)';
|
|
138
|
+
twins.set(el, twin);
|
|
139
|
+
animate(twin, arrive([0, rest, rest]));
|
|
140
|
+
const flight = animate(el, arrive([0, 0, 0]));
|
|
141
|
+
flight.finished.then(() => twin.remove());
|
|
142
|
+
return flight;
|
|
143
|
+
}
|
package/src/motion/element.tsx
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import { createElement, useCallback, useRef, type ReactNode, type Ref } from 'react';
|
|
3
|
+
import { Component, createElement, useCallback, useLayoutEffect, useRef, type ReactNode, type Ref } from 'react';
|
|
4
4
|
|
|
5
5
|
import { useFlip, type FlipTuning } from './flip';
|
|
6
|
+
import { usePresence } from './presence-context';
|
|
6
7
|
import { useMotion, type MotionSpecs } from './use-motion';
|
|
7
8
|
|
|
8
9
|
export interface MotionProps extends MotionSpecs {
|
|
9
10
|
/** Tag for the element this renders. @default 'div' */
|
|
10
11
|
as?: string;
|
|
11
|
-
/** FLIP this element from its previous box
|
|
12
|
+
/** FLIP this element from its previous box whenever a render moves it. */
|
|
12
13
|
layout?: boolean;
|
|
13
|
-
/** FLIP from whatever element last held this id, so the box travels between nodes. */
|
|
14
|
+
/** FLIP from whatever element last held this id, so the box travels between nodes. Add `layout` to FLIP its own moves too. */
|
|
14
15
|
layoutId?: string;
|
|
15
16
|
/** Tunes whichever layout animation is active; ignored without `layout` or `layoutId`. */
|
|
16
17
|
layoutTransition?: FlipTuning;
|
|
@@ -19,12 +20,26 @@ export interface MotionProps extends MotionSpecs {
|
|
|
19
20
|
[prop: string]: unknown;
|
|
20
21
|
}
|
|
21
22
|
|
|
23
|
+
class BeforeCommit extends Component<{ read: () => void; children?: ReactNode }> {
|
|
24
|
+
getSnapshotBeforeUpdate(): null {
|
|
25
|
+
this.props.read();
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
componentDidUpdate() {}
|
|
30
|
+
|
|
31
|
+
render() {
|
|
32
|
+
return this.props.children;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
22
36
|
export function Motion({
|
|
23
37
|
as = 'div',
|
|
24
38
|
animate,
|
|
25
39
|
exit,
|
|
26
40
|
initial,
|
|
27
41
|
deps,
|
|
42
|
+
offscreenMargin,
|
|
28
43
|
layout,
|
|
29
44
|
layoutId,
|
|
30
45
|
layoutTransition,
|
|
@@ -32,23 +47,29 @@ export function Motion({
|
|
|
32
47
|
children,
|
|
33
48
|
...rest
|
|
34
49
|
}: MotionProps) {
|
|
35
|
-
const
|
|
50
|
+
const { isPresent } = usePresence();
|
|
51
|
+
const flip = useFlip<HTMLElement>(layoutId ?? null, { ...layoutTransition, offscreenMargin }, !!layout);
|
|
36
52
|
const host = useRef<HTMLElement | null>(null);
|
|
37
53
|
const forwarded = useRef(ref);
|
|
38
54
|
forwarded.current = ref;
|
|
39
55
|
|
|
40
|
-
useMotion(host, { animate, exit, initial, deps });
|
|
56
|
+
useMotion(host, { animate, exit, initial, deps, offscreenMargin });
|
|
57
|
+
useLayoutEffect(flip.play);
|
|
41
58
|
|
|
42
59
|
const attach = useCallback(
|
|
43
60
|
(el: HTMLElement | null) => {
|
|
44
61
|
host.current = el;
|
|
45
|
-
|
|
62
|
+
flip.ref.current = el;
|
|
46
63
|
const outer = forwarded.current;
|
|
47
64
|
if (typeof outer === 'function') outer(el);
|
|
48
65
|
else if (outer) outer.current = el;
|
|
49
66
|
},
|
|
50
|
-
[
|
|
67
|
+
[flip.ref],
|
|
51
68
|
);
|
|
52
69
|
|
|
53
|
-
return createElement(
|
|
70
|
+
return createElement(
|
|
71
|
+
BeforeCommit,
|
|
72
|
+
{ read: flip.snapshot },
|
|
73
|
+
createElement(as, { ...rest, 'data-exiting': isPresent ? undefined : 'true', ref: attach }, children),
|
|
74
|
+
);
|
|
54
75
|
}
|