@ttoss/theme 1.2.2 → 1.2.4

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  # @ttoss/theme
2
2
 
3
- **@ttoss/theme** is an theme package
3
+ **@ttoss/theme** is an theme package.
4
4
 
5
5
  ## Install
6
6
 
package/dist/esm/index.js CHANGED
@@ -1,186 +1,253 @@
1
1
  /** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
2
2
 
3
- // src/themes/defaultTheme.ts
4
- var DefaultTheme = {
5
- colors: {
6
- text: "#000",
7
- background: "#fff",
8
- primary: "#07c",
9
- secondary: "#639",
10
- gray: "#555",
11
- muted: "#f6f6f6",
12
- danger: "red"
13
- },
14
- space: [0, 4, 8, 16, 32, 64, 128, 256, 512, 1024],
15
- fonts: {
16
- body: '"Asap", sans-serif',
17
- heading: '"Overpass", sans-serif',
18
- monospace: '"Overpass Mono", sans-serif'
19
- },
20
- styles: {
21
- root: {
22
- fontFamily: "body",
23
- fontWeight: "body"
24
- },
25
- a: {
26
- color: "primary",
27
- textDecoration: "underline",
28
- cursor: "pointer",
29
- fontFamily: "body"
30
- },
31
- progress: {
32
- color: "primary",
33
- backgroundColor: "background"
34
- }
35
- },
36
- buttons: {
37
- cta: {
38
- color: "white",
39
- backgroundColor: "primary"
40
- },
41
- muted: {
42
- color: "text",
43
- backgroundColor: "muted"
44
- },
45
- danger: {
46
- color: "white",
47
- backgroundColor: "danger"
48
- }
49
- },
50
- cards: {
51
- primary: {
52
- backgroundColor: "background",
53
- border: "1px solid black",
54
- padding: [4, 5],
55
- display: "flex",
56
- flexDirection: "column",
57
- alignItems: "center",
58
- width: "fit-content"
59
- }
60
- },
61
- forms: {
62
- input: {
63
- fontFamily: "body"
64
- }
65
- },
66
- text: {
67
- default: {
68
- color: "text",
69
- fontFamily: "body"
70
- },
71
- title: {
72
- fontFamily: "heading",
73
- fontSize: 4,
74
- lineSpace: "3.5"
75
- }
76
- }
3
+ // src/tokens/fontSizes.ts
4
+ var fontSizes = {
5
+ "2xs": "0.5rem",
6
+ xs: "0.75rem",
7
+ sm: "0.875rem",
8
+ base: "1rem",
9
+ lg: "1.125rem",
10
+ xl: "1.25rem",
11
+ "2xl": "1.5rem",
12
+ "3xl": "1.875rem",
13
+ "4xl": "2.25rem",
14
+ "5xl": "3rem",
15
+ "6xl": "3.75rem",
16
+ "7xl": "4.5rem",
17
+ "8xl": "6rem",
18
+ "9xl": "8rem"
19
+ };
20
+
21
+ // src/tokens/fontWeights.ts
22
+ var fontWeights = {
23
+ thin: 100,
24
+ extralight: 200,
25
+ light: 300,
26
+ normal: 400,
27
+ medium: 500,
28
+ semibold: 600,
29
+ bold: 700,
30
+ extrabold: 800
77
31
  };
78
32
 
79
- // src/themes/bruttalTheme.ts
33
+ // src/tokens/letterSpacings.ts
34
+ var letterSpacings = {
35
+ tighter: "-0.05em",
36
+ tight: "-0.025em",
37
+ normal: "0em",
38
+ wide: "0.025em",
39
+ wider: "0.05em",
40
+ widest: "0.1em"
41
+ };
42
+
43
+ // src/tokens/space.ts
44
+ var space = {
45
+ none: 0,
46
+ "2xs": "2px",
47
+ xs: "3px",
48
+ sm: "5px",
49
+ md: "8px",
50
+ lg: "13px",
51
+ xl: "21px",
52
+ "2xl": "34px",
53
+ "3xl": "55px",
54
+ "4xl": "89px",
55
+ "5xl": "144px",
56
+ "6xl": "233px",
57
+ "7xl": "377px"
58
+ };
59
+
60
+ // src/themes/Bruttal/BruttalTheme.ts
61
+ var coreFonts = {
62
+ main: '"Atkinson Hyperlegible", sans-serif',
63
+ contrast: '"Work Sans", sans-serif',
64
+ monospace: '"Inconsolata", sans-serif'
65
+ };
66
+ var brandColors = {
67
+ complimentary: "#f5f5f5",
68
+ main: "#292c2a",
69
+ darkNeutral: "#515389",
70
+ accent: "#0000ff",
71
+ lightNeutral: "#e3e3e3"
72
+ };
73
+ var coreColors = {
74
+ ...brandColors,
75
+ gray100: "#f0f1f3",
76
+ gray200: "#ced1d7",
77
+ gray300: "#acb1ba",
78
+ gray400: "#8b919e",
79
+ gray500: "#6b7280",
80
+ gray600: "#535863",
81
+ gray700: "#3b3f46",
82
+ gray800: "#23252a",
83
+ gray900: "#0b0b0d",
84
+ black: "#000000",
85
+ red100: "#ffebeb",
86
+ red200: "#fdbfbf",
87
+ red300: "#f99595",
88
+ red400: "#f56c6c",
89
+ red500: "#ef4444",
90
+ red600: "#e42828",
91
+ red700: "#c62121",
92
+ white: "#ffffff"
93
+ };
94
+ var coreBorders = {
95
+ none: "0px solid",
96
+ thin: "1px solid",
97
+ medium: "2px solid",
98
+ thick: "4px solid"
99
+ };
100
+ var coreRadii = {
101
+ sharp: "0px",
102
+ xs: "2px",
103
+ sm: "4px",
104
+ md: "6px",
105
+ lg: "8px",
106
+ xl: "12px",
107
+ "2xl": "16px",
108
+ "3xl": "24px",
109
+ circle: "9999px"
110
+ };
80
111
  var BruttalTheme = {
112
+ /**
113
+ * Tokens
114
+ */
115
+ fontSizes,
116
+ fontWeights,
117
+ letterSpacings,
118
+ space,
81
119
  colors: {
82
- text: "#0D0D0D",
83
- background: "#fff",
84
- backgroundBrand: "#C2C2C2",
85
- primary: "#0D0D0D",
86
- secondary: "#639",
87
- gray: "#555",
88
- muted: "#f6f6f6",
89
- danger: "red",
90
- accent: "#0000FF",
91
- textOnSurface: "#FFFFFF"
120
+ background: coreColors.lightNeutral,
121
+ text: coreColors.gray900,
122
+ muted: coreColors.gray200,
123
+ outline: coreColors.gray200,
124
+ primary: coreColors.main,
125
+ onPrimary: coreColors.white,
126
+ secondary: coreColors.gray500,
127
+ onSecondary: coreColors.white,
128
+ highlight: coreColors.darkNeutral,
129
+ onHighlight: coreColors.white,
130
+ accent: coreColors.accent,
131
+ onAccent: coreColors.white,
132
+ neutral: coreColors.white,
133
+ onNeutral: coreColors.gray900
92
134
  },
