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.
- package/{src → dist}/accessibility/color_namer.js +48 -3
- package/{src → dist}/accessibility/describe.js +2 -2
- package/{src → dist}/accessibility/gridOutput.js +2 -2
- package/dist/accessibility/index.js +60 -0
- package/{src → dist}/accessibility/outputs.js +2 -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-C-g_eAdC.js} +266 -130
- package/{src → dist}/core/States.js +3 -1
- package/dist/core/constants.js +1 -0
- package/{src → dist}/core/environment.js +7 -6
- 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 +5455 -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-D4AAKRbx.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 +11 -5
- 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 +2 -2
- package/{src → dist}/events/index.js +3 -1
- package/{src → dist}/events/keyboard.js +14 -11
- 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 +4 -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 +3 -4
- 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-s72KWcUy.js} +735 -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 +2 -2
- 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-CwAYZOC2.js} +390 -19
- package/dist/rendering--aAe5aq3.js +24925 -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 -61
- package/{src → dist}/type/textCore.js +34 -57
- 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 +51 -9
- package/lib/p5.esm.js +102 -48
- package/lib/p5.js +102 -48
- package/lib/p5.min.js +1 -1
- package/package.json +17 -16
- package/translations/dev.js +6 -6
- package/translations/index.js +1 -1
- 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,302 @@
|
|
|
1
|
+
import i18next from 'i18next';
|
|
2
|
+
import LanguageDetector from 'i18next-browser-languagedetector';
|
|
3
|
+
|
|
4
|
+
var fes = {
|
|
5
|
+
autoplay: "The media that tried to play (with '{{src}}') wasn't allowed to by this browser, most likely due to the browser's autoplay policy.\n\n+ More info: {{url}}",
|
|
6
|
+
checkUserDefinedFns: "It seems that you may have accidentally written {{name}} instead of {{actualName}}. Please correct it if it's not intentional.",
|
|
7
|
+
fileLoadError: {
|
|
8
|
+
bytes: "It looks like there was a problem loading your file. {{suggestion}}",
|
|
9
|
+
font: "It looks like there was a problem loading your font. {{suggestion}}",
|
|
10
|
+
gif: "There was some trouble loading your GIF. Make sure that your GIF is using 87a or 89a encoding.",
|
|
11
|
+
image: "It looks like there was a problem loading your image. {{suggestion}}",
|
|
12
|
+
json: "It looks like there was a problem loading your JSON file. {{suggestion}}",
|
|
13
|
+
large: "If your large file isn't fetched successfully, we recommend splitting the file into smaller segments and fetching those.",
|
|
14
|
+
strings: "It looks like there was a problem loading your text file. {{suggestion}}",
|
|
15
|
+
suggestion: "Try checking if the file path ({{filePath}}) is correct, hosting the file online, or running a local server.\n\n+ More info: {{url}}",
|
|
16
|
+
table: "It looks like there was a problem loading your table file. {{suggestion}}",
|
|
17
|
+
xml: "It looks like there was a problem loading your XML file. {{suggestion}}"
|
|
18
|
+
},
|
|
19
|
+
friendlyParamError: {
|
|
20
|
+
type_EMPTY_VAR: "{{location}} {{func}}() was expecting {{formatType}} for the {{position}} parameter, received an empty variable instead. If not intentional, this is often a problem with scope.\n\n+ More info: {{url}}",
|
|
21
|
+
type_TOO_FEW_ARGUMENTS: "{{location}} {{func}}() was expecting at least {{minParams}} arguments, but received only {{argCount}}.",
|
|
22
|
+
type_TOO_MANY_ARGUMENTS: "{{location}} {{func}}() was expecting no more than {{maxParams}} arguments, but received {{argCount}}.",
|
|
23
|
+
type_WRONG_TYPE: "{{location}} {{func}}() was expecting {{formatType}} for the {{position}} parameter, received {{argType}} instead."
|
|
24
|
+
},
|
|
25
|
+
globalErrors: {
|
|
26
|
+
reference: {
|
|
27
|
+
cannotAccess: "\n{{location}} \"{{symbol}}\" is used before declaration. Make sure you have declared the variable before using it.\n\n+ More info: {{url}}",
|
|
28
|
+
notDefined: "\n{{location}} \"{{symbol}}\" is not defined in the current scope. If you have defined it in your code, you should check its scope, spelling, and letter-casing (JavaScript is case-sensitive).\n\n+ More info: {{url}}"
|
|
29
|
+
},
|
|
30
|
+
stackSubseq: "└[{{location}}] \n\t Called from line {{line}} in {{func}}()\n",
|
|
31
|
+
stackTop: "┌[{{location}}] \n\t Error at line {{line}} in {{func}}()\n",
|
|
32
|
+
syntax: {
|
|
33
|
+
badReturnOrYield: "\nSyntax Error - return lies outside of a function. Make sure you’re not missing any brackets, so that return lies inside a function.\n\n+ More info: {{url}}",
|
|
34
|
+
invalidToken: "\nSyntax Error - Found a symbol that JavaScript doesn't recognize or didn't expect at it's place.\n\n+ More info: {{url}}",
|
|
35
|
+
missingInitializer: "\nSyntax Error - A const variable is declared but not initialized. In JavaScript, an initializer for a const is required. A value must be specified in the same statement in which the variable is declared. Check the line number in the error and assign the const variable a value.\n\n+ More info: {{url}}",
|
|
36
|
+
redeclaredVariable: "\nSyntax Error - \"{{symbol}}\" is being redeclared. JavaScript doesn't allow declaring a variable more than once. Check the line number in error for redeclaration of the variable.\n\n+ More info: {{url}}",
|
|
37
|
+
unexpectedToken: "\nSyntax Error - Symbol present at a place that wasn't expected.\nUsually this is due to a typo. Check the line number in the error for anything missing/extra.\n\n+ More info: {{url}}"
|
|
38
|
+
},
|
|
39
|
+
type: {
|
|
40
|
+
constAssign: "\n{{location}} A const variable is being re-assigned. In javascript, re-assigning a value to a constant is not allowed. If you want to re-assign new values to a variable, make sure it is declared as var or let.\n\n+ More info: {{url}}",
|
|
41
|
+
notfunc: "\n{{location}} \"{{symbol}}\" could not be called as a function.\nCheck the spelling, letter-casing (JavaScript is case-sensitive) and its type.\n\n+ More info: {{url}}",
|
|
42
|
+
notfuncObj: "\n{{location}} \"{{symbol}}\" could not be called as a function.\nVerify whether \"{{obj}}\" has \"{{symbol}}\" in it and check the spelling, letter-casing (JavaScript is case-sensitive) and its type.\n\n+ More info: {{url}}",
|
|
43
|
+
readFromNull: "\n{{location}} The property of null can't be read. In javascript the value null indicates that an object has no value.\n\n+ More info: {{url}}",
|
|
44
|
+
readFromUndefined: "\n{{location}} Cannot read property of undefined. Check the line number in error and make sure the variable which is being operated is not undefined.\n\n + More info: {{url}}"
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
libraryError: "{{location}} An error with message \"{{error}}\" occurred inside the p5js library when {{func}} was called. If not stated otherwise, it might be an issue with the arguments passed to {{func}}.",
|
|
48
|
+
location: "[{{file}}, line {{line}}]",
|
|
49
|
+
misspelling: "{{location}} It seems that you may have accidentally written \"{{name}}\" instead of \"{{actualName}}\". Please correct it to {{actualName}} if you wish to use the {{type}} from p5.js.",
|
|
50
|
+
misspelling_plural: "{{location}} It seems that you may have accidentally written \"{{name}}\".\nYou may have meant one of the following: \n{{suggestions}}",
|
|
51
|
+
misusedTopLevel: "Did you just try to use p5.js's {{symbolName}} {{symbolType}}? If so, you may want to move it into your sketch's setup() function.\n\n+ More info: {{url}}",
|
|
52
|
+
preloadDisabled: "The preload() function has been removed in p5.js 2.0. Please load assets in setup() using async / await keywords or callbacks instead. See https://dev.to/limzykenneth/asynchronous-p5js-20-458f for more information.",
|
|
53
|
+
positions: {
|
|
54
|
+
p_1: "first",
|
|
55
|
+
p_10: "tenth",
|
|
56
|
+
p_11: "eleventh",
|
|
57
|
+
p_12: "twelfth",
|
|
58
|
+
p_2: "second",
|
|
59
|
+
p_3: "third",
|
|
60
|
+
p_4: "fourth",
|
|
61
|
+
p_5: "fifth",
|
|
62
|
+
p_6: "sixth",
|
|
63
|
+
p_7: "seventh",
|
|
64
|
+
p_8: "eighth",
|
|
65
|
+
p_9: "ninth"
|
|
66
|
+
},
|
|
67
|
+
pre: "\n🌸 p5.js says: {{message}}",
|
|
68
|
+
sketchReaderErrors: {
|
|
69
|
+
reservedConst: "you have used a p5.js reserved variable \"{{symbol}}\" make sure you change the variable name to something else.\n\n+ More info: {{url}}",
|
|
70
|
+
reservedFunc: "you have used a p5.js reserved function \"{{symbol}}\" make sure you change the function name to something else.\n\n+ More info: {{url}}"
|
|
71
|
+
},
|
|
72
|
+
welcome: "Welcome! This is your friendly debugger. To turn me off, switch to using p5.min.js.",
|
|
73
|
+
wrongPreload: "{{location}} An error with message \"{{error}}\" occurred inside the p5js library when \"{{func}}\" was called. If not stated otherwise, it might be due to \"{{func}}\" being called from preload. Nothing besides load calls (loadImage, loadJSON, loadFont, loadStrings, etc.) should be inside the preload function."
|
|
74
|
+
};
|
|
75
|
+
var en = {
|
|
76
|
+
fes: fes
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
// Only one language is imported above. This is intentional as other languages
|
|
80
|
+
// will be hosted online and then downloaded whenever needed
|
|
81
|
+
|
|
82
|
+
/*
|
|
83
|
+
* Here, we define a default/fallback language which we can use without internet.
|
|
84
|
+
* You won't have to change this when adding a new language.
|
|
85
|
+
*
|
|
86
|
+
* `translation` is the namespace we are using for our initial set of strings
|
|
87
|
+
*/
|
|
88
|
+
var fallbackResources = {
|
|
89
|
+
en: {
|
|
90
|
+
translation: en
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
/*
|
|
95
|
+
* This is a list of languages that we have added so far.
|
|
96
|
+
* If you have just added a new language (yay!), add its key to the list below
|
|
97
|
+
* (`en` is english, `es` es español). Also add its export to
|
|
98
|
+
* dev.js, which is another file in this folder.
|
|
99
|
+
* @private
|
|
100
|
+
*/
|
|
101
|
+
const languages = [
|
|
102
|
+
'en',
|
|
103
|
+
'es',
|
|
104
|
+
'ko',
|
|
105
|
+
'zh',
|
|
106
|
+
'hi',
|
|
107
|
+
'ja'
|
|
108
|
+
];
|
|
109
|
+
|
|
110
|
+
if (typeof IS_MINIFIED === 'undefined') {
|
|
111
|
+
// internationalization is only for the unminified build
|
|
112
|
+
|
|
113
|
+
if (typeof P5_DEV_BUILD !== 'undefined') {
|
|
114
|
+
// When the library is built in development mode ( using npm run dev )
|
|
115
|
+
// we want to use the current translation files on the disk, which may have
|
|
116
|
+
// been updated but not yet pushed to the CDN.
|
|
117
|
+
let completeResources = require('../../translations/dev');
|
|
118
|
+
for (const language of Object.keys(completeResources)) {
|
|
119
|
+
// In es_translation, language is es and namespace is translation
|
|
120
|
+
// In es_MX_translation, language is es-MX and namespace is translation
|
|
121
|
+
const parts = language.split('_');
|
|
122
|
+
const lng = parts.slice(0, parts.length - 1).join('-');
|
|
123
|
+
const ns = parts[parts.length - 1];
|
|
124
|
+
|
|
125
|
+
fallbackResources[lng] = fallbackResources[lng] || {};
|
|
126
|
+
fallbackResources[lng][ns] = completeResources[language];
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/*
|
|
132
|
+
* This is our i18next "backend" plugin. It tries to fetch languages
|
|
133
|
+
* from a CDN.
|
|
134
|
+
* @private
|
|
135
|
+
*/
|
|
136
|
+
class FetchResources {
|
|
137
|
+
constructor(services, options) {
|
|
138
|
+
this.init(services, options);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
// run fetch with a timeout. Automatically rejects on timeout
|
|
142
|
+
// default timeout = 2000 ms
|
|
143
|
+
fetchWithTimeout(url, options, timeout = 2000) {
|
|
144
|
+
return Promise.race([
|
|
145
|
+
fetch(url, options),
|
|
146
|
+
new Promise((_, reject) =>
|
|
147
|
+
setTimeout(() => reject(new Error('timeout')), timeout)
|
|
148
|
+
)
|
|
149
|
+
]);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
init(services, options = {}) {
|
|
153
|
+
this.services = services;
|
|
154
|
+
this.options = options;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
read(language, namespace, callback) {
|
|
158
|
+
const loadPath = this.options.loadPath;
|
|
159
|
+
|
|
160
|
+
if (language === this.options.fallback) {
|
|
161
|
+
// if the default language of the user is the same as our inbuilt fallback,
|
|
162
|
+
// there's no need to fetch resources from the cdn. This won't actually
|
|
163
|
+
// need to run when we use "partialBundledLanguages" in the init
|
|
164
|
+
// function.
|
|
165
|
+
callback(null, fallbackResources[language][namespace]);
|
|
166
|
+
} else if (languages.includes(language)) {
|
|
167
|
+
// The user's language is included in the list of languages
|
|
168
|
+
// that we so far added translations for.
|
|
169
|
+
|
|
170
|
+
const url = this.services.interpolator.interpolate(loadPath, {
|
|
171
|
+
lng: language,
|
|
172
|
+
ns: namespace
|
|
173
|
+
});
|
|
174
|
+
this.loadUrl(url, callback);
|
|
175
|
+
} else {
|
|
176
|
+
// We don't have translations for this language. i18next will use
|
|
177
|
+
// the default language instead.
|
|
178
|
+
callback('Not found', false);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
loadUrl(url, callback) {
|
|
183
|
+
this.fetchWithTimeout(url)
|
|
184
|
+
.then(
|
|
185
|
+
response => {
|
|
186
|
+
const ok = response.ok;
|
|
187
|
+
|
|
188
|
+
if (!ok) {
|
|
189
|
+
// caught in the catch() below
|
|
190
|
+
throw new Error(`failed loading ${url}`);
|
|
191
|
+
}
|
|
192
|
+
return response.json();
|
|
193
|
+
},
|
|
194
|
+
() => {
|
|
195
|
+
// caught in the catch() below
|
|
196
|
+
throw new Error(`failed loading ${url}`);
|
|
197
|
+
}
|
|
198
|
+
)
|
|
199
|
+
.then(data => {
|
|
200
|
+
return callback(null, data);
|
|
201
|
+
})
|
|
202
|
+
.catch(callback);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
FetchResources.type = 'backend';
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* This is our translation function. Give it a key and
|
|
209
|
+
* it will retrieve the appropriate string
|
|
210
|
+
* (within supported languages) according to the
|
|
211
|
+
* user's browser's language settings.
|
|
212
|
+
* @function translator
|
|
213
|
+
* @param {String} key a key that corresponds to a message in our translation files
|
|
214
|
+
* @param {Object} values values for use in the message under the given `key`
|
|
215
|
+
* @returns {String} message (with values inserted) in the user's browser language
|
|
216
|
+
* @private
|
|
217
|
+
*/
|
|
218
|
+
let translator = (key, values) => {
|
|
219
|
+
console.debug('p5.js translator called before translations were loaded');
|
|
220
|
+
|
|
221
|
+
// Certain FES functionality may trigger before translations are downloaded.
|
|
222
|
+
// Using "partialBundledLanguages" option during initialization, we can
|
|
223
|
+
// still use our fallback language to display messages
|
|
224
|
+
i18next.t(key, values); /* i18next-extract-disable-line */
|
|
225
|
+
};
|
|
226
|
+
// (We'll set this to a real value in the init function below!)
|
|
227
|
+
|
|
228
|
+
/*
|
|
229
|
+
* Set up our translation function, with loaded languages
|
|
230
|
+
* @private
|
|
231
|
+
*/
|
|
232
|
+
const initialize = () => {
|
|
233
|
+
let i18init = i18next
|
|
234
|
+
.use(LanguageDetector)
|
|
235
|
+
.use(FetchResources)
|
|
236
|
+
.init({
|
|
237
|
+
fallbackLng: 'en',
|
|
238
|
+
nestingPrefix: '$tr(',
|
|
239
|
+
nestingSuffix: ')',
|
|
240
|
+
defaultNS: 'translation',
|
|
241
|
+
returnEmptyString: false,
|
|
242
|
+
interpolation: {
|
|
243
|
+
escapeValue: false
|
|
244
|
+
},
|
|
245
|
+
detection: {
|
|
246
|
+
checkWhitelist: false,
|
|
247
|
+
|
|
248
|
+
// prevent storing or locating language from cookie or localStorage
|
|
249
|
+
// more info on https://github.com/processing/p5.js/issues/4862
|
|
250
|
+
order: ['querystring', 'navigator', 'htmlTag', 'path', 'subdomain'],
|
|
251
|
+
caches: []
|
|
252
|
+
},
|
|
253
|
+
backend: {
|
|
254
|
+
fallback: 'en',
|
|
255
|
+
loadPath:
|
|
256
|
+
'https://cdn.jsdelivr.net/npm/p5/translations/{{lng}}/{{ns}}.json'
|
|
257
|
+
},
|
|
258
|
+
partialBundledLanguages: true,
|
|
259
|
+
resources: fallbackResources
|
|
260
|
+
})
|
|
261
|
+
.then(
|
|
262
|
+
translateFn => {
|
|
263
|
+
translator = translateFn;
|
|
264
|
+
},
|
|
265
|
+
e => console.debug(`Translations failed to load (${e})`)
|
|
266
|
+
);
|
|
267
|
+
|
|
268
|
+
// i18next.init() returns a promise that resolves when the translations
|
|
269
|
+
// are loaded. We use this in core/init.js to hold p5 initialization until
|
|
270
|
+
// we have the translation files.
|
|
271
|
+
return i18init;
|
|
272
|
+
};
|
|
273
|
+
|
|
274
|
+
/*
|
|
275
|
+
* Returns a list of languages we have translations loaded for
|
|
276
|
+
* @private
|
|
277
|
+
*/
|
|
278
|
+
const availableTranslatorLanguages = () => {
|
|
279
|
+
return i18next.languages;
|
|
280
|
+
};
|
|
281
|
+
|
|
282
|
+
/*
|
|
283
|
+
* Returns the current language selected for translation
|
|
284
|
+
* @private
|
|
285
|
+
*/
|
|
286
|
+
const currentTranslatorLanguage = language => {
|
|
287
|
+
return i18next.language;
|
|
288
|
+
};
|
|
289
|
+
|
|
290
|
+
/*
|
|
291
|
+
* Sets the current language for translation
|
|
292
|
+
* Returns a promise that resolved when loading is finished,
|
|
293
|
+
* or rejects if it fails.
|
|
294
|
+
* @private
|
|
295
|
+
*/
|
|
296
|
+
const setTranslatorLanguage = language => {
|
|
297
|
+
return i18next.changeLanguage(language || undefined, e =>
|
|
298
|
+
console.debug(`Translations failed to load (${e})`)
|
|
299
|
+
);
|
|
300
|
+
};
|
|
301
|
+
|
|
302
|
+
export { availableTranslatorLanguages, currentTranslatorLanguage, initialize, setTranslatorLanguage, translator };
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { p as p5 } from '../main-s72KWcUy.js';
|
|
2
|
+
import '../constants-C-g_eAdC.js';
|
|
3
|
+
import './transform.js';
|
|
4
|
+
import './structure.js';
|
|
5
|
+
import './environment.js';
|
|
6
|
+
import '../math/p5.Vector.js';
|
|
7
|
+
import '../rendering--aAe5aq3.js';
|
|
8
|
+
import '../creating_reading-D4AAKRbx.js';
|
|
9
|
+
import 'colorjs.io/fn';
|
|
10
|
+
import '../color/color_spaces/hsb.js';
|
|
11
|
+
import '../dom/p5.Element.js';
|
|
12
|
+
import '../dom/p5.File.js';
|
|
13
|
+
import '../io/p5.XML.js';
|
|
14
|
+
import '../p5.Renderer-CwAYZOC2.js';
|
|
15
|
+
import '../image/filters.js';
|
|
16
|
+
import '../shape/custom_shapes.js';
|
|
17
|
+
import './States.js';
|
|
18
|
+
import '../io/utilities.js';
|
|
19
|
+
import 'file-saver';
|
|
20
|
+
import '../dom/p5.MediaElement.js';
|
|
21
|
+
import '../shape/2d_primitives.js';
|
|
22
|
+
import './helpers.js';
|
|
23
|
+
import '../shape/attributes.js';
|
|
24
|
+
import '../shape/curves.js';
|
|
25
|
+
import '../shape/vertex.js';
|
|
26
|
+
import '../color/setting.js';
|
|
27
|
+
import 'omggif';
|
|
28
|
+
import '../io/csv.js';
|
|
29
|
+
import 'gifenc';
|
|
30
|
+
import '../image/pixels.js';
|
|
31
|
+
import '../webgl/GeometryBuilder.js';
|
|
32
|
+
import '../math/p5.Matrix.js';
|
|
33
|
+
import '../math/Matrices/Matrix.js';
|
|
34
|
+
import '../math/Matrices/MatrixInterface.js';
|
|
35
|
+
import '../webgl/p5.Geometry.js';
|
|
36
|
+
import '../webgl/p5.DataArray.js';
|
|
37
|
+
import '../webgl/p5.Quat.js';
|
|
38
|
+
import '../webgl/p5.RenderBuffer.js';
|
|
39
|
+
import '../webgl/ShapeBuilder.js';
|
|
40
|
+
import 'libtess';
|
|
41
|
+
import '../webgl/GeometryBufferCache.js';
|
|
42
|
+
import '../image/const.js';
|
|
43
|
+
import '../math/trigonometry.js';
|
|
44
|
+
import '../image/filterRenderer2D.js';
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* @for p5
|
|
48
|
+
* @requires core
|
|
49
|
+
* These are functions that are part of the Processing API but are not part of
|
|
50
|
+
* the p5.js API. In some cases they have a new name, in others, they are
|
|
51
|
+
* removed completely. Not all unsupported Processing functions are listed here
|
|
52
|
+
* but we try to include ones that a user coming from Processing might likely
|
|
53
|
+
* call.
|
|
54
|
+
*/
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
p5.prototype.pushStyle = function() {
|
|
58
|
+
throw new Error('pushStyle() not used, see push()');
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
p5.prototype.popStyle = function() {
|
|
62
|
+
throw new Error('popStyle() not used, see pop()');
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
p5.prototype.popMatrix = function() {
|
|
66
|
+
throw new Error('popMatrix() not used, see pop()');
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
p5.prototype.pushMatrix = function() {
|
|
70
|
+
throw new Error('pushMatrix() not used, see push()');
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
export { p5 as default };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import '../constants-C-g_eAdC.js';
|
|
2
|
+
import './transform.js';
|
|
3
|
+
import './structure.js';
|
|
4
|
+
import './environment.js';
|
|
5
|
+
import '../rendering--aAe5aq3.js';
|
|
6
|
+
import '../p5.Renderer-CwAYZOC2.js';
|
|
7
|
+
export { p as default } from '../main-s72KWcUy.js';
|
|
8
|
+
import '../math/p5.Vector.js';
|
|
9
|
+
import '../creating_reading-D4AAKRbx.js';
|
|
10
|
+
import 'colorjs.io/fn';
|
|
11
|
+
import '../color/color_spaces/hsb.js';
|
|
12
|
+
import '../dom/p5.Element.js';
|
|
13
|
+
import '../dom/p5.File.js';
|
|
14
|
+
import '../io/p5.XML.js';
|
|
15
|
+
import '../dom/p5.MediaElement.js';
|
|
16
|
+
import '../shape/2d_primitives.js';
|
|
17
|
+
import './helpers.js';
|
|
18
|
+
import '../shape/attributes.js';
|
|
19
|
+
import '../shape/curves.js';
|
|
20
|
+
import '../shape/vertex.js';
|
|
21
|
+
import '../color/setting.js';
|
|
22
|
+
import 'omggif';
|
|
23
|
+
import '../io/csv.js';
|
|
24
|
+
import '../io/utilities.js';
|
|
25
|
+
import 'file-saver';
|
|
26
|
+
import 'gifenc';
|
|
27
|
+
import '../image/pixels.js';
|
|
28
|
+
import '../image/filters.js';
|
|
29
|
+
import '../webgl/GeometryBuilder.js';
|
|
30
|
+
import '../math/p5.Matrix.js';
|
|
31
|
+
import '../math/Matrices/Matrix.js';
|
|
32
|
+
import '../math/Matrices/MatrixInterface.js';
|
|
33
|
+
import '../webgl/p5.Geometry.js';
|
|
34
|
+
import '../webgl/p5.DataArray.js';
|
|
35
|
+
import '../webgl/p5.Quat.js';
|
|
36
|
+
import '../webgl/p5.RenderBuffer.js';
|
|
37
|
+
import '../webgl/ShapeBuilder.js';
|
|
38
|
+
import 'libtess';
|
|
39
|
+
import '../webgl/GeometryBufferCache.js';
|
|
40
|
+
import '../image/const.js';
|
|
41
|
+
import '../shape/custom_shapes.js';
|
|
42
|
+
import '../math/trigonometry.js';
|
|
43
|
+
import './States.js';
|
|
44
|
+
import '../image/filterRenderer2D.js';
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import '../constants-C-g_eAdC.js';
|
|
2
|
+
import '../creating_reading-D4AAKRbx.js';
|
|
3
|
+
import '../shape/2d_primitives.js';
|
|
4
|
+
import '../shape/attributes.js';
|
|
5
|
+
import '../shape/curves.js';
|
|
6
|
+
import '../shape/vertex.js';
|
|
7
|
+
import '../color/setting.js';
|
|
8
|
+
export { G as Graphics, z as default } from '../rendering--aAe5aq3.js';
|
|
9
|
+
import '../image/pixels.js';
|
|
10
|
+
import './transform.js';
|
|
11
|
+
import '../math/trigonometry.js';
|
|
12
|
+
import '../shape/custom_shapes.js';
|
|
13
|
+
import 'colorjs.io/fn';
|
|
14
|
+
import '../color/color_spaces/hsb.js';
|
|
15
|
+
import './helpers.js';
|
|
16
|
+
import '../dom/p5.Element.js';
|
|
17
|
+
import '../dom/p5.File.js';
|
|
18
|
+
import '../io/p5.XML.js';
|
|
19
|
+
import '../p5.Renderer-CwAYZOC2.js';
|
|
20
|
+
import '../image/filters.js';
|
|
21
|
+
import '../math/p5.Vector.js';
|
|
22
|
+
import './States.js';
|
|
23
|
+
import '../io/utilities.js';
|
|
24
|
+
import 'file-saver';
|
|
25
|
+
import '../dom/p5.MediaElement.js';
|
|
26
|
+
import 'omggif';
|
|
27
|
+
import '../io/csv.js';
|
|
28
|
+
import 'gifenc';
|
|
29
|
+
import '../webgl/GeometryBuilder.js';
|
|
30
|
+
import '../math/p5.Matrix.js';
|
|
31
|
+
import '../math/Matrices/Matrix.js';
|
|
32
|
+
import '../math/Matrices/MatrixInterface.js';
|
|
33
|
+
import '../webgl/p5.Geometry.js';
|
|
34
|
+
import '../webgl/p5.DataArray.js';
|
|
35
|
+
import '../webgl/p5.Quat.js';
|
|
36
|
+
import '../webgl/p5.RenderBuffer.js';
|
|
37
|
+
import '../webgl/ShapeBuilder.js';
|
|
38
|
+
import 'libtess';
|
|
39
|
+
import '../webgl/GeometryBufferCache.js';
|
|
40
|
+
import '../image/const.js';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import '../creating_reading-D4AAKRbx.js';
|
|
2
|
+
import '../constants-C-g_eAdC.js';
|
|
3
|
+
export { R as Renderer, r as default } from '../p5.Renderer-CwAYZOC2.js';
|
|
4
|
+
import '../math/p5.Vector.js';
|
|
5
|
+
import '../shape/custom_shapes.js';
|
|
6
|
+
import './States.js';
|
|
7
|
+
import 'colorjs.io/fn';
|
|
8
|
+
import '../color/color_spaces/hsb.js';
|
|
9
|
+
import '../image/filters.js';
|
|
10
|
+
import '../io/utilities.js';
|
|
11
|
+
import 'file-saver';
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import '../constants-C-g_eAdC.js';
|
|
2
|
+
export { R as Renderer2D, r as default } from '../main-s72KWcUy.js';
|
|
3
|
+
import '../p5.Renderer-CwAYZOC2.js';
|
|
4
|
+
import '../rendering--aAe5aq3.js';
|
|
5
|
+
import '../dom/p5.Element.js';
|
|
6
|
+
import '../dom/p5.MediaElement.js';
|
|
7
|
+
import '../creating_reading-D4AAKRbx.js';
|
|
8
|
+
import '../image/filterRenderer2D.js';
|
|
9
|
+
import '../math/p5.Matrix.js';
|
|
10
|
+
import '../shape/custom_shapes.js';
|
|
11
|
+
import '../math/Matrices/Matrix.js';
|
|
12
|
+
import './transform.js';
|
|
13
|
+
import './structure.js';
|
|
14
|
+
import './environment.js';
|
|
15
|
+
import '../math/p5.Vector.js';
|
|
16
|
+
import '../image/filters.js';
|
|
17
|
+
import './States.js';
|
|
18
|
+
import '../io/utilities.js';
|
|
19
|
+
import 'file-saver';
|
|
20
|
+
import '../shape/2d_primitives.js';
|
|
21
|
+
import './helpers.js';
|
|
22
|
+
import '../shape/attributes.js';
|
|
23
|
+
import '../shape/curves.js';
|
|
24
|
+
import '../shape/vertex.js';
|
|
25
|
+
import '../color/setting.js';
|
|
26
|
+
import 'colorjs.io/fn';
|
|
27
|
+
import '../color/color_spaces/hsb.js';
|
|
28
|
+
import 'omggif';
|
|
29
|
+
import '../io/csv.js';
|
|
30
|
+
import 'gifenc';
|
|
31
|
+
import '../image/pixels.js';
|
|
32
|
+
import '../webgl/GeometryBuilder.js';
|
|
33
|
+
import '../webgl/p5.Geometry.js';
|
|
34
|
+
import '../webgl/p5.DataArray.js';
|
|
35
|
+
import '../math/Matrices/MatrixInterface.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
|
+
import '../dom/p5.File.js';
|
|
44
|
+
import '../io/p5.XML.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import '../constants-C-g_eAdC.js';
|
|
2
|
+
export { y as default, I as renderers } from '../rendering--aAe5aq3.js';
|
|
3
|
+
import '../creating_reading-D4AAKRbx.js';
|
|
4
|
+
import 'colorjs.io/fn';
|
|
5
|
+
import '../color/color_spaces/hsb.js';
|
|
6
|
+
import '../dom/p5.Element.js';
|
|
7
|
+
import '../dom/p5.File.js';
|
|
8
|
+
import '../io/p5.XML.js';
|
|
9
|
+
import '../p5.Renderer-CwAYZOC2.js';
|
|
10
|
+
import '../image/filters.js';
|
|
11
|
+
import '../math/p5.Vector.js';
|
|
12
|
+
import '../shape/custom_shapes.js';
|
|
13
|
+
import './States.js';
|
|
14
|
+
import '../io/utilities.js';
|
|
15
|
+
import 'file-saver';
|
|
16
|
+
import '../dom/p5.MediaElement.js';
|
|
17
|
+
import '../shape/2d_primitives.js';
|
|
18
|
+
import './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 '../io/csv.js';
|
|
25
|
+
import 'gifenc';
|
|
26
|
+
import '../image/pixels.js';
|
|
27
|
+
import './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 '../image/const.js';
|
|
40
|
+
import '../math/trigonometry.js';
|