@rolemodel/optics 2.5.1 → 2.6.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.
Files changed (65) hide show
  1. package/.github/workflows/linting.yml +2 -0
  2. package/.prettierignore +3 -0
  3. package/.yarn/install-state.gz +0 -0
  4. package/CHANGELOG.md +41 -0
  5. package/README.md +16 -0
  6. package/build_token_json.js +2 -1
  7. package/dist/README.md +16 -0
  8. package/dist/css/core/tokens/base_color_tokens.css +74 -0
  9. package/dist/css/core/tokens/base_tokens.css +3 -345
  10. package/dist/css/core/tokens/index.css +2 -1
  11. package/dist/css/core/tokens/oklch/base_color_tokens.css +74 -0
  12. package/dist/css/core/tokens/oklch/index.css +3 -0
  13. package/dist/css/core/tokens/oklch/scale_color_tokens.css +1498 -0
  14. package/dist/css/core/tokens/shared_tokens.css +272 -0
  15. package/dist/css/optics+feather_icons.css +74 -73
  16. package/dist/css/optics+feather_icons.min.css +1 -1
  17. package/dist/css/optics+lucide_icons.css +74 -73
  18. package/dist/css/optics+lucide_icons.min.css +1 -1
  19. package/dist/css/optics+material_outlined_variable.css +74 -73
  20. package/dist/css/optics+material_outlined_variable.min.css +1 -1
  21. package/dist/css/optics+no_icons.css +74 -73
  22. package/dist/css/optics+no_icons.min.css +1 -1
  23. package/dist/css/optics+phosphor_icons.css +74 -73
  24. package/dist/css/optics+phosphor_icons.min.css +1 -1
  25. package/dist/css/optics+tabler_icons.css +74 -73
  26. package/dist/css/optics+tabler_icons.min.css +1 -1
  27. package/dist/css/optics-oklch+feather_icons.css +6566 -0
  28. package/dist/css/optics-oklch+feather_icons.min.css +1 -0
  29. package/dist/css/optics-oklch+lucide_icons.css +13598 -0
  30. package/dist/css/optics-oklch+lucide_icons.min.css +1 -0
  31. package/dist/css/optics-oklch+material_outlined_variable.css +5636 -0
  32. package/dist/css/optics-oklch+material_outlined_variable.min.css +1 -0
  33. package/dist/css/optics-oklch+no_icons.css +5627 -0
  34. package/dist/css/optics-oklch+no_icons.min.css +1 -0
  35. package/dist/css/optics-oklch+phosphor_icons.css +5671 -0
  36. package/dist/css/optics-oklch+phosphor_icons.min.css +1 -0
  37. package/dist/css/optics-oklch+tabler_icons.css +5638 -0
  38. package/dist/css/optics-oklch+tabler_icons.min.css +1 -0
  39. package/dist/css/optics-oklch.css +5640 -0
  40. package/dist/css/optics-oklch.min.css +1 -0
  41. package/dist/css/optics.css +74 -73
  42. package/dist/css/optics.min.css +1 -1
  43. package/dist/package.json +10 -6
  44. package/dist/tokens/tokens.json +16 -16
  45. package/dist/tools/check-contrast.cjs +47 -0
  46. package/dist/tools/contrast/builds/build.cjs +44 -0
  47. package/dist/tools/contrast/builds/hsl-build.cjs +11 -0
  48. package/dist/tools/contrast/builds/oklch-build.cjs +11 -0
  49. package/dist/tools/contrast/calc-expression.cjs +68 -0
  50. package/dist/tools/contrast/check-error.cjs +4 -0
  51. package/dist/tools/contrast/color-pair.cjs +35 -0
  52. package/dist/tools/contrast/colors/color.cjs +41 -0
  53. package/dist/tools/contrast/colors/function-color.cjs +46 -0
  54. package/dist/tools/contrast/colors/hex-color.cjs +19 -0
  55. package/dist/tools/contrast/colors/hsl-color.cjs +25 -0
  56. package/dist/tools/contrast/colors/oklch-color.cjs +36 -0
  57. package/dist/tools/contrast/colors/themed-color.cjs +37 -0
  58. package/dist/tools/contrast/contrast-check.cjs +37 -0
  59. package/dist/tools/contrast/contrast-reporter.cjs +44 -0
  60. package/dist/tools/contrast/contrast-result.cjs +15 -0
  61. package/dist/tools/contrast/css-syntax.cjs +23 -0
  62. package/dist/tools/contrast/stylesheet.cjs +174 -0
  63. package/dist/tools/contrast/theme.cjs +84 -0
  64. package/dist/tools/contrast/tool-options.cjs +50 -0
  65. package/package.json +10 -6
