p5 2.0.0 → 2.0.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 (188) hide show
  1. package/{src → dist}/accessibility/color_namer.js +48 -3
  2. package/{src → dist}/accessibility/describe.js +2 -2
  3. package/{src → dist}/accessibility/gridOutput.js +2 -2
  4. package/dist/accessibility/index.js +60 -0
  5. package/{src → dist}/accessibility/outputs.js +2 -2
  6. package/{src → dist}/accessibility/textOutput.js +2 -2
  7. package/dist/app.js +120 -0
  8. package/{src → dist}/color/color_conversion.js +48 -10
  9. package/{src → dist}/color/color_spaces/hsb.js +3 -1
  10. package/dist/color/creating_reading.js +3 -0
  11. package/dist/color/index.js +13 -0
  12. package/dist/color/p5.Color.culori.js +1 -0
  13. package/dist/color/p5.Color.js +3 -0
  14. package/{src → dist}/color/setting.js +9 -6
  15. package/{src/core/constants.js → dist/constants-C-g_eAdC.js} +266 -130
  16. package/{src → dist}/core/States.js +3 -1
  17. package/dist/core/constants.js +1 -0
  18. package/{src → dist}/core/environment.js +7 -6
  19. package/{src → dist}/core/friendly_errors/browser_errors.js +1 -1
  20. package/{src → dist}/core/friendly_errors/fes_core.js +14 -44
  21. package/{src → dist}/core/friendly_errors/file_errors.js +6 -3
  22. package/dist/core/friendly_errors/index.js +23 -0
  23. package/dist/core/friendly_errors/param_validator.js +5455 -0
  24. package/{src → dist}/core/friendly_errors/sketch_reader.js +50 -4
  25. package/{src → dist}/core/friendly_errors/sketch_verifier.js +6 -6
  26. package/{src → dist}/core/friendly_errors/stacktrace.js +3 -5
  27. package/{src → dist}/core/friendly_errors/validate_params.js +50 -41
  28. package/{src → dist}/core/helpers.js +9 -6
  29. package/dist/core/init.js +105 -0
  30. package/dist/core/internationalization.js +302 -0
  31. package/dist/core/legacy.js +73 -0
  32. package/dist/core/main.js +44 -0
  33. package/dist/core/noop.js +3 -0
  34. package/dist/core/p5.Graphics.js +40 -0
  35. package/dist/core/p5.Renderer.js +11 -0
  36. package/dist/core/p5.Renderer2D.js +44 -0
  37. package/dist/core/reference.js +1 -0
  38. package/dist/core/rendering.js +40 -0
  39. package/{src → dist}/core/structure.js +3 -3
  40. package/{src → dist}/core/transform.js +2 -2
  41. package/{src/color/creating_reading.js → dist/creating_reading-D4AAKRbx.js} +841 -13
  42. package/{src → dist}/data/index.js +3 -1
  43. package/{src → dist}/data/local_storage.js +2 -8
  44. package/{src → dist}/dom/dom.js +11 -5
  45. package/dist/dom/index.js +18 -0
  46. package/{src → dist}/dom/p5.Element.js +14 -12
  47. package/{src → dist}/dom/p5.File.js +4 -4
  48. package/{src → dist}/dom/p5.MediaElement.js +10 -4
  49. package/{src → dist}/events/acceleration.js +2 -2
  50. package/{src → dist}/events/index.js +3 -1
  51. package/{src → dist}/events/keyboard.js +14 -11
  52. package/{src → dist}/events/pointer.js +16 -17
  53. package/dist/image/const.js +9 -0
  54. package/{src → dist}/image/filterRenderer2D.js +57 -37
  55. package/{src → dist}/image/filters.js +1 -3
  56. package/dist/image/image.js +40 -0
  57. package/dist/image/index.js +51 -0
  58. package/dist/image/loading_displaying.js +40 -0
  59. package/dist/image/p5.Image.js +11 -0
  60. package/{src → dist}/image/pixels.js +4 -3
  61. package/{src → dist}/io/csv.js +72 -70
  62. package/dist/io/files.js +40 -0
  63. package/dist/io/index.js +51 -0
  64. package/{src → dist}/io/p5.Table.js +6 -6
  65. package/{src → dist}/io/p5.TableRow.js +3 -4
  66. package/{src → dist}/io/p5.XML.js +2 -5
  67. package/{src → dist}/io/utilities.js +1 -1
  68. package/{src/core/p5.Renderer2D.js → dist/main-s72KWcUy.js} +735 -57
  69. package/{src → dist}/math/Matrices/Matrix.js +10 -8
  70. package/{src → dist}/math/Matrices/MatrixInterface.js +5 -3
  71. package/{src → dist}/math/Matrices/MatrixNumjs.js +12 -26
  72. package/{src → dist}/math/calculation.js +2 -2
  73. package/{src → dist}/math/index.js +6 -3
  74. package/{src → dist}/math/math.js +2 -2
  75. package/{src → dist}/math/noise.js +2 -2
  76. package/{src → dist}/math/p5.Matrix.js +7 -4
  77. package/{src → dist}/math/p5.Vector.js +6 -6
  78. package/{src → dist}/math/random.js +2 -2
  79. package/{src → dist}/math/trigonometry.js +16 -15
  80. package/{src/image/p5.Image.js → dist/p5.Renderer-CwAYZOC2.js} +390 -19
  81. package/dist/rendering--aAe5aq3.js +24925 -0
  82. package/{src → dist}/shape/2d_primitives.js +18 -17
  83. package/{src → dist}/shape/attributes.js +18 -17
  84. package/{src → dist}/shape/curves.js +2 -2
  85. package/{src → dist}/shape/custom_shapes.js +44 -64
  86. package/{src → dist}/shape/index.js +10 -2
  87. package/{src → dist}/shape/vertex.js +2 -3
  88. package/dist/type/index.js +25 -0
  89. package/{src → dist}/type/lib/Typr.js +76 -94
  90. package/{src → dist}/type/p5.Font.js +37 -61
  91. package/{src → dist}/type/textCore.js +34 -57
  92. package/{src → dist}/type/unicodeRanges.js +3 -1
  93. package/{src → dist}/utilities/conversion.js +2 -2
  94. package/{src → dist}/utilities/index.js +3 -1
  95. package/{src → dist}/utilities/time_date.js +6 -7
  96. package/{src → dist}/utilities/utility_functions.js +2 -2
  97. package/dist/webgl/3d_primitives.js +40 -0
  98. package/{src → dist}/webgl/GeometryBufferCache.js +3 -1
  99. package/{src → dist}/webgl/GeometryBuilder.js +12 -8
  100. package/{src → dist}/webgl/ShaderGenerator.js +79 -82
  101. package/{src → dist}/webgl/ShapeBuilder.js +26 -23
  102. package/dist/webgl/index.js +76 -0
  103. package/{src → dist}/webgl/interaction.js +7 -6
  104. package/dist/webgl/light.js +40 -0
  105. package/{src → dist}/webgl/loading.js +45 -12
  106. package/dist/webgl/material.js +40 -0
  107. package/dist/webgl/p5.Camera.js +40 -0
  108. package/{src → dist}/webgl/p5.DataArray.js +3 -5
  109. package/dist/webgl/p5.Framebuffer.js +40 -0
  110. package/{src → dist}/webgl/p5.Geometry.js +12 -15
  111. package/{src → dist}/webgl/p5.Quat.js +5 -4
  112. package/{src → dist}/webgl/p5.RenderBuffer.js +2 -3
  113. package/dist/webgl/p5.RendererGL.js +40 -0
  114. package/dist/webgl/p5.Shader.js +40 -0
  115. package/dist/webgl/p5.Texture.js +40 -0
  116. package/{src → dist}/webgl/text.js +51 -9
  117. package/lib/p5.esm.js +102 -48
  118. package/lib/p5.js +102 -48
  119. package/lib/p5.min.js +1 -1
  120. package/package.json +17 -16
  121. package/translations/dev.js +6 -6
  122. package/translations/index.js +1 -1
  123. package/src/README.md +0 -27
  124. package/src/accessibility/index.js +0 -13
  125. package/src/app.js +0 -61
  126. package/src/color/index.js +0 -9
  127. package/src/color/p5.Color.culori.js +0 -66
  128. package/src/color/p5.Color.js +0 -851
  129. package/src/core/README.md +0 -91
  130. package/src/core/friendly_errors/index.js +0 -13
  131. package/src/core/friendly_errors/param_validator.js +0 -561
  132. package/src/core/init.js +0 -58
  133. package/src/core/internationalization.js +0 -195
  134. package/src/core/legacy.js +0 -29
  135. package/src/core/main.js +0 -689
  136. package/src/core/noop.js +0 -1
  137. package/src/core/p5.Graphics.js +0 -696
  138. package/src/core/p5.Renderer.js +0 -408
  139. package/src/core/reference.js +0 -2060
  140. package/src/core/rendering.js +0 -697
  141. package/src/dom/index.js +0 -11
  142. package/src/image/const.js +0 -6
  143. package/src/image/image.js +0 -731
  144. package/src/image/index.js +0 -15
  145. package/src/image/loading_displaying.js +0 -1431
  146. package/src/io/files.js +0 -2210
  147. package/src/io/index.js +0 -11
  148. package/src/math/README.md +0 -40
  149. package/src/type/index.js +0 -9
  150. package/src/webgl/3d_primitives.js +0 -2741
  151. package/src/webgl/index.js +0 -37
  152. package/src/webgl/light.js +0 -1851
  153. package/src/webgl/material.js +0 -3854
  154. package/src/webgl/p5.Camera.js +0 -4010
  155. package/src/webgl/p5.Framebuffer.js +0 -1865
  156. package/src/webgl/p5.RendererGL.js +0 -2867
  157. package/src/webgl/p5.Shader.js +0 -1505
  158. package/src/webgl/p5.Texture.js +0 -541
  159. package/src/webgl/shaders/basic.frag +0 -6
  160. package/src/webgl/shaders/filters/base.frag +0 -22
  161. package/src/webgl/shaders/filters/base.vert +0 -19
  162. package/src/webgl/shaders/filters/blur.frag +0 -60
  163. package/src/webgl/shaders/filters/default.vert +0 -18
  164. package/src/webgl/shaders/filters/dilate.frag +0 -39
  165. package/src/webgl/shaders/filters/erode.frag +0 -39
  166. package/src/webgl/shaders/filters/gray.frag +0 -16
  167. package/src/webgl/shaders/filters/invert.frag +0 -15
  168. package/src/webgl/shaders/filters/opaque.frag +0 -12
  169. package/src/webgl/shaders/filters/posterize.frag +0 -29
  170. package/src/webgl/shaders/filters/threshold.frag +0 -23
  171. package/src/webgl/shaders/font.frag +0 -216
  172. package/src/webgl/shaders/font.vert +0 -44
  173. package/src/webgl/shaders/imageLight.vert +0 -33
  174. package/src/webgl/shaders/imageLightDiffused.frag +0 -82
  175. package/src/webgl/shaders/imageLightSpecular.frag +0 -134
  176. package/src/webgl/shaders/light.vert +0 -37
  177. package/src/webgl/shaders/light_texture.frag +0 -26
  178. package/src/webgl/shaders/lighting.glsl +0 -227
  179. package/src/webgl/shaders/line.frag +0 -74
  180. package/src/webgl/shaders/line.vert +0 -294
  181. package/src/webgl/shaders/normal.frag +0 -6
  182. package/src/webgl/shaders/normal.vert +0 -72
  183. package/src/webgl/shaders/phong.frag +0 -84
  184. package/src/webgl/shaders/phong.vert +0 -87
  185. package/src/webgl/shaders/point.frag +0 -29
  186. package/src/webgl/shaders/point.vert +0 -19
  187. package/src/webgl/shaders/sphereMapping.frag +0 -26
  188. package/src/webgl/shaders/webgl2Compatibility.glsl +0 -34
