quasar-ui-danx 0.5.0 → 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 (81) hide show
  1. package/.claude/settings.local.json +8 -0
  2. package/dist/danx.es.js +16119 -10641
  3. package/dist/danx.es.js.map +1 -1
  4. package/dist/danx.umd.js +202 -123
  5. package/dist/danx.umd.js.map +1 -1
  6. package/dist/style.css +1 -1
  7. package/package.json +8 -1
  8. package/src/components/Utility/Buttons/ActionButton.vue +15 -5
  9. package/src/components/Utility/Code/CodeViewer.vue +41 -16
  10. package/src/components/Utility/Code/CodeViewerCollapsed.vue +2 -0
  11. package/src/components/Utility/Code/CodeViewerFooter.vue +3 -1
  12. package/src/components/Utility/Code/LanguageBadge.vue +278 -5
  13. package/src/components/Utility/Code/MarkdownContent.vue +31 -163
  14. package/src/components/Utility/Code/index.ts +3 -0
  15. package/src/components/Utility/Markdown/ContextMenu.vue +314 -0
  16. package/src/components/Utility/Markdown/HotkeyHelpPopover.vue +259 -0
  17. package/src/components/Utility/Markdown/LineTypeMenu.vue +226 -0
  18. package/src/components/Utility/Markdown/LinkPopover.vue +331 -0
  19. package/src/components/Utility/Markdown/MarkdownEditor.vue +233 -0
  20. package/src/components/Utility/Markdown/MarkdownEditorContent.vue +296 -0
  21. package/src/components/Utility/Markdown/MarkdownEditorFooter.vue +50 -0
  22. package/src/components/Utility/Markdown/TablePopover.vue +420 -0
  23. package/src/components/Utility/Markdown/index.ts +11 -0
  24. package/src/components/Utility/Markdown/types.ts +27 -0
  25. package/src/components/Utility/Widgets/LabelPillWidget.vue +20 -0
  26. package/src/components/Utility/index.ts +1 -0
  27. package/src/composables/index.ts +1 -0
  28. package/src/composables/markdown/features/useBlockquotes.spec.ts +428 -0
  29. package/src/composables/markdown/features/useBlockquotes.ts +248 -0
  30. package/src/composables/markdown/features/useCodeBlockManager.ts +369 -0
  31. package/src/composables/markdown/features/useCodeBlocks.spec.ts +805 -0
  32. package/src/composables/markdown/features/useCodeBlocks.ts +774 -0
  33. package/src/composables/markdown/features/useContextMenu.ts +444 -0
  34. package/src/composables/markdown/features/useFocusTracking.ts +116 -0
  35. package/src/composables/markdown/features/useHeadings.spec.ts +834 -0
  36. package/src/composables/markdown/features/useHeadings.ts +290 -0
  37. package/src/composables/markdown/features/useInlineFormatting.spec.ts +705 -0
  38. package/src/composables/markdown/features/useInlineFormatting.ts +402 -0
  39. package/src/composables/markdown/features/useLineTypeMenu.ts +285 -0
  40. package/src/composables/markdown/features/useLinks.spec.ts +388 -0
  41. package/src/composables/markdown/features/useLinks.ts +374 -0
  42. package/src/composables/markdown/features/useLists.spec.ts +834 -0
  43. package/src/composables/markdown/features/useLists.ts +747 -0
  44. package/src/composables/markdown/features/usePopoverManager.ts +181 -0
  45. package/src/composables/markdown/features/useTables.spec.ts +1601 -0
  46. package/src/composables/markdown/features/useTables.ts +1107 -0
  47. package/src/composables/markdown/index.ts +16 -0
  48. package/src/composables/markdown/useMarkdownEditor.spec.ts +332 -0
  49. package/src/composables/markdown/useMarkdownEditor.ts +1077 -0
  50. package/src/composables/markdown/useMarkdownHotkeys.spec.ts +791 -0
  51. package/src/composables/markdown/useMarkdownHotkeys.ts +266 -0
  52. package/src/composables/markdown/useMarkdownSelection.ts +219 -0
  53. package/src/composables/markdown/useMarkdownSync.ts +549 -0
  54. package/src/composables/useCodeFormat.ts +17 -10
  55. package/src/composables/useCodeViewerEditor.spec.ts +655 -0
  56. package/src/composables/useCodeViewerEditor.ts +174 -20
  57. package/src/helpers/formats/highlightCSS.ts +236 -0
  58. package/src/helpers/formats/highlightHTML.ts +483 -0
  59. package/src/helpers/formats/highlightJavaScript.ts +346 -0
  60. package/src/helpers/formats/highlightSyntax.ts +15 -4
  61. package/src/helpers/formats/index.ts +3 -0
  62. package/src/helpers/formats/markdown/htmlToMarkdown/convertHeadings.ts +41 -0
  63. package/src/helpers/formats/markdown/htmlToMarkdown/index.spec.ts +489 -0
  64. package/src/helpers/formats/markdown/htmlToMarkdown/index.ts +425 -0
  65. package/src/helpers/formats/markdown/index.ts +7 -0
  66. package/src/helpers/formats/markdown/linePatterns.spec.ts +498 -0
  67. package/src/helpers/formats/markdown/linePatterns.ts +172 -0
  68. package/src/styles/danx.scss +3 -3
  69. package/src/styles/index.scss +5 -5
  70. package/src/styles/themes/danx/code.scss +257 -1
  71. package/src/styles/themes/danx/index.scss +10 -10
  72. package/src/styles/themes/danx/markdown.scss +59 -0
  73. package/src/test/helpers/editorTestUtils.spec.ts +296 -0
  74. package/src/test/helpers/editorTestUtils.ts +253 -0
  75. package/src/test/helpers/index.ts +1 -0
  76. package/src/test/highlighters.test.ts +153 -0
  77. package/src/test/setup.test.ts +12 -0
  78. package/src/test/setup.ts +12 -0
  79. package/src/types/widgets.d.ts +2 -2
  80. package/vite.config.js +5 -1
  81. package/vitest.config.ts +19 -0
