@jsenv/navi 0.29.518 → 0.29.520
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 +65 -47
- package/dist/dev/jsenv_navi.js.map +10 -10
- package/dist/jsenv_navi.js +65 -47
- package/dist/jsenv_navi.js.map +10 -10
- package/docs/interactions.md +2 -3
- package/docs/network_policy.md +3 -2
- package/docs/popup_open.md +8 -16
- package/package.json +1 -1
package/dist/jsenv_navi.js
CHANGED
|
@@ -21144,6 +21144,11 @@ const BUSY_CONSTRAINT = {
|
|
|
21144
21144
|
return null;
|
|
21145
21145
|
}
|
|
21146
21146
|
|
|
21147
|
+
// Same as READONLY_CONSTRAINT: a run inside the popup holds it from there.
|
|
21148
|
+
if (intent === "close") {
|
|
21149
|
+
return null;
|
|
21150
|
+
}
|
|
21151
|
+
|
|
21147
21152
|
// Busy, and what it opens still opens: a picker's answer lives in a shape
|
|
21148
21153
|
// only its popup draws, and refusing to open leaves it unreadable for as
|
|
21149
21154
|
// long as the wait lasts. Opening reads and nothing more — the same
|
|
@@ -21238,12 +21243,17 @@ const findBusySource = (field) => {
|
|
|
21238
21243
|
const DISABLED_CONSTRAINT = {
|
|
21239
21244
|
name: "disabled",
|
|
21240
21245
|
messageAttribute: "data-disabled-message",
|
|
21241
|
-
check: (field) => {
|
|
21246
|
+
check: (field, { intent } = {}) => {
|
|
21242
21247
|
const disabled = field.controlHostProps.disabled;
|
|
21243
21248
|
if (!disabled) {
|
|
21244
21249
|
return null;
|
|
21245
21250
|
}
|
|
21246
21251
|
|
|
21252
|
+
// Same as READONLY_CONSTRAINT: a popup still open leaves like any other.
|
|
21253
|
+
if (intent === "close") {
|
|
21254
|
+
return null;
|
|
21255
|
+
}
|
|
21256
|
+
|
|
21247
21257
|
const type = field.controlHostProps.type;
|
|
21248
21258
|
let message;
|
|
21249
21259
|
if (type === "radio") {
|
|
@@ -22232,6 +22242,14 @@ const READONLY_CONSTRAINT = {
|
|
|
22232
22242
|
return null;
|
|
22233
22243
|
}
|
|
22234
22244
|
|
|
22245
|
+
// Leaving a popup already open is never the control's to refuse, whatever
|
|
22246
|
+
// it would refuse on the way in: closing writes nothing, and what may hold
|
|
22247
|
+
// a popup is the popup's own question (see popup_busy.js and the picker's
|
|
22248
|
+
// onRequestClose).
|
|
22249
|
+
if (intent === "close") {
|
|
22250
|
+
return null;
|
|
22251
|
+
}
|
|
22252
|
+
|
|
22235
22253
|
// Read-only, and what it opens still opens: a picker's answer often lives
|
|
22236
22254
|
// in a shape only its popup draws — a plan with one tile ringed, a wheel
|
|
22237
22255
|
// stopped on a time — and refusing to open leaves that shape unreadable.
|
|
@@ -22331,7 +22349,8 @@ const readOnlyMessage = (field) => {
|
|
|
22331
22349
|
* → onRequestInteraction
|
|
22332
22350
|
* → check disabled / read-only / busy (via controller.rules.interaction)
|
|
22333
22351
|
* against the interaction's `intent` ("write" by default, "read" for one
|
|
22334
|
-
* that only shows what is already there
|
|
22352
|
+
* that only shows what is already there, "close" for one leaving a popup
|
|
22353
|
+
* — see READONLY_CONSTRAINT)
|
|
22335
22354
|
* → if blocked → prevented()
|
|
22336
22355
|
* → if allowed → allowed()
|
|
22337
22356
|
* → (in allowed callback) setUIState(value)
|
|
@@ -22614,9 +22633,10 @@ const onRequestInteraction = (
|
|
|
22614
22633
|
name,
|
|
22615
22634
|
// What this interaction would do to the control: write it, or only read it.
|
|
22616
22635
|
// Everything writes unless it says otherwise — an interaction that merely
|
|
22617
|
-
// shows what is already there (opening a picker's popup
|
|
22618
|
-
//
|
|
22619
|
-
//
|
|
22636
|
+
// shows what is already there (opening a picker's popup) says "read", and
|
|
22637
|
+
// that is what a control held read-only can still let through. Closing that
|
|
22638
|
+
// popup says "close", which no state of the control refuses (see
|
|
22639
|
+
// READONLY_CONSTRAINT).
|
|
22620
22640
|
intent = "write",
|
|
22621
22641
|
bypassInteractivity = false,
|
|
22622
22642
|
// navi continuing a gesture on its own rather than a user asking for
|
|
@@ -43392,11 +43412,8 @@ const clearCommand = (source, event) => {
|
|
|
43392
43412
|
return;
|
|
43393
43413
|
}
|
|
43394
43414
|
// Only what is open: the clear cross of a picker sits on the closed
|
|
43395
|
-
// trigger,
|
|
43396
|
-
//
|
|
43397
|
-
// down while the clear it just sent is still running and says so out loud
|
|
43398
|
-
// ("this element is busy"). A clear pressed INSIDE an open popup is the
|
|
43399
|
-
// one this is for: it answers the popup, so the popup goes away.
|
|
43415
|
+
// trigger, with nothing to close. A clear pressed INSIDE an open popup is
|
|
43416
|
+
// the one this is for: it answers the popup, so the popup goes away.
|
|
43400
43417
|
const expandable = resolveClosestExpandable(source);
|
|
43401
43418
|
if (expandable?.getAttribute("aria-expanded") !== "true") {
|
|
43402
43419
|
return;
|
|
@@ -51613,21 +51630,20 @@ const useInteractiveProps = (props, {
|
|
|
51613
51630
|
// — a diskette saving a row into the reader's own address book stays
|
|
51614
51631
|
// pressable on a game nobody may edit. Its own props still hold; only what
|
|
51615
51632
|
// came from above is dropped (see self_interactions.js for the three modes).
|
|
51616
|
-
const zoneStateApplies = !selfInteractionsIgnoreBlock(props);
|
|
51617
51633
|
// A press that only leaves the popup it sits in writes nothing to the zone
|
|
51618
|
-
// around it either, so that zone being read-only
|
|
51619
|
-
// network policy keeps — does not hold it: the popup
|
|
51620
|
-
// itself. A read-only picker's popup then closes from its
|
|
51621
|
-
// it does from a press outside, and refuses both alike when it
|
|
51622
|
-
// change it cannot send.
|
|
51623
|
-
const
|
|
51634
|
+
// around it either, so that zone being disabled, read-only or busy — or
|
|
51635
|
+
// holding a write the network policy keeps — does not hold it: the popup
|
|
51636
|
+
// answers the close itself. A read-only picker's popup then closes from its
|
|
51637
|
+
// own button as it does from a press outside, and refuses both alike when it
|
|
51638
|
+
// holds a change it cannot send or a run it cannot give up on.
|
|
51639
|
+
const zoneStateApplies = !selfInteractionsIgnoreBlock(props) && !pressOnlyLeaves(controlInfo.controlType, props);
|
|
51624
51640
|
// A press feeding nothing to the write around it — a travel, a page, a
|
|
51625
51641
|
// uiAction, a function of its own — has nothing for the network policy to
|
|
51626
51642
|
// keep: only its own verb holds it, as anywhere else. What the zone holds
|
|
51627
51643
|
// for its own reasons (read-only, busy) still holds it.
|
|
51628
51644
|
const asksNothingOfTheWrite = pressAsksNothingOfTheWrite(controlInfo.controlType, props, boundAction);
|
|
51629
51645
|
const controlDisabled = zoneStateApplies && controlDisabledFromAbove;
|
|
51630
|
-
const controlReadOnly =
|
|
51646
|
+
const controlReadOnly = zoneStateApplies && !(asksNothingOfTheWrite && controlReadOnlyFromAbove === "network-policy") && controlReadOnlyFromAbove;
|
|
51631
51647
|
const controlLoading = zoneStateApplies && controlLoadingFromAbove;
|
|
51632
51648
|
const disabledResolved = disabled || controlDisabled;
|
|
51633
51649
|
const requiredResolved = required || controlRequired;
|
|
@@ -51646,7 +51662,7 @@ const useInteractiveProps = (props, {
|
|
|
51646
51662
|
// picker's popup) — refuses before the press and says why (see
|
|
51647
51663
|
// network_policy.js): a press that looks accepted and fails after is what
|
|
51648
51664
|
// the policy exists to avoid.
|
|
51649
|
-
const heldByNetworkPolicy = networkPolicyReason !== null && (isWriteAction(boundAction) || Boolean(
|
|
51665
|
+
const heldByNetworkPolicy = networkPolicyReason !== null && (isWriteAction(boundAction) || Boolean(zoneStateApplies && !asksNothingOfTheWrite && parentAction && isWriteAction(parentAction)) || controlReadOnly === "network-policy");
|
|
51650
51666
|
// Held back because the surface above already has as many runs in flight as
|
|
51651
51667
|
// it allows (see parallel_guard.js). Only a control that would START one:
|
|
51652
51668
|
// anything without an action of its own runs nothing and has nothing to
|
|
@@ -52218,10 +52234,11 @@ const splitControlProps = (props, {
|
|
|
52218
52234
|
return [controlRootProps, controlHostProps];
|
|
52219
52235
|
};
|
|
52220
52236
|
// What a press leaving a popup asks for: closing it, or cancelling it. Only on
|
|
52221
|
-
// a
|
|
52222
|
-
// it then leads
|
|
52237
|
+
// a button or a link running nothing of its own — one with an action writes,
|
|
52238
|
+
// wherever it then leads, and on a field or a form `command` is what follows
|
|
52239
|
+
// the value it writes.
|
|
52223
52240
|
const LEAVING_COMMAND_SET = new Set(["--navi-close", "--navi-cancel"]);
|
|
52224
|
-
const pressOnlyLeaves = props => LEAVING_COMMAND_SET.has(props.command) && !props.action;
|
|
52241
|
+
const pressOnlyLeaves = (controlType, props) => (controlType === "button" || controlType === "link") && LEAVING_COMMAND_SET.has(props.command) && !props.action;
|
|
52225
52242
|
// What these commands move reads only the person's place: the slide shown,
|
|
52226
52243
|
// the item pointed at, the scroll, the page (see commands.js).
|
|
52227
52244
|
const COMMANDS_ASKING_NOTHING_OF_THE_WRITE = new Set(["--navi-right", "--navi-left", "--navi-down", "--navi-up", "--navi-previous", "--navi-next", "--navi-first", "--navi-last", "--navi-go-to-slide", "--navi-back", "--navi-scroll", "--navi-nav-to", "--navi-nav-back"]);
|
|
@@ -56299,6 +56316,8 @@ const css$$ = /* css */`@layer navi {
|
|
|
56299
56316
|
}
|
|
56300
56317
|
|
|
56301
56318
|
&[data-stretch] {
|
|
56319
|
+
z-index: auto;
|
|
56320
|
+
outline-width: 0;
|
|
56302
56321
|
position: static;
|
|
56303
56322
|
|
|
56304
56323
|
&:after {
|
|
@@ -56306,6 +56325,12 @@ const css$$ = /* css */`@layer navi {
|
|
|
56306
56325
|
position: absolute;
|
|
56307
56326
|
inset: 0;
|
|
56308
56327
|
}
|
|
56328
|
+
|
|
56329
|
+
&[data-focus-visible]:after {
|
|
56330
|
+
border-radius: var(--link-border-radius);
|
|
56331
|
+
outline: var(--link-outline-width) solid var(--link-outline-color);
|
|
56332
|
+
outline-offset: calc(-1 * var(--link-outline-width));
|
|
56333
|
+
}
|
|
56309
56334
|
}
|
|
56310
56335
|
|
|
56311
56336
|
&[data-readonly] > * {
|
|
@@ -56529,7 +56554,10 @@ const LinkPseudoElements = ["::-navi-loader", "::-navi-indicator"];
|
|
|
56529
56554
|
* positioned; navi's `Text` is not. A control in the row that keeps its own
|
|
56530
56555
|
* press sits above the area when it is positioned and comes after the link
|
|
56531
56556
|
* (navi's `Button` is positioned); one written before the link is raised
|
|
56532
|
-
* with a `z-index`. The link is never positioned itself, in any state.
|
|
56557
|
+
* with a `z-index`. The link is never positioned itself, in any state. The
|
|
56558
|
+
* focus ring is drawn inside the press area and cannot read the ancestor's
|
|
56559
|
+
* radius: a rounded ancestor repeats it on the link
|
|
56560
|
+
* (`<Link stretch borderRadius="m">`).
|
|
56533
56561
|
* @param {boolean} [props.hrefFallback] - Use `href` as the visible text when
|
|
56534
56562
|
* no children are given; defaults to `true` unless `anchor`.
|
|
56535
56563
|
* @param {string|{type?: string, duration?: number|string, direction?: "forward"|"back"}} [props.routeTransition] -
|
|
@@ -74600,12 +74628,11 @@ const clipOf = (side, distance) => {
|
|
|
74600
74628
|
* `--navi-close`, which the nearest popup above it answers; the caller only
|
|
74601
74629
|
* decides where it goes (the right end of a header, most of the time).
|
|
74602
74630
|
*
|
|
74603
|
-
* It is the way out of a popup, so
|
|
74604
|
-
*
|
|
74605
|
-
*
|
|
74606
|
-
*
|
|
74607
|
-
*
|
|
74608
|
-
* the reason to use this one rather than a `<Button command="--navi-close" />`.
|
|
74631
|
+
* It is the way out of a popup, so the state of the surrounding control does not
|
|
74632
|
+
* reach it, as with any `--navi-close` button that has no action of its own (see
|
|
74633
|
+
* pressOnlyLeaves in control_hooks.jsx): a read-only picker still opens (reading
|
|
74634
|
+
* changes nothing) and hands its popup that read-only, and a cross wearing it
|
|
74635
|
+
* would trap the user in a popup they were invited to read.
|
|
74609
74636
|
*
|
|
74610
74637
|
* Exempt from the state around it, never from the popup's own answer: the cross
|
|
74611
74638
|
* ASKS, and the popup decides — a dialog holding a form mid-send keeps the
|
|
@@ -74632,15 +74659,6 @@ const PopupClose = ({
|
|
|
74632
74659
|
command: "--navi-close",
|
|
74633
74660
|
icon: true,
|
|
74634
74661
|
variant: "discrete"
|
|
74635
|
-
// Dismissing writes nothing to whatever control the popup belongs to, so
|
|
74636
|
-
// that control's read-only and disabled are not about this cross: a
|
|
74637
|
-
// read-only picker still opens to be read (see readonly_constraint.js),
|
|
74638
|
-
// and what is opened has to be closable. Whether closing is allowed at
|
|
74639
|
-
// this instant is the popup's own question, answered by the popup — a
|
|
74640
|
-
// dialog holds the close while an action inside it runs (see
|
|
74641
|
-
// popup_busy.js).
|
|
74642
|
-
,
|
|
74643
|
-
whenSelfInteractionsBlocked: "ignore"
|
|
74644
74662
|
// The cross is drawn at the control size, which is a few millimetres
|
|
74645
74663
|
// wide; the padding is what makes it a target a thumb can hit.
|
|
74646
74664
|
,
|
|
@@ -80219,11 +80237,11 @@ const PickerCustom = props => {
|
|
|
80219
80237
|
event: e,
|
|
80220
80238
|
name: "navi_request_open_event",
|
|
80221
80239
|
// Showing what the picker already holds, in the shape only the popup
|
|
80222
|
-
// draws it in — nothing of the value is written on the way in
|
|
80223
|
-
//
|
|
80224
|
-
//
|
|
80225
|
-
//
|
|
80226
|
-
// READONLY_CONSTRAINT.
|
|
80240
|
+
// draws it in — nothing of the value is written on the way in. Every
|
|
80241
|
+
// way of opening below says the same, which is what lets a read-only
|
|
80242
|
+
// picker be opened and read while everything that would write it
|
|
80243
|
+
// (paste, cut, the clear cross) stays refused. Every way of closing
|
|
80244
|
+
// says "close". See READONLY_CONSTRAINT.
|
|
80227
80245
|
intent: "read",
|
|
80228
80246
|
allowed: () => {
|
|
80229
80247
|
// What the open said travels with it: a picker opened from
|
|
@@ -80248,7 +80266,7 @@ const PickerCustom = props => {
|
|
|
80248
80266
|
onnavi_request_close: e => {
|
|
80249
80267
|
requestInteraction({
|
|
80250
80268
|
event: e,
|
|
80251
|
-
intent: "
|
|
80269
|
+
intent: "close",
|
|
80252
80270
|
allowed: () => {
|
|
80253
80271
|
const closing = requestClose(e, {
|
|
80254
80272
|
isCancel: e.detail.isCancel,
|
|
@@ -80355,7 +80373,7 @@ const PickerCustom = props => {
|
|
|
80355
80373
|
}
|
|
80356
80374
|
return {
|
|
80357
80375
|
name: "escape_to_cancel",
|
|
80358
|
-
intent: "
|
|
80376
|
+
intent: "close",
|
|
80359
80377
|
allowed: () => {
|
|
80360
80378
|
// Read with escapeEffect by the controller (see above).
|
|
80361
80379
|
requestClose(e, {
|
|
@@ -80432,7 +80450,7 @@ const PickerCustom = props => {
|
|
|
80432
80450
|
pressAnsweredAtMouseDownRef.current = readPressCount();
|
|
80433
80451
|
return {
|
|
80434
80452
|
name: "mousedown to close picker",
|
|
80435
|
-
intent: "
|
|
80453
|
+
intent: "close",
|
|
80436
80454
|
allowed: () => requestClose(e, {
|
|
80437
80455
|
isCancel: true
|
|
80438
80456
|
})
|
|
@@ -80479,7 +80497,7 @@ const PickerCustom = props => {
|
|
|
80479
80497
|
if (openController.opened && !openedDuringThisPress(openController)) {
|
|
80480
80498
|
return {
|
|
80481
80499
|
name: "click to close picker",
|
|
80482
|
-
intent: "
|
|
80500
|
+
intent: "close",
|
|
80483
80501
|
prevented: () => {
|
|
80484
80502
|
e.preventDefault();
|
|
80485
80503
|
},
|