@uni-design-system/uni-core 5.2.0 → 6.0.0

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/esm/index.js CHANGED
@@ -820,6 +820,28 @@ var generateShadows = (colors, mode = "light") => {
820
820
  };
821
821
  };
822
822
  //#endregion
823
+ //#region src/concepts/iconography/icon.records.ts
824
+ /**
825
+ * Default icon primitives shipped with every theme. Each icon is an inline
826
+ * SVG data URI rendered as a CSS mask over `currentColor`, so icons recolor
827
+ * with the theme automatically. `createTheme` merges a theme's own `icons`
828
+ * over this set — add or override under any name; components render them by
829
+ * token via `uni-icon`, never by inlining SVG.
830
+ */
831
+ var BaseIcons = {
832
+ alertCircle: "data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3e%3cpath d='M0 0h24v24H0V0z' fill='none'/%3e%3cpath d='M11 15h2v2h-2zm0-8h2v6h-2zm.99-5C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z'/%3e%3c/svg%3e",
833
+ calendar: "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M19 3h-1V1h-2v2H8V1H6v2H5c-1.11 0-1.99.9-1.99 2L3 19c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H5V8h14v11zM7 10h5v5H7z'%3E%3C/path%3E%3C/svg%3E",
834
+ checkCircle: "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3E%3Cg%3E%3Cpath d='M32,0A32,32,0,1,0,64,32,32,32,0,0,0,32,0Zm2.0873,41.5-5.4107,5.4106-.02.02L14.1751,32.4492l5.4306-5.4306,9.051,9.0509L46.2861,18.44l5.4305,5.4306Z'/%3E%3C/g%3E%3C/svg%3E",
835
+ chevronUp: "data:image/svg+xml,%0A%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'%3E%3Cpath d='m296-345-56-56 240-240 240 240-56 56-184-184-184 184Z'/%3E%3C/svg%3E",
836
+ chevronDown: "data:image/svg+xml,%0A%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'%3E%3Cpath d='M480-345 240-585l56-56 184 184 184-184 56 56-240 240Z'/%3E%3C/svg%3E",
837
+ chevronLeft: "data:image/svg+xml, %3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'%3E%3Cpath d='M560-240 320-480l240-240 56 56-184 184 184 184-56 56Z'/%3E%3C/svg%3E",
838
+ chevronRight: "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'%3E%3Cpath d='M504-480 320-664l56-56 240 240-240 240-56-56 184-184Z'/%3E%3C/svg%3E",
839
+ xCircle: "data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3e%3cg%3e%3cpath d='M32,0A32,32,0,1,0,64,32,32,32,0,0,0,32,0ZM47.4649,42.3543l-5.4306,5.43L31.68,37.4305,21.3257,47.7848l-5.4306-5.43L26.25,32,15.8951,21.6456l5.4306-5.4305L31.68,26.5694,42.0343,16.2151l5.4306,5.4305L37.1106,32Z'/%3e%3c/g%3e%3c/svg%3e",
840
+ search: "data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 50 50'%3e%3cg%3e%3cpath d='M 21 3 C 11.601563 3 4 10.601563 4 20 C 4 29.398438 11.601563 37 21 37 C 24.355469 37 27.460938 36.015625 30.09375 34.34375 L 42.375 46.625 L 46.625 42.375 L 34.5 30.28125 C 36.679688 27.421875 38 23.878906 38 20 C 38 10.601563 30.398438 3 21 3 Z M 21 7 C 28.199219 7 34 12.800781 34 20 C 34 27.199219 28.199219 33 21 33 C 13.800781 33 8 27.199219 8 20 C 8 12.800781 13.800781 7 21 7 Z'%3e%3c/path%3e%3c/g%3e%3c/svg%3e",
841
+ close: "data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3e%3cg%3e%3cpath fill='currentColor' d='M.439,21.44a1.5,1.5,0,0,0,2.122,2.121L11.823,14.3a.25.25,0,0,1,.354,0l9.262,9.263a1.5,1.5,0,1,0,2.122-2.121L14.3,12.177a.25.25,0,0,1,0-.354l9.263-9.262A1.5,1.5,0,0,0,21.439.44L12.177,9.7a.25.25,0,0,1-.354,0L2.561.44A1.5,1.5,0,0,0,.439,2.561L9.7,11.823a.25.25,0,0,1,0,.354Z'%3e%3c/path%3e%3c/g%3e%3c/svg%3e",
842
+ spinner: "data:image/svg+xml;charset=UTF-8,%3csvg stroke='%23000' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg' %3e%3cstyle%3e .oui_spinner %7b transform-origin: center; animation: rotate_360 2s linear infinite;%7d .oui_spinner circle %7b stroke-linecap: round; animation: dash 1.5s ease-in-out infinite;%7d %40keyframes rotate_360 %7b 100%25 %7b transform: rotate(360deg);%7d %7d %40keyframes dash %7b 0%25 %7b stroke-dasharray: 0 150; stroke-dashoffset: 0;%7d 47.5%25 %7b stroke-dasharray: 42 150; stroke-dashoffset: -16;%7d 95%25, 100%25 %7b stroke-dasharray: 42 150; stroke-dashoffset: -59;%7d %7d %3c/style%3e%3cg class='oui_spinner'%3e%3ccircle cx='12' cy='12' r='9.5' fill='none' stroke-width='3'%3e%3c/circle%3e%3c/g%3e%3c/svg%3e "
843
+ };
844
+ //#endregion
823
845
  //#region src/concepts/theme/themes/base.theme.ts
