Skip to content

Commit fa01e03

Browse files
authored
Merge pull request #72 from wu-component/feat/new
feat:add wu-right-menu component
2 parents d674bfa + d87b2db commit fa01e03

22 files changed

+1014
-0
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# EditorConfig is awesome: https://EditorConfig.org
2+
3+
root = true
4+
5+
[*]
6+
charset = utf-8
7+
indent_size = 4
8+
indent_style = space
9+
insert_final_newline = true
10+
trim_trailing_whitespace = true
11+
12+
[*.md]
13+
trim_trailing_whitespace = false
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
build/**
2+
dist/**
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
module.exports = {
2+
parser: '@typescript-eslint/parser',
3+
parserOptions: {
4+
sourceType: 'module',
5+
},
6+
plugins: [ '@typescript-eslint/eslint-plugin' ],
7+
extends: [
8+
'plugin:@typescript-eslint/eslint-recommended',
9+
'plugin:@typescript-eslint/recommended',
10+
'prettier',
11+
'prettier/@typescript-eslint',
12+
],
13+
root: true,
14+
env: {
15+
node: true,
16+
jest: true,
17+
'shared-node-browser': true,
18+
es6: true
19+
},
20+
rules: {
21+
'@typescript-eslint/no-empty-interface': 'off',
22+
'@typescript-eslint/no-namespace': 'off',
23+
'@typescript-eslint/ban-types': 'off',
24+
'@typescript-eslint/no-var-requires': 'off',
25+
'@typescript-eslint/interface-name-prefix': 'off',
26+
'@typescript-eslint/explicit-function-return-type': 'off',
27+
'@typescript-eslint/no-explicit-any': 'off',
28+
'@typescript-eslint/explicit-module-boundary-types': 'off',
29+
'@typescript-eslint/ban-ts-comment': 'off',
30+
'@typescript-eslint/no-empty-function': 'off',
31+
'@typescript-eslint/no-unused-vars': 'off',
32+
'prefer-rest-params': 'off',
33+
'@typescript-eslint/no-this-alias': 'off',
34+
'semi':[ 'error','always' ],
35+
'prefer-spread': 'off',
36+
"array-bracket-spacing": [ "error","always" ],
37+
"object-curly-spacing": [ "error","always" ]
38+
},
39+
};
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"singleQuote": true,
3+
"trailingComma": "all",
4+
"printWidth": 300,
5+
}
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
const webpack = require('webpack');
2+
const commonRules = [
3+
{
4+
test:/\.tsx?$/,
5+
exclude: /node_modules/,
6+
use: [
7+
{
8+
loader: "ts-loader"
9+
}
10+
]
11+
},
12+
{
13+
test: /\.png|jpg|gif|jpeg|svg/,
14+
type: 'asset/resource',
15+
parser: {
16+
dataUrlCondition: {
17+
maxSize: 10 * 1024,
18+
},
19+
},
20+
generator: {
21+
filename: 'images/[base]',
22+
},
23+
},
24+
{
25+
test: /\.(eot|ttf|woff|woff2)(\?\S*)?$/,
26+
type: 'asset/resource',
27+
generator: {
28+
filename: 'fonts/[base]',
29+
},
30+
},
31+
{
32+
test: /\.css$/,
33+
use:[ // 由后向前加载
34+
{loader: 'css-loader'},
35+
{loader: "postcss-loader"}
36+
]
37+
},
38+
{
39+
test: /\.less$/,
40+
use:[
41+
{loader: 'css-loader'},
42+
{loader: "postcss-loader"},
43+
{loader: 'less-loader'}
44+
]
45+
},
46+
{ // 处理sass/scss
47+
test: /\.s[ac]ss$/i,
48+
use: [
49+
// 将 CSS 转化成 CommonJS 模块
50+
'css-loader',
51+
// 将 Sass 编译成 CSS
52+
'sass-loader',
53+
],
54+
},
55+
{
56+
//test: /\.styl$/,
57+
test: /\.styl(us)?$/,
58+
use: [
59+
{loader: 'css-loader'},
60+
{loader: "postcss-loader"},
61+
{loader: 'stylus-loader'}
62+
]
63+
}
64+
]
65+
const commonPlugins = [
66+
new webpack.HotModuleReplacementPlugin(),
67+
]
68+
module.exports = { commonRules, commonPlugins };
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
const webpack = require('webpack');
2+
const path = require('path');
3+
const HtmlWebpackPlugin = require('html-webpack-plugin');
4+
const {commonPlugins, commonRules} = require("./webpack_common.config");
5+
module.exports = {
6+
entry: ['./src/index.tsx'],
7+
output: {
8+
path: path.resolve(__dirname, '../', "dist"),
9+
filename: "bundle.[chunkhash:8].js",
10+
publicPath: '/',
11+
},
12+
target: 'web',
13+
resolve: {
14+
extensions: ['.ts', '.js', 'tsx'],
15+
},
16+
plugins: [
17+
/*new webpack.EvalSourceMapDevToolPlugin({}),*/
18+
new webpack.HotModuleReplacementPlugin(),
19+
new HtmlWebpackPlugin({
20+
template: "./public/index.html"
21+
}),
22+
/*...commonPlugins*/
23+
24+
],
25+
devServer: {
26+
compress: true,
27+
open: true,
28+
port: 9005
29+
},
30+
// devtool: 'eval-source-map',
31+
devtool: false,
32+
module: {
33+
rules: [
34+
...commonRules
35+
]
36+
}
37+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<title>Title</title>
6+
<script src="./dist/index.umd.js"></script>
7+
</head>
8+
<body>
9+
<div id="app">
10+
<wu-right-menu id="rateTest7" list='[{"name":"保存"},{"name":"另存为"},{"name":"放弃此次修改"},{"name":"设置","menu":[{"name":"首选项"},{"name":"快捷键"}]}]'>
11+
<p>wweee</p>
12+
<p>wweee</p>
13+
<p>wweee</p>
14+
<p>wweee</p>
15+
<p>wweee</p>
16+
<p>wweee</p>
17+
</wu-right-menu>
18+
</div>
19+
</body>
20+
</html>
21+
<script>
22+
document.getElementById('rateTest7').addEventListener("menuclick", (res) => {
23+
console.log(res);
24+
})
25+
</script>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"watch": ["./src"],
3+
"ext": "ts",
4+
"ignore": ["./src/**/*.spec.ts"],
5+
"exec": "node --inspect-brk -r ts-node/register -r tsconfig-paths/register ./src/index.ts"
6+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"watch": ["./src"],
3+
"ext": "ts",
4+
"ignore": ["./src/**/*.spec.ts"],
5+
"env": {
6+
"NODE_ENV": "development"
7+
},
8+
"exec": "cross-env NODE_ENV=production tsc -p tsconfig.build.json && node ./build/dev.js"
9+
}
Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
{
2+
"name": "@wu-component/wu-right-menu",
3+
"version": "1.9.1",
4+
"description": "> TODO: description",
5+
"author": "Marvin <[email protected]>",
6+
"homepage": "",
7+
"license": "ISC",
8+
"directories": {
9+
"lib": "lib",
10+
"test": "__tests__"
11+
},
12+
"types": "./types/index.d.ts",
13+
"main": "./dist/index.cjs.js",
14+
"module": "./dist/index.esm.js",
15+
"browser": "./umd/index.umd.js",
16+
"scripts": {
17+
"format": "prettier --write \"{src,apps,libs,test}/**/*.{tsx,ts}\"",
18+
"lint": "eslint \"{src,apps,libs,test}/**/*.{tsx,ts}\" --fix",
19+
"test": "web-test-runner \"./test/*.js\" --node-resolve",
20+
"example:package": "live-server",
21+
"build:package": "node ./node_modules/@wu-component/wu-build-tools/dist/index.js --input ./src/index.tsx --operate BUILD",
22+
"dev:package": "webpack serve --config ./build/webpack_dev.config --env development --mode development --hot"
23+
},
24+
"publishConfig": {
25+
"access": "public"
26+
},
27+
"engines": {
28+
"node": ">= 10",
29+
"npm": ">= 5"
30+
},
31+
"devDependencies": {
32+
"@babel/preset-typescript": "^7.13.0",
33+
"@open-wc/testing": "^3.1.6",
34+
"@rollup/plugin-commonjs": "^19.0.2",
35+
"@rollup/plugin-inject": "^4.0.4",
36+
"@rollup/plugin-json": "^4.1.0",
37+
"@rollup/plugin-node-resolve": "^13.1.3",
38+
"@rollup/plugin-replace": "^4.0.0",
39+
"@rollup/plugin-typescript": "^8.3.1",
40+
"@rollup/plugin-url": "^6.1.0",
41+
"@types/jest": "^23.3.14",
42+
"@types/node": "^10.17.60",
43+
"@types/yaml": "^1.9.7",
44+
"@typescript-eslint/eslint-plugin": "^5.25.0",
45+
"@typescript-eslint/parser": "^5.25.0",
46+
"@web/test-runner": "^0.13.28",
47+
"@wu-component/wu-build-tools": "latest",
48+
"autoprefixer": "^10.4.4",
49+
"body-parser": "^1.19.0",
50+
"chalk": "4.1.2",
51+
"cross-env": "^7.0.3",
52+
"css-loader": "^6.7.1",
53+
"eslint": "7.1.0",
54+
"eslint-config-prettier": "^6.10.0",
55+
"eslint-plugin-import": "^2.20.1",
56+
"html-webpack-plugin": "^5.5.0",
57+
"jest": "^23.6.0",
58+
"live-server": "^1.2.2",
59+
"nodemon": "^1.18.9",
60+
"prettier": "^1.15.3",
61+
"process": "^0.11.10",
62+
"reflect-metadata": "^0.1.13",
63+
"rollup": "^2.74.1",
64+
"rollup-plugin-filesize": "^9.1.1",
65+
"rollup-plugin-livereload": "^2.0.5",
66+
"rollup-plugin-node-externals": "^2.2.0",
67+
"rollup-plugin-postcss": "^4.0.2",
68+
"rollup-plugin-progress": "^1.1.2",
69+
"rollup-plugin-scss": "^3.0.0",
70+
"rollup-plugin-serve": "^2.0.1",
71+
"rollup-plugin-terser": "^7.0.2",
72+
"rollup-plugin-typescript2": "^0.31.2",
73+
"rollup-plugin-visualizer": "^5.6.0",
74+
"sass": "^1.52.1",
75+
"sass-loader": "^13.0.0",
76+
"style-loader": "^3.3.1",
77+
"ts-jest": "^23.1.4",
78+
"ts-loader": "^9.3.0",
79+
"ts-node": "^7.0.1",
80+
"tsconfig-paths": "^3.7.0",
81+
"tslib": "^2.3.1",
82+
"typescript": "^4.6.4",
83+
"webpack": "^5.72.1",
84+
"webpack-cli": "^4.9.2",
85+
"webpack-dev-server": "^4.9.0"
86+
},
87+
"dependencies": {
88+
"@wu-component/common": "latest",
89+
"@wu-component/web-core-plus": "latest"
90+
},
91+
"files": [
92+
"dist",
93+
"src",
94+
"LICENSE",
95+
"types",
96+
"readme.md"
97+
],
98+
"repository": {
99+
"type": "git",
100+
"url": "https://github.com/wu-component/web-component-plus"
101+
},
102+
"gitHead": "186ad2a3cb32b6a803e5a0c52f6e79363ee4f1c5",
103+
"exports": {
104+
".": {
105+
"types": "./types/index.d.ts",
106+
"require": "./dist/index.cjs.js",
107+
"import": "./dist/index.esm.js"
108+
},
109+
"./*": "./*"
110+
},
111+
"sideEffects": true
112+
}

0 commit comments

Comments
 (0)