p5 2.0.0 → 2.0.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 (267) hide show
  1. package/{src → dist}/accessibility/color_namer.js +48 -3
  2. package/{src → dist}/accessibility/describe.js +12 -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 +23 -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-tYr0tCl8.js} +284 -132
  16. package/{src → dist}/core/States.js +3 -1
  17. package/dist/core/constants.js +1 -0
  18. package/{src → dist}/core/environment.js +12 -10
  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 +5421 -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-Cr8L2Jnm.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 +19 -13
  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 +26 -26
  50. package/{src → dist}/events/index.js +3 -1
  51. package/{src → dist}/events/keyboard.js +14 -12
  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 +5 -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 +5 -6
  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-CAxvgiOV.js} +738 -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 +3 -3
  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-Swjl9HQO.js} +393 -22
  81. package/dist/rendering-B5TRR7aY.js +24960 -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 -63
  91. package/{src → dist}/type/textCore.js +35 -58
  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 +78 -38
  117. package/lib/p5.esm.js +296 -194
  118. package/lib/p5.js +296 -194
  119. package/lib/p5.min.js +1 -1
  120. package/package.json +17 -17
  121. package/translations/dev.js +6 -6
  122. package/translations/index.js +1 -1
  123. package/types/accessibility/color_namer.d.ts +8 -0
  124. package/types/accessibility/describe.d.ts +184 -0
  125. package/types/accessibility/gridOutput.d.ts +8 -0
  126. package/types/accessibility/outputs.d.ts +235 -0
  127. package/types/accessibility/textOutput.d.ts +8 -0
  128. package/types/color/color_conversion.d.ts +47 -0
  129. package/types/color/creating_reading.d.ts +1348 -0
  130. package/types/color/p5.Color.d.ts +1070 -0
  131. package/types/color/setting.d.ts +2085 -0
  132. package/types/core/constants.d.ts +341 -0
  133. package/types/core/environment.d.ts +668 -0
  134. package/types/core/friendly_errors/fes_core.d.ts +8 -0
  135. package/types/core/friendly_errors/file_errors.d.ts +8 -0
  136. package/types/core/friendly_errors/param_validator.d.ts +30 -0
  137. package/types/core/friendly_errors/sketch_reader.d.ts +8 -0
  138. package/types/core/friendly_errors/stacktrace.d.ts +11 -0
  139. package/types/core/friendly_errors/validate_params.d.ts +8 -0
  140. package/types/core/helpers.d.ts +8 -0
  141. package/types/core/legacy.d.ts +8 -0
  142. package/types/core/main.d.ts +5996 -0
  143. package/types/core/p5.Graphics.d.ts +484 -0
  144. package/types/core/p5.Renderer.d.ts +14 -0
  145. package/types/core/reference.d.ts +8 -0
  146. package/types/core/rendering.d.ts +481 -0
  147. package/types/core/structure.d.ts +492 -0
  148. package/types/core/transform.d.ts +1638 -0
  149. package/types/data/local_storage.d.ts +323 -0
  150. package/types/dom/dom.d.ts +1295 -0
  151. package/types/dom/p5.Element.d.ts +2011 -0
  152. package/types/dom/p5.File.d.ts +13 -0
  153. package/types/dom/p5.MediaElement.d.ts +1249 -0
  154. package/types/events/acceleration.d.ts +193 -0
  155. package/types/events/keyboard.d.ts +499 -0
  156. package/types/events/pointer.d.ts +782 -0
  157. package/types/global.d.ts +5542 -0
  158. package/types/image/filterRenderer2D.d.ts +54 -0
  159. package/types/image/image.d.ts +326 -0
  160. package/types/image/loading_displaying.d.ts +580 -0
  161. package/types/image/p5.Image.d.ts +5882 -0
  162. package/types/image/pixels.d.ts +832 -0
  163. package/types/io/files.d.ts +1447 -0
  164. package/types/io/p5.Table.d.ts +1247 -0
  165. package/types/io/p5.TableRow.d.ts +343 -0
  166. package/types/io/p5.XML.d.ts +1188 -0
  167. package/types/math/Matrices/Matrix.d.ts +1029 -0
  168. package/types/math/Matrices/MatrixNumjs.d.ts +8 -0
  169. package/types/math/calculation.d.ts +923 -0
  170. package/types/math/math.d.ts +90 -0
  171. package/types/math/noise.d.ts +311 -0
  172. package/types/math/p5.Matrix.d.ts +8 -0
  173. package/types/math/p5.Vector.d.ts +3416 -0
  174. package/types/math/random.d.ts +267 -0
  175. package/types/math/trigonometry.d.ts +663 -0
  176. package/types/p5.d.ts +6663 -0
  177. package/types/shape/2d_primitives.d.ts +1033 -0
  178. package/types/shape/attributes.d.ts +466 -0
  179. package/types/shape/curves.d.ts +740 -0
  180. package/types/shape/custom_shapes.d.ts +888 -0
  181. package/types/shape/vertex.d.ts +1141 -0
  182. package/types/type/p5.Font.d.ts +575 -0
  183. package/types/type/textCore.d.ts +1198 -0
  184. package/types/utilities/conversion.d.ts +894 -0
  185. package/types/utilities/time_date.d.ts +295 -0
  186. package/types/utilities/utility_functions.d.ts +587 -0
  187. package/types/webgl/3d_primitives.d.ts +1432 -0
  188. package/types/webgl/ShaderGenerator.d.ts +8 -0
  189. package/types/webgl/interaction.d.ts +371 -0
  190. package/types/webgl/light.d.ts +1184 -0
  191. package/types/webgl/loading.d.ts +481 -0
  192. package/types/webgl/material.d.ts +2656 -0
  193. package/types/webgl/p5.Camera.d.ts +3023 -0
  194. package/types/webgl/p5.DataArray.d.ts +61 -0
  195. package/types/webgl/p5.Framebuffer.d.ts +760 -0
  196. package/types/webgl/p5.Geometry.d.ts +1191 -0
  197. package/types/webgl/p5.Quat.d.ts +45 -0
  198. package/types/webgl/p5.RendererGL.d.ts +234 -0
  199. package/types/webgl/p5.Shader.d.ts +660 -0
  200. package/types/webgl/p5.Texture.d.ts +61 -0
  201. package/types/webgl/text.d.ts +74 -0
  202. package/src/README.md +0 -27
  203. package/src/accessibility/index.js +0 -13
  204. package/src/app.js +0 -61
  205. package/src/color/index.js +0 -9
  206. package/src/color/p5.Color.culori.js +0 -66
  207. package/src/color/p5.Color.js +0 -851
  208. package/src/core/README.md +0 -91
  209. package/src/core/friendly_errors/index.js +0 -13
  210. package/src/core/friendly_errors/param_validator.js +0 -561
  211. package/src/core/init.js +0 -58
  212. package/src/core/internationalization.js +0 -195
  213. package/src/core/legacy.js +0 -29
  214. package/src/core/main.js +0 -689
  215. package/src/core/noop.js +0 -1
  216. package/src/core/p5.Graphics.js +0 -696
  217. package/src/core/p5.Renderer.js +0 -408
  218. package/src/core/reference.js +0 -2060
  219. package/src/core/rendering.js +0 -697
  220. package/src/dom/index.js +0 -11
  221. package/src/image/const.js +0 -6
  222. package/src/image/image.js +0 -731
  223. package/src/image/index.js +0 -15
  224. package/src/image/loading_displaying.js +0 -1431
  225. package/src/io/files.js +0 -2210
  226. package/src/io/index.js +0 -11
  227. package/src/math/README.md +0 -40
  228. package/src/type/index.js +0 -9
  229. package/src/webgl/3d_primitives.js +0 -2741
  230. package/src/webgl/index.js +0 -37
  231. package/src/webgl/light.js +0 -1851
  232. package/src/webgl/material.js +0 -3854
  233. package/src/webgl/p5.Camera.js +0 -4010
  234. package/src/webgl/p5.Framebuffer.js +0 -1865
  235. package/src/webgl/p5.RendererGL.js +0 -2867
  236. package/src/webgl/p5.Shader.js +0 -1505
  237. package/src/webgl/p5.Texture.js +0 -541
  238. package/src/webgl/shaders/basic.frag +0 -6
  239. package/src/webgl/shaders/filters/base.frag +0 -22
  240. package/src/webgl/shaders/filters/base.vert +0 -19
  241. package/src/webgl/shaders/filters/blur.frag +0 -60
  242. package/src/webgl/shaders/filters/default.vert +0 -18
  243. package/src/webgl/shaders/filters/dilate.frag +0 -39
  244. package/src/webgl/shaders/filters/erode.frag +0 -39
  245. package/src/webgl/shaders/filters/gray.frag +0 -16
  246. package/src/webgl/shaders/filters/invert.frag +0 -15
  247. package/src/webgl/shaders/filters/opaque.frag +0 -12
  248. package/src/webgl/shaders/filters/posterize.frag +0 -29
  249. package/src/webgl/shaders/filters/threshold.frag +0 -23
  250. package/src/webgl/shaders/font.frag +0 -216
  251. package/src/webgl/shaders/font.vert +0 -44
  252. package/src/webgl/shaders/imageLight.vert +0 -33
  253. package/src/webgl/shaders/imageLightDiffused.frag +0 -82
  254. package/src/webgl/shaders/imageLightSpecular.frag +0 -134
  255. package/src/webgl/shaders/light.vert +0 -37
  256. package/src/webgl/shaders/light_texture.frag +0 -26
  257. package/src/webgl/shaders/lighting.glsl +0 -227
  258. package/src/webgl/shaders/line.frag +0 -74
  259. package/src/webgl/shaders/line.vert +0 -294
  260. package/src/webgl/shaders/normal.frag +0 -6
  261. package/src/webgl/shaders/normal.vert +0 -72
  262. package/src/webgl/shaders/phong.frag +0 -84
  263. package/src/webgl/shaders/phong.vert +0 -87
  264. package/src/webgl/shaders/point.frag +0 -29
  265. package/src/webgl/shaders/point.vert +0 -19
  266. package/src/webgl/shaders/sphereMapping.frag +0 -26
  267. package/src/webgl/shaders/webgl2Compatibility.glsl +0 -34
