@jsenv/dom 0.17.42 → 0.17.44
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/jsenv_dom.js +50 -66
- package/package.json +1 -1
package/dist/jsenv_dom.js
CHANGED
|
@@ -14170,24 +14170,6 @@ const WHEEL_FADE_RUN = 2;
|
|
|
14170
14170
|
// but to the hand these are two gestures, and the second is answered like a
|
|
14171
14171
|
// first event: with a screen, now, not with credit towards one.
|
|
14172
14172
|
const WHEEL_REGROW_RUN = 2;
|
|
14173
|
-
// A hand scrolling the OTHER axis over that same tail is a new gesture too,
|
|
14174
|
-
// and one that is not ours — but it has to be told apart from the tail's own
|
|
14175
|
-
// wobble: at the end of a fade the deltas are a pixel or two on each axis, and
|
|
14176
|
-
// read alone such an event says "the other axis" as easily as it says nothing.
|
|
14177
|
-
// Three things separate a scroll from those crumbs, and all three are asked
|
|
14178
|
-
// for before an event is handed back:
|
|
14179
|
-
// - the other axis clearly dominates the event (the same bar a drag uses to
|
|
14180
|
-
// give up its press) — a diagonal crumb says nothing;
|
|
14181
|
-
// - the event is the size of a hand (WHEEL_CROSS_CONFIRM_DELTA — crumbs never
|
|
14182
|
-
// reach it), or the run is GROWING event over event, which is a scroll
|
|
14183
|
-
// ramping up from rest and never what decay looks like;
|
|
14184
|
-
// - and it is a RUN (one more event for the growing read, which starts from
|
|
14185
|
-
// sizes a crumb also has): wobble is isolated, a scroll insists.
|
|
14186
|
-
// What the run costs a real scroll is its first event or two — a few pixels,
|
|
14187
|
-
// one notch of a stepped wheel; what it saves a slide is its own scroller
|
|
14188
|
-
// creeping under a travel, a header detaching from the edge of the box.
|
|
14189
|
-
const WHEEL_CROSS_RUN = 2;
|
|
14190
|
-
const WHEEL_CROSS_CONFIRM_DELTA = 10;
|
|
14191
14173
|
|
|
14192
14174
|
/**
|
|
14193
14175
|
* A travel asked for with a wheel, and it asks for a WHOLE ONE.
|
|
@@ -14333,65 +14315,39 @@ const watchWheelTravel = (element, {
|
|
|
14333
14315
|
lastMagnitude: 0,
|
|
14334
14316
|
fadeRun: 0,
|
|
14335
14317
|
growRun: 0,
|
|
14336
|
-
crossRun: 0,
|
|
14337
|
-
crossMagnitude: 0,
|
|
14338
|
-
crossHandedBack: false,
|
|
14339
14318
|
faded: false,
|
|
14340
14319
|
stepped: false
|
|
14341
14320
|
};
|
|
14342
14321
|
document.documentElement.setAttribute(GESTURE_ATTRIBUTE, "");
|
|
14343
14322
|
document.documentElement.setAttribute(WALKING_ATTRIBUTE, axis);
|
|
14344
14323
|
}
|
|
14345
|
-
// The other axis, on a stream that is momentum only: a hand is never
|
|
14346
|
-
// perfectly straight, so cross-axis events WITHIN a push are the push's own
|
|
14347
|
-
// wobble and are swallowed below — but once our axis has faded to a tail,
|
|
14348
|
-
// a hand pushing the other way is a NEW gesture, and on an axis this box
|
|
14349
|
-
// does not travel it is not ours at all: it belongs to whatever scrolls
|
|
14350
|
-
// under the pointer, and it is handed back untouched. Not swallowed, and
|
|
14351
|
-
// not renewing the claim either — an ignored scroll must not keep alive
|
|
14352
|
-
// the very gesture that ignores it, while the tail of ours goes on being
|
|
14353
|
-
// absorbed by the events still on our axis. Only a scroll is handed back,
|
|
14354
|
-
// though, never the tail's own wobble — see WHEEL_CROSS_RUN.
|
|
14355
|
-
if (axis !== gesture.axis && gesture.faded && !axes.includes(axis)) {
|
|
14356
|
-
if (gesture.crossHandedBack) {
|
|
14357
|
-
// Already recognized as a scroll: the whole rest of it is its own.
|
|
14358
|
-
return;
|
|
14359
|
-
}
|
|
14360
|
-
const ownDelta = Math.abs(gesture.axis === "x" ? wheelEvent.deltaX : wheelEvent.deltaY);
|
|
14361
|
-
const crossDelta = Math.abs(delta);
|
|
14362
|
-
const dominant = crossDelta > ownDelta * AXIS_CROSS_DOMINANCE;
|
|
14363
|
-
const handSized = crossDelta >= WHEEL_CROSS_CONFIRM_DELTA;
|
|
14364
|
-
const growing = crossDelta > gesture.crossMagnitude;
|
|
14365
|
-
if (dominant && (handSized || growing)) {
|
|
14366
|
-
gesture.crossRun += 1;
|
|
14367
|
-
gesture.crossMagnitude = crossDelta;
|
|
14368
|
-
if (gesture.crossRun >= (handSized ? WHEEL_CROSS_RUN : WHEEL_CROSS_RUN + 1)) {
|
|
14369
|
-
gesture.crossHandedBack = true;
|
|
14370
|
-
return;
|
|
14371
|
-
}
|
|
14372
|
-
} else {
|
|
14373
|
-
gesture.crossRun = 0;
|
|
14374
|
-
gesture.crossMagnitude = 0;
|
|
14375
|
-
}
|
|
14376
|
-
}
|
|
14377
14324
|
// Ours from here, on both axes: what the browser would do with the leftover
|
|
14378
14325
|
// — scroll the page behind the box, bounce it, go back in history — is one
|
|
14379
|
-
// gesture answered twice.
|
|
14326
|
+
// gesture answered twice. On the other axis that swallowing is absolute —
|
|
14327
|
+
// there is no per-event reading that tells a scroll's onset from the
|
|
14328
|
+
// tail's own wobble (end-of-fade crumbs land on either axis, and a
|
|
14329
|
+
// diagonal swipe's tail carries hand-sized deltas on both), and a crumb
|
|
14330
|
+
// let through scrolls the slide's own content under the travel, a header
|
|
14331
|
+
// creeping off the edge of the box.
|
|
14380
14332
|
wheelEvent.preventDefault();
|
|
14381
|
-
// …and said on every event of it, because a claim nobody renews is a
|
|
14382
|
-
// gesture that is over: silence is the only end a wheel has.
|
|
14383
|
-
claimWheelGesture(element, {
|
|
14384
|
-
onEnd: forgetGesture
|
|
14385
|
-
});
|
|
14386
14333
|
if (axis !== gesture.axis) {
|
|
14387
14334
|
// The other axis mid-gesture: a hand is never perfectly straight, and the
|
|
14388
|
-
// axis was decided when the gesture set off.
|
|
14335
|
+
// axis was decided when the gesture set off. Swallowed, but NOT renewing
|
|
14336
|
+
// the claim below: silence is the only end a wheel gesture has, and it
|
|
14337
|
+
// is silence ON ITS AXIS. Renewed by what it eats, the gesture would
|
|
14338
|
+
// outlive its own stream — a hand starting a scroll over the tail would
|
|
14339
|
+
// extend, event by event, the very deadness it is waiting out. Left to
|
|
14340
|
+
// lapse, the claim dies shortly after our axis goes quiet (and on a
|
|
14341
|
+
// system where touching the surface kills the old momentum, that is
|
|
14342
|
+
// moments after the new scroll begins) — the browser then answers the
|
|
14343
|
+
// rest of the scroll itself.
|
|
14389
14344
|
return;
|
|
14390
14345
|
}
|
|
14391
|
-
//
|
|
14392
|
-
gesture
|
|
14393
|
-
|
|
14394
|
-
|
|
14346
|
+
// …and said on every event on our axis, because a claim nobody renews is a
|
|
14347
|
+
// gesture that is over.
|
|
14348
|
+
claimWheelGesture(element, {
|
|
14349
|
+
onEnd: forgetGesture
|
|
14350
|
+
});
|
|
14395
14351
|
if (sign !== gesture.sign) {
|
|
14396
14352
|
// Turned around: what was adding up was going the other way.
|
|
14397
14353
|
gesture.sign = sign;
|
|
@@ -15273,6 +15229,22 @@ const getVisibleViewportRect = () => {
|
|
|
15273
15229
|
};
|
|
15274
15230
|
};
|
|
15275
15231
|
|
|
15232
|
+
// The window is not always all the app's: an app simulating a narrower
|
|
15233
|
+
// screen (say a 600px column centered in a wide window) wants everything
|
|
15234
|
+
// pickPositionRelativeTo places against the viewport — dialogs, popovers,
|
|
15235
|
+
// side panels — kept to its own rectangle rather than the window's. The
|
|
15236
|
+
// embedder declares that rectangle here, as insets from the window's edges
|
|
15237
|
+
// ({ left, top, right, bottom } in px — see @jsenv/navi's
|
|
15238
|
+
// --navi-app-inset-*, the CSS twin of this). A callback rather than a
|
|
15239
|
+
// value so it stays live without a subscription; read on each placement.
|
|
15240
|
+
// Placement only: visibleRectEffect keeps reading the real viewport —
|
|
15241
|
+
// whether something is on screen is a fact about the window, not about
|
|
15242
|
+
// the rectangle an app confines itself to.
|
|
15243
|
+
let getPlacementViewportInsets = null;
|
|
15244
|
+
const setPlacementViewportInsets = (getInsets) => {
|
|
15245
|
+
getPlacementViewportInsets = getInsets;
|
|
15246
|
+
};
|
|
15247
|
+
|
|
15276
15248
|
const isEditableElement = (element) => {
|
|
15277
15249
|
if (!element) {
|
|
15278
15250
|
return false;
|
|
@@ -16312,12 +16284,24 @@ const pickPositionRelativeTo = (
|
|
|
16312
16284
|
} = {},
|
|
16313
16285
|
) => {
|
|
16314
16286
|
// Needed before hasValidAnchor below.
|
|
16315
|
-
|
|
16287
|
+
let {
|
|
16316
16288
|
left: viewportLeft,
|
|
16317
16289
|
top: viewportTop,
|
|
16318
16290
|
width: viewportWidth,
|
|
16319
16291
|
height: viewportHeight,
|
|
16320
16292
|
} = getVisibleViewportRect();
|
|
16293
|
+
// Narrowed to the embedder's own rectangle (see setPlacementViewportInsets)
|
|
16294
|
+
// before anything reads it: the available area, the flip decisions, the
|
|
16295
|
+
// clamps and the viewport-as-anchor rect below all follow, so an element
|
|
16296
|
+
// docked to an edge lands flush against the app's edge rather than the
|
|
16297
|
+
// window's.
|
|
16298
|
+
if (getPlacementViewportInsets) {
|
|
16299
|
+
const placementInsets = getPlacementViewportInsets();
|
|
16300
|
+
viewportLeft += placementInsets.left;
|
|
16301
|
+
viewportTop += placementInsets.top;
|
|
16302
|
+
viewportWidth -= placementInsets.left + placementInsets.right;
|
|
16303
|
+
viewportHeight -= placementInsets.top + placementInsets.bottom;
|
|
16304
|
+
}
|
|
16321
16305
|
|
|
16322
16306
|
// Resolved early: everything below that would otherwise reach for
|
|
16323
16307
|
// viewportLeft/Top/Width/Height instead uses these, so a "local" popover
|
|
@@ -20378,4 +20362,4 @@ const useResizeStatus = (elementRef, { as = "number" } = {}) => {
|
|
|
20378
20362
|
};
|
|
20379
20363
|
};
|
|
20380
20364
|
|
|
20381
|
-
export { EASING, ELEMENT_SIZE_CHANGE, activeElementSignal, addActiveElementEffect, addAttributeEffect, allowWheelThrough, appendStyles, applyNewPosition, canScroll, captureScrollState, chainEvent, claimWheelGesture, clickIsSuppressed, closestOpenableAncestor, contrastColor, createBackgroundColorTransition, createBackgroundTransition, createBorderRadiusTransition, createBorderTransition, createDragGestureController, createDragToMoveGestureController, createEventGroupLogger, createGroupTransitionController, createHeightTransition, createIterableWeakSet, createOpacityTransition, createPubSub, createStyleController, createTimelineTransition, createTransition, createTranslateXTransition, createValueEffect, createWidthTransition, cubicBezier, dispatchCustomEvent, dispatchInternalCustomEvent, dispatchPublicCustomEvent, dragAfterIntent, elementIsFocusable, elementIsVisibleForFocus, elementIsVisuallyVisible, findAfter, findAncestor, findBefore, findDescendant, findEvent, findFocusDelegateTarget, findFocusable, findSelfOrAncestorFixedPosition, formatEventSideEffect, getAncestorOpenType, getAvailableHeight, getAvailableWidth, getBackground, getBackgroundColor, getBorder, getBorderRadius, getBorderSizes, getContrastRatio, getDefaultStyles, getDragCoordinates, getDropTargetInfo, getElementSignature, getFirstVisuallyVisibleAncestor, getFocusVisibilityInfo, getHeight, getHeightWithoutTransition, getInnerHeight, getInnerWidth, getKeyboardEventDefaultAction, getLuminance, getMarginSizes, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getOpacity, getOpacityWithoutTransition, getPaddingSizes, getPositionedParent, getPositioningScrollOffset, getPreferedColorScheme, getScrollBox, getScrollContainer, getScrollContainerSet, getScrollIntoViewScopedOffsets, getScrollRelativeRect, getSelfAndAncestorScrolls, getStyle, getTranslateX, getTranslateXWithoutTransition, getTranslateY, getVirtualKeyboardOverlayHeight, getVisuallyVisibleInfo, getWidth, getWidthWithoutTransition, hasCSSSizeUnit, initFlexDetailsSet, initFocusGroup, initPositionSticky, isAncestorOpen, isDisplayedDespiteClosedAncestor, isPressDisputedByDrag, isPrimaryButtonEvent, isSameColor, isScrollable, isTouchDrivenEvent, keepTouchRefusable, markDragSource, measureLongestVisualLineWidth, measureScrollbar, measureWidestChildRow, mergeOneStyle, mergeTwoStyles, normalizeKeyboardKey, normalizeStyle, normalizeStyles, observeAncestorOpenState, onAncestorReopen, parsePositionArea, parseStyle, performTabNavigation, pickPositionRelativeTo, prefersDarkColors, prefersLightColors, preventFocusNav, preventFocusNavViaKeyboard, preventIntermediateScrollbar, releaseWheelGesture, resolveCSSColor, resolveCSSSize, resolveColorLuminance, resolveOklchLightness, scrollIntoViewScoped, scrollIntoViewThroughScrollables, scrollIntoViewWithStickyAwareness, scrollRoomTowards, setAttribute, setAttributes, setStyles, setVirtualKeyboardOverlaysContent, snapToPixel, startDragTo, startDragToResizeGesture, startDragToTravel, stickyAsRelativeCoords, stringifyStyle, subscribeVirtualKeyboardGeometryChange, subscribeVisualViewportResizeSettled, subscribeWindowResizeSettled, suppressClickAfterGesture, trapFocusInside, trapScrollInside, useActiveElement, useAvailableHeight, useAvailableWidth, useMaxHeight, useMaxWidth, useResizeStatus, visibleRectEffect, waitForPressHeld, watchWheelTravel, wheelGestureIsTakenFrom };
|
|
20365
|
+
export { EASING, ELEMENT_SIZE_CHANGE, activeElementSignal, addActiveElementEffect, addAttributeEffect, allowWheelThrough, appendStyles, applyNewPosition, canScroll, captureScrollState, chainEvent, claimWheelGesture, clickIsSuppressed, closestOpenableAncestor, contrastColor, createBackgroundColorTransition, createBackgroundTransition, createBorderRadiusTransition, createBorderTransition, createDragGestureController, createDragToMoveGestureController, createEventGroupLogger, createGroupTransitionController, createHeightTransition, createIterableWeakSet, createOpacityTransition, createPubSub, createStyleController, createTimelineTransition, createTransition, createTranslateXTransition, createValueEffect, createWidthTransition, cubicBezier, dispatchCustomEvent, dispatchInternalCustomEvent, dispatchPublicCustomEvent, dragAfterIntent, elementIsFocusable, elementIsVisibleForFocus, elementIsVisuallyVisible, findAfter, findAncestor, findBefore, findDescendant, findEvent, findFocusDelegateTarget, findFocusable, findSelfOrAncestorFixedPosition, formatEventSideEffect, getAncestorOpenType, getAvailableHeight, getAvailableWidth, getBackground, getBackgroundColor, getBorder, getBorderRadius, getBorderSizes, getContrastRatio, getDefaultStyles, getDragCoordinates, getDropTargetInfo, getElementSignature, getFirstVisuallyVisibleAncestor, getFocusVisibilityInfo, getHeight, getHeightWithoutTransition, getInnerHeight, getInnerWidth, getKeyboardEventDefaultAction, getLuminance, getMarginSizes, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getOpacity, getOpacityWithoutTransition, getPaddingSizes, getPositionedParent, getPositioningScrollOffset, getPreferedColorScheme, getScrollBox, getScrollContainer, getScrollContainerSet, getScrollIntoViewScopedOffsets, getScrollRelativeRect, getSelfAndAncestorScrolls, getStyle, getTranslateX, getTranslateXWithoutTransition, getTranslateY, getVirtualKeyboardOverlayHeight, getVisuallyVisibleInfo, getWidth, getWidthWithoutTransition, hasCSSSizeUnit, initFlexDetailsSet, initFocusGroup, initPositionSticky, isAncestorOpen, isDisplayedDespiteClosedAncestor, isPressDisputedByDrag, isPrimaryButtonEvent, isSameColor, isScrollable, isTouchDrivenEvent, keepTouchRefusable, markDragSource, measureLongestVisualLineWidth, measureScrollbar, measureWidestChildRow, mergeOneStyle, mergeTwoStyles, normalizeKeyboardKey, normalizeStyle, normalizeStyles, observeAncestorOpenState, onAncestorReopen, parsePositionArea, parseStyle, performTabNavigation, pickPositionRelativeTo, prefersDarkColors, prefersLightColors, preventFocusNav, preventFocusNavViaKeyboard, preventIntermediateScrollbar, releaseWheelGesture, resolveCSSColor, resolveCSSSize, resolveColorLuminance, resolveOklchLightness, scrollIntoViewScoped, scrollIntoViewThroughScrollables, scrollIntoViewWithStickyAwareness, scrollRoomTowards, setAttribute, setAttributes, setPlacementViewportInsets, setStyles, setVirtualKeyboardOverlaysContent, snapToPixel, startDragTo, startDragToResizeGesture, startDragToTravel, stickyAsRelativeCoords, stringifyStyle, subscribeVirtualKeyboardGeometryChange, subscribeVisualViewportResizeSettled, subscribeWindowResizeSettled, suppressClickAfterGesture, trapFocusInside, trapScrollInside, useActiveElement, useAvailableHeight, useAvailableWidth, useMaxHeight, useMaxWidth, useResizeStatus, visibleRectEffect, waitForPressHeld, watchWheelTravel, wheelGestureIsTakenFrom };
|