bereg-ds 1.1.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,7 +3,19 @@
3
3
  All notable changes to this project are documented here. The project follows [Semantic Versioning](https://semver.org/):
4
4
  a breaking change to a token name, a class name or a component prop is a major version.
5
5
 
6
- ## 1.1.0 (unreleased)
6
+ ## 1.2.0 (unreleased)
7
+
8
+ - Fonts: own woff2 files in `bereg-ds/fonts/` instead of the Fontsource packages (now dev dependencies only, used by
9
+ `scripts/build-fonts.py`). Hinting removed, Sans weight axis limited to 300 to 700. Subsets latin, latin-ext and cyrillic
10
+ (same `unicode-range` as before); Greek, Vietnamese and Cyrillic Extended dropped, they fall back to the system font.
11
+ Same family names and fallbacks. Latin files: Sans 45.7 → 38.5 KB, Mono 14.7 → 10.1 KB. OFL license in `bereg-ds/fonts/OFL.txt`.
12
+ New export `bereg-ds/fonts/*`; README shows how to preload the Latin Sans file.
13
+ - `.text-h1-subtitle` is fluid: `clamp(--font-size-lg, 0.75rem + 1.6vw, --font-size-2xl)`, 20px on phones, 30px on desktop.
14
+ - `.subhead` right after `.section-head` has no top margin (was an extra 32px).
15
+ - Card focus: the card-wide ring (and hiding the title link ring) only inside `@supports selector(:has(*))`.
16
+ Browsers without `:has()` keep the link's own focus ring; before, they showed no focus at all.
17
+
18
+ ## 1.1.0 (2026-11-18)
7
19
 
8
20
  - Optional light theme: `bereg-ds/theme-light.css` (not part of `bereg-ds.css`). Follows `prefers-color-scheme`
9
21
  unless `<html data-theme="light|dark">` is set. Text contrast 7:1 or more, interactive borders 3:1 or more.
package/README.md CHANGED
@@ -15,7 +15,7 @@ Design tokens, CSS components and React components from one source.
15
15
  npm i bereg-ds
16
16
  ```
17
17
 
18
- IBM Plex Sans and Mono come with it (self-hosted through Fontsource, no Google Fonts).
18
+ IBM Plex Sans and Mono come with it: self-hosted woff2 files in `bereg-ds/fonts/`, no Google Fonts, no extra dependencies.
19
19
 
20
20
  ## Use with CSS (any project: Astro, plain HTML, Vue...)
21
21
 
@@ -39,13 +39,41 @@ Import only what you need:
39
39
 
40
40
  | File | What |
41
41
  |---|---|
42
- | `bereg-ds/fonts.css` | IBM Plex Sans (variable) and Mono 400, metric-matched fallbacks |
42
+ | `bereg-ds/fonts.css` | IBM Plex Sans (variable, 300 to 700) and Mono 400, metric-matched fallbacks |
43
43
  | `bereg-ds/tokens.css` | CSS variables: colors, spacing, radii, type scale, motion |
44
44
  | `bereg-ds/base.css` | Page defaults, headings, text-style classes (`.text-h1`, `.text-meta`...), `.blueprint` grid |
45
45
  | `bereg-ds/components.css` | Components: `.btn`, `.card`, `.quote`, `.tag`, `.filter-tab`, `.section-head`, `.subhead`, `.facts`, `.timeline`, `.posts`, `.book-promo`, `.site-header`, `.site-footer`, `.prose`, `.wrap` |
46
46
  | `bereg-ds/hdr.css` | Optional HDR accents (`.hdr-logo`, `.hdr-card`) |
47
47
  | `bereg-ds/theme-light.css` | Optional light theme (see below) |
48
48
 
49
+ ## Fonts
50
+
51
+ `fonts.css` links the font files with relative URLs (`../fonts/*.woff2`), so bundlers (Vite, Astro, webpack) copy them as assets.
52
+ Subsets: latin, latin-ext, cyrillic. Each is a separate file with its own `unicode-range`: a page in English loads only the Latin files.
53
+ Other scripts (Greek, Vietnamese...) fall back to the system font.
54
+
55
+ | Font | Weights | Latin file |
56
+ |---|---|---|
57
+ | IBM Plex Sans (variable) | 300 to 700, normal | `plex-sans-latin-wght.woff2` (~39 KB) |
58
+ | IBM Plex Mono | 400, normal | `plex-mono-latin-400.woff2` (~10 KB) |
59
+
60
+ Hinting is removed (smaller files; modern browsers smooth the glyphs themselves). There is no italic and no other Mono weight:
61
+ `<em>` gets a slanted Sans, bold inside `<code>` gets a synthesized bold.
62
+
63
+ **Preload the main font** so text renders in Plex sooner. With Vite, `?url` gives the same hashed URL that the CSS uses,
64
+ so the file is downloaded once:
65
+
66
+ ```js
67
+ import plexSans from 'bereg-ds/fonts/plex-sans-latin-wght.woff2?url';
68
+ ```
69
+
70
+ ```html
71
+ <link rel="preload" href="{plexSans}" as="font" type="font/woff2" crossorigin>
72
+ ```
73
+
74
+ `crossorigin` is required even on the same origin: without it the browser downloads the font twice.
75
+ Preload only the Latin Sans file; other files load when a page needs them.
76
+
49
77
  ## Light theme (optional)
50
78
 
51
79
  Dark is the default. Projects that need a light theme add one file; projects that stay dark do not load it.
@@ -131,4 +159,4 @@ Storybook (ds.bereg.dev) deploys automatically on push to `main`.
131
159
 
132
160
  ## License
133
161
 
134
- MIT. IBM Plex is licensed under the SIL Open Font License (comes with the Fontsource packages).
162
+ MIT. IBM Plex is licensed under the SIL Open Font License: `bereg-ds/fonts/OFL.txt`.
package/dist/css/base.css CHANGED
@@ -44,7 +44,7 @@ h3, .text-h3 { font-size: var(--font-size-lg); font-weight: var(--weight-semibol
44
44
  p { margin: 0 0 var(--space-4); }
45
45
 
46
46
  /* Text styles (classes). Sizes in rem follow the user's browser font size. */
47
- .text-h1-subtitle { font-size: var(--font-size-2xl); font-weight: var(--weight-light); line-height: var(--leading-tight); letter-spacing: var(--tracking-snug); }
47
+ .text-h1-subtitle { font-size: clamp(var(--font-size-lg), 0.75rem + 1.6vw, var(--font-size-2xl)); font-weight: var(--weight-light); line-height: var(--leading-tight); letter-spacing: var(--tracking-snug); }
48
48
  .text-facts { font-size: var(--font-size-4xl); font-weight: var(--weight-semibold); line-height: var(--leading-tight); letter-spacing: var(--tracking-tighter); }
49
49
  .text-h2-article { font-size: var(--font-size-2xl); font-weight: var(--weight-semibold); line-height: var(--leading-tight); letter-spacing: var(--tracking-tight); }
50
50
  .text-post-title { font-size: var(--font-size-xl); font-weight: var(--weight-semibold); line-height: var(--leading-tight); letter-spacing: var(--tracking-tight); }
@@ -79,9 +79,12 @@
79
79
  }
