Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
);
}
let name = node.get('name') + '';
// If the user's filtering then highlight search terms in the tag name.
// This will serve as a visual reminder that the visible tree is filtered.
if (searchRegExp) {
const unmatched = name.split(searchRegExp);
const matched = name.match(searchRegExp);
const pieces = [
<span>{unmatched.shift()}</span>,
];
while (unmatched.length > 0) {
pieces.push(
<span style="{highlightStyle(theme)}">{nullthrows(matched).shift()}</span>
);
pieces.push(
<span>{unmatched.shift()}</span>
);
}
name = pieces;
}
const dollarRStyle = {
color: isWindowFocused ? getInvertedWeak(theme.state02) : 'inherit',
};
// Single-line tag (collapsed / simple content / no content)
if (!children || typeof children === 'string' || !children.length) {
const jsxSingleLineTagStyle = jsxTagStyle(inverted, nodeType, theme);
window.addEventListener('keydown', function(e) {
const body = nullthrows(document.body);
if (e.altKey && e.keyCode === 68) { // Alt + D
if (body.className === 'devtools-bottom') {
body.className = 'devtools-right';
} else {
body.className = 'devtools-bottom';
}
}
});
window.__REACT_DEVTOOLS_GLOBAL_HOOK__.nativeWeakMap = WeakMap;
window.__REACT_DEVTOOLS_GLOBAL_HOOK__.nativeSet = Set;
`;
var js = (
';(' + installGlobalHook.toString() + '(window))' +
saveNativeValues +
detectReact
);
// This script runs before the element is created, so we add the script
// to instead.
var script = document.createElement('script');
script.textContent = js;
nullthrows(document.documentElement).appendChild(script);
nullthrows(script.parentNode).removeChild(script);
function _parseJarJarRule(line) {
let [type, ...parts] = line.trim().split(/\s+/);
if (type === 'rule') {
return { type, match: nullthrows(parts[0]), replace: nullthrows(parts[1]) };
} else if (type === 'zap' || type === 'keep') {
return { type, match: nullthrows(parts[0]) };
}
throw new Error(`Unknown Jar Jar rule: ${line}`);
}
_setRef = element => {
if (!element) {
return;
}
const elementHeight = nullthrows(element.querySelector('ul')).clientHeight;
const windowHeight = window.innerHeight;
if (this.state.elementHeight === elementHeight && this.state.windowHeight === windowHeight) {
return;
}
this.setState({
elementHeight: elementHeight,
windowHeight: windowHeight,
});
};
getId(internalInstance: OpaqueNodeHandle): ElementID {
if (typeof internalInstance !== 'object' || !internalInstance) {
return internalInstance;
}
if (!this.idsByInternalInstances.has(internalInstance)) {
this.idsByInternalInstances.set(internalInstance, guid());
this.internalInstancesById.set(
nullthrows(this.idsByInternalInstances.get(internalInstance)),
internalInstance
);
}
return nullthrows(this.idsByInternalInstances.get(internalInstance));
}
renderItem(name: string, key: string) {
const data = nullthrows(this.props.data);
return (
);
}
function renderApplication() {
ReactDOM.render(
,
nullthrows(document.getElementById('application'))
);
}
_onClick: Function = (event): void => {
const container = nullthrows(this._containerRef);
const targetPosition = nullthrows(
this._colorChipRef,
).getBoundingClientRect();
this.setState({
isColorPickerOpen: true,
maxHeight: container.offsetHeight,
targetPosition,
});
};
function inject(src, done) {
if (!src || src === 'false') {
done();
return;
}
invariant(target instanceof HTMLIFrameElement);
var script = target.contentDocument.createElement('script');
script.src = src;
script.onload = done;
nullthrows(target.contentDocument.body).appendChild(script);
}