@sessile/presets 0.3.0 → 0.3.1
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/popover.d.ts +2 -0
- package/dist/popover.js +11 -5
- package/package.json +2 -2
package/dist/popover.d.ts
CHANGED
|
@@ -159,6 +159,8 @@ export interface PopoverMorphController {
|
|
|
159
159
|
/** Default timing, geometry, and spring constants for morphing popovers and menus. */
|
|
160
160
|
export declare const POPOVER_MORPH_DEFAULTS: {
|
|
161
161
|
readonly openDurationSec: 0.45;
|
|
162
|
+
/** Normalized time at which the opening springs start landing on the resting `open` state. */
|
|
163
|
+
readonly openLandingStart: 0.7;
|
|
162
164
|
readonly closeDurationSec: 0.5;
|
|
163
165
|
readonly pointCloseDurationSec: 0.2;
|
|
164
166
|
readonly reducedMotionDurationSec: 0.15;
|
package/dist/popover.js
CHANGED
|
@@ -11,6 +11,8 @@ import { DEFAULT_SPRINGS, clamp, computePairMergeStatus, cubicBezier, easeInOutC
|
|
|
11
11
|
/** Default timing, geometry, and spring constants for morphing popovers and menus. */
|
|
12
12
|
export const POPOVER_MORPH_DEFAULTS = {
|
|
13
13
|
openDurationSec: 0.45,
|
|
14
|
+
/** Normalized time at which the opening springs start landing on the resting `open` state. */
|
|
15
|
+
openLandingStart: 0.7,
|
|
14
16
|
closeDurationSec: 0.5,
|
|
15
17
|
pointCloseDurationSec: 0.2,
|
|
16
18
|
reducedMotionDurationSec: 0.15,
|
|
@@ -314,16 +316,20 @@ export function evaluatePopoverMotion(phase, normalizedT, options = {}) {
|
|
|
314
316
|
reducedMotion: true,
|
|
315
317
|
};
|
|
316
318
|
}
|
|
317
|
-
|
|
319
|
+
// The springs still ring at `openDurationSec` (corners about 1.3px short on a 360px panel),
|
|
320
|
+
// so their residuals fade out over the tail: the last opening frame is the `open` state and
|
|
321
|
+
// the hand-off to the resting surface has no step.
|
|
322
|
+
const landing = 1 - smoothstep(POPOVER_MORPH_DEFAULTS.openLandingStart, 1, u);
|
|
323
|
+
const morphProgress = lerp(1, evaluateSpring(elapsedSec, POPOVER_MORPH_DEFAULTS.springs.open), landing);
|
|
318
324
|
const cornerDelay = POPOVER_MORPH_DEFAULTS.cornerDelaySec;
|
|
319
325
|
const cornerProgress = elapsedSec <= cornerDelay
|
|
320
326
|
? 1
|
|
321
|
-
: 1 - evaluateSpring(elapsedSec - cornerDelay, POPOVER_MORPH_DEFAULTS.springs.corners);
|
|
327
|
+
: lerp(0, 1 - evaluateSpring(elapsedSec - cornerDelay, POPOVER_MORPH_DEFAULTS.springs.corners), landing);
|
|
322
328
|
const platterDipEnvelope = hasControlSource
|
|
323
|
-
? riseAndFall(elapsedSec, POPOVER_MORPH_DEFAULTS.openDipPeakSec, POPOVER_MORPH_DEFAULTS.openDipSharpness)
|
|
329
|
+
? lerp(0, riseAndFall(elapsedSec, POPOVER_MORPH_DEFAULTS.openDipPeakSec, POPOVER_MORPH_DEFAULTS.openDipSharpness), landing)
|
|
324
330
|
: 0;
|
|
325
|
-
const blurBumpPx = POPOVER_MORPH_DEFAULTS.openBlurBumpAmpPx *
|
|
326
|
-
riseAndFall(elapsedSec, POPOVER_MORPH_DEFAULTS.openBlurBumpPeakSec, POPOVER_MORPH_DEFAULTS.openBlurBumpSharpness);
|
|
331
|
+
const blurBumpPx = lerp(0, POPOVER_MORPH_DEFAULTS.openBlurBumpAmpPx *
|
|
332
|
+
riseAndFall(elapsedSec, POPOVER_MORPH_DEFAULTS.openBlurBumpPeakSec, POPOVER_MORPH_DEFAULTS.openBlurBumpSharpness), landing);
|
|
327
333
|
const settled = clamp(morphProgress, 0, 1);
|
|
328
334
|
const glyphT = clamp(settled / POPOVER_MORPH_DEFAULTS.openSettledGlyphEnd, 0, 1);
|
|
329
335
|
const normalContentBlurPx = Math.hypot(POPOVER_MORPH_DEFAULTS.openContentBlurBasePx * (1 - settled), blurBumpPx);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sessile/presets",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MPL-2.0",
|
|
6
6
|
"description": "Optional interaction presets (morphing menu, segmented pill, drag-merge) built on Sessile.",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"access": "public"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@sessile/core": "0.3.
|
|
29
|
+
"@sessile/core": "0.3.1"
|
|
30
30
|
},
|
|
31
31
|
"scripts": {
|
|
32
32
|
"typecheck": "tsc -p tsconfig.json --noEmit && tsc -p tsconfig.test.json --noEmit",
|