@terrahq/design-system 0.6.1 → 0.10.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/README.md +31 -9
- package/bin/terra-ds.mjs +33 -0
- package/dist/icons.css +1 -0
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/src/scss/framework/_var/_vars.scss +33 -22
- package/src/scss/framework/components/btn.scss +1 -0
- package/src/scss/framework/foundation/font/_make-font.scss +12 -12
- package/src/scss/framework/foundation/gap/_make-gap.scss +10 -10
- package/src/scss/framework/foundation/grid/_columns.scss +51 -10
- package/src/scss/framework/foundation/grid/_container.scss +0 -7
- package/src/scss/framework/foundation/grid/_make-container.scss +3 -3
- package/src/scss/framework/foundation/section/_make-section.scss +18 -18
- package/src/scss/framework/foundation/spaces/_make-spaces.scss +10 -10
- package/src/scss/framework/utilities/_align-items.scss +5 -5
- package/src/scss/framework/utilities/_aspect-ratio.scss +5 -5
- package/src/scss/framework/utilities/_display.scss +6 -5
- package/src/scss/framework/utilities/_flex-direction.scss +5 -5
- package/src/scss/framework/utilities/_font-style.scss +5 -5
- package/src/scss/framework/utilities/_font-weight.scss +5 -5
- package/src/scss/framework/utilities/_height.scss +5 -5
- package/src/scss/framework/utilities/_justify-content.scss +5 -5
- package/src/scss/framework/utilities/_offsets.scss +2 -1
- package/src/scss/framework/utilities/_opacity.scss +2 -1
- package/src/scss/framework/utilities/_order.scss +5 -5
- package/src/scss/framework/utilities/_overflow.scss +6 -5
- package/src/scss/framework/utilities/_position.scss +5 -5
- package/src/scss/framework/utilities/_size.scss +14 -0
- package/src/scss/framework/utilities/_spacing.scss +11 -8
- package/src/scss/framework/utilities/_text-align.scss +7 -7
- package/src/scss/framework/utilities/_text-transform.scss +47 -0
- package/src/scss/framework/utilities/_utilities.scss +2 -0
- package/src/scss/framework/utilities/_width.scss +5 -5
- package/src/scss/framework/utilities/_z-index.scss +2 -1
- package/terra.config.example.js +23 -7
package/README.md
CHANGED
|
@@ -98,7 +98,7 @@ import '@terrahq/design-system/terraforms.css'
|
|
|
98
98
|
<i class="c--terraform-a c--terraform-a--forma f--color-d"></i>
|
|
99
99
|
```
|
|
100
100
|
|
|
101
|
-
Icons: `arrow-right`, `arrow-left`, `check`, `close`, `plus`, `search`, `chevron-down`, `external`, `download`, `copy`, `mail`, `info`, `menu`, `trash` (an initial set). Terraforms: `forma`, `diana`, `stanley`, `mistyk`, `melos`, `prismo`, `mendia`, `boba`, `ebb`, `gollum`, `punky`, `infinito`.
|
|
101
|
+
Icons: `arrow-right`, `arrow-left`, `check`, `close`, `plus`, `search`, `chevron-down`, `external`, `download`, `copy`, `mail`, `info`, `menu`, `trash`, `pencil` (an initial set). Terraforms: `forma`, `diana`, `stanley`, `mistyk`, `melos`, `prismo`, `mendia`, `boba`, `ebb`, `gollum`, `punky`, `infinito`.
|
|
102
102
|
|
|
103
103
|
A Terraform is used **alone or in a trio**: three different shapes in three different colors. Never two, and never the same shape or color twice in a trio.
|
|
104
104
|
|
|
@@ -152,18 +152,34 @@ npx terra-ds build
|
|
|
152
152
|
|
|
153
153
|
```js
|
|
154
154
|
// terra.config.js
|
|
155
|
+
// Every key is optional: what you leave out keeps the value Terra ships with, shown here as a comment.
|
|
155
156
|
export default {
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
157
|
+
// Palette and type
|
|
158
|
+
colors: { a: '#0f0f0f', b: '#ffffff' }, // replaces the palette; "a" and "b" are required
|
|
159
|
+
backgrounds: ['a', 'b'], // which colors also get f--background-* (default a to e)
|
|
160
|
+
font: "'Uncut Sans', system-ui, sans-serif", // font-family of f--font-* (this is the default)
|
|
161
|
+
|
|
162
|
+
// Shape and depth
|
|
163
|
+
radius: { a: '4px', full: '999px' }, // replaces f--radius-* (default a 8px, b 12px, c 16px, d 20px, full, round)
|
|
164
|
+
shadows: { a: '0 1px 2px rgb(15 15 15 / .06), 0 4px 16px rgb(15 15 15 / .08)' }, // f--shadow-* (default a, b, c)
|
|
165
|
+
|
|
166
|
+
// Scales of the utilities (each step is a class)
|
|
167
|
+
spacing: [0, 1, 2, 4, 8], // u--padding-*, u--margin-*, u--gap-* (x 8px; default 0 to 10, 12 and 15)
|
|
168
|
+
sizes: [2, 4, 5, 6, 8], // u--height-*, u--width-* (x 8px; default 2, 3, 4, 5, 6, 8, 10, 12)
|
|
169
|
+
minWidth: [10, 20, 30, 40], // u--min-width-* (x 8px; this is the default)
|
|
170
|
+
opacity: { 100: 1, 85: 0.85, 70: 0.7, 50: 0.5 }, // u--opacity-* (this is the default)
|
|
171
|
+
zIndex: [0, 10, 20, 40], // u--z-index-* (this is the default)
|
|
172
|
+
offsets: { 0: '0', 100: '100%' }, // u--top-*, u--right-*, u--bottom-*, u--left-* (this is the default)
|
|
173
|
+
|
|
174
|
+
// Motion
|
|
175
|
+
time: { a: '0.1s', b: '0.3s', c: '0.6s' }, // micro-interactions, expansion, background dimming (this is the default)
|
|
176
|
+
ease: { 'standard-a': 'cubic-bezier(0.2, 0, 0.38, 0.9)' }, // also standard-b, entrance-a/b, exit-a/b
|
|
177
|
+
|
|
178
|
+
output: 'public/terra.css', // where the CSS is written
|
|
163
179
|
}
|
|
164
180
|
```
|
|
165
181
|
|
|
166
|
-
Every key is optional. "Replaces" means what you don't list is not generated, which also makes the file smaller (about 80 kB with this config, against 113 kB by default). Breakpoints
|
|
182
|
+
Every key is optional. "Replaces" means what you don't list is not generated, which also makes the file smaller (about 80 kB with this config, against 113 kB by default). Breakpoints and the grid are not configurable yet.
|
|
167
183
|
|
|
168
184
|
## What's new
|
|
169
185
|
|
|
@@ -173,6 +189,12 @@ Every key is optional. "Replaces" means what you don't list is not generated, wh
|
|
|
173
189
|
|
|
174
190
|
**0.4.2** adds `u--top|right|bottom|left-0|100`, `u--z-index-0|10|20|40`, `u--min-width-{n}` (n x 8px, steps set with `minWidth` in `terra.config.js`), `u--flex-grow-1`, and the button modifiers of Terra: `c--btn-a--second|third|fourth|fifth` (the letters `c--btn-b` to `c--btn-e` stay as aliases). Additive.
|
|
175
191
|
|
|
192
|
+
**0.9.0** adds the icon `c--icon-a--pencil` and removes `u--hover-tint-*` (and the `tint` option), which was named after an effect and not after a CSS property. A quiet button is now an outline plus the hover utilities that already exist.
|
|
193
|
+
|
|
194
|
+
**0.8.0** renames the spacing classes so they read like the CSS property, and the short names are gone (this is the one release that is not additive, while the package is still in development): `u--p-4` is now `u--padding-4`, `u--pt-4` is `u--padding-top-4`, `u--px-4` is `u--padding-x-4`, `u--py-4` is `u--padding-y-4`, and the same for `u--margin-*`. `u--mx-auto`, `u--my-auto` and `u--m-auto` are `u--margin-x-auto`, `u--margin-y-auto` and `u--margin-auto`, and `u--col-gap-*` is `u--column-gap-*`. Breakpoint versions follow: `u--p-mobile-4` is `u--padding-mobile-4`. To migrate, replace the names in your HTML; the frozen 0.0.9 rules were renamed with them, nothing else changed.
|
|
195
|
+
|
|
196
|
+
**0.7.0** adds what a button needs to be built from utilities alone: `u--height-{n}` and `u--width-{n}` (a fixed height or width of n x 8px). It also opens more of the package to `terra.config.js`: `sizes`, `shadows`, `opacity`, `zIndex`, `offsets`, `time` and `ease` (every one optional, with Terra's values as the default; see `terra.config.example.js`). Spacing classes also exist with the name of the CSS property: `u--padding-y-4` is `u--py-4`, `u--margin-x-auto` is `u--mx-auto` (the short names are unchanged). Additive.
|
|
197
|
+
|
|
176
198
|
**0.6.1** adds the icon `c--icon-a--trash` (in `icons.css`) and the button `c--btn-a--sixth` for dangerous actions such as delete (rojizo text, a faint tint on hover). Additive.
|
|
177
199
|
|
|
178
200
|
**0.6.0** adds `c--diff-a` (on a `<pre>`, with `c--diff-a__same`, `__add`, `__del`, `__skip` and `__mark`) for review screens, and `u--cursor-pointer`. Additive.
|
package/bin/terra-ds.mjs
CHANGED
|
@@ -29,6 +29,39 @@ if (cfg.spacing) {
|
|
|
29
29
|
if (bad.length) { console.error(`spacing steps must be whole numbers, 0 or higher (got ${bad.join(', ')}). Each step is that number x 8px.`); process.exit(1) }
|
|
30
30
|
}
|
|
31
31
|
if (cfg.spacing) vars.push(`$space-values: ${list(cfg.spacing)}`)
|
|
32
|
+
if (cfg.sizes) {
|
|
33
|
+
const bad = cfg.sizes.filter(n => !Number.isInteger(n) || n < 1 || [25, 50, 75, 100].includes(n))
|
|
34
|
+
if (bad.length) { console.error(`sizes steps must be whole numbers, 1 or higher, and not 25, 50, 75 or 100 (those are the percentage classes). Got ${bad.join(', ')}. Each step is that number x 8px.`); process.exit(1) }
|
|
35
|
+
vars.push(`$size-steps: ${list(cfg.sizes)}`)
|
|
36
|
+
}
|
|
37
|
+
const fail = m => { console.error(m); process.exit(1) }
|
|
38
|
+
if (cfg.shadows) vars.push(`$shadow-options: (${Object.entries(cfg.shadows).map(([k, v]) => `${k}: (${v})`).join(', ')})`)
|
|
39
|
+
if (cfg.opacity) {
|
|
40
|
+
const bad = Object.entries(cfg.opacity).filter(([k, v]) => !/^\d+$/.test(k) || typeof v !== 'number' || v < 0 || v > 1)
|
|
41
|
+
if (bad.length) fail(`opacity must map whole numbers (the class) to a value from 0 to 1, for example { 70: 0.7 }. Check: ${bad.map(([k]) => k).join(', ')}`)
|
|
42
|
+
vars.push(`$opacity-values: ${map(cfg.opacity)}`)
|
|
43
|
+
}
|
|
44
|
+
if (cfg.zIndex) {
|
|
45
|
+
const bad = cfg.zIndex.filter(n => !Number.isInteger(n) || n < 0)
|
|
46
|
+
if (bad.length) fail(`zIndex steps must be whole numbers, 0 or higher (got ${bad.join(', ')}).`)
|
|
47
|
+
vars.push(`$z-index-values: ${list(cfg.zIndex)}`)
|
|
48
|
+
}
|
|
49
|
+
if (cfg.offsets) {
|
|
50
|
+
const bad = Object.keys(cfg.offsets).filter(k => !/^\d+$/.test(k))
|
|
51
|
+
if (bad.length) fail(`offsets must map whole numbers (the class) to a CSS length, for example { 0: '0', 100: '100%' }. Check: ${bad.join(', ')}`)
|
|
52
|
+
vars.push(`$offset-values: ${map(cfg.offsets)}`)
|
|
53
|
+
}
|
|
54
|
+
if (cfg.time) {
|
|
55
|
+
const bad = Object.entries(cfg.time).filter(([k, v]) => !['a', 'b', 'c'].includes(k) || !/^\d*\.?\d+m?s$/.test(v))
|
|
56
|
+
if (bad.length) fail(`time takes the keys a, b and c with values such as '0.1s' or '150ms'. Check: ${bad.map(([k]) => k).join(', ')}`)
|
|
57
|
+
for (const [k, v] of Object.entries(cfg.time)) vars.push(`$time-${k}: ${v}`)
|
|
58
|
+
}
|
|
59
|
+
if (cfg.ease) {
|
|
60
|
+
const ok = ['standard-a', 'standard-b', 'entrance-a', 'entrance-b', 'exit-a', 'exit-b']
|
|
61
|
+
const bad = Object.keys(cfg.ease).filter(k => !ok.includes(k))
|
|
62
|
+
if (bad.length) fail(`ease takes the keys ${ok.join(', ')}. Check: ${bad.join(', ')}`)
|
|
63
|
+
for (const [k, v] of Object.entries(cfg.ease)) vars.push(`$ease-${k}: ${v}`)
|
|
64
|
+
}
|
|
32
65
|
if (cfg.minWidth) {
|
|
33
66
|
const bad = cfg.minWidth.filter(n => !Number.isInteger(n) || n < 1)
|
|
34
67
|
if (bad.length) { console.error(`minWidth steps must be whole numbers, 1 or higher (got ${bad.join(', ')}). Each step is that number x 8px.`); process.exit(1) }
|
package/dist/icons.css
CHANGED
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
.c--icon-a--info{--c-icon:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22%23000%22%20stroke-width%3D%221.6%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Ccircle%20cx%3D%2212%22%20cy%3D%2212%22%20r%3D%229%22%2F%3E%3Cpath%20d%3D%22M12%2011v5M12%208h.01%22%2F%3E%3C%2Fsvg%3E")}
|
|
10
10
|
.c--icon-a--mail{--c-icon:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22%23000%22%20stroke-width%3D%221.6%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Crect%20x%3D%223%22%20y%3D%225%22%20width%3D%2218%22%20height%3D%2214%22%20rx%3D%222%22%2F%3E%3Cpath%20d%3D%22M3%207l9%206%209-6%22%2F%3E%3C%2Fsvg%3E")}
|
|
11
11
|
.c--icon-a--menu{--c-icon:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22%23000%22%20stroke-width%3D%221.6%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M4%207h16M4%2012h16M4%2017h16%22%2F%3E%3C%2Fsvg%3E")}
|
|
12
|
+
.c--icon-a--pencil{--c-icon:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22%23000%22%20stroke-width%3D%221.6%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M4%2020h4L19.5%208.5a2.1%202.1%200%200%200-3-3L5%2017v3zM14.5%207.5l3%203%22%2F%3E%3C%2Fsvg%3E")}
|
|
12
13
|
.c--icon-a--plus{--c-icon:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22%23000%22%20stroke-width%3D%221.6%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M12%205v14M5%2012h14%22%2F%3E%3C%2Fsvg%3E")}
|
|
13
14
|
.c--icon-a--search{--c-icon:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22%23000%22%20stroke-width%3D%221.6%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Ccircle%20cx%3D%2211%22%20cy%3D%2211%22%20r%3D%226%22%2F%3E%3Cpath%20d%3D%22M16%2016l4%204%22%2F%3E%3C%2Fsvg%3E")}
|
|
14
15
|
.c--icon-a--trash{--c-icon:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22%23000%22%20stroke-width%3D%221.6%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M4%207h16M9%207V5a1%201%200%200%201%201-1h4a1%201%200%200%201%201%201v2M6.5%207l.8%2012a1%201%200%200%200%201%20.9h7.4a1%201%200%200%200%201-.9l.8-12M10%2011v5M14%2011v5%22%2F%3E%3C%2Fsvg%3E")}
|