chore: bump and kill react
This commit is contained in:
parent
37613ffec1
commit
06edd64559
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@avocado/behavior",
|
||||
"version": "1.0.10",
|
||||
"version": "1.0.11",
|
||||
"main": "index.js",
|
||||
"author": "cha0s",
|
||||
"license": "MIT",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@avocado/core",
|
||||
"version": "1.0.10",
|
||||
"version": "1.0.11",
|
||||
"main": "index.js",
|
||||
"author": "cha0s",
|
||||
"license": "MIT",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@avocado/entity",
|
||||
"version": "1.0.13",
|
||||
"version": "1.0.14",
|
||||
"main": "index.js",
|
||||
"author": "cha0s",
|
||||
"license": "MIT",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@avocado/graphics",
|
||||
"version": "1.0.8",
|
||||
"version": "1.0.9",
|
||||
"main": "index.js",
|
||||
"author": "cha0s",
|
||||
"license": "MIT",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@avocado/input",
|
||||
"version": "1.0.3",
|
||||
"version": "1.0.4",
|
||||
"main": "index.js",
|
||||
"author": "cha0s",
|
||||
"license": "MIT",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@avocado/math",
|
||||
"version": "1.0.4",
|
||||
"version": "1.0.5",
|
||||
"main": "index.js",
|
||||
"author": "cha0s",
|
||||
"license": "MIT",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@avocado/net",
|
||||
"version": "1.0.6",
|
||||
"version": "1.0.7",
|
||||
"main": "index.js",
|
||||
"author": "cha0s",
|
||||
"license": "MIT",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@avocado/physics",
|
||||
"version": "1.0.5",
|
||||
"version": "1.0.6",
|
||||
"main": "index.js",
|
||||
"author": "cha0s",
|
||||
"license": "MIT",
|
||||
|
|
|
@ -1,51 +0,0 @@
|
|||
import React from 'react'
|
||||
import PropTypes from 'prop-types';
|
||||
|
||||
import {AnimationView, Ticker} from '@avocado/timing'
|
||||
class AnimationComponent extends React.Component
|
||||
|
||||
@defaultProps:
|
||||
|
||||
animation: null
|
||||
image: null
|
||||
|
||||
isTicking: true
|
||||
|
||||
constructor: (props) ->
|
||||
|
||||
super props
|
||||
|
||||
@animationView = new AnimationView()
|
||||
@animationView.on [
|
||||
'animationChanged'
|
||||
'imageChanged'
|
||||
'sourceRectangleChanged'
|
||||
], @tickContainer
|
||||
|
||||
@ticker = new Ticker.OutOfBand()
|
||||
@ticker.on 'tick', (elapsed) => @props.animation?.tick elapsed
|
||||
|
||||
componentWillUnmount: ->
|
||||
|
||||
@animationView.off [
|
||||
'animationChanged'
|
||||
'imageChanged'
|
||||
'sourceRectangleChanged'
|
||||
], @tickContainer
|
||||
|
||||
@ticker.off 'tick'
|
||||
@ticker.stop()
|
||||
|
||||
render: ->
|
||||
|
||||
# Side-effects.
|
||||
@animationView.setAnimation @props.animation
|
||||
@animationView.setImage @props.image
|
||||
|
||||
@props.setIntoContainer @animationView
|
||||
|
||||
return null
|
||||
|
||||
tickContainer: => @props.tickContainer()
|
||||
|
||||
export default AnimationComponent
|
|
@ -1,79 +0,0 @@
|
|||
import shallowequal from 'shallowequal'
|
||||
import * as React from 'react'
|
||||
|
||||
import {Container, Renderer} from '@avocado/graphics'
|
||||
import {Vector} from '@avocado/math'
|
||||
|
||||
class ContainerComponent extends React.Component
|
||||
|
||||
constructor: (props) ->
|
||||
|
||||
super()
|
||||
|
||||
@isDirty = true
|
||||
@renderer = new Renderer props.size, 'canvas'
|
||||
@container = new Container()
|
||||
|
||||
@defaultProps: size: [0, 0]
|
||||
|
||||
componentDidMount: ->
|
||||
|
||||
@containerRef.appendChild @renderer.element()
|
||||
|
||||
window.addEventListener 'resize', @recalculateBackgroundSize
|
||||
|
||||
componentDidUpdate: ->
|
||||
|
||||
# Performance: Check if the children actually changed after render.
|
||||
@isDirty = shallowequal @previousChildren, @container.children()
|
||||
|
||||
# Tick the first time.
|
||||
return unless @isDirty
|
||||
|
||||
@tick()
|
||||
@isDirty = false
|
||||
|
||||
componentWillUnmount: ->
|
||||
|
||||
window.removeEventListener 'resize', @recalculateBackgroundSize
|
||||
|
||||
@renderer.destroy(); @renderer = null
|
||||
|
||||
recalculateBackgroundSize: =>
|
||||
|
||||
s = getComputedStyle @renderer.element()
|
||||
domSize = [s.width, s.height].map (n) -> parseInt n
|
||||
|
||||
[w, h] = Vector.mul [16, 16], Vector.div domSize, @props.size
|
||||
@renderer.element().style.backgroundSize = "#{w}px #{h}px"
|
||||
|
||||
render: ->
|
||||
|
||||
# Literally one big side-effect.
|
||||
@renderer.resize @props.size
|
||||
@recalculateBackgroundSize()
|
||||
|
||||
@previousChildren = @container.children()
|
||||
@container.removeChildren()
|
||||
children = React.Children.map @props.children, (child) =>
|
||||
|
||||
React.cloneElement child,
|
||||
|
||||
setIntoContainer: (renderable) =>
|
||||
|
||||
return unless renderable
|
||||
@container.addChild renderable
|
||||
|
||||
tickContainer: @tick
|
||||
|
||||
<div
|
||||
className="container"
|
||||
ref={@setContainerRef}
|
||||
style={'lineHeight': 0}
|
||||
>{children}</div>
|
||||
|
||||
setContainerRef: (@containerRef) => return
|
||||
|
||||
tick: => @renderer.render @container
|
||||
|
||||
export default ContainerComponent
|
|
@ -1,21 +0,0 @@
|
|||
import PropTypes from 'prop-types';
|
||||
import React from 'react'
|
||||
import {connect} from 'react-redux'
|
||||
import {all, call, put, takeEvery} from 'redux-saga/effects'
|
||||
|
||||
import {Image, Sprite} from '@avocado/graphics'
|
||||
|
||||
import {processActions} from './util'
|
||||
|
||||
class ImageComponent extends React.Component
|
||||
|
||||
@defaultProps: image: null
|
||||
|
||||
image: -> @props.image
|
||||
|
||||
render: ->
|
||||
|
||||
@props.setIntoSprite? @props.image
|
||||
return null
|
||||
|
||||
export default ImageComponent
|
|
@ -1,8 +0,0 @@
|
|||
|
||||
// import Animation from './animation'; export {Animation};
|
||||
// import Container from './container'; export {Container};
|
||||
// import Image from './image'; export {Image};
|
||||
// import Primitives from './primitives'; export {Primitives};
|
||||
// import Room from './room'; export {Room};
|
||||
// import Sprite from './sprite'; export {Sprite};
|
||||
import Vector from './vector'; export {Vector};
|
|
@ -1,24 +0,0 @@
|
|||
import PropTypes from 'prop-types'
|
||||
import React from 'react'
|
||||
|
||||
import {TileLayer2D, TileLayer2DView, Tileset} from '@truss/environment'
|
||||
|
||||
class Layer2D extends React.Component
|
||||
|
||||
@propTypes =
|
||||
|
||||
layer: PropTypes.instanceOf TileLayer2D
|
||||
tileset: PropTypes.instanceOf Tileset
|
||||
|
||||
constructor: (props) ->
|
||||
|
||||
super props
|
||||
@layerView = new TileLayer2DView()
|
||||
|
||||
render: ->
|
||||
|
||||
@layerView.setLayer @props.layer
|
||||
@layerView.setTileset @props.tileset
|
||||
@props.setIntoContainer @layerView
|
||||
|
||||
export default Layer2D
|
|
@ -1,13 +0,0 @@
|
|||
{
|
||||
"name": "@avocado/react",
|
||||
"version": "1.0.0",
|
||||
"main": "index.js",
|
||||
"author": "cha0s",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"contempo": "1.x",
|
||||
"ponere": "1.x",
|
||||
"react": "^16.5.0",
|
||||
"redux-form": "^7.4.2"
|
||||
}
|
||||
}
|
|
@ -1,32 +0,0 @@
|
|||
import PropTypes from 'prop-types';
|
||||
import * as React from 'react'
|
||||
|
||||
import {color, Primitives} from '@avocado/graphics'
|
||||
import {Rectangle} from '@avocado/math'
|
||||
|
||||
class PrimitivesComponent extends React.Component
|
||||
|
||||
constructor: (props) ->
|
||||
|
||||
super props
|
||||
|
||||
@primitives = new Primitives()
|
||||
|
||||
@defaultProps:
|
||||
|
||||
lineStyle: Primitives.LineStyle color 0, 0, 0
|
||||
rectangle: [0, 0, 0, 0]
|
||||
|
||||
componentWillUnmount: -> @primitives.destroy()
|
||||
|
||||
render: ->
|
||||
|
||||
@primitives.clear()
|
||||
|
||||
unless Rectangle.isNull @props.rectangle
|
||||
@primitives.drawRectangle @props.rectangle, @props.lineStyle
|
||||
|
||||
@props.setIntoContainer @primitives
|
||||
return null
|
||||
|
||||
export default PrimitivesComponent
|
|
@ -1,29 +0,0 @@
|
|||
import PropTypes from 'prop-types'
|
||||
import React from 'react'
|
||||
|
||||
import {Room2DView} from '@avocado/environment'
|
||||
|
||||
class Room extends React.Component
|
||||
|
||||
@propTypes =
|
||||
|
||||
roomView: PropTypes.instanceOf(Room2DView).isRequired
|
||||
|
||||
constructor: (props) ->
|
||||
|
||||
super props
|
||||
|
||||
props.roomView.on [
|
||||
'roomChanged', 'tilesetChanged'
|
||||
], @tickContainer
|
||||
|
||||
render: ->
|
||||
|
||||
@props.setIntoContainer @props.roomView
|
||||
@tickContainer()
|
||||
|
||||
return null
|
||||
|
||||
tickContainer: => @props.tickContainer()
|
||||
|
||||
export default Room
|
|
@ -1,38 +0,0 @@
|
|||
import PropTypes from 'prop-types';
|
||||
import * as React from 'react'
|
||||
|
||||
import {Sprite} from '@avocado/graphics'
|
||||
|
||||
import Image from './image'
|
||||
|
||||
class SpriteComponent extends React.Component
|
||||
|
||||
constructor: (props) ->
|
||||
|
||||
super props
|
||||
|
||||
@sprite = new Sprite()
|
||||
@sprite.on 'imageOrCanvasChanged sourceRectangleChanged', =>
|
||||
@props.tickContainer()
|
||||
|
||||
@defaultProps: image: null
|
||||
|
||||
@propTypes:
|
||||
|
||||
children: PropTypes.element
|
||||
|
||||
componentWillUnmount: -> @sprite.destroy()
|
||||
|
||||
render: ->
|
||||
|
||||
image = React.Children.only @props.children
|
||||
|
||||
child = React.cloneElement image,
|
||||
|
||||
setIntoSprite: (image) => @sprite.setImageOrCanvas image
|
||||
|
||||
@props.setIntoContainer @sprite
|
||||
|
||||
return child
|
||||
|
||||
export default SpriteComponent
|
|
@ -1,46 +0,0 @@
|
|||
import React from 'react';
|
||||
import {Field} from 'redux-form/immutable';
|
||||
|
||||
import contempo from 'contempo';
|
||||
|
||||
import {NumberField} from 'ponere';
|
||||
|
||||
@contempo(require('./vector.scss'))
|
||||
export default class Vector extends React.Component {
|
||||
|
||||
static defaultProps = {
|
||||
max: [99999, 99999],
|
||||
min: [0, 0],
|
||||
xLabel: '',
|
||||
yLabel: '',
|
||||
separatorLabel: 'x',
|
||||
}
|
||||
|
||||
render() {
|
||||
return <div className="vector control">
|
||||
|
||||
{this.props.label && <label>{this.props.label}</label>}
|
||||
<div className="controls">
|
||||
<div className="control">
|
||||
<Field
|
||||
component={NumberField}
|
||||
name={`${this.props.input.name}[0]`}
|
||||
max={this.props.max[0]}
|
||||
min={this.props.min[0]}
|
||||
></Field>
|
||||
<p className="aside">{this.props.xLabel}</p>
|
||||
</div>
|
||||
<div className="separator">{this.props.separatorLabel}</div>
|
||||
<div className="control">
|
||||
<Field
|
||||
component={NumberField}
|
||||
name={`${this.props.input.name}[1]`}
|
||||
max={this.props.max[1]}
|
||||
min={this.props.min[1]}
|
||||
></Field>
|
||||
<p className="aside">{this.props.yLabel}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>;
|
||||
}
|
||||
}
|
|
@ -1,40 +0,0 @@
|
|||
.vector {
|
||||
display: block;
|
||||
@media (min-width: 1024px) {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.control {
|
||||
float: left;
|
||||
|
||||
> label {
|
||||
font-size: 0.8em;
|
||||
}
|
||||
|
||||
.control label {
|
||||
border: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.controls {
|
||||
float: right;
|
||||
position: relative;
|
||||
|
||||
@media (min-width: 1024px) {
|
||||
float: none;
|
||||
}
|
||||
|
||||
&:after {
|
||||
display: table;
|
||||
content: ' ';
|
||||
clear: both;
|
||||
}
|
||||
}
|
||||
|
||||
.separator {
|
||||
float: left;
|
||||
font-size: 0.8em;
|
||||
position: relative;
|
||||
top: 0.4em;
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@avocado/resource",
|
||||
"version": "1.0.3",
|
||||
"version": "1.0.4",
|
||||
"main": "index.js",
|
||||
"author": "cha0s",
|
||||
"license": "MIT",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@avocado/sound",
|
||||
"version": "1.0.2",
|
||||
"version": "1.0.3",
|
||||
"main": "index.js",
|
||||
"author": "cha0s",
|
||||
"license": "MIT",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@avocado/timing",
|
||||
"version": "1.0.5",
|
||||
"version": "1.0.6",
|
||||
"main": "index.js",
|
||||
"author": "cha0s",
|
||||
"license": "MIT",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@avocado/topdown",
|
||||
"version": "1.0.5",
|
||||
"version": "1.0.6",
|
||||
"main": "index.js",
|
||||
"author": "cha0s",
|
||||
"license": "MIT",
|
||||
|
|
Loading…
Reference in New Issue
Block a user