p5 2.2.2 → 2.2.3-rc.1

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 (98) 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-BUwWryrh.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-Cd6rU9Vm.js} +48 -14
  40. package/dist/{main-DDs4QOnh.js → main-DFpoFdvM.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-D-EuAodU.js} +9 -2
  48. package/dist/{rendering-C9g7uSQ5.js → rendering-DE9-Hl7Y.js} +103 -78
  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 +24 -35
  57. package/dist/strands/strands_api.js +86 -41
  58. package/dist/strands/strands_codegen.js +0 -12
  59. package/dist/strands/strands_conditionals.js +1 -1
  60. package/dist/strands/strands_for.js +1 -1
  61. package/dist/strands/strands_node.js +1 -1
  62. package/dist/strands/strands_phi_utils.js +27 -9
  63. package/dist/strands/strands_transpiler.js +1237 -831
  64. package/dist/type/index.js +2 -2
  65. package/dist/type/p5.Font.js +7 -5
  66. package/dist/type/textCore.js +2 -2
  67. package/dist/webgl/3d_primitives.js +3 -3
  68. package/dist/webgl/GeometryBuilder.js +1 -1
  69. package/dist/webgl/ShapeBuilder.js +1 -1
  70. package/dist/webgl/enums.js +1 -1
  71. package/dist/webgl/index.js +4 -4
  72. package/dist/webgl/interaction.js +1 -1
  73. package/dist/webgl/light.js +3 -3
  74. package/dist/webgl/loading.js +41 -35
  75. package/dist/webgl/material.js +3 -3
  76. package/dist/webgl/p5.Camera.js +3 -3
  77. package/dist/webgl/p5.Framebuffer.js +3 -3
  78. package/dist/webgl/p5.Geometry.js +1 -1
  79. package/dist/webgl/p5.Quat.js +1 -1
  80. package/dist/webgl/p5.RendererGL.js +4 -4
  81. package/dist/webgl/p5.Shader.js +14 -6
  82. package/dist/webgl/p5.Texture.js +3 -3
  83. package/dist/webgl/strands_glslBackend.js +1 -1
  84. package/dist/webgl/text.js +3 -3
  85. package/dist/webgl/utils.js +3 -3
  86. package/dist/webgpu/index.js +2 -2
  87. package/dist/webgpu/p5.RendererWebGPU.js +2 -2
  88. package/dist/webgpu/strands_wgslBackend.js +13 -4
  89. package/lib/p5.esm.js +3670 -2951
  90. package/lib/p5.esm.min.js +1 -1
  91. package/lib/p5.js +3670 -2951
  92. package/lib/p5.min.js +1 -1
  93. package/lib/p5.webgpu.esm.js +43 -21
  94. package/lib/p5.webgpu.js +43 -21
  95. package/lib/p5.webgpu.min.js +1 -1
  96. package/package.json +1 -1
  97. package/types/global.d.ts +1283 -1301
  98. package/types/p5.d.ts +655 -657
@@ -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-BUwWryrh.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-BUwWryrh.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-DFpoFdvM.js';
2
2
  import { initialize } from './internationalization.js';
3
- import '../constants-BxjhKpTv.js';
3
+ import '../constants-BUwWryrh.js';
4
4
  import './transform.js';
5
5
  import './structure.js';
6
6
  import './environment.js';
7
- import '../rendering-C9g7uSQ5.js';
7
+ import '../rendering-DE9-Hl7Y.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-D-EuAodU.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-Cd6rU9Vm.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-BUwWryrh.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-DFpoFdvM.js';
2
+ import '../constants-BUwWryrh.js';
3
3
  import './transform.js';
4
4
  import './structure.js';
5
5
  import './environment.js';
