@zyncat/ui 0.15.0 → 0.18.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 +32 -202
- package/dist/alert.css +1 -1
- package/dist/alert.js +18 -10
- package/dist/alert.js.map +1 -1
- package/dist/avatar.css +3 -2
- package/dist/badge.css +1 -1
- package/dist/bloom-HV23M4AW.js +81 -0
- package/dist/bloom-HV23M4AW.js.map +1 -0
- package/dist/button.css +38 -31
- package/dist/button.js +4 -1
- package/dist/checkbox.css +1 -1
- package/dist/{chunk-5W5TKANX.js → chunk-2DNKZ57E.js} +3 -3
- package/dist/{chunk-5W5TKANX.js.map → chunk-2DNKZ57E.js.map} +1 -1
- package/dist/chunk-2YGHPQ66.js +16 -0
- package/dist/chunk-2YGHPQ66.js.map +1 -0
- package/dist/{chunk-N2GJEO5Z.js → chunk-6H3IJ752.js} +24 -9
- package/dist/chunk-6H3IJ752.js.map +1 -0
- package/dist/chunk-7NHY2CRA.js +132 -0
- package/dist/chunk-7NHY2CRA.js.map +1 -0
- package/dist/{chunk-PWQVSVXR.js → chunk-AIAPXRCI.js} +20 -19
- package/dist/chunk-AIAPXRCI.js.map +1 -0
- package/dist/{chunk-K45CWVHS.js → chunk-BRKGYLEQ.js} +12 -9
- package/dist/chunk-BRKGYLEQ.js.map +1 -0
- package/dist/{chunk-MDSRZ4QR.js → chunk-C3D32LE3.js} +6 -5
- package/dist/chunk-C3D32LE3.js.map +1 -0
- package/dist/chunk-F2TB3TT6.js +103 -0
- package/dist/chunk-F2TB3TT6.js.map +1 -0
- package/dist/{chunk-FVPNICF4.js → chunk-F64Z42PJ.js} +6 -6
- package/dist/{chunk-FVPNICF4.js.map → chunk-F64Z42PJ.js.map} +1 -1
- package/dist/{chunk-QGVFFT2B.js → chunk-HBWRKEW4.js} +3 -3
- package/dist/{chunk-QGVFFT2B.js.map → chunk-HBWRKEW4.js.map} +1 -1
- package/dist/{chunk-CAXQJSIE.js → chunk-JINATP4N.js} +13 -13
- package/dist/chunk-JINATP4N.js.map +1 -0
- package/dist/chunk-KSAJ6DED.js +16 -0
- package/dist/chunk-KSAJ6DED.js.map +1 -0
- package/dist/{chunk-BH4JFWXQ.js → chunk-M2KGLH2G.js} +19 -16
- package/dist/chunk-M2KGLH2G.js.map +1 -0
- package/dist/{chunk-6X3G4GIM.js → chunk-N43NDSME.js} +3 -3
- package/dist/{chunk-6X3G4GIM.js.map → chunk-N43NDSME.js.map} +1 -1
- package/dist/chunk-NYQQH4R5.js +40 -0
- package/dist/chunk-NYQQH4R5.js.map +1 -0
- package/dist/{chunk-BTF6DAE3.js → chunk-ODRO3KS6.js} +4 -4
- package/dist/{chunk-BTF6DAE3.js.map → chunk-ODRO3KS6.js.map} +1 -1
- package/dist/chunk-PXQBJMPJ.js +50 -0
- package/dist/chunk-PXQBJMPJ.js.map +1 -0
- package/dist/{chunk-GJTHWB6O.js → chunk-QDAN43B6.js} +3 -3
- package/dist/{chunk-GJTHWB6O.js.map → chunk-QDAN43B6.js.map} +1 -1
- package/dist/{chunk-RBSHRRNO.js → chunk-RJENXXTI.js} +5 -5
- package/dist/{chunk-RBSHRRNO.js.map → chunk-RJENXXTI.js.map} +1 -1
- package/dist/chunk-RLNCRDAL.js +89 -0
- package/dist/chunk-RLNCRDAL.js.map +1 -0
- package/dist/{chunk-GOLSYGRA.js → chunk-TBLPZQSI.js} +84 -48
- package/dist/chunk-TBLPZQSI.js.map +1 -0
- package/dist/{chunk-WZUTBJC4.js → chunk-TDHLZY6I.js} +23 -5
- package/dist/chunk-TDHLZY6I.js.map +1 -0
- package/dist/chunk-TP2AC5MQ.js +13 -0
- package/dist/chunk-TP2AC5MQ.js.map +1 -0
- package/dist/chunk-TRPAKUIB.js +196 -0
- package/dist/chunk-TRPAKUIB.js.map +1 -0
- package/dist/{chunk-5X3MJRIM.js → chunk-UKPX3RIP.js} +3 -3
- package/dist/{chunk-5X3MJRIM.js.map → chunk-UKPX3RIP.js.map} +1 -1
- package/dist/{chunk-5GBV45YD.js → chunk-V6QAAOA5.js} +3 -3
- package/dist/{chunk-5GBV45YD.js.map → chunk-V6QAAOA5.js.map} +1 -1
- package/dist/{chunk-FLQVOSFC.js → chunk-VJXP256V.js} +10 -10
- package/dist/chunk-VJXP256V.js.map +1 -0
- package/dist/{chunk-IUQAUBVM.js → chunk-VQFILXQN.js} +5 -5
- package/dist/chunk-VQFILXQN.js.map +1 -0
- package/dist/{chunk-CFRGQJ23.js → chunk-VZXML7EH.js} +4 -4
- package/dist/{chunk-CFRGQJ23.js.map → chunk-VZXML7EH.js.map} +1 -1
- package/dist/{chunk-FEXUS4SV.js → chunk-XKDR22VE.js} +11 -5
- package/dist/chunk-XKDR22VE.js.map +1 -0
- package/dist/cli.js +262 -45
- package/dist/collapse.css +8 -5
- package/dist/confetti.css +3 -3
- package/dist/confetti.js +2 -2
- package/dist/date-field.js +20 -18
- package/dist/date-field.js.map +1 -1
- package/dist/date-picker.css +168 -43
- package/dist/date-range-field.js +42 -27
- package/dist/date-range-field.js.map +1 -1
- package/dist/datetime-field.js +21 -19
- package/dist/datetime-field.js.map +1 -1
- package/dist/dialog.css +4 -3
- package/dist/dialog.js +12 -12
- package/dist/dialog.js.map +1 -1
- package/dist/digit-strip.css +1 -1
- package/dist/dropdown.css +1 -1
- package/dist/dropdown.js +16 -16
- package/dist/dropdown.js.map +1 -1
- package/dist/emoji-picker.js +41 -26
- package/dist/emoji-picker.js.map +1 -1
- package/dist/facebook-feed.css +1 -1
- package/dist/flow-field.css +4 -4
- package/dist/flow-field.js +3 -3
- package/dist/flow-field.js.map +1 -1
- package/dist/glide.js +3 -3
- package/dist/icon.css +1 -1
- package/dist/input.css +7 -4
- package/dist/instagram-feed.css +1 -1
- package/dist/instagram-feed.js +2 -2
- package/dist/lens.css +1 -2
- package/dist/lens.js +2 -2
- package/dist/mcp.js +1 -1
- package/dist/menu-surface.css +1 -1
- package/dist/modal.css +1 -1
- package/dist/modal.js +10 -10
- package/dist/modal.js.map +1 -1
- package/dist/morphing-text.css +2 -2
- package/dist/morphing-text.js +2 -2
- package/dist/motion-devtools.css +77 -2
- package/dist/motion-devtools.js +194 -37
- package/dist/motion-devtools.js.map +1 -1
- package/dist/motion-tokens.js +1 -1
- package/dist/multi-select.js +12 -12
- package/dist/number-field.js +3 -3
- package/dist/odometer.css +1 -1
- package/dist/odometer.js +2 -2
- package/dist/overlay.css +1 -1
- package/dist/pagination.css +1 -1
- package/dist/pagination.js +6 -4
- 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 +1 -1
- package/dist/popover.js +10 -10
- package/dist/radio-group.css +6 -4
- package/dist/radio-group.js +6 -6
- package/dist/select.css +1 -1
- package/dist/select.js +12 -12
- package/dist/sheet.css +1 -1
- package/dist/sheet.js +9 -9
- package/dist/spinner.css +115 -0
- package/dist/spinner.js +4 -0
- package/dist/spinner.js.map +1 -0
- package/dist/status-badge.js +2 -2
- package/dist/styles.css +1 -1
- package/dist/support-rail.css +76 -238
- package/dist/support-rail.js +99 -107
- package/dist/support-rail.js.map +1 -1
- package/dist/table.css +2 -2
- package/dist/table.js +8 -6
- package/dist/table.js.map +1 -1
- package/dist/tabs.css +10 -14
- package/dist/tabs.js +17 -11
- package/dist/tabs.js.map +1 -1
- package/dist/tag.css +1 -1
- package/dist/tag.js +6 -6
- package/dist/text-field.js +3 -3
- package/dist/textarea.css +1 -1
- package/dist/textarea.js +2 -2
- 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-VGLPZDJI.js +346 -0
- package/dist/theme-transition-VGLPZDJI.js.map +1 -0
- package/dist/theme-transition.css +48 -0
- package/dist/theme.js +57 -26
- 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 +2 -3
- package/dist/tiktok.js +2 -2
- package/dist/time-field.js +4 -4
- package/dist/toast.css +2 -14
- package/dist/toast.js +12 -10
- package/dist/toast.js.map +1 -1
- package/dist/toggle-tag.js +2 -2
- package/dist/toggle.css +1 -1
- package/dist/tooltip.css +1 -1
- package/dist/tooltip.js +25 -22
- package/dist/tooltip.js.map +1 -1
- package/dist/trigger.css +1 -1
- package/dist/types/components/composites/date-picker/month-jump.d.ts +11 -0
- 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/compound/support-rail/SupportRail.d.ts +10 -8
- package/dist/types/components/dev/MotionDevtools.d.ts +10 -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-press-feedback.d.ts +7 -0
- package/dist/types/components/internal/icon/Icon.d.ts +1 -0
- package/dist/types/components/internal/overlay/layer.d.ts +7 -1
- package/dist/types/components/internal/utils/token-px.d.ts +1 -1
- package/dist/types/components/primitives/button/Button.d.ts +9 -12
- package/dist/types/components/primitives/button/button-style.d.ts +15 -0
- package/dist/types/components/primitives/spinner/Spinner.d.ts +27 -0
- package/dist/types/engine/animate.d.ts +1 -0
- package/dist/types/motion/motion-timing.d.ts +1 -1
- package/dist/types/tokens/component-styles.generated.d.ts +35 -38
- package/dist/types/tokens/motion-tokens.d.ts +5 -3
- package/dist/types/tokens/theme-store.d.ts +47 -0
- package/dist/types/tokens/theme-sync.d.ts +7 -1
- package/dist/types/tokens/theme-tokens.generated.d.ts +125 -115
- package/dist/types/tokens/theme.d.ts +28 -5
- package/dist/typing-lines.css +1 -1
- package/dist/typing-lines.js +2 -2
- package/dist/typing-lines.js.map +1 -1
- package/dist/weight-field.css +2 -2
- package/dist/youtube.css +1 -1
- package/dist/youtube.js +2 -2
- package/package.json +20 -24
- package/skills/zyncat-ui/SKILL.md +1 -1
- package/skills/zyncat-ui/references/components.md +5 -2
- package/skills/zyncat-ui/references/theming.md +31 -23
- package/src/components/composites/alert/Alert.tsx +7 -3
- package/src/components/composites/alert/alert.css +1 -1
- package/src/components/composites/date-picker/calendar-panel.tsx +10 -4
- package/src/components/composites/date-picker/date-picker.css +168 -43
- package/src/components/composites/date-picker/month-jump.tsx +192 -0
- package/src/components/composites/date-picker/range-panel.tsx +20 -5
- package/src/components/composites/dialog/Dialog.tsx +2 -2
- package/src/components/composites/dialog/dialog.css +4 -3
- package/src/components/composites/dropdown/Dropdown.tsx +5 -5
- package/src/components/composites/dropdown/dropdown.css +1 -1
- package/src/components/composites/emoji-picker/react/category-bar.tsx +17 -5
- package/src/components/composites/emoji-picker/scaffold.ts +6 -5
- package/src/components/composites/emoji-picker/styles.css +1 -1
- package/src/components/composites/modal/Modal.tsx +2 -2
- package/src/components/composites/modal/modal.css +1 -1
- package/src/components/composites/pagination/pagination.css +1 -1
- package/src/components/composites/popover/Popover.tsx +5 -5
- package/src/components/composites/popover/popover.css +1 -1
- package/src/components/composites/select/core/menu.tsx +15 -10
- package/src/components/composites/select/select.css +1 -1
- package/src/components/composites/sheet/Sheet.tsx +2 -2
- package/src/components/composites/sheet/sheet.css +1 -1
- package/src/components/composites/table/table.css +2 -2
- package/src/components/composites/tabs/Tabs.tsx +13 -7
- package/src/components/composites/tabs/tabs.css +10 -14
- 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 +2 -1
- package/src/components/composites/toast/toast.css +2 -14
- package/src/components/composites/tooltip/tooltip-host.tsx +19 -17
- package/src/components/composites/tooltip/tooltip.css +1 -1
- package/src/components/compound/support-rail/SupportRail.tsx +116 -128
- package/src/components/compound/support-rail/SupportRail.usage.md +7 -6
- package/src/components/compound/support-rail/support-rail.css +76 -238
- package/src/components/dev/MotionDevtools.tsx +252 -42
- package/src/components/dev/MotionDevtools.usage.md +12 -4
- package/src/components/dev/motion-devtools.css +77 -2
- package/src/components/dev/slowmo-engine.ts +1 -1
- package/src/components/expressive/confetti/confetti.css +3 -3
- package/src/components/expressive/facebook-feed/facebook-feed.css +1 -1
- package/src/components/expressive/flow-field/FlowField.tsx +1 -1
- package/src/components/expressive/flow-field/flow-field.css +4 -4
- package/src/components/expressive/instagram-feed/instagram-feed.css +1 -1
- package/src/components/expressive/lens/lens.css +1 -2
- package/src/components/expressive/morphing-text/morphing-text.css +2 -2
- package/src/components/expressive/odometer/odometer.css +1 -1
- 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.css +2 -3
- package/src/components/expressive/typing-lines/TypingLines.tsx +0 -0
- package/src/components/expressive/typing-lines/typing-lines.css +1 -1
- package/src/components/expressive/weight-field/weight-field.css +2 -2
- package/src/components/expressive/youtube/youtube.css +1 -1
- package/src/components/internal/glass/glass.css +1 -1
- package/src/components/internal/hooks/use-press-feedback.ts +52 -0
- package/src/components/internal/icon/Icon.tsx +2 -0
- package/src/components/internal/icon/icon.css +1 -1
- package/src/components/internal/menu/menu-surface.css +1 -1
- package/src/components/internal/overlay/layer.tsx +35 -2
- package/src/components/internal/overlay/overlay.css +1 -1
- package/src/components/internal/overlay/position.ts +2 -2
- package/src/components/internal/overlay/trigger.css +1 -1
- package/src/components/internal/utils/token-px.ts +4 -4
- package/src/components/primitives/avatar/avatar.css +3 -2
- package/src/components/primitives/badge/badge.css +1 -1
- package/src/components/primitives/badge/digit-strip.css +1 -1
- package/src/components/primitives/button/Button.tsx +28 -27
- package/src/components/primitives/button/button-style.ts +28 -0
- package/src/components/primitives/button/button.css +38 -31
- package/src/components/primitives/checkbox/checkbox.css +1 -1
- package/src/components/primitives/collapse/collapse.css +8 -5
- package/src/components/primitives/input/input.css +7 -4
- package/src/components/primitives/radio-group/radio-group.css +6 -4
- 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.css +1 -1
- package/src/components/primitives/textarea/textarea.css +1 -1
- package/src/components/primitives/toggle/toggle.css +1 -1
- package/src/engine/animate.ts +10 -2
- package/src/mcp/server.ts +2 -1
- package/src/motion/glide.tsx +9 -6
- package/src/motion/motion-timing.ts +5 -2
- package/src/styles.css +3 -4
- package/src/tokens/base.css +5 -5
- package/src/tokens/color.css +8 -9
- package/src/tokens/component-styles.generated.ts +36 -38
- package/src/tokens/dark.css +8 -13
- package/src/tokens/decisions.css +9 -12
- package/src/tokens/elevation.css +18 -26
- package/src/tokens/glass.css +3 -2
- package/src/tokens/motion-defaults.generated.ts +1 -1
- package/src/tokens/motion-tokens.ts +27 -8
- package/src/tokens/motion.css +9 -9
- package/src/tokens/radius.css +3 -2
- package/src/tokens/reset.css +36 -0
- package/src/tokens/semantic.css +12 -22
- package/src/tokens/spacing.css +1 -1
- package/src/tokens/theme-store.ts +187 -0
- package/src/tokens/theme-sync.tsx +49 -2
- package/src/tokens/theme-tokens.generated.ts +128 -116
- package/src/tokens/theme.tsx +96 -24
- package/src/tokens/theme.usage.md +25 -24
- package/src/tokens/typography.css +4 -3
- package/tailwind.css +8 -14
- package/dist/chunk-6SUHSSOK.js +0 -25
- package/dist/chunk-6SUHSSOK.js.map +0 -1
- package/dist/chunk-BH4JFWXQ.js.map +0 -1
- package/dist/chunk-CAXQJSIE.js.map +0 -1
- package/dist/chunk-FEXUS4SV.js.map +0 -1
- package/dist/chunk-FLQVOSFC.js.map +0 -1
- package/dist/chunk-GOLSYGRA.js.map +0 -1
- package/dist/chunk-IUQAUBVM.js.map +0 -1
- package/dist/chunk-K45CWVHS.js.map +0 -1
- package/dist/chunk-MDSRZ4QR.js.map +0 -1
- package/dist/chunk-N2GJEO5Z.js.map +0 -1
- package/dist/chunk-PWQVSVXR.js.map +0 -1
- package/dist/chunk-UE63OOVG.js +0 -13
- package/dist/chunk-UE63OOVG.js.map +0 -1
- package/dist/chunk-UYSXJ7MH.js +0 -52
- package/dist/chunk-UYSXJ7MH.js.map +0 -1
- package/dist/chunk-WZUTBJC4.js.map +0 -1
- package/src/tokens/fonts.css +0 -1
package/dist/typing-lines.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/expressive/typing-lines/TypingLines.tsx"],"names":[],"mappings":";;;;;;;;AAWA,IAAM,iBAAA,GAAoB,EAAA;AAC1B,IAAM,mBAAA,GAAsB,EAAA;AAC5B,IAAM,YAAA,GAAe,GAAA;AACrB,IAAM,cAAA,GAAiB,EAAA;AACvB,IAAM,OAAA,GAAU,IAAA;AAEhB,IAAM,UAAA,GAAa,uBAAA;AACnB,IAAM,cAAA,GAAiB,kCAAA;AAevB,IAAM,OAAA,GAAU,CAAC,IAAA,EAAc,IAAA,KAAsB,SAAS,MAAA,GAAU,IAAA,GAAO,IAAA,CAAK,KAAA,CAAM,GAAG,CAAA,GAAI,EAAC,GAAK,CAAC,GAAG,IAAI,CAAA;AAE/G,SAAS,UAAA,CAAW,EAAA,EAAiB,KAAA,EAAiB,MAAA,EAAgB,QAAA,EAAoB;AACxF,EAAA,OAAO,QAAA,CAAS,KAAA,GAAQ,MAAA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AA,MACjF,CAAA;AAAA,MACA,EAAE,EAAA,EAAI,KAAA,EAAO,MAAM,QAAA,CAAS,OAAA,EAAS,MAAM,MAAA;AAAO,KACpD;AAEA,IAAA,OAAO,MAAM,SAAS,IAAA,EAAK;AAAA,EAC7B,CAAA,EAAG,CAAC,GAAA,EAAK,KAAA,EAAO,IAAI,CAAC,CAAA;AAErB,EAAA,uBACE,IAAA,CAAC,MAAA,EAAA,EAAK,GAAA,EAAK,OAAA,EAAS,SAAA,EAAW,EAAA,CAAG,iBAAA,EAAmB,SAAS,CAAA,EAAG,KAAA,EAAe,GAAG,SAAA,EACjF,QAAA,EAAA;AAAA,oBAAA,GAAA,CAAC,MAAA,EAAA,EAAK,GAAA,EAAK,QAAA,EAAU,SAAA,EAAU,wBAAA,EAAyB,CAAA;AAAA,wBACvD,MAAA,EAAA,EAAK,GAAA,EAAK,SAAS,SAAA,EAAU,uBAAA,EAAwB,eAAY,MAAA,EAAO,CAAA;AAAA,IACxE,KAAA,KAAU,MAAA,GAAS,IAAA,mBAClB,GAAA,CAAC,MAAA,EAAA,EAAK,GAAA,EAAK,QAAA,EAAU,SAAA,EAAW,CAAA,+CAAA,EAAkD,KAAK,CAAA,CAAA,EAAI,aAAA,EAAY,MAAA,EAAO;AAAA,GAAA,EAElH,CAAA;AAEJ","file":"typing-lines.js","sourcesContent":["'use client';\n\nimport './typing-lines.css';\n\nimport { useEffect, useRef, type HTMLAttributes } from 'react';\n\nimport type { DataAttributes } from '../../../dom-props';\nimport { loop } from '../../../engine';\nimport type { TypingLinesStyle } from '../../../tokens/component-styles.generated';\nimport { cx } from '../../internal/utils/cx';\n\nconst CHARACTER_TYPE_MS = 54;\nconst CHARACTER_DELETE_MS = 26;\nconst WORD_TYPE_MS = 210;\nconst WORD_DELETE_MS = 90;\nconst HOLD_MS = 2400;\nconst RESTART_LEAD_MS = 420;\nconst WORD_CLASS = 'zc-typing-lines__word';\nconst BLINKING_CLASS = 'zc-typing-lines__caret--blinking';\n\nexport type TypingUnit = 'character' | 'word';\nexport type TypingCaret = 'line' | 'block' | 'underscore' | 'none';\n\ntype Phase = 'typing' | 'holding' | 'deleting';\n\ninterface Progress {\n index: number;\n count: number;\n phase: Phase;\n elapsed: number;\n built: number;\n}\n\nconst unitsOf = (line: string, unit: TypingUnit) => (unit === 'word' ? (line ? line.split(' ') : []) : [...line]);\n\nfunction paintWords(el: HTMLElement, words: string[], target: number, progress: Progress) {\n while (progress.built > target && el.lastChild) {\n el.removeChild(el.lastChild);\n if (progress.built > 1 && el.lastChild) el.removeChild(el.lastChild);\n progress.built--;\n }\n for (let i = progress.built; i < target; i++) {\n if (i) el.appendChild(document.createTextNode(' '));\n const span = document.createElement('span');\n span.className = WORD_CLASS;\n span.textContent = words[i];\n el.appendChild(span);\n progress.built = i + 1;\n }\n}\n\nfunction paint(el: HTMLElement, line: string, unit: TypingUnit, count: number, progress: Progress) {\n if (unit === 'word') {\n paintWords(el, unitsOf(line, unit), count, progress);\n return;\n }\n el.textContent = [...line].slice(0, count).join('');\n progress.built = 0;\n}\n\nfunction advance(progress: Progress, dt: number, lines: string[], unit: TypingUnit) {\n const total = unitsOf(lines[progress.index] ?? '', unit).length;\n const typeRate = unit === 'word' ? WORD_TYPE_MS : CHARACTER_TYPE_MS;\n const deleteRate = unit === 'word' ? WORD_DELETE_MS : CHARACTER_DELETE_MS;\n progress.elapsed += dt;\n\n if (progress.phase === 'typing') {\n if (progress.elapsed > typeRate) {\n progress.elapsed = 0;\n progress.count++;\n if (progress.count >= total) {\n progress.count = total;\n progress.phase = 'holding';\n }\n }\n return;\n }\n if (progress.phase === 'holding') {\n if (progress.elapsed > HOLD_MS) {\n progress.elapsed = 0;\n progress.phase = 'deleting';\n }\n return;\n }\n if (progress.elapsed > deleteRate) {\n progress.elapsed = 0;\n progress.count--;\n if (progress.count <= 0) {\n progress.count = 0;\n progress.phase = 'typing';\n progress.elapsed = -RESTART_LEAD_MS;\n progress.index = lines.length ? (progress.index + 1) % lines.length : 0;\n }\n }\n}\n\nexport interface TypingLinesOwnProps {\n /** The lines to type, in order; the sequence restarts once the last one has been deleted. */\n lines: string[];\n /** Whether the line arrives one character or one whole word at a time. @default 'character' */\n unit?: TypingUnit;\n /** Caret shape. It holds solid while characters land and blinks only once the line is idle. @default 'line' */\n caret?: TypingCaret;\n /** Multiplies the typing rate; sampled live on every frame. @default 1 */\n speed?: number;\n /** Extra class(es) merged onto the root. */\n className?: string;\n /** Inline styles merged onto the root. */\n style?: TypingLinesStyle;\n}\n\nexport interface TypingLinesProps extends TypingLinesOwnProps {\n /** Standard <span> attributes (aria-*, data-*, title, ...) forwarded to the root. */\n htmlProps?: Omit<HTMLAttributes<HTMLSpanElement>, keyof TypingLinesOwnProps> & DataAttributes;\n}\n\nexport function TypingLines({\n lines,\n unit = 'character',\n caret = 'line',\n speed = 1,\n className = '',\n style,\n htmlProps,\n}: TypingLinesProps) {\n const rootRef = useRef<HTMLSpanElement>(null);\n const textRef = useRef<HTMLSpanElement>(null);\n const caretRef = useRef<HTMLSpanElement>(null);\n const labelRef = useRef<HTMLSpanElement>(null);\n const speedRef = useRef(speed);\n const key = lines.join('\u0000') + '\u0001' + unit;\n\n useEffect(() => {\n speedRef.current = speed;\n }, [speed]);\n\n useEffect(() => {\n const el = rootRef.current;\n const text = textRef.current;\n if (!el || !text) return;\n\n const progress: Progress = { index: 0, count: 0, phase: 'typing', elapsed: 0, built: 0 };\n text.textContent = '';\n\n const showLabel = () => {\n if (labelRef.current) labelRef.current.textContent = lines[progress.index] ?? '';\n };\n const settle = () => {\n const line = lines[0] ?? '';\n progress.index = 0;\n progress.count = unitsOf(line, unit).length;\n progress.phase = 'holding';\n paint(text, line, unit, progress.count, progress);\n caretRef.current?.classList.remove(BLINKING_CLASS);\n showLabel();\n };\n\n let painted = -1;\n showLabel();\n\n const playback = loop(\n (_k, dt) => {\n const before = progress.index;\n advance(progress, dt, lines, unit);\n if (progress.index !== before) {\n progress.built = 0;\n text.textContent = '';\n showLabel();\n }\n if (progress.count !== painted) {\n paint(text, lines[progress.index] ?? '', unit, progress.count, progress);\n painted = progress.count;\n }\n caretRef.current?.classList.toggle(BLINKING_CLASS, progress.phase === 'holding');\n },\n { el, speed: () => speedRef.current, snap: settle },\n );\n\n return () => playback.stop();\n }, [key, lines, unit]);\n\n return (\n <span ref={rootRef} className={cx('zc-typing-lines', className)} style={style} {...htmlProps}>\n <span ref={labelRef} className=\"zc-typing-lines__label\" />\n <span ref={textRef} className=\"zc-typing-lines__text\" aria-hidden=\"true\" />\n {caret === 'none' ? null : (\n <span ref={caretRef} className={`zc-typing-lines__caret zc-typing-lines__caret--${caret}`} aria-hidden=\"true\" />\n )}\n </span>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/components/expressive/typing-lines/TypingLines.tsx"],"names":[],"mappings":";;;;;;;;AAWA,IAAM,iBAAA,GAAoB,EAAA;AAC1B,IAAM,mBAAA,GAAsB,EAAA;AAC5B,IAAM,YAAA,GAAe,GAAA;AACrB,IAAM,cAAA,GAAiB,EAAA;AACvB,IAAM,OAAA,GAAU,IAAA;AAEhB,IAAM,UAAA,GAAa,uBAAA;AACnB,IAAM,cAAA,GAAiB,kCAAA;AAevB,IAAM,OAAA,GAAU,CAAC,IAAA,EAAc,IAAA,KAAsB,SAAS,MAAA,GAAU,IAAA,GAAO,IAAA,CAAK,KAAA,CAAM,GAAG,CAAA,GAAI,EAAC,GAAK,CAAC,GAAG,IAAI,CAAA;AAE/G,SAAS,UAAA,CAAW,EAAA,EAAiB,KAAA,EAAiB,MAAA,EAAgB,QAAA,EAAoB;AACxF,EAAA,OAAO,QAAA,CAAS,KAAA,GAAQ,MAAA,IAAU,EAAA,CAAG,SAAA,EAAW;AAC9C,IAAA,EAAA,CAAG,WAAA,CAAY,GAAG,SAAS,CAAA;AAC3B,IAAA,IAAI,QAAA,CAAS,QAAQ,CAAA,IAAK,EAAA,CAAG,WAAW,EAAA,CAAG,WAAA,CAAY,GAAG,SAAS,CAAA;AACnE,IAA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O,IAAI,CAAC,CAAA;AAErB,EAAA,uBACE,IAAA,CAAC,MAAA,EAAA,EAAK,GAAA,EAAK,OAAA,EAAS,SAAA,EAAW,EAAA,CAAG,iBAAA,EAAmB,SAAS,CAAA,EAAG,KAAA,EAAe,GAAG,SAAA,EACjF,QAAA,EAAA;AAAA,oBAAA,GAAA,CAAC,MAAA,EAAA,EAAK,GAAA,EAAK,QAAA,EAAU,SAAA,EAAU,wBAAA,EAAyB,CAAA;AAAA,wBACvD,MAAA,EAAA,EAAK,GAAA,EAAK,SAAS,SAAA,EAAU,uBAAA,EAAwB,eAAY,MAAA,EAAO,CAAA;AAAA,IACxE,KAAA,KAAU,MAAA,GAAS,IAAA,mBAClB,GAAA,CAAC,MAAA,EAAA,EAAK,GAAA,EAAK,QAAA,EAAU,SAAA,EAAW,CAAA,+CAAA,EAAkD,KAAK,CAAA,CAAA,EAAI,aAAA,EAAY,MAAA,EAAO;AAAA,GAAA,EAElH,CAAA;AAEJ","file":"typing-lines.js","sourcesContent":["'use client';\n\nimport './typing-lines.css';\n\nimport { useEffect, useRef, type HTMLAttributes } from 'react';\n\nimport type { DataAttributes } from '../../../dom-props';\nimport { loop } from '../../../engine';\nimport type { TypingLinesStyle } from '../../../tokens/component-styles.generated';\nimport { cx } from '../../internal/utils/cx';\n\nconst CHARACTER_TYPE_MS = 54;\nconst CHARACTER_DELETE_MS = 26;\nconst WORD_TYPE_MS = 210;\nconst WORD_DELETE_MS = 90;\nconst HOLD_MS = 2400;\nconst RESTART_LEAD_MS = 420;\nconst WORD_CLASS = 'zc-typing-lines__word';\nconst BLINKING_CLASS = 'zc-typing-lines__caret--blinking';\n\nexport type TypingUnit = 'character' | 'word';\nexport type TypingCaret = 'line' | 'block' | 'underscore' | 'none';\n\ntype Phase = 'typing' | 'holding' | 'deleting';\n\ninterface Progress {\n index: number;\n count: number;\n phase: Phase;\n elapsed: number;\n built: number;\n}\n\nconst unitsOf = (line: string, unit: TypingUnit) => (unit === 'word' ? (line ? line.split(' ') : []) : [...line]);\n\nfunction paintWords(el: HTMLElement, words: string[], target: number, progress: Progress) {\n while (progress.built > target && el.lastChild) {\n el.removeChild(el.lastChild);\n if (progress.built > 1 && el.lastChild) el.removeChild(el.lastChild);\n progress.built--;\n }\n for (let i = progress.built; i < target; i++) {\n if (i) el.appendChild(document.createTextNode(' '));\n const span = document.createElement('span');\n span.className = WORD_CLASS;\n span.textContent = words[i];\n el.appendChild(span);\n progress.built = i + 1;\n }\n}\n\nfunction paint(el: HTMLElement, line: string, unit: TypingUnit, count: number, progress: Progress) {\n if (unit === 'word') {\n paintWords(el, unitsOf(line, unit), count, progress);\n return;\n }\n el.textContent = [...line].slice(0, count).join('');\n progress.built = 0;\n}\n\nfunction advance(progress: Progress, dt: number, lines: string[], unit: TypingUnit) {\n const total = unitsOf(lines[progress.index] ?? '', unit).length;\n const typeRate = unit === 'word' ? WORD_TYPE_MS : CHARACTER_TYPE_MS;\n const deleteRate = unit === 'word' ? WORD_DELETE_MS : CHARACTER_DELETE_MS;\n progress.elapsed += dt;\n\n if (progress.phase === 'typing') {\n if (progress.elapsed > typeRate) {\n progress.elapsed = 0;\n progress.count++;\n if (progress.count >= total) {\n progress.count = total;\n progress.phase = 'holding';\n }\n }\n return;\n }\n if (progress.phase === 'holding') {\n if (progress.elapsed > HOLD_MS) {\n progress.elapsed = 0;\n progress.phase = 'deleting';\n }\n return;\n }\n if (progress.elapsed > deleteRate) {\n progress.elapsed = 0;\n progress.count--;\n if (progress.count <= 0) {\n progress.count = 0;\n progress.phase = 'typing';\n progress.elapsed = -RESTART_LEAD_MS;\n progress.index = lines.length ? (progress.index + 1) % lines.length : 0;\n }\n }\n}\n\nexport interface TypingLinesOwnProps {\n /** The lines to type, in order; the sequence restarts once the last one has been deleted. */\n lines: string[];\n /** Whether the line arrives one character or one whole word at a time. @default 'character' */\n unit?: TypingUnit;\n /** Caret shape. It holds solid while characters land and blinks only once the line is idle. @default 'line' */\n caret?: TypingCaret;\n /** Multiplies the typing rate; sampled live on every frame. @default 1 */\n speed?: number;\n /** Extra class(es) merged onto the root. */\n className?: string;\n /** Inline styles merged onto the root. */\n style?: TypingLinesStyle;\n}\n\nexport interface TypingLinesProps extends TypingLinesOwnProps {\n /** Standard <span> attributes (aria-*, data-*, title, ...) forwarded to the root. */\n htmlProps?: Omit<HTMLAttributes<HTMLSpanElement>, keyof TypingLinesOwnProps> & DataAttributes;\n}\n\nexport function TypingLines({\n lines,\n unit = 'character',\n caret = 'line',\n speed = 1,\n className = '',\n style,\n htmlProps,\n}: TypingLinesProps) {\n const rootRef = useRef<HTMLSpanElement>(null);\n const textRef = useRef<HTMLSpanElement>(null);\n const caretRef = useRef<HTMLSpanElement>(null);\n const labelRef = useRef<HTMLSpanElement>(null);\n const speedRef = useRef(speed);\n const key = lines.join('\\u0000') + '\\u0001' + unit;\n\n useEffect(() => {\n speedRef.current = speed;\n }, [speed]);\n\n useEffect(() => {\n const el = rootRef.current;\n const text = textRef.current;\n if (!el || !text) return;\n\n const progress: Progress = { index: 0, count: 0, phase: 'typing', elapsed: 0, built: 0 };\n text.textContent = '';\n\n const showLabel = () => {\n if (labelRef.current) labelRef.current.textContent = lines[progress.index] ?? '';\n };\n const settle = () => {\n const line = lines[0] ?? '';\n progress.index = 0;\n progress.count = unitsOf(line, unit).length;\n progress.phase = 'holding';\n paint(text, line, unit, progress.count, progress);\n caretRef.current?.classList.remove(BLINKING_CLASS);\n showLabel();\n };\n\n let painted = -1;\n showLabel();\n\n const playback = loop(\n (_k, dt) => {\n const before = progress.index;\n advance(progress, dt, lines, unit);\n if (progress.index !== before) {\n progress.built = 0;\n text.textContent = '';\n showLabel();\n }\n if (progress.count !== painted) {\n paint(text, lines[progress.index] ?? '', unit, progress.count, progress);\n painted = progress.count;\n }\n caretRef.current?.classList.toggle(BLINKING_CLASS, progress.phase === 'holding');\n },\n { el, speed: () => speedRef.current, snap: settle },\n );\n\n return () => playback.stop();\n }, [key, lines, unit]);\n\n return (\n <span ref={rootRef} className={cx('zc-typing-lines', className)} style={style} {...htmlProps}>\n <span ref={labelRef} className=\"zc-typing-lines__label\" />\n <span ref={textRef} className=\"zc-typing-lines__text\" aria-hidden=\"true\" />\n {caret === 'none' ? null : (\n <span ref={caretRef} className={`zc-typing-lines__caret zc-typing-lines__caret--${caret}`} aria-hidden=\"true\" />\n )}\n </span>\n );\n}\n"]}
|
package/dist/weight-field.css
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
@layer zyncat.tokens, zyncat.components;
|
|
1
|
+
@layer zyncat.reset, zyncat.tokens, zyncat.components;
|
|
2
2
|
|
|
3
3
|
@layer zyncat.components {
|
|
4
4
|
.zc-weight-field {
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
--weight-field-peak-weight: 900;
|
|
25
25
|
/* How much a unit widens under the pointer. */
|
|
26
26
|
--weight-field-hover-padding: calc(1em / 12);
|
|
27
|
-
/* The text stroke every unit carries
|
|
27
|
+
/* The text stroke every unit carries, doubled on the peak letter. */
|
|
28
28
|
--weight-field-stroke: calc(1em * 125 / 6000);
|
|
29
29
|
--_weight-field-stroke-peak: calc(var(--weight-field-stroke) * 2);
|
|
30
30
|
/* How long a unit takes to settle at a new weight. */
|
package/dist/youtube.css
CHANGED
package/dist/youtube.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
'use client';import { startDrag } from './chunk-
|
|
1
|
+
'use client';import { startDrag } from './chunk-XKDR22VE.js';
|
|
2
2
|
import './chunk-VNVVG47J.js';
|
|
3
3
|
import { useControllable } from './chunk-MMRIQNEN.js';
|
|
4
|
-
import './chunk-
|
|
4
|
+
import './chunk-6H3IJ752.js';
|
|
5
5
|
import { cx } from './chunk-QGNC7LH5.js';
|
|
6
6
|
import './youtube.css';
|
|
7
7
|
import { useRef, useEffect } from 'react';
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zyncat/ui",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"packageManager": "pnpm@11.
|
|
3
|
+
"version": "0.18.0",
|
|
4
|
+
"packageManager": "pnpm@11.26.0",
|
|
5
5
|
"description": "A React 19 design system: accessible, animated UI components built on a small, closed CSS design-token vocabulary. No Tailwind, no CSS-in-JS.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"react",
|
|
@@ -298,6 +298,21 @@
|
|
|
298
298
|
"types": "./dist/types/tokens/theme.d.ts",
|
|
299
299
|
"import": "./dist/theme.js"
|
|
300
300
|
},
|
|
301
|
+
"./theme-switcher": {
|
|
302
|
+
"source": "./src/components/composites/theme-switcher/ThemeSwitcher.tsx",
|
|
303
|
+
"types": "./dist/types/components/composites/theme-switcher/ThemeSwitcher.d.ts",
|
|
304
|
+
"import": "./dist/theme-switcher.js"
|
|
305
|
+
},
|
|
306
|
+
"./theme-grid": {
|
|
307
|
+
"source": "./src/components/composites/theme-switcher/ThemeGrid.tsx",
|
|
308
|
+
"types": "./dist/types/components/composites/theme-switcher/ThemeGrid.d.ts",
|
|
309
|
+
"import": "./dist/theme-grid.js"
|
|
310
|
+
},
|
|
311
|
+
"./spinner": {
|
|
312
|
+
"source": "./src/components/primitives/spinner/Spinner.tsx",
|
|
313
|
+
"types": "./dist/types/components/primitives/spinner/Spinner.d.ts",
|
|
314
|
+
"import": "./dist/spinner.js"
|
|
315
|
+
},
|
|
301
316
|
"./styles.css": "./src/styles.css",
|
|
302
317
|
"./tailwind.css": "./tailwind.css",
|
|
303
318
|
"./next": {
|
|
@@ -315,31 +330,12 @@
|
|
|
315
330
|
"next.d.mts"
|
|
316
331
|
],
|
|
317
332
|
"scripts": {
|
|
318
|
-
"build": "
|
|
319
|
-
"
|
|
320
|
-
"dev": "turbo run dev --filter=zyncat-ui-docs",
|
|
321
|
-
"dev:lib": "tsup --watch",
|
|
322
|
-
"typecheck": "tsc -p tsconfig.build.json --noEmit --declaration false && tsc -p tsconfig.node.json && pnpm --filter zyncat-ui typecheck",
|
|
323
|
-
"check:css": "node scripts/check-css-graph.mjs",
|
|
324
|
-
"check:contracts": "node scripts/check-contracts.mjs",
|
|
325
|
-
"check:usage": "node scripts/check-usage.mjs",
|
|
326
|
-
"check:skill": "node scripts/gen-skill.mjs --check",
|
|
327
|
-
"check:authoring": "node scripts/check-authoring.mjs",
|
|
328
|
-
"check:exports": "node scripts/sync-exports.mjs",
|
|
329
|
-
"check:props": "node scripts/gen-props.mjs --check",
|
|
330
|
-
"check:tsconfig": "node scripts/sync-tsconfig.mjs --check",
|
|
331
|
-
"check:theme": "node scripts/gen-theme.mjs --check",
|
|
332
|
-
"check:shim": "node scripts/gen-shim.mjs --check",
|
|
333
|
-
"docs:props": "node scripts/gen-props.mjs",
|
|
334
|
-
"sync:exports": "node scripts/sync-exports.mjs --write",
|
|
335
|
-
"sync:tsconfig": "node scripts/sync-tsconfig.mjs",
|
|
336
|
-
"sync:skill": "node scripts/gen-skill.mjs",
|
|
337
|
-
"sync:theme": "node scripts/gen-theme.mjs",
|
|
338
|
-
"sync:shim": "node scripts/gen-shim.mjs",
|
|
333
|
+
"build": "node scripts/build.mjs",
|
|
334
|
+
"check": "node scripts/check.mjs",
|
|
339
335
|
"sync": "node scripts/sync.mjs",
|
|
340
336
|
"verify": "node scripts/verify.mjs",
|
|
337
|
+
"dev": "turbo run dev --filter=zyncat-ui-docs",
|
|
341
338
|
"format": "prettier --write --cache .",
|
|
342
|
-
"format:check": "prettier --check --cache .",
|
|
343
339
|
"prepublishOnly": "pnpm build"
|
|
344
340
|
},
|
|
345
341
|
"commitlint": {
|
|
@@ -34,7 +34,7 @@ init over hand-wiring it.
|
|
|
34
34
|
- `import '@zyncat/ui/styles.css'` once at the root - fonts + tokens; each component lazy-loads its
|
|
35
35
|
own CSS. `import './zyncat.theme.css'` right after it - the eight decisions init wrote beside the
|
|
36
36
|
entry; a retheme is editing a value there.
|
|
37
|
-
- Theming that is data: `defineTheme` + `<ZyncatTheme
|
|
37
|
+
- Theming that is data: `defineTheme` + `<ZyncatTheme themes={{ default: { light, dark } }} />` from
|
|
38
38
|
`@zyncat/ui/theme`, once at the root. Typed, server-rendered, no build config. See
|
|
39
39
|
references/theming.md before writing one.
|
|
40
40
|
- One subpath per component: `import { Button } from '@zyncat/ui/button'`. There is no barrel.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @zyncat/ui component index
|
|
2
2
|
|
|
3
|
-
Generated from @zyncat/ui v0.
|
|
3
|
+
Generated from @zyncat/ui v0.18.0 by `pnpm sync skill` - do not edit by hand.
|
|
4
4
|
If node_modules/@zyncat/ui/package.json shows a DIFFERENT version, this index is stale:
|
|
5
5
|
trust the get_component MCP tool and re-run `npx zyncat-ui init` to refresh the skill.
|
|
6
6
|
|
|
@@ -14,6 +14,7 @@ Badge - @zyncat/ui/badge - Glass or outline chip for ambient status - toned, dot
|
|
|
14
14
|
StatusBadge - @zyncat/ui/status-badge - Canonical post status - tone + one-word label.
|
|
15
15
|
CountBadge - @zyncat/ui/count-badge - Mono tabular count; `roll` animates digits like an odometer.
|
|
16
16
|
Glide / GlidePill - @zyncat/ui/glide - A persistent background pill that glides smoothly between hovered/active elements.
|
|
17
|
+
Spinner - @zyncat/ui/spinner - Indeterminate loader; three looks, no JavaScript, no layout of its own.
|
|
17
18
|
|
|
18
19
|
== Forms ==
|
|
19
20
|
Every form field takes label, helper/error/warning/success, size sm|md|lg, disabled.
|
|
@@ -54,6 +55,8 @@ Alert - @zyncat/ui/alert - Persistent, in-flow status.
|
|
|
54
55
|
Toast - @zyncat/ui/toast - Imperative transient notifications: mount <Toaster /> once at the app root, then call toast() from anywhere.
|
|
55
56
|
toast-store - @zyncat/ui/toast-store - The headless store behind Toast: subscribe to the toast queue and drive it without rendering <Toaster />.
|
|
56
57
|
EmojiPickerPanel - @zyncat/ui/emoji-picker - Searchable emoji panel - grid, scrollspy category rail, recents in localStorage - living in a Popover, becoming a bottom Sheet on narrow viewports.
|
|
58
|
+
ThemeSwitcher - @zyncat/ui/theme-switcher - The theme control: a chip painted in the live palette opens a grid of miniatures, one card per palette and side plus a split System card, each drawn from that theme's real tokens.
|
|
59
|
+
ThemeGrid - @zyncat/ui/theme-grid - The theme picker without a surface: a radio grid of miniatures, one card per palette and side plus a split System card, each drawn from that theme's real tokens.
|
|
57
60
|
|
|
58
61
|
== Expressive ==
|
|
59
62
|
Creative motion components. Each publishes scoped --<component>-* custom properties as its theming surface.
|
|
@@ -79,7 +82,7 @@ YouTube - @zyncat/ui/youtube - Replica of three YouTube surfaces, picked with su
|
|
|
79
82
|
== Dev tools ==
|
|
80
83
|
motion-tokens - @zyncat/ui/motion-tokens - TypeScript readers for the motion token vocabulary - duration/ease/distance/scale token names resolved to the live CSS values.
|
|
81
84
|
MotionDevtools - @zyncat/ui/motion-devtools - Dev-only floating panel that slows or freezes EVERY animation at once (CSS and WAAPI) for motion debugging.
|
|
82
|
-
Theme - @zyncat/ui/theme - Typed theming
|
|
85
|
+
Theme - @zyncat/ui/theme - Typed theming and the theme state: defineTheme shapes a theme, ZyncatTheme emits the CSS and the pre-paint boot script, useTheme reads and sets the choice.
|
|
83
86
|
|
|
84
87
|
== Types-only modules (documented by their .d.ts alone) ==
|
|
85
88
|
@zyncat/ui/next - get_component("next")
|
|
@@ -27,25 +27,32 @@ own `-subtle`, `-text` and `-wash`; the `--radius-*` steps are fixed ratios of `
|
|
|
27
27
|
`--radius: 0` squares every corner (`--radius-full` is a shape and stays put); the `--type-*` bundles
|
|
28
28
|
follow the faces. Set a derived token only to break it away from its decision.
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
Palette and polarity are two attributes. `data-theme='<name>'` picks the palette, `data-polarity='light|dark'`
|
|
31
|
+
picks the side, and they are independent - a palette carries both sides.
|
|
32
|
+
|
|
33
|
+
Dark ships in the package. `data-polarity="dark"` on `<html>` turns the page - the base layer paints
|
|
31
34
|
`body` in `--bg-app`, `--text-body` and `--type-body`, so there is no wrapper to add - and on any
|
|
32
|
-
element it turns that subtree, where `data-
|
|
33
|
-
the neutral roles (`--bg-*`, `--text-*`, `--border-*`), the shadow ink, `--shadow-strength` (how
|
|
34
|
-
shadow the surfaces cast), `--sheen-strength` (how bright the white top-light highlights render)
|
|
35
|
-
`--glow-strength` (how much light a hovered hue fill casts on the canvas around it), drops the
|
|
36
|
-
faces (`--accent-fill`, `--danger-fill`) a step, and re-derives the hue steps whose light
|
|
37
|
-
lightness near white; the decisions cascade in, so the accent a project sets is the dark
|
|
38
|
-
accent too. Extend it in the same block -
|
|
39
|
-
`[data-
|
|
35
|
+
element it turns that subtree, where `data-polarity="light"` makes a light island. The dark polarity
|
|
36
|
+
sets the neutral roles (`--bg-*`, `--text-*`, `--border-*`), the shadow ink, `--shadow-strength` (how
|
|
37
|
+
much shadow the surfaces cast), `--sheen-strength` (how bright the white top-light highlights render)
|
|
38
|
+
and `--glow-strength` (how much light a hovered hue fill casts on the canvas around it), drops the
|
|
39
|
+
filled faces (`--accent-fill`, `--danger-fill`) a step, and re-derives the hue steps whose light
|
|
40
|
+
values pin a lightness near white; the decisions cascade in, so the accent a project sets is the dark
|
|
41
|
+
side's accent too. Extend it in the same block -
|
|
42
|
+
`[data-polarity='dark'] { --accent: oklch(0.72 0.14 292); --shadow-strength: 2.5; }` - and whatever is
|
|
40
43
|
left out keeps the shipped dark value. The derived tokens are declared on every theme root (`:root`
|
|
41
|
-
and any element with `data-theme`), so a subtree
|
|
42
|
-
them; the neutral roles cascade like any property, so a theme of your own that sets
|
|
43
|
-
`--text-body` keeps them without restating the rest.
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
44
|
+
and any element with `data-theme` or `data-polarity`), so a subtree that repoints `--accent`
|
|
45
|
+
re-derives all of them; the neutral roles cascade like any property, so a theme of your own that sets
|
|
46
|
+
`--bg-app` and `--text-body` keeps them without restating the rest. Overlays portal to `<body>` but
|
|
47
|
+
carry their trigger's palette and polarity onto their own panel, so a Dropdown, Select, Popover,
|
|
48
|
+
Tooltip, Dialog, Modal or Sheet opened from inside a themed island paints as the island does.
|
|
49
|
+
Components read the tokens live, and the WAAPI engine reads them off the element it is animating -
|
|
50
|
+
overlays off their trigger - so a subtree theme retimes motion as well as colour, and a page with no
|
|
51
|
+
subtree theme reads `<body>` as before. The read refreshes whenever `data-theme` or `data-polarity`
|
|
52
|
+
changes anywhere, `prefers-reduced-motion` flips or `ZyncatTheme` renders. Reduced motion is handled
|
|
53
|
+
here - every `--duration-*` collapses to 1ms under `prefers-reduced-motion` - so derive your own
|
|
54
|
+
delays from a duration token, and repoint durations on `:root` for the collapse to reach the whole
|
|
55
|
+
page.
|
|
49
56
|
|
|
50
57
|
`@zyncat/ui/theme` is the same level with a type on it, for a theme that is data - several named
|
|
51
58
|
themes, or values computed at build time. `defineTheme` takes one object shaped like a theme: four
|
|
@@ -62,19 +69,20 @@ on `defineTheme` drops those lines from `zyncat.theme.css`.
|
|
|
62
69
|
```tsx
|
|
63
70
|
import { defineTheme, ZyncatTheme } from '@zyncat/ui/theme';
|
|
64
71
|
|
|
65
|
-
const
|
|
72
|
+
const light = defineTheme({
|
|
66
73
|
color: { accent: 'oklch(0.58 0.19 292)' },
|
|
67
74
|
shape: { radius: '0.75rem' },
|
|
68
75
|
components: { odometer: { accent: 'var(--warning)' } },
|
|
69
76
|
});
|
|
70
77
|
const dark = defineTheme({ color: { accent: 'oklch(0.72 0.14 292)' }, custom: { '--shadow-strength': 2.5 } });
|
|
71
78
|
|
|
72
|
-
<ZyncatTheme
|
|
79
|
+
<ZyncatTheme themes={{ default: { light, dark } }} />;
|
|
73
80
|
```
|
|
74
81
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
82
|
+
Every key is a palette carrying a `light` and a `dark` side, and `dark` is a delta - what `light`
|
|
83
|
+
sets and `dark` leaves out carries over. `default` lands on `:root`; every other key becomes
|
|
84
|
+
`[data-theme='<key>']`, so both extend the shipped polarities rather than starting them. Durations
|
|
85
|
+
you repoint keep their reduced-motion collapse automatically.
|
|
78
86
|
|
|
79
87
|
The vocabulary a page reads is the roles, never the plumbing:
|
|
80
88
|
`--bg-app/-surface/-surface-raised/-subtle/-muted/-inset/-overlay`,
|
|
@@ -147,7 +155,7 @@ the face), with `font-body`, `leading-<role>`, `tracking-caps`, `tracking-displa
|
|
|
147
155
|
colour utility on `ring-<hue>`);
|
|
148
156
|
`duration-fast` … `duration-slowest`, `ease-standard`, `ease-entrance`, `ease-exit`, `ease-spring`,
|
|
149
157
|
`ease-glide`; `max-w-prose`, `max-w-floating`. Each utility reads the token itself, so a themed
|
|
150
|
-
subtree and the dark
|
|
158
|
+
subtree and the dark polarity reach it, and `dark:` follows `data-polarity` rather than the OS. The names
|
|
151
159
|
Tailwind also ships - `rounded-md`, `shadow-md`, `tracking-tight` - read the zyncat token of the same
|
|
152
160
|
name, so `--radius` in the theme file moves utilities and components together. Spacing stays
|
|
153
161
|
Tailwind's own scale; both sit on the 4px grid. Reach for a role utility before an arbitrary value:
|
|
@@ -15,7 +15,7 @@ import { useControllable } from '../../internal/hooks/use-controllable';
|
|
|
15
15
|
import { Icon, type IconName } from '../../internal/icon/Icon';
|
|
16
16
|
import { IconSlot } from '../../internal/icon/IconSlot';
|
|
17
17
|
import { cx } from '../../internal/utils/cx';
|
|
18
|
-
import {
|
|
18
|
+
import { buttonClass } from '../../primitives/button/button-style';
|
|
19
19
|
|
|
20
20
|
export type AlertTone = 'info' | 'success' | 'warning' | 'danger';
|
|
21
21
|
|
|
@@ -125,9 +125,13 @@ export function Alert({
|
|
|
125
125
|
{children != null && <p className="zc-alert__desc">{children}</p>}
|
|
126
126
|
</div>
|
|
127
127
|
{action && (
|
|
128
|
-
<
|
|
128
|
+
<button
|
|
129
|
+
type="button"
|
|
130
|
+
className={buttonClass({ size: 'sm', className: 'zc-alert__action' })}
|
|
131
|
+
onClick={action.onClick}
|
|
132
|
+
>
|
|
129
133
|
{action.label}
|
|
130
|
-
</
|
|
134
|
+
</button>
|
|
131
135
|
)}
|
|
132
136
|
{dismissible && (
|
|
133
137
|
<button type="button" className="zc-alert__close" aria-label="Dismiss" onClick={dismiss}>
|
|
@@ -14,6 +14,7 @@ import { activationProps, type ActivateOn } from '../../internal/utils/activatio
|
|
|
14
14
|
import { cx } from '../../internal/utils/cx';
|
|
15
15
|
import { Button } from '../../primitives/button/Button';
|
|
16
16
|
import { col, DOW, grid, MONTHS, parse, today, toKey, tzLabel, within } from './date-utils';
|
|
17
|
+
import { MonthJump } from './month-jump';
|
|
17
18
|
import { useDayFocus } from './use-day-focus';
|
|
18
19
|
|
|
19
20
|
const PILL_FLIP = { timing: UIMotion.t.settle };
|
|
@@ -56,6 +57,11 @@ export function DtpPanel({ val, commit, min, max, timezone, label, close, slot,
|
|
|
56
57
|
function goToMonth(y: number, m: number) {
|
|
57
58
|
setView((v) => (v.y === y && v.m === m ? v : { y: y, m: m }));
|
|
58
59
|
}
|
|
60
|
+
const jumpedRef = useRef(false);
|
|
61
|
+
function jumpToMonth(y: number, m: number) {
|
|
62
|
+
jumpedRef.current = true;
|
|
63
|
+
goToMonth(y, m);
|
|
64
|
+
}
|
|
59
65
|
function nav(dir: number) {
|
|
60
66
|
const d = new Date(view.y, view.m + dir, 1);
|
|
61
67
|
goToMonth(d.getFullYear(), d.getMonth());
|
|
@@ -75,7 +81,9 @@ export function DtpPanel({ val, commit, min, max, timezone, label, close, slot,
|
|
|
75
81
|
const prev = prevViewRef.current;
|
|
76
82
|
prevViewRef.current = viewIdx;
|
|
77
83
|
const el = daysRef.current;
|
|
78
|
-
|
|
84
|
+
const jumped = jumpedRef.current;
|
|
85
|
+
jumpedRef.current = false;
|
|
86
|
+
if (prev == null || prev === viewIdx || !el || jumped) return;
|
|
79
87
|
const dir = viewIdx > prev ? 1 : -1;
|
|
80
88
|
animate(el, slideIn(dir * UIMotion.dist.md, UIMotion.t.enter));
|
|
81
89
|
}, [viewIdx]);
|
|
@@ -129,9 +137,7 @@ export function DtpPanel({ val, commit, min, max, timezone, label, close, slot,
|
|
|
129
137
|
<div className="zc-dtp" role="dialog" aria-label={label || 'Pick a date'}>
|
|
130
138
|
<div className="zc-dtp__cal">
|
|
131
139
|
<div className="zc-dtp__head">
|
|
132
|
-
<
|
|
133
|
-
{MONTHS[view.m]} <span className="zc-dtp__year">{view.y}</span>
|
|
134
|
-
</span>
|
|
140
|
+
<MonthJump y={view.y} m={view.m} min={min} max={max} activateOn={activateOn} onPick={jumpToMonth} />
|
|
135
141
|
<div className="zc-dtp__navs">
|
|
136
142
|
<button
|
|
137
143
|
type="button"
|