@@ -0,0 +1,181 @@
1
+ import { ref, Ref } from "vue";
2
+ import { ShowLinkPopoverOptions } from "./useLinks";
3
+ import { ShowTablePopoverOptions } from "./useTables";
4
+
5
+ /**
6
+ * Position for popovers (x, y coordinates in viewport)
7
+ */
8
+ export interface PopoverPosition {
9
+ x: number;
10
+ y: number;
11
+ }
12
+
13
+ /**
14
+ * Return type for useLinkPopover composable
15
+ */
16
+ export interface UseLinkPopoverReturn {
17
+ /** Whether the link popover is currently visible */
18
+ isVisible: Ref<boolean>;
19
+ /** Position of the popover in viewport coordinates */
20
+ position: Ref<PopoverPosition>;
21
+ /** Existing URL when editing an existing link */
22
+ existingUrl: Ref<string | undefined>;
23
+ /** Selected text for label preview */
24
+ selectedText: Ref<string | undefined>;
25
+ /** Show the link popover with given options */
26
+ show: (options: ShowLinkPopoverOptions) => void;
27
+ /** Handle submit from the popover */
28
+ submit: (url: string, label?: string) => void;
29
+ /** Handle cancel from the popover */
30
+ cancel: () => void;
31
+ }
32
+
33
+ /**
34
+ * Return type for useTablePopover composable
35
+ */
36
+ export interface UseTablePopoverReturn {
37
+ /** Whether the table popover is currently visible */
38
+ isVisible: Ref<boolean>;
39
+ /** Position of the popover in viewport coordinates */
40
+ position: Ref<PopoverPosition>;
41
+ /** Show the table popover with given options */
42
+ show: (options: ShowTablePopoverOptions) => void;
43
+ /** Handle submit from the popover */
44
+ submit: (rows: number, cols: number) => void;
45
+ /** Handle cancel from the popover */
46
+ cancel: () => void;
47
+ }
48
+
49
+ /**
50
+ * Composable for managing link popover state
51
+ *
52
+ * This extracts popover state management from the component level,
53
+ * allowing the component to simply bind to refs and call methods.
54
+ */
55
+ export function useLinkPopover(): UseLinkPopoverReturn {
56
+ // Popover visibility state
57
+ const isVisible = ref(false);
58
+
59
+ // Popover position in viewport coordinates
60
+ const position = ref<PopoverPosition>({ x: 0, y: 0 });
61
+
62
+ // Existing URL when editing an existing link
63
+ const existingUrl = ref<string | undefined>(undefined);
64
+
65
+ // Selected text for label preview
66
+ const selectedText = ref<string | undefined>(undefined);
67
+
68
+ // Callbacks stored for submit/cancel - these are set when show() is called
69
+ let onSubmitCallback: ((url: string, label?: string) => void) | null = null;
70
+ let onCancelCallback: (() => void) | null = null;
71
+
72
+ /**
73
+ * Show the link popover with the given options
74
+ */
75
+ function show(options: ShowLinkPopoverOptions): void {
76
+ position.value = options.position;
77
+ existingUrl.value = options.existingUrl;
78
+ selectedText.value = options.selectedText;
79
+ onSubmitCallback = options.onSubmit;
80
+ onCancelCallback = options.onCancel;
81
+ isVisible.value = true;
82
+ }
83
+
84
+ /**
85
+ * Handle submit from the popover
86
+ */
87
+ function submit(url: string, label?: string): void {
88
+ isVisible.value = false;
89
+ if (onSubmitCallback) {
90
+ onSubmitCallback(url, label);
91
+ }
92
+ // Clear callbacks after use
93
+ onSubmitCallback = null;
94
+ onCancelCallback = null;
95
+ }
96
+
97
+ /**
98
+ * Handle cancel from the popover
99
+ */
100
+ function cancel(): void {
101
+ isVisible.value = false;
102
+ if (onCancelCallback) {
103
+ onCancelCallback();
104
+ }
105
+ // Clear callbacks after use
106
+ onSubmitCallback = null;
107
+ onCancelCallback = null;
108
+ }
109
+
110
+ return {
111
+ isVisible,
112
+ position,
113
+ existingUrl,
114
+ selectedText,
115
+ show,
116
+ submit,
117
+ cancel
118
+ };
119
+ }
120
+
121
+ /**
122
+ * Composable for managing table popover state
123
+ *
124
+ * This extracts popover state management from the component level,
125
+ * allowing the component to simply bind to refs and call methods.
126
+ */
127
+ export function useTablePopover(): UseTablePopoverReturn {
128
+ // Popover visibility state
129
+ const isVisible = ref(false);
130
+
131
+ // Popover position in viewport coordinates
132
+ const position = ref<PopoverPosition>({ x: 0, y: 0 });
133
+
134
+ // Callbacks stored for submit/cancel - these are set when show() is called
135
+ let onSubmitCallback: ((rows: number, cols: number) => void) | null = null;
136
+ let onCancelCallback: (() => void) | null = null;
137
+
138
+ /**
139
+ * Show the table popover with the given options
140
+ */
141
+ function show(options: ShowTablePopoverOptions): void {
142
+ position.value = options.position;
143
+ onSubmitCallback = options.onSubmit;
144
+ onCancelCallback = options.onCancel;
145
+ isVisible.value = true;
146
+ }
147
+
148
+ /**
149
+ * Handle submit from the popover
150
+ */
151
+ function submit(rows: number, cols: number): void {
152
+ isVisible.value = false;
153
+ if (onSubmitCallback) {
154
+ onSubmitCallback(rows, cols);
155
+ }
156
+ // Clear callbacks after use
157
+ onSubmitCallback = null;
158
+ onCancelCallback = null;
159
+ }
160
+
161
+ /**
162
+ * Handle cancel from the popover
163
+ */
164
+ function cancel(): void {
165
+ isVisible.value = false;
166
+ if (onCancelCallback) {
167
+ onCancelCallback();
168
+ }
169
+ // Clear callbacks after use
170
+ onSubmitCallback = null;
171
+ onCancelCallback = null;
172
+ }
173
+
174
+ return {
175
+ isVisible,
176
+ position,
177
+ show,
178
+ submit,
179
+ cancel
180
+ };
181
+ }