@jsenv/navi 0.12.10 → 0.12.12
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/jsenv_navi.js +199 -135
- package/dist/jsenv_navi.js.map +44 -29
- package/package.json +1 -1
package/dist/jsenv_navi.js
CHANGED
|
@@ -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,
|
|
2
|
+
import { createIterableWeakSet, createPubSub, createValueEffect, createStyleController, getVisuallyVisibleInfo, getFirstVisuallyVisibleAncestor, allowWheelThrough, resolveCSSColor, visibleRectEffect, pickPositionRelativeTo, getBorderSizes, getPaddingSizes, activeElementSignal, canInterceptKeys, createGroupTransitionController, getElementSignature, getBorderRadius, preventIntermediateScrollbar, createOpacityTransition, mergeOneStyle, stringifyStyle, 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";
|
|
@@ -8950,13 +8950,19 @@ const createUITransitionController = (
|
|
|
8950
8950
|
if (isEmpty) {
|
|
8951
8951
|
debugSize(`measureSlot(".${slot.className}") -> it is empty`);
|
|
8952
8952
|
} else if (singleElementNode) {
|
|
8953
|
-
const
|
|
8953
|
+
const visualSelector = singleElementNode.getAttribute(
|
|
8954
|
+
"data-visual-selector",
|
|
8955
|
+
);
|
|
8956
|
+
const visualElement = visualSelector
|
|
8957
|
+
? singleElementNode.querySelector(visualSelector) || singleElementNode
|
|
8958
|
+
: singleElementNode;
|
|
8959
|
+
const rect = visualElement.getBoundingClientRect();
|
|
8954
8960
|
width = rect.width;
|
|
8955
8961
|
height = rect.height;
|
|
8956
8962
|
debugSize(`measureSlot(".${slot.className}") -> [${width}x${height}]`);
|
|
8957
|
-
borderRadius = getBorderRadius(
|
|
8958
|
-
border = getComputedStyle(
|
|
8959
|
-
background =
|
|
8963
|
+
borderRadius = getBorderRadius(visualElement);
|
|
8964
|
+
border = getComputedStyle(visualElement).border;
|
|
8965
|
+
background = getComputedStyle(visualElement).background;
|
|
8960
8966
|
} else {
|
|
8961
8967
|
// text, multiple elements
|
|
8962
8968
|
const rect = slot.getBoundingClientRect();
|
|
@@ -9194,7 +9200,7 @@ const createUITransitionController = (
|
|
|
9194
9200
|
const fadeInTargetSlot = () => {
|
|
9195
9201
|
targetSlotBackground.style.setProperty(
|
|
9196
9202
|
"--target-slot-background",
|
|
9197
|
-
|
|
9203
|
+
targetSlotConfiguration.background,
|
|
9198
9204
|
);
|
|
9199
9205
|
targetSlotBackground.style.setProperty(
|
|
9200
9206
|
"--target-slot-width",
|
|
@@ -9209,6 +9215,9 @@ const createUITransitionController = (
|
|
|
9209
9215
|
duration,
|
|
9210
9216
|
styleSynchronizer: "inline_style",
|
|
9211
9217
|
onFinish: (targetSlotOpacityTransition) => {
|
|
9218
|
+
targetSlotBackground.style.removeProperty("--target-slot-background");
|
|
9219
|
+
targetSlotBackground.style.removeProperty("--target-slot-width");
|
|
9220
|
+
targetSlotBackground.style.removeProperty("--target-slot-height");
|
|
9212
9221
|
targetSlotOpacityTransition.cancel();
|
|
9213
9222
|
},
|
|
9214
9223
|
});
|
|
@@ -9336,6 +9345,9 @@ const createUITransitionController = (
|
|
|
9336
9345
|
};
|
|
9337
9346
|
|
|
9338
9347
|
const targetSlotEffect = (reasons) => {
|
|
9348
|
+
if (root.hasAttribute("data-disabled")) {
|
|
9349
|
+
return;
|
|
9350
|
+
}
|
|
9339
9351
|
const fromConfiguration = targetSlotConfiguration;
|
|
9340
9352
|
const toConfiguration = detectConfiguration(targetSlot);
|
|
9341
9353
|
if (hasDebugLogs) {
|
|
@@ -9601,13 +9613,11 @@ const UITransition = ({
|
|
|
9601
9613
|
uiTransition.cleanup();
|
|
9602
9614
|
};
|
|
9603
9615
|
}, [disabled, alignX, alignY]);
|
|
9604
|
-
if (disabled) {
|
|
9605
|
-
return children;
|
|
9606
|
-
}
|
|
9607
9616
|
return jsxs("div", {
|
|
9608
9617
|
ref: ref,
|
|
9609
9618
|
...props,
|
|
9610
9619
|
className: "ui_transition",
|
|
9620
|
+
"data-disabled": disabled ? "" : undefined,
|
|
9611
9621
|
"data-transition-type": type,
|
|
9612
9622
|
"data-transition-duration": duration,
|
|
9613
9623
|
"data-debug-detection": debugDetection ? "" : undefined,
|
|
@@ -9623,10 +9633,12 @@ const UITransition = ({
|
|
|
9623
9633
|
children: children
|
|
9624
9634
|
})
|
|
9625
9635
|
}), jsx("div", {
|
|
9626
|
-
className: "ui_transition_outgoing_slot"
|
|
9636
|
+
className: "ui_transition_outgoing_slot",
|
|
9637
|
+
inert: true
|
|
9627
9638
|
})]
|
|
9628
9639
|
}), jsxs("div", {
|
|
9629
9640
|
className: "ui_transition_previous_group",
|
|
9641
|
+
inert: true,
|
|
9630
9642
|
children: [jsx("div", {
|
|
9631
9643
|
className: "ui_transition_previous_target_slot"
|
|
9632
9644
|
}), jsx("div", {
|
|
@@ -10482,11 +10494,6 @@ const VISUAL_PROP_NAME_SET = new Set(Object.keys(VISUAL_PROPS));
|
|
|
10482
10494
|
const CONTENT_PROP_NAME_SET = new Set(Object.keys(CONTENT_PROPS));
|
|
10483
10495
|
const STYLE_PROP_NAME_SET = new Set(Object.keys(All_PROPS));
|
|
10484
10496
|
|
|
10485
|
-
const HANDLED_BY_VISUAL_CHILD_PROP_SET = new Set([
|
|
10486
|
-
...INNER_SPACING_PROP_NAME_SET,
|
|
10487
|
-
...VISUAL_PROP_NAME_SET,
|
|
10488
|
-
...CONTENT_PROP_NAME_SET,
|
|
10489
|
-
]);
|
|
10490
10497
|
const COPIED_ON_VISUAL_CHILD_PROP_SET = new Set([
|
|
10491
10498
|
...LAYOUT_PROP_NAME_SET,
|
|
10492
10499
|
"expand",
|
|
@@ -10496,6 +10503,20 @@ const COPIED_ON_VISUAL_CHILD_PROP_SET = new Set([
|
|
|
10496
10503
|
"contentAlignX",
|
|
10497
10504
|
"contentAlignY",
|
|
10498
10505
|
]);
|
|
10506
|
+
const HANDLED_BY_VISUAL_CHILD_PROP_SET = new Set([
|
|
10507
|
+
...INNER_SPACING_PROP_NAME_SET,
|
|
10508
|
+
...VISUAL_PROP_NAME_SET,
|
|
10509
|
+
...CONTENT_PROP_NAME_SET,
|
|
10510
|
+
]);
|
|
10511
|
+
const getVisualChildStylePropStrategy = (name) => {
|
|
10512
|
+
if (COPIED_ON_VISUAL_CHILD_PROP_SET.has(name)) {
|
|
10513
|
+
return "copy";
|
|
10514
|
+
}
|
|
10515
|
+
if (HANDLED_BY_VISUAL_CHILD_PROP_SET.has(name)) {
|
|
10516
|
+
return "forward";
|
|
10517
|
+
}
|
|
10518
|
+
return null;
|
|
10519
|
+
};
|
|
10499
10520
|
|
|
10500
10521
|
const isStyleProp = (name) => STYLE_PROP_NAME_SET.has(name);
|
|
10501
10522
|
|
|
@@ -10527,6 +10548,9 @@ const getStylePropGroup = (name) => {
|
|
|
10527
10548
|
return null;
|
|
10528
10549
|
};
|
|
10529
10550
|
const getNormalizer = (key) => {
|
|
10551
|
+
if (key === "borderRadius") {
|
|
10552
|
+
return normalizeTypoStyle;
|
|
10553
|
+
}
|
|
10530
10554
|
const group = getStylePropGroup(key);
|
|
10531
10555
|
if (group === "margin" || group === "padding") {
|
|
10532
10556
|
return normalizeSpacingStyle;
|
|
@@ -10536,58 +10560,18 @@ const getNormalizer = (key) => {
|
|
|
10536
10560
|
}
|
|
10537
10561
|
return stringifyStyle;
|
|
10538
10562
|
};
|
|
10539
|
-
|
|
10540
|
-
const
|
|
10541
|
-
|
|
10542
|
-
|
|
10543
|
-
propName,
|
|
10544
|
-
styleContext,
|
|
10545
|
-
context = "js",
|
|
10546
|
-
) => {
|
|
10547
|
-
if (propValue === undefined) {
|
|
10548
|
-
return;
|
|
10549
|
-
}
|
|
10550
|
-
const { managedByCSSVars } = styleContext;
|
|
10551
|
-
if (!managedByCSSVars) {
|
|
10552
|
-
throw new Error("managedByCSSVars is required in styleContext");
|
|
10553
|
-
}
|
|
10554
|
-
const normalizer = getNormalizer(propName);
|
|
10555
|
-
const getStyle = All_PROPS[propName];
|
|
10556
|
-
if (
|
|
10557
|
-
getStyle === PASS_THROUGH ||
|
|
10558
|
-
// style not listed can be passed through as-is (accentColor, zIndex, ...)
|
|
10559
|
-
getStyle === undefined
|
|
10560
|
-
) {
|
|
10561
|
-
const cssValue = normalizer(propValue, propName);
|
|
10562
|
-
const cssVar = managedByCSSVars[propName];
|
|
10563
|
-
const mergedValue = mergeOneStyle(
|
|
10564
|
-
styleObject[propName],
|
|
10565
|
-
cssValue,
|
|
10566
|
-
propName,
|
|
10567
|
-
context,
|
|
10568
|
-
);
|
|
10569
|
-
if (cssVar) {
|
|
10570
|
-
styleObject[cssVar] = mergedValue;
|
|
10571
|
-
} else {
|
|
10572
|
-
styleObject[propName] = mergedValue;
|
|
10573
|
-
}
|
|
10574
|
-
return;
|
|
10575
|
-
}
|
|
10576
|
-
const values = getStyle(propValue, styleContext);
|
|
10577
|
-
if (!values) {
|
|
10578
|
-
return;
|
|
10579
|
-
}
|
|
10580
|
-
for (const key of Object.keys(values)) {
|
|
10581
|
-
const value = values[key];
|
|
10582
|
-
const cssValue = normalizer(value, key);
|
|
10583
|
-
const cssVar = managedByCSSVars[key];
|
|
10584
|
-
const mergedValue = mergeOneStyle(styleObject[key], cssValue, key, context);
|
|
10585
|
-
if (cssVar) {
|
|
10586
|
-
styleObject[cssVar] = mergedValue;
|
|
10587
|
-
} else {
|
|
10588
|
-
styleObject[key] = mergedValue;
|
|
10589
|
-
}
|
|
10563
|
+
const getHowToHandleStyleProp = (name) => {
|
|
10564
|
+
const getStyle = All_PROPS[name];
|
|
10565
|
+
if (getStyle === PASS_THROUGH) {
|
|
10566
|
+
return null;
|
|
10590
10567
|
}
|
|
10568
|
+
return getStyle;
|
|
10569
|
+
};
|
|
10570
|
+
const prepareStyleValue = (existingValue, value, name, context) => {
|
|
10571
|
+
const normalizer = getNormalizer(name);
|
|
10572
|
+
const cssValue = normalizer(value, name);
|
|
10573
|
+
const mergedValue = mergeOneStyle(existingValue, cssValue, name, context);
|
|
10574
|
+
return mergedValue;
|
|
10591
10575
|
};
|
|
10592
10576
|
|
|
10593
10577
|
// Unified design scale using t-shirt sizes with rem units for accessibility.
|
|
@@ -10943,6 +10927,20 @@ const PSEUDO_CLASSES = {
|
|
|
10943
10927
|
},
|
|
10944
10928
|
};
|
|
10945
10929
|
|
|
10930
|
+
const dispatchNaviPseudoStateEvent = (element, value, previousValue) => {
|
|
10931
|
+
if (!element) {
|
|
10932
|
+
return;
|
|
10933
|
+
}
|
|
10934
|
+
element.dispatchEvent(
|
|
10935
|
+
new CustomEvent("navi_pseudo_state", {
|
|
10936
|
+
detail: {
|
|
10937
|
+
pseudoState: value,
|
|
10938
|
+
previousPseudoState: previousValue,
|
|
10939
|
+
},
|
|
10940
|
+
}),
|
|
10941
|
+
);
|
|
10942
|
+
};
|
|
10943
|
+
|
|
10946
10944
|
const EMPTY_STATE = {};
|
|
10947
10945
|
const initPseudoStyles = (
|
|
10948
10946
|
element,
|
|
@@ -10951,10 +10949,20 @@ const initPseudoStyles = (
|
|
|
10951
10949
|
pseudoState, // ":disabled", ":read-only", ":-navi-loading", etc...
|
|
10952
10950
|
effect,
|
|
10953
10951
|
elementToImpact = element,
|
|
10952
|
+
elementListeningPseudoState,
|
|
10954
10953
|
},
|
|
10955
10954
|
) => {
|
|
10955
|
+
const onStateChange = (value, previousValue) => {
|
|
10956
|
+
effect?.(value, previousValue);
|
|
10957
|
+
dispatchNaviPseudoStateEvent(
|
|
10958
|
+
elementListeningPseudoState,
|
|
10959
|
+
value,
|
|
10960
|
+
previousValue,
|
|
10961
|
+
);
|
|
10962
|
+
};
|
|
10963
|
+
|
|
10956
10964
|
if (!pseudoClasses || pseudoClasses.length === 0) {
|
|
10957
|
-
|
|
10965
|
+
onStateChange(EMPTY_STATE);
|
|
10958
10966
|
return () => {};
|
|
10959
10967
|
}
|
|
10960
10968
|
|
|
@@ -11000,10 +11008,17 @@ const initPseudoStyles = (
|
|
|
11000
11008
|
if (!someChange) {
|
|
11001
11009
|
return;
|
|
11002
11010
|
}
|
|
11003
|
-
|
|
11011
|
+
const previousState = state;
|
|
11004
11012
|
state = currentState;
|
|
11013
|
+
onStateChange(state, previousState);
|
|
11005
11014
|
};
|
|
11006
11015
|
|
|
11016
|
+
element.addEventListener("navi_pseudo_state_check", (event) => {
|
|
11017
|
+
const previousState = event.detail.previousPseudoState;
|
|
11018
|
+
state = event.detail.pseudoState;
|
|
11019
|
+
onStateChange(state, previousState);
|
|
11020
|
+
});
|
|
11021
|
+
|
|
11007
11022
|
for (const pseudoClass of pseudoClasses) {
|
|
11008
11023
|
const pseudoClassDefinition = PSEUDO_CLASSES[pseudoClass];
|
|
11009
11024
|
if (!pseudoClassDefinition) {
|
|
@@ -11081,7 +11096,7 @@ const getStyleToApply = (styles, pseudoState, pseudoNamedStyles) => {
|
|
|
11081
11096
|
}
|
|
11082
11097
|
let style = styles || {};
|
|
11083
11098
|
for (const styleToAdd of styleToAddSet) {
|
|
11084
|
-
style = mergeTwoStyles(style, styleToAdd);
|
|
11099
|
+
style = mergeTwoStyles(style, styleToAdd, "css");
|
|
11085
11100
|
}
|
|
11086
11101
|
return style;
|
|
11087
11102
|
};
|
|
@@ -11246,9 +11261,8 @@ const Box = props => {
|
|
|
11246
11261
|
layout = getDefaultDisplay(TagName);
|
|
11247
11262
|
}
|
|
11248
11263
|
const innerClassName = withPropsClassName(baseClassName, className);
|
|
11249
|
-
const
|
|
11250
|
-
const
|
|
11251
|
-
const shouldForwardAllToChild = visualSelector && pseudoStateSelector;
|
|
11264
|
+
const selfForwardedProps = {};
|
|
11265
|
+
const childForwardedProps = {};
|
|
11252
11266
|
{
|
|
11253
11267
|
const parentLayout = useContext(BoxLayoutContext);
|
|
11254
11268
|
const styleDeps = [
|
|
@@ -11304,66 +11318,112 @@ const Box = props => {
|
|
|
11304
11318
|
pseudoElements
|
|
11305
11319
|
};
|
|
11306
11320
|
const boxStyles = {};
|
|
11307
|
-
|
|
11308
|
-
|
|
11309
|
-
|
|
11310
|
-
|
|
11311
|
-
|
|
11321
|
+
let boxPseudoNamedStyles = PSEUDO_NAMED_STYLES_DEFAULT;
|
|
11322
|
+
const shouldForwardAllToChild = visualSelector && pseudoStateSelector;
|
|
11323
|
+
const addStyle = (value, name, stylesTarget, context) => {
|
|
11324
|
+
styleDeps.push(value); // impact box style -> add to deps
|
|
11325
|
+
const cssVar = managedByCSSVars[name];
|
|
11326
|
+
const mergedValue = prepareStyleValue(stylesTarget[name], value, name, context);
|
|
11327
|
+
if (cssVar) {
|
|
11328
|
+
stylesTarget[cssVar] = mergedValue;
|
|
11329
|
+
return true;
|
|
11312
11330
|
}
|
|
11313
|
-
|
|
11314
|
-
|
|
11315
|
-
|
|
11316
|
-
|
|
11317
|
-
|
|
11318
|
-
|
|
11319
|
-
|
|
11320
|
-
if (COPIED_ON_VISUAL_CHILD_PROP_SET.has(propName)) {
|
|
11321
|
-
return "style_and_forward";
|
|
11322
|
-
}
|
|
11331
|
+
stylesTarget[name] = mergedValue;
|
|
11332
|
+
return false;
|
|
11333
|
+
};
|
|
11334
|
+
const addStyleMaybeForwarding = (value, name, stylesTarget, context, visualChildPropStrategy) => {
|
|
11335
|
+
if (!visualChildPropStrategy) {
|
|
11336
|
+
addStyle(value, name, stylesTarget, context);
|
|
11337
|
+
return false;
|
|
11323
11338
|
}
|
|
11324
|
-
|
|
11325
|
-
|
|
11339
|
+
const cssVar = managedByCSSVars[name];
|
|
11340
|
+
if (cssVar) {
|
|
11341
|
+
// css var wins over visual child handling
|
|
11342
|
+
addStyle(value, name, stylesTarget, context);
|
|
11343
|
+
return false;
|
|
11326
11344
|
}
|
|
11327
|
-
if (
|
|
11328
|
-
|
|
11345
|
+
if (visualChildPropStrategy === "copy") {
|
|
11346
|
+
// we stylyze ourself + forward prop to the child
|
|
11347
|
+
addStyle(value, name, stylesTarget, context);
|
|
11329
11348
|
}
|
|
11330
|
-
return
|
|
11349
|
+
return true;
|
|
11331
11350
|
};
|
|
11332
|
-
const
|
|
11333
|
-
const
|
|
11334
|
-
|
|
11351
|
+
const assignStyle = (value, name, styleContext, boxStylesTarget, styleOrigin) => {
|
|
11352
|
+
const context = styleOrigin === "base_style" ? "js" : "css";
|
|
11353
|
+
const isCss = styleOrigin === "base_style" || styleOrigin === "style";
|
|
11354
|
+
if (isCss) {
|
|
11355
|
+
addStyle(value, name, boxStylesTarget, context);
|
|
11335
11356
|
return;
|
|
11336
11357
|
}
|
|
11337
|
-
const
|
|
11338
|
-
const
|
|
11339
|
-
if (
|
|
11340
|
-
|
|
11341
|
-
|
|
11358
|
+
const isPseudoStyle = styleOrigin === "pseudo_style";
|
|
11359
|
+
const mightStyle = isStyleProp(name);
|
|
11360
|
+
if (!mightStyle) {
|
|
11361
|
+
// not a style prop what do we do with it?
|
|
11362
|
+
if (shouldForwardAllToChild) {
|
|
11363
|
+
if (isPseudoStyle) ; else {
|
|
11364
|
+
childForwardedProps[name] = value;
|
|
11365
|
+
}
|
|
11366
|
+
} else {
|
|
11367
|
+
if (isPseudoStyle) {
|
|
11368
|
+
console.warn(`unsupported pseudo style key "${name}"`);
|
|
11369
|
+
}
|
|
11370
|
+
selfForwardedProps[name] = value;
|
|
11371
|
+
}
|
|
11372
|
+
return;
|
|
11342
11373
|
}
|
|
11343
|
-
if
|
|
11344
|
-
|
|
11345
|
-
|
|
11346
|
-
|
|
11374
|
+
// it's a style prop, we need first to check if we have css var to handle them
|
|
11375
|
+
// otherwise we decide to put it either on self or child
|
|
11376
|
+
const visualChildPropStrategy = visualSelector && getVisualChildStylePropStrategy(name);
|
|
11377
|
+
const getStyle = getHowToHandleStyleProp(name);
|
|
11378
|
+
if (
|
|
11379
|
+
// prop name === css style name
|
|
11380
|
+
!getStyle) {
|
|
11381
|
+
const needForwarding = addStyleMaybeForwarding(value, name, boxStylesTarget, context, visualChildPropStrategy);
|
|
11382
|
+
if (needForwarding) {
|
|
11383
|
+
if (isPseudoStyle) ; else {
|
|
11384
|
+
childForwardedProps[name] = value;
|
|
11385
|
+
}
|
|
11347
11386
|
}
|
|
11348
|
-
|
|
11349
|
-
|
|
11387
|
+
return;
|
|
11388
|
+
}
|
|
11389
|
+
const cssValues = getStyle(value, styleContext);
|
|
11390
|
+
if (!cssValues) {
|
|
11391
|
+
return;
|
|
11392
|
+
}
|
|
11393
|
+
let needForwarding = false;
|
|
11394
|
+
for (const styleName of Object.keys(cssValues)) {
|
|
11395
|
+
const cssValue = cssValues[styleName];
|
|
11396
|
+
needForwarding = addStyleMaybeForwarding(cssValue, styleName, boxStylesTarget, context, visualChildPropStrategy);
|
|
11397
|
+
}
|
|
11398
|
+
if (needForwarding) {
|
|
11399
|
+
if (isPseudoStyle) ; else {
|
|
11400
|
+
childForwardedProps[name] = value;
|
|
11350
11401
|
}
|
|
11351
11402
|
}
|
|
11352
11403
|
};
|
|
11353
|
-
|
|
11354
|
-
|
|
11404
|
+
if (baseStyle) {
|
|
11405
|
+
for (const key of baseStyle) {
|
|
11406
|
+
const value = baseStyle[key];
|
|
11407
|
+
assignStyle(value, key, styleContext, boxStyles, "baseStyle");
|
|
11408
|
+
}
|
|
11409
|
+
}
|
|
11410
|
+
const remainingPropKeyArray = Object.keys(rest);
|
|
11411
|
+
for (const propName of remainingPropKeyArray) {
|
|
11412
|
+
if (propName === "ref") {
|
|
11355
11413
|
// some props not destructured but that are neither
|
|
11356
11414
|
// style props, nor should be forwarded to the child
|
|
11357
11415
|
continue;
|
|
11358
11416
|
}
|
|
11359
|
-
const
|
|
11360
|
-
|
|
11417
|
+
const propValue = rest[propName];
|
|
11418
|
+
assignStyle(propValue, propName, styleContext, boxStyles, "prop");
|
|
11361
11419
|
}
|
|
11362
|
-
let pseudoNamedStyles = PSEUDO_NAMED_STYLES_DEFAULT;
|
|
11363
11420
|
if (pseudoStyle) {
|
|
11421
|
+
const assignPseudoStyle = (propValue, propName, pseudoStyleContext, pseudoStylesTarget) => {
|
|
11422
|
+
assignStyle(propValue, propName, pseudoStyleContext, pseudoStylesTarget, "pseudo_style");
|
|
11423
|
+
};
|
|
11364
11424
|
const pseudoStyleKeys = Object.keys(pseudoStyle);
|
|
11365
11425
|
if (pseudoStyleKeys.length) {
|
|
11366
|
-
|
|
11426
|
+
boxPseudoNamedStyles = {};
|
|
11367
11427
|
for (const key of pseudoStyleKeys) {
|
|
11368
11428
|
const pseudoStyleContext = {
|
|
11369
11429
|
...styleContext,
|
|
@@ -11381,9 +11441,9 @@ const Box = props => {
|
|
|
11381
11441
|
const pseudoClassStyle = pseudoStyle[key];
|
|
11382
11442
|
for (const pseudoClassStyleKey of Object.keys(pseudoClassStyle)) {
|
|
11383
11443
|
const pseudoClassStyleValue = pseudoClassStyle[pseudoClassStyleKey];
|
|
11384
|
-
|
|
11444
|
+
assignPseudoStyle(pseudoClassStyleValue, pseudoClassStyleKey, pseudoStyleContext, pseudoClassStyles);
|
|
11385
11445
|
}
|
|
11386
|
-
|
|
11446
|
+
boxPseudoNamedStyles[key] = pseudoClassStyles;
|
|
11387
11447
|
continue;
|
|
11388
11448
|
}
|
|
11389
11449
|
// pseudo element
|
|
@@ -11393,29 +11453,31 @@ const Box = props => {
|
|
|
11393
11453
|
const pseudoElementStyle = pseudoStyle[key];
|
|
11394
11454
|
for (const pseudoElementStyleKey of Object.keys(pseudoElementStyle)) {
|
|
11395
11455
|
const pseudoElementStyleValue = pseudoElementStyle[pseudoElementStyleKey];
|
|
11396
|
-
|
|
11456
|
+
assignPseudoStyle(pseudoElementStyleValue, pseudoElementStyleKey, pseudoStyleContext, pseudoElementStyles);
|
|
11397
11457
|
}
|
|
11398
|
-
|
|
11458
|
+
boxPseudoNamedStyles[key] = pseudoElementStyles;
|
|
11399
11459
|
continue;
|
|
11400
11460
|
}
|
|
11401
11461
|
console.warn(`unsupported pseudo style key "${key}"`);
|
|
11402
11462
|
}
|
|
11403
11463
|
}
|
|
11404
|
-
|
|
11464
|
+
childForwardedProps.pseudoStyle = pseudoStyle;
|
|
11405
11465
|
}
|
|
11406
11466
|
if (typeof style === "string") {
|
|
11407
|
-
|
|
11408
|
-
|
|
11467
|
+
const styleObject = normalizeStyles(style, "css");
|
|
11468
|
+
for (const styleName of Object.keys(styleObject)) {
|
|
11469
|
+
const styleValue = styleObject[styleName];
|
|
11470
|
+
assignStyle(styleValue, styleName, styleContext, boxStyles, "style");
|
|
11471
|
+
}
|
|
11409
11472
|
} else if (style && typeof style === "object") {
|
|
11410
|
-
for (const
|
|
11411
|
-
const
|
|
11412
|
-
assignStyle(
|
|
11413
|
-
styleDeps.push(stylePropValue); // impact box style -> add to deps
|
|
11473
|
+
for (const styleName of Object.keys(style)) {
|
|
11474
|
+
const styleValue = style[styleName];
|
|
11475
|
+
assignStyle(styleValue, styleName, styleContext, boxStyles, "style");
|
|
11414
11476
|
}
|
|
11415
11477
|
}
|
|
11416
11478
|
const updateStyle = useCallback(state => {
|
|
11417
11479
|
const boxEl = ref.current;
|
|
11418
|
-
applyStyle(boxEl, boxStyles, state,
|
|
11480
|
+
applyStyle(boxEl, boxStyles, state, boxPseudoNamedStyles);
|
|
11419
11481
|
}, styleDeps);
|
|
11420
11482
|
const finalStyleDeps = [pseudoStateSelector, innerPseudoState, updateStyle];
|
|
11421
11483
|
// By default ":hover", ":active" are not tracked.
|
|
@@ -11446,11 +11508,13 @@ const Box = props => {
|
|
|
11446
11508
|
return null;
|
|
11447
11509
|
}
|
|
11448
11510
|
const pseudoStateEl = pseudoStateSelector ? boxEl.querySelector(pseudoStateSelector) : boxEl;
|
|
11511
|
+
const visualEl = visualSelector ? boxEl.querySelector(visualSelector) : null;
|
|
11449
11512
|
return initPseudoStyles(pseudoStateEl, {
|
|
11450
11513
|
pseudoClasses: innerPseudoClasses,
|
|
11451
11514
|
pseudoState: innerPseudoState,
|
|
11452
11515
|
effect: updateStyle,
|
|
11453
|
-
elementToImpact: boxEl
|
|
11516
|
+
elementToImpact: boxEl,
|
|
11517
|
+
elementListeningPseudoState: visualEl
|
|
11454
11518
|
});
|
|
11455
11519
|
}, finalStyleDeps);
|
|
11456
11520
|
}
|
|
@@ -11461,9 +11525,9 @@ const Box = props => {
|
|
|
11461
11525
|
let innerChildren;
|
|
11462
11526
|
if (hasChildFunction) {
|
|
11463
11527
|
if (Array.isArray(children)) {
|
|
11464
|
-
innerChildren = children.map(child => typeof child === "function" ? child(
|
|
11528
|
+
innerChildren = children.map(child => typeof child === "function" ? child(childForwardedProps) : child);
|
|
11465
11529
|
} else if (typeof children === "function") {
|
|
11466
|
-
innerChildren = children(
|
|
11530
|
+
innerChildren = children(childForwardedProps);
|
|
11467
11531
|
} else {
|
|
11468
11532
|
innerChildren = children;
|
|
11469
11533
|
}
|
|
@@ -11476,7 +11540,8 @@ const Box = props => {
|
|
|
11476
11540
|
"data-layout-inline": inline ? "" : undefined,
|
|
11477
11541
|
"data-layout-row": row ? "" : undefined,
|
|
11478
11542
|
"data-layout-column": column ? "" : undefined,
|
|
11479
|
-
|
|
11543
|
+
"data-visual-selector": visualSelector,
|
|
11544
|
+
...selfForwardedProps,
|
|
11480
11545
|
children: jsx(BoxLayoutContext.Provider, {
|
|
11481
11546
|
value: layout,
|
|
11482
11547
|
children: innerChildren
|
|
@@ -16573,10 +16638,9 @@ installImportMetaCss(import.meta);import.meta.css = /* css */`
|
|
|
16573
16638
|
display: inline-flex;
|
|
16574
16639
|
box-sizing: border-box;
|
|
16575
16640
|
padding: 0;
|
|
16576
|
-
flex-direction: inherit;
|
|
16577
16641
|
background: none;
|
|
16578
16642
|
border: none;
|
|
16579
|
-
border-radius:
|
|
16643
|
+
border-radius: var(--x-border-radius);
|
|
16580
16644
|
outline: none;
|
|
16581
16645
|
cursor: pointer;
|
|
16582
16646
|
}
|
|
@@ -16752,7 +16816,7 @@ const ButtonBasic = props => {
|
|
|
16752
16816
|
return jsxs(Box, {
|
|
16753
16817
|
...buttonProps,
|
|
16754
16818
|
as: "span",
|
|
16755
|
-
|
|
16819
|
+
className: "navi_button_content",
|
|
16756
16820
|
children: [innerChildren, jsx("span", {
|
|
16757
16821
|
className: "navi_button_shadow"
|
|
16758
16822
|
})]
|
|
@@ -21654,15 +21718,15 @@ const DialogLayout = ({
|
|
|
21654
21718
|
...props
|
|
21655
21719
|
}) => {
|
|
21656
21720
|
return jsx(Box, {
|
|
21657
|
-
|
|
21721
|
+
baseClassName: "navi_dialog_layout",
|
|
21658
21722
|
managedByCSSVars: DialogManagedByCSSVars,
|
|
21659
21723
|
visualSelector: ".navi_dialog_content",
|
|
21660
21724
|
...props,
|
|
21661
|
-
contentAlignX: contentAlignX,
|
|
21662
|
-
contentAlignY: contentAlignY,
|
|
21663
21725
|
children: jsx(Box, {
|
|
21664
|
-
className: "navi_dialog_content",
|
|
21665
21726
|
row: true,
|
|
21727
|
+
className: "navi_dialog_content",
|
|
21728
|
+
contentAlignX: contentAlignX,
|
|
21729
|
+
contentAlignY: contentAlignY,
|
|
21666
21730
|
children: children
|
|
21667
21731
|
})
|
|
21668
21732
|
});
|