@zyncat/ui 0.15.0 → 0.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +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 +21 -24
- package/dist/button.js +3 -1
- package/dist/checkbox.css +1 -1
- package/dist/chunk-2YGHPQ66.js +16 -0
- package/dist/chunk-2YGHPQ66.js.map +1 -0
- package/dist/{chunk-K45CWVHS.js → chunk-3MLUH2QL.js} +4 -4
- package/dist/{chunk-K45CWVHS.js.map → chunk-3MLUH2QL.js.map} +1 -1
- package/dist/{chunk-FVPNICF4.js → chunk-4PQDVK23.js} +4 -4
- package/dist/{chunk-FVPNICF4.js.map → chunk-4PQDVK23.js.map} +1 -1
- package/dist/{chunk-FLQVOSFC.js → chunk-6IXLW7QA.js} +7 -7
- package/dist/{chunk-FLQVOSFC.js.map → chunk-6IXLW7QA.js.map} +1 -1
- package/dist/chunk-7NHY2CRA.js +132 -0
- package/dist/chunk-7NHY2CRA.js.map +1 -0
- package/dist/{chunk-BH4JFWXQ.js → chunk-7VTWJL72.js} +19 -16
- package/dist/chunk-7VTWJL72.js.map +1 -0
- package/dist/chunk-7ZSIUUC3.js +50 -0
- package/dist/chunk-7ZSIUUC3.js.map +1 -0
- package/dist/{chunk-6X3G4GIM.js → chunk-DH7DT6EO.js} +3 -3
- package/dist/{chunk-6X3G4GIM.js.map → chunk-DH7DT6EO.js.map} +1 -1
- package/dist/{chunk-QGVFFT2B.js → chunk-EOWWVFBF.js} +3 -3
- package/dist/{chunk-QGVFFT2B.js.map → chunk-EOWWVFBF.js.map} +1 -1
- package/dist/{chunk-RBSHRRNO.js → chunk-FLDIRXFU.js} +5 -5
- package/dist/{chunk-RBSHRRNO.js.map → chunk-FLDIRXFU.js.map} +1 -1
- package/dist/{chunk-5GBV45YD.js → chunk-GWCBTD63.js} +3 -3
- package/dist/{chunk-5GBV45YD.js.map → chunk-GWCBTD63.js.map} +1 -1
- package/dist/chunk-GZ6UMHCK.js +103 -0
- package/dist/chunk-GZ6UMHCK.js.map +1 -0
- package/dist/{chunk-FEXUS4SV.js → chunk-HWDIVGME.js} +11 -5
- package/dist/chunk-HWDIVGME.js.map +1 -0
- package/dist/chunk-KSAJ6DED.js +16 -0
- package/dist/chunk-KSAJ6DED.js.map +1 -0
- package/dist/{chunk-UYSXJ7MH.js → chunk-LH2UIEKN.js} +7 -17
- package/dist/chunk-LH2UIEKN.js.map +1 -0
- package/dist/{chunk-CAXQJSIE.js → chunk-M2A6PZ7J.js} +6 -6
- package/dist/{chunk-CAXQJSIE.js.map → chunk-M2A6PZ7J.js.map} +1 -1
- package/dist/chunk-NYQQH4R5.js +40 -0
- package/dist/chunk-NYQQH4R5.js.map +1 -0
- package/dist/{chunk-BTF6DAE3.js → chunk-ODRO3KS6.js} +4 -4
- package/dist/{chunk-BTF6DAE3.js.map → chunk-ODRO3KS6.js.map} +1 -1
- 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-MDSRZ4QR.js → chunk-RY35IU3G.js} +3 -3
- package/dist/{chunk-MDSRZ4QR.js.map → chunk-RY35IU3G.js.map} +1 -1
- package/dist/{chunk-GOLSYGRA.js → chunk-TBLPZQSI.js} +84 -48
- package/dist/chunk-TBLPZQSI.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-CFRGQJ23.js → chunk-VZXML7EH.js} +4 -4
- package/dist/{chunk-CFRGQJ23.js.map → chunk-VZXML7EH.js.map} +1 -1
- package/dist/{chunk-PWQVSVXR.js → chunk-WC45VSST.js} +8 -8
- package/dist/{chunk-PWQVSVXR.js.map → chunk-WC45VSST.js.map} +1 -1
- package/dist/chunk-WQKWPI6V.js +196 -0
- package/dist/chunk-WQKWPI6V.js.map +1 -0
- package/dist/{chunk-N2GJEO5Z.js → chunk-ZHMOH62S.js} +4 -4
- package/dist/chunk-ZHMOH62S.js.map +1 -0
- package/dist/cli.js +259 -43
- package/dist/collapse.css +8 -5
- package/dist/confetti.css +3 -3
- package/dist/confetti.js +2 -2
- package/dist/date-field.js +16 -14
- package/dist/date-field.js.map +1 -1
- package/dist/date-picker.css +168 -43
- package/dist/date-range-field.js +38 -23
- package/dist/date-range-field.js.map +1 -1
- package/dist/datetime-field.js +17 -15
- package/dist/datetime-field.js.map +1 -1
- package/dist/dialog.css +4 -3
- package/dist/dialog.js +8 -8
- package/dist/digit-strip.css +1 -1
- package/dist/dropdown.css +1 -1
- package/dist/dropdown.js +8 -8
- package/dist/emoji-picker.js +14 -14
- 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 +6 -6
- 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 +9 -9
- 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 +6 -6
- package/dist/radio-group.css +6 -4
- package/dist/radio-group.js +6 -6
- package/dist/select.css +1 -1
- package/dist/select.js +9 -9
- package/dist/sheet.css +1 -1
- package/dist/sheet.js +7 -7
- 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 +97 -105
- 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 +6 -6
- 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-LLC644ZR.js +346 -0
- package/dist/theme-transition-LLC644ZR.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 +11 -9
- 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 +5 -5
- 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/icon/Icon.d.ts +1 -0
- 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/tokens/component-styles.generated.d.ts +35 -38
- package/dist/types/tokens/motion-tokens.d.ts +2 -2
- 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 +121 -109
- 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/weight-field.css +2 -2
- package/dist/youtube.css +1 -1
- package/dist/youtube.js +2 -2
- package/package.json +25 -31
- package/skills/zyncat-ui/references/components.md +5 -2
- 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.css +4 -3
- package/src/components/composites/dropdown/dropdown.css +1 -1
- package/src/components/composites/emoji-picker/styles.css +1 -1
- package/src/components/composites/modal/modal.css +1 -1
- package/src/components/composites/pagination/pagination.css +1 -1
- package/src/components/composites/popover/popover.css +1 -1
- package/src/components/composites/select/select.css +1 -1
- package/src/components/composites/sheet/sheet.css +1 -1
- package/src/components/composites/table/table.css +2 -2
- 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.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/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/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/overlay.css +1 -1
- package/src/components/internal/overlay/trigger.css +1 -1
- 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 +12 -26
- package/src/components/primitives/button/button-style.ts +28 -0
- package/src/components/primitives/button/button.css +21 -24
- 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/styles.css +3 -3
- 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 +5 -8
- 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 +3 -3
- 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 +10 -18
- 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 +124 -110
- 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 +7 -13
- 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-FEXUS4SV.js.map +0 -1
- package/dist/chunk-GOLSYGRA.js.map +0 -1
- package/dist/chunk-N2GJEO5Z.js.map +0 -1
- package/dist/chunk-UYSXJ7MH.js.map +0 -1
|
@@ -2,9 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
import './motion-devtools.css';
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
useCallback,
|
|
7
|
+
useEffect,
|
|
8
|
+
useRef,
|
|
9
|
+
useState,
|
|
10
|
+
type CSSProperties,
|
|
11
|
+
type MouseEvent as ReactMouseEvent,
|
|
12
|
+
type PointerEvent as ReactPointerEvent,
|
|
13
|
+
} from 'react';
|
|
6
14
|
import { createPortal } from 'react-dom';
|
|
7
15
|
|
|
16
|
+
import { startDrag } from '../../engine';
|
|
8
17
|
import { cx } from '../internal/utils/cx';
|
|
9
18
|
import { Button } from '../primitives/button/Button';
|
|
10
19
|
import { Checkbox } from '../primitives/checkbox/Checkbox';
|
|
@@ -14,11 +23,12 @@ import { motionSlowmo, shouldBeActive, type SlowmoState } from './slowmo-engine'
|
|
|
14
23
|
export type MotionDevtoolsPlacement = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
|
|
15
24
|
|
|
16
25
|
export interface MotionDevtoolsProps {
|
|
17
|
-
/** Which corner of the viewport
|
|
26
|
+
/** Which corner of the viewport the panel rests in. Dragging moves it off. @default 'bottom-right' */
|
|
18
27
|
placement?: MotionDevtoolsPlacement;
|
|
19
|
-
/** Distance from the viewport edges, in px. @default 16 */
|
|
28
|
+
/** Distance from the viewport edges at rest, in px. @default 16 */
|
|
20
29
|
offset?: number;
|
|
21
|
-
/** Quick-select slow-down factors (1 = real time).
|
|
30
|
+
/** Quick-select slow-down factors (1 = real time). Also the ladder the slower/faster
|
|
31
|
+
* shortcuts step through. @default [1, 2, 4, 8, 16] */
|
|
22
32
|
presets?: number[];
|
|
23
33
|
/** Upper bound of the fine slider. @default 16 */
|
|
24
34
|
maxFactor?: number;
|
|
@@ -27,7 +37,11 @@ export interface MotionDevtoolsProps {
|
|
|
27
37
|
/** Scale setTimeout/setInterval too, so duration-coupled JS cleanups don't truncate
|
|
28
38
|
* slowed CSS. Exposed as a live toggle in the panel. @default true */
|
|
29
39
|
scaleTimers?: boolean;
|
|
30
|
-
/**
|
|
40
|
+
/** Bind the global Alt-chord shortcuts. The panel lists them under Shortcuts. @default true */
|
|
41
|
+
hotkeys?: boolean;
|
|
42
|
+
/** Let the panel be dragged anywhere in the viewport by its header. @default true */
|
|
43
|
+
draggable?: boolean;
|
|
44
|
+
/** Remember the chosen factor and dragged position across reloads (localStorage). @default true */
|
|
31
45
|
persist?: boolean;
|
|
32
46
|
/** Start with the full panel open rather than collapsed to its header. @default false */
|
|
33
47
|
defaultOpen?: boolean;
|
|
@@ -35,8 +49,64 @@ export interface MotionDevtoolsProps {
|
|
|
35
49
|
className?: string;
|
|
36
50
|
}
|
|
37
51
|
|
|
52
|
+
type ChordId = 'freeze' | 'slower' | 'faster' | 'realtime' | 'panel';
|
|
53
|
+
|
|
54
|
+
interface Chord {
|
|
55
|
+
id: ChordId;
|
|
56
|
+
code: string;
|
|
57
|
+
label: string;
|
|
58
|
+
keys: string[];
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const CHORDS: Chord[] = [
|
|
62
|
+
{ id: 'freeze', code: 'KeyP', label: 'Freeze / resume', keys: ['P'] },
|
|
63
|
+
{ id: 'slower', code: 'Comma', label: 'Slower', keys: [','] },
|
|
64
|
+
{ id: 'faster', code: 'Period', label: 'Faster', keys: ['.'] },
|
|
65
|
+
{ id: 'realtime', code: 'Digit0', label: 'Real time', keys: ['0'] },
|
|
66
|
+
{ id: 'panel', code: 'KeyM', label: 'Show / hide', keys: ['M'] },
|
|
67
|
+
];
|
|
68
|
+
|
|
38
69
|
const STORAGE_KEY = 'zyncat-ui:motion-devtools';
|
|
70
|
+
const DRAG_SLOP_PX = 4;
|
|
71
|
+
const TEXT_INPUT_TYPES = new Set([
|
|
72
|
+
'text',
|
|
73
|
+
'search',
|
|
74
|
+
'email',
|
|
75
|
+
'url',
|
|
76
|
+
'tel',
|
|
77
|
+
'password',
|
|
78
|
+
'number',
|
|
79
|
+
'date',
|
|
80
|
+
'time',
|
|
81
|
+
'datetime-local',
|
|
82
|
+
'month',
|
|
83
|
+
'week',
|
|
84
|
+
]);
|
|
85
|
+
|
|
39
86
|
const fmt = (n: number) => (Number.isInteger(n) ? String(n) : n.toFixed(1));
|
|
87
|
+
const clampRange = (min: number, max: number, v: number) => (v < min ? min : v > max ? max : v);
|
|
88
|
+
const altLabel = () => (/mac|iphone|ipad|ipod/i.test(navigator.userAgent) ? '⌥' : 'Alt');
|
|
89
|
+
|
|
90
|
+
function isTextEntry(target: EventTarget | null): boolean {
|
|
91
|
+
if (!(target instanceof HTMLElement)) return false;
|
|
92
|
+
if (target.isContentEditable) return true;
|
|
93
|
+
if (target instanceof HTMLTextAreaElement || target instanceof HTMLSelectElement) return true;
|
|
94
|
+
return target instanceof HTMLInputElement && TEXT_INPUT_TYPES.has(target.type);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
function Chevron({ open }: { open: boolean }) {
|
|
98
|
+
return (
|
|
99
|
+
<svg
|
|
100
|
+
className={'zc-mdt__chevron' + (open ? ' zc-mdt__chevron--open' : '')}
|
|
101
|
+
width="12"
|
|
102
|
+
height="12"
|
|
103
|
+
viewBox="0 0 12 12"
|
|
104
|
+
aria-hidden="true"
|
|
105
|
+
>
|
|
106
|
+
<path d="M2.5 4.5 6 8l3.5-3.5" fill="none" stroke="currentColor" strokeWidth="1.6" strokeLinecap="round" />
|
|
107
|
+
</svg>
|
|
108
|
+
);
|
|
109
|
+
}
|
|
40
110
|
|
|
41
111
|
function GaugeGlyph() {
|
|
42
112
|
return (
|
|
@@ -62,6 +132,14 @@ function GaugeGlyph() {
|
|
|
62
132
|
);
|
|
63
133
|
}
|
|
64
134
|
|
|
135
|
+
function PauseGlyph() {
|
|
136
|
+
return (
|
|
137
|
+
<svg className="zc-mdt__glyph" width="15" height="15" viewBox="0 0 24 24" aria-hidden="true">
|
|
138
|
+
<path d="M9 5v14M15 5v14" fill="none" stroke="currentColor" strokeWidth="2.4" strokeLinecap="round" />
|
|
139
|
+
</svg>
|
|
140
|
+
);
|
|
141
|
+
}
|
|
142
|
+
|
|
65
143
|
export function MotionDevtools({
|
|
66
144
|
placement = 'bottom-right',
|
|
67
145
|
offset = 16,
|
|
@@ -69,28 +147,100 @@ export function MotionDevtools({
|
|
|
69
147
|
maxFactor = 16,
|
|
70
148
|
defaultFactor = 1,
|
|
71
149
|
scaleTimers = true,
|
|
150
|
+
hotkeys = true,
|
|
151
|
+
draggable = true,
|
|
72
152
|
persist = true,
|
|
73
153
|
defaultOpen = false,
|
|
74
154
|
className,
|
|
75
155
|
}: MotionDevtoolsProps) {
|
|
76
156
|
const [mounted, setMounted] = useState(false);
|
|
77
157
|
const [open, setOpen] = useState(defaultOpen);
|
|
158
|
+
const [showKeys, setShowKeys] = useState(false);
|
|
78
159
|
const [snap, setSnap] = useState<SlowmoState>(() => motionSlowmo.get());
|
|
79
160
|
const [timers, setTimers] = useState(scaleTimers);
|
|
80
161
|
|
|
162
|
+
const rootRef = useRef<HTMLDivElement>(null);
|
|
163
|
+
const posRef = useRef({ x: 0, y: 0 });
|
|
164
|
+
const pressRef = useRef({ x: 0, y: 0 });
|
|
165
|
+
const runChordRef = useRef<(id: ChordId) => void>(() => {});
|
|
166
|
+
|
|
167
|
+
const writePos = useCallback(() => {
|
|
168
|
+
const el = rootRef.current;
|
|
169
|
+
if (el) el.style.translate = `${posRef.current.x}px ${posRef.current.y}px`;
|
|
170
|
+
}, []);
|
|
171
|
+
|
|
172
|
+
const clampIntoView = useCallback(() => {
|
|
173
|
+
const el = rootRef.current;
|
|
174
|
+
if (!el) return;
|
|
175
|
+
writePos();
|
|
176
|
+
const rect = el.getBoundingClientRect();
|
|
177
|
+
const restLeft = rect.left - posRef.current.x;
|
|
178
|
+
const restTop = rect.top - posRef.current.y;
|
|
179
|
+
posRef.current = {
|
|
180
|
+
x: clampRange(-restLeft, window.innerWidth - rect.width - restLeft, posRef.current.x),
|
|
181
|
+
y: clampRange(-restTop, window.innerHeight - rect.height - restTop, posRef.current.y),
|
|
182
|
+
};
|
|
183
|
+
writePos();
|
|
184
|
+
}, [writePos]);
|
|
185
|
+
|
|
186
|
+
const savePrefs = useCallback(() => {
|
|
187
|
+
if (!persist) return;
|
|
188
|
+
const { factor, paused } = motionSlowmo.get();
|
|
189
|
+
try {
|
|
190
|
+
localStorage.setItem(STORAGE_KEY, JSON.stringify({ factor, paused, ...posRef.current }));
|
|
191
|
+
} catch {}
|
|
192
|
+
}, [persist]);
|
|
193
|
+
|
|
194
|
+
const setFactor = (factor: number) => motionSlowmo.set({ factor, paused: false });
|
|
195
|
+
|
|
196
|
+
const stepFactor = (direction: 1 | -1) => {
|
|
197
|
+
const ladder = [...new Set(presets)].sort((a, b) => a - b);
|
|
198
|
+
const current = motionSlowmo.get().factor;
|
|
199
|
+
const next = direction > 0 ? ladder.find((p) => p > current) : ladder.findLast((p) => p < current);
|
|
200
|
+
if (next !== undefined) setFactor(next);
|
|
201
|
+
};
|
|
202
|
+
|
|
203
|
+
const onHeadPointerDown = (e: ReactPointerEvent<HTMLButtonElement>) => {
|
|
204
|
+
pressRef.current = { x: e.clientX, y: e.clientY };
|
|
205
|
+
const el = rootRef.current;
|
|
206
|
+
if (!draggable || e.button !== 0 || !el) return;
|
|
207
|
+
const start = { ...posRef.current };
|
|
208
|
+
let moved = false;
|
|
209
|
+
startDrag(e, {
|
|
210
|
+
onMove: (info) => {
|
|
211
|
+
if (!moved && Math.hypot(info.offset.x, info.offset.y) < DRAG_SLOP_PX) return;
|
|
212
|
+
moved = true;
|
|
213
|
+
el.dataset.dragging = '';
|
|
214
|
+
posRef.current = { x: start.x + info.offset.x, y: start.y + info.offset.y };
|
|
215
|
+
clampIntoView();
|
|
216
|
+
},
|
|
217
|
+
onEnd: () => {
|
|
218
|
+
if (!moved) return;
|
|
219
|
+
delete el.dataset.dragging;
|
|
220
|
+
savePrefs();
|
|
221
|
+
},
|
|
222
|
+
});
|
|
223
|
+
};
|
|
224
|
+
|
|
225
|
+
const isDragRelease = (e: ReactMouseEvent<HTMLButtonElement>) =>
|
|
226
|
+
e.detail !== 0 && Math.hypot(e.clientX - pressRef.current.x, e.clientY - pressRef.current.y) >= DRAG_SLOP_PX;
|
|
227
|
+
|
|
81
228
|
useEffect(() => motionSlowmo.subscribe(setSnap), []);
|
|
82
229
|
|
|
83
230
|
useEffect(() => {
|
|
84
231
|
setMounted(true);
|
|
85
|
-
let
|
|
232
|
+
let stored: { factor?: number; paused?: boolean; x?: number; y?: number } = {};
|
|
86
233
|
if (persist) {
|
|
87
234
|
try {
|
|
88
235
|
const raw = localStorage.getItem(STORAGE_KEY);
|
|
89
|
-
if (raw)
|
|
236
|
+
if (raw) stored = JSON.parse(raw);
|
|
90
237
|
} catch {}
|
|
91
238
|
}
|
|
92
|
-
|
|
93
|
-
|
|
239
|
+
posRef.current = { x: stored.x ?? 0, y: stored.y ?? 0 };
|
|
240
|
+
const factor = stored.factor ?? defaultFactor;
|
|
241
|
+
const paused = stored.paused ?? false;
|
|
242
|
+
motionSlowmo.set({ factor, paused });
|
|
243
|
+
if (shouldBeActive(factor, paused)) setOpen(true);
|
|
94
244
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
95
245
|
}, []);
|
|
96
246
|
|
|
@@ -99,61 +249,99 @@ export function MotionDevtools({
|
|
|
99
249
|
}, [timers]);
|
|
100
250
|
|
|
101
251
|
useEffect(() => {
|
|
102
|
-
if (
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
252
|
+
if (mounted) savePrefs();
|
|
253
|
+
}, [snap.factor, snap.paused, mounted, savePrefs]);
|
|
254
|
+
|
|
255
|
+
useEffect(() => {
|
|
256
|
+
const el = rootRef.current;
|
|
257
|
+
if (!mounted || !el) return;
|
|
258
|
+
const observer = new ResizeObserver(clampIntoView);
|
|
259
|
+
observer.observe(el);
|
|
260
|
+
window.addEventListener('resize', clampIntoView);
|
|
261
|
+
return () => {
|
|
262
|
+
observer.disconnect();
|
|
263
|
+
window.removeEventListener('resize', clampIntoView);
|
|
264
|
+
};
|
|
265
|
+
}, [mounted, clampIntoView]);
|
|
266
|
+
|
|
267
|
+
useEffect(() => {
|
|
268
|
+
runChordRef.current = (id: ChordId) => {
|
|
269
|
+
const live = motionSlowmo.get();
|
|
270
|
+
switch (id) {
|
|
271
|
+
case 'freeze':
|
|
272
|
+
return motionSlowmo.set({ paused: !live.paused });
|
|
273
|
+
case 'slower':
|
|
274
|
+
return stepFactor(1);
|
|
275
|
+
case 'faster':
|
|
276
|
+
return stepFactor(-1);
|
|
277
|
+
case 'realtime':
|
|
278
|
+
return motionSlowmo.reset();
|
|
279
|
+
case 'panel':
|
|
280
|
+
return setOpen((o) => !o);
|
|
281
|
+
}
|
|
282
|
+
};
|
|
283
|
+
});
|
|
284
|
+
|
|
285
|
+
useEffect(() => {
|
|
286
|
+
if (!hotkeys) return;
|
|
287
|
+
const onKeyDown = (e: KeyboardEvent) => {
|
|
288
|
+
if (!e.altKey || e.ctrlKey || e.metaKey || e.shiftKey || isTextEntry(e.target)) return;
|
|
289
|
+
const chord = CHORDS.find((c) => c.code === e.code);
|
|
290
|
+
if (!chord) return;
|
|
291
|
+
e.preventDefault();
|
|
292
|
+
e.stopPropagation();
|
|
293
|
+
runChordRef.current(chord.id);
|
|
294
|
+
};
|
|
295
|
+
window.addEventListener('keydown', onKeyDown, true);
|
|
296
|
+
return () => window.removeEventListener('keydown', onKeyDown, true);
|
|
297
|
+
}, [hotkeys]);
|
|
107
298
|
|
|
108
299
|
if (!mounted) return null;
|
|
109
300
|
|
|
110
301
|
const active = shouldBeActive(snap.factor, snap.paused);
|
|
302
|
+
const fill = `${((Math.min(snap.factor, maxFactor) - 1) / Math.max(1, maxFactor - 1)) * 100}%`;
|
|
303
|
+
const alt = altLabel();
|
|
304
|
+
|
|
305
|
+
const readout = snap.paused
|
|
306
|
+
? { value: 'Paused', unit: 'frozen' }
|
|
307
|
+
: snap.factor === 1
|
|
308
|
+
? { value: 'Normal', unit: 'real-time' }
|
|
309
|
+
: { value: `${fmt(snap.factor)}×`, unit: 'slower' };
|
|
310
|
+
|
|
111
311
|
const rootClass = cx(
|
|
112
312
|
'zc-mdt',
|
|
113
313
|
`zc-mdt--${placement}`,
|
|
114
314
|
active && 'zc-mdt--active',
|
|
115
315
|
snap.paused && 'zc-mdt--paused',
|
|
316
|
+
draggable && 'zc-mdt--draggable',
|
|
116
317
|
className,
|
|
117
318
|
);
|
|
118
319
|
|
|
119
|
-
const setFactor = (factor: number) => motionSlowmo.set({ factor, paused: false });
|
|
120
|
-
const fill = `${((Math.min(snap.factor, maxFactor) - 1) / Math.max(1, maxFactor - 1)) * 100}%`;
|
|
121
|
-
const pillBadge = snap.factor === 1 ? '1×' : `${fmt(snap.factor)}×`;
|
|
122
|
-
|
|
123
320
|
return createPortal(
|
|
124
|
-
<div className={rootClass} style={{ '--mdt-offset': `${offset}px` } as CSSProperties}>
|
|
321
|
+
<div ref={rootRef} className={rootClass} style={{ '--mdt-offset': `${offset}px` } as CSSProperties}>
|
|
125
322
|
<div className={'zc-mdt__panel' + (open ? ' zc-is-open' : '')} role="group" aria-label="Motion devtools">
|
|
126
323
|
<button
|
|
127
324
|
className="zc-mdt__head"
|
|
128
|
-
|
|
325
|
+
onPointerDown={onHeadPointerDown}
|
|
326
|
+
onClick={(e) => {
|
|
327
|
+
if (!isDragRelease(e)) setOpen((o) => !o);
|
|
328
|
+
}}
|
|
129
329
|
aria-expanded={open}
|
|
130
|
-
title=
|
|
330
|
+
title={draggable ? 'Motion devtools - drag to move' : 'Motion devtools'}
|
|
131
331
|
aria-label={open ? 'Collapse motion devtools' : 'Expand motion devtools'}
|
|
132
332
|
>
|
|
133
|
-
<GaugeGlyph />
|
|
333
|
+
{snap.paused ? <PauseGlyph /> : <GaugeGlyph />}
|
|
134
334
|
<span className="zc-mdt__spacer" />
|
|
135
|
-
<span className="zc-mdt__badge">{
|
|
136
|
-
<
|
|
137
|
-
className={'zc-mdt__chevron' + (open ? ' zc-mdt__chevron--open' : '')}
|
|
138
|
-
width="12"
|
|
139
|
-
height="12"
|
|
140
|
-
viewBox="0 0 12 12"
|
|
141
|
-
aria-hidden="true"
|
|
142
|
-
>
|
|
143
|
-
<path d="M2.5 4.5 6 8l3.5-3.5" fill="none" stroke="currentColor" strokeWidth="1.6" strokeLinecap="round" />
|
|
144
|
-
</svg>
|
|
335
|
+
<span className="zc-mdt__badge">{`${fmt(snap.factor)}×`}</span>
|
|
336
|
+
<Chevron open={open} />
|
|
145
337
|
</button>
|
|
146
338
|
|
|
147
339
|
<Collapse open={open} fade>
|
|
148
340
|
<div className="zc-mdt__body">
|
|
149
341
|
<span className="zc-mdt__title">Motion</span>
|
|
150
342
|
<div className="zc-mdt__readout">
|
|
151
|
-
<span className="zc-mdt__value">
|
|
152
|
-
|
|
153
|
-
</span>
|
|
154
|
-
<span className="zc-mdt__unit">
|
|
155
|
-
{snap.paused ? 'frozen' : snap.factor === 1 ? 'real-time' : 'slower'}
|
|
156
|
-
</span>
|
|
343
|
+
<span className="zc-mdt__value">{readout.value}</span>
|
|
344
|
+
<span className="zc-mdt__unit">{readout.unit}</span>
|
|
157
345
|
</div>
|
|
158
346
|
|
|
159
347
|
<input
|
|
@@ -196,10 +384,32 @@ export function MotionDevtools({
|
|
|
196
384
|
|
|
197
385
|
<div className="zc-mdt__opt">
|
|
198
386
|
<Checkbox size="sm" checked={timers} onChange={(e) => setTimers(e.target.checked)} label="Scale timers" />
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
387
|
+
|
|
388
|
+
<button className="zc-mdt__more" onClick={() => setShowKeys((k) => !k)} aria-expanded={showKeys}>
|
|
389
|
+
<span>Shortcuts</span>
|
|
390
|
+
<Chevron open={showKeys} />
|
|
391
|
+
</button>
|
|
392
|
+
|
|
393
|
+
<Collapse open={showKeys} fade>
|
|
394
|
+
<dl className="zc-mdt__keys">
|
|
395
|
+
{CHORDS.map((chord) => (
|
|
396
|
+
<div className="zc-mdt__keyrow" key={chord.id}>
|
|
397
|
+
<dt>{chord.label}</dt>
|
|
398
|
+
<dd>
|
|
399
|
+
<kbd className="zc-mdt__key">{alt}</kbd>
|
|
400
|
+
{chord.keys.map((key) => (
|
|
401
|
+
<kbd className="zc-mdt__key" key={key}>
|
|
402
|
+
{key}
|
|
403
|
+
</kbd>
|
|
404
|
+
))}
|
|
405
|
+
</dd>
|
|
406
|
+
</div>
|
|
407
|
+
))}
|
|
408
|
+
</dl>
|
|
409
|
+
<p className="zc-mdt__hint">
|
|
410
|
+
Timer scaling keeps duration-based cleanups from cutting slowed animations short.
|
|
411
|
+
</p>
|
|
412
|
+
</Collapse>
|
|
203
413
|
</div>
|
|
204
414
|
</div>
|
|
205
415
|
</Collapse>
|
|
@@ -4,10 +4,18 @@ Group: dev
|
|
|
4
4
|
|
|
5
5
|
Dev-only floating panel that slows or freezes EVERY animation at once (CSS and WAAPI) for motion debugging.
|
|
6
6
|
|
|
7
|
-
Mount once at the app root
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
root, e.g. a host token scope).
|
|
7
|
+
Mount once at the app root behind a dev check: no provider, no wrapper, and no effect on any other
|
|
8
|
+
component. `placement` top-left|top-right|bottom-left|bottom-right, `offset`, `presets`, `maxFactor`,
|
|
9
|
+
`defaultFactor`, `defaultOpen`, `scaleTimers`, `hotkeys`, `draggable`, `persist`, `className` (extra
|
|
10
|
+
class on the panel root, e.g. a host token scope). While `hotkeys` is on, Alt chords reach it from
|
|
11
|
+
anywhere on the page: Alt P freezes or resumes, Alt , and Alt . step down and up the `presets` ladder,
|
|
12
|
+
Alt 0 returns to real time, Alt M shows or hides the panel. They match the physical key, so a layout
|
|
13
|
+
where Option+P types another character still fires them, they want Alt alone, and they stay quiet
|
|
14
|
+
while you are typing in a field. The open panel lists them under Shortcuts at its foot, closed until
|
|
15
|
+
you ask for it, with the note on what timer scaling buys you. With `draggable` on the header is a drag
|
|
16
|
+
handle: the panel goes anywhere in the viewport and snaps to nothing, held inside the edges as you
|
|
17
|
+
drag, as the window resizes, and as it widens on open. `persist` remembers where you dropped it
|
|
18
|
+
alongside the chosen factor. `motionSlowmo` is exported too, to drive the same state from the console.
|
|
11
19
|
|
|
12
20
|
```tsx
|
|
13
21
|
{
|
|
@@ -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
|
}
|
|
@@ -58,7 +58,7 @@ function applyCssTokens() {
|
|
|
58
58
|
const ms = state.paused ? FROZEN_MS : baseMs[token] * state.factor;
|
|
59
59
|
return `${token}: ${ms}ms !important;`;
|
|
60
60
|
});
|
|
61
|
-
overrideSheet.textContent = `:root, [data-theme] { ${declarations.join(' ')} }`;
|
|
61
|
+
overrideSheet.textContent = `:root, [data-theme], [data-polarity] { ${declarations.join(' ')} }`;
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
function clearCssTokens() {
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
@layer zyncat.tokens, zyncat.components;
|
|
1
|
+
@layer zyncat.reset, zyncat.tokens, zyncat.components;
|
|
2
2
|
|
|
3
3
|
@layer zyncat.components {
|
|
4
4
|
.zc-confetti {
|
|
5
|
-
/* The five papers a burst draws from
|
|
5
|
+
/* The five papers a burst draws from. */
|
|
6
6
|
--confetti-paper-1: oklch(0.53 0.2 288);
|
|
7
7
|
--confetti-paper-2: var(--accent);
|
|
8
8
|
--confetti-paper-3: oklch(0.78 0.115 62);
|
|
9
9
|
--confetti-paper-4: oklch(0.67 0.18 12);
|
|
10
10
|
--confetti-paper-5: var(--text-strong);
|
|
11
|
-
/* How often each paper appears
|
|
11
|
+
/* How often each paper appears, in slot order. */
|
|
12
12
|
--confetti-weights: 1 1 1 1 0.45;
|
|
13
13
|
|
|
14
14
|
/* What the reverse side of a piece darkens toward. */
|
|
@@ -41,7 +41,7 @@ const WIDTH_GAIN = 1.2;
|
|
|
41
41
|
const ALPHA_REST = 0.42;
|
|
42
42
|
const ALPHA_GAIN = 0.58;
|
|
43
43
|
|
|
44
|
-
const THEME_ATTRIBUTES: MutationObserverInit = { attributeFilter: ['class', 'style', 'data-theme'] };
|
|
44
|
+
const THEME_ATTRIBUTES: MutationObserverInit = { attributeFilter: ['class', 'style', 'data-theme', 'data-polarity'] };
|
|
45
45
|
|
|
46
46
|
const JITTER_X = 12.9898;
|
|
47
47
|
const JITTER_Y = 78.233;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
@layer zyncat.tokens, zyncat.components;
|
|
1
|
+
@layer zyncat.reset, zyncat.tokens, zyncat.components;
|
|
2
2
|
|
|
3
3
|
@layer zyncat.components {
|
|
4
4
|
.zc-flow-field {
|
|
5
|
-
/* The particle colour at rest
|
|
5
|
+
/* The particle colour at rest. */
|
|
6
6
|
--flow-field-ink: var(--text-subtle);
|
|
7
|
-
/* The particle colour at full speed
|
|
7
|
+
/* The particle colour at full speed. */
|
|
8
8
|
--flow-field-accent: var(--accent);
|
|
9
9
|
/* The field's minimum height before content sizes it. */
|
|
10
10
|
--flow-field-min-height: var(--space-10);
|
|
11
11
|
|
|
12
|
-
/* The twelve stops from ink to accent,
|
|
12
|
+
/* The twelve stops from ink to accent, set together for a ramp of your own. */
|
|
13
13
|
--flow-field-ramp-0: var(--flow-field-ink);
|
|
14
14
|
--flow-field-ramp-1: color-mix(in oklab, var(--flow-field-accent) 9%, var(--flow-field-ink));
|
|
15
15
|
--flow-field-ramp-2: color-mix(in oklab, var(--flow-field-accent) 18%, var(--flow-field-ink));
|
|
@@ -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-lens {
|
|
@@ -28,7 +28,6 @@
|
|
|
28
28
|
|
|
29
29
|
.zc-lens:focus-visible {
|
|
30
30
|
outline: var(--focus-ring);
|
|
31
|
-
outline-offset: var(--ring-inset);
|
|
32
31
|
}
|
|
33
32
|
|
|
34
33
|
.zc-lens--active {
|
|
@@ -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);
|