@xcpcio/core 0.52.1 → 0.53.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.cjs +2008 -1683
- package/dist/index.d.cts +519 -0
- package/dist/index.d.mts +519 -0
- package/dist/index.d.ts +127 -127
- package/dist/index.mjs +1990 -1663
- package/package.json +21 -21
- package/src/balloon.ts +1 -1
- package/src/battle-of-giants.ts +3 -2
- package/src/contest-index.ts +2 -3
- package/src/contest.ts +6 -6
- package/src/export/cf.ts +2 -2
- package/src/export/general-excel.ts +5 -3
- package/src/export/icpc-standings-csv.ts +4 -3
- package/src/index.ts +6 -7
- package/src/problem.ts +3 -3
- package/src/rank.ts +12 -12
- package/src/rating/index.ts +1 -1
- package/src/rating/rating-history.ts +3 -3
- package/src/rating/rating.ts +2 -3
- package/src/resolver-vue.ts +4 -3
- package/src/resolver.ts +7 -6
- package/src/team.ts +6 -6
- package/src/utils/dayjs.ts +4 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xcpcio/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.53.0",
|
|
4
4
|
"description": "XCPCIO Core",
|
|
5
5
|
"author": "Dup4 <lyuzhi.pan@gmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
"exports": {
|
|
21
21
|
".": {
|
|
22
22
|
"types": "./dist/index.d.ts",
|
|
23
|
-
"
|
|
24
|
-
"
|
|
23
|
+
"import": "./dist/index.mjs",
|
|
24
|
+
"require": "./dist/index.cjs"
|
|
25
25
|
}
|
|
26
26
|
},
|
|
27
27
|
"main": "./dist/index.mjs",
|
|
@@ -36,39 +36,39 @@
|
|
|
36
36
|
}
|
|
37
37
|
},
|
|
38
38
|
"files": [
|
|
39
|
-
"
|
|
40
|
-
"
|
|
39
|
+
"dist",
|
|
40
|
+
"src"
|
|
41
41
|
],
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"chroma-js": "^
|
|
43
|
+
"chroma-js": "^3.1.1",
|
|
44
44
|
"color-diff": "^1.4.0",
|
|
45
45
|
"dayjs": "^1.11.13",
|
|
46
46
|
"js-base64": "^3.7.7",
|
|
47
47
|
"lodash": "^4.17.21",
|
|
48
48
|
"ordinal": "^1.0.3",
|
|
49
49
|
"papaparse": "^5.4.1",
|
|
50
|
-
"string-width": "^
|
|
50
|
+
"string-width": "^7.2.0",
|
|
51
51
|
"xlsx-js-style": "^1.2.0",
|
|
52
|
-
"@xcpcio/types": "0.
|
|
52
|
+
"@xcpcio/types": "0.53.0"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
|
-
"@babel/types": "^7.25.
|
|
55
|
+
"@babel/types": "^7.25.7",
|
|
56
56
|
"@types/chroma-js": "^2.4.4",
|
|
57
57
|
"@types/color-diff": "^1.2.5",
|
|
58
|
-
"@types/lodash": "^4.17.
|
|
59
|
-
"@types/node": "^18.19.
|
|
58
|
+
"@types/lodash": "^4.17.10",
|
|
59
|
+
"@types/node": "^18.19.55",
|
|
60
60
|
"@types/papaparse": "^5.3.14",
|
|
61
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
62
|
-
"@typescript-eslint/parser": "^
|
|
63
|
-
"bumpp": "^7.
|
|
64
|
-
"eslint": "^
|
|
65
|
-
"esmo": "^
|
|
61
|
+
"@typescript-eslint/eslint-plugin": "^8.8.1",
|
|
62
|
+
"@typescript-eslint/parser": "^8.8.1",
|
|
63
|
+
"bumpp": "^9.7.1",
|
|
64
|
+
"eslint": "^9.12.0",
|
|
65
|
+
"esmo": "^4.8.0",
|
|
66
66
|
"npm-run-all": "^4.1.5",
|
|
67
|
-
"pnpm": "^
|
|
68
|
-
"taze": "^0.
|
|
69
|
-
"typescript": "^
|
|
70
|
-
"unbuild": "^0.
|
|
71
|
-
"vite": "^4.
|
|
67
|
+
"pnpm": "^9.12.1",
|
|
68
|
+
"taze": "^0.17.2",
|
|
69
|
+
"typescript": "^5.6.3",
|
|
70
|
+
"unbuild": "^2.0.0",
|
|
71
|
+
"vite": "^5.4.8",
|
|
72
72
|
"vitest": "^2.1.2"
|
|
73
73
|
},
|
|
74
74
|
"scripts": {
|
package/src/balloon.ts
CHANGED
package/src/battle-of-giants.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { type SelectOptionItem } from "./basic-types";
|
|
1
|
+
import type { SelectOptionItem } from "./basic-types";
|
|
3
2
|
import type { Team } from "./team";
|
|
4
3
|
|
|
4
|
+
import { Base64 } from "js-base64";
|
|
5
|
+
|
|
5
6
|
export enum GiantsType {
|
|
6
7
|
BLUE,
|
|
7
8
|
RED,
|
package/src/contest-index.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import type dayjs from "dayjs";
|
|
2
|
-
|
|
3
1
|
import type { Contest as IContest, ContestIndex as IContestIndex, Image } from "@xcpcio/types";
|
|
2
|
+
import type dayjs from "dayjs";
|
|
4
3
|
|
|
5
|
-
import { createDayJS } from "./utils";
|
|
6
4
|
import { Contest, createContest } from "./contest";
|
|
5
|
+
import { createDayJS } from "./utils";
|
|
7
6
|
|
|
8
7
|
export class ContestIndexConfig {
|
|
9
8
|
contestName: string;
|
package/src/contest.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import type { BannerMode, Contest as IContest, Image, MedalPreset, StatusTimeDisplay } from "@xcpcio/types";
|
|
2
|
-
import {
|
|
3
|
-
|
|
2
|
+
import type { Awards } from "./award";
|
|
4
3
|
import type { Problem, Problems } from "./problem";
|
|
4
|
+
|
|
5
|
+
import { ContestState } from "@xcpcio/types";
|
|
6
|
+
import { Award, MedalType } from "./award";
|
|
7
|
+
import { ContestOptions, createContestOptions } from "./contest-options";
|
|
8
|
+
import { Group } from "./group";
|
|
5
9
|
import { createProblems, createProblemsByProblemIds } from "./problem";
|
|
6
10
|
import { createDayJS, dayjs, getTimeDiff } from "./utils";
|
|
7
|
-
import { Group } from "./group";
|
|
8
|
-
import { Award } from "./award";
|
|
9
|
-
import { type Awards, MedalType } from "./award";
|
|
10
|
-
import { ContestOptions, createContestOptions } from "./contest-options";
|
|
11
11
|
|
|
12
12
|
export class Contest {
|
|
13
13
|
id = "";
|
package/src/export/cf.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import type { Rank } from "../rank";
|
|
2
|
+
|
|
1
3
|
import _ from "lodash";
|
|
2
|
-
import * as XLSX from "xlsx-js-style";
|
|
3
4
|
import stringWidth from "string-width";
|
|
5
|
+
import * as XLSX from "xlsx-js-style";
|
|
4
6
|
|
|
5
7
|
import { isValidMedalType } from "../award";
|
|
6
|
-
import type { Rank } from "../rank";
|
|
7
8
|
|
|
8
9
|
export class GeneralExcelConverter {
|
|
9
10
|
constructor() {}
|
|
@@ -33,7 +34,8 @@ export class GeneralExcelConverter {
|
|
|
33
34
|
filename,
|
|
34
35
|
{
|
|
35
36
|
compression: true,
|
|
36
|
-
}
|
|
37
|
+
},
|
|
38
|
+
);
|
|
37
39
|
}
|
|
38
40
|
|
|
39
41
|
private convertToSheet(rank: Rank): XLSX.WorkSheet {
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import type { Rank } from "../rank";
|
|
2
|
+
import type { Team } from "../team";
|
|
3
|
+
|
|
1
4
|
import _ from "lodash";
|
|
2
|
-
import Papa from "papaparse";
|
|
3
5
|
import ordinal from "ordinal";
|
|
6
|
+
import Papa from "papaparse";
|
|
4
7
|
|
|
5
|
-
import type { Rank } from "../rank";
|
|
6
|
-
import type { Team } from "../team";
|
|
7
8
|
import { isValidMedalType } from "../award";
|
|
8
9
|
|
|
9
10
|
interface ICPCTeamResult {
|
package/src/index.ts
CHANGED
|
@@ -1,20 +1,19 @@
|
|
|
1
|
-
export * from "./export";
|
|
2
|
-
export * from "./rating";
|
|
3
|
-
export * from "./utils";
|
|
4
|
-
|
|
5
1
|
export * from "./award";
|
|
6
2
|
export * from "./balloon";
|
|
7
3
|
export * from "./basic-types";
|
|
8
4
|
export * from "./battle-of-giants";
|
|
9
|
-
export * from "./contest-index";
|
|
10
5
|
export * from "./contest";
|
|
6
|
+
export * from "./contest-index";
|
|
7
|
+
export * from "./export";
|
|
11
8
|
export * from "./image";
|
|
12
9
|
export * from "./person";
|
|
13
10
|
export * from "./problem";
|
|
14
|
-
export * from "./rank-statistics";
|
|
15
11
|
export * from "./rank";
|
|
12
|
+
export * from "./rank-statistics";
|
|
13
|
+
export * from "./rating";
|
|
16
14
|
export * from "./resolver";
|
|
17
15
|
export * from "./resolver-vue";
|
|
18
|
-
export * from "./submission-status";
|
|
19
16
|
export * from "./submission";
|
|
17
|
+
export * from "./submission-status";
|
|
20
18
|
export * from "./team";
|
|
19
|
+
export * from "./utils";
|
package/src/problem.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import _ from "lodash";
|
|
2
|
-
|
|
3
1
|
import type { BalloonColor, Problem as IProblem, Problems as IProblems } from "@xcpcio/types";
|
|
4
|
-
|
|
5
2
|
import type { Submissions } from "./submission";
|
|
3
|
+
|
|
4
|
+
import _ from "lodash";
|
|
5
|
+
|
|
6
6
|
import { calcDirt, getWhiteOrBlackColor } from "./utils";
|
|
7
7
|
|
|
8
8
|
export class ProblemStatistics {
|
package/src/rank.ts
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import _ from "lodash";
|
|
2
|
-
|
|
3
1
|
import type { SubmissionStatus } from "@xcpcio/types";
|
|
4
|
-
|
|
2
|
+
import type { SelectOptionItem } from "./basic-types";
|
|
5
3
|
import type { Contest } from "./contest";
|
|
6
|
-
import type { Teams } from "./team";
|
|
7
|
-
import { Team } from "./team";
|
|
8
4
|
import type { Submissions } from "./submission";
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
import
|
|
12
|
-
|
|
5
|
+
import type { Teams } from "./team";
|
|
6
|
+
|
|
7
|
+
import _ from "lodash";
|
|
8
|
+
|
|
13
9
|
import { Award, MedalType } from "./award";
|
|
14
|
-
import { type
|
|
10
|
+
import { Balloon, type Balloons } from "./balloon";
|
|
15
11
|
import { BattleOfGiants } from "./battle-of-giants";
|
|
12
|
+
import { TeamProblemStatistics } from "./problem";
|
|
13
|
+
import { RankStatistics } from "./rank-statistics";
|
|
14
|
+
import { Submission } from "./submission";
|
|
15
|
+
import { Team } from "./team";
|
|
16
16
|
|
|
17
17
|
export class RankOptions {
|
|
18
18
|
enableFilterSubmissionsByTimestamp: boolean;
|
|
@@ -264,8 +264,8 @@ export class Rank {
|
|
|
264
264
|
|
|
265
265
|
(() => {
|
|
266
266
|
this.rankStatistics.reset();
|
|
267
|
-
this.rankStatistics.teamSolvedNum = Array(this.contest.problems.length + 1).fill(0);
|
|
268
|
-
this.rankStatistics.teamSolvedNumIndex = Array(this.contest.problems.length + 1).fill(0);
|
|
267
|
+
this.rankStatistics.teamSolvedNum = Array.from({ length: this.contest.problems.length + 1 }).fill(0) as number[];
|
|
268
|
+
this.rankStatistics.teamSolvedNumIndex = Array.from({ length: this.contest.problems.length + 1 }).fill(0) as number[];
|
|
269
269
|
})();
|
|
270
270
|
|
|
271
271
|
let preSubmissionTimestampToMinute = 0;
|
package/src/rating/index.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { IRatingHistory } from "@xcpcio/types";
|
|
2
|
-
|
|
2
|
+
import type { Persons } from "../person";
|
|
3
3
|
import type { dayjs } from "../utils";
|
|
4
|
-
|
|
4
|
+
|
|
5
5
|
import { Person } from "../person";
|
|
6
|
-
import
|
|
6
|
+
import { createDayJS } from "../utils";
|
|
7
7
|
|
|
8
8
|
export class RatingHistory {
|
|
9
9
|
rank: number;
|
package/src/rating/rating.ts
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import type { IRating } from "@xcpcio/types";
|
|
2
|
-
|
|
3
2
|
import type { Ranks } from "../rank";
|
|
4
3
|
import type { Team } from "../team";
|
|
5
|
-
import {
|
|
4
|
+
import type { RatingUserMap, RatingUsers } from "./rating-user";
|
|
6
5
|
|
|
6
|
+
import { createPersons } from "../person";
|
|
7
7
|
import { RatingCalculator } from "./rating-calculator";
|
|
8
8
|
import { RatingHistory } from "./rating-history";
|
|
9
|
-
import type { RatingUserMap, RatingUsers } from "./rating-user";
|
|
10
9
|
import { RatingUser } from "./rating-user";
|
|
11
10
|
|
|
12
11
|
export class Rating {
|
package/src/resolver-vue.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import type { Contest } from "./contest";
|
|
2
|
+
import type { Submissions } from "./submission";
|
|
3
|
+
import type { Teams } from "./team";
|
|
4
|
+
|
|
1
5
|
import { Resolver } from "./resolver";
|
|
2
6
|
import { Team } from "./team";
|
|
3
|
-
import type { Teams } from "./team";
|
|
4
|
-
import type { Submissions } from "./submission";
|
|
5
|
-
import type { Contest } from "./contest";
|
|
6
7
|
|
|
7
8
|
export class ResolverVue extends Resolver {
|
|
8
9
|
readonly FLASHING_TIME_MS = 100;
|
package/src/resolver.ts
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
|
+
import type { Contest } from "./contest";
|
|
2
|
+
import type { TeamProblemStatistics } from "./problem";
|
|
3
|
+
import type { Submissions } from "./submission";
|
|
4
|
+
import type { Teams } from "./team";
|
|
5
|
+
|
|
1
6
|
import _ from "lodash";
|
|
2
7
|
|
|
3
8
|
import { Rank } from "./rank";
|
|
4
|
-
import type { Contest } from "./contest";
|
|
5
|
-
import type { Teams } from "./team";
|
|
6
|
-
import { Team } from "./team";
|
|
7
|
-
import type { Submissions } from "./submission";
|
|
8
|
-
import { Submission } from "./submission";
|
|
9
|
-
import type { TeamProblemStatistics } from "./problem";
|
|
10
9
|
import { ResolverOperation } from "./resolver-operation";
|
|
10
|
+
import { Submission } from "./submission";
|
|
11
|
+
import { Team } from "./team";
|
|
11
12
|
|
|
12
13
|
export class Resolver extends Rank {
|
|
13
14
|
finalRank: Rank;
|
package/src/team.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import
|
|
1
|
+
import type { Image, Team as ITeam, Teams as ITeams } from "@xcpcio/types";
|
|
2
2
|
|
|
3
|
-
import type {
|
|
3
|
+
import type { Award, MedalType } from "./award";
|
|
4
4
|
|
|
5
|
+
import type { ContestOptions } from "./contest-options";
|
|
5
6
|
import type { Problem, TeamProblemStatistics } from "./problem";
|
|
6
|
-
import { calcDirt } from "./utils";
|
|
7
7
|
import type { Submissions } from "./submission";
|
|
8
|
-
import
|
|
9
|
-
import
|
|
8
|
+
import _ from "lodash";
|
|
9
|
+
import { calcDirt } from "./utils";
|
|
10
10
|
|
|
11
11
|
export class PlaceChartPointData {
|
|
12
12
|
timePoint: number;
|
|
@@ -199,7 +199,7 @@ export class Team {
|
|
|
199
199
|
this.attemptedProblemNum += p.failedCount + 1;
|
|
200
200
|
|
|
201
201
|
if (options?.calculationOfPenalty === "in_seconds"
|
|
202
|
-
|
|
202
|
+
|| options?.calculationOfPenalty === "accumulate_in_seconds_and_finally_to_the_minute") {
|
|
203
203
|
this.penalty += p.penaltyInSecond;
|
|
204
204
|
} else {
|
|
205
205
|
this.penalty += p.penalty;
|
package/src/utils/dayjs.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import dayjs from "dayjs";
|
|
2
2
|
|
|
3
|
-
import duration from "dayjs/plugin/duration";
|
|
4
|
-
import utc from "dayjs/plugin/utc";
|
|
5
|
-
import timezone from "dayjs/plugin/timezone";
|
|
6
3
|
import advancedFormat from "dayjs/plugin/advancedFormat";
|
|
7
|
-
import
|
|
4
|
+
import duration from "dayjs/plugin/duration";
|
|
8
5
|
import isSameOrAfter from "dayjs/plugin/isSameOrAfter";
|
|
6
|
+
import isSameOrBefore from "dayjs/plugin/isSameOrBefore";
|
|
9
7
|
import minMax from "dayjs/plugin/minMax";
|
|
10
8
|
import relativeTime from "dayjs/plugin/relativeTime";
|
|
9
|
+
import timezone from "dayjs/plugin/timezone";
|
|
10
|
+
import utc from "dayjs/plugin/utc";
|
|
11
11
|
|
|
12
12
|
dayjs.extend(duration);
|
|
13
13
|
dayjs.extend(utc);
|