93
- space: [0, 4, 8, 16, 32, 64, 128, 256, 512, 1024],
94
135
  fonts: {
95
- body: '"Inconsolata", sans-serif',
96
- heading: '"Work Sans", sans-serif',
97
- monospace: '"Inconsolata", sans-serif'
98
- },
99
- fontSizes: {
100
- xxs: "0.5rem",
101
- xs: "0.75rem",
102
- sm: "0.875rem",
103
- base: "1rem",
104
- lg: "1.125rem",
105
- xl: "1.25rem",
106
- "2xl": "1.5rem",
107
- "3xl": "1.875rem",
108
- "4xl": "2.25rem",
109
- "5xl": "3rem",
110
- "6xl": "3.75rem",
111
- "7xl": "4.5rem",
112
- "8xl": "6rem",
113
- "9xl": "8rem"
136
+ h1: coreFonts.contrast,
137
+ h2: coreFonts.contrast,
138
+ h3: coreFonts.contrast,
139
+ h4: coreFonts.contrast,
140
+ h5: coreFonts.contrast,
141
+ h6: coreFonts.contrast,
142
+ body: coreFonts.main,
143
+ highlight: coreFonts.main,
144
+ caption: coreFonts.monospace
114
145
  },
115
- fontWeights: {
116
- thin: 100,
117
- extralight: 200,
118
- light: 300,
119
- normal: 400,
120
- medium: 500,
121
- semibold: 600,
122
- bold: 700,
123
- extrabold: 800
146
+ borders: {
147
+ default: coreBorders.medium
124
148
  },
125
- letterSpacings: {
126
- tighter: "-0.05em",
127
- tight: "-0.025em",
128
- normal: "0em",
129
- wide: "0.025em",
130
- wider: "0.05em",
131
- widest: "0.1em"
149
+ radii: {
150
+ default: coreRadii.sm
132
151
  },
152
+ /**
153
+ * Global styles
154
+ */
133
155
  styles: {
134
156
  root: {
135
157
  fontFamily: "body",
136
158
  fontWeight: "normal"
137
- },
138
- a: {
139
- color: "primary",
140
- textDecoration: "underline",
141
- cursor: "pointer",
142
- fontFamily: "body"
143
- },
144
- progress: {
145
- color: "primary",
146
- backgroundColor: "background"
147
159
  }
148
160
  },
149
- borders: [0, "3px solid #0D0D0D"],
161
+ /**
162
+ * Components
163
+ */
150
164
  buttons: {
151
- cta: {
152
- color: "white",
153
- backgroundColor: "primary"
154
- },
155
- muted: {
156
- color: "text",
157
- backgroundColor: "muted"
158
- },
159
- danger: {
160
- color: "white",
161
- backgroundColor: "danger"
165
+ accent: {
166
+ backgroundColor: "accent",
167
+ color: "onAccent",
168
+ fontFamily: "highlight",
169
+ fontWeight: "bold",
170
+ border: "default",
171
+ borderRadius: "default",
172
+ borderColor: "accent",
173
+ ":hover:not(:active,[disabled])": {
174
+ backgroundColor: "highlight",
175
+ color: "onHighlight",
176
+ borderColor: "highlight"
177
+ },
178
+ ":disabled": {
179
+ cursor: "default",
180
+ backgroundColor: "muted",
181
+ borderColor: "muted"
182
+ }
162
183
  },
163
184
  primary: {
185
+ backgroundColor: "primary",
186
+ color: "onPrimary",
187
+ fontFamily: "body",
188
+ border: "default",
189
+ borderRadius: "default",
190
+ borderColor: "outline",
191
+ ":hover:not(:active,[disabled])": {
192
+ backgroundColor: "highlight",
193
+ color: "onHighlight",
194
+ borderColor: "highlight"
195
+ },
196
+ ":active": {
197
+ backgroundColor: "primary",
198
+ color: "onPrimary",
199
+ borderColor: "outline"
200
+ },
164
201
  ":disabled": {
165
- backgroundColor: "backgroundBrand",
166
- cursor: "default"
202
+ cursor: "default",
203
+ backgroundColor: "muted",
204
+ borderColor: "muted"
167
205
  }
168
206
  },
169
207
  secondary: {
170
- color: "text",
171
- backgroundColor: "white",
172
- borderColor: "text",
173
- borderWidth: 1,
174
- borderStyle: "solid",
208
+ backgroundColor: "secondary",
209
+ color: "onSecondary",
210
+ fontFamily: "body",
211
+ border: "default",
212
+ borderRadius: "default",
213
+ borderColor: "outline",
214
+ ":hover:not(:active,[disabled])": {
215
+ backgroundColor: "highlight",
216
+ color: "onHighlight",
217
+ borderColor: "highlight"
218
+ },
219
+ ":disabled": {
220
+ cursor: "default",
221
+ backgroundColor: "muted",
222
+ borderColor: "muted"
223
+ }
224
+ },
225
+ neutral: {
226
+ backgroundColor: "neutral",
227
+ color: "onNeutral",
228
+ fontFamily: "body",
229
+ border: "default",
230
+ borderRadius: "default",
231
+ borderColor: "outline",
232
+ ":hover:not(:active,[disabled])": {
233
+ backgroundColor: "highlight",
234
+ color: "onHighlight",
235
+ borderColor: "highlight"
236
+ },
175
237
  ":disabled": {
176
- opacity: 0.5,
177
- cursor: "default"
238
+ cursor: "default",
239
+ backgroundColor: "muted",
240
+ borderColor: "muted"
178
241
  }
242
+ },
243
+ danger: {
244
+ color: "white",
245
+ backgroundColor: "danger"
179
246
  }
180
247
  },
181
248
  cards: {
182
249
  primary: {
183
- backgroundColor: "background",
250
+ backgroundColor: "primary",
184
251
  border: "1px solid black",
185
252
  padding: [4, 5],
186
253
  display: "flex",
@@ -237,22 +304,20 @@ var BruttalTheme = {
237
304
  }
238
305
  };
239
306
 
240
- // src/themes/bruttalFonts.ts
307
+ // src/createTheme.ts
308
+ import deepmerge from "deepmerge";
309
+ var createTheme = (theme) => {
310
+ return deepmerge(BruttalTheme, theme);
311
+ };
312
+
313
+ // src/themes/Bruttal/BruttalFonts.ts
241
314
  var BruttalFonts = [
242
315
  "https://fonts.googleapis.com/css?family=Inconsolata:wght@100;200;300;400;500;700;800;900",
243
- "https://fonts.googleapis.com/css?family=Work+Sans:wght@100;200;300;400;500;700;800;900"
244
- ];
245
-
246
- // src/themes/defaultFonts.ts
247
- var DefaultFonts = [
248
- "https://fonts.googleapis.com/css?family=Asap",
249
- "https://fonts.googleapis.com/css?family=Overpass",
250
- "https://fonts.googleapis.com/css?family=Overpass+Mono",
251
- "https://fonts.googleapis.com/css?family=Flamenco"
316
+ "https://fonts.googleapis.com/css?family=Work+Sans:wght@100;200;300;400;500;700;800;900",
317
+ "https://fonts.googleapis.com/css2?family=Atkinson+Hyperlegible:ital,wght@0,400;0,700;1,400;1,700&display=swap"
252
318
  ];
253
319
  export {
254
320
  BruttalFonts,
255
321
  BruttalTheme,
256
- DefaultFonts,
257
- DefaultTheme
322
+ createTheme
258
323
  };
package/dist/index.d.ts CHANGED
@@ -1,11 +1,9 @@
1
1
  import { Theme } from 'theme-ui';
2
2
 
3
- declare const DefaultTheme: Theme;
3
+ declare const createTheme: (theme: Theme) => Theme;
4
4
 
5
5
  declare const BruttalTheme: Theme;
6
6
 
7
7
  declare const BruttalFonts: string[];
8
8
 
9
- declare const DefaultFonts: string[];
10
-
11
- export { BruttalFonts, BruttalTheme, DefaultFonts, DefaultTheme };
9
+ export { BruttalFonts, BruttalTheme, createTheme };