Skip to content

Commit 7c97220

Browse files
committed
Replace WikimediaUI Base with Codex design tokens
This patch replaces the WikimediaUI Base library with the new Codex design tokens library. The new library is mostly a drop-in replacement for the old one. But there are deprecated variable names (token keys) that need to be adapted to the new ones. See https://gerrit.wikimedia.org/r/plugins/gitiles/design/codex/+/refs/heads/main/packages/codex-design-tokens/src/deprecated-aliases-wikimedia-ui-base.json for the full list of deprecated names with equal values. Replacing also a number of static values mainly on properties, where most other occurrences had already majority of variable usage. See `font-weight` for example. Please note that the only minor “step back” (to static values) is the replacement of very few static background colors that are going to be added to Codex in one of the following releases. Also note, that `color-subtle` was agreed on by systems designers to carry darker `#54595d` value. For now approaching it by direct replacement as the predecessor wasn't used in prominent places. We can work in a separate patch if a 1:1 value variable were greatly desired. Lastly adding a small margin in label elements to make the checkboxes easier targetable. Bug: T331403 Bug: T334934 Change-Id: I102a641725a89a92a50f5f72c5033c8200aa4e45
1 parent b80322f commit 7c97220

File tree

6 files changed

+357
-354
lines changed

6 files changed

+357
-354
lines changed

docs/demo/index.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<html lang="en">
33
<meta charset="utf-8">
44
<title>CSSJanus Live demos</title>
5-
<link rel="stylesheet" href="../lib/wikimedia-ui-base-0.19.0.css">
5+
<link rel="stylesheet" href="../lib/codex-design-tokens/theme-wikimedia-ui-1.0.0.css">
66
<link rel="stylesheet" href="../site.css">
77
<link rel="icon" href="../favicon.svg">
88
<style id="css">
@@ -26,13 +26,13 @@
2626
section h3 {
2727
font-size: 2.4rem;
2828
padding-bottom: 2px;
29-
border-bottom: 3px solid var( --wmui-color-base80 );
29+
border-bottom: 3px solid var( --cssjanus-border-color-soft );
3030
}
3131

3232
.well {
33-
background: var( --wmui-color-base90 );
34-
border: 1px solid var( --wmui-color-base80 );
35-
border-radius: 2px;
33+
background: var( --cssjanus-background-color-neutral-subtle );
34+
border: 1px solid var( --cssjanus-border-color-soft );
35+
border-radius: var( --border-radius-base );
3636
padding: 1rem;
3737
margin: 0 0 1rem 0;
3838
}

docs/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<html lang="en">
33
<meta charset="utf-8">
44
<title>CSSJanus</title>
5-
<link rel="stylesheet" href="./lib/wikimedia-ui-base-0.19.0.css">
5+
<link rel="stylesheet" href="./lib/codex-design-tokens/theme-wikimedia-ui-1.0.0.css">
66
<link rel="stylesheet" href="./site.css">
77
<link rel="icon" href="./favicon.svg">
88

