@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/module/index.d.ts CHANGED
@@ -568,12 +568,182 @@ declare namespace Desmos {
568
568
  * @defaultValue a random 128-bit hex string
569
569
  */
570
570
  randomSeed?: string;
571
+ /**
572
+ * Turn on Complex Mode, so expressions can use complex numbers. Ignored
573
+ * (forced to `false`) when `allowComplex` is `false`, and turns off
574
+ * `degreeMode`.
575
+ * @defaultValue `false`
576
+ * @remarks Undocumented.
577
+ */
578
+ complex?: boolean;
579
+ /**
580
+ * Draw the grid, axes and numbers only in the first quadrant.
581
+ * @defaultValue `false`
582
+ * @remarks Undocumented.
583
+ */
584
+ restrictGridToFirstQuadrant?: boolean;
585
+ /**
586
+ * The "lock viewport" toggle in the graph settings, which stops the user
587
+ * from panning and zooming. Unlike `lockViewport`, it is part of the graph
588
+ * state.
589
+ * @defaultValue `false`
590
+ * @remarks Undocumented.
591
+ */
592
+ userLockedViewport?: boolean;
593
+ }
594
+
595
+ /**
596
+ * Configuration options the docs don't mention that still appear on
597
+ * `calculator.settings`.
598
+ *
599
+ * @remarks Undocumented: may change without notice.
600
+ */
601
+ interface UndocumentedGraphingCalculatorConfig {
602
+ /**
603
+ * Show the author features enabled by `authorFeatures`. With `false`, they
604
+ * stay available but hidden, as when an author previews the student view.
605
+ * @defaultValue `true`
606
+ */
607
+ authorMode?: boolean;
608
+ /** Allow the advanced styling options in the style menu. @defaultValue `false` */
609
+ advancedStyling?: boolean;
610
+ /** Allow defining functions, like `f(x)=x^2`. @defaultValue `true` */
611
+ functionDefinition?: boolean;
612
+ /** 3D: put the viewport controls on the left instead of the right. @defaultValue `false` */
613
+ leftAlign3dViewportControls?: boolean;
614
+ /** 3D: draw surfaces with their opacity. When `false`, surfaces are opaque. @defaultValue `false` */
615
+ translucentSurfaces?: boolean;
616
+ /** Show keyboard shortcuts in tooltips. @defaultValue `false` */
617
+ showKeyboardShortcutsInTooltips?: boolean;
618
+ /** Show a performance meter over the graph paper. @defaultValue `false` */
619
+ showPerformanceMeter?: boolean;
620
+ }
621
+
622
+ /**
623
+ * Options Desmos uses for its own products, debugging and embedding. They
624
+ * are accepted by the constructor and `updateSettings()` but never appear
625
+ * on `calculator.settings`.
626
+ *
627
+ * @remarks Undocumented: may change without notice.
628
+ */
629
+ interface InternalGraphingCalculatorOptions {
630
+ /**
631
+ * Which product the calculator behaves as. `Desmos.Geometry` and
632
+ * `Desmos.Calculator3D` set this themselves.
633
+ * @defaultValue `'graphing'`
634
+ */
635
+ product?: 'graphing' | 'geometry-calculator' | 'graphing-3d';
636
+ /** Show the Desmos branding on the graph paper. @defaultValue `true` */
637
+ branding?: boolean;
638
+ /** Only trace and show points of interest for the selected expression. @defaultValue `false` */
639
+ onlyTraceSelected?: boolean;
640
+ /** Ignore mouse and touch input on the graph paper. @defaultValue `false` */
641
+ disableMouseInteractions?: boolean;
642
+ /** Accepted, but not read anywhere in the v1.13 bundle. @defaultValue `false` */
643
+ nativeOnscreenKeypad?: boolean;
644
+ /** 3D: draw surfaces as wireframes. @defaultValue `false` */
645
+ wireframe?: boolean;
646
+ /** 3D: debug rendering that shows ray-casting cost as a heat map. @defaultValue `false` */
647
+ raycastHeatmap?: boolean;
648
+ /** 3D: debugging flag for surface cost estimates (shows them in the expression list). @defaultValue `false` */
649
+ ignoreCostEstimate?: boolean;
650
+ /** 3D: ray-cast without interval arithmetic (debugging). @defaultValue `false` */
651
+ raycastDisableIntervals?: boolean;
652
+ /**
653
+ * With `pasteGraphLink`, called with the state of a pasted graph link
654
+ * before it is imported. Call `done(null, state)` to import it (possibly
655
+ * modified), or `done(error)` to reject it.
656
+ * @defaultValue imports the state unchanged
657
+ */
658
+ pasteGraphLinkCallback?: (state: GraphState, done: (error: unknown, state?: GraphState) => void) => void;
659
+ /** Link the branding to desmos.com, where the graph can be edited. @defaultValue `false` */
660
+ editOnWeb?: boolean;
661
+ /** Desmos testing: post the cross-origin save test to the current origin. @defaultValue `false` */
662
+ crossOriginSaveTest?: boolean;
663
+ /** Make the graph paper and its objects reachable with Tab. @defaultValue `true` */
664
+ enableTabindex?: boolean;
665
+ /** Audio Trace: step through expressions in reverse order. @defaultValue `false` */
666
+ audioTraceReverseExpressions?: boolean;
667
+ /** Draw the graph paper with a transparent background. @defaultValue `false` */
668
+ transparentBackground?: boolean;
669
+ /** Stop animating while the calculator is scrolled out of view. @defaultValue `false` */
670
+ pauseWhenOffscreen?: boolean;
671
+ /** 3D: release the WebGL context while the calculator is out of view. @defaultValue `true` */
672
+ releaseContextWhenOffscreen?: boolean;
673
+ /** Geometry: hide the geometry toolbar and tools. @defaultValue `false` */
674
+ hideGeoUI?: boolean;
675
+ /** 3D: beta features, such as per-surface resolution and translucent surfaces. @defaultValue `false` */
676
+ beta3d?: boolean;
677
+ /** Allow strings (categorical data) in expressions. @defaultValue `false` */
678
+ categoricalData?: boolean;
679
+ /** Pause the evaluator while the user is zooming. @defaultValue `false` */
680
+ disableWorkerOnZoom?: boolean;
681
+ /** Cache rendered SVG images. @defaultValue `false` */
682
+ cacheRenderedSvgs?: boolean;
683
+ /** Graph hidden expressions too (the "ghost mode" checkbox in advanced settings). @defaultValue `false` */
684
+ ghostMode?: boolean;
685
+ /** Geometry: draw an arc on reflection previews. @defaultValue `false` */
686
+ reflectionArc?: boolean;
687
+ /** Log the evaluator's internal errors to the console. @defaultValue `false` */
688
+ logInternalErrors?: boolean;
689
+ /** Show the compiler debugging panel. @defaultValue `false` */
690
+ debugCompiler?: boolean;
691
+ /** Show each item's id in the expression list. @defaultValue `false` */
692
+ showIDs?: boolean;
693
+ /** Show the evaluator's progress on each item, with a legend. @defaultValue `false` */
694
+ debugProgressUpdates?: boolean;
695
+ /** Maximum depth of recursive function calls, from 1 to 1,000,000. @defaultValue the evaluator's built-in limit */
696
+ recursionDepthLimit?: number;
697
+ /** Never narrate coordinates to screen readers, except during Audio Trace. @defaultValue `false` */
698
+ reportPositionNone?: boolean;
699
+ /** The calculator is embedded in a Desmos notebook. @defaultValue `false` */
700
+ insideDesNotebook?: boolean;
701
+ /** The expression list is rendered outside the calculator (split panel). @defaultValue `false` */
702
+ expressionsExternal?: boolean;
703
+ /** 3D: show the orientation buttons. @defaultValue `true` */
704
+ orientationButtons?: boolean;
705
+ /** Accepted, but not read anywhere in the v1.13 bundle. */
706
+ debug3dRender?: unknown;
707
+ /** 3D: force this many depth-peeling layers for translucent surfaces. @defaultValue chosen from the scene */
708
+ debugPeelLayers?: number;
709
+ /** 3D: choose the number of depth-peeling layers from the scene. @defaultValue `true` */
710
+ adaptivePeeling?: boolean;
711
+ /** Accepted, but not read anywhere in the v1.13 bundle. */
712
+ debugPixelRatio?: unknown;
713
+ /** 3D: opacity (as LaTeX) given to new translucent surfaces. @defaultValue `'0.8'` */
714
+ translucentOpacity?: Latex;
715
+ /** 3D: samples per pixel for depth peeling. @defaultValue chosen from the device pixel ratio */
716
+ peelUpsample?: number;
717
+ /** 3D: render surfaces by ray casting. @defaultValue `false` */
718
+ rayCast?: boolean;
719
+ }
720
+
721
+ /**
722
+ * Old options that still work: the calculator logs a deprecation warning
723
+ * and sets the replacement.
724
+ */
725
+ interface DeprecatedGraphingCalculatorOptions {
726
+ /** @deprecated Use `settingsMenu` and `expressionsTopbar`, which this sets. */
727
+ menus?: boolean;
728
+ /** @deprecated Use `pointsOfInterest`, which this sets. */
729
+ solutions?: boolean;
730
+ /** @deprecated Removed in API v1.0; ignored. */
731
+ singleVariableSolutions?: boolean;
732
+ /** @deprecated Use `actions`; `true` sets `actions: true`. */
733
+ clickableObjects?: boolean;
734
+ /** @deprecated Use `authorFeatures`, which this sets. */
735
+ administerSecretFolders?: boolean;
571
736
  }
