@crispcode/shimmer 5.0.0 → 5.0.3

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crispcode/shimmer",
3
- "version": "5.0.0",
3
+ "version": "5.0.3",
4
4
  "description": "A PIXI.JS wrapper plugin for MODUX",
5
5
  "author": "Crisp Code ( contact@crispcode.ro )",
6
6
  "access": "public",
@@ -17,39 +17,39 @@
17
17
  "url": "https://github.com/CrispCode/shimmer/issues"
18
18
  },
19
19
  "dependencies": {
20
- "@pixi/canvas-display": "^6.4.0",
21
- "@pixi/canvas-extract": "^6.4.0",
22
- "@pixi/canvas-graphics": "^6.4.0",
23
- "@pixi/canvas-mesh": "^6.4.0",
24
- "@pixi/canvas-particle-container": "^6.4.0",
25
- "@pixi/canvas-prepare": "^6.4.0",
26
- "@pixi/canvas-renderer": "^6.4.0",
27
- "@pixi/canvas-sprite": "^6.4.0",
28
- "@pixi/canvas-sprite-tiling": "^6.4.0",
29
- "@pixi/canvas-text": "^6.4.0",
30
- "@pixi/constants": "^6.4.0",
31
- "@pixi/core": "^6.4.0",
32
- "@pixi/display": "^6.4.0",
33
- "@pixi/graphics": "^6.4.0",
34
- "@pixi/interaction": "^6.4.0",
35
- "@pixi/loaders": "^6.4.0",
36
- "@pixi/math": "^6.4.0",
37
- "@pixi/mesh": "^6.4.0",
38
- "@pixi/mesh-extras": "^6.4.0",
39
- "@pixi/particle-container": "^6.4.0",
40
- "@pixi/prepare": "^6.4.0",
41
- "@pixi/runner": "^6.4.0",
42
- "@pixi/settings": "^6.4.0",
43
- "@pixi/sprite": "^6.4.0",
44
- "@pixi/sprite-animated": "^6.4.0",
45
- "@pixi/sprite-tiling": "^6.4.0",
46
- "@pixi/text": "^6.4.0",
47
- "@pixi/ticker": "^6.4.0",
48
- "@pixi/utils": "^6.4.0",
49
- "acorn": "^8.7.1"
20
+ "@pixi/assets": "^6.5.1",
21
+ "@pixi/canvas-display": "^6.5.1",
22
+ "@pixi/canvas-extract": "^6.5.1",
23
+ "@pixi/canvas-graphics": "^6.5.1",
24
+ "@pixi/canvas-mesh": "^6.5.1",
25
+ "@pixi/canvas-particle-container": "^6.5.1",
26
+ "@pixi/canvas-prepare": "^6.5.1",
27
+ "@pixi/canvas-renderer": "^6.5.1",
28
+ "@pixi/canvas-sprite": "^6.5.1",
29
+ "@pixi/canvas-sprite-tiling": "^6.5.1",
30
+ "@pixi/canvas-text": "^6.5.1",
31
+ "@pixi/constants": "^6.5.1",
32
+ "@pixi/core": "^6.5.1",
33
+ "@pixi/display": "^6.5.1",
34
+ "@pixi/extensions": "^6.5.1",
35
+ "@pixi/graphics": "^6.5.1",
36
+ "@pixi/interaction": "^6.5.1",
37
+ "@pixi/math": "^6.5.1",
38
+ "@pixi/mesh": "^6.5.1",
39
+ "@pixi/mesh-extras": "^6.5.1",
40
+ "@pixi/particle-container": "^6.5.1",
41
+ "@pixi/prepare": "^6.5.1",
42
+ "@pixi/runner": "^6.5.1",
43
+ "@pixi/settings": "^6.5.1",
44
+ "@pixi/sprite": "^6.5.1",
45
+ "@pixi/sprite-animated": "^6.5.1",
46
+ "@pixi/sprite-tiling": "^6.5.1",
47
+ "@pixi/text": "^6.5.1",
48
+ "@pixi/ticker": "^6.5.1",
49
+ "@pixi/utils": "^6.5.1"
50
50
  },
51
51
  "peerDependencies": {
52
- "@crispcode/modux": "CrispCode/modux#v5.0.4"
52
+ "@crispcode/modux": "^5.1.1"
53
53
  },
