desmost 0.10.0 → 0.11.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/README.md +6 -6
- package/dist/compiler/compile.d.ts +1 -1
- package/dist/compiler/compile.js +1 -1
- package/dist/compiler/compiler.d.ts.map +1 -1
- package/dist/compiler/compiler.js +9 -8
- package/dist/compiler/compiler.js.map +1 -1
- package/dist/compiler/format.js +1 -1
- package/dist/compiler/format.js.map +1 -1
- package/dist/decompiler/decompile.d.ts +13 -5
- package/dist/decompiler/decompile.d.ts.map +1 -1
- package/dist/decompiler/decompile.js +24 -13
- package/dist/decompiler/decompile.js.map +1 -1
- package/dist/decompiler/emit.d.ts +5 -2
- package/dist/decompiler/emit.d.ts.map +1 -1
- package/dist/decompiler/emit.js +41 -20
- package/dist/decompiler/emit.js.map +1 -1
- package/dist/decompiler/extract.d.ts +1 -9
- package/dist/decompiler/extract.d.ts.map +1 -1
- package/dist/decompiler/extract.js +24 -58
- package/dist/decompiler/extract.js.map +1 -1
- package/dist/decompiler/format.d.ts +0 -1
- package/dist/decompiler/format.d.ts.map +1 -1
- package/dist/decompiler/format.js +3 -9
- package/dist/decompiler/format.js.map +1 -1
- package/dist/errors.d.ts +14 -7
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +20 -2
- package/dist/errors.js.map +1 -1
- package/dist/magic/expr/index.js +6 -6
- package/dist/magic/expr/index.js.map +1 -1
- package/dist/magic/expr/latex.d.ts +5 -2
- package/dist/magic/expr/latex.d.ts.map +1 -1
- package/dist/magic/expr/latex.js +4 -2
- package/dist/magic/expr/latex.js.map +1 -1
- package/dist/magic/expr/text.d.ts +5 -2
- package/dist/magic/expr/text.d.ts.map +1 -1
- package/dist/magic/expr/text.js +4 -2
- package/dist/magic/expr/text.js.map +1 -1
- package/dist/magic/global/{dark-mode.d.ts → dark.d.ts} +6 -2
- package/dist/magic/global/dark.d.ts.map +1 -0
- package/dist/magic/global/dark.js +20 -0
- package/dist/magic/global/dark.js.map +1 -0
- package/dist/magic/global/desmos.d.ts +4 -1
- package/dist/magic/global/desmos.d.ts.map +1 -1
- package/dist/magic/global/desmos.js +23 -0
- package/dist/magic/global/desmos.js.map +1 -1
- package/dist/magic/global/index.d.ts +5 -5
- package/dist/magic/global/index.d.ts.map +1 -1
- package/dist/magic/global/index.js +8 -11
- package/dist/magic/global/index.js.map +1 -1
- package/dist/magic/global/viewport.d.ts +3 -0
- package/dist/magic/global/viewport.d.ts.map +1 -1
- package/dist/magic/global/viewport.js +20 -0
- package/dist/magic/global/viewport.js.map +1 -1
- package/dist/magic/incantation.d.ts +15 -2
- package/dist/magic/incantation.d.ts.map +1 -1
- package/dist/magic/incantation.js +8 -1
- package/dist/magic/incantation.js.map +1 -1
- package/dist/magic/local/anim.d.ts +5 -1
- package/dist/magic/local/anim.d.ts.map +1 -1
- package/dist/magic/local/anim.js +12 -1
- package/dist/magic/local/anim.js.map +1 -1
- package/dist/magic/local/colour.d.ts +7 -3
- package/dist/magic/local/colour.d.ts.map +1 -1
- package/dist/magic/local/colour.js +13 -3
- package/dist/magic/local/colour.js.map +1 -1
- package/dist/magic/local/dashed.d.ts +5 -1
- package/dist/magic/local/dashed.d.ts.map +1 -1
- package/dist/magic/local/dashed.js +12 -1
- package/dist/magic/local/dashed.js.map +1 -1
- package/dist/magic/local/fill.d.ts +5 -1
- package/dist/magic/local/fill.d.ts.map +1 -1
- package/dist/magic/local/fill.js +15 -1
- package/dist/magic/local/fill.js.map +1 -1
- package/dist/magic/local/hide.d.ts +5 -1
- package/dist/magic/local/hide.d.ts.map +1 -1
- package/dist/magic/local/hide.js +12 -1
- package/dist/magic/local/hide.js.map +1 -1
- package/dist/magic/local/index.d.ts +13 -2
- package/dist/magic/local/index.d.ts.map +1 -1
- package/dist/magic/local/index.js +24 -24
- package/dist/magic/local/index.js.map +1 -1
- package/dist/magic/local/label.d.ts +6 -2
- package/dist/magic/local/label.d.ts.map +1 -1
- package/dist/magic/local/label.js +19 -1
- package/dist/magic/local/label.js.map +1 -1
- package/dist/magic/local/line.d.ts +5 -1
- package/dist/magic/local/line.d.ts.map +1 -1
- package/dist/magic/local/line.js +19 -1
- package/dist/magic/local/line.js.map +1 -1
- package/dist/magic/local/no-line.d.ts +5 -1
- package/dist/magic/local/no-line.d.ts.map +1 -1
- package/dist/magic/local/no-line.js +12 -1
- package/dist/magic/local/no-line.js.map +1 -1
- package/dist/magic/local/point.d.ts +5 -1
- package/dist/magic/local/point.d.ts.map +1 -1
- package/dist/magic/local/point.js +19 -1
- package/dist/magic/local/point.js.map +1 -1
- package/dist/magic/local/secret.d.ts +5 -1
- package/dist/magic/local/secret.d.ts.map +1 -1
- package/dist/magic/local/secret.js +12 -1
- package/dist/magic/local/secret.js.map +1 -1
- package/dist/magic/local/slider.d.ts +5 -1
- package/dist/magic/local/slider.d.ts.map +1 -1
- package/dist/magic/local/slider.js +13 -1
- package/dist/magic/local/slider.js.map +1 -1
- package/dist/parser/ast.d.ts +9 -3
- package/dist/parser/ast.d.ts.map +1 -1
- package/dist/parser/ast.js +3 -1
- package/dist/parser/ast.js.map +1 -1
- package/dist/parser/desmost-parser.d.ts +2 -2
- package/dist/parser/desmost-parser.d.ts.map +1 -1
- package/dist/parser/desmost-parser.js +21 -19
- package/dist/parser/desmost-parser.js.map +1 -1
- package/dist/parser/errors.d.ts +11 -0
- package/dist/parser/errors.d.ts.map +1 -0
- package/dist/parser/errors.js +4 -0
- package/dist/parser/errors.js.map +1 -0
- package/dist/parser/generic-parser.d.ts +13 -11
- package/dist/parser/generic-parser.d.ts.map +1 -1
- package/dist/parser/generic-parser.js +21 -24
- package/dist/parser/generic-parser.js.map +1 -1
- package/dist/utils.js +1 -1
- package/dist/utils.js.map +1 -1
- package/package.json +1 -1
- package/src/compiler/compile.ts +1 -1
- package/src/compiler/compiler.ts +10 -9
- package/src/compiler/format.ts +1 -1
- package/src/decompiler/decompile.ts +30 -14
- package/src/decompiler/emit.ts +57 -25
- package/src/decompiler/extract.ts +30 -89
- package/src/decompiler/format.ts +3 -14
- package/src/decompiler/readme.md +2 -2
- package/src/errors.ts +13 -7
- package/src/magic/.template.ts +8 -0
- package/src/magic/expr/index.ts +6 -7
- package/src/magic/expr/latex.ts +8 -4
- package/src/magic/expr/text.ts +8 -4
- package/src/magic/global/dark.ts +29 -0
- package/src/magic/global/desmos.ts +35 -5
- package/src/magic/global/index.ts +8 -14
- package/src/magic/global/viewport.ts +29 -0
- package/src/magic/incantation.ts +28 -6
- package/src/magic/local/anim.ts +16 -3
- package/src/magic/local/colour.ts +18 -6
- package/src/magic/local/dashed.ts +16 -2
- package/src/magic/local/fill.ts +20 -3
- package/src/magic/local/hide.ts +16 -2
- package/src/magic/local/index.ts +24 -25
- package/src/magic/local/label.ts +31 -8
- package/src/magic/local/line.ts +25 -3
- package/src/magic/local/no-line.ts +16 -2
- package/src/magic/local/point.ts +27 -3
- package/src/magic/local/secret.ts +16 -2
- package/src/magic/local/slider.ts +18 -3
- package/src/parser/ast.ts +10 -7
- package/src/parser/desmost-parser.ts +25 -21
- package/src/parser/errors.ts +10 -0
- package/src/parser/generic-parser.ts +23 -25
- package/src/utils.ts +1 -1
- package/svelte/desmost.svelte +107 -107
- package/dist/magic/expr/index.d.ts +0 -3
- package/dist/magic/expr/index.d.ts.map +0 -1
- package/dist/magic/global/dark-mode.d.ts.map +0 -1
- package/dist/magic/global/dark-mode.js +0 -9
- package/dist/magic/global/dark-mode.js.map +0 -1
- package/src/magic/global/dark-mode.ts +0 -15
package/dist/errors.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAGrC
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,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AY;QAC3B,IAAI,EAAE,IAAI;oBAAV,IAAI,EAAE,IAAI;KAC/B;CACD;AAED,4DAA4D;AAC5D,MAAM,MAAM,QAAQ,CAAC,MAAM,IACxB,MAAM,GACN,MAAM,GAAG;IAAE,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,MAAM,CAAA;CAAE,CAAC"}
|
package/dist/errors.js
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
|
-
/**
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Multiple aggregated errors.
|
|
3
|
+
*
|
|
4
|
+
* Since the compiler does its best to recover from errors, it often needs to aggregate errors to report later, instead of immediately throwing.
|
|
5
|
+
*/
|
|
6
|
+
export class DesmostErrors {
|
|
7
|
+
errors;
|
|
8
|
+
constructor(errors = []) {
|
|
9
|
+
this.errors = errors;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
3
12
|
/**
|
|
4
13
|
* The compiler encountered a fatal unrecoverable error, which will reach the end user.
|
|
5
14
|
*
|
|
@@ -49,6 +58,15 @@ export class DesmostError extends Error {
|
|
|
49
58
|
}
|
|
50
59
|
}
|
|
51
60
|
DesmostError.ExcessInput = ExcessInput;
|
|
61
|
+
/** No incantation with this identifier exists. */
|
|
62
|
+
class UnknownIncantation extends DesmostError {
|
|
63
|
+
data;
|
|
64
|
+
constructor(data) {
|
|
65
|
+
super(data.msg, "Unknown Incantation");
|
|
66
|
+
this.data = data;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
DesmostError.UnknownIncantation = UnknownIncantation;
|
|
52
70
|
/** An incantation can't be applied here. */
|
|
53
71
|
class IllegalIncantation extends DesmostError {
|
|
54
72
|
data;
|
package/dist/errors.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAGA
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AA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B;QAArB,YAAqB,IAAU;YAAI,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,qBAAqB,CAAC,CAAC;YAArD,SAAI,GAAJ,IAAI,CAAM;QAA4C,CAAC;KAC5E;IAFY,+BAAkB,qBAE9B,CAAA;IAED,4CAA4C;IAC5C,MAAa,kBAAmB,SAAQ,YAAY;QAC9B;QAArB,YAAqB,IAAU;YAAI,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,qBAAqB,CAAC,CAAC;YAArD,SAAI,GAAJ,IAAI,CAAM;QAA4C,CAAC;KAC5E;IAFY,+BAAkB,qBAE9B,CAAA;IAED,mGAAmG;IACnG,MAAa,eAAgB,SAAQ,YAAY;QAC3B;QAArB,YAAqB,IAAU;YAAI,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,kBAAkB,CAAC,CAAC;YAAlD,SAAI,GAAJ,IAAI,CAAM;QAAyC,CAAC;KACzE;IAFY,4BAAe,kBAE3B,CAAA;AACF,CAAC,EAjDgB,YAAY,KAAZ,YAAY,QAiD5B"}
|
package/dist/magic/expr/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ArgIncantation } from "../incantation.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
export const EXPR_INCANTATIONS =
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
import { latex } from "./latex.js";
|
|
3
|
+
import { text } from "./text.js";
|
|
4
|
+
export const EXPR_INCANTATIONS = {
|
|
5
|
+
latex,
|
|
6
|
+
text,
|
|
7
|
+
};
|
|
8
8
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/magic/expr/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAa,MAAM,gBAAgB,CAAC;AAE3D,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/magic/expr/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAa,MAAM,gBAAgB,CAAC;AAE3D,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,IAAI,EAAG,MAAM,QAAQ,CAAC;AAG/B,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAChC,KAAK;IACL,IAAI;CAC2C,CAAC"}
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { Incantation, ArgIncantation, type EXPR } from "../incantation.js";
|
|
2
|
-
|
|
3
|
-
readonly
|
|
2
|
+
declare class LatexIncantation extends ArgIncantation<EXPR> {
|
|
3
|
+
readonly effect = Incantation.Effect.EXPR;
|
|
4
4
|
readonly identifier = "latex";
|
|
5
5
|
readonly requires_arg = true;
|
|
6
6
|
readonly arg_type = Incantation.ArgType.LATEX;
|
|
7
|
+
readonly description = "Produce a LaTeX expression. This allows the input to span multiple lines.";
|
|
7
8
|
apply(target: Desmos.ExpressionState, data: string): asserts target is Desmos.Expression;
|
|
8
9
|
}
|
|
10
|
+
export declare const latex: LatexIncantation;
|
|
11
|
+
export {};
|
|
9
12
|
//# sourceMappingURL=latex.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"latex.d.ts","sourceRoot":"","sources":["../../../src/magic/expr/latex.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,KAAK,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAGxE,
|
|
1
|
+
{"version":3,"file":"latex.d.ts","sourceRoot":"","sources":["../../../src/magic/expr/latex.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,KAAK,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAGxE,cAAM,gBAAiB,SAAQ,cAAc,CAAC,IAAI,CAAC;IAElD,SAAkB,MAAM,2BAAgC;IACxD,SAAkB,UAAU,WAAY;IACxC,SAAkB,YAAY,QAAO;IACrC,SAAkB,QAAQ,6BAAgC;IAC1D,SAAkB,WAAW,+EACiD;IAE9E,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,eAAe,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,MAAM,CAAC,UAAU;CAQxF;AAED,eAAO,MAAM,KAAK,kBAAyB,CAAC"}
|
package/dist/magic/expr/latex.js
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import { Incantation, ArgIncantation } from "../incantation.js";
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
class LatexIncantation extends ArgIncantation {
|
|
3
|
+
effect = Incantation.Effect.EXPR;
|
|
4
4
|
identifier = "latex";
|
|
5
5
|
requires_arg = true;
|
|
6
6
|
arg_type = Incantation.ArgType.LATEX;
|
|
7
|
+
description = "Produce a LaTeX expression. This allows the input to span multiple lines.";
|
|
7
8
|
apply(target, data) {
|
|
8
9
|
target.type = "expression";
|
|
9
10
|
// @ts-expect-error: previous assignment type-narrows
|
|
10
11
|
target.latex = data === "" ? " " : data;
|
|
11
12
|
}
|
|
12
13
|
}
|
|
14
|
+
export const latex = new LatexIncantation();
|
|
13
15
|
//# sourceMappingURL=latex.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"latex.js","sourceRoot":"","sources":["../../../src/magic/expr/latex.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,cAAc,EAAa,MAAM,gBAAgB,CAAC;AAGxE,MAAM,
|
|
1
|
+
{"version":3,"file":"latex.js","sourceRoot":"","sources":["../../../src/magic/expr/latex.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,cAAc,EAAa,MAAM,gBAAgB,CAAC;AAGxE,MAAM,gBAAiB,SAAQ,cAAoB;IAEhC,MAAM,GAAS,WAAW,CAAC,MAAM,CAAC,IAAI,CAAA;IACtC,UAAU,GAAK,OAAO,CAAA;IACtB,YAAY,GAAG,IAAI,CAAA;IACnB,QAAQ,GAAO,WAAW,CAAC,OAAO,CAAC,KAAK,CAAA;IACxC,WAAW,GAC1B,2EAA2E,CAAA;IAE9E,KAAK,CAAC,MAA8B,EAAE,IAAY;QAEjD,MAAM,CAAC,IAAI,GAAG,YAAY,CAAC;QAC3B,qDAAqD;QACrD,MAAM,CAAC,KAAK,GAAG,IAAI,KAAK,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC;IACzC,CAAC;CAGD;AAED,MAAM,CAAC,MAAM,KAAK,GAAG,IAAI,gBAAgB,EAAE,CAAC"}
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { Incantation, ArgIncantation, type EXPR } from "../incantation.js";
|
|
2
|
-
|
|
3
|
-
readonly
|
|
2
|
+
declare class TextIncantation extends ArgIncantation<EXPR> {
|
|
3
|
+
readonly effect = Incantation.Effect.EXPR;
|
|
4
4
|
readonly identifier = "text";
|
|
5
5
|
readonly alias = "note";
|
|
6
6
|
readonly requires_arg = true;
|
|
7
7
|
readonly arg_type = Incantation.ArgType.STRING;
|
|
8
|
+
readonly description = "Produce a text expression (\u201CAdd Note\u201D in the Desmos GUI).";
|
|
8
9
|
apply(target: Desmos.ExpressionState, data: string): asserts target is Desmos.Note;
|
|
9
10
|
}
|
|
11
|
+
export declare const text: TextIncantation;
|
|
12
|
+
export {};
|
|
10
13
|
//# sourceMappingURL=text.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text.d.ts","sourceRoot":"","sources":["../../../src/magic/expr/text.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,KAAK,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAGxE,
|
|
1
|
+
{"version":3,"file":"text.d.ts","sourceRoot":"","sources":["../../../src/magic/expr/text.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,KAAK,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAGxE,cAAM,eAAgB,SAAQ,cAAc,CAAC,IAAI,CAAC;IAEjD,SAAkB,MAAM,2BAAgC;IACxD,SAAkB,UAAU,UAAW;IACvC,SAAkB,KAAK,UAAgB;IACvC,SAAkB,YAAY,QAAO;IACrC,SAAkB,QAAQ,8BAAiC;IAC3D,SAAkB,WAAW,yEACiC;IAErD,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,eAAe,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,MAAM,CAAC,IAAI;CAQ3F;AAED,eAAO,MAAM,IAAI,iBAAwB,CAAC"}
|
package/dist/magic/expr/text.js
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import { Incantation, ArgIncantation } from "../incantation.js";
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
class TextIncantation extends ArgIncantation {
|
|
3
|
+
effect = Incantation.Effect.EXPR;
|
|
4
4
|
identifier = "text";
|
|
5
5
|
alias = "note";
|
|
6
6
|
requires_arg = true;
|
|
7
7
|
arg_type = Incantation.ArgType.STRING;
|
|
8
|
+
description = "Produce a text expression (“Add Note” in the Desmos GUI).";
|
|
8
9
|
apply(target, data) {
|
|
9
10
|
target.type = "text";
|
|
10
11
|
// @ts-expect-error: previous assignment type-narrows
|
|
11
12
|
target.text = data;
|
|
12
13
|
}
|
|
13
14
|
}
|
|
15
|
+
export const text = new TextIncantation();
|
|
14
16
|
//# sourceMappingURL=text.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text.js","sourceRoot":"","sources":["../../../src/magic/expr/text.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,cAAc,EAAa,MAAM,gBAAgB,CAAC;AAGxE,MAAM,
|
|
1
|
+
{"version":3,"file":"text.js","sourceRoot":"","sources":["../../../src/magic/expr/text.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,cAAc,EAAa,MAAM,gBAAgB,CAAC;AAGxE,MAAM,eAAgB,SAAQ,cAAoB;IAE/B,MAAM,GAAS,WAAW,CAAC,MAAM,CAAC,IAAI,CAAA;IACtC,UAAU,GAAK,MAAM,CAAA;IACrB,KAAK,GAAU,MAAM,CAAA;IACrB,YAAY,GAAG,IAAI,CAAA;IACnB,QAAQ,GAAO,WAAW,CAAC,OAAO,CAAC,MAAM,CAAA;IACzC,WAAW,GAC1B,2DAA2D,CAAA;IAErD,KAAK,CAAC,MAA8B,EAAE,IAAY;QAE1D,MAAM,CAAC,IAAI,GAAG,MAAM,CAAC;QACrB,qDAAqD;QACrD,MAAM,CAAC,IAAI,GAAG,IAAI,CAAC;IACpB,CAAC;CAGD;AAED,MAAM,CAAC,MAAM,IAAI,GAAG,IAAI,eAAe,EAAE,CAAC"}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { Incantation, type GLOBAL } from "../incantation.js";
|
|
2
|
+
import { Ast } from "../../parser/index.js";
|
|
2
3
|
export declare class DarkModeIncantation extends Incantation<GLOBAL> {
|
|
3
|
-
readonly
|
|
4
|
+
readonly effect = Incantation.Effect.GLOBAL;
|
|
4
5
|
readonly identifier = "dark";
|
|
6
|
+
readonly description = "Enable dark mode for the calculator, which inverts all colours.";
|
|
5
7
|
apply(target: Desmos.Calculator): void;
|
|
8
|
+
extract(target: Desmos.Calculator): Ast.IncantationInvocation<Incantation.Effect.GLOBAL> | void;
|
|
6
9
|
}
|
|
7
|
-
|
|
10
|
+
export declare const dark: DarkModeIncantation;
|
|
11
|
+
//# sourceMappingURL=dark.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dark.d.ts","sourceRoot":"","sources":["../../../src/magic/global/dark.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,KAAK,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAE1D,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAGnC,qBAAa,mBAAoB,SAAQ,WAAW,CAAC,MAAM,CAAC;IAE3D,SAAkB,MAAM,6BAAgC;IACxD,SAAkB,UAAU,UAAS;IACrC,SAAkB,WAAW,qEACuC;IAEpE,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,UAAU;IAKtB,OAAO,CAAC,MAAM,EAAE,MAAM,CAAC,UAAU,GAAG,GAAG,CAAC,qBAAqB,CAAC,WAAW,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,IAAI;CASxG;AAED,eAAO,MAAM,IAAI,qBAA4B,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Incantation } from "../incantation.js";
|
|
2
|
+
import { Ast } from "../../parser/index.js";
|
|
3
|
+
export class DarkModeIncantation extends Incantation {
|
|
4
|
+
effect = Incantation.Effect.GLOBAL;
|
|
5
|
+
identifier = "dark";
|
|
6
|
+
description = "Enable dark mode for the calculator, which inverts all colours.";
|
|
7
|
+
apply(target) {
|
|
8
|
+
target.updateSettings({ invertedColors: true });
|
|
9
|
+
}
|
|
10
|
+
extract(target) {
|
|
11
|
+
if (target.settings.invertedColors) {
|
|
12
|
+
return {
|
|
13
|
+
kind: Ast.Kind.INCANTATION_INVOCATION,
|
|
14
|
+
incantation: dark,
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
export const dark = new DarkModeIncantation();
|
|
20
|
+
//# sourceMappingURL=dark.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dark.js","sourceRoot":"","sources":["../../../src/magic/global/dark.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAe,MAAM,gBAAgB,CAAC;AAE1D,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAGnC,MAAM,OAAO,mBAAoB,SAAQ,WAAmB;IAEzC,MAAM,GAAO,WAAW,CAAC,MAAM,CAAC,MAAM,CAAA;IACtC,UAAU,GAAG,MAAM,CAAA;IACnB,WAAW,GAC1B,iEAAiE,CAAA;IAEpE,KAAK,CAAC,MAAyB;QAE9B,MAAM,CAAC,cAAc,CAAC,EAAE,cAAc,EAAE,IAAI,EAAE,CAAC,CAAC;IACjD,CAAC;IAEQ,OAAO,CAAC,MAAyB;QAEzC,IAAI,MAAM,CAAC,QAAQ,CAAC,cAAc,EAAE,CAAC;YACpC,OAAO;gBACN,IAAI,EAAE,GAAG,CAAC,IAAI,CAAC,sBAAsB;gBACrC,WAAW,EAAE,IAAI;aACjB,CAAC;QACH,CAAC;IACF,CAAC;CACD;AAED,MAAM,CAAC,MAAM,IAAI,GAAG,IAAI,mBAAmB,EAAE,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Incantation, ArgIncantation, type GLOBAL } from "../incantation.js";
|
|
2
|
-
import { type Fallible } from "../../errors.js";
|
|
3
2
|
import type { DesmostOptions } from "../../options.js";
|
|
3
|
+
import { type Fallible } from "../../errors.js";
|
|
4
|
+
import { Ast } from "../../parser/index.js";
|
|
4
5
|
type DesmosSettings = Desmos.GraphConfiguration & Desmos.GraphSettings;
|
|
5
6
|
export declare class DesmosIncantation extends ArgIncantation<GLOBAL> {
|
|
6
7
|
readonly description = "Tweak calculator settings via `Calculator.updateSettings()`.";
|
|
@@ -9,6 +10,8 @@ export declare class DesmosIncantation extends ArgIncantation<GLOBAL> {
|
|
|
9
10
|
readonly arg_type = Incantation.ArgType.OBJECT;
|
|
10
11
|
apply(target: Desmos.Calculator, data?: DesmosSettings): void;
|
|
11
12
|
evaluate_arg(raw: string, options: DesmostOptions): Fallible<DesmosSettings>;
|
|
13
|
+
extract(target: Desmos.Calculator, blank: Desmos.Calculator): Ast.IncantationInvocation<Incantation.Effect.GLOBAL> | void;
|
|
12
14
|
}
|
|
15
|
+
export declare const desmos: DesmosIncantation;
|
|
13
16
|
export {};
|
|
14
17
|
//# sourceMappingURL=desmos.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"desmos.d.ts","sourceRoot":"","sources":["../../../src/magic/global/desmos.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,KAAK,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAE1E,OAAO,EAAgB,KAAK,QAAQ,EAAE,MAAM,cAAc,CAAC;AAC3D,OAAO,
|
|
1
|
+
{"version":3,"file":"desmos.d.ts","sourceRoot":"","sources":["../../../src/magic/global/desmos.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,KAAK,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAE1E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAgB,KAAK,QAAQ,EAAE,MAAM,cAAc,CAAC;AAC3D,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAGnC,KAAK,cAAc,GAAG,MAAM,CAAC,kBAAkB,GAAG,MAAM,CAAC,aAAa,CAAA;AAGtE,qBAAa,iBAAkB,SAAQ,cAAc,CAAC,MAAM,CAAC;IAE5D,SAAkB,WAAW,kEACoC;IAEjE,SAAkB,UAAU,YAAa;IACzC,SAAkB,YAAY,SAAQ;IACtC,SAAkB,QAAQ,8BAAiC;IAElD,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,UAAU,EAAE,IAAI,CAAC,EAAE,cAAc,GAAG,IAAI;IAO7D,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,GAAG,QAAQ,CAAC,cAAc,CAAC;IAiB5E,OAAO,CACf,MAAM,EAAE,MAAM,CAAC,UAAU,EACzB,KAAK,EAAE,MAAM,CAAC,UAAU,GACtB,GAAG,CAAC,qBAAqB,CAAC,WAAW,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,IAAI;CA0B9D;AAED,eAAO,MAAM,MAAM,mBAA0B,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Incantation, ArgIncantation } from "../incantation.js";
|
|
2
2
|
import { DesmostError } from "../../errors.js";
|
|
3
|
+
import { Ast } from "../../parser/index.js";
|
|
3
4
|
export class DesmosIncantation extends ArgIncantation {
|
|
4
5
|
description = "Tweak calculator settings via `Calculator.updateSettings()`.";
|
|
5
6
|
identifier = "desmos";
|
|
@@ -23,5 +24,27 @@ export class DesmosIncantation extends ArgIncantation {
|
|
|
23
24
|
}
|
|
24
25
|
return out;
|
|
25
26
|
}
|
|
27
|
+
extract(target, blank) {
|
|
28
|
+
let settings = { ...target.settings };
|
|
29
|
+
let defaults = blank.settings;
|
|
30
|
+
for (let [key, val] of Object.entries(settings)) {
|
|
31
|
+
if (val === defaults[key]
|
|
32
|
+
|| key === "__observers"
|
|
33
|
+
|| key === "guid"
|
|
34
|
+
|| key === "randomSeed"
|
|
35
|
+
|| key === "colors") {
|
|
36
|
+
delete settings[key];
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
let arg_raw = super.emit_object_arg(settings);
|
|
40
|
+
if (arg_raw.trim() === "")
|
|
41
|
+
return;
|
|
42
|
+
return {
|
|
43
|
+
kind: Ast.Kind.INCANTATION_INVOCATION,
|
|
44
|
+
incantation: desmos,
|
|
45
|
+
arg_raw,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
26
48
|
}
|
|
49
|
+
export const desmos = new DesmosIncantation();
|
|
27
50
|
//# sourceMappingURL=desmos.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"desmos.js","sourceRoot":"","sources":["../../../src/magic/global/desmos.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,cAAc,EAAe,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"desmos.js","sourceRoot":"","sources":["../../../src/magic/global/desmos.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,cAAc,EAAe,MAAM,gBAAgB,CAAC;AAG1E,OAAO,EAAE,YAAY,EAAiB,MAAM,cAAc,CAAC;AAC3D,OAAO,EAAE,GAAG,EAAE,MAAM,cAA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gBACF,OAAO,QAAQ,CAAC,GAAG,CAAC,CAAC;YACtB,CAAC;QACF,CAAC;QAED,IAAI,OAAO,GAAG,KAAK,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC;QAC9C,IAAI,OAAO,CAAC,IAAI,EAAE,KAAK,EAAE;YAAE,OAAO;QAElC,OAAO;YACN,IAAI,EAAE,GAAG,CAAC,IAAI,CAAC,sBAAsB;YACrC,WAAW,EAAE,MAAM;YACnB,OAAO;SACP,CAAC;IACH,CAAC;CACD;AAED,MAAM,CAAC,MAAM,MAAM,GAAG,IAAI,iBAAiB,EAAE,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import
|
|
5
|
-
|
|
1
|
+
export declare const GLOBAL_INCANTATIONS: {
|
|
2
|
+
desmos: import("./desmos.js").DesmosIncantation;
|
|
3
|
+
viewport: import("./viewport.js").ViewportIncantation;
|
|
4
|
+
dark: import("./dark.js").DarkModeIncantation;
|
|
5
|
+
};
|
|
6
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/magic/global/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/magic/global/index.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,mBAAmB;;;;CAIe,CAAC"}
|
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
export { DesmosIncantation } from "./desmos.js";
|
|
2
|
-
export { ViewportIncantation } from "./viewport.js";
|
|
3
|
-
export { DarkModeIncantation } from "./dark-mode.js";
|
|
4
1
|
import { Incantation } from "../incantation.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
export const GLOBAL_INCANTATIONS =
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
2
|
+
import { desmos } from "./desmos.js";
|
|
3
|
+
import { viewport } from "./viewport.js";
|
|
4
|
+
import { dark } from "./dark.js";
|
|
5
|
+
export const GLOBAL_INCANTATIONS = {
|
|
6
|
+
desmos,
|
|
7
|
+
viewport,
|
|
8
|
+
dark,
|
|
9
|
+
};
|
|
13
10
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/magic/global/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/magic/global/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAe,MAAM,gBAAgB,CAAC;AAE1D,OAAO,EAAE,MAAM,EAAI,MAAM,UAAU,CAAC;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,IAAI,EAAM,MAAM,QAAQ,CAAC;AAGlC,MAAM,CAAC,MAAM,mBAAmB,GAAG;IAClC,MAAM;IACN,QAAQ;IACR,IAAI;CAC0C,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Incantation, ArgIncantation, type GLOBAL } from "../incantation.js";
|
|
2
2
|
import { type Fallible } from "../../errors.js";
|
|
3
3
|
import type { DesmostOptions } from "../../options.js";
|
|
4
|
+
import { Ast } from "../../parser/index.js";
|
|
4
5
|
interface ViewportBounds {
|
|
5
6
|
left?: number;
|
|
6
7
|
right?: number;
|
|
@@ -14,6 +15,8 @@ export declare class ViewportIncantation extends ArgIncantation<GLOBAL> {
|
|
|
14
15
|
readonly arg_type = Incantation.ArgType.OBJECT;
|
|
15
16
|
apply(target: Desmos.Calculator, data: ViewportBounds): void;
|
|
16
17
|
evaluate_arg(raw: string, options: DesmostOptions): Fallible<ViewportBounds>;
|
|
18
|
+
extract(target: Desmos.Calculator, blank: Desmos.Calculator): Ast.IncantationInvocation<Incantation.Effect.GLOBAL> | void;
|
|
17
19
|
}
|
|
20
|
+
export declare const viewport: ViewportIncantation;
|
|
18
21
|
export {};
|
|
19
22
|
//# sourceMappingURL=viewport.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"viewport.d.ts","sourceRoot":"","sources":["../../../src/magic/global/viewport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,KAAK,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAE1E,OAAO,EAAgB,KAAK,QAAQ,EAAE,MAAM,cAAc,CAAC;AAC3D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"viewport.d.ts","sourceRoot":"","sources":["../../../src/magic/global/viewport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,KAAK,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAE1E,OAAO,EAAgB,KAAK,QAAQ,EAAE,MAAM,cAAc,CAAC;AAC3D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAGnC,UAAU,cAAc;IAEvB,IAAI,CAAC,EAAI,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAChC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAI,MAAM,CAAC;CAChC;AAKD,qBAAa,mBAAoB,SAAQ,cAAc,CAAC,MAAM,CAAC;IAE9D,SAAkB,WAAW,sEACwC;IAErE,SAAkB,UAAU,cAAe;IAC3C,SAAkB,YAAY,QAAO;IACrC,SAAkB,QAAQ,8BAAiC;IAElD,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,UAAU,EAAE,IAAI,EAAE,cAAc;IAcrD,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,GAAG,QAAQ,CAAC,cAAc,CAAC;IA4B5E,OAAO,CACf,MAAM,EAAE,MAAM,CAAC,UAAU,EACzB,KAAK,EAAE,MAAM,CAAC,UAAU,GACtB,GAAG,CAAC,qBAAqB,CAAC,WAAW,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,IAAI;CAsB9D;AAED,eAAO,MAAM,QAAQ,qBAA4B,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Incantation, ArgIncantation } from "../incantation.js";
|
|
2
2
|
import { DesmostError } from "../../errors.js";
|
|
3
|
+
import { Ast } from "../../parser/index.js";
|
|
3
4
|
const VALID_KEYS = ["left", "right", "bottom", "top"];
|
|
4
5
|
export class ViewportIncantation extends ArgIncantation {
|
|
5
6
|
description = "Set the bounds of the viewport via `Calculator.setMathBounds()`.";
|
|
@@ -32,5 +33,24 @@ export class ViewportIncantation extends ArgIncantation {
|
|
|
32
33
|
}
|
|
33
34
|
return out;
|
|
34
35
|
}
|
|
36
|
+
extract(target, blank) {
|
|
37
|
+
let { left, right, bottom, top } = target.graphpaperBounds.mathCoordinates;
|
|
38
|
+
let bounds = { left, right, bottom, top };
|
|
39
|
+
let defaults = blank.graphpaperBounds.mathCoordinates;
|
|
40
|
+
for (let [key, val] of Object.entries(bounds)) {
|
|
41
|
+
if (Math.abs(val - defaults[key]) < 0.001) {
|
|
42
|
+
delete bounds[key];
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
let arg_raw = super.emit_object_arg(bounds);
|
|
46
|
+
if (arg_raw.trim() === "")
|
|
47
|
+
return;
|
|
48
|
+
return {
|
|
49
|
+
kind: Ast.Kind.INCANTATION_INVOCATION,
|
|
50
|
+
incantation: viewport,
|
|
51
|
+
arg_raw,
|
|
52
|
+
};
|
|
53
|
+
}
|
|
35
54
|
}
|
|
55
|
+
export const viewport = new ViewportIncantation();
|
|
36
56
|
//# sourceMappingURL=viewport.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"viewport.js","sourceRoot":"","sources":["../../../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C,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;YAC/C,IAAI,IAAI,CAAC,GAAG,CAAC,GAAG,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,GAAG,KAAK,EAAE,CAAC;gBAC3C,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC;YACpB,CAAC;QACF,CAAC;QAED,IAAI,OAAO,GAAG,KAAK,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC;QAC5C,IAAI,OAAO,CAAC,IAAI,EAAE,KAAK,EAAE;YAAE,OAAO;QAElC,OAAO;YACN,IAAI,EAAE,GAAG,CAAC,IAAI,CAAC,sBAAsB;YACrC,WAAW,EAAE,QAAQ;YACrB,OAAO;SACP,CAAC;IACH,CAAC;CACD;AAED,MAAM,CAAC,MAAM,QAAQ,GAAG,IAAI,mBAAmB,EAAE,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { DesmostOptions } from "../options.js";
|
|
2
|
+
import type { Ast } from "../parser/index.js";
|
|
2
3
|
import { DesmostError, type Fallible } from "../errors.js";
|
|
3
4
|
/**
|
|
4
5
|
* An *Incantation* is like a slash command that tells Desmost to do something - like changing the properties of an expression, or applying some settings to the calculator as a whole.
|
|
@@ -14,16 +15,24 @@ import { DesmostError, type Fallible } from "../errors.js";
|
|
|
14
15
|
* Incantations that accept an argument derive from `ArgIncantation`.
|
|
15
16
|
*/
|
|
16
17
|
export declare abstract class Incantation<Effect extends Incantation.Effect = Incantation.Effect> {
|
|
17
|
-
/**
|
|
18
|
-
abstract readonly
|
|
18
|
+
/** Whether the incantation is a global, local or expression incantation. */
|
|
19
|
+
abstract readonly effect: Effect;
|
|
19
20
|
/** The raw text sequence that matches this incantation, such as `viewport` or `hidden`. */
|
|
20
21
|
abstract readonly identifier: string;
|
|
21
22
|
/** An alternative `.identifier`, strictly for localisation purposes only. */
|
|
22
23
|
readonly alias?: string;
|
|
24
|
+
/** Short user-facing description of what the incantation does. */
|
|
25
|
+
abstract readonly description: string;
|
|
23
26
|
/** Apply this incantation's effect to `target`, using the provided `data` if required. */
|
|
24
27
|
abstract apply(target: Effect extends GLOBAL ? Desmos.Calculator : Desmos.ExpressionState, data?: unknown): void;
|
|
25
28
|
/** Error if the `actual` type of the given expression is not `required`. */
|
|
26
29
|
protected require_expr_type<T extends Desmos.ExpressionState["type"]>(actual: unknown, required: T): asserts actual is T;
|
|
30
|
+
/**
|
|
31
|
+
* Extract the AST representation of this incantation from `target`.
|
|
32
|
+
*
|
|
33
|
+
* (The opposite of {@linkcode apply()}.)
|
|
34
|
+
*/
|
|
35
|
+
abstract extract(target: Effect extends GLOBAL ? Desmos.Calculator : Desmos.ExpressionState, blank?: Effect extends GLOBAL ? Desmos.Calculator : never): Ast.IncantationInvocation<Effect> | void;
|
|
27
36
|
}
|
|
28
37
|
/**
|
|
29
38
|
* An incantation that accepts an argument.
|
|
@@ -47,6 +56,10 @@ export declare abstract class ArgIncantation<Effect extends Incantation.Effect =
|
|
|
47
56
|
evaluate_arg(raw: string, options: DesmostOptions): Fallible<unknown>;
|
|
48
57
|
protected require_nonempty(arg: object, error_data?: DesmostError.Data): Fallible<void>;
|
|
49
58
|
protected require_known(arg: object, valid_fields: string[], error_data?: DesmostError.Data): Fallible<void>;
|
|
59
|
+
/**
|
|
60
|
+
* Stringify an object argument to its raw source text.
|
|
61
|
+
*/
|
|
62
|
+
protected emit_object_arg(data: object): string;
|
|
50
63
|
}
|
|
51
64
|
/** An incantation that affects the entire Desmos calculator state, like `/desmos` or `/viewport`. */
|
|
52
65
|
export type GLOBAL = Incantation.Effect.GLOBAL;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"incantation.d.ts","sourceRoot":"","sources":["../../src/magic/incantation.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,KAAK,QAAQ,EAAE,MAAM,WAAW,CAAC;AAG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;KACJ;IAED,mFAAmF;IACnF,KAAY,OAAO;QAElB,yHAAyH;QACzH,MAAM,WAAW;QAEjB,qDAAqD;QACrD,KAAK,UAAU;QAEf,uGAAuG;QACvG,IAAI,SAAS;QAEb,oHAAoH;QACpH,MAAM,WAAW;KACjB;CACD"}
|
|
@@ -22,7 +22,7 @@ export class Incantation {
|
|
|
22
22
|
if ((actual ?? "expression") !== required) {
|
|
23
23
|
let req = required === "expression" ? "latex" : required;
|
|
24
24
|
throw new DesmostError.IllegalIncantation({
|
|
25
|
-
msg: `/${this.identifier} can only applied to
|
|
25
|
+
msg: `/${this.identifier} can only applied to \`${req}\` blocks, but target block has type: \`${actual}\``,
|
|
26
26
|
});
|
|
27
27
|
}
|
|
28
28
|
}
|
|
@@ -81,6 +81,13 @@ export class ArgIncantation extends Incantation {
|
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
|
+
/**
|
|
85
|
+
* Stringify an object argument to its raw source text.
|
|
86
|
+
*/
|
|
87
|
+
emit_object_arg(data) {
|
|
88
|
+
let defined = Object.fromEntries(Object.entries(data).filter((k, v) => Boolean(v)));
|
|
89
|
+
return Json5.stringify(defined).slice(1, -1);
|
|
90
|
+
}
|
|
84
91
|
}
|
|
85
92
|
(function (Incantation) {
|
|
86
93
|
/** The kind of effect an incantation produces - it either modifies only one block, or modifies the calculator as a whole. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"incantation.js","sourceRoot":"","sources":["../../src/magic/incantation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,MAAM,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"incantation.js","sourceRoot":"","sources":["../../src/magic/incantation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,MAAM,MAAM,QAAQ,CAAC;AAI5B,OAAO,EAAE,YAAY,EAAiB,MAAM,WAAW,CAAC;A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IAC7H,IAAY,MAUX;IAVD,WAAY,MAAM;QAEjB,qGAAqG;QACrG,uCAAM,CAAA;QAEN,2GAA2G;QAC3G,qCAAK,CAAA;QAEL,4EAA4E;QAC5E,mCAAI,CAAA;IACL,CAAC,EAVW,MAAM,GAAN,kBAAM,KAAN,kBAAM,QAUjB;IAED,mFAAmF;IACnF,IAAY,OAaX;IAbD,WAAY,OAAO;QAElB,yHAAyH;QACzH,4BAAiB,CAAA;QAEjB,qDAAqD;QACrD,0BAAe,CAAA;QAEf,uGAAuG;QACvG,wBAAa,CAAA;QAEb,oHAAoH;QACpH,4BAAiB,CAAA;IAClB,CAAC,EAbW,OAAO,GAAP,mBAAO,KAAP,mBAAO,QAalB;AACF,CAAC,EA9BgB,WAAW,KAAX,WAAW,QA8B3B"}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { Incantation, type LOCAL } from "../incantation.js";
|
|
2
|
+
import { Ast } from "../../parser/index.js";
|
|
2
3
|
export declare class AnimIncantation extends Incantation<LOCAL> {
|
|
3
|
-
readonly
|
|
4
|
+
readonly effect = Incantation.Effect.LOCAL;
|
|
4
5
|
readonly identifier = "anim";
|
|
6
|
+
readonly description = "Animate the slider of a block.";
|
|
5
7
|
apply(target: Desmos.ExpressionState): void;
|
|
8
|
+
extract(target: Desmos.Expression): Ast.IncantationInvocation<LOCAL> | void;
|
|
6
9
|
}
|
|
10
|
+
export declare const anim: AnimIncantation;
|
|
7
11
|
//# sourceMappingURL=anim.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"anim.d.ts","sourceRoot":"","sources":["../../../src/magic/local/anim.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,KAAK,KAAK,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"anim.d.ts","sourceRoot":"","sources":["../../../src/magic/local/anim.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,KAAK,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAGnC,qBAAa,eAAgB,SAAQ,WAAW,CAAC,KAAK,CAAC;IAEtD,SAAkB,MAAM,4BAAiC;IACzD,SAAkB,UAAU,UAAS;IACrC,SAAkB,WAAW,oCACM;IAE1B,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,eAAe;IAMpC,OAAO,CAAC,MAAM,EAAE,MAAM,CAAC,UAAU,GAAG,GAAG,CAAC,qBAAqB,CAAC,KAAK,CAAC,GAAG,IAAI;CASpF;AAED,eAAO,MAAM,IAAI,iBAAwB,CAAC"}
|
package/dist/magic/local/anim.js
CHANGED
|
@@ -1,10 +1,21 @@
|
|
|
1
1
|
import { Incantation } from "../incantation.js";
|
|
2
|
+
import { Ast } from "../../parser/index.js";
|
|
2
3
|
export class AnimIncantation extends Incantation {
|
|
3
|
-
|
|
4
|
+
effect = Incantation.Effect.LOCAL;
|
|
4
5
|
identifier = "anim";
|
|
6
|
+
description = `Animate the slider of a block.`;
|
|
5
7
|
apply(target) {
|
|
6
8
|
super.require_expr_type(target.type, "expression");
|
|
7
9
|
target.playing = true;
|
|
8
10
|
}
|
|
11
|
+
extract(target) {
|
|
12
|
+
if (target.playing) {
|
|
13
|
+
return {
|
|
14
|
+
kind: Ast.Kind.INCANTATION_INVOCATION,
|
|
15
|
+
incantation: anim,
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
}
|
|
9
19
|
}
|
|
20
|
+
export const anim = new AnimIncantation();
|
|
10
21
|
//# sourceMappingURL=anim.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"anim.js","sourceRoot":"","sources":["../../../src/magic/local/anim.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAc,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"anim.js","sourceRoot":"","sources":["../../../src/magic/local/anim.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAc,MAAM,gBAAgB,CAAC;AACzD,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAGnC,MAAM,OAAO,eAAgB,SAAQ,WAAkB;IAEpC,MAAM,GAAS,WAAW,CAAC,MAAM,CAAC,KAAK,CAAA;IACvC,UAAU,GAAG,MAAM,CAAA;IACnB,WAAW,GAC1B,gCAAgC,CAAA;IAE1B,KAAK,CAAC,MAA8B;QAE5C,KAAK,CAAC,iBAAiB,CAAC,MAAM,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;QACnD,MAAM,CAAC,OAAO,GAAG,IAAI,CAAC;IACvB,CAAC;IAEQ,OAAO,CAAC,MAAyB;QAEzC,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;YACpB,OAAO;gBACN,IAAI,EAAE,GAAG,CAAC,IAAI,CAAC,sBAAsB;gBACrC,WAAW,EAAE,IAAI;aACjB,CAAC;QACH,CAAC;IACF,CAAC;CACD;AAED,MAAM,CAAC,MAAM,IAAI,GAAG,IAAI,eAAe,EAAE,CAAC"}
|
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
import { Incantation, ArgIncantation, type LOCAL } from "../incantation.js";
|
|
2
2
|
import type { DesmostOptions } from "../../options.js";
|
|
3
|
+
import { Ast } from "../../parser/index.js";
|
|
3
4
|
type DesmosColourName = keyof typeof Desmos.Colors;
|
|
4
5
|
type DesmosColour = (typeof Desmos.Colors)[DesmosColourName];
|
|
5
6
|
export declare class ColourIncantation extends ArgIncantation<LOCAL> {
|
|
6
|
-
readonly
|
|
7
|
-
readonly identifier = "
|
|
8
|
-
readonly alias = "
|
|
7
|
+
readonly effect = Incantation.Effect.LOCAL;
|
|
8
|
+
readonly identifier = "colour";
|
|
9
|
+
readonly alias = "color";
|
|
9
10
|
readonly requires_arg = true;
|
|
10
11
|
readonly arg_type = Incantation.ArgType.ENUM;
|
|
12
|
+
readonly description = "Change the colour of a rendered expression, such as a line, region, polygon, etc.";
|
|
11
13
|
apply(target: Desmos.ExpressionState, data: DesmosColour): void;
|
|
12
14
|
evaluate_arg(data: string, options: DesmostOptions): DesmosColour;
|
|
15
|
+
extract(target: Desmos.Expression): Ast.IncantationInvocation<LOCAL>;
|
|
13
16
|
}
|
|
17
|
+
export declare const colour: ColourIncantation;
|
|
14
18
|
export {};
|
|
15
19
|
//# sourceMappingURL=colour.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"colour.d.ts","sourceRoot":"","sources":["../../../src/magic/local/colour.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,KAAK,KAAK,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"colour.d.ts","sourceRoot":"","sources":["../../../src/magic/local/colour.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,KAAK,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAEzE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAEpD,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAGnC,KAAK,gBAAgB,GAAG,MAAM,OAAO,MAAM,CAAC,MAAM,CAAC;AACnD,KAAK,YAAY,GAAG,CAAC,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC,gBAAgB,CAAC,CAAC;AAK7D,qBAAa,iBAAkB,SAAQ,cAAc,CAAC,KAAK,CAAC;IAE3D,SAAkB,MAAM,4BAAiC;IACzD,SAAkB,UAAU,YAAa;IACzC,SAAkB,KAAK,WAAiB;IACxC,SAAkB,YAAY,QAAO;IACrC,SAAkB,QAAQ,4BAA+B;IACzD,SAAkB,WAAW,uFACyD;IAE7E,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,eAAe,EAAE,IAAI,EAAE,YAAY;IAMxD,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,GAAG,YAAY;IAqBjE,OAAO,CAAC,MAAM,EAAE,MAAM,CAAC,UAAU,GAAG,GAAG,CAAC,qBAAqB,CAAC,KAAK,CAAC;CAQ7E;AAED,eAAO,MAAM,MAAM,mBAA0B,CAAC"}
|