Skip to content
This repository was archived by the owner on Feb 13, 2024. It is now read-only.

Commit 423465f

Browse files
committed
docs(update doc):
1 parent 5fa4587 commit 423465f

File tree

16 files changed

+9053
-19871
lines changed

16 files changed

+9053
-19871
lines changed

ghpages/docs/ast/source/config/configMgr.js.json

Lines changed: 1034 additions & 8590 deletions
Large diffs are not rendered by default.

ghpages/docs/ast/source/config/configValidater.js.json

Lines changed: 0 additions & 10759 deletions
This file was deleted.

ghpages/docs/ast/source/config/defaultConfig.js.json

Lines changed: 7622 additions & 0 deletions
Large diffs are not rendered by default.

ghpages/docs/coverage.json

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"coverage": "20%",
3-
"expectCount": 320,
2+
"coverage": "20.18%",
3+
"expectCount": 317,
44
"actualCount": 64,
55
"files": {
66
"src/cDefine.js": {
@@ -78,19 +78,14 @@
7878
]
7979
},
8080
"src/config/configMgr.js": {
81-
"expectCount": 3,
81+
"expectCount": 2,
8282
"actualCount": 2,
83-
"undocumentLines": [
84-
68
85-
]
83+
"undocumentLines": []
8684
},
87-
"src/config/configValidater.js": {
88-
"expectCount": 3,
85+
"src/config/defaultConfig.js": {
86+
"expectCount": 1,
8987
"actualCount": 1,
90-
"undocumentLines": [
91-
13,
92-
65
93-
]
88+
"undocumentLines": []
9489
},
9590
"src/elementMgr.js": {
9691
"expectCount": 3,

ghpages/docs/file/src/config/configMgr.js.html

Lines changed: 1 addition & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -71,56 +71,14 @@
7171
'use strict';
7272

7373
import _ from 'lodash';
74+
import defaultConfig from './defaultConfig';
7475

7576
/**
7677
* The container of current configs
7778
* @type {Object}
7879
*/
7980

8081
let currConfig = {};
81-
/**
82-
* Default settings for defaulter
83-
* @type {Object}
84-
*/
85-
86-
const defaultConfig = {
87-
model: {
88-
jsonPath: 'https://unpkg.com/live2d-widget-model-shizuku@latest/assets/shizuku.model.json',
89-
scale: 1,
90-
hHeadPos: 0.5,
91-
vHeadPos: 0.618,
92-
myDefine: [],
93-
},
94-
display: {
95-
superSample: 2,
96-
width: 150,
97-
height: 300,
98-
position: 'right',
99-
hOffset: 0,
100-
vOffset: -20,
101-
},
102-
mobile: {
103-
show: true,
104-
scale: 0.5,
105-
motion: true,
106-
},
107-
name: {
108-
canvas: 'live2dcanvas',
109-
div: 'live2d-widget',
110-
},
111-
react: {
112-
opacityDefault: 0.7,
113-
opacityOnHover: 0.2,
114-
myFunc: (e) => {console.log('(undefined) ┑( ̄Д  ̄)┍');},
115-
},
116-
dev: {
117-
log: false,
118-
border: (process.env.NODE_ENV === 'development' ? true : false),
119-
mouseLog: false,
120-
mouseFunc: (x, y, ix, iy) => {console.log(`MouseFunc: ${x},${y}; ${ix}, ${iy}`);},
121-
},
122-
// _: true,
123-
}
12482

12583
/**
12684
* Apply users function, make the full settings
@@ -130,14 +88,6 @@
13088

13189
function configApplyer(userConfig){
13290

133-
// if (_.has(userConfig, '_')){
134-
// import(/* webpackMode: "lazy" */ './configValidater').then(f => {
135-
// f.configValidater(userConfig);
136-
// }).catch(err => {
137-
// console.error(err);
138-
// });
139-
// }
140-
14191
currConfig = _.defaultsDeep(userConfig, defaultConfig);
14292
// console.log('Live2Dwidget: currConfig', currConfig);
14393

ghpages/docs/file/src/config/configValidater.js.html renamed to ghpages/docs/file/src/config/defaultConfig.js.html

Lines changed: 42 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<head>
44
<meta charset="utf-8">
55
<base data-ice="baseUrl" href="../../../">
6-
<title data-ice="title">src/config/configValidater.js | live2d-widget.js</title>
6+
<title data-ice="title">src/config/defaultConfig.js | live2d-widget.js</title>
77
<link type="text/css" rel="stylesheet" href="css/style.css">
88
<link type="text/css" rel="stylesheet" href="css/prettify-tomorrow.css">
99
<script src="script/prettify/prettify.js"></script>
@@ -60,80 +60,55 @@
6060
</div>
6161
</nav>
6262

63-
<div class="content" data-ice="content"><h1 data-ice="title">src/config/configValidater.js</h1>
64-
<pre class="source-code line-number raw-source-code"><code class="prettyprint linenums" data-ice="content">// Created by xiazeyu.
65-
66-
/**
67-
* @description The validater function for user&apos;s config.
68-
* @deprecated Only respond one time when you call it, won&apos;t be built in production.
69-
* @requires prop-types, use npm i prop-types
63+
<div class="content" data-ice="content"><h1 data-ice="title">src/config/defaultConfig.js</h1>
64+
<pre class="source-code line-number raw-source-code"><code class="prettyprint linenums" data-ice="content">/**
65+
* @description The storage of configs. Intend to unify serverJs and clientJs&apos;s config
7066
*/
7167

72-
73-
&apos;use strict&apos;;
74-
75-
76-
let PropTypes = require(&apos;prop-types&apos;);
7768
/**
78-
* The propTypes configeration of config
69+
* Default settings for defaulter
7970
* @type {Object}
8071
*/
8172

82-
const configPropTypes = {
83-
model: PropTypes.shape({
84-
jsonPath: PropTypes.string,
85-
hHeadPos: PropTypes.number,
86-
vHeadPos: PropTypes.number,
87-
myDefine: PropTypes.array,
88-
}),
89-
display: PropTypes.shape({
90-
superSample: PropTypes.number,
91-
width: PropTypes.number,
92-
height: PropTypes.number,
93-
scale: PropTypes.number,
94-
position: PropTypes.oneOf([&apos;left&apos;, &apos;right&apos;]),
95-
hOffset: PropTypes.number,
96-
vOffset: PropTypes.number,
97-
}),
98-
mobile: PropTypes.shape({
99-
show: PropTypes.bool,
100-
scale: PropTypes.number,
101-
motion: PropTypes.bool,
102-
}),
103-
name: PropTypes.shape({
104-
canvas: PropTypes.string,
105-
div: PropTypes.string,
106-
}),
107-
react: PropTypes.shape({
108-
opacityDefault: PropTypes.number,
109-
opacityOnHover: PropTypes.number,
110-
myFunc: PropTypes.func,
111-
}),
112-
dev: PropTypes.shape({
113-
log: PropTypes.bool,
114-
border: PropTypes.bool,
115-
mouseLog: PropTypes.bool,
116-
mouseFunc: PropTypes.func,
117-
}),
118-
}
119-
/**
120-
* The validater for user config
121-
* See https://github.com/facebook/prop-types
122-
* @param {Object} [userConfig] User&apos;s config
123-
* @description Only console.warn
124-
* @deprecated Only respond one time when you call it, won&apos;t be built in production.
125-
* @return {null}
126-
*/
127-
128-
function configValidater(userConfig){
129-
PropTypes.checkPropTypes(configPropTypes, userConfig, &apos;config&apos;, &apos;Live2D-widget&apos;);
73+
const defaultConfig = {
74+
model: {
75+
jsonPath: &apos;https://unpkg.com/live2d-widget-model-shizuku@latest/assets/shizuku.model.json&apos;,
76+
scale: 1,
77+
hHeadPos: 0.5,
78+
vHeadPos: 0.618,
79+
myDefine: [],
80+
},
81+
display: {
82+
superSample: 2,
83+
width: 150,
84+
height: 300,
85+
position: &apos;right&apos;,
86+
hOffset: 0,
87+
vOffset: -20,
88+
},
89+
mobile: {
90+
show: true,
91+
scale: 0.5,
92+
motion: true,
93+
},
94+
name: {
95+
canvas: &apos;live2dcanvas&apos;,
96+
div: &apos;live2d-widget&apos;,
97+
},
98+
react: {
99+
opacityDefault: 0.7,
100+
opacityOnHover: 0.2,
101+
myFunc: (e) =&gt; {console.log(&apos;(undefined) &#x2511;(&#xFFE3;&#x414; &#xFFE3;)&#x250D;&apos;);},
102+
},
103+
dev: {
104+
log: false,
105+
border: (process.env.NODE_ENV === &apos;development&apos; ? true : false),
106+
mouseLog: false,
107+
mouseFunc: (x, y, ix, iy) =&gt; {console.log(`MouseFunc: ${x},${y}; ${ix}, ${iy}`);},
108+
},
130109
}
131110

132-
if (process.env.NODE_ENV === &apos;development&apos;) window.cV = configValidater;
133-
134-
module.exports = {
135-
configValidater: configValidater,
136-
}
111+
module.exports = defaultConfig;
137112
</code></pre>
138113

139114
</div>

ghpages/docs/function/index.html

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -643,13 +643,14 @@
643643

644644

645645

646-
<span class="code" data-ice="name"><span><a href="function/index.html#static-function-configApplyer">configApplyer</a></span></span><span class="code" data-ice="signature">(userConfig: <span>*</span>)</span>
646+
<span class="code" data-ice="name"><span><a href="function/index.html#static-function-configApplyer">configApplyer</a></span></span><span class="code" data-ice="signature">(userConfig: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a></span>): <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/null">null</a></span></span>
647647
</p>
648648
</div>
649649
<div>
650650

651651

652-
652+
<div data-ice="description"><p>Apply users function, make the full settings</p>
653+
</div>
653654
</div>
654655
</td>
655656
<td>
@@ -1764,18 +1765,19 @@ <h3 data-ice="anchor" id="static-function-configApplyer">
17641765

17651766

17661767

1767-
<span class="code" data-ice="name">configApplyer</span><span class="code" data-ice="signature">(userConfig: <span>*</span>)</span>
1768+
<span class="code" data-ice="name">configApplyer</span><span class="code" data-ice="signature">(userConfig: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a></span>): <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/null">null</a></span></span>
17681769
<span class="right-info">
17691770

17701771

1771-
<span data-ice="source"><span><a href="file/src/config/configMgr.js.html#lineNumber68">source</a></span></span>
1772+
<span data-ice="source"><span><a href="file/src/config/configMgr.js.html#lineNumber26">source</a></span></span>
17721773
</span>
17731774
</h3>
17741775

1775-
<div data-ice="importPath" class="import-path"><pre class="prettyprint"><code data-ice="importPathCode">import {configApplyer} from &apos;<span><a href="file/src/config/configMgr.js.html#lineNumber68">live2d-widget/src/config/configMgr.js</a></span>&apos;</code></pre></div>
1776-
1776+
<div data-ice="importPath" class="import-path"><pre class="prettyprint"><code data-ice="importPathCode">import {configApplyer} from &apos;<span><a href="file/src/config/configMgr.js.html#lineNumber26">live2d-widget/src/config/configMgr.js</a></span>&apos;</code></pre></div>
17771777

17781778

1779+
<div data-ice="description"><p>Apply users function, make the full settings</p>
1780+
</div>
17791781

17801782

17811783

@@ -1789,16 +1791,29 @@ <h4 data-ice="title">Params:</h4>
17891791

17901792
<tr data-ice="property" data-depth="0">
17911793
<td data-ice="name" class="code" data-depth="0">userConfig</td>
1792-
<td data-ice="type" class="code"><span>*</span></td>
1793-
<td data-ice="appendix"></td>
1794-
<td data-ice="description"></td>
1794+
<td data-ice="type" class="code"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a></span></td>
1795+
<td data-ice="appendix"><ul><li>optional</li></ul></td>
1796+
<td data-ice="description"><p>User&apos;s custom config</p>
1797+
</td>
17951798
</tr>
17961799
</tbody>
17971800
</table>
17981801
</div>
17991802
</div>
18001803

1801-
1804+
<div class="return-params" data-ice="returnParams">
1805+
<h4>Return:</h4>
1806+
<table>
1807+
<tbody>
1808+
<tr>
1809+
<td class="return-type code" data-ice="returnType"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/null">null</a></span></td>
1810+
1811+
</tr>
1812+
</tbody>
1813+
</table>
1814+
<div data-ice="returnProperties">
1815+
</div>
1816+
</div>
18021817

18031818

18041819

ghpages/docs/identifiers.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -383,13 +383,14 @@ <h2 data-ice="dirPath" id="config">config</h2>
383383
<span data-ice="kind-icon" class="kind-function">F</span>
384384

385385

386-
<span class="code" data-ice="name"><span><a href="function/index.html#static-function-configApplyer">configApplyer</a></span></span><span class="code" data-ice="signature">(userConfig: <span>*</span>)</span>
386+
<span class="code" data-ice="name"><span><a href="function/index.html#static-function-configApplyer">configApplyer</a></span></span><span class="code" data-ice="signature">(userConfig: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a></span>): <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/null">null</a></span></span>
387387
</p>
388388
</div>
389389
<div>
390390

391391

392-
392+
<div data-ice="description"><p>Apply users function, make the full settings</p>
393+
</div>
393394
</div>
394395
</td>
395396
<td>

0 commit comments

Comments
 (0)