Skip to content

Commit 6cd34d2

Browse files
committed
chore: add plugin example
1 parent 9f0936c commit 6cd34d2

11 files changed

+148
-1
lines changed

example/main/LICENSE

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

example/main/index.html

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
4+
<head>
5+
<meta charset="UTF-8" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7+
<title>canvas-editor-plugin-example</title>
8+
</head>
9+
10+
<body>
11+
<div id="app">
12+
<h1>canvas-editor-plugin-example</h1>
13+
<main>
14+
<iframe src="https://codesandbox.io/embed/nostalgic-grothendieck-fwm59s?fontsize=14&hidenavigation=1&theme=dark"
15+
style="width:100%; height:80vh; border:0; border-radius: 4px; overflow:hidden;"
16+
title="nostalgic-grothendieck-fwm59s"
17+
allow="accelerometer; ambient-light-sensor; camera; encrypted-media; geolocation; gyroscope; hid; microphone; midi; payment; usb; vr; xr-spatial-tracking"
18+
sandbox="allow-forms allow-modals allow-popups allow-presentation allow-same-origin allow-scripts"></iframe>
19+
</main>
20+
</div>
21+
<script type="module" src="/src/main.ts"></script>
22+
</body>
23+
24+
</html>

example/main/package.json

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"name": "canvas-editor-plugin-example",
3+
"author": "Hufe",
4+
"license": "MIT",
5+
"version": "0.0.1",
6+
"description": "canvas-editor-plugin example",
7+
"publishConfig": {
8+
"registry": "https://registry.npmjs.org/",
9+
"access": "public"
10+
},
11+
"repository": {
12+
"type": "git",
13+
"url": "https://github.com/Hufe921/canvas-editor-plugin.git"
14+
},
15+
"keywords": [
16+
"canvas-editor",
17+
"canvas-editor-plugin"
18+
],
19+
"scripts": {
20+
"dev": "vite",
21+
"build": "vite build",
22+
"type:check": "tsc --noEmit"
23+
},
24+
"devDependencies": {
25+
"@rollup/plugin-typescript": "^10.0.1",
26+
"@typescript-eslint/eslint-plugin": "4.33.0",
27+
"@typescript-eslint/parser": "4.33.0",
28+
"eslint": "7.32.0",
29+
"sass": "^1.69.2",
30+
"simple-git-hooks": "^2.8.1",
31+
"typescript": "^5.0.2",
32+
"vite": "^4.3.9"
33+
}
34+
}

example/main/src/index.scss

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
body {
2+
background-color: #f2f4f7;
3+
}
4+
5+
#app {
6+
h1 {
7+
font-size: 26px;
8+
text-align: center;
9+
margin: 50px auto;
10+
}
11+
12+
main {
13+
width: 90%;
14+
height: 100%;
15+
margin: 0 auto;
16+
}
17+
}

example/main/src/main.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
import './index.scss'

example/main/src/vite-env.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/// <reference types="vite/client" />

example/main/tsconfig.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"extends": ["../../tsconfig.json"],
3+
"compilerOptions": {
4+
"outDir": "dist",
5+
"rootDir": ""
6+
},
7+
"include": [
8+
"./src/**/*.ts"
9+
]
10+
}

example/main/vite.config.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { defineConfig } from 'vite'
2+
3+
export default defineConfig(() => {
4+
return {
5+
base: `/canvas-editor-plugin/`,
6+
server: {
7+
host: '0.0.0.0'
8+
}
9+
}
10+
})

lerna.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"packages": [
3-
"packages/*"
3+
"packages/*",
4+
"example/*"
45
],
56
"version": "0.0.1",
67
"npmClient": "pnpm",

pnpm-lock.yaml

Lines changed: 27 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pnpm-workspace.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
packages:
22
- 'packages/**'
3+
- 'example/**'

0 commit comments

Comments
 (0)