feat: npm 构建

This commit is contained in:
tackchen 2020-12-17 18:10:19 +08:00
parent d862406707
commit 86949db8fd
77 changed files with 189 additions and 183 deletions

View File

@ -186,7 +186,7 @@ import cnchar from 'cnchar';
16. 提供汉字工具方法,方便开发者更便捷高效地 **操作拼音和汉字** 16. 提供汉字工具方法,方便开发者更便捷高效地 **操作拼音和汉字**
17. **体积小**min 版本仅 46 kbzip 版本 34 kb (含有大量汉字拼音字典) 17. **体积小**min 版本仅 46 kbzip 版本 34 kb (含有大量汉字拼音字典)
18. **多端可用**,可用于 **浏览器、nodejs、小程序/小游戏、ReactNative/Weex/Uniapp/Electron、webpack**...,支持所有 js 能运行的环境 18. **多端可用**,可用于 **浏览器、nodejs、小程序/小游戏、ReactNative/Weex/Uniapp/Electron、webpack**...,支持所有 js 能运行的环境
19. **typescript支持**支持在typescript中调用 19. **typescript**主库及所有插件库均使用typescript开发
20. 丰富的配置按功能拆分成7个库按需取用 20. 丰富的配置按功能拆分成7个库按需取用
21. 支持**自定义**拼音笔画等数据,使用更灵活 21. 支持**自定义**拼音笔画等数据,使用更灵活

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -76,7 +76,7 @@
Gitee地址 Gitee地址
<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></li><li class="dropdown-item"><!----> <a href="https://blog.csdn.net/yanxiaomu" target="_blank" rel="noopener noreferrer" class="nav-link external"> <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></li><li class="dropdown-item"><!----> <a href="https://blog.csdn.net/yanxiaomu" target="_blank" rel="noopener noreferrer" class="nav-link external">
CSDN账号 CSDN账号
<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></li></ul></div></div> <!----></nav> <!----> </aside> <main class="page"> <div class="theme-default-content content__default"><div><div class="home-wrapper"><div><img src="/cnchar/assets/img/logo.6cd28633.png" alt srcset class="logo"></div> <div class="title">cnchar</div> <div class="desc">js</div> <div class="test"><div class="test-input el-input"><!----><input type="text" autocomplete="off" placeholder="" class="el-input__inner"><!----><!----><!----><!----></div> <div class="show-area" style="display:none;"><div> <span class="split">|</span> </div> <div>: <span class="split">|</span> : </div> <div>: </div> <div id="draw-area"></div></div></div> <div class="start-w"><button type="button" class="el-button el-button--primary"><!----><!----><span> <i class="ei-location-arrow"></i></span></button> <button type="button" class="el-button el-button--primary"><!----><!----><span> <i class="ei-play"></i></span></button></div> <div class="feature-w"><div class="f-i"><div class="f-t"><i class="ei-rocket"></i></div> <div class="f-des">/</div> <div class="f-des"></div> <div class="f-des">/</div> <div class="f-des">/</div> <div class="f-des"></div> <div class="f-des">/</div> <div class="f-des">...</div></div> <div class="f-i"><div class="f-t"><i class="ei-tablet"></i></div> <div class="f-des"></div> <div class="f-des">nodejs</div> <div class="f-des">/</div> <div class="f-des">ReactNative/Weex/Uniapp/Electron</div> <div class="f-des">webpack</div> <div class="f-des">typescript</div> <div class="f-des">...</div></div> <div class="f-i"><div class="f-t"><i class="ei-cubes"></i></div> <div class="f-des"></div> <div class="f-des"></div> <div class="f-des"></div> <div class="f-des"></div> <div class="f-des">npm</div> <div class="f-des">cdn</div> <div class="f-des">...</div></div></div> <div class="copy-right">MIT Licensed | Copyright © 2020 present <a href="https://www.github.com/theajack" target="view_window">theajack</a></div></div></div></div> <footer class="page-edit"><!----> <!----></footer> <!----> </main></div><div class="global-ui"><!----><div></div></div></div> <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></li></ul></div></div> <!----></nav> <!----> </aside> <main class="page"> <div class="theme-default-content content__default"><div><div class="home-wrapper"><div><img src="/cnchar/assets/img/logo.6cd28633.png" alt srcset class="logo"></div> <div class="title">cnchar</div> <div class="desc">js</div> <div class="test"><div class="test-input el-input"><!----><input type="text" autocomplete="off" placeholder="" class="el-input__inner"><!----><!----><!----><!----></div> <div class="show-area" style="display:none;"><div> <span class="split">|</span> </div> <div>: <span class="split">|</span> : </div> <div>: </div> <div id="draw-area"></div></div></div> <div class="start-w"><button type="button" class="el-button el-button--primary"><!----><!----><span> <i class="ei-location-arrow"></i></span></button> <button type="button" class="el-button el-button--primary"><!----><!----><span> <i class="ei-play"></i></span></button></div> <div class="feature-w"><div class="f-i"><div class="f-t"><i class="ei-rocket"></i></div> <div class="f-des">/</div> <div class="f-des"></div> <div class="f-des">/</div> <div class="f-des">/</div> <div class="f-des"></div> <div class="f-des">/</div> <div class="f-des">...</div></div> <div class="f-i"><div class="f-t"><i class="ei-tablet"></i></div> <div class="f-des"></div> <div class="f-des">nodejs</div> <div class="f-des">/</div> <div class="f-des">ReactNative/Weex/Uniapp/Electron</div> <div class="f-des">webpack</div> <div class="f-des">typescript</div> <div class="f-des">...</div></div> <div class="f-i"><div class="f-t"><i class="ei-cubes"></i></div> <div class="f-des"></div> <div class="f-des"></div> <div class="f-des"></div> <div class="f-des"></div> <div class="f-des">npm</div> <div class="f-des">cdn</div> <div class="f-des">...</div></div></div> <div class="copy-right">MIT Licensed | Copyright © 2020 present <a href="https://www.github.com/theajack" target="view_window">theajack</a></div></div></div></div> <footer class="page-edit"><!----> <!----></footer> <!----> </main></div><div class="global-ui"><!----><div></div></div></div>
<script src="/cnchar/assets/js/app.3d5a33c2.js" defer></script><script src="/cnchar/assets/js/2.2bb98858.js" defer></script><script src="/cnchar/assets/js/8.f01c3380.js" defer></script><script src="/cnchar/assets/js/4.dec2fc6b.js" defer></script> <script src="/cnchar/assets/js/app.3d5a33c2.js" defer></script><script src="/cnchar/assets/js/2.2bb98858.js" defer></script><script src="/cnchar/assets/js/8.f01c3380.js" defer></script><script src="/cnchar/assets/js/4.dec2fc6b.js" defer></script>
<script> <script>
var _mtac = {}; var _mtac = {};

View File

@ -91,7 +91,7 @@ Use the script tag to use:
16. Support **Range radicals** query function 16. Support **Range radicals** query function
17. **Small size**, min version is only 46 kb, zip version is 34 kb(contains a large number of Chinese Pinyin dictionaries) 17. **Small size**, min version is only 46 kb, zip version is 34 kb(contains a large number of Chinese Pinyin dictionaries)
18. **Multi-end available**, can be used in**browser, nodejs, applet / mini-game, ReactNative / Weex / Uniapp / Electron, webpack**..., supports all environments where js can run 18. **Multi-end available**, can be used in**browser, nodejs, applet / mini-game, ReactNative / Weex / Uniapp / Electron, webpack**..., supports all environments where js can run
19. **typescript support**, support calling in typescript 19. **typescript**, the main library and all plug-in libraries are developed using typescript
20. Rich configuration, split into 7 libraries according to function 20. Rich configuration, split into 7 libraries according to function
21. Support **custom** pinyin strokes and other data, use more flexible 21. Support **custom** pinyin strokes and other data, use more flexible

View File

@ -97,7 +97,7 @@ import cnchar from 'cnchar';
16. 提供汉字工具方法,方便开发者更便捷高效地 **操作拼音和汉字** 16. 提供汉字工具方法,方便开发者更便捷高效地 **操作拼音和汉字**
17. **体积小**min 版本仅 46 kbzip 版本 34 kb (含有大量汉字拼音字典) 17. **体积小**min 版本仅 46 kbzip 版本 34 kb (含有大量汉字拼音字典)
18. **多端可用**,可用于 **浏览器、nodejs、小程序/小游戏、ReactNative/Weex/Uniapp/Electron、webpack**...,支持所有 js 能运行的环境 18. **多端可用**,可用于 **浏览器、nodejs、小程序/小游戏、ReactNative/Weex/Uniapp/Electron、webpack**...,支持所有 js 能运行的环境
19. **typescript支持**支持在typescript中调用 19. **typescript**主库及所有插件库均使用typescript开发
20. 丰富的配置按功能拆分成7个库按需取用 20. 丰富的配置按功能拆分成7个库按需取用
21. 支持**自定义**拼音笔画等数据,使用更灵活 21. 支持**自定义**拼音笔画等数据,使用更灵活