@@ -1,3 +1,6 @@
1
+ import { e as CORNER, f as TWO_PI, g as HALF_PI, h as PI } from '../constants-tYr0tCl8.js';
2
+ import canvas from '../core/helpers.js';
3
+
1
4
  /**
2
5
  * @module Shape
3
6
  * @submodule 2D Primitives
@@ -6,8 +9,6 @@
6
9
  * @requires constants
7
10
  */
8
11
 
9
- import * as constants from '../core/constants';
10
- import canvas from '../core/helpers';
11
12
 
12
13
  function primitives(p5, fn){
13
14
  /**
@@ -46,8 +47,8 @@ function primitives(p5, fn){
46
47
  // adjustments made in the steps that precede it.
47
48
 
48
49
  // Constrain both start and stop to [0,TWO_PI).
49
- start = start - constants.TWO_PI * Math.floor(start / constants.TWO_PI);
50
- stop = stop - constants.TWO_PI * Math.floor(stop / constants.TWO_PI);
50
+ start = start - TWO_PI * Math.floor(start / TWO_PI);
51
+ stop = stop - TWO_PI * Math.floor(stop / TWO_PI);
51
52
 
52
53
  // Get the angular separation between the requested start and stop points.
53
54
  //
@@ -63,30 +64,30 @@ function primitives(p5, fn){
63
64
  // epsilon smaller...)
64
65
  separation = Math.min(
65
66
  Math.abs(start - stop),
66
- constants.TWO_PI - Math.abs(start - stop)
67
+ TWO_PI - Math.abs(start - stop)
67
68
  );
68
69
 
69
70
  // Optionally adjust the angles to counter linear scaling.
70
71
  if (correctForScaling) {
71
- if (start <= constants.HALF_PI) {
72
+ if (start <= HALF_PI) {
72
73
  start = Math.atan(width / height * Math.tan(start));
73
- } else if (start > constants.HALF_PI && start <= 3 * constants.HALF_PI) {
74
- start = Math.atan(width / height * Math.tan(start)) + constants.PI;
74
+ } else if (start > HALF_PI && start <= 3 * HALF_PI) {
75
+ start = Math.atan(width / height * Math.tan(start)) + PI;
75
76
  } else {
76
- start = Math.atan(width / height * Math.tan(start)) + constants.TWO_PI;
77
+ start = Math.atan(width / height * Math.tan(start)) + TWO_PI;
77
78
  }
78
- if (stop <= constants.HALF_PI) {
79
+ if (stop <= HALF_PI) {
79
80
  stop = Math.atan(width / height * Math.tan(stop));
80
- } else if (stop > constants.HALF_PI && stop <= 3 * constants.HALF_PI) {
81
- stop = Math.atan(width / height * Math.tan(stop)) + constants.PI;
81
+ } else if (stop > HALF_PI && stop <= 3 * HALF_PI) {
82
+ stop = Math.atan(width / height * Math.tan(stop)) + PI;
82
83
  } else {
83
- stop = Math.atan(width / height * Math.tan(stop)) + constants.TWO_PI;
84
+ stop = Math.atan(width / height * Math.tan(stop)) + TWO_PI;
84
85
  }
85
86
  }
86
87
 
87
88
  // Ensure that start <= stop < start + TWO_PI.
88
89
  if (start > stop) {
89
- stop += constants.TWO_PI;
90
+ stop += TWO_PI;
90
91
  }
91
92
 
92
93
  return {
@@ -1341,7 +1342,7 @@ function primitives(p5, fn){
1341
1342
  // removed by modeAdjust(). This results in flipped/mirrored rendering,
1342
1343
  // which is especially noticable when using WEGBL rendering and texture().
1343
1344
  // Note that this behavior only applies to rect(), NOT to ellipse() and arc().
1344
- if (this._renderer.states.rectMode === constants.CORNER) {
1345
+ if (this._renderer.states.rectMode === CORNER) {
1345
1346
  vals.w = arguments[2];
1346
1347
  vals.h = arguments[3];
1347
1348
  }
@@ -1445,8 +1446,8 @@ function primitives(p5, fn){
1445
1446
  };
1446
1447
  }
1447
1448
 
1448
- export default primitives;
1449
-
1450
1449
  if(typeof p5 !== 'undefined'){
1451
1450
  primitives(p5, p5.prototype);
1452
1451
  }
1452
+
1453
+ export { primitives as default };
@@ -1,3 +1,5 @@
1
+ import { e as CORNER, i as CORNERS, a as RADIUS, C as CENTER, j as ROUND, S as SQUARE, k as PROJECT, B as BEVEL, l as MITER } from '../constants-tYr0tCl8.js';
2
+
1
3
  /**
2
4
  * @module Shape
3
5
  * @submodule Attributes
@@ -6,7 +8,6 @@
6
8
  * @requires constants
7
9
  */
8
10
 
9
- import * as constants from '../core/constants';
10
11
 
11
12
  function attributes(p5, fn){
12
13
  /**
@@ -87,10 +88,10 @@ function attributes(p5, fn){
87
88
  fn.ellipseMode = function(m) {
88
89
  // p5._validateParameters('ellipseMode', arguments);
89
90
  if (
90
- m === constants.CORNER ||
91
- m === constants.CORNERS ||
92
- m === constants.RADIUS ||
93
- m === constants.CENTER
91
+ m === CORNER ||
92
+ m === CORNERS ||
93
+ m === RADIUS ||
94
+ m === CENTER
94
95
  ) {
95
96
  this._renderer.states.setValue('ellipseMode', m);
96
97
  }
@@ -287,10 +288,10 @@ function attributes(p5, fn){
287
288
  fn.rectMode = function(m) {
288
289
  // p5._validateParameters('rectMode', arguments);
289
290
  if (
290
- m === constants.CORNER ||
291
- m === constants.CORNERS ||
292
- m === constants.RADIUS ||
293
- m === constants.CENTER
291
+ m === CORNER ||
292
+ m === CORNERS ||
293
+ m === RADIUS ||
294
+ m === CENTER
294
295
  ) {
295
296
  this._renderer.states.setValue('rectMode', m);
296
297
  }
@@ -425,9 +426,9 @@ function attributes(p5, fn){
425
426
  fn.strokeCap = function(cap) {
426
427
  // p5._validateParameters('strokeCap', arguments);
427
428
  if (
428
- cap === constants.ROUND ||
429
- cap === constants.SQUARE ||
430
- cap === constants.PROJECT
429
+ cap === ROUND ||
430
+ cap === SQUARE ||
431
+ cap === PROJECT
431
432
  ) {
432
433
  this._renderer.strokeCap(cap);
433
434
  }
@@ -524,9 +525,9 @@ function attributes(p5, fn){
524
525
  fn.strokeJoin = function(join) {
525
526
  // p5._validateParameters('strokeJoin', arguments);
526
527
  if (
527
- join === constants.ROUND ||
528
- join === constants.BEVEL ||
529
- join === constants.MITER
528
+ join === ROUND ||
529
+ join === BEVEL ||
530
+ join === MITER
530
531
  ) {
531
532
  this._renderer.strokeJoin(join);
532
533
  }
@@ -595,8 +596,8 @@ function attributes(p5, fn){
595
596
  };
596
597
  }
597
598
 
598
- export default attributes;
599
-
600
599
  if(typeof p5 !== 'undefined'){
601
600
  attributes(p5, p5.prototype);
602
601
  }
602
+
603
+ export { attributes as default };
@@ -900,8 +900,8 @@ function curves(p5, fn){
900
900
  };
901
901
  }
902
902
 
903
- export default curves;
904
-
905
903
  if(typeof p5 !== 'undefined'){
906
904
  curves(p5, p5.prototype);
907
905
  }
906
+
907
+ export { curves as default };
@@ -1,3 +1,9 @@
1
+ import { C as Color } from '../creating_reading-Cr8L2Jnm.js';
2
+ import { Vector } from '../math/p5.Vector.js';
3
+ import { I as INCLUDE, m as PATH, E as EMPTY_PATH, O as OPEN, n as CLOSE, o as POINTS, L as LINES, p as TRIANGLES, Q as QUADS, q as TRIANGLE_FAN, r as TRIANGLE_STRIP, s as QUAD_STRIP, t as EXCLUDE, J as JOIN } from '../constants-tYr0tCl8.js';
4
+ import 'colorjs.io/fn';
5
+ import '../color/color_spaces/hsb.js';
6
+
1
7
  /**
2
8
  * @module Shape
3
9
  * @submodule Custom Shapes
@@ -6,10 +12,6 @@
6
12
  * @requires constants
7
13
  */
8
14
 
9
- // REMINDER: remove .js extension (currently using it to run file locally)
10
- import { Color } from '../color/p5.Color';
11
- import { Vector } from '../math/p5.Vector';
12
- import * as constants from '../core/constants';
13
15
 
14
16
  // ---- UTILITY FUNCTIONS ----
15
17
  function polylineLength(vertices) {
@@ -155,15 +157,15 @@ class Contour {
155
157
  #kind;
156
158
  primitives;
157
159
 
158
- constructor(kind = constants.PATH) {
160
+ constructor(kind = PATH) {
159
161
  this.#kind = kind;
160
162
  this.primitives = [];
161
163
  }
162
164
 
163
165
  get kind() {
164
166
  const isEmpty = this.primitives.length === 0;
165
- const isPath = this.#kind === constants.PATH;
166
- return isEmpty && isPath ? constants.EMPTY_PATH : this.#kind;
167
+ const isPath = this.#kind === PATH;
168
+ return isEmpty && isPath ? EMPTY_PATH : this.#kind;
167
169
  }
168
170
 
169
171
  accept(visitor) {
@@ -281,7 +283,7 @@ to interpolated endpoints (a breaking change)
281
283
  class SplineSegment extends Segment {
282
284
  #vertexCapacity = Infinity;
283
285
  _splineProperties = {
284
- ends: constants.INCLUDE,
286
+ ends: INCLUDE,
285
287
  tightness: 0
286
288
  };
287
289
 
@@ -298,7 +300,7 @@ class SplineSegment extends Segment {
298
300
  }
299
301
 
300
302
  get canOverrideAnchor() {
301
- return this._splineProperties.ends === constants.EXCLUDE;
303
+ return this._splineProperties.ends === EXCLUDE;
302
304
  }
303
305
 
304
306
  // assuming for now that the first interpolated vertex is always
@@ -306,7 +308,7 @@ class SplineSegment extends Segment {
306
308
  // if this spline segment doesn't follow another segment,
307
309
  // the first vertex is in an anchor
308
310
  get _firstInterpolatedVertex() {
309
- if (this._splineProperties.ends === constants.EXCLUDE) {
311
+ if (this._splineProperties.ends === EXCLUDE) {
310
312
  return this._comesAfterSegment ?
311
313
  this.vertices[1] :
312
314
  this.vertices[0];
@@ -333,7 +335,7 @@ class SplineSegment extends Segment {
333
335
  this._splineProperties.ends = shape._splineProperties.ends;
334
336
  this._splineProperties.tightness = shape._splineProperties.tightness;
335
337
 
336
- if (this._splineProperties.ends !== constants.EXCLUDE) return added;
338
+ if (this._splineProperties.ends !== EXCLUDE) return added;
337
339
 
338
340
  let verticesPushed = !this._belongsToShape;
339
341
  let lastPrimitive = shape.at(-1, -1);
@@ -369,9 +371,9 @@ class SplineSegment extends Segment {
369
371
 
370
372
  // override method on base class
371
373
  getEndVertex() {
372
- if (this._splineProperties.ends === constants.INCLUDE) {
374
+ if (this._splineProperties.ends === INCLUDE) {
373
375
  return super.getEndVertex();
374
- } else if (this._splineProperties.ends === constants.EXCLUDE) {
376
+ } else if (this._splineProperties.ends === EXCLUDE) {
375
377
  return this.vertices.at(-2);
376
378
  } else {
377
379
  return this.getStartVertex();
@@ -391,10 +393,10 @@ class SplineSegment extends Segment {
391
393
  }
392
394
 
393
395
  const prevVertex = this.getStartVertex();
394
- if (this._splineProperties.ends === constants.INCLUDE) {
396
+ if (this._splineProperties.ends === INCLUDE) {
395
397
  points.unshift(prevVertex);
396
398
  points.push(this.vertices.at(-1));
397
- } else if (this._splineProperties.ends === constants.JOIN) {
399
+ } else if (this._splineProperties.ends === JOIN) {
398
400
  points.unshift(this.vertices.at(-1));
399
401
  points.push(prevVertex, this.vertices.at(0));
400
402
  }
@@ -412,7 +414,7 @@ class SplineSegment extends Segment {
412
414
  }
413
415
 
414
416
  close() {
415
- this._splineProperties.ends = constants.JOIN;
417
+ this._splineProperties.ends = JOIN;
416
418
  }
417
419
  }
418
420
 
@@ -535,23 +537,23 @@ class PrimitiveShapeCreators {
535
537
  */
536
538
 
537
539
  // vertex
538
- creators.set(`vertex-${constants.EMPTY_PATH}`, (...vertices) => new Anchor(...vertices));
539
- creators.set(`vertex-${constants.PATH}`, (...vertices) => new LineSegment(...vertices));
540
- creators.set(`vertex-${constants.POINTS}`, (...vertices) => new Point(...vertices));
541
- creators.set(`vertex-${constants.LINES}`, (...vertices) => new Line(...vertices));
542
- creators.set(`vertex-${constants.TRIANGLES}`, (...vertices) => new Triangle(...vertices));
543
- creators.set(`vertex-${constants.QUADS}`, (...vertices) => new Quad(...vertices));
544
- creators.set(`vertex-${constants.TRIANGLE_FAN}`, (...vertices) => new TriangleFan(...vertices));
545
- creators.set(`vertex-${constants.TRIANGLE_STRIP}`, (...vertices) => new TriangleStrip(...vertices));
546
- creators.set(`vertex-${constants.QUAD_STRIP}`, (...vertices) => new QuadStrip(...vertices));
540
+ creators.set(`vertex-${EMPTY_PATH}`, (...vertices) => new Anchor(...vertices));
541
+ creators.set(`vertex-${PATH}`, (...vertices) => new LineSegment(...vertices));
542
+ creators.set(`vertex-${POINTS}`, (...vertices) => new Point(...vertices));
543
+ creators.set(`vertex-${LINES}`, (...vertices) => new Line(...vertices));
544
+ creators.set(`vertex-${TRIANGLES}`, (...vertices) => new Triangle(...vertices));
545
+ creators.set(`vertex-${QUADS}`, (...vertices) => new Quad(...vertices));
546
+ creators.set(`vertex-${TRIANGLE_FAN}`, (...vertices) => new TriangleFan(...vertices));
547
+ creators.set(`vertex-${TRIANGLE_STRIP}`, (...vertices) => new TriangleStrip(...vertices));
548
+ creators.set(`vertex-${QUAD_STRIP}`, (...vertices) => new QuadStrip(...vertices));
547
549
 
548
550
  // bezierVertex (constructors all take order and vertices so they can be called in a uniform way)
549
- creators.set(`bezierVertex-${constants.EMPTY_PATH}`, (order, ...vertices) => new Anchor(...vertices));
550
- creators.set(`bezierVertex-${constants.PATH}`, (order, ...vertices) => new BezierSegment(order, ...vertices));
551
+ creators.set(`bezierVertex-${EMPTY_PATH}`, (order, ...vertices) => new Anchor(...vertices));
552
+ creators.set(`bezierVertex-${PATH}`, (order, ...vertices) => new BezierSegment(order, ...vertices));
551
553
 
552
554
  // splineVertex
553
- creators.set(`splineVertex-${constants.EMPTY_PATH}`, (...vertices) => new Anchor(...vertices));
554
- creators.set(`splineVertex-${constants.PATH}`, (...vertices) => new SplineSegment(...vertices));
555
+ creators.set(`splineVertex-${EMPTY_PATH}`, (...vertices) => new Anchor(...vertices));
556
+ creators.set(`splineVertex-${PATH}`, (...vertices) => new SplineSegment(...vertices));
555
557
 
556
558
  this.creators = creators;
557
559
  }
@@ -587,7 +589,7 @@ class Shape {
587
589
  contours = [];
588
590
  _splineProperties = {
589
591
  tightness: 0,
590
- ends: constants.INCLUDE
592
+ ends: INCLUDE
591
593
  };
592
594
  userVertexProperties = null;
593
595
 
@@ -905,18 +907,18 @@ class Shape {
905
907
  this.#generalVertex('arcVertex', position, textureCoordinates);
906
908
  }
907
909
 
908
- beginContour(shapeKind = constants.PATH) {
909
- if (this.at(-1)?.kind === constants.EMPTY_PATH) {
910
+ beginContour(shapeKind = PATH) {
911
+ if (this.at(-1)?.kind === EMPTY_PATH) {
910
912
  this.contours.pop();
911
913
  }
912
914
  this.contours.push(new Contour(shapeKind));
913
915
  }
914
916
 
915
- endContour(closeMode = constants.OPEN, _index = this.contours.length - 1) {
917
+ endContour(closeMode = OPEN, _index = this.contours.length - 1) {
916
918
  const contour = this.at(_index);
917
- if (closeMode === constants.CLOSE) {
919
+ if (closeMode === CLOSE) {
918
920
  // shape characteristics
919
- const isPath = contour.kind === constants.PATH;
921
+ const isPath = contour.kind === PATH;
920
922
 
921
923
  // anchor characteristics
922
924
  const anchorVertex = this.at(_index, 0, 0);
@@ -952,7 +954,7 @@ class Shape {
952
954
  }
953
955
  }
954
956
 
955
- beginShape(shapeKind = constants.PATH) {
957
+ beginShape(shapeKind = PATH) {
956
958
  this.kind = shapeKind;
957
959
  // Implicitly start a contour
958
960
  this.beginContour(shapeKind);
@@ -963,8 +965,8 @@ class Shape {
963
965
  - Might combine conditions at top, and rely on shortcircuiting.
964
966
  Does nothing if shape is not a path or has multiple contours. Might discuss this.
965
967
  */
966
- endShape(closeMode = constants.OPEN) {
967
- if (closeMode === constants.CLOSE) {
968
+ endShape(closeMode = OPEN) {
969
+ if (closeMode === CLOSE) {
968
970
  // Close the first contour, the one implicitly used for shape data
969
971
  // added without an explicit contour
970
972
  this.endContour(closeMode, 0);
@@ -1083,7 +1085,7 @@ class PrimitiveToPath2DConverter extends PrimitiveVisitor {
1083
1085
  const shape = splineSegment._shape;
1084
1086
 
1085
1087
  if (
1086
- splineSegment._splineProperties.ends === constants.EXCLUDE &&
1088
+ splineSegment._splineProperties.ends === EXCLUDE &&
1087
1089
  !splineSegment._comesAfterSegment
1088
1090
  ) {
1089
1091
  let startVertex = splineSegment._firstInterpolatedVertex;
@@ -2590,35 +2592,13 @@ function customShapes(p5, fn) {
2590
2592
  * </code>
2591
2593
  * </div>
2592
2594
  */
2593
- fn.endContour = function(mode = constants.OPEN) {
2595
+ fn.endContour = function(mode = OPEN) {
2594
2596
  this._renderer.endContour(mode);
2595
2597
  };
2596
2598
  }
2597
2599
 
2598
- export default customShapes;
2599
- export {
2600
- Shape,
2601
- Contour,
2602
- ShapePrimitive,
2603
- Vertex,
2604
- Anchor,
2605
- Segment,
2606
- LineSegment,
2607
- BezierSegment,
2608
- SplineSegment,
2609
- Point,
2610
- Line,
2611
- Triangle,
2612
- Quad,
2613
- TriangleFan,
2614
- TriangleStrip,
2615
- QuadStrip,
2616
- PrimitiveVisitor,
2617
- PrimitiveToPath2DConverter,
2618
- PrimitiveToVerticesConverter,
2619
- PointAtLengthGetter
2620
- };
2621
-
2622
2600
  if (typeof p5 !== 'undefined') {
2623
2601
  customShapes(p5, p5.prototype);
2624
2602
  }
2603
+
2604
+ export { Anchor, BezierSegment, Contour, Line, LineSegment, Point, PointAtLengthGetter, PrimitiveToPath2DConverter, PrimitiveToVerticesConverter, PrimitiveVisitor, Quad, QuadStrip, Segment, Shape, ShapePrimitive, SplineSegment, Triangle, TriangleFan, TriangleStrip, Vertex, customShapes as default };
@@ -3,11 +3,19 @@ import attributes from './attributes.js';
3
3
  import curves from './curves.js';
4
4
  import vertex from './vertex.js';
5
5
  import customShapes from './custom_shapes.js';
6
+ import '../constants-tYr0tCl8.js';
7
+ import '../core/helpers.js';
8
+ import '../creating_reading-Cr8L2Jnm.js';
9
+ import 'colorjs.io/fn';
10
+ import '../color/color_spaces/hsb.js';
11
+ import '../math/p5.Vector.js';
6
12
 
7
- export default function(p5){
13
+ function shape(p5){
8
14
  p5.registerAddon(primitives);
9
15
  p5.registerAddon(attributes);
10
16
  p5.registerAddon(curves);
11
17
  p5.registerAddon(vertex);
12
18
  p5.registerAddon(customShapes);
13
- }
19
+ }
20
+
21
+ export { shape as default };
@@ -6,7 +6,6 @@
6
6
  * @requires constants
7
7
  */
8
8
 
9
- import * as constants from '../core/constants';
10
9
 
11
10
  function vertex(p5, fn){
12
11
  /**
@@ -1248,8 +1247,8 @@ function vertex(p5, fn){
1248
1247
  };
1249
1248
  }
1250
1249
 
1251
- export default vertex;
1252
-
1253
1250
  if(typeof p5 !== 'undefined'){
1254
1251
  vertex(p5, p5.prototype);
1255
1252
  }
1253
+
1254
+ export { vertex as default };
@@ -0,0 +1,25 @@
1
+ import textCore from './textCore.js';
2
+ import font from './p5.Font.js';
3
+ import '../p5.Renderer-Swjl9HQO.js';
4
+ import '../creating_reading-Cr8L2Jnm.js';
5
+ import 'colorjs.io/fn';
6
+ import '../color/color_spaces/hsb.js';
7
+ import '../constants-tYr0tCl8.js';
8
+ import '../image/filters.js';
9
+ import '../math/p5.Vector.js';
10
+ import '../shape/custom_shapes.js';
11
+ import '../core/States.js';
12
+ import '../io/utilities.js';
13
+ import 'file-saver';
14
+ import '@japont/unicode-range';
15
+ import './unicodeRanges.js';
16
+ import './lib/Typr.js';
17
+ import 'pako';
18
+ import '@davepagurek/bezier-path';
19
+
20
+ function type(p5){
21
+ p5.registerAddon(textCore);
22
+ p5.registerAddon(font);
23
+ }
24
+
25
+ export { type as default };