@terrahq/design-system 0.0.9 → 0.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.
@@ -0,0 +1,88 @@
1
+ @use "@scss/framework/_var/_vars.scss" as *;
2
+
3
+ // Transitions reuse Terra's time tokens and easing curves ($time-*, $ease-* in _vars.scss).
4
+ // Order matters: the transition-* classes set a default duration and curve, and the duration and ease classes
5
+ // that follow them win over those defaults.
6
+
7
+ .u--transition-all {
8
+ transition-property: all;
9
+ transition-duration: $time-a;
10
+ transition-timing-function: $ease-standard-a;
11
+ }
12
+ .u--transition-colors {
13
+ transition-property: color, background-color, border-color, fill, stroke;
14
+ transition-duration: $time-a;
15
+ transition-timing-function: $ease-standard-a;
16
+ }
17
+ .u--transition-opacity {
18
+ transition-property: opacity;
19
+ transition-duration: $time-a;
20
+ transition-timing-function: $ease-standard-a;
21
+ }
22
+ .u--transition-transform {
23
+ transition-property: transform;
24
+ transition-duration: $time-a;
25
+ transition-timing-function: $ease-standard-a;
26
+ }
27
+
28
+ // u--duration-a (0.1s) / b (0.3s) / c (0.6s)
29
+ $durations: (a: $time-a, b: $time-b, c: $time-c);
30
+ @each $name, $time in $durations {
31
+ .u--duration-#{$name} {
32
+ transition-duration: $time;
33
+ }
34
+ }
35
+
36
+ // u--ease-{standard|entrance|exit}-{a|b}: a = productive (interfaces), b = expressive (marketing)
37
+ $eases: (
38
+ standard-a: $ease-standard-a,
39
+ standard-b: $ease-standard-b,
40
+ entrance-a: $ease-entrance-a,
41
+ entrance-b: $ease-entrance-b,
42
+ exit-a: $ease-exit-a,
43
+ exit-b: $ease-exit-b,
44
+ );
45
+ @each $name, $curve in $eases {
46
+ .u--ease-#{$name} {
47
+ transition-timing-function: $curve;
48
+ }
49
+ }
50
+
51
+ // Animations are utilities, not foundations.
52
+ @keyframes u-fade-in {
53
+ from { opacity: 0; }
54
+ to { opacity: 1; }
55
+ }
56
+ @keyframes u-fade-up {
57
+ from { opacity: 0; transform: translateY(1rem); }
58
+ to { opacity: 1; transform: none; }
59
+ }
60
+ @keyframes u-spin {
61
+ to { transform: rotate(360deg); }
62
+ }
63
+ @keyframes u-pulse {
64
+ 50% { opacity: 0.5; }
65
+ }
66
+
67
+ .u--animation-fade-in {
68
+ animation: u-fade-in $time-b $ease-entrance-a both;
69
+ }
70
+ .u--animation-fade-up {
71
+ animation: u-fade-up $time-b $ease-entrance-a both;
72
+ }
73
+ .u--animation-spin {
74
+ animation: u-spin 1s linear infinite;
75
+ }
76
+ .u--animation-pulse {
77
+ animation: u-pulse 2s $ease-standard-a infinite;
78
+ }
79
+
80
+ // All of them respect prefers-reduced-motion.
81
+ @media (prefers-reduced-motion: reduce) {
82
+ .u--animation-fade-in,
83
+ .u--animation-fade-up,
84
+ .u--animation-spin,
85
+ .u--animation-pulse {
86
+ animation: none;
87
+ }
88
+ }
@@ -1,17 +1,5 @@
1
1
  @use "@scss/framework/_var/_vars.scss" as *;
2
2
 
3
- $space-values : (
4
- 0,
5
- 1,
6
- 2,
7
- 3,
8
- 4,
9
- 5,
10
- 7,
11
- 8,
12
- 10,
13
- 15,
14
- ) !default;
15
3
 
