初始导入

This commit is contained in:
猴赛雷 2023-08-21 17:22:16 +08:00
commit abe6b3ba2f
23 changed files with 2587 additions and 0 deletions

23
.gitignore vendored Normal file
View File

@ -0,0 +1,23 @@
.DS_Store
node_modules
/dist
# local env files
# .env*
.env.local
.env.*.local
.*.git
# Log files
*.log
# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
*.history
*.zip
yarn.*

40
README.md Normal file
View File

@ -0,0 +1,40 @@
# ddei-editor
This template should help get you started developing with Vue 3 in Vite.
## Recommended IDE Setup
[VSCode](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (and disable Vetur) + [TypeScript Vue Plugin (Volar)](https://marketplace.visualstudio.com/items?itemName=Vue.vscode-typescript-vue-plugin).
## Type Support for `.vue` Imports in TS
TypeScript cannot handle type information for `.vue` imports by default, so we replace the `tsc` CLI with `vue-tsc` for type checking. In editors, we need [TypeScript Vue Plugin (Volar)](https://marketplace.visualstudio.com/items?itemName=Vue.vscode-typescript-vue-plugin) to make the TypeScript language service aware of `.vue` types.
If the standalone TypeScript plugin doesn't feel fast enough to you, Volar has also implemented a [Take Over Mode](https://github.com/johnsoncodehk/volar/discussions/471#discussioncomment-1361669) that is more performant. You can enable it by the following steps:
1. Disable the built-in TypeScript Extension
1) Run `Extensions: Show Built-in Extensions` from VSCode's command palette
2) Find `TypeScript and JavaScript Language Features`, right click and select `Disable (Workspace)`
2. Reload the VSCode window by running `Developer: Reload Window` from the command palette.
## Customize configuration
See [Vite Configuration Reference](https://vitejs.dev/config/).
## Project Setup
```sh
npm install
```
### Compile and Hot-Reload for Development
```sh
npm run dev
```
### Type-Check, Compile and Minify for Production
```sh
npm run build
```

1
env.d.ts vendored Normal file
View File

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

13
index.html Normal file
View File

@ -0,0 +1,13 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link rel="icon" href="/favicon.ico">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Vite App</title>
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.ts"></script>
</body>
</html>

1990
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

25
package.json Normal file
View File

@ -0,0 +1,25 @@
{
"name": "ddei-editor",
"version": "0.0.1",
"private": true,
"scripts": {
"dev": "vite",
"build": "run-p type-check build-only",
"preview": "vite preview",
"build-only": "vite build",
"type-check": "vue-tsc --noEmit -p tsconfig.app.json --composite false"
},
"dependencies": {
"vue": "^3.3.4"
},
"devDependencies": {
"@tsconfig/node18": "^18.2.0",
"@types/node": "^18.17.0",
"@vitejs/plugin-vue": "^4.2.3",
"@vue/tsconfig": "^0.4.0",
"npm-run-all": "^4.1.5",
"typescript": "~5.1.6",
"vite": "^4.4.6",
"vue-tsc": "^1.8.6"
}
}

BIN
public/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

BIN
public/test_img.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

47
src/App.vue Normal file
View File

@ -0,0 +1,47 @@
<template>
<div>
<DDeiEditor></DDeiEditor>
</div>
</template>
<script lang="ts">
import DDeiEditor from "./components/editor/Editor.vue";
export default {
name: "APP-DDEI-EDITOR",
extends: null,
mixins: [],
props: {},
//
components: {
DDeiEditor,
},
data() {
return {
layers: [],
};
},
computed: {},
watch: {},
created() { },
mounted() {
},
methods: {
},
};
</script>
<style>
body {
display: block;
}
#app {
padding: 0;
margin: 0;
display: block;
max-width: 100%;
}
</style>

73
src/assets/base.css Normal file
View File

@ -0,0 +1,73 @@
/* color palette from <https://github.com/vuejs/theme> */
:root {
--vt-c-white: #ffffff;
--vt-c-white-soft: #f8f8f8;
--vt-c-white-mute: #f2f2f2;
--vt-c-black: #181818;
--vt-c-black-soft: #222222;
--vt-c-black-mute: #282828;
--vt-c-indigo: #2c3e50;
--vt-c-divider-light-1: rgba(60, 60, 60, 0.29);
--vt-c-divider-light-2: rgba(60, 60, 60, 0.12);
--vt-c-divider-dark-1: rgba(84, 84, 84, 0.65);
--vt-c-divider-dark-2: rgba(84, 84, 84, 0.48);
--vt-c-text-light-1: var(--vt-c-indigo);
--vt-c-text-light-2: rgba(60, 60, 60, 0.66);
--vt-c-text-dark-1: var(--vt-c-white);
--vt-c-text-dark-2: rgba(235, 235, 235, 0.64);
}
/* semantic color variables for this project */
:root {
--color-background: var(--vt-c-white);
--color-background-soft: var(--vt-c-white-soft);
--color-background-mute: var(--vt-c-white-mute);
--color-border: var(--vt-c-divider-light-2);
--color-border-hover: var(--vt-c-divider-light-1);
--color-heading: var(--vt-c-text-light-1);
--color-text: var(--vt-c-text-light-1);
--section-gap: 160px;
}
@media (prefers-color-scheme: dark) {
:root {
--color-background: var(--vt-c-black);
--color-background-soft: var(--vt-c-black-soft);
--color-background-mute: var(--vt-c-black-mute);
--color-border: var(--vt-c-divider-dark-2);
--color-border-hover: var(--vt-c-divider-dark-1);
--color-heading: var(--vt-c-text-dark-1);
--color-text: var(--vt-c-text-dark-2);
}
}
*,
*::before,
*::after {
box-sizing: border-box;
margin: 0;
font-weight: normal;
}
body {
min-height: 100vh;
color: var(--color-text);
background: var(--color-background);
transition: color 0.5s, background-color 0.5s;
line-height: 1.6;
font-family: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu,
Cantarell, 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
font-size: 15px;
text-rendering: optimizeLegibility;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}

1
src/assets/logo.svg Normal file
View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 261.76 226.69"><path d="M161.096.001l-30.225 52.351L100.647.001H-.005l130.877 226.688L261.749.001z" fill="#41b883"/><path d="M161.096.001l-30.225 52.351L100.647.001H52.346l78.526 136.01L209.398.001z" fill="#34495e"/></svg>

After

Width:  |  Height:  |  Size: 276 B

35
src/assets/main.css Normal file
View File

@ -0,0 +1,35 @@
@import './base.css';
#app {
max-width: 1280px;
margin: 0 auto;
padding: 2rem;
font-weight: normal;
}
a,
.green {
text-decoration: none;
color: hsla(160, 100%, 37%, 1);
transition: 0.4s;
}
@media (hover: hover) {
a:hover {
background-color: hsla(160, 100%, 37%, 0.2);
}
}
@media (min-width: 1024px) {
body {
display: flex;
place-items: center;
}
#app {
display: grid;
grid-template-columns: 1fr 1fr;
padding: 0 2rem;
}
}

