diff --git a/contributor_docs/ko/method.example.js b/contributor_docs/ko/method.example.js index 72c889878b..782dd40111 100644 --- a/contributor_docs/ko/method.example.js +++ b/contributor_docs/ko/method.example.js @@ -1,5 +1,5 @@ /** - * "이것은 메소드의 인라인 문서 템플릿입니다. 이 템플릿을 사용하려면 큰 따옴표 + * "이것은 메소드의 인라인 문서 템플릿입니다. 이 템플릿을 사용하려면 큰 따옴표 * 사이의 모든 텍스트를 제거하십시오. 메소드에 대한 일부 설명은 여기에 들어갑니다. * 간단한 단어로 함수가 하는 일과 그에 대한 좋은/나쁜 사용 예를 설명하십시오. * 만약 비정상적인 케이스나 경고가 있다면 여기에서 설명해 주세요." @@ -31,7 +31,7 @@ * "두 번째 예시를 명확히 설명하는 줄입니다" */ -// "메소드에 둘 이상의 특징이 있으면, 각 특징은 다음과 같은 파라미터 설명과 함께 +// "메소드에 둘 이상의 특징이 있으면, 각 특징은 다음과 같은 파라미터 설명과 함께 // 자체 블록에 문서화할 수 있습니다." /** * @method "메소드명" @@ -46,11 +46,11 @@ p5.prototype.methodName = function() { // 이 부분은 템플릿을 채운 예시입니다. /** - * background() 함수는 p5.js 캔버스의 배경 색상을 - * 설정합니다. 이 함수는 일반적으로 draw()에서 각 프레임의 시작 부분에 디스플레이 - * 윈도우를 지우는 데 사용되지만, 애니메이션의 첫 번째 프레임에 배경색을 설정하거나 + * background() 함수는 p5.js 캔버스의 배경 색상을 + * 설정합니다. 이 함수는 일반적으로 draw()에서 각 프레임의 시작 부분에 디스플레이 + * 윈도우를 지우는 데 사용되지만, 애니메이션의 첫 번째 프레임에 배경색을 설정하거나 * 배경을 한 번만 설정해야 할 경우 setup() 내에서 사용할 수 있습니다. - * + * * 배경색 기본 설정은 투명입니다. * * @method background @@ -81,7 +81,7 @@ p5.prototype.methodName = function() { /** * @method background * @param {String} 문자열 형태의 색상 설정에 사용할 수 있는 형식: - 정수, rgb(), rgba(), rgb() 비율, rgba() 비율, + 정수, rgb(), rgba(), rgb() 비율, rgba() 비율, 3자리 16진법, 6자리 16진법, * @param {Number} [a] * @chainable diff --git a/contributor_docs/project_wrapups/slominski_gsoc_2022.md b/contributor_docs/project_wrapups/slominski_gsoc_2022.md index 4d00fc32e2..195f347136 100644 --- a/contributor_docs/project_wrapups/slominski_gsoc_2022.md +++ b/contributor_docs/project_wrapups/slominski_gsoc_2022.md @@ -47,6 +47,6 @@ The tutorials can be found on the p5.js websites Learn section here (to be added And the code and commits for these contributions can be found at (to be added): -##Acknowledgements +## Acknowledgements I want to express my gratitude towards my mentor Kate Hollenbach for her guidance throughout this project, as well as towards the p5.js community for its openness and helpfulness. diff --git a/docs/parameterData.json b/docs/parameterData.json index 3fc79dbeed..8b767d876b 100644 --- a/docs/parameterData.json +++ b/docs/parameterData.json @@ -4655,6 +4655,10 @@ }, "modify": { "overloads": [ + [ + "Function", + "Object?" + ], [ "Object?" ] diff --git a/eslint.config.mjs b/eslint.config.mjs index 040c2b7727..a691ea6ea0 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -80,7 +80,7 @@ const commonRules = { '@stylistic/max-len': [ warn, { - code: 80, + code: 120, ignoreComments: true, ignoreStrings: true, ignoreTemplateLiterals: true, @@ -272,4 +272,4 @@ export default defineConfig([ // * contributor_docs/zh-Hans/unit_testing.md 35:1 error Parsing error: Unexpected token // * rfc_p5js_2.md 205:50 error Parsing error: Binding arguments in strict mode // ...markdown.configs.processor -]); \ No newline at end of file +]); diff --git a/package.json b/package.json index c18ed30084..0e7ca1c1ab 100644 --- a/package.json +++ b/package.json @@ -69,20 +69,62 @@ "license": "LGPL-2.1", "browser": "./lib/p5.min.js", "exports": { - ".": "./dist/app.js", - "./core": "./dist/core/main.js", - "./shape": "./dist/shape/index.js", - "./accessibility": "./dist/accessibility/index.js", - "./friendlyErrors": "./dist/core/friendlyErrors/index.js", - "./data": "./dist/data/index.js", - "./dom": "./dist/dom/index.js", - "./events": "./dist/events/index.js", - "./image": "./dist/image/index.js", - "./io": "./dist/io/index.js", - "./math": "./dist/math/index.js", - "./utilities": "./dist/utilities/index.js", - "./webgl": "./dist/webgl/index.js", - "./type": "./dist/type/index.js" + ".": { + "default": "./dist/app.js", + "types": "./types/p5.d.ts" + }, + "./core": { + "default": "./dist/core/main.js", + "types": "./types/core/main.d.ts" + }, + "./shape": { + "default": "./dist/shape/index.js", + "types": "./types/shape/index.d.ts" + }, + "./accessibility": { + "default": "./dist/accessibility/index.js", + "types": "./types/accessibility/index.d.ts" + }, + "./friendly_errors": { + "default": "./dist/core/friendly_errors/index.js", + "types": "./types/core/friendly_errors/index.d.ts" + }, + "./data": { + "default": "./dist/data/index.js", + "types": "./types/data/index.d.ts" + }, + "./dom": { + "default": "./dist/dom/index.js", + "types": "./types/dom/index.d.ts" + }, + "./events": { + "default": "./dist/events/index.js", + "types": "./types/events/index.d.ts" + }, + "./image": { + "default": "./dist/image/index.js", + "types": "./types/image/index.d.ts" + }, + "./io": { + "default": "./dist/io/index.js", + "types": "./types/io/index.d.ts" + }, + "./math": { + "default": "./dist/math/index.js", + "types": "./types/math/index.d.ts" + }, + "./utilities": { + "default": "./dist/utilities/index.js", + "types": "./types/utilities/index.d.ts" + }, + "./webgl": { + "default": "./dist/webgl/index.js", + "types": "./types/webgl/index.d.ts" + }, + "./type": { + "default": "./dist/type/index.js", + "types": "./types/type/index.d.ts" + } }, "files": [ "dist/**", @@ -111,6 +153,5 @@ "workerDirectory": [ "test" ] - }, - "types": "./types/p5.d.ts" + } } diff --git a/src/color/p5.Color.js b/src/color/p5.Color.js index 8e2a9d8e82..a3dc0be40b 100644 --- a/src/color/p5.Color.js +++ b/src/color/p5.Color.js @@ -37,7 +37,7 @@ const map = (n, start1, stop1, start2, stop2, clamp) => { result = Math.min(result, Math.max(start2, stop2)); } return result; -} +}; const serializationMap = {}; @@ -547,11 +547,11 @@ class Color { let coords = structuredClone(to(this._color, 'srgb').coords); coords.push(this._color.alpha); - const rangeMaxes = maxes.map((v) => { + const rangeMaxes = maxes.map(v => { if(!Array.isArray(v)){ return [0, v]; }else{ - return v + return v; } }); diff --git a/src/core/friendly_errors/sketch_verifier.js b/src/core/friendly_errors/sketch_verifier.js index b8f6e70db6..c56c84b6de 100644 --- a/src/core/friendly_errors/sketch_verifier.js +++ b/src/core/friendly_errors/sketch_verifier.js @@ -24,7 +24,7 @@ const ignoreFunction = [ 'keyPressed', 'keyReleased', 'keyTyped', - 'windowResized', + 'windowResized' // 'name', // 'parent', // 'toString', diff --git a/src/image/filterRenderer2D.js b/src/image/filterRenderer2D.js index cd0a97fe0a..af3edbd1cc 100644 --- a/src/image/filterRenderer2D.js +++ b/src/image/filterRenderer2D.js @@ -257,9 +257,9 @@ class FilterRenderer2D { const identityMatrix = [1, 0, 0, 0, - 0, 1, 0, 0, - 0, 0, 1, 0, - 0, 0, 0, 1]; + 0, 1, 0, 0, + 0, 0, 1, 0, + 0, 0, 0, 1]; this._shader.setUniform('uModelViewMatrix', identityMatrix); this._shader.setUniform('uProjectionMatrix', identityMatrix); diff --git a/src/shape/curves.js b/src/shape/curves.js index b83a9dbfe0..d8c1c4a3a2 100644 --- a/src/shape/curves.js +++ b/src/shape/curves.js @@ -517,22 +517,22 @@ function curves(p5, fn){ * function setup() { * createCanvas(200, 200); * background(245); - * + * * // Ensure the curve includes both end spans p0->p1 and p2->p3 * splineProperty('ends', INCLUDE); - * + * * // Control / anchor points * const p0 = createVector(30, 160); * const p1 = createVector(60, 40); * const p2 = createVector(140, 40); * const p3 = createVector(170, 160); - * + * * // Draw the spline that passes through ALL four points (INCLUDE) * noFill(); * stroke(0); * strokeWeight(2); * spline(p0.x, p0.y, p1.x, p1.y, p2.x, p2.y, p3.x, p3.y); - * + * * // Draw markers + labels * fill(255); * stroke(0); @@ -541,19 +541,19 @@ function curves(p5, fn){ * circle(p1.x, p1.y, r); * circle(p2.x, p2.y, r); * circle(p3.x, p3.y, r); - * + * * noStroke(); * fill(0); * text('p0', p0.x - 14, p0.y + 14); * text('p1', p1.x - 14, p1.y - 8); * text('p2', p2.x + 4, p2.y - 8); * text('p3', p3.x + 4, p3.y + 14); - * + * * describe('A black Catmull-Rom spline passes through p0, p1, p2, p3 with endpoints included.'); * } * * - * + * *
* function setup() {
@@ -848,45 +848,45 @@ function curves(p5, fn){
* }
*
*
* let p0, p1, p2, p3;
- *
+ *
* function setup() {
* createCanvas(200, 200);
* splineProperty('ends', INCLUDE); // make endpoints part of the curve
- *
+ *
* // Four points forming a gentle arch
* p0 = createVector(30, 160);
* p1 = createVector(60, 50);
* p2 = createVector(140, 50);
* p3 = createVector(170, 160);
- *
+ *
* describe('Black spline through p0–p3. A red dot marks the location at parameter t on p1->p2 using splinePoint.');
* }
- *
+ *
* function draw() {
* background(245);
- *
+ *
* // Draw the spline for context
* noFill();
* stroke(0);
* strokeWeight(2);
* spline(p0.x, p0.y, p1.x, p1.y, p2.x, p2.y, p3.x, p3.y);
- *
+ *
* // Map mouse X to t in [0, 1] (span p1->p2)
* let t = constrain(map(mouseX, 0, width, 0, 1), 0, 1);
- *
+ *
* // Evaluate the curve point by axis (splinePoint works one axis at a time)
* let x = splinePoint(p0.x, p1.x, p2.x, p3.x, t);
* let y = splinePoint(p0.y, p1.y, p2.y, p3.y, t);
- *
+ *
* // Marker at the evaluated position
* noStroke();
* fill('red');
* circle(x, y, 8);
- *
+ *
* // Draw control/anchor points
* stroke(0);
* strokeWeight(1);
@@ -896,7 +896,7 @@ function curves(p5, fn){
* circle(p1.x, p1.y, r);
* circle(p2.x, p2.y, r);
* circle(p3.x, p3.y, r);
- *
+ *
* // Labels + UI hint
* noStroke();
* fill(20);
@@ -909,7 +909,7 @@ function curves(p5, fn){
* }
*
*
@@ -1833,44 +1833,44 @@ function customShapes(p5, fn) {
* let vertexD;
* let vertexE;
* let vertexF;
- *
+ *
* let markerRadius;
- *
+ *
* let vectorAB;
* let vectorFE;
- *
+ *
* let endOfTangentB;
* let endOfTangentE;
- *
+ *
* function setup() {
* createCanvas(100, 100);
- *
+ *
* // Initialize variables
* // Adjusting vertices A and F affects the slopes at B and E
- *
+ *
* vertexA = createVector(35, 85);
* vertexB = createVector(25, 70);
* vertexC = createVector(30, 30);
* vertexD = createVector(70, 30);
* vertexE = createVector(75, 70);
* vertexF = createVector(65, 85);
- *
+ *
* markerRadius = 4;
- *
+ *
* vectorAB = p5.Vector.sub(vertexB, vertexA);
* vectorFE = p5.Vector.sub(vertexE, vertexF);
- *
+ *
* endOfTangentB = p5.Vector.add(vertexC, vectorAB);
* endOfTangentE = p5.Vector.add(vertexD, vectorFE);
- *
+ *
* splineProperty(`ends`, EXCLUDE);
- *
+ *
* // Draw figure
- *
+ *
* background(220);
- *
+ *
* noFill();
- *
+ *
* beginShape();
* splineVertex(vertexA.x, vertexA.y);
* splineVertex(vertexB.x, vertexB.y);
@@ -1879,15 +1879,15 @@ function customShapes(p5, fn) {
* splineVertex(vertexE.x, vertexE.y);
* splineVertex(vertexF.x, vertexF.y);
* endShape();
- *
+ *
* stroke('red');
* line(vertexA.x, vertexA.y, vertexC.x, vertexC.y);
* line(vertexB.x, vertexB.y, endOfTangentB.x, endOfTangentB.y);
- *
+ *
* stroke('blue');
* line(vertexD.x, vertexD.y, vertexF.x, vertexF.y);
* line(vertexE.x, vertexE.y, endOfTangentE.x, endOfTangentE.y);
- *
+ *
* fill('white');
* stroke('black');
* circle(vertexA.x, vertexA.y, markerRadius);
@@ -1896,7 +1896,7 @@ function customShapes(p5, fn) {
* circle(vertexD.x, vertexD.y, markerRadius);
* circle(vertexE.x, vertexE.y, markerRadius);
* circle(vertexF.x, vertexF.y, markerRadius);
- *
+ *
* fill('black');
* noStroke();
* text('A', vertexA.x - 15, vertexA.y + 5);
@@ -1905,7 +1905,7 @@ function customShapes(p5, fn) {
* text('D', vertexD.x - 5, vertexD.y - 5);
* text('E', vertexE.x + 5, vertexE.y + 5);
* text('F', vertexF.x + 5, vertexF.y + 5);
- *
+ *
* describe('On a gray background, a black spline passes through vertices A, B, C, D, E, and F, shown as white circles. A red line segment joining vertices A and C has the same slope as the red tangent segment at B. Similarly, the blue line segment joining vertices D and F has the same slope as the blue tangent at E.');
* }
*
@@ -2069,7 +2069,7 @@ function customShapes(p5, fn) {
* spline(25, 46, 93, 44, 93, 81, 35, 85);
* ```
*
* let vertexA;
@@ -2196,44 +2196,44 @@ function customShapes(p5, fn) {
* let vertexD;
* let vertexE;
* let vertexF;
- *
+ *
* let markerRadius;
- *
+ *
* let vectorAB;
* let vectorFE;
- *
+ *
* let endOfTangentB;
* let endOfTangentE;
- *
+ *
* function setup() {
* createCanvas(100, 100);
- *
+ *
* // Initialize variables
* // Adjusting vertices A and F affects the slopes at B and E
- *
+ *
* vertexA = createVector(35, 85);
* vertexB = createVector(25, 70);
* vertexC = createVector(30, 30);
* vertexD = createVector(70, 30);
* vertexE = createVector(75, 70);
* vertexF = createVector(65, 85);
- *
+ *
* markerRadius = 4;
- *
+ *
* vectorAB = p5.Vector.sub(vertexB, vertexA);
* vectorFE = p5.Vector.sub(vertexE, vertexF);
- *
+ *
* endOfTangentB = p5.Vector.add(vertexC, vectorAB);
* endOfTangentE = p5.Vector.add(vertexD, vectorFE);
- *
+ *
* splineProperty(`ends`, EXCLUDE);
- *
+ *
* // Draw figure
- *
+ *
* background(220);
- *
+ *
* noFill();
- *
+ *
* beginShape();
* splineVertex(vertexA.x, vertexA.y);
* splineVertex(vertexB.x, vertexB.y);
@@ -2242,15 +2242,15 @@ function customShapes(p5, fn) {
* splineVertex(vertexE.x, vertexE.y);
* splineVertex(vertexF.x, vertexF.y);
* endShape();
- *
+ *
* stroke('red');
* line(vertexA.x, vertexA.y, vertexC.x, vertexC.y);
* line(vertexB.x, vertexB.y, endOfTangentB.x, endOfTangentB.y);
- *
+ *
* stroke('blue');
* line(vertexD.x, vertexD.y, vertexF.x, vertexF.y);
* line(vertexE.x, vertexE.y, endOfTangentE.x, endOfTangentE.y);
- *
+ *
* fill('white');
* stroke('black');
* circle(vertexA.x, vertexA.y, markerRadius);
@@ -2259,7 +2259,7 @@ function customShapes(p5, fn) {
* circle(vertexD.x, vertexD.y, markerRadius);
* circle(vertexE.x, vertexE.y, markerRadius);
* circle(vertexF.x, vertexF.y, markerRadius);
- *
+ *
* fill('black');
* noStroke();
* text('A', vertexA.x - 15, vertexA.y + 5);
@@ -2268,12 +2268,12 @@ function customShapes(p5, fn) {
* text('D', vertexD.x - 5, vertexD.y - 5);
* text('E', vertexE.x + 5, vertexE.y + 5);
* text('F', vertexF.x + 5, vertexF.y + 5);
- *
+ *
* describe('On a gray background, a black spline passes through vertices A, B, C, D, E, and F, shown as white circles. A red line segment joining vertices A and C has the same slope as the red tangent segment at B. Similarly, the blue line segment joining vertices D and F has the same slope as the blue tangent at E.');
* }
*
*