@rcarls/rc-theme-material 0.4.2 → 0.6.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.
@@ -0,0 +1,99 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "name": "rc-theme-material rendered constraints",
4
+ "version": 1,
5
+ "sources": {
6
+ "material3": "https://m3.material.io/",
7
+ "lists": "https://m3.material.io/components/lists/specs",
8
+ "buttons": "https://m3.material.io/components/buttons/specs",
9
+ "iconButtons": "https://m3.material.io/components/icon-buttons/specs",
10
+ "iconButtonsExpressive": "https://github.com/material-components/material-components-android/blob/master/lib/java/com/google/android/material/button/res/values/styles.xml",
11
+ "menus": "https://m3.material.io/components/menus/specs"
12
+ },
13
+ "constraints": [
14
+ {
15
+ "id": "list.inline-content-padding",
16
+ "selector": "rc-list > rc-list-item",
17
+ "variants": ["standard", "segmented"],
18
+ "geometry": {
19
+ "contentInlineStart": "16px",
20
+ "contentInlineEnd": "16px"
21
+ },
22
+ "source": "lists"
23
+ },
24
+ {
25
+ "id": "list.leading-icon",
26
+ "selector": "rc-list-item > [slot='leading'][data-rc-list-leading]",
27
+ "geometry": {
28
+ "inlineSize": "24px",
29
+ "blockSize": "24px",
30
+ "iconSize": "24px"
31
+ },
32
+ "source": "lists"
33
+ },
34
+ {
35
+ "id": "button.small-container",
36
+ "selector": "rc-button:not([icon-only])",
37
+ "geometry": {
38
+ "minBlockSize": "40px"
39
+ },
40
+ "typography": {
41
+ "role": "label-large"
42
+ },
43
+ "source": "buttons"
44
+ },
45
+ {
46
+ "id": "icon-button.small",
47
+ "selector": "rc-button[icon-only]",
48
+ "geometry": {
49
+ "containerInlineSize": "40px",
50
+ "containerBlockSize": "40px",
51
+ "iconSize": "24px",
52
+ "minTouchTarget": "48px"
53
+ },
54
+ "source": "iconButtons"
55
+ },
56
+ {
57
+ "id": "adaptive-menu.overflow-trigger",
58
+ "selector": "rc-adaptive-menu::part(overflow-trigger)",
59
+ "variants": ["small", "narrow"],
60
+ "geometry": {
61
+ "containerInlineSize": "32px",
62
+ "containerBlockSize": "40px",
63
+ "iconSize": "24px",
64
+ "minTouchTarget": "48px"
65
+ },
66
+ "source": "iconButtonsExpressive"
67
+ },
68
+ {
69
+ "id": "menu.item",
70
+ "selector": "rc-menu [role^='menuitem'], rc-adaptive-menu > [data-rc-action-overflowed]",
71
+ "geometry": {
72
+ "minBlockSize": "48px",
73
+ "paddingInlineStart": "12px",
74
+ "paddingInlineEnd": "12px",
75
+ "contentGap": "12px",
76
+ "leadingIconSize": "24px"
77
+ },
78
+ "typography": {
79
+ "role": "body-large",
80
+ "fontSize": "16px",
81
+ "fontWeight": "400",
82
+ "lineHeight": "24px",
83
+ "tracking": "0.5px"
84
+ },
85
+ "source": "menus"
86
+ },
87
+ {
88
+ "id": "adaptive-menu.viewport-containment",
89
+ "selector": "rc-adaptive-menu::part(popup)",
90
+ "behavior": {
91
+ "maxInlineSize": "viewport - 8px",
92
+ "maxBlockSize": "viewport - 8px",
93
+ "overflow": "auto",
94
+ "overscrollBehavior": "contain"
95
+ },
96
+ "source": "menus"
97
+ }
98
+ ]
99
+ }
package/defaults.css CHANGED
@@ -149,10 +149,22 @@
149
149
  --md-ref-palette-neutral-variant100: #ffffffff;
150
150
  /* Neutral 0 */
151
151
  --md-ref-palette-neutral0: #000000ff;
152
+ /* Neutral 4 */
153
+ --md-ref-palette-neutral4: #0f0e11ff;
154
+ /* Neutral 6 */
155
+ --md-ref-palette-neutral6: #141317ff;
152
156
  /* Neutral 10 */
153
157
  --md-ref-palette-neutral10: #1c1b1fff;
158
+ /* Neutral 12 */
159
+ --md-ref-palette-neutral12: #211f23ff;
160
+ /* Neutral 17 */
161
+ --md-ref-palette-neutral17: #2b292eff;
154
162
  /* Neutral 20 */
155
163
  --md-ref-palette-neutral20: #313033ff;
