p5 2.2.2 → 2.2.3-rc.0

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 (96) hide show
  1. package/dist/accessibility/color_namer.js +5 -5
  2. package/dist/accessibility/index.js +5 -5
  3. package/dist/app.js +5 -5
  4. package/dist/color/color_conversion.js +5 -5
  5. package/dist/color/index.js +1 -1
  6. package/dist/color/setting.js +1 -1
  7. package/dist/{constants-BxjhKpTv.js → constants-D3ryGa0m.js} +1 -1
  8. package/dist/core/constants.js +1 -1
  9. package/dist/core/environment.js +7 -3
  10. package/dist/core/filterShaders.js +1 -1
  11. package/dist/core/friendly_errors/fes_core.js +1 -1
  12. package/dist/core/friendly_errors/file_errors.js +1 -1
  13. package/dist/core/friendly_errors/index.js +1 -1
  14. package/dist/core/friendly_errors/param_validator.js +2063 -2014
  15. package/dist/core/friendly_errors/sketch_verifier.js +1 -1
  16. package/dist/core/helpers.js +1 -1
  17. package/dist/core/init.js +5 -5
  18. package/dist/core/internationalization.js +1 -1
  19. package/dist/core/legacy.js +5 -5
  20. package/dist/core/main.js +5 -5
  21. package/dist/core/p5.Graphics.js +3 -3
  22. package/dist/core/p5.Renderer.js +2 -2
  23. package/dist/core/p5.Renderer2D.js +5 -5
  24. package/dist/core/p5.Renderer3D.js +3 -3
  25. package/dist/core/rendering.js +3 -3
  26. package/dist/dom/dom.js +1 -1
  27. package/dist/dom/index.js +1 -1
  28. package/dist/dom/p5.Element.js +1 -1
  29. package/dist/dom/p5.MediaElement.js +11 -4
  30. package/dist/events/pointer.js +4 -0
  31. package/dist/image/const.js +1 -1
  32. package/dist/image/filterRenderer2D.js +4 -4
  33. package/dist/image/image.js +3 -3
  34. package/dist/image/index.js +3 -3
  35. package/dist/image/loading_displaying.js +3 -3
  36. package/dist/image/p5.Image.js +2 -2
  37. package/dist/io/files.js +3 -3
  38. package/dist/io/index.js +3 -3
  39. package/dist/{ir_builders-w12-GSxu.js → ir_builders-DMfaOLIL.js} +48 -8
  40. package/dist/{main-DDs4QOnh.js → main-CGwYa9-f.js} +126 -36
  41. package/dist/math/Matrices/Matrix.js +1 -1
  42. package/dist/math/Matrices/MatrixNumjs.js +1 -1
  43. package/dist/math/index.js +1 -1
  44. package/dist/math/p5.Matrix.js +1 -1
  45. package/dist/math/p5.Vector.js +1 -1
  46. package/dist/math/trigonometry.js +1 -1
  47. package/dist/{p5.Renderer-BSGddFv7.js → p5.Renderer-C0e0XesC.js} +9 -2
  48. package/dist/{rendering-C9g7uSQ5.js → rendering-4Z2qdE_W.js} +90 -55
  49. package/dist/shape/2d_primitives.js +1 -1
  50. package/dist/shape/attributes.js +1 -1
  51. package/dist/shape/custom_shapes.js +1 -1
  52. package/dist/shape/index.js +1 -1
  53. package/dist/strands/ir_builders.js +1 -1
  54. package/dist/strands/ir_dag.js +32 -2
  55. package/dist/strands/ir_types.js +18 -11
  56. package/dist/strands/p5.strands.js +15 -2
  57. package/dist/strands/strands_api.js +86 -40
  58. package/dist/strands/strands_conditionals.js +1 -1
  59. package/dist/strands/strands_for.js +1 -1
  60. package/dist/strands/strands_node.js +1 -1
  61. package/dist/strands/strands_phi_utils.js +27 -9
  62. package/dist/strands/strands_transpiler.js +1237 -831
  63. package/dist/type/index.js +2 -2
  64. package/dist/type/p5.Font.js +7 -5
  65. package/dist/type/textCore.js +2 -2
  66. package/dist/webgl/3d_primitives.js +3 -3
  67. package/dist/webgl/GeometryBuilder.js +1 -1
  68. package/dist/webgl/ShapeBuilder.js +1 -1
  69. package/dist/webgl/enums.js +1 -1
  70. package/dist/webgl/index.js +4 -4
  71. package/dist/webgl/interaction.js +1 -1
  72. package/dist/webgl/light.js +3 -3
  73. package/dist/webgl/loading.js +41 -35
  74. package/dist/webgl/material.js +3 -3
  75. package/dist/webgl/p5.Camera.js +3 -3
  76. package/dist/webgl/p5.Framebuffer.js +3 -3
  77. package/dist/webgl/p5.Geometry.js +1 -1
  78. package/dist/webgl/p5.Quat.js +1 -1
  79. package/dist/webgl/p5.RendererGL.js +4 -4
  80. package/dist/webgl/p5.Texture.js +3 -3
  81. package/dist/webgl/strands_glslBackend.js +1 -1
  82. package/dist/webgl/text.js +3 -3
  83. package/dist/webgl/utils.js +3 -3
  84. package/dist/webgpu/index.js +2 -2
  85. package/dist/webgpu/p5.RendererWebGPU.js +2 -2
  86. package/dist/webgpu/strands_wgslBackend.js +13 -4
  87. package/lib/p5.esm.js +3634 -2870
  88. package/lib/p5.esm.min.js +1 -1
  89. package/lib/p5.js +3634 -2870
  90. package/lib/p5.min.js +1 -1
  91. package/lib/p5.webgpu.esm.js +43 -15
  92. package/lib/p5.webgpu.js +43 -15
  93. package/lib/p5.webgpu.min.js +1 -1
  94. package/package.json +1 -1
  95. package/types/global.d.ts +805 -805
  96. package/types/p5.d.ts +415 -415
