@jsenv/navi 0.12.9 → 0.12.11

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.
@@ -1,5 +1,5 @@
1
1
  import { installImportMetaCss } from "./jsenv_navi_side_effects.js";
2
- import { createIterableWeakSet, createPubSub, createValueEffect, createStyleController, getVisuallyVisibleInfo, getFirstVisuallyVisibleAncestor, allowWheelThrough, resolveCSSColor, visibleRectEffect, pickPositionRelativeTo, getBorderSizes, getPaddingSizes, activeElementSignal, canInterceptKeys, createGroupTransitionController, getElementSignature, getBorderRadius, getBackground, preventIntermediateScrollbar, createOpacityTransition, stringifyStyle, mergeOneStyle, mergeTwoStyles, appendStyles, normalizeStyles, resolveCSSSize, findBefore, findAfter, initFocusGroup, elementIsFocusable, pickLightOrDark, resolveColorLuminance, dragAfterThreshold, getScrollContainer, stickyAsRelativeCoords, createDragToMoveGestureController, getDropTargetInfo, setStyles, useActiveElement } from "@jsenv/dom";
2
+ import { createIterableWeakSet, createPubSub, createValueEffect, createStyleController, getVisuallyVisibleInfo, getFirstVisuallyVisibleAncestor, allowWheelThrough, resolveCSSColor, visibleRectEffect, pickPositionRelativeTo, getBorderSizes, getPaddingSizes, activeElementSignal, canInterceptKeys, createGroupTransitionController, getElementSignature, getBorderRadius, getBackground, preventIntermediateScrollbar, createOpacityTransition, stringifyStyle, mergeOneStyle, mergeTwoStyles, normalizeStyles, resolveCSSSize, findBefore, findAfter, initFocusGroup, elementIsFocusable, pickLightOrDark, resolveColorLuminance, dragAfterThreshold, getScrollContainer, stickyAsRelativeCoords, createDragToMoveGestureController, getDropTargetInfo, setStyles, useActiveElement } from "@jsenv/dom";
3
3
  import { prefixFirstAndIndentRemainingLines } from "@jsenv/humanize";
4
4
  import { effect, signal, computed, batch, useSignal } from "@preact/signals";
5
5
  import { useEffect, useRef, useCallback, useContext, useState, useLayoutEffect, useMemo, useErrorBoundary, useImperativeHandle, useId } from "preact/hooks";
@@ -8734,58 +8734,58 @@ import.meta.css = /* css */ `
8734
8734
  }
8735
8735
 
8736
8736
  .ui_transition,
8737
- .active_group,
8738
- .previous_group,
8739
- .target_slot,
8740
- .previous_target_slot,
8741
- .outgoing_slot,
8742
- .previous_outgoing_slot {
8737
+ .ui_transition_active_group,
8738
+ .ui_transition_previous_group,
8739
+ .ui_transition_target_slot,
8740
+ .ui_transition_previous_target_slot,
8741
+ .ui_transition_outgoing_slot,
8742
+ .ui_transition_previous_outgoing_slot {
8743
8743
  width: 100%;
8744
8744
  height: 100%;
8745
8745
  }
8746
8746
 
8747
- .target_slot,
8748
- .outgoing_slot,
8749
- .previous_target_slot,
8750
- .previous_outgoing_slot {
8747
+ .ui_transition_target_slot,
8748
+ .ui_transition_outgoing_slot,
8749
+ .ui_transition_previous_target_slot,
8750
+ .ui_transition_previous_outgoing_slot {
8751
8751
  display: flex;
8752
8752
  align-items: var(--x-align-items);
8753
8753
  justify-content: var(--x-justify-content);
8754
8754
  }
8755
- .target_slot[data-items-width-overflow],
8756
- .previous_target_slot[data-items-width-overflow],
8757
- .previous_target_slot[data-items-width-overflow],
8758
- .previous_outgoing_slot[data-items-width-overflow] {
8755
+ .ui_transition_target_slot[data-items-width-overflow],
8756
+ .ui_transition_previous_target_slot[data-items-width-overflow],
8757
+ .ui_transition_previous_target_slot[data-items-width-overflow],
8758
+ .ui_transition_previous_outgoing_slot[data-items-width-overflow] {
8759
8759
  --x-justify-content: flex-start;
8760
8760
  }
8761
- .target_slot[data-items-height-overflow],
8762
- .previous_slot[data-items-height-overflow],
8763
- .previous_target_slot[data-items-height-overflow],
8764
- .previous_outgoing_slot[data-items-height-overflow] {
8761
+ .ui_transition_target_slot[data-items-height-overflow],
8762
+ .ui_transition_previous_slot[data-items-height-overflow],
8763
+ .ui_transition_previous_target_slot[data-items-height-overflow],
8764
+ .ui_transition_previous_outgoing_slot[data-items-height-overflow] {
8765
8765
  --x-align-items: flex-start;
8766
8766
  }
8767
8767
 
8768
- .active_group {
8768
+ .ui_transition_active_group {
8769
8769
  position: relative;
8770
8770
  }
8771
- .target_slot {
8771
+ .ui_transition_target_slot {
8772
8772
  position: relative;
8773
8773
  }
8774
- .outgoing_slot,
8775
- .previous_outgoing_slot {
8774
+ .ui_transition_outgoing_slot,
8775
+ .ui_transition_previous_outgoing_slot {
8776
8776
  position: absolute;
8777
8777
  top: 0;
8778
8778
  left: 0;
8779
8779
  }
8780
- .previous_group {
8780
+ .ui_transition_previous_group {
8781
8781
  position: absolute;
8782
8782
  inset: 0;
8783
8783
  }
8784
- .ui_transition[data-only-previous-group] .previous_group {
8784
+ .ui_transition[data-only-previous-group] .ui_transition_previous_group {
8785
8785
  position: relative;
8786
8786
  }
8787
8787
 
8788
- .target_slot_background {
8788
+ .ui_transition_target_slot_background {
8789
8789
  position: absolute;
8790
8790
  top: 0;
8791
8791
  left: 0;
@@ -8796,7 +8796,7 @@ import.meta.css = /* css */ `
8796
8796
  background: var(--target-slot-background, transparent);