824
846
  var BaseTypography = {
825
847
  "display-large": {
@@ -958,6 +980,13 @@ var BaseTypography = {
958
980
  fontSize: 16,
959
981
  lineHeight: 24
960
982
  },
983
+ stat: {
984
+ fontFamily: "Red Hat Display",
985
+ fontSize: 32,
986
+ lineHeight: 38,
987
+ fontWeight: 600,
988
+ letterSpacing: -.32
989
+ },
961
990
  tag: {
962
991
  fontFamily: "Red Hat Display",
963
992
  fontSize: 15,
@@ -1101,7 +1130,23 @@ var buildComponents = (c) => ({
1101
1130
  ringColor: "surface",
1102
1131
  ringWidth: 2
1103
1132
  } },
1104
- checkbox: { options: { size: 20 } },
1133
+ searchInput: { options: {
1134
+ searchSymbol: "search",
1135
+ clearSymbol: "close",
1136
+ listColor: "primary-surface",
1137
+ listShadow: "menu",
1138
+ listBorderRadius: "xs",
1139
+ maxSuggestions: 8
1140
+ } },
1141
+ checkbox: { options: {
1142
+ size: 20,
1143
+ boxColor: "surface"
1144
+ } },
1145
+ radio: { options: {
1146
+ size: 20,
1147
+ ringColor: "outline",
1148
+ fillColor: "surface"
1149
+ } },
1105
1150
  dialog: { options: {
1106
1151
  borderRadius: "lg",
1107
1152
  color: "primary-surface",
@@ -1426,6 +1471,19 @@ var buildComponents = (c) => ({
1426
1471
  currentPageBorder: "light",
1427
1472
  currentPageBorderRadius: "xs"
1428
1473
  } },
1474
+ stat: { options: {
1475
+ labelTypeface: "label",
1476
+ valueTypeface: "stat",
1477
+ color: "surface",
1478
+ border: "light",
1479
+ borderRadius: "xs",
1480
+ positiveColor: "success",
1481
+ negativeColor: "error",
1482
+ trendColor: "outline",
1483
+ trendAccent: "primary",
1484
+ padding: "md",
1485
+ gap: "xxs"
1486
+ } },
1429
1487
  slider: { options: {
1430
1488
  color: "primary",
1431
1489
  trackColor: "surface-variant",
@@ -1452,7 +1510,11 @@ var buildComponents = (c) => ({
1452
1510
  grade: 0,
1453
1511
  opticalSize: 24
1454
1512
  } },
1455
- toggle: { options: { size: 20 } },
1513
+ toggle: { options: {
1514
+ size: 20,
1515
+ trackColor: "surface-variant",
1516
+ knobColor: "surface"
1517
+ } },
1456
1518
  tooltip: { options: {
1457
1519
  border: void 0,
1458
1520
  borderRadius: "xs",
@@ -1478,7 +1540,10 @@ var createTheme = ({ id, name, colors, icons = {}, radii = BaseRadii, shadows =
1478
1540
  shadows,
1479
1541
  spacing: BaseSpacing,
1480
1542
  thicknesses: BaseThicknesses,
1481
- icons,
1543
+ icons: {
1544
+ ...BaseIcons,
1545
+ ...icons
1546
+ },
1482
1547
  components: deepMerge(buildComponents(colors), components)
1483
1548
  });
1484
1549
  /**
@@ -1685,6 +1750,7 @@ var themeExport = (exportName, displayName, colorsConst, shadowsConst, radii) =>
1685
1750
  ` borders: borders(${colorsConst}),`,
1686
1751
  ` components: components(${colorsConst}),`,
1687
1752
  ` shadows: ${shadowsConst},`,
1753
+ " icons,",
1688
1754
  ...radii ? [" radii,"] : [],
1689
1755
  "});"
1690
1756
  ].join("\n");
@@ -1739,6 +1805,7 @@ var emitThemeFile = (input) => {
1739
1805
  " type Borders,",
1740
1806
  " type Colors,",
1741
1807
  " type ComponentThemes,",
1808
+ " type Icons,",
1742
1809
  " type Shadows,",
1743
1810
  " type UniTheme,",
1744
1811
  "} from '@uni-design-system/uni-core';",
@@ -1756,6 +1823,15 @@ var emitThemeFile = (input) => {
1756
1823
  " */",
1757
1824
  "const components = (colors: Colors): ComponentThemes => ({});",
1758
1825
  "",
1826
+ "/**",
1827
+ " * Icon primitives, merged over the built-in set (close, search, spinner,",
1828
+ " * chevrons, …). Define an icon ONCE here as an inline SVG data URI — it is",
1829
+ " * masked with currentColor, so it recolors with the theme — and render it",
1830
+ " * anywhere via `<uni-icon name='…'/>`. Never inline SVG in components.",
1831
+ " * Example: logo: \"data:image/svg+xml,%3Csvg xmlns='…' viewBox='0 0 24 24'%3E…%3C/svg%3E\",",
1832
+ " */",
1833
+ "const icons: Icons = {};",
1834
+ "",
1759
1835
  ...radii ? [
1760
1836
  `/** Shape language: '${input.shape}'. */`,
1761
1837
  `const radii = {\n${recordLiteral(radii, " ")}\n};`,
@@ -1964,6 +2040,6 @@ var debounce = (callback, timeout) => {
1964
2040
  };
1965
2041
  };
1966
2042
  //#endregion
1967
- export { BASE_PALETTE_CONFIG, BaseTheme, CategoryChroma, CategoryLightness, CategorySaturation, DarkTheme, DefaultThemeId, FontWeightMap, HSLAToString, HSLToHex, HSLToRGB, LightTheme, RGBToHSL, RGBToString, RoleHues, ShadowCssMap, ShadowMap, ShapeRadii, UniThemes, Z_INDEX, classifyScheme, collapseFadeOut, contrastRatio, createTheme, createThemeFromPalette, cycle, darkColors, debounce, emitDtcgTokens, emitThemeFile, expandFadeIn, fadeIn, fadeOut, generateColors, generatePalette, generateShadows, generateThemes, generateUniThemes, getAnalogousHues, getComplimentaryHue, getDeviceOrientation, getDeviceSize, getSplitComplimentaryHues, getTriadicHues, getValue, gradient, hexToHSL, hexToOklch, hexToRgb, inferCategory, lightColors, oklchToHex, randomRangeValue, relativeLuminance, removeInputPlatformStyling, rgbToHex, schemeHues, toTypeface, toTypefaces, uniColor };
2043
+ export { BASE_PALETTE_CONFIG, BaseIcons, BaseTheme, CategoryChroma, CategoryLightness, CategorySaturation, DarkTheme, DefaultThemeId, FontWeightMap, HSLAToString, HSLToHex, HSLToRGB, LightTheme, RGBToHSL, RGBToString, RoleHues, ShadowCssMap, ShadowMap, ShapeRadii, UniThemes, Z_INDEX, classifyScheme, collapseFadeOut, contrastRatio, createTheme, createThemeFromPalette, cycle, darkColors, debounce, emitDtcgTokens, emitThemeFile, expandFadeIn, fadeIn, fadeOut, generateColors, generatePalette, generateShadows, generateThemes, generateUniThemes, getAnalogousHues, getComplimentaryHue, getDeviceOrientation, getDeviceSize, getSplitComplimentaryHues, getTriadicHues, getValue, gradient, hexToHSL, hexToOklch, hexToRgb, inferCategory, lightColors, oklchToHex, randomRangeValue, relativeLuminance, removeInputPlatformStyling, rgbToHex, schemeHues, toTypeface, toTypefaces, uniColor };
1968
2044
 
1969
2045
  //# sourceMappingURL=index.js.map