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
package/package.json CHANGED
@@ -23,7 +23,7 @@
23
23
  "node ./utils/sample-linter.mjs"
24
24
  ]
25
25
  },
26
- "version": "2.0.0",
26
+ "version": "2.0.1",
27
27
  "dependencies": {
28
28
  "@davepagurek/bezier-path": "^0.0.2",
29
29
  "@japont/unicode-range": "^1.0.0",
@@ -54,6 +54,7 @@
54
54
  "dayjs": "^1.11.10",
55
55
  "documentation": "^14.0.3",
56
56
  "eslint": "^8.54.0",
57
+ "glob": "^11.0.1",
57
58
  "husky": "^4.2.3",
58
59
  "lint-staged": "^15.1.0",
59
60
  "msw": "^2.6.3",
@@ -68,23 +69,23 @@
68
69
  "license": "LGPL-2.1",
69
70
  "browser": "./lib/p5.min.js",
70
71
  "exports": {
71
- "./": "./src/app.js",
72
- "./core": "./src/core/main.js",
73
- "./shape": "./src/shape/index.js",
74
- "./accessibility": "./src/accessibility/index.js",
75
- "./friendlyErrors": "./src/core/friendlyErrors/index.js",
76
- "./data": "./src/data/index.js",
77
- "./dom": "./src/dom/index.js",
78
- "./events": "./src/events/index.js",
79
- "./image": "./src/image/index.js",
80
- "./io": "./src/io/index.js",
81
- "./math": "./src/math/index.js",
82
- "./utilities": "./src/utilities/index.js",
83
- "./webgl": "./src/webgl/index.js",
84
- "./type": "./src/type/index.js"
72
+ ".": "./dist/app.js",
73
+ "./core": "./dist/core/main.js",
74
+ "./shape": "./dist/shape/index.js",
75
+ "./accessibility": "./dist/accessibility/index.js",
76
+ "./friendlyErrors": "./dist/core/friendlyErrors/index.js",
77
+ "./data": "./dist/data/index.js",
78
+ "./dom": "./dist/dom/index.js",
79
+ "./events": "./dist/events/index.js",
80
+ "./image": "./dist/image/index.js",
81
+ "./io": "./dist/io/index.js",
82
+ "./math": "./dist/math/index.js",
83
+ "./utilities": "./dist/utilities/index.js",
84
+ "./webgl": "./dist/webgl/index.js",
85
+ "./type": "./dist/type/index.js"
85
86
  },
86
87
  "files": [
87
- "src/**",
88
+ "dist/**",
88
89
  "license.txt",
89
90
  "lib/p5.min.js",
90
91
  "lib/p5.js",
@@ -1,9 +1,9 @@
1
- export { default as en_translation } from './en/translation';
2
- export { default as es_translation } from './es/translation';
3
- export { default as ko_translation } from './ko/translation';
4
- export { default as zh_translation } from './zh/translation';
5
- export { default as hi_translation } from './hi/translation';
6
- export { default as ja_translation } from './ja/translation';
1
+ export { default as en_translation } from './en/translation.json';
2
+ export { default as es_translation } from './es/translation.json';
3
+ export { default as ko_translation } from './ko/translation.json';
4
+ export { default as zh_translation } from './zh/translation.json';
5
+ export { default as hi_translation } from './hi/translation.json';
6
+ export { default as ja_translation } from './ja/translation.json';
7
7
 
8
8
  /*
9
9
  * When adding a new language, add a new "export" statement above this.
@@ -1,4 +1,4 @@
1
- import en from './en/translation';
1
+ import en from './en/translation.json';
2
2
 
3
3
  // Only one language is imported above. This is intentional as other languages
4
4
  // will be hosted online and then downloaded whenever needed
package/src/README.md DELETED
@@ -1,27 +0,0 @@
1
- # Organization
2
-
3
- The p5.js source code is organized into subdirectories which are roughly conceptually equivalent to third-party addons, except that these "addons" are actually just shipped as part of the p5.js library because the functionality they provide is so useful and central to p5's goal of building art projects for the web.
4
-
5
- The `src/core` directory is the primary exception to this. It contains most of the internal logic of p5.js — the code which orchestrates everything else. It is possible to create optimized minimalist [custom builds](/contributor_docs/custom_p5_build.md) of the p5.js library which only include specific desired modules. In such a custom build, the contents of the core directory would be the only hard requirement, and everything else would be optional.
6
-
7
- [JSDoc](https://jsdoc.app/) [module](https://jsdoc.app/tags-module.html) annotations are used throughout the codebase, but they primarily organize the public-facing [p5 reference manual](https://p5js.org/reference/), which is built automatically from the source code. These annotations structure the *expressive and creative API* of p5, and consequently they might not always align exactly with the *source code structure*.
8
-
9
- The `app.js` file is simply an index of all the other modules which exports the p5 constructor function.
10
-
11
- # APIs
12
-
13
- p5.js seeks to create a toolkit for working with the web technologies that are most valuable for building art projects. For both expressive and pedagogical reasons, p5.js values (but does not necessarily always achieve lol!) clarity in its APIs. These are guidelines, and in practice there may be occasional exceptions.
14
-
15
- ## Public
16
-
17
- Public APIs which are exposed to users of the p5.js library during the course of working on sketches and projects should use short, clear, declarative function names. `circle()` is preferable to `new Circle()`. If the name of a public API function is longer than one or two words, it may be worth carefully considering whether the API should be restructured into something more creative, expressive, or intuitive.
18
-
19
- ## Native
20
-
21
- Native APIs provided by the browser can sometimes be aliased in the style of public APIs to provide a more creative, expressive, or intuitive interface than the native implementation. For example, `print()` is easier to explain than `console.log()`. Idiomatic JavaScript is generally preferable, so aliasing in this manner needs to have tremendous creative or pedagogical benefits.
22
-
23
- Native browser functionality is also often aliased with properties on the `p5` object. This allows the library to consistently point toward the same reference, but in most cases this practice should not be considered part of the public API even though those properties are exposed to the user.
24
-
25
- ## Internal
26
-
27
- Internal APIs which are not exposed to the user but are used for coordination within the library should generally take the form of constructor functions which can be exported across module boundaries. Those constructors are often attached to the `p5` constructor as a form of namespacing, but otherwise do not meaningfully act as methods that reference the host object. In cases where a `p5` object is needed inside a constructor, an instance will be explicitly passed as an input argument.
@@ -1,13 +0,0 @@
1
- import describe from './describe.js';
2
- import gridOutput from './gridOutput.js';
3
- import textOutput from './textOutput.js';
4
- import outputs from './outputs.js';
5
- import colorNamer from './color_namer.js';
6
-
7
- export default function(p5){
8
- p5.registerAddon(describe);
9
- p5.registerAddon(gridOutput);
10
- p5.registerAddon(textOutput);
11
- p5.registerAddon(outputs);
12
- p5.registerAddon(colorNamer);
13
- }
package/src/app.js DELETED
@@ -1,61 +0,0 @@
1
- // core
2
- import p5 from './core/main';
3
-
4
- // shape
5
- import shape from './shape';
6
- shape(p5);
7
-
8
- //accessibility
9
- import accessibility from './accessibility';
10
- accessibility(p5);
11
-
12
- // color
13
- import color from './color';
14
- color(p5);
15
-
16
- // core
17
- // currently, it only contains the test for parameter validation
18
- import friendlyErrors from './core/friendly_errors';
19
- friendlyErrors(p5);
20
-
21
- // data
22
- import data from './data';
23
- data(p5);
24
-
25
- // DOM
26
- import dom from './dom';
27
- dom(p5);
28
-
29
- // events
30
- import events from './events';
31
- events(p5);
32
-
33
- // image
34
- import image from './image';
35
- image(p5);
36
-
37
- // io
38
- import io from './io';
39
- io(p5);
40
-
41
- // math
42
- import math from './math';
43
- math(p5);
44
-
45
- // utilities
46
- import utilities from './utilities';
47
- utilities(p5);
48
-
49
- // webgl
50
- import webgl from './webgl';
51
- webgl(p5);
52
-
53
- // typography
54
- import type from './type'
55
- type(p5);
56
-
57
- import { waitForDocumentReady, waitingForTranslator, _globalInit } from './core/init';
58
- Promise.all([waitForDocumentReady(), waitingForTranslator]).then(_globalInit);
59
-
60
- export default p5;
61
-
@@ -1,9 +0,0 @@
1
- import creatingReading from './creating_reading.js';
2
- import p5color from './p5.Color.js';
3
- import setting from './setting.js';
4
-
5
- export default function(p5){
6
- p5.registerAddon(creatingReading);
7
- p5.registerAddon(p5color);
8
- p5.registerAddon(setting);
9
- }
@@ -1,66 +0,0 @@
1
- class Color {
2
- _color;
3
- maxes;
4
- mode;
5
- array;
6
-
7
- static addColorMode(mode, definition){
8
-
9
- }
10
-
11
- constructor(vals){
12
-
13
- }
14
-
15
- toString(){
16
-
17
- }
18
-
19
- setRed(new_red){
20
-
21
- }
22
-
23
- setGreen(new_green){
24
-
25
- }
26
-
27
- setBlue(new_blue){
28
-
29
- }
30
-
31
- setAlpha(new_alpha){
32
-
33
- }
34
-
35
- _getRed(){
36
-
37
- }
38
-
39
- _getGreen(){
40
-
41
- }
42
-
43
- _getBlue(){
44
-
45
- }
46
-
47
- _getAlpha(){
48
-
49
- }
50
-
51
- _getHue(){
52
-
53
- }
54
-
55
- _getSaturation(){
56
-
57
- }
58
-
59
- _getBrightness(){
60
-
61
- }
62
-
63
- _getLightness(){
64
-
65
- }
66
- }