quasar-ui-danx 0.5.1 → 0.5.2

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.
Files changed (33) hide show
  1. package/.claude/settings.local.json +8 -0
  2. package/dist/danx.es.js +11359 -10497
  3. package/dist/danx.es.js.map +1 -1
  4. package/dist/danx.umd.js +138 -131
  5. package/dist/danx.umd.js.map +1 -1
  6. package/dist/style.css +1 -1
  7. package/package.json +1 -1
  8. package/src/components/Utility/Buttons/ActionButton.vue +15 -5
  9. package/src/components/Utility/Code/CodeViewer.vue +10 -2
  10. package/src/components/Utility/Code/CodeViewerFooter.vue +2 -0
  11. package/src/components/Utility/Code/MarkdownContent.vue +31 -163
  12. package/src/components/Utility/Markdown/MarkdownEditor.vue +7 -2
  13. package/src/components/Utility/Markdown/MarkdownEditorContent.vue +69 -8
  14. package/src/components/Utility/Widgets/LabelPillWidget.vue +20 -0
  15. package/src/composables/markdown/features/useCodeBlocks.spec.ts +59 -33
  16. package/src/composables/markdown/features/useLinks.spec.ts +29 -10
  17. package/src/composables/markdown/useMarkdownEditor.ts +16 -7
  18. package/src/composables/useCodeFormat.ts +17 -10
  19. package/src/helpers/formats/highlightCSS.ts +236 -0
  20. package/src/helpers/formats/highlightHTML.ts +483 -0
  21. package/src/helpers/formats/highlightJavaScript.ts +346 -0
  22. package/src/helpers/formats/highlightSyntax.ts +15 -4
  23. package/src/helpers/formats/index.ts +3 -0
  24. package/src/helpers/formats/markdown/htmlToMarkdown/index.ts +15 -2
  25. package/src/helpers/formats/markdown/linePatterns.spec.ts +7 -4
  26. package/src/styles/danx.scss +3 -3
  27. package/src/styles/index.scss +5 -5
  28. package/src/styles/themes/danx/code.scss +257 -1
  29. package/src/styles/themes/danx/index.scss +10 -10
  30. package/src/styles/themes/danx/markdown.scss +59 -0
  31. package/src/test/highlighters.test.ts +153 -0
  32. package/src/types/widgets.d.ts +2 -2
  33. package/vite.config.js +5 -1
@@ -1,5 +1,5 @@
1
1
  // Code Viewer Theme
2
- // Dark theme with syntax highlighting for JSON/YAML
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
- @import "action-table";
2
- @import "buttons";
3
- @import "carousels";
4
- @import "code";
5
- @import "dialogs";
6
- @import "forms";
7
- @import "markdown";
8
- @import "panels";
9
- @import "sidebar";
10
- @import "toolbar";
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";
@@ -238,4 +238,63 @@
238
238
  text-decoration: none;
239
239
  }
240
240
  }
241
+
242
+ // ==========================================
243
+ // LIGHT THEME VARIANT
244
+ // ==========================================
245
+ &.theme-light {
246
+ color: #1e293b;
247
+
248
+ // Inline code - light theme
249
+ code {
250
+ background: #f1f5f9;
251
+ color: #0f172a;
252
+ }
253
+
254
+ // Code blocks - light theme
255
+ pre {
256
+ background: #f8fafc;
257
+ border: 1px solid #e2e8f0;
258
+
259
+ code {
260
+ background: transparent;
261
+ }
262
+ }
263
+
264
+ // Blockquotes - light theme
265
+ blockquote {
266
+ border-left-color: #cbd5e1;
267
+ color: #475569;
268
+ }
269
+
270
+ // Links - light theme
271
+ a {
272
+ color: #0369a1;
273
+ }
274
+
275
+ // Horizontal rules - light theme
276
+ hr {
277
+ border-top-color: #e2e8f0;
278
+ }
279
+
280
+ // Tables - light theme
281
+ table {
282
+ th, td {
283
+ border-color: #e2e8f0;
284
+ }
285
+
286
+ th {
287
+ background: #f1f5f9;
288
+ }
289
+
290
+ tr:nth-child(even) {
291
+ background: #f8fafc;
292
+ }
293
+ }
294
+
295
+ // Highlight - light theme
296
+ mark {
297
+ background: rgba(250, 204, 21, 0.5);
298
+ }
299
+ }
241
300
  }
@@ -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("&lt;script&gt;");
151
+ expect(result).not.toContain("<script>");
152
+ });
153
+ });
@@ -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
- additionalData: `@import "./src/styles/index.scss";`
37
+ api: "modern",
38
+ loadPaths: [resolve(__dirname, "src/styles")],
39
+ additionalData: `@use "index" as *;`
36
40
  }
37
41
  }
38
42
  }