@ttoss/theme 1.2.3 → 1.2.5

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/dist/index.js CHANGED
@@ -1,8 +1,10 @@
1
1
  /** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
2
2
  "use strict";
3
+ var __create = Object.create;
3
4
  var __defProp = Object.defineProperty;
4
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
6
  var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
6
8
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
9
  var __export = (target, all) => {
8
10
  for (var name in all)
@@ -16,6 +18,14 @@ var __copyProps = (to, from, except, desc) => {
16
18
  }
17
19
  return to;
18
20
  };
21
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
+ // If the importer is in node compatibility mode or this is not an ESM
23
+ // file that has been converted to a CommonJS file using a Babel-
24
+ // compatible transform (i.e. "__esModule" has not been set), then set
25
+ // "default" to the CommonJS "module.exports" for node compatibility.
26
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
27
+ mod
28
+ ));
19
29
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
30
 
21
31
  // src/index.ts
@@ -23,192 +33,258 @@ var src_exports = {};
23
33
  __export(src_exports, {
24
34
  BruttalFonts: () => BruttalFonts,
25
35
  BruttalTheme: () => BruttalTheme,
26
- DefaultFonts: () => DefaultFonts,
27
- DefaultTheme: () => DefaultTheme
36
+ createTheme: () => createTheme
28
37
  });
29
38
  module.exports = __toCommonJS(src_exports);
30
39
 
31
- // src/themes/defaultTheme.ts
32
- var DefaultTheme = {
33
- colors: {
34
- text: "#000",
35
- background: "#fff",
36
- primary: "#07c",
37
- secondary: "#639",
38
- gray: "#555",
39
- muted: "#f6f6f6",
40
- danger: "red"
41
- },
42
- space: [0, 4, 8, 16, 32, 64, 128, 256, 512, 1024],
43
- fonts: {
44
- body: '"Asap", sans-serif',
45
- heading: '"Overpass", sans-serif',
46
- monospace: '"Overpass Mono", sans-serif'
47
- },
48
- styles: {
49
- root: {
50
- fontFamily: "body",
51
- fontWeight: "body"
52
- },
53
- a: {
54
- color: "primary",
55
- textDecoration: "underline",
56
- cursor: "pointer",
57
- fontFamily: "body"
58
- },
59
- progress: {
60
- color: "primary",
61
- backgroundColor: "background"
62
- }
63
- },
64
- buttons: {
65
- cta: {
66
- color: "white",
67
- backgroundColor: "primary"
68
- },
69
- muted: {
70
- color: "text",
71
- backgroundColor: "muted"
72
- },
73
- danger: {
74
- color: "white",
75
- backgroundColor: "danger"
76
- }
77
- },
78
- cards: {
79
- primary: {
80
- backgroundColor: "background",
81
- border: "1px solid black",
82
- padding: [4, 5],
83
- display: "flex",
84
- flexDirection: "column",
85
- alignItems: "center",
86
- width: "fit-content"
87
- }
88
- },
89
- forms: {
90
- input: {
91
- fontFamily: "body"
92
- }
93
- },
94
- text: {
95
- default: {
96
- color: "text",
97
- fontFamily: "body"
98
- },
99
- title: {
100
- fontFamily: "heading",
101
- fontSize: 4,
102
- lineSpace: "3.5"
103
- }
104
- }
40
+ // src/tokens/fontSizes.ts
41
+ var fontSizes = {
42
+ "2xs": "0.5rem",
43
+ xs: "0.75rem",
44
+ sm: "0.875rem",
45
+ base: "1rem",
46
+ lg: "1.125rem",
47
+ xl: "1.25rem",
48
+ "2xl": "1.5rem",
49
+ "3xl": "1.875rem",
50
+ "4xl": "2.25rem",
51
+ "5xl": "3rem",
52
+ "6xl": "3.75rem",
53
+ "7xl": "4.5rem",
54
+ "8xl": "6rem",
55
+ "9xl": "8rem"
56
+ };
57
+
58
+ // src/tokens/fontWeights.ts
59
+ var fontWeights = {
60
+ thin: 100,
61
+ extralight: 200,
62
+ light: 300,
63
+ normal: 400,
64
+ medium: 500,
65
+ semibold: 600,
66
+ bold: 700,
67
+ extrabold: 800
105
68
  };
106
69
 
107
- // src/themes/bruttalTheme.ts
70
+ // src/tokens/letterSpacings.ts
71
+ var letterSpacings = {
72
+ tighter: "-0.05em",
73
+ tight: "-0.025em",
74
+ normal: "0em",
75
+ wide: "0.025em",
76
+ wider: "0.05em",
77
+ widest: "0.1em"
78
+ };
79
+
80
+ // src/tokens/space.ts
81
+ var space = {
82
+ none: 0,
83
+ "2xs": "2px",
84
+ xs: "3px",
85
+ sm: "5px",
86
+ md: "8px",
87
+ lg: "13px",
88
+ xl: "21px",
89
+ "2xl": "34px",
90
+ "3xl": "55px",
91
+ "4xl": "89px",
92
+ "5xl": "144px",
93
+ "6xl": "233px",
94
+ "7xl": "377px"
95
+ };
96
+
97
+ // src/themes/Bruttal/BruttalTheme.ts
98
+ var coreFonts = {
99
+ main: '"Atkinson Hyperlegible", sans-serif',
100
+ contrast: '"Work Sans", sans-serif',
101
+ monospace: '"Inconsolata", sans-serif'
102
+ };
103
+ var brandColors = {
104
+ complimentary: "#f5f5f5",
105
+ main: "#292c2a",
106
+ darkNeutral: "#515389",
107
+ accent: "#0000ff",
108
+ lightNeutral: "#e3e3e3"
109
+ };
110
+ var coreColors = {
111
+ ...brandColors,
112
+ gray100: "#f0f1f3",
113
+ gray200: "#ced1d7",
114
+ gray300: "#acb1ba",
115
+ gray400: "#8b919e",
116
+ gray500: "#6b7280",
117
+ gray600: "#535863",
118
+ gray700: "#3b3f46",
119
+ gray800: "#23252a",
120
+ gray900: "#0b0b0d",
121
+ black: "#000000",
122
+ red100: "#ffebeb",
123
+ red200: "#fdbfbf",
124
+ red300: "#f99595",
125
+ red400: "#f56c6c",
126
+ red500: "#ef4444",
127
+ red600: "#e42828",
128
+ red700: "#c62121",
129
+ white: "#ffffff"
130
+ };
131
+ var coreBorders = {
132
+ none: "0px solid",
133
+ thin: "1px solid",
134
+ medium: "2px solid",
135
+ thick: "4px solid"
136
+ };
137
+ var coreRadii = {
138
+ sharp: "0px",
139
+ xs: "2px",
140
+ sm: "4px",
141
+ md: "6px",
142
+ lg: "8px",
143
+ xl: "12px",
144
+ "2xl": "16px",
145
+ "3xl": "24px",
146
+ circle: "9999px"
147
+ };
108
148
  var BruttalTheme = {
149
+ /**
150
+ * Tokens
151
+ */
152
+ fontSizes,
153
+ fontWeights,
154
+ letterSpacings,
155
+ space,
109
156
  colors: {
110
- text: "#0D0D0D",
111
- background: "#fff",
112
- backgroundBrand: "#C2C2C2",
113
- primary: "#0D0D0D",
114
- secondary: "#639",
115
- gray: "#555",
116
- muted: "#f6f6f6",
117
- danger: "red",
118
- accent: "#0000FF",
119
- textOnSurface: "#FFFFFF"
157
+ background: coreColors.lightNeutral,
158
+ text: coreColors.gray900,
159
+ muted: coreColors.gray200,
160
+ outline: coreColors.gray200,
161
+ primary: coreColors.main,
162
+ onPrimary: coreColors.white,
163
+ secondary: coreColors.gray500,
164
+ onSecondary: coreColors.white,
165
+ highlight: coreColors.darkNeutral,
166
+ onHighlight: coreColors.white,
167
+ accent: coreColors.accent,
168
+ onAccent: coreColors.white,
169
+ neutral: coreColors.white,
170
+ onNeutral: coreColors.gray900
120
171
  },
