@nakafa/aksara-contracts 8.9.1 → 8.12.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 (160) hide show
  1. package/dist/assessment/choice.d.ts +26 -0
  2. package/dist/assessment/document.d.ts +39 -0
  3. package/dist/assessment/figure.d.ts +13 -0
  4. package/dist/assessment/hash.d.ts +711 -111
  5. package/dist/assessment/inline.d.ts +53 -0
  6. package/dist/assessment/inline.js +1 -0
  7. package/dist/assessment/interaction.d.ts +26 -0
  8. package/dist/assessment/item.d.ts +414 -36
  9. package/dist/assessment/paper.d.ts +731 -131
  10. package/dist/assessment/part.d.ts +13 -0
  11. package/dist/assessment/rows.d.ts +336 -36
  12. package/dist/assessment/snapshot.d.ts +773 -121
  13. package/dist/release/snapshot/data.d.ts +26 -0
  14. package/dist/release/snapshot/verify.d.ts +336 -36
  15. package/dist/transport/group.d.ts +78 -0
  16. package/dist/transport/request.d.ts +2195 -343
  17. package/dist/transport/snapshot.d.ts +52 -0
  18. package/dist/visual/base/math.d.ts +56 -6
  19. package/dist/visual/base/media.d.ts +56 -6
  20. package/dist/visual/biology/bacteria.d.ts +224 -24
  21. package/dist/visual/biology/binomial.d.ts +139 -0
  22. package/dist/visual/biology/binomial.js +46 -0
  23. package/dist/visual/biology/blood.d.ts +56 -6
  24. package/dist/visual/biology/bone.d.ts +141 -0
  25. package/dist/visual/biology/bone.js +46 -0
  26. package/dist/visual/biology/cell.d.ts +168 -18
  27. package/dist/visual/biology/chromosome.d.ts +139 -0
  28. package/dist/visual/biology/chromosome.js +42 -0
  29. package/dist/visual/biology/climate.d.ts +168 -18
  30. package/dist/visual/biology/control.d.ts +17 -0
  31. package/dist/visual/biology/control.js +21 -0
  32. package/dist/visual/biology/denature.d.ts +159 -0
  33. package/dist/visual/biology/denature.js +74 -0
  34. package/dist/visual/biology/drawing.d.ts +151 -0
  35. package/dist/visual/biology/drawing.js +69 -0
  36. package/dist/visual/biology/ecology.d.ts +224 -24
  37. package/dist/visual/biology/enzyme.d.ts +145 -0
  38. package/dist/visual/biology/enzyme.js +54 -0
  39. package/dist/visual/biology/equipment.d.ts +140 -0
  40. package/dist/visual/biology/equipment.js +64 -0
  41. package/dist/visual/biology/gametogenesis.d.ts +145 -0
  42. package/dist/visual/biology/gametogenesis.js +83 -0
  43. package/dist/visual/biology/heart.d.ts +56 -6
  44. package/dist/visual/biology/implantation.d.ts +138 -0
  45. package/dist/visual/biology/implantation.js +44 -0
  46. package/dist/visual/biology/joint.d.ts +140 -0
  47. package/dist/visual/biology/joint.js +47 -0
  48. package/dist/visual/biology/key.d.ts +141 -0
  49. package/dist/visual/biology/key.js +58 -0
  50. package/dist/visual/biology/kingdom.d.ts +142 -0
  51. package/dist/visual/biology/kingdom.js +82 -0
  52. package/dist/visual/biology/lactase.d.ts +147 -0
  53. package/dist/visual/biology/lactase.js +48 -0
  54. package/dist/visual/biology/limb.d.ts +139 -0
  55. package/dist/visual/biology/limb.js +44 -0
  56. package/dist/visual/biology/lipid.d.ts +144 -0
  57. package/dist/visual/biology/lipid.js +43 -0
  58. package/dist/visual/biology/locomotion.d.ts +141 -0
  59. package/dist/visual/biology/locomotion.js +48 -0
  60. package/dist/visual/biology/menstrual.d.ts +148 -0
  61. package/dist/visual/biology/menstrual.js +65 -0
  62. package/dist/visual/biology/metamorphosis.d.ts +140 -0
  63. package/dist/visual/biology/metamorphosis.js +34 -0
  64. package/dist/visual/biology/mitochondrion.d.ts +56 -6
  65. package/dist/visual/biology/muscle.d.ts +56 -6
  66. package/dist/visual/biology/neuron.d.ts +56 -6
  67. package/dist/visual/biology/paddy.d.ts +56 -6
  68. package/dist/visual/biology/physiology.d.ts +168 -18
  69. package/dist/visual/biology/placenta.d.ts +139 -0
  70. package/dist/visual/biology/placenta.js +52 -0
  71. package/dist/visual/biology/planes.d.ts +145 -0
  72. package/dist/visual/biology/planes.js +62 -0
  73. package/dist/visual/biology/plant.d.ts +280 -30
  74. package/dist/visual/biology/protein.d.ts +142 -0
  75. package/dist/visual/biology/protein.js +41 -0
  76. package/dist/visual/biology/saturation.d.ts +149 -0
  77. package/dist/visual/biology/saturation.js +40 -0
  78. package/dist/visual/biology/secretion.d.ts +149 -0
  79. package/dist/visual/biology/secretion.js +79 -0
  80. package/dist/visual/biology/spill.d.ts +165 -0
  81. package/dist/visual/biology/spill.js +58 -0
  82. package/dist/visual/biology/sugar.d.ts +152 -0
  83. package/dist/visual/biology/sugar.js +59 -0
  84. package/dist/visual/biology/synapse.d.ts +56 -6
  85. package/dist/visual/biology/taxon.d.ts +138 -0
  86. package/dist/visual/biology/taxon.js +50 -0
  87. package/dist/visual/biology/twins.d.ts +144 -0
  88. package/dist/visual/biology/twins.js +60 -0
  89. package/dist/visual/biology/vernacular.d.ts +141 -0
  90. package/dist/visual/biology/vernacular.js +57 -0
  91. package/dist/visual/biology/vertebra.d.ts +141 -0
  92. package/dist/visual/biology/vertebra.js +59 -0
  93. package/dist/visual/biology/vessel.d.ts +56 -6
  94. package/dist/visual/biology/waste.d.ts +140 -0
  95. package/dist/visual/biology/waste.js +57 -0
  96. package/dist/visual/biology/water.d.ts +152 -0
  97. package/dist/visual/biology/water.js +54 -0
  98. package/dist/visual/biology/yeast.d.ts +56 -6
  99. package/dist/visual/card.d.ts +67 -6
  100. package/dist/visual/card.js +17 -1
  101. package/dist/visual/catalog.d.ts +21584 -5487
  102. package/dist/visual/catalog.js +66 -0
  103. package/dist/visual/chemistry/atom.d.ts +168 -18
  104. package/dist/visual/chemistry/balance.d.ts +280 -30
  105. package/dist/visual/chemistry/bonding.d.ts +280 -30
  106. package/dist/visual/chemistry/discovery.d.ts +392 -42
  107. package/dist/visual/chemistry/electrochemistry.d.ts +112 -12
  108. package/dist/visual/chemistry/electron.d.ts +112 -12
  109. package/dist/visual/chemistry/laws.d.ts +224 -24
  110. package/dist/visual/chemistry/particles.d.ts +280 -30
  111. package/dist/visual/chemistry/periodic.d.ts +112 -12
  112. package/dist/visual/chemistry/rate.d.ts +56 -6
  113. package/dist/visual/chemistry/reaction.d.ts +168 -18
  114. package/dist/visual/chemistry/titration.d.ts +56 -6
  115. package/dist/visual/length.d.ts +56 -6
  116. package/dist/visual/mathematics/argument.d.ts +226 -0
  117. package/dist/visual/mathematics/argument.js +150 -0
  118. package/dist/visual/mathematics/chance.d.ts +168 -18
  119. package/dist/visual/mathematics/chart.d.ts +56 -6
  120. package/dist/visual/mathematics/charts.d.ts +280 -30
  121. package/dist/visual/mathematics/counterexample.d.ts +340 -0
  122. package/dist/visual/mathematics/counterexample.js +157 -0
  123. package/dist/visual/mathematics/function.d.ts +168 -18
  124. package/dist/visual/mathematics/journey.d.ts +56 -6
  125. package/dist/visual/mathematics/logic.d.ts +56 -6
  126. package/dist/visual/mathematics/network.d.ts +56 -6
  127. package/dist/visual/mathematics/numeral.d.ts +168 -18
  128. package/dist/visual/mathematics/sets.d.ts +56 -6
  129. package/dist/visual/physics/braking.d.ts +224 -24
  130. package/dist/visual/physics/circuit.d.ts +224 -24
  131. package/dist/visual/physics/circular.d.ts +112 -12
  132. package/dist/visual/physics/dynamics.d.ts +392 -42
  133. package/dist/visual/physics/efficiency.d.ts +336 -36
  134. package/dist/visual/physics/electronics.d.ts +168 -18
  135. package/dist/visual/physics/falling.d.ts +224 -24
  136. package/dist/visual/physics/field.d.ts +168 -18
  137. package/dist/visual/physics/fluid.d.ts +224 -24
  138. package/dist/visual/physics/force.d.ts +280 -30
  139. package/dist/visual/physics/gravity.d.ts +112 -12
  140. package/dist/visual/physics/heat.d.ts +168 -18
  141. package/dist/visual/physics/instrument.d.ts +392 -42
  142. package/dist/visual/physics/light.d.ts +224 -24
  143. package/dist/visual/physics/measurement.d.ts +224 -24
  144. package/dist/visual/physics/motion.d.ts +336 -36
  145. package/dist/visual/physics/nuclear.d.ts +168 -18
  146. package/dist/visual/physics/parabolic.d.ts +56 -6
  147. package/dist/visual/physics/position.d.ts +336 -36
  148. package/dist/visual/physics/power.d.ts +448 -48
  149. package/dist/visual/physics/precision.d.ts +392 -42
  150. package/dist/visual/physics/product.d.ts +224 -24
  151. package/dist/visual/physics/reading.d.ts +168 -18
  152. package/dist/visual/physics/record.d.ts +112 -12
  153. package/dist/visual/physics/relative.d.ts +168 -18
  154. package/dist/visual/physics/solar.d.ts +336 -36
  155. package/dist/visual/physics/thermodynamics.d.ts +56 -6
  156. package/dist/visual/physics/vector.d.ts +280 -30
  157. package/dist/visual/physics/velocity.d.ts +392 -42
  158. package/dist/visual/physics/wave.d.ts +224 -24
  159. package/dist/visual/politics.d.ts +336 -36
  160. package/package.json +1 -1
