react-pixi-fiber 1.0.0 → 1.0.2

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/CHANGELOG.md CHANGED
@@ -9,7 +9,19 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
9
9
  ## [Unreleased]
10
10
 
11
11
 
12
- ## [1.0.0-beta.16] - 2022-01-08
12
+ ## [1.0.2] - 2022-09-01
13
+
14
+ ### Fixed
15
+ - Fixed ES build by replacing inline require with regular import ([#283])
16
+
17
+
18
+ ## [1.0.1] - 2022-08-02
19
+
20
+ ### Fixed
21
+ - Fixed peer dependencies ([#277])
22
+
23
+
24
+ ## [1.0.0] - 2022-07-19
13
25
 
14
26
  ### Added
15
27
  - Added ReactDOM-like prop validation in development ([#47])
@@ -406,8 +418,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
406
418
  - Added `<TilingSprite />` component
407
419
 
408
420
 
409
- [Unreleased]: https://github.com/michalochman/react-pixi-fiber/compare/v1.0.0-beta.16...HEAD
410
- [1.0.0-beta.16]: https://github.com/michalochman/react-pixi-fiber/compare/v0.14.3...v1.0.0-beta.16
421
+ [Unreleased]: https://github.com/michalochman/react-pixi-fiber/compare/v1.0.2...HEAD
422
+ [1.0.2]: https://github.com/michalochman/react-pixi-fiber/compare/v1.0.1...v1.0.2
423
+ [1.0.1]: https://github.com/michalochman/react-pixi-fiber/compare/v1.0.0...v1.0.1
424
+ [1.0.0]: https://github.com/michalochman/react-pixi-fiber/compare/v0.14.3...v1.0.0
411
425
  [0.14.2]: https://github.com/michalochman/react-pixi-fiber/compare/v0.14.1...v0.14.2
412
426
  [0.14.1]: https://github.com/michalochman/react-pixi-fiber/compare/v0.14.0...v0.14.1
413
427
  [0.14.0]: https://github.com/michalochman/react-pixi-fiber/compare/v0.13.2...v0.14.0
@@ -454,6 +468,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
454
468
  [0.2.0]: https://github.com/michalochman/react-pixi-fiber/compare/v0.1.1...v0.2.0
455
469
  [0.1.1]: https://github.com/michalochman/react-pixi-fiber/compare/v0.1.0...v0.1.1
456
470
 
471
+ [#283]: https://github.com/michalochman/react-pixi-fiber/pull/283
472
+ [#277]: https://github.com/michalochman/react-pixi-fiber/pull/277
457
473
  [#227]: https://github.com/michalochman/react-pixi-fiber/issues/227
458
474
  [#225]: https://github.com/michalochman/react-pixi-fiber/issues/225
459
475
  [#221]: https://github.com/michalochman/react-pixi-fiber/issues/221
package/README.md CHANGED
@@ -36,6 +36,17 @@
36
36
 
37
37
  See [Rotating Bunny](https://codesandbox.io/s/q7oj1p0jo6) demo.
38
38
 
39
+ Also, please explore our [CodeSandbox](https://codesandbox.io/) templates:
40
+ * [Hello world using JavaScript](https://codesandbox.io/s/react-pixi-fiber-template-ohk6z)
41
+ * [Hello world using TypeScript](https://codesandbox.io/s/react-pixi-fiber-typescript-template-613ly)
42
+
43
+ and examples:
44
+ * [Rotating Bunny](https://codesandbox.io/s/q7oj1p0jo6)
45
+ * [AnimatedSprite using CustomComponent](https://codesandbox.io/s/react-pixi-fiber-demo-animatedsprite-d6udu)
46
+ * [Aligning texts](https://codesandbox.io/s/react-pixi-fiber-text-alignment-th5eg)
47
+ * [Sharing Redux state](https://codesandbox.io/s/react-pixi-fiber-with-redux-g4k7n)
48
+ * [Using animated](https://codesandbox.io/s/9qyxrljyo)
49
+
39
50
 
40
51
  ## 🚀 Migrating from version `0.x.y`? 🚀
41
52
 
@@ -57,7 +68,41 @@ This package works flawlessly with [Create React App](https://github.com/faceboo
57
68
 
58
69
  ## Usage
59
70
 
60
- ### With ReactDOM
71
+ <details open>
72
+ <summary>
73
+ <strong>With ReactDOM (React 18 and above)</strong>
74
+ </summary>
75
+
76
+ ```jsx harmony
77
+ import { createRoot } from "react-dom/client";
78
+ import { Sprite, Stage } from "react-pixi-fiber";
79
+ import bunny from "./bunny.png";
80
+
81
+ function Bunny (props) {
82
+ return <Sprite texture={PIXI.Texture.from(bunny)} {...props} />;
83
+ }
84
+
85
+ const container = document.getElementById("container");
86
+ const root = createRoot(container);
87
+
88
+ root.render(
89
+ <Stage options={{ backgroundColor: 0x10bb99, height: 600, width: 800 }}>
90
+ <Bunny x={200} y={200} />
91
+ </Stage>,
92
+ );
93
+ ```
94
+
95
+ This example will render [`PIXI.Sprite`] object into a [Root Container] of [`PIXI.Application`] on the page.
96
+
97
+ The HTML-like syntax; [called JSX](https://reactjs.org/docs/introducing-jsx.html) is not required to use with this renderer, but it makes code more readable. You can use [Babel](https://babeljs.io/) with a [React preset](https://babeljs.io/docs/plugins/preset-react/) to convert JSX into native JavaScript.
98
+ </details>
99
+
100
+ ---
101
+
102
+ <details>
103
+ <summary>
104
+ <strong>With ReactDOM (React 16 and 17)</strong>
105
+ </summary>
61
106
 
62
107
  ```jsx harmony
63
108
  import { render } from "react-dom";
@@ -68,20 +113,26 @@ function Bunny(props) {
68
113
  return <Sprite texture={PIXI.Texture.from(bunny)} {...props} />;
69
114
  }
70
115
 
116
+ const container = document.getElementById("container");
71
117
  render(
72
118
  <Stage options={{ backgroundColor: 0x10bb99, height: 600, width: 800 }}>
73
119
  <Bunny x={200} y={200} />
74
120
  </Stage>,
75
- document.getElementById("container")
121
+ container
76
122
  );
77
123
  ```
78
124
 
79
125
  This example will render [`PIXI.Sprite`] object into a [Root Container] of [`PIXI.Application`] on the page.
80
126
 
81
127
  The HTML-like syntax; [called JSX](https://reactjs.org/docs/introducing-jsx.html) is not required to use with this renderer, but it makes code more readable. You can use [Babel](https://babeljs.io/) with a [React preset](https://babeljs.io/docs/plugins/preset-react/) to convert JSX into native JavaScript.
128
+ </details>
82
129
 
130
+ ---
83
131
 
84
- ### Without ReactDOM
132
+ <details>
133
+ <summary>
134
+ <strong>Without ReactDOM</strong>
135
+ </summary>
85
136
 
86
137
  ```jsx harmony
87
138
  import { render, Text } from "react-pixi-fiber";
@@ -103,6 +154,7 @@ render(
103
154
  ```
104
155
 
105
156
  This example will render [`PIXI.Text`] object into a [Root Container] of PIXI Application (created as `app`) inside the `<canvas id="container"></canvas>` element on the page.
157
+ </details>
106
158
 
107
159
 
108
160
  ## Running Examples
@@ -166,6 +218,8 @@ function App() {
166
218
  ```
167
219
  </details>
168
220
 
221
+ ---
222
+
169
223
  <details>
170
224
  <summary>
171
225
  <strong>Changed <code>PIXI.Application</code> exposed by <code>Stage</code> to be React <code>ref</code></strong>
@@ -208,6 +262,8 @@ function App() {
208
262
  ```
209
263
  </details>
210
264
 
265
+ ---
266
+
211
267
  <details>
212
268
  <summary>
213
269
  <strong>Changed <code>oldProps</code> in <code>customApplyProps</code> to not be initialised when the component is first rendered</strong>
@@ -243,6 +299,8 @@ export default CustomPIXIComponent(behavior, TYPE)
243
299
  ```
244
300
  </details>
245
301
 
302
+ ---
303
+
246
304
  <details>
247
305
  <summary>
248
306
  <strong>Changed <code>applyProps</code> to <code>applyDisplayObjectProps</code></strong>
@@ -279,13 +337,16 @@ Refer to the implementation, when in doubt:
279
337
  * new `applyDisplayObjectProps` -> https://github.com/michalochman/react-pixi-fiber/blob/3a9b71b8d18180117bf70459dd6b4419c5ef1c21/src/ReactPixiFiberComponent.js#L161
280
338
  </details>
281
339
 
340
+ ---
341
+
282
342
  ## Migrating from `react-pixi`
283
343
 
284
344
  It is possible to use React Pixi Fiber as a drop-in replacement for `react-pixi`.
285
345
 
286
346
  There are two options:
287
347
 
288
- ### Changing `import` / `require` statements
348
+ <details>
349
+ <summary>Changing <code>import</code> or <code>require</code> statements</summary>
289
350
 
290
351
  Change:
291
352
 
@@ -296,28 +357,35 @@ const ReactPIXI = require("react-pixi");
296
357
  ```
297
358
 
298
359
  to:
299
-
360
+
300
361
  ```js
301
362
  import ReactPIXI from "react-pixi-fiber/react-pixi-alias";
302
363
  // or
303
364
  const ReactPIXI = require("react-pixi-fiber/react-pixi-alias");
304
365
  ```
366
+ </details>
305
367
 
306
- ### Using `webpack` resolve `alias`
368
+ ---
369
+
370
+ <details>
371
+ <summary>Using <code>webpack</code> resolve <code>alias</code></summary>
307
372
 
308
373
  ```js
309
374
  resolve: {
310
375
  alias: {
311
- 'react-pixi$': 'react-pixi-fiber/react-pixi-alias'
376
+ "react-pixi$": "react-pixi-fiber/react-pixi-alias"
312
377
  }
313
378
  }
314
379
  ```
380
+ </details>
381
+
382
+ ---
315
383
 
316
384
  ## API
317
385
 
318
386
  ### Components
319
387
 
320
- React Pixi Fiber currently supports following components:
388
+ React Pixi Fiber currently supports following components out of the box (but read [Custom Components](#custom-components) section if you need more):
321
389
 
322
390
  #### `<Stage />`
323
391
 
@@ -337,7 +405,7 @@ Renders [`PIXI.Graphics`].
337
405
 
338
406
  #### `<ParticleContainer />`
339
407
 
340
- Renders [`PIXI.particles.ParticleContainer`].
408
+ Renders [`PIXI.ParticleContainer`] (or [`PIXI.particles.ParticleContainer`] if you're using PixiJS 4).
341
409
 
342
410
  #### `<Sprite />`
343
411
 
@@ -345,7 +413,7 @@ Renders [`PIXI.Sprite`].
345
413
 
346
414
  #### `<TilingSprite />`
347
415
 
348
- Renders [`PIXI.extras.TilingSprite`].
416
+ Renders [`PIXI.TilingSprite`] (or [`PIXI.extras.TilingSprite`] if you're using PixiJS 4).
349
417
 
350
418
  #### `<Text />`
351
419
 
@@ -353,7 +421,7 @@ Renders [`PIXI.Text`].
353
421
 
354
422
  #### `<BitmapText />`
355
423
 
356
- Renders [`PIXI.extras.BitmapText`].
424
+ Renders [`PIXI.BitmapText`] (or [`PIXI.extras.BitmapText`] if you're using PixiJS 4).
357
425
 
358
426
  #### `<NineSlicePlane />`
359
427
 
@@ -488,6 +556,8 @@ render(
488
556
 
489
557
  </details>
490
558
 
559
+ ---
560
+
491
561
  <details>
492
562
  <summary>
493
563
  <strong>Using New Context API directly (with React 16.3.0 and newer)</strong>
@@ -546,6 +616,8 @@ render(
546
616
 
547
617
  </details>
548
618
 
619
+ ---
620
+
549
621
  <details>
550
622
  <summary>
551
623
  <strong>Using Legacy Context API directly (with React older than 16.3.0)</strong>
@@ -603,6 +675,8 @@ render(
603
675
 
604
676
  </details>
605
677
 
678
+ ---
679
+
606
680
  ### Custom Components
607
681
 
608
682
  ReactPixiFiber can recognize your custom components using API compatible with `react-pixi`.
@@ -685,12 +759,16 @@ render(
685
759
 
686
760
  ### Is it production ready?
687
761
 
688
- Yes! Awesome!
762
+ Yes and it's awesome! It is battle tested and backed up by [Kalamba Games](https://kalambagames.com/games/) since the conception in the beginning of 2018 (after [migrating from `react-pixi`](#migrating-from-react-pixi)) and now also used by other game studios.
689
763
 
690
764
  ### What version of PixiJS I can use?
691
765
 
692
766
  PixiJS v4, v5 and v6 are supported.
693
767
 
768
+ ### Can I use it in my TypeScript project?
769
+
770
+ Sure thing! We've got you covered.
771
+
694
772
  ### Can I use already existing [`PIXI.Application`]?
695
773
 
696
774
  Yes, you can pass `app` property to `Stage` component, e.g. `<Stage app={app} />`.
@@ -755,15 +833,18 @@ For making an awesome project structure and documentation that is used in simila
755
833
  [React]: https://github.com/facebook/react
756
834
  [Root Container]: http://pixijs.download/release/docs/PIXI.Application.html#stage
757
835
  [`PIXI.Application`]: http://pixijs.download/release/docs/PIXI.Application.html
836
+ [`PIXI.BitmapText`]: http://pixijs.download/release/docs/PIXI.BitmapText.html
758
837
  [`PIXI.Container`]: http://pixijs.download/release/docs/PIXI.Container.html
759
838
  [`PIXI.DisplayObject`]: http://pixijs.download/release/docs/PIXI.DisplayObject.html
760
- [`PIXI.extras.BitmapText`]: http://pixijs.download/release/docs/PIXI.extras.BitmapText.html
761
- [`PIXI.extras.TilingSprite`]: http://pixijs.download/release/docs/PIXI.extras.TilingSprite.html
839
+ [`PIXI.extras.BitmapText`]: https://pixijs.download/v4.8.8/docs/PIXI.extras.BitmapText.html
840
+ [`PIXI.extras.TilingSprite`]: https://pixijs.download/v4.8.8/docs/PIXI.extras.TilingSprite.html
762
841
  [`PIXI.Graphics`]: http://pixijs.download/release/docs/PIXI.Graphics.html
763
842
  [`PIXI.NineSlicePlane`]: http://pixijs.download/release/docs/PIXI.NineSlicePlane.html
764
843
  [`PIXI.ObservablePoint`]: http://pixijs.download/release/docs/PIXI.ObservablePoint.html
765
- [`PIXI.particles.ParticleContainer`]: http://pixijs.download/release/docs/PIXI.particles.ParticleContainer.html
844
+ [`PIXI.ParticleContainer`]: http://pixijs.download/release/docs/PIXI.ParticleContainer.html
845
+ [`PIXI.particles.ParticleContainer`]: https://pixijs.download/v4.8.8/docs/PIXI.particles.ParticleContainer.html
766
846
  [`PIXI.Point`]: http://pixijs.download/release/docs/PIXI.Point.html
767
847
  [`PIXI.Sprite`]: http://pixijs.download/release/docs/PIXI.Sprite.html
768
848
  [`PIXI.Text`]: http://pixijs.download/release/docs/PIXI.Text.html
849
+ [`PIXI.TilingSprite`]: http://pixijs.download/release/docs/PIXI.TilingSprite.html
769
850
  [`react-pixi`]: https://github.com/Izzimach/react-pixi
@@ -21479,7 +21479,7 @@ var ReactPixiFiberAsSecondaryRenderer = ReactFiberReconciler(_objectSpread2(_obj
21479
21479
  var unstable_batchedUpdates = ReactPixiFiberAsPrimaryRenderer.batchedUpdates;
21480
21480
 
21481
21481
  function getDevToolsVersion() {
21482
- return require("react").version;
21482
+ return React.version;
21483
21483
  }
21484
21484
  var roots = new Map();
21485
21485
  /*