@m2c2kit/core 0.3.30 → 0.3.32

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/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import * as canvaskit_wasm from 'canvaskit-wasm';
1
2
  import { Canvas, Typeface, TypefaceFontProvider, Image, Paint, CanvasKit, Surface, Font, ParagraphBuilder, Paragraph, FontMgr, Path, PaintStyle } from 'canvaskit-wasm';
2
3
 
3
4
  /**
@@ -1006,6 +1007,10 @@ interface GameOptions extends LocalizationOptions {
1006
1007
  moduleMetadata?: ModuleMetadata;
1007
1008
  }
1008
1009
 
1010
+ interface TrialData {
1011
+ [key: string]: string | number | boolean | object | undefined | null;
1012
+ }
1013
+
1009
1014
  interface GameData extends ActivityKeyValueData {
1010
1015
  trials: Array<TrialData>;
1011
1016
  scoring: ActivityKeyValueData;
@@ -1556,9 +1561,316 @@ declare class EventMaterializer {
1556
1561
  private materializeScenePresentEvent;
1557
1562
  }
1558
1563
 
1559
- interface TrialData {
1560
- [key: string]: string | number | boolean | object | undefined | null;
1564
+ declare class InputManager {
1565
+ private game;
1566
+ private htmlCanvas;
1567
+ constructor(game: Game, htmlCanvas: HTMLCanvasElement);
1568
+ dispose(): void;
1569
+ private addEventListeners;
1570
+ private removeEventListeners;
1571
+ private touchStartHandler;
1572
+ /**
1573
+ * Receives callback from DOM PointerDown event
1574
+ *
1575
+ * @param domPointerEvent - PointerEvent from the DOM
1576
+ * @returns
1577
+ */
1578
+ private htmlCanvasPointerDownHandler;
1579
+ private htmlCanvasPointerUpHandler;
1580
+ private htmlCanvasPointerMoveHandler;
1581
+ private htmlCanvasPointerLeaveHandler;
1582
+ private documentKeyDownHandler;
1583
+ private documentKeyUpHandler;
1584
+ /**
1585
+ * Determines if/how m2c2kit nodes respond to the DOM PointerDown event
1586
+ *
1587
+ * @param node - node that might be affected by the DOM PointerDown event
1588
+ * @param nodeEvent
1589
+ * @param domPointerEvent
1590
+ */
1591
+ private processDomPointerDown;
1592
+ private processDomPointerUp;
1593
+ private processDomPointerMove;
1594
+ private processDomPointerLeave;
1595
+ private raiseEventOnListeningNodes;
1596
+ private raiseM2PointerDownEvent;
1597
+ private raiseTapDownEvent;
1598
+ private raiseTapLeaveEvent;
1599
+ private raiseM2PointerUpEvent;
1600
+ private raiseTapUpEvent;
1601
+ private raiseTapUpAny;
1602
+ private raiseM2PointerMoveEvent;
1603
+ private raiseM2PointerLeaveEvent;
1604
+ private raiseM2DragStartEvent;
1605
+ private raiseM2DragEvent;
1606
+ private raiseM2DragEndEvent;
1607
+ private sceneCanReceiveUserInteraction;
1608
+ /**
1609
+ *
1610
+ * Checks if the given canvas point is within the node's bounds.
1611
+ *
1612
+ * @param node - node to check bounds for
1613
+ * @param x - x coordinate of the canvas point
1614
+ * @param y - y coordinate of the canvas point
1615
+ * @returns true if x, y point is within the node's bounds
1616
+ */
1617
+ private IsCanvasPointWithinNodeBounds;
1618
+ private calculatePointWithinNodeFromDomPointerEvent;
1619
+ }
1620
+
1621
+ declare class SceneManager {
1622
+ private game;
1623
+ scenes: Scene[];
1624
+ freeNodesScene: Scene;
1625
+ currentScene?: Scene;
1626
+ incomingSceneTransitions: SceneTransition[];
1627
+ snapshots: Image[];
1628
+ private currentSceneSnapshot?;
1629
+ private pendingScreenshot?;
1630
+ constructor(game: Game);
1631
+ /**
1632
+ * Clears the current game scene by setting it to undefined.
1633
+ */
1634
+ clearCurrentScene(): void;
1635
+ /**
1636
+ * Updates all active scenes and their children.
1637
+ */
1638
+ updateScenes(): void;
1639
+ /**
1640
+ * Draws all active scenes and their children on the provided canvas.
1641
+ *
1642
+ * @param canvas - the canvas to draw the scenes on
1643
+ */
1644
+ drawScenes(canvas: Canvas): void;
1645
+ /**
1646
+ * Adds events from a node and its children to the game's event store.
1647
+ *
1648
+ * @remarks This method is first called when a scene is added to the game.
1649
+ * If the scene or any of its descendants was constructed or had its
1650
+ * properties changed before it was added to the game, these events were
1651
+ * stored within the node (because the game event store was not yet
1652
+ * available). This method retrieves these events from the node and adds
1653
+ * them to the game's event store.
1654
+ *
1655
+ * @param node - node that contains events to add
1656
+ */
1657
+ private addNodeEvents;
1658
+ /**
1659
+ * Adds a scene to the game.
1660
+ *
1661
+ * @remarks A scene, and its children nodes, cannot be presented unless it
1662
+ * has been added to the game object. A scene can be added to the game
1663
+ * only once.
1664
+ *
1665
+ * @param scene
1666
+ */
1667
+ add(scene: Scene): void;
1668
+ /**
1669
+ * Removes a scene from the game.
1670
+ *
1671
+ * @param scene - the scene to remove or its name as a string
1672
+ */
1673
+ remove(scene: Scene | string): void;
1674
+ /**
1675
+ * Specifies the scene that will be presented upon the next frame draw.
1676
+ *
1677
+ * @param scene - the scene, its string name, or UUID
1678
+ * @param transition
1679
+ */
1680
+ present(scene: string | Scene, transition?: Transition): void;
1681
+ handleIncomingSceneTransitions(): void;
1682
+ /**
1683
+ * Creates a scene that has a screen shot of the current scene.
1684
+ *
1685
+ * @param outgoingSceneImage - an image of the current scene
1686
+ * @returns - the scene with the screen shot
1687
+ */
1688
+ private createOutgoingScene;
1689
+ private animateSceneTransition;
1690
+ /**
1691
+ * Takes screenshot of canvas
1692
+ *
1693
+ * @remarks Coordinates should be provided unscaled; that is, the method
1694
+ * will handle any scaling that happened due to device pixel ratios
1695
+ * not equal to 1. This returns a promise because the screenshot request
1696
+ * must be queued and completed once a draw cycle has completed. See
1697
+ * the handleScreenshots() method.
1698
+ *
1699
+ * @param sx - Upper left coordinate of screenshot
1700
+ * @param sy - Upper right coordinate of screenshot
1701
+ * @param sw - width of area to screenshot
1702
+ * @param sh - height of area to screenshot
1703
+ * @returns Promise of Uint8Array of image data
1704
+ */
1705
+ takeScreenshot(sx?: number, sy?: number, sw?: number, sh?: number): Promise<Uint8Array | null>;
1706
+ /**
1707
+ * Handles game screenshots.
1708
+ *
1709
+ * @remarks This is called on every iteration of the game loop.
1710
+ * In prior versions, I took a snapshot only when needed, e.g.,
1711
+ * after a new scene transition was requested. From performance testing,
1712
+ * however, I found that taking a snapshot has negligible impact on
1713
+ * performance. It is only encoding the image to bytes, i.e.,
1714
+ * image.encodeToBytes(), that is expensive. Thus, we can take a snapshot
1715
+ * after every draw, in case we'll need the snapshot. IMPORTANT: snapshots
1716
+ * must be deleted when not needed, otherwise we will create a massive memory
1717
+ * leak because we are creating them 60 times per second.
1718
+ */
1719
+ handleScreenshots(): void;
1720
+ takeCurrentSceneSnapshot(): Image;
1721
+ private handlePendingScreenshot;
1722
+ private raiseSceneEvent;
1723
+ private createFreeNodesScene;
1724
+ get freeNodes(): Array<M2Node>;
1725
+ addFreeNode(node: M2Node): void;
1726
+ removeFreeNode(node: M2Node | string): void;
1727
+ removeAllFreeNodes(): void;
1728
+ }
1729
+
1730
+ interface DeviceMetadata {
1731
+ userAgent?: string;
1732
+ devicePixelRatio?: number;
1733
+ screen?: screenMetadata;
1734
+ webGlRenderer?: string;
1735
+ }
1736
+ /**
1737
+ * screenMetadata is similar to window.Screen, except we don't want the
1738
+ * methods on the window.Screen.ScreenOrientation
1739
+ */
1740
+ interface screenMetadata {
1741
+ readonly availHeight: number;
1742
+ readonly availWidth: number;
1743
+ readonly colorDepth: number;
1744
+ readonly height: number;
1745
+ /** ScreenOrientation has some methods on it; we only want these two properties
1746
+ * However, when unit testing, orientation is not available to us. Thus, make this
1747
+ * property optional
1748
+ */
1749
+ readonly orientation?: Pick<ScreenOrientation, "type" | "angle">;
1750
+ readonly pixelDepth: number;
1751
+ readonly width: number;
1561
1752
  }