164
+ /* Neutral 22 */
165
+ --md-ref-palette-neutral22: #363438ff;
166
+ /* Neutral 24 */
167
+ --md-ref-palette-neutral24: #3b383dff;
156
168
  /* Neutral 30 */
157
169
  --md-ref-palette-neutral30: #484649ff;
158
170
  /* Neutral 40 */
@@ -165,10 +177,20 @@
165
177
  --md-ref-palette-neutral70: #aeaaaeff;
166
178
  /* Neutral 80 */
167
179
  --md-ref-palette-neutral80: #c9c5caff;
180
+ /* Neutral 87 */
181
+ --md-ref-palette-neutral87: #ded8deff;
168
182
  /* Neutral 90 */
169
183
  --md-ref-palette-neutral90: #e6e1e5ff;
184
+ /* Neutral 92 */
185
+ --md-ref-palette-neutral92: #ece6ecff;
186
+ /* Neutral 94 */
187
+ --md-ref-palette-neutral94: #f2ecf2ff;
170
188
  /* Neutral 95 */
171
189
  --md-ref-palette-neutral95: #f4eff4ff;
190
+ /* Neutral 96 */
191
+ --md-ref-palette-neutral96: #f8f2f8ff;
192
+ /* Neutral 98 */
193
+ --md-ref-palette-neutral98: #fdf8fdff;
172
194
  /* Neutral 99 */
173
195
  --md-ref-palette-neutral99: #fffbfeff;
174
196
  /* Neutral 100 */
@@ -723,8 +745,18 @@
723
745
  var(--md-ref-palette-tertiary40),
724
746
  var(--md-ref-palette-tertiary80)
725
747
  );
748
+ /* Tertiary fixed — persistent color, same value in both themes */
749
+ --md-sys-color-tertiary-fixed: var(--md-ref-palette-tertiary90);
750
+ /* On tertiary fixed */
751
+ --md-sys-color-on-tertiary-fixed: var(--md-ref-palette-tertiary10);
752
+ /* Tertiary fixed dim */
753
+ --md-sys-color-tertiary-fixed-dim: var(--md-ref-palette-tertiary80);
754
+ /* On tertiary fixed variant */
755
+ --md-sys-color-on-tertiary-fixed-variant: var(--md-ref-palette-tertiary30);
726
756
  /* Shadow */
727
757
  --md-sys-color-shadow: var(--md-ref-palette-neutral0);
758
+ /* Scrim */
759
+ --md-sys-color-scrim: var(--md-ref-palette-neutral0);
728
760
  /* Error */
729
761
  --md-sys-color-error: light-dark(var(--md-ref-palette-error40), var(--md-ref-palette-error80));
730
762
  /* Outline */
@@ -732,6 +764,11 @@
732
764
  var(--md-ref-palette-neutral-variant50),
733
765
  var(--md-ref-palette-neutral-variant60)
734
766
  );
767
+ /* Outline variant */
768
+ --md-sys-color-outline-variant: light-dark(
769
+ var(--md-ref-palette-neutral-variant80),
770
+ var(--md-ref-palette-neutral-variant30)
771
+ );
735
772
  /* On background */
736
773
  --md-sys-color-on-background: light-dark(
737
774
  var(--md-ref-palette-neutral10),
@@ -739,8 +776,8 @@
739
776
  );
740
777
  /* Background */
741
778
  --md-sys-color-background: light-dark(
742
- var(--md-ref-palette-neutral99),
743
- var(--md-ref-palette-neutral10)
779
+ var(--md-ref-palette-neutral98),
780
+ var(--md-ref-palette-neutral6)
744
781
  );
745
782
  /* Inverse on surface */
746
783
  --md-sys-color-inverse-on-surface: light-dark(
@@ -767,35 +804,45 @@
767
804
  var(--md-ref-palette-neutral-variant90),
768
805
  var(--md-ref-palette-neutral-variant30)
769
806
  );
807
+ /* Surface dim */
808
+ --md-sys-color-surface-dim: light-dark(
809
+ var(--md-ref-palette-neutral87),
810
+ var(--md-ref-palette-neutral6)
811
+ );
770
812
  /* Surface */
771
813
  --md-sys-color-surface: light-dark(
772
- var(--md-ref-palette-neutral99),
773
- var(--md-ref-palette-neutral10)
814
+ var(--md-ref-palette-neutral98),
815
+ var(--md-ref-palette-neutral6)
816
+ );
817
+ /* Surface bright */
818
+ --md-sys-color-surface-bright: light-dark(
819
+ var(--md-ref-palette-neutral98),
820
+ var(--md-ref-palette-neutral24)
774
821
  );
775
822
  /* Surface container lowest (near-white / near-black) */