572
737
 
573
738
  type AxisScale = 'linear' | 'logarithmic';
574
739
 
575
740
  /** Everything that can be passed to the `GraphingCalculator` constructor or `updateSettings()`. */
576
- interface GraphingCalculatorOptions extends GraphingCalculatorConfig, GraphSettings {}
741
+ interface GraphingCalculatorOptions
742
+ extends GraphingCalculatorConfig,
743
+ GraphSettings,
744
+ UndocumentedGraphingCalculatorConfig,
745
+ InternalGraphingCalculatorOptions,
746
+ DeprecatedGraphingCalculatorOptions {}
577
747
 
578
748
  /** Options for `Desmos.Geometry`. Any graphing calculator option is accepted. */
579
749
  type GeometryOptions = GraphingCalculatorOptions;
@@ -586,37 +756,18 @@ declare namespace Desmos {
586
756
  | 'substitutions'
587
757
  | 'regressionTemplates'
588
758
  | 'intervalComprehensions'
589
- | 'recursion';
590
-
591
- /**
592
- * Settings present on `calculator.settings` at runtime that the docs don't
593
- * mention. They are read-only here because their behavior when set is not
594
- * part of the public API.
595
- *
596
- * @remarks Undocumented: may change without notice.
597
- */
598
- interface UndocumentedGraphingSettings {
599
- /** Whether Complex Mode is currently on. */
600
- readonly complex: boolean;
601
- readonly functionDefinition: boolean;
602
- readonly restrictGridToFirstQuadrant: boolean;
603
- readonly userLockedViewport: boolean;
604
- readonly authorMode: boolean;
605
- readonly advancedStyling: boolean;
606
- readonly leftAlign3dViewportControls: boolean;
607
- readonly translucentSurfaces: boolean;
608
- readonly showKeyboardShortcutsInTooltips: boolean;
609
- readonly showPerformanceMeter: boolean;
610
- }
759
+ | 'recursion'
760
+ | keyof InternalGraphingCalculatorOptions
761
+ | keyof DeprecatedGraphingCalculatorOptions;
611
762
 
612
- /** The current value of every documented option and graph setting. */
763
+ /** The current value of every option and graph setting that appears on `calculator.settings`. */
613
764
  type GraphingCalculatorSettingsValues = {
614
765
  readonly [K in Exclude<keyof GraphingCalculatorOptions, WriteOnlyGraphingOption | 'graphDescription'>]-?: NonNullable<
615
766
  GraphingCalculatorOptions[K]
616
767
  >;
617
768
  } & {
618
769
  readonly graphDescription: string | undefined;
619
- } & UndocumentedGraphingSettings;
770
+ };
620
771
 
