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.
- package/{src → dist}/accessibility/color_namer.js +48 -3
- package/{src → dist}/accessibility/describe.js +12 -2
- package/{src → dist}/accessibility/gridOutput.js +2 -2
- package/dist/accessibility/index.js +60 -0
- package/{src → dist}/accessibility/outputs.js +23 -2
- package/{src → dist}/accessibility/textOutput.js +2 -2
- package/dist/app.js +120 -0
- package/{src → dist}/color/color_conversion.js +48 -10
- package/{src → dist}/color/color_spaces/hsb.js +3 -1
- package/dist/color/creating_reading.js +3 -0
- package/dist/color/index.js +13 -0
- package/dist/color/p5.Color.culori.js +1 -0
- package/dist/color/p5.Color.js +3 -0
- package/{src → dist}/color/setting.js +9 -6
- package/{src/core/constants.js → dist/constants-tYr0tCl8.js} +284 -132
- package/{src → dist}/core/States.js +3 -1
- package/dist/core/constants.js +1 -0
- package/{src → dist}/core/environment.js +12 -10
- package/{src → dist}/core/friendly_errors/browser_errors.js +1 -1
- package/{src → dist}/core/friendly_errors/fes_core.js +14 -44
- package/{src → dist}/core/friendly_errors/file_errors.js +6 -3
- package/dist/core/friendly_errors/index.js +23 -0
- package/dist/core/friendly_errors/param_validator.js +5421 -0
- package/{src → dist}/core/friendly_errors/sketch_reader.js +50 -4
- package/{src → dist}/core/friendly_errors/sketch_verifier.js +6 -6
- package/{src → dist}/core/friendly_errors/stacktrace.js +3 -5
- package/{src → dist}/core/friendly_errors/validate_params.js +50 -41
- package/{src → dist}/core/helpers.js +9 -6
- package/dist/core/init.js +105 -0
- package/dist/core/internationalization.js +302 -0
- package/dist/core/legacy.js +73 -0
- package/dist/core/main.js +44 -0
- package/dist/core/noop.js +3 -0
- package/dist/core/p5.Graphics.js +40 -0
- package/dist/core/p5.Renderer.js +11 -0
- package/dist/core/p5.Renderer2D.js +44 -0
- package/dist/core/reference.js +1 -0
- package/dist/core/rendering.js +40 -0
- package/{src → dist}/core/structure.js +3 -3
- package/{src → dist}/core/transform.js +2 -2
- package/{src/color/creating_reading.js → dist/creating_reading-Cr8L2Jnm.js} +841 -13
- package/{src → dist}/data/index.js +3 -1
- package/{src → dist}/data/local_storage.js +2 -8
- package/{src → dist}/dom/dom.js +19 -13
- package/dist/dom/index.js +18 -0
- package/{src → dist}/dom/p5.Element.js +14 -12
- package/{src → dist}/dom/p5.File.js +4 -4
- package/{src → dist}/dom/p5.MediaElement.js +10 -4
- package/{src → dist}/events/acceleration.js +26 -26
- package/{src → dist}/events/index.js +3 -1
- package/{src → dist}/events/keyboard.js +14 -12
- package/{src → dist}/events/pointer.js +16 -17
- package/dist/image/const.js +9 -0
- package/{src → dist}/image/filterRenderer2D.js +57 -37
- package/{src → dist}/image/filters.js +1 -3
- package/dist/image/image.js +40 -0
- package/dist/image/index.js +51 -0
- package/dist/image/loading_displaying.js +40 -0
- package/dist/image/p5.Image.js +11 -0
- package/{src → dist}/image/pixels.js +5 -3
- package/{src → dist}/io/csv.js +72 -70
- package/dist/io/files.js +40 -0
- package/dist/io/index.js +51 -0
- package/{src → dist}/io/p5.Table.js +6 -6
- package/{src → dist}/io/p5.TableRow.js +5 -6
- package/{src → dist}/io/p5.XML.js +2 -5
- package/{src → dist}/io/utilities.js +1 -1
- package/{src/core/p5.Renderer2D.js → dist/main-CAxvgiOV.js} +738 -57
- package/{src → dist}/math/Matrices/Matrix.js +10 -8
- package/{src → dist}/math/Matrices/MatrixInterface.js +5 -3
- package/{src → dist}/math/Matrices/MatrixNumjs.js +12 -26
- package/{src → dist}/math/calculation.js +2 -2
- package/{src → dist}/math/index.js +6 -3
- package/{src → dist}/math/math.js +3 -3
- package/{src → dist}/math/noise.js +2 -2
- package/{src → dist}/math/p5.Matrix.js +7 -4
- package/{src → dist}/math/p5.Vector.js +6 -6
- package/{src → dist}/math/random.js +2 -2
- package/{src → dist}/math/trigonometry.js +16 -15
- package/{src/image/p5.Image.js → dist/p5.Renderer-Swjl9HQO.js} +393 -22
- package/dist/rendering-B5TRR7aY.js +24960 -0
- package/{src → dist}/shape/2d_primitives.js +18 -17
- package/{src → dist}/shape/attributes.js +18 -17
- package/{src → dist}/shape/curves.js +2 -2
- package/{src → dist}/shape/custom_shapes.js +44 -64
- package/{src → dist}/shape/index.js +10 -2
- package/{src → dist}/shape/vertex.js +2 -3
- package/dist/type/index.js +25 -0
- package/{src → dist}/type/lib/Typr.js +76 -94
- package/{src → dist}/type/p5.Font.js +37 -63
- package/{src → dist}/type/textCore.js +35 -58
- package/{src → dist}/type/unicodeRanges.js +3 -1
- package/{src → dist}/utilities/conversion.js +2 -2
- package/{src → dist}/utilities/index.js +3 -1
- package/{src → dist}/utilities/time_date.js +6 -7
- package/{src → dist}/utilities/utility_functions.js +2 -2
- package/dist/webgl/3d_primitives.js +40 -0
- package/{src → dist}/webgl/GeometryBufferCache.js +3 -1
- package/{src → dist}/webgl/GeometryBuilder.js +12 -8
- package/{src → dist}/webgl/ShaderGenerator.js +79 -82
- package/{src → dist}/webgl/ShapeBuilder.js +26 -23
- package/dist/webgl/index.js +76 -0
- package/{src → dist}/webgl/interaction.js +7 -6
- package/dist/webgl/light.js +40 -0
- package/{src → dist}/webgl/loading.js +45 -12
- package/dist/webgl/material.js +40 -0
- package/dist/webgl/p5.Camera.js +40 -0
- package/{src → dist}/webgl/p5.DataArray.js +3 -5
- package/dist/webgl/p5.Framebuffer.js +40 -0
- package/{src → dist}/webgl/p5.Geometry.js +12 -15
- package/{src → dist}/webgl/p5.Quat.js +5 -4
- package/{src → dist}/webgl/p5.RenderBuffer.js +2 -3
- package/dist/webgl/p5.RendererGL.js +40 -0
- package/dist/webgl/p5.Shader.js +40 -0
- package/dist/webgl/p5.Texture.js +40 -0
- package/{src → dist}/webgl/text.js +78 -38
- package/lib/p5.esm.js +296 -194
- package/lib/p5.js +296 -194
- package/lib/p5.min.js +1 -1
- package/package.json +17 -17
- package/translations/dev.js +6 -6
- package/translations/index.js +1 -1
- package/types/accessibility/color_namer.d.ts +8 -0
- package/types/accessibility/describe.d.ts +184 -0
- package/types/accessibility/gridOutput.d.ts +8 -0
- package/types/accessibility/outputs.d.ts +235 -0
- package/types/accessibility/textOutput.d.ts +8 -0
- package/types/color/color_conversion.d.ts +47 -0
- package/types/color/creating_reading.d.ts +1348 -0
- package/types/color/p5.Color.d.ts +1070 -0
- package/types/color/setting.d.ts +2085 -0
- package/types/core/constants.d.ts +341 -0
- package/types/core/environment.d.ts +668 -0
- package/types/core/friendly_errors/fes_core.d.ts +8 -0
- package/types/core/friendly_errors/file_errors.d.ts +8 -0
- package/types/core/friendly_errors/param_validator.d.ts +30 -0
- package/types/core/friendly_errors/sketch_reader.d.ts +8 -0
- package/types/core/friendly_errors/stacktrace.d.ts +11 -0
- package/types/core/friendly_errors/validate_params.d.ts +8 -0
- package/types/core/helpers.d.ts +8 -0
- package/types/core/legacy.d.ts +8 -0
- package/types/core/main.d.ts +5996 -0
- package/types/core/p5.Graphics.d.ts +484 -0
- package/types/core/p5.Renderer.d.ts +14 -0
- package/types/core/reference.d.ts +8 -0
- package/types/core/rendering.d.ts +481 -0
- package/types/core/structure.d.ts +492 -0
- package/types/core/transform.d.ts +1638 -0
- package/types/data/local_storage.d.ts +323 -0
- package/types/dom/dom.d.ts +1295 -0
- package/types/dom/p5.Element.d.ts +2011 -0
- package/types/dom/p5.File.d.ts +13 -0
- package/types/dom/p5.MediaElement.d.ts +1249 -0
- package/types/events/acceleration.d.ts +193 -0
- package/types/events/keyboard.d.ts +499 -0
- package/types/events/pointer.d.ts +782 -0
- package/types/global.d.ts +5542 -0
- package/types/image/filterRenderer2D.d.ts +54 -0
- package/types/image/image.d.ts +326 -0
- package/types/image/loading_displaying.d.ts +580 -0
- package/types/image/p5.Image.d.ts +5882 -0
- package/types/image/pixels.d.ts +832 -0
- package/types/io/files.d.ts +1447 -0
- package/types/io/p5.Table.d.ts +1247 -0
- package/types/io/p5.TableRow.d.ts +343 -0
- package/types/io/p5.XML.d.ts +1188 -0
- package/types/math/Matrices/Matrix.d.ts +1029 -0
- package/types/math/Matrices/MatrixNumjs.d.ts +8 -0
- package/types/math/calculation.d.ts +923 -0
- package/types/math/math.d.ts +90 -0
- package/types/math/noise.d.ts +311 -0
- package/types/math/p5.Matrix.d.ts +8 -0
- package/types/math/p5.Vector.d.ts +3416 -0
- package/types/math/random.d.ts +267 -0
- package/types/math/trigonometry.d.ts +663 -0
- package/types/p5.d.ts +6663 -0
- package/types/shape/2d_primitives.d.ts +1033 -0
- package/types/shape/attributes.d.ts +466 -0
- package/types/shape/curves.d.ts +740 -0
- package/types/shape/custom_shapes.d.ts +888 -0
- package/types/shape/vertex.d.ts +1141 -0
- package/types/type/p5.Font.d.ts +575 -0
- package/types/type/textCore.d.ts +1198 -0
- package/types/utilities/conversion.d.ts +894 -0
- package/types/utilities/time_date.d.ts +295 -0
- package/types/utilities/utility_functions.d.ts +587 -0
- package/types/webgl/3d_primitives.d.ts +1432 -0
- package/types/webgl/ShaderGenerator.d.ts +8 -0
- package/types/webgl/interaction.d.ts +371 -0
- package/types/webgl/light.d.ts +1184 -0
- package/types/webgl/loading.d.ts +481 -0
- package/types/webgl/material.d.ts +2656 -0
- package/types/webgl/p5.Camera.d.ts +3023 -0
- package/types/webgl/p5.DataArray.d.ts +61 -0
- package/types/webgl/p5.Framebuffer.d.ts +760 -0
- package/types/webgl/p5.Geometry.d.ts +1191 -0
- package/types/webgl/p5.Quat.d.ts +45 -0
- package/types/webgl/p5.RendererGL.d.ts +234 -0
- package/types/webgl/p5.Shader.d.ts +660 -0
- package/types/webgl/p5.Texture.d.ts +61 -0
- package/types/webgl/text.d.ts +74 -0
- package/src/README.md +0 -27
- package/src/accessibility/index.js +0 -13
- package/src/app.js +0 -61
- package/src/color/index.js +0 -9
- package/src/color/p5.Color.culori.js +0 -66
- package/src/color/p5.Color.js +0 -851
- package/src/core/README.md +0 -91
- package/src/core/friendly_errors/index.js +0 -13
- package/src/core/friendly_errors/param_validator.js +0 -561
- package/src/core/init.js +0 -58
- package/src/core/internationalization.js +0 -195
- package/src/core/legacy.js +0 -29
- package/src/core/main.js +0 -689
- package/src/core/noop.js +0 -1
- package/src/core/p5.Graphics.js +0 -696
- package/src/core/p5.Renderer.js +0 -408
- package/src/core/reference.js +0 -2060
- package/src/core/rendering.js +0 -697
- package/src/dom/index.js +0 -11
- package/src/image/const.js +0 -6
- package/src/image/image.js +0 -731
- package/src/image/index.js +0 -15
- package/src/image/loading_displaying.js +0 -1431
- package/src/io/files.js +0 -2210
- package/src/io/index.js +0 -11
- package/src/math/README.md +0 -40
- package/src/type/index.js +0 -9
- package/src/webgl/3d_primitives.js +0 -2741
- package/src/webgl/index.js +0 -37
- package/src/webgl/light.js +0 -1851
- package/src/webgl/material.js +0 -3854
- package/src/webgl/p5.Camera.js +0 -4010
- package/src/webgl/p5.Framebuffer.js +0 -1865
- package/src/webgl/p5.RendererGL.js +0 -2867
- package/src/webgl/p5.Shader.js +0 -1505
- package/src/webgl/p5.Texture.js +0 -541
- package/src/webgl/shaders/basic.frag +0 -6
- package/src/webgl/shaders/filters/base.frag +0 -22
- package/src/webgl/shaders/filters/base.vert +0 -19
- package/src/webgl/shaders/filters/blur.frag +0 -60
- package/src/webgl/shaders/filters/default.vert +0 -18
- package/src/webgl/shaders/filters/dilate.frag +0 -39
- package/src/webgl/shaders/filters/erode.frag +0 -39
- package/src/webgl/shaders/filters/gray.frag +0 -16
- package/src/webgl/shaders/filters/invert.frag +0 -15
- package/src/webgl/shaders/filters/opaque.frag +0 -12
- package/src/webgl/shaders/filters/posterize.frag +0 -29
- package/src/webgl/shaders/filters/threshold.frag +0 -23
- package/src/webgl/shaders/font.frag +0 -216
- package/src/webgl/shaders/font.vert +0 -44
- package/src/webgl/shaders/imageLight.vert +0 -33
- package/src/webgl/shaders/imageLightDiffused.frag +0 -82
- package/src/webgl/shaders/imageLightSpecular.frag +0 -134
- package/src/webgl/shaders/light.vert +0 -37
- package/src/webgl/shaders/light_texture.frag +0 -26
- package/src/webgl/shaders/lighting.glsl +0 -227
- package/src/webgl/shaders/line.frag +0 -74
- package/src/webgl/shaders/line.vert +0 -294
- package/src/webgl/shaders/normal.frag +0 -6
- package/src/webgl/shaders/normal.vert +0 -72
- package/src/webgl/shaders/phong.frag +0 -84
- package/src/webgl/shaders/phong.vert +0 -87
- package/src/webgl/shaders/point.frag +0 -29
- package/src/webgl/shaders/point.vert +0 -19
- package/src/webgl/shaders/sphereMapping.frag +0 -26
- package/src/webgl/shaders/webgl2Compatibility.glsl +0 -34
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import 'omggif';
|
|
2
|
+
import '../dom/p5.Element.js';
|
|
3
|
+
export { i as default } from '../rendering-B5TRR7aY.js';
|
|
4
|
+
import '../dom/p5.File.js';
|
|
5
|
+
import '../io/p5.XML.js';
|
|
6
|
+
import '../creating_reading-Cr8L2Jnm.js';
|
|
7
|
+
import 'colorjs.io/fn';
|
|
8
|
+
import '../color/color_spaces/hsb.js';
|
|
9
|
+
import '../constants-tYr0tCl8.js';
|
|
10
|
+
import '../p5.Renderer-Swjl9HQO.js';
|
|
11
|
+
import './filters.js';
|
|
12
|
+
import '../math/p5.Vector.js';
|
|
13
|
+
import '../shape/custom_shapes.js';
|
|
14
|
+
import '../core/States.js';
|
|
15
|
+
import '../io/utilities.js';
|
|
16
|
+
import 'file-saver';
|
|
17
|
+
import '../dom/p5.MediaElement.js';
|
|
18
|
+
import '../shape/2d_primitives.js';
|
|
19
|
+
import '../core/helpers.js';
|
|
20
|
+
import '../shape/attributes.js';
|
|
21
|
+
import '../shape/curves.js';
|
|
22
|
+
import '../shape/vertex.js';
|
|
23
|
+
import '../color/setting.js';
|
|
24
|
+
import '../io/csv.js';
|
|
25
|
+
import 'gifenc';
|
|
26
|
+
import './pixels.js';
|
|
27
|
+
import '../core/transform.js';
|
|
28
|
+
import '../webgl/GeometryBuilder.js';
|
|
29
|
+
import '../math/p5.Matrix.js';
|
|
30
|
+
import '../math/Matrices/Matrix.js';
|
|
31
|
+
import '../math/Matrices/MatrixInterface.js';
|
|
32
|
+
import '../webgl/p5.Geometry.js';
|
|
33
|
+
import '../webgl/p5.DataArray.js';
|
|
34
|
+
import '../webgl/p5.Quat.js';
|
|
35
|
+
import '../webgl/p5.RenderBuffer.js';
|
|
36
|
+
import '../webgl/ShapeBuilder.js';
|
|
37
|
+
import 'libtess';
|
|
38
|
+
import '../webgl/GeometryBufferCache.js';
|
|
39
|
+
import './const.js';
|
|
40
|
+
import '../math/trigonometry.js';
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { i as image$1, b as loadingDisplaying, s as shader, t as texture } from '../rendering-B5TRR7aY.js';
|
|
2
|
+
import { i as image$2 } from '../p5.Renderer-Swjl9HQO.js';
|
|
3
|
+
import pixels from './pixels.js';
|
|
4
|
+
import '../constants-tYr0tCl8.js';
|
|
5
|
+
import '../creating_reading-Cr8L2Jnm.js';
|
|
6
|
+
import 'colorjs.io/fn';
|
|
7
|
+
import '../color/color_spaces/hsb.js';
|
|
8
|
+
import '../dom/p5.Element.js';
|
|
9
|
+
import '../dom/p5.File.js';
|
|
10
|
+
import '../io/p5.XML.js';
|
|
11
|
+
import '../dom/p5.MediaElement.js';
|
|
12
|
+
import '../shape/2d_primitives.js';
|
|
13
|
+
import '../core/helpers.js';
|
|
14
|
+
import '../shape/attributes.js';
|
|
15
|
+
import '../shape/curves.js';
|
|
16
|
+
import '../shape/vertex.js';
|
|
17
|
+
import '../color/setting.js';
|
|
18
|
+
import 'omggif';
|
|
19
|
+
import '../io/csv.js';
|
|
20
|
+
import '../io/utilities.js';
|
|
21
|
+
import 'file-saver';
|
|
22
|
+
import 'gifenc';
|
|
23
|
+
import '../core/transform.js';
|
|
24
|
+
import '../webgl/GeometryBuilder.js';
|
|
25
|
+
import '../math/p5.Matrix.js';
|
|
26
|
+
import '../math/Matrices/Matrix.js';
|
|
27
|
+
import '../math/p5.Vector.js';
|
|
28
|
+
import '../math/Matrices/MatrixInterface.js';
|
|
29
|
+
import '../webgl/p5.Geometry.js';
|
|
30
|
+
import '../webgl/p5.DataArray.js';
|
|
31
|
+
import '../webgl/p5.Quat.js';
|
|
32
|
+
import '../webgl/p5.RenderBuffer.js';
|
|
33
|
+
import '../webgl/ShapeBuilder.js';
|
|
34
|
+
import 'libtess';
|
|
35
|
+
import '../webgl/GeometryBufferCache.js';
|
|
36
|
+
import './const.js';
|
|
37
|
+
import '../shape/custom_shapes.js';
|
|
38
|
+
import '../math/trigonometry.js';
|
|
39
|
+
import './filters.js';
|
|
40
|
+
import '../core/States.js';
|
|
41
|
+
|
|
42
|
+
function image(p5){
|
|
43
|
+
p5.registerAddon(image$1);
|
|
44
|
+
p5.registerAddon(loadingDisplaying);
|
|
45
|
+
p5.registerAddon(image$2);
|
|
46
|
+
p5.registerAddon(pixels);
|
|
47
|
+
p5.registerAddon(shader);
|
|
48
|
+
p5.registerAddon(texture);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export { image as default };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import '../core/helpers.js';
|
|
2
|
+
import '../constants-tYr0tCl8.js';
|
|
3
|
+
export { b as default } from '../rendering-B5TRR7aY.js';
|
|
4
|
+
import 'omggif';
|
|
5
|
+
import 'gifenc';
|
|
6
|
+
import '../creating_reading-Cr8L2Jnm.js';
|
|
7
|
+
import 'colorjs.io/fn';
|
|
8
|
+
import '../color/color_spaces/hsb.js';
|
|
9
|
+
import '../dom/p5.Element.js';
|
|
10
|
+
import '../dom/p5.File.js';
|
|
11
|
+
import '../io/p5.XML.js';
|
|
12
|
+
import '../p5.Renderer-Swjl9HQO.js';
|
|
13
|
+
import './filters.js';
|
|
14
|
+
import '../math/p5.Vector.js';
|
|
15
|
+
import '../shape/custom_shapes.js';
|
|
16
|
+
import '../core/States.js';
|
|
17
|
+
import '../io/utilities.js';
|
|
18
|
+
import 'file-saver';
|
|
19
|
+
import '../dom/p5.MediaElement.js';
|
|
20
|
+
import '../shape/2d_primitives.js';
|
|
21
|
+
import '../shape/attributes.js';
|
|
22
|
+
import '../shape/curves.js';
|
|
23
|
+
import '../shape/vertex.js';
|
|
24
|
+
import '../color/setting.js';
|
|
25
|
+
import '../io/csv.js';
|
|
26
|
+
import './pixels.js';
|
|
27
|
+
import '../core/transform.js';
|
|
28
|
+
import '../webgl/GeometryBuilder.js';
|
|
29
|
+
import '../math/p5.Matrix.js';
|
|
30
|
+
import '../math/Matrices/Matrix.js';
|
|
31
|
+
import '../math/Matrices/MatrixInterface.js';
|
|
32
|
+
import '../webgl/p5.Geometry.js';
|
|
33
|
+
import '../webgl/p5.DataArray.js';
|
|
34
|
+
import '../webgl/p5.Quat.js';
|
|
35
|
+
import '../webgl/p5.RenderBuffer.js';
|
|
36
|
+
import '../webgl/ShapeBuilder.js';
|
|
37
|
+
import 'libtess';
|
|
38
|
+
import '../webgl/GeometryBufferCache.js';
|
|
39
|
+
import './const.js';
|
|
40
|
+
import '../math/trigonometry.js';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import './filters.js';
|
|
2
|
+
export { I as Image, i as default } from '../p5.Renderer-Swjl9HQO.js';
|
|
3
|
+
import '../io/utilities.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 '../math/p5.Vector.js';
|
|
9
|
+
import '../shape/custom_shapes.js';
|
|
10
|
+
import '../core/States.js';
|
|
11
|
+
import 'file-saver';
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import Filters from './filters.js';
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* @module Image
|
|
3
5
|
* @submodule Pixels
|
|
@@ -5,7 +7,6 @@
|
|
|
5
7
|
* @requires core
|
|
6
8
|
*/
|
|
7
9
|
|
|
8
|
-
import Filters from './filters';
|
|
9
10
|
|
|
10
11
|
function pixels(p5, fn){
|
|
11
12
|
/**
|
|
@@ -41,6 +42,7 @@ function pixels(p5, fn){
|
|
|
41
42
|
* <code>
|
|
42
43
|
* function setup() {
|
|
43
44
|
* createCanvas(100, 100);
|
|
45
|
+
* background(128);
|
|
44
46
|
*
|
|
45
47
|
* // Load the pixels array.
|
|
46
48
|
* loadPixels();
|
|
@@ -1117,8 +1119,8 @@ function pixels(p5, fn){
|
|
|
1117
1119
|
};
|
|
1118
1120
|
}
|
|
1119
1121
|
|
|
1120
|
-
export default pixels;
|
|
1121
|
-
|
|
1122
1122
|
if(typeof p5 !== 'undefined'){
|
|
1123
1123
|
pixels(p5, p5.prototype);
|
|
1124
1124
|
}
|
|
1125
|
+
|
|
1126
|
+
export { pixels as default };
|
package/{src → dist}/io/csv.js
RENAMED
|
@@ -22,15 +22,15 @@ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
|
22
22
|
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
23
23
|
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
24
24
|
*/
|
|
25
|
-
|
|
26
|
-
const ctx = Object.create(null)
|
|
27
|
-
ctx.options = options || {}
|
|
28
|
-
ctx.reviver = reviver
|
|
29
|
-
ctx.value = ''
|
|
30
|
-
ctx.entry = []
|
|
31
|
-
ctx.output = []
|
|
32
|
-
ctx.col = 1
|
|
33
|
-
ctx.row = 1
|
|
25
|
+
function parse (csv, options, reviver = v => v) {
|
|
26
|
+
const ctx = Object.create(null);
|
|
27
|
+
ctx.options = options || {};
|
|
28
|
+
ctx.reviver = reviver;
|
|
29
|
+
ctx.value = '';
|
|
30
|
+
ctx.entry = [];
|
|
31
|
+
ctx.output = [];
|
|
32
|
+
ctx.col = 1;
|
|
33
|
+
ctx.row = 1;
|
|
34
34
|
|
|
35
35
|
ctx.options.delimiter = ctx.options.delimiter === undefined ? '"' : options.delimiter;
|
|
36
36
|
if(ctx.options.delimiter.length > 1 || ctx.options.delimiter.length === 0)
|
|
@@ -40,78 +40,78 @@ export function parse (csv, options, reviver = v => v) {
|
|
|
40
40
|
if(ctx.options.separator.length > 1 || ctx.options.separator.length === 0)
|
|
41
41
|
throw Error(`CSVError: separator must be one character [${ctx.options.separator}]`)
|
|
42
42
|
|
|
43
|
-
const lexer = new RegExp(`${escapeRegExp(ctx.options.delimiter)}|${escapeRegExp(ctx.options.separator)}|\r\n|\n|\r|[^${escapeRegExp(ctx.options.delimiter)}${escapeRegExp(ctx.options.separator)}\r\n]+`, 'y')
|
|
44
|
-
const isNewline = /^(\r\n|\n|\r)
|
|
43
|
+
const lexer = new RegExp(`${escapeRegExp(ctx.options.delimiter)}|${escapeRegExp(ctx.options.separator)}|\r\n|\n|\r|[^${escapeRegExp(ctx.options.delimiter)}${escapeRegExp(ctx.options.separator)}\r\n]+`, 'y');
|
|
44
|
+
const isNewline = /^(\r\n|\n|\r)$/;
|
|
45
45
|
|
|
46
|
-
let matches = []
|
|
47
|
-
let match = ''
|
|
48
|
-
let state = 0
|
|
46
|
+
let matches = [];
|
|
47
|
+
let match = '';
|
|
48
|
+
let state = 0;
|
|
49
49
|
|
|
50
50
|
while ((matches = lexer.exec(csv)) !== null) {
|
|
51
|
-
match = matches[0]
|
|
51
|
+
match = matches[0];
|
|
52
52
|
|
|
53
53
|
switch (state) {
|
|
54
54
|
case 0: // start of entry
|
|
55
55
|
switch (true) {
|
|
56
56
|
case match === ctx.options.delimiter:
|
|
57
|
-
state = 3
|
|
57
|
+
state = 3;
|
|
58
58
|
break
|
|
59
59
|
case match === ctx.options.separator:
|
|
60
|
-
state = 0
|
|
61
|
-
valueEnd(ctx)
|
|
60
|
+
state = 0;
|
|
61
|
+
valueEnd(ctx);
|
|
62
62
|
break
|
|
63
63
|
case isNewline.test(match):
|
|
64
|
-
state = 0
|
|
65
|
-
valueEnd(ctx)
|
|
66
|
-
entryEnd(ctx)
|
|
64
|
+
state = 0;
|
|
65
|
+
valueEnd(ctx);
|
|
66
|
+
entryEnd(ctx);
|
|
67
67
|
break
|
|
68
68
|
default:
|
|
69
|
-
ctx.value += match
|
|
70
|
-
state = 2
|
|
69
|
+
ctx.value += match;
|
|
70
|
+
state = 2;
|
|
71
71
|
break
|
|
72
72
|
}
|
|
73
73
|
break
|
|
74
74
|
case 2: // un-delimited input
|
|
75
75
|
switch (true) {
|
|
76
76
|
case match === ctx.options.separator:
|
|
77
|
-
state = 0
|
|
78
|
-
valueEnd(ctx)
|
|
77
|
+
state = 0;
|
|
78
|
+
valueEnd(ctx);
|
|
79
79
|
break
|
|
80
80
|
case isNewline.test(match):
|
|
81
|
-
state = 0
|
|
82
|
-
valueEnd(ctx)
|
|
83
|
-
entryEnd(ctx)
|
|
81
|
+
state = 0;
|
|
82
|
+
valueEnd(ctx);
|
|
83
|
+
entryEnd(ctx);
|
|
84
84
|
break
|
|
85
85
|
default:
|
|
86
|
-
state = 4
|
|
86
|
+
state = 4;
|
|
87
87
|
throw Error(`CSVError: Illegal state [row:${ctx.row}, col:${ctx.col}]`)
|
|
88
88
|
}
|
|
89
89
|
break
|
|
90
90
|
case 3: // delimited input
|
|
91
91
|
switch (true) {
|
|
92
92
|
case match === ctx.options.delimiter:
|
|
93
|
-
state = 4
|
|
93
|
+
state = 4;
|
|
94
94
|
break
|
|
95
95
|
default:
|
|
96
|
-
state = 3
|
|
97
|
-
ctx.value += match
|
|
96
|
+
state = 3;
|
|
97
|
+
ctx.value += match;
|
|
98
98
|
break
|
|
99
99
|
}
|
|
100
100
|
break
|
|
101
101
|
case 4: // escaped or closing delimiter
|
|
102
102
|
switch (true) {
|
|
103
103
|
case match === ctx.options.delimiter:
|
|
104
|
-
state = 3
|
|
105
|
-
ctx.value += match
|
|
104
|
+
state = 3;
|
|
105
|
+
ctx.value += match;
|
|
106
106
|
break
|
|
107
107
|
case match === ctx.options.separator:
|
|
108
|
-
state = 0
|
|
109
|
-
valueEnd(ctx)
|
|
108
|
+
state = 0;
|
|
109
|
+
valueEnd(ctx);
|
|
110
110
|
break
|
|
111
111
|
case isNewline.test(match):
|
|
112
|
-
state = 0
|
|
113
|
-
valueEnd(ctx)
|
|
114
|
-
entryEnd(ctx)
|
|
112
|
+
state = 0;
|
|
113
|
+
valueEnd(ctx);
|
|
114
|
+
entryEnd(ctx);
|
|
115
115
|
break
|
|
116
116
|
default:
|
|
117
117
|
throw Error(`CSVError: Illegal state [row:${ctx.row}, col:${ctx.col}]`)
|
|
@@ -122,20 +122,20 @@ export function parse (csv, options, reviver = v => v) {
|
|
|
122
122
|
|
|
123
123
|
// flush the last value
|
|
124
124
|
if (ctx.entry.length !== 0) {
|
|
125
|
-
valueEnd(ctx)
|
|
126
|
-
entryEnd(ctx)
|
|
125
|
+
valueEnd(ctx);
|
|
126
|
+
entryEnd(ctx);
|
|
127
127
|
}
|
|
128
128
|
|
|
129
129
|
return ctx.output
|
|
130
130
|
}
|
|
131
131
|
|
|
132
|
-
|
|
133
|
-
const ctx = Object.create(null)
|
|
134
|
-
ctx.options = options
|
|
135
|
-
ctx.options.eof = ctx.options.eof !== undefined ? ctx.options.eof : true
|
|
136
|
-
ctx.row = 1
|
|
137
|
-
ctx.col = 1
|
|
138
|
-
ctx.output = ''
|
|
132
|
+
function stringify (array, options = {}, replacer = v => v) {
|
|
133
|
+
const ctx = Object.create(null);
|
|
134
|
+
ctx.options = options;
|
|
135
|
+
ctx.options.eof = ctx.options.eof !== undefined ? ctx.options.eof : true;
|
|
136
|
+
ctx.row = 1;
|
|
137
|
+
ctx.col = 1;
|
|
138
|
+
ctx.output = '';
|
|
139
139
|
|
|
140
140
|
ctx.options.delimiter = ctx.options.delimiter === undefined ? '"' : options.delimiter;
|
|
141
141
|
if(ctx.options.delimiter.length > 1 || ctx.options.delimiter.length === 0)
|
|
@@ -145,53 +145,53 @@ export function stringify (array, options = {}, replacer = v => v) {
|
|
|
145
145
|
if(ctx.options.separator.length > 1 || ctx.options.separator.length === 0)
|
|
146
146
|
throw Error(`CSVError: separator must be one character [${ctx.options.separator}]`)
|
|
147
147
|
|
|
148
|
-
const needsDelimiters = new RegExp(`${escapeRegExp(ctx.options.delimiter)}|${escapeRegExp(ctx.options.separator)}|\r\n|\n|\r`)
|
|
148
|
+
const needsDelimiters = new RegExp(`${escapeRegExp(ctx.options.delimiter)}|${escapeRegExp(ctx.options.separator)}|\r\n|\n|\r`);
|
|
149
149
|
|
|
150
150
|
array.forEach((row, rIdx) => {
|
|
151
|
-
let entry = ''
|
|
152
|
-
ctx.col = 1
|
|
151
|
+
let entry = '';
|
|
152
|
+
ctx.col = 1;
|
|
153
153
|
row.forEach((col, cIdx) => {
|
|
154
154
|
if (typeof col === 'string') {
|
|
155
|
-
col = col.replace(new RegExp(ctx.options.delimiter, 'g'), `${ctx.options.delimiter}${ctx.options.delimiter}`)
|
|
156
|
-
col = needsDelimiters.test(col) ? `${ctx.options.delimiter}${col}${ctx.options.delimiter}` : col
|
|
155
|
+
col = col.replace(new RegExp(ctx.options.delimiter, 'g'), `${ctx.options.delimiter}${ctx.options.delimiter}`);
|
|
156
|
+
col = needsDelimiters.test(col) ? `${ctx.options.delimiter}${col}${ctx.options.delimiter}` : col;
|
|
157
157
|
}
|
|
158
|
-
entry += replacer(col, ctx.row, ctx.col)
|
|
158
|
+
entry += replacer(col, ctx.row, ctx.col);
|
|
159
159
|
if (cIdx !== row.length - 1) {
|
|
160
|
-
entry += ctx.options.separator
|
|
160
|
+
entry += ctx.options.separator;
|
|
161
161
|
}
|
|
162
|
-
ctx.col
|
|
163
|
-
})
|
|
162
|
+
ctx.col++;
|
|
163
|
+
});
|
|
164
164
|
switch (true) {
|
|
165
165
|
case ctx.options.eof:
|
|
166
166
|
case !ctx.options.eof && rIdx !== array.length - 1:
|
|
167
|
-
ctx.output += `${entry}\n
|
|
167
|
+
ctx.output += `${entry}\n`;
|
|
168
168
|
break
|
|
169
169
|
default:
|
|
170
|
-
ctx.output += `${entry}
|
|
170
|
+
ctx.output += `${entry}`;
|
|
171
171
|
break
|
|
172
172
|
}
|
|
173
|
-
ctx.row
|
|
174
|
-
})
|
|
173
|
+
ctx.row++;
|
|
174
|
+
});
|
|
175
175
|
|
|
176
176
|
return ctx.output
|
|
177
177
|
}
|
|
178
178
|
|
|
179
179
|
function valueEnd (ctx) {
|
|
180
|
-
const value = ctx.options.typed ? inferType(ctx.value) : ctx.value
|
|
181
|
-
ctx.entry.push(ctx.reviver(value, ctx.row, ctx.col))
|
|
182
|
-
ctx.value = ''
|
|
183
|
-
ctx.col
|
|
180
|
+
const value = ctx.options.typed ? inferType(ctx.value) : ctx.value;
|
|
181
|
+
ctx.entry.push(ctx.reviver(value, ctx.row, ctx.col));
|
|
182
|
+
ctx.value = '';
|
|
183
|
+
ctx.col++;
|
|
184
184
|
}
|
|
185
185
|
|
|
186
186
|
function entryEnd (ctx) {
|
|
187
|
-
ctx.output.push(ctx.entry)
|
|
188
|
-
ctx.entry = []
|
|
189
|
-
ctx.row
|
|
190
|
-
ctx.col = 1
|
|
187
|
+
ctx.output.push(ctx.entry);
|
|
188
|
+
ctx.entry = [];
|
|
189
|
+
ctx.row++;
|
|
190
|
+
ctx.col = 1;
|
|
191
191
|
}
|
|
192
192
|
|
|
193
193
|
function inferType (value) {
|
|
194
|
-
const isNumber =
|
|
194
|
+
const isNumber = /.\./;
|
|
195
195
|
|
|
196
196
|
switch (true) {
|
|
197
197
|
case value === 'true':
|
|
@@ -209,3 +209,5 @@ function inferType (value) {
|
|
|
209
209
|
function escapeRegExp(str) {
|
|
210
210
|
return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
|
|
211
211
|
}
|
|
212
|
+
|
|
213
|
+
export { parse, stringify };
|
package/dist/io/files.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import '../p5.Renderer-Swjl9HQO.js';
|
|
2
|
+
export { d as default, a as request } from '../rendering-B5TRR7aY.js';
|
|
3
|
+
import './csv.js';
|
|
4
|
+
import './utilities.js';
|
|
5
|
+
import '../creating_reading-Cr8L2Jnm.js';
|
|
6
|
+
import 'colorjs.io/fn';
|
|
7
|
+
import '../color/color_spaces/hsb.js';
|
|
8
|
+
import '../constants-tYr0tCl8.js';
|
|
9
|
+
import '../image/filters.js';
|
|
10
|
+
import '../math/p5.Vector.js';
|
|
11
|
+
import '../shape/custom_shapes.js';
|
|
12
|
+
import '../core/States.js';
|
|
13
|
+
import '../dom/p5.Element.js';
|
|
14
|
+
import '../dom/p5.File.js';
|
|
15
|
+
import './p5.XML.js';
|
|
16
|
+
import '../dom/p5.MediaElement.js';
|
|
17
|
+
import '../shape/2d_primitives.js';
|
|
18
|
+
import '../core/helpers.js';
|
|
19
|
+
import '../shape/attributes.js';
|
|
20
|
+
import '../shape/curves.js';
|
|
21
|
+
import '../shape/vertex.js';
|
|
22
|
+
import '../color/setting.js';
|
|
23
|
+
import 'omggif';
|
|
24
|
+
import 'gifenc';
|
|
25
|
+
import '../image/pixels.js';
|
|
26
|
+
import '../core/transform.js';
|
|
27
|
+
import '../webgl/GeometryBuilder.js';
|
|
28
|
+
import '../math/p5.Matrix.js';
|
|
29
|
+
import '../math/Matrices/Matrix.js';
|
|
30
|
+
import '../math/Matrices/MatrixInterface.js';
|
|
31
|
+
import '../webgl/p5.Geometry.js';
|
|
32
|
+
import '../webgl/p5.DataArray.js';
|
|
33
|
+
import '../webgl/p5.Quat.js';
|
|
34
|
+
import '../webgl/p5.RenderBuffer.js';
|
|
35
|
+
import '../webgl/ShapeBuilder.js';
|
|
36
|
+
import 'libtess';
|
|
37
|
+
import '../webgl/GeometryBufferCache.js';
|
|
38
|
+
import '../image/const.js';
|
|
39
|
+
import '../math/trigonometry.js';
|
|
40
|
+
import 'file-saver';
|
package/dist/io/index.js
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { d as files } from '../rendering-B5TRR7aY.js';
|
|
2
|
+
import table from './p5.Table.js';
|
|
3
|
+
import tableRow from './p5.TableRow.js';
|
|
4
|
+
import xml from './p5.XML.js';
|
|
5
|
+
import '../constants-tYr0tCl8.js';
|
|
6
|
+
import '../creating_reading-Cr8L2Jnm.js';
|
|
7
|
+
import 'colorjs.io/fn';
|
|
8
|
+
import '../color/color_spaces/hsb.js';
|
|
9
|
+
import '../dom/p5.Element.js';
|
|
10
|
+
import '../dom/p5.File.js';
|
|
11
|
+
import '../p5.Renderer-Swjl9HQO.js';
|
|
12
|
+
import '../image/filters.js';
|
|
13
|
+
import '../math/p5.Vector.js';
|
|
14
|
+
import '../shape/custom_shapes.js';
|
|
15
|
+
import '../core/States.js';
|
|
16
|
+
import './utilities.js';
|
|
17
|
+
import 'file-saver';
|
|
18
|
+
import '../dom/p5.MediaElement.js';
|
|
19
|
+
import '../shape/2d_primitives.js';
|
|
20
|
+
import '../core/helpers.js';
|
|
21
|
+
import '../shape/attributes.js';
|
|
22
|
+
import '../shape/curves.js';
|
|
23
|
+
import '../shape/vertex.js';
|
|
24
|
+
import '../color/setting.js';
|
|
25
|
+
import 'omggif';
|
|
26
|
+
import './csv.js';
|
|
27
|
+
import 'gifenc';
|
|
28
|
+
import '../image/pixels.js';
|
|
29
|
+
import '../core/transform.js';
|
|
30
|
+
import '../webgl/GeometryBuilder.js';
|
|
31
|
+
import '../math/p5.Matrix.js';
|
|
32
|
+
import '../math/Matrices/Matrix.js';
|
|
33
|
+
import '../math/Matrices/MatrixInterface.js';
|
|
34
|
+
import '../webgl/p5.Geometry.js';
|
|
35
|
+
import '../webgl/p5.DataArray.js';
|
|
36
|
+
import '../webgl/p5.Quat.js';
|
|
37
|
+
import '../webgl/p5.RenderBuffer.js';
|
|
38
|
+
import '../webgl/ShapeBuilder.js';
|
|
39
|
+
import 'libtess';
|
|
40
|
+
import '../webgl/GeometryBufferCache.js';
|
|
41
|
+
import '../image/const.js';
|
|
42
|
+
import '../math/trigonometry.js';
|
|
43
|
+
|
|
44
|
+
function io(p5){
|
|
45
|
+
p5.registerAddon(files);
|
|
46
|
+
p5.registerAddon(table);
|
|
47
|
+
p5.registerAddon(tableRow);
|
|
48
|
+
p5.registerAddon(xml);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export { io as default };
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import { stringify } from './csv.js';
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* @module IO
|
|
3
5
|
* @submodule Table
|
|
4
6
|
* @requires core
|
|
5
7
|
*/
|
|
6
8
|
|
|
7
|
-
import { stringify } from './csv';
|
|
8
9
|
|
|
9
10
|
class Table {
|
|
10
11
|
constructor(rows) {
|
|
@@ -16,7 +17,7 @@ class Table {
|
|
|
16
17
|
let rows = this.rows.map((row) => row.arr);
|
|
17
18
|
|
|
18
19
|
if(!this.columns.some((column) => column === null)){
|
|
19
|
-
rows = [this.columns, ...rows,]
|
|
20
|
+
rows = [this.columns, ...rows,];
|
|
20
21
|
}
|
|
21
22
|
|
|
22
23
|
return stringify(rows, {
|
|
@@ -1321,8 +1322,7 @@ class Table {
|
|
|
1321
1322
|
}
|
|
1322
1323
|
return tableArray;
|
|
1323
1324
|
}
|
|
1324
|
-
}
|
|
1325
|
-
|
|
1325
|
+
}
|
|
1326
1326
|
function table(p5, fn){
|
|
1327
1327
|
/**
|
|
1328
1328
|
* Table Options
|
|
@@ -1403,8 +1403,8 @@ function table(p5, fn){
|
|
|
1403
1403
|
*/
|
|
1404
1404
|
}
|
|
1405
1405
|
|
|
1406
|
-
export default table;
|
|
1407
|
-
|
|
1408
1406
|
if(typeof p5 !== 'undefined'){
|
|
1409
1407
|
table(p5, p5.prototype);
|
|
1410
1408
|
}
|
|
1409
|
+
|
|
1410
|
+
export { table as default };
|
|
@@ -255,8 +255,8 @@ class TableRow {
|
|
|
255
255
|
* let table;
|
|
256
256
|
*
|
|
257
257
|
* async function setup() {
|
|
258
|
-
* // Create a
|
|
259
|
-
* createCanvas(
|
|
258
|
+
* // Create a 300x100 canvas and set a white background
|
|
259
|
+
* createCanvas(300, 100);
|
|
260
260
|
* background(255);
|
|
261
261
|
*
|
|
262
262
|
* // Load the CSV file with a header row
|
|
@@ -349,8 +349,7 @@ class TableRow {
|
|
|
349
349
|
return this.arr[column].toString();
|
|
350
350
|
}
|
|
351
351
|
}
|
|
352
|
-
}
|
|
353
|
-
|
|
352
|
+
}
|
|
354
353
|
function tableRow(p5, fn){
|
|
355
354
|
/**
|
|
356
355
|
* A TableRow object represents a single row of data values,
|
|
@@ -368,8 +367,8 @@ function tableRow(p5, fn){
|
|
|
368
367
|
p5.TableRow = TableRow;
|
|
369
368
|
}
|
|
370
369
|
|
|
371
|
-
export default tableRow;
|
|
372
|
-
|
|
373
370
|
if(typeof p5 !== 'undefined'){
|
|
374
371
|
tableRow(p5, p5.prototype);
|
|
375
372
|
}
|
|
373
|
+
|
|
374
|
+
export { tableRow as default };
|
|
@@ -507,8 +507,6 @@ class XML {
|
|
|
507
507
|
addChild(node) {
|
|
508
508
|
if (node instanceof XML) {
|
|
509
509
|
this.DOM.appendChild(node.DOM);
|
|
510
|
-
} else {
|
|
511
|
-
// PEND
|
|
512
510
|
}
|
|
513
511
|
}
|
|
514
512
|
|
|
@@ -1290,9 +1288,8 @@ function xml(p5, fn){
|
|
|
1290
1288
|
p5.XML = XML;
|
|
1291
1289
|
}
|
|
1292
1290
|
|
|
1293
|
-
export default xml;
|
|
1294
|
-
export { XML }
|
|
1295
|
-
|
|
1296
1291
|
if(typeof p5 !== 'undefined'){
|
|
1297
1292
|
xml(p5, p5.prototype);
|
|
1298
1293
|
}
|
|
1294
|
+
|
|
1295
|
+
export { XML, xml as default };
|