quasar-ui-danx 0.5.1 → 0.5.3
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/.claude/settings.local.json +8 -0
- package/dist/danx.es.js +13869 -12976
- package/dist/danx.es.js.map +1 -1
- package/dist/danx.umd.js +159 -151
- package/dist/danx.umd.js.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/src/components/Utility/Buttons/ActionButton.vue +15 -5
- package/src/components/Utility/Code/CodeViewer.vue +10 -2
- package/src/components/Utility/Code/CodeViewerFooter.vue +2 -0
- package/src/components/Utility/Code/MarkdownContent.vue +31 -163
- package/src/components/Utility/Files/FilePreview.vue +2 -2
- package/src/components/Utility/Markdown/MarkdownEditor.vue +7 -2
- package/src/components/Utility/Markdown/MarkdownEditorContent.vue +69 -8
- package/src/components/Utility/Widgets/LabelPillWidget.vue +20 -0
- package/src/composables/markdown/features/useCodeBlocks.spec.ts +59 -33
- package/src/composables/markdown/features/useLinks.spec.ts +29 -10
- package/src/composables/markdown/useMarkdownEditor.ts +16 -7
- package/src/composables/useCodeFormat.ts +17 -10
- package/src/composables/useCodeViewerCollapse.ts +7 -0
- package/src/composables/useFileNavigation.ts +5 -1
- package/src/helpers/formats/highlightCSS.ts +236 -0
- package/src/helpers/formats/highlightHTML.ts +483 -0
- package/src/helpers/formats/highlightJavaScript.ts +346 -0
- package/src/helpers/formats/highlightSyntax.ts +15 -4
- package/src/helpers/formats/index.ts +3 -0
- package/src/helpers/formats/markdown/htmlToMarkdown/index.ts +42 -4
- package/src/helpers/formats/markdown/linePatterns.spec.ts +7 -4
- package/src/helpers/formats/markdown/parseInline.ts +26 -13
- package/src/helpers/routes.ts +3 -1
- package/src/styles/danx.scss +3 -3
- package/src/styles/index.scss +5 -5
- package/src/styles/themes/danx/code.scss +257 -1
- package/src/styles/themes/danx/index.scss +10 -10
- package/src/styles/themes/danx/markdown.scss +81 -0
- package/src/test/highlighters.test.ts +153 -0
- package/src/types/widgets.d.ts +2 -2
- package/vite.config.js +5 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Code Viewer Theme
|
|
2
|
-
//
|
|
2
|
+
// Supports dark (default) and light themes with syntax highlighting for JSON/YAML
|
|
3
3
|
|
|
4
4
|
.dx-code-viewer {
|
|
5
5
|
width: 100%;
|
|
@@ -134,6 +134,58 @@
|
|
|
134
134
|
color: #808080;
|
|
135
135
|
}
|
|
136
136
|
|
|
137
|
+
// Comments - Muted green
|
|
138
|
+
.syntax-comment {
|
|
139
|
+
color: #6a9955;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
// CSS/HTML specific
|
|
143
|
+
.syntax-selector {
|
|
144
|
+
color: #d7ba7d; // Gold/yellow
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
.syntax-property {
|
|
148
|
+
color: #9cdcfe; // Light blue (same as key)
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
.syntax-value {
|
|
152
|
+
color: #ce9178; // Orange (same as number)
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
.syntax-at-rule {
|
|
156
|
+
color: #c586c0; // Purple/magenta
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
// JavaScript specific
|
|
160
|
+
.syntax-keyword {
|
|
161
|
+
color: #569cd6; // Blue
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
.syntax-operator {
|
|
165
|
+
color: #d4d4d4; // Gray/white
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
.syntax-regex {
|
|
169
|
+
color: #d16969; // Red
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
.syntax-template {
|
|
173
|
+
color: #ce9178; // Orange (same as string/number)
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
// HTML specific
|
|
177
|
+
.syntax-tag {
|
|
178
|
+
color: #569cd6; // Blue
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
.syntax-attribute {
|
|
182
|
+
color: #9cdcfe; // Light blue
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
.syntax-doctype {
|
|
186
|
+
color: #808080; // Gray
|
|
187
|
+
}
|
|
188
|
+
|
|
137
189
|
|
|
138
190
|
// ==========================================
|
|
139
191
|
// Editable mode (contenteditable)
|
|
@@ -155,4 +207,208 @@
|
|
|
155
207
|
// Caret color
|
|
156
208
|
caret-color: #d4d4d4;
|
|
157
209
|
}
|
|
210
|
+
|
|
211
|
+
// ==========================================
|
|
212
|
+
// LIGHT THEME VARIANT
|
|
213
|
+
// ==========================================
|
|
214
|
+
&.theme-light {
|
|
215
|
+
.code-collapsed {
|
|
216
|
+
background-color: #f5f5f5;
|
|
217
|
+
|
|
218
|
+
&:hover {
|
|
219
|
+
background-color: #ebebeb;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
.code-collapsed-preview {
|
|
223
|
+
color: #333333;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
.code-content {
|
|
228
|
+
background-color: #f8fafc;
|
|
229
|
+
color: #1e293b;
|
|
230
|
+
border: 1px solid #e2e8f0;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
.code-footer {
|
|
234
|
+
background-color: #f1f5f9;
|
|
235
|
+
border-top: 1px solid #e2e8f0;
|
|
236
|
+
|
|
237
|
+
&.has-error {
|
|
238
|
+
background-color: #fee2e2;
|
|
239
|
+
border-top: 1px solid #ef4444;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
.language-badge {
|
|
244
|
+
background-color: #e2e8f0;
|
|
245
|
+
color: #64748b;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
// Light theme syntax highlighting
|
|
249
|
+
.syntax-key {
|
|
250
|
+
color: #0369a1;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
.syntax-string {
|
|
254
|
+
color: #15803d;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
.syntax-number {
|
|
258
|
+
color: #c2410c;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
.syntax-boolean {
|
|
262
|
+
color: #7c3aed;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
.syntax-null {
|
|
266
|
+
color: #7c3aed;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
.syntax-punctuation {
|
|
270
|
+
color: #64748b;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
// Light theme - Comments
|
|
274
|
+
.syntax-comment {
|
|
275
|
+
color: #6a9955;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
// Light theme - CSS/HTML specific
|
|
279
|
+
.syntax-selector {
|
|
280
|
+
color: #b45309; // Amber/brown
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
.syntax-property {
|
|
284
|
+
color: #0369a1; // Blue (same as key)
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
.syntax-value {
|
|
288
|
+
color: #c2410c; // Orange (same as number)
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
.syntax-at-rule {
|
|
292
|
+
color: #7c3aed; // Purple
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
// Light theme - JavaScript specific
|
|
296
|
+
.syntax-keyword {
|
|
297
|
+
color: #0369a1; // Blue
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
.syntax-operator {
|
|
301
|
+
color: #64748b; // Gray
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
.syntax-regex {
|
|
305
|
+
color: #be123c; // Red/rose
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
.syntax-template {
|
|
309
|
+
color: #c2410c; // Orange
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
// Light theme - HTML specific
|
|
313
|
+
.syntax-tag {
|
|
314
|
+
color: #0369a1; // Blue
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
.syntax-attribute {
|
|
318
|
+
color: #0891b2; // Cyan
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
.syntax-doctype {
|
|
322
|
+
color: #64748b; // Gray
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
.code-content.is-editable {
|
|
326
|
+
caret-color: #1e293b;
|
|
327
|
+
|
|
328
|
+
&:focus {
|
|
329
|
+
border-color: rgba(14, 165, 233, 0.6);
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
&:hover:not(:focus) {
|
|
333
|
+
border-color: rgba(14, 165, 233, 0.3);
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
// Light theme - Language badge component overrides
|
|
338
|
+
.dx-language-badge-container {
|
|
339
|
+
// Container needs no background changes
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
.dx-language-badge {
|
|
343
|
+
background: rgba(0, 0, 0, 0.08);
|
|
344
|
+
color: #64748b;
|
|
345
|
+
|
|
346
|
+
&.is-active {
|
|
347
|
+
background: rgba(0, 0, 0, 0.12);
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
.dx-language-option {
|
|
352
|
+
background: rgba(0, 0, 0, 0.06);
|
|
353
|
+
color: #64748b;
|
|
354
|
+
border-right: 1px solid rgba(0, 0, 0, 0.1);
|
|
355
|
+
|
|
356
|
+
&:hover {
|
|
357
|
+
background: rgba(0, 0, 0, 0.12);
|
|
358
|
+
color: #1e293b;
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
.dx-language-search-trigger {
|
|
363
|
+
// Inherits from dx-language-option
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
.dx-language-search-panel {
|
|
367
|
+
background: #f8fafc;
|
|
368
|
+
border: 1px solid #e2e8f0;
|
|
369
|
+
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
.dx-language-search-input {
|
|
373
|
+
background: #f1f5f9;
|
|
374
|
+
border-bottom: 1px solid #e2e8f0;
|
|
375
|
+
color: #1e293b;
|
|
376
|
+
|
|
377
|
+
&::placeholder {
|
|
378
|
+
color: #94a3b8;
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
&:focus {
|
|
382
|
+
background: #e2e8f0;
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
.dx-language-search-list {
|
|
387
|
+
&::-webkit-scrollbar-track {
|
|
388
|
+
background: #f1f5f9;
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
&::-webkit-scrollbar-thumb {
|
|
392
|
+
background: #cbd5e1;
|
|
393
|
+
|
|
394
|
+
&:hover {
|
|
395
|
+
background: #94a3b8;
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
.dx-language-search-item {
|
|
401
|
+
color: #64748b;
|
|
402
|
+
|
|
403
|
+
&:hover,
|
|
404
|
+
&.is-selected {
|
|
405
|
+
background: #e2e8f0;
|
|
406
|
+
color: #1e293b;
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
.dx-language-search-empty {
|
|
411
|
+
color: #94a3b8;
|
|
412
|
+
}
|
|
413
|
+
}
|
|
158
414
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
@
|
|
2
|
-
@
|
|
3
|
-
@
|
|
4
|
-
@
|
|
5
|
-
@
|
|
6
|
-
@
|
|
7
|
-
@
|
|
8
|
-
@
|
|
9
|
-
@
|
|
10
|
-
@
|
|
1
|
+
@use "action-table";
|
|
2
|
+
@use "buttons";
|
|
3
|
+
@use "carousels";
|
|
4
|
+
@use "code";
|
|
5
|
+
@use "dialogs";
|
|
6
|
+
@use "forms";
|
|
7
|
+
@use "markdown";
|
|
8
|
+
@use "panels";
|
|
9
|
+
@use "sidebar";
|
|
10
|
+
@use "toolbar";
|
|
@@ -165,6 +165,23 @@
|
|
|
165
165
|
vertical-align: super;
|
|
166
166
|
}
|
|
167
167
|
|
|
168
|
+
// Hex color preview swatch
|
|
169
|
+
.color-preview {
|
|
170
|
+
display: inline-flex;
|
|
171
|
+
align-items: center;
|
|
172
|
+
gap: 0.25em;
|
|
173
|
+
|
|
174
|
+
.color-swatch {
|
|
175
|
+
display: inline-block;
|
|
176
|
+
width: 14px;
|
|
177
|
+
height: 14px;
|
|
178
|
+
border-radius: 3px;
|
|
179
|
+
border: 1px solid rgba(255, 255, 255, 0.3);
|
|
180
|
+
vertical-align: middle;
|
|
181
|
+
flex-shrink: 0;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
|
|
168
185
|
// Tables
|
|
169
186
|
table {
|
|
170
187
|
border-collapse: collapse;
|
|
@@ -238,4 +255,68 @@
|
|
|
238
255
|
text-decoration: none;
|
|
239
256
|
}
|
|
240
257
|
}
|
|
258
|
+
|
|
259
|
+
// ==========================================
|
|
260
|
+
// LIGHT THEME VARIANT
|
|
261
|
+
// ==========================================
|
|
262
|
+
&.theme-light {
|
|
263
|
+
color: #1e293b;
|
|
264
|
+
|
|
265
|
+
// Inline code - light theme
|
|
266
|
+
code {
|
|
267
|
+
background: #f1f5f9;
|
|
268
|
+
color: #0f172a;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
// Code blocks - light theme
|
|
272
|
+
pre {
|
|
273
|
+
background: #f8fafc;
|
|
274
|
+
border: 1px solid #e2e8f0;
|
|
275
|
+
|
|
276
|
+
code {
|
|
277
|
+
background: transparent;
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
// Blockquotes - light theme
|
|
282
|
+
blockquote {
|
|
283
|
+
border-left-color: #cbd5e1;
|
|
284
|
+
color: #475569;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
// Links - light theme
|
|
288
|
+
a {
|
|
289
|
+
color: #0369a1;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
// Horizontal rules - light theme
|
|
293
|
+
hr {
|
|
294
|
+
border-top-color: #e2e8f0;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
// Tables - light theme
|
|
298
|
+
table {
|
|
299
|
+
th, td {
|
|
300
|
+
border-color: #e2e8f0;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
th {
|
|
304
|
+
background: #f1f5f9;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
tr:nth-child(even) {
|
|
308
|
+
background: #f8fafc;
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
// Highlight - light theme
|
|
313
|
+
mark {
|
|
314
|
+
background: rgba(250, 204, 21, 0.5);
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
// Color swatch - light theme
|
|
318
|
+
.color-preview .color-swatch {
|
|
319
|
+
border-color: rgba(0, 0, 0, 0.2);
|
|
320
|
+
}
|
|
321
|
+
}
|
|
241
322
|
}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import { describe, it, expect } from "vitest";
|
|
2
|
+
import { highlightCSS } from "../helpers/formats/highlightCSS";
|
|
3
|
+
import { highlightJavaScript } from "../helpers/formats/highlightJavaScript";
|
|
4
|
+
import { highlightHTML } from "../helpers/formats/highlightHTML";
|
|
5
|
+
import { highlightSyntax } from "../helpers/formats/highlightSyntax";
|
|
6
|
+
|
|
7
|
+
describe("CSS Highlighter", () => {
|
|
8
|
+
it("highlights selectors", () => {
|
|
9
|
+
const result = highlightCSS(".test { }");
|
|
10
|
+
expect(result).toContain("syntax-selector");
|
|
11
|
+
expect(result).toContain(".test");
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
it("highlights properties and values", () => {
|
|
15
|
+
const result = highlightCSS(".test { color: red; }");
|
|
16
|
+
expect(result).toContain("syntax-property");
|
|
17
|
+
expect(result).toContain("syntax-value");
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it("highlights comments", () => {
|
|
21
|
+
const result = highlightCSS("/* comment */");
|
|
22
|
+
expect(result).toContain("syntax-comment");
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
it("highlights at-rules", () => {
|
|
26
|
+
const result = highlightCSS("@media screen { }");
|
|
27
|
+
expect(result).toContain("syntax-at-rule");
|
|
28
|
+
expect(result).toContain("@media");
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
it("highlights strings", () => {
|
|
32
|
+
const result = highlightCSS('@import "file.css";');
|
|
33
|
+
expect(result).toContain("syntax-string");
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
describe("JavaScript Highlighter", () => {
|
|
38
|
+
it("highlights keywords", () => {
|
|
39
|
+
const result = highlightJavaScript("const x = 1;");
|
|
40
|
+
expect(result).toContain("syntax-keyword");
|
|
41
|
+
expect(result).toContain("const");
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
it("highlights strings", () => {
|
|
45
|
+
const result = highlightJavaScript('const s = "hello";');
|
|
46
|
+
expect(result).toContain("syntax-string");
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
it("highlights numbers", () => {
|
|
50
|
+
const result = highlightJavaScript("const n = 42;");
|
|
51
|
+
expect(result).toContain("syntax-number");
|
|
52
|
+
expect(result).toContain("42");
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
it("highlights single-line comments", () => {
|
|
56
|
+
const result = highlightJavaScript("// comment");
|
|
57
|
+
expect(result).toContain("syntax-comment");
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
it("highlights multi-line comments", () => {
|
|
61
|
+
const result = highlightJavaScript("/* comment */");
|
|
62
|
+
expect(result).toContain("syntax-comment");
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
it("highlights template literals", () => {
|
|
66
|
+
const result = highlightJavaScript("const t = `hello`;");
|
|
67
|
+
expect(result).toContain("syntax-template");
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
it("highlights boolean values", () => {
|
|
71
|
+
const result = highlightJavaScript("const b = true;");
|
|
72
|
+
expect(result).toContain("syntax-boolean");
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
it("highlights null and undefined", () => {
|
|
76
|
+
const result = highlightJavaScript("const n = null;");
|
|
77
|
+
expect(result).toContain("syntax-null");
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
it("highlights operators", () => {
|
|
81
|
+
const result = highlightJavaScript("x === y");
|
|
82
|
+
expect(result).toContain("syntax-operator");
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
it("highlights regex", () => {
|
|
86
|
+
const result = highlightJavaScript("const r = /test/gi;");
|
|
87
|
+
expect(result).toContain("syntax-regex");
|
|
88
|
+
});
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
describe("HTML Highlighter", () => {
|
|
92
|
+
it("highlights tags", () => {
|
|
93
|
+
const result = highlightHTML("<div></div>");
|
|
94
|
+
expect(result).toContain("syntax-tag");
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
it("highlights attributes", () => {
|
|
98
|
+
const result = highlightHTML('<div class="test"></div>');
|
|
99
|
+
expect(result).toContain("syntax-attribute");
|
|
100
|
+
expect(result).toContain("class");
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
it("highlights attribute values as strings", () => {
|
|
104
|
+
const result = highlightHTML('<div class="test"></div>');
|
|
105
|
+
expect(result).toContain("syntax-string");
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
it("highlights comments", () => {
|
|
109
|
+
const result = highlightHTML("<!-- comment -->");
|
|
110
|
+
expect(result).toContain("syntax-comment");
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
it("highlights doctype", () => {
|
|
114
|
+
const result = highlightHTML("<!DOCTYPE html>");
|
|
115
|
+
expect(result).toContain("syntax-doctype");
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
it("highlights embedded CSS in style tags", () => {
|
|
119
|
+
const result = highlightHTML("<style>.test { color: red; }</style>");
|
|
120
|
+
expect(result).toContain("syntax-selector");
|
|
121
|
+
expect(result).toContain("syntax-property");
|
|
122
|
+
expect(result).toContain("syntax-value");
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
it("highlights embedded JavaScript in script tags", () => {
|
|
126
|
+
const result = highlightHTML("<script>const x = 42;</script>");
|
|
127
|
+
expect(result).toContain("syntax-keyword");
|
|
128
|
+
expect(result).toContain("syntax-number");
|
|
129
|
+
});
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
describe("highlightSyntax dispatcher", () => {
|
|
133
|
+
it("dispatches to CSS highlighter", () => {
|
|
134
|
+
const result = highlightSyntax(".test { }", { format: "css" });
|
|
135
|
+
expect(result).toContain("syntax-selector");
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
it("dispatches to JavaScript highlighter", () => {
|
|
139
|
+
const result = highlightSyntax("const x = 1;", { format: "javascript" });
|
|
140
|
+
expect(result).toContain("syntax-keyword");
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
it("dispatches to HTML highlighter", () => {
|
|
144
|
+
const result = highlightSyntax("<div></div>", { format: "html" });
|
|
145
|
+
expect(result).toContain("syntax-tag");
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
it("escapes HTML for text format", () => {
|
|
149
|
+
const result = highlightSyntax("<script>alert(1)</script>", { format: "text" });
|
|
150
|
+
expect(result).toContain("<script>");
|
|
151
|
+
expect(result).not.toContain("<script>");
|
|
152
|
+
});
|
|
153
|
+
});
|
package/src/types/widgets.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export interface LabelPillWidgetProps {
|
|
2
2
|
label?: string | number;
|
|
3
|
-
size?: "xs" | "sm" | "md" | "lg";
|
|
4
|
-
color?: "sky" | "green" | "red" | "amber" | "yellow" | "blue" | "purple" | "slate" | "slate-mid" | "gray" | "emerald" | "orange" | "lime" | "teal" | "cyan" | "rose" | "indigo" | "violet" | "fuchsia" | "none";
|
|
3
|
+
size?: "xxs" | "xs" | "sm" | "md" | "lg";
|
|
4
|
+
color?: "sky" | "green" | "red" | "amber" | "yellow" | "blue" | "purple" | "slate" | "slate-mid" | "gray" | "emerald" | "orange" | "lime" | "teal" | "cyan" | "rose" | "indigo" | "violet" | "fuchsia" | "sky-soft" | "green-soft" | "red-soft" | "amber-soft" | "yellow-soft" | "blue-soft" | "purple-soft" | "slate-soft" | "gray-soft" | "emerald-soft" | "orange-soft" | "lime-soft" | "teal-soft" | "cyan-soft" | "rose-soft" | "indigo-soft" | "violet-soft" | "fuchsia-soft" | "none";
|
|
5
5
|
}
|
package/vite.config.js
CHANGED
|
@@ -3,6 +3,8 @@ import { resolve } from "path";
|
|
|
3
3
|
import { defineConfig } from "vite";
|
|
4
4
|
import svgLoader from "vite-svg-loader";
|
|
5
5
|
|
|
6
|
+
const __dirname = import.meta.dirname;
|
|
7
|
+
|
|
6
8
|
export default defineConfig({
|
|
7
9
|
plugins: [vue(), svgLoader()],
|
|
8
10
|
resolve: {
|
|
@@ -32,7 +34,9 @@ export default defineConfig({
|
|
|
32
34
|
css: {
|
|
33
35
|
preprocessorOptions: {
|
|
34
36
|
scss: {
|
|
35
|
-
|
|
37
|
+
api: "modern",
|
|
38
|
+
loadPaths: [resolve(__dirname, "src/styles")],
|
|
39
|
+
additionalData: `@use "index" as *;`
|
|
36
40
|
}
|
|
37
41
|
}
|
|
38
42
|
}
|