@astryxdesign/core 0.7.6-canary.7544940 → 0.7.6-canary.962dffe
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/ComplexSelector/ComplexSelector.d.ts.map +1 -1
- package/dist/ComplexSelector/ComplexSelector.js +4 -41
- package/dist/NumberInput/NumberInput.d.ts.map +1 -1
- package/dist/NumberInput/NumberInput.js +2 -23
- package/dist/astryx.css +0 -4
- package/dist/gestures/GestureArena.d.ts +1 -26
- package/dist/gestures/GestureArena.d.ts.map +1 -1
- package/dist/gestures/GestureArena.js +9 -70
- package/dist/gestures/GestureRecognizer.d.ts +1 -3
- package/dist/gestures/GestureRecognizer.d.ts.map +1 -1
- package/dist/gestures/GestureRecognizer.js +1 -3
- package/dist/motion/animator.d.ts +7 -76
- package/dist/motion/animator.d.ts.map +1 -1
- package/dist/motion/animator.js +99 -589
- package/dist/motion/coast.d.ts +1 -4
- package/dist/motion/coast.d.ts.map +1 -1
- package/dist/motion/coast.js +2 -4
- package/dist/motion/reducedMotion.d.ts.map +1 -1
- package/dist/motion/reducedMotion.js +2 -6
- package/dist/motion/reducedMotionPlan.d.ts +0 -7
- package/dist/motion/reducedMotionPlan.d.ts.map +1 -1
- package/dist/motion/reducedMotionPlan.js +1 -14
- package/dist/motion/roleValue.d.ts +1 -2
- package/dist/motion/roleValue.d.ts.map +1 -1
- package/dist/motion/roleValue.js +1 -2
- package/dist/motion/uikit/timing.d.ts +1 -7
- package/dist/motion/uikit/timing.d.ts.map +1 -1
- package/dist/motion/uikit/timing.js +1 -19
- package/dist/utils/focusOutline.stylex.d.ts +0 -6
- package/dist/utils/focusOutline.stylex.d.ts.map +1 -1
- package/dist/utils/focusOutline.stylex.js +0 -7
- package/dist/utils/touchPresentation.d.ts +2 -2
- package/dist/utils/touchPresentation.d.ts.map +1 -1
- package/dist/utils/touchPresentation.js +5 -8
- package/package.json +4 -4
- package/src/ComplexSelector/ComplexSelector.test.tsx +0 -111
- package/src/ComplexSelector/ComplexSelector.tsx +4 -41
- package/src/NumberInput/NumberInput.test.tsx +7 -68
- package/src/NumberInput/NumberInput.tsx +1 -31
- package/src/gestures/GestureArena.ts +11 -76
- package/src/gestures/GestureRecognizer.ts +1 -3
- package/src/gestures/__tests__/GestureHost.test.ts +1 -50
- package/src/gestures/__tests__/arena.test.ts +0 -35
- package/src/gestures/__tests__/harness.ts +2 -31
- package/src/motion/MEASUREMENTS.md +1 -2
- package/src/motion/README.md +32 -101
- package/src/motion/animator.test.ts +33 -978
- package/src/motion/animator.ts +104 -790
- package/src/motion/coast.ts +3 -10
- package/src/motion/reducedMotion.ts +2 -12
- package/src/motion/reducedMotionPlan.test.ts +0 -26
- package/src/motion/reducedMotionPlan.ts +1 -20
- package/src/motion/roleValue.ts +1 -2
- package/src/motion/roles.test.ts +0 -16
- package/src/motion/uikit/timing.ts +1 -15
- package/src/motion/uikit/values.test.ts +12 -23
- package/src/utils/focusOutline.stylex.ts +0 -28
- package/src/utils/pressGesture.test.ts +0 -9
- package/src/utils/touchPresentation.ts +5 -8
- package/dist/gestures/PressTracker.d.ts +0 -112
- package/dist/gestures/PressTracker.d.ts.map +0 -1
- package/dist/gestures/PressTracker.js +0 -267
- package/dist/gestures/index.d.ts +0 -37
- package/dist/gestures/index.d.ts.map +0 -1
- package/dist/gestures/index.js +0 -25
- package/dist/gestures/useGestureRecognizer.d.ts +0 -56
- package/dist/gestures/useGestureRecognizer.d.ts.map +0 -1
- package/dist/gestures/useGestureRecognizer.js +0 -226
- package/dist/motion/resolveMotion.d.ts +0 -42
- package/dist/motion/resolveMotion.d.ts.map +0 -1
- package/dist/motion/resolveMotion.js +0 -43
- package/dist/utils/touchQueries.d.ts +0 -13
- package/dist/utils/touchQueries.d.ts.map +0 -1
- package/dist/utils/touchQueries.js +0 -15
- package/src/__tests__/internalModulesNotExperimental.test.ts +0 -88
- package/src/gestures/PressTracker.ts +0 -386
- package/src/gestures/README.md +0 -420
- package/src/gestures/__tests__/PressTracker.test.ts +0 -275
- package/src/gestures/__tests__/pressTrackerFactory.test.ts +0 -59
- package/src/gestures/__tests__/useGestureRecognizer.test.tsx +0 -570
- package/src/gestures/index.ts +0 -79
- package/src/gestures/useGestureRecognizer.ts +0 -305
- package/src/motion/__tests__/animator.interaction.browser.spec.ts +0 -843
- package/src/motion/__tests__/motionBundle.ts +0 -14
- package/src/motion/resolveMotion.test.ts +0 -123
- package/src/motion/resolveMotion.ts +0 -68
- package/src/motion/uikit/tableImports.test.ts +0 -293
- package/src/utils/touchQueries.ts +0 -15
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ComplexSelector.d.ts","sourceRoot":"","sources":["../../src/ComplexSelector/ComplexSelector.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,EAQZ,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAEf,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAEL,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EACzB,MAAM,qBAAqB,CAAC;AAK7B,OAAO,EAA4B,KAAK,kBAAkB,EAAC,MAAM,UAAU,CAAC;AAC5E,OAAO,EAAuB,KAAK,QAAQ,EAAC,MAAM,SAAS,CAAC;AAI5D,OAAO,KAAK,EAAC,cAAc,EAAE,cAAc,EAAC,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"ComplexSelector.d.ts","sourceRoot":"","sources":["../../src/ComplexSelector/ComplexSelector.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,EAQZ,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAEf,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAEL,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EACzB,MAAM,qBAAqB,CAAC;AAK7B,OAAO,EAA4B,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EAAE,iCAAiC,KAAK,SAAS,CAAC;IACxE;;;;;OAKG;IACH,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;IACzC,qDAAqD;IACrD,aAAa,CAAC,EAAE,YAAY,CAAC;IAC7B,sCAAsC;IACtC,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,EACrC,KAAK,EACL,KAAK,EACL,QAAQ,EACR,YAAY,EACZ,QAAQ,EACR,YAAY,EACZ,WAAW,EAAE,oBAAoB,EACjC,aAAqB,EACrB,WAAW,EACX,UAAkB,EAClB,UAAkB,EAClB,UAAkB,EAClB,SAAiB,EACjB,MAAM,EACN,aAA0B,EAC1B,YAAY,EACZ,IAAW,EACX,OAAiB,EACjB,SAAS,EACT,KAAK,EACL,SAAmB,EACnB,SAAmB,EACnB,SAAS,EACT,aAAa,EACb,YAAY,EACZ,aAAa,EACb,eAAe,EACf,kBAAkB,EAClB,cAAc,EACd,aAAa,EACb,gBAAgB,EAChB,YAAY,EACZ,GAAG,EACH,EAAE,EACF,OAAO,EAAE,WAAW,EACpB,SAAS,EAAE,aAAa,EACxB,kBAAkB,EAAE,mBAAmB,EACvC,GAAG,SAAS,EACb,EAAE,oBAAoB,CAAC,KAAK,CAAC,qBAkY7B;yBAzae,eAAe"}
|
|
@@ -29,23 +29,16 @@ import { useTranslator } from "../i18n/index.js";
|
|
|
29
29
|
import { layerAnimations } from "../Layer/layerAnimations.stylex.js";
|
|
30
30
|
import { usePopover } from "../Popover/usePopover.js";
|
|
31
31
|
import { useResolvedRequired } from "../hooks/useResolvedRequired.js";
|
|
32
|
-
import { useInputStatusIcon } from "../hooks/useInputStatusIcon.js";
|
|
33
32
|
import "../theme/tokens.stylex.js";
|
|
34
33
|
import { colorVars, durationVars, easeVars, fontWeightVars, radiusVars, sizeVars, spacingVars, typographyVars, typeScaleVars } from "../theme/tokens.stylex.js";
|
|
35
|
-
import { focusOutlineStyles } from "../utils/focusOutline.stylex.js";
|
|
36
34
|
import { isRenderable, mergeProps } from "../utils/index.js";
|
|
37
35
|
import { composeEventHandlers } from "../utils/composeEventHandlers.js";
|
|
36
|
+
import { focusOutlineStyles } from "../utils/focusOutline.stylex.js";
|
|
38
37
|
import { interactionOverlayStyles } from "../utils/interactionOverlay.stylex.js";
|
|
39
38
|
import { usePressFeedback } from "../hooks/usePressFeedback.js";
|
|
40
39
|
import { themeProps } from "../utils/themeProps.js";
|
|
41
40
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
42
41
|
const styles = {
|
|
43
|
-
statusTip: {
|
|
44
|
-
k1xSpc: "x3nfvp2",
|
|
45
|
-
kGNEyG: "x6s0dn4",
|
|
46
|
-
kmuXW: "x2lah0s",
|
|
47
|
-
$$css: true
|
|
48
|
-
},
|
|
49
42
|
triggerContainer: {
|
|
50
43
|
kVAEAm: "x1n2onr6",
|
|
51
44
|
k1xSpc: "x78zum5",
|
|
@@ -184,11 +177,6 @@ const RENDER_TRIGGER_PARTS_MESSAGE = '`container*` and `control*` styling props
|
|
|
184
177
|
* open and close, including the ones the selector performs itself.
|
|
185
178
|
*/
|
|
186
179
|
|
|
187
|
-
/** Keeps a click from reaching the control box's open-the-popup handler. */
|
|
188
|
-
function stopPropagation(event) {
|
|
189
|
-
event.stopPropagation();
|
|
190
|
-
}
|
|
191
|
-
|
|
192
180
|
/**
|
|
193
181
|
* A selector shell for rich, custom selection surfaces.
|
|
194
182
|
*
|
|
@@ -280,19 +268,7 @@ export function ComplexSelector({
|
|
|
280
268
|
const contentId = useId();
|
|
281
269
|
const descriptionId = useId();
|
|
282
270
|
const statusMessageId = useId();
|
|
283
|
-
|
|
284
|
-
// lives in an info-tip button on the trigger row (family:input-fields FR8).
|
|
285
|
-
// Only that placement renders an on-field status affordance here.
|
|
286
|
-
const isTooltipStatus = effectiveStatusVariant === 'tooltip';
|
|
287
|
-
const {
|
|
288
|
-
statusIcon: statusTip,
|
|
289
|
-
describedBy: statusTipDescribedBy
|
|
290
|
-
} = useInputStatusIcon({
|
|
291
|
-
status: isTooltipStatus ? status : undefined,
|
|
292
|
-
statusVariant: effectiveStatusVariant,
|
|
293
|
-
size: 'sm'
|
|
294
|
-
});
|
|
295
|
-
const ariaDescribedBy = [description ? descriptionId : null, isTooltipStatus ? statusTipDescribedBy : status?.message ? statusMessageId : null].filter(id => id != null).join(' ') || undefined;
|
|
271
|
+
const ariaDescribedBy = [description ? descriptionId : null, status?.message ? statusMessageId : null].filter(id => id != null).join(' ') || undefined;
|
|
296
272
|
const triggerRef = useRef(null);
|
|
297
273
|
const triggerButtonRef = useMergedRefs(triggerRef, ref);
|
|
298
274
|
const [isPending, startTransition] = useTransition();
|
|
@@ -488,10 +464,8 @@ export function ComplexSelector({
|
|
|
488
464
|
// The ring belongs to the wrapper (the focusable `<button>` sits
|
|
489
465
|
// inside it), but it must still be a KEYBOARD ring: `:focus-within`
|
|
490
466
|
// matched a mouse click on the trigger and drew the outline for
|
|
491
|
-
// pointer users too.
|
|
492
|
-
|
|
493
|
-
// (architecture:interaction-modality INV3).
|
|
494
|
-
focusOutlineStyles.focusWithinCombobox, variant === 'secondary' && styles.triggerSecondary, variant === 'ghost' && styles.triggerGhost, variant !== 'input' && interactionOverlayStyles.backgroundImage, isDisabled && inputWrapperStyles.disabled, variant !== 'input' && isDisabled && styles.triggerGhostDisabled, isDisabled && styles.disabled, triggerLabel == null && styles.placeholder, controlXstyle), controlClassName, controlStyle),
|
|
467
|
+
// pointer users too. `focusWithin` here is `:has(:focus-visible)`.
|
|
468
|
+
focusOutlineStyles.focusWithin, variant === 'secondary' && styles.triggerSecondary, variant === 'ghost' && styles.triggerGhost, variant !== 'input' && interactionOverlayStyles.backgroundImage, isDisabled && inputWrapperStyles.disabled, variant !== 'input' && isDisabled && styles.triggerGhostDisabled, isDisabled && styles.disabled, triggerLabel == null && styles.placeholder, controlXstyle), controlClassName, controlStyle),
|
|
495
469
|
children: [isRenderable(startIconSlot) && startIconSlot, /*#__PURE__*/_jsx("button", {
|
|
496
470
|
...rest,
|
|
497
471
|
ref: triggerButtonRef,
|
|
@@ -531,17 +505,6 @@ export function ComplexSelector({
|
|
|
531
505
|
},
|
|
532
506
|
children: triggerContent
|
|
533
507
|
})
|
|
534
|
-
}), isRenderable(statusTip) &&
|
|
535
|
-
/*#__PURE__*/
|
|
536
|
-
// The info-tip is its own control: a press on it, or on its message
|
|
537
|
-
// bubble (portaled, so outside this span in the DOM but inside it in
|
|
538
|
-
// React), shows the message without opening the popup.
|
|
539
|
-
_jsx("span", {
|
|
540
|
-
onClick: stopPropagation,
|
|
541
|
-
...{
|
|
542
|
-
className: "x3nfvp2 x6s0dn4 x2lah0s"
|
|
543
|
-
},
|
|
544
|
-
children: statusTip
|
|
545
508
|
}), isBusy && /*#__PURE__*/_jsx(Spinner, {
|
|
546
509
|
size: "sm",
|
|
547
510
|
"aria-hidden": "true"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NumberInput.d.ts","sourceRoot":"","sources":["../../src/NumberInput/NumberInput.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"NumberInput.d.ts","sourceRoot":"","sources":["../../src/NumberInput/NumberInput.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAOL,KAAK,UAAU,EACf,KAAK,aAAa,EAClB,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,MAAM,MAAM,kBAAkB,CAAC;AAS3C,OAAO,EAGL,KAAK,WAAW,EAKhB,KAAK,kBAAkB,EACxB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAuB,KAAK,QAAQ,EAAC,MAAM,SAAS,CAAC;AAyJ5D,QAAA,MAAM,UAAU;;;;;;;;;;EAUd,CAAC;AAEH,MAA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CAAC;AAEF,KAAK,yBAAyB,GAAG,oBAAoB,GAAG;IACtD;;;;;;OAMG;IACH,QAAQ,EAAE,IAAI,CAAC;IACf,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;CAC1C,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAC1B,4BAA4B,GAAG,yBAAyB,CAAC;AAsF3D;;;;;;;;;;GAUG;AACH,wBAAgB,WAAW,CAAC,EAC1B,KAAK,EACL,aAAqB,EACrB,WAAW,EACX,UAAkB,EAClB,UAAkB,EAClB,UAAU,EAAE,cAAsB,EAClC,UAAkB,EAClB,eAAe,EACf,SAAS,EACT,SAAS,EACT,MAAM,EACN,aAA0B,EAC1B,IAAI,EAAE,QAAQ,EACd,QAAQ,EACR,KAAK,EACL,WAAW,EACX,YAAY,EACZ,YAAoB,EACpB,QAAQ,EACR,YAAY,EACZ,GAAG,EACH,GAAG,EACH,IAAI,EACJ,WAAW,EACX,cAAqB,EACrB,iBAAyB,EACzB,KAAK,EACL,aAAqB,EACrB,OAAO,EACP,MAAM,EACN,QAAQ,EACR,OAAO,EACP,SAAS,EACT,KAAK,EACL,eAAe,EACf,kBAAkB,EAClB,cAAc,EACd,aAAa,EACb,gBAAgB,EAChB,YAAY,EACZ,GAAG,EACH,EAAE,EAAE,MAAM,EACV,kBAAkB,EAAE,mBAAmB,EACvC,iBAAiB,EAAE,kBAAkB,EACrC,GAAG,SAAS,EACb,EAAE,gBAAgB,+BA8iBlB;yBA5lBe,WAAW"}
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
* - /apps/storybook/stories/NumberInput.stories.tsx (storybook stories)
|
|
18
18
|
* - /packages/cli/assets/templates/blocks/components/NumberInput/ (showcase blocks)
|
|
19
19
|
*/
|
|
20
|
-
import { use, useId, useState, useMemo, useCallback,
|
|
20
|
+
import { use, useId, useState, useMemo, useCallback, useRef } from 'react';
|
|
21
21
|
import * as stylex from '@stylexjs/stylex';
|
|
22
22
|
import "../theme/tokens.stylex.js";
|
|
23
23
|
import { colorVars, sizeVars, spacingVars, typographyVars, typeScaleVars, borderVars } from "../theme/tokens.stylex.js";
|
|
@@ -363,31 +363,10 @@ export function NumberInput({
|
|
|
363
363
|
}, [isDisabled, isReadOnly]);
|
|
364
364
|
|
|
365
365
|
// Handle focus
|
|
366
|
-
// Tab into the field selects its text so typing replaces it. With
|
|
367
|
-
// `formatValue` the text at rest differs from the editable text, and putting
|
|
368
|
-
// the editable text in the input after focus collapses that selection to the
|
|
369
|
-
// end, so typing would append. When focus arrives with the text selected,
|
|
370
|
-
// select the swapped-in text too.
|
|
371
|
-
const reselectOnFocusRef = useRef(false);
|
|
372
366
|
const handleFocus = useCallback(e => {
|
|
373
|
-
const input = e.currentTarget;
|
|
374
|
-
// Only when focusing swaps the text: otherwise no render follows to
|
|
375
|
-
// consume the flag, and the first keystroke would.
|
|
376
|
-
const editableText = pendingInput ?? (value == null ? '' : formatEditableNumber(value, locale));
|
|
377
|
-
reselectOnFocusRef.current = input.value.length > 0 && input.value !== editableText && input.selectionStart === 0 && input.selectionEnd === input.value.length;
|
|
378
367
|
setIsFocused(true);
|
|
379
368
|
onFocus?.(e);
|
|
380
|
-
}, [onFocus
|
|
381
|
-
useLayoutEffect(() => {
|
|
382
|
-
if (!reselectOnFocusRef.current) {
|
|
383
|
-
return;
|
|
384
|
-
}
|
|
385
|
-
reselectOnFocusRef.current = false;
|
|
386
|
-
const input = inputRef.current;
|
|
387
|
-
if (input != null && input === document.activeElement) {
|
|
388
|
-
input.setSelectionRange(0, input.value.length);
|
|
389
|
-
}
|
|
390
|
-
}, [displayValue]);
|
|
369
|
+
}, [onFocus]);
|
|
391
370
|
const commitPendingInput = useCallback(trigger => {
|
|
392
371
|
if (pendingInput === null) {
|
|
393
372
|
return;
|
package/dist/astryx.css
CHANGED
|
@@ -1589,16 +1589,12 @@
|
|
|
1589
1589
|
.x92e2el:has(> [data-astryx-edge-comp]:last-child):not(#\#):not(#\#):not(#\#){margin-inline-end:var(--x-4drmnv)}
|
|
1590
1590
|
.x1kftj4p:has(> [data-astryx-edge-comp]:first-child):not(#\#):not(#\#):not(#\#){margin-inline-start:var(--x-126w13d)}
|
|
1591
1591
|
.x1uy843r:has(:focus-visible):not(#\#):not(#\#):not(#\#){outline-color:var(--focus-outline-color)}
|
|
1592
|
-
.x4jz7i8:has(> [role="combobox"]:focus-visible):not(#\#):not(#\#):not(#\#){outline-color:var(--focus-outline-color)}
|
|
1593
1592
|
.xobxmqy:has(> :first-child:focus-visible):not(#\#):not(#\#):not(#\#){outline-color:var(--focus-outline-color)}
|
|
1594
|
-
.x1fz9cfn:has(> [role="combobox"]:focus-visible):not(#\#):not(#\#):not(#\#){outline-offset:var(--focus-outline-offset)}
|
|
1595
1593
|
.x1jumodi:has(:focus-visible):not(#\#):not(#\#):not(#\#){outline-offset:var(--focus-outline-offset)}
|
|
1596
1594
|
.x2vr5qc:has(> :first-child:focus-visible):not(#\#):not(#\#):not(#\#){outline-offset:var(--focus-outline-offset)}
|
|
1597
|
-
.x151uj7h:has(> [role="combobox"]:focus-visible):not(#\#):not(#\#):not(#\#){outline-style:var(--focus-outline-style)}
|
|
1598
1595
|
.xciu248:has(:focus-visible):not(#\#):not(#\#):not(#\#){outline-style:var(--focus-outline-style)}
|
|
1599
1596
|
.xfd04fr:has(> :first-child:focus-visible):not(#\#):not(#\#):not(#\#){outline-style:var(--focus-outline-style)}
|
|
1600
1597
|
.x11j6mr8:has(:focus-visible):not(#\#):not(#\#):not(#\#){outline-width:var(--focus-outline-width)}
|
|
1601
|
-
.x1ufq04b:has(> [role="combobox"]:focus-visible):not(#\#):not(#\#):not(#\#){outline-width:var(--focus-outline-width)}
|
|
1602
1598
|
.xmmisi4:has(> :first-child:focus-visible):not(#\#):not(#\#):not(#\#){outline-width:var(--focus-outline-width)}
|
|
1603
1599
|
.xxdn8bs:has(> div > .astryx-layout-content):not(#\#):not(#\#):not(#\#){padding-inline-end:max(0px,calc((100% - var(--layout-content-width)) / 2))}
|
|
1604
1600
|
.xmnmr5y:has(.astryx-nav-icon):not(#\#):not(#\#):not(#\#){padding-inline-start:0}
|
|
@@ -69,15 +69,10 @@ export interface GestureArenaOptions {
|
|
|
69
69
|
/** Every recognizer transition, for debugging and tests. */
|
|
70
70
|
onTransition?: (recognizer: GestureRecognizer, from: GestureState, to: GestureState) => void;
|
|
71
71
|
}
|
|
72
|
-
/**
|
|
73
|
-
* The arena that decides which recognizer gets a touch.
|
|
74
|
-
*/
|
|
75
72
|
export declare class GestureArena {
|
|
76
73
|
readonly environment: GestureEnvironment;
|
|
77
74
|
private readonly clock;
|
|
78
75
|
private readonly options;
|
|
79
|
-
/** The touches whose move the arena is delivering right now. */
|
|
80
|
-
private movingIds;
|
|
81
76
|
private readonly records;
|
|
82
77
|
/** Recognizers involved in the current interaction, in resolution order. */
|
|
83
78
|
private active;
|
|
@@ -89,10 +84,6 @@ export declare class GestureArena {
|
|
|
89
84
|
/** The latest time processed: input never moves the clock backwards. */
|
|
90
85
|
private latestTime;
|
|
91
86
|
private depth;
|
|
92
|
-
/** Open `deferResolution` calls: what their stops unblock waits. */
|
|
93
|
-
private deferDepth;
|
|
94
|
-
/** A deferred stop left recognitions, held touches or resets to settle. */
|
|
95
|
-
private owesResolution;
|
|
96
87
|
constructor(options?: GestureArenaOptions);
|
|
97
88
|
/** The current time on the event clock. */
|
|
98
89
|
now(): number;
|
|
@@ -139,18 +130,6 @@ export declare class GestureArena {
|
|
|
139
130
|
/** @internal */
|
|
140
131
|
clearTimer(recognizer: GestureRecognizer): void;
|
|
141
132
|
/** Cancel an active recognizer, or fail a possible one. */
|
|
142
|
-
/**
|
|
143
|
-
* Runs `body`, code outside input that stops recognizers (an Effect that
|
|
144
|
-
* turns one off or detaches it), without resolving what those stops
|
|
145
|
-
* unblock: the recognitions waiting on them, the touches they held from a
|
|
146
|
-
* view, the resets. A pass a microtask later resolves all of it, at the
|
|
147
|
-
* last event's time, so the listeners and consumers it reaches hear it
|
|
148
|
-
* outside the caller's frame and read the recognized state
|
|
149
|
-
* (react-component-runtime INV2).
|
|
150
|
-
*/
|
|
151
|
-
deferResolution(body: () => void): void;
|
|
152
|
-
/** The last event's time, or now before any event. */
|
|
153
|
-
private lastEventTime;
|
|
154
133
|
stop(recognizer: GestureRecognizer): void;
|
|
155
134
|
private attemptRecognition;
|
|
156
135
|
/** Whether `winner` being recognized prevents `other`. */
|
|
@@ -162,11 +141,7 @@ export declare class GestureArena {
|
|
|
162
141
|
* A recognition that claimed its touches and then fails or is cancelled (a
|
|
163
142
|
* waiting recognition that fails, a gesture a second finger or the app
|
|
164
143
|
* cancels) gives them back to the browser unless another recognition owns
|
|
165
|
-
* them, so a finger still resting there can pinch-zoom the page.
|
|
166
|
-
* that cancels itself on a finger's move (a long press past its tolerance)
|
|
167
|
-
* keeps that finger until it lifts: the drag goes on, and the page never
|
|
168
|
-
* takes it over midway (`spec:AST-094` FR14), as UIKit's scroll view never
|
|
169
|
-
* takes a touch another recognizer had.
|
|
144
|
+
* them, so a finger still resting there can pinch-zoom the page.
|
|
170
145
|
*/
|
|
171
146
|
private releaseClaim;
|
|
172
147
|
private apply;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GestureArena.d.ts","sourceRoot":"","sources":["../../src/gestures/GestureArena.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAEH,OAAO,EAGL,KAAK,iBAAiB,EACvB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EACV,kBAAkB,EAElB,YAAY,EACZ,YAAY,EACZ,eAAe,EACf,aAAa,EACb,UAAU,EAEX,MAAM,SAAS,CAAC;AAGjB,MAAM,WAAW,YAAY;IAC3B,GAAG,IAAI,MAAM,CAAC;IACd,UAAU,CAAC,QAAQ,EAAE,MAAM,IAAI,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC;IACtD,YAAY,CAAC,MAAM,EAAE,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AAsE;IACtE,QAAQ,CACN,UAAU,EAAE,iBAAiB,EAC7B,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,IAAI,GACnB,IAAI;IAKP,gBAAgB;IAChB,UAAU,CAAC,UAAU,EAAE,iBAAiB,GAAG,IAAI;IAM/C,2DAA2D;IAC3D,IAAI,CAAC,UAAU,EAAE,iBAAiB,GAAG,IAAI;IAkBzC,OAAO,CAAC,kBAAkB;IA8D1B,0DAA0D;IAC1D,OAAO,CAAC,SAAS;IAUjB,+EAA+E;IAC/E,OAAO,CAAC,kBAAkB;IAU1B,OAAO,CAAC,IAAI;IAaZ;;;;;OAKG;IACH,OAAO,CAAC,YAAY;IAuBpB,OAAO,CAAC,KAAK;IAgBb;;;;OAIG;IACH,OAAO,CAAC,aAAa;IA0BrB,OAAO,CAAC,KAAK;IAyBb,OAAO,CAAC,gBAAgB;IAgBxB,qEAAqE;IACrE,OAAO,CAAC,UAAU;IAqClB,0DAA0D;IAC1D,OAAO,CAAC,UAAU;IAoClB,OAAO,CAAC,aAAa;IAUrB,OAAO,CAAC,WAAW;IAUnB,OAAO,CAAC,mBAAmB;IAW3B,OAAO,CAAC,UAAU;IAWlB,OAAO,CAAC,OAAO;IASf,OAAO,CAAC,WAAW;IAWnB,OAAO,CAAC,MAAM;IAyBd,OAAO,CAAC,SAAS;IAMjB;;;;;OAKG;IACH,OAAO,CAAC,GAAG;IAmBX,OAAO,CAAC,WAAW;IA+BnB,4EAA4E;IAC5E,OAAO,CAAC,IAAI;IAKZ,OAAO,CAAC,MAAM;IAoCd,OAAO,CAAC,iBAAiB;CAkC1B"}
|
|
@@ -56,12 +56,7 @@ export const browserClock = {
|
|
|
56
56
|
* be swallowed now and replayed if the recognizers holding it all fail.
|
|
57
57
|
*/
|
|
58
58
|
|
|
59
|
-
/**
|
|
60
|
-
* The arena that decides which recognizer gets a touch.
|
|
61
|
-
*/
|
|
62
59
|
export class GestureArena {
|
|
63
|
-
/** The touches whose move the arena is delivering right now. */
|
|
64
|
-
movingIds = new Set();
|
|
65
60
|
records = new Map();
|
|
66
61
|
/** Recognizers involved in the current interaction, in resolution order. */
|
|
67
62
|
active = [];
|
|
@@ -73,10 +68,6 @@ export class GestureArena {
|
|
|
73
68
|
/** The latest time processed: input never moves the clock backwards. */
|
|
74
69
|
latestTime = Number.NEGATIVE_INFINITY;
|
|
75
70
|
depth = 0;
|
|
76
|
-
/** Open `deferResolution` calls: what their stops unblock waits. */
|
|
77
|
-
deferDepth = 0;
|
|
78
|
-
/** A deferred stop left recognitions, held touches or resets to settle. */
|
|
79
|
-
owesResolution = false;
|
|
80
71
|
constructor(options = {}) {
|
|
81
72
|
this.options = options;
|
|
82
73
|
this.clock = options.clock ?? browserClock;
|
|
@@ -254,14 +245,8 @@ export class GestureArena {
|
|
|
254
245
|
return;
|
|
255
246
|
}
|
|
256
247
|
const context = this.context();
|
|
257
|
-
const
|
|
258
|
-
|
|
259
|
-
try {
|
|
260
|
-
for (const recognizer of [...this.active]) {
|
|
261
|
-
recognizer.deliverMoved(changed, context);
|
|
262
|
-
}
|
|
263
|
-
} finally {
|
|
264
|
-
this.movingIds = previous;
|
|
248
|
+
for (const recognizer of [...this.active]) {
|
|
249
|
+
recognizer.deliverMoved(changed, context);
|
|
265
250
|
}
|
|
266
251
|
for (const touch of changed) {
|
|
267
252
|
const record = this.records.get(touch.id);
|
|
@@ -406,39 +391,10 @@ export class GestureArena {
|
|
|
406
391
|
}
|
|
407
392
|
|
|
408
393
|
/** Cancel an active recognizer, or fail a possible one. */
|
|
409
|
-
/**
|
|
410
|
-
* Runs `body`, code outside input that stops recognizers (an Effect that
|
|
411
|
-
* turns one off or detaches it), without resolving what those stops
|
|
412
|
-
* unblock: the recognitions waiting on them, the touches they held from a
|
|
413
|
-
* view, the resets. A pass a microtask later resolves all of it, at the
|
|
414
|
-
* last event's time, so the listeners and consumers it reaches hear it
|
|
415
|
-
* outside the caller's frame and read the recognized state
|
|
416
|
-
* (react-component-runtime INV2).
|
|
417
|
-
*/
|
|
418
|
-
deferResolution(body) {
|
|
419
|
-
this.deferDepth += 1;
|
|
420
|
-
try {
|
|
421
|
-
body();
|
|
422
|
-
} finally {
|
|
423
|
-
this.deferDepth -= 1;
|
|
424
|
-
}
|
|
425
|
-
if (this.deferDepth === 0 && this.owesResolution) {
|
|
426
|
-
queueMicrotask(() => {
|
|
427
|
-
if (this.owesResolution && this.deferDepth === 0) {
|
|
428
|
-
this.run(this.lastEventTime(), () => {});
|
|
429
|
-
}
|
|
430
|
-
});
|
|
431
|
-
}
|
|
432
|
-
}
|
|
433
|
-
|
|
434
|
-
/** The last event's time, or now before any event. */
|
|
435
|
-
lastEventTime() {
|
|
436
|
-
return Number.isFinite(this.latestTime) ? this.latestTime : this.clock.now();
|
|
437
|
-
}
|
|
438
394
|
stop(recognizer) {
|
|
439
395
|
// A cancel from code between events happens at the last event's time:
|
|
440
396
|
// wall time would run deadlines ahead of input still queued (FR16).
|
|
441
|
-
const time = this.currentTime ?? this.
|
|
397
|
+
const time = this.currentTime ?? (Number.isFinite(this.latestTime) ? this.latestTime : this.clock.now());
|
|
442
398
|
this.run(time, () => {
|
|
443
399
|
if (isActive(recognizer.state)) {
|
|
444
400
|
this.apply(recognizer, 'cancelled');
|
|
@@ -531,11 +487,6 @@ export class GestureArena {
|
|
|
531
487
|
}
|
|
532
488
|
recognizer.pending = null;
|
|
533
489
|
this.apply(recognizer, 'failed');
|
|
534
|
-
if (this.deferDepth > 0) {
|
|
535
|
-
// Inside `deferResolution`, the next pass settles.
|
|
536
|
-
this.owesResolution = true;
|
|
537
|
-
return;
|
|
538
|
-
}
|
|
539
490
|
this.reviewPending();
|
|
540
491
|
}
|
|
541
492
|
|
|
@@ -543,16 +494,12 @@ export class GestureArena {
|
|
|
543
494
|
* A recognition that claimed its touches and then fails or is cancelled (a
|
|
544
495
|
* waiting recognition that fails, a gesture a second finger or the app
|
|
545
496
|
* cancels) gives them back to the browser unless another recognition owns
|
|
546
|
-
* them, so a finger still resting there can pinch-zoom the page.
|
|
547
|
-
* that cancels itself on a finger's move (a long press past its tolerance)
|
|
548
|
-
* keeps that finger until it lifts: the drag goes on, and the page never
|
|
549
|
-
* takes it over midway (`spec:AST-094` FR14), as UIKit's scroll view never
|
|
550
|
-
* takes a touch another recognizer had.
|
|
497
|
+
* them, so a finger still resting there can pinch-zoom the page.
|
|
551
498
|
*/
|
|
552
|
-
releaseClaim(recognizer
|
|
499
|
+
releaseClaim(recognizer) {
|
|
553
500
|
for (const touch of recognizer.trackedTouches) {
|
|
554
501
|
const record = this.records.get(touch.id);
|
|
555
|
-
if (record == null || !record.isClaimed
|
|
502
|
+
if (record == null || !record.isClaimed) {
|
|
556
503
|
continue;
|
|
557
504
|
}
|
|
558
505
|
// A recognized discrete gesture (`ended`, a swipe) still owns its
|
|
@@ -574,9 +521,7 @@ export class GestureArena {
|
|
|
574
521
|
if (isTerminal(next)) {
|
|
575
522
|
this.clearTimer(recognizer);
|
|
576
523
|
}
|
|
577
|
-
if (next === 'cancelled') {
|
|
578
|
-
this.releaseClaim(recognizer, this.movingIds);
|
|
579
|
-
} else if (next === 'failed') {
|
|
524
|
+
if (next === 'cancelled' || next === 'failed') {
|
|
580
525
|
this.releaseClaim(recognizer);
|
|
581
526
|
}
|
|
582
527
|
}
|
|
@@ -795,15 +740,9 @@ export class GestureArena {
|
|
|
795
740
|
this.currentTime = this.clampTime(time);
|
|
796
741
|
body();
|
|
797
742
|
// Re-entrant calls settle with the outermost one: settling mid-delivery
|
|
798
|
-
// would reset recognizers that have not heard the event yet.
|
|
799
|
-
// `deferResolution`, the next pass settles.
|
|
743
|
+
// would reset recognizers that have not heard the event yet.
|
|
800
744
|
if (this.depth === 1) {
|
|
801
|
-
|
|
802
|
-
this.owesResolution = true;
|
|
803
|
-
} else {
|
|
804
|
-
this.owesResolution = false;
|
|
805
|
-
this.settle();
|
|
806
|
-
}
|
|
745
|
+
this.settle();
|
|
807
746
|
}
|
|
808
747
|
} finally {
|
|
809
748
|
this.depth -= 1;
|
|
@@ -64,9 +64,7 @@ export type GestureTransitionListener<R> = (recognizer: R, from: GestureState, t
|
|
|
64
64
|
export declare function isTransitionAllowed(from: GestureState, to: GestureState): boolean;
|
|
65
65
|
export declare function isTerminal(state: GestureState): boolean;
|
|
66
66
|
export declare function isActive(state: GestureState): boolean;
|
|
67
|
-
/**
|
|
68
|
-
* The browser behaviors `touch-action` can keep or remove.
|
|
69
|
-
*/
|
|
67
|
+
/** The browser behaviors `touch-action` can keep or remove. */
|
|
70
68
|
export interface NativeTouchBehavior {
|
|
71
69
|
readonly panX: boolean;
|
|
72
70
|
readonly panY: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GestureRecognizer.d.ts","sourceRoot":"","sources":["../../src/gestures/GestureRecognizer.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AACjD,OAAO,KAAK,EACV,kBAAkB,EAClB,mBAAmB,EACnB,YAAY,EACZ,YAAY,EACZ,KAAK,EACL,WAAW,EACZ,MAAM,SAAS,CAAC;AAGjB,MAAM,WAAW,wBAAwB,CAAC,CAAC,GAAG,iBAAiB;IAC7D,4CAA4C;IAC5C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,qGAAqG;IACrG,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;;OAIG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,8EAA8E;IAC9E,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B;;;OAGG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,2FAA2F;IAC3F,mBAAmB,CAAC,EAAE,aAAa,CAAC,WAAW,CAAC,CAAC;IACjD,sFAAsF;IACtF,0BAA0B,CAAC,EAAE,OAAO,CAAC;IACrC,+EAA+E;IAC/E,WAAW,CAAC,EAAE,CAAC,UAAU,EAAE,CAAC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isActive(state) {
|
|
|
49
49
|
return state === 'began' || state === 'changed';
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
/**
|
|
53
|
-
* The browser behaviors `touch-action` can keep or remove.
|
|
54
|
-
*/
|
|
52
|
+
/** The browser behaviors `touch-action` can keep or remove. */
|
|
55
53
|
|
|
56
54
|
export const ALL_NATIVE_TOUCH = {
|
|
57
55
|
panX: true,
|
|
@@ -48,36 +48,6 @@ export interface AnimateOptions {
|
|
|
48
48
|
* changes nothing.
|
|
49
49
|
*/
|
|
50
50
|
crossfadeAs?: 'entrance' | 'exit';
|
|
51
|
-
/**
|
|
52
|
-
* When the call's animations start. By default a call from rest starts
|
|
53
|
-
* when the browser commits it, and a call that continues motion on screen
|
|
54
|
-
* (a retarget) starts now, from the value on screen. Ignored with `at`.
|
|
55
|
-
* - `'commit'`: a call that continues motion also starts when the browser
|
|
56
|
-
* commits it, dated by the browser rather than by the main thread, as a
|
|
57
|
-
* call from rest is.
|
|
58
|
-
* - `'presented'`: a call from rest leaves its element at rest and creates
|
|
59
|
-
* its animations two frames later, once the frame that carries the
|
|
60
|
-
* element at rest has been presented; they then start at their commit. A
|
|
61
|
-
* busy UI process delays the motion instead of skipping into it, for two
|
|
62
|
-
* frames more before an idle start. Any other change to the animator
|
|
63
|
-
* before then creates the animations first, in call order. A call that
|
|
64
|
-
* continues motion on screen (a retarget) starts now, as by default.
|
|
65
|
-
*/
|
|
66
|
-
start?: 'commit' | 'presented';
|
|
67
|
-
/**
|
|
68
|
-
* A call that retargets a curve on screen adds to it instead of replacing
|
|
69
|
-
* it, as UIKit's animations do: the old curve keeps going (past its end, at
|
|
70
|
-
* its target) and a spring of the difference between the two targets runs
|
|
71
|
-
* from 0 on top, in the same animation. Its value and velocity at the call
|
|
72
|
-
* are the old curve's, so whichever frame first shows it (WebKit can apply
|
|
73
|
-
* a new curve tens of ms late), nothing steps back. Ignored for a property
|
|
74
|
-
* at rest or still waiting for the browser's start, for a property given a
|
|
75
|
-
* velocity, and under Reduced Motion. Use it for a played curve that starts
|
|
76
|
-
* at rest (an eased reversal) while the property moves; a spring retarget
|
|
77
|
-
* on the same spring moves the same either way, and a curve that already
|
|
78
|
-
* continues the velocity on screen must not add to it.
|
|
79
|
-
*/
|
|
80
|
-
additive?: boolean;
|
|
81
51
|
}
|
|
82
52
|
/**
|
|
83
53
|
* Any closed-form curve to play on the compositor (`Animator.play`, and a
|
|
@@ -103,20 +73,6 @@ export interface MotionCurve {
|
|
|
103
73
|
/**
|
|
104
74
|
* Options of `createAnimator`.
|
|
105
75
|
*/
|
|
106
|
-
/** How `set` puts values in place. */
|
|
107
|
-
export interface SetOptions {
|
|
108
|
-
/**
|
|
109
|
-
* Whether the write promotes its channels to a compositing layer, as a
|
|
110
|
-
* drag's per-frame writes need so each is a composite only (default
|
|
111
|
-
* true). `false` writes the values and nothing else: a one-off switch that
|
|
112
|
-
* must not give its element a layer, such as a veil under a sticky header
|
|
113
|
-
* switched during a programmatic scroll (on iOS 26.2, a layer there blanks
|
|
114
|
-
* the header's painted items for about two frames). A channel another
|
|
115
|
-
* motion keeps promoted stays promoted, and a channel with other motion
|
|
116
|
-
* still running gets its animation's layer as usual.
|
|
117
|
-
*/
|
|
118
|
-
promote?: boolean;
|
|
119
|
-
}
|
|
120
76
|
export interface AnimatorOptions {
|
|
121
77
|
/**
|
|
122
78
|
* Animates a pseudo-element of the element instead (`'::backdrop'` of a
|
|
@@ -155,14 +111,6 @@ export interface MotionHandle {
|
|
|
155
111
|
value(property: MotionProperty, time?: number): number;
|
|
156
112
|
/** Presentation velocity of a property at `time`, units/s. */
|
|
157
113
|
velocity(property: MotionProperty, time?: number): number;
|
|
158
|
-
/**
|
|
159
|
-
* The curve this call started on `property` (`scale` reads `scaleX`),
|
|
160
|
-
* in seconds from the call's start: what the keyframes play. Null for a
|
|
161
|
-
* property the call does not move, or moves without travel (Reduced
|
|
162
|
-
* Motion). Map it onto a companion property with `mapProgress`, and play
|
|
163
|
-
* that on the same clock.
|
|
164
|
-
*/
|
|
165
|
-
curve(property: MotionProperty | 'scale'): MotionCurve | null;
|
|
166
114
|
/** New targets for this call's properties, keeping their velocity. */
|
|
167
115
|
retarget(to: MotionValues, transition?: SpringTransition, options?: AnimateOptions): MotionHandle;
|
|
168
116
|
/** Freezes this call's properties at their presentation values. */
|
|
@@ -198,7 +146,7 @@ export interface Animator {
|
|
|
198
146
|
* of a drag (one style write per channel, no animation when nothing else
|
|
199
147
|
* on the channel is moving).
|
|
200
148
|
*/
|
|
201
|
-
set(values: MotionValues
|
|
149
|
+
set(values: MotionValues): void;
|
|
202
150
|
/** Springs to `to` from the presentation values. */
|
|
203
151
|
animate(to: MotionValues, transition: SpringTransition, options?: AnimateOptions): MotionHandle;
|
|
204
152
|
/**
|
|
@@ -252,27 +200,11 @@ export declare const SETTLE_THRESHOLD: Record<MotionProperty, number>;
|
|
|
252
200
|
/**
|
|
253
201
|
* The keyframes hold the end state this long after a curve ends. An engine
|
|
254
202
|
* whose compositor ends an animation while the main thread is blocked falls
|
|
255
|
-
* back to the value its main thread last committed,
|
|
256
|
-
*
|
|
257
|
-
*
|
|
258
|
-
* animation as soon as it runs after the curve's end.
|
|
259
|
-
*
|
|
260
|
-
* Why a tail inside the curve's own animation, with a bound (measured Oct 24
|
|
261
|
-
* 2026; do not replace it without these proofs):
|
|
262
|
-
* - WebKit on Linux (WebKitGTK and WPE) ignores `fill` on its compositor:
|
|
263
|
-
* a 400 ms move that ends during a 1 s main-thread block snaps back to the
|
|
264
|
-
* block-start position 13 ms after its end, with `fill: forwards` or with
|
|
265
|
-
* no fill, and holds with this tail. iOS 26.2 Mobile Safari holds the end
|
|
266
|
-
* in all three forms, so there the tail is unneeded but harmless (measured
|
|
267
|
-
* Oct 25 2026). The browser proof "a spring that ends inside the block
|
|
268
|
-
* keeps showing its end state" catches it.
|
|
269
|
-
* - A separate static animation of the end state under the curve would hold
|
|
270
|
-
* it without a bound, but two animations on one property push Chromium to
|
|
271
|
-
* run the curve on the main thread: the 1 s block proof moved in 0 of 57
|
|
272
|
-
* frames, the start-before-a-block proof failed, and seeking the curve
|
|
273
|
-
* broke.
|
|
203
|
+
* back to the value its main thread last committed, mid-flight (WebKit); the
|
|
204
|
+
* hold keeps the end state on screen through such a block. The main thread
|
|
205
|
+
* drops the animation as soon as it runs after the curve's end.
|
|
274
206
|
*/
|
|
275
|
-
export declare const END_HOLD_MS =
|
|
207
|
+
export declare const END_HOLD_MS = 5000;
|
|
276
208
|
/** How long an element stays promoted after its last motion, ms. */
|
|
277
209
|
export declare const PROMOTION_LINGER_MS = 500;
|
|
278
210
|
/**
|
|
@@ -303,9 +235,8 @@ export declare function defaultIsCoarsePointer(): boolean;
|
|
|
303
235
|
* @example
|
|
304
236
|
* ```
|
|
305
237
|
* const animator = createAnimator(sheet);
|
|
306
|
-
* // finger lifts at 1200 px/s heading for the detent at 0
|
|
307
|
-
*
|
|
308
|
-
* animator.animate({y: 0}, {spring: {response: 0.45, dampingRatio: 0.9}, velocity: {y: 1200}});
|
|
238
|
+
* // finger lifts at 1200 px/s heading for the detent at 0:
|
|
239
|
+
* animator.animate({y: 0}, {spring: springs.sheetDetent, velocity: {y: 1200}});
|
|
309
240
|
* // the finger lands again: where is it right now?
|
|
310
241
|
* const y = animator.get('y', event.timeStamp);
|
|
311
242
|
* animator.stop(['y']);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"animator.d.ts","sourceRoot":"","sources":["../../src/motion/animator.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"animator.d.ts","sourceRoot":"","sources":["../../src/motion/animator.ts"],"names":[],"mappings":"AAqJA,OAAO,EAAwB,KAAK,iBAAiB,EAAC,MAAM,UAAU,CAAC;AAIvE;;GAEG;AACH,MAAM,MAAM,cAAc,GACxB,GAAG,GAAG,GAAG,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,CAAC;AAEzD;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,OAAO,CAA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