@carbon/web-components 1.40.0 → 1.41.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/custom-elements.json +12 -0
- package/dist/accordion.min.js +1 -1
- package/dist/accordion.rtl.min.js +1 -1
- package/dist/breadcrumb.min.js +1 -1
- package/dist/breadcrumb.rtl.min.js +1 -1
- package/dist/{button-035465bb.js → button-0734f87a.js} +1 -1
- package/dist/{button-1a16f30e.js → button-5c6cbd4c.js} +1 -1
- package/dist/button.min.js +1 -1
- package/dist/button.rtl.min.js +1 -1
- package/dist/{checkbox-61c8aa71.js → checkbox-b2e39436.js} +1 -1
- package/dist/checkbox-d2398e7b.js +65 -0
- package/dist/checkbox.min.js +1 -1
- package/dist/checkbox.rtl.min.js +1 -1
- package/dist/code-snippet.min.js +2 -2
- package/dist/code-snippet.rtl.min.js +2 -2
- package/dist/combo-box.min.js +1 -1
- package/dist/combo-box.rtl.min.js +1 -1
- package/dist/{content-switcher-item-9c0951ff.js → content-switcher-item-71e83982.js} +1 -1
- package/dist/{content-switcher-item-97882c68.js → content-switcher-item-cd83a398.js} +1 -1
- package/dist/content-switcher.min.js +1 -1
- package/dist/content-switcher.rtl.min.js +1 -1
- package/dist/{copy-button-07fadd2e.js → copy-button-1ca43f15.js} +1 -1
- package/dist/{copy-button-d62f4b6e.js → copy-button-ca7272b2.js} +1 -1
- package/dist/copy-button.min.js +1 -1
- package/dist/copy-button.rtl.min.js +1 -1
- package/dist/data-table.min.js +1 -1
- package/dist/data-table.rtl.min.js +1 -1
- package/dist/date-picker.min.js +1 -1
- package/dist/date-picker.rtl.min.js +1 -1
- package/dist/{decorators-56213c84.js → decorators-0325a4b1.js} +1 -1
- package/dist/{dropdown-item-5f11f61b.js → dropdown-item-4b9fc7c5.js} +1 -1
- package/dist/{dropdown-item-988f7917.js → dropdown-item-ab2aac60.js} +1 -1
- package/dist/dropdown.min.js +1 -1
- package/dist/dropdown.rtl.min.js +1 -1
- package/dist/file-uploader.min.js +1 -1
- package/dist/file-uploader.rtl.min.js +1 -1
- package/dist/inline-loading.min.js +1 -1
- package/dist/inline-loading.rtl.min.js +2 -2
- package/dist/{input-e5ad8493.js → input-69ad5064.js} +1 -1
- package/dist/{input-13d32d6b.js → input-f63a1de6.js} +1 -1
- package/dist/input.min.js +1 -1
- package/dist/input.rtl.min.js +1 -1
- package/dist/{link-00bbdb76.js → link-4e6c1437.js} +1 -1
- package/dist/{link-1e3fcabc.js → link-a64a1312.js} +1 -1
- package/dist/link.min.js +1 -1
- package/dist/link.rtl.min.js +1 -1
- package/dist/list.min.js +1 -1
- package/dist/list.rtl.min.js +1 -1
- package/dist/{loading-2a5481c6.js → loading-d8d950dd.js} +1 -1
- package/dist/{loading-5f4a55c9.js → loading-e1a88439.js} +1 -1
- package/dist/loading.min.js +1 -1
- package/dist/loading.rtl.min.js +1 -1
- package/dist/modal.min.js +1 -1
- package/dist/modal.rtl.min.js +1 -1
- package/dist/multi-select.min.js +1 -1
- package/dist/multi-select.rtl.min.js +1 -1
- package/dist/notification.min.js +1 -1
- package/dist/notification.rtl.min.js +1 -1
- package/dist/number-input.min.js +1 -1
- package/dist/number-input.rtl.min.js +1 -1
- package/dist/{overflow-menu-92d0e3a4.js → overflow-menu-9dd5a7e8.js} +1 -1
- package/dist/{overflow-menu-fefec311.js → overflow-menu-e68fb3a3.js} +1 -1
- package/dist/overflow-menu.min.js +1 -1
- package/dist/overflow-menu.rtl.min.js +1 -1
- package/dist/pagination-nav.min.js +1 -1
- package/dist/pagination-nav.rtl.min.js +1 -1
- package/dist/pagination.min.js +1 -1
- package/dist/pagination.rtl.min.js +1 -1
- package/dist/progress-indicator.min.js +1 -1
- package/dist/progress-indicator.rtl.min.js +1 -1
- package/dist/radio-button.min.js +1 -1
- package/dist/radio-button.rtl.min.js +1 -1
- package/dist/{search-dc317efe.js → search-ba0b25b6.js} +1 -1
- package/dist/{search-7746f7ab.js → search-bb97ebb6.js} +1 -1
- package/dist/search.min.js +1 -1
- package/dist/search.rtl.min.js +1 -1
- package/dist/select.min.js +1 -1
- package/dist/select.rtl.min.js +1 -1
- package/dist/skeleton-text.min.js +1 -1
- package/dist/skeleton-text.rtl.min.js +1 -1
- package/dist/skip-to-content.min.js +1 -1
- package/dist/skip-to-content.rtl.min.js +1 -1
- package/dist/slider.min.js +1 -1
- package/dist/slider.rtl.min.js +1 -1
- package/dist/structured-list.min.js +1 -1
- package/dist/structured-list.rtl.min.js +1 -1
- package/dist/tabs.min.js +1 -1
- package/dist/tabs.rtl.min.js +1 -1
- package/dist/tag.min.js +1 -1
- package/dist/tag.rtl.min.js +1 -1
- package/dist/textarea.min.js +1 -1
- package/dist/textarea.rtl.min.js +1 -1
- package/dist/tile.min.js +1 -1
- package/dist/tile.rtl.min.js +1 -1
- package/dist/toggle.min.js +1 -1
- package/dist/toggle.rtl.min.js +1 -1
- package/dist/tooltip.min.js +1 -1
- package/dist/tooltip.rtl.min.js +1 -1
- package/dist/ui-shell.min.js +1 -1
- package/dist/ui-shell.rtl.min.js +1 -1
- package/es/components/code-snippet/code-snippet.css.js +1 -1
- package/es/components/code-snippet/code-snippet.d.ts +25 -2
- package/es/components/code-snippet/code-snippet.js +132 -74
- package/es/components/code-snippet/code-snippet.js.map +1 -1
- package/es/components/code-snippet/code-snippet.rtl.css.js +1 -1
- package/package.json +2 -2
- package/scss/components/code-snippet/code-snippet.scss +14 -1
- package/dist/checkbox-93412a35.js +0 -65
|
@@ -20,7 +20,7 @@ let _ = t => t,
|
|
|
20
20
|
*/
|
|
21
21
|
|
|
22
22
|
import { classMap } from 'lit-html/directives/class-map';
|
|
23
|
-
import { html, property, query, LitElement } from 'lit-element';
|
|
23
|
+
import { html, property, query, LitElement, state } from 'lit-element';
|
|
24
24
|
import ChevronDown16 from "../../icons/chevron--down/16";
|
|
25
25
|
import settings from 'carbon-components/es/globals/js/settings';
|
|
26
26
|
import FocusMixin from '../../globals/mixins/focus';
|
|
@@ -33,54 +33,6 @@ const {
|
|
|
33
33
|
prefix
|
|
34
34
|
} = settings;
|
|
35
35
|
|
|
36
|
-
/**
|
|
37
|
-
* @param values The values to render.
|
|
38
|
-
* @param values.children The child nodes.
|
|
39
|
-
* @param values.handleClick The handler for the `click` event on the button.
|
|
40
|
-
* @returns The template result for the expando.
|
|
41
|
-
*/
|
|
42
|
-
const renderExpando = ({
|
|
43
|
-
children,
|
|
44
|
-
handleClick
|
|
45
|
-
}) => html(_t || (_t = _`
|
|
46
|
-
<button
|
|
47
|
-
type="button"
|
|
48
|
-
class="${0}--snippet-btn--expand"
|
|
49
|
-
@click="${0}">
|
|
50
|
-
<span id="button-text" class="${0}--snippet-btn--text">
|
|
51
|
-
${0}
|
|
52
|
-
</span>
|
|
53
|
-
${0}
|
|
54
|
-
</button>
|
|
55
|
-
`), prefix, handleClick, prefix, children, ChevronDown16({
|
|
56
|
-
'aria-labeledby': 'button-text',
|
|
57
|
-
class: `${prefix}--icon-chevron--down ${prefix}--snippet__icon`,
|
|
58
|
-
role: 'img'
|
|
59
|
-
}));
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* @param values The values to render.
|
|
63
|
-
* @param values.assistiveText The assistive text to announce that the node is for code snippet.
|
|
64
|
-
* @param [values.expanded] `true` to show the expanded state (for multi-line variant).
|
|
65
|
-
* @param values.children The child nodes.
|
|
66
|
-
* @returns The template result for the code snippet.
|
|
67
|
-
*/
|
|
68
|
-
const renderCode = ({
|
|
69
|
-
assistiveText,
|
|
70
|
-
expanded,
|
|
71
|
-
children
|
|
72
|
-
}) => {
|
|
73
|
-
const classes = classMap({
|
|
74
|
-
[`${prefix}--snippet-container`]: true,
|
|
75
|
-
[`${prefix}-ce--snippet-container--expanded`]: Boolean(expanded)
|
|
76
|
-
});
|
|
77
|
-
// Ensures no extra whitespace text node
|
|
78
|
-
// prettier-ignore
|
|
79
|
-
return html(_t2 || (_t2 = _`
|
|
80
|
-
<div role="textbox" tabindex="0" class="${0}" aria-label="${0}"><code><pre>${0}</pre></code></div>
|
|
81
|
-
`), classes, assistiveText, children);
|
|
82
|
-
};
|
|
83
|
-
|
|
84
36
|
/**
|
|
85
37
|
* Basic code snippet.
|
|
86
38
|
*
|
|
@@ -97,6 +49,7 @@ let BXCodeSnippet = _decorate([customElement(`${prefix}-code-snippet`)], functio
|
|
|
97
49
|
F: BXCodeSnippet,
|
|
98
50
|
d: [{
|
|
99
51
|
kind: "field",
|
|
52
|
+
decorators: [state()],
|
|
100
53
|
key: "_expanded",
|
|
101
54
|
value() {
|
|
102
55
|
return false;
|
|
@@ -115,7 +68,7 @@ let BXCodeSnippet = _decorate([customElement(`${prefix}-code-snippet`)], functio
|
|
|
115
68
|
}
|
|
116
69
|
}, {
|
|
117
70
|
kind: "method",
|
|
118
|
-
key: "
|
|
71
|
+
key: "_calculateOverflows",
|
|
119
72
|
value:
|
|
120
73
|
/**
|
|
121
74
|
* `true` to expand multi-line variant of code snippet.
|
|
@@ -129,10 +82,36 @@ let BXCodeSnippet = _decorate([customElement(`${prefix}-code-snippet`)], functio
|
|
|
129
82
|
* `true` to show the expando.
|
|
130
83
|
*/
|
|
131
84
|
|
|
85
|
+
/**
|
|
86
|
+
* Determine whether the code text overflows the container.
|
|
87
|
+
*/
|
|
88
|
+
function _calculateOverflows() {
|
|
89
|
+
const {
|
|
90
|
+
_codeContainerNode: container,
|
|
91
|
+
_preNode: preNode
|
|
92
|
+
} = this;
|
|
93
|
+
if (container && preNode) {
|
|
94
|
+
const {
|
|
95
|
+
clientWidth: containerWidth,
|
|
96
|
+
scrollLeft
|
|
97
|
+
} = container;
|
|
98
|
+
const containerPadding = parseInt(getComputedStyle(container).getPropertyValue('padding-inline-start'));
|
|
99
|
+
const {
|
|
100
|
+
clientWidth: codeWidth
|
|
101
|
+
} = preNode;
|
|
102
|
+
const hasOverflow = codeWidth > containerWidth;
|
|
103
|
+
this.hasOverflowLeft = hasOverflow && Boolean(scrollLeft);
|
|
104
|
+
this.hasOverflowRight = hasOverflow && codeWidth - scrollLeft > containerWidth - containerPadding;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
132
108
|
/**
|
|
133
109
|
* Handles `click` event on the copy button.
|
|
134
110
|
*/
|
|
135
|
-
|
|
111
|
+
}, {
|
|
112
|
+
kind: "method",
|
|
113
|
+
key: "_handleClickCopyButton",
|
|
114
|
+
value: function _handleClickCopyButton() {
|
|
136
115
|
const {
|
|
137
116
|
ownerDocument: doc
|
|
138
117
|
} = this;
|
|
@@ -177,7 +156,6 @@ let BXCodeSnippet = _decorate([customElement(`${prefix}-code-snippet`)], functio
|
|
|
177
156
|
*/
|
|
178
157
|
function _handleClickExpando() {
|
|
179
158
|
this._expanded = !this._expanded;
|
|
180
|
-
this.requestUpdate();
|
|
181
159
|
}
|
|
182
160
|
|
|
183
161
|
/**
|
|
@@ -197,11 +175,17 @@ let BXCodeSnippet = _decorate([customElement(`${prefix}-code-snippet`)], functio
|
|
|
197
175
|
this.requestUpdate();
|
|
198
176
|
}
|
|
199
177
|
}
|
|
178
|
+
this._calculateOverflows();
|
|
200
179
|
}
|
|
201
180
|
|
|
202
181
|
/**
|
|
203
|
-
* The `<pre>` element in the shadow DOM.
|
|
182
|
+
* The `<pre>` element's container in the shadow DOM.
|
|
204
183
|
*/
|
|
184
|
+
}, {
|
|
185
|
+
kind: "field",
|
|
186
|
+
decorators: [query(`.${prefix}--snippet-container`)],
|
|
187
|
+
key: "_codeContainerNode",
|
|
188
|
+
value: void 0
|
|
205
189
|
}, {
|
|
206
190
|
kind: "field",
|
|
207
191
|
decorators: [query('pre')],
|
|
@@ -272,6 +256,20 @@ let BXCodeSnippet = _decorate([customElement(`${prefix}-code-snippet`)], functio
|
|
|
272
256
|
value() {
|
|
273
257
|
return 'Show more';
|
|
274
258
|
}
|
|
259
|
+
}, {
|
|
260
|
+
kind: "field",
|
|
261
|
+
decorators: [state()],
|
|
262
|
+
key: "hasOverflowLeft",
|
|
263
|
+
value() {
|
|
264
|
+
return false;
|
|
265
|
+
}
|
|
266
|
+
}, {
|
|
267
|
+
kind: "field",
|
|
268
|
+
decorators: [state()],
|
|
269
|
+
key: "hasOverflowRight",
|
|
270
|
+
value() {
|
|
271
|
+
return false;
|
|
272
|
+
}
|
|
275
273
|
}, {
|
|
276
274
|
kind: "field",
|
|
277
275
|
decorators: [property({
|
|
@@ -285,6 +283,9 @@ let BXCodeSnippet = _decorate([customElement(`${prefix}-code-snippet`)], functio
|
|
|
285
283
|
kind: "method",
|
|
286
284
|
key: "createRenderRoot",
|
|
287
285
|
value:
|
|
286
|
+
/**
|
|
287
|
+
* The `<pre>` element in the shadow DOM.
|
|
288
|
+
*/
|
|
288
289
|
/**
|
|
289
290
|
* An assistive text for screen reader to advice a DOM node is for code snippet.
|
|
290
291
|
*/
|
|
@@ -306,6 +307,12 @@ let BXCodeSnippet = _decorate([customElement(`${prefix}-code-snippet`)], functio
|
|
|
306
307
|
/**
|
|
307
308
|
* The context content for the expand button.
|
|
308
309
|
*/
|
|
310
|
+
/**
|
|
311
|
+
* Whether or not the content is scrollable left.
|
|
312
|
+
*/
|
|
313
|
+
/**
|
|
314
|
+
* Whether or not the content is scrollable right.
|
|
315
|
+
*/
|
|
309
316
|
/**
|
|
310
317
|
* The type of code snippet.
|
|
311
318
|
*/
|
|
@@ -316,35 +323,93 @@ let BXCodeSnippet = _decorate([customElement(`${prefix}-code-snippet`)], functio
|
|
|
316
323
|
delegatesFocus: Number(((_exec = /Safari\/(\d+)/.exec(navigator.userAgent)) !== null && _exec !== void 0 ? _exec : ['', 0])[1]) <= 537
|
|
317
324
|
});
|
|
318
325
|
}
|
|
326
|
+
|
|
327
|
+
/**
|
|
328
|
+
* Renders the code snippet.
|
|
329
|
+
*/
|
|
330
|
+
}, {
|
|
331
|
+
kind: "method",
|
|
332
|
+
key: "_renderCode",
|
|
333
|
+
value: function _renderCode() {
|
|
334
|
+
const {
|
|
335
|
+
codeAssistiveText,
|
|
336
|
+
_expanded: expanded,
|
|
337
|
+
_handleSlotChange: handleSlotChange,
|
|
338
|
+
hasOverflowLeft,
|
|
339
|
+
hasOverflowRight
|
|
340
|
+
} = this;
|
|
341
|
+
const classes = classMap({
|
|
342
|
+
[`${prefix}--snippet-container`]: true,
|
|
343
|
+
[`${prefix}-ce--snippet-container--expanded`]: Boolean(expanded)
|
|
344
|
+
});
|
|
345
|
+
// Ensures no extra whitespace text node
|
|
346
|
+
// prettier-ignore
|
|
347
|
+
return html(_t || (_t = _`
|
|
348
|
+
${0}
|
|
349
|
+
<div
|
|
350
|
+
role="textbox"
|
|
351
|
+
tabindex="0"
|
|
352
|
+
class="${0}"
|
|
353
|
+
aria-label="${0}"
|
|
354
|
+
@scroll="${0}"
|
|
355
|
+
>
|
|
356
|
+
<code><pre><slot @slotchange="${0}"></slot></pre></code>
|
|
357
|
+
</div>
|
|
358
|
+
${0}
|
|
359
|
+
`), hasOverflowLeft ? html(_t2 || (_t2 = _`<span class="${0}--snippet__overflow-indicator--left"></span>`), prefix) : '', classes, codeAssistiveText, this._calculateOverflows, handleSlotChange, hasOverflowRight ? html(_t3 || (_t3 = _`<span class="${0}--snippet__overflow-indicator--right"></span>`), prefix) : '');
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
/**
|
|
363
|
+
* Renders the expando.
|
|
364
|
+
*/
|
|
365
|
+
}, {
|
|
366
|
+
kind: "method",
|
|
367
|
+
key: "_renderExpando",
|
|
368
|
+
value: function _renderExpando() {
|
|
369
|
+
const {
|
|
370
|
+
collapseButtonText,
|
|
371
|
+
_expanded: expanded,
|
|
372
|
+
expandButtonText
|
|
373
|
+
} = this;
|
|
374
|
+
return html(_t4 || (_t4 = _`
|
|
375
|
+
<button
|
|
376
|
+
type="button"
|
|
377
|
+
class="${0}--snippet-btn--expand"
|
|
378
|
+
@click="${0}">
|
|
379
|
+
<span id="button-text" class="${0}--snippet-btn--text">
|
|
380
|
+
${0}
|
|
381
|
+
</span>
|
|
382
|
+
${0}
|
|
383
|
+
</button>
|
|
384
|
+
`), prefix, this._handleClickExpando, prefix, expanded ? html(_t5 || (_t5 = _`<slot name="collapse-button-text"
|
|
385
|
+
>${0}</slot
|
|
386
|
+
>`), collapseButtonText) : html(_t6 || (_t6 = _`<slot name="expand-button-text">${0}</slot>`), expandButtonText), ChevronDown16({
|
|
387
|
+
'aria-labeledby': 'button-text',
|
|
388
|
+
class: `${prefix}--icon-chevron--down ${prefix}--snippet__icon`,
|
|
389
|
+
role: 'img'
|
|
390
|
+
}));
|
|
391
|
+
}
|
|
319
392
|
}, {
|
|
320
393
|
kind: "method",
|
|
321
394
|
key: "render",
|
|
322
395
|
value: function render() {
|
|
323
396
|
const {
|
|
324
397
|
codeAssistiveText,
|
|
325
|
-
collapseButtonText,
|
|
326
398
|
copyButtonAssistiveText,
|
|
327
399
|
copyButtonFeedbackText,
|
|
328
|
-
expandButtonText,
|
|
329
400
|
type,
|
|
330
|
-
_expanded: expanded,
|
|
331
401
|
_showCopyButtonFeedback: showCopyButtonFeedback,
|
|
332
402
|
_showExpando: showExpando,
|
|
333
403
|
_handleClickCopyButton: handleClickCopyButton,
|
|
334
|
-
_handleClickExpando: handleClickExpando,
|
|
335
404
|
_handleSlotChange: handleSlotChange
|
|
336
405
|
} = this;
|
|
337
406
|
if (type === CODE_SNIPPET_TYPE.SINGLE) {
|
|
338
407
|
// Ensures no extra whitespace text node
|
|
339
408
|
// prettier-ignore
|
|
340
|
-
return html(
|
|
409
|
+
return html(_t7 || (_t7 = _`
|
|
341
410
|
${0}
|
|
342
411
|
${0}
|
|
343
|
-
`),
|
|
344
|
-
assistiveText: codeAssistiveText,
|
|
345
|
-
expanded,
|
|
346
|
-
children: html(_t4 || (_t4 = _`<slot @slotchange="${0}"></slot>`), handleSlotChange)
|
|
347
|
-
}), renderCopyButton({
|
|
412
|
+
`), this._renderCode(), renderCopyButton({
|
|
348
413
|
assistiveText: copyButtonAssistiveText,
|
|
349
414
|
feedbackText: copyButtonFeedbackText,
|
|
350
415
|
showFeedback: showCopyButtonFeedback,
|
|
@@ -355,24 +420,17 @@ let BXCodeSnippet = _decorate([customElement(`${prefix}-code-snippet`)], functio
|
|
|
355
420
|
if (type === CODE_SNIPPET_TYPE.MULTI) {
|
|
356
421
|
// Ensures no extra whitespace text node
|
|
357
422
|
// prettier-ignore
|
|
358
|
-
return html(
|
|
423
|
+
return html(_t8 || (_t8 = _`
|
|
359
424
|
${0}
|
|
360
425
|
${0}
|
|
361
426
|
${0}
|
|
362
|
-
`),
|
|
363
|
-
assistiveText: codeAssistiveText,
|
|
364
|
-
expanded,
|
|
365
|
-
children: html(_t6 || (_t6 = _`<slot @slotchange="${0}"></slot>`), handleSlotChange)
|
|
366
|
-
}), renderCopyButton({
|
|
427
|
+
`), this._renderCode(), renderCopyButton({
|
|
367
428
|
assistiveText: copyButtonAssistiveText,
|
|
368
429
|
feedbackText: copyButtonFeedbackText,
|
|
369
430
|
showFeedback: showCopyButtonFeedback,
|
|
370
431
|
handleClickButton: handleClickCopyButton,
|
|
371
432
|
className: `${prefix}--snippet-button`
|
|
372
|
-
}), !showExpando ? undefined :
|
|
373
|
-
children: expanded ? html(_t7 || (_t7 = _`<slot name="collapse-button-text">${0}</slot>`), collapseButtonText) : html(_t8 || (_t8 = _`<slot name="expand-button-text">${0}</slot>`), expandButtonText),
|
|
374
|
-
handleClick: handleClickExpando
|
|
375
|
-
}));
|
|
433
|
+
}), !showExpando ? undefined : this._renderExpando());
|
|
376
434
|
}
|
|
377
435
|
|
|
378
436
|
// Ensures no extra whitespace text node
|
|
@@ -385,7 +443,7 @@ let BXCodeSnippet = _decorate([customElement(`${prefix}-code-snippet`)], functio
|
|
|
385
443
|
showFeedback: showCopyButtonFeedback,
|
|
386
444
|
handleClickButton: handleClickCopyButton,
|
|
387
445
|
className: `${prefix}--snippet ${prefix}--snippet--inline`,
|
|
388
|
-
children: html(_t10 || (_t10 = _`<code aria-label="${0}"><slot></slot></code>`), codeAssistiveText)
|
|
446
|
+
children: html(_t10 || (_t10 = _`<code aria-label="${0}"><slot @slotchange="${0}"></slot></code>`), codeAssistiveText, handleSlotChange)
|
|
389
447
|
}));
|
|
390
448
|
}
|
|
391
449
|
}, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"code-snippet.js","names":["classMap","html","property","query","LitElement","ChevronDown16","settings","FocusMixin","_createHandleFeedbackTooltip","createHandleCopyButtonFeedbackTooltip","_renderButton","renderCopyButton","CODE_SNIPPET_COLOR_SCHEME","CODE_SNIPPET_TYPE","styles","carbonElement","customElement","prefix","renderExpando","children","handleClick","_t","_","class","role","renderCode","assistiveText","expanded","classes","Boolean","_t2","BXCodeSnippet","_decorate","_initialize","_FocusMixin","constructor","args","F","d","kind","key","value","_handleClickCopyButton","ownerDocument","doc","selection","defaultView","getSelection","removeAllRanges","code","createElement","className","pre","textContent","appendChild","body","range","createRange","selectNodeContents","addRange","execCommand","_handleCopyButtonFeedbackTooltip","copyButtonFeedbackTimeout","removeChild","showFeedback","_showCopyButtonFeedback","requestUpdate","_handleClickExpando","_expanded","_handleSlotChange","type","_preNode","preNode","MULTI","getBoundingClientRect","height","_showExpando","decorators","attribute","reflect","REGULAR","Number","SINGLE","createRenderRoot","_exec","attachShadow","mode","delegatesFocus","exec","navigator","userAgent","render","codeAssistiveText","collapseButtonText","copyButtonAssistiveText","copyButtonFeedbackText","expandButtonText","showCopyButtonFeedback","showExpando","handleClickCopyButton","handleClickExpando","handleSlotChange","_t3","_t4","feedbackText","handleClickButton","_t5","_t6","undefined","_t7","_t8","_t9","_t10","static"],"sources":["components/code-snippet/code-snippet.ts"],"sourcesContent":["/**\n * @license\n *\n * Copyright IBM Corp. 2019, 2023\n *\n * This source code is licensed under the Apache-2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { classMap } from 'lit-html/directives/class-map';\nimport { TemplateResult } from 'lit-html';\nimport { html, property, query, LitElement } from 'lit-element';\nimport ChevronDown16 from '@carbon/icons/lib/chevron--down/16';\nimport settings from 'carbon-components/es/globals/js/settings';\nimport FocusMixin from '../../globals/mixins/focus';\nimport {\n _createHandleFeedbackTooltip as createHandleCopyButtonFeedbackTooltip,\n _renderButton as renderCopyButton,\n} from '../copy-button/copy-button';\nimport { CODE_SNIPPET_COLOR_SCHEME, CODE_SNIPPET_TYPE } from './defs';\nimport styles from './code-snippet.scss';\nimport { carbonElement as customElement } from '../../globals/decorators/carbon-element';\n\nexport { CODE_SNIPPET_COLOR_SCHEME, CODE_SNIPPET_TYPE };\n\nconst { prefix } = settings;\n\n/**\n * @param values The values to render.\n * @param values.children The child nodes.\n * @param values.handleClick The handler for the `click` event on the button.\n * @returns The template result for the expando.\n */\nconst renderExpando = ({\n children,\n handleClick,\n}: {\n children: string | TemplateResult;\n handleClick: EventListener;\n}) => html`\n <button\n type=\"button\"\n class=\"${prefix}--snippet-btn--expand\"\n @click=\"${handleClick}\">\n <span id=\"button-text\" class=\"${prefix}--snippet-btn--text\">\n ${children}\n </span>\n ${ChevronDown16({\n 'aria-labeledby': 'button-text',\n class: `${prefix}--icon-chevron--down ${prefix}--snippet__icon`,\n role: 'img',\n })}\n </button>\n`;\n\n/**\n * @param values The values to render.\n * @param values.assistiveText The assistive text to announce that the node is for code snippet.\n * @param [values.expanded] `true` to show the expanded state (for multi-line variant).\n * @param values.children The child nodes.\n * @returns The template result for the code snippet.\n */\nconst renderCode = ({\n assistiveText,\n expanded,\n children,\n}: {\n assistiveText: string;\n expanded?: boolean;\n children: string | TemplateResult;\n}) => {\n const classes = classMap({\n [`${prefix}--snippet-container`]: true,\n [`${prefix}-ce--snippet-container--expanded`]: Boolean(expanded),\n });\n // Ensures no extra whitespace text node\n // prettier-ignore\n return html`\n <div role=\"textbox\" tabindex=\"0\" class=\"${classes}\" aria-label=\"${assistiveText}\"><code><pre>${children}</pre></code></div>\n `;\n};\n\n/**\n * Basic code snippet.\n *\n * @element bx-code-snippet\n */\n@customElement(`${prefix}-code-snippet`)\nclass BXCodeSnippet extends FocusMixin(LitElement) {\n /**\n * `true` to expand multi-line variant of code snippet.\n */\n private _expanded = false;\n\n /**\n * `true` to show the feedback tooltip.\n */\n private _showCopyButtonFeedback = false;\n\n /**\n * `true` to show the expando.\n */\n private _showExpando = false;\n\n /**\n * Handles `click` event on the copy button.\n */\n private _handleClickCopyButton() {\n const { ownerDocument: doc } = this;\n const selection = doc!.defaultView!.getSelection();\n selection!.removeAllRanges();\n const code = doc!.createElement('code');\n code.className = `${prefix}--visually-hidden`;\n const pre = doc!.createElement('pre');\n pre.textContent = this.textContent;\n code.appendChild(pre);\n // Using `<code>` in shadow DOM seems to lose the LFs in some browsers\n doc!.body.appendChild(code);\n const range = doc!.createRange();\n range.selectNodeContents(code);\n selection!.addRange(range);\n doc!.execCommand('copy');\n this._handleCopyButtonFeedbackTooltip(this.copyButtonFeedbackTimeout);\n doc!.body.removeChild(code);\n selection!.removeAllRanges();\n }\n\n /**\n * Handles showing/hiding the feedback tooltip.\n */\n private _handleCopyButtonFeedbackTooltip =\n createHandleCopyButtonFeedbackTooltip(\n ({ showFeedback = false }: { showFeedback?: boolean }) => {\n this._showCopyButtonFeedback = showFeedback;\n this.requestUpdate();\n }\n );\n\n /**\n * Handles `click` event on the expando.\n */\n private _handleClickExpando() {\n this._expanded = !this._expanded;\n this.requestUpdate();\n }\n\n /**\n * Handles change in slot content to determine if the content\n */\n private _handleSlotChange() {\n const { type, _preNode: preNode } = this;\n if (type === CODE_SNIPPET_TYPE.MULTI) {\n if (preNode.getBoundingClientRect().height > 255) {\n this._showExpando = true;\n this.requestUpdate();\n }\n }\n }\n\n /**\n * The `<pre>` element in the shadow DOM.\n */\n @query('pre')\n private _preNode!: HTMLPreElement;\n\n /**\n * An assistive text for screen reader to advice a DOM node is for code snippet.\n */\n @property({ attribute: 'code-assistive-text' })\n codeAssistiveText = 'code-snippet';\n\n /**\n * The context content for the collapse button.\n */\n @property({ attribute: 'collapse-button-text' })\n collapseButtonText = 'Show less';\n\n /**\n * The color scheme.\n */\n @property({ attribute: 'color-scheme', reflect: true })\n colorScheme = CODE_SNIPPET_COLOR_SCHEME.REGULAR;\n\n /**\n * An assistive text for screen reader to announce, telling that the button copies the content to the clipboard.\n */\n @property({ attribute: 'copy-button-assistive-text' })\n copyButtonAssistiveText = 'Copy to clipboard';\n\n /**\n * The feedback text for the copy button.\n */\n @property({ attribute: 'copy-button-feedback-text' })\n copyButtonFeedbackText = 'Copied!';\n\n /**\n * The number in milliseconds to determine how long the tooltip for the copy button should remain.\n */\n @property({ type: Number, attribute: 'copy-button-feedback-timeout' })\n copyButtonFeedbackTimeout = 2000;\n\n /**\n * The context content for the expand button.\n */\n @property({ attribute: 'expand-button-text' })\n expandButtonText = 'Show more';\n\n /**\n * The type of code snippet.\n */\n @property({ reflect: true })\n type = CODE_SNIPPET_TYPE.SINGLE;\n\n createRenderRoot() {\n return this.attachShadow({\n mode: 'open',\n delegatesFocus:\n Number((/Safari\\/(\\d+)/.exec(navigator.userAgent) ?? ['', 0])[1]) <=\n 537,\n });\n }\n\n render() {\n const {\n codeAssistiveText,\n collapseButtonText,\n copyButtonAssistiveText,\n copyButtonFeedbackText,\n expandButtonText,\n type,\n _expanded: expanded,\n _showCopyButtonFeedback: showCopyButtonFeedback,\n _showExpando: showExpando,\n _handleClickCopyButton: handleClickCopyButton,\n _handleClickExpando: handleClickExpando,\n _handleSlotChange: handleSlotChange,\n } = this;\n\n if (type === CODE_SNIPPET_TYPE.SINGLE) {\n // Ensures no extra whitespace text node\n // prettier-ignore\n return html`\n ${renderCode({\n assistiveText: codeAssistiveText,\n expanded,\n children: html`<slot @slotchange=\"${handleSlotChange}\"></slot>`,\n })}\n ${renderCopyButton({\n assistiveText: copyButtonAssistiveText,\n feedbackText: copyButtonFeedbackText,\n showFeedback: showCopyButtonFeedback,\n handleClickButton: handleClickCopyButton,\n className: `${prefix}--snippet-button`,\n })}\n `;\n }\n\n if (type === CODE_SNIPPET_TYPE.MULTI) {\n // Ensures no extra whitespace text node\n // prettier-ignore\n return html`\n ${renderCode({\n assistiveText: codeAssistiveText,\n expanded,\n children: html`<slot @slotchange=\"${handleSlotChange}\"></slot>`,\n })}\n ${renderCopyButton({\n assistiveText: copyButtonAssistiveText,\n feedbackText: copyButtonFeedbackText,\n showFeedback: showCopyButtonFeedback,\n handleClickButton: handleClickCopyButton,\n className: `${prefix}--snippet-button`,\n })}\n ${!showExpando\n ? undefined\n : renderExpando({\n children: expanded\n ? html`<slot name=\"collapse-button-text\">${collapseButtonText}</slot>`\n : html`<slot name=\"expand-button-text\">${expandButtonText}</slot>`,\n handleClick: handleClickExpando,\n })}\n `;\n }\n\n // Ensures no extra whitespace text node\n // prettier-ignore\n return html`\n ${renderCopyButton({\n assistiveText: copyButtonAssistiveText,\n feedbackText: copyButtonFeedbackText,\n showFeedback: showCopyButtonFeedback,\n handleClickButton: handleClickCopyButton,\n className: `${prefix}--snippet ${prefix}--snippet--inline`,\n children: html`<code aria-label=\"${codeAssistiveText}\"><slot></slot></code>`,\n })}\n `;\n }\n\n static styles = styles;\n}\n\nexport default BXCodeSnippet;\n"],"mappings":";;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,QAAQ,QAAQ,+BAA+B;AAExD,SAASC,IAAI,EAAEC,QAAQ,EAAEC,KAAK,EAAEC,UAAU,QAAQ,aAAa;AAC/D,OAAOC,aAAa,MAAM,8BAAoC;AAC9D,OAAOC,QAAQ,MAAM,0CAA0C;AAC/D,OAAOC,UAAU,MAAM,4BAA4B;AACnD,SACEC,4BAA4B,IAAIC,qCAAqC,EACrEC,aAAa,IAAIC,gBAAgB,QAC5B,4BAA4B;AACnC,SAASC,yBAAyB,EAAEC,iBAAiB,QAAQ,QAAQ;AACrE,OAAOC,MAAM,MAAM,yBAAqB;AACxC,SAASC,aAAa,IAAIC,aAAa,QAAQ,yCAAyC;AAExF,SAASJ,yBAAyB,EAAEC,iBAAiB;AAErD,MAAM;EAAEI;AAAO,CAAC,GAAGX,QAAQ;;AAE3B;AACA;AACA;AACA;AACA;AACA;AACA,MAAMY,aA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MAEN;IAAC;MAAArD,IAAA;MAAA0E,MAAA;MAAAzE,GAAA;MAAAC,MAAA;QAAA,OAEe3B,MAAM;MAAA;IAAA;EAAA;AAAA,GAlNIP,UAAU,CAACH,UAAU,CAAC;AAqNlD,eAAe2B,aAAa"}
|
|
1
|
+
{"version":3,"file":"code-snippet.js","names":["classMap","html","property","query","LitElement","state","ChevronDown16","settings","FocusMixin","_createHandleFeedbackTooltip","createHandleCopyButtonFeedbackTooltip","_renderButton","renderCopyButton","CODE_SNIPPET_COLOR_SCHEME","CODE_SNIPPET_TYPE","styles","carbonElement","customElement","prefix","BXCodeSnippet","_decorate","_initialize","_FocusMixin","constructor","args","F","d","kind","decorators","key","value","_calculateOverflows","_codeContainerNode","container","_preNode","preNode","clientWidth","containerWidth","scrollLeft","containerPadding","parseInt","getComputedStyle","getPropertyValue","codeWidth","hasOverflow","hasOverflowLeft","Boolean","hasOverflowRight","_handleClickCopyButton","ownerDocument","doc","selection","defaultView","getSelection","removeAllRanges","code","createElement","className","pre","textContent","appendChild","body","range","createRange","selectNodeContents","addRange","execCommand","_handleCopyButtonFeedbackTooltip","copyButtonFeedbackTimeout","removeChild","showFeedback","_showCopyButtonFeedback","requestUpdate","_handleClickExpando","_expanded","_handleSlotChange","type","MULTI","getBoundingClientRect","height","_showExpando","attribute","reflect","REGULAR","Number","SINGLE","createRenderRoot","_exec","attachShadow","mode","delegatesFocus","exec","navigator","userAgent","_renderCode","codeAssistiveText","expanded","handleSlotChange","classes","_t","_","_t2","_t3","_renderExpando","collapseButtonText","expandButtonText","_t4","_t5","_t6","class","role","render","copyButtonAssistiveText","copyButtonFeedbackText","showCopyButtonFeedback","showExpando","handleClickCopyButton","_t7","assistiveText","feedbackText","handleClickButton","_t8","undefined","_t9","children","_t10","static"],"sources":["components/code-snippet/code-snippet.ts"],"sourcesContent":["/**\n * @license\n *\n * Copyright IBM Corp. 2019, 2023\n *\n * This source code is licensed under the Apache-2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { classMap } from 'lit-html/directives/class-map';\nimport { html, property, query, LitElement, state } from 'lit-element';\nimport ChevronDown16 from '@carbon/icons/lib/chevron--down/16';\nimport settings from 'carbon-components/es/globals/js/settings';\nimport FocusMixin from '../../globals/mixins/focus';\nimport {\n _createHandleFeedbackTooltip as createHandleCopyButtonFeedbackTooltip,\n _renderButton as renderCopyButton,\n} from '../copy-button/copy-button';\nimport { CODE_SNIPPET_COLOR_SCHEME, CODE_SNIPPET_TYPE } from './defs';\nimport styles from './code-snippet.scss';\nimport { carbonElement as customElement } from '../../globals/decorators/carbon-element';\n\nexport { CODE_SNIPPET_COLOR_SCHEME, CODE_SNIPPET_TYPE };\n\nconst { prefix } = settings;\n\n/**\n * Basic code snippet.\n *\n * @element bx-code-snippet\n */\n@customElement(`${prefix}-code-snippet`)\nclass BXCodeSnippet extends FocusMixin(LitElement) {\n /**\n * `true` to expand multi-line variant of code snippet.\n */\n @state()\n private _expanded = false;\n\n /**\n * `true` to show the feedback tooltip.\n */\n private _showCopyButtonFeedback = false;\n\n /**\n * `true` to show the expando.\n */\n private _showExpando = false;\n\n /**\n * Determine whether the code text overflows the container.\n */\n protected _calculateOverflows() {\n const { _codeContainerNode: container, _preNode: preNode } = this;\n if (container && preNode) {\n const { clientWidth: containerWidth, scrollLeft } = container;\n const containerPadding = parseInt(\n getComputedStyle(container).getPropertyValue('padding-inline-start')\n );\n const { clientWidth: codeWidth } = preNode;\n const hasOverflow = codeWidth > containerWidth;\n this.hasOverflowLeft = hasOverflow && Boolean(scrollLeft);\n this.hasOverflowRight =\n hasOverflow &&\n codeWidth - scrollLeft > containerWidth - containerPadding;\n }\n }\n\n /**\n * Handles `click` event on the copy button.\n */\n private _handleClickCopyButton() {\n const { ownerDocument: doc } = this;\n const selection = doc!.defaultView!.getSelection();\n selection!.removeAllRanges();\n const code = doc!.createElement('code');\n code.className = `${prefix}--visually-hidden`;\n const pre = doc!.createElement('pre');\n pre.textContent = this.textContent;\n code.appendChild(pre);\n // Using `<code>` in shadow DOM seems to lose the LFs in some browsers\n doc!.body.appendChild(code);\n const range = doc!.createRange();\n range.selectNodeContents(code);\n selection!.addRange(range);\n doc!.execCommand('copy');\n this._handleCopyButtonFeedbackTooltip(this.copyButtonFeedbackTimeout);\n doc!.body.removeChild(code);\n selection!.removeAllRanges();\n }\n\n /**\n * Handles showing/hiding the feedback tooltip.\n */\n private _handleCopyButtonFeedbackTooltip =\n createHandleCopyButtonFeedbackTooltip(\n ({ showFeedback = false }: { showFeedback?: boolean }) => {\n this._showCopyButtonFeedback = showFeedback;\n this.requestUpdate();\n }\n );\n\n /**\n * Handles `click` event on the expando.\n */\n private _handleClickExpando() {\n this._expanded = !this._expanded;\n }\n\n /**\n * Handles change in slot content to determine if the content\n */\n private _handleSlotChange() {\n const { type, _preNode: preNode } = this;\n if (type === CODE_SNIPPET_TYPE.MULTI) {\n if (preNode.getBoundingClientRect().height > 255) {\n this._showExpando = true;\n this.requestUpdate();\n }\n }\n this._calculateOverflows();\n }\n\n /**\n * The `<pre>` element's container in the shadow DOM.\n */\n @query(`.${prefix}--snippet-container`)\n private _codeContainerNode!: HTMLElement;\n\n /**\n * The `<pre>` element in the shadow DOM.\n */\n @query('pre')\n private _preNode!: HTMLPreElement;\n\n /**\n * An assistive text for screen reader to advice a DOM node is for code snippet.\n */\n @property({ attribute: 'code-assistive-text' })\n codeAssistiveText = 'code-snippet';\n\n /**\n * The context content for the collapse button.\n */\n @property({ attribute: 'collapse-button-text' })\n collapseButtonText = 'Show less';\n\n /**\n * The color scheme.\n */\n @property({ attribute: 'color-scheme', reflect: true })\n colorScheme = CODE_SNIPPET_COLOR_SCHEME.REGULAR;\n\n /**\n * An assistive text for screen reader to announce, telling that the button copies the content to the clipboard.\n */\n @property({ attribute: 'copy-button-assistive-text' })\n copyButtonAssistiveText = 'Copy to clipboard';\n\n /**\n * The feedback text for the copy button.\n */\n @property({ attribute: 'copy-button-feedback-text' })\n copyButtonFeedbackText = 'Copied!';\n\n /**\n * The number in milliseconds to determine how long the tooltip for the copy button should remain.\n */\n @property({ type: Number, attribute: 'copy-button-feedback-timeout' })\n copyButtonFeedbackTimeout = 2000;\n\n /**\n * The context content for the expand button.\n */\n @property({ attribute: 'expand-button-text' })\n expandButtonText = 'Show more';\n\n /**\n * Whether or not the content is scrollable left.\n */\n @state()\n hasOverflowLeft = false;\n\n /**\n * Whether or not the content is scrollable right.\n */\n @state()\n hasOverflowRight = false;\n\n /**\n * The type of code snippet.\n */\n @property({ reflect: true })\n type = CODE_SNIPPET_TYPE.SINGLE;\n\n createRenderRoot() {\n return this.attachShadow({\n mode: 'open',\n delegatesFocus:\n Number((/Safari\\/(\\d+)/.exec(navigator.userAgent) ?? ['', 0])[1]) <=\n 537,\n });\n }\n\n /**\n * Renders the code snippet.\n */\n protected _renderCode() {\n const {\n codeAssistiveText,\n _expanded: expanded,\n _handleSlotChange: handleSlotChange,\n hasOverflowLeft,\n hasOverflowRight,\n } = this;\n\n const classes = classMap({\n [`${prefix}--snippet-container`]: true,\n [`${prefix}-ce--snippet-container--expanded`]: Boolean(expanded),\n });\n // Ensures no extra whitespace text node\n // prettier-ignore\n return html`\n ${hasOverflowLeft\n ? html`<span class=\"${prefix}--snippet__overflow-indicator--left\"></span>`\n : ''}\n <div\n role=\"textbox\"\n tabindex=\"0\"\n class=\"${classes}\"\n aria-label=\"${codeAssistiveText}\"\n @scroll=\"${this._calculateOverflows}\"\n >\n <code><pre><slot @slotchange=\"${handleSlotChange}\"></slot></pre></code>\n </div>\n ${hasOverflowRight\n ? html`<span class=\"${prefix}--snippet__overflow-indicator--right\"></span>`\n : ''}\n `;\n }\n\n /**\n * Renders the expando.\n */\n protected _renderExpando() {\n const { collapseButtonText, _expanded: expanded, expandButtonText } = this;\n return html`\n <button\n type=\"button\"\n class=\"${prefix}--snippet-btn--expand\"\n @click=\"${this._handleClickExpando}\">\n <span id=\"button-text\" class=\"${prefix}--snippet-btn--text\">\n ${expanded\n ? html`<slot name=\"collapse-button-text\"\n >${collapseButtonText}</slot\n >`\n : html`<slot name=\"expand-button-text\">${expandButtonText}</slot>`}\n </span>\n ${ChevronDown16({\n 'aria-labeledby': 'button-text',\n class: `${prefix}--icon-chevron--down ${prefix}--snippet__icon`,\n role: 'img',\n })}\n </button>\n `;\n }\n\n render() {\n const {\n codeAssistiveText,\n copyButtonAssistiveText,\n copyButtonFeedbackText,\n type,\n _showCopyButtonFeedback: showCopyButtonFeedback,\n _showExpando: showExpando,\n _handleClickCopyButton: handleClickCopyButton,\n _handleSlotChange: handleSlotChange,\n } = this;\n\n if (type === CODE_SNIPPET_TYPE.SINGLE) {\n // Ensures no extra whitespace text node\n // prettier-ignore\n return html`\n ${this._renderCode()}\n ${renderCopyButton({\n assistiveText: copyButtonAssistiveText,\n feedbackText: copyButtonFeedbackText,\n showFeedback: showCopyButtonFeedback,\n handleClickButton: handleClickCopyButton,\n className: `${prefix}--snippet-button`,\n })}\n `;\n }\n\n if (type === CODE_SNIPPET_TYPE.MULTI) {\n // Ensures no extra whitespace text node\n // prettier-ignore\n return html`\n ${this._renderCode()}\n ${renderCopyButton({\n assistiveText: copyButtonAssistiveText,\n feedbackText: copyButtonFeedbackText,\n showFeedback: showCopyButtonFeedback,\n handleClickButton: handleClickCopyButton,\n className: `${prefix}--snippet-button`,\n })}\n ${!showExpando\n ? undefined\n : this._renderExpando()}\n `;\n }\n\n // Ensures no extra whitespace text node\n // prettier-ignore\n return html`\n ${renderCopyButton({\n assistiveText: copyButtonAssistiveText,\n feedbackText: copyButtonFeedbackText,\n showFeedback: showCopyButtonFeedback,\n handleClickButton: handleClickCopyButton,\n className: `${prefix}--snippet ${prefix}--snippet--inline`,\n children: html`<code aria-label=\"${codeAssistiveText}\"><slot @slotchange=\"${handleSlotChange}\"></slot></code>`,\n })}\n `;\n }\n\n static styles = styles;\n}\n\nexport default BXCodeSnippet;\n"],"mappings":";;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,Q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