@redvars/peacock 3.15.0 → 3.17.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/dist/assets/styles.css +1 -1
- package/dist/assets/styles.css.map +1 -1
- package/dist/assets/theme.js +19 -19
- package/dist/assets/tokens.css +1 -1
- package/dist/assets/tokens.css.map +1 -1
- package/dist/card-content.js +8 -7
- package/dist/card-content.js.map +1 -1
- package/dist/card.js +142 -98
- package/dist/card.js.map +1 -1
- package/dist/{chart-bar-D5dGFJfK.js → cartesian-chart-DgE4USyC.js} +529 -312
- package/dist/cartesian-chart-DgE4USyC.js.map +1 -0
- package/dist/chart-area.js +78 -0
- package/dist/chart-area.js.map +1 -0
- package/dist/chart-bar.js +283 -213
- package/dist/chart-bar.js.map +1 -1
- package/dist/{transform-DSwFSqzD.js → chart-base-C2qRMF48.js} +771 -102
- package/dist/chart-base-C2qRMF48.js.map +1 -0
- package/dist/chart-doughnut.js +55 -287
- package/dist/chart-doughnut.js.map +1 -1
- package/dist/chart-line.js +626 -0
- package/dist/chart-line.js.map +1 -0
- package/dist/chart-pie.js +637 -195
- package/dist/chart-pie.js.map +1 -1
- package/dist/code-editor.js +704 -131
- package/dist/code-editor.js.map +1 -1
- package/dist/code-group.js +188 -0
- package/dist/code-group.js.map +1 -0
- package/dist/code-highlighter.js +895 -257
- package/dist/code-highlighter.js.map +1 -1
- package/dist/custom-elements-jsdocs.json +2278 -677
- package/dist/custom-elements.json +13962 -3690
- package/dist/image.js +5 -1
- package/dist/image.js.map +1 -1
- package/dist/index.js +8 -7
- package/dist/index.js.map +1 -1
- package/dist/loader-full.js +1 -1
- package/dist/loader.js +9 -3
- package/dist/loader.js.map +1 -1
- package/dist/{is-dark-mode-DOcaw4Yq.js → observe-theme-change-DCifz1uv.js} +2 -6
- package/dist/observe-theme-change-DCifz1uv.js.map +1 -0
- package/dist/pagination.js +408 -110
- package/dist/pagination.js.map +1 -1
- package/dist/path-CJ0Arqcy.js +166 -0
- package/dist/path-CJ0Arqcy.js.map +1 -0
- package/dist/snackbar.js +89 -34
- package/dist/snackbar.js.map +1 -1
- package/dist/src/__internal/chart/cartesian-chart.d.ts +80 -0
- package/dist/src/__internal/chart/chart-base.d.ts +113 -0
- package/dist/src/__internal/chart/paths.d.ts +5 -0
- package/dist/src/__internal/chart/types.d.ts +42 -0
- package/dist/src/card/card-content.d.ts +2 -3
- package/dist/src/card/card.d.ts +31 -17
- package/dist/src/chart-area/chart-area.d.ts +54 -0
- package/dist/src/chart-area/index.d.ts +1 -0
- package/dist/src/chart-bar/chart-bar.d.ts +44 -33
- package/dist/src/chart-bar/index.d.ts +0 -1
- package/dist/src/chart-doughnut/chart-doughnut.d.ts +33 -39
- package/dist/src/chart-line/chart-line.d.ts +69 -0
- package/dist/src/chart-line/index.d.ts +1 -0
- package/dist/src/chart-pie/chart-pie.d.ts +63 -28
- package/dist/src/code-editor/code-editor.d.ts +52 -13
- package/dist/src/code-editor/editor-theme.d.ts +60 -0
- package/dist/src/code-highlighter/code-group.d.ts +52 -0
- package/dist/src/code-highlighter/code-highlighter.d.ts +122 -15
- package/dist/src/code-highlighter/index.d.ts +1 -0
- package/dist/src/code-highlighter/line-ranges.d.ts +24 -0
- package/dist/src/code-highlighter/local.d.ts +4 -1
- package/dist/src/code-highlighter/token-colors.d.ts +8 -0
- package/dist/src/index.d.ts +4 -2
- package/dist/src/pagination/page-items.d.ts +14 -0
- package/dist/src/pagination/pagination.d.ts +46 -7
- package/dist/src/snackbar/snackbar.d.ts +13 -1
- package/dist/src/table/table.d.ts +125 -27
- package/dist/src/toolbar/toolbar.d.ts +56 -51
- package/dist/table.js +1007 -338
- package/dist/table.js.map +1 -1
- package/dist/test/chart.test.d.ts +1 -0
- package/dist/test/code-highlighter.test.d.ts +1 -0
- package/dist/test/pagination.test.d.ts +1 -0
- package/dist/test/table.test.d.ts +1 -0
- package/dist/token-colors-0TFHWbcq.js +81 -0
- package/dist/token-colors-0TFHWbcq.js.map +1 -0
- package/dist/toolbar.js +195 -184
- package/dist/toolbar.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -2
- package/readme.md +7 -6
- package/scss/_code-block.scss +139 -0
- package/scss/tokens.css +24 -0
- package/src/__internal/chart/cartesian-chart.ts +404 -0
- package/src/__internal/chart/chart-base.scss +252 -0
- package/src/__internal/chart/chart-base.ts +474 -0
- package/src/__internal/chart/paths.ts +28 -0
- package/src/__internal/chart/types.ts +49 -0
- package/src/card/card-content.ts +12 -9
- package/src/card/card.scss +66 -54
- package/src/card/card.ts +109 -73
- package/src/chart-area/chart-area.ts +82 -0
- package/src/chart-area/index.ts +1 -0
- package/src/chart-bar/chart-bar.ts +336 -250
- package/src/chart-bar/index.ts +0 -1
- package/src/chart-doughnut/chart-doughnut.ts +62 -262
- package/src/chart-doughnut/demo/index.html +14 -22
- package/src/chart-line/chart-line.scss +25 -0
- package/src/chart-line/chart-line.ts +346 -0
- package/src/chart-line/index.ts +1 -0
- package/src/chart-pie/chart-pie.scss +35 -16
- package/src/chart-pie/chart-pie.ts +282 -188
- package/src/chart-pie/demo/index.html +13 -21
- package/src/code-editor/code-editor.scss +132 -36
- package/src/code-editor/code-editor.ts +308 -88
- package/src/code-editor/demo/index.html +39 -12
- package/src/code-editor/editor-theme.ts +213 -0
- package/src/code-highlighter/code-group.scss +34 -0
- package/src/code-highlighter/code-group.ts +173 -0
- package/src/code-highlighter/code-highlighter.scss +226 -111
- package/src/code-highlighter/code-highlighter.ts +554 -199
- package/src/code-highlighter/demo/index.html +68 -4
- package/src/code-highlighter/index.ts +1 -0
- package/src/code-highlighter/line-ranges.ts +81 -0
- package/src/code-highlighter/local.ts +9 -3
- package/src/code-highlighter/token-colors.ts +42 -0
- package/src/index.ts +4 -2
- package/src/loader.ts +8 -2
- package/src/pagination/page-items.ts +50 -0
- package/src/pagination/pagination.scss +159 -44
- package/src/pagination/pagination.ts +275 -74
- package/src/snackbar/demo/index.html +39 -4
- package/src/snackbar/snackbar.scss +27 -10
- package/src/snackbar/snackbar.ts +80 -37
- package/src/table/table.scss +337 -109
- package/src/table/table.ts +812 -272
- package/src/toolbar/toolbar-colors.scss +6 -7
- package/src/toolbar/toolbar.scss +35 -106
- package/src/toolbar/toolbar.ts +180 -80
- package/dist/array-D5vjT2Xm.js +0 -14
- package/dist/array-D5vjT2Xm.js.map +0 -1
- package/dist/chart-bar-D5dGFJfK.js.map +0 -1
- package/dist/chart-stacked-bar.js +0 -403
- package/dist/chart-stacked-bar.js.map +0 -1
- package/dist/copy-to-clipboard-upGx-Ueo.js +0 -39
- package/dist/copy-to-clipboard-upGx-Ueo.js.map +0 -1
- package/dist/is-dark-mode-DOcaw4Yq.js.map +0 -1
- package/dist/pie-Dz0IDiPt.js +0 -537
- package/dist/pie-Dz0IDiPt.js.map +0 -1
- package/dist/pierre-dark-DFWl0m-C.js +0 -4
- package/dist/pierre-dark-DFWl0m-C.js.map +0 -1
- package/dist/pierre-light-BEkAPImt.js +0 -4
- package/dist/pierre-light-BEkAPImt.js.map +0 -1
- package/dist/src/chart-bar/chart-stacked-bar.d.ts +0 -78
- package/dist/src/code-highlighter/constants.d.ts +0 -1
- package/dist/transform-DSwFSqzD.js.map +0 -1
- package/src/chart-bar/chart-bar.scss +0 -58
- package/src/chart-bar/chart-stacked-bar.ts +0 -398
- package/src/chart-doughnut/chart-donut.scss +0 -37
- package/src/code-highlighter/constants.ts +0 -117
- /package/dist/test/{chart-bar.test.d.ts → card.test.d.ts} +0 -0
package/dist/code-editor.js
CHANGED
|
@@ -1,17 +1,211 @@
|
|
|
1
|
-
import { i, _ as __decorate, I as IndividualComponent,
|
|
1
|
+
import { i, _ as __decorate, I as IndividualComponent, b, A } from './IndividualComponent-Bdwyrvd6.js';
|
|
2
2
|
import { n } from './property-B49QQ8pS.js';
|
|
3
3
|
import { r } from './state-DkTK9EGF.js';
|
|
4
4
|
import { e } from './query-CHb9Ft_d.js';
|
|
5
5
|
import { e as e$1 } from './class-map-DG7CA1et.js';
|
|
6
6
|
import { B as BaseInput } from './BaseInput-CV0pZgSb.js';
|
|
7
|
-
import {
|
|
7
|
+
import { o as observeThemeChange } from './observe-theme-change-DCifz1uv.js';
|
|
8
8
|
import { r as redispatchEvent } from './dispatch-event-utils-CuEqjlPT.js';
|
|
9
|
-
import { c as copyToClipboard } from './
|
|
9
|
+
import { t as tokenColor, c as copyToClipboard } from './token-colors-0TFHWbcq.js';
|
|
10
10
|
import './base-Cl6v8-BZ.js';
|
|
11
11
|
import './directive-ZPhl09Yt.js';
|
|
12
12
|
import './element-internals-QME0yEz4.js';
|
|
13
13
|
import './form-associated-Bhwwr6dT.js';
|
|
14
14
|
|
|
15
|
+
/**
|
|
16
|
+
* The colors the editor theme is built from: Peacock color roles, plus the syntax colors
|
|
17
|
+
* wc-code-highlighter uses, so the two show code alike. Monaco takes hex colors only, so these
|
|
18
|
+
* are resolved on the page and converted.
|
|
19
|
+
*/
|
|
20
|
+
const PALETTE_SOURCES = {
|
|
21
|
+
surface: 'var(--color-surface)',
|
|
22
|
+
surfaceContainerHigh: 'var(--color-surface-container-high)',
|
|
23
|
+
surfaceContainerHighest: 'var(--color-surface-container-highest)',
|
|
24
|
+
onSurface: 'var(--color-on-surface)',
|
|
25
|
+
onSurfaceVariant: 'var(--color-on-surface-variant)',
|
|
26
|
+
outline: 'var(--color-outline)',
|
|
27
|
+
outlineVariant: 'var(--color-outline-variant)',
|
|
28
|
+
primary: 'var(--color-primary)',
|
|
29
|
+
secondary: 'var(--color-secondary)',
|
|
30
|
+
tertiary: 'var(--color-tertiary)',
|
|
31
|
+
secondaryContainer: 'var(--color-secondary-container)',
|
|
32
|
+
onSecondaryContainer: 'var(--color-on-secondary-container)',
|
|
33
|
+
error: 'var(--color-error)',
|
|
34
|
+
warning: 'var(--color-warning)',
|
|
35
|
+
info: 'var(--color-blue)',
|
|
36
|
+
foreground: tokenColor('foreground'),
|
|
37
|
+
keyword: tokenColor('token-keyword'),
|
|
38
|
+
string: tokenColor('token-string'),
|
|
39
|
+
func: tokenColor('token-function'),
|
|
40
|
+
constant: tokenColor('token-constant'),
|
|
41
|
+
comment: tokenColor('token-comment'),
|
|
42
|
+
punctuation: tokenColor('token-punctuation'),
|
|
43
|
+
parameter: tokenColor('token-parameter'),
|
|
44
|
+
link: tokenColor('token-link'),
|
|
45
|
+
};
|
|
46
|
+
let context;
|
|
47
|
+
/**
|
|
48
|
+
* Converts any CSS color the browser understands (`rgb()`, `oklch()`, `color()`, …) to
|
|
49
|
+
* `#rrggbb`, or `#rrggbbaa` when it is not opaque, by painting one pixel.
|
|
50
|
+
*/
|
|
51
|
+
function cssColorToHex(color) {
|
|
52
|
+
context ??= document
|
|
53
|
+
.createElement('canvas')
|
|
54
|
+
.getContext('2d', { willReadFrequently: true });
|
|
55
|
+
if (!context)
|
|
56
|
+
return '#000000';
|
|
57
|
+
context.clearRect(0, 0, 1, 1);
|
|
58
|
+
context.fillStyle = '#000000';
|
|
59
|
+
context.fillStyle = color;
|
|
60
|
+
context.fillRect(0, 0, 1, 1);
|
|
61
|
+
const [r, g, b, a] = context.getImageData(0, 0, 1, 1).data;
|
|
62
|
+
const hex = [r, g, b, ...(a < 255 ? [a] : [])]
|
|
63
|
+
.map(value => value.toString(16).padStart(2, '0'))
|
|
64
|
+
.join('');
|
|
65
|
+
return `#${hex}`;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Resolves the palette where `probe` sits, so it follows the theme around the editor:
|
|
69
|
+
* `data-theme`, the system color scheme, or a custom theme.
|
|
70
|
+
*/
|
|
71
|
+
function resolvePalette(probe) {
|
|
72
|
+
const palette = {};
|
|
73
|
+
for (const [key, value] of Object.entries(PALETTE_SOURCES)) {
|
|
74
|
+
// eslint-disable-next-line no-param-reassign
|
|
75
|
+
probe.style.color = value;
|
|
76
|
+
palette[key] = cssColorToHex(getComputedStyle(probe).color);
|
|
77
|
+
}
|
|
78
|
+
// eslint-disable-next-line no-param-reassign
|
|
79
|
+
probe.style.color = '';
|
|
80
|
+
return palette;
|
|
81
|
+
}
|
|
82
|
+
/** `#rrggbb` with an alpha from 0 to 1. */
|
|
83
|
+
function alpha(hex, opacity) {
|
|
84
|
+
const value = Math.round(Math.min(1, Math.max(0, opacity)) * 255);
|
|
85
|
+
return `${hex.slice(0, 7)}${value.toString(16).padStart(2, '0')}`;
|
|
86
|
+
}
|
|
87
|
+
/** Whether a `#rrggbb` color is dark, by relative luminance. */
|
|
88
|
+
function isDark(hex) {
|
|
89
|
+
const [r, g, b] = [1, 3, 5].map(index => {
|
|
90
|
+
const channel = parseInt(hex.slice(index, index + 2), 16) / 255;
|
|
91
|
+
return channel <= 0.04045
|
|
92
|
+
? channel / 12.92
|
|
93
|
+
: ((channel + 0.055) / 1.055) ** 2.4;
|
|
94
|
+
});
|
|
95
|
+
return 0.2126 * r + 0.7152 * g + 0.0722 * b < 0.18;
|
|
96
|
+
}
|
|
97
|
+
/** Monaco rules take colors without the `#`. */
|
|
98
|
+
const bare = (hex) => hex.slice(1, 7);
|
|
99
|
+
/**
|
|
100
|
+
* Builds the editor theme from a palette. The editor background is transparent, so the frame
|
|
101
|
+
* around it shows through; widgets such as suggestions and hovers sit on surface containers.
|
|
102
|
+
*/
|
|
103
|
+
function buildEditorTheme(p) {
|
|
104
|
+
return {
|
|
105
|
+
base: isDark(p.surface) ? 'vs-dark' : 'vs',
|
|
106
|
+
// Not inherited: Monaco's own rules are more specific than these (`string.value.json`,
|
|
107
|
+
// `keyword.flow`, …) and would keep its stock colors.
|
|
108
|
+
inherit: false,
|
|
109
|
+
rules: [
|
|
110
|
+
{ token: '', foreground: bare(p.foreground) },
|
|
111
|
+
{ token: 'comment', foreground: bare(p.comment), fontStyle: 'italic' },
|
|
112
|
+
{ token: 'keyword', foreground: bare(p.keyword) },
|
|
113
|
+
{ token: 'string', foreground: bare(p.string) },
|
|
114
|
+
{ token: 'string.escape', foreground: bare(p.constant) },
|
|
115
|
+
{ token: 'string.key.json', foreground: bare(p.keyword) },
|
|
116
|
+
{ token: 'string.link', foreground: bare(p.link) },
|
|
117
|
+
{ token: 'number', foreground: bare(p.constant) },
|
|
118
|
+
{ token: 'constant', foreground: bare(p.constant) },
|
|
119
|
+
{ token: 'regexp', foreground: bare(p.string) },
|
|
120
|
+
{ token: 'type', foreground: bare(p.func) },
|
|
121
|
+
{ token: 'identifier', foreground: bare(p.foreground) },
|
|
122
|
+
{ token: 'variable', foreground: bare(p.parameter) },
|
|
123
|
+
{ token: 'predefined', foreground: bare(p.func) },
|
|
124
|
+
{ token: 'annotation', foreground: bare(p.func) },
|
|
125
|
+
{ token: 'delimiter', foreground: bare(p.punctuation) },
|
|
126
|
+
{ token: 'operator', foreground: bare(p.punctuation) },
|
|
127
|
+
{ token: 'tag', foreground: bare(p.string) },
|
|
128
|
+
{ token: 'metatag', foreground: bare(p.keyword) },
|
|
129
|
+
{ token: 'attribute.name', foreground: bare(p.func) },
|
|
130
|
+
{ token: 'attribute.value', foreground: bare(p.string) },
|
|
131
|
+
{ token: 'tag.css', foreground: bare(p.func) },
|
|
132
|
+
{ token: 'attribute.name.css', foreground: bare(p.constant) },
|
|
133
|
+
{ token: 'attribute.value.css', foreground: bare(p.foreground) },
|
|
134
|
+
{ token: 'attribute.value.number.css', foreground: bare(p.constant) },
|
|
135
|
+
{ token: 'attribute.value.unit.css', foreground: bare(p.constant) },
|
|
136
|
+
{ token: 'attribute.value.hex.css', foreground: bare(p.constant) },
|
|
137
|
+
{ token: 'strong', fontStyle: 'bold' },
|
|
138
|
+
{ token: 'emphasis', fontStyle: 'italic' },
|
|
139
|
+
{ token: 'keyword.json', foreground: bare(p.constant) },
|
|
140
|
+
{ token: 'invalid', foreground: bare(p.error) },
|
|
141
|
+
],
|
|
142
|
+
colors: {
|
|
143
|
+
foreground: p.onSurface,
|
|
144
|
+
focusBorder: p.primary,
|
|
145
|
+
'editor.background': '#00000000',
|
|
146
|
+
'editor.foreground': p.foreground,
|
|
147
|
+
'editorGutter.background': '#00000000',
|
|
148
|
+
'editorLineNumber.foreground': p.onSurfaceVariant,
|
|
149
|
+
'editorLineNumber.activeForeground': p.onSurface,
|
|
150
|
+
'editor.lineHighlightBackground': alpha(p.onSurface, 0.05),
|
|
151
|
+
'editor.lineHighlightBorder': '#00000000',
|
|
152
|
+
'editorCursor.foreground': p.primary,
|
|
153
|
+
'editor.selectionBackground': alpha(p.primary, 0.24),
|
|
154
|
+
'editor.inactiveSelectionBackground': alpha(p.primary, 0.12),
|
|
155
|
+
'editor.selectionHighlightBackground': alpha(p.primary, 0.12),
|
|
156
|
+
'editor.wordHighlightBackground': alpha(p.primary, 0.1),
|
|
157
|
+
'editor.wordHighlightStrongBackground': alpha(p.primary, 0.16),
|
|
158
|
+
'editor.findMatchBackground': alpha(p.warning, 0.4),
|
|
159
|
+
'editor.findMatchHighlightBackground': alpha(p.warning, 0.2),
|
|
160
|
+
'editorBracketMatch.background': alpha(p.primary, 0.12),
|
|
161
|
+
'editorBracketMatch.border': alpha(p.primary, 0.5),
|
|
162
|
+
'editorIndentGuide.background1': alpha(p.outlineVariant, 0.6),
|
|
163
|
+
'editorIndentGuide.activeBackground1': p.outline,
|
|
164
|
+
'editorWhitespace.foreground': p.outlineVariant,
|
|
165
|
+
'editorError.foreground': p.error,
|
|
166
|
+
'editorWarning.foreground': p.warning,
|
|
167
|
+
'editorInfo.foreground': p.info,
|
|
168
|
+
'editorOverviewRuler.border': '#00000000',
|
|
169
|
+
'editorOverviewRuler.errorForeground': p.error,
|
|
170
|
+
'editorOverviewRuler.warningForeground': p.warning,
|
|
171
|
+
'editorWidget.background': p.surfaceContainerHigh,
|
|
172
|
+
'editorWidget.foreground': p.onSurface,
|
|
173
|
+
'editorWidget.border': p.outlineVariant,
|
|
174
|
+
'editorSuggestWidget.background': p.surfaceContainerHigh,
|
|
175
|
+
'editorSuggestWidget.border': p.outlineVariant,
|
|
176
|
+
'editorSuggestWidget.foreground': p.onSurface,
|
|
177
|
+
'editorSuggestWidget.highlightForeground': p.primary,
|
|
178
|
+
'editorSuggestWidget.selectedBackground': p.secondaryContainer,
|
|
179
|
+
'editorSuggestWidget.selectedForeground': p.onSecondaryContainer,
|
|
180
|
+
'editorHoverWidget.background': p.surfaceContainerHigh,
|
|
181
|
+
'editorHoverWidget.foreground': p.onSurface,
|
|
182
|
+
'editorHoverWidget.border': p.outlineVariant,
|
|
183
|
+
'input.background': p.surfaceContainerHighest,
|
|
184
|
+
'input.foreground': p.onSurface,
|
|
185
|
+
'input.border': p.outlineVariant,
|
|
186
|
+
'inputOption.activeBorder': p.primary,
|
|
187
|
+
'list.hoverBackground': alpha(p.onSurface, 0.08),
|
|
188
|
+
'list.activeSelectionBackground': p.secondaryContainer,
|
|
189
|
+
'list.activeSelectionForeground': p.onSecondaryContainer,
|
|
190
|
+
'list.highlightForeground': p.primary,
|
|
191
|
+
'scrollbar.shadow': '#00000000',
|
|
192
|
+
'scrollbarSlider.background': alpha(p.onSurface, 0.16),
|
|
193
|
+
'scrollbarSlider.hoverBackground': alpha(p.onSurface, 0.28),
|
|
194
|
+
'scrollbarSlider.activeBackground': alpha(p.onSurface, 0.38),
|
|
195
|
+
'minimap.background': '#00000000',
|
|
196
|
+
'widget.shadow': alpha('#000000', 0.2),
|
|
197
|
+
// Bracket pairs cycle through the theme's accent roles.
|
|
198
|
+
'editorBracketHighlight.foreground1': p.primary,
|
|
199
|
+
'editorBracketHighlight.foreground2': p.tertiary,
|
|
200
|
+
'editorBracketHighlight.foreground3': p.secondary,
|
|
201
|
+
'editorBracketHighlight.foreground4': p.primary,
|
|
202
|
+
'editorBracketHighlight.foreground5': p.tertiary,
|
|
203
|
+
'editorBracketHighlight.foreground6': p.secondary,
|
|
204
|
+
'editorBracketHighlight.unexpectedBracket.foreground': p.error,
|
|
205
|
+
},
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
|
|
15
209
|
var css_248z = i`@charset "UTF-8";
|
|
16
210
|
* {
|
|
17
211
|
box-sizing: border-box;
|
|
@@ -26,6 +220,124 @@ var css_248z = i`@charset "UTF-8";
|
|
|
26
220
|
display: none !important;
|
|
27
221
|
}
|
|
28
222
|
|
|
223
|
+
.code-block {
|
|
224
|
+
--_pad-block: var(--spacing-200);
|
|
225
|
+
--_pad-inline: var(--spacing-200);
|
|
226
|
+
--_pad-near: var(--spacing-100);
|
|
227
|
+
--_background: var(
|
|
228
|
+
--code-editor-background,
|
|
229
|
+
var(--color-surface-container-low)
|
|
230
|
+
);
|
|
231
|
+
--_border-color: var(--code-editor-border-color, var(--color-outline-variant));
|
|
232
|
+
--_foreground: var(--code-editor-foreground, var(--color-on-surface));
|
|
233
|
+
position: relative;
|
|
234
|
+
display: flex;
|
|
235
|
+
flex-direction: column;
|
|
236
|
+
height: 100%;
|
|
237
|
+
min-width: 0;
|
|
238
|
+
overflow: hidden;
|
|
239
|
+
background: var(--_background);
|
|
240
|
+
color: var(--_foreground);
|
|
241
|
+
border: 1px solid var(--_border-color);
|
|
242
|
+
border-radius: var(--code-editor-shape, var(--shape-corner-medium));
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
.header {
|
|
246
|
+
display: flex;
|
|
247
|
+
align-items: center;
|
|
248
|
+
gap: var(--spacing-100);
|
|
249
|
+
min-width: 0;
|
|
250
|
+
padding: var(--_pad-block) var(--_pad-inline) 0;
|
|
251
|
+
color: var(--color-on-surface-variant);
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
::slotted([slot=icon]) {
|
|
255
|
+
--icon-size: 1.125rem;
|
|
256
|
+
flex: none;
|
|
257
|
+
color: var(--color-on-surface-variant);
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
.title {
|
|
261
|
+
flex: 1 1 auto;
|
|
262
|
+
min-width: 0;
|
|
263
|
+
overflow: hidden;
|
|
264
|
+
text-overflow: ellipsis;
|
|
265
|
+
white-space: nowrap;
|
|
266
|
+
color: var(--color-on-surface);
|
|
267
|
+
font-family: var(--typography-title-small-font-family) !important;
|
|
268
|
+
font-size: var(--typography-title-small-font-size) !important;
|
|
269
|
+
font-weight: var(--typography-title-small-font-weight) !important;
|
|
270
|
+
line-height: var(--typography-title-small-line-height) !important;
|
|
271
|
+
letter-spacing: var(--typography-title-small-letter-spacing) !important;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
.actions {
|
|
275
|
+
display: flex;
|
|
276
|
+
flex: none;
|
|
277
|
+
align-items: center;
|
|
278
|
+
gap: var(--spacing-025);
|
|
279
|
+
margin-inline-start: auto;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
.header .actions {
|
|
283
|
+
margin-block: calc(-1 * var(--spacing-100));
|
|
284
|
+
margin-inline-end: calc(-1 * var(--spacing-100));
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
.actions.floating {
|
|
288
|
+
position: absolute;
|
|
289
|
+
z-index: 1;
|
|
290
|
+
inset-block-start: var(--spacing-100);
|
|
291
|
+
inset-inline-end: var(--spacing-100);
|
|
292
|
+
padding: var(--spacing-025);
|
|
293
|
+
background: var(--color-surface);
|
|
294
|
+
border: 1px solid var(--color-outline-variant);
|
|
295
|
+
border-radius: var(--shape-corner-full);
|
|
296
|
+
opacity: 0;
|
|
297
|
+
transition: opacity var(--duration-short4) var(--easing-standard);
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
.code-block:hover .actions.floating,
|
|
301
|
+
.code-block:focus-within .actions.floating {
|
|
302
|
+
opacity: 1;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
@media (pointer: coarse) {
|
|
306
|
+
.actions.floating {
|
|
307
|
+
opacity: 1;
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
@media (prefers-reduced-motion: reduce) {
|
|
311
|
+
.actions.floating {
|
|
312
|
+
transition: none;
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
.sr-only {
|
|
316
|
+
position: absolute;
|
|
317
|
+
width: 1px;
|
|
318
|
+
height: 1px;
|
|
319
|
+
padding: 0;
|
|
320
|
+
margin: -1px;
|
|
321
|
+
overflow: hidden;
|
|
322
|
+
clip-path: inset(50%);
|
|
323
|
+
white-space: nowrap;
|
|
324
|
+
border: 0;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
:host([size=sm]) .code-block {
|
|
328
|
+
--_pad-block: var(--spacing-150);
|
|
329
|
+
--_pad-inline: var(--spacing-150);
|
|
330
|
+
--_pad-near: var(--spacing-075);
|
|
331
|
+
border-radius: var(--code-editor-shape, var(--shape-corner-small));
|
|
332
|
+
}
|
|
333
|
+
:host([size=sm]) .title {
|
|
334
|
+
font-family: var(--typography-label-medium-font-family) !important;
|
|
335
|
+
font-size: var(--typography-label-medium-font-size) !important;
|
|
336
|
+
font-weight: var(--typography-label-medium-font-weight) !important;
|
|
337
|
+
line-height: var(--typography-label-medium-line-height) !important;
|
|
338
|
+
letter-spacing: var(--typography-label-medium-letter-spacing) !important;
|
|
339
|
+
}
|
|
340
|
+
|
|
29
341
|
/* stylelint-disable -- vendored Monaco editor CSS, kept as shipped */
|
|
30
342
|
.monaco-aria-container {
|
|
31
343
|
position: absolute;
|
|
@@ -6353,39 +6665,141 @@ var css_248z = i`@charset "UTF-8";
|
|
|
6353
6665
|
/* stylelint-enable */
|
|
6354
6666
|
:host {
|
|
6355
6667
|
display: block;
|
|
6356
|
-
|
|
6357
|
-
--code-editor-height: 300px;
|
|
6668
|
+
min-width: 0;
|
|
6358
6669
|
}
|
|
6359
6670
|
|
|
6360
|
-
.code-
|
|
6361
|
-
|
|
6362
|
-
|
|
6363
|
-
|
|
6364
|
-
|
|
6365
|
-
|
|
6366
|
-
|
|
6671
|
+
.code-block {
|
|
6672
|
+
--_pad-top: var(--_pad-block);
|
|
6673
|
+
height: auto;
|
|
6674
|
+
}
|
|
6675
|
+
.code-block.has-header {
|
|
6676
|
+
--_pad-top: var(--_pad-near);
|
|
6677
|
+
}
|
|
6678
|
+
.code-block.focused {
|
|
6679
|
+
border-color: var(--color-primary);
|
|
6680
|
+
outline: 1px solid var(--color-primary);
|
|
6681
|
+
outline-offset: -2px;
|
|
6682
|
+
}
|
|
6683
|
+
.code-block.disabled {
|
|
6684
|
+
border-color: color-mix(in srgb, var(--color-on-surface) calc(var(--state-disabled-container-opacity) * 100%), transparent);
|
|
6685
|
+
}
|
|
6686
|
+
.code-block.disabled .header,
|
|
6687
|
+
.code-block.disabled .editor-area {
|
|
6688
|
+
opacity: var(--state-disabled-content-opacity);
|
|
6689
|
+
}
|
|
6690
|
+
|
|
6691
|
+
.actions.floating {
|
|
6692
|
+
inset-inline-end: var(--spacing-300);
|
|
6693
|
+
}
|
|
6694
|
+
|
|
6695
|
+
.actions.floating.pinned {
|
|
6696
|
+
opacity: 1;
|
|
6697
|
+
}
|
|
6698
|
+
|
|
6699
|
+
.read-only-badge {
|
|
6700
|
+
display: inline-flex;
|
|
6367
6701
|
align-items: center;
|
|
6368
|
-
justify-content: center;
|
|
6369
6702
|
gap: var(--spacing-050);
|
|
6703
|
+
padding: 0 var(--spacing-100);
|
|
6704
|
+
color: var(--color-on-surface-variant);
|
|
6705
|
+
font-family: var(--typography-label-small-font-family) !important;
|
|
6706
|
+
font-size: var(--typography-label-small-font-size) !important;
|
|
6707
|
+
font-weight: var(--typography-label-small-font-weight) !important;
|
|
6708
|
+
line-height: var(--typography-label-small-line-height) !important;
|
|
6709
|
+
letter-spacing: var(--typography-label-small-letter-spacing) !important;
|
|
6710
|
+
}
|
|
6711
|
+
.read-only-badge wc-icon {
|
|
6712
|
+
--icon-size: 0.875rem;
|
|
6370
6713
|
}
|
|
6371
6714
|
|
|
6372
|
-
.
|
|
6373
|
-
display: block;
|
|
6374
|
-
height: 100%;
|
|
6715
|
+
.editor-area {
|
|
6375
6716
|
position: relative;
|
|
6376
|
-
|
|
6717
|
+
height: var(--code-editor-height, 300px);
|
|
6718
|
+
min-height: 0;
|
|
6719
|
+
}
|
|
6720
|
+
|
|
6721
|
+
.editor {
|
|
6722
|
+
height: 100%;
|
|
6723
|
+
}
|
|
6724
|
+
|
|
6725
|
+
.probe {
|
|
6726
|
+
position: absolute;
|
|
6727
|
+
inset-block-start: 0;
|
|
6728
|
+
inset-inline-start: 0;
|
|
6729
|
+
padding-block: var(--_pad-top) var(--_pad-block);
|
|
6730
|
+
visibility: hidden;
|
|
6731
|
+
pointer-events: none;
|
|
6732
|
+
font-family: var(--typography-code-medium-font-family) !important;
|
|
6733
|
+
font-size: var(--typography-code-medium-font-size) !important;
|
|
6734
|
+
font-weight: var(--typography-code-medium-font-weight) !important;
|
|
6735
|
+
line-height: var(--typography-code-medium-line-height) !important;
|
|
6736
|
+
letter-spacing: var(--typography-code-medium-letter-spacing) !important;
|
|
6737
|
+
}
|
|
6738
|
+
|
|
6739
|
+
.placeholder {
|
|
6740
|
+
position: absolute;
|
|
6741
|
+
inset: 0;
|
|
6742
|
+
margin: 0;
|
|
6743
|
+
padding-block-start: var(--_pad-top);
|
|
6744
|
+
padding-inline-start: calc(var(--_gutter, 0px) + var(--spacing-300));
|
|
6745
|
+
overflow: hidden;
|
|
6746
|
+
color: var(--_foreground);
|
|
6747
|
+
white-space: pre;
|
|
6748
|
+
pointer-events: none;
|
|
6749
|
+
font-family: var(--typography-code-medium-font-family) !important;
|
|
6750
|
+
font-size: var(--typography-code-medium-font-size) !important;
|
|
6751
|
+
font-weight: var(--typography-code-medium-font-weight) !important;
|
|
6752
|
+
line-height: var(--typography-code-medium-line-height) !important;
|
|
6753
|
+
letter-spacing: var(--typography-code-medium-letter-spacing) !important;
|
|
6754
|
+
}
|
|
6755
|
+
|
|
6756
|
+
.numbered {
|
|
6757
|
+
--_gutter: 3ch;
|
|
6758
|
+
}
|
|
6759
|
+
|
|
6760
|
+
.breakpoint-gutter .placeholder {
|
|
6761
|
+
padding-inline-start: calc(var(--_gutter, 0px) + var(--spacing-300) + 1.25rem);
|
|
6762
|
+
}
|
|
6763
|
+
|
|
6764
|
+
.skeleton {
|
|
6765
|
+
position: absolute;
|
|
6766
|
+
inset: 0;
|
|
6767
|
+
z-index: 2;
|
|
6768
|
+
}
|
|
6769
|
+
|
|
6770
|
+
:host([size=sm]) .probe,
|
|
6771
|
+
:host([size=sm]) .placeholder {
|
|
6772
|
+
font-family: var(--typography-code-small-font-family) !important;
|
|
6773
|
+
font-size: var(--typography-code-small-font-size) !important;
|
|
6774
|
+
font-weight: var(--typography-code-small-font-weight) !important;
|
|
6775
|
+
line-height: var(--typography-code-small-line-height) !important;
|
|
6776
|
+
letter-spacing: var(--typography-code-small-letter-spacing) !important;
|
|
6377
6777
|
}
|
|
6378
|
-
|
|
6379
|
-
|
|
6778
|
+
|
|
6779
|
+
:host([fill]) {
|
|
6780
|
+
height: 100%;
|
|
6781
|
+
min-height: 0;
|
|
6782
|
+
}
|
|
6783
|
+
:host([fill]) .code-block {
|
|
6784
|
+
height: 100%;
|
|
6785
|
+
background: transparent;
|
|
6786
|
+
border: 0;
|
|
6787
|
+
border-radius: 0;
|
|
6788
|
+
outline: none;
|
|
6789
|
+
}
|
|
6790
|
+
:host([fill]) .editor-area {
|
|
6791
|
+
flex: 1 1 auto;
|
|
6792
|
+
height: auto;
|
|
6380
6793
|
}
|
|
6381
|
-
|
|
6794
|
+
|
|
6795
|
+
.code-block .monaco-editor {
|
|
6382
6796
|
--vscode-editor-background: transparent;
|
|
6383
6797
|
--vscode-editorGutter-background: transparent;
|
|
6384
6798
|
}
|
|
6385
|
-
.code-
|
|
6799
|
+
.code-block .wc-code-editor-breakpoint {
|
|
6386
6800
|
cursor: pointer;
|
|
6387
6801
|
}
|
|
6388
|
-
.code-
|
|
6802
|
+
.code-block .wc-code-editor-breakpoint::before {
|
|
6389
6803
|
content: "";
|
|
6390
6804
|
display: block;
|
|
6391
6805
|
width: 10px;
|
|
@@ -6394,15 +6808,15 @@ var css_248z = i`@charset "UTF-8";
|
|
|
6394
6808
|
border-radius: 50%;
|
|
6395
6809
|
background: var(--color-error);
|
|
6396
6810
|
}
|
|
6397
|
-
.code-
|
|
6811
|
+
.code-block .wc-code-editor-current-line {
|
|
6398
6812
|
background: color-mix(in srgb, var(--color-warning) 22%, transparent);
|
|
6399
6813
|
}
|
|
6400
|
-
.code-
|
|
6401
|
-
.code-
|
|
6814
|
+
.code-block .wc-code-editor-current-line-glyph,
|
|
6815
|
+
.code-block .wc-code-editor-breakpoint.wc-code-editor-current-line-glyph {
|
|
6402
6816
|
z-index: 1;
|
|
6403
6817
|
}
|
|
6404
|
-
.code-
|
|
6405
|
-
.code-
|
|
6818
|
+
.code-block .wc-code-editor-current-line-glyph::before,
|
|
6819
|
+
.code-block .wc-code-editor-breakpoint.wc-code-editor-current-line-glyph::before {
|
|
6406
6820
|
content: "";
|
|
6407
6821
|
display: block;
|
|
6408
6822
|
width: 0;
|
|
@@ -6413,33 +6827,18 @@ var css_248z = i`@charset "UTF-8";
|
|
|
6413
6827
|
border-block: 6px solid transparent;
|
|
6414
6828
|
border-inline-start: 10px solid var(--color-warning);
|
|
6415
6829
|
}
|
|
6416
|
-
.code-
|
|
6830
|
+
.code-block .monaco-editor .margin-view-overlays .cgmr {
|
|
6417
6831
|
cursor: pointer;
|
|
6418
|
-
}
|
|
6419
|
-
|
|
6420
|
-
:host([fill]) {
|
|
6421
|
-
--code-editor-height: 100%;
|
|
6422
|
-
min-height: 0;
|
|
6423
|
-
}
|
|
6424
|
-
|
|
6425
|
-
.code-editor-component.fill {
|
|
6426
|
-
height: 100%;
|
|
6427
|
-
}
|
|
6428
|
-
|
|
6429
|
-
.toolbar {
|
|
6430
|
-
position: absolute;
|
|
6431
|
-
top: var(--spacing-100);
|
|
6432
|
-
inset-inline-end: var(--spacing-300);
|
|
6433
|
-
z-index: 1;
|
|
6434
|
-
display: flex;
|
|
6435
|
-
align-items: center;
|
|
6436
|
-
gap: var(--spacing-100);
|
|
6437
6832
|
}`;
|
|
6438
6833
|
|
|
6439
6834
|
const locale = {
|
|
6440
6835
|
copied: 'Copied',
|
|
6441
6836
|
copyToClipboard: 'Copy to clipboard',
|
|
6442
|
-
|
|
6837
|
+
copiedCode: 'Copied code to clipboard',
|
|
6838
|
+
readOnly: 'Read only',
|
|
6839
|
+
wrapLines: 'Wrap lines',
|
|
6840
|
+
unwrapLines: 'Turn off line wrap',
|
|
6841
|
+
editorLabel: 'Code editor',
|
|
6443
6842
|
breakpoint: 'Breakpoint',
|
|
6444
6843
|
currentLine: 'Paused here',
|
|
6445
6844
|
};
|
|
@@ -6452,31 +6851,46 @@ const EXTENSIONS = {
|
|
|
6452
6851
|
scss: 'scss',
|
|
6453
6852
|
markdown: 'md',
|
|
6454
6853
|
};
|
|
6854
|
+
/** Monaco has one theme per page; every editor defines it from the tokens around it. */
|
|
6855
|
+
const THEME_NAME = 'peacock';
|
|
6856
|
+
/** How long the copy button shows its check. */
|
|
6857
|
+
const COPY_FEEDBACK_DURATION = 2000;
|
|
6455
6858
|
/** Where the language workers are: `monaco/` beside the built component. */
|
|
6456
6859
|
const WORKERS = new URL('./monaco/', import.meta.url);
|
|
6457
6860
|
let loading;
|
|
6458
6861
|
let instances = 0;
|
|
6862
|
+
/** The worker file for a Monaco language service label. */
|
|
6863
|
+
function workerFile(label) {
|
|
6864
|
+
if (label === 'typescript' || label === 'javascript')
|
|
6865
|
+
return 'ts.worker.js';
|
|
6866
|
+
if (label === 'json')
|
|
6867
|
+
return 'json.worker.js';
|
|
6868
|
+
return 'editor.worker.js';
|
|
6869
|
+
}
|
|
6870
|
+
/** The next editor's model number. */
|
|
6871
|
+
function nextInstanceId() {
|
|
6872
|
+
instances += 1;
|
|
6873
|
+
return instances;
|
|
6874
|
+
}
|
|
6459
6875
|
/**
|
|
6460
6876
|
* Loads Monaco once per page: its workers come from this origin, and the icon font is declared in
|
|
6461
6877
|
* the document, since a shadow root ignores `@font-face`.
|
|
6462
6878
|
*/
|
|
6463
6879
|
function loadMonaco() {
|
|
6464
6880
|
loading ??= (async () => {
|
|
6465
|
-
Reflect.set(
|
|
6881
|
+
Reflect.set(window, 'MonacoEnvironment', {
|
|
6466
6882
|
getWorker(_id, label) {
|
|
6467
|
-
|
|
6468
|
-
|
|
6469
|
-
|
|
6470
|
-
? 'json.worker.js'
|
|
6471
|
-
: 'editor.worker.js';
|
|
6472
|
-
return new Worker(new URL(file, WORKERS), { type: 'module' });
|
|
6883
|
+
return new Worker(new URL(workerFile(label), WORKERS), {
|
|
6884
|
+
type: 'module',
|
|
6885
|
+
});
|
|
6473
6886
|
},
|
|
6474
6887
|
});
|
|
6475
6888
|
const font = css_248z.cssText.match(/@font-face\s*\{[^}]*font-family:\s*codicon[^}]*\}/);
|
|
6476
6889
|
if (font && !document.getElementById('wc-code-editor-codicon')) {
|
|
6890
|
+
const [declaration] = font;
|
|
6477
6891
|
const style = document.createElement('style');
|
|
6478
6892
|
style.id = 'wc-code-editor-codicon';
|
|
6479
|
-
style.textContent =
|
|
6893
|
+
style.textContent = declaration;
|
|
6480
6894
|
document.head.append(style);
|
|
6481
6895
|
}
|
|
6482
6896
|
return import('./monaco-CM52C2ss.js').then(function (n) { return n.m; });
|
|
@@ -6490,16 +6904,30 @@ function loadMonaco() {
|
|
|
6490
6904
|
*
|
|
6491
6905
|
* @summary A Monaco-based code editing component with syntax highlighting, completions and debugging marks.
|
|
6492
6906
|
* @overview
|
|
6493
|
-
* - CodeEditor wraps Monaco Editor as a web component. Monaco is bundled with Peacock and loaded when the first editor appears; nothing comes from a CDN, so it works under a content security policy that allows only its own origin.
|
|
6494
|
-
* -
|
|
6907
|
+
* - CodeEditor wraps Monaco Editor as a web component, in the same frame as `wc-code-highlighter`: an optional header with a title and actions, or a copy button that floats at the top end. Monaco is bundled with Peacock and loaded when the first editor appears; nothing comes from a CDN, so it works under a content security policy that allows only its own origin. The code shows as plain text until Monaco is ready.
|
|
6908
|
+
* - Its colors come from the theme's color roles and the code highlighter's syntax colors, so light, dark, the system color scheme and custom themes all follow the tokens.
|
|
6909
|
+
* - Supports TypeScript, JavaScript, JSON, HTML, CSS, SCSS and Markdown, with completions and errors for TypeScript, JavaScript and JSON; read-only mode, line numbers, line wrapping and a minimap.
|
|
6495
6910
|
* - `lib-source` adds TypeScript declarations for completions, such as the modules a script may import.
|
|
6496
6911
|
* - With `breakpoint-gutter`, a click in the gutter fires `breakpoint-toggle`; `breakpoints` and `current-line` draw the marks a debugger shows.
|
|
6497
6912
|
* - `markers` underline problems, such as where a run failed.
|
|
6498
|
-
* - With `fill`, the editor takes the height of its container.
|
|
6499
|
-
* - Has a copy button; hide it with `hide-copy`.
|
|
6913
|
+
* - With `fill`, the editor drops its frame and takes the height of its container, as a pane of its own.
|
|
6500
6914
|
* - Emits `change` when content is edited and updates value from property changes.
|
|
6501
6915
|
*
|
|
6502
|
-
* @
|
|
6916
|
+
* @slot title - Header title content. Overrides `label` and shows the header.
|
|
6917
|
+
* @slot icon - Icon shown before the title in the header.
|
|
6918
|
+
* @slot actions - Extra action buttons, shown in the header or floating at the top end.
|
|
6919
|
+
*
|
|
6920
|
+
* @csspart container - The outer frame.
|
|
6921
|
+
* @csspart header - The header row.
|
|
6922
|
+
* @csspart title - The header title.
|
|
6923
|
+
* @csspart actions - The action buttons group.
|
|
6924
|
+
* @csspart editor - The area Monaco renders into.
|
|
6925
|
+
*
|
|
6926
|
+
* @cssprop --code-editor-height - Height of the editing area. Defaults to 300px. Ignored with `fill`.
|
|
6927
|
+
* @cssprop --code-editor-background - Frame background. Defaults to `--color-surface-container-low`.
|
|
6928
|
+
* @cssprop --code-editor-border-color - Frame border color. Defaults to `--color-outline-variant`.
|
|
6929
|
+
* @cssprop --code-editor-shape - Frame corner radius. Defaults to `--shape-corner-medium`.
|
|
6930
|
+
* @cssprop --code-highlighter-token-keyword - Keyword color, shared with `wc-code-highlighter`, like the other `--code-highlighter-token-*` colors.
|
|
6503
6931
|
*
|
|
6504
6932
|
* @fires {Event} change - Dispatched when the user edits the content.
|
|
6505
6933
|
* @fires {CustomEvent<{value: string}>} copied - Dispatched after the copy button copies the content.
|
|
@@ -6509,6 +6937,7 @@ function loadMonaco() {
|
|
|
6509
6937
|
* ```html
|
|
6510
6938
|
* <wc-code-editor
|
|
6511
6939
|
* language="css"
|
|
6940
|
+
* label="theme.css"
|
|
6512
6941
|
* readonly
|
|
6513
6942
|
* style="width: 100%; --code-editor-height: 10rem;"
|
|
6514
6943
|
* value=":root { --color-primary: #6341d5; }">
|
|
@@ -6526,13 +6955,21 @@ let CodeEditor = class CodeEditor extends BaseInput {
|
|
|
6526
6955
|
this.value = '';
|
|
6527
6956
|
/** Language used for syntax highlighting. Can be changed after the editor loads. */
|
|
6528
6957
|
this.language = 'javascript';
|
|
6958
|
+
/** Header title, such as a file name. Shows the header. */
|
|
6959
|
+
this.label = '';
|
|
6529
6960
|
/** Whether line numbers show in the gutter. */
|
|
6530
6961
|
this.lineNumbers = 'on';
|
|
6962
|
+
/** Wraps long lines instead of scrolling horizontally. */
|
|
6963
|
+
this.wrap = false;
|
|
6964
|
+
/** Shows a button that turns line wrapping on and off. */
|
|
6965
|
+
this.wrapToggle = false;
|
|
6531
6966
|
/** Shows the minimap. Leave the attribute out to hide it. */
|
|
6532
6967
|
this.minimap = false;
|
|
6968
|
+
/** Size of the editor. `sm` uses smaller text and padding. */
|
|
6969
|
+
this.size = 'md';
|
|
6533
6970
|
/** Hides the copy button. */
|
|
6534
6971
|
this.hideCopy = false;
|
|
6535
|
-
/** Shows a "Read
|
|
6972
|
+
/** Shows a "Read only" badge while the editor is read-only or disabled. */
|
|
6536
6973
|
this.showReadonlyBadge = false;
|
|
6537
6974
|
/** Shows a gutter for breakpoints; a click there, or on a line number, fires `breakpoint-toggle`. */
|
|
6538
6975
|
this.breakpointGutter = false;
|
|
@@ -6540,28 +6977,45 @@ let CodeEditor = class CodeEditor extends BaseInput {
|
|
|
6540
6977
|
this.breakpoints = [];
|
|
6541
6978
|
/** Problems to underline, such as where a run failed. */
|
|
6542
6979
|
this.markers = [];
|
|
6543
|
-
/**
|
|
6980
|
+
/** Drops the frame and takes the height of the container instead of `--code-editor-height`. */
|
|
6544
6981
|
this.fill = false;
|
|
6545
|
-
/** Whether the page is in dark mode; picks the Monaco theme. */
|
|
6546
|
-
this._isDarkMode = isDarkMode();
|
|
6547
6982
|
/** Whether the editor text has focus. */
|
|
6548
6983
|
this.hasFocus = false;
|
|
6549
|
-
/** Whether the copy button was just used; shows a check for a
|
|
6984
|
+
/** Whether the copy button was just used; shows a check for a moment. */
|
|
6550
6985
|
this._copied = false;
|
|
6551
6986
|
/** This editor's model's address, unique on the page so two editors never share a model. */
|
|
6552
|
-
this.__id =
|
|
6987
|
+
this.__id = nextInstanceId();
|
|
6988
|
+
/** The font and padding last given to Monaco, to skip unchanged updates. */
|
|
6989
|
+
this.__layoutKey = '';
|
|
6990
|
+
// ── Private methods
|
|
6991
|
+
/** Defines the page's editor theme from the tokens around this editor. */
|
|
6992
|
+
this.__applyTheme = () => {
|
|
6993
|
+
const { monaco, probeElement } = this;
|
|
6994
|
+
if (!monaco || !probeElement)
|
|
6995
|
+
return;
|
|
6996
|
+
monaco.editor.defineTheme(THEME_NAME, buildEditorTheme(resolvePalette(probeElement)));
|
|
6997
|
+
monaco.editor.setTheme(THEME_NAME);
|
|
6998
|
+
};
|
|
6553
6999
|
}
|
|
6554
7000
|
// ── Lifecycle
|
|
6555
7001
|
connectedCallback() {
|
|
6556
7002
|
super.connectedCallback();
|
|
6557
|
-
this.__unobserveTheme = observeThemeChange(
|
|
6558
|
-
|
|
6559
|
-
|
|
7003
|
+
this.__unobserveTheme = observeThemeChange(this.__applyTheme);
|
|
7004
|
+
this.__colorScheme = window.matchMedia?.('(prefers-color-scheme: dark)');
|
|
7005
|
+
this.__colorScheme?.addEventListener('change', this.__applyTheme);
|
|
7006
|
+
this.__childObserver = new MutationObserver(() => this.requestUpdate());
|
|
7007
|
+
this.__childObserver.observe(this, {
|
|
7008
|
+
childList: true,
|
|
7009
|
+
attributes: true,
|
|
7010
|
+
attributeFilter: ['slot'],
|
|
7011
|
+
subtree: true,
|
|
6560
7012
|
});
|
|
6561
7013
|
}
|
|
6562
7014
|
disconnectedCallback() {
|
|
6563
7015
|
super.disconnectedCallback();
|
|
6564
7016
|
this.__unobserveTheme?.();
|
|
7017
|
+
this.__colorScheme?.removeEventListener('change', this.__applyTheme);
|
|
7018
|
+
this.__childObserver?.disconnect();
|
|
6565
7019
|
clearTimeout(this.__copiedTimer);
|
|
6566
7020
|
this.__lib?.forEach(lib => lib.dispose());
|
|
6567
7021
|
this.__lib = undefined;
|
|
@@ -6574,30 +7028,39 @@ let CodeEditor = class CodeEditor extends BaseInput {
|
|
|
6574
7028
|
this.initializeMonaco();
|
|
6575
7029
|
}
|
|
6576
7030
|
updated(changedProperties) {
|
|
6577
|
-
if (changedProperties.has('libSource') ||
|
|
7031
|
+
if (changedProperties.has('libSource') ||
|
|
7032
|
+
changedProperties.has('compilerOptions'))
|
|
6578
7033
|
this.libSourceChanged();
|
|
6579
7034
|
const editor = this.editorMonacoInstance;
|
|
6580
7035
|
if (!editor || !this.monaco)
|
|
6581
7036
|
return;
|
|
6582
|
-
if (changedProperties.has('disabled') ||
|
|
7037
|
+
if (changedProperties.has('disabled') ||
|
|
7038
|
+
changedProperties.has('readonly')) {
|
|
6583
7039
|
editor.updateOptions({ readOnly: this.disabled || this.readonly });
|
|
6584
7040
|
}
|
|
6585
7041
|
if (changedProperties.has('lineNumbers') ||
|
|
6586
7042
|
changedProperties.has('minimap') ||
|
|
6587
|
-
changedProperties.has('breakpointGutter')
|
|
7043
|
+
changedProperties.has('breakpointGutter') ||
|
|
7044
|
+
changedProperties.has('wrap') ||
|
|
7045
|
+
changedProperties.has('label')) {
|
|
6588
7046
|
editor.updateOptions({
|
|
6589
7047
|
lineNumbers: this.lineNumbers,
|
|
6590
7048
|
minimap: { enabled: this.minimap },
|
|
6591
7049
|
glyphMargin: this.breakpointGutter,
|
|
7050
|
+
wordWrap: this.wrap ? 'on' : 'off',
|
|
7051
|
+
ariaLabel: this.label || locale.editorLabel,
|
|
6592
7052
|
});
|
|
6593
7053
|
}
|
|
7054
|
+
// The header and size set the font and padding; read them back from the styles.
|
|
7055
|
+
this.__applyLayout();
|
|
6594
7056
|
if (changedProperties.has('language')) {
|
|
6595
7057
|
this.monaco.editor.setModelLanguage(editor.getModel(), this.language);
|
|
6596
7058
|
}
|
|
6597
7059
|
if (changedProperties.has('value') && editor.getValue() !== this.value) {
|
|
6598
7060
|
editor.setValue(this.value || '');
|
|
6599
7061
|
}
|
|
6600
|
-
if (changedProperties.has('breakpoints') ||
|
|
7062
|
+
if (changedProperties.has('breakpoints') ||
|
|
7063
|
+
changedProperties.has('currentLine')) {
|
|
6601
7064
|
this.drawDecorations();
|
|
6602
7065
|
}
|
|
6603
7066
|
if (changedProperties.has('currentLine') && this.currentLine) {
|
|
@@ -6613,19 +7076,39 @@ let CodeEditor = class CodeEditor extends BaseInput {
|
|
|
6613
7076
|
if (!this.isConnected || !this.editorElement)
|
|
6614
7077
|
return;
|
|
6615
7078
|
this.monaco = monaco;
|
|
7079
|
+
this.__applyTheme();
|
|
6616
7080
|
const model = monaco.editor.createModel(this.value, this.language, monaco.Uri.parse(`file:///wc-code-editor/${this.__id}/index.${EXTENSIONS[this.language] ?? 'txt'}`));
|
|
7081
|
+
const layout = this.__readLayout();
|
|
7082
|
+
this.__layoutKey = JSON.stringify(layout);
|
|
6617
7083
|
this.editorMonacoInstance = monaco.editor.create(this.editorElement, {
|
|
6618
7084
|
model,
|
|
7085
|
+
...layout,
|
|
6619
7086
|
lineNumbers: this.lineNumbers,
|
|
6620
7087
|
minimap: { enabled: this.minimap },
|
|
6621
7088
|
glyphMargin: this.breakpointGutter,
|
|
6622
|
-
|
|
7089
|
+
wordWrap: this.wrap ? 'on' : 'off',
|
|
7090
|
+
theme: THEME_NAME,
|
|
6623
7091
|
readOnly: this.disabled || this.readonly,
|
|
7092
|
+
ariaLabel: this.label || locale.editorLabel,
|
|
6624
7093
|
automaticLayout: true,
|
|
6625
7094
|
fixedOverflowWidgets: true,
|
|
6626
7095
|
scrollBeyondLastLine: false,
|
|
7096
|
+
lineNumbersMinChars: 3,
|
|
7097
|
+
lineDecorationsWidth: 8,
|
|
7098
|
+
renderLineHighlight: 'line',
|
|
7099
|
+
renderLineHighlightOnlyWhenFocus: true,
|
|
7100
|
+
overviewRulerBorder: false,
|
|
7101
|
+
hideCursorInOverviewRuler: true,
|
|
7102
|
+
stickyScroll: { enabled: false },
|
|
7103
|
+
scrollbar: {
|
|
7104
|
+
useShadows: false,
|
|
7105
|
+
verticalScrollbarSize: 10,
|
|
7106
|
+
horizontalScrollbarSize: 10,
|
|
7107
|
+
},
|
|
6627
7108
|
});
|
|
6628
7109
|
this.__decorations = this.editorMonacoInstance.createDecorationsCollection([]);
|
|
7110
|
+
// Monaco measures the font when it starts; measure again once web fonts have loaded.
|
|
7111
|
+
document.fonts?.ready.then(() => this.monaco?.editor.remeasureFonts());
|
|
6629
7112
|
this.libSourceChanged();
|
|
6630
7113
|
this.drawDecorations();
|
|
6631
7114
|
this.drawMarkers();
|
|
@@ -6641,7 +7124,8 @@ let CodeEditor = class CodeEditor extends BaseInput {
|
|
|
6641
7124
|
return;
|
|
6642
7125
|
const type = e.target?.type;
|
|
6643
7126
|
const { MouseTargetType } = monaco.editor;
|
|
6644
|
-
if (type !== MouseTargetType.GUTTER_GLYPH_MARGIN &&
|
|
7127
|
+
if (type !== MouseTargetType.GUTTER_GLYPH_MARGIN &&
|
|
7128
|
+
type !== MouseTargetType.GUTTER_LINE_NUMBERS)
|
|
6645
7129
|
return;
|
|
6646
7130
|
const line = e.target.position?.lineNumber;
|
|
6647
7131
|
if (!line)
|
|
@@ -6673,12 +7157,44 @@ let CodeEditor = class CodeEditor extends BaseInput {
|
|
|
6673
7157
|
editor.revealLineInCenterIfOutsideViewport(line);
|
|
6674
7158
|
editor.setPosition({ lineNumber: line, column: 1 });
|
|
6675
7159
|
}
|
|
6676
|
-
|
|
7160
|
+
/** The font and padding the styles give the code, for Monaco's options. */
|
|
7161
|
+
__readLayout() {
|
|
7162
|
+
const probe = this.probeElement;
|
|
7163
|
+
if (!probe)
|
|
7164
|
+
return {};
|
|
7165
|
+
const style = getComputedStyle(probe);
|
|
7166
|
+
const fontSize = parseFloat(style.fontSize) || 14;
|
|
7167
|
+
return {
|
|
7168
|
+
fontFamily: style.fontFamily,
|
|
7169
|
+
fontSize,
|
|
7170
|
+
lineHeight: parseFloat(style.lineHeight) || Math.round(fontSize * 1.43),
|
|
7171
|
+
padding: {
|
|
7172
|
+
top: parseFloat(style.paddingTop) || 0,
|
|
7173
|
+
bottom: parseFloat(style.paddingBottom) || 0,
|
|
7174
|
+
},
|
|
7175
|
+
};
|
|
7176
|
+
}
|
|
7177
|
+
/** Gives Monaco the font and padding when the header or size changed them. */
|
|
7178
|
+
__applyLayout() {
|
|
7179
|
+
const layout = this.__readLayout();
|
|
7180
|
+
const key = JSON.stringify(layout);
|
|
7181
|
+
if (key === this.__layoutKey)
|
|
7182
|
+
return;
|
|
7183
|
+
this.__layoutKey = key;
|
|
7184
|
+
this.editorMonacoInstance?.updateOptions(layout);
|
|
7185
|
+
}
|
|
7186
|
+
/** Whether light-DOM children are assigned to the named slot. */
|
|
7187
|
+
__hasSlotted(name) {
|
|
7188
|
+
return Array.from(this.children).some(child => child.getAttribute('slot') === name);
|
|
7189
|
+
}
|
|
6677
7190
|
libSourceChanged() {
|
|
6678
7191
|
const typescript = this.monaco?.typescript;
|
|
6679
7192
|
if (!typescript)
|
|
6680
7193
|
return;
|
|
6681
|
-
const defaults = [
|
|
7194
|
+
const defaults = [
|
|
7195
|
+
typescript.typescriptDefaults,
|
|
7196
|
+
typescript.javascriptDefaults,
|
|
7197
|
+
];
|
|
6682
7198
|
for (const found of defaults) {
|
|
6683
7199
|
found.setCompilerOptions({
|
|
6684
7200
|
target: typescript.ScriptTarget.ESNext,
|
|
@@ -6696,7 +7212,7 @@ let CodeEditor = class CodeEditor extends BaseInput {
|
|
|
6696
7212
|
: undefined;
|
|
6697
7213
|
}
|
|
6698
7214
|
drawDecorations() {
|
|
6699
|
-
const monaco = this
|
|
7215
|
+
const { monaco } = this;
|
|
6700
7216
|
if (!monaco || !this.__decorations)
|
|
6701
7217
|
return;
|
|
6702
7218
|
const range = (line) => new monaco.Range(line, 1, line, 1);
|
|
@@ -6722,7 +7238,7 @@ let CodeEditor = class CodeEditor extends BaseInput {
|
|
|
6722
7238
|
this.__decorations.set(decorations);
|
|
6723
7239
|
}
|
|
6724
7240
|
drawMarkers() {
|
|
6725
|
-
const monaco = this
|
|
7241
|
+
const { monaco } = this;
|
|
6726
7242
|
const model = this.editorMonacoInstance?.getModel();
|
|
6727
7243
|
if (!monaco || !model)
|
|
6728
7244
|
return;
|
|
@@ -6737,15 +7253,13 @@ let CodeEditor = class CodeEditor extends BaseInput {
|
|
|
6737
7253
|
startLineNumber: marker.line,
|
|
6738
7254
|
startColumn: marker.column ?? 1,
|
|
6739
7255
|
endLineNumber: endLine,
|
|
6740
|
-
endColumn: marker.endColumn ??
|
|
7256
|
+
endColumn: marker.endColumn ??
|
|
7257
|
+
model.getLineMaxColumn(Math.min(endLine, model.getLineCount())),
|
|
6741
7258
|
message: marker.message,
|
|
6742
7259
|
severity: severity[marker.severity ?? 'error'],
|
|
6743
7260
|
};
|
|
6744
7261
|
}));
|
|
6745
7262
|
}
|
|
6746
|
-
getTheme() {
|
|
6747
|
-
return this._isDarkMode ? 'vs-dark' : 'vs';
|
|
6748
|
-
}
|
|
6749
7263
|
async __handleCopyClick() {
|
|
6750
7264
|
const value = this.editorMonacoInstance?.getValue() ?? this.value ?? '';
|
|
6751
7265
|
await copyToClipboard(value);
|
|
@@ -6753,77 +7267,124 @@ let CodeEditor = class CodeEditor extends BaseInput {
|
|
|
6753
7267
|
clearTimeout(this.__copiedTimer);
|
|
6754
7268
|
this.__copiedTimer = setTimeout(() => {
|
|
6755
7269
|
this._copied = false;
|
|
6756
|
-
},
|
|
7270
|
+
}, COPY_FEEDBACK_DURATION);
|
|
6757
7271
|
this.dispatchEvent(new CustomEvent('copied', {
|
|
6758
7272
|
detail: { value },
|
|
6759
7273
|
bubbles: true,
|
|
6760
7274
|
composed: true,
|
|
6761
7275
|
}));
|
|
6762
7276
|
}
|
|
7277
|
+
__handleWrapClick() {
|
|
7278
|
+
this.wrap = !this.wrap;
|
|
7279
|
+
}
|
|
6763
7280
|
// ── Render helpers
|
|
6764
|
-
|
|
6765
|
-
|
|
6766
|
-
|
|
6767
|
-
|
|
7281
|
+
renderBadge() {
|
|
7282
|
+
return b `<span class="read-only-badge">
|
|
7283
|
+
<wc-icon name="lock"></wc-icon>${locale.readOnly}
|
|
7284
|
+
</span>`;
|
|
7285
|
+
}
|
|
7286
|
+
renderActions(floating, showBadge) {
|
|
6768
7287
|
return b `
|
|
6769
|
-
<div
|
|
6770
|
-
${
|
|
6771
|
-
|
|
7288
|
+
<div
|
|
7289
|
+
class=${e$1({
|
|
7290
|
+
actions: true,
|
|
7291
|
+
floating,
|
|
7292
|
+
pinned: floating && showBadge,
|
|
7293
|
+
})}
|
|
7294
|
+
part="actions"
|
|
7295
|
+
>
|
|
7296
|
+
${showBadge ? this.renderBadge() : A}
|
|
7297
|
+
<slot name="actions"></slot>
|
|
7298
|
+
${this.wrapToggle
|
|
7299
|
+
? b `<wc-icon-button
|
|
7300
|
+
class="wrap-button"
|
|
7301
|
+
variant="text"
|
|
7302
|
+
size="xs"
|
|
7303
|
+
shape="round"
|
|
7304
|
+
color="surface"
|
|
7305
|
+
toggle
|
|
7306
|
+
?selected=${this.wrap}
|
|
7307
|
+
aria-label=${this.wrap ? locale.unwrapLines : locale.wrapLines}
|
|
7308
|
+
tooltip=${this.wrap ? locale.unwrapLines : locale.wrapLines}
|
|
7309
|
+
@click=${this.__handleWrapClick}
|
|
7310
|
+
>
|
|
7311
|
+
<wc-icon name="wrap_text"></wc-icon>
|
|
7312
|
+
</wc-icon-button>`
|
|
6772
7313
|
: A}
|
|
6773
7314
|
${this.hideCopy
|
|
6774
7315
|
? A
|
|
6775
7316
|
: b `<wc-icon-button
|
|
6776
7317
|
class="copy-button"
|
|
6777
|
-
color=${this._copied ? 'success' : 'surface'}
|
|
6778
7318
|
variant="text"
|
|
6779
7319
|
size="xs"
|
|
6780
|
-
|
|
7320
|
+
shape="round"
|
|
7321
|
+
color=${this._copied ? 'success' : 'surface'}
|
|
7322
|
+
aria-label=${this._copied
|
|
7323
|
+
? locale.copied
|
|
7324
|
+
: locale.copyToClipboard}
|
|
6781
7325
|
tooltip=${this._copied ? locale.copied : locale.copyToClipboard}
|
|
6782
7326
|
@click=${this.__handleCopyClick}
|
|
6783
7327
|
>
|
|
6784
|
-
<wc-icon
|
|
7328
|
+
<wc-icon
|
|
7329
|
+
name=${this._copied ? 'check' : 'content_copy'}
|
|
7330
|
+
></wc-icon>
|
|
6785
7331
|
</wc-icon-button>`}
|
|
6786
7332
|
</div>
|
|
6787
7333
|
`;
|
|
6788
7334
|
}
|
|
7335
|
+
renderHeader(showBadge) {
|
|
7336
|
+
return b `
|
|
7337
|
+
<div class="header" part="header">
|
|
7338
|
+
<slot name="icon"></slot>
|
|
7339
|
+
<div class="title" part="title">
|
|
7340
|
+
<slot name="title">${this.label}</slot>
|
|
7341
|
+
</div>
|
|
7342
|
+
${this.renderActions(false, showBadge)}
|
|
7343
|
+
</div>
|
|
7344
|
+
`;
|
|
7345
|
+
}
|
|
6789
7346
|
// ── Render
|
|
6790
7347
|
render() {
|
|
6791
|
-
|
|
6792
|
-
|
|
6793
|
-
|
|
6794
|
-
|
|
6795
|
-
|
|
6796
|
-
|
|
6797
|
-
|
|
6798
|
-
|
|
6799
|
-
: A}
|
|
6800
|
-
</div>
|
|
6801
|
-
`;
|
|
6802
|
-
}
|
|
6803
|
-
// The field isn't marked read-only: its read-only look dims the
|
|
6804
|
-
// container, and a read-only editor is still meant to be read.
|
|
7348
|
+
const hasHeader = !!this.label || this.__hasSlotted('title');
|
|
7349
|
+
const showBadge = this.showReadonlyBadge && (this.disabled || this.readonly);
|
|
7350
|
+
const hasActions = !this.hideCopy ||
|
|
7351
|
+
this.wrapToggle ||
|
|
7352
|
+
showBadge ||
|
|
7353
|
+
this.__hasSlotted('actions');
|
|
7354
|
+
const loaded = !!this.editorMonacoInstance;
|
|
7355
|
+
// A read-only editor keeps full contrast: it is still meant to be read.
|
|
6805
7356
|
return b `
|
|
6806
|
-
<
|
|
6807
|
-
|
|
6808
|
-
|
|
6809
|
-
|
|
6810
|
-
|
|
6811
|
-
.host=${this}
|
|
6812
|
-
class="${e$1({
|
|
6813
|
-
'code-editor-component': true,
|
|
7357
|
+
<div
|
|
7358
|
+
class=${e$1({
|
|
7359
|
+
'code-block': true,
|
|
7360
|
+
'has-header': hasHeader,
|
|
7361
|
+
focused: this.hasFocus,
|
|
6814
7362
|
disabled: this.disabled,
|
|
6815
|
-
|
|
7363
|
+
numbered: this.lineNumbers !== 'off',
|
|
7364
|
+
'breakpoint-gutter': this.breakpointGutter,
|
|
7365
|
+
})}
|
|
7366
|
+
part="container"
|
|
6816
7367
|
>
|
|
6817
|
-
${this.
|
|
6818
|
-
|
|
6819
|
-
|
|
6820
|
-
|
|
6821
|
-
|
|
6822
|
-
|
|
6823
|
-
|
|
6824
|
-
|
|
7368
|
+
${hasHeader ? this.renderHeader(showBadge) : A}
|
|
7369
|
+
${!hasHeader && hasActions
|
|
7370
|
+
? this.renderActions(true, showBadge)
|
|
7371
|
+
: A}
|
|
7372
|
+
<div class="editor-area">
|
|
7373
|
+
<div class="editor" part="editor"></div>
|
|
7374
|
+
${loaded
|
|
7375
|
+
? A
|
|
7376
|
+
: b `<pre class="placeholder" aria-hidden="true">
|
|
7377
|
+
${this.value}</pre
|
|
7378
|
+
>`}
|
|
7379
|
+
${this.skeleton
|
|
7380
|
+
? b `<wc-skeleton class="skeleton" visible></wc-skeleton>`
|
|
6825
7381
|
: A}
|
|
6826
|
-
|
|
7382
|
+
</div>
|
|
7383
|
+
<span class="probe" aria-hidden="true"></span>
|
|
7384
|
+
<span class="sr-only" aria-live="polite"
|
|
7385
|
+
>${this._copied ? locale.copiedCode : ''}</span
|
|
7386
|
+
>
|
|
7387
|
+
</div>
|
|
6827
7388
|
`;
|
|
6828
7389
|
}
|
|
6829
7390
|
};
|
|
@@ -6834,6 +7395,9 @@ __decorate([
|
|
|
6834
7395
|
__decorate([
|
|
6835
7396
|
n({ type: String })
|
|
6836
7397
|
], CodeEditor.prototype, "language", void 0);
|
|
7398
|
+
__decorate([
|
|
7399
|
+
n({ type: String })
|
|
7400
|
+
], CodeEditor.prototype, "label", void 0);
|
|
6837
7401
|
__decorate([
|
|
6838
7402
|
n({ type: String, attribute: 'lib-source' })
|
|
6839
7403
|
], CodeEditor.prototype, "libSource", void 0);
|
|
@@ -6841,11 +7405,20 @@ __decorate([
|
|
|
6841
7405
|
n({ type: Object, attribute: false })
|
|
6842
7406
|
], CodeEditor.prototype, "compilerOptions", void 0);
|
|
6843
7407
|
__decorate([
|
|
6844
|
-
n({ type: String })
|
|
7408
|
+
n({ type: String, attribute: 'line-numbers' })
|
|
6845
7409
|
], CodeEditor.prototype, "lineNumbers", void 0);
|
|
7410
|
+
__decorate([
|
|
7411
|
+
n({ type: Boolean, reflect: true })
|
|
7412
|
+
], CodeEditor.prototype, "wrap", void 0);
|
|
7413
|
+
__decorate([
|
|
7414
|
+
n({ type: Boolean, attribute: 'wrap-toggle' })
|
|
7415
|
+
], CodeEditor.prototype, "wrapToggle", void 0);
|
|
6846
7416
|
__decorate([
|
|
6847
7417
|
n({ type: Boolean })
|
|
6848
7418
|
], CodeEditor.prototype, "minimap", void 0);
|
|
7419
|
+
__decorate([
|
|
7420
|
+
n({ type: String, reflect: true })
|
|
7421
|
+
], CodeEditor.prototype, "size", void 0);
|
|
6849
7422
|
__decorate([
|
|
6850
7423
|
n({ type: Boolean, attribute: 'hide-copy' })
|
|
6851
7424
|
], CodeEditor.prototype, "hideCopy", void 0);
|
|
@@ -6867,9 +7440,6 @@ __decorate([
|
|
|
6867
7440
|
__decorate([
|
|
6868
7441
|
n({ type: Boolean, reflect: true })
|
|
6869
7442
|
], CodeEditor.prototype, "fill", void 0);
|
|
6870
|
-
__decorate([
|
|
6871
|
-
r()
|
|
6872
|
-
], CodeEditor.prototype, "_isDarkMode", void 0);
|
|
6873
7443
|
__decorate([
|
|
6874
7444
|
r()
|
|
6875
7445
|
], CodeEditor.prototype, "hasFocus", void 0);
|
|
@@ -6882,6 +7452,9 @@ __decorate([
|
|
|
6882
7452
|
__decorate([
|
|
6883
7453
|
e('.editor')
|
|
6884
7454
|
], CodeEditor.prototype, "editorElement", void 0);
|
|
7455
|
+
__decorate([
|
|
7456
|
+
e('.probe')
|
|
7457
|
+
], CodeEditor.prototype, "probeElement", void 0);
|
|
6885
7458
|
CodeEditor = __decorate([
|
|
6886
7459
|
IndividualComponent
|
|
6887
7460
|
], CodeEditor);
|