8797
8797
  pointer-events: none;
8798
8798
  }
8799
- .ui_transition[data-transitioning] .target_slot_background {
8799
+ .ui_transition[data-transitioning] .ui_transition_target_slot_background {
8800
8800
  display: block;
8801
8801
  }
8802
8802
  `;
@@ -8844,15 +8844,15 @@ const createUITransitionController = (
8844
8844
  console.debug(`[size]`, message);
8845
8845
  };
8846
8846
 
8847
- const activeGroup = root.querySelector(".active_group");
8848
- const targetSlot = root.querySelector(".target_slot");
8849
- const outgoingSlot = root.querySelector(".outgoing_slot");
8850
- const previousGroup = root.querySelector(".previous_group");
8847
+ const activeGroup = root.querySelector(".ui_transition_active_group");
8848
+ const targetSlot = root.querySelector(".ui_transition_target_slot");
8849
+ const outgoingSlot = root.querySelector(".ui_transition_outgoing_slot");
8850
+ const previousGroup = root.querySelector(".ui_transition_previous_group");
8851
8851
  const previousTargetSlot = previousGroup?.querySelector(
8852
- ".previous_target_slot",
8852
+ ".ui_transition_previous_target_slot",
8853
8853
  );
8854
8854
  const previousOutgoingSlot = previousGroup?.querySelector(
8855
- ".previous_outgoing_slot",
8855
+ ".ui_transition_previous_outgoing_slot",
8856
8856
  );
8857
8857
 
8858
8858
  if (
@@ -8872,7 +8872,7 @@ const createUITransitionController = (
8872
8872
  // we maintain a background copy behind target slot to avoid showing
8873
8873
  // the body flashing during the fade-in
8874
8874
  const targetSlotBackground = document.createElement("div");
8875
- targetSlotBackground.className = "target_slot_background";
8875
+ targetSlotBackground.className = "ui_transition_target_slot_background";
8876
8876
  activeGroup.insertBefore(targetSlotBackground, targetSlot);
8877
8877
 
8878
8878
  root.style.setProperty("--x-transition-duration", `${duration}ms`);
@@ -9209,6 +9209,9 @@ const createUITransitionController = (
9209
9209
  duration,
9210
9210
  styleSynchronizer: "inline_style",
9211
9211
  onFinish: (targetSlotOpacityTransition) => {
9212
+ targetSlotBackground.style.removeProperty("--target-slot-background");
9213
+ targetSlotBackground.style.removeProperty("--target-slot-width");
9214
+ targetSlotBackground.style.removeProperty("--target-slot-height");
9212
9215
  targetSlotOpacityTransition.cancel();
9213
9216
  },
9214
9217
  });
@@ -9530,6 +9533,8 @@ const UITransition = ({
9530
9533
  debugSize,
9531
9534
  disabled,
9532
9535
  uiTransitionRef,
9536
+ alignX,
9537
+ alignY,
9533
9538
  ...props
9534
9539
  }) => {
9535
9540
  const contentIdRef = useRef(contentId);
@@ -9590,12 +9595,15 @@ const UITransition = ({
9590
9595
  if (disabled) {
9591
9596
  return null;
9592
9597
  }
9593
- const uiTransition = createUITransitionController(ref.current);
9598
+ const uiTransition = createUITransitionController(ref.current, {
9599
+ alignX,
9600
+ alignY
9601
+ });
9594
9602
  uiTransitionRef.current = uiTransition;
9595
9603
  return () => {
9596
9604
  uiTransition.cleanup();
9597
9605
  };
9598
- }, [disabled]);
9606
+ }, [disabled, alignX, alignY]);
9599
9607
  if (disabled) {
9600
9608
  return children;
9601
9609
  }
@@ -9609,23 +9617,23 @@ const UITransition = ({
9609
9617
  "data-debug-size": debugSize ? "" : undefined,
9610
9618
  "data-debug-content": debugContent ? "" : undefined,
9611
9619
  children: [jsxs("div", {
9612
- className: "active_group",
9620
+ className: "ui_transition_active_group",
9613
9621
  children: [jsx("div", {
9614
- className: "target_slot",
9622
+ className: "ui_transition_target_slot",
9615
9623
  "data-content-id": contentIdRef.current ? contentIdRef.current : undefined,
9616
9624
  children: jsx(UITransitionContentIdContext.Provider, {
9617
9625
  value: uiTransitionContentIdContextValue,
9618
9626
  children: children
9619
9627
  })
9620
9628
  }), jsx("div", {
9621
- className: "outgoing_slot"
9629
+ className: "ui_transition_outgoing_slot"
9622
9630
  })]
9623
9631
  }), jsxs("div", {
9624
- className: "previous_group",
9632
+ className: "ui_transition_previous_group",
9625
9633
  children: [jsx("div", {
9626
- className: "previous_target_slot"
9634
+ className: "ui_transition_previous_target_slot"
9627
9635
  }), jsx("div", {
9628
- className: "previous_outgoing_slot"
9636
+ className: "ui_transition_previous_outgoing_slot"
9629
9637
  })]
9630
9638
  })]
9631
9639
  });
@@ -10477,11 +10485,6 @@ const VISUAL_PROP_NAME_SET = new Set(Object.keys(VISUAL_PROPS));
10477
10485
  const CONTENT_PROP_NAME_SET = new Set(Object.keys(CONTENT_PROPS));
10478
10486
  const STYLE_PROP_NAME_SET = new Set(Object.keys(All_PROPS));
10479
10487
 
10480
- const HANDLED_BY_VISUAL_CHILD_PROP_SET = new Set([
10481
- ...INNER_SPACING_PROP_NAME_SET,
10482
- ...VISUAL_PROP_NAME_SET,
10483
- ...CONTENT_PROP_NAME_SET,
10484
- ]);
10485
10488
  const COPIED_ON_VISUAL_CHILD_PROP_SET = new Set([
10486
10489
  ...LAYOUT_PROP_NAME_SET,
10487
10490
  "expand",
@@ -10491,6 +10494,20 @@ const COPIED_ON_VISUAL_CHILD_PROP_SET = new Set([
10491
10494
  "contentAlignX",
10492
10495
  "contentAlignY",
10493
10496
  ]);
10497
+ const HANDLED_BY_VISUAL_CHILD_PROP_SET = new Set([
10498
+ ...INNER_SPACING_PROP_NAME_SET,
10499
+ ...VISUAL_PROP_NAME_SET,
10500
+ ...CONTENT_PROP_NAME_SET,
10501
+ ]);
10502
+ const getVisualChildStylePropStrategy = (name) => {
10503
+ if (COPIED_ON_VISUAL_CHILD_PROP_SET.has(name)) {
10504
+ return "copy";
10505
+ }
10506
+ if (HANDLED_BY_VISUAL_CHILD_PROP_SET.has(name)) {
10507
+ return "forward";
10508
+ }
10509
+ return null;
10510
+ };
10494
10511
 
10495
10512
  const isStyleProp = (name) => STYLE_PROP_NAME_SET.has(name);
10496
10513
 
@@ -10522,6 +10539,9 @@ const getStylePropGroup = (name) => {
10522
10539
  return null;
10523
10540
  };
10524
10541
  const getNormalizer = (key) => {
10542
+ if (key === "borderRadius") {
10543
+ return normalizeTypoStyle;
10544
+ }
10525
10545
  const group = getStylePropGroup(key);
10526
10546
  if (group === "margin" || group === "padding") {
10527
10547
  return normalizeSpacingStyle;
@@ -10531,58 +10551,18 @@ const getNormalizer = (key) => {
10531
10551
  }
10532
10552
  return stringifyStyle;
10533
10553
  };
10534
-
10535
- const assignStyle = (
10536
- styleObject,
10537
- propValue,
10538
- propName,
10539
- styleContext,
10540
- context = "js",
10541
- ) => {
10542
- if (propValue === undefined) {
10543
- return;
10544
- }
10545
- const { managedByCSSVars } = styleContext;
10546
- if (!managedByCSSVars) {
10547
- throw new Error("managedByCSSVars is required in styleContext");
10548
- }
10549
- const normalizer = getNormalizer(propName);
10550
- const getStyle = All_PROPS[propName];
10551
- if (
10552
- getStyle === PASS_THROUGH ||
10553
- // style not listed can be passed through as-is (accentColor, zIndex, ...)
10554
- getStyle === undefined
10555
- ) {
10556
- const cssValue = normalizer(propValue, propName);
10557
- const cssVar = managedByCSSVars[propName];
10558
- const mergedValue = mergeOneStyle(
10559
- styleObject[propName],
10560
- cssValue,
10561
- propName,
10562
- context,
10563
- );
10564
- if (cssVar) {
10565
- styleObject[cssVar] = mergedValue;
10566
- } else {
10567
- styleObject[propName] = mergedValue;
10568
- }
10569
- return;
10570
- }
10571
- const values = getStyle(propValue, styleContext);
10572
- if (!values) {
10573
- return;
10574
- }
10575
- for (const key of Object.keys(values)) {
10576
- const value = values[key];
10577
- const cssValue = normalizer(value, key);
10578
- const cssVar = managedByCSSVars[key];
10579
- const mergedValue = mergeOneStyle(styleObject[key], cssValue, key, context);
10580
- if (cssVar) {
10581
- styleObject[cssVar] = mergedValue;
10582
- } else {
10583
- styleObject[key] = mergedValue;
10584
- }
10554
+ const getHowToHandleStyleProp = (name) => {
10555
+ const getStyle = All_PROPS[name];
10556
+ if (getStyle === PASS_THROUGH) {
10557
+ return null;
10585
10558
  }
10559
+ return getStyle;
10560
+ };
10561
+ const prepareStyleValue = (existingValue, value, name, context) => {
10562
+ const normalizer = getNormalizer(name);
10563
+ const cssValue = normalizer(value, name);
10564
+ const mergedValue = mergeOneStyle(existingValue, cssValue, name, context);
10565
+ return mergedValue;
10586
10566
  };
10587
10567
 
10588
10568
  // Unified design scale using t-shirt sizes with rem units for accessibility.
@@ -10938,6 +10918,20 @@ const PSEUDO_CLASSES = {
10938
10918
  },
10939
10919
  };
10940
10920
 
10921
+ const dispatchNaviPseudoStateEvent = (element, value, previousValue) => {
10922
+ if (!element) {
10923
+ return;
10924
+ }
10925
+ element.dispatchEvent(
10926
+ new CustomEvent("navi_pseudo_state", {
10927
+ detail: {
10928
+ pseudoState: value,
10929
+ previousPseudoState: previousValue,
10930
+ },
10931
+ }),
10932
+ );
10933
+ };
10934
+
10941
10935
  const EMPTY_STATE = {};
10942
10936
  const initPseudoStyles = (
10943
10937
  element,
@@ -10946,10 +10940,20 @@ const initPseudoStyles = (
10946
10940
  pseudoState, // ":disabled", ":read-only", ":-navi-loading", etc...
10947
10941
  effect,
10948
10942
  elementToImpact = element,
10943
+ elementListeningPseudoState,
10949
10944
  },
10950
10945
  ) => {
10946
+ const onStateChange = (value, previousValue) => {
10947
+ effect?.(value, previousValue);
10948
+ dispatchNaviPseudoStateEvent(
10949
+ elementListeningPseudoState,
10950
+ value,
10951
+ previousValue,
10952
+ );
10953
+ };
10954
+
10951
10955
  if (!pseudoClasses || pseudoClasses.length === 0) {
10952
- effect?.(EMPTY_STATE);
10956
+ onStateChange(EMPTY_STATE);
10953
10957
  return () => {};
10954
10958
  }
10955
10959
 
@@ -10995,10 +10999,17 @@ const initPseudoStyles = (
10995
10999
  if (!someChange) {
10996
11000
  return;
10997
11001
  }
10998
- effect?.(currentState, state);
11002
+ const previousState = state;
10999
11003
  state = currentState;
11004
+ onStateChange(state, previousState);
11000
11005
  };
11001
11006
 
11007
+ element.addEventListener("navi_pseudo_state_check", (event) => {
11008
+ const previousState = event.detail.previousPseudoState;
11009
+ state = event.detail.pseudoState;
11010
+ onStateChange(state, previousState);
11011
+ });
11012
+
11002
11013
  for (const pseudoClass of pseudoClasses) {
11003
11014
  const pseudoClassDefinition = PSEUDO_CLASSES[pseudoClass];
11004
11015
  if (!pseudoClassDefinition) {
@@ -11076,7 +11087,7 @@ const getStyleToApply = (styles, pseudoState, pseudoNamedStyles) => {
11076
11087
  }
11077
11088
  let style = styles || {};
11078
11089
  for (const styleToAdd of styleToAddSet) {
11079
- style = mergeTwoStyles(style, styleToAdd);
11090
+ style = mergeTwoStyles(style, styleToAdd, "css");
11080
11091
  }
11081
11092
  return style;
11082
11093
  };
@@ -11241,9 +11252,8 @@ const Box = props => {
11241
11252
  layout = getDefaultDisplay(TagName);
11242
11253
  }
11243
11254
  const innerClassName = withPropsClassName(baseClassName, className);
11244
- const remainingProps = {};
11245
- const propsToForward = {};
11246
- const shouldForwardAllToChild = visualSelector && pseudoStateSelector;
11255
+ const selfForwardedProps = {};
11256
+ const childForwardedProps = {};
11247
11257
  {
11248
11258
  const parentLayout = useContext(BoxLayoutContext);
11249
11259
  const styleDeps = [
@@ -11299,66 +11309,112 @@ const Box = props => {
11299
11309
  pseudoElements
11300
11310
  };
11301
11311
  const boxStyles = {};
11302
- if (baseStyle) {
11303
- for (const key of baseStyle) {
11304
- const value = baseStyle[key];
11305
- styleDeps.push(value);
11306
- assignStyle(boxStyles, value, key, styleContext);
11312
+ let boxPseudoNamedStyles = PSEUDO_NAMED_STYLES_DEFAULT;
11313
+ const shouldForwardAllToChild = visualSelector && pseudoStateSelector;
11314
+ const addStyle = (value, name, stylesTarget, context) => {
11315
+ styleDeps.push(value); // impact box style -> add to deps
11316
+ const cssVar = managedByCSSVars[name];
11317
+ const mergedValue = prepareStyleValue(stylesTarget[name], value, name, context);
11318
+ if (cssVar) {
11319
+ stylesTarget[cssVar] = mergedValue;
11320
+ return true;
11307
11321
  }
11308
- }
11309
- const stylingKeyCandidateArray = Object.keys(rest);
11310
- const getPropEffect = propName => {
11311
- if (visualSelector) {
11312
- if (HANDLED_BY_VISUAL_CHILD_PROP_SET.has(propName)) {
11313
- return "forward";
11314
- }
11315
- if (COPIED_ON_VISUAL_CHILD_PROP_SET.has(propName)) {
11316
- return "style_and_forward";
11317
- }
11322
+ stylesTarget[name] = mergedValue;
11323
+ return false;
11324
+ };
11325
+ const addStyleMaybeForwarding = (value, name, stylesTarget, context, visualChildPropStrategy) => {
11326
+ if (!visualChildPropStrategy) {
11327
+ addStyle(value, name, stylesTarget, context);
11328
+ return false;
11318
11329
  }
11319
- if (isStyleProp(propName)) {
11320
- return "style";
11330
+ const cssVar = managedByCSSVars[name];
11331
+ if (cssVar) {
11332
+ // css var wins over visual child handling
11333
+ addStyle(value, name, stylesTarget, context);
11334
+ return false;
11321
11335
  }
11322
- if (propName.startsWith("data-")) {
11323
- return "use";
11336
+ if (visualChildPropStrategy === "copy") {
11337
+ // we stylyze ourself + forward prop to the child
11338
+ addStyle(value, name, stylesTarget, context);
11324
11339
  }
11325
- return "forward";
11340
+ return true;
11326
11341
  };
11327
- const assignStyleFromProp = (propValue, propName, stylesTarget, styleContext) => {
11328
- const propEffect = getPropEffect(propName);
11329
- if (propEffect === "ignore") {
11342
+ const assignStyle = (value, name, styleContext, boxStylesTarget, styleOrigin) => {
11343
+ const context = styleOrigin === "base_style" ? "js" : "css";
11344
+ const isCss = styleOrigin === "base_style" || styleOrigin === "style";
11345
+ if (isCss) {
11346
+ addStyle(value, name, boxStylesTarget, context);
11330
11347
  return;
11331
11348
  }
11332
- const useToStyle = propEffect === "style" || propEffect === "style_and_forward";
11333
- const shouldForward = propEffect === "forward" || propEffect === "style_and_forward";
11334
- if (useToStyle) {
11335
- styleDeps.push(propValue);
11336
- assignStyle(stylesTarget, propValue, propName, styleContext, "css");
11349
+ const isPseudoStyle = styleOrigin === "pseudo_style";
11350
+ const mightStyle = isStyleProp(name);
11351
+ if (!mightStyle) {
11352
+ // not a style prop what do we do with it?
11353
+ if (shouldForwardAllToChild) {
11354
+ if (isPseudoStyle) ; else {
11355
+ childForwardedProps[name] = value;
11356
+ }
11357
+ } else {
11358
+ if (isPseudoStyle) {
11359
+ console.warn(`unsupported pseudo style key "${name}"`);
11360
+ }
11361
+ selfForwardedProps[name] = value;
11362
+ }
11363
+ return;
11337
11364
  }
11338
- if (stylesTarget === boxStyles) {
11339
- if (!shouldForwardAllToChild && !useToStyle) {
11340
- // we'll put these props on ourselves
11341
- remainingProps[propName] = propValue;
11365
+ // it's a style prop, we need first to check if we have css var to handle them
11366
+ // otherwise we decide to put it either on self or child
11367
+ const visualChildPropStrategy = visualSelector && getVisualChildStylePropStrategy(name);
11368
+ const getStyle = getHowToHandleStyleProp(name);
11369
+ if (
11370
+ // prop name === css style name
11371
+ !getStyle) {
11372
+ const needForwarding = addStyleMaybeForwarding(value, name, boxStylesTarget, context, visualChildPropStrategy);
11373
+ if (needForwarding) {
11374
+ if (isPseudoStyle) ; else {
11375
+ childForwardedProps[name] = value;
11376
+ }
11342
11377
  }
11343
- if (shouldForward) {
11344
- propsToForward[propName] = propValue;
11378
+ return;
11379
+ }
11380
+ const cssValues = getStyle(value, styleContext);
11381
+ if (!cssValues) {
11382
+ return;
11383
+ }
11384
+ let needForwarding = false;
11385
+ for (const styleName of Object.keys(cssValues)) {
11386
+ const cssValue = cssValues[styleName];
11387
+ needForwarding = addStyleMaybeForwarding(cssValue, styleName, boxStylesTarget, context, visualChildPropStrategy);
11388
+ }
11389
+ if (needForwarding) {
11390
+ if (isPseudoStyle) ; else {
11391
+ childForwardedProps[name] = value;
11345
11392
  }
11346
11393
  }
11347
11394
  };
11348
- for (const key of stylingKeyCandidateArray) {
11349
- if (key === "ref") {
11395
+ if (baseStyle) {
11396
+ for (const key of baseStyle) {
11397
+ const value = baseStyle[key];
11398
+ assignStyle(value, key, styleContext, boxStyles, "baseStyle");
11399
+ }
11400
+ }
11401
+ const remainingPropKeyArray = Object.keys(rest);
11402
+ for (const propName of remainingPropKeyArray) {
11403
+ if (propName === "ref") {
11350
11404
  // some props not destructured but that are neither
11351
11405
  // style props, nor should be forwarded to the child
11352
11406
  continue;
11353
11407
  }
11354
- const value = rest[key];
11355
- assignStyleFromProp(value, key, boxStyles, styleContext);
11408
+ const propValue = rest[propName];
11409
+ assignStyle(propValue, propName, styleContext, boxStyles, "prop");
11356
11410
  }
11357
- let pseudoNamedStyles = PSEUDO_NAMED_STYLES_DEFAULT;
11358
11411
  if (pseudoStyle) {
11412
+ const assignPseudoStyle = (propValue, propName, pseudoStyleContext, pseudoStylesTarget) => {
11413
+ assignStyle(propValue, propName, pseudoStyleContext, pseudoStylesTarget, "pseudo_style");
11414
+ };
11359
11415
  const pseudoStyleKeys = Object.keys(pseudoStyle);
11360
11416
  if (pseudoStyleKeys.length) {
11361
- pseudoNamedStyles = {};
11417
+ boxPseudoNamedStyles = {};
11362
11418
  for (const key of pseudoStyleKeys) {
11363
11419
  const pseudoStyleContext = {
11364
11420
  ...styleContext,
@@ -11376,9 +11432,9 @@ const Box = props => {
11376
11432
  const pseudoClassStyle = pseudoStyle[key];
11377
11433
  for (const pseudoClassStyleKey of Object.keys(pseudoClassStyle)) {
11378
11434
  const pseudoClassStyleValue = pseudoClassStyle[pseudoClassStyleKey];
11379
- assignStyleFromProp(pseudoClassStyleValue, pseudoClassStyleKey, pseudoClassStyles, pseudoStyleContext);
11435
+ assignPseudoStyle(pseudoClassStyleValue, pseudoClassStyleKey, pseudoStyleContext, pseudoClassStyles);
11380
11436
  }
11381
- pseudoNamedStyles[key] = pseudoClassStyles;
11437
+ boxPseudoNamedStyles[key] = pseudoClassStyles;
11382
11438
  continue;
11383
11439
  }
11384
11440
  // pseudo element
@@ -11388,29 +11444,31 @@ const Box = props => {
11388
11444
  const pseudoElementStyle = pseudoStyle[key];
11389
11445
  for (const pseudoElementStyleKey of Object.keys(pseudoElementStyle)) {
11390
11446
  const pseudoElementStyleValue = pseudoElementStyle[pseudoElementStyleKey];
11391
- assignStyleFromProp(pseudoElementStyleValue, pseudoElementStyleKey, pseudoElementStyles, pseudoStyleContext);
11447
+ assignPseudoStyle(pseudoElementStyleValue, pseudoElementStyleKey, pseudoStyleContext, pseudoElementStyles);
11392
11448
  }
11393
- pseudoNamedStyles[key] = pseudoElementStyles;
11449
+ boxPseudoNamedStyles[key] = pseudoElementStyles;
11394
11450
  continue;
11395
11451
  }
11396
11452
  console.warn(`unsupported pseudo style key "${key}"`);
11397
11453
  }
11398
11454
  }
11399
- remainingProps.pseudoStyle = pseudoStyle;
11455
+ childForwardedProps.pseudoStyle = pseudoStyle;
11400
11456
  }
11401
11457
  if (typeof style === "string") {
11402
- appendStyles(boxStyles, normalizeStyles(style, "css"), "css");
11403
- styleDeps.push(style); // impact box style -> add to deps
11458
+ const styleObject = normalizeStyles(style, "css");
11459
+ for (const styleName of Object.keys(styleObject)) {
11460
+ const styleValue = styleObject[styleName];
11461
+ assignStyle(styleValue, styleName, styleContext, boxStyles, "style");
11462
+ }
11404
11463
  } else if (style && typeof style === "object") {
11405
- for (const key of Object.keys(style)) {
11406
- const stylePropValue = style[key];
11407
- assignStyle(boxStyles, stylePropValue, key, styleContext, "css");
11408
- styleDeps.push(stylePropValue); // impact box style -> add to deps
11464
+ for (const styleName of Object.keys(style)) {
11465
+ const styleValue = style[styleName];
11466
+ assignStyle(styleValue, styleName, styleContext, boxStyles, "style");
11409
11467
  }
11410
11468
  }
11411
11469
  const updateStyle = useCallback(state => {
11412
11470
  const boxEl = ref.current;
11413
- applyStyle(boxEl, boxStyles, state, pseudoNamedStyles);
11471
+ applyStyle(boxEl, boxStyles, state, boxPseudoNamedStyles);
11414
11472
  }, styleDeps);
11415
11473
  const finalStyleDeps = [pseudoStateSelector, innerPseudoState, updateStyle];
11416
11474
  // By default ":hover", ":active" are not tracked.
@@ -11441,11 +11499,13 @@ const Box = props => {
11441
11499
  return null;
11442
11500
  }
11443
11501
  const pseudoStateEl = pseudoStateSelector ? boxEl.querySelector(pseudoStateSelector) : boxEl;
11502
+ const visualEl = visualSelector ? boxEl.querySelector(visualSelector) : null;
11444
11503
  return initPseudoStyles(pseudoStateEl, {
11445
11504
  pseudoClasses: innerPseudoClasses,
11446
11505
  pseudoState: innerPseudoState,
11447
11506
  effect: updateStyle,
11448
- elementToImpact: boxEl
11507
+ elementToImpact: boxEl,
11508
+ elementListeningPseudoState: visualEl
11449
11509
  });
11450
11510
  }, finalStyleDeps);
11451
11511
  }
@@ -11456,9 +11516,9 @@ const Box = props => {
11456
11516
  let innerChildren;
11457
11517
  if (hasChildFunction) {
11458
11518
  if (Array.isArray(children)) {
11459
- innerChildren = children.map(child => typeof child === "function" ? child(propsToForward) : child);
11519
+ innerChildren = children.map(child => typeof child === "function" ? child(childForwardedProps) : child);
11460
11520
  } else if (typeof children === "function") {
11461
- innerChildren = children(propsToForward);
11521
+ innerChildren = children(childForwardedProps);
11462
11522
  } else {
11463
11523
  innerChildren = children;
11464
11524
  }
@@ -11471,7 +11531,7 @@ const Box = props => {
11471
11531
  "data-layout-inline": inline ? "" : undefined,
11472
11532
  "data-layout-row": row ? "" : undefined,
11473
11533
  "data-layout-column": column ? "" : undefined,
11474
- ...remainingProps,
11534
+ ...selfForwardedProps,
11475
11535
  children: jsx(BoxLayoutContext.Provider, {
11476
11536
  value: layout,
11477
11537
  children: innerChildren
@@ -16568,10 +16628,9 @@ installImportMetaCss(import.meta);import.meta.css = /* css */`
16568
16628
  display: inline-flex;
16569
16629
  box-sizing: border-box;
16570
16630
  padding: 0;
16571
- flex-direction: inherit;
16572
16631
  background: none;
16573
16632
  border: none;
16574
- border-radius: inherit;
16633
+ border-radius: var(--x-border-radius);
16575
16634
  outline: none;
16576
16635
  cursor: pointer;
16577
16636
  }
