cloud-business 0.1.102 → 0.1.103-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/{dist/cloud-business.css → cloud-business.css} +268 -499
- package/cloud-business.js +5 -0
- package/cloud-business.min.css +1 -0
- package/cloud-business.min.js +1 -0
- package/package.json +1 -130
- package/.babelrc +0 -22
- package/.idea/cloud-business.iml +0 -8
- package/.idea/inspectionProfiles/Project_Default.xml +0 -6
- package/.idea/misc.xml +0 -6
- package/.idea/modules.xml +0 -8
- package/.idea/vcs.xml +0 -6
- package/.idea/workspace.xml +0 -698
- package/LICENSE +0 -21
- package/README.md +0 -2
- package/assets.json +0 -132
- package/demos/app.js +0 -86
- package/demos/app.less +0 -13
- package/demos/assets/lib/prism.js +0 -11
- package/demos/assets/lib/prism.less +0 -160
- package/demos/components/code-box/assets/code.svg +0 -1
- package/demos/components/code-box/index.js +0 -106
- package/demos/components/code-box/index.less +0 -204
- package/demos/components/markdown/index.js +0 -105
- package/demos/components/markdown/index.less +0 -937
- package/demos/components/menu/index.js +0 -75
- package/demos/components/menu/index.less +0 -73
- package/demos/index.html +0 -28
- package/demos/index.js +0 -16
- package/dist/cloud-business.js +0 -5
- package/dist/cloud-business.min.css +0 -1
- package/dist/cloud-business.min.js +0 -1
- package/dist/package.json +0 -130
- package/jsconfig.json +0 -13
- package/typings.d.ts +0 -2
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2019 Shuyun FF2E
|
|
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.
|
package/README.md
DELETED
package/assets.json
DELETED
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": " ",
|
|
3
|
-
"package": "cloud-react",
|
|
4
|
-
"logo": "https://brand-guide.shuyun.com/IAM/77c28a6547cd.png",
|
|
5
|
-
"assets": {
|
|
6
|
-
"atoms": [],
|
|
7
|
-
"examples": [
|
|
8
|
-
{
|
|
9
|
-
"type": "BLOCK",
|
|
10
|
-
"identifier": "basic-demo",
|
|
11
|
-
"dependencies": {
|
|
12
|
-
"react": {
|
|
13
|
-
"type": "NPM",
|
|
14
|
-
"value": "16.14.0"
|
|
15
|
-
},
|
|
16
|
-
"cloud-react": {
|
|
17
|
-
"type": "NPM",
|
|
18
|
-
"value": "0.0.98"
|
|
19
|
-
},
|
|
20
|
-
"index.jsx": {
|
|
21
|
-
"type": "FILE",
|
|
22
|
-
"value": "/**\n+ * title: cloud-bread-crumbs\n+ */\n\n\n\nimport React from 'react';\nimport { BreadCrumbs, Button } from 'cloud-react';\n\nexport default class BreadCrumbsDemo extends React.Component {\n constructor(props) {\n super(props);\n this.state = {\n size: 'default'\n };\n }\n\n onChangeSize = size => {\n this.setState({ size });\n }\n\n onClickBreadCrumbs = item => {\n console.log(item);\n };\n\n getButtonType = size => {\n return this.state.size === size ? 'primary' : 'normal';\n }\n render() {\n const { size } = this.state;\n const { onChangeSize, onClickBreadCrumbs, getButtonType } = this;\n const list = [\n {\n key: 'home',\n title: '首页'\n },\n {\n key: 'bread-crumbs',\n title: '面包屑'\n },\n {\n key: 'a3',\n title: '查看详情'\n }\n ];\n\n\t\treturn (\n\t\t\t<>\n <div className=\"basic-action\">\n <Button type={getButtonType('large')} onClick={() => {onChangeSize('large')}}>large</Button>\n <Button type={getButtonType('default')} onClick={() => {onChangeSize('default')}}>default</Button>\n <Button type={getButtonType('small')} onClick={() => {onChangeSize('small')}}>small</Button>\n <Button type=\"link\" disabled>\n current: {size}\n </Button>\n </div>\n <div>\n <BreadCrumbs list={list} size={size} onClick={onClickBreadCrumbs.bind(this)}/>\n </div>\n </>\n\t\t);\n\t}\n}"
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
"type": "BLOCK",
|
|
28
|
-
"identifier": "basic-demo",
|
|
29
|
-
"dependencies": {
|
|
30
|
-
"react": {
|
|
31
|
-
"type": "NPM",
|
|
32
|
-
"value": "16.14.0"
|
|
33
|
-
},
|
|
34
|
-
"cloud-react": {
|
|
35
|
-
"type": "NPM",
|
|
36
|
-
"value": "0.0.98"
|
|
37
|
-
},
|
|
38
|
-
"index.jsx": {
|
|
39
|
-
"type": "FILE",
|
|
40
|
-
"value": "/**\n+ * title: cloud-bread-crumbs\n+ */\n\n\n\nimport React from 'react';\nimport { BreadCrumbs, Button } from 'cloud-react';\n\nexport default class BreadCrumbsDemo extends React.Component {\n constructor(props) {\n super(props);\n this.state = {\n size: 'default'\n };\n }\n\n onChangeSize = size => {\n this.setState({ size });\n }\n\n onClickBreadCrumbs = item => {\n console.log(item);\n };\n\n getButtonType = size => {\n return this.state.size === size ? 'primary' : 'normal';\n }\n render() {\n const { size } = this.state;\n const { onChangeSize, onClickBreadCrumbs, getButtonType } = this;\n const list = [\n {\n key: 'home',\n title: '首页'\n },\n {\n key: 'bread-crumbs',\n title: '面包屑'\n },\n {\n key: 'a3',\n title: '查看详情'\n }\n ];\n\n\t\treturn (\n\t\t\t<>\n <div className=\"basic-action\">\n <Button type={getButtonType('large')} onClick={() => {onChangeSize('large')}}>large</Button>\n <Button type={getButtonType('default')} onClick={() => {onChangeSize('default')}}>default</Button>\n <Button type={getButtonType('small')} onClick={() => {onChangeSize('small')}}>small</Button>\n <Button type=\"link\" disabled>\n current: {size}\n </Button>\n </div>\n <div>\n <BreadCrumbs list={list} size={size} onClick={onClickBreadCrumbs.bind(this)}/>\n </div>\n </>\n\t\t);\n\t}\n}"
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
"type": "BLOCK",
|
|
46
|
-
"identifier": "basic-demo",
|
|
47
|
-
"dependencies": {
|
|
48
|
-
"react": {
|
|
49
|
-
"type": "NPM",
|
|
50
|
-
"value": "16.14.0"
|
|
51
|
-
},
|
|
52
|
-
"cloud-react": {
|
|
53
|
-
"type": "NPM",
|
|
54
|
-
"value": "0.0.98"
|
|
55
|
-
},
|
|
56
|
-
"index.jsx": {
|
|
57
|
-
"type": "FILE",
|
|
58
|
-
"value": "import React from 'react';\nimport { Button, InputNumber } from 'cloud-react';\n\nconst blank = '\\u00A0';\n\nexport default class ButtonDemo extends React.Component {\n\trender() {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<div>\n\t\t\t\t\t<Button type=\"primary\">primary</Button>\n\t\t\t\t\t{blank}\n\t\t\t\t\t<Button type=\"normal\">normal</Button>\n\t\t\t\t\t{blank}\n\t\t\t\t\t<Button type=\"dashed\">dashed</Button>\n\t\t\t\t\t{blank}\n\t\t\t\t\t<Button type=\"link\">link</Button>\n\t\t\t\t</div>\n\t\t\t</>\n\t\t);\n\t}\n}"
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
},
|
|
62
|
-
{
|
|
63
|
-
"type": "BLOCK",
|
|
64
|
-
"identifier": "block-demo",
|
|
65
|
-
"dependencies": {
|
|
66
|
-
"react": {
|
|
67
|
-
"type": "NPM",
|
|
68
|
-
"value": "16.14.0"
|
|
69
|
-
},
|
|
70
|
-
"cloud-react": {
|
|
71
|
-
"type": "NPM",
|
|
72
|
-
"value": "0.0.98"
|
|
73
|
-
},
|
|
74
|
-
"index.jsx": {
|
|
75
|
-
"type": "FILE",
|
|
76
|
-
"value": "import React from 'react';\nimport { Button } from 'cloud-react';\n\nconst blank = '\\u00A0';\n\nexport default class ButtonDemo extends React.Component {\n\trender() {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<div>\n\t\t\t\t\t<Button block type=\"primary\">\n\t\t\t\t\t\tprimary\n\t\t\t\t\t</Button>\n\t\t\t\t\t{blank}\n\t\t\t\t\t<Button block type=\"normal\">\n\t\t\t\t\t\tnormal\n\t\t\t\t\t</Button>\n\t\t\t\t\t{blank}\n\t\t\t\t\t<Button block type=\"dashed\">\n\t\t\t\t\t\tdashed\n\t\t\t\t\t</Button>\n\t\t\t\t\t{blank}\n\t\t\t\t\t<Button block type=\"link\">\n\t\t\t\t\t\tlink\n\t\t\t\t\t</Button>\n\t\t\t\t</div>\n\t\t\t</>\n\t\t);\n\t}\n}"
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
},
|
|
80
|
-
{
|
|
81
|
-
"type": "BLOCK",
|
|
82
|
-
"identifier": "basic-demo",
|
|
83
|
-
"dependencies": {
|
|
84
|
-
"react": {
|
|
85
|
-
"type": "NPM",
|
|
86
|
-
"value": "16.14.0"
|
|
87
|
-
},
|
|
88
|
-
"cloud-react": {
|
|
89
|
-
"type": "NPM",
|
|
90
|
-
"value": "0.0.98"
|
|
91
|
-
},
|
|
92
|
-
"index.jsx": {
|
|
93
|
-
"type": "FILE",
|
|
94
|
-
"value": "import React from 'react';\nimport { Button, InputNumber } from 'cloud-react';\n\nconst blank = '\\u00A0';\n\nexport default class ButtonDemo extends React.Component {\n\trender() {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<div>\n\t\t\t\t\t<Button type=\"primary\">primary</Button>\n\t\t\t\t\t{blank}\n\t\t\t\t\t<Button type=\"normal\">normal</Button>\n\t\t\t\t\t{blank}\n\t\t\t\t\t<Button type=\"dashed\">dashed</Button>\n\t\t\t\t\t{blank}\n\t\t\t\t\t<Button type=\"link\">link</Button>\n\t\t\t\t</div>\n\t\t\t</>\n\t\t);\n\t}\n}"
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
},
|
|
98
|
-
{
|
|
99
|
-
"type": "BLOCK",
|
|
100
|
-
"identifier": "block-demo",
|
|
101
|
-
"dependencies": {
|
|
102
|
-
"react": {
|
|
103
|
-
"type": "NPM",
|
|
104
|
-
"value": "16.14.0"
|
|
105
|
-
},
|
|
106
|
-
"cloud-react": {
|
|
107
|
-
"type": "NPM",
|
|
108
|
-
"value": "0.0.98"
|
|
109
|
-
},
|
|
110
|
-
"index.jsx": {
|
|
111
|
-
"type": "FILE",
|
|
112
|
-
"value": "import React from 'react';\nimport { Button } from 'cloud-react';\n\nconst blank = '\\u00A0';\n\nexport default class ButtonDemo extends React.Component {\n\trender() {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<div>\n\t\t\t\t\t<Button block type=\"primary\">\n\t\t\t\t\t\tprimary\n\t\t\t\t\t</Button>\n\t\t\t\t\t{blank}\n\t\t\t\t\t<Button block type=\"normal\">\n\t\t\t\t\t\tnormal\n\t\t\t\t\t</Button>\n\t\t\t\t\t{blank}\n\t\t\t\t\t<Button block type=\"dashed\">\n\t\t\t\t\t\tdashed\n\t\t\t\t\t</Button>\n\t\t\t\t\t{blank}\n\t\t\t\t\t<Button block type=\"link\">\n\t\t\t\t\t\tlink\n\t\t\t\t\t</Button>\n\t\t\t\t</div>\n\t\t\t</>\n\t\t);\n\t}\n}"
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
},
|
|
116
|
-
{
|
|
117
|
-
"type": "BLOCK",
|
|
118
|
-
"identifier": "form-demo",
|
|
119
|
-
"dependencies": {
|
|
120
|
-
"cloud-react": {
|
|
121
|
-
"type": "NPM",
|
|
122
|
-
"value": "0.0.98"
|
|
123
|
-
},
|
|
124
|
-
"index.jsx": {
|
|
125
|
-
"type": "FILE",
|
|
126
|
-
"value": "import { Form, Field, Input } from 'cloud-react';\n\n// 简单场景\nfunction FormA() {\n\tconst field = Field.useField();\n\n\treturn (\n\t\t<Form field={field}>\n\t\t\t<Form.Item>\n\t\t\t\t<Input\n\t\t\t\t\t{...field.init('name', {\n\t\t\t\t\t\trules: [{ required: true, message: '用户名必须填写' }]\n\t\t\t\t\t})}\n\t\t\t\t/>\n\t\t\t</Form.Item>\n\t\t</Form>\n\t);\n}\n\n// 复杂场景,需要使用Nexus组件\nfunction FormB() {\n\tB;\n\tconst field = Field.useField();\n\n\treturn (\n\t\t<Form field={field}>\n\t\t\t<Form.Item>\n\t\t\t\t<UseNexus field={field} />\n\t\t\t</Form.Item>\n\t\t</Form>\n\t);\n}\n\nfunction UseNexus() {\n\treturn (\n\t\t<Form.Nexus>\n\t\t\t<Input\n\t\t\t\t{...field.init('firstName', {\n\t\t\t\t\trules: [{ required: true, message: '名字必须填写' }]\n\t\t\t\t})}\n\t\t\t/>\n\n\t\t\t<Input\n\t\t\t\t{...field.init('lastName', {\n\t\t\t\t\trules: [{ required: true, message: '姓氏必须填写' }]\n\t\t\t\t})}\n\t\t\t/>\n\t\t</Form.Nexus>\n\t);\n}"
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
]
|
|
131
|
-
}
|
|
132
|
-
}
|
package/demos/app.js
DELETED
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
/* eslint-disable */
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import { Switch, Route, Redirect } from 'react-router-dom';
|
|
4
|
-
import './assets/lib/prism';
|
|
5
|
-
import './assets/lib/prism.less';
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
/* <% dynamicDocs begin %> */
|
|
9
|
-
/**
|
|
10
|
-
* import abc './abc.md'
|
|
11
|
-
* import ...
|
|
12
|
-
*
|
|
13
|
-
* const docs = [
|
|
14
|
-
* { path: '/abc', label: 'abc', result: abc },
|
|
15
|
-
* ...
|
|
16
|
-
* ]
|
|
17
|
-
*
|
|
18
|
-
*/
|
|
19
|
-
/* <% dynamicDocs end %> */
|
|
20
|
-
|
|
21
|
-
import Menu from './components/menu';
|
|
22
|
-
import Markdown from './components/markdown';
|
|
23
|
-
import classes from './app.less';
|
|
24
|
-
|
|
25
|
-
const menuConf = {};
|
|
26
|
-
const routeViews = [];
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* docs 这个变量是生成的
|
|
30
|
-
* 注意那段的注释
|
|
31
|
-
*/
|
|
32
|
-
docs.forEach(({ path, result, demos = [] }, key) => {
|
|
33
|
-
const { html, attributes: { title, subtitle, order, category = '' } } = result;
|
|
34
|
-
const routePath = `/${category}${path}`.replace(/\/+/g, '/').toLocaleLowerCase();
|
|
35
|
-
|
|
36
|
-
if (!menuConf[category]) {
|
|
37
|
-
menuConf[category] = {
|
|
38
|
-
title: category,
|
|
39
|
-
subMenu: []
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
menuConf[category].subMenu.push({
|
|
44
|
-
title,
|
|
45
|
-
order,
|
|
46
|
-
subtitle,
|
|
47
|
-
path: routePath
|
|
48
|
-
})
|
|
49
|
-
|
|
50
|
-
routeViews.push(
|
|
51
|
-
<Route
|
|
52
|
-
key={key}
|
|
53
|
-
path={routePath}
|
|
54
|
-
component={() => <Markdown title={title} subtitle={subtitle} html={html} demos={demos} />} />
|
|
55
|
-
);
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
function App() {
|
|
60
|
-
const infinity = Math.pow(2, 32);
|
|
61
|
-
const menuDataSource = [];
|
|
62
|
-
|
|
63
|
-
Object.keys(menuConf).map(key => {
|
|
64
|
-
!key
|
|
65
|
-
? menuDataSource.push(...menuConf[key].subMenu)
|
|
66
|
-
: menuDataSource.push(menuConf[key]);
|
|
67
|
-
});
|
|
68
|
-
menuDataSource.sort(({ order: p = infinity }, { order: n = infinity }) => p - n);
|
|
69
|
-
|
|
70
|
-
const [first] = menuDataSource;
|
|
71
|
-
|
|
72
|
-
return (
|
|
73
|
-
<section className={classes.app}>
|
|
74
|
-
<Menu dataSource={menuDataSource} />
|
|
75
|
-
|
|
76
|
-
<div className={classes.content}>
|
|
77
|
-
<Switch>
|
|
78
|
-
{routeViews}
|
|
79
|
-
<Redirect to={first.path ? first.path : first.subMenu[0].path} />
|
|
80
|
-
</Switch>
|
|
81
|
-
</div>
|
|
82
|
-
</section>
|
|
83
|
-
);
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
export default App;
|
package/demos/app.less
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/* PrismJS 1.17.1
|
|
2
|
-
https://prismjs.com/download.html#themes=prism&languages=markup+css+clike+javascript+less+markdown+jsx */
|
|
3
|
-
/* eslint-disable */
|
|
4
|
-
var _self="undefined"!=typeof window?window:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?self:{},Prism=function(u){var c=/\blang(?:uage)?-([\w-]+)\b/i,r=0;var _={manual:u.Prism&&u.Prism.manual,disableWorkerMessageHandler:u.Prism&&u.Prism.disableWorkerMessageHandler,util:{encode:function(e){return e instanceof L?new L(e.type,_.util.encode(e.content),e.alias):Array.isArray(e)?e.map(_.util.encode):e.replace(/&/g,"&").replace(/</g,"<").replace(/\u00a0/g," ")},type:function(e){return Object.prototype.toString.call(e).slice(8,-1)},objId:function(e){return e.__id||Object.defineProperty(e,"__id",{value:++r}),e.__id},clone:function n(e,t){var a,r,i=_.util.type(e);switch(t=t||{},i){case"Object":if(r=_.util.objId(e),t[r])return t[r];for(var o in a={},t[r]=a,e)e.hasOwnProperty(o)&&(a[o]=n(e[o],t));return a;case"Array":return r=_.util.objId(e),t[r]?t[r]:(a=[],t[r]=a,e.forEach(function(e,r){a[r]=n(e,t)}),a);default:return e}},currentScript:function(){if("undefined"==typeof document)return null;if("currentScript"in document)return document.currentScript;try{throw new Error}catch(e){var r=(/at [^(\r\n]*\((.*):.+:.+\)$/i.exec(e.stack)||[])[1];if(r){var n=document.getElementsByTagName("script");for(var t in n)if(n[t].src==r)return n[t]}return null}}},languages:{extend:function(e,r){var n=_.util.clone(_.languages[e]);for(var t in r)n[t]=r[t];return n},insertBefore:function(n,e,r,t){var a=(t=t||_.languages)[n],i={};for(var o in a)if(a.hasOwnProperty(o)){if(o==e)for(var l in r)r.hasOwnProperty(l)&&(i[l]=r[l]);r.hasOwnProperty(o)||(i[o]=a[o])}var s=t[n];return t[n]=i,_.languages.DFS(_.languages,function(e,r){r===s&&e!=n&&(this[e]=i)}),i},DFS:function e(r,n,t,a){a=a||{};var i=_.util.objId;for(var o in r)if(r.hasOwnProperty(o)){n.call(r,o,r[o],t||o);var l=r[o],s=_.util.type(l);"Object"!==s||a[i(l)]?"Array"!==s||a[i(l)]||(a[i(l)]=!0,e(l,n,o,a)):(a[i(l)]=!0,e(l,n,null,a))}}},plugins:{},highlightAll:function(e,r){_.highlightAllUnder(document,e,r)},highlightAllUnder:function(e,r,n){var t={callback:n,selector:'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'};_.hooks.run("before-highlightall",t);for(var a,i=e.querySelectorAll(t.selector),o=0;a=i[o++];)_.highlightElement(a,!0===r,t.callback)},highlightElement:function(e,r,n){var t=function(e){for(;e&&!c.test(e.className);)e=e.parentNode;return e?(e.className.match(c)||[,"none"])[1].toLowerCase():"none"}(e),a=_.languages[t];e.className=e.className.replace(c,"").replace(/\s+/g," ")+" language-"+t;var i=e.parentNode;i&&"pre"===i.nodeName.toLowerCase()&&(i.className=i.className.replace(c,"").replace(/\s+/g," ")+" language-"+t);var o={element:e,language:t,grammar:a,code:e.textContent};function l(e){o.highlightedCode=e,_.hooks.run("before-insert",o),o.element.innerHTML=o.highlightedCode,_.hooks.run("after-highlight",o),_.hooks.run("complete",o),n&&n.call(o.element)}if(_.hooks.run("before-sanity-check",o),!o.code)return _.hooks.run("complete",o),void(n&&n.call(o.element));if(_.hooks.run("before-highlight",o),o.grammar)if(r&&u.Worker){var s=new Worker(_.filename);s.onmessage=function(e){l(e.data)},s.postMessage(JSON.stringify({language:o.language,code:o.code,immediateClose:!0}))}else l(_.highlight(o.code,o.grammar,o.language));else l(_.util.encode(o.code))},highlight:function(e,r,n){var t={code:e,grammar:r,language:n};return _.hooks.run("before-tokenize",t),t.tokens=_.tokenize(t.code,t.grammar),_.hooks.run("after-tokenize",t),L.stringify(_.util.encode(t.tokens),t.language)},matchGrammar:function(e,r,n,t,a,i,o){for(var l in n)if(n.hasOwnProperty(l)&&n[l]){var s=n[l];s=Array.isArray(s)?s:[s];for(var u=0;u<s.length;++u){if(o&&o==l+","+u)return;var c=s[u],g=c.inside,f=!!c.lookbehind,d=!!c.greedy,h=0,m=c.alias;if(d&&!c.pattern.global){var p=c.pattern.toString().match(/[imsuy]*$/)[0];c.pattern=RegExp(c.pattern.source,p+"g")}c=c.pattern||c;for(var y=t,v=a;y<r.length;v+=r[y].length,++y){var k=r[y];if(r.length>e.length)return;if(!(k instanceof L)){if(d&&y!=r.length-1){if(c.lastIndex=v,!(O=c.exec(e)))break;for(var b=O.index+(f&&O[1]?O[1].length:0),w=O.index+O[0].length,A=y,P=v,x=r.length;A<x&&(P<w||!r[A].type&&!r[A-1].greedy);++A)(P+=r[A].length)<=b&&(++y,v=P);if(r[y]instanceof L)continue;S=A-y,k=e.slice(v,P),O.index-=v}else{c.lastIndex=0;var O=c.exec(k),S=1}if(O){f&&(h=O[1]?O[1].length:0);w=(b=O.index+h)+(O=O[0].slice(h)).length;var j=k.slice(0,b),N=k.slice(w),E=[y,S];j&&(++y,v+=j.length,E.push(j));var C=new L(l,g?_.tokenize(O,g):O,m,O,d);if(E.push(C),N&&E.push(N),Array.prototype.splice.apply(r,E),1!=S&&_.matchGrammar(e,r,n,y,v,!0,l+","+u),i)break}else if(i)break}}}}},tokenize:function(e,r){var n=[e],t=r.rest;if(t){for(var a in t)r[a]=t[a];delete r.rest}return _.matchGrammar(e,n,r,0,0,!1),n},hooks:{all:{},add:function(e,r){var n=_.hooks.all;n[e]=n[e]||[],n[e].push(r)},run:function(e,r){var n=_.hooks.all[e];if(n&&n.length)for(var t,a=0;t=n[a++];)t(r)}},Token:L};function L(e,r,n,t,a){this.type=e,this.content=r,this.alias=n,this.length=0|(t||"").length,this.greedy=!!a}if(u.Prism=_,L.stringify=function(e,r){if("string"==typeof e)return e;if(Array.isArray(e))return e.map(function(e){return L.stringify(e,r)}).join("");var n={type:e.type,content:L.stringify(e.content,r),tag:"span",classes:["token",e.type],attributes:{},language:r};if(e.alias){var t=Array.isArray(e.alias)?e.alias:[e.alias];Array.prototype.push.apply(n.classes,t)}_.hooks.run("wrap",n);var a=Object.keys(n.attributes).map(function(e){return e+'="'+(n.attributes[e]||"").replace(/"/g,""")+'"'}).join(" ");return"<"+n.tag+' class="'+n.classes.join(" ")+'"'+(a?" "+a:"")+">"+n.content+"</"+n.tag+">"},!u.document)return u.addEventListener&&(_.disableWorkerMessageHandler||u.addEventListener("message",function(e){var r=JSON.parse(e.data),n=r.language,t=r.code,a=r.immediateClose;u.postMessage(_.highlight(t,_.languages[n],n)),a&&u.close()},!1)),_;var e=_.util.currentScript();if(e&&(_.filename=e.src,e.hasAttribute("data-manual")&&(_.manual=!0)),!_.manual){function n(){_.manual||_.highlightAll()}var t=document.readyState;"loading"===t||"interactive"===t&&e.defer?document.addEventListener("DOMContentLoaded",n):window.requestAnimationFrame?window.requestAnimationFrame(n):window.setTimeout(n,16)}return _}(_self);"undefined"!=typeof module&&module.exports&&(module.exports=Prism),"undefined"!=typeof global&&(global.Prism=Prism);
|
|
5
|
-
Prism.languages.markup={comment:/<!--[\s\S]*?-->/,prolog:/<\?[\s\S]+?\?>/,doctype:{pattern:/<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:(?!<!--)[^"'\]]|"[^"]*"|'[^']*'|<!--[\s\S]*?-->)*\]\s*)?>/i,greedy:!0},cdata:/<!\[CDATA\[[\s\S]*?]]>/i,tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/i,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/i,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/i,inside:{punctuation:[/^=/,{pattern:/^(\s*)["']|["']$/,lookbehind:!0}]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:/&#?[\da-z]{1,8};/i},Prism.languages.markup.tag.inside["attr-value"].inside.entity=Prism.languages.markup.entity,Prism.hooks.add("wrap",function(a){"entity"===a.type&&(a.attributes.title=a.content.replace(/&/,"&"))}),Object.defineProperty(Prism.languages.markup.tag,"addInlined",{value:function(a,e){var s={};s["language-"+e]={pattern:/(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,lookbehind:!0,inside:Prism.languages[e]},s.cdata=/^<!\[CDATA\[|\]\]>$/i;var n={"included-cdata":{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,inside:s}};n["language-"+e]={pattern:/[\s\S]+/,inside:Prism.languages[e]};var t={};t[a]={pattern:RegExp("(<__[\\s\\S]*?>)(?:<!\\[CDATA\\[[\\s\\S]*?\\]\\]>\\s*|[\\s\\S])*?(?=<\\/__>)".replace(/__/g,a),"i"),lookbehind:!0,greedy:!0,inside:n},Prism.languages.insertBefore("markup","cdata",t)}}),Prism.languages.xml=Prism.languages.extend("markup",{}),Prism.languages.html=Prism.languages.markup,Prism.languages.mathml=Prism.languages.markup,Prism.languages.svg=Prism.languages.markup;
|
|
6
|
-
!function(s){var t=/("|')(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/;s.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:/@[\w-]+[\s\S]*?(?:;|(?=\s*\{))/,inside:{rule:/@[\w-]+/}},url:{pattern:RegExp("url\\((?:"+t.source+"|[^\n\r()]*)\\)","i"),inside:{function:/^url/i,punctuation:/^\(|\)$/}},selector:RegExp("[^{}\\s](?:[^{};\"']|"+t.source+")*?(?=\\s*\\{)"),string:{pattern:t,greedy:!0},property:/[-_a-z\xA0-\uFFFF][-\w\xA0-\uFFFF]*(?=\s*:)/i,important:/!important\b/i,function:/[-a-z0-9]+(?=\()/i,punctuation:/[(){};:,]/},s.languages.css.atrule.inside.rest=s.languages.css;var e=s.languages.markup;e&&(e.tag.addInlined("style","css"),s.languages.insertBefore("inside","attr-value",{"style-attr":{pattern:/\s*style=("|')(?:\\[\s\S]|(?!\1)[^\\])*\1/i,inside:{"attr-name":{pattern:/^\s*style/i,inside:e.tag.inside},punctuation:/^\s*=\s*['"]|['"]\s*$/,"attr-value":{pattern:/.+/i,inside:s.languages.css}},alias:"language-css"}},e.tag))}(Prism);
|
|
7
|
-
Prism.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/(\b(?:class|interface|extends|implements|trait|instanceof|new)\s+|\bcatch\s+\()[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:if|else|while|do|for|return|in|instanceof|function|new|try|throw|catch|finally|null|break|continue)\b/,boolean:/\b(?:true|false)\b/,function:/\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+\.?\d*|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/};
|
|
8
|
-
Prism.languages.javascript=Prism.languages.extend("clike",{"class-name":[Prism.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])[_$A-Z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\.(?:prototype|constructor))/,lookbehind:!0}],keyword:[{pattern:/((?:^|})\s*)(?:catch|finally)\b/,lookbehind:!0},{pattern:/(^|[^.])\b(?:as|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],number:/\b(?:(?:0[xX](?:[\dA-Fa-f](?:_[\dA-Fa-f])?)+|0[bB](?:[01](?:_[01])?)+|0[oO](?:[0-7](?:_[0-7])?)+)n?|(?:\d(?:_\d)?)+n|NaN|Infinity)\b|(?:\b(?:\d(?:_\d)?)+\.?(?:\d(?:_\d)?)*|\B\.(?:\d(?:_\d)?)+)(?:[Ee][+-]?(?:\d(?:_\d)?)+)?/,function:/#?[_$a-zA-Z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,operator:/--|\+\+|\*\*=?|=>|&&|\|\||[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?[.?]?|[~:]/}),Prism.languages.javascript["class-name"][0].pattern=/(\b(?:class|interface|extends|implements|instanceof|new)\s+)[\w.\\]+/,Prism.languages.insertBefore("javascript","keyword",{regex:{pattern:/((?:^|[^$\w\xA0-\uFFFF."'\])\s])\s*)\/(?:\[(?:[^\]\\\r\n]|\\.)*]|\\.|[^/\\\[\r\n])+\/[gimyus]{0,6}(?=\s*(?:$|[\r\n,.;})\]]))/,lookbehind:!0,greedy:!0},"function-variable":{pattern:/#?[_$a-zA-Z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|[_$a-zA-Z\xA0-\uFFFF][$\w\xA0-\uFFFF]*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+[_$A-Za-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*)?\s*\(\s*)(?!\s)(?:[^()]|\([^()]*\))+?(?=\s*\))/,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/[_$a-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\s*=>)/i,inside:Prism.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()]|\([^()]*\))+?(?=\s*\)\s*=>)/,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:[_$A-Za-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*\s*)\(\s*)(?!\s)(?:[^()]|\([^()]*\))+?(?=\s*\)\s*\{)/,lookbehind:!0,inside:Prism.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),Prism.languages.insertBefore("javascript","string",{"template-string":{pattern:/`(?:\\[\s\S]|\${(?:[^{}]|{(?:[^{}]|{[^}]*})*})+}|(?!\${)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\${(?:[^{}]|{(?:[^{}]|{[^}]*})*})+}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\${|}$/,alias:"punctuation"},rest:Prism.languages.javascript}},string:/[\s\S]+/}}}),Prism.languages.markup&&Prism.languages.markup.tag.addInlined("script","javascript"),Prism.languages.js=Prism.languages.javascript;
|
|
9
|
-
Prism.languages.less=Prism.languages.extend("css",{comment:[/\/\*[\s\S]*?\*\//,{pattern:/(^|[^\\])\/\/.*/,lookbehind:!0}],atrule:{pattern:/@[\w-]+?(?:\((?:[^(){}]|\([^(){}]*\))*\)|[^(){};])*?(?=\s*\{)/,inside:{punctuation:/[:()]/}},selector:{pattern:/(?:@\{[\w-]+\}|[^{};\s@])(?:@\{[\w-]+\}|\((?:[^(){}]|\([^(){}]*\))*\)|[^(){};@])*?(?=\s*\{)/,inside:{variable:/@+[\w-]+/}},property:/(?:@\{[\w-]+\}|[\w-])+(?:\+_?)?(?=\s*:)/i,operator:/[+\-*\/]/}),Prism.languages.insertBefore("less","property",{variable:[{pattern:/@[\w-]+\s*:/,inside:{punctuation:/:/}},/@@?[\w-]+/],"mixin-usage":{pattern:/([{;]\s*)[.#](?!\d)[\w-]+.*?(?=[(;])/,lookbehind:!0,alias:"function"}});
|
|
10
|
-
!function(d){function n(n,e){return n=n.replace(/<inner>/g,"(?:\\\\.|[^\\\\\\n\r]|(?:\r?\n|\r)(?!\r?\n|\r))"),e&&(n=n+"|"+n.replace(/_/g,"\\*")),RegExp("((?:^|[^\\\\])(?:\\\\{2})*)(?:"+n+")")}var e="(?:\\\\.|``.+?``|`[^`\r\\n]+`|[^\\\\|\r\\n`])+",t="\\|?__(?:\\|__)+\\|?(?:(?:\r?\n|\r)|$)".replace(/__/g,e),a="\\|?[ \t]*:?-{3,}:?[ \t]*(?:\\|[ \t]*:?-{3,}:?[ \t]*)+\\|?(?:\r?\n|\r)";d.languages.markdown=d.languages.extend("markup",{}),d.languages.insertBefore("markdown","prolog",{blockquote:{pattern:/^>(?:[\t ]*>)*/m,alias:"punctuation"},table:{pattern:RegExp("^"+t+a+"(?:"+t+")*","m"),inside:{"table-data-rows":{pattern:RegExp("^("+t+a+")(?:"+t+")*$"),lookbehind:!0,inside:{"table-data":{pattern:RegExp(e),inside:d.languages.markdown},punctuation:/\|/}},"table-line":{pattern:RegExp("^("+t+")"+a+"$"),lookbehind:!0,inside:{punctuation:/\||:?-{3,}:?/}},"table-header-row":{pattern:RegExp("^"+t+"$"),inside:{"table-header":{pattern:RegExp(e),alias:"important",inside:d.languages.markdown},punctuation:/\|/}}}},code:[{pattern:/(^[ \t]*(?:\r?\n|\r))(?: {4}|\t).+(?:(?:\r?\n|\r)(?: {4}|\t).+)*/m,lookbehind:!0,alias:"keyword"},{pattern:/``.+?``|`[^`\r\n]+`/,alias:"keyword"},{pattern:/^```[\s\S]*?^```$/m,greedy:!0,inside:{"code-block":{pattern:/^(```.*(?:\r?\n|\r))[\s\S]+?(?=(?:\r?\n|\r)^```$)/m,lookbehind:!0},"code-language":{pattern:/^(```).+/,lookbehind:!0},punctuation:/```/}}],title:[{pattern:/\S.*(?:\r?\n|\r)(?:==+|--+)(?=[ \t]*$)/m,alias:"important",inside:{punctuation:/==+$|--+$/}},{pattern:/(^\s*)#+.+/m,lookbehind:!0,alias:"important",inside:{punctuation:/^#+|#+$/}}],hr:{pattern:/(^\s*)([*-])(?:[\t ]*\2){2,}(?=\s*$)/m,lookbehind:!0,alias:"punctuation"},list:{pattern:/(^\s*)(?:[*+-]|\d+\.)(?=[\t ].)/m,lookbehind:!0,alias:"punctuation"},"url-reference":{pattern:/!?\[[^\]]+\]:[\t ]+(?:\S+|<(?:\\.|[^>\\])+>)(?:[\t ]+(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\)))?/,inside:{variable:{pattern:/^(!?\[)[^\]]+/,lookbehind:!0},string:/(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\))$/,punctuation:/^[\[\]!:]|[<>]/},alias:"url"},bold:{pattern:n("__(?:(?!_)<inner>|_(?:(?!_)<inner>)+_)+__",!0),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^..)[\s\S]+(?=..$)/,lookbehind:!0,inside:{}},punctuation:/\*\*|__/}},italic:{pattern:n("_(?:(?!_)<inner>|__(?:(?!_)<inner>)+__)+_",!0),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^.)[\s\S]+(?=.$)/,lookbehind:!0,inside:{}},punctuation:/[*_]/}},strike:{pattern:n("(~~?)(?:(?!~)<inner>)+?\\2",!1),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^~~?)[\s\S]+(?=\1$)/,lookbehind:!0,inside:{}},punctuation:/~~?/}},url:{pattern:n('!?\\[(?:(?!\\])<inner>)+\\](?:\\([^\\s)]+(?:[\t ]+"(?:\\\\.|[^"\\\\])*")?\\)| ?\\[(?:(?!\\])<inner>)+\\])',!1),lookbehind:!0,greedy:!0,inside:{variable:{pattern:/(\[)[^\]]+(?=\]$)/,lookbehind:!0},content:{pattern:/(^!?\[)[^\]]+(?=\])/,lookbehind:!0,inside:{}},string:{pattern:/"(?:\\.|[^"\\])*"(?=\)$)/}}}}),["url","bold","italic","strike"].forEach(function(e){["url","bold","italic","strike"].forEach(function(n){e!==n&&(d.languages.markdown[e].inside.content.inside[n]=d.languages.markdown[n])})}),d.hooks.add("after-tokenize",function(n){"markdown"!==n.language&&"md"!==n.language||!function n(e){if(e&&"string"!=typeof e)for(var t=0,a=e.length;t<a;t++){var i=e[t];if("code"===i.type){var r=i.content[1],o=i.content[3];if(r&&o&&"code-language"===r.type&&"code-block"===o.type&&"string"==typeof r.content){var l="language-"+r.content.trim().split(/\s+/)[0].toLowerCase();o.alias?"string"==typeof o.alias?o.alias=[o.alias,l]:o.alias.push(l):o.alias=[l]}}else n(i.content)}}(n.tokens)}),d.hooks.add("wrap",function(n){if("code-block"===n.type){for(var e="",t=0,a=n.classes.length;t<a;t++){var i=n.classes[t],r=/language-(.+)/.exec(i);if(r){e=r[1];break}}var o=d.languages[e];if(o){var l=n.content.replace(/</g,"<").replace(/&/g,"&");n.content=d.highlight(l,o,e)}else if(e&&"none"!==e&&d.plugins.autoloader){var s="md-"+(new Date).valueOf()+"-"+Math.floor(1e16*Math.random());n.attributes.id=s,d.plugins.autoloader.loadLanguages(e,function(){var n=document.getElementById(s);n&&(n.innerHTML=d.highlight(n.textContent,d.languages[e],e))})}}}),d.languages.md=d.languages.markdown}(Prism);
|
|
11
|
-
!function(i){var t=i.util.clone(i.languages.javascript);i.languages.jsx=i.languages.extend("markup",t),i.languages.jsx.tag.pattern=/<\/?(?:[\w.:-]+\s*(?:\s+(?:[\w.:-]+(?:=(?:("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|[^\s{'">=]+|\{(?:\{(?:\{[^}]*\}|[^{}])*\}|[^{}])+\}))?|\{\.{3}[a-z_$][\w$]*(?:\.[a-z_$][\w$]*)*\}))*\s*\/?)?>/i,i.languages.jsx.tag.inside.tag.pattern=/^<\/?[^\s>\/]*/i,i.languages.jsx.tag.inside["attr-value"].pattern=/=(?!\{)(?:("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|[^\s'">]+)/i,i.languages.jsx.tag.inside.tag.inside["class-name"]=/^[A-Z]\w*(?:\.[A-Z]\w*)*$/,i.languages.insertBefore("inside","attr-name",{spread:{pattern:/\{\.{3}[a-z_$][\w$]*(?:\.[a-z_$][\w$]*)*\}/,inside:{punctuation:/\.{3}|[{}.]/,"attr-value":/\w+/}}},i.languages.jsx.tag),i.languages.insertBefore("inside","attr-value",{script:{pattern:/=(?:\{(?:\{(?:\{[^}]*\}|[^}])*\}|[^}])+\})/i,inside:{"script-punctuation":{pattern:/^=(?={)/,alias:"punctuation"},rest:i.languages.jsx},alias:"language-javascript"}},i.languages.jsx.tag);var o=function(t){return t?"string"==typeof t?t:"string"==typeof t.content?t.content:t.content.map(o).join(""):""},p=function(t){for(var n=[],e=0;e<t.length;e++){var a=t[e],s=!1;if("string"!=typeof a&&("tag"===a.type&&a.content[0]&&"tag"===a.content[0].type?"</"===a.content[0].content[0].content?0<n.length&&n[n.length-1].tagName===o(a.content[0].content[1])&&n.pop():"/>"===a.content[a.content.length-1].content||n.push({tagName:o(a.content[0].content[1]),openedBraces:0}):0<n.length&&"punctuation"===a.type&&"{"===a.content?n[n.length-1].openedBraces++:0<n.length&&0<n[n.length-1].openedBraces&&"punctuation"===a.type&&"}"===a.content?n[n.length-1].openedBraces--:s=!0),(s||"string"==typeof a)&&0<n.length&&0===n[n.length-1].openedBraces){var g=o(a);e<t.length-1&&("string"==typeof t[e+1]||"plain-text"===t[e+1].type)&&(g+=o(t[e+1]),t.splice(e+1,1)),0<e&&("string"==typeof t[e-1]||"plain-text"===t[e-1].type)&&(g=o(t[e-1])+g,t.splice(e-1,1),e--),t[e]=new i.Token("plain-text",g,null,g)}a.content&&"string"!=typeof a.content&&p(a.content)}};i.hooks.add("after-tokenize",function(t){"jsx"!==t.language&&"tsx"!==t.language||p(t.tokens)})}(Prism);
|
|
@@ -1,160 +0,0 @@
|
|
|
1
|
-
/* PrismJS 1.17.1
|
|
2
|
-
https://prismjs.com/download.html#themes=prism&languages=markup+css+clike+javascript+less+markdown+jsx */
|
|
3
|
-
/**
|
|
4
|
-
* prism.js default theme for JavaScript, CSS and HTML
|
|
5
|
-
* Based on dabblet (http://dabblet.com)
|
|
6
|
-
* @author Lea Verou
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
:global {
|
|
10
|
-
|
|
11
|
-
code[class*="language-"],
|
|
12
|
-
pre[class*="language-"] {
|
|
13
|
-
color: black;
|
|
14
|
-
background: none;
|
|
15
|
-
text-shadow: 0 1px white;
|
|
16
|
-
font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
|
|
17
|
-
font-size: 1em;
|
|
18
|
-
text-align: left;
|
|
19
|
-
white-space: pre;
|
|
20
|
-
word-spacing: normal;
|
|
21
|
-
word-break: normal;
|
|
22
|
-
word-wrap: normal;
|
|
23
|
-
line-height: 1.5;
|
|
24
|
-
|
|
25
|
-
-moz-tab-size: 4;
|
|
26
|
-
-o-tab-size: 4;
|
|
27
|
-
tab-size: 4;
|
|
28
|
-
|
|
29
|
-
-webkit-hyphens: none;
|
|
30
|
-
-moz-hyphens: none;
|
|
31
|
-
-ms-hyphens: none;
|
|
32
|
-
hyphens: none;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
pre[class*="language-"]::-moz-selection, pre[class*="language-"] ::-moz-selection,
|
|
36
|
-
code[class*="language-"]::-moz-selection, code[class*="language-"] ::-moz-selection {
|
|
37
|
-
text-shadow: none;
|
|
38
|
-
background: #b3d4fc;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
pre[class*="language-"]::selection, pre[class*="language-"] ::selection,
|
|
42
|
-
code[class*="language-"]::selection, code[class*="language-"] ::selection {
|
|
43
|
-
text-shadow: none;
|
|
44
|
-
background: #b3d4fc;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
@media print {
|
|
48
|
-
code[class*="language-"],
|
|
49
|
-
pre[class*="language-"] {
|
|
50
|
-
text-shadow: none;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
/* Code blocks */
|
|
55
|
-
pre[class*="language-"] {
|
|
56
|
-
padding: 1em;
|
|
57
|
-
margin: .5em 0;
|
|
58
|
-
overflow: auto;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
:not(pre) > code[class*="language-"],
|
|
62
|
-
pre[class*="language-"] {
|
|
63
|
-
background: #f5f2f0;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
/* Inline code */
|
|
67
|
-
:not(pre) > code[class*="language-"] {
|
|
68
|
-
padding: .1em;
|
|
69
|
-
border-radius: .3em;
|
|
70
|
-
white-space: normal;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
.token.comment,
|
|
74
|
-
.token.prolog,
|
|
75
|
-
.token.doctype,
|
|
76
|
-
.token.cdata {
|
|
77
|
-
color: slategray;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
.token.punctuation {
|
|
81
|
-
color: #999;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
.namespace {
|
|
85
|
-
opacity: .7;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
.token.property,
|
|
89
|
-
.token.tag,
|
|
90
|
-
.token.boolean,
|
|
91
|
-
.token.number,
|
|
92
|
-
.token.constant,
|
|
93
|
-
.token.symbol,
|
|
94
|
-
.token.deleted {
|
|
95
|
-
color: #905;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
.token.selector,
|
|
99
|
-
.token.attr-name,
|
|
100
|
-
.token.string,
|
|
101
|
-
.token.char,
|
|
102
|
-
.token.builtin,
|
|
103
|
-
.token.inserted {
|
|
104
|
-
color: #690;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
.token.operator,
|
|
108
|
-
.token.entity,
|
|
109
|
-
.token.url,
|
|
110
|
-
.language-css .token.string,
|
|
111
|
-
.style .token.string {
|
|
112
|
-
color: #9a6e3a;
|
|
113
|
-
background: hsla(0, 0%, 100%, .5);
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
.token.atrule,
|
|
117
|
-
.token.attr-value,
|
|
118
|
-
.token.keyword {
|
|
119
|
-
color: #07a;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
.token.function,
|
|
123
|
-
.token.class-name {
|
|
124
|
-
color: #DD4A68;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
.token.regex,
|
|
128
|
-
.token.important,
|
|
129
|
-
.token.variable {
|
|
130
|
-
color: #e90;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
.token.important,
|
|
134
|
-
.token.bold {
|
|
135
|
-
font-weight: bold;
|
|
136
|
-
}
|
|
137
|
-
.token.italic {
|
|
138
|
-
font-style: italic;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
.token.entity {
|
|
142
|
-
cursor: help;
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
/* TODO-被组件的样式影响了,组件的样式也是全局模式 */
|
|
146
|
-
code[class*="language-"] {
|
|
147
|
-
.tag {
|
|
148
|
-
padding: 0;
|
|
149
|
-
margin-right: 0;
|
|
150
|
-
border: none;
|
|
151
|
-
cursor: text;
|
|
152
|
-
|
|
153
|
-
&:hover {
|
|
154
|
-
background: none;
|
|
155
|
-
border: none;
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1561270214571" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="14250" xmlns:xlink="http://www.w3.org/1999/xlink" width="128" height="128"><defs><style type="text/css"></style></defs><path d="M697.158047 947.930487c-11.778254 0-21.309328-9.531074-21.309328-21.309328L675.848719 729.8404c0-11.778254 9.531074-21.309328 21.309328-21.309328l185.189769 0c11.778254 0 21.309328 9.531074 21.309328 21.309328 0 11.778254-9.531074 21.309328-21.309328 21.309328L718.467375 751.149728l0 175.47143C718.467375 938.399413 708.936301 947.930487 697.158047 947.930487z" p-id="14251" fill="#409eff"></path><path d="M470.203058 728.445634c-1.477654 0-2.975774-0.145309-4.495384-0.478907-11.508102-2.455935-18.832927-13.797237-16.356526-25.305339l83.615373-390.273634c2.476401-11.487635 13.672394-18.937305 25.305339-16.356526 11.508102 2.455935 18.832927 13.797237 16.356526 25.305339L491.013013 711.6102C488.869187 721.599715 480.024751 728.445634 470.203058 728.445634z" p-id="14252" fill="#409eff"></path><path d="M642.281205 665.204287c-4.827959 0-9.697873-1.644453-13.69286-4.994758-9.011234-7.574512-10.175757-21.018709-2.601244-30.02892L737.612411 497.411747l-120.407324-100.970646c-9.011234-7.574512-10.197246-21.018709-2.6432-30.02892 7.574512-9.011234 20.99722-10.175757 30.02892-2.6432l136.743384 114.684996c4.328585 3.641947 7.054673 8.844435 7.53358 14.483876 0.499373 5.63944-1.269923 11.237949-4.910846 15.565511L658.617265 657.608286C654.393058 662.623509 648.358621 665.204287 642.281205 665.204287z" p-id="14253" fill="#409eff"></path><path d="M395.2029 666.432255c-4.807493 0-9.635451-1.622964-13.630439-4.932336l-138.88721-115.76663c-4.349051-3.641947-7.075139-8.864902-7.574512-14.525831s1.290389-11.278881 4.952802-15.607466l127.295198-150.4782c7.616468-9.011234 21.039175-10.134825 30.02892-2.518357 8.989745 7.596002 10.113335 21.059642 2.518357 30.02892L286.470477 526.733563l122.404818 102.011348c9.031701 7.554046 10.259668 20.976754 2.726088 30.02892C407.377174 663.831011 401.321248 666.432255 395.2029 666.432255z" p-id="14254" fill="#409eff"></path><path d="M680.031994 959.50101l-465.201138 0c-58.57507 0-106.058524-47.484478-106.058524-106.058524L108.772332 170.557514c0-58.57507 47.484478-106.058524 106.058524-106.058524l594.337263 0c58.57507 0 106.058524 47.484478 106.058524 106.058524l0 550.749536c0 27.298739-10.525728 53.547567-29.386284 73.28305l-23.179932 24.255427c-19.748786 20.705578-19.748786 20.705578-42.36897 43.576471-12.393261 12.494569-31.589462 31.875988-64.640206 65.383126C735.721341 948.011328 708.413392 959.50101 680.031994 959.50101zM236.141208 916.88133l434.977789 0c22.670326 0 44.491307-9.18008 60.415998-25.315572 29.308513-29.697369 46.88175-47.439452 58.458413-59.131749 22.350031-22.557762 22.350031-22.557762 41.828664-42.99421l17.323551-18.137079c15.059997-15.767102 23.464411-36.732599 23.464411-58.537208L872.610034 191.866842c0-46.806026-37.943171-84.749196-84.749196-84.749196L236.141208 107.117646c-46.806026 0-84.749196 37.943171-84.749196 84.749196l0 640.265292C151.390989 878.93816 189.335183 916.88133 236.141208 916.88133z" p-id="14255" fill="#409eff"></path></svg>
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import classnames from 'classnames';
|
|
3
|
-
import PropTypes from 'prop-types';
|
|
4
|
-
import codeIcon from './assets/code.svg';
|
|
5
|
-
|
|
6
|
-
import classes from './index.less';
|
|
7
|
-
|
|
8
|
-
const CSS_SELECTOR = /[^{}]+\{[^}]*\}/gi;
|
|
9
|
-
const STYLE_TYPE = 'text/css';
|
|
10
|
-
|
|
11
|
-
class CodeBox extends React.Component {
|
|
12
|
-
static propTypes = {
|
|
13
|
-
title: PropTypes.string,
|
|
14
|
-
desc: PropTypes.string,
|
|
15
|
-
code: PropTypes.string,
|
|
16
|
-
css: PropTypes.string,
|
|
17
|
-
children: PropTypes.node
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
static defaultProps = {
|
|
21
|
-
title: '标题',
|
|
22
|
-
desc: '描述',
|
|
23
|
-
code: '',
|
|
24
|
-
css: '',
|
|
25
|
-
children: ''
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
constructor(props) {
|
|
29
|
-
super(props);
|
|
30
|
-
|
|
31
|
-
this.codeBlock = React.createRef();
|
|
32
|
-
|
|
33
|
-
const selectors = props.css.match(CSS_SELECTOR);
|
|
34
|
-
|
|
35
|
-
// TODO - 如果创建过一次,下次就不应该再创建,需要优化
|
|
36
|
-
if (selectors) {
|
|
37
|
-
this.styleEle = document.createElement('style');
|
|
38
|
-
this.styleEle.type = STYLE_TYPE;
|
|
39
|
-
this.styleEle.innerText = selectors.map(v => `.${classes.codeBoxDemo} ${v}`).join('\n');
|
|
40
|
-
|
|
41
|
-
document.head.appendChild(this.styleEle);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
state = {
|
|
46
|
-
expand: false
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
componentDidMount() {
|
|
50
|
-
const { current } = this.codeBlock;
|
|
51
|
-
|
|
52
|
-
window.requestAnimationFrame(() => {
|
|
53
|
-
window.Prism.highlightElement(current.children[0]);
|
|
54
|
-
})
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
componentWillUnmount() {
|
|
58
|
-
if (this.styleEle) {
|
|
59
|
-
document.head.removeChild(this.styleEle);
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
onToggle = () => {
|
|
64
|
-
const { expand } = this.state;
|
|
65
|
-
this.setState({ expand: !expand });
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
render() {
|
|
69
|
-
const { expand } = this.state;
|
|
70
|
-
const { title, desc, code, children } = this.props;
|
|
71
|
-
|
|
72
|
-
return (
|
|
73
|
-
<section className={classes.codeBox}>
|
|
74
|
-
<h4 className={classes.codeBoxTitle}>
|
|
75
|
-
{title}
|
|
76
|
-
<span className={classes.codeBoxDesc}>{desc}</span>
|
|
77
|
-
</h4>
|
|
78
|
-
<div className={classes.codeBoxDemo}>{children}</div>
|
|
79
|
-
<div
|
|
80
|
-
className={classnames({
|
|
81
|
-
[classes.codeBoxActions]: true,
|
|
82
|
-
[classes.expand]: expand
|
|
83
|
-
})}
|
|
84
|
-
onClick={this.onToggle}
|
|
85
|
-
role="presentation"
|
|
86
|
-
>
|
|
87
|
-
<span className={classes.icon}>
|
|
88
|
-
<img src={codeIcon} alt="代码" />
|
|
89
|
-
<span className={classes.iconDesc}>
|
|
90
|
-
{expand ? '隐藏代码' : '显示代码'}
|
|
91
|
-
</span>
|
|
92
|
-
</span>
|
|
93
|
-
</div>
|
|
94
|
-
|
|
95
|
-
<pre ref={this.codeBlock} className={classnames({
|
|
96
|
-
[classes.codeBlock]: true,
|
|
97
|
-
[classes.hidden]: !expand
|
|
98
|
-
})}>
|
|
99
|
-
<code dangerouslySetInnerHTML={{ __html: code }} className="language-jsx" />
|
|
100
|
-
</pre>
|
|
101
|
-
</section>
|
|
102
|
-
);
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
export default CodeBox;
|