16
4
  $space-prefixes : (
17
5
  p : padding,
@@ -24,6 +12,13 @@ $space-values : (
24
12
  mr : margin-right,
25
13
  mb : margin-bottom,
26
14
  ml : margin-left,
15
+ px : (padding-left, padding-right),
16
+ py : (padding-top, padding-bottom),
17
+ mx : (margin-left, margin-right),
18
+ my : (margin-top, margin-bottom),
19
+ gap : gap,
20
+ row-gap : row-gap,
21
+ col-gap : column-gap,
27
22
  ) !default;
28
23
 
29
24
  $space-breakpoints: (
@@ -44,7 +39,7 @@ $space-values : (
44
39
  @each $attr-short, $attr-long in $prefixes {
45
40
  @each $value in $values {
46
41
  .u--#{$attr-short}-#{$value} {
47
- #{$attr-long}: calc(#{$measure} * #{$value});
42
+ @each $prop in $attr-long { #{$prop}: calc(#{$measure} * #{$value}); }
48
43
  }
49
44
  }
50
45
  }
@@ -55,7 +50,7 @@ $space-values : (
55
50
  @each $attr-short, $attr-long in $prefixes {
56
51
  @each $value in $values {
57
52
  .u--#{$attr-short}-#{$breakpoint-name}-#{$value} {
58
- #{$attr-long}: calc(#{$measure} * #{$value});
53
+ @each $prop in $attr-long { #{$prop}: calc(#{$measure} * #{$value}); }
59
54
  }
60
55
  }
61
56
  }
@@ -64,4 +59,6 @@ $space-values : (
64
59
  }
65
60
  }
66
61
 
67
- @include make-spaces($space-values, $space-prefixes,$space-breakpoints);
62
+ @include make-spaces($space-values, $space-prefixes,$space-breakpoints);
63
+
64
+ .u--mx-auto { margin-left: auto; margin-right: auto; }
@@ -0,0 +1,70 @@
1
+ @use "sass:map";
2
+ @use "sass:math";
3
+ @use "@scss/framework/_var/_vars.scss" as *;
4
+
5
+ // States live in the class name, with no colons: u--hover-background-d, u--focus-ring, u--active-scale-95...
6
+ // Hover only applies on devices that can hover. States have no breakpoint variants.
7
+
8
+ @media (hover: hover) {
9
+ // u--hover-color-{letter}, u--hover-border-{letter} (border color only: pair with u--border-*)
10
+ @each $name, $color in $color-options {
11
+ .u--hover-color-#{$name}:hover {
12
+ color: $color;
13
+ }
14
+ .u--hover-border-#{$name}:hover {
15
+ border-color: $color;
16
+ }
17
+ }
18
+
19
+ // u--hover-background-{letter}: the letters that also have f--background-*
20
+ @each $name in $colorbg-keys {
21
+ @if map.has-key($color-options, $name) {
22
+ .u--hover-background-#{$name}:hover {
23
+ background-color: map.get($color-options, $name);
24
+ }
25
+ }
26
+ }
27
+
28
+ // u--group on a parent, u--group-hover-* on its children
29
+ @each $name, $color in $color-options {
30
+ .u--group:hover .u--group-hover-color-#{$name} {
31
+ color: $color;
32
+ }
33
+ .u--group:hover .u--group-hover-border-#{$name} {
34
+ border-color: $color;
35
+ }
36
+ }
37
+ @each $name in $colorbg-keys {
38
+ @if map.has-key($color-options, $name) {
39
+ .u--group:hover .u--group-hover-background-#{$name} {
40
+ background-color: map.get($color-options, $name);
41
+ }
42
+ }
43
+ }
44
+ }
45
+
46
+ // u--group is a marker: it sets only a custom property so the class exists in the CSS.
47
+ .u--group {
48
+ --u-group: 1;
49
+ }
50
+
51
+ // u--focus-ring: a 2px ring in color a, only for keyboard focus
52
+ .u--focus-ring:focus-visible {
53
+ outline: 2px solid map.get($color-options, a);
54
+ outline-offset: 2px;
55
+ }
56
+
57
+ // u--active-scale-{90|95|98}: pressed
58
+ @each $step in (90, 95, 98) {
59
+ .u--active-scale-#{$step}:active {
60
+ transform: scale(math.div($step, 100));
61
+ }
62
+ }
63
+
64
+ // u--disabled-opacity-{25|50|75}: on :disabled and [aria-disabled="true"]
65
+ @each $step in (25, 50, 75) {
66
+ .u--disabled-opacity-#{$step}:disabled,
67
+ .u--disabled-opacity-#{$step}[aria-disabled="true"] {
68
+ opacity: math.div($step, 100);
69
+ }
70
+ }
@@ -1,5 +1,6 @@
1
1
  @forward './align-items.scss';
2
2
  @forward './aspect-ratio.scss';
3
+ @forward './border.scss';
3
4
  @forward './display.scss';
4
5
  @forward './flex-direction.scss';
5
6
  @forward './flex-wrap.scss';
@@ -7,9 +8,11 @@
7
8
  @forward './font-weight.scss';
8
9
  @forward './height.scss';
9
10
  @forward './justify-content.scss';
11
+ @forward './motion.scss';
10
12
  @forward './order.scss';
11
13
  @forward './overflow.scss';
12
14
  @forward './position.scss';
