@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.
Files changed (176) hide show
  1. package/.history/package_20230626112515.json +45 -0
  2. package/.history/package_20230626112519.json +45 -0
  3. package/.history/package_20230626113741.json +48 -0
  4. package/.history/package_20230626113743.json +48 -0
  5. package/.history/package_20230626113745.json +48 -0
  6. package/.history/package_20230626113750.json +48 -0
  7. package/.history/package_20230626113754.json +48 -0
  8. package/.history/package_20230626113756.json +48 -0
  9. package/.history/package_20230626113758.json +48 -0
  10. package/.history/package_20230626113759.json +48 -0
  11. package/.history/package_20230626113808.json +48 -0
  12. package/.history/package_20230626113839.json +45 -0
  13. package/.history/package_20230626113841.json +45 -0
  14. package/.history/package_20230626115037.json +45 -0
  15. package/.history/package_20230626115243.json +45 -0
  16. package/.history/package_20230626115245.json +45 -0
  17. package/.history/package_20230626115259.json +45 -0
  18. package/.history/vue.config_20230606223920.js +126 -0
  19. package/.history/vue.config_20230626104338.js +133 -0
  20. package/.history/vue.config_20230626104344.js +129 -0
  21. package/.history/vue.config_20230626104347.js +129 -0
  22. package/.history/vue.config_20230626104410.js +129 -0
  23. package/.history/vue.config_20230626104446.js +129 -0
  24. package/.history/vue.config_20230626104448.js +129 -0
  25. package/.history/vue.config_20230626104552.js +130 -0
  26. package/.history/vue.config_20230626104554.js +130 -0
  27. package/.history/vue.config_20230626104556.js +130 -0
  28. package/.history/vue.config_20230626104559.js +132 -0
  29. package/.history/vue.config_20230626104600.js +132 -0
  30. package/.history/vue.config_20230626104603.js +132 -0
  31. package/.history/vue.config_20230626104608.js +129 -0
  32. package/.history/vue.config_20230626104646.js +123 -0
  33. package/.history/vue.config_20230626104824.js +124 -0
  34. package/.history/vue.config_20230626104825.js +124 -0
  35. package/.history/vue.config_20230626104829.js +124 -0
  36. package/.history/vue.config_20230626104832.js +124 -0
  37. package/.history/vue.config_20230626104836.js +121 -0
  38. package/.history/vue.config_20230626105637.js +122 -0
  39. package/.history/vue.config_20230626105642.js +123 -0
  40. package/.history/vue.config_20230626105834.js +124 -0
  41. package/.history/vue.config_20230626105920.js +124 -0
  42. package/.history/vue.config_20230626105938.js +123 -0
  43. package/.history/vue.config_20230626110142.js +124 -0
  44. package/.history/vue.config_20230626110147.js +124 -0
  45. package/.history/vue.config_20230626110154.js +124 -0
  46. package/.history/vue.config_20230626110156.js +124 -0
  47. package/.history/vue.config_20230626110206.js +124 -0
  48. package/.history/vue.config_20230626110207.js +124 -0
  49. package/.history/vue.config_20230626110209.js +124 -0
  50. package/.history/vue.config_20230626110235.js +123 -0
  51. package/.history/vue.config_20230626110237.js +123 -0
  52. package/.history/vue.config_20230626110257.js +123 -0
  53. package/.history/vue.config_20230626110300.js +123 -0
  54. package/.history/vue.config_20230626110316.js +123 -0
  55. package/.history/vue.config_20230626110621.js +123 -0
  56. package/.history/vue.config_20230626110703.js +124 -0
  57. package/.history/vue.config_20230626110708.js +125 -0
  58. package/.history/vue.config_20230626110710.js +126 -0
  59. package/.history/vue.config_20230626110712.js +127 -0
  60. package/.history/vue.config_20230626110715.js +126 -0
  61. package/.history/vue.config_20230626110716.js +127 -0
  62. package/.history/vue.config_20230626110721.js +128 -0
  63. package/.history/vue.config_20230626110741.js +128 -0
  64. package/.history/vue.config_20230626110746.js +128 -0
  65. package/.history/vue.config_20230626110751.js +128 -0
  66. package/.history/vue.config_20230626110754.js +128 -0
  67. package/.history/vue.config_20230626110757.js +128 -0
  68. package/.history/vue.config_20230626110811.js +128 -0
  69. package/.history/vue.config_20230626110815.js +128 -0
  70. package/.history/vue.config_20230626110820.js +128 -0
  71. package/.history/vue.config_20230626110823.js +128 -0
  72. package/.history/vue.config_20230626110949.js +129 -0
  73. package/.history/vue.config_20230626110951.js +129 -0
  74. package/.history/vue.config_20230626110953.js +130 -0
  75. package/.history/vue.config_20230626110956.js +130 -0
  76. package/.history/vue.config_20230626110958.js +131 -0
  77. package/.history/vue.config_20230626111207.js +131 -0
  78. package/.history/vue.config_20230626111211.js +131 -0
  79. package/.history/vue.config_20230626111216.js +131 -0
  80. package/.history/vue.config_20230626111217.js +131 -0
  81. package/.history/vue.config_20230626111332.js +131 -0
  82. package/.history/vue.config_20230626111338.js +131 -0
  83. package/.history/vue.config_20230626111342.js +131 -0
  84. package/.history/vue.config_20230626111359.js +131 -0
  85. package/.history/vue.config_20230626111402.js +131 -0
  86. package/.history/vue.config_20230626111404.js +131 -0
  87. package/.history/vue.config_20230626111442.js +131 -0
  88. package/.history/vue.config_20230626111443.js +131 -0
  89. package/.history/vue.config_20230626111448.js +131 -0
  90. package/.history/vue.config_20230626111450.js +131 -0
  91. package/.history/vue.config_20230626111528.js +131 -0
  92. package/.history/vue.config_20230626111529.js +131 -0
  93. package/.history/vue.config_20230626112153.js +132 -0
  94. package/.history/vue.config_20230626112156.js +133 -0
  95. package/.history/vue.config_20230626112158.js +132 -0
  96. package/.history/vue.config_20230626112201.js +132 -0
  97. package/.history/vue.config_20230626112254.js +132 -0
  98. package/.history/vue.config_20230626112400.js +132 -0
  99. package/.history/vue.config_20230626112402.js +132 -0
  100. package/.history/vue.config_20230626112452.js +132 -0
  101. package/.history/vue.config_20230626113026.js +133 -0
  102. package/.history/vue.config_20230626113032.js +133 -0
  103. package/.history/vue.config_20230626113034.js +134 -0
  104. package/.history/vue.config_20230626113036.js +135 -0
  105. package/.history/vue.config_20230626113040.js +136 -0
  106. package/.history/vue.config_20230626113041.js +137 -0
  107. package/.history/vue.config_20230626113042.js +138 -0
  108. package/.history/vue.config_20230626113044.js +139 -0
  109. package/.history/vue.config_20230626113049.js +140 -0
  110. package/.history/vue.config_20230626113052.js +141 -0
  111. package/.history/vue.config_20230626113056.js +142 -0
  112. package/.history/vue.config_20230626113058.js +143 -0
  113. package/.history/vue.config_20230626113101.js +144 -0
  114. package/.history/vue.config_20230626113105.js +144 -0
  115. package/.history/vue.config_20230626113110.js +145 -0
  116. package/.history/vue.config_20230626113112.js +145 -0
  117. package/.history/vue.config_20230626113129.js +145 -0
  118. package/.history/vue.config_20230626113131.js +146 -0
  119. package/.history/vue.config_20230626113133.js +145 -0
  120. package/.history/vue.config_20230626113142.js +144 -0
  121. package/.history/vue.config_20230626113145.js +137 -0
  122. package/.history/vue.config_20230626113147.js +144 -0
  123. package/.history/vue.config_20230626113154.js +143 -0
  124. package/.history/vue.config_20230626113202.js +144 -0
  125. package/.history/vue.config_20230626113204.js +144 -0
  126. package/.history/vue.config_20230626113207.js +144 -0
  127. package/.history/vue.config_20230626113216.js +144 -0
  128. package/.history/vue.config_20230626113223.js +144 -0
  129. package/.history/vue.config_20230626113224.js +144 -0
  130. package/.history/vue.config_20230626113227.js +144 -0
  131. package/.history/vue.config_20230626113230.js +144 -0
  132. package/.history/vue.config_20230626113237.js +144 -0
  133. package/.history/vue.config_20230626113239.js +144 -0
  134. package/.history/vue.config_20230626113244.js +144 -0
  135. package/.history/vue.config_20230626113245.js +144 -0
  136. package/.history/vue.config_20230626113248.js +142 -0
  137. package/.history/vue.config_20230626113250.js +142 -0
  138. package/.history/vue.config_20230626113255.js +142 -0
  139. package/.history/vue.config_20230626113303.js +142 -0
  140. package/.history/vue.config_20230626113305.js +142 -0
  141. package/.history/vue.config_20230626113309.js +142 -0
  142. package/.history/vue.config_20230626113347.js +142 -0
  143. package/.history/vue.config_20230626113404.js +139 -0
  144. package/.history/vue.config_20230626113406.js +138 -0
  145. package/.history/vue.config_20230626113418.js +134 -0
  146. package/.history/vue.config_20230626113511.js +129 -0
  147. package/.history/vue.config_20230626113656.js +129 -0
  148. package/.history/vue.config_20230626114206.js +134 -0
  149. package/.history/vue.config_20230626114210.js +138 -0
  150. package/.history/vue.config_20230626114358.js +137 -0
  151. package/.history/vue.config_20230626114603.js +137 -0
  152. package/.history/vue.config_20230626114605.js +137 -0
  153. package/.history/vue.config_20230626114657.js +137 -0
  154. package/.history/vue.config_20230626114745.js +137 -0
  155. package/.history/vue.config_20230626114821.js +137 -0
  156. package/.history/vue.config_20230626114832.js +139 -0
  157. package/.history/vue.config_20230626114836.js +132 -0
  158. package/.history/vue.config_20230626114847.js +132 -0
  159. package/.history/vue.config_20230626114850.js +132 -0
  160. package/{dist → lib}/@focus-teach/ui.common.js +26 -26
  161. package/lib/@focus-teach/ui.css +1 -0
  162. package/{dist → lib}/@focus-teach/ui.umd.js +26 -26
  163. package/{dist → lib}/@focus-teach/ui.umd.min.js +1 -1
  164. package/package.json +2 -2
  165. package/dist/@focus-teach/ui.css +0 -1
  166. /package/{dist → lib/@focus-teach}/fonts/icomoon.356dc15f.woff +0 -0
  167. /package/{dist → lib/@focus-teach}/fonts/icomoon.71d64f31.woff +0 -0
  168. /package/{dist → lib/@focus-teach}/fonts/icomoon.7c9a60d9.eot +0 -0
  169. /package/{dist → lib/@focus-teach}/fonts/icomoon.ba18ad87.eot +0 -0
  170. /package/{dist → lib/@focus-teach}/fonts/icomoon.de76432e.ttf +0 -0
  171. /package/{dist → lib/@focus-teach}/fonts/icomoon.ec37e716.ttf +0 -0
  172. /package/{dist → lib/@focus-teach}/img/cloud_txt_24.87b9d2ae.svg +0 -0
  173. /package/{dist → lib/@focus-teach}/img/icomoon.428f3063.svg +0 -0
  174. /package/{dist → lib/@focus-teach}/img/icomoon.532b3795.svg +0 -0
  175. /package/{dist → lib/@focus-teach}/img/icon_question.e931b16c.svg +0 -0
  176. /package/{dist → lib}/demo.html +0 -0
