@solfacil/girassol 0.21.0 → 0.22.0
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/.vscode/settings.json +4 -0
- package/cli/build/commands/generate-icons.js +208 -0
- package/cli/build/types/commands/generate-icons.d.ts +7 -0
- package/dist/girassol.es.js +9 -7
- package/dist/girassol.umd.js +2 -2
- package/dist/types/components/breadcrumb/Breadcrumb.vue.d.ts +1 -1
- package/dist/types/components/breadcrumb/types.d.ts +3 -1
- package/dist/types/components/link/Link.vue.d.ts +3 -2
- package/dist/types/components/link/types.d.ts +4 -1
- package/dist/types/index.d.ts +11 -10
- package/package.json +7 -3
- package/scripts/girassol-icons.mjs +154 -0
- package/scripts/update-girassol-icons.mjs +4 -0
- package/theme/safelist.ts +5 -1
- package/theme/solfacil/colors.ts +64 -57
- package/vite-modules/generate-component-types.ts +44 -0
- package/vite-modules/generate-girassol-icons.ts +18 -0
- package/vite.config.ts +12 -6
- package/windi.config.ts +1 -1
|
@@ -23,7 +23,7 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
|
|
|
23
23
|
}[];
|
|
24
24
|
}>>>, {
|
|
25
25
|
items: import("./types").Item[];
|
|
26
|
-
linkTag: "a" | "
|
|
26
|
+
linkTag: "a" | import("./types").NuxtLinkResolved | "router-link";
|
|
27
27
|
}>;
|
|
28
28
|
export default _default;
|
|
29
29
|
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
+
import type { resolveComponent } from "vue";
|
|
1
2
|
export type Item = {
|
|
2
3
|
href: string;
|
|
3
4
|
text: string;
|
|
4
5
|
target?: '_blank' | '_self' | '_parent' | '_top';
|
|
5
6
|
rel?: string;
|
|
6
7
|
};
|
|
8
|
+
export type NuxtLinkResolved = Exclude<ReturnType<typeof resolveComponent>, string>;
|
|
7
9
|
export interface Breadcrumb {
|
|
8
10
|
id: string;
|
|
9
11
|
items?: Item[];
|
|
10
12
|
gtmId?: string;
|
|
11
|
-
linkTag?: 'a' | 'router-link' |
|
|
13
|
+
linkTag?: 'a' | 'router-link' | NuxtLinkResolved;
|
|
12
14
|
}
|
|
@@ -3,7 +3,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
|
|
|
3
3
|
id: Link['id'];
|
|
4
4
|
text?: Link['text'];
|
|
5
5
|
to?: Link['to'];
|
|
6
|
-
component?: "a" | "router-link" | "
|
|
6
|
+
component?: "a" | "router-link" | (import("vue").ComponentOptions<{}, any, any, import("vue").ComputedOptions, import("vue").MethodOptions, any, any, any> | import("vue").FunctionalComponent<{}, any>) | undefined;
|
|
7
7
|
size?: "large" | "medium" | undefined;
|
|
8
8
|
onColor?: Link['onColor'];
|
|
9
9
|
external?: Link['external'];
|
|
@@ -15,7 +15,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
|
|
|
15
15
|
id: Link['id'];
|
|
16
16
|
text?: Link['text'];
|
|
17
17
|
to?: Link['to'];
|
|
18
|
-
component?: "a" | "router-link" | "
|
|
18
|
+
component?: "a" | "router-link" | (import("vue").ComponentOptions<{}, any, any, import("vue").ComputedOptions, import("vue").MethodOptions, any, any, any> | import("vue").FunctionalComponent<{}, any>) | undefined;
|
|
19
19
|
size?: "large" | "medium" | undefined;
|
|
20
20
|
onColor?: Link['onColor'];
|
|
21
21
|
external?: Link['external'];
|
|
@@ -29,6 +29,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
|
|
|
29
29
|
component: Link['component'];
|
|
30
30
|
}>, {
|
|
31
31
|
icon: (_: {}) => any;
|
|
32
|
+
default: (_: {}) => any;
|
|
32
33
|
}>;
|
|
33
34
|
export default _default;
|
|
34
35
|
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { resolveComponent } from "vue";
|
|
1
2
|
export interface LinkTo {
|
|
2
3
|
path: string;
|
|
3
4
|
force?: boolean;
|
|
@@ -8,12 +9,14 @@ export interface LinkTo {
|
|
|
8
9
|
replace?: false;
|
|
9
10
|
state?: string;
|
|
10
11
|
}
|
|
12
|
+
type NuxtLinkResolved = Exclude<ReturnType<typeof resolveComponent>, string>;
|
|
11
13
|
export interface Link {
|
|
12
14
|
id: string;
|
|
13
|
-
component: 'router-link' | '
|
|
15
|
+
component: 'router-link' | 'a' | NuxtLinkResolved;
|
|
14
16
|
text?: string;
|
|
15
17
|
to?: string | LinkTo;
|
|
16
18
|
external?: boolean;
|
|
17
19
|
size: 'medium' | 'large';
|
|
18
20
|
onColor?: boolean;
|
|
19
21
|
}
|
|
22
|
+
export {};
|
package/dist/types/index.d.ts
CHANGED
|
@@ -5260,7 +5260,7 @@ export declare const components: {
|
|
|
5260
5260
|
}[];
|
|
5261
5261
|
};
|
|
5262
5262
|
linkTag: {
|
|
5263
|
-
type: import("vue").PropType<"a" | "
|
|
5263
|
+
type: import("vue").PropType<"a" | import("./components/breadcrumb/types").NuxtLinkResolved | "router-link">;
|
|
5264
5264
|
} & {
|
|
5265
5265
|
default: string;
|
|
5266
5266
|
};
|
|
@@ -5280,7 +5280,7 @@ export declare const components: {
|
|
|
5280
5280
|
}[];
|
|
5281
5281
|
};
|
|
5282
5282
|
linkTag: {
|
|
5283
|
-
type: import("vue").PropType<"a" | "
|
|
5283
|
+
type: import("vue").PropType<"a" | import("./components/breadcrumb/types").NuxtLinkResolved | "router-link">;
|
|
5284
5284
|
} & {
|
|
5285
5285
|
default: string;
|
|
5286
5286
|
};
|
|
@@ -5289,7 +5289,7 @@ export declare const components: {
|
|
|
5289
5289
|
};
|
|
5290
5290
|
}>>, {
|
|
5291
5291
|
items: import("./components/breadcrumb/types").Item[];
|
|
5292
|
-
linkTag: "a" | "
|
|
5292
|
+
linkTag: "a" | import("./components/breadcrumb/types").NuxtLinkResolved | "router-link";
|
|
5293
5293
|
}>;
|
|
5294
5294
|
SolDivider: import("vue").DefineComponent<{
|
|
5295
5295
|
orientation: {
|
|
@@ -5324,7 +5324,7 @@ export declare const components: {
|
|
|
5324
5324
|
$props: Partial<{
|
|
5325
5325
|
text: string;
|
|
5326
5326
|
size: "large" | "medium";
|
|
5327
|
-
component: "a" | "router-link" | "
|
|
5327
|
+
component: "a" | "router-link" | (import("vue").ComponentOptions<{}, any, any, import("vue").ComputedOptions, import("vue").MethodOptions, any, any, any> | import("vue").FunctionalComponent<{}, any>);
|
|
5328
5328
|
}> & Omit<Readonly<import("vue").ExtractPropTypes<{
|
|
5329
5329
|
id: {
|
|
5330
5330
|
type: import("vue").PropType<string>;
|
|
@@ -5347,7 +5347,7 @@ export declare const components: {
|
|
|
5347
5347
|
type: import("vue").PropType<string | import("./components/link/types").LinkTo>;
|
|
5348
5348
|
};
|
|
5349
5349
|
component: {
|
|
5350
|
-
type: import("vue").PropType<"a" | "router-link" | "
|
|
5350
|
+
type: import("vue").PropType<"a" | "router-link" | (import("vue").ComponentOptions<{}, any, any, import("vue").ComputedOptions, import("vue").MethodOptions, any, any, any> | import("vue").FunctionalComponent<{}, any>)>;
|
|
5351
5351
|
} & {
|
|
5352
5352
|
default: string;
|
|
5353
5353
|
};
|
|
@@ -5390,7 +5390,7 @@ export declare const components: {
|
|
|
5390
5390
|
type: import("vue").PropType<string | import("./components/link/types").LinkTo>;
|
|
5391
5391
|
};
|
|
5392
5392
|
component: {
|
|
5393
|
-
type: import("vue").PropType<"a" | "router-link" | "
|
|
5393
|
+
type: import("vue").PropType<"a" | "router-link" | (import("vue").ComponentOptions<{}, any, any, import("vue").ComputedOptions, import("vue").MethodOptions, any, any, any> | import("vue").FunctionalComponent<{}, any>)>;
|
|
5394
5394
|
} & {
|
|
5395
5395
|
default: string;
|
|
5396
5396
|
};
|
|
@@ -5400,7 +5400,7 @@ export declare const components: {
|
|
|
5400
5400
|
}>>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, {
|
|
5401
5401
|
text: string;
|
|
5402
5402
|
size: "large" | "medium";
|
|
5403
|
-
component: "a" | "router-link" | "
|
|
5403
|
+
component: "a" | "router-link" | (import("vue").ComponentOptions<{}, any, any, import("vue").ComputedOptions, import("vue").MethodOptions, any, any, any> | import("vue").FunctionalComponent<{}, any>);
|
|
5404
5404
|
}, {}, string> & {
|
|
5405
5405
|
beforeCreate?: ((() => void) | (() => void)[]) | undefined;
|
|
5406
5406
|
created?: ((() => void) | (() => void)[]) | undefined;
|
|
@@ -5443,7 +5443,7 @@ export declare const components: {
|
|
|
5443
5443
|
type: import("vue").PropType<string | import("./components/link/types").LinkTo>;
|
|
5444
5444
|
};
|
|
5445
5445
|
component: {
|
|
5446
|
-
type: import("vue").PropType<"a" | "router-link" | "
|
|
5446
|
+
type: import("vue").PropType<"a" | "router-link" | (import("vue").ComponentOptions<{}, any, any, import("vue").ComputedOptions, import("vue").MethodOptions, any, any, any> | import("vue").FunctionalComponent<{}, any>)>;
|
|
5447
5447
|
} & {
|
|
5448
5448
|
default: string;
|
|
5449
5449
|
};
|
|
@@ -5476,7 +5476,7 @@ export declare const components: {
|
|
|
5476
5476
|
type: import("vue").PropType<string | import("./components/link/types").LinkTo>;
|
|
5477
5477
|
};
|
|
5478
5478
|
component: {
|
|
5479
|
-
type: import("vue").PropType<"a" | "router-link" | "
|
|
5479
|
+
type: import("vue").PropType<"a" | "router-link" | (import("vue").ComponentOptions<{}, any, any, import("vue").ComputedOptions, import("vue").MethodOptions, any, any, any> | import("vue").FunctionalComponent<{}, any>)>;
|
|
5480
5480
|
} & {
|
|
5481
5481
|
default: string;
|
|
5482
5482
|
};
|
|
@@ -5486,10 +5486,11 @@ export declare const components: {
|
|
|
5486
5486
|
}>>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, {
|
|
5487
5487
|
text: string;
|
|
5488
5488
|
size: "large" | "medium";
|
|
5489
|
-
component: "a" | "router-link" | "
|
|
5489
|
+
component: "a" | "router-link" | (import("vue").ComponentOptions<{}, any, any, import("vue").ComputedOptions, import("vue").MethodOptions, any, any, any> | import("vue").FunctionalComponent<{}, any>);
|
|
5490
5490
|
}, {}, string> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & (new () => {
|
|
5491
5491
|
$slots: {
|
|
5492
5492
|
icon: (_: {}) => any;
|
|
5493
|
+
default: (_: {}) => any;
|
|
5493
5494
|
};
|
|
5494
5495
|
});
|
|
5495
5496
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@solfacil/girassol",
|
|
3
3
|
"description": "Girassol design system",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.22.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"authors": [
|
|
7
7
|
{
|
|
@@ -20,7 +20,9 @@
|
|
|
20
20
|
"theme/",
|
|
21
21
|
"cli/bin",
|
|
22
22
|
"cli/build",
|
|
23
|
-
"
|
|
23
|
+
"vite-modules/",
|
|
24
|
+
"*.ts",
|
|
25
|
+
"scripts"
|
|
24
26
|
],
|
|
25
27
|
"bin": {
|
|
26
28
|
"girassol-cli": "./cli/bin/girassol-cli"
|
|
@@ -33,10 +35,12 @@
|
|
|
33
35
|
"require": "./dist/girassol.umd.js"
|
|
34
36
|
},
|
|
35
37
|
"./dist/style.css": "./dist/style.css",
|
|
36
|
-
"./windi.config.ts": "./windi.config.ts"
|
|
38
|
+
"./windi.config.ts": "./windi.config.ts",
|
|
39
|
+
"./vite-modules/generate-girassol-icons": "./vite-modules/generate-girassol-icons.ts"
|
|
37
40
|
},
|
|
38
41
|
"types": "./dist/types/index.d.ts",
|
|
39
42
|
"scripts": {
|
|
43
|
+
"postinstall": "node scripts/update-girassol-icons.mjs",
|
|
40
44
|
"typecheck": "vue-tsc -p tsconfig.app.json --noEmit",
|
|
41
45
|
"dev": "vite --port 3333 --host",
|
|
42
46
|
"build:lib": "vue-tsc --noEmit && vite build",
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { access, constants, mkdir, readFile, writeFile } from 'fs/promises'
|
|
2
|
+
import { dirname, join } from 'path'
|
|
3
|
+
import crypto from 'crypto'
|
|
4
|
+
import https from 'node-fetch'
|
|
5
|
+
|
|
6
|
+
const COLORS = {
|
|
7
|
+
Reset: "\x1B[0m",
|
|
8
|
+
Bright: "\x1B[1m",
|
|
9
|
+
Dim: "\x1B[2m",
|
|
10
|
+
Italic: "\x1B[3m",
|
|
11
|
+
Underscore: "\x1B[4m",
|
|
12
|
+
Blink: "\x1B[5m",
|
|
13
|
+
Reverse: "\x1B[7m",
|
|
14
|
+
Hidden: "\x1B[8m",
|
|
15
|
+
Stroke: "\x1B[9m",
|
|
16
|
+
|
|
17
|
+
FgBlack: "\x1B[30m",
|
|
18
|
+
FgRed: "\x1B[31m",
|
|
19
|
+
FgGreen: "\x1B[32m",
|
|
20
|
+
FgYellow: "\x1B[33m",
|
|
21
|
+
FgBlue: "\x1B[34m",
|
|
22
|
+
FgMagenta: "\x1B[35m",
|
|
23
|
+
FgCyan: "\x1B[36m",
|
|
24
|
+
FgWhite: "\x1B[37m",
|
|
25
|
+
FgGray: "\x1B[90m",
|
|
26
|
+
|
|
27
|
+
BgBlack: "\x1B[40m",
|
|
28
|
+
BgRed: "\x1B[41m",
|
|
29
|
+
BgGreen: "\x1B[42m",
|
|
30
|
+
BgYellow: "\x1B[43m",
|
|
31
|
+
BgBlue: "\x1B[44m",
|
|
32
|
+
BgMagenta: "\x1B[45m",
|
|
33
|
+
BgCyan: "\x1B[46m",
|
|
34
|
+
BgWhite: "\x1B[47m",
|
|
35
|
+
BgGray: "\x1B[100m",
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function log(styles, content) {
|
|
39
|
+
console.log(...styles, content, COLORS.Reset)
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
log([COLORS.Bright,COLORS.FgYellow], '======== [GIRASSOL_ICONS] =========')
|
|
43
|
+
|
|
44
|
+
const dirname__ = dirname('./node_modules/')
|
|
45
|
+
const girassolModules = join(dirname__, 'node_modules/@solfacil/girassol')
|
|
46
|
+
|
|
47
|
+
const COLLECTIONS = [
|
|
48
|
+
{ url: 'https://d1azc1qln24ryf.cloudfront.net/265413/Icons/selection-svg.json', filename: 'icons', collection: 'girassol' },
|
|
49
|
+
{ url: 'https://d1azc1qln24ryf.cloudfront.net/265413/Ilustrations/selection-svg.json', filename: 'illustration', collection: 'illustration' },
|
|
50
|
+
]
|
|
51
|
+
|
|
52
|
+
async function getIcon(url) {
|
|
53
|
+
try {
|
|
54
|
+
const data = await https(url, { method: 'GET' })
|
|
55
|
+
const response = await data.json()
|
|
56
|
+
|
|
57
|
+
const hash = crypto.createHash('md5')
|
|
58
|
+
hash.update(JSON.stringify(response))
|
|
59
|
+
|
|
60
|
+
response.hash = hash.digest('hex')
|
|
61
|
+
|
|
62
|
+
return response
|
|
63
|
+
}
|
|
64
|
+
catch (er) {
|
|
65
|
+
console.error('Error', er)
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function transformIcons(collection, icons) {
|
|
70
|
+
const girassol = {
|
|
71
|
+
prefix: collection,
|
|
72
|
+
hash: icons?.hash,
|
|
73
|
+
width: 1024,
|
|
74
|
+
height: 1024,
|
|
75
|
+
icons: {},
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
icons.icons.forEach(({ icon, properties }) => {
|
|
79
|
+
const name = properties.name
|
|
80
|
+
const hasAttributes = icon.attrs.length
|
|
81
|
+
|
|
82
|
+
function transformAttribute(index) {
|
|
83
|
+
const currentAttributes = icon.attrs[index]
|
|
84
|
+
|
|
85
|
+
const style = () =>
|
|
86
|
+
Object.entries(currentAttributes)
|
|
87
|
+
.flatMap(([property, value]) => `${property}: ${value}`)
|
|
88
|
+
.join(';')
|
|
89
|
+
|
|
90
|
+
if (hasAttributes && Object.values(currentAttributes))
|
|
91
|
+
return `style="${style()}"`
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
function addPath(path, index) {
|
|
95
|
+
return `<path fill="currentColor" d="${path}" ${transformAttribute(index)} />`
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
const paths = icon.paths
|
|
99
|
+
.map(addPath)
|
|
100
|
+
.join('')
|
|
101
|
+
|
|
102
|
+
Object.assign(girassol.icons, {
|
|
103
|
+
[name]: {
|
|
104
|
+
body: paths,
|
|
105
|
+
},
|
|
106
|
+
})
|
|
107
|
+
})
|
|
108
|
+
|
|
109
|
+
return girassol
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
function createGirassolIconFiles(filename, collection, data) {
|
|
113
|
+
writeFile(`${girassolModules}/${filename}.json`, JSON.stringify(transformIcons(collection, data)))
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export async function generateIcons() {
|
|
117
|
+
for (const collection of COLLECTIONS) {
|
|
118
|
+
try {
|
|
119
|
+
const icons = await getIcon(collection.url)
|
|
120
|
+
|
|
121
|
+
readFile(`${girassolModules}/${collection.filename}.json`)
|
|
122
|
+
.then(response => {
|
|
123
|
+
const cached = JSON.parse((response).toString())
|
|
124
|
+
const isDifferentHash = icons.hash !== cached.hash
|
|
125
|
+
|
|
126
|
+
log([COLORS.Bright,COLORS.FgCyan],
|
|
127
|
+
`${isDifferentHash ? ' 💡' : ' ✅'} [${collection.filename}] ${isDifferentHash ? 'has new update' : 'is updated' }`)
|
|
128
|
+
|
|
129
|
+
if (isDifferentHash){
|
|
130
|
+
log([COLORS.Blink, COLORS.Bright, COLORS.FgCyan],`👷 [${collection.filename}] Updating...`)
|
|
131
|
+
createGirassolIconFiles(collection.filename, collection.collection, icons)
|
|
132
|
+
log([COLORS.Bright,COLORS.FgCyan],` ✅ [${collection.filename}] Updated!`)
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
})
|
|
136
|
+
.catch(() => {
|
|
137
|
+
createGirassolIconFiles(collection.filename, collection.collection, icons)
|
|
138
|
+
log([COLORS.Bright,COLORS.FgYellow],` 🧪 [${collection.filename}] Created!`)
|
|
139
|
+
})
|
|
140
|
+
}
|
|
141
|
+
catch(e) {
|
|
142
|
+
console.error('ERROR ', e)
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
export async function validateFolder() {
|
|
148
|
+
try {
|
|
149
|
+
await access(girassolModules, constants.R_OK | constants.W_OK)
|
|
150
|
+
}
|
|
151
|
+
catch {
|
|
152
|
+
await mkdir(join(dirname__, 'node_modules/@solfacil/girassol'), { recursive: true })
|
|
153
|
+
}
|
|
154
|
+
}
|
package/theme/safelist.ts
CHANGED
|
@@ -54,7 +54,7 @@ export function safelist({ activeSafeList = true, data }: Args): string[] {
|
|
|
54
54
|
return []
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
export function safelistColors(colors: Data['colors']) {
|
|
57
|
+
export function safelistColors({ colors, backgroundImage }: Data['colors']) {
|
|
58
58
|
const colorsNames: string[] = []
|
|
59
59
|
|
|
60
60
|
for (const category in colors) {
|
|
@@ -73,6 +73,10 @@ export function safelistColors(colors: Data['colors']) {
|
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
+
for (const gradientName in backgroundImage) {
|
|
77
|
+
colorsNames.push(`${gradientName}`)
|
|
78
|
+
}
|
|
79
|
+
|
|
76
80
|
return colorsNames
|
|
77
81
|
}
|
|
78
82
|
|
package/theme/solfacil/colors.ts
CHANGED
|
@@ -1,65 +1,72 @@
|
|
|
1
1
|
export default {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
colors: {
|
|
3
|
+
brand: {
|
|
4
|
+
primary: {
|
|
5
|
+
pure: '#000000',
|
|
6
|
+
light: '#a3a3a3',
|
|
7
|
+
medium: '#666666',
|
|
8
|
+
dark: '#212121',
|
|
9
|
+
},
|
|
10
|
+
secondary: {
|
|
11
|
+
medium: '#BFFF00',
|
|
12
|
+
light: '#EFFFC1',
|
|
13
|
+
pure: '#00B569',
|
|
14
|
+
dark: '#008859',
|
|
15
|
+
},
|
|
8
16
|
},
|
|
9
|
-
secondary: {
|
|
10
|
-
medium: '#BFFF00',
|
|
11
|
-
light: '#EFFFC1',
|
|
12
|
-
pure: '#00B569',
|
|
13
|
-
dark: '#008859',
|
|
14
|
-
},
|
|
15
|
-
},
|
|
16
17
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
highlight: {
|
|
19
|
+
pure: '#8250DF',
|
|
20
|
+
light: '#E6DCF9',
|
|
21
|
+
medium: '#C0A7EF',
|
|
22
|
+
dark: '#342059',
|
|
23
|
+
},
|
|
23
24
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
25
|
+
neutral: {
|
|
26
|
+
low: {
|
|
27
|
+
pure: '#000000',
|
|
28
|
+
light: '#757575',
|
|
29
|
+
medium: '#505050',
|
|
30
|
+
dark: '#222222',
|
|
31
|
+
},
|
|
32
|
+
high: {
|
|
33
|
+
pure: '#ffffff',
|
|
34
|
+
light: '#F0f0f0',
|
|
35
|
+
medium: '#dedede',
|
|
36
|
+
dark: '#c8c8c8',
|
|
37
|
+
},
|
|
30
38
|
},
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
39
|
+
|
|
40
|
+
feedback: {
|
|
41
|
+
positive: {
|
|
42
|
+
pure: '#1CA36F',
|
|
43
|
+
light: '#D2EDE2',
|
|
44
|
+
medium: '#8DD1B7',
|
|
45
|
+
dark: '#0B412C',
|
|
46
|
+
},
|
|
47
|
+
warning: {
|
|
48
|
+
pure: '#FFB300',
|
|
49
|
+
light: '#FFF0CC',
|
|
50
|
+
medium: '#FFD97F',
|
|
51
|
+
dark: '#664800',
|
|
52
|
+
},
|
|
53
|
+
informative: {
|
|
54
|
+
pure: '#176EC4',
|
|
55
|
+
light: '#D1E4F6',
|
|
56
|
+
medium: '#8CBAE8',
|
|
57
|
+
dark: '#0A2F54',
|
|
58
|
+
},
|
|
59
|
+
negative: {
|
|
60
|
+
pure: '#D0382D',
|
|
61
|
+
light: '#F6D7D5',
|
|
62
|
+
medium: '#E79B96',
|
|
63
|
+
dark: '#531612',
|
|
64
|
+
},
|
|
36
65
|
},
|
|
37
66
|
},
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
light: '#D2EDE2',
|
|
43
|
-
medium: '#8DD1B7',
|
|
44
|
-
dark: '#0B412C',
|
|
45
|
-
},
|
|
46
|
-
warning: {
|
|
47
|
-
pure: '#FFB300',
|
|
48
|
-
light: '#FFF0CC',
|
|
49
|
-
medium: '#FFD97F',
|
|
50
|
-
dark: '#664800',
|
|
51
|
-
},
|
|
52
|
-
informative: {
|
|
53
|
-
pure: '#176EC4',
|
|
54
|
-
light: '#D1E4F6',
|
|
55
|
-
medium: '#8CBAE8',
|
|
56
|
-
dark: '#0A2F54',
|
|
57
|
-
},
|
|
58
|
-
negative: {
|
|
59
|
-
pure: '#D0382D',
|
|
60
|
-
light: '#F6D7D5',
|
|
61
|
-
medium: '#E79B96',
|
|
62
|
-
dark: '#531612',
|
|
63
|
-
},
|
|
67
|
+
backgroundImage: {
|
|
68
|
+
'gradient-pure': 'linear-gradient(180deg, #BFFF00 0%, #00B569 100%)',
|
|
69
|
+
'gradient-dark':
|
|
70
|
+
'linear-gradient(274.52deg, #BFFF00 -105.99%, #42CF45 -65.65%, #008859 134.97%)',
|
|
64
71
|
},
|
|
65
|
-
}
|
|
72
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { readFile, writeFile } from 'fs/promises'
|
|
2
|
+
import type { Plugin } from 'vite'
|
|
3
|
+
|
|
4
|
+
export default (): Plugin => {
|
|
5
|
+
|
|
6
|
+
return {
|
|
7
|
+
name: 'vite-generate-component-types',
|
|
8
|
+
enforce: 'post',
|
|
9
|
+
apply: 'build',
|
|
10
|
+
|
|
11
|
+
async closeBundle() {
|
|
12
|
+
const data = await readFile('./src/index.ts', { encoding: 'utf8' })
|
|
13
|
+
|
|
14
|
+
const init = data.indexOf('export const component')
|
|
15
|
+
const dataFiltered = data.slice(init)
|
|
16
|
+
const end = dataFiltered.indexOf('}')
|
|
17
|
+
|
|
18
|
+
const componentsString = dataFiltered.slice(0, end)
|
|
19
|
+
|
|
20
|
+
const componentsArray = componentsString
|
|
21
|
+
.split(',')
|
|
22
|
+
.map((item) => item.slice(item.indexOf("Sol")).trim())
|
|
23
|
+
.filter(item => item)
|
|
24
|
+
|
|
25
|
+
const componentsTypes = componentsArray.map((component) =>
|
|
26
|
+
`${component}: typeof import('@solfacil/girassol')['${component}']`,
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
await writeFile('dist/components.json', `${JSON.stringify({ components: componentsArray })}`)
|
|
30
|
+
await writeFile('dist/components.d.ts',
|
|
31
|
+
`import '@vue/runtime-core'
|
|
32
|
+
declare module '@vue/runtime-core' {
|
|
33
|
+
export interface GlobalComponents {
|
|
34
|
+
${componentsTypes.join('\n\t\t\t\t\t')}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export {}
|
|
39
|
+
`)
|
|
40
|
+
|
|
41
|
+
console.log(`[Girassol] all types and components file generated!`)
|
|
42
|
+
},
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { Plugin } from 'vite'
|
|
2
|
+
|
|
3
|
+
import { generateIcons,validateFolder } from '../scripts/girassol-icons.mjs'
|
|
4
|
+
|
|
5
|
+
export default (): Plugin => {
|
|
6
|
+
return {
|
|
7
|
+
name: 'vite-generate-girassol-icons-data',
|
|
8
|
+
apply: 'serve',
|
|
9
|
+
|
|
10
|
+
async buildStart() {
|
|
11
|
+
|
|
12
|
+
await validateFolder()
|
|
13
|
+
await generateIcons()
|
|
14
|
+
|
|
15
|
+
console.log('[Girassol icons generated!]')
|
|
16
|
+
},
|
|
17
|
+
}
|
|
18
|
+
}
|
package/vite.config.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import path from 'path'
|
|
2
|
+
import { readFile } from 'fs/promises'
|
|
3
|
+
|
|
2
4
|
import { defineConfig } from 'vitest/config'
|
|
3
5
|
|
|
4
6
|
import vue from '@vitejs/plugin-vue'
|
|
@@ -8,10 +10,13 @@ import Icons from 'unplugin-icons/vite'
|
|
|
8
10
|
import Inspect from 'vite-plugin-inspect'
|
|
9
11
|
import WindiCSS from 'vite-plugin-windicss'
|
|
10
12
|
|
|
11
|
-
import GirassolComponentsTypes
|
|
13
|
+
import GirassolComponentsTypes from './vite-modules/generate-component-types'
|
|
14
|
+
import GenerateIconsData from './vite-modules/generate-girassol-icons'
|
|
12
15
|
|
|
13
16
|
const currentPath = path.resolve(__dirname)
|
|
14
17
|
|
|
18
|
+
const girassolPath = path.join(__dirname, 'node_modules/@solfacil/girassol')
|
|
19
|
+
|
|
15
20
|
// https://vitejs.dev/config/
|
|
16
21
|
export default defineConfig({
|
|
17
22
|
build: {
|
|
@@ -53,21 +58,22 @@ export default defineConfig({
|
|
|
53
58
|
enabled: true,
|
|
54
59
|
}),
|
|
55
60
|
|
|
56
|
-
|
|
57
61
|
Icons({
|
|
58
62
|
autoInstall: true,
|
|
59
63
|
compiler: 'vue3',
|
|
60
64
|
scale: 1.0,
|
|
65
|
+
customCollections: {
|
|
66
|
+
girassol: async () => JSON.parse(await readFile(`${girassolPath}/icons.json`, 'utf8')),
|
|
67
|
+
illustration: async () => JSON.parse(await readFile(`${girassolPath}/illustration.json`, 'utf8')),
|
|
68
|
+
},
|
|
61
69
|
}),
|
|
62
70
|
|
|
63
71
|
GirassolComponentsTypes(),
|
|
72
|
+
GenerateIconsData(),
|
|
64
73
|
],
|
|
65
74
|
|
|
66
75
|
optimizeDeps: {
|
|
67
|
-
include: [
|
|
68
|
-
'vue',
|
|
69
|
-
'@vueuse/core',
|
|
70
|
-
],
|
|
76
|
+
include: ['vue', '@vueuse/core'],
|
|
71
77
|
},
|
|
72
78
|
|
|
73
79
|
test: {
|