13
15
  @forward './spacing.scss';
16
+ @forward './states.scss';
14
17
  @forward './text-align.scss';
15
18
  @forward './width.scss';
@@ -1,3 +1,4 @@
1
+ @use "sass:meta";
1
2
  @use "@scss/framework/_var/_vars.scss" as *;
2
3
 
3
4
  $width-values: (
@@ -38,7 +39,7 @@ $width-breakpoints: (
38
39
  }
39
40
  }
40
41
 
41
- @if variable-exists(width-breakpoints) {
42
+ @if meta.variable-exists(width-breakpoints) {
42
43
  @include width-utility($width-values, $width-breakpoints);
43
44
  }
44
45
  @else {
@@ -1,3 +1,5 @@
1
- @use "./src/scss/framework/foundation/foundation.scss";
1
+ // _vars is forwarded first so `@use "<pkg>" with (...)` configures it before anything else loads it.
2
+ @forward "./framework/_var/vars";
2
3
 
3
- @use "./src/scss/framework/utilities/utilities.scss";
4
+ @use "./framework/foundation/foundation";
5
+ @use "./framework/utilities/utilities";
@@ -0,0 +1,9 @@
1
+ // Copy to your project as terra.config.js, then: npx terra-ds build
2
+ export default {
3
+ colors: { a: '#0f0f0f', b: '#fefefe' }, // replaces the palette; "a" and "b" are required
4
+ backgrounds: ['a', 'b'], // which colors also get f--background-*
5
+ spacing: [0, 1, 2, 4, 8], // replaces the u--p-* / u--m-* steps
6
+ font: "'Uncut Sans', system-ui, sans-serif", // font-family used by f--font-* (this is already the default)
7
+ radius: { a: '4px', full: '999px' }, // replaces f--radius-*
8
+ output: 'public/terra.css',
9
+ }
package/decs.d.ts DELETED
@@ -1,2 +0,0 @@
1
- declare module "@teamthunderfoot/breakpoints"
2
- declare module '@andresclua/jsutil';
package/public/vite.svg DELETED
@@ -1 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
package/src/index.html DELETED
@@ -1,67 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
-
4
- <head>
5
- <meta charset="UTF-8" />
6
- <link rel="icon" type="image/svg+xml" href="/vite.svg" />
7
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
8
- <link rel="stylesheet" href="./scss/index.scss">
9
- <title>Design System by Terra</title>
10
- </head>
11
-
12
- <body>
13
- <section class="f--section-a">
14
- <div class="f--container">
15
- <div class="f--row">
16
- <div class="f--col-12">
17
- <div class="f--font-a f--sp-c u--font-bold">Design System <span class="f--font-c">By Terra</span></div>
18
- <p class="f--font-d">A small collection of css helpers that include</p>
19
- </div>
20
- </div>
21
- </div>
22
- </section>
23
- <section class="f--section-b">
24
- <div class="f--container">
25
- <div class="f--row f--gap-b">
26
- <div class="f--col-6 f--col-tablets-12">
27
- <p class="f--font-d f--sp-d">Foundation</p>
28
- <ul class="f--font-e">
29
- <li class="u--font-black">Grid ( container, row, col offset)</li>
30
- <li>Color (terra branded)</li>
31
- <li>Background (terra branded)</li>
32
- <li>Font</li>
33
- <li>Spaces</li>
34
- <li>Section</li>
35
- <li>Gap</li>
36
- </ul>
37
- </div>
38
- <div class="f--col-6 f--col-tablets-12">
39
- <p class="f--font-d f--sp-d">Utilities</p>
40
- <ul class="f--font-e" style="columns: 2;">
41
- <li>Align items</li>
42
- <li>Aspect ratio</li>
43
- <li>Display </li>
44
- <li>Flex-direction</li>
45
- <li>Flex-wrap</li>
46
- <li>Font style</li>
47
- <li>Font Weight</li>
48
- <li>Height</li>
49
- <li>Justify Content</li>
50
- <li>Order</li>
51
- <li>Overflow</li>
52
- <li>Position</li>
53
- <li>Spacing</li>
54
- <li>Text-align</li>
55
- <li>Width</li>
56
- </ul>
57
- </div>
58
- </div>
59
- </div>
60
- </section>
61
-
62
-
63
- </body>
64
-
65
- </html>
66
-
67
-
package/src/style.css DELETED
@@ -1,99 +0,0 @@
1
- :root {
2
- font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif;
3
- /* line-height: 1.5;
4
- font-weight: 400;
5
-
6
- color-scheme: light dark;
7
- color: rgba(255, 255, 255, 0.87);
8
- background-color: #242424;
9
-
10
- font-synthesis: none;
11
- text-rendering: optimizeLegibility;
12
- -webkit-font-smoothing: antialiased;
13
- -moz-osx-font-smoothing: grayscale;
14
- -webkit-text-size-adjust: 100%; */
15
- }
16
-
17
-
18
-
19
- a {
20
- font-weight: 500;
21
- color: #646cff;
22
- text-decoration: inherit;
23
- }
24
- a:hover {
25
- color: #535bf2;
26
- }
27
-
28
- body,html {
29
- margin: 0;
30
- min-height: 100svh;
31
- /* display: flex;
32
- place-items: center; */
33
- background-color: rgb(55, 55, 82);
34
- }
35
-
36
- h1 {
37
- font-size: 3.2em;
38
- line-height: 1.1;
39
- }
40
-
41
- #app {
42
- max-width: 1280px;
43
- margin: 0 auto;
44
- padding: 2rem;
45
- text-align: center;
46
- }
47
-
48
- .logo {
49
- height: 6em;
50
- padding: 1.5em;
51
- will-change: filter;
52
- transition: filter 300ms;
53
- }
54
- .logo:hover {
55
- filter: drop-shadow(0 0 2em #646cffaa);
56
- }
57
- .logo.vanilla:hover {
58
- filter: drop-shadow(0 0 2em #3178c6aa);
59
- }
60
-
61
- .card {
62
- padding: 2em;
63
- }
64
-
65
- .read-the-docs {
66
- color: #888;
67
- }
68
-
69
- button {
70
- border-radius: 8px;
71
- border: 1px solid transparent;
72
- padding: 0.6em 1.2em;
73
- font-size: 1em;
74
- font-weight: 500;
75
- font-family: inherit;
76
- background-color: #1a1a1a;
77
- cursor: pointer;
78
- transition: border-color 0.25s;
79
- }
80
- button:hover {
81
- border-color: #646cff;
82
- }
83
- button:focus,
84
- button:focus-visible {
85
- outline: 4px auto -webkit-focus-ring-color;
86
- }
87
-
88
- @media (prefers-color-scheme: light) {
89
- :root {
90
- color: #213547;
91
- background-color: #ffffff;
92
- }
93
- a:hover {
94
- color: #747bff;
95
- }
96
- button {
97
- background-color: #f9f9f9;
98
- }
99
- }
package/src/vite-env.d.ts DELETED
@@ -1,3 +0,0 @@
1
- // This line allows TypeScript to understand and provide auto-completion and type checking specific to Vite in your code, making development in a Vite project environment easier.
2
- /// <reference types="vite/client" />
3
-
package/tsconfig.json DELETED
@@ -1,24 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "target": "ES2020",
4
- "useDefineForClassFields": true,
5
- "module": "ESNext",
6
- "lib": ["ES2020", "DOM", "DOM.Iterable"],
7
- "skipLibCheck": true,
8
-
9
-
10
- /* Bundler mode */
11
- "moduleResolution": "bundler",
12
- "allowImportingTsExtensions": true,
13
- "resolveJsonModule": true,
14
- "isolatedModules": true,
15
- "noEmit": true,
16
-
17
- /* Linting */
18
- "strict": true,
19
- "noUnusedLocals": true,
20
- "noUnusedParameters": true,
21
- "noFallthroughCasesInSwitch": true
22
- },
23
- "include": ["src", "decs.d.ts"]
24
- }
package/vite.config.js DELETED
@@ -1,37 +0,0 @@
1
- import { resolve } from 'path'
2
- import path from 'path';
3
- import { defineConfig } from 'vite'
4
-
5
- const root = resolve(__dirname, 'src');
6
- const outDir = resolve(__dirname, 'dist');
7
-
8
- // https://vitejs.dev/config/
9
- export default defineConfig({
10
- root,
11
- plugins: [],
12
- build: {
13
- outDir,
14
- emptyOutDir: true,
15
- lib: {
16
- entry: 'src/scss/index.scss', // Punto de entrada de tu biblioteca
17
- name: 'terra-design-system', // Nombre global si se incluye mediante una etiqueta <script>
18
- // Especifica los formatos de salida deseados
19
- // formats: ['es', 'umd', 'cjs'],
20
- },
21
- rollupOptions: {
22
- input: {
23
- main: resolve(root, './scss/index.scss'),
24
- },
25
- output: {
26
- // entryFileNames: `[name].[format].js`,
27
- }
28
- }
29
- },
30
- resolve: {
31
- alias: {
32
- '@scss': path.resolve(__dirname, './src/scss'),
33
-
34
- },
35
- },
36
-
37
- })