@nakafa/aksara-contracts 6.5.0 → 7.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.
Files changed (117) hide show
  1. package/dist/assessment/catalog.d.ts +18 -5
  2. package/dist/assessment/catalog.js +18 -8
  3. package/dist/assessment/choice.d.ts +10 -0
  4. package/dist/assessment/closure.d.ts +2 -1
  5. package/dist/assessment/closure.js +43 -62
  6. package/dist/assessment/document.d.ts +18 -0
  7. package/dist/assessment/document.js +10 -0
  8. package/dist/assessment/figure.d.ts +47605 -1555
  9. package/dist/assessment/figure.js +14 -217
  10. package/dist/assessment/hash.d.ts +274 -4
  11. package/dist/assessment/inline.d.ts +25 -0
  12. package/dist/assessment/inline.js +22 -3
  13. package/dist/assessment/interaction.d.ts +10 -0
  14. package/dist/assessment/item.d.ts +864 -0
  15. package/dist/assessment/item.js +10 -2
  16. package/dist/assessment/locales.d.ts +10 -0
  17. package/dist/assessment/locales.js +58 -0
  18. package/dist/assessment/paper.d.ts +1349 -12
  19. package/dist/assessment/paper.js +93 -9
  20. package/dist/assessment/part.d.ts +5 -0
  21. package/dist/assessment/profile.d.ts +4 -4
  22. package/dist/assessment/rows.d.ts +1409 -0
  23. package/dist/assessment/rows.js +44 -0
  24. package/dist/assessment/scalar.d.ts +1 -1
  25. package/dist/assessment/scoring.d.ts +1 -1
  26. package/dist/assessment/snapshot.d.ts +372 -20
  27. package/dist/assessment/structure.d.ts +6 -0
  28. package/dist/assessment/structure.js +22 -2
  29. package/dist/locale.d.ts +9 -9
  30. package/dist/locale.js +4 -3
  31. package/dist/program/snapshot/hash.d.ts +2 -2
  32. package/dist/program/snapshot/spec.d.ts +2 -2
  33. package/dist/projection/material.d.ts +10 -0
  34. package/dist/projection/material.js +1 -1
  35. package/dist/quran/attribution.d.ts +2 -2
  36. package/dist/quran/identity.d.ts +31 -10
  37. package/dist/quran/identity.js +15 -3
  38. package/dist/quran/provenance.d.ts +16 -16
  39. package/dist/quran/provenance.js +4 -1
  40. package/dist/quran/snapshot/hash.d.ts +2 -2
  41. package/dist/quran/snapshot/row/hash.d.ts +48 -15
  42. package/dist/quran/snapshot/row.d.ts +18 -8
  43. package/dist/quran/snapshot/spec.d.ts +2 -2
  44. package/dist/quran/source.d.ts +17 -7
  45. package/dist/quran/source.js +13 -1
  46. package/dist/quran/spec.d.ts +4 -4
  47. package/dist/quran/spec.js +2 -1
  48. package/dist/release/current/evidence.d.ts +9 -9
  49. package/dist/release/current/state.d.ts +11 -11
  50. package/dist/release/hash.d.ts +2 -2
  51. package/dist/release/identity.d.ts +1 -1
  52. package/dist/release/lifecycle.d.ts +7 -7
  53. package/dist/release/policy.d.ts +1 -1
  54. package/dist/release/snapshot/data.d.ts +36 -11
  55. package/dist/release/snapshot/evidence/assessment.d.ts +1 -1
  56. package/dist/release/snapshot/evidence/program.d.ts +1 -1
  57. package/dist/release/snapshot/evidence/quran.d.ts +1 -1
  58. package/dist/release/snapshot/evidence.d.ts +3 -3
  59. package/dist/release/snapshot/verify.d.ts +179 -12
  60. package/dist/release/spec.d.ts +13 -13
  61. package/dist/release/verify.d.ts +2 -2
  62. package/dist/runtime/spec.d.ts +6 -6
  63. package/dist/runtime/verify.d.ts +4 -4
  64. package/dist/transport/group.d.ts +108 -33
  65. package/dist/transport/request.d.ts +1166 -114
  66. package/dist/transport/response.d.ts +64 -64
  67. package/dist/transport/snapshot.d.ts +72 -22
  68. package/dist/visual/base/layout.d.ts +27 -0
  69. package/dist/visual/base/layout.js +35 -0
  70. package/dist/visual/base/math.d.ts +523 -0
  71. package/dist/visual/base/math.js +72 -0
  72. package/dist/visual/base/media.d.ts +13 -0
  73. package/dist/visual/base/media.js +25 -0
  74. package/dist/visual/biology.d.ts +203 -0
  75. package/dist/visual/biology.js +108 -0
  76. package/dist/visual/card.d.ts +32 -0
  77. package/dist/visual/card.js +30 -0
  78. package/dist/visual/catalog.d.ts +28633 -0
  79. package/dist/visual/catalog.js +73 -0
  80. package/dist/visual/chemistry/atom.d.ts +79 -0
  81. package/dist/visual/chemistry/atom.js +109 -0
  82. package/dist/visual/chemistry/electron.d.ts +41 -0
  83. package/dist/visual/chemistry/electron.js +69 -0
  84. package/dist/visual/chemistry/laws.d.ts +86 -0
  85. package/dist/visual/chemistry/laws.js +117 -0
  86. package/dist/visual/chemistry/particles.d.ts +114 -0
  87. package/dist/visual/chemistry/particles.js +149 -0
  88. package/dist/visual/chemistry/periodic.d.ts +52 -0
  89. package/dist/visual/chemistry/periodic.js +85 -0
  90. package/dist/visual/chemistry/reaction.d.ts +60 -0
  91. package/dist/visual/chemistry/reaction.js +76 -0
  92. package/dist/visual/entry.d.ts +42 -0
  93. package/dist/visual/entry.js +48 -0
  94. package/dist/visual/mathematics/chart.d.ts +30 -0
  95. package/dist/{assessment → visual/mathematics}/chart.js +26 -18
  96. package/dist/visual/mathematics/charts.d.ts +118 -0
  97. package/dist/visual/mathematics/charts.js +100 -0
  98. package/dist/visual/mathematics/function.d.ts +82 -0
  99. package/dist/visual/mathematics/function.js +102 -0
  100. package/dist/visual/mathematics/geometry.d.ts +222 -0
  101. package/dist/visual/mathematics/geometry.js +81 -0
  102. package/dist/visual/mathematics/line.d.ts +179 -0
  103. package/dist/visual/mathematics/line.js +156 -0
  104. package/dist/visual/mathematics/number.d.ts +21 -0
  105. package/dist/visual/mathematics/number.js +53 -0
  106. package/dist/visual/physics/measurement.d.ts +66 -0
  107. package/dist/visual/physics/measurement.js +85 -0
  108. package/dist/visual/physics/motion.d.ts +85 -0
  109. package/dist/visual/physics/motion.js +110 -0
  110. package/dist/visual/physics/parabolic.d.ts +42 -0
  111. package/dist/visual/physics/parabolic.js +56 -0
  112. package/dist/visual/physics/velocity.d.ts +112 -0
  113. package/dist/visual/physics/velocity.js +144 -0
  114. package/dist/visual/politics.d.ts +92 -0
  115. package/dist/visual/politics.js +76 -0
  116. package/package.json +13 -5
  117. package/dist/assessment/chart.d.ts +0 -62
