@optolith/entity-descriptions 0.15.0 → 0.17.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/CHANGELOG.md +16 -0
- package/lib/creator.d.ts +13 -1
- package/lib/creator.js +32 -16
- package/lib/entities/activatable.d.ts +1 -1
- package/lib/entities/alternativeRule.d.ts +1 -1
- package/lib/entities/attribute.d.ts +1 -1
- package/lib/entities/combatTechnique.d.ts +2 -2
- package/lib/entities/condition.d.ts +2 -2
- package/lib/entities/culture.d.ts +1 -1
- package/lib/entities/curriculum.d.ts +1 -1
- package/lib/entities/derivedCharacteristic.d.ts +1 -1
- package/lib/entities/disease.d.ts +1 -1
- package/lib/entities/disease.js +5 -6
- package/lib/entities/elixir.d.ts +1 -1
- package/lib/entities/elixir.js +2 -2
- package/lib/entities/equipment.d.ts +4 -4
- package/lib/entities/equipmentPackage.d.ts +1 -1
- package/lib/entities/experienceLevel.d.ts +1 -1
- package/lib/entities/focusRule.d.ts +1 -1
- package/lib/entities/influence.d.ts +1 -1
- package/lib/entities/liturgicalChant.d.ts +3 -3
- package/lib/entities/optionalRule.d.ts +1 -1
- package/lib/entities/partial/commonnessRatedAdvantagesAndDisadvantages.d.ts +1 -1
- package/lib/entities/partial/enhancements.d.ts +1 -1
- package/lib/entities/partial/herbary.d.ts +6 -3
- package/lib/entities/partial/herbary.js +5 -3
- package/lib/entities/partial/prerequisites/index.d.ts +1 -1
- package/lib/entities/partial/rated/activatable/effect.d.ts +1 -1
- package/lib/entities/partial/rated/activatable/index.d.ts +1 -1
- package/lib/entities/partial/rated/activatable/parensIf.d.ts +6 -0
- package/lib/entities/partial/rated/activatable/parensIf.js +6 -3
- package/lib/entities/partial/rated/activatable/targetCategory.d.ts +1 -1
- package/lib/entities/partial/rated/improvementCost.d.ts +1 -1
- package/lib/entities/personalityTrait.d.ts +1 -1
- package/lib/entities/poison.d.ts +1 -1
- package/lib/entities/poison.js +2 -2
- package/lib/entities/profession.d.ts +1 -1
- package/lib/entities/race.d.ts +1 -1
- package/lib/entities/sexPractice.d.ts +1 -1
- package/lib/entities/skill.d.ts +1 -1
- package/lib/entities/spell.d.ts +16 -16
- package/lib/entities/state.d.ts +1 -1
- package/lib/entities/tradeSecret.d.ts +1 -1
- package/lib/entities/tradeSecret.js +3 -2
- package/lib/entityDescription.d.ts +118 -0
- package/lib/entityDescription.js +1 -0
- package/lib/index.d.ts +10 -213
- package/lib/rawEntityDescription.d.ts +144 -0
- package/lib/rawEntityDescription.js +1 -0
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -2
package/lib/entities/skill.d.ts
CHANGED
|
@@ -10,4 +10,4 @@ export declare const getSkillEntityDescription: import("../creator.js").EntityDe
|
|
|
10
10
|
getChildInstancesForInstanceId: GetAllChildInstancesForParent<"SkillApplication">;
|
|
11
11
|
getAllResolvedNewSkillApplications: GetAllResolvedNewSkillApplications;
|
|
12
12
|
getAllResolvedSkillUses: GetAllResolvedSkillUses;
|
|
13
|
-
} & import("../env.js").StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, import("../
|
|
13
|
+
} & import("../env.js").StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, import("../entityDescription.js").EntityDescription<string>>;
|
package/lib/entities/spell.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ import type { GetResolvedSelectOptionById } from "./partial/prerequisites/single
|
|
|
8
8
|
*/
|
|
9
9
|
export declare const getCantripEntityDescription: import("../creator.js").EntityDescriptionCreator<"Cantrip", {
|
|
10
10
|
getInstanceById: GetInstanceById<"Publication" | "TargetCategory" | "Property" | "MagicalTradition" | "Curriculum">;
|
|
11
|
-
} & StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, import("../
|
|
11
|
+
} & StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, import("../entityDescription.js").EntityDescription<string>>;
|
|
12
12
|
/**
|
|
13
13
|
* Get a JSON representation of the rules text for a skill.
|
|
14
14
|
*/
|
|
@@ -16,7 +16,7 @@ export declare const getSpellEntityDescription: import("../creator.js").EntityDe
|
|
|
16
16
|
getInstanceById: GetInstanceById<"Publication" | "Attribute" | "SkillModificationLevel" | "TargetCategory" | "Property" | "MagicalTradition" | "DerivedCharacteristic" | RatedIdentifier["kind"] | "Enhancement" | "FocusRule">;
|
|
17
17
|
getChildInstancesForInstanceId: GetAllChildInstancesForParent<"Enhancement">;
|
|
18
18
|
idMap: IdMap;
|
|
19
|
-
} & StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, import("../
|
|
19
|
+
} & StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, import("../entityDescription.js").EntityDescription<string>>;
|
|
20
20
|
/**
|
|
21
21
|
* Get a JSON representation of the rules text for a ritual.
|
|
22
22
|
*/
|
|
@@ -24,88 +24,88 @@ export declare const getRitualEntityDescription: import("../creator.js").EntityD
|
|
|
24
24
|
getInstanceById: GetInstanceById<"Publication" | "Attribute" | "SkillModificationLevel" | "TargetCategory" | "Property" | "MagicalTradition" | "DerivedCharacteristic" | RatedIdentifier["kind"] | "Enhancement" | "FocusRule">;
|
|
25
25
|
getChildInstancesForInstanceId: GetAllChildInstancesForParent<"Enhancement">;
|
|
26
26
|
idMap: IdMap;
|
|
27
|
-
} & StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, import("../
|
|
27
|
+
} & StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, import("../entityDescription.js").EntityDescription<string>>;
|
|
28
28
|
/**
|
|
29
29
|
* Get a JSON representation of the rules text for a curse.
|
|
30
30
|
*/
|
|
31
31
|
export declare const getCurseEntityDescription: import("../creator.js").EntityDescriptionCreator<"Curse", {
|
|
32
32
|
getInstanceById: GetInstanceById<"Publication" | "Attribute" | "Property" | "DerivedCharacteristic">;
|
|
33
33
|
idMap: IdMap;
|
|
34
|
-
} & StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, import("../
|
|
34
|
+
} & StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, import("../entityDescription.js").EntityDescription<string>>;
|
|
35
35
|
/**
|
|
36
36
|
* Get a JSON representation of the rules text for an Elven magical song.
|
|
37
37
|
*/
|
|
38
38
|
export declare const getElvenMagicalSongEntityDescription: import("../creator.js").EntityDescriptionCreator<"ElvenMagicalSong", {
|
|
39
39
|
getInstanceById: GetInstanceById<"Publication" | "Attribute" | "Property" | "DerivedCharacteristic" | "Skill">;
|
|
40
40
|
idMap: IdMap;
|
|
41
|
-
} & StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, import("../
|
|
41
|
+
} & StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, import("../entityDescription.js").EntityDescription<string>>;
|
|
42
42
|
/**
|
|
43
43
|
* Get a JSON representation of the rules text for a domination ritual.
|
|
44
44
|
*/
|
|
45
45
|
export declare const getDominationRitualEntityDescription: import("../creator.js").EntityDescriptionCreator<"DominationRitual", {
|
|
46
46
|
getInstanceById: GetInstanceById<"Publication" | "Attribute" | "Property" | "DerivedCharacteristic" | "SkillModificationLevel">;
|
|
47
47
|
idMap: IdMap;
|
|
48
|
-
} & StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, import("../
|
|
48
|
+
} & StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, import("../entityDescription.js").EntityDescription<string>>;
|
|
49
49
|
/**
|
|
50
50
|
* Get a JSON representation of the rules text for a magical dance.
|
|
51
51
|
*/
|
|
52
52
|
export declare const getMagicalDanceEntityDescription: import("../creator.js").EntityDescriptionCreator<"MagicalDance", {
|
|
53
53
|
getInstanceById: GetInstanceById<"Publication" | "Attribute" | "Property" | "DerivedCharacteristic" | "ArcaneBardTradition" | "ArcaneDancerTradition">;
|
|
54
|
-
} & StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, import("../
|
|
54
|
+
} & StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, import("../entityDescription.js").EntityDescription<string>>;
|
|
55
55
|
/**
|
|
56
56
|
* Get a JSON representation of the rules text for a magical melody.
|
|
57
57
|
*/
|
|
58
58
|
export declare const getMagicalMelodyEntityDescription: import("../creator.js").EntityDescriptionCreator<"MagicalMelody", {
|
|
59
59
|
getInstanceById: GetInstanceById<"Publication" | "Attribute" | "Property" | "DerivedCharacteristic" | "Skill" | "ArcaneBardTradition" | "ArcaneDancerTradition">;
|
|
60
|
-
} & StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, import("../
|
|
60
|
+
} & StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, import("../entityDescription.js").EntityDescription<string>>;
|
|
61
61
|
/**
|
|
62
62
|
* Get a JSON representation of the rules text for a familiar’s trick.
|
|
63
63
|
*/
|
|
64
64
|
export declare const getFamiliarsTrickEntityDescription: import("../creator.js").EntityDescriptionCreator<"FamiliarsTrick", {
|
|
65
65
|
getInstanceById: GetInstanceById<"Publication" | "Attribute" | "Property" | "DerivedCharacteristic" | "AnimalType">;
|
|
66
|
-
} & StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, import("../
|
|
66
|
+
} & StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, import("../entityDescription.js").EntityDescription<string>>;
|
|
67
67
|
/**
|
|
68
68
|
* Get a JSON representation of the rules text for a animist power.
|
|
69
69
|
*/
|
|
70
70
|
export declare const getAnimistPowerEntityDescription: import("../creator.js").EntityDescriptionCreator<"AnimistPower", {
|
|
71
71
|
getInstanceById: GetInstanceById<"Publication" | "Attribute" | "SkillModificationLevel" | "TargetCategory" | "Property" | "MagicalTradition" | "DerivedCharacteristic" | "AnimistPower" | "Tribe">;
|
|
72
72
|
idMap: IdMap;
|
|
73
|
-
} & StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, import("../
|
|
73
|
+
} & StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, import("../entityDescription.js").EntityDescription<string>>;
|
|
74
74
|
/**
|
|
75
75
|
* Get a JSON representation of the rules text for a Goede ritual.
|
|
76
76
|
*/
|
|
77
77
|
export declare const getGeodeRitualEntityDescription: import("../creator.js").EntityDescriptionCreator<"GeodeRitual", {
|
|
78
78
|
getInstanceById: GetInstanceById<"Publication" | "Attribute" | "SkillModificationLevel" | "TargetCategory" | "Property" | "MagicalTradition" | "DerivedCharacteristic" | "Influence" | ActivatableIdentifier["kind"] | "Aspect">;
|
|
79
79
|
getResolvedSelectOptionById: GetResolvedSelectOptionById;
|
|
80
|
-
} & StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, import("../
|
|
80
|
+
} & StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, import("../entityDescription.js").EntityDescription<string>>;
|
|
81
81
|
/**
|
|
82
82
|
* Get a JSON representation of the rules text for a jester trick.
|
|
83
83
|
*/
|
|
84
84
|
export declare const getJesterTrickEntityDescription: import("../creator.js").EntityDescriptionCreator<"JesterTrick", {
|
|
85
85
|
getInstanceById: GetInstanceById<"Publication" | "Attribute" | "SkillModificationLevel" | "TargetCategory" | "Property" | "MagicalTradition" | "DerivedCharacteristic">;
|
|
86
86
|
idMap: IdMap;
|
|
87
|
-
} & StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, import("../
|
|
87
|
+
} & StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, import("../entityDescription.js").EntityDescription<string>>;
|
|
88
88
|
/**
|
|
89
89
|
* Get a JSON representation of the rules text for a goblin ritual.
|
|
90
90
|
*/
|
|
91
91
|
export declare const getGoblinRitualEntityDescription: import("../creator.js").EntityDescriptionCreator<"GoblinRitual", {
|
|
92
92
|
getInstanceById: GetInstanceById<"Publication" | "Attribute" | "SkillModificationLevel" | "TargetCategory" | "Property" | "MagicalTradition" | "DerivedCharacteristic">;
|
|
93
93
|
idMap: IdMap;
|
|
94
|
-
} & StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, import("../
|
|
94
|
+
} & StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, import("../entityDescription.js").EntityDescription<string>>;
|
|
95
95
|
/**
|
|
96
96
|
* Get a JSON representation of the rules text for a Zibilja ritual.
|
|
97
97
|
*/
|
|
98
98
|
export declare const getZibiljaRitualEntityDescription: import("../creator.js").EntityDescriptionCreator<"ZibiljaRitual", {
|
|
99
99
|
getInstanceById: GetInstanceById<"Publication" | "Attribute" | "SkillModificationLevel" | "TargetCategory" | "Property" | "MagicalTradition" | "DerivedCharacteristic">;
|
|
100
100
|
idMap: IdMap;
|
|
101
|
-
} & StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, import("../
|
|
101
|
+
} & StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, import("../entityDescription.js").EntityDescription<string>>;
|
|
102
102
|
/**
|
|
103
103
|
* Get a JSON representation of the rules text for a Bannzeichen.
|
|
104
104
|
*/
|
|
105
105
|
export declare const getBannzeichenEntityDescription: import("../creator.js").EntityDescriptionCreator<"Bannzeichen", {
|
|
106
106
|
getInstanceById: GetInstanceById<"Publication" | "Attribute" | "Property" | "DerivedCharacteristic">;
|
|
107
107
|
getChildInstancesForInstanceId: GetAllChildInstancesForParent<"BannzeichenOption">;
|
|
108
|
-
} & StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, import("../
|
|
108
|
+
} & StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, import("../entityDescription.js").EntityDescription<string>>;
|
|
109
109
|
/**
|
|
110
110
|
* Get a JSON representation of the rules text for a magical rune.
|
|
111
111
|
*/
|
|
@@ -113,4 +113,4 @@ export declare const getMagicalRuneEntityDescription: import("../creator.js").En
|
|
|
113
113
|
getInstanceById: GetInstanceById<"Publication" | "Attribute" | "Property" | "DerivedCharacteristic" | "Skill">;
|
|
114
114
|
getChildInstancesForInstanceId: GetAllChildInstancesForParent<"MagicalRuneOption">;
|
|
115
115
|
idMap: IdMap;
|
|
116
|
-
} & StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, import("../
|
|
116
|
+
} & StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, import("../entityDescription.js").EntityDescription<string>>;
|
package/lib/entities/state.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Get a JSON representation of the rules text for a state.
|
|
3
3
|
*/
|
|
4
|
-
export declare const getStateEntityDescription: import("../creator.js").EntityDescriptionCreator<"State", import("@elyukai/utils/nullable").AnyNonNullish & import("../env.js").StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, import("../
|
|
4
|
+
export declare const getStateEntityDescription: import("../creator.js").EntityDescriptionCreator<"State", import("@elyukai/utils/nullable").AnyNonNullish & import("../env.js").StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, import("../entityDescription.js").EntityDescription<string>>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Get a JSON representation of the rules text for a state.
|
|
3
3
|
*/
|
|
4
|
-
export declare const getTradeSecretEntityDescription: import("../creator.js").EntityDescriptionCreator<"TradeSecret", import("@elyukai/utils/nullable").AnyNonNullish & import("../env.js").StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, import("../
|
|
4
|
+
export declare const getTradeSecretEntityDescription: import("../creator.js").EntityDescriptionCreator<"TradeSecret", import("@elyukai/utils/nullable").AnyNonNullish & import("../env.js").StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, import("../entityDescription.js").EntityDescription<string>>;
|
|
@@ -4,7 +4,8 @@ import { createEntityDescriptionCreator } from "../creator.js";
|
|
|
4
4
|
import { renderDefaultValueMapLabel, renderValueMap } from "./partial/map.js";
|
|
5
5
|
import { evaluateMathOperation } from "./partial/mathOperation.js";
|
|
6
6
|
import { printPlainGeneralPrerequisites } from "./partial/prerequisites/index.js";
|
|
7
|
-
import {
|
|
7
|
+
import { parensIfR } from "./partial/rated/activatable/parensIf.js";
|
|
8
|
+
import { sequence, translateR } from "./partial/reader.js";
|
|
8
9
|
import { formatAdventurePoints, formatArbitraryAdventurePoints } from "./partial/units/simple.js";
|
|
9
10
|
const renderAdventurePointsValue = (value) => {
|
|
10
11
|
switch (value.kind) {
|
|
@@ -65,7 +66,7 @@ export const getTradeSecretEntityDescription = createEntityDescriptionCreator((_
|
|
|
65
66
|
apValue: translateR("AP Value"),
|
|
66
67
|
},
|
|
67
68
|
values: {
|
|
68
|
-
name: Reader.of(
|
|
69
|
+
name: sequence `${translation.name}${parensIfR(entry.is_secret_knowledge ? translateR("Secret Knowledge") : Reader.of(undefined))}`,
|
|
69
70
|
prerequisites: entry.prerequisites === undefined
|
|
70
71
|
? translateR("none")
|
|
71
72
|
: printPlainGeneralPrerequisites(entry.prerequisites),
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A JSON representation of the rules text for a library entry.
|
|
3
|
+
*/
|
|
4
|
+
export type EntityDescription<Cols extends string> = TextEntityDescription | TabularEntityDescription<Cols> | TabularEntityDescription<Cols>[];
|
|
5
|
+
/**
|
|
6
|
+
* A JSON representation of the rules text for a library entry.
|
|
7
|
+
*/
|
|
8
|
+
export type TextEntityDescription = {
|
|
9
|
+
type?: "text";
|
|
10
|
+
category?: {
|
|
11
|
+
label: string;
|
|
12
|
+
value: string;
|
|
13
|
+
};
|
|
14
|
+
title: string;
|
|
15
|
+
subtitle?: string;
|
|
16
|
+
badge?: EntityDescriptionBadge;
|
|
17
|
+
className: string;
|
|
18
|
+
body: EntityDescriptionSection[];
|
|
19
|
+
errata?: {
|
|
20
|
+
date: string;
|
|
21
|
+
description: string;
|
|
22
|
+
}[];
|
|
23
|
+
references?: string;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* A JSON representation of the rules text for a library entry.
|
|
27
|
+
*/
|
|
28
|
+
export type TabularEntityDescription<Cols extends string> = {
|
|
29
|
+
type: "tabular";
|
|
30
|
+
category?: {
|
|
31
|
+
label: string;
|
|
32
|
+
value: string;
|
|
33
|
+
};
|
|
34
|
+
title: string;
|
|
35
|
+
labels: {
|
|
36
|
+
[K in Cols]: string;
|
|
37
|
+
};
|
|
38
|
+
values: {
|
|
39
|
+
[K in Cols]: string;
|
|
40
|
+
};
|
|
41
|
+
additionalInformation?: {
|
|
42
|
+
label: string;
|
|
43
|
+
id: string;
|
|
44
|
+
value: string;
|
|
45
|
+
}[];
|
|
46
|
+
errata?: {
|
|
47
|
+
date: string;
|
|
48
|
+
description: string;
|
|
49
|
+
}[];
|
|
50
|
+
references?: string;
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* A badge that can be displayed next to the title of a library entry.
|
|
54
|
+
*/
|
|
55
|
+
export type EntityDescriptionBadge = {
|
|
56
|
+
type: "level" | "armedCombat" | "unarmedCombat";
|
|
57
|
+
value: string;
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* A labeled or unlabeled section of a library entry text.
|
|
61
|
+
*/
|
|
62
|
+
export type EntityDescriptionSection = EntityDescriptionSectionContent<DefinitionListEntityDescriptionSection> | LabeledEntityDescriptionSection;
|
|
63
|
+
/**
|
|
64
|
+
* A slice of the content of a library entry text.
|
|
65
|
+
*/
|
|
66
|
+
export type EntityDescriptionSectionContent<DL> = PlainEntityDescriptionSection | DL | TableEntityDescriptionSection;
|
|
67
|
+
/**
|
|
68
|
+
* A labeled section of a library entry text.
|
|
69
|
+
*/
|
|
70
|
+
export type LabeledEntityDescriptionSection = {
|
|
71
|
+
type: "labeled";
|
|
72
|
+
label: string;
|
|
73
|
+
value: EntityDescriptionSectionContent<DefinitionListEntityDescriptionSection>;
|
|
74
|
+
};
|
|
75
|
+
/**
|
|
76
|
+
* A plain text, possibly containing Markdown syntax.
|
|
77
|
+
*/
|
|
78
|
+
export type PlainEntityDescriptionSection = {
|
|
79
|
+
type: "plain";
|
|
80
|
+
text: string;
|
|
81
|
+
};
|
|
82
|
+
/**
|
|
83
|
+
* A list of labeled values, such as prerequisites or quality levels.
|
|
84
|
+
*/
|
|
85
|
+
export type DefinitionListEntityDescriptionSection = {
|
|
86
|
+
type: "definitionList";
|
|
87
|
+
items: DefinitionListEntityDescriptionSectionItem[];
|
|
88
|
+
};
|
|
89
|
+
/**
|
|
90
|
+
* A list of labeled values, such as prerequisites or quality levels, nested within another definition list.
|
|
91
|
+
*/
|
|
92
|
+
export type NestedDefinitionListEntityDescriptionSection = {
|
|
93
|
+
type: "definitionList";
|
|
94
|
+
/**
|
|
95
|
+
* How to render this definition list.
|
|
96
|
+
*
|
|
97
|
+
* - `"hidden"`: The definition list does not look like it is nested, it just looks like it belongs to its parent definition list.
|
|
98
|
+
* - `"nested"`: The definition list is visually nested inside its parent definition list, usually indented and with italic labels instead of bold ones.
|
|
99
|
+
*/
|
|
100
|
+
style: "hidden" | "nested";
|
|
101
|
+
items: DefinitionListEntityDescriptionSectionItem[];
|
|
102
|
+
};
|
|
103
|
+
/**
|
|
104
|
+
* A single labeled value in a definition list.
|
|
105
|
+
*/
|
|
106
|
+
export type DefinitionListEntityDescriptionSectionItem = {
|
|
107
|
+
label: string;
|
|
108
|
+
value: string | EntityDescriptionSectionContent<NestedDefinitionListEntityDescriptionSection>[];
|
|
109
|
+
};
|
|
110
|
+
/**
|
|
111
|
+
* A table with a header, rows, and an optional footer.
|
|
112
|
+
*/
|
|
113
|
+
export type TableEntityDescriptionSection = {
|
|
114
|
+
type: "table";
|
|
115
|
+
header: string[];
|
|
116
|
+
rows: string[][];
|
|
117
|
+
footer?: string[];
|
|
118
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/lib/index.d.ts
CHANGED
|
@@ -1,218 +1,15 @@
|
|
|
1
|
-
import type { AnyNonNullish } from "@elyukai/utils/nullable";
|
|
2
|
-
import type { Reader } from "@elyukai/utils/reader";
|
|
3
1
|
import type { TSONDBTypes } from "@optolith/database-schema";
|
|
4
2
|
import type { ResolvedNewSkillApplication, ResolvedSelectOption, ResolvedSkillUse } from "@optolith/database-schema/cache";
|
|
5
|
-
import type { ActivatableIdentifier,
|
|
3
|
+
import type { ActivatableIdentifier, Skill_ID } from "@optolith/database-schema/gen";
|
|
6
4
|
import type { TSONDB } from "tsondb";
|
|
7
5
|
import type { EntityDescriptionCreator } from "./creator.js";
|
|
8
6
|
import type { GetResolvedSelectOptionById } from "./entities/partial/prerequisites/single/activatable.js";
|
|
7
|
+
import type { EntityDescription } from "./entityDescription.js";
|
|
9
8
|
import type { StdEnv } from "./env.js";
|
|
10
9
|
import type { CountInstances, GetAllChildInstancesForParent, GetAllInstances, GetInstanceById } from "./helpers/getTypes.js";
|
|
11
10
|
import type { LocaleEnvironment } from "./helpers/locale.js";
|
|
12
11
|
import type { PublicationOptions } from "./references/publicationOptions.js";
|
|
13
12
|
export type { LocaleEnvironment };
|
|
14
|
-
/**
|
|
15
|
-
* A JSON representation of the rules text for a library entry.
|
|
16
|
-
*/
|
|
17
|
-
export type EntityDescription<Cols extends string> = TextEntityDescription | TabularEntityDescription<Cols> | TabularEntityDescription<Cols>[];
|
|
18
|
-
/**
|
|
19
|
-
* A JSON representation of the rules text for a library entry.
|
|
20
|
-
*/
|
|
21
|
-
export type TextEntityDescription = {
|
|
22
|
-
type?: "text";
|
|
23
|
-
category?: {
|
|
24
|
-
label: string;
|
|
25
|
-
value: string;
|
|
26
|
-
};
|
|
27
|
-
title: string;
|
|
28
|
-
subtitle?: string;
|
|
29
|
-
badge?: RawEntityDescriptionBadge;
|
|
30
|
-
className: string;
|
|
31
|
-
body: EntityDescriptionSection[];
|
|
32
|
-
errata?: {
|
|
33
|
-
date: string;
|
|
34
|
-
description: string;
|
|
35
|
-
}[];
|
|
36
|
-
references?: string;
|
|
37
|
-
};
|
|
38
|
-
/**
|
|
39
|
-
* A JSON representation of the rules text for a library entry.
|
|
40
|
-
*/
|
|
41
|
-
export type TabularEntityDescription<Cols extends string> = {
|
|
42
|
-
type: "tabular";
|
|
43
|
-
category?: {
|
|
44
|
-
label: string;
|
|
45
|
-
value: string;
|
|
46
|
-
};
|
|
47
|
-
title: string;
|
|
48
|
-
labels: {
|
|
49
|
-
[K in Cols]: string;
|
|
50
|
-
};
|
|
51
|
-
values: {
|
|
52
|
-
[K in Cols]: string;
|
|
53
|
-
};
|
|
54
|
-
additionalInformation?: {
|
|
55
|
-
label: string;
|
|
56
|
-
id: string;
|
|
57
|
-
value: string;
|
|
58
|
-
}[];
|
|
59
|
-
errata?: {
|
|
60
|
-
date: string;
|
|
61
|
-
description: string;
|
|
62
|
-
}[];
|
|
63
|
-
references?: string;
|
|
64
|
-
};
|
|
65
|
-
/**
|
|
66
|
-
* A labeled or unlabeled section of a library entry text.
|
|
67
|
-
*/
|
|
68
|
-
export type EntityDescriptionSection = EntityDescriptionSectionContent | LabeledEntityDescriptionSection<EntityDescriptionSectionContent>;
|
|
69
|
-
/**
|
|
70
|
-
* A labeled section of a library entry text.
|
|
71
|
-
*/
|
|
72
|
-
export type LabeledEntityDescriptionSection<Content extends EntityDescriptionSectionContent | RawEntityDescriptionSectionContent> = {
|
|
73
|
-
type: "labeled";
|
|
74
|
-
label: string;
|
|
75
|
-
value: EntityDescriptionSectionContent<Content>;
|
|
76
|
-
};
|
|
77
|
-
/**
|
|
78
|
-
* A slice of the content of a library entry text.
|
|
79
|
-
*/
|
|
80
|
-
export type EntityDescriptionSectionContent<DL = DefinitionListEntityDescriptionSection> = PlainEntityDescriptionSection | DL | TableEntityDescriptionSection;
|
|
81
|
-
/**
|
|
82
|
-
* A JSON representation of the rules text for a library entry that has not been
|
|
83
|
-
* cleaned up.
|
|
84
|
-
*/
|
|
85
|
-
export type RawEntityDescription<Cols extends string = string, E = AnyNonNullish> = RawTextEntityDescription<E> | RawTabularEntityDescription<Cols, E> | RawTabularEntityDescription<Cols, E>[];
|
|
86
|
-
/**
|
|
87
|
-
* A JSON representation of the rules text for a library entry that has not been
|
|
88
|
-
* cleaned up.
|
|
89
|
-
*/
|
|
90
|
-
export type RawTextEntityDescription<E> = {
|
|
91
|
-
type?: "text";
|
|
92
|
-
category?: {
|
|
93
|
-
label: Reader<E, string>;
|
|
94
|
-
value: Reader<E, string>;
|
|
95
|
-
};
|
|
96
|
-
title: string;
|
|
97
|
-
subtitle?: string;
|
|
98
|
-
badge?: RawEntityDescriptionBadge;
|
|
99
|
-
className: string;
|
|
100
|
-
body: (RawEntityDescriptionSection | undefined)[];
|
|
101
|
-
errata?: Errata;
|
|
102
|
-
references?: PublicationRefs;
|
|
103
|
-
};
|
|
104
|
-
/**
|
|
105
|
-
* A JSON representation of the table for a library entry that has not been
|
|
106
|
-
* cleaned up.
|
|
107
|
-
*/
|
|
108
|
-
export type RawTabularEntityDescription<Cols extends string, E> = {
|
|
109
|
-
type: "tabular";
|
|
110
|
-
category?: {
|
|
111
|
-
label: Reader<E, string>;
|
|
112
|
-
value: Reader<E, string>;
|
|
113
|
-
};
|
|
114
|
-
title: string;
|
|
115
|
-
labels: {
|
|
116
|
-
[K in Cols]: Reader<E, string>;
|
|
117
|
-
};
|
|
118
|
-
values: {
|
|
119
|
-
[K in Cols]: Reader<E, string>;
|
|
120
|
-
};
|
|
121
|
-
additionalInformation?: ({
|
|
122
|
-
label: Reader<E, string>;
|
|
123
|
-
id: string;
|
|
124
|
-
value: Reader<E, string | undefined>;
|
|
125
|
-
} | undefined)[];
|
|
126
|
-
errata?: Errata;
|
|
127
|
-
references?: PublicationRefs;
|
|
128
|
-
};
|
|
129
|
-
/**
|
|
130
|
-
* A badge that can be displayed next to the title of a library entry.
|
|
131
|
-
*/
|
|
132
|
-
export type RawEntityDescriptionBadge = {
|
|
133
|
-
type: "level" | "armedCombat" | "unarmedCombat";
|
|
134
|
-
value: string;
|
|
135
|
-
};
|
|
136
|
-
/**
|
|
137
|
-
* A labeled or unlabeled section of a library entry text.
|
|
138
|
-
*/
|
|
139
|
-
export type RawEntityDescriptionSection = RawEntityDescriptionSectionContent | LabeledEntityDescriptionSection<RawEntityDescriptionSectionContent>;
|
|
140
|
-
/**
|
|
141
|
-
* A slice of the content of a library entry text.
|
|
142
|
-
*/
|
|
143
|
-
export type RawEntityDescriptionSectionContent<DL = RawDefinitionListEntityDescriptionSection> = PlainEntityDescriptionSection | DL | TableEntityDescriptionSection;
|
|
144
|
-
/**
|
|
145
|
-
* A plain text, possibly containing Markdown syntax.
|
|
146
|
-
*/
|
|
147
|
-
export type PlainEntityDescriptionSection = {
|
|
148
|
-
type: "plain";
|
|
149
|
-
text: string;
|
|
150
|
-
};
|
|
151
|
-
/**
|
|
152
|
-
* A list of labeled values, such as prerequisites or quality levels.
|
|
153
|
-
*/
|
|
154
|
-
export type DefinitionListEntityDescriptionSection = {
|
|
155
|
-
type: "definitionList";
|
|
156
|
-
items: DefinitionListEntityDescriptionSectionItem[];
|
|
157
|
-
};
|
|
158
|
-
/**
|
|
159
|
-
* A list of labeled values, such as prerequisites or quality levels, nested within another definition list.
|
|
160
|
-
*/
|
|
161
|
-
export type NestedDefinitionListEntityDescriptionSection = {
|
|
162
|
-
type: "definitionList";
|
|
163
|
-
/**
|
|
164
|
-
* How to render this definition list.
|
|
165
|
-
*
|
|
166
|
-
* - `"hidden"`: The definition list does not look like it is nested, it just looks like it belongs to its parent definition list.
|
|
167
|
-
* - `"nested"`: The definition list is visually nested inside its parent definition list, usually indented and with italic labels instead of bold ones.
|
|
168
|
-
*/
|
|
169
|
-
style: "hidden" | "nested";
|
|
170
|
-
items: DefinitionListEntityDescriptionSectionItem[];
|
|
171
|
-
};
|
|
172
|
-
/**
|
|
173
|
-
* A list of labeled values, such as prerequisites or quality levels.
|
|
174
|
-
*/
|
|
175
|
-
export type RawDefinitionListEntityDescriptionSection = {
|
|
176
|
-
type: "definitionList";
|
|
177
|
-
items: (RawDefinitionListEntityDescriptionSectionItem | undefined)[];
|
|
178
|
-
};
|
|
179
|
-
/**
|
|
180
|
-
* A list of labeled values, such as prerequisites or quality levels, nested within another definition list.
|
|
181
|
-
*/
|
|
182
|
-
export type RawNestedDefinitionListEntityDescriptionSection = {
|
|
183
|
-
type: "definitionList";
|
|
184
|
-
/**
|
|
185
|
-
* How to render this definition list.
|
|
186
|
-
*
|
|
187
|
-
* - `"hidden"`: The definition list does not look like it is nested, it just looks like it belongs to its parent definition list.
|
|
188
|
-
* - `"nested"`: The definition list is visually nested inside its parent definition list, usually indented and with italic labels instead of bold ones.
|
|
189
|
-
*/
|
|
190
|
-
style: "hidden" | "nested";
|
|
191
|
-
items: (RawDefinitionListEntityDescriptionSectionItem | undefined)[];
|
|
192
|
-
};
|
|
193
|
-
/**
|
|
194
|
-
* A single labeled value in a definition list.
|
|
195
|
-
*/
|
|
196
|
-
export type DefinitionListEntityDescriptionSectionItem = {
|
|
197
|
-
label: string;
|
|
198
|
-
value: string | EntityDescriptionSectionContent<NestedDefinitionListEntityDescriptionSection>[];
|
|
199
|
-
};
|
|
200
|
-
/**
|
|
201
|
-
* A single labeled value in a definition list.
|
|
202
|
-
*/
|
|
203
|
-
export type RawDefinitionListEntityDescriptionSectionItem = {
|
|
204
|
-
label: string;
|
|
205
|
-
value: string | (RawEntityDescriptionSectionContent<RawNestedDefinitionListEntityDescriptionSection> | undefined)[];
|
|
206
|
-
};
|
|
207
|
-
/**
|
|
208
|
-
* A table with a header, rows, and an optional footer.
|
|
209
|
-
*/
|
|
210
|
-
export type TableEntityDescriptionSection = {
|
|
211
|
-
type: "table";
|
|
212
|
-
header: string[];
|
|
213
|
-
rows: string[][];
|
|
214
|
-
footer?: string[];
|
|
215
|
-
};
|
|
216
13
|
/**
|
|
217
14
|
* Data passed to an EntityDescriptionCreator function, with the entity type as a type parameter for better type inference.
|
|
218
15
|
*/
|
|
@@ -231,14 +28,14 @@ declare const registeredEntityDescriptionCreators: {
|
|
|
231
28
|
FocusRule: EntityDescriptionCreator<"FocusRule", {
|
|
232
29
|
getInstanceById: GetInstanceById<"Publication" | "Subject">;
|
|
233
30
|
} & StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, EntityDescription<string>>;
|
|
234
|
-
OptionalRule: EntityDescriptionCreator<"OptionalRule", AnyNonNullish & StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, EntityDescription<string>>;
|
|
31
|
+
OptionalRule: EntityDescriptionCreator<"OptionalRule", import("@elyukai/utils/nullable").AnyNonNullish & StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, EntityDescription<string>>;
|
|
235
32
|
AlternativeRule: EntityDescriptionCreator<"AlternativeRule", {
|
|
236
33
|
getInstanceById: GetInstanceById<"Publication" | "PlayerType">;
|
|
237
34
|
} & StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, EntityDescription<string>>;
|
|
238
|
-
Condition: EntityDescriptionCreator<"Condition", AnyNonNullish & StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, EntityDescription<string>>;
|
|
239
|
-
MetaCondition: EntityDescriptionCreator<"MetaCondition", AnyNonNullish & StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, EntityDescription<string>>;
|
|
240
|
-
State: EntityDescriptionCreator<"State", AnyNonNullish & StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, EntityDescription<string>>;
|
|
241
|
-
ExperienceLevel: EntityDescriptionCreator<"ExperienceLevel", AnyNonNullish & StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, EntityDescription<string>>;
|
|
35
|
+
Condition: EntityDescriptionCreator<"Condition", import("@elyukai/utils/nullable").AnyNonNullish & StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, EntityDescription<string>>;
|
|
36
|
+
MetaCondition: EntityDescriptionCreator<"MetaCondition", import("@elyukai/utils/nullable").AnyNonNullish & StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, EntityDescription<string>>;
|
|
37
|
+
State: EntityDescriptionCreator<"State", import("@elyukai/utils/nullable").AnyNonNullish & StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, EntityDescription<string>>;
|
|
38
|
+
ExperienceLevel: EntityDescriptionCreator<"ExperienceLevel", import("@elyukai/utils/nullable").AnyNonNullish & StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, EntityDescription<string>>;
|
|
242
39
|
DerivedCharacteristic: EntityDescriptionCreator<"DerivedCharacteristic", {
|
|
243
40
|
getInstanceById: GetInstanceById<"Publication" | "Attribute" | "DerivedCharacteristic">;
|
|
244
41
|
} & StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, EntityDescription<string>>;
|
|
@@ -277,7 +74,7 @@ declare const registeredEntityDescriptionCreators: {
|
|
|
277
74
|
getAllResolvedSkillUses: GetAllResolvedSkillUses;
|
|
278
75
|
translateMap: import("./helpers/translate.js").TranslateMap;
|
|
279
76
|
} & StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, EntityDescription<string>>;
|
|
280
|
-
Attribute: EntityDescriptionCreator<"Attribute", AnyNonNullish & StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, EntityDescription<string>>;
|
|
77
|
+
Attribute: EntityDescriptionCreator<"Attribute", import("@elyukai/utils/nullable").AnyNonNullish & StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, EntityDescription<string>>;
|
|
281
78
|
Skill: EntityDescriptionCreator<"Skill", {
|
|
282
79
|
getInstanceById: GetInstanceById<"Publication" | "Attribute" | ActivatableIdentifier["kind"] | "Aspect">;
|
|
283
80
|
getAllInstances: GetAllInstances<"BlessedTradition" | "Disease" | "Region" | "SkillUse" | "NewSkillApplication">;
|
|
@@ -860,7 +657,7 @@ declare const registeredEntityDescriptionCreators: {
|
|
|
860
657
|
getAllResolvedSkillUses: GetAllResolvedSkillUses;
|
|
861
658
|
translateMap: import("./helpers/translate.js").TranslateMap;
|
|
862
659
|
} & StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, EntityDescription<string>>;
|
|
863
|
-
TradeSecret: EntityDescriptionCreator<"TradeSecret", AnyNonNullish & StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, EntityDescription<string>>;
|
|
660
|
+
TradeSecret: EntityDescriptionCreator<"TradeSecret", import("@elyukai/utils/nullable").AnyNonNullish & StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, EntityDescription<string>>;
|
|
864
661
|
Ammunition: EntityDescriptionCreator<"Weapon" | "Ammunition" | "Armor" | "Animal" | "AnimalCare" | "BandageOrRemedy" | "Book" | "CeremonialItem" | "Clothes" | "ClothingPackage" | "Container" | "EquipmentOfBlessedOnes" | "GemOrPreciousStone" | "IlluminationLightSource" | "IlluminationRefillOrSupply" | "Jewelry" | "Laboratory" | "Liebesspielzeug" | "LuxuryGood" | "MagicalArtifact" | "MusicalInstrument" | "Newspaper" | "OrienteeringAid" | "RopeOrChain" | "Stationery" | "ThievesTool" | "ToolOfTheTrade" | "TravelGearOrTool" | "Vehicle" | "WeaponAccessory" | "WorkingSupernaturalCreature", StdEnv<"f" | "fn" | "t" | "tm" | "lj" | "lc" | "rts" | "ibi" | "ma" | "idm", "BlessedTradition" | "MagicalTradition" | "Publication" | "Race" | "Culture" | "SocialStatus" | "Attribute" | "Skill" | "CloseCombatTechnique" | "RangedCombatTechnique" | "Weapon" | "Profession" | "Ammunition" | "DerivedCharacteristic" | "Reach"> & StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, EntityDescription<string>>;
|
|
865
662
|
Animal: EntityDescriptionCreator<"Weapon" | "Ammunition" | "Armor" | "Animal" | "AnimalCare" | "BandageOrRemedy" | "Book" | "CeremonialItem" | "Clothes" | "ClothingPackage" | "Container" | "EquipmentOfBlessedOnes" | "GemOrPreciousStone" | "IlluminationLightSource" | "IlluminationRefillOrSupply" | "Jewelry" | "Laboratory" | "Liebesspielzeug" | "LuxuryGood" | "MagicalArtifact" | "MusicalInstrument" | "Newspaper" | "OrienteeringAid" | "RopeOrChain" | "Stationery" | "ThievesTool" | "ToolOfTheTrade" | "TravelGearOrTool" | "Vehicle" | "WeaponAccessory" | "WorkingSupernaturalCreature", StdEnv<"f" | "fn" | "t" | "tm" | "lj" | "lc" | "rts" | "ibi" | "ma" | "idm", "BlessedTradition" | "MagicalTradition" | "Publication" | "Race" | "Culture" | "SocialStatus" | "Attribute" | "Skill" | "CloseCombatTechnique" | "RangedCombatTechnique" | "Weapon" | "Profession" | "Ammunition" | "DerivedCharacteristic" | "Reach"> & StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, EntityDescription<string>>;
|
|
866
663
|
AnimalCare: EntityDescriptionCreator<"Weapon" | "Ammunition" | "Armor" | "Animal" | "AnimalCare" | "BandageOrRemedy" | "Book" | "CeremonialItem" | "Clothes" | "ClothingPackage" | "Container" | "EquipmentOfBlessedOnes" | "GemOrPreciousStone" | "IlluminationLightSource" | "IlluminationRefillOrSupply" | "Jewelry" | "Laboratory" | "Liebesspielzeug" | "LuxuryGood" | "MagicalArtifact" | "MusicalInstrument" | "Newspaper" | "OrienteeringAid" | "RopeOrChain" | "Stationery" | "ThievesTool" | "ToolOfTheTrade" | "TravelGearOrTool" | "Vehicle" | "WeaponAccessory" | "WorkingSupernaturalCreature", StdEnv<"f" | "fn" | "t" | "tm" | "lj" | "lc" | "rts" | "ibi" | "ma" | "idm", "BlessedTradition" | "MagicalTradition" | "Publication" | "Race" | "Culture" | "SocialStatus" | "Attribute" | "Skill" | "CloseCombatTechnique" | "RangedCombatTechnique" | "Weapon" | "Profession" | "Ammunition" | "DerivedCharacteristic" | "Reach"> & StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, EntityDescription<string>>;
|
|
@@ -919,7 +716,7 @@ declare const registeredEntityDescriptionCreators: {
|
|
|
919
716
|
PersonalityTrait: EntityDescriptionCreator<"PersonalityTrait", {
|
|
920
717
|
getInstanceById: GetInstanceById<"Publication" | "Race" | "Culture" | "PersonalityTrait">;
|
|
921
718
|
} & StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, EntityDescription<string>>;
|
|
922
|
-
SexPractice: EntityDescriptionCreator<"SexPractice", AnyNonNullish & StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, EntityDescription<string>>;
|
|
719
|
+
SexPractice: EntityDescriptionCreator<"SexPractice", import("@elyukai/utils/nullable").AnyNonNullish & StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, EntityDescription<string>>;
|
|
923
720
|
};
|
|
924
721
|
/**
|
|
925
722
|
* The set of entities for which there is a registered description creator function.
|