@jsenv/navi 0.29.455 → 0.29.456
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/dev/jsenv_navi.js +61 -27
- package/dist/dev/jsenv_navi.js.map +5 -5
- package/dist/dev/jsenv_navi_side_effects.js +1 -0
- package/dist/dev/jsenv_navi_side_effects.js.map +2 -2
- package/dist/jsenv_navi.js +61 -27
- package/dist/jsenv_navi.js.map +5 -5
- package/dist/jsenv_navi_side_effects.js +1 -0
- package/dist/jsenv_navi_side_effects.js.map +2 -2
- package/docs/popup_backdrop.md +16 -0
- package/package.json +1 -1
package/dist/dev/jsenv_navi.js
CHANGED
|
@@ -33755,9 +33755,33 @@ const pushHeadThemeColors = (themeColors) => {
|
|
|
33755
33755
|
};
|
|
33756
33756
|
};
|
|
33757
33757
|
|
|
33758
|
+
/**
|
|
33759
|
+
* What a popup asks of the colour while it is open: its `themeColor` prop,
|
|
33760
|
+
* else the `--navi-popup-theme-color` it inherits — where the choice goes
|
|
33761
|
+
* when it is the app's, or a part of the app's, rather than one popup's.
|
|
33762
|
+
*
|
|
33763
|
+
* @param {Element} element - The popup element.
|
|
33764
|
+
* @param {string|false} [themeColor] - The popup's prop.
|
|
33765
|
+
* @returns {string} `"auto"` paints what the popup lays over the top edge,
|
|
33766
|
+
* `"none"` leaves the colour as it is, anything else is a colour forcing it.
|
|
33767
|
+
*/
|
|
33768
|
+
const readPopupThemeColor = (element, themeColor) => {
|
|
33769
|
+
if (themeColor === false) {
|
|
33770
|
+
return "none";
|
|
33771
|
+
}
|
|
33772
|
+
if (themeColor) {
|
|
33773
|
+
return themeColor;
|
|
33774
|
+
}
|
|
33775
|
+
const token = getComputedStyle(element)
|
|
33776
|
+
.getPropertyValue("--navi-popup-theme-color")
|
|
33777
|
+
.trim();
|
|
33778
|
+
return token || "auto";
|
|
33779
|
+
};
|
|
33780
|
+
|
|
33758
33781
|
/**
|
|
33759
33782
|
* @param {object} paint
|
|
33760
|
-
* @param {string}
|
|
33783
|
+
* @param {string} paint.themeColor - `"auto"` paints the two colours below,
|
|
33784
|
+
* a colour forces it and nothing is painted.
|
|
33761
33785
|
* @param {string|null} [paint.backdropColor] - Laid over the page's colour.
|
|
33762
33786
|
* @param {string|null} [paint.surfaceColor] - Laid over that, for a popup
|
|
33763
33787
|
* flush with the top edge.
|
|
@@ -33769,7 +33793,7 @@ const pushPopupThemeColor = ({
|
|
|
33769
33793
|
surfaceColor,
|
|
33770
33794
|
}) => {
|
|
33771
33795
|
let layer;
|
|
33772
|
-
if (themeColor) {
|
|
33796
|
+
if (themeColor !== "auto") {
|
|
33773
33797
|
layer = { color: themeColor };
|
|
33774
33798
|
} else {
|
|
33775
33799
|
const paints = [];
|
|
@@ -67908,16 +67932,17 @@ const css$E = /* css */`
|
|
|
67908
67932
|
* `saturate()`/`grayscale()` work too. How far what is behind withdraws is
|
|
67909
67933
|
* a question of paint, not of what an outside click does — a backdrop that
|
|
67910
67934
|
* closes can blur.
|
|
67911
|
-
* @param {string|false} [props.themeColor] - The colour the browser
|
|
67912
|
-
* above the page (`<meta name="theme-color">`: Chrome's address bar
|
|
67913
|
-
* Android, an installed app's status bar) while this dialog is open.
|
|
67914
|
-
*
|
|
67935
|
+
* @param {"auto"|string|false} [props.themeColor] - The colour the browser
|
|
67936
|
+
* paints above the page (`<meta name="theme-color">`: Chrome's address bar
|
|
67937
|
+
* on Android, an installed app's status bar) while this dialog is open.
|
|
67938
|
+
* `"auto"` is what the dialog lays over the top edge of the screen: its
|
|
67915
67939
|
* backdrop over the colour the page asked for (`<Head>`), and its own
|
|
67916
67940
|
* background over that when it is flush with the top edge
|
|
67917
67941
|
* (`marginWithContainer={0}` with `expand`/`expandY` or a top
|
|
67918
67942
|
* `positionArea`). A colour forces it, for a surface whose colour cannot be
|
|
67919
67943
|
* read (an image, a gradient); `false` leaves the page's colour alone.
|
|
67920
|
-
* `
|
|
67944
|
+
* Left out, the `--navi-popup-theme-color` token decides, `"auto"` unless
|
|
67945
|
+
* the app says otherwise. `layer="top"` only.
|
|
67921
67946
|
* @param {boolean} [props.scrollCapture] - Traps scroll gestures inside the
|
|
67922
67947
|
* dialog so the page/container behind it can't scroll while it's open.
|
|
67923
67948
|
* A `layer="local"` dialog always locks its own positioned ancestor's
|
|
@@ -69087,12 +69112,15 @@ const useDialogProps = props => {
|
|
|
69087
69112
|
// What the browser paints above the page goes with what is laid over its
|
|
69088
69113
|
// top edge, from the start of the opening to the start of the closing: a
|
|
69089
69114
|
// local dialog lays nothing there.
|
|
69090
|
-
if (isTopLayer
|
|
69091
|
-
|
|
69092
|
-
|
|
69093
|
-
|
|
69094
|
-
|
|
69095
|
-
|
|
69115
|
+
if (isTopLayer) {
|
|
69116
|
+
const popupThemeColor = readPopupThemeColor(dialogEl, themeColor);
|
|
69117
|
+
if (popupThemeColor !== "none") {
|
|
69118
|
+
addCleanup(pushPopupThemeColor({
|
|
69119
|
+
themeColor: popupThemeColor,
|
|
69120
|
+
backdropColor: backdrop ? readBackdropColor(dialogEl) : null,
|
|
69121
|
+
surfaceColor: flushEdges.top ? getComputedStyle(dialogEl).backgroundColor : null
|
|
69122
|
+
}));
|
|
69123
|
+
}
|
|
69096
69124
|
}
|
|
69097
69125
|
const cancelOpenInteractionSuppression = !silent && hasCssTransitionAnimation ? suppressPointerEventsDuringTransition(dialogEl) : null;
|
|
69098
69126
|
// Handing the focus to a field is what raises the on-screen keyboard, and
|
|
@@ -69958,12 +69986,14 @@ const css$D = /* css */`
|
|
|
69958
69986
|
* `saturate()`/`grayscale()` work too. How far what is behind withdraws is
|
|
69959
69987
|
* a question of paint, not of what an outside click does — a backdrop that
|
|
69960
69988
|
* closes can blur.
|
|
69961
|
-
* @param {string|false} [props.themeColor] - The colour the browser
|
|
69962
|
-
* above the page (`<meta name="theme-color">`: Chrome's address bar
|
|
69963
|
-
* Android, an installed app's status bar) while this popover is open.
|
|
69964
|
-
*
|
|
69989
|
+
* @param {"auto"|string|false} [props.themeColor] - The colour the browser
|
|
69990
|
+
* paints above the page (`<meta name="theme-color">`: Chrome's address bar
|
|
69991
|
+
* on Android, an installed app's status bar) while this popover is open.
|
|
69992
|
+
* `"auto"` is the backdrop laid over the colour the page asked for
|
|
69965
69993
|
* (`<Head>`), and the page's colour when there is no backdrop. A colour
|
|
69966
|
-
* forces it; `false` leaves the page's colour alone.
|
|
69994
|
+
* forces it; `false` leaves the page's colour alone. Left out, the
|
|
69995
|
+
* `--navi-popup-theme-color` token decides, `"auto"` unless the app says
|
|
69996
|
+
* otherwise. `layer="top"` only.
|
|
69967
69997
|
* @param {boolean} [props.scrollCapture] - Traps scroll gestures inside the
|
|
69968
69998
|
* popover so the page/container behind it can't scroll while it's open.
|
|
69969
69999
|
* @param {boolean} [props.focusCapture] - Traps Tab navigation inside the
|
|
@@ -70924,11 +70954,14 @@ const usePopoverProps = props => {
|
|
|
70924
70954
|
// What the browser paints above the page goes with what is laid over its
|
|
70925
70955
|
// top edge, from the start of the opening to the start of the closing: a
|
|
70926
70956
|
// local popover's backdrop stops at its container.
|
|
70927
|
-
if (isTopLayer
|
|
70928
|
-
|
|
70929
|
-
|
|
70930
|
-
|
|
70931
|
-
|
|
70957
|
+
if (isTopLayer) {
|
|
70958
|
+
const popupThemeColor = readPopupThemeColor(popoverEl, themeColor);
|
|
70959
|
+
if (popupThemeColor !== "none") {
|
|
70960
|
+
addCleanup(pushPopupThemeColor({
|
|
70961
|
+
themeColor: popupThemeColor,
|
|
70962
|
+
backdropColor: backdropEl ? readBackdropColor(backdropEl) : null
|
|
70963
|
+
}));
|
|
70964
|
+
}
|
|
70932
70965
|
}
|
|
70933
70966
|
const cancelOpenInteractionSuppression = !silent && hasCssTransitionAnimation ? suppressPointerEventsDuringTransition(popoverEl) : null;
|
|
70934
70967
|
// autoFocus={false}: opening moves no focus at all — whoever has the
|
|
@@ -71346,10 +71379,11 @@ const css$C = /* css */`@layer navi {
|
|
|
71346
71379
|
* identically): the wash the backdrop paints over what is behind.
|
|
71347
71380
|
* @param {string} [props.backdropFilter] - Forwarded as-is: what that wash
|
|
71348
71381
|
* does to the picture underneath, `"blur(4px)"` and the like.
|
|
71349
|
-
* @param {string|false} [props.themeColor] - Forwarded as-is: the
|
|
71350
|
-
* browser paints above the page while the popup is open
|
|
71351
|
-
*
|
|
71352
|
-
* leaves the page's colour alone.
|
|
71382
|
+
* @param {"auto"|string|false} [props.themeColor] - Forwarded as-is: the
|
|
71383
|
+
* colour the browser paints above the page while the popup is open.
|
|
71384
|
+
* `"auto"` works it out from what the popup lays over the top edge, a
|
|
71385
|
+
* colour forces it, `false` leaves the page's colour alone. Left out, the
|
|
71386
|
+
* `--navi-popup-theme-color` token decides.
|
|
71353
71387
|
* @param {boolean|"auto"|"fading"|"scaling"|"sliding"|`slide-from-${string}`|"expanding"|`expand-${string}`|"lifting"|{open: boolean|"auto"|"fading"|"scaling"|"sliding"|`slide-from-${string}`, close: "lifting"}} [props.animation]
|
|
71354
71388
|
* - Forwarded to whichever renders — see either component's own doc.
|
|
71355
71389
|
* `"expanding"`/`"expand-*"` are `Popover`'s own; `"lifting"` and
|