View File

@ -1,7 +1,6 @@
const gulp = require('gulp'); const gulp = require('gulp');
const rename = require('gulp-rename'); const rename = require('gulp-rename');
const fs = require('fs'); const fs = require('fs');
const util = require('./tool');
const toc = require('gulp-markdown-toc'); const toc = require('gulp-markdown-toc');
const version = require('../package.json').version; const version = require('../package.json').version;
@ -127,14 +126,4 @@ function copyLatest () {
.pipe(gulp.dest('npm/packages/hanzi-util-base')); .pipe(gulp.dest('npm/packages/hanzi-util-base'));
} }
function modMinJs () {
var file = 'npm/disable-devtool.min.js';
util.read(file, (code) => {
util.write(file, code.replace(/[a-z]\){/i, (str) => {
const n = str[0];
return `${str}var _f=${n};${n}=function(){return _f().default};`;
}));
});
}
task(); task();

View File

@ -1,4 +1,8 @@
### 本地运行注意事项 ### 本地运行注意事项
1. 进入 src/cnchar-types 目录 运行 npm link 命令 1. 进入 src/cnchar-types 目录 运行 npm link 命令
2. 进入 src/cnchar 目录 运行 npm link cnchar-types 命令 2. 进入 src/cnchar 目录 运行 npm link cnchar-types 命令
### npm run test
1. npm run test:npm: 需要先build之后测试 npm 包
2. npm run test直接测试 ts 源代码,需要 npm install -g typescript 全局安装ts

View File

@ -125,6 +125,7 @@
6. 歇后语没有查询到默认返回空数组 6. 歇后语没有查询到默认返回空数组
7. 修复小程序下json文件为数组加载不到的问题 7. 修复小程序下json文件为数组加载不到的问题
## 2.2.9 ## 3.0.0
1. 增加 免 和 倘 的默认读音 1. typescript 重写主库及所有插件库使用ts重写
2. 增加 重来 词组 2. 增加 免 和 倘 的默认读音
3. 增加 重来 词组

File diff suppressed because one or more lines are too long

View File

@ -186,7 +186,7 @@ import cnchar from 'cnchar';
16. 提供汉字工具方法,方便开发者更便捷高效地 **操作拼音和汉字** 16. 提供汉字工具方法,方便开发者更便捷高效地 **操作拼音和汉字**
17. **体积小**min 版本仅 46 kbzip 版本 34 kb (含有大量汉字拼音字典) 17. **体积小**min 版本仅 46 kbzip 版本 34 kb (含有大量汉字拼音字典)
18. **多端可用**,可用于 **浏览器、nodejs、小程序/小游戏、ReactNative/Weex/Uniapp/Electron、webpack**...,支持所有 js 能运行的环境 18. **多端可用**,可用于 **浏览器、nodejs、小程序/小游戏、ReactNative/Weex/Uniapp/Electron、webpack**...,支持所有 js 能运行的环境
19. **typescript支持**支持在typescript中调用 19. **typescript**主库及所有插件库均使用typescript开发
20. 丰富的配置按功能拆分成7个库按需取用 20. 丰富的配置按功能拆分成7个库按需取用
21. 支持**自定义**拼音笔画等数据,使用更灵活 21. 支持**自定义**拼音笔画等数据,使用更灵活

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
{ {
"name": "cnchar-all", "name": "cnchar-all",
"version": "2.2.8", "version": "3.0.0",
"description": "功能全面、多端支持的汉字拼音笔画js库支持多音字、繁体字、火星文", "description": "功能全面、多端支持的汉字拼音笔画js库支持多音字、繁体字、火星文",
"main": "cnchar.all.min.js", "main": "cnchar.all.min.js",
"unpkg": "cnchar.all.min.js", "unpkg": "cnchar.all.min.js",
@ -27,6 +27,6 @@
}, },
"homepage": "https://www.theajack.com/cnchar/", "homepage": "https://www.theajack.com/cnchar/",
"dependencies": { "dependencies": {
"cnchar-types": "^2.2.8" "cnchar-types": "^3.0.0"
} }
} }

View File

@ -186,7 +186,7 @@ import cnchar from 'cnchar';
16. 提供汉字工具方法,方便开发者更便捷高效地 **操作拼音和汉字** 16. 提供汉字工具方法,方便开发者更便捷高效地 **操作拼音和汉字**
17. **体积小**min 版本仅 46 kbzip 版本 34 kb (含有大量汉字拼音字典) 17. **体积小**min 版本仅 46 kbzip 版本 34 kb (含有大量汉字拼音字典)
18. **多端可用**,可用于 **浏览器、nodejs、小程序/小游戏、ReactNative/Weex/Uniapp/Electron、webpack**...,支持所有 js 能运行的环境 18. **多端可用**,可用于 **浏览器、nodejs、小程序/小游戏、ReactNative/Weex/Uniapp/Electron、webpack**...,支持所有 js 能运行的环境
19. **typescript支持**支持在typescript中调用 19. **typescript**主库及所有插件库均使用typescript开发
20. 丰富的配置按功能拆分成7个库按需取用 20. 丰富的配置按功能拆分成7个库按需取用
21. 支持**自定义**拼音笔画等数据,使用更灵活 21. 支持**自定义**拼音笔画等数据,使用更灵活

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
{ {
"name": "cnchar", "name": "cnchar",
"version": "2.2.8", "version": "2.2.8-beta2",
"description": "功能全面、多端支持的汉字拼音笔画js库支持多音字、繁体字、火星文", "description": "功能全面、多端支持的汉字拼音笔画js库支持多音字、繁体字、火星文",
"main": "cnchar.min.js", "main": "cnchar.min.js",
"scripts": {}, "scripts": {},
@ -27,6 +27,6 @@
}, },
"homepage": "https://www.theajack.com/cnchar/", "homepage": "https://www.theajack.com/cnchar/",
"dependencies": { "dependencies": {
"cnchar-types": "^2.2.8" "cnchar-types": "^0.0.2"
} }
} }

View File

@ -186,7 +186,7 @@ import cnchar from 'cnchar';
16. 提供汉字工具方法,方便开发者更便捷高效地 **操作拼音和汉字** 16. 提供汉字工具方法,方便开发者更便捷高效地 **操作拼音和汉字**
17. **体积小**min 版本仅 46 kbzip 版本 34 kb (含有大量汉字拼音字典) 17. **体积小**min 版本仅 46 kbzip 版本 34 kb (含有大量汉字拼音字典)
18. **多端可用**,可用于 **浏览器、nodejs、小程序/小游戏、ReactNative/Weex/Uniapp/Electron、webpack**...,支持所有 js 能运行的环境 18. **多端可用**,可用于 **浏览器、nodejs、小程序/小游戏、ReactNative/Weex/Uniapp/Electron、webpack**...,支持所有 js 能运行的环境
19. **typescript支持**支持在typescript中调用 19. **typescript**主库及所有插件库均使用typescript开发
20. 丰富的配置按功能拆分成7个库按需取用 20. 丰富的配置按功能拆分成7个库按需取用
21. 支持**自定义**拼音笔画等数据,使用更灵活 21. 支持**自定义**拼音笔画等数据,使用更灵活

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
{ {
"name": "cnchar-draw", "name": "cnchar-draw",
"version": "2.2.8", "version": "2.2.8-beta2",
"description": "功能全面、多端支持的汉字拼音笔画js库支持多音字、繁体字、火星文", "description": "功能全面、多端支持的汉字拼音笔画js库支持多音字、繁体字、火星文",
"main": "cnchar.draw.min.js", "main": "cnchar.draw.min.js",
"unpkg": "cnchar.draw.min.js", "unpkg": "cnchar.draw.min.js",
@ -27,6 +27,6 @@
}, },
"homepage": "https://www.theajack.com/cnchar/", "homepage": "https://www.theajack.com/cnchar/",
"dependencies": { "dependencies": {
"cnchar-types": "^2.2.8" "cnchar-types": "^0.0.2"
} }
} }

