@schukai/monster 3.85.0 → 3.85.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -8,30 +8,32 @@
8
8
  * For those who do not wish to adhere to the AGPLv3, a commercial license is available.
9
9
  * Acquiring a commercial license allows you to use this software without complying with the AGPLv3 terms.
10
10
  * For more information about purchasing a commercial license, please contact schukai GmbH.
11
+ *
12
+ * SPDX-License-Identifier: AGPL-3.0
11
13
  */
12
14
 
13
- import { instanceSymbol } from "../../constants.mjs";
15
+ import {instanceSymbol} from "../../constants.mjs";
14
16
  import {
15
- addAttributeToken,
16
- removeAttributeToken,
17
+ addAttributeToken,
18
+ removeAttributeToken,
17
19
  } from "../../dom/attributes.mjs";
18
20
  import {
19
- ATTRIBUTE_ERRORMESSAGE,
20
- ATTRIBUTE_ROLE,
21
+ ATTRIBUTE_ERRORMESSAGE,
22
+ ATTRIBUTE_ROLE,
21
23
  } from "../../dom/constants.mjs";
22
- import { CustomElement, getSlottedElements } from "../../dom/customelement.mjs";
24
+ import {CustomElement} from "../../dom/customelement.mjs";
23
25
  import {
24
- assembleMethodSymbol,
25
- registerCustomElement,
26
+ assembleMethodSymbol,
27
+ registerCustomElement,
26
28
  } from "../../dom/customelement.mjs";
27
- import { getDocument } from "../../dom/util.mjs";
28
- import { STYLE_DISPLAY_MODE_BLOCK } from "../form/constants.mjs";
29
- import { CopyStyleSheet } from "./stylesheet/copy.mjs";
30
- import { fireCustomEvent } from "../../dom/events.mjs";
31
- import { positionPopper } from "../form/util/floating-ui.mjs";
32
- import { DeadMansSwitch } from "../../util/deadmansswitch.mjs";
29
+ import {getDocument} from "../../dom/util.mjs";
30
+ import {STYLE_DISPLAY_MODE_BLOCK} from "../form/constants.mjs";
31
+ import {CopyStyleSheet} from "./stylesheet/copy.mjs";
32
+ import {fireCustomEvent} from "../../dom/events.mjs";
33
+ import {positionPopper} from "../form/util/floating-ui.mjs";
34
+ import {DeadMansSwitch} from "../../util/deadmansswitch.mjs";
33
35
 
34
- export { Copy };
36
+ export {Copy};
35
37
 
36
38
  /**
37
39
  * @private
@@ -39,6 +41,12 @@ export { Copy };
39
41
  */
40
42
  const timerCallbackSymbol = Symbol("timerCallback");
41
43
 
44
+ /**
45
+ * @private
46
+ * @type {symbol}
47
+ */
48
+ const timerDelaySymbol = Symbol("timerDelay");
49
+
42
50
  /**
43
51
  * @private
44
52
  * @type {symbol}
@@ -83,248 +91,265 @@ const resizeObserverSymbol = Symbol("resizeObserver");
83
91
  * @summary A beautiful Copy that can make your life easier and also looks good.
84
92
  */
