Skip to content
This repository was archived by the owner on Jan 9, 2022. It is now read-only.

Commit 7d70812

Browse files
Merge pull request #2 from MichaelGitArt/next
Next
2 parents 28c3c4f + b5c8018 commit 7d70812

26 files changed

+568
-176
lines changed

packages/demo/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@
88
"license": "MIT",
99
"dependencies": {
1010
"@vueuse/core": "^5.2.0",
11-
"gitart-vue-dialog": "1.1.0"
11+
"gitart-vue-dialog": "^1.2.0"
1212
},
1313
"devDependencies": {
1414
"@vitejs/plugin-vue": "^1.3.0",
1515
"vite": "^2.5.3",
1616
"vite-plugin-windicss": "^1.2.7",
17-
"vue-tsc": "0.3.0",
17+
"vue-tsc": "^0.29.8",
1818
"windicss": "^3.1.6"
1919
}
2020
}

packages/demo/src/components/UI/Radio/Radio.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<template>
22
<div>
3-
<label v-bind="''">
3+
<label>
44
<input
55
type="radio"
66
:name="computedName"

packages/dialog/.npmignore

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
*
2+
!dist/**/*
3+
!LINCENSE
4+
README.md

packages/dialog/LICENSE

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
MIT License
2+
3+
Copyright (c) 2021 Misha Kryvoruchko
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6+
7+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8+
9+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
10+
11+
The MIT License (MIT)

packages/dialog/README.md

+5-3
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,13 @@
1010

