@optolith/entity-descriptions 0.15.0 → 0.16.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.
Files changed (48) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/lib/creator.d.ts +13 -1
  3. package/lib/creator.js +32 -16
  4. package/lib/entities/activatable.d.ts +1 -1
  5. package/lib/entities/alternativeRule.d.ts +1 -1
  6. package/lib/entities/attribute.d.ts +1 -1
  7. package/lib/entities/combatTechnique.d.ts +2 -2
  8. package/lib/entities/condition.d.ts +2 -2
  9. package/lib/entities/culture.d.ts +1 -1
  10. package/lib/entities/curriculum.d.ts +1 -1
  11. package/lib/entities/derivedCharacteristic.d.ts +1 -1
  12. package/lib/entities/disease.d.ts +1 -1
  13. package/lib/entities/disease.js +5 -6
  14. package/lib/entities/elixir.d.ts +1 -1
  15. package/lib/entities/elixir.js +2 -2
  16. package/lib/entities/equipment.d.ts +4 -4
  17. package/lib/entities/equipmentPackage.d.ts +1 -1
  18. package/lib/entities/experienceLevel.d.ts +1 -1
  19. package/lib/entities/focusRule.d.ts +1 -1
  20. package/lib/entities/influence.d.ts +1 -1
  21. package/lib/entities/liturgicalChant.d.ts +3 -3
  22. package/lib/entities/optionalRule.d.ts +1 -1
  23. package/lib/entities/partial/commonnessRatedAdvantagesAndDisadvantages.d.ts +1 -1
  24. package/lib/entities/partial/enhancements.d.ts +1 -1
  25. package/lib/entities/partial/herbary.d.ts +6 -3
  26. package/lib/entities/partial/herbary.js +5 -3
  27. package/lib/entities/partial/prerequisites/index.d.ts +1 -1
  28. package/lib/entities/partial/rated/activatable/effect.d.ts +1 -1
  29. package/lib/entities/partial/rated/activatable/index.d.ts +1 -1
  30. package/lib/entities/partial/rated/activatable/targetCategory.d.ts +1 -1
  31. package/lib/entities/partial/rated/improvementCost.d.ts +1 -1
  32. package/lib/entities/personalityTrait.d.ts +1 -1
  33. package/lib/entities/poison.d.ts +1 -1
  34. package/lib/entities/poison.js +2 -2
  35. package/lib/entities/profession.d.ts +1 -1
  36. package/lib/entities/race.d.ts +1 -1
  37. package/lib/entities/sexPractice.d.ts +1 -1
  38. package/lib/entities/skill.d.ts +1 -1
  39. package/lib/entities/spell.d.ts +16 -16
  40. package/lib/entities/state.d.ts +1 -1
  41. package/lib/entities/tradeSecret.d.ts +1 -1
  42. package/lib/entityDescription.d.ts +118 -0
  43. package/lib/entityDescription.js +1 -0
  44. package/lib/index.d.ts +10 -213
  45. package/lib/rawEntityDescription.d.ts +144 -0
  46. package/lib/rawEntityDescription.js +1 -0
  47. package/lib/tsconfig.tsbuildinfo +1 -1
  48. package/package.json +2 -1
