Skip to content

Commit 2bc8bab

Browse files
committed
Merge branch 'dev-2.0' of github.com:processing/p5.js into dev-2.0
2 parents 9f2eb56 + c6c96f6 commit 2bc8bab

31 files changed

+432
-368
lines changed

.github/workflows/release-workflow-v2.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ jobs:
4747
CI: true
4848
- name: Run build
4949
run: npm run build
50+
- name: Generate types
51+
run: npm run generate-types
5052

5153
# 2. Prepare release files
5254
- run: mkdir release && mkdir p5 && cp -r ./lib/* p5/

contributor_docs/creating_libraries.md

Lines changed: 138 additions & 120 deletions
Large diffs are not rendered by default.

docs/parameterData.json

Lines changed: 21 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -934,7 +934,7 @@
934934
"image": {
935935
"overloads": [
936936
[
937-
"p5.Image|p5.Element|p5.Texture|p5.Framebuffer|p5.FramebufferTexture",
937+
"p5.Image|p5.Element|p5.Texture|p5.Framebuffer|p5.FramebufferTexture|p5.Renderer|p5.Graphics",
938938
"Number",
939939
"Number",
940940
"Number?",
@@ -1427,14 +1427,7 @@
14271427
"createVector": {
14281428
"overloads": [
14291429
[
1430-
null
1431-
]
1432-
]
1433-
},
1434-
"createMatrix": {
1435-
"overloads": [
1436-
[
1437-
"Number[]"
1430+
"...Number[]"
14381431
]
14391432
]
14401433
},
@@ -1856,14 +1849,23 @@
18561849
},
18571850
"bezierOrder": {
18581851
"overloads": [
1859-
[],
18601852
[
18611853
"Number"
1862-
]
1854+
],
1855+
[]
18631856
]
18641857
},
18651858
"splineVertex": {
18661859
"overloads": [
1860+
[
1861+
"Number",
1862+
"Number"
1863+
],
1864+
[
1865+
"Number",
1866+
"Number",
1867+
"Number?"
1868+
],
18671869
[
18681870
"Number",
18691871
"Number",
@@ -1881,21 +1883,21 @@
18811883
},
18821884
"splineProperty": {
18831885
"overloads": [
1884-
[
1885-
"String"
1886-
],
18871886
[
18881887
"String",
18891888
null
1889+
],
1890+
[
1891+
"String"
18901892
]
18911893
]
18921894
},
18931895
"splineProperties": {
18941896
"overloads": [
1895-
[],
18961897
[
18971898
"Object"
1898-
]
1899+
],
1900+
[]
18991901
]
19001902
},
19011903
"vertex": {
@@ -1955,19 +1957,6 @@
19551957
]
19561958
]
19571959
},
1958-
"curveVertex": {
1959-
"overloads": [
1960-
[
1961-
"Number",
1962-
"Number"
1963-
],
1964-
[
1965-
"Number",
1966-
"Number",
1967-
"Number?"
1968-
]
1969-
]
1970-
},
19711960
"endShape": {
19721961
"overloads": [
19731962
[
@@ -2002,7 +1991,6 @@
20021991
"String",
20031992
"String?",
20041993
"Object?",
2005-
"String|String[]?",
20061994
"Function?",
20071995
"Function?"
20081996
],
@@ -2745,46 +2733,10 @@
27452733
],
27462734
[
27472735
"String|Request",
2748-
"Object?",
2749-
"String?",
2750-
"function(p5.Geometry)?",
2751-
"function(Event)?",
2752-
"Boolean?",
2753-
"Boolean?",
2754-
"Boolean?"
2736+
"Object?"
27552737
]
27562738
]
27572739
},
2758-
"parseObj": {
2759-
"overloads": [
2760-
[]
2761-
]
2762-
},
2763-
"parseSTL": {
2764-
"overloads": [
2765-
[]
2766-
]
2767-
},
2768-
"isBinary": {
2769-
"overloads": [
2770-
[]
2771-
]
2772-
},
2773-
"matchDataViewAt": {
2774-
"overloads": [
2775-
[]
2776-
]
2777-
},
2778-
"parseBinarySTL": {
2779-
"overloads": [
2780-
[]
2781-
]
2782-
},
2783-
"parseASCIISTL": {
2784-
"overloads": [
2785-
[]
2786-
]
2787-
},
27882740
"model": {
27892741
"overloads": [
27902742
[
@@ -2814,12 +2766,7 @@
28142766
[
28152767
"String",
28162768
"String?",
2817-
"Object?",
2818-
"function(p5.Geometry)?",
2819-
"function(Event)?",
2820-
"boolean?",
2821-
"boolean?",
2822-
"boolean?"
2769+
"Object?"
28232770
]
28242771
]
28252772
},
@@ -4519,9 +4466,7 @@
45194466
"Number",
45204467
"Number",
45214468
"Number",
4522-
"Object?",
4523-
"Number?",
4524-
"Number?"
4469+
"Object?"
45254470
]
45264471
]
45274472
}

package-lock.json

Lines changed: 2 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"node ./utils/sample-linter.mjs"
2424
]
2525
},
26-
"version": "2.0.1",
26+
"version": "2.0.2",
2727
"dependencies": {
2828
"@davepagurek/bezier-path": "^0.0.2",
2929
"@japont/unicode-range": "^1.0.0",
@@ -51,7 +51,6 @@
5151
"@vitest/browser": "^2.1.5",
5252
"all-contributors-cli": "^6.19.0",
5353
"concurrently": "^8.2.2",
54-
"dayjs": "^1.11.10",
5554
"documentation": "^14.0.3",
5655
"eslint": "^8.54.0",
5756
"glob": "^11.0.1",

rollup.config.mjs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import { string } from 'rollup-plugin-string';
44
import commonjs from '@rollup/plugin-commonjs';
55
import terser from '@rollup/plugin-terser';
66
import pkg from './package.json' with { type: 'json' };
7-
import dayjs from 'dayjs';
87
import { visualizer } from 'rollup-plugin-visualizer';
98
import replace from '@rollup/plugin-replace';
109
import alias from '@rollup/plugin-alias';
@@ -27,7 +26,7 @@ const plugins = [
2726
preventAssignment: true
2827
})
2928
];
30-
const banner = `/*! p5.js v${pkg.version} ${dayjs().format('MMMM D, YYYY')} */`;
29+
const banner = `/*! p5.js v${pkg.version} ${new Intl.DateTimeFormat('en-US', { month: 'long', day: 'numeric', year: 'numeric' }).format(new Date())} */`;
3130
const bundleSize = (name, sourcemap) => {
3231
return visualizer({
3332
filename: `analyzer/${name}.html`,
@@ -80,7 +79,7 @@ const generateModuleBuild = () => {
8079
plugins: [
8180
...plugins
8281
]
83-
}
82+
};
8483
});
8584
};
8685

src/accessibility/describe.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,11 @@ function describe(p5, fn){
7575
*
7676
* <div>
7777
* <code>
78+
*
79+
* function setup(){
80+
* createCanvas(100, 100);
81+
* };
82+
*
7883
* function draw() {
7984
* background(200);
8085
*
@@ -96,6 +101,11 @@ function describe(p5, fn){
96101
*
97102
* <div>
98103
* <code>
104+
*
105+
* function setup(){
106+
* createCanvas(100, 100);
107+
* }
108+
*
99109
* function draw() {
100110
* background(200);
101111
*

src/accessibility/outputs.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,11 @@ function outputs(p5, fn){
8181
*
8282
* <div>
8383
* <code>
84+
*
85+
* function setup(){
86+
* createCanvas(100, 100);
87+
* }
88+
*
8489
* function draw() {
8590
* // Add the text description.
8691
* textOutput();
@@ -101,6 +106,11 @@ function outputs(p5, fn){
101106
*
102107
* <div>
103108
* <code>
109+
*
110+
* function setup(){
111+
* createCanvas(100, 100);
112+
* }
113+
*
104114
* function draw() {
105115
* // Add the text description and
106116
* // display it for debugging.
@@ -215,6 +225,11 @@ function outputs(p5, fn){
215225
*
216226
* <div>
217227
* <code>
228+
*
229+
* function setup() {
230+
* createCanvas(100, 100);
231+
* }
232+
*
218233
* function draw() {
219234
* // Add the grid description.
220235
* gridOutput();
@@ -235,6 +250,11 @@ function outputs(p5, fn){
235250
*
236251
* <div>
237252
* <code>
253+
*
254+
* function setup(){
255+
* createCanvas(100, 100);
256+
* }
257+
*
238258
* function draw() {
239259
* // Add the grid description and
240260
* // display it for debugging.
@@ -255,6 +275,7 @@ function outputs(p5, fn){
255275
* </div>
256276
*/
257277

278+
258279
fn.gridOutput = function(display) {
259280
// p5._validateParameters('gridOutput', arguments);
260281
//if gridOutput is already true

src/color/p5.Color.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ class Color {
381381
* }
382382
* </code>
383383
* </div>
384-
**/
384+
*/
385385
setGreen(new_green, max=[0, 1]) {
386386
if(!Array.isArray(max)){
387387
max = [0, max];
@@ -492,7 +492,7 @@ class Color {
492492
* }
493493
* </code>
494494
* </div>
495-
**/
495+
*/
496496
setAlpha(new_alpha, max=[0, 1]) {
497497
if(!Array.isArray(max)){
498498
max = [0, max];

src/core/constants.js

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,29 @@ export const VERSION = 'VERSION_WILL_BE_REPLACED_BY_BUILD';
1515

1616
// GRAPHICS RENDERER
1717
/**
18-
* The default, two-dimensional renderer.
19-
* @typedef {unique symbol} P2D
18+
* The default, two-dimensional renderer in p5.js.
19+
*
20+
* Use this when calling <a href="#/p5/createCanvas"> (for example,
21+
* `createCanvas(400, 400, P2D)`) to specify a 2D context.
22+
*
23+
* @typedef {'p2d'} P2D
2024
* @property {P2D} P2D
2125
* @final
2226
*/
2327
export const P2D = 'p2d';
2428

29+
/**
30+
* A high-dynamic-range (HDR) variant of the default, two-dimensional renderer.
31+
*
32+
* When available, this mode can allow for extended color ranges and more
33+
* dynamic color representation. Use it similarly to `P2D`:
34+
* `createCanvas(400, 400, P2DHDR)`.
35+
*
36+
* @typedef {'p2d-hdr'} P2DHDR
37+
* @property {P2DHDR} P2DHDR
38+
* @final
39+
*/
40+
2541
export const P2DHDR = 'p2d-hdr';
2642

2743
/**

0 commit comments

Comments
 (0)