q5 4.7.1 → 4.7.2

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.
Files changed (4) hide show
  1. package/package.json +1 -1
  2. package/q5.d.ts +8 -7
  3. package/q5.js +1 -0
  4. package/q5.pyi +53 -75
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "q5",
3
- "version": "4.7.1",
3
+ "version": "4.7.2",
4
4
  "description": "Beginner friendly graphics powered by WebGPU, optimized for interactive art!",
5
5
  "author": "quinton-ashley",
6
6
  "license": "LGPL-3.0-only",
package/q5.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ /** @module q5 */
1
2
  declare global {
2
3
 
3
4
  // ⭐ core
@@ -1686,7 +1687,7 @@ declare global {
1686
1687
  * Like the [`color`](https://q5js.org/learn/#color) function,
1687
1688
  * this function can accept colors in a wide range of formats:
1688
1689
  * CSS color string, grayscale value, and color component values.
1689
- * @param {Color | Q5.Image} filler a color or image to draw
1690
+ * @param {string | Color | Q5.Image} filler color or image
1690
1691
  * @example
1691
1692
  * await Canvas(200, 100);
1692
1693
  * background('crimson');
@@ -1696,7 +1697,7 @@ declare global {
1696
1697
  * circle(mouseX, mouseY, 20);
1697
1698
  * };
1698
1699
  */
1699
- function background(filler: Color | Q5.Image): void;
1700
+ function background(c0: number, c1: number, c2: number, c3: number): void;
1700
1701
 
1701
1702
  class Color {
1702
1703
 
@@ -1739,7 +1740,7 @@ declare global {
1739
1740
  * Like the [`color`](https://q5js.org/learn/#color) function, this function
1740
1741
  * can accept colors in a wide range of formats: as a CSS color string,
1741
1742
  * a `Color` object, grayscale value, or color component values.
1742
- * @param {Color} color fill color
1743
+ * @param {string | Color} color fill color
1743
1744
  * @example
1744
1745
  * await Canvas(200);
1745
1746
  * background(0.8);
@@ -1750,7 +1751,7 @@ declare global {
1750
1751
  * fill('lime');
1751
1752
  * square(-20, -20, 80);
1752
1753
  */
1753
- function fill(color: Color): void;
1754
+ function fill(c0: number, c1: number, c2: number, c3: number): void;
1754
1755
 
1755
1756
  /** 💅
1756
1757
  * Sets the stroke (outline) color. The default is black.
@@ -1758,7 +1759,7 @@ declare global {
1758
1759
  * Like the [`color`](https://q5js.org/learn/#color) function, this function
1759
1760
  * can accept colors in a wide range of formats: as a CSS color string,
1760
1761
  * a `Color` object, grayscale value, or color component values.
1761
- * @param {Color} color stroke color
1762
+ * @param {string | Color} color stroke color
1762
1763
  * @example
1763
1764
  * await Canvas(200);
1764
1765
  * background(0.8);
@@ -1770,7 +1771,7 @@ declare global {
1770
1771
  * stroke('lime');
1771
1772
  * square(-20, -20, 80);
1772
1773
  */
1773
- function stroke(color: Color): void;
1774
+ function stroke(c0: number, c1: number, c2: number, c3: number): void;
1774
1775
 
1775
1776
  /** 💅
1776
1777
  * After calling this function, drawing will not be filled.
@@ -1843,7 +1844,7 @@ declare global {
1843
1844
  * a `Color` object, grayscale value, or color component values.
1844
1845
  *
1845
1846
  * Not available in q5 WebGPU.
1846
- * @param {Color} color shadow color
1847
+ * @param {string | Color} color shadow color
1847
1848
  */
1848
1849
  function shadow(color: string | Color): void;
1849
1850
 
package/q5.js CHANGED
@@ -9656,6 +9656,7 @@ const runPython = async function () {
9656
9656
 
9657
9657
  const useWebGPU = !code.slice(0, code.indexOf('\n')).includes('C2D'),
9658
9658
  q = useWebGPU ? await Q5.WebGPU() : new Q5();
9659
+ q._py = true;
9659
9660
  await q.ready;
9660
9661
 
9661
9662
  let pyReady;
package/q5.pyi CHANGED
@@ -1662,7 +1662,7 @@ Example::
1662
1662
  background(1, 0, 0)
1663
1663
  """
1664
1664
 
1665
- def background(filler: Color | Image) -> None:
1665
+ def background(filler: str | Color | Image) -> None:
1666
1666
  """🎨
1667
1667
  Draws over the entire canvas with a color or image.
1668
1668
 
@@ -1670,7 +1670,7 @@ def background(filler: Color | Image) -> None:
1670
1670
  this function can accept colors in a wide range of formats:
1671
1671
  CSS color string, grayscale value, and color component values.
1672
1672
 
1673
- :param filler: a color or image to draw
1673
+ :param filler: color or image
1674
1674
 
1675
1675
  Example::
1676
1676
 
@@ -1689,26 +1689,25 @@ class Color:
1689
1689
  """
1690
1690
 
1691
1691
 
1692
- def equals(self) -> None:
1692
+ def equals(self) -> bool:
1693
1693
  """🎨 Checks if this color is exactly equal to another color."""
1694
1694
  ...
1695
1695
 
1696
- def isSameColor(self) -> None:
1696
+ def isSameColor(self) -> bool:
1697
1697
  """🎨 Checks if the color is the same as another color,
1698
1698
  disregarding their alpha values."""
1699
1699
  ...
1700
1700
 
1701
- def toString(self) -> None:
1701
+ def toString(self) -> str:
1702
1702
  """🎨 Produces a CSS color string representation."""
1703
1703
  ...
1704
1704
 
1705
- def levels(self) -> None:
1706
- """🎨 An array of the color's components."""
1707
- ...
1705
+ levels: list[float]
1706
+ """🎨 An array of the color's components."""
1708
1707
 
1709
1708
  # 💅 styles
1710
1709
 
1711
- def fill(color: Color) -> None:
1710
+ def fill(color: str | Color) -> None:
1712
1711
  """💅
1713
1712
  Sets the fill color. The default is white.
1714
1713
 
@@ -1731,7 +1730,7 @@ def fill(color: Color) -> None:
1731
1730
  """
1732
1731
  ...
1733
1732
 
1734
- def stroke(color: Color) -> None:
1733
+ def stroke(color: str | Color) -> None:
1735
1734
  """💅
1736
1735
  Sets the stroke (outline) color. The default is black.
1737
1736
 
@@ -1829,7 +1828,7 @@ def opacity(alpha: float) -> None:
1829
1828
  """
1830
1829
  ...
1831
1830
 
1832
- def shadow(color: Color) -> None:
1831
+ def shadow(color: str | Color) -> None:
1833
1832
  """💅
1834
1833
  Sets the shadow color. The default is transparent (no shadow).
1835
1834
 
@@ -3057,30 +3056,24 @@ class Sound:
3057
3056
  """
3058
3057
 
3059
3058
 
3060
- def volume(self) -> None:
3061
- """🔊 Set the sound's volume to a value between
3059
+ volume: float
3060
+ """🔊 Set the sound's volume to a value between
3062
3061
  0 (silent) and 1 (full volume)."""
3063
- ...
3064
3062
 
3065
- def pan(self) -> None:
3066
- """🔊 Set the sound's stereo position between -1 (left) and 1 (right)."""
3067
- ...
3063
+ pan: float
3064
+ """🔊 Set the sound's stereo position between -1 (left) and 1 (right)."""
3068
3065
 
3069
- def loop(self) -> None:
3070
- """🔊 Set to true to make the sound loop continuously."""
3071
- ...
3066
+ loop: bool
3067
+ """🔊 Set to true to make the sound loop continuously."""
3072
3068
 
3073
- def loaded(self) -> None:
3074
- """🔊 True if the sound data has finished loading."""
3075
- ...
3069
+ loaded: bool
3070
+ """🔊 True if the sound data has finished loading."""
3076
3071
 
3077
- def paused(self) -> None:
3078
- """🔊 True if the sound is currently paused."""
3079
- ...
3072
+ paused: bool
3073
+ """🔊 True if the sound is currently paused."""
3080
3074
 
3081
- def ended(self) -> None:
3082
- """🔊 True if the sound has finished playing."""
3083
- ...
3075
+ ended: bool
3076
+ """🔊 True if the sound has finished playing."""
3084
3077
 
3085
3078
  def play(self) -> object:
3086
3079
  """🔊 Plays the sound.
@@ -3768,17 +3761,14 @@ class Vector:
3768
3761
  """
3769
3762
 
3770
3763
 
3771
- def x(self) -> None:
3772
- """↗ The x component of the vector."""
3773
- ...
3764
+ x: float
3765
+ """↗ The x component of the vector."""
3774
3766
 
3775
- def y(self) -> None:
3776
- """↗ The y component of the vector."""
3777
- ...
3767
+ y: float
3768
+ """↗ The y component of the vector."""
3778
3769
 
3779
- def z(self) -> None:
3780
- """↗ The z component of the vector, if applicable."""
3781
- ...
3770
+ z: float
3771
+ """↗ The z component of the vector, if applicable."""
3782
3772
 
3783
3773
  def add(self, v: Vector) -> Vector:
3784
3774
  """↗ Adds a vector to this vector."""
@@ -4330,74 +4320,63 @@ class Q5:
4330
4320
  """
4331
4321
 
4332
4322
 
4333
- def version(self) -> str:
4334
- """⚙ The current minor version of q5."""
4335
- ...
4323
+ version: str
4324
+ """⚙ The current minor version of q5."""
4336
4325
 
4337
- def lang(self) -> None:
4338
- """⚙ Set to a language code other than 'en' (English) to use q5 in an additional language.
4326
+ lang: str
4327
+ """⚙ Set to a language code other than 'en' (English) to use q5 in an additional language.
4339
4328
 
4340
4329
  Currently supported languages:
4341
4330
 
4342
4331
  - 'es' (Spanish)"""
4343
- ...
4344
4332
 
4345
- def disableFriendlyErrors(self) -> None:
4346
- """⚙ Turn off q5's friendly error messages."""
4347
- ...
4333
+ disableFriendlyErrors: bool
4334
+ """⚙ Turn off q5's friendly error messages."""
4348
4335
 
4349
- def errorTolerant(self) -> None:
4350
- """⚙ Set to true to keep draw looping after an error."""
4351
- ...
4336
+ errorTolerant: bool
4337
+ """⚙ Set to true to keep draw looping after an error."""
4352
4338
 
4353
- def supportsHDR(self) -> None:
4354
- """⚙ True if the device supports HDR (the display-p3 colorspace)."""
4355
- ...
4339
+ supportsHDR: bool
4340
+ """⚙ True if the device supports HDR (the display-p3 colorspace)."""
4356
4341
 
4357
- def canvasOptions(self) -> None:
4358
- """⚙ Sets the default canvas context attributes used for newly created
4342
+ canvasOptions: dict
4343
+ """⚙ Sets the default canvas context attributes used for newly created
4359
4344
  canvases and internal graphics. These options are overwritten by any
4360
4345
  per-canvas options you pass to Canvas."""
4361
- ...
4362
4346
 
4363
- def MAX_TRANSFORMS(self) -> None:
4364
- """⚙ A WebGPU memory allocation limit.
4347
+ MAX_TRANSFORMS: float
4348
+ """⚙ A WebGPU memory allocation limit.
4365
4349
 
4366
4350
  The maximum number of transformation matrixes
4367
4351
  that can be used per frame."""
4368
- ...
4369
4352
 
4370
- def MAX_RECTS(self) -> None:
4371
- """⚙ A WebGPU memory allocation limit.
4353
+ MAX_RECTS: float
4354
+ """⚙ A WebGPU memory allocation limit.
4372
4355
 
4373
4356
  The maximum number of rectangles
4374
4357
  (calls to rect, square, capsule)
4375
4358
  that can be drawn per frame."""
4376
- ...
4377
4359
 
4378
- def MAX_ELLIPSES(self) -> None:
4379
- """⚙ A WebGPU memory allocation limit.
4360
+ MAX_ELLIPSES: float
4361
+ """⚙ A WebGPU memory allocation limit.
4380
4362
 
4381
4363
  The maximum number of ellipses
4382
4364
  (calls to ellipse, circle, and arc)
4383
4365
  that can be drawn per frame."""
4384
- ...
4385
4366
 
4386
- def MAX_CHARS(self) -> None:
4387
- """⚙ A WebGPU memory allocation limit.
4367
+ MAX_CHARS: float
4368
+ """⚙ A WebGPU memory allocation limit.
4388
4369
 
4389
4370
  The maximum number of text characters
4390
4371
  that can be drawn per frame."""
4391
- ...
4392
4372
 
4393
- def MAX_TEXTS(self) -> None:
4394
- """⚙ A WebGPU memory allocation limit.
4373
+ MAX_TEXTS: float
4374
+ """⚙ A WebGPU memory allocation limit.
4395
4375
 
4396
4376
  The maximum number of separate calls to text
4397
4377
  that can be drawn per frame."""
4398
- ...
4399
4378
 
4400
- def WebGPU(self) -> None:
4379
+ def WebGPU(self) -> Q5:
4401
4380
  """⚙ Creates a new Q5 instance that uses q5's WebGPU renderer."""
4402
4381
  ...
4403
4382
 
@@ -4412,14 +4391,13 @@ Inside the function, this refers to the Q5 instance."""
4412
4391
  """⚙ p5.js v2 compatible way to register an addon with q5."""
4413
4392
  ...
4414
4393
 
4415
- def modules(self) -> None:
4416
- """⚙ An object containing q5's modules, functions that run when q5 loads.
4394
+ modules: dict
4395
+ """⚙ An object containing q5's modules, functions that run when q5 loads.
4417
4396
 
4418
4397
  Each function receives two input parameters:
4419
4398
 
4420
4399
  - the q5 instance
4421
4400
  - a proxy for editing the q5 instance and corresponding properties of the global scope"""
4422
- ...
4423
4401
 
4424
4402
  def draw(self) -> None:
4425
4403
  """⚙ The q5 draw function is run 60 times per second by default."""