121
- space: [0, 4, 8, 16, 32, 64, 128, 256, 512, 1024],
122
172
  fonts: {
123
- body: '"Inconsolata", sans-serif',
124
- heading: '"Work Sans", sans-serif',
125
- monospace: '"Inconsolata", sans-serif'
126
- },
127
- fontSizes: {
128
- xxs: "0.5rem",
129
- xs: "0.75rem",
130
- sm: "0.875rem",
131
- base: "1rem",
132
- lg: "1.125rem",
133
- xl: "1.25rem",
134
- "2xl": "1.5rem",
135
- "3xl": "1.875rem",
136
- "4xl": "2.25rem",
137
- "5xl": "3rem",
138
- "6xl": "3.75rem",
139
- "7xl": "4.5rem",
140
- "8xl": "6rem",
141
- "9xl": "8rem"
173
+ h1: coreFonts.contrast,
174
+ h2: coreFonts.contrast,
175
+ h3: coreFonts.contrast,
176
+ h4: coreFonts.contrast,
177
+ h5: coreFonts.contrast,
178
+ h6: coreFonts.contrast,
179
+ body: coreFonts.main,
180
+ highlight: coreFonts.main,
181
+ caption: coreFonts.monospace
142
182
  },
143
- fontWeights: {
144
- thin: 100,
145
- extralight: 200,
146
- light: 300,
147
- normal: 400,
148
- medium: 500,
149
- semibold: 600,
150
- bold: 700,
151
- extrabold: 800
183
+ borders: {
184
+ default: coreBorders.medium
152
185
  },
153
- letterSpacings: {
154
- tighter: "-0.05em",
155
- tight: "-0.025em",
156
- normal: "0em",
157
- wide: "0.025em",
158
- wider: "0.05em",
159
- widest: "0.1em"
186
+ radii: {
187
+ default: coreRadii.sm
160
188
  },
189
+ /**
190
+ * Global styles
191
+ */
161
192
  styles: {
162
193
  root: {
163
194
  fontFamily: "body",
164
195
  fontWeight: "normal"
165
- },
166
- a: {
167
- color: "primary",
168
- textDecoration: "underline",
169
- cursor: "pointer",
170
- fontFamily: "body"
171
- },
172
- progress: {
173
- color: "primary",
174
- backgroundColor: "background"
175
196
  }
176
197
  },
177
- borders: [0, "3px solid #0D0D0D"],
198
+ /**
199
+ * Components
200
+ */
178
201
  buttons: {
179
- cta: {
180
- color: "white",
181
- backgroundColor: "primary"
182
- },
183
- muted: {
184
- color: "text",
185
- backgroundColor: "muted"
186
- },
187
- danger: {
188
- color: "white",
189
- backgroundColor: "danger"
202
+ accent: {
203
+ backgroundColor: "accent",
204
+ color: "onAccent",
205
+ fontFamily: "highlight",
206
+ fontWeight: "bold",
207
+ border: "default",
208
+ borderRadius: "default",
209
+ borderColor: "accent",
210
+ ":hover:not(:active,[disabled])": {
211
+ backgroundColor: "highlight",
212
+ color: "onHighlight",
213
+ borderColor: "highlight"
214
+ },
215
+ ":disabled": {
216
+ cursor: "default",
217
+ backgroundColor: "muted",
218
+ borderColor: "muted"
219
+ }
190
220
  },
191
221
  primary: {
222
+ backgroundColor: "primary",
223
+ color: "onPrimary",
224
+ fontFamily: "body",
225
+ border: "default",
226
+ borderRadius: "default",
227
+ borderColor: "outline",
228
+ ":hover:not(:active,[disabled])": {
229
+ backgroundColor: "highlight",
230
+ color: "onHighlight",
231
+ borderColor: "highlight"
232
+ },
233
+ ":active": {
234
+ backgroundColor: "primary",
235
+ color: "onPrimary",
236
+ borderColor: "outline"
237
+ },
192
238
  ":disabled": {
193
- backgroundColor: "backgroundBrand",
194
- cursor: "default"
239
+ cursor: "default",
240
+ backgroundColor: "muted",
241
+ borderColor: "muted"
195
242
  }
196
243
  },
197
244
  secondary: {
198
- color: "text",
199
- backgroundColor: "white",
200
- borderColor: "text",
201
- borderWidth: 1,
202
- borderStyle: "solid",
245
+ backgroundColor: "secondary",
246
+ color: "onSecondary",
247
+ fontFamily: "body",
248
+ border: "default",
249
+ borderRadius: "default",
250
+ borderColor: "outline",
251
+ ":hover:not(:active,[disabled])": {
252
+ backgroundColor: "highlight",
253
+ color: "onHighlight",
254
+ borderColor: "highlight"
255
+ },
256
+ ":disabled": {
257
+ cursor: "default",
258
+ backgroundColor: "muted",
259
+ borderColor: "muted"
260
+ }
261
+ },
262
+ neutral: {
263
+ backgroundColor: "neutral",
264
+ color: "onNeutral",
265
+ fontFamily: "body",
266
+ border: "default",
267
+ borderRadius: "default",
268
+ borderColor: "outline",
269
+ ":hover:not(:active,[disabled])": {
270
+ backgroundColor: "highlight",
271
+ color: "onHighlight",
272
+ borderColor: "highlight"
273
+ },
203
274
  ":disabled": {
204
- opacity: 0.5,
205
- cursor: "default"
275
+ cursor: "default",
276
+ backgroundColor: "muted",
277
+ borderColor: "muted"
206
278
  }
279
+ },
280
+ danger: {
281
+ color: "white",
282
+ backgroundColor: "danger"
207
283
  }
208
284
  },
209
285
  cards: {
210
286
  primary: {
211
- backgroundColor: "background",
287
+ backgroundColor: "primary",
212
288
  border: "1px solid black",
213
289
  padding: [4, 5],
214
290
  display: "flex",
@@ -265,23 +341,21 @@ var BruttalTheme = {
265
341
  }
266
342
  };
267
343
 
268
- // src/themes/bruttalFonts.ts
344
+ // src/createTheme.ts
345
+ var import_deepmerge = __toESM(require("deepmerge"));
346
+ var createTheme = (theme) => {
347
+ return (0, import_deepmerge.default)(BruttalTheme, theme);
348
+ };
349
+
350
+ // src/themes/Bruttal/BruttalFonts.ts
269
351
  var BruttalFonts = [
270
352
  "https://fonts.googleapis.com/css?family=Inconsolata:wght@100;200;300;400;500;700;800;900",
271
- "https://fonts.googleapis.com/css?family=Work+Sans:wght@100;200;300;400;500;700;800;900"
272
- ];
273
-
274
- // src/themes/defaultFonts.ts
275
- var DefaultFonts = [
276
- "https://fonts.googleapis.com/css?family=Asap",
277
- "https://fonts.googleapis.com/css?family=Overpass",
278
- "https://fonts.googleapis.com/css?family=Overpass+Mono",
279
- "https://fonts.googleapis.com/css?family=Flamenco"
353
+ "https://fonts.googleapis.com/css?family=Work+Sans:wght@100;200;300;400;500;700;800;900",
354
+ "https://fonts.googleapis.com/css2?family=Atkinson+Hyperlegible:ital,wght@0,400;0,700;1,400;1,700&display=swap"
280
355
  ];
281
356
  // Annotate the CommonJS export names for ESM import in node:
282
357
  0 && (module.exports = {
283
358
  BruttalFonts,
284
359
  BruttalTheme,
285
- DefaultFonts,
286
- DefaultTheme
360
+ createTheme
287
361
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ttoss/theme",
3
- "version": "1.2.3",
3
+ "version": "1.2.5",
4
4
  "description": "Theme for packages.",
5
5
  "license": "UNLICENSED",
6
6
  "author": "ttoss",
@@ -15,20 +15,21 @@
15
15
  "tsconfig.json"
16
16
  ],
17
17
  "scripts": {
18
- "build": "tsup-node",
18
+ "build": "tsup",
19
19
  "test": "jest"
20
20
  },
21
+ "sideEffects": false,
21
22
  "typings": "dist/index.d.ts",
22
23
  "dependencies": {
23
- "theme-ui": "^0.15.4"
24
+ "deepmerge": "^4.3.0"
24
25
  },
25
26
  "devDependencies": {
26
- "@ttoss/config": "^1.28.0",
27
- "@ttoss/test-utils": "^1.20.2"
27
+ "@ttoss/config": "^1.28.2",
28
+ "@ttoss/test-utils": "^1.20.4"
28
29
  },
29
30
  "keywords": [],
30
31
  "publishConfig": {
31
32
  "access": "public"
32
33
  },
33
- "gitHead": "7852c1c6c570e30cd03a603902f45fb4849c7701"
34
+ "gitHead": "8ba4361ab9cf6c0ab275ee771a371d4c2ba8cebe"
34
35
  }
@@ -0,0 +1,7 @@
1
+ import { BruttalTheme } from './themes/Bruttal/BruttalTheme';
2
+ import deepmerge from 'deepmerge';
3
+ import type { Theme } from 'theme-ui';
4
+
5
+ export const createTheme = (theme: Theme): Theme => {
6
+ return deepmerge(BruttalTheme, theme);
7
+ };
package/src/index.ts CHANGED
@@ -1,2 +1,4 @@
1
- export * from './themes/themes';
2
- export * from './themes/fonts';
1
+ export { createTheme } from './createTheme';
2
+
3
+ export { BruttalTheme } from './themes/Bruttal/BruttalTheme';
4
+ export { BruttalFonts } from './themes/Bruttal/BruttalFonts';
@@ -1,4 +1,5 @@
1
1
  export const BruttalFonts = [
2
2
  'https://fonts.googleapis.com/css?family=Inconsolata:wght@100;200;300;400;500;700;800;900',
3
3
  'https://fonts.googleapis.com/css?family=Work+Sans:wght@100;200;300;400;500;700;800;900',
4
+ 'https://fonts.googleapis.com/css2?family=Atkinson+Hyperlegible:ital,wght@0,400;0,700;1,400;1,700&display=swap',
4
5
  ];