621
772
  /**
622
773
  * `calculator.settings`: the current settings, observable per property.
@@ -1893,7 +2044,7 @@ declare namespace Desmos {
1893
2044
  /** Set global MathQuill configuration. */
1894
2045
  config(config: MathQuillConfig): void;
1895
2046
  /** The MathQuill API instance attached to `element`, if any. */
1896
- getApiInstanceForElement(element: HTMLElement): MathQuillStaticMath | MathQuillMathField | null | undefined;
2047
+ getApiInstanceForElement(element: Element): MathQuillStaticMath | MathQuillMathField | null | undefined;
1897
2048
  }
1898
2049
 
1899
2050
  /** @remarks Undocumented: may change without notice. */
@@ -568,12 +568,182 @@ declare namespace Desmos {
568
568
  * @defaultValue a random 128-bit hex string
569
569
  */
570
570
  randomSeed?: string;
571
+ /**
572
+ * Turn on Complex Mode, so expressions can use complex numbers. Ignored
573
+ * (forced to `false`) when `allowComplex` is `false`, and turns off
574
+ * `degreeMode`.
575
+ * @defaultValue `false`
576
+ * @remarks Undocumented.
577
+ */
578
+ complex?: boolean;
579
+ /**
580
+ * Draw the grid, axes and numbers only in the first quadrant.
581
+ * @defaultValue `false`
582
+ * @remarks Undocumented.
583
+ */
584
+ restrictGridToFirstQuadrant?: boolean;
585
+ /**
586
+ * The "lock viewport" toggle in the graph settings, which stops the user
587
+ * from panning and zooming. Unlike `lockViewport`, it is part of the graph
588
+ * state.
589
+ * @defaultValue `false`
590
+ * @remarks Undocumented.
591
+ */
592
+ userLockedViewport?: boolean;
593
+ }
594
+
595
+ /**
596
+ * Configuration options the docs don't mention that still appear on
597
+ * `calculator.settings`.
598
+ *
599
+ * @remarks Undocumented: may change without notice.
600
+ */
601
+ interface UndocumentedGraphingCalculatorConfig {
602
+ /**
603
+ * Show the author features enabled by `authorFeatures`. With `false`, they
604
+ * stay available but hidden, as when an author previews the student view.
605
+ * @defaultValue `true`
606
+ */
607
+ authorMode?: boolean;
608
+ /** Allow the advanced styling options in the style menu. @defaultValue `false` */
609
+ advancedStyling?: boolean;
610
+ /** Allow defining functions, like `f(x)=x^2`. @defaultValue `true` */
611
+ functionDefinition?: boolean;
612
+ /** 3D: put the viewport controls on the left instead of the right. @defaultValue `false` */
613
+ leftAlign3dViewportControls?: boolean;
614
+ /** 3D: draw surfaces with their opacity. When `false`, surfaces are opaque. @defaultValue `false` */
615
+ translucentSurfaces?: boolean;
616
+ /** Show keyboard shortcuts in tooltips. @defaultValue `false` */
617
+ showKeyboardShortcutsInTooltips?: boolean;
618
+ /** Show a performance meter over the graph paper. @defaultValue `false` */
619
+ showPerformanceMeter?: boolean;
620
+ }
621
+
622
+ /**
623
+ * Options Desmos uses for its own products, debugging and embedding. They
624
+ * are accepted by the constructor and `updateSettings()` but never appear
625
+ * on `calculator.settings`.
626
+ *
627
+ * @remarks Undocumented: may change without notice.
628
+ */
629
+ interface InternalGraphingCalculatorOptions {
630
+ /**
631
+ * Which product the calculator behaves as. `Desmos.Geometry` and
632
+ * `Desmos.Calculator3D` set this themselves.
633
+ * @defaultValue `'graphing'`
634
+ */
635
+ product?: 'graphing' | 'geometry-calculator' | 'graphing-3d';
636
+ /** Show the Desmos branding on the graph paper. @defaultValue `true` */
637
+ branding?: boolean;
638
+ /** Only trace and show points of interest for the selected expression. @defaultValue `false` */
639
+ onlyTraceSelected?: boolean;
640
+ /** Ignore mouse and touch input on the graph paper. @defaultValue `false` */
641
+ disableMouseInteractions?: boolean;
642
+ /** Accepted, but not read anywhere in the v1.13 bundle. @defaultValue `false` */
643
+ nativeOnscreenKeypad?: boolean;
644
+ /** 3D: draw surfaces as wireframes. @defaultValue `false` */
645
+ wireframe?: boolean;
646
+ /** 3D: debug rendering that shows ray-casting cost as a heat map. @defaultValue `false` */
647
+ raycastHeatmap?: boolean;
648
+ /** 3D: debugging flag for surface cost estimates (shows them in the expression list). @defaultValue `false` */
649
+ ignoreCostEstimate?: boolean;
650
+ /** 3D: ray-cast without interval arithmetic (debugging). @defaultValue `false` */
651
+ raycastDisableIntervals?: boolean;
652
+ /**
653
+ * With `pasteGraphLink`, called with the state of a pasted graph link
654
+ * before it is imported. Call `done(null, state)` to import it (possibly
655
+ * modified), or `done(error)` to reject it.
656
+ * @defaultValue imports the state unchanged
657
+ */
658
+ pasteGraphLinkCallback?: (state: GraphState, done: (error: unknown, state?: GraphState) => void) => void;
659
+ /** Link the branding to desmos.com, where the graph can be edited. @defaultValue `false` */
660
+ editOnWeb?: boolean;
661
+ /** Desmos testing: post the cross-origin save test to the current origin. @defaultValue `false` */
662
+ crossOriginSaveTest?: boolean;
663
+ /** Make the graph paper and its objects reachable with Tab. @defaultValue `true` */
664
+ enableTabindex?: boolean;
665
+ /** Audio Trace: step through expressions in reverse order. @defaultValue `false` */
666
+ audioTraceReverseExpressions?: boolean;
667
+ /** Draw the graph paper with a transparent background. @defaultValue `false` */
668
+ transparentBackground?: boolean;
669
+ /** Stop animating while the calculator is scrolled out of view. @defaultValue `false` */
670
+ pauseWhenOffscreen?: boolean;
671
+ /** 3D: release the WebGL context while the calculator is out of view. @defaultValue `true` */
672
+ releaseContextWhenOffscreen?: boolean;
673
+ /** Geometry: hide the geometry toolbar and tools. @defaultValue `false` */
674
+ hideGeoUI?: boolean;
675
+ /** 3D: beta features, such as per-surface resolution and translucent surfaces. @defaultValue `false` */
676
+ beta3d?: boolean;
677
+ /** Allow strings (categorical data) in expressions. @defaultValue `false` */
678
+ categoricalData?: boolean;
679
+ /** Pause the evaluator while the user is zooming. @defaultValue `false` */
680
+ disableWorkerOnZoom?: boolean;
681
+ /** Cache rendered SVG images. @defaultValue `false` */
682
+ cacheRenderedSvgs?: boolean;
683
+ /** Graph hidden expressions too (the "ghost mode" checkbox in advanced settings). @defaultValue `false` */
684
+ ghostMode?: boolean;
685
+ /** Geometry: draw an arc on reflection previews. @defaultValue `false` */
686
+ reflectionArc?: boolean;
687
+ /** Log the evaluator's internal errors to the console. @defaultValue `false` */
688
+ logInternalErrors?: boolean;
689
+ /** Show the compiler debugging panel. @defaultValue `false` */
690
+ debugCompiler?: boolean;
691
+ /** Show each item's id in the expression list. @defaultValue `false` */
692
+ showIDs?: boolean;
693
+ /** Show the evaluator's progress on each item, with a legend. @defaultValue `false` */
694
+ debugProgressUpdates?: boolean;
695
+ /** Maximum depth of recursive function calls, from 1 to 1,000,000. @defaultValue the evaluator's built-in limit */
696
+ recursionDepthLimit?: number;
697
+ /** Never narrate coordinates to screen readers, except during Audio Trace. @defaultValue `false` */
698
+ reportPositionNone?: boolean;
699
+ /** The calculator is embedded in a Desmos notebook. @defaultValue `false` */
700
+ insideDesNotebook?: boolean;
701
+ /** The expression list is rendered outside the calculator (split panel). @defaultValue `false` */
702
+ expressionsExternal?: boolean;
703
+ /** 3D: show the orientation buttons. @defaultValue `true` */
704
+ orientationButtons?: boolean;
705
+ /** Accepted, but not read anywhere in the v1.13 bundle. */
706
+ debug3dRender?: unknown;
707
+ /** 3D: force this many depth-peeling layers for translucent surfaces. @defaultValue chosen from the scene */
708
+ debugPeelLayers?: number;
709
+ /** 3D: choose the number of depth-peeling layers from the scene. @defaultValue `true` */
710
+ adaptivePeeling?: boolean;
711
+ /** Accepted, but not read anywhere in the v1.13 bundle. */
712
+ debugPixelRatio?: unknown;
713
+ /** 3D: opacity (as LaTeX) given to new translucent surfaces. @defaultValue `'0.8'` */
714
+ translucentOpacity?: Latex;
715
+ /** 3D: samples per pixel for depth peeling. @defaultValue chosen from the device pixel ratio */
716
+ peelUpsample?: number;
717
+ /** 3D: render surfaces by ray casting. @defaultValue `false` */
718
+ rayCast?: boolean;
719
+ }
720
+
721
+ /**
722
+ * Old options that still work: the calculator logs a deprecation warning
723
+ * and sets the replacement.
724
+ */
725
+ interface DeprecatedGraphingCalculatorOptions {
726
+ /** @deprecated Use `settingsMenu` and `expressionsTopbar`, which this sets. */
727
+ menus?: boolean;
728
+ /** @deprecated Use `pointsOfInterest`, which this sets. */
729
+ solutions?: boolean;
730
+ /** @deprecated Removed in API v1.0; ignored. */
731
+ singleVariableSolutions?: boolean;
732
+ /** @deprecated Use `actions`; `true` sets `actions: true`. */
733
+ clickableObjects?: boolean;
734
+ /** @deprecated Use `authorFeatures`, which this sets. */
735
+ administerSecretFolders?: boolean;
571
736
  }
