feat: add blocks (#1918)

This commit is contained in:
Kagol 2024-08-15 17:28:50 +08:00 committed by GitHub
parent 09efdec5f1
commit 5f524400a5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
13 changed files with 197 additions and 0 deletions

25
examples/blocks/.gitignore vendored Normal file
View File

@ -0,0 +1,25 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*
node_modules
dist
dist-ssr
*.local
package-lock.json
# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

10
examples/blocks/README.md Normal file
View File

@ -0,0 +1,10 @@
# Blocks
使用 TinyVue 组件搭建出来的区块。
## 本启启动
```shell
pnpm i
pnpm -F blocks dev
```

53
examples/blocks/components.d.ts vendored Normal file
View File

@ -0,0 +1,53 @@
/* eslint-disable */
/* prettier-ignore */
// @ts-nocheck
// Generated by unplugin-vue-components
// Read more: https://github.com/vuejs/core/pull/3399
export {}
declare module 'vue' {
export interface GlobalComponents {
RouterLink: (typeof import('vue-router'))['RouterLink']
RouterView: (typeof import('vue-router'))['RouterView']
TinyActionSheet: (typeof import('@opentiny/vue'))['ActionSheet']
TinyAlert: (typeof import('@opentiny/vue'))['Alert']
TinyBaseSelect: (typeof import('@opentiny/vue'))['BaseSelect']
TinyButton: (typeof import('@opentiny/vue'))['Button']
TinyCascaderSelect: (typeof import('@opentiny/vue'))['CascaderSelect']
TinyCell: (typeof import('@opentiny/vue'))['Cell']
TinyCheckbox: (typeof import('@opentiny/vue'))['Checkbox']
TinyCheckboxGroup: (typeof import('@opentiny/vue'))['CheckboxGroup']
TinyCol: (typeof import('@opentiny/vue'))['Col']
TinyCustomSwitch: (typeof import('@opentiny/vue'))['CustomSwitch']
TinyDialogBox: (typeof import('@opentiny/vue'))['DialogBox']
TinyDropdown: (typeof import('@opentiny/vue'))['Dropdown']
TinyDropdownItem: (typeof import('@opentiny/vue'))['DropdownItem']
TinyDropdownMenu: (typeof import('@opentiny/vue'))['DropdownMenu']
TinyException: (typeof import('@opentiny/vue'))['Exception']
TinyFilterBox: (typeof import('@opentiny/vue'))['FilterBox']
TinyGrid: (typeof import('@opentiny/vue'))['Grid']
TinyGridColumn: (typeof import('@opentiny/vue'))['GridColumn']
TinyInput: (typeof import('@opentiny/vue'))['Input']
TinyLayout: (typeof import('@opentiny/vue'))['Layout']
TinyModal: (typeof import('@opentiny/vue'))['Modal']
TinyOption: (typeof import('@opentiny/vue'))['Option']
TinyOptionGroup: (typeof import('@opentiny/vue'))['OptionGroup']
TinyPager: (typeof import('@opentiny/vue'))['Pager']
TinyPopover: (typeof import('@opentiny/vue'))['Popover']
TinyRadio: (typeof import('@opentiny/vue'))['Radio']
TinyRadioGroup: (typeof import('@opentiny/vue'))['RadioGroup']
TinyRecycleScroller: (typeof import('@opentiny/vue'))['RecycleScroller']
TinyRow: (typeof import('@opentiny/vue'))['Row']
TinySearch: (typeof import('@opentiny/vue'))['Search']
TinySelect: (typeof import('@opentiny/vue'))['Select']
TinySelectedBox: (typeof import('@opentiny/vue'))['SelectedBox']
TinySplit: (typeof import('@opentiny/vue'))['Split']
TinyTabItem: (typeof import('@opentiny/vue'))['TabItem']
TinyTabs: (typeof import('@opentiny/vue'))['Tabs']
TinyTagGroup: (typeof import('@opentiny/vue'))['TagGroup']
TinyTimePickerMobile: (typeof import('@opentiny/vue'))['TimePickerMobile']
TinyTooltip: (typeof import('@opentiny/vue'))['Tooltip']
TinyTree: (typeof import('@opentiny/vue'))['Tree']
TinyUserHead: (typeof import('@opentiny/vue'))['UserHead']
}
}

View File

@ -0,0 +1,12 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>TinyVue 区块</title>
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.ts"></script>
</body>
</html>

View File

@ -0,0 +1,22 @@
{
"name": "blocks",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "vue-tsc && vite build",
"preview": "vite preview"
},
"dependencies": {
"@opentiny/vue": "~3.18.0",
"vue": "^3.3.11"
},
"devDependencies": {
"@opentiny/unplugin-tiny-vue": "~0.0.2",
"@vitejs/plugin-vue": "^4.5.2",
"typescript": "^5.2.2",
"vite": "^5.0.8",
"vue-tsc": "^1.8.25"
}
}

View File

@ -0,0 +1,9 @@
<script setup lang="ts">
import BlockDemo from './blocks/BlockDemo.vue'
</script>
<template>
<BlockDemo />
</template>
<style scoped></style>

View File

@ -0,0 +1,8 @@
<script setup lang="ts"></script>
<template>
<tiny-button>确定</tiny-button>
<tiny-alert description="描述信息"></tiny-alert>
</template>
<style scoped></style>

View File

@ -0,0 +1,5 @@
import { createApp } from 'vue'
import './style.css'
import App from './App.vue'
createApp(App).mount('#app')

View File

1
examples/blocks/src/vite-env.d.ts vendored Normal file
View File

@ -0,0 +1 @@
/// <reference types="vite/client" />

View File

@ -0,0 +1,25 @@
{
"compilerOptions": {
"target": "ES2020",
"useDefineForClassFields": true,
"module": "ESNext",
"lib": ["ES2020", "DOM", "DOM.Iterable"],
"skipLibCheck": true,
/* Bundler mode */
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "preserve",
/* Linting */
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true
},
"include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.vue"],
"references": [{ "path": "./tsconfig.node.json" }]
}

View File

@ -0,0 +1,10 @@
{
"compilerOptions": {
"composite": true,
"skipLibCheck": true,
"module": "ESNext",
"moduleResolution": "bundler",
"allowSyntheticDefaultImports": true
},
"include": ["vite.config.ts"]
}

View File

@ -0,0 +1,17 @@
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import autoImportPlugin from '@opentiny/unplugin-tiny-vue'
// https://vitejs.dev/config/
export default defineConfig({
plugins: [vue(), autoImportPlugin('vite')],
resolve: {
alias: [
// XDesign 主题
{
find: /\@opentiny\/vue-theme\/(?!(smb))/,
replacement: '@opentiny/vue-theme/smb-theme/'
}
]
}
})