@focus-teach/ui 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.history/package_20230626112515.json +45 -0
- package/.history/package_20230626112519.json +45 -0
- package/.history/package_20230626113741.json +48 -0
- package/.history/package_20230626113743.json +48 -0
- package/.history/package_20230626113745.json +48 -0
- package/.history/package_20230626113750.json +48 -0
- package/.history/package_20230626113754.json +48 -0
- package/.history/package_20230626113756.json +48 -0
- package/.history/package_20230626113758.json +48 -0
- package/.history/package_20230626113759.json +48 -0
- package/.history/package_20230626113808.json +48 -0
- package/.history/package_20230626113839.json +45 -0
- package/.history/package_20230626113841.json +45 -0
- package/.history/package_20230626115037.json +45 -0
- package/.history/package_20230626115243.json +45 -0
- package/.history/package_20230626115245.json +45 -0
- package/.history/package_20230626115259.json +45 -0
- package/.history/vue.config_20230606223920.js +126 -0
- package/.history/vue.config_20230626104338.js +133 -0
- package/.history/vue.config_20230626104344.js +129 -0
- package/.history/vue.config_20230626104347.js +129 -0
- package/.history/vue.config_20230626104410.js +129 -0
- package/.history/vue.config_20230626104446.js +129 -0
- package/.history/vue.config_20230626104448.js +129 -0
- package/.history/vue.config_20230626104552.js +130 -0
- package/.history/vue.config_20230626104554.js +130 -0
- package/.history/vue.config_20230626104556.js +130 -0
- package/.history/vue.config_20230626104559.js +132 -0
- package/.history/vue.config_20230626104600.js +132 -0
- package/.history/vue.config_20230626104603.js +132 -0
- package/.history/vue.config_20230626104608.js +129 -0
- package/.history/vue.config_20230626104646.js +123 -0
- package/.history/vue.config_20230626104824.js +124 -0
- package/.history/vue.config_20230626104825.js +124 -0
- package/.history/vue.config_20230626104829.js +124 -0
- package/.history/vue.config_20230626104832.js +124 -0
- package/.history/vue.config_20230626104836.js +121 -0
- package/.history/vue.config_20230626105637.js +122 -0
- package/.history/vue.config_20230626105642.js +123 -0
- package/.history/vue.config_20230626105834.js +124 -0
- package/.history/vue.config_20230626105920.js +124 -0
- package/.history/vue.config_20230626105938.js +123 -0
- package/.history/vue.config_20230626110142.js +124 -0
- package/.history/vue.config_20230626110147.js +124 -0
- package/.history/vue.config_20230626110154.js +124 -0
- package/.history/vue.config_20230626110156.js +124 -0
- package/.history/vue.config_20230626110206.js +124 -0
- package/.history/vue.config_20230626110207.js +124 -0
- package/.history/vue.config_20230626110209.js +124 -0
- package/.history/vue.config_20230626110235.js +123 -0
- package/.history/vue.config_20230626110237.js +123 -0
- package/.history/vue.config_20230626110257.js +123 -0
- package/.history/vue.config_20230626110300.js +123 -0
- package/.history/vue.config_20230626110316.js +123 -0
- package/.history/vue.config_20230626110621.js +123 -0
- package/.history/vue.config_20230626110703.js +124 -0
- package/.history/vue.config_20230626110708.js +125 -0
- package/.history/vue.config_20230626110710.js +126 -0
- package/.history/vue.config_20230626110712.js +127 -0
- package/.history/vue.config_20230626110715.js +126 -0
- package/.history/vue.config_20230626110716.js +127 -0
- package/.history/vue.config_20230626110721.js +128 -0
- package/.history/vue.config_20230626110741.js +128 -0
- package/.history/vue.config_20230626110746.js +128 -0
- package/.history/vue.config_20230626110751.js +128 -0
- package/.history/vue.config_20230626110754.js +128 -0
- package/.history/vue.config_20230626110757.js +128 -0
- package/.history/vue.config_20230626110811.js +128 -0
- package/.history/vue.config_20230626110815.js +128 -0
- package/.history/vue.config_20230626110820.js +128 -0
- package/.history/vue.config_20230626110823.js +128 -0
- package/.history/vue.config_20230626110949.js +129 -0
- package/.history/vue.config_20230626110951.js +129 -0
- package/.history/vue.config_20230626110953.js +130 -0
- package/.history/vue.config_20230626110956.js +130 -0
- package/.history/vue.config_20230626110958.js +131 -0
- package/.history/vue.config_20230626111207.js +131 -0
- package/.history/vue.config_20230626111211.js +131 -0
- package/.history/vue.config_20230626111216.js +131 -0
- package/.history/vue.config_20230626111217.js +131 -0
- package/.history/vue.config_20230626111332.js +131 -0
- package/.history/vue.config_20230626111338.js +131 -0
- package/.history/vue.config_20230626111342.js +131 -0
- package/.history/vue.config_20230626111359.js +131 -0
- package/.history/vue.config_20230626111402.js +131 -0
- package/.history/vue.config_20230626111404.js +131 -0
- package/.history/vue.config_20230626111442.js +131 -0
- package/.history/vue.config_20230626111443.js +131 -0
- package/.history/vue.config_20230626111448.js +131 -0
- package/.history/vue.config_20230626111450.js +131 -0
- package/.history/vue.config_20230626111528.js +131 -0
- package/.history/vue.config_20230626111529.js +131 -0
- package/.history/vue.config_20230626112153.js +132 -0
- package/.history/vue.config_20230626112156.js +133 -0
- package/.history/vue.config_20230626112158.js +132 -0
- package/.history/vue.config_20230626112201.js +132 -0
- package/.history/vue.config_20230626112254.js +132 -0
- package/.history/vue.config_20230626112400.js +132 -0
- package/.history/vue.config_20230626112402.js +132 -0
- package/.history/vue.config_20230626112452.js +132 -0
- package/.history/vue.config_20230626113026.js +133 -0
- package/.history/vue.config_20230626113032.js +133 -0
- package/.history/vue.config_20230626113034.js +134 -0
- package/.history/vue.config_20230626113036.js +135 -0
- package/.history/vue.config_20230626113040.js +136 -0
- package/.history/vue.config_20230626113041.js +137 -0
- package/.history/vue.config_20230626113042.js +138 -0
- package/.history/vue.config_20230626113044.js +139 -0
- package/.history/vue.config_20230626113049.js +140 -0
- package/.history/vue.config_20230626113052.js +141 -0
- package/.history/vue.config_20230626113056.js +142 -0
- package/.history/vue.config_20230626113058.js +143 -0
- package/.history/vue.config_20230626113101.js +144 -0
- package/.history/vue.config_20230626113105.js +144 -0
- package/.history/vue.config_20230626113110.js +145 -0
- package/.history/vue.config_20230626113112.js +145 -0
- package/.history/vue.config_20230626113129.js +145 -0
- package/.history/vue.config_20230626113131.js +146 -0
- package/.history/vue.config_20230626113133.js +145 -0
- package/.history/vue.config_20230626113142.js +144 -0
- package/.history/vue.config_20230626113145.js +137 -0
- package/.history/vue.config_20230626113147.js +144 -0
- package/.history/vue.config_20230626113154.js +143 -0
- package/.history/vue.config_20230626113202.js +144 -0
- package/.history/vue.config_20230626113204.js +144 -0
- package/.history/vue.config_20230626113207.js +144 -0
- package/.history/vue.config_20230626113216.js +144 -0
- package/.history/vue.config_20230626113223.js +144 -0
- package/.history/vue.config_20230626113224.js +144 -0
- package/.history/vue.config_20230626113227.js +144 -0
- package/.history/vue.config_20230626113230.js +144 -0
- package/.history/vue.config_20230626113237.js +144 -0
- package/.history/vue.config_20230626113239.js +144 -0
- package/.history/vue.config_20230626113244.js +144 -0
- package/.history/vue.config_20230626113245.js +144 -0
- package/.history/vue.config_20230626113248.js +142 -0
- package/.history/vue.config_20230626113250.js +142 -0
- package/.history/vue.config_20230626113255.js +142 -0
- package/.history/vue.config_20230626113303.js +142 -0
- package/.history/vue.config_20230626113305.js +142 -0
- package/.history/vue.config_20230626113309.js +142 -0
- package/.history/vue.config_20230626113347.js +142 -0
- package/.history/vue.config_20230626113404.js +139 -0
- package/.history/vue.config_20230626113406.js +138 -0
- package/.history/vue.config_20230626113418.js +134 -0
- package/.history/vue.config_20230626113511.js +129 -0
- package/.history/vue.config_20230626113656.js +129 -0
- package/.history/vue.config_20230626114206.js +134 -0
- package/.history/vue.config_20230626114210.js +138 -0
- package/.history/vue.config_20230626114358.js +137 -0
- package/.history/vue.config_20230626114603.js +137 -0
- package/.history/vue.config_20230626114605.js +137 -0
- package/.history/vue.config_20230626114657.js +137 -0
- package/.history/vue.config_20230626114745.js +137 -0
- package/.history/vue.config_20230626114821.js +137 -0
- package/.history/vue.config_20230626114832.js +139 -0
- package/.history/vue.config_20230626114836.js +132 -0
- package/.history/vue.config_20230626114847.js +132 -0
- package/.history/vue.config_20230626114850.js +132 -0
- package/{dist → lib}/@focus-teach/ui.common.js +26 -26
- package/lib/@focus-teach/ui.css +1 -0
- package/{dist → lib}/@focus-teach/ui.umd.js +26 -26
- package/{dist → lib}/@focus-teach/ui.umd.min.js +1 -1
- package/package.json +2 -2
- package/dist/@focus-teach/ui.css +0 -1
- /package/{dist → lib/@focus-teach}/fonts/icomoon.356dc15f.woff +0 -0
- /package/{dist → lib/@focus-teach}/fonts/icomoon.71d64f31.woff +0 -0
- /package/{dist → lib/@focus-teach}/fonts/icomoon.7c9a60d9.eot +0 -0
- /package/{dist → lib/@focus-teach}/fonts/icomoon.ba18ad87.eot +0 -0
- /package/{dist → lib/@focus-teach}/fonts/icomoon.de76432e.ttf +0 -0
- /package/{dist → lib/@focus-teach}/fonts/icomoon.ec37e716.ttf +0 -0
- /package/{dist → lib/@focus-teach}/img/cloud_txt_24.87b9d2ae.svg +0 -0
- /package/{dist → lib/@focus-teach}/img/icomoon.428f3063.svg +0 -0
- /package/{dist → lib/@focus-teach}/img/icomoon.532b3795.svg +0 -0
- /package/{dist → lib/@focus-teach}/img/icon_question.e931b16c.svg +0 -0
- /package/{dist → lib}/demo.html +0 -0
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
const path = require("path");
|
|
2
|
+
// const PrerenderSpaPlugin = require("prerender-spa-plugin");
|
|
3
|
+
const MarkdownItContainer = require("markdown-it-container");
|
|
4
|
+
|
|
5
|
+
const cheerio = require('cheerio');
|
|
6
|
+
const striptags = (str, tags) => {
|
|
7
|
+
const $ = cheerio.load(str, { decodeEntities: false })
|
|
8
|
+
|
|
9
|
+
if (!tags || tags.length === 0) {
|
|
10
|
+
return str
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
tags = !Array.isArray(tags) ? [tags] : tags;
|
|
14
|
+
let len = tags.length;
|
|
15
|
+
|
|
16
|
+
while (len--) {
|
|
17
|
+
$(tags[len]).remove()
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
return $.html()
|
|
21
|
+
};
|
|
22
|
+
const convertHtml = function (str) {
|
|
23
|
+
return str.replace(/(&#x)(\w{4});/gi, $0 => String.fromCharCode(parseInt(encodeURIComponent($0).replace(/(%26%23x)(\w{4})(%3B)/g, '$2'), 16)))
|
|
24
|
+
};
|
|
25
|
+
const wrapCustomClass = function (render) {
|
|
26
|
+
return function (...args) {
|
|
27
|
+
return render(...args)
|
|
28
|
+
.replace('<code class="', '<code class="hljs ')
|
|
29
|
+
.replace('<code>', '<code class="hljs">')
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
const vueMarkdown = {
|
|
33
|
+
raw: true,
|
|
34
|
+
preprocess: (MarkdownIt, source) => {
|
|
35
|
+
MarkdownIt.renderer.rules.table_open = function () {
|
|
36
|
+
return '<table class="table">'
|
|
37
|
+
};
|
|
38
|
+
MarkdownIt.renderer.rules.fence = wrapCustomClass(MarkdownIt.renderer.rules.fence);
|
|
39
|
+
|
|
40
|
+
// ```code`` 给这种样式加个class code_inline
|
|
41
|
+
const code_inline = MarkdownIt.renderer.rules.code_inline;
|
|
42
|
+
MarkdownIt.renderer.rules.code_inline = function(...args){
|
|
43
|
+
args[0][args[1]].attrJoin('class', 'code_inline');
|
|
44
|
+
return code_inline(...args)
|
|
45
|
+
};
|
|
46
|
+
return source
|
|
47
|
+
},
|
|
48
|
+
use: [
|
|
49
|
+
[MarkdownItContainer, 'demo', {
|
|
50
|
+
validate: params => params.trim().match(/^demo\s*(.*)$/),
|
|
51
|
+
render: function(tokens, idx) {
|
|
52
|
+
if (tokens[idx].nesting === 1) {
|
|
53
|
+
const html = convertHtml(striptags(tokens[idx + 1].content, 'script'));
|
|
54
|
+
// 移除描述,防止被添加到代码块
|
|
55
|
+
tokens[idx + 2].children = [];
|
|
56
|
+
|
|
57
|
+
return `<demo-block>
|
|
58
|
+
<div slot="desc">${html}</div>
|
|
59
|
+
<div slot="highlight">`;
|
|
60
|
+
}
|
|
61
|
+
return '</div></demo-block>\n';
|
|
62
|
+
}
|
|
63
|
+
}]
|
|
64
|
+
]
|
|
65
|
+
};
|
|
66
|
+
const resolve = dir => path.join(__dirname, dir);
|
|
67
|
+
const packagesDir = resolve('packages');
|
|
68
|
+
module.exports = {
|
|
69
|
+
runtimeCompiler: true,
|
|
70
|
+
devServer: {
|
|
71
|
+
proxy: {
|
|
72
|
+
'/backend': {
|
|
73
|
+
target: 'http://10.10.14.64:8085',
|
|
74
|
+
changeOrigin: true,
|
|
75
|
+
pathRewrite: {
|
|
76
|
+
'^/backend': '/'
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
pages: {
|
|
82
|
+
index: {
|
|
83
|
+
entry: "examples/main.js",
|
|
84
|
+
template: "public/index.html",
|
|
85
|
+
filename: "index.html"
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
publicPath: process.env.NODE_ENV === 'production' ? '/vue-ui-demo/' : '/',
|
|
89
|
+
chainWebpack: config => {
|
|
90
|
+
config.resolve.alias
|
|
91
|
+
.set("@", path.resolve("examples"))
|
|
92
|
+
.set("~", path.resolve("packages"));
|
|
93
|
+
config.module
|
|
94
|
+
.rule("js")
|
|
95
|
+
.include.add("/packages")
|
|
96
|
+
.end()
|
|
97
|
+
.include.add("/examples")
|
|
98
|
+
.end()
|
|
99
|
+
.include.add("/api")
|
|
100
|
+
.end()
|
|
101
|
+
.use("babel")
|
|
102
|
+
.loader("babel-loader")
|
|
103
|
+
.end()
|
|
104
|
+
.use("vue-loader")
|
|
105
|
+
.loader("vue-loader")
|
|
106
|
+
.end()
|
|
107
|
+
config.module.rule("md")
|
|
108
|
+
.test(/\.md/)
|
|
109
|
+
.use("vue-loader")
|
|
110
|
+
.loader("vue-loader")
|
|
111
|
+
.end()
|
|
112
|
+
.use("vue-markdown-loader")
|
|
113
|
+
.loader("vue-markdown-loader/lib/markdown-compiler")
|
|
114
|
+
.options(vueMarkdown);
|
|
115
|
+
config.module.rule("vue")
|
|
116
|
+
.test(/\.vue/)
|
|
117
|
+
.use("vue-loader")
|
|
118
|
+
.loader("vue-loader")
|
|
119
|
+
},
|
|
120
|
+
outputDir:path.resolve(__dirname, 'lib'),
|
|
121
|
+
configureWebpack: {
|
|
122
|
+
}
|
|
123
|
+
};
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
const path = require("path");
|
|
2
|
+
// const PrerenderSpaPlugin = require("prerender-spa-plugin");
|
|
3
|
+
const MarkdownItContainer = require("markdown-it-container");
|
|
4
|
+
|
|
5
|
+
const cheerio = require('cheerio');
|
|
6
|
+
const striptags = (str, tags) => {
|
|
7
|
+
const $ = cheerio.load(str, { decodeEntities: false })
|
|
8
|
+
|
|
9
|
+
if (!tags || tags.length === 0) {
|
|
10
|
+
return str
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
tags = !Array.isArray(tags) ? [tags] : tags;
|
|
14
|
+
let len = tags.length;
|
|
15
|
+
|
|
16
|
+
while (len--) {
|
|
17
|
+
$(tags[len]).remove()
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
return $.html()
|
|
21
|
+
};
|
|
22
|
+
const convertHtml = function (str) {
|
|
23
|
+
return str.replace(/(&#x)(\w{4});/gi, $0 => String.fromCharCode(parseInt(encodeURIComponent($0).replace(/(%26%23x)(\w{4})(%3B)/g, '$2'), 16)))
|
|
24
|
+
};
|
|
25
|
+
const wrapCustomClass = function (render) {
|
|
26
|
+
return function (...args) {
|
|
27
|
+
return render(...args)
|
|
28
|
+
.replace('<code class="', '<code class="hljs ')
|
|
29
|
+
.replace('<code>', '<code class="hljs">')
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
const vueMarkdown = {
|
|
33
|
+
raw: true,
|
|
34
|
+
preprocess: (MarkdownIt, source) => {
|
|
35
|
+
MarkdownIt.renderer.rules.table_open = function () {
|
|
36
|
+
return '<table class="table">'
|
|
37
|
+
};
|
|
38
|
+
MarkdownIt.renderer.rules.fence = wrapCustomClass(MarkdownIt.renderer.rules.fence);
|
|
39
|
+
|
|
40
|
+
// ```code`` 给这种样式加个class code_inline
|
|
41
|
+
const code_inline = MarkdownIt.renderer.rules.code_inline;
|
|
42
|
+
MarkdownIt.renderer.rules.code_inline = function(...args){
|
|
43
|
+
args[0][args[1]].attrJoin('class', 'code_inline');
|
|
44
|
+
return code_inline(...args)
|
|
45
|
+
};
|
|
46
|
+
return source
|
|
47
|
+
},
|
|
48
|
+
use: [
|
|
49
|
+
[MarkdownItContainer, 'demo', {
|
|
50
|
+
validate: params => params.trim().match(/^demo\s*(.*)$/),
|
|
51
|
+
render: function(tokens, idx) {
|
|
52
|
+
if (tokens[idx].nesting === 1) {
|
|
53
|
+
const html = convertHtml(striptags(tokens[idx + 1].content, 'script'));
|
|
54
|
+
// 移除描述,防止被添加到代码块
|
|
55
|
+
tokens[idx + 2].children = [];
|
|
56
|
+
|
|
57
|
+
return `<demo-block>
|
|
58
|
+
<div slot="desc">${html}</div>
|
|
59
|
+
<div slot="highlight">`;
|
|
60
|
+
}
|
|
61
|
+
return '</div></demo-block>\n';
|
|
62
|
+
}
|
|
63
|
+
}]
|
|
64
|
+
]
|
|
65
|
+
};
|
|
66
|
+
const resolve = dir => path.join(__dirname, dir);
|
|
67
|
+
const packagesDir = resolve('packages');
|
|
68
|
+
module.exports = {
|
|
69
|
+
runtimeCompiler: true,
|
|
70
|
+
devServer: {
|
|
71
|
+
proxy: {
|
|
72
|
+
'/backend': {
|
|
73
|
+
target: 'http://10.10.14.64:8085',
|
|
74
|
+
changeOrigin: true,
|
|
75
|
+
pathRewrite: {
|
|
76
|
+
'^/backend': '/'
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
pages: {
|
|
82
|
+
index: {
|
|
83
|
+
entry: "examples/main.js",
|
|
84
|
+
template: "public/index.html",
|
|
85
|
+
filename: "index.html"
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
publicPath: process.env.NODE_ENV === 'production' ? '/vue-ui-demo/' : '/',
|
|
89
|
+
chainWebpack: config => {
|
|
90
|
+
config.resolve.alias
|
|
91
|
+
.set("@", path.resolve("examples"))
|
|
92
|
+
.set("~", path.resolve("packages"));
|
|
93
|
+
config.module
|
|
94
|
+
.rule("js")
|
|
95
|
+
.include.add("./packages")
|
|
96
|
+
.end()
|
|
97
|
+
.include.add("/examples")
|
|
98
|
+
.end()
|
|
99
|
+
.include.add("/api")
|
|
100
|
+
.end()
|
|
101
|
+
.use("babel")
|
|
102
|
+
.loader("babel-loader")
|
|
103
|
+
.end()
|
|
104
|
+
.use("vue-loader")
|
|
105
|
+
.loader("vue-loader")
|
|
106
|
+
.end()
|
|
107
|
+
config.module.rule("md")
|
|
108
|
+
.test(/\.md/)
|
|
109
|
+
.use("vue-loader")
|
|
110
|
+
.loader("vue-loader")
|
|
111
|
+
.end()
|
|
112
|
+
.use("vue-markdown-loader")
|
|
113
|
+
.loader("vue-markdown-loader/lib/markdown-compiler")
|
|
114
|
+
.options(vueMarkdown);
|
|
115
|
+
config.module.rule("vue")
|
|
116
|
+
.test(/\.vue/)
|
|
117
|
+
.use("vue-loader")
|
|
118
|
+
.loader("vue-loader")
|
|
119
|
+
},
|
|
120
|
+
outputDir:path.resolve(__dirname, 'lib'),
|
|
121
|
+
configureWebpack: {
|
|
122
|
+
}
|
|
123
|
+
};
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
const path = require("path");
|
|
2
|
+
// const PrerenderSpaPlugin = require("prerender-spa-plugin");
|
|
3
|
+
const MarkdownItContainer = require("markdown-it-container");
|
|
4
|
+
|
|
5
|
+
const cheerio = require('cheerio');
|
|
6
|
+
const striptags = (str, tags) => {
|
|
7
|
+
const $ = cheerio.load(str, { decodeEntities: false })
|
|
8
|
+
|
|
9
|
+
if (!tags || tags.length === 0) {
|
|
10
|
+
return str
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
tags = !Array.isArray(tags) ? [tags] : tags;
|
|
14
|
+
let len = tags.length;
|
|
15
|
+
|
|
16
|
+
while (len--) {
|
|
17
|
+
$(tags[len]).remove()
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
return $.html()
|
|
21
|
+
};
|
|
22
|
+
const convertHtml = function (str) {
|
|
23
|
+
return str.replace(/(&#x)(\w{4});/gi, $0 => String.fromCharCode(parseInt(encodeURIComponent($0).replace(/(%26%23x)(\w{4})(%3B)/g, '$2'), 16)))
|
|
24
|
+
};
|
|
25
|
+
const wrapCustomClass = function (render) {
|
|
26
|
+
return function (...args) {
|
|
27
|
+
return render(...args)
|
|
28
|
+
.replace('<code class="', '<code class="hljs ')
|
|
29
|
+
.replace('<code>', '<code class="hljs">')
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
const vueMarkdown = {
|
|
33
|
+
raw: true,
|
|
34
|
+
preprocess: (MarkdownIt, source) => {
|
|
35
|
+
MarkdownIt.renderer.rules.table_open = function () {
|
|
36
|
+
return '<table class="table">'
|
|
37
|
+
};
|
|
38
|
+
MarkdownIt.renderer.rules.fence = wrapCustomClass(MarkdownIt.renderer.rules.fence);
|
|
39
|
+
|
|
40
|
+
// ```code`` 给这种样式加个class code_inline
|
|
41
|
+
const code_inline = MarkdownIt.renderer.rules.code_inline;
|
|
42
|
+
MarkdownIt.renderer.rules.code_inline = function(...args){
|
|
43
|
+
args[0][args[1]].attrJoin('class', 'code_inline');
|
|
44
|
+
return code_inline(...args)
|
|
45
|
+
};
|
|
46
|
+
return source
|
|
47
|
+
},
|
|
48
|
+
use: [
|
|
49
|
+
[MarkdownItContainer, 'demo', {
|
|
50
|
+
validate: params => params.trim().match(/^demo\s*(.*)$/),
|
|
51
|
+
render: function(tokens, idx) {
|
|
52
|
+
if (tokens[idx].nesting === 1) {
|
|
53
|
+
const html = convertHtml(striptags(tokens[idx + 1].content, 'script'));
|
|
54
|
+
// 移除描述,防止被添加到代码块
|
|
55
|
+
tokens[idx + 2].children = [];
|
|
56
|
+
|
|
57
|
+
return `<demo-block>
|
|
58
|
+
<div slot="desc">${html}</div>
|
|
59
|
+
<div slot="highlight">`;
|
|
60
|
+
}
|
|
61
|
+
return '</div></demo-block>\n';
|
|
62
|
+
}
|
|
63
|
+
}]
|
|
64
|
+
]
|
|
65
|
+
};
|
|
66
|
+
const resolve = dir => path.join(__dirname, dir);
|
|
67
|
+
const packagesDir = resolve('packages');
|
|
68
|
+
module.exports = {
|
|
69
|
+
runtimeCompiler: true,
|
|
70
|
+
devServer: {
|
|
71
|
+
proxy: {
|
|
72
|
+
'/backend': {
|
|
73
|
+
target: 'http://10.10.14.64:8085',
|
|
74
|
+
changeOrigin: true,
|
|
75
|
+
pathRewrite: {
|
|
76
|
+
'^/backend': '/'
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
pages: {
|
|
82
|
+
index: {
|
|
83
|
+
entry: "examples/main.js",
|
|
84
|
+
template: "public/index.html",
|
|
85
|
+
filename: "index.html"
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
publicPath: process.env.NODE_ENV === 'production' ? '/vue-ui-demo/' : '/',
|
|
89
|
+
chainWebpack: config => {
|
|
90
|
+
config.resolve.alias
|
|
91
|
+
.set("@", path.resolve("examples"))
|
|
92
|
+
.set("~", path.resolve("packages"));
|
|
93
|
+
config.module
|
|
94
|
+
.rule("js")
|
|
95
|
+
.include.add("/packages")
|
|
96
|
+
.end()
|
|
97
|
+
.include.add("/examples")
|
|
98
|
+
.end()
|
|
99
|
+
.include.add("/api")
|
|
100
|
+
.end()
|
|
101
|
+
.use("babel")
|
|
102
|
+
.loader("babel-loader")
|
|
103
|
+
.end()
|
|
104
|
+
.use("vue-loader")
|
|
105
|
+
.loader("vue-loader")
|
|
106
|
+
.end()
|
|
107
|
+
config.module.rule("md")
|
|
108
|
+
.test(/\.md/)
|
|
109
|
+
.use("vue-loader")
|
|
110
|
+
.loader("vue-loader")
|
|
111
|
+
.end()
|
|
112
|
+
.use("vue-markdown-loader")
|
|
113
|
+
.loader("vue-markdown-loader/lib/markdown-compiler")
|
|
114
|
+
.options(vueMarkdown);
|
|
115
|
+
config.module.rule("vue")
|
|
116
|
+
.test(/\.vue/)
|
|
117
|
+
.use("vue-loader")
|
|
118
|
+
.loader("vue-loader")
|
|
119
|
+
},
|
|
120
|
+
outputDir:path.resolve(__dirname, 'lib'),
|
|
121
|
+
configureWebpack: {
|
|
122
|
+
}
|
|
123
|
+
};
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
const path = require("path");
|
|
2
|
+
// const PrerenderSpaPlugin = require("prerender-spa-plugin");
|
|
3
|
+
const MarkdownItContainer = require("markdown-it-container");
|
|
4
|
+
|
|
5
|
+
const cheerio = require('cheerio');
|
|
6
|
+
const striptags = (str, tags) => {
|
|
7
|
+
const $ = cheerio.load(str, { decodeEntities: false })
|
|
8
|
+
|
|
9
|
+
if (!tags || tags.length === 0) {
|
|
10
|
+
return str
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
tags = !Array.isArray(tags) ? [tags] : tags;
|
|
14
|
+
let len = tags.length;
|
|
15
|
+
|
|
16
|
+
while (len--) {
|
|
17
|
+
$(tags[len]).remove()
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
return $.html()
|
|
21
|
+
};
|
|
22
|
+
const convertHtml = function (str) {
|
|
23
|
+
return str.replace(/(&#x)(\w{4});/gi, $0 => String.fromCharCode(parseInt(encodeURIComponent($0).replace(/(%26%23x)(\w{4})(%3B)/g, '$2'), 16)))
|
|
24
|
+
};
|
|
25
|
+
const wrapCustomClass = function (render) {
|
|
26
|
+
return function (...args) {
|
|
27
|
+
return render(...args)
|
|
28
|
+
.replace('<code class="', '<code class="hljs ')
|
|
29
|
+
.replace('<code>', '<code class="hljs">')
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
const vueMarkdown = {
|
|
33
|
+
raw: true,
|
|
34
|
+
preprocess: (MarkdownIt, source) => {
|
|
35
|
+
MarkdownIt.renderer.rules.table_open = function () {
|
|
36
|
+
return '<table class="table">'
|
|
37
|
+
};
|
|
38
|
+
MarkdownIt.renderer.rules.fence = wrapCustomClass(MarkdownIt.renderer.rules.fence);
|
|
39
|
+
|
|
40
|
+
// ```code`` 给这种样式加个class code_inline
|
|
41
|
+
const code_inline = MarkdownIt.renderer.rules.code_inline;
|
|
42
|
+
MarkdownIt.renderer.rules.code_inline = function(...args){
|
|
43
|
+
args[0][args[1]].attrJoin('class', 'code_inline');
|
|
44
|
+
return code_inline(...args)
|
|
45
|
+
};
|
|
46
|
+
return source
|
|
47
|
+
},
|
|
48
|
+
use: [
|
|
49
|
+
[MarkdownItContainer, 'demo', {
|
|
50
|
+
validate: params => params.trim().match(/^demo\s*(.*)$/),
|
|
51
|
+
render: function(tokens, idx) {
|
|
52
|
+
if (tokens[idx].nesting === 1) {
|
|
53
|
+
const html = convertHtml(striptags(tokens[idx + 1].content, 'script'));
|
|
54
|
+
// 移除描述,防止被添加到代码块
|
|
55
|
+
tokens[idx + 2].children = [];
|
|
56
|
+
|
|
57
|
+
return `<demo-block>
|
|
58
|
+
<div slot="desc">${html}</div>
|
|
59
|
+
<div slot="highlight">`;
|
|
60
|
+
}
|
|
61
|
+
return '</div></demo-block>\n';
|
|
62
|
+
}
|
|
63
|
+
}]
|
|
64
|
+
]
|
|
65
|
+
};
|
|
66
|
+
const resolve = dir => path.join(__dirname, dir);
|
|
67
|
+
const srcDir = resolve('src');
|
|
68
|
+
module.exports = {
|
|
69
|
+
runtimeCompiler: true,
|
|
70
|
+
devServer: {
|
|
71
|
+
proxy: {
|
|
72
|
+
'/backend': {
|
|
73
|
+
target: 'http://10.10.14.64:8085',
|
|
74
|
+
changeOrigin: true,
|
|
75
|
+
pathRewrite: {
|
|
76
|
+
'^/backend': '/'
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
pages: {
|
|
82
|
+
index: {
|
|
83
|
+
entry: "examples/main.js",
|
|
84
|
+
template: "public/index.html",
|
|
85
|
+
filename: "index.html"
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
publicPath: process.env.NODE_ENV === 'production' ? '/vue-ui-demo/' : '/',
|
|
89
|
+
chainWebpack: config => {
|
|
90
|
+
config.resolve.alias
|
|
91
|
+
.set("@", path.resolve("examples"))
|
|
92
|
+
.set("~", path.resolve("packages"));
|
|
93
|
+
config.module
|
|
94
|
+
.rule("js")
|
|
95
|
+
.include.add("/packages")
|
|
96
|
+
.end()
|
|
97
|
+
.include.add("/examples")
|
|
98
|
+
.end()
|
|
99
|
+
.include.add("/api")
|
|
100
|
+
.end()
|
|
101
|
+
.use("babel")
|
|
102
|
+
.loader("babel-loader")
|
|
103
|
+
.end()
|
|
104
|
+
.use("vue-loader")
|
|
105
|
+
.loader("vue-loader")
|
|
106
|
+
.end()
|
|
107
|
+
config.module.rule("md")
|
|
108
|
+
.test(/\.md/)
|
|
109
|
+
.use("vue-loader")
|
|
110
|
+
.loader("vue-loader")
|
|
111
|
+
.end()
|
|
112
|
+
.use("vue-markdown-loader")
|
|
113
|
+
.loader("vue-markdown-loader/lib/markdown-compiler")
|
|
114
|
+
.options(vueMarkdown);
|
|
115
|
+
config.module.rule("vue")
|
|
116
|
+
.test(/\.vue/)
|
|
117
|
+
.use("vue-loader")
|
|
118
|
+
.loader("vue-loader")
|
|
119
|
+
},
|
|
120
|
+
outputDir:path.resolve(__dirname, 'lib'),
|
|
121
|
+
configureWebpack: {
|
|
122
|
+
}
|
|
123
|
+
};
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
const path = require("path");
|
|
2
|
+
// const PrerenderSpaPlugin = require("prerender-spa-plugin");
|
|
3
|
+
const MarkdownItContainer = require("markdown-it-container");
|
|
4
|
+
|
|
5
|
+
const cheerio = require('cheerio');
|
|
6
|
+
const striptags = (str, tags) => {
|
|
7
|
+
const $ = cheerio.load(str, { decodeEntities: false })
|
|
8
|
+
|
|
9
|
+
if (!tags || tags.length === 0) {
|
|
10
|
+
return str
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
tags = !Array.isArray(tags) ? [tags] : tags;
|
|
14
|
+
let len = tags.length;
|
|
15
|
+
|
|
16
|
+
while (len--) {
|
|
17
|
+
$(tags[len]).remove()
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
return $.html()
|
|
21
|
+
};
|
|
22
|
+
const convertHtml = function (str) {
|
|
23
|
+
return str.replace(/(&#x)(\w{4});/gi, $0 => String.fromCharCode(parseInt(encodeURIComponent($0).replace(/(%26%23x)(\w{4})(%3B)/g, '$2'), 16)))
|
|
24
|
+
};
|
|
25
|
+
const wrapCustomClass = function (render) {
|
|
26
|
+
return function (...args) {
|
|
27
|
+
return render(...args)
|
|
28
|
+
.replace('<code class="', '<code class="hljs ')
|
|
29
|
+
.replace('<code>', '<code class="hljs">')
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
const vueMarkdown = {
|
|
33
|
+
raw: true,
|
|
34
|
+
preprocess: (MarkdownIt, source) => {
|
|
35
|
+
MarkdownIt.renderer.rules.table_open = function () {
|
|
36
|
+
return '<table class="table">'
|
|
37
|
+
};
|
|
38
|
+
MarkdownIt.renderer.rules.fence = wrapCustomClass(MarkdownIt.renderer.rules.fence);
|
|
39
|
+
|
|
40
|
+
// ```code`` 给这种样式加个class code_inline
|
|
41
|
+
const code_inline = MarkdownIt.renderer.rules.code_inline;
|
|
42
|
+
MarkdownIt.renderer.rules.code_inline = function(...args){
|
|
43
|
+
args[0][args[1]].attrJoin('class', 'code_inline');
|
|
44
|
+
return code_inline(...args)
|
|
45
|
+
};
|
|
46
|
+
return source
|
|
47
|
+
},
|
|
48
|
+
use: [
|
|
49
|
+
[MarkdownItContainer, 'demo', {
|
|
50
|
+
validate: params => params.trim().match(/^demo\s*(.*)$/),
|
|
51
|
+
render: function(tokens, idx) {
|
|
52
|
+
if (tokens[idx].nesting === 1) {
|
|
53
|
+
const html = convertHtml(striptags(tokens[idx + 1].content, 'script'));
|
|
54
|
+
// 移除描述,防止被添加到代码块
|
|
55
|
+
tokens[idx + 2].children = [];
|
|
56
|
+
|
|
57
|
+
return `<demo-block>
|
|
58
|
+
<div slot="desc">${html}</div>
|
|
59
|
+
<div slot="highlight">`;
|
|
60
|
+
}
|
|
61
|
+
return '</div></demo-block>\n';
|
|
62
|
+
}
|
|
63
|
+
}]
|
|
64
|
+
]
|
|
65
|
+
};
|
|
66
|
+
const resolve = dir => path.join(__dirname, dir);
|
|
67
|
+
const srcDir = resolve('src');
|
|
68
|
+
module.exports = {
|
|
69
|
+
runtimeCompiler: true,
|
|
70
|
+
devServer: {
|
|
71
|
+
proxy: {
|
|
72
|
+
'/backend': {
|
|
73
|
+
target: 'http://10.10.14.64:8085',
|
|
74
|
+
changeOrigin: true,
|
|
75
|
+
pathRewrite: {
|
|
76
|
+
'^/backend': '/'
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
pages: {
|
|
82
|
+
index: {
|
|
83
|
+
entry: "examples/main.js",
|
|
84
|
+
template: "public/index.html",
|
|
85
|
+
filename: "index.html"
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
publicPath: process.env.NODE_ENV === 'production' ? '/vue-ui-demo/' : '/',
|
|
89
|
+
chainWebpack: config => {
|
|
90
|
+
config.resolve.alias
|
|
91
|
+
.set("@", path.resolve("examples"))
|
|
92
|
+
.set("~", path.resolve("packages"));
|
|
93
|
+
config.module
|
|
94
|
+
.rule("js")
|
|
95
|
+
.include.add("/packages")
|
|
96
|
+
.end()
|
|
97
|
+
.include.add("/examples")
|
|
98
|
+
.end()
|
|
99
|
+
.include.add("/api")
|
|
100
|
+
.end()
|
|
101
|
+
.use("babel")
|
|
102
|
+
.loader("babel-loader")
|
|
103
|
+
.end()
|
|
104
|
+
.use("vue-loader")
|
|
105
|
+
.loader("vue-loader")
|
|
106
|
+
.end()
|
|
107
|
+
config.module.rule("md")
|
|
108
|
+
.test(/\.md/)
|
|
109
|
+
.use("vue-loader")
|
|
110
|
+
.loader("vue-loader")
|
|
111
|
+
.end()
|
|
112
|
+
.use("vue-markdown-loader")
|
|
113
|
+
.loader("vue-markdown-loader/lib/markdown-compiler")
|
|
114
|
+
.options(vueMarkdown);
|
|
115
|
+
config.module.rule("vue")
|
|
116
|
+
.test(/\.vue/)
|
|
117
|
+
.use("vue-loader")
|
|
118
|
+
.loader("vue-loader")
|
|
119
|
+
},
|
|
120
|
+
outputDir:path.resolve(__dirname, 'lib'),
|
|
121
|
+
configureWebpack: {
|
|
122
|
+
entry: { index: path.resolve(srcDir, 'index.js'), button: path.resolve(srcDir, 'components/button/index.js'), input: path.resolve(srcDir, 'components/input/index.js'),
|
|
123
|
+
}
|
|
124
|
+
};
|