572
737
 
573
738
  type AxisScale = 'linear' | 'logarithmic';
574
739
 
575
740
  /** Everything that can be passed to the `GraphingCalculator` constructor or `updateSettings()`. */
576
- interface GraphingCalculatorOptions extends GraphingCalculatorConfig, GraphSettings {}
741
+ interface GraphingCalculatorOptions
742
+ extends GraphingCalculatorConfig,
743
+ GraphSettings,
744
+ UndocumentedGraphingCalculatorConfig,
745
+ InternalGraphingCalculatorOptions,
746
+ DeprecatedGraphingCalculatorOptions {}
577
747
 
578
748
  /** Options for `Desmos.Geometry`. Any graphing calculator option is accepted. */
579
749
  type GeometryOptions = GraphingCalculatorOptions;
@@ -586,37 +756,18 @@ declare namespace Desmos {
586
756
  | 'substitutions'
587
757
  | 'regressionTemplates'
588
758
  | 'intervalComprehensions'
589
- | 'recursion';
759
+ | 'recursion'
760
+ | keyof InternalGraphingCalculatorOptions
761
+ | keyof DeprecatedGraphingCalculatorOptions;
590
762
 
591
- /**
592
- * Settings present on `calculator.settings` at runtime that the docs don't
593
- * mention. They are read-only here because their behavior when set is not
594
- * part of the public API.
595
- *
596
- * @remarks Undocumented: may change without notice.
597
- */
598
- interface UndocumentedGraphingSettings {
599
- /** Whether Complex Mode is currently on. */
600
- readonly complex: boolean;
601
- readonly functionDefinition: boolean;
602
- readonly restrictGridToFirstQuadrant: boolean;
603
- readonly userLockedViewport: boolean;
604
- readonly authorMode: boolean;
605
- readonly advancedStyling: boolean;
606
- readonly leftAlign3dViewportControls: boolean;
607
- readonly translucentSurfaces: boolean;
608
- readonly showKeyboardShortcutsInTooltips: boolean;
609
- readonly showPerformanceMeter: boolean;
610
- }
611
-
612
- /** The current value of every documented option and graph setting. */
763
+ /** The current value of every option and graph setting that appears on `calculator.settings`. */
613
764
  type GraphingCalculatorSettingsValues = {
614
765
  readonly [K in Exclude<keyof GraphingCalculatorOptions, WriteOnlyGraphingOption | 'graphDescription'>]-?: NonNullable<
615
766
  GraphingCalculatorOptions[K]
616
767
  >;
617
768
  } & {
618
769
  readonly graphDescription: string | undefined;
619
- } & UndocumentedGraphingSettings;
770
+ };
620
771
 