1753
+
1754
+ /**
1755
+ * Manages the participant data for a game.
1756
+ *
1757
+ * @internal For m2c2kit library use only
1758
+ *
1759
+ * @param game - The game instance that this DataManager is associated with.
1760
+ */
1761
+ declare class DataManager {
1762
+ private game;
1763
+ private webGlRendererInfo;
1764
+ data: GameData;
1765
+ trialIndex: number;
1766
+ staticTrialSchema: {
1767
+ [key: string]: JsonSchemaDataTypeScriptTypes;
1768
+ };
1769
+ constructor(game: Game);
1770
+ /**
1771
+ * Initializes the participant data structure for a new game.
1772
+ *
1773
+ * @remarks This method should be called once at the start of a new game.
1774
+ */
1775
+ initializeData(): void;
1776
+ /**
1777
+ * The m2c2kit engine will automatically include these schema and their
1778
+ * values in the trial data.
1779
+ *
1780
+ * @remarks These are in the `Game` class, rather than in the `DataManager`
1781
+ * class, because the schema-util parses the code to find these
1782
+ * properties, and it expects them in the `Game` class.
1783
+ */
1784
+ private readonly automaticTrialSchema;
1785
+ /**
1786
+ * The m2c2kit engine will automatically include these schema and their
1787
+ * values in the scoring data.
1788
+ *
1789
+ * @remarks These are in the `Game` class, rather than in the `DataManager`
1790
+ * class, because the schema-util parses the code to find these
1791
+ * properties, and it expects them in the `Game` class.
1792
+ */
1793
+ private readonly automaticScoringSchema;
1794
+ /**
1795
+ * Queries the WebGL renderer for graphics drivers information and stores
1796
+ * it so it can be included in the device metadata.
1797
+ *
1798
+ * @remarks This method should be called once during the game start to avoid
1799
+ * performance issues (it could be slow on some devices/browsers).
1800
+ */
1801
+ queryWebGlRendererInfo(): void;
1802
+ private propertySchemaDataTypeIsValid;
1803
+ /**
1804
+ * Increments the trial index by 1.
1805
+ */
1806
+ incrementTrialIndex(): void;
1807
+ /**
1808
+ * Adds data to the game's TrialData object.
1809
+ *
1810
+ * @remarks `variableName` must be previously defined in the
1811
+ * {@link TrialSchema} object in {@link GameOptions}. The type of the value
1812
+ * must match what was defined in the trial schema, otherwise an error is
1813
+ * thrown.
1814
+ *
1815
+ * @param variableName - variable to be set
1816
+ * @param value - value of the variable to set
1817
+ */
1818
+ addTrialData(variableName: string, value: JsonSchemaDataTypeScriptTypes): void;
1819
+ /**
1820
+ * Sets the value of a variable that will be the same for all trials.
1821
+ *
1822
+ * @remarks This sets the value of a variable that is the same across
1823
+ * all trials ("static"). This is useful for variables that are not
1824
+ * part of the trial schema, but that you want to save for each trial in
1825
+ * your use case. For example, you might want to save the subject's
1826
+ * participant ID for each trial, but this is not part of the trial schema.
1827
+ * Rather than modify the source code for the game, you can do the following
1828
+ * to ensure that the participant ID is saved for each trial:
1829
+ *
1830
+ * game.addTrialSchema(&#123
1831
+ * participant_id: &#123
1832
+ * type: "string",
1833
+ * description: "ID of the participant",
1834
+ * &#125;
1835
+ * &#125;);
1836
+ * game.addStaticTrialData("participant_id", "12345");
1837
+ *
1838
+ * When Game.trialComplete() is called, the participant_id variable will
1839
+ * be saved for the trial with the value "12345".
1840
+ *
1841
+ * @param variableName - variable to be set
1842
+ * @param value - value of the variable to set
1843
+ */
1844
+ addStaticTrialData(variableName: string, value: JsonSchemaDataTypeScriptTypes): void;
1845
+ /**
1846
+ * Adds data to the game's scoring data.
1847
+ *
1848
+ * @remarks The variable name (or object property names) must be previously
1849
+ * defined in the {@link ScoringSchema} object in {@link GameOptions}.
1850
+ * The type of the value must match what was defined in the scoring schema,
1851
+ * otherwise an error is thrown.
1852
+ *
1853
+ * @param variableNameOrObject - Either a variable name (string) or an object
1854
+ * containing multiple key-value pairs to add all at once.
1855
+ * @param value - Value of the variable to set (only used when
1856
+ * variableNameOrObject is a variable name string).
1857
+ */
1858
+ addScoringData(variableNameOrObject: string | Record<string, JsonSchemaDataTypeScriptTypes> | Array<Record<string, JsonSchemaDataTypeScriptTypes>>, value?: JsonSchemaDataTypeScriptTypes): void;
1859
+ /**
1860
+ * Helper method to validate and set a single scoring variable
1861
+ *
1862
+ * @param variableName - Name of the variable to set
1863
+ * @param value - Value to set
1864
+ * @private
1865
+ */
1866
+ private validateAndSetScoringVariable;
1867
+ getDeviceMetadata(): DeviceMetadata;
1868
+ makeNewGameDataSchema(): JsonSchema;
1869
+ makeGameDataSchema(): JsonSchema;
1870
+ makeScoringDataSchema(): JsonSchema;
1871
+ private validateSchema;
1872
+ }
1873
+
1562
1874
  declare class Game implements Activity {
1563
1875
  readonly type = ActivityType.Game;
1564
1876
  _canvasKit?: CanvasKit;
@@ -1586,12 +1898,12 @@ declare class Game implements Activity {
1586
1898
  private _dataStores?;
1587
1899
  private plugins;
1588
1900
  additionalParameters?: unknown;
1589
- staticTrialSchema: {
1590
- [key: string]: JsonSchemaDataTypeScriptTypes;
1591
- };
1592
1901
  private _fontManager?;
1593
1902
  private _imageManager?;
1594
1903
  private _soundManager?;
1904
+ private _inputManager?;
1905
+ sceneManager: SceneManager;
1906
+ dataManager: DataManager;
1595
1907
  manifest?: Manifest;
1596
1908
  eventStore: EventStore;
1597
1909
  private nodeFactory;
@@ -1604,7 +1916,22 @@ declare class Game implements Activity {
1604
1916
  * @param options - {@link GameOptions}
1605
1917
  */
1606
1918
  constructor(options: GameOptions);
1607
- private createFreeNodesScene;
1919
+ /**
1920
+ * Returns the base URL of an imported module.
1921
+ *
1922
+ * @remarks Previously, a regex was used:
1923
+ * `const regex = new RegExp(`^.*${packageName}[^\\/]*`);`
1924
+ * but this triggered irrelevant warnings for ReDoS in some overly
1925
+ * sensitive package scanners, so now we use URL and pathname parsing.
1926
+ * Also: trailing slashes are removed from the returned base URL.
1927
+ *
1928
+ * @param packageName - the name of the imported package module, like
1929
+ * `@m2c2kit/assessment-symbol-search`
1930
+ * @param moduleUrl - the full URL of the module's entrypoint, possibly
1931
+ * including a version suffix, like `https://cdn.com/@m2c2kit/assessment-symbol-search@0.8.13/dist/index.js`
1932
+ * @returns - the base URL of the imported module, without the entrypoint,
1933
+ * like `https://cdn.com/@m2c2kit/assessment-symbol-search@0.8.13`
1934
+ */
1608
1935
  private getImportedModuleBaseUrl;
1609
1936
  private addLocalizationParametersToGameParameters;
1610
1937
  init(): Promise<void>;
@@ -1654,6 +1981,29 @@ declare class Game implements Activity {
1654
1981
  set soundManager(soundManager: SoundManager);
1655
1982
  get eventMaterializer(): EventMaterializer;
1656
1983
  set eventMaterializer(eventMaterializer: EventMaterializer);
1984
+ get inputManager(): InputManager;
1985
+ set inputManager(inputManager: InputManager);
1986
+ /**
1987
+ * Returns the scenes that have been added to the game.
1988
+ */
1989
+ get scenes(): Scene[];
1990
+ /**
1991
+ * Returns the current game scene.
1992
+ *
1993
+ * @remarks The current scene is the scene that is currently being
1994
+ * rendered. If no scene has been set as the current scene, this will
1995
+ * return undefined.
1996
+ */
1997
+ get currentScene(): Scene | undefined;
1998
+ /**
1999
+ * Returns the game snapshots.
2000
+ *
2001
+ * @remarks Snapshots are the most recent images of the current scene. These
2002
+ * are in raw CanvasKit `Image` format and must be converted to another
2003
+ * format, such as PNG via `CanvasKit.MakeImage()`, before they can be
2004
+ * meaningfully exported.
2005
+ */
2006
+ get snapshots(): canvaskit_wasm.Image[];
1657
2007
  /**
1658
2008
  * Adds prefixes to a key to ensure that keys are unique across activities
1659
2009
  * and studies.
@@ -1779,14 +2129,14 @@ declare class Game implements Activity {
1779
2129
  set canvasKit(canvasKit: CanvasKit);
1780
2130
  /** The scene, or its name as a string, to be presented when the game is started. If this is undefined, the game will start with the first scene that has been added */
1781
2131
  entryScene?: Scene | string;
1782
- data: GameData;
2132
+ /** The participant data generated by the game. */
2133
+ get data(): GameData;
1783
2134
  /** The 0-based index of the current trial */
1784
- trialIndex: number;
2135
+ get trialIndex(): number;
1785
2136
  private htmlCanvas?;
1786
2137
  surface?: Surface;
1787
2138
  private showFps?;
1788
- private bodyBackgroundColor?;
1789
- currentScene?: Scene;
2139
+ bodyBackgroundColor?: RgbaColor;
1790
2140
  private priorUpdateTime?;
1791
2141
  private fpsTextFont?;
1792
2142
  private fpsTextPaint?;
@@ -1797,14 +2147,8 @@ declare class Game implements Activity {
1797
2147
  private animationFramesRequested;
1798
2148
  private limitFps;
1799
2149
  private gameStopRequested;
1800
- private webGlRendererInfo;
1801
2150
  canvasCssWidth: number;
1802
2151
  canvasCssHeight: number;
1803
- scenes: Scene[];
1804
- freeNodesScene: Scene;
1805
- private incomingSceneTransitions;
1806
- private currentSceneSnapshot?;
1807
- private pendingScreenshot?;
1808
2152
  /**
1809
2153
  * Adds a node as a free node (a node that is not part of a scene)
1810
2154
  * to the game.
@@ -1865,19 +2209,6 @@ declare class Game implements Activity {
1865
2209
  * @param scene
1866
2210
  */
1867
2211
  addScene(scene: Scene): void;
1868
- /**
1869
- * Adds events from a node and its children to the game's event store.
1870
- *
1871
- * @remarks This method is first called when a scene is added to the game.
1872
- * If the scene or any of its descendants was constructed or had its
1873
- * properties changed before it was added to the game, these events were
1874
- * stored within the node (because the game event store was not yet
1875
- * available). This method retrieves these events from the node and adds
1876
- * them to the game's event store.
1877
- *
1878
- * @param node - node that contains events to add
1879
- */
1880
- private addNodeEvents;
1881
2212
  /**
1882
2213
  * Adds multiple scenes to the game.
1883
2214
  *
@@ -1985,10 +2316,6 @@ declare class Game implements Activity {
1985
2316
  * end-user must not call this. FOR INTERNAL USE ONLY.
1986
2317
  */
1987
2318
  dispose(): void;
1988
- private initData;
1989
- private validateSchema;
1990
- private propertySchemaDataTypeIsValid;
1991
- private getDeviceMetadata;
1992
2319
  /**
1993
2320
  * Adds data to the game's TrialData object.
1994
2321
  *
@@ -2015,14 +2342,6 @@ declare class Game implements Activity {
2015
2342
  * variableNameOrObject is a variable name string).
2016
2343
  */
2017
2344
  addScoringData(variableNameOrObject: string | Record<string, JsonSchemaDataTypeScriptTypes> | Array<Record<string, JsonSchemaDataTypeScriptTypes>>, value?: JsonSchemaDataTypeScriptTypes): void;
2018
- /**
2019
- * Helper method to validate and set a single scoring variable
2020
- *
2021
- * @param variableName - Name of the variable to set
2022
- * @param value - Value to set
2023
- * @private
2024
- */
2025
- private validateAndSetScoringVariable;
2026
2345
  /**
2027
2346
  * Adds custom trial schema to the game's trialSchema object.
2028
2347
  *
@@ -2082,18 +2401,6 @@ declare class Game implements Activity {
2082
2401
  * to call this at the appropriate time. It is not triggered automatically.
2083
2402
  */
2084
2403
  scoringComplete(): void;
2085
- /**
2086
- * The m2c2kit engine will automatically include these schema and their
2087
- * values in the scoring data.
2088
- */
2089
- private readonly automaticScoringSchema;
2090
- /**
2091
- * The m2c2kit engine will automatically include these schema and their
2092
- * values in the trial data.
2093
- */
2094
- private readonly automaticTrialSchema;
2095
- private makeNewGameDataSchema;
2096
- private makeGameDataSchema;
2097
2404
  /**
2098
2405
  * GameParameters combines default parameters values and
2099
2406
  * JSON Schema to describe what the parameters are.
@@ -2103,7 +2410,6 @@ declare class Game implements Activity {
2103
2410
  */
2104
2411
  private makeGameActivityConfiguration;
2105
2412
  private makeGameActivityConfigurationSchema;
2106
- private makeScoringDataSchema;
2107
2413
  /**
2108
2414
  * Should be called when current game has ended successfully.
2109
2415
  *
@@ -2128,20 +2434,10 @@ declare class Game implements Activity {
2128
2434
  cancel(): void;
2129
2435
  private setupHtmlCanvases;
2130
2436
  private setupCanvasKitSurface;
2131
- private interceptWebGlCalls;
2132
2437
  private setupFpsFont;
2133
- private setupCanvasDomEventHandlers;
2438
+ private setupInputManager;
2134
2439
  private loop;
2135
- snapshots: Image[];
2136
2440
  private updateGameTime;
2137
- private handleIncomingSceneTransitions;
2138
- /**
2139
- * Creates a scene that has a screen shot of the current scene.
2140
- *
2141
- * @param outgoingSceneImage - an image of the current scene
2142
- * @returns - the scene with the screen shot
2143
- */
2144
- private createOutgoingScene;
2145
2441
  /**
2146
2442
  * Registers a plugin with the game.
2147
2443
  *
@@ -2156,10 +2452,6 @@ declare class Game implements Activity {
2156
2452
  *
2157
2453
  */
2158
2454
  private update;
2159
- /**
2160
- * Updates all active scenes and their children.
2161
- */
2162
- private updateScenes;
2163
2455
  /**
2164
2456
  * Executes all active plugins before scenes are updated.
2165
2457
  */
@@ -2170,8 +2462,6 @@ declare class Game implements Activity {
2170
2462
  private executeAfterUpdatePlugins;
2171
2463
  private draw;
2172
2464
  private calculateFps;
2173
- private takeCurrentSceneSnapshot;
2174
- private handlePendingScreenshot;
2175
2465
  /**
2176
2466
  * Takes screenshot of canvas
2177
2467
  *
@@ -2188,7 +2478,6 @@ declare class Game implements Activity {
2188
2478
  * @returns Promise of Uint8Array of image data
2189
2479
  */
2190
2480
  takeScreenshot(sx?: number, sy?: number, sw?: number, sh?: number): Promise<Uint8Array | null>;
2191
- private animateSceneTransition;
2192
2481
  private drawFps;
2193
2482
  /**
2194
2483
  * Creates an event listener for a node based on the node name
@@ -2209,42 +2498,6 @@ declare class Game implements Activity {
2209
2498
  * @deprecated use Game.nodes instead
2210
2499
  */
2211
2500
  get entities(): Array<M2Node>;
2212
- /**
2213
- * Receives callback from DOM PointerDown event
2214
- *
2215
- * @param domPointerEvent - PointerEvent from the DOM
2216
- * @returns
2217
- */
2218
- private htmlCanvasPointerDownHandler;
2219
- private htmlCanvasPointerUpHandler;
2220
- private htmlCanvasPointerMoveHandler;
2221
- private htmlCanvasPointerLeaveHandler;
2222
- private documentKeyDownHandler;
2223
- private documentKeyUpHandler;
2224
- /**
2225
- * Determines if/how m2c2kit nodes respond to the DOM PointerDown event
2226
- *
2227
- * @param node - node that might be affected by the DOM PointerDown event
2228
- * @param nodeEvent
2229
- * @param domPointerEvent
2230
- */
2231
- private processDomPointerDown;
2232
- private processDomPointerUp;
2233
- private processDomPointerMove;
2234
- private processDomPointerLeave;
2235
- private raiseM2PointerDownEvent;
2236
- private raiseTapDownEvent;
2237
- private raiseTapLeaveEvent;
2238
- private raiseM2PointerUpEvent;
2239
- private raiseTapUpEvent;
2240
- private raiseTapUpAny;
2241
- private raiseM2PointerMoveEvent;
2242
- private raiseM2PointerLeaveEvent;
2243
- private raiseM2DragStartEvent;
2244
- private raiseM2DragEvent;
2245
- private raiseM2DragEndEvent;
2246
- private raiseSceneEvent;
2247
- private calculatePointWithinNodeFromDomPointerEvent;
2248
2501
  /**
2249
2502
  * Executes a callback when the game starts.
2250
2503
  *
@@ -2293,18 +2546,6 @@ declare class Game implements Activity {
2293
2546
  onWarmupEnd(callback: (activityEvent: ActivityEvent) => void, options?: CallbackOptions): void;
2294
2547
  private addEventListener;
2295
2548
  private raiseActivityEventOnListeners;
2296
- private raiseEventOnListeningNodes;
2297
- private sceneCanReceiveUserInteraction;
2298
- /**
2299
- *
2300
- * Checks if the given canvas point is within the node's bounds.
2301
- *
2302
- * @param node - node to check bounds for
2303
- * @param x - x coordinate of the canvas point
2304
- * @param y - y coordinate of the canvas point
2305
- * @returns true if x, y point is within the node's bounds
2306
- */
2307
- private IsCanvasPointWithinNodeBounds;
2308
2549
  }
2309
2550
 
2310
2551
  /**
@@ -4027,6 +4268,13 @@ declare class M2c2KitHelpers {
4027
4268
  * "https://", "file://", etc.)
4028
4269
  */
4029
4270
  static urlHasScheme(url: string): boolean;
4271
+ /**
4272
+ * Sanitizes parameters object to prevent prototype pollution.
4273
+ *
4274
+ * @param parameters - parameters object to be sanitized
4275
+ * @returns sanitized parameters or undefined if parameters is undefined
4276
+ */
4277
+ static sanitizeParameters(parameters: unknown | undefined): any;
4030
4278
  /**
4031
4279
  * Converts a value to a JSON schema type or one of types.
4032
4280
  *
@@ -5505,6 +5753,7 @@ declare class WebGlInfo {
5505
5753
  * Removes the temporary canvas that was created to get WebGL information.
5506
5754
  */
5507
5755
  static dispose(): void;
5756
+ static interceptWebGlCalls(htmlCanvas: HTMLCanvasElement): void;
5508
5757
  }
5509
5758
 
5510
5759
  export { Action, ActivityType, CanvasKitHelpers, ColorfulMutablePath, Composite, Constants, ConstraintType, CustomAction, Dimensions, Easings, Equal, Equals, EventStore, EventStoreMode, FadeAlphaAction, FontManager, Game, GroupAction, I18n, ImageManager, Label, LabelHorizontalAlignmentMode, LayoutConstraint, LegacyTimer, M2Error, M2EventType, M2ImageStatus, M2Node, M2NodeFactory, M2NodeType, M2SoundStatus, M2c2KitHelpers, MoveAction, MutablePath, NoneTransition, PlayAction, RandomDraws, RepeatAction, RepeatForeverAction, RotateAction, ScaleAction, Scene, SceneTransition, SequenceAction, Shape, ShapeType, SlideTransition, SoundManager, SoundPlayer, SoundRecorder, Sprite, Story, TextLine, Timer, Transition, TransitionDirection, TransitionType, Uuid, WaitAction, WebColors, WebGlInfo, handleInterfaceOptions };