desmost 0.8.2 → 0.9.1
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 +80 -13
- package/dist/compiler/compile.d.ts +7 -3
- package/dist/compiler/compile.d.ts.map +1 -1
- package/dist/compiler/compile.js +7 -3
- package/dist/compiler/compile.js.map +1 -1
- package/dist/compiler/evaluate.d.ts +5 -5
- package/dist/compiler/evaluate.d.ts.map +1 -1
- package/dist/compiler/evaluate.js +16 -8
- package/dist/compiler/evaluate.js.map +1 -1
- package/dist/compiler/format.d.ts +2 -2
- package/dist/compiler/format.d.ts.map +1 -1
- package/dist/compiler/format.js +14 -1
- package/dist/compiler/format.js.map +1 -1
- package/dist/compiler/index.d.ts +0 -1
- package/dist/compiler/index.d.ts.map +1 -1
- package/dist/decompiler/decompile.d.ts +12 -1
- package/dist/decompiler/decompile.d.ts.map +1 -1
- package/dist/decompiler/decompile.js +14 -2
- package/dist/decompiler/decompile.js.map +1 -1
- package/dist/decompiler/emit.d.ts.map +1 -1
- package/dist/decompiler/emit.js +13 -6
- package/dist/decompiler/emit.js.map +1 -1
- package/dist/decompiler/extract.d.ts.map +1 -1
- package/dist/decompiler/extract.js +3 -2
- package/dist/decompiler/extract.js.map +1 -1
- package/dist/decompiler/format.js +1 -1
- package/dist/decompiler/format.js.map +1 -1
- package/dist/desmos.d.ts +4 -0
- package/dist/desmos.d.ts.map +1 -1
- package/dist/desmos.js +6 -0
- package/dist/desmos.js.map +1 -1
- package/dist/errors.d.ts +18 -0
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +37 -0
- package/dist/errors.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.internal.d.ts +1 -1
- package/dist/index.internal.d.ts.map +1 -1
- package/dist/index.internal.js +1 -1
- package/dist/index.internal.js.map +1 -1
- package/dist/index.js +0 -1
- package/dist/index.js.map +1 -1
- package/dist/magic/expr/latex.d.ts +1 -2
- package/dist/magic/expr/latex.d.ts.map +1 -1
- package/dist/magic/expr/latex.js +1 -4
- package/dist/magic/expr/latex.js.map +1 -1
- package/dist/magic/expr/text.d.ts +1 -1
- package/dist/magic/expr/text.d.ts.map +1 -1
- package/dist/magic/expr/text.js +1 -1
- package/dist/magic/expr/text.js.map +1 -1
- package/dist/magic/global/dark-mode.d.ts.map +1 -1
- package/dist/magic/global/dark-mode.js +1 -3
- package/dist/magic/global/dark-mode.js.map +1 -1
- 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 +14 -1
- package/dist/magic/global/desmos.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 +23 -0
- package/dist/magic/global/viewport.js.map +1 -1
- package/dist/magic/incantation.d.ts +13 -8
- package/dist/magic/incantation.d.ts.map +1 -1
- package/dist/magic/incantation.js +23 -3
- package/dist/magic/incantation.js.map +1 -1
- package/dist/magic/local/anim.d.ts.map +1 -1
- package/dist/magic/local/anim.js +0 -1
- package/dist/magic/local/anim.js.map +1 -1
- package/dist/magic/local/colour.d.ts +3 -2
- package/dist/magic/local/colour.d.ts.map +1 -1
- package/dist/magic/local/colour.js +3 -3
- package/dist/magic/local/colour.js.map +1 -1
- package/dist/magic/local/label.d.ts +4 -3
- package/dist/magic/local/label.d.ts.map +1 -1
- package/dist/magic/local/label.js +37 -16
- package/dist/magic/local/label.js.map +1 -1
- package/dist/magic/local/line.d.ts +3 -0
- package/dist/magic/local/line.d.ts.map +1 -1
- package/dist/magic/local/line.js +10 -0
- package/dist/magic/local/line.js.map +1 -1
- package/dist/magic/local/slider.d.ts +2 -2
- package/dist/magic/local/slider.d.ts.map +1 -1
- package/dist/magic/local/slider.js +0 -1
- package/dist/magic/local/slider.js.map +1 -1
- package/dist/{compiler/options.d.ts → options.d.ts} +49 -22
- package/dist/options.d.ts.map +1 -0
- package/dist/{compiler/options.js → options.js} +6 -1
- package/dist/options.js.map +1 -0
- package/dist/parser/desmost-parser.d.ts +1 -1
- package/dist/parser/desmost-parser.d.ts.map +1 -1
- package/dist/parser/desmost-parser.js +9 -5
- package/dist/parser/desmost-parser.js.map +1 -1
- package/dist/parser/generic-parser.d.ts +1 -5
- package/dist/parser/generic-parser.d.ts.map +1 -1
- package/dist/parser/generic-parser.js +7 -10
- package/dist/parser/generic-parser.js.map +1 -1
- package/dist/utils.d.ts +1 -0
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +1 -0
- package/dist/utils.js.map +1 -1
- package/package.json +9 -6
- package/src/compiler/compile.ts +8 -4
- package/src/compiler/evaluate.ts +22 -13
- package/src/compiler/format.ts +16 -3
- package/src/compiler/index.ts +0 -1
- package/src/decompiler/decompile.ts +18 -2
- package/src/decompiler/emit.ts +15 -6
- package/src/decompiler/extract.ts +3 -2
- package/src/decompiler/format.ts +1 -1
- package/src/decompiler/readme.md +9 -1
- package/src/desmos.ts +9 -0
- package/src/errors.ts +29 -8
- package/src/index.internal.ts +1 -1
- package/src/index.ts +2 -2
- package/src/magic/.template.ts +25 -16
- package/src/magic/expr/latex.ts +2 -7
- package/src/magic/expr/text.ts +2 -2
- package/src/magic/global/dark-mode.ts +1 -3
- package/src/magic/global/desmos.ts +23 -1
- package/src/magic/global/viewport.ts +40 -1
- package/src/magic/incantation.ts +59 -22
- package/src/magic/local/anim.ts +0 -1
- package/src/magic/local/colour.ts +4 -3
- package/src/magic/local/label.ts +52 -22
- package/src/magic/local/line.ts +20 -3
- package/src/magic/local/slider.ts +2 -3
- package/src/{compiler/options.ts → options.ts} +61 -14
- package/src/parser/desmost-parser.ts +12 -6
- package/src/parser/generic-parser.ts +12 -12
- package/src/parser/readme.md +2 -0
- package/src/utils.ts +3 -0
- package/svelte/desmost.svelte +5 -3
- package/dist/compiler/options.d.ts.map +0 -1
- package/dist/compiler/options.js.map +0 -1
package/dist/errors.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,8HAA8H;AAC9H,eAAO,MAAM,QAAQ,eAAqB,CAAC;AAE3C,kJAAkJ;AAClJ,MAAM,MAAM,OAAO,GAAG,OAAO,QAAQ,GAAG;IAAE,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,MAAM,CAAA;CAAE,CAAC;AAG7E;;;;GAIG;AACH,qBAAa,kBAAmB,SAAQ,KAAK;
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,8HAA8H;AAC9H,eAAO,MAAM,QAAQ,eAAqB,CAAC;AAE3C,kJAAkJ;AAClJ,MAAM,MAAM,OAAO,GAAG,OAAO,QAAQ,GAAG;IAAE,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,MAAM,CAAA;CAAE,CAAC;AAG7E;;;;GAIG;AACH,qBAAa,kBAAmB,SAAQ,KAAK;IAE5C,IAAI,CAAC,EAAE,kBAAkB,CAAC,IAAI,CAAC;CAC/B;AAED,yBAAiB,kBAAkB,CACnC;IACC,UAAiB,IAAI;QAEpB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,UAAU,CAAC,EAAE,MAAM,CAAC;KACpB;IAED,+EAA+E;IAC/E,MAAa,aAAc,SAAQ,kBAAkB;QAClB,IAAI,CAAC,EAAE,IAAI;oBAAjC,GAAG,EAAE,MAAM,EAAW,IAAI,CAAC,EAAE,IAAI,YAAA;KAC7C;IAED,yDAAyD;IACzD,MAAa,YAAa,SAAQ,kBAAkB;QACjB,IAAI,CAAC,EAAE,IAAI;oBAAjC,GAAG,EAAE,MAAM,EAAW,IAAI,CAAC,EAAE,IAAI,YAAA;KAC7C;IAED,qEAAqE;IACrE,MAAa,eAAgB,SAAQ,kBAAkB;QACpB,IAAI,CAAC,EAAE,IAAI;oBAAjC,GAAG,EAAE,MAAM,EAAW,IAAI,CAAC,EAAE,IAAI,YAAA;KAC7C;IAED,+DAA+D;IAC/D,MAAa,WAAY,SAAQ,kBAAkB;QAChB,IAAI,CAAC,EAAE,IAAI;oBAAjC,GAAG,EAAE,MAAM,EAAW,IAAI,CAAC,EAAE,IAAI,YAAA;KAC7C;IAED,4CAA4C;IAC5C,MAAa,kBAAmB,SAAQ,kBAAkB;QACvB,IAAI,CAAC,EAAE,IAAI;oBAAjC,GAAG,EAAE,MAAM,EAAW,IAAI,CAAC,EAAE,IAAI,YAAA;KAC7C;IAED,oDAAoD;IACpD,MAAa,eAAgB,SAAQ,kBAAkB;QACpB,IAAI,CAAC,EAAE,IAAI;oBAAjC,GAAG,EAAE,MAAM,EAAW,IAAI,CAAC,EAAE,IAAI,YAAA;KAC7C;CACD;AAGD,mEAAmE;AACnE,MAAM,MAAM,aAAa,CAAC,MAAM,IAAI,MAAM,GAAG,MAAM,GAAG;IAAE,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,MAAM,CAAA;CAAE,CAAC"}
|
package/dist/errors.js
CHANGED
|
@@ -6,30 +6,67 @@ export const NO_MATCH = Symbol("no-match");
|
|
|
6
6
|
* It's not *literally* unrecoverable in the sense that it will crash the compiler completely, but it means there are no further fallbacks to try.
|
|
7
7
|
*/
|
|
8
8
|
export class UnrecoverableError extends Error {
|
|
9
|
+
info;
|
|
9
10
|
}
|
|
10
11
|
(function (UnrecoverableError) {
|
|
11
12
|
/** The parser unexpectedly reached the end of its entire input source code. */
|
|
12
13
|
class UnexpectedEnd extends UnrecoverableError {
|
|
14
|
+
info;
|
|
15
|
+
constructor(msg, info) {
|
|
16
|
+
super(msg);
|
|
17
|
+
this.info = info;
|
|
18
|
+
this.name = "Unexpected End";
|
|
19
|
+
}
|
|
13
20
|
}
|
|
14
21
|
UnrecoverableError.UnexpectedEnd = UnexpectedEnd;
|
|
15
22
|
/** The parser did not receive input that it expected. */
|
|
16
23
|
class MissingInput extends UnrecoverableError {
|
|
24
|
+
info;
|
|
25
|
+
constructor(msg, info) {
|
|
26
|
+
super(msg);
|
|
27
|
+
this.info = info;
|
|
28
|
+
this.name = "Missing Input";
|
|
29
|
+
}
|
|
17
30
|
}
|
|
18
31
|
UnrecoverableError.MissingInput = MissingInput;
|
|
19
32
|
/** The parser received input that did not match what it expected. */
|
|
20
33
|
class UnexpectedInput extends UnrecoverableError {
|
|
34
|
+
info;
|
|
35
|
+
constructor(msg, info) {
|
|
36
|
+
super(msg);
|
|
37
|
+
this.info = info;
|
|
38
|
+
this.name = "Unexpected Input";
|
|
39
|
+
}
|
|
21
40
|
}
|
|
22
41
|
UnrecoverableError.UnexpectedInput = UnexpectedInput;
|
|
23
42
|
/** The parser received excess input that it did not expect. */
|
|
24
43
|
class ExcessInput extends UnrecoverableError {
|
|
44
|
+
info;
|
|
45
|
+
constructor(msg, info) {
|
|
46
|
+
super(msg);
|
|
47
|
+
this.info = info;
|
|
48
|
+
this.name = "Excess Input";
|
|
49
|
+
}
|
|
25
50
|
}
|
|
26
51
|
UnrecoverableError.ExcessInput = ExcessInput;
|
|
27
52
|
/** An incantation can't be applied here. */
|
|
28
53
|
class IllegalIncantation extends UnrecoverableError {
|
|
54
|
+
info;
|
|
55
|
+
constructor(msg, info) {
|
|
56
|
+
super(msg);
|
|
57
|
+
this.info = info;
|
|
58
|
+
this.name = "Illegal Incantation";
|
|
59
|
+
}
|
|
29
60
|
}
|
|
30
61
|
UnrecoverableError.IllegalIncantation = IllegalIncantation;
|
|
31
62
|
/** An incantation's argument couldn't be parsed. */
|
|
32
63
|
class InvalidArgument extends UnrecoverableError {
|
|
64
|
+
info;
|
|
65
|
+
constructor(msg, info) {
|
|
66
|
+
super(msg);
|
|
67
|
+
this.info = info;
|
|
68
|
+
this.name = "Invalid Argument";
|
|
69
|
+
}
|
|
33
70
|
}
|
|
34
71
|
UnrecoverableError.InvalidArgument = InvalidArgument;
|
|
35
72
|
})(UnrecoverableError || (UnrecoverableError = {}));
|
package/dist/errors.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,8HAA8H;AAC9H,MAAM,CAAC,MAAM,QAAQ,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC;AAM3C;;;;GAIG;AACH,MAAM,OAAO,kBAAmB,SAAQ,KAAK;
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,8HAA8H;AAC9H,MAAM,CAAC,MAAM,QAAQ,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC;AAM3C;;;;GAIG;AACH,MAAM,OAAO,kBAAmB,SAAQ,KAAK;IAE5C,IAAI,CAA2B;CAC/B;AAED,WAAiB,kBAAkB;IASlC,+EAA+E;IAC/E,MAAa,aAAc,SAAQ,kBAAkB;QAClB;QAAlC,YAAY,GAAW,EAAW,IAAW;YAAI,KAAK,CAAC,GAAG,CAAC,CAAC;YAA1B,SAAI,GAAJ,IAAI,CAAO;YAAgB,IAAI,CAAC,IAAI,GAAG,gBAAgB,CAAC;QAAC,CAAC;KAC5F;IAFY,gCAAa,gBAEzB,CAAA;IAED,yDAAyD;IACzD,MAAa,YAAa,SAAQ,kBAAkB;QACjB;QAAlC,YAAY,GAAW,EAAW,IAAW;YAAI,KAAK,CAAC,GAAG,CAAC,CAAC;YAA1B,SAAI,GAAJ,IAAI,CAAO;YAAgB,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC;QAAC,CAAC;KAC3F;IAFY,+BAAY,eAExB,CAAA;IAED,qEAAqE;IACrE,MAAa,eAAgB,SAAQ,kBAAkB;QACpB;QAAlC,YAAY,GAAW,EAAW,IAAW;YAAI,KAAK,CAAC,GAAG,CAAC,CAAC;YAA1B,SAAI,GAAJ,IAAI,CAAO;YAAgB,IAAI,CAAC,IAAI,GAAG,kBAAkB,CAAC;QAAC,CAAC;KAC9F;IAFY,kCAAe,kBAE3B,CAAA;IAED,+DAA+D;IAC/D,MAAa,WAAY,SAAQ,kBAAkB;QAChB;QAAlC,YAAY,GAAW,EAAW,IAAW;YAAI,KAAK,CAAC,GAAG,CAAC,CAAC;YAA1B,SAAI,GAAJ,IAAI,CAAO;YAAgB,IAAI,CAAC,IAAI,GAAG,cAAc,CAAC;QAAC,CAAC;KAC1F;IAFY,8BAAW,cAEvB,CAAA;IAED,4CAA4C;IAC5C,MAAa,kBAAmB,SAAQ,kBAAkB;QACvB;QAAlC,YAAY,GAAW,EAAW,IAAW;YAAI,KAAK,CAAC,GAAG,CAAC,CAAC;YAA1B,SAAI,GAAJ,IAAI,CAAO;YAAgB,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAC;QAAC,CAAC;KACjG;IAFY,qCAAkB,qBAE9B,CAAA;IAED,oDAAoD;IACpD,MAAa,eAAgB,SAAQ,kBAAkB;QACpB;QAAlC,YAAY,GAAW,EAAW,IAAW;YAAI,KAAK,CAAC,GAAG,CAAC,CAAC;YAA1B,SAAI,GAAJ,IAAI,CAAO;YAAgB,IAAI,CAAC,IAAI,GAAG,kBAAkB,CAAC;QAAC,CAAC;KAC9F;IAFY,kCAAe,kBAE3B,CAAA;AACF,CAAC,EAtCgB,kBAAkB,KAAlB,kBAAkB,QAsClC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { compile
|
|
2
|
-
export {
|
|
1
|
+
export { compile } from "./compiler/index.js";
|
|
2
|
+
export type { DesmostOptions } from "./options.js";
|
|
3
3
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,YAAY,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC"}
|
package/dist/index.internal.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { DEFAULT_OPTIONS } from "./options.js";
|
|
2
2
|
export type { DesmostDebug } from "./compiler/compile.js";
|
|
3
3
|
export { Ast } from "./parser/index.js";
|
|
4
4
|
export { desmos_to_ast, ast_to_source } from "./decompiler/decompile.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.internal.d.ts","sourceRoot":"","sources":["../src/index.internal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.internal.d.ts","sourceRoot":"","sources":["../src/index.internal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,YAAY,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEvD,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAE/B,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC"}
|
package/dist/index.internal.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { DEFAULT_OPTIONS } from "./options.js";
|
|
2
2
|
export { Ast } from "./parser/index.js";
|
|
3
3
|
export { desmos_to_ast, ast_to_source } from "./decompiler/decompile.js";
|
|
4
4
|
//# sourceMappingURL=index.internal.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.internal.js","sourceRoot":"","sources":["../src/index.internal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.internal.js","sourceRoot":"","sources":["../src/index.internal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAG5C,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAE/B,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC"}
|
package/dist/index.js
CHANGED
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -4,7 +4,6 @@ export declare class LatexIncantation extends ArgIncantation<EXPR> {
|
|
|
4
4
|
readonly identifier = "latex";
|
|
5
5
|
readonly requires_arg = true;
|
|
6
6
|
readonly arg_type = Incantation.ArgType.LATEX;
|
|
7
|
-
apply(target: Desmos.ExpressionState, data: string):
|
|
8
|
-
evaluate_arg(data: string): string;
|
|
7
|
+
apply(target: Desmos.ExpressionState, data: string): asserts target is Desmos.Expression;
|
|
9
8
|
}
|
|
10
9
|
//# 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,qBAAa,gBAAiB,SAAQ,cAAc,CAAC,IAAI,CAAC;IAEzD,SAAkB,WAAW,+EACiD;IAE9E,SAAkB,UAAU,WAAY;IACxC,SAAkB,YAAY,QAAO;IACrC,SAAkB,QAAQ,6BAAgC;IAE1D,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,eAAe,EAAE,IAAI,EAAE,MAAM,GAAG,
|
|
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,qBAAa,gBAAiB,SAAQ,cAAc,CAAC,IAAI,CAAC;IAEzD,SAAkB,WAAW,+EACiD;IAE9E,SAAkB,UAAU,WAAY;IACxC,SAAkB,YAAY,QAAO;IACrC,SAAkB,QAAQ,6BAAgC;IAE1D,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,eAAe,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,MAAM,CAAC,UAAU;CAMxF"}
|
package/dist/magic/expr/latex.js
CHANGED
|
@@ -6,11 +6,8 @@ export class LatexIncantation extends ArgIncantation {
|
|
|
6
6
|
arg_type = Incantation.ArgType.LATEX;
|
|
7
7
|
apply(target, data) {
|
|
8
8
|
target.type = "expression";
|
|
9
|
-
// @ts-expect-error:
|
|
9
|
+
// @ts-expect-error: previous assignment type-narrows
|
|
10
10
|
target.latex = data === "" ? " " : data;
|
|
11
11
|
}
|
|
12
|
-
evaluate_arg(data) {
|
|
13
|
-
return data;
|
|
14
|
-
}
|
|
15
12
|
}
|
|
16
13
|
//# 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,OAAO,gBAAiB,SAAQ,cAAoB;IAEvC,WAAW,GAC1B,2EAA2E,CAAA;IAE5D,UAAU,GAAK,OAAO,CAAA;IACtB,YAAY,GAAG,IAAI,CAAA;IACnB,QAAQ,GAAO,WAAW,CAAC,OAAO,CAAC,KAAK,CAAA;IAE1D,KAAK,CAAC,MAA8B,EAAE,IAAY;QAEjD,MAAM,CAAC,IAAI,GAAG,YAAY,CAAC;QAC3B,
|
|
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,OAAO,gBAAiB,SAAQ,cAAoB;IAEvC,WAAW,GAC1B,2EAA2E,CAAA;IAE5D,UAAU,GAAK,OAAO,CAAA;IACtB,YAAY,GAAG,IAAI,CAAA;IACnB,QAAQ,GAAO,WAAW,CAAC,OAAO,CAAC,KAAK,CAAA;IAE1D,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;CACD"}
|
|
@@ -5,6 +5,6 @@ export declare class TextIncantation extends ArgIncantation<EXPR> {
|
|
|
5
5
|
readonly alias = "note";
|
|
6
6
|
readonly requires_arg = true;
|
|
7
7
|
readonly arg_type = Incantation.ArgType.STRING;
|
|
8
|
-
apply(target: Desmos.ExpressionState, data: string):
|
|
8
|
+
apply(target: Desmos.ExpressionState, data: string): asserts target is Desmos.Note;
|
|
9
9
|
}
|
|
10
10
|
//# 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,qBAAa,eAAgB,SAAQ,cAAc,CAAC,IAAI,CAAC;IAExD,SAAkB,WAAW,yEACiC;IAE9D,SAAkB,UAAU,UAAW;IACvC,SAAkB,KAAK,UAAgB;IACvC,SAAkB,YAAY,QAAO;IACrC,SAAkB,QAAQ,8BAAiC;IAElD,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,eAAe,EAAE,IAAI,EAAE,MAAM;
|
|
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,qBAAa,eAAgB,SAAQ,cAAc,CAAC,IAAI,CAAC;IAExD,SAAkB,WAAW,yEACiC;IAE9D,SAAkB,UAAU,UAAW;IACvC,SAAkB,KAAK,UAAgB;IACvC,SAAkB,YAAY,QAAO;IACrC,SAAkB,QAAQ,8BAAiC;IAElD,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,eAAe,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,MAAM,CAAC,IAAI;CAM3F"}
|
package/dist/magic/expr/text.js
CHANGED
|
@@ -7,7 +7,7 @@ export class TextIncantation extends ArgIncantation {
|
|
|
7
7
|
arg_type = Incantation.ArgType.STRING;
|
|
8
8
|
apply(target, data) {
|
|
9
9
|
target.type = "text";
|
|
10
|
-
// @ts-expect-error:
|
|
10
|
+
// @ts-expect-error: previous assignment type-narrows
|
|
11
11
|
target.text = data;
|
|
12
12
|
}
|
|
13
13
|
}
|
|
@@ -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,OAAO,eAAgB,SAAQ,cAAoB;IAEtC,WAAW,GAC1B,2DAA2D,CAAA;IAE5C,UAAU,GAAK,MAAM,CAAA;IACrB,KAAK,GAAU,MAAM,CAAA;IACrB,YAAY,GAAG,IAAI,CAAA;IACnB,QAAQ,GAAO,WAAW,CAAC,OAAO,CAAC,MAAM,CAAA;IAElD,KAAK,CAAC,MAA8B,EAAE,IAAY;QAE1D,MAAM,CAAC,IAAI,GAAG,MAAM,CAAC;QACrB,
|
|
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,OAAO,eAAgB,SAAQ,cAAoB;IAEtC,WAAW,GAC1B,2DAA2D,CAAA;IAE5C,UAAU,GAAK,MAAM,CAAA;IACrB,KAAK,GAAU,MAAM,CAAA;IACrB,YAAY,GAAG,IAAI,CAAA;IACnB,QAAQ,GAAO,WAAW,CAAC,OAAO,CAAC,MAAM,CAAA;IAElD,KAAK,CAAC,MAA8B,EAAE,IAAY;QAE1D,MAAM,CAAC,IAAI,GAAG,MAAM,CAAC;QACrB,qDAAqD;QACrD,MAAM,CAAC,IAAI,GAAG,IAAI,CAAC;IACpB,CAAC;CACD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dark-mode.d.ts","sourceRoot":"","sources":["../../../src/magic/global/dark-mode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,KAAK,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAG1D,qBAAa,mBAAoB,SAAQ,WAAW,CAAC,MAAM,CAAC;IAE3D,SAAkB,WAAW,qEACuC;IAEpE,SAAkB,UAAU,UAAS;IAErC,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,UAAU;
|
|
1
|
+
{"version":3,"file":"dark-mode.d.ts","sourceRoot":"","sources":["../../../src/magic/global/dark-mode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,KAAK,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAG1D,qBAAa,mBAAoB,SAAQ,WAAW,CAAC,MAAM,CAAC;IAE3D,SAAkB,WAAW,qEACuC;IAEpE,SAAkB,UAAU,UAAS;IAErC,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,UAAU;CAI/B"}
|
|
@@ -3,9 +3,7 @@ export class DarkModeIncantation extends Incantation {
|
|
|
3
3
|
description = "Enable dark mode for the calculator, which inverts all colours.";
|
|
4
4
|
identifier = "dark";
|
|
5
5
|
apply(target) {
|
|
6
|
-
target.updateSettings({
|
|
7
|
-
invertedColors: true,
|
|
8
|
-
});
|
|
6
|
+
target.updateSettings({ invertedColors: true });
|
|
9
7
|
}
|
|
10
8
|
}
|
|
11
9
|
//# sourceMappingURL=dark-mode.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dark-mode.js","sourceRoot":"","sources":["../../../src/magic/global/dark-mode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAe,MAAM,gBAAgB,CAAC;AAG1D,MAAM,OAAO,mBAAoB,SAAQ,WAAmB;IAEzC,WAAW,GAC1B,iEAAiE,CAAA;IAElD,UAAU,GAAG,MAAM,CAAA;IAErC,KAAK,CAAC,MAAyB;QAE9B,MAAM,CAAC,cAAc,CAAC
|
|
1
|
+
{"version":3,"file":"dark-mode.js","sourceRoot":"","sources":["../../../src/magic/global/dark-mode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAe,MAAM,gBAAgB,CAAC;AAG1D,MAAM,OAAO,mBAAoB,SAAQ,WAAmB;IAEzC,WAAW,GAC1B,iEAAiE,CAAA;IAElD,UAAU,GAAG,MAAM,CAAA;IAErC,KAAK,CAAC,MAAyB;QAE9B,MAAM,CAAC,cAAc,CAAC,EAAE,cAAc,EAAE,IAAI,EAAE,CAAC,CAAC;IACjD,CAAC;CACD"}
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { Incantation, ArgIncantation, type GLOBAL } from "../incantation.js";
|
|
2
|
+
import { type Unrecoverable } from "../../errors.js";
|
|
3
|
+
import type { DesmostOptions } from "../../options.js";
|
|
2
4
|
type DesmosSettings = Desmos.GraphConfiguration & Desmos.GraphSettings;
|
|
3
5
|
export declare class DesmosIncantation extends ArgIncantation<GLOBAL> {
|
|
4
|
-
readonly description = "
|
|
6
|
+
readonly description = "Tweak calculator settings via `Calculator.updateSettings()`.";
|
|
5
7
|
readonly identifier = "desmos";
|
|
6
8
|
readonly requires_arg = false;
|
|
7
9
|
readonly arg_type = Incantation.ArgType.OBJECT;
|
|
8
10
|
apply(target: Desmos.Calculator, data?: DesmosSettings): void;
|
|
11
|
+
evaluate_arg(raw: string, options: DesmostOptions): Unrecoverable<DesmosSettings>;
|
|
9
12
|
}
|
|
10
13
|
export {};
|
|
11
14
|
//# 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;
|
|
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,EAAsB,KAAK,aAAa,EAAE,MAAM,cAAc,CAAC;AACtE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAGpD,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,CACb,MAAM,EAAE,MAAM,CAAC,UAAU,EACzB,IAAI,CAAC,EAAE,cAAc,GACnB,IAAI;IAOE,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,GAAG,aAAa,CAAC,cAAc,CAAC;CAkB1F"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Incantation, ArgIncantation } from "../incantation.js";
|
|
2
|
+
import { UnrecoverableError } from "../../errors.js";
|
|
2
3
|
export class DesmosIncantation extends ArgIncantation {
|
|
3
|
-
description = "
|
|
4
|
+
description = "Tweak calculator settings via `Calculator.updateSettings()`.";
|
|
4
5
|
identifier = "desmos";
|
|
5
6
|
requires_arg = false;
|
|
6
7
|
arg_type = Incantation.ArgType.OBJECT;
|
|
@@ -9,5 +10,17 @@ export class DesmosIncantation extends ArgIncantation {
|
|
|
9
10
|
target.updateSettings(data);
|
|
10
11
|
}
|
|
11
12
|
}
|
|
13
|
+
evaluate_arg(raw, options) {
|
|
14
|
+
let out = super.evaluate_arg(raw, options);
|
|
15
|
+
if (options.check_args) {
|
|
16
|
+
if (Object.keys(out).length === 0) {
|
|
17
|
+
throw new UnrecoverableError.MissingInput(`/${this.identifier} received empty settings`, {
|
|
18
|
+
hint: `Provide settings like \`/desmos{expressionsCollapsed: true}\``,
|
|
19
|
+
note: `Use just /desmos (without \`{}\`) if you want it as an indicator`,
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return out;
|
|
24
|
+
}
|
|
12
25
|
}
|
|
13
26
|
//# 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;AAE1E,OAAO,EAAE,kBAAkB,EAAsB,MAAM,cAAc,CAAC;AAOtE,MAAM,OAAO,iBAAkB,SAAQ,cAAsB;IAE1C,WAAW,GAC1B,8DAA8D,CAAA;IAE/C,UAAU,GAAK,QAAQ,CAAA;IACvB,YAAY,GAAG,KAAK,CAAA;IACpB,QAAQ,GAAO,WAAW,CAAC,OAAO,CAAC,MAAM,CAAA;IAElD,KAAK,CACb,MAAyB,EACzB,IAAqB;QAGrB,IAAI,IAAI,IAAI,SAAS,EAAE,CAAC;YACvB,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;QAC7B,CAAC;IACF,CAAC;IAEQ,YAAY,CAAC,GAAW,EAAE,OAAuB;QAEzD,IAAI,GAAG,GAAG,KAAK,CAAC,YAAY,CAAC,GAAG,EAAE,OAAO,CAAmB,CAAC;QAE7D,IAAI,OAAO,CAAC,UAAU,EAAE,CAAC;YACxB,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBACnC,MAAM,IAAI,kBAAkB,CAAC,YAAY,CACxC,IAAI,IAAI,CAAC,UAAU,0BAA0B,EAC7C;oBACC,IAAI,EAAE,+DAA+D;oBACrE,IAAI,EAAE,kEAAkE;iBACxE,CACD,CAAC;YACH,CAAC;QACF,CAAC;QAED,OAAO,GAAG,CAAC;IACZ,CAAC;CACD"}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { Incantation, ArgIncantation, type GLOBAL } from "../incantation.js";
|
|
2
|
+
import { type Unrecoverable } from "../../errors.js";
|
|
3
|
+
import type { DesmostOptions } from "../../options.js";
|
|
2
4
|
interface ViewportBounds {
|
|
3
5
|
left?: number;
|
|
4
6
|
right?: number;
|
|
@@ -11,6 +13,7 @@ export declare class ViewportIncantation extends ArgIncantation<GLOBAL> {
|
|
|
11
13
|
readonly requires_arg = true;
|
|
12
14
|
readonly arg_type = Incantation.ArgType.OBJECT;
|
|
13
15
|
apply(target: Desmos.Calculator, data: ViewportBounds): void;
|
|
16
|
+
evaluate_arg(raw: string, options: DesmostOptions): Unrecoverable<ViewportBounds>;
|
|
14
17
|
}
|
|
15
18
|
export {};
|
|
16
19
|
//# 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;
|
|
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,EAAsB,KAAK,aAAa,EAAE,MAAM,cAAc,CAAC;AACtE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAGpD,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,aAAa,CAAC,cAAc,CAAC;CAiC1F"}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { Incantation, ArgIncantation } from "../incantation.js";
|
|
2
|
+
import { UnrecoverableError } from "../../errors.js";
|
|
3
|
+
const VALID_KEYS = ["left", "right", "bottom", "top"];
|
|
2
4
|
export class ViewportIncantation extends ArgIncantation {
|
|
3
5
|
description = "Set the bounds of the viewport via `Calculator.setMathBounds()`.";
|
|
4
6
|
identifier = "viewport";
|
|
@@ -9,5 +11,26 @@ export class ViewportIncantation extends ArgIncantation {
|
|
|
9
11
|
let { left = existing.left, right = existing.right, bottom = existing.bottom, top = existing.top, } = data;
|
|
10
12
|
target.setMathBounds({ left, right, bottom, top });
|
|
11
13
|
}
|
|
14
|
+
evaluate_arg(raw, options) {
|
|
15
|
+
let out = super.evaluate_arg(raw, options);
|
|
16
|
+
if (options.check_args) {
|
|
17
|
+
if (Object.keys(out).length === 0) {
|
|
18
|
+
throw new UnrecoverableError.InvalidArgument(`/${this.identifier} received empty viewport bounds`, {
|
|
19
|
+
hint: `Provide bounds like \`/viewport{left: -8, right: 8}\``,
|
|
20
|
+
note: `Missing bounds are kept as their defaults`,
|
|
21
|
+
flagged_by: "check_args",
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
let invalid_keys = Object.keys(out).filter(key => !VALID_KEYS.includes(key));
|
|
25
|
+
if (invalid_keys.length > 0) {
|
|
26
|
+
let plural = invalid_keys.length > 1 ? "fields" : "field";
|
|
27
|
+
throw new UnrecoverableError.InvalidArgument(`/${this.identifier} received invalid ${plural}: [${invalid_keys.join(", ")}]`, {
|
|
28
|
+
hint: `Valid fields are: [${VALID_KEYS.join(", ")}]`,
|
|
29
|
+
flagged_by: "check_args",
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return out;
|
|
34
|
+
}
|
|
12
35
|
}
|
|
13
36
|
//# sourceMappingURL=viewport.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"viewport.js","sourceRoot":"","sources":["../../../src/magic/global/viewport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,cAAc,EAAe,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"viewport.js","sourceRoot":"","sources":["../../../src/magic/global/viewport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,cAAc,EAAe,MAAM,gBAAgB,CAAC;AAE1E,OAAO,EAAE,kBAAkB,EAAsB,MAAM,cAAc,CAAC;AAUtE,MAAM,UAAU,GAAG,CAAC,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC;AAGtD,MAAM,OAAO,mBAAoB,SAAQ,cAAsB;IAE5C,WAAW,GAC1B,kEAAkE,CAAA;IAEnD,UAAU,GAAK,UAAU,CAAA;IACzB,YAAY,GAAG,IAAI,CAAA;IACnB,QAAQ,GAAO,WAAW,CAAC,OAAO,CAAC,MAAM,CAAA;IAElD,KAAK,CAAC,MAAyB,EAAE,IAAoB;QAE7D,IAAI,QAAQ,GAAG,MAAM,CAAC,gBAAgB,CAAC,eAAe,CAAC;QAEvD,IAAI,EACH,IAAI,GAAK,QAAQ,CAAC,IAAI,EACtB,KAAK,GAAI,QAAQ,CAAC,KAAK,EACvB,MAAM,GAAG,QAAQ,CAAC,MAAM,EACxB,GAAG,GAAM,QAAQ,CAAC,GAAG,GACrB,GAAG,IAAI,CAAC;QAET,MAAM,CAAC,aAAa,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC;IACpD,CAAC;IAEQ,YAAY,CAAC,GAAW,EAAE,OAAuB;QAEzD,IAAI,GAAG,GAAG,KAAK,CAAC,YAAY,CAAC,GAAG,EAAE,OAAO,CAAmB,CAAC;QAE7D,IAAI,OAAO,CAAC,UAAU,EAAE,CAAC;YACxB,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBACnC,MAAM,IAAI,kBAAkB,CAAC,eAAe,CAC3C,IAAI,IAAI,CAAC,UAAU,iCAAiC,EACpD;oBACC,IAAI,EAAE,uDAAuD;oBAC7D,IAAI,EAAE,2CAA2C;oBACjD,UAAU,EAAE,YAAY;iBACxB,CACD,CAAC;YACH,CAAC;YAED,IAAI,YAAY,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,UAAU,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC;YAE7E,IAAI,YAAY,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBAC7B,IAAI,MAAM,GAAG,YAAY,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC;gBAE1D,MAAM,IAAI,kBAAkB,CAAC,eAAe,CAC3C,IAAI,IAAI,CAAC,UAAU,qBAAqB,MAAM,MAAM,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAC9E;oBACC,IAAI,EAAE,sBAAsB,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG;oBACpD,UAAU,EAAE,YAAY;iBACxB,CACD,CAAC;YACH,CAAC;QACF,CAAC;QAED,OAAO,GAAG,CAAC;IACZ,CAAC;CACD"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { DesmostOptions } from "../options.js";
|
|
2
|
+
import { UnrecoverableError, type Unrecoverable } from "../errors.js";
|
|
2
3
|
/**
|
|
3
4
|
* 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.
|
|
4
5
|
*
|
|
@@ -40,9 +41,19 @@ export declare abstract class ArgIncantation<Effect extends Incantation.Effect =
|
|
|
40
41
|
* ## Notes
|
|
41
42
|
*
|
|
42
43
|
* Child incantation classes should override this method, though the defaults should cover most cases (except `ArgType.ENUM`).
|
|
44
|
+
*
|
|
45
|
+
* Validity checks for missing or invalid values, incorrect types, and unknown fields should be performed here, so that `.apply()` can assume the data it receives is guaranteed to be valid.
|
|
43
46
|
*/
|
|
44
|
-
evaluate_arg(raw: string): Unrecoverable<unknown>;
|
|
47
|
+
evaluate_arg(raw: string, options: DesmostOptions): Unrecoverable<unknown>;
|
|
48
|
+
protected require_nonempty(arg: object, msg?: string, info?: UnrecoverableError.Info): Unrecoverable<void>;
|
|
49
|
+
protected require_known(arg: object, valid_fields: string[], info?: UnrecoverableError.Info): Unrecoverable<void>;
|
|
45
50
|
}
|
|
51
|
+
/** An incantation that affects the entire Desmos calculator state, like `/desmos` or `/viewport`. */
|
|
52
|
+
export type GLOBAL = Incantation.Effect.GLOBAL;
|
|
53
|
+
/** An incantation that affects only the expression immediately following it, like `/hide` or `/slider`. */
|
|
54
|
+
export type LOCAL = Incantation.Effect.LOCAL;
|
|
55
|
+
/** An incantation that produces an expression, like `/latex` or `/text`. */
|
|
56
|
+
export type EXPR = Incantation.Effect.EXPR;
|
|
46
57
|
export declare namespace Incantation {
|
|
47
58
|
/** The kind of effect an incantation produces - it either modifies only one block, or modifies the calculator as a whole. */
|
|
48
59
|
enum Effect {
|
|
@@ -65,10 +76,4 @@ export declare namespace Incantation {
|
|
|
65
76
|
OBJECT = "Object"
|
|
66
77
|
}
|
|
67
78
|
}
|
|
68
|
-
/** An incantation that affects the entire Desmos calculator state, like `/desmos` or `/viewport`. */
|
|
69
|
-
export type GLOBAL = Incantation.Effect.GLOBAL;
|
|
70
|
-
/** An incantation that affects only the expression immediately following it, like `/hide` or `/slider`. */
|
|
71
|
-
export type LOCAL = Incantation.Effect.LOCAL;
|
|
72
|
-
/** An incantation that produces an expression, like `/latex` or `/text`. */
|
|
73
|
-
export type EXPR = Incantation.Effect.EXPR;
|
|
74
79
|
//# sourceMappingURL=incantation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"incantation.d.ts","sourceRoot":"","sources":["../../src/magic/incantation.ts"],"names":[],"mappings":"
|
|
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,kBAAkB,EAAE,KAAK,aAAa,EAAE,MAAM,WAAW,CAAC;AAGnE;;;;;;;;;;;;GAYG;AACH,8BAAsB,WAAW,CAChC,MAAM,SAAS,WAAW,CAAC,MAAM,GAAG,WAAW,CAAC,MAAM;IAGtD,kEAAkE;IAClE,QAAQ,CAAC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;IAErC,2FAA2F;IAC3F,QAAQ,CAAC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;IAEpC,6EAA6E;IAC7E,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAA;IAGvB,0FAA0F;IAC1F,QAAQ,CAAC,KAAK,CACb,MAAM,EAAE,MAAM,SAAS,MAAM,GAAG,MAAM,CAAC,UAAU,GAAG,MAAM,CAAC,eAAe,EAC1E,IAAI,CAAC,EAAE,OAAO,GACZ,IAAI;IAEP,4EAA4E;IAC5E,SAAS,CAAC,iBAAiB,CAAC,CAAC,SAAS,MAAM,CAAC,eAAe,CAAC,MAAM,CAAC,EACnE,MAAM,EAAE,OAAO,EACf,QAAQ,EAAE,CAAC,GACT,OAAO,CAAC,MAAM,IAAI,CAAC;CAStB;AAGD;;GAEG;AACH,8BAAsB,cAAc,CACnC,MAAM,SAAS,WAAW,CAAC,MAAM,GAAG,WAAW,CAAC,MAAM,CAEtD,SAAQ,WAAW,CAAC,MAAM,CAAC;IAE3B,qEAAqE;IACrE,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAO;IAErC,0DAA0D;IAC1D,QAAQ,CAAC,QAAQ,CAAC,QAAQ,EAAE,WAAW,CAAC,OAAO,CAAA;IAG/C;;;;;;;;;;OAUG;IACH,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,GAAG,aAAa,CAAC,OAAO,CAAC;IAqB1E,SAAS,CAAC,gBAAgB,CACzB,GAAG,EAAE,MAAM,EACX,GAAG,CAAC,EAAE,MAAM,EACZ,IAAI,CAAC,EAAE,kBAAkB,CAAC,IAAI,GAC5B,aAAa,CAAC,IAAI,CAAC;IAUtB,SAAS,CAAC,aAAa,CACtB,GAAG,EAAE,MAAM,EACX,YAAY,EAAE,MAAM,EAAE,EACtB,IAAI,CAAC,EAAE,kBAAkB,CAAC,IAAI,GAC5B,aAAa,CAAC,IAAI,CAAC;CAetB;AAGD,qGAAqG;AACrG,MAAM,MAAM,MAAM,GAAG,WAAW,CAAC,MAAM,CAAC,MAAM,CAAC;AAE/C,2GAA2G;AAC3G,MAAM,MAAM,KAAK,GAAG,WAAW,CAAC,MAAM,CAAC,KAAK,CAAC;AAE7C,4EAA4E;AAC5E,MAAM,MAAM,IAAI,GAAG,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC;AAG3C,yBAAiB,WAAW,CAC5B;IACC,6HAA6H;IAC7H,KAAY,MAAM;QAEjB,qGAAqG;QACrG,MAAM,IAAA;QAEN,2GAA2G;QAC3G,KAAK,IAAA;QAEL,4EAA4E;QAC5E,IAAI,IAAA;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"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import Json5 from "json5";
|
|
2
|
+
import dedent from "dedent";
|
|
2
3
|
import { UnrecoverableError } 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.
|
|
@@ -19,7 +20,7 @@ export class Incantation {
|
|
|
19
20
|
/** Error if the `actual` type of the given expression is not `required`. */
|
|
20
21
|
require_expr_type(actual, required) {
|
|
21
22
|
if ((actual ?? "expression") !== required) {
|
|
22
|
-
throw new UnrecoverableError.IllegalIncantation(`/${this.identifier} can only applied to ${required === "expression" ? "latex" : required}
|
|
23
|
+
throw new UnrecoverableError.IllegalIncantation(`/${this.identifier} can only applied to ${required === "expression" ? "latex" : required} blocks, but target block has type: ${actual}`);
|
|
23
24
|
}
|
|
24
25
|
}
|
|
25
26
|
}
|
|
@@ -37,12 +38,15 @@ export class ArgIncantation extends Incantation {
|
|
|
37
38
|
* ## Notes
|
|
38
39
|
*
|
|
39
40
|
* Child incantation classes should override this method, though the defaults should cover most cases (except `ArgType.ENUM`).
|
|
41
|
+
*
|
|
42
|
+
* Validity checks for missing or invalid values, incorrect types, and unknown fields should be performed here, so that `.apply()` can assume the data it receives is guaranteed to be valid.
|
|
40
43
|
*/
|
|
41
|
-
evaluate_arg(raw) {
|
|
44
|
+
evaluate_arg(raw, options) {
|
|
42
45
|
switch (this.arg_type) {
|
|
43
|
-
case Incantation.ArgType.STRING: return raw;
|
|
44
46
|
case Incantation.ArgType.LATEX: return raw;
|
|
45
47
|
case Incantation.ArgType.ENUM: return raw;
|
|
48
|
+
case Incantation.ArgType.STRING:
|
|
49
|
+
return (options.dedent_text) ? dedent(raw) : raw.trim();
|
|
46
50
|
case Incantation.ArgType.OBJECT: {
|
|
47
51
|
try {
|
|
48
52
|
return Json5.parse(`{${raw}}`);
|
|
@@ -54,6 +58,22 @@ export class ArgIncantation extends Incantation {
|
|
|
54
58
|
}
|
|
55
59
|
}
|
|
56
60
|
}
|
|
61
|
+
require_nonempty(arg, msg, info) {
|
|
62
|
+
if (Object.entries(arg).length === 0) {
|
|
63
|
+
throw new UnrecoverableError.MissingInput(msg ?? `/${this.identifier} received an empty argument {}`, info);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
require_known(arg, valid_fields, info) {
|
|
67
|
+
// TODO accumulate
|
|
68
|
+
for (let field of Object.keys(arg)) {
|
|
69
|
+
if (!valid_fields.includes(field)) {
|
|
70
|
+
throw new UnrecoverableError.InvalidArgument(`/${this.identifier} received invalid field: ${field}`, {
|
|
71
|
+
hint: `Valid fields are [${valid_fields.join(", ")}]`,
|
|
72
|
+
...info,
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
57
77
|
}
|
|
58
78
|
(function (Incantation) {
|
|
59
79
|
/** 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;
|
|
1
|
+
{"version":3,"file":"incantation.js","sourceRoot":"","sources":["../../src/magic/incantation.ts"],"names":[],"mappings":"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"}
|
|
@@ -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;AAGzD,qBAAa,eAAgB,SAAQ,WAAW,CAAC,KAAK,CAAC;IAEtD,SAAkB,WAAW,oCACM;IAEnC,SAAkB,UAAU,UAAS;IAE5B,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,eAAe;
|
|
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;AAGzD,qBAAa,eAAgB,SAAQ,WAAW,CAAC,KAAK,CAAC;IAEtD,SAAkB,WAAW,oCACM;IAEnC,SAAkB,UAAU,UAAS;IAE5B,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,eAAe;CAK7C"}
|
package/dist/magic/local/anim.js
CHANGED
|
@@ -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;AAGzD,MAAM,OAAO,eAAgB,SAAQ,WAAkB;IAEpC,WAAW,GAC1B,gCAAgC,CAAA;IAEjB,UAAU,GAAG,MAAM,CAAA;IAE5B,KAAK,CAAC,MAA8B;QAE5C,KAAK,CAAC,iBAAiB,CAAC,MAAM,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;QACnD,
|
|
1
|
+
{"version":3,"file":"anim.js","sourceRoot":"","sources":["../../../src/magic/local/anim.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAc,MAAM,gBAAgB,CAAC;AAGzD,MAAM,OAAO,eAAgB,SAAQ,WAAkB;IAEpC,WAAW,GAC1B,gCAAgC,CAAA;IAEjB,UAAU,GAAG,MAAM,CAAA;IAE5B,KAAK,CAAC,MAA8B;QAE5C,KAAK,CAAC,iBAAiB,CAAC,MAAM,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;QACnD,MAAM,CAAC,OAAO,GAAG,IAAI,CAAC;IACvB,CAAC;CACD"}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { Incantation, ArgIncantation, type LOCAL } from "../incantation.js";
|
|
2
2
|
import { DesmosColour } from "../../desmos.js";
|
|
3
|
+
import type { DesmostOptions } from "../../options.js";
|
|
3
4
|
export declare class ColourIncantation extends ArgIncantation<LOCAL> {
|
|
4
|
-
readonly description = "";
|
|
5
|
+
readonly description = "Change the colour of a rendered expression, such as a line, region, polygon, etc.";
|
|
5
6
|
readonly identifier = "color";
|
|
6
7
|
readonly alias = "colour";
|
|
7
8
|
readonly requires_arg = true;
|
|
8
9
|
readonly arg_type = Incantation.ArgType.ENUM;
|
|
9
10
|
apply(target: Desmos.ExpressionState, data: DesmosColour): void;
|
|
10
|
-
evaluate_arg(data: string): DesmosColour;
|
|
11
|
+
evaluate_arg(data: string, options: DesmostOptions): DesmosColour;
|
|
11
12
|
}
|
|
12
13
|
//# 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,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAGpD,qBAAa,iBAAkB,SAAQ,cAAc,CAAC,KAAK,CAAC;IAE3D,SAAkB,WAAW,uFACyD;IAEtF,SAAkB,UAAU,WAAY;IACxC,SAAkB,KAAK,YAAkB;IACzC,SAAkB,YAAY,QAAO;IACrC,SAAkB,QAAQ,4BAA+B;IAEhD,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,eAAe,EAAE,IAAI,EAAE,YAAY;IAMxD,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,GAAG,YAAY;CAe1E"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Incantation, ArgIncantation } from "../incantation.js";
|
|
2
|
-
import { UnrecoverableError } from "../../errors.js";
|
|
3
2
|
import { DesmosColour } from "../../desmos.js";
|
|
3
|
+
import { UnrecoverableError } from "../../errors.js";
|
|
4
4
|
export class ColourIncantation extends ArgIncantation {
|
|
5
|
-
description = "";
|
|
5
|
+
description = "Change the colour of a rendered expression, such as a line, region, polygon, etc.";
|
|
6
6
|
identifier = "color";
|
|
7
7
|
alias = "colour";
|
|
8
8
|
requires_arg = true;
|
|
@@ -11,7 +11,7 @@ export class ColourIncantation extends ArgIncantation {
|
|
|
11
11
|
super.require_expr_type(target.type, "expression");
|
|
12
12
|
target.color = data;
|
|
13
13
|
}
|
|
14
|
-
evaluate_arg(data) {
|
|
14
|
+
evaluate_arg(data, options) {
|
|
15
15
|
switch (data.trim().toUpperCase()) {
|
|
16
16
|
case "RED": return DesmosColour.RED;
|
|
17
17
|
case "BLUE": return DesmosColour.BLUE;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"colour.js","sourceRoot":"","sources":["../../../src/magic/local/colour.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,cAAc,EAAc,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"colour.js","sourceRoot":"","sources":["../../../src/magic/local/colour.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,cAAc,EAAc,MAAM,gBAAgB,CAAC;AAEzE,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAIlD,MAAM,OAAO,iBAAkB,SAAQ,cAAqB;IAEzC,WAAW,GAC1B,mFAAmF,CAAA;IAEpE,UAAU,GAAK,OAAO,CAAA;IACtB,KAAK,GAAU,QAAQ,CAAA;IACvB,YAAY,GAAG,IAAI,CAAA;IACnB,QAAQ,GAAO,WAAW,CAAC,OAAO,CAAC,IAAI,CAAA;IAEhD,KAAK,CAAC,MAA8B,EAAE,IAAkB;QAEhE,KAAK,CAAC,iBAAiB,CAAC,MAAM,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;QACnD,MAAM,CAAC,KAAK,GAAG,IAAI,CAAC;IACrB,CAAC;IAEQ,YAAY,CAAC,IAAY,EAAE,OAAuB;QAE1D,QAAQ,IAAI,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,EAAE,CAAC;YACnC,KAAK,KAAK,CAAC,CAAI,OAAO,YAAY,CAAC,GAAG,CAAC;YACvC,KAAK,MAAM,CAAC,CAAG,OAAO,YAAY,CAAC,IAAI,CAAC;YACxC,KAAK,OAAO,CAAC,CAAE,OAAO,YAAY,CAAC,KAAK,CAAC;YACzC,KAAK,QAAQ,CAAC,CAAC,OAAO,YAAY,CAAC,MAAM,CAAC;YAC1C,KAAK,QAAQ,CAAC,CAAC,OAAO,YAAY,CAAC,MAAM,CAAC;YAC1C,KAAK,OAAO,CAAC,CAAE,OAAO,YAAY,CAAC,KAAK,CAAC;YACzC;gBACC,MAAM,IAAI,kBAAkB,CAC3B,qBAAqB,IAAI,IAAI,CAC7B,CAAC;QACJ,CAAC;IACF,CAAC;CACD"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { Incantation, ArgIncantation, type LOCAL } from "../incantation.js";
|
|
2
|
+
import type { DesmostOptions } from "../../options.js";
|
|
2
3
|
interface LabelOptions {
|
|
3
4
|
text: string;
|
|
4
5
|
show?: boolean;
|
|
5
|
-
size?: number
|
|
6
|
-
pos?:
|
|
6
|
+
size?: number;
|
|
7
|
+
pos?: "ABOVE" | "BELOW" | "LEFT" | "RIGHT" | "ABOVE_LEFT" | "ABOVE_RIGHT" | "BELOW_LEFT" | "BELOW_RIGHT";
|
|
7
8
|
}
|
|
8
9
|
export declare class LabelIncantation extends ArgIncantation<LOCAL> {
|
|
9
10
|
readonly description = "Label a block that evaluates to a point(s).";
|
|
@@ -11,7 +12,7 @@ export declare class LabelIncantation extends ArgIncantation<LOCAL> {
|
|
|
11
12
|
readonly requires_arg = true;
|
|
12
13
|
readonly arg_type = Incantation.ArgType.OBJECT;
|
|
13
14
|
apply(target: Desmos.ExpressionState, data: LabelOptions): void;
|
|
14
|
-
evaluate_arg(raw: string): LabelOptions;
|
|
15
|
+
evaluate_arg(raw: string, options: DesmostOptions): LabelOptions;
|
|
15
16
|
}
|
|
16
17
|
export {};
|
|
17
18
|
//# sourceMappingURL=label.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"label.d.ts","sourceRoot":"","sources":["../../../src/magic/local/label.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"label.d.ts","sourceRoot":"","sources":["../../../src/magic/local/label.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,KAAK,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAGzE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAGpD,UAAU,YAAY;IAErB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,OAAO,GAAG,OAAO,GAAG,MAAM,GAAG,OAAO,GAAG,YAAY,GAAG,aAAa,GAAG,YAAY,GAAG,aAAa,CAAC;CACzG;AAUD,qBAAa,gBAAiB,SAAQ,cAAc,CAAC,KAAK,CAAC;IAE1D,SAAkB,WAAW,iDACmB;IAEhD,SAAkB,UAAU,WAAY;IACxC,SAAkB,YAAY,QAAO;IACrC,SAAkB,QAAQ,8BAAiC;IAElD,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,eAAe,EAAE,IAAI,EAAE,YAAY;IAWxD,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,GAAG,YAAY;CAkDzE"}
|