621
772
  /**
622
773
  * `calculator.settings`: the current settings, observable per property.
@@ -1893,7 +2044,7 @@ declare namespace Desmos {
1893
2044
  /** Set global MathQuill configuration. */
1894
2045
  config(config: MathQuillConfig): void;
1895
2046
  /** The MathQuill API instance attached to `element`, if any. */
1896
- getApiInstanceForElement(element: HTMLElement): MathQuillStaticMath | MathQuillMathField | null | undefined;
2047
+ getApiInstanceForElement(element: Element): MathQuillStaticMath | MathQuillMathField | null | undefined;
1897
2048
  }
1898
2049
 
1899
2050
  /** @remarks Undocumented: may change without notice. */
@@ -7149,6 +7300,55 @@ declare namespace Desmos.Internals {
7149
7300
  };
7150
7301
  }
7151
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
+
7152
7352
  /**
7153
7353
  * Options accepted by the grapher's own screenshot methods. The public
7154
7354
  * `asyncScreenshot` handles `mode` and `mathBounds` itself and passes the
@@ -7262,6 +7462,9 @@ declare namespace Desmos.Internals {
7262
7462
  settings: GrapherSettings;
7263
7463
  events: GrapherEvents;
7264
7464
  viewportController: ViewportController;
7465
+ /** Draws the grid, axes and axis numbers. */
7466
+ gridLayer: GridLayer;
7467
+ privateGetGridLayer(): GridLayer;
7265
7468
  __projection: Projection;
