@solfacil/girassol 0.1.3 → 0.1.7
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/extensions.json +4 -2
- package/.vscode/settings.json +9 -0
- package/README.md +1 -1
- package/cli/package.json +2 -12
- package/cli/src/commands/create:component.ts +91 -0
- package/cli/src/commands/generate:plugin.ts +1 -1
- package/cli/src/commands/generate:types.ts +1 -1
- package/cli/src/commands/girassol.ts +1 -1
- package/cli/src/extensions/cli-extension.ts +1 -1
- package/cli/src/templates/components/component.spec.ts.ejs +20 -0
- package/cli/src/templates/components/component.stories.mdx.ejs +74 -0
- package/cli/src/templates/components/component.vue.ejs +23 -0
- package/cli/src/templates/components/index.ts.ejs +10 -0
- package/cli/yarn.lock +31 -2860
- package/dist/girassol.es.js +1119 -136
- package/dist/girassol.umd.js +5 -5
- package/dist/style.css +1 -1
- package/dist/theme/solfacil/colors.d.ts +2 -2
- package/dist/theme/solfacil/index.d.ts +3 -0
- package/dist/theme/solfacil/utilities.d.ts +3 -0
- package/dist/types/components/dropdown/Dropdown.vue.d.ts +77 -0
- package/dist/types/components/dropdown/dropdown.spec.d.ts +1 -0
- package/dist/types/components/dropdown/index.d.ts +2 -0
- package/dist/types/components/forms/button/Button.vue.d.ts +4 -4
- package/dist/types/components/forms/checkbox/CheckboxGroup.vue.d.ts +2 -2
- package/dist/types/components/forms/checkbox/checkbox-type.d.ts +2 -2
- package/dist/types/components/forms/checkbox/index.d.ts +1 -1
- package/dist/types/components/forms/input/Input.vue.d.ts +3 -1
- package/dist/types/components/forms/input/index.d.ts +1 -1
- package/dist/types/components/forms/radio/RadioGroup.vue.d.ts +2 -2
- package/dist/types/components/forms/radio/index.d.ts +1 -1
- package/dist/types/components/forms/radio/radio-type.d.ts +2 -2
- package/dist/types/components/forms/select/Select.vue.d.ts +53 -0
- package/dist/types/components/forms/select/index.d.ts +2 -0
- package/dist/types/components/forms/select/select.spec.d.ts +1 -0
- package/dist/types/components/forms/switch/index.d.ts +1 -1
- package/dist/types/components/forms/textarea/Textarea.vue.d.ts +50 -0
- package/dist/types/components/forms/textarea/index.d.ts +2 -0
- package/dist/types/components/forms/textarea/textarea.spec.d.ts +1 -0
- package/dist/types/components/forms/textfield/Textfield.vue.d.ts +5 -5
- package/dist/types/components/forms/textfield/index.d.ts +1 -1
- package/dist/types/composables/use-toast/Toast.vue.d.ts +66 -0
- package/dist/types/composables/use-toast/index.d.ts +9 -0
- package/dist/types/composables/use-toast/types.d.ts +23 -0
- package/dist/types/composables/use-toast/use-toast.spec.d.ts +1 -0
- package/dist/types/composables/use-toast/useTimer.d.ts +9 -0
- package/dist/types/composables/use-toast/useTransition.d.ts +57 -0
- package/dist/types/index.d.ts +5 -1
- package/dist/vite.config.d.ts +1 -1
- package/dist/windi.config.d.ts +1 -1
- package/package.json +67 -35
- package/theme/solfacil/borders.ts +2 -2
- package/theme/solfacil/colors.ts +4 -4
- package/theme/solfacil/effects.ts +3 -3
- package/theme/solfacil/index.ts +5 -2
- package/theme/solfacil/miscs.ts +2 -2
- package/theme/solfacil/spacing.ts +1 -1
- package/theme/solfacil/typography.ts +2 -2
- package/theme/solfacil/utilities.ts +88 -3
- package/vite.config.ts +16 -4
- package/windi.config.ts +7 -4
- package/cli/__tests__/cli-integration.test.ts +0 -29
package/.vscode/extensions.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"recommendations": [
|
|
3
3
|
"antfu.vite",
|
|
4
|
-
"
|
|
4
|
+
"Vue.volar",
|
|
5
|
+
"Vue.vscode-typescript-vue-plugin",
|
|
5
6
|
"dbaeumer.vscode-eslint",
|
|
6
7
|
"voorjaar.windicss-intellisense",
|
|
7
8
|
"csstools.postcss",
|
|
@@ -12,6 +13,7 @@
|
|
|
12
13
|
"formulahendry.auto-close-tag",
|
|
13
14
|
"wix.vscode-import-cost",
|
|
14
15
|
"syler.sass-indented",
|
|
15
|
-
"streetsidesoftware.code-spell-checker"
|
|
16
|
+
"streetsidesoftware.code-spell-checker",
|
|
17
|
+
"ZixuanChen.vitest-explorer"
|
|
16
18
|
]
|
|
17
19
|
}
|
package/.vscode/settings.json
CHANGED
|
@@ -2,8 +2,13 @@
|
|
|
2
2
|
"cSpell.words": [
|
|
3
3
|
"antfu",
|
|
4
4
|
"attributify",
|
|
5
|
+
"composables",
|
|
6
|
+
"describedby",
|
|
5
7
|
"esnext",
|
|
8
|
+
"gluegun",
|
|
6
9
|
"iconify",
|
|
10
|
+
"IIFE",
|
|
11
|
+
"nuxt",
|
|
7
12
|
"solfacil",
|
|
8
13
|
"Solfácil",
|
|
9
14
|
"textfield",
|
|
@@ -11,6 +16,10 @@
|
|
|
11
16
|
"theming",
|
|
12
17
|
"unplugin",
|
|
13
18
|
"vitejs",
|
|
19
|
+
"vitest",
|
|
20
|
+
"vue",
|
|
21
|
+
"vue.js",
|
|
22
|
+
"vuejs",
|
|
14
23
|
"vueuse",
|
|
15
24
|
"windi",
|
|
16
25
|
"windicss"
|
package/README.md
CHANGED
package/cli/package.json
CHANGED
|
@@ -13,11 +13,7 @@
|
|
|
13
13
|
"copy-templates": "copyfiles ./src/templates/* ./build/templates",
|
|
14
14
|
"build": "yarn clean-build && yarn compile && yarn copy-templates",
|
|
15
15
|
"prepublishOnly": "yarn build",
|
|
16
|
-
"format": "eslint \"**/*.{js,jsx,ts,tsx}\" --fix && prettier \"**/*.{js,jsx,ts,tsx,json}\" --write"
|
|
17
|
-
"test": "jest",
|
|
18
|
-
"watch": "jest --watch",
|
|
19
|
-
"snapupdate": "jest --updateSnapshot",
|
|
20
|
-
"coverage": "jest --coverage"
|
|
16
|
+
"format": "eslint \"**/*.{js,jsx,ts,tsx}\" --fix && prettier \"**/*.{js,jsx,ts,tsx,json}\" --write"
|
|
21
17
|
},
|
|
22
18
|
"files": [
|
|
23
19
|
"build",
|
|
@@ -32,10 +28,8 @@
|
|
|
32
28
|
},
|
|
33
29
|
"devDependencies": {
|
|
34
30
|
"@types/node": "^12.7.11",
|
|
35
|
-
"@types/jest": "^26.0.20",
|
|
36
31
|
"@typescript-eslint/eslint-plugin": "^4.17.0",
|
|
37
32
|
"@typescript-eslint/parser": "^4.17.0",
|
|
38
|
-
"ts-jest": "^26.5.3",
|
|
39
33
|
"ts-node": "^9.1.1",
|
|
40
34
|
"typescript": "^4.2.3",
|
|
41
35
|
"copyfiles": "^2.4.1",
|
|
@@ -43,14 +37,10 @@
|
|
|
43
37
|
"eslint-config-prettier": "^8.1.0",
|
|
44
38
|
"eslint-plugin-prettier": "^3.3.1",
|
|
45
39
|
"husky": "^5.1.3",
|
|
46
|
-
"jest": "^26.6.3",
|
|
47
40
|
"prettier": "^2.2.1",
|
|
48
41
|
"pretty-quick": "^3.1.0"
|
|
49
42
|
},
|
|
50
|
-
|
|
51
|
-
"preset": "ts-jest",
|
|
52
|
-
"testEnvironment": "node"
|
|
53
|
-
},
|
|
43
|
+
|
|
54
44
|
"prettier": {
|
|
55
45
|
"semi": false,
|
|
56
46
|
"singleQuote": true
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import type { GluegunToolbox } from 'gluegun'
|
|
2
|
+
import { resolve } from 'path'
|
|
3
|
+
const COMPONENTS_PATH_GIRASSOL = resolve(__dirname, '../../../src/components')
|
|
4
|
+
|
|
5
|
+
const pascalToKebab = (str: string) =>
|
|
6
|
+
str.replace(
|
|
7
|
+
/[A-Z]/g,
|
|
8
|
+
(letter, match) => `${match !== 0 ? '-' : ''}${letter.toLowerCase()}`
|
|
9
|
+
)
|
|
10
|
+
|
|
11
|
+
module.exports = {
|
|
12
|
+
name: 'create:component',
|
|
13
|
+
description: 'Create a component, unit test and docs file',
|
|
14
|
+
run: async (toolbox: GluegunToolbox) => {
|
|
15
|
+
const {
|
|
16
|
+
prompt,
|
|
17
|
+
template,
|
|
18
|
+
print: { highlight, info, success, error },
|
|
19
|
+
} = toolbox
|
|
20
|
+
|
|
21
|
+
const askFolder = {
|
|
22
|
+
type: 'input',
|
|
23
|
+
name: 'folder',
|
|
24
|
+
message: 'Gostaria de criar dentro de alguma pasta?',
|
|
25
|
+
hint: 'forms | forms/specials',
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const askName = {
|
|
29
|
+
type: 'input',
|
|
30
|
+
name: 'name',
|
|
31
|
+
message: 'Qual o nome do componente?',
|
|
32
|
+
hint: 'Textfield | Button',
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const { folder, name } = await prompt.ask([askFolder, askName])
|
|
36
|
+
|
|
37
|
+
const path = folder.endsWith('/')
|
|
38
|
+
? `${folder}${pascalToKebab(name)}`
|
|
39
|
+
: `${folder}/${pascalToKebab(name)}`
|
|
40
|
+
|
|
41
|
+
const fullPath = `${COMPONENTS_PATH_GIRASSOL}/${path}/`
|
|
42
|
+
|
|
43
|
+
console.log(folder, name)
|
|
44
|
+
|
|
45
|
+
info('Isto ira criar:')
|
|
46
|
+
|
|
47
|
+
highlight(`
|
|
48
|
+
components/
|
|
49
|
+
├── ${path}
|
|
50
|
+
└── ${name}.vue
|
|
51
|
+
└── ${pascalToKebab(name)}.spec.ts
|
|
52
|
+
└── ${name}.stories.mdx
|
|
53
|
+
└── index.ts
|
|
54
|
+
`)
|
|
55
|
+
|
|
56
|
+
try {
|
|
57
|
+
const canWrite = await prompt.confirm('Esta configuração esta correta?')
|
|
58
|
+
|
|
59
|
+
if (canWrite) {
|
|
60
|
+
info('Gerando arquivos...')
|
|
61
|
+
await template.generate({
|
|
62
|
+
props: { name, folder, nameClass: pascalToKebab(name) },
|
|
63
|
+
template: 'components/component.vue.ejs',
|
|
64
|
+
target: `${fullPath}${name}.vue`,
|
|
65
|
+
})
|
|
66
|
+
|
|
67
|
+
await template.generate({
|
|
68
|
+
props: { name, folder, nameClass: pascalToKebab(name) },
|
|
69
|
+
template: 'components/component.spec.ts.ejs',
|
|
70
|
+
target: `${fullPath}${pascalToKebab(name)}.spec.ts`,
|
|
71
|
+
})
|
|
72
|
+
|
|
73
|
+
await template.generate({
|
|
74
|
+
props: { name, folder, nameClass: pascalToKebab(name) },
|
|
75
|
+
template: 'components/component.stories.mdx.ejs',
|
|
76
|
+
target: `${fullPath}${name}.stories.mdx`,
|
|
77
|
+
})
|
|
78
|
+
|
|
79
|
+
await template.generate({
|
|
80
|
+
props: { name },
|
|
81
|
+
template: 'components/index.ts.ejs',
|
|
82
|
+
target: `${fullPath}index.ts`,
|
|
83
|
+
})
|
|
84
|
+
|
|
85
|
+
success('Arquivos gerados com sucesso!')
|
|
86
|
+
}
|
|
87
|
+
} catch (er) {
|
|
88
|
+
error('Error inesperado')
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import '@testing-library/jest-dom'
|
|
2
|
+
import userEvent from '@testing-library/user-event'
|
|
3
|
+
|
|
4
|
+
import { render, screen } from '@testing-library/vue'
|
|
5
|
+
|
|
6
|
+
import <%- props.name %> from './<%- props.name %>.vue'
|
|
7
|
+
|
|
8
|
+
describe('[<%- props.folder %>] <%- props.name %>', () => {
|
|
9
|
+
it('Renders text <%- props.name %> pass by label prop', () => {
|
|
10
|
+
const label = 'awesome!'
|
|
11
|
+
|
|
12
|
+
render(<%- props.name %>, {
|
|
13
|
+
props: {
|
|
14
|
+
label
|
|
15
|
+
},
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
screen.getByText(label)
|
|
19
|
+
})
|
|
20
|
+
})
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { Meta, Story, Canvas, ArgsTable } from '@storybook/addon-docs'
|
|
2
|
+
import { withDesign } from 'storybook-addon-designs'
|
|
3
|
+
|
|
4
|
+
import <%- props.name %> from './<%- props.name %>.vue'
|
|
5
|
+
|
|
6
|
+
<Meta
|
|
7
|
+
title="Componentes/<%- props.folder %>/<%- props.name %>"
|
|
8
|
+
component={<%- props.name %>}
|
|
9
|
+
decorators={[withDesign]}
|
|
10
|
+
parameters={{
|
|
11
|
+
design: {
|
|
12
|
+
type: 'figma',
|
|
13
|
+
url: '',
|
|
14
|
+
},
|
|
15
|
+
}}
|
|
16
|
+
argTypes={{
|
|
17
|
+
label: 'hi!'
|
|
18
|
+
}}
|
|
19
|
+
/>
|
|
20
|
+
|
|
21
|
+
export const Template = ({ label,...args }) => ({
|
|
22
|
+
components: { <%- props.name %> },
|
|
23
|
+
setup() {
|
|
24
|
+
return { args, label }
|
|
25
|
+
},
|
|
26
|
+
template: `<<%- props.name %> v-bind="args" id="teste"></<%- props.name %>>`,
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
# <%- props.name %>
|
|
30
|
+
|
|
31
|
+
## Melhores praticas
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
## Acessibilidade
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
## Importar localmente
|
|
38
|
+
|
|
39
|
+
```js dark
|
|
40
|
+
import { Sol<%- props.name %> } from '@solfacil/girassol'
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Variants
|
|
44
|
+
<Canvas>
|
|
45
|
+
<Story
|
|
46
|
+
name="Default"
|
|
47
|
+
args={{
|
|
48
|
+
label: 'default',
|
|
49
|
+
}}
|
|
50
|
+
>
|
|
51
|
+
{Template.bind({})}
|
|
52
|
+
</Story>
|
|
53
|
+
</Canvas>
|
|
54
|
+
|
|
55
|
+
## Exemplos de uso
|
|
56
|
+
|
|
57
|
+
```html dark
|
|
58
|
+
<Sol<%- props.name %> id="just-test">Awesome component!</Sol<%- props.name %>>
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Playground
|
|
62
|
+
|
|
63
|
+
<Canvas>
|
|
64
|
+
<Story
|
|
65
|
+
name="Playground"
|
|
66
|
+
args={{
|
|
67
|
+
label: 'its work fine!',
|
|
68
|
+
}}
|
|
69
|
+
>
|
|
70
|
+
{Template.bind({})}
|
|
71
|
+
</Story>
|
|
72
|
+
</Canvas>
|
|
73
|
+
|
|
74
|
+
<ArgsTable story="Playground" />
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
defineProps<{
|
|
3
|
+
id: string
|
|
4
|
+
label?: string
|
|
5
|
+
}>()
|
|
6
|
+
|
|
7
|
+
const emit = defineEmits<{
|
|
8
|
+
(e: 'change', value: string): void
|
|
9
|
+
}>()
|
|
10
|
+
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<template>
|
|
14
|
+
<div class="sol-<%- props.nameClass %>-core" >
|
|
15
|
+
{{ label }}
|
|
16
|
+
</div>
|
|
17
|
+
</template>
|
|
18
|
+
|
|
19
|
+
<style lang="scss">
|
|
20
|
+
.sol-<%- props.nameClass %>-core {
|
|
21
|
+
@apply bg-brand-primary-medium px-2xs;
|
|
22
|
+
}
|
|
23
|
+
</style>
|