-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
types.ts
124 lines (108 loc) · 2.68 KB
/
types.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
export type Name =
string |
{ name: string, lang?: string } |
{ given: string, family: string, familyFirst?: boolean, lang?: string }
export type Organization = { orgName: string, orgAbbr?: string, orgLang?: string, orgUrl?: string }
export type LicenseName
= "cc0"
| "cc-by"
| "cc-by-sa"
| "cc-by-nd"
| "cc-by-nc"
| "cc-by-nc-sa"
| "cc-by-nc-nd"
| "with-permission"
| "us-fair-use"
| "terms"
export type LicenseVersion = "2.0" | "2.5" | "3.0" | "4.0"
type CommonInfo = {
identifier?: string,
originalUrl?: string,
copyrightYear?: number,
author?: Name,
organization?: Organization,
licenseVersion?: LicenseVersion,
license: LicenseName,
termsUrl?: string,
hidden?: boolean, // don’t render this?
}
// this just requires Organization for stock-image license
type StockInfo = {
identifier?: string,
originalUrl?: string,
copyrightYear?: number,
author?: Name,
organization: Organization,
licenseVersion?: LicenseVersion,
license: "stock-image",
hidden?: boolean,
}
export type SourceInfo = CommonInfo | StockInfo
export type SizePosition
= { size: "wide", position?: "aside" }
| { size?: "small", position?: "left" | "right" | "aside" }
| { size: "extra-wide", position?: "aside" };
export type Author = {
readonly family?: string,
readonly given: (readonly string[] | string),
readonly lang?: string,
readonly alt?: string,
readonly ["alt-lang"]?: string
}
export type Date
= number
| ({ year: number }
| { year: number, month: number }
| { year: number, month: number, day: number }
| { year: number, season: string }) & { OS?: boolean }; // OS = old-style date
//11ty types
export type Article<D=Data> = {
draft?: boolean,
title: string,
titleLang?: string,
url: string,
children: readonly Article[],
data: D,
date: any,
content: string,
};
export type Context = {
eleventyNavigation(this: Context, collection: any): Article[];
asAttr(name: string, value: string | undefined): string;
};
export type Players =
| 'banking'
| 'any'
| number
| number[]
| { min: number, max?: number };
export type GameData = Data & {
players: Players|undefined,
equipment: string|undefined,
variant?: boolean;
countries: string|undefined,
subgames: {
title: string,
titleLang?: string
originalTitle?: string,
players: Players|undefined,
equipment: string|undefined,
countries: string|undefined,
slug?: string,
}[]
};
export type Data = {
title: string,
titleLang?: string,
originalTitle?: string,
draft?: boolean,
collections: {
all: any;
article: Article[],
game: Article<GameData>[],
},
// from _data/site.json
site: {
url: string,
}
};