@qingwu-ui/holiday-data 0.0.0-stage → 1.0.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 +154 -0
- package/LICENSE-holiday-cn +21 -0
- package/data.json +1490 -0
- package/dist/index.cjs +1449 -0
- package/dist/index.d.cts +56 -0
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +56 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +1444 -0
- package/dist/index.mjs.map +1 -0
- package/festivals.json +899 -0
- package/package.json +61 -4
- package/schema.json +188 -0
- package/years/2024.json +195 -0
- package/years/2025.json +180 -0
- package/years/2026.json +210 -0
- package/README.md +0 -3
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
//#region src/schema.d.ts
|
|
2
|
+
/** 数据协议独立于运行时与农历算法;calendar/core 构建时内联本文件。 */
|
|
3
|
+
interface DataSource {
|
|
4
|
+
title: string;
|
|
5
|
+
publisher: string;
|
|
6
|
+
url: string;
|
|
7
|
+
accessedAt: string;
|
|
8
|
+
}
|
|
9
|
+
interface HolidayDay {
|
|
10
|
+
date: string;
|
|
11
|
+
name: string;
|
|
12
|
+
isOffDay: boolean;
|
|
13
|
+
}
|
|
14
|
+
interface HolidayYear {
|
|
15
|
+
schemaVersion: 1;
|
|
16
|
+
year: number;
|
|
17
|
+
updatedAt: string;
|
|
18
|
+
sources: DataSource[];
|
|
19
|
+
days: HolidayDay[];
|
|
20
|
+
}
|
|
21
|
+
interface SourcedText {
|
|
22
|
+
text: string;
|
|
23
|
+
sources: DataSource[];
|
|
24
|
+
}
|
|
25
|
+
interface FestivalRecord {
|
|
26
|
+
id: string;
|
|
27
|
+
name: string;
|
|
28
|
+
rule: {
|
|
29
|
+
calendar: "lunar" | "solar" | "solar-term" | "lunar-eve";
|
|
30
|
+
month?: number;
|
|
31
|
+
day?: number;
|
|
32
|
+
term?: string;
|
|
33
|
+
};
|
|
34
|
+
description: SourcedText;
|
|
35
|
+
origin: SourcedText;
|
|
36
|
+
customs: SourcedText;
|
|
37
|
+
}
|
|
38
|
+
interface HolidayData {
|
|
39
|
+
schemaVersion: 1;
|
|
40
|
+
updatedAt: string;
|
|
41
|
+
years: HolidayYear[];
|
|
42
|
+
festivals: FestivalRecord[];
|
|
43
|
+
}
|
|
44
|
+
declare function isISODate(value: unknown): value is string;
|
|
45
|
+
declare function validateHolidayYear(value: unknown): asserts value is HolidayYear;
|
|
46
|
+
declare function validateHolidayData(value: unknown): asserts value is HolidayData;
|
|
47
|
+
/** 接受 JSON.parse 后的对象,也接受年度文件;年度输入不会替换其他年份。 */
|
|
48
|
+
declare function parseHolidayData(value: unknown): HolidayData;
|
|
49
|
+
declare function mergeHolidayData(base: HolidayData, custom: HolidayData | HolidayYear): HolidayData;
|
|
50
|
+
//#endregion
|
|
51
|
+
//#region src/index.d.ts
|
|
52
|
+
declare const holidayData: HolidayData;
|
|
53
|
+
declare function getHolidayYear(year: number): HolidayYear | null;
|
|
54
|
+
//#endregion
|
|
55
|
+
export { DataSource, FestivalRecord, HolidayData, HolidayDay, HolidayYear, SourcedText, getHolidayYear, holidayData, isISODate, mergeHolidayData, parseHolidayData, validateHolidayData, validateHolidayYear };
|
|
56
|
+
//# sourceMappingURL=index.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/schema.d.ts","../src/index.ts"],"mappings":";;UACiB;EACb;EACA;EACA;EACA;;UAEa;EACb;EACA;EACA;;UAEa;EACb;EACA;EACA;EACA,SAAS;EACT,MAAM;;UAEO;EACb;EACA,SAAS;;UAEI;EACb;EACA;EACA;IACI;IACA;IACA;IACA;;EAEJ,aAAa;EACb,QAAQ;EACR,SAAS;;UAEI;EACb;EACA;EACA,OAAO;EACP,WAAW;;iBAES,UAAU,iBAAiB;iBAC3B,oBAAoB,yBAAyB,SAAS;iBACtD,oBAAoB,yBAAyB,SAAS;;iBAEtD,iBAAiB,iBAAiB;iBAClC,iBAAiB,MAAM,aAAa,QAAQ,cAAc,cAAc;;;cC3CnF,aAAA;iBACG,eAAe,eAAf"}
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
//#region src/schema.d.ts
|
|
2
|
+
/** 数据协议独立于运行时与农历算法;calendar/core 构建时内联本文件。 */
|
|
3
|
+
interface DataSource {
|
|
4
|
+
title: string;
|
|
5
|
+
publisher: string;
|
|
6
|
+
url: string;
|
|
7
|
+
accessedAt: string;
|
|
8
|
+
}
|
|
9
|
+
interface HolidayDay {
|
|
10
|
+
date: string;
|
|
11
|
+
name: string;
|
|
12
|
+
isOffDay: boolean;
|
|
13
|
+
}
|
|
14
|
+
interface HolidayYear {
|
|
15
|
+
schemaVersion: 1;
|
|
16
|
+
year: number;
|
|
17
|
+
updatedAt: string;
|
|
18
|
+
sources: DataSource[];
|
|
19
|
+
days: HolidayDay[];
|
|
20
|
+
}
|
|
21
|
+
interface SourcedText {
|
|
22
|
+
text: string;
|
|
23
|
+
sources: DataSource[];
|
|
24
|
+
}
|
|
25
|
+
interface FestivalRecord {
|
|
26
|
+
id: string;
|
|
27
|
+
name: string;
|
|
28
|
+
rule: {
|
|
29
|
+
calendar: "lunar" | "solar" | "solar-term" | "lunar-eve";
|
|
30
|
+
month?: number;
|
|
31
|
+
day?: number;
|
|
32
|
+
term?: string;
|
|
33
|
+
};
|
|
34
|
+
description: SourcedText;
|
|
35
|
+
origin: SourcedText;
|
|
36
|
+
customs: SourcedText;
|
|
37
|
+
}
|
|
38
|
+
interface HolidayData {
|
|
39
|
+
schemaVersion: 1;
|
|
40
|
+
updatedAt: string;
|
|
41
|
+
years: HolidayYear[];
|
|
42
|
+
festivals: FestivalRecord[];
|
|
43
|
+
}
|
|
44
|
+
declare function isISODate(value: unknown): value is string;
|
|
45
|
+
declare function validateHolidayYear(value: unknown): asserts value is HolidayYear;
|
|
46
|
+
declare function validateHolidayData(value: unknown): asserts value is HolidayData;
|
|
47
|
+
/** 接受 JSON.parse 后的对象,也接受年度文件;年度输入不会替换其他年份。 */
|
|
48
|
+
declare function parseHolidayData(value: unknown): HolidayData;
|
|
49
|
+
declare function mergeHolidayData(base: HolidayData, custom: HolidayData | HolidayYear): HolidayData;
|
|
50
|
+
//#endregion
|
|
51
|
+
//#region src/index.d.ts
|
|
52
|
+
declare const holidayData: HolidayData;
|
|
53
|
+
declare function getHolidayYear(year: number): HolidayYear | null;
|
|
54
|
+
//#endregion
|
|
55
|
+
export { DataSource, FestivalRecord, HolidayData, HolidayDay, HolidayYear, SourcedText, getHolidayYear, holidayData, isISODate, mergeHolidayData, parseHolidayData, validateHolidayData, validateHolidayYear };
|
|
56
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/schema.ts","../src/index.ts"],"mappings":";;UACiB;EACf;EACA;EACA;EACA;;UAGe;EACf;EACA;EACA;;UAGe;EACf;EACA;EACA;EACA,SAAS;EACT,MAAM;;UAGS;EACf;EACA,SAAS;;UAGM;EACf;EACA;EACA;IACE;IACA;IACA;IACA;;EAEF,aAAa;EACb,QAAQ;EACR,SAAS;;UAGM;EACf;EACA;EACA,OAAO;EACP,WAAW;;iBAGG,UAAU,iBAAiB;iBAwC3B,oBAAoB,yBAAyB,SAAS;iBA2BtD,oBAAoB,yBAAyB,SAAS;;iBAiDtD,iBAAiB,iBAAiB;iBASlC,iBACd,MAAM,aACN,QAAQ,cAAc,cACrB;;;cC5KU,aAAA;iBACG,eAAe,eAAf"}
|