@@ -1,11 +1,56 @@
1
+ import { p as p5 } from '../../main-s72KWcUy.js';
2
+ import { translator } from '../internationalization.js';
3
+ import { v as constants } from '../../constants-C-g_eAdC.js';
4
+ import '../transform.js';
5
+ import '../structure.js';
6
+ import '../environment.js';
7
+ import '../../math/p5.Vector.js';
8
+ import '../../rendering--aAe5aq3.js';
9
+ import '../../creating_reading-D4AAKRbx.js';
10
+ import 'colorjs.io/fn';
11
+ import '../../color/color_spaces/hsb.js';
12
+ import '../../dom/p5.Element.js';
13
+ import '../../dom/p5.File.js';
14
+ import '../../io/p5.XML.js';
15
+ import '../../p5.Renderer-CwAYZOC2.js';
16
+ import '../../image/filters.js';
17
+ import '../../shape/custom_shapes.js';
18
+ import '../States.js';
19
+ import '../../io/utilities.js';
20
+ import 'file-saver';
21
+ import '../../dom/p5.MediaElement.js';
22
+ import '../../shape/2d_primitives.js';
23
+ import '../helpers.js';
24
+ import '../../shape/attributes.js';
25
+ import '../../shape/curves.js';
26
+ import '../../shape/vertex.js';
27
+ import '../../color/setting.js';
28
+ import 'omggif';
29
+ import '../../io/csv.js';
30
+ import 'gifenc';
31
+ import '../../image/pixels.js';
32
+ import '../../webgl/GeometryBuilder.js';
33
+ import '../../math/p5.Matrix.js';
34
+ import '../../math/Matrices/Matrix.js';
35
+ import '../../math/Matrices/MatrixInterface.js';
36
+ import '../../webgl/p5.Geometry.js';
37
+ import '../../webgl/p5.DataArray.js';
38
+ import '../../webgl/p5.Quat.js';
39
+ import '../../webgl/p5.RenderBuffer.js';
40
+ import '../../webgl/ShapeBuilder.js';
41
+ import 'libtess';
42
+ import '../../webgl/GeometryBufferCache.js';
43
+ import '../../image/const.js';
44
+ import '../../math/trigonometry.js';
45
+ import '../../image/filterRenderer2D.js';
46
+ import 'i18next';
47
+ import 'i18next-browser-languagedetector';
48
+
1
49
  /**
2
50
  * @for p5
3
51
  * @requires core
4
52
  */
