@zyncat/ui 0.13.1 → 0.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +46 -157
- package/dist/alert.css +27 -34
- package/dist/alert.js +26 -17
- package/dist/alert.js.map +1 -1
- package/dist/avatar-group.js +2 -2
- package/dist/avatar-group.js.map +1 -1
- package/dist/avatar.css +53 -51
- package/dist/avatar.js +29 -7
- package/dist/avatar.js.map +1 -1
- package/dist/badge.css +31 -37
- package/dist/badge.js +1 -1
- package/dist/bloom-HV23M4AW.js +81 -0
- package/dist/bloom-HV23M4AW.js.map +1 -0
- package/dist/button.css +99 -118
- package/dist/button.js +3 -1
- package/dist/checkbox.css +28 -33
- package/dist/checkbox.js +2 -2
- package/dist/chunk-2YGHPQ66.js +16 -0
- package/dist/chunk-2YGHPQ66.js.map +1 -0
- package/dist/chunk-3MLUH2QL.js +53 -0
- package/dist/chunk-3MLUH2QL.js.map +1 -0
- package/dist/{chunk-RJFGWJ4W.js → chunk-3XRVPCIM.js} +6 -6
- package/dist/chunk-3XRVPCIM.js.map +1 -0
- package/dist/{chunk-FONOS5RN.js → chunk-4PQDVK23.js} +11 -10
- package/dist/chunk-4PQDVK23.js.map +1 -0
- package/dist/{chunk-45R4Z5XN.js → chunk-5VC3TUZ2.js} +4 -4
- package/dist/{chunk-45R4Z5XN.js.map → chunk-5VC3TUZ2.js.map} +1 -1
- package/dist/{chunk-A5WTZACK.js → chunk-5W5TKANX.js} +3 -3
- package/dist/{chunk-A5WTZACK.js.map → chunk-5W5TKANX.js.map} +1 -1
- package/dist/{chunk-227ZW4V7.js → chunk-6IXLW7QA.js} +11 -11
- package/dist/chunk-6IXLW7QA.js.map +1 -0
- package/dist/chunk-7NHY2CRA.js +132 -0
- package/dist/chunk-7NHY2CRA.js.map +1 -0
- package/dist/{chunk-EF6RPXU7.js → chunk-7VTWJL72.js} +43 -35
- package/dist/chunk-7VTWJL72.js.map +1 -0
- package/dist/chunk-7ZSIUUC3.js +50 -0
- package/dist/chunk-7ZSIUUC3.js.map +1 -0
- package/dist/{chunk-TYHR4VNM.js → chunk-AREEMG47.js} +10 -8
- package/dist/chunk-AREEMG47.js.map +1 -0
- package/dist/{chunk-DDRSMHN4.js → chunk-DH7DT6EO.js} +3 -3
- package/dist/{chunk-DDRSMHN4.js.map → chunk-DH7DT6EO.js.map} +1 -1
- package/dist/chunk-EOWWVFBF.js +14 -0
- package/dist/chunk-EOWWVFBF.js.map +1 -0
- package/dist/{chunk-5PZ43DCG.js → chunk-FLDIRXFU.js} +12 -13
- package/dist/chunk-FLDIRXFU.js.map +1 -0
- package/dist/{chunk-I45AU6KH.js → chunk-GGDAMIBH.js} +13 -7
- package/dist/chunk-GGDAMIBH.js.map +1 -0
- package/dist/{chunk-M43IOM5C.js → chunk-GWCBTD63.js} +3 -3
- package/dist/{chunk-M43IOM5C.js.map → chunk-GWCBTD63.js.map} +1 -1
- package/dist/chunk-GZ6UMHCK.js +103 -0
- package/dist/chunk-GZ6UMHCK.js.map +1 -0
- package/dist/chunk-H3X2263Y.js +17 -0
- package/dist/chunk-H3X2263Y.js.map +1 -0
- package/dist/{chunk-IJS7TPGV.js → chunk-HWDIVGME.js} +14 -7
- package/dist/chunk-HWDIVGME.js.map +1 -0
- package/dist/chunk-KSAJ6DED.js +16 -0
- package/dist/chunk-KSAJ6DED.js.map +1 -0
- package/dist/chunk-LH2UIEKN.js +42 -0
- package/dist/chunk-LH2UIEKN.js.map +1 -0
- package/dist/{chunk-JY6A2ZJZ.js → chunk-LNAV5E7S.js} +2 -2
- package/dist/{chunk-JY6A2ZJZ.js.map → chunk-LNAV5E7S.js.map} +1 -1
- package/dist/{chunk-CF4QHO4N.js → chunk-M2A6PZ7J.js} +10 -10
- package/dist/{chunk-CF4QHO4N.js.map → chunk-M2A6PZ7J.js.map} +1 -1
- package/dist/chunk-NYQQH4R5.js +40 -0
- package/dist/chunk-NYQQH4R5.js.map +1 -0
- package/dist/{chunk-TVYH4AN7.js → chunk-ODRO3KS6.js} +13 -13
- package/dist/chunk-ODRO3KS6.js.map +1 -0
- package/dist/chunk-PU3QWBEL.js +39 -0
- package/dist/chunk-PU3QWBEL.js.map +1 -0
- package/dist/{chunk-4BSHB7R3.js → chunk-QDAN43B6.js} +9 -9
- package/dist/chunk-QDAN43B6.js.map +1 -0
- package/dist/{chunk-XNIYSAMJ.js → chunk-RW2A4M2Q.js} +14 -9
- package/dist/chunk-RW2A4M2Q.js.map +1 -0
- package/dist/{chunk-TUTXXC3W.js → chunk-RY35IU3G.js} +3 -3
- package/dist/{chunk-TUTXXC3W.js.map → chunk-RY35IU3G.js.map} +1 -1
- package/dist/{chunk-EAI4POPB.js → chunk-TBLPZQSI.js} +56 -50
- package/dist/chunk-TBLPZQSI.js.map +1 -0
- package/dist/{chunk-AADAJL7D.js → chunk-UKPX3RIP.js} +8 -9
- package/dist/chunk-UKPX3RIP.js.map +1 -0
- package/dist/chunk-VDOBLABP.js +38 -0
- package/dist/chunk-VDOBLABP.js.map +1 -0
- package/dist/chunk-VNVVG47J.js +12 -0
- package/dist/chunk-VNVVG47J.js.map +1 -0
- package/dist/{chunk-4C5RZXBT.js → chunk-VZXML7EH.js} +8 -8
- package/dist/chunk-VZXML7EH.js.map +1 -0
- package/dist/{chunk-43M6GQ4Q.js → chunk-WC45VSST.js} +51 -32
- package/dist/chunk-WC45VSST.js.map +1 -0
- package/dist/{chunk-3MPF7FZV.js → chunk-WCWV5IX6.js} +3 -3
- package/dist/{chunk-3MPF7FZV.js.map → chunk-WCWV5IX6.js.map} +1 -1
- package/dist/chunk-WQKWPI6V.js +196 -0
- package/dist/chunk-WQKWPI6V.js.map +1 -0
- package/dist/{chunk-VAXCXZ53.js → chunk-WZUTBJC4.js} +5 -4
- package/dist/chunk-WZUTBJC4.js.map +1 -0
- package/dist/chunk-ZHMOH62S.js +101 -0
- package/dist/chunk-ZHMOH62S.js.map +1 -0
- package/dist/cli.js +356 -28
- package/dist/collapse.css +21 -33
- package/dist/collapse.js +1 -1
- package/dist/confetti.css +20 -13
- package/dist/confetti.js +7 -6
- package/dist/confetti.js.map +1 -1
- package/dist/count-badge.js +2 -2
- package/dist/date-field.js +22 -19
- package/dist/date-field.js.map +1 -1
- package/dist/date-picker.css +287 -185
- package/dist/date-range-field.js +75 -59
- package/dist/date-range-field.js.map +1 -1
- package/dist/datetime-field.js +26 -23
- package/dist/datetime-field.js.map +1 -1
- package/dist/dialog.css +35 -44
- package/dist/dialog.js +23 -22
- package/dist/dialog.js.map +1 -1
- package/dist/digit-strip.css +17 -17
- package/dist/dropdown.css +37 -28
- package/dist/dropdown.js +77 -40
- package/dist/dropdown.js.map +1 -1
- package/dist/emoji-picker.js +44 -45
- package/dist/emoji-picker.js.map +1 -1
- package/dist/facebook-feed.css +146 -149
- package/dist/facebook-feed.js +106 -102
- package/dist/facebook-feed.js.map +1 -1
- package/dist/flow-field.css +9 -5
- package/dist/flow-field.js +8 -7
- package/dist/flow-field.js.map +1 -1
- package/dist/glide.js +4 -3
- package/dist/icon.css +8 -11
- package/dist/input.css +81 -86
- package/dist/instagram-feed.css +66 -67
- package/dist/instagram-feed.js +61 -44
- package/dist/instagram-feed.js.map +1 -1
- package/dist/lens.css +42 -39
- package/dist/lens.js +17 -16
- package/dist/lens.js.map +1 -1
- package/dist/mcp.js +4 -3
- package/dist/menu-surface.css +55 -35
- package/dist/modal.css +3 -5
- package/dist/modal.js +12 -11
- package/dist/modal.js.map +1 -1
- package/dist/morphing-text.css +27 -17
- package/dist/morphing-text.js +14 -13
- package/dist/morphing-text.js.map +1 -1
- package/dist/motion-devtools.css +118 -69
- package/dist/motion-devtools.js +230 -65
- package/dist/motion-devtools.js.map +1 -1
- package/dist/motion-tokens.js +1 -1
- package/dist/multi-select.js +21 -16
- package/dist/multi-select.js.map +1 -1
- package/dist/number-field.js +15 -15
- package/dist/number-field.js.map +1 -1
- package/dist/odometer.css +23 -17
- package/dist/odometer.js +12 -11
- package/dist/odometer.js.map +1 -1
- package/dist/otp-field.js +3 -3
- package/dist/otp-field.js.map +1 -1
- package/dist/overlay.css +5 -10
- package/dist/pagination.css +11 -16
- package/dist/pagination.js +13 -10
- package/dist/pagination.js.map +1 -1
- package/dist/paint-CJQCM6ZO.js +260 -0
- package/dist/paint-CJQCM6ZO.js.map +1 -0
- package/dist/popover.css +14 -16
- package/dist/popover.js +10 -9
- package/dist/radio-group.css +65 -76
- package/dist/radio-group.js +30 -29
- package/dist/radio-group.js.map +1 -1
- package/dist/select.css +67 -76
- package/dist/select.js +19 -14
- package/dist/select.js.map +1 -1
- package/dist/sheet.css +13 -15
- package/dist/sheet.js +11 -10
- package/dist/spinner.css +115 -0
- package/dist/spinner.js +4 -0
- package/dist/spinner.js.map +1 -0
- package/dist/status-badge.js +9 -9
- package/dist/status-badge.js.map +1 -1
- package/dist/styles.css +35 -35
- package/dist/support-rail.css +110 -256
- package/dist/support-rail.js +116 -123
- package/dist/support-rail.js.map +1 -1
- package/dist/table.css +77 -85
- package/dist/table.js +44 -41
- package/dist/table.js.map +1 -1
- package/dist/tabs.css +81 -93
- package/dist/tabs.js +23 -20
- package/dist/tabs.js.map +1 -1
- package/dist/tag.css +49 -54
- package/dist/tag.js +13 -12
- package/dist/tag.js.map +1 -1
- package/dist/text-field.js +5 -5
- package/dist/textarea.css +47 -50
- package/dist/textarea.js +16 -16
- package/dist/textarea.js.map +1 -1
- package/dist/theme-grid.js +11 -0
- package/dist/theme-grid.js.map +1 -0
- package/dist/theme-switcher.css +107 -0
- package/dist/theme-switcher.js +70 -0
- package/dist/theme-switcher.js.map +1 -0
- package/dist/theme-transition-LLC644ZR.js +346 -0
- package/dist/theme-transition-LLC644ZR.js.map +1 -0
- package/dist/theme-transition.css +48 -0
- package/dist/theme.js +74 -27
- package/dist/theme.js.map +1 -1
- package/dist/tide-DJZMDAFT.js +57 -0
- package/dist/tide-DJZMDAFT.js.map +1 -0
- package/dist/tiktok.css +114 -119
- package/dist/tiktok.js +53 -52
- package/dist/tiktok.js.map +1 -1
- package/dist/time-field.js +26 -20
- package/dist/time-field.js.map +1 -1
- package/dist/toast-store.js +2 -1
- package/dist/toast.css +51 -79
- package/dist/toast.js +34 -26
- package/dist/toast.js.map +1 -1
- package/dist/toggle-tag.js +23 -14
- package/dist/toggle-tag.js.map +1 -1
- package/dist/toggle.css +27 -32
- package/dist/toggle.js +7 -7
- package/dist/toggle.js.map +1 -1
- package/dist/tooltip.css +17 -24
- package/dist/tooltip.js +117 -95
- package/dist/tooltip.js.map +1 -1
- package/dist/trigger.css +4 -4
- package/dist/types/components/composites/alert/Alert.d.ts +1 -2
- package/dist/types/components/composites/date-picker/TimeField.d.ts +1 -2
- package/dist/types/components/composites/date-picker/field-shell.d.ts +1 -1
- package/dist/types/components/composites/date-picker/month-jump.d.ts +11 -0
- package/dist/types/components/composites/date-picker/time-core.d.ts +1 -2
- package/dist/types/components/composites/dropdown/Dropdown.d.ts +9 -1
- package/dist/types/components/composites/dropdown/types.d.ts +14 -0
- package/dist/types/components/composites/emoji-picker/EmojiPickerPanel.d.ts +1 -1
- package/dist/types/components/composites/emoji-picker/data.d.ts +2 -5
- package/dist/types/components/composites/emoji-picker/react/useEmojiPicker.d.ts +0 -11
- package/dist/types/components/composites/emoji-picker/types.d.ts +3 -8
- package/dist/types/components/composites/select/MultiSelect.d.ts +6 -1
- package/dist/types/components/composites/select/Select.d.ts +6 -1
- package/dist/types/components/composites/select/core/index.d.ts +1 -1
- package/dist/types/components/composites/select/core/menu.d.ts +3 -3
- package/dist/types/components/composites/select/core/panel.d.ts +3 -3
- package/dist/types/components/composites/tabs/Tabs.d.ts +7 -10
- package/dist/types/components/composites/theme-switcher/ThemeGrid.d.ts +20 -0
- package/dist/types/components/composites/theme-switcher/ThemeSwitcher.d.ts +24 -0
- package/dist/types/components/composites/toast/Toast.d.ts +1 -1
- package/dist/types/components/composites/tooltip/Tooltip.d.ts +9 -1
- package/dist/types/components/composites/tooltip/tooltip-store.d.ts +5 -6
- package/dist/types/components/compound/support-rail/SupportRail.d.ts +10 -8
- package/dist/types/components/dev/MotionDevtools.d.ts +12 -5
- package/dist/types/components/expressive/theme-transition/bloom.d.ts +2 -0
- package/dist/types/components/expressive/theme-transition/paint.d.ts +2 -0
- package/dist/types/components/expressive/theme-transition/scene.d.ts +24 -0
- package/dist/types/components/expressive/theme-transition/theme-transition.d.ts +19 -0
- package/dist/types/components/expressive/theme-transition/tide.d.ts +2 -0
- package/dist/types/components/internal/hooks/use-host-election.d.ts +8 -0
- package/dist/types/components/internal/icon/Icon.d.ts +2 -3
- package/dist/types/components/internal/menu/highlight.d.ts +7 -0
- package/dist/types/components/internal/utils/activation.d.ts +0 -4
- package/dist/types/components/primitives/avatar/Avatar.d.ts +1 -1
- package/dist/types/components/primitives/button/Button.d.ts +10 -13
- package/dist/types/components/primitives/button/button-style.d.ts +15 -0
- package/dist/types/components/primitives/input/TextField.d.ts +1 -2
- package/dist/types/components/primitives/spinner/Spinner.d.ts +27 -0
- package/dist/types/components/primitives/textarea/Textarea.d.ts +0 -1
- package/dist/types/engine/animate.d.ts +1 -0
- package/dist/types/shared-slot.d.ts +1 -0
- package/dist/types/tokens/component-styles.generated.d.ts +80 -155
- package/dist/types/tokens/motion-defaults.generated.d.ts +34 -0
- package/dist/types/tokens/motion-scale.d.ts +2 -2
- package/dist/types/tokens/motion-tokens.d.ts +7 -0
- package/dist/types/tokens/theme-store.d.ts +47 -0
- package/dist/types/tokens/theme-sync.d.ts +9 -0
- package/dist/types/tokens/theme-tokens.generated.d.ts +693 -1117
- package/dist/types/tokens/theme.d.ts +28 -5
- package/dist/typing-lines.css +18 -11
- package/dist/typing-lines.js +9 -8
- package/dist/typing-lines.js.map +1 -1
- package/dist/weight-field.css +32 -18
- package/dist/weight-field.js +4 -4
- package/dist/weight-field.js.map +1 -1
- package/dist/youtube.css +91 -97
- package/dist/youtube.js +87 -86
- package/dist/youtube.js.map +1 -1
- package/package.json +27 -31
- package/skills/zyncat-ui/SKILL.md +5 -3
- package/skills/zyncat-ui/references/components.md +7 -4
- package/skills/zyncat-ui/references/theming.md +105 -34
- package/src/components/composites/alert/Alert.tsx +15 -12
- package/src/components/composites/alert/alert.css +27 -34
- package/src/components/composites/date-picker/DateField.tsx +1 -1
- package/src/components/composites/date-picker/DateRangeField.tsx +1 -1
- package/src/components/composites/date-picker/DateTimeField.tsx +4 -4
- package/src/components/composites/date-picker/TimeField.tsx +8 -5
- package/src/components/composites/date-picker/calendar-panel.tsx +33 -22
- package/src/components/composites/date-picker/date-picker.css +287 -185
- package/src/components/composites/date-picker/field-shell.tsx +7 -7
- package/src/components/composites/date-picker/month-jump.tsx +192 -0
- package/src/components/composites/date-picker/range-panel.tsx +51 -36
- package/src/components/composites/date-picker/time-core.tsx +4 -6
- package/src/components/composites/date-picker/use-day-focus.ts +1 -1
- package/src/components/composites/dialog/Dialog.tsx +11 -11
- package/src/components/composites/dialog/dialog.css +35 -44
- package/src/components/composites/dropdown/Dropdown.tsx +15 -2
- package/src/components/composites/dropdown/Dropdown.usage.md +7 -4
- package/src/components/composites/dropdown/dropdown.css +37 -28
- package/src/components/composites/dropdown/menu-panel.tsx +56 -27
- package/src/components/composites/dropdown/types.ts +28 -6
- package/src/components/composites/emoji-picker/EmojiPickerPanel.tsx +5 -4
- package/src/components/composites/emoji-picker/EmojiPickerPanel.usage.md +4 -4
- package/src/components/composites/emoji-picker/data.ts +2 -5
- package/src/components/composites/emoji-picker/dom.ts +6 -6
- package/src/components/composites/emoji-picker/react/category-bar.tsx +6 -6
- package/src/components/composites/emoji-picker/react/useEmojiPicker.ts +0 -11
- package/src/components/composites/emoji-picker/scaffold.ts +7 -7
- package/src/components/composites/emoji-picker/search.ts +0 -7
- package/src/components/composites/emoji-picker/styles.css +35 -35
- package/src/components/composites/emoji-picker/types.ts +3 -8
- package/src/components/composites/modal/Modal.tsx +2 -2
- package/src/components/composites/modal/modal.css +3 -5
- package/src/components/composites/pagination/Pagination.tsx +7 -7
- package/src/components/composites/pagination/pagination.css +11 -16
- package/src/components/composites/popover/Popover.tsx +2 -2
- package/src/components/composites/popover/popover.css +14 -16
- package/src/components/composites/select/MultiSelect.tsx +11 -2
- package/src/components/composites/select/MultiSelect.usage.md +2 -1
- package/src/components/composites/select/Select.tsx +10 -1
- package/src/components/composites/select/Select.usage.md +2 -1
- package/src/components/composites/select/core/index.ts +1 -1
- package/src/components/composites/select/core/menu.tsx +19 -4
- package/src/components/composites/select/core/panel.tsx +19 -15
- package/src/components/composites/select/core/trigger.tsx +5 -5
- package/src/components/composites/select/select.css +67 -76
- package/src/components/composites/sheet/Sheet.tsx +2 -2
- package/src/components/composites/sheet/sheet.css +13 -15
- package/src/components/composites/sheet/use-sheet-drag.ts +1 -1
- package/src/components/composites/table/Table.tsx +35 -35
- package/src/components/composites/table/table.css +77 -85
- package/src/components/composites/tabs/Tabs.tsx +20 -21
- package/src/components/composites/tabs/Tabs.usage.md +3 -2
- package/src/components/composites/tabs/tabs.css +81 -93
- package/src/components/composites/theme-switcher/ThemeGrid.tsx +133 -0
- package/src/components/composites/theme-switcher/ThemeGrid.usage.md +20 -0
- package/src/components/composites/theme-switcher/ThemeSwitcher.tsx +75 -0
- package/src/components/composites/theme-switcher/ThemeSwitcher.usage.md +21 -0
- package/src/components/composites/theme-switcher/theme-switcher.css +107 -0
- package/src/components/composites/toast/Toast.tsx +24 -18
- package/src/components/composites/toast/toast-store.ts +8 -6
- package/src/components/composites/toast/toast.css +51 -79
- package/src/components/composites/tooltip/Tooltip.tsx +40 -19
- package/src/components/composites/tooltip/Tooltip.usage.md +9 -1
- package/src/components/composites/tooltip/tooltip-host.tsx +55 -23
- package/src/components/composites/tooltip/tooltip-store.ts +36 -53
- package/src/components/composites/tooltip/tooltip.css +17 -24
- package/src/components/compound/support-rail/SupportRail.tsx +132 -144
- package/src/components/compound/support-rail/SupportRail.usage.md +7 -6
- package/src/components/compound/support-rail/support-rail.css +110 -256
- package/src/components/dev/MotionDevtools.tsx +272 -51
- package/src/components/dev/MotionDevtools.usage.md +12 -4
- package/src/components/dev/motion-devtools.css +118 -69
- package/src/components/dev/slowmo-engine.ts +16 -15
- package/src/components/expressive/confetti/Confetti.tsx +4 -4
- package/src/components/expressive/confetti/confetti.css +20 -13
- package/src/components/expressive/facebook-feed/chrome.tsx +2 -2
- package/src/components/expressive/facebook-feed/facebook-feed.css +146 -149
- package/src/components/expressive/facebook-feed/post.tsx +39 -39
- package/src/components/expressive/facebook-feed/reel.tsx +41 -37
- package/src/components/expressive/facebook-feed/story.tsx +27 -27
- package/src/components/expressive/flow-field/FlowField.tsx +5 -5
- package/src/components/expressive/flow-field/flow-field.css +9 -5
- package/src/components/expressive/instagram-feed/InstagramFeed.tsx +52 -44
- package/src/components/expressive/instagram-feed/instagram-feed.css +66 -67
- package/src/components/expressive/lens/Lens.tsx +14 -14
- package/src/components/expressive/lens/lens.css +42 -39
- package/src/components/expressive/morphing-text/MorphingText.tsx +12 -13
- package/src/components/expressive/morphing-text/morphing-text.css +27 -17
- package/src/components/expressive/odometer/Odometer.tsx +9 -9
- package/src/components/expressive/odometer/odometer.css +23 -17
- package/src/components/expressive/theme-transition/bloom.ts +88 -0
- package/src/components/expressive/theme-transition/paint.ts +296 -0
- package/src/components/expressive/theme-transition/scene.ts +38 -0
- package/src/components/expressive/theme-transition/theme-transition.css +48 -0
- package/src/components/expressive/theme-transition/theme-transition.ts +423 -0
- package/src/components/expressive/theme-transition/tide.ts +65 -0
- package/src/components/expressive/tiktok/TikTok.tsx +54 -54
- package/src/components/expressive/tiktok/tiktok.css +114 -119
- package/src/components/expressive/typing-lines/TypingLines.tsx +0 -0
- package/src/components/expressive/typing-lines/typing-lines.css +18 -11
- package/src/components/expressive/weight-field/WeightField.tsx +4 -4
- package/src/components/expressive/weight-field/weight-field.css +32 -18
- package/src/components/expressive/youtube/YouTube.tsx +4 -4
- package/src/components/expressive/youtube/glyphs.tsx +16 -16
- package/src/components/expressive/youtube/media.tsx +3 -3
- package/src/components/expressive/youtube/post.tsx +28 -28
- package/src/components/expressive/youtube/short.tsx +25 -25
- package/src/components/expressive/youtube/video.tsx +13 -13
- package/src/components/expressive/youtube/youtube.css +91 -97
- package/src/components/internal/glass/glass.css +20 -23
- package/src/components/internal/glass/glint.ts +3 -3
- package/src/components/internal/hooks/use-host-election.ts +46 -0
- package/src/components/internal/icon/Icon.tsx +3 -5
- package/src/components/internal/icon/IconSlot.tsx +1 -1
- package/src/components/internal/icon/icon.css +8 -11
- package/src/components/internal/menu/highlight.ts +12 -0
- package/src/components/internal/menu/menu-row.tsx +5 -5
- package/src/components/internal/menu/menu-surface.css +55 -35
- package/src/components/internal/overlay/layer.tsx +2 -1
- package/src/components/internal/overlay/modal.tsx +5 -4
- package/src/components/internal/overlay/overlay.css +5 -10
- package/src/components/internal/overlay/trigger.css +4 -4
- package/src/components/internal/utils/activation.ts +0 -4
- package/src/components/primitives/avatar/Avatar.tsx +24 -8
- package/src/components/primitives/avatar/AvatarGroup.tsx +4 -4
- package/src/components/primitives/avatar/avatar.css +53 -51
- package/src/components/primitives/badge/Badge.tsx +9 -9
- package/src/components/primitives/badge/StatusBadge.tsx +7 -7
- package/src/components/primitives/badge/badge.css +31 -37
- package/src/components/primitives/badge/digit-strip.css +17 -17
- package/src/components/primitives/badge/digit-strip.tsx +4 -4
- package/src/components/primitives/button/Button.tsx +14 -28
- package/src/components/primitives/button/button-style.ts +28 -0
- package/src/components/primitives/button/button.css +99 -118
- package/src/components/primitives/checkbox/Checkbox.tsx +10 -4
- package/src/components/primitives/checkbox/check-glyph.tsx +5 -5
- package/src/components/primitives/checkbox/checkbox.css +28 -33
- package/src/components/primitives/collapse/Collapse.tsx +2 -2
- package/src/components/primitives/collapse/collapse.css +21 -33
- package/src/components/primitives/collapse/collapse.typecheck.tsx +1 -1
- package/src/components/primitives/input/NumberField.tsx +11 -11
- package/src/components/primitives/input/OtpField.tsx +3 -3
- package/src/components/primitives/input/TextField.tsx +9 -10
- package/src/components/primitives/input/field-chrome.tsx +6 -6
- package/src/components/primitives/input/input.css +81 -86
- package/src/components/primitives/radio-group/RadioGroup.tsx +23 -23
- package/src/components/primitives/radio-group/radio-group.css +65 -76
- package/src/components/primitives/spinner/Spinner.tsx +70 -0
- package/src/components/primitives/spinner/Spinner.usage.md +19 -0
- package/src/components/primitives/spinner/spinner.css +115 -0
- package/src/components/primitives/tag/Tag.tsx +5 -5
- package/src/components/primitives/tag/ToggleTag.tsx +11 -6
- package/src/components/primitives/tag/tag.css +49 -54
- package/src/components/primitives/textarea/Textarea.tsx +13 -14
- package/src/components/primitives/textarea/textarea.css +47 -50
- package/src/components/primitives/toggle/Toggle.tsx +7 -7
- package/src/components/primitives/toggle/toggle.css +27 -32
- package/src/engine/animate.ts +12 -3
- package/src/engine/flip.ts +2 -1
- package/src/mcp/server.ts +5 -2
- package/src/motion/flip.ts +7 -8
- package/src/motion/glide.tsx +41 -26
- package/src/shared-slot.ts +10 -0
- package/src/styles.css +8 -16
- package/src/tokens/base.css +15 -0
- package/src/tokens/color.css +22 -63
- package/src/tokens/component-styles.generated.ts +81 -155
- package/src/tokens/dark.css +58 -0
- package/src/tokens/decisions.css +23 -0
- package/src/tokens/elevation.css +65 -23
- package/src/tokens/fonts.css +0 -2
- package/src/tokens/glass.css +17 -10
- package/src/tokens/motion-defaults.generated.ts +21 -0
- package/src/tokens/motion-scale.ts +2 -2
- package/src/tokens/motion-tokens.ts +65 -40
- package/src/tokens/motion-tokens.usage.md +5 -2
- package/src/tokens/motion.css +18 -28
- package/src/tokens/radius.css +12 -10
- package/src/tokens/reset.css +36 -0
- package/src/tokens/semantic.css +51 -39
- package/src/tokens/spacing.css +6 -7
- package/src/tokens/theme-store.ts +187 -0
- package/src/tokens/theme-sync.tsx +62 -0
- package/src/tokens/theme-tokens.generated.ts +708 -1121
- package/src/tokens/theme.tsx +116 -38
- package/src/tokens/theme.usage.md +26 -19
- package/src/tokens/typography.css +18 -20
- package/tailwind.css +187 -0
- package/dist/chunk-227ZW4V7.js.map +0 -1
- package/dist/chunk-43M6GQ4Q.js.map +0 -1
- package/dist/chunk-4BSHB7R3.js.map +0 -1
- package/dist/chunk-4C5RZXBT.js.map +0 -1
- package/dist/chunk-5PZ43DCG.js.map +0 -1
- package/dist/chunk-7IZJERGA.js +0 -80
- package/dist/chunk-7IZJERGA.js.map +0 -1
- package/dist/chunk-AADAJL7D.js.map +0 -1
- package/dist/chunk-CNWTIMIP.js +0 -39
- package/dist/chunk-CNWTIMIP.js.map +0 -1
- package/dist/chunk-EAI4POPB.js.map +0 -1
- package/dist/chunk-EF6RPXU7.js.map +0 -1
- package/dist/chunk-FONOS5RN.js.map +0 -1
- package/dist/chunk-FQEHSKEI.js +0 -38
- package/dist/chunk-FQEHSKEI.js.map +0 -1
- package/dist/chunk-HY5MPISE.js +0 -52
- package/dist/chunk-HY5MPISE.js.map +0 -1
- package/dist/chunk-I45AU6KH.js.map +0 -1
- package/dist/chunk-IJS7TPGV.js.map +0 -1
- package/dist/chunk-OWNMRMPN.js +0 -14
- package/dist/chunk-OWNMRMPN.js.map +0 -1
- package/dist/chunk-RJFGWJ4W.js.map +0 -1
- package/dist/chunk-TCUCYFT7.js +0 -25
- package/dist/chunk-TCUCYFT7.js.map +0 -1
- package/dist/chunk-TVYH4AN7.js.map +0 -1
- package/dist/chunk-TYHR4VNM.js.map +0 -1
- package/dist/chunk-VAXCXZ53.js.map +0 -1
- package/dist/chunk-XNIYSAMJ.js.map +0 -1
- package/dist/chunk-Y2YA7QRF.js +0 -17
- package/dist/chunk-Y2YA7QRF.js.map +0 -1
- package/src/tokens/avatar.css +0 -24
- package/src/tokens/icons.css +0 -11
- package/src/tokens/layers.css +0 -11
|
@@ -0,0 +1,423 @@
|
|
|
1
|
+
import './theme-transition.css';
|
|
2
|
+
|
|
3
|
+
import { clock, loop } from '../../../engine';
|
|
4
|
+
import { UIMotion } from '../../../tokens/motion-tokens';
|
|
5
|
+
import { DEFAULT_THEME, getThemeSnapshot, type ThemeChange, type ThemeState } from '../../../tokens/theme-store';
|
|
6
|
+
import { type BloomShape, type EffectFactory, type Scene, type SweepDirection } from './scene';
|
|
7
|
+
|
|
8
|
+
export type ThemeTransitionEffect = 'tide' | 'paint' | `bloom-${BloomShape}`;
|
|
9
|
+
|
|
10
|
+
export interface ThemeTransitionOptions {
|
|
11
|
+
/**
|
|
12
|
+
* `tide` sweeps a wave across the page; `paint` throws splats that run together; `bloom-circle`,
|
|
13
|
+
* `bloom-hexagon`, `bloom-star`, `bloom-petal` and `bloom-blob` grow that outline from the
|
|
14
|
+
* pressed control.
|
|
15
|
+
*/
|
|
16
|
+
effect: ThemeTransitionEffect;
|
|
17
|
+
/** Divides the effect's own duration - `2` runs it twice as fast. @default 1 */
|
|
18
|
+
speed?: number;
|
|
19
|
+
/** Scales the wave, the relief and spin of the bloom outline and the size of the splats. @default 1 */
|
|
20
|
+
intensity?: number;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export type ThemeTransitionSetting = ThemeTransitionEffect | ThemeTransitionOptions;
|
|
24
|
+
|
|
25
|
+
interface Settings {
|
|
26
|
+
effect: ThemeTransitionEffect;
|
|
27
|
+
speed: number;
|
|
28
|
+
intensity: number;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
interface Run {
|
|
32
|
+
current: ThemeState;
|
|
33
|
+
next: ThemeState;
|
|
34
|
+
direction: 1 | -1;
|
|
35
|
+
finish(): void;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
interface Plan {
|
|
39
|
+
change: ThemeChange;
|
|
40
|
+
current: ThemeState;
|
|
41
|
+
settings: Settings;
|
|
42
|
+
factory: EffectFactory;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
interface Overlay {
|
|
46
|
+
root: HTMLElement;
|
|
47
|
+
inner: HTMLElement;
|
|
48
|
+
left: number;
|
|
49
|
+
top: number;
|
|
50
|
+
scrollX: number;
|
|
51
|
+
scrollY: number;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const SETTLING = 'data-theme-settling';
|
|
55
|
+
const LEAD = '[data-theme-lead]';
|
|
56
|
+
const ORIGIN_ABOVE_BOTTOM = 48;
|
|
57
|
+
const NEVER_CLONED = 'script, style, link, template, noscript, .zc-theme-transition';
|
|
58
|
+
const EMBEDS = 'iframe, video, object, embed';
|
|
59
|
+
const BLOOM_SHAPES: Partial<Record<ThemeTransitionEffect, BloomShape>> = {
|
|
60
|
+
'bloom-circle': 'circle',
|
|
61
|
+
'bloom-hexagon': 'hexagon',
|
|
62
|
+
'bloom-star': 'star',
|
|
63
|
+
'bloom-petal': 'petal',
|
|
64
|
+
'bloom-blob': 'blob',
|
|
65
|
+
};
|
|
66
|
+
const loadBloom = () => import('./bloom').then((module) => module.bloom);
|
|
67
|
+
const LOADERS: Record<ThemeTransitionEffect, () => Promise<EffectFactory>> = {
|
|
68
|
+
tide: () => import('./tide').then((module) => module.tide),
|
|
69
|
+
paint: () => import('./paint').then((module) => module.paint),
|
|
70
|
+
'bloom-circle': loadBloom,
|
|
71
|
+
'bloom-hexagon': loadBloom,
|
|
72
|
+
'bloom-star': loadBloom,
|
|
73
|
+
'bloom-petal': loadBloom,
|
|
74
|
+
'bloom-blob': loadBloom,
|
|
75
|
+
};
|
|
76
|
+
const loading = new Map<ThemeTransitionEffect, Promise<EffectFactory>>();
|
|
77
|
+
const ready = new Map<ThemeTransitionEffect, EffectFactory>();
|
|
78
|
+
|
|
79
|
+
const loadEffect = (effect: ThemeTransitionEffect) => {
|
|
80
|
+
let pending = loading.get(effect);
|
|
81
|
+
if (!pending) {
|
|
82
|
+
pending = LOADERS[effect]().then((factory) => {
|
|
83
|
+
ready.set(effect, factory);
|
|
84
|
+
return factory;
|
|
85
|
+
});
|
|
86
|
+
loading.set(effect, pending);
|
|
87
|
+
}
|
|
88
|
+
return pending;
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
const resolveSettings = (setting: ThemeTransitionSetting): Settings => {
|
|
92
|
+
const options = typeof setting === 'string' ? { effect: setting } : setting;
|
|
93
|
+
const effect = options.effect in LOADERS ? options.effect : 'tide';
|
|
94
|
+
const speed = Number(options.speed);
|
|
95
|
+
return {
|
|
96
|
+
effect,
|
|
97
|
+
speed: Number.isFinite(speed) && speed > 0 ? speed : 1,
|
|
98
|
+
intensity: Number.isFinite(Number(options.intensity)) ? Number(options.intensity) : 1,
|
|
99
|
+
};
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
export function preloadThemeTransition(setting: ThemeTransitionSetting): void {
|
|
103
|
+
void loadEffect(resolveSettings(setting).effect);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
const ACCENT_RAMP = 'var(--accent)';
|
|
107
|
+
|
|
108
|
+
type ThemeRoot = Pick<ThemeState, 'theme' | 'resolvedPolarity'>;
|
|
109
|
+
|
|
110
|
+
const markThemeRoot = (element: HTMLElement, state: ThemeRoot, ramp: string | null) => {
|
|
111
|
+
element.setAttribute('data-theme', state.theme);
|
|
112
|
+
element.setAttribute('data-polarity', state.resolvedPolarity);
|
|
113
|
+
if (ramp) element.style.setProperty('--neutral', ramp);
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
const probeOf = (state: ThemeRoot, ramp: string | null): HTMLSpanElement => {
|
|
117
|
+
const probe = document.body.appendChild(document.createElement('span'));
|
|
118
|
+
probe.className = 'zc-theme-transition__probe';
|
|
119
|
+
markThemeRoot(probe, state, ramp);
|
|
120
|
+
return probe;
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
const neutralOf = (element: Element) => getComputedStyle(element).getPropertyValue('--neutral').trim();
|
|
124
|
+
|
|
125
|
+
const rampOf = (next: ThemeState): string | null => {
|
|
126
|
+
const target = probeOf(next, null);
|
|
127
|
+
const pinned = neutralOf(target) !== neutralOf(document.documentElement);
|
|
128
|
+
target.remove();
|
|
129
|
+
if (pinned) return null;
|
|
130
|
+
const base = probeOf({ theme: DEFAULT_THEME, resolvedPolarity: next.resolvedPolarity }, null);
|
|
131
|
+
const tied = neutralOf(base) === getComputedStyle(base).getPropertyValue('--accent').trim();
|
|
132
|
+
base.remove();
|
|
133
|
+
return tied ? ACCENT_RAMP : null;
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
const originOf = (change: ThemeChange, width: number, height: number): [number, number] => {
|
|
137
|
+
if (change.origin) return [change.origin[0], change.origin[1]];
|
|
138
|
+
const focused = document.activeElement;
|
|
139
|
+
if (focused instanceof HTMLElement && focused.closest(LEAD)) {
|
|
140
|
+
const box = focused.getBoundingClientRect();
|
|
141
|
+
return [box.left + box.width / 2, box.top + box.height / 2];
|
|
142
|
+
}
|
|
143
|
+
return [width / 2, height - ORIGIN_ABOVE_BOTTOM];
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
const sameState = (a: ThemeState, b: ThemeState) => a.theme === b.theme && a.resolvedPolarity === b.resolvedPolarity;
|
|
147
|
+
|
|
148
|
+
const directionOf = (current: ThemeState, next: ThemeState): SweepDirection => {
|
|
149
|
+
if (current.resolvedPolarity !== next.resolvedPolarity) return next.resolvedPolarity === 'dark' ? 'down' : 'up';
|
|
150
|
+
return next.themes.indexOf(next.theme) > current.themes.indexOf(current.theme) ? 'right' : 'left';
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
const mirrorState = (live: Element, copy: Element) => {
|
|
154
|
+
if (live instanceof HTMLInputElement) {
|
|
155
|
+
const input = copy as HTMLInputElement;
|
|
156
|
+
input.value = live.value;
|
|
157
|
+
input.checked = live.checked;
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
if (live instanceof HTMLTextAreaElement) {
|
|
161
|
+
(copy as HTMLTextAreaElement).value = live.value;
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
if (live instanceof HTMLSelectElement) {
|
|
165
|
+
(copy as HTMLSelectElement).selectedIndex = live.selectedIndex;
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
if (live instanceof HTMLCanvasElement) {
|
|
169
|
+
try {
|
|
170
|
+
(copy as HTMLCanvasElement).getContext('2d')?.drawImage(live, 0, 0);
|
|
171
|
+
} catch {}
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
if (live.matches(EMBEDS)) {
|
|
175
|
+
const box = live.getBoundingClientRect();
|
|
176
|
+
const stand = document.createElement('div');
|
|
177
|
+
stand.className = copy.className;
|
|
178
|
+
stand.setAttribute(
|
|
179
|
+
'style',
|
|
180
|
+
`${copy.getAttribute('style') ?? ''};display:inline-block;width:${box.width}px;height:${box.height}px`,
|
|
181
|
+
);
|
|
182
|
+
copy.replaceWith(stand);
|
|
183
|
+
}
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
const RESERVED_KEYFRAME_KEYS = new Set(['offset', 'computedOffset', 'easing', 'composite']);
|
|
187
|
+
const THEMED_PROPERTY = /color|background|shadow|fill|stroke|outline|border-image|caret/;
|
|
188
|
+
const KEYFRAME_ALIASES: Record<string, string> = { cssOffset: 'offset', cssFloat: 'float' };
|
|
189
|
+
|
|
190
|
+
const propertyOf = (key: string) =>
|
|
191
|
+
KEYFRAME_ALIASES[key] ?? (key.startsWith('--') ? key : key.replace(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`));
|
|
192
|
+
|
|
193
|
+
const twinKey = (index: number, animation: CSSAnimation, pseudo: string | null) =>
|
|
194
|
+
`${index}|${animation.animationName}|${pseudo ?? ''}`;
|
|
195
|
+
|
|
196
|
+
const unthemedKeyframes = (effect: KeyframeEffect): Keyframe[] | null => {
|
|
197
|
+
let carries = false;
|
|
198
|
+
const frames = effect.getKeyframes().map((keyframe) => {
|
|
199
|
+
const frame: Keyframe = { offset: keyframe.computedOffset, easing: keyframe.easing, composite: keyframe.composite };
|
|
200
|
+
for (const key of Object.keys(keyframe)) {
|
|
201
|
+
if (RESERVED_KEYFRAME_KEYS.has(key) || THEMED_PROPERTY.test(propertyOf(key))) continue;
|
|
202
|
+
frame[key] = keyframe[key];
|
|
203
|
+
carries = true;
|
|
204
|
+
}
|
|
205
|
+
return frame;
|
|
206
|
+
});
|
|
207
|
+
return carries ? frames : null;
|
|
208
|
+
};
|
|
209
|
+
|
|
210
|
+
const replicate = (target: Element, effect: KeyframeEffect): Animation | null => {
|
|
211
|
+
const frames = unthemedKeyframes(effect);
|
|
212
|
+
if (!frames) return null;
|
|
213
|
+
const { duration } = effect.getComputedTiming();
|
|
214
|
+
return target.animate(frames, {
|
|
215
|
+
...effect.getTiming(),
|
|
216
|
+
duration: typeof duration === 'number' ? duration : 0,
|
|
217
|
+
composite: effect.composite,
|
|
218
|
+
pseudoElement: effect.pseudoElement,
|
|
219
|
+
});
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
const pace = (twin: Animation, lead: Animation) => {
|
|
223
|
+
if (lead.currentTime === null) return;
|
|
224
|
+
twin.playbackRate = lead.playbackRate;
|
|
225
|
+
twin.currentTime = lead.currentTime;
|
|
226
|
+
if (lead.playState === 'paused') twin.pause();
|
|
227
|
+
};
|
|
228
|
+
|
|
229
|
+
const finishable = (animation: Animation) => {
|
|
230
|
+
const rate = animation.playbackRate;
|
|
231
|
+
return rate < 0 || (rate > 0 && animation.effect?.getComputedTiming().endTime !== Infinity);
|
|
232
|
+
};
|
|
233
|
+
|
|
234
|
+
const syncAnimations = (live: NodeListOf<Element>, copy: NodeListOf<Element>) => {
|
|
235
|
+
const liveIndex = new Map<Element, number>();
|
|
236
|
+
const copyIndex = new Map<Element, number>();
|
|
237
|
+
live.forEach((element, index) => liveIndex.set(element, index));
|
|
238
|
+
copy.forEach((element, index) => copyIndex.set(element, index));
|
|
239
|
+
const animations = document.getAnimations();
|
|
240
|
+
const twins = new Map<string, CSSAnimation>();
|
|
241
|
+
const orphans = new Set<CSSAnimation>();
|
|
242
|
+
for (const animation of animations) {
|
|
243
|
+
const effect = animation.effect;
|
|
244
|
+
if (!(animation instanceof CSSAnimation) || !(effect instanceof KeyframeEffect) || !effect.target) continue;
|
|
245
|
+
const index = copyIndex.get(effect.target);
|
|
246
|
+
if (index === undefined) continue;
|
|
247
|
+
twins.set(twinKey(index, animation, effect.pseudoElement), animation);
|
|
248
|
+
orphans.add(animation);
|
|
249
|
+
}
|
|
250
|
+
for (const animation of animations) {
|
|
251
|
+
const effect = animation.effect;
|
|
252
|
+
if (!(effect instanceof KeyframeEffect) || !effect.target) continue;
|
|
253
|
+
const index = liveIndex.get(effect.target);
|
|
254
|
+
if (index === undefined) continue;
|
|
255
|
+
if (animation instanceof CSSAnimation) {
|
|
256
|
+
const twin = twins.get(twinKey(index, animation, effect.pseudoElement));
|
|
257
|
+
if (!twin) continue;
|
|
258
|
+
orphans.delete(twin);
|
|
259
|
+
pace(twin, animation);
|
|
260
|
+
} else {
|
|
261
|
+
const replica = replicate(copy[index], effect);
|
|
262
|
+
if (replica) pace(replica, animation);
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
for (const orphan of orphans) if (finishable(orphan)) orphan.finish();
|
|
266
|
+
};
|
|
267
|
+
|
|
268
|
+
const buildOverlay = (next: ThemeState, clip: string, ramp: string | null): Overlay => {
|
|
269
|
+
const body = document.body;
|
|
270
|
+
const inner = body.cloneNode(true) as HTMLElement;
|
|
271
|
+
const live = body.querySelectorAll('*');
|
|
272
|
+
const copy = inner.querySelectorAll('*');
|
|
273
|
+
const scrolled: [Element, number, number][] = [];
|
|
274
|
+
for (let i = 0; i < live.length; i++) {
|
|
275
|
+
const source = live[i];
|
|
276
|
+
if (source.scrollTop || source.scrollLeft) scrolled.push([copy[i], source.scrollTop, source.scrollLeft]);
|
|
277
|
+
mirrorState(source, copy[i]);
|
|
278
|
+
}
|
|
279
|
+
for (const dead of inner.querySelectorAll(NEVER_CLONED)) dead.remove();
|
|
280
|
+
inner.classList.add('zc-theme-transition__inner');
|
|
281
|
+
const box = body.getBoundingClientRect();
|
|
282
|
+
inner.style.cssText += `;position:absolute;left:${box.left}px;top:${box.top}px;width:${box.width}px;margin:0`;
|
|
283
|
+
const root = document.createElement('div');
|
|
284
|
+
root.className = 'zc-theme-transition';
|
|
285
|
+
markThemeRoot(root, next, ramp);
|
|
286
|
+
root.setAttribute('aria-hidden', 'true');
|
|
287
|
+
root.setAttribute('inert', '');
|
|
288
|
+
root.style.clipPath = clip;
|
|
289
|
+
root.appendChild(inner);
|
|
290
|
+
body.appendChild(root);
|
|
291
|
+
syncAnimations(live, copy);
|
|
292
|
+
for (const [element, top, left] of scrolled) {
|
|
293
|
+
element.scrollTop = top;
|
|
294
|
+
element.scrollLeft = left;
|
|
295
|
+
}
|
|
296
|
+
return { root, inner, left: box.left, top: box.top, scrollX: window.scrollX, scrollY: window.scrollY };
|
|
297
|
+
};
|
|
298
|
+
|
|
299
|
+
let active: Run | null = null;
|
|
300
|
+
|
|
301
|
+
const build = (run: Run, { change, current, settings, factory }: Plan) => {
|
|
302
|
+
const { next } = change;
|
|
303
|
+
const root = document.documentElement;
|
|
304
|
+
const width = root.clientWidth;
|
|
305
|
+
const height = root.clientHeight;
|
|
306
|
+
const [originX, originY] = originOf(change, width, height);
|
|
307
|
+
const ramp = rampOf(next);
|
|
308
|
+
const scene: Scene = {
|
|
309
|
+
width,
|
|
310
|
+
height,
|
|
311
|
+
originX,
|
|
312
|
+
originY,
|
|
313
|
+
kind: current.resolvedPolarity === next.resolvedPolarity ? 'palette' : 'polarity',
|
|
314
|
+
direction: directionOf(current, next),
|
|
315
|
+
intensity: settings.intensity,
|
|
316
|
+
shape: BLOOM_SHAPES[settings.effect] ?? 'circle',
|
|
317
|
+
};
|
|
318
|
+
const effect = factory(scene);
|
|
319
|
+
const total = effect.duration / settings.speed;
|
|
320
|
+
const overlay = buildOverlay(next, effect.clips[0], ramp);
|
|
321
|
+
const reveal = overlay.root.animate(
|
|
322
|
+
effect.clips.map((clipPath) => ({ clipPath })),
|
|
323
|
+
{ duration: total, easing: 'linear', fill: 'both' },
|
|
324
|
+
);
|
|
325
|
+
|
|
326
|
+
let done = false;
|
|
327
|
+
const rateOf = () => run.direction / clock.scale;
|
|
328
|
+
reveal.playbackRate = rateOf();
|
|
329
|
+
|
|
330
|
+
const follow = () => {
|
|
331
|
+
overlay.inner.style.left = `${overlay.left + overlay.scrollX - window.scrollX}px`;
|
|
332
|
+
overlay.inner.style.top = `${overlay.top + overlay.scrollY - window.scrollY}px`;
|
|
333
|
+
};
|
|
334
|
+
const resize = () => {
|
|
335
|
+
const box = document.body.getBoundingClientRect();
|
|
336
|
+
overlay.left = box.left;
|
|
337
|
+
overlay.top = box.top;
|
|
338
|
+
overlay.scrollX = window.scrollX;
|
|
339
|
+
overlay.scrollY = window.scrollY;
|
|
340
|
+
overlay.inner.style.width = `${box.width}px`;
|
|
341
|
+
follow();
|
|
342
|
+
};
|
|
343
|
+
const onVisibility = () => {
|
|
344
|
+
if (document.visibilityState === 'hidden') finish();
|
|
345
|
+
};
|
|
346
|
+
|
|
347
|
+
const release = () => {
|
|
348
|
+
window.removeEventListener('scroll', follow);
|
|
349
|
+
window.removeEventListener('resize', resize);
|
|
350
|
+
document.removeEventListener('visibilitychange', onVisibility);
|
|
351
|
+
overlay.root.remove();
|
|
352
|
+
if (active === run) active = null;
|
|
353
|
+
};
|
|
354
|
+
|
|
355
|
+
const finish = () => {
|
|
356
|
+
if (done) return;
|
|
357
|
+
done = true;
|
|
358
|
+
playback.stop();
|
|
359
|
+
reveal.cancel();
|
|
360
|
+
overlay.root.style.clipPath = 'none';
|
|
361
|
+
root.setAttribute(SETTLING, '');
|
|
362
|
+
change.commit();
|
|
363
|
+
void document.body.offsetWidth;
|
|
364
|
+
root.removeAttribute(SETTLING);
|
|
365
|
+
release();
|
|
366
|
+
};
|
|
367
|
+
|
|
368
|
+
const cancel = () => {
|
|
369
|
+
if (done) return;
|
|
370
|
+
done = true;
|
|
371
|
+
playback.stop();
|
|
372
|
+
reveal.cancel();
|
|
373
|
+
release();
|
|
374
|
+
change.revert();
|
|
375
|
+
};
|
|
376
|
+
|
|
377
|
+
const playback = loop(() => {
|
|
378
|
+
const rate = rateOf();
|
|
379
|
+
if (reveal.playbackRate !== rate) reveal.playbackRate = rate;
|
|
380
|
+
});
|
|
381
|
+
|
|
382
|
+
reveal.finished.then(
|
|
383
|
+
() => (run.direction > 0 ? finish() : cancel()),
|
|
384
|
+
() => {},
|
|
385
|
+
);
|
|
386
|
+
run.finish = finish;
|
|
387
|
+
|
|
388
|
+
window.addEventListener('scroll', follow, { passive: true });
|
|
389
|
+
window.addEventListener('resize', resize);
|
|
390
|
+
document.addEventListener('visibilitychange', onVisibility);
|
|
391
|
+
};
|
|
392
|
+
|
|
393
|
+
const start = (plan: Plan): Run => {
|
|
394
|
+
const run: Run = { current: plan.current, next: plan.change.next, direction: 1, finish: () => {} };
|
|
395
|
+
queueMicrotask(() => {
|
|
396
|
+
if (active === run) build(run, plan);
|
|
397
|
+
});
|
|
398
|
+
return run;
|
|
399
|
+
};
|
|
400
|
+
|
|
401
|
+
export function runThemeTransition(change: ThemeChange, setting: ThemeTransitionSetting): void {
|
|
402
|
+
const { next } = change;
|
|
403
|
+
if (active) {
|
|
404
|
+
if (sameState(active.next, next)) {
|
|
405
|
+
active.direction = 1;
|
|
406
|
+
return;
|
|
407
|
+
}
|
|
408
|
+
if (sameState(active.current, next)) {
|
|
409
|
+
active.direction = -1;
|
|
410
|
+
return;
|
|
411
|
+
}
|
|
412
|
+
active.finish();
|
|
413
|
+
}
|
|
414
|
+
const current = getThemeSnapshot();
|
|
415
|
+
const settings = resolveSettings(setting);
|
|
416
|
+
const factory = ready.get(settings.effect);
|
|
417
|
+
if (!factory) void loadEffect(settings.effect);
|
|
418
|
+
if (!factory || sameState(current, next) || UIMotion.reduced || document.visibilityState === 'hidden') {
|
|
419
|
+
change.commit();
|
|
420
|
+
return;
|
|
421
|
+
}
|
|
422
|
+
active = start({ change, current, settings, factory });
|
|
423
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { easeInOut, easeOut, sample, SAMPLE_MS, TAU, type EffectFactory } from './scene';
|
|
2
|
+
|
|
3
|
+
const DURATION = { polarity: 1250, palette: 560 };
|
|
4
|
+
const POINTS = 72;
|
|
5
|
+
const POLARITY_WAVE = { heightShare: 0.085, maxAmplitude: 96, margin: 24 };
|
|
6
|
+
const PALETTE_WAVE = { widthShare: 0.02, maxAmplitude: 26, tiltShare: 0.16, margin: 16 };
|
|
7
|
+
const REST_AMPLITUDE = 0.3;
|
|
8
|
+
|
|
9
|
+
const waveOf = (points: string[], close: string) => `path("M${points.join(' L')} ${close}")`;
|
|
10
|
+
|
|
11
|
+
export const tide: EffectFactory = (scene) => {
|
|
12
|
+
const { width: W, height: H, kind, direction } = scene;
|
|
13
|
+
const intensity = Math.max(0, scene.intensity);
|
|
14
|
+
|
|
15
|
+
const polarityFrame = (p: number, t: number) => {
|
|
16
|
+
const points: string[] = [];
|
|
17
|
+
const e = easeInOut(p);
|
|
18
|
+
const env = Math.sin(Math.PI * p);
|
|
19
|
+
const A0 = Math.min(H * POLARITY_WAVE.heightShare, POLARITY_WAVE.maxAmplitude) * intensity;
|
|
20
|
+
const amp = A0 * (REST_AMPLITUDE + (1 - REST_AMPLITUDE) * env);
|
|
21
|
+
const m = A0 + POLARITY_WAVE.margin;
|
|
22
|
+
const span = H + 2 * m;
|
|
23
|
+
const down = direction === 'down';
|
|
24
|
+
const front = down ? -m + e * span : H + m - e * span;
|
|
25
|
+
for (let i = 0; i <= POINTS; i++) {
|
|
26
|
+
const u = i / POINTS;
|
|
27
|
+
const y =
|
|
28
|
+
front +
|
|
29
|
+
amp *
|
|
30
|
+
(Math.sin(u * TAU * 1.15 + t * 0.0012) +
|
|
31
|
+
0.55 * Math.sin(u * TAU * 2.35 - t * 0.0019 + 1.7) +
|
|
32
|
+
0.22 * Math.sin(u * TAU * 4.1 + t * 0.0031));
|
|
33
|
+
points.push(`${(W * u).toFixed(1)} ${y.toFixed(1)}`);
|
|
34
|
+
}
|
|
35
|
+
return waveOf(points, down ? `L${W} 0 L0 0Z` : `L${W} ${H} L0 ${H}Z`);
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
const paletteFrame = (p: number, t: number) => {
|
|
39
|
+
const points: string[] = [];
|
|
40
|
+
const e = easeOut(p);
|
|
41
|
+
const env = Math.sin(Math.PI * p);
|
|
42
|
+
const A0 = Math.min(W * PALETTE_WAVE.widthShare, PALETTE_WAVE.maxAmplitude) * intensity;
|
|
43
|
+
const amp = A0 * (REST_AMPLITUDE + (1 - REST_AMPLITUDE) * env);
|
|
44
|
+
const tilt = H * PALETTE_WAVE.tiltShare;
|
|
45
|
+
const m = A0 + tilt / 2 + PALETTE_WAVE.margin;
|
|
46
|
+
const span = W + 2 * m;
|
|
47
|
+
const right = direction === 'right';
|
|
48
|
+
const front = right ? -m + e * span : W + m - e * span;
|
|
49
|
+
const sign = right ? 1 : -1;
|
|
50
|
+
for (let i = 0; i <= POINTS; i++) {
|
|
51
|
+
const v = i / POINTS;
|
|
52
|
+
const x =
|
|
53
|
+
front +
|
|
54
|
+
(v - 0.5) * tilt * sign +
|
|
55
|
+
amp * (Math.sin(v * TAU * 1.3 + t * 0.002) + 0.5 * Math.sin(v * TAU * 2.8 - t * 0.003 + 1));
|
|
56
|
+
points.push(`${x.toFixed(1)} ${(H * v).toFixed(1)}`);
|
|
57
|
+
}
|
|
58
|
+
return waveOf(points, right ? `L0 ${H} L0 0Z` : `L${W} ${H} L${W} 0Z`);
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
return {
|
|
62
|
+
duration: DURATION[kind],
|
|
63
|
+
clips: sample(DURATION[kind], SAMPLE_MS, kind === 'polarity' ? polarityFrame : paletteFrame),
|
|
64
|
+
};
|
|
65
|
+
};
|