@@ -10,10 +10,11 @@ import CanvasDrawer from "./mixins/canvas-drawer"
1010import include from "./decorators/include"
1111import element from "./decorators/element"
1212
13- import MinimapQuickSettingsElement from "./minimap-quick-settings-element"
13+ import { createMinimapQuickSettingsElement } from "./minimap-quick-settings-element"
1414const elementResizeDetector = elementResizeDetectorImport ( { strategy : "scroll" } )
1515
1616const SPEC_MODE = atom . inSpecMode ( )
17+ const TAG_NAME = "atom-text-editor-minimap"
1718
1819/**
1920 * Public: The MinimapElement is the view meant to render a {@link Minimap} instance in the DOM.
@@ -25,10 +26,10 @@ const SPEC_MODE = atom.inSpecMode()
2526 *
2627 * @example Let minimapElement = atom.views.getView(minimap)
2728 */
28- class MinimapElement {
29+ class MinimapElement extends HTMLElement {
2930 static initClass ( ) {
3031 include ( this , CanvasDrawer , EventsDelegation , AncestorsMethods )
31- return element ( this , "atom-text-editor-minimap" )
32+ element ( this , TAG_NAME )
3233 }
3334
3435 // ## ## ####### ####### ## ## ######
@@ -273,7 +274,7 @@ class MinimapElement {
273274 *
274275 * @access private
275276 */
276- attachedCallback ( ) {
277+ connectedCallback ( ) {
277278 if ( typeof atom . views . pollDocument === "function" ) {
278279 this . subscriptions . add (
279280 atom . views . pollDocument ( ( ) => {
@@ -326,7 +327,7 @@ class MinimapElement {
326327 *
327328 * @access private
328329 */
329- detachedCallback ( ) {
330+ disconnectedCallback ( ) {
330331 this . minimap . getTextEditorElement ( ) . removeAttribute ( "with-minimap" )
331332 this . attached = false
332333 }
@@ -363,7 +364,7 @@ class MinimapElement {
363364 }
364365
365366 const container = parent || this . minimap . getTextEditorElement ( )
366- const minimaps = container . querySelectorAll ( "atom-text-editor-minimap" )
367+ const minimaps = container . querySelectorAll ( TAG_NAME )
367368 if ( minimaps . length ) {
368369 Array . prototype . forEach . call ( minimaps , ( el ) => {
369370 el . destroy ( )
@@ -583,7 +584,7 @@ class MinimapElement {
583584 this . quickSettingsElement . destroy ( )
584585 this . quickSettingsSubscription . dispose ( )
585586 } else {
586- this . quickSettingsElement = new MinimapQuickSettingsElement ( )
587+ this . quickSettingsElement = createMinimapQuickSettingsElement ( )
587588 this . quickSettingsElement . setModel ( this )
588589 this . quickSettingsSubscription = this . quickSettingsElement . onDidDestroy ( ( ) => {
589590 this . quickSettingsElement = null
@@ -1220,8 +1221,13 @@ class MinimapElement {
12201221 }
12211222}
12221223
1223- const minimapElement = MinimapElement . initClass ( )
1224- export default minimapElement
1224+ MinimapElement . initClass ( )
1225+
1226+ export function createMinimapElement ( ) {
1227+ const element = document . createElement ( TAG_NAME )
1228+ element . createdCallback ( )
1229+ return element
1230+ }
12251231
12261232// ######## ## ## ######## ## ## ######## ######
12271233// ## ## ## ## ### ## ## ## ##
0 commit comments