@spidunno/desmos-types 1.13.7 → 1.13.9

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.
@@ -1,36 +1,36 @@
1
- /**
2
- * `controller.listModel`: the expressions list, its lookup tables and
3
- * selection state.
4
- */
5
- declare namespace Desmos.Internals {
6
- /**
7
- * One pass of drawing. Layer `-1` holds background images (drawn under the
8
- * grid), `0` everything else, and `1` folders marked "in front of
9
- * everything". Layers -1 and 1 only exist when non-empty.
10
- */
11
- interface DrawLayer {
12
- layer: -1 | 0 | 1;
13
- /** Item ids (table column ids for tables) in paint order, back to front. */
14
- drawOrder: ExpressionId[];
15
- drawSet: Set<ExpressionId>;
16
- }
17
-
18
- interface ListModel extends Generated.ListModel {
19
- controller: Controller;
20
- /** Every item, in list order. Prefer `controller.getAllItemModels()`. */
21
- __itemModelArray: ItemModel[];
22
- /** Items by id. Prefer `controller.getItemModel(id)`. */
23
- __itemIdToModel: Record<ExpressionId, ItemModel>;
24
- /** Helper expressions by id. */
25
- __helperIdToModel: Record<string, unknown>;
26
- /** Ids of selected items. */
27
- selectedItemMap: Record<ExpressionId, unknown>;
28
- /** Item ids in keyboard tab order. */
29
- tabOrder: ExpressionId[];
30
- drawLayers: DrawLayer[];
31
- /** Index into the palette for the next new item's color. */
32
- colorIdx: number;
33
- expressionAnalysis: Record<ExpressionId, ExpressionAnalysis>;
34
- ticker: TickerModel;
35
- }
36
- }
1
+ /**
2
+ * `controller.listModel`: the expressions list, its lookup tables and
3
+ * selection state.
4
+ */
5
+ declare namespace Desmos.Internals {
6
+ /**
7
+ * One pass of drawing. Layer `-1` holds background images (drawn under the
8
+ * grid), `0` everything else, and `1` folders marked "in front of
9
+ * everything". Layers -1 and 1 only exist when non-empty.
10
+ */
11
+ interface DrawLayer {
12
+ layer: -1 | 0 | 1;
13
+ /** Item ids (table column ids for tables) in paint order, back to front. */
14
+ drawOrder: ExpressionId[];
15
+ drawSet: Set<ExpressionId>;
16
+ }
17
+
18
+ interface ListModel extends Generated.ListModel {
19
+ controller: Controller;
20
+ /** Every item, in list order. Prefer `controller.getAllItemModels()`. */
21
+ __itemModelArray: ItemModel[];
22
+ /** Items by id. Prefer `controller.getItemModel(id)`. */
23
+ __itemIdToModel: Record<ExpressionId, ItemModel>;
24
+ /** Helper expressions by id. */
25
+ __helperIdToModel: Record<string, unknown>;
26
+ /** Ids of selected items. */
27
+ selectedItemMap: Record<ExpressionId, unknown>;
28
+ /** Item ids in keyboard tab order. */
29
+ tabOrder: ExpressionId[];
30
+ drawLayers: DrawLayer[];
31
+ /** Index into the palette for the next new item's color. */
32
+ colorIdx: number;
33
+ expressionAnalysis: Record<ExpressionId, ExpressionAnalysis>;
34
+ ticker: TickerModel;
35
+ }
36
+ }
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: HTMLElement): MathQuillStaticMath | MathQuillMathField | null | undefined;
2047
+ getApiInstanceForElement(element: Element): MathQuillStaticMath | MathQuillMathField | null | undefined;
2048
2048
  }
2049
2049
 
2050
2050
  /** @remarks Undocumented: may change without notice. */
@@ -2099,3 +2099,11 @@ declare namespace Desmos {
2099
2099
  }
2100
2100
 
2101
2101
  export type { Desmos };