85
93
  class Copy extends CustomElement {
86
- /**
87
- * This method is called by the `instanceof` operator.
88
- * @return {symbol}
89
- */
90
- static get [instanceSymbol]() {
91
- return Symbol.for("@schukai/monster/components/content/copy@@instance");
92
- }
93
-
94
- /**
95
- *
96
- * @return {Components.Content.Copy
97
- * @fires monster-copy-clicked This event is fired when the copy button is clicked.
98
- * @fires monster-copy-success This event is fired when the copy action is successful.
99
- * @fires monster-copy-error This event is fired when the copy action fails.
100
- */
101
- [assembleMethodSymbol]() {
102
- super[assembleMethodSymbol]();
103
- initControlReferences.call(this);
104
- initEventHandler.call(this);
105
- return this;
106
- }
107
-
108
- /**
109
- * This method is called when the element is connected to the dom.
110
- *
111
- * @return {void}
112
- */
113
- connectedCallback() {
114
- super.connectedCallback();
115
-
116
- const document = getDocument();
117
-
118
- for (const [, type] of Object.entries(["click", "touch"])) {
119
- // close on outside ui-events
120
- document.addEventListener(type, this[closeEventHandler]);
121
- }
122
-
123
- updatePopper.call(this);
124
- attachResizeObserver.call(this);
125
- }
126
-
127
- /**
128
- * This method is called when the element is disconnected from the dom.
129
- *
130
- * @return {void}
131
- */
132
- disconnectedCallback() {
133
- super.disconnectedCallback();
134
-
135
- // close on outside ui-events
136
- for (const [, type] of Object.entries(["click", "touch"])) {
137
- document.removeEventListener(type, this[closeEventHandler]);
138
- }
139
-
140
- disconnectResizeObserver.call(this);
141
- }
142
-
143
- /**
144
- * To set the options via the HTML Tag, the attribute `data-monster-options` must be used.
145
- * @see {@link https://monsterjs.org/en/doc/#configurate-a-monster-control}
146
- *
147
- * The individual configuration values can be found in the table.
148
- *
149
- * @property {Object} templates Template definitions
150
- * @property {string} templates.main Main template
151
- * @property {Object} actions Callbacks
152
- * @property {string} actions.click="throw Error" Callback when clicked
153
- * @property {Object} features Features
154
- * @property {boolean} features.stripTags=true Strip tags from the copied text
155
- * @property {boolean} features.preventOpenEventSent=false Prevent open event from being sent
156
- * @property {Object} popper Popper configuration
157
- * @property {string} popper.placement="top" Popper placement
158
- * @property {string[]} popper.middleware=["autoPlacement", "shift", "offset:15", "arrow"] Popper middleware
159
- * @property {boolean} disabled=false Disabled state
160
- */
161
- get defaults() {
162
- return Object.assign({}, super.defaults, {
163
- templates: {
164
- main: getTemplate(),
165
- },
166
- disabled: false,
167
- features: {
168
- stripTags: true,
169
- preventOpenEventSent: false,
170
- },
171
- popper: {
172
- placement: "top",
173
- middleware: ["autoPlacement", "shift", "offset:15", "arrow"],
174
- },
175
- });
176
- }
177
-
178
- /**
179
- * @return {string}
180
- */
181
- static getTag() {
182
- return "monster-copy";
183
- }
184
-
185
- /**
186
- * @return {CSSStyleSheet[]}
187
- */
188
- static getCSSStyleSheet() {
189
- return [CopyStyleSheet];
190
- }
191
-
192
- /**
193
- * With this method, you can show the popper.
194
- *
195
- * @return {Copy}
196
- */
197
- showDialog() {
198
- show.call(this);
199
- return this;
200
- }
201
-
202
- /**
203
- * With this method, you can hide the popper.
204
- *
205
- * @return {Copy}
206
- */
207
- hideDialog() {
208
- hide.call(this);
209
- return this;
210
- }
211
-
212
- /**
213
- * With this method, you can toggle the popper.
214
- *
215
- * @return {Copy}
216
- */
217
- toggleDialog() {
218
- if (this[popperElementSymbol].style.display === STYLE_DISPLAY_MODE_BLOCK) {
219
- this.hideDialog();
220
- } else {
221
- this.showDialog();
222
- }
223
- return this;
224
- }
94
+ /**
95
+ * This method is called by the `instanceof` operator.
96
+ * @return {symbol}
97
+ */
98
+ static get [instanceSymbol]() {
99
+ return Symbol.for("@schukai/monster/components/content/copy@@instance");
100
+ }
101
+
102
+ /**
103
+ *
104
+ * @return {Components.Content.Copy
105
+ * @fires monster-copy-clicked This event is fired when the copy button is clicked.
106
+ * @fires monster-copy-success This event is fired when the copy action is successful.
107
+ * @fires monster-copy-error This event is fired when the copy action fails.
108
+ */
109
+ [assembleMethodSymbol]() {
110
+ super[assembleMethodSymbol]();
111
+ initControlReferences.call(this);
112
+ initEventHandler.call(this);
113
+ return this;
114
+ }
115
+
116
+ /**
117
+ * This method is called when the element is connected to the dom.
118
+ *
119
+ * @return {void}
120
+ */
121
+ connectedCallback() {
122
+ super.connectedCallback();
123
+
124
+ const document = getDocument();
125
+
126
+ for (const [, type] of Object.entries(["click", "touch"])) {
127
+ // close on outside ui-events
128
+ document.addEventListener(type, this[closeEventHandler]);
129
+ }
130
+
131
+ updatePopper.call(this);
132
+ attachResizeObserver.call(this);
133
+ }
134
+
135
+ /**
136
+ * This method is called when the element is disconnected from the dom.
137
+ *
138
+ * @return {void}
139
+ */
140
+ disconnectedCallback() {
141
+ super.disconnectedCallback();
142
+
143
+ // close on outside ui-events
144
+ for (const [, type] of Object.entries(["click", "touch"])) {
145
+ document.removeEventListener(type, this[closeEventHandler]);
146
+ }
147
+
148
+ disconnectResizeObserver.call(this);
149
+ }
150
+
151
+ /**
152
+ * To set the options via the HTML Tag, the attribute `data-monster-options` must be used.
153
+ * @see {@link https://monsterjs.org/en/doc/#configurate-a-monster-control}
154
+ *
155
+ * The individual configuration values can be found in the table.
156
+ *
157
+ * @property {Object} templates Template definitions
158
+ * @property {string} templates.main Main template
159
+ * @property {Object} actions Callbacks
160
+ * @property {string} actions.click="throw Error" Callback when clicked
161
+ * @property {Object} features Features
162
+ * @property {boolean} features.stripTags=true Strip tags from the copied text
163
+ * @property {boolean} features.preventOpenEventSent=false Prevent open event from being sent
164
+ * @property {Object} popper Popper configuration
165
+ * @property {string} popper.placement="top" Popper placement
166
+ * @property {string[]} popper.middleware=["autoPlacement", "shift", "offset:15", "arrow"] Popper middleware
167
+ * @property {boolean} disabled=false Disabled state
168
+ */
169
+ get defaults() {
170
+ return Object.assign({}, super.defaults, {
171
+ templates: {
172
+ main: getTemplate(),
173
+ },
174
+ disabled: false,
175
+ features: {
176
+ stripTags: true,
177
+ preventOpenEventSent: false,
178
+ },
179
+ popper: {
180
+ placement: "top",
181
+ middleware: ["autoPlacement", "offset:-1", "arrow"],
182
+ },
183
+ });
184
+ }
185
+
186
+ /**
187
+ * @return {string}
188
+ */
189
+ static getTag() {
190
+ return "monster-copy";
191
+ }
192
+
193
+ /**
194
+ * @return {CSSStyleSheet[]}
195
+ */
196
+ static getCSSStyleSheet() {
197
+ return [CopyStyleSheet];
198
+ }
199
+
200
+ /**
201
+ * With this method, you can show the popper.
202
+ *
203
+ * @return {Copy}
204
+ */
205
+ showDialog() {
206
+ if (this[timerDelaySymbol] instanceof DeadMansSwitch) {
207
+ try {
208
+ this[timerDelaySymbol].defuse();
209
+ } catch (e) {
210
+ }
211
+ }
212
+
213
+ this[timerDelaySymbol] = new DeadMansSwitch(500, () => {
214
+ show.call(this);
215
+ });
216
+
217
+ return this;
218
+ }
219
+
220
+ /**
221
+ * With this method, you can hide the popper.
222
+ *
223
+ * @return {Copy}
224
+ */
225
+ hideDialog() {
226
+ if (this[timerDelaySymbol] instanceof DeadMansSwitch) {
227
+ try {
228
+ this[timerDelaySymbol].defuse();
229
+ } catch (e) {
230
+ }
231
+ }
232
+
233
+ hide.call(this);
234
+ return this;
235
+ }
236
+
237
+ /**
238
+ * With this method, you can toggle the popper.
239
+ *
240
+ * @return {Copy}
241
+ */
242
+ toggleDialog() {
243
+ if (this[popperElementSymbol].style.display === STYLE_DISPLAY_MODE_BLOCK) {
244
+ this.hideDialog();
245
+ } else {
246
+ this.showDialog();
247
+ }
248
+ return this;
249
+ }
225
250
  }
