desmost 0.11.3 → 0.12.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/dist/compiler/format.d.ts.map +1 -1
- package/dist/compiler/format.js +6 -3
- package/dist/compiler/format.js.map +1 -1
- package/dist/decompiler/format.d.ts.map +1 -1
- package/dist/decompiler/format.js +5 -1
- package/dist/decompiler/format.js.map +1 -1
- package/dist/magic/global/index.d.ts +1 -0
- package/dist/magic/global/index.d.ts.map +1 -1
- package/dist/magic/global/index.js +2 -0
- package/dist/magic/global/index.js.map +1 -1
- package/dist/magic/global/no-border.d.ts +11 -0
- package/dist/magic/global/no-border.d.ts.map +1 -0
- package/dist/magic/global/no-border.js +20 -0
- package/dist/magic/global/no-border.js.map +1 -0
- package/dist/magic/local/colour.d.ts +4 -3
- package/dist/magic/local/colour.d.ts.map +1 -1
- package/dist/magic/local/colour.js +5 -3
- package/dist/magic/local/colour.js.map +1 -1
- package/dist/magic/local/dotted.d.ts +11 -0
- package/dist/magic/local/dotted.d.ts.map +1 -0
- package/dist/magic/local/dotted.js +21 -0
- package/dist/magic/local/dotted.js.map +1 -0
- package/dist/magic/local/index.d.ts +2 -0
- package/dist/magic/local/index.d.ts.map +1 -1
- package/dist/magic/local/index.js +4 -0
- package/dist/magic/local/index.js.map +1 -1
- package/dist/magic/local/no-fill.d.ts +11 -0
- package/dist/magic/local/no-fill.d.ts.map +1 -0
- package/dist/magic/local/no-fill.js +21 -0
- package/dist/magic/local/no-fill.js.map +1 -0
- package/dist/magic/local/no-line.d.ts.map +1 -1
- package/dist/magic/local/no-line.js.map +1 -1
- package/dist/magic/local/point.d.ts +2 -1
- package/dist/magic/local/point.d.ts.map +1 -1
- package/dist/magic/local/point.js +6 -2
- package/dist/magic/local/point.js.map +1 -1
- package/package.json +1 -1
- package/src/compiler/format.ts +9 -4
- package/src/decompiler/format.ts +11 -1
- package/src/magic/.template.ts +4 -4
- package/src/magic/global/index.ts +5 -3
- package/src/magic/global/no-border.ts +29 -0
- package/src/magic/local/colour.ts +7 -5
- package/src/magic/local/dotted.ts +30 -0
- package/src/magic/local/index.ts +4 -0
- package/src/magic/local/no-fill.ts +30 -0
- package/src/magic/local/no-line.ts +1 -1
- package/src/magic/local/point.ts +5 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../../src/compiler/format.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjD,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAIzC,wBAAgB,YAAY,CAC3B,CAAC,EAAE,YAAY,EACf,OAAO,EAAE,cAAc,GACrB,MAAM,CA8BR;AAGD;;GAEG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAIrD;AAGD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../../src/compiler/format.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjD,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAIzC,wBAAgB,YAAY,CAC3B,CAAC,EAAE,YAAY,EACf,OAAO,EAAE,cAAc,GACrB,MAAM,CA8BR;AAGD;;GAEG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAIrD;AAGD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAwBpD"}
|
package/dist/compiler/format.js
CHANGED
|
@@ -49,13 +49,16 @@ export function normalise_latex(latex) {
|
|
|
49
49
|
* ```
|
|
50
50
|
*/
|
|
51
51
|
export function prettify_latex(latex) {
|
|
52
|
+
latex = latex.replaceAll(/\s=<\s/g, " \\leq ");
|
|
53
|
+
latex = latex.replaceAll(/\s>=\s/g, " \\geq ");
|
|
52
54
|
latex = latex.replaceAll(/(?<!\\left)(\(|\[|\\\{)/g, "\\left$1");
|
|
53
55
|
latex = latex.replaceAll(/(?:\\left\s?)+/g, "\\left");
|
|
54
56
|
latex = latex.replaceAll(/(?<!\\right)(\)|\]|\\\})/g, "\\right$1");
|
|
55
57
|
latex = latex.replaceAll(/(?:\\right\s?)+/g, "\\right");
|
|
56
|
-
latex = latex.replaceAll(/(:|,)(?!\\ )
|
|
57
|
-
latex = latex.replaceAll(/(?<=[^\w]|^)\\?(length|mean|median|
|
|
58
|
-
latex = latex.replaceAll(
|
|
58
|
+
latex = latex.replaceAll(/(:|,)\s*(?!\\ )/g, "$1\\ ");
|
|
59
|
+
latex = latex.replaceAll(/(?<=[^\w]|^)\\?(length|mean|median|count|total|repeat|join|sort|shuffle|unique|mod|ceil|floor|round|sign)\s*(?=\(|\\left\()/g, "\\operatorname{$1}");
|
|
60
|
+
latex = latex.replaceAll(/\\?(min|max)\s*(?=\(|\\left\()/g, "\\$1");
|
|
61
|
+
latex = latex.replaceAll(/\s(and|or)\s/g, " \\operatorname{$1} ");
|
|
59
62
|
return latex;
|
|
60
63
|
}
|
|
61
64
|
//# sourceMappingURL=format.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"format.js","sourceRoot":"","sources":["../../src/compiler/format.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAGhC,MAAM,UAAU,YAAY,CAC3B,CAAe,EACf,OAAuB;IAGvB,IAAI,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC;IAClC,IAAI,GAAG,GAAG,CAAC,MAAM,KAAK,EAAE,IAAI,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC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G,KAAK,CAAC,UAAU,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;IAC/C,KAAK,GAAG,KAAK,CAAC,UAAU,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;IAC/C,KAAK,GAAG,KAAK,CAAC,UAAU,CAAC,0BAA0B,EAAE,UAAU,CAAC,CAAC;IACjE,KAAK,GAAG,KAAK,CAAC,UAAU,CAAC,iBAAiB,EAAE,QAAQ,CAAC,CAAC;IACtD,KAAK,GAAG,KAAK,CAAC,UAAU,CAAC,2BAA2B,EAAE,WAAW,CAAC,CAAC;IACnE,KAAK,GAAG,KAAK,CAAC,UAAU,CAAC,kBAAkB,EAAE,SAAS,CAAC,CAAC;IACxD,KAAK,GAAG,KAAK,CAAC,UAAU,CAAC,kBAAkB,EAAE,OAAO,CAAC,CAAC;IAEtD,KAAK,GAAG,KAAK,CAAC,UAAU,CACvB,8HAA8H,EAC9H,oBAAoB,CACpB,CAAC;IACF,KAAK,GAAG,KAAK,CAAC,UAAU,CACvB,iCAAiC,EACjC,MAAM,CACN,CAAC;IACF,KAAK,GAAG,KAAK,CAAC,UAAU,CACvB,eAAe,EACf,sBAAsB,CACtB,CAAC;IAEF,OAAO,KAAK,CAAC;AACd,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../../src/decompiler/format.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../../src/decompiler/format.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAuBtD"}
|
|
@@ -12,11 +12,15 @@
|
|
|
12
12
|
* ```
|
|
13
13
|
*/
|
|
14
14
|
export function prettify_source(source) {
|
|
15
|
+
source = source.replaceAll(/\s*\\leq\s*/g, " =< ");
|
|
16
|
+
source = source.replaceAll(/\s*\\geq\s*/g, " >= ");
|
|
15
17
|
source = source.replaceAll(/(?<=[^ ])=(?=[^ ])/g, " = ");
|
|
16
18
|
source = source.replaceAll(/\\left\s*(\(|\[|\\\{)/g, "$1");
|
|
17
19
|
source = source.replaceAll(/\\right\s*(\)|\]|\\\})/g, "$1");
|
|
18
20
|
source = source.replaceAll(/(:|,)\\ /g, "$1 ");
|
|
19
|
-
source = source.replaceAll(/\\operatorname\{(length|mean|median|
|
|
21
|
+
source = source.replaceAll(/\\operatorname\{(length|mean|median|count|total|repeat|join|sort|shuffle|unique|mod|ceil|floor|round|sign)\}\s*(?=\(|\\left\()/g, "$1");
|
|
22
|
+
source = source.replaceAll(/\\(min|max)\s*(?=\(|\\left\()/g, "$1");
|
|
23
|
+
source = source.replaceAll(/\\operatorname\{(and|or)\}/g, "$1");
|
|
20
24
|
return source;
|
|
21
25
|
}
|
|
22
26
|
//# sourceMappingURL=format.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"format.js","sourceRoot":"","sources":["../../src/decompiler/format.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,eAAe,CAAC,MAAc;
|
|
1
|
+
{"version":3,"file":"format.js","sourceRoot":"","sources":["../../src/decompiler/format.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,eAAe,CAAC,MAAc;IAE7C,MAAM,GAAG,MAAM,CAAC,UAAU,CAAC,cAAc,EAAE,MAAM,CAAC,CAAA;IAClD,MAAM,GAAG,MAAM,CAAC,UAAU,CAAC,cAAc,EAAE,MAAM,CAAC,CAAA;IAChD,MAAM,GAAG,MAAM,CAAC,UAAU,CAAC,qBAAqB,EAAE,KAAK,CAAC,CAAC;IACzD,MAAM,GAAG,MAAM,CAAC,UAAU,CAAC,wBAAwB,EAAE,IAAI,CAAC,CAAC;IAC3D,MAAM,GAAG,MAAM,CAAC,UAAU,CAAC,yBAAyB,EAAE,IAAI,CAAC,CAAC;IAC9D,MAAM,GAAG,MAAM,CAAC,UAAU,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC;IAE/C,MAAM,GAAG,MAAM,CAAC,UAAU,CACrB,iIAAiI,EACrI,IAAI,CACJ,CAAC;IACA,MAAM,GAAG,MAAM,CAAC,UAAU,CAC3B,gCAAgC,EAChC,IAAI,CACJ,CAAC;IACF,MAAM,GAAG,MAAM,CAAC,UAAU,CACzB,6BAA6B,EAC7B,IAAI,CACJ,CAAC;IAEA,OAAO,MAAM,CAAC;AACjB,CAAC"}
|
|
@@ -2,5 +2,6 @@ export declare const GLOBAL_INCANTATIONS: {
|
|
|
2
2
|
desmos: import("./desmos.js").DesmosIncantation;
|
|
3
3
|
viewport: import("./viewport.js").ViewportIncantation;
|
|
4
4
|
dark: import("./dark.js").DarkModeIncantation;
|
|
5
|
+
no_border: import("./no-border.js").NoBorderIncantation;
|
|
5
6
|
};
|
|
6
7
|
//# 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":"AAQA,eAAO,MAAM,mBAAmB;;;;;CAKe,CAAC"}
|
|
@@ -2,9 +2,11 @@ import { Incantation } from "../incantation.js";
|
|
|
2
2
|
import { desmos } from "./desmos.js";
|
|
3
3
|
import { viewport } from "./viewport.js";
|
|
4
4
|
import { dark } from "./dark.js";
|
|
5
|
+
import { no_border } from "./no-border.js";
|
|
5
6
|
export const GLOBAL_INCANTATIONS = {
|
|
6
7
|
desmos,
|
|
7
8
|
viewport,
|
|
8
9
|
dark,
|
|
10
|
+
no_border,
|
|
9
11
|
};
|
|
10
12
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
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,
|
|
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,EAAK,MAAM,UAAU,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAG,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,IAAI,EAAO,MAAM,QAAQ,CAAC;AACnC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAGxC,MAAM,CAAC,MAAM,mBAAmB,GAAG;IAClC,MAAM;IACN,QAAQ;IACR,IAAI;IACJ,SAAS;CACqC,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Incantation, type GLOBAL } from "../incantation.js";
|
|
2
|
+
import { Ast } from "../../parser/index.js";
|
|
3
|
+
export declare class NoBorderIncantation extends Incantation<GLOBAL> {
|
|
4
|
+
readonly effect = Incantation.Effect.GLOBAL;
|
|
5
|
+
readonly identifier = "no-border";
|
|
6
|
+
readonly description = "Remove the \u201Csubtle 1px gray border around the entire calculator\u201D.";
|
|
7
|
+
apply(target: Desmos.Calculator): void;
|
|
8
|
+
extract(target: Desmos.Calculator): Ast.IncantationInvocation<GLOBAL> | void;
|
|
9
|
+
}
|
|
10
|
+
export declare const no_border: NoBorderIncantation;
|
|
11
|
+
//# sourceMappingURL=no-border.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"no-border.d.ts","sourceRoot":"","sources":["../../../src/magic/global/no-border.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,6BAAkC;IAC1D,SAAkB,UAAU,eAAgB;IAC5C,SAAkB,WAAW,iFAC2C;IAE/D,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,UAAU;IAK/B,OAAO,CAAC,MAAM,EAAE,MAAM,CAAC,UAAU,GAAG,GAAG,CAAC,qBAAqB,CAAC,MAAM,CAAC,GAAG,IAAI;CASrF;AAED,eAAO,MAAM,SAAS,qBAA4B,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Incantation } from "../incantation.js";
|
|
2
|
+
import { Ast } from "../../parser/index.js";
|
|
3
|
+
export class NoBorderIncantation extends Incantation {
|
|
4
|
+
effect = Incantation.Effect.GLOBAL;
|
|
5
|
+
identifier = "no-border";
|
|
6
|
+
description = "Remove the “subtle 1px gray border around the entire calculator”.";
|
|
7
|
+
apply(target) {
|
|
8
|
+
target.updateSettings({ border: false });
|
|
9
|
+
}
|
|
10
|
+
extract(target) {
|
|
11
|
+
if (target.settings.border === false) {
|
|
12
|
+
return {
|
|
13
|
+
kind: Ast.Kind.INCANTATION_INVOCATION,
|
|
14
|
+
incantation: no_border,
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
export const no_border = new NoBorderIncantation();
|
|
20
|
+
//# sourceMappingURL=no-border.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"no-border.js","sourceRoot":"","sources":["../../../src/magic/global/no-border.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,GAAS,WAAW,CAAC,MAAM,CAAC,MAAM,CAAA;IACxC,UAAU,GAAK,WAAW,CAAA;IAC1B,WAAW,GACxB,mEAAmE,CAAA;IAE/D,KAAK,CAAC,MAAyB;QAEvC,MAAM,CAAC,cAAc,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC;IAC1C,CAAC;IAEQ,OAAO,CAAC,MAAyB;QAEzC,IAAI,MAAM,CAAC,QAAQ,CAAC,MAAM,KAAK,KAAK,EAAE,CAAC;YACtC,OAAO;gBACN,IAAI,EAAE,GAAG,CAAC,IAAI,CAAC,sBAAsB;gBACrC,WAAW,EAAE,SAAS;aACtB,CAAC;QACH,CAAC;IACF,CAAC;CACD;AAED,MAAM,CAAC,MAAM,SAAS,GAAG,IAAI,mBAAmB,EAAE,CAAC"}
|
|
@@ -3,15 +3,16 @@ import type { DesmostOptions } from "../../options.js";
|
|
|
3
3
|
import { Ast } from "../../parser/index.js";
|
|
4
4
|
type DesmosColourName = keyof typeof Desmos.Colors;
|
|
5
5
|
type DesmosColour = (typeof Desmos.Colors)[DesmosColourName];
|
|
6
|
+
type HexColour = string;
|
|
6
7
|
export declare class ColourIncantation extends ArgIncantation<LOCAL> {
|
|
7
8
|
readonly effect = Incantation.Effect.LOCAL;
|
|
8
9
|
readonly identifier = "colour";
|
|
9
10
|
readonly alias = "color";
|
|
10
11
|
readonly requires_arg = true;
|
|
11
|
-
readonly arg_type = Incantation.ArgType.
|
|
12
|
+
readonly arg_type = Incantation.ArgType.STRING;
|
|
12
13
|
readonly description = "Change the colour of a rendered expression, such as a line, region, polygon, etc.";
|
|
13
|
-
apply(target: Desmos.ExpressionState, data: DesmosColour): void;
|
|
14
|
-
evaluate_arg(data: string, options: DesmostOptions): DesmosColour;
|
|
14
|
+
apply(target: Desmos.ExpressionState, data: DesmosColour | HexColour): void;
|
|
15
|
+
evaluate_arg(data: string, options: DesmostOptions): DesmosColour | HexColour;
|
|
15
16
|
extract(target: Desmos.Expression): Ast.IncantationInvocation<LOCAL> | void;
|
|
16
17
|
}
|
|
17
18
|
export declare const colour: ColourIncantation;
|
|
@@ -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;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;
|
|
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;AAC7D,KAAK,SAAS,GAAG,MAAM,CAAC;AAKxB,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,8BAAiC;IAC3D,SAAkB,WAAW,uFACyD;IAE7E,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,eAAe,EAAE,IAAI,EAAE,YAAY,GAAG,SAAS;IAMpE,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,GAAG,YAAY,GAAG,SAAS;IAsB7E,OAAO,CAAC,MAAM,EAAE,MAAM,CAAC,UAAU,GAAG,GAAG,CAAC,qBAAqB,CAAC,KAAK,CAAC,GAAG,IAAI;CAcpF;AAED,eAAO,MAAM,MAAM,mBAA0B,CAAC"}
|
|
@@ -7,7 +7,7 @@ export class ColourIncantation extends ArgIncantation {
|
|
|
7
7
|
identifier = "colour";
|
|
8
8
|
alias = "color";
|
|
9
9
|
requires_arg = true;
|
|
10
|
-
arg_type = Incantation.ArgType.
|
|
10
|
+
arg_type = Incantation.ArgType.STRING;
|
|
11
11
|
description = "Change the colour of a rendered expression, such as a line, region, polygon, etc.";
|
|
12
12
|
apply(target, data) {
|
|
13
13
|
super.require_expr_type(target.type, "expression");
|
|
@@ -20,13 +20,15 @@ export class ColourIncantation extends ArgIncantation {
|
|
|
20
20
|
}
|
|
21
21
|
else {
|
|
22
22
|
let internal = Desmos.Colors[colour];
|
|
23
|
-
if (
|
|
23
|
+
if (internal != undefined)
|
|
24
|
+
return internal;
|
|
25
|
+
if (options.check_args && !colour.startsWith("#")) {
|
|
24
26
|
throw new DesmostError.InvalidArgument({
|
|
25
27
|
msg: `/colour received invalid colour: \`${data}\``,
|
|
26
28
|
hint: `Valid colours are ${VALID_COLOURS.join(", ")}`,
|
|
27
29
|
});
|
|
28
30
|
}
|
|
29
|
-
return
|
|
31
|
+
return colour;
|
|
30
32
|
}
|
|
31
33
|
}
|
|
32
34
|
extract(target) {
|
|
@@ -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;AAGzE,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
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AC,GAAG,CAAC,EAAE,CAAC;gBACnD,MAAM,IAAI,YAAY,CAAC,eAAe,CAAC;oBACtC,GAAG,EAAG,sCAAsC,IAAI,IAAI;oBACpD,IAAI,EAAE,qBAAqB,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;iBACrD,CAAC,CAAC;YACJ,CAAC;YAED,OAAO,MAAM,CAAC;QACf,CAAC;IACF,CAAC;IAEQ,OAAO,CAAC,MAAyB;QAEzC,IAAI,MAAM,CAAC,KAAK,IAAI,SAAS;YAAE,OAAO;QAEtC,IAAI,GAAG,GAAG,MAAM,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC;QAErC,OAAO;YACN,IAAI,EAAE,GAAG,CAAC,IAAI,CAAC,sBAAsB;YACrC,WAAW,EAAE,MAAM;YACnB,OAAO,EACN,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;mBAC3D,MAAM,CAAC,KAAK;SAChB,CAAC;IACH,CAAC;CACD;AAED,MAAM,CAAC,MAAM,MAAM,GAAG,IAAI,iBAAiB,EAAE,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Incantation, type LOCAL } from "../incantation.js";
|
|
2
|
+
import { Ast } from "../../parser/index.js";
|
|
3
|
+
export declare class DottedIncantation extends Incantation<LOCAL> {
|
|
4
|
+
readonly effect = Incantation.Effect.LOCAL;
|
|
5
|
+
readonly identifier = "dotted";
|
|
6
|
+
readonly description = "Render a block as a dotted line.";
|
|
7
|
+
apply(target: Desmos.ExpressionState): void;
|
|
8
|
+
extract(target: Desmos.Expression): Ast.IncantationInvocation<LOCAL> | void;
|
|
9
|
+
}
|
|
10
|
+
export declare const dotted: DottedIncantation;
|
|
11
|
+
//# sourceMappingURL=dotted.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dotted.d.ts","sourceRoot":"","sources":["../../../src/magic/local/dotted.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,KAAK,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAEzD,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAGnC,qBAAa,iBAAkB,SAAQ,WAAW,CAAC,KAAK,CAAC;IAExD,SAAkB,MAAM,4BAAiC;IACzD,SAAkB,UAAU,YAAW;IACvC,SAAkB,WAAW,sCACQ;IAE5B,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,MAAM,mBAA0B,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Incantation } from "../incantation.js";
|
|
2
|
+
import { Ast } from "../../parser/index.js";
|
|
3
|
+
export class DottedIncantation extends Incantation {
|
|
4
|
+
effect = Incantation.Effect.LOCAL;
|
|
5
|
+
identifier = "dotted";
|
|
6
|
+
description = "Render a block as a dotted line.";
|
|
7
|
+
apply(target) {
|
|
8
|
+
super.require_expr_type(target.type, "expression");
|
|
9
|
+
target.lineStyle = Desmos.Styles.DOTTED;
|
|
10
|
+
}
|
|
11
|
+
extract(target) {
|
|
12
|
+
if (target.lineStyle === Desmos.Styles.DOTTED) {
|
|
13
|
+
return {
|
|
14
|
+
kind: Ast.Kind.INCANTATION_INVOCATION,
|
|
15
|
+
incantation: dotted,
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
export const dotted = new DottedIncantation();
|
|
21
|
+
//# sourceMappingURL=dotted.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dotted.js","sourceRoot":"","sources":["../../../src/magic/local/dotted.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAc,MAAM,gBAAgB,CAAC;AAEzD,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAGnC,MAAM,OAAO,iBAAkB,SAAQ,WAAkB;IAEtC,MAAM,GAAS,WAAW,CAAC,MAAM,CAAC,KAAK,CAAA;IACvC,UAAU,GAAG,QAAQ,CAAA;IACrB,WAAW,GAC1B,kCAAkC,CAAA;IAE5B,KAAK,CAAC,MAA8B;QAE5C,KAAK,CAAC,iBAAiB,CAAC,MAAM,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;QACnD,MAAM,CAAC,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC;IACzC,CAAC;IAEQ,OAAO,CAAC,MAAyB;QAEzC,IAAI,MAAM,CAAC,SAAS,KAAK,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;YAC/C,OAAO;gBACN,IAAI,EAAE,GAAG,CAAC,IAAI,CAAC,sBAAsB;gBACrC,WAAW,EAAE,MAAM;aACnB,CAAC;QACH,CAAC;IACF,CAAC;CACD;AAED,MAAM,CAAC,MAAM,MAAM,GAAG,IAAI,iBAAiB,EAAE,CAAC"}
|
|
@@ -2,10 +2,12 @@ export declare const LOCAL_INCANTATIONS: {
|
|
|
2
2
|
anim: import("./anim.js").AnimIncantation;
|
|
3
3
|
colour: import("./colour.js").ColourIncantation;
|
|
4
4
|
dashed: import("./dashed.js").DashedIncantation;
|
|
5
|
+
dotted: import("./dotted.js").DottedIncantation;
|
|
5
6
|
fill: import("./fill.js").FillIncantation;
|
|
6
7
|
hide: import("./hide.js").HideIncantation;
|
|
7
8
|
label: import("./label.js").LabelIncantation;
|
|
8
9
|
line: import("./line.js").LineIncantation;
|
|
10
|
+
no_fill: import("./no-fill.js").NoFillIncantation;
|
|
9
11
|
no_line: import("./no-line.js").NoLineIncantation;
|
|
10
12
|
point: import("./point.js").PointIncantation;
|
|
11
13
|
secret: import("./secret.js").SecretIncantation;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/magic/local/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/magic/local/index.ts"],"names":[],"mappings":"AAiBA,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;CAce,CAAC"}
|
|
@@ -2,10 +2,12 @@ import { Incantation } from "../incantation.js";
|
|
|
2
2
|
import { anim } from "./anim.js";
|
|
3
3
|
import { colour } from "./colour.js";
|
|
4
4
|
import { dashed } from "./dashed.js";
|
|
5
|
+
import { dotted } from "./dotted.js";
|
|
5
6
|
import { fill } from "./fill.js";
|
|
6
7
|
import { hide } from "./hide.js";
|
|
7
8
|
import { label } from "./label.js";
|
|
8
9
|
import { line } from "./line.js";
|
|
10
|
+
import { no_fill } from "./no-fill.js";
|
|
9
11
|
import { no_line } from "./no-line.js";
|
|
10
12
|
import { point } from "./point.js";
|
|
11
13
|
import { secret } from "./secret.js";
|
|
@@ -14,10 +16,12 @@ export const LOCAL_INCANTATIONS = {
|
|
|
14
16
|
anim,
|
|
15
17
|
colour,
|
|
16
18
|
dashed,
|
|
19
|
+
dotted,
|
|
17
20
|
fill,
|
|
18
21
|
hide,
|
|
19
22
|
label,
|
|
20
23
|
line,
|
|
24
|
+
no_fill,
|
|
21
25
|
no_line,
|
|
22
26
|
point,
|
|
23
27
|
secret,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/magic/local/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAc,MAAM,gBAAgB,CAAC;AAEzD,OAAO,EAAE,IAAI,EAAK,MAAM,QAAQ,CAAC;AACjC,OAAO,EAAE,MAAM,EAAG,MAAM,UAAU,CAAC;AACnC,OAAO,EAAE,MAAM,EAAG,MAAM,UAAU,CAAC;AACnC,OAAO,EAAE,IAAI,EAAK,M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AM,UAAU,CAAC;AACnC,OAAO,EAAE,MAAM,EAAG,MAAM,UAAU,CAAC;AAGnC,MAAM,CAAC,MAAM,kBAAkB,GAAG;IACjC,IAAI;IACJ,MAAM;IACN,MAAM;IACN,MAAM;IACN,IAAI;IACJ,IAAI;IACJ,KAAK;IACL,IAAI;IACJ,OAAO;IACP,OAAO;IACP,KAAK;IACL,MAAM;IACN,MAAM;CACuC,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Incantation, type LOCAL } from "../incantation.js";
|
|
2
|
+
import { Ast } from "../../parser/index.js";
|
|
3
|
+
export declare class NoFillIncantation extends Incantation<LOCAL> {
|
|
4
|
+
readonly effect = Incantation.Effect.LOCAL;
|
|
5
|
+
readonly identifier = "no-fill";
|
|
6
|
+
readonly description = "Disable rendering fill for a block.";
|
|
7
|
+
apply(target: Desmos.ExpressionState): void;
|
|
8
|
+
extract(target: Desmos.Expression): Ast.IncantationInvocation<LOCAL> | void;
|
|
9
|
+
}
|
|
10
|
+
export declare const no_fill: NoFillIncantation;
|
|
11
|
+
//# sourceMappingURL=no-fill.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"no-fill.d.ts","sourceRoot":"","sources":["../../../src/magic/local/no-fill.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,KAAK,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAEzD,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAGnC,qBAAa,iBAAkB,SAAQ,WAAW,CAAC,KAAK,CAAC;IAExD,SAAkB,MAAM,4BAA+B;IACvD,SAAkB,UAAU,aAAY;IACxC,SAAkB,WAAW,yCACW;IAE/B,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,OAAO,mBAA0B,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Incantation } from "../incantation.js";
|
|
2
|
+
import { Ast } from "../../parser/index.js";
|
|
3
|
+
export class NoFillIncantation extends Incantation {
|
|
4
|
+
effect = Incantation.Effect.LOCAL;
|
|
5
|
+
identifier = "no-fill";
|
|
6
|
+
description = "Disable rendering fill for a block.";
|
|
7
|
+
apply(target) {
|
|
8
|
+
super.require_expr_type(target.type, "expression");
|
|
9
|
+
target.fill = false;
|
|
10
|
+
}
|
|
11
|
+
extract(target) {
|
|
12
|
+
if (target.fill === false) {
|
|
13
|
+
return {
|
|
14
|
+
kind: Ast.Kind.INCANTATION_INVOCATION,
|
|
15
|
+
incantation: no_fill,
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
export const no_fill = new NoFillIncantation();
|
|
21
|
+
//# sourceMappingURL=no-fill.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"no-fill.js","sourceRoot":"","sources":["../../../src/magic/local/no-fill.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAc,MAAM,gBAAgB,CAAC;AAEzD,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAGnC,MAAM,OAAO,iBAAkB,SAAQ,WAAkB;IAEtC,MAAM,GAAO,WAAW,CAAC,MAAM,CAAC,KAAK,CAAA;IACrC,UAAU,GAAG,SAAS,CAAA;IACtB,WAAW,GAC1B,qCAAqC,CAAA;IAE/B,KAAK,CAAC,MAA8B;QAE5C,KAAK,CAAC,iBAAiB,CAAC,MAAM,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;QACnD,MAAM,CAAC,IAAI,GAAG,KAAK,CAAC;IACrB,CAAC;IAEQ,OAAO,CAAC,MAAyB;QAEzC,IAAI,MAAM,CAAC,IAAI,KAAK,KAAK,EAAE,CAAC;YAC3B,OAAO;gBACN,IAAI,EAAE,GAAG,CAAC,IAAI,CAAC,sBAAsB;gBACrC,WAAW,EAAE,OAAO;aACpB,CAAC;QACH,CAAC;IACF,CAAC;CACD;AAED,MAAM,CAAC,MAAM,OAAO,GAAG,IAAI,iBAAiB,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"no-line.d.ts","sourceRoot":"","sources":["../../../src/magic/local/no-line.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,KAAK,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAEzD,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAGnC,qBAAa,iBAAkB,SAAQ,WAAW,CAAC,KAAK,CAAC;IAExD,SAAkB,MAAM,
|
|
1
|
+
{"version":3,"file":"no-line.d.ts","sourceRoot":"","sources":["../../../src/magic/local/no-line.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,KAAK,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAEzD,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAGnC,qBAAa,iBAAkB,SAAQ,WAAW,CAAC,KAAK,CAAC;IAExD,SAAkB,MAAM,4BAA+B;IACvD,SAAkB,UAAU,aAAY;IACxC,SAAkB,WAAW,0CACY;IAEhC,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,OAAO,mBAA0B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"no-line.js","sourceRoot":"","sources":["../../../src/magic/local/no-line.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAc,MAAM,gBAAgB,CAAC;AAEzD,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAGnC,MAAM,OAAO,iBAAkB,SAAQ,WAAkB;IAEtC,MAAM,
|
|
1
|
+
{"version":3,"file":"no-line.js","sourceRoot":"","sources":["../../../src/magic/local/no-line.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAc,MAAM,gBAAgB,CAAC;AAEzD,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAGnC,MAAM,OAAO,iBAAkB,SAAQ,WAAkB;IAEtC,MAAM,GAAO,WAAW,CAAC,MAAM,CAAC,KAAK,CAAA;IACrC,UAAU,GAAG,SAAS,CAAA;IACtB,WAAW,GAC1B,sCAAsC,CAAA;IAEhC,KAAK,CAAC,MAA8B;QAE5C,KAAK,CAAC,iBAAiB,CAAC,MAAM,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;QACnD,MAAM,CAAC,KAAK,GAAG,KAAK,CAAC;IACtB,CAAC;IAEQ,OAAO,CAAC,MAAyB;QAEzC,IAAI,MAAM,CAAC,KAAK,KAAK,KAAK,EAAE,CAAC;YAC5B,OAAO;gBACN,IAAI,EAAE,GAAG,CAAC,IAAI,CAAC,sBAAsB;gBACrC,WAAW,EAAE,OAAO;aACpB,CAAC;QACH,CAAC;IACF,CAAC;CACD;AAED,MAAM,CAAC,MAAM,OAAO,GAAG,IAAI,iBAAiB,EAAE,CAAC"}
|
|
@@ -4,13 +4,14 @@ interface PointStyles {
|
|
|
4
4
|
style?: keyof typeof Desmos.Styles;
|
|
5
5
|
size?: number;
|
|
6
6
|
opacity?: number;
|
|
7
|
+
drag: keyof typeof Desmos.DragModes;
|
|
7
8
|
}
|
|
8
9
|
export declare class PointIncantation extends ArgIncantation<LOCAL> {
|
|
9
10
|
readonly effect = Incantation.Effect.LOCAL;
|
|
10
11
|
readonly identifier = "point";
|
|
11
12
|
readonly requires_arg = true;
|
|
12
13
|
readonly arg_type = Incantation.ArgType.OBJECT;
|
|
13
|
-
readonly description = "";
|
|
14
|
+
readonly description = "Change point styles for a rendered block.";
|
|
14
15
|
apply(target: Desmos.ExpressionState, data: Partial<PointStyles>): void;
|
|
15
16
|
extract(target: Desmos.Expression): Ast.IncantationInvocation<LOCAL> | void;
|
|
16
17
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"point.d.ts","sourceRoot":"","sources":["../../../src/magic/local/point.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,KAAK,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAEzE,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAGnC,UAAU,WAAW;IAEpB,KAAK,CAAC,EAAI,MAAM,OAAO,MAAM,CAAC,MAAM,CAAC;IACrC,IAAI,CAAC,EAAK,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"point.d.ts","sourceRoot":"","sources":["../../../src/magic/local/point.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,KAAK,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAEzE,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAGnC,UAAU,WAAW;IAEpB,KAAK,CAAC,EAAI,MAAM,OAAO,MAAM,CAAC,MAAM,CAAC;IACrC,IAAI,CAAC,EAAK,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,EAAM,MAAM,OAAO,MAAM,CAAC,SAAS,CAAC;CACxC;AAGD,qBAAa,gBAAiB,SAAQ,cAAc,CAAC,KAAK,CAAC;IAE1D,SAAkB,MAAM,4BAAiC;IACzD,SAAkB,UAAU,WAAY;IACxC,SAAkB,YAAY,QAAO;IACrC,SAAkB,QAAQ,8BAAiC;IAC3D,SAAkB,WAAW,+CACiB;IAErC,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,eAAe,EAAE,IAAI,EAAE,OAAO,CAAC,WAAW,CAAC;IAUhE,OAAO,CAAC,MAAM,EAAE,MAAM,CAAC,UAAU,GAAG,GAAG,CAAC,qBAAqB,CAAC,KAAK,CAAC,GAAG,IAAI;CAqBpF;AAED,eAAO,MAAM,KAAK,kBAAyB,CAAC"}
|
|
@@ -5,7 +5,7 @@ export class PointIncantation extends ArgIncantation {
|
|
|
5
5
|
identifier = "point";
|
|
6
6
|
requires_arg = true;
|
|
7
7
|
arg_type = Incantation.ArgType.OBJECT;
|
|
8
|
-
description = "";
|
|
8
|
+
description = "Change point styles for a rendered block.";
|
|
9
9
|
apply(target, data) {
|
|
10
10
|
super.require_expr_type(target.type, "expression");
|
|
11
11
|
if (data.style != undefined)
|
|
@@ -14,11 +14,14 @@ export class PointIncantation extends ArgIncantation {
|
|
|
14
14
|
target.pointSize = data.size;
|
|
15
15
|
if (data.opacity != undefined)
|
|
16
16
|
target.pointOpacity = data.opacity;
|
|
17
|
+
if (data.drag != undefined)
|
|
18
|
+
target.dragMode = data.drag;
|
|
17
19
|
}
|
|
18
20
|
extract(target) {
|
|
19
21
|
if (target.pointStyle && target.pointStyle !== Desmos.Styles.POINT
|
|
20
22
|
|| target.pointSize
|
|
21
|
-
|| target.pointOpacity
|
|
23
|
+
|| target.pointOpacity
|
|
24
|
+
|| target.dragMode && target.dragMode !== Desmos.DragModes.AUTO) {
|
|
22
25
|
return {
|
|
23
26
|
kind: Ast.Kind.INCANTATION_INVOCATION,
|
|
24
27
|
incantation: point,
|
|
@@ -26,6 +29,7 @@ export class PointIncantation extends ArgIncantation {
|
|
|
26
29
|
style: target.pointStyle,
|
|
27
30
|
size: target.pointSize,
|
|
28
31
|
opacity: target.pointOpacity,
|
|
32
|
+
drag: target.dragMode,
|
|
29
33
|
}),
|
|
30
34
|
};
|
|
31
35
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"point.js","sourceRoot":"","sources":["../../../src/magic/local/point.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,cAAc,EAAc,MAAM,gBAAgB,CAAC;AAEzE,OAAO,EAAE,GAAG,EAAE,M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ACA,OAAO;gBACN,IAAI,EAAE,GAAG,CAAC,IAAI,CAAC,sBAAsB;gBACrC,WAAW,EAAE,KAAK;gBAClB,OAAO,EAAE,KAAK,CAAC,eAAe,CAAC;oBAC9B,KAAK,EAAI,MAAM,CAAC,UAAU;oBAC1B,IAAI,EAAK,MAAM,CAAC,SAAS;oBACzB,OAAO,EAAE,MAAM,CAAC,YAAY;oBAC5B,IAAI,EAAK,MAAM,CAAC,QAAQ;iBACxB,CAAC;aACF,CAAC;QACH,CAAC;IACF,CAAC;CACD;AAED,MAAM,CAAC,MAAM,KAAK,GAAG,IAAI,gBAAgB,EAAE,CAAC"}
|
package/package.json
CHANGED
package/src/compiler/format.ts
CHANGED
|
@@ -66,20 +66,25 @@ export function normalise_latex(latex: string): string
|
|
|
66
66
|
*/
|
|
67
67
|
export function prettify_latex(latex: string): string
|
|
68
68
|
{
|
|
69
|
+
latex = latex.replaceAll(/\s=<\s/g, " \\leq ");
|
|
70
|
+
latex = latex.replaceAll(/\s>=\s/g, " \\geq ");
|
|
69
71
|
latex = latex.replaceAll(/(?<!\\left)(\(|\[|\\\{)/g, "\\left$1");
|
|
70
72
|
latex = latex.replaceAll(/(?:\\left\s?)+/g, "\\left");
|
|
71
73
|
latex = latex.replaceAll(/(?<!\\right)(\)|\]|\\\})/g, "\\right$1");
|
|
72
74
|
latex = latex.replaceAll(/(?:\\right\s?)+/g, "\\right");
|
|
73
|
-
latex = latex.replaceAll(/(:|,)(?!\\ )
|
|
75
|
+
latex = latex.replaceAll(/(:|,)\s*(?!\\ )/g, "$1\\ ");
|
|
74
76
|
|
|
75
77
|
latex = latex.replaceAll(
|
|
76
|
-
/(?<=[^\w]|^)\\?(length|mean|median|
|
|
78
|
+
/(?<=[^\w]|^)\\?(length|mean|median|count|total|repeat|join|sort|shuffle|unique|mod|ceil|floor|round|sign)\s*(?=\(|\\left\()/g,
|
|
77
79
|
"\\operatorname{$1}"
|
|
78
80
|
);
|
|
79
|
-
|
|
81
|
+
latex = latex.replaceAll(
|
|
82
|
+
/\\?(min|max)\s*(?=\(|\\left\()/g,
|
|
83
|
+
"\\$1"
|
|
84
|
+
);
|
|
80
85
|
latex = latex.replaceAll(
|
|
81
86
|
/\s(and|or)\s/g,
|
|
82
|
-
"\\operatorname{$1}"
|
|
87
|
+
" \\operatorname{$1} "
|
|
83
88
|
);
|
|
84
89
|
|
|
85
90
|
return latex;
|
package/src/decompiler/format.ts
CHANGED
|
@@ -13,15 +13,25 @@
|
|
|
13
13
|
*/
|
|
14
14
|
export function prettify_source(source: string): string
|
|
15
15
|
{
|
|
16
|
+
source = source.replaceAll(/\s*\\leq\s*/g, " =< ")
|
|
17
|
+
source = source.replaceAll(/\s*\\geq\s*/g, " >= ")
|
|
16
18
|
source = source.replaceAll(/(?<=[^ ])=(?=[^ ])/g, " = ");
|
|
17
19
|
source = source.replaceAll(/\\left\s*(\(|\[|\\\{)/g, "$1");
|
|
18
20
|
source = source.replaceAll(/\\right\s*(\)|\]|\\\})/g, "$1");
|
|
19
21
|
source = source.replaceAll(/(:|,)\\ /g, "$1 ");
|
|
20
22
|
|
|
21
23
|
source = source.replaceAll(
|
|
22
|
-
/\\operatorname\{(length|mean|median|
|
|
24
|
+
/\\operatorname\{(length|mean|median|count|total|repeat|join|sort|shuffle|unique|mod|ceil|floor|round|sign)\}\s*(?=\(|\\left\()/g,
|
|
23
25
|
"$1"
|
|
24
26
|
);
|
|
27
|
+
source = source.replaceAll(
|
|
28
|
+
/\\(min|max)\s*(?=\(|\\left\()/g,
|
|
29
|
+
"$1"
|
|
30
|
+
);
|
|
31
|
+
source = source.replaceAll(
|
|
32
|
+
/\\operatorname\{(and|or)\}/g,
|
|
33
|
+
"$1",
|
|
34
|
+
);
|
|
25
35
|
|
|
26
36
|
return source;
|
|
27
37
|
}
|
package/src/magic/.template.ts
CHANGED
|
@@ -7,12 +7,12 @@
|
|
|
7
7
|
|
|
8
8
|
// export class ?Incantation extends ArgIncantation<?>
|
|
9
9
|
// {
|
|
10
|
-
// override readonly
|
|
11
|
-
// = ""
|
|
12
|
-
|
|
10
|
+
// override readonly effect = Incantation.Effect.?
|
|
13
11
|
// override readonly identifier = ?
|
|
14
12
|
// override readonly requires_arg = ?
|
|
15
13
|
// override readonly arg_type = Incantation.ArgType.?
|
|
14
|
+
// override readonly description
|
|
15
|
+
// = ""
|
|
16
16
|
|
|
17
17
|
// override apply(target: ?, data: ?)
|
|
18
18
|
// {
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
// return out;
|
|
31
31
|
// }
|
|
32
32
|
|
|
33
|
-
// override extract(target: ?): Ast.IncantationInvocation<?> |
|
|
33
|
+
// override extract(target: ?): Ast.IncantationInvocation<?> | void
|
|
34
34
|
// {
|
|
35
35
|
// // TODO
|
|
36
36
|
// }
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { Incantation, type GLOBAL } from "../incantation";
|
|
2
2
|
|
|
3
|
-
import { desmos
|
|
4
|
-
import { viewport
|
|
5
|
-
import { dark
|
|
3
|
+
import { desmos } from "./desmos";
|
|
4
|
+
import { viewport } from "./viewport";
|
|
5
|
+
import { dark } from "./dark";
|
|
6
|
+
import { no_border } from "./no-border";
|
|
6
7
|
|
|
7
8
|
|
|
8
9
|
export const GLOBAL_INCANTATIONS = {
|
|
9
10
|
desmos,
|
|
10
11
|
viewport,
|
|
11
12
|
dark,
|
|
13
|
+
no_border,
|
|
12
14
|
} satisfies Record<string, Incantation<GLOBAL>>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Incantation, type GLOBAL } from "../incantation";
|
|
2
|
+
|
|
3
|
+
import { Ast } from "../../parser";
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
export class NoBorderIncantation extends Incantation<GLOBAL>
|
|
7
|
+
{
|
|
8
|
+
override readonly effect = Incantation.Effect.GLOBAL
|
|
9
|
+
override readonly identifier = "no-border"
|
|
10
|
+
override readonly description
|
|
11
|
+
= "Remove the “subtle 1px gray border around the entire calculator”."
|
|
12
|
+
|
|
13
|
+
override apply(target: Desmos.Calculator)
|
|
14
|
+
{
|
|
15
|
+
target.updateSettings({ border: false });
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
override extract(target: Desmos.Calculator): Ast.IncantationInvocation<GLOBAL> | void
|
|
19
|
+
{
|
|
20
|
+
if (target.settings.border === false) {
|
|
21
|
+
return {
|
|
22
|
+
kind: Ast.Kind.INCANTATION_INVOCATION,
|
|
23
|
+
incantation: no_border,
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export const no_border = new NoBorderIncantation();
|
|
@@ -7,6 +7,7 @@ import { Ast } from "../../parser";
|
|
|
7
7
|
|
|
8
8
|
type DesmosColourName = keyof typeof Desmos.Colors;
|
|
9
9
|
type DesmosColour = (typeof Desmos.Colors)[DesmosColourName];
|
|
10
|
+
type HexColour = string;
|
|
10
11
|
|
|
11
12
|
const VALID_COLOURS = ["RED", "BLUE", "GREEN", "PURPLE", "ORANGE", "BLACK"];
|
|
12
13
|
|
|
@@ -17,17 +18,17 @@ export class ColourIncantation extends ArgIncantation<LOCAL>
|
|
|
17
18
|
override readonly identifier = "colour"
|
|
18
19
|
override readonly alias = "color"
|
|
19
20
|
override readonly requires_arg = true
|
|
20
|
-
override readonly arg_type = Incantation.ArgType.
|
|
21
|
+
override readonly arg_type = Incantation.ArgType.STRING
|
|
21
22
|
override readonly description
|
|
22
23
|
= "Change the colour of a rendered expression, such as a line, region, polygon, etc."
|
|
23
24
|
|
|
24
|
-
override apply(target: Desmos.ExpressionState, data: DesmosColour)
|
|
25
|
+
override apply(target: Desmos.ExpressionState, data: DesmosColour | HexColour)
|
|
25
26
|
{
|
|
26
27
|
super.require_expr_type(target.type, "expression");
|
|
27
28
|
target.color = data;
|
|
28
29
|
}
|
|
29
30
|
|
|
30
|
-
override evaluate_arg(data: string, options: DesmostOptions): DesmosColour
|
|
31
|
+
override evaluate_arg(data: string, options: DesmostOptions): DesmosColour | HexColour
|
|
31
32
|
{
|
|
32
33
|
let colour = data.trim().toUpperCase();
|
|
33
34
|
|
|
@@ -36,15 +37,16 @@ export class ColourIncantation extends ArgIncantation<LOCAL>
|
|
|
36
37
|
}
|
|
37
38
|
else {
|
|
38
39
|
let internal = Desmos.Colors[colour as DesmosColourName];
|
|
40
|
+
if (internal != undefined) return internal;
|
|
39
41
|
|
|
40
|
-
if (options.check_args &&
|
|
42
|
+
if (options.check_args && !colour.startsWith("#")) {
|
|
41
43
|
throw new DesmostError.InvalidArgument({
|
|
42
44
|
msg: `/colour received invalid colour: \`${data}\``,
|
|
43
45
|
hint: `Valid colours are ${VALID_COLOURS.join(", ")}`,
|
|
44
46
|
});
|
|
45
47
|
}
|
|
46
48
|
|
|
47
|
-
return
|
|
49
|
+
return colour;
|
|
48
50
|
}
|
|
49
51
|
}
|
|
50
52
|
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Incantation, type LOCAL } from "../incantation";
|
|
2
|
+
|
|
3
|
+
import { Ast } from "../../parser";
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
export class DottedIncantation extends Incantation<LOCAL>
|
|
7
|
+
{
|
|
8
|
+
override readonly effect = Incantation.Effect.LOCAL
|
|
9
|
+
override readonly identifier = "dotted"
|
|
10
|
+
override readonly description
|
|
11
|
+
= "Render a block as a dotted line."
|
|
12
|
+
|
|
13
|
+
override apply(target: Desmos.ExpressionState)
|
|
14
|
+
{
|
|
15
|
+
super.require_expr_type(target.type, "expression");
|
|
16
|
+
target.lineStyle = Desmos.Styles.DOTTED;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
override extract(target: Desmos.Expression): Ast.IncantationInvocation<LOCAL> | void
|
|
20
|
+
{
|
|
21
|
+
if (target.lineStyle === Desmos.Styles.DOTTED) {
|
|
22
|
+
return {
|
|
23
|
+
kind: Ast.Kind.INCANTATION_INVOCATION,
|
|
24
|
+
incantation: dotted,
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export const dotted = new DottedIncantation();
|
package/src/magic/local/index.ts
CHANGED
|
@@ -3,10 +3,12 @@ import { Incantation, type LOCAL } from "../incantation";
|
|
|
3
3
|
import { anim } from "./anim";
|
|
4
4
|
import { colour } from "./colour";
|
|
5
5
|
import { dashed } from "./dashed";
|
|
6
|
+
import { dotted } from "./dotted";
|
|
6
7
|
import { fill } from "./fill";
|
|
7
8
|
import { hide } from "./hide";
|
|
8
9
|
import { label } from "./label";
|
|
9
10
|
import { line } from "./line";
|
|
11
|
+
import { no_fill } from "./no-fill";
|
|
10
12
|
import { no_line } from "./no-line";
|
|
11
13
|
import { point } from "./point";
|
|
12
14
|
import { secret } from "./secret";
|
|
@@ -17,10 +19,12 @@ export const LOCAL_INCANTATIONS = {
|
|
|
17
19
|
anim,
|
|
18
20
|
colour,
|
|
19
21
|
dashed,
|
|
22
|
+
dotted,
|
|
20
23
|
fill,
|
|
21
24
|
hide,
|
|
22
25
|
label,
|
|
23
26
|
line,
|
|
27
|
+
no_fill,
|
|
24
28
|
no_line,
|
|
25
29
|
point,
|
|
26
30
|
secret,
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Incantation, type LOCAL } from "../incantation";
|
|
2
|
+
|
|
3
|
+
import { Ast } from "../../parser";
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
export class NoFillIncantation extends Incantation<LOCAL>
|
|
7
|
+
{
|
|
8
|
+
override readonly effect = Incantation.Effect.LOCAL
|
|
9
|
+
override readonly identifier = "no-fill"
|
|
10
|
+
override readonly description
|
|
11
|
+
= "Disable rendering fill for a block."
|
|
12
|
+
|
|
13
|
+
override apply(target: Desmos.ExpressionState)
|
|
14
|
+
{
|
|
15
|
+
super.require_expr_type(target.type, "expression");
|
|
16
|
+
target.fill = false;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
override extract(target: Desmos.Expression): Ast.IncantationInvocation<LOCAL> | void
|
|
20
|
+
{
|
|
21
|
+
if (target.fill === false) {
|
|
22
|
+
return {
|
|
23
|
+
kind: Ast.Kind.INCANTATION_INVOCATION,
|
|
24
|
+
incantation: no_fill,
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export const no_fill = new NoFillIncantation();
|
|
@@ -5,7 +5,7 @@ import { Ast } from "../../parser";
|
|
|
5
5
|
|
|
6
6
|
export class NoLineIncantation extends Incantation<LOCAL>
|
|
7
7
|
{
|
|
8
|
-
override readonly effect
|
|
8
|
+
override readonly effect = Incantation.Effect.LOCAL
|
|
9
9
|
override readonly identifier = "no-line"
|
|
10
10
|
override readonly description
|
|
11
11
|
= "Disable rendering lines for a block."
|
package/src/magic/local/point.ts
CHANGED
|
@@ -8,6 +8,7 @@ interface PointStyles
|
|
|
8
8
|
style?: keyof typeof Desmos.Styles;
|
|
9
9
|
size?: number;
|
|
10
10
|
opacity?: number;
|
|
11
|
+
drag: keyof typeof Desmos.DragModes;
|
|
11
12
|
}
|
|
12
13
|
|
|
13
14
|
|
|
@@ -18,7 +19,7 @@ export class PointIncantation extends ArgIncantation<LOCAL>
|
|
|
18
19
|
override readonly requires_arg = true
|
|
19
20
|
override readonly arg_type = Incantation.ArgType.OBJECT
|
|
20
21
|
override readonly description
|
|
21
|
-
= ""
|
|
22
|
+
= "Change point styles for a rendered block."
|
|
22
23
|
|
|
23
24
|
override apply(target: Desmos.ExpressionState, data: Partial<PointStyles>)
|
|
24
25
|
{
|
|
@@ -27,6 +28,7 @@ export class PointIncantation extends ArgIncantation<LOCAL>
|
|
|
27
28
|
if (data.style != undefined) target.pointStyle = data.style;
|
|
28
29
|
if (data.size != undefined) target.pointSize = data.size;
|
|
29
30
|
if (data.opacity != undefined) target.pointOpacity = data.opacity;
|
|
31
|
+
if (data.drag != undefined) target.dragMode = data.drag;
|
|
30
32
|
}
|
|
31
33
|
|
|
32
34
|
override extract(target: Desmos.Expression): Ast.IncantationInvocation<LOCAL> | void
|
|
@@ -35,6 +37,7 @@ export class PointIncantation extends ArgIncantation<LOCAL>
|
|
|
35
37
|
target.pointStyle && target.pointStyle !== Desmos.Styles.POINT
|
|
36
38
|
|| target.pointSize
|
|
37
39
|
|| target.pointOpacity
|
|
40
|
+
|| target.dragMode && target.dragMode !== Desmos.DragModes.AUTO
|
|
38
41
|
)
|
|
39
42
|
{
|
|
40
43
|
return {
|
|
@@ -44,6 +47,7 @@ export class PointIncantation extends ArgIncantation<LOCAL>
|
|
|
44
47
|
style: target.pointStyle,
|
|
45
48
|
size: target.pointSize,
|
|
46
49
|
opacity: target.pointOpacity,
|
|
50
|
+
drag: target.dragMode,
|
|
47
51
|
}),
|
|
48
52
|
};
|
|
49
53
|
}
|