7266
7469
  /** The viewport at the last animation frame (unset before the first one); used to detect viewport changes. */
7267
7470
  lastTickViewport?: Viewport;
@@ -7603,7 +7806,63 @@ declare namespace Desmos.Internals {
7603
7806
  controller: Controller;
7604
7807
  }
7605
7808
 
7606
- interface Grapher3D extends Generated.Grapher3D {}
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
+ }
7607
7866
 
7608
7867
  interface Evaluator extends Generated.Evaluator {}
7609
7868
 
@@ -8014,6 +8273,17 @@ declare namespace Desmos.Internals {
8014
8273
 
8015
8274
  type FragileViewClass<P, Members> = DCGView.ViewClass<P, FragileView<P, Members>>;
8016
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
+
8017
8287
  /** The view classes on `Private.Fragile`. */
8018
8288
  interface FragileViews {
8019
8289
  ExpressionView: FragileViewClass<ExpressionViewProps, Generated.ExpressionViewMembers>;
@@ -8022,7 +8292,7 @@ declare namespace Desmos.Internals {
8022
8292
  ExpressionOptionsMenuView: FragileViewClass<ExpressionOptionsMenuViewProps, Generated.ExpressionOptionsMenuViewMembers>;
8023
8293
  ImageIconView: FragileViewClass<ImageIconViewProps, Generated.ImageIconViewMembers>;
8024
8294
  PromptSliderView: FragileViewClass<PromptSliderViewProps, Generated.PromptSliderViewMembers>;
8025
- MathquillView: FragileViewClass<MathquillViewProps, Generated.MathquillViewMembers>;
8295
+ MathquillView: FragileViewClass<MathquillViewProps, Generated.MathquillViewMembers> & MathquillViewStatics;
8026
8296
  InlineMathInputView: FragileViewClass<InlineMathInputViewProps, Generated.InlineMathInputViewMembers>;
8027
8297
  StaticMathquillView: FragileViewClass<StaticMathquillViewProps, Generated.StaticMathquillViewMembers>;
8028
8298
  Checkbox: FragileViewClass<CheckboxProps, Generated.CheckboxMembers>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spidunno/desmos-types",
3
- "version": "1.13.6",
3
+ "version": "1.13.8",
4
4
  "description": "TypeScript type definitions for the Desmos API v1.13",
5
5
  "types": "index.d.ts",
6
6
  "publishConfig": {
@@ -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: HTMLElement): MathQuillStaticMath | MathQuillMathField | null | undefined;
55
+ getApiInstanceForElement(element: Element): MathQuillStaticMath | MathQuillMathField | null | undefined;
56
56
  }
57
57
 
58
58
  /** @remarks Undocumented: may change without notice. */