@spidunno/desmos-types 1.13.8 → 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.
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.8
9
+ npm install --save-dev @spidunno/desmos-types@~1.13.9
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.8`), not npm's default caret (`^`), so you only
13
+ are fixes to the types. Use a tilde range (`~1.13.9`), not npm's default caret (`^`), so you only
14
14
  get type fixes for the API version you load.
15
15
 
16
16
  ## Usage
@@ -366,10 +366,36 @@ g.events.unobserveEvent('.myMod');
366
366
  Moving the viewport this way doesn't add an undo step. Call
367
367
  `g.debounceUserRequestedViewportChange()` afterwards if you want one.
368
368
 
369
+ ### Which Desmos build a version matches
370
+
371
+ Desmos updates the v1.13 bundle without changing its version, so the internal types are
372
+ regenerated automatically whenever `Desmos.commit` changes, and each regeneration is published as a
373
+ new patch version. The `desmos` field in `package.json` records the commit a version was generated
374
+ from, and [CHANGELOG.md](CHANGELOG.md) lists every version's commit and what changed in the
375
+ internals:
376
+
377
+ ```sh
378
+ npm view @spidunno/desmos-types@1.13.9 desmos # { version: 'v1.13-prerelease', commit: '…' }
379
+ ```
380
+
381
+ ```js
382
+ // is the live bundle the one the installed types were generated from?
383
+ console.log(Desmos.commit);
384
+ ```
385
+
369
386
  ### Regenerating for a new bundle
370
387
 
371
388
  ```sh
372
389
  curl -o calculator.js "https://www.desmos.com/api/v1.13/calculator.js?apiKey=YOUR_API_KEY"
390
+ npm run update:bundle -- calculator.js
391
+ ```
392
+
393
+ `update:bundle` does the whole update: it reads the bundle's commit (stopping if it's the one in
394
+ `package.json`, unless you pass `--force`), runs both generators, runs `npm test`, bumps the patch
395
+ version, records the commit and adds a CHANGELOG entry. It doesn't commit or publish. The
396
+ generators can also be run on their own:
397
+
398
+ ```sh
373
399
  npm run generate:internals -- calculator.js
374
400
  npm run snapshot:sketches -- calculator.js
375
401
  npm test
@@ -1,6 +1,6 @@
1
1
  // AUTO-GENERATED by scripts/extract-internals.cjs. Do not edit by hand:
2
2
  // put precise types in the hand-written files in internals/ instead.
3
- // Source: Desmos v1.13-prerelease (commit c2616b6762c586165f75e322fbc6c7b6ab56b394).
3
+ // Source: Desmos v1.13-prerelease (commit 7f0bcd732b59def63b568d6e527e004258e53995).
4
4
  // Actions accepted by each dispatch domain, from static analysis.
5
5
  declare namespace Desmos.Internals.Generated {
6
6
  /**
@@ -1,6 +1,6 @@
1
1
  // AUTO-GENERATED by scripts/extract-internals.cjs. Do not edit by hand:
2
2
  // put precise types in the hand-written files in internals/ instead.
3
- // Source: Desmos v1.13-prerelease (commit c2616b6762c586165f75e322fbc6c7b6ab56b394).
3
+ // Source: Desmos v1.13-prerelease (commit 7f0bcd732b59def63b568d6e527e004258e53995).
4
4
  // Runtime shapes of internal objects.
5
5
  declare namespace Desmos.Internals.Generated {
6
6
  interface Controller {
@@ -1,6 +1,6 @@
1
1
  // AUTO-GENERATED by scripts/extract-internals.cjs. Do not edit by hand:
2
2
  // put precise types in the hand-written files in internals/ instead.
3
- // Source: Desmos v1.13-prerelease (commit c2616b6762c586165f75e322fbc6c7b6ab56b394).
3
+ // Source: Desmos v1.13-prerelease (commit 7f0bcd732b59def63b568d6e527e004258e53995).
4
4
  // Props and instance members of the views on Private.Fragile.
5
5
  declare namespace Desmos.Internals.Generated {
6
6
  /**
@@ -411,6 +411,19 @@ declare namespace Desmos.Internals {
411
411
  redrawToCtx(context: DrawContext, scaleAxis?: 'x' | 'y' | 'both'): void;
412
412
  drawCartesianGrid(ctx: CanvasRenderingContext2D, projection: Projection, steps: GridSteps, logGrid?: LogGrid): void;
413
413
  drawPolarGrid(ctx: CanvasRenderingContext2D, projection: Projection, steps: { majorStepR: number; minorStepR: number }): void;
414
+ /**
415
+ * Draw the numbers at every major step (each one a `strokeText` shadow
416
+ * then a `fillText`), plus tick marks on the axes when `drawTickMarks`
417
+ * (the grid is hidden). Returns the strips along each axis that the
418
+ * numbers cover, which `drawLabels` keeps the axis labels out of.
419
+ */
420
+ drawCartesianStepNumbers(
421
+ ctx: CanvasRenderingContext2D,
422
+ projection: Projection,
423
+ steps: GridSteps,
424
+ drawTickMarks: boolean,
425
+ logGrid?: LogGrid,
426
+ ): { x: PixelRect; y: PixelRect };
414
427
  }
415
428
 
416
429
  /**
@@ -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
@@ -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 };
@@ -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
  /**
@@ -7347,6 +7347,19 @@ declare namespace Desmos.Internals {
7347
7347
  redrawToCtx(context: DrawContext, scaleAxis?: 'x' | 'y' | 'both'): void;
7348
7348
  drawCartesianGrid(ctx: CanvasRenderingContext2D, projection: Projection, steps: GridSteps, logGrid?: LogGrid): void;
7349
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 };
7350
7363
  }
7351
7364
 
7352
7365
  /**
@@ -8452,3 +8465,11 @@ declare namespace Desmos {
8452
8465
  }
8453
8466
 
8454
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.8",
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
  }