Skip to content

Commit d917408

Browse files
committed
init
0 parents  commit d917408

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+8572
-0
lines changed

.browserslistrc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
defaults

.editorconfig

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
indent_size = 2
7+
indent_style = space
8+
insert_final_newline = true
9+
trim_trailing_whitespace = true

.eslintignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.tmp
2+
dist
3+
/config

.eslintrc.js

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// https://eslint.org/docs/user-guide/configuring
2+
3+
module.exports = {
4+
root: true,
5+
parser: 'vue-eslint-parser',
6+
parserOptions: {
7+
parser: '@babel/eslint-parser',
8+
ecmaVersion: 2020,
9+
sourceType: 'module'
10+
},
11+
env: {
12+
browser: true,
13+
node: true,
14+
es6: true,
15+
jest: true
16+
},
17+
plugins: ['vue', 'prettier'],
18+
extends: ['plugin:vue/vue3-recommended', 'prettier'],
19+
rules: {
20+
// allow debugger during development
21+
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off'
22+
}
23+
};

.gitignore

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
lerna-debug.log*
8+
9+
# Coverage directory used by tools like istanbul
10+
coverage
11+
*.lcov
12+
13+
# nyc test coverage
14+
.nyc_output
15+
16+
# Dependency directories
17+
bower_components
18+
node_modules/
19+
jspm_packages/
20+
web_modules/
21+
22+
# Build build output
23+
.tmp/
24+
dist/
25+
26+
# MacOS generated files
27+
.DS_Store
28+
29+
# Others
30+
.vscode/

.prettierrc

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"singleQuote": true,
3+
"trailingComma": "none"
4+
}

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2021-present, N.Elf-mousE
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 all
13+
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 THE
21+
SOFTWARE.

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# BalmUI pro

babel.config.js

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
module.exports = function (api) {
2+
let envOptions = api.env('production')
3+
? {
4+
modules: false,
5+
useBuiltIns: 'entry',
6+
corejs: { version: '3.22', proposals: true }
7+
}
8+
: {
9+
modules: false
10+
};
11+
let runtimeOptions = api.env('production') ? { corejs: 3 } : {};
12+
13+
return {
14+
presets: [['@babel/preset-env', envOptions]],
15+
plugins: [
16+
['@babel/plugin-transform-runtime', runtimeOptions],
17+
[
18+
'prismjs',
19+
{
20+
languages: [
21+
'markup',
22+
'css',
23+
'javascript',
24+
'bash',
25+
'scss',
26+
'typescript'
27+
],
28+
plugins: ['highlight-keywords', 'toolbar', 'copy-to-clipboard']
29+
}
30+
]
31+
]
32+
};
33+
};

balm.config.js

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
const getConfig = require('./config/balmrc');
2+
const api = require('./config/balm.api');
3+
4+
module.exports = (balm) => {
5+
return {
6+
config: getConfig(balm),
7+
api
8+
};
9+
};

balm.env.js

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
function setBalmCore(useSource = false) {
2+
const BALM_ROOT = '/Users/elf-mouse/www/balmjs/balm-next';
3+
const BALM_CORE_SOURCE = `${BALM_ROOT}/packages/balm-core`;
4+
const BALM_CORE =
5+
'/Users/elf-mouse/.config/yarn/global/node_modules/balm-core';
6+
7+
process.env.BALM_CORE = useSource ? BALM_CORE_SOURCE : BALM_CORE;
8+
}
9+
10+
setBalmCore();

config/balm.api.js

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module.exports = (mix) => {
2+
if (mix.env.isProd) {
3+
} else {
4+
mix.copy('node_modules/balm-ui/fonts/*', 'docs/fonts');
5+
}
6+
};

config/balmrc.js

