Skip to content

Commit d24e909

Browse files
committed
Update layouts and build scripts to work with webgpu
1 parent 229269f commit d24e909

File tree

7 files changed

+15
-5
lines changed

7 files changed

+15
-5
lines changed

src/components/CodeEmbed/index.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export const CodeEmbed = (props) => {
3939
);
4040

4141
let { previewWidth, previewHeight } = props;
42-
const canvasMatch = /createCanvas\(\s*(\d+),\s*(\d+)\s*(?:,\s*(?:\w+\.)?(?:P2D|WEBGL)\s*)?\)/m.exec(initialCode);
42+
const canvasMatch = /createCanvas\(\s*(\d+),\s*(\d+)\s*(?:,\s*(?:\w+\.)?(?:P2D|WEBGL|WEBGPU)\s*)?\)/m.exec(initialCode);
4343
if (canvasMatch) {
4444
previewWidth = previewWidth || parseFloat(canvasMatch[1]);
4545
previewHeight = previewHeight || parseFloat(canvasMatch[2]);

src/layouts/ReferenceItemLayout.astro

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,13 +127,13 @@ function normalizeP5ReferenceLinks(html: string | undefined): string | undefined
127127
)}
128128
{entry.data.webgpu && (
129129
<div class="experimental">
130-
<p>
130+
<h5>
131131
<div
132132
class="inline-block mr-2 w-[20px] h-[20px] mb-[-2px]"
133-
set:html={flask}
133+
set:html={warning}
134134
/>
135135
{t('webgpuAddon')}
136-
</p>
136+
</h5>
137137
</div>
138138
)}
139139
{entry.data.deprecated && (

src/scripts/branchTest.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ if (!match) {
1717
const repoUrl = match[1];
1818
const branch = match[2];
1919

20-
const envVars = [`PUBLIC_P5_LIBRARY_PATH='/p5.min.js'`, `P5_REPO_URL='${repoUrl}'`, `P5_BRANCH='${branch}'`];
20+
const envVars = [`PUBLIC_P5_LIBRARY_PATH='/p5.min.js'`, `PUBLIC_P5_WEBGPU_LIBRARY_PATH='/p5.webgpu.js'`, `P5_REPO_URL='${repoUrl}'`, `P5_BRANCH='${branch}'`];
2121
const env = envVars.join(' ');
2222

2323
const envFilePath = path.join(__dirname, '../../.env');

src/scripts/builders/reference.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,7 @@ const getMethodFrontmatter = (doc: ReferenceClassItemMethod) => {
314314
itemtype,
315315
chainable: doc.chainable === 1,
316316
beta: doc.beta ? !!doc.beta : undefined,
317+
webgpu: doc.webgpu ? !!doc.webgpu : undefined,
317318
};
318319
};
319320

src/scripts/resetBranchTest.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ async function main() {
2929
if (existsSync(p5BuildPath)) {
3030
rmSync(p5BuildPath);
3131
}
32+
33+
const p5WebGPUBuildPath = path.join(__dirname, '../../public/p5.webgpu.js');
34+
if (existsSync(p5WebGPUBuildPath)) {
35+
rmSync(p5WebGPUBuildPath);
36+
}
3237
}
3338

3439
main().then(() => process.exit(0))

styles/global.scss

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,9 @@ pre.code-box,
311311
& h5 {
312312
font-weight: bold;
313313
margin-bottom: var(--spacing-sm);
314+
&:last-child {
315+
margin-bottom: 0;
316+
}
314317
}
315318
}
316319

types/parsers.interface.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ interface Return {
106106

107107
interface MaybeBeta {
108108
beta?: number;
109+
webgpu?: number;
109110
}
110111

111112
/* Represents a method within a class */

0 commit comments

Comments
 (0)