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.
- package/.claude/settings.local.json +8 -0
- package/dist/danx.es.js +16119 -10641
- package/dist/danx.es.js.map +1 -1
- package/dist/danx.umd.js +202 -123
- package/dist/danx.umd.js.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +8 -1
- package/src/components/Utility/Buttons/ActionButton.vue +15 -5
- package/src/components/Utility/Code/CodeViewer.vue +41 -16
- package/src/components/Utility/Code/CodeViewerCollapsed.vue +2 -0
- package/src/components/Utility/Code/CodeViewerFooter.vue +3 -1
- package/src/components/Utility/Code/LanguageBadge.vue +278 -5
- package/src/components/Utility/Code/MarkdownContent.vue +31 -163
- package/src/components/Utility/Code/index.ts +3 -0
- package/src/components/Utility/Markdown/ContextMenu.vue +314 -0
- package/src/components/Utility/Markdown/HotkeyHelpPopover.vue +259 -0
- package/src/components/Utility/Markdown/LineTypeMenu.vue +226 -0
- package/src/components/Utility/Markdown/LinkPopover.vue +331 -0
- package/src/components/Utility/Markdown/MarkdownEditor.vue +233 -0
- package/src/components/Utility/Markdown/MarkdownEditorContent.vue +296 -0
- package/src/components/Utility/Markdown/MarkdownEditorFooter.vue +50 -0
- package/src/components/Utility/Markdown/TablePopover.vue +420 -0
- package/src/components/Utility/Markdown/index.ts +11 -0
- package/src/components/Utility/Markdown/types.ts +27 -0
- package/src/components/Utility/Widgets/LabelPillWidget.vue +20 -0
- package/src/components/Utility/index.ts +1 -0
- package/src/composables/index.ts +1 -0
- package/src/composables/markdown/features/useBlockquotes.spec.ts +428 -0
- package/src/composables/markdown/features/useBlockquotes.ts +248 -0
- package/src/composables/markdown/features/useCodeBlockManager.ts +369 -0
- package/src/composables/markdown/features/useCodeBlocks.spec.ts +805 -0
- package/src/composables/markdown/features/useCodeBlocks.ts +774 -0
- package/src/composables/markdown/features/useContextMenu.ts +444 -0
- package/src/composables/markdown/features/useFocusTracking.ts +116 -0
- package/src/composables/markdown/features/useHeadings.spec.ts +834 -0
- package/src/composables/markdown/features/useHeadings.ts +290 -0
- package/src/composables/markdown/features/useInlineFormatting.spec.ts +705 -0
- package/src/composables/markdown/features/useInlineFormatting.ts +402 -0
- package/src/composables/markdown/features/useLineTypeMenu.ts +285 -0
- package/src/composables/markdown/features/useLinks.spec.ts +388 -0
- package/src/composables/markdown/features/useLinks.ts +374 -0
- package/src/composables/markdown/features/useLists.spec.ts +834 -0
- package/src/composables/markdown/features/useLists.ts +747 -0
- package/src/composables/markdown/features/usePopoverManager.ts +181 -0
- package/src/composables/markdown/features/useTables.spec.ts +1601 -0
- package/src/composables/markdown/features/useTables.ts +1107 -0
- package/src/composables/markdown/index.ts +16 -0
- package/src/composables/markdown/useMarkdownEditor.spec.ts +332 -0
- package/src/composables/markdown/useMarkdownEditor.ts +1077 -0
- package/src/composables/markdown/useMarkdownHotkeys.spec.ts +791 -0
- package/src/composables/markdown/useMarkdownHotkeys.ts +266 -0
- package/src/composables/markdown/useMarkdownSelection.ts +219 -0
- package/src/composables/markdown/useMarkdownSync.ts +549 -0
- package/src/composables/useCodeFormat.ts +17 -10
- package/src/composables/useCodeViewerEditor.spec.ts +655 -0
- package/src/composables/useCodeViewerEditor.ts +174 -20
- 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/convertHeadings.ts +41 -0
- package/src/helpers/formats/markdown/htmlToMarkdown/index.spec.ts +489 -0
- package/src/helpers/formats/markdown/htmlToMarkdown/index.ts +425 -0
- package/src/helpers/formats/markdown/index.ts +7 -0
- package/src/helpers/formats/markdown/linePatterns.spec.ts +498 -0
- package/src/helpers/formats/markdown/linePatterns.ts +172 -0
- 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 +59 -0
- package/src/test/helpers/editorTestUtils.spec.ts +296 -0
- package/src/test/helpers/editorTestUtils.ts +253 -0
- package/src/test/helpers/index.ts +1 -0
- package/src/test/highlighters.test.ts +153 -0
- package/src/test/setup.test.ts +12 -0
- package/src/test/setup.ts +12 -0
- package/src/types/widgets.d.ts +2 -2
- package/vite.config.js +5 -1
- 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
|
+
}
|