80
80
  .card:hover, .card:focus-within { border-color: var(--line-hover); }
81
81
  .card:hover::before, .card:focus-within::before { --tick: var(--tick-hover); --tc: var(--highlight); opacity: 1; }
82
- /* Focus: the ring goes around the whole card, not only around the title link. */
83
- .card:has(.stretch:focus-visible) { outline: var(--border-thick) solid var(--focus); outline-offset: var(--focus-offset); }
84
- .card .stretch:focus-visible { outline: none; }
82
+ /* Focus: the ring goes around the whole card, not only around the title link.
83
+ Only where :has() works; elsewhere the title link keeps its own focus ring (base.css :focus-visible). */
84
+ @supports selector(:has(*)) {
85
+ .card:has(.stretch:focus-visible) { outline: var(--border-thick) solid var(--focus); outline-offset: var(--focus-offset); }
86
+ .card .stretch:focus-visible { outline: none; }
87
+ }
85
88
 
86
89
  /* ---------- Quote ---------- */
87
90
  .quotes { display: grid; grid-template-columns: repeat(auto-fill, minmax(18.75rem, 1fr)); gap: var(--space-6); }
@@ -149,6 +152,7 @@
149
152
  /* ---------- Post Item ---------- */
150
153
  .subhead { font-family: var(--mono); font-size: var(--font-size-xs); font-weight: var(--weight-regular); letter-spacing: var(--tracking-caps); text-transform: uppercase; color: var(--muted); margin: var(--space-8) 0 var(--space-4); }