Lines changed: 312 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,312 @@
1+
/**
2+
* Do not edit directly
3+
* Generated on Tue, 24 Oct 2023 19:12:13 GMT
4+
*/
5+
6+
:root {
7+
--font-size-base: 16px;
8+
--font-size-x-small: 0.75em; /* `x` stands for extra. In this case extra small. */
9+
--font-size-small: 0.875em;
10+
--font-size-medium: 1em;
11+
--font-size-large: 1.125em;
12+
--font-size-x-large: 1.25em;
13+
--font-size-xx-large: 1.5em;
14+
--font-size-xxx-large: 1.75em;
15+
--accent-color-base: #36c;
16+
--background-color-base: #fff;
17+
--background-color-interactive: #eaecf0;
18+
--background-color-interactive-subtle: #f8f9fa;
19+
--background-color-disabled: #c8ccd1; /* Components like Buttons, Checkboxes, Radios, ProgressBars…. */
20+
--background-color-disabled-subtle: #eaecf0; /* Components like TextInputs, Selects…. */
21+
--background-color-progressive: #36c;
22+
--background-color-progressive--hover: #447ff5;
23+
--background-color-progressive--active: #2a4b8d;
24+
--background-color-progressive--focus: #36c;
25+
--background-color-progressive-subtle: #eaf3ff;
26+
--background-color-destructive: #d73333;
27+
--background-color-destructive--hover: #ff4242;
28+
--background-color-destructive--active: #b32424;
29+
--background-color-destructive--focus: #d73333;
30+
--background-color-destructive-subtle: #fee7e6;
31+
--background-color-error: #d73333;
32+
--background-color-error--hover: #ff4242;
33+
--background-color-error--active: #b32424;
34+
--background-color-error-subtle: #fee7e6;
35+
--background-color-warning-subtle: #fef6e7;
36+
--background-color-success-subtle: #d5fdf4;
37+
--background-color-notice-subtle: #eaecf0;
38+
--background-color-backdrop-light: rgba( 255, 255, 255, 0.65 ); /* Backdrop is the term used by CSS Fullscreen API and is used to dim the background when a modal Dialog is open. Also known as overlay mask. */
39+
--background-color-backdrop-dark: rgba( 0, 0, 0, 0.65 );
40+
--background-color-transparent: rgba( 255, 255, 255, 0 );
41+
--background-color-button-quiet--hover: rgba( 0, 24, 73, 0.027 );
42+
--background-color-button-quiet--active: rgba( 0, 24, 73, 0.082 );
43+
--background-color-input-binary--checked: #36c;
44+
--color-base: #202122;
45+
--color-base--hover: #404244; /* Aimed to be replaced by `color.gray600` in future. */
46+
--color-emphasized: #000;
47+
--color-subtle: #54595d;
48+
--color-placeholder: #72777d;
49+
--color-disabled: #72777d;
50+
--color-inverted: #fff;
51+
--color-progressive: #36c; /* 'Progressive' Color and states */
52+
--color-progressive--hover: #447ff5;
53+
--color-progressive--active: #2a4b8d;
54+
--color-progressive--focus: #36c;
55+
--color-destructive: #d73333; /* 'Destructive' Color and states */
56+
--color-destructive--hover: #ff4242;
57+
--color-destructive--active: #b32424;
58+
--color-destructive--focus: #d73333;
59+
--color-visited: #6b4ba1; /* 'Visited' color. In combination with progressive. Used for default links. */
60+
--color-error: #d73333;
61+
--color-warning: #edab00; /* Note, this is only meant for warning icon for contrast reasons. */
62+
--color-success: #14866d; /* Note, this needs to use a tone darker than Red and Yellow for contrast reasons with background White. */
63+
--color-notice: #202122;
64+
--color-link-red: #d73333; /* Red ('new') Link color and states */
65+
--color-link-red--hover: #ff4242;
66+
--color-link-red--active: #b32424;
67+
--color-link-red--focus: #d73333;
68+
--color-link-red--visited: #a55858;
69+
--opacity-base: 1;
70+
--opacity-medium: 0.65;
71+
--opacity-low: 0.3;
72+
--opacity-transparent: 0;
73+
--opacity-icon-base: 0.87;
74+
--opacity-icon-base--hover: 0.74;
75+
--opacity-icon-base--selected: 1;
76+
--opacity-icon-base--disabled: 0.51;
77+
--opacity-icon-placeholder: 0.51;
78+
--opacity-icon-subtle: 0.67;
79+
--background-position-base: center;
80+
--background-size-search-figure: cover; /* Use in TypeaheadSearch and Thumbnail components for the thumb container. */
81+
--z-index-bottom: -100; /* Use descriptive `z-index` tokens for layout purposes. */
82+
--z-index-base: 0;
83+
--z-index-above-content: 1;
84+
--z-index-toolbar: 2;
85+
--z-index-dropdown: 50;
86+
--z-index-sticky: 100;
87+
--z-index-fixed: 200;
88+
--z-index-off-canvas-backdrop: 300;
89+
--z-index-off-canvas: 350;
90+
--z-index-overlay-backdrop: 400;
91+
--z-index-overlay: 450;
92+
--z-index-tooltip: 800;
93+
--z-index-toast-notification: 900;
94+
--z-index-top: 9999;
95+
--z-index-stacking-0: 0; /* Use stacking-specific z-index tokens inside components to layer individual elements. */
96+
--z-index-stacking-1: 1;
97+
--z-index-stacking-2: 2;
98+
--z-index-stacking-3: 3;
99+
--box-sizing-base: border-box;
100+
--min-size-interactive-pointer: 32px;
101+
--min-size-interactive-touch: 44px;
102+
--min-size-search-figure: 40px; /* Alias for use in TypeaheadSearch and Thumbnail components for the same purpose and for better code readability. */
103+
--min-size-icon-x-small: 12px;
104+
--min-size-icon-small: 16px;
105+
--min-size-icon-medium: 20px;
106+
--min-size-input-binary: 20px;
107+
--min-size-toggle-switch-grip: 20px;
108+
--size-0: 0;
109+
--size-6: 0.0625em;
110+
--size-12: 0.125em;
111+
--size-25: 0.25em;
112+
--size-50: 0.5em;
113+
--size-75: 0.75em;
114+
--size-100: 1em;
115+
--size-125: 1.25em;
116+
--size-150: 1.5em;
117+
--size-200: 2em;
118+
--size-250: 2.5em;
119+
--size-275: 2.75em;
120+
--size-300: 3em;
121+
--size-400: 4em;
122+
--size-800: 8em;
123+
--size-1600: 16em;
124+
--size-2400: 24em;
125+
--size-2800: 28em;
126+
--size-3200: 32em;
127+
--size-5600: 56em;
128+
--size-absolute-1: 1px;
129+
--size-absolute-9999: 9999px;
130+
--size-third: 33.33%;
131+
--size-half: 50%;
132+
--size-full: 100%;
133+
--size-double: 200%;
134+
--size-viewport-width-full: 100vw;
135+
--size-viewport-height-full: 100vh;
136+
--size-search-figure: 2.5em; /* Alias for use in TypeaheadSearch and Thumbnail components for the same purpose and for better code readability. */
137+
--size-icon-x-small: 0.75em;
138+
--size-icon-small: 1em;
139+
--size-icon-medium: 1.25em;
140+
--min-width-medium: 256px;
141+
--min-width-breakpoint-mobile: 320px; /* A mobile device's minimum available screen width. Many older feature phones have screens smaller than this value. */
142+
--min-width-breakpoint-tablet: 640px; /* A tablet device's minimum available screen width. Note: the size chosen is eager to be re-evaluated with Web team and Product Analytics. */
143+
--min-width-breakpoint-desktop: 1120px; /* A desktop device's minimum available screen width. */
144+
--min-width-breakpoint-desktop-wide: 1680px; /* A wider desktop's minimum available screen width. */
145+
--min-width-toggle-switch: 48px;
146+
--max-width-base: none;
147+
--max-width-breakpoint-mobile: calc( 640px - 1px ); /* A mobile device's maximum available screen width. Many older feature phones have screens smaller than this value. */
148+
--max-width-breakpoint-tablet: calc( 1120px - 1px ); /* A tablet device's maximum available screen width. Note, the size chosen is eager to be re-evaluated with Web team and Product Analytics. */
149+
--max-width-breakpoint-desktop: calc( 1680px - 1px ); /* A desktop device's maximum available screen width. */
150+
--max-width-button: 28em; /* Note, that this is a slight amendment from WikimediaUI Base from `28.75em` = `460px` to `448px` – `dimension.2800` */
151+
--position-offset-border-width-base: -1px;
152+
--position-offset-input-radio--focus: -0.25em;
153+
--spacing-0: 0;
154+
--spacing-12: 2px;
155+
--spacing-25: 4px;
156+
--spacing-30: 5px; /* This token is an exception to the scale. Used as vertical `padding` in inputs and controls to achieve the default 32px component height. */
157+
--spacing-35: 6px; /* This token is an exception to the scale. Used as `padding` of the ToggleSwitch component. */
158+
--spacing-50: 8px;
159+
--spacing-75: 12px;
160+
--spacing-100: 16px;
161+
--spacing-125: 20px;
162+
--spacing-150: 24px;
163+
--spacing-200: 32px;
164+
--spacing-250: 40px;
165+
--spacing-300: 48px;
166+
--spacing-400: 64px;
167+
--spacing-half: 50%; /* From here on, spacing tokens which are used for positioning values. */
168+
--spacing-full: 100%;
169+
--spacing-horizontal-button: 12px - 1px; /* Padding should equal 12px of spacing minus the width of the border */
170+
--spacing-horizontal-button-icon-only: 6px - 1px; /* Padding should equal 6px of spacing minus the width of the border */
171+
--spacing-horizontal-button-large: 16px - 1px; /* Padding should equal 16px of spacing minus the width of the border */
172+
--spacing-horizontal-input-text-two-end-icons: calc( 8px * 2 + 1em ); /* Rely on `calc()` to make token output usable in all formats. When there are two end icons, (i.e. a clear icon and an end icon), we need to double the horizontal padding and account for the size of the extra icon. This token can be used to calculate the horizontal position of the clear icon and the padding-end of the text input. */
173+
--spacing-start-typeahead-search-figure: 12px; /* The amount of space between the TypeaheadSearch figure's parent component and the TypeaheadSearch figure (input icon container, search result thumbnail, and footer icon container). We want this space to be uniform so that the figures vertically line up nicely. We use the same horizontal padding as the MenuItem. */
174+
--spacing-start-typeahead-search-icon: calc( 12px + ( 40px - 20px ) / 2 ); /* The padding required for the icon to center align with the menu item thumbnail. We calculate the difference in size and add it to the expected spacing. */
175+
--spacing-typeahead-search-focus-addition: calc( ( 12px + 40px ) - ( 20px + 8px ) ); /* The amount the width of the input increases when it is focused to allow for the extra spacing around the search figures. The caret position should remain static. This calculates the padding-left of the input when expanded minus the padding-left of the input when not expanded. (Note that both padding values actually include `@spacing-50` as well, but it was left out of the calculation for simplicity's sake.) */
176+
--border-width-base: 1px;
177+
--border-width-thick: 2px;
178+
--border-width-input-radio--checked: 6px;
179+
--border-style-base: solid;
180+
--border-style-dashed: dashed;
181+
--border-color-base: #a2a9b1;
182+
--border-color-interactive: #72777d;
183+
--border-color-subtle: #c8ccd1;
184+
--border-color-disabled: #c8ccd1;
185+
--border-color-inverted: #fff;
186+
--border-color-progressive: #36c;
187+
--border-color-progressive--hover: #447ff5;
188+
--border-color-progressive--active: #2a4b8d;
189+
--border-color-progressive--focus: #36c;
190+
--border-color-destructive: #d73333;
191+
--border-color-destructive--hover: #ff4242;
192+
--border-color-destructive--active: #b32424;
193+
--border-color-destructive--focus: #d73333;
194+
--border-color-error: #b32424;
195+
--border-color-error--hover: #ff4242;
196+
--border-color-warning: #ac6600;
197+
--border-color-success: #096450;
198+
--border-color-notice: #54595d;
199+
--border-color-transparent: transparent;
200+
--border-color-divider: #a2a9b1;
201+
--border-color-input--hover: #72777d;
202+
--border-color-input-binary: #72777d;
203+
--border-color-input-binary--hover: #447ff5;
204+
--border-color-input-binary--active: #2a4b8d;
205+
--border-color-input-binary--focus: #36c;
206+
--border-color-input-binary--checked: #36c;
207+
--border-base: 1px solid #a2a9b1;
208+
--border-subtle: 1px solid #c8ccd1;
209+
--border-progressive: 1px solid #36c;
210+
--border-destructive: 1px solid #d73333;
211+
--border-radius-base: 2px;
212+
--border-radius-sharp: 0;
213+
--border-radius-pill: 9999px;
214+
--border-radius-circle: 50%; /* Use `50%` for circle or ellipsis. See https://stackoverflow.com/a/29966500 */
215+
--box-shadow-drop-small: 0 1px 1px rgba( 0, 0, 0, 0.2 ); /* This features color as part of the theme token value. */
216+
--box-shadow-drop-medium: 0 2px 2px 0 rgba( 0, 0, 0, 0.2 ); /* This features color as part of the theme token value. */
217+
--box-shadow-drop-xx-large: 0 20px 48px 0 rgba( 0, 0, 0, 0.2 ); /* This features color as part of the theme token value. */
218+
--box-shadow-inset-small: inset 0 0 0 1px;
219+
--box-shadow-inset-medium: inset 0 0 0 2px;
220+
--box-shadow-inset-medium-vertical: inset 0 -2px 0 0;
221+
--box-shadow-outset-small: 0 0 0 1px;
222+
--box-shadow-outset-small-top: 0 -1px 0 0;
223+
--box-shadow-outset-small-start: -1px 0 0 0;
224+
--box-shadow-color-base: #000;
225+
--box-shadow-color-progressive--active: #2a4b8d;
226+
--box-shadow-color-progressive--focus: #36c;
227+
--box-shadow-color-progressive-selected: #36c;
228+
--box-shadow-color-progressive-selected--hover: #447ff5;
229+
--box-shadow-color-progressive-selected--active: #2a4b8d;
230+
--box-shadow-color-destructive--focus: #d73333;
231+
--box-shadow-color-inverted: #fff;
232+
--box-shadow-color-transparent: transparent;
233+
--outline-base--focus: 1px solid transparent; /* Enable Windows high contrast mode on certain widgets, that have default outlines overridden. */
234+
--outline-color-progressive--focus: #36c; /* Use in places where no more customized focus styles are provided, for example on generic `:focus`. */
235+
--font-family-base: sans-serif; /* Reference Vector's default fallback sans instead of the deprecated value `font-family-sans` in WikimediaUI Base. */
236+
--font-family-system-sans: -apple-system, 'BlinkMacSystemFont', 'Segoe UI', 'Roboto', 'Inter', 'Helvetica', 'Arial', sans-serif;
237+
--font-family-sans--fallback: sans-serif;
238+
--font-family-serif: 'Linux Libertine', 'Georgia', 'Times', 'Source Serif Pro', serif;
239+
--font-family-serif--fallback: serif;
240+
--font-family-monospace: 'Menlo', 'Consolas', 'Liberation Mono', 'Fira Code', 'Courier New', monospace;
241+
--font-family-monospace--fallback: monospace, monospace;
242+
--font-family-heading-main: 'Linux Libertine', 'Georgia', 'Times', 'Source Serif Pro', serif; /* Legacy value from WikimediaUI Base. Use for first heading special treatment. */
243+
--font-weight-hairline: 100;
244+
--font-weight-light: 300;
245+
--font-weight-normal: 400;
246+
--font-weight-semi-bold: 600;
247+
--font-weight-bold: 700;
248+
--line-height-xxx-small: 1.25; /* `x` stands for extra. In this case extra-extra-extra small. */
249+
--line-height-xx-small: 1.375;
250+
--line-height-small: 1.5714285;
251+
--line-height-medium: 1.6;
252+
--text-decoration-none: none;
253+
--text-decoration-line-through: line-through;
254+
--text-decoration-underline: underline;
255+
--text-overflow-clip: clip;
256+
--text-overflow-ellipsis: ellipsis;
257+
--tab-size-base: 4;
258+
--transition-duration-base: 100ms;
259+
--transition-duration-medium: 250ms;
260+
--transition-timing-function-system: ease;
261+
--transition-timing-function-user: ease-out;
262+
--transition-property-base: background-color, color, border-color, box-shadow;
263+
--transition-property-fade: opacity;
264+
--transition-property-icon: color;
265+
--transition-property-icon-css-only: background-color;
266+
--transition-property-toggle-switch-grip: background-color, border-color, transform;
267+
--animation-delay-none: 0ms;
268+
--animation-delay-medium: -160ms;
269+
--animation-delay-slow: -330ms;
270+
--animation-duration-medium: 1600ms;
271+
--animation-duration-slow: 2000ms;
272+
--animation-timing-function-base: linear;
273+
--animation-timing-function-bouncing: ease-in-out;
274+
--animation-iteration-count-base: infinite;
275+
--cursor-base: default;
276+
--cursor-base--disabled: default;
277+
--cursor-base--hover: pointer;
278+
--cursor-grab: grab;
279+
--cursor-grabbing: grabbing;
280+
--cursor-help: help;
281+
--cursor-move: move;
282+
--cursor-not-allowed: not-allowed;
283+
--cursor-resize-nesw: nesw-resize;
284+
--cursor-resize-nwse: nwse-resize;
285+
--cursor-text: text;
286+
--cursor-zoom-in: zoom-in;
287+
--cursor-zoom-out: zoom-out;
288+
--unit-absolute: px;
289+
--unit-relative: em;
290+
--background-image-input-checkbox--checked: url( 'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20"><path fill="%23fff" d="M7 14.17L2.83 10l-1.41 1.41L7 17 19 5l-1.41-1.42z"/></svg>' );
291+
--min-height-text-area: 64px;
292+
293+
/* DEPRECATED TOKENS */
294+
/* Warning: the following token name is deprecated (No replacement for this token. Only used in non-Codex products and design decision is to need to rely on background for this state.) */
295+
--background-color-primary--hover: rgba( 51, 102, 204, 0.1 );
296+
/* Warning: the following token name is deprecated (Use `color-subtle` instead. Note, that `color-subtle` is using `color.gray600` instead of `color.gray500` now.) */
297+
--color-base--subtle: #72777d;
298+
/* Warning: the following token name is deprecated, use min-width-breakpoint-mobile instead. (Legacy breakpoint. Use `min-width`/`max-width` breakpoint token instead. A mobile device's screen width. Many older feature phones have screens smaller than this value.) */
299+
--width-breakpoint-mobile: 320px;
300+
/* Warning: the following token name is deprecated (Legacy breakpoint. Use `min-width`/`max-width` breakpoint token instead. A tablet device's screen width.) */
301+
--width-breakpoint-tablet: 720px;
302+
/* Warning: the following token name is deprecated (Legacy breakpoint. Use `min-width`/`max-width` breakpoint token instead. A desktop device's screen width.) */
303+
--width-breakpoint-desktop: 1000px;
304+
/* Warning: the following token name is deprecated (Legacy breakpoint. Use `min-width`/`max-width` breakpoint token instead. A wider desktop's screen width.) */
305+
--width-breakpoint-desktop-wide: 1200px;
306+
/* Warning: the following token name is deprecated (Legacy breakpoint. Use `min-width`/`max-width` breakpoint token instead. An extra wide desktop's screen width.) */
307+
--width-breakpoint-desktop-extrawide: 2000px;
308+
/* Warning: the following token name is deprecated (Use `font-family-sans--fallback` instead. See T247166.) */
309+
--font-family-sans: 'Helvetica Neue', 'Helvetica', 'Liberation Sans', 'Arial', sans-serif;
310+
/* Warning: the following token name is deprecated (Legacy line-height. Use `line-height-small` instead.) */
311+
--line-height-x-small: 1.4285714;
312+
}

0 commit comments

Comments
 (0)