@@ -0,0 +1,114 @@
1
+ import { Schema } from "effect";
2
+ import { type RichSlot } from "#contracts/visual/card";
3
+ /**
4
+ * The particle labs. A category and a reading say what a particle is, a note
5
+ * says what an isotope shows, and a summary says what a property means, so
6
+ * each is answer state.
7
+ */
8
+ export declare function particleVisuals<E>(rich: RichSlot<E>): {
9
+ IonLab: import("#contracts/visual/entry").VisualEntry<Schema.Struct<{
10
+ readonly description: RichSlot<E>;
11
+ readonly title: RichSlot<E>;
12
+ readonly labels: Schema.Struct<{
13
+ readonly afterChange: Schema.Trimmed;
14
+ readonly beforeChange: Schema.Trimmed;
15
+ readonly charge: Schema.Trimmed;
16
+ readonly chooseIon: Schema.Trimmed;
17
+ readonly electronChange: Schema.Trimmed;
18
+ readonly electrons: Schema.Trimmed;
19
+ readonly neutralAtom: Schema.Trimmed;
20
+ readonly neutrons: Schema.Trimmed;
21
+ readonly protons: Schema.Trimmed;
22
+ readonly samples: Schema.$Record<Schema.Literals<readonly ["sodium-cation", "fluoride-anion", "lithium-cation", "oxide-anion"]>, Schema.Struct<{
23
+ readonly action: RichSlot<E>;
24
+ readonly name: Schema.Trimmed;
25
+ readonly type: Schema.Trimmed;
26
+ }>>;
27
+ }>;
28
+ }>>;
29
+ IsotopeLab: import("#contracts/visual/entry").VisualEntry<Schema.Struct<{
30
+ readonly description: RichSlot<E>;
31
+ readonly title: RichSlot<E>;
32
+ readonly labels: Schema.Struct<{
33
+ readonly abundance: Schema.Trimmed;
34
+ readonly atomicNumber: Schema.Trimmed;
35
+ readonly chooseIsotope: Schema.Trimmed;
36
+ readonly electrons: Schema.Trimmed;
37
+ readonly massNumber: Schema.Trimmed;
38
+ readonly neutrons: Schema.Trimmed;
39
+ readonly protons: Schema.Trimmed;
40
+ readonly samples: Schema.$Record<Schema.Literals<readonly ["hydrogen-1", "deuterium", "tritium", "carbon-12", "carbon-13", "carbon-14"]>, Schema.Struct<{
41
+ readonly abundance: RichSlot<E>;
42
+ readonly ariaName: Schema.Trimmed;
43
+ readonly name: RichSlot<E>;
44
+ readonly note: RichSlot<E>;
45
+ readonly tab: RichSlot<E>;
46
+ }>>;
47
+ }>;
48
+ }>>;
49
+ MatterParticleReaderLab: import("#contracts/visual/entry").VisualEntry<Schema.Struct<{
50
+ readonly description: RichSlot<E>;
51
+ readonly title: RichSlot<E>;
52
+ readonly labels: Schema.Struct<{
53
+ readonly categoryLabel: Schema.Trimmed;
54
+ readonly chooseMode: Schema.Trimmed;
55
+ readonly modes: Schema.$Record<Schema.Literals<readonly ["atom", "element", "elemental-molecule", "compound-molecule"]>, Schema.Struct<{
56
+ readonly category: RichSlot<E>;
57
+ readonly helperCaption: RichSlot<E>;
58
+ readonly reading: RichSlot<E>;
59
+ readonly tab: RichSlot<E>;
60
+ readonly tabLabel: Schema.Trimmed;
61
+ }>>;
62
+ readonly particleView: Schema.Trimmed;
63
+ readonly readingLabel: Schema.Trimmed;
64
+ }>;
65
+ }>>;
66
+ SubatomicParticlePropertiesLab: import("#contracts/visual/entry").VisualEntry<Schema.Struct<{
67
+ readonly description: RichSlot<E>;
68
+ readonly title: RichSlot<E>;
69
+ readonly labels: Schema.Struct<{
70
+ readonly chooseMode: Schema.Trimmed;
71
+ readonly modes: Schema.$Record<Schema.Literals<readonly ["charge", "mass", "location"]>, Schema.Struct<{
72
+ readonly facts: Schema.$Array<Schema.Struct<{
73
+ readonly label: Schema.Trimmed;
74
+ readonly value: RichSlot<E>;
75
+ }>>;
76
+ readonly summary: RichSlot<E>;
77
+ readonly tab: Schema.Trimmed;
78
+ }>>;
79
+ readonly scene: Schema.Struct<{
80
+ readonly electron: RichSlot<E>;
81
+ readonly electronRegion: RichSlot<E>;
82
+ readonly negativePlate: RichSlot<E>;
83
+ readonly neutron: RichSlot<E>;
84
+ readonly nucleus: RichSlot<E>;
85
+ readonly positivePlate: RichSlot<E>;
86
+ readonly proton: RichSlot<E>;
87
+ }>;
88
+ }>;
89
+ }>>;
90
+ SubatomicParticlesLab: import("#contracts/visual/entry").VisualEntry<Schema.Struct<{
91
+ readonly description: RichSlot<E>;
92
+ readonly title: RichSlot<E>;
93
+ readonly labels: Schema.Struct<{
94
+ readonly chooseMode: Schema.Trimmed;
95
+ readonly modes: Schema.$Record<Schema.Literals<readonly ["cathode-ray", "gold-foil", "atom-map"]>, Schema.Struct<{
96
+ readonly description: RichSlot<E>;
97
+ readonly facts: Schema.$Array<Schema.Struct<{
98
+ readonly label: Schema.Trimmed;
99
+ readonly value: RichSlot<E>;
100
+ }>>;
101
+ readonly tab: Schema.Trimmed;
102
+ }>>;
103
+ readonly scene: Schema.Struct<{
104
+ readonly alphaParticle: RichSlot<E>;
105
+ readonly anode: RichSlot<E>;
106
+ readonly cathode: RichSlot<E>;
107
+ readonly cathodeRay: RichSlot<E>;
108
+ readonly negativePlate: RichSlot<E>;
109
+ readonly nucleus: RichSlot<E>;
110
+ readonly positivePlate: RichSlot<E>;
111
+ }>;
112
+ }>;
113
+ }>>;
114
+ };
@@ -0,0 +1,149 @@
1
+ import { Schema } from "effect";
2
+ import { byIds, cardFields, factSchema, TextSchema, } from "#contracts/visual/card";
3
+ import { answerAt, figure } from "#contracts/visual/entry";
4
+ /** The ions the ion lab forms. */
5
+ const ION_SAMPLES = [
6
+ "sodium-cation",
7
+ "fluoride-anion",
8
+ "lithium-cation",
9
+ "oxide-anion",
10
+ ];
11
+ /** The isotopes the isotope lab compares. */
12
+ const ISOTOPE_SAMPLES = [
13
+ "hydrogen-1",
14
+ "deuterium",
15
+ "tritium",
16
+ "carbon-12",
17
+ "carbon-13",
18
+ "carbon-14",
19
+ ];
20
+ /** The particles the matter reader sorts. */
21
+ const MATTER_MODES = [
22
+ "atom",
23
+ "element",
24
+ "elemental-molecule",
25
+ "compound-molecule",
26
+ ];
27
+ /** The properties the subatomic property lab compares. */
28
+ const PROPERTY_MODES = ["charge", "mass", "location"];
29
+ /** The experiments that found the subatomic particles. */
30
+ const DISCOVERY_MODES = ["cathode-ray", "gold-foil", "atom-map"];
31
+ /** Props of `IonLab`: an atom that gains or loses electrons. */
32
+ function ionLab(rich) {
33
+ return figure(Schema.Struct({
34
+ ...cardFields(rich),
35
+ labels: Schema.Struct({
36
+ afterChange: TextSchema,
37
+ beforeChange: TextSchema,
38
+ charge: TextSchema,
39
+ chooseIon: TextSchema,
40
+ electronChange: TextSchema,
41
+ electrons: TextSchema,
42
+ neutralAtom: TextSchema,
43
+ neutrons: TextSchema,
44
+ protons: TextSchema,
45
+ samples: byIds(ION_SAMPLES, Schema.Struct({ action: rich, name: TextSchema, type: TextSchema })),
46
+ }),
47
+ }));
48
+ }
49
+ /** Props of `IsotopeLab`: atoms of one element with different neutron counts. */
50
+ function isotopeLab(rich) {
51
+ return figure(Schema.Struct({
52
+ ...cardFields(rich),
53
+ labels: Schema.Struct({
54
+ abundance: TextSchema,
55
+ atomicNumber: TextSchema,
56
+ chooseIsotope: TextSchema,
57
+ electrons: TextSchema,
58
+ massNumber: TextSchema,
59
+ neutrons: TextSchema,
60
+ protons: TextSchema,
61
+ samples: byIds(ISOTOPE_SAMPLES, Schema.Struct({
62
+ abundance: rich,
63
+ ariaName: TextSchema,
64
+ name: rich,
65
+ note: rich,
66
+ tab: rich,
67
+ })),
68
+ }),
69
+ }), answerAt(["labels", "samples", "*", "note"]));
70
+ }
71
+ /** Props of `MatterParticleReaderLab`: atoms, elements, and molecules. */
72
+ function matterParticleReaderLab(rich) {
73
+ return figure(Schema.Struct({
74
+ ...cardFields(rich),
75
+ labels: Schema.Struct({
76
+ categoryLabel: TextSchema,
77
+ chooseMode: TextSchema,
78
+ modes: byIds(MATTER_MODES, Schema.Struct({
79
+ category: rich,
80
+ helperCaption: rich,
81
+ reading: rich,
82
+ tab: rich,
83
+ tabLabel: TextSchema,
84
+ })),
85
+ particleView: TextSchema,
86
+ readingLabel: TextSchema,
87
+ }),
88
+ }), answerAt(["labels", "modes", "*", "category"], ["labels", "modes", "*", "reading"]));
89
+ }
90
+ /** Props of `SubatomicParticlePropertiesLab`: charge, mass, and place of each particle. */
91
+ function subatomicParticlePropertiesLab(rich) {
92
+ return figure(Schema.Struct({
93
+ ...cardFields(rich),
94
+ labels: Schema.Struct({
95
+ chooseMode: TextSchema,
96
+ modes: byIds(PROPERTY_MODES, Schema.Struct({
97
+ facts: Schema.Array(factSchema(rich)),
98
+ summary: rich,
99
+ tab: TextSchema,
100
+ })),
101
+ scene: Schema.Struct({
102
+ electron: rich,
103
+ electronRegion: rich,
104
+ negativePlate: rich,
105
+ neutron: rich,
106
+ nucleus: rich,
107
+ positivePlate: rich,
108
+ proton: rich,
109
+ }),
110
+ }),
111
+ }), answerAt(["labels", "modes", "*", "summary"]));
112
+ }
113
+ /** Props of `SubatomicParticlesLab`: the experiments that found each particle. */
114
+ function subatomicParticlesLab(rich) {
115
+ return figure(Schema.Struct({
116
+ ...cardFields(rich),
117
+ labels: Schema.Struct({
118
+ chooseMode: TextSchema,
119
+ modes: byIds(DISCOVERY_MODES, Schema.Struct({
120
+ description: rich,
121
+ facts: Schema.Array(factSchema(rich)),
122
+ tab: TextSchema,
123
+ })),
124
+ scene: Schema.Struct({
125
+ alphaParticle: rich,
126
+ anode: rich,
127
+ cathode: rich,
128
+ cathodeRay: rich,
129
+ negativePlate: rich,
130
+ nucleus: rich,
131
+ positivePlate: rich,
132
+ }),
133
+ }),
134
+ }));
135
+ }
136
+ /**
137
+ * The particle labs. A category and a reading say what a particle is, a note
138
+ * says what an isotope shows, and a summary says what a property means, so
139
+ * each is answer state.
140
+ */
141
+ export function particleVisuals(rich) {
142
+ return {
143
+ IonLab: ionLab(rich),
144
+ IsotopeLab: isotopeLab(rich),
145
+ MatterParticleReaderLab: matterParticleReaderLab(rich),
146
+ SubatomicParticlePropertiesLab: subatomicParticlePropertiesLab(rich),
147
+ SubatomicParticlesLab: subatomicParticlesLab(rich),
148
+ };
149
+ }
@@ -0,0 +1,52 @@
1
+ import { Schema } from "effect";
2
+ import { type RichSlot } from "#contracts/visual/card";
3
+ /**
4
+ * The periodic table labs. A focus detail explains what a part of the table
5
+ * shares, and a trend and its cause state how a property changes and why, so
6
+ * they are answer state.
7
+ */
8
+ export declare function periodicVisuals<E>(rich: RichSlot<E>): {
9
+ ModernPeriodicTableLab: import("#contracts/visual/entry").VisualEntry<Schema.Struct<{
10
+ readonly description: RichSlot<E>;
11
+ readonly title: RichSlot<E>;
12
+ readonly labels: Schema.Struct<{
13
+ readonly atomicNumber: Schema.Trimmed;
14
+ readonly categoryNames: Schema.$Record<Schema.Literals<readonly ["metal", "transition-metal", "metalloid", "nonmetal", "noble-gas", "inner-transition", "series-marker"]>, Schema.Trimmed>;
15
+ readonly chooseFocus: Schema.Trimmed;
16
+ readonly focuses: Schema.$Record<Schema.Literals<readonly ["group-one", "period-three", "transition", "inner-transition", "metalloid", "noble-gas"]>, Schema.Struct<{
17
+ readonly detail: RichSlot<E>;
18
+ readonly name: Schema.Trimmed;
19
+ readonly tab: Schema.Trimmed;
20
+ }>>;
21
+ readonly focusLabel: Schema.Trimmed;
22
+ readonly group: Schema.Trimmed;
23
+ readonly period: Schema.Trimmed;
24
+ readonly periodPrefix: Schema.Trimmed;
25
+ readonly seriesNames: Schema.$Record<Schema.Literals<readonly ["lanthanide", "actinide"]>, Schema.Trimmed>;
26
+ readonly tableLabel: Schema.Trimmed;
27
+ }>;
28
+ }>>;
29
+ PeriodicPropertiesLab: import("#contracts/visual/entry").VisualEntry<Schema.Struct<{
30
+ readonly description: RichSlot<E>;
31
+ readonly title: RichSlot<E>;
32
+ readonly labels: Schema.Struct<{
33
+ readonly chooseTrend: Schema.Trimmed;
34
+ readonly factLabels: Schema.Struct<{
35
+ readonly cause: Schema.Trimmed;
36
+ readonly group: Schema.Trimmed;
37
+ readonly period: Schema.Trimmed;
38
+ readonly question: Schema.Trimmed;
39
+ }>;
40
+ readonly modes: Schema.$Record<Schema.Literals<readonly ["atomic-radius", "ionization-energy", "electron-affinity", "electronegativity"]>, Schema.Struct<{
41
+ readonly cause: RichSlot<E>;
42
+ readonly groupTrend: RichSlot<E>;
43
+ readonly guidance: RichSlot<E>;
44
+ readonly name: Schema.Trimmed;
45
+ readonly periodTrend: RichSlot<E>;
46
+ readonly question: RichSlot<E>;
47
+ readonly tab: Schema.Trimmed;
48
+ }>>;
49
+ readonly sceneLabel: Schema.Trimmed;
50
+ }>;
51
+ }>>;
52
+ };
@@ -0,0 +1,85 @@
1
+ import { Schema } from "effect";
2
+ import { byIds, cardFields, TextSchema, } from "#contracts/visual/card";
3
+ import { answerAt, figure } from "#contracts/visual/entry";
4
+ /** The parts of the periodic table the table lab can focus on. */
5
+ const TABLE_FOCUSES = [
6
+ "group-one",
7
+ "period-three",
8
+ "transition",
9
+ "inner-transition",
10
+ "metalloid",
11
+ "noble-gas",
12
+ ];
13
+ /** The categories the table colors its elements by, and the marker of the lower series. */
14
+ const ELEMENT_CATEGORIES = [
15
+ "metal",
16
+ "transition-metal",
17
+ "metalloid",
18
+ "nonmetal",
19
+ "noble-gas",
20
+ "inner-transition",
21
+ "series-marker",
22
+ ];
23
+ /** The two rows drawn below the table. */
24
+ const SERIES_ROWS = ["lanthanide", "actinide"];
25
+ /** The trends the periodic properties lab compares. */
26
+ const PROPERTY_TRENDS = [
27
+ "atomic-radius",
28
+ "ionization-energy",
29
+ "electron-affinity",
30
+ "electronegativity",
31
+ ];
32
+ /** Props of `ModernPeriodicTableLab`: groups, periods, and blocks of the table. */
33
+ function modernPeriodicTableLab(rich) {
34
+ return figure(Schema.Struct({
35
+ ...cardFields(rich),
36
+ labels: Schema.Struct({
37
+ atomicNumber: TextSchema,
38
+ categoryNames: byIds(ELEMENT_CATEGORIES, TextSchema),
39
+ chooseFocus: TextSchema,
40
+ focuses: byIds(TABLE_FOCUSES, Schema.Struct({ detail: rich, name: TextSchema, tab: TextSchema })),
41
+ focusLabel: TextSchema,
42
+ group: TextSchema,
43
+ period: TextSchema,
44
+ periodPrefix: TextSchema,
45
+ seriesNames: byIds(SERIES_ROWS, TextSchema),
46
+ tableLabel: TextSchema,
47
+ }),
48
+ }), answerAt(["labels", "focuses", "*", "detail"]));
49
+ }
50
+ /** Props of `PeriodicPropertiesLab`: how a property changes along a period and a group. */
51
+ function periodicPropertiesLab(rich) {
52
+ return figure(Schema.Struct({
53
+ ...cardFields(rich),
54
+ labels: Schema.Struct({
55
+ chooseTrend: TextSchema,
56
+ factLabels: Schema.Struct({
57
+ cause: TextSchema,
58
+ group: TextSchema,
59
+ period: TextSchema,
60
+ question: TextSchema,
61
+ }),
62
+ modes: byIds(PROPERTY_TRENDS, Schema.Struct({
63
+ cause: rich,
64
+ groupTrend: rich,
65
+ guidance: rich,
66
+ name: TextSchema,
67
+ periodTrend: rich,
68
+ question: rich,
69
+ tab: TextSchema,
70
+ })),
71
+ sceneLabel: TextSchema,
72
+ }),
73
+ }), answerAt(["labels", "modes", "*", "cause"], ["labels", "modes", "*", "groupTrend"], ["labels", "modes", "*", "periodTrend"]));
74
+ }
75
+ /**
76
+ * The periodic table labs. A focus detail explains what a part of the table
77
+ * shares, and a trend and its cause state how a property changes and why, so
78
+ * they are answer state.
79
+ */
80
+ export function periodicVisuals(rich) {
81
+ return {
82
+ ModernPeriodicTableLab: modernPeriodicTableLab(rich),
83
+ PeriodicPropertiesLab: periodicPropertiesLab(rich),
84
+ };
85
+ }
@@ -0,0 +1,60 @@
1
+ import { Schema } from "effect";
2
+ import { type RichSlot } from "#contracts/visual/card";
3
+ /**
4
+ * The reaction labs. A meaning says what a cue tells, an equation and its
5
+ * check balance a reaction, so they are answer state.
6
+ */
7
+ export declare function reactionVisuals<E>(rich: RichSlot<E>): {
8
+ ChemicalReactionCharacteristicsLab: import("#contracts/visual/entry").VisualEntry<Schema.Struct<{
9
+ readonly description: RichSlot<E>;
10
+ readonly title: RichSlot<E>;
11
+ readonly labels: Schema.Struct<{
12
+ readonly after: Schema.Trimmed;
13
+ readonly before: Schema.Trimmed;
14
+ readonly chooseCue: Schema.Trimmed;
15
+ readonly cues: Schema.$Record<Schema.Literals<readonly ["gas", "precipitate", "color", "energy"]>, Schema.Struct<{
16
+ readonly helperCaption: RichSlot<E>;
17
+ readonly limit: RichSlot<E>;
18
+ readonly meaning: RichSlot<E>;
19
+ readonly observation: RichSlot<E>;
20
+ readonly tab: Schema.Trimmed;
21
+ }>>;
22
+ readonly limitLabel: Schema.Trimmed;
23
+ readonly meaningLabel: Schema.Trimmed;
24
+ readonly observationLabel: Schema.Trimmed;
25
+ readonly transition: Schema.Trimmed;
26
+ }>;
27
+ }>>;
28
+ ChemicalReactionTypesLab: import("#contracts/visual/entry").VisualEntry<Schema.Struct<{
29
+ readonly description: RichSlot<E>;
30
+ readonly title: RichSlot<E>;
31
+ readonly labels: Schema.Struct<{
32
+ readonly after: Schema.Trimmed;
33
+ readonly before: Schema.Trimmed;
34
+ readonly checkLabel: Schema.Trimmed;
35
+ readonly chooseType: Schema.Trimmed;
36
+ readonly equationLabel: Schema.Trimmed;
37
+ readonly reactionView: Schema.Trimmed;
38
+ readonly readingLabel: Schema.Trimmed;
39
+ readonly types: Schema.$Record<Schema.Literals<readonly ["combustion", "rust", "precipitate", "gas"]>, Schema.Struct<{
40
+ readonly check: RichSlot<E>;
41
+ readonly equation: RichSlot<E>;
42
+ readonly helperCaption: RichSlot<E>;
43
+ readonly reading: RichSlot<E>;
44
+ readonly tab: Schema.Trimmed;
45
+ readonly visibleCue: RichSlot<E>;
46
+ }>>;
47
+ readonly visibleCueLabel: Schema.Trimmed;
48
+ }>;
49
+ }>>;
50
+ MethaneCombustionEquationLab: import("#contracts/visual/entry").VisualEntry<Schema.Struct<{
51
+ readonly description: RichSlot<E>;
52
+ readonly title: RichSlot<E>;
53
+ readonly labels: Schema.Struct<{
54
+ readonly equation: RichSlot<E>;
55
+ readonly moleculeView: Schema.Trimmed;
56
+ readonly products: Schema.Trimmed;
57
+ readonly reactants: Schema.Trimmed;
58
+ }>;
59
+ }>>;
60
+ };
@@ -0,0 +1,76 @@
1
+ import { Schema } from "effect";
2
+ import { byIds, cardFields, TextSchema, } from "#contracts/visual/card";
3
+ import { answerAt, figure } from "#contracts/visual/entry";
4
+ /** The cues that show a reaction happened. */
5
+ const REACTION_CUES = ["gas", "precipitate", "color", "energy"];
6
+ /** The reaction types the types lab shows. */
7
+ const REACTION_TYPES = ["combustion", "rust", "precipitate", "gas"];
8
+ /** Props of `ChemicalReactionCharacteristicsLab`: what a reaction looks like. */
9
+ function reactionCharacteristicsLab(rich) {
10
+ return figure(Schema.Struct({
11
+ ...cardFields(rich),
12
+ labels: Schema.Struct({
13
+ after: TextSchema,
14
+ before: TextSchema,
15
+ chooseCue: TextSchema,
16
+ cues: byIds(REACTION_CUES, Schema.Struct({
17
+ helperCaption: rich,
18
+ limit: rich,
19
+ meaning: rich,
20
+ observation: rich,
21
+ tab: TextSchema,
22
+ })),
23
+ limitLabel: TextSchema,
24
+ meaningLabel: TextSchema,
25
+ observationLabel: TextSchema,
26
+ transition: TextSchema,
27
+ }),
28
+ }), answerAt(["labels", "cues", "*", "meaning"]));
29
+ }
30
+ /** Props of `ChemicalReactionTypesLab`: four everyday reactions and their equations. */
31
+ function reactionTypesLab(rich) {
32
+ return figure(Schema.Struct({
33
+ ...cardFields(rich),
34
+ labels: Schema.Struct({
35
+ after: TextSchema,
36
+ before: TextSchema,
37
+ checkLabel: TextSchema,
38
+ chooseType: TextSchema,
39
+ equationLabel: TextSchema,
40
+ reactionView: TextSchema,
41
+ readingLabel: TextSchema,
42
+ types: byIds(REACTION_TYPES, Schema.Struct({
43
+ check: rich,
44
+ equation: rich,
45
+ helperCaption: rich,
46
+ reading: rich,
47
+ tab: TextSchema,
48
+ visibleCue: rich,
49
+ })),
50
+ visibleCueLabel: TextSchema,
51
+ }),
52
+ }), answerAt(["labels", "types", "*", "check"], ["labels", "types", "*", "equation"]));
53
+ }
54
+ /** Props of `MethaneCombustionEquationLab`: methane burning, molecule by molecule. */
55
+ function methaneCombustionLab(rich) {
56
+ return figure(Schema.Struct({
57
+ ...cardFields(rich),
58
+ labels: Schema.Struct({
59
+ equation: rich,
60
+ moleculeView: TextSchema,
61
+ products: TextSchema,
62
+ reactants: TextSchema,
63
+ }),
64
+ }), answerAt(["labels", "equation"]));
65
+ }
66
+ /**
67
+ * The reaction labs. A meaning says what a cue tells, an equation and its
68
+ * check balance a reaction, so they are answer state.
69
+ */
70
+ export function reactionVisuals(rich) {
71
+ return {
72
+ ChemicalReactionCharacteristicsLab: reactionCharacteristicsLab(rich),
73
+ ChemicalReactionTypesLab: reactionTypesLab(rich),
74
+ MethaneCombustionEquationLab: methaneCombustionLab(rich),
75
+ };
76
+ }
@@ -0,0 +1,42 @@
1
+ import { Schema } from "effect";
2
+ /**
3
+ * How a document draws a catalog component. A `figure` is a visual that a
4
+ * lesson places as an element and an assessment places as a figure node. A
5
+ * `markup` component shapes text or layout instead, such as a formula, a
6
+ * highlighted phrase, or a stack of blocks, and an assessment writes it as
7
+ * nodes and marks of its own.
8
+ */
9
+ export type VisualKind = "figure" | "markup";
10
+ /**
11
+ * One step of an answer path: a prop name, or `*` for every entry of a record
12
+ * or every item of a list.
13
+ */
14
+ export type AnswerStep = string;
15
+ /** The path of a prop that holds answer state, such as `["trigValues"]`. */
16
+ export type AnswerPattern = readonly [AnswerStep, ...AnswerStep[]];
17
+ /**
18
+ * Lists the answer state that decoded props hold, each as the dotted path of a
19
+ * prop that is present, such as `labels.modes.closed.calculation`.
20
+ */
21
+ export type AnswerReader = (props: unknown) => readonly string[];
22
+ /**
23
+ * One component of the catalog: its kind, the schema of its props in one
24
+ * document kind, and the reader of the answer state those props hold.
25
+ */
26
+ export interface VisualEntry<Props extends Schema.Top> {
27
+ readonly answer: AnswerReader;
28
+ readonly kind: VisualKind;
29
+ readonly props: Props;
30
+ }
31
+ /**
32
+ * Reads answer state at fixed paths: every prop that one of the patterns names
33
+ * and that the props hold, written as its dotted path. A flag set to `false`
34
+ * shows nothing, so it holds no answer state.
35
+ */
36
+ export declare function answerAt(...patterns: readonly AnswerPattern[]): AnswerReader;
37
+ /** A component whose props never hold answer state. */
38
+ export declare const noAnswer: AnswerReader;
39
+ /** A figure component, with the answer state its props may hold. */
40
+ export declare function figure<Props extends Schema.Top>(props: Props, answer?: AnswerReader): VisualEntry<Props>;
41
+ /** A markup component: a formula, an emphasis, or a layout around blocks. */
42
+ export declare function markup<Props extends Schema.Top>(props: Props): VisualEntry<Props>;
@@ -0,0 +1,48 @@
1
+ import { Array as Arr, Predicate, Record as Rec, Schema } from "effect";
2
+ /** The value one step of a path names in a value, with the path so far. */
3
+ const LocatedSchema = Schema.Struct({
4
+ path: Schema.Array(Schema.String),
5
+ value: Schema.Unknown,
6
+ });
7
+ /** Follows one step of a path from every value reached so far. */
8
+ function stepInto(located, step) {
9
+ return Arr.flatMap(located, ({ path, value }) => {
10
+ if (Arr.isArray(value)) {
11
+ return step === "*"
12
+ ? Arr.map(value, (item, index) => ({
13
+ path: [...path, String(index)],
14
+ value: item,
15
+ }))
16
+ : [];
17
+ }
18
+ if (!Predicate.isObject(value)) {
19
+ return [];
20
+ }
21
+ if (step !== "*") {
22
+ const next = Predicate.hasProperty(value, step) ? value[step] : false;
23
+ return next === false ? [] : [{ path: [...path, step], value: next }];
24
+ }
25
+ return Arr.map(Rec.toEntries(value), ([key, item]) => ({
26
+ path: [...path, key],
27
+ value: item,
28
+ }));
29
+ });
30
+ }
31
+ /**
32
+ * Reads answer state at fixed paths: every prop that one of the patterns names
33
+ * and that the props hold, written as its dotted path. A flag set to `false`
34
+ * shows nothing, so it holds no answer state.
35
+ */
36
+ export function answerAt(...patterns) {
37
+ return (props) => Arr.flatMap(patterns, (pattern) => Arr.map(Arr.reduce(pattern, [{ path: [], value: props }], stepInto), ({ path }) => Arr.join(path, ".")));
38
+ }
39
+ /** A component whose props never hold answer state. */
40
+ export const noAnswer = () => [];
41
+ /** A figure component, with the answer state its props may hold. */
42
+ export function figure(props, answer = noAnswer) {
43
+ return { answer, kind: "figure", props };
44
+ }
45
+ /** A markup component: a formula, an emphasis, or a layout around blocks. */
46
+ export function markup(props) {
47
+ return { answer: noAnswer, kind: "markup", props };
48
+ }
@@ -0,0 +1,30 @@
1
+ import { Schema } from "effect";
2
+ import { type RichSlot } from "#contracts/visual/card";
3
+ /**
4
+ * Props of `Chart`: categories along one axis and one or more series of
5
+ * values drawn as bars or lines over them, the data of a bar chart, a line
6
+ * chart, a histogram, or both marks at once. The data is the figure, so a
7
+ * learner reads the same values that the figure draws. Every series has a
8
+ * name, because no meaning may ride on color alone.
9
+ */
10
+ export declare function chartProps<E>(rich: RichSlot<E>): import("#contracts/visual/entry").VisualEntry<Schema.Struct<{
11
+ readonly description: RichSlot<E>;
12
+ readonly title: RichSlot<E>;
13
+ /**
14
+ * How the bars of a chart that has bars stand: `apart` leaves a gap between
15
+ * neighboring categories, as a bar chart does, and `touching` closes it, as
16
+ * a histogram of classes does. A chart of lines alone has no bars to place.
17
+ */
18
+ readonly bars: Schema.optionalKey<Schema.Literals<readonly ["apart", "touching"]>>;
19
+ readonly categories: Schema.NonEmptyArray<Schema.Trimmed>;
20
+ readonly series: Schema.NonEmptyArray<Schema.Struct<{
21
+ readonly label: Schema.Trimmed;
22
+ readonly mark: Schema.Literals<readonly ["bar", "line"]>;
23
+ readonly values: Schema.NonEmptyArray<Schema.NullOr<Schema.Finite>>;
24
+ }>>;
25
+ readonly valueLabel: Schema.optionalKey<Schema.Trimmed>;
26
+ readonly valueRange: Schema.optionalKey<Schema.Struct<{
27
+ readonly max: Schema.Finite;
28
+ readonly min: Schema.Finite;
29
+ }>>;
30
+ }>>;