776
823
  --md-sys-color-surface-container-lowest: light-dark(
777
824
  var(--md-ref-palette-neutral100),
778
- var(--md-ref-palette-neutral10)
825
+ var(--md-ref-palette-neutral4)
779
826
  );
780
827
  /* Surface container low */
781
828
  --md-sys-color-surface-container-low: light-dark(
782
- var(--md-ref-palette-neutral99),
829
+ var(--md-ref-palette-neutral96),
783
830
  var(--md-ref-palette-neutral10)
784
831
  );
785
832
  /* Surface container — used for menus, sheets, and elevated surfaces */
786
833
  --md-sys-color-surface-container: light-dark(
787
- var(--md-ref-palette-neutral95),
788
- var(--md-ref-palette-neutral20)
834
+ var(--md-ref-palette-neutral94),
835
+ var(--md-ref-palette-neutral12)
789
836
  );
790
837
  /* Surface container high */
791
838
  --md-sys-color-surface-container-high: light-dark(
792
- var(--md-ref-palette-neutral90),
793
- var(--md-ref-palette-neutral20)
839
+ var(--md-ref-palette-neutral92),
840
+ var(--md-ref-palette-neutral17)
794
841
  );
795
842
  /* Surface container highest — used for text fields and chips */
796
843
  --md-sys-color-surface-container-highest: light-dark(
797
844
  var(--md-ref-palette-neutral90),
798
- var(--md-ref-palette-neutral20)
845
+ var(--md-ref-palette-neutral22)
799
846
  );
800
847
  /* On secondary container */
801
848
  --md-sys-color-on-secondary-container: light-dark(
@@ -817,6 +864,14 @@
817
864
  var(--md-ref-palette-secondary40),
818
865
  var(--md-ref-palette-secondary80)
819
866
  );
867
+ /* Secondary fixed — persistent color, same value in both themes */
868
+ --md-sys-color-secondary-fixed: var(--md-ref-palette-secondary90);
869
+ /* On secondary fixed */
870
+ --md-sys-color-on-secondary-fixed: var(--md-ref-palette-secondary10);
871
+ /* Secondary fixed dim */
872
+ --md-sys-color-secondary-fixed-dim: var(--md-ref-palette-secondary80);
873
+ /* On secondary fixed variant */
874
+ --md-sys-color-on-secondary-fixed-variant: var(--md-ref-palette-secondary30);
820
875
  /* Inverse primary */
821
876
  --md-sys-color-inverse-primary: light-dark(
822
877
  var(--md-ref-palette-primary80),
@@ -842,18 +897,86 @@
842
897
  var(--md-ref-palette-primary40),
843
898
  var(--md-ref-palette-primary80)
844
899
  );
900
+ /* Primary fixed — persistent color, same value in both themes */
901
+ --md-sys-color-primary-fixed: var(--md-ref-palette-primary90);
902
+ /* On primary fixed */
903
+ --md-sys-color-on-primary-fixed: var(--md-ref-palette-primary10);
904
+ /* Primary fixed dim */
905
+ --md-sys-color-primary-fixed-dim: var(--md-ref-palette-primary80);
906
+ /* On primary fixed variant */
907
+ --md-sys-color-on-primary-fixed-variant: var(--md-ref-palette-primary30);
845
908
  }
846
909
 
