@spidunno/desmos-types 1.13.7 → 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 +2 -2
- 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 +1 -1
- package/module/internals.d.ts +122 -3
- package/package.json +1 -1
- package/types/mathquill.d.ts +1 -1
package/module/index.d.ts
CHANGED
|
@@ -2044,7 +2044,7 @@ declare namespace Desmos {
|
|
|
2044
2044
|
/** Set global MathQuill configuration. */
|
|
2045
2045
|
config(config: MathQuillConfig): void;
|
|
2046
2046
|
/** The MathQuill API instance attached to `element`, if any. */
|
|
2047
|
-
getApiInstanceForElement(element:
|
|
2047
|
+
getApiInstanceForElement(element: Element): MathQuillStaticMath | MathQuillMathField | null | undefined;
|
|
2048
2048
|
}
|
|
2049
2049
|
|
|
2050
2050
|
/** @remarks Undocumented: may change without notice. */
|
package/module/internals.d.ts
CHANGED
|
@@ -2044,7 +2044,7 @@ declare namespace Desmos {
|
|
|
2044
2044
|
/** Set global MathQuill configuration. */
|
|
2045
2045
|
config(config: MathQuillConfig): void;
|
|
2046
2046
|
/** The MathQuill API instance attached to `element`, if any. */
|
|
2047
|
-
getApiInstanceForElement(element:
|
|
2047
|
+
getApiInstanceForElement(element: Element): MathQuillStaticMath | MathQuillMathField | null | undefined;
|
|
2048
2048
|
}
|
|
2049
2049
|
|
|
2050
2050
|
/** @remarks Undocumented: may change without notice. */
|
|
@@ -7300,6 +7300,55 @@ declare namespace Desmos.Internals {
|
|
|
7300
7300
|
};
|
|
7301
7301
|
}
|
|
7302
7302
|
|
|
7303
|
+
// ---------------------------------------------------------------------------
|
|
7304
|
+
// Grid layer
|
|
7305
|
+
// ---------------------------------------------------------------------------
|
|
7306
|
+
|
|
7307
|
+
/**
|
|
7308
|
+
* Grid spacing in math units: the axis step settings if they fit, otherwise
|
|
7309
|
+
* steps picked so the axis numbers don't overlap. A minor step of 0 means no
|
|
7310
|
+
* minor lines; both are NaN on a logarithmic axis.
|
|
7311
|
+
*/
|
|
7312
|
+
interface GridSteps {
|
|
7313
|
+
majorStepX: number;
|
|
7314
|
+
minorStepX: number;
|
|
7315
|
+
majorStepY: number;
|
|
7316
|
+
minorStepY: number;
|
|
7317
|
+
}
|
|
7318
|
+
|
|
7319
|
+
/** Where a logarithmic axis draws its lines (a linear axis has empty lists). */
|
|
7320
|
+
interface LogAxisGrid {
|
|
7321
|
+
label: number[];
|
|
7322
|
+
major: number[];
|
|
7323
|
+
minor: number[];
|
|
7324
|
+
/** Multiplies the minor line opacity; fades minor lines as decades shrink. */
|
|
7325
|
+
unitOpacity: number;
|
|
7326
|
+
}
|
|
7327
|
+
|
|
7328
|
+
interface LogGrid {
|
|
7329
|
+
x: LogAxisGrid;
|
|
7330
|
+
y: LogAxisGrid;
|
|
7331
|
+
}
|
|
7332
|
+
|
|
7333
|
+
/**
|
|
7334
|
+
* `grapher2d.gridLayer` (also `privateGetGridLayer()`): draws the grid,
|
|
7335
|
+
* axes and axis numbers, under every graph.
|
|
7336
|
+
*
|
|
7337
|
+
* Lines are drawn 1px wide at `Math.round(px - 0.5) + 0.5`, in the text
|
|
7338
|
+
* color: minor lines at `minorAxisOpacity`, then major lines over them at
|
|
7339
|
+
* an opacity that composites to `majorAxisOpacity`. Lines on the edges of
|
|
7340
|
+
* the screen, and at 0 when that axis is shown, are skipped.
|
|
7341
|
+
*/
|
|
7342
|
+
interface GridLayer extends Generated.Grapher2DGridLayer {
|
|
7343
|
+
/**
|
|
7344
|
+
* Draw the whole layer. The main redraw passes `grapher2d.scaleAxis`
|
|
7345
|
+
* (the axis being dragged, highlighted); screenshots pass only `context`.
|
|
7346
|
+
*/
|
|
7347
|
+
redrawToCtx(context: DrawContext, scaleAxis?: 'x' | 'y' | 'both'): void;
|
|
7348
|
+
drawCartesianGrid(ctx: CanvasRenderingContext2D, projection: Projection, steps: GridSteps, logGrid?: LogGrid): void;
|
|
7349
|
+
drawPolarGrid(ctx: CanvasRenderingContext2D, projection: Projection, steps: { majorStepR: number; minorStepR: number }): void;
|
|
7350
|
+
}
|
|
7351
|
+
|
|
7303
7352
|
/**
|
|
7304
7353
|
* Options accepted by the grapher's own screenshot methods. The public
|
|
7305
7354
|
* `asyncScreenshot` handles `mode` and `mathBounds` itself and passes the
|
|
@@ -7413,6 +7462,9 @@ declare namespace Desmos.Internals {
|
|
|
7413
7462
|
settings: GrapherSettings;
|
|
7414
7463
|
events: GrapherEvents;
|
|
7415
7464
|
viewportController: ViewportController;
|
|
7465
|
+
/** Draws the grid, axes and axis numbers. */
|
|
7466
|
+
gridLayer: GridLayer;
|
|
7467
|
+
privateGetGridLayer(): GridLayer;
|
|
7416
7468
|
__projection: Projection;
|
|
7417
7469
|
/** The viewport at the last animation frame (unset before the first one); used to detect viewport changes. */
|
|
7418
7470
|
lastTickViewport?: Viewport;
|
|
@@ -7754,7 +7806,63 @@ declare namespace Desmos.Internals {
|
|
|
7754
7806
|
controller: Controller;
|
|
7755
7807
|
}
|
|
7756
7808
|
|
|
7757
|
-
|
|
7809
|
+
/** A point in 3D math coordinates. */
|
|
7810
|
+
interface Point3D {
|
|
7811
|
+
x: number;
|
|
7812
|
+
y: number;
|
|
7813
|
+
z: number;
|
|
7814
|
+
}
|
|
7815
|
+
|
|
7816
|
+
/** What the 3D grapher's worker found under the mouse. */
|
|
7817
|
+
interface PickResult3D {
|
|
7818
|
+
/** Where the ray from the mouse hit, in math coordinates. */
|
|
7819
|
+
point: Point3D;
|
|
7820
|
+
}
|
|
7821
|
+
|
|
7822
|
+
/** `grapher3d.controls`: mouse, touch and keyboard handling for the 3D graph paper. */
|
|
7823
|
+
interface Grapher3DControls {
|
|
7824
|
+
grapher3d: Grapher3D;
|
|
7825
|
+
/** The graph paper element (`grapher3d.elt`). Desmos's wheel handler is attached here. */
|
|
7826
|
+
domElement: HTMLElement;
|
|
7827
|
+
/** -1 when idle, 0 while rotating with the mouse. */
|
|
7828
|
+
state: -1 | 0;
|
|
7829
|
+
/** Rotation speed while the graph is spinning, 0 when it isn't. */
|
|
7830
|
+
speed3D: number;
|
|
7831
|
+
/**
|
|
7832
|
+
* `performance.now()` of the last wheel zoom, or 0. The tick calls
|
|
7833
|
+
* `grapher3d.endZoom()` and resets it 100ms after the last one.
|
|
7834
|
+
*/
|
|
7835
|
+
lastWheelEventTime: number;
|
|
7836
|
+
/** Whether zoom and pan are disabled. */
|
|
7837
|
+
isLocked(): boolean;
|
|
7838
|
+
/** Whether rotating is disabled (the user lock, or the page is pinch zoomed). */
|
|
7839
|
+
isRotationLocked(): boolean;
|
|
7840
|
+
/** Set the viewport and commit it to history after a short delay. */
|
|
7841
|
+
updateViewport(viewport: ViewportObject): void;
|
|
7842
|
+
}
|
|
7843
|
+
|
|
7844
|
+
/** `grapher3d.viewportController`. */
|
|
7845
|
+
interface Grapher3DViewportController {
|
|
7846
|
+
getViewport(): Viewport;
|
|
7847
|
+
/**
|
|
7848
|
+
* Jump to a viewport. Invalid axes keep their current bounds, and each
|
|
7849
|
+
* axis is clamped to a width between 1.34e-4 × its largest bound (at
|
|
7850
|
+
* least 1.34e-4) and 134000, within ±67000.
|
|
7851
|
+
*/
|
|
7852
|
+
setCurrentViewport(viewport: ViewportObject): void;
|
|
7853
|
+
}
|
|
7854
|
+
|
|
7855
|
+
interface Grapher3D extends Generated.Grapher3D {
|
|
7856
|
+
controls: Grapher3DControls;
|
|
7857
|
+
viewportController: Grapher3DViewportController;
|
|
7858
|
+
/** The 3D viewport always has z bounds (Desmos fills in defaults). */
|
|
7859
|
+
getProjection(): { viewport: Viewport & { zmin: number; zmax: number } };
|
|
7860
|
+
/**
|
|
7861
|
+
* What's under the mouse, used as the center when zooming in with the
|
|
7862
|
+
* scroll wheel. Undefined while the graph is spinning, or over nothing.
|
|
7863
|
+
*/
|
|
7864
|
+
getZoomScrollWheelPickResult(): PickResult3D | null | undefined;
|
|
7865
|
+
}
|
|
7758
7866
|
|
|
7759
7867
|
interface Evaluator extends Generated.Evaluator {}
|
|
7760
7868
|
|
|
@@ -8165,6 +8273,17 @@ declare namespace Desmos.Internals {
|
|
|
8165
8273
|
|
|
8166
8274
|
type FragileViewClass<P, Members> = DCGView.ViewClass<P, FragileView<P, Members>>;
|
|
8167
8275
|
|
|
8276
|
+
/** Static helpers on `Fragile.MathquillView`. */
|
|
8277
|
+
interface MathquillViewStatics {
|
|
8278
|
+
/** The math field containing `document.activeElement`, if it's in one. */
|
|
8279
|
+
getFocusedMathquill(): Desmos.MathQuillMathField | undefined;
|
|
8280
|
+
/**
|
|
8281
|
+
* Apply an arrow key to a math field. Returns true if the cursor was
|
|
8282
|
+
* already at that edge (so focus should move to the next item).
|
|
8283
|
+
*/
|
|
8284
|
+
applyArrowKeyAndReturnIfWasAtBounds(mathField: Desmos.MathQuillMathField, key: string, event: KeyboardEvent): boolean;
|
|
8285
|
+
}
|
|
8286
|
+
|
|
8168
8287
|
/** The view classes on `Private.Fragile`. */
|
|
8169
8288
|
interface FragileViews {
|
|
8170
8289
|
ExpressionView: FragileViewClass<ExpressionViewProps, Generated.ExpressionViewMembers>;
|
|
@@ -8173,7 +8292,7 @@ declare namespace Desmos.Internals {
|
|
|
8173
8292
|
ExpressionOptionsMenuView: FragileViewClass<ExpressionOptionsMenuViewProps, Generated.ExpressionOptionsMenuViewMembers>;
|
|
8174
8293
|
ImageIconView: FragileViewClass<ImageIconViewProps, Generated.ImageIconViewMembers>;
|
|
8175
8294
|
PromptSliderView: FragileViewClass<PromptSliderViewProps, Generated.PromptSliderViewMembers>;
|
|
8176
|
-
MathquillView: FragileViewClass<MathquillViewProps, Generated.MathquillViewMembers
|
|
8295
|
+
MathquillView: FragileViewClass<MathquillViewProps, Generated.MathquillViewMembers> & MathquillViewStatics;
|
|
8177
8296
|
InlineMathInputView: FragileViewClass<InlineMathInputViewProps, Generated.InlineMathInputViewMembers>;
|
|
8178
8297
|
StaticMathquillView: FragileViewClass<StaticMathquillViewProps, Generated.StaticMathquillViewMembers>;
|
|
8179
8298
|
Checkbox: FragileViewClass<CheckboxProps, Generated.CheckboxMembers>;
|
package/package.json
CHANGED
package/types/mathquill.d.ts
CHANGED
|
@@ -52,7 +52,7 @@ declare namespace Desmos {
|
|
|
52
52
|
/** Set global MathQuill configuration. */
|
|
53
53
|
config(config: MathQuillConfig): void;
|
|
54
54
|
/** The MathQuill API instance attached to `element`, if any. */
|
|
55
|
-
getApiInstanceForElement(element:
|
|
55
|
+
getApiInstanceForElement(element: Element): MathQuillStaticMath | MathQuillMathField | null | undefined;
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
/** @remarks Undocumented: may change without notice. */
|