View File

@ -186,7 +186,7 @@ import cnchar from 'cnchar';
16. 提供汉字工具方法,方便开发者更便捷高效地 **操作拼音和汉字** 16. 提供汉字工具方法,方便开发者更便捷高效地 **操作拼音和汉字**
17. **体积小**min 版本仅 46 kbzip 版本 34 kb (含有大量汉字拼音字典) 17. **体积小**min 版本仅 46 kbzip 版本 34 kb (含有大量汉字拼音字典)
18. **多端可用**,可用于 **浏览器、nodejs、小程序/小游戏、ReactNative/Weex/Uniapp/Electron、webpack**...,支持所有 js 能运行的环境 18. **多端可用**,可用于 **浏览器、nodejs、小程序/小游戏、ReactNative/Weex/Uniapp/Electron、webpack**...,支持所有 js 能运行的环境
19. **typescript支持**支持在typescript中调用 19. **typescript**主库及所有插件库均使用typescript开发
20. 丰富的配置按功能拆分成7个库按需取用 20. 丰富的配置按功能拆分成7个库按需取用
21. 支持**自定义**拼音笔画等数据,使用更灵活 21. 支持**自定义**拼音笔画等数据,使用更灵活

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
{ {
"name": "hanzi-util-base", "name": "hanzi-util-base",
"version": "2.2.8", "version": "3.0.0",
"description": "功能全面、多端支持的汉字拼音笔画js库支持多音字、繁体字、火星文", "description": "功能全面、多端支持的汉字拼音笔画js库支持多音字、繁体字、火星文",
"main": "hanzi.base.min.js", "main": "hanzi.base.min.js",
"unpkg": "hanzi.base.min.js", "unpkg": "hanzi.base.min.js",
@ -27,6 +27,6 @@
}, },
"homepage": "https://www.theajack.com/cnchar/", "homepage": "https://www.theajack.com/cnchar/",
"dependencies": { "dependencies": {
"cnchar-types": "^2.2.8" "cnchar-types": "^3.0.0"
} }
} }

View File

@ -186,7 +186,7 @@ import cnchar from 'cnchar';
16. 提供汉字工具方法,方便开发者更便捷高效地 **操作拼音和汉字** 16. 提供汉字工具方法,方便开发者更便捷高效地 **操作拼音和汉字**
17. **体积小**min 版本仅 46 kbzip 版本 34 kb (含有大量汉字拼音字典) 17. **体积小**min 版本仅 46 kbzip 版本 34 kb (含有大量汉字拼音字典)
18. **多端可用**,可用于 **浏览器、nodejs、小程序/小游戏、ReactNative/Weex/Uniapp/Electron、webpack**...,支持所有 js 能运行的环境 18. **多端可用**,可用于 **浏览器、nodejs、小程序/小游戏、ReactNative/Weex/Uniapp/Electron、webpack**...,支持所有 js 能运行的环境
19. **typescript支持**支持在typescript中调用 19. **typescript**主库及所有插件库均使用typescript开发
20. 丰富的配置按功能拆分成7个库按需取用 20. 丰富的配置按功能拆分成7个库按需取用
21. 支持**自定义**拼音笔画等数据,使用更灵活 21. 支持**自定义**拼音笔画等数据,使用更灵活

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
{ {
"name": "hanzi-util", "name": "hanzi-util",
"version": "2.2.8", "version": "3.0.0",
"description": "功能全面、多端支持的汉字拼音笔画js库支持多音字、繁体字、火星文", "description": "功能全面、多端支持的汉字拼音笔画js库支持多音字、繁体字、火星文",
"main": "hanzi.util.min.js", "main": "hanzi.util.min.js",
"unpkg": "hanzi.util.min.js", "unpkg": "hanzi.util.min.js",
@ -27,6 +27,6 @@
}, },
"homepage": "https://www.theajack.com/cnchar/", "homepage": "https://www.theajack.com/cnchar/",
"dependencies": { "dependencies": {
"cnchar-types": "^2.2.8" "cnchar-types": "^3.0.0"
} }
} }

View File

@ -186,7 +186,7 @@ import cnchar from 'cnchar';
16. 提供汉字工具方法,方便开发者更便捷高效地 **操作拼音和汉字** 16. 提供汉字工具方法,方便开发者更便捷高效地 **操作拼音和汉字**
17. **体积小**min 版本仅 46 kbzip 版本 34 kb (含有大量汉字拼音字典) 17. **体积小**min 版本仅 46 kbzip 版本 34 kb (含有大量汉字拼音字典)
18. **多端可用**,可用于 **浏览器、nodejs、小程序/小游戏、ReactNative/Weex/Uniapp/Electron、webpack**...,支持所有 js 能运行的环境 18. **多端可用**,可用于 **浏览器、nodejs、小程序/小游戏、ReactNative/Weex/Uniapp/Electron、webpack**...,支持所有 js 能运行的环境
19. **typescript支持**支持在typescript中调用 19. **typescript**主库及所有插件库均使用typescript开发
20. 丰富的配置按功能拆分成7个库按需取用 20. 丰富的配置按功能拆分成7个库按需取用
21. 支持**自定义**拼音笔画等数据,使用更灵活 21. 支持**自定义**拼音笔画等数据,使用更灵活

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
{ {
"name": "cnchar-idiom", "name": "cnchar-idiom",
"version": "2.2.8", "version": "3.0.0",
"description": "功能全面、多端支持的汉字拼音笔画js库支持多音字、繁体字、火星文", "description": "功能全面、多端支持的汉字拼音笔画js库支持多音字、繁体字、火星文",
"main": "cnchar.idiom.min.js", "main": "cnchar.idiom.min.js",
"unpkg": "cnchar.idiom.min.js", "unpkg": "cnchar.idiom.min.js",
@ -27,6 +27,6 @@
}, },
"homepage": "https://www.theajack.com/cnchar/", "homepage": "https://www.theajack.com/cnchar/",
"dependencies": { "dependencies": {
"cnchar-types": "^2.2.8" "cnchar-types": "^3.0.0"
} }
} }

View File

@ -186,7 +186,7 @@ import cnchar from 'cnchar';
16. 提供汉字工具方法,方便开发者更便捷高效地 **操作拼音和汉字** 16. 提供汉字工具方法,方便开发者更便捷高效地 **操作拼音和汉字**
17. **体积小**min 版本仅 46 kbzip 版本 34 kb (含有大量汉字拼音字典) 17. **体积小**min 版本仅 46 kbzip 版本 34 kb (含有大量汉字拼音字典)
18. **多端可用**,可用于 **浏览器、nodejs、小程序/小游戏、ReactNative/Weex/Uniapp/Electron、webpack**...,支持所有 js 能运行的环境 18. **多端可用**,可用于 **浏览器、nodejs、小程序/小游戏、ReactNative/Weex/Uniapp/Electron、webpack**...,支持所有 js 能运行的环境
19. **typescript支持**支持在typescript中调用 19. **typescript**主库及所有插件库均使用typescript开发
20. 丰富的配置按功能拆分成7个库按需取用 20. 丰富的配置按功能拆分成7个库按需取用
21. 支持**自定义**拼音笔画等数据,使用更灵活 21. 支持**自定义**拼音笔画等数据,使用更灵活

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
{ {
"name": "cnchar-order", "name": "cnchar-order",
"version": "2.2.8", "version": "3.0.0",
"description": "功能全面、多端支持的汉字拼音笔画js库支持多音字、繁体字、火星文", "description": "功能全面、多端支持的汉字拼音笔画js库支持多音字、繁体字、火星文",
"main": "cnchar.order.min.js", "main": "cnchar.order.min.js",
"unpkg": "cnchar.order.min.js", "unpkg": "cnchar.order.min.js",
@ -27,6 +27,6 @@
}, },
"homepage": "https://www.theajack.com/cnchar/", "homepage": "https://www.theajack.com/cnchar/",
"dependencies": { "dependencies": {
"cnchar-types": "^2.2.8" "cnchar-types": "^3.0.0"
} }
} }

View File