@@ -0,0 +1,128 @@
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: {
123
+ index: path.resolve(srcDir, 'index.js'),
124
+ button: path.resolve(srcDir, 'components/button/index.js'),
125
+ input: path.resolve(srcDir, 'components/input/index.js'),
126
+ }
127
+ }
128
+ };
@@ -0,0 +1,128 @@
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('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
+ entry: {
123
+ index: path.resolve(srcDir, 'index.js'),
124
+ button: path.resolve(srcDir, 'components/button/index.js'),
125
+ input: path.resolve(srcDir, 'components/input/index.js'),
126
+ }
127
+ }
128
+ };
@@ -0,0 +1,128 @@
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
+ entry: {
123
+ index: path.resolve(srcDir, 'index.js'),
124
+ button: path.resolve(srcDir, 'components/button/index.js'),
125
+ input: path.resolve(srcDir, 'components/input/index.js'),
126
+ }
127
+ }
128
+ };
@@ -0,0 +1,128 @@
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
+ entry: {
123
+ packagesDir: path.resolve(srcDir, 'index.js'),
124
+ button: path.resolve(srcDir, 'components/button/index.js'),
125
+ input: path.resolve(srcDir, 'components/input/index.js'),
126
+ }
127
+ }
128
+ };
@@ -0,0 +1,128 @@
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
+ entry: {
123
+ index: path.resolve(srcDir, 'index.js'),
124
+ button: path.resolve(srcDir, 'components/button/index.js'),
125
+ input: path.resolve(srcDir, 'components/input/index.js'),
126
+ }
127
+ }
128
+ };