@jsenv/navi 0.11.9 → 0.11.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.
@@ -1,5 +1,5 @@
1
1
  import { installImportMetaCss } from "./jsenv_navi_side_effects.js";
2
- import { createIterableWeakSet, createPubSub, createValueEffect, createStyleController, getVisuallyVisibleInfo, getFirstVisuallyVisibleAncestor, allowWheelThrough, visibleRectEffect, pickPositionRelativeTo, getBorderSizes, getPaddingSizes, activeElementSignal, canInterceptKeys, initUITransition, getElementSignature, resolveCSSSize, normalizeStyles, appendStyles, findBefore, findAfter, initFocusGroup, elementIsFocusable, pickLightOrDark, dragAfterThreshold, getScrollContainer, stickyAsRelativeCoords, createDragToMoveGestureController, getDropTargetInfo, setStyles, useActiveElement } from "@jsenv/dom";
2
+ import { createIterableWeakSet, createPubSub, createValueEffect, createStyleController, getVisuallyVisibleInfo, getFirstVisuallyVisibleAncestor, allowWheelThrough, visibleRectEffect, pickPositionRelativeTo, getBorderSizes, getPaddingSizes, activeElementSignal, canInterceptKeys, initUITransition, getElementSignature, resolveCSSSize, normalizeStyles, normalizeStyle, appendStyles, findBefore, findAfter, initFocusGroup, elementIsFocusable, pickLightOrDark, 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, useImperativeHandle, useErrorBoundary, useId } from "preact/hooks";
@@ -9921,6 +9921,7 @@ const withPropsStyle = (
9921
9921
  } else if (marginY !== undefined) {
9922
9922
  marginStyles.marginBottom = sizeSpacingScale[marginY] || marginY;
9923
9923
  }
9924
+ normalizeStyles(marginStyles, "css", true);
9924
9925
  }
9925
9926
  {
9926
9927
  paddingStyles = {};
@@ -9950,6 +9951,7 @@ const withPropsStyle = (
9950
9951
  } else if (paddingY !== undefined) {
9951
9952
  paddingStyles.paddingBottom = sizeSpacingScale[paddingY] || paddingY;
9952
9953
  }
9954
+ normalizeStyles(paddingStyles, "css", true);
9953
9955
  }
9954
9956
  }
9955
9957
  alignment_styles: {
@@ -10033,7 +10035,7 @@ const withPropsStyle = (
10033
10035
  sizeStyles.width = "100%"; // Take full width outside flex
10034
10036
  }
10035
10037
  } else if (width !== undefined) {
10036
- sizeStyles.width = width;
10038
+ sizeStyles.width = normalizeStyle(width, "width", "css");
10037
10039
  }
10038
10040
  if (expandY) {
10039
10041
  if (flexDirection === "row") {
@@ -10044,7 +10046,7 @@ const withPropsStyle = (
10044
10046
  sizeStyles.height = "100%"; // Take full height outside flex
10045
10047
  }
10046
10048
  } else if (height !== undefined) {
10047
- sizeStyles.height = height;
10049
+ sizeStyles.height = normalizeStyle(height, "height", "css");
10048
10050
  }
10049
10051
  }