5
53
 
6
- import p5 from '../main';
7
- import { translator } from '../internationalization';
8
- import * as constants from '../constants';
9
54
 
10
55
  /**
11
56
  * Checks if any p5.js constant/function is declared outside of setup()
@@ -405,4 +450,5 @@ if (typeof IS_MINIFIED !== 'undefined') {
405
450
 
406
451
  window.addEventListener('p5Ready', p5._fesCodeReader);
407
452
  }
408
- export default p5;
453
+
454
+ export { p5 as default };
@@ -1,6 +1,6 @@
1
1
  import { parse } from 'acorn';
2
- import { simple as walk } from 'acorn-walk';
3
- import * as constants from '../constants';
2
+ import { simple } from 'acorn-walk';
3
+ import { v as constants } from '../../constants-C-g_eAdC.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.
@@ -33,7 +33,7 @@ const ignoreFunction = [
33
33
  // 'onended'
34
34
  ];
35
35
 
36
- export const verifierUtils = {
36
+ const verifierUtils = {
37
37
 
38
38
  /**
39
39
  * Fetches the contents of a script element in the user's sketch.
@@ -85,7 +85,7 @@ export const verifierUtils = {
85
85
  locations: true // This helps us get the line number.
86
86
  });
87
87
 
88
- walk(ast, {
88
+ simple(ast, {
89
89
  VariableDeclarator(node) {
90
90
  if (node.id.type === 'Identifier') {
91
91
  const category = node.init && ['ArrowFunctionExpression', 'FunctionExpression'].includes(node.init.type)
@@ -226,8 +226,8 @@ function sketchVerifier(p5, _fn, lifecycles) {
226
226
  };
227
227
  }
228
228
 
229
- export default sketchVerifier;
230
-
231
229
  if (typeof p5 !== 'undefined') {
232
230
  sketchVerifier(p5, p5.prototype);
233
231
  }
232
+
233
+ export { sketchVerifier as default, verifierUtils };
@@ -43,9 +43,7 @@ function ErrorStackParser() {
43
43
  return this.parseV8OrIE(error);
44
44
  } else if (error.stack) {
45
45
  return this.parseFFOrSafari(error);
46
- } else {
47
- // throw new Error('Cannot parse given Error object');
48
- }
46
+ } else ;
49
47
  },
50
48
 
51
49
  // Separate line and column numbers from a string of the form: (URI:Line:Column)
@@ -245,8 +243,8 @@ function stacktrace(p5, fn){
245
243
  };
246
244
  }
247
245
 
248
- export default stacktrace;
249
-
250
246
  if (typeof p5 !== 'undefined') {
251
247
  stacktrace(p5, p5.prototype);
252
248
  }
249
+
250
+ export { stacktrace as default };
@@ -1,51 +1,60 @@
1
+ import { p as p5 } from '../../main-s72KWcUy.js';
2
+ import { translator } from '../internationalization.js';
3
+ import '../../constants-C-g_eAdC.js';
4
+ import '../transform.js';
5
+ import '../structure.js';
6
+ import '../environment.js';
7
+ import '../../math/p5.Vector.js';
8
+ import '../../rendering--aAe5aq3.js';
9
+ import '../../creating_reading-D4AAKRbx.js';
10
+ import 'colorjs.io/fn';
11
+ import '../../color/color_spaces/hsb.js';
12
+ import '../../dom/p5.Element.js';
13
+ import '../../dom/p5.File.js';
14
+ import '../../io/p5.XML.js';
15
+ import '../../p5.Renderer-CwAYZOC2.js';
16
+ import '../../image/filters.js';
17
+ import '../../shape/custom_shapes.js';
18
+ import '../States.js';
19
+ import '../../io/utilities.js';
20
+ import 'file-saver';
21
+ import '../../dom/p5.MediaElement.js';
22
+ import '../../shape/2d_primitives.js';
23
+ import '../helpers.js';
24
+ import '../../shape/attributes.js';
25
+ import '../../shape/curves.js';
26
+ import '../../shape/vertex.js';
27
+ import '../../color/setting.js';
28
+ import 'omggif';
29
+ import '../../io/csv.js';
30
+ import 'gifenc';
31
+ import '../../image/pixels.js';
32
+ import '../../webgl/GeometryBuilder.js';
33
+ import '../../math/p5.Matrix.js';
34
+ import '../../math/Matrices/Matrix.js';
35
+ import '../../math/Matrices/MatrixInterface.js';
36
+ import '../../webgl/p5.Geometry.js';
37
+ import '../../webgl/p5.DataArray.js';
38
+ import '../../webgl/p5.Quat.js';
39
+ import '../../webgl/p5.RenderBuffer.js';
40
+ import '../../webgl/ShapeBuilder.js';
41
+ import 'libtess';
42
+ import '../../webgl/GeometryBufferCache.js';
43
+ import '../../image/const.js';
44
+ import '../../math/trigonometry.js';
45
+ import '../../image/filterRenderer2D.js';
46
+ import 'i18next';
47
+ import 'i18next-browser-languagedetector';
48
+
1
49
  /**
2
50
  * @for p5
3
51
  * @requires core
4
52
  */