View File

@ -0,0 +1,95 @@
<template>
<div>
<div id="ddei_editor"
class="ddei_editor">
<div class="top">
<TopMenu></TopMenu>
</div>
<div class="body">
<div class="left">
<Toolbox></Toolbox>
</div>
<div class="middle">
<CanvasView></CanvasView>
</div>
<div class="right">
<PropertyView></PropertyView>
</div>
</div>
<div class="bottom">
<BottomMenu></BottomMenu>
</div>
</div>
</div>
</template>
<script lang="ts">
import TopMenu from './topmenu/TopMenu.vue';
import Toolbox from './toolbox/Toolbox.vue';
import BottomMenu from './bottommenu/BottomMenu.vue';
import PropertyView from './propertyview/PropertyView.vue';
import CanvasView from './canvasview/CanvasView.vue';
export default {
name: "DDei-Editor",
extends: null,
mixins: [],
props: {},
data() {
return {};
},
//
components: {
TopMenu,
Toolbox,
BottomMenu,
PropertyView,
CanvasView
},
computed: {},
watch: {},
created() {},
mounted() {
},
};
</script>
<style scoped>
.ddei_editor {
width: 100%;
height: calc(100vh);
display: flex;
flex-direction: column;
background-color: aquamarine;
}
.ddei_editor .top {
background: grey;
flex: 0 0 175px!important;
}
.ddei_editor .body {
display: flex;
flex: 1;
}
.ddei_editor .body .left {
text-align: center;
background: green;
flex: 0 0 220px!important;
}
.ddei_editor .body .middle {
background: blue;
flex: 1;
}
.ddei_editor .body .right {
flex: 0 0 275px!important;
}
.ddei_editor .bottom {
flex: 0 0 60px!important;
}
</style>

View File

@ -0,0 +1,38 @@
<template>
<div id="ddei_editor_bottommenu"
class="ddei_editor_bottommenu">
<button type="button" v-for="(item, i) in layers" @click="changeLayer(i)" style="width:120px;height:30px;margin-top:10px">{{ item.id }}</button>
<button type="button" @click="createLayer()" style="width:120px;height:30px;margin-top:10px">图层+</button>
<button type="button" @click="removeLayer()" style="width:120px;height:30px;margin-top:10px">图层-</button>
<button type="button" @click="displayLayer()" style="width:120px;height:30px;margin-top:10px">显示图层</button>
<button type="button" @click="hiddenLayer()" style="width:120px;height:30px;margin-top:10px">隐藏图层</button>
<button type="button" style="width:120px;height:30px;margin-top:10px">放大</button>
<button type="button" style="width:120px;height:30px;margin-top:10px">缩小</button>
</div>
</template>
<script lang="ts">
export default {
name: "DDei-Editor-BottomMenu",
extends: null,
mixins: [],
props: {},
data() {
return {};
},
computed: {},
watch: {},
created() {},
mounted() {
},
};
</script>
<style scoped>
.ddei_editor_bottommenu {
height:60px;
width:100%;
background: #d87093;
}
</style>