@ -186,7 +186,7 @@ import cnchar from 'cnchar';
16. 提供汉字工具方法,方便开发者更便捷高效地 **操作拼音和汉字** 16. 提供汉字工具方法,方便开发者更便捷高效地 **操作拼音和汉字**
17. **体积小**min 版本仅 46 kbzip 版本 34 kb (含有大量汉字拼音字典) 17. **体积小**min 版本仅 46 kbzip 版本 34 kb (含有大量汉字拼音字典)
18. **多端可用**,可用于 **浏览器、nodejs、小程序/小游戏、ReactNative/Weex/Uniapp/Electron、webpack**...,支持所有 js 能运行的环境 18. **多端可用**,可用于 **浏览器、nodejs、小程序/小游戏、ReactNative/Weex/Uniapp/Electron、webpack**...,支持所有 js 能运行的环境
19. **typescript支持**支持在typescript中调用 19. **typescript**主库及所有插件库均使用typescript开发
20. 丰富的配置按功能拆分成7个库按需取用 20. 丰富的配置按功能拆分成7个库按需取用
21. 支持**自定义**拼音笔画等数据,使用更灵活 21. 支持**自定义**拼音笔画等数据,使用更灵活

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
{ {
"name": "cnchar-poly", "name": "cnchar-poly",
"version": "2.2.8", "version": "3.0.0",
"description": "功能全面、多端支持的汉字拼音笔画js库支持多音字、繁体字、火星文", "description": "功能全面、多端支持的汉字拼音笔画js库支持多音字、繁体字、火星文",
"main": "cnchar.poly.min.js", "main": "cnchar.poly.min.js",
"unpkg": "cnchar.poly.min.js", "unpkg": "cnchar.poly.min.js",
@ -27,6 +27,6 @@
}, },
"homepage": "https://www.theajack.com/cnchar/", "homepage": "https://www.theajack.com/cnchar/",
"dependencies": { "dependencies": {
"cnchar-types": "^2.2.8" "cnchar-types": "^3.0.0"
} }
} }

View File

@ -186,7 +186,7 @@ import cnchar from 'cnchar';
16. 提供汉字工具方法,方便开发者更便捷高效地 **操作拼音和汉字** 16. 提供汉字工具方法,方便开发者更便捷高效地 **操作拼音和汉字**
17. **体积小**min 版本仅 46 kbzip 版本 34 kb (含有大量汉字拼音字典) 17. **体积小**min 版本仅 46 kbzip 版本 34 kb (含有大量汉字拼音字典)
18. **多端可用**,可用于 **浏览器、nodejs、小程序/小游戏、ReactNative/Weex/Uniapp/Electron、webpack**...,支持所有 js 能运行的环境 18. **多端可用**,可用于 **浏览器、nodejs、小程序/小游戏、ReactNative/Weex/Uniapp/Electron、webpack**...,支持所有 js 能运行的环境
19. **typescript支持**支持在typescript中调用 19. **typescript**主库及所有插件库均使用typescript开发
20. 丰富的配置按功能拆分成7个库按需取用 20. 丰富的配置按功能拆分成7个库按需取用
21. 支持**自定义**拼音笔画等数据,使用更灵活 21. 支持**自定义**拼音笔画等数据,使用更灵活

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
{ {
"name": "cnchar-radical", "name": "cnchar-radical",
"version": "2.2.8", "version": "3.0.0",
"description": "功能全面、多端支持的汉字拼音笔画js库支持多音字、繁体字、火星文", "description": "功能全面、多端支持的汉字拼音笔画js库支持多音字、繁体字、火星文",
"main": "cnchar.radical.min.js", "main": "cnchar.radical.min.js",
"unpkg": "cnchar.radical.min.js", "unpkg": "cnchar.radical.min.js",
@ -27,6 +27,6 @@
}, },
"homepage": "https://www.theajack.com/cnchar/", "homepage": "https://www.theajack.com/cnchar/",
"dependencies": { "dependencies": {
"cnchar-types": "^2.2.8" "cnchar-types": "^3.0.0"
} }
} }

View File

@ -186,7 +186,7 @@ import cnchar from 'cnchar';
16. 提供汉字工具方法,方便开发者更便捷高效地 **操作拼音和汉字** 16. 提供汉字工具方法,方便开发者更便捷高效地 **操作拼音和汉字**
17. **体积小**min 版本仅 46 kbzip 版本 34 kb (含有大量汉字拼音字典) 17. **体积小**min 版本仅 46 kbzip 版本 34 kb (含有大量汉字拼音字典)
18. **多端可用**,可用于 **浏览器、nodejs、小程序/小游戏、ReactNative/Weex/Uniapp/Electron、webpack**...,支持所有 js 能运行的环境 18. **多端可用**,可用于 **浏览器、nodejs、小程序/小游戏、ReactNative/Weex/Uniapp/Electron、webpack**...,支持所有 js 能运行的环境
19. **typescript支持**支持在typescript中调用 19. **typescript**主库及所有插件库均使用typescript开发
20. 丰富的配置按功能拆分成7个库按需取用 20. 丰富的配置按功能拆分成7个库按需取用
21. 支持**自定义**拼音笔画等数据,使用更灵活 21. 支持**自定义**拼音笔画等数据,使用更灵活

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
{ {
"name": "cnchar-trad", "name": "cnchar-trad",
"version": "2.2.8", "version": "3.0.0",
"description": "功能全面、多端支持的汉字拼音笔画js库支持多音字、繁体字、火星文", "description": "功能全面、多端支持的汉字拼音笔画js库支持多音字、繁体字、火星文",
"main": "cnchar.trad.min.js", "main": "cnchar.trad.min.js",
"unpkg": "cnchar.trad.min.js", "unpkg": "cnchar.trad.min.js",
@ -27,6 +27,6 @@
}, },
"homepage": "https://www.theajack.com/cnchar/", "homepage": "https://www.theajack.com/cnchar/",
"dependencies": { "dependencies": {
"cnchar-types": "^2.2.8" "cnchar-types": "^3.0.0"
} }
} }

View File

@ -186,7 +186,7 @@ import cnchar from 'cnchar';
16. 提供汉字工具方法,方便开发者更便捷高效地 **操作拼音和汉字** 16. 提供汉字工具方法,方便开发者更便捷高效地 **操作拼音和汉字**
17. **体积小**min 版本仅 46 kbzip 版本 34 kb (含有大量汉字拼音字典) 17. **体积小**min 版本仅 46 kbzip 版本 34 kb (含有大量汉字拼音字典)
18. **多端可用**,可用于 **浏览器、nodejs、小程序/小游戏、ReactNative/Weex/Uniapp/Electron、webpack**...,支持所有 js 能运行的环境 18. **多端可用**,可用于 **浏览器、nodejs、小程序/小游戏、ReactNative/Weex/Uniapp/Electron、webpack**...,支持所有 js 能运行的环境
19. **typescript支持**支持在typescript中调用 19. **typescript**主库及所有插件库均使用typescript开发
20. 丰富的配置按功能拆分成7个库按需取用 20. 丰富的配置按功能拆分成7个库按需取用
21. 支持**自定义**拼音笔画等数据,使用更灵活 21. 支持**自定义**拼音笔画等数据,使用更灵活

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
{ {
"name": "cnchar-xhy", "name": "cnchar-xhy",
"version": "2.2.8", "version": "3.0.0",
"description": "功能全面、多端支持的汉字拼音笔画js库支持多音字、繁体字、火星文", "description": "功能全面、多端支持的汉字拼音笔画js库支持多音字、繁体字、火星文",
"main": "cnchar.xhy.min.js", "main": "cnchar.xhy.min.js",
"unpkg": "cnchar.xhy.min.js", "unpkg": "cnchar.xhy.min.js",
@ -27,6 +27,6 @@
}, },
"homepage": "https://www.theajack.com/cnchar/", "homepage": "https://www.theajack.com/cnchar/",
"dependencies": { "dependencies": {
"cnchar-types": "^2.2.8" "cnchar-types": "^3.0.0"
} }
} }

View File