@@ -0,0 +1,226 @@
1
+ import { Schema } from "effect";
2
+ import type { RichSlot } from "#contracts/visual/card";
3
+ /** The argument labs, where an argument is checked for its form. */
4
+ export declare function argumentVisuals<E>(rich: RichSlot<E>): {
5
+ ArgumentChainLab: import("#contracts/visual/entry").VisualEntry<Schema.Struct<{
6
+ readonly description: RichSlot<E>;
7
+ readonly footer: Schema.optionalKey<Schema.Codec<readonly [{
8
+ readonly marks?: readonly [{
9
+ readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
10
+ } | {
11
+ readonly attrs: {
12
+ readonly href: string;
13
+ };
14
+ readonly type: "link";
15
+ } | {
16
+ readonly attrs: {
17
+ readonly variant: "success" | "warning" | null;
18
+ };
19
+ readonly type: "highlight";
20
+ }, ...({
21
+ readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
22
+ } | {
23
+ readonly attrs: {
24
+ readonly href: string;
25
+ };
26
+ readonly type: "link";
27
+ } | {
28
+ readonly attrs: {
29
+ readonly variant: "success" | "warning" | null;
30
+ };
31
+ readonly type: "highlight";
32
+ })[]];
33
+ readonly text: string;
34
+ readonly type: "text";
35
+ } | {
36
+ readonly attrs: {
37
+ readonly latex: string;
38
+ };
39
+ readonly marks?: readonly [{
40
+ readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
41
+ } | {
42
+ readonly attrs: {
43
+ readonly href: string;
44
+ };
45
+ readonly type: "link";
46
+ } | {
47
+ readonly attrs: {
48
+ readonly variant: "success" | "warning" | null;
49
+ };
50
+ readonly type: "highlight";
51
+ }, ...({
52
+ readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
53
+ } | {
54
+ readonly attrs: {
55
+ readonly href: string;
56
+ };
57
+ readonly type: "link";
58
+ } | {
59
+ readonly attrs: {
60
+ readonly variant: "success" | "warning" | null;
61
+ };
62
+ readonly type: "highlight";
63
+ })[]];
64
+ readonly type: "mathInline";
65
+ }, ...({
66
+ readonly marks?: readonly [{
67
+ readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
68
+ } | {
69
+ readonly attrs: {
70
+ readonly href: string;
71
+ };
72
+ readonly type: "link";
73
+ } | {
74
+ readonly attrs: {
75
+ readonly variant: "success" | "warning" | null;
76
+ };
77
+ readonly type: "highlight";
78
+ }, ...({
79
+ readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
80
+ } | {
81
+ readonly attrs: {
82
+ readonly href: string;
83
+ };
84
+ readonly type: "link";
85
+ } | {
86
+ readonly attrs: {
87
+ readonly variant: "success" | "warning" | null;
88
+ };
89
+ readonly type: "highlight";
90
+ })[]];
91
+ readonly text: string;
92
+ readonly type: "text";
93
+ } | {
94
+ readonly attrs: {
95
+ readonly latex: string;
96
+ };
97
+ readonly marks?: readonly [{
98
+ readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
99
+ } | {
100
+ readonly attrs: {
101
+ readonly href: string;
102
+ };
103
+ readonly type: "link";
104
+ } | {
105
+ readonly attrs: {
106
+ readonly variant: "success" | "warning" | null;
107
+ };
108
+ readonly type: "highlight";
109
+ }, ...({
110
+ readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
111
+ } | {
112
+ readonly attrs: {
113
+ readonly href: string;
114
+ };
115
+ readonly type: "link";
116
+ } | {
117
+ readonly attrs: {
118
+ readonly variant: "success" | "warning" | null;
119
+ };
120
+ readonly type: "highlight";
121
+ })[]];
122
+ readonly type: "mathInline";
123
+ })[]], E, never, never>>;
124
+ readonly title: RichSlot<E>;
125
+ readonly conclusion: Schema.Union<readonly [Schema.Struct<{
126
+ readonly statement: Schema.Union<readonly [Schema.Struct<{
127
+ readonly kind: Schema.Literal<"all">;
128
+ readonly predicate: Schema.Trimmed;
129
+ readonly subject: Schema.Trimmed;
130
+ }>, Schema.Struct<{
131
+ readonly kind: Schema.Literal<"member">;
132
+ readonly member: Schema.Trimmed;
133
+ readonly set: Schema.Trimmed;
134
+ }>, Schema.Struct<{
135
+ readonly antecedent: Schema.Trimmed;
136
+ readonly consequent: Schema.Trimmed;
137
+ readonly kind: Schema.Literal<"conditional">;
138
+ }>, Schema.Struct<{
139
+ readonly kind: Schema.Literal<"claim">;
140
+ readonly negated: Schema.Boolean;
141
+ readonly statement: Schema.Trimmed;
142
+ }>]>;
143
+ readonly text: Schema.Trimmed;
144
+ readonly truth: Schema.Boolean;
145
+ }>, Schema.Literal<"open">]>;
146
+ readonly hand: Schema.NonEmptyArray<Schema.Struct<{
147
+ readonly statement: Schema.Union<readonly [Schema.Struct<{
148
+ readonly kind: Schema.Literal<"all">;
149
+ readonly predicate: Schema.Trimmed;
150
+ readonly subject: Schema.Trimmed;
151
+ }>, Schema.Struct<{
152
+ readonly kind: Schema.Literal<"member">;
153
+ readonly member: Schema.Trimmed;
154
+ readonly set: Schema.Trimmed;
155
+ }>, Schema.Struct<{
156
+ readonly antecedent: Schema.Trimmed;
157
+ readonly consequent: Schema.Trimmed;
158
+ readonly kind: Schema.Literal<"conditional">;
159
+ }>, Schema.Struct<{
160
+ readonly kind: Schema.Literal<"claim">;
161
+ readonly negated: Schema.Boolean;
162
+ readonly statement: Schema.Trimmed;
163
+ }>]>;
164
+ readonly text: Schema.Trimmed;
165
+ readonly truth: Schema.Boolean;
166
+ }>>;
167
+ readonly premises: Schema.Tuple<readonly [Schema.Union<readonly [Schema.Struct<{
168
+ readonly statement: Schema.Union<readonly [Schema.Struct<{
169
+ readonly kind: Schema.Literal<"all">;
170
+ readonly predicate: Schema.Trimmed;
171
+ readonly subject: Schema.Trimmed;
172
+ }>, Schema.Struct<{
173
+ readonly kind: Schema.Literal<"member">;
174
+ readonly member: Schema.Trimmed;
175
+ readonly set: Schema.Trimmed;
176
+ }>, Schema.Struct<{
177
+ readonly antecedent: Schema.Trimmed;
178
+ readonly consequent: Schema.Trimmed;
179
+ readonly kind: Schema.Literal<"conditional">;
180
+ }>, Schema.Struct<{
181
+ readonly kind: Schema.Literal<"claim">;
182
+ readonly negated: Schema.Boolean;
183
+ readonly statement: Schema.Trimmed;
184
+ }>]>;
185
+ readonly text: Schema.Trimmed;
186
+ readonly truth: Schema.Boolean;
187
+ }>, Schema.Literal<"open">]>, Schema.Union<readonly [Schema.Struct<{
188
+ readonly statement: Schema.Union<readonly [Schema.Struct<{
189
+ readonly kind: Schema.Literal<"all">;
190
+ readonly predicate: Schema.Trimmed;
191
+ readonly subject: Schema.Trimmed;
192
+ }>, Schema.Struct<{
193
+ readonly kind: Schema.Literal<"member">;
194
+ readonly member: Schema.Trimmed;
195
+ readonly set: Schema.Trimmed;
196
+ }>, Schema.Struct<{
197
+ readonly antecedent: Schema.Trimmed;
198
+ readonly consequent: Schema.Trimmed;
199
+ readonly kind: Schema.Literal<"conditional">;
200
+ }>, Schema.Struct<{
201
+ readonly kind: Schema.Literal<"claim">;
202
+ readonly negated: Schema.Boolean;
203
+ readonly statement: Schema.Trimmed;
204
+ }>]>;
205
+ readonly text: Schema.Trimmed;
206
+ readonly truth: Schema.Boolean;
207
+ }>, Schema.Literal<"open">]>]>;
208
+ readonly labels: Schema.Struct<{
209
+ readonly conclusion: Schema.Trimmed;
210
+ readonly fallacies: Schema.$Record<Schema.Literals<readonly ["consequent", "antecedent", "middle"]>, RichSlot<E>>;
211
+ readonly form: RichSlot<E>;
212
+ readonly forms: Schema.$Record<Schema.Literals<readonly ["I", "II", "III"]>, RichSlot<E>>;
213
+ readonly hand: Schema.Trimmed;
214
+ readonly no: RichSlot<E>;
215
+ readonly premises: Schema.Tuple<readonly [Schema.Trimmed, Schema.Trimmed]>;
216
+ readonly sound: RichSlot<E>;
217
+ readonly truth: RichSlot<E>;
218
+ readonly unfollowed: RichSlot<E>;
219
+ readonly unlinked: RichSlot<E>;
220
+ readonly valid: RichSlot<E>;
221
+ readonly viewLabel: Schema.Trimmed;
222
+ readonly yes: RichSlot<E>;
223
+ }>;
224
+ readonly showVerdict: Schema.optionalKey<Schema.Boolean>;
225
+ }>, "figure">;
226
+ };
@@ -0,0 +1,150 @@
1
+ import { Array as Arr, Schema } from "effect";
2
+ import { byIds, cardFields, TextSchema } from "#contracts/visual/card";
3
+ import { answerAt, figure } from "#contracts/visual/entry";
4
+ /** The textbook's three valid forms of argument, and the fallacies that look like them. */
5
+ const ARGUMENT_FORMS = ["I", "II", "III"];
6
+ const ARGUMENT_FALLACIES = ["consequent", "antecedent", "middle"];
7
+ /** The most cards the hand holds, the longest card text, and the longest slot name. */
8
+ const HAND_LIMIT = 3;
9
+ const CARD_TEXT_LIMIT = 100;
10
+ const SLOT_NAME_LIMIT = 12;
11
+ /**
12
+ * What one card says, in the shapes the three forms are built from: "All A
13
+ * are B" (`all`), "c is A" (`member`), "If p, then q" (`conditional`), and
14
+ * "p is true" or "Not p is true" (`claim`). The names are the lesson's own
15
+ * ids for its sets and statements, never shown: two cards that speak of one
16
+ * set or one statement use one name.
17
+ */
18
+ const StatementSchema = Schema.Union([
19
+ Schema.Struct({
20
+ kind: Schema.Literal("all"),
21
+ predicate: TextSchema,
22
+ subject: TextSchema,
23
+ }),
24
+ Schema.Struct({
25
+ kind: Schema.Literal("member"),
26
+ member: TextSchema,
27
+ set: TextSchema,
28
+ }),
29
+ Schema.Struct({
30
+ antecedent: TextSchema,
31
+ consequent: TextSchema,
32
+ kind: Schema.Literal("conditional"),
33
+ }),
34
+ Schema.Struct({
35
+ kind: Schema.Literal("claim"),
36
+ negated: Schema.Boolean,
37
+ statement: TextSchema,
38
+ }),
39
+ ]);
40
+ /** One card: the words the learner reads, what they say, and whether that is true. */
41
+ const ArgumentCardSchema = Schema.Struct({
42
+ statement: StatementSchema,
43
+ text: TextSchema.check(Schema.isMaxLength(CARD_TEXT_LIMIT)),
44
+ truth: Schema.Boolean,
45
+ });
46
+ /** A slot of the chain: a card the lesson places, or `open` for the learner to fill from the hand. */
47
+ const ArgumentSlotSchema = Schema.Union([
48
+ ArgumentCardSchema,
49
+ Schema.Literal("open"),
50
+ ]);
51
+ /** The chain's three slots and the hand the learner fills the open ones from. */
52
+ const ArgumentChainSchema = Schema.Struct({
53
+ conclusion: ArgumentSlotSchema,
54
+ hand: Schema.NonEmptyArray(ArgumentCardSchema).check(Schema.isMaxLength(HAND_LIMIT)),
55
+ premises: Schema.Tuple([ArgumentSlotSchema, ArgumentSlotSchema]),
56
+ });
57
+ /** A slot's name on its brass plate. */
58
+ const SlotNameSchema = TextSchema.check(Schema.isMaxLength(SLOT_NAME_LIMIT));
59
+ const sameStatement = Schema.toEquivalence(StatementSchema);
60
+ /** Every card a single slot can take, paired with the hand left after placing it. */
61
+ function picksFor(slot, hand) {
62
+ return slot === "open"
63
+ ? Arr.map(hand, (card, index) => [card, Arr.remove(hand, index)])
64
+ : [[slot, hand]];
65
+ }
66
+ /** Every way the hand fills the open slots, one card to a slot and no card twice, with the placed cards kept. */
67
+ function dealsOf([firstSlot, secondSlot, thirdSlot], hand) {
68
+ return Arr.flatMap(picksFor(firstSlot, hand), ([first, afterFirst]) => Arr.flatMap(picksFor(secondSlot, afterFirst), ([second, afterSecond]) => Arr.map(picksFor(thirdSlot, afterSecond), ([conclusion]) => [first, second, conclusion])));
69
+ }
70
+ /** Whether a statement is general: a rule about every member or every case. */
71
+ function isGeneral(statement) {
72
+ return statement.kind === "all" || statement.kind === "conditional";
73
+ }
74
+ /** Whether two statements say one thing and its opposite. */
75
+ function contradicts(left, right) {
76
+ return (left.kind === "claim" &&
77
+ right.kind === "claim" &&
78
+ left.statement === right.statement &&
79
+ left.negated !== right.negated);
80
+ }
81
+ /**
82
+ * Whether a full chain is one the lab can judge: valid only through form I,
83
+ * II or III, or invalid. Two general premises chain into a valid argument the
84
+ * lab does not teach, premises that contradict each other prove anything, and
85
+ * a conclusion that repeats a premise follows trivially; none of these may
86
+ * be dealt.
87
+ */
88
+ function isJudgeable([first, second, conclusion]) {
89
+ return !((isGeneral(first.statement) && isGeneral(second.statement)) ||
90
+ contradicts(first.statement, second.statement) ||
91
+ sameStatement(conclusion.statement, first.statement) ||
92
+ sameStatement(conclusion.statement, second.statement));
93
+ }
94
+ /**
95
+ * Whether the learner has a slot to fill and a card for each open slot, the
96
+ * hand's cards read differently, and every chain the hand can deal is one
97
+ * the lab can judge.
98
+ */
99
+ function isDealable({ conclusion, hand, premises, }) {
100
+ const slots = [
101
+ premises[0],
102
+ premises[1],
103
+ conclusion,
104
+ ];
105
+ const open = Arr.filter(slots, (slot) => slot === "open").length;
106
+ const texts = Arr.map(hand, ({ text }) => text);
107
+ return (open > 0 &&
108
+ hand.length >= open &&
109
+ Arr.dedupe(texts).length === texts.length &&
110
+ Arr.every(dealsOf(slots, hand), isJudgeable));
111
+ }
112
+ /**
113
+ * Props of `ArgumentChainLab`: an argument built from cards on a rail, two
114
+ * `premises` and a `conclusion` joined by two chain links. Each slot holds a
115
+ * card the lesson places, or is `open` for the learner to fill from the
116
+ * `hand`, whose cards the toolbar deals in. With `showVerdict`, each link
117
+ * locks when the step holds and breaks where the argument fails, a seal marks
118
+ * each false card, and the footer names the form or the fallacy and reads
119
+ * whether the argument is valid, its premises true and the argument sound,
120
+ * so it is answer state.
121
+ */
122
+ function argumentChainLab(rich) {
123
+ return figure(Schema.Struct({
124
+ ...cardFields(rich),
125
+ ...ArgumentChainSchema.fields,
126
+ labels: Schema.Struct({
127
+ conclusion: SlotNameSchema,
128
+ fallacies: byIds(ARGUMENT_FALLACIES, rich),
129
+ form: rich,
130
+ forms: byIds(ARGUMENT_FORMS, rich),
131
+ hand: TextSchema,
132
+ no: rich,
133
+ premises: Schema.Tuple([SlotNameSchema, SlotNameSchema]),
134
+ sound: rich,
135
+ truth: rich,
136
+ unfollowed: rich,
137
+ unlinked: rich,
138
+ valid: rich,
139
+ viewLabel: TextSchema,
140
+ yes: rich,
141
+ }),
142
+ showVerdict: Schema.optionalKey(Schema.Boolean),
143
+ }).check(Schema.makeFilter(isDealable, {
144
+ message: "Expected an open slot, a hand with a different card for each open slot, and no deal the lab cannot judge: two general premises, contradicting premises, or a conclusion that repeats a premise.",
145
+ })), answerAt(["showVerdict"]));
146
+ }
147
+ /** The argument labs, where an argument is checked for its form. */
148
+ export function argumentVisuals(rich) {
149
+ return { ArgumentChainLab: argumentChainLab(rich) };
150
+ }
@@ -5,11 +5,64 @@ export declare function chanceVisuals<E>(rich: RichSlot<E>): {
5
5
  DiceRollLab: import("#contracts/visual/entry").VisualEntry<Schema.Struct<{
6
6
  readonly description: RichSlot<E>;
7
7
  readonly footer: Schema.optionalKey<Schema.Codec<readonly [{
8
+ readonly marks?: readonly [{
9
+ readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
10
+ } | {
11
+ readonly attrs: {
12
+ readonly href: string;
13
+ };
14
+ readonly type: "link";
15
+ } | {
16
+ readonly attrs: {
17
+ readonly variant: "success" | "warning" | null;
18
+ };
19
+ readonly type: "highlight";
20
+ }, ...({
21
+ readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
22
+ } | {
23
+ readonly attrs: {
24
+ readonly href: string;
25
+ };
26
+ readonly type: "link";
27
+ } | {
28
+ readonly attrs: {
29
+ readonly variant: "success" | "warning" | null;
30
+ };
31
+ readonly type: "highlight";
32
+ })[]];
33
+ readonly text: string;
34
+ readonly type: "text";
35
+ } | {
8
36
  readonly attrs: {
9
37
  readonly latex: string;
10
38
  };
39
+ readonly marks?: readonly [{
40
+ readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
41
+ } | {
42
+ readonly attrs: {
43
+ readonly href: string;
44
+ };
45
+ readonly type: "link";
46
+ } | {
47
+ readonly attrs: {
48
+ readonly variant: "success" | "warning" | null;
49
+ };
50
+ readonly type: "highlight";
51
+ }, ...({
52
+ readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
53
+ } | {
54
+ readonly attrs: {
55
+ readonly href: string;
56
+ };
57
+ readonly type: "link";
58
+ } | {
59
+ readonly attrs: {
60
+ readonly variant: "success" | "warning" | null;
61
+ };
62
+ readonly type: "highlight";
63
+ })[]];
11
64
  readonly type: "mathInline";
12
- } | {
65
+ }, ...({
13
66
  readonly marks?: readonly [{
14
67
  readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
15
68
  } | {
@@ -37,12 +90,10 @@ export declare function chanceVisuals<E>(rich: RichSlot<E>): {
37
90
  })[]];
38
91
  readonly text: string;
39
92
  readonly type: "text";
40
- }, ...({
93
+ } | {
41
94
  readonly attrs: {
42
95
  readonly latex: string;
43
96
  };
44
- readonly type: "mathInline";
45
- } | {
46
97
  readonly marks?: readonly [{
47
98
  readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
48
99
  } | {
@@ -68,8 +119,7 @@ export declare function chanceVisuals<E>(rich: RichSlot<E>): {
68
119
  };
69
120
  readonly type: "highlight";
70
121
  })[]];
71
- readonly text: string;
72
- readonly type: "text";
122
+ readonly type: "mathInline";
73
123
  })[]], E, never, never>>;
74
124
  readonly title: RichSlot<E>;
75
125
  readonly dice: Schema.Literals<readonly [1, 2]>;
@@ -85,11 +135,64 @@ export declare function chanceVisuals<E>(rich: RichSlot<E>): {
85
135
  GaltonBoardLab: import("#contracts/visual/entry").VisualEntry<Schema.Struct<{
86
136
  readonly description: RichSlot<E>;
87
137
  readonly footer: Schema.optionalKey<Schema.Codec<readonly [{
138
+ readonly marks?: readonly [{
139
+ readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
140
+ } | {
141
+ readonly attrs: {
142
+ readonly href: string;
143
+ };
144
+ readonly type: "link";
145
+ } | {
146
+ readonly attrs: {
147
+ readonly variant: "success" | "warning" | null;
148
+ };
149
+ readonly type: "highlight";
150
+ }, ...({
151
+ readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
152
+ } | {
153
+ readonly attrs: {
154
+ readonly href: string;
155
+ };
156
+ readonly type: "link";
157
+ } | {
158
+ readonly attrs: {
159
+ readonly variant: "success" | "warning" | null;
160
+ };
161
+ readonly type: "highlight";
162
+ })[]];
163
+ readonly text: string;
164
+ readonly type: "text";
165
+ } | {
88
166
  readonly attrs: {
89
167
  readonly latex: string;
90
168
  };
169
+ readonly marks?: readonly [{
170
+ readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
171
+ } | {
172
+ readonly attrs: {
173
+ readonly href: string;
174
+ };
175
+ readonly type: "link";
176
+ } | {
177
+ readonly attrs: {
178
+ readonly variant: "success" | "warning" | null;
179
+ };
180
+ readonly type: "highlight";
181
+ }, ...({
182
+ readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
183
+ } | {
184
+ readonly attrs: {
185
+ readonly href: string;
186
+ };
187
+ readonly type: "link";
188
+ } | {
189
+ readonly attrs: {
190
+ readonly variant: "success" | "warning" | null;
191
+ };
192
+ readonly type: "highlight";
193
+ })[]];
91
194
  readonly type: "mathInline";
92
- } | {
195
+ }, ...({
93
196
  readonly marks?: readonly [{
94
197
  readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
95
198
  } | {
@@ -117,12 +220,10 @@ export declare function chanceVisuals<E>(rich: RichSlot<E>): {
117
220
  })[]];
118
221
  readonly text: string;
119
222
  readonly type: "text";
120
- }, ...({
223
+ } | {
121
224
  readonly attrs: {
122
225
  readonly latex: string;
123
226
  };
124
- readonly type: "mathInline";
125
- } | {
126
227
  readonly marks?: readonly [{
127
228
  readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
128
229
  } | {
@@ -148,8 +249,7 @@ export declare function chanceVisuals<E>(rich: RichSlot<E>): {
148
249
  };
149
250
  readonly type: "highlight";
150
251
  })[]];
151
- readonly text: string;
152
- readonly type: "text";
252
+ readonly type: "mathInline";
153
253
  })[]], E, never, never>>;
154
254
  readonly title: RichSlot<E>;
155
255
  readonly labels: Schema.Struct<{
@@ -168,11 +268,64 @@ export declare function chanceVisuals<E>(rich: RichSlot<E>): {
168
268
  MarbleDrawLab: import("#contracts/visual/entry").VisualEntry<Schema.Struct<{
169
269
  readonly description: RichSlot<E>;
170
270
  readonly footer: Schema.optionalKey<Schema.Codec<readonly [{
271
+ readonly marks?: readonly [{
272
+ readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
273
+ } | {
274
+ readonly attrs: {
275
+ readonly href: string;
276
+ };
277
+ readonly type: "link";
278
+ } | {
279
+ readonly attrs: {
280
+ readonly variant: "success" | "warning" | null;
281
+ };
282
+ readonly type: "highlight";
283
+ }, ...({
284
+ readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
285
+ } | {
286
+ readonly attrs: {
287
+ readonly href: string;
288
+ };
289
+ readonly type: "link";
290
+ } | {
291
+ readonly attrs: {
292
+ readonly variant: "success" | "warning" | null;
293
+ };
294
+ readonly type: "highlight";
295
+ })[]];
296
+ readonly text: string;
297
+ readonly type: "text";
298
+ } | {
171
299
  readonly attrs: {
172
300
  readonly latex: string;
173
301
  };
302
+ readonly marks?: readonly [{
303
+ readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
304
+ } | {
305
+ readonly attrs: {
306
+ readonly href: string;
307
+ };
308
+ readonly type: "link";
309
+ } | {
310
+ readonly attrs: {
311
+ readonly variant: "success" | "warning" | null;
312
+ };
313
+ readonly type: "highlight";
314
+ }, ...({
315
+ readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
316
+ } | {
317
+ readonly attrs: {
318
+ readonly href: string;
319
+ };
320
+ readonly type: "link";
321
+ } | {
322
+ readonly attrs: {
323
+ readonly variant: "success" | "warning" | null;
324
+ };
325
+ readonly type: "highlight";
326
+ })[]];
174
327
  readonly type: "mathInline";
175
- } | {
328
+ }, ...({
176
329
  readonly marks?: readonly [{
177
330
  readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
178
331
  } | {
@@ -200,12 +353,10 @@ export declare function chanceVisuals<E>(rich: RichSlot<E>): {
200
353
  })[]];
201
354
  readonly text: string;
202
355
  readonly type: "text";
203
- }, ...({
356
+ } | {
204
357
  readonly attrs: {
205
358
  readonly latex: string;
206
359
  };
207
- readonly type: "mathInline";
208
- } | {
209
360
  readonly marks?: readonly [{
210
361
  readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
211
362
  } | {
@@ -231,8 +382,7 @@ export declare function chanceVisuals<E>(rich: RichSlot<E>): {
231
382
  };
232
383
  readonly type: "highlight";
233
384
  })[]];
234
- readonly text: string;
235
- readonly type: "text";
385
+ readonly type: "mathInline";
236
386
  })[]], E, never, never>>;
237
387
  readonly title: RichSlot<E>;
238
388
  readonly event: Schema.optionalKey<Schema.Struct<{