@aeris-ui/core 22.0.0-alpha.0 → 22.0.0-alpha.10
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/README.md +14 -3
- package/fesm2022/aeris-ui-core-accordion.mjs +646 -255
- package/fesm2022/aeris-ui-core-accordion.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-animate-on-scroll.mjs +284 -103
- package/fesm2022/aeris-ui-core-animate-on-scroll.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-auto-complete.mjs +1228 -446
- package/fesm2022/aeris-ui-core-auto-complete.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-auto-focus.mjs +111 -61
- package/fesm2022/aeris-ui-core-auto-focus.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-avatar.mjs +383 -101
- package/fesm2022/aeris-ui-core-avatar.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-badge.mjs +562 -115
- package/fesm2022/aeris-ui-core-badge.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-block-ui.mjs +209 -101
- package/fesm2022/aeris-ui-core-block-ui.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-breadcrumb.mjs +581 -189
- package/fesm2022/aeris-ui-core-breadcrumb.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-button-group.mjs +153 -38
- package/fesm2022/aeris-ui-core-button-group.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-button.mjs +741 -139
- package/fesm2022/aeris-ui-core-button.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-card.mjs +371 -101
- package/fesm2022/aeris-ui-core-card.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-carousel.mjs +773 -369
- package/fesm2022/aeris-ui-core-carousel.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-cascade-select.mjs +1171 -521
- package/fesm2022/aeris-ui-core-cascade-select.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-chart.mjs +455 -258
- package/fesm2022/aeris-ui-core-chart.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-checkbox.mjs +440 -140
- package/fesm2022/aeris-ui-core-checkbox.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-chip.mjs +430 -117
- package/fesm2022/aeris-ui-core-chip.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-class-names.mjs +87 -65
- package/fesm2022/aeris-ui-core-class-names.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-code-block.mjs +637 -0
- package/fesm2022/aeris-ui-core-code-block.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-color-picker.mjs +1340 -700
- package/fesm2022/aeris-ui-core-color-picker.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-compare.mjs +823 -318
- package/fesm2022/aeris-ui-core-compare.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-confirm-dialog.mjs +1404 -555
- package/fesm2022/aeris-ui-core-confirm-dialog.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-confirm-popup.mjs +1471 -740
- package/fesm2022/aeris-ui-core-confirm-popup.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-context-menu.mjs +918 -443
- package/fesm2022/aeris-ui-core-context-menu.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-date-picker.mjs +1942 -1123
- package/fesm2022/aeris-ui-core-date-picker.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-dialog.mjs +1079 -346
- package/fesm2022/aeris-ui-core-dialog.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-divider.mjs +204 -43
- package/fesm2022/aeris-ui-core-divider.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-drawer.mjs +1015 -322
- package/fesm2022/aeris-ui-core-drawer.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-dynamic-dialog.mjs +410 -254
- package/fesm2022/aeris-ui-core-dynamic-dialog.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-editor.mjs +967 -587
- package/fesm2022/aeris-ui-core-editor.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-file-upload.mjs +1379 -522
- package/fesm2022/aeris-ui-core-file-upload.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-filter-service.mjs +258 -301
- package/fesm2022/aeris-ui-core-filter-service.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-fluid.mjs +68 -21
- package/fesm2022/aeris-ui-core-fluid.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-focus-trap.mjs +206 -182
- package/fesm2022/aeris-ui-core-focus-trap.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-form-field.mjs +688 -0
- package/fesm2022/aeris-ui-core-form-field.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-galleria.mjs +2446 -1117
- package/fesm2022/aeris-ui-core-galleria.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-glass.mjs +110 -33
- package/fesm2022/aeris-ui-core-glass.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-icon-field.mjs +426 -98
- package/fesm2022/aeris-ui-core-icon-field.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-inplace.mjs +452 -130
- package/fesm2022/aeris-ui-core-inplace.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-input-group.mjs +413 -107
- package/fesm2022/aeris-ui-core-input-group.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-input-mask.mjs +658 -255
- package/fesm2022/aeris-ui-core-input-mask.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-input-number.mjs +926 -291
- package/fesm2022/aeris-ui-core-input-number.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-input-otp.mjs +678 -264
- package/fesm2022/aeris-ui-core-input-otp.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-input-text.mjs +625 -158
- package/fesm2022/aeris-ui-core-input-text.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-key-filter.mjs +263 -201
- package/fesm2022/aeris-ui-core-key-filter.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-mega-menu.mjs +613 -382
- package/fesm2022/aeris-ui-core-mega-menu.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-menu.mjs +1062 -472
- package/fesm2022/aeris-ui-core-menu.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-menubar.mjs +994 -393
- package/fesm2022/aeris-ui-core-menubar.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-message.mjs +477 -145
- package/fesm2022/aeris-ui-core-message.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-meter-group.mjs +623 -230
- package/fesm2022/aeris-ui-core-meter-group.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-multi-select.mjs +1598 -561
- package/fesm2022/aeris-ui-core-multi-select.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-order-list.mjs +592 -220
- package/fesm2022/aeris-ui-core-order-list.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-organization-chart.mjs +485 -199
- package/fesm2022/aeris-ui-core-organization-chart.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-paginator.mjs +428 -123
- package/fesm2022/aeris-ui-core-paginator.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-panel.mjs +596 -196
- package/fesm2022/aeris-ui-core-panel.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-password.mjs +925 -249
- package/fesm2022/aeris-ui-core-password.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-pick-list.mjs +1280 -659
- package/fesm2022/aeris-ui-core-pick-list.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-popover.mjs +912 -375
- package/fesm2022/aeris-ui-core-popover.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-progress-bar.mjs +549 -176
- package/fesm2022/aeris-ui-core-progress-bar.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-progress-spinner.mjs +410 -133
- package/fesm2022/aeris-ui-core-progress-spinner.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-radio-button.mjs +394 -124
- package/fesm2022/aeris-ui-core-radio-button.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-rating.mjs +506 -231
- package/fesm2022/aeris-ui-core-rating.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-scroll-panel.mjs +457 -154
- package/fesm2022/aeris-ui-core-scroll-panel.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-scroll-top.mjs +226 -63
- package/fesm2022/aeris-ui-core-scroll-top.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-select.mjs +1845 -648
- package/fesm2022/aeris-ui-core-select.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-skeleton.mjs +149 -45
- package/fesm2022/aeris-ui-core-skeleton.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-slider.mjs +884 -430
- package/fesm2022/aeris-ui-core-slider.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-speed-dial.mjs +861 -337
- package/fesm2022/aeris-ui-core-speed-dial.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-split-button.mjs +955 -266
- package/fesm2022/aeris-ui-core-split-button.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-splitter.mjs +812 -352
- package/fesm2022/aeris-ui-core-splitter.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-stepper.mjs +697 -254
- package/fesm2022/aeris-ui-core-stepper.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-style-class.mjs +587 -342
- package/fesm2022/aeris-ui-core-style-class.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-table.mjs +2034 -869
- package/fesm2022/aeris-ui-core-table.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-tabs.mjs +789 -279
- package/fesm2022/aeris-ui-core-tabs.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-textarea.mjs +856 -219
- package/fesm2022/aeris-ui-core-textarea.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-theme-builder.mjs +1284 -1399
- package/fesm2022/aeris-ui-core-theme-builder.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-theming.mjs +132 -144
- package/fesm2022/aeris-ui-core-theming.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-tiered-menu.mjs +909 -441
- package/fesm2022/aeris-ui-core-tiered-menu.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-timeline.mjs +407 -131
- package/fesm2022/aeris-ui-core-timeline.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-toast.mjs +1076 -384
- package/fesm2022/aeris-ui-core-toast.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-toggle-switch.mjs +398 -132
- package/fesm2022/aeris-ui-core-toggle-switch.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-toolbar.mjs +458 -121
- package/fesm2022/aeris-ui-core-toolbar.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-tooltip.mjs +625 -330
- package/fesm2022/aeris-ui-core-tooltip.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-tree-select.mjs +1453 -621
- package/fesm2022/aeris-ui-core-tree-select.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-tree-table.mjs +2019 -940
- package/fesm2022/aeris-ui-core-tree-table.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-tree.mjs +1107 -658
- package/fesm2022/aeris-ui-core-tree.mjs.map +1 -1
- package/fesm2022/aeris-ui-core.mjs +985 -316
- package/fesm2022/aeris-ui-core.mjs.map +1 -1
- package/package.json +20 -8
- package/schematics/ng-add/schema.json +1 -1
- package/schematics/runtime/schematics/ng-add/options.js +4 -4
- package/schematics/runtime/schematics/ng-add/options.js.map +1 -1
- package/schematics/runtime/schematics/ng-add/workspace.js +1 -1
- package/schematics/runtime/schematics/ng-add/workspace.js.map +1 -1
- package/schematics/runtime/theme-builder/aeris-contrast.js +6 -17
- package/schematics/runtime/theme-builder/aeris-contrast.js.map +1 -1
- package/schematics/runtime/theme-builder/aeris-foundation.js +10 -4
- package/schematics/runtime/theme-builder/aeris-foundation.js.map +1 -1
- package/schematics/runtime/theme-builder/aeris-semantic-tones.js +28 -5
- package/schematics/runtime/theme-builder/aeris-semantic-tones.js.map +1 -1
- package/schematics/runtime/theme-builder/aeris-theme-generator.js +2 -2
- package/schematics/runtime/theme-builder/aeris-theme-generator.js.map +1 -1
- package/schematics/runtime/theme-builder/aeris-theme-resolver.js +22 -8
- package/schematics/runtime/theme-builder/aeris-theme-resolver.js.map +1 -1
- package/schematics/runtime/theme-builder/aeris-theme-tokens.js +12 -4
- package/schematics/runtime/theme-builder/aeris-theme-tokens.js.map +1 -1
- package/schematics/runtime/theme-builder/aeris-theme-validation.js +7 -1
- package/schematics/runtime/theme-builder/aeris-theme-validation.js.map +1 -1
- package/schematics/runtime/theme-builder/aeris-theme.js +49 -33
- package/schematics/runtime/theme-builder/aeris-theme.js.map +1 -1
- package/styles/_fallback-colors.scss +10 -0
- package/styles/_mobile.scss +16 -0
- package/styles/_tokens.scss +5 -5
- package/styles/aeris.css +412 -125
- package/styles/controls.css +61 -29
- package/tools/aeris-theme.mjs +2 -2
- package/tools/aeris-theme.schema.json +5 -2
- package/types/aeris-ui-core-accordion.d.ts +167 -93
- package/types/aeris-ui-core-animate-on-scroll.d.ts +72 -31
- package/types/aeris-ui-core-auto-complete.d.ts +327 -140
- package/types/aeris-ui-core-auto-focus.d.ts +24 -16
- package/types/aeris-ui-core-avatar.d.ts +112 -42
- package/types/aeris-ui-core-badge.d.ts +160 -46
- package/types/aeris-ui-core-block-ui.d.ts +47 -27
- package/types/aeris-ui-core-breadcrumb.d.ts +163 -92
- package/types/aeris-ui-core-button-group.d.ts +37 -16
- package/types/aeris-ui-core-button.d.ts +226 -67
- package/types/aeris-ui-core-card.d.ts +74 -37
- package/types/aeris-ui-core-carousel.d.ts +201 -117
- package/types/aeris-ui-core-cascade-select.d.ts +257 -123
- package/types/aeris-ui-core-chart.d.ts +134 -84
- package/types/aeris-ui-core-checkbox.d.ts +139 -54
- package/types/aeris-ui-core-chip.d.ts +116 -51
- package/types/aeris-ui-core-class-names.d.ts +22 -20
- package/types/aeris-ui-core-code-block.d.ts +188 -0
- package/types/aeris-ui-core-color-picker.d.ts +348 -143
- package/types/aeris-ui-core-compare.d.ts +224 -102
- package/types/aeris-ui-core-confirm-dialog.d.ts +442 -245
- package/types/aeris-ui-core-confirm-popup.d.ts +442 -263
- package/types/aeris-ui-core-context-menu.d.ts +264 -146
- package/types/aeris-ui-core-date-picker.d.ts +489 -217
- package/types/aeris-ui-core-dialog.d.ts +288 -117
- package/types/aeris-ui-core-divider.d.ts +58 -20
- package/types/aeris-ui-core-drawer.d.ts +273 -112
- package/types/aeris-ui-core-dynamic-dialog.d.ts +158 -137
- package/types/aeris-ui-core-editor.d.ts +250 -123
- package/types/aeris-ui-core-file-upload.d.ts +367 -197
- package/types/aeris-ui-core-filter-service.d.ts +48 -52
- package/types/aeris-ui-core-fluid.d.ts +12 -9
- package/types/aeris-ui-core-focus-trap.d.ts +39 -31
- package/types/aeris-ui-core-form-field.d.ts +163 -0
- package/types/aeris-ui-core-galleria.d.ts +588 -256
- package/types/aeris-ui-core-glass.d.ts +24 -11
- package/types/aeris-ui-core-icon-field.d.ts +94 -32
- package/types/aeris-ui-core-inplace.d.ts +123 -62
- package/types/aeris-ui-core-input-group.d.ts +84 -33
- package/types/aeris-ui-core-input-mask.d.ts +194 -69
- package/types/aeris-ui-core-input-number.d.ts +272 -87
- package/types/aeris-ui-core-input-otp.d.ts +191 -81
- package/types/aeris-ui-core-input-text.d.ts +185 -60
- package/types/aeris-ui-core-key-filter.d.ts +53 -39
- package/types/aeris-ui-core-mega-menu.d.ts +175 -121
- package/types/aeris-ui-core-menu.d.ts +277 -168
- package/types/aeris-ui-core-menubar.d.ts +273 -135
- package/types/aeris-ui-core-message.d.ts +132 -60
- package/types/aeris-ui-core-meter-group.d.ts +163 -90
- package/types/aeris-ui-core-multi-select.d.ts +439 -180
- package/types/aeris-ui-core-order-list.d.ts +144 -66
- package/types/aeris-ui-core-organization-chart.d.ts +133 -77
- package/types/aeris-ui-core-paginator.d.ts +93 -38
- package/types/aeris-ui-core-panel.d.ts +149 -78
- package/types/aeris-ui-core-password.d.ts +258 -102
- package/types/aeris-ui-core-pick-list.d.ts +374 -179
- package/types/aeris-ui-core-popover.d.ts +219 -105
- package/types/aeris-ui-core-progress-bar.d.ts +157 -73
- package/types/aeris-ui-core-progress-spinner.d.ts +110 -48
- package/types/aeris-ui-core-radio-button.d.ts +124 -50
- package/types/aeris-ui-core-rating.d.ts +149 -76
- package/types/aeris-ui-core-scroll-panel.d.ts +142 -64
- package/types/aeris-ui-core-scroll-top.d.ts +66 -29
- package/types/aeris-ui-core-select.d.ts +475 -217
- package/types/aeris-ui-core-skeleton.d.ts +39 -17
- package/types/aeris-ui-core-slider.d.ts +270 -115
- package/types/aeris-ui-core-speed-dial.d.ts +241 -111
- package/types/aeris-ui-core-split-button.d.ts +267 -113
- package/types/aeris-ui-core-splitter.d.ts +225 -106
- package/types/aeris-ui-core-stepper.d.ts +184 -91
- package/types/aeris-ui-core-style-class.d.ts +141 -71
- package/types/aeris-ui-core-table.d.ts +596 -304
- package/types/aeris-ui-core-tabs.d.ts +181 -76
- package/types/aeris-ui-core-textarea.d.ts +261 -78
- package/types/aeris-ui-core-theme-builder.d.ts +472 -450
- package/types/aeris-ui-core-theming.d.ts +42 -45
- package/types/aeris-ui-core-tiered-menu.d.ts +251 -142
- package/types/aeris-ui-core-timeline.d.ts +109 -71
- package/types/aeris-ui-core-toast.d.ts +225 -115
- package/types/aeris-ui-core-toggle-switch.d.ts +125 -51
- package/types/aeris-ui-core-toolbar.d.ts +98 -41
- package/types/aeris-ui-core-tooltip.d.ts +157 -88
- package/types/aeris-ui-core-tree-select.d.ts +364 -171
- package/types/aeris-ui-core-tree-table.d.ts +566 -286
- package/types/aeris-ui-core-tree.d.ts +270 -165
- package/types/aeris-ui-core.d.ts +197 -72
|
@@ -1,1565 +1,1450 @@
|
|
|
1
1
|
const AERIS_MONOCHROME_LIGHT_PRIMARY_TONE = {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
2
|
+
base: "#111111",
|
|
3
|
+
boundary: "#111111",
|
|
4
|
+
hover: "#242424",
|
|
5
|
+
active: "#050505",
|
|
6
|
+
onBase: "#ffffff",
|
|
7
|
+
onHover: "#ffffff",
|
|
8
|
+
onActive: "#ffffff",
|
|
9
|
+
text: "#111111",
|
|
10
|
+
soft: "#f1f1f1",
|
|
11
|
+
onSoft: "#111111"
|
|
12
12
|
};
|
|
13
13
|
const AERIS_MONOCHROME_DARK_PRIMARY_TONE = {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
14
|
+
base: "#f5f5f5",
|
|
15
|
+
boundary: "#f5f5f5",
|
|
16
|
+
hover: "#ffffff",
|
|
17
|
+
active: "#e7e7e7",
|
|
18
|
+
onBase: "#090909",
|
|
19
|
+
onHover: "#090909",
|
|
20
|
+
onActive: "#090909",
|
|
21
|
+
text: "#f5f5f5",
|
|
22
|
+
soft: "#1b1b1b",
|
|
23
|
+
onSoft: "#ffffff"
|
|
24
24
|
};
|
|
25
25
|
const AERIS_MONOCHROME_LIGHT_SECONDARY_TONE = {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
26
|
+
base: "#565656",
|
|
27
|
+
boundary: "#565656",
|
|
28
|
+
hover: "#464646",
|
|
29
|
+
active: "#363636",
|
|
30
|
+
onBase: "#ffffff",
|
|
31
|
+
onHover: "#ffffff",
|
|
32
|
+
onActive: "#ffffff",
|
|
33
|
+
text: "#454545",
|
|
34
|
+
soft: "#ededed",
|
|
35
|
+
onSoft: "#242424"
|
|
36
36
|
};
|
|
37
37
|
const AERIS_MONOCHROME_DARK_SECONDARY_TONE = {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
38
|
+
base: "#b8b8b8",
|
|
39
|
+
boundary: "#b8b8b8",
|
|
40
|
+
hover: "#c8c8c8",
|
|
41
|
+
active: "#a8a8a8",
|
|
42
|
+
onBase: "#090909",
|
|
43
|
+
onHover: "#090909",
|
|
44
|
+
onActive: "#090909",
|
|
45
|
+
text: "#d0d0d0",
|
|
46
|
+
soft: "#262626",
|
|
47
|
+
onSoft: "#f5f5f5"
|
|
48
48
|
};
|
|
49
49
|
const AERIS_MONOCHROME_LIGHT_CONTRAST_TONE = {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
50
|
+
base: "#ffffff",
|
|
51
|
+
boundary: "#111111",
|
|
52
|
+
hover: "#f1f1f1",
|
|
53
|
+
active: "#e3e3e3",
|
|
54
|
+
onBase: "#111111",
|
|
55
|
+
onHover: "#111111",
|
|
56
|
+
onActive: "#111111",
|
|
57
|
+
text: "#111111",
|
|
58
|
+
soft: "#f1f1f1",
|
|
59
|
+
onSoft: "#111111"
|
|
60
60
|
};
|
|
61
61
|
const AERIS_MONOCHROME_DARK_CONTRAST_TONE = {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
62
|
+
base: "#090909",
|
|
63
|
+
boundary: "#f5f5f5",
|
|
64
|
+
hover: "#181818",
|
|
65
|
+
active: "#242424",
|
|
66
|
+
onBase: "#ffffff",
|
|
67
|
+
onHover: "#ffffff",
|
|
68
|
+
onActive: "#ffffff",
|
|
69
|
+
text: "#f5f5f5",
|
|
70
|
+
soft: "#1b1b1b",
|
|
71
|
+
onSoft: "#ffffff"
|
|
72
72
|
};
|
|
73
73
|
const AERIS_MONOCHROME_LIGHT_STATUS_TONES = {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
74
|
+
success: {
|
|
75
|
+
base: "#2f6b46",
|
|
76
|
+
hover: "#285c3c",
|
|
77
|
+
active: "#214f34",
|
|
78
|
+
onBase: "#ffffff",
|
|
79
|
+
onHover: "#ffffff",
|
|
80
|
+
onActive: "#ffffff",
|
|
81
|
+
text: "#24573a",
|
|
82
|
+
soft: "#edf5ef",
|
|
83
|
+
onSoft: "#214f34"
|
|
84
|
+
},
|
|
85
|
+
info: {
|
|
86
|
+
base: "#2f6178",
|
|
87
|
+
hover: "#285368",
|
|
88
|
+
active: "#214758",
|
|
89
|
+
onBase: "#ffffff",
|
|
90
|
+
onHover: "#ffffff",
|
|
91
|
+
onActive: "#ffffff",
|
|
92
|
+
text: "#264f62",
|
|
93
|
+
soft: "#edf4f7",
|
|
94
|
+
onSoft: "#214758"
|
|
95
|
+
},
|
|
96
|
+
warning: {
|
|
97
|
+
base: "#c38600",
|
|
98
|
+
hover: "#bd8200",
|
|
99
|
+
active: "#b87d00",
|
|
100
|
+
onBase: "#211600",
|
|
101
|
+
onHover: "#211600",
|
|
102
|
+
onActive: "#211600",
|
|
103
|
+
text: "#8a6100",
|
|
104
|
+
soft: "#fff5d6",
|
|
105
|
+
onSoft: "#704e00"
|
|
106
|
+
},
|
|
107
|
+
danger: {
|
|
108
|
+
base: "#c81e2a",
|
|
109
|
+
hover: "#b51b26",
|
|
110
|
+
active: "#a21822",
|
|
111
|
+
onBase: "#ffffff",
|
|
112
|
+
onHover: "#ffffff",
|
|
113
|
+
onActive: "#ffffff",
|
|
114
|
+
text: "#a31722",
|
|
115
|
+
soft: "#fff0f1",
|
|
116
|
+
onSoft: "#81131a"
|
|
117
|
+
}
|
|
118
118
|
};
|
|
119
119
|
const AERIS_MONOCHROME_DARK_STATUS_TONES = {
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
120
|
+
success: {
|
|
121
|
+
base: "#9fd3ae",
|
|
122
|
+
hover: "#b5dfc0",
|
|
123
|
+
active: "#8bc69c",
|
|
124
|
+
onBase: "#0b1a10",
|
|
125
|
+
onHover: "#0b1a10",
|
|
126
|
+
onActive: "#0b1a10",
|
|
127
|
+
text: "#9fd3ae",
|
|
128
|
+
soft: "#17271d",
|
|
129
|
+
onSoft: "#b5dfc0"
|
|
130
|
+
},
|
|
131
|
+
info: {
|
|
132
|
+
base: "#9ecbe0",
|
|
133
|
+
hover: "#b4d8e8",
|
|
134
|
+
active: "#88bdd6",
|
|
135
|
+
onBase: "#091923",
|
|
136
|
+
onHover: "#091923",
|
|
137
|
+
onActive: "#091923",
|
|
138
|
+
text: "#9ecbe0",
|
|
139
|
+
soft: "#17242a",
|
|
140
|
+
onSoft: "#b4d8e8"
|
|
141
|
+
},
|
|
142
|
+
warning: {
|
|
143
|
+
base: "#facc15",
|
|
144
|
+
hover: "#ffdb4d",
|
|
145
|
+
active: "#e7b900",
|
|
146
|
+
onBase: "#211600",
|
|
147
|
+
onHover: "#211600",
|
|
148
|
+
onActive: "#211600",
|
|
149
|
+
text: "#facc15",
|
|
150
|
+
soft: "#2c2508",
|
|
151
|
+
onSoft: "#ffdb4d"
|
|
152
|
+
},
|
|
153
|
+
danger: {
|
|
154
|
+
base: "#ff5c68",
|
|
155
|
+
hover: "#ff7b84",
|
|
156
|
+
active: "#e84955",
|
|
157
|
+
onBase: "#260609",
|
|
158
|
+
onHover: "#260609",
|
|
159
|
+
onActive: "#260609",
|
|
160
|
+
text: "#ff5c68",
|
|
161
|
+
soft: "#301416",
|
|
162
|
+
onSoft: "#ff8f97"
|
|
163
|
+
}
|
|
164
|
+
};
|
|
165
|
+
const AERIS_COLORED_DARK_SCHEME = {
|
|
166
|
+
page: "#0c0c0c",
|
|
167
|
+
surface: "#121212",
|
|
168
|
+
surface2: "#191919",
|
|
169
|
+
surface3: "#232323",
|
|
170
|
+
interactiveHover: "#292929",
|
|
171
|
+
border: "#292929",
|
|
172
|
+
borderStrong: "#757575"
|
|
164
173
|
};
|
|
165
|
-
/** Accessible Aeris starter themes that can be passed directly to provideAeris(). */
|
|
166
174
|
const AERIS_THEME_PRESETS = {
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
175
|
+
earth: {
|
|
176
|
+
palette: {
|
|
177
|
+
surface: "#f1f4f2",
|
|
178
|
+
primary: "#2c694b",
|
|
179
|
+
secondary: "#52685b",
|
|
180
|
+
accent: "#a88245",
|
|
181
|
+
contrast: "#343b37"
|
|
182
|
+
},
|
|
183
|
+
dark: AERIS_COLORED_DARK_SCHEME
|
|
184
|
+
},
|
|
185
|
+
coastal: {
|
|
186
|
+
palette: {
|
|
187
|
+
surface: "#f1f4f8",
|
|
188
|
+
primary: "#2d63a8",
|
|
189
|
+
secondary: "#546b89",
|
|
190
|
+
accent: "#368678",
|
|
191
|
+
contrast: "#39404a"
|
|
192
|
+
},
|
|
193
|
+
dark: AERIS_COLORED_DARK_SCHEME
|
|
194
|
+
},
|
|
195
|
+
orchid: {
|
|
196
|
+
palette: {
|
|
197
|
+
surface: "#f5f2f8",
|
|
198
|
+
primary: "#7551a8",
|
|
199
|
+
secondary: "#6f607f",
|
|
200
|
+
accent: "#a46b82",
|
|
201
|
+
contrast: "#453b4e"
|
|
202
|
+
},
|
|
203
|
+
dark: AERIS_COLORED_DARK_SCHEME
|
|
204
|
+
},
|
|
205
|
+
monochrome: {
|
|
206
|
+
palette: {
|
|
207
|
+
surface: "#f4f4f4",
|
|
208
|
+
primary: "#111111",
|
|
209
|
+
secondary: "#1f1f1f",
|
|
210
|
+
accent: "#f8f8f8",
|
|
211
|
+
contrast: "#050505"
|
|
212
|
+
},
|
|
213
|
+
light: {
|
|
214
|
+
accent: "#111111",
|
|
215
|
+
page: "#f7f7f7",
|
|
216
|
+
surface: "#ffffff",
|
|
217
|
+
surface2: "#f3f3f3",
|
|
218
|
+
surface3: "#e8e8e8",
|
|
219
|
+
interactiveHover: "#e8e8e8",
|
|
220
|
+
text: "#111111",
|
|
221
|
+
text2: "#242424",
|
|
222
|
+
text3: "#454545",
|
|
223
|
+
border: "#efefef",
|
|
224
|
+
borderStrong: "#111111",
|
|
225
|
+
focus: "#111111",
|
|
226
|
+
shadowXs: "0 1px 2px rgb(0 0 0 / 10%)",
|
|
227
|
+
shadowSm: "0 2px 5px rgb(0 0 0 / 14%)",
|
|
228
|
+
shadowMd: "0 8px 24px rgb(0 0 0 / 14%)",
|
|
229
|
+
shadowLg: "0 18px 48px rgb(0 0 0 / 18%)",
|
|
230
|
+
tones: {
|
|
231
|
+
primary: AERIS_MONOCHROME_LIGHT_PRIMARY_TONE,
|
|
232
|
+
secondary: AERIS_MONOCHROME_LIGHT_SECONDARY_TONE,
|
|
233
|
+
...AERIS_MONOCHROME_LIGHT_STATUS_TONES,
|
|
234
|
+
contrast: AERIS_MONOCHROME_LIGHT_CONTRAST_TONE
|
|
235
|
+
}
|
|
236
|
+
},
|
|
237
|
+
dark: {
|
|
238
|
+
accent: "#f5f5f5",
|
|
239
|
+
page: "#070707",
|
|
240
|
+
surface: "#0c0c0c",
|
|
241
|
+
surface2: "#151515",
|
|
242
|
+
surface3: "#202020",
|
|
243
|
+
interactiveHover: "#292929",
|
|
244
|
+
text: "#f8f8f8",
|
|
245
|
+
text2: "#ededed",
|
|
246
|
+
text3: "#d0d0d0",
|
|
247
|
+
border: "#242424",
|
|
248
|
+
borderStrong: "#ffffff",
|
|
249
|
+
focus: "#ffffff",
|
|
250
|
+
shadowXs: "0 1px 2px rgb(0 0 0 / 48%)",
|
|
251
|
+
shadowSm: "0 2px 6px rgb(0 0 0 / 62%)",
|
|
252
|
+
shadowMd: "0 10px 28px rgb(0 0 0 / 58%)",
|
|
253
|
+
shadowLg: "0 20px 56px rgb(0 0 0 / 68%)",
|
|
254
|
+
tones: {
|
|
255
|
+
primary: AERIS_MONOCHROME_DARK_PRIMARY_TONE,
|
|
256
|
+
secondary: AERIS_MONOCHROME_DARK_SECONDARY_TONE,
|
|
257
|
+
...AERIS_MONOCHROME_DARK_STATUS_TONES,
|
|
258
|
+
contrast: AERIS_MONOCHROME_DARK_CONTRAST_TONE
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
}
|
|
247
262
|
};
|
|
248
263
|
const AERIS_DENSITY_PRESETS = {
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
264
|
+
compact: {
|
|
265
|
+
controlHeight: "2.125rem",
|
|
266
|
+
controlPaddingX: "0.625rem",
|
|
267
|
+
itemHeight: "2rem",
|
|
268
|
+
itemPaddingY: "0.375rem",
|
|
269
|
+
itemPaddingX: "0.625rem",
|
|
270
|
+
gap: "0.375rem",
|
|
271
|
+
iconSize: "0.9375rem"
|
|
272
|
+
},
|
|
273
|
+
medium: {
|
|
274
|
+
controlHeight: "2.625rem",
|
|
275
|
+
controlPaddingX: "0.75rem",
|
|
276
|
+
itemHeight: "2.5rem",
|
|
277
|
+
itemPaddingY: "0.5rem",
|
|
278
|
+
itemPaddingX: "0.75rem",
|
|
279
|
+
gap: "0.5rem",
|
|
280
|
+
iconSize: "1rem"
|
|
281
|
+
},
|
|
282
|
+
comfortable: {
|
|
283
|
+
controlHeight: "3.125rem",
|
|
284
|
+
controlPaddingX: "0.875rem",
|
|
285
|
+
itemHeight: "2.875rem",
|
|
286
|
+
itemPaddingY: "0.625rem",
|
|
287
|
+
itemPaddingX: "0.875rem",
|
|
288
|
+
gap: "0.625rem",
|
|
289
|
+
iconSize: "1.0625rem"
|
|
290
|
+
}
|
|
276
291
|
};
|
|
277
292
|
const AERIS_RADIUS_PRESETS = {
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
293
|
+
soft: {
|
|
294
|
+
sm: "0.25rem",
|
|
295
|
+
md: "0.375rem",
|
|
296
|
+
lg: "0.5rem",
|
|
297
|
+
xl: "0.75rem",
|
|
298
|
+
control: "0.25rem",
|
|
299
|
+
pill: "999px"
|
|
300
|
+
},
|
|
301
|
+
rounded: {
|
|
302
|
+
sm: "0.4375rem",
|
|
303
|
+
md: "0.5625rem",
|
|
304
|
+
lg: "0.75rem",
|
|
305
|
+
xl: "1rem",
|
|
306
|
+
control: "0.4375rem",
|
|
307
|
+
pill: "999px"
|
|
308
|
+
},
|
|
309
|
+
pill: {
|
|
310
|
+
sm: "0.75rem",
|
|
311
|
+
md: "1rem",
|
|
312
|
+
lg: "1.25rem",
|
|
313
|
+
xl: "1.5rem",
|
|
314
|
+
control: "999px",
|
|
315
|
+
pill: "999px"
|
|
316
|
+
}
|
|
302
317
|
};
|
|
303
318
|
const AERIS_DEFAULT_THEME = {
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
319
|
+
palette: {
|
|
320
|
+
...AERIS_THEME_PRESETS.monochrome.palette,
|
|
321
|
+
mist: AERIS_THEME_PRESETS.monochrome.palette.surface,
|
|
322
|
+
sage: AERIS_THEME_PRESETS.monochrome.palette.primary,
|
|
323
|
+
cloud: AERIS_THEME_PRESETS.monochrome.palette.secondary,
|
|
324
|
+
sand: AERIS_THEME_PRESETS.monochrome.palette.accent,
|
|
325
|
+
umber: AERIS_THEME_PRESETS.monochrome.palette.contrast
|
|
326
|
+
},
|
|
327
|
+
light: { ...AERIS_THEME_PRESETS.monochrome.light },
|
|
328
|
+
dark: { ...AERIS_THEME_PRESETS.monochrome.dark },
|
|
329
|
+
radius: "rounded",
|
|
330
|
+
radii: AERIS_RADIUS_PRESETS,
|
|
331
|
+
density: "medium",
|
|
332
|
+
densities: AERIS_DENSITY_PRESETS
|
|
318
333
|
};
|
|
319
|
-
|
|
320
|
-
const ACHROMATIC_CHROMA = 0.01;
|
|
334
|
+
const ACHROMATIC_CHROMA = .01;
|
|
321
335
|
const GAMUT_SEARCH_STEPS = 24;
|
|
322
|
-
const SRGB_GAMUT_TOLERANCE = 0.000_000_1;
|
|
323
336
|
function parseAerisColor(value) {
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
337
|
+
const color = value.trim().toLowerCase();
|
|
338
|
+
if (color === "black") return {
|
|
339
|
+
red: 0,
|
|
340
|
+
green: 0,
|
|
341
|
+
blue: 0
|
|
342
|
+
};
|
|
343
|
+
if (color === "white") return {
|
|
344
|
+
red: 255,
|
|
345
|
+
green: 255,
|
|
346
|
+
blue: 255
|
|
347
|
+
};
|
|
348
|
+
if (color.startsWith("#")) return parseHex(color);
|
|
349
|
+
if (color.startsWith("rgb(") || color.startsWith("rgba(")) return parseRgb(color);
|
|
350
|
+
if (color.startsWith("hsl(") || color.startsWith("hsla(")) return parseHsl(color);
|
|
351
|
+
return null;
|
|
336
352
|
}
|
|
337
353
|
function mixAerisColor(from, to, amount) {
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
return `color-mix(in oklch, ${from} ${startWeight}%, ${to})`;
|
|
344
|
-
}
|
|
345
|
-
return formatAerisHex(mixAerisRgb(start, end, weight));
|
|
354
|
+
const weight = clampUnit(amount);
|
|
355
|
+
const start = parseAerisColor(from);
|
|
356
|
+
const end = parseAerisColor(to);
|
|
357
|
+
if (!start || !end) return `color-mix(in oklch, ${from} ${formatPercentage((1 - weight) * 100)}%, ${to})`;
|
|
358
|
+
return formatAerisHex(mixAerisRgb(start, end, weight));
|
|
346
359
|
}
|
|
347
360
|
function aerisContrastRatio(first, second) {
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
return aerisRgbContrastRatio(firstColor, secondColor);
|
|
361
|
+
const firstColor = parseAerisColor(first);
|
|
362
|
+
const secondColor = parseAerisColor(second);
|
|
363
|
+
if (!firstColor || !secondColor) return null;
|
|
364
|
+
return aerisRgbContrastRatio(firstColor, secondColor);
|
|
353
365
|
}
|
|
354
366
|
function aerisRgbContrastRatio(first, second) {
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
367
|
+
const firstLuminance = relativeLuminance(first);
|
|
368
|
+
const secondLuminance = relativeLuminance(second);
|
|
369
|
+
const lighter = Math.max(firstLuminance, secondLuminance);
|
|
370
|
+
const darker = Math.min(firstLuminance, secondLuminance);
|
|
371
|
+
return (lighter + .05) / (darker + .05);
|
|
360
372
|
}
|
|
361
373
|
function mixAerisRgb(from, to, amount) {
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
hue: interpolateHue(start.hue, end.hue, weight),
|
|
373
|
-
};
|
|
374
|
-
return oklchToGamutMappedRgb(mixed);
|
|
374
|
+
const weight = clampUnit(amount);
|
|
375
|
+
if (weight === 0) return { ...from };
|
|
376
|
+
if (weight === 1) return { ...to };
|
|
377
|
+
const start = oklabToOklch(rgbToOklab(from));
|
|
378
|
+
const end = oklabToOklch(rgbToOklab(to));
|
|
379
|
+
return oklchToGamutMappedRgb({
|
|
380
|
+
lightness: interpolate(start.lightness, end.lightness, weight),
|
|
381
|
+
chroma: interpolate(start.chroma, end.chroma, weight),
|
|
382
|
+
hue: interpolateHue(start.hue, end.hue, weight)
|
|
383
|
+
});
|
|
375
384
|
}
|
|
376
385
|
function formatAerisHex(color) {
|
|
377
|
-
|
|
378
|
-
|
|
386
|
+
const channel = (value) => Math.round(clampChannel(value)).toString(16).padStart(2, "0");
|
|
387
|
+
return `#${channel(color.red)}${channel(color.green)}${channel(color.blue)}`;
|
|
379
388
|
}
|
|
380
389
|
function relativeLuminance(color) {
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
390
|
+
const linear = (value) => {
|
|
391
|
+
const channel = value / 255;
|
|
392
|
+
return channel <= .04045 ? channel / 12.92 : ((channel + .055) / 1.055) ** 2.4;
|
|
393
|
+
};
|
|
394
|
+
return .2126 * linear(color.red) + .7152 * linear(color.green) + .0722 * linear(color.blue);
|
|
386
395
|
}
|
|
387
396
|
function rgbToOklab(color) {
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
397
|
+
const red = srgbToLinear(clampChannel(color.red) / 255);
|
|
398
|
+
const green = srgbToLinear(clampChannel(color.green) / 255);
|
|
399
|
+
const blue = srgbToLinear(clampChannel(color.blue) / 255);
|
|
400
|
+
const l = .4122214708 * red + .5363325363 * green + .0514459929 * blue;
|
|
401
|
+
const m = .2119034982 * red + .6806995451 * green + .1073969566 * blue;
|
|
402
|
+
const s = .0883024619 * red + .2817188376 * green + .6299787005 * blue;
|
|
403
|
+
const lRoot = Math.cbrt(l);
|
|
404
|
+
const mRoot = Math.cbrt(m);
|
|
405
|
+
const sRoot = Math.cbrt(s);
|
|
406
|
+
return {
|
|
407
|
+
lightness: .2104542553 * lRoot + .793617785 * mRoot - .0040720468 * sRoot,
|
|
408
|
+
a: 1.9779984951 * lRoot - 2.428592205 * mRoot + .4505937099 * sRoot,
|
|
409
|
+
b: .0259040371 * lRoot + .7827717662 * mRoot - .808675766 * sRoot
|
|
410
|
+
};
|
|
402
411
|
}
|
|
403
412
|
function oklabToOklch(color) {
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
413
|
+
const chroma = Math.hypot(color.a, color.b);
|
|
414
|
+
const achromatic = chroma < ACHROMATIC_CHROMA;
|
|
415
|
+
return {
|
|
416
|
+
lightness: color.lightness,
|
|
417
|
+
chroma: achromatic ? 0 : chroma,
|
|
418
|
+
hue: achromatic ? null : normalizeHue(Math.atan2(color.b, color.a) * 180 / Math.PI)
|
|
419
|
+
};
|
|
411
420
|
}
|
|
412
421
|
function oklchToGamutMappedRgb(color) {
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
422
|
+
const direct = oklchToSrgb(color);
|
|
423
|
+
if (isInSrgbGamut(direct)) return toRgbChannels(direct);
|
|
424
|
+
let minimumChroma = 0;
|
|
425
|
+
let maximumChroma = color.chroma;
|
|
426
|
+
let mapped = oklchToSrgb({
|
|
427
|
+
...color,
|
|
428
|
+
chroma: minimumChroma
|
|
429
|
+
});
|
|
430
|
+
for (let step = 0; step < GAMUT_SEARCH_STEPS; step += 1) {
|
|
431
|
+
const chroma = (minimumChroma + maximumChroma) / 2;
|
|
432
|
+
const candidate = oklchToSrgb({
|
|
433
|
+
...color,
|
|
434
|
+
chroma
|
|
435
|
+
});
|
|
436
|
+
if (isInSrgbGamut(candidate)) {
|
|
437
|
+
minimumChroma = chroma;
|
|
438
|
+
mapped = candidate;
|
|
439
|
+
} else maximumChroma = chroma;
|
|
440
|
+
}
|
|
441
|
+
return toRgbChannels(mapped);
|
|
431
442
|
}
|
|
432
443
|
function oklchToSrgb(color) {
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
444
|
+
const hueRadians = (color.hue ?? 0) * Math.PI / 180;
|
|
445
|
+
const a = color.chroma * Math.cos(hueRadians);
|
|
446
|
+
const b = color.chroma * Math.sin(hueRadians);
|
|
447
|
+
const lRoot = color.lightness + .3963377774 * a + .2158037573 * b;
|
|
448
|
+
const mRoot = color.lightness - .1055613458 * a - .0638541728 * b;
|
|
449
|
+
const sRoot = color.lightness - .0894841775 * a - 1.291485548 * b;
|
|
450
|
+
const l = lRoot ** 3;
|
|
451
|
+
const m = mRoot ** 3;
|
|
452
|
+
const s = sRoot ** 3;
|
|
453
|
+
return [
|
|
454
|
+
linearToSrgb(4.0767416621 * l - 3.3077115913 * m + .2309699292 * s),
|
|
455
|
+
linearToSrgb(-1.2684380046 * l + 2.6097574011 * m - .3413193965 * s),
|
|
456
|
+
linearToSrgb(-.0041960863 * l - .7034186147 * m + 1.707614701 * s)
|
|
457
|
+
];
|
|
447
458
|
}
|
|
448
459
|
function interpolateHue(from, to, amount) {
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
return from;
|
|
453
|
-
const difference = ((to - from + 540) % 360) - 180;
|
|
454
|
-
return normalizeHue(from + difference * amount);
|
|
460
|
+
if (from === null) return to;
|
|
461
|
+
if (to === null) return from;
|
|
462
|
+
return normalizeHue(from + ((to - from + 540) % 360 - 180) * amount);
|
|
455
463
|
}
|
|
456
464
|
function srgbToLinear(channel) {
|
|
457
|
-
|
|
465
|
+
return channel <= .04045 ? channel / 12.92 : ((channel + .055) / 1.055) ** 2.4;
|
|
458
466
|
}
|
|
459
467
|
function linearToSrgb(channel) {
|
|
460
|
-
|
|
468
|
+
return channel <= .0031308 ? channel * 12.92 : 1.055 * channel ** (1 / 2.4) - .055;
|
|
461
469
|
}
|
|
462
470
|
function isInSrgbGamut(color) {
|
|
463
|
-
|
|
471
|
+
return color.every((channel) => channel >= -1e-7 && channel <= 1.0000001);
|
|
464
472
|
}
|
|
465
473
|
function toRgbChannels(color) {
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
474
|
+
return {
|
|
475
|
+
red: clampUnit(color[0]) * 255,
|
|
476
|
+
green: clampUnit(color[1]) * 255,
|
|
477
|
+
blue: clampUnit(color[2]) * 255
|
|
478
|
+
};
|
|
471
479
|
}
|
|
472
480
|
function interpolate(from, to, amount) {
|
|
473
|
-
|
|
481
|
+
return from + (to - from) * amount;
|
|
474
482
|
}
|
|
475
483
|
function normalizeHue(hue) {
|
|
476
|
-
|
|
484
|
+
return (hue % 360 + 360) % 360;
|
|
477
485
|
}
|
|
478
486
|
function formatPercentage(value) {
|
|
479
|
-
|
|
487
|
+
return Number(value.toFixed(4)).toString();
|
|
480
488
|
}
|
|
481
489
|
function parseHex(value) {
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
};
|
|
490
|
+
const hex = value.slice(1);
|
|
491
|
+
if (!/^[\da-f]{3}([\da-f]{3})?$/i.test(hex)) return null;
|
|
492
|
+
const normalized = hex.length === 3 ? [...hex].map((character) => character.repeat(2)).join("") : hex;
|
|
493
|
+
return {
|
|
494
|
+
red: Number.parseInt(normalized.slice(0, 2), 16),
|
|
495
|
+
green: Number.parseInt(normalized.slice(2, 4), 16),
|
|
496
|
+
blue: Number.parseInt(normalized.slice(4, 6), 16)
|
|
497
|
+
};
|
|
491
498
|
}
|
|
492
499
|
function parseRgb(value) {
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
return {
|
|
511
|
-
red: clampChannel(parsed[0]),
|
|
512
|
-
green: clampChannel(parsed[1]),
|
|
513
|
-
blue: clampChannel(parsed[2]),
|
|
514
|
-
};
|
|
500
|
+
const functionalValue = splitFunctionalColor(value);
|
|
501
|
+
if (!functionalValue) return null;
|
|
502
|
+
const body = functionalValue.channels;
|
|
503
|
+
if (!body) return null;
|
|
504
|
+
const channels = body.replaceAll(",", " ").split(/\s+/).filter(Boolean);
|
|
505
|
+
if (channels.length !== 3) return null;
|
|
506
|
+
const parsed = channels.map((channel) => {
|
|
507
|
+
const numeric = Number.parseFloat(channel);
|
|
508
|
+
if (!Number.isFinite(numeric)) return NaN;
|
|
509
|
+
return channel.endsWith("%") ? numeric * 2.55 : numeric;
|
|
510
|
+
});
|
|
511
|
+
if (parsed.some((channel) => !Number.isFinite(channel))) return null;
|
|
512
|
+
return {
|
|
513
|
+
red: clampChannel(parsed[0]),
|
|
514
|
+
green: clampChannel(parsed[1]),
|
|
515
|
+
blue: clampChannel(parsed[2])
|
|
516
|
+
};
|
|
515
517
|
}
|
|
516
518
|
function parseHsl(value) {
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
519
|
+
const functionalValue = splitFunctionalColor(value);
|
|
520
|
+
if (!functionalValue) return null;
|
|
521
|
+
const body = functionalValue.channels;
|
|
522
|
+
if (!body) return null;
|
|
523
|
+
const channels = body.replaceAll(",", " ").split(/\s+/).filter(Boolean);
|
|
524
|
+
if (channels.length !== 3 || !channels[1]?.endsWith("%") || !channels[2]?.endsWith("%")) return null;
|
|
525
|
+
const hue = Number.parseFloat(channels[0]);
|
|
526
|
+
const saturation = Number.parseFloat(channels[1]) / 100;
|
|
527
|
+
const lightness = Number.parseFloat(channels[2]) / 100;
|
|
528
|
+
if (![
|
|
529
|
+
hue,
|
|
530
|
+
saturation,
|
|
531
|
+
lightness
|
|
532
|
+
].every(Number.isFinite)) return null;
|
|
533
|
+
const chroma = (1 - Math.abs(2 * lightness - 1)) * saturation;
|
|
534
|
+
const section = (hue % 360 + 360) % 360 / 60;
|
|
535
|
+
const secondary = chroma * (1 - Math.abs(section % 2 - 1));
|
|
536
|
+
const [red, green, blue] = section < 1 ? [
|
|
537
|
+
chroma,
|
|
538
|
+
secondary,
|
|
539
|
+
0
|
|
540
|
+
] : section < 2 ? [
|
|
541
|
+
secondary,
|
|
542
|
+
chroma,
|
|
543
|
+
0
|
|
544
|
+
] : section < 3 ? [
|
|
545
|
+
0,
|
|
546
|
+
chroma,
|
|
547
|
+
secondary
|
|
548
|
+
] : section < 4 ? [
|
|
549
|
+
0,
|
|
550
|
+
secondary,
|
|
551
|
+
chroma
|
|
552
|
+
] : section < 5 ? [
|
|
553
|
+
secondary,
|
|
554
|
+
0,
|
|
555
|
+
chroma
|
|
556
|
+
] : [
|
|
557
|
+
chroma,
|
|
558
|
+
0,
|
|
559
|
+
secondary
|
|
560
|
+
];
|
|
561
|
+
const match = lightness - chroma / 2;
|
|
562
|
+
return {
|
|
563
|
+
red: clampChannel((red + match) * 255),
|
|
564
|
+
green: clampChannel((green + match) * 255),
|
|
565
|
+
blue: clampChannel((blue + match) * 255)
|
|
566
|
+
};
|
|
552
567
|
}
|
|
553
568
|
function splitFunctionalColor(value) {
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
if (alpha !== undefined && !isOpaqueAlpha(alpha))
|
|
559
|
-
return null;
|
|
560
|
-
return { channels };
|
|
569
|
+
const [channels, alpha, ...remainder] = value.slice(value.indexOf("(") + 1, -1).split("/").map((part) => part.trim());
|
|
570
|
+
if (!channels || remainder.length > 0) return null;
|
|
571
|
+
if (alpha !== void 0 && !isOpaqueAlpha(alpha)) return null;
|
|
572
|
+
return { channels };
|
|
561
573
|
}
|
|
562
574
|
function isOpaqueAlpha(value) {
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
return value.endsWith('%') ? numeric === 100 : numeric === 1;
|
|
575
|
+
const numeric = Number.parseFloat(value);
|
|
576
|
+
if (!Number.isFinite(numeric)) return false;
|
|
577
|
+
return value.endsWith("%") ? numeric === 100 : numeric === 1;
|
|
567
578
|
}
|
|
568
579
|
function clampChannel(value) {
|
|
569
|
-
|
|
580
|
+
return Math.min(255, Math.max(0, value));
|
|
570
581
|
}
|
|
571
582
|
function clampUnit(value) {
|
|
572
|
-
|
|
583
|
+
return Math.min(1, Math.max(0, value));
|
|
573
584
|
}
|
|
574
|
-
|
|
575
|
-
/**
|
|
576
|
-
* Version of the deterministic algorithm used to derive Aeris color tokens.
|
|
577
|
-
*
|
|
578
|
-
* A change to an existing derived color for the same complete theme input must
|
|
579
|
-
* increment this value. Build-time configurations can pin the version to make
|
|
580
|
-
* an intentional regeneration step explicit during upgrades.
|
|
581
|
-
*/
|
|
582
585
|
const AERIS_COLOR_DERIVATION_VERSION = 1;
|
|
583
|
-
|
|
584
|
-
const
|
|
585
|
-
const
|
|
586
|
-
const
|
|
587
|
-
const
|
|
588
|
-
const
|
|
589
|
-
const DARK_TEXT_TERTIARY = '#9d9d9d';
|
|
590
|
-
/** Resolves palette-aware surfaces and borders while keeping ordinary text achromatic. */
|
|
586
|
+
const LIGHT_TEXT = "#222222";
|
|
587
|
+
const LIGHT_TEXT_SECONDARY = "#555555";
|
|
588
|
+
const LIGHT_TEXT_TERTIARY = "#707070";
|
|
589
|
+
const DARK_TEXT = "#f4f4f4";
|
|
590
|
+
const DARK_TEXT_SECONDARY = "#c5c5c5";
|
|
591
|
+
const DARK_TEXT_TERTIARY = "#9d9d9d";
|
|
591
592
|
function resolveAerisFoundation(theme, mode) {
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
593
|
+
const scheme = theme[mode];
|
|
594
|
+
const surfaceSeed = theme.palette.surface;
|
|
595
|
+
const borderSeed = theme.palette.secondary;
|
|
596
|
+
if (mode === "light") {
|
|
597
|
+
const surface2 = scheme.surface2 ?? mixAerisColor("#f7f6f2", surfaceSeed, .24);
|
|
598
|
+
const surface = scheme.surface ?? "#ffffff";
|
|
599
|
+
const border = scheme.border ?? mixAerisColor(surface, mixAerisColor("#5f625d", borderSeed, .42), .12);
|
|
600
|
+
return {
|
|
601
|
+
page: scheme.page ?? mixAerisColor("#faf9f7", surfaceSeed, .18),
|
|
602
|
+
surface,
|
|
603
|
+
surface2,
|
|
604
|
+
surface3: scheme.surface3 ?? mixAerisColor("#f1f0eb", surfaceSeed, .42),
|
|
605
|
+
interactiveHover: scheme.interactiveHover ?? mixAerisColor(surface2, theme.palette.primary, .1),
|
|
606
|
+
text: scheme.text ?? LIGHT_TEXT,
|
|
607
|
+
text2: scheme.text2 ?? LIGHT_TEXT_SECONDARY,
|
|
608
|
+
text3: scheme.text3 ?? LIGHT_TEXT_TERTIARY,
|
|
609
|
+
border,
|
|
610
|
+
borderStrong: scheme.borderStrong ?? mixAerisColor("#444842", borderSeed, .3),
|
|
611
|
+
focus: scheme.focus ?? mixAerisColor("#1d2119", theme.palette.primary, .5)
|
|
612
|
+
};
|
|
613
|
+
}
|
|
614
|
+
const surface2 = scheme.surface2 ?? mixAerisColor("#171b22", surfaceSeed, .008);
|
|
615
|
+
const surface = scheme.surface ?? mixAerisColor("#101318", surfaceSeed, .006);
|
|
616
|
+
const border = scheme.border ?? mixAerisColor(surface, mixAerisColor("#70746d", borderSeed, .35), .16);
|
|
617
|
+
return {
|
|
618
|
+
page: scheme.page ?? mixAerisColor("#090b0f", surfaceSeed, .004),
|
|
619
|
+
surface,
|
|
620
|
+
surface2,
|
|
621
|
+
surface3: scheme.surface3 ?? mixAerisColor("#202632", surfaceSeed, .01),
|
|
622
|
+
interactiveHover: scheme.interactiveHover ?? mixAerisColor(surface2, theme.palette.primary, .12),
|
|
623
|
+
text: scheme.text ?? DARK_TEXT,
|
|
624
|
+
text2: scheme.text2 ?? DARK_TEXT_SECONDARY,
|
|
625
|
+
text3: scheme.text3 ?? DARK_TEXT_TERTIARY,
|
|
626
|
+
border,
|
|
627
|
+
borderStrong: scheme.borderStrong ?? mixAerisColor("#8d9289", borderSeed, .3),
|
|
628
|
+
focus: scheme.focus ?? mixAerisColor("#ffffff", theme.palette.primary, .56)
|
|
629
|
+
};
|
|
625
630
|
}
|
|
626
|
-
|
|
627
631
|
const AERIS_SEMANTIC_TONE_NAMES = [
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
632
|
+
"primary",
|
|
633
|
+
"secondary",
|
|
634
|
+
"success",
|
|
635
|
+
"info",
|
|
636
|
+
"warning",
|
|
637
|
+
"danger",
|
|
638
|
+
"contrast"
|
|
635
639
|
];
|
|
636
640
|
const LIGHT_BASES = {
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
+
success: "#52744d",
|
|
642
|
+
info: "#4f7180",
|
|
643
|
+
warning: "#c38600",
|
|
644
|
+
danger: "#c81e2a"
|
|
641
645
|
};
|
|
642
646
|
const DARK_BASES = {
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
+
success: "#91b78a",
|
|
648
|
+
info: "#91b7c8",
|
|
649
|
+
warning: "#facc15",
|
|
650
|
+
danger: "#ff5c68"
|
|
647
651
|
};
|
|
648
|
-
const DARK_FOREGROUND =
|
|
649
|
-
const LIGHT_FOREGROUND =
|
|
652
|
+
const DARK_FOREGROUND = "#111411";
|
|
653
|
+
const LIGHT_FOREGROUND = "#ffffff";
|
|
650
654
|
const REQUIRED_TEXT_CONTRAST = 4.5;
|
|
651
|
-
const LIGHT_HOVER_MIX =
|
|
652
|
-
const LIGHT_ACTIVE_MIX =
|
|
653
|
-
const DARK_HOVER_MIX =
|
|
654
|
-
const DARK_ACTIVE_MIX =
|
|
655
|
+
const LIGHT_HOVER_MIX = .04;
|
|
656
|
+
const LIGHT_ACTIVE_MIX = .05;
|
|
657
|
+
const DARK_HOVER_MIX = .2;
|
|
658
|
+
const DARK_ACTIVE_MIX = .28;
|
|
655
659
|
function resolveAerisSemanticTones(theme, mode) {
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
}
|
|
684
|
-
return result;
|
|
660
|
+
const scheme = theme[mode];
|
|
661
|
+
const surface = resolveSurface(theme, scheme, mode);
|
|
662
|
+
const result = {};
|
|
663
|
+
for (const name of AERIS_SEMANTIC_TONE_NAMES) {
|
|
664
|
+
const overrides = scheme.tones?.[name] ?? {};
|
|
665
|
+
const base = overrides.base ?? defaultBase(theme, mode, name);
|
|
666
|
+
const boundary = overrides.boundary ?? base;
|
|
667
|
+
const onBase = overrides.onBase ?? contrastingForeground(base);
|
|
668
|
+
const hover = overrides.hover ?? deriveState(base, mode, stateMix(mode, "hover"), onBase);
|
|
669
|
+
const active = overrides.active ?? deriveState(base, mode, stateMix(mode, "active"), onBase);
|
|
670
|
+
const soft = overrides.soft ?? mixAerisColor(surface, base, mode === "dark" ? .2 : .14);
|
|
671
|
+
const text = overrides.text ?? ensureTextContrast(base, surface, mode);
|
|
672
|
+
const onHover = overrides.onHover ?? contrastingForeground(hover, onBase);
|
|
673
|
+
result[name] = {
|
|
674
|
+
base,
|
|
675
|
+
boundary,
|
|
676
|
+
hover,
|
|
677
|
+
active,
|
|
678
|
+
onBase,
|
|
679
|
+
onHover,
|
|
680
|
+
onActive: overrides.onActive ?? contrastingForeground(active, onHover),
|
|
681
|
+
text,
|
|
682
|
+
soft,
|
|
683
|
+
onSoft: overrides.onSoft ?? ensureTextContrast(text, soft, mode)
|
|
684
|
+
};
|
|
685
|
+
}
|
|
686
|
+
return result;
|
|
685
687
|
}
|
|
686
688
|
function defaultBase(theme, mode, name) {
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
: name === 'secondary'
|
|
693
|
-
? theme.palette.secondary
|
|
694
|
-
: theme.palette.contrast;
|
|
695
|
-
if (mode === 'light')
|
|
696
|
-
return seed;
|
|
697
|
-
return mixAerisColor(seed, LIGHT_FOREGROUND, name === 'contrast' ? 0.29 : 0.22);
|
|
689
|
+
const fixed = (mode === "dark" ? DARK_BASES : LIGHT_BASES)[name];
|
|
690
|
+
if (fixed) return fixed;
|
|
691
|
+
const seed = name === "primary" ? theme.palette.primary : name === "secondary" ? theme.palette.secondary : theme.palette.contrast;
|
|
692
|
+
if (mode === "light") return seed;
|
|
693
|
+
return mixAerisColor(seed, LIGHT_FOREGROUND, name === "contrast" ? .29 : .22);
|
|
698
694
|
}
|
|
699
695
|
function resolveSurface(theme, scheme, mode) {
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
return mode === 'light'
|
|
703
|
-
? LIGHT_FOREGROUND
|
|
704
|
-
: mixAerisColor('#1f221c', theme.palette.surface, 0.02);
|
|
696
|
+
if (scheme.surface) return scheme.surface;
|
|
697
|
+
return mode === "light" ? LIGHT_FOREGROUND : mixAerisColor("#1f221c", theme.palette.surface, .02);
|
|
705
698
|
}
|
|
706
|
-
function deriveState(base, mode, amount) {
|
|
707
|
-
|
|
699
|
+
function deriveState(base, mode, amount, foreground) {
|
|
700
|
+
const state = mixAerisColor(base, mode === "light" ? DARK_FOREGROUND : LIGHT_FOREGROUND, amount);
|
|
701
|
+
const stateColor = parseAerisColor(state);
|
|
702
|
+
const foregroundColor = parseAerisColor(foreground);
|
|
703
|
+
if (mode === "dark" || !stateColor || !foregroundColor || aerisRgbContrastRatio(stateColor, foregroundColor) >= REQUIRED_TEXT_CONTRAST) return state;
|
|
704
|
+
const dark = parseAerisColor(DARK_FOREGROUND);
|
|
705
|
+
const target = aerisRgbContrastRatio(foregroundColor, parseAerisColor(LIGHT_FOREGROUND)) > aerisRgbContrastRatio(foregroundColor, dark) ? LIGHT_FOREGROUND : DARK_FOREGROUND;
|
|
706
|
+
for (let mix = amount; mix <= 1; mix += .01) {
|
|
707
|
+
const candidate = mixAerisColor(base, target, mix);
|
|
708
|
+
const candidateColor = parseAerisColor(candidate);
|
|
709
|
+
if (candidateColor && aerisRgbContrastRatio(candidateColor, foregroundColor) >= REQUIRED_TEXT_CONTRAST) return candidate;
|
|
710
|
+
}
|
|
711
|
+
return target;
|
|
708
712
|
}
|
|
709
713
|
function stateMix(mode, state) {
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
return state === 'hover' ? DARK_HOVER_MIX : DARK_ACTIVE_MIX;
|
|
714
|
+
if (mode === "light") return state === "hover" ? LIGHT_HOVER_MIX : LIGHT_ACTIVE_MIX;
|
|
715
|
+
return state === "hover" ? DARK_HOVER_MIX : DARK_ACTIVE_MIX;
|
|
713
716
|
}
|
|
714
717
|
function contrastingForeground(color, fallback = DARK_FOREGROUND) {
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
}
|
|
722
|
-
const darkContrast = aerisRgbContrastRatio(background, parseAerisColor(DARK_FOREGROUND));
|
|
723
|
-
const lightContrast = aerisRgbContrastRatio(background, parseAerisColor(LIGHT_FOREGROUND));
|
|
724
|
-
return lightContrast > darkContrast ? LIGHT_FOREGROUND : DARK_FOREGROUND;
|
|
718
|
+
const background = parseAerisColor(color);
|
|
719
|
+
if (!background) return fallback;
|
|
720
|
+
const fallbackColor = parseAerisColor(fallback);
|
|
721
|
+
if (fallbackColor && aerisRgbContrastRatio(background, fallbackColor) >= REQUIRED_TEXT_CONTRAST) return fallback;
|
|
722
|
+
const darkContrast = aerisRgbContrastRatio(background, parseAerisColor(DARK_FOREGROUND));
|
|
723
|
+
return aerisRgbContrastRatio(background, parseAerisColor(LIGHT_FOREGROUND)) > darkContrast ? LIGHT_FOREGROUND : DARK_FOREGROUND;
|
|
725
724
|
}
|
|
726
725
|
function ensureTextContrast(color, background, mode) {
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
return formatAerisHex(candidate);
|
|
738
|
-
}
|
|
739
|
-
}
|
|
740
|
-
return formatAerisHex(target);
|
|
726
|
+
const foreground = parseAerisColor(color);
|
|
727
|
+
const surface = parseAerisColor(background);
|
|
728
|
+
if (!foreground || !surface) return color;
|
|
729
|
+
if (aerisRgbContrastRatio(foreground, surface) >= REQUIRED_TEXT_CONTRAST) return color;
|
|
730
|
+
const target = parseAerisColor(mode === "light" ? DARK_FOREGROUND : LIGHT_FOREGROUND);
|
|
731
|
+
for (let amount = .05; amount <= 1; amount += .05) {
|
|
732
|
+
const candidate = mixAerisRgb(foreground, target, amount);
|
|
733
|
+
if (aerisRgbContrastRatio(candidate, surface) >= REQUIRED_TEXT_CONTRAST) return formatAerisHex(candidate);
|
|
734
|
+
}
|
|
735
|
+
return formatAerisHex(target);
|
|
741
736
|
}
|
|
742
|
-
|
|
743
737
|
const TONE_NAMES = [
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
738
|
+
"primary",
|
|
739
|
+
"secondary",
|
|
740
|
+
"success",
|
|
741
|
+
"info",
|
|
742
|
+
"warning",
|
|
743
|
+
"danger",
|
|
744
|
+
"contrast"
|
|
751
745
|
];
|
|
752
746
|
function auditAerisThemeContrast(theme, mode) {
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
const resolvedTotal = passed + failed;
|
|
894
|
-
return {
|
|
895
|
-
mode,
|
|
896
|
-
checks,
|
|
897
|
-
passed,
|
|
898
|
-
failed,
|
|
899
|
-
unresolved,
|
|
900
|
-
total: checks.length,
|
|
901
|
-
score: resolvedTotal > 0 ? Math.round((passed / resolvedTotal) * 100) : 0,
|
|
902
|
-
status: failed > 0 ? 'fail' : unresolved > 0 ? 'unresolved' : 'pass',
|
|
903
|
-
};
|
|
747
|
+
const scheme = resolveSchemeColors(theme, mode);
|
|
748
|
+
const tones = resolveAerisSemanticTones(theme, mode);
|
|
749
|
+
const checks = [
|
|
750
|
+
createCheck({
|
|
751
|
+
id: "text-page",
|
|
752
|
+
label: "Primary text on page",
|
|
753
|
+
description: "Default body content against the application page.",
|
|
754
|
+
category: "text",
|
|
755
|
+
kind: "text",
|
|
756
|
+
foreground: scheme.text,
|
|
757
|
+
background: scheme.page,
|
|
758
|
+
requiredRatio: 4.5,
|
|
759
|
+
guidance: "Increase the difference between the text and page colors."
|
|
760
|
+
}),
|
|
761
|
+
createCheck({
|
|
762
|
+
id: "text-surface",
|
|
763
|
+
label: "Primary text on surface",
|
|
764
|
+
description: "Default content inside cards, panels, and overlays.",
|
|
765
|
+
category: "text",
|
|
766
|
+
kind: "text",
|
|
767
|
+
foreground: scheme.text,
|
|
768
|
+
background: scheme.surface,
|
|
769
|
+
requiredRatio: 4.5,
|
|
770
|
+
guidance: "Increase the difference between the text and surface colors."
|
|
771
|
+
}),
|
|
772
|
+
createCheck({
|
|
773
|
+
id: "text-secondary-surface",
|
|
774
|
+
label: "Secondary text on surface",
|
|
775
|
+
description: "Supporting descriptions and metadata on a primary surface.",
|
|
776
|
+
category: "text",
|
|
777
|
+
kind: "text",
|
|
778
|
+
foreground: scheme.text2,
|
|
779
|
+
background: scheme.surface,
|
|
780
|
+
requiredRatio: 4.5,
|
|
781
|
+
guidance: "Strengthen the secondary text color without reducing hierarchy."
|
|
782
|
+
}),
|
|
783
|
+
createCheck({
|
|
784
|
+
id: "text-tertiary-surface",
|
|
785
|
+
label: "Tertiary text on surface",
|
|
786
|
+
description: "Low-emphasis visible text on a primary surface.",
|
|
787
|
+
category: "text",
|
|
788
|
+
kind: "text",
|
|
789
|
+
foreground: scheme.text3,
|
|
790
|
+
background: scheme.surface,
|
|
791
|
+
requiredRatio: 4.5,
|
|
792
|
+
guidance: "Darken or lighten the tertiary text until it remains readable."
|
|
793
|
+
}),
|
|
794
|
+
createCheck({
|
|
795
|
+
id: "text-secondary-raised",
|
|
796
|
+
label: "Secondary text on raised surface",
|
|
797
|
+
description: "Supporting content against the secondary surface layer.",
|
|
798
|
+
category: "text",
|
|
799
|
+
kind: "text",
|
|
800
|
+
foreground: scheme.text2,
|
|
801
|
+
background: scheme.surface2,
|
|
802
|
+
requiredRatio: 4.5,
|
|
803
|
+
guidance: "Increase secondary text contrast against the raised surface."
|
|
804
|
+
}),
|
|
805
|
+
createCheck({
|
|
806
|
+
id: "text-interactive-hover",
|
|
807
|
+
label: "Primary text on neutral hover",
|
|
808
|
+
description: "Default item content against the shared neutral interactive hover surface.",
|
|
809
|
+
category: "interaction",
|
|
810
|
+
kind: "text",
|
|
811
|
+
foreground: scheme.text,
|
|
812
|
+
background: scheme.interactiveHover,
|
|
813
|
+
requiredRatio: 4.5,
|
|
814
|
+
guidance: "Adjust interactiveHover until default content remains readable."
|
|
815
|
+
}),
|
|
816
|
+
...TONE_NAMES.flatMap((name) => interactionChecks(name, tones[name], scheme.surface)),
|
|
817
|
+
createCheck({
|
|
818
|
+
id: "focus-surface",
|
|
819
|
+
label: "Focus indicator on surface",
|
|
820
|
+
description: "Focus token against cards, controls, and overlay surfaces.",
|
|
821
|
+
category: "focus",
|
|
822
|
+
kind: "non-text",
|
|
823
|
+
foreground: scheme.focus,
|
|
824
|
+
background: scheme.surface,
|
|
825
|
+
requiredRatio: 3,
|
|
826
|
+
guidance: "Strengthen the focus color against the primary surface."
|
|
827
|
+
}),
|
|
828
|
+
createCheck({
|
|
829
|
+
id: "focus-page",
|
|
830
|
+
label: "Focus indicator on page",
|
|
831
|
+
description: "Focus token against the application page background.",
|
|
832
|
+
category: "focus",
|
|
833
|
+
kind: "non-text",
|
|
834
|
+
foreground: scheme.focus,
|
|
835
|
+
background: scheme.page,
|
|
836
|
+
requiredRatio: 3,
|
|
837
|
+
guidance: "Strengthen the focus color against the page background."
|
|
838
|
+
}),
|
|
839
|
+
createCheck({
|
|
840
|
+
id: "border-strong-surface",
|
|
841
|
+
label: "Emphasized boundary on surface",
|
|
842
|
+
description: "Optional strong boundary against a primary surface.",
|
|
843
|
+
category: "boundary",
|
|
844
|
+
kind: "non-text",
|
|
845
|
+
foreground: scheme.borderStrong,
|
|
846
|
+
background: scheme.surface,
|
|
847
|
+
requiredRatio: 3,
|
|
848
|
+
guidance: "Increase the emphasized boundary contrast against the primary surface."
|
|
849
|
+
}),
|
|
850
|
+
createCheck({
|
|
851
|
+
id: "border-strong-raised",
|
|
852
|
+
label: "Emphasized boundary on raised surface",
|
|
853
|
+
description: "Optional strong boundary used on the secondary surface layer.",
|
|
854
|
+
category: "boundary",
|
|
855
|
+
kind: "non-text",
|
|
856
|
+
foreground: scheme.borderStrong,
|
|
857
|
+
background: scheme.surface2,
|
|
858
|
+
requiredRatio: 3,
|
|
859
|
+
guidance: "Increase the emphasized boundary contrast against the raised surface."
|
|
860
|
+
}),
|
|
861
|
+
...TONE_NAMES.map((name) => createCheck({
|
|
862
|
+
id: `${name}-boundary`,
|
|
863
|
+
label: `${titleCase(name)} control boundary`,
|
|
864
|
+
description: `Solid ${name} controls against a primary surface.`,
|
|
865
|
+
category: "boundary",
|
|
866
|
+
kind: "non-text",
|
|
867
|
+
foreground: tones[name].boundary,
|
|
868
|
+
background: scheme.surface,
|
|
869
|
+
requiredRatio: 3,
|
|
870
|
+
guidance: `Adjust tones.${name}.boundary so solid controls remain identifiable.`
|
|
871
|
+
}))
|
|
872
|
+
];
|
|
873
|
+
const passed = checks.filter((check) => check.status === "pass").length;
|
|
874
|
+
const failed = checks.filter((check) => check.status === "fail").length;
|
|
875
|
+
const unresolved = checks.filter((check) => check.status === "unresolved").length;
|
|
876
|
+
const resolvedTotal = passed + failed;
|
|
877
|
+
return {
|
|
878
|
+
mode,
|
|
879
|
+
checks,
|
|
880
|
+
passed,
|
|
881
|
+
failed,
|
|
882
|
+
unresolved,
|
|
883
|
+
total: checks.length,
|
|
884
|
+
score: resolvedTotal > 0 ? Math.round(passed / resolvedTotal * 100) : 0,
|
|
885
|
+
status: failed > 0 ? "fail" : unresolved > 0 ? "unresolved" : "pass"
|
|
886
|
+
};
|
|
904
887
|
}
|
|
905
888
|
function interactionChecks(name, tone, surface) {
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
889
|
+
const label = titleCase(name);
|
|
890
|
+
return [
|
|
891
|
+
createCheck({
|
|
892
|
+
id: `${name}-base-content`,
|
|
893
|
+
label: `${label} solid content`,
|
|
894
|
+
description: "Text and icons on the default solid background.",
|
|
895
|
+
category: "interaction",
|
|
896
|
+
kind: "text",
|
|
897
|
+
foreground: tone.onBase,
|
|
898
|
+
background: tone.base,
|
|
899
|
+
requiredRatio: 4.5,
|
|
900
|
+
guidance: `Set tones.${name}.onBase to a more contrasting foreground.`
|
|
901
|
+
}),
|
|
902
|
+
createCheck({
|
|
903
|
+
id: `${name}-hover-content`,
|
|
904
|
+
label: `${label} hover content`,
|
|
905
|
+
description: "Text and icons on the hover background.",
|
|
906
|
+
category: "interaction",
|
|
907
|
+
kind: "text",
|
|
908
|
+
foreground: tone.onHover,
|
|
909
|
+
background: tone.hover,
|
|
910
|
+
requiredRatio: 4.5,
|
|
911
|
+
guidance: `Adjust tones.${name}.hover or tones.${name}.onHover.`
|
|
912
|
+
}),
|
|
913
|
+
createCheck({
|
|
914
|
+
id: `${name}-active-content`,
|
|
915
|
+
label: `${label} pressed content`,
|
|
916
|
+
description: "Text and icons on the pressed background.",
|
|
917
|
+
category: "interaction",
|
|
918
|
+
kind: "text",
|
|
919
|
+
foreground: tone.onActive,
|
|
920
|
+
background: tone.active,
|
|
921
|
+
requiredRatio: 4.5,
|
|
922
|
+
guidance: `Adjust tones.${name}.active or tones.${name}.onActive.`
|
|
923
|
+
}),
|
|
924
|
+
createCheck({
|
|
925
|
+
id: `${name}-text-surface`,
|
|
926
|
+
label: `${label} text treatment`,
|
|
927
|
+
description: "Outline, text, and link content on a primary surface.",
|
|
928
|
+
category: "interaction",
|
|
929
|
+
kind: "text",
|
|
930
|
+
foreground: tone.text,
|
|
931
|
+
background: surface,
|
|
932
|
+
requiredRatio: 4.5,
|
|
933
|
+
guidance: `Set tones.${name}.text to a readable surface foreground.`
|
|
934
|
+
}),
|
|
935
|
+
createCheck({
|
|
936
|
+
id: `${name}-soft-content`,
|
|
937
|
+
label: `${label} soft content`,
|
|
938
|
+
description: "Text and icons on the low-emphasis semantic background.",
|
|
939
|
+
category: "interaction",
|
|
940
|
+
kind: "text",
|
|
941
|
+
foreground: tone.onSoft,
|
|
942
|
+
background: tone.soft,
|
|
943
|
+
requiredRatio: 4.5,
|
|
944
|
+
guidance: `Adjust tones.${name}.soft or tones.${name}.onSoft.`
|
|
945
|
+
})
|
|
946
|
+
];
|
|
964
947
|
}
|
|
965
948
|
function createCheck(definition) {
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
949
|
+
const ratio = aerisContrastRatio(definition.foreground, definition.background);
|
|
950
|
+
const status = ratio === null ? "unresolved" : ratio >= definition.requiredRatio ? "pass" : "fail";
|
|
951
|
+
return {
|
|
952
|
+
...definition,
|
|
953
|
+
criterion: definition.kind === "text" ? "1.4.3" : "1.4.11",
|
|
954
|
+
ratio,
|
|
955
|
+
status
|
|
956
|
+
};
|
|
974
957
|
}
|
|
975
958
|
function resolveSchemeColors(theme, mode) {
|
|
976
|
-
|
|
959
|
+
return resolveAerisFoundation(theme, mode);
|
|
977
960
|
}
|
|
978
961
|
function titleCase(value) {
|
|
979
|
-
|
|
962
|
+
return value.charAt(0).toUpperCase() + value.slice(1);
|
|
980
963
|
}
|
|
981
|
-
|
|
982
|
-
|
|
964
|
+
const AERIS_THEME_RESOLUTION_BASE = {
|
|
965
|
+
...AERIS_DEFAULT_THEME,
|
|
966
|
+
palette: {
|
|
967
|
+
...AERIS_THEME_PRESETS.earth.palette,
|
|
968
|
+
mist: AERIS_THEME_PRESETS.earth.palette.surface,
|
|
969
|
+
sage: AERIS_THEME_PRESETS.earth.palette.primary,
|
|
970
|
+
cloud: AERIS_THEME_PRESETS.earth.palette.secondary,
|
|
971
|
+
sand: AERIS_THEME_PRESETS.earth.palette.accent,
|
|
972
|
+
umber: AERIS_THEME_PRESETS.earth.palette.contrast
|
|
973
|
+
},
|
|
974
|
+
light: {},
|
|
975
|
+
dark: { ...AERIS_THEME_PRESETS.earth.dark }
|
|
976
|
+
};
|
|
983
977
|
function resolveAerisTheme(theme) {
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
978
|
+
const base = theme === void 0 ? AERIS_DEFAULT_THEME : AERIS_THEME_RESOLUTION_BASE;
|
|
979
|
+
return {
|
|
980
|
+
...base,
|
|
981
|
+
...theme,
|
|
982
|
+
palette: {
|
|
983
|
+
...base.palette,
|
|
984
|
+
...normalizeAerisPalette(theme?.palette)
|
|
985
|
+
},
|
|
986
|
+
light: {
|
|
987
|
+
...base.light,
|
|
988
|
+
...theme?.light,
|
|
989
|
+
tones: mergeAerisSemanticTones(base.light.tones, theme?.light?.tones)
|
|
990
|
+
},
|
|
991
|
+
dark: {
|
|
992
|
+
...base.dark,
|
|
993
|
+
...theme?.dark,
|
|
994
|
+
tones: mergeAerisSemanticTones(base.dark.tones, theme?.dark?.tones)
|
|
995
|
+
},
|
|
996
|
+
densities: {
|
|
997
|
+
...base.densities,
|
|
998
|
+
...theme?.densities
|
|
999
|
+
},
|
|
1000
|
+
radii: {
|
|
1001
|
+
...base.radii,
|
|
1002
|
+
...theme?.radii
|
|
1003
|
+
}
|
|
1004
|
+
};
|
|
1010
1005
|
}
|
|
1011
|
-
/** Deeply merges a runtime update into an already resolved Aeris theme. */
|
|
1012
1006
|
function mergeAerisTheme(theme, update) {
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1007
|
+
return {
|
|
1008
|
+
...theme,
|
|
1009
|
+
...update,
|
|
1010
|
+
palette: {
|
|
1011
|
+
...theme.palette,
|
|
1012
|
+
...normalizeAerisPalette(update.palette)
|
|
1013
|
+
},
|
|
1014
|
+
light: {
|
|
1015
|
+
...theme.light,
|
|
1016
|
+
...update.light,
|
|
1017
|
+
tones: mergeAerisSemanticTones(theme.light.tones, update.light?.tones)
|
|
1018
|
+
},
|
|
1019
|
+
dark: {
|
|
1020
|
+
...theme.dark,
|
|
1021
|
+
...update.dark,
|
|
1022
|
+
tones: mergeAerisSemanticTones(theme.dark.tones, update.dark?.tones)
|
|
1023
|
+
},
|
|
1024
|
+
densities: {
|
|
1025
|
+
...theme.densities,
|
|
1026
|
+
...update.densities
|
|
1027
|
+
},
|
|
1028
|
+
radii: {
|
|
1029
|
+
...theme.radii,
|
|
1030
|
+
...update.radii
|
|
1031
|
+
}
|
|
1032
|
+
};
|
|
1039
1033
|
}
|
|
1040
1034
|
function resolveAerisDensity(theme) {
|
|
1041
|
-
|
|
1035
|
+
return theme.densities[theme.density] ?? AERIS_DEFAULT_THEME.densities["medium"];
|
|
1042
1036
|
}
|
|
1043
1037
|
function resolveAerisRadius(theme) {
|
|
1044
|
-
|
|
1038
|
+
return theme.radii[theme.radius] ?? AERIS_DEFAULT_THEME.radii["rounded"];
|
|
1045
1039
|
}
|
|
1046
1040
|
function mergeAerisSemanticTones(current, updates) {
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
...current?.[name],
|
|
1053
|
-
...updates?.[name],
|
|
1054
|
-
},
|
|
1055
|
-
]));
|
|
1041
|
+
if (!current && !updates) return void 0;
|
|
1042
|
+
return Object.fromEntries(AERIS_SEMANTIC_TONE_NAMES.map((name) => [name, {
|
|
1043
|
+
...current?.[name],
|
|
1044
|
+
...updates?.[name]
|
|
1045
|
+
}]));
|
|
1056
1046
|
}
|
|
1057
1047
|
function normalizeAerisPalette(palette) {
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1048
|
+
if (!palette) return {};
|
|
1049
|
+
const surface = palette.surface ?? palette.mist;
|
|
1050
|
+
const primary = palette.primary ?? palette.sage;
|
|
1051
|
+
const secondary = palette.secondary ?? palette.cloud;
|
|
1052
|
+
const accent = palette.accent ?? palette.sand;
|
|
1053
|
+
const contrast = palette.contrast ?? palette.umber;
|
|
1054
|
+
return {
|
|
1055
|
+
...palette,
|
|
1056
|
+
...surface ? {
|
|
1057
|
+
surface,
|
|
1058
|
+
mist: surface
|
|
1059
|
+
} : {},
|
|
1060
|
+
...primary ? {
|
|
1061
|
+
primary,
|
|
1062
|
+
sage: primary
|
|
1063
|
+
} : {},
|
|
1064
|
+
...secondary ? {
|
|
1065
|
+
secondary,
|
|
1066
|
+
cloud: secondary
|
|
1067
|
+
} : {},
|
|
1068
|
+
...accent ? {
|
|
1069
|
+
accent,
|
|
1070
|
+
sand: accent
|
|
1071
|
+
} : {},
|
|
1072
|
+
...contrast ? {
|
|
1073
|
+
contrast,
|
|
1074
|
+
umber: contrast
|
|
1075
|
+
} : {}
|
|
1076
|
+
};
|
|
1073
1077
|
}
|
|
1074
|
-
|
|
1075
1078
|
const FOUNDATION_TOKENS = [
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1079
|
+
["page", "--aeris-page"],
|
|
1080
|
+
["surface", "--aeris-surface"],
|
|
1081
|
+
["surface2", "--aeris-surface-2"],
|
|
1082
|
+
["surface3", "--aeris-surface-3"],
|
|
1083
|
+
["interactiveHover", "--aeris-interactive-hover"],
|
|
1084
|
+
["text", "--aeris-text"],
|
|
1085
|
+
["text2", "--aeris-text-2"],
|
|
1086
|
+
["text3", "--aeris-text-3"],
|
|
1087
|
+
["border", "--aeris-border"],
|
|
1088
|
+
["borderStrong", "--aeris-border-strong"],
|
|
1089
|
+
["focus", "--aeris-focus"]
|
|
1087
1090
|
];
|
|
1088
1091
|
const DENSITY_TOKENS = [
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1092
|
+
["controlHeight", "--aeris-control-height"],
|
|
1093
|
+
["controlPaddingX", "--aeris-control-padding-x"],
|
|
1094
|
+
["itemHeight", "--aeris-item-height"],
|
|
1095
|
+
["itemPaddingY", "--aeris-item-padding-y"],
|
|
1096
|
+
["itemPaddingX", "--aeris-item-padding-x"],
|
|
1097
|
+
["gap", "--aeris-density-gap"],
|
|
1098
|
+
["iconSize", "--aeris-icon-size"]
|
|
1096
1099
|
];
|
|
1097
1100
|
const RADIUS_TOKENS = [
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1101
|
+
["sm", "--aeris-radius-sm"],
|
|
1102
|
+
["md", "--aeris-radius-md"],
|
|
1103
|
+
["lg", "--aeris-radius-lg"],
|
|
1104
|
+
["xl", "--aeris-radius-xl"],
|
|
1105
|
+
["control", "--aeris-radius-control"],
|
|
1106
|
+
["pill", "--aeris-radius-pill"]
|
|
1104
1107
|
];
|
|
1105
|
-
/** Resolves the ordered CSS custom properties used by runtime and generated Aeris themes. */
|
|
1106
1108
|
function resolveAerisThemeTokens(theme, mode) {
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
for (const [property, token] of RADIUS_TOKENS) {
|
|
1144
|
-
const value = radius[property];
|
|
1145
|
-
if (value)
|
|
1146
|
-
tokens[token] = value;
|
|
1147
|
-
}
|
|
1148
|
-
return tokens;
|
|
1109
|
+
const tokens = {};
|
|
1110
|
+
for (const [name, value] of Object.entries(theme.palette)) tokens[`--aeris-palette-${name}`] = value;
|
|
1111
|
+
const foundation = resolveAerisFoundation(theme, mode);
|
|
1112
|
+
for (const [property, token] of FOUNDATION_TOKENS) tokens[token] = foundation[property];
|
|
1113
|
+
tokens["--aeris-accent"] = theme[mode].accent ?? theme.palette.accent;
|
|
1114
|
+
tokens["--aeris-shadow-xs"] = theme[mode].shadowXs ?? (mode === "light" ? "0 1px 2px rgb(0 0 0 / 8%)" : "0 1px 2px rgb(0 0 0 / 40%)");
|
|
1115
|
+
tokens["--aeris-shadow-sm"] = theme[mode].shadowSm ?? (mode === "light" ? "0 2px 8px rgb(0 0 0 / 10%)" : "0 2px 8px rgb(0 0 0 / 48%)");
|
|
1116
|
+
tokens["--aeris-shadow-md"] = theme[mode].shadowMd ?? (mode === "light" ? "0 8px 24px rgb(0 0 0 / 12%)" : "0 10px 28px rgb(0 0 0 / 54%)");
|
|
1117
|
+
tokens["--aeris-shadow-lg"] = theme[mode].shadowLg ?? (mode === "light" ? "0 18px 48px rgb(0 0 0 / 16%)" : "0 20px 56px rgb(0 0 0 / 64%)");
|
|
1118
|
+
const tones = resolveAerisSemanticTones(theme, mode);
|
|
1119
|
+
for (const name of AERIS_SEMANTIC_TONE_NAMES) {
|
|
1120
|
+
const tone = tones[name];
|
|
1121
|
+
tokens[`--aeris-${name}`] = tone.base;
|
|
1122
|
+
tokens[`--aeris-${name}-boundary`] = tone.boundary;
|
|
1123
|
+
tokens[`--aeris-${name}-hover`] = tone.hover;
|
|
1124
|
+
tokens[`--aeris-${name}-active`] = tone.active;
|
|
1125
|
+
tokens[`--aeris-on-${name}`] = tone.onBase;
|
|
1126
|
+
tokens[`--aeris-on-${name}-hover`] = tone.onHover;
|
|
1127
|
+
tokens[`--aeris-on-${name}-active`] = tone.onActive;
|
|
1128
|
+
tokens[`--aeris-${name}-text`] = tone.text;
|
|
1129
|
+
tokens[`--aeris-${name}-soft`] = tone.soft;
|
|
1130
|
+
tokens[`--aeris-on-${name}-soft`] = tone.onSoft;
|
|
1131
|
+
tokens[`--aeris-${name}-contrast`] = tone.onBase;
|
|
1132
|
+
}
|
|
1133
|
+
tokens["--aeris-primary-contrast"] = tones.primary.onBase;
|
|
1134
|
+
const density = resolveAerisDensity(theme);
|
|
1135
|
+
for (const [property, token] of DENSITY_TOKENS) {
|
|
1136
|
+
const value = density[property];
|
|
1137
|
+
if (value) tokens[token] = value;
|
|
1138
|
+
}
|
|
1139
|
+
const radius = resolveAerisRadius(theme);
|
|
1140
|
+
for (const [property, token] of RADIUS_TOKENS) {
|
|
1141
|
+
const value = radius[property];
|
|
1142
|
+
if (value) tokens[token] = value;
|
|
1143
|
+
}
|
|
1144
|
+
return tokens;
|
|
1149
1145
|
}
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
const
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
return {
|
|
1185
|
-
derivationVersion: AERIS_COLOR_DERIVATION_VERSION,
|
|
1186
|
-
css: serializeThemeCss(lightTokens, darkTokens, selector, options, generation),
|
|
1187
|
-
theme,
|
|
1188
|
-
lightTokens,
|
|
1189
|
-
darkTokens,
|
|
1190
|
-
contrast,
|
|
1191
|
-
};
|
|
1146
|
+
var AerisThemeGenerationError = class extends Error {
|
|
1147
|
+
issues;
|
|
1148
|
+
constructor(issues) {
|
|
1149
|
+
super(`Aeris theme generation failed with ${issues.length} issue${issues.length === 1 ? "" : "s"}.`);
|
|
1150
|
+
this.name = "AerisThemeGenerationError";
|
|
1151
|
+
this.issues = issues;
|
|
1152
|
+
}
|
|
1153
|
+
};
|
|
1154
|
+
const DEFAULT_SELECTOR = ":root";
|
|
1155
|
+
const GENERATED_BANNER = `/*! Generated by Aeris UI; color derivation v1. Edit the theme source, not this file. */`;
|
|
1156
|
+
function compileAerisTheme(themeOverride, options = {}) {
|
|
1157
|
+
const selector = options.selector?.trim() || DEFAULT_SELECTOR;
|
|
1158
|
+
const generation = resolveGenerationOptions(options);
|
|
1159
|
+
const theme = resolveAerisTheme(themeOverride);
|
|
1160
|
+
const lightTokens = resolveAerisThemeTokens(theme, "light");
|
|
1161
|
+
const darkTokens = resolveAerisThemeTokens(theme, "dark");
|
|
1162
|
+
const contrast = {
|
|
1163
|
+
light: auditAerisThemeContrast(theme, "light"),
|
|
1164
|
+
dark: auditAerisThemeContrast(theme, "dark")
|
|
1165
|
+
};
|
|
1166
|
+
const issues = [...validateGeneration(selector, theme, lightTokens, darkTokens, contrast, generation)];
|
|
1167
|
+
if (options.expectedDerivationVersion !== void 0 && options.expectedDerivationVersion !== 1) issues.unshift({
|
|
1168
|
+
code: "derivation-version-mismatch",
|
|
1169
|
+
message: `This configuration expects color derivation v${options.expectedDerivationVersion}, but the installed Aeris package provides v1. Review the theme changes, then update the configured derivation version before regenerating CSS.`
|
|
1170
|
+
});
|
|
1171
|
+
if (issues.length) throw new AerisThemeGenerationError(issues);
|
|
1172
|
+
return {
|
|
1173
|
+
derivationVersion: 1,
|
|
1174
|
+
css: serializeThemeCss(lightTokens, darkTokens, selector, options, generation),
|
|
1175
|
+
theme,
|
|
1176
|
+
lightTokens,
|
|
1177
|
+
darkTokens,
|
|
1178
|
+
contrast
|
|
1179
|
+
};
|
|
1192
1180
|
}
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
return compileAerisTheme(themeOverride, options).css;
|
|
1181
|
+
function generateAerisThemeCss(themeOverride, options = {}) {
|
|
1182
|
+
return compileAerisTheme(themeOverride, options).css;
|
|
1196
1183
|
}
|
|
1197
1184
|
function validateGeneration(selector, theme, lightTokens, darkTokens, contrast, generation) {
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
mode,
|
|
1238
|
-
token,
|
|
1239
|
-
});
|
|
1240
|
-
}
|
|
1241
|
-
}
|
|
1242
|
-
if (generation.validateContrast) {
|
|
1243
|
-
for (const check of contrast[mode].checks) {
|
|
1244
|
-
if (check.status === 'fail') {
|
|
1245
|
-
issues.push({
|
|
1246
|
-
code: 'contrast-failed',
|
|
1247
|
-
message: `${check.label} is ${check.ratio?.toFixed(2)}:1; ${check.requiredRatio}:1 is required.`,
|
|
1248
|
-
mode,
|
|
1249
|
-
});
|
|
1250
|
-
}
|
|
1251
|
-
else if (check.status === 'unresolved') {
|
|
1252
|
-
issues.push({
|
|
1253
|
-
code: 'contrast-unresolved',
|
|
1254
|
-
message: `${check.label} could not be evaluated from static colors.`,
|
|
1255
|
-
mode,
|
|
1256
|
-
});
|
|
1257
|
-
}
|
|
1258
|
-
}
|
|
1259
|
-
}
|
|
1260
|
-
}
|
|
1261
|
-
return issues;
|
|
1185
|
+
const issues = [];
|
|
1186
|
+
if (!isSafeSelector(selector)) issues.push({
|
|
1187
|
+
code: "invalid-selector",
|
|
1188
|
+
message: "selector must be one non-empty CSS selector without commas, braces, or semicolons."
|
|
1189
|
+
});
|
|
1190
|
+
if (!generation.valid) issues.push({
|
|
1191
|
+
code: "invalid-default-mode",
|
|
1192
|
+
message: generation.message
|
|
1193
|
+
});
|
|
1194
|
+
if (!theme.densities[theme.density]) issues.push({
|
|
1195
|
+
code: "invalid-density",
|
|
1196
|
+
message: `The density preset "${theme.density}" is not defined in theme.densities.`
|
|
1197
|
+
});
|
|
1198
|
+
if (!theme.radii[theme.radius]) issues.push({
|
|
1199
|
+
code: "invalid-radius",
|
|
1200
|
+
message: `The radius preset "${theme.radius}" is not defined in theme.radii.`
|
|
1201
|
+
});
|
|
1202
|
+
const modes = generation.schemes === "both" ? [["light", lightTokens], ["dark", darkTokens]] : [[generation.schemes, generation.schemes === "light" ? lightTokens : darkTokens]];
|
|
1203
|
+
for (const [mode, tokens] of modes) {
|
|
1204
|
+
for (const [token, value] of Object.entries(tokens)) if (!isSafeCssValue$1(value)) issues.push({
|
|
1205
|
+
code: "invalid-css-value",
|
|
1206
|
+
message: `${token} contains characters that cannot be emitted safely.`,
|
|
1207
|
+
mode,
|
|
1208
|
+
token
|
|
1209
|
+
});
|
|
1210
|
+
if (generation.validateContrast) {
|
|
1211
|
+
for (const check of contrast[mode].checks) if (check.status === "fail") issues.push({
|
|
1212
|
+
code: "contrast-failed",
|
|
1213
|
+
message: `${check.label} is ${check.ratio?.toFixed(2)}:1; ${check.requiredRatio}:1 is required.`,
|
|
1214
|
+
mode
|
|
1215
|
+
});
|
|
1216
|
+
else if (check.status === "unresolved") issues.push({
|
|
1217
|
+
code: "contrast-unresolved",
|
|
1218
|
+
message: `${check.label} could not be evaluated from static colors.`,
|
|
1219
|
+
mode
|
|
1220
|
+
});
|
|
1221
|
+
}
|
|
1222
|
+
}
|
|
1223
|
+
return issues;
|
|
1262
1224
|
}
|
|
1263
1225
|
function serializeThemeCss(lightTokens, darkTokens, selector, options, generation) {
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
darkSelectors.unshift(selector);
|
|
1295
|
-
}
|
|
1296
|
-
if (includeSystemMode)
|
|
1297
|
-
lightSelectors.push(`${selector}[data-aeris-theme='system']`);
|
|
1298
|
-
const rules = [
|
|
1299
|
-
formatRule([selector], common, undefined, options.minify ?? false),
|
|
1300
|
-
formatRule(lightSelectors, light, 'light', options.minify ?? false),
|
|
1301
|
-
formatRule(darkSelectors, dark, 'dark', options.minify ?? false),
|
|
1302
|
-
];
|
|
1303
|
-
if (includeSystemMode) {
|
|
1304
|
-
const systemSelectors = [`${selector}[data-aeris-theme='system']`];
|
|
1305
|
-
if (generation.defaultMode === 'system') {
|
|
1306
|
-
systemSelectors.unshift(`${selector}:not([data-aeris-theme])`);
|
|
1307
|
-
}
|
|
1308
|
-
const systemRule = formatRule(systemSelectors, dark, 'dark', options.minify ?? false);
|
|
1309
|
-
rules.push(formatMediaRule(systemRule, options.minify ?? false));
|
|
1310
|
-
}
|
|
1311
|
-
return finalizeCss(rules, options);
|
|
1226
|
+
if (generation.schemes !== "both") {
|
|
1227
|
+
const mode = generation.schemes;
|
|
1228
|
+
const tokens = Object.entries(mode === "light" ? lightTokens : darkTokens);
|
|
1229
|
+
return finalizeCss([formatRule([selector], tokens, mode, options.minify ?? false)], options);
|
|
1230
|
+
}
|
|
1231
|
+
const includeSystemMode = generation.includeSystemMode;
|
|
1232
|
+
const common = [];
|
|
1233
|
+
const light = [];
|
|
1234
|
+
const dark = [];
|
|
1235
|
+
for (const [token, lightValue] of Object.entries(lightTokens)) if (darkTokens[token] === lightValue) common.push([token, lightValue]);
|
|
1236
|
+
else light.push([token, lightValue]);
|
|
1237
|
+
for (const [token, darkValue] of Object.entries(darkTokens)) if (!(token in lightTokens)) dark.push([token, darkValue]);
|
|
1238
|
+
else if (lightTokens[token] !== darkValue) dark.push([token, darkValue]);
|
|
1239
|
+
const lightSelectors = [`${selector}[data-aeris-theme='light']`];
|
|
1240
|
+
const darkSelectors = [`${selector}[data-aeris-theme='dark']`];
|
|
1241
|
+
if (generation.defaultMode === "light" || generation.defaultMode === "system") lightSelectors.unshift(selector);
|
|
1242
|
+
else darkSelectors.unshift(selector);
|
|
1243
|
+
if (includeSystemMode) lightSelectors.push(`${selector}[data-aeris-theme='system']`);
|
|
1244
|
+
const rules = [
|
|
1245
|
+
formatRule([selector], common, void 0, options.minify ?? false),
|
|
1246
|
+
formatRule(lightSelectors, light, "light", options.minify ?? false),
|
|
1247
|
+
formatRule(darkSelectors, dark, "dark", options.minify ?? false)
|
|
1248
|
+
];
|
|
1249
|
+
if (includeSystemMode) {
|
|
1250
|
+
const systemSelectors = [`${selector}[data-aeris-theme='system']`];
|
|
1251
|
+
if (generation.defaultMode === "system") systemSelectors.unshift(`${selector}:not([data-aeris-theme])`);
|
|
1252
|
+
const systemRule = formatRule(systemSelectors, dark, "dark", options.minify ?? false);
|
|
1253
|
+
rules.push(formatMediaRule(systemRule, options.minify ?? false));
|
|
1254
|
+
}
|
|
1255
|
+
return finalizeCss(rules, options);
|
|
1312
1256
|
}
|
|
1313
1257
|
function finalizeCss(rules, options) {
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
return `${GENERATED_BANNER}\n${output}\n`;
|
|
1258
|
+
const minify = options.minify ?? false;
|
|
1259
|
+
const banner = options.banner ?? true;
|
|
1260
|
+
const output = rules.filter(Boolean).join(minify ? "" : "\n\n");
|
|
1261
|
+
if (minify || !banner) return `${output}${minify ? "" : "\n"}`;
|
|
1262
|
+
return `${GENERATED_BANNER}\n${output}\n`;
|
|
1320
1263
|
}
|
|
1321
1264
|
function resolveGenerationOptions(options) {
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
includeSystemMode,
|
|
1337
|
-
validateContrast,
|
|
1338
|
-
valid,
|
|
1339
|
-
message: !validSchemes
|
|
1340
|
-
? 'schemes must be "both", "light", or "dark".'
|
|
1341
|
-
: !validDefaultMode
|
|
1342
|
-
? 'defaultMode must be "system", "light", or "dark".'
|
|
1343
|
-
: schemes === 'both'
|
|
1344
|
-
? 'defaultMode="system" requires system-mode generation to be enabled.'
|
|
1345
|
-
: `defaultMode must be "${schemes}" when only the ${schemes} scheme is generated.`,
|
|
1346
|
-
};
|
|
1265
|
+
const schemes = options.schemes ?? "both";
|
|
1266
|
+
const validSchemes = schemes === "both" || schemes === "light" || schemes === "dark";
|
|
1267
|
+
const includeSystemMode = schemes === "both" && (options.includeSystemMode ?? true);
|
|
1268
|
+
const validateContrast = options.validateContrast ?? true;
|
|
1269
|
+
const defaultMode = options.defaultMode ?? (schemes === "both" ? includeSystemMode ? "system" : "light" : schemes);
|
|
1270
|
+
const validDefaultMode = defaultMode === "system" || defaultMode === "light" || defaultMode === "dark";
|
|
1271
|
+
return {
|
|
1272
|
+
schemes,
|
|
1273
|
+
defaultMode,
|
|
1274
|
+
includeSystemMode,
|
|
1275
|
+
validateContrast,
|
|
1276
|
+
valid: validSchemes && validDefaultMode && (schemes === "both" && (defaultMode !== "system" || includeSystemMode) || schemes === defaultMode),
|
|
1277
|
+
message: !validSchemes ? "schemes must be \"both\", \"light\", or \"dark\"." : !validDefaultMode ? "defaultMode must be \"system\", \"light\", or \"dark\"." : schemes === "both" ? "defaultMode=\"system\" requires system-mode generation to be enabled." : `defaultMode must be "${schemes}" when only the ${schemes} scheme is generated.`
|
|
1278
|
+
};
|
|
1347
1279
|
}
|
|
1348
1280
|
function formatRule(selectors, tokens, colorScheme, minify) {
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
return `${selectors.join(',')}{${declarations.join(';')}}`;
|
|
1357
|
-
}
|
|
1358
|
-
const declarations = [
|
|
1359
|
-
...(colorScheme ? [` color-scheme: ${colorScheme};`] : []),
|
|
1360
|
-
...tokens.map(([token, value]) => ` ${token}: ${value};`),
|
|
1361
|
-
];
|
|
1362
|
-
return `${selectors.join(',\n')} {\n${declarations.join('\n')}\n}`;
|
|
1281
|
+
if (!tokens.length && !colorScheme) return "";
|
|
1282
|
+
if (minify) {
|
|
1283
|
+
const declarations = [...colorScheme ? [`color-scheme:${colorScheme}`] : [], ...tokens.map(([token, value]) => `${token}:${value}`)];
|
|
1284
|
+
return `${selectors.join(",")}{${declarations.join(";")}}`;
|
|
1285
|
+
}
|
|
1286
|
+
const declarations = [...colorScheme ? [` color-scheme: ${colorScheme};`] : [], ...tokens.map(([token, value]) => ` ${token}: ${value};`)];
|
|
1287
|
+
return `${selectors.join(",\n")} {\n${declarations.join("\n")}\n}`;
|
|
1363
1288
|
}
|
|
1364
1289
|
function formatMediaRule(rule, minify) {
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
return `@media (prefers-color-scheme: dark) {\n${rule
|
|
1368
|
-
.split('\n')
|
|
1369
|
-
.map((line) => ` ${line}`)
|
|
1370
|
-
.join('\n')}\n}`;
|
|
1290
|
+
if (minify) return `@media(prefers-color-scheme:dark){${rule}}`;
|
|
1291
|
+
return `@media (prefers-color-scheme: dark) {\n${rule.split("\n").map((line) => ` ${line}`).join("\n")}\n}`;
|
|
1371
1292
|
}
|
|
1372
1293
|
function isSafeSelector(selector) {
|
|
1373
|
-
|
|
1294
|
+
return selector.length > 0 && !/[{},;\r\n]/.test(selector);
|
|
1374
1295
|
}
|
|
1375
1296
|
function isSafeCssValue$1(value) {
|
|
1376
|
-
|
|
1297
|
+
return value.length > 0 && !/[;{}\r\n]/.test(value);
|
|
1377
1298
|
}
|
|
1378
|
-
|
|
1379
1299
|
const SCHEME_COLOR_PROPERTIES = [
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1300
|
+
"accent",
|
|
1301
|
+
"page",
|
|
1302
|
+
"surface",
|
|
1303
|
+
"surface2",
|
|
1304
|
+
"surface3",
|
|
1305
|
+
"interactiveHover",
|
|
1306
|
+
"text",
|
|
1307
|
+
"text2",
|
|
1308
|
+
"text3",
|
|
1309
|
+
"border",
|
|
1310
|
+
"borderStrong",
|
|
1311
|
+
"focus"
|
|
1392
1312
|
];
|
|
1393
1313
|
const TONE_PROPERTIES = [
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1314
|
+
"base",
|
|
1315
|
+
"boundary",
|
|
1316
|
+
"hover",
|
|
1317
|
+
"active",
|
|
1318
|
+
"onBase",
|
|
1319
|
+
"onHover",
|
|
1320
|
+
"onActive",
|
|
1321
|
+
"text",
|
|
1322
|
+
"soft",
|
|
1323
|
+
"onSoft"
|
|
1404
1324
|
];
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
? `${check.guidance} Static analysis supports opaque HEX, RGB, and HSL colors; verify CSS variables, named colors, and newer color functions in their rendered context.`
|
|
1449
|
-
: check.guidance,
|
|
1450
|
-
});
|
|
1451
|
-
}
|
|
1452
|
-
}
|
|
1453
|
-
}
|
|
1454
|
-
const errors = issues.filter(({ severity }) => severity === 'error');
|
|
1455
|
-
const warnings = issues.filter(({ severity }) => severity === 'warning');
|
|
1456
|
-
return {
|
|
1457
|
-
status: errors.length ? 'error' : warnings.length ? 'warning' : 'valid',
|
|
1458
|
-
valid: errors.length === 0,
|
|
1459
|
-
issues,
|
|
1460
|
-
errors,
|
|
1461
|
-
warnings,
|
|
1462
|
-
};
|
|
1325
|
+
function validateAerisTheme(themeOverride) {
|
|
1326
|
+
const theme = resolveAerisTheme(themeOverride);
|
|
1327
|
+
const issues = [];
|
|
1328
|
+
validateThemeSelection(theme, issues);
|
|
1329
|
+
const values = collectThemeCssValues(theme);
|
|
1330
|
+
let canAuditColors = true;
|
|
1331
|
+
for (const entry of values) {
|
|
1332
|
+
if (isSafeCssValue(entry.value)) continue;
|
|
1333
|
+
if (entry.affectsColorResolution) canAuditColors = false;
|
|
1334
|
+
issues.push({
|
|
1335
|
+
code: "invalid-css-value",
|
|
1336
|
+
severity: "error",
|
|
1337
|
+
path: entry.path,
|
|
1338
|
+
message: `${entry.path} must be a non-empty CSS value without braces, semicolons, or line breaks.`,
|
|
1339
|
+
guidance: "Replace it with a valid CSS color, length, radius, or shadow value."
|
|
1340
|
+
});
|
|
1341
|
+
}
|
|
1342
|
+
if (canAuditColors) for (const mode of ["light", "dark"]) {
|
|
1343
|
+
const contrast = auditAerisThemeContrast(theme, mode);
|
|
1344
|
+
for (const check of contrast.checks) {
|
|
1345
|
+
if (check.status === "pass") continue;
|
|
1346
|
+
const unresolved = check.status === "unresolved";
|
|
1347
|
+
issues.push({
|
|
1348
|
+
code: unresolved ? "contrast-unresolved" : "contrast-failed",
|
|
1349
|
+
severity: unresolved ? "warning" : "error",
|
|
1350
|
+
mode,
|
|
1351
|
+
path: `contrast.${mode}.${check.id}`,
|
|
1352
|
+
ratio: check.ratio,
|
|
1353
|
+
requiredRatio: check.requiredRatio,
|
|
1354
|
+
message: unresolved ? `${check.label} could not be evaluated from static colors.` : `${check.label} is ${check.ratio?.toFixed(2)}:1; WCAG ${check.criterion} requires ${check.requiredRatio}:1.`,
|
|
1355
|
+
guidance: unresolved ? `${check.guidance} Static analysis supports opaque HEX, RGB, and HSL colors; verify CSS variables, named colors, and newer color functions in their rendered context.` : check.guidance
|
|
1356
|
+
});
|
|
1357
|
+
}
|
|
1358
|
+
}
|
|
1359
|
+
const errors = issues.filter(({ severity }) => severity === "error");
|
|
1360
|
+
const warnings = issues.filter(({ severity }) => severity === "warning");
|
|
1361
|
+
return {
|
|
1362
|
+
status: errors.length ? "error" : warnings.length ? "warning" : "valid",
|
|
1363
|
+
valid: errors.length === 0,
|
|
1364
|
+
issues,
|
|
1365
|
+
errors,
|
|
1366
|
+
warnings
|
|
1367
|
+
};
|
|
1463
1368
|
}
|
|
1464
1369
|
function validateThemeSelection(theme, issues) {
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
severity: 'error',
|
|
1487
|
-
path: 'radius',
|
|
1488
|
-
message: `The selected radius "${theme.radius}" is not registered in theme.radii.`,
|
|
1489
|
-
guidance: 'Select a built-in corner style or register a radius scale with the same name.',
|
|
1490
|
-
});
|
|
1491
|
-
}
|
|
1370
|
+
if (theme.direction !== void 0 && theme.direction !== "ltr" && theme.direction !== "rtl") issues.push({
|
|
1371
|
+
code: "invalid-direction",
|
|
1372
|
+
severity: "error",
|
|
1373
|
+
path: "direction",
|
|
1374
|
+
message: `direction must be "ltr" or "rtl"; received "${String(theme.direction)}".`,
|
|
1375
|
+
guidance: "Use ltr for left-to-right content or rtl for right-to-left content."
|
|
1376
|
+
});
|
|
1377
|
+
if (!theme.densities[theme.density]) issues.push({
|
|
1378
|
+
code: "missing-density",
|
|
1379
|
+
severity: "error",
|
|
1380
|
+
path: "density",
|
|
1381
|
+
message: `The selected density "${theme.density}" is not registered in theme.densities.`,
|
|
1382
|
+
guidance: "Select a built-in density or register a scale with the same name."
|
|
1383
|
+
});
|
|
1384
|
+
if (!theme.radii[theme.radius]) issues.push({
|
|
1385
|
+
code: "missing-radius",
|
|
1386
|
+
severity: "error",
|
|
1387
|
+
path: "radius",
|
|
1388
|
+
message: `The selected radius "${theme.radius}" is not registered in theme.radii.`,
|
|
1389
|
+
guidance: "Select a built-in corner style or register a radius scale with the same name."
|
|
1390
|
+
});
|
|
1492
1391
|
}
|
|
1493
1392
|
function collectThemeCssValues(theme) {
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
for (const [name, scale] of Object.entries(theme.radii)) {
|
|
1536
|
-
if (!isRecord(scale)) {
|
|
1537
|
-
values.push(cssValue(`radii.${name}`, scale, false));
|
|
1538
|
-
continue;
|
|
1539
|
-
}
|
|
1540
|
-
for (const [property, value] of Object.entries(scale)) {
|
|
1541
|
-
values.push(cssValue(`radii.${name}.${property}`, value, false));
|
|
1542
|
-
}
|
|
1543
|
-
}
|
|
1544
|
-
return values;
|
|
1393
|
+
const values = [
|
|
1394
|
+
cssValue("palette.surface", theme.palette.surface, true),
|
|
1395
|
+
cssValue("palette.primary", theme.palette.primary, true),
|
|
1396
|
+
cssValue("palette.secondary", theme.palette.secondary, true),
|
|
1397
|
+
cssValue("palette.accent", theme.palette.accent, true),
|
|
1398
|
+
cssValue("palette.contrast", theme.palette.contrast, true)
|
|
1399
|
+
];
|
|
1400
|
+
for (const mode of ["light", "dark"]) {
|
|
1401
|
+
const scheme = theme[mode];
|
|
1402
|
+
for (const property of SCHEME_COLOR_PROPERTIES) {
|
|
1403
|
+
const value = scheme[property];
|
|
1404
|
+
if (value !== void 0) values.push(cssValue(`${mode}.${property}`, value, true));
|
|
1405
|
+
}
|
|
1406
|
+
if (scheme.shadowXs !== void 0) values.push(cssValue(`${mode}.shadowXs`, scheme.shadowXs, false));
|
|
1407
|
+
if (scheme.shadowSm !== void 0) values.push(cssValue(`${mode}.shadowSm`, scheme.shadowSm, false));
|
|
1408
|
+
if (scheme.shadowMd !== void 0) values.push(cssValue(`${mode}.shadowMd`, scheme.shadowMd, false));
|
|
1409
|
+
if (scheme.shadowLg !== void 0) values.push(cssValue(`${mode}.shadowLg`, scheme.shadowLg, false));
|
|
1410
|
+
for (const toneName of AERIS_SEMANTIC_TONE_NAMES) {
|
|
1411
|
+
const tone = scheme.tones?.[toneName];
|
|
1412
|
+
if (!tone) continue;
|
|
1413
|
+
for (const property of TONE_PROPERTIES) {
|
|
1414
|
+
const value = tone[property];
|
|
1415
|
+
if (value !== void 0) values.push(cssValue(`${mode}.tones.${toneName}.${property}`, value, true));
|
|
1416
|
+
}
|
|
1417
|
+
}
|
|
1418
|
+
}
|
|
1419
|
+
for (const [name, scale] of Object.entries(theme.densities)) {
|
|
1420
|
+
if (!isRecord(scale)) {
|
|
1421
|
+
values.push(cssValue(`densities.${name}`, scale, false));
|
|
1422
|
+
continue;
|
|
1423
|
+
}
|
|
1424
|
+
for (const [property, value] of Object.entries(scale)) values.push(cssValue(`densities.${name}.${property}`, value, false));
|
|
1425
|
+
}
|
|
1426
|
+
for (const [name, scale] of Object.entries(theme.radii)) {
|
|
1427
|
+
if (!isRecord(scale)) {
|
|
1428
|
+
values.push(cssValue(`radii.${name}`, scale, false));
|
|
1429
|
+
continue;
|
|
1430
|
+
}
|
|
1431
|
+
for (const [property, value] of Object.entries(scale)) values.push(cssValue(`radii.${name}.${property}`, value, false));
|
|
1432
|
+
}
|
|
1433
|
+
return values;
|
|
1545
1434
|
}
|
|
1546
1435
|
function cssValue(path, value, affectsColorResolution) {
|
|
1547
|
-
|
|
1436
|
+
return {
|
|
1437
|
+
path,
|
|
1438
|
+
value,
|
|
1439
|
+
affectsColorResolution
|
|
1440
|
+
};
|
|
1548
1441
|
}
|
|
1549
1442
|
function isSafeCssValue(value) {
|
|
1550
|
-
|
|
1443
|
+
return typeof value === "string" && value.trim().length > 0 && !/[;{}\r\n]/.test(value);
|
|
1551
1444
|
}
|
|
1552
1445
|
function isRecord(value) {
|
|
1553
|
-
|
|
1446
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
1554
1447
|
}
|
|
1555
|
-
|
|
1556
|
-
/**
|
|
1557
|
-
* Framework-independent Aeris theme compiler APIs for Node.js build scripts and browser tooling.
|
|
1558
|
-
*/
|
|
1559
|
-
|
|
1560
|
-
/**
|
|
1561
|
-
* Generated bundle index. Do not edit.
|
|
1562
|
-
*/
|
|
1563
|
-
|
|
1564
1448
|
export { AERIS_COLOR_DERIVATION_VERSION, AERIS_DEFAULT_THEME, AERIS_DENSITY_PRESETS, AERIS_RADIUS_PRESETS, AERIS_SEMANTIC_TONE_NAMES, AERIS_THEME_PRESETS, AerisThemeGenerationError, aerisContrastRatio, aerisRgbContrastRatio, auditAerisThemeContrast, compileAerisTheme, formatAerisHex, generateAerisThemeCss, mergeAerisTheme, mixAerisColor, mixAerisRgb, parseAerisColor, resolveAerisDensity, resolveAerisFoundation, resolveAerisRadius, resolveAerisSemanticTones, resolveAerisTheme, resolveAerisThemeTokens, validateAerisTheme };
|
|
1565
|
-
|
|
1449
|
+
|
|
1450
|
+
//# sourceMappingURL=aeris-ui-core-theme-builder.mjs.map
|