151
154
  .subhead:first-child { margin-top: 0; }
155
+ .section-head + .subhead { margin-top: 0; }
152
156
  .posts { list-style: none; margin: 0; padding: 0; }
153
157
  .posts > li { border-top: var(--border-thin) solid var(--line); padding: var(--space-4) 0; display: grid; grid-template-columns: 8.125rem 1fr; gap: var(--space-6); }
154
158
  .posts h2, .posts h3 { font-size: var(--font-size-xl); }
@@ -1,9 +1,27 @@
1
- /* Bereg DS fonts: IBM Plex Sans (variable, 100-700) and IBM Plex Mono 400, self-hosted through Fontsource.
2
- The font files and their OFL license come with the @fontsource packages (dependencies of bereg-ds).
3
- Each subset has its own unicode-range, so the browser loads only the scripts a page uses (latin, cyrillic...).
1
+ /* Bereg DS fonts: IBM Plex Sans (variable, weights 300-700) and IBM Plex Mono 400. Generated by scripts/build-fonts.py, do not edit by hand.
2
+ Self-hosted woff2 files in ../fonts (built from Fontsource, hinting removed, Sans weight axis limited to 300-700). License: ../fonts/OFL.txt.
3
+ Subsets: latin, latin-ext, cyrillic, each with its own unicode-range, so the browser loads only the scripts a page uses.
4
+ Other scripts (Greek, Vietnamese...) fall back to the system font.
4
5
  For Hebrew use IBM Plex Sans Hebrew (@fontsource/ibm-plex-sans-hebrew) and add it to --font in your project. */
