@dan-uni/dan-any 1.0.1 → 1.1.1
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/157.min.js +14 -0
- package/dist/browser/42.min.js +45 -0
- package/dist/{index.min.js → browser/index.min.js} +15 -50
- package/dist/browser/plugins/bili-dedupe.min.js +1 -0
- package/dist/browser/plugins/index.min.js +1 -0
- package/dist/browser/src/plugins/bili-dedupe/index.d.ts +5 -0
- package/dist/browser/src/plugins/index.d.ts +2 -0
- package/dist/browser/src/utils/dm-gen.test.d.ts +1 -0
- package/dist/node/157.js +14 -0
- package/dist/node/42.js +45 -0
- package/dist/{index.js → node/index.js} +4 -45
- package/dist/node/plugins/bili-dedupe.js +1 -0
- package/dist/node/plugins/index.js +1 -0
- package/dist/node/src/ass-gen/__tests__/canvas.test.d.ts +1 -0
- package/dist/node/src/ass-gen/__tests__/generate.test.d.ts +1 -0
- package/dist/node/src/ass-gen/ass/create.d.ts +4 -0
- package/dist/node/src/ass-gen/ass/dialogue.d.ts +16 -0
- package/dist/node/src/ass-gen/ass/event.d.ts +2 -0
- package/dist/node/src/ass-gen/ass/info.d.ts +8 -0
- package/dist/node/src/ass-gen/ass/raw.d.ts +14 -0
- package/dist/node/src/ass-gen/ass/style.d.ts +2 -0
- package/dist/node/src/ass-gen/config.d.ts +2 -0
- package/dist/node/src/ass-gen/index.d.ts +30 -0
- package/dist/node/src/ass-gen/types.d.ts +71 -0
- package/dist/node/src/ass-gen/util/color.d.ts +18 -0
- package/dist/node/src/ass-gen/util/danconvert.d.ts +5 -0
- package/dist/node/src/ass-gen/util/index.d.ts +4 -0
- package/dist/node/src/ass-gen/util/lang.d.ts +3 -0
- package/dist/node/src/ass-gen/util/layout.d.ts +4 -0
- package/dist/node/src/index.d.ts +255 -0
- package/dist/node/src/index.test.d.ts +1 -0
- package/dist/node/src/plugins/bili-dedupe/index.d.ts +5 -0
- package/dist/node/src/plugins/bili-dedupe/index.test.d.ts +1 -0
- package/dist/node/src/plugins/index.d.ts +2 -0
- package/dist/node/src/proto/gen/bili/dm_pb.d.ts +3426 -0
- package/dist/node/src/proto/gen/danuni_pb.d.ts +172 -0
- package/dist/node/src/utils/dm-gen.d.ts +309 -0
- package/dist/node/src/utils/dm-gen.test.d.ts +1 -0
- package/dist/node/src/utils/id-gen.d.ts +50 -0
- package/dist/node/src/utils/platform.d.ts +24 -0
- package/dist/{index.umd.min.js → umd/index.umd.min.js} +12 -6
- package/dist/umd/plugins/bili-dedupe.umd.min.js +79 -0
- package/dist/umd/plugins/index.umd.min.js +98 -0
- package/dist/umd/src/ass-gen/__tests__/canvas.test.d.ts +1 -0
- package/dist/umd/src/ass-gen/__tests__/generate.test.d.ts +1 -0
- package/dist/umd/src/ass-gen/ass/create.d.ts +4 -0
- package/dist/umd/src/ass-gen/ass/dialogue.d.ts +16 -0
- package/dist/umd/src/ass-gen/ass/event.d.ts +2 -0
- package/dist/umd/src/ass-gen/ass/info.d.ts +8 -0
- package/dist/umd/src/ass-gen/ass/raw.d.ts +14 -0
- package/dist/umd/src/ass-gen/ass/style.d.ts +2 -0
- package/dist/umd/src/ass-gen/config.d.ts +2 -0
- package/dist/umd/src/ass-gen/index.d.ts +30 -0
- package/dist/umd/src/ass-gen/types.d.ts +71 -0
- package/dist/umd/src/ass-gen/util/color.d.ts +18 -0
- package/dist/umd/src/ass-gen/util/danconvert.d.ts +5 -0
- package/dist/umd/src/ass-gen/util/index.d.ts +4 -0
- package/dist/umd/src/ass-gen/util/lang.d.ts +3 -0
- package/dist/umd/src/ass-gen/util/layout.d.ts +4 -0
- package/dist/umd/src/index.d.ts +255 -0
- package/dist/umd/src/index.test.d.ts +1 -0
- package/dist/umd/src/plugins/bili-dedupe/index.d.ts +5 -0
- package/dist/umd/src/plugins/bili-dedupe/index.test.d.ts +1 -0
- package/dist/umd/src/plugins/index.d.ts +2 -0
- package/dist/umd/src/proto/gen/bili/dm_pb.d.ts +3426 -0
- package/dist/umd/src/proto/gen/danuni_pb.d.ts +172 -0
- package/dist/umd/src/utils/dm-gen.d.ts +309 -0
- package/dist/umd/src/utils/dm-gen.test.d.ts +1 -0
- package/dist/umd/src/utils/id-gen.d.ts +50 -0
- package/dist/umd/src/utils/platform.d.ts +24 -0
- package/package.json +8 -8
- package/plugins/package.json +6 -0
- package/rslib.config.ts +10 -0
- package/src/plugins/bili-dedupe/index.test.ts +40 -0
- package/src/plugins/bili-dedupe/index.ts +19 -0
- package/src/plugins/index.ts +3 -0
- package/src/proto/gen/bili/dm_pb.ts +1 -1
- package/src/proto/gen/danuni_pb.ts +1 -1
- /package/dist/{index.min.js.LICENSE.txt → browser/index.min.js.LICENSE.txt} +0 -0
- /package/dist/{rslib-runtime.min.js → browser/rslib-runtime.min.js} +0 -0
- /package/dist/{src → browser/src}/ass-gen/__tests__/canvas.test.d.ts +0 -0
- /package/dist/{src → browser/src}/ass-gen/__tests__/generate.test.d.ts +0 -0
- /package/dist/{src → browser/src}/ass-gen/ass/create.d.ts +0 -0
- /package/dist/{src → browser/src}/ass-gen/ass/dialogue.d.ts +0 -0
- /package/dist/{src → browser/src}/ass-gen/ass/event.d.ts +0 -0
- /package/dist/{src → browser/src}/ass-gen/ass/info.d.ts +0 -0
- /package/dist/{src → browser/src}/ass-gen/ass/raw.d.ts +0 -0
- /package/dist/{src → browser/src}/ass-gen/ass/style.d.ts +0 -0
- /package/dist/{src → browser/src}/ass-gen/config.d.ts +0 -0
- /package/dist/{src → browser/src}/ass-gen/index.d.ts +0 -0
- /package/dist/{src → browser/src}/ass-gen/types.d.ts +0 -0
- /package/dist/{src → browser/src}/ass-gen/util/color.d.ts +0 -0
- /package/dist/{src → browser/src}/ass-gen/util/danconvert.d.ts +0 -0
- /package/dist/{src → browser/src}/ass-gen/util/index.d.ts +0 -0
- /package/dist/{src → browser/src}/ass-gen/util/lang.d.ts +0 -0
- /package/dist/{src → browser/src}/ass-gen/util/layout.d.ts +0 -0
- /package/dist/{src → browser/src}/index.d.ts +0 -0
- /package/dist/{src → browser/src}/index.test.d.ts +0 -0
- /package/dist/{src/utils/dm-gen.test.d.ts → browser/src/plugins/bili-dedupe/index.test.d.ts} +0 -0
- /package/dist/{src → browser/src}/proto/gen/bili/dm_pb.d.ts +0 -0
- /package/dist/{src → browser/src}/proto/gen/danuni_pb.d.ts +0 -0
- /package/dist/{src → browser/src}/utils/dm-gen.d.ts +0 -0
- /package/dist/{src → browser/src}/utils/id-gen.d.ts +0 -0
- /package/dist/{src → browser/src}/utils/platform.d.ts +0 -0
- /package/dist/{rslib-runtime.js → node/rslib-runtime.js} +0 -0
- /package/dist/{index.umd.min.js.LICENSE.txt → umd/index.umd.min.js.LICENSE.txt} +0 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { platform_PlatformVideoSource } from "./42.min.js";
|
|
2
|
+
function bili_dedupe(that) {
|
|
3
|
+
that.dans.forEach((d)=>{
|
|
4
|
+
if (d.platform !== platform_PlatformVideoSource.Bilibili) throw new Error('bili-dedupe: 仅支持B站(主站)的弹幕');
|
|
5
|
+
if (!d.extra.bili?.dmid) throw new Error('bili-dedupe: 弹幕缺少bili extra dmid字段');
|
|
6
|
+
});
|
|
7
|
+
const map = new Map();
|
|
8
|
+
that.dans.forEach((d)=>map.set(d.extra.bili.dmid, d));
|
|
9
|
+
that.dans = [
|
|
10
|
+
...map.values()
|
|
11
|
+
];
|
|
12
|
+
return that;
|
|
13
|
+
}
|
|
14
|
+
export { bili_dedupe };
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { __webpack_require__ } from "./rslib-runtime.min.js";
|
|
2
|
+
var platform_namespaceObject = {};
|
|
3
|
+
__webpack_require__.r(platform_namespaceObject);
|
|
4
|
+
__webpack_require__.d(platform_namespaceObject, {
|
|
5
|
+
PlatformDanmakuOnlySource: ()=>platform_PlatformDanmakuOnlySource,
|
|
6
|
+
PlatformDanmakuOnlySources: ()=>PlatformDanmakuOnlySources,
|
|
7
|
+
PlatformDanmakuSources: ()=>PlatformDanmakuSources,
|
|
8
|
+
PlatformInfoSource: ()=>platform_PlatformInfoSource,
|
|
9
|
+
PlatformInfoSources: ()=>PlatformInfoSources,
|
|
10
|
+
PlatformSources: ()=>PlatformSources,
|
|
11
|
+
PlatformVideoSource: ()=>platform_PlatformVideoSource,
|
|
12
|
+
PlatformVideoSources: ()=>PlatformVideoSources
|
|
13
|
+
});
|
|
14
|
+
var platform_PlatformInfoSource = /*#__PURE__*/ function(PlatformInfoSource) {
|
|
15
|
+
PlatformInfoSource["Bangumi"] = "bgm";
|
|
16
|
+
PlatformInfoSource["TMDB"] = "tmdb";
|
|
17
|
+
return PlatformInfoSource;
|
|
18
|
+
}({});
|
|
19
|
+
const PlatformInfoSources = Object.values(platform_PlatformInfoSource);
|
|
20
|
+
var platform_PlatformVideoSource = /*#__PURE__*/ function(PlatformVideoSource) {
|
|
21
|
+
PlatformVideoSource["Acfun"] = "acfun";
|
|
22
|
+
PlatformVideoSource["Baha"] = "baha";
|
|
23
|
+
PlatformVideoSource["Bilibili"] = "bili";
|
|
24
|
+
PlatformVideoSource["BilibiliGlobal"] = "bglobal";
|
|
25
|
+
PlatformVideoSource["Iqiyi"] = "iqiyi";
|
|
26
|
+
PlatformVideoSource["Tencent"] = "tencent";
|
|
27
|
+
PlatformVideoSource["Youku"] = "youku";
|
|
28
|
+
return PlatformVideoSource;
|
|
29
|
+
}({});
|
|
30
|
+
const PlatformVideoSources = Object.values(platform_PlatformVideoSource);
|
|
31
|
+
var platform_PlatformDanmakuOnlySource = /*#__PURE__*/ function(PlatformDanmakuOnlySource) {
|
|
32
|
+
PlatformDanmakuOnlySource["DanDanPlay"] = "ddplay";
|
|
33
|
+
PlatformDanmakuOnlySource["TuCao"] = "tucao";
|
|
34
|
+
return PlatformDanmakuOnlySource;
|
|
35
|
+
}({});
|
|
36
|
+
const PlatformDanmakuOnlySources = Object.values(platform_PlatformDanmakuOnlySource);
|
|
37
|
+
const PlatformDanmakuSources = [
|
|
38
|
+
...PlatformVideoSources,
|
|
39
|
+
...PlatformDanmakuOnlySources
|
|
40
|
+
];
|
|
41
|
+
const PlatformSources = [
|
|
42
|
+
...PlatformInfoSources,
|
|
43
|
+
...PlatformDanmakuSources
|
|
44
|
+
];
|
|
45
|
+
export { PlatformDanmakuSources, platform_PlatformDanmakuOnlySource, platform_PlatformVideoSource, platform_namespaceObject as platform };
|
|
@@ -11,6 +11,7 @@ import hh_mm_ss from "hh-mm-ss";
|
|
|
11
11
|
import jssha from "jssha";
|
|
12
12
|
import { decode, encode as external_base16384_encode } from "base16384";
|
|
13
13
|
import { fileDesc, messageDesc as codegenv2_messageDesc } from "@bufbuild/protobuf/codegenv2";
|
|
14
|
+
import { platform_PlatformVideoSource, PlatformDanmakuSources, platform_PlatformDanmakuOnlySource } from "./42.min.js";
|
|
14
15
|
__webpack_require__.add({
|
|
15
16
|
"../../node_modules/.pnpm/assert@2.1.0/node_modules/assert/build/assert.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
16
17
|
var process = __webpack_require__("../../node_modules/.pnpm/process@0.11.10/node_modules/process/browser.js");
|
|
@@ -4769,7 +4770,7 @@ __webpack_require__.add({
|
|
|
4769
4770
|
module.exports = fn;
|
|
4770
4771
|
},
|
|
4771
4772
|
"../../node_modules/.pnpm/is-typed-array@1.1.15/node_modules/is-typed-array/index.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
4772
|
-
var whichTypedArray = __webpack_require__("../../node_modules/.pnpm/which-typed-array@1.1.
|
|
4773
|
+
var whichTypedArray = __webpack_require__("../../node_modules/.pnpm/which-typed-array@1.1.20/node_modules/which-typed-array/index.js");
|
|
4773
4774
|
module.exports = function(value) {
|
|
4774
4775
|
return !!whichTypedArray(value);
|
|
4775
4776
|
};
|
|
@@ -10683,7 +10684,7 @@ __webpack_require__.add({
|
|
|
10683
10684
|
"../../node_modules/.pnpm/util@0.12.5/node_modules/util/support/types.js" (__unused_rspack_module, exports, __webpack_require__) {
|
|
10684
10685
|
var isArgumentsObject = __webpack_require__("../../node_modules/.pnpm/is-arguments@1.2.0/node_modules/is-arguments/index.js");
|
|
10685
10686
|
var isGeneratorFunction = __webpack_require__("../../node_modules/.pnpm/is-generator-function@1.1.2/node_modules/is-generator-function/index.js");
|
|
10686
|
-
var whichTypedArray = __webpack_require__("../../node_modules/.pnpm/which-typed-array@1.1.
|
|
10687
|
+
var whichTypedArray = __webpack_require__("../../node_modules/.pnpm/which-typed-array@1.1.20/node_modules/which-typed-array/index.js");
|
|
10687
10688
|
var isTypedArray = __webpack_require__("../../node_modules/.pnpm/is-typed-array@1.1.15/node_modules/is-typed-array/index.js");
|
|
10688
10689
|
function uncurryThis(f) {
|
|
10689
10690
|
return f.call.bind(f);
|
|
@@ -11349,7 +11350,7 @@ __webpack_require__.add({
|
|
|
11349
11350
|
}
|
|
11350
11351
|
exports.callbackify = callbackify;
|
|
11351
11352
|
},
|
|
11352
|
-
"../../node_modules/.pnpm/which-typed-array@1.1.
|
|
11353
|
+
"../../node_modules/.pnpm/which-typed-array@1.1.20/node_modules/which-typed-array/index.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
11353
11354
|
var forEach = __webpack_require__("../../node_modules/.pnpm/for-each@0.3.5/node_modules/for-each/index.js");
|
|
11354
11355
|
var availableTypedArrays = __webpack_require__("../../node_modules/.pnpm/available-typed-arrays@1.0.7/node_modules/available-typed-arrays/index.js");
|
|
11355
11356
|
var callBind = __webpack_require__("../../node_modules/.pnpm/call-bind@1.0.8/node_modules/call-bind/index.js");
|
|
@@ -11377,12 +11378,18 @@ __webpack_require__.add({
|
|
|
11377
11378
|
var superProto = getProto(proto);
|
|
11378
11379
|
descriptor = gOPD(superProto, Symbol.toStringTag);
|
|
11379
11380
|
}
|
|
11380
|
-
|
|
11381
|
+
if (descriptor && descriptor.get) {
|
|
11382
|
+
var bound = callBind(descriptor.get);
|
|
11383
|
+
cache['$' + typedArray] = bound;
|
|
11384
|
+
}
|
|
11381
11385
|
}
|
|
11382
11386
|
}) : forEach(typedArrays, function(typedArray) {
|
|
11383
11387
|
var arr = new g[typedArray]();
|
|
11384
11388
|
var fn = arr.slice || arr.set;
|
|
11385
|
-
if (fn)
|
|
11389
|
+
if (fn) {
|
|
11390
|
+
var bound = callBind(fn);
|
|
11391
|
+
cache['$' + typedArray] = bound;
|
|
11392
|
+
}
|
|
11386
11393
|
});
|
|
11387
11394
|
var tryTypedArrays = function(value) {
|
|
11388
11395
|
var found = false;
|
|
@@ -11443,19 +11450,7 @@ __webpack_require__.d(id_gen_namespaceObject, {
|
|
|
11443
11450
|
UniID: ()=>id_gen_UniID,
|
|
11444
11451
|
createDMID: ()=>createDMID
|
|
11445
11452
|
});
|
|
11446
|
-
var
|
|
11447
|
-
__webpack_require__.r(platform_namespaceObject);
|
|
11448
|
-
__webpack_require__.d(platform_namespaceObject, {
|
|
11449
|
-
PlatformDanmakuOnlySource: ()=>platform_PlatformDanmakuOnlySource,
|
|
11450
|
-
PlatformDanmakuOnlySources: ()=>PlatformDanmakuOnlySources,
|
|
11451
|
-
PlatformDanmakuSources: ()=>PlatformDanmakuSources,
|
|
11452
|
-
PlatformInfoSource: ()=>platform_PlatformInfoSource,
|
|
11453
|
-
PlatformInfoSources: ()=>PlatformInfoSources,
|
|
11454
|
-
PlatformSources: ()=>PlatformSources,
|
|
11455
|
-
PlatformVideoSource: ()=>platform_PlatformVideoSource,
|
|
11456
|
-
PlatformVideoSources: ()=>PlatformVideoSources
|
|
11457
|
-
});
|
|
11458
|
-
var package_namespaceObject = JSON.parse('{"UU":"@dan-uni/dan-any","rE":"1.0.1","TB":"https://github.com/ani-uni/danuni/tree/master/packages/dan-any#readme"}');
|
|
11453
|
+
var package_namespaceObject = JSON.parse('{"UU":"@dan-uni/dan-any","rE":"1.1.1","TB":"https://github.com/ani-uni/danuni/tree/master/packages/dan-any#readme"}');
|
|
11459
11454
|
const color_pad = (s)=>s.length < 2 ? `0${s}` : s;
|
|
11460
11455
|
const decimalToHex = (n)=>color_pad(n.toString(16));
|
|
11461
11456
|
const isDarkColor = ({ r, g, b })=>0.299 * r + 0.587 * g + 0.114 * b < 0x30;
|
|
@@ -11492,37 +11487,6 @@ const formatColor = ({ r, g, b }, opacity)=>{
|
|
|
11492
11487
|
};
|
|
11493
11488
|
const getDecoratingColor = (color)=>isDarkColor(color) ? WHITE : BLACK;
|
|
11494
11489
|
const isWhite = (color)=>255 === color.r && 255 === color.g && 255 === color.b;
|
|
11495
|
-
var platform_PlatformInfoSource = /*#__PURE__*/ function(PlatformInfoSource) {
|
|
11496
|
-
PlatformInfoSource["Bangumi"] = "bgm";
|
|
11497
|
-
PlatformInfoSource["TMDB"] = "tmdb";
|
|
11498
|
-
return PlatformInfoSource;
|
|
11499
|
-
}({});
|
|
11500
|
-
const PlatformInfoSources = Object.values(platform_PlatformInfoSource);
|
|
11501
|
-
var platform_PlatformVideoSource = /*#__PURE__*/ function(PlatformVideoSource) {
|
|
11502
|
-
PlatformVideoSource["Acfun"] = "acfun";
|
|
11503
|
-
PlatformVideoSource["Baha"] = "baha";
|
|
11504
|
-
PlatformVideoSource["Bilibili"] = "bili";
|
|
11505
|
-
PlatformVideoSource["BilibiliGlobal"] = "bglobal";
|
|
11506
|
-
PlatformVideoSource["Iqiyi"] = "iqiyi";
|
|
11507
|
-
PlatformVideoSource["Tencent"] = "tencent";
|
|
11508
|
-
PlatformVideoSource["Youku"] = "youku";
|
|
11509
|
-
return PlatformVideoSource;
|
|
11510
|
-
}({});
|
|
11511
|
-
const PlatformVideoSources = Object.values(platform_PlatformVideoSource);
|
|
11512
|
-
var platform_PlatformDanmakuOnlySource = /*#__PURE__*/ function(PlatformDanmakuOnlySource) {
|
|
11513
|
-
PlatformDanmakuOnlySource["DanDanPlay"] = "ddplay";
|
|
11514
|
-
PlatformDanmakuOnlySource["TuCao"] = "tucao";
|
|
11515
|
-
return PlatformDanmakuOnlySource;
|
|
11516
|
-
}({});
|
|
11517
|
-
const PlatformDanmakuOnlySources = Object.values(platform_PlatformDanmakuOnlySource);
|
|
11518
|
-
const PlatformDanmakuSources = [
|
|
11519
|
-
...PlatformVideoSources,
|
|
11520
|
-
...PlatformDanmakuOnlySources
|
|
11521
|
-
];
|
|
11522
|
-
const PlatformSources = [
|
|
11523
|
-
...PlatformInfoSources,
|
|
11524
|
-
...PlatformDanmakuSources
|
|
11525
|
-
];
|
|
11526
11490
|
class id_gen_UniID {
|
|
11527
11491
|
constructor(id, domain){
|
|
11528
11492
|
this.id = id;
|
|
@@ -13280,4 +13244,5 @@ class UniPool {
|
|
|
13280
13244
|
}, canvasCtx);
|
|
13281
13245
|
}
|
|
13282
13246
|
}
|
|
13283
|
-
export {
|
|
13247
|
+
export { platform } from "./42.min.js";
|
|
13248
|
+
export { UniDM, UniPool, dm_gen_namespaceObject as UniDMTools, id_gen_namespaceObject as UniIDTools };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { bili_dedupe as default } from "../157.min.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { bili_dedupe } from "../157.min.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/node/157.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { platform_PlatformVideoSource } from "./42.js";
|
|
2
|
+
function bili_dedupe(that) {
|
|
3
|
+
that.dans.forEach((d)=>{
|
|
4
|
+
if (d.platform !== platform_PlatformVideoSource.Bilibili) throw new Error('bili-dedupe: 仅支持B站(主站)的弹幕');
|
|
5
|
+
if (!d.extra.bili?.dmid) throw new Error('bili-dedupe: 弹幕缺少bili extra dmid字段');
|
|
6
|
+
});
|
|
7
|
+
const map = new Map();
|
|
8
|
+
that.dans.forEach((d)=>map.set(d.extra.bili.dmid, d));
|
|
9
|
+
that.dans = [
|
|
10
|
+
...map.values()
|
|
11
|
+
];
|
|
12
|
+
return that;
|
|
13
|
+
}
|
|
14
|
+
export { bili_dedupe };
|
package/dist/node/42.js
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { __webpack_require__ } from "./rslib-runtime.js";
|
|
2
|
+
var platform_namespaceObject = {};
|
|
3
|
+
__webpack_require__.r(platform_namespaceObject);
|
|
4
|
+
__webpack_require__.d(platform_namespaceObject, {
|
|
5
|
+
PlatformDanmakuOnlySource: ()=>platform_PlatformDanmakuOnlySource,
|
|
6
|
+
PlatformDanmakuOnlySources: ()=>PlatformDanmakuOnlySources,
|
|
7
|
+
PlatformDanmakuSources: ()=>PlatformDanmakuSources,
|
|
8
|
+
PlatformInfoSource: ()=>platform_PlatformInfoSource,
|
|
9
|
+
PlatformInfoSources: ()=>PlatformInfoSources,
|
|
10
|
+
PlatformSources: ()=>PlatformSources,
|
|
11
|
+
PlatformVideoSource: ()=>platform_PlatformVideoSource,
|
|
12
|
+
PlatformVideoSources: ()=>PlatformVideoSources
|
|
13
|
+
});
|
|
14
|
+
var platform_PlatformInfoSource = /*#__PURE__*/ function(PlatformInfoSource) {
|
|
15
|
+
PlatformInfoSource["Bangumi"] = "bgm";
|
|
16
|
+
PlatformInfoSource["TMDB"] = "tmdb";
|
|
17
|
+
return PlatformInfoSource;
|
|
18
|
+
}({});
|
|
19
|
+
const PlatformInfoSources = Object.values(platform_PlatformInfoSource);
|
|
20
|
+
var platform_PlatformVideoSource = /*#__PURE__*/ function(PlatformVideoSource) {
|
|
21
|
+
PlatformVideoSource["Acfun"] = "acfun";
|
|
22
|
+
PlatformVideoSource["Baha"] = "baha";
|
|
23
|
+
PlatformVideoSource["Bilibili"] = "bili";
|
|
24
|
+
PlatformVideoSource["BilibiliGlobal"] = "bglobal";
|
|
25
|
+
PlatformVideoSource["Iqiyi"] = "iqiyi";
|
|
26
|
+
PlatformVideoSource["Tencent"] = "tencent";
|
|
27
|
+
PlatformVideoSource["Youku"] = "youku";
|
|
28
|
+
return PlatformVideoSource;
|
|
29
|
+
}({});
|
|
30
|
+
const PlatformVideoSources = Object.values(platform_PlatformVideoSource);
|
|
31
|
+
var platform_PlatformDanmakuOnlySource = /*#__PURE__*/ function(PlatformDanmakuOnlySource) {
|
|
32
|
+
PlatformDanmakuOnlySource["DanDanPlay"] = "ddplay";
|
|
33
|
+
PlatformDanmakuOnlySource["TuCao"] = "tucao";
|
|
34
|
+
return PlatformDanmakuOnlySource;
|
|
35
|
+
}({});
|
|
36
|
+
const PlatformDanmakuOnlySources = Object.values(platform_PlatformDanmakuOnlySource);
|
|
37
|
+
const PlatformDanmakuSources = [
|
|
38
|
+
...PlatformVideoSources,
|
|
39
|
+
...PlatformDanmakuOnlySources
|
|
40
|
+
];
|
|
41
|
+
const PlatformSources = [
|
|
42
|
+
...PlatformInfoSources,
|
|
43
|
+
...PlatformDanmakuSources
|
|
44
|
+
];
|
|
45
|
+
export { PlatformDanmakuSources, platform_PlatformDanmakuOnlySource, platform_PlatformVideoSource, platform_namespaceObject as platform };
|
|
@@ -11,6 +11,7 @@ import jssha from "jssha";
|
|
|
11
11
|
import { brotliCompressSync, brotliDecompressSync, gunzipSync, gzipSync } from "node:zlib";
|
|
12
12
|
import { decode, encode as external_base16384_encode } from "base16384";
|
|
13
13
|
import { fileDesc, messageDesc as codegenv2_messageDesc } from "@bufbuild/protobuf/codegenv2";
|
|
14
|
+
import { platform_PlatformVideoSource, PlatformDanmakuSources, platform_PlatformDanmakuOnlySource } from "./42.js";
|
|
14
15
|
var dm_gen_namespaceObject = {};
|
|
15
16
|
__webpack_require__.r(dm_gen_namespaceObject);
|
|
16
17
|
__webpack_require__.d(dm_gen_namespaceObject, {
|
|
@@ -27,19 +28,7 @@ __webpack_require__.d(id_gen_namespaceObject, {
|
|
|
27
28
|
UniID: ()=>id_gen_UniID,
|
|
28
29
|
createDMID: ()=>createDMID
|
|
29
30
|
});
|
|
30
|
-
var
|
|
31
|
-
__webpack_require__.r(platform_namespaceObject);
|
|
32
|
-
__webpack_require__.d(platform_namespaceObject, {
|
|
33
|
-
PlatformDanmakuOnlySource: ()=>platform_PlatformDanmakuOnlySource,
|
|
34
|
-
PlatformDanmakuOnlySources: ()=>PlatformDanmakuOnlySources,
|
|
35
|
-
PlatformDanmakuSources: ()=>PlatformDanmakuSources,
|
|
36
|
-
PlatformInfoSource: ()=>platform_PlatformInfoSource,
|
|
37
|
-
PlatformInfoSources: ()=>PlatformInfoSources,
|
|
38
|
-
PlatformSources: ()=>PlatformSources,
|
|
39
|
-
PlatformVideoSource: ()=>platform_PlatformVideoSource,
|
|
40
|
-
PlatformVideoSources: ()=>PlatformVideoSources
|
|
41
|
-
});
|
|
42
|
-
var package_namespaceObject = JSON.parse('{"UU":"@dan-uni/dan-any","rE":"1.0.1","TB":"https://github.com/ani-uni/danuni/tree/master/packages/dan-any#readme"}');
|
|
31
|
+
var package_namespaceObject = JSON.parse('{"UU":"@dan-uni/dan-any","rE":"1.1.1","TB":"https://github.com/ani-uni/danuni/tree/master/packages/dan-any#readme"}');
|
|
43
32
|
const color_pad = (s)=>s.length < 2 ? `0${s}` : s;
|
|
44
33
|
const decimalToHex = (n)=>color_pad(n.toString(16));
|
|
45
34
|
const isDarkColor = ({ r, g, b })=>0.299 * r + 0.587 * g + 0.114 * b < 0x30;
|
|
@@ -76,37 +65,6 @@ const formatColor = ({ r, g, b }, opacity)=>{
|
|
|
76
65
|
};
|
|
77
66
|
const getDecoratingColor = (color)=>isDarkColor(color) ? WHITE : BLACK;
|
|
78
67
|
const isWhite = (color)=>255 === color.r && 255 === color.g && 255 === color.b;
|
|
79
|
-
var platform_PlatformInfoSource = /*#__PURE__*/ function(PlatformInfoSource) {
|
|
80
|
-
PlatformInfoSource["Bangumi"] = "bgm";
|
|
81
|
-
PlatformInfoSource["TMDB"] = "tmdb";
|
|
82
|
-
return PlatformInfoSource;
|
|
83
|
-
}({});
|
|
84
|
-
const PlatformInfoSources = Object.values(platform_PlatformInfoSource);
|
|
85
|
-
var platform_PlatformVideoSource = /*#__PURE__*/ function(PlatformVideoSource) {
|
|
86
|
-
PlatformVideoSource["Acfun"] = "acfun";
|
|
87
|
-
PlatformVideoSource["Baha"] = "baha";
|
|
88
|
-
PlatformVideoSource["Bilibili"] = "bili";
|
|
89
|
-
PlatformVideoSource["BilibiliGlobal"] = "bglobal";
|
|
90
|
-
PlatformVideoSource["Iqiyi"] = "iqiyi";
|
|
91
|
-
PlatformVideoSource["Tencent"] = "tencent";
|
|
92
|
-
PlatformVideoSource["Youku"] = "youku";
|
|
93
|
-
return PlatformVideoSource;
|
|
94
|
-
}({});
|
|
95
|
-
const PlatformVideoSources = Object.values(platform_PlatformVideoSource);
|
|
96
|
-
var platform_PlatformDanmakuOnlySource = /*#__PURE__*/ function(PlatformDanmakuOnlySource) {
|
|
97
|
-
PlatformDanmakuOnlySource["DanDanPlay"] = "ddplay";
|
|
98
|
-
PlatformDanmakuOnlySource["TuCao"] = "tucao";
|
|
99
|
-
return PlatformDanmakuOnlySource;
|
|
100
|
-
}({});
|
|
101
|
-
const PlatformDanmakuOnlySources = Object.values(platform_PlatformDanmakuOnlySource);
|
|
102
|
-
const PlatformDanmakuSources = [
|
|
103
|
-
...PlatformVideoSources,
|
|
104
|
-
...PlatformDanmakuOnlySources
|
|
105
|
-
];
|
|
106
|
-
const PlatformSources = [
|
|
107
|
-
...PlatformInfoSources,
|
|
108
|
-
...PlatformDanmakuSources
|
|
109
|
-
];
|
|
110
68
|
class id_gen_UniID {
|
|
111
69
|
constructor(id, domain){
|
|
112
70
|
this.id = id;
|
|
@@ -1861,4 +1819,5 @@ class UniPool {
|
|
|
1861
1819
|
}, canvasCtx);
|
|
1862
1820
|
}
|
|
1863
1821
|
}
|
|
1864
|
-
export {
|
|
1822
|
+
export { platform } from "./42.js";
|
|
1823
|
+
export { UniDM, UniPool, dm_gen_namespaceObject as UniDMTools, id_gen_namespaceObject as UniIDTools };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { bili_dedupe as default } from "../157.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { bili_dedupe } from "../157.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { UniPool } from '../..';
|
|
2
|
+
import type { Context, SubtitleStyle } from '../types';
|
|
3
|
+
import type { RawConfig } from './raw';
|
|
4
|
+
export declare const ass: (list: UniPool, rawList: UniPool, config: SubtitleStyle, context?: Context, rawConfig?: RawConfig) => string;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { RGB } from '../types';
|
|
2
|
+
import { DanmakuType } from '../types';
|
|
3
|
+
export declare const dialogue: (danmaku: {
|
|
4
|
+
type: (typeof DanmakuType)[keyof typeof DanmakuType];
|
|
5
|
+
color: RGB;
|
|
6
|
+
fontSizeType: number;
|
|
7
|
+
content: string;
|
|
8
|
+
time: number;
|
|
9
|
+
start: number;
|
|
10
|
+
end: number;
|
|
11
|
+
top: number;
|
|
12
|
+
left: number;
|
|
13
|
+
}, config: {
|
|
14
|
+
scrollTime: number;
|
|
15
|
+
fixTime: number;
|
|
16
|
+
}) => string;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Context, Danmaku, SubtitleStyle } from '../types';
|
|
2
|
+
type compressType = 'brotli' | 'gzip';
|
|
3
|
+
type baseType = 'base64' | 'base18384';
|
|
4
|
+
export interface RawConfig {
|
|
5
|
+
compressType: compressType;
|
|
6
|
+
baseType: baseType;
|
|
7
|
+
}
|
|
8
|
+
export declare function raw(list: Danmaku[], config: SubtitleStyle, context: Context, compressType?: compressType, baseType?: baseType): string;
|
|
9
|
+
export declare function deRaw(ass: string): {
|
|
10
|
+
list: Danmaku[];
|
|
11
|
+
config: SubtitleStyle;
|
|
12
|
+
context: Context;
|
|
13
|
+
} | undefined;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { Options as UniPoolOptions } from '..';
|
|
2
|
+
import type { RawConfig } from './ass/raw';
|
|
3
|
+
import type { CanvasCtx, SubtitleStyle } from './types';
|
|
4
|
+
import { UniPool } from '..';
|
|
5
|
+
export { CanvasCtx };
|
|
6
|
+
export type Options = {
|
|
7
|
+
filename?: string;
|
|
8
|
+
title?: string;
|
|
9
|
+
substyle?: Partial<SubtitleStyle>;
|
|
10
|
+
raw?: RawConfig;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* 使用bilibili弹幕(XMl)生成ASS字幕文件
|
|
14
|
+
* @param {string} danmaku XML弹幕文件内容
|
|
15
|
+
* @param {Options} options 杂项
|
|
16
|
+
* @returns {string} 返回ASS字幕文件内容
|
|
17
|
+
* @description 杂项相关
|
|
18
|
+
`filename`: 还原文件为XML时使用的默认文件名
|
|
19
|
+
`title`: ASS [Script Info] Title 项的值,显示于播放器字幕选择
|
|
20
|
+
`substyle`: ASS字幕样式
|
|
21
|
+
* @example ```ts
|
|
22
|
+
import fs from 'fs'
|
|
23
|
+
const filename = 'example.xml'
|
|
24
|
+
const xmlText = fs.readFileSync(filename, 'utf-8')
|
|
25
|
+
const assText = generateASS(xmlText, { filename, title: 'Quick Example' })
|
|
26
|
+
fs.writeFileSync(`${filename}.ass`, assText, 'utf-8')
|
|
27
|
+
```
|
|
28
|
+
*/
|
|
29
|
+
export declare function generateASS(danmaku: UniPool, options: Options, canvasCtx: CanvasCtx): string;
|
|
30
|
+
export declare function parseAssRawField(ass: string, options?: UniPoolOptions): UniPool;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import type { CanvasRenderingContext2D as NodeCRCtx2D } from 'canvas';
|
|
2
|
+
import type { UniDM } from '../utils/dm-gen';
|
|
3
|
+
/**
|
|
4
|
+
* 请根据您的使用环境提供一个 50x50 的 2D Canvas 上下文
|
|
5
|
+
* @example
|
|
6
|
+
* // Node.js + canvas
|
|
7
|
+
* import { createCanvas } from 'canvas'
|
|
8
|
+
* const canvas = createCanvas(50, 50)
|
|
9
|
+
* const ctx = canvas.getContext('2d')
|
|
10
|
+
* @example
|
|
11
|
+
* // Node.js + Fabric.js
|
|
12
|
+
* import { StaticCanvas } from 'fabric/node'
|
|
13
|
+
* const ctx = new StaticCanvas(null, { width: 50, height: 50 }).getContext()
|
|
14
|
+
* @example
|
|
15
|
+
* // Browser + Native Canvas
|
|
16
|
+
* const canvas = document.createElement('canvas')
|
|
17
|
+
* canvas.width = 50
|
|
18
|
+
* canvas.height = 50
|
|
19
|
+
* const ctx = canvas.getContext('2d')
|
|
20
|
+
* @example
|
|
21
|
+
* // Browser + Fabric.js
|
|
22
|
+
* import { Canvas } from 'fabric'
|
|
23
|
+
* const ctx = new Canvas('canvas', { width: 50, height: 50 }).getContext()
|
|
24
|
+
*/
|
|
25
|
+
export type CanvasCtx = NodeCRCtx2D | CanvasRenderingContext2D;
|
|
26
|
+
export interface Context {
|
|
27
|
+
filename: string;
|
|
28
|
+
title: string;
|
|
29
|
+
}
|
|
30
|
+
export interface SubtitleStyle {
|
|
31
|
+
fontSize: number[];
|
|
32
|
+
fontName: string;
|
|
33
|
+
color: string;
|
|
34
|
+
outlineColor?: string;
|
|
35
|
+
backColor?: string;
|
|
36
|
+
outline: number;
|
|
37
|
+
shadow: number;
|
|
38
|
+
bold: boolean;
|
|
39
|
+
padding: number[];
|
|
40
|
+
playResX: number;
|
|
41
|
+
playResY: number;
|
|
42
|
+
scrollTime: number;
|
|
43
|
+
fixTime: number;
|
|
44
|
+
opacity: number;
|
|
45
|
+
bottomSpace: number;
|
|
46
|
+
includeRaw: boolean;
|
|
47
|
+
mergeIn: number;
|
|
48
|
+
}
|
|
49
|
+
export type RGB = {
|
|
50
|
+
r: number;
|
|
51
|
+
g: number;
|
|
52
|
+
b: number;
|
|
53
|
+
};
|
|
54
|
+
export declare const DanmakuType: {
|
|
55
|
+
SCROLL: number;
|
|
56
|
+
BOTTOM: number;
|
|
57
|
+
TOP: number;
|
|
58
|
+
};
|
|
59
|
+
export declare const FontSize: {
|
|
60
|
+
SMALL: number;
|
|
61
|
+
NORMAL: number;
|
|
62
|
+
LARGE: number;
|
|
63
|
+
};
|
|
64
|
+
export type Danmaku = {
|
|
65
|
+
time: number;
|
|
66
|
+
type: number;
|
|
67
|
+
fontSizeType: number;
|
|
68
|
+
color: RGB;
|
|
69
|
+
content: string;
|
|
70
|
+
extra: UniDM;
|
|
71
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { RGB } from '../types';
|
|
2
|
+
export declare const hexColorToRGB: (hex: string) => {
|
|
3
|
+
r: number;
|
|
4
|
+
g: number;
|
|
5
|
+
b: number;
|
|
6
|
+
};
|
|
7
|
+
export declare const decimalColorToRGB: (decimal: number) => {
|
|
8
|
+
r: number;
|
|
9
|
+
g: number;
|
|
10
|
+
b: number;
|
|
11
|
+
};
|
|
12
|
+
export declare const formatColor: ({ r, g, b }: RGB, opacity?: number) => string;
|
|
13
|
+
export declare const getDecoratingColor: (color: RGB) => {
|
|
14
|
+
r: number;
|
|
15
|
+
g: number;
|
|
16
|
+
b: number;
|
|
17
|
+
};
|
|
18
|
+
export declare const isWhite: (color: RGB) => boolean;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Options as UniPoolOptions } from '../..';
|
|
2
|
+
import type { Danmaku } from '../types';
|
|
3
|
+
import { UniPool } from '../..';
|
|
4
|
+
export declare function UniPool2DanmakuLists(UP: UniPool): Danmaku[];
|
|
5
|
+
export declare function DanmakuList2UniPool(d: Danmaku[], options?: UniPoolOptions): UniPool;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { decimalColorToRGB, formatColor, getDecoratingColor, hexColorToRGB, isWhite, } from './color';
|
|
2
|
+
export { DanmakuList2UniPool, UniPool2DanmakuLists } from './danconvert';
|
|
3
|
+
export { arrayOfLength, assign, uniqueArray } from './lang';
|
|
4
|
+
export { layoutDanmaku } from './layout';
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { UniPool } from '../..';
|
|
2
|
+
import type { CanvasCtx, SubtitleStyle } from '../types';
|
|
3
|
+
export declare const measureTextWidthConstructor: (canvasContext: CanvasCtx) => (fontName: string, fontSize: number, bold: boolean, text: string) => number;
|
|
4
|
+
export declare const layoutDanmaku: (inputList: UniPool, config: SubtitleStyle, canvasCtx: CanvasCtx) => UniPool;
|