scratch-paint 3.0.339 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "scratch-paint",
3
- "version": "3.0.339",
3
+ "version": "4.0.0",
4
4
  "description": "Graphical User Interface for the Scratch 3.0 paint editor, which is used to make and edit sprites for use in projects.",
5
5
  "main": "./dist/scratch-paint.js",
6
6
  "browser": "./src/index.js",
@@ -33,16 +33,16 @@
33
33
  "prop-types": "^15.5.10"
34
34
  },
35
35
  "peerDependencies": {
36
- "react": "^16",
37
- "react-dom": "^16",
38
- "react-intl": "^2",
36
+ "react": "^18",
37
+ "react-dom": "^18",
38
+ "react-intl": "^6",
39
39
  "react-intl-redux": "^0.7 || ^2.0.0",
40
40
  "react-popover": "^0.5",
41
- "react-redux": "^5",
42
- "react-responsive": "^5",
41
+ "react-redux": "^8",
42
+ "react-responsive": "^9",
43
43
  "react-style-proptype": "^3",
44
44
  "react-tooltip": "^4",
45
- "redux": "^3",
45
+ "redux": "^4",
46
46
  "scratch-render-fonts": "^1.0.0"
47
47
  },
48
48
  "devDependencies": {
@@ -53,6 +53,7 @@
53
53
  "@babel/preset-react": "7.27.1",
54
54
  "@commitlint/cli": "17.8.1",
55
55
  "@commitlint/config-conventional": "17.8.1",
56
+ "@testing-library/react": "8.0.9",
56
57
  "autoprefixer": "9.8.8",
57
58
  "babel-eslint": "10.1.0",
58
59
  "babel-jest": "29.7.0",
@@ -61,8 +62,6 @@
61
62
  "babel-plugin-transform-object-rest-spread": "6.26.0",
62
63
  "canvas": "2.11.2",
63
64
  "css-loader": "3.6.0",
64
- "enzyme": "3.11.0",
65
- "enzyme-adapter-react-16": "1.15.8",
66
65
  "eslint": "8.57.1",
67
66
  "eslint-config-scratch": "9.0.9",
68
67
  "eslint-plugin-import": "2.32.0",
@@ -79,28 +78,17 @@
79
78
  "postcss-loader": "3.0.0",
80
79
  "postcss-simple-vars": "5.0.2",
81
80
  "raf": "3.4.1",
82
- "react": "16.14.0",
83
- "react-dom": "16.14.0",
84
- "react-intl": "2.9.0",
85
- "react-intl-redux": "2.4.1",
86
- "react-popover": "0.5.10",
87
- "react-redux": "5.1.2",
88
- "react-responsive": "5.0.0",
89
- "react-style-proptype": "3.2.2",
90
- "react-test-renderer": "16.14.0",
91
- "react-tooltip": "4.5.1",
92
- "redux": "3.7.2",
81
+ "react-test-renderer": "18.3.1",
93
82
  "redux-mock-store": "1.5.5",
94
83
  "redux-throttle": "0.1.1",
95
84
  "regenerator-runtime": "0.13.9",
96
85
  "rimraf": "2.7.1",
97
86
  "scratch-l10n": "5.0.309",
98
- "scratch-render-fonts": "1.0.218",
99
87
  "scratch-semantic-release-config": "3.0.0",
100
88
  "semantic-release": "19.0.5",
101
89
  "style-loader": "1.3.0",
102
90
  "svg-url-loader": "3.0.3",
103
- "tap": "14.11.0",
91
+ "tap": "21.1.0",
104
92
  "uglifyjs-webpack-plugin": "2.2.0",
105
93
  "url-loader": "2.3.0",
106
94
  "webpack": "4.47.0",
@@ -114,14 +102,17 @@
114
102
  },
115
103
  "jest": {
116
104
  "setupFiles": [
117
- "raf/polyfill",
118
- "<rootDir>/test/helpers/enzyme-setup.js"
105
+ "raf/polyfill"
119
106
  ],
107
+ "testEnvironment": "jsdom",
120
108
  "testURL": "http://localhost",
121
109
  "moduleNameMapper": {
122
110
  "\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/test/__mocks__/fileMock.js",
123
111
  "\\.(css|less)$": "<rootDir>/test/__mocks__/styleMock.js"
124
- }
112
+ },
113
+ "transformIgnorePatterns": [
114
+ "/node_modules/(?!intl-messageformat|intl-messageformat-parser).+\\.js$"
115
+ ]
125
116
  },
