@jsenv/dom 0.17.35 → 0.17.37
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 +56 -24
- package/package.json +1 -1
package/dist/jsenv_dom.js
CHANGED
|
@@ -7524,6 +7524,29 @@ const getScrollbarState = (
|
|
|
7524
7524
|
* @param {"start"|"center"|"end"|"nearest"} [options.inline="nearest"] - Horizontal alignment.
|
|
7525
7525
|
*/
|
|
7526
7526
|
const scrollIntoViewScoped = (
|
|
7527
|
+
el,
|
|
7528
|
+
{ container = getScrollContainer(el), ...rest } = {},
|
|
7529
|
+
) => {
|
|
7530
|
+
if (!container) {
|
|
7531
|
+
return;
|
|
7532
|
+
}
|
|
7533
|
+
container.scrollTo(
|
|
7534
|
+
getScrollIntoViewScopedOffsets(el, { container, ...rest }),
|
|
7535
|
+
);
|
|
7536
|
+
};
|
|
7537
|
+
|
|
7538
|
+
/**
|
|
7539
|
+
* Where the container would have to be scrolled for `el` to be in view — the
|
|
7540
|
+
* measure scrollIntoViewScoped acts on, handed out on its own for whoever must
|
|
7541
|
+
* stand BETWEEN two such answers rather than land on one: a row of tabs
|
|
7542
|
+
* scrolled the same fraction of the way as the slides it names are travelling
|
|
7543
|
+
* (see navi's <Nav>).
|
|
7544
|
+
*
|
|
7545
|
+
* @param {Element} el
|
|
7546
|
+
* @param {object} options - the same as scrollIntoViewScoped's.
|
|
7547
|
+
* @returns {{left: number, top: number}}
|
|
7548
|
+
*/
|
|
7549
|
+
const getScrollIntoViewScopedOffsets = (
|
|
7527
7550
|
el,
|
|
7528
7551
|
{
|
|
7529
7552
|
container = getScrollContainer(el),
|
|
@@ -7531,10 +7554,6 @@ const scrollIntoViewScoped = (
|
|
|
7531
7554
|
inline = "nearest",
|
|
7532
7555
|
} = {},
|
|
7533
7556
|
) => {
|
|
7534
|
-
if (!container) {
|
|
7535
|
-
return;
|
|
7536
|
-
}
|
|
7537
|
-
|
|
7538
7557
|
const containerRect = container.getBoundingClientRect();
|
|
7539
7558
|
const elRect = el.getBoundingClientRect();
|
|
7540
7559
|
const style = getComputedStyle(el);
|
|
@@ -7609,10 +7628,10 @@ const scrollIntoViewScoped = (
|
|
|
7609
7628
|
}
|
|
7610
7629
|
}
|
|
7611
7630
|
|
|
7612
|
-
|
|
7631
|
+
return {
|
|
7613
7632
|
left: newScrollLeft,
|
|
7614
7633
|
top: newScrollTop,
|
|
7615
|
-
}
|
|
7634
|
+
};
|
|
7616
7635
|
};
|
|
7617
7636
|
|
|
7618
7637
|
/**
|
|
@@ -9482,7 +9501,7 @@ const css$4 = /* css */`[data-drag-handle], [data-drag-source] {
|
|
|
9482
9501
|
touch-action: pinch-zoom;
|
|
9483
9502
|
}
|
|
9484
9503
|
|
|
9485
|
-
[data-drag-ignore], [data-
|
|
9504
|
+
[data-drag-ignore], [data-self-interactions~="drag"], [data-self-interactions~="*"], [data-drag-source] [popover], [data-drag-source] dialog {
|
|
9486
9505
|
-webkit-touch-callout: default;
|
|
9487
9506
|
touch-action: auto;
|
|
9488
9507
|
}
|
|
@@ -11881,7 +11900,7 @@ const css$1 = /* css */`.navi_drop_hint {
|
|
|
11881
11900
|
cursor: default;
|
|
11882
11901
|
}
|
|
11883
11902
|
|
|
11884
|
-
[data-drag-ignore], [data-
|
|
11903
|
+
[data-drag-ignore], [data-self-interactions~="drag"], [data-self-interactions~="*"], [data-drag-source] [popover], [data-drag-source] dialog {
|
|
11885
11904
|
cursor: auto;
|
|
11886
11905
|
}
|
|
11887
11906
|
|
|
@@ -11946,15 +11965,19 @@ import.meta.css = [css$1, "@jsenv/dom/src/interaction/drag/drag_to.js"];
|
|
|
11946
11965
|
|
|
11947
11966
|
// What a press must not be read from at all. `data-drag-ignore` is said by
|
|
11948
11967
|
// something whose press is its own business — a text one wants to select, a
|
|
11949
|
-
// control that reads the pointer itself
|
|
11950
|
-
//
|
|
11951
|
-
//
|
|
11952
|
-
//
|
|
11953
|
-
//
|
|
11954
|
-
//
|
|
11955
|
-
//
|
|
11956
|
-
//
|
|
11957
|
-
|
|
11968
|
+
// control that reads the pointer itself — and it means every gesture at once.
|
|
11969
|
+
// `data-self-interactions` says a narrower thing, and says which: an element
|
|
11970
|
+
// declaring the interactions that are ITS own, whatever it happens to sit
|
|
11971
|
+
// inside, the rest being left to what it sits in. Only the ones naming `drag`
|
|
11972
|
+
// take the grab away from the surface (see also DRAG_EXCLUDED_SELECTOR in
|
|
11973
|
+
// drag_to_travel.js) — an affordance that took the click alone is one a finger
|
|
11974
|
+
// may still pick the object up by, which is what it is for when it covers a real
|
|
11975
|
+
// part of that object. A popover or a dialog says it without being asked: it is
|
|
11976
|
+
// a layer OVER the surface, so a press in it is aimed at the layer — yet it
|
|
11977
|
+
// stays a descendant of whatever it is anchored in (a callout next to a button,
|
|
11978
|
+
// in the card that carries both), and the press bubbles through the surface as
|
|
11979
|
+
// if it had landed on it.
|
|
11980
|
+
const DRAG_IGNORED_SELECTOR = '[data-drag-ignore],[data-self-interactions~="drag"],[data-self-interactions~="*"],[popover],dialog';
|
|
11958
11981
|
|
|
11959
11982
|
/**
|
|
11960
11983
|
* Starts a drag-to-reorder interaction on a list item.
|
|
@@ -13403,12 +13426,21 @@ const DRAG_RESISTANCE = 0.3;
|
|
|
13403
13426
|
// out. A drag SOURCE is not either: it says which way it goes and only takes
|
|
13404
13427
|
// that (see DRAG_SOURCE_AXES_ATTRIBUTE) — but a dedicated handle is, being a
|
|
13405
13428
|
// place whose only purpose is to be taken hold of, from the first pixel. And so
|
|
13406
|
-
// is an
|
|
13407
|
-
//
|
|
13408
|
-
//
|
|
13409
|
-
// dialog: a layer OVER the box, whose
|
|
13410
|
-
// the layer is anchored in it.
|
|
13411
|
-
const DRAG_EXCLUDED_SELECTOR = [
|
|
13429
|
+
// is an element naming `drag` among its own interactions: it said the grab is
|
|
13430
|
+
// ITS, here, rather than the box's — and one that named only the click said
|
|
13431
|
+
// nothing to this gesture and is passed through (see DRAG_IGNORED_SELECTOR in
|
|
13432
|
+
// drag_to.js). And so is a popover or a dialog: a layer OVER the box, whose
|
|
13433
|
+
// press only bubbles through the box because the layer is anchored in it.
|
|
13434
|
+
const DRAG_EXCLUDED_SELECTOR = [
|
|
13435
|
+
// The fields that read the pointer as it MOVES: a caret dragged through text,
|
|
13436
|
+
// a thumb pushed along its rail, a spinner. The ones that only read the
|
|
13437
|
+
// press — a checkbox, a radio, a colour, a file — are buttons by another
|
|
13438
|
+
// name, and like a button they let the drag through, the click they would
|
|
13439
|
+
// have made swallowed on the way out. Which matters more than the list makes
|
|
13440
|
+
// it look: a selectable row is covered by an invisible radio of its own, so
|
|
13441
|
+
// excluding every input at once means a list of rows inside a travelling box
|
|
13442
|
+
// that no finger can push.
|
|
13443
|
+
'input:not([type="checkbox"], [type="radio"], [type="button"], [type="submit"], [type="reset"], [type="image"], [type="color"], [type="file"])', "textarea", "select", '[contenteditable=""]', '[contenteditable="true"]', "[data-drag-handle]", "[data-no-drag-travel]", '[data-self-interactions~="drag"]', '[data-self-interactions~="*"]', "[popover]", "dialog"].join(",");
|
|
13412
13444
|
|
|
13413
13445
|
// Which axes a box travels on, one attribute per gesture, said in the DOM by
|
|
13414
13446
|
// whoever owns the box: it is what a box ABOVE another reads to know the
|
|
@@ -20055,4 +20087,4 @@ const useResizeStatus = (elementRef, { as = "number" } = {}) => {
|
|
|
20055
20087
|
};
|
|
20056
20088
|
};
|
|
20057
20089
|
|
|
20058
|
-
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, getScrollRelativeRect, getSelfAndAncestorScrolls, getStyle, getTranslateX, getTranslateXWithoutTransition, getTranslateY, getVirtualKeyboardOverlayHeight, getVisuallyVisibleInfo, getWidth, getWidthWithoutTransition, hasCSSSizeUnit, initFlexDetailsSet, initFocusGroup, initPositionSticky, isAncestorOpen, isDisplayedDespiteClosedAncestor, isPrimaryButtonEvent, isSameColor, isScrollable, isTouchDrivenEvent, 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, 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 };
|
|
20090
|
+
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, isPrimaryButtonEvent, isSameColor, isScrollable, isTouchDrivenEvent, 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, 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 };
|