@jsenv/navi 0.23.1 → 0.23.3

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.
@@ -6303,21 +6303,16 @@ const DIMENSION_PROPS = {
6303
6303
  if (selfHorizontalFlexFlow || inHorizontalFlexFlow) {
6304
6304
  if (!inHorizontalFlexFlow) {
6305
6305
  if (parentBoxFlow === "flex-y" || parentBoxFlow === "inline-flex-y") {
6306
- return { minWidth: "100%", width: "auto" };
6306
+ return { alignSelf: "stretch" };
6307
6307
  }
6308
- return {
6309
- flexGrow: 1,
6310
- flexBasis: "0%",
6311
- minWidth: "100%",
6312
- width: "auto",
6313
- };
6308
+ return { flexGrow: 1, flexBasis: "0%" };
6314
6309
  }
6315
6310
  return { flexGrow: 1, flexBasis: "0%" }; // Grow horizontally in column
6316
6311
  }
6317
- if (parentBoxFlow === "flex-y") {
6318
- return { minWidth: "100%", width: "auto" }; // Take full width in row
6312
+ if (parentBoxFlow === "flex-y" || parentBoxFlow === "inline-flex-y") {
6313
+ return { alignSelf: "stretch" }; // Stretch to cross-axis width in flex-y
6319
6314
  }
6320
- return { minWidth: "100%", width: "auto" }; // Take full width outside flex
6315
+ return { width: "100%" }; // Take full width outside flex
6321
6316
  },
6322
6317
  expandY: (value, { parentBoxFlow, boxFlow }) => {
6323
6318
  if (!value) {
@@ -6334,19 +6329,14 @@ const DIMENSION_PROPS = {
6334
6329
  if (inHorizontalFlexFlow) {
6335
6330
  return { alignSelf: "stretch" };
6336
6331
  }
6337
- return {
6338
- flexGrow: 1,
6339
- flexBasis: "0%",
6340
- minHeight: "100%",
6341
- height: "auto",
6342
- };
6332
+ return { flexGrow: 1, flexBasis: "0%" };
6343
6333
  }
6344
6334
  return { flexGrow: 1, flexBasis: "0%" }; // Grow vertically in row
6345
6335
  }
6346
6336
  if (inHorizontalFlexFlow) {
6347
6337
  return { alignSelf: "stretch" }; // Stretch to cross-axis height in flex-x
6348
6338
  }
6349
- return { minHeight: "100%", height: "auto" }; // Take full height outside flex
6339
+ return { height: "100%" }; // Take full height outside flex
6350
6340
  },
6351
6341
  shrinkX: (value) => {
6352
6342
  if (!value || value === "0") {
@@ -6929,6 +6919,8 @@ const getDefaultDisplay = (tagName) => {
6929
6919
  return TAG_NAME_TO_DEFAULT_DISPLAY.get(normalizedTagName) || "inline";
6930
6920
  };
6931
6921
 
6922
+ const pressedElements = new WeakSet();
6923
+
6932
6924
  const PSEUDO_CLASSES = {
6933
6925
  ":hover": {
6934
6926
  attribute: "data-hover",
@@ -6986,15 +6978,58 @@ const PSEUDO_CLASSES = {
6986
6978
  ":active": {
6987
6979
  attribute: "data-active",
6988
6980
  setup: (el, callback) => {
6989
- el.addEventListener("mousedown", callback);
6990
- document.addEventListener("mouseup", callback);
6981
+ const onPointerDown = (e) => {
6982
+ el.setPointerCapture(e.pointerId);
6983
+ const onRelease = () => {
6984
+ el.releasePointerCapture(e.pointerId);
6985
+ el.removeEventListener("lostpointercapture", onRelease);
6986
+ el.removeEventListener("pointercancel", onRelease);
6987
+ el.removeEventListener("pointerup", onRelease);
6988
+ callback();
6989
+ };
6990
+ el.addEventListener("lostpointercapture", onRelease);
6991
+ el.addEventListener("pointercancel", onRelease);
6992
+ el.addEventListener("pointerup", onRelease);
6993
+ callback();
6994
+ };
6995
+ el.addEventListener("pointerdown", onPointerDown);
6991
6996
  return () => {
6992
- el.removeEventListener("mousedown", callback);
6993
- document.removeEventListener("mouseup", callback);
6997
+ el.removeEventListener("pointerdown", onPointerDown);
6994
6998
  };
6995
6999
  },
6996
7000
  test: (el) => el.matches(":active"),
6997
7001
  },
7002
+ ":-navi-pressed": {
7003
+ attribute: "data-pressed",
7004
+ setup: (el, callback) => {
7005
+ const onPointerDown = (e) => {
7006
+ if (e.button !== 0) {
7007
+ // only left pointer (mouse left click, touch, pen)
7008
+ return;
7009
+ }
7010
+ pressedElements.add(el);
7011
+ el.setPointerCapture(e.pointerId);
7012
+ const onRelease = () => {
7013
+ pressedElements.delete(el);
7014
+ el.releasePointerCapture(e.pointerId);
7015
+ el.removeEventListener("lostpointercapture", onRelease);
7016
+ el.removeEventListener("pointercancel", onRelease);
7017
+ el.removeEventListener("pointerup", onRelease);
7018
+ callback();
7019
+ };
7020
+ el.addEventListener("lostpointercapture", onRelease);
7021
+ el.addEventListener("pointercancel", onRelease);
7022
+ el.addEventListener("pointerup", onRelease);
7023
+ callback();
7024
+ };
7025
+ el.addEventListener("pointerdown", onPointerDown);
7026
+ return () => {
7027
+ el.removeEventListener("pointerdown", onPointerDown);
7028
+ pressedElements.delete(el);
7029
+ };
7030
+ },
7031
+ test: (el) => pressedElements.has(el),
7032
+ },
6998
7033
  ":visited": {
6999
7034
  attribute: "data-visited",
7000
7035
  },
@@ -21446,8 +21481,8 @@ installImportMetaCssBuild(import.meta);const css$r = /* css */`
21446
21481
  black
21447
21482
  );
21448
21483
  --button-color-hover: var(--button-color);
21449
- /* Active */
21450
- --button-border-color-active: color-mix(
21484
+ /* Pressed */
21485
+ --button-border-color-pressed: color-mix(
21451
21486
  in srgb,
21452
21487
  var(--button-border-color) 90%,
21453
21488
  black
@@ -21497,6 +21532,9 @@ installImportMetaCssBuild(import.meta);const css$r = /* css */`
21497
21532
  border-radius: var(--x-button-border-radius);
21498
21533
  outline: none;
21499
21534
  cursor: var(--x-button-cursor);
21535
+ -webkit-tap-highlight-color: transparent;
21536
+ touch-action: manipulation;
21537
+ user-select: none;
21500
21538
 
21501
21539
  &[data-icon] {
21502
21540
  --button-padding: 0;
@@ -21587,16 +21625,16 @@ installImportMetaCssBuild(import.meta);const css$r = /* css */`
21587
21625
  --x-button-background-color: var(--button-background-color);
21588
21626
  --x-button-color: var(--button-color);
21589
21627
  }
21590
- /* Active */
21591
- &[data-active] {
21592
- --x-button-outline-color: var(--button-border-color-active);
21628
+ /* Pressed */
21629
+ &[data-pressed] {
21630
+ --x-button-outline-color: var(--button-border-color-pressed);
21593
21631
  }
21594
- &[data-active] {
21632
+ &[data-pressed] {
21595
21633
  .navi_button_content {
21596
21634
  transform: scale(0.9);
21597
21635
  }
21598
21636
  }
21599
- &[data-active] {
21637
+ &[data-pressed] {
21600
21638
  .navi_button_shadow {
21601
21639
  box-shadow:
21602
21640
  inset 0 3px 6px rgba(0, 0, 0, 0.2),
@@ -21632,7 +21670,7 @@ installImportMetaCssBuild(import.meta);const css$r = /* css */`
21632
21670
 
21633
21671
  color: unset;
21634
21672
 
21635
- /* Remove active effects */
21673
+ /* Remove pressed effects */
21636
21674
  .navi_button_content {
21637
21675
  transform: none;
21638
21676
 
@@ -21694,8 +21732,8 @@ const ButtonStyleCSSVars = {
21694
21732
  borderColor: "--button-border-color-hover",
21695
21733
  color: "--button-color-hover"
21696
21734
  },
21697
- ":active": {
21698
- borderColor: "--button-border-color-active"
21735
+ ":-navi-pressed": {
21736
+ borderColor: "--button-border-color-pressed"
21699
21737
  },
21700
21738
  ":read-only": {
21701
21739
  backgroundColor: "--button-background-color-readonly",
@@ -21708,7 +21746,7 @@ const ButtonStyleCSSVars = {
21708
21746
  color: "--button-color-disabled"
21709
21747
  }
21710
21748
  };
21711
- const ButtonPseudoClasses = [":hover", ":active", ":focus", ":focus-visible", ":read-only", ":disabled", ":-navi-loading"];
21749
+ const ButtonPseudoClasses = [":hover", ":active", ":-navi-pressed", ":focus", ":focus-visible", ":read-only", ":disabled", ":-navi-loading"];
21712
21750
  const ButtonPseudoElements = ["::-navi-loader"];
21713
21751
  const ButtonBasic = props => {
21714
21752
  const contextLoading = useContext(LoadingContext);
@@ -21749,6 +21787,16 @@ const ButtonBasic = props => {
21749
21787
  ...remainingProps,
21750
21788
  as: "button",
21751
21789
  ref: ref,
21790
+ onContextMenu: e => {
21791
+ if (e.pointerType === "touch") {
21792
+ // Suppress the native context menu triggered by long-press on touch devices.
21793
+ // Buttons have no meaningful context menu (no text to copy/paste/search),
21794
+ // and the long-press visual state would get stuck if we let the menu open.
21795
+ // Note: e.button === -1 is equivalent — it means no physical button triggered
21796
+ // the event, i.e. it was synthesized from a long-press gesture (right-click gives e.button === 2).
21797
+ e.preventDefault();
21798
+ }
21799
+ },
21752
21800
  "data-icon": icon ? "" : undefined,
21753
21801
  "data-reveal-on-interaction": revealOnInteraction ? "" : undefined,
21754
21802
  "data-discrete": discrete ? "" : undefined,
@@ -22243,7 +22291,7 @@ const css$q = /* css */`
22243
22291
  --link-color: rgb(0, 0, 238);
22244
22292
  --link-color-visited: color-mix(in srgb, var(--link-color), black 40%);
22245
22293
 
22246
- --link-color-active: red;
22294
+ --link-color-pressed: red;
22247
22295
  --link-text-decoration: underline;
22248
22296
  --link-text-decoration-hover: var(--link-text-decoration);
22249
22297
  --link-cursor: pointer;
@@ -22278,7 +22326,7 @@ const css$q = /* css */`
22278
22326
  --x-link-color-hover: var(--link-color-hover, var(--link-color));
22279
22327
  --x-link-color-visited: var(--link-color-visited);
22280
22328
  --x-link-color-current: var(--link-color-current);
22281
- --x-link-color-active: var(--link-color-active);
22329
+ --x-link-color-pressed: var(--link-color-pressed);
22282
22330
  --x-link-text-decoration: var(--link-text-decoration);
22283
22331
  --x-link-text-decoration-hover: var(--link-text-decoration-hover);
22284
22332
  --x-link-cursor: var(--link-cursor);
@@ -22372,10 +22420,10 @@ const css$q = /* css */`
22372
22420
  &[data-focus-visible] {
22373
22421
  outline-width: 2px;
22374
22422
  }
22375
- /* Active */
22376
- &[data-active] {
22423
+ /* Pressed */
22424
+ &[data-pressed] {
22377
22425
  /* Redefine it otherwise [data-visited] prevails */
22378
- --x-link-color: var(--x-link-color-active);
22426
+ --x-link-color: var(--x-link-color-pressed);
22379
22427
  }
22380
22428
  /* Current */
22381
22429
  &[data-href-current] {
@@ -22518,8 +22566,8 @@ const LinkStyleCSSVars = {
22518
22566
  color: "--link-color-hover",
22519
22567
  textDecoration: "--link-text-decoration-hover"
22520
22568
  },
22521
- ":active": {
22522
- color: "--link-color-active"
22569
+ ":-navi-pressed": {
22570
+ color: "--link-color-pressed"
22523
22571
  },
22524
22572
  ":-navi-href-current": {
22525
22573
  background: "--link-background-current",
@@ -22532,7 +22580,7 @@ const LinkStyleCSSVars = {
22532
22580
  color: "--link-color-selected"
22533
22581
  }
22534
22582
  };
22535
- const LinkPseudoClasses = [":hover", ":active", ":focus", ":focus-visible", ":read-only", ":disabled", ":visited", ":-navi-loading", ":-navi-href-internal", ":-navi-href-external", ":-navi-href-anchor", ":-navi-href-current", ":-navi-selected"];
22583
+ const LinkPseudoClasses = [":hover", ":active", ":-navi-pressed", ":focus", ":focus-visible", ":read-only", ":disabled", ":visited", ":-navi-loading", ":-navi-href-internal", ":-navi-href-external", ":-navi-href-anchor", ":-navi-href-current", ":-navi-selected"];
22536
22584
  const LinkPseudoElements = ["::-navi-loader", "::-navi-indicator"];
22537
22585
  Object.assign(PSEUDO_CLASSES, {
22538
22586
  ":-navi-href-internal": {
@@ -24870,20 +24918,20 @@ installImportMetaCssBuild(import.meta);const css$j = /* css */`
24870
24918
  --track-color-hover: color-mix(in srgb, var(--fill-color) 95%, black);
24871
24919
  --fill-color-hover: color-mix(in srgb, var(--fill-color) 80%, black);
24872
24920
  --thumb-color-hover: color-mix(in srgb, var(--thumb-color) 80%, black);
24873
- /* Active */
24874
- --border-color-active: color-mix(
24921
+ /* Pressed */
24922
+ --border-color-pressed: color-mix(
24875
24923
  in srgb,
24876
24924
  var(--border-color) 50%,
24877
24925
  transparent
24878
24926
  );
24879
- --track-border-color-active: var(--border-color-active);
24880
- --background-color-active: color-mix(
24927
+ --track-border-color-pressed: var(--border-color-pressed);
24928
+ --background-color-pressed: color-mix(
24881
24929
  in srgb,
24882
24930
  var(--background-color) 75%,
24883
24931
  white
24884
24932
  );
24885
- --fill-color-active: color-mix(in srgb, var(--fill-color) 75%, white);
24886
- --thumb-color-active: color-mix(in srgb, var(--thumb-color) 75%, white);
24933
+ --fill-color-pressed: color-mix(in srgb, var(--fill-color) 75%, white);
24934
+ --thumb-color-pressed: color-mix(in srgb, var(--thumb-color) 75%, white);
24887
24935
  /* Readonly */
24888
24936
  --border-color-readonly: color-mix(
24889
24937
  in srgb,
@@ -25001,13 +25049,13 @@ installImportMetaCssBuild(import.meta);const css$j = /* css */`
25001
25049
  --x-fill-color: var(--fill-color-hover);
25002
25050
  --x-thumb-color: var(--thumb-color-hover);
25003
25051
  }
25004
- /* Active */
25005
- &[data-active] {
25006
- --x-border-color: var(--border-color-active);
25007
- --x-track-border-color: var(--track-border-color-active);
25008
- --x-background-color: var(--background-color-active);
25009
- --x-fill-color: var(--fill-color-active);
25010
- --x-thumb-color: var(--thumb-color-active);
25052
+ /* Pressed */
25053
+ &[data-pressed] {
25054
+ --x-border-color: var(--border-color-pressed);
25055
+ --x-track-border-color: var(--track-border-color-pressed);
25056
+ --x-background-color: var(--background-color-pressed);
25057
+ --x-fill-color: var(--fill-color-pressed);
25058
+ --x-thumb-color: var(--thumb-color-pressed);
25011
25059
  }
25012
25060
  /* Focus */
25013
25061
  &[data-focus-visible] {
@@ -25071,11 +25119,11 @@ const RangeStyleCSSVars = {
25071
25119
  fillColor: "--fill-color-hover",
25072
25120
  thumbColor: "--thumb-color-hover"
25073
25121
  },
25074
- ":active": {
25122
+ ":-navi-pressed": {
25075
25123
  borderColor: "--border-color-hover",
25076
25124
  backgroundColor: "--background-color-hover",
25077
- fillColor: "--fill-color-active",
25078
- thumbColor: "--thumb-color-active"
25125
+ fillColor: "--fill-color-pressed",
25126
+ thumbColor: "--thumb-color-pressed"
25079
25127
  },
25080
25128
  ":read-only": {
25081
25129
  borderColor: "--border-color-readonly",
@@ -25090,7 +25138,7 @@ const RangeStyleCSSVars = {
25090
25138
  thumbColor: "--thumb-color-disabled"
25091
25139
  }
25092
25140
  };
25093
- const RangePseudoClasses = [":hover", ":active", ":focus", ":focus-visible", ":read-only", ":disabled", ":-navi-loading"];
25141
+ const RangePseudoClasses = [":hover", ":active", ":-navi-pressed", ":focus", ":focus-visible", ":read-only", ":disabled", ":-navi-loading"];
25094
25142
  const RangePseudoElements = ["::-navi-loader"];
25095
25143
  const RangeChildPropSet = new Set([...fieldPropSet]);
25096
25144
  const InputRangeBasic = props => {