2102
+
2103
+ /**
2104
+ * The same namespace, exported as a value as well. This package has no
2105
+ * JavaScript, so importing this from here fails at runtime: it exists for
2106
+ * packages that supply the value themselves and re-export it as `Desmos`,
2107
+ * like @spidunno/desmos-loader.
2108
+ */
2109
+ export { Desmos as DesmosForLoaders };
@@ -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: HTMLElement): MathQuillStaticMath | MathQuillMathField | null | undefined;
2047
+ getApiInstanceForElement(element: Element): MathQuillStaticMath | MathQuillMathField | null | undefined;
2048
2048
  }
2049
2049
 
2050
2050
  /** @remarks Undocumented: may change without notice. */
@@ -2101,7 +2101,7 @@ declare namespace Desmos {
2101
2101
 
2102
2102
  // AUTO-GENERATED by scripts/extract-internals.cjs. Do not edit by hand:
2103
2103
  // put precise types in the hand-written files in internals/ instead.
2104
- // Source: Desmos v1.13-prerelease (commit c2616b6762c586165f75e322fbc6c7b6ab56b394).
2104
+ // Source: Desmos v1.13-prerelease (commit 7f0bcd732b59def63b568d6e527e004258e53995).
2105
2105
  // Runtime shapes of internal objects.
2106
2106
  declare namespace Desmos.Internals.Generated {
2107
2107
  interface Controller {
@@ -4771,7 +4771,7 @@ declare namespace Desmos.Internals.Generated {
4771
4771
 
4772
4772
  // AUTO-GENERATED by scripts/extract-internals.cjs. Do not edit by hand:
4773
4773
  // put precise types in the hand-written files in internals/ instead.
4774
- // Source: Desmos v1.13-prerelease (commit c2616b6762c586165f75e322fbc6c7b6ab56b394).
4774
+ // Source: Desmos v1.13-prerelease (commit 7f0bcd732b59def63b568d6e527e004258e53995).
4775
4775
  // Actions accepted by each dispatch domain, from static analysis.
4776
4776
  declare namespace Desmos.Internals.Generated {
4777
4777
  /**
@@ -5529,7 +5529,7 @@ declare namespace Desmos.Internals.Generated {
5529
5529
 
5530
5530
  // AUTO-GENERATED by scripts/extract-internals.cjs. Do not edit by hand:
5531
5531
  // put precise types in the hand-written files in internals/ instead.
5532
- // Source: Desmos v1.13-prerelease (commit c2616b6762c586165f75e322fbc6c7b6ab56b394).
5532
+ // Source: Desmos v1.13-prerelease (commit 7f0bcd732b59def63b568d6e527e004258e53995).
5533
5533
  // Props and instance members of the views on Private.Fragile.
5534
5534
  declare namespace Desmos.Internals.Generated {
5535
5535
  /**
@@ -7300,6 +7300,68 @@ 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
+ * Draw the numbers at every major step (each one a `strokeText` shadow
7352
+ * then a `fillText`), plus tick marks on the axes when `drawTickMarks`
7353
+ * (the grid is hidden). Returns the strips along each axis that the
7354
+ * numbers cover, which `drawLabels` keeps the axis labels out of.
7355
+ */
7356
+ drawCartesianStepNumbers(
7357
+ ctx: CanvasRenderingContext2D,
7358
+ projection: Projection,
7359
+ steps: GridSteps,
7360
+ drawTickMarks: boolean,
7361
+ logGrid?: LogGrid,
7362
+ ): { x: PixelRect; y: PixelRect };
7363
+ }
7364
+
7303
7365
  /**
7304
7366
  * Options accepted by the grapher's own screenshot methods. The public
7305
7367
  * `asyncScreenshot` handles `mode` and `mathBounds` itself and passes the
@@ -7413,6 +7475,9 @@ declare namespace Desmos.Internals {
7413
7475
  settings: GrapherSettings;
7414
7476
  events: GrapherEvents;
7415
7477
  viewportController: ViewportController;
7478
+ /** Draws the grid, axes and axis numbers. */
7479
+ gridLayer: GridLayer;
7480
+ privateGetGridLayer(): GridLayer;
7416
7481
  __projection: Projection;
7417
7482
  /** The viewport at the last animation frame (unset before the first one); used to detect viewport changes. */
7418
7483
  lastTickViewport?: Viewport;
@@ -7754,7 +7819,63 @@ declare namespace Desmos.Internals {
7754
7819
  controller: Controller;
7755
7820
  }
7756
7821
 
7757
- interface Grapher3D extends Generated.Grapher3D {}
7822
+ /** A point in 3D math coordinates. */
7823
+ interface Point3D {
7824
+ x: number;
7825
+ y: number;
7826
+ z: number;
7827
+ }
7828
+
7829
+ /** What the 3D grapher's worker found under the mouse. */
7830
+ interface PickResult3D {
7831
+ /** Where the ray from the mouse hit, in math coordinates. */
7832
+ point: Point3D;
7833
+ }
7834
+
7835
+ /** `grapher3d.controls`: mouse, touch and keyboard handling for the 3D graph paper. */
7836
+ interface Grapher3DControls {
7837
+ grapher3d: Grapher3D;
7838
+ /** The graph paper element (`grapher3d.elt`). Desmos's wheel handler is attached here. */
7839
+ domElement: HTMLElement;
7840
+ /** -1 when idle, 0 while rotating with the mouse. */
7841
+ state: -1 | 0;
7842
+ /** Rotation speed while the graph is spinning, 0 when it isn't. */
7843
+ speed3D: number;
7844
+ /**
7845
+ * `performance.now()` of the last wheel zoom, or 0. The tick calls
7846
+ * `grapher3d.endZoom()` and resets it 100ms after the last one.
7847
+ */
7848
+ lastWheelEventTime: number;
7849
+ /** Whether zoom and pan are disabled. */
7850
+ isLocked(): boolean;
7851
+ /** Whether rotating is disabled (the user lock, or the page is pinch zoomed). */
7852
+ isRotationLocked(): boolean;
7853
+ /** Set the viewport and commit it to history after a short delay. */
7854
+ updateViewport(viewport: ViewportObject): void;
7855
+ }
7856
+
7857
+ /** `grapher3d.viewportController`. */
7858
+ interface Grapher3DViewportController {
7859
+ getViewport(): Viewport;
7860
+ /**
7861
+ * Jump to a viewport. Invalid axes keep their current bounds, and each
7862
+ * axis is clamped to a width between 1.34e-4 × its largest bound (at
7863
+ * least 1.34e-4) and 134000, within ±67000.
7864
+ */
7865
+ setCurrentViewport(viewport: ViewportObject): void;
7866
+ }
7867
+
7868
+ interface Grapher3D extends Generated.Grapher3D {
7869
+ controls: Grapher3DControls;
7870
+ viewportController: Grapher3DViewportController;
7871
+ /** The 3D viewport always has z bounds (Desmos fills in defaults). */
7872
+ getProjection(): { viewport: Viewport & { zmin: number; zmax: number } };
7873
+ /**
7874
+ * What's under the mouse, used as the center when zooming in with the
7875
+ * scroll wheel. Undefined while the graph is spinning, or over nothing.
7876
+ */
7877
+ getZoomScrollWheelPickResult(): PickResult3D | null | undefined;
7878
+ }
7758
7879
 
7759
7880
  interface Evaluator extends Generated.Evaluator {}
7760
7881
 
@@ -8165,6 +8286,17 @@ declare namespace Desmos.Internals {
8165
8286
 
8166
8287
  type FragileViewClass<P, Members> = DCGView.ViewClass<P, FragileView<P, Members>>;
8167
8288
 
8289
+ /** Static helpers on `Fragile.MathquillView`. */
8290
+ interface MathquillViewStatics {
8291
+ /** The math field containing `document.activeElement`, if it's in one. */
8292
+ getFocusedMathquill(): Desmos.MathQuillMathField | undefined;
8293
+ /**
8294
+ * Apply an arrow key to a math field. Returns true if the cursor was
8295
+ * already at that edge (so focus should move to the next item).
8296
+ */
8297
+ applyArrowKeyAndReturnIfWasAtBounds(mathField: Desmos.MathQuillMathField, key: string, event: KeyboardEvent): boolean;
8298
+ }
8299
+
8168
8300
  /** The view classes on `Private.Fragile`. */
8169
8301
  interface FragileViews {
8170
8302
  ExpressionView: FragileViewClass<ExpressionViewProps, Generated.ExpressionViewMembers>;
@@ -8173,7 +8305,7 @@ declare namespace Desmos.Internals {
8173
8305
  ExpressionOptionsMenuView: FragileViewClass<ExpressionOptionsMenuViewProps, Generated.ExpressionOptionsMenuViewMembers>;
8174
8306
  ImageIconView: FragileViewClass<ImageIconViewProps, Generated.ImageIconViewMembers>;
8175
8307
  PromptSliderView: FragileViewClass<PromptSliderViewProps, Generated.PromptSliderViewMembers>;
8176
- MathquillView: FragileViewClass<MathquillViewProps, Generated.MathquillViewMembers>;
8308
+ MathquillView: FragileViewClass<MathquillViewProps, Generated.MathquillViewMembers> & MathquillViewStatics;
8177
8309
  InlineMathInputView: FragileViewClass<InlineMathInputViewProps, Generated.InlineMathInputViewMembers>;
8178
8310
  StaticMathquillView: FragileViewClass<StaticMathquillViewProps, Generated.StaticMathquillViewMembers>;
8179
8311
  Checkbox: FragileViewClass<CheckboxProps, Generated.CheckboxMembers>;
@@ -8333,3 +8465,11 @@ declare namespace Desmos {
8333
8465
  }
8334
8466
 
8335
8467
  export type { Desmos };
8468
+
8469
+ /**
8470
+ * The same namespace, exported as a value as well. This package has no
8471
+ * JavaScript, so importing this from here fails at runtime: it exists for
8472
+ * packages that supply the value themselves and re-export it as `Desmos`,
8473
+ * like @spidunno/desmos-loader.
8474
+ */
8475
+ export { Desmos as DesmosForLoaders };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spidunno/desmos-types",
3
- "version": "1.13.7",
3
+ "version": "1.13.9",
4
4
  "description": "TypeScript type definitions for the Desmos API v1.13",
5
5
  "types": "index.d.ts",
6
6
  "publishConfig": {
@@ -31,7 +31,9 @@
31
31
  "build:module": "node scripts/build-module-types.cjs",
32
32
  "prepack": "npm run build:module",
33
33
  "generate:internals": "node scripts/extract-internals.cjs",
34
- "snapshot:sketches": "node scripts/snapshot-sketches.cjs"
34
+ "snapshot:sketches": "node scripts/snapshot-sketches.cjs",
35
+ "bundle-info": "node scripts/bundle-info.cjs",
36
+ "update:bundle": "node scripts/update-bundle.mjs"
35
37
  },
36
38
  "keywords": [
37
39
  "desmos",
@@ -40,9 +42,18 @@
40
42
  "calculator"
41
43
  ],
42
44
  "license": "MIT",
45
+ "repository": {
46
+ "type": "git",
47
+ "url": "git+https://github.com/spidunno/desmos-types.git",
48
+ "directory": "packages/desmos-types"
49
+ },
43
50
  "devDependencies": {
44
51
  "acorn": "^8.14.0",
45
52
  "acorn-walk": "^8.3.4",
46
53
  "jsdom": "^24.1.3"
54
+ },
55
+ "desmos": {
56
+ "version": "v1.13-prerelease",
57
+ "commit": "7f0bcd732b59def63b568d6e527e004258e53995"
47
58
  }
48
59
  }
@@ -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. */