6
- import '../rendering-C9g7uSQ5.js';
6
+ import '../rendering-DE9-Hl7Y.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-D-EuAodU.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-Cd6rU9Vm.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-BUwWryrh.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-DE9-Hl7Y.js';
6
+ import '../p5.Renderer-D-EuAodU.js';
7
+ export { p as default } from '../main-DFpoFdvM.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-Cd6rU9Vm.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-BUwWryrh.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-DE9-Hl7Y.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-D-EuAodU.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-BUwWryrh.js';
3
+ export { R as Renderer, r as default } from '../p5.Renderer-D-EuAodU.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-BUwWryrh.js';
2
+ export { R as Renderer2D, r as default } from '../main-DFpoFdvM.js';
3
+ import '../p5.Renderer-D-EuAodU.js';
4
+ import '../rendering-DE9-Hl7Y.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-Cd6rU9Vm.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-BUwWryrh.js';
2
+ export { R as Renderer3D, r as default } from '../rendering-DE9-Hl7Y.js';
3
+ import '../p5.Renderer-D-EuAodU.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-BUwWryrh.js';
2
+ export { k as default, x as renderers } from '../rendering-DE9-Hl7Y.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-D-EuAodU.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-BUwWryrh.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-BUwWryrh.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-BUwWryrh.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-BUwWryrh.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-BUwWryrh.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-DE9-Hl7Y.js';
3
+ import { I as Image } from '../p5.Renderer-D-EuAodU.js';
4
+ import { C as CLAMP, aa as WEBGL2, p as CORNER, B as BLEND, ab as BLUR, ac as WEBGL } from '../constants-BUwWryrh.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-Cd6rU9Vm.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-DE9-Hl7Y.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-BUwWryrh.js';
10
+ import '../p5.Renderer-D-EuAodU.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-DE9-Hl7Y.js';
2
+ import { i as image$2 } from '../p5.Renderer-D-EuAodU.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-BUwWryrh.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-BUwWryrh.js';
3
+ export { b as default } from '../rendering-DE9-Hl7Y.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-D-EuAodU.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-D-EuAodU.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-BUwWryrh.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-D-EuAodU.js';
2
+ export { d as default, a as request } from '../rendering-DE9-Hl7Y.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-BUwWryrh.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-DE9-Hl7Y.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-BUwWryrh.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-D-EuAodU.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 {
@@ -71,9 +71,6 @@ class StrandsNode {
71
71
  const assignmentID = getOrCreateNode(dag, assignmentNode);
72
72
  recordInBasicBlock(cfg, cfg.currentBlock, assignmentID);
73
73
 
74
- // Track for global assignments processing
75
- this.strandsContext.globalAssignments.push(assignmentID);
76
-
77
74
  // Simply update this node to be a variable node with the identifier
78
75
  // This ensures it always generates the variable name in expressions
79
76
  const variableNodeData = createNodeData({
@@ -137,9 +134,6 @@ class StrandsNode {
137
134
  const assignmentID = getOrCreateNode(dag, assignmentNode);
138
135
  recordInBasicBlock(cfg, cfg.currentBlock, assignmentID);
139
136
 
140
- // Track for global assignments processing in the current hook context
141
- this.strandsContext.globalAssignments.push(assignmentID);
142
-
143
137
  // Simply update this node to be a variable node with the identifier
144
138
  // This ensures it always generates the variable name in expressions
145
139
  const variableNodeData = createNodeData({
@@ -222,12 +216,22 @@ function unaryOpNode(strandsContext, nodeOrValue, opCode) {
222
216
  node = createStrandsNode(id, dimension, strandsContext);
223
217
  }
224
218
  dependsOn = [node.id];
219
+
220
+ const typeInfo = {
221
+ baseType: dag.baseTypes[node.id],
222
+ dimension: node.dimension
223
+ };
224
+ if (booleanOpCode[opCode]) {
225
+ typeInfo.baseType = BaseType.BOOL;
226
+ typeInfo.dimension = 1;
227
+ }
228
+
225
229
  const nodeData = createNodeData({
226
230
  nodeType: NodeType.OPERATION,
227
231
  opCode,
228
232
  dependsOn,
229
- baseType: dag.baseTypes[node.id],
230
- dimension: node.dimension
233
+ baseType: typeInfo.baseType,
234
+ dimension: typeInfo.dimension
231
235
  });
232
236
  const id = getOrCreateNode(dag, nodeData);
233
237
  recordInBasicBlock(cfg, cfg.currentBlock, id);
@@ -248,8 +252,17 @@ function binaryOpNode(strandsContext, leftStrandsNode, rightArg, opCode) {
248
252
  let finalRightNodeID = rightStrandsNode.id;
249
253
 
250
254
  // Check if we have to cast either node
251
- const leftType = extractNodeTypeInfo(dag, leftStrandsNode.id);
252
- const rightType = extractNodeTypeInfo(dag, rightStrandsNode.id);
255
+ let leftType = extractNodeTypeInfo(dag, leftStrandsNode.id);
256
+ let rightType = extractNodeTypeInfo(dag, rightStrandsNode.id);
257
+
258
+ // Update ASSIGN_ON_USE nodes to match the type of the other operand
259
+ if (leftType.baseType === BaseType.ASSIGN_ON_USE && rightType.baseType !== BaseType.ASSIGN_ON_USE) {
260
+ propagateTypeToAssignOnUse(dag, leftStrandsNode.id, rightType.baseType, rightType.dimension);
261
+ leftType = extractNodeTypeInfo(dag, leftStrandsNode.id);
262
+ } else if (rightType.baseType === BaseType.ASSIGN_ON_USE && leftType.baseType !== BaseType.ASSIGN_ON_USE) {
263
+ propagateTypeToAssignOnUse(dag, rightStrandsNode.id, leftType.baseType, leftType.dimension);
264
+ rightType = extractNodeTypeInfo(dag, rightStrandsNode.id);
265
+ }
253
266
  const cast = { node: null, toType: leftType };
254
267
  const bothDeferred = leftType.baseType === rightType.baseType && leftType.baseType === BaseType.DEFER;
255
268
  if (bothDeferred) {
@@ -309,6 +322,11 @@ function binaryOpNode(strandsContext, leftStrandsNode, rightArg, opCode) {
309
322
  }
310
323
  }
311
324
 
325
+ if (booleanOpCode[opCode]) {
326
+ cast.toType.baseType = BaseType.BOOL;
327
+ cast.toType.dimension = 1;
328
+ }
329
+
312
330
  const nodeData = createNodeData({
313
331
  nodeType: NodeType.OPERATION,
314
332
  opCode,
@@ -396,6 +414,17 @@ function mapPrimitiveDepsToIDs(strandsContext, typeInfo, dependsOn) {
396
414
  calculatedDimensions += dimension;
397
415
  continue;
398
416
  }
417
+ else if (typeof dep === 'boolean') {
418
+ // Handle boolean literals - convert to bool type
419
+ const { id, dimension } = scalarLiteralNode(strandsContext, { dimension: 1, baseType: BaseType.BOOL }, dep);
420
+ mappedDependencies.push(id);
421
+ calculatedDimensions += dimension;
422
+ // Update baseType to BOOL if it was inferred
423
+ if (baseType !== BaseType.BOOL) {
424
+ baseType = BaseType.BOOL;
425
+ }
426
+ continue;
427
+ }
399
428
  else {
400
429
  userError('type error', `You've tried to construct a scalar or vector type with a non-numeric value: ${dep}`);
401
430
  }
@@ -446,7 +475,12 @@ function primitiveConstructorNode(strandsContext, typeInfo, dependsOn) {
446
475
  const { mappedDependencies, inferredTypeInfo } = mapPrimitiveDepsToIDs(strandsContext, typeInfo, dependsOn);
447
476
 
448
477
  const finalType = {
449
- baseType: typeInfo.baseType,
478
+ // We might have inferred a non numeric type. Currently this is
479
+ // just used for booleans. Maybe this needs to be something more robust
480
+ // if we ever want to support inference of e.g. int vectors?
481
+ baseType: inferredTypeInfo.baseType === BaseType.BOOL
482
+ ? BaseType.BOOL
483
+ : typeInfo.baseType,
450
484
  dimension: inferredTypeInfo.dimension
451
485
  };
452
486
 
@@ -754,4 +788,4 @@ function swizzleTrap(id, dimension, strandsContext, onRebind) {
754
788
  return trap;
755
789
  }
756
790
 
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 };
791
+ 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 };