Socket
Socket
Sign inDemoInstall

@pixi/accessibility

Package Overview
Dependencies
Maintainers
3
Versions
122
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@pixi/accessibility - npm Package Compare versions

Comparing version 5.0.4 to 5.1.0

6

dist/accessibility.js
/*!
* @pixi/accessibility - v5.0.4
* Compiled Fri, 07 Jun 2019 17:17:49 UTC
* @pixi/accessibility - v5.1.0
* Compiled Fri, 19 Jul 2019 21:54:36 UTC
*

@@ -545,2 +545,4 @@ * @pixi/accessibility is licensed under the MIT License.

interactionManager.dispatchEvent(e.target.displayObject, 'click', interactionManager.eventData);
interactionManager.dispatchEvent(e.target.displayObject, 'pointertap', interactionManager.eventData);
interactionManager.dispatchEvent(e.target.displayObject, 'tap', interactionManager.eventData);
};

@@ -547,0 +549,0 @@

/*!
* @pixi/accessibility - v5.0.4
* Compiled Fri, 07 Jun 2019 17:17:49 UTC
* @pixi/accessibility - v5.1.0
* Compiled Fri, 19 Jul 2019 21:54:36 UTC
*

@@ -8,3 +8,3 @@ * @pixi/accessibility is licensed under the MIT License.

*/
this.PIXI=this.PIXI||{},this.PIXI.accessibility=this.PIXI.accessibility||{};var _pixi_accessibility=function(e,t,i){"use strict";var s={accessible:!1,accessibleTitle:null,accessibleHint:null,tabIndex:0,_accessibleActive:!1,_accessibleDiv:!1};PIXI.DisplayObject.mixin(s);var n=function(e){this._hookDiv=null,(t.isMobile.tablet||t.isMobile.phone)&&this.createTouchHook();var i=document.createElement("div");i.style.width="100px",i.style.height="100px",i.style.position="absolute",i.style.top="0px",i.style.left="0px",i.style.zIndex=2,this.div=i,this.pool=[],this.renderId=0,this.debug=!1,this.renderer=e,this.children=[],this._onKeyDown=this._onKeyDown.bind(this),this._onMouseMove=this._onMouseMove.bind(this),this.isActive=!1,this.isMobileAccessibility=!1,window.addEventListener("keydown",this._onKeyDown,!1)};return n.prototype.createTouchHook=function(){var e=this,t=document.createElement("button");t.style.width="1px",t.style.height="1px",t.style.position="absolute",t.style.top="-1000px",t.style.left="-1000px",t.style.zIndex=2,t.style.backgroundColor="#FF0000",t.title="HOOK DIV",t.addEventListener("focus",function(){e.isMobileAccessibility=!0,e.activate(),e.destroyTouchHook()}),document.body.appendChild(t),this._hookDiv=t},n.prototype.destroyTouchHook=function(){this._hookDiv&&(document.body.removeChild(this._hookDiv),this._hookDiv=null)},n.prototype.activate=function(){this.isActive||(this.isActive=!0,window.document.addEventListener("mousemove",this._onMouseMove,!0),window.removeEventListener("keydown",this._onKeyDown,!1),this.renderer.on("postrender",this.update,this),this.renderer.view.parentNode&&this.renderer.view.parentNode.appendChild(this.div))},n.prototype.deactivate=function(){this.isActive&&!this.isMobileAccessibility&&(this.isActive=!1,window.document.removeEventListener("mousemove",this._onMouseMove,!0),window.addEventListener("keydown",this._onKeyDown,!1),this.renderer.off("postrender",this.update),this.div.parentNode&&this.div.parentNode.removeChild(this.div))},n.prototype.updateAccessibleObjects=function(e){if(e.visible){e.accessible&&e.interactive&&(e._accessibleActive||this.addChild(e),e.renderId=this.renderId);for(var t=e.children,i=0;i<t.length;i++)this.updateAccessibleObjects(t[i])}},n.prototype.update=function(){if(this.renderer.renderingToScreen){this.updateAccessibleObjects(this.renderer._lastObjectRendered);var e=this.renderer.view.getBoundingClientRect(),i=e.width/this.renderer.width,s=e.height/this.renderer.height,n=this.div;n.style.left=e.left+"px",n.style.top=e.top+"px",n.style.width=this.renderer.width+"px",n.style.height=this.renderer.height+"px";for(var o=0;o<this.children.length;o++){var r=this.children[o];if(r.renderId!==this.renderId)r._accessibleActive=!1,t.removeItems(this.children,o,1),this.div.removeChild(r._accessibleDiv),this.pool.push(r._accessibleDiv),r._accessibleDiv=null,o--,0===this.children.length&&this.deactivate();else{n=r._accessibleDiv;var l=r.hitArea,c=r.worldTransform;r.hitArea?(n.style.left=(c.tx+l.x*c.a)*i+"px",n.style.top=(c.ty+l.y*c.d)*s+"px",n.style.width=l.width*c.a*i+"px",n.style.height=l.height*c.d*s+"px"):(l=r.getBounds(),this.capHitArea(l),n.style.left=l.x*i+"px",n.style.top=l.y*s+"px",n.style.width=l.width*i+"px",n.style.height=l.height*s+"px",n.title!==r.accessibleTitle&&null!==r.accessibleTitle&&(n.title=r.accessibleTitle),n.getAttribute("aria-label")!==r.accessibleHint&&null!==r.accessibleHint&&n.setAttribute("aria-label",r.accessibleHint))}}this.renderId++}},n.prototype.capHitArea=function(e){e.x<0&&(e.width+=e.x,e.x=0),e.y<0&&(e.height+=e.y,e.y=0),e.x+e.width>this.renderer.width&&(e.width=this.renderer.width-e.x),e.y+e.height>this.renderer.height&&(e.height=this.renderer.height-e.y)},n.prototype.addChild=function(e){var t=this.pool.pop();t||((t=document.createElement("button")).style.width="100px",t.style.height="100px",t.style.backgroundColor=this.debug?"rgba(255,0,0,0.5)":"transparent",t.style.position="absolute",t.style.zIndex=2,t.style.borderStyle="none",navigator.userAgent.toLowerCase().indexOf("chrome")>-1?t.setAttribute("aria-live","off"):t.setAttribute("aria-live","polite"),navigator.userAgent.match(/rv:.*Gecko\//)?t.setAttribute("aria-relevant","additions"):t.setAttribute("aria-relevant","text"),t.addEventListener("click",this._onClick.bind(this)),t.addEventListener("focus",this._onFocus.bind(this)),t.addEventListener("focusout",this._onFocusOut.bind(this))),e.accessibleTitle&&null!==e.accessibleTitle?t.title=e.accessibleTitle:e.accessibleHint&&null!==e.accessibleHint||(t.title="displayObject "+e.tabIndex),e.accessibleHint&&null!==e.accessibleHint&&t.setAttribute("aria-label",e.accessibleHint),e._accessibleActive=!0,e._accessibleDiv=t,t.displayObject=e,this.children.push(e),this.div.appendChild(e._accessibleDiv),e._accessibleDiv.tabIndex=e.tabIndex},n.prototype._onClick=function(e){var t=this.renderer.plugins.interaction;t.dispatchEvent(e.target.displayObject,"click",t.eventData)},n.prototype._onFocus=function(e){e.target.getAttribute("aria-live","off")||e.target.setAttribute("aria-live","assertive");var t=this.renderer.plugins.interaction;t.dispatchEvent(e.target.displayObject,"mouseover",t.eventData)},n.prototype._onFocusOut=function(e){e.target.getAttribute("aria-live","off")||e.target.setAttribute("aria-live","polite");var t=this.renderer.plugins.interaction;t.dispatchEvent(e.target.displayObject,"mouseout",t.eventData)},n.prototype._onKeyDown=function(e){9===e.keyCode&&this.activate()},n.prototype._onMouseMove=function(e){0===e.movementX&&0===e.movementY||this.deactivate()},n.prototype.destroy=function(){this.destroyTouchHook(),this.div=null;for(var e=0;e<this.children.length;e++)this.children[e].div=null;window.document.removeEventListener("mousemove",this._onMouseMove,!0),window.removeEventListener("keydown",this._onKeyDown),this.pool=null,this.children=null,this.renderer=null},e.AccessibilityManager=n,e.accessibleTarget=s,e}({},PIXI.utils);Object.assign(this.PIXI.accessibility,_pixi_accessibility);
this.PIXI=this.PIXI||{},this.PIXI.accessibility=this.PIXI.accessibility||{};var _pixi_accessibility=function(e,t,i){"use strict";var s={accessible:!1,accessibleTitle:null,accessibleHint:null,tabIndex:0,_accessibleActive:!1,_accessibleDiv:!1};PIXI.DisplayObject.mixin(s);var n=function(e){this._hookDiv=null,(t.isMobile.tablet||t.isMobile.phone)&&this.createTouchHook();var i=document.createElement("div");i.style.width="100px",i.style.height="100px",i.style.position="absolute",i.style.top="0px",i.style.left="0px",i.style.zIndex=2,this.div=i,this.pool=[],this.renderId=0,this.debug=!1,this.renderer=e,this.children=[],this._onKeyDown=this._onKeyDown.bind(this),this._onMouseMove=this._onMouseMove.bind(this),this.isActive=!1,this.isMobileAccessibility=!1,window.addEventListener("keydown",this._onKeyDown,!1)};return n.prototype.createTouchHook=function(){var e=this,t=document.createElement("button");t.style.width="1px",t.style.height="1px",t.style.position="absolute",t.style.top="-1000px",t.style.left="-1000px",t.style.zIndex=2,t.style.backgroundColor="#FF0000",t.title="HOOK DIV",t.addEventListener("focus",function(){e.isMobileAccessibility=!0,e.activate(),e.destroyTouchHook()}),document.body.appendChild(t),this._hookDiv=t},n.prototype.destroyTouchHook=function(){this._hookDiv&&(document.body.removeChild(this._hookDiv),this._hookDiv=null)},n.prototype.activate=function(){this.isActive||(this.isActive=!0,window.document.addEventListener("mousemove",this._onMouseMove,!0),window.removeEventListener("keydown",this._onKeyDown,!1),this.renderer.on("postrender",this.update,this),this.renderer.view.parentNode&&this.renderer.view.parentNode.appendChild(this.div))},n.prototype.deactivate=function(){this.isActive&&!this.isMobileAccessibility&&(this.isActive=!1,window.document.removeEventListener("mousemove",this._onMouseMove,!0),window.addEventListener("keydown",this._onKeyDown,!1),this.renderer.off("postrender",this.update),this.div.parentNode&&this.div.parentNode.removeChild(this.div))},n.prototype.updateAccessibleObjects=function(e){if(e.visible){e.accessible&&e.interactive&&(e._accessibleActive||this.addChild(e),e.renderId=this.renderId);for(var t=e.children,i=0;i<t.length;i++)this.updateAccessibleObjects(t[i])}},n.prototype.update=function(){if(this.renderer.renderingToScreen){this.updateAccessibleObjects(this.renderer._lastObjectRendered);var e=this.renderer.view.getBoundingClientRect(),i=e.width/this.renderer.width,s=e.height/this.renderer.height,n=this.div;n.style.left=e.left+"px",n.style.top=e.top+"px",n.style.width=this.renderer.width+"px",n.style.height=this.renderer.height+"px";for(var o=0;o<this.children.length;o++){var r=this.children[o];if(r.renderId!==this.renderId)r._accessibleActive=!1,t.removeItems(this.children,o,1),this.div.removeChild(r._accessibleDiv),this.pool.push(r._accessibleDiv),r._accessibleDiv=null,o--,0===this.children.length&&this.deactivate();else{n=r._accessibleDiv;var l=r.hitArea,c=r.worldTransform;r.hitArea?(n.style.left=(c.tx+l.x*c.a)*i+"px",n.style.top=(c.ty+l.y*c.d)*s+"px",n.style.width=l.width*c.a*i+"px",n.style.height=l.height*c.d*s+"px"):(l=r.getBounds(),this.capHitArea(l),n.style.left=l.x*i+"px",n.style.top=l.y*s+"px",n.style.width=l.width*i+"px",n.style.height=l.height*s+"px",n.title!==r.accessibleTitle&&null!==r.accessibleTitle&&(n.title=r.accessibleTitle),n.getAttribute("aria-label")!==r.accessibleHint&&null!==r.accessibleHint&&n.setAttribute("aria-label",r.accessibleHint))}}this.renderId++}},n.prototype.capHitArea=function(e){e.x<0&&(e.width+=e.x,e.x=0),e.y<0&&(e.height+=e.y,e.y=0),e.x+e.width>this.renderer.width&&(e.width=this.renderer.width-e.x),e.y+e.height>this.renderer.height&&(e.height=this.renderer.height-e.y)},n.prototype.addChild=function(e){var t=this.pool.pop();t||((t=document.createElement("button")).style.width="100px",t.style.height="100px",t.style.backgroundColor=this.debug?"rgba(255,0,0,0.5)":"transparent",t.style.position="absolute",t.style.zIndex=2,t.style.borderStyle="none",navigator.userAgent.toLowerCase().indexOf("chrome")>-1?t.setAttribute("aria-live","off"):t.setAttribute("aria-live","polite"),navigator.userAgent.match(/rv:.*Gecko\//)?t.setAttribute("aria-relevant","additions"):t.setAttribute("aria-relevant","text"),t.addEventListener("click",this._onClick.bind(this)),t.addEventListener("focus",this._onFocus.bind(this)),t.addEventListener("focusout",this._onFocusOut.bind(this))),e.accessibleTitle&&null!==e.accessibleTitle?t.title=e.accessibleTitle:e.accessibleHint&&null!==e.accessibleHint||(t.title="displayObject "+e.tabIndex),e.accessibleHint&&null!==e.accessibleHint&&t.setAttribute("aria-label",e.accessibleHint),e._accessibleActive=!0,e._accessibleDiv=t,t.displayObject=e,this.children.push(e),this.div.appendChild(e._accessibleDiv),e._accessibleDiv.tabIndex=e.tabIndex},n.prototype._onClick=function(e){var t=this.renderer.plugins.interaction;t.dispatchEvent(e.target.displayObject,"click",t.eventData),t.dispatchEvent(e.target.displayObject,"pointertap",t.eventData),t.dispatchEvent(e.target.displayObject,"tap",t.eventData)},n.prototype._onFocus=function(e){e.target.getAttribute("aria-live","off")||e.target.setAttribute("aria-live","assertive");var t=this.renderer.plugins.interaction;t.dispatchEvent(e.target.displayObject,"mouseover",t.eventData)},n.prototype._onFocusOut=function(e){e.target.getAttribute("aria-live","off")||e.target.setAttribute("aria-live","polite");var t=this.renderer.plugins.interaction;t.dispatchEvent(e.target.displayObject,"mouseout",t.eventData)},n.prototype._onKeyDown=function(e){9===e.keyCode&&this.activate()},n.prototype._onMouseMove=function(e){0===e.movementX&&0===e.movementY||this.deactivate()},n.prototype.destroy=function(){this.destroyTouchHook(),this.div=null;for(var e=0;e<this.children.length;e++)this.children[e].div=null;window.document.removeEventListener("mousemove",this._onMouseMove,!0),window.removeEventListener("keydown",this._onKeyDown),this.pool=null,this.children=null,this.renderer=null},e.AccessibilityManager=n,e.accessibleTarget=s,e}({},PIXI.utils);Object.assign(this.PIXI.accessibility,_pixi_accessibility);
//# sourceMappingURL=accessibility.min.js.map
/*!
* @pixi/accessibility - v5.0.4
* Compiled Fri, 07 Jun 2019 17:17:49 UTC
* @pixi/accessibility - v5.1.0
* Compiled Fri, 19 Jul 2019 21:54:36 UTC
*

@@ -543,2 +543,4 @@ * @pixi/accessibility is licensed under the MIT License.

interactionManager.dispatchEvent(e.target.displayObject, 'click', interactionManager.eventData);
interactionManager.dispatchEvent(e.target.displayObject, 'pointertap', interactionManager.eventData);
interactionManager.dispatchEvent(e.target.displayObject, 'tap', interactionManager.eventData);
};

@@ -545,0 +547,0 @@

/*!
* @pixi/accessibility - v5.0.4
* Compiled Fri, 07 Jun 2019 17:17:49 UTC
* @pixi/accessibility - v5.1.0
* Compiled Fri, 19 Jul 2019 21:54:36 UTC
*

@@ -547,2 +547,4 @@ * @pixi/accessibility is licensed under the MIT License.

interactionManager.dispatchEvent(e.target.displayObject, 'click', interactionManager.eventData);
interactionManager.dispatchEvent(e.target.displayObject, 'pointertap', interactionManager.eventData);
interactionManager.dispatchEvent(e.target.displayObject, 'tap', interactionManager.eventData);
};

@@ -549,0 +551,0 @@

{
"name": "@pixi/accessibility",
"version": "5.0.4",
"version": "5.1.0",
"main": "lib/accessibility.js",

@@ -23,5 +23,2 @@ "module": "lib/accessibility.es.js",

},
"scripts": {
"test": "floss --path test"
},
"files": [

@@ -32,11 +29,10 @@ "lib",

"dependencies": {
"@pixi/core": "^5.0.4",
"@pixi/display": "^5.0.4",
"@pixi/utils": "^5.0.4"
"@pixi/core": "^5.1.0",
"@pixi/display": "^5.1.0",
"@pixi/utils": "^5.1.0"
},
"devDependencies": {
"@pixi/canvas-renderer": "^5.0.4",
"floss": "^2.2.0"
"@pixi/canvas-renderer": "^5.1.0"
},
"gitHead": "7a771ca5f05eeba62222b53446d0c2bdfcac37f7"
"gitHead": "05c5e0e0beba56e886c74f201bf7efe576612570"
}

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc