diff --git a/public/reference/data.json b/public/reference/data.json index edb525782a..d1965ffbf3 100644 --- a/public/reference/data.json +++ b/public/reference/data.json @@ -2,7 +2,7 @@ "project": { "name": "p5", "description": "[![npm version](https://badge.fury.io/js/p5.svg)](https://www.npmjs.com/package/p5)", - "version": "1.11.2", + "version": "1.11.3", "url": "https://github.com/processing/p5.js#readme" }, "files": { @@ -914,197 +914,6 @@ "classes": {}, "fors": {}, "namespaces": {} - }, - "src/Amplitude.js": { - "name": "src/Amplitude.js", - "modules": { - "p5.sound": 1 - }, - "classes": { - "Amplitude": 1 - }, - "fors": { - "p5.sound": 1, - "Amplitude": 1 - }, - "namespaces": {} - }, - "src/AudioIn.js": { - "name": "src/AudioIn.js", - "modules": {}, - "classes": { - "AudioIn": 1 - }, - "fors": { - "p5.sound": 1, - "AudioIn": 1 - }, - "namespaces": {} - }, - "src/Biquad.js": { - "name": "src/Biquad.js", - "modules": {}, - "classes": { - "Biquad": 1, - "LowPass": 1, - "HighPass": 1, - "BandPass": 1 - }, - "fors": { - "p5.sound": 1, - "Biquad": 1 - }, - "namespaces": {} - }, - "src/Delay.js": { - "name": "src/Delay.js", - "modules": {}, - "classes": { - "Delay": 1 - }, - "fors": { - "p5.sound": 1, - "Delay": 1 - }, - "namespaces": {} - }, - "src/Envelope.js": { - "name": "src/Envelope.js", - "modules": {}, - "classes": { - "Envelope": 1 - }, - "fors": { - "p5.sound": 1, - "Envelope": 1 - }, - "namespaces": {} - }, - "src/FFT.js": { - "name": "src/FFT.js", - "modules": {}, - "classes": { - "FFT": 1 - }, - "fors": { - "p5.sound": 1, - "FFT": 1 - }, - "namespaces": {} - }, - "src/Gain.js": { - "name": "src/Gain.js", - "modules": {}, - "classes": { - "Gain": 1 - }, - "fors": { - "p5.sound": 1, - "Gain": 1 - }, - "namespaces": {} - }, - "src/Noise.js": { - "name": "src/Noise.js", - "modules": {}, - "classes": { - "Noise": 1 - }, - "fors": { - "p5.sound": 1, - "Noise": 1 - }, - "namespaces": {} - }, - "src/Oscillator.js": { - "name": "src/Oscillator.js", - "modules": {}, - "classes": { - "Oscillator": 1, - "SawOsc": 1, - "SqrOsc": 1, - "TriOsc": 1, - "SinOsc": 1 - }, - "fors": { - "p5.sound": 1, - "Oscillator": 1 - }, - "namespaces": {} - }, - "src/Panner.js": { - "name": "src/Panner.js", - "modules": {}, - "classes": { - "Panner": 1 - }, - "fors": { - "p5.sound": 1, - "Panner": 1 - }, - "namespaces": {} - }, - "src/Panner3D.js": { - "name": "src/Panner3D.js", - "modules": {}, - "classes": { - "Panner3D": 1 - }, - "fors": { - "p5.sound": 1, - "Panner3D": 1 - }, - "namespaces": {} - }, - "src/PitchShifter.js": { - "name": "src/PitchShifter.js", - "modules": {}, - "classes": { - "PitchShifter": 1 - }, - "fors": { - "p5.sound": 1, - "PitchShifter": 1 - }, - "namespaces": {} - }, - "src/Reverb.js": { - "name": "src/Reverb.js", - "modules": {}, - "classes": { - "Reverb": 1 - }, - "fors": { - "p5.sound": 1, - "Reverb": 1 - }, - "namespaces": {} - }, - "src/SoundFile.js": { - "name": "src/SoundFile.js", - "modules": { - "SoundFile": 1 - }, - "classes": { - "SoundFile": 1 - }, - "fors": { - "p5.sound": 1, - "sound": 1, - "SoundFile": 1 - }, - "namespaces": {} - }, - "src/Utils.js": { - "name": "src/Utils.js", - "modules": { - "Sound Utilities": 1 - }, - "classes": {}, - "fors": { - "sound": 1 - }, - "namespaces": {} } }, "modules": { @@ -2081,106 +1890,79 @@ }, "p5.sound": { "name": "p5.sound", - "submodules": { - "SoundFile": 1 - }, - "elements": {}, - "classes": { - "p5.sound": 1, - "Amplitude": 1, - "AudioIn": 1, - "Biquad": 1, - "LowPass": 1, - "HighPass": 1, - "BandPass": 1, - "Delay": 1, - "Envelope": 1, - "FFT": 1, - "Gain": 1, - "Noise": 1, - "Oscillator": 1, - "SawOsc": 1, - "SqrOsc": 1, - "TriOsc": 1, - "SinOsc": 1, - "Panner": 1, - "Panner3D": 1, - "PitchShifter": 1, - "Reverb": 1, - "sound": 1, - "SoundFile": 1 - }, - "fors": { - "p5.sound": 1, - "Amplitude": 1, - "AudioIn": 1, - "Biquad": 1, - "Delay": 1, - "Envelope": 1, - "FFT": 1, - "Gain": 1, - "Noise": 1, - "Oscillator": 1, - "Panner": 1, - "Panner3D": 1, - "PitchShifter": 1, - "Reverb": 1, - "sound": 1, - "SoundFile": 1 - }, - "namespaces": {}, - "module": "p5.sound", - "file": "src/SoundFile.js", - "line": 60, - "description": "Get the current volume of a sound." - }, - "SoundFile": { - "name": "SoundFile", "submodules": {}, "elements": {}, "classes": { - "sound": 1, - "SoundFile": 1 + "p5.sound": 1, + "p5.SoundFile": 1, + "p5.Amplitude": 1, + "p5.FFT": 1, + "p5.Oscillator": 1, + "p5.SinOsc": 1, + "p5.TriOsc": 1, + "p5.SawOsc": 1, + "p5.SqrOsc": 1, + "p5.Envelope": 1, + "p5.Noise": 1, + "p5.Pulse": 1, + "p5.AudioIn": 1, + "p5.Effect": 1, + "p5.Filter": 1, + "p5.LowPass": 1, + "p5.HighPass": 1, + "p5.BandPass": 1, + "p5.EQ": 1, + "p5.Panner3D": 1, + "p5.Delay": 1, + "p5.Reverb": 1, + "p5.Convolver": 1, + "p5.Phrase": 1, + "p5.Part": 1, + "p5.Score": 1, + "p5.SoundLoop": 1, + "p5.Compressor": 1, + "p5.PeakDetect": 1, + "p5.SoundRecorder": 1, + "p5.Distortion": 1, + "p5.Gain": 1, + "p5.AudioVoice": 1, + "p5.MonoSynth": 1, + "p5.OnsetDetect": 1, + "p5.PolySynth": 1 }, "fors": { "p5.sound": 1, - "sound": 1, - "SoundFile": 1 + "p5": 1, + "p5.SoundFile": 1, + "p5.Amplitude": 1, + "p5.FFT": 1, + "p5.Oscillator": 1, + "p5.Envelope": 1, + "p5.AudioIn": 1, + "p5.Effect": 1, + "p5.EQ": 1, + "p5.Panner3D": 1, + "p5.Delay": 1, + "p5.Reverb": 1, + "p5.Convolver": 1, + "p5.Part": 1, + "p5.Score": 1, + "p5.SoundLoop": 1, + "p5.Compressor": 1, + "p5.SoundRecorder": 1, + "p5.Distortion": 1, + "p5.Gain": 1, + "p5.AudioVoice": 1, + "p5.MonoSynth": 1, + "p5.PolySynth": 1 }, - "is_submodule": 1, "namespaces": {}, "module": "p5.sound", - "namespace": "", - "file": "src/SoundFile.js", - "line": 60, - "description": "p5.sound.js extends p5.js with Web Audio functionality including audio input, playback, analysis and synthesis." - }, - "Sound": { - "name": "Sound", - "submodules": { - "Sound Utilities": 1 - }, - "elements": {}, - "classes": {}, - "fors": { - "sound": 1 - }, - "namespaces": {} - }, - "Sound Utilities": { - "name": "Sound Utilities", - "submodules": {}, - "elements": {}, - "classes": {}, - "fors": { - "sound": 1 - }, - "is_submodule": 1, - "namespaces": {}, - "module": "Sound", - "namespace": "", - "file": "src/Utils.js", - "line": 1 + "file": "lib/addons/p5.sound.js", + "line": 11691, + "description": "

p5.sound extends p5 with Web Audio functionality including audio input,\nplayback, analysis and synthesis.\n

\n -line: 1129 +line: 1134 isConstructor: false itemtype: method example: @@ -93,7 +93,7 @@ return: description: the p5.Geometry object type: p5.Geometry overloads: - - line: 1129 + - line: 1134 params: - name: modelString description: | @@ -126,7 +126,7 @@ overloads: return: description: the p5.Geometry object type: p5.Geometry - - line: 1199 + - line: 1204 params: - name: modelString description: '' @@ -146,7 +146,7 @@ overloads: return: description: the p5.Geometry object type: p5.Geometry - - line: 1207 + - line: 1212 params: - name: modelString description: '' diff --git a/src/content/reference/en/p5/createP.mdx b/src/content/reference/en/p5/createP.mdx index 851e7ded92..c7998ad8f0 100644 --- a/src/content/reference/en/p5/createP.mdx +++ b/src/content/reference/en/p5/createP.mdx @@ -4,7 +4,7 @@ module: DOM submodule: DOM file: src/dom/dom.js description: > -

Creates a paragraph element.

+

Creates a

element.

elements are commonly used for paragraph-length text.

diff --git a/src/content/reference/en/p5/createSlider.mdx b/src/content/reference/en/p5/createSlider.mdx index ec96d92c93..a38232f3b5 100644 --- a/src/content/reference/en/p5/createSlider.mdx +++ b/src/content/reference/en/p5/createSlider.mdx @@ -150,7 +150,7 @@ params: type: Number optional: true return: - description: new p5.Element object. + description: new p5.Element object. type: p5.Element chainable: false --- diff --git a/src/content/reference/en/p5/fill.mdx b/src/content/reference/en/p5/fill.mdx index e704ef6ef1..a06bd2f294 100644 --- a/src/content/reference/en/p5/fill.mdx +++ b/src/content/reference/en/p5/fill.mdx @@ -240,7 +240,7 @@ overloads: type: Number - name: alpha description: > -

optional alpha value, controls transparency (0 - transparent, 255 - +

alpha value, controls transparency (0 - transparent, 255 - opaque).

type: Number optional: true diff --git a/src/content/reference/en/p5/for.mdx b/src/content/reference/en/p5/for.mdx index c8ee85b2b7..65ced3c14c 100644 --- a/src/content/reference/en/p5/for.mdx +++ b/src/content/reference/en/p5/for.mdx @@ -165,7 +165,7 @@ description: > updates its value to 40 and then 60 during the next iterations.

-line: 1688 +line: 1648 isConstructor: false itemtype: property example: diff --git a/src/content/reference/en/p5/getURLParams.mdx b/src/content/reference/en/p5/getURLParams.mdx index c7661b7f34..8f4a37bd44 100644 --- a/src/content/reference/en/p5/getURLParams.mdx +++ b/src/content/reference/en/p5/getURLParams.mdx @@ -15,7 +15,7 @@ description: >

For example, calling getURLParams() in a sketch hosted at the URL - https://p5js.org?year=2014&month=May&day=15 returns + http://p5js.org?year=2014&month=May&day=15 returns { year: 2014, month: 'May', day: 15 }.

line: 1208 diff --git a/src/content/reference/en/p5/green.mdx b/src/content/reference/en/p5/green.mdx index b19ba7523f..5aee8b7de1 100644 --- a/src/content/reference/en/p5/green.mdx +++ b/src/content/reference/en/p5/green.mdx @@ -16,7 +16,7 @@ description: >

By default, green() returns a color's green value in the range 0 - to 255. If the colorMode() is set to RGB, + to 255. If the colorMode() is set to RGB, it returns the green value in the given range.

diff --git a/src/content/reference/en/p5/hue.mdx b/src/content/reference/en/p5/hue.mdx index a14c21882b..af5861e635 100644 --- a/src/content/reference/en/p5/hue.mdx +++ b/src/content/reference/en/p5/hue.mdx @@ -18,7 +18,7 @@ description: > returns a color's HSL hue in the range 0 to 360. If the - colorMode() is set to HSB or HSL, it + colorMode() is set to HSB or HSL, it returns the hue value in the given mode.

diff --git a/src/content/reference/en/p5/keyIsDown.mdx b/src/content/reference/en/p5/keyIsDown.mdx index 4de0221d64..0f98f1696e 100644 --- a/src/content/reference/en/p5/keyIsDown.mdx +++ b/src/content/reference/en/p5/keyIsDown.mdx @@ -30,7 +30,7 @@ description: > keyIsDown(LEFT_ARROW). Key codes can be found on websites such as keycode.info.

-line: 795 +line: 809 isConstructor: false itemtype: method example: diff --git a/src/content/reference/en/p5/keyReleased.mdx b/src/content/reference/en/p5/keyReleased.mdx index 1fe77469fb..e293d6cad4 100644 --- a/src/content/reference/en/p5/keyReleased.mdx +++ b/src/content/reference/en/p5/keyReleased.mdx @@ -57,7 +57,7 @@ description: > the end of the function.

-line: 461 +line: 472 isConstructor: false itemtype: method example: diff --git a/src/content/reference/en/p5/keyTyped.mdx b/src/content/reference/en/p5/keyTyped.mdx index 646087c938..8ff0573ff8 100644 --- a/src/content/reference/en/p5/keyTyped.mdx +++ b/src/content/reference/en/p5/keyTyped.mdx @@ -73,7 +73,7 @@ description: > the end of the function.

-line: 639 +line: 653 isConstructor: false itemtype: method example: diff --git a/src/content/reference/en/p5/lightness.mdx b/src/content/reference/en/p5/lightness.mdx index 15b87823a9..de4dbf41bc 100644 --- a/src/content/reference/en/p5/lightness.mdx +++ b/src/content/reference/en/p5/lightness.mdx @@ -16,7 +16,7 @@ description: >

By default, lightness() returns a color's HSL lightness in the range 0 - to 100. If the colorMode() is set to HSL, + to 100. If the colorMode() is set to HSL, it returns the lightness value in the given range.

diff --git a/src/content/reference/en/p5/line.mdx b/src/content/reference/en/p5/line.mdx index f338067107..8fafe3a215 100644 --- a/src/content/reference/en/p5/line.mdx +++ b/src/content/reference/en/p5/line.mdx @@ -94,7 +94,7 @@ example: }
- - | + - |-
diff --git a/src/content/reference/en/p5/loadModel.mdx b/src/content/reference/en/p5/loadModel.mdx index f5bbd47a90..9c34c265db 100644 --- a/src/content/reference/en/p5/loadModel.mdx +++ b/src/content/reference/en/p5/loadModel.mdx @@ -31,6 +31,16 @@ description: > 'https://example.com/model.obj' may be blocked due to browser security.

+

Note: When loading a .obj file that references materials + stored in + + .mtl files, p5.js will attempt to load and apply those materials. + + To ensure that the .obj file reads the .mtl file + correctly include the + + .mtl file alongside it.

+

The first way to call loadModel() has three optional parameters after the @@ -391,7 +401,7 @@ overloads: return: description: the p5.Geometry object type: p5.Geometry - - line: 319 + - line: 324 params: - name: path description: '' @@ -411,7 +421,7 @@ overloads: return: description: new p5.Geometry object. type: p5.Geometry - - line: 327 + - line: 332 params: - name: path description: '' diff --git a/src/content/reference/en/p5/loadTable.mdx b/src/content/reference/en/p5/loadTable.mdx index bbb05cfc2f..871026ac69 100644 --- a/src/content/reference/en/p5/loadTable.mdx +++ b/src/content/reference/en/p5/loadTable.mdx @@ -57,7 +57,7 @@ example: //and has a header specifying the columns labels table = loadTable('/assets/mammals.csv', 'csv', 'header'); //the file can be remote - //table = loadTable("https://p5js.org/reference//assets/mammals.csv", + //table = loadTable("http://p5js.org/reference//assets/mammals.csv", // "csv", "header"); } diff --git a/src/content/reference/en/p5/model.mdx b/src/content/reference/en/p5/model.mdx index 4fd95e7946..981de3bf09 100644 --- a/src/content/reference/en/p5/model.mdx +++ b/src/content/reference/en/p5/model.mdx @@ -23,7 +23,7 @@ description: > a file with loadGeometry().

Note: model() can only be used in WebGL mode.

-line: 988 +line: 993 isConstructor: false itemtype: method example: diff --git a/src/content/reference/en/p5/p5.Geometry.mdx b/src/content/reference/en/p5/p5.Geometry.mdx index c86a37cb3a..a5ab48e47e 100644 --- a/src/content/reference/en/p5/p5.Geometry.mdx +++ b/src/content/reference/en/p5/p5.Geometry.mdx @@ -496,11 +496,11 @@ methods: // Notice the swaps: - // Left vertices: [0, 0] <--> [1, 0] + // Left vertices: [0, 0] <--> [1, 0] - // Right vertices: [1, 0] <--> [1, 1] + // Right vertices: [1, 0] <--> [1, 1] -
+ path: p5.Geometry/flipV computeFaces: description: > diff --git a/src/content/reference/en/p5/p5.Shader.mdx b/src/content/reference/en/p5/p5.Shader.mdx index 85aa3ae372..df30922ab4 100644 --- a/src/content/reference/en/p5/p5.Shader.mdx +++ b/src/content/reference/en/p5/p5.Shader.mdx @@ -64,7 +64,7 @@ description: >
void main() {
     HOOK_beforeVertex();
-    // Add the rest ofy our shader code here!
+    // Add the rest of your shader code here!
   }
 
   
diff --git a/src/content/reference/en/p5/paletteLerp.mdx b/src/content/reference/en/p5/paletteLerp.mdx index 30a3dee1b6..281627209d 100644 --- a/src/content/reference/en/p5/paletteLerp.mdx +++ b/src/content/reference/en/p5/paletteLerp.mdx @@ -19,7 +19,7 @@ description: >

The way that colors are interpolated depends on the current - colorMode().

+ colorMode().

line: 1079 isConstructor: false itemtype: method diff --git a/src/content/reference/en/p5/red.mdx b/src/content/reference/en/p5/red.mdx index bd47f1ba6f..53caf4c44c 100644 --- a/src/content/reference/en/p5/red.mdx +++ b/src/content/reference/en/p5/red.mdx @@ -15,7 +15,7 @@ description: >

By default, red() returns a color's red value in the range 0 - to 255. If the colorMode() is set to RGB, + to 255. If the colorMode() is set to RGB, it returns the red value in the given range.

diff --git a/src/content/reference/en/p5/reverse.mdx b/src/content/reference/en/p5/reverse.mdx index df1d26cbb8..b30a4f75c6 100644 --- a/src/content/reference/en/p5/reverse.mdx +++ b/src/content/reference/en/p5/reverse.mdx @@ -6,6 +6,7 @@ file: src/utilities/array_functions.js description: |

Reverses the order of an array, maps to Array.reverse()

line: 141 +deprecated: true isConstructor: false itemtype: method example: diff --git a/src/content/reference/en/p5/saturation.mdx b/src/content/reference/en/p5/saturation.mdx index 4ac75f6a26..2940cc659f 100644 --- a/src/content/reference/en/p5/saturation.mdx +++ b/src/content/reference/en/p5/saturation.mdx @@ -18,7 +18,7 @@ description: > returns a color's HSL saturation in the range 0 to 100. If the - colorMode() is set to HSB or HSL, it + colorMode() is set to HSB or HSL, it returns the saturation value in the given mode.

diff --git a/src/content/reference/en/p5/saveFrames.mdx b/src/content/reference/en/p5/saveFrames.mdx index 5ea0e4aa75..c77c3a0335 100644 --- a/src/content/reference/en/p5/saveFrames.mdx +++ b/src/content/reference/en/p5/saveFrames.mdx @@ -14,7 +14,7 @@ description: > example, the first saved frame might have the following properties:

-

{ ext: 'png', filenmame: 'frame0', imageData: +

{ ext: 'png', filename: 'frame0', imageData: 'data:image/octet-stream;base64, abc123' }.

The first parameter, filename, sets the prefix for the file diff --git a/src/content/reference/en/p5/saveSound.mdx b/src/content/reference/en/p5/saveSound.mdx index 42eef131a3..0676ce11fe 100644 --- a/src/content/reference/en/p5/saveSound.mdx +++ b/src/content/reference/en/p5/saveSound.mdx @@ -11,7 +11,7 @@ description: > For uploading audio to a server, use p5.SoundFile.saveBlob.

+ href="/docs/reference/#/p5.SoundFile/saveBlob/">p5.SoundFile.saveBlob.

line: 1145 isConstructor: false itemtype: method diff --git a/src/content/reference/en/p5/shorten.mdx b/src/content/reference/en/p5/shorten.mdx index b3cfdecf68..7d9060df54 100644 --- a/src/content/reference/en/p5/shorten.mdx +++ b/src/content/reference/en/p5/shorten.mdx @@ -7,6 +7,7 @@ description: |

Decreases an array by one element and returns the shortened array, maps to Array.pop().

line: 161 +deprecated: true isConstructor: false itemtype: method example: diff --git a/src/content/reference/en/p5/sin.mdx b/src/content/reference/en/p5/sin.mdx index 439945e25b..fc241c4173 100644 --- a/src/content/reference/en/p5/sin.mdx +++ b/src/content/reference/en/p5/sin.mdx @@ -86,8 +86,9 @@ example: class: p5 params: - name: angle - description: | -

the angle.

+ description: > +

the angle in radians unless specified by angleMode().

type: Number return: description: sine of the angle. diff --git a/src/content/reference/en/p5/sort.mdx b/src/content/reference/en/p5/sort.mdx index 8c4398d07b..bfc89c09d5 100644 --- a/src/content/reference/en/p5/sort.mdx +++ b/src/content/reference/en/p5/sort.mdx @@ -10,6 +10,7 @@ description: | elements to sort. For example, if there are 12 elements in an array and count is set to 5, only the first 5 elements in the array will be sorted.

line: 300 +deprecated: true isConstructor: false itemtype: method example: diff --git a/src/content/reference/en/p5/splice.mdx b/src/content/reference/en/p5/splice.mdx index e3aec6c786..eb111d0991 100644 --- a/src/content/reference/en/p5/splice.mdx +++ b/src/content/reference/en/p5/splice.mdx @@ -11,6 +11,7 @@ description: | (Remember that array index numbering starts at zero, so the first position is 0, the second position is 1, and so on.)

line: 346 +deprecated: true isConstructor: false itemtype: method example: diff --git a/src/content/reference/en/p5/stroke.mdx b/src/content/reference/en/p5/stroke.mdx index 25a21ed99c..ada5111cb6 100644 --- a/src/content/reference/en/p5/stroke.mdx +++ b/src/content/reference/en/p5/stroke.mdx @@ -262,7 +262,9 @@ overloads: is HSB.

type: Number - name: alpha - description: '' + description: > +

alpha value, controls transparency (0 - transparent, 255 - + opaque).

type: Number optional: true chainable: 1 diff --git a/src/content/reference/en/p5/subset.mdx b/src/content/reference/en/p5/subset.mdx index 1cf9f6c1f6..b6968e511f 100644 --- a/src/content/reference/en/p5/subset.mdx +++ b/src/content/reference/en/p5/subset.mdx @@ -11,6 +11,7 @@ description: | When specifying the start, remember that the first array element is 0. This function does not change the source array.

line: 381 +deprecated: true isConstructor: false itemtype: method example: diff --git a/src/content/reference/en/p5/tan.mdx b/src/content/reference/en/p5/tan.mdx index 1fb3eeafd8..94694a1888 100644 --- a/src/content/reference/en/p5/tan.mdx +++ b/src/content/reference/en/p5/tan.mdx @@ -43,8 +43,9 @@ example: class: p5 params: - name: angle - description: | -

the angle.

+ description: > +

the angle in radians unless specified by angleMode().

type: Number return: description: tangent of the angle. diff --git a/src/content/reference/en/p5/while.mdx b/src/content/reference/en/p5/while.mdx index 5198618587..4622976804 100644 --- a/src/content/reference/en/p5/while.mdx +++ b/src/content/reference/en/p5/while.mdx @@ -94,7 +94,7 @@ description: > }
-line: 1912 +line: 1872 isConstructor: false itemtype: property example: diff --git a/src/globals/globals.ts b/src/globals/globals.ts index 6fce520364..33c302365a 100644 --- a/src/globals/globals.ts +++ b/src/globals/globals.ts @@ -23,4 +23,6 @@ export const libraryDownloadUrl = export const minifiedLibraryDownloadUrl = `https://github.com/processing/p5.js/releases/download/v${p5Version}/p5.min.js` as const; export const cdnSoundUrl = - `https://cdn.jsdelivr.net/npm/p5.sound@${p5SoundVersion}` as const; + (!!import.meta.env?.PUBLIC_P5_LIBRARY_PATH || p5Version.startsWith('v2')) + ? `https://cdn.jsdelivr.net/npm/p5.sound@${p5SoundVersion}` as const + : `https://cdn.jsdelivr.net/npm/p5@${p5Version}/lib/addons/p5.sound.min.js` as const diff --git a/src/scripts/builders/reference.ts b/src/scripts/builders/reference.ts index 50fbce16b1..d72954c418 100644 --- a/src/scripts/builders/reference.ts +++ b/src/scripts/builders/reference.ts @@ -415,6 +415,7 @@ const convertDocsToMDX = async ( doc.example = correctRelativeLinksToExampleAssets( doc.example, ) as string[]; + doc.deprecated = (doc.deprecated ? (doc.deprecationMessage ?? true) : undefined) as any; const mdx = await convertToMDX(doc); return mdx ? { mdx, savePath, name: doc.name } : null; diff --git a/src/scripts/parsers/reference.ts b/src/scripts/parsers/reference.ts index 1395782e80..f49ae0bc21 100644 --- a/src/scripts/parsers/reference.ts +++ b/src/scripts/parsers/reference.ts @@ -27,6 +27,9 @@ export const parseLibraryReference = latestRelease = 'v' + latestRelease; } + const useExternalP5Sound = !!process.env.P5_REPO_BRANCH || + latestRelease.startsWith('v2'); + // Clone p5.js await cloneLibraryRepo( localPath, @@ -36,56 +39,68 @@ export const parseLibraryReference = ); // Install dependencies and build docs in the p5 repo - await createP5Docs('p5.js', 'data-p5') + await createP5Docs('p5.js', 'data-p5'); // If we're using a custom build of p5 instead of a public release, create // a build and copy it to the specified path if (process.env.PUBLIC_P5_LIBRARY_PATH) { - await createP5Build('p5.js', '../../../public' + process.env.PUBLIC_P5_LIBRARY_PATH) + await createP5Build('p5.js', '../../../public' + process.env.PUBLIC_P5_LIBRARY_PATH); } // Copy the reference output so we can process it const p5Data = await getYuidocOutput('data-p5'); if (!p5Data) throw new Error('Error generating p5 reference data!'); - // Clone p5.sound.js - await cloneLibraryRepo( - localSoundPath, - 'https://github.com/processing/p5.sound.js.git', - 'main' - ); - await saveYuidocOutput('p5.sound.js', 'data-sound'); - const soundData = await getYuidocOutput('data-sound'); - if (!soundData) throw new Error('Error generating p5.sound reference data!'); - - // Fix p5.sound classes - for (const key in soundData.classes) { - const newName = 'p5.' + soundData.classes[key].name; - const updated = { - ...soundData.classes[key], - name: newName, - }; - soundData.classes[newName] = updated; - delete soundData.classes[key]; - } - for (const item of soundData.classitems) { - item.class = 'p5.' + item.class; - } + let result; + if (useExternalP5Sound) { + console.log('Cloning separate p5.sound repo'); + + // Clone p5.sound.js + await cloneLibraryRepo( + localSoundPath, + 'https://github.com/processing/p5.sound.js.git', + 'main' + ); + await saveYuidocOutput('p5.sound.js', 'data-sound'); + const soundData = await getYuidocOutput('data-sound'); + if (!soundData) throw new Error('Error generating p5.sound reference data!'); + + // Fix p5.sound classes + for (const key in soundData.classes) { + const newName = 'p5.' + soundData.classes[key].name; + const updated = { + ...soundData.classes[key], + name: newName, + }; + soundData.classes[newName] = updated; + delete soundData.classes[key]; + } + for (const item of soundData.classitems) { + item.class = 'p5.' + item.class; + } - const combined = await combineYuidocData( - [ - p5Data, - soundData, - ], - 'data' - ); + result = await combineYuidocData( + [ + p5Data, + soundData, + ], + 'data' + ); + } else { + result = await combineYuidocData( + [ + p5Data, + ], + 'data' + ); + } await serveYuidocOutput('data'); //delete the cloned directories await cleanUpDirectory(parsersInPath ); await cleanUpDirectory(parsersOutPath ); - return combined; + return result; }; /** diff --git a/types/parsers.interface.ts b/types/parsers.interface.ts index 6833946a62..7dfdf23bbf 100644 --- a/types/parsers.interface.ts +++ b/types/parsers.interface.ts @@ -93,7 +93,8 @@ interface Chainable { } interface Deprecatable { - deprecated?: string; // If this item is deprecated, a description of why. + deprecated?: boolean; // If this item is deprecated, a description of why. + deprecationMessage?: string; // If this item is deprecated, a description of why. } /* Represents the return value of a method or constructor */