226
251
 
227
252
  /**
228
253
  * @private
229
254
  */
230
255
  function attachResizeObserver() {
231
- // against flickering
232
- this[resizeObserverSymbol] = new ResizeObserver((entries) => {
233
- if (this[timerCallbackSymbol] instanceof DeadMansSwitch) {
234
- try {
235
- this[timerCallbackSymbol].touch();
236
- return;
237
- } catch (e) {
238
- delete this[timerCallbackSymbol];
239
- }
240
- }
241
-
242
- this[timerCallbackSymbol] = new DeadMansSwitch(200, () => {
243
- updatePopper.call(this);
244
- });
245
- });
246
-
247
- this[resizeObserverSymbol].observe(this.parentElement);
256
+ // against flickering
257
+ this[resizeObserverSymbol] = new ResizeObserver((entries) => {
258
+ if (this[timerCallbackSymbol] instanceof DeadMansSwitch) {
259
+ try {
260
+ this[timerCallbackSymbol].touch();
261
+ return;
262
+ } catch (e) {
263
+ delete this[timerCallbackSymbol];
264
+ }
265
+ }
266
+
267
+ this[timerCallbackSymbol] = new DeadMansSwitch(200, () => {
268
+ updatePopper.call(this);
269
+ });
270
+ });
271
+
272
+ this[resizeObserverSymbol].observe(this.parentElement);
248
273
  }
