@jsenv/navi 0.29.150 → 0.29.151

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.
@@ -5596,8 +5596,19 @@ const CLICK_SELECTOR = selfInteractionSelector("click");
5596
5596
  * The closest element CLAIMING THE PRESS wins, not the closest one claiming
5597
5597
  * anything: an affordance that took only the drag is transparent here, exactly
5598
5598
  * as it is to the drag readers when it took only the click.
5599
+ *
5600
+ * @param {Event} event The gesture being arbitrated.
5601
+ * @param {Element} controlHost The control asking whether the press is its own.
5602
+ * @param {Element} [requester] Who asked this control to act, when someone did
5603
+ * — the source of a command, typically. The claim answers "was this press
5604
+ * yours or the affordance's"; it says nothing about a request that affordance
5605
+ * is making, and the answer there is always yes.
5599
5606
  */
5600
- const isAimedAtSelfInteractionsBelow = (event, controlHost) => {
5607
+ const isAimedAtSelfInteractionsBelow = (
5608
+ event,
5609
+ controlHost,
5610
+ requester,
5611
+ ) => {
5601
5612
  const target = event?.target;
5602
5613
  if (!target || typeof target.closest !== "function") {
5603
5614
  return false;
@@ -5611,6 +5622,13 @@ const isAimedAtSelfInteractionsBelow = (event, controlHost) => {
5611
5622
  if (claimer === controlHost || claimer.contains(controlHost)) {
5612
5623
  return false;
5613
5624
  }
5625
+ // The claimer is the one asking. Its claim took the press so IT would decide
5626
+ // what the press means, and this is that decision arriving — a clear cross
5627
+ // sending "--navi-clear" to the field it sits in. Stepping back here would be
5628
+ // the control refusing the very request the claim exists to let through.
5629
+ if (requester && (claimer === requester || claimer.contains(requester))) {
5630
+ return false;
5631
+ }
5614
5632
  // From the root rather than the host: a layered control (a picker holding an
5615
5633
  // input) has its gate on the input, and what the application drew sits beside
5616
5634
  // it, not in it.
@@ -9802,12 +9820,21 @@ const createControlInteraction = (
9802
9820
 
9803
9821
  const dispatchRequestInteraction = (
9804
9822
  element,
9805
- { event, name = "", prevented, allowed, always, ...detailRest } = {},
9823
+ {
9824
+ event,
9825
+ name = "",
9826
+ requester,
9827
+ prevented,
9828
+ allowed,
9829
+ always,
9830
+ ...detailRest
9831
+ } = {},
9806
9832
  ) => {
9807
9833
  const controlHost = findControlHost(element) || element;
9808
9834
  return dispatchInternalCustomEvent(controlHost, "navi_request_interaction", {
9809
9835
  event,
9810
9836
  name,
9837
+ requester,
9811
9838
  prevented,
9812
9839
  allowed,
9813
9840
  always,
@@ -9829,6 +9856,9 @@ const onRequestInteraction = (
9829
9856
  // through (see READONLY_CONSTRAINT).
9830
9857
  intent = "write",
9831
9858
  bypassInteractivity = false,
9859
+ // Who asked, when the control is not answering the gesture on its own —
9860
+ // the source of a command (see the self-interactions step-back below).
9861
+ requester,
9832
9862
  prevented,
9833
9863
  allowed,
9834
9864
  always,
@@ -9862,7 +9892,9 @@ const onRequestInteraction = (
9862
9892
  // reaction never happened, so its `prevented`/`always` (an
9863
9893
  // `e.preventDefault()`, for most of them) have nothing to undo and would take
9864
9894
  // the press from the affordance itself.
9865
- if (isAimedAtSelfInteractionsBelow(event, controlHost)) {
9895
+ // Unless that element is the one asking: what it took the press to decide is
9896
+ // arriving here, and it is this control's to answer.
9897
+ if (isAimedAtSelfInteractionsBelow(event, controlHost, requester)) {
9866
9898
  debugInteraction(
9867
9899
  event,
9868
9900
  `"${name}" is for a self-interactions element below`,
@@ -9947,6 +9979,11 @@ const dispatchRequestAction = (
9947
9979
  return dispatchRequestInteraction(element, {
9948
9980
  event,
9949
9981
  name,
9982
+ // The gate needs it as much as the action does: the requester may be an
9983
+ // affordance that claimed the press to ask for this very action, and the
9984
+ // control must not read that claim as "this press was not for me" — see
9985
+ // isAimedAtSelfInteractionsBelow.
9986
+ requester: actionOptions.requester,
9950
9987
  prevented,
9951
9988
  allowed: () => {
9952
9989
  allowed?.();
@@ -30404,6 +30441,9 @@ registerNaviCommand("--navi-update", (source, event, { argument }) => {
30404
30441
  dispatchRequestInteraction(target, {
30405
30442
  event,
30406
30443
  name: "--navi-update",
30444
+ // The source may have claimed the press to send this very command — see
30445
+ // the requester in onRequestInteraction.
30446
+ requester: source,
30407
30447
  prevented: () => event.preventDefault(),
30408
30448
  allowed: () => {
30409
30449
  const commandValue = resolveCommandValue(source, event);
@@ -30442,6 +30482,9 @@ registerNaviCommand("--navi-clear", (source, event) => {
30442
30482
  dispatchRequestInteraction(target, {
30443
30483
  event: clearEvent,
30444
30484
  name: "--navi-clear",
30485
+ // The source may have claimed the press to send this very command — see
30486
+ // the requester in onRequestInteraction.
30487
+ requester: source,
30445
30488
  prevented: () => clearEvent.preventDefault(),
30446
30489
  allowed: () => {
30447
30490
  // What the control holds, before it holds nothing: the clear is
@@ -30529,6 +30572,9 @@ registerNaviCommand("--navi-reset", (source, event) => {
30529
30572
  dispatchRequestInteraction(target, {
30530
30573
  event,
30531
30574
  name: "--navi-reset",
30575
+ // The source may have claimed the press to send this very command — see
30576
+ // the requester in onRequestInteraction.
30577
+ requester: source,
30532
30578
  prevented: () => event.preventDefault(),
30533
30579
  allowed: () => dispatchRequestResetUIState(target, event),
30534
30580
  });
@@ -44206,7 +44252,7 @@ installImportMetaCssBuild(import.meta);const css$P = /* css */`@layer navi {
44206
44252
  --button-color: currentColor;
44207
44253
  --button-cursor: pointer;
44208
44254
  --button-font-size: var(--navi-control-font-size);
44209
- --button-font-family: var(--navi-control-font-family);
44255
+ --button-font-family: var(--navi-control-font-family, inherit);
44210
44256
  --button-border-color-hover: color-mix(in srgb,
44211
44257
  var(--button-border-color) 70%,
44212
44258
  black);
@@ -44453,37 +44499,30 @@ a.navi_button {
44453
44499
  }
44454
44500
 
44455
44501
  &[data-cta] {
44456
- --x-button-background-color: var(--button-cta-background-color);
44457
- --x-button-border-color: var(--button-cta-background-color);
44458
- --x-button-color: white;
44459
-
44460
- &[data-hover] {
44461
- --x-button-background-color: color-mix(in srgb,
44462
- var(--button-cta-background-color) 85%,
44463
- white);
44464
- --x-button-border-color: color-mix(in srgb,
44465
- var(--button-cta-background-color) 85%,
44466
- white);
44467
- }
44468
-
44469
- &[data-readonly] {
44470
- --x-button-background-color: color-mix(in srgb,
44471
- var(--button-cta-background-color) 50%,
44472
- white);
44473
- --x-button-border-color: color-mix(in srgb,
44474
- var(--button-cta-background-color) 50%,
44475
- white);
44476
- }
44477
-
44478
- &[data-disabled] {
44479
- --x-button-background-color: color-mix(in srgb,
44480
- var(--button-cta-background-color) 40%,
44481
- white);
44482
- --x-button-border-color: color-mix(in srgb,
44483
- var(--button-cta-background-color) 40%,
44484
- white);
44485
- --x-button-color: #fff9;
44486
- }
44502
+ --button-background-color: var(--button-background, var(--button-cta-background-color));
44503
+ --button-border-color: var(--button-cta-background-color);
44504
+ --button-color: white;
44505
+ --button-background-color-hover: color-mix(in srgb,
44506
+ var(--button-background-color) 85%,
44507
+ white);
44508
+ --button-border-color-hover: color-mix(in srgb,
44509
+ var(--button-border-color) 85%,
44510
+ white);
44511
+ --button-background-color-readonly: color-mix(in srgb,
44512
+ var(--button-background-color) 50%,
44513
+ white);
44514
+ --button-border-color-readonly: color-mix(in srgb,
44515
+ var(--button-border-color) 50%,
44516
+ white);
44517
+ --button-background-color-disabled: color-mix(in srgb,
44518
+ var(--button-background-color) 40%,
44519
+ white);
44520
+ --button-border-color-disabled: color-mix(in srgb,
44521
+ var(--button-border-color) 40%,
44522
+ white);
44523
+ --button-color-disabled: color-mix(in srgb,
44524
+ var(--button-color) 60%,
44525
+ transparent);
44487
44526
  }
44488
44527
  }
44489
44528
  `;
@@ -45426,7 +45465,7 @@ installImportMetaCssBuild(import.meta);const css$M = /* css */`@layer navi {
45426
45465
  --outline-color: var(--navi-focus-outline-color);
45427
45466
  --margin: 3px 3px 3px 4px;
45428
45467
  --font-size: var(--navi-control-font-size);
45429
- --font-family: var(--navi-control-font-family);
45468
+ --font-family: var(--navi-control-font-family, inherit);
45430
45469
  --width: round(1em, 1px);
45431
45470
  --height: round(1em, 1px);
45432
45471
  --loader-color: var(--navi-loader-color);
@@ -46132,7 +46171,7 @@ installImportMetaCssBuild(import.meta);const css$K = /* css */`@layer navi {
46132
46171
  --border-color-checked: var(--accent-color);
46133
46172
  --cursor: pointer;
46134
46173
  --font-size: var(--navi-control-font-size);
46135
- --font-family: var(--navi-control-font-family);
46174
+ --font-family: var(--navi-control-font-family, inherit);
46136
46175
  --border-color-hover: color-mix(in srgb, var(--border-color) 60%, black);
46137
46176
  --border-color-hover-checked: color-mix(in srgb,
46138
46177
  var(--border-color-checked) 80%,
@@ -46579,7 +46618,7 @@ installImportMetaCssBuild(import.meta);const css$J = /* css */`@layer navi {
46579
46618
  --thumb-border-radius: 100%;
46580
46619
  --thumb-cursor: pointer;
46581
46620
  --font-size: var(--navi-control-font-size);
46582
- --font-family: var(--navi-control-font-family);
46621
+ --font-family: var(--navi-control-font-family, inherit);
46583
46622
  --loader-color: var(--navi-loader-color);
46584
46623
  --accent-color: var(--navi-control-accent-color);
46585
46624
  --color-mix-light: black;
@@ -46927,7 +46966,7 @@ const inputCss = /* css */`@layer navi {
46927
46966
  --outline-offset: calc(-.5 * var(--outline-width));
46928
46967
  --outline-color: var(--navi-focus-outline-color);
46929
46968
  --font-size: var(--navi-control-font-size);
46930
- --font-family: var(--navi-control-font-family);
46969
+ --font-family: var(--navi-control-font-family, inherit);
46931
46970
  --loader-color: var(--navi-loader-color);
46932
46971
  --border-color: var(--navi-control-border-color);
46933
46972
  --background-color: var(--navi-surface-color);
@@ -47142,13 +47181,24 @@ const inputCss = /* css */`@layer navi {
47142
47181
  }
47143
47182
 
47144
47183
  &[data-variant="text"] {
47145
- --x-background-color: transparent;
47146
- --x-border-color: transparent;
47184
+ --background-color: transparent;
47185
+ --background-color-hover: var(--background-color);
47186
+ --background-color-focus: var(--background-color);
47187
+ --background-color-readonly: var(--background-color);
47188
+ --background-color-disabled: var(--background-color);
47189
+ --border-color: transparent;
47190
+ --border-color-hover: var(--border-color);
47191
+ --border-color-readonly: var(--border-color);
47192
+ --border-color-disabled: var(--border-color);
47147
47193
  cursor: inherit;
47148
47194
  }
47149
47195
 
47150
47196
  &[data-variant="underline"] {
47151
- --x-background-color: transparent;
47197
+ --background-color: transparent;
47198
+ --background-color-hover: var(--background-color);
47199
+ --background-color-focus: var(--background-color);
47200
+ --background-color-readonly: var(--background-color);
47201
+ --background-color-disabled: var(--background-color);
47152
47202
  border: none;
47153
47203
  border-radius: 0;
47154
47204
  padding-left: 0;
@@ -47170,12 +47220,7 @@ const inputCss = /* css */`@layer navi {
47170
47220
  position: absolute;
47171
47221
  }
47172
47222
 
47173
- &[data-hover] {
47174
- --x-background-color: transparent;
47175
- }
47176
-
47177
47223
  &[data-focus-visible] {
47178
- --x-background-color: transparent;
47179
47224
  outline-style: none;
47180
47225
 
47181
47226
  & .navi_input_underline {
@@ -47183,10 +47228,6 @@ const inputCss = /* css */`@layer navi {
47183
47228
  height: 2px;
47184
47229
  }
47185
47230
  }
47186
-
47187
- &[data-readonly], &[data-disabled] {
47188
- --x-background-color: transparent;
47189
- }
47190
47231
  }
47191
47232
  }
47192
47233
  `;
@@ -59395,7 +59436,12 @@ const PickerConfirmResolver = props => {
59395
59436
  return jsx(Next, {
59396
59437
  ...props,
59397
59438
  type: "navi_js",
59398
- allowNameless: true,
59439
+ allowNameless: true
59440
+ // No chevron, no clear cross, whatever variant the trigger is drawn in:
59441
+ // both announce a value, and a question holds none.
59442
+ ,
59443
+
59444
+ picksNothing: true,
59399
59445
  variant: variant,
59400
59446
  mode: mode,
59401
59447
  focusCapture: focusCapture,
@@ -60264,7 +60310,7 @@ installImportMetaCssBuild(import.meta);const css$y = /* css */`@layer navi {
60264
60310
  --x-list-item-cursor: default;
60265
60311
  --x-list-item-border-color: var(--list-item-border-color);
60266
60312
  font-size: var(--navi-control-font-size);
60267
- font-family: var(--navi-control-font-family);
60313
+ font-family: var(--navi-control-font-family, inherit);
60268
60314
  line-height: var(--navi-control-line-height);
60269
60315
  position: relative;
60270
60316
  }
@@ -66707,7 +66753,7 @@ installImportMetaCssBuild(import.meta);const css$t = /* css */`@layer navi {
66707
66753
  --picker-padding-x-default: var(--navi-picker-padding-x-default);
66708
66754
  --picker-padding-y-default: var(--navi-picker-padding-y-default);
66709
66755
  --picker-font-size: var(--navi-control-font-size);
66710
- --picker-font-family: var(--navi-control-font-family);
66756
+ --picker-font-family: var(--navi-control-font-family, inherit);
66711
66757
  --picker-loader-color: var(--navi-loader-color);
66712
66758
  --picker-border-color: var(--navi-control-border-color);
66713
66759
  --picker-background-color: white;
@@ -66807,6 +66853,7 @@ installImportMetaCssBuild(import.meta);const css$t = /* css */`@layer navi {
66807
66853
  padding-bottom: var(--x-picker-padding-bottom);
66808
66854
  padding-left: var(--x-picker-padding-left);
66809
66855
  justify-content: inherit;
66856
+ text-align: var(--picker-align-x, var(--picker-text-align-default));
66810
66857
  pointer-events: none;
66811
66858
  user-select: none;
66812
66859
  flex-grow: 1;
@@ -66965,7 +67012,7 @@ installImportMetaCssBuild(import.meta);const css$t = /* css */`@layer navi {
66965
67012
  --picker-background-color-hover: var(--picker-background-color);
66966
67013
  --picker-background-color-readonly: var(--picker-background-color);
66967
67014
  --picker-background-color-disabled: var(--picker-background-color);
66968
- --x-picker-icon-color: currentColor;
67015
+ --picker-icon-color: currentColor;
66969
67016
 
66970
67017
  & .navi_picker_value {
66971
67018
  flex-grow: 0;
@@ -66998,7 +67045,7 @@ installImportMetaCssBuild(import.meta);const css$t = /* css */`@layer navi {
66998
67045
  --picker-background-color-hover: var(--picker-background-color);
66999
67046
  --picker-background-color-readonly: var(--picker-background-color);
67000
67047
  --picker-background-color-disabled: var(--picker-background-color);
67001
- --x-picker-icon-color: currentColor;
67048
+ --picker-icon-color: currentColor;
67002
67049
 
67003
67050
  & .navi_picker_box {
67004
67051
  z-index: -1;
@@ -67020,7 +67067,7 @@ installImportMetaCssBuild(import.meta);const css$t = /* css */`@layer navi {
67020
67067
  --picker-background-color-hover: var(--picker-background-color);
67021
67068
  --picker-background-color-readonly: var(--picker-background-color);
67022
67069
  --picker-background-color-disabled: var(--picker-background-color);
67023
- --x-picker-icon-color: currentColor;
67070
+ --picker-icon-color: currentColor;
67024
67071
  font-size: inherit;
67025
67072
  font-family: inherit;
67026
67073
  line-height: inherit;
@@ -67045,7 +67092,7 @@ installImportMetaCssBuild(import.meta);const css$t = /* css */`@layer navi {
67045
67092
  --picker-border-color-disabled: var(--picker-border-color-readonly);
67046
67093
  --picker-background-color-disabled: var(--picker-background-color-readonly);
67047
67094
  --picker-color-disabled: var(--picker-color-readonly);
67048
- text-align: center;
67095
+ --picker-text-align-default: center;
67049
67096
  }
67050
67097
 
67051
67098
  &[data-variant="text"] {
@@ -67111,6 +67158,11 @@ const PickerButton = props => {
67111
67158
  // not come back. The cross is then a confirm picker (see
67112
67159
  // picker_confirm.jsx), and the clear only goes out on yes.
67113
67160
  clearConfirm,
67161
+ // Nothing is picked here: the popup asks a question rather than holding an
67162
+ // answer, so the trigger draws a label and never a value. Set by the
67163
+ // confirm resolver (see picker_confirm.jsx), which is the picker that is
67164
+ // one — a caller whose popup is a menu of actions says it for themselves.
67165
+ picksNothing,
67114
67166
  readOnly,
67115
67167
  error
67116
67168
  } = props;
@@ -67124,17 +67176,19 @@ const PickerButton = props => {
67124
67176
  const isSingleLine = maxLines === 1;
67125
67177
  // Same rule as the root: phrasing content inside a sentence.
67126
67178
  const ContentTag = variant === "text" ? "span" : "div";
67127
- // Which variants get the right slot — the chevron saying "this opens", and
67128
- // the cross replacing it once there is something to clear.
67129
- // Not the ones that draw no value beside it: an icon picker IS its icon, a
67130
- // headless one draws nothing, a button says what it opens with its label, a
67179
+ // Who gets the right slot — the chevron saying "this opens", and the cross
67180
+ // replacing it once there is something to clear. Both are about a value, so
67181
+ // the slot follows the value and not the drawing: `picksNothing` has none to
67182
+ // announce and none to take back, whatever variant it is drawn in.
67183
+ // Then the variants that draw no value beside it: an icon picker IS its icon,
67184
+ // a headless one draws nothing, a button says what it opens with its label, a
67131
67185
  // word in a sentence has no room for furniture. Nor a picker rendering the
67132
67186
  // browser's own control ("default").
67133
67187
  // Nor a bare one: the picker is that drawing's box to the pixel, so anything
67134
67188
  // navi adds beside it either grows the box or covers what the caller drew.
67135
67189
  // The pieces are the caller's to place there instead — a <Picker.Clear /> in
67136
67190
  // their own layout (see warnOnClearableWithoutSlot).
67137
- const hasRightSlot = variant !== "icon" && variant !== "headless" && variant !== "button" && variant !== "text" && variant !== "bare" && ui !== "default";
67191
+ const hasRightSlot = !picksNothing && variant !== "icon" && variant !== "headless" && variant !== "button" && variant !== "text" && variant !== "bare" && ui !== "default";
67138
67192
  const inputRef = useRef(null);
67139
67193
  const [pickerRemainingProps, inputProps, facadeChildrenProps] = useControlFacadeProps({
67140
67194
  ...props,
@@ -67213,6 +67267,7 @@ const PickerButton = props => {
67213
67267
  rightSlotIconSize: undefined,
67214
67268
  rightSlot: undefined,
67215
67269
  clearConfirm: undefined,
67270
+ picksNothing: undefined,
67216
67271
  openWhileReadOnly: undefined,
67217
67272
  ui: undefined,
67218
67273
  maxLines: undefined,
@@ -67765,7 +67820,7 @@ const css$s = /* css */`@layer navi {
67765
67820
  --x-picker-spin-padding-bottom: var(--picker-spin-padding-bottom, var(--picker-spin-padding-y, var(--picker-spin-padding, var(--picker-spin-padding-y-default))));
67766
67821
  --x-picker-spin-padding-left: var(--picker-spin-padding-left, var(--picker-spin-padding-x, var(--picker-spin-padding, var(--picker-spin-padding-x-default))));
67767
67822
  font-size: var(--navi-control-font-size);
67768
- font-family: var(--navi-control-font-family);
67823
+ font-family: var(--navi-control-font-family, inherit);
67769
67824
  border: var(--navi-control-border-width) solid
67770
67825
  var(--navi-control-border-color);
67771
67826
  border-top-left-radius: var(--x-corner-top-left-radius, var(--navi-control-border-radius));
@@ -67915,7 +67970,7 @@ const css$s = /* css */`@layer navi {
67915
67970
 
67916
67971
  .navi_spin_group {
67917
67972
  font-size: var(--navi-control-font-size);
67918
- font-family: var(--navi-control-font-family);
67973
+ font-family: var(--navi-control-font-family, inherit);
67919
67974
  border: var(--navi-control-border-width) solid
67920
67975
  var(--navi-control-border-color);
67921
67976
  border-top-left-radius: var(--x-corner-top-left-radius, var(--navi-control-border-radius));
@@ -70813,7 +70868,7 @@ const css$m = /* css */`.navi_wheel_container {
70813
70868
  transparent);
70814
70869
  color: var(--wheel-color);
70815
70870
  font-size: var(--navi-control-font-size);
70816
- font-family: var(--navi-control-font-family);
70871
+ font-family: var(--navi-control-font-family, inherit);
70817
70872
  border: var(--navi-control-border-width) solid
70818
70873
  var(--navi-control-border-color);
70819
70874
  border-radius: var(--navi-control-border-radius);
@@ -71103,7 +71158,7 @@ const css$m = /* css */`.navi_wheel_container {
71103
71158
  color: var(--wheel-color, light-dark(#111, #eee));
71104
71159
  font-weight: 600;
71105
71160
  font-size: var(--navi-control-font-size);
71106
- font-family: var(--navi-control-font-family);
71161
+ font-family: var(--navi-control-font-family, inherit);
71107
71162
  white-space: nowrap;
71108
71163
  user-select: none;
71109
71164
  justify-content: center;
@@ -75864,7 +75919,6 @@ const css$g = /* css */`.navi_table_root {
75864
75919
 
75865
75920
  .navi_table {
75866
75921
  --editing-border-color: #a8c7fa;
75867
- font-family: Arial;
75868
75922
  font-size: 16px;
75869
75923
  }
75870
75924