@@ -16747,7 +16806,7 @@ const ButtonBasic = props => {
16747
16806
  return jsxs(Box, {
16748
16807
  ...buttonProps,
16749
16808
  as: "span",
16750
- baseClassName: "navi_button_content",
16809
+ className: "navi_button_content",
16751
16810
  children: [innerChildren, jsx("span", {
16752
16811
  className: "navi_button_shadow"
16753
16812
  })]
@@ -21588,6 +21647,118 @@ const Title = ({
21588
21647
  });
21589
21648
  };
21590
21649
 
21650
+ installImportMetaCss(import.meta);import.meta.css = /* css */`
21651
+ @layer navi {
21652
+ .navi_dialog_layout {
21653
+ --margin: 30px;
21654
+ --padding: 20px;
21655
+ --background: white;
21656
+ --border-width: 2px;
21657
+ --border-color: lightgrey;
21658
+ --border-radius: 10px;
21659
+ --min-width: 300px;
21660
+ --min-height: auto;
21661
+ }
21662
+ }
21663
+ .navi_dialog_layout {
21664
+ padding-top: var(--margin-top, var(--margin-y, var(--margin)));
21665
+ padding-right: var(--margin-right, var(--margin-x, var(--margin)));
21666
+ padding-bottom: var(--margin-bottom, var(--margin-y, var(--margin)));
21667
+ padding-left: var(--margin-left, var(--margin-x, var(--margin)));
21668
+ }
21669
+
21670
+ .navi_dialog_content {
21671
+ min-width: var(--min-width);
21672
+ min-height: var(--min-height);
21673
+ padding-top: var(--padding-top, var(--padding-y, var(--padding)));
21674
+ padding-right: var(--padding-right, var(--padding-x, var(--padding)));
21675
+ padding-bottom: var(--padding-bottom, var(--padding-y, var(--padding)));
21676
+ padding-left: var(--padding-left, var(--padding-x, var(--padding)));
21677
+ background: var(--background);
21678
+ background-color: var(--background-color, var(--background));
21679
+ border-width: var(--border-width);
21680
+ border-style: solid;
21681
+ border-color: var(--border-color);
21682
+ border-radius: var(--border-radius);
21683
+ }
21684
+ `;
21685
+ const DialogManagedByCSSVars = {
21686
+ margin: "--margin",
21687
+ marginTop: "--margin-top",
21688
+ marginBottom: "--margin-bottom",
21689
+ marginLeft: "--margin-left",
21690
+ marginRight: "--margin-right",
21691
+ borderRadius: "--border-radius",
21692
+ borderWidth: "--border-width",
21693
+ borderColor: "--border-color",
21694
+ background: "--background",
21695
+ backgroundColor: "--background-color",
21696
+ padding: "--padding",
21697
+ paddingTop: "--padding-top",
21698
+ paddingBottom: "--padding-bottom",
21699
+ paddingLeft: "--padding-left",
21700
+ paddingRight: "--padding-right",
21701
+ minWidth: "--min-width",
21702
+ minHeight: "--min-height"
21703
+ };
21704
+ const DialogLayout = ({
21705
+ children,
21706
+ contentAlignX = "center",
21707
+ contentAlignY = "center",
21708
+ ...props
21709
+ }) => {
21710
+ return jsx(Box, {
21711
+ baseClassName: "navi_dialog_layout",
21712
+ managedByCSSVars: DialogManagedByCSSVars,
21713
+ visualSelector: ".navi_dialog_content",
21714
+ ...props,
21715
+ children: jsx(Box, {
21716
+ row: true,
21717
+ className: "navi_dialog_content",
21718
+ contentAlignX: contentAlignX,
21719
+ contentAlignY: contentAlignY,
21720
+ children: children
21721
+ })
21722
+ });
21723
+ };
21724
+
21725
+ installImportMetaCss(import.meta);import.meta.css = /* css */`
21726
+ @layer navi {
21727
+ .navi_viewport_layout {
21728
+ --padding: 40px;
21729
+ --background: white;
21730
+ }
21731
+ }
21732
+
21733
+ .navi_viewport_layout {
21734
+ padding-top: var(--padding-top, var(--padding-y, var(--padding)));
21735
+ padding-right: var(--padding-right, var(--padding-x, var(--padding)));
21736
+ padding-bottom: var(--padding-bottom, var(--padding-y, var(--padding)));
21737
+ padding-left: var(--padding-left, var(--padding-x, var(--padding)));
21738
+ background: var(--background);
21739
+ }
21740
+ `;
21741
+ const ViewportManagedByCSSVars = {
21742
+ padding: "--padding",
21743
+ paddingTop: "--padding-top",
21744
+ paddingBottom: "--padding-bottom",
21745
+ paddingLeft: "--padding-left",
21746
+ paddingRight: "--padding-right",
21747
+ background: "--background"
21748
+ };
21749
+ const ViewportLayout = props => {
21750
+ return jsx(Box, {
21751
+ row: true,
21752
+ ...props,
21753
+ className: "navi_viewport_layout",
21754
+ managedByCSSVars: ViewportManagedByCSSVars,
21755
+ minWidth: "max-content",
21756
+ minHeight: "max-content",
21757
+ width: "100%",
21758
+ height: "100%"
21759
+ });
21760
+ };
21761
+
21591
21762
  const createUniqueValueConstraint = (
21592
21763
  // the set might be incomplete (the front usually don't have the full copy of all the items from the backend)
21593
21764
  // but this is already nice to help user with what we know
@@ -21665,5 +21836,5 @@ const useDependenciesDiff = (inputs) => {
21665
21836
  return diffRef.current;
21666
21837
  };
21667
21838
 
21668
- export { ActionRenderer, ActiveKeyboardShortcuts, BadgeCount, Box, Button, Checkbox, CheckboxList, Code, Col, Colgroup, Details, Editable, ErrorBoundaryContext, FontSizedSvg, Form, Icon, IconAndText, Image, Input, Label, Layout, Link, LinkWithIcon, MessageBox, Paragraph, Radio, RadioList, Route, RouteLink, Routes, RowNumberCol, RowNumberTableCell, SINGLE_SPACE_CONSTRAINT, SVGMaskOverlay, Select, SelectionContext, SummaryMarker, Svg, Tab, TabList, Table, TableCell, Tbody, Text, Thead, Title, Tr, UITransition, actionIntegratedVia, addCustomMessage, createAction, createSelectionKeyboardShortcuts, createUniqueValueConstraint, enableDebugActions, enableDebugOnDocumentLoading, forwardActionRequested, goBack, goForward, goTo, installCustomConstraintValidation, isCellSelected, isColumnSelected, isRowSelected, openCallout, rawUrlPart, reload, removeCustomMessage, rerunActions, resource, setBaseUrl, setupRoutes, stopLoad, stringifyTableSelectionValue, updateActions, useActionData, useActionStatus, useActiveRouteInfo, useCellsAndColumns, useDependenciesDiff, useDocumentState, useDocumentUrl, useEditionController, useFocusGroup, useKeyboardShortcuts, useNavState, useRouteStatus, useRunOnMount, useSelectableElement, useSelectionController, useSignalSync, useStateArray, useUrlSearchParam, valueInLocalStorage };
21839
+ export { ActionRenderer, ActiveKeyboardShortcuts, BadgeCount, Box, Button, Checkbox, CheckboxList, Code, Col, Colgroup, Details, DialogLayout, Editable, ErrorBoundaryContext, FontSizedSvg, Form, Icon, IconAndText, Image, Input, Label, Layout, Link, LinkWithIcon, MessageBox, Paragraph, Radio, RadioList, Route, RouteLink, Routes, RowNumberCol, RowNumberTableCell, SINGLE_SPACE_CONSTRAINT, SVGMaskOverlay, Select, SelectionContext, SummaryMarker, Svg, Tab, TabList, Table, TableCell, Tbody, Text, Thead, Title, Tr, UITransition, ViewportLayout, actionIntegratedVia, addCustomMessage, createAction, createSelectionKeyboardShortcuts, createUniqueValueConstraint, enableDebugActions, enableDebugOnDocumentLoading, forwardActionRequested, goBack, goForward, goTo, installCustomConstraintValidation, isCellSelected, isColumnSelected, isRowSelected, openCallout, rawUrlPart, reload, removeCustomMessage, rerunActions, resource, setBaseUrl, setupRoutes, stopLoad, stringifyTableSelectionValue, updateActions, useActionData, useActionStatus, useActiveRouteInfo, useCellsAndColumns, useDependenciesDiff, useDocumentState, useDocumentUrl, useEditionController, useFocusGroup, useKeyboardShortcuts, useNavState, useRouteStatus, useRunOnMount, useSelectableElement, useSelectionController, useSignalSync, useStateArray, useUrlSearchParam, valueInLocalStorage };
21669
21840
  //# sourceMappingURL=jsenv_navi.js.map