@dan-uni/dan-any 1.4.0 → 1.4.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/browser/index.min.js +12 -3
- package/dist/browser/src/index.d.ts +4 -3
- package/dist/node/index.js +12 -3
- package/dist/node/src/index.d.ts +4 -3
- package/dist/umd/index.umd.min.js +15 -5
- package/dist/umd/plugins/bili.umd.min.js +2 -2
- package/dist/umd/plugins/index.umd.min.js +2 -2
- package/dist/umd/src/index.d.ts +4 -3
- package/package.json +1 -1
- package/src/index.ts +14 -5
- package/src/utils/dm-gen.ts +1 -1
|
@@ -11480,7 +11480,7 @@ __webpack_require__.d(platform_namespaceObject, {
|
|
|
11480
11480
|
PlatformVideoSource: ()=>platform_PlatformVideoSource,
|
|
11481
11481
|
PlatformVideoSources: ()=>PlatformVideoSources
|
|
11482
11482
|
});
|
|
11483
|
-
var package_namespaceObject = JSON.parse('{"UU":"@dan-uni/dan-any","rE":"1.4.
|
|
11483
|
+
var package_namespaceObject = JSON.parse('{"UU":"@dan-uni/dan-any","rE":"1.4.2","TB":"https://github.com/ani-uni/danuni/tree/master/packages/dan-any#readme"}');
|
|
11484
11484
|
const color_pad = (s)=>s.length < 2 ? `0${s}` : s;
|
|
11485
11485
|
const decimalToHex = (n)=>color_pad(n.toString(16));
|
|
11486
11486
|
const isDarkColor = ({ r, g, b })=>0.299 * r + 0.587 * g + 0.114 * b < 0x30;
|
|
@@ -12028,7 +12028,7 @@ class UniDM {
|
|
|
12028
12028
|
mode: 4,
|
|
12029
12029
|
senderID: senderID.toString(),
|
|
12030
12030
|
ctime: new Date(`${args.ctime} GMT+0800`),
|
|
12031
|
-
weight:
|
|
12031
|
+
weight: 11,
|
|
12032
12032
|
pool: 2,
|
|
12033
12033
|
attr: [
|
|
12034
12034
|
"Protect"
|
|
@@ -12851,6 +12851,15 @@ var src_DM_format = /*#__PURE__*/ function(DM_format) {
|
|
|
12851
12851
|
DM_format["CommonAss"] = "common.ass";
|
|
12852
12852
|
return DM_format;
|
|
12853
12853
|
}({});
|
|
12854
|
+
const Conver2Formats = [
|
|
12855
|
+
"danuni.json",
|
|
12856
|
+
"danuni.min.json",
|
|
12857
|
+
"danuni.binpb",
|
|
12858
|
+
"bili.xml",
|
|
12859
|
+
"dplayer.json",
|
|
12860
|
+
"artplayer.json",
|
|
12861
|
+
"ddplay.json"
|
|
12862
|
+
];
|
|
12854
12863
|
class UniPool {
|
|
12855
12864
|
constructor(dans, options = {}, info = {
|
|
12856
12865
|
fromConverted: false
|
|
@@ -13504,4 +13513,4 @@ class UniPool {
|
|
|
13504
13513
|
}, canvasCtx);
|
|
13505
13514
|
}
|
|
13506
13515
|
}
|
|
13507
|
-
export { UniDM, UniPool, bili_history_fast_forward, bili_namespaceObject as bili, dedupe_namespaceObject as bili_dedupe, dm_gen_namespaceObject as UniDMTools, id_gen_namespaceObject as UniIDTools, platform_namespaceObject as platform, plugins_namespaceObject as plugins, src_DM_format as DM_format };
|
|
13516
|
+
export { Conver2Formats, UniDM, UniPool, bili_history_fast_forward, bili_namespaceObject as bili, dedupe_namespaceObject as bili_dedupe, dm_gen_namespaceObject as UniDMTools, id_gen_namespaceObject as UniIDTools, platform_namespaceObject as platform, plugins_namespaceObject as plugins, src_DM_format as DM_format };
|
|
@@ -141,7 +141,8 @@ export interface Options {
|
|
|
141
141
|
*/
|
|
142
142
|
dmid?: boolean | number | UniIDTools.DMIDGenerator;
|
|
143
143
|
}
|
|
144
|
-
|
|
144
|
+
export declare const Conver2Formats: DM_format[];
|
|
145
|
+
export type Convert2Formats = DM_format.DanuniJson | DM_format.DanuniMinJson | DM_format.DanuniPbBin | DM_format.BiliXml | DM_format.DplayerJson | DM_format.ArtplayerJson | DM_format.DDPlayJson;
|
|
145
146
|
type Convert2ResultMap = {
|
|
146
147
|
[DM_format.DanuniJson]: UniDM[];
|
|
147
148
|
[DM_format.DanuniMinJson]: DM_JSON_DanuniMin;
|
|
@@ -222,8 +223,8 @@ export declare class UniPool {
|
|
|
222
223
|
pool: UniPool;
|
|
223
224
|
fmt: DM_format;
|
|
224
225
|
};
|
|
225
|
-
convert2(format:
|
|
226
|
-
convert2<T extends
|
|
226
|
+
convert2<T extends Exclude<DM_format, Convert2Formats>>(format: T, file_wrapper: true, continue_on_error?: boolean): File;
|
|
227
|
+
convert2<T extends Convert2Formats>(format: T, file_wrapper?: false, continue_on_error?: boolean): Convert2ResultMap[T];
|
|
227
228
|
minify(): (Partial<UniDMTools.UniDMObj> & Pick<UniDMTools.UniDMObj, "SOID">)[];
|
|
228
229
|
static fromMin(json: DM_JSON_DanuniMin, options?: Options): UniPool;
|
|
229
230
|
static fromPb(bin: Uint8Array | ArrayBuffer, options?: Options): UniPool;
|
package/dist/node/index.js
CHANGED
|
@@ -59,7 +59,7 @@ __webpack_require__.d(platform_namespaceObject, {
|
|
|
59
59
|
PlatformVideoSource: ()=>platform_PlatformVideoSource,
|
|
60
60
|
PlatformVideoSources: ()=>PlatformVideoSources
|
|
61
61
|
});
|
|
62
|
-
var package_namespaceObject = JSON.parse('{"UU":"@dan-uni/dan-any","rE":"1.4.
|
|
62
|
+
var package_namespaceObject = JSON.parse('{"UU":"@dan-uni/dan-any","rE":"1.4.2","TB":"https://github.com/ani-uni/danuni/tree/master/packages/dan-any#readme"}');
|
|
63
63
|
const color_pad = (s)=>s.length < 2 ? `0${s}` : s;
|
|
64
64
|
const decimalToHex = (n)=>color_pad(n.toString(16));
|
|
65
65
|
const isDarkColor = ({ r, g, b })=>0.299 * r + 0.587 * g + 0.114 * b < 0x30;
|
|
@@ -606,7 +606,7 @@ class UniDM {
|
|
|
606
606
|
mode: 4,
|
|
607
607
|
senderID: senderID.toString(),
|
|
608
608
|
ctime: new Date(`${args.ctime} GMT+0800`),
|
|
609
|
-
weight:
|
|
609
|
+
weight: 11,
|
|
610
610
|
pool: 2,
|
|
611
611
|
attr: [
|
|
612
612
|
"Protect"
|
|
@@ -1427,6 +1427,15 @@ var src_DM_format = /*#__PURE__*/ function(DM_format) {
|
|
|
1427
1427
|
DM_format["CommonAss"] = "common.ass";
|
|
1428
1428
|
return DM_format;
|
|
1429
1429
|
}({});
|
|
1430
|
+
const Conver2Formats = [
|
|
1431
|
+
"danuni.json",
|
|
1432
|
+
"danuni.min.json",
|
|
1433
|
+
"danuni.binpb",
|
|
1434
|
+
"bili.xml",
|
|
1435
|
+
"dplayer.json",
|
|
1436
|
+
"artplayer.json",
|
|
1437
|
+
"ddplay.json"
|
|
1438
|
+
];
|
|
1430
1439
|
class UniPool {
|
|
1431
1440
|
constructor(dans, options = {}, info = {
|
|
1432
1441
|
fromConverted: false
|
|
@@ -2080,4 +2089,4 @@ class UniPool {
|
|
|
2080
2089
|
}, canvasCtx);
|
|
2081
2090
|
}
|
|
2082
2091
|
}
|
|
2083
|
-
export { UniDM, UniPool, bili_history_fast_forward, bili_namespaceObject as bili, dedupe_namespaceObject as bili_dedupe, dm_gen_namespaceObject as UniDMTools, id_gen_namespaceObject as UniIDTools, platform_namespaceObject as platform, plugins_namespaceObject as plugins, src_DM_format as DM_format };
|
|
2092
|
+
export { Conver2Formats, UniDM, UniPool, bili_history_fast_forward, bili_namespaceObject as bili, dedupe_namespaceObject as bili_dedupe, dm_gen_namespaceObject as UniDMTools, id_gen_namespaceObject as UniIDTools, platform_namespaceObject as platform, plugins_namespaceObject as plugins, src_DM_format as DM_format };
|
package/dist/node/src/index.d.ts
CHANGED
|
@@ -141,7 +141,8 @@ export interface Options {
|
|
|
141
141
|
*/
|
|
142
142
|
dmid?: boolean | number | UniIDTools.DMIDGenerator;
|
|
143
143
|
}
|
|
144
|
-
|
|
144
|
+
export declare const Conver2Formats: DM_format[];
|
|
145
|
+
export type Convert2Formats = DM_format.DanuniJson | DM_format.DanuniMinJson | DM_format.DanuniPbBin | DM_format.BiliXml | DM_format.DplayerJson | DM_format.ArtplayerJson | DM_format.DDPlayJson;
|
|
145
146
|
type Convert2ResultMap = {
|
|
146
147
|
[DM_format.DanuniJson]: UniDM[];
|
|
147
148
|
[DM_format.DanuniMinJson]: DM_JSON_DanuniMin;
|
|
@@ -222,8 +223,8 @@ export declare class UniPool {
|
|
|
222
223
|
pool: UniPool;
|
|
223
224
|
fmt: DM_format;
|
|
224
225
|
};
|
|
225
|
-
convert2(format:
|
|
226
|
-
convert2<T extends
|
|
226
|
+
convert2<T extends Exclude<DM_format, Convert2Formats>>(format: T, file_wrapper: true, continue_on_error?: boolean): File;
|
|
227
|
+
convert2<T extends Convert2Formats>(format: T, file_wrapper?: false, continue_on_error?: boolean): Convert2ResultMap[T];
|
|
227
228
|
minify(): (Partial<UniDMTools.UniDMObj> & Pick<UniDMTools.UniDMObj, "SOID">)[];
|
|
228
229
|
static fromMin(json: DM_JSON_DanuniMin, options?: Options): UniPool;
|
|
229
230
|
static fromPb(bin: Uint8Array | ArrayBuffer, options?: Options): UniPool;
|
|
@@ -13573,12 +13573,13 @@
|
|
|
13573
13573
|
"use strict";
|
|
13574
13574
|
__webpack_require__.r(__webpack_exports__);
|
|
13575
13575
|
__webpack_require__.d(__webpack_exports__, {
|
|
13576
|
-
plugins: ()=>plugins,
|
|
13577
|
-
platform: ()=>platform,
|
|
13578
13576
|
UniDM: ()=>UniDM,
|
|
13579
|
-
UniDMTools: ()=>dm_gen_namespaceObject,
|
|
13580
13577
|
UniPool: ()=>UniPool,
|
|
13581
13578
|
DM_format: ()=>src_DM_format,
|
|
13579
|
+
plugins: ()=>plugins,
|
|
13580
|
+
Conver2Formats: ()=>Conver2Formats,
|
|
13581
|
+
platform: ()=>platform,
|
|
13582
|
+
UniDMTools: ()=>dm_gen_namespaceObject,
|
|
13582
13583
|
UniIDTools: ()=>id_gen_namespaceObject
|
|
13583
13584
|
});
|
|
13584
13585
|
var id_gen_namespaceObject = {};
|
|
@@ -21209,7 +21210,7 @@
|
|
|
21209
21210
|
function timestamp_timestampMs(timestamp) {
|
|
21210
21211
|
return 1000 * Number(timestamp.seconds) + Math.round(timestamp.nanos / 1000000);
|
|
21211
21212
|
}
|
|
21212
|
-
var package_namespaceObject = JSON.parse('{"UU":"@dan-uni/dan-any","rE":"1.4.
|
|
21213
|
+
var package_namespaceObject = JSON.parse('{"UU":"@dan-uni/dan-any","rE":"1.4.2","TB":"https://github.com/ani-uni/danuni/tree/master/packages/dan-any#readme"}');
|
|
21213
21214
|
const color_pad = (s)=>s.length < 2 ? `0${s}` : s;
|
|
21214
21215
|
const decimalToHex = (n)=>color_pad(n.toString(16));
|
|
21215
21216
|
const isDarkColor = ({ r, g, b })=>0.299 * r + 0.587 * g + 0.114 * b < 0x30;
|
|
@@ -23935,7 +23936,7 @@
|
|
|
23935
23936
|
mode: 4,
|
|
23936
23937
|
senderID: senderID.toString(),
|
|
23937
23938
|
ctime: new Date(`${args.ctime} GMT+0800`),
|
|
23938
|
-
weight:
|
|
23939
|
+
weight: 11,
|
|
23939
23940
|
pool: 2,
|
|
23940
23941
|
attr: [
|
|
23941
23942
|
"Protect"
|
|
@@ -24699,6 +24700,15 @@
|
|
|
24699
24700
|
DM_format["CommonAss"] = "common.ass";
|
|
24700
24701
|
return DM_format;
|
|
24701
24702
|
}({});
|
|
24703
|
+
const Conver2Formats = [
|
|
24704
|
+
"danuni.json",
|
|
24705
|
+
"danuni.min.json",
|
|
24706
|
+
"danuni.binpb",
|
|
24707
|
+
"bili.xml",
|
|
24708
|
+
"dplayer.json",
|
|
24709
|
+
"artplayer.json",
|
|
24710
|
+
"ddplay.json"
|
|
24711
|
+
];
|
|
24702
24712
|
class UniPool {
|
|
24703
24713
|
constructor(dans, options = {}, info = {
|
|
24704
24714
|
fromConverted: false
|
|
@@ -21186,7 +21186,7 @@
|
|
|
21186
21186
|
function timestamp_timestampMs(timestamp) {
|
|
21187
21187
|
return 1000 * Number(timestamp.seconds) + Math.round(timestamp.nanos / 1000000);
|
|
21188
21188
|
}
|
|
21189
|
-
var package_namespaceObject = JSON.parse('{"UU":"@dan-uni/dan-any","rE":"1.4.
|
|
21189
|
+
var package_namespaceObject = JSON.parse('{"UU":"@dan-uni/dan-any","rE":"1.4.2","TB":"https://github.com/ani-uni/danuni/tree/master/packages/dan-any#readme"}');
|
|
21190
21190
|
const color_pad = (s)=>s.length < 2 ? `0${s}` : s;
|
|
21191
21191
|
const decimalToHex = (n)=>color_pad(n.toString(16));
|
|
21192
21192
|
const isDarkColor = ({ r, g, b })=>0.299 * r + 0.587 * g + 0.114 * b < 0x30;
|
|
@@ -23892,7 +23892,7 @@
|
|
|
23892
23892
|
mode: 4,
|
|
23893
23893
|
senderID: senderID.toString(),
|
|
23894
23894
|
ctime: new Date(`${args.ctime} GMT+0800`),
|
|
23895
|
-
weight:
|
|
23895
|
+
weight: 11,
|
|
23896
23896
|
pool: 2,
|
|
23897
23897
|
attr: [
|
|
23898
23898
|
"Protect"
|
|
@@ -21186,7 +21186,7 @@
|
|
|
21186
21186
|
function timestamp_timestampMs(timestamp) {
|
|
21187
21187
|
return 1000 * Number(timestamp.seconds) + Math.round(timestamp.nanos / 1000000);
|
|
21188
21188
|
}
|
|
21189
|
-
var package_namespaceObject = JSON.parse('{"UU":"@dan-uni/dan-any","rE":"1.4.
|
|
21189
|
+
var package_namespaceObject = JSON.parse('{"UU":"@dan-uni/dan-any","rE":"1.4.2","TB":"https://github.com/ani-uni/danuni/tree/master/packages/dan-any#readme"}');
|
|
21190
21190
|
const color_pad = (s)=>s.length < 2 ? `0${s}` : s;
|
|
21191
21191
|
const decimalToHex = (n)=>color_pad(n.toString(16));
|
|
21192
21192
|
const isDarkColor = ({ r, g, b })=>0.299 * r + 0.587 * g + 0.114 * b < 0x30;
|
|
@@ -23892,7 +23892,7 @@
|
|
|
23892
23892
|
mode: 4,
|
|
23893
23893
|
senderID: senderID.toString(),
|
|
23894
23894
|
ctime: new Date(`${args.ctime} GMT+0800`),
|
|
23895
|
-
weight:
|
|
23895
|
+
weight: 11,
|
|
23896
23896
|
pool: 2,
|
|
23897
23897
|
attr: [
|
|
23898
23898
|
"Protect"
|
package/dist/umd/src/index.d.ts
CHANGED
|
@@ -141,7 +141,8 @@ export interface Options {
|
|
|
141
141
|
*/
|
|
142
142
|
dmid?: boolean | number | UniIDTools.DMIDGenerator;
|
|
143
143
|
}
|
|
144
|
-
|
|
144
|
+
export declare const Conver2Formats: DM_format[];
|
|
145
|
+
export type Convert2Formats = DM_format.DanuniJson | DM_format.DanuniMinJson | DM_format.DanuniPbBin | DM_format.BiliXml | DM_format.DplayerJson | DM_format.ArtplayerJson | DM_format.DDPlayJson;
|
|
145
146
|
type Convert2ResultMap = {
|
|
146
147
|
[DM_format.DanuniJson]: UniDM[];
|
|
147
148
|
[DM_format.DanuniMinJson]: DM_JSON_DanuniMin;
|
|
@@ -222,8 +223,8 @@ export declare class UniPool {
|
|
|
222
223
|
pool: UniPool;
|
|
223
224
|
fmt: DM_format;
|
|
224
225
|
};
|
|
225
|
-
convert2(format:
|
|
226
|
-
convert2<T extends
|
|
226
|
+
convert2<T extends Exclude<DM_format, Convert2Formats>>(format: T, file_wrapper: true, continue_on_error?: boolean): File;
|
|
227
|
+
convert2<T extends Convert2Formats>(format: T, file_wrapper?: false, continue_on_error?: boolean): Convert2ResultMap[T];
|
|
227
228
|
minify(): (Partial<UniDMTools.UniDMObj> & Pick<UniDMTools.UniDMObj, "SOID">)[];
|
|
228
229
|
static fromMin(json: DM_JSON_DanuniMin, options?: Options): UniPool;
|
|
229
230
|
static fromPb(bin: Uint8Array | ArrayBuffer, options?: Options): UniPool;
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -200,7 +200,16 @@ export interface Options {
|
|
|
200
200
|
dmid?: boolean | number | UniIDTools.DMIDGenerator
|
|
201
201
|
}
|
|
202
202
|
|
|
203
|
-
|
|
203
|
+
export const Conver2Formats = [
|
|
204
|
+
DM_format.DanuniJson,
|
|
205
|
+
DM_format.DanuniMinJson,
|
|
206
|
+
DM_format.DanuniPbBin,
|
|
207
|
+
DM_format.BiliXml,
|
|
208
|
+
DM_format.DplayerJson,
|
|
209
|
+
DM_format.ArtplayerJson,
|
|
210
|
+
DM_format.DDPlayJson,
|
|
211
|
+
]
|
|
212
|
+
export type Convert2Formats =
|
|
204
213
|
| DM_format.DanuniJson
|
|
205
214
|
| DM_format.DanuniMinJson
|
|
206
215
|
| DM_format.DanuniPbBin
|
|
@@ -684,12 +693,12 @@ export class UniPool {
|
|
|
684
693
|
}
|
|
685
694
|
throw new Error(errmesg ?? err)
|
|
686
695
|
}
|
|
687
|
-
convert2(
|
|
688
|
-
format:
|
|
696
|
+
convert2<T extends Exclude<DM_format, Convert2Formats>>(
|
|
697
|
+
format: T,
|
|
689
698
|
file_wrapper: true,
|
|
690
699
|
continue_on_error?: boolean,
|
|
691
700
|
): File
|
|
692
|
-
convert2<T extends
|
|
701
|
+
convert2<T extends Convert2Formats>(
|
|
693
702
|
format: T,
|
|
694
703
|
file_wrapper?: false,
|
|
695
704
|
continue_on_error?: boolean,
|
|
@@ -698,7 +707,7 @@ export class UniPool {
|
|
|
698
707
|
format: DM_format,
|
|
699
708
|
file_wrapper = false,
|
|
700
709
|
continue_on_error = false,
|
|
701
|
-
): File | Convert2ResultMap[
|
|
710
|
+
): File | Convert2ResultMap[Convert2Formats] | string {
|
|
702
711
|
switch (format) {
|
|
703
712
|
case DM_format.DanuniJson:
|
|
704
713
|
if (file_wrapper)
|
package/src/utils/dm-gen.ts
CHANGED
|
@@ -932,7 +932,7 @@ export class UniDM {
|
|
|
932
932
|
senderID: senderID.toString(),
|
|
933
933
|
// content: args.content,
|
|
934
934
|
ctime: new Date(`${args.ctime} GMT+0800`), // 无视本地时区,按照B站的东8区计算时间
|
|
935
|
-
weight:
|
|
935
|
+
weight: 11,
|
|
936
936
|
pool: Pools.Adv,
|
|
937
937
|
attr: [DMAttr.Protect],
|
|
938
938
|
platform: PlatformVideoSource.Bilibili,
|