@jsenv/navi 0.29.450 → 0.29.452
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 +92 -31
- package/dist/dev/jsenv_navi.js.map +7 -7
- package/dist/jsenv_navi.js +92 -31
- package/dist/jsenv_navi.js.map +7 -7
- package/package.json +1 -1
package/dist/dev/jsenv_navi.js
CHANGED
|
@@ -33796,6 +33796,34 @@ const pushPopupThemeColor = ({
|
|
|
33796
33796
|
};
|
|
33797
33797
|
};
|
|
33798
33798
|
|
|
33799
|
+
/**
|
|
33800
|
+
* What a popup's wall paints, read off the `--backdrop-background` it is
|
|
33801
|
+
* painted from rather than off the wall: for the length of a route transition
|
|
33802
|
+
* played on an area the wall itself is turned transparent and stood in for
|
|
33803
|
+
* (transition_furniture.js), and a popup opening then would find nothing laid
|
|
33804
|
+
* over the edge. The variable holds a token list, resolved to a colour on an
|
|
33805
|
+
* element of its own, given what the wall inherits that a colour depends on:
|
|
33806
|
+
* color-scheme for light-dark() and the system colours, color for
|
|
33807
|
+
* currentcolor.
|
|
33808
|
+
*
|
|
33809
|
+
* @param {Element} element - The element declaring the variable: the dialog
|
|
33810
|
+
* for its ::backdrop, a popover's wall for itself.
|
|
33811
|
+
* @returns {string}
|
|
33812
|
+
*/
|
|
33813
|
+
const readBackdropColor = (element) => {
|
|
33814
|
+
const elementStyle = getComputedStyle(element);
|
|
33815
|
+
const probe = document.createElement("div");
|
|
33816
|
+
probe.style.colorScheme = elementStyle.colorScheme;
|
|
33817
|
+
probe.style.color = elementStyle.color;
|
|
33818
|
+
probe.style.background = elementStyle.getPropertyValue(
|
|
33819
|
+
"--backdrop-background",
|
|
33820
|
+
);
|
|
33821
|
+
document.body.append(probe);
|
|
33822
|
+
const color = getComputedStyle(probe).backgroundColor;
|
|
33823
|
+
probe.remove();
|
|
33824
|
+
return color;
|
|
33825
|
+
};
|
|
33826
|
+
|
|
33799
33827
|
let renderQueued = false;
|
|
33800
33828
|
// Once per commit: a Head re-rendering leaves and arrives again in the same
|
|
33801
33829
|
// commit, and the browser must not be handed the colour from in between.
|
|
@@ -35057,9 +35085,16 @@ const WALL_ATTRIBUTE = "data-navi-transition-wall";
|
|
|
35057
35085
|
// property would replace it.
|
|
35058
35086
|
const FURNITURE_ATTRIBUTE = "data-navi-transition-furniture";
|
|
35059
35087
|
// What the wall paints, resolved on the matched element in both cases (the
|
|
35060
|
-
// dialog for its ::backdrop, the popover's wall for itself)
|
|
35061
|
-
//
|
|
35062
|
-
|
|
35088
|
+
// dialog for its ::backdrop, the popover's wall for itself), and what a colour
|
|
35089
|
+
// in it depends on: color-scheme for light-dark() and the system colours,
|
|
35090
|
+
// color for currentcolor. Copied onto the stand-in, which paints them in a
|
|
35091
|
+
// context of its own.
|
|
35092
|
+
const WALL_PROPERTIES = [
|
|
35093
|
+
"--backdrop-background",
|
|
35094
|
+
"--backdrop-filter",
|
|
35095
|
+
"color-scheme",
|
|
35096
|
+
"color",
|
|
35097
|
+
];
|
|
35063
35098
|
|
|
35064
35099
|
// The pictures the wall is painted into: the pages', and every bar's own.
|
|
35065
35100
|
const FIXED_BAR_SELECTOR$1 = ".navi_fixed_bar";
|
|
@@ -43577,6 +43612,7 @@ const useUIStateController = (
|
|
|
43577
43612
|
if (
|
|
43578
43613
|
e.type === "facade_propagate_up" ||
|
|
43579
43614
|
e.type === "cancel_rollback" ||
|
|
43615
|
+
e.type === "navi_reset_ui_state" ||
|
|
43580
43616
|
e.type === "auto_fix"
|
|
43581
43617
|
) {
|
|
43582
43618
|
// Exception: when the facade propagates a child state change up to the
|
|
@@ -43586,7 +43622,9 @@ const useUIStateController = (
|
|
|
43586
43622
|
// the Form's uiAction fires on every value change.
|
|
43587
43623
|
// A cancel takes the same road back: the Form was told what the
|
|
43588
43624
|
// popup was picking, so it has to be told the picker went back to
|
|
43589
|
-
// where it opened, or it sends a value the user said no to.
|
|
43625
|
+
// where it opened, or it sends a value the user said no to. A
|
|
43626
|
+
// reset is that road too, for a field put back after its own
|
|
43627
|
+
// action failed.
|
|
43590
43628
|
// A correction is the same story once more: the Form sends what
|
|
43591
43629
|
// its fields add up to, and a field that just put its own value
|
|
43592
43630
|
// right has to be counted for the corrected one.
|
|
@@ -45705,6 +45743,13 @@ const INTERNAL_EVENT_SET = new Set([
|
|
|
45705
45743
|
// notification below still happen, exactly as they did on the way in (see
|
|
45706
45744
|
// picker_custom.jsx's onClose).
|
|
45707
45745
|
"cancel_rollback",
|
|
45746
|
+
// A rollback navi asks for (see dispatchRequestResetUIState): the action
|
|
45747
|
+
// failed or was aborted, the edit was cancelled, a reset command aimed here.
|
|
45748
|
+
// Nobody acted on the control, so no command — a `<Picker type="confirm"
|
|
45749
|
+
// action command>` refused by the server would otherwise go where only its
|
|
45750
|
+
// success leads. Where the value moves back, uiAction and the parent
|
|
45751
|
+
// notification below still happen, as for cancel_rollback.
|
|
45752
|
+
"navi_reset_ui_state",
|
|
45708
45753
|
// A constraint allowed to correct the value put it right as the value was
|
|
45709
45754
|
// committed (see applyAutoFix). Nobody pressed anything, so no command and
|
|
45710
45755
|
// no action of the control's own — but what it holds really did move, so
|
|
@@ -57530,24 +57575,32 @@ const ControlSwap = props => {
|
|
|
57530
57575
|
}
|
|
57531
57576
|
// Reading .value during render is what subscribes the row to it.
|
|
57532
57577
|
const valueRequested = signal ? signal.value : value;
|
|
57533
|
-
|
|
57578
|
+
// The side holding the floor, and the cap whose press gave it (null when
|
|
57579
|
+
// `value`/`signal` did): which cap was pressed decides where the focus goes.
|
|
57580
|
+
const [floor, setFloor] = useState(() => {
|
|
57534
57581
|
const nameRequested = valueRequested === undefined ? defaultValue : valueRequested;
|
|
57535
|
-
return
|
|
57582
|
+
return {
|
|
57583
|
+
name: nameRequested === undefined ? sides[0].name : nameRequested,
|
|
57584
|
+
pressedCapIndex: null
|
|
57585
|
+
};
|
|
57536
57586
|
});
|
|
57537
|
-
const activeIndexFound = sides.findIndex(side => side.name ===
|
|
57587
|
+
const activeIndexFound = sides.findIndex(side => side.name === floor.name);
|
|
57538
57588
|
const activeIndex = activeIndexFound === -1 ? 0 : activeIndexFound;
|
|
57539
57589
|
const activeSide = sides[activeIndex];
|
|
57540
57590
|
const capRefs = [useRef(), useRef()];
|
|
57541
57591
|
const slotRefs = [useRef(), useRef()];
|
|
57542
57592
|
const slotIdPrefix = useId();
|
|
57543
|
-
const activeNameRef = useRef(
|
|
57593
|
+
const activeNameRef = useRef(floor.name);
|
|
57544
57594
|
activeNameRef.current = activeSide.name;
|
|
57545
|
-
const swapTo = (name, event) => {
|
|
57595
|
+
const swapTo = (name, event, pressedCapIndex = null) => {
|
|
57546
57596
|
if (name === activeNameRef.current) {
|
|
57547
57597
|
return;
|
|
57548
57598
|
}
|
|
57549
57599
|
activeNameRef.current = name;
|
|
57550
|
-
|
|
57600
|
+
setFloor({
|
|
57601
|
+
name,
|
|
57602
|
+
pressedCapIndex
|
|
57603
|
+
});
|
|
57551
57604
|
if (signal) {
|
|
57552
57605
|
signal.value = name;
|
|
57553
57606
|
}
|
|
@@ -57580,14 +57633,14 @@ const ControlSwap = props => {
|
|
|
57580
57633
|
isFirstActiveRunRef.current = false;
|
|
57581
57634
|
return;
|
|
57582
57635
|
}
|
|
57583
|
-
focusWithTheFloor(slotRefs[activeIndex].current, activeSide, capRefs[activeIndex].current);
|
|
57636
|
+
focusWithTheFloor(slotRefs[activeIndex].current, activeSide, capRefs[activeIndex].current, floor.pressedCapIndex === null ? null : capRefs[floor.pressedCapIndex].current);
|
|
57584
57637
|
}, [activeSide.name]);
|
|
57585
57638
|
|
|
57586
57639
|
// Both caps do the same thing, and it is the reason they sit outside the
|
|
57587
57640
|
// controls: whichever one the finger lands on, the floor goes to the other
|
|
57588
57641
|
// side. The same pixel opens the search and closes it.
|
|
57589
|
-
const swapOnPress = event => {
|
|
57590
|
-
swapTo(sides[activeIndex === 0 ? 1 : 0].name, event);
|
|
57642
|
+
const swapOnPress = (event, pressedCapIndex) => {
|
|
57643
|
+
swapTo(sides[activeIndex === 0 ? 1 : 0].name, event, pressedCapIndex);
|
|
57591
57644
|
};
|
|
57592
57645
|
return jsxs(Box, {
|
|
57593
57646
|
flex: "x",
|
|
@@ -57601,7 +57654,7 @@ const ControlSwap = props => {
|
|
|
57601
57654
|
side: sides[0],
|
|
57602
57655
|
slotId: `${slotIdPrefix}_0`,
|
|
57603
57656
|
active: activeIndex === 0,
|
|
57604
|
-
onPress: swapOnPress
|
|
57657
|
+
onPress: event => swapOnPress(event, 0)
|
|
57605
57658
|
}), jsx("div", {
|
|
57606
57659
|
className: "navi_control_swap_stage",
|
|
57607
57660
|
children: jsx("div", {
|
|
@@ -57619,7 +57672,7 @@ const ControlSwap = props => {
|
|
|
57619
57672
|
side: sides[1],
|
|
57620
57673
|
slotId: `${slotIdPrefix}_1`,
|
|
57621
57674
|
active: activeIndex === 1,
|
|
57622
|
-
onPress: swapOnPress
|
|
57675
|
+
onPress: event => swapOnPress(event, 1)
|
|
57623
57676
|
})]
|
|
57624
57677
|
});
|
|
57625
57678
|
};
|
|
@@ -57650,12 +57703,14 @@ const ControlSwap = props => {
|
|
|
57650
57703
|
* the collapsed one — the side holding the floor spells out in full what a
|
|
57651
57704
|
* dot could only hint at — so it is read straight off the state
|
|
57652
57705
|
* (`badge={Boolean(groupId)}`), with no "and this side is hidden" to add.
|
|
57653
|
-
* @param autoFocus - On by default: the focus goes into this control when
|
|
57654
|
-
*
|
|
57655
|
-
* control first, its first focusable
|
|
57656
|
-
* that was pressed, for a control one
|
|
57657
|
-
* phone, for a keyboard that must not
|
|
57658
|
-
* setting
|
|
57706
|
+
* @param autoFocus - On by default: the focus goes into this control when its
|
|
57707
|
+
* own cap (or `value`/`signal`) gives it the floor, where navi's ladder puts
|
|
57708
|
+
* it — an `autoFocus` inside the control first, its first focusable
|
|
57709
|
+
* otherwise. `false` leaves it on the cap that was pressed, for a control one
|
|
57710
|
+
* reads before writing in (and, on a phone, for a keyboard that must not
|
|
57711
|
+
* rise). Whatever the setting, never on mount, and never when the floor comes
|
|
57712
|
+
* back because the other side was put away by its own cap: that press closed
|
|
57713
|
+
* something, it did not ask for this control.
|
|
57659
57714
|
*
|
|
57660
57715
|
* Anything else — `data-testid`, `variant`, `backgroundColor`, `color`, an
|
|
57661
57716
|
* `aria-describedby` — goes to the cap, which is a `<Button>`. It is the one
|
|
@@ -57730,9 +57785,13 @@ const readSides = children => {
|
|
|
57730
57785
|
return sides;
|
|
57731
57786
|
};
|
|
57732
57787
|
|
|
57733
|
-
// The floor moved
|
|
57734
|
-
//
|
|
57735
|
-
// opened, not pressing its icon again.
|
|
57788
|
+
// The floor moved. A press on the arriving side's own cap — the collapsed one —
|
|
57789
|
+
// asks for that control: what one wants next is typing into the search field
|
|
57790
|
+
// one just opened, not pressing its icon again. A press on the other cap puts
|
|
57791
|
+
// the side holding the floor away, and the arriving one only comes back because
|
|
57792
|
+
// the row has room for one control: the focus stays on the cap pressed, and on
|
|
57793
|
+
// a phone no keyboard rises over the list one went back to. A swap with no
|
|
57794
|
+
// press behind it (`value`/`signal` moved) is taken as asking for the arrival.
|
|
57736
57795
|
//
|
|
57737
57796
|
// WHERE inside is navi's own ladder (findFocusTarget): an `autoFocus` in the
|
|
57738
57797
|
// control's own content first, the first focusable otherwise, a last resort
|
|
@@ -57747,8 +57806,9 @@ const readSides = children => {
|
|
|
57747
57806
|
// open". A field marked that way so its sheet opens quietly would otherwise
|
|
57748
57807
|
// leave the focus on the magnifier that was pressed to reach it.
|
|
57749
57808
|
// A side one reads before writing in says `autoFocus={false}`.
|
|
57750
|
-
const focusWithTheFloor = (arrivingSlot, arrivingSide, arrivingCap) => {
|
|
57751
|
-
|
|
57809
|
+
const focusWithTheFloor = (arrivingSlot, arrivingSide, arrivingCap, pressedCap) => {
|
|
57810
|
+
const arrivalAskedFor = !pressedCap || pressedCap === arrivingCap;
|
|
57811
|
+
if (arrivalAskedFor && arrivingSide.autoFocus !== false) {
|
|
57752
57812
|
const found = findFocusTarget(arrivingSlot, {
|
|
57753
57813
|
restoreMayClaim: true
|
|
57754
57814
|
});
|
|
@@ -57758,13 +57818,14 @@ const focusWithTheFloor = (arrivingSlot, arrivingSide, arrivingCap) => {
|
|
|
57758
57818
|
}
|
|
57759
57819
|
}
|
|
57760
57820
|
// Whatever the leaving slot held is inert and off the window now, so the
|
|
57761
|
-
// browser dropped its focus to the document body
|
|
57762
|
-
//
|
|
57821
|
+
// browser dropped its focus to the document body (Safari never gave it to
|
|
57822
|
+
// the pressed button in the first place): it has to land somewhere, and the
|
|
57823
|
+
// cap pressed is where the gesture was.
|
|
57763
57824
|
const {
|
|
57764
57825
|
activeElement
|
|
57765
57826
|
} = document;
|
|
57766
57827
|
if (!activeElement || activeElement === document.body) {
|
|
57767
|
-
moveFocusTo(arrivingCap);
|
|
57828
|
+
moveFocusTo(pressedCap || arrivingCap);
|
|
57768
57829
|
}
|
|
57769
57830
|
};
|
|
57770
57831
|
|
|
@@ -68909,7 +68970,7 @@ const useDialogProps = props => {
|
|
|
68909
68970
|
if (isTopLayer && themeColor !== false) {
|
|
68910
68971
|
addCleanup(pushPopupThemeColor({
|
|
68911
68972
|
themeColor,
|
|
68912
|
-
backdropColor: backdrop ?
|
|
68973
|
+
backdropColor: backdrop ? readBackdropColor(dialogEl) : null,
|
|
68913
68974
|
surfaceColor: flushEdges.top ? getComputedStyle(dialogEl).backgroundColor : null
|
|
68914
68975
|
}));
|
|
68915
68976
|
}
|
|
@@ -70711,7 +70772,7 @@ const usePopoverProps = props => {
|
|
|
70711
70772
|
if (isTopLayer && themeColor !== false) {
|
|
70712
70773
|
addCleanup(pushPopupThemeColor({
|
|
70713
70774
|
themeColor,
|
|
70714
|
-
backdropColor: backdropEl ?
|
|
70775
|
+
backdropColor: backdropEl ? readBackdropColor(backdropEl) : null
|
|
70715
70776
|
}));
|
|
70716
70777
|
}
|
|
70717
70778
|
const cancelOpenInteractionSuppression = !silent && hasCssTransitionAnimation ? suppressPointerEventsDuringTransition(popoverEl) : null;
|