@nanahoshi/mona-ui 0.25.0 → 0.25.1

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.
@@ -16,7 +16,7 @@ const BUTTON_GROUP_DEFAULT_MESSAGES = {
16
16
 
17
17
  const buttonGroupThemeVariants = cva(`
18
18
  inline-flex items-center justify-center
19
- border border-border
19
+ border border-input-border
20
20
  data-[invalid='true']:border-error
21
21
  data-[invalid='true']:ring-2 data-[invalid='true']:ring-error/35
22
22
  data-[readonly='true']:[&_button[aria-pressed]]:cursor-default
@@ -81,7 +81,7 @@ const buttonThemeVariants = cva(`
81
81
  look: {
82
82
  default: `
83
83
  ${themeControlSurfaceClasses} text-foreground
84
- border border-border
84
+ border border-input-border
85
85
  hover:bg-hover active:bg-active
86
86
  focus-visible:border-focus-indicator
87
87
  `,
@@ -111,7 +111,7 @@ const buttonThemeVariants = cva(`
111
111
  `,
112
112
  outline: `
113
113
  ${themeControlSurfaceClasses} text-foreground
114
- border border-border
114
+ border border-input-border
115
115
  hover:bg-hover active:bg-active
116
116
  focus-visible:border-focus-indicator
117
117
  `,
@@ -37867,7 +37867,7 @@ class CartesianChartRenderer {
37867
37867
  static renderAxisLayer(context, scene, styleResolver) {
37868
37868
  const { axes, plotRect } = scene;
37869
37869
  const axisLineColor = styleResolver.resolveCssVariable("--mona-chart-axis-line-color") ||
37870
- styleResolver.resolveCssVariable("--color-border") ||
37870
+ styleResolver.resolveCssVariable("--color-border-control") ||
37871
37871
  "rgba(148, 163, 184, 0.45)";
37872
37872
  context.save();
37873
37873
  for (const axisScene of axes) {
@@ -38182,7 +38182,7 @@ class FunnelChartRenderer {
38182
38182
  }
38183
38183
  else {
38184
38184
  const hoverColor = styleResolver.resolveCssVariable("--mona-chart-funnel-hover-outline-color") ||
38185
- styleResolver.resolveCssVariable("--color-border") ||
38185
+ styleResolver.resolveCssVariable("--color-border-control") ||
38186
38186
  "rgba(255, 255, 255, 0.85)";
38187
38187
  context.strokeStyle = hoverColor;
38188
38188
  context.lineWidth = 1.5;
@@ -38297,7 +38297,7 @@ class HeatmapChartRenderer {
38297
38297
  context.restore();
38298
38298
  // 3. Draw Axis Baseline Lines
38299
38299
  const axisLineColor = styleResolver.resolveCssVariable("--mona-chart-axis-line-color") ||
38300
- styleResolver.resolveCssVariable("--color-border") ||
38300
+ styleResolver.resolveCssVariable("--color-border-control") ||
38301
38301
  "rgba(148, 163, 184, 0.45)";
38302
38302
  for (const axisScene of axes) {
38303
38303
  if (!axisScene.visible || !axisScene.axisLine) {
@@ -38340,7 +38340,7 @@ class HeatmapChartRenderer {
38340
38340
  }
38341
38341
  else {
38342
38342
  const hoverColor = styleResolver.resolveCssVariable("--mona-chart-heatmap-hover-outline-color") ||
38343
- styleResolver.resolveCssVariable("--color-border") ||
38343
+ styleResolver.resolveCssVariable("--color-border-control") ||
38344
38344
  "rgba(255, 255, 255, 0.85)";
38345
38345
  context.strokeStyle = hoverColor;
38346
38346
  context.lineWidth = 1.5;
@@ -38359,7 +38359,7 @@ class RoseGridRenderer {
38359
38359
  return;
38360
38360
  }
38361
38361
  const gridColor = styleResolver.resolveCssVariable("--mona-chart-grid-color") ||
38362
- styleResolver.resolveCssVariable("--color-border") ||
38362
+ styleResolver.resolveCssVariable("--color-border-control") ||
38363
38363
  "rgba(150, 150, 150, 0.2)";
38364
38364
  const zeroLineColor = styleResolver.resolveCssVariable("--mona-chart-zero-line-color") ||
38365
38365
  styleResolver.resolveCssVariable("--color-muted-foreground") ||
@@ -38420,7 +38420,7 @@ class RoseGridRenderer {
38420
38420
  return;
38421
38421
  }
38422
38422
  const axisLineColor = styleResolver.resolveCssVariable("--mona-chart-axis-line-color") ||
38423
- styleResolver.resolveCssVariable("--color-border") ||
38423
+ styleResolver.resolveCssVariable("--color-border-control") ||
38424
38424
  "rgba(150, 150, 150, 0.5)";
38425
38425
  const sweepSpan = Math.abs(endAngleRad - startAngleRad);
38426
38426
  const isFullSweep = sweepSpan >= Math.PI * 2 - 1e-4;
@@ -38886,7 +38886,7 @@ class PolarAxisGridRenderer {
38886
38886
  return;
38887
38887
  }
38888
38888
  const gridColor = styleResolver.resolveCssVariable("--mona-chart-grid-color") ||
38889
- styleResolver.resolveCssVariable("--color-border") ||
38889
+ styleResolver.resolveCssVariable("--color-border-control") ||
38890
38890
  "rgba(150, 150, 150, 0.2)";
38891
38891
  const zeroLineColor = styleResolver.resolveCssVariable("--mona-chart-zero-line-color") ||
38892
38892
  styleResolver.resolveCssVariable("--color-muted-foreground") ||
@@ -38951,7 +38951,7 @@ class PolarAxisGridRenderer {
38951
38951
  return;
38952
38952
  }
38953
38953
  const axisLineColor = styleResolver.resolveCssVariable("--mona-chart-axis-line-color") ||
38954
- styleResolver.resolveCssVariable("--color-border") ||
38954
+ styleResolver.resolveCssVariable("--color-border-control") ||
38955
38955
  "rgba(150, 150, 150, 0.5)";
38956
38956
  context.save();
38957
38957
  // 1. Radial Axis Reference Spoke (pole to boundary along labelAngle)
@@ -39539,7 +39539,7 @@ class TreemapChartRenderer {
39539
39539
  }
39540
39540
  else {
39541
39541
  const hoverColor = styleResolver.resolveCssVariable("--mona-chart-treemap-hover-outline-color") ||
39542
- styleResolver.resolveCssVariable("--color-border") ||
39542
+ styleResolver.resolveCssVariable("--color-border-control") ||
39543
39543
  "rgba(255, 255, 255, 0.85)";
39544
39544
  context.strokeStyle = hoverColor;
39545
39545
  context.lineWidth = 1.5;
@@ -39662,7 +39662,7 @@ class WaterfallChartRenderer {
39662
39662
  styleResolver.resolveCssVariable("--color-primary") ||
39663
39663
  "#3b82f6";
39664
39664
  const hoverColor = styleResolver.resolveCssVariable("--mona-chart-waterfall-hover-outline-color") ||
39665
- styleResolver.resolveCssVariable("--color-border") ||
39665
+ styleResolver.resolveCssVariable("--color-border-control") ||
39666
39666
  "rgba(255, 255, 255, 0.85)";
39667
39667
  context.strokeStyle = isKeyboard ? focusColor : hoverColor;
39668
39668
  context.lineWidth = isKeyboard ? 2.5 : 1.5;
@@ -39672,7 +39672,7 @@ class WaterfallChartRenderer {
39672
39672
  context.restore();
39673
39673
  // 4. Draw Axis baseline lines
39674
39674
  const axisLineColor = styleResolver.resolveCssVariable("--mona-chart-axis-line-color") ||
39675
- styleResolver.resolveCssVariable("--color-border") ||
39675
+ styleResolver.resolveCssVariable("--color-border-control") ||
39676
39676
  "rgba(148, 163, 184, 0.45)";
39677
39677
  for (const axisScene of axes) {
39678
39678
  if (!axisScene.visible || !axisScene.axisLine) {
@@ -40254,7 +40254,7 @@ class SvgCartesianAxisRenderer {
40254
40254
  return;
40255
40255
  }
40256
40256
  const axisLineColor = styleResolver.resolveCssVariable("--mona-chart-axis-line-color") ||
40257
- styleResolver.resolveCssVariable("--color-border") ||
40257
+ styleResolver.resolveCssVariable("--color-border-control") ||
40258
40258
  "rgba(148, 163, 184, 0.5)";
40259
40259
  const items = [];
40260
40260
  for (const axisScene of axes) {
@@ -42805,7 +42805,7 @@ class SvgPolarArcRenderer {
42805
42805
  }
42806
42806
  const { angularAxis, center, innerRadius, outerRadius, radialAxis } = scene;
42807
42807
  const gridColor = styleResolver.resolveCssVariable("--mona-chart-grid-color") ||
42808
- styleResolver.resolveCssVariable("--color-border") ||
42808
+ styleResolver.resolveCssVariable("--color-border-control") ||
42809
42809
  "rgba(150, 150, 150, 0.2)";
42810
42810
  // Radial Grid Rings
42811
42811
  if (radialAxis && radialAxis.visible && radialAxis.gridLines) {
@@ -42878,7 +42878,7 @@ class SvgPolarArcRenderer {
42878
42878
  }
42879
42879
  const { angularAxis, center, outerRadius } = scene;
42880
42880
  const axisLineColor = styleResolver.resolveCssVariable("--mona-chart-axis-line-color") ||
42881
- styleResolver.resolveCssVariable("--color-border") ||
42881
+ styleResolver.resolveCssVariable("--color-border-control") ||
42882
42882
  "rgba(150, 150, 150, 0.5)";
42883
42883
  // Outer Boundary Arc
42884
42884
  if (angularAxis && angularAxis.visible && angularAxis.axisLine) {
@@ -43190,7 +43190,7 @@ class SvgPolarAxisRenderer {
43190
43190
  #renderBackground(scene, styleResolver) {
43191
43191
  const { angularAxis, center, outerRadius, radialAxis } = scene;
43192
43192
  const gridColor = styleResolver.resolveCssVariable("--mona-chart-grid-color") ||
43193
- styleResolver.resolveCssVariable("--color-border") ||
43193
+ styleResolver.resolveCssVariable("--color-border-control") ||
43194
43194
  "rgba(150, 150, 150, 0.2)";
43195
43195
  const zeroLineColor = styleResolver.resolveCssVariable("--mona-chart-zero-line-color") ||
43196
43196
  styleResolver.resolveCssVariable("--color-muted-foreground") ||
@@ -43263,7 +43263,7 @@ class SvgPolarAxisRenderer {
43263
43263
  #renderForeground(scene, styleResolver) {
43264
43264
  const { angularAxis, center, outerRadius, radialAxis } = scene;
43265
43265
  const axisLineColor = styleResolver.resolveCssVariable("--mona-chart-axis-line-color") ||
43266
- styleResolver.resolveCssVariable("--color-border") ||
43266
+ styleResolver.resolveCssVariable("--color-border-control") ||
43267
43267
  "rgba(150, 150, 150, 0.5)";
43268
43268
  // Outer Boundary Circle / Polygon
43269
43269
  if (angularAxis.visible && angularAxis.axisLine) {
@@ -43888,7 +43888,7 @@ class SvgHeatmapRenderer {
43888
43888
  });
43889
43889
  // 3. Axes
43890
43890
  const axisLineColor = styleResolver.resolveCssVariable("--mona-chart-axis-line-color") ||
43891
- styleResolver.resolveCssVariable("--color-border") ||
43891
+ styleResolver.resolveCssVariable("--color-border-control") ||
43892
43892
  "rgba(148, 163, 184, 0.45)";
43893
43893
  const axisSegments = [];
43894
43894
  for (const axisScene of axes) {
@@ -43957,7 +43957,7 @@ class SvgHeatmapRenderer {
43957
43957
  }
43958
43958
  else {
43959
43959
  const hoverColor = styleResolver.resolveCssVariable("--mona-chart-heatmap-hover-outline-color") ||
43960
- styleResolver.resolveCssVariable("--color-border") ||
43960
+ styleResolver.resolveCssVariable("--color-border-control") ||
43961
43961
  "rgba(255, 255, 255, 0.85)";
43962
43962
  setSvgAttribute(highlightEl, "fill", "none");
43963
43963
  setSvgAttribute(highlightEl, "stroke", hoverColor);
@@ -44116,7 +44116,7 @@ class SvgTreemapRenderer {
44116
44116
  }
44117
44117
  else {
44118
44118
  const hoverColor = styleResolver.resolveCssVariable("--mona-chart-treemap-hover-outline-color") ||
44119
- styleResolver.resolveCssVariable("--color-border") ||
44119
+ styleResolver.resolveCssVariable("--color-border-control") ||
44120
44120
  "rgba(255, 255, 255, 0.85)";
44121
44121
  setSvgAttribute(highlightEl, "fill", "none");
44122
44122
  setSvgAttribute(highlightEl, "stroke", hoverColor);
@@ -44230,7 +44230,7 @@ class SvgFunnelRenderer {
44230
44230
  }
44231
44231
  else {
44232
44232
  const hoverColor = styleResolver.resolveCssVariable("--mona-chart-funnel-hover-outline-color") ||
44233
- styleResolver.resolveCssVariable("--color-border") ||
44233
+ styleResolver.resolveCssVariable("--color-border-control") ||
44234
44234
  "rgba(255, 255, 255, 0.85)";
44235
44235
  setSvgAttribute(highlightPath, "stroke", hoverColor);
44236
44236
  setSvgAttribute(highlightPath, "stroke-width", 1.5);
@@ -44420,7 +44420,7 @@ class SvgWaterfallRenderer {
44420
44420
  });
44421
44421
  // 3. Axes
44422
44422
  const axisLineColor = styleResolver.resolveCssVariable("--mona-chart-axis-line-color") ||
44423
- styleResolver.resolveCssVariable("--color-border") ||
44423
+ styleResolver.resolveCssVariable("--color-border-control") ||
44424
44424
  "rgba(148, 163, 184, 0.45)";
44425
44425
  const axisSegments = [];
44426
44426
  for (const axisScene of axes) {
@@ -44486,7 +44486,7 @@ class SvgWaterfallRenderer {
44486
44486
  }
44487
44487
  else {
44488
44488
  const hoverColor = styleResolver.resolveCssVariable("--mona-chart-waterfall-hover-outline-color") ||
44489
- styleResolver.resolveCssVariable("--color-border") ||
44489
+ styleResolver.resolveCssVariable("--color-border-control") ||
44490
44490
  "rgba(255, 255, 255, 0.85)";
44491
44491
  setSvgAttribute(highlightEl, "fill", "none");
44492
44492
  setSvgAttribute(highlightEl, "stroke", hoverColor);
@@ -69,7 +69,7 @@ const chipThemeVariants = cva(`
69
69
  error: "bg-error text-error-foreground",
70
70
  warning: "bg-warning text-warning-foreground",
71
71
  info: "bg-info text-info-foreground",
72
- outline: "bg-transparent text-foreground border border-border",
72
+ outline: "bg-transparent text-foreground border border-input-border",
73
73
  secondary: "bg-secondary text-secondary-foreground",
74
74
  ghost: "bg-transparent text-foreground shadow-none"
75
75
  },
@@ -35,11 +35,15 @@ const scrollViewArrowThemeVariants = cva(`
35
35
  absolute top-0 bottom-0 flex items-center justify-center
36
36
  px-1
37
37
  cursor-pointer select-none
38
- bg-surface-overlay/65 text-foreground
39
- transition-colors duration-(--mona-motion-standard) ease-out
40
- hover:bg-hover/90 active:bg-active/90
38
+ bg-transparent text-foreground
39
+ forced-colors:bg-[Canvas]
41
40
  focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus-indicator
42
41
  [&_svg]:stroke-current
42
+ [&_svg]:drop-shadow-[0_0_1px_var(--color-surface),0_0_4px_var(--color-surface)]
43
+ [&_svg]:opacity-70
44
+ [&_svg]:transition-opacity [&_svg]:duration-(--mona-motion-standard) [&_svg]:ease-out
45
+ hover:[&_svg]:opacity-100 active:[&_svg]:opacity-100 focus-visible:[&_svg]:opacity-100
46
+ contrast-more:[&_svg]:opacity-100 forced-colors:[&_svg]:opacity-100
43
47
  `, {
44
48
  variants: {
45
49
  hidden: {
@@ -31,7 +31,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
31
31
  const segmentedContainerThemeVariants = cva(`
32
32
  relative inline-flex items-center gap-0.5
33
33
  ${themeControlSurfaceClasses}
34
- border border-border
34
+ border border-input-border
35
35
  p-1
36
36
  data-[invalid='true']:border-error
37
37
  data-[invalid='true']:ring-2 data-[invalid='true']:ring-error/35
@@ -189,7 +189,7 @@ const sliderTrackThemeVariants = cva(`
189
189
  relative z-2 cursor-pointer
190
190
  overflow-hidden
191
191
  bg-surface-muted text-foreground
192
- border border-input-border
192
+ contrast-more:border contrast-more:border-input-border
193
193
 
194
194
  data-[orientation="horizontal"]:w-full
195
195
  data-[orientation="horizontal"]:h-1.5
@@ -156,7 +156,7 @@ const splitButtonThemeVariants = cva(`
156
156
  error: "",
157
157
  ghost: "border-transparent",
158
158
  info: "",
159
- outline: "[&>button:not(:last-child)]:border-e [&>button:not(:last-child)]:border-border",
159
+ outline: "[&>button:not(:last-child)]:border-e [&>button:not(:last-child)]:border-input-border",
160
160
  primary: "",
161
161
  secondary: "",
162
162
  success: "",
@@ -264,8 +264,10 @@ const dark$5 = Object.freeze({
264
264
  "--color-input-foreground": "var(--color-foreground)",
265
265
  "--color-border-subtle": "#0F0F10",
266
266
  "--color-border": "#131416",
267
- "--color-border-control": "#6F7077",
268
- "--color-border-control-hover": "#818289",
267
+ "--color-border-control": "#0F0F10",
268
+ "--color-border-control-hover": "#17181A",
269
+ "--color-border-control-contrast": "#6F7077",
270
+ "--color-border-control-contrast-hover": "#818289",
269
271
  "--color-hover": "#242528",
270
272
  "--color-active": "#2A2B2E",
271
273
  "--color-disabled-foreground": "#9A9AA0",
@@ -404,8 +406,10 @@ const light$3 = Object.freeze({
404
406
  "--color-input-foreground": "var(--color-foreground)",
405
407
  "--color-border-subtle": "#eeeeef",
406
408
  "--color-border": "#e4e4e6",
407
- "--color-border-control": "#8a8b90",
408
- "--color-border-control-hover": "#76777c",
409
+ "--color-border-control": "#d5d6d9",
410
+ "--color-border-control-hover": "#c5c6ca",
411
+ "--color-border-control-contrast": "#8a8b90",
412
+ "--color-border-control-contrast-hover": "#76777c",
409
413
  "--color-hover": "#ecedef",
410
414
  "--color-active": "#e2e3e6",
411
415
  "--color-disabled-foreground": "#68696d",
@@ -482,8 +486,10 @@ const dark$3 = Object.freeze({
482
486
  "--color-input-foreground": "var(--color-foreground)",
483
487
  "--color-border-subtle": "#303033",
484
488
  "--color-border": "#39393d",
485
- "--color-border-control": "#74757a",
486
- "--color-border-control-hover": "#85868c",
489
+ "--color-border-control": "#494a4f",
490
+ "--color-border-control-hover": "#5a5b61",
491
+ "--color-border-control-contrast": "#74757a",
492
+ "--color-border-control-contrast-hover": "#85868c",
487
493
  "--color-hover": "#2f2f32",
488
494
  "--color-active": "#3a3a3e",
489
495
  "--color-disabled-foreground": "#8f9095",
@@ -731,8 +737,10 @@ const light$1 = Object.freeze({
731
737
  "--color-input-foreground": "var(--color-foreground)",
732
738
  "--color-border-subtle": "oklch(94% 0.002 286.320)",
733
739
  "--color-border": "oklch(92.2% 0.004 286.320)",
734
- "--color-border-control": "oklch(64% 0.010 286.067)",
735
- "--color-border-control-hover": "oklch(55.2% 0.010 285.938)",
740
+ "--color-border-control": "oklch(87.1% 0.006 286.286)",
741
+ "--color-border-control-hover": "oklch(80.5% 0.008 286.067)",
742
+ "--color-border-control-contrast": "oklch(64% 0.010 286.067)",
743
+ "--color-border-control-contrast-hover": "oklch(55.2% 0.010 285.938)",
736
744
  "--color-hover": "oklch(96.7% 0.001 286.375)",
737
745
  "--color-active": "oklch(92.2% 0.004 286.320)",
738
746
  "--color-disabled-foreground": "oklch(46% 0.010 285.938)",
@@ -796,8 +804,10 @@ const dark$1 = Object.freeze({
796
804
  "--color-input-foreground": "var(--color-foreground)",
797
805
  "--color-border-subtle": "oklch(24% 0.006 286.033)",
798
806
  "--color-border": "oklch(30% 0.007 286.033)",
799
- "--color-border-control": "oklch(56% 0.010 286.067)",
800
- "--color-border-control-hover": "oklch(65% 0.010 286.067)",
807
+ "--color-border-control": "oklch(32% 0.008 285.938)",
808
+ "--color-border-control-hover": "oklch(37.1% 0.008 285.805)",
809
+ "--color-border-control-contrast": "oklch(56% 0.010 286.067)",
810
+ "--color-border-control-contrast-hover": "oklch(65% 0.010 286.067)",
801
811
  "--color-hover": "oklch(32% 0.007 286.033)",
802
812
  "--color-active": "oklch(37.1% 0.008 285.805)",
803
813
  "--color-disabled-foreground": "oklch(70.5% 0.010 286.067)",
@@ -914,7 +924,8 @@ const contrastPairs = [
914
924
  ["--color-muted-foreground", "--color-surface", 4.5],
915
925
  ["--color-input-foreground", "--color-input-background", 4.5],
916
926
  ["--color-primary-foreground", "--color-primary", 4.5],
917
- ["--color-border-control", "--color-input-background", 3],
927
+ ["--color-border-control-contrast", "--color-input-background", 3],
928
+ ["--color-border-control-contrast-hover", "--color-input-background", 3],
918
929
  ["--color-focus-indicator", "--color-surface", 3],
919
930
  ["--color-selected-border", "--color-surface", 3]
920
931
  ];
@@ -962,6 +973,11 @@ function resolveColor(colors, token) {
962
973
  return undefined;
963
974
  }
964
975
 
976
+ /** A theme without these keeps its own border when the user asks for more contrast. */
977
+ const optionalTokens = new Set([
978
+ "--color-border-control-contrast",
979
+ "--color-border-control-contrast-hover"
980
+ ]);
965
981
  class DefaultThemeStrategy {
966
982
  #overrides;
967
983
  #themes = new Map();
@@ -1079,9 +1095,8 @@ function validateProfile(name, variant, profile) {
1079
1095
  const reference = builtInThemes.mona.variants.light;
1080
1096
  for (const section of ["colors", "shadows", "motion", "effects", "shape", "components"]) {
1081
1097
  const values = profile[section];
1082
- const missing = values
1083
- ? Object.keys(reference[section]).filter(key => !(key in values))
1084
- : Object.keys(reference[section]);
1098
+ const required = Object.keys(reference[section]).filter(key => !optionalTokens.has(key));
1099
+ const missing = values ? required.filter(key => !(key in values)) : required;
1085
1100
  if (missing.length > 0) {
1086
1101
  throw new Error(`Mona UI theme "${name}" is missing ${section} tokens for the "${variant}" variant: ${missing.join(", ")}.`);
1087
1102
  }
@@ -1173,6 +1188,7 @@ class ThemeService {
1173
1188
  #activeSelection;
1174
1189
  #appliedVariables;
1175
1190
  #colorSchemeQuery;
1191
+ #contrastQuery;
1176
1192
  #destroyRef;
1177
1193
  #document;
1178
1194
  #injector;
@@ -1207,6 +1223,7 @@ class ThemeService {
1207
1223
  ...(ngDevMode ? [{ debugName: "themeVariant" }] : /* istanbul ignore next */ []));
1208
1224
  const view = this.#document.defaultView;
1209
1225
  this.#colorSchemeQuery = view?.matchMedia?.("(prefers-color-scheme: dark)");
1226
+ this.#contrastQuery = view?.matchMedia?.("(prefers-contrast: more)");
1210
1227
  this.#transparencyQuery = view?.matchMedia?.("(prefers-reduced-transparency: reduce)");
1211
1228
  this.#storage = this.#options.persistKey ? inject(THEME_STORAGE) : null;
1212
1229
  this.#targets = this.#root ? [this.#root] : [];
@@ -1227,11 +1244,12 @@ class ThemeService {
1227
1244
  if (this.#root && this.#root !== this.#document.documentElement) {
1228
1245
  this.#themeOverlayContainer();
1229
1246
  }
1230
- const transparencyQuery = this.#transparencyQuery;
1231
- if (transparencyQuery) {
1232
- const onPreferenceChange = () => this.#applyTheme(this.#activeSelection(), this.#activeProfile());
1233
- transparencyQuery.addEventListener("change", onPreferenceChange);
1234
- this.#destroyRef.onDestroy(() => transparencyQuery.removeEventListener("change", onPreferenceChange));
1247
+ const onPreferenceChange = () => this.#applyTheme(this.#activeSelection(), this.#activeProfile());
1248
+ for (const query of [this.#transparencyQuery, this.#contrastQuery]) {
1249
+ if (query) {
1250
+ query.addEventListener("change", onPreferenceChange);
1251
+ this.#destroyRef.onDestroy(() => query.removeEventListener("change", onPreferenceChange));
1252
+ }
1235
1253
  }
1236
1254
  const colorSchemeQuery = this.#colorSchemeQuery;
1237
1255
  if (colorSchemeQuery) {
@@ -1302,7 +1320,7 @@ class ThemeService {
1302
1320
  }
1303
1321
  #applyTheme(selection, profile) {
1304
1322
  const transparency = this.#getTransparencyMode();
1305
- const variables = getEffectiveVariables(profile, transparency);
1323
+ const variables = getEffectiveVariables(profile, transparency, this.#contrastQuery?.matches === true);
1306
1324
  for (const target of this.#targets) {
1307
1325
  for (const previousName of this.#appliedVariables) {
1308
1326
  if (!(previousName in variables)) {
@@ -1441,6 +1459,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
1441
1459
  type: Injectable,
1442
1460
  args: [{ providedIn: "root" }]
1443
1461
  }], ctorParameters: () => [] });
1462
+ /** A field's border is quiet by default. Each pair is the variable and what replaces it for more contrast. */
1463
+ const contrastBorders = [
1464
+ ["--color-border-control", "--color-border-control-contrast"],
1465
+ ["--color-border-control-hover", "--color-border-control-contrast-hover"]
1466
+ ];
1444
1467
  const effectLevels = ["control", "raised", "overlay"];
1445
1468
  const preferenceVariants = ["light", "dark", "system"];
1446
1469
  function applyColorPalette(profile, colors) {
@@ -1449,8 +1472,17 @@ function applyColorPalette(profile, colors) {
1449
1472
  colors: Object.freeze({ ...profile.colors, ...colors })
1450
1473
  });
1451
1474
  }
1452
- function getEffectiveVariables(profile, transparency) {
1475
+ function getEffectiveVariables(profile, transparency, moreContrast) {
1453
1476
  const variables = { ...flattenThemeProfile(profile) };
1477
+ if (moreContrast) {
1478
+ for (const [name, replacement] of contrastBorders) {
1479
+ // A custom theme may not have one, and then keeps what it has.
1480
+ const value = profile.colors[replacement];
1481
+ if (value !== undefined) {
1482
+ variables[name] = value;
1483
+ }
1484
+ }
1485
+ }
1454
1486
  if (transparency === "full") {
1455
1487
  return variables;
1456
1488
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nanahoshi/mona-ui",
3
- "version": "0.25.0",
3
+ "version": "0.25.1",
4
4
  "description": "A very light Angular UI framework",
5
5
  "author": "Nanahoshi",
6
6
  "repository": {
package/styles.css CHANGED
@@ -33,8 +33,10 @@
33
33
  --color-input-foreground: var(--color-foreground);
34
34
  --color-border-subtle: oklch(94% 0.002 286.32);
35
35
  --color-border: oklch(92.2% 0.004 286.32);
36
- --color-border-control: oklch(64% 0.01 286.067);
37
- --color-border-control-hover: oklch(55.2% 0.01 285.938);
36
+ --color-border-control: oklch(87.1% 0.006 286.286);
37
+ --color-border-control-hover: oklch(80.5% 0.008 286.067);
38
+ --color-border-control-contrast: oklch(64% 0.01 286.067);
39
+ --color-border-control-contrast-hover: oklch(55.2% 0.01 285.938);
38
40
  --color-input-border: var(--color-border-control);
39
41
  --color-input-hover: var(--color-hover);
40
42
  --color-input-active: var(--color-surface-raised);
@@ -154,3 +156,11 @@
154
156
  --color-scrollbar-track-focus: var(--color-accent);
155
157
  --color-scrollbar-corner: var(--color-canvas);
156
158
  }
159
+
160
+ /* A theme provider does this itself, for the theme it applies. This is for the values above, without one. */
161
+ @media (prefers-contrast: more) {
162
+ :root {
163
+ --color-border-control: var(--color-border-control-contrast);
164
+ --color-border-control-hover: var(--color-border-control-contrast-hover);
165
+ }
166
+ }