@uppy/informer
Advanced tools
Comparing version 3.0.2 to 3.0.3
@@ -8,3 +8,2 @@ import { h, Component, createRef } from 'preact'; | ||
} | ||
componentWillEnter(callback) { | ||
@@ -15,3 +14,2 @@ this.ref.current.style.opacity = '1'; | ||
} | ||
componentWillLeave(callback) { | ||
@@ -22,3 +20,2 @@ this.ref.current.style.opacity = '0'; | ||
} | ||
render() { | ||
@@ -33,3 +30,2 @@ const { | ||
} | ||
} |
/* eslint-disable jsx-a11y/no-noninteractive-element-interactions */ | ||
/* eslint-disable jsx-a11y/click-events-have-key-events */ | ||
@@ -9,3 +8,3 @@ import { h } from 'preact'; | ||
const packageJson = { | ||
"version": "3.0.2" | ||
"version": "3.0.3" | ||
}; | ||
@@ -19,7 +18,5 @@ /** | ||
*/ | ||
export default class Informer extends UIPlugin { | ||
constructor(uppy, opts) { | ||
super(uppy, opts); | ||
this.render = state => { | ||
@@ -36,3 +33,4 @@ return h("div", { | ||
"data-microtip-size": "medium", | ||
role: "tooltip" // eslint-disable-next-line no-alert | ||
role: "tooltip" | ||
// eslint-disable-next-line no-alert | ||
, | ||
@@ -42,14 +40,14 @@ onClick: () => alert(`${info.message} \n\n ${info.details}`) | ||
}; | ||
this.type = 'progressindicator'; | ||
this.id = this.opts.id || 'Informer'; | ||
this.title = 'Informer'; // set default options | ||
this.title = 'Informer'; | ||
const defaultOptions = {}; // merge default options with the ones set by user | ||
this.opts = { ...defaultOptions, | ||
// set default options | ||
const defaultOptions = {}; | ||
// merge default options with the ones set by user | ||
this.opts = { | ||
...defaultOptions, | ||
...opts | ||
}; | ||
} | ||
install() { | ||
@@ -59,3 +57,2 @@ const { | ||
} = this.opts; | ||
if (target) { | ||
@@ -65,4 +62,3 @@ this.mount(target, this); | ||
} | ||
} | ||
Informer.VERSION = packageJson.version; |
/* eslint-disable */ | ||
/** | ||
* @source https://github.com/developit/preact-transition-group | ||
*/ | ||
import { Component, cloneElement, h, toChildArray } from 'preact'; | ||
function assign(obj, props) { | ||
return Object.assign(obj, props); | ||
} | ||
function getKey(vnode, fallback) { | ||
var _vnode$key; | ||
return (_vnode$key = vnode == null ? void 0 : vnode.key) != null ? _vnode$key : fallback; | ||
} | ||
function linkRef(component, name) { | ||
@@ -24,6 +20,4 @@ const cache = component._ptgLinkedRefs || (component._ptgLinkedRefs = {}); | ||
} | ||
function getChildMapping(children) { | ||
const out = {}; | ||
for (let i = 0; i < children.length; i++) { | ||
@@ -35,17 +29,13 @@ if (children[i] != null) { | ||
} | ||
return out; | ||
} | ||
function mergeChildMappings(prev, next) { | ||
prev = prev || {}; | ||
next = next || {}; | ||
const getValueForKey = key => next.hasOwnProperty(key) ? next[key] : prev[key]; | ||
const getValueForKey = key => next.hasOwnProperty(key) ? next[key] : prev[key]; // For each key of `next`, the list of keys to insert before that key in | ||
// For each key of `next`, the list of keys to insert before that key in | ||
// the combined list | ||
const nextKeysPending = {}; | ||
let pendingKeys = []; | ||
for (const prevKey in prev) { | ||
@@ -61,5 +51,3 @@ if (next.hasOwnProperty(prevKey)) { | ||
} | ||
const childMapping = {}; | ||
for (const nextKey in next) { | ||
@@ -72,16 +60,12 @@ if (nextKeysPending.hasOwnProperty(nextKey)) { | ||
} | ||
childMapping[nextKey] = getValueForKey(nextKey); | ||
} // Finally, add the keys which didn't appear before any key in `next` | ||
} | ||
// Finally, add the keys which didn't appear before any key in `next` | ||
for (let i = 0; i < pendingKeys.length; i++) { | ||
childMapping[pendingKeys[i]] = getValueForKey(pendingKeys[i]); | ||
} | ||
return childMapping; | ||
} | ||
const identity = i => i; | ||
class TransitionGroup extends Component { | ||
@@ -98,3 +82,2 @@ constructor(props, context) { | ||
} | ||
componentWillMount() { | ||
@@ -106,6 +89,4 @@ this.currentlyTransitioningKeys = {}; | ||
} | ||
componentDidMount() { | ||
const initialChildMapping = this.state.children; | ||
for (const key in initialChildMapping) { | ||
@@ -118,3 +99,2 @@ if (initialChildMapping[key]) { | ||
} | ||
componentWillReceiveProps(nextProps) { | ||
@@ -127,7 +107,6 @@ const nextChildMapping = getChildMapping(toChildArray(nextProps.children) || []); | ||
let key; | ||
for (key in nextChildMapping) { | ||
if (nextChildMapping.hasOwnProperty(key)) { | ||
const hasPrev = prevChildMapping && prevChildMapping.hasOwnProperty(key); // We should re-enter the component and abort its leave function | ||
const hasPrev = prevChildMapping && prevChildMapping.hasOwnProperty(key); | ||
// We should re-enter the component and abort its leave function | ||
if (nextChildMapping[key] && hasPrev && this.currentlyTransitioningKeys[key]) { | ||
@@ -141,7 +120,5 @@ this.keysToEnter.push(key); | ||
} | ||
for (key in prevChildMapping) { | ||
if (prevChildMapping.hasOwnProperty(key)) { | ||
const hasNext = nextChildMapping && nextChildMapping.hasOwnProperty(key); | ||
if (prevChildMapping[key] && !hasNext && !this.currentlyTransitioningKeys[key]) { | ||
@@ -153,3 +130,2 @@ this.keysToLeave.push(key); | ||
} | ||
componentDidUpdate() { | ||
@@ -167,6 +143,4 @@ const { | ||
} | ||
_finishAbort(key) { | ||
const idx = this.keysToAbortLeave.indexOf(key); | ||
if (idx !== -1) { | ||
@@ -176,7 +150,5 @@ this.keysToAbortLeave.splice(idx, 1); | ||
} | ||
performAppear(key) { | ||
this.currentlyTransitioningKeys[key] = true; | ||
const component = this.refs[key]; | ||
if (component != null && component.componentWillAppear) { | ||
@@ -188,16 +160,10 @@ component.componentWillAppear(this._handleDoneAppearing.bind(this, key)); | ||
} | ||
_handleDoneAppearing(key) { | ||
const component = this.refs[key]; | ||
if (component != null && component.componentDidAppear) { | ||
component.componentDidAppear(); | ||
} | ||
delete this.currentlyTransitioningKeys[key]; | ||
this._finishAbort(key); | ||
const currentChildMapping = getChildMapping(toChildArray(this.props.children) || []); | ||
if (!currentChildMapping || !currentChildMapping.hasOwnProperty(key)) { | ||
@@ -208,7 +174,5 @@ // This was removed before it had fully appeared. Remove it. | ||
} | ||
performEnter(key) { | ||
this.currentlyTransitioningKeys[key] = true; | ||
const component = this.refs[key]; | ||
if (component != null && component.componentWillEnter) { | ||
@@ -220,16 +184,10 @@ component.componentWillEnter(this._handleDoneEntering.bind(this, key)); | ||
} | ||
_handleDoneEntering(key) { | ||
const component = this.refs[key]; | ||
if (component != null && component.componentDidEnter) { | ||
component.componentDidEnter(); | ||
} | ||
delete this.currentlyTransitioningKeys[key]; | ||
this._finishAbort(key); | ||
const currentChildMapping = getChildMapping(toChildArray(this.props.children) || []); | ||
if (!currentChildMapping || !currentChildMapping.hasOwnProperty(key)) { | ||
@@ -240,3 +198,2 @@ // This was removed before it had fully entered. Remove it. | ||
} | ||
performLeave(key) { | ||
@@ -246,10 +203,7 @@ // If we should immediately abort this leave function, | ||
const idx = this.keysToAbortLeave.indexOf(key); | ||
if (idx !== -1) { | ||
return; | ||
} | ||
this.currentlyTransitioningKeys[key] = true; | ||
const component = this.refs[key]; | ||
if (component != null && component.componentWillLeave) { | ||
@@ -264,3 +218,2 @@ component.componentWillLeave(this._handleDoneLeaving.bind(this, key)); | ||
} | ||
_handleDoneLeaving(key) { | ||
@@ -270,16 +223,11 @@ // If we should immediately abort the leave, | ||
const idx = this.keysToAbortLeave.indexOf(key); | ||
if (idx !== -1) { | ||
return; | ||
} | ||
const component = this.refs[key]; | ||
if (component != null && component.componentDidLeave) { | ||
component.componentDidLeave(); | ||
} | ||
delete this.currentlyTransitioningKeys[key]; | ||
const currentChildMapping = getChildMapping(toChildArray(this.props.children) || []); | ||
if (currentChildMapping && currentChildMapping.hasOwnProperty(key)) { | ||
@@ -296,3 +244,2 @@ // This entered again before it fully left. Add it again. | ||
} | ||
render(_ref, _ref2) { | ||
@@ -327,5 +274,3 @@ let { | ||
} | ||
} | ||
TransitionGroup.defaultProps = { | ||
@@ -332,0 +277,0 @@ component: 'span', |
{ | ||
"name": "@uppy/informer", | ||
"description": "A notification and error pop-up bar for Uppy.", | ||
"version": "3.0.2", | ||
"version": "3.0.3", | ||
"license": "MIT", | ||
@@ -27,8 +27,8 @@ "main": "lib/index.js", | ||
"dependencies": { | ||
"@uppy/utils": "^5.3.0", | ||
"@uppy/utils": "^5.4.3", | ||
"preact": "^10.5.13" | ||
}, | ||
"peerDependencies": { | ||
"@uppy/core": "^3.2.0" | ||
"@uppy/core": "^3.4.0" | ||
} | ||
} |
@@ -1,4 +0,4 @@ | ||
import type { PluginOptions, UIPlugin, PluginTarget } from '@uppy/core' | ||
import type { PluginTarget, UIPlugin, UIPluginOptions } from '@uppy/core' | ||
interface InformerOptions extends PluginOptions { | ||
interface InformerOptions extends UIPluginOptions { | ||
target?: PluginTarget | ||
@@ -5,0 +5,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
54485
730
Updated@uppy/utils@^5.4.3