249
274
 
250
275
  /**
251
276
  * @private
252
277
  */
253
278
  function disconnectResizeObserver() {
254
- if (this[resizeObserverSymbol] instanceof ResizeObserver) {
255
- this[resizeObserverSymbol].disconnect();
256
- }
279
+ if (this[resizeObserverSymbol] instanceof ResizeObserver) {
280
+ this[resizeObserverSymbol].disconnect();
281
+ }
257
282
  }
258
283
 
259
284
  /**
260
285
  * @private
261
286
  */
262
287
  function hide() {
263
- const self = this;
288
+ const self = this;
264
289
 
265
- fireCustomEvent(self, "monster-popper-hide", {
266
- self,
267
- });
290
+ fireCustomEvent(self, "monster-popper-hide", {
291
+ self,
292
+ });
268
293
 
269
- self[popperElementSymbol].style.display = "none";
270
- removeAttributeToken(self[controlElementSymbol], "class", "open");
294
+ self[popperElementSymbol].style.display = "none";
295
+ removeAttributeToken(self[controlElementSymbol], "class", "open");
271
296
 
272
- setTimeout(() => {
273
- fireCustomEvent(self, "monster-popper-hidden", {
274
- self,
275
- });
276
- }, 0);
297
+ setTimeout(() => {
298
+ fireCustomEvent(self, "monster-popper-hidden", {
299
+ self,
300
+ });
301
+ }, 0);
277
302
  }
278
303
 
279
304
  /**
280
305
  * @private
281
306
  */
