@pixi/accessibility
Advanced tools
Comparing version 5.0.0-alpha.3 to 5.0.0-rc
/*! | ||
* @pixi/accessibility - v5.0.0-alpha.3 | ||
* Compiled Tue, 03 Jul 2018 04:08:21 UTC | ||
* @pixi/accessibility - v5.0.0-rc | ||
* Compiled Fri, 01 Feb 2019 04:50:10 UTC | ||
* | ||
@@ -16,4 +16,6 @@ * @pixi/accessibility is licensed under the MIT License. | ||
* | ||
* @private | ||
* @function accessibleTarget | ||
* @memberof PIXI.accessibility | ||
* @type {Object} | ||
* @example | ||
@@ -33,2 +35,3 @@ * function MyObject() {} | ||
* @member {boolean} | ||
* @memberof PIXI.DisplayObject# | ||
*/ | ||
@@ -41,3 +44,4 @@ accessible: false, | ||
* | ||
* @member {string} | ||
* @member {?string} | ||
* @memberof PIXI.DisplayObject# | ||
*/ | ||
@@ -50,2 +54,3 @@ accessibleTitle: null, | ||
* @member {string} | ||
* @memberof PIXI.DisplayObject# | ||
*/ | ||
@@ -55,2 +60,5 @@ accessibleHint: null, | ||
/** | ||
* @member {number} | ||
* @memberof PIXI.DisplayObject# | ||
* @private | ||
* @todo Needs docs. | ||
@@ -61,2 +69,4 @@ */ | ||
/** | ||
* @member {boolean} | ||
* @memberof PIXI.DisplayObject# | ||
* @todo Needs docs. | ||
@@ -67,2 +77,4 @@ */ | ||
/** | ||
* @member {boolean} | ||
* @memberof PIXI.DisplayObject# | ||
* @todo Needs docs. | ||
@@ -92,10 +104,9 @@ */ | ||
/** | ||
* The Accessibility manager recreates the ability to tab and have content read by screen | ||
* readers. This is very important as it can possibly help people with disabilities access pixi | ||
* content. | ||
* The Accessibility manager recreates the ability to tab and have content read by screen readers. | ||
* This is very important as it can possibly help people with disabilities access PixiJS content. | ||
* | ||
* Much like interaction any DisplayObject can be made accessible. This manager will map the | ||
* A DisplayObject can be made accessible just like it can be made interactive. This manager will map the | ||
* events as if the mouse was being used, minimizing the effort required to implement. | ||
* | ||
* An instance of this class is automatically created by default, and can be found at renderer.plugins.accessibility | ||
* An instance of this class is automatically created by default, and can be found at `renderer.plugins.accessibility` | ||
* | ||
@@ -107,2 +118,7 @@ * @class | ||
{ | ||
/** | ||
* @type {?HTMLElement} | ||
* @private | ||
*/ | ||
this._hookDiv = null; | ||
if ((Device.tablet || Device.phone) && !navigator.isCocoonJS) | ||
@@ -172,14 +188,27 @@ { | ||
* | ||
* @type {Function} | ||
* @private | ||
*/ | ||
this._onKeyDown = this._onKeyDown.bind(this); | ||
this._onMouseMove = this._onMouseMove.bind(this); | ||
/** | ||
* stores the state of the manager. If there are no accessible objects or the mouse is moving, this will be false. | ||
* pre-bind the functions | ||
* | ||
* @member {Array<*>} | ||
* @type {Function} | ||
* @private | ||
*/ | ||
this._onMouseMove = this._onMouseMove.bind(this); | ||
/** | ||
* A flag | ||
* @type {boolean} | ||
* @readonly | ||
*/ | ||
this.isActive = false; | ||
/** | ||
* A flag | ||
* @type {boolean} | ||
* @readonly | ||
*/ | ||
this.isMobileAccessibility = false; | ||
@@ -194,2 +223,3 @@ | ||
* | ||
* @private | ||
*/ | ||
@@ -214,14 +244,30 @@ AccessibilityManager.prototype.createTouchHook = function createTouchHook () | ||
this$1.activate(); | ||
document.body.removeChild(hookDiv); | ||
this$1.destroyTouchHook(); | ||
}); | ||
document.body.appendChild(hookDiv); | ||
this._hookDiv = hookDiv; | ||
}; | ||
/** | ||
* Activating will cause the Accessibility layer to be shown. This is called when a user | ||
* presses the tab key. | ||
* Destroys the touch hooks. | ||
* | ||
* @private | ||
*/ | ||
AccessibilityManager.prototype.destroyTouchHook = function destroyTouchHook () | ||
{ | ||
if (!this._hookDiv) | ||
{ | ||
return; | ||
} | ||
document.body.removeChild(this._hookDiv); | ||
this._hookDiv = null; | ||
}; | ||
/** | ||
* Activating will cause the Accessibility layer to be shown. | ||
* This is called when a user presses the tab key. | ||
* | ||
* @private | ||
*/ | ||
AccessibilityManager.prototype.activate = function activate () | ||
@@ -248,4 +294,4 @@ { | ||
/** | ||
* Deactivating will cause the Accessibility layer to be hidden. This is called when a user moves | ||
* the mouse. | ||
* Deactivating will cause the Accessibility layer to be hidden. | ||
* This is called when a user moves the mouse. | ||
* | ||
@@ -263,3 +309,3 @@ * @private | ||
window.document.removeEventListener('mousemove', this._onMouseMove); | ||
window.document.removeEventListener('mousemove', this._onMouseMove, true); | ||
window.addEventListener('keydown', this._onKeyDown, false); | ||
@@ -283,4 +329,2 @@ | ||
{ | ||
var this$1 = this; | ||
if (!displayObject.visible) | ||
@@ -305,3 +349,3 @@ { | ||
{ | ||
this$1.updateAccessibleObjects(children[i]); | ||
this.updateAccessibleObjects(children[i]); | ||
} | ||
@@ -317,4 +361,2 @@ }; | ||
{ | ||
var this$1 = this; | ||
if (!this.renderer.renderingToScreen) | ||
@@ -341,11 +383,11 @@ { | ||
{ | ||
var child = this$1.children[i]; | ||
var child = this.children[i]; | ||
if (child.renderId !== this$1.renderId) | ||
if (child.renderId !== this.renderId) | ||
{ | ||
child._accessibleActive = false; | ||
removeItems(this$1.children, i, 1); | ||
this$1.div.removeChild(child._accessibleDiv); | ||
this$1.pool.push(child._accessibleDiv); | ||
removeItems(this.children, i, 1); | ||
this.div.removeChild(child._accessibleDiv); | ||
this.pool.push(child._accessibleDiv); | ||
child._accessibleDiv = null; | ||
@@ -355,5 +397,5 @@ | ||
if (this$1.children.length === 0) | ||
if (this.children.length === 0) | ||
{ | ||
this$1.deactivate(); | ||
this.deactivate(); | ||
} | ||
@@ -380,3 +422,3 @@ } | ||
this$1.capHitArea(hitArea); | ||
this.capHitArea(hitArea); | ||
@@ -408,5 +450,5 @@ div.style.left = (hitArea.x * sx) + "px"; | ||
/** | ||
* TODO: docs. | ||
* Adjust the hit area based on the bounds of a display object | ||
* | ||
* @param {Rectangle} hitArea - TODO docs | ||
* @param {Rectangle} hitArea - Bounds of the child | ||
*/ | ||
@@ -600,4 +642,3 @@ AccessibilityManager.prototype.capHitArea = function capHitArea (hitArea) | ||
{ | ||
var this$1 = this; | ||
this.destroyTouchHook(); | ||
this.div = null; | ||
@@ -607,6 +648,6 @@ | ||
{ | ||
this$1.children[i].div = null; | ||
this.children[i].div = null; | ||
} | ||
window.document.removeEventListener('mousemove', this._onMouseMove); | ||
window.document.removeEventListener('mousemove', this._onMouseMove, true); | ||
window.removeEventListener('keydown', this._onKeyDown); | ||
@@ -620,4 +661,3 @@ | ||
/** | ||
* This namespace contains a renderer plugin for interaction accessibility for end-users | ||
* with physical impairments which require screen-renders, keyboard navigation, etc. | ||
* This namespace contains an accessibility plugin for allowing interaction via the keyboard. | ||
* | ||
@@ -624,0 +664,0 @@ * Do not instantiate this plugin directly. It is available from the `renderer.plugins` property. |
/*! | ||
* @pixi/accessibility - v5.0.0-alpha.3 | ||
* Compiled Tue, 03 Jul 2018 04:08:21 UTC | ||
* @pixi/accessibility - v5.0.0-rc | ||
* Compiled Fri, 01 Feb 2019 04:50:10 UTC | ||
* | ||
@@ -22,4 +22,6 @@ * @pixi/accessibility is licensed under the MIT License. | ||
* | ||
* @private | ||
* @function accessibleTarget | ||
* @memberof PIXI.accessibility | ||
* @type {Object} | ||
* @example | ||
@@ -39,2 +41,3 @@ * function MyObject() {} | ||
* @member {boolean} | ||
* @memberof PIXI.DisplayObject# | ||
*/ | ||
@@ -47,3 +50,4 @@ accessible: false, | ||
* | ||
* @member {string} | ||
* @member {?string} | ||
* @memberof PIXI.DisplayObject# | ||
*/ | ||
@@ -56,2 +60,3 @@ accessibleTitle: null, | ||
* @member {string} | ||
* @memberof PIXI.DisplayObject# | ||
*/ | ||
@@ -61,2 +66,5 @@ accessibleHint: null, | ||
/** | ||
* @member {number} | ||
* @memberof PIXI.DisplayObject# | ||
* @private | ||
* @todo Needs docs. | ||
@@ -67,2 +75,4 @@ */ | ||
/** | ||
* @member {boolean} | ||
* @memberof PIXI.DisplayObject# | ||
* @todo Needs docs. | ||
@@ -73,2 +83,4 @@ */ | ||
/** | ||
* @member {boolean} | ||
* @memberof PIXI.DisplayObject# | ||
* @todo Needs docs. | ||
@@ -98,10 +110,9 @@ */ | ||
/** | ||
* The Accessibility manager recreates the ability to tab and have content read by screen | ||
* readers. This is very important as it can possibly help people with disabilities access pixi | ||
* content. | ||
* The Accessibility manager recreates the ability to tab and have content read by screen readers. | ||
* This is very important as it can possibly help people with disabilities access PixiJS content. | ||
* | ||
* Much like interaction any DisplayObject can be made accessible. This manager will map the | ||
* A DisplayObject can be made accessible just like it can be made interactive. This manager will map the | ||
* events as if the mouse was being used, minimizing the effort required to implement. | ||
* | ||
* An instance of this class is automatically created by default, and can be found at renderer.plugins.accessibility | ||
* An instance of this class is automatically created by default, and can be found at `renderer.plugins.accessibility` | ||
* | ||
@@ -113,2 +124,7 @@ * @class | ||
{ | ||
/** | ||
* @type {?HTMLElement} | ||
* @private | ||
*/ | ||
this._hookDiv = null; | ||
if ((Device.tablet || Device.phone) && !navigator.isCocoonJS) | ||
@@ -178,14 +194,27 @@ { | ||
* | ||
* @type {Function} | ||
* @private | ||
*/ | ||
this._onKeyDown = this._onKeyDown.bind(this); | ||
this._onMouseMove = this._onMouseMove.bind(this); | ||
/** | ||
* stores the state of the manager. If there are no accessible objects or the mouse is moving, this will be false. | ||
* pre-bind the functions | ||
* | ||
* @member {Array<*>} | ||
* @type {Function} | ||
* @private | ||
*/ | ||
this._onMouseMove = this._onMouseMove.bind(this); | ||
/** | ||
* A flag | ||
* @type {boolean} | ||
* @readonly | ||
*/ | ||
this.isActive = false; | ||
/** | ||
* A flag | ||
* @type {boolean} | ||
* @readonly | ||
*/ | ||
this.isMobileAccessibility = false; | ||
@@ -200,2 +229,3 @@ | ||
* | ||
* @private | ||
*/ | ||
@@ -220,14 +250,30 @@ AccessibilityManager.prototype.createTouchHook = function createTouchHook () | ||
this$1.activate(); | ||
document.body.removeChild(hookDiv); | ||
this$1.destroyTouchHook(); | ||
}); | ||
document.body.appendChild(hookDiv); | ||
this._hookDiv = hookDiv; | ||
}; | ||
/** | ||
* Activating will cause the Accessibility layer to be shown. This is called when a user | ||
* presses the tab key. | ||
* Destroys the touch hooks. | ||
* | ||
* @private | ||
*/ | ||
AccessibilityManager.prototype.destroyTouchHook = function destroyTouchHook () | ||
{ | ||
if (!this._hookDiv) | ||
{ | ||
return; | ||
} | ||
document.body.removeChild(this._hookDiv); | ||
this._hookDiv = null; | ||
}; | ||
/** | ||
* Activating will cause the Accessibility layer to be shown. | ||
* This is called when a user presses the tab key. | ||
* | ||
* @private | ||
*/ | ||
AccessibilityManager.prototype.activate = function activate () | ||
@@ -254,4 +300,4 @@ { | ||
/** | ||
* Deactivating will cause the Accessibility layer to be hidden. This is called when a user moves | ||
* the mouse. | ||
* Deactivating will cause the Accessibility layer to be hidden. | ||
* This is called when a user moves the mouse. | ||
* | ||
@@ -269,3 +315,3 @@ * @private | ||
window.document.removeEventListener('mousemove', this._onMouseMove); | ||
window.document.removeEventListener('mousemove', this._onMouseMove, true); | ||
window.addEventListener('keydown', this._onKeyDown, false); | ||
@@ -289,4 +335,2 @@ | ||
{ | ||
var this$1 = this; | ||
if (!displayObject.visible) | ||
@@ -311,3 +355,3 @@ { | ||
{ | ||
this$1.updateAccessibleObjects(children[i]); | ||
this.updateAccessibleObjects(children[i]); | ||
} | ||
@@ -323,4 +367,2 @@ }; | ||
{ | ||
var this$1 = this; | ||
if (!this.renderer.renderingToScreen) | ||
@@ -347,11 +389,11 @@ { | ||
{ | ||
var child = this$1.children[i]; | ||
var child = this.children[i]; | ||
if (child.renderId !== this$1.renderId) | ||
if (child.renderId !== this.renderId) | ||
{ | ||
child._accessibleActive = false; | ||
utils.removeItems(this$1.children, i, 1); | ||
this$1.div.removeChild(child._accessibleDiv); | ||
this$1.pool.push(child._accessibleDiv); | ||
utils.removeItems(this.children, i, 1); | ||
this.div.removeChild(child._accessibleDiv); | ||
this.pool.push(child._accessibleDiv); | ||
child._accessibleDiv = null; | ||
@@ -361,5 +403,5 @@ | ||
if (this$1.children.length === 0) | ||
if (this.children.length === 0) | ||
{ | ||
this$1.deactivate(); | ||
this.deactivate(); | ||
} | ||
@@ -386,3 +428,3 @@ } | ||
this$1.capHitArea(hitArea); | ||
this.capHitArea(hitArea); | ||
@@ -414,5 +456,5 @@ div.style.left = (hitArea.x * sx) + "px"; | ||
/** | ||
* TODO: docs. | ||
* Adjust the hit area based on the bounds of a display object | ||
* | ||
* @param {Rectangle} hitArea - TODO docs | ||
* @param {Rectangle} hitArea - Bounds of the child | ||
*/ | ||
@@ -606,4 +648,3 @@ AccessibilityManager.prototype.capHitArea = function capHitArea (hitArea) | ||
{ | ||
var this$1 = this; | ||
this.destroyTouchHook(); | ||
this.div = null; | ||
@@ -613,6 +654,6 @@ | ||
{ | ||
this$1.children[i].div = null; | ||
this.children[i].div = null; | ||
} | ||
window.document.removeEventListener('mousemove', this._onMouseMove); | ||
window.document.removeEventListener('mousemove', this._onMouseMove, true); | ||
window.removeEventListener('keydown', this._onKeyDown); | ||
@@ -626,4 +667,3 @@ | ||
/** | ||
* This namespace contains a renderer plugin for interaction accessibility for end-users | ||
* with physical impairments which require screen-renders, keyboard navigation, etc. | ||
* This namespace contains an accessibility plugin for allowing interaction via the keyboard. | ||
* | ||
@@ -630,0 +670,0 @@ * Do not instantiate this plugin directly. It is available from the `renderer.plugins` property. |
{ | ||
"name": "@pixi/accessibility", | ||
"version": "5.0.0-alpha.3", | ||
"version": "5.0.0-rc", | ||
"main": "lib/accessibility.js", | ||
@@ -28,11 +28,12 @@ "module": "lib/accessibility.es.js", | ||
"dependencies": { | ||
"@pixi/core": "^5.0.0-alpha.3", | ||
"@pixi/display": "^5.0.0-alpha.3", | ||
"@pixi/utils": "^5.0.0-alpha.3", | ||
"ismobilejs": "^0.4.0" | ||
"@pixi/core": "^5.0.0-rc", | ||
"@pixi/display": "^5.0.0-rc", | ||
"@pixi/utils": "^5.0.0-rc", | ||
"ismobilejs": "^0.5.1" | ||
}, | ||
"devDependencies": { | ||
"@pixi/canvas-renderer": "^5.0.0-alpha.3", | ||
"floss": "^2.1.3" | ||
} | ||
"@pixi/canvas-renderer": "^5.0.0-rc", | ||
"floss": "^2.1.5" | ||
}, | ||
"gitHead": "9026a1bbca9a9d86b7a3b6d5eb4fa2c3145c2b85" | ||
} |
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
94483
1108
+ Addedismobilejs@0.5.2(transitive)
- Removedismobilejs@0.4.1(transitive)
Updated@pixi/core@^5.0.0-rc
Updated@pixi/display@^5.0.0-rc
Updated@pixi/utils@^5.0.0-rc
Updatedismobilejs@^0.5.1