1111
🤯 [Examples](https://michaelgitart.github.io/gitart-vue-dialog/)
1212

13+
🃏 [Plan for the Future](https://trello.com/b/CYcpbq4F/gitart-oss/)
14+
1315
Typescript support, customizable, beautifully animated, lightweight
1416

15-
~9.5 KiB - index.upd.js `gitart-vue-dialog` <br/>
16-
~8.6 KiB - index.es.js `gitart-vue-dialog/dist/index.es.js` <br/>
17-
~1.7 KiB - style.css `gitart-vue-dialog/dist/style.css` <br/>
17+
~9.9 KiB - index.cjs `gitart-vue-dialog` <br/>
18+
~8.9 KiB - index.mjs `gitart-vue-dialog/dist/index.mjs` <br/>
19+
~1.8 KiB - style.css `gitart-vue-dialog/dist/style.css` <br/>
1820

1921

2022
## Instalation

packages/dialog/build/build.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,4 @@ const shell = require('shelljs')
44

55
shell.exec('vue-tsc --noEmit')
66
shell.exec('vite build --config build/vite.config.ts')
7-
shell.exec('cp ./build/index.d.ts ./dist/index.es.d.ts')
8-
shell.exec('cp ./build/index.d.ts ./dist/index.upd.d.ts')
7+
shell.exec('vue-tsc --declaration --emitDeclarationOnly --p build/tsconfig.json')

packages/dialog/build/index.d.ts

-1
This file was deleted.

packages/dialog/build/tsconfig.json

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"extends": "../tsconfig.json",
3+
"compilerOptions": {
4+
"outDir": "../dist",
5+
},
6+
"files": [
7+
"../src/index.ts"
8+
]
9+
}

packages/dialog/build/vite.config.ts

+11-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,17 @@ export default defineConfig({
1818
lib: {
1919
entry: resolve('src/index.ts'),
2020
name: 'index',
21-
fileName: format => `index.${format}.js`,
21+
fileName: format => {
22+
let fileEnd = 'js'
23+
24+
if(format === 'es') {
25+
fileEnd = 'mjs'
26+
}else if (format === 'umd') {
27+
fileEnd = 'cjs'
28+
}
29+
30+
return `index.${fileEnd}`
31+
},
2232
},
2333

2434
rollupOptions: {

packages/dialog/dev/.eslintrc.js

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/* eslint-env node */
2+
module.exports = {
3+
extends: [
4+
'../../../.eslintrc.js',
5+
],
6+
7+
rules: {
8+
'no-undef': 'off',
9+
},
10+
}

packages/dialog/dev/Playground.template.vue

+6-19
Original file line numberDiff line numberDiff line change
@@ -6,27 +6,14 @@
66
Content
77
</GDialog>
88

9-
<button @click="dialog = true">
9+
<button
10+
class="btn"
11+
@click="dialog = true"
12+
>
1013
Open
1114
</button>
1215
</template>
1316

14-
<script lang="ts">
15-
import { ref } from 'vue'
16-
import { GDialog } from 'gitart-vue-dialog'
17-
18-
export default {
19-
name: 'Playground',
20-
components: {
21-
GDialog,
22-
},
23-
24-
setup() {
25-
const dialog = ref(false)
26-
27-
return {
28-
dialog,
29-
}
30-
},
31-
}
17+
<script setup lang="ts">
18+
const dialog = ref(false)
3219
</script>

packages/dialog/dev/auto-imports.d.ts

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
// Generated by 'unplugin-auto-import'
2+
// We suggest you to commit this file into source control
3+
declare global {
4+
const computed: typeof import('vue')['computed']
5+
const createApp: typeof import('vue')['createApp']
6+
const customRef: typeof import('vue')['customRef']
7+
const defineAsyncComponent: typeof import('vue')['defineAsyncComponent']
8+
const defineComponent: typeof import('vue')['defineComponent']
9+
const dialogInjectionKey: typeof import('gitart-vue-dialog')['dialogInjectionKey']
10+
const dialogPlugin: typeof import('gitart-vue-dialog')['plugin']
11+
const effectScope: typeof import('vue')['effectScope']
12+
const EffectScope: typeof import('vue')['EffectScope']
13+
const getCurrentInstance: typeof import('vue')['getCurrentInstance']
14+
const getCurrentScope: typeof import('vue')['getCurrentScope']
15+
const h: typeof import('vue')['h']
16+
const inject: typeof import('vue')['inject']
17+
const isReadonly: typeof import('vue')['isReadonly']
18+
const isRef: typeof import('vue')['isRef']
19+
const markRaw: typeof import('vue')['markRaw']
20+
const nextTick: typeof import('vue')['nextTick']
21+
const onActivated: typeof import('vue')['onActivated']
22+
const onBeforeMount: typeof import('vue')['onBeforeMount']
23+
const onBeforeUnmount: typeof import('vue')['onBeforeUnmount']
24+
const onBeforeUpdate: typeof import('vue')['onBeforeUpdate']
25+
const onDeactivated: typeof import('vue')['onDeactivated']
26+
const onErrorCaptured: typeof import('vue')['onErrorCaptured']
27+
const onMounted: typeof import('vue')['onMounted']
28+
const onRenderTracked: typeof import('vue')['onRenderTracked']
29+
const onRenderTriggered: typeof import('vue')['onRenderTriggered']
30+
const onScopeDispose: typeof import('vue')['onScopeDispose']
31+
const onServerPrefetch: typeof import('vue')['onServerPrefetch']
32+
const onUnmounted: typeof import('vue')['onUnmounted']
33+
const onUpdated: typeof import('vue')['onUpdated']
34+
const provide: typeof import('vue')['provide']
35+
const reactive: typeof import('vue')['reactive']
36+
const readonly: typeof import('vue')['readonly']
37+
const ref: typeof import('vue')['ref']
38+
const shallowReactive: typeof import('vue')['shallowReactive']
39+
const shallowReadonly: typeof import('vue')['shallowReadonly']
40+
const shallowRef: typeof import('vue')['shallowRef']
41+
const toRaw: typeof import('vue')['toRaw']
42+
const toRef: typeof import('vue')['toRef']
43+
const toRefs: typeof import('vue')['toRefs']
44+
const triggerRef: typeof import('vue')['triggerRef']
45+
const unref: typeof import('vue')['unref']
46+
const useAttrs: typeof import('vue')['useAttrs']
47+
const useCssModule: typeof import('vue')['useCssModule']
48+
const useSlots: typeof import('vue')['useSlots']
49+
const watch: typeof import('vue')['watch']
50+
const watchEffect: typeof import('vue')['watchEffect']
51+
}
52+
export {}

packages/dialog/dev/components.d.ts

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// generated by unplugin-vue-components
2+
// We suggest you to commit this file into source control
3+
// Read more: https://github.com/vuejs/vue-next/pull/3399
4+
5+
declare module 'vue' {
6+
export interface GlobalComponents {
7+
GDialog: typeof import('gitart-vue-dialog')['GDialog']
8+
GDialogRoot: typeof import('gitart-vue-dialog')['GDialogRoot']
9+
}
10+
}
11+
12+
export { }

packages/dialog/dev/main.ts

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import { createApp } from 'vue'
22

3+
import 'virtual:windi.css'
4+
35
import App from './App.vue'
46
import dialogPlugin from './g-dialog'
57

packages/dialog/dev/vite.config.ts

+34-6
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,48 @@
11
/*eslint-env node*/
22
import path from 'path'
3-
import { defineConfig, UserConfigExport } from 'vite'
3+
import { defineConfig } from 'vite'
44
import vue from '@vitejs/plugin-vue'
5+
import AutoImport from 'unplugin-auto-import/vite'
6+
import Components from 'unplugin-vue-components/vite'
57
import WindiCSS from 'vite-plugin-windicss'
68

79
const resolve = (str: string) => path.resolve(__dirname, str)
810

9-
export default ({ mode }: { mode: 'production'| 'development' }): UserConfigExport => defineConfig({
11+
export default defineConfig({
1012
root: resolve('.'),
11-
base: mode === 'production'
12-
? '/gitart-vue-dialog/'
13-
: '/',
1413

1514
plugins: [
1615
vue(),
17-
WindiCSS(),
16+
AutoImport({
17+
imports: [
18+
'vue',
19+
{
20+
'gitart-vue-dialog': [
21+
'dialogInjectionKey',
22+
['plugin', 'dialogPlugin'],
23+
],
24+
},
25+
],
26+
dts: resolve('auto-imports.d.ts'),
27+
}),
28+
Components({
29+
resolvers: [
30+
(name: string) => {
31+
if ([
32+
'GDialog',
33+
'GDialogRoot',
34+
].includes(name)) {
35+
return { importName: name, path: 'gitart-vue-dialog' }
36+
}
37+
38+
return
39+
},
40+
],
41+
dts: resolve('components.d.ts'),
42+
}),
43+
WindiCSS({
44+
config: resolve('windi.config.ts'),
45+
}),
1846
],
1947

2048
server: {

packages/dialog/dev/windi.config.ts

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { defineConfig } from 'windicss/helpers'
2+
import plugin from 'windicss/plugin'
3+
4+
export default defineConfig({
5+
attributify: true,
6+
extract: {
7+
include: ['./**/*.{vue,html,jsx,tsx}'],
8+
},
9+
plugins: [
10+
plugin(({ addComponents }) => {
11+
addComponents({
12+
'.btn': {
13+
'backgroundColor': '#3490dc',
14+
padding: '.5rem 1rem',
15+
borderRadius: '.25rem',
16+
color: '#fff',
17+
fontWeight: '600',
18+
'&:hover': {
19+
backgroundColor: '#2779bd',
20+
},
21+
},
22+
})
23+
}),
24+
],
25+
})

packages/dialog/package.json

+13-8
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,22 @@
11
{
22
"name": "gitart-vue-dialog",
3-
"version": "1.1.0",
3+
"version": "1.2.0",
44
"scripts": {
55
"dev": "vite --config dev/vite.config.ts",
6-
"build": "node build/build.js"
6+
"build": "node build/build.js",
7+
"build:types": "vue-tsc --declaration --emitDeclarationOnly --p ./build/tsconfig.json"
78
},
8-
"main": "./dist/index.umd.js",
9-
"module": "./dist/index.es.js",
9+
"main": "./dist/index.cjs",
10+
"module": "./dist/index.mjs",
1011
"exports": {
1112
".": {
12-
"import": "./dist/index.es.js",
13-
"require": "./dist/index.umd.js"
13+
"import": "./dist/index.mjs",
14+
"require": "./dist/index.cjs"
1415
},
1516
"./dist/*": "./dist/*",
1617
"./package.json": "./package.json"
1718
},
18-
"types": "dist/index.upd.d.ts",
19+
"types": "dist/index.d.ts",
1920
"keywords": [
2021
"gitart",
2122
"gitart-vue-dialog",
@@ -42,9 +43,13 @@
4243
"@vitejs/plugin-vue": "^1.6.0",
4344
"sass": "^1.39.0",
4445
"shelljs": "^0.8.4",
46+
"unplugin-auto-import": "^0.5.1",
47+
"unplugin-vue-components": "^0.17.5",
4548
"vite": "^2.5.3",
49+
"vite-plugin-windicss": "^1.5.4",
4650
"vue": "3.2.6",
47-
"vue-tsc": "^0.3.0"
51+
"vue-tsc": "^0.29.8",
52+
"windicss": "^3.2.1"
4853
},
4954
"peerDependencies": {
5055
"vue": "^3.2.6"

0 commit comments

Comments
 (0)