Skip to content

Commit e6c28bb

Browse files
authored
Merge branch 'main' into fix/default-camera-z
2 parents fb1fd73 + 0e42fcc commit e6c28bb

1,151 files changed

Lines changed: 11347 additions & 15809 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

astro.config.mjs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { defineConfig } from "astro/config";
1+
import { defineConfig, passthroughImageService } from "astro/config";
22
import preact from "@astrojs/preact";
33
import mdx from "@astrojs/mdx";
44
import compress from "astro-compress";
@@ -66,5 +66,11 @@ export default defineConfig({
6666
},
6767
image: {
6868
domains: ["openprocessing.org"],
69+
service: passthroughImageService()
70+
},
71+
markdown: {
72+
shikiConfig: {
73+
theme: 'github-light',
74+
},
6975
},
7076
});

package-lock.json

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

package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"build:contribute": "tsx ./src/scripts/builders/contribute.ts",
1414
"build:reference": "tsx ./src/scripts/builders/reference.ts",
1515
"build:search": "tsx ./src/scripts/builders/search.ts",
16+
"build:people": "tsx ./src/scripts/builders/people.ts",
1617
"test": "vitest",
1718
"build:examples": "node ./src/scripts/build-examples.js",
1819
"postprocess:links": "tsx ./src/scripts/postprocess-locale-relative-links.ts"
@@ -30,7 +31,9 @@
3031
"cheerio": "^1.0.0-rc.12",
3132
"cssnano": "^6.1.2",
3233
"fuse.js": "^7.0.0",
34+
"js-yaml": "^4.1.0",
3335
"keyword-extractor": "^0.0.28",
36+
"lodash": "^4.17.21",
3437
"preact": "^10.19.5",
3538
"tailwindcss": "^3.4.1",
3639
"typescript": "^5.3.3",
@@ -51,7 +54,9 @@
5154
"@preact/preset-vite": "^2.8.2",
5255
"@testing-library/preact": "^3.2.3",
5356
"@types/he": "^1.2.3",
57+
"@types/js-yaml": "^4.0.9",
5458
"@types/jsdom": "^21.1.6",
59+
"@types/lodash": "^4.17.1",
5560
"@types/node": "^20.11.19",
5661
"@typescript-eslint/eslint-plugin": "^7.0.2",
5762
"@typescript-eslint/parser": "^7.0.2",

public/search-indices/en.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

public/search-indices/es.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

public/search-indices/hi.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

public/search-indices/ko.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

public/search-indices/zh-Hans.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

src/api/OpenProcessing.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// SEE https://documenter.getpostman.com/view/16936458/2s9YC1Xa6X#intro
33

44
import type { AnyEntryMap, CollectionEntry } from "astro:content";
5+
import memoize from "lodash/memoize";
56

67
const openProcessingEndpoint = "https://openprocessing.org/api/";
78
/**
@@ -72,13 +73,13 @@ export type OpenProcessingSketchResponse = {
7273
* @param id
7374
* @returns
7475
*/
75-
export const getSketch = async (
76+
export const getSketch = memoize(async (
7677
id: string,
7778
): Promise<OpenProcessingSketchResponse> => {
7879
const response = await fetch(`${openProcessingEndpoint}sketch/${id}`);
7980
const payload = await response.json();
8081
return payload as OpenProcessingSketchResponse;
81-
};
82+
});
8283

8384
export const makeSketchLinkUrl = (id: string) =>
8485
`https://openprocessing.org/sketch/${id}`;
@@ -100,7 +101,7 @@ export function isCurationResponse<C extends keyof AnyEntryMap>(
100101
return "visualID" in item;
101102
}
102103

103-
export const getRandomCurationSketches = async (num = 4) => {
104+
export const getRandomCurationSketches = memoize(async (num = 4) => {
104105
const curationSketches = await getCurationSketches();
105106
const result: OpenProcessingCurationResponse = [];
106107
const usedIndices: Set<number> = new Set();
@@ -114,4 +115,4 @@ export const getRandomCurationSketches = async (num = 4) => {
114115
}
115116

116117
return result;
117-
};
118+
});

src/components/AnnotatedCode/index.astro

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ const code = rows.map((row) => row.code).join('');
5252
// Convert it to HTML with style tags
5353
const html = await codeToHtml(code, {
5454
lang: props.lang || 'javascript',
55-
theme: props.theme || 'github-dark',
55+
theme: props.theme || 'github-light',
5656
})
5757
5858
// Turn it into a DOM tree we can query
@@ -80,19 +80,20 @@ const getPreStyle = (i: number) => {
8080
if (i < rows.length-1) {
8181
style += 'border-bottom-left-radius:0;border-bottom-right-radius:0;'
8282
}
83+
style += 'margin:0;'
8384
return style;
8485
}
8586
const codeAttrs: Record<string, string> = {};
8687
for (const attr of codeTag.attributes) {
8788
codeAttrs[attr.name] = attr.value;
8889
}
8990
---
90-
<table class="h-1 my-md">
91+
<table class="h-1 my-md full-width">
9192
<tbody>
9293
{rows.map((row, i) => {
9394
const lineNodes = lines.slice(row.startLine, row.endLine);
9495
return (
95-
<tr class="[&>*]:align-top [&>*]:m-0 [&>*:not(:first-child)]:py-2 [&>*:not(:first-child)]:max-w-xl">
96+
<tr class="[&>*]:align-top [&>*]:m-0 [&>*:not(:first-child)]:py-2 [&>*:not(:first-child)]:pl-6 [&>*:not(:first-child)]:max-w-xl">
9697
<td class="align-top p-0" style="height:100%; margin:0">
9798
<pre {...preAttrs} style={`${getPreStyle(i)};height:100%`}><code {...codeAttrs} set:html={lineNodes.map((n) => n.outerHTML).join('\n')} /></pre>
9899
</td>

0 commit comments

Comments
 (0)