@dan-uni/dan-any 0.4.9 → 0.5.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/dist/index.js +3 -3
- package/dist/index.umd.min.js +3 -3
- package/dist/src/utils/dm-gen.d.ts +8 -0
- package/package.json +1 -1
- package/src/utils/dm-gen.ts +12 -3
package/dist/index.js
CHANGED
|
@@ -4948,7 +4948,7 @@ const toBits = (number)=>{
|
|
|
4948
4948
|
bits.unshift(!!(1 & number));
|
|
4949
4949
|
number >>= 1;
|
|
4950
4950
|
}while (number);
|
|
4951
|
-
return bits;
|
|
4951
|
+
return bits.reverse();
|
|
4952
4952
|
};
|
|
4953
4953
|
const DMAttrUtils = {
|
|
4954
4954
|
fromBin (bin = 0, format) {
|
|
@@ -5051,9 +5051,9 @@ class UniDM {
|
|
|
5051
5051
|
this.DMID = DMID;
|
|
5052
5052
|
if (progress < 0) this.progress = 0;
|
|
5053
5053
|
if (mode < 0 || mode > 4) this.mode = 0;
|
|
5054
|
-
if (fontsize
|
|
5054
|
+
if (fontsize < 10 || fontsize > 127) this.fontsize = 25;
|
|
5055
5055
|
if (color <= 0) this.color = 16777215;
|
|
5056
|
-
if (weight < 0 || weight >
|
|
5056
|
+
if (weight < 0 || weight > 11) this.weight = 5;
|
|
5057
5057
|
if (pool < 0 || pool > 3) this.pool = 0;
|
|
5058
5058
|
if (!DMID) DMID = this.toDMID();
|
|
5059
5059
|
this.progress = Number.parseFloat(progress.toFixed(3));
|
package/dist/index.umd.min.js
CHANGED
|
@@ -18993,7 +18993,7 @@
|
|
|
18993
18993
|
bits.unshift(!!(1 & number));
|
|
18994
18994
|
number >>= 1;
|
|
18995
18995
|
}while (number);
|
|
18996
|
-
return bits;
|
|
18996
|
+
return bits.reverse();
|
|
18997
18997
|
};
|
|
18998
18998
|
const DMAttrUtils = {
|
|
18999
18999
|
fromBin (bin = 0, format) {
|
|
@@ -19096,9 +19096,9 @@
|
|
|
19096
19096
|
this.DMID = DMID;
|
|
19097
19097
|
if (progress < 0) this.progress = 0;
|
|
19098
19098
|
if (mode < 0 || mode > 4) this.mode = 0;
|
|
19099
|
-
if (fontsize
|
|
19099
|
+
if (fontsize < 10 || fontsize > 127) this.fontsize = 25;
|
|
19100
19100
|
if (color <= 0) this.color = 16777215;
|
|
19101
|
-
if (weight < 0 || weight >
|
|
19101
|
+
if (weight < 0 || weight > 11) this.weight = 5;
|
|
19102
19102
|
if (pool < 0 || pool > 3) this.pool = 0;
|
|
19103
19103
|
if (!DMID) DMID = this.toDMID();
|
|
19104
19104
|
this.progress = Number.parseFloat(progress.toFixed(3));
|
|
@@ -176,9 +176,13 @@ export declare class UniDM {
|
|
|
176
176
|
/**
|
|
177
177
|
* 字号
|
|
178
178
|
* @default 25
|
|
179
|
+
* - 12
|
|
180
|
+
* - 16
|
|
179
181
|
* - 18:小
|
|
180
182
|
* - 25:标准
|
|
181
183
|
* - 36:大
|
|
184
|
+
* - 45
|
|
185
|
+
* - 64
|
|
182
186
|
*/
|
|
183
187
|
fontsize: number;
|
|
184
188
|
/**
|
|
@@ -248,9 +252,13 @@ export declare class UniDM {
|
|
|
248
252
|
/**
|
|
249
253
|
* 字号
|
|
250
254
|
* @default 25
|
|
255
|
+
* - 12
|
|
256
|
+
* - 16
|
|
251
257
|
* - 18:小
|
|
252
258
|
* - 25:标准
|
|
253
259
|
* - 36:大
|
|
260
|
+
* - 45
|
|
261
|
+
* - 64
|
|
254
262
|
*/
|
|
255
263
|
fontsize?: number,
|
|
256
264
|
/**
|
package/package.json
CHANGED
package/src/utils/dm-gen.ts
CHANGED
|
@@ -42,6 +42,11 @@ class SetBin {
|
|
|
42
42
|
this.bin &= ~(1 << bit)
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* 获得数字的二进制,每位以boolean(true/false)表示1/0,从低位向高位
|
|
48
|
+
* @param number 任意进制数字
|
|
49
|
+
*/
|
|
45
50
|
const toBits = (number: number) => {
|
|
46
51
|
// 低速方案
|
|
47
52
|
// return [...number.toString(2)].map(Number)
|
|
@@ -52,7 +57,7 @@ const toBits = (number: number) => {
|
|
|
52
57
|
// bits.unshift(number & 1) // (0|1)[]
|
|
53
58
|
number >>= 1
|
|
54
59
|
} while (number)
|
|
55
|
-
return bits
|
|
60
|
+
return bits.reverse()
|
|
56
61
|
}
|
|
57
62
|
|
|
58
63
|
export type DMAttr =
|
|
@@ -339,9 +344,13 @@ export class UniDM {
|
|
|
339
344
|
/**
|
|
340
345
|
* 字号
|
|
341
346
|
* @default 25
|
|
347
|
+
* - 12
|
|
348
|
+
* - 16
|
|
342
349
|
* - 18:小
|
|
343
350
|
* - 25:标准
|
|
344
351
|
* - 36:大
|
|
352
|
+
* - 45
|
|
353
|
+
* - 64
|
|
345
354
|
*/
|
|
346
355
|
public fontsize: number = 25,
|
|
347
356
|
/**
|
|
@@ -396,10 +405,10 @@ export class UniDM {
|
|
|
396
405
|
//TODO 引入class-validator
|
|
397
406
|
if (progress < 0) this.progress = 0
|
|
398
407
|
if (mode < Modes.Normal || mode > Modes.Ext) this.mode = Modes.Normal
|
|
399
|
-
if (fontsize
|
|
408
|
+
if (fontsize < 10 || fontsize > 127) this.fontsize = 25
|
|
400
409
|
if (color <= 0) this.color = 16777215 //虽然不知道为0是否为可用值,但过为少见,利用其作为默认位
|
|
401
410
|
// if (ctime <= 0n) this.ctime = BigInt(Date.now())
|
|
402
|
-
if (weight < 0 || weight >
|
|
411
|
+
if (weight < 0 || weight > 11) this.weight = 5
|
|
403
412
|
if (pool < Pools.Def || pool > Pools.Ix) this.pool = Pools.Def
|
|
404
413
|
// if (attr < 0 || attr > 0b111) this.attr = 0
|
|
405
414
|
if (!DMID) DMID = this.toDMID()
|