| 19 | import { formatNodeName } from './util' |
| 20 | |
| 21 | export default class Elements extends Tool { |
| 22 | constructor() { |
| 23 | super() |
| 24 | |
| 25 | this._style = evalCss(require('./Elements.scss')) |
| 26 | |
| 27 | this.name = 'elements' |
| 28 | this._selectElement = false |
| 29 | this._observeElement = true |
| 30 | this._history = [] |
| 31 | |
| 32 | Emitter.mixin(this) |
| 33 | } |
| 34 | init($el, container) { |
| 35 | super.init($el) |
| 36 | |
| 37 | this._container = container |
| 38 | |
| 39 | this._initTpl() |
| 40 | this._htmlEl = document.documentElement |
| 41 | this._detail = new Detail(this._$detail, container) |
| 42 | this.config = this._detail.config |
| 43 | this._splitMediaQuery = new MediaQuery('screen and (min-width: 680px)') |
| 44 | this._splitMode = this._splitMediaQuery.isMatch() |
| 45 | this._domViewer = new LunaDomViewer(this._$domViewer.get(0), { |
| 46 | node: this._htmlEl, |
| 47 | ignore: (node) => isErudaEl(node) || isChobitsuEl(node), |
| 48 | }) |
| 49 | this._domViewer.expand() |
| 50 | this._bindEvent() |
| 51 | chobitsu.domain('Overlay').enable() |
| 52 | |
| 53 | nextTick(() => this._updateHistory()) |
| 54 | } |
| 55 | show() { |
| 56 | super.show() |
| 57 | this._isShow = true |
| 58 | |
| 59 | if (!this._curNode) { |
| 60 | this.select(document.body) |
| 61 | } else if (this._splitMode) { |
| 62 | this._showDetail() |
| 63 | } |
| 64 | } |
| 65 | hide() { |
| 66 | super.hide() |
| 67 | this._isShow = false |
| 68 | |
| 69 | chobitsu.domain('Overlay').hideHighlight() |
| 70 | } |
| 71 | select(node) { |
| 72 | this._domViewer.select(node) |
| 73 | this._setNode(node) |
| 74 | this.emit('change', node) |
| 75 | return this |
| 76 | } |
| 77 | destroy() { |
| 78 | super.destroy() |
nothing calls this directly
no test coverage detected
searching dependent graphs…