@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,425 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
import type { RichSlot } from "#contracts/visual/card";
|
|
3
|
+
/**
|
|
4
|
+
* Linear methods 3D labs covering eigen-transformations, principal component
|
|
5
|
+
* projection, and QR Gram-Schmidt orthogonalization.
|
|
6
|
+
*/
|
|
7
|
+
export declare function linearVisuals<E>(rich: RichSlot<E>): {
|
|
8
|
+
EigenTransform3DLab: 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 labels: Schema.Struct<{
|
|
129
|
+
readonly determinant: Schema.optionalKey<RichSlot<E>>;
|
|
130
|
+
readonly eigenvalues: Schema.optionalKey<RichSlot<E>>;
|
|
131
|
+
readonly parts: Schema.$Record<Schema.Literals<readonly ["basisAxes", "transformedGrid", "eigenvectorOne", "eigenvectorTwo", "eigenvectorThree", "testVector"]>, Schema.Trimmed>;
|
|
132
|
+
readonly progress: Schema.Trimmed;
|
|
133
|
+
readonly transform: Schema.Trimmed;
|
|
134
|
+
readonly transforms: Schema.$Record<Schema.Literals<readonly ["stretchShear", "symmetricDiag", "reflectionScale", "anisotropic3D"]>, Schema.optionalKey<Schema.Struct<{
|
|
135
|
+
readonly formula: RichSlot<E>;
|
|
136
|
+
readonly name: Schema.Trimmed;
|
|
137
|
+
}>>>;
|
|
138
|
+
readonly view: Schema.Trimmed;
|
|
139
|
+
}>;
|
|
140
|
+
readonly progress: Schema.Struct<{
|
|
141
|
+
readonly max: Schema.Finite;
|
|
142
|
+
readonly min: Schema.Finite;
|
|
143
|
+
readonly value: Schema.Finite;
|
|
144
|
+
}>;
|
|
145
|
+
readonly transforms: Schema.NonEmptyArray<Schema.Literals<readonly ["stretchShear", "symmetricDiag", "reflectionScale", "anisotropic3D"]>>;
|
|
146
|
+
}>, "figure">;
|
|
147
|
+
PcaProjection3DLab: 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 correlation: 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 correlation: Schema.Trimmed;
|
|
274
|
+
readonly parts: Schema.$Record<Schema.Literals<readonly ["pointCloud", "pc1Axis", "pc2Axis", "pc3Axis", "projectionPlane", "residualLines"]>, Schema.Trimmed>;
|
|
275
|
+
readonly reconstructionError: Schema.optionalKey<RichSlot<E>>;
|
|
276
|
+
readonly subspace: Schema.Trimmed;
|
|
277
|
+
readonly subspaces: Schema.$Record<Schema.Literals<readonly ["pc1Line", "pc1Pc2Plane", "full3D"]>, Schema.optionalKey<Schema.Struct<{
|
|
278
|
+
readonly name: Schema.Trimmed;
|
|
279
|
+
readonly summary: RichSlot<E>;
|
|
280
|
+
}>>>;
|
|
281
|
+
readonly varianceExplained: Schema.optionalKey<RichSlot<E>>;
|
|
282
|
+
readonly view: Schema.Trimmed;
|
|
283
|
+
}>;
|
|
284
|
+
readonly subspaces: Schema.NonEmptyArray<Schema.Literals<readonly ["pc1Line", "pc1Pc2Plane", "full3D"]>>;
|
|
285
|
+
}>, "figure">;
|
|
286
|
+
QrGramSchmidt3DLab: 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 labels: Schema.Struct<{
|
|
407
|
+
readonly orthogonalityCheck: Schema.optionalKey<RichSlot<E>>;
|
|
408
|
+
readonly parts: Schema.$Record<Schema.Literals<readonly ["inputVectors", "orthonormalBasis", "projectionShadow", "orthogonalFrame", "unitSphere"]>, Schema.Trimmed>;
|
|
409
|
+
readonly rEntries: Schema.optionalKey<RichSlot<E>>;
|
|
410
|
+
readonly skew: Schema.Trimmed;
|
|
411
|
+
readonly step: Schema.Trimmed;
|
|
412
|
+
readonly steps: Schema.$Record<Schema.Literals<readonly ["originalBasis", "normalizeQ1", "orthogonalizeQ2", "orthogonalizeQ3"]>, Schema.optionalKey<Schema.Struct<{
|
|
413
|
+
readonly name: Schema.Trimmed;
|
|
414
|
+
readonly summary: RichSlot<E>;
|
|
415
|
+
}>>>;
|
|
416
|
+
readonly view: Schema.Trimmed;
|
|
417
|
+
}>;
|
|
418
|
+
readonly skew: Schema.Struct<{
|
|
419
|
+
readonly max: Schema.Finite;
|
|
420
|
+
readonly min: Schema.Finite;
|
|
421
|
+
readonly value: Schema.Finite;
|
|
422
|
+
}>;
|
|
423
|
+
readonly steps: Schema.NonEmptyArray<Schema.Literals<readonly ["originalBasis", "normalizeQ1", "orthogonalizeQ2", "orthogonalizeQ3"]>>;
|
|
424
|
+
}>, "figure">;
|
|
425
|
+
};
|
|
@@ -0,0 +1,140 @@
|
|
|
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 non-negative finite number for unit-interval and skew sliders. */
|
|
5
|
+
const NonNegativeSchema = Schema.Finite.check(Schema.isGreaterThanOrEqualTo(0));
|
|
6
|
+
/** A strictly positive finite upper bound for sliders. */
|
|
7
|
+
const PositiveSchema = Schema.Finite.check(Schema.isGreaterThan(0));
|
|
8
|
+
/** A non-negative slider whose minimum sits below its maximum. */
|
|
9
|
+
const UnitSliderSchema = Schema.Struct({
|
|
10
|
+
max: PositiveSchema,
|
|
11
|
+
min: NonNegativeSchema,
|
|
12
|
+
value: NonNegativeSchema,
|
|
13
|
+
}).check(Schema.makeFilter(({ max, min, value }) => min < max && min <= value && value <= max, {
|
|
14
|
+
message: "Expected a non-negative slider range whose minimum is below its maximum, with the starting value between them.",
|
|
15
|
+
}));
|
|
16
|
+
const EIGEN_TRANSFORMS = [
|
|
17
|
+
"stretchShear",
|
|
18
|
+
"symmetricDiag",
|
|
19
|
+
"reflectionScale",
|
|
20
|
+
"anisotropic3D",
|
|
21
|
+
];
|
|
22
|
+
const PCA_SUBSPACES = ["pc1Line", "pc1Pc2Plane", "full3D"];
|
|
23
|
+
const QR_STEPS = [
|
|
24
|
+
"originalBasis",
|
|
25
|
+
"normalizeQ1",
|
|
26
|
+
"orthogonalizeQ2",
|
|
27
|
+
"orthogonalizeQ3",
|
|
28
|
+
];
|
|
29
|
+
/**
|
|
30
|
+
* Props of `EigenTransform3DLab`: a 3D linear transformation cube showing
|
|
31
|
+
* invariant eigenvector spans and scaling factors as the space morphs from the
|
|
32
|
+
* identity to matrix A. Eigenvalues and determinant readouts are optional
|
|
33
|
+
* answer state.
|
|
34
|
+
*/
|
|
35
|
+
function eigenTransform3DLab(rich) {
|
|
36
|
+
return figure(Schema.Struct({
|
|
37
|
+
...cardFields(rich),
|
|
38
|
+
labels: Schema.Struct({
|
|
39
|
+
determinant: Schema.optionalKey(rich),
|
|
40
|
+
eigenvalues: Schema.optionalKey(rich),
|
|
41
|
+
parts: byIds([
|
|
42
|
+
"basisAxes",
|
|
43
|
+
"transformedGrid",
|
|
44
|
+
"eigenvectorOne",
|
|
45
|
+
"eigenvectorTwo",
|
|
46
|
+
"eigenvectorThree",
|
|
47
|
+
"testVector",
|
|
48
|
+
], TextSchema),
|
|
49
|
+
progress: TextSchema,
|
|
50
|
+
transform: TextSchema,
|
|
51
|
+
transforms: byPickedIds(EIGEN_TRANSFORMS, Schema.Struct({
|
|
52
|
+
formula: rich,
|
|
53
|
+
name: TextSchema,
|
|
54
|
+
})),
|
|
55
|
+
view: TextSchema,
|
|
56
|
+
}),
|
|
57
|
+
progress: UnitSliderSchema,
|
|
58
|
+
transforms: Schema.NonEmptyArray(Schema.Literals(EIGEN_TRANSFORMS)).check(Schema.isUnique()),
|
|
59
|
+
}).check(Schema.makeFilter(({ labels, transforms }) => namesEach(transforms, labels.transforms), {
|
|
60
|
+
message: "Expected a name and formula for every linear transformation preset shown, and no other.",
|
|
61
|
+
})), answerAt(["labels", "eigenvalues"], ["labels", "determinant"]));
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Props of `PcaProjection3DLab`: a 3D correlated point cloud with orthogonal
|
|
65
|
+
* principal component axes and residual projection drop-lines onto PC1 or the
|
|
66
|
+
* PC1-PC2 plane. Variance explained and reconstruction error readouts are
|
|
67
|
+
* optional answer state.
|
|
68
|
+
*/
|
|
69
|
+
function pcaProjection3DLab(rich) {
|
|
70
|
+
return figure(Schema.Struct({
|
|
71
|
+
...cardFields(rich),
|
|
72
|
+
correlation: UnitSliderSchema,
|
|
73
|
+
labels: Schema.Struct({
|
|
74
|
+
correlation: TextSchema,
|
|
75
|
+
parts: byIds([
|
|
76
|
+
"pointCloud",
|
|
77
|
+
"pc1Axis",
|
|
78
|
+
"pc2Axis",
|
|
79
|
+
"pc3Axis",
|
|
80
|
+
"projectionPlane",
|
|
81
|
+
"residualLines",
|
|
82
|
+
], TextSchema),
|
|
83
|
+
reconstructionError: Schema.optionalKey(rich),
|
|
84
|
+
subspace: TextSchema,
|
|
85
|
+
subspaces: byPickedIds(PCA_SUBSPACES, Schema.Struct({
|
|
86
|
+
name: TextSchema,
|
|
87
|
+
summary: rich,
|
|
88
|
+
})),
|
|
89
|
+
varianceExplained: Schema.optionalKey(rich),
|
|
90
|
+
view: TextSchema,
|
|
91
|
+
}),
|
|
92
|
+
subspaces: Schema.NonEmptyArray(Schema.Literals(PCA_SUBSPACES)).check(Schema.isUnique()),
|
|
93
|
+
}).check(Schema.makeFilter(({ labels, subspaces }) => namesEach(subspaces, labels.subspaces), {
|
|
94
|
+
message: "Expected a name and summary for every PCA projection subspace shown, and no other.",
|
|
95
|
+
})), answerAt(["labels", "varianceExplained"], ["labels", "reconstructionError"]));
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Props of `QrGramSchmidt3DLab`: a 3D step-by-step Gram-Schmidt
|
|
99
|
+
* orthogonalization turning three skewed column vectors into an orthonormal
|
|
100
|
+
* basis Q with upper-triangular projection coordinates R. Orthogonality check
|
|
101
|
+
* and R-entry readouts are optional answer state.
|
|
102
|
+
*/
|
|
103
|
+
function qrGramSchmidt3DLab(rich) {
|
|
104
|
+
return figure(Schema.Struct({
|
|
105
|
+
...cardFields(rich),
|
|
106
|
+
labels: Schema.Struct({
|
|
107
|
+
orthogonalityCheck: Schema.optionalKey(rich),
|
|
108
|
+
parts: byIds([
|
|
109
|
+
"inputVectors",
|
|
110
|
+
"orthonormalBasis",
|
|
111
|
+
"projectionShadow",
|
|
112
|
+
"orthogonalFrame",
|
|
113
|
+
"unitSphere",
|
|
114
|
+
], TextSchema),
|
|
115
|
+
rEntries: Schema.optionalKey(rich),
|
|
116
|
+
skew: TextSchema,
|
|
117
|
+
step: TextSchema,
|
|
118
|
+
steps: byPickedIds(QR_STEPS, Schema.Struct({
|
|
119
|
+
name: TextSchema,
|
|
120
|
+
summary: rich,
|
|
121
|
+
})),
|
|
122
|
+
view: TextSchema,
|
|
123
|
+
}),
|
|
124
|
+
skew: UnitSliderSchema,
|
|
125
|
+
steps: Schema.NonEmptyArray(Schema.Literals(QR_STEPS)).check(Schema.isUnique()),
|
|
126
|
+
}).check(Schema.makeFilter(({ labels, steps }) => namesEach(steps, labels.steps), {
|
|
127
|
+
message: "Expected a name and summary for every Gram-Schmidt step shown, and no other.",
|
|
128
|
+
})), answerAt(["labels", "orthogonalityCheck"], ["labels", "rEntries"]));
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Linear methods 3D labs covering eigen-transformations, principal component
|
|
132
|
+
* projection, and QR Gram-Schmidt orthogonalization.
|
|
133
|
+
*/
|
|
134
|
+
export function linearVisuals(rich) {
|
|
135
|
+
return {
|
|
136
|
+
EigenTransform3DLab: eigenTransform3DLab(rich),
|
|
137
|
+
PcaProjection3DLab: pcaProjection3DLab(rich),
|
|
138
|
+
QrGramSchmidt3DLab: qrGramSchmidt3DLab(rich),
|
|
139
|
+
};
|
|
140
|
+
}
|