910
+ /*
911
+ * Forced-colors (Windows High Contrast) coverage for every role defined
912
+ * above. Deliberately collapses to a few tiers rather than one system
913
+ * color per role: forced-colors mode exists to strip semantic hue in
914
+ * favor of the user's chosen palette, so distinguishing e.g. tertiary
915
+ * from error by color here would work against that intent.
916
+ * - True accent (primary and its container/fixed/inverse variants):
917
+ * a Highlight fill with HighlightText content, everywhere.
918
+ * - Secondary emphasis (secondary, tertiary, error, and each one's
919
+ * container/fixed variants): styled as a plain control instead of
920
+ * color-coded by family. The "plain" role in each triple (secondary,
921
+ * tertiary, error) is also the one components use as a fill for
922
+ * their own filled variant (see rc-button's danger/filled styling),
923
+ * so it takes the fill/content pairing ButtonText fill with
924
+ * ButtonFace content; the *-container/*-fixed roles are always
925
+ * read as a soft background, so they get the inverse pairing:
926
+ * ButtonFace fill with ButtonText content.
927
+ * - Surfaces (background/surface and every container/dim/bright
928
+ * tier, surface-variant): a Canvas fill with CanvasText content,
929
+ * except surface-container-highest which stays Field (text
930
+ * fields, chips).
931
+ * - Borders: ButtonBorder.
932
+ * Elevation shadows are zeroed throughout, since tonal/shadow elevation
933
+ * isn't part of the forced-colors palette either.
934
+ */
847
935
  @media (forced-colors: active) {
848
936
  .rc-theme-material,
849
937
  :host(.rc-theme-material) {
938
+ /* Accent tier */
850
939
  --md-sys-color-primary: Highlight;
851
940
  --md-sys-color-on-primary: HighlightText;
852
941
  --md-sys-color-primary-container: Highlight;
853
942
  --md-sys-color-on-primary-container: HighlightText;
943
+ --md-sys-color-primary-fixed: Highlight;
944
+ --md-sys-color-primary-fixed-dim: Highlight;
945
+ --md-sys-color-on-primary-fixed: HighlightText;
946
+ --md-sys-color-on-primary-fixed-variant: HighlightText;
947
+ --md-sys-color-inverse-primary: Canvas;
948
+
949
+ /* Secondary-emphasis tier: secondary, tertiary, and error all
950
+ styled as plain controls rather than color-coded */
951
+ --md-sys-color-secondary: ButtonText;
952
+ --md-sys-color-on-secondary: ButtonFace;
854
953
  --md-sys-color-secondary-container: ButtonFace;
855
954
  --md-sys-color-on-secondary-container: ButtonText;
955
+ --md-sys-color-secondary-fixed: ButtonFace;
956
+ --md-sys-color-secondary-fixed-dim: ButtonFace;
957
+ --md-sys-color-on-secondary-fixed: ButtonText;
958
+ --md-sys-color-on-secondary-fixed-variant: ButtonText;
959
+ --md-sys-color-tertiary: ButtonText;
960
+ --md-sys-color-on-tertiary: ButtonFace;
961
+ --md-sys-color-tertiary-container: ButtonFace;
962
+ --md-sys-color-on-tertiary-container: ButtonText;
963
+ --md-sys-color-tertiary-fixed: ButtonFace;
964
+ --md-sys-color-tertiary-fixed-dim: ButtonFace;
965
+ --md-sys-color-on-tertiary-fixed: ButtonText;
966
+ --md-sys-color-on-tertiary-fixed-variant: ButtonText;
967
+ --md-sys-color-error: ButtonText;
968
+ --md-sys-color-on-error: ButtonFace;
969
+ --md-sys-color-error-container: ButtonFace;
970
+ --md-sys-color-on-error-container: ButtonText;
971
+
972
+ /* Surface tier */
973
+ --md-sys-color-background: Canvas;
974
+ --md-sys-color-on-background: CanvasText;
856
975
  --md-sys-color-surface: Canvas;
976
+ --md-sys-color-surface-variant: Canvas;
977
+ --md-sys-color-surface-dim: Canvas;
978
+ --md-sys-color-surface-bright: Canvas;
979
+ --md-sys-color-surface-container-lowest: Canvas;
857
980
  --md-sys-color-surface-container-low: Canvas;
858
981
  --md-sys-color-surface-container: Canvas;
859
982
  --md-sys-color-surface-container-high: Canvas;
@@ -862,11 +985,17 @@
862
985
  --md-sys-color-on-surface-variant: CanvasText;
863
986
  --md-sys-color-inverse-surface: CanvasText;
864
987
  --md-sys-color-inverse-on-surface: Canvas;
988
+
989
+ /* Borders */
865
990
  --md-sys-color-outline: ButtonBorder;
866
991
  --md-sys-color-outline-variant: ButtonBorder;
992
+
993
+ /* Elevation: shadows carry no meaning under forced colors */
867
994
  --md-sys-elevation-level1: 0px;
868
995
  --md-sys-elevation-level2: 0px;
869
996
  --md-sys-elevation-level3: 0px;
997
+ --md-sys-elevation-level4: 0px;
998
+ --md-sys-elevation-level5: 0px;
870
999
  }
871
1000
  }
872
1001
  }
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "0.4.2",
6
+ "version": "0.6.0",
7
7
  "description": "Material 3 CSS theme and token bridge for rc-webcomponents.",
8
8
  "repository": {
9
9
  "type": "git",
@@ -28,6 +28,7 @@
28
28
  "files": [
29
29
  "*.css",
30
30
  "components",
31
+ "constraints",
31
32
  "README.md"
32
33
  ],
33
34
  "scripts": {
@@ -37,6 +38,10 @@
37
38
  "test:browser:firefox": "vitest --run --project=firefox"
38
39
  },
39
40
  "devDependencies": {
41
+ "@rcarls/rc-adaptive-menu": "0.6.0",
42
+ "@rcarls/rc-button": "0.6.0",
43
+ "@rcarls/rc-list": "0.6.0",
44
+ "@rcarls/rc-menu-button": "0.6.0",
40
45
  "@vitest/browser-playwright": "4.1.5",
41
46
  "playwright": "^1.56.0",
42
47
  "vite": "^7.1.7",