5
- import p5 from '../main';
6
- import * as constants from '../constants';
7
- import { translator } from '../internationalization';
8
53
  // import dataDoc from '../../../docs/parameterData.json';
9
54
 
10
55
  if (typeof IS_MINIFIED !== 'undefined') {
11
56
  p5._validateParameters = p5._clearValidateParamsCache = () => {};
12
57
  } else {
13
- // for parameter validation
14
- // const arrDoc = JSON.parse(JSON.stringify(dataDoc));
15
-
16
- // const docCache = {};
17
- // const builtinTypes = new Set([
18
- // 'null',
19
- // 'number',
20
- // 'string',
21
- // 'boolean',
22
- // 'constant',
23
- // 'function',
24
- // 'any',
25
- // 'integer'
26
- // ]);
27
-
28
- // const basicTypes = {
29
- // number: true,
30
- // boolean: true,
31
- // string: true,
32
- // function: true,
33
- // undefined: true
34
- // };
35
-
36
- // reverse map of all constants
37
- const constantsReverseMap = {};
38
- for (let key in constants) {
39
- constantsReverseMap[constants[key]] = key;
40
- }
41
-
42
- // mapping names of p5 types to their constructor function
43
- // p5Constructors:
44
- // - Color: f()
45
- // - Graphics: f()
46
- // - Vector: f()
47
- // and so on
48
- const p5Constructors = {};
49
58
 
50
59
  // For speedup over many runs. funcSpecificConstructors[func] only has the
51
60
  // constructors for types which were seen earlier as args of "func"
@@ -58,7 +67,7 @@ if (typeof IS_MINIFIED !== 'undefined') {
58
67
  // Get a list of all constructors in p5. They are functions whose names
59
68
  // start with a capital letter
60
69
  if (typeof p5[key] === 'function' && key[0] !== key[0].toLowerCase()) {
61
- p5Constructors[key] = p5[key];
70
+ p5[key];
62
71
  }
63
72
  }
64
73
  });