@@ -0,0 +1,272 @@
1
+ :root {
2
+ /**
3
+ * @tokens Opacities
4
+ * @presenter Opacity
5
+ */
6
+ --op-opacity-none: 0;
7
+ --op-opacity-overlay: 0.2;
8
+ --op-opacity-disabled: 0.4;
9
+ --op-opacity-half: 0.5;
10
+ --op-opacity-full: 1;
11
+
12
+ /*
13
+ Breakpoints
14
+ CSS does not support using variables within @media or @container queries. Environment variables are drafted but likely to not be implemented soon.
15
+ https://drafts.csswg.org/css-env-1/
16
+ https://bholmes.dev/blog/alternative-to-css-variable-media-queries/
17
+
18
+ Here is a list of breakpoints used throughout Optics:
19
+ */
20
+
21
+ /**
22
+ * @tokens Breakpoints
23
+ * @presenter Spacing
24
+ */
25
+ --op-breakpoint-x-small: 512px; /* vertical phone */
26
+ --op-breakpoint-small: 768px; /* vertical ipad */
27
+ --op-breakpoint-medium: 1024px; /* landscape ipad */
28
+ --op-breakpoint-large: 1280px; /* small laptop */
29
+ --op-breakpoint-x-large: 1440px; /* medium laptop */
30
+
31
+ /* Border */
32
+
33
+ /**
34
+ * @tokens Border Radius
35
+ * @presenter BorderRadius
36
+ */
37
+ --op-radius-small: 2px;
38
+ --op-radius-medium: 4px;
39
+ --op-radius-large: 8px;
40
+ --op-radius-x-large: 12px;
41
+ --op-radius-2x-large: 16px;
42
+ --op-radius-circle: 50%;
43
+ --op-radius-pill: 9999px;
44
+
45
+ /**
46
+ * @tokens Border Width
47
+ * @presenter Spacing
48
+ */
49
+ --op-border-width: 1px;
50
+ --op-border-width-large: 2px;
51
+ --op-border-width-x-large: 4px;
52
+
53
+ /**
54
+ * @tokens Border Color
55
+ * @presenter Color
56
+ */
57
+ --op-color-border: var(--op-color-neutral-plus-five);
58
+
59
+ /* E.G. box-shadow: var(--op-border-top) var(--op-color-border); */
60
+
61
+ /**
62
+ * @tokens Border Shadow
63
+ * @presenter Shadow
64
+ */
65
+ --op-border-none: 0 0 0 0;
66
+ --op-border-all: 0 0 0 var(--op-border-width);
67
+ --op-border-top: 0 calc(-1 * var(--op-border-width)) 0 0;
68
+ --op-border-right: var(--op-border-width) 0 0 0;
69
+ --op-border-bottom: 0 var(--op-border-width) 0 0;
70
+ --op-border-left: calc(-1 * var(--op-border-width)) 0 0 0;
71
+ --op-border-y: var(--op-border-top) var(--op-color-border), var(--op-border-bottom) var(--op-color-border);
72
+ --op-border-x: var(--op-border-left) var(--op-color-border), var(--op-border-right) var(--op-color-border);
73
+
74
+ /* Font */
75
+
76
+ /**
77
+ * @tokens Font Scale
78
+ * @presenter FontSize
79
+ */
80
+ --op-font-scale-unit: 1rem; /* 10px; */
81
+ --op-font-2x-small: calc(var(--op-font-scale-unit) * 1); /* 10px */
82
+ --op-font-x-small: calc(var(--op-font-scale-unit) * 1.2); /* 12px */
83
+ --op-font-small: calc(var(--op-font-scale-unit) * 1.4); /* 14px */
84
+ --op-font-medium: calc(var(--op-font-scale-unit) * 1.6); /* 16px */
85
+ --op-font-large: calc(var(--op-font-scale-unit) * 1.8); /* 18px */
86
+ --op-font-x-large: calc(var(--op-font-scale-unit) * 2); /* 20px */
87
+ --op-font-2x-large: calc(var(--op-font-scale-unit) * 2.4); /* 24px */
88
+ --op-font-3x-large: calc(var(--op-font-scale-unit) * 2.8); /* 28px */
89
+ --op-font-4x-large: calc(var(--op-font-scale-unit) * 3.2); /* 32px */
90
+ --op-font-5x-large: calc(var(--op-font-scale-unit) * 3.6); /* 36px */
91
+ --op-font-6x-large: calc(var(--op-font-scale-unit) * 4.8); /* 48px */
92
+
93
+ /**
94
+ * @tokens Font Weight
95
+ * @presenter FontWeight
96
+ */
97
+ --op-font-weight-thin: 100;
98
+ --op-font-weight-extra-light: 200;
99
+ --op-font-weight-light: 300;
100
+ --op-font-weight-normal: 400;
101
+ --op-font-weight-medium: 500;
102
+ --op-font-weight-semi-bold: 600;
103
+ --op-font-weight-bold: 700;
104
+ --op-font-weight-extra-bold: 800;
105
+ --op-font-weight-black: 900;
106
+
107
+ /**
108
+ * @tokens Font Family
109
+ * @presenter FontFamily
110
+ */
111
+ --op-font-family: 'Noto Sans', sans-serif;
112
+ --op-font-family-alt: 'Noto Serif', serif;
113
+
114
+ /* Text */
115
+
116
+ /**
117
+ * @tokens Line Height
118
+ * @presenter LineHeight
119
+ */
120
+ --op-line-height-none: 0;
121
+ --op-line-height-densest: 1;
122
+ --op-line-height-denser: 1.15;
123
+ --op-line-height-dense: 1.3;
124
+ --op-line-height-base: 1.5;
125
+ --op-line-height-loose: 1.6;
126
+ --op-line-height-looser: 1.7;
127
+ --op-line-height-loosest: 1.8;
128
+
129
+ /**
130
+ * @tokens Letter Spacing
131
+ * @presenter LetterSpacing
132
+ */
133
+ --op-letter-spacing-navigation: 0.01rem;
134
+ --op-letter-spacing-label: 0.04rem;
135
+
136
+ /* Transitions and Animations */
137
+
138
+ /**
139
+ * @tokens Transition
140
+ */
141
+ --op-transition-accordion: rotate 120ms ease-in;
142
+ --op-transition-accordion-content: height 300ms ease, content-visibility 300ms ease allow-discrete;
143
+ --op-transition-input: all 120ms ease-in;
144
+ --op-transition-sidebar: all 200ms ease-in-out;
145
+ --op-transition-modal-time: 300ms;
146
+ --op-transition-modal: all var(--op-transition-modal-time) ease-in;
147
+ --op-transition-panel: right 400ms ease-in;
148
+ --op-transition-tooltip: all 300ms ease-in 300ms;
149
+
150
+ /**
151
+ * @tokens Animation
152
+ * @presenter Animation
153
+ */
154
+ --op-animation-flash: rm-slide-in-out-flash 5s normal forwards;
155
+
156
+ /* Encoded Images */
157
+
158
+ /**
159
+ * @tokens Encoded Images
160
+ */
161
+ --op-encoded-images-dropdown-arrow-width: calc(
162
+ 1.2 * var(--op-space-scale-unit)
163
+ ); /* 12px No way to string interpolate */
164
+
165
+ --op-encoded-images-dropdown-arrow: url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTIiIGhlaWdodD0iOSIgdmlld0JveD0iMCAwIDEyIDkiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxwYXRoIGQ9Ik02IDguMzc1MDFMMCAyLjM3NTAxTDEuNCAwLjk3NTAwNkw2IDUuNTc1MDFMMTAuNiAwLjk3NTAwNkwxMiAyLjM3NTAxTDYgOC4zNzUwMVoiIGZpbGw9IiMwQTBBMEIiLz4KPC9zdmc+Cg==');
166
+
167
+ /* Spacing */
168
+
169
+ /**
170
+ * @tokens Size Scale
171
+ * @presenter Spacing
172
+ */
173
+ --op-size-unit: 0.4rem; /* 4px */
174
+
175
+ /**
176
+ * @tokens Space Scale
177
+ * @presenter Spacing
178
+ */
179
+ --op-space-scale-unit: 1rem; /* 10px; */
180
+ --op-space-3x-small: calc(var(--op-space-scale-unit) * 0.2); /* 2px */
181
+ --op-space-2x-small: calc(var(--op-space-scale-unit) * 0.4); /* 4px */
182
+ --op-space-x-small: calc(var(--op-space-scale-unit) * 0.8); /* 8px */
183
+ --op-space-small: calc(var(--op-space-scale-unit) * 1.2); /* 12px */
184
+ --op-space-medium: calc(var(--op-space-scale-unit) * 1.6); /* 16px */
185
+ --op-space-large: calc(var(--op-space-scale-unit) * 2); /* 20px */
186
+ --op-space-x-large: calc(var(--op-space-scale-unit) * 2.4); /* 24px */
187
+ --op-space-2x-large: calc(var(--op-space-scale-unit) * 2.8); /* 28px */
188
+ --op-space-3x-large: calc(var(--op-space-scale-unit) * 4); /* 40px */
189
+ --op-space-4x-large: calc(var(--op-space-scale-unit) * 8); /* 80px */
190
+
191
+ /* Z Index */
192
+
193
+ /**
194
+ * @tokens Z-Index
195
+ */
196
+ --op-z-index-header: 500;
197
+ --op-z-index-footer: 500;
198
+ --op-z-index-sidebar: 700;
199
+ --op-z-index-dialog: 800;
200
+ --op-z-index-dialog-backdrop: 801;
201
+ --op-z-index-dialog-content: 802;
202
+ --op-z-index-dropdown: 900;
203
+ --op-z-index-alert-group: 950;
204
+ --op-z-index-tooltip: 1000;
205
+
206
+ /* Inputs */
207
+
208
+ /*
209
+ This should follow multiples of 4
210
+ https: //uxdesign.cc/baseline-grids-design-systems-ae23b5af8cec See example 8
211
+ */
212
+
213
+ /**
214
+ * @tokens Input Heights
215
+ * @presenter Spacing
216
+ */
217
+ --op-input-height-small: 2.8rem; /* 28px */
218
+ --op-input-height-medium: 3.6rem; /* 36px */
219
+ --op-input-height-large: 4rem; /* 40px */
220
+ --op-input-height-x-large: 8.4rem; /* 84px */
221
+
222
+ /**
223
+ * @tokens Input Focus
224
+ * @presenter Shadow
225
+ */
226
+ --op-input-inner-focus: inset 0 0 0 var(--op-border-width-large);
227
+ --op-input-outer-focus: 0 0 0 var(--op-border-width-x-large);
228
+ --op-input-focus-primary:
229
+ var(--op-input-inner-focus) var(--op-color-primary-plus-two),
230
+ var(--op-input-outer-focus) var(--op-color-primary-plus-five);
231
+ --op-input-focus-neutral:
232
+ var(--op-input-inner-focus) var(--op-color-neutral-plus-two),
233
+ var(--op-input-outer-focus) var(--op-color-neutral-plus-five);
234
+ --op-input-focus-danger:
235
+ var(--op-input-inner-focus) var(--op-color-alerts-danger-plus-two),
236
+ var(--op-input-outer-focus) var(--op-color-alerts-danger-plus-five);
237
+ --op-input-focus-warning:
238
+ var(--op-input-inner-focus) var(--op-color-alerts-warning-plus-two),
239
+ var(--op-input-outer-focus) var(--op-color-alerts-warning-plus-five);
240
+ --op-input-focus-info:
241
+ var(--op-input-inner-focus) var(--op-color-alerts-info-plus-two),
242
+ var(--op-input-outer-focus) var(--op-color-alerts-info-plus-five);
243
+ --op-input-focus-notice:
244
+ var(--op-input-inner-focus) var(--op-color-alerts-notice-plus-two),
245
+ var(--op-input-outer-focus) var(--op-color-alerts-notice-plus-five);
246
+ }
247
+
248
+ /* Animations */
249
+ @keyframes rm-slide-in-out-flash {
250
+ /*
251
+ If an duration of 5s is set:
252
+ Start off the Screen
253
+ */
254
+ 0% {
255
+ inset-inline-end: -100%;
256
+ }
257
+
258
+ /* Animate onto the screen for 0.5s */
259
+ 10% {
260
+ inset-inline-end: var(--op-space-large);
261
+ }
262
+
263
+ /* Stay on the screen for 3s */
264
+ 70% {
265
+ inset-inline-end: var(--op-space-large);
266
+ }
267
+
268
+ /* Animate off the screen for 1.5s */
269
+ 100% {
270
+ inset-inline-end: -100%;
271
+ }
272
+ }
@@ -1033,67 +1033,6 @@ Noto Sans supports:
1033
1033
 
