Toolbar.js (2151B)
1 /* This Source Code Form is subject to the terms of the Mozilla Public 2 * License, v. 2.0. If a copy of the MPL was not distributed with this 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 4 "use strict"; 5 6 // React 7 const { 8 createFactory, 9 } = require("resource://devtools/client/shared/vendor/react.mjs"); 10 const { 11 div, 12 } = require("resource://devtools/client/shared/vendor/react-dom-factories.js"); 13 const AccessibilityTreeFilter = createFactory( 14 require("resource://devtools/client/accessibility/components/AccessibilityTreeFilter.js") 15 ); 16 const AccessibilityPrefs = createFactory( 17 require("resource://devtools/client/accessibility/components/AccessibilityPrefs.js") 18 ); 19 loader.lazyGetter(this, "SimulationMenuButton", function () { 20 return createFactory( 21 require("resource://devtools/client/accessibility/components/SimulationMenuButton.js") 22 ); 23 }); 24 const DisplayTabbingOrder = createFactory( 25 require("resource://devtools/client/accessibility/components/DisplayTabbingOrder.js") 26 ); 27 28 const { 29 connect, 30 } = require("resource://devtools/client/shared/vendor/react-redux.js"); 31 32 function Toolbar({ audit, simulate, supportsTabbingOrder, toolboxDoc }) { 33 const optionalSimulationSection = simulate 34 ? [ 35 div({ 36 role: "separator", 37 className: "devtools-separator", 38 }), 39 SimulationMenuButton({ simulate, toolboxDoc }), 40 ] 41 : []; 42 const optionalDisplayTabbingOrderSection = supportsTabbingOrder 43 ? [ 44 div({ 45 role: "separator", 46 className: "devtools-separator", 47 }), 48 DisplayTabbingOrder(), 49 ] 50 : []; 51 52 return div( 53 { 54 className: "devtools-toolbar", 55 role: "toolbar", 56 }, 57 AccessibilityTreeFilter({ audit, toolboxDoc }), 58 // Simulation section is shown if webrender is enabled 59 ...optionalSimulationSection, 60 ...optionalDisplayTabbingOrderSection, 61 AccessibilityPrefs({ toolboxDoc }) 62 ); 63 } 64 65 const mapStateToProps = ({ 66 ui: { 67 supports: { tabbingOrder }, 68 }, 69 }) => ({ 70 supportsTabbingOrder: tabbingOrder, 71 }); 72 73 // Exports from this module 74 exports.Toolbar = connect(mapStateToProps)(Toolbar);