@@ -774,4 +783,4 @@ if (typeof IS_MINIFIED !== 'undefined') {
774
783
  p5.prototype._validateParameters = p5.validateParameters;
775
784
  }
776
785
 
777
- export default p5;
786
+ export { p5 as default };
@@ -1,8 +1,9 @@
1
+ import { e as CORNER, i as CORNERS, a as RADIUS, C as CENTER } from '../constants-C-g_eAdC.js';
2
+
1
3
  /**
2
4
  * @requires constants
3
5
  */
4
6
 
5
- import * as constants from './constants';
6
7
 
7
8
  /*
8
9
  This function normalizes the first four arguments given to rect, ellipse and arc
@@ -13,7 +14,7 @@ import * as constants from './constants';
13
14
  function modeAdjust(a, b, c, d, mode) {
14
15
  let bbox;
15
16
 
16
- if (mode === constants.CORNER) {
17
+ if (mode === CORNER) {
17
18
 
18
19
  // CORNER mode already corresponds to a bounding box (top-left corner, width, height).
19
20
  // For negative widhts or heights, the absolute value is used.
@@ -24,7 +25,7 @@ function modeAdjust(a, b, c, d, mode) {
24
25
  h: Math.abs(d)
25
26
  };
26
27
 
27
- } else if (mode === constants.CORNERS) {
28
+ } else if (mode === CORNERS) {
28
29
 
29
30
  // CORNERS mode uses two opposite corners, in any configuration.
30
31
  // Make sure to get the top left corner by using the minimum of the x and y coordniates.
@@ -35,7 +36,7 @@ function modeAdjust(a, b, c, d, mode) {
35
36
  h: Math.abs(d - b)
36
37
  };
37
38
 
38
- } else if (mode === constants.RADIUS) {
39
+ } else if (mode === RADIUS) {
39
40
 
40
41
  // RADIUS mode uses the center point and half the width and height.
41
42
  // c (half width) and d (half height) could be negative, so use the absolute value
@@ -49,7 +50,7 @@ function modeAdjust(a, b, c, d, mode) {
49
50
  h: 2 * d
50
51
  };
51
52
 
52
- } else if (mode === constants.CENTER) {
53
+ } else if (mode === CENTER) {
53
54
 
54
55
  // CENTER mode uses the center point, width and height.
55
56
  // c (width) and d (height) could be negative, so use the absolute value
@@ -68,4 +69,6 @@ function modeAdjust(a, b, c, d, mode) {
68
69
  return bbox;
69
70
  }
70
71
 
71
- export default { modeAdjust };
72
+ var canvas = { modeAdjust };
73
+
74
+ export { canvas as default };
@@ -0,0 +1,105 @@
1
+ import { p as p5 } from '../main-s72KWcUy.js';
2
+ import { initialize } from './internationalization.js';
3
+ import '../constants-C-g_eAdC.js';
4
+ import './transform.js';
5
+ import './structure.js';
6
+ import './environment.js';
7
+ import '../math/p5.Vector.js';
8
+ import '../rendering--aAe5aq3.js';
9
+ import '../creating_reading-D4AAKRbx.js';
10
+ import 'colorjs.io/fn';
11
+ import '../color/color_spaces/hsb.js';
12
+ import '../dom/p5.Element.js';
13
+ import '../dom/p5.File.js';
14
+ import '../io/p5.XML.js';
15
+ import '../p5.Renderer-CwAYZOC2.js';
16
+ import '../image/filters.js';
17
+ import '../shape/custom_shapes.js';
18
+ import './States.js';
19
+ import '../io/utilities.js';
20
+ import 'file-saver';
21
+ import '../dom/p5.MediaElement.js';
22
+ import '../shape/2d_primitives.js';
23
+ import './helpers.js';
24
+ import '../shape/attributes.js';
25
+ import '../shape/curves.js';
26
+ import '../shape/vertex.js';
27
+ import '../color/setting.js';
28
+ import 'omggif';
29
+ import '../io/csv.js';
30
+ import 'gifenc';
31
+ import '../image/pixels.js';
32
+ import '../webgl/GeometryBuilder.js';
33
+ import '../math/p5.Matrix.js';
34
+ import '../math/Matrices/Matrix.js';
35
+ import '../math/Matrices/MatrixInterface.js';
36
+ import '../webgl/p5.Geometry.js';
37
+ import '../webgl/p5.DataArray.js';
38
+ import '../webgl/p5.Quat.js';
39
+ import '../webgl/p5.RenderBuffer.js';
40
+ import '../webgl/ShapeBuilder.js';
41
+ import 'libtess';
42
+ import '../webgl/GeometryBufferCache.js';
43
+ import '../image/const.js';
44
+ import '../math/trigonometry.js';
45
+ import '../image/filterRenderer2D.js';
46
+ import 'i18next';
47
+ import 'i18next-browser-languagedetector';
48
+
49
+ /**
50
+ * This file setup global mode automatic instantiation
51
+ *
52
+ * if sketch is on window
53
+ * assume "global" mode
54
+ * and instantiate p5 automatically
55
+ * otherwise do nothing
56
+ *
57
+ * @private
58
+ * @return {Undefined}
59
+ */
60
+ const _globalInit = () => {
61
+ // Could have been any property defined within the p5 constructor.
62
+ // If that property is already a part of the global object,
63
+ // this code has already run before, likely due to a duplicate import
64
+ if (typeof window._setupDone !== 'undefined') {
65
+ console.warn(
66
+ 'p5.js seems to have been imported multiple times. Please remove the duplicate import'
67
+ );
68
+ return;
69
+ }
70
+
71
+ if (!window.mocha) {
72
+ const p5ReadyEvent = new Event('p5Ready');
73
+ window.dispatchEvent(p5ReadyEvent);
74
+
75
+ // If there is a setup or draw function on the window
76
+ // then instantiate p5 in "global" mode
77
+ if (
78
+ ((window.setup && typeof window.setup === 'function') ||
79
+ (window.draw && typeof window.draw === 'function')) &&
80
+ !p5.instance
81
+ ) {
82
+ new p5();
83
+ }
84
+ }
85
+ };
86
+
87
+ // make a promise that resolves when the document is ready
88
+ const waitForDocumentReady = () =>
89
+ new Promise((resolve, reject) => {
90
+ // if the page is ready, initialize p5 immediately
91
+ if (document.readyState === 'complete') {
92
+ resolve();
93
+ // if the page is still loading, add an event listener
94
+ // and initialize p5 as soon as it finishes loading
95
+ } else {
96
+ window.addEventListener('load', resolve, false);
97
+ }
98
+ });
99
+
100
+ // only load translations if we're using the full, un-minified library
101
+ const waitingForTranslator =
102
+ typeof IS_MINIFIED === 'undefined' ? initialize() :
103
+ Promise.resolve();
104
+
105
+ export { _globalInit, waitForDocumentReady, waitingForTranslator };