@nakafa/aksara-contracts 8.15.0 → 8.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/dist/visual/base.d.ts +785 -0
- package/dist/visual/base.js +13 -0
- package/dist/visual/biology/ecosystem.d.ts +425 -0
- package/dist/visual/biology/ecosystem.js +140 -0
- package/dist/visual/biology/respiration.d.ts +286 -0
- package/dist/visual/biology/respiration.js +97 -0
- package/dist/visual/biology.d.ts +11158 -205
- package/dist/visual/biology.js +104 -0
- package/dist/visual/catalog.d.ts +16 -41206
- package/dist/visual/catalog.js +8 -216
- package/dist/visual/chemistry/green.d.ts +282 -0
- package/dist/visual/chemistry/green.js +98 -0
- package/dist/visual/chemistry/groups.d.ts +276 -0
- package/dist/visual/chemistry/groups.js +85 -0
- package/dist/visual/chemistry/industry.d.ts +420 -0
- package/dist/visual/chemistry/industry.js +126 -0
- package/dist/visual/chemistry/materials.d.ts +416 -0
- package/dist/visual/chemistry/materials.js +116 -0
- package/dist/visual/chemistry/organic.d.ts +416 -0
- package/dist/visual/chemistry/organic.js +128 -0
- package/dist/visual/chemistry/polymer.d.ts +422 -0
- package/dist/visual/chemistry/polymer.js +126 -0
- package/dist/visual/chemistry/solution.d.ts +278 -0
- package/dist/visual/chemistry/solution.js +89 -0
- package/dist/visual/chemistry/stoichiometry.d.ts +287 -0
- package/dist/visual/chemistry/stoichiometry.js +83 -0
- package/dist/visual/chemistry.d.ts +8827 -0
- package/dist/visual/chemistry.js +50 -0
- package/dist/visual/mathematics/derivative.d.ts +425 -0
- package/dist/visual/mathematics/derivative.js +132 -0
- package/dist/visual/mathematics/integral.d.ts +428 -0
- package/dist/visual/mathematics/integral.js +146 -0
- package/dist/visual/mathematics/limit.d.ts +425 -0
- package/dist/visual/mathematics/limit.js +139 -0
- package/dist/visual/mathematics/linear.d.ts +425 -0
- package/dist/visual/mathematics/linear.js +140 -0
- package/dist/visual/mathematics/vector.d.ts +419 -0
- package/dist/visual/mathematics/vector.js +129 -0
- package/dist/visual/mathematics.d.ts +5148 -0
- package/dist/visual/mathematics.js +41 -0
- package/dist/visual/physics.d.ts +17875 -0
- package/dist/visual/physics.js +70 -0
- package/package.json +1 -1
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { atomVisuals } from "#contracts/visual/chemistry/atom";
|
|
2
|
+
import { balanceVisuals } from "#contracts/visual/chemistry/balance";
|
|
3
|
+
import { bondingVisuals } from "#contracts/visual/chemistry/bonding";
|
|
4
|
+
import { discoveryVisuals } from "#contracts/visual/chemistry/discovery";
|
|
5
|
+
import { electrochemistryVisuals } from "#contracts/visual/chemistry/electrochemistry";
|
|
6
|
+
import { electronVisuals } from "#contracts/visual/chemistry/electron";
|
|
7
|
+
import { equilibriumVisuals } from "#contracts/visual/chemistry/equilibrium";
|
|
8
|
+
import { greenVisuals } from "#contracts/visual/chemistry/green";
|
|
9
|
+
import { groupVisuals } from "#contracts/visual/chemistry/groups";
|
|
10
|
+
import { industryVisuals } from "#contracts/visual/chemistry/industry";
|
|
11
|
+
import { lawVisuals } from "#contracts/visual/chemistry/laws";
|
|
12
|
+
import { materialVisuals } from "#contracts/visual/chemistry/materials";
|
|
13
|
+
import { organicVisuals } from "#contracts/visual/chemistry/organic";
|
|
14
|
+
import { particleVisuals } from "#contracts/visual/chemistry/particles";
|
|
15
|
+
import { periodicVisuals } from "#contracts/visual/chemistry/periodic";
|
|
16
|
+
import { polymerVisuals } from "#contracts/visual/chemistry/polymer";
|
|
17
|
+
import { rateVisuals } from "#contracts/visual/chemistry/rate";
|
|
18
|
+
import { reactionVisuals } from "#contracts/visual/chemistry/reaction";
|
|
19
|
+
import { solutionVisuals } from "#contracts/visual/chemistry/solution";
|
|
20
|
+
import { stoichiometryVisuals } from "#contracts/visual/chemistry/stoichiometry";
|
|
21
|
+
import { titrationVisuals } from "#contracts/visual/chemistry/titration";
|
|
22
|
+
/**
|
|
23
|
+
* Every chemistry visual entry in the catalog across atomic, bonding, kinetics,
|
|
24
|
+
* equilibrium, solution, organic, green, industrial, materials, and polymer labs.
|
|
25
|
+
*/
|
|
26
|
+
export function chemistryVisuals(rich) {
|
|
27
|
+
return {
|
|
28
|
+
...atomVisuals(rich),
|
|
29
|
+
...balanceVisuals(rich),
|
|
30
|
+
...bondingVisuals(rich),
|
|
31
|
+
...discoveryVisuals(rich),
|
|
32
|
+
...electrochemistryVisuals(rich),
|
|
33
|
+
...electronVisuals(rich),
|
|
34
|
+
...equilibriumVisuals(rich),
|
|
35
|
+
...greenVisuals(rich),
|
|
36
|
+
...groupVisuals(rich),
|
|
37
|
+
...industryVisuals(rich),
|
|
38
|
+
...lawVisuals(rich),
|
|
39
|
+
...materialVisuals(rich),
|
|
40
|
+
...organicVisuals(rich),
|
|
41
|
+
...particleVisuals(rich),
|
|
42
|
+
...periodicVisuals(rich),
|
|
43
|
+
...polymerVisuals(rich),
|
|
44
|
+
...rateVisuals(rich),
|
|
45
|
+
...reactionVisuals(rich),
|
|
46
|
+
...solutionVisuals(rich),
|
|
47
|
+
...stoichiometryVisuals(rich),
|
|
48
|
+
...titrationVisuals(rich),
|
|
49
|
+
};
|
|
50
|
+
}
|
|
@@ -0,0 +1,425 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
import type { RichSlot } from "#contracts/visual/card";
|
|
3
|
+
/**
|
|
4
|
+
* Derivative calculus 3D labs covering secant-to-tangent limits, derivative
|
|
5
|
+
* slope fields, and 3D box volume optimization.
|
|
6
|
+
*/
|
|
7
|
+
export declare function derivativeVisuals<E>(rich: RichSlot<E>): {
|
|
8
|
+
DerivativeSlopeFieldLab: import("#contracts/visual/entry").VisualEntry<Schema.Struct<{
|
|
9
|
+
readonly description: RichSlot<E>;
|
|
10
|
+
readonly footer: Schema.optionalKey<Schema.Codec<readonly [{
|
|
11
|
+
readonly marks?: readonly [{
|
|
12
|
+
readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
|
|
13
|
+
} | {
|
|
14
|
+
readonly attrs: {
|
|
15
|
+
readonly href: string;
|
|
16
|
+
};
|
|
17
|
+
readonly type: "link";
|
|
18
|
+
} | {
|
|
19
|
+
readonly attrs: {
|
|
20
|
+
readonly variant: "success" | "warning" | null;
|
|
21
|
+
};
|
|
22
|
+
readonly type: "highlight";
|
|
23
|
+
}, ...({
|
|
24
|
+
readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
|
|
25
|
+
} | {
|
|
26
|
+
readonly attrs: {
|
|
27
|
+
readonly href: string;
|
|
28
|
+
};
|
|
29
|
+
readonly type: "link";
|
|
30
|
+
} | {
|
|
31
|
+
readonly attrs: {
|
|
32
|
+
readonly variant: "success" | "warning" | null;
|
|
33
|
+
};
|
|
34
|
+
readonly type: "highlight";
|
|
35
|
+
})[]];
|
|
36
|
+
readonly text: string;
|
|
37
|
+
readonly type: "text";
|
|
38
|
+
} | {
|
|
39
|
+
readonly attrs: {
|
|
40
|
+
readonly latex: string;
|
|
41
|
+
};
|
|
42
|
+
readonly marks?: readonly [{
|
|
43
|
+
readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
|
|
44
|
+
} | {
|
|
45
|
+
readonly attrs: {
|
|
46
|
+
readonly href: string;
|
|
47
|
+
};
|
|
48
|
+
readonly type: "link";
|
|
49
|
+
} | {
|
|
50
|
+
readonly attrs: {
|
|
51
|
+
readonly variant: "success" | "warning" | null;
|
|
52
|
+
};
|
|
53
|
+
readonly type: "highlight";
|
|
54
|
+
}, ...({
|
|
55
|
+
readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
|
|
56
|
+
} | {
|
|
57
|
+
readonly attrs: {
|
|
58
|
+
readonly href: string;
|
|
59
|
+
};
|
|
60
|
+
readonly type: "link";
|
|
61
|
+
} | {
|
|
62
|
+
readonly attrs: {
|
|
63
|
+
readonly variant: "success" | "warning" | null;
|
|
64
|
+
};
|
|
65
|
+
readonly type: "highlight";
|
|
66
|
+
})[]];
|
|
67
|
+
readonly type: "mathInline";
|
|
68
|
+
}, ...({
|
|
69
|
+
readonly marks?: readonly [{
|
|
70
|
+
readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
|
|
71
|
+
} | {
|
|
72
|
+
readonly attrs: {
|
|
73
|
+
readonly href: string;
|
|
74
|
+
};
|
|
75
|
+
readonly type: "link";
|
|
76
|
+
} | {
|
|
77
|
+
readonly attrs: {
|
|
78
|
+
readonly variant: "success" | "warning" | null;
|
|
79
|
+
};
|
|
80
|
+
readonly type: "highlight";
|
|
81
|
+
}, ...({
|
|
82
|
+
readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
|
|
83
|
+
} | {
|
|
84
|
+
readonly attrs: {
|
|
85
|
+
readonly href: string;
|
|
86
|
+
};
|
|
87
|
+
readonly type: "link";
|
|
88
|
+
} | {
|
|
89
|
+
readonly attrs: {
|
|
90
|
+
readonly variant: "success" | "warning" | null;
|
|
91
|
+
};
|
|
92
|
+
readonly type: "highlight";
|
|
93
|
+
})[]];
|
|
94
|
+
readonly text: string;
|
|
95
|
+
readonly type: "text";
|
|
96
|
+
} | {
|
|
97
|
+
readonly attrs: {
|
|
98
|
+
readonly latex: string;
|
|
99
|
+
};
|
|
100
|
+
readonly marks?: readonly [{
|
|
101
|
+
readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
|
|
102
|
+
} | {
|
|
103
|
+
readonly attrs: {
|
|
104
|
+
readonly href: string;
|
|
105
|
+
};
|
|
106
|
+
readonly type: "link";
|
|
107
|
+
} | {
|
|
108
|
+
readonly attrs: {
|
|
109
|
+
readonly variant: "success" | "warning" | null;
|
|
110
|
+
};
|
|
111
|
+
readonly type: "highlight";
|
|
112
|
+
}, ...({
|
|
113
|
+
readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
|
|
114
|
+
} | {
|
|
115
|
+
readonly attrs: {
|
|
116
|
+
readonly href: string;
|
|
117
|
+
};
|
|
118
|
+
readonly type: "link";
|
|
119
|
+
} | {
|
|
120
|
+
readonly attrs: {
|
|
121
|
+
readonly variant: "success" | "warning" | null;
|
|
122
|
+
};
|
|
123
|
+
readonly type: "highlight";
|
|
124
|
+
})[]];
|
|
125
|
+
readonly type: "mathInline";
|
|
126
|
+
})[]], E, never, never>>;
|
|
127
|
+
readonly title: RichSlot<E>;
|
|
128
|
+
readonly curves: Schema.NonEmptyArray<Schema.Literals<readonly ["cubicWave", "quarticWell", "dampedSine"]>>;
|
|
129
|
+
readonly labels: Schema.Struct<{
|
|
130
|
+
readonly curve: Schema.Trimmed;
|
|
131
|
+
readonly curves: Schema.$Record<Schema.Literals<readonly ["cubicWave", "quarticWell", "dampedSine"]>, Schema.optionalKey<Schema.Struct<{
|
|
132
|
+
readonly formula: RichSlot<E>;
|
|
133
|
+
readonly name: Schema.Trimmed;
|
|
134
|
+
}>>>;
|
|
135
|
+
readonly monotonicity: Schema.optionalKey<RichSlot<E>>;
|
|
136
|
+
readonly parts: Schema.$Record<Schema.Literals<readonly ["functionCurve", "derivativeCurve", "slopeNeedles", "probeMarker", "criticalPoints"]>, Schema.Trimmed>;
|
|
137
|
+
readonly probeX: Schema.Trimmed;
|
|
138
|
+
readonly slopeValue: Schema.optionalKey<RichSlot<E>>;
|
|
139
|
+
readonly view: Schema.Trimmed;
|
|
140
|
+
}>;
|
|
141
|
+
readonly probeX: Schema.Struct<{
|
|
142
|
+
readonly max: Schema.Finite;
|
|
143
|
+
readonly min: Schema.Finite;
|
|
144
|
+
readonly value: Schema.Finite;
|
|
145
|
+
}>;
|
|
146
|
+
}>, "figure">;
|
|
147
|
+
OptimizationBox3DLab: import("#contracts/visual/entry").VisualEntry<Schema.Struct<{
|
|
148
|
+
readonly description: RichSlot<E>;
|
|
149
|
+
readonly footer: Schema.optionalKey<Schema.Codec<readonly [{
|
|
150
|
+
readonly marks?: readonly [{
|
|
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 type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
|
|
164
|
+
} | {
|
|
165
|
+
readonly attrs: {
|
|
166
|
+
readonly href: string;
|
|
167
|
+
};
|
|
168
|
+
readonly type: "link";
|
|
169
|
+
} | {
|
|
170
|
+
readonly attrs: {
|
|
171
|
+
readonly variant: "success" | "warning" | null;
|
|
172
|
+
};
|
|
173
|
+
readonly type: "highlight";
|
|
174
|
+
})[]];
|
|
175
|
+
readonly text: string;
|
|
176
|
+
readonly type: "text";
|
|
177
|
+
} | {
|
|
178
|
+
readonly attrs: {
|
|
179
|
+
readonly latex: string;
|
|
180
|
+
};
|
|
181
|
+
readonly marks?: readonly [{
|
|
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
|
+
}, ...({
|
|
194
|
+
readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
|
|
195
|
+
} | {
|
|
196
|
+
readonly attrs: {
|
|
197
|
+
readonly href: string;
|
|
198
|
+
};
|
|
199
|
+
readonly type: "link";
|
|
200
|
+
} | {
|
|
201
|
+
readonly attrs: {
|
|
202
|
+
readonly variant: "success" | "warning" | null;
|
|
203
|
+
};
|
|
204
|
+
readonly type: "highlight";
|
|
205
|
+
})[]];
|
|
206
|
+
readonly type: "mathInline";
|
|
207
|
+
}, ...({
|
|
208
|
+
readonly marks?: readonly [{
|
|
209
|
+
readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
|
|
210
|
+
} | {
|
|
211
|
+
readonly attrs: {
|
|
212
|
+
readonly href: string;
|
|
213
|
+
};
|
|
214
|
+
readonly type: "link";
|
|
215
|
+
} | {
|
|
216
|
+
readonly attrs: {
|
|
217
|
+
readonly variant: "success" | "warning" | null;
|
|
218
|
+
};
|
|
219
|
+
readonly type: "highlight";
|
|
220
|
+
}, ...({
|
|
221
|
+
readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
|
|
222
|
+
} | {
|
|
223
|
+
readonly attrs: {
|
|
224
|
+
readonly href: string;
|
|
225
|
+
};
|
|
226
|
+
readonly type: "link";
|
|
227
|
+
} | {
|
|
228
|
+
readonly attrs: {
|
|
229
|
+
readonly variant: "success" | "warning" | null;
|
|
230
|
+
};
|
|
231
|
+
readonly type: "highlight";
|
|
232
|
+
})[]];
|
|
233
|
+
readonly text: string;
|
|
234
|
+
readonly type: "text";
|
|
235
|
+
} | {
|
|
236
|
+
readonly attrs: {
|
|
237
|
+
readonly latex: string;
|
|
238
|
+
};
|
|
239
|
+
readonly marks?: readonly [{
|
|
240
|
+
readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
|
|
241
|
+
} | {
|
|
242
|
+
readonly attrs: {
|
|
243
|
+
readonly href: string;
|
|
244
|
+
};
|
|
245
|
+
readonly type: "link";
|
|
246
|
+
} | {
|
|
247
|
+
readonly attrs: {
|
|
248
|
+
readonly variant: "success" | "warning" | null;
|
|
249
|
+
};
|
|
250
|
+
readonly type: "highlight";
|
|
251
|
+
}, ...({
|
|
252
|
+
readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
|
|
253
|
+
} | {
|
|
254
|
+
readonly attrs: {
|
|
255
|
+
readonly href: string;
|
|
256
|
+
};
|
|
257
|
+
readonly type: "link";
|
|
258
|
+
} | {
|
|
259
|
+
readonly attrs: {
|
|
260
|
+
readonly variant: "success" | "warning" | null;
|
|
261
|
+
};
|
|
262
|
+
readonly type: "highlight";
|
|
263
|
+
})[]];
|
|
264
|
+
readonly type: "mathInline";
|
|
265
|
+
})[]], E, never, never>>;
|
|
266
|
+
readonly title: RichSlot<E>;
|
|
267
|
+
readonly cutout: Schema.Struct<{
|
|
268
|
+
readonly max: Schema.Finite;
|
|
269
|
+
readonly min: Schema.Finite;
|
|
270
|
+
readonly value: Schema.Finite;
|
|
271
|
+
}>;
|
|
272
|
+
readonly labels: Schema.Struct<{
|
|
273
|
+
readonly boxVolume: Schema.optionalKey<RichSlot<E>>;
|
|
274
|
+
readonly cutout: Schema.Trimmed;
|
|
275
|
+
readonly derivativeNote: Schema.optionalKey<RichSlot<E>>;
|
|
276
|
+
readonly parts: Schema.$Record<Schema.Literals<readonly ["basePlate", "sideFlaps", "cornerCutouts", "volumeCurve", "optimalMarker"]>, Schema.Trimmed>;
|
|
277
|
+
readonly sheet: Schema.Trimmed;
|
|
278
|
+
readonly sheets: Schema.$Record<Schema.Literals<readonly ["squareSheet", "wideSheet", "tallSheet"]>, Schema.optionalKey<Schema.Struct<{
|
|
279
|
+
readonly dimensions: RichSlot<E>;
|
|
280
|
+
readonly name: Schema.Trimmed;
|
|
281
|
+
}>>>;
|
|
282
|
+
readonly view: Schema.Trimmed;
|
|
283
|
+
}>;
|
|
284
|
+
readonly sheets: Schema.NonEmptyArray<Schema.Literals<readonly ["squareSheet", "wideSheet", "tallSheet"]>>;
|
|
285
|
+
}>, "figure">;
|
|
286
|
+
SecantToTangentLab: import("#contracts/visual/entry").VisualEntry<Schema.Struct<{
|
|
287
|
+
readonly description: RichSlot<E>;
|
|
288
|
+
readonly footer: Schema.optionalKey<Schema.Codec<readonly [{
|
|
289
|
+
readonly marks?: readonly [{
|
|
290
|
+
readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
|
|
291
|
+
} | {
|
|
292
|
+
readonly attrs: {
|
|
293
|
+
readonly href: string;
|
|
294
|
+
};
|
|
295
|
+
readonly type: "link";
|
|
296
|
+
} | {
|
|
297
|
+
readonly attrs: {
|
|
298
|
+
readonly variant: "success" | "warning" | null;
|
|
299
|
+
};
|
|
300
|
+
readonly type: "highlight";
|
|
301
|
+
}, ...({
|
|
302
|
+
readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
|
|
303
|
+
} | {
|
|
304
|
+
readonly attrs: {
|
|
305
|
+
readonly href: string;
|
|
306
|
+
};
|
|
307
|
+
readonly type: "link";
|
|
308
|
+
} | {
|
|
309
|
+
readonly attrs: {
|
|
310
|
+
readonly variant: "success" | "warning" | null;
|
|
311
|
+
};
|
|
312
|
+
readonly type: "highlight";
|
|
313
|
+
})[]];
|
|
314
|
+
readonly text: string;
|
|
315
|
+
readonly type: "text";
|
|
316
|
+
} | {
|
|
317
|
+
readonly attrs: {
|
|
318
|
+
readonly latex: string;
|
|
319
|
+
};
|
|
320
|
+
readonly marks?: readonly [{
|
|
321
|
+
readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
|
|
322
|
+
} | {
|
|
323
|
+
readonly attrs: {
|
|
324
|
+
readonly href: string;
|
|
325
|
+
};
|
|
326
|
+
readonly type: "link";
|
|
327
|
+
} | {
|
|
328
|
+
readonly attrs: {
|
|
329
|
+
readonly variant: "success" | "warning" | null;
|
|
330
|
+
};
|
|
331
|
+
readonly type: "highlight";
|
|
332
|
+
}, ...({
|
|
333
|
+
readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
|
|
334
|
+
} | {
|
|
335
|
+
readonly attrs: {
|
|
336
|
+
readonly href: string;
|
|
337
|
+
};
|
|
338
|
+
readonly type: "link";
|
|
339
|
+
} | {
|
|
340
|
+
readonly attrs: {
|
|
341
|
+
readonly variant: "success" | "warning" | null;
|
|
342
|
+
};
|
|
343
|
+
readonly type: "highlight";
|
|
344
|
+
})[]];
|
|
345
|
+
readonly type: "mathInline";
|
|
346
|
+
}, ...({
|
|
347
|
+
readonly marks?: readonly [{
|
|
348
|
+
readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
|
|
349
|
+
} | {
|
|
350
|
+
readonly attrs: {
|
|
351
|
+
readonly href: string;
|
|
352
|
+
};
|
|
353
|
+
readonly type: "link";
|
|
354
|
+
} | {
|
|
355
|
+
readonly attrs: {
|
|
356
|
+
readonly variant: "success" | "warning" | null;
|
|
357
|
+
};
|
|
358
|
+
readonly type: "highlight";
|
|
359
|
+
}, ...({
|
|
360
|
+
readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
|
|
361
|
+
} | {
|
|
362
|
+
readonly attrs: {
|
|
363
|
+
readonly href: string;
|
|
364
|
+
};
|
|
365
|
+
readonly type: "link";
|
|
366
|
+
} | {
|
|
367
|
+
readonly attrs: {
|
|
368
|
+
readonly variant: "success" | "warning" | null;
|
|
369
|
+
};
|
|
370
|
+
readonly type: "highlight";
|
|
371
|
+
})[]];
|
|
372
|
+
readonly text: string;
|
|
373
|
+
readonly type: "text";
|
|
374
|
+
} | {
|
|
375
|
+
readonly attrs: {
|
|
376
|
+
readonly latex: string;
|
|
377
|
+
};
|
|
378
|
+
readonly marks?: readonly [{
|
|
379
|
+
readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
|
|
380
|
+
} | {
|
|
381
|
+
readonly attrs: {
|
|
382
|
+
readonly href: string;
|
|
383
|
+
};
|
|
384
|
+
readonly type: "link";
|
|
385
|
+
} | {
|
|
386
|
+
readonly attrs: {
|
|
387
|
+
readonly variant: "success" | "warning" | null;
|
|
388
|
+
};
|
|
389
|
+
readonly type: "highlight";
|
|
390
|
+
}, ...({
|
|
391
|
+
readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
|
|
392
|
+
} | {
|
|
393
|
+
readonly attrs: {
|
|
394
|
+
readonly href: string;
|
|
395
|
+
};
|
|
396
|
+
readonly type: "link";
|
|
397
|
+
} | {
|
|
398
|
+
readonly attrs: {
|
|
399
|
+
readonly variant: "success" | "warning" | null;
|
|
400
|
+
};
|
|
401
|
+
readonly type: "highlight";
|
|
402
|
+
})[]];
|
|
403
|
+
readonly type: "mathInline";
|
|
404
|
+
})[]], E, never, never>>;
|
|
405
|
+
readonly title: RichSlot<E>;
|
|
406
|
+
readonly curves: Schema.NonEmptyArray<Schema.Literals<readonly ["quadratic", "cubic", "sineWave"]>>;
|
|
407
|
+
readonly labels: Schema.Struct<{
|
|
408
|
+
readonly curve: Schema.Trimmed;
|
|
409
|
+
readonly curves: Schema.$Record<Schema.Literals<readonly ["quadratic", "cubic", "sineWave"]>, Schema.optionalKey<Schema.Struct<{
|
|
410
|
+
readonly formula: RichSlot<E>;
|
|
411
|
+
readonly name: Schema.Trimmed;
|
|
412
|
+
}>>>;
|
|
413
|
+
readonly parts: Schema.$Record<Schema.Literals<readonly ["curveRibbon", "anchorPoint", "movingPoint", "secantLine", "tangentLine", "slopeTriangle"]>, Schema.Trimmed>;
|
|
414
|
+
readonly secantSlope: Schema.optionalKey<RichSlot<E>>;
|
|
415
|
+
readonly stepH: Schema.Trimmed;
|
|
416
|
+
readonly tangentSlope: Schema.optionalKey<RichSlot<E>>;
|
|
417
|
+
readonly view: Schema.Trimmed;
|
|
418
|
+
}>;
|
|
419
|
+
readonly stepH: Schema.Struct<{
|
|
420
|
+
readonly max: Schema.Finite;
|
|
421
|
+
readonly min: Schema.Finite;
|
|
422
|
+
readonly value: Schema.Finite;
|
|
423
|
+
}>;
|
|
424
|
+
}>, "figure">;
|
|
425
|
+
};
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
import { byIds, byPickedIds, cardFields, namesEach, TextSchema, } from "#contracts/visual/card";
|
|
3
|
+
import { answerAt, figure } from "#contracts/visual/entry";
|
|
4
|
+
/** A strictly positive finite number for step-size and cutout sliders. */
|
|
5
|
+
const PositiveSchema = Schema.Finite.check(Schema.isGreaterThan(0));
|
|
6
|
+
/** A positive slider whose minimum sits below its maximum. */
|
|
7
|
+
const PositiveSliderSchema = Schema.Struct({
|
|
8
|
+
max: PositiveSchema,
|
|
9
|
+
min: PositiveSchema,
|
|
10
|
+
value: PositiveSchema,
|
|
11
|
+
}).check(Schema.makeFilter(({ max, min, value }) => min < max && min <= value && value <= max, {
|
|
12
|
+
message: "Expected a positive slider range whose minimum is below its maximum, with the starting value between them.",
|
|
13
|
+
}));
|
|
14
|
+
/** A signed slider whose minimum sits below its maximum. */
|
|
15
|
+
const SignedSliderSchema = Schema.Struct({
|
|
16
|
+
max: Schema.Finite,
|
|
17
|
+
min: Schema.Finite,
|
|
18
|
+
value: Schema.Finite,
|
|
19
|
+
}).check(Schema.makeFilter(({ max, min, value }) => min < max && min <= value && value <= max, {
|
|
20
|
+
message: "Expected a slider range whose minimum is below its maximum, with the starting value between them.",
|
|
21
|
+
}));
|
|
22
|
+
const SECANT_CURVES = ["quadratic", "cubic", "sineWave"];
|
|
23
|
+
const SLOPE_CURVES = ["cubicWave", "quarticWell", "dampedSine"];
|
|
24
|
+
const BOX_SHEETS = ["squareSheet", "wideSheet", "tallSheet"];
|
|
25
|
+
/**
|
|
26
|
+
* Props of `SecantToTangentLab`: a 3D curve ribbon showing a secant beam
|
|
27
|
+
* between x = a and x = a + h converging onto the tangent line as h approaches
|
|
28
|
+
* zero. Secant slope and tangent slope readouts are optional answer state.
|
|
29
|
+
*/
|
|
30
|
+
function secantToTangentLab(rich) {
|
|
31
|
+
return figure(Schema.Struct({
|
|
32
|
+
...cardFields(rich),
|
|
33
|
+
curves: Schema.NonEmptyArray(Schema.Literals(SECANT_CURVES)).check(Schema.isUnique()),
|
|
34
|
+
labels: Schema.Struct({
|
|
35
|
+
curve: TextSchema,
|
|
36
|
+
curves: byPickedIds(SECANT_CURVES, Schema.Struct({
|
|
37
|
+
formula: rich,
|
|
38
|
+
name: TextSchema,
|
|
39
|
+
})),
|
|
40
|
+
parts: byIds([
|
|
41
|
+
"curveRibbon",
|
|
42
|
+
"anchorPoint",
|
|
43
|
+
"movingPoint",
|
|
44
|
+
"secantLine",
|
|
45
|
+
"tangentLine",
|
|
46
|
+
"slopeTriangle",
|
|
47
|
+
], TextSchema),
|
|
48
|
+
secantSlope: Schema.optionalKey(rich),
|
|
49
|
+
stepH: TextSchema,
|
|
50
|
+
tangentSlope: Schema.optionalKey(rich),
|
|
51
|
+
view: TextSchema,
|
|
52
|
+
}),
|
|
53
|
+
stepH: PositiveSliderSchema,
|
|
54
|
+
}).check(Schema.makeFilter(({ curves, labels }) => namesEach(curves, labels.curves), {
|
|
55
|
+
message: "Expected a name and formula for every secant curve shown, and no other.",
|
|
56
|
+
})), answerAt(["labels", "secantSlope"], ["labels", "tangentSlope"]));
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Props of `DerivativeSlopeFieldLab`: a 3D dual-ribbon stage pairing f(x) with
|
|
60
|
+
* its derivative curve f'(x), local tangent slope needles, and critical point
|
|
61
|
+
* beacons. Slope value and monotonicity readouts are optional answer state.
|
|
62
|
+
*/
|
|
63
|
+
function derivativeSlopeFieldLab(rich) {
|
|
64
|
+
return figure(Schema.Struct({
|
|
65
|
+
...cardFields(rich),
|
|
66
|
+
curves: Schema.NonEmptyArray(Schema.Literals(SLOPE_CURVES)).check(Schema.isUnique()),
|
|
67
|
+
labels: Schema.Struct({
|
|
68
|
+
curve: TextSchema,
|
|
69
|
+
curves: byPickedIds(SLOPE_CURVES, Schema.Struct({
|
|
70
|
+
formula: rich,
|
|
71
|
+
name: TextSchema,
|
|
72
|
+
})),
|
|
73
|
+
monotonicity: Schema.optionalKey(rich),
|
|
74
|
+
parts: byIds([
|
|
75
|
+
"functionCurve",
|
|
76
|
+
"derivativeCurve",
|
|
77
|
+
"slopeNeedles",
|
|
78
|
+
"probeMarker",
|
|
79
|
+
"criticalPoints",
|
|
80
|
+
], TextSchema),
|
|
81
|
+
probeX: TextSchema,
|
|
82
|
+
slopeValue: Schema.optionalKey(rich),
|
|
83
|
+
view: TextSchema,
|
|
84
|
+
}),
|
|
85
|
+
probeX: SignedSliderSchema,
|
|
86
|
+
}).check(Schema.makeFilter(({ curves, labels }) => namesEach(curves, labels.curves), {
|
|
87
|
+
message: "Expected a name and formula for every derivative curve shown, and no other.",
|
|
88
|
+
})), answerAt(["labels", "slopeValue"], ["labels", "monotonicity"]));
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Props of `OptimizationBox3DLab`: a 3D foldable open-top box cut from a flat
|
|
92
|
+
* sheet alongside a live volume curve V(x) highlighting the stationary optimum
|
|
93
|
+
* V'(x) = 0. Box volume and derivative note readouts are optional answer state.
|
|
94
|
+
*/
|
|
95
|
+
function optimizationBox3DLab(rich) {
|
|
96
|
+
return figure(Schema.Struct({
|
|
97
|
+
...cardFields(rich),
|
|
98
|
+
cutout: PositiveSliderSchema,
|
|
99
|
+
labels: Schema.Struct({
|
|
100
|
+
boxVolume: Schema.optionalKey(rich),
|
|
101
|
+
cutout: TextSchema,
|
|
102
|
+
derivativeNote: Schema.optionalKey(rich),
|
|
103
|
+
parts: byIds([
|
|
104
|
+
"basePlate",
|
|
105
|
+
"sideFlaps",
|
|
106
|
+
"cornerCutouts",
|
|
107
|
+
"volumeCurve",
|
|
108
|
+
"optimalMarker",
|
|
109
|
+
], TextSchema),
|
|
110
|
+
sheet: TextSchema,
|
|
111
|
+
sheets: byPickedIds(BOX_SHEETS, Schema.Struct({
|
|
112
|
+
dimensions: rich,
|
|
113
|
+
name: TextSchema,
|
|
114
|
+
})),
|
|
115
|
+
view: TextSchema,
|
|
116
|
+
}),
|
|
117
|
+
sheets: Schema.NonEmptyArray(Schema.Literals(BOX_SHEETS)).check(Schema.isUnique()),
|
|
118
|
+
}).check(Schema.makeFilter(({ labels, sheets }) => namesEach(sheets, labels.sheets), {
|
|
119
|
+
message: "Expected a name and dimensions note for every sheet preset shown, and no other.",
|
|
120
|
+
})), answerAt(["labels", "boxVolume"], ["labels", "derivativeNote"]));
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Derivative calculus 3D labs covering secant-to-tangent limits, derivative
|
|
124
|
+
* slope fields, and 3D box volume optimization.
|
|
125
|
+
*/
|
|
126
|
+
export function derivativeVisuals(rich) {
|
|
127
|
+
return {
|
|
128
|
+
DerivativeSlopeFieldLab: derivativeSlopeFieldLab(rich),
|
|
129
|
+
OptimizationBox3DLab: optimizationBox3DLab(rich),
|
|
130
|
+
SecantToTangentLab: secantToTangentLab(rich),
|
|
131
|
+
};
|
|
132
|
+
}
|