@ -1,6 +1,6 @@
{ {
"name": "cnchar", "name": "cnchar",
"version": "2.2.8", "version": "3.0.0",
"description": "功能全面、多端支持的汉字拼音笔画js库支持多音字、繁体字、火星文", "description": "功能全面、多端支持的汉字拼音笔画js库支持多音字、繁体字、火星文",
"main": "index.html", "main": "index.html",
"author": "theajack <contact@theajack.com>", "author": "theajack <contact@theajack.com>",
@ -33,10 +33,9 @@
"build:npm": "node ./helper/build-npm.js", "build:npm": "node ./helper/build-npm.js",
"start": "webpack-dev-server --open --config webpack-config/dev.js", "start": "webpack-dev-server --open --config webpack-config/dev.js",
"dev": "webpack-dev-server --open --config webpack-config/dev.js", "dev": "webpack-dev-server --open --config webpack-config/dev.js",
"publish": "npm publish npm/cnchar && npm publish npm/order && npm publish npm/poly && npm publish npm/trad && npm publish npm/draw && npm publish npm/idiom && npm publish npm/xhy && npm publish npm/radical && npm publish npm/all && npm publish npm/hanzi-util-base && npm publish npm/hanzi-util", "publish": "npm publish src/cnchar-types && npm publish npm/packages/cnchar && npm publish npm/packages/order && npm publish npm/packages/poly && npm publish npm/packages/trad && npm publish npm/packages/draw && npm publish npm/packages/idiom && npm publish npm/packages/xhy && npm publish npm/packages/radical && npm publish npm/packages/cnchar-all && npm publish npm/packages/hanzi-util-base && npm publish npm/packages/hanzi-util",
"lint": "eslint src --ext js", "lint": "eslint src --ext js",
"test": "node test", "test": "node test npm",
"test:npm": "node test npm",
"dev:docs": "vuepress dev vuepress", "dev:docs": "vuepress dev vuepress",
"build:docs": "bash helper/build-docs.sh", "build:docs": "bash helper/build-docs.sh",
"build:docs-win": "vuepress build vuepress && node ./helper/build-docs.js" "build:docs-win": "vuepress build vuepress && node ./helper/build-docs.js"

View File

@ -33,6 +33,9 @@ import '../src/cnchar/plugin/radical';
console.log(cnchar); console.log(cnchar);
console.log(cnchar.orderToWord(['横', '撇', '捺'], 'array'));
console.log(cnchar.orderToWord(['横', '撇', '捺'], 'start'));
console.log(cnchar.orderToWord(['横', '撇', '捺'], 'start', 'simple'));
// import './plugin/draw' // import './plugin/draw'
// console.log('1',cnchar) // console.log('1',cnchar)
console.log(cnchar.stroke('一个', 'order')); console.log(cnchar.stroke('一个', 'order'));
@ -81,37 +84,37 @@ console.log(cnchar.xhy('上晃下摇', 'fuzzy', 'answer', 'second')); // ['醉
// // 返回数组 // // 返回数组
// console.log(cnchar.radical('你好呀', 'array')); // ["亻", "女", "口"] // console.log(cnchar.radical('你好呀', 'array')); // ["亻", "女", "口"]
// window.keys = Object.keys(spell); // window.keys = Object.keys(spell);
cnchar.draw('你好九', {});
// cncharDraw('你好', { cnchar.draw('你好九', {
// type: cncharDraw.TYPE.NORMAL, type: cnchar.draw.TYPE.STROKE,
// el: '#drawArea', el: '#drawArea',
// style: { style: {
// radicalColor: '#44f', radicalColor: '#44f',
// backgroundColor: '#ccc' backgroundColor: '#ccc'
// }, },
// animation: { animation: {
// animateComplete () { animateComplete () {
// console.log('animateComplete'); console.log('animateComplete');
// }, },
// loopAnimate: true, loopAnimate: true,
// autoAnimate: false, // false 时点击出发animate 只能触发一次 autoAnimate: false, // false 时点击出发animate 只能触发一次
// // stepByStep: false // stepByStep: false
// }, },
// test: { test: {
// onTestStatus (d) { onTestStatus (d: any) {
// console.log(d); console.log(d);
// } }
// } }
// }); });
// cnchar.draw('中国', { cnchar.draw('中国', {
// type: cnchar.draw.TYPE.TEST, type: cnchar.draw.TYPE.TEST,
// style: { style: {
// radicalColor: '#44f', radicalColor: '#44f',
// backgroundColor: '#eee', backgroundColor: '#eee',
// length: 100, length: 100,
// }, },
// }); });
// cnchar.draw('你好', { // cnchar.draw('你好', {
// type: cnchar.draw.TYPE.ANIMATION, // type: cnchar.draw.TYPE.ANIMATION,

View File

@ -34,7 +34,9 @@ export declare type TypeValueObject = {
}; };
export declare interface ISpell {(sentence: string, ...args: Array<SpellArg>): string | Array<any>;} export declare interface ISpell {(sentence: string, ...args: Array<SpellArg>): string | Array<any>;}
declare interface IStroke {(sentence: string, ...args: Array<StrokeArg>): number | Array<any>;} declare interface IStroke {(sentence: string, ...args: Array<StrokeArg>): number | Array<any>;}
export interface ICnChar { export interface ICnChar {
spell: ISpell; spell: ISpell;
stroke: IStroke; stroke: IStroke;
@ -78,6 +80,7 @@ export interface ICnChar {
spell: ISpell; spell: ISpell;
stroke: IStroke; stroke: IStroke;
}; };
} }
declare global { declare global {

View File

@ -1,5 +1,5 @@
{ {
"name": "cnchar-types", "name": "cnchar-types",
"version": "0.0.1", "version": "0.0.2",
"lockfileVersion": 1 "lockfileVersion": 1
} }

View File

@ -1,6 +1,6 @@
{ {
"name": "cnchar-types", "name": "cnchar-types",
"version": "2.2.8", "version": "0.0.2",
"description": "功能全面、多端支持的汉字拼音笔画js库支持多音字、繁体字、火星文", "description": "功能全面、多端支持的汉字拼音笔画js库支持多音字、繁体字、火星文",
"main": "index.js", "main": "index.js",
"scripts": {}, "scripts": {},
@ -24,4 +24,4 @@
"url": "https://github.com/theajack/cnchar/issues" "url": "https://github.com/theajack/cnchar/issues"
}, },
"homepage": "https://www.theajack.com/cnchar/" "homepage": "https://www.theajack.com/cnchar/"
} }

View File

@ -1,8 +1,9 @@
import {IComplete, IWriter} from './index'; import {IComplete, IWriter, IWriterOptionWithoutText} from './index';
import {Json} from '../../main/common'; import {Json} from '../../main/common';
import {ICnChar} from '../../main'; import {ICnChar} from '../../main';
export declare type TDrawType = 'normal' | 'animation' | 'stroke' | 'test'; export declare type TDrawType = 'normal' | 'animation' | 'stroke' | 'test';
export declare type TDrawTypeUpperCase = 'NORMAL' | 'ANIMATION' | 'STROKE' | 'TEST';
export declare type TTestStatusType = 'mistake' | 'correct' | 'complete'; export declare type TTestStatusType = 'mistake' | 'correct' | 'complete';
export declare interface ITestStatusData { export declare interface ITestStatusData {
@ -103,7 +104,7 @@ export declare interface ICloneSvg{
} }
export declare interface IDraw { export declare interface IDraw {
(text: string, options: IDrawOption): IWriter | null; (text: string, options: IWriterOptionWithoutText): IWriter | null;
TYPE: Json<TDrawType>; TYPE: Json<TDrawType>;
TEST_STATUS: Json<TTestStatusType>; TEST_STATUS: Json<TTestStatusType>;
init?(cnchar?: ICnChar): void; init?(cnchar?: ICnChar): void;
@ -115,7 +116,7 @@ declare global {
} }
} }
declare module '../../main/index' { declare module '../../main' {
interface ICnChar { interface ICnChar {
draw: IDraw; draw: IDraw;
} }

View File

@ -13,12 +13,14 @@ export default class HanziWriter {
onMistake (strokeData: ITestStatusData): void; onMistake (strokeData: ITestStatusData): void;
onCorrectStroke (strokeData: ITestStatusData): void; onCorrectStroke (strokeData: ITestStatusData): void;
onComplete (strokeData: ITestStatusData): void; onComplete (strokeData: ITestStatusData): void;
}); }): void;
hideCharacter(): void; hideCharacter(): void;
animateCharacter(option: { animateCharacter(option: {
onComplete(): void; onComplete(): void;
}): void; }): void;
static create(node: Node, text: string, option: IDrawOption): HanziWriter; static create(node: Node, text: string, option: IDrawOption): HanziWriter;
static loadCharacterData(str: string): Promise<ICharData>; static loadCharacterData(str: string): Promise<ICharData>;
static getScalingTransform(width?: number, height?: number, padding?: number); static getScalingTransform(width?: number, height?: number, padding?: number): {
transform: string
};
} }

View File

