@pie-players/pie-calculator-cortex 0.3.68
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/LICENSE.md +14 -0
- package/README.md +256 -0
- package/dist/assets/evaluation-worker-BI6KdSur.js +115523 -0
- package/dist/chunks/runtime-BiXEoJDs.js +163543 -0
- package/dist/chunks/settings-C0zxv5EL.js +389 -0
- package/dist/chunks/src-D05hiMPJ.js +31307 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +63 -0
- package/dist/src/CalculatorView.svelte.d.ts +1 -0
- package/dist/src/GraphView.svelte.d.ts +1 -0
- package/dist/src/Icon.svelte.d.ts +1 -0
- package/dist/src/Keypad.svelte.d.ts +1 -0
- package/dist/src/MathFieldInput.svelte.d.ts +1 -0
- package/dist/src/calculator-controller.d.ts +65 -0
- package/dist/src/cortex-provider.d.ts +18 -0
- package/dist/src/errors.d.ts +10 -0
- package/dist/src/evaluation-client.d.ts +26 -0
- package/dist/src/evaluation-engine.d.ts +9 -0
- package/dist/src/evaluation-worker.d.ts +1 -0
- package/dist/src/function-policy.d.ts +15 -0
- package/dist/src/icons.d.ts +33 -0
- package/dist/src/index.d.ts +4 -0
- package/dist/src/keypad-layouts.d.ts +70 -0
- package/dist/src/localization.d.ts +35 -0
- package/dist/src/mathlive-runtime.d.ts +17 -0
- package/dist/src/runtime.d.ts +5 -0
- package/dist/src/settings.d.ts +29 -0
- package/dist/src/state-codec.d.ts +10 -0
- package/dist/src/types.d.ts +157 -0
- package/dist/src/worker-protocol.d.ts +58 -0
- package/package.json +74 -0
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { CalculatorType } from '@pie-players/pie-calculator';
|
|
2
|
+
import { CortexCalculatorErrorCode } from './errors.js';
|
|
3
|
+
import { CortexAngleMode, CortexFunctionId, CortexGraphViewport } from './types.js';
|
|
4
|
+
export declare const CORTEX_WORKER_PROTOCOL_VERSION: 1;
|
|
5
|
+
export interface WorkerEvaluationSettings {
|
|
6
|
+
angleMode: CortexAngleMode;
|
|
7
|
+
calculationPrecision: number;
|
|
8
|
+
displayPrecision: number;
|
|
9
|
+
evaluationTimeLimitMs: number;
|
|
10
|
+
allowedFunctions: CortexFunctionId[];
|
|
11
|
+
}
|
|
12
|
+
interface WorkerEnvelope {
|
|
13
|
+
protocolVersion: typeof CORTEX_WORKER_PROTOCOL_VERSION;
|
|
14
|
+
instanceId: string;
|
|
15
|
+
requestId: number;
|
|
16
|
+
generation: number;
|
|
17
|
+
}
|
|
18
|
+
export type WorkerRequest = (WorkerEnvelope & {
|
|
19
|
+
kind: "evaluate";
|
|
20
|
+
latex: string;
|
|
21
|
+
type: CalculatorType;
|
|
22
|
+
settings: WorkerEvaluationSettings;
|
|
23
|
+
}) | (WorkerEnvelope & {
|
|
24
|
+
kind: "sample";
|
|
25
|
+
expressions: Array<{
|
|
26
|
+
id: string;
|
|
27
|
+
latex: string;
|
|
28
|
+
}>;
|
|
29
|
+
viewport: CortexGraphViewport;
|
|
30
|
+
pixelWidth: number;
|
|
31
|
+
type: "graphing";
|
|
32
|
+
settings: WorkerEvaluationSettings;
|
|
33
|
+
});
|
|
34
|
+
export interface EvaluationResult {
|
|
35
|
+
formatted: string;
|
|
36
|
+
numericValue: number;
|
|
37
|
+
}
|
|
38
|
+
export interface SampledSeries {
|
|
39
|
+
id: string;
|
|
40
|
+
x: number[];
|
|
41
|
+
y: number[];
|
|
42
|
+
}
|
|
43
|
+
export interface SerializedCortexError {
|
|
44
|
+
code: CortexCalculatorErrorCode;
|
|
45
|
+
message: string;
|
|
46
|
+
recoverable: boolean;
|
|
47
|
+
}
|
|
48
|
+
export type WorkerResponse = (WorkerEnvelope & {
|
|
49
|
+
kind: "result";
|
|
50
|
+
result: EvaluationResult;
|
|
51
|
+
}) | (WorkerEnvelope & {
|
|
52
|
+
kind: "series";
|
|
53
|
+
series: SampledSeries[];
|
|
54
|
+
}) | (WorkerEnvelope & {
|
|
55
|
+
kind: "error";
|
|
56
|
+
error: SerializedCortexError;
|
|
57
|
+
});
|
|
58
|
+
export {};
|
package/package.json
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@pie-players/pie-calculator-cortex",
|
|
3
|
+
"version": "0.3.68",
|
|
4
|
+
"description": "Fully bundled open-source calculator provider for PIE assessment tools",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.js"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"dist",
|
|
16
|
+
"README.md",
|
|
17
|
+
"LICENSE.md"
|
|
18
|
+
],
|
|
19
|
+
"scripts": {
|
|
20
|
+
"build": "vite build",
|
|
21
|
+
"demo": "bun run build && bunx vite demo",
|
|
22
|
+
"test": "bun test tests",
|
|
23
|
+
"test:corpus": "bun scripts/build-expression-corpus.mjs --full --out .corpus/gsm8k-arithmetic.json && CORTEX_CORPUS=.corpus/gsm8k-arithmetic.json bun test tests/calculator-cortex-corpus.test.ts",
|
|
24
|
+
"test:e2e": "bun run build && bunx playwright test --config playwright.config.ts",
|
|
25
|
+
"typecheck": "tsc --noEmit && tsc -p tsconfig.demo.json",
|
|
26
|
+
"check": "svelte-check --tsconfig ./tsconfig.json",
|
|
27
|
+
"lint": "biome check ."
|
|
28
|
+
},
|
|
29
|
+
"keywords": [
|
|
30
|
+
"pie",
|
|
31
|
+
"calculator",
|
|
32
|
+
"scientific",
|
|
33
|
+
"graphing",
|
|
34
|
+
"mathlive",
|
|
35
|
+
"cortex",
|
|
36
|
+
"jsxgraph",
|
|
37
|
+
"accessibility"
|
|
38
|
+
],
|
|
39
|
+
"author": "PIE Framework",
|
|
40
|
+
"license": "MIT",
|
|
41
|
+
"repository": {
|
|
42
|
+
"type": "git",
|
|
43
|
+
"url": "git+https://github.com/pie-framework/pie-players.git",
|
|
44
|
+
"directory": "packages/calculator-cortex"
|
|
45
|
+
},
|
|
46
|
+
"publishConfig": {
|
|
47
|
+
"access": "public"
|
|
48
|
+
},
|
|
49
|
+
"dependencies": {
|
|
50
|
+
"@cortex-js/compute-engine": "0.119.0",
|
|
51
|
+
"@pie-players/pie-calculator": "0.3.68",
|
|
52
|
+
"jsxgraph": "1.13.2",
|
|
53
|
+
"mathlive": "0.110.0"
|
|
54
|
+
},
|
|
55
|
+
"devDependencies": {
|
|
56
|
+
"@axe-core/playwright": "^4.13.0",
|
|
57
|
+
"@biomejs/biome": "^2.5.10",
|
|
58
|
+
"@playwright/test": "^1.62.1",
|
|
59
|
+
"@sveltejs/vite-plugin-svelte": "^7.3.0",
|
|
60
|
+
"svelte": "^5.56.10",
|
|
61
|
+
"svelte-check": "^4.7.5",
|
|
62
|
+
"typescript": "^5.9.3",
|
|
63
|
+
"vite": "^8.2.1",
|
|
64
|
+
"vite-plugin-dts": "^5.0.3"
|
|
65
|
+
},
|
|
66
|
+
"sideEffects": false,
|
|
67
|
+
"homepage": "https://github.com/pie-framework/pie-players/tree/master/packages/calculator-cortex#readme",
|
|
68
|
+
"bugs": {
|
|
69
|
+
"url": "https://github.com/pie-framework/pie-players/issues"
|
|
70
|
+
},
|
|
71
|
+
"engines": {
|
|
72
|
+
"node": ">=20.0.0"
|
|
73
|
+
}
|
|
74
|
+
}
|