@jsenv/navi 0.27.8 → 0.27.10

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.
@@ -6387,7 +6387,7 @@ const applyOnTwoProps = (propA, propB) => {
6387
6387
  };
6388
6388
  };
6389
6389
 
6390
- const FLOW_PROPS = {
6390
+ const LAYOUT_PROPS = {
6391
6391
  // all are handled by navi-attributes
6392
6392
  inline: () => {},
6393
6393
  block: () => {},
@@ -6398,12 +6398,8 @@ const FLOW_PROPS = {
6398
6398
  display: PASS_THROUGH, // in case people write "display: none" (even if hidden prop is recommended)
6399
6399
  row: () => {},
6400
6400
  column: () => {},
6401
-
6402
- // not really related to flow but should be on the container element if any
6403
- pointerEvents: PASS_THROUGH,
6404
- viewTransitionName: PASS_THROUGH,
6405
6401
  };
6406
- const OUTER_SPACING_PROPS = {
6402
+ const OUTER_PROPS = {
6407
6403
  margin: PASS_THROUGH,
6408
6404
  marginLeft: PASS_THROUGH,
6409
6405
  marginRight: PASS_THROUGH,
@@ -6411,8 +6407,12 @@ const OUTER_SPACING_PROPS = {
6411
6407
  marginBottom: PASS_THROUGH,
6412
6408
  marginX: applyOnTwoCSSProps("marginLeft", "marginRight"),
6413
6409
  marginY: applyOnTwoCSSProps("marginTop", "marginBottom"),
6410
+
6411
+ // not really related to flow but should be on the container element if any
6412
+ pointerEvents: PASS_THROUGH,
6413
+ viewTransitionName: PASS_THROUGH,
6414
6414
  };
6415
- const INNER_SPACING_PROPS = {
6415
+ const INNER_PROPS = {
6416
6416
  padding: PASS_THROUGH,
6417
6417
  paddingLeft: PASS_THROUGH,
6418
6418
  paddingRight: PASS_THROUGH,
@@ -6506,13 +6506,13 @@ const DIMENSION_PROPS = {
6506
6506
  if (!value || value === "0") {
6507
6507
  return { flexShrink: 0 };
6508
6508
  }
6509
- return { flexShrink: 1 };
6509
+ return { flexShrink: 1, minWidth: 0 };
6510
6510
  },
6511
6511
  shrinkY: (value) => {
6512
6512
  if (!value || value === "0") {
6513
6513
  return { flexShrink: 0 };
6514
6514
  }
6515
- return { flexShrink: 1 };
6515
+ return { flexShrink: 1, minHeight: 0 };
6516
6516
  },
6517
6517
 
6518
6518
  scaleX: (value) => {
@@ -6692,6 +6692,27 @@ const TYPO_PROPS = {
6692
6692
  uppercase: applyToCssPropWhenTruthy("textTransform", "uppercase", "none"),
6693
6693
  lowercase: applyToCssPropWhenTruthy("textTransform", "lowercase", "none"),
6694
6694
  letterSpacing: PASS_THROUGH,
6695
+ overflowEllipsis: (value) => {
6696
+ if (!value) {
6697
+ return null;
6698
+ }
6699
+ return {
6700
+ overflow: "hidden",
6701
+ textOverflow: "ellipsis",
6702
+ overflowWrap: "normal",
6703
+ };
6704
+ },
6705
+ lineClamp: (value) => {
6706
+ if (!value) {
6707
+ return null;
6708
+ }
6709
+ return {
6710
+ "overflow": "hidden",
6711
+ "display": "-webkit-box",
6712
+ "-webkit-box-orient": "vertical",
6713
+ "-webkit-line-clamp": value,
6714
+ };
6715
+ },
6695
6716
  };
6696
6717
  const VISUAL_PROPS = {
6697
6718
  outline: PASS_THROUGH,
@@ -6725,13 +6746,6 @@ const VISUAL_PROPS = {
6725
6746
  overflow: PASS_THROUGH,
6726
6747
  overflowX: PASS_THROUGH,
6727
6748
  overflowY: PASS_THROUGH,
6728
- overflowEllipsis: () => {
6729
- return {
6730
- overflow: "hidden",
6731
- textOverflow: "ellipsis",
6732
- overflowWrap: "normal",
6733
- };
6734
- },
6735
6749
  objectFit: PASS_THROUGH,
6736
6750
  accentColor: PASS_THROUGH,
6737
6751
  };
@@ -6775,7 +6789,7 @@ const CONTENT_PROPS = {
6775
6789
  };
6776
6790
  },
6777
6791
  spacing: (value, { boxFlow }) => {
6778
- if (isSpacingHandledByFlow(boxFlow)) {
6792
+ if (isSpacingHandledByLayout(boxFlow)) {
6779
6793
  return {
6780
6794
  gap: stringifySpacingStyle(value, "gap"),
6781
6795
  };
@@ -6809,7 +6823,7 @@ const CONTENT_PROPS = {
6809
6823
  return undefined;
6810
6824
  },
6811
6825
  };
6812
- const flowSpacingHandlerSet = new Set([
6826
+ const LAYOUT_HANDLING_SPACING_SET = new Set([
6813
6827
  "flex-x",
6814
6828
  "flex-y",
6815
6829
  "inline-flex-x",
@@ -6817,36 +6831,58 @@ const flowSpacingHandlerSet = new Set([
6817
6831
  "grid",
6818
6832
  "inline-grid",
6819
6833
  ]);
6820
- const isSpacingHandledByFlow = (boxFlow) => {
6821
- return flowSpacingHandlerSet.has(boxFlow);
6834
+ const isSpacingHandledByLayout = (boxFlow) => {
6835
+ return LAYOUT_HANDLING_SPACING_SET.has(boxFlow);
6822
6836
  };
6823
6837
 
6824
6838
  const All_PROPS = {
6825
- ...FLOW_PROPS,
6826
- ...OUTER_SPACING_PROPS,
6827
- ...INNER_SPACING_PROPS,
6839
+ ...LAYOUT_PROPS,
6840
+ ...OUTER_PROPS,
6841
+ ...INNER_PROPS,
6828
6842
  ...DIMENSION_PROPS,
6829
6843
  ...POSITION_PROPS,
6830
6844
  ...TYPO_PROPS,
6831
6845
  ...VISUAL_PROPS,
6832
6846
  ...CONTENT_PROPS,
6833
6847
  };
6834
- const FLOW_PROP_NAME_SET = new Set(Object.keys(FLOW_PROPS));
6835
- const OUTER_SPACING_PROP_NAME_SET = new Set(Object.keys(OUTER_SPACING_PROPS));
6836
- const INNER_SPACING_PROP_NAME_SET = new Set(Object.keys(INNER_SPACING_PROPS));
6837
- const DIMENSION_PROP_NAME_SET = new Set(Object.keys(DIMENSION_PROPS));
6838
- const POSITION_PROP_NAME_SET = new Set(Object.keys(POSITION_PROPS));
6848
+ const LAYOUT_PROP_NAME_SET = new Set(Object.keys(LAYOUT_PROPS));
6849
+ // const OUTER_PROP_NAME_SET = new Set(Object.keys(OUTER_PROPS));
6850
+ const INNER_PROP_NAME_SET = new Set(Object.keys(INNER_PROPS));
6851
+ // const DIMENSION_PROP_NAME_SET = new Set(Object.keys(DIMENSION_PROPS));
6852
+ // const POSITION_PROP_NAME_SET = new Set(Object.keys(POSITION_PROPS));
6839
6853
  const TYPO_PROP_NAME_SET = new Set(Object.keys(TYPO_PROPS));
6840
6854
  const VISUAL_PROP_NAME_SET = new Set(Object.keys(VISUAL_PROPS));
6841
6855
  const CONTENT_PROP_NAME_SET = new Set(Object.keys(CONTENT_PROPS));
6842
6856
  const STYLE_PROP_NAME_SET = new Set(Object.keys(All_PROPS));
6857
+ const SPACING_PROP_SET = new Set([
6858
+ "borderRadius",
6859
+ "spacing",
6860
+ "spacingX",
6861
+ "spacingY",
6862
+ "margin",
6863
+ "marginLeft",
6864
+ "marginRight",
6865
+ "marginTop",
6866
+ "marginBottom",
6867
+ "marginX",
6868
+ "marginY",
6869
+ "padding",
6870
+ "paddingLeft",
6871
+ "paddingRight",
6872
+ "paddingTop",
6873
+ "paddingBottom",
6874
+ "paddingX",
6875
+ "paddingY",
6876
+ ]);
6843
6877
 
6844
6878
  const COPIED_ON_VISUAL_CHILD_PROP_SET = new Set([
6845
- ...FLOW_PROP_NAME_SET,
6879
+ ...LAYOUT_PROP_NAME_SET,
6846
6880
  "expand",
6847
6881
  "expandX",
6848
6882
  "expandY",
6849
6883
  "shrink",
6884
+ "shrinkX",
6885
+ "shrinkY",
6850
6886
  "align",
6851
6887
  "alignX",
6852
6888
  "alignY",
@@ -6854,7 +6890,7 @@ const COPIED_ON_VISUAL_CHILD_PROP_SET = new Set([
6854
6890
  "minHeight",
6855
6891
  ]);
6856
6892
  const HANDLED_BY_VISUAL_CHILD_PROP_SET = new Set([
6857
- ...INNER_SPACING_PROP_NAME_SET,
6893
+ ...INNER_PROP_NAME_SET,
6858
6894
  ...VISUAL_PROP_NAME_SET,
6859
6895
  ...CONTENT_PROP_NAME_SET,
6860
6896
  ]);
@@ -6870,47 +6906,11 @@ const getVisualChildStylePropStrategy = (name) => {
6870
6906
 
6871
6907
  const isStyleProp = (name) => STYLE_PROP_NAME_SET.has(name);
6872
6908
 
6873
- const getStylePropGroup = (name) => {
6874
- if (FLOW_PROP_NAME_SET.has(name)) {
6875
- return "flow";
6876
- }
6877
- if (OUTER_SPACING_PROP_NAME_SET.has(name)) {
6878
- return "margin";
6879
- }
6880
- if (INNER_SPACING_PROP_NAME_SET.has(name)) {
6881
- return "padding";
6882
- }
6883
- if (DIMENSION_PROP_NAME_SET.has(name)) {
6884
- return "dimension";
6885
- }
6886
- if (POSITION_PROP_NAME_SET.has(name)) {
6887
- return "position";
6888
- }
6889
- if (TYPO_PROP_NAME_SET.has(name)) {
6890
- return "typo";
6891
- }
6892
- if (VISUAL_PROP_NAME_SET.has(name)) {
6893
- return "visual";
6894
- }
6895
- if (CONTENT_PROP_NAME_SET.has(name)) {
6896
- return "content";
6897
- }
6898
- return null;
6899
- };
6900
6909
  const getStringifier = (key) => {
6901
- if (
6902
- key === "borderRadius" ||
6903
- key === "spacing" ||
6904
- key === "spacingX" ||
6905
- key === "spacingY"
6906
- ) {
6910
+ if (SPACING_PROP_SET.has(key)) {
6907
6911
  return stringifySpacingStyle;
6908
6912
  }
6909
- const group = getStylePropGroup(key);
6910
- if (group === "margin" || group === "padding") {
6911
- return stringifySpacingStyle;
6912
- }
6913
- if (group === "typo") {
6913
+ if (TYPO_PROP_NAME_SET.has(key)) {
6914
6914
  return stringifyTypoStyle;
6915
6915
  }
6916
6916
  return stringifyStyle;
@@ -12445,6 +12445,27 @@ const useUIStateController = (
12445
12445
  value: newUIState,
12446
12446
  });
12447
12447
  }
12448
+ // When this controller is a real input that has a visible proxy
12449
+ // (linked via `navi-control-proxy-for`), mirror the new state to the
12450
+ // proxy DOM synchronously. Otherwise the proxy would only catch up
12451
+ // later through a React re-render — visible as e.g. two radios
12452
+ // appearing checked at once between the real input update and the
12453
+ // next render (radio_sibling_uncheck case).
12454
+ if (el && !controlProxyFor) {
12455
+ const proxyEl = findControlProxy(el);
12456
+ if (proxyEl) {
12457
+ const propValue = uiStateController.getPropFromState(newUIState);
12458
+ proxyEl[statePropName] = propValue;
12459
+ // Also notify the proxy's controller so it can stay in sync with
12460
+ // state changes that originate from the real input (e.g. radio_sibling_uncheck).
12461
+ // Without this the proxy only learns about deselection later via state_prop
12462
+ // (Preact re-render), too late for lastActionValueRef to be updated.
12463
+ dispatchInternalCustomEvent(proxyEl, "navi_ui_state_change", {
12464
+ event: e,
12465
+ value: newUIState,
12466
+ });
12467
+ }
12468
+ }
12448
12469
  const internalBehavior = e.detail?.internalBehavior;
12449
12470
  if (internalBehavior) {
12450
12471
  return true;
@@ -33709,6 +33730,7 @@ const css$m = /* css */`
33709
33730
  );
33710
33731
 
33711
33732
  display: flex;
33733
+ min-width: 0;
33712
33734
  /* fit-content by default, but never wider than the parent */
33713
33735
  max-width: 100%;
33714
33736
  flex-direction: column;
@@ -33780,7 +33802,7 @@ const css$m = /* css */`
33780
33802
  --x-list-item-font-weight: var(--list-item-font-weight);
33781
33803
 
33782
33804
  box-sizing: border-box;
33783
- min-width: 100%;
33805
+ min-width: 0;
33784
33806
  max-width: 100%;
33785
33807
  padding: var(--list-item-padding);
33786
33808
  color: var(--x-list-item-color);
@@ -34979,6 +35001,10 @@ const css$l = /* css */`
34979
35001
  outline-color: var(--list-item-outline-color);
34980
35002
  outline-offset: var(--list-item-outline-offset);
34981
35003
 
35004
+ &[navi-selectable] {
35005
+ user-select: none;
35006
+ }
35007
+
34982
35008
  &[data-interactive] {
34983
35009
  cursor: pointer;
34984
35010
  user-select: none;
@@ -35373,6 +35399,7 @@ const Selectable = props => {
35373
35399
  },
35374
35400
  "aria-selected": checked,
35375
35401
  selected: checked,
35402
+ "navi-selectable": "",
35376
35403
  children: jsxs(Field, {
35377
35404
  as: selectableArea === "manual" ? "div" : undefined,
35378
35405
  padding: "m",
@@ -35672,7 +35699,6 @@ installImportMetaCssBuild(import.meta);const css$k = /* css */`
35672
35699
  font-size: var(--picker-font-size);
35673
35700
  text-align: inherit;
35674
35701
  text-overflow: ellipsis;
35675
- white-space: nowrap;
35676
35702
  background-color: var(--x-picker-background-color);
35677
35703
  border-width: var(--picker-border-width);
35678
35704
  border-style: solid;