@ -10,9 +10,8 @@ import {
import HanziWriter from './hanzi-writer'; import HanziWriter from './hanzi-writer';
export declare interface IComplete {(end?: boolean): void;} export declare interface IComplete {(end?: boolean): void;}
export declare interface IWriterOption { export declare interface IWriterOptionWithoutText {
el?: string | HTMLElement; el?: string | HTMLElement;
text?: string;
clear?: boolean; clear?: boolean;
type?: TDrawType; type?: TDrawType;
style?: IDrawStyleOption, style?: IDrawStyleOption,
@ -21,6 +20,9 @@ export declare interface IWriterOption {
stroke?: IDrawStrokeOption, stroke?: IDrawStrokeOption,
test?: IDrawTestOption, test?: IDrawTestOption,
} }
export declare interface IWriterOption extends IWriterOptionWithoutText {
text?: string;
}
export declare interface IWriter { export declare interface IWriter {
option: IDrawOption; option: IDrawOption;
el: HTMLElement; el: HTMLElement;

View File

@ -1,6 +1,6 @@
{ {
"name": "cnchar-all", "name": "cnchar-all",
"version": "2.2.8", "version": "3.0.0",
"description": "功能全面、多端支持的汉字拼音笔画js库支持多音字、繁体字、火星文", "description": "功能全面、多端支持的汉字拼音笔画js库支持多音字、繁体字、火星文",
"main": "cnchar.all.min.js", "main": "cnchar.all.min.js",
"unpkg": "cnchar.all.min.js", "unpkg": "cnchar.all.min.js",
@ -27,6 +27,6 @@
}, },
"homepage": "https://www.theajack.com/cnchar/", "homepage": "https://www.theajack.com/cnchar/",
"dependencies": { "dependencies": {
"cnchar-types": "^2.2.8" "cnchar-types": "^3.0.0"
} }
} }

View File

@ -1,6 +1,6 @@
{ {
"name": "hanzi-util-base", "name": "hanzi-util-base",
"version": "2.2.8", "version": "3.0.0",
"description": "功能全面、多端支持的汉字拼音笔画js库支持多音字、繁体字、火星文", "description": "功能全面、多端支持的汉字拼音笔画js库支持多音字、繁体字、火星文",
"main": "hanzi.base.min.js", "main": "hanzi.base.min.js",
"unpkg": "hanzi.base.min.js", "unpkg": "hanzi.base.min.js",
@ -27,6 +27,6 @@
}, },
"homepage": "https://www.theajack.com/cnchar/", "homepage": "https://www.theajack.com/cnchar/",
"dependencies": { "dependencies": {
"cnchar-types": "^2.2.8" "cnchar-types": "^3.0.0"
} }
} }

View File

@ -1,6 +1,6 @@
{ {
"name": "hanzi-util", "name": "hanzi-util",
"version": "2.2.8", "version": "3.0.0",
"description": "功能全面、多端支持的汉字拼音笔画js库支持多音字、繁体字、火星文", "description": "功能全面、多端支持的汉字拼音笔画js库支持多音字、繁体字、火星文",
"main": "hanzi.util.min.js", "main": "hanzi.util.min.js",
"unpkg": "hanzi.util.min.js", "unpkg": "hanzi.util.min.js",
@ -27,6 +27,6 @@
}, },
"homepage": "https://www.theajack.com/cnchar/", "homepage": "https://www.theajack.com/cnchar/",
"dependencies": { "dependencies": {
"cnchar-types": "^2.2.8" "cnchar-types": "^3.0.0"
} }
} }

View File

@ -1,6 +1,6 @@
{ {
"name": "cnchar", "name": "cnchar",
"version": "2.2.8", "version": "3.0.0",
"description": "功能全面、多端支持的汉字拼音笔画js库支持多音字、繁体字、火星文", "description": "功能全面、多端支持的汉字拼音笔画js库支持多音字、繁体字、火星文",
"main": "cnchar.min.js", "main": "cnchar.min.js",
"scripts": {}, "scripts": {},
@ -27,6 +27,6 @@
}, },
"homepage": "https://www.theajack.com/cnchar/", "homepage": "https://www.theajack.com/cnchar/",
"dependencies": { "dependencies": {
"cnchar-types": "^2.2.8" "cnchar-types": "^3.0.0"
} }
} }

View File

@ -1 +1 @@
export default '2.2.8'; export default '3.0.0';

View File

@ -1,6 +1,6 @@
{ {
"name": "cnchar-draw", "name": "cnchar-draw",
"version": "2.2.8", "version": "3.0.0",
"description": "功能全面、多端支持的汉字拼音笔画js库支持多音字、繁体字、火星文", "description": "功能全面、多端支持的汉字拼音笔画js库支持多音字、繁体字、火星文",
"main": "cnchar.draw.min.js", "main": "cnchar.draw.min.js",
"unpkg": "cnchar.draw.min.js", "unpkg": "cnchar.draw.min.js",
@ -27,6 +27,6 @@
}, },
"homepage": "https://www.theajack.com/cnchar/", "homepage": "https://www.theajack.com/cnchar/",
"dependencies": { "dependencies": {
"cnchar-types": "^2.2.8" "cnchar-types": "^3.0.0"
} }
} }

View File

@ -46,6 +46,7 @@ function renderFanningStrokes ({
const group: SVGGElement = document.createElementNS('http://www.w3.org/2000/svg', 'g'); const group: SVGGElement = document.createElementNS('http://www.w3.org/2000/svg', 'g');
const transformData = HanziWriter.getScalingTransform(width, width, option.padding); const transformData = HanziWriter.getScalingTransform(width, width, option.padding);
console.log(transformData);
group.setAttributeNS(null, 'transform', transformData.transform); group.setAttributeNS(null, 'transform', transformData.transform);
svg.appendChild(group); svg.appendChild(group);
for (let i = 0; i <= current; i++) { for (let i = 0; i <= current; i++) {

View File

@ -204,7 +204,7 @@ export class Writer implements IWriter {
} }
} }
const draw: IDraw = (text: string = '', options: IDrawOption = {}): IWriter | null => { const draw: IDraw = (text: string = '', options: IWriterOption = {}): IWriter | null => {
if (typeof window === 'undefined') { if (typeof window === 'undefined') {
console.error('Draw 方法仅支持在浏览器环境下使用'); console.error('Draw 方法仅支持在浏览器环境下使用');
return null; return null;

View File

@ -1,6 +1,6 @@
{ {
"name": "cnchar-idiom", "name": "cnchar-idiom",
"version": "2.2.8", "version": "3.0.0",
"description": "功能全面、多端支持的汉字拼音笔画js库支持多音字、繁体字、火星文", "description": "功能全面、多端支持的汉字拼音笔画js库支持多音字、繁体字、火星文",
"main": "cnchar.idiom.min.js", "main": "cnchar.idiom.min.js",
"unpkg": "cnchar.idiom.min.js", "unpkg": "cnchar.idiom.min.js",
@ -27,6 +27,6 @@
}, },
"homepage": "https://www.theajack.com/cnchar/", "homepage": "https://www.theajack.com/cnchar/",
"dependencies": { "dependencies": {
"cnchar-types": "^2.2.8" "cnchar-types": "^3.0.0"
} }
} }

View File

@ -25,7 +25,6 @@ const orderToWord = ((
input: string | Array<OrderName>, input: string | Array<OrderName>,
...args: Array<OrderToWordArg> ...args: Array<OrderToWordArg>
): string | Array<string> => { ): string | Array<string> => {
args = args.splice(1);
if (typeof input === 'string') { if (typeof input === 'string') {
input = input.split(' ') as Array<OrderName>; input = input.split(' ') as Array<OrderName>;
} }

View File

@ -1,6 +1,6 @@
{ {
"name": "cnchar-order", "name": "cnchar-order",
"version": "2.2.8", "version": "3.0.0",
"description": "功能全面、多端支持的汉字拼音笔画js库支持多音字、繁体字、火星文", "description": "功能全面、多端支持的汉字拼音笔画js库支持多音字、繁体字、火星文",
"main": "cnchar.order.min.js", "main": "cnchar.order.min.js",
"unpkg": "cnchar.order.min.js", "unpkg": "cnchar.order.min.js",
@ -27,6 +27,6 @@
}, },
"homepage": "https://www.theajack.com/cnchar/", "homepage": "https://www.theajack.com/cnchar/",
"dependencies": { "dependencies": {
"cnchar-types": "^2.2.8" "cnchar-types": "^3.0.0"
} }
} }

View File

@ -1,6 +1,6 @@
{ {
"name": "cnchar-poly", "name": "cnchar-poly",
"version": "2.2.8", "version": "3.0.0",
"description": "功能全面、多端支持的汉字拼音笔画js库支持多音字、繁体字、火星文", "description": "功能全面、多端支持的汉字拼音笔画js库支持多音字、繁体字、火星文",
"main": "cnchar.poly.min.js", "main": "cnchar.poly.min.js",
"unpkg": "cnchar.poly.min.js", "unpkg": "cnchar.poly.min.js",
@ -27,6 +27,6 @@
}, },
"homepage": "https://www.theajack.com/cnchar/", "homepage": "https://www.theajack.com/cnchar/",
"dependencies": { "dependencies": {
"cnchar-types": "^2.2.8" "cnchar-types": "^3.0.0"
} }
} }

View File

@ -1,6 +1,6 @@
{ {
"name": "cnchar-radical", "name": "cnchar-radical",
"version": "2.2.8", "version": "3.0.0",
"description": "功能全面、多端支持的汉字拼音笔画js库支持多音字、繁体字、火星文", "description": "功能全面、多端支持的汉字拼音笔画js库支持多音字、繁体字、火星文",
"main": "cnchar.radical.min.js", "main": "cnchar.radical.min.js",
"unpkg": "cnchar.radical.min.js", "unpkg": "cnchar.radical.min.js",
@ -27,6 +27,6 @@
}, },
"homepage": "https://www.theajack.com/cnchar/", "homepage": "https://www.theajack.com/cnchar/",
"dependencies": { "dependencies": {
"cnchar-types": "^2.2.8" "cnchar-types": "^3.0.0"
} }
} }