5
- @import '@fontsource-variable/ibm-plex-sans/wght.css';
6
- @import '@fontsource/ibm-plex-mono/400.css';
6
+
7
+ @font-face { font-family: 'IBM Plex Sans Variable'; font-style: normal; font-weight: 300 700; font-display: swap;
8
+ src: url('../fonts/plex-sans-cyrillic-wght.woff2') format('woff2');
9
+ unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116; }
10
+ @font-face { font-family: 'IBM Plex Sans Variable'; font-style: normal; font-weight: 300 700; font-display: swap;
11
+ src: url('../fonts/plex-sans-latin-ext-wght.woff2') format('woff2');
12
+ unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
13
+ @font-face { font-family: 'IBM Plex Sans Variable'; font-style: normal; font-weight: 300 700; font-display: swap;
14
+ src: url('../fonts/plex-sans-latin-wght.woff2') format('woff2');
15
+ unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
16
+ @font-face { font-family: 'IBM Plex Mono'; font-style: normal; font-weight: 400; font-display: swap;
17
+ src: url('../fonts/plex-mono-cyrillic-400.woff2') format('woff2');
18
+ unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116; }
19
+ @font-face { font-family: 'IBM Plex Mono'; font-style: normal; font-weight: 400; font-display: swap;
20
+ src: url('../fonts/plex-mono-latin-ext-400.woff2') format('woff2');
21
+ unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
22
+ @font-face { font-family: 'IBM Plex Mono'; font-style: normal; font-weight: 400; font-display: swap;
23
+ src: url('../fonts/plex-mono-latin-400.woff2') format('woff2');
24
+ unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
7
25
 
8
26
  /* Metric-matched fallbacks: system fonts scaled to Plex's size and line box, so the font swap does not shift layout.
9
27
  Variable names in tokens.css (--font, --mono) list these right after Plex. */
@@ -31,7 +31,7 @@
31
31
  --duration-base: 250ms;
32
32
  --duration-slow: 700ms;
33
33
  --duration-draw: 900ms;
34
- --font: 'IBM Plex Sans Variable', 'IBM Plex Sans', 'IBM Plex Sans Fallback', system-ui, -apple-system, 'Segoe UI', sans-serif; /** 'IBM Plex Sans Variable' is the Fontsource name of the variable font (fonts.css); 'IBM Plex Sans' covers projects that load Plex another way. */
34
+ --font: 'IBM Plex Sans Variable', 'IBM Plex Sans', 'IBM Plex Sans Fallback', system-ui, -apple-system, 'Segoe UI', sans-serif; /** 'IBM Plex Sans Variable' is the family name of the variable font in fonts.css (same as Fontsource); 'IBM Plex Sans' covers projects that load Plex another way. */
35
35
  --mono: 'IBM Plex Mono', 'IBM Plex Mono Fallback', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
36
36
  --weight-light: 300;
37
37
  --weight-regular: 400;
@@ -0,0 +1,93 @@
1
+ Copyright 2019 IBM Corp. All rights reserved. IBMPlexSans-Italic[wdth,wght].ttf: Copyright 2019 IBM Corp. All rights reserved.
2
+
3
+ This Font Software is licensed under the SIL Open Font License, Version 1.1.
4
+ This license is copied below, and is also available with a FAQ at:
5
+ http://scripts.sil.org/OFL
6
+
7
+
8
+ -----------------------------------------------------------
9
+ SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
10
+ -----------------------------------------------------------
11
+
12
+ PREAMBLE
13
+ The goals of the Open Font License (OFL) are to stimulate worldwide
14
+ development of collaborative font projects, to support the font creation
15
+ efforts of academic and linguistic communities, and to provide a free and
16
+ open framework in which fonts may be shared and improved in partnership
17
+ with others.
18
+
19
+ The OFL allows the licensed fonts to be used, studied, modified and
20
+ redistributed freely as long as they are not sold by themselves. The
21
+ fonts, including any derivative works, can be bundled, embedded,
22
+ redistributed and/or sold with any software provided that any reserved
23
+ names are not used by derivative works. The fonts and derivatives,
24
+ however, cannot be released under any other type of license. The
25
+ requirement for fonts to remain under this license does not apply
26
+ to any document created using the fonts or their derivatives.
27
+
28
+ DEFINITIONS
29
+ "Font Software" refers to the set of files released by the Copyright
30
+ Holder(s) under this license and clearly marked as such. This may
31
+ include source files, build scripts and documentation.
32
+
33
+ "Reserved Font Name" refers to any names specified as such after the
34
+ copyright statement(s).
35
+
36
+ "Original Version" refers to the collection of Font Software components as
37
+ distributed by the Copyright Holder(s).
38
+
39
+ "Modified Version" refers to any derivative made by adding to, deleting,
40
+ or substituting -- in part or in whole -- any of the components of the
41
+ Original Version, by changing formats or by porting the Font Software to a
42
+ new environment.
43
+
44
+ "Author" refers to any designer, engineer, programmer, technical
45
+ writer or other person who contributed to the Font Software.
46
+
47
+ PERMISSION & CONDITIONS
48
+ Permission is hereby granted, free of charge, to any person obtaining
49
+ a copy of the Font Software, to use, study, copy, merge, embed, modify,
50
+ redistribute, and sell modified and unmodified copies of the Font
51
+ Software, subject to the following conditions:
52
+
53
+ 1) Neither the Font Software nor any of its individual components,
54
+ in Original or Modified Versions, may be sold by itself.
55
+
56
+ 2) Original or Modified Versions of the Font Software may be bundled,
57
+ redistributed and/or sold with any software, provided that each copy
58
+ contains the above copyright notice and this license. These can be
59
+ included either as stand-alone text files, human-readable headers or
60
+ in the appropriate machine-readable metadata fields within text or
61
+ binary files as long as those fields can be easily viewed by the user.
62
+
63
+ 3) No Modified Version of the Font Software may use the Reserved Font
64
+ Name(s) unless explicit written permission is granted by the corresponding
65
+ Copyright Holder. This restriction only applies to the primary font name as
66
+ presented to the users.
67
+
68
+ 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
69
+ Software shall not be used to promote, endorse or advertise any
70
+ Modified Version, except to acknowledge the contribution(s) of the
71
+ Copyright Holder(s) and the Author(s) or with their explicit written
72
+ permission.
73
+
74
+ 5) The Font Software, modified or unmodified, in part or in whole,
75
+ must be distributed entirely under this license, and must not be
76
+ distributed under any other license. The requirement for fonts to
77
+ remain under this license does not apply to any document created
78
+ using the Font Software.
79
+
80
+ TERMINATION
81
+ This license becomes null and void if any of the above conditions are
82
+ not met.
83
+
84
+ DISCLAIMER
85
+ THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
86
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
87
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
88
+ OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
89
+ COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
90
+ INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
91
+ DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
92
+ FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
93
+ OTHER DEALINGS IN THE FONT SOFTWARE.
@@ -64,7 +64,7 @@ export const motionDurationFast: string;
64
64
  export const motionDurationBase: string;