1034
1034
  /* Tokens */
1035
1035
  :root {
1036
- /* Color HSLs
1037
- A theme comprised of a primary, neutral, warning, danger, info, and notice colors.
1038
- */
1039
-
1040
- /* Basic Colors */
1041
-
1042
- /**
1043
- * @tokens Basic Colors
1044
- * @presenter Color
1045
- */
1046
- --op-color-white: hsl(0deg 100% 100%);
1047
- --op-color-black: hsl(0deg 0% 0%);
1048
-
1049
- /**
1050
- * @tokens Primary Colors
1051
- * @presenter Color
1052
- */
1053
- --op-color-primary-h: 216;
1054
- --op-color-primary-s: 58%;
1055
- --op-color-primary-l: 48%;
1056
-
1057
- /**
1058
- * @tokens Neutral Colors
1059
- * @presenter Color
1060
- */
1061
- --op-color-neutral-h: var(--op-color-primary-h);
1062
- --op-color-neutral-s: 4%;
1063
- --op-color-neutral-l: var(--op-color-primary-l);
1064
-
1065
- /**
1066
- * @tokens Alerts Warning Colors
1067
- * @presenter Color
1068
- */
1069
- --op-color-alerts-warning-h: 47;
1070
- --op-color-alerts-warning-s: 100%;
1071
- --op-color-alerts-warning-l: 61%;
1072
-
1073
- /**
1074
- * @tokens Alerts Danger Colors
1075
- * @presenter Color
1076
- */
1077
- --op-color-alerts-danger-h: 0;
1078
- --op-color-alerts-danger-s: 99%;
1079
- --op-color-alerts-danger-l: 76%;
1080
-
1081
- /**
1082
- * @tokens Alerts Info Colors
1083
- * @presenter Color
1084
- */
1085
- --op-color-alerts-info-h: 216;
1086
- --op-color-alerts-info-s: 58%;
1087
- --op-color-alerts-info-l: 48%;
1088
-
1089
- /**
1090
- * @tokens Alerts Notice Colors
1091
- * @presenter Color
1092
- */
1093
- --op-color-alerts-notice-h: 130;
1094
- --op-color-alerts-notice-s: 61%;
1095
- --op-color-alerts-notice-l: 64%;
1096
-
1097
1036
  /**
1098
1037
  * @tokens Opacities
1099
1038
  * @presenter Opacity
@@ -1283,18 +1222,6 @@ Noto Sans supports:
1283
1222
  --op-space-3x-large: calc(var(--op-space-scale-unit) * 4); /* 40px */
1284
1223
  --op-space-4x-large: calc(var(--op-space-scale-unit) * 8); /* 80px */
1285
1224
 
1286
- /* Shadows */
1287
-
1288
- /**
1289
- * @tokens Shadows
1290
- * @presenter Shadow
1291
- */
1292
- --op-shadow-x-small: 0 1px 2px hsl(0deg 0% 0% / 3%), 0 1px 3px hsl(0deg 0% 0% / 15%);
1293
- --op-shadow-small: 0 1px 2px hsl(0deg 0% 0% / 3%), 0 2px 6px hsl(0deg 0% 0% / 15%);
1294
- --op-shadow-medium: 0 4px 8px hsl(0deg 0% 0% / 15%), 0 1px 3px hsl(0deg 0% 0% / 3%);
1295
- --op-shadow-large: 0 6px 10px hsl(0deg 0% 0% / 15%), 0 2px 3px hsl(0deg 0% 0% / 3%);
1296
- --op-shadow-x-large: 0 8px 12px hsl(0deg 0% 0% / 15%), 0 4px 4px hsl(0deg 0% 0% / 3%);
1297
-
1298
1225
  /* Z Index */
1299
1226
 
1300
1227
  /**
@@ -1377,6 +1304,80 @@ Noto Sans supports:
1377
1304
  inset-inline-end: -100%;
1378
1305
  }
1379
1306
  }
1307
+ :root {
1308
+ /* Color HSLs
1309
+ A theme comprised of a primary, neutral, warning, danger, info, and notice colors.
1310
+ */
1311
+
1312
+ /* Basic Colors */
1313
+
1314
+ /**
1315
+ * @tokens Basic Colors
1316
+ * @presenter Color
1317
+ */
1318
+ --op-color-white: hsl(0deg 100% 100%);
1319
+ --op-color-black: hsl(0deg 0% 0%);
1320
+
1321
+ /**
1322
+ * @tokens Primary Colors
1323
+ * @presenter Color
1324
+ */
1325
+ --op-color-primary-h: 216;
1326
+ --op-color-primary-s: 58%;
1327
+ --op-color-primary-l: 48%;
1328
+
1329
+ /**
1330
+ * @tokens Neutral Colors
1331
+ * @presenter Color
1332
+ */
1333
+ --op-color-neutral-h: var(--op-color-primary-h);
1334
+ --op-color-neutral-s: 4%;
1335
+ --op-color-neutral-l: var(--op-color-primary-l);
1336
+
1337
+ /**
1338
+ * @tokens Alerts Warning Colors
1339
+ * @presenter Color
1340
+ */
1341
+ --op-color-alerts-warning-h: 47;
1342
+ --op-color-alerts-warning-s: 100%;
1343
+ --op-color-alerts-warning-l: 61%;
1344
+
1345
+ /**
1346
+ * @tokens Alerts Danger Colors
1347
+ * @presenter Color
1348
+ */
1349
+ --op-color-alerts-danger-h: 0;
1350
+ --op-color-alerts-danger-s: 99%;
1351
+ --op-color-alerts-danger-l: 76%;
1352
+
1353
+ /**
1354
+ * @tokens Alerts Info Colors
1355
+ * @presenter Color
1356
+ */
1357
+ --op-color-alerts-info-h: 216;
1358
+ --op-color-alerts-info-s: 58%;
1359
+ --op-color-alerts-info-l: 48%;
1360
+
1361
+ /**
1362
+ * @tokens Alerts Notice Colors
1363
+ * @presenter Color
1364
+ */
1365
+ --op-color-alerts-notice-h: 130;
1366
+ --op-color-alerts-notice-s: 61%;
1367
+ --op-color-alerts-notice-l: 64%;
1368
+
1369
+ /* Shadows */
1370
+
1371
+ /**
1372
+ * @tokens Shadows
1373
+ * @presenter Shadow
1374
+ */
1375
+ --op-shadow-x-small: 0 1px 2px hsl(0deg 0% 0% / 3%), 0 1px 3px hsl(0deg 0% 0% / 15%);
1376
+ --op-shadow-small: 0 1px 2px hsl(0deg 0% 0% / 3%), 0 2px 6px hsl(0deg 0% 0% / 15%);
1377
+ --op-shadow-medium: 0 4px 8px hsl(0deg 0% 0% / 15%), 0 1px 3px hsl(0deg 0% 0% / 3%);
1378
+ --op-shadow-large: 0 6px 10px hsl(0deg 0% 0% / 15%), 0 2px 3px hsl(0deg 0% 0% / 3%);
1379
+ --op-shadow-x-large: 0 8px 12px hsl(0deg 0% 0% / 15%), 0 4px 4px hsl(0deg 0% 0% / 3%);
1380
+ }
1380
1381
  :root {
1381
1382
  /* Enable light and dark mode switching */
1382
1383
  color-scheme: light dark;