colored-table 0.1.0 → 0.2.0
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/LICENSE +2 -2
- package/README.md +2 -10
- package/{src/build/buildBody.cjs → cjs/build/buildBody.js} +2 -2
- package/{src/build/buildHeader.cjs → cjs/build/buildHeader.js} +2 -2
- package/{src/build/computerMaxLen.cjs → cjs/build/computerMaxLen.js} +1 -1
- package/{src/build/index.cjs → cjs/build/index.js} +4 -4
- package/{src/core.cjs → cjs/core.js} +4 -4
- package/{index.cjs → cjs/index.js} +2 -2
- package/{src/parse/parse.cjs → cjs/parse/parse.js} +5 -5
- package/{src/parse/parseCell.cjs → cjs/parse/parseCell.js} +1 -1
- package/{src/parse/parseRow.cjs → cjs/parse/parseRow.js} +3 -3
- package/{src/proto/createHeaderProto.cjs → cjs/proto/createHeaderProto.js} +1 -1
- package/{src/build/buildBody.mjs → es/build/buildBody.js} +2 -2
- package/{src/build/buildHeader.mjs → es/build/buildHeader.js} +2 -2
- package/{src/build/computerMaxLen.mjs → es/build/computerMaxLen.js} +1 -1
- package/{src/build/index.mjs → es/build/index.js} +4 -4
- package/{src/core.mjs → es/core.js} +4 -4
- package/{index.mjs → es/index.js} +2 -2
- package/{src/parse/parse.mjs → es/parse/parse.js} +5 -5
- package/{src/parse/parseCell.mjs → es/parse/parseCell.js} +1 -1
- package/{src/parse/parseRow.mjs → es/parse/parseRow.js} +3 -3
- package/{src/proto/createHeaderProto.mjs → es/proto/createHeaderProto.js} +1 -1
- package/{index.d.ts → es/src/index.d.ts} +3 -3
- package/package.json +38 -42
- /package/{src/build/createPen.cjs → cjs/build/createPen.js} +0 -0
- /package/{src/ele/rowEle.cjs → cjs/ele/rowEle.js} +0 -0
- /package/{src/ele/tableEle.cjs → cjs/ele/tableEle.js} +0 -0
- /package/{src/global.cjs → cjs/global.js} +0 -0
- /package/{src/lines.cjs → cjs/lines.js} +0 -0
- /package/{src/proto/setPro.cjs → cjs/proto/setPro.js} +0 -0
- /package/{src/build/createPen.mjs → es/build/createPen.js} +0 -0
- /package/{src/ele/rowEle.mjs → es/ele/rowEle.js} +0 -0
- /package/{src/ele/tableEle.mjs → es/ele/tableEle.js} +0 -0
- /package/{src/global.mjs → es/global.js} +0 -0
- /package/{src/lines.mjs → es/lines.js} +0 -0
- /package/{src/proto/setPro.mjs → es/proto/setPro.js} +0 -0
- /package/{src → es/src}/build/buildBody.d.ts +0 -0
- /package/{src → es/src}/build/buildHeader.d.ts +0 -0
- /package/{src → es/src}/build/computerMaxLen.d.ts +0 -0
- /package/{src → es/src}/build/createPen.d.ts +0 -0
- /package/{src → es/src}/build/index.d.ts +0 -0
- /package/{src → es/src}/core.d.ts +0 -0
- /package/{src → es/src}/ele/rowEle.d.ts +0 -0
- /package/{src → es/src}/ele/tableEle.d.ts +0 -0
- /package/{src → es/src}/global.d.ts +0 -0
- /package/{src → es/src}/lines.d.ts +0 -0
- /package/{src → es/src}/parse/parse.d.ts +0 -0
- /package/{src → es/src}/parse/parseCell.d.ts +0 -0
- /package/{src → es/src}/parse/parseRow.d.ts +0 -0
- /package/{src → es/src}/proto/createHeaderProto.d.ts +0 -0
- /package/{src → es/src}/proto/setPro.d.ts +0 -0
- /package/{src → es/src}/types.d.ts +0 -0
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c) <2025> <
|
|
3
|
+
Copyright (c) <2025> <Mr.MudBean>
|
|
4
4
|
|
|
5
5
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
6
6
|
purpose with or without fee is hereby granted, provided that the above
|
|
@@ -16,7 +16,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
|
16
16
|
|
|
17
17
|
# MIT 许可证
|
|
18
18
|
|
|
19
|
-
版权所有 (c) [2025] [
|
|
19
|
+
版权所有 (c) [2025] [泥豆君]
|
|
20
20
|
|
|
21
21
|
特此免费授予任何获得本软件及相关文档文件(以下简称“软件”)副本的人不受限制地处置该软件的权利,包括不受限制地使用、复制、修改、合并、发布、分发、再许可和/或出售该软件副本的权利,并允许向其提供该软件的人这样做,但须遵守以下条件:
|
|
22
22
|
|
package/README.md
CHANGED
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
# 彩色表格
|
|
2
2
|
|
|
3
|
-
~~一个在控制台构建表格的工具(自定义版 console.table )~~
|
|
4
|
-
|
|
5
|
-
~~本来想着写成在终端(node 环境)和控制台(浏览器环境)公用的,但是发现在浏览器环境表现不佳,且不同的浏览器环境渲染效果不同,还不如使用 `console.table`~~
|
|
6
|
-
|
|
7
3
|
现在支持在浏览器环境打印彩色文本的表格,但是目前不支持自定义边框及长文本换行。因为在 `node` 使用的终端和浏览器的控制台渲染的方式不同,其核心代码也不尽相同。
|
|
8
4
|
|
|
9
5
|
(目前的小问题就是当同行表情过多时会产生偏移)
|
|
@@ -12,10 +8,6 @@
|
|
|
12
8
|
|
|
13
9
|
```bash
|
|
14
10
|
npm install --save colored-table
|
|
15
|
-
|
|
16
|
-
# 亦可 (两包以后将同步版本发布)
|
|
17
|
-
|
|
18
|
-
npm install --save @qqi/table
|
|
19
11
|
```
|
|
20
12
|
|
|
21
13
|
## 使用
|
|
@@ -49,11 +41,11 @@ table();
|
|
|
49
41
|
|
|
50
42
|
在浏览器效果:
|
|
51
43
|
|
|
52
|
-
[](https://github.com/MrMudBean/qqi/blob/main/media/浏览器表格.png)
|
|
53
45
|
|
|
54
46
|
带表情的效果
|
|
55
47
|
|
|
56
|
-
[](https://github.com/MrMudBean/qqi/blob/main/media/浏览器表格-with-emoji.png)
|
|
57
49
|
|
|
58
50
|
### setFontSize
|
|
59
51
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var aTypeOfJs = require('a-type-of-js');
|
|
4
|
-
var createPen = require('./createPen.
|
|
4
|
+
var createPen = require('./createPen.js');
|
|
5
5
|
var colorPen = require('color-pen');
|
|
6
|
-
var lines = require('../lines.
|
|
6
|
+
var lines = require('../lines.js');
|
|
7
7
|
var _static = require('@color-pen/static');
|
|
8
8
|
|
|
9
9
|
/** 构建表头 */
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var aTypeOfJs = require('a-type-of-js');
|
|
4
|
-
var createPen = require('./createPen.
|
|
4
|
+
var createPen = require('./createPen.js');
|
|
5
5
|
var colorPen = require('color-pen');
|
|
6
|
-
var lines = require('../lines.
|
|
6
|
+
var lines = require('../lines.js');
|
|
7
7
|
var _static = require('@color-pen/static');
|
|
8
8
|
|
|
9
9
|
/** 构建表头 */
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var colorPen = require('color-pen');
|
|
4
|
-
var buildBody = require('./buildBody.
|
|
5
|
-
var buildHeader = require('./buildHeader.
|
|
6
|
-
var computerMaxLen = require('./computerMaxLen.
|
|
7
|
-
var global = require('../global.
|
|
4
|
+
var buildBody = require('./buildBody.js');
|
|
5
|
+
var buildHeader = require('./buildHeader.js');
|
|
6
|
+
var computerMaxLen = require('./computerMaxLen.js');
|
|
7
|
+
var global = require('../global.js');
|
|
8
8
|
|
|
9
9
|
/** 渲染 */
|
|
10
10
|
function render(table, fontSize) {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var createHeaderProto = require('./proto/createHeaderProto.
|
|
4
|
-
var parse = require('./parse/parse.
|
|
5
|
-
var parseRow = require('./parse/parseRow.
|
|
6
|
-
var index = require('./build/index.
|
|
3
|
+
var createHeaderProto = require('./proto/createHeaderProto.js');
|
|
4
|
+
var parse = require('./parse/parse.js');
|
|
5
|
+
var parseRow = require('./parse/parseRow.js');
|
|
6
|
+
var index = require('./build/index.js');
|
|
7
7
|
|
|
8
8
|
/** 构建一个用于控制台的表格 */
|
|
9
9
|
function table(options) {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var aTypeOfJs = require('a-type-of-js');
|
|
4
|
-
var global = require('../global.
|
|
5
|
-
var setPro = require('../proto/setPro.
|
|
6
|
-
var tableEle = require('../ele/tableEle.
|
|
7
|
-
var parseRow = require('./parseRow.
|
|
8
|
-
var createHeaderProto = require('../proto/createHeaderProto.
|
|
4
|
+
var global = require('../global.js');
|
|
5
|
+
var setPro = require('../proto/setPro.js');
|
|
6
|
+
var tableEle = require('../ele/tableEle.js');
|
|
7
|
+
var parseRow = require('./parseRow.js');
|
|
8
|
+
var createHeaderProto = require('../proto/createHeaderProto.js');
|
|
9
9
|
|
|
10
10
|
/** 表格的 */
|
|
11
11
|
class TableProto {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var aTypeOfJs = require('a-type-of-js');
|
|
4
|
-
var rowEle = require('../ele/rowEle.
|
|
5
|
-
var setPro = require('../proto/setPro.
|
|
6
|
-
var parseCell = require('./parseCell.
|
|
4
|
+
var rowEle = require('../ele/rowEle.js');
|
|
5
|
+
var setPro = require('../proto/setPro.js');
|
|
6
|
+
var parseCell = require('./parseCell.js');
|
|
7
7
|
|
|
8
8
|
/** 表格的行原型 */
|
|
9
9
|
class RowProto {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { isUndefined, isNull } from 'a-type-of-js';
|
|
2
|
-
import { createPen } from './createPen.
|
|
2
|
+
import { createPen } from './createPen.js';
|
|
3
3
|
import { cutoffStringWithChar } from 'color-pen';
|
|
4
|
-
import { lines } from '../lines.
|
|
4
|
+
import { lines } from '../lines.js';
|
|
5
5
|
import { terminalResetStyle } from '@color-pen/static';
|
|
6
6
|
|
|
7
7
|
/** 构建表头 */
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { isUndefined, isNull } from 'a-type-of-js';
|
|
2
|
-
import { createPen } from './createPen.
|
|
2
|
+
import { createPen } from './createPen.js';
|
|
3
3
|
import { cutoffStringWithChar } from 'color-pen';
|
|
4
|
-
import { lines } from '../lines.
|
|
4
|
+
import { lines } from '../lines.js';
|
|
5
5
|
import { terminalResetStyle } from '@color-pen/static';
|
|
6
6
|
|
|
7
7
|
/** 构建表头 */
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { colorText, strInTerminalLength } from 'color-pen';
|
|
2
|
-
import { buildBody } from './buildBody.
|
|
3
|
-
import { buildHeader } from './buildHeader.
|
|
4
|
-
import { computerMaxLen } from './computerMaxLen.
|
|
5
|
-
import { browserEnv, data } from '../global.
|
|
2
|
+
import { buildBody } from './buildBody.js';
|
|
3
|
+
import { buildHeader } from './buildHeader.js';
|
|
4
|
+
import { computerMaxLen } from './computerMaxLen.js';
|
|
5
|
+
import { browserEnv, data } from '../global.js';
|
|
6
6
|
|
|
7
7
|
/** 渲染 */
|
|
8
8
|
function render(table, fontSize) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { createHeaderProto } from './proto/createHeaderProto.
|
|
2
|
-
import { parse } from './parse/parse.
|
|
3
|
-
import { parseRow } from './parse/parseRow.
|
|
4
|
-
import { render } from './build/index.
|
|
1
|
+
import { createHeaderProto } from './proto/createHeaderProto.js';
|
|
2
|
+
import { parse } from './parse/parse.js';
|
|
3
|
+
import { parseRow } from './parse/parseRow.js';
|
|
4
|
+
import { render } from './build/index.js';
|
|
5
5
|
|
|
6
6
|
/** 构建一个用于控制台的表格 */
|
|
7
7
|
function table(options) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createConstructor } from 'a-js-tools';
|
|
2
|
-
import { table } from './
|
|
3
|
-
export { globalData as ColoredTableGlobalData } from './
|
|
2
|
+
import { table } from './core.js';
|
|
3
|
+
export { globalData as ColoredTableGlobalData } from './global.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
*
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { isUndefined, isArray } from 'a-type-of-js';
|
|
2
|
-
import { globalData } from '../global.
|
|
3
|
-
import { setPro } from '../proto/setPro.
|
|
4
|
-
import { TableEleClass } from '../ele/tableEle.
|
|
5
|
-
import { parseRow } from './parseRow.
|
|
6
|
-
import { createHeaderProto } from '../proto/createHeaderProto.
|
|
2
|
+
import { globalData } from '../global.js';
|
|
3
|
+
import { setPro } from '../proto/setPro.js';
|
|
4
|
+
import { TableEleClass } from '../ele/tableEle.js';
|
|
5
|
+
import { parseRow } from './parseRow.js';
|
|
6
|
+
import { createHeaderProto } from '../proto/createHeaderProto.js';
|
|
7
7
|
|
|
8
8
|
/** 表格的 */
|
|
9
9
|
class TableProto {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { isArray } from 'a-type-of-js';
|
|
2
|
-
import { RowEleClass } from '../ele/rowEle.
|
|
3
|
-
import { setPro } from '../proto/setPro.
|
|
4
|
-
import { parseCell } from './parseCell.
|
|
2
|
+
import { RowEleClass } from '../ele/rowEle.js';
|
|
3
|
+
import { setPro } from '../proto/setPro.js';
|
|
4
|
+
import { parseCell } from './parseCell.js';
|
|
5
5
|
|
|
6
6
|
/** 表格的行原型 */
|
|
7
7
|
class RowProto {
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*
|
|
8
8
|
*
|
|
9
9
|
*/
|
|
10
|
-
declare const tableClass: import("a-js-tools").CreateConstructor<import("./
|
|
10
|
+
declare const tableClass: import("a-js-tools").CreateConstructor<import("./types").ColoredTable, [options?: import("./types").ColoredTableOptions]>;
|
|
11
11
|
export { tableClass as ColoredTable, tableClass as Table };
|
|
12
|
-
export type { ColoredTableCellValue, ColoredTableBorderStyle, ColoredTableUnilateralBorder, ColoredTableUnilateralBorderOptions, ColoredTableBorder, ColoredTableBorderOptions, ColoredBorderOptions, ColoredTableContentAlign, ColoredTableCommon, ColoredTableCommonOption, ColoredTableCellNoBorder, ColoredTableCell, ColoredTableRowOption, ColoredTableEle, ColoredTableOptions, } from './
|
|
13
|
-
export { globalData as ColoredTableGlobalData } from './
|
|
12
|
+
export type { ColoredTableCellValue, ColoredTableBorderStyle, ColoredTableUnilateralBorder, ColoredTableUnilateralBorderOptions, ColoredTableBorder, ColoredTableBorderOptions, ColoredBorderOptions, ColoredTableContentAlign, ColoredTableCommon, ColoredTableCommonOption, ColoredTableCellNoBorder, ColoredTableCell, ColoredTableRowOption, ColoredTableEle, ColoredTableOptions, } from './types';
|
|
13
|
+
export { globalData as ColoredTableGlobalData } from './global';
|
package/package.json
CHANGED
|
@@ -1,62 +1,58 @@
|
|
|
1
1
|
{
|
|
2
|
-
"main": "index.cjs",
|
|
3
|
-
"module": "index.mjs",
|
|
4
|
-
"types": "index.d.ts",
|
|
5
2
|
"name": "colored-table",
|
|
6
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
7
4
|
"type": "module",
|
|
5
|
+
"main": "cjs/index.js",
|
|
6
|
+
"module": "es/index.js",
|
|
7
|
+
"types": "es/src/index.d.ts",
|
|
8
|
+
"author": {
|
|
9
|
+
"name": "泥豆君",
|
|
10
|
+
"email": "Mr.MudBean@outlook.com",
|
|
11
|
+
"url": "https://earthnut.dev"
|
|
12
|
+
},
|
|
8
13
|
"description": "一个简单的在控制台及控制台构建彩色文本表格的工具",
|
|
14
|
+
"sideEffects": false,
|
|
9
15
|
"license": "MIT",
|
|
10
|
-
"dependencies": {
|
|
11
|
-
"@color-pen/static": "^1.0.1",
|
|
12
|
-
"a-js-tools": "^1.0.10",
|
|
13
|
-
"a-type-of-js": "^1.0.7",
|
|
14
|
-
"color-pen": "^2.0.13"
|
|
15
|
-
},
|
|
16
|
-
"publishConfig": {
|
|
17
|
-
"access": "public",
|
|
18
|
-
"registry": "https://registry.npmjs.org/"
|
|
19
|
-
},
|
|
20
16
|
"files": [
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
"
|
|
17
|
+
"cjs",
|
|
18
|
+
"es",
|
|
19
|
+
"LICENSE",
|
|
20
|
+
"README.md"
|
|
25
21
|
],
|
|
26
22
|
"exports": {
|
|
27
23
|
".": {
|
|
28
|
-
"import":
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
"require": {
|
|
33
|
-
"default": "./index.cjs",
|
|
34
|
-
"types": "./index.d.ts"
|
|
35
|
-
}
|
|
24
|
+
"import": "./es/index.js",
|
|
25
|
+
"default": "./es/index.js",
|
|
26
|
+
"require": "./cjs/index.js",
|
|
27
|
+
"types": "./es/src/index.d.ts"
|
|
36
28
|
}
|
|
37
29
|
},
|
|
30
|
+
"keywords": [
|
|
31
|
+
"colored table",
|
|
32
|
+
"终端",
|
|
33
|
+
"彩色表格",
|
|
34
|
+
"控制台",
|
|
35
|
+
"terminal"
|
|
36
|
+
],
|
|
37
|
+
"homepage": "https://earthnut.dev/npm/colored-table",
|
|
38
|
+
"dependencies": {
|
|
39
|
+
"@color-pen/static": "^1.1.1",
|
|
40
|
+
"a-js-tools": "^2.0.1",
|
|
41
|
+
"a-type-of-js": "^2.0.0",
|
|
42
|
+
"color-pen": "^3.0.0"
|
|
43
|
+
},
|
|
44
|
+
"bugs": {
|
|
45
|
+
"url": "https://github.com/MrMudBean/colored-table/issues",
|
|
46
|
+
"email": "Mr.MudBean@outlook.com"
|
|
47
|
+
},
|
|
38
48
|
"repository": {
|
|
39
49
|
"type": "git",
|
|
40
|
-
"url": "git+https://github.com/
|
|
41
|
-
},
|
|
42
|
-
"author": {
|
|
43
|
-
"name": "花生亻",
|
|
44
|
-
"email": "earthnut.dev@outlook.com",
|
|
45
|
-
"url": "https://earthnut.dev"
|
|
50
|
+
"url": "git+https://github.com/MrMudBean/colored-table.git"
|
|
46
51
|
},
|
|
47
52
|
"browserslist": [
|
|
48
|
-
"
|
|
53
|
+
"last 2"
|
|
49
54
|
],
|
|
50
55
|
"engines": {
|
|
51
56
|
"node": ">=18.0.0"
|
|
52
|
-
},
|
|
53
|
-
"keywords": [
|
|
54
|
-
"colored-table",
|
|
55
|
-
"colored-table"
|
|
56
|
-
],
|
|
57
|
-
"homepage": "https://earthnut.dev/npm/colored-table",
|
|
58
|
-
"bugs": {
|
|
59
|
-
"url": "https://github.com/earthnutDev/colored-table/issues",
|
|
60
|
-
"email": "earthnut.dev@outlook.com"
|
|
61
57
|
}
|
|
62
58
|
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|