View File

@ -1,6 +1,6 @@
{ {
"name": "cnchar-trad", "name": "cnchar-trad",
"version": "2.2.8", "version": "3.0.0",
"description": "功能全面、多端支持的汉字拼音笔画js库支持多音字、繁体字、火星文", "description": "功能全面、多端支持的汉字拼音笔画js库支持多音字、繁体字、火星文",
"main": "cnchar.trad.min.js", "main": "cnchar.trad.min.js",
"unpkg": "cnchar.trad.min.js", "unpkg": "cnchar.trad.min.js",
@ -27,6 +27,6 @@
}, },
"homepage": "https://www.theajack.com/cnchar/", "homepage": "https://www.theajack.com/cnchar/",
"dependencies": { "dependencies": {
"cnchar-types": "^2.2.8" "cnchar-types": "^3.0.0"
} }
} }

View File

@ -1,6 +1,6 @@
{ {
"name": "cnchar-xhy", "name": "cnchar-xhy",
"version": "2.2.8", "version": "3.0.0",
"description": "功能全面、多端支持的汉字拼音笔画js库支持多音字、繁体字、火星文", "description": "功能全面、多端支持的汉字拼音笔画js库支持多音字、繁体字、火星文",
"main": "cnchar.xhy.min.js", "main": "cnchar.xhy.min.js",
"unpkg": "cnchar.xhy.min.js", "unpkg": "cnchar.xhy.min.js",
@ -27,6 +27,6 @@
}, },
"homepage": "https://www.theajack.com/cnchar/", "homepage": "https://www.theajack.com/cnchar/",
"dependencies": { "dependencies": {
"cnchar-types": "^2.2.8" "cnchar-types": "^3.0.0"
} }
} }

View File

@ -1,29 +1,30 @@
let order, trad, poly, idiom, xhy, radical, cnchar; let order, trad, poly, idiom, xhy, radical, cnchar;
if (process.argv[2] === 'npm') { if (process.argv[2] === 'npm') {
cnchar = require('../npm/cnchar'); cnchar = require('../npm/packages/cnchar');
order = require('../npm/order'); order = require('../npm/packages/order');
trad = require('../npm/trad'); trad = require('../npm/packages/trad');
poly = require('../npm/poly'); poly = require('../npm/packages/poly');
idiom = require('../npm/idiom'); idiom = require('../npm/packages/idiom');
xhy = require('../npm/xhy'); xhy = require('../npm/packages/xhy');
radical = require('../npm/radical'); radical = require('../npm/packages/radical');
console.log('****TEST NPM****'); console.log('****TEST NPM****');
} else { } else {
cnchar = require('../src/main/index'); throw new Error('ts 暂不支持node test 请先build之后再测试');
order = require('../src/plugin/order'); // cnchar = require('../src/cnchar/main/index');
trad = require('../src/plugin/trad'); // order = require('../src/cnchar/plugin/order');
poly = require('../src/plugin/poly'); // trad = require('../src/cnchar/plugin/trad');
idiom = require('../src/plugin/idiom'); // poly = require('../src/cnchar/plugin/poly');
xhy = require('../src/plugin/xhy'); // idiom = require('../src/cnchar/plugin/idiom');
radical = require('../src/plugin/radical'); // xhy = require('../src/cnchar/plugin/xhy');
console.log('****TEST SRC****'); // radical = require('../src/cnchar/plugin/radical');
// console.log('****TEST SRC****');
} }
console.log(); console.log();
cnchar.use(order, trad, poly, idiom, xhy, radical); cnchar.use(order, trad, poly, idiom, xhy, radical);
let config = require('./test.config'); const config = require('./test.config');
const startTest = require('./test'); const startTest = require('./test');

View File

@ -7,24 +7,24 @@
// var radical = require('./radical/index'); // var radical = require('./radical/index');
var cnchar = require('../../npm/packages/cnchar/cnchar.min.js'); var cnchar = require('../../npm/packages/cnchar/cnchar.min.js');
// var poly = require('../../npm/packages/poly/cnchar.poly.min.js'); var poly = require('../../npm/packages/poly/cnchar.poly.min.js');
// var order = require('../../npm/packages/order/cnchar.order.min.js'); var order = require('../../npm/packages/order/cnchar.order.min.js');
// var trad = require('../../npm/packages/trad/cnchar.trad.min.js'); var trad = require('../../npm/packages/trad/cnchar.trad.min.js');
// var idiom = require('../../npm/packages/idiom/cnchar.idiom.min.js'); var idiom = require('../../npm/packages/idiom/cnchar.idiom.min.js');
// var xhy = require('../../npm/packages/xhy/cnchar.xhy.min.js'); var xhy = require('../../npm/packages/xhy/cnchar.xhy.min.js');
// var radical = require('../../npm/packages/radical/cnchar.radical.min.js'); var radical = require('../../npm/packages/radical/cnchar.radical.min.js');
// console.log(cnchar); console.log(cnchar.use);
// debugger; // debugger;
// cnchar.use(order, trad, poly, idiom, xhy, radical); cnchar.use(order, trad, poly, idiom, xhy, radical);
// console.log(cnchar.stroke('一个', 'order')); console.log(cnchar.stroke('一个', 'order'));
// console.log(cnchar.stroke('長城', 'count', 'order', 'name')); console.log(cnchar.stroke('長城', 'count', 'order', 'name'));
// console.log(cnchar.orderToWord(['横', '撇', '捺'])); console.log(cnchar.orderToWord(['横', '撇', '捺']));
// console.log('美好的地方'.spell('tone')); console.log('美好的地方'.spell('tone'));
// console.log('长大了'.spell()); console.log('长大了'.spell());
// console.log('长大了'.spell('poly')); console.log('长大了'.spell('poly'));
// console.log(cnchar.strokeToWord(25, 'simple')); console.log(cnchar.strokeToWord(25, 'simple'));
// console.log(cnchar.idiom(['五', '', '十', ''])); console.log(cnchar.idiom(['五', '', '十', '']));
// console.log(cnchar.xhy('大水冲了龙王庙')); console.log(cnchar.xhy('大水冲了龙王庙'));
// console.log(cnchar.radical('你好呀')); console.log(cnchar.radical('你好呀'));
// module.exports = cnchar // module.exports = cnchar

View File

@ -36,7 +36,7 @@
<div class='f-des'>小程序/小游戏</div> <div class='f-des'>小程序/小游戏</div>
<div class='f-des'>ReactNative/Weex/Uniapp/Electron</div> <div class='f-des'>ReactNative/Weex/Uniapp/Electron</div>
<div class='f-des'>webpack</div> <div class='f-des'>webpack</div>
<div class='f-des'>typescript支持</div> <div class='f-des'>typescript开发</div>
<div class='f-des'>...</div> <div class='f-des'>...</div>
</div> </div>
<div class='f-i'> <div class='f-i'>

View File