65
65
  export const motionDurationSlow: string;
66
66
  export const motionDurationDraw: string;
67
- /** 'IBM Plex Sans Variable' is the Fontsource name of the variable font (fonts.css); 'IBM Plex Sans' covers projects that load Plex another way. */
67
+ /** 'IBM Plex Sans Variable' is the family name of the variable font in fonts.css (same as Fontsource); 'IBM Plex Sans' covers projects that load Plex another way. */
68
68
  export const fontFamilySans: string;
69
69
  export const fontFamilyMono: string;
70
70
  export const fontWeightLight: number;
@@ -56,7 +56,7 @@ export const motionDurationBase = "250ms";
56
56
  export const motionDurationSlow = "700ms";
57
57
  export const motionDurationDraw = "900ms";
58
58
  export const fontFamilySans =
59
- "'IBM Plex Sans Variable', 'IBM Plex Sans', 'IBM Plex Sans Fallback', system-ui, -apple-system, 'Segoe UI', sans-serif"; // 'IBM Plex Sans Variable' is the Fontsource name of the variable font (fonts.css); 'IBM Plex Sans' covers projects that load Plex another way.
59
+ "'IBM Plex Sans Variable', 'IBM Plex Sans', 'IBM Plex Sans Fallback', system-ui, -apple-system, 'Segoe UI', sans-serif"; // 'IBM Plex Sans Variable' is the family name of the variable font in fonts.css (same as Fontsource); 'IBM Plex Sans' covers projects that load Plex another way.
60
60
  export const fontFamilyMono =
61
61
  "'IBM Plex Mono', 'IBM Plex Mono Fallback', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace";
62
62
  export const fontWeightLight = 300;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bereg-ds",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "description": "Bereg DS: the Engineering Blueprint design system by Konstantin Beregovoy. Design tokens, CSS components and React components.",
5
5
  "license": "MIT",
6
6
  "author": "Konstantin Beregovoy (https://bereg.dev)",
@@ -34,6 +34,7 @@
34
34
  "exports": {
35
35
  ".": "./dist/css/bereg-ds.css",
36
36
  "./fonts.css": "./dist/css/fonts.css",
37
+ "./fonts/*": "./dist/fonts/*",
37
38
  "./tokens.css": "./dist/css/tokens.css",
38
39
  "./base.css": "./dist/css/base.css",
39
40
  "./components.css": "./dist/css/components.css",
@@ -53,6 +54,7 @@
53
54
  "./package.json": "./package.json"
54
55
  },
55
56
  "scripts": {
57
+ "build:fonts": "python3 scripts/build-fonts.py",
56
58
  "build:tokens": "node scripts/build-tokens.mjs",
57
59
  "build:css": "node scripts/build-css.mjs",
58
60
  "build:react": "tsup",
@@ -63,10 +65,6 @@
63
65
  "build-storybook": "npm run build && storybook build -o storybook-static && node scripts/seo-head.mjs",
64
66
  "prepublishOnly": "npm run build && npm test"
65
67
  },
66
- "dependencies": {
67
- "@fontsource-variable/ibm-plex-sans": "^5.3.0",
68
- "@fontsource/ibm-plex-mono": "^5.3.0"
69
- },
70
68
  "peerDependencies": {
71
69
  "react": ">=18"
72
70
  },
@@ -79,6 +77,8 @@
79
77
  "node": ">=20"
80
78
  },
81
79
  "devDependencies": {
80
+ "@fontsource-variable/ibm-plex-sans": "^5.3.0",
81
+ "@fontsource/ibm-plex-mono": "^5.3.0",
82
82
  "@storybook/addon-a11y": "^10.6.7",
83
83
  "@storybook/addon-docs": "^10.6.7",
84
84
  "@storybook/react-vite": "^10.6.7",
package/tokens/font.json CHANGED
@@ -17,7 +17,7 @@
17
17
  "css": "font"
18
18
  }
19
19
  },
20
- "$description": "'IBM Plex Sans Variable' is the Fontsource name of the variable font (fonts.css); 'IBM Plex Sans' covers projects that load Plex another way."
20
+ "$description": "'IBM Plex Sans Variable' is the family name of the variable font in fonts.css (same as Fontsource); 'IBM Plex Sans' covers projects that load Plex another way."
21
21
  },
22
22
  "mono": {
23
23
  "$value": [