10050
10052
  typo_styles: {
@@ -10058,7 +10060,7 @@ const withPropsStyle = (
10058
10060
  typeof textSize === "string"
10059
10061
  ? sizeTypoScale[textSize] || textSize
10060
10062
  : textSize;
10061
- typoStyles.fontSize = fontSize;
10063
+ typoStyles.fontSize = normalizeStyle(fontSize, "fontSize", "css");
10062
10064
  }
10063
10065
  if (textBold) {
10064
10066
  typoStyles.fontWeight = "bold";
@@ -10121,10 +10123,18 @@ const withPropsStyle = (
10121
10123
  visualStyles.borderBottom = borderBottom;
10122
10124
  }
10123
10125
  if (borderWidth !== undefined) {
10124
- visualStyles.borderWidth = borderWidth;
10126
+ visualStyles.borderWidth = normalizeStyle(
10127
+ sizeSpacingScale[borderWidth] || borderWidth,
10128
+ "borderWidth",
10129
+ "css",
10130
+ );
10125
10131
  }
10126
10132
  if (borderRadius !== undefined) {
10127
- visualStyles.borderRadius = borderRadius;
10133
+ visualStyles.borderRadius = normalizeStyle(
10134
+ sizeSpacingScale[borderRadius] || borderRadius,
10135
+ "borderRadius",
10136
+ "css",
10137
+ );
10128
10138
  }
10129
10139
  if (borderColor !== undefined) {
10130
10140
  visualStyles.borderColor = borderColor;
@@ -13857,7 +13867,8 @@ installImportMetaCss(import.meta);import.meta.css = /* css */`
13857
13867
  );
13858
13868
 
13859
13869
  --color: currentColor;
13860
- --color-readonly: color-mix(in srgb, currentColor 60%, transparent);
13870
+ --color-dimmed: color-mix(in srgb, currentColor 60%, transparent);
13871
+ --color-readonly: var(--color-dimmed);
13861
13872
  --color-disabled: var(--color-readonly);
13862
13873
 
13863
13874
  width: 100%;
@@ -13874,6 +13885,15 @@ installImportMetaCss(import.meta);import.meta.css = /* css */`
13874
13885
  outline-color: var(--border-color);
13875
13886
  outline-offset: calc(-1 * (var(--border-width)));
13876
13887
  }
13888
+ .navi_input::placeholder {
13889
+ color: var(--color-dimmed);
13890
+ }
13891
+ .navi_input:-internal-autofill-selected {
13892
+ /* Webkit is putting some nasty styles after automplete that look as follow */
13893
+ /* input:-internal-autofill-selected { color: FieldText !important; } */
13894
+ /* Fortunately we can override it as follow */
13895
+ -webkit-text-fill-color: var(--color) !important;
13896
+ }
13877
13897
  /* Focus */
13878
13898
  .navi_input[data-focus] {
13879
13899
  border-color: var(--outline-color);
@@ -13883,16 +13903,13 @@ installImportMetaCss(import.meta);import.meta.css = /* css */`
13883
13903
  }
13884
13904
  /* Readonly */
13885
13905
  .navi_input[data-readonly] {
13886
- color: var(--color-readonly);
13906
+ --color: var(--color-readonly);
13887
13907
  background-color: var(--background-color-readonly);
13888
13908
  outline-color: var(--border-color-readonly);
13889
13909
  }
13890
- .navi_input[data-readonly]::placeholder {
13891
- color: var(--color-readonly);
13892
- }
13893
13910
  /* Disabled */
13894
13911
  .navi_input[data-disabled] {
13895
- color: var(--color-disabled);
13912
+ --color: var(--color-disabled);
13896
13913
  background-color: var(--background-color-disabled);
13897
13914
  outline-color: var(--border-color-disabled);
13898
13915
  }
@@ -19231,6 +19248,16 @@ const SVGMaskOverlay = ({
19231
19248
  });
19232
19249
  };
19233
19250
 
19251
+ const Image = props => {
19252
+ const [remainingProps, innerStyle] = withPropsStyle(props, {
19253
+ spacing: true
19254
+ });
19255
+ return jsx("img", {
19256
+ style: innerStyle,
19257
+ ...remainingProps
19258
+ });
19259
+ };
19260
+
19234
19261
  const Overflow = ({
19235
19262
  className,
19236
19263
  children,
@@ -19304,8 +19331,8 @@ const Title = ({
19304
19331
  as = "h1",
19305
19332
  ...rest
19306
19333
  }) => {
19307
- if (rest.bold === undefined) {
19308
- rest.bold = true;
19334
+ if (rest.textBold === undefined) {
19335
+ rest.textBold = true;
19309
19336
  }
19310
19337
  const [remainingProps, innerStyle] = withPropsStyle(rest, {
19311
19338
  layout: true,
@@ -19337,12 +19364,14 @@ installImportMetaCss(import.meta);import.meta.css = /* css */`
19337
19364
  }
19338
19365
  `;
19339
19366
  const FlexRow = ({
19367
+ className,
19340
19368
  alignX,
19341
19369
  alignY,
19342
19370
  gap,
19343
19371
  children,
19344
19372
  ...rest
19345
19373
  }) => {
19374
+ const innerClassName = withPropsClassName("navi_flex_row", className);
19346
19375
  const [remainingProps, innerStyle] = withPropsStyle(rest, {
19347
19376
  base: {
19348
19377
  // Only set justifyContent if it's not the default "start"
@@ -19355,7 +19384,7 @@ const FlexRow = ({
19355
19384
  });
19356
19385
  return jsx("div", {
19357
19386
  ...remainingProps,
19358
- className: "navi_flex_row",
19387
+ className: innerClassName,
19359
19388
  style: innerStyle,
19360
19389
  children: jsx(FlexDirectionContext.Provider, {
19361
19390
  value: "row",
@@ -19364,12 +19393,14 @@ const FlexRow = ({
19364
19393
  });
19365
19394
  };
19366
19395
  const FlexColumn = ({
19396
+ className,
19367
19397
  alignX,
19368
19398
  alignY,
19369
19399
  gap,
19370
19400
  children,
19371
19401
  ...rest
19372
19402
  }) => {
19403
+ const innerClassName = withPropsClassName("navi_flex_column", className);
19373
19404
  const [remainingProps, innerStyle] = withPropsStyle(rest, {
19374
19405
  base: {
19375
19406
  // Only set alignItems if it's not the default "stretch"
@@ -19377,11 +19408,12 @@ const FlexColumn = ({
19377
19408
  // Only set justifyContent if it's not the default "start"
19378
19409
  justifyContent: alignY !== "start" ? alignY : undefined,
19379
19410
  gap: sizeSpacingScale[gap] || gap
19380
- }
19411
+ },
19412
+ layout: true
19381
19413
  });
19382
19414
  return jsx("div", {
19383
19415
  ...remainingProps,
19384
- className: "navi_flex_column",
19416
+ className: innerClassName,
19385
19417
  style: innerStyle,
19386
19418
  children: jsx(FlexDirectionContext.Provider, {
19387
19419
  value: "column",
@@ -19421,7 +19453,8 @@ const Spacing = ({
19421
19453
  ...rest
19422
19454
  }) => {
19423
19455
  const [remainingProps, innerStyle] = withPropsStyle(rest, {
19424
- spacing: true
19456
+ spacing: true,
19457
+ visual: true
19425
19458
  });
19426
19459
  return jsx("div", {
19427
19460
  ...remainingProps,
@@ -19507,5 +19540,5 @@ const useDependenciesDiff = (inputs) => {
19507
19540
  return diffRef.current;
19508
19541
  };
19509
19542
 
19510
- export { ActionRenderer, ActiveKeyboardShortcuts, Button, Checkbox, CheckboxList, Col, Colgroup, Details, Editable, ErrorBoundaryContext, FlexColumn, FlexItem, FlexRow, FontSizedSvg, Form, Icon, IconAndText, Input, Label, Link, LinkWithIcon, Overflow, Paragraph, Radio, RadioList, Route, RouteLink, Routes, RowNumberCol, RowNumberTableCell, SINGLE_SPACE_CONSTRAINT, SVGMaskOverlay, Select, SelectionContext, Spacing, SummaryMarker, Tab, TabList, Table, TableCell, Tbody, Text, TextAndCount, 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, useCellsAndColumns, useDependenciesDiff, useDocumentState, useDocumentUrl, useEditionController, useFocusGroup, useKeyboardShortcuts, useNavState, useRouteStatus, useRunOnMount, useSelectableElement, useSelectionController, useSignalSync, useStateArray, valueInLocalStorage };
19543
+ export { ActionRenderer, ActiveKeyboardShortcuts, Button, Checkbox, CheckboxList, Col, Colgroup, Details, Editable, ErrorBoundaryContext, FlexColumn, FlexItem, FlexRow, FontSizedSvg, Form, Icon, IconAndText, Image, Input, Label, Link, LinkWithIcon, Overflow, Paragraph, Radio, RadioList, Route, RouteLink, Routes, RowNumberCol, RowNumberTableCell, SINGLE_SPACE_CONSTRAINT, SVGMaskOverlay, Select, SelectionContext, Spacing, SummaryMarker, Tab, TabList, Table, TableCell, Tbody, Text, TextAndCount, 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, useCellsAndColumns, useDependenciesDiff, useDocumentState, useDocumentUrl, useEditionController, useFocusGroup, useKeyboardShortcuts, useNavState, useRouteStatus, useRunOnMount, useSelectableElement, useSelectionController, useSignalSync, useStateArray, valueInLocalStorage };
19511
19544
  //# sourceMappingURL=jsenv_navi.js.map