+115
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
const env = require('./env');
2+
const path = require('path');
3+
const webpack = require('webpack');
4+
const { VueLoaderPlugin } = require('vue-loader');
5+
const { ModuleFederationPlugin } = webpack.container;
6+
7+
const workspace = path.join(__dirname, '..');
8+
9+
function resolve(dir) {
10+
return path.join(workspace, dir);
11+
}
12+
13+
function getConfig(balm) {
14+
const { isProd } = balm.config.env;
15+
const useDocsProd = isProd && env.buildDocs;
16+
const useDocsDev = !isProd || env.buildDocs;
17+
const useBuild = isProd && !env.buildDocs;
18+
19+
return {
20+
server: {
21+
historyOptions: true
22+
},
23+
roots: {
24+
source: useDocsDev ? 'docs' : 'src'
25+
},
26+
styles: {
27+
extname: 'scss'
28+
},
29+
scripts: {
30+
lint: true,
31+
entry: useDocsDev
32+
? {
33+
app: './docs/scripts/index.js'
34+
}
35+
: {
36+
'balm-ui-pro': './src/scripts/index.js'
37+
},
38+
library: useDocsDev
39+
? ''
40+
: {
41+
name: 'BalmUIPro',
42+
type: 'umd',
43+
umdNamedDefine: true
44+
},
45+
loaders: [
46+
{
47+
test: /\.md$/,
48+
use: ['html-loader', 'markdown-loader']
49+
},
50+
{
51+
test: /\.vue$/,
52+
loader: 'vue-loader'
53+
}
54+
],
55+
alias: {
56+
vue$: 'vue/dist/vue.esm-bundler.js',
57+
'balm-ui$': 'balm-ui/src/scripts/balm-ui.js',
58+
'balm-ui-plus$': 'balm-ui/src/scripts/balm-ui-plus.js',
59+
'balm-ui-next$': 'balm-ui/src/scripts/balm-ui-next.js',
60+
'balm-ui-pro': resolve('src/scripts/index.js'),
61+
'@': resolve('docs/scripts')
62+
},
63+
includeJsResource: [
64+
resolve('node_modules/balm-ui/src/scripts'),
65+
...(useDocsDev ? [resolve('src/scripts')] : [])
66+
],
67+
plugins: [
68+
new VueLoaderPlugin(),
69+
new webpack.DefinePlugin({
70+
__VUE_OPTIONS_API__: JSON.stringify(true),
71+
__VUE_PROD_DEVTOOLS__: JSON.stringify(false)
72+
}),
73+
...(useDocsProd
74+
? [
75+
new ModuleFederationPlugin({
76+
name: 'RemoteBalmUIPro',
77+
filename: 'remote-balm-ui-pro.js',
78+
exposes,
79+
shared: ['vue']
80+
})
81+
]
82+
: [])
83+
],
84+
externals: useBuild
85+
? {
86+
vue: {
87+
root: 'Vue',
88+
commonjs: 'vue',
89+
commonjs2: 'vue',
90+
amd: 'vue'
91+
}
92+
}
93+
: {},
94+
webpackOptions: useBuild
95+
? {
96+
output: {
97+
// See https://github.com/webpack/webpack/issues/6522
98+
globalObject: "typeof self !== 'undefined' ? self : this"
99+
}
100+
}
101+
: {}
102+
},
103+
extras: {
104+
includes: ['CNAME']
105+
},
106+
assets: {
107+
cache: env.buildDocs
108+
},
109+
logs: {
110+
level: 2
111+
}
112+
};
113+
}
114+
115+
module.exports = getConfig;

config/env.js

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
const buildDocs = process.argv.includes('--docs');
2+
3+
module.exports = {
4+
buildDocs
5+
};
147 KB
Binary file not shown.

docs/fonts/material-icons-round.woff2

165 KB
Binary file not shown.

docs/fonts/material-icons-sharp.woff2

129 KB
Binary file not shown.
202 KB
Binary file not shown.

docs/fonts/material-icons.woff

155 KB
Binary file not shown.

docs/fonts/material-icons.woff2

121 KB
Binary file not shown.

docs/index.html

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8" />
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
6+
<title>BalmUI Pro</title>
7+
<link rel="stylesheet" href="%PUBLIC_URL%/styles/app.css" />
8+
</head>
9+
<body>
10+
<div id="app"></div>
11+
<script src="%PUBLIC_URL%/scripts/app.js"></script>
12+
</body>
13+
</html>

docs/scripts/bootstrap.js

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import { isIE, killIE } from '@/kill-ie';
2+
import createBalmUIProApp from '@/main';
3+
4+
isIE ? killIE() : createBalmUIProApp();

docs/scripts/components/github.vue

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<template>
2+
<svg
3+
aria-hidden="true"
4+
class="octicon octicon-mark-github"
5+
height="32"
6+
version="1.1"
7+
viewBox="0 0 16 16"
8+
width="32"
9+
>
10+
<path
11+
fill-rule="evenodd"
12+
d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0 0 16 8c0-4.42-3.58-8-8-8z"
13+
></path>
14+
</svg>
15+
</template>

docs/scripts/components/markdown.vue

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
<template>
2+
<div v-if="html" :class="className" v-html="html"></div>
3+
<ui-skeleton v-else active></ui-skeleton>
4+
</template>
5+
6+
<script>
7+
export default {
8+
name: 'ui-markdown',
9+
inheritAttrs: false
10+
};
11+
</script>
12+
13+
<script setup>
14+
import { reactive, toRefs, computed, watch, onMounted, nextTick } from 'vue';
15+
import { usePrism } from '@/plugins/prism';
16+
17+
const props = defineProps({
18+
// 文档内容
19+
text: {
20+
type: String,
21+
default: ''
22+
},
23+
// 代码片段
24+
code: {
25+
type: Boolean,
26+
default: false
27+
}
28+
});
29+
30+
const state = reactive({
31+
html: props.text
32+
});
33+
34+
const className = computed(() =>
35+
props.code ? 'snippet-code' : 'markdown-body'
36+
);
37+
38+
const text = watch(
39+
() => state.html,
40+
(val) => {
41+
state.html = val;
42+
init();
43+
}
44+
);
45+
46+
function init() {
47+
if (state.html) {
48+
nextTick(() => {
49+
const prism = usePrism();
50+
prism.highlightAll();
51+
});
52+
}
53+
}
54+
55+
onMounted(() => init());
56+
57+
const { html } = toRefs(state);
58+
</script>

0 commit comments

Comments
 (0)