@ -50,7 +50,7 @@ sidebarDepth: 0 //吐槽这里设置0无效只能设置1或2
16. 提供汉字工具方法,方便开发者更便捷高效地 **操作拼音和汉字** 16. 提供汉字工具方法,方便开发者更便捷高效地 **操作拼音和汉字**
17. **体积小**min 版本仅 46 kbzip 版本 34 kb (含有大量汉字拼音字典) 17. **体积小**min 版本仅 46 kbzip 版本 34 kb (含有大量汉字拼音字典)
18. **多端可用**,可用于 **浏览器、nodejs、小程序/小游戏、ReactNative/Weex/Uniapp/Electron、webpack**...,支持所有 js 能运行的环境 18. **多端可用**,可用于 **浏览器、nodejs、小程序/小游戏、ReactNative/Weex/Uniapp/Electron、webpack**...,支持所有 js 能运行的环境
19. **typescript支持**支持在typescript中调用 19. **typescript开发**主库及所有插件库均使用typescript开发
20. 丰富的配置按功能拆分成7个库按需取用 20. 丰富的配置按功能拆分成7个库按需取用
21. 支持**自定义**拼音笔画等数据,使用更灵活 21. 支持**自定义**拼音笔画等数据,使用更灵活

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -76,7 +76,7 @@
Gitee地址 Gitee地址
<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></li><li class="dropdown-item"><!----> <a href="https://blog.csdn.net/yanxiaomu" target="_blank" rel="noopener noreferrer" class="nav-link external"> <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></li><li class="dropdown-item"><!----> <a href="https://blog.csdn.net/yanxiaomu" target="_blank" rel="noopener noreferrer" class="nav-link external">
CSDN账号 CSDN账号
<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></li></ul></div></div> <!----></nav> <!----> </aside> <main class="page"> <div class="theme-default-content content__default"><div><div class="home-wrapper"><div><img src="/cnchar/v2/assets/img/logo.6cd28633.png" alt srcset class="logo"></div> <div class="title">cnchar</div> <div class="desc">js</div> <div class="test"><div class="test-input el-input"><!----><input type="text" autocomplete="off" placeholder="" class="el-input__inner"><!----><!----><!----><!----></div> <div class="show-area" style="display:none;"><div> <span class="split">|</span> </div> <div>: <span class="split">|</span> : </div> <div>: </div> <div id="draw-area"></div></div></div> <div class="start-w"><button type="button" class="el-button el-button--primary"><!----><!----><span> <i class="ei-location-arrow"></i></span></button> <button type="button" class="el-button el-button--primary"><!----><!----><span> <i class="ei-play"></i></span></button></div> <div class="feature-w"><div class="f-i"><div class="f-t"><i class="ei-rocket"></i></div> <div class="f-des">/</div> <div class="f-des"></div> <div class="f-des">/</div> <div class="f-des">/</div> <div class="f-des"></div> <div class="f-des">/</div> <div class="f-des">...</div></div> <div class="f-i"><div class="f-t"><i class="ei-tablet"></i></div> <div class="f-des"></div> <div class="f-des">nodejs</div> <div class="f-des">/</div> <div class="f-des">ReactNative/Weex/Uniapp/Electron</div> <div class="f-des">webpack</div> <div class="f-des">typescript</div> <div class="f-des">...</div></div> <div class="f-i"><div class="f-t"><i class="ei-cubes"></i></div> <div class="f-des"></div> <div class="f-des"></div> <div class="f-des"></div> <div class="f-des"></div> <div class="f-des">npm</div> <div class="f-des">cdn</div> <div class="f-des">...</div></div></div> <div class="copy-right">MIT Licensed | Copyright © 2020 present <a href="https://www.github.com/theajack" target="view_window">theajack</a></div></div></div></div> <footer class="page-edit"><!----> <div class="last-updated"><span class="prefix">:</span> <span class="time">4/14/2020, 1:02:43 AM</span></div></footer> <!----> </main></div><div class="global-ui"><!----><div></div></div></div> <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></li></ul></div></div> <!----></nav> <!----> </aside> <main class="page"> <div class="theme-default-content content__default"><div><div class="home-wrapper"><div><img src="/cnchar/v2/assets/img/logo.6cd28633.png" alt srcset class="logo"></div> <div class="title">cnchar</div> <div class="desc">js</div> <div class="test"><div class="test-input el-input"><!----><input type="text" autocomplete="off" placeholder="" class="el-input__inner"><!----><!----><!----><!----></div> <div class="show-area" style="display:none;"><div> <span class="split">|</span> </div> <div>: <span class="split">|</span> : </div> <div>: </div> <div id="draw-area"></div></div></div> <div class="start-w"><button type="button" class="el-button el-button--primary"><!----><!----><span> <i class="ei-location-arrow"></i></span></button> <button type="button" class="el-button el-button--primary"><!----><!----><span> <i class="ei-play"></i></span></button></div> <div class="feature-w"><div class="f-i"><div class="f-t"><i class="ei-rocket"></i></div> <div class="f-des">/</div> <div class="f-des"></div> <div class="f-des">/</div> <div class="f-des">/</div> <div class="f-des"></div> <div class="f-des">/</div> <div class="f-des">...</div></div> <div class="f-i"><div class="f-t"><i class="ei-tablet"></i></div> <div class="f-des"></div> <div class="f-des">nodejs</div> <div class="f-des">/</div> <div class="f-des">ReactNative/Weex/Uniapp/Electron</div> <div class="f-des">webpack</div> <div class="f-des">typescript</div> <div class="f-des">...</div></div> <div class="f-i"><div class="f-t"><i class="ei-cubes"></i></div> <div class="f-des"></div> <div class="f-des"></div> <div class="f-des"></div> <div class="f-des"></div> <div class="f-des">npm</div> <div class="f-des">cdn</div> <div class="f-des">...</div></div></div> <div class="copy-right">MIT Licensed | Copyright © 2020 present <a href="https://www.github.com/theajack" target="view_window">theajack</a></div></div></div></div> <footer class="page-edit"><!----> <div class="last-updated"><span class="prefix">:</span> <span class="time">4/14/2020, 1:02:43 AM</span></div></footer> <!----> </main></div><div class="global-ui"><!----><div></div></div></div>
<script src="/cnchar/v2/assets/js/app.c32cd789.js" defer></script><script src="/cnchar/v2/assets/js/2.2bb98858.js" defer></script><script src="/cnchar/v2/assets/js/8.6e193aef.js" defer></script><script src="/cnchar/v2/assets/js/4.e922f897.js" defer></script> <script src="/cnchar/v2/assets/js/app.c32cd789.js" defer></script><script src="/cnchar/v2/assets/js/2.2bb98858.js" defer></script><script src="/cnchar/v2/assets/js/8.6e193aef.js" defer></script><script src="/cnchar/v2/assets/js/4.e922f897.js" defer></script>
<script> <script>
var _mtac = {}; var _mtac = {};

View File

@ -28,8 +28,7 @@ module.exports = {
filename: 'cnchar.min.js', filename: 'cnchar.min.js',
library: 'cnchar', library: 'cnchar',
libraryTarget: 'umd', libraryTarget: 'umd',
// umdNamedDefine: true, globalObject: 'this',
// globalObject: 'this',
libraryExport: 'default', libraryExport: 'default',
}, },
resolve: { resolve: {

View File

@ -23,19 +23,22 @@ const path = require('path');
module.exports = (env) => { module.exports = (env) => {
const plugin = env.pluginname; const plugin = env.pluginname;
let dir = `plugin/${plugin}`; let dir = `plugin/${plugin}`;
let npmDir = plugin;
if (plugin === 'all') { if (plugin === 'all') {
dir = 'alias/cnchar-all'; dir = 'alias/cnchar-all';
npmDir = 'cnchar-all';
} }
return { return {
mode: 'production', mode: 'production',
entry: path.resolve('./', `src/cnchar/${dir}/index.ts`), entry: path.resolve('./', `src/cnchar/${dir}/index.ts`),
output: { output: {
path: path.resolve('./', 'npm/packages/' + plugin), path: path.resolve('./', 'npm/packages/' + npmDir),
filename: 'cnchar.' + plugin + '.min.js', filename: 'cnchar.' + plugin + '.min.js',
library: 'cnchar' + plugin[0].toUpperCase() + plugin.substr(1), library: 'cnchar' + plugin[0].toUpperCase() + plugin.substr(1),
// umdNamedDefine: true,
libraryTarget: 'umd', libraryTarget: 'umd',
umdNamedDefine: true, globalObject: 'this',
globalObject: 'this' libraryExport: 'default',
}, },
resolve: { resolve: {
extensions: [ '.tsx', '.ts', '.js' ] extensions: [ '.tsx', '.ts', '.js' ]