View File

@ -0,0 +1,32 @@
<template>
<div>
<div id="ddei_editor_canvasyview"
class="ddei_editor_canvasyview">
</div>
</div>
</template>
<script lang="ts">
export default {
name: "DDei-Editor-CanvasView",
extends: null,
mixins: [],
props: {},
data() {
return {};
},
computed: {},
watch: {},
created() {},
mounted() {
},
};
</script>
<style scoped>
.ddei_editor_canvasyview {
background: blue;
}
</style>

View File

@ -0,0 +1,33 @@
<template>
<div>
<div id="ddei_editor_propertyview"
class="ddei_editor_propertyview">
</div>
</div>
</template>
<script lang="ts">
export default {
name: "DDei-Editor-PropertyView",
extends: null,
mixins: [],
props: {},
data() {
return {};
},
computed: {},
watch: {},
created() {},
mounted() {
},
};
</script>
<style scoped>
.ddei_editor_propertyview {
background: red;
height:100%
}
</style>

View File

@ -0,0 +1,42 @@
<template>
<div>
<div id="ddei_editor_toolbox"
class="ddei_editor_toolbox">
<button type="button" @click="createRectangle()" style="width:120px;height:30px;margin-top:10px">矩形</button>
<button type="button" @click="createCircle()" style="width:120px;height:30px;margin-top:10px">圆型</button>
<button type="button" @click="createDiamond()" style="width:120px;height:30px;margin-top:10px">菱形</button>
<button type="button" @click="createImg(1)" style="width:120px;height:30px;margin-top:10px">矩形图片</button>
<button type="button" @click="createImg(2)" style="width:120px;height:30px;margin-top:10px">圆形图片</button>
<button type="button" @click="createImg(3)" style="width:120px;height:30px;margin-top:10px">菱形图片</button>
<button type="button" @click="createContainer(1)" style="width:120px;height:30px;margin-top:10px">容器-不联动</button>
<button type="button" @click="createContainer(2)" style="width:120px;height:30px;margin-top:10px">容器-联动子</button>
<button type="button" @click="createContainer(3)" style="width:120px;height:30px;margin-top:10px">容器-联动父</button>
<button type="button" @click="createContainer(4)" style="width:120px;height:30px;margin-top:10px">容器-双联动</button>
</div>
</div>
</template>
<script lang="ts">
export default {
name: "DDei-Editor-Toolbox",
extends: null,
mixins: [],
props: {},
data() {
return {};
},
computed: {},
watch: {},
created() {},
mounted() {
},
};
</script>
<style scoped>
.ddei_editor_toolbox {
text-align: center;
background: green;
}
</style>

View File

@ -0,0 +1,38 @@
<template>
<div>
<div id="ddei_editor_topmenu"
class="ddei_editor_topmenu">
<button type="button" style="width:120px;height:30px;margin-top:10px">新建</button>
<button type="button" style="width:120px;height:30px;margin-top:10px">打开</button>
<button type="button" style="width:120px;height:30px;margin-top:10px">保存</button>
</div>
</div>
</template>
<script lang="ts">
export default {
name: "DDei-Editor-TopMenu",
extends: null,
mixins: [],
props: {},
data() {
return {};
},
computed: {},
watch: {},
created() {},
mounted() {
},
};
</script>
<style scoped>
.ddei_editor_topmenu {
background: grey;
width: 100%;
height: 175px;
}
</style>

6
src/main.ts Normal file
View File

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

12
tsconfig.app.json Normal file
View File

@ -0,0 +1,12 @@
{
"extends": "@vue/tsconfig/tsconfig.dom.json",
"include": ["env.d.ts", "src/**/*", "src/**/*.vue"],
"exclude": ["src/**/__tests__/*"],
"compilerOptions": {
"composite": true,
"baseUrl": ".",
"paths": {
"@/*": ["./src/*"]
}
}
}

11
tsconfig.json Normal file
View File

@ -0,0 +1,11 @@
{
"files": [],
"references": [
{
"path": "./tsconfig.node.json"
},
{
"path": "./tsconfig.app.json"
}
]
}

16
tsconfig.node.json Normal file
View File

@ -0,0 +1,16 @@
{
"extends": "@tsconfig/node18/tsconfig.json",
"include": [
"vite.config.*",
"vitest.config.*",
"cypress.config.*",
"nightwatch.conf.*",
"playwright.config.*"
],
"compilerOptions": {
"composite": true,
"module": "ESNext",
"moduleResolution": "Bundler",
"types": ["node"]
}
}

16
vite.config.ts Normal file
View File

@ -0,0 +1,16 @@
import { fileURLToPath, URL } from 'node:url'
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
// https://vitejs.dev/config/
export default defineConfig({
plugins: [
vue(),
],
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url))
}
}
})