Skip to content

Commit aac802d

Browse files
authored
Merge branch 'develop' into pr05_finals_clientModulesUser
2 parents 12b1f7c + 15c7797 commit aac802d

47 files changed

Lines changed: 1747 additions & 497 deletions

Some content is hidden

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

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ I have verified that this pull request:
66

77
* [ ] has no linting errors (`npm run lint`)
88
* [ ] has no test errors (`npm run test`)
9+
* [ ] has no typecheck errors (`npm run typecheck`)
910
* [ ] is from a uniquely-named feature branch and is up to date with the `develop` branch.
1011
* [ ] is descriptively named and links to an issue number, i.e. `Fixes #123`
1112
* [ ] meets the standards outlined in the [accessibility guidelines](https://github.com/processing/p5.js-web-editor/blob/develop/contributor_docs/accessibility.md)

README.md

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -10,45 +10,36 @@ We are a community of, and in solidarity with, people from every gender identity
1010

1111
Learn more about [our community](https://p5js.org/community/) and read our [Community Statement and Code of Conduct](./.github/CODE_OF_CONDUCT.md). You can directly support our work with p5.js by [donating to the Processing Foundation](https://processingfoundation.org/support).
1212

13-
Stay in touch with Processing Foundation across other platforms:
13+
Stay in touch with Processing Foundation across other platforms:
14+
1415
- [Instagram](https://www.instagram.com/p5xjs)
1516
- [Youtube](https://www.youtube.com/@ProcessingFoundation)
1617
- [X](https://x.com/p5xjs)
1718
- [Discord](https://discord.com/invite/esmGA6H6wm)
1819
- [Forum](https://discourse.processing.org)
1920

20-
2121
## Using the p5.js Editor 🤔
2222

23-
Make your first sketch in the [p5.js Editor](https://editor.p5js.org/)! Learn more about sketching with p5.js on the [Get Started](https://p5js.org/tutorials/get-started/) and find everything you can do in the [Reference](https://p5js.org/reference/). You can also look at [examples](https://editor.p5js.org/p5/sketches) and remix them in the p5.js Editor.
23+
Make your first sketch in the [p5.js Editor](https://editor.p5js.org/)! Learn more about sketching with p5.js on the [Get Started](https://p5js.org/tutorials/get-started/) and find everything you can do in the [Reference](https://p5js.org/reference/). You can also look at [examples](https://editor.p5js.org/p5/sketches) and remix them in the p5.js Editor.
2424

25-
For more information on usage guidelines for the p5.js Editor, check out the [p5.js Editor Terms of Use](https://editor.p5js.org/terms-of-use). To gain better insight into how we handle user data and data privacy, refer to the [p5.js Editor Privacy Policy](https://editor.p5js.org/privacy-policy).
25+
For more information on usage guidelines for the p5.js Editor, check out the [p5.js Editor Terms of Use](https://editor.p5js.org/terms-of-use). To gain better insight into how we handle user data and data privacy, refer to the [p5.js Editor Privacy Policy](https://editor.p5js.org/privacy-policy).
2626

2727
## Contributing 📖 🐛 🎨
2828

29-
The p5.js Editor is a collaborative project created by many individuals, mostly volunteers, and you are invited to help. All types of involvement are welcome. To get started with contributing to the p5.js Editor, we recommend exploring the following resources in order:
29+
The p5.js Editor is a collaborative project created by many individuals, mostly volunteers, and you are invited to help. All types of involvement are welcome. To get started with contributing to the p5.js Editor, we recommend exploring the following resources in order:
3030

3131
1. [p5.js Community Statement and Code of Conduct](https://editor.p5js.org/code-of-conduct) - Read our Community Statement and Code of Conduct to understand the values that guide our community and how to participate respectfully and constructively.
3232

3333
2. [Contributor Docs](https://github.com/processing/p5.js-web-editor/blob/develop/contributor_docs/README.md) - For a deeper look at how to get involved with the p5.js Editor, check out our Contributor Docs for more in-depth details about contributing to different areas of the project, including code, bug fixes, documentation, discussion, and more.
3434

3535
3. [All Contributors list on the p5.js repository](https://github.com/processing/p5.js?tab=readme-ov-file#contributors) - Explore the All Contributors list to see the wide range of contributions by our amazing community!
3636

37-
> **TypeScript Migration:**
38-
> As of July 2025, we are working on migrating the repo to TypeScript as part of the **[p5.js Web Editor pr05 Grant](https://github.com/processing/pr05-grant/wiki/2025-pr05-Program-Page)**.
39-
> This migration will occur in two phases:
40-
> 1. **Grant Work (July – October 31, 2025)** – Setting up TypeScript configuration, tooling, and starting partial migration. Contributions will be **closed** during this period.
41-
> 2. **Open Contribution (After October 31, 2025)** – TypeScript migration tasks will **open** to all contributors, with guidelines and tutorials available.
37+
> **TypeScript Migration:** We have initiated migrating the repo to Typescript as part of the **[p5.js Web Editor pr05 Grant](https://github.com/processing/pr05-grant/wiki/2025-pr05-Program-Page)**, and the repo is now open to migration contributions.
4238
>
43-
> For full details, see [TypeScript Migration Plan](./contributor_docs/typescript-migration.md).
39+
> Please see [Typescript Migration](contributor_docs/typescript_migration.md) for migration guidelines. Please see [2025 pr05 Typescript Migration Project](contributor_docs/pr05_2025_typescript_migration/index.md) for details and technical decisions for the migration project.
4440
4541
## Acknowledgements 🙏
4642

47-
Support for this project has come from [Processing Foundation](https://processingfoundation.org/), [NYU ITP](https://tisch.nyu.edu/itp), [CS4All, NYC DOE](http://cs4all.nyc/), [COSA at DU](https://liberalarts.du.edu/emergent-digital-practices/open-source-arts), [STUDIO for Creative Inquiry](https://studioforcreativeinquiry.org/), [Grant for the Web](https://www.grantfortheweb.org/), [New Media Rights](https://www.newmediarights.org/), and many others.
43+
Support for this project has come from [Processing Foundation](https://processingfoundation.org/), [NYU ITP](https://tisch.nyu.edu/itp), [CS4All, NYC DOE](http://cs4all.nyc/), [COSA at DU](https://liberalarts.du.edu/emergent-digital-practices/open-source-arts), [STUDIO for Creative Inquiry](https://studioforcreativeinquiry.org/), [Grant for the Web](https://www.grantfortheweb.org/), [New Media Rights](https://www.newmediarights.org/), and many others.
4844

49-
Hosting and technical support has come from:
50-
<br />
51-
<br />
52-
<a href="https://releasehub.com/" target="_blank"><img width="100" src="https://assets.website-files.com/603dd147c5b0a480611bd348/603dd147c5b0a469bc1bd451_logo--dark.svg" /></a>
53-
<br />
54-
<a href="https://www.browserstack.com/" target="_blank"><img width="100" src="https://user-images.githubusercontent.com/6063380/46976166-ab280a80-d096-11e8-983b-18dd38c8cc9b.png" /></a>
45+
Hosting and technical support has come from: <br /> <br /> <a href="https://releasehub.com/" target="_blank"><img width="100" src="https://assets.website-files.com/603dd147c5b0a480611bd348/603dd147c5b0a469bc1bd451_logo--dark.svg" /></a> <br /> <a href="https://www.browserstack.com/" target="_blank"><img width="100" src="https://user-images.githubusercontent.com/6063380/46976166-ab280a80-d096-11e8-983b-18dd38c8cc9b.png" /></a>

client/index.jsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,10 @@ const store = setupStore(initialState);
2323

2424
const DONATE_LOGO_IMAGE_URL = 'https://donorbox.org/images/white_logo.svg';
2525

26+
const showDonateCampaign = false;
27+
2628
if (
29+
showDonateCampaign &&
2730
window.location.href.indexOf('full') === -1 &&
2831
window.location.href.indexOf('embed') === -1
2932
) {
Lines changed: 40 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import React from 'react';
2-
import PropTypes from 'prop-types';
32
import { useSelector } from 'react-redux';
43
import { Helmet } from 'react-helmet';
54
import { useTranslation } from 'react-i18next';
65
import { Link } from 'react-router-dom';
76

7+
import type { TFunction } from 'react-i18next';
88
import {
99
AboutPageContent,
1010
Intro,
@@ -27,8 +27,34 @@ import packageData from '../../../../package.json';
2727
import HeartIcon from '../../../images/heart.svg';
2828
import AsteriskIcon from '../../../images/p5-asterisk.svg';
2929
import LogoIcon from '../../../images/p5js-square-logo.svg';
30+
import { RootState } from '../../../reducers';
3031

31-
const AboutSection = ({ section, t }) => (
32+
export interface AboutSectionInfoItem {
33+
url: string;
34+
title: string;
35+
description: string;
36+
}
37+
export interface AboutSectionInfoSection {
38+
header: string;
39+
items: AboutSectionInfoItem[];
40+
}
41+
export interface ContactSectionLink {
42+
label: string;
43+
href: string;
44+
}
45+
46+
export interface AboutSectionProps {
47+
section: AboutSectionInfoSection;
48+
t: TFunction<'translation'>;
49+
}
50+
51+
const AboutSection = ({
52+
section,
53+
t
54+
}: {
55+
section: AboutSectionInfoSection;
56+
t: TFunction<'translation'>;
57+
}) => (
3258
<Section>
3359
<h2>{t(section.header)}</h2>
3460
<SectionContainer>
@@ -47,11 +73,15 @@ const AboutSection = ({ section, t }) => (
4773
</Section>
4874
);
4975

50-
const About = () => {
76+
export const About = () => {
5177
const { t } = useTranslation();
5278

53-
const p5version = useSelector((state) => {
54-
const index = state.files.find((file) => file.name === 'index.html');
79+
const p5version = useSelector((state: RootState) => {
80+
const index = state.files.find(
81+
(file: {
82+
name: string /** TODO: update once files types are defined in server */;
83+
}) => file.name === 'index.html'
84+
);
5585
return index?.content.match(/\/p5@([\d.]+)\//)?.[1];
5686
});
5787

@@ -91,7 +121,11 @@ const About = () => {
91121
</Intro>
92122

93123
{AboutSectionInfo.map((section) => (
94-
<AboutSection key={t(section.header)} section={section} t={t} />
124+
<AboutSection
125+
key={t(section.header) as string}
126+
section={section}
127+
t={t}
128+
/>
95129
))}
96130

97131
<Contact>
@@ -152,19 +186,3 @@ const About = () => {
152186
</RootPage>
153187
);
154188
};
155-
156-
AboutSection.propTypes = {
157-
section: PropTypes.shape({
158-
header: PropTypes.string.isRequired,
159-
items: PropTypes.arrayOf(
160-
PropTypes.shape({
161-
url: PropTypes.string.isRequired,
162-
title: PropTypes.string.isRequired,
163-
description: PropTypes.string.isRequired
164-
})
165-
).isRequired
166-
}).isRequired,
167-
t: PropTypes.func.isRequired
168-
};
169-
170-
export default About;
Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
export const ContactSectionLinks = [
1+
import type {
2+
ContactSectionLink,
3+
AboutSectionInfoSection
4+
} from '../pages/About';
5+
6+
export const ContactSectionLinks: ContactSectionLink[] = [
27
{
38
label: 'About.Github',
49
href: 'https://github.com/processing/p5.js-web-editor'
@@ -22,7 +27,7 @@ export const ContactSectionLinks = [
2227
}
2328
];
2429

25-
export const AboutSectionInfo = [
30+
export const AboutSectionInfo: AboutSectionInfoSection[] = [
2631
{
2732
header: 'About.NewP5',
2833
items: [

client/modules/IDE/components/Banner.jsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import React from 'react';
22
import PropTypes from 'prop-types';
3+
import { Trans } from 'react-i18next';
34
import { CrossIcon } from '../../../common/icons';
45

56
/**
@@ -23,12 +24,11 @@ import { CrossIcon } from '../../../common/icons';
2324

2425
const Banner = ({ onClose }) => {
2526
// URL can be updated depending on the opportunity or announcement.
26-
const bannerURL = 'https://openprocessing.org/curation/89576';
27+
const bannerURL = 'https://processingfoundation.org/donate';
28+
2729
const bannerCopy = (
2830
<>
29-
We’re accepting p5.js sketches for a special curation exploring mental
30-
health and the newest features in p5.js 2.0!{' '}
31-
<span style={{ fontWeight: 600 }}>Submit by July 20!</span>
31+
<Trans i18nKey="Banner.Copy" components={{ bold: <strong /> }} />
3232
</>
3333
);
3434

client/modules/IDE/components/Preferences/index.jsx

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,8 @@ import {
2121
setLinewrap,
2222
setPreferencesTab
2323
} from '../../actions/preferences';
24-
import {
25-
majorVersion,
26-
p5SoundURL,
27-
p5URL,
28-
useP5Version
29-
} from '../../hooks/useP5Version';
24+
import { majorVersion, p5URL, useP5Version } from '../../hooks/useP5Version';
25+
import { p5SoundURL } from '../../../../../common/p5URLs';
3026
import VersionPicker from '../VersionPicker';
3127
import { updateFileContent } from '../../actions/files';
3228
import { CmControllerContext } from '../../pages/IDEView';

client/modules/IDE/components/VersionPicker.jsx

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,23 @@ const VersionPicker = React.forwardRef(({ onChangeVersion }, ref) => {
7777
return (
7878
<VersionDropdownMenu
7979
className="versionPicker"
80+
aria-label="Select p5.js version"
8081
anchor={
8182
<VersionPickerButton ref={ref}>
82-
<VersionPickerText>{versionInfo.version}</VersionPickerText>
83+
<VersionPickerText>
84+
{versionInfo
85+
? (() => {
86+
const current = p5Versions.find((v) =>
87+
typeof v === 'string'
88+
? v === versionInfo.version
89+
: v.version === versionInfo.version
90+
);
91+
if (!current) return versionInfo.version;
92+
if (typeof current === 'string') return current;
93+
return `${current.version} ${current.label}`;
94+
})()
95+
: t('Toolbar.CustomLibraryVersion')}
96+
</VersionPickerText>
8397
<VersionPickerArrow>
8498
<DropdownArrowIcon />
8599
</VersionPickerArrow>
@@ -88,11 +102,20 @@ const VersionPicker = React.forwardRef(({ onChangeVersion }, ref) => {
88102
align="left"
89103
maxHeight="50vh"
90104
>
91-
{p5Versions.map((version) => (
92-
<MenuItem key={version} onClick={() => dispatchReplaceVersion(version)}>
93-
{version}
94-
</MenuItem>
95-
))}
105+
{p5Versions.map((item) => {
106+
const version = typeof item === 'string' ? item : item.version;
107+
const label =
108+
typeof item === 'string' ? item : `${item.version} ${item.label}`;
109+
110+
return (
111+
<MenuItem
112+
key={version}
113+
onClick={() => dispatchReplaceVersion(version)}
114+
>
115+
{label}
116+
</MenuItem>
117+
);
118+
})}
96119
</VersionDropdownMenu>
97120
);
98121
});

client/modules/IDE/hooks/useP5Version.jsx

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,22 @@ import React, { useContext, useMemo } from 'react';
33
import { useSelector } from 'react-redux';
44
import PropTypes from 'prop-types';
55
import { currentP5Version, p5Versions } from '../../../../common/p5Versions';
6+
import {
7+
p5SoundURLOldTemplate,
8+
p5SoundURL,
9+
p5PreloadAddonURL,
10+
p5ShapesAddonURL,
11+
p5DataAddonURL,
12+
p5URLTemplate
13+
} from '../../../../common/p5URLs';
614

715
export const majorVersion = (version) => version.split('.')[0];
816

9-
export const p5SoundURLOldTemplate =
10-
'https://cdnjs.cloudflare.com/ajax/libs/p5.js/$VERSION/addons/p5.sound.min.js';
1117
export const p5SoundURLOld = p5SoundURLOldTemplate.replace(
1218
'$VERSION',
1319
currentP5Version
1420
);
15-
export const p5SoundURL =
16-
'https://cdn.jsdelivr.net/npm/p5.sound@0.2.0/dist/p5.sound.min.js';
17-
export const p5PreloadAddonURL =
18-
'https://cdn.jsdelivr.net/npm/p5.js-compatibility@0.1.2/src/preload.js';
19-
export const p5ShapesAddonURL =
20-
'https://cdn.jsdelivr.net/npm/p5.js-compatibility@0.1.2/src/shapes.js';
21-
export const p5DataAddonURL =
22-
'https://cdn.jsdelivr.net/npm/p5.js-compatibility@0.1.2/src/data.js';
23-
export const p5URL = `https://cdn.jsdelivr.net/npm/p5@${currentP5Version}/lib/p5.js`;
21+
export const p5URL = p5URLTemplate.replace('$VERSION', currentP5Version);
2422

2523
const P5VersionContext = React.createContext({});
2624

@@ -62,7 +60,10 @@ export function P5VersionProvider(props) {
6260
if (!match) return null;
6361

6462
// See if this is a version we recognize
65-
if (p5Versions.includes(match[1])) {
63+
const versionExists = p5Versions.some((v) =>
64+
typeof v === 'string' ? v === match[1] : v.version === match[1]
65+
);
66+
if (versionExists) {
6667
return { version: match[1], minified: !!match[2], scriptNode };
6768
}
6869
return null;

0 commit comments

Comments
 (0)