282
307
  function show() {
283
- const self = this;
308
+ const self = this;
284
309
 
285
- if (self.getOption("disabled", false) === true) {
286
- return;
287
- }
310
+ if (self.getOption("disabled", false) === true) {
311
+ return;
312
+ }
288
313
 
289
- if (self[popperElementSymbol].style.display === STYLE_DISPLAY_MODE_BLOCK) {
290
- return;
291
- }
314
+ if (self[popperElementSymbol].style.display === STYLE_DISPLAY_MODE_BLOCK) {
315
+ return;
316
+ }
292
317
 
293
- fireCustomEvent(self, "monster-popper-open", {
294
- self,
295
- });
318
+ fireCustomEvent(self, "monster-popper-open", {
319
+ self,
320
+ });
296
321
 
297
- self[popperElementSymbol].style.visibility = "hidden";
298
- self[popperElementSymbol].style.display = STYLE_DISPLAY_MODE_BLOCK;
322
+ self[popperElementSymbol].style.visibility = "hidden";
323
+ self[popperElementSymbol].style.display = STYLE_DISPLAY_MODE_BLOCK;
299
324
 
300
- addAttributeToken(self[controlElementSymbol], "class", "open");
301
- updatePopper.call(self);
325
+ addAttributeToken(self[controlElementSymbol], "class", "open");
326
+ updatePopper.call(self);
302
327
 
303
- setTimeout(() => {
304
- fireCustomEvent(self, "monster-popper-opened", {
305
- self,
306
- });
307
- }, 0);
328
+ setTimeout(() => {
329
+ fireCustomEvent(self, "monster-popper-opened", {
330
+ self,
331
+ });
332
+ }, 0);
308
333
  }
309
334
 
310
335
  /**
311
336
  * @private
312
337
  */
313
338
  function updatePopper() {
314
- if (this[popperElementSymbol].style.display !== STYLE_DISPLAY_MODE_BLOCK) {
315
- return;
316
- }
317
-
318
- if (this.getOption("disabled", false) === true) {
319
- return;
320
- }
321
-
322
- positionPopper.call(
323
- this,
324
- this[controlElementSymbol],
325
- this[popperElementSymbol],
326
- this.getOption("popper", {}),
327
- );
339
+ if (this[popperElementSymbol].style.display !== STYLE_DISPLAY_MODE_BLOCK) {
340
+ return;
341
+ }
342
+
343
+ if (this.getOption("disabled", false) === true) {
344
+ return;
345
+ }
346
+
347
+ positionPopper.call(
348
+ this,
349
+ this[controlElementSymbol],
350
+ this[popperElementSymbol],
351
+ this.getOption("popper", {}),
352
+ );
328
353
  }
329
354
 
330
355
  /**
@@ -332,92 +357,126 @@ function updatePopper() {
332
357
  * @return {initEventHandler}
333
358
  */
