Skip to content

Commit 2a2005f

Browse files
authored
Merge pull request #5 from MatteuSan/dev/v1
1.0.0
2 parents bd700d4 + 5ed2372 commit 2a2005f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+3106
-3344
lines changed

.github/workflows/sentro.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
runs-on: ubuntu-latest
1212
strategy:
1313
matrix:
14-
node-version: [ 16.x, 18.x ]
14+
node-version: [ 20.x, 21.x ]
1515
steps:
1616
- uses: actions/checkout@v3
1717
- name: Use NodeJS version ${{ matrix.node-version }}

README.md

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,20 @@
11
# Sentro
2-
![lang](https://img.shields.io/badge/lang-SCSS-%23c69)
3-
[![version_badge](https://img.shields.io/npm/v/@matteusan/sentro)](https://www.npmjs.com/package/@matteusan/sentro)
4-
![license_badge](https://img.shields.io/npm/l/@matteusan/sentro)
5-
![stars](https://img.shields.io/github/stars/MatteuSan/sentro?style=social)
6-
72
A low-level SCSS library for building and managing token-driven design systems.
83

94
## Installation
105
```sh
116
# NPM
127
npm install @matteusan/sentro --save
13-
14-
# Yarn
15-
yarn add @matteusan/sentro --save
168
```
179

1810
## Documentation
1911
- The documentation for this project is located [here](https://docs.matteusan.me/docs/sentro).
2012

2113
## Showcase
2214
#### SCSS Input
23-
- Tokenize your UI while creating an intuitive theming API for your design system.
2415
```scss
25-
@use 'path/to/@matteusan/sentro' with (
26-
$prefix: 'sdb',
16+
@use '@matteusan/sentro' with (
17+
$prefix: 'sdc',
2718
$context: 'theme'
2819
);
2920

@@ -56,8 +47,8 @@ yarn add @matteusan/sentro --save
5647
border-radius: sentro.key-create('button-radius', sentro.token-get('radius-small'));
5748
}
5849
```
50+
5951
#### CSS Output
60-
- Voila!
6152
```css
6253
:root {
6354
--sdb-theme-primary: #122c53;

docs/api/breakpoints.md

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
---
2+
title: Breakpoint Module API
3+
slug: /api/breakpoints
4+
---
5+
6+
# Breakpoint API
7+
8+
## `breakpoint-config()` mixin
9+
10+
Adds breakpoints to the design system.
11+
12+
There are two parameters to this mixin. The first one is to insert a pre-made breakpoint map. It could be from the design
13+
team, or from the project's UX lead. Then the second one is for adding your own breakpoints.
14+
15+
Both parameters can be used simultaneously, or if you don't want that you can always use one or the other.
16+
17+
### Syntax
18+
19+
```scss
20+
/// @param {map} $token-map
21+
/// @param {args} $breakpoints...
22+
breakpoint-config($map: (), $breakpoints...) {}
23+
```
24+
25+
### Usage
26+
27+
```scss
28+
@use 'node_modules/@matteusan/sentro' with ($prefix: 'sdc', $context: 'theme');
29+
30+
:root {
31+
@include sentro.token-config(
32+
$small: 320px,
33+
$medium: 677px,
34+
$large: 890px,
35+
$xlarge: 1077px
36+
);
37+
}
38+
39+
...
40+
```
41+
42+
## `breakpoint-check()` function
43+
44+
Checks if a breakpoint is a valid breakpoint or not. Must be used within a valid SCSS conditional statement.
45+
46+
**NOTE: It does not throw and error when the value is asserted as false, you need to make the error yourself.**
47+
48+
### Syntax
49+
50+
```scss
51+
/// @param {*} query
52+
breakpoint-check($query) {}
53+
```
54+
55+
### Usage
56+
57+
```scss
58+
@use 'node_modules/@matteusan/sentro' with ($prefix: 'sdc', $context: 'theme');
59+
60+
@function tell-me-if-its-a-breakpoint($breakpoint) {
61+
@if sentro.breakpoint-check($breakpoint) {
62+
@return 'IT IS A BREAKPOINT!';
63+
} @else {
64+
@return 'Oh, that\'s disappointing...';
65+
}
66+
}
67+
68+
...
69+
```
70+
71+
## `breakpoint-create()` mixin
72+
73+
Creates a breakpoint. Must be used within a valid CSS selector.
74+
75+
### Syntax
76+
77+
```scss
78+
/// @param {string} $key
79+
/// @param {*} $value
80+
breakpoint-create($key, $value) {}
81+
```
82+
83+
### Usage
84+
85+
```scss
86+
@use 'node_modules/@matteusan/sentro' with ($prefix: 'sdc', $context: 'theme');
87+
88+
dialog {
89+
// CSS Styles
90+
91+
@include sentro.breakpoint-create('medium') {
92+
// CSS Styles
93+
}
94+
}
95+
96+
...
97+
```
98+
99+
## `breakpoint-get()` function
100+
101+
Queries and retrieves a breakpoint. Must be used as a property value, css-function value, or key-fallback value.
102+
103+
Allows you to query your own breakpoint and pass it off inside a property to be used.
104+
105+
### Syntax
106+
107+
```scss
108+
/// @param {string} $key
109+
token-get($key) {}
110+
```
111+
112+
### Usage
113+
114+
```scss
115+
@use 'node_modules/@matteusan/sentro' with ($prefix: 'sdc', $context: 'theme');
116+
117+
dialog {
118+
// CSS Styles
119+
120+
@media (min-width: sentro.breakpoint-get('medium')) {
121+
// CSS Styles
122+
}
123+
}
124+
125+
...
126+
```

docs/api/keys.md

Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
---
2+
title: Keys Module API
3+
slug: /api/keys
4+
---
5+
6+
# Keys API
7+
8+
## `key-bind()` mixin
9+
10+
Binds a new value to an existing key. Must be used within a valid CSS selector.
11+
12+
### Syntax
13+
14+
```scss
15+
/// @param {string} $key
16+
/// @param {*} $value
17+
key-bind($key, $value) {}
18+
```
19+
20+
### Usage
21+
22+
```scss
23+
@use 'node_modules/@matteusan/sentro' with ($prefix: 'sdc', $context: 'theme');
24+
25+
.sdc-card {
26+
@include sentro.key-bind('card-bg', sentro.token-switch('surface-light'));
27+
}
28+
29+
...
30+
```
31+
32+
## `key-create()` function
33+
34+
Creates a key with a fallback value for a CSS property. Must be used as a property value, css-function value, or
35+
key-fallback value.
36+
37+
### Syntax
38+
39+
```scss
40+
/// @param {string} $key
41+
/// @param {*} $value
42+
key-create($key, $value) {}
43+
```
44+
45+
### Usage
46+
47+
```scss
48+
@use 'node_modules/@matteusan/sentro' with ($prefix: 'sdc', $context: 'theme');
49+
50+
.sdc-card {
51+
background: sentro.key-create('card-bg', sentro.token-switch('surface-light'));
52+
}
53+
54+
...
55+
```
56+
57+
## `key-check()` function
58+
59+
Checks if a token is a valid key or not. Must be used within a valid SCSS conditional statement.
60+
61+
**NOTE: It does not throw and error when the value is asserted as false, you need to make the error yourself.**
62+
63+
### Syntax
64+
65+
```scss
66+
/// @param {*} $query
67+
key-check($query) {}
68+
```
69+
70+
### Usage
71+
72+
```scss
73+
@use 'node_modules/@matteusan/sentro' with ($prefix: 'sdc', $context: 'theme');
74+
75+
@function tell-me-if-its-a-key($key) {
76+
@if sentro.key-check($key) {
77+
@return 'IT IS A KEY!';
78+
} @else {
79+
@return 'Oh, that\'s disappointing...';
80+
}
81+
}
82+
83+
...
84+
```
85+
86+
## `key-get()` function
87+
88+
Queries and retrieves a key in its CSS custom property form. Must be used as a property value, css-function value, or
89+
key-fallback value.
90+
91+
### Syntax
92+
93+
```scss
94+
/// @param {string} $key
95+
key-get($key) {}
96+
```
97+
98+
### Usage
99+
100+
```scss
101+
@use 'node_modules/@matteusan/sentro' with ($prefix: 'sdc', $context: 'theme');
102+
103+
.sdc-card {
104+
background: sentro.key-get('card-bg');
105+
}
106+
107+
...
108+
```
109+
110+
## `key-get-raw()` function
111+
112+
Queries and retrieves a key in its raw value form. Must be used as a property value, css-function value, or key-fallback
113+
value.
114+
115+
### Syntax
116+
117+
```scss
118+
/// @param {string} $key
119+
key-get-raw($key) {}
120+
```
121+
122+
### Usage
123+
124+
```scss
125+
@use 'node_modules/@matteusan/sentro' with ($prefix: 'sdc', $context: 'theme');
126+
127+
.sdc-card {
128+
background: sentro.key-get-raw('card-bg');
129+
}
130+
131+
...
132+
```

0 commit comments

Comments
 (0)