Skip to content

Commit 8308700

Browse files
committed
Merge branch 'develop' into develop-codemirror-v6
2 parents 7b58f6d + 5f4840c commit 8308700

File tree

207 files changed

+16596
-7744
lines changed

Some content is hidden

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

207 files changed

+16596
-7744
lines changed

.eslintrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@
135135
"import/no-extraneous-dependencies": "off",
136136
"no-unused-vars": "off",
137137
"import/no-default-export": "warn",
138-
"no-underscore-dangle": "warn",
138+
"no-underscore-dangle": "off",
139139
"react/require-default-props": "off",
140140
"no-shadow": "off",
141141
"@typescript-eslint/no-shadow": "error"

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +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`
12+
* [ ] meets the standards outlined in the [accessibility guidelines](https://github.com/processing/p5.js-web-editor/blob/develop/contributor_docs/accessibility.md)

.github/workflows/test.yml

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,12 @@ jobs:
77
name: Test and lint code base
88
runs-on: ubuntu-latest
99
steps:
10-
- uses: actions/checkout@v2
11-
- name: Use Node.js
12-
uses: actions/setup-node@v1
13-
with:
14-
node-version: '18.20.x'
15-
- run: npm install
16-
- run: npm run test
17-
- run: npm run lint
18-
19-
10+
- uses: actions/checkout@v2
11+
- name: Use Node.js
12+
uses: actions/setup-node@v1
13+
with:
14+
node-version: '18.20.x'
15+
- run: npm install
16+
- run: npm run test
17+
- run: npm run typecheck
18+
- run: npm run lint

.storybook/preview.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@ import React from 'react';
22
import { Provider } from 'react-redux';
33
import { MemoryRouter } from 'react-router';
44

5-
import configureStore from '../client/store';
5+
import { setupStore } from '../client/store';
66
import '../client/i18n-test';
7-
import '../client/styles/storybook.css'
7+
import '../client/styles/storybook.css';
88
import { withThemeProvider, themeToolbarItem } from './decorator-theme';
99

1010
const initialState = window.__INITIAL_STATE__;
1111

12-
const store = configureStore(initialState);
12+
const store = setupStore(initialState);
1313

1414
export const decorators = [
1515
(Story) => (

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/common/Button.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ export interface ButtonProps extends React.HTMLAttributes<HTMLElement> {
8080
/**
8181
* If using a native button, specifies on an onClick action
8282
*/
83-
onClick?: () => void;
83+
onClick?: (evt: React.MouseEvent<HTMLButtonElement>) => void;
8484
/**
8585
* If using a button, then type is defines the type of button
8686
*/
Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,25 @@ import Filter from '../images/filter.svg';
2626
import Cross from '../images/cross.svg';
2727
import Copy from '../images/copy.svg';
2828

29+
export interface IconColors {
30+
default?: string;
31+
hover?: string;
32+
}
33+
34+
export interface IconProps extends React.SVGProps<SVGSVGElement> {
35+
'aria-label'?: string;
36+
Icon?: IconColors;
37+
}
38+
2939
// HOC that adds the right web accessibility props
3040
// https://www.scottohara.me/blog/2019/05/22/contextual-images-svgs-and-a11y.html
3141

3242
// could also give these a default size, color, etc. based on the theme
3343
// Need to add size to these - like small icon, medium icon, large icon. etc.
34-
function withLabel(SvgComponent) {
35-
const StyledIcon = styled(SvgComponent)`
44+
function withLabel(
45+
SvgComponent: React.ComponentType<React.SVGProps<SVGSVGElement>>
46+
) {
47+
const StyledIcon = styled(SvgComponent)<IconProps>`
3648
&&& {
3749
color: ${(props) => props.Icon?.default};
3850
& g,
@@ -53,27 +65,27 @@ function withLabel(SvgComponent) {
5365
}
5466
`;
5567

56-
const Icon = (props) => {
57-
const { 'aria-label': ariaLabel } = props;
68+
// Necessary because styled components inject a different type for the ref prop
69+
type StyledIconProps = Omit<
70+
React.ComponentProps<typeof StyledIcon>,
71+
'ref'
72+
> & {
73+
ref?: React.Ref<SVGSVGElement>;
74+
};
75+
76+
const Icon = (props: StyledIconProps) => {
77+
const { 'aria-label': ariaLabel, ...rest } = props;
5878
if (ariaLabel) {
5979
return (
6080
<StyledIcon
61-
{...props}
81+
{...rest}
6282
aria-label={ariaLabel}
6383
role="img"
6484
focusable="false"
6585
/>
6686
);
6787
}
68-
return <StyledIcon {...props} aria-hidden focusable="false" />;
69-
};
70-
71-
Icon.propTypes = {
72-
'aria-label': PropTypes.string
73-
};
74-
75-
Icon.defaultProps = {
76-
'aria-label': null
88+
return <StyledIcon {...rest} aria-hidden focusable="false" />;
7789
};
7890

7991
return Icon;

client/common/useSyncFormTranslations.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,30 @@
11
import { useEffect, MutableRefObject } from 'react';
2+
import type { FormApi } from 'final-form';
23

3-
export interface FormLike {
4-
getState(): { values: Record<string, unknown> };
5-
reset(): void;
6-
change(field: string, value: unknown): void;
7-
}
4+
// Generic FormLike that mirrors FormApi for any form value type
5+
export interface FormLike<FormValues = Record<string, unknown>>
6+
extends Pick<FormApi<FormValues>, 'getState' | 'reset' | 'change'> {}
87

98
/**
109
* This hook ensures that form values are preserved when the language changes.
1110
* @param formRef
1211
* @param language
1312
*/
14-
export const useSyncFormTranslations = (
15-
formRef: MutableRefObject<FormLike>,
13+
export const useSyncFormTranslations = <FormValues extends Record<string, any>>(
14+
formRef: MutableRefObject<FormLike<FormValues> | null>,
1615
language: string
1716
) => {
1817
useEffect(() => {
19-
const form = formRef.current;
18+
const form = formRef?.current;
2019
if (!form) return;
2120

2221
const { values } = form.getState();
2322
form.reset();
2423

25-
Object.keys(values).forEach((field) => {
26-
if (values[field]) {
27-
form.change(field, values[field]);
24+
(Object.keys(values) as (keyof FormValues)[]).forEach((field) => {
25+
const value = values[field];
26+
if (value !== undefined && value !== null && value !== '') {
27+
form.change(field, value);
2828
}
2929
});
3030
}, [language]);

client/components/Menubar/Menubar.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from 'react';
22
import { render, screen, fireEvent } from '../../test-utils';
33
import { Menubar } from './Menubar';
4-
import MenubarSubmenu from './MenubarSubmenu';
4+
import { MenubarSubmenu } from './MenubarSubmenu';
55
import { MenubarItem } from './MenubarItem';
66

77
describe('Menubar', () => {

0 commit comments

Comments
 (0)