334
359
  function initEventHandler() {
335
- const self = this;
336
-
337
- this[closeEventHandler] = (event) => {
338
- const path = event.composedPath();
339
-
340
- for (const [, element] of Object.entries(path)) {
341
- if (element === this) {
342
- return;
343
- }
344
- }
345
- hide.call(this);
346
- };
347
-
348
- const type = "click";
349
-
350
- this[controlElementSymbol].addEventListener("mouseenter", (event) => {
351
- if (this.getOption("features.preventOpenEventSent") === true) {
352
- event.preventDefault();
353
- }
354
- this.showDialog();
355
- });
356
-
357
- this[controlElementSymbol].addEventListener("focus", (event) => {
358
- if (this.getOption("features.preventOpenEventSent") === true) {
359
- event.preventDefault();
360
- }
361
- this.showDialog();
362
- });
363
- this[controlElementSymbol].addEventListener("blur", (event) => {
364
- if (this.getOption("features.preventOpenEventSent") === true) {
365
- event.preventDefault();
366
- }
367
- this.hideDialog();
368
- });
369
-
370
- this[copyButtonElementSymbol].addEventListener(type, function (event) {
371
- fireCustomEvent(self, "monster-copy-clicked", {
372
- element: self,
373
- });
374
-
375
- const nodes = getSlottedElements.call(self, ":scope");
376
-
377
- let text = "";
378
- for (const node of nodes) {
379
- if (self.getOption("features.stripTags")) {
380
- text += node.textContent;
381
- } else {
382
- text += node.outerHTML;
383
- }
384
- }
385
-
386
- navigator.clipboard
387
- .writeText(text)
388
- .then(function () {
389
- self[copyButtonElementSymbol]
390
- .querySelector("use")
391
- .setAttribute("href", "#copy-success");
392
- setTimeout(() => {
393
- self[copyButtonElementSymbol]
394
- .querySelector("use")
395
- .setAttribute("href", "#copy");
396
- }, 2000);
397
-
398
- fireCustomEvent(self, "monster-copy-success", {
399
- element: self,
400
- });
401
- })
402
- .catch(function (e) {
403
- self[copyButtonElementSymbol]
404
- .querySelector("use")
405
- .setAttribute("href", "#copy-error");
406
- setTimeout(() => {
407
- self[copyButtonElementSymbol]
408
- .querySelector("use")
409
- .setAttribute("href", "#copy");
410
- }, 2000);
411
-
412
- fireCustomEvent(self, "monster-copy-error", {
413
- element: self,
414
- });
415
-
416
- addAttributeToken(self, ATTRIBUTE_ERRORMESSAGE, "" + e);
417
- });
418
- });
419
-
420
- return this;
360
+ const self = this;
361
+
362
+ this[closeEventHandler] = (event) => {
363
+ const path = event.composedPath();
364
+
365
+ for (const [, element] of Object.entries(path)) {
366
+ if (element === this) {
367
+ return;
368
+ }
369
+ }
370
+ hide.call(this);
371
+ };
372
+
373
+ const type = "click";
374
+
375
+ this[controlElementSymbol].addEventListener("mouseenter", (event) => {
376
+ if (this.getOption("features.preventOpenEventSent") === true) {
377
+ event.preventDefault();
378
+ }
379
+ this.showDialog();
380
+ });
381
+
382
+ this[controlElementSymbol].addEventListener("mouseleave", (event) => {
383
+ if (this.getOption("features.preventOpenEventSent") === true) {
384
+ event.preventDefault();
385
+ }
386
+ this.hideDialog();
387
+ });
388
+
389
+ this[controlElementSymbol].addEventListener("focus", (event) => {
390
+ if (this.getOption("features.preventOpenEventSent") === true) {
391
+ event.preventDefault();
392
+ }
393
+ this.showDialog();
394
+ });
395
+ this[controlElementSymbol].addEventListener("blur", (event) => {
396
+ if (this.getOption("features.preventOpenEventSent") === true) {
397
+ event.preventDefault();
398
+ }
399
+ this.hideDialog();
400
+ });
401
+
402
+ this[copyButtonElementSymbol].addEventListener(type, function (event) {
403
+ fireCustomEvent(self, "monster-copy-clicked", {
404
+ element: self,
405
+ });
406
+
407
+ const text = getSlottedCopyContent.call(self);
408
+
409
+ navigator.clipboard
410
+ .writeText(text)
411
+ .then(function () {
412
+ self[copyButtonElementSymbol]
413
+ .querySelector("use")
414
+ .setAttribute("href", "#copy-success");
415
+ setTimeout(() => {
416
+ self[copyButtonElementSymbol]
417
+ .querySelector("use")
418
+ .setAttribute("href", "#copy");
419
+ }, 2000);
420
+
421
+ fireCustomEvent(self, "monster-copy-success", {
422
+ element: self,
423
+ });
424
+ })
425
+ .catch(function (e) {
426
+ self[copyButtonElementSymbol]
427
+ .querySelector("use")
428
+ .setAttribute("href", "#copy-error");
429
+ setTimeout(() => {
430
+ self[copyButtonElementSymbol]
431
+ .querySelector("use")
432
+ .setAttribute("href", "#copy");
433
+ }, 2000);
434
+
435
+ fireCustomEvent(self, "monster-copy-error", {
436
+ element: self,
437
+ });
438
+
439
+ addAttributeToken(self, ATTRIBUTE_ERRORMESSAGE, "" + e);
440
+ });
441
+ });
442
+
443
+ return this;
444
+ }
445
+
446
+ /**
447
+ * @private
448
+ * @returns {Set<any>|string}
449
+ */
450
+ function getSlottedCopyContent() {
451
+ const self = this;
452
+ const result = new Set();
453
+
454
+ if (!(this.shadowRoot instanceof ShadowRoot)) {
455
+ return result;
456
+ }
457
+
458
+ const slots = this.shadowRoot.querySelectorAll("slot");
459
+
460
+ let text = "";
461
+ for (const [, slot] of Object.entries(slots)) {
462
+ slot.assignedNodes().forEach(function (node) {
463
+ if (
464
+ node instanceof HTMLElement ||
465
+ node instanceof SVGElement ||
466
+ node instanceof MathMLElement
467
+ ) {
468
+ if (self.getOption("features.stripTags")) {
469
+ text += node.textContent.trim();
470
+ } else {
471
+ text += node.outerHTML.trim();
472
+ }
473
+ } else {
474
+ text += node.textContent.trim();
475
+ }
476
+ });
477
+ }
478
+
479
+ return text;
421
480
  }
