@francofantomius/material-components 0.1.0 → 1.0.1
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/CHANGELOG.md +80 -0
- package/README.md +550 -90
- package/custom-elements.json +21010 -2354
- package/dist/chunks/badge-G4EjcMoy.js +89 -0
- package/dist/chunks/badge-G4EjcMoy.js.map +1 -0
- package/dist/chunks/button-B4TSZ7Sl.js +250 -0
- package/dist/chunks/button-B4TSZ7Sl.js.map +1 -0
- package/dist/chunks/card-DVffdPpv.js +163 -0
- package/dist/chunks/card-DVffdPpv.js.map +1 -0
- package/dist/chunks/checkbox-BqlboAHd.js +194 -0
- package/dist/chunks/checkbox-BqlboAHd.js.map +1 -0
- package/dist/chunks/chip-CI1ZINnr.js +169 -0
- package/dist/chunks/chip-CI1ZINnr.js.map +1 -0
- package/dist/chunks/code-C5UFBkCh.js +1830 -0
- package/dist/chunks/code-C5UFBkCh.js.map +1 -0
- package/dist/chunks/decorate-DXuynaiA.js +39 -0
- package/dist/chunks/decorate-DXuynaiA.js.map +1 -0
- package/dist/chunks/dialog-DGVEE5m_.js +158 -0
- package/dist/chunks/dialog-DGVEE5m_.js.map +1 -0
- package/dist/chunks/divider-DNepwoZv.js +82 -0
- package/dist/chunks/divider-DNepwoZv.js.map +1 -0
- package/dist/chunks/fab-C9j3WBHE.js +150 -0
- package/dist/chunks/fab-C9j3WBHE.js.map +1 -0
- package/dist/chunks/focus-ring-CuiJuM-y.js +71 -0
- package/dist/chunks/focus-ring-CuiJuM-y.js.map +1 -0
- package/dist/chunks/{form-associated-fKbeX_2P.js → form-associated-Cty_ZaS9.js} +26 -27
- package/dist/chunks/form-associated-Cty_ZaS9.js.map +1 -0
- package/dist/chunks/icon-DrNqcNEL.js +62 -0
- package/dist/chunks/icon-DrNqcNEL.js.map +1 -0
- package/dist/chunks/icon-button-BdSc7eot.js +188 -0
- package/dist/chunks/icon-button-BdSc7eot.js.map +1 -0
- package/dist/chunks/list-D8olR7oZ.js +204 -0
- package/dist/chunks/list-D8olR7oZ.js.map +1 -0
- package/dist/chunks/navigation-drawer-CKl44Ef5.js +531 -0
- package/dist/chunks/navigation-drawer-CKl44Ef5.js.map +1 -0
- package/dist/chunks/player-C4ydiIpr.js +1582 -0
- package/dist/chunks/player-C4ydiIpr.js.map +1 -0
- package/dist/chunks/progress-LQmLMDjX.js +266 -0
- package/dist/chunks/progress-LQmLMDjX.js.map +1 -0
- package/dist/chunks/radio-Bily78NT.js +205 -0
- package/dist/chunks/radio-Bily78NT.js.map +1 -0
- package/dist/chunks/ripple-squbKHhj.js +135 -0
- package/dist/chunks/ripple-squbKHhj.js.map +1 -0
- package/dist/chunks/search-bar-TXnqJ-gd.js +698 -0
- package/dist/chunks/search-bar-TXnqJ-gd.js.map +1 -0
- package/dist/chunks/snackbar-Wsz3BzEY.js +161 -0
- package/dist/chunks/snackbar-Wsz3BzEY.js.map +1 -0
- package/dist/chunks/switch-DdukrvXb.js +190 -0
- package/dist/chunks/switch-DdukrvXb.js.map +1 -0
- package/dist/chunks/table-aRTYzDyE.js +773 -0
- package/dist/chunks/table-aRTYzDyE.js.map +1 -0
- package/dist/chunks/tabs-BfOtoeir.js +191 -0
- package/dist/chunks/tabs-BfOtoeir.js.map +1 -0
- package/dist/chunks/text-field-hN6-2HQy.js +338 -0
- package/dist/chunks/text-field-hN6-2HQy.js.map +1 -0
- package/dist/chunks/top-app-bar-Dgbp6CFv.js +228 -0
- package/dist/chunks/top-app-bar-Dgbp6CFv.js.map +1 -0
- package/dist/components/account-menu/account-menu.css.d.ts +3 -0
- package/dist/components/account-menu/account-menu.css.d.ts.map +1 -0
- package/dist/components/account-menu/account-menu.d.ts +111 -0
- package/dist/components/account-menu/account-menu.d.ts.map +1 -0
- package/dist/components/app-drawer/app-drawer.css.d.ts +3 -0
- package/dist/components/app-drawer/app-drawer.css.d.ts.map +1 -0
- package/dist/components/app-drawer/app-drawer.d.ts +173 -0
- package/dist/components/app-drawer/app-drawer.d.ts.map +1 -0
- package/dist/components/badge/badge.js +2 -91
- package/dist/components/button/button.js +2 -261
- package/dist/components/card/card.js +2 -167
- package/dist/components/checkbox/checkbox.css.d.ts.map +1 -1
- package/dist/components/checkbox/checkbox.js +2 -186
- package/dist/components/chip/chip.js +3 -172
- package/dist/components/code/code.css.d.ts +2 -0
- package/dist/components/code/code.css.d.ts.map +1 -0
- package/dist/components/code/code.d.ts +106 -0
- package/dist/components/code/code.d.ts.map +1 -0
- package/dist/components/code/code.js +5 -0
- package/dist/components/code/highlighter.d.ts +8 -0
- package/dist/components/code/highlighter.d.ts.map +1 -0
- package/dist/components/code/linter.d.ts +44 -0
- package/dist/components/code/linter.d.ts.map +1 -0
- package/dist/components/dialog/dialog.js +2 -165
- package/dist/components/divider/divider.js +2 -79
- package/dist/components/fab/fab.js +2 -153
- package/dist/components/icon/icon.js +2 -68
- package/dist/components/icon-button/icon-button.css.d.ts.map +1 -1
- package/dist/components/icon-button/icon-button.js +1 -189
- package/dist/components/list/list.css.d.ts.map +1 -1
- package/dist/components/list/list.d.ts.map +1 -1
- package/dist/components/list/list.js +3 -188
- package/dist/components/navigation-drawer/navigation-drawer.css.d.ts +3 -0
- package/dist/components/navigation-drawer/navigation-drawer.css.d.ts.map +1 -0
- package/dist/components/navigation-drawer/navigation-drawer.d.ts +76 -0
- package/dist/components/navigation-drawer/navigation-drawer.d.ts.map +1 -0
- package/dist/components/navigation-drawer/navigation-drawer.js +8 -0
- package/dist/components/player/player.css.d.ts +2 -0
- package/dist/components/player/player.css.d.ts.map +1 -0
- package/dist/components/player/player.d.ts +99 -0
- package/dist/components/player/player.d.ts.map +1 -0
- package/dist/components/player/player.js +7 -0
- package/dist/components/progress/progress.css.d.ts.map +1 -1
- package/dist/components/progress/progress.d.ts +2 -0
- package/dist/components/progress/progress.d.ts.map +1 -1
- package/dist/components/progress/progress.js +3 -181
- package/dist/components/radio/radio.css.d.ts.map +1 -1
- package/dist/components/radio/radio.js +3 -203
- package/dist/components/search-bar/search-bar.css.d.ts +2 -0
- package/dist/components/search-bar/search-bar.css.d.ts.map +1 -0
- package/dist/components/search-bar/search-bar.d.ts +81 -0
- package/dist/components/search-bar/search-bar.d.ts.map +1 -0
- package/dist/components/search-bar/search-bar.js +5 -0
- package/dist/components/snackbar/snackbar.js +2 -162
- package/dist/components/switch/switch.css.d.ts.map +1 -1
- package/dist/components/switch/switch.js +2 -169
- package/dist/components/table/table.css.d.ts +8 -0
- package/dist/components/table/table.css.d.ts.map +1 -0
- package/dist/components/table/table.d.ts +158 -0
- package/dist/components/table/table.d.ts.map +1 -0
- package/dist/components/table/table.js +13 -0
- package/dist/components/tabs/tabs.js +3 -198
- package/dist/components/text-field/text-field.css.d.ts.map +1 -1
- package/dist/components/text-field/text-field.d.ts +1 -1
- package/dist/components/text-field/text-field.d.ts.map +1 -1
- package/dist/components/text-field/text-field.js +2 -325
- package/dist/components/top-app-bar/top-app-bar.css.d.ts +2 -0
- package/dist/components/top-app-bar/top-app-bar.css.d.ts.map +1 -0
- package/dist/components/top-app-bar/top-app-bar.d.ts +29 -0
- package/dist/components/top-app-bar/top-app-bar.d.ts.map +1 -0
- package/dist/components/top-app-bar/top-app-bar.js +5 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2264 -58
- package/dist/index.js.map +1 -1
- package/dist/internal/focus-ring/focus-ring.d.ts.map +1 -1
- package/dist/internal/focus-ring/focus-ring.js +4 -0
- package/dist/internal/ripple/ripple.css.d.ts.map +1 -1
- package/dist/internal/ripple/ripple.d.ts +0 -3
- package/dist/internal/ripple/ripple.d.ts.map +1 -1
- package/dist/internal/ripple/ripple.js +2 -142
- package/dist/tokens/index.js +336 -11
- package/dist/tokens/index.js.map +1 -1
- package/package.json +118 -12
- package/dist/chunks/base-component-DQTjlEVL.js +0 -34
- package/dist/chunks/base-component-DQTjlEVL.js.map +0 -1
- package/dist/chunks/focus-ring-Dl-XoEKK.js +0 -71
- package/dist/chunks/focus-ring-Dl-XoEKK.js.map +0 -1
- package/dist/chunks/form-associated-fKbeX_2P.js.map +0 -1
- package/dist/chunks/theme.css-DV3DRha-.js +0 -263
- package/dist/chunks/theme.css-DV3DRha-.js.map +0 -1
- package/dist/components/badge/badge.js.map +0 -1
- package/dist/components/button/button.js.map +0 -1
- package/dist/components/card/card.js.map +0 -1
- package/dist/components/checkbox/checkbox.js.map +0 -1
- package/dist/components/chip/chip.js.map +0 -1
- package/dist/components/dialog/dialog.js.map +0 -1
- package/dist/components/divider/divider.js.map +0 -1
- package/dist/components/fab/fab.js.map +0 -1
- package/dist/components/icon/icon.js.map +0 -1
- package/dist/components/icon-button/icon-button.js.map +0 -1
- package/dist/components/list/list.js.map +0 -1
- package/dist/components/progress/progress.js.map +0 -1
- package/dist/components/radio/radio.js.map +0 -1
- package/dist/components/snackbar/snackbar.js.map +0 -1
- package/dist/components/switch/switch.js.map +0 -1
- package/dist/components/tabs/tabs.js.map +0 -1
- package/dist/components/text-field/text-field.js.map +0 -1
- package/dist/internal/ripple/ripple.js.map +0 -1
|
@@ -0,0 +1,1830 @@
|
|
|
1
|
+
import { n as E, t as v } from "./decorate-DXuynaiA.js";
|
|
2
|
+
import "./icon-DrNqcNEL.js";
|
|
3
|
+
import { css as T, html as x, nothing as C } from "lit";
|
|
4
|
+
import { customElement as N, property as k, state as L } from "lit/decorators.js";
|
|
5
|
+
import { unsafeHTML as O } from "lit/directives/unsafe-html.js";
|
|
6
|
+
var M = T`
|
|
7
|
+
:host {
|
|
8
|
+
display: block;
|
|
9
|
+
box-sizing: border-box;
|
|
10
|
+
font-family: 'Fira Code', 'Roboto Mono', Consolas, Monaco, 'Courier New', monospace;
|
|
11
|
+
--md-code-bg: var(--md-sys-color-surface-container, #f3edf7);
|
|
12
|
+
--md-code-header-bg: var(--md-sys-color-surface-container-high, #ece6f0);
|
|
13
|
+
--md-code-border: var(--md-sys-color-outline-variant, #cac4d0);
|
|
14
|
+
--md-code-color: var(--md-sys-color-on-surface, #1d1b20);
|
|
15
|
+
--md-code-gutter-color: var(--md-sys-color-outline, #79747e);
|
|
16
|
+
--md-code-gutter-bg: transparent;
|
|
17
|
+
--md-code-radius: var(--md-sys-shape-corner-medium, 12px);
|
|
18
|
+
--md-code-font-size: 13.5px;
|
|
19
|
+
--md-code-line-height: 1.6;
|
|
20
|
+
margin: 1rem 0;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.code-container {
|
|
24
|
+
position: relative;
|
|
25
|
+
display: flex;
|
|
26
|
+
flex-direction: column;
|
|
27
|
+
background-color: var(--md-code-bg);
|
|
28
|
+
border: 1px solid var(--md-code-border);
|
|
29
|
+
border-radius: var(--md-code-radius);
|
|
30
|
+
overflow: hidden;
|
|
31
|
+
color: var(--md-code-color);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/* Header Bar */
|
|
35
|
+
.code-header {
|
|
36
|
+
display: flex;
|
|
37
|
+
align-items: center;
|
|
38
|
+
justify-content: space-between;
|
|
39
|
+
padding: 6px 12px;
|
|
40
|
+
background-color: var(--md-code-header-bg);
|
|
41
|
+
border-bottom: 1px solid var(--md-code-border);
|
|
42
|
+
min-height: 40px;
|
|
43
|
+
font-size: 12.5px;
|
|
44
|
+
font-weight: 500;
|
|
45
|
+
user-select: none;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.code-header-left {
|
|
49
|
+
display: flex;
|
|
50
|
+
align-items: center;
|
|
51
|
+
gap: 8px;
|
|
52
|
+
overflow: hidden;
|
|
53
|
+
text-overflow: ellipsis;
|
|
54
|
+
white-space: nowrap;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.lang-badge {
|
|
58
|
+
display: inline-flex;
|
|
59
|
+
align-items: center;
|
|
60
|
+
padding: 2px 8px;
|
|
61
|
+
background-color: var(--md-sys-color-secondary-container, #e8def8);
|
|
62
|
+
color: var(--md-sys-color-on-secondary-container, #1d192b);
|
|
63
|
+
border-radius: var(--md-sys-shape-corner-full, 9999px);
|
|
64
|
+
font-size: 11px;
|
|
65
|
+
font-weight: 600;
|
|
66
|
+
text-transform: uppercase;
|
|
67
|
+
letter-spacing: 0.5px;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.code-filename {
|
|
71
|
+
font-weight: 500;
|
|
72
|
+
color: var(--md-sys-color-on-surface, #1d1b20);
|
|
73
|
+
overflow: hidden;
|
|
74
|
+
text-overflow: ellipsis;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.code-header-actions {
|
|
78
|
+
display: flex;
|
|
79
|
+
align-items: center;
|
|
80
|
+
gap: 4px;
|
|
81
|
+
margin-left: auto;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/* Floating Copy Button (when header is hidden) */
|
|
85
|
+
.floating-copy-btn {
|
|
86
|
+
position: absolute;
|
|
87
|
+
top: 8px;
|
|
88
|
+
right: 8px;
|
|
89
|
+
z-index: 5;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/* Copy Button inside header or floating */
|
|
93
|
+
.action-btn {
|
|
94
|
+
display: inline-flex;
|
|
95
|
+
align-items: center;
|
|
96
|
+
justify-content: center;
|
|
97
|
+
gap: 6px;
|
|
98
|
+
height: 28px;
|
|
99
|
+
padding: 0 10px;
|
|
100
|
+
border: none;
|
|
101
|
+
border-radius: var(--md-sys-shape-corner-small, 8px);
|
|
102
|
+
background-color: transparent;
|
|
103
|
+
color: var(--md-sys-color-on-surface-variant, #49454f);
|
|
104
|
+
font-family: var(--md-sys-typescale-font-family, 'Roboto', sans-serif);
|
|
105
|
+
font-size: 12px;
|
|
106
|
+
font-weight: 500;
|
|
107
|
+
cursor: pointer;
|
|
108
|
+
transition: background-color 150ms ease, color 150ms ease;
|
|
109
|
+
outline: none;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.action-btn:hover {
|
|
113
|
+
background-color: var(--md-sys-color-surface-container-highest, #e6e0e9);
|
|
114
|
+
color: var(--md-sys-color-on-surface, #1d1b20);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.action-btn:active {
|
|
118
|
+
background-color: var(--md-sys-color-secondary-container, #e8def8);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.action-btn.copied {
|
|
122
|
+
color: var(--md-sys-color-primary, #6750a4);
|
|
123
|
+
background-color: var(--md-sys-color-primary-container, #eaddff);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.action-btn md-icon {
|
|
127
|
+
--md-icon-size: 16px;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/* Code Viewport & Scroll Area */
|
|
131
|
+
.code-body {
|
|
132
|
+
position: relative;
|
|
133
|
+
display: flex;
|
|
134
|
+
overflow-x: auto;
|
|
135
|
+
overflow-y: auto;
|
|
136
|
+
font-size: var(--md-code-font-size);
|
|
137
|
+
line-height: var(--md-code-line-height);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
pre {
|
|
141
|
+
margin: 0;
|
|
142
|
+
padding: 12px 16px;
|
|
143
|
+
font-family: inherit;
|
|
144
|
+
font-size: inherit;
|
|
145
|
+
line-height: inherit;
|
|
146
|
+
tab-size: 2;
|
|
147
|
+
flex-grow: 1;
|
|
148
|
+
overflow: visible;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
code {
|
|
152
|
+
font-family: inherit;
|
|
153
|
+
font-size: inherit;
|
|
154
|
+
line-height: inherit;
|
|
155
|
+
display: block;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
:host([wrap-lines]) pre {
|
|
159
|
+
white-space: pre-wrap;
|
|
160
|
+
word-break: break-word;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
:host(:not([wrap-lines])) pre {
|
|
164
|
+
white-space: pre;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/* Line Structure */
|
|
168
|
+
.code-line {
|
|
169
|
+
display: block;
|
|
170
|
+
padding: 0 4px;
|
|
171
|
+
border-radius: 2px;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
.code-line.highlighted {
|
|
175
|
+
background-color: rgba(103, 80, 164, 0.12);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
.code-line.has-error {
|
|
179
|
+
background-color: rgba(179, 38, 30, 0.14);
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
.code-line.has-warning {
|
|
183
|
+
background-color: rgba(230, 81, 0, 0.12);
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/* Gutter & Line Numbers */
|
|
187
|
+
.code-gutter {
|
|
188
|
+
display: flex;
|
|
189
|
+
flex-direction: column;
|
|
190
|
+
padding: 12px 0 12px 10px;
|
|
191
|
+
user-select: none;
|
|
192
|
+
background-color: var(--md-code-gutter-bg);
|
|
193
|
+
border-right: 1px solid var(--md-code-border);
|
|
194
|
+
flex-shrink: 0;
|
|
195
|
+
min-width: 44px;
|
|
196
|
+
box-sizing: border-box;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
.gutter-line {
|
|
200
|
+
display: flex;
|
|
201
|
+
align-items: center;
|
|
202
|
+
justify-content: flex-end;
|
|
203
|
+
gap: 4px;
|
|
204
|
+
height: calc(var(--md-code-font-size) * var(--md-code-line-height));
|
|
205
|
+
padding-right: 8px;
|
|
206
|
+
color: var(--md-code-gutter-color);
|
|
207
|
+
font-size: 11.5px;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
.gutter-marker {
|
|
211
|
+
display: inline-flex;
|
|
212
|
+
align-items: center;
|
|
213
|
+
justify-content: center;
|
|
214
|
+
width: 14px;
|
|
215
|
+
height: 14px;
|
|
216
|
+
cursor: pointer;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
.gutter-marker.error {
|
|
220
|
+
color: var(--md-sys-color-error, #b3261e);
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
.gutter-marker.warning {
|
|
224
|
+
color: #e65100;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
.gutter-marker.info {
|
|
228
|
+
color: var(--md-sys-color-primary, #6750a4);
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
.gutter-marker md-icon {
|
|
232
|
+
--md-icon-size: 14px;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
/* Lint Status Footer Bar */
|
|
236
|
+
.lint-footer {
|
|
237
|
+
display: flex;
|
|
238
|
+
flex-direction: column;
|
|
239
|
+
background-color: var(--md-code-header-bg);
|
|
240
|
+
border-top: 1px solid var(--md-code-border);
|
|
241
|
+
font-size: 12px;
|
|
242
|
+
font-family: var(--md-sys-typescale-font-family, 'Roboto', sans-serif);
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
.lint-footer-summary {
|
|
246
|
+
display: flex;
|
|
247
|
+
align-items: center;
|
|
248
|
+
justify-content: space-between;
|
|
249
|
+
padding: 6px 12px;
|
|
250
|
+
cursor: pointer;
|
|
251
|
+
user-select: none;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
.lint-footer-summary:hover {
|
|
255
|
+
background-color: var(--md-sys-color-surface-container-highest, #e6e0e9);
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
.lint-counts {
|
|
259
|
+
display: flex;
|
|
260
|
+
align-items: center;
|
|
261
|
+
gap: 12px;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
.lint-count-item {
|
|
265
|
+
display: inline-flex;
|
|
266
|
+
align-items: center;
|
|
267
|
+
gap: 4px;
|
|
268
|
+
font-weight: 500;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
.lint-count-item.errors {
|
|
272
|
+
color: var(--md-sys-color-error, #b3261e);
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
.lint-count-item.warnings {
|
|
276
|
+
color: #e65100;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
.lint-count-item.valid {
|
|
280
|
+
color: #2e7d32;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
.lint-count-item md-icon {
|
|
284
|
+
--md-icon-size: 15px;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
.lint-issues-list {
|
|
288
|
+
display: flex;
|
|
289
|
+
flex-direction: column;
|
|
290
|
+
max-height: 160px;
|
|
291
|
+
overflow-y: auto;
|
|
292
|
+
border-top: 1px solid var(--md-code-border);
|
|
293
|
+
background-color: var(--md-code-bg);
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
.lint-issue-item {
|
|
297
|
+
display: flex;
|
|
298
|
+
align-items: flex-start;
|
|
299
|
+
gap: 8px;
|
|
300
|
+
padding: 6px 12px;
|
|
301
|
+
border-bottom: 1px solid var(--md-code-border);
|
|
302
|
+
cursor: pointer;
|
|
303
|
+
transition: background-color 100ms ease;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
.lint-issue-item:last-child {
|
|
307
|
+
border-bottom: none;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
.lint-issue-item:hover {
|
|
311
|
+
background-color: var(--md-sys-color-surface-container-highest, #e6e0e9);
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
.lint-issue-item.error md-icon {
|
|
315
|
+
color: var(--md-sys-color-error, #b3261e);
|
|
316
|
+
--md-icon-size: 16px;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
.lint-issue-item.warning md-icon {
|
|
320
|
+
color: #e65100;
|
|
321
|
+
--md-icon-size: 16px;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
.lint-issue-item.info md-icon {
|
|
325
|
+
color: var(--md-sys-color-primary, #6750a4);
|
|
326
|
+
--md-icon-size: 16px;
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
.lint-issue-content {
|
|
330
|
+
display: flex;
|
|
331
|
+
flex-direction: column;
|
|
332
|
+
gap: 2px;
|
|
333
|
+
flex-grow: 1;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
.lint-issue-loc {
|
|
337
|
+
font-weight: 600;
|
|
338
|
+
font-size: 11px;
|
|
339
|
+
color: var(--md-sys-color-outline, #79747e);
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
.lint-issue-msg {
|
|
343
|
+
font-size: 12px;
|
|
344
|
+
color: var(--md-sys-color-on-surface, #1d1b20);
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
/* --- Syntax Highlighting Colors (MD3 Color Scheme Aware) --- */
|
|
348
|
+
.token-keyword {
|
|
349
|
+
color: var(--md-code-token-keyword, var(--md-sys-color-primary, #6750a4));
|
|
350
|
+
font-weight: 600;
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
.token-string {
|
|
354
|
+
color: var(--md-code-token-string, #198754);
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
.token-comment {
|
|
358
|
+
color: var(--md-code-token-comment, var(--md-sys-color-outline, #79747e));
|
|
359
|
+
font-style: italic;
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
.token-function {
|
|
363
|
+
color: var(--md-code-token-function, var(--md-sys-color-tertiary, #7d5260));
|
|
364
|
+
font-weight: 500;
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
.token-number {
|
|
368
|
+
color: var(--md-code-token-number, #b35900);
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
.token-boolean {
|
|
372
|
+
color: var(--md-code-token-boolean, #d9381e);
|
|
373
|
+
font-weight: 600;
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
.token-constant {
|
|
377
|
+
color: var(--md-code-token-constant, #b3261e);
|
|
378
|
+
font-weight: 600;
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
.token-tag {
|
|
382
|
+
color: var(--md-code-token-tag, var(--md-sys-color-primary, #6750a4));
|
|
383
|
+
font-weight: 600;
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
.token-attr-name {
|
|
387
|
+
color: var(--md-code-token-attr-name, var(--md-sys-color-secondary, #625b71));
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
.token-property {
|
|
391
|
+
color: var(--md-code-token-property, var(--md-sys-color-primary, #6750a4));
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
.token-type {
|
|
395
|
+
color: var(--md-code-token-type, #00838f);
|
|
396
|
+
font-weight: 500;
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
.token-variable {
|
|
400
|
+
color: var(--md-code-token-variable, #e65100);
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
.token-operator {
|
|
404
|
+
color: var(--md-code-token-operator, var(--md-sys-color-on-surface-variant, #49454f));
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
.token-punctuation {
|
|
408
|
+
color: var(--md-code-token-punctuation, var(--md-sys-color-outline, #79747e));
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
/* Dark Theme Adjustments */
|
|
412
|
+
:host-context([data-theme='dark']) .token-string,
|
|
413
|
+
:host([data-theme='dark']) .token-string {
|
|
414
|
+
color: #4ade80;
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
:host-context([data-theme='dark']) .token-number,
|
|
418
|
+
:host([data-theme='dark']) .token-number {
|
|
419
|
+
color: #fb923c;
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
:host-context([data-theme='dark']) .token-type,
|
|
423
|
+
:host([data-theme='dark']) .token-type {
|
|
424
|
+
color: #38bdf8;
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
:host-context([data-theme='dark']) .token-boolean,
|
|
428
|
+
:host([data-theme='dark']) .token-boolean {
|
|
429
|
+
color: #f87171;
|
|
430
|
+
}
|
|
431
|
+
`;
|
|
432
|
+
function l(e) {
|
|
433
|
+
return e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
434
|
+
}
|
|
435
|
+
function c(e, r) {
|
|
436
|
+
return `<span class="token-${e}">${r}</span>`;
|
|
437
|
+
}
|
|
438
|
+
function B(e) {
|
|
439
|
+
const r = /* @__PURE__ */ new Set([
|
|
440
|
+
"abstract",
|
|
441
|
+
"any",
|
|
442
|
+
"as",
|
|
443
|
+
"async",
|
|
444
|
+
"await",
|
|
445
|
+
"boolean",
|
|
446
|
+
"break",
|
|
447
|
+
"case",
|
|
448
|
+
"catch",
|
|
449
|
+
"class",
|
|
450
|
+
"const",
|
|
451
|
+
"constructor",
|
|
452
|
+
"continue",
|
|
453
|
+
"debugger",
|
|
454
|
+
"declare",
|
|
455
|
+
"default",
|
|
456
|
+
"delete",
|
|
457
|
+
"do",
|
|
458
|
+
"else",
|
|
459
|
+
"enum",
|
|
460
|
+
"export",
|
|
461
|
+
"extends",
|
|
462
|
+
"false",
|
|
463
|
+
"finally",
|
|
464
|
+
"for",
|
|
465
|
+
"from",
|
|
466
|
+
"function",
|
|
467
|
+
"get",
|
|
468
|
+
"if",
|
|
469
|
+
"implements",
|
|
470
|
+
"import",
|
|
471
|
+
"in",
|
|
472
|
+
"infer",
|
|
473
|
+
"instanceof",
|
|
474
|
+
"interface",
|
|
475
|
+
"is",
|
|
476
|
+
"keyof",
|
|
477
|
+
"let",
|
|
478
|
+
"module",
|
|
479
|
+
"namespace",
|
|
480
|
+
"never",
|
|
481
|
+
"new",
|
|
482
|
+
"null",
|
|
483
|
+
"number",
|
|
484
|
+
"of",
|
|
485
|
+
"override",
|
|
486
|
+
"package",
|
|
487
|
+
"private",
|
|
488
|
+
"protected",
|
|
489
|
+
"public",
|
|
490
|
+
"readonly",
|
|
491
|
+
"require",
|
|
492
|
+
"return",
|
|
493
|
+
"set",
|
|
494
|
+
"static",
|
|
495
|
+
"string",
|
|
496
|
+
"super",
|
|
497
|
+
"switch",
|
|
498
|
+
"symbol",
|
|
499
|
+
"this",
|
|
500
|
+
"throw",
|
|
501
|
+
"true",
|
|
502
|
+
"try",
|
|
503
|
+
"type",
|
|
504
|
+
"typeof",
|
|
505
|
+
"undefined",
|
|
506
|
+
"unique",
|
|
507
|
+
"unknown",
|
|
508
|
+
"var",
|
|
509
|
+
"void",
|
|
510
|
+
"while",
|
|
511
|
+
"with",
|
|
512
|
+
"yield"
|
|
513
|
+
]);
|
|
514
|
+
let i = "", n = 0;
|
|
515
|
+
const o = e.length;
|
|
516
|
+
for (; n < o; ) {
|
|
517
|
+
if (e[n] === "/" && e[n + 1] === "/") {
|
|
518
|
+
let t = e.indexOf(`
|
|
519
|
+
`, n);
|
|
520
|
+
t === -1 && (t = o), i += c("comment", l(e.slice(n, t))), n = t;
|
|
521
|
+
continue;
|
|
522
|
+
}
|
|
523
|
+
if (e[n] === "/" && e[n + 1] === "*") {
|
|
524
|
+
let t = e.indexOf("*/", n + 2);
|
|
525
|
+
t === -1 ? t = o : t += 2, i += c("comment", l(e.slice(n, t))), n = t;
|
|
526
|
+
continue;
|
|
527
|
+
}
|
|
528
|
+
if (e[n] === "`") {
|
|
529
|
+
let t = n + 1;
|
|
530
|
+
for (; t < o && e[t] !== "`"; )
|
|
531
|
+
e[t] === "\\" && t++, t++;
|
|
532
|
+
t < o && t++, i += c("string", l(e.slice(n, t))), n = t;
|
|
533
|
+
continue;
|
|
534
|
+
}
|
|
535
|
+
if (e[n] === '"' || e[n] === "'") {
|
|
536
|
+
const t = e[n];
|
|
537
|
+
let s = n + 1;
|
|
538
|
+
for (; s < o && e[s] !== t && e[s] !== `
|
|
539
|
+
`; )
|
|
540
|
+
e[s] === "\\" && s++, s++;
|
|
541
|
+
s < o && e[s] === t && s++, i += c("string", l(e.slice(n, s))), n = s;
|
|
542
|
+
continue;
|
|
543
|
+
}
|
|
544
|
+
if (/[0-9]/.test(e[n]) || e[n] === "." && /[0-9]/.test(e[n + 1] || "")) {
|
|
545
|
+
let t = n;
|
|
546
|
+
for (; t < o && /[0-9a-fA-FxXbBoOeE_.]/.test(e[t]); ) t++;
|
|
547
|
+
i += c("number", l(e.slice(n, t))), n = t;
|
|
548
|
+
continue;
|
|
549
|
+
}
|
|
550
|
+
if (/[a-zA-Z_$]/.test(e[n])) {
|
|
551
|
+
let t = n;
|
|
552
|
+
for (; t < o && /[a-zA-Z0-9_$]/.test(e[t]); ) t++;
|
|
553
|
+
const s = e.slice(n, t);
|
|
554
|
+
let a = t;
|
|
555
|
+
for (; a < o && /\s/.test(e[a]); ) a++;
|
|
556
|
+
const d = e[a] === "(";
|
|
557
|
+
s === "true" || s === "false" ? i += c("boolean", l(s)) : s === "null" || s === "undefined" ? i += c("constant", l(s)) : r.has(s) ? i += c("keyword", l(s)) : /^[A-Z][a-zA-Z0-9_$]*$/.test(s) && !d ? i += c("type", l(s)) : d ? i += c("function", l(s)) : i += l(s), n = t;
|
|
558
|
+
continue;
|
|
559
|
+
}
|
|
560
|
+
if (/[+\-*/%=&|<>!^~?:.]/.test(e[n])) {
|
|
561
|
+
let t = n;
|
|
562
|
+
for (; t < o && /[+\-*/%=&|<>!^~?:.]/.test(e[t]); ) t++;
|
|
563
|
+
i += c("operator", l(e.slice(n, t))), n = t;
|
|
564
|
+
continue;
|
|
565
|
+
}
|
|
566
|
+
if (/[{}()[\];,]/.test(e[n])) {
|
|
567
|
+
i += c("punctuation", l(e[n])), n++;
|
|
568
|
+
continue;
|
|
569
|
+
}
|
|
570
|
+
i += l(e[n]), n++;
|
|
571
|
+
}
|
|
572
|
+
return i;
|
|
573
|
+
}
|
|
574
|
+
function j(e) {
|
|
575
|
+
let r = "", i = 0;
|
|
576
|
+
const n = e.length;
|
|
577
|
+
for (; i < n; ) {
|
|
578
|
+
if (e.slice(i, i + 4) === "<!--") {
|
|
579
|
+
let o = e.indexOf("-->", i + 4);
|
|
580
|
+
o === -1 ? o = n : o += 3, r += c("comment", l(e.slice(i, o))), i = o;
|
|
581
|
+
continue;
|
|
582
|
+
}
|
|
583
|
+
if (e[i] === "<") {
|
|
584
|
+
let o = e.indexOf(">", i);
|
|
585
|
+
o === -1 ? o = n : o += 1;
|
|
586
|
+
const t = e.slice(i, o), s = t.match(/^<\/?([a-zA-Z0-9\-:]+)/);
|
|
587
|
+
if (s && s[1]) {
|
|
588
|
+
let a = c("punctuation", l(t.startsWith("</") ? "</" : "<"));
|
|
589
|
+
a += c("tag", l(s[1]));
|
|
590
|
+
let d = t.slice(s[0].length);
|
|
591
|
+
const h = /([a-zA-Z0-9\-:@?]+)(\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]+))?/g;
|
|
592
|
+
let p = 0, f;
|
|
593
|
+
for (; (f = h.exec(d)) !== null; ) {
|
|
594
|
+
f[0];
|
|
595
|
+
const m = f[1], g = f[2];
|
|
596
|
+
if (a += l(d.slice(p, f.index)), a += c("attr-name", l(m)), g) {
|
|
597
|
+
const y = g.indexOf("=");
|
|
598
|
+
a += c("operator", "=");
|
|
599
|
+
const w = g.slice(y + 1).trim();
|
|
600
|
+
a += c("string", l(w));
|
|
601
|
+
}
|
|
602
|
+
p = h.lastIndex;
|
|
603
|
+
}
|
|
604
|
+
const u = d.slice(p);
|
|
605
|
+
u.endsWith("/>") ? a += l(u.slice(0, -2)) + c("punctuation", "/>") : u.endsWith(">") ? a += l(u.slice(0, -1)) + c("punctuation", ">") : a += l(u), r += a;
|
|
606
|
+
} else r += l(t);
|
|
607
|
+
i = o;
|
|
608
|
+
continue;
|
|
609
|
+
}
|
|
610
|
+
r += l(e[i]), i++;
|
|
611
|
+
}
|
|
612
|
+
return r;
|
|
613
|
+
}
|
|
614
|
+
function U(e) {
|
|
615
|
+
let r = "", i = 0;
|
|
616
|
+
const n = e.length;
|
|
617
|
+
let o = !1;
|
|
618
|
+
for (; i < n; ) {
|
|
619
|
+
if (e[i] === "/" && e[i + 1] === "*") {
|
|
620
|
+
let t = e.indexOf("*/", i + 2);
|
|
621
|
+
t === -1 ? t = n : t += 2, r += c("comment", l(e.slice(i, t))), i = t;
|
|
622
|
+
continue;
|
|
623
|
+
}
|
|
624
|
+
if (e[i] === '"' || e[i] === "'") {
|
|
625
|
+
const t = e[i];
|
|
626
|
+
let s = i + 1;
|
|
627
|
+
for (; s < n && e[s] !== t && e[s] !== `
|
|
628
|
+
`; ) s++;
|
|
629
|
+
s < n && e[s] === t && s++, r += c("string", l(e.slice(i, s))), i = s;
|
|
630
|
+
continue;
|
|
631
|
+
}
|
|
632
|
+
if (e[i] === "{") {
|
|
633
|
+
o = !0, r += c("punctuation", "{"), i++;
|
|
634
|
+
continue;
|
|
635
|
+
}
|
|
636
|
+
if (e[i] === "}") {
|
|
637
|
+
o = !1, r += c("punctuation", "}"), i++;
|
|
638
|
+
continue;
|
|
639
|
+
}
|
|
640
|
+
if (o && /[a-zA-Z-]/.test(e[i])) {
|
|
641
|
+
let t = i;
|
|
642
|
+
for (; t < n && /[a-zA-Z0-9_-]/.test(e[t]); ) t++;
|
|
643
|
+
const s = e.slice(i, t);
|
|
644
|
+
let a = t;
|
|
645
|
+
for (; a < n && /\s/.test(e[a]); ) a++;
|
|
646
|
+
if (e[a] === ":") {
|
|
647
|
+
r += c("property", l(s)), r += l(e.slice(t, a)), r += c("punctuation", ":"), i = a + 1;
|
|
648
|
+
continue;
|
|
649
|
+
}
|
|
650
|
+
}
|
|
651
|
+
if (/[0-9]/.test(e[i])) {
|
|
652
|
+
let t = i;
|
|
653
|
+
for (; t < n && /[0-9a-zA-Z%.]/.test(e[t]); ) t++;
|
|
654
|
+
r += c("number", l(e.slice(i, t))), i = t;
|
|
655
|
+
continue;
|
|
656
|
+
}
|
|
657
|
+
if (e[i] === "#" && /[0-9a-fA-F]/.test(e[i + 1] || "")) {
|
|
658
|
+
let t = i + 1;
|
|
659
|
+
for (; t < n && /[0-9a-fA-F]/.test(e[t]); ) t++;
|
|
660
|
+
r += c("number", l(e.slice(i, t))), i = t;
|
|
661
|
+
continue;
|
|
662
|
+
}
|
|
663
|
+
if (/[;:(),]/.test(e[i])) {
|
|
664
|
+
r += c("punctuation", l(e[i])), i++;
|
|
665
|
+
continue;
|
|
666
|
+
}
|
|
667
|
+
r += l(e[i]), i++;
|
|
668
|
+
}
|
|
669
|
+
return r;
|
|
670
|
+
}
|
|
671
|
+
function W(e) {
|
|
672
|
+
let r = "", i = 0;
|
|
673
|
+
const n = e.length;
|
|
674
|
+
for (; i < n; ) {
|
|
675
|
+
if (e[i] === '"') {
|
|
676
|
+
let o = i + 1;
|
|
677
|
+
for (; o < n && e[o] !== '"'; )
|
|
678
|
+
e[o] === "\\" && o++, o++;
|
|
679
|
+
o < n && o++;
|
|
680
|
+
const t = e.slice(i, o);
|
|
681
|
+
let s = o;
|
|
682
|
+
for (; s < n && /\s/.test(e[s]); ) s++;
|
|
683
|
+
e[s] === ":" ? r += c("property", l(t)) : r += c("string", l(t)), i = o;
|
|
684
|
+
continue;
|
|
685
|
+
}
|
|
686
|
+
if (/[0-9-]/.test(e[i])) {
|
|
687
|
+
let o = i;
|
|
688
|
+
for (; o < n && /[0-9.eE+-]/.test(e[o]); ) o++;
|
|
689
|
+
r += c("number", l(e.slice(i, o))), i = o;
|
|
690
|
+
continue;
|
|
691
|
+
}
|
|
692
|
+
if (/[a-zA-Z]/.test(e[i])) {
|
|
693
|
+
let o = i;
|
|
694
|
+
for (; o < n && /[a-zA-Z]/.test(e[o]); ) o++;
|
|
695
|
+
const t = e.slice(i, o);
|
|
696
|
+
t === "true" || t === "false" ? r += c("boolean", l(t)) : t === "null" ? r += c("constant", l(t)) : r += l(t), i = o;
|
|
697
|
+
continue;
|
|
698
|
+
}
|
|
699
|
+
if (/[{}[\]:,]/.test(e[i])) {
|
|
700
|
+
r += c("punctuation", l(e[i])), i++;
|
|
701
|
+
continue;
|
|
702
|
+
}
|
|
703
|
+
r += l(e[i]), i++;
|
|
704
|
+
}
|
|
705
|
+
return r;
|
|
706
|
+
}
|
|
707
|
+
function H(e) {
|
|
708
|
+
const r = /* @__PURE__ */ new Set([
|
|
709
|
+
"and",
|
|
710
|
+
"as",
|
|
711
|
+
"assert",
|
|
712
|
+
"async",
|
|
713
|
+
"await",
|
|
714
|
+
"break",
|
|
715
|
+
"class",
|
|
716
|
+
"continue",
|
|
717
|
+
"def",
|
|
718
|
+
"del",
|
|
719
|
+
"elif",
|
|
720
|
+
"else",
|
|
721
|
+
"except",
|
|
722
|
+
"False",
|
|
723
|
+
"finally",
|
|
724
|
+
"for",
|
|
725
|
+
"from",
|
|
726
|
+
"global",
|
|
727
|
+
"if",
|
|
728
|
+
"import",
|
|
729
|
+
"in",
|
|
730
|
+
"is",
|
|
731
|
+
"lambda",
|
|
732
|
+
"None",
|
|
733
|
+
"nonlocal",
|
|
734
|
+
"not",
|
|
735
|
+
"or",
|
|
736
|
+
"pass",
|
|
737
|
+
"raise",
|
|
738
|
+
"return",
|
|
739
|
+
"True",
|
|
740
|
+
"try",
|
|
741
|
+
"while",
|
|
742
|
+
"with",
|
|
743
|
+
"yield",
|
|
744
|
+
"self"
|
|
745
|
+
]);
|
|
746
|
+
let i = "", n = 0;
|
|
747
|
+
const o = e.length;
|
|
748
|
+
for (; n < o; ) {
|
|
749
|
+
if (e[n] === "#") {
|
|
750
|
+
let t = e.indexOf(`
|
|
751
|
+
`, n);
|
|
752
|
+
t === -1 && (t = o), i += c("comment", l(e.slice(n, t))), n = t;
|
|
753
|
+
continue;
|
|
754
|
+
}
|
|
755
|
+
if (e.slice(n, n + 3) === '"""' || e.slice(n, n + 3) === "'''") {
|
|
756
|
+
const t = e.slice(n, n + 3);
|
|
757
|
+
let s = e.indexOf(t, n + 3);
|
|
758
|
+
s === -1 ? s = o : s += 3, i += c("string", l(e.slice(n, s))), n = s;
|
|
759
|
+
continue;
|
|
760
|
+
}
|
|
761
|
+
if (e[n] === '"' || e[n] === "'") {
|
|
762
|
+
const t = e[n];
|
|
763
|
+
let s = n + 1;
|
|
764
|
+
for (; s < o && e[s] !== t && e[s] !== `
|
|
765
|
+
`; )
|
|
766
|
+
e[s] === "\\" && s++, s++;
|
|
767
|
+
s < o && e[s] === t && s++, i += c("string", l(e.slice(n, s))), n = s;
|
|
768
|
+
continue;
|
|
769
|
+
}
|
|
770
|
+
if (/[0-9]/.test(e[n])) {
|
|
771
|
+
let t = n;
|
|
772
|
+
for (; t < o && /[0-9a-fA-FxXbBoOeE_.]/.test(e[t]); ) t++;
|
|
773
|
+
i += c("number", l(e.slice(n, t))), n = t;
|
|
774
|
+
continue;
|
|
775
|
+
}
|
|
776
|
+
if (/[a-zA-Z_]/.test(e[n])) {
|
|
777
|
+
let t = n;
|
|
778
|
+
for (; t < o && /[a-zA-Z0-9_]/.test(e[t]); ) t++;
|
|
779
|
+
const s = e.slice(n, t);
|
|
780
|
+
let a = t;
|
|
781
|
+
for (; a < o && /\s/.test(e[a]); ) a++;
|
|
782
|
+
const d = e[a] === "(";
|
|
783
|
+
s === "True" || s === "False" ? i += c("boolean", l(s)) : s === "None" ? i += c("constant", l(s)) : r.has(s) ? i += c("keyword", l(s)) : d ? i += c("function", l(s)) : /^[A-Z][a-zA-Z0-9_]*$/.test(s) ? i += c("type", l(s)) : i += l(s), n = t;
|
|
784
|
+
continue;
|
|
785
|
+
}
|
|
786
|
+
if (/[+\-*/%=&|<>!^~@:]/.test(e[n])) {
|
|
787
|
+
i += c("operator", l(e[n])), n++;
|
|
788
|
+
continue;
|
|
789
|
+
}
|
|
790
|
+
if (/[{}()[\];,.]/.test(e[n])) {
|
|
791
|
+
i += c("punctuation", l(e[n])), n++;
|
|
792
|
+
continue;
|
|
793
|
+
}
|
|
794
|
+
i += l(e[n]), n++;
|
|
795
|
+
}
|
|
796
|
+
return i;
|
|
797
|
+
}
|
|
798
|
+
function R(e) {
|
|
799
|
+
const r = /* @__PURE__ */ new Set([
|
|
800
|
+
"case",
|
|
801
|
+
"do",
|
|
802
|
+
"done",
|
|
803
|
+
"elif",
|
|
804
|
+
"else",
|
|
805
|
+
"esac",
|
|
806
|
+
"export",
|
|
807
|
+
"fi",
|
|
808
|
+
"for",
|
|
809
|
+
"function",
|
|
810
|
+
"if",
|
|
811
|
+
"in",
|
|
812
|
+
"return",
|
|
813
|
+
"select",
|
|
814
|
+
"then",
|
|
815
|
+
"time",
|
|
816
|
+
"until",
|
|
817
|
+
"while",
|
|
818
|
+
"sudo",
|
|
819
|
+
"echo",
|
|
820
|
+
"cd",
|
|
821
|
+
"mkdir",
|
|
822
|
+
"rm",
|
|
823
|
+
"cp",
|
|
824
|
+
"mv",
|
|
825
|
+
"npm",
|
|
826
|
+
"npx",
|
|
827
|
+
"node",
|
|
828
|
+
"git",
|
|
829
|
+
"yarn",
|
|
830
|
+
"pnpm"
|
|
831
|
+
]);
|
|
832
|
+
let i = "", n = 0;
|
|
833
|
+
const o = e.length;
|
|
834
|
+
for (; n < o; ) {
|
|
835
|
+
if (e[n] === "#") {
|
|
836
|
+
let t = e.indexOf(`
|
|
837
|
+
`, n);
|
|
838
|
+
t === -1 && (t = o), i += c("comment", l(e.slice(n, t))), n = t;
|
|
839
|
+
continue;
|
|
840
|
+
}
|
|
841
|
+
if (e[n] === '"' || e[n] === "'") {
|
|
842
|
+
const t = e[n];
|
|
843
|
+
let s = n + 1;
|
|
844
|
+
for (; s < o && e[s] !== t && e[s] !== `
|
|
845
|
+
`; )
|
|
846
|
+
e[s] === "\\" && s++, s++;
|
|
847
|
+
s < o && e[s] === t && s++, i += c("string", l(e.slice(n, s))), n = s;
|
|
848
|
+
continue;
|
|
849
|
+
}
|
|
850
|
+
if (e[n] === "$") {
|
|
851
|
+
let t = n + 1;
|
|
852
|
+
if (e[t] === "{")
|
|
853
|
+
t = e.indexOf("}", t), t === -1 ? t = o : t += 1;
|
|
854
|
+
else if (e[t] === "(")
|
|
855
|
+
t = e.indexOf(")", t), t === -1 ? t = o : t += 1;
|
|
856
|
+
else for (; t < o && /[a-zA-Z0-9_]/.test(e[t]); ) t++;
|
|
857
|
+
i += c("variable", l(e.slice(n, t))), n = t;
|
|
858
|
+
continue;
|
|
859
|
+
}
|
|
860
|
+
if (e[n] === "-" && /[a-zA-Z-]/.test(e[n + 1] || "")) {
|
|
861
|
+
let t = n + 1;
|
|
862
|
+
for (; t < o && /[a-zA-Z0-9_-]/.test(e[t]); ) t++;
|
|
863
|
+
i += c("attr-name", l(e.slice(n, t))), n = t;
|
|
864
|
+
continue;
|
|
865
|
+
}
|
|
866
|
+
if (/[a-zA-Z0-9_]/.test(e[n])) {
|
|
867
|
+
let t = n;
|
|
868
|
+
for (; t < o && /[a-zA-Z0-9_\-./]/.test(e[t]); ) t++;
|
|
869
|
+
const s = e.slice(n, t);
|
|
870
|
+
r.has(s) ? i += c("keyword", l(s)) : i += l(s), n = t;
|
|
871
|
+
continue;
|
|
872
|
+
}
|
|
873
|
+
if (/[|&><=;]/.test(e[n])) {
|
|
874
|
+
i += c("operator", l(e[n])), n++;
|
|
875
|
+
continue;
|
|
876
|
+
}
|
|
877
|
+
i += l(e[n]), n++;
|
|
878
|
+
}
|
|
879
|
+
return i;
|
|
880
|
+
}
|
|
881
|
+
function Z(e) {
|
|
882
|
+
const r = /* @__PURE__ */ new Set([
|
|
883
|
+
"SELECT",
|
|
884
|
+
"FROM",
|
|
885
|
+
"WHERE",
|
|
886
|
+
"INSERT",
|
|
887
|
+
"INTO",
|
|
888
|
+
"VALUES",
|
|
889
|
+
"UPDATE",
|
|
890
|
+
"SET",
|
|
891
|
+
"DELETE",
|
|
892
|
+
"CREATE",
|
|
893
|
+
"TABLE",
|
|
894
|
+
"DROP",
|
|
895
|
+
"ALTER",
|
|
896
|
+
"JOIN",
|
|
897
|
+
"LEFT",
|
|
898
|
+
"RIGHT",
|
|
899
|
+
"INNER",
|
|
900
|
+
"OUTER",
|
|
901
|
+
"FULL",
|
|
902
|
+
"ON",
|
|
903
|
+
"GROUP",
|
|
904
|
+
"BY",
|
|
905
|
+
"ORDER",
|
|
906
|
+
"HAVING",
|
|
907
|
+
"LIMIT",
|
|
908
|
+
"OFFSET",
|
|
909
|
+
"UNION",
|
|
910
|
+
"ALL",
|
|
911
|
+
"AS",
|
|
912
|
+
"DISTINCT",
|
|
913
|
+
"COUNT",
|
|
914
|
+
"SUM",
|
|
915
|
+
"AVG",
|
|
916
|
+
"MIN",
|
|
917
|
+
"MAX",
|
|
918
|
+
"AND",
|
|
919
|
+
"OR",
|
|
920
|
+
"NOT",
|
|
921
|
+
"IN",
|
|
922
|
+
"IS",
|
|
923
|
+
"NULL",
|
|
924
|
+
"LIKE",
|
|
925
|
+
"BETWEEN",
|
|
926
|
+
"EXISTS",
|
|
927
|
+
"CASE",
|
|
928
|
+
"WHEN",
|
|
929
|
+
"THEN",
|
|
930
|
+
"ELSE",
|
|
931
|
+
"END",
|
|
932
|
+
"PRIMARY",
|
|
933
|
+
"KEY",
|
|
934
|
+
"FOREIGN",
|
|
935
|
+
"REFERENCES",
|
|
936
|
+
"INDEX",
|
|
937
|
+
"DEFAULT",
|
|
938
|
+
"CHECK",
|
|
939
|
+
"CONSTRAINT"
|
|
940
|
+
]);
|
|
941
|
+
let i = "", n = 0;
|
|
942
|
+
const o = e.length;
|
|
943
|
+
for (; n < o; ) {
|
|
944
|
+
if (e[n] === "-" && e[n + 1] === "-") {
|
|
945
|
+
let t = e.indexOf(`
|
|
946
|
+
`, n);
|
|
947
|
+
t === -1 && (t = o), i += c("comment", l(e.slice(n, t))), n = t;
|
|
948
|
+
continue;
|
|
949
|
+
}
|
|
950
|
+
if (e[n] === "'" || e[n] === '"') {
|
|
951
|
+
const t = e[n];
|
|
952
|
+
let s = n + 1;
|
|
953
|
+
for (; s < o && e[s] !== t && e[s] !== `
|
|
954
|
+
`; ) s++;
|
|
955
|
+
s < o && e[s] === t && s++, i += c("string", l(e.slice(n, s))), n = s;
|
|
956
|
+
continue;
|
|
957
|
+
}
|
|
958
|
+
if (/[a-zA-Z_]/.test(e[n])) {
|
|
959
|
+
let t = n;
|
|
960
|
+
for (; t < o && /[a-zA-Z0-9_]/.test(e[t]); ) t++;
|
|
961
|
+
const s = e.slice(n, t);
|
|
962
|
+
r.has(s.toUpperCase()) ? i += c("keyword", l(s)) : i += l(s), n = t;
|
|
963
|
+
continue;
|
|
964
|
+
}
|
|
965
|
+
if (/[0-9]/.test(e[n])) {
|
|
966
|
+
let t = n;
|
|
967
|
+
for (; t < o && /[0-9.]/.test(e[t]); ) t++;
|
|
968
|
+
i += c("number", l(e.slice(n, t))), n = t;
|
|
969
|
+
continue;
|
|
970
|
+
}
|
|
971
|
+
if (/[=<>!+*/-]/.test(e[n])) {
|
|
972
|
+
i += c("operator", l(e[n])), n++;
|
|
973
|
+
continue;
|
|
974
|
+
}
|
|
975
|
+
if (/[(),;]/.test(e[n])) {
|
|
976
|
+
i += c("punctuation", l(e[n])), n++;
|
|
977
|
+
continue;
|
|
978
|
+
}
|
|
979
|
+
i += l(e[n]), n++;
|
|
980
|
+
}
|
|
981
|
+
return i;
|
|
982
|
+
}
|
|
983
|
+
function _(e, r) {
|
|
984
|
+
if (!e) return "";
|
|
985
|
+
switch ((r || "").toLowerCase().trim()) {
|
|
986
|
+
case "javascript":
|
|
987
|
+
case "js":
|
|
988
|
+
case "typescript":
|
|
989
|
+
case "ts":
|
|
990
|
+
case "jsx":
|
|
991
|
+
case "tsx":
|
|
992
|
+
return B(e);
|
|
993
|
+
case "html":
|
|
994
|
+
case "xml":
|
|
995
|
+
case "svg":
|
|
996
|
+
return j(e);
|
|
997
|
+
case "css":
|
|
998
|
+
case "scss":
|
|
999
|
+
case "less":
|
|
1000
|
+
return U(e);
|
|
1001
|
+
case "json":
|
|
1002
|
+
return W(e);
|
|
1003
|
+
case "python":
|
|
1004
|
+
case "py":
|
|
1005
|
+
return H(e);
|
|
1006
|
+
case "bash":
|
|
1007
|
+
case "sh":
|
|
1008
|
+
case "shell":
|
|
1009
|
+
case "zsh":
|
|
1010
|
+
return R(e);
|
|
1011
|
+
case "sql":
|
|
1012
|
+
return Z(e);
|
|
1013
|
+
default:
|
|
1014
|
+
return l(e);
|
|
1015
|
+
}
|
|
1016
|
+
}
|
|
1017
|
+
function D(e) {
|
|
1018
|
+
const r = [];
|
|
1019
|
+
if (!e.trim()) return r;
|
|
1020
|
+
try {
|
|
1021
|
+
return JSON.parse(e), r;
|
|
1022
|
+
} catch (i) {
|
|
1023
|
+
const n = i instanceof Error ? i.message : String(i);
|
|
1024
|
+
let o = 1, t = 1;
|
|
1025
|
+
const s = n.match(/at position (\d+)/i), a = n.match(/line (\d+) column (\d+)/i);
|
|
1026
|
+
if (a && a[1] && a[2])
|
|
1027
|
+
o = parseInt(a[1], 10), t = parseInt(a[2], 10);
|
|
1028
|
+
else if (s && s[1]) {
|
|
1029
|
+
const h = parseInt(s[1], 10), p = e.slice(0, h).split(`
|
|
1030
|
+
`);
|
|
1031
|
+
o = p.length, t = (p[p.length - 1]?.length || 0) + 1;
|
|
1032
|
+
} else {
|
|
1033
|
+
const h = e.split(`
|
|
1034
|
+
`);
|
|
1035
|
+
let p = !1;
|
|
1036
|
+
for (let f = 0; f < h.length; f++) {
|
|
1037
|
+
const u = h[f];
|
|
1038
|
+
if (/'[^']*'/.test(u)) {
|
|
1039
|
+
r.push({
|
|
1040
|
+
line: f + 1,
|
|
1041
|
+
column: u.indexOf("'") + 1,
|
|
1042
|
+
message: "JSON strings must use double quotes, not single quotes",
|
|
1043
|
+
severity: "error",
|
|
1044
|
+
rule: "json-no-single-quotes"
|
|
1045
|
+
}), p = !0;
|
|
1046
|
+
break;
|
|
1047
|
+
}
|
|
1048
|
+
if (/,\s*([}\]])/.test(u)) {
|
|
1049
|
+
r.push({
|
|
1050
|
+
line: f + 1,
|
|
1051
|
+
column: u.search(/,\s*([}\]])/) + 1,
|
|
1052
|
+
message: "Trailing comma is not allowed in standard JSON",
|
|
1053
|
+
severity: "error",
|
|
1054
|
+
rule: "json-no-trailing-comma"
|
|
1055
|
+
}), p = !0;
|
|
1056
|
+
break;
|
|
1057
|
+
}
|
|
1058
|
+
if (/\/\//.test(u) || /\/\*/.test(u)) {
|
|
1059
|
+
r.push({
|
|
1060
|
+
line: f + 1,
|
|
1061
|
+
column: u.search(/\/\/|\/\*/) + 1,
|
|
1062
|
+
message: "Comments are not permitted in standard JSON",
|
|
1063
|
+
severity: "warning",
|
|
1064
|
+
rule: "json-no-comments"
|
|
1065
|
+
}), p = !0;
|
|
1066
|
+
break;
|
|
1067
|
+
}
|
|
1068
|
+
const m = u.match(/([{,]\s*)([a-zA-Z0-9_$]+)\s*:/);
|
|
1069
|
+
if (m && m[1] && m[2]) {
|
|
1070
|
+
r.push({
|
|
1071
|
+
line: f + 1,
|
|
1072
|
+
column: u.indexOf(m[2]) + 1,
|
|
1073
|
+
message: `Key "${m[2]}" must be enclosed in double quotes`,
|
|
1074
|
+
severity: "error",
|
|
1075
|
+
rule: "json-unquoted-key"
|
|
1076
|
+
}), p = !0;
|
|
1077
|
+
break;
|
|
1078
|
+
}
|
|
1079
|
+
}
|
|
1080
|
+
if (p) return r;
|
|
1081
|
+
}
|
|
1082
|
+
let d = n.replace(/^JSON\.parse:\s*/i, "").replace(/in JSON at position \d+/i, "").trim();
|
|
1083
|
+
d || (d = "Invalid JSON syntax"), r.push({
|
|
1084
|
+
line: o,
|
|
1085
|
+
column: t,
|
|
1086
|
+
message: d,
|
|
1087
|
+
severity: "error",
|
|
1088
|
+
rule: "json-syntax-error"
|
|
1089
|
+
});
|
|
1090
|
+
}
|
|
1091
|
+
return r;
|
|
1092
|
+
}
|
|
1093
|
+
function q(e) {
|
|
1094
|
+
const r = [], i = e.split(`
|
|
1095
|
+
`), n = [], o = {
|
|
1096
|
+
"}": "{",
|
|
1097
|
+
")": "(",
|
|
1098
|
+
"]": "["
|
|
1099
|
+
};
|
|
1100
|
+
let t = !1, s = !1;
|
|
1101
|
+
for (let a = 0; a < i.length; a++) {
|
|
1102
|
+
const d = a + 1, h = i[a];
|
|
1103
|
+
let p = null, f = !1;
|
|
1104
|
+
for (let u = 0; u < h.length; u++) {
|
|
1105
|
+
const m = h[u], g = h[u + 1] || "";
|
|
1106
|
+
if (t) {
|
|
1107
|
+
m === "*" && g === "/" && (t = !1, u++);
|
|
1108
|
+
continue;
|
|
1109
|
+
}
|
|
1110
|
+
if (s) {
|
|
1111
|
+
if (m === "\\") {
|
|
1112
|
+
u++;
|
|
1113
|
+
continue;
|
|
1114
|
+
}
|
|
1115
|
+
m === "`" && (s = !1);
|
|
1116
|
+
continue;
|
|
1117
|
+
}
|
|
1118
|
+
if (p) {
|
|
1119
|
+
f ? f = !1 : m === "\\" ? f = !0 : m === p && (p = null);
|
|
1120
|
+
continue;
|
|
1121
|
+
}
|
|
1122
|
+
if (m === "/" && g === "/") break;
|
|
1123
|
+
if (m === "/" && g === "*") {
|
|
1124
|
+
t = !0, u++;
|
|
1125
|
+
continue;
|
|
1126
|
+
}
|
|
1127
|
+
if (m === "`") {
|
|
1128
|
+
s = !0;
|
|
1129
|
+
continue;
|
|
1130
|
+
}
|
|
1131
|
+
if (m === '"' || m === "'") {
|
|
1132
|
+
p = m;
|
|
1133
|
+
continue;
|
|
1134
|
+
}
|
|
1135
|
+
if (m === "{" || m === "(" || m === "[") n.push({
|
|
1136
|
+
char: m,
|
|
1137
|
+
line: d,
|
|
1138
|
+
col: u + 1
|
|
1139
|
+
});
|
|
1140
|
+
else if (m === "}" || m === ")" || m === "]") {
|
|
1141
|
+
const y = o[m];
|
|
1142
|
+
if (n.length === 0) r.push({
|
|
1143
|
+
line: d,
|
|
1144
|
+
column: u + 1,
|
|
1145
|
+
message: `Unexpected closing '${m}' with no matching opening bracket`,
|
|
1146
|
+
severity: "error",
|
|
1147
|
+
rule: "js-unmatched-bracket"
|
|
1148
|
+
});
|
|
1149
|
+
else {
|
|
1150
|
+
const w = n.pop();
|
|
1151
|
+
w.char !== y && r.push({
|
|
1152
|
+
line: d,
|
|
1153
|
+
column: u + 1,
|
|
1154
|
+
message: `Mismatched closing '${m}', expected matching '${w.char === "{" ? "}" : w.char === "(" ? ")" : "]"}' for '${w.char}' from line ${w.line}`,
|
|
1155
|
+
severity: "error",
|
|
1156
|
+
rule: "js-mismatched-bracket"
|
|
1157
|
+
});
|
|
1158
|
+
}
|
|
1159
|
+
}
|
|
1160
|
+
}
|
|
1161
|
+
p && r.push({
|
|
1162
|
+
line: d,
|
|
1163
|
+
column: h.lastIndexOf(p) + 1,
|
|
1164
|
+
message: `Unclosed string literal starting with ${p}`,
|
|
1165
|
+
severity: "error",
|
|
1166
|
+
rule: "js-unclosed-string"
|
|
1167
|
+
}), /====+/.test(h) && r.push({
|
|
1168
|
+
line: d,
|
|
1169
|
+
column: h.indexOf("====") + 1,
|
|
1170
|
+
message: 'Invalid equality operator: "===="',
|
|
1171
|
+
severity: "error",
|
|
1172
|
+
rule: "js-invalid-operator"
|
|
1173
|
+
});
|
|
1174
|
+
}
|
|
1175
|
+
for (t && r.push({
|
|
1176
|
+
line: i.length,
|
|
1177
|
+
column: 1,
|
|
1178
|
+
message: 'Unclosed multi-line comment "/*"',
|
|
1179
|
+
severity: "error",
|
|
1180
|
+
rule: "js-unclosed-comment"
|
|
1181
|
+
}), s && r.push({
|
|
1182
|
+
line: i.length,
|
|
1183
|
+
column: 1,
|
|
1184
|
+
message: "Unclosed template literal (`...`)",
|
|
1185
|
+
severity: "error",
|
|
1186
|
+
rule: "js-unclosed-template"
|
|
1187
|
+
}); n.length > 0; ) {
|
|
1188
|
+
const a = n.pop();
|
|
1189
|
+
r.push({
|
|
1190
|
+
line: a.line,
|
|
1191
|
+
column: a.col,
|
|
1192
|
+
message: `Unclosed opening bracket '${a.char}'`,
|
|
1193
|
+
severity: "error",
|
|
1194
|
+
rule: "js-unclosed-bracket"
|
|
1195
|
+
});
|
|
1196
|
+
}
|
|
1197
|
+
return r;
|
|
1198
|
+
}
|
|
1199
|
+
function F(e) {
|
|
1200
|
+
const r = [], i = e.split(`
|
|
1201
|
+
`), n = /* @__PURE__ */ new Set([
|
|
1202
|
+
"area",
|
|
1203
|
+
"base",
|
|
1204
|
+
"br",
|
|
1205
|
+
"col",
|
|
1206
|
+
"embed",
|
|
1207
|
+
"hr",
|
|
1208
|
+
"img",
|
|
1209
|
+
"input",
|
|
1210
|
+
"link",
|
|
1211
|
+
"meta",
|
|
1212
|
+
"param",
|
|
1213
|
+
"source",
|
|
1214
|
+
"track",
|
|
1215
|
+
"wbr",
|
|
1216
|
+
"!doctype"
|
|
1217
|
+
]), o = [], t = /<\/?([a-zA-Z0-9\-:]+)(\s+[^>]*?)?(\/?)>/g;
|
|
1218
|
+
for (let s = 0; s < i.length; s++) {
|
|
1219
|
+
const a = s + 1, d = i[s];
|
|
1220
|
+
let h;
|
|
1221
|
+
for (t.lastIndex = 0; (h = t.exec(d)) !== null; ) {
|
|
1222
|
+
const p = h[0], f = (h[1] || "").toLowerCase(), u = p.startsWith("</"), m = p.endsWith("/>") || n.has(f), g = h.index + 1;
|
|
1223
|
+
if (!(f.startsWith("!--") || f.startsWith("!doctype")))
|
|
1224
|
+
if (u)
|
|
1225
|
+
if (o.length === 0) r.push({
|
|
1226
|
+
line: a,
|
|
1227
|
+
column: g,
|
|
1228
|
+
message: `Unexpected closing tag </${f}> without matching opening tag`,
|
|
1229
|
+
severity: "error",
|
|
1230
|
+
rule: "html-unmatched-closing-tag"
|
|
1231
|
+
});
|
|
1232
|
+
else {
|
|
1233
|
+
const y = o.pop();
|
|
1234
|
+
y.name !== f && r.push({
|
|
1235
|
+
line: a,
|
|
1236
|
+
column: g,
|
|
1237
|
+
message: `Mismatched closing tag </${f}>, expected </${y.name}> (opened on line ${y.line})`,
|
|
1238
|
+
severity: "error",
|
|
1239
|
+
rule: "html-mismatched-tag"
|
|
1240
|
+
});
|
|
1241
|
+
}
|
|
1242
|
+
else m || o.push({
|
|
1243
|
+
name: f,
|
|
1244
|
+
line: a,
|
|
1245
|
+
col: g
|
|
1246
|
+
});
|
|
1247
|
+
}
|
|
1248
|
+
}
|
|
1249
|
+
for (; o.length > 0; ) {
|
|
1250
|
+
const s = o.pop();
|
|
1251
|
+
r.push({
|
|
1252
|
+
line: s.line,
|
|
1253
|
+
column: s.col,
|
|
1254
|
+
message: `Unclosed tag <${s.name}>`,
|
|
1255
|
+
severity: "error",
|
|
1256
|
+
rule: "html-unclosed-tag"
|
|
1257
|
+
});
|
|
1258
|
+
}
|
|
1259
|
+
return r;
|
|
1260
|
+
}
|
|
1261
|
+
function J(e) {
|
|
1262
|
+
const r = [], i = e.split(`
|
|
1263
|
+
`);
|
|
1264
|
+
let n = 0;
|
|
1265
|
+
const o = [];
|
|
1266
|
+
for (let t = 0; t < i.length; t++) {
|
|
1267
|
+
const s = t + 1, a = i[t], d = a.trim();
|
|
1268
|
+
if (!(!d || d.startsWith("/*") || d.startsWith("//"))) {
|
|
1269
|
+
for (let h = 0; h < a.length; h++) a[h] === "{" ? (n++, o.push({
|
|
1270
|
+
line: s,
|
|
1271
|
+
col: h + 1
|
|
1272
|
+
})) : a[h] === "}" && (n === 0 ? r.push({
|
|
1273
|
+
line: s,
|
|
1274
|
+
column: h + 1,
|
|
1275
|
+
message: 'Unexpected closing brace "}" without opening "{"',
|
|
1276
|
+
severity: "error",
|
|
1277
|
+
rule: "css-unmatched-brace"
|
|
1278
|
+
}) : (n--, o.pop()));
|
|
1279
|
+
if (n > 0 && d !== "{" && d !== "}" && !d.endsWith("{") && !d.endsWith("}") && (!d.includes(":") && !d.startsWith("@") && !d.endsWith(",") && r.push({
|
|
1280
|
+
line: s,
|
|
1281
|
+
column: 1,
|
|
1282
|
+
message: `Declaration "${d}" is missing a colon ":" between property and value`,
|
|
1283
|
+
severity: "warning",
|
|
1284
|
+
rule: "css-missing-colon"
|
|
1285
|
+
}), d.includes(":") && !d.endsWith(";") && !d.endsWith("{") && !d.endsWith("}"))) {
|
|
1286
|
+
const h = i[t + 1]?.trim() || "";
|
|
1287
|
+
h && !h.startsWith("}") && r.push({
|
|
1288
|
+
line: s,
|
|
1289
|
+
column: a.length,
|
|
1290
|
+
message: 'Missing semicolon ";" at the end of CSS declaration',
|
|
1291
|
+
severity: "warning",
|
|
1292
|
+
rule: "css-missing-semicolon"
|
|
1293
|
+
});
|
|
1294
|
+
}
|
|
1295
|
+
}
|
|
1296
|
+
}
|
|
1297
|
+
for (; o.length > 0; ) {
|
|
1298
|
+
const t = o.pop();
|
|
1299
|
+
r.push({
|
|
1300
|
+
line: t.line,
|
|
1301
|
+
column: t.col,
|
|
1302
|
+
message: 'Unclosed CSS block "{"',
|
|
1303
|
+
severity: "error",
|
|
1304
|
+
rule: "css-unclosed-brace"
|
|
1305
|
+
});
|
|
1306
|
+
}
|
|
1307
|
+
return r;
|
|
1308
|
+
}
|
|
1309
|
+
function V(e) {
|
|
1310
|
+
const r = [], i = e.split(`
|
|
1311
|
+
`);
|
|
1312
|
+
let n = !1, o = !1;
|
|
1313
|
+
const t = [], s = {
|
|
1314
|
+
")": "(",
|
|
1315
|
+
"]": "[",
|
|
1316
|
+
"}": "{"
|
|
1317
|
+
}, a = /^\s*(def\s+.*|class\s+.*|if\s+.*|elif\s+.*|else|for\s+.*|while\s+.*|try|except(\s+.*)?|finally|with\s+.*)$/;
|
|
1318
|
+
for (let d = 0; d < i.length; d++) {
|
|
1319
|
+
const h = d + 1, p = i[d], f = p.trim();
|
|
1320
|
+
if (!f || f.startsWith("#")) continue;
|
|
1321
|
+
const u = p.match(/^([ \t]+)/);
|
|
1322
|
+
if (u && u[1]) {
|
|
1323
|
+
const g = u[1];
|
|
1324
|
+
g.includes(" ") && (n = !0), g.includes(" ") && (o = !0), n && o && r.push({
|
|
1325
|
+
line: h,
|
|
1326
|
+
column: 1,
|
|
1327
|
+
message: "Inconsistent indentation: mixed tabs and spaces",
|
|
1328
|
+
severity: "warning",
|
|
1329
|
+
rule: "python-mixed-indentation"
|
|
1330
|
+
});
|
|
1331
|
+
}
|
|
1332
|
+
a.test(f) && !f.endsWith(":") && !f.includes("#") && r.push({
|
|
1333
|
+
line: h,
|
|
1334
|
+
column: p.length,
|
|
1335
|
+
message: 'Expected ":" at the end of statement header',
|
|
1336
|
+
severity: "error",
|
|
1337
|
+
rule: "python-missing-colon"
|
|
1338
|
+
});
|
|
1339
|
+
let m = null;
|
|
1340
|
+
for (let g = 0; g < p.length; g++) {
|
|
1341
|
+
const y = p[g];
|
|
1342
|
+
if (y === "#") break;
|
|
1343
|
+
if (m) {
|
|
1344
|
+
y === m && p[g - 1] !== "\\" && (m = null);
|
|
1345
|
+
continue;
|
|
1346
|
+
}
|
|
1347
|
+
if (y === '"' || y === "'") {
|
|
1348
|
+
m = y;
|
|
1349
|
+
continue;
|
|
1350
|
+
}
|
|
1351
|
+
if (y === "(" || y === "[" || y === "{") t.push({
|
|
1352
|
+
char: y,
|
|
1353
|
+
line: h,
|
|
1354
|
+
col: g + 1
|
|
1355
|
+
});
|
|
1356
|
+
else if (y === ")" || y === "]" || y === "}") {
|
|
1357
|
+
const w = s[y];
|
|
1358
|
+
if (t.length === 0) r.push({
|
|
1359
|
+
line: h,
|
|
1360
|
+
column: g + 1,
|
|
1361
|
+
message: `Unmatched closing '${y}'`,
|
|
1362
|
+
severity: "error",
|
|
1363
|
+
rule: "python-unmatched-bracket"
|
|
1364
|
+
});
|
|
1365
|
+
else {
|
|
1366
|
+
const $ = t.pop();
|
|
1367
|
+
$.char !== w && r.push({
|
|
1368
|
+
line: h,
|
|
1369
|
+
column: g + 1,
|
|
1370
|
+
message: `Mismatched bracket '${y}', expected closing for '${$.char}' from line ${$.line}`,
|
|
1371
|
+
severity: "error",
|
|
1372
|
+
rule: "python-mismatched-bracket"
|
|
1373
|
+
});
|
|
1374
|
+
}
|
|
1375
|
+
}
|
|
1376
|
+
}
|
|
1377
|
+
}
|
|
1378
|
+
for (; t.length > 0; ) {
|
|
1379
|
+
const d = t.pop();
|
|
1380
|
+
r.push({
|
|
1381
|
+
line: d.line,
|
|
1382
|
+
column: d.col,
|
|
1383
|
+
message: `Unclosed '${d.char}'`,
|
|
1384
|
+
severity: "error",
|
|
1385
|
+
rule: "python-unclosed-bracket"
|
|
1386
|
+
});
|
|
1387
|
+
}
|
|
1388
|
+
return r;
|
|
1389
|
+
}
|
|
1390
|
+
function G(e) {
|
|
1391
|
+
const r = [], i = e.split(`
|
|
1392
|
+
`), n = [];
|
|
1393
|
+
for (let o = 0; o < i.length; o++) {
|
|
1394
|
+
const t = o + 1, s = i[o], a = s.trim();
|
|
1395
|
+
if (!a || a.startsWith("#")) continue;
|
|
1396
|
+
const d = a.split(/\s+/);
|
|
1397
|
+
for (const h of d) if (h === "if") n.push({
|
|
1398
|
+
keyword: "if",
|
|
1399
|
+
line: t
|
|
1400
|
+
});
|
|
1401
|
+
else if (h === "fi") {
|
|
1402
|
+
const p = n.pop();
|
|
1403
|
+
(!p || p.keyword !== "if") && r.push({
|
|
1404
|
+
line: t,
|
|
1405
|
+
column: s.indexOf("fi") + 1,
|
|
1406
|
+
message: 'Unexpected "fi" with no preceding "if"',
|
|
1407
|
+
severity: "error",
|
|
1408
|
+
rule: "bash-unmatched-fi"
|
|
1409
|
+
});
|
|
1410
|
+
} else if (h === "case") n.push({
|
|
1411
|
+
keyword: "case",
|
|
1412
|
+
line: t
|
|
1413
|
+
});
|
|
1414
|
+
else if (h === "esac") {
|
|
1415
|
+
const p = n.pop();
|
|
1416
|
+
(!p || p.keyword !== "case") && r.push({
|
|
1417
|
+
line: t,
|
|
1418
|
+
column: s.indexOf("esac") + 1,
|
|
1419
|
+
message: 'Unexpected "esac" with no preceding "case"',
|
|
1420
|
+
severity: "error",
|
|
1421
|
+
rule: "bash-unmatched-esac"
|
|
1422
|
+
});
|
|
1423
|
+
} else if (h === "do") n.push({
|
|
1424
|
+
keyword: "do",
|
|
1425
|
+
line: t
|
|
1426
|
+
});
|
|
1427
|
+
else if (h === "done") {
|
|
1428
|
+
const p = n.pop();
|
|
1429
|
+
(!p || p.keyword !== "do") && r.push({
|
|
1430
|
+
line: t,
|
|
1431
|
+
column: s.indexOf("done") + 1,
|
|
1432
|
+
message: 'Unexpected "done" with no preceding "do" / loop',
|
|
1433
|
+
severity: "error",
|
|
1434
|
+
rule: "bash-unmatched-done"
|
|
1435
|
+
});
|
|
1436
|
+
}
|
|
1437
|
+
}
|
|
1438
|
+
for (; n.length > 0; ) {
|
|
1439
|
+
const o = n.pop(), t = o.keyword === "if" ? "fi" : o.keyword === "case" ? "esac" : "done";
|
|
1440
|
+
r.push({
|
|
1441
|
+
line: o.line,
|
|
1442
|
+
column: 1,
|
|
1443
|
+
message: `Unclosed "${o.keyword}" block, missing "${t}"`,
|
|
1444
|
+
severity: "error",
|
|
1445
|
+
rule: "bash-unclosed-block"
|
|
1446
|
+
});
|
|
1447
|
+
}
|
|
1448
|
+
return r;
|
|
1449
|
+
}
|
|
1450
|
+
function K(e) {
|
|
1451
|
+
const r = [], i = e.split(`
|
|
1452
|
+
`);
|
|
1453
|
+
for (let n = 0; n < i.length; n++) {
|
|
1454
|
+
const o = n + 1, t = i[n];
|
|
1455
|
+
(/^\t+/.test(t) || /^ +\t+/.test(t)) && r.push({
|
|
1456
|
+
line: o,
|
|
1457
|
+
column: 1,
|
|
1458
|
+
message: "YAML forbids tab characters for indentation; use spaces instead",
|
|
1459
|
+
severity: "error",
|
|
1460
|
+
rule: "yaml-no-tabs"
|
|
1461
|
+
});
|
|
1462
|
+
const s = t.trim();
|
|
1463
|
+
/^[a-zA-Z0-9_-]+:[^ \t\n\r/#]/.test(s) && !s.startsWith("http:") && !s.startsWith("https:") && r.push({
|
|
1464
|
+
line: o,
|
|
1465
|
+
column: t.indexOf(":") + 1,
|
|
1466
|
+
message: 'YAML mappings require a space after the colon ":" (e.g. "key: value")',
|
|
1467
|
+
severity: "warning",
|
|
1468
|
+
rule: "yaml-missing-space"
|
|
1469
|
+
});
|
|
1470
|
+
}
|
|
1471
|
+
return r;
|
|
1472
|
+
}
|
|
1473
|
+
function P(e) {
|
|
1474
|
+
const r = [], i = e.split(`
|
|
1475
|
+
`);
|
|
1476
|
+
let n = 0, o = 1;
|
|
1477
|
+
for (let t = 0; t < i.length; t++) {
|
|
1478
|
+
const s = t + 1;
|
|
1479
|
+
i[t].trim().startsWith("```") && (n === 0 ? (n++, o = s) : n--);
|
|
1480
|
+
}
|
|
1481
|
+
return n > 0 && r.push({
|
|
1482
|
+
line: o,
|
|
1483
|
+
column: 1,
|
|
1484
|
+
message: "Unclosed Markdown code fence (```)",
|
|
1485
|
+
severity: "error",
|
|
1486
|
+
rule: "md-unclosed-fence"
|
|
1487
|
+
}), r;
|
|
1488
|
+
}
|
|
1489
|
+
function Y(e, r) {
|
|
1490
|
+
if (!e || !e.trim()) return [];
|
|
1491
|
+
switch ((r || "").toLowerCase().trim()) {
|
|
1492
|
+
case "json":
|
|
1493
|
+
return D(e);
|
|
1494
|
+
case "javascript":
|
|
1495
|
+
case "js":
|
|
1496
|
+
case "typescript":
|
|
1497
|
+
case "ts":
|
|
1498
|
+
case "jsx":
|
|
1499
|
+
case "tsx":
|
|
1500
|
+
return q(e);
|
|
1501
|
+
case "html":
|
|
1502
|
+
case "xml":
|
|
1503
|
+
case "svg":
|
|
1504
|
+
return F(e);
|
|
1505
|
+
case "css":
|
|
1506
|
+
case "scss":
|
|
1507
|
+
case "less":
|
|
1508
|
+
return J(e);
|
|
1509
|
+
case "python":
|
|
1510
|
+
case "py":
|
|
1511
|
+
return V(e);
|
|
1512
|
+
case "bash":
|
|
1513
|
+
case "sh":
|
|
1514
|
+
case "shell":
|
|
1515
|
+
case "zsh":
|
|
1516
|
+
return G(e);
|
|
1517
|
+
case "yaml":
|
|
1518
|
+
case "yml":
|
|
1519
|
+
return K(e);
|
|
1520
|
+
case "markdown":
|
|
1521
|
+
case "md":
|
|
1522
|
+
return P(e);
|
|
1523
|
+
default:
|
|
1524
|
+
return [];
|
|
1525
|
+
}
|
|
1526
|
+
}
|
|
1527
|
+
var b = class extends E {
|
|
1528
|
+
constructor(...r) {
|
|
1529
|
+
super(...r), this.code = "", this.language = "plaintext", this.lang = "", this.label = "", this.filename = "", this.lint = !1, this.diagnostics = [], this.showLintSummary = !0, this.lineNumbers = !1, this.highlightLines = "", this.copyable = !0, this.hideCopyButton = !1, this.wrapLines = !1, this.maxHeight = "", this.isCopied = !1, this.isIssuesExpanded = !1, this.internalCode = "", this.activeDiagnostics = [], this.copyTimeout = null, this.handleSlotChange = () => {
|
|
1530
|
+
this.code || (this.extractCodeContent(), this.requestUpdate());
|
|
1531
|
+
}, this.toggleIssuesList = () => {
|
|
1532
|
+
this.isIssuesExpanded = !this.isIssuesExpanded;
|
|
1533
|
+
};
|
|
1534
|
+
}
|
|
1535
|
+
static {
|
|
1536
|
+
this.styles = [E.styles, M];
|
|
1537
|
+
}
|
|
1538
|
+
connectedCallback() {
|
|
1539
|
+
super.connectedCallback(), this.extractCodeContent();
|
|
1540
|
+
}
|
|
1541
|
+
disconnectedCallback() {
|
|
1542
|
+
super.disconnectedCallback(), this.copyTimeout && (clearTimeout(this.copyTimeout), this.copyTimeout = null);
|
|
1543
|
+
}
|
|
1544
|
+
willUpdate(r) {
|
|
1545
|
+
r.has("code") && this.code ? this.internalCode = this.code : !this.internalCode && this.textContent && this.textContent.trim() && (this.internalCode = this.normalizeIndentation(this.textContent)), this.runLint();
|
|
1546
|
+
}
|
|
1547
|
+
extractCodeContent() {
|
|
1548
|
+
!this.code && this.textContent && this.textContent.trim() && (this.internalCode = this.normalizeIndentation(this.textContent), this.runLint());
|
|
1549
|
+
}
|
|
1550
|
+
normalizeIndentation(r) {
|
|
1551
|
+
const i = r.replace(/^\r?\n/, "").replace(/\r?\n\s*$/, "").split(`
|
|
1552
|
+
`);
|
|
1553
|
+
if (i.length === 0) return r;
|
|
1554
|
+
let n = 1 / 0;
|
|
1555
|
+
for (const o of i) {
|
|
1556
|
+
if (o.trim().length === 0) continue;
|
|
1557
|
+
const t = o.match(/^[ \t]*/)?.[0]?.length || 0;
|
|
1558
|
+
t < n && (n = t);
|
|
1559
|
+
}
|
|
1560
|
+
return n === 1 / 0 || n === 0 ? i.join(`
|
|
1561
|
+
`) : i.map((o) => o.slice(n)).join(`
|
|
1562
|
+
`);
|
|
1563
|
+
}
|
|
1564
|
+
runLint() {
|
|
1565
|
+
const r = this.effectiveLanguage;
|
|
1566
|
+
let i = [];
|
|
1567
|
+
const n = !!(this.lint || this.hasAttribute("lint")), o = this.internalCode || this.code || "";
|
|
1568
|
+
return n && o && (i = Y(o, r)), this.diagnostics && this.diagnostics.length > 0 && (i = [...i, ...this.diagnostics]), this.activeDiagnostics = i, this.emitEvent("lint-complete", {
|
|
1569
|
+
diagnostics: i,
|
|
1570
|
+
isValid: i.length === 0
|
|
1571
|
+
}), i;
|
|
1572
|
+
}
|
|
1573
|
+
get effectiveLanguage() {
|
|
1574
|
+
return this.lang || this.language || "plaintext";
|
|
1575
|
+
}
|
|
1576
|
+
get effectiveLabel() {
|
|
1577
|
+
return this.filename || this.label;
|
|
1578
|
+
}
|
|
1579
|
+
async copy() {
|
|
1580
|
+
const r = this.internalCode || this.code || this.textContent || "";
|
|
1581
|
+
if (!r) return !1;
|
|
1582
|
+
try {
|
|
1583
|
+
if (navigator.clipboard && navigator.clipboard.writeText) await navigator.clipboard.writeText(r);
|
|
1584
|
+
else {
|
|
1585
|
+
const i = document.createElement("textarea");
|
|
1586
|
+
i.value = r, i.style.position = "fixed", i.style.opacity = "0", document.body.appendChild(i), i.select(), document.execCommand("copy"), document.body.removeChild(i);
|
|
1587
|
+
}
|
|
1588
|
+
return this.isCopied = !0, this.emitEvent("copy", { code: r }), this.copyTimeout && clearTimeout(this.copyTimeout), this.copyTimeout = setTimeout(() => {
|
|
1589
|
+
this.isCopied = !1;
|
|
1590
|
+
}, 2e3), !0;
|
|
1591
|
+
} catch {
|
|
1592
|
+
return !1;
|
|
1593
|
+
}
|
|
1594
|
+
}
|
|
1595
|
+
parseHighlightedLines() {
|
|
1596
|
+
const r = /* @__PURE__ */ new Set();
|
|
1597
|
+
if (!this.highlightLines) return r;
|
|
1598
|
+
const i = this.highlightLines.split(",");
|
|
1599
|
+
for (const n of i) {
|
|
1600
|
+
const o = n.trim();
|
|
1601
|
+
if (o.includes("-")) {
|
|
1602
|
+
const [t, s] = o.split("-"), a = parseInt(t || "", 10), d = parseInt(s || "", 10);
|
|
1603
|
+
if (!isNaN(a) && !isNaN(d)) for (let h = a; h <= d; h++) r.add(h);
|
|
1604
|
+
} else {
|
|
1605
|
+
const t = parseInt(o, 10);
|
|
1606
|
+
isNaN(t) || r.add(t);
|
|
1607
|
+
}
|
|
1608
|
+
}
|
|
1609
|
+
return r;
|
|
1610
|
+
}
|
|
1611
|
+
scrollToLine(r) {
|
|
1612
|
+
const i = this.shadowRoot?.querySelector(`[data-line="${r}"]`);
|
|
1613
|
+
i && i.scrollIntoView({
|
|
1614
|
+
behavior: "smooth",
|
|
1615
|
+
block: "center"
|
|
1616
|
+
});
|
|
1617
|
+
}
|
|
1618
|
+
render() {
|
|
1619
|
+
const r = this.internalCode || this.code || "", i = this.effectiveLanguage, n = this.effectiveLabel, o = !!(n || i !== "plaintext" || this.copyable), t = this.parseHighlightedLines(), s = /* @__PURE__ */ new Map();
|
|
1620
|
+
for (const u of this.activeDiagnostics) {
|
|
1621
|
+
const m = s.get(u.line) || [];
|
|
1622
|
+
m.push(u), s.set(u.line, m);
|
|
1623
|
+
}
|
|
1624
|
+
const a = r.split(`
|
|
1625
|
+
`).length, d = _(r, i).split(`
|
|
1626
|
+
`), h = this.activeDiagnostics.filter((u) => u.severity === "error" || !u.severity).length, p = this.activeDiagnostics.filter((u) => u.severity === "warning").length, f = this.activeDiagnostics.length > 0;
|
|
1627
|
+
return x`
|
|
1628
|
+
<div class="code-container" style=${this.maxHeight ? `--md-code-max-height: ${this.maxHeight};` : ""}>
|
|
1629
|
+
<!-- Hidden Slot for code content fallback -->
|
|
1630
|
+
<div style="display: none;">
|
|
1631
|
+
<slot @slotchange=${this.handleSlotChange}></slot>
|
|
1632
|
+
</div>
|
|
1633
|
+
|
|
1634
|
+
<!-- Header -->
|
|
1635
|
+
${o ? x`
|
|
1636
|
+
<header class="code-header">
|
|
1637
|
+
<div class="code-header-left">
|
|
1638
|
+
${i && i !== "plaintext" ? x`
|
|
1639
|
+
<span class="lang-badge">${i}</span>
|
|
1640
|
+
` : C}
|
|
1641
|
+
${n ? x`<span class="code-filename">${n}</span>` : C}
|
|
1642
|
+
</div>
|
|
1643
|
+
|
|
1644
|
+
<div class="code-header-actions">
|
|
1645
|
+
<slot name="actions"></slot>
|
|
1646
|
+
${this.copyable && !this.hideCopyButton ? x`
|
|
1647
|
+
<button
|
|
1648
|
+
type="button"
|
|
1649
|
+
class="action-btn ${this.isCopied ? "copied" : ""}"
|
|
1650
|
+
@click=${this.copy}
|
|
1651
|
+
aria-label=${this.isCopied ? "Copied to clipboard" : "Copy code to clipboard"}
|
|
1652
|
+
title=${this.isCopied ? "Copied!" : "Copy code"}
|
|
1653
|
+
>
|
|
1654
|
+
<md-icon name=${this.isCopied ? "check" : "content_copy"}></md-icon>
|
|
1655
|
+
<span>${this.isCopied ? "Copied!" : "Copy"}</span>
|
|
1656
|
+
</button>
|
|
1657
|
+
` : C}
|
|
1658
|
+
</div>
|
|
1659
|
+
</header>
|
|
1660
|
+
` : this.copyable && !this.hideCopyButton ? x`
|
|
1661
|
+
<div class="floating-copy-btn">
|
|
1662
|
+
<button
|
|
1663
|
+
type="button"
|
|
1664
|
+
class="action-btn ${this.isCopied ? "copied" : ""}"
|
|
1665
|
+
@click=${this.copy}
|
|
1666
|
+
aria-label=${this.isCopied ? "Copied to clipboard" : "Copy code"}
|
|
1667
|
+
title=${this.isCopied ? "Copied!" : "Copy code"}
|
|
1668
|
+
>
|
|
1669
|
+
<md-icon name=${this.isCopied ? "check" : "content_copy"}></md-icon>
|
|
1670
|
+
<span>${this.isCopied ? "Copied!" : "Copy"}</span>
|
|
1671
|
+
</button>
|
|
1672
|
+
</div>
|
|
1673
|
+
` : C}
|
|
1674
|
+
|
|
1675
|
+
<!-- Body with Gutter and Code Lines -->
|
|
1676
|
+
<div class="code-body" style=${this.maxHeight ? `max-height: ${this.maxHeight};` : ""}>
|
|
1677
|
+
${this.lineNumbers || this.hasAttribute("line-numbers") || this.lint || this.hasAttribute("lint") || this.activeDiagnostics.length > 0 ? x`
|
|
1678
|
+
<div class="code-gutter" aria-hidden="true">
|
|
1679
|
+
${Array.from({ length: a }, (u, m) => {
|
|
1680
|
+
const g = m + 1, y = s.get(g), w = y?.find(($) => $.severity === "error" || !$.severity) || y?.[0];
|
|
1681
|
+
return x`
|
|
1682
|
+
<div class="gutter-line" @click=${() => this.scrollToLine(g)}>
|
|
1683
|
+
${w ? x`
|
|
1684
|
+
<span
|
|
1685
|
+
class="gutter-marker ${w.severity || "error"}"
|
|
1686
|
+
title="Line ${g}: ${w.message}"
|
|
1687
|
+
>
|
|
1688
|
+
<md-icon name=${w.severity === "warning" ? "warning" : "error"}></md-icon>
|
|
1689
|
+
</span>
|
|
1690
|
+
` : C}
|
|
1691
|
+
${this.lineNumbers || this.hasAttribute("line-numbers") ? x`<span>${g}</span>` : C}
|
|
1692
|
+
</div>
|
|
1693
|
+
`;
|
|
1694
|
+
})}
|
|
1695
|
+
</div>
|
|
1696
|
+
` : C}
|
|
1697
|
+
|
|
1698
|
+
<pre><code>${d.map((u, m) => {
|
|
1699
|
+
const g = m + 1, y = t.has(g), w = s.get(g), $ = w?.some((S) => S.severity === "error" || !S.severity), I = w?.some((S) => S.severity === "warning"), z = [
|
|
1700
|
+
"code-line",
|
|
1701
|
+
y ? "highlighted" : "",
|
|
1702
|
+
$ ? "has-error" : "",
|
|
1703
|
+
I && !$ ? "has-warning" : ""
|
|
1704
|
+
].filter(Boolean).join(" ");
|
|
1705
|
+
return x`<div class=${z} data-line=${g}>${O(u || " ")}</div>`;
|
|
1706
|
+
})}</code></pre>
|
|
1707
|
+
</div>
|
|
1708
|
+
|
|
1709
|
+
<!-- Lint Summary Footer -->
|
|
1710
|
+
${(this.lint || this.hasAttribute("lint") || this.diagnostics.length > 0 || this.activeDiagnostics.length > 0) && this.showLintSummary !== !1 ? x`
|
|
1711
|
+
<footer class="lint-footer">
|
|
1712
|
+
<div class="lint-footer-summary" @click=${this.toggleIssuesList} role="button" tabindex="0">
|
|
1713
|
+
<div class="lint-counts">
|
|
1714
|
+
${f && h > 0 ? x`
|
|
1715
|
+
<span class="lint-count-item errors">
|
|
1716
|
+
<md-icon name="error"></md-icon>
|
|
1717
|
+
<span>${h} ${h === 1 ? "error" : "errors"}</span>
|
|
1718
|
+
</span>
|
|
1719
|
+
` : C}
|
|
1720
|
+
${f && p > 0 ? x`
|
|
1721
|
+
<span class="lint-count-item warnings">
|
|
1722
|
+
<md-icon name="warning"></md-icon>
|
|
1723
|
+
<span>${p} ${p === 1 ? "warning" : "warnings"}</span>
|
|
1724
|
+
</span>
|
|
1725
|
+
` : C}
|
|
1726
|
+
${f ? C : x`
|
|
1727
|
+
<span class="lint-count-item valid">
|
|
1728
|
+
<md-icon name="check_circle"></md-icon>
|
|
1729
|
+
<span>No syntax issues detected</span>
|
|
1730
|
+
</span>
|
|
1731
|
+
`}
|
|
1732
|
+
</div>
|
|
1733
|
+
|
|
1734
|
+
${f ? x`
|
|
1735
|
+
<button type="button" class="action-btn" aria-label="Toggle issues panel">
|
|
1736
|
+
<md-icon name=${this.isIssuesExpanded ? "expand_less" : "expand_more"}></md-icon>
|
|
1737
|
+
<span>${this.isIssuesExpanded ? "Hide issues" : "View issues"}</span>
|
|
1738
|
+
</button>
|
|
1739
|
+
` : C}
|
|
1740
|
+
</div>
|
|
1741
|
+
|
|
1742
|
+
${f && this.isIssuesExpanded ? x`
|
|
1743
|
+
<div class="lint-issues-list" role="region" aria-label="Lint diagnostics">
|
|
1744
|
+
${this.activeDiagnostics.map((u) => x`
|
|
1745
|
+
<div
|
|
1746
|
+
class="lint-issue-item ${u.severity || "error"}"
|
|
1747
|
+
@click=${() => this.scrollToLine(u.line)}
|
|
1748
|
+
role="button"
|
|
1749
|
+
tabindex="0"
|
|
1750
|
+
>
|
|
1751
|
+
<md-icon name=${u.severity === "warning" ? "warning" : "error"}></md-icon>
|
|
1752
|
+
<div class="lint-issue-content">
|
|
1753
|
+
<span class="lint-issue-loc">Line ${u.line}${u.column ? `:${u.column}` : ""}${u.rule ? ` • ${u.rule}` : ""}</span>
|
|
1754
|
+
<span class="lint-issue-msg">${u.message}</span>
|
|
1755
|
+
</div>
|
|
1756
|
+
</div>
|
|
1757
|
+
`)}
|
|
1758
|
+
</div>
|
|
1759
|
+
` : C}
|
|
1760
|
+
</footer>
|
|
1761
|
+
` : C}
|
|
1762
|
+
</div>
|
|
1763
|
+
`;
|
|
1764
|
+
}
|
|
1765
|
+
};
|
|
1766
|
+
v([k({ type: String })], b.prototype, "code", void 0);
|
|
1767
|
+
v([k({
|
|
1768
|
+
type: String,
|
|
1769
|
+
reflect: !0
|
|
1770
|
+
})], b.prototype, "language", void 0);
|
|
1771
|
+
v([k({ type: String })], b.prototype, "lang", void 0);
|
|
1772
|
+
v([k({ type: String })], b.prototype, "label", void 0);
|
|
1773
|
+
v([k({ type: String })], b.prototype, "filename", void 0);
|
|
1774
|
+
v([k({
|
|
1775
|
+
type: Boolean,
|
|
1776
|
+
reflect: !0
|
|
1777
|
+
})], b.prototype, "lint", void 0);
|
|
1778
|
+
v([k({ type: Array })], b.prototype, "diagnostics", void 0);
|
|
1779
|
+
v([k({
|
|
1780
|
+
type: Boolean,
|
|
1781
|
+
attribute: "show-lint-summary",
|
|
1782
|
+
converter: {
|
|
1783
|
+
fromAttribute: (e) => e === null ? !0 : e !== "false",
|
|
1784
|
+
toAttribute: (e) => e ? "" : null
|
|
1785
|
+
}
|
|
1786
|
+
})], b.prototype, "showLintSummary", void 0);
|
|
1787
|
+
v([k({
|
|
1788
|
+
type: Boolean,
|
|
1789
|
+
attribute: "line-numbers",
|
|
1790
|
+
reflect: !0
|
|
1791
|
+
})], b.prototype, "lineNumbers", void 0);
|
|
1792
|
+
v([k({
|
|
1793
|
+
type: String,
|
|
1794
|
+
attribute: "highlight-lines"
|
|
1795
|
+
})], b.prototype, "highlightLines", void 0);
|
|
1796
|
+
v([k({
|
|
1797
|
+
type: Boolean,
|
|
1798
|
+
reflect: !0,
|
|
1799
|
+
converter: {
|
|
1800
|
+
fromAttribute: (e) => e === null ? !0 : e !== "false",
|
|
1801
|
+
toAttribute: (e) => e ? "" : null
|
|
1802
|
+
}
|
|
1803
|
+
})], b.prototype, "copyable", void 0);
|
|
1804
|
+
v([k({
|
|
1805
|
+
type: Boolean,
|
|
1806
|
+
attribute: "hide-copy-button"
|
|
1807
|
+
})], b.prototype, "hideCopyButton", void 0);
|
|
1808
|
+
v([k({
|
|
1809
|
+
type: Boolean,
|
|
1810
|
+
attribute: "wrap-lines",
|
|
1811
|
+
reflect: !0
|
|
1812
|
+
})], b.prototype, "wrapLines", void 0);
|
|
1813
|
+
v([k({
|
|
1814
|
+
type: String,
|
|
1815
|
+
attribute: "max-height"
|
|
1816
|
+
})], b.prototype, "maxHeight", void 0);
|
|
1817
|
+
v([L()], b.prototype, "isCopied", void 0);
|
|
1818
|
+
v([L()], b.prototype, "isIssuesExpanded", void 0);
|
|
1819
|
+
v([L()], b.prototype, "internalCode", void 0);
|
|
1820
|
+
v([L()], b.prototype, "activeDiagnostics", void 0);
|
|
1821
|
+
b = v([N("md-code")], b);
|
|
1822
|
+
var A = class extends b {
|
|
1823
|
+
};
|
|
1824
|
+
A = v([N("md-code-block")], A);
|
|
1825
|
+
export {
|
|
1826
|
+
A as n,
|
|
1827
|
+
b as t
|
|
1828
|
+
};
|
|
1829
|
+
|
|
1830
|
+
//# sourceMappingURL=code-C5UFBkCh.js.map
|