54
54
  "devDependencies": {
55
55
  "esdoc": "^1.1.0",
@@ -4,11 +4,12 @@
4
4
 
5
5
  import { Component, extend, loop, logger } from '@crispcode/modux'
6
6
 
7
- import { autoDetectRenderer, Renderer, BatchRenderer } from '@pixi/core'
8
- import { Loader } from '@pixi/loaders'
7
+ import { autoDetectRenderer, BatchRenderer } from '@pixi/core'
8
+ import { Assets } from '@pixi/assets'
9
9
  import { Ticker } from '@pixi/ticker'
10
10
  import { InteractionManager } from '@pixi/interaction'
11
11
  import { skipHello, isWebGLSupported } from '@pixi/utils'
12
+ import { extensions } from '@pixi/extensions'
12
13
 
13
14
  // Canvas support
14
15
  import '@pixi/canvas-display'
@@ -25,15 +26,8 @@ import '@pixi/canvas-text'
25
26
  import { Element } from './element.js'
26
27
  import { Controls } from './controls.js'
27
28
 
28
- Renderer.registerPlugin( 'interaction', InteractionManager )
29
- Renderer.registerPlugin( 'batch', BatchRenderer )
30
-
31
- CanvasRenderer.registerPlugin( 'interaction', InteractionManager )
32
- CanvasRenderer.registerPlugin( 'extract', CanvasExtract )
33
- CanvasRenderer.registerPlugin( 'graphics', CanvasGraphicsRenderer )
34
- CanvasRenderer.registerPlugin( 'mesh', CanvasMeshRenderer )
35
- CanvasRenderer.registerPlugin( 'prepare', CanvasPrepare )
36
- CanvasRenderer.registerPlugin( 'sprite', CanvasSpriteRenderer )
29
+ extensions.add( InteractionManager )
30
+ extensions.add( BatchRenderer )
37
31
 
38
32
  /**
39
33
  * This class is used to create the shimmer component
@@ -66,19 +60,12 @@ export class Shimmer extends Component {
66
60
 
67
61
  /**
68
62
  * This method preloads a colection of assets
69
- * @param {Object} assets A collection of assets
63
+ * @param {Object} bundle A collection of assets
70
64
  * @return {Promise} A promise which is resolved upon loading the assets. It resolves the loaded resources.
71
65
  */
72
- preload ( assets ) {
73
- let loader = new Loader()
74
- return new Promise( ( resolve ) => {
75
- loop( assets, ( data, name ) => {
76
- loader.add( name, data )
77
- } )
78
- loader.load( ( loader, resources ) => {
79
- resolve( resources )
80
- } )
81
- } )
66
+ preload ( bundle ) {
67
+ Assets.addBundle( 'bundle', bundle )
68
+ return Assets.loadBundle( 'bundle' )
82
69
  }
83
70
 
84
71
  /**
@@ -163,7 +150,17 @@ export class Shimmer extends Component {
163
150
  * Stores the renderer
164
151
  * @type {Renderer}
165
152
  */
166
- this.renderer = ( isWebGLSupported() && !this.settings.forceCanvas ) ? autoDetectRenderer( rendererSettings ) : new CanvasRenderer( rendererSettings )
153
+ this.renderer = null
154
+ if ( isWebGLSupported() && !this.settings.forceCanvas ) {
155
+ this.renderer = autoDetectRenderer( rendererSettings )
156
+ } else {
157
+ extensions.add( CanvasExtract )
158
+ extensions.add( CanvasGraphicsRenderer )
159
+ extensions.add( CanvasMeshRenderer )
160
+ extensions.add( CanvasPrepare )
161
+ extensions.add( CanvasSpriteRenderer )
162
+ this.renderer = new CanvasRenderer( rendererSettings )
163
+ }
167
164
 
168
165
  this.renderer.resize( this.element.clientWidth, this.element.clientHeight )
169
166
 
package/test/app.js CHANGED
@@ -1,4 +1,3 @@
1
1
  'use strict'
2
2
 
3
- require( './styles/index.scss' )
4
3
  require( './scripts/index.js' )
@@ -1,9 +1,10 @@
1
1
  'use strict'
2
2
 
3
3
  import { Component } from '@crispcode/modux'
4
+ import template from './template.html'
4
5
 
5
6
  export class LayoutComponent extends Component {
6
7
  get template () {
7
- return require( './template.html' )
8
+ return template
8
9
  }
9
10
  }
@@ -37,13 +37,13 @@ export class ShimmerComponent extends Shimmer {
37
37
  'image2': '/image2.png'
38
38
  } )
39
39
  .then( ( resources ) => {
40
- this.__button = new ButtonMain( resources[ 'image1' ].texture )
40
+ this.__button = new ButtonMain( resources[ 'image1' ] )
41
41
  this.stage.addElementChild( 'button', this.__button )
42
42
 
43
43
  this.__moons = {}
44
44
 
45
45
  for ( let i = 0; i < 20; i++ ) {
46
- let moon = new Moon( resources[ 'image2' ].texture )
46
+ let moon = new Moon( resources[ 'image2' ] )
47
47
  moon.setAngle( rnd( 0, 359 ) )
48
48
  moon.setRadius( rnd( 200, 500 ) )
49
49
  moon.setSpeed( rnd( 10, 50 ) / 10 )
@@ -7,6 +7,8 @@ import { Module, logger } from '@crispcode/modux'
7
7
  import { LayoutComponent } from './components/layout'
8
8
  import { ShimmerComponent } from './components/shimmer'
9
9
 
10
+ import './../styles/index.scss'
11
+
10
12
  let initialize = () => {
11
13
  // Create application
12
14
  let app = new Module( 'app' )