p5-wrapper / next Goto Github PK
View Code? Open in Web Editor NEWA NextJS specific library for the @P5-Wrapper/react project.
License: MIT License
A NextJS specific library for the @P5-Wrapper/react project.
License: MIT License
This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.
These updates are pending. To force PRs open, click the checkbox below.
@types/react
, @types/react-dom
).github/workflows/CD.yml
P5-wrapper/setup-action v1.0.6
P5-wrapper/setup-action v1.0.6
JS-DevTools/npm-publish v3
.github/workflows/CI.yml
P5-wrapper/setup-action v1.0.6
stefanzweifel/git-auto-commit-action v5.0.0
P5-wrapper/setup-action v1.0.6
stefanzweifel/git-auto-commit-action v5
P5-wrapper/setup-action v1.0.6
stefanzweifel/git-auto-commit-action v5
P5-wrapper/setup-action v1.0.6
P5-wrapper/setup-action v1.0.6
.github/workflows/CODEQL.yml
actions/checkout v4
github/codeql-action v2
github/codeql-action v2
package.json
next ^13.3.4
react ^18.2.0
react-dom ^18.2.0
@types/node ^20.0.0
@types/react ^18.2.0
@types/react-dom ^18.2.1
@vitejs/plugin-react ^4.0.0
rimraf ^5.0.0
typescript ^5.0.4
vite ^4.3.4
vite-plugin-dts ^3.0.0
@p5-wrapper/react >= 4.2.0
next >= 12.3.4
react >= 18.2.0
react-dom >= 18.2.0
I run into an issue when porting a cellular automaton I coded in standard p5.js to a Next.js project. I managed to isolate the bug that I suppose is responsible for the code not working. Here's the isolated issue:
The contents of index.js
import Head from 'next/head'
import Issue from '@/components/p5/Issue'
export default function Home() {
return (
<>
<Head>
<title>++test++</title>
<meta name="description" content="Generated by create next app" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
</Head>
<div className='w-screen h-screen relative'>
<Issue />
</div>
</>
)
}
The contents of issue.jsx
import React from "react";
import { NextReactP5Wrapper } from "@p5-wrapper/next";
const sketch = p5 => {
let board
let size = 10
p5.setup = () => {
p5.createCanvas(200, 200)
board = new Array(size);
for (let i = 0; i < size; i++) {
board[i] = new Array(size);
}
cokurwa()
}
const cokurwa = () => {
console.log('before for:', board)
console.log('before for:', board[1][0])
for (let i = 0; i < board.length; i++) {
board[i][0] = i;
}
console.log('after for:', board)
console.log('after for:', board[1][0])
console.log('==================')
}
}
const Issue = () => {
return (
<NextReactP5Wrapper sketch={sketch} />
)
}
export default Issue
sketch
function is executed onceconsole.log('before for:', board)
in cokurwa()
outputs a 2d array where each element is undefined
console.log('before for:', board[1][0])
in cokurwa()
outputs undefined
sketch
function is executed two times, instead of oneconsole.log('before for:', board)
seems to output contents of board
after the for loop has executedconsole.log('before for:', board[1][0])
outputs undefined
like it logically shouldcreate-next-app
setupPackage Version: "@p5-wrapper/next": "^0.2.0"
Sketch elements only contains one canvas
Sketch contains two? No clue why, but even in the most basic case when using the latest next.js, you get two sketches rendering.
The actual component renders it twice.
I've tried using p5-wrapper directly, with the same outcome.
I've made a minimal reproduction. Notice how this happens in app router, but not page router.
Package Version: 0.2.0
Have followed the steps in the @p5-wrapper/react documentation. However getting stuck at the top level await step. As that's not supported in the latest versions of nextjs using swc (instead of webpack)
Is there a way you can suggest I can import the sound plugin without top level await and get it to work.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.