@spidunno/desmos-types 1.13.6 → 1.13.8
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 +4 -3
- package/internals/controller.d.ts +57 -1
- package/internals/fragile.d.ts +12 -1
- package/internals/grapher2d.d.ts +643 -591
- package/module/index.d.ts +177 -26
- package/module/internals.d.ts +298 -28
- package/package.json +1 -1
- package/types/mathquill.d.ts +1 -1
- package/types/options/graphing.d.ts +176 -25
package/README.md
CHANGED
|
@@ -6,11 +6,11 @@ the graphing calculator, geometry tool, 3D calculator, and the four-function and
|
|
|
6
6
|
## Install
|
|
7
7
|
|
|
8
8
|
```sh
|
|
9
|
-
npm install --save-dev @spidunno/desmos-types@~1.13.
|
|
9
|
+
npm install --save-dev @spidunno/desmos-types@~1.13.8
|
|
10
10
|
```
|
|
11
11
|
|
|
12
12
|
The package's major and minor version match the Desmos API version it describes; patch releases
|
|
13
|
-
are fixes to the types. Use a tilde range (`~1.13.
|
|
13
|
+
are fixes to the types. Use a tilde range (`~1.13.8`), not npm's default caret (`^`), so you only
|
|
14
14
|
get type fixes for the API version you load.
|
|
15
15
|
|
|
16
16
|
## Usage
|
|
@@ -124,7 +124,8 @@ members are typed separately (see [Internals](#internals)). `Desmos.TestInternal
|
|
|
124
124
|
- `Desmos.Colors.GREEN` is `#348543`, not the documented `#388c46`. The palette still cycles through `#388c46` for new items.
|
|
125
125
|
- `asyncScreenshot()` without a `mode` uses `'preserveX'` when the axes are square and `'stretch'` otherwise, not the documented `'contain'`.
|
|
126
126
|
- On `Calculator3D`, `asyncScreenshot()` always throws, and `mathToPixels` / `pixelsToMath` are `undefined`. The types leave all three out.
|
|
127
|
-
- `
|
|
127
|
+
- The calculator accepts many options the docs don't mention, such as `complex`, `restrictGridToFirstQuadrant` and `advancedStyling`. All of them are typed (as `UndocumentedGraphingCalculatorConfig`, `InternalGraphingCalculatorOptions` and the undocumented members of `GraphSettings`), along with the deprecated aliases (`menus`, `solutions`, ...), which are marked `@deprecated`.
|
|
128
|
+
- `substitutions`, `regressionTemplates`, `intervalComprehensions`, `recursion` and the internal and deprecated options are accepted but never appear on `calculator.settings`.
|
|
128
129
|
- `setMathBounds()` also accepts `{ xmin, xmax, ymin, ymax }`, plus `zmin` / `zmax` on 3D.
|
|
129
130
|
|
|
130
131
|
## Internals
|
|
@@ -225,7 +225,63 @@ declare namespace Desmos.Internals {
|
|
|
225
225
|
controller: Controller;
|
|
226
226
|
}
|
|
227
227
|
|
|
228
|
-
|
|
228
|
+
/** A point in 3D math coordinates. */
|
|
229
|
+
interface Point3D {
|
|
230
|
+
x: number;
|
|
231
|
+
y: number;
|
|
232
|
+
z: number;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
/** What the 3D grapher's worker found under the mouse. */
|
|
236
|
+
interface PickResult3D {
|
|
237
|
+
/** Where the ray from the mouse hit, in math coordinates. */
|
|
238
|
+
point: Point3D;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
/** `grapher3d.controls`: mouse, touch and keyboard handling for the 3D graph paper. */
|
|
242
|
+
interface Grapher3DControls {
|
|
243
|
+
grapher3d: Grapher3D;
|
|
244
|
+
/** The graph paper element (`grapher3d.elt`). Desmos's wheel handler is attached here. */
|
|
245
|
+
domElement: HTMLElement;
|
|
246
|
+
/** -1 when idle, 0 while rotating with the mouse. */
|
|
247
|
+
state: -1 | 0;
|
|
248
|
+
/** Rotation speed while the graph is spinning, 0 when it isn't. */
|
|
249
|
+
speed3D: number;
|
|
250
|
+
/**
|
|
251
|
+
* `performance.now()` of the last wheel zoom, or 0. The tick calls
|
|
252
|
+
* `grapher3d.endZoom()` and resets it 100ms after the last one.
|
|
253
|
+
*/
|
|
254
|
+
lastWheelEventTime: number;
|
|
255
|
+
/** Whether zoom and pan are disabled. */
|
|
256
|
+
isLocked(): boolean;
|
|
257
|
+
/** Whether rotating is disabled (the user lock, or the page is pinch zoomed). */
|
|
258
|
+
isRotationLocked(): boolean;
|
|
259
|
+
/** Set the viewport and commit it to history after a short delay. */
|
|
260
|
+
updateViewport(viewport: ViewportObject): void;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
/** `grapher3d.viewportController`. */
|
|
264
|
+
interface Grapher3DViewportController {
|
|
265
|
+
getViewport(): Viewport;
|
|
266
|
+
/**
|
|
267
|
+
* Jump to a viewport. Invalid axes keep their current bounds, and each
|
|
268
|
+
* axis is clamped to a width between 1.34e-4 × its largest bound (at
|
|
269
|
+
* least 1.34e-4) and 134000, within ±67000.
|
|
270
|
+
*/
|
|
271
|
+
setCurrentViewport(viewport: ViewportObject): void;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
interface Grapher3D extends Generated.Grapher3D {
|
|
275
|
+
controls: Grapher3DControls;
|
|
276
|
+
viewportController: Grapher3DViewportController;
|
|
277
|
+
/** The 3D viewport always has z bounds (Desmos fills in defaults). */
|
|
278
|
+
getProjection(): { viewport: Viewport & { zmin: number; zmax: number } };
|
|
279
|
+
/**
|
|
280
|
+
* What's under the mouse, used as the center when zooming in with the
|
|
281
|
+
* scroll wheel. Undefined while the graph is spinning, or over nothing.
|
|
282
|
+
*/
|
|
283
|
+
getZoomScrollWheelPickResult(): PickResult3D | null | undefined;
|
|
284
|
+
}
|
|
229
285
|
|
|
230
286
|
interface Evaluator extends Generated.Evaluator {}
|
|
231
287
|
|
package/internals/fragile.d.ts
CHANGED
|
@@ -168,6 +168,17 @@ declare namespace Desmos.Internals {
|
|
|
168
168
|
|
|
169
169
|
type FragileViewClass<P, Members> = DCGView.ViewClass<P, FragileView<P, Members>>;
|
|
170
170
|
|
|
171
|
+
/** Static helpers on `Fragile.MathquillView`. */
|
|
172
|
+
interface MathquillViewStatics {
|
|
173
|
+
/** The math field containing `document.activeElement`, if it's in one. */
|
|
174
|
+
getFocusedMathquill(): Desmos.MathQuillMathField | undefined;
|
|
175
|
+
/**
|
|
176
|
+
* Apply an arrow key to a math field. Returns true if the cursor was
|
|
177
|
+
* already at that edge (so focus should move to the next item).
|
|
178
|
+
*/
|
|
179
|
+
applyArrowKeyAndReturnIfWasAtBounds(mathField: Desmos.MathQuillMathField, key: string, event: KeyboardEvent): boolean;
|
|
180
|
+
}
|
|
181
|
+
|
|
171
182
|
/** The view classes on `Private.Fragile`. */
|
|
172
183
|
interface FragileViews {
|
|
173
184
|
ExpressionView: FragileViewClass<ExpressionViewProps, Generated.ExpressionViewMembers>;
|
|
@@ -176,7 +187,7 @@ declare namespace Desmos.Internals {
|
|
|
176
187
|
ExpressionOptionsMenuView: FragileViewClass<ExpressionOptionsMenuViewProps, Generated.ExpressionOptionsMenuViewMembers>;
|
|
177
188
|
ImageIconView: FragileViewClass<ImageIconViewProps, Generated.ImageIconViewMembers>;
|
|
178
189
|
PromptSliderView: FragileViewClass<PromptSliderViewProps, Generated.PromptSliderViewMembers>;
|
|
179
|
-
MathquillView: FragileViewClass<MathquillViewProps, Generated.MathquillViewMembers
|
|
190
|
+
MathquillView: FragileViewClass<MathquillViewProps, Generated.MathquillViewMembers> & MathquillViewStatics;
|
|
180
191
|
InlineMathInputView: FragileViewClass<InlineMathInputViewProps, Generated.InlineMathInputViewMembers>;
|
|
181
192
|
StaticMathquillView: FragileViewClass<StaticMathquillViewProps, Generated.StaticMathquillViewMembers>;
|
|
182
193
|
Checkbox: FragileViewClass<CheckboxProps, Generated.CheckboxMembers>;
|