@@ -1,6 +1,6 @@
1
1
  import { parse } from 'acorn';
2
2
  import { simple } from 'acorn-walk';
3
- import { a3 as constants } from '../../constants-BxjhKpTv.js';
3
+ import { a3 as constants } from '../../constants-D3ryGa0m.js';
4
4
 
5
5
  // List of functions to ignore as they either are meant to be re-defined or
6
6
  // generate false positive outputs.
@@ -1,4 +1,4 @@
1
- import { p as CORNER, t as CORNERS, u as RADIUS, v as CENTER } from '../constants-BxjhKpTv.js';
1
+ import { p as CORNER, t as CORNERS, u as RADIUS, v as CENTER } from '../constants-D3ryGa0m.js';
2
2
 
3
3
  /**
4
4
  * @requires constants
package/dist/core/init.js CHANGED
@@ -1,17 +1,17 @@
1
- import { p as p5 } from '../main-DDs4QOnh.js';
1
+ import { p as p5 } from '../main-CGwYa9-f.js';
2
2
  import { initialize } from './internationalization.js';
3
- import '../constants-BxjhKpTv.js';
3
+ import '../constants-D3ryGa0m.js';
4
4
  import './transform.js';
5
5
  import './structure.js';
6
6
  import './environment.js';
7
- import '../rendering-C9g7uSQ5.js';
7
+ import '../rendering-4Z2qdE_W.js';
8
8
  import '../creating_reading-C7hu6sg1.js';
9
9
  import 'colorjs.io/fn';
10
10
  import '../color/color_spaces/hsb.js';
11
11
  import '../dom/p5.Element.js';
12
12
  import '../dom/p5.File.js';
13
13
  import '../io/p5.XML.js';
14
- import '../p5.Renderer-BSGddFv7.js';
14
+ import '../p5.Renderer-C0e0XesC.js';
15
15
  import '../image/filters.js';
16
16
  import '../math/p5.Vector.js';
17
17
  import '../shape/custom_shapes.js';
@@ -51,7 +51,7 @@ import '../webgl/strands_glslBackend.js';
51
51
  import '../strands/ir_types.js';
52
52
  import '../strands/ir_dag.js';
53
53
  import '../strands/strands_FES.js';
54
- import '../ir_builders-w12-GSxu.js';
54
+ import '../ir_builders-DMfaOLIL.js';
55
55
  import '../strands/ir_cfg.js';
56
56
  import '../strands/strands_builtins.js';
57
57
  import '../webgl/shaderHookUtils.js';
@@ -1,6 +1,6 @@
1
1
  import i18next from 'i18next';
2
2
  import LanguageDetector from 'i18next-browser-languagedetector';
3
- import { az as VERSION } from '../constants-BxjhKpTv.js';
3
+ import { az as VERSION } from '../constants-D3ryGa0m.js';
4
4
 
5
5
  var fes = {
6
6
  autoplay: "The media that tried to play (with '{{src}}') wasn't allowed to by this browser, most likely due to the browser's autoplay policy.\n\n+ More info: {{url}}",
@@ -1,16 +1,16 @@
1
- import { p as p5 } from '../main-DDs4QOnh.js';
2
- import '../constants-BxjhKpTv.js';
1
+ import { p as p5 } from '../main-CGwYa9-f.js';
2
+ import '../constants-D3ryGa0m.js';
3
3
  import './transform.js';
4
4
  import './structure.js';
5
5
  import './environment.js';
6
- import '../rendering-C9g7uSQ5.js';
6
+ import '../rendering-4Z2qdE_W.js';
7
7
  import '../creating_reading-C7hu6sg1.js';
8
8
  import 'colorjs.io/fn';
9
9
  import '../color/color_spaces/hsb.js';
10
10
  import '../dom/p5.Element.js';
11
11
  import '../dom/p5.File.js';
12
12
  import '../io/p5.XML.js';
13
- import '../p5.Renderer-BSGddFv7.js';
13
+ import '../p5.Renderer-C0e0XesC.js';
14
14
  import '../image/filters.js';
15
15
  import '../math/p5.Vector.js';
16
16
  import '../shape/custom_shapes.js';
@@ -50,7 +50,7 @@ import '../webgl/strands_glslBackend.js';
50
50
  import '../strands/ir_types.js';
51
51
  import '../strands/ir_dag.js';
52
52
  import '../strands/strands_FES.js';
53
- import '../ir_builders-w12-GSxu.js';
53
+ import '../ir_builders-DMfaOLIL.js';
54
54
  import '../strands/ir_cfg.js';
55
55
  import '../strands/strands_builtins.js';
56
56
  import '../webgl/shaderHookUtils.js';
package/dist/core/main.js CHANGED
@@ -1,10 +1,10 @@
1
- import '../constants-BxjhKpTv.js';
1
+ import '../constants-D3ryGa0m.js';
2
2
  import './transform.js';
3
3
  import './structure.js';
4
4
  import './environment.js';
5
- import '../rendering-C9g7uSQ5.js';
6
- import '../p5.Renderer-BSGddFv7.js';
7
- export { p as default } from '../main-DDs4QOnh.js';
5
+ import '../rendering-4Z2qdE_W.js';
6
+ import '../p5.Renderer-C0e0XesC.js';
7
+ export { p as default } from '../main-CGwYa9-f.js';
8
8
  import '../creating_reading-C7hu6sg1.js';
9
9
  import 'colorjs.io/fn';
10
10
  import '../color/color_spaces/hsb.js';
@@ -50,7 +50,7 @@ import '../webgl/strands_glslBackend.js';
50
50
  import '../strands/ir_types.js';
51
51
  import '../strands/ir_dag.js';
52
52
  import '../strands/strands_FES.js';
53
- import '../ir_builders-w12-GSxu.js';
53
+ import '../ir_builders-DMfaOLIL.js';
54
54
  import '../strands/ir_cfg.js';
55
55
  import '../strands/strands_builtins.js';
56
56
  import '../webgl/shaderHookUtils.js';
@@ -1,10 +1,10 @@
1
- import '../constants-BxjhKpTv.js';
1
+ import '../constants-D3ryGa0m.js';
2
2
  import '../shape/2d_primitives.js';
3
3
  import '../shape/attributes.js';
4
4
  import '../shape/curves.js';
5
5
  import '../shape/vertex.js';
6
6
  import '../color/setting.js';
7
- export { G as Graphics, n as default } from '../rendering-C9g7uSQ5.js';
7
+ export { G as Graphics, n as default } from '../rendering-4Z2qdE_W.js';
8
8
  import '../image/pixels.js';
9
9
  import './transform.js';
10
10
  import '../creating_reading-C7hu6sg1.js';
@@ -16,7 +16,7 @@ import '../color/color_spaces/hsb.js';
16
16
  import '../dom/p5.Element.js';
17
17
  import '../dom/p5.File.js';
18
18
  import '../io/p5.XML.js';
19
- import '../p5.Renderer-BSGddFv7.js';
19
+ import '../p5.Renderer-C0e0XesC.js';
20
20
  import '../image/filters.js';
21
21
  import '../math/p5.Vector.js';
22
22
  import './States.js';
@@ -1,6 +1,6 @@
1
1
  import '../creating_reading-C7hu6sg1.js';
2
- import '../constants-BxjhKpTv.js';
3
- export { R as Renderer, r as default } from '../p5.Renderer-BSGddFv7.js';
2
+ import '../constants-D3ryGa0m.js';
3
+ export { R as Renderer, r as default } from '../p5.Renderer-C0e0XesC.js';
4
4
  import '../math/p5.Vector.js';
5
5
  import '../shape/custom_shapes.js';
6
6
  import './States.js';
@@ -1,7 +1,7 @@
1
- import '../constants-BxjhKpTv.js';
2
- export { R as Renderer2D, r as default } from '../main-DDs4QOnh.js';
3
- import '../p5.Renderer-BSGddFv7.js';
4
- import '../rendering-C9g7uSQ5.js';
1
+ import '../constants-D3ryGa0m.js';
2
+ export { R as Renderer2D, r as default } from '../main-CGwYa9-f.js';
3
+ import '../p5.Renderer-C0e0XesC.js';
4
+ import '../rendering-4Z2qdE_W.js';
5
5
  import '../dom/p5.Element.js';
6
6
  import '../dom/p5.MediaElement.js';
7
7
  import '../creating_reading-C7hu6sg1.js';
@@ -50,7 +50,7 @@ import '../webgl/strands_glslBackend.js';
50
50
  import '../strands/ir_types.js';
51
51
  import '../strands/ir_dag.js';
52
52
  import '../strands/strands_FES.js';
53
- import '../ir_builders-w12-GSxu.js';
53
+ import '../ir_builders-DMfaOLIL.js';
54
54
  import '../strands/ir_cfg.js';
55
55
  import '../strands/strands_builtins.js';
56
56
  import '../webgl/shaderHookUtils.js';
@@ -1,6 +1,6 @@
1
- import '../constants-BxjhKpTv.js';
2
- export { R as Renderer3D, r as default } from '../rendering-C9g7uSQ5.js';
3
- import '../p5.Renderer-BSGddFv7.js';
1
+ import '../constants-D3ryGa0m.js';
2
+ export { R as Renderer3D, r as default } from '../rendering-4Z2qdE_W.js';
3
+ import '../p5.Renderer-C0e0XesC.js';
4
4
  import '../webgl/GeometryBuilder.js';
5
5
  import '../math/p5.Matrix.js';
6
6
  import '../math/p5.Vector.js';
@@ -1,12 +1,12 @@
1
- import '../constants-BxjhKpTv.js';
2
- export { k as default, x as renderers } from '../rendering-C9g7uSQ5.js';
1
+ import '../constants-D3ryGa0m.js';
2
+ export { k as default, x as renderers } from '../rendering-4Z2qdE_W.js';
3
3
  import '../creating_reading-C7hu6sg1.js';
4
4
  import 'colorjs.io/fn';
5
5
  import '../color/color_spaces/hsb.js';
6
6
  import '../dom/p5.Element.js';
7
7
  import '../dom/p5.File.js';
8
8
  import '../io/p5.XML.js';
9
- import '../p5.Renderer-BSGddFv7.js';
9
+ import '../p5.Renderer-C0e0XesC.js';
10
10
  import '../image/filters.js';
11
11
  import '../math/p5.Vector.js';
12
12
  import '../shape/custom_shapes.js';
package/dist/dom/dom.js CHANGED
@@ -4,7 +4,7 @@ import { File } from './p5.File.js';
4
4
  import '../creating_reading-C7hu6sg1.js';
5
5
  import 'colorjs.io/fn';
6
6
  import '../color/color_spaces/hsb.js';
7
- import '../constants-BxjhKpTv.js';
7
+ import '../constants-D3ryGa0m.js';
8
8
  import '../io/p5.XML.js';
9
9
 
10
10
  /**
package/dist/dom/index.js CHANGED
@@ -5,7 +5,7 @@ import file from './p5.File.js';
5
5
  import '../creating_reading-C7hu6sg1.js';
6
6
  import 'colorjs.io/fn';
7
7
  import '../color/color_spaces/hsb.js';
8
- import '../constants-BxjhKpTv.js';
8
+ import '../constants-D3ryGa0m.js';
9
9
  import '../io/p5.XML.js';
10
10
 
11
11
  function dom(p5){
@@ -1,6 +1,6 @@
1
1
  import { File } from './p5.File.js';
2
2
  import { C as Color } from '../creating_reading-C7hu6sg1.js';
3
- import { a4 as AUTO } from '../constants-BxjhKpTv.js';
3
+ import { a4 as AUTO } from '../constants-D3ryGa0m.js';
4
4
  import '../io/p5.XML.js';
5
5
  import 'colorjs.io/fn';
6
6
  import '../color/color_spaces/hsb.js';
@@ -4,7 +4,7 @@ import '../io/p5.XML.js';
4
4
  import '../creating_reading-C7hu6sg1.js';
5
5
  import 'colorjs.io/fn';
6
6
  import '../color/color_spaces/hsb.js';
7
- import '../constants-BxjhKpTv.js';
7
+ import '../constants-D3ryGa0m.js';
8
8
 
9
9
  /**
10
10
  * @module DOM
@@ -720,6 +720,13 @@ class MediaElement extends Element {
720
720
  duration() {
721
721
  return this.elt.duration;
722
722
  }
723
+ _checkIfTextureNeedsUpdate() {
724
+ const needsUpdate = this._frameOnTexture !== this._pInst.frameCount;
725
+ if (needsUpdate) {
726
+ this.setModified(true);
727
+ this._frameOnTexture = this._pInst.frameCount;
728
+ }
729
+ }
723
730
  _ensureCanvas() {
724
731
  if (!this.canvas) {
725
732
  this.canvas = document.createElement('canvas');
@@ -1654,13 +1661,13 @@ function media(p5, fn){
1654
1661
  if (domElement.width) {
1655
1662
  videoEl.width = domElement.width;
1656
1663
  videoEl.height = domElement.height;
1657
- if (flipped) {
1658
- videoEl.elt.style.transform = 'scaleX(-1)';
1659
- }
1660
1664
  } else {
1661
1665
  videoEl.width = videoEl.elt.width = domElement.videoWidth;
1662
1666
  videoEl.height = videoEl.elt.height = domElement.videoHeight;
1663
1667
  }
1668
+ if (flipped) {
1669
+ videoEl.elt.style.transform = 'scaleX(-1)';
1670
+ }
1664
1671
  videoEl.loadedmetadata = true;
1665
1672
 
1666
1673
  if (callback) callback(domElement.srcObject);
@@ -24,6 +24,10 @@ function pointer(p5, fn, lifecycles){
24
24
  signal: this._removeSignal
25
25
  });
26
26
  }
27
+
28
+ window.addEventListener('blur', () => {
29
+ this.mouseIsPressed = false;
30
+ }, { signal: this._removeSignal });
27
31
  };
28
32
 
29
33
  /**
@@ -1,4 +1,4 @@
1
- import { ae as THRESHOLD, af as POSTERIZE, ab as BLUR } from '../constants-BxjhKpTv.js';
1
+ import { ae as THRESHOLD, af as POSTERIZE, ab as BLUR } from '../constants-D3ryGa0m.js';
2
2
 
3
3
  const filterParamDefaults = {
4
4
  [BLUR]: 3,
@@ -1,7 +1,7 @@
1
1
  import { Shader } from '../webgl/p5.Shader.js';
2
- import { s as setWebGLUniformValue, e as setWebGLTextureParams, g as getWebGLUniformMetadata, h as getWebGLShaderAttributes, j as populateGLSLHooks, T as Texture } from '../rendering-C9g7uSQ5.js';
3
- import { I as Image } from '../p5.Renderer-BSGddFv7.js';
4
- import { C as CLAMP, aa as WEBGL2, p as CORNER, B as BLEND, ab as BLUR, ac as WEBGL } from '../constants-BxjhKpTv.js';
2
+ import { s as setWebGLUniformValue, e as setWebGLTextureParams, g as getWebGLUniformMetadata, h as getWebGLShaderAttributes, j as populateGLSLHooks, T as Texture } from '../rendering-4Z2qdE_W.js';
3
+ import { I as Image } from '../p5.Renderer-C0e0XesC.js';
4
+ import { C as CLAMP, aa as WEBGL2, p as CORNER, B as BLEND, ab as BLUR, ac as WEBGL } from '../constants-D3ryGa0m.js';
5
5
  import { filterParamDefaults } from './const.js';
6
6
  import { w as webgl2CompatibilityShader, f as filterBaseVert, a as filterBaseFrag, n as noiseGLSL } from '../noise3DGLSL-Bwrdi4gi.js';
7
7
  import { glslBackend } from '../webgl/strands_glslBackend.js';
@@ -47,7 +47,7 @@ import '../math/trigonometry.js';
47
47
  import '../strands/ir_types.js';
48
48
  import '../strands/ir_dag.js';
49
49
  import '../strands/strands_FES.js';
50
- import '../ir_builders-w12-GSxu.js';
50
+ import '../ir_builders-DMfaOLIL.js';
51
51
  import '../strands/ir_cfg.js';
52
52
  import '../strands/strands_builtins.js';
53
53
 
@@ -1,13 +1,13 @@
1
1
  import 'omggif';
2
2
  import '../dom/p5.Element.js';
3
- export { i as default } from '../rendering-C9g7uSQ5.js';
3
+ export { i as default } from '../rendering-4Z2qdE_W.js';
4
4
  import '../dom/p5.File.js';
5
5
  import '../io/p5.XML.js';
6
6
  import '../creating_reading-C7hu6sg1.js';
7
7
  import 'colorjs.io/fn';
8
8
  import '../color/color_spaces/hsb.js';
9
- import '../constants-BxjhKpTv.js';
10
- import '../p5.Renderer-BSGddFv7.js';
9
+ import '../constants-D3ryGa0m.js';
10
+ import '../p5.Renderer-C0e0XesC.js';
11
11
  import './filters.js';
12
12
  import '../math/p5.Vector.js';
13
13
  import '../shape/custom_shapes.js';
@@ -1,8 +1,8 @@
1
- import { i as image$1, b as loadingDisplaying, t as texture } from '../rendering-C9g7uSQ5.js';
2
- import { i as image$2 } from '../p5.Renderer-BSGddFv7.js';
1
+ import { i as image$1, b as loadingDisplaying, t as texture } from '../rendering-4Z2qdE_W.js';
2
+ import { i as image$2 } from '../p5.Renderer-C0e0XesC.js';
3
3
  import pixels from './pixels.js';
4
4
  import shader from '../webgl/p5.Shader.js';
5
- import '../constants-BxjhKpTv.js';
5
+ import '../constants-D3ryGa0m.js';
6
6
  import '../creating_reading-C7hu6sg1.js';
7
7
  import 'colorjs.io/fn';
8
8
  import '../color/color_spaces/hsb.js';
@@ -1,6 +1,6 @@
1
1
  import '../core/helpers.js';
2
- import '../constants-BxjhKpTv.js';
3
- export { b as default } from '../rendering-C9g7uSQ5.js';
2
+ import '../constants-D3ryGa0m.js';
3
+ export { b as default } from '../rendering-4Z2qdE_W.js';
4
4
  import 'omggif';
5
5
  import 'gifenc';
6
6
  import '../creating_reading-C7hu6sg1.js';
@@ -9,7 +9,7 @@ import '../color/color_spaces/hsb.js';
9
9
  import '../dom/p5.Element.js';
10
10
  import '../dom/p5.File.js';
11
11
  import '../io/p5.XML.js';
12
- import '../p5.Renderer-BSGddFv7.js';
12
+ import '../p5.Renderer-C0e0XesC.js';
13
13
  import './filters.js';
14
14
  import '../math/p5.Vector.js';
15
15
  import '../shape/custom_shapes.js';
@@ -1,10 +1,10 @@
1
1
  import './filters.js';
2
- export { I as Image, i as default } from '../p5.Renderer-BSGddFv7.js';
2
+ export { I as Image, i as default } from '../p5.Renderer-C0e0XesC.js';
3
3
  import '../io/utilities.js';
4
4
  import '../creating_reading-C7hu6sg1.js';
5
5
  import 'colorjs.io/fn';
6
6
  import '../color/color_spaces/hsb.js';
7
- import '../constants-BxjhKpTv.js';
7
+ import '../constants-D3ryGa0m.js';
8
8
  import '../math/p5.Vector.js';
9
9
  import '../shape/custom_shapes.js';
10
10
  import '../core/States.js';
package/dist/io/files.js CHANGED
@@ -1,11 +1,11 @@
1
- import '../p5.Renderer-BSGddFv7.js';
2
- export { d as default, a as request } from '../rendering-C9g7uSQ5.js';
1
+ import '../p5.Renderer-C0e0XesC.js';
2
+ export { d as default, a as request } from '../rendering-4Z2qdE_W.js';
3
3
  import './csv.js';
4
4
  import './utilities.js';
5
5
  import '../creating_reading-C7hu6sg1.js';
6
6
  import 'colorjs.io/fn';
7
7
  import '../color/color_spaces/hsb.js';
8
- import '../constants-BxjhKpTv.js';
8
+ import '../constants-D3ryGa0m.js';
9
9
  import '../image/filters.js';
10
10
  import '../math/p5.Vector.js';
11
11
  import '../shape/custom_shapes.js';
package/dist/io/index.js CHANGED
@@ -1,14 +1,14 @@
1
- import { d as files } from '../rendering-C9g7uSQ5.js';
1
+ import { d as files } from '../rendering-4Z2qdE_W.js';
2
2
  import table from './p5.Table.js';
3
3
  import tableRow from './p5.TableRow.js';
4
4
  import xml from './p5.XML.js';
5
- import '../constants-BxjhKpTv.js';
5
+ import '../constants-D3ryGa0m.js';
6
6
  import '../creating_reading-C7hu6sg1.js';
7
7
  import 'colorjs.io/fn';
8
8
  import '../color/color_spaces/hsb.js';
9
9
  import '../dom/p5.Element.js';
10
10
  import '../dom/p5.File.js';
11
- import '../p5.Renderer-BSGddFv7.js';
11
+ import '../p5.Renderer-C0e0XesC.js';
12
12
  import '../image/filters.js';
13
13
  import '../math/p5.Vector.js';
14
14
  import '../shape/custom_shapes.js';
@@ -1,7 +1,7 @@
1
- import { getNodeDataFromID, createNodeData, getOrCreateNode, extractNodeTypeInfo } from './strands/ir_dag.js';
1
+ import { getNodeDataFromID, createNodeData, getOrCreateNode, extractNodeTypeInfo, propagateTypeToAssignOnUse } from './strands/ir_dag.js';
2
2
  import { recordInBasicBlock } from './strands/ir_cfg.js';
3
3
  import { userError, internalError } from './strands/strands_FES.js';
4
- import { BaseType, NodeType, OpCode, typeEquals, BasePriority, DataType, OpCodeToSymbol } from './strands/ir_types.js';
4
+ import { BaseType, NodeType, OpCode, typeEquals, BasePriority, DataType, OpCodeToSymbol, booleanOpCode } from './strands/ir_types.js';
5
5
  import { strandsBuiltinFunctions } from './strands/strands_builtins.js';
6
6
 
7
7
  class StrandsNode {
@@ -222,12 +222,22 @@ function unaryOpNode(strandsContext, nodeOrValue, opCode) {
222
222
  node = createStrandsNode(id, dimension, strandsContext);
223
223
  }
224
224
  dependsOn = [node.id];
225
+
226
+ const typeInfo = {
227
+ baseType: dag.baseTypes[node.id],
228
+ dimension: node.dimension
229
+ };
230
+ if (booleanOpCode[opCode]) {
231
+ typeInfo.baseType = BaseType.BOOL;
232
+ typeInfo.dimension = 1;
233
+ }
234
+
225
235
  const nodeData = createNodeData({
226
236
  nodeType: NodeType.OPERATION,
227
237
  opCode,
228
238
  dependsOn,
229
- baseType: dag.baseTypes[node.id],
230
- dimension: node.dimension
239
+ baseType: typeInfo.baseType,
240
+ dimension: typeInfo.dimension
231
241
  });
232
242
  const id = getOrCreateNode(dag, nodeData);
233
243
  recordInBasicBlock(cfg, cfg.currentBlock, id);
@@ -248,8 +258,17 @@ function binaryOpNode(strandsContext, leftStrandsNode, rightArg, opCode) {
248
258
  let finalRightNodeID = rightStrandsNode.id;
249
259
 
250
260
  // Check if we have to cast either node
251
- const leftType = extractNodeTypeInfo(dag, leftStrandsNode.id);
252
- const rightType = extractNodeTypeInfo(dag, rightStrandsNode.id);
261
+ let leftType = extractNodeTypeInfo(dag, leftStrandsNode.id);
262
+ let rightType = extractNodeTypeInfo(dag, rightStrandsNode.id);
263
+
264
+ // Update ASSIGN_ON_USE nodes to match the type of the other operand
265
+ if (leftType.baseType === BaseType.ASSIGN_ON_USE && rightType.baseType !== BaseType.ASSIGN_ON_USE) {
266
+ propagateTypeToAssignOnUse(dag, leftStrandsNode.id, rightType.baseType, rightType.dimension);
267
+ leftType = extractNodeTypeInfo(dag, leftStrandsNode.id);
268
+ } else if (rightType.baseType === BaseType.ASSIGN_ON_USE && leftType.baseType !== BaseType.ASSIGN_ON_USE) {
269
+ propagateTypeToAssignOnUse(dag, rightStrandsNode.id, leftType.baseType, leftType.dimension);
270
+ rightType = extractNodeTypeInfo(dag, rightStrandsNode.id);
271
+ }
253
272
  const cast = { node: null, toType: leftType };
254
273
  const bothDeferred = leftType.baseType === rightType.baseType && leftType.baseType === BaseType.DEFER;
255
274
  if (bothDeferred) {
@@ -309,6 +328,11 @@ function binaryOpNode(strandsContext, leftStrandsNode, rightArg, opCode) {
309
328
  }
310
329
  }
311
330
 
331
+ if (booleanOpCode[opCode]) {
332
+ cast.toType.baseType = BaseType.BOOL;
333
+ cast.toType.dimension = 1;
334
+ }
335
+
312
336
  const nodeData = createNodeData({
313
337
  nodeType: NodeType.OPERATION,
314
338
  opCode,
@@ -396,6 +420,17 @@ function mapPrimitiveDepsToIDs(strandsContext, typeInfo, dependsOn) {
396
420
  calculatedDimensions += dimension;
397
421
  continue;
398
422
  }
423
+ else if (typeof dep === 'boolean') {
424
+ // Handle boolean literals - convert to bool type
425
+ const { id, dimension } = scalarLiteralNode(strandsContext, { dimension: 1, baseType: BaseType.BOOL }, dep);
426
+ mappedDependencies.push(id);
427
+ calculatedDimensions += dimension;
428
+ // Update baseType to BOOL if it was inferred
429
+ if (baseType !== BaseType.BOOL) {
430
+ baseType = BaseType.BOOL;
431
+ }
432
+ continue;
433
+ }
399
434
  else {
400
435
  userError('type error', `You've tried to construct a scalar or vector type with a non-numeric value: ${dep}`);
401
436
  }
@@ -446,7 +481,12 @@ function primitiveConstructorNode(strandsContext, typeInfo, dependsOn) {
446
481
  const { mappedDependencies, inferredTypeInfo } = mapPrimitiveDepsToIDs(strandsContext, typeInfo, dependsOn);
447
482
 
448
483
  const finalType = {
449
- baseType: typeInfo.baseType,
484
+ // We might have inferred a non numeric type. Currently this is
485
+ // just used for booleans. Maybe this needs to be something more robust
486
+ // if we ever want to support inference of e.g. int vectors?
487
+ baseType: inferredTypeInfo.baseType === BaseType.BOOL
488
+ ? BaseType.BOOL
489
+ : typeInfo.baseType,
450
490
  dimension: inferredTypeInfo.dimension
451
491
  };
452
492
 
@@ -754,4 +794,4 @@ function swizzleTrap(id, dimension, strandsContext, onRebind) {
754
794
  return trap;
755
795
  }
756
796
 
757
- export { StrandsNode as S, structInstanceNode as a, structConstructorNode as b, createStrandsNode as c, binaryOpNode as d, scalarLiteralNode as e, functionCallNode as f, constructTypeFromIDs as g, castToFloat as h, swizzleNode as i, swizzleTrap as j, memberAccessNode as m, primitiveConstructorNode as p, statementNode as s, unaryOpNode as u, variableNode as v };
797
+ export { StrandsNode as S, structInstanceNode as a, binaryOpNode as b, createStrandsNode as c, structConstructorNode as d, scalarLiteralNode as e, functionCallNode as f, constructTypeFromIDs as g, castToFloat as h, swizzleNode as i, swizzleTrap as j, memberAccessNode as m, primitiveConstructorNode as p, statementNode as s, unaryOpNode as u, variableNode as v };