@@ -0,0 +1,144 @@
1
+ import type { AnyNonNullish } from "@elyukai/utils/nullable";
2
+ import type { Reader } from "@elyukai/utils/reader";
3
+ import type { Errata, PublicationRefs } from "@optolith/database-schema/gen";
4
+ /**
5
+ * A JSON representation of the rules text for a library entry that has not been
6
+ * cleaned up.
7
+ */
8
+ export type RawEntityDescription<Cols extends string = string, E = AnyNonNullish> = RawTextEntityDescription<E> | RawTabularEntityDescription<Cols, E> | RawTabularEntityDescription<Cols, E>[];
9
+ /**
10
+ * A JSON representation of the rules text for a library entry that has not been
11
+ * cleaned up.
12
+ */
13
+ export type RawTextEntityDescription<E> = {
14
+ type?: "text";
15
+ category?: {
16
+ label: Reader<E, string>;
17
+ value: Reader<E, string>;
18
+ };
19
+ title: string;
20
+ subtitle?: string;
21
+ badge?: RawEntityDescriptionBadge;
22
+ className: string;
23
+ body: (RawEntityDescriptionSection | RawEntityDescriptionSectionR<E> | undefined)[];
24
+ errata?: Errata;
25
+ references?: PublicationRefs;
26
+ };
27
+ /**
28
+ * A JSON representation of the table for a library entry that has not been
29
+ * cleaned up.
30
+ */
31
+ export type RawTabularEntityDescription<Cols extends string, E> = {
32
+ type: "tabular";
33
+ category?: {
34
+ label: Reader<E, string>;
35
+ value: Reader<E, string>;
36
+ };
37
+ title: string;
38
+ labels: {
39
+ [K in Cols]: Reader<E, string>;
40
+ };
41
+ values: {
42
+ [K in Cols]: Reader<E, string>;
43
+ };
44
+ additionalInformation?: ({
45
+ label: Reader<E, string>;
46
+ id: string;
47
+ value: Reader<E, string | undefined>;
48
+ } | undefined)[];
49
+ errata?: Errata;
50
+ references?: PublicationRefs;
51
+ };
52
+ /**
53
+ * A badge that can be displayed next to the title of a library entry.
54
+ */
55
+ export type RawEntityDescriptionBadge = {
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 RawEntityDescriptionSection = RawEntityDescriptionSectionContent<RawDefinitionListEntityDescriptionSection> | RawLabeledEntityDescriptionSection;
63
+ /**
64
+ * A labeled or unlabeled section of a library entry text.
65
+ */
66
+ export type RawEntityDescriptionSectionR<E> = RawEntityDescriptionSectionContent<RawDefinitionListEntityDescriptionSectionR<E>> | RawLabeledEntityDescriptionSectionR<E>;
67
+ /**
68
+ * A slice of the content of a library entry text.
69
+ */
70
+ export type RawEntityDescriptionSectionContent<DL> = RawPlainEntityDescriptionSection | DL | RawTableEntityDescriptionSection;
71
+ /**
72
+ * A labeled section of a library entry text.
73
+ */
74
+ export type RawLabeledEntityDescriptionSection = {
75
+ type: "labeled";
76
+ label: string;
77
+ value: RawEntityDescriptionSectionContent<RawDefinitionListEntityDescriptionSection>;
78
+ };
79
+ /**
80
+ * A labeled section of a library entry text.
81
+ */
82
+ export type RawLabeledEntityDescriptionSectionR<E> = {
83
+ type: "labeled";
84
+ label: string;
85
+ value: RawEntityDescriptionSectionContent<RawDefinitionListEntityDescriptionSectionR<E>>;
86
+ };
87
+ /**
88
+ * A plain text, possibly containing Markdown syntax.
89
+ */
90
+ export type RawPlainEntityDescriptionSection = {
91
+ type: "plain";
92
+ text: string;
93
+ };
94
+ /**
95
+ * A list of labeled values, such as prerequisites or quality levels.
96
+ */
97
+ export type RawDefinitionListEntityDescriptionSection = {
98
+ type: "definitionList";
99
+ items: (RawDefinitionListEntityDescriptionSectionItem | undefined)[];
100
+ };
101
+ /**
102
+ * A list of labeled values, such as prerequisites or quality levels.
103
+ */
104
+ export type RawDefinitionListEntityDescriptionSectionR<E> = {
105
+ type: "definitionList";
106
+ items: (RawDefinitionListEntityDescriptionSectionItemR<E> | undefined)[];
107
+ };
108
+ /**
109
+ * A list of labeled values, such as prerequisites or quality levels, nested within another definition list.
110
+ */
111
+ export type RawNestedDefinitionListEntityDescriptionSection = {
112
+ type: "definitionList";
113
+ /**
114
+ * How to render this definition list.
115
+ *
116
+ * - `"hidden"`: The definition list does not look like it is nested, it just looks like it belongs to its parent definition list.
117
+ * - `"nested"`: The definition list is visually nested inside its parent definition list, usually indented and with italic labels instead of bold ones.
118
+ */
119
+ style: "hidden" | "nested";
120
+ items: (RawDefinitionListEntityDescriptionSectionItem | undefined)[];
121
+ };
122
+ /**
123
+ * A single labeled value in a definition list.
124
+ */
125
+ export type RawDefinitionListEntityDescriptionSectionItem = {
126
+ label: string;
127
+ value: string | (RawEntityDescriptionSectionContent<RawNestedDefinitionListEntityDescriptionSection> | undefined)[];
128
+ };
129
+ /**
130
+ * A single labeled value in a definition list.
131
+ */
132
+ export type RawDefinitionListEntityDescriptionSectionItemR<E> = {
133
+ label: Reader<E, string>;
134
+ value: Reader<E, string | (RawEntityDescriptionSectionContent<RawNestedDefinitionListEntityDescriptionSection> | undefined)[]>;
135
+ };
136
+ /**
137
+ * A table with a header, rows, and an optional footer.
138
+ */
139
+ export type RawTableEntityDescriptionSection = {
140
+ type: "table";
141
+ header: string[];
142
+ rows: string[][];
143
+ footer?: string[];
144
+ };
@@ -0,0 +1 @@
1
+ export {};