422
481
 
423
482
  /**
@@ -425,17 +484,17 @@ function initEventHandler() {
425
484
  * @return {void}
426
485
  */
427
486
  function initControlReferences() {
428
- this[controlElementSymbol] = this.shadowRoot.querySelector(
429
- `[${ATTRIBUTE_ROLE}="control"]`,
430
- );
487
+ this[controlElementSymbol] = this.shadowRoot.querySelector(
488
+ `[${ATTRIBUTE_ROLE}="control"]`,
489
+ );
431
490
 
432
- this[copyButtonElementSymbol] = this.shadowRoot.querySelector(
433
- `[${ATTRIBUTE_ROLE}="button"]`,
434
- );
491
+ this[copyButtonElementSymbol] = this.shadowRoot.querySelector(
492
+ `[${ATTRIBUTE_ROLE}="button"]`,
493
+ );
435
494
 
436
- this[popperElementSymbol] = this.shadowRoot.querySelector(
437
- `[${ATTRIBUTE_ROLE}="popper"]`,
438
- );
495
+ this[popperElementSymbol] = this.shadowRoot.querySelector(
496
+ `[${ATTRIBUTE_ROLE}="popper"]`,
497
+ );
439
498
  }
440
499
 
441
500
  /**
@@ -443,14 +502,15 @@ function initControlReferences() {
443
502
  * @return {string}
444
503
  */
445
504
  function getTemplate() {
446
- // language=HTML
447
- return `
505
+ // language=HTML
506
+ return `
448
507
  <div data-monster-role="control" part="control">
449
508
  <slot></slot>
450
509
  <div data-monster-role="popper" part="popper" tabindex="-1" class="monster-color-primary-1">
451
510
  <div data-monster-role="arrow"></div>
452
511
  <button data-monster-role="button" part="button">
453
- <svg data-monster-role="icon-map"><defs>
512
+ <svg data-monster-role="icon-map">
513
+ <defs>
454
514
  <g id="copy">
455
515
  <path d="M4 1.5H3a2 2 0 0 0-2 2V14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V3.5a2 2 0 0 0-2-2h-1v1h1a1 1 0 0 1 1 1V14a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V3.5a1 1 0 0 1 1-1h1z"/>
456
516
  <path d="M9.5 1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-3a.5.5 0 0 1-.5-.5v-1a.5.5 0 0 1 .5-.5zm-3-1A1.5 1.5 0 0 0 5 1.5v1A1.5 1.5 0 0 0 6.5 4h3A1.5 1.5 0 0 0 11 2.5v-1A1.5 1.5 0 0 0 9.5 0z"/>
@@ -471,7 +531,11 @@ function getTemplate() {
471
531
  </g>
472
532
 
473
533
  </defs>
474
- </svg><svg data-monster-role="icon" xmlns="http://www.w3.org/2000/svg" width="25" height="25" viewBox="0 0 16 16"><use href="#copy"></use></svg>
534
+ </svg>
535
+ <svg data-monster-role="icon" xmlns="http://www.w3.org/2000/svg" width="25" height="25"
536
+ viewBox="0 0 16 16">
537
+ <use href="#copy"></use>
538
+ </svg>
475
539
  </button>
476
540
  </div>
477
541
  </div>`;