@cognitap/radiant 0.0.5 → 0.0.6
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/CHANGELOG.md +17 -0
- package/README.md +8 -0
- package/dist/library/Button.d.ts +3 -1
- package/dist/library/Button.d.ts.map +1 -1
- package/dist/library/Button.js +43 -2
- package/dist/library/Button.js.map +1 -1
- package/dist/library/Collapsible.d.ts +2 -1
- package/dist/library/Collapsible.d.ts.map +1 -1
- package/dist/library/Collapsible.js +5 -2
- package/dist/library/Collapsible.js.map +1 -1
- package/dist/library/Dialog.d.ts +2 -1
- package/dist/library/Dialog.d.ts.map +1 -1
- package/dist/library/Dialog.js +5 -2
- package/dist/library/Dialog.js.map +1 -1
- package/dist/library/ThemeScope.d.ts.map +1 -1
- package/dist/library/ThemeScope.js +10 -9
- package/dist/library/ThemeScope.js.map +1 -1
- package/dist/library/index.d.ts +3 -1
- package/dist/library/index.d.ts.map +1 -1
- package/dist/library/index.js +1 -0
- package/dist/library/index.js.map +1 -1
- package/dist/library/motion/MotionLink.d.ts +7 -0
- package/dist/library/motion/MotionLink.d.ts.map +1 -0
- package/dist/library/motion/MotionLink.js +45 -0
- package/dist/library/motion/MotionLink.js.map +1 -0
- package/dist/library/motion/browser.d.ts +5 -0
- package/dist/library/motion/browser.d.ts.map +1 -0
- package/dist/library/motion/browser.js +35 -0
- package/dist/library/motion/browser.js.map +1 -0
- package/dist/library/motion/config.d.ts +26 -0
- package/dist/library/motion/config.d.ts.map +1 -0
- package/dist/library/motion/config.js +58 -0
- package/dist/library/motion/config.js.map +1 -0
- package/dist/library/motion/context.d.ts +2 -0
- package/dist/library/motion/context.d.ts.map +1 -0
- package/dist/library/motion/context.js +5 -0
- package/dist/library/motion/context.js.map +1 -0
- package/dist/library/motion/drag.d.ts +20 -0
- package/dist/library/motion/drag.d.ts.map +1 -0
- package/dist/library/motion/drag.js +138 -0
- package/dist/library/motion/drag.js.map +1 -0
- package/dist/library/motion/dragBrowser.d.ts +4 -0
- package/dist/library/motion/dragBrowser.d.ts.map +1 -0
- package/dist/library/motion/dragBrowser.js +156 -0
- package/dist/library/motion/dragBrowser.js.map +1 -0
- package/dist/library/motion/follow.d.ts +9 -0
- package/dist/library/motion/follow.d.ts.map +1 -0
- package/dist/library/motion/follow.js +26 -0
- package/dist/library/motion/follow.js.map +1 -0
- package/dist/library/motion/host.d.ts +27 -0
- package/dist/library/motion/host.d.ts.map +1 -0
- package/dist/library/motion/host.js +62 -0
- package/dist/library/motion/host.js.map +1 -0
- package/dist/library/motion/index.d.ts +16 -0
- package/dist/library/motion/index.d.ts.map +1 -0
- package/dist/library/motion/index.js +9 -0
- package/dist/library/motion/index.js.map +1 -0
- package/dist/library/motion/layout.d.ts +20 -0
- package/dist/library/motion/layout.d.ts.map +1 -0
- package/dist/library/motion/layout.js +67 -0
- package/dist/library/motion/layout.js.map +1 -0
- package/dist/library/motion/layoutDom.d.ts +17 -0
- package/dist/library/motion/layoutDom.d.ts.map +1 -0
- package/dist/library/motion/layoutDom.js +272 -0
- package/dist/library/motion/layoutDom.js.map +1 -0
- package/dist/library/motion/press.d.ts +5 -0
- package/dist/library/motion/press.d.ts.map +1 -0
- package/dist/library/motion/press.js +72 -0
- package/dist/library/motion/press.js.map +1 -0
- package/dist/library/motion/pressPolicy.d.ts +5 -0
- package/dist/library/motion/pressPolicy.d.ts.map +1 -0
- package/dist/library/motion/pressPolicy.js +8 -0
- package/dist/library/motion/pressPolicy.js.map +1 -0
- package/dist/library/motion/react.d.ts +35 -0
- package/dist/library/motion/react.d.ts.map +1 -0
- package/dist/library/motion/react.js +224 -0
- package/dist/library/motion/react.js.map +1 -0
- package/dist/library/motion/runtime.d.ts +22 -0
- package/dist/library/motion/runtime.d.ts.map +1 -0
- package/dist/library/motion/runtime.js +117 -0
- package/dist/library/motion/runtime.js.map +1 -0
- package/dist/library/motion/transitions.d.ts +5 -0
- package/dist/library/motion/transitions.d.ts.map +1 -0
- package/dist/library/motion/transitions.js +211 -0
- package/dist/library/motion/transitions.js.map +1 -0
- package/dist/library/styles.css +1 -1
- package/dist/library/themes/defineTheme.d.ts +3 -0
- package/dist/library/themes/defineTheme.d.ts.map +1 -1
- package/dist/library/themes/defineTheme.js +4 -2
- package/dist/library/themes/defineTheme.js.map +1 -1
- package/dist/library/themes/index.d.ts +1 -1
- package/dist/library/themes/index.d.ts.map +1 -1
- package/dist/library/themes/index.js.map +1 -1
- package/dist/library/themes/themeDocument.d.ts.map +1 -1
- package/dist/library/themes/themeDocument.js +11 -5
- package/dist/library/themes/themeDocument.js.map +1 -1
- package/dist/library/themes/themeDocumentTypes.d.ts +5 -1
- package/dist/library/themes/themeDocumentTypes.d.ts.map +1 -1
- package/dist/library/themes/themeDocumentTypes.js.map +1 -1
- package/docs/motion.md +434 -0
- package/docs/system.md +26 -0
- package/package.json +14 -3
- package/src/Button.tsx +49 -1
- package/src/Collapsible.tsx +13 -1
- package/src/Dialog.tsx +10 -1
- package/src/ThemeScope.tsx +21 -17
- package/src/index.ts +9 -0
- package/src/motion/MotionLink.tsx +64 -0
- package/src/motion/browser.ts +45 -0
- package/src/motion/config.ts +79 -0
- package/src/motion/context.ts +4 -0
- package/src/motion/drag.ts +151 -0
- package/src/motion/dragBrowser.ts +159 -0
- package/src/motion/follow.ts +28 -0
- package/src/motion/host.ts +88 -0
- package/src/motion/index.ts +28 -0
- package/src/motion/layout.ts +78 -0
- package/src/motion/layoutDom.ts +293 -0
- package/src/motion/press.ts +77 -0
- package/src/motion/pressPolicy.ts +12 -0
- package/src/motion/react.ts +272 -0
- package/src/motion/runtime.ts +122 -0
- package/src/motion/transitions.ts +206 -0
- package/src/themes/defineTheme.ts +10 -2
- package/src/themes/index.ts +1 -0
- package/src/themes/themeDocument.ts +14 -6
- package/src/themes/themeDocumentTypes.ts +12 -5
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { createSpring } from './runtime.js';
|
|
2
|
+
import { bindSpringStyle } from './browser.js';
|
|
3
|
+
import { resolveMotion } from './config.js';
|
|
4
|
+
/** Presentation only: this adapter never clicks, submits, captures or prevents input. */
|
|
5
|
+
export function bindPressMotion(node, initialProfile) {
|
|
6
|
+
let profile = initialProfile;
|
|
7
|
+
const query = node.ownerDocument.defaultView.matchMedia('(prefers-reduced-motion: reduce)');
|
|
8
|
+
const spring = createSpring(1, {
|
|
9
|
+
...resolveMotion(profile, 'press', query.matches),
|
|
10
|
+
reducedValue: 1
|
|
11
|
+
});
|
|
12
|
+
const unbind = bindSpringStyle(node, spring, 'scale');
|
|
13
|
+
const blocked = () => node.matches(':disabled') ||
|
|
14
|
+
node.getAttribute('aria-busy') === 'true' ||
|
|
15
|
+
node.getAttribute('aria-disabled') === 'true';
|
|
16
|
+
const release = () => spring.to(1);
|
|
17
|
+
function update(next) {
|
|
18
|
+
profile = next;
|
|
19
|
+
spring.configure({ ...resolveMotion(profile, 'press', query.matches), reducedValue: 1 });
|
|
20
|
+
if (blocked())
|
|
21
|
+
spring.jump(1);
|
|
22
|
+
}
|
|
23
|
+
const changed = () => update(profile);
|
|
24
|
+
query.addEventListener('change', changed);
|
|
25
|
+
const observer = new MutationObserver(() => {
|
|
26
|
+
if (blocked())
|
|
27
|
+
spring.jump(1);
|
|
28
|
+
});
|
|
29
|
+
observer.observe(node, {
|
|
30
|
+
attributes: true,
|
|
31
|
+
attributeFilter: ['disabled', 'aria-busy', 'aria-disabled']
|
|
32
|
+
});
|
|
33
|
+
for (let parent = node.parentElement; parent; parent = parent.parentElement) {
|
|
34
|
+
if (parent.tagName === 'FIELDSET')
|
|
35
|
+
observer.observe(parent, { attributes: true, attributeFilter: ['disabled'] });
|
|
36
|
+
}
|
|
37
|
+
const document = node.ownerDocument;
|
|
38
|
+
document.addEventListener('pointerup', release);
|
|
39
|
+
document.addEventListener('pointercancel', release);
|
|
40
|
+
document.addEventListener('keyup', release);
|
|
41
|
+
document.defaultView.addEventListener('blur', release);
|
|
42
|
+
return {
|
|
43
|
+
update,
|
|
44
|
+
press(event) {
|
|
45
|
+
if (event.defaultPrevented || blocked()) {
|
|
46
|
+
release();
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
if ('key' in event) {
|
|
50
|
+
if (event.repeat ||
|
|
51
|
+
!['Enter', ...(node.tagName === 'BUTTON' ? [' '] : [])].includes(event.key))
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
else if (event.button !== 0 || event.isPrimary === false)
|
|
55
|
+
return;
|
|
56
|
+
const scale = Number(getComputedStyle(node).getPropertyValue('--rad-button-press-scale').trim() || '.97');
|
|
57
|
+
spring.to(Number.isFinite(scale) && scale >= 0.5 && scale <= 1 ? scale : 0.97);
|
|
58
|
+
},
|
|
59
|
+
release,
|
|
60
|
+
destroy() {
|
|
61
|
+
observer.disconnect();
|
|
62
|
+
query.removeEventListener('change', changed);
|
|
63
|
+
document.removeEventListener('pointerup', release);
|
|
64
|
+
document.removeEventListener('pointercancel', release);
|
|
65
|
+
document.removeEventListener('keyup', release);
|
|
66
|
+
document.defaultView.removeEventListener('blur', release);
|
|
67
|
+
spring.destroy();
|
|
68
|
+
unbind();
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=press.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"press.js","sourceRoot":"","sources":["../../../src/motion/press.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAC3C,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAC9C,OAAO,EAAE,aAAa,EAAsB,MAAM,aAAa,CAAA;AAG/D,yFAAyF;AACzF,MAAM,UAAU,eAAe,CAC7B,IAAiB,EACjB,cAA6B;IAE7B,IAAI,OAAO,GAAG,cAAc,CAAA;IAC5B,MAAM,KAAK,GAAG,IAAI,CAAC,aAAa,CAAC,WAAY,CAAC,UAAU,CAAC,kCAAkC,CAAC,CAAA;IAC5F,MAAM,MAAM,G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,IAAI,EAAE,IAAI,KAAK,CACpF,CAAA;YACD,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,KAAK,IAAI,GAAG,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAA;QAChF,CAAC;QACD,OAAO;QACP,OAAO;YACL,QAAQ,CAAC,UAAU,EAAE,CAAA;YACrB,KAAK,CAAC,mBAAmB,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAA;YAC5C,QAAQ,CAAC,mBAAmB,CAAC,WAAW,EAAE,OAAO,CAAC,CAAA;YAClD,QAAQ,CAAC,mBAAmB,CAAC,eAAe,EAAE,OAAO,CAAC,CAAA;YACtD,QAAQ,CAAC,mBAAmB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;YAC9C,QAAQ,CAAC,WAAY,CAAC,mBAAmB,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;YAC1D,MAAM,CAAC,OAAO,EAAE,CAAA;YAChB,MAAM,EAAE,CAAA;QACV,CAAC;KACF,CAAA;AACH,CAAC","sourcesContent":["import { createSpring } from './runtime.js'\nimport { bindSpringStyle } from './browser.js'\nimport { resolveMotion, type MotionProfile } from './config.js'\nimport type { MotionHostBinding } from './host.js'\n\n/** Presentation only: this adapter never clicks, submits, captures or prevents input. */\nexport function bindPressMotion(\n node: HTMLElement,\n initialProfile: MotionProfile\n): MotionHostBinding {\n let profile = initialProfile\n const query = node.ownerDocument.defaultView!.matchMedia('(prefers-reduced-motion: reduce)')\n const spring = createSpring(1, {\n ...resolveMotion(profile, 'press', query.matches),\n reducedValue: 1\n })\n const unbind = bindSpringStyle(node, spring, 'scale')\n const blocked = () =>\n node.matches(':disabled') ||\n node.getAttribute('aria-busy') === 'true' ||\n node.getAttribute('aria-disabled') === 'true'\n const release = () => spring.to(1)\n function update(next: MotionProfile) {\n profile = next\n spring.configure({ ...resolveMotion(profile, 'press', query.matches), reducedValue: 1 })\n if (blocked()) spring.jump(1)\n }\n const changed = () => update(profile)\n query.addEventListener('change', changed)\n const observer = new MutationObserver(() => {\n if (blocked()) spring.jump(1)\n })\n observer.observe(node, {\n attributes: true,\n attributeFilter: ['disabled', 'aria-busy', 'aria-disabled']\n })\n for (let parent = node.parentElement; parent; parent = parent.parentElement) {\n if (parent.tagName === 'FIELDSET')\n observer.observe(parent, { attributes: true, attributeFilter: ['disabled'] })\n }\n const document = node.ownerDocument\n document.addEventListener('pointerup', release)\n document.addEventListener('pointercancel', release)\n document.addEventListener('keyup', release)\n document.defaultView!.addEventListener('blur', release)\n return {\n update,\n press(event) {\n if (event.defaultPrevented || blocked()) {\n release()\n return\n }\n if ('key' in event) {\n if (\n event.repeat ||\n !['Enter', ...(node.tagName === 'BUTTON' ? [' '] : [])].includes(event.key)\n )\n return\n } else if (event.button !== 0 || event.isPrimary === false) return\n const scale = Number(\n getComputedStyle(node).getPropertyValue('--rad-button-press-scale').trim() || '.97'\n )\n spring.to(Number.isFinite(scale) && scale >= 0.5 && scale <= 1 ? scale : 0.97)\n },\n release,\n destroy() {\n observer.disconnect()\n query.removeEventListener('change', changed)\n document.removeEventListener('pointerup', release)\n document.removeEventListener('pointercancel', release)\n document.removeEventListener('keyup', release)\n document.defaultView!.removeEventListener('blur', release)\n spring.destroy()\n unbind()\n }\n }\n}\n"]}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { CSSProperties } from 'react';
|
|
2
|
+
export declare function callerOwnsPress(style: CSSProperties | undefined, className: string | undefined): boolean;
|
|
3
|
+
export declare const springPressClass = "transition-[translate,border-radius,corner-shape,box-shadow,background-color,color] not-disabled:not-aria-busy:motion-safe:active:scale-100";
|
|
4
|
+
export declare const offPressClass = "not-disabled:not-aria-busy:motion-safe:active:scale-100 not-disabled:not-aria-busy:motion-safe:active:translate-0 not-disabled:not-aria-busy:motion-safe:hover:translate-0";
|
|
5
|
+
//# sourceMappingURL=pressPolicy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pressPolicy.d.ts","sourceRoot":"","sources":["../../../src/motion/pressPolicy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAA;AAC1C,wBAAgB,eAAe,CAAC,KAAK,EAAE,aAAa,GAAG,SAAS,EAAE,SAAS,EAAE,MAAM,GAAG,SAAS,WAM9F;AACD,eAAO,MAAM,gBAAgB,gJACkH,CAAA;AAC/I,eAAO,MAAM,aAAa,+KACoJ,CAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export function callerOwnsPress(style, className) {
|
|
2
|
+
return (style?.scale !== undefined ||
|
|
3
|
+
/(?:scale-|\[scale:|transition-all|transition-\[[^\]]*scale)/.test(className ?? '') ||
|
|
4
|
+
/(?:scale|all)/.test(String(style?.transition ?? style?.transitionProperty ?? '')));
|
|
5
|
+
}
|
|
6
|
+
export const springPressClass = 'transition-[translate,border-radius,corner-shape,box-shadow,background-color,color] not-disabled:not-aria-busy:motion-safe:active:scale-100';
|
|
7
|
+
export const offPressClass = 'not-disabled:not-aria-busy:motion-safe:active:scale-100 not-disabled:not-aria-busy:motion-safe:active:translate-0 not-disabled:not-aria-busy:motion-safe:hover:translate-0';
|
|
8
|
+
//# sourceMappingURL=pressPolicy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pressPolicy.js","sourceRoot":"","sources":["../../../src/motion/pressPolicy.ts"],"names":[],"mappings":"AACA,MAAM,UAAU,eAAe,CAAC,KAAgC,EAAE,SAA6B;IAC7F,OAAO,CACL,KAAK,EAAE,KAAK,KAAK,SAAS;QAC1B,6DAA6D,CAAC,IAAI,CAAC,SAAS,IAAI,EAAE,CAAC;QACnF,eAAe,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,UAAU,IAAI,KAAK,EAAE,kBAAkB,IAAI,EAAE,CAAC,CAAC,CACnF,CAAA;AACH,CAAC;AACD,MAAM,CAAC,MAAM,gBAAgB,GAC3B,6IAA6I,CAAA;AAC/I,MAAM,CAAC,MAAM,aAAa,GACxB,4KAA4K,CAAA","sourcesContent":["import type { CSSProperties } from 'react'\nexport function callerOwnsPress(style: CSSProperties | undefined, className: string | undefined) {\n return (\n style?.scale !== undefined ||\n /(?:scale-|\\[scale:|transition-all|transition-\\[[^\\]]*scale)/.test(className ?? '') ||\n /(?:scale|all)/.test(String(style?.transition ?? style?.transitionProperty ?? ''))\n )\n}\nexport const springPressClass =\n 'transition-[translate,border-radius,corner-shape,box-shadow,background-color,color] not-disabled:not-aria-busy:motion-safe:active:scale-100'\nexport const offPressClass =\n 'not-disabled:not-aria-busy:motion-safe:active:scale-100 not-disabled:not-aria-busy:motion-safe:active:translate-0 not-disabled:not-aria-busy:motion-safe:hover:translate-0'\n"]}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { type RefObject } from 'react';
|
|
2
|
+
import { type ReactNode } from 'react';
|
|
3
|
+
import { type MotionInteraction } from './config.js';
|
|
4
|
+
import { type SpringDragOptions } from './drag.js';
|
|
5
|
+
import { type SpringController } from './runtime.js';
|
|
6
|
+
import { type SpringStyleProperty } from './browser.js';
|
|
7
|
+
import { type SpringSource } from './follow.js';
|
|
8
|
+
import { type SpringLayoutController } from './layoutDom.js';
|
|
9
|
+
export declare function useReducedMotion(): boolean;
|
|
10
|
+
export declare function useSpring(initial: number, interaction?: MotionInteraction, reducedValue?: number): SpringController;
|
|
11
|
+
/** Use the real native ref; events/state remain with the component and caller. */
|
|
12
|
+
export declare function useSpringStyle(ref: RefObject<HTMLElement | null>, property: SpringStyleProperty, initial: number, interaction?: MotionInteraction, reducedValue?: number): SpringController;
|
|
13
|
+
/** Opt into native Radiant spring interactions without adding a DOM wrapper. */
|
|
14
|
+
export declare function MotionProvider({ children }: {
|
|
15
|
+
children?: ReactNode;
|
|
16
|
+
}): import("react").FunctionComponentElement<import("react").ProviderProps<import("./host.js").MotionHostRuntime | null>>;
|
|
17
|
+
export { MotionLink } from './MotionLink.js';
|
|
18
|
+
export type { MotionLinkProps } from './MotionLink.js';
|
|
19
|
+
/** Dedicated one-axis handle binding; explicit native keyboard controls are retained. */
|
|
20
|
+
export declare function useSpringDrag(ref: RefObject<HTMLElement | null>, initial: number, options: Omit<SpringDragOptions, 'parameters' | 'enabled'> & {
|
|
21
|
+
axis?: 'x' | 'y';
|
|
22
|
+
}): {
|
|
23
|
+
get: () => number;
|
|
24
|
+
getVelocity: () => number;
|
|
25
|
+
subscribe: (listener: (value: number) => void) => () => void;
|
|
26
|
+
to: (target: number) => void | undefined;
|
|
27
|
+
cancel: () => void | undefined;
|
|
28
|
+
step: (direction: -1 | 1 | "first" | "last") => void | undefined;
|
|
29
|
+
isAnimating: () => boolean;
|
|
30
|
+
};
|
|
31
|
+
/** Follow committed numeric props or an external source without rendering each spring frame. */
|
|
32
|
+
export declare function useSpringFollow(target: number | SpringSource, interaction?: MotionInteraction, reducedValue?: number): SpringController;
|
|
33
|
+
/** Batch direct-child layout slots after each commit and observe later intrinsic changes. */
|
|
34
|
+
export declare function useSpringLayout(ref: RefObject<HTMLElement | null>): Pick<SpringLayoutController, 'measure' | 'get' | 'getVelocity' | 'isAnimating'>;
|
|
35
|
+
//# sourceMappingURL=react.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../../../src/motion/react.ts"],"names":[],"mappings":"AACA,OAAO,EAOL,KAAK,SAAS,EACf,MAAM,OAAO,CAAA;AACd,OAAO,EAAiB,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAKrD,OAAO,EAAiB,KAAK,iBAAiB,EAAE,MAAM,aAAa,CAAA;AACnE,OAAO,EAA+C,KAAK,iBAAiB,EAAE,MAAM,WAAW,CAAA;AAE/F,OAAO,EAAgB,KAAK,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAClE,OAAO,EAAmB,KAAK,mBAAmB,EAAE,MA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GACpB,gBAAgB,CAWlB;AAED,6FAA6F;AAC7F,wBAAgB,eAAe,CAC7B,GAAG,EAAE,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,GACjC,IAAI,CAAC,sBAAsB,EAAE,SAAS,GAAG,KAAK,GAAG,aAAa,GAAG,aAAa,CAAC,CAkCjF"}
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { useContext, useEffect, useLayoutEffect, useRef, useState, useSyncExternalStore } from 'react';
|
|
3
|
+
import { createElement } from 'react';
|
|
4
|
+
import { MotionHostContext } from './host.js';
|
|
5
|
+
import { bindDisclosureMotion, bindDialogMotion } from './transitions.js';
|
|
6
|
+
import { bindPressMotion } from './press.js';
|
|
7
|
+
import { MotionProfileContext } from './context.js';
|
|
8
|
+
import { resolveMotion } from './config.js';
|
|
9
|
+
import { createSpringDrag } from './drag.js';
|
|
10
|
+
import { bindSpringDrag } from './dragBrowser.js';
|
|
11
|
+
import { createSpring } from './runtime.js';
|
|
12
|
+
import { bindSpringStyle } from './browser.js';
|
|
13
|
+
import { bindSpringSource } from './follow.js';
|
|
14
|
+
import { bindSpringLayout } from './layoutDom.js';
|
|
15
|
+
// Start conservatively for SSR/hydration; only subscribing reads the browser.
|
|
16
|
+
const listeners = new Set();
|
|
17
|
+
let query;
|
|
18
|
+
function subscribeReduced(listener) {
|
|
19
|
+
if (!query)
|
|
20
|
+
query = window.matchMedia('(prefers-reduced-motion: reduce)');
|
|
21
|
+
const current = query;
|
|
22
|
+
const notify = () => listener();
|
|
23
|
+
listeners.add(notify);
|
|
24
|
+
current.addEventListener('change', notify);
|
|
25
|
+
return () => {
|
|
26
|
+
listeners.delete(notify);
|
|
27
|
+
current.removeEventListener('change', notify);
|
|
28
|
+
if (!listeners.size)
|
|
29
|
+
query = undefined;
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
export function useReducedMotion() {
|
|
33
|
+
return useSyncExternalStore(subscribeReduced, () => query?.matches ?? true, () => true);
|
|
34
|
+
}
|
|
35
|
+
export function useSpring(initial, interaction = 'follow', reducedValue) {
|
|
36
|
+
const profile = useContext(MotionProfileContext);
|
|
37
|
+
const reduced = useReducedMotion();
|
|
38
|
+
const resolved = resolveMotion(profile, interaction, reduced);
|
|
39
|
+
const owned = useRef(null);
|
|
40
|
+
const requested = useRef(initial);
|
|
41
|
+
const requestedVelocity = useRef(undefined);
|
|
42
|
+
const callbacks = useRef(new Set());
|
|
43
|
+
const initialOptions = useRef({ ...resolved, reducedValue });
|
|
44
|
+
const policy = useRef(resolved.enabled);
|
|
45
|
+
const initialValue = useRef(initial);
|
|
46
|
+
const [controller] = useState(() => ({
|
|
47
|
+
get: () => owned.current?.get() ?? requested.current,
|
|
48
|
+
getVelocity: () => owned.current?.getVelocity() ?? 0,
|
|
49
|
+
isAnimating: () => owned.current?.isAnimating() ?? false,
|
|
50
|
+
to(next, velocity) {
|
|
51
|
+
if (velocity !== undefined && !Number.isFinite(velocity))
|
|
52
|
+
throw new TypeError('Velocity must be finite.');
|
|
53
|
+
requestedVelocity.current = velocity;
|
|
54
|
+
if (!Number.isFinite(next))
|
|
55
|
+
throw new TypeError('Spring value must be finite.');
|
|
56
|
+
requested.current = next;
|
|
57
|
+
owned.current?.to(next, velocity);
|
|
58
|
+
},
|
|
59
|
+
jump(next) {
|
|
60
|
+
if (!Number.isFinite(next))
|
|
61
|
+
throw new TypeError('Spring value must be finite.');
|
|
62
|
+
requested.current = next;
|
|
63
|
+
owned.current?.jump(next);
|
|
64
|
+
},
|
|
65
|
+
stop() {
|
|
66
|
+
owned.current?.stop();
|
|
67
|
+
requested.current = owned.current?.get() ?? requested.current;
|
|
68
|
+
},
|
|
69
|
+
configure(next) {
|
|
70
|
+
owned.current?.configure({ ...next, enabled: policy.current && (next.enabled ?? true) });
|
|
71
|
+
},
|
|
72
|
+
subscribe(listener) {
|
|
73
|
+
callbacks.current.add(listener);
|
|
74
|
+
return () => {
|
|
75
|
+
callbacks.current.delete(listener);
|
|
76
|
+
};
|
|
77
|
+
},
|
|
78
|
+
destroy() {
|
|
79
|
+
owned.current?.destroy();
|
|
80
|
+
}
|
|
81
|
+
}));
|
|
82
|
+
useEffect(() => {
|
|
83
|
+
const spring = createSpring(initialValue.current, initialOptions.current);
|
|
84
|
+
owned.current = spring;
|
|
85
|
+
const off = spring.subscribe(next => callbacks.current.forEach(listener => listener(next)));
|
|
86
|
+
spring.to(requested.current, requestedVelocity.current);
|
|
87
|
+
return () => {
|
|
88
|
+
off();
|
|
89
|
+
spring.destroy();
|
|
90
|
+
owned.current = null;
|
|
91
|
+
};
|
|
92
|
+
}, []);
|
|
93
|
+
const { stiffness, damping, mass } = resolved.parameters;
|
|
94
|
+
useEffect(() => {
|
|
95
|
+
policy.current = resolved.enabled;
|
|
96
|
+
owned.current?.configure({
|
|
97
|
+
enabled: resolved.enabled,
|
|
98
|
+
parameters: { stiffness, damping, mass },
|
|
99
|
+
reducedValue
|
|
100
|
+
});
|
|
101
|
+
}, [resolved.enabled, stiffness, damping, mass, reducedValue]);
|
|
102
|
+
return controller;
|
|
103
|
+
}
|
|
104
|
+
/** Use the real native ref; events/state remain with the component and caller. */
|
|
105
|
+
export function useSpringStyle(ref, property, initial, interaction = 'follow', reducedValue) {
|
|
106
|
+
const spring = useSpring(initial, interaction, reducedValue);
|
|
107
|
+
// Rebind after every commit to handle a replaced render host; no animation state enters React.
|
|
108
|
+
useEffect(() => {
|
|
109
|
+
if (!ref.current)
|
|
110
|
+
return;
|
|
111
|
+
return bindSpringStyle(ref.current, spring, property);
|
|
112
|
+
});
|
|
113
|
+
return spring;
|
|
114
|
+
}
|
|
115
|
+
const hostRuntime = {
|
|
116
|
+
press: bindPressMotion,
|
|
117
|
+
disclosure: bindDisclosureMotion,
|
|
118
|
+
dialog: bindDialogMotion
|
|
119
|
+
};
|
|
120
|
+
/** Opt into native Radiant spring interactions without adding a DOM wrapper. */
|
|
121
|
+
export function MotionProvider({ children }) {
|
|
122
|
+
return createElement(MotionHostContext.Provider, { value: hostRuntime }, children);
|
|
123
|
+
}
|
|
124
|
+
export { MotionLink } from './MotionLink.js';
|
|
125
|
+
/** Dedicated one-axis handle binding; explicit native keyboard controls are retained. */
|
|
126
|
+
export function useSpringDrag(ref, initial, options) {
|
|
127
|
+
const profile = useContext(MotionProfileContext);
|
|
128
|
+
const reduced = useReducedMotion();
|
|
129
|
+
const resolved = resolveMotion(profile, 'drag', reduced);
|
|
130
|
+
const latest = useRef({ initial, options, resolved });
|
|
131
|
+
const owned = useRef(null);
|
|
132
|
+
const [control] = useState(() => ({
|
|
133
|
+
get: () => owned.current?.get() ?? initial,
|
|
134
|
+
getVelocity: () => owned.current?.getVelocity() ?? 0,
|
|
135
|
+
subscribe: (listener) => owned.current?.subscribe(listener) ?? (() => { }),
|
|
136
|
+
to: (target) => owned.current?.to(target),
|
|
137
|
+
cancel: () => owned.current?.cancel(),
|
|
138
|
+
step: (direction) => owned.current?.step(direction),
|
|
139
|
+
isAnimating: () => owned.current?.isAnimating() ?? false
|
|
140
|
+
}));
|
|
141
|
+
useEffect(() => {
|
|
142
|
+
const current = latest.current;
|
|
143
|
+
const drag = createSpringDrag(current.initial, { ...current.options, ...current.resolved });
|
|
144
|
+
owned.current = drag;
|
|
145
|
+
return () => {
|
|
146
|
+
drag.destroy();
|
|
147
|
+
owned.current = null;
|
|
148
|
+
};
|
|
149
|
+
}, []);
|
|
150
|
+
const points = options.snapPoints?.join(',');
|
|
151
|
+
const { stiffness, damping, mass } = resolved.parameters;
|
|
152
|
+
useEffect(() => {
|
|
153
|
+
owned.current?.configure({
|
|
154
|
+
min: options.min,
|
|
155
|
+
max: options.max,
|
|
156
|
+
snapPoints: points?.split(',').map(Number),
|
|
157
|
+
parameters: { stiffness, damping, mass },
|
|
158
|
+
enabled: resolved.enabled
|
|
159
|
+
});
|
|
160
|
+
}, [options.min, options.max, points, stiffness, damping, mass, resolved.enabled]);
|
|
161
|
+
const binding = useRef(null);
|
|
162
|
+
useEffect(() => {
|
|
163
|
+
if (binding.current &&
|
|
164
|
+
(binding.current.node !== ref.current || binding.current.axis !== options.axis)) {
|
|
165
|
+
binding.current.cleanup();
|
|
166
|
+
binding.current = null;
|
|
167
|
+
}
|
|
168
|
+
if (!binding.current && ref.current && owned.current)
|
|
169
|
+
binding.current = {
|
|
170
|
+
node: ref.current,
|
|
171
|
+
axis: options.axis,
|
|
172
|
+
cleanup: bindSpringDrag(ref.current, owned.current, options.axis)
|
|
173
|
+
};
|
|
174
|
+
});
|
|
175
|
+
useEffect(() => () => {
|
|
176
|
+
binding.current?.cleanup();
|
|
177
|
+
binding.current = null;
|
|
178
|
+
}, []);
|
|
179
|
+
return control;
|
|
180
|
+
}
|
|
181
|
+
/** Follow committed numeric props or an external source without rendering each spring frame. */
|
|
182
|
+
export function useSpringFollow(target, interaction = 'follow', reducedValue) {
|
|
183
|
+
const spring = useSpring(typeof target === 'number' ? target : target.get(), interaction, reducedValue);
|
|
184
|
+
useEffect(() => {
|
|
185
|
+
if (typeof target === 'number')
|
|
186
|
+
spring.to(target);
|
|
187
|
+
else
|
|
188
|
+
return bindSpringSource(spring, target);
|
|
189
|
+
}, [spring, target]);
|
|
190
|
+
return spring;
|
|
191
|
+
}
|
|
192
|
+
/** Batch direct-child layout slots after each commit and observe later intrinsic changes. */
|
|
193
|
+
export function useSpringLayout(ref) {
|
|
194
|
+
const profile = useContext(MotionProfileContext);
|
|
195
|
+
const reduced = useReducedMotion();
|
|
196
|
+
const resolved = resolveMotion(profile, 'layout', reduced);
|
|
197
|
+
const binding = useRef(null);
|
|
198
|
+
const [controller] = useState(() => ({
|
|
199
|
+
measure: () => binding.current?.controller.measure(),
|
|
200
|
+
get: slot => binding.current?.controller.get(slot),
|
|
201
|
+
getVelocity: slot => binding.current?.controller.getVelocity(slot),
|
|
202
|
+
isAnimating: () => binding.current?.controller.isAnimating() ?? false
|
|
203
|
+
}));
|
|
204
|
+
useLayoutEffect(() => {
|
|
205
|
+
if (binding.current?.node !== ref.current) {
|
|
206
|
+
binding.current?.controller.destroy();
|
|
207
|
+
binding.current = null;
|
|
208
|
+
}
|
|
209
|
+
if (!ref.current)
|
|
210
|
+
return;
|
|
211
|
+
if (!binding.current)
|
|
212
|
+
binding.current = { node: ref.current, controller: bindSpringLayout(ref.current, resolved) };
|
|
213
|
+
else {
|
|
214
|
+
binding.current.controller.configure(resolved);
|
|
215
|
+
binding.current.controller.measure();
|
|
216
|
+
}
|
|
217
|
+
});
|
|
218
|
+
useLayoutEffect(() => () => {
|
|
219
|
+
binding.current?.controller.destroy();
|
|
220
|
+
binding.current = null;
|
|
221
|
+
}, []);
|
|
222
|
+
return controller;
|
|
223
|
+
}
|
|
224
|
+
//# sourceMappingURL=react.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"react.js","sourceRoot":"","sources":["../../../src/motion/react.ts"],"names":[],"mappings":"AAAA,YAAY,CAAA;AACZ,OAAO,EACL,UAAU,EACV,SAAS,EACT,eAAe,EACf,MAAM,EACN,QAAQ,EACR,oBAAoB,EAErB,MAAM,OAAO,CAAA;AACd,OAAO,EAAE,aAAa,EAAkB,MAAM,OAAO,CAAA;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAA;AAC7C,OAAO,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AACzE,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAC5C,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAA;AACnD,OAAO,EAAE,aAAa,EAA0B,MAAM,aAAa,CAAA;AACnE,OAAO,EAAE,gBAAgB,EAAqD,MAAM,WAAW,CAAA;AAC/F,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AACjD,OAAO,EAAE,YAAY,EAAyB,MAAM,cAAc,CAAA;AAClE,OAAO,EAAE,eAAe,EAA4B,MAAM,cAAc,CAAA;AACxE,OAAO,EAAE,gBAAgB,EAAqB,MAAM,aAAa,CAA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B,OAAO,CAAC,OAAO,GAAG,EAAE,IAAI,EAAE,GAAG,CAAC,OAAO,EAAE,UAAU,EAAE,gBAAgB,CAAC,GAAG,CAAC,OAAO,EAAE,QAAQ,CAAC,EAAE,CAAA;aACzF,CAAC;YACJ,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAA;YAC9C,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,OAAO,EAAE,CAAA;QACtC,CAAC;IACH,CAAC,CAAC,CAAA;IACF,eAAe,CACb,GAAG,EAAE,CAAC,GAAG,EAAE;QACT,OAAO,CAAC,OAAO,EAAE,UAAU,CAAC,OAAO,EAAE,CAAA;QACrC,OAAO,CAAC,OAAO,GAAG,IAAI,CAAA;IACxB,CAAC,EACD,EAAE,CACH,CAAA;IACD,OAAO,UAAU,CAAA;AACnB,CAAC","sourcesContent":["'use client'\nimport {\n useContext,\n useEffect,\n useLayoutEffect,\n useRef,\n useState,\n useSyncExternalStore,\n type RefObject\n} from 'react'\nimport { createElement, type ReactNode } from 'react'\nimport { MotionHostContext } from './host.js'\nimport { bindDisclosureMotion, bindDialogMotion } from './transitions.js'\nimport { bindPressMotion } from './press.js'\nimport { MotionProfileContext } from './context.js'\nimport { resolveMotion, type MotionInteraction } from './config.js'\nimport { createSpringDrag, type SpringDragController, type SpringDragOptions } from './drag.js'\nimport { bindSpringDrag } from './dragBrowser.js'\nimport { createSpring, type SpringController } from './runtime.js'\nimport { bindSpringStyle, type SpringStyleProperty } from './browser.js'\nimport { bindSpringSource, type SpringSource } from './follow.js'\nimport { bindSpringLayout, type SpringLayoutController } from './layoutDom.js'\n\n// Start conservatively for SSR/hydration; only subscribing reads the browser.\nconst listeners = new Set<() => void>()\nlet query: MediaQueryList | undefined\nfunction subscribeReduced(listener: () => void) {\n if (!query) query = window.matchMedia('(prefers-reduced-motion: reduce)')\n const current = query\n const notify = () => listener()\n listeners.add(notify)\n current.addEventListener('change', notify)\n return () => {\n listeners.delete(notify)\n current.removeEventListener('change', notify)\n if (!listeners.size) query = undefined\n }\n}\nexport function useReducedMotion(): boolean {\n return useSyncExternalStore(\n subscribeReduced,\n () => query?.matches ?? true,\n () => true\n )\n}\nexport function useSpring(\n initial: number,\n interaction: MotionInteraction = 'follow',\n reducedValue?: number\n): SpringController {\n const profile = useContext(MotionProfileContext)\n const reduced = useReducedMotion()\n const resolved = resolveMotion(profile, interaction, reduced)\n const owned = useRef<SpringController | null>(null)\n const requested = useRef(initial)\n const requestedVelocity = useRef<number | undefined>(undefined)\n const callbacks = useRef(new Set<(value: number) => void>())\n const initialOptions = useRef({ ...resolved, reducedValue })\n const policy = useRef(resolved.enabled)\n const initialValue = useRef(initial)\n const [controller] = useState<SpringController>(() => ({\n get: () => owned.current?.get() ?? requested.current,\n getVelocity: () => owned.current?.getVelocity() ?? 0,\n isAnimating: () => owned.current?.isAnimating() ?? false,\n to(next, velocity) {\n if (velocity !== undefined && !Number.isFinite(velocity))\n throw new TypeError('Velocity must be finite.')\n requestedVelocity.current = velocity\n if (!Number.isFinite(next)) throw new TypeError('Spring value must be finite.')\n requested.current = next\n owned.current?.to(next, velocity)\n },\n jump(next) {\n if (!Number.isFinite(next)) throw new TypeError('Spring value must be finite.')\n requested.current = next\n owned.current?.jump(next)\n },\n stop() {\n owned.current?.stop()\n requested.current = owned.current?.get() ?? requested.current\n },\n configure(next) {\n owned.current?.configure({ ...next, enabled: policy.current && (next.enabled ?? true) })\n },\n subscribe(listener) {\n callbacks.current.add(listener)\n return () => {\n callbacks.current.delete(listener)\n }\n },\n destroy() {\n owned.current?.destroy()\n }\n }))\n useEffect(() => {\n const spring = createSpring(initialValue.current, initialOptions.current)\n owned.current = spring\n const off = spring.subscribe(next => callbacks.current.forEach(listener => listener(next)))\n spring.to(requested.current, requestedVelocity.current)\n return () => {\n off()\n spring.destroy()\n owned.current = null\n }\n }, [])\n const { stiffness, damping, mass } = resolved.parameters\n useEffect(() => {\n policy.current = resolved.enabled\n owned.current?.configure({\n enabled: resolved.enabled,\n parameters: { stiffness, damping, mass },\n reducedValue\n })\n }, [resolved.enabled, stiffness, damping, mass, reducedValue])\n return controller\n}\n/** Use the real native ref; events/state remain with the component and caller. */\nexport function useSpringStyle(\n ref: RefObject<HTMLElement | null>,\n property: SpringStyleProperty,\n initial: number,\n interaction: MotionInteraction = 'follow',\n reducedValue?: number\n): SpringController {\n const spring = useSpring(initial, interaction, reducedValue)\n // Rebind after every commit to handle a replaced render host; no animation state enters React.\n useEffect(() => {\n if (!ref.current) return\n return bindSpringStyle(ref.current, spring, property)\n })\n return spring\n}\n\nconst hostRuntime = {\n press: bindPressMotion,\n disclosure: bindDisclosureMotion,\n dialog: bindDialogMotion\n}\n/** Opt into native Radiant spring interactions without adding a DOM wrapper. */\nexport function MotionProvider({ children }: { children?: ReactNode }) {\n return createElement(MotionHostContext.Provider, { value: hostRuntime }, children)\n}\nexport { MotionLink } from './MotionLink.js'\nexport type { MotionLinkProps } from './MotionLink.js'\n\n/** Dedicated one-axis handle binding; explicit native keyboard controls are retained. */\nexport function useSpringDrag(\n ref: RefObject<HTMLElement | null>,\n initial: number,\n options: Omit<SpringDragOptions, 'parameters' | 'enabled'> & { axis?: 'x' | 'y' }\n) {\n const profile = useContext(MotionProfileContext)\n const reduced = useReducedMotion()\n const resolved = resolveMotion(profile, 'drag', reduced)\n const latest = useRef({ initial, options, resolved })\n const owned = useRef<SpringDragController | null>(null)\n const [control] = useState(() => ({\n get: () => owned.current?.get() ?? initial,\n getVelocity: () => owned.current?.getVelocity() ?? 0,\n subscribe: (listener: (value: number) => void) =>\n owned.current?.subscribe(listener) ?? (() => {}),\n to: (target: number) => owned.current?.to(target),\n cancel: () => owned.current?.cancel(),\n step: (direction: -1 | 1 | 'first' | 'last') => owned.current?.step(direction),\n isAnimating: () => owned.current?.isAnimating() ?? false\n }))\n useEffect(() => {\n const current = latest.current\n const drag = createSpringDrag(current.initial, { ...current.options, ...current.resolved })\n owned.current = drag\n return () => {\n drag.destroy()\n owned.current = null\n }\n }, [])\n const points = options.snapPoints?.join(',')\n const { stiffness, damping, mass } = resolved.parameters\n useEffect(() => {\n owned.current?.configure({\n min: options.min,\n max: options.max,\n snapPoints: points?.split(',').map(Number),\n parameters: { stiffness, damping, mass },\n enabled: resolved.enabled\n })\n }, [options.min, options.max, points, stiffness, damping, mass, resolved.enabled])\n const binding = useRef<{\n node: HTMLElement\n axis: 'x' | 'y' | undefined\n cleanup: () => void\n } | null>(null)\n useEffect(() => {\n if (\n binding.current &&\n (binding.current.node !== ref.current || binding.current.axis !== options.axis)\n ) {\n binding.current.cleanup()\n binding.current = null\n }\n if (!binding.current && ref.current && owned.current)\n binding.current = {\n node: ref.current,\n axis: options.axis,\n cleanup: bindSpringDrag(ref.current, owned.current, options.axis)\n }\n })\n useEffect(\n () => () => {\n binding.current?.cleanup()\n binding.current = null\n },\n []\n )\n return control\n}\n\n/** Follow committed numeric props or an external source without rendering each spring frame. */\nexport function useSpringFollow(\n target: number | SpringSource,\n interaction: MotionInteraction = 'follow',\n reducedValue?: number\n): SpringController {\n const spring = useSpring(\n typeof target === 'number' ? target : target.get(),\n interaction,\n reducedValue\n )\n useEffect(() => {\n if (typeof target === 'number') spring.to(target)\n else return bindSpringSource(spring, target)\n }, [spring, target])\n return spring\n}\n\n/** Batch direct-child layout slots after each commit and observe later intrinsic changes. */\nexport function useSpringLayout(\n ref: RefObject<HTMLElement | null>\n): Pick<SpringLayoutController, 'measure' | 'get' | 'getVelocity' | 'isAnimating'> {\n const profile = useContext(MotionProfileContext)\n const reduced = useReducedMotion()\n const resolved = resolveMotion(profile, 'layout', reduced)\n const binding = useRef<{ node: HTMLElement; controller: SpringLayoutController } | null>(null)\n const [controller] = useState<\n Pick<SpringLayoutController, 'measure' | 'get' | 'getVelocity' | 'isAnimating'>\n >(() => ({\n measure: () => binding.current?.controller.measure(),\n get: slot => binding.current?.controller.get(slot),\n getVelocity: slot => binding.current?.controller.getVelocity(slot),\n isAnimating: () => binding.current?.controller.isAnimating() ?? false\n }))\n useLayoutEffect(() => {\n if (binding.current?.node !== ref.current) {\n binding.current?.controller.destroy()\n binding.current = null\n }\n if (!ref.current) return\n if (!binding.current)\n binding.current = { node: ref.current, controller: bindSpringLayout(ref.current, resolved) }\n else {\n binding.current.controller.configure(resolved)\n binding.current.controller.measure()\n }\n })\n useLayoutEffect(\n () => () => {\n binding.current?.controller.destroy()\n binding.current = null\n },\n []\n )\n return controller\n}\n"]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type SpringParameters } from './config.js';
|
|
2
|
+
export interface SpringOptions {
|
|
3
|
+
readonly parameters?: Partial<SpringParameters>;
|
|
4
|
+
readonly enabled?: boolean;
|
|
5
|
+
/** Presentation neutral (e.g. scale 1); otherwise off snaps to the latest goal. */
|
|
6
|
+
readonly reducedValue?: number;
|
|
7
|
+
}
|
|
8
|
+
export interface SpringController {
|
|
9
|
+
get(): number;
|
|
10
|
+
getVelocity(): number;
|
|
11
|
+
isAnimating(): boolean;
|
|
12
|
+
to(target: number, velocity?: number): void;
|
|
13
|
+
jump(target: number): void;
|
|
14
|
+
/** Stop at the current presentation and discard the old goal. */
|
|
15
|
+
stop(): void;
|
|
16
|
+
configure(options: SpringOptions): void;
|
|
17
|
+
subscribe(listener: (value: number) => void): () => void;
|
|
18
|
+
destroy(): void;
|
|
19
|
+
}
|
|
20
|
+
/** One persistent upstream follower; numeric values only, no DOM or React ownership. */
|
|
21
|
+
export declare function createSpring(initial: number, options?: SpringOptions): SpringController;
|
|
22
|
+
//# sourceMappingURL=runtime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../../src/motion/runtime.ts"],"names":[],"mappings":"AACA,OAAO,EAA2B,KAAK,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAE5E,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC,gBAAgB,CAAC,CAAA;IAC/C,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAA;IAC1B,mFAAmF;IACnF,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAA;CAC/B;AACD,MAAM,WAAW,gBAAgB;IAC/B,GAAG,IAAI,MAAM,CAAA;IACb,WAAW,IAAI,MAAM,CAAA;IACrB,WAAW,IAAI,OAAO,CAAA;IACtB,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3C,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;IAC1B,iEAAiE;IACjE,IAAI,IAAI,IAAI,CAAA;IACZ,SAAS,CAAC,OAAO,EAAE,aAAa,GAAG,IAAI,CAAA;IACvC,SAAS,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,GAAG,MAAM,IAAI,CAAA;IACxD,OAAO,IAAI,IAAI,CAAA;CAChB;AASD,wFAAwF;AACxF,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,GAAE,aAAkB,GAAG,gBAAgB,CA2F3F"}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { springValue } from 'motion';
|
|
2
|
+
import { resolveSpringParameters } from './config.js';
|
|
3
|
+
function finite(value) {
|
|
4
|
+
if (typeof value !== 'number' || !Number.isFinite(value))
|
|
5
|
+
throw new TypeError('Spring values must be finite numbers in one consistent unit.');
|
|
6
|
+
return value;
|
|
7
|
+
}
|
|
8
|
+
function same(a, b) {
|
|
9
|
+
return a.stiffness === b.stiffness && a.damping === b.damping && a.mass === b.mass;
|
|
10
|
+
}
|
|
11
|
+
/** One persistent upstream follower; numeric values only, no DOM or React ownership. */
|
|
12
|
+
export function createSpring(initial, options = {}) {
|
|
13
|
+
let parameters = resolveSpringParameters(options.parameters);
|
|
14
|
+
let pending = parameters;
|
|
15
|
+
let value = springValue(finite(initial), parameters);
|
|
16
|
+
let enabled = options.enabled ?? true;
|
|
17
|
+
let reducedValue = options.reducedValue === undefined ? undefined : finite(options.reducedValue);
|
|
18
|
+
let target = initial;
|
|
19
|
+
let destroyed = false;
|
|
20
|
+
const listeners = new Set();
|
|
21
|
+
let offChange;
|
|
22
|
+
let offComplete;
|
|
23
|
+
function attach() {
|
|
24
|
+
offChange = value.on('change', next => listeners.forEach(listener => listener(next)));
|
|
25
|
+
offComplete = value.on('animationComplete', applyPending);
|
|
26
|
+
}
|
|
27
|
+
function applyPending() {
|
|
28
|
+
if (destroyed || same(parameters, pending))
|
|
29
|
+
return;
|
|
30
|
+
const current = value.get();
|
|
31
|
+
offChange();
|
|
32
|
+
offComplete();
|
|
33
|
+
value.destroy();
|
|
34
|
+
parameters = pending;
|
|
35
|
+
value = springValue(current, parameters);
|
|
36
|
+
attach();
|
|
37
|
+
}
|
|
38
|
+
attach();
|
|
39
|
+
const controller = {
|
|
40
|
+
get: () => value.get(),
|
|
41
|
+
getVelocity: () => (destroyed ? 0 : value.getVelocity()),
|
|
42
|
+
isAnimating: () => !destroyed && value.isAnimating(),
|
|
43
|
+
to(next, velocity) {
|
|
44
|
+
finite(next);
|
|
45
|
+
if (velocity !== undefined)
|
|
46
|
+
finite(velocity);
|
|
47
|
+
if (destroyed)
|
|
48
|
+
return;
|
|
49
|
+
target = next;
|
|
50
|
+
if (enabled) {
|
|
51
|
+
if (velocity !== undefined) {
|
|
52
|
+
const current = value.get();
|
|
53
|
+
value.jump(current);
|
|
54
|
+
applyPending();
|
|
55
|
+
value.setWithVelocity(current - velocity / 60, current, 1000 / 60);
|
|
56
|
+
}
|
|
57
|
+
value.set(next);
|
|
58
|
+
}
|
|
59
|
+
else
|
|
60
|
+
value.jump(reducedValue ?? target);
|
|
61
|
+
},
|
|
62
|
+
jump(next) {
|
|
63
|
+
finite(next);
|
|
64
|
+
if (destroyed)
|
|
65
|
+
return;
|
|
66
|
+
target = next;
|
|
67
|
+
value.jump(enabled ? next : (reducedValue ?? next));
|
|
68
|
+
applyPending();
|
|
69
|
+
},
|
|
70
|
+
stop() {
|
|
71
|
+
if (destroyed)
|
|
72
|
+
return;
|
|
73
|
+
target = value.get();
|
|
74
|
+
value.jump(target);
|
|
75
|
+
applyPending();
|
|
76
|
+
},
|
|
77
|
+
configure(next) {
|
|
78
|
+
const resolved = resolveSpringParameters(next.parameters, pending);
|
|
79
|
+
const neutral = Object.hasOwn(next, 'reducedValue')
|
|
80
|
+
? next.reducedValue === undefined
|
|
81
|
+
? undefined
|
|
82
|
+
: finite(next.reducedValue)
|
|
83
|
+
: reducedValue;
|
|
84
|
+
if (destroyed)
|
|
85
|
+
return;
|
|
86
|
+
pending = resolved;
|
|
87
|
+
reducedValue = neutral;
|
|
88
|
+
enabled = next.enabled ?? enabled;
|
|
89
|
+
if (!enabled)
|
|
90
|
+
value.jump(reducedValue ?? target);
|
|
91
|
+
// Parameter changes take effect at rest, so in-flight momentum is never replaced.
|
|
92
|
+
if (!value.isAnimating())
|
|
93
|
+
applyPending();
|
|
94
|
+
},
|
|
95
|
+
subscribe(listener) {
|
|
96
|
+
if (destroyed)
|
|
97
|
+
return () => { };
|
|
98
|
+
listeners.add(listener);
|
|
99
|
+
return () => {
|
|
100
|
+
listeners.delete(listener);
|
|
101
|
+
};
|
|
102
|
+
},
|
|
103
|
+
destroy() {
|
|
104
|
+
if (destroyed)
|
|
105
|
+
return;
|
|
106
|
+
destroyed = true;
|
|
107
|
+
offChange();
|
|
108
|
+
offComplete();
|
|
109
|
+
value.destroy();
|
|
110
|
+
listeners.clear();
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
if (!enabled)
|
|
114
|
+
value.jump(reducedValue ?? target);
|
|
115
|
+
return controller;
|
|
116
|
+
}
|
|
117
|
+
//# sourceMappingURL=runtime.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime.js","sourceRoot":"","sources":["../../../src/motion/runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,E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CAAC,IAAI,CAAC,YAAY,IAAI,MAAM,CAAC,CAAA;YAChD,kFAAkF;YAClF,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE;gBAAE,YAAY,EAAE,CAAA;QAC1C,CAAC;QACD,SAAS,CAAC,QAAQ;YAChB,IAAI,SAAS;gBAAE,OAAO,GAAG,EAAE,GAAE,CAAC,CAAA;YAC9B,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAA;YACvB,OAAO,GAAG,EAAE;gBACV,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAA;YAC5B,CAAC,CAAA;QACH,CAAC;QACD,OAAO;YACL,IAAI,SAAS;gBAAE,OAAM;YACrB,SAAS,GAAG,IAAI,CAAA;YAChB,SAAS,EAAE,CAAA;YACX,WAAW,EAAE,CAAA;YACb,KAAK,CAAC,OAAO,EAAE,CAAA;YACf,SAAS,CAAC,KAAK,EAAE,CAAA;QACnB,CAAC;KACF,CAAA;IACD,IAAI,CAAC,OAAO;QAAE,KAAK,CAAC,IAAI,CAAC,YAAY,IAAI,MAAM,CAAC,CAAA;IAChD,OAAO,UAAU,CAAA;AACnB,CAAC","sourcesContent":["import { springValue } from 'motion'\nimport { resolveSpringParameters, type SpringParameters } from './config.js'\n\nexport interface SpringOptions {\n readonly parameters?: Partial<SpringParameters>\n readonly enabled?: boolean\n /** Presentation neutral (e.g. scale 1); otherwise off snaps to the latest goal. */\n readonly reducedValue?: number\n}\nexport interface SpringController {\n get(): number\n getVelocity(): number\n isAnimating(): boolean\n to(target: number, velocity?: number): void\n jump(target: number): void\n /** Stop at the current presentation and discard the old goal. */\n stop(): void\n configure(options: SpringOptions): void\n subscribe(listener: (value: number) => void): () => void\n destroy(): void\n}\nfunction finite(value: number) {\n if (typeof value !== 'number' || !Number.isFinite(value))\n throw new TypeError('Spring values must be finite numbers in one consistent unit.')\n return value\n}\nfunction same(a: SpringParameters, b: SpringParameters) {\n return a.stiffness === b.stiffness && a.damping === b.damping && a.mass === b.mass\n}\n/** One persistent upstream follower; numeric values only, no DOM or React ownership. */\nexport function createSpring(initial: number, options: SpringOptions = {}): SpringController {\n let parameters = resolveSpringParameters(options.parameters)\n let pending = parameters\n let value = springValue(finite(initial), parameters)\n let enabled = options.enabled ?? true\n let reducedValue = options.reducedValue === undefined ? undefined : finite(options.reducedValue)\n let target = initial\n let destroyed = false\n const listeners = new Set<(value: number) => void>()\n let offChange: () => void\n let offComplete: () => void\n function attach() {\n offChange = value.on('change', next => listeners.forEach(listener => listener(next)))\n offComplete = value.on('animationComplete', applyPending)\n }\n function applyPending() {\n if (destroyed || same(parameters, pending)) return\n const current = value.get()\n offChange()\n offComplete()\n value.destroy()\n parameters = pending\n value = springValue(current, parameters)\n attach()\n }\n attach()\n const controller: SpringController = {\n get: () => value.get(),\n getVelocity: () => (destroyed ? 0 : value.getVelocity()),\n isAnimating: () => !destroyed && value.isAnimating(),\n to(next, velocity) {\n finite(next)\n if (velocity !== undefined) finite(velocity)\n if (destroyed) return\n target = next\n if (enabled) {\n if (velocity !== undefined) {\n const current = value.get()\n value.jump(current)\n applyPending()\n value.setWithVelocity(current - velocity / 60, current, 1000 / 60)\n }\n value.set(next)\n } else value.jump(reducedValue ?? target)\n },\n jump(next) {\n finite(next)\n if (destroyed) return\n target = next\n value.jump(enabled ? next : (reducedValue ?? next))\n applyPending()\n },\n stop() {\n if (destroyed) return\n target = value.get()\n value.jump(target)\n applyPending()\n },\n configure(next) {\n const resolved = resolveSpringParameters(next.parameters, pending)\n const neutral = Object.hasOwn(next, 'reducedValue')\n ? next.reducedValue === undefined\n ? undefined\n : finite(next.reducedValue)\n : reducedValue\n if (destroyed) return\n pending = resolved\n reducedValue = neutral\n enabled = next.enabled ?? enabled\n if (!enabled) value.jump(reducedValue ?? target)\n // Parameter changes take effect at rest, so in-flight momentum is never replaced.\n if (!value.isAnimating()) applyPending()\n },\n subscribe(listener) {\n if (destroyed) return () => {}\n listeners.add(listener)\n return () => {\n listeners.delete(listener)\n }\n },\n destroy() {\n if (destroyed) return\n destroyed = true\n offChange()\n offComplete()\n value.destroy()\n listeners.clear()\n }\n }\n if (!enabled) value.jump(reducedValue ?? target)\n return controller\n}\n"]}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type MotionProfile } from './config.js';
|
|
2
|
+
import type { MotionHostBinding } from './host.js';
|
|
3
|
+
export declare function bindDisclosureMotion(host: HTMLElement, initial: MotionProfile): MotionHostBinding;
|
|
4
|
+
export declare function bindDialogMotion(host: HTMLElement, initial: MotionProfile): MotionHostBinding;
|
|
5
|
+
//# sourceMappingURL=transitions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transitions.d.ts","sourceRoot":"","sources":["../../../src/motion/transitions.ts"],"names":[],"mappings":"AAEA,OAAO,EAAiB,KAAK,aAAa,EAAE,MAAM,aAAa,CAAA;AAC/D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAA;AAElD,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,aAAa,GAAG,iBAAiB,CAgEjG;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,aAAa,GAAG,iBAAiB,CAsI7F"}
|