@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/modal.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
'use client';import { OV_TAKEOVER_TIMING, ModalShell } from './chunk-
|
|
2
|
-
import './chunk-
|
|
3
|
-
import { ovCloneTrigger, OverlayPortal } from './chunk-
|
|
1
|
+
'use client';import { OV_TAKEOVER_TIMING, ModalShell } from './chunk-F64Z42PJ.js';
|
|
2
|
+
import './chunk-2DNKZ57E.js';
|
|
3
|
+
import { ovCloneTrigger, OverlayPortal } from './chunk-TDHLZY6I.js';
|
|
4
4
|
import './chunk-LNAV5E7S.js';
|
|
5
5
|
import { popOut, popIn } from './chunk-HDSFWZ7L.js';
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import './chunk-
|
|
9
|
-
import './chunk-
|
|
6
|
+
import { resolveMotionTiming } from './chunk-C3D32LE3.js';
|
|
7
|
+
import { Presence } from './chunk-N43NDSME.js';
|
|
8
|
+
import './chunk-V6QAAOA5.js';
|
|
9
|
+
import './chunk-XKDR22VE.js';
|
|
10
10
|
import './chunk-VNVVG47J.js';
|
|
11
11
|
import { useControllable } from './chunk-MMRIQNEN.js';
|
|
12
|
-
import { UIMotion } from './chunk-
|
|
12
|
+
import { UIMotion } from './chunk-6H3IJ752.js';
|
|
13
13
|
import './chunk-DMX2F6B4.js';
|
|
14
14
|
import './chunk-QGNC7LH5.js';
|
|
15
15
|
import './modal.css';
|
|
@@ -35,7 +35,7 @@ function Modal({
|
|
|
35
35
|
const autoId = useId();
|
|
36
36
|
const panelId = id || "modal-" + autoId;
|
|
37
37
|
const close = () => setOpen(false);
|
|
38
|
-
const timings = resolveMotionTiming(animation, OV_TAKEOVER_TIMING);
|
|
38
|
+
const timings = resolveMotionTiming(animation, OV_TAKEOVER_TIMING, container ?? triggerRef.current);
|
|
39
39
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
40
40
|
ovCloneTrigger(trigger, {
|
|
41
41
|
open,
|
|
@@ -45,7 +45,7 @@ function Modal({
|
|
|
45
45
|
triggerRef,
|
|
46
46
|
activateOn
|
|
47
47
|
}),
|
|
48
|
-
/* @__PURE__ */ jsx(OverlayPortal, { container, children: /* @__PURE__ */ jsx(Presence, { children: open && /* @__PURE__ */ jsx(
|
|
48
|
+
/* @__PURE__ */ jsx(OverlayPortal, { container, scope: triggerRef.current, children: /* @__PURE__ */ jsx(Presence, { children: open && /* @__PURE__ */ jsx(
|
|
49
49
|
ModalShell,
|
|
50
50
|
{
|
|
51
51
|
timings,
|
package/dist/modal.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/composites/modal/Modal.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAkDO,SAAS,KAAA,CAAM;AAAA,EACpB,IAAA,EAAM,cAAA;AAAA,EACN,WAAA,GAAc,KAAA;AAAA,EACd,YAAA;AAAA,EACA,OAAA,GAAU,IAAA;AAAA,EACV,UAAA;AAAA,EACA,WAAA,GAAc,IAAA;AAAA,EACd,SAAA,GAAY,IAAA;AAAA,EACZ,EAAA;AAAA,EACA,SAAA;AAAA,EACA,UAAA;AAAA,EACA,SAAA;AAAA,EACA;AACF,CAAA,EAAe;AACb,EAAA,MAAM,CAAC,IAAA,EAAM,OAAO,IAAI,eAAA,CAAgB,cAAA,EAAgB,aAAa,YAAY,CAAA;AACjF,EAAA,MAAM,UAAA,GAAa,OAAoB,IAAI,CAAA;AAC3C,EAAA,MAAM,SAAS,KAAA,EAAM;AACrB,EAAA,MAAM,OAAA,GAAU,MAAM,QAAA,GAAW,MAAA;AACjC,EAAA,MAAM,KAAA,GAAQ,MAAM,OAAA,CAAQ,KAAK,CAAA;AACjC,EAAA,MAAM,
|
|
1
|
+
{"version":3,"sources":["../src/components/composites/modal/Modal.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAkDO,SAAS,KAAA,CAAM;AAAA,EACpB,IAAA,EAAM,cAAA;AAAA,EACN,WAAA,GAAc,KAAA;AAAA,EACd,YAAA;AAAA,EACA,OAAA,GAAU,IAAA;AAAA,EACV,UAAA;AAAA,EACA,WAAA,GAAc,IAAA;AAAA,EACd,SAAA,GAAY,IAAA;AAAA,EACZ,EAAA;AAAA,EACA,SAAA;AAAA,EACA,UAAA;AAAA,EACA,SAAA;AAAA,EACA;AACF,CAAA,EAAe;AACb,EAAA,MAAM,CAAC,IAAA,EAAM,OAAO,IAAI,eAAA,CAAgB,cAAA,EAAgB,aAAa,YAAY,CAAA;AACjF,EAAA,MAAM,UAAA,GAAa,OAAoB,IAAI,CAAA;AAC3C,EAAA,MAAM,SAAS,KAAA,EAAM;AACrB,EAAA,MAAM,OAAA,GAAU,MAAM,QAAA,GAAW,MAAA;AACjC,EAAA,MAAM,KAAA,GAAQ,MAAM,OAAA,CAAQ,KAAK,CAAA;AACjC,EAAA,MAAM,UAAU,mBAAA,CAAoB,SAAA,EAAW,kBAAA,EAAoB,SAAA,IAAa,WAAW,OAAO,CAAA;AAElG,EAAA,4BACG,QAAA,EAAA,EACE,QAAA,EAAA;AAAA,IAAA,cAAA,CAAe,OAAA,EAAS;AAAA,MACvB,IAAA;AAAA,MACA,OAAA,EAAS,MAAM,OAAA,CAAQ,IAAI,CAAA;AAAA,MAC3B,OAAA;AAAA,MACA,QAAA,EAAU,QAAA;AAAA,MACV,UAAA;AAAA,MACA;AAAA,KACD,CAAA;AAAA,oBACD,GAAA,CAAC,iBAAc,SAAA,EAAsB,KAAA,EAAO,WAAW,OAAA,EACrD,QAAA,kBAAA,GAAA,CAAC,YACE,QAAA,EAAA,IAAA,oBACC,GAAA;AAAA,MAAC,UAAA;AAAA,MAAA;AAAA,QAEC,OAAA;AAAA,QACA,SAAS,KAAA,CAAM,QAAA,CAAS,KAAA,CAAM,KAAA,EAAO,QAAQ,IAAI,CAAA;AAAA,QACjD,MAAM,MAAA,CAAO,QAAA,CAAS,KAAA,CAAM,KAAA,EAAO,QAAQ,KAAK,CAAA;AAAA,QAChD,UAAA,EAAW,yBAAA;AAAA,QACX,UAAA,EAAW,yBAAA;AAAA,QACX,OAAA;AAAA,QACA,WAAA;AAAA,QACA,SAAA;AAAA,QACA,YAAA,EAAc,KAAA;AAAA,QACd,UAAA,EAAY,SAAA;AAAA,QACZ,UAAA;AAAA,QAEC;AAAA,OAAA;AAAA,MAbG;AAAA,OAgBV,CAAA,EACF;AAAA,GAAA,EACF,CAAA;AAEJ","file":"modal.js","sourcesContent":["'use client';\n\nimport './modal.css';\n\nimport { Fragment, useId, useRef, type HTMLAttributes, type ReactElement, type ReactNode } from 'react';\n\nimport type { DataAttributes } from '../../../dom-props';\nimport { resolveMotionTiming } from '../../../motion/motion-timing';\nimport { Presence } from '../../../motion/presence';\nimport { popIn, popOut } from '../../../motion/presets';\nimport type { DisableableAnimation } from '../../../motion/timing';\nimport { UIMotion } from '../../../tokens/motion-tokens';\nimport { useControllable } from '../../internal/hooks/use-controllable';\nimport { ovCloneTrigger, OverlayPortal } from '../../internal/overlay/layer';\nimport { ModalShell, OV_TAKEOVER_TIMING } from '../../internal/overlay/modal';\nimport type { ActivateOn } from '../../internal/utils/activation';\n\nexport interface ModalProps {\n /** Controlled open state. Omit to stay uncontrolled. */\n open?: boolean;\n /** Initial state when uncontrolled. Default false. */\n defaultOpen?: boolean;\n /** Fires whenever the open state changes. Pair with `open` for controlled use. */\n onOpenChange?: (open: boolean) => void;\n\n /** Cloned to open the modal. */\n trigger?: ReactElement | null;\n /** Whether the trigger fires on `pointerdown` (snappier) or waits for `click`. @default 'click' */\n activateOn?: ActivateOn;\n\n /** Scrim/Esc dismissal. Default true. */\n dismissible?: boolean;\n\n /** Mount inside this element instead of the viewport - it must be positioned (`position: relative` or similar).\n * Scrim, scroll lock and inert scope to it; the rest of the page stays interactive. */\n container?: HTMLElement | null;\n\n /** Base id for the panel; drives the trigger's `aria-controls`. Auto-generated when omitted. */\n id?: string;\n /** Standard attributes (className, style, data-*, ...) forwarded to the panel - this is where your paint goes.\n * Centered by default; `width: 100%; height: 100%` makes it full-bleed. */\n htmlProps?: HTMLAttributes<HTMLDivElement> & DataAttributes;\n /** Standard attributes forwarded to the layer behind the panel - set `--bg-overlay` here to retint the scrim. */\n layerProps?: HTMLAttributes<HTMLDivElement> & DataAttributes;\n /** Open/close timing - motion tokens only, or `null` to disable. @default open 'slow'/'entrance', close 'base'/'standard' */\n animation?: DisableableAnimation;\n /** The ENTIRE surface - paint AND semantics (`role=\"dialog\"`, a label). Nothing is painted for you. */\n children: ReactNode;\n}\n\nexport function Modal({\n open: controlledOpen,\n defaultOpen = false,\n onOpenChange,\n trigger = null,\n activateOn,\n dismissible = true,\n container = null,\n id,\n htmlProps,\n layerProps,\n animation,\n children,\n}: ModalProps) {\n const [open, setOpen] = useControllable(controlledOpen, defaultOpen, onOpenChange);\n const triggerRef = useRef<HTMLElement>(null);\n const autoId = useId();\n const panelId = id || 'modal-' + autoId;\n const close = () => setOpen(false);\n const timings = resolveMotionTiming(animation, OV_TAKEOVER_TIMING, container ?? triggerRef.current);\n\n return (\n <Fragment>\n {ovCloneTrigger(trigger, {\n open,\n onPress: () => setOpen(true),\n panelId,\n haspopup: 'dialog',\n triggerRef,\n activateOn,\n })}\n <OverlayPortal container={container} scope={triggerRef.current}>\n <Presence>\n {open && (\n <ModalShell\n key=\"modal\"\n timings={timings}\n animate={popIn(UIMotion.scale.panel, timings.open)}\n exit={popOut(UIMotion.scale.panel, timings.close)}\n layerClass=\"zc-overlay-layer--modal\"\n panelClass=\"zc-overlay-panel--modal\"\n panelId={panelId}\n dismissible={dismissible}\n container={container}\n requestClose={close}\n panelProps={htmlProps}\n layerProps={layerProps}\n >\n {children}\n </ModalShell>\n )}\n </Presence>\n </OverlayPortal>\n </Fragment>\n );\n}\n"]}
|
package/dist/morphing-text.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-morphing-text {
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
--morphing-text-leading: 1.2;
|
|
13
13
|
/* Letter spacing. */
|
|
14
14
|
--morphing-text-tracking: var(--tracking-display);
|
|
15
|
-
/* How much letters blur
|
|
15
|
+
/* How much letters blur between words, 0 cutting clean. */
|
|
16
16
|
--morphing-text-smear: 1;
|
|
17
17
|
/* The rule at rest. */
|
|
18
18
|
--morphing-text-rule-ink: var(--text-strong);
|
package/dist/morphing-text.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
'use client';import { loop } from './chunk-
|
|
1
|
+
'use client';import { loop } from './chunk-XKDR22VE.js';
|
|
2
2
|
import './chunk-VNVVG47J.js';
|
|
3
|
-
import { UIMotion } from './chunk-
|
|
3
|
+
import { UIMotion } from './chunk-6H3IJ752.js';
|
|
4
4
|
import { cx } from './chunk-QGNC7LH5.js';
|
|
5
5
|
import './morphing-text.css';
|
|
6
6
|
import { useRef, useId, useEffect } from 'react';
|
package/dist/motion-devtools.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-mdt {
|
|
@@ -13,9 +13,10 @@
|
|
|
13
13
|
|
|
14
14
|
--mdt-offset: 16px;
|
|
15
15
|
--mdt-surface: color-mix(in oklab, var(--bg-surface, #fff) 88%, transparent);
|
|
16
|
+
--_mdt-body-max: calc(100dvh - var(--mdt-offset) * 2 - 3.25rem);
|
|
16
17
|
|
|
17
18
|
position: fixed;
|
|
18
|
-
z-index:
|
|
19
|
+
z-index: var(--layer-infinity, 2147483647);
|
|
19
20
|
display: flex;
|
|
20
21
|
color: var(--text-body, oklch(0.35 0.01 264));
|
|
21
22
|
font-family: var(--font-body, ui-sans-serif, system-ui, sans-serif);
|
|
@@ -88,6 +89,17 @@
|
|
|
88
89
|
.zc-mdt__head:focus-visible {
|
|
89
90
|
outline: var(--ring-accent, 3px solid oklch(0.7 0.12 185 / 0.35));
|
|
90
91
|
}
|
|
92
|
+
.zc-mdt--draggable .zc-mdt__head {
|
|
93
|
+
cursor: grab;
|
|
94
|
+
touch-action: none;
|
|
95
|
+
}
|
|
96
|
+
.zc-mdt[data-dragging] {
|
|
97
|
+
user-select: none;
|
|
98
|
+
}
|
|
99
|
+
.zc-mdt[data-dragging] .zc-mdt__head {
|
|
100
|
+
cursor: grabbing;
|
|
101
|
+
background: var(--neutral-wash, oklch(0.5 0.01 264 / 0.07));
|
|
102
|
+
}
|
|
91
103
|
|
|
92
104
|
.zc-mdt__glyph {
|
|
93
105
|
color: var(--text-subtle, oklch(0.6 0.01 264));
|
|
@@ -135,6 +147,10 @@
|
|
|
135
147
|
box-sizing: border-box;
|
|
136
148
|
width: 100%;
|
|
137
149
|
min-width: 208px; /* wider than the collapsed pill on purpose: the controls never reflow while it opens */
|
|
150
|
+
max-height: var(--_mdt-body-max);
|
|
151
|
+
overflow-y: auto;
|
|
152
|
+
scrollbar-width: thin;
|
|
153
|
+
scroll-padding-block: var(--ring-gutter, 3px);
|
|
138
154
|
display: flex;
|
|
139
155
|
flex-direction: column;
|
|
140
156
|
gap: 0.8125rem;
|
|
@@ -238,6 +254,65 @@
|
|
|
238
254
|
font-size: 0.6875rem;
|
|
239
255
|
line-height: 1.45;
|
|
240
256
|
color: var(--text-subtle, oklch(0.6 0.01 264));
|
|
257
|
+
margin: 0.5rem 0 0;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
.zc-mdt__more {
|
|
261
|
+
appearance: none;
|
|
262
|
+
display: flex;
|
|
263
|
+
align-items: center;
|
|
264
|
+
justify-content: space-between;
|
|
265
|
+
width: 100%;
|
|
266
|
+
padding: 0.125rem 0;
|
|
267
|
+
border: 0;
|
|
268
|
+
border-radius: var(--radius-sm, 0.25rem);
|
|
269
|
+
background: transparent;
|
|
270
|
+
color: var(--text-subtle, oklch(0.6 0.01 264));
|
|
271
|
+
font: inherit;
|
|
272
|
+
font-size: 0.6875rem;
|
|
273
|
+
font-weight: 650;
|
|
274
|
+
letter-spacing: 0.06em;
|
|
275
|
+
text-transform: uppercase;
|
|
276
|
+
cursor: pointer;
|
|
277
|
+
}
|
|
278
|
+
.zc-mdt__more:hover {
|
|
279
|
+
color: var(--text-body, oklch(0.35 0.01 264));
|
|
280
|
+
}
|
|
281
|
+
.zc-mdt__more:focus-visible {
|
|
282
|
+
outline: var(--ring-accent, 3px solid oklch(0.7 0.12 185 / 0.35));
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
.zc-mdt__keys {
|
|
286
|
+
display: flex;
|
|
287
|
+
flex-direction: column;
|
|
288
|
+
gap: 0.3125rem;
|
|
289
|
+
margin: 0.125rem 0 0;
|
|
290
|
+
}
|
|
291
|
+
.zc-mdt__keyrow {
|
|
292
|
+
display: flex;
|
|
293
|
+
align-items: center;
|
|
294
|
+
justify-content: space-between;
|
|
295
|
+
gap: 0.5rem;
|
|
296
|
+
}
|
|
297
|
+
.zc-mdt__keyrow dt {
|
|
298
|
+
font-size: 0.6875rem;
|
|
299
|
+
color: var(--text-muted, oklch(0.55 0.01 264));
|
|
300
|
+
}
|
|
301
|
+
.zc-mdt__keyrow dd {
|
|
302
|
+
display: flex;
|
|
303
|
+
gap: 0.1875rem;
|
|
241
304
|
margin: 0;
|
|
242
305
|
}
|
|
306
|
+
.zc-mdt__key {
|
|
307
|
+
min-width: 1.125rem;
|
|
308
|
+
padding: 0.0625rem 0.25rem;
|
|
309
|
+
border: 1px solid var(--border-subtle, oklch(0.92 0.004 264));
|
|
310
|
+
border-radius: var(--radius-sm, 0.25rem);
|
|
311
|
+
background: var(--bg-muted, oklch(0.97 0.004 264));
|
|
312
|
+
color: var(--text-subtle, oklch(0.6 0.01 264));
|
|
313
|
+
font-family: var(--font-code, ui-monospace, SFMono-Regular, Menlo, monospace);
|
|
314
|
+
font-size: 0.625rem;
|
|
315
|
+
line-height: 1.4;
|
|
316
|
+
text-align: center;
|
|
317
|
+
}
|
|
243
318
|
}
|
package/dist/motion-devtools.js
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
'use client';import { clock } from './chunk-
|
|
1
|
+
'use client';import { startDrag, clock } from './chunk-XKDR22VE.js';
|
|
2
2
|
import './chunk-VNVVG47J.js';
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
3
|
+
import { Button } from './chunk-RLNCRDAL.js';
|
|
4
|
+
import './chunk-KSAJ6DED.js';
|
|
5
|
+
import './chunk-NYQQH4R5.js';
|
|
6
|
+
import { motionDefaults } from './chunk-6H3IJ752.js';
|
|
5
7
|
import { Checkbox } from './chunk-GGDAMIBH.js';
|
|
6
8
|
import './chunk-3XRVPCIM.js';
|
|
7
9
|
import { Collapse } from './chunk-5VC3TUZ2.js';
|
|
8
10
|
import './chunk-DMX2F6B4.js';
|
|
9
11
|
import { cx } from './chunk-QGNC7LH5.js';
|
|
10
12
|
import './motion-devtools.css';
|
|
11
|
-
import { useState, useEffect } from 'react';
|
|
13
|
+
import { useState, useRef, useCallback, useEffect } from 'react';
|
|
12
14
|
import { createPortal } from 'react-dom';
|
|
13
15
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
14
16
|
|
|
@@ -48,7 +50,7 @@ function applyCssTokens() {
|
|
|
48
50
|
const ms = state.paused ? FROZEN_MS : baseMs[token] * state.factor;
|
|
49
51
|
return `${token}: ${ms}ms !important;`;
|
|
50
52
|
});
|
|
51
|
-
overrideSheet.textContent = `:root, [data-theme] { ${declarations.join(" ")} }`;
|
|
53
|
+
overrideSheet.textContent = `:root, [data-theme], [data-polarity] { ${declarations.join(" ")} }`;
|
|
52
54
|
}
|
|
53
55
|
function clearCssTokens() {
|
|
54
56
|
overrideSheet?.remove();
|
|
@@ -194,8 +196,51 @@ var motionSlowmo = {
|
|
|
194
196
|
return () => listeners.delete(cb);
|
|
195
197
|
}
|
|
196
198
|
};
|
|
199
|
+
var CHORDS = [
|
|
200
|
+
{ id: "freeze", code: "KeyP", label: "Freeze / resume", keys: ["P"] },
|
|
201
|
+
{ id: "slower", code: "Comma", label: "Slower", keys: [","] },
|
|
202
|
+
{ id: "faster", code: "Period", label: "Faster", keys: ["."] },
|
|
203
|
+
{ id: "realtime", code: "Digit0", label: "Real time", keys: ["0"] },
|
|
204
|
+
{ id: "panel", code: "KeyM", label: "Show / hide", keys: ["M"] }
|
|
205
|
+
];
|
|
197
206
|
var STORAGE_KEY = "zyncat-ui:motion-devtools";
|
|
207
|
+
var DRAG_SLOP_PX = 4;
|
|
208
|
+
var TEXT_INPUT_TYPES = /* @__PURE__ */ new Set([
|
|
209
|
+
"text",
|
|
210
|
+
"search",
|
|
211
|
+
"email",
|
|
212
|
+
"url",
|
|
213
|
+
"tel",
|
|
214
|
+
"password",
|
|
215
|
+
"number",
|
|
216
|
+
"date",
|
|
217
|
+
"time",
|
|
218
|
+
"datetime-local",
|
|
219
|
+
"month",
|
|
220
|
+
"week"
|
|
221
|
+
]);
|
|
198
222
|
var fmt = (n) => Number.isInteger(n) ? String(n) : n.toFixed(1);
|
|
223
|
+
var clampRange = (min, max, v) => v < min ? min : v > max ? max : v;
|
|
224
|
+
var altLabel = () => /mac|iphone|ipad|ipod/i.test(navigator.userAgent) ? "\u2325" : "Alt";
|
|
225
|
+
function isTextEntry(target) {
|
|
226
|
+
if (!(target instanceof HTMLElement)) return false;
|
|
227
|
+
if (target.isContentEditable) return true;
|
|
228
|
+
if (target instanceof HTMLTextAreaElement || target instanceof HTMLSelectElement) return true;
|
|
229
|
+
return target instanceof HTMLInputElement && TEXT_INPUT_TYPES.has(target.type);
|
|
230
|
+
}
|
|
231
|
+
function Chevron({ open }) {
|
|
232
|
+
return /* @__PURE__ */ jsx(
|
|
233
|
+
"svg",
|
|
234
|
+
{
|
|
235
|
+
className: "zc-mdt__chevron" + (open ? " zc-mdt__chevron--open" : ""),
|
|
236
|
+
width: "12",
|
|
237
|
+
height: "12",
|
|
238
|
+
viewBox: "0 0 12 12",
|
|
239
|
+
"aria-hidden": "true",
|
|
240
|
+
children: /* @__PURE__ */ jsx("path", { d: "M2.5 4.5 6 8l3.5-3.5", fill: "none", stroke: "currentColor", strokeWidth: "1.6", strokeLinecap: "round" })
|
|
241
|
+
}
|
|
242
|
+
);
|
|
243
|
+
}
|
|
199
244
|
function GaugeGlyph() {
|
|
200
245
|
return /* @__PURE__ */ jsxs("svg", { className: "zc-mdt__glyph", width: "15", height: "15", viewBox: "0 0 24 24", "aria-hidden": "true", children: [
|
|
201
246
|
/* @__PURE__ */ jsx(
|
|
@@ -223,6 +268,9 @@ function GaugeGlyph() {
|
|
|
223
268
|
/* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "1.6", fill: "currentColor" })
|
|
224
269
|
] });
|
|
225
270
|
}
|
|
271
|
+
function PauseGlyph() {
|
|
272
|
+
return /* @__PURE__ */ jsx("svg", { className: "zc-mdt__glyph", width: "15", height: "15", viewBox: "0 0 24 24", "aria-hidden": "true", children: /* @__PURE__ */ jsx("path", { d: "M9 5v14M15 5v14", fill: "none", stroke: "currentColor", strokeWidth: "2.4", strokeLinecap: "round" }) });
|
|
273
|
+
}
|
|
226
274
|
function MotionDevtools({
|
|
227
275
|
placement = "bottom-right",
|
|
228
276
|
offset = 16,
|
|
@@ -230,83 +278,179 @@ function MotionDevtools({
|
|
|
230
278
|
maxFactor = 16,
|
|
231
279
|
defaultFactor = 1,
|
|
232
280
|
scaleTimers = true,
|
|
281
|
+
hotkeys = true,
|
|
282
|
+
draggable = true,
|
|
233
283
|
persist = true,
|
|
234
284
|
defaultOpen = false,
|
|
235
285
|
className
|
|
236
286
|
}) {
|
|
237
287
|
const [mounted, setMounted] = useState(false);
|
|
238
288
|
const [open, setOpen] = useState(defaultOpen);
|
|
289
|
+
const [showKeys, setShowKeys] = useState(false);
|
|
239
290
|
const [snap, setSnap] = useState(() => motionSlowmo.get());
|
|
240
291
|
const [timers, setTimers] = useState(scaleTimers);
|
|
292
|
+
const rootRef = useRef(null);
|
|
293
|
+
const posRef = useRef({ x: 0, y: 0 });
|
|
294
|
+
const pressRef = useRef({ x: 0, y: 0 });
|
|
295
|
+
const runChordRef = useRef(() => {
|
|
296
|
+
});
|
|
297
|
+
const writePos = useCallback(() => {
|
|
298
|
+
const el = rootRef.current;
|
|
299
|
+
if (el) el.style.translate = `${posRef.current.x}px ${posRef.current.y}px`;
|
|
300
|
+
}, []);
|
|
301
|
+
const clampIntoView = useCallback(() => {
|
|
302
|
+
const el = rootRef.current;
|
|
303
|
+
if (!el) return;
|
|
304
|
+
writePos();
|
|
305
|
+
const rect = el.getBoundingClientRect();
|
|
306
|
+
const restLeft = rect.left - posRef.current.x;
|
|
307
|
+
const restTop = rect.top - posRef.current.y;
|
|
308
|
+
posRef.current = {
|
|
309
|
+
x: clampRange(-restLeft, window.innerWidth - rect.width - restLeft, posRef.current.x),
|
|
310
|
+
y: clampRange(-restTop, window.innerHeight - rect.height - restTop, posRef.current.y)
|
|
311
|
+
};
|
|
312
|
+
writePos();
|
|
313
|
+
}, [writePos]);
|
|
314
|
+
const savePrefs = useCallback(() => {
|
|
315
|
+
if (!persist) return;
|
|
316
|
+
const { factor, paused } = motionSlowmo.get();
|
|
317
|
+
try {
|
|
318
|
+
localStorage.setItem(STORAGE_KEY, JSON.stringify({ factor, paused, ...posRef.current }));
|
|
319
|
+
} catch {
|
|
320
|
+
}
|
|
321
|
+
}, [persist]);
|
|
322
|
+
const setFactor = (factor) => motionSlowmo.set({ factor, paused: false });
|
|
323
|
+
const stepFactor = (direction) => {
|
|
324
|
+
const ladder = [...new Set(presets)].sort((a, b) => a - b);
|
|
325
|
+
const current = motionSlowmo.get().factor;
|
|
326
|
+
const next = direction > 0 ? ladder.find((p) => p > current) : ladder.findLast((p) => p < current);
|
|
327
|
+
if (next !== void 0) setFactor(next);
|
|
328
|
+
};
|
|
329
|
+
const onHeadPointerDown = (e) => {
|
|
330
|
+
pressRef.current = { x: e.clientX, y: e.clientY };
|
|
331
|
+
const el = rootRef.current;
|
|
332
|
+
if (!draggable || e.button !== 0 || !el) return;
|
|
333
|
+
const start = { ...posRef.current };
|
|
334
|
+
let moved = false;
|
|
335
|
+
startDrag(e, {
|
|
336
|
+
onMove: (info) => {
|
|
337
|
+
if (!moved && Math.hypot(info.offset.x, info.offset.y) < DRAG_SLOP_PX) return;
|
|
338
|
+
moved = true;
|
|
339
|
+
el.dataset.dragging = "";
|
|
340
|
+
posRef.current = { x: start.x + info.offset.x, y: start.y + info.offset.y };
|
|
341
|
+
clampIntoView();
|
|
342
|
+
},
|
|
343
|
+
onEnd: () => {
|
|
344
|
+
if (!moved) return;
|
|
345
|
+
delete el.dataset.dragging;
|
|
346
|
+
savePrefs();
|
|
347
|
+
}
|
|
348
|
+
});
|
|
349
|
+
};
|
|
350
|
+
const isDragRelease = (e) => e.detail !== 0 && Math.hypot(e.clientX - pressRef.current.x, e.clientY - pressRef.current.y) >= DRAG_SLOP_PX;
|
|
241
351
|
useEffect(() => motionSlowmo.subscribe(setSnap), []);
|
|
242
352
|
useEffect(() => {
|
|
243
353
|
setMounted(true);
|
|
244
|
-
let
|
|
354
|
+
let stored = {};
|
|
245
355
|
if (persist) {
|
|
246
356
|
try {
|
|
247
357
|
const raw = localStorage.getItem(STORAGE_KEY);
|
|
248
|
-
if (raw)
|
|
358
|
+
if (raw) stored = JSON.parse(raw);
|
|
249
359
|
} catch {
|
|
250
360
|
}
|
|
251
361
|
}
|
|
252
|
-
|
|
253
|
-
|
|
362
|
+
posRef.current = { x: stored.x ?? 0, y: stored.y ?? 0 };
|
|
363
|
+
const factor = stored.factor ?? defaultFactor;
|
|
364
|
+
const paused = stored.paused ?? false;
|
|
365
|
+
motionSlowmo.set({ factor, paused });
|
|
366
|
+
if (shouldBeActive(factor, paused)) setOpen(true);
|
|
254
367
|
}, []);
|
|
255
368
|
useEffect(() => {
|
|
256
369
|
motionSlowmo.configure({ scaleTimers: timers });
|
|
257
370
|
}, [timers]);
|
|
258
371
|
useEffect(() => {
|
|
259
|
-
if (
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
372
|
+
if (mounted) savePrefs();
|
|
373
|
+
}, [snap.factor, snap.paused, mounted, savePrefs]);
|
|
374
|
+
useEffect(() => {
|
|
375
|
+
const el = rootRef.current;
|
|
376
|
+
if (!mounted || !el) return;
|
|
377
|
+
const observer = new ResizeObserver(clampIntoView);
|
|
378
|
+
observer.observe(el);
|
|
379
|
+
window.addEventListener("resize", clampIntoView);
|
|
380
|
+
return () => {
|
|
381
|
+
observer.disconnect();
|
|
382
|
+
window.removeEventListener("resize", clampIntoView);
|
|
383
|
+
};
|
|
384
|
+
}, [mounted, clampIntoView]);
|
|
385
|
+
useEffect(() => {
|
|
386
|
+
runChordRef.current = (id) => {
|
|
387
|
+
const live = motionSlowmo.get();
|
|
388
|
+
switch (id) {
|
|
389
|
+
case "freeze":
|
|
390
|
+
return motionSlowmo.set({ paused: !live.paused });
|
|
391
|
+
case "slower":
|
|
392
|
+
return stepFactor(1);
|
|
393
|
+
case "faster":
|
|
394
|
+
return stepFactor(-1);
|
|
395
|
+
case "realtime":
|
|
396
|
+
return motionSlowmo.reset();
|
|
397
|
+
case "panel":
|
|
398
|
+
return setOpen((o) => !o);
|
|
399
|
+
}
|
|
400
|
+
};
|
|
401
|
+
});
|
|
402
|
+
useEffect(() => {
|
|
403
|
+
if (!hotkeys) return;
|
|
404
|
+
const onKeyDown = (e) => {
|
|
405
|
+
if (!e.altKey || e.ctrlKey || e.metaKey || e.shiftKey || isTextEntry(e.target)) return;
|
|
406
|
+
const chord = CHORDS.find((c) => c.code === e.code);
|
|
407
|
+
if (!chord) return;
|
|
408
|
+
e.preventDefault();
|
|
409
|
+
e.stopPropagation();
|
|
410
|
+
runChordRef.current(chord.id);
|
|
411
|
+
};
|
|
412
|
+
window.addEventListener("keydown", onKeyDown, true);
|
|
413
|
+
return () => window.removeEventListener("keydown", onKeyDown, true);
|
|
414
|
+
}, [hotkeys]);
|
|
265
415
|
if (!mounted) return null;
|
|
266
416
|
const active2 = shouldBeActive(snap.factor, snap.paused);
|
|
417
|
+
const fill = `${(Math.min(snap.factor, maxFactor) - 1) / Math.max(1, maxFactor - 1) * 100}%`;
|
|
418
|
+
const alt = altLabel();
|
|
419
|
+
const readout = snap.paused ? { value: "Paused", unit: "frozen" } : snap.factor === 1 ? { value: "Normal", unit: "real-time" } : { value: `${fmt(snap.factor)}\xD7`, unit: "slower" };
|
|
267
420
|
const rootClass = cx(
|
|
268
421
|
"zc-mdt",
|
|
269
422
|
`zc-mdt--${placement}`,
|
|
270
423
|
active2 && "zc-mdt--active",
|
|
271
424
|
snap.paused && "zc-mdt--paused",
|
|
425
|
+
draggable && "zc-mdt--draggable",
|
|
272
426
|
className
|
|
273
427
|
);
|
|
274
|
-
const setFactor = (factor) => motionSlowmo.set({ factor, paused: false });
|
|
275
|
-
const fill = `${(Math.min(snap.factor, maxFactor) - 1) / Math.max(1, maxFactor - 1) * 100}%`;
|
|
276
|
-
const pillBadge = snap.factor === 1 ? "1\xD7" : `${fmt(snap.factor)}\xD7`;
|
|
277
428
|
return createPortal(
|
|
278
|
-
/* @__PURE__ */ jsx("div", { className: rootClass, style: { "--mdt-offset": `${offset}px` }, children: /* @__PURE__ */ jsxs("div", { className: "zc-mdt__panel" + (open ? " zc-is-open" : ""), role: "group", "aria-label": "Motion devtools", children: [
|
|
429
|
+
/* @__PURE__ */ jsx("div", { ref: rootRef, className: rootClass, style: { "--mdt-offset": `${offset}px` }, children: /* @__PURE__ */ jsxs("div", { className: "zc-mdt__panel" + (open ? " zc-is-open" : ""), role: "group", "aria-label": "Motion devtools", children: [
|
|
279
430
|
/* @__PURE__ */ jsxs(
|
|
280
431
|
"button",
|
|
281
432
|
{
|
|
282
433
|
className: "zc-mdt__head",
|
|
283
|
-
|
|
434
|
+
onPointerDown: onHeadPointerDown,
|
|
435
|
+
onClick: (e) => {
|
|
436
|
+
if (!isDragRelease(e)) setOpen((o) => !o);
|
|
437
|
+
},
|
|
284
438
|
"aria-expanded": open,
|
|
285
|
-
title: "Motion devtools",
|
|
439
|
+
title: draggable ? "Motion devtools - drag to move" : "Motion devtools",
|
|
286
440
|
"aria-label": open ? "Collapse motion devtools" : "Expand motion devtools",
|
|
287
441
|
children: [
|
|
288
|
-
/* @__PURE__ */ jsx(GaugeGlyph, {}),
|
|
442
|
+
snap.paused ? /* @__PURE__ */ jsx(PauseGlyph, {}) : /* @__PURE__ */ jsx(GaugeGlyph, {}),
|
|
289
443
|
/* @__PURE__ */ jsx("span", { className: "zc-mdt__spacer" }),
|
|
290
|
-
/* @__PURE__ */ jsx("span", { className: "zc-mdt__badge", children:
|
|
291
|
-
/* @__PURE__ */ jsx(
|
|
292
|
-
"svg",
|
|
293
|
-
{
|
|
294
|
-
className: "zc-mdt__chevron" + (open ? " zc-mdt__chevron--open" : ""),
|
|
295
|
-
width: "12",
|
|
296
|
-
height: "12",
|
|
297
|
-
viewBox: "0 0 12 12",
|
|
298
|
-
"aria-hidden": "true",
|
|
299
|
-
children: /* @__PURE__ */ jsx("path", { d: "M2.5 4.5 6 8l3.5-3.5", fill: "none", stroke: "currentColor", strokeWidth: "1.6", strokeLinecap: "round" })
|
|
300
|
-
}
|
|
301
|
-
)
|
|
444
|
+
/* @__PURE__ */ jsx("span", { className: "zc-mdt__badge", children: `${fmt(snap.factor)}\xD7` }),
|
|
445
|
+
/* @__PURE__ */ jsx(Chevron, { open })
|
|
302
446
|
]
|
|
303
447
|
}
|
|
304
448
|
),
|
|
305
449
|
/* @__PURE__ */ jsx(Collapse, { open, fade: true, children: /* @__PURE__ */ jsxs("div", { className: "zc-mdt__body", children: [
|
|
306
450
|
/* @__PURE__ */ jsx("span", { className: "zc-mdt__title", children: "Motion" }),
|
|
307
451
|
/* @__PURE__ */ jsxs("div", { className: "zc-mdt__readout", children: [
|
|
308
|
-
/* @__PURE__ */ jsx("span", { className: "zc-mdt__value", children:
|
|
309
|
-
/* @__PURE__ */ jsx("span", { className: "zc-mdt__unit", children:
|
|
452
|
+
/* @__PURE__ */ jsx("span", { className: "zc-mdt__value", children: readout.value }),
|
|
453
|
+
/* @__PURE__ */ jsx("span", { className: "zc-mdt__unit", children: readout.unit })
|
|
310
454
|
] }),
|
|
311
455
|
/* @__PURE__ */ jsx(
|
|
312
456
|
"input",
|
|
@@ -349,7 +493,20 @@ function MotionDevtools({
|
|
|
349
493
|
] }),
|
|
350
494
|
/* @__PURE__ */ jsxs("div", { className: "zc-mdt__opt", children: [
|
|
351
495
|
/* @__PURE__ */ jsx(Checkbox, { size: "sm", checked: timers, onChange: (e) => setTimers(e.target.checked), label: "Scale timers" }),
|
|
352
|
-
/* @__PURE__ */
|
|
496
|
+
/* @__PURE__ */ jsxs("button", { className: "zc-mdt__more", onClick: () => setShowKeys((k) => !k), "aria-expanded": showKeys, children: [
|
|
497
|
+
/* @__PURE__ */ jsx("span", { children: "Shortcuts" }),
|
|
498
|
+
/* @__PURE__ */ jsx(Chevron, { open: showKeys })
|
|
499
|
+
] }),
|
|
500
|
+
/* @__PURE__ */ jsxs(Collapse, { open: showKeys, fade: true, children: [
|
|
501
|
+
/* @__PURE__ */ jsx("dl", { className: "zc-mdt__keys", children: CHORDS.map((chord) => /* @__PURE__ */ jsxs("div", { className: "zc-mdt__keyrow", children: [
|
|
502
|
+
/* @__PURE__ */ jsx("dt", { children: chord.label }),
|
|
503
|
+
/* @__PURE__ */ jsxs("dd", { children: [
|
|
504
|
+
/* @__PURE__ */ jsx("kbd", { className: "zc-mdt__key", children: alt }),
|
|
505
|
+
chord.keys.map((key) => /* @__PURE__ */ jsx("kbd", { className: "zc-mdt__key", children: key }, key))
|
|
506
|
+
] })
|
|
507
|
+
] }, chord.id)) }),
|
|
508
|
+
/* @__PURE__ */ jsx("p", { className: "zc-mdt__hint", children: "Timer scaling keeps duration-based cleanups from cutting slowed animations short." })
|
|
509
|
+
] })
|
|
353
510
|
] })
|
|
354
511
|
] }) })
|
|
355
512
|
] }) }),
|