motion-dom 14.4.0 → 14.5.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/dist/cjs/index.js +269 -24
- package/dist/cjs/index.js.map +1 -1
- package/dist/es/animation/animate/element.mjs +10 -1
- package/dist/es/animation/animate/element.mjs.map +1 -1
- package/dist/es/gestures/drag/VisualElementDragControls.mjs.map +1 -1
- package/dist/es/gestures/drag/index.mjs +16 -1
- package/dist/es/gestures/drag/index.mjs.map +1 -1
- package/dist/es/gestures/hover.mjs +2 -0
- package/dist/es/gestures/hover.mjs.map +1 -1
- package/dist/es/gestures/pan/PanSession.mjs +6 -0
- package/dist/es/gestures/pan/PanSession.mjs.map +1 -1
- package/dist/es/gestures/press/index.mjs +3 -1
- package/dist/es/gestures/press/index.mjs.map +1 -1
- package/dist/es/gestures/press/utils/keyboard.mjs +22 -12
- package/dist/es/gestures/press/utils/keyboard.mjs.map +1 -1
- package/dist/es/gestures/utils/setup.mjs +2 -1
- package/dist/es/gestures/utils/setup.mjs.map +1 -1
- package/dist/es/index.mjs +4 -1
- package/dist/es/index.mjs.map +1 -1
- package/dist/es/layout/LayoutAnimationBuilder.mjs +2 -1
- package/dist/es/layout/LayoutAnimationBuilder.mjs.map +1 -1
- package/dist/es/layout/animate-layout.mjs +7 -1
- package/dist/es/layout/animate-layout.mjs.map +1 -1
- package/dist/es/resize/index.mjs +2 -1
- package/dist/es/resize/index.mjs.map +1 -1
- package/dist/es/scope/active.mjs +39 -0
- package/dist/es/scope/active.mjs.map +1 -0
- package/dist/es/scope/index.mjs +122 -0
- package/dist/es/scope/index.mjs.map +1 -0
- package/dist/es/scope/media.mjs +42 -0
- package/dist/es/scope/media.mjs.map +1 -0
- package/dist/es/utils/delay.mjs +3 -1
- package/dist/es/utils/delay.mjs.map +1 -1
- package/dist/es/utils/resolve-elements.mjs +5 -4
- package/dist/es/utils/resolve-elements.mjs.map +1 -1
- package/dist/es/view/index.mjs +4 -1
- package/dist/es/view/index.mjs.map +1 -1
- package/dist/index.d.ts +135 -2
- package/dist/motion-dom.dev.js +269 -24
- package/dist/motion-dom.js +1 -1
- package/dist/size-rollup-style-effect.js +1 -1
- package/dist/size-rollup-style-effect.js.map +1 -1
- package/package.json +3 -3
package/dist/cjs/index.js
CHANGED
|
@@ -5830,6 +5830,43 @@ function isSVGElement(element) {
|
|
|
5830
5830
|
return motionUtils.isObject(element) && "ownerSVGElement" in element;
|
|
5831
5831
|
}
|
|
5832
5832
|
|
|
5833
|
+
const activeScope = {};
|
|
5834
|
+
/**
|
|
5835
|
+
* Register `cleanup` with the active scope, if there is one, so stopping
|
|
5836
|
+
* the scope also runs it.
|
|
5837
|
+
*/
|
|
5838
|
+
function addToScope(cleanup) {
|
|
5839
|
+
activeScope.current?.add(cleanup);
|
|
5840
|
+
return cleanup;
|
|
5841
|
+
}
|
|
5842
|
+
/**
|
|
5843
|
+
* Collect the animation a builder like `animateLayout()` or
|
|
5844
|
+
* `animateView()` resolves with. If the scope stops first, the animation
|
|
5845
|
+
* is stopped as soon as it starts.
|
|
5846
|
+
*/
|
|
5847
|
+
function addBuilderToScope(builder) {
|
|
5848
|
+
const scope = activeScope.current;
|
|
5849
|
+
if (!scope)
|
|
5850
|
+
return;
|
|
5851
|
+
let isStopped = false;
|
|
5852
|
+
let stop;
|
|
5853
|
+
const remove = scope.add(() => {
|
|
5854
|
+
isStopped = true;
|
|
5855
|
+
stop?.();
|
|
5856
|
+
});
|
|
5857
|
+
builder.then((animation) => {
|
|
5858
|
+
if (!animation)
|
|
5859
|
+
return;
|
|
5860
|
+
stop = () => animation.stop();
|
|
5861
|
+
isStopped ? stop() : animation.finished.then(remove);
|
|
5862
|
+
}, remove);
|
|
5863
|
+
}
|
|
5864
|
+
/**
|
|
5865
|
+
* Bind `callback` to the active scope, so anything it starts later (for
|
|
5866
|
+
* instance an animation in an `inView()` callback) is collected too.
|
|
5867
|
+
*/
|
|
5868
|
+
const bindToScope = (callback) => activeScope.current ? activeScope.current.bind(callback) : callback;
|
|
5869
|
+
|
|
5833
5870
|
function resolveElements(elementOrSelector, scope, selectorCache) {
|
|
5834
5871
|
if (elementOrSelector == null) {
|
|
5835
5872
|
return [];
|
|
@@ -5838,10 +5875,9 @@ function resolveElements(elementOrSelector, scope, selectorCache) {
|
|
|
5838
5875
|
return [elementOrSelector];
|
|
5839
5876
|
}
|
|
5840
5877
|
else if (typeof elementOrSelector === "string") {
|
|
5841
|
-
|
|
5842
|
-
|
|
5843
|
-
root
|
|
5844
|
-
}
|
|
5878
|
+
const root = scope
|
|
5879
|
+
? scope.current
|
|
5880
|
+
: activeScope.current?.root || document;
|
|
5845
5881
|
const elements = selectorCache?.[elementOrSelector] ??
|
|
5846
5882
|
root.querySelectorAll(elementOrSelector);
|
|
5847
5883
|
return elements ? Array.from(elements) : [];
|
|
@@ -6631,12 +6667,20 @@ class EffectSubject {
|
|
|
6631
6667
|
* sharing values and a renderer.
|
|
6632
6668
|
*/
|
|
6633
6669
|
function animateElement(element, keyframes, transition, visualElement) {
|
|
6670
|
+
activeScope.current?.track(element);
|
|
6634
6671
|
if (visualElement) {
|
|
6635
6672
|
return animateValues((key) => visualElement.getValue(key, null), keyframes, transition, visualElement);
|
|
6636
6673
|
}
|
|
6637
6674
|
const effect = getElementEffect(element);
|
|
6638
6675
|
return animateEffectSubject(effect, element, keyframes, transition, new EffectSubject(effect, element));
|
|
6639
6676
|
}
|
|
6677
|
+
/**
|
|
6678
|
+
* Detach the values styleEffect/svgEffect bound to `element`, so the
|
|
6679
|
+
* next animation reads its starting values from the DOM again.
|
|
6680
|
+
*/
|
|
6681
|
+
const releaseElement = (element) => getElementEffect(element)
|
|
6682
|
+
.state(element)
|
|
6683
|
+
?.release();
|
|
6640
6684
|
/**
|
|
6641
6685
|
* Hand the values styleEffect/svgEffect are rendering on `element`,
|
|
6642
6686
|
* whether bound by animate() or directly, to a VisualElement that now
|
|
@@ -6727,6 +6771,7 @@ const statsBuffer = {
|
|
|
6727
6771
|
*/
|
|
6728
6772
|
function delay(callback, timeout) {
|
|
6729
6773
|
const start = time.now();
|
|
6774
|
+
callback = bindToScope(callback);
|
|
6730
6775
|
const checkElapsed = ({ timestamp }) => {
|
|
6731
6776
|
const elapsed = timestamp - start;
|
|
6732
6777
|
if (elapsed >= timeout) {
|
|
@@ -6735,7 +6780,7 @@ function delay(callback, timeout) {
|
|
|
6735
6780
|
}
|
|
6736
6781
|
};
|
|
6737
6782
|
frame.setup(checkElapsed, true);
|
|
6738
|
-
return () => cancelFrame(checkElapsed);
|
|
6783
|
+
return addToScope(() => cancelFrame(checkElapsed));
|
|
6739
6784
|
}
|
|
6740
6785
|
function delayInSeconds(callback, timeout) {
|
|
6741
6786
|
return delay(callback, motionUtils.secondsToMilliseconds(timeout));
|
|
@@ -10149,7 +10194,7 @@ class LayoutAnimationBuilder {
|
|
|
10149
10194
|
function parseAnimateLayoutArgs(scopeOrUpdateDom, updateDomOrOptions, options) {
|
|
10150
10195
|
if (typeof scopeOrUpdateDom === "function") {
|
|
10151
10196
|
return {
|
|
10152
|
-
scope: document,
|
|
10197
|
+
scope: activeScope.current?.root || document,
|
|
10153
10198
|
updateDom: scopeOrUpdateDom,
|
|
10154
10199
|
defaultOptions: updateDomOrOptions,
|
|
10155
10200
|
};
|
|
@@ -10285,7 +10330,7 @@ function resizeWindow(callback) {
|
|
|
10285
10330
|
}
|
|
10286
10331
|
|
|
10287
10332
|
function resize(a, b) {
|
|
10288
|
-
return typeof a === "function" ? resizeWindow(a) : resizeElement(a, b);
|
|
10333
|
+
return addToScope(typeof a === "function" ? resizeWindow(a) : resizeElement(a, b));
|
|
10289
10334
|
}
|
|
10290
10335
|
|
|
10291
10336
|
const distance = (a, b) => Math.abs(a - b);
|
|
@@ -10350,6 +10395,12 @@ class PanSession {
|
|
|
10350
10395
|
onMove && onMove(this.lastMoveEvent, info);
|
|
10351
10396
|
};
|
|
10352
10397
|
this.handlePointerMove = (event, info) => {
|
|
10398
|
+
/**
|
|
10399
|
+
* This event's pageX/pageY already include any window scroll that
|
|
10400
|
+
* hasn't fired its scroll event yet. Settle it now, so that scroll
|
|
10401
|
+
* event doesn't add it to the new point a second time.
|
|
10402
|
+
*/
|
|
10403
|
+
this.handleScroll(window);
|
|
10353
10404
|
this.lastMoveEvent = event;
|
|
10354
10405
|
this.lastRawMoveEventInfo = info;
|
|
10355
10406
|
this.lastMoveEventInfo = transformPoint(info, this.transformPagePoint);
|
|
@@ -11381,7 +11432,20 @@ function applyDragStyles(element, axis) {
|
|
|
11381
11432
|
*/
|
|
11382
11433
|
function drag(elementOrSelector, options = {}) {
|
|
11383
11434
|
const props = toProps(options);
|
|
11435
|
+
const scope = activeScope.current;
|
|
11436
|
+
/**
|
|
11437
|
+
* Run callbacks in the active scope, so work they start is collected.
|
|
11438
|
+
*/
|
|
11439
|
+
if (scope) {
|
|
11440
|
+
for (const key in props) {
|
|
11441
|
+
const value = props[key];
|
|
11442
|
+
if (typeof value === "function") {
|
|
11443
|
+
props[key] = scope.bind(value);
|
|
11444
|
+
}
|
|
11445
|
+
}
|
|
11446
|
+
}
|
|
11384
11447
|
const cleanups = resolveElements(elementOrSelector).map((element) => {
|
|
11448
|
+
scope?.track(element);
|
|
11385
11449
|
const [node, release] = acquireProjectionNode(element);
|
|
11386
11450
|
/**
|
|
11387
11451
|
* Measure layout even when not animating it, as constraints and
|
|
@@ -11395,10 +11459,11 @@ function drag(elementOrSelector, options = {}) {
|
|
|
11395
11459
|
removeStyles();
|
|
11396
11460
|
removeListeners?.();
|
|
11397
11461
|
controls.cancel();
|
|
11462
|
+
controls.stopAnimation();
|
|
11398
11463
|
release();
|
|
11399
11464
|
};
|
|
11400
11465
|
});
|
|
11401
|
-
return () => cleanups.forEach((cleanup) => cleanup());
|
|
11466
|
+
return addToScope(() => cleanups.forEach((cleanup) => cleanup()));
|
|
11402
11467
|
}
|
|
11403
11468
|
|
|
11404
11469
|
function setupGesture(elementOrSelector, options) {
|
|
@@ -11409,7 +11474,7 @@ function setupGesture(elementOrSelector, options) {
|
|
|
11409
11474
|
...options,
|
|
11410
11475
|
signal: gestureAbortController.signal,
|
|
11411
11476
|
};
|
|
11412
|
-
const cancel = () => gestureAbortController.abort();
|
|
11477
|
+
const cancel = addToScope(() => gestureAbortController.abort());
|
|
11413
11478
|
return [elements, eventOptions, cancel];
|
|
11414
11479
|
}
|
|
11415
11480
|
|
|
@@ -11424,6 +11489,7 @@ function isValidHover(event) {
|
|
|
11424
11489
|
* @public
|
|
11425
11490
|
*/
|
|
11426
11491
|
function hover(elementOrSelector, onHoverStart, options = {}) {
|
|
11492
|
+
onHoverStart = bindToScope(onHoverStart);
|
|
11427
11493
|
const [elements, eventOptions, cancel] = setupGesture(elementOrSelector, options);
|
|
11428
11494
|
elements.forEach((element) => {
|
|
11429
11495
|
let isPressed = false;
|
|
@@ -11512,26 +11578,36 @@ function filterEvents(callback) {
|
|
|
11512
11578
|
function firePointerEvent(target, type) {
|
|
11513
11579
|
target.dispatchEvent(new PointerEvent("pointer" + type, { isPrimary: true, bubbles: true }));
|
|
11514
11580
|
}
|
|
11515
|
-
const enableKeyboardPress = (
|
|
11516
|
-
|
|
11517
|
-
|
|
11518
|
-
|
|
11581
|
+
const enableKeyboardPress = (element, eventOptions) => {
|
|
11582
|
+
/**
|
|
11583
|
+
* Listeners are scoped to this focus and all released on blur, rather
|
|
11584
|
+
* than added per Enter press, so they can't accumulate and fire
|
|
11585
|
+
* duplicate pointerup/pointercancel events. See #3935.
|
|
11586
|
+
*/
|
|
11587
|
+
let isKeyPressing = false;
|
|
11519
11588
|
const handleKeydown = filterEvents(() => {
|
|
11520
11589
|
if (isPressing.has(element))
|
|
11521
11590
|
return;
|
|
11591
|
+
isKeyPressing = true;
|
|
11522
11592
|
firePointerEvent(element, "down");
|
|
11523
|
-
|
|
11524
|
-
|
|
11525
|
-
|
|
11526
|
-
|
|
11527
|
-
|
|
11528
|
-
element
|
|
11593
|
+
});
|
|
11594
|
+
const handleKeyup = filterEvents(() => {
|
|
11595
|
+
if (!isKeyPressing)
|
|
11596
|
+
return;
|
|
11597
|
+
isKeyPressing = false;
|
|
11598
|
+
firePointerEvent(element, "up");
|
|
11529
11599
|
});
|
|
11530
11600
|
element.addEventListener("keydown", handleKeydown, eventOptions);
|
|
11601
|
+
element.addEventListener("keyup", handleKeyup, eventOptions);
|
|
11531
11602
|
/**
|
|
11532
|
-
*
|
|
11603
|
+
* On blur, remove the key listeners and cancel any keyboard press.
|
|
11533
11604
|
*/
|
|
11534
|
-
element.addEventListener("blur", () =>
|
|
11605
|
+
element.addEventListener("blur", () => {
|
|
11606
|
+
element.removeEventListener("keydown", handleKeydown);
|
|
11607
|
+
element.removeEventListener("keyup", handleKeyup);
|
|
11608
|
+
if (isKeyPressing)
|
|
11609
|
+
firePointerEvent(element, "cancel");
|
|
11610
|
+
}, { ...eventOptions, once: true });
|
|
11535
11611
|
};
|
|
11536
11612
|
|
|
11537
11613
|
/**
|
|
@@ -11562,6 +11638,7 @@ const claimedPointerDownEvents = new WeakSet();
|
|
|
11562
11638
|
* @public
|
|
11563
11639
|
*/
|
|
11564
11640
|
function press(targetOrSelector, onPressStart, options = {}) {
|
|
11641
|
+
onPressStart = bindToScope(onPressStart);
|
|
11565
11642
|
const [targets, eventOptions, cancelEvents] = setupGesture(targetOrSelector, options);
|
|
11566
11643
|
const startPress = (startEvent) => {
|
|
11567
11644
|
const target = startEvent.currentTarget;
|
|
@@ -11610,7 +11687,7 @@ function press(targetOrSelector, onPressStart, options = {}) {
|
|
|
11610
11687
|
const pointerDownTarget = options.useGlobalTarget ? window : target;
|
|
11611
11688
|
pointerDownTarget.addEventListener("pointerdown", startPress, eventOptions);
|
|
11612
11689
|
if (isHTMLElement(target)) {
|
|
11613
|
-
target.addEventListener("focus", (
|
|
11690
|
+
target.addEventListener("focus", () => enableKeyboardPress(target, eventOptions), eventOptions);
|
|
11614
11691
|
if (!isElementKeyboardAccessible(target) &&
|
|
11615
11692
|
!target.hasAttribute("tabindex")) {
|
|
11616
11693
|
target.tabIndex = 0;
|
|
@@ -11627,6 +11704,160 @@ function getComputedStyle$1(element, name) {
|
|
|
11627
11704
|
: computedStyle[name];
|
|
11628
11705
|
}
|
|
11629
11706
|
|
|
11707
|
+
const keywords = {
|
|
11708
|
+
reducedMotion: "(prefers-reduced-motion: reduce)",
|
|
11709
|
+
motion: "(prefers-reduced-motion: no-preference)",
|
|
11710
|
+
dark: "(prefers-color-scheme: dark)",
|
|
11711
|
+
light: "(prefers-color-scheme: light)",
|
|
11712
|
+
hover: "(hover: hover) and (pointer: fine)",
|
|
11713
|
+
touch: "(pointer: coarse)",
|
|
11714
|
+
portrait: "(orientation: portrait)",
|
|
11715
|
+
landscape: "(orientation: landscape)",
|
|
11716
|
+
};
|
|
11717
|
+
/**
|
|
11718
|
+
* Turn a condition into a media query. Full media queries pass through
|
|
11719
|
+
* unchanged. Otherwise each space-separated token must match:
|
|
11720
|
+
*
|
|
11721
|
+
* - A width comparison: `">=800"`, `"<1200px"`, `"> 40em"`
|
|
11722
|
+
* - A keyword: `reducedMotion`, `motion`, `dark`, `light`, `hover`,
|
|
11723
|
+
* `touch`, `portrait`, `landscape`
|
|
11724
|
+
*
|
|
11725
|
+
* Prefix a token with `!` to negate it, for instance `">=800 !touch"`.
|
|
11726
|
+
*/
|
|
11727
|
+
function toMediaQuery(condition) {
|
|
11728
|
+
if (condition.includes("("))
|
|
11729
|
+
return condition;
|
|
11730
|
+
return condition
|
|
11731
|
+
.replace(/([<>!]=?)\s+/g, "$1")
|
|
11732
|
+
.trim()
|
|
11733
|
+
.split(/\s+/)
|
|
11734
|
+
.map((token) => {
|
|
11735
|
+
const isNot = token[0] === "!";
|
|
11736
|
+
if (isNot)
|
|
11737
|
+
token = token.slice(1);
|
|
11738
|
+
const width = /^([<>]=?)([\d.]+)([a-z]*)$/.exec(token);
|
|
11739
|
+
const query = width
|
|
11740
|
+
? `(width ${width[1]} ${width[2]}${width[3] || "px"})`
|
|
11741
|
+
: keywords[token] || token;
|
|
11742
|
+
return isNot ? `(not (${query}))` : query;
|
|
11743
|
+
})
|
|
11744
|
+
.join(" and ");
|
|
11745
|
+
}
|
|
11746
|
+
|
|
11747
|
+
function scopeMotion(...args) {
|
|
11748
|
+
const root = typeof args[0] === "function" ? undefined : args.shift();
|
|
11749
|
+
const [setup, options = {}] = args;
|
|
11750
|
+
const { transition, matchMedia } = options;
|
|
11751
|
+
const queries = [];
|
|
11752
|
+
const styles = new Map();
|
|
11753
|
+
let cleanups = [];
|
|
11754
|
+
let isPending = false;
|
|
11755
|
+
const active = {
|
|
11756
|
+
root: resolveElements(root)[0],
|
|
11757
|
+
transition,
|
|
11758
|
+
add(cleanup) {
|
|
11759
|
+
cleanups.push(cleanup);
|
|
11760
|
+
return () => motionUtils.removeItem(cleanups, cleanup);
|
|
11761
|
+
},
|
|
11762
|
+
bind: (callback) => ((...args) => {
|
|
11763
|
+
const result = scope.run(() => callback(...args));
|
|
11764
|
+
return typeof result === "function"
|
|
11765
|
+
? active.bind(result)
|
|
11766
|
+
: result;
|
|
11767
|
+
}),
|
|
11768
|
+
track(element) {
|
|
11769
|
+
styles.has(element) ||
|
|
11770
|
+
styles.set(element, element.getAttribute("style"));
|
|
11771
|
+
},
|
|
11772
|
+
};
|
|
11773
|
+
const clear = (restore) => {
|
|
11774
|
+
const current = cleanups;
|
|
11775
|
+
cleanups = [];
|
|
11776
|
+
for (let i = current.length - 1; i >= 0; i--)
|
|
11777
|
+
current[i]();
|
|
11778
|
+
restore &&
|
|
11779
|
+
styles.forEach((style, element) => {
|
|
11780
|
+
releaseElement(element);
|
|
11781
|
+
style === null
|
|
11782
|
+
? element.removeAttribute("style")
|
|
11783
|
+
: element.setAttribute("style", style);
|
|
11784
|
+
});
|
|
11785
|
+
styles.clear();
|
|
11786
|
+
};
|
|
11787
|
+
const start = () => {
|
|
11788
|
+
scope.state = "active";
|
|
11789
|
+
let matches = !queries.length;
|
|
11790
|
+
scope.media = {};
|
|
11791
|
+
for (const [name, query] of queries) {
|
|
11792
|
+
matches = (scope.media[name] = query.matches) || matches;
|
|
11793
|
+
}
|
|
11794
|
+
if (matches && setup) {
|
|
11795
|
+
const cleanup = scope.run(() => setup(scope));
|
|
11796
|
+
typeof cleanup === "function" && active.add(cleanup);
|
|
11797
|
+
}
|
|
11798
|
+
};
|
|
11799
|
+
const onChange = () => {
|
|
11800
|
+
if (isPending)
|
|
11801
|
+
return;
|
|
11802
|
+
isPending = true;
|
|
11803
|
+
/**
|
|
11804
|
+
* Several conditions can change together, for instance two
|
|
11805
|
+
* breakpoints crossed by one resize. Refresh once.
|
|
11806
|
+
*/
|
|
11807
|
+
queueMicrotask(() => {
|
|
11808
|
+
isPending = false;
|
|
11809
|
+
queries.length && scope.refresh();
|
|
11810
|
+
});
|
|
11811
|
+
};
|
|
11812
|
+
const kill = (restore) => {
|
|
11813
|
+
scope.state = restore ? "cancelled" : "stopped";
|
|
11814
|
+
for (const [, query] of queries) {
|
|
11815
|
+
query.removeEventListener("change", onChange);
|
|
11816
|
+
}
|
|
11817
|
+
queries.length = 0;
|
|
11818
|
+
clear(restore);
|
|
11819
|
+
};
|
|
11820
|
+
const runIn = (target, callback) => {
|
|
11821
|
+
const prev = activeScope.current;
|
|
11822
|
+
activeScope.current = target;
|
|
11823
|
+
try {
|
|
11824
|
+
return callback();
|
|
11825
|
+
}
|
|
11826
|
+
finally {
|
|
11827
|
+
activeScope.current = prev;
|
|
11828
|
+
}
|
|
11829
|
+
};
|
|
11830
|
+
const scope = {
|
|
11831
|
+
state: "active",
|
|
11832
|
+
media: {},
|
|
11833
|
+
run: (callback) => runIn(active, callback),
|
|
11834
|
+
ignore: (callback) => runIn(undefined, callback),
|
|
11835
|
+
bind: active.bind,
|
|
11836
|
+
stop: () => kill(),
|
|
11837
|
+
cancel: () => kill(true),
|
|
11838
|
+
refresh() {
|
|
11839
|
+
clear(true);
|
|
11840
|
+
start();
|
|
11841
|
+
},
|
|
11842
|
+
};
|
|
11843
|
+
if (matchMedia && typeof window !== "undefined") {
|
|
11844
|
+
const conditions = typeof matchMedia === "string"
|
|
11845
|
+
? { matches: matchMedia }
|
|
11846
|
+
: matchMedia;
|
|
11847
|
+
for (const name in conditions) {
|
|
11848
|
+
const query = window.matchMedia(toMediaQuery(conditions[name]));
|
|
11849
|
+
query.addEventListener("change", onChange);
|
|
11850
|
+
queries.push([name, query]);
|
|
11851
|
+
}
|
|
11852
|
+
}
|
|
11853
|
+
/**
|
|
11854
|
+
* A scope created inside another is cancelled with it.
|
|
11855
|
+
*/
|
|
11856
|
+
addToScope(scope.cancel);
|
|
11857
|
+
start();
|
|
11858
|
+
return scope;
|
|
11859
|
+
}
|
|
11860
|
+
|
|
11630
11861
|
function clearStatsBuffer() {
|
|
11631
11862
|
statsBuffer.value = null;
|
|
11632
11863
|
statsBuffer.addProjectionMetrics = null;
|
|
@@ -13243,7 +13474,9 @@ class ViewTransitionBuilder {
|
|
|
13243
13474
|
}
|
|
13244
13475
|
}
|
|
13245
13476
|
function animateView(update, options = {}) {
|
|
13246
|
-
|
|
13477
|
+
const builder = new ViewTransitionBuilder(update, options);
|
|
13478
|
+
addBuilderToScope(builder);
|
|
13479
|
+
return builder;
|
|
13247
13480
|
}
|
|
13248
13481
|
|
|
13249
13482
|
/**
|
|
@@ -13753,7 +13986,12 @@ function nodeGroup() {
|
|
|
13753
13986
|
*/
|
|
13754
13987
|
function animateLayout(scopeOrUpdateDom, updateDomOrOptions, options) {
|
|
13755
13988
|
const { scope, updateDom, defaultOptions } = parseAnimateLayoutArgs(scopeOrUpdateDom, updateDomOrOptions, options);
|
|
13756
|
-
|
|
13989
|
+
const builder = new LayoutAnimationBuilder(scope, updateDom, {
|
|
13990
|
+
...activeScope.current?.transition,
|
|
13991
|
+
...defaultOptions,
|
|
13992
|
+
});
|
|
13993
|
+
addBuilderToScope(builder);
|
|
13994
|
+
return builder;
|
|
13757
13995
|
}
|
|
13758
13996
|
|
|
13759
13997
|
/**
|
|
@@ -13798,7 +14036,9 @@ exports.ViewTransitionBuilder = ViewTransitionBuilder;
|
|
|
13798
14036
|
exports.VisualElement = VisualElement;
|
|
13799
14037
|
exports.VisualElementDragControls = VisualElementDragControls;
|
|
13800
14038
|
exports.acceleratedValues = acceleratedValues;
|
|
14039
|
+
exports.activeScope = activeScope;
|
|
13801
14040
|
exports.addAttrValue = addAttrValue;
|
|
14041
|
+
exports.addBuilderToScope = addBuilderToScope;
|
|
13802
14042
|
exports.addDomEvent = addDomEvent;
|
|
13803
14043
|
exports.addEffect = addEffect;
|
|
13804
14044
|
exports.addPointerEvent = addPointerEvent;
|
|
@@ -13806,6 +14046,7 @@ exports.addPointerInfo = addPointerInfo;
|
|
|
13806
14046
|
exports.addSVGValue = addSVGValue;
|
|
13807
14047
|
exports.addScaleCorrector = addScaleCorrector;
|
|
13808
14048
|
exports.addStyleValue = addStyleValue;
|
|
14049
|
+
exports.addToScope = addToScope;
|
|
13809
14050
|
exports.addValueToWillChange = addValueToWillChange;
|
|
13810
14051
|
exports.alpha = alpha;
|
|
13811
14052
|
exports.analyseComplexValue = analyseComplexValue;
|
|
@@ -13835,6 +14076,7 @@ exports.attrEffect = attrEffect;
|
|
|
13835
14076
|
exports.axisDeltaEquals = axisDeltaEquals;
|
|
13836
14077
|
exports.axisEquals = axisEquals;
|
|
13837
14078
|
exports.axisEqualsRounded = axisEqualsRounded;
|
|
14079
|
+
exports.bindToScope = bindToScope;
|
|
13838
14080
|
exports.boxEquals = boxEquals;
|
|
13839
14081
|
exports.boxEqualsRounded = boxEqualsRounded;
|
|
13840
14082
|
exports.buildHTMLStyles = buildHTMLStyles;
|
|
@@ -14004,6 +14246,7 @@ exports.readSVGValue = readSVGValue;
|
|
|
14004
14246
|
exports.readStyleValue = readStyleValue;
|
|
14005
14247
|
exports.readTransformValue = readTransformValue;
|
|
14006
14248
|
exports.recordStats = recordStats;
|
|
14249
|
+
exports.releaseElement = releaseElement;
|
|
14007
14250
|
exports.removeAxisDelta = removeAxisDelta;
|
|
14008
14251
|
exports.removeAxisTransforms = removeAxisTransforms;
|
|
14009
14252
|
exports.removeBoxTransforms = removeBoxTransforms;
|
|
@@ -14025,6 +14268,7 @@ exports.sampleDelta = sampleDelta;
|
|
|
14025
14268
|
exports.scale = scale;
|
|
14026
14269
|
exports.scaleCorrectors = scaleCorrectors;
|
|
14027
14270
|
exports.scalePoint = scalePoint;
|
|
14271
|
+
exports.scopeMotion = scopeMotion;
|
|
14028
14272
|
exports.scrapeHTMLMotionValuesFromProps = scrapeMotionValuesFromProps$1;
|
|
14029
14273
|
exports.scrapeSVGMotionValuesFromProps = scrapeMotionValuesFromProps;
|
|
14030
14274
|
exports.setDragLock = setDragLock;
|
|
@@ -14051,6 +14295,7 @@ exports.svgSubjectEffect = svgSubjectEffect;
|
|
|
14051
14295
|
exports.sync = sync;
|
|
14052
14296
|
exports.testValueType = testValueType;
|
|
14053
14297
|
exports.time = time;
|
|
14298
|
+
exports.toMediaQuery = toMediaQuery;
|
|
14054
14299
|
exports.transform = transform;
|
|
14055
14300
|
exports.transformAxis = transformAxis;
|
|
14056
14301
|
exports.transformBox = transformBox;
|