@obosbbl/grunnmuren-tailwind 2.0.0-canary.1 → 2.0.0-canary.11
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 +22 -2
- package/fonts/font-fallback.js +1 -0
- package/package.json +10 -5
- package/tailwind-base.cjs +433 -109
package/README.md
CHANGED
|
@@ -29,7 +29,7 @@ module.exports = {
|
|
|
29
29
|
'./src/app/**/*.{js,ts,jsx,tsx,}',
|
|
30
30
|
|
|
31
31
|
// If you're using Grunnmuren's React components
|
|
32
|
-
'./node_modules/@obosbbl/grunnmuren-react/dist/**/*.mjs',
|
|
32
|
+
'./node_modules/@obosbbl/grunnmuren-react/dist/**/*.{mjs,js}',
|
|
33
33
|
],
|
|
34
34
|
};
|
|
35
35
|
```
|
|
@@ -57,19 +57,39 @@ module.exports = {
|
|
|
57
57
|
};
|
|
58
58
|
```
|
|
59
59
|
|
|
60
|
+
## Fonts
|
|
61
|
+
|
|
62
|
+
Fonts are automatically loaded from OBOS' CDN, so you don't have to host the font files yourself.
|
|
63
|
+
|
|
64
|
+
If you use [Content-Security-Policy](https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP), you have to allow `https://www.obos.no` as a [font-src](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/font-src), otherwise the fonts will be blocked from loading.
|
|
65
|
+
|
|
66
|
+
The preset includes a (local) fallback font to prevent [CLS](https://web.dev/articles/cls) while the fonts are loading. This is similar to the [font optimization in Next](https://nextjs.org/docs/app/building-your-application/optimizing/fonts). This is enabled by default, but can be disabled with the `includeFontFallback` option.
|
|
67
|
+
|
|
68
|
+
The fallback font metrics is generated with a script that can be run with `pnpm font-fallback` (requires [Bun](https://bun.sh/)). If the fonts are changed, the script must be rerun and the resulting file commited.
|
|
69
|
+
|
|
60
70
|
## Migrating from v1?
|
|
61
71
|
|
|
62
72
|
To ease the transition from v1 to v2 of Grunnmuren, it is possible to configure the preset to be (partially) compatible with v1. This allows you to use v2 of the Tailwind preset with v1 of the React components, and upgrade your application over time instead of a full migration.
|
|
63
73
|
|
|
64
74
|
To do that you need to configure the preset with `legacyV1Compatibility` option.
|
|
65
75
|
|
|
76
|
+
## Options
|
|
77
|
+
|
|
66
78
|
```js
|
|
67
79
|
// tailwind.config.js
|
|
68
80
|
|
|
69
81
|
/** @type {import('tailwindcss').Config} */
|
|
70
82
|
module.exports = {
|
|
71
83
|
presets: [
|
|
72
|
-
require('@obosbbl/grunnmuren-tailwind')({
|
|
84
|
+
require('@obosbbl/grunnmuren-tailwind')({ includeFontFallback: false }),
|
|
73
85
|
],
|
|
86
|
+
// content: [ ... ]
|
|
74
87
|
};
|
|
75
88
|
```
|
|
89
|
+
|
|
90
|
+
The preset supports the following options:
|
|
91
|
+
|
|
92
|
+
| Name | Default value | Description |
|
|
93
|
+
| --------------------- | ------------- | --------------------------------------------------- |
|
|
94
|
+
| includeFontFallback | `true` | Whether the preset includes a font fallback |
|
|
95
|
+
| legacyV1Compatibility | `false` | Configures partial compatibility with Grunnmuren v1 |
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = {"OBOSText":{"font-family":"\"__OBOSText_Fallback\"","src":"local(\"Arial\")","size-adjust":"100%","ascent-override":"94%","descent-override":"26%","line-gap-override":"0%"},"OBOSDisplay":{"font-family":"\"__OBOSDisplay_Fallback\"","src":"local(\"Arial\")","size-adjust":"100%","ascent-override":"94%","descent-override":"26%","line-gap-override":"0%"}}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@obosbbl/grunnmuren-tailwind",
|
|
3
|
-
"version": "2.0.0-canary.
|
|
3
|
+
"version": "2.0.0-canary.11",
|
|
4
4
|
"description": "Grunnmuren Tailwind preset",
|
|
5
5
|
"repository": {
|
|
6
6
|
"url": "https://github.com/code-obos/grunnmuren"
|
|
@@ -11,16 +11,21 @@
|
|
|
11
11
|
".": "./tailwind-base.cjs"
|
|
12
12
|
},
|
|
13
13
|
"files": [
|
|
14
|
-
"tailwind-base.cjs"
|
|
14
|
+
"tailwind-base.cjs",
|
|
15
|
+
"fonts/font-fallback.js"
|
|
15
16
|
],
|
|
16
17
|
"dependencies": {
|
|
17
18
|
"@tailwindcss/aspect-ratio": "^0.4.2",
|
|
18
|
-
"@tailwindcss/typography": "^0.5.10"
|
|
19
|
+
"@tailwindcss/typography": "^0.5.10",
|
|
20
|
+
"tailwindcss-animate": "^1.0.7"
|
|
19
21
|
},
|
|
20
22
|
"devDependencies": {
|
|
21
|
-
"tailwindcss": "3.
|
|
23
|
+
"tailwindcss": "3.4.17"
|
|
22
24
|
},
|
|
23
25
|
"peerDependencies": {
|
|
24
|
-
"tailwindcss": "^3.
|
|
26
|
+
"tailwindcss": "^3.4.0"
|
|
27
|
+
},
|
|
28
|
+
"scripts": {
|
|
29
|
+
"font-fallback": "bun --cwd=./fonts ./generate-font-fallback.ts"
|
|
25
30
|
}
|
|
26
31
|
}
|
package/tailwind-base.cjs
CHANGED
|
@@ -1,32 +1,148 @@
|
|
|
1
|
+
const defaultTheme = require('tailwindcss/defaultTheme');
|
|
1
2
|
const plugin = require('tailwindcss/plugin');
|
|
3
|
+
const fontFallbacks = require('./fonts/font-fallback');
|
|
2
4
|
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
const fontDeclarations = {
|
|
6
|
+
OBOSText: [
|
|
7
|
+
{
|
|
8
|
+
fontWeight: 400,
|
|
9
|
+
fontStyle: 'normal',
|
|
10
|
+
url: 'https://www.obos.no/fonts/OBOSText-Regular.woff2',
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
fontWeight: 400,
|
|
14
|
+
fontStyle: 'italic',
|
|
15
|
+
url: 'https://www.obos.no/fonts/OBOSText-Italic.woff2',
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
fontWeight: 500,
|
|
19
|
+
fontStyle: 'normal',
|
|
20
|
+
url: 'https://www.obos.no/fonts/OBOSText-Medium.woff2',
|
|
21
|
+
},
|
|
22
|
+
],
|
|
23
|
+
OBOSDisplay: [
|
|
24
|
+
{
|
|
25
|
+
url: 'https://www.obos.no/fonts/OBOSDisplay-SemiBold.woff2',
|
|
26
|
+
},
|
|
27
|
+
],
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Styles for typography that are reused in both component classes and prose (through the tailwind typography plugin)
|
|
32
|
+
*/
|
|
33
|
+
const typography = {
|
|
34
|
+
headingXlText: {
|
|
35
|
+
fontWeight: 'semibold',
|
|
36
|
+
small: {
|
|
37
|
+
fontSize: '2.8125rem',
|
|
38
|
+
lineHeight: '3.625rem',
|
|
39
|
+
},
|
|
40
|
+
large: {
|
|
41
|
+
fontSize: '3.9375rem',
|
|
42
|
+
lineHeight: '5.125rem',
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
headingLText: {
|
|
46
|
+
fontWeight: 'semibold',
|
|
47
|
+
small: {
|
|
48
|
+
fontSize: '1.8125rem',
|
|
49
|
+
lineHeight: '2.75rem',
|
|
50
|
+
},
|
|
51
|
+
large: {
|
|
52
|
+
fontSize: '2.25rem',
|
|
53
|
+
lineHeight: '3.5rem',
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
headingMText: {
|
|
57
|
+
fontWeight: 'medium',
|
|
58
|
+
small: {
|
|
59
|
+
fontSize: '1.4375rem',
|
|
60
|
+
lineHeight: '2.25rem',
|
|
61
|
+
},
|
|
62
|
+
large: {
|
|
63
|
+
fontSize: '1.625rem',
|
|
64
|
+
lineHeight: '2.5625rem',
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
headingSText: {
|
|
68
|
+
fontWeight: 'medium',
|
|
69
|
+
small: {
|
|
70
|
+
fontSize: '1.1875rem',
|
|
71
|
+
lineHeight: '1.1875rem',
|
|
72
|
+
},
|
|
73
|
+
large: {
|
|
74
|
+
fontSize: '1.3125rem',
|
|
75
|
+
lineHeight: '2.125rem',
|
|
76
|
+
},
|
|
8
77
|
},
|
|
9
|
-
{
|
|
10
|
-
fontWeight:
|
|
11
|
-
|
|
12
|
-
|
|
78
|
+
headingXsText: {
|
|
79
|
+
fontWeight: 'medium',
|
|
80
|
+
small: {
|
|
81
|
+
fontSize: '1.125rem',
|
|
82
|
+
lineHeight: '1.75rem',
|
|
83
|
+
},
|
|
84
|
+
large: {
|
|
85
|
+
fontSize: '1.1875rem',
|
|
86
|
+
lineHeight: '1.9375rem',
|
|
87
|
+
},
|
|
13
88
|
},
|
|
14
|
-
{
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
url: 'https://www.obos.no/fonts/OBOSText-Medium.woff2',
|
|
89
|
+
paragraphText: {
|
|
90
|
+
fontSize: '1rem', // 1rem is the base font size, which is obviously the default size. But it is set explicitly here to make it easier to configure in the future, if this size changes.
|
|
91
|
+
lineHeight: '1.625rem',
|
|
18
92
|
},
|
|
19
|
-
{
|
|
20
|
-
fontWeight:
|
|
21
|
-
|
|
22
|
-
|
|
93
|
+
leadText: {
|
|
94
|
+
fontWeight: 'medium',
|
|
95
|
+
small: {
|
|
96
|
+
fontSize: '1.4375rem',
|
|
97
|
+
lineHeight: '2.25rem',
|
|
98
|
+
},
|
|
99
|
+
large: {
|
|
100
|
+
fontSize: '1.625rem',
|
|
101
|
+
lineHeight: '2.5625rem',
|
|
102
|
+
},
|
|
23
103
|
},
|
|
24
|
-
|
|
104
|
+
blockquoteText: {
|
|
105
|
+
fontWeight: 'medium',
|
|
106
|
+
display: 'grid',
|
|
107
|
+
gridTemplateColumns: '3rem 1fr',
|
|
108
|
+
columnGap: '0.4375rem',
|
|
109
|
+
small: {
|
|
110
|
+
fontSize: '1.4375rem',
|
|
111
|
+
lineHeight: '2.25rem',
|
|
112
|
+
},
|
|
113
|
+
large: {
|
|
114
|
+
fontSize: '1.625rem',
|
|
115
|
+
lineHeight: '2.5625rem',
|
|
116
|
+
},
|
|
117
|
+
before: {
|
|
118
|
+
content: '"“"',
|
|
119
|
+
fontFamily: 'OBOSDisplay',
|
|
120
|
+
fontSize: '4.6875rem',
|
|
121
|
+
lineHeight: '1.6875rem',
|
|
122
|
+
fontWeight: '400',
|
|
123
|
+
fontStyle: 'normal',
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
descriptionText: {
|
|
127
|
+
small: {
|
|
128
|
+
fontSize: '0.875rem',
|
|
129
|
+
lineHeight: '1.4375rem',
|
|
130
|
+
},
|
|
131
|
+
large: {
|
|
132
|
+
fontSize: '0.875rem',
|
|
133
|
+
lineHeight: '1.375rem',
|
|
134
|
+
},
|
|
135
|
+
},
|
|
136
|
+
};
|
|
25
137
|
|
|
26
138
|
/**
|
|
139
|
+
* @param {boolean} options.includeFontFallback
|
|
27
140
|
* @param {boolean} options.legacyV1Compatibility
|
|
28
141
|
*/
|
|
29
142
|
module.exports = (options = {}) => {
|
|
143
|
+
options.includeFontFallback ??= true;
|
|
144
|
+
options.legacyV1Compatibility ??= false;
|
|
145
|
+
|
|
30
146
|
const v1CompatibilityPlugins = [];
|
|
31
147
|
|
|
32
148
|
if (options.legacyV1Compatibility) {
|
|
@@ -39,18 +155,15 @@ module.exports = (options = {}) => {
|
|
|
39
155
|
);
|
|
40
156
|
}
|
|
41
157
|
|
|
42
|
-
const fontFamily = 'OBOSFont';
|
|
43
|
-
const fonts = obosFonts;
|
|
44
|
-
const containerSize = '92rem';
|
|
45
|
-
|
|
46
158
|
return {
|
|
47
159
|
plugins: [
|
|
48
160
|
...v1CompatibilityPlugins,
|
|
49
161
|
require('@tailwindcss/typography'),
|
|
50
|
-
|
|
162
|
+
require('tailwindcss-animate'),
|
|
163
|
+
plugin(({ addBase, addComponents, theme }) => {
|
|
51
164
|
addBase({
|
|
52
165
|
html: {
|
|
53
|
-
'@apply text-black antialiased font-normal': {},
|
|
166
|
+
'@apply text-black antialiased font-normal font-text': {},
|
|
54
167
|
},
|
|
55
168
|
b: {
|
|
56
169
|
fontWeight: 500,
|
|
@@ -62,21 +175,68 @@ module.exports = (options = {}) => {
|
|
|
62
175
|
'text-decoration': 'underline',
|
|
63
176
|
},
|
|
64
177
|
'::selection': { '@apply bg-mint text-black': {} },
|
|
178
|
+
':root': {
|
|
179
|
+
'--gm-container-width': '92rem',
|
|
180
|
+
'--gm-container-gutter-width': '1rem',
|
|
181
|
+
|
|
182
|
+
'--gm-color-black': hexToRgb('#333'),
|
|
183
|
+
'--gm-color-white': hexToRgb('#fff'),
|
|
184
|
+
|
|
185
|
+
'--gm-color-gray': hexToRgb('#818181'),
|
|
186
|
+
'--gm-color-gray-dark': hexToRgb('#595959'),
|
|
187
|
+
'--gm-color-gray-light': hexToRgb('#e6e6e6'),
|
|
188
|
+
'--gm-color-gray-lightest': hexToRgb('#f1f1f1'),
|
|
189
|
+
|
|
190
|
+
'--gm-color-sky': hexToRgb('#bedfec'),
|
|
191
|
+
'--gm-color-sky-light': hexToRgb('#deeff5'),
|
|
192
|
+
'--gm-color-sky-lightest': hexToRgb('#ebf5f9'),
|
|
193
|
+
|
|
194
|
+
'--gm-color-mint': hexToRgb('#cdece2'),
|
|
195
|
+
'--gm-color-mint-light': hexToRgb('#e6f5f0'),
|
|
196
|
+
'--gm-color-mint-lightest': hexToRgb('#f0f9f6'),
|
|
197
|
+
|
|
198
|
+
'--gm-color-blue': hexToRgb('#0047ba'),
|
|
199
|
+
'--gm-color-blue-light': hexToRgb('#bedfec'),
|
|
200
|
+
'--gm-color-blue-lightest': hexToRgb('#deeff5'),
|
|
201
|
+
'--gm-color-blue-dark': hexToRgb('#002169'),
|
|
202
|
+
|
|
203
|
+
'--gm-color-green': hexToRgb('#008761'),
|
|
204
|
+
'--gm-color-green-dark': hexToRgb('#00524c'),
|
|
205
|
+
'--gm-color-green-light': hexToRgb('#cdece2'),
|
|
206
|
+
'--gm-color-green-lightest': hexToRgb('#e6f5f0'),
|
|
207
|
+
|
|
208
|
+
'--gm-color-red': hexToRgb('#c0385d'),
|
|
209
|
+
'--gm-color-red-light': hexToRgb('#faedef'),
|
|
210
|
+
|
|
211
|
+
'--gm-color-orange': hexToRgb('#e8a74a'),
|
|
212
|
+
'--gm-color-orange-light': hexToRgb('#f8e5c9'),
|
|
213
|
+
|
|
214
|
+
'--gm-color-yellow': hexToRgb('#fff5d2'),
|
|
215
|
+
},
|
|
65
216
|
});
|
|
66
217
|
|
|
67
218
|
addComponents({
|
|
219
|
+
'.page-layout': {
|
|
220
|
+
display: 'flex',
|
|
221
|
+
flexDirection: 'column',
|
|
222
|
+
minHeight: '100vh',
|
|
223
|
+
},
|
|
224
|
+
'.page-layout-main': {
|
|
225
|
+
backgroundColor: theme('colors.white'),
|
|
226
|
+
flexGrow: '1',
|
|
227
|
+
},
|
|
68
228
|
'.container': {
|
|
69
229
|
width: '100%',
|
|
70
|
-
paddingLeft: '
|
|
71
|
-
paddingRight: '
|
|
230
|
+
paddingLeft: 'var(--gm-container-gutter-width)',
|
|
231
|
+
paddingRight: 'var(--gm-container-gutter-width)',
|
|
72
232
|
marginLeft: 'auto',
|
|
73
233
|
marginRight: 'auto',
|
|
74
|
-
maxWidth:
|
|
234
|
+
maxWidth: 'var(--gm-container-width)',
|
|
75
235
|
},
|
|
76
236
|
'.container-prose': {
|
|
77
237
|
width: '100%',
|
|
78
|
-
paddingLeft: '
|
|
79
|
-
paddingRight: '
|
|
238
|
+
paddingLeft: 'var(--gm-container-gutter-width)',
|
|
239
|
+
paddingRight: 'var(--gm-container-gutter-width)',
|
|
80
240
|
marginLeft: 'auto',
|
|
81
241
|
marginRight: 'auto',
|
|
82
242
|
maxWidth: '45.5rem',
|
|
@@ -84,57 +244,141 @@ module.exports = (options = {}) => {
|
|
|
84
244
|
});
|
|
85
245
|
}),
|
|
86
246
|
|
|
87
|
-
plugin(
|
|
247
|
+
plugin(({ addBase, addComponents }) => {
|
|
248
|
+
const {
|
|
249
|
+
headingXlText,
|
|
250
|
+
headingLText,
|
|
251
|
+
headingMText,
|
|
252
|
+
headingSText,
|
|
253
|
+
headingXsText,
|
|
254
|
+
paragraphText,
|
|
255
|
+
leadText,
|
|
256
|
+
blockquoteText,
|
|
257
|
+
descriptionText,
|
|
258
|
+
} = typography;
|
|
259
|
+
|
|
88
260
|
// This is tailwind syntax for setting both the font-size and the line-height
|
|
89
|
-
const
|
|
90
|
-
const
|
|
91
|
-
const
|
|
92
|
-
const
|
|
261
|
+
const headingXl = `@apply font-display font-${headingXlText.fontWeight} text-[${headingXlText.small.fontSize}]/[${headingXlText.small.lineHeight}] lg:text-[${headingXlText.large.fontSize}]/[${headingXlText.large.lineHeight}]`;
|
|
262
|
+
const headingL = `@apply font-display font-${headingLText.fontWeight} text-[${headingLText.small.fontSize}]/[${headingLText.small.lineHeight}] lg:text-[${headingLText.large.fontSize}]/[${headingLText.large.lineHeight}]`;
|
|
263
|
+
const headingM = `@apply font-text font-${headingMText.fontWeight} text-[${headingMText.small.fontSize}]/[${headingMText.small.lineHeight}] lg:text-[${headingMText.large.fontSize}]/[${headingMText.large.lineHeight}]`;
|
|
264
|
+
const headingS = `@apply font-text font-${headingSText.fontWeight} text-[${headingSText.small.fontSize}]/[${headingSText.small.lineHeight}] lg:text-[${headingSText.large.fontSize}]/[${headingSText.large.lineHeight}]`;
|
|
265
|
+
const headingXs = `@apply font-text font-${headingXsText.fontWeight} text-[${headingXsText.small.fontSize}]/[${headingXsText.small.lineHeight}] lg:text-[${headingXsText.large.fontSize}]/[${headingXsText.large.lineHeight}]`;
|
|
266
|
+
|
|
267
|
+
const paragraph = `@apply text-[${paragraphText.fontSize}]/[${paragraphText.lineHeight}]`;
|
|
268
|
+
const lead = `@apply font-medium text-[${leadText.small.fontSize}]/[${leadText.small.lineHeight}] lg:text-[${leadText.large.fontSize}]/[${leadText.large.lineHeight}]`;
|
|
269
|
+
|
|
270
|
+
const blockquote = `@apply font-${blockquoteText.fontWeight} italic grid grid-cols-[${blockquoteText.gridTemplateColumns.split(' ').join('_')}] gap-x-[${blockquoteText.columnGap}] pt-4
|
|
271
|
+
text-[${blockquoteText.large.fontSize}]/[${blockquoteText.large.lineHeight}] lg:text-[${blockquoteText.small.fontSize}]/[${blockquoteText.small.lineHeight}]
|
|
272
|
+
before:text-[${blockquoteText.before.fontSize}]/[${blockquoteText.before.lineHeight}] before:content-[${blockquoteText.before.content}] before:font-display before:not-italic`;
|
|
273
|
+
|
|
274
|
+
const description = `@apply text-[${descriptionText.large.fontSize}]/[${descriptionText.large.lineHeight}] lg:text-[${descriptionText.small.fontSize}]/[${descriptionText.small.lineHeight}]`;
|
|
93
275
|
|
|
94
276
|
if (options.legacyV1Compatibility) {
|
|
95
277
|
addBase({
|
|
96
278
|
h1: {
|
|
97
|
-
[
|
|
279
|
+
[headingXl]: {},
|
|
98
280
|
},
|
|
99
281
|
h2: {
|
|
100
|
-
[
|
|
282
|
+
[headingL]: {},
|
|
101
283
|
},
|
|
102
284
|
h3: {
|
|
103
|
-
[
|
|
285
|
+
[headingM]: {},
|
|
104
286
|
},
|
|
105
287
|
h4: {
|
|
106
|
-
[
|
|
288
|
+
[headingS]: {},
|
|
107
289
|
},
|
|
108
290
|
});
|
|
109
291
|
}
|
|
110
292
|
|
|
111
293
|
addComponents({
|
|
294
|
+
/** @deprecated Will be replaced by heading-xl */
|
|
112
295
|
'.h1': {
|
|
113
|
-
[
|
|
296
|
+
[headingXl]: {},
|
|
114
297
|
},
|
|
298
|
+
/** @deprecated Will be replaced by heading-l */
|
|
115
299
|
'.h2': {
|
|
116
|
-
[
|
|
300
|
+
[headingL]: {},
|
|
117
301
|
},
|
|
302
|
+
/** @deprecated Will be replaced by heading-m */
|
|
118
303
|
'.h3': {
|
|
119
|
-
[
|
|
304
|
+
[headingM]: {},
|
|
120
305
|
},
|
|
306
|
+
/** @deprecated Will be replaced by heading-s */
|
|
121
307
|
'.h4': {
|
|
122
|
-
[
|
|
308
|
+
[headingS]: {},
|
|
309
|
+
},
|
|
310
|
+
'.heading-xl': {
|
|
311
|
+
[headingXl]: {},
|
|
312
|
+
},
|
|
313
|
+
'.heading-l': {
|
|
314
|
+
[headingL]: {},
|
|
315
|
+
},
|
|
316
|
+
'.heading-m': {
|
|
317
|
+
[headingM]: {},
|
|
318
|
+
},
|
|
319
|
+
'.heading-s': {
|
|
320
|
+
[headingS]: {},
|
|
321
|
+
},
|
|
322
|
+
'.heading-xs': {
|
|
323
|
+
[headingXs]: {},
|
|
324
|
+
},
|
|
325
|
+
'.paragraph': {
|
|
326
|
+
[paragraph]: {},
|
|
327
|
+
},
|
|
328
|
+
'.lead': {
|
|
329
|
+
[lead]: {},
|
|
330
|
+
},
|
|
331
|
+
'.blockquote': {
|
|
332
|
+
[blockquote]: {},
|
|
333
|
+
},
|
|
334
|
+
'.description': {
|
|
335
|
+
[description]: {},
|
|
336
|
+
},
|
|
337
|
+
/** Standard black focus outline */
|
|
338
|
+
'.outline-focus': {
|
|
339
|
+
'@apply outline outline-2 outline-black': {},
|
|
340
|
+
},
|
|
341
|
+
/** Standard black focus outline with offset */
|
|
342
|
+
'.outline-focus-offset': {
|
|
343
|
+
'@apply outline-focus outline-offset-2': {},
|
|
344
|
+
},
|
|
345
|
+
/** Standard black focus outline with negative offset (inset) */
|
|
346
|
+
'.outline-focus-inset': {
|
|
347
|
+
'@apply outline-focus -outline-offset-4': {},
|
|
348
|
+
},
|
|
349
|
+
/** Standard black focus ring */
|
|
350
|
+
'.ring-focus': {
|
|
351
|
+
'@apply ring-2 ring-black': {},
|
|
352
|
+
},
|
|
353
|
+
/** Standard black focus ring with offset */
|
|
354
|
+
'.ring-focus-offset': {
|
|
355
|
+
'@apply ring-focus ring-offset-2': {},
|
|
123
356
|
},
|
|
124
357
|
});
|
|
125
358
|
}),
|
|
126
|
-
plugin(
|
|
359
|
+
plugin(({ addBase }) => {
|
|
127
360
|
addBase(
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
361
|
+
Object.entries(fontDeclarations).flatMap(
|
|
362
|
+
([fontFamily, fontFamilyDeclarations]) =>
|
|
363
|
+
fontFamilyDeclarations.map((font) => ({
|
|
364
|
+
'@font-face': {
|
|
365
|
+
fontFamily,
|
|
366
|
+
fontWeight: font.fontWeight,
|
|
367
|
+
fontStyle: font.fontStyle,
|
|
368
|
+
src: `url('${font.url}') format('woff2')`,
|
|
369
|
+
fontDisplay: 'swap',
|
|
370
|
+
},
|
|
371
|
+
})),
|
|
372
|
+
),
|
|
137
373
|
);
|
|
374
|
+
|
|
375
|
+
if (options.includeFontFallback) {
|
|
376
|
+
addBase(
|
|
377
|
+
Object.values(fontFallbacks).map((fontFallback) => ({
|
|
378
|
+
'@font-face': fontFallback,
|
|
379
|
+
})),
|
|
380
|
+
);
|
|
381
|
+
}
|
|
138
382
|
}),
|
|
139
383
|
],
|
|
140
384
|
theme: {
|
|
@@ -142,56 +386,68 @@ module.exports = (options = {}) => {
|
|
|
142
386
|
inherit: 'inherit',
|
|
143
387
|
current: 'currentColor',
|
|
144
388
|
transparent: 'transparent',
|
|
145
|
-
black: '
|
|
146
|
-
white: '
|
|
389
|
+
black: 'rgb(var(--gm-color-black))',
|
|
390
|
+
white: 'rgb(var(--gm-color-white))',
|
|
147
391
|
gray: {
|
|
148
|
-
DEFAULT: '
|
|
149
|
-
dark: '
|
|
150
|
-
light: '
|
|
151
|
-
lightest: '
|
|
392
|
+
DEFAULT: 'rgb(var(--gm-color-gray))',
|
|
393
|
+
dark: 'rgb(var(--gm-color-gray-dark))',
|
|
394
|
+
light: 'rgb(var(--gm-color-gray-light))',
|
|
395
|
+
lightest: 'rgb(var(--gm-color-gray-lightest))',
|
|
152
396
|
},
|
|
153
397
|
sky: {
|
|
154
|
-
DEFAULT: '
|
|
155
|
-
light: '
|
|
156
|
-
lightest: '
|
|
398
|
+
DEFAULT: 'rgb(var(--gm-color-sky))',
|
|
399
|
+
light: 'rgb(var(--gm-color-sky-light))',
|
|
400
|
+
lightest: 'rgb(var(--gm-color-sky-lightest))',
|
|
157
401
|
},
|
|
158
402
|
mint: {
|
|
159
|
-
DEFAULT: '
|
|
160
|
-
light: '
|
|
161
|
-
lightest: '
|
|
403
|
+
DEFAULT: 'rgb(var(--gm-color-mint))',
|
|
404
|
+
light: 'rgb(var(--gm-color-mint-light))',
|
|
405
|
+
lightest: 'rgb(var(--gm-color-mint-lightest))',
|
|
162
406
|
},
|
|
163
407
|
blue: {
|
|
164
408
|
// OBOS Blue/Primary brand
|
|
165
|
-
DEFAULT: '
|
|
166
|
-
light: '#BEDFEC',
|
|
167
|
-
lightest: '#DEEFF5',
|
|
409
|
+
DEFAULT: 'rgb(var(--gm-color-blue))',
|
|
168
410
|
// OBOS Ocean
|
|
169
|
-
dark: '
|
|
411
|
+
dark: 'rgb(var(--gm-color-blue-dark))',
|
|
412
|
+
light: 'rgb(var(--gm-color-blue-light))',
|
|
413
|
+
lightest: 'rgb(var(--gm-color-blue-lightest))',
|
|
170
414
|
},
|
|
171
415
|
green: {
|
|
172
416
|
// OBOS Green/Primary brand
|
|
173
|
-
DEFAULT: '
|
|
174
|
-
lightest: '#E6F5F0',
|
|
175
|
-
light: '#CDECE2',
|
|
417
|
+
DEFAULT: 'rgb(var(--gm-color-green))',
|
|
176
418
|
// OBOS Forest
|
|
177
|
-
dark: '
|
|
419
|
+
dark: 'rgb(var(--gm-color-green-dark))',
|
|
420
|
+
light: 'rgb(var(--gm-color-green-light))',
|
|
421
|
+
lightest: 'rgb(var(--gm-color-green-lightest))',
|
|
178
422
|
},
|
|
179
423
|
red: {
|
|
180
|
-
DEFAULT: '
|
|
424
|
+
DEFAULT: 'rgb(var(--gm-color-red))',
|
|
181
425
|
// error red
|
|
182
|
-
light: '
|
|
426
|
+
light: 'rgb(var(--gm-color-red-light))',
|
|
183
427
|
},
|
|
184
428
|
orange: {
|
|
185
|
-
DEFAULT: '
|
|
186
|
-
light: '
|
|
429
|
+
DEFAULT: 'rgb(var(--gm-color-orange))',
|
|
430
|
+
light: 'rgb(var(--gm-color-orange-light))',
|
|
187
431
|
},
|
|
188
432
|
yellow: {
|
|
189
433
|
// open house
|
|
190
|
-
DEFAULT: '
|
|
434
|
+
DEFAULT: 'rgb(var(--gm-color-yellow))',
|
|
191
435
|
},
|
|
192
436
|
},
|
|
193
437
|
fontFamily: {
|
|
194
|
-
|
|
438
|
+
text: [
|
|
439
|
+
'OBOSText',
|
|
440
|
+
options.includeFontFallback && fontFallbacks.OBOSText['font-family'],
|
|
441
|
+
'sans-serif',
|
|
442
|
+
].filter((f) => f),
|
|
443
|
+
display: [
|
|
444
|
+
'OBOSDisplay',
|
|
445
|
+
options.includeFontFallback &&
|
|
446
|
+
fontFallbacks.OBOSDisplay['font-family'],
|
|
447
|
+
'sans-serif',
|
|
448
|
+
],
|
|
449
|
+
// OBOS doesn't have monospaced font, so we keep Tailwind's default here
|
|
450
|
+
mono: defaultTheme.fontFamily.mono,
|
|
195
451
|
},
|
|
196
452
|
extend: {
|
|
197
453
|
maxWidth: {
|
|
@@ -215,59 +471,101 @@ module.exports = (options = {}) => {
|
|
|
215
471
|
'--tw-prose-headings': 'inherit',
|
|
216
472
|
'--tw-prose-lead': 'inherit',
|
|
217
473
|
'--tw-prose-links': 'inherit',
|
|
218
|
-
'--tw-prose-quotes':
|
|
219
|
-
'--tw-prose-quote-borders': theme('colors.green.DEFAULT'),
|
|
474
|
+
'--tw-prose-quotes': 'inherit',
|
|
220
475
|
'--tw-prose-counters': theme('colors.black'),
|
|
221
|
-
'--tw-prose-bullets': theme('colors.
|
|
476
|
+
'--tw-prose-bullets': theme('colors.black'),
|
|
222
477
|
color: theme('colors.black'),
|
|
223
478
|
maxWidth: theme('maxWidth.prose'),
|
|
224
479
|
a: {
|
|
225
480
|
fontWeight: 400,
|
|
226
481
|
},
|
|
227
482
|
h1: {
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
483
|
+
fontFamily: 'OBOSDisplay',
|
|
484
|
+
fontWeight: theme('fontWeight.semibold'),
|
|
485
|
+
...typography.headingXlText.small,
|
|
486
|
+
'@media (min-width: theme("screens.lg"))': {
|
|
487
|
+
...typography.headingXlText.large,
|
|
232
488
|
},
|
|
233
489
|
},
|
|
234
490
|
h2: {
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
491
|
+
fontFamily: 'OBOSDisplay',
|
|
492
|
+
fontWeight: theme('fontWeight.semibold'),
|
|
493
|
+
...typography.headingLText.small,
|
|
494
|
+
'@media (min-width: theme("screens.lg"))': {
|
|
495
|
+
...typography.headingLText.large,
|
|
239
496
|
},
|
|
240
497
|
},
|
|
241
498
|
h3: {
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
499
|
+
fontFamily: 'OBOSText',
|
|
500
|
+
fontWeight: theme('fontWeight.medium'),
|
|
501
|
+
...typography.headingMText.small,
|
|
502
|
+
'@media (min-width: theme("screens.lg"))': {
|
|
503
|
+
...typography.headingMText.large,
|
|
246
504
|
},
|
|
247
505
|
},
|
|
248
506
|
h4: {
|
|
507
|
+
fontFamily: 'OBOSText',
|
|
508
|
+
fontWeight: theme('fontWeight.medium'),
|
|
509
|
+
...typography.headingSText.small,
|
|
510
|
+
'@media (min-width: theme("screens.lg"))': {
|
|
511
|
+
...typography.headingSText.large,
|
|
512
|
+
},
|
|
513
|
+
},
|
|
514
|
+
h5: {
|
|
515
|
+
fontFamily: 'OBOSText',
|
|
249
516
|
fontWeight: theme('fontWeight.bold'),
|
|
250
|
-
|
|
251
|
-
'@media (min-width: theme("screens.
|
|
252
|
-
|
|
517
|
+
...typography.headingXsText.small,
|
|
518
|
+
'@media (min-width: theme("screens.lg"))': {
|
|
519
|
+
...typography.headingXsText.large,
|
|
253
520
|
},
|
|
254
521
|
},
|
|
255
522
|
li: {
|
|
256
|
-
|
|
257
|
-
|
|
523
|
+
...typography.paragraphText.small,
|
|
524
|
+
'@media (min-width: theme("screens.lg"))': {
|
|
525
|
+
...typography.paragraphText.large,
|
|
526
|
+
},
|
|
258
527
|
},
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
528
|
+
p: {
|
|
529
|
+
...typography.paragraphText.small,
|
|
530
|
+
'@media (min-width: theme("screens.lg"))': {
|
|
531
|
+
...typography.paragraphText.large,
|
|
532
|
+
},
|
|
262
533
|
},
|
|
263
|
-
|
|
264
|
-
|
|
534
|
+
strong: {
|
|
535
|
+
fontWeight: theme('fontWeight.medium'),
|
|
265
536
|
},
|
|
266
|
-
|
|
267
|
-
|
|
537
|
+
blockquote: {
|
|
538
|
+
// Reset defaults:
|
|
539
|
+
marginBottom: 'unset',
|
|
540
|
+
padding: 'unset',
|
|
541
|
+
border: 'unset',
|
|
542
|
+
fontWeight: theme('fontWeight.medium'),
|
|
543
|
+
fontStyle: 'italic',
|
|
544
|
+
display: typography.blockquoteText.display,
|
|
545
|
+
gridTemplateColumns:
|
|
546
|
+
typography.blockquoteText.gridTemplateColumns,
|
|
547
|
+
columnGap: typography.blockquoteText.columnGap,
|
|
548
|
+
paddingTop: '1rem',
|
|
549
|
+
...typography.blockquoteText.small,
|
|
550
|
+
'@media (min-width: theme("screens.lg"))': {
|
|
551
|
+
...typography.blockquoteText.large,
|
|
552
|
+
},
|
|
553
|
+
},
|
|
554
|
+
'blockquote::before': {
|
|
555
|
+
...typography.blockquoteText.before,
|
|
268
556
|
},
|
|
269
557
|
'[class~="lead"]': {
|
|
270
558
|
fontWeight: theme('fontWeight.medium'),
|
|
559
|
+
...typography.leadText.small,
|
|
560
|
+
'@media (min-width: theme("screens.lg"))': {
|
|
561
|
+
...typography.leadText.large,
|
|
562
|
+
},
|
|
563
|
+
},
|
|
564
|
+
'[class~="description"]': {
|
|
565
|
+
...typography.descriptionText.small,
|
|
566
|
+
'@media (min-width: theme("screens.lg"))': {
|
|
567
|
+
...typography.descriptionText.large,
|
|
568
|
+
},
|
|
271
569
|
},
|
|
272
570
|
},
|
|
273
571
|
},
|
|
@@ -277,8 +575,34 @@ module.exports = (options = {}) => {
|
|
|
277
575
|
};
|
|
278
576
|
};
|
|
279
577
|
|
|
578
|
+
/**
|
|
579
|
+
* A function that takes in a hex color as a string and returns a string with the color's rgb values.
|
|
580
|
+
* @param {string} hex
|
|
581
|
+
* @returns {string} The rgb values of the color.
|
|
582
|
+
*/
|
|
583
|
+
function hexToRgb(hex) {
|
|
584
|
+
// Remove the hash (#) at the start if it's there
|
|
585
|
+
let hexValue = hex.replace(/^#/, '');
|
|
586
|
+
|
|
587
|
+
// If the hex value is shorthand (3 characters), expand it to 6 characters
|
|
588
|
+
if (hexValue.length === 3) {
|
|
589
|
+
hexValue = hexValue
|
|
590
|
+
.split('')
|
|
591
|
+
.map((char) => char + char)
|
|
592
|
+
.join('');
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
// Parse the r, g, and b values from the hex string
|
|
596
|
+
const r = Number.parseInt(hexValue.substring(0, 2), 16);
|
|
597
|
+
const g = Number.parseInt(hexValue.substring(2, 4), 16);
|
|
598
|
+
const b = Number.parseInt(hexValue.substring(4, 6), 16);
|
|
599
|
+
|
|
600
|
+
// Return the RGB values as a whitespace-separated string
|
|
601
|
+
return `${r} ${g} ${b}`;
|
|
602
|
+
}
|
|
603
|
+
|
|
280
604
|
// These custom components are only used for v1 compat
|
|
281
|
-
const button = plugin(
|
|
605
|
+
const button = plugin(({ addComponents, theme }) => {
|
|
282
606
|
const hoverLoadingBgColor = 'rgba(0, 0, 0, 0.1)';
|
|
283
607
|
|
|
284
608
|
addComponents({
|
|
@@ -335,7 +659,7 @@ const button = plugin(function ({ addComponents, theme }) {
|
|
|
335
659
|
});
|
|
336
660
|
});
|
|
337
661
|
|
|
338
|
-
const radio = plugin(
|
|
662
|
+
const radio = plugin(({ addComponents, theme }) => {
|
|
339
663
|
addComponents({
|
|
340
664
|
'.radio': {
|
|
341
665
|
// hide the native radio input
|
|
@@ -380,7 +704,7 @@ const radio = plugin(function ({ addComponents, theme }) {
|
|
|
380
704
|
});
|
|
381
705
|
});
|
|
382
706
|
|
|
383
|
-
const checkbox = plugin(
|
|
707
|
+
const checkbox = plugin(({ addComponents, theme }) => {
|
|
384
708
|
addComponents({
|
|
385
709
|
'.checkbox': {
|
|
386
710
|
'&::before': {
|
|
@@ -401,7 +725,7 @@ const checkbox = plugin(function ({ addComponents, theme }) {
|
|
|
401
725
|
});
|
|
402
726
|
});
|
|
403
727
|
|
|
404
|
-
const snackbar = plugin(
|
|
728
|
+
const snackbar = plugin(({ addComponents, theme }) => {
|
|
405
729
|
addComponents({
|
|
406
730
|
'.snackbar': {
|
|
407
731
|
'grid-template-columns': 'min-content auto',
|