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 @@
|
|
|
1
|
+
export { ai as ADD, aL as ALT, b as ARROW, w as AUTO, A as AXES, aM as BACKSPACE, an as BASELINE, B as BEVEL, b5 as BEZIER, u as BLEND, $ as BLUR, a_ as BOLD, a$ as BOLDITALIC, ar as BOTTOM, ah as BURN, C as CENTER, b0 as CHAR, ak as CHORD, at as CLAMP, n as CLOSE, aq as CONTAIN, aN as CONTROL, e as CORNER, i as CORNERS, ap as COVER, c as CROSS, b6 as CURVE, a6 as DARKEST, D as DEG_TO_RAD, aO as DELETE, a8 as DIFFERENCE, V as DILATE, ag as DODGE, aP as DOWN_ARROW, E as EMPTY_PATH, aQ as ENTER, Y as ERODE, aR as ESCAPE, t as EXCLUDE, aa as EXCLUSION, bc as FALLBACK, as as FILL, F as FLAT, aB as FLOAT, ax as FULL, X as GRAY, G as GRID, aD as HALF_FLOAT, g as HALF_PI, H as HAND, ae as HARD_LIGHT, a1 as IMAGE, b8 as IMMEDIATE, I as INCLUDE, _ as INVERT, aZ as ITALIC, J as JOIN, bb as LABEL, b9 as LANDSCAPE, ao as LEFT, aS as LEFT_ARROW, a7 as LIGHTEST, aC as LINEAR, L as LINES, aJ as LINE_LOOP, aI as LINE_STRIP, aA as MIRROR, l as MITER, M as MOVE, a9 as MULTIPLY, ay as NEAREST, N as NORMAL, K as OPAQUE, O as OPEN, aT as OPTION, ad as OVERLAY, P as P2D, aE as P2DHDR, m as PATH, h as PI, aj as PIE, o as POINTS, ba as PORTRAIT, U as POSTERIZE, k as PROJECT, b4 as QUADRATIC, Q as QUADS, s as QUAD_STRIP, aF as QUARTER_PI, a as RADIUS, x as RAD_TO_DEG, a4 as REMOVE, az as REPEAT, ac as REPLACE, aU as RETURN, R as RIGHT, aV as RIGHT_ARROW, j as ROUND, ab as SCREEN, aW as SHIFT, aw as SIMPLE, y as SMOOTH, af as SOFT_LIGHT, S as SQUARE, b7 as STROKE, a5 as SUBTRACT, aX as TAB, aG as TAU, aK as TESS, d as TEXT, T as TEXTURE, Z as THRESHOLD, aH as TOP, p as TRIANGLES, q as TRIANGLE_FAN, r as TRIANGLE_STRIP, f as TWO_PI, av as UNSIGNED_BYTE, au as UNSIGNED_INT, aY as UP_ARROW, al as VERSION, W as WAIT, a0 as WEBGL, z as WEBGL2, am as WORD, b3 as _CTX_MIDDLE, a2 as _DEFAULT_FILL, b2 as _DEFAULT_LEADMULT, a3 as _DEFAULT_STROKE, b1 as _DEFAULT_TEXT_FILL } from '../constants-tYr0tCl8.js';
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { b as ARROW, c as CROSS, H as HAND, M as MOVE, d as TEXT, W as WAIT, P as P2D } from '../constants-tYr0tCl8.js';
|
|
2
|
+
import '../math/p5.Vector.js';
|
|
3
|
+
|
|
1
4
|
/**
|
|
2
5
|
* @module Environment
|
|
3
6
|
* @submodule Environment
|
|
@@ -6,11 +9,9 @@
|
|
|
6
9
|
* @requires constants
|
|
7
10
|
*/
|
|
8
11
|
|
|
9
|
-
import * as C from './constants';
|
|
10
|
-
import { Vector } from '../math/p5.Vector';
|
|
11
12
|
|
|
12
13
|
function environment(p5, fn){
|
|
13
|
-
const standardCursors = [
|
|
14
|
+
const standardCursors = [ARROW, CROSS, HAND, MOVE, TEXT, WAIT];
|
|
14
15
|
|
|
15
16
|
fn._frameRate = 0;
|
|
16
17
|
fn._lastFrameTime = window.performance.now();
|
|
@@ -31,8 +32,8 @@ function environment(p5, fn){
|
|
|
31
32
|
* @method print
|
|
32
33
|
* @param {Any} contents content to print to the console.
|
|
33
34
|
* @example
|
|
34
|
-
* <div>
|
|
35
|
-
* <code
|
|
35
|
+
* <div class="norender">
|
|
36
|
+
* <code>
|
|
36
37
|
* function setup() {
|
|
37
38
|
* // Prints "hello, world" to the console.
|
|
38
39
|
* print('hello, world');
|
|
@@ -40,8 +41,8 @@ function environment(p5, fn){
|
|
|
40
41
|
* </code>
|
|
41
42
|
* </div>
|
|
42
43
|
*
|
|
43
|
-
* <div>
|
|
44
|
-
* <code
|
|
44
|
+
* <div class="norender">
|
|
45
|
+
* <code>
|
|
45
46
|
* function setup() {
|
|
46
47
|
* let name = 'ada';
|
|
47
48
|
* // Prints "hello, ada" to the console.
|
|
@@ -514,6 +515,7 @@ function environment(p5, fn){
|
|
|
514
515
|
* - `WEBGL2` whose value is `'webgl2'`,
|
|
515
516
|
* - `WEBGL` whose value is `'webgl'`, or
|
|
516
517
|
* - `P2D` whose value is `'p2d'`. This is the default for 2D sketches.
|
|
518
|
+
* - `P2DHDR` whose value is `'p2d-hdr'` (used for HDR 2D sketches, if available).
|
|
517
519
|
*
|
|
518
520
|
* See <a href="#/p5/setAttributes">setAttributes()</a> for ways to set the
|
|
519
521
|
* WebGL version.
|
|
@@ -582,7 +584,7 @@ function environment(p5, fn){
|
|
|
582
584
|
* </code>
|
|
583
585
|
* </div>
|
|
584
586
|
*/
|
|
585
|
-
fn.webglVersion =
|
|
587
|
+
fn.webglVersion = P2D;
|
|
586
588
|
|
|
587
589
|
/**
|
|
588
590
|
* A `Number` variable that stores the width of the screen display.
|
|
@@ -1456,8 +1458,8 @@ function environment(p5, fn){
|
|
|
1456
1458
|
};
|
|
1457
1459
|
}
|
|
1458
1460
|
|
|
1459
|
-
export default environment;
|
|
1460
|
-
|
|
1461
1461
|
if(typeof p5 !== 'undefined'){
|
|
1462
1462
|
environment(p5, p5.prototype);
|
|
1463
1463
|
}
|
|
1464
|
+
|
|
1465
|
+
export { environment as default };
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
import { translator } from '../internationalization.js';
|
|
2
|
+
import strings from './browser_errors.js';
|
|
3
|
+
import { v as constants } from '../../constants-tYr0tCl8.js';
|
|
4
|
+
import 'i18next';
|
|
5
|
+
import 'i18next-browser-languagedetector';
|
|
6
|
+
|
|
1
7
|
/**
|
|
2
8
|
* @for p5
|
|
3
9
|
* @requires core
|
|
@@ -22,9 +28,6 @@
|
|
|
22
28
|
* sequence of each function, please look at the FES Reference + Dev Notes:
|
|
23
29
|
* https://github.com/processing/p5.js/blob/main/contributor_docs/fes_reference_dev_notes.md
|
|
24
30
|
*/
|
|
25
|
-
import { translator } from '../internationalization';
|
|
26
|
-
import errorTable from './browser_errors';
|
|
27
|
-
import * as contants from '../constants';
|
|
28
31
|
|
|
29
32
|
function fesCore(p5, fn){
|
|
30
33
|
// p5.js blue, p5.js orange, auto dark green; fallback p5.js darkened magenta
|
|
@@ -37,20 +40,15 @@ function fesCore(p5, fn){
|
|
|
37
40
|
// used in misspelling detection
|
|
38
41
|
const EDIT_DIST_THRESHOLD = 2;
|
|
39
42
|
|
|
40
|
-
// to enable or disable styling (color, font-size, etc. ) for fes messages
|
|
41
|
-
const ENABLE_FES_STYLING = false;
|
|
42
|
-
|
|
43
43
|
// Used for internally thrown errors that should not get wrapped by another
|
|
44
44
|
// friendly error handler
|
|
45
|
-
class FESError extends Error {}
|
|
46
|
-
|
|
45
|
+
class FESError extends Error {}
|
|
47
46
|
if (typeof IS_MINIFIED !== 'undefined') {
|
|
48
47
|
p5._friendlyError =
|
|
49
48
|
p5._checkForUserDefinedFunctions =
|
|
50
49
|
p5._fesErrorMonitor =
|
|
51
50
|
() => {};
|
|
52
51
|
} else {
|
|
53
|
-
let doFriendlyWelcome = false; // TEMP until we get it all working LM
|
|
54
52
|
|
|
55
53
|
// const errorTable = require('./browser_errors').default;
|
|
56
54
|
|
|
@@ -105,26 +103,6 @@ function fesCore(p5, fn){
|
|
|
105
103
|
'windowResized'
|
|
106
104
|
];
|
|
107
105
|
|
|
108
|
-
const friendlyWelcome = () => {
|
|
109
|
-
// p5.js brand - magenta: #ED225D
|
|
110
|
-
//const astrixBgColor = 'transparent';
|
|
111
|
-
//const astrixTxtColor = '#ED225D';
|
|
112
|
-
//const welcomeBgColor = '#ED225D';
|
|
113
|
-
//const welcomeTextColor = 'white';
|
|
114
|
-
const welcomeMessage = translator('fes.pre', {
|
|
115
|
-
message: translator('fes.welcome')
|
|
116
|
-
});
|
|
117
|
-
console.log(
|
|
118
|
-
' _ \n' +
|
|
119
|
-
' /\\| |/\\ \n' +
|
|
120
|
-
" \\ ` ' / \n" +
|
|
121
|
-
' / , . \\ \n' +
|
|
122
|
-
' \\/|_|\\/ ' +
|
|
123
|
-
'\n\n' +
|
|
124
|
-
welcomeMessage
|
|
125
|
-
);
|
|
126
|
-
};
|
|
127
|
-
|
|
128
106
|
/**
|
|
129
107
|
* Takes a message and a p5 function func, and adds a link pointing to
|
|
130
108
|
* the reference documentation of func at the end of the message
|
|
@@ -173,11 +151,6 @@ function fesCore(p5, fn){
|
|
|
173
151
|
// instead of console.log
|
|
174
152
|
const log =
|
|
175
153
|
p5._fesLogger == null ? console.log.bind(console) : p5._fesLogger;
|
|
176
|
-
|
|
177
|
-
if (doFriendlyWelcome) {
|
|
178
|
-
friendlyWelcome();
|
|
179
|
-
doFriendlyWelcome = false;
|
|
180
|
-
}
|
|
181
154
|
if ('undefined' === getType(color)) {
|
|
182
155
|
color = '#B40033'; // dark magenta
|
|
183
156
|
} else if (getType(color) === 'number') {
|
|
@@ -187,12 +160,9 @@ function fesCore(p5, fn){
|
|
|
187
160
|
|
|
188
161
|
// Add a link to the reference docs of func at the end of the message
|
|
189
162
|
message = mapToReference(message, func);
|
|
190
|
-
let style = [`color: ${color}`, 'font-family: Arial', 'font-size: larger'];
|
|
191
163
|
const prefixedMsg = translator('fes.pre', { message });
|
|
192
164
|
|
|
193
|
-
|
|
194
|
-
log('%c' + prefixedMsg, style.join(';'));
|
|
195
|
-
} else {
|
|
165
|
+
{
|
|
196
166
|
log(prefixedMsg);
|
|
197
167
|
}
|
|
198
168
|
};
|
|
@@ -309,7 +279,7 @@ function fesCore(p5, fn){
|
|
|
309
279
|
*/
|
|
310
280
|
p5.isPreloadSupported = function() {
|
|
311
281
|
return false;
|
|
312
|
-
}
|
|
282
|
+
};
|
|
313
283
|
|
|
314
284
|
/**
|
|
315
285
|
* Checks capitalization for user defined functions.
|
|
@@ -348,7 +318,7 @@ function fesCore(p5, fn){
|
|
|
348
318
|
// actual name with correct capitalization doesnt exist in context,
|
|
349
319
|
// and if the user-defined symbol is of the type function
|
|
350
320
|
if (
|
|
351
|
-
fxns
|
|
321
|
+
fxns.hasOwnProperty(lowercase) &&
|
|
352
322
|
!context[fxns[lowercase]] &&
|
|
353
323
|
typeof context[prop] === 'function'
|
|
354
324
|
) {
|
|
@@ -697,7 +667,7 @@ function fesCore(p5, fn){
|
|
|
697
667
|
return;
|
|
698
668
|
}
|
|
699
669
|
|
|
700
|
-
const errList =
|
|
670
|
+
const errList = strings[error.name];
|
|
701
671
|
if (!errList) return; // this type of error can't be handled yet
|
|
702
672
|
let matchedError;
|
|
703
673
|
for (const obj of errList) {
|
|
@@ -1052,7 +1022,7 @@ function fesCore(p5, fn){
|
|
|
1052
1022
|
// At present, p5 only adds its constants to fn during
|
|
1053
1023
|
// construction, which may not have happened at the time a
|
|
1054
1024
|
// ReferenceError is thrown, so we'll manually add them to our list.
|
|
1055
|
-
getSymbols(
|
|
1025
|
+
getSymbols(constants)
|
|
1056
1026
|
);
|
|
1057
1027
|
|
|
1058
1028
|
// This will ultimately ensure that we report the most specific error
|
|
@@ -1146,8 +1116,8 @@ function fesCore(p5, fn){
|
|
|
1146
1116
|
}
|
|
1147
1117
|
}
|
|
1148
1118
|
|
|
1149
|
-
export default fesCore;
|
|
1150
|
-
|
|
1151
1119
|
if (typeof p5 !== 'undefined') {
|
|
1152
1120
|
fesCore(p5, p5.prototype);
|
|
1153
1121
|
}
|
|
1122
|
+
|
|
1123
|
+
export { fesCore as default };
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
+
import { translator } from '../internationalization.js';
|
|
2
|
+
import 'i18next';
|
|
3
|
+
import 'i18next-browser-languagedetector';
|
|
4
|
+
|
|
1
5
|
/**
|
|
2
6
|
* @for p5
|
|
3
7
|
* @requires core
|
|
4
8
|
*/
|
|
5
|
-
import { translator } from '../internationalization';
|
|
6
9
|
|
|
7
10
|
function fileErrors(p5, fn){
|
|
8
11
|
// mapping used by `_friendlyFileLoadError`
|
|
@@ -91,8 +94,8 @@ function fileErrors(p5, fn){
|
|
|
91
94
|
};
|
|
92
95
|
}
|
|
93
96
|
|
|
94
|
-
export default fileErrors;
|
|
95
|
-
|
|
96
97
|
if (typeof p5 !== 'undefined') {
|
|
97
98
|
fileErrors(p5, p5.prototype);
|
|
98
99
|
}
|
|
100
|
+
|
|
101
|
+
export { fileErrors as default };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import fesCore from './fes_core.js';
|
|
2
|
+
import stacktrace from './stacktrace.js';
|
|
3
|
+
import validateParams from './param_validator.js';
|
|
4
|
+
import sketchVerifier from './sketch_verifier.js';
|
|
5
|
+
import fileErrors from './file_errors.js';
|
|
6
|
+
import '../internationalization.js';
|
|
7
|
+
import 'i18next';
|
|
8
|
+
import 'i18next-browser-languagedetector';
|
|
9
|
+
import './browser_errors.js';
|
|
10
|
+
import '../../constants-tYr0tCl8.js';
|
|
11
|
+
import 'zod';
|
|
12
|
+
import 'acorn';
|
|
13
|
+
import 'acorn-walk';
|
|
14
|
+
|
|
15
|
+
function friendlyErrors (p5) {
|
|
16
|
+
p5.registerAddon(fesCore);
|
|
17
|
+
p5.registerAddon(stacktrace);
|
|
18
|
+
p5.registerAddon(validateParams);
|
|
19
|
+
p5.registerAddon(sketchVerifier);
|
|
20
|
+
p5.registerAddon(fileErrors);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export { friendlyErrors as default };
|