@solfacil/girassol 0.2.0 → 0.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.
@@ -0,0 +1,104 @@
1
+ type Data = {
2
+ colors: Record<string, any>
3
+ spacing: Record<string, any>
4
+ }
5
+
6
+ type Args = {
7
+ activeSafeList: boolean
8
+ data: Data
9
+ }
10
+
11
+ export function safelist({ activeSafeList = true, data }: Args): string[] {
12
+ if (activeSafeList) {
13
+ const colors = data.colors ? safelistElementColors(safelistColors(data.colors)) : []
14
+ const spacing = data.spacing ? safelistSpacing(data.spacing) : []
15
+
16
+ const gaps = range(20).map(i => `gap-${i}`)
17
+ const gridRows = range(14).map(i => `grid-rows-${i}`)
18
+ const gridCols = range(14).map(i => `grid-cols-${i}`)
19
+ const rowsStart = range(14).map(i => `row-start-${i}`)
20
+ const colsStart = range(14).map(i => `col-start-${i}`)
21
+ const rowsSpan = range(14).map(i => `row-span-${i}`)
22
+ const colsSpan = range(14).map(i => `col-span-${i}`)
23
+
24
+ return [
25
+ ...colors,
26
+ ...spacing,
27
+ ...gaps,
28
+ ...gridRows,
29
+ ...gridCols,
30
+ ...rowsStart,
31
+ ...colsStart,
32
+ ...rowsSpan,
33
+ ...colsSpan,
34
+ ]
35
+ }
36
+
37
+
38
+ return []
39
+ }
40
+
41
+ export function safelistColors(colors: Data['colors']) {
42
+ const colorsNames: string[] = []
43
+
44
+ for (const category in colors) {
45
+ for (const color in colors[category]) {
46
+ const current = colors[category][color]
47
+
48
+ if (typeof current === 'string') {
49
+ colorsNames.push(`${category}-${color}`)
50
+ }
51
+
52
+ if (typeof current === 'object') {
53
+ for (const insideColor in colors[category][color]) {
54
+ colorsNames.push(`${category}-${color}-${insideColor}`)
55
+ }
56
+ }
57
+ }
58
+ }
59
+
60
+ return colorsNames
61
+ }
62
+
63
+ export function safelistElementColors(colorsNames: string[]) {
64
+ const elements = ['text', 'bg', 'outline', 'fill', 'stroke', 'border', 'text-decoration-color', 'text-stroke-color']
65
+ const elementColors: string[] = []
66
+
67
+ elements.forEach((element: string) => {
68
+ colorsNames.forEach((color: string) => {
69
+ elementColors.push(`${element}-${color}`)
70
+ })
71
+ })
72
+
73
+ return elementColors
74
+ }
75
+
76
+
77
+ export function safelistSpacing(spacing: Data['spacing']): string[] {
78
+ const spacingTokenNames = Object.keys(spacing)
79
+ const paddings = ['p', 'px', 'py', 'pl', 'pr', 'pt', 'pb']
80
+ const margins = ['m', 'mx', 'my', 'ml', 'mr', 'mt', 'mb']
81
+
82
+ const typos = ['text', 'tracking', 'decoration', 'underline-offset', 'indent', 'text-stroke']
83
+ const svg = ['stroke']
84
+ const border = ['border-a', 'border-x', 'border-y', 'border-l', 'border-r', 'border-t', 'border-b']
85
+
86
+ const elements = [...paddings, ...margins, ...typos, ...svg, ...border]
87
+
88
+ const elementSpacing: string[] = []
89
+
90
+ elements.forEach((element: string) => {
91
+ spacingTokenNames.forEach((space: string) => {
92
+ elementSpacing.push(`${element}-${space}`)
93
+ })
94
+ })
95
+
96
+ margins.forEach(margin => elementSpacing.push(`${margin}-auto`))
97
+ paddings.forEach(padding => elementSpacing.push(`${padding}-auto`))
98
+
99
+ return elementSpacing
100
+ }
101
+
102
+ export function range(size: number, startAt = 1) {
103
+ return Array.from(Array(size).keys()).map(i => i + startAt)
104
+ }
@@ -1,32 +1,41 @@
1
1
  export default {
2
2
  brand: {
3
3
  primary: {
4
+ pure: '#000000',
5
+ light: '#a3a3a3',
6
+ medium: '#666666',
7
+ dark: '#212121',
8
+ },
9
+ secondary: {
4
10
  medium: '#BFFF00',
5
11
  light: '#EFFFC1',
6
12
  pure: '#00B569',
7
13
  dark: '#008859',
8
14
  },
9
15
  },
16
+
10
17
  highlight: {
11
18
  pure: '#8250DF',
12
19
  light: '#E6DCF9',
13
20
  medium: '#C0A7EF',
14
21
  dark: '#342059',
15
22
  },
23
+
16
24
  neutral: {
17
25
  low: {
18
26
  pure: '#000000',
19
- light: '#888888',
20
- medium: '#555555',
27
+ light: '#757575',
28
+ medium: '#505050',
21
29
  dark: '#222222',
22
30
  },
23
31
  high: {
24
32
  pure: '#ffffff',
25
- light: '#F5f5f5',
26
- medium: '#e0e0e0',
27
- dark: '#cccccc',
33
+ light: '#F0f0f0',
34
+ medium: '#dedede',
35
+ dark: '#c8c8c8',
28
36
  },
29
37
  },
38
+
30
39
  feedback: {
31
40
  positive: {
32
41
  pure: '#1CA36F',
@@ -2,16 +2,16 @@ export default {
2
2
  opacity: {
3
3
  'DEFAULT': 1,
4
4
 
5
- strong: 0.8,
5
+ semiopaque: 0.8,
6
6
  intense: 0.6,
7
- moderate: 0.32,
8
- weak: 0.16,
7
+ medium: 0.32,
8
+ light: 0.16,
9
9
  },
10
10
 
11
11
  boxShadow: {
12
12
  weak: '0px 4px 8px rgba(41, 41, 41, 0.08)',
13
13
  moderate: '0px 8px 24px rgba(41, 41, 41, 0.16)',
14
- intense: '0px 16px 32px rgba(41, 41, 41, 0.24)',
15
- strong: '0px 16px 48px rgba(41, 41, 41, 0.24)',
14
+ intense: '0px 16px 32px rgba(41, 41, 41, 0.32)',
15
+ strong: '0px 16px 48px rgba(41, 41, 41, 0.32)',
16
16
  },
17
17
  }
@@ -5,7 +5,7 @@ import spacing from './spacing'
5
5
  import effects from './effects'
6
6
  import misc from './miscs'
7
7
 
8
- import { debug, maxLines, outlinesForFocus, placeholder } from './utilities'
8
+ import { componentTypos ,debug, maxLines, outlinesForFocus, placeholder } from './utilities'
9
9
 
10
10
 
11
11
  export {
@@ -18,6 +18,7 @@ export {
18
18
  }
19
19
 
20
20
  export const utilities = {
21
+ componentTypos,
21
22
  outlinesForFocus,
22
23
  maxLines,
23
24
  debug,
@@ -14,6 +14,7 @@ export default {
14
14
  '2xl': '5rem',
15
15
  '3xl': '6rem',
16
16
  'mega': '7.5rem',
17
+ 'huge': '10rem',
17
18
  'giga': '12.5rem',
18
19
  },
19
20
 
@@ -32,6 +33,7 @@ export default {
32
33
  '2xl': '5rem',
33
34
  '3xl': '6rem',
34
35
  'mega': '7.5rem',
36
+ 'huge': '10rem',
35
37
  'giga': '12.5rem',
36
38
  },
37
39
 
@@ -50,6 +52,7 @@ export default {
50
52
  '2xl': '5rem',
51
53
  '3xl': '6rem',
52
54
  'mega': '7.5rem',
55
+ 'huge': '10rem',
53
56
  'giga': '12.5rem',
54
57
  },
55
58
  }
@@ -2,7 +2,7 @@ export default {
2
2
  fontFamily: {
3
3
  sans: ['"Lato"', 'sans-serif'],
4
4
  base: ['"Lato"', 'sans-serif'],
5
- title: ['"Rubik"'],
5
+ highlight: ['"Rubik"'],
6
6
  },
7
7
 
8
8
  fontSize: {
@@ -12,12 +12,13 @@ export default {
12
12
  'xs': '1.25rem',
13
13
 
14
14
  'sm': '1.5rem',
15
- 'md': '2rem',
16
- 'lg': '2.5rem',
15
+ 'md': '1.75rem',
16
+ 'lg': '2rem',
17
17
 
18
- 'xl': '3rem',
19
- '2xl': '3.5rem',
20
- '3xl': '4rem',
18
+ 'xl': '2.5rem',
19
+ '2xl': '3rem',
20
+ '3xl': '3.5rem',
21
+ 'huge': '4rem',
21
22
  'mega': '4.5rem',
22
23
  'giga': '5rem',
23
24
  },
@@ -26,7 +27,7 @@ export default {
26
27
  'default': 1,
27
28
 
28
29
  'xs': 1.15,
29
- 'sm': 1.2,
30
+ 'sm': 1.25,
30
31
 
31
32
  'md': 1.33,
32
33
 
@@ -1,14 +1,212 @@
1
1
  import plugin from 'windicss/plugin'
2
2
 
3
+ export const componentTypos = plugin(({ addUtilities, theme }) => {
4
+ const wrapperThemeType = (path: string) => `${theme(path)}`
5
+
6
+
7
+ const displayCommons = {
8
+ fontFamily: wrapperThemeType('fontFamily.highlight'),
9
+ color: wrapperThemeType('colors.neutral.low.dark'),
10
+ lineHeight: wrapperThemeType('lineHeight.xs'),
11
+ fontWeight: wrapperThemeType('fontWeight.medium'),
12
+ }
13
+ const display = {
14
+ '.fonts-display-large': {
15
+ ...displayCommons,
16
+ fontSize: wrapperThemeType('fontSize.3xl'),
17
+ '@media (min-width: 1024px)': {
18
+ fontSize: wrapperThemeType('fontSize.mega'),
19
+ },
20
+ },
21
+
22
+
23
+ '.fonts-display-medium': {
24
+ ...displayCommons,
25
+ fontSize: wrapperThemeType('fontSize.2xl'),
26
+ '@media (min-width: 1024px)': {
27
+ fontSize: wrapperThemeType('fontSize.huge'),
28
+ },
29
+ },
30
+
31
+ '.fonts-display-small': {
32
+ ...displayCommons,
33
+ fontSize: wrapperThemeType('fontSize.xl'),
34
+ '@media (min-width: 1024px)': {
35
+ fontSize: wrapperThemeType('fontSize.3xl'),
36
+ },
37
+ },
38
+
39
+ }
40
+
41
+ const headingCommons = {
42
+ fontFamily: wrapperThemeType('fontFamily.highlight'),
43
+ lineHeight: wrapperThemeType('lineHeight.xs'),
44
+ color: wrapperThemeType('colors.neutral.low.dark'),
45
+ fontWeight: wrapperThemeType('fontWeight.medium'),
46
+
47
+ }
48
+ const heading = {
49
+ '.fonts-heading-h1': {
50
+ ...headingCommons,
51
+ fontSize: wrapperThemeType('fontSize.md'),
52
+ '@media (min-width: 1024px)': {
53
+ fontSize: wrapperThemeType('fontSize.xl'),
54
+ },
55
+ },
56
+
57
+ '.fonts-heading-h2': {
58
+ ...headingCommons,
59
+ fontSize: wrapperThemeType('fontSize.sm'),
60
+
61
+ '@media (min-width: 1024px)': {
62
+ fontSize: wrapperThemeType('fontSize.lg'),
63
+ },
64
+ },
65
+
66
+ '.fonts-heading-h3': {
67
+ ...headingCommons,
68
+ fontSize: wrapperThemeType('fontSize.xs'),
69
+
70
+ '@media (min-width: 1024px)': {
71
+ fontSize: wrapperThemeType('fontSize.sm'),
72
+ },
73
+ },
74
+
75
+ '.fonts-heading-h4': {
76
+ ...headingCommons,
77
+ fontSize: wrapperThemeType('fontSize.2xs'),
78
+
79
+ '@media (min-width: 1024px)': {
80
+ fontSize: wrapperThemeType('fontSize.2xs'),
81
+ },
82
+ },
83
+ }
84
+
85
+ const subtitleCommons = {
86
+ fontFamily: wrapperThemeType('fontFamily.base'),
87
+ lineHeight: wrapperThemeType('lineHeight.xs'),
88
+ color: wrapperThemeType('colors.neutral.low.light'),
89
+ fontWeight: wrapperThemeType('fontWeight.regular'),
90
+ }
91
+ const subtitle = {
92
+ '.fonts-subtitle-medium': {
93
+ ...subtitleCommons,
94
+ fontSize: wrapperThemeType('fontSize.2xs'),
95
+ '@media (min-width: 1024px)': {
96
+ fontSize: wrapperThemeType('fontSize.xs'),
97
+ },
98
+ },
99
+
100
+ '.fonts-subtitle-small': {
101
+ ...subtitleCommons,
102
+ fontSize: wrapperThemeType('fontSize.3xs'),
103
+ '@media (min-width: 1024px)': {
104
+ fontSize: wrapperThemeType('fontSize.2xs'),
105
+ },
106
+ },
107
+ }
108
+
109
+ const bodyCommons = {
110
+ color: wrapperThemeType('colors.neutral.low.medium'),
111
+ fontFamily: wrapperThemeType('fontFamily.base'),
112
+ lineHeight: wrapperThemeType('lineHeight.xs'),
113
+ }
114
+ const body = {
115
+ '.fonts-body-large-regular': {
116
+ ...bodyCommons,
117
+ fontSize: wrapperThemeType('fontSize.2xs'),
118
+ fontWeight: wrapperThemeType('fontWeight.regular'),
119
+ },
120
+
121
+ '.fonts-body-larger-bold': {
122
+ ...bodyCommons,
123
+ fontSize: wrapperThemeType('fontSize.2xs'),
124
+ fontWeight: wrapperThemeType('fontWeight.bold'),
125
+ },
126
+
127
+ '.fonts-body-medium-regular': {
128
+ ...bodyCommons,
129
+ fontSize: wrapperThemeType('fontSize.3xs'),
130
+ fontWeight: wrapperThemeType('fontWeight.regular'),
131
+ },
132
+
133
+ '.fonts-body-medium-bold': {
134
+ ...bodyCommons,
135
+ fontSize: wrapperThemeType('fontSize.3xs'),
136
+ fontWeight: wrapperThemeType('fontWeight.bold'),
137
+ },
138
+
139
+ '.fonts-body-small-regular': {
140
+ ...bodyCommons,
141
+ fontSize: wrapperThemeType('fontSize.micro'),
142
+ fontWeight: wrapperThemeType('fontWeight.regular'),
143
+ },
144
+
145
+ '.fonts-body-small-bold': {
146
+ ...bodyCommons,
147
+ fontSize: wrapperThemeType('fontSize.micro'),
148
+ fontWeight: wrapperThemeType('fontWeight.bold'),
149
+ },
150
+ }
151
+
152
+ const linkCommons = {
153
+ fontFamily: wrapperThemeType('fontFamily.base'),
154
+ lineHeight: wrapperThemeType('lineHeight.xs'),
155
+ fontWeight: wrapperThemeType('fontWeight.regular'),
156
+ color: wrapperThemeType('colors.neutral.low.medium'),
157
+ textDecoration: 'underline',
158
+ '&:hover': {
159
+ color: wrapperThemeType('colors.neutral.low.dark'),
160
+ },
161
+ }
162
+ const link = {
163
+ '.fonts-link-inline-large': {
164
+ ...linkCommons,
165
+ fontSize: wrapperThemeType('fontSize.2xs'),
166
+ },
167
+
168
+ '.fonts-link-inline-medium': {
169
+ ...linkCommons,
170
+ fontSize: wrapperThemeType('fontSize.3xs'),
171
+ },
172
+
173
+ '.fonts-link-inline-small': {
174
+ ...linkCommons,
175
+ fontSize: wrapperThemeType('fontSize.micro'),
176
+ },
177
+ }
178
+
179
+ const overline = {
180
+ '.fonts-overline-small': {
181
+ fontSize: wrapperThemeType('fontSize.2xs'),
182
+ fontFamily: wrapperThemeType('fontFamily.base'),
183
+ lineHeight: wrapperThemeType('lineHeight.xs'),
184
+ fontWeight: wrapperThemeType('fontWeight.regular'),
185
+ color: wrapperThemeType('colors.neutral.low.medium'),
186
+ textTransform: 'uppercase',
187
+ },
188
+ }
189
+
190
+ addUtilities({
191
+ ...display,
192
+ ...heading,
193
+ ...subtitle,
194
+ ...body,
195
+ ...link,
196
+ ...overline,
197
+ })
198
+ })
199
+
200
+
3
201
  export const outlinesForFocus = plugin(({ addUtilities }) => {
4
202
  addUtilities({
5
203
  '.outline-focused': {
6
- outline: '3px solid #292929',
7
- outlineOffset: '0px',
204
+ outline: '2px solid #8250DF',
205
+ outlineOffset: '2px',
8
206
  },
9
207
 
10
208
  '.outline-focused-invert': {
11
- outline: '3px solid #ffffff',
209
+ outline: '2px solid #ffffff',
12
210
  outlineOffset: '0px',
13
211
  },
14
212
  })
package/vite.config.ts CHANGED
@@ -54,6 +54,7 @@ export default defineConfig({
54
54
  Icons({
55
55
  autoInstall: true,
56
56
  compiler: 'vue3',
57
+ scale: 1.0,
57
58
  }),
58
59
 
59
60
  GirassolComponentsTypes(),
package/windi.config.ts CHANGED
@@ -4,9 +4,7 @@ import typography from 'windicss/plugin/typography'
4
4
 
5
5
  import { borders, colors, effects, misc, spacing, typography as typos, utilities } from './theme/solfacil/'
6
6
 
7
- function range(size: number, startAt = 1) {
8
- return Array.from(Array(size).keys()).map(i => i + startAt)
9
- }
7
+ import { safelist } from './theme/safelist'
10
8
 
11
9
  export default defineConfig({
12
10
  darkMode: 'class',
@@ -16,29 +14,13 @@ export default defineConfig({
16
14
  },
17
15
 
18
16
  safelist: [
19
- 'p-nano',
20
- 'p-micro',
21
- 'p-3xs',
22
- 'p-2xs',
23
- 'p-xs',
24
- 'p-sm',
25
- 'p-md',
26
- 'p-lg',
27
- 'm-nano',
28
- 'm-micro',
29
- 'm-3xs',
30
- 'm-2xs',
31
- 'm-xs',
32
- 'm-sm',
33
- 'm-md',
34
- 'm-lg',
35
- range(30).map(i => `grid-rows-${i}`),
36
- range(30).map(i => `grid-cols-${i}`),
37
- range(10).map(i => `gap-${i}`),
38
- range(30).map(i => `row-start-${i}`),
39
- range(30).map(i => `col-start-${i}`),
40
- range(30).map(i => `row-span-${i}`),
41
- range(30).map(i => `col-span-${i}`),
17
+ ...safelist({
18
+ activeSafeList: true,
19
+ data: {
20
+ colors,
21
+ spacing: spacing.space,
22
+ },
23
+ }),
42
24
  ],
43
25
 
44
26
  plugins: [
@@ -47,6 +29,7 @@ export default defineConfig({
47
29
  utilities.maxLines,
48
30
  utilities.debug,
49
31
  utilities.placeholder,
32
+ utilities.componentTypos,
50
33
  ],
51
34
 
52
35
  theme: {