126
117
  "jest-junit": {
127
118
  "outputDirectory": "./test/results"
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import {defineMessages, FormattedMessage, injectIntl, intlShape} from 'react-intl';
3
+ import {defineMessages, FormattedMessage, injectIntl} from 'react-intl';
4
+ import intlShape from '../../lib/intl-shape.js';
4
5
 
5
6
  import classNames from 'classnames';
6
7
  import parseColor from 'parse-color';
@@ -4,7 +4,8 @@ See #13 */
4
4
 
5
5
  import bindAll from 'lodash.bindall';
6
6
  import classNames from 'classnames';
7
- import {defineMessages, injectIntl, intlShape, FormattedMessage} from 'react-intl';
7
+ import {defineMessages, injectIntl, FormattedMessage} from 'react-intl';
8
+ import intlShape from '../../lib/intl-shape.js';
8
9
  import PropTypes from 'prop-types';
9
10
  import React from 'react';
10
11
  import ReactTooltip from 'react-tooltip';
@@ -11,7 +11,7 @@ import BufferedInputHOC from '../forms/buffered-input-hoc.jsx';
11
11
  import Button from '../button/button.jsx';
12
12
  import ButtonGroup from '../button-group/button-group.jsx';
13
13
  import Dropdown from '../dropdown/dropdown.jsx';
14
- import {defineMessages, injectIntl, intlShape} from 'react-intl';
14
+ import {defineMessages, useIntl} from 'react-intl';
15
15
  import Formats, {isVector} from '../../lib/format';
16
16
  import Input from '../forms/input.jsx';
17
17
  import InputGroup from '../input-group/input-group.jsx';
@@ -87,13 +87,14 @@ const messages = defineMessages({
87
87
  const FixedToolsComponent = props => {
88
88
  const redoDisabled = !props.canRedo();
89
89
  const undoDisabled = !props.canUndo();
90
+ const intl = useIntl();
90
91
 
91
92
  return (
92
93
  <div className={styles.row}>
93
94
  {/* Name field */}
94
95
  <InputGroup>
95
96
  <MediaQuery minWidth={layout.fullSizeEditorMinWidth}>
96
- <Label text={props.intl.formatMessage(messages.costume)}>
97
+ <Label text={intl.formatMessage(messages.costume)}>
97
98
  <BufferedInput
98
99
  className={styles.costumeInput}
99
100
  type="text"
@@ -128,7 +129,7 @@ const FixedToolsComponent = props => {
128
129
  onClick={props.onUndo}
129
130
  >
130
131
  <img
131
- alt={props.intl.formatMessage(messages.undo)}
132
+ alt={intl.formatMessage(messages.undo)}
132
133
  className={classNames(
133
134
  styles.buttonGroupButtonIcon,
134
135
  styles.undoIcon
@@ -150,7 +151,7 @@ const FixedToolsComponent = props => {
150
151
  onClick={props.onRedo}
151
152
  >
152
153
  <img
153
- alt={props.intl.formatMessage(messages.redo)}
154
+ alt={intl.formatMessage(messages.redo)}
154
155
  className={styles.buttonGroupButtonIcon}
155
156
  draggable={false}
156
157
  src={redoIcon}
@@ -164,16 +165,16 @@ const FixedToolsComponent = props => {
164
165
  <InputGroup className={styles.modDashedBorder}>
165
166
  <LabeledIconButton
166
167
  disabled={!shouldShowGroup()}
167
- hideLabel={hideLabel(props.intl.locale)}
168
+ hideLabel={hideLabel(intl.locale)}
168
169
  imgSrc={groupIcon}
169
- title={props.intl.formatMessage(messages.group)}
170
+ title={intl.formatMessage(messages.group)}
170
171
  onClick={props.onGroup}
171
172
  />
172
173
  <LabeledIconButton
173
174
  disabled={!shouldShowUngroup()}
174
- hideLabel={hideLabel(props.intl.locale)}
175
+ hideLabel={hideLabel(intl.locale)}
175
176
  imgSrc={ungroupIcon}
176
- title={props.intl.formatMessage(messages.ungroup)}
177
+ title={intl.formatMessage(messages.ungroup)}
177
178
  onClick={props.onUngroup}
178
179
  />
179
180
  </InputGroup> : null
@@ -184,16 +185,16 @@ const FixedToolsComponent = props => {
184
185
  <InputGroup className={styles.modDashedBorder}>
185
186
  <LabeledIconButton
186
187
  disabled={!shouldShowBringForward()}
187
- hideLabel={hideLabel(props.intl.locale)}
188
+ hideLabel={hideLabel(intl.locale)}
188
189
  imgSrc={sendForwardIcon}
189
- title={props.intl.formatMessage(messages.forward)}
190
+ title={intl.formatMessage(messages.forward)}
190
191
  onClick={props.onSendForward}
191
192
  />
192
193
  <LabeledIconButton
193
194
  disabled={!shouldShowSendBackward()}
194
- hideLabel={hideLabel(props.intl.locale)}
195
+ hideLabel={hideLabel(intl.locale)}
195
196
  imgSrc={sendBackwardIcon}
196
- title={props.intl.formatMessage(messages.backward)}
197
+ title={intl.formatMessage(messages.backward)}
197
198
  onClick={props.onSendBackward}
198
199
  />
199
200
  </InputGroup> : null
@@ -204,16 +205,16 @@ const FixedToolsComponent = props => {
204
205
  <InputGroup className={styles.row}>
205
206
  <LabeledIconButton
206
207
  disabled={!shouldShowBringForward()}
207
- hideLabel={hideLabel(props.intl.locale)}
208
+ hideLabel={hideLabel(intl.locale)}
208
209
  imgSrc={sendFrontIcon}
209
- title={props.intl.formatMessage(messages.front)}
210
+ title={intl.formatMessage(messages.front)}
210
211
  onClick={props.onSendToFront}
211
212
  />
212
213
  <LabeledIconButton
213
214
  disabled={!shouldShowSendBackward()}
214
- hideLabel={hideLabel(props.intl.locale)}
215
+ hideLabel={hideLabel(intl.locale)}
215
216
  imgSrc={sendBackIcon}
216
- title={props.intl.formatMessage(messages.back)}
217
+ title={intl.formatMessage(messages.back)}
217
218
  onClick={props.onSendToBack}
218
219
  />
219
220
  </InputGroup>
@@ -252,7 +253,7 @@ const FixedToolsComponent = props => {
252
253
  draggable={false}
253
254
  src={sendFrontIcon}
254
255
  />
255
- <span>{props.intl.formatMessage(messages.front)}</span>
256
+ <span>{intl.formatMessage(messages.front)}</span>
256
257
  </Button>
257
258
  <Button
258
259
  className={classNames(styles.modMenuItem, {
@@ -266,7 +267,7 @@ const FixedToolsComponent = props => {
266
267
  draggable={false}
267
268
  src={sendBackIcon}
268
269
  />
269
- <span>{props.intl.formatMessage(messages.back)}</span>
270
+ <span>{intl.formatMessage(messages.back)}</span>
270
271
  </Button>
271
272
 
272
273
  {/* To be rotation point */}
@@ -285,7 +286,7 @@ const FixedToolsComponent = props => {
285
286
  }
286
287
  tipSize={.01}
287
288
  >
288
- {props.intl.formatMessage(messages.more)}
289
+ {intl.formatMessage(messages.more)}
289
290
  </Dropdown>
290
291
  </InputGroup>
291
292
  </MediaQuery> : null
@@ -298,7 +299,6 @@ FixedToolsComponent.propTypes = {
298
299
  canRedo: PropTypes.func.isRequired,
299
300
  canUndo: PropTypes.func.isRequired,
300
301
  format: PropTypes.oneOf(Object.keys(Formats)),
301
- intl: intlShape,
302
302
  name: PropTypes.string,
303
303
  onGroup: PropTypes.func.isRequired,
304
304
  onRedo: PropTypes.func.isRequired,
@@ -321,4 +321,4 @@ const mapStateToProps = state => ({
321
321
 
322
322
  export default connect(
323
323
  mapStateToProps
324
- )(injectIntl(FixedToolsComponent));
324
+ )(FixedToolsComponent);
@@ -12,7 +12,7 @@ import {setShapesFilled} from '../../reducers/fill-bitmap-shapes';
12
12
  import FontDropdown from '../../containers/font-dropdown.jsx';
13
13
  import LiveInputHOC from '../forms/live-input-hoc.jsx';
14
14
  import Label from '../forms/label.jsx';
15
- import {defineMessages, injectIntl, intlShape} from 'react-intl';
15
+ import {defineMessages, useIntl} from 'react-intl';
16
16
  import Input from '../forms/input.jsx';
17
17
  import InputGroup from '../input-group/input-group.jsx';
18
18
  import LabeledIconButton from '../labeled-icon-button/labeled-icon-button.jsx';
@@ -43,6 +43,7 @@ import {MAX_STROKE_WIDTH} from '../../reducers/stroke-width';
43
43
 
44
44
  const LiveInput = LiveInputHOC(Input);
45
45
  const ModeToolsComponent = props => {
46
+ const intl = useIntl();
46
47
  const messages = defineMessages({
47
48
  brushSize: {
48
49
  defaultMessage: 'Size',
@@ -122,7 +123,7 @@ const ModeToolsComponent = props => {
122
123
  <div className={classNames(props.className, styles.modeTools)}>
123
124
  <div>
124
125
  <img
125
- alt={props.intl.formatMessage(currentMessage)}
126
+ alt={intl.formatMessage(currentMessage)}
126
127
  className={styles.modeToolsIcon}
127
128
  draggable={false}
128
129
  src={currentIcon}
@@ -151,7 +152,7 @@ const ModeToolsComponent = props => {
151
152
  <div className={classNames(props.className, styles.modeTools)}>
152
153
  <div>
153
154
  <img
154
- alt={props.intl.formatMessage(messages.eraserSize)}
155
+ alt={intl.formatMessage(messages.eraserSize)}
155
156
  className={styles.modeToolsIcon}
156
157
  draggable={false}
157
158
  src={currentIcon}
@@ -175,24 +176,24 @@ const ModeToolsComponent = props => {
175
176
  <InputGroup className={classNames(styles.modDashedBorder, styles.modLabeledIconHeight)}>
176
177
  <LabeledIconButton
177
178
  disabled={!props.hasSelectedUncurvedPoints}
178
- hideLabel={hideLabel(props.intl.locale)}
179
+ hideLabel={hideLabel(intl.locale)}
179
180
  imgSrc={curvedPointIcon}
180
- title={props.intl.formatMessage(messages.curved)}
181
+ title={intl.formatMessage(messages.curved)}
181
182
  onClick={props.onCurvePoints}
182
183
  />
183
184
  <LabeledIconButton
184
185
  disabled={!props.hasSelectedUnpointedPoints}
185
- hideLabel={hideLabel(props.intl.locale)}
186
+ hideLabel={hideLabel(intl.locale)}
186
187
  imgSrc={straightPointIcon}
187
- title={props.intl.formatMessage(messages.pointed)}
188
+ title={intl.formatMessage(messages.pointed)}
188
189
  onClick={props.onPointPoints}
189
190
  />
190
191
  </InputGroup>
191
192
  <InputGroup className={classNames(styles.modLabeledIconHeight)}>
192
193
  <LabeledIconButton
193
- hideLabel={hideLabel(props.intl.locale)}
194
+ hideLabel={hideLabel(intl.locale)}
194
195
  imgSrc={deleteIcon}
195
- title={props.intl.formatMessage(messages.delete)}
196
+ title={intl.formatMessage(messages.delete)}
196
197
  onClick={props.onDelete}
197
198
  />
198
199
  </InputGroup>
@@ -205,38 +206,38 @@ const ModeToolsComponent = props => {
205
206
  <div className={classNames(props.className, styles.modeTools)}>
206
207
  <InputGroup className={classNames(styles.modDashedBorder, styles.modLabeledIconHeight)}>
207
208
  <LabeledIconButton
208
- hideLabel={hideLabel(props.intl.locale)}
209
+ hideLabel={hideLabel(intl.locale)}
209
210
  imgSrc={copyIcon}
210
- title={props.intl.formatMessage(messages.copy)}
211
+ title={intl.formatMessage(messages.copy)}
211
212
  onClick={props.onCopyToClipboard}
212
213
  />
213
214
  <LabeledIconButton
214
215
  disabled={!(props.clipboardItems.length > 0)}
215
- hideLabel={hideLabel(props.intl.locale)}
216
+ hideLabel={hideLabel(intl.locale)}
216
217
  imgSrc={pasteIcon}
217
- title={props.intl.formatMessage(messages.paste)}
218
+ title={intl.formatMessage(messages.paste)}
218
219
  onClick={props.onPasteFromClipboard}
219
220
  />
220
221
  </InputGroup>
221
222
  <InputGroup className={classNames(styles.modDashedBorder, styles.modLabeledIconHeight)}>
222
223
  <LabeledIconButton
223
- hideLabel={hideLabel(props.intl.locale)}
224
+ hideLabel={hideLabel(intl.locale)}
224
225
  imgSrc={deleteIcon}
225
- title={props.intl.formatMessage(messages.delete)}
226
+ title={intl.formatMessage(messages.delete)}
226
227
  onClick={props.onDelete}
227
228
  />
228
229
  </InputGroup>
229
230
  <InputGroup className={classNames(styles.modLabeledIconHeight)}>
230
231
  <LabeledIconButton
231
- hideLabel={props.intl.locale !== 'en'}
232
+ hideLabel={intl.locale !== 'en'}
232
233
  imgSrc={flipHorizontalIcon}
233
- title={props.intl.formatMessage(messages.flipHorizontal)}
234
+ title={intl.formatMessage(messages.flipHorizontal)}
234
235
  onClick={props.onFlipHorizontal}
235
236
  />
236
237
  <LabeledIconButton
237
- hideLabel={props.intl.locale !== 'en'}
238
+ hideLabel={intl.locale !== 'en'}
238
239
  imgSrc={flipVerticalIcon}
239
- title={props.intl.formatMessage(messages.flipVertical)}
240
+ title={intl.formatMessage(messages.flipVertical)}
240
241
  onClick={props.onFlipVertical}
241
242
  />
242
243
  </InputGroup>
@@ -266,7 +267,7 @@ const ModeToolsComponent = props => {
266
267
  <LabeledIconButton
267
268
  highlighted={props.fillBitmapShapes}
268
269
  imgSrc={fillIcon}
269
- title={props.intl.formatMessage(messages.filled)}
270
+ title={intl.formatMessage(messages.filled)}
270
271
  onClick={props.onFillShapes}
271
272
  />
272
273
  </InputGroup>
@@ -274,13 +275,13 @@ const ModeToolsComponent = props => {
274
275
  <LabeledIconButton
275
276
  highlighted={!props.fillBitmapShapes}
276
277
  imgSrc={outlineIcon}
277
- title={props.intl.formatMessage(messages.outlined)}
278
+ title={intl.formatMessage(messages.outlined)}
278
279
  onClick={props.onOutlineShapes}
279
280
  />
280
281
  </InputGroup>
281
282
  {props.fillBitmapShapes ? null : (
282
283
  <InputGroup>
283
- <Label text={props.intl.formatMessage(messages.thickness)}>
284
+ <Label text={intl.formatMessage(messages.thickness)}>
284
285
  <LiveInput
285
286
  range
286
287
  small
@@ -315,7 +316,6 @@ ModeToolsComponent.propTypes = {
315
316
  format: PropTypes.oneOf(Object.keys(Formats)),
316
317
  hasSelectedUncurvedPoints: PropTypes.bool,
317
318
  hasSelectedUnpointedPoints: PropTypes.bool,
318
- intl: intlShape.isRequired,
319
319
  mode: PropTypes.string.isRequired,
320
320
  onBitBrushSliderChange: PropTypes.func.isRequired,
321
321
  onBitEraserSliderChange: PropTypes.func.isRequired,
@@ -367,4 +367,4 @@ const mapDispatchToProps = dispatch => ({
367
367
  export default connect(
368
368
  mapStateToProps,
369
369
  mapDispatchToProps
370
- )(injectIntl(ModeToolsComponent));
370
+ )(ModeToolsComponent);