@m3ui-vue/m3ui-vue 0.8.8 → 0.9.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/README.md +25 -5
- package/dist/API.md +3661 -0
- package/dist/MIcon-CaEooCmZ.js.map +1 -1
- package/dist/{MMenuItem-5xojJYAL.js → MTextField-pJU1vFaR.js} +374 -364
- package/dist/MTextField-pJU1vFaR.js.map +1 -0
- package/dist/api.json +1 -0
- package/dist/barcode.js +9 -11
- package/dist/barcode.js.map +1 -1
- package/dist/chart.js.map +1 -1
- package/dist/code-editor.js +2 -2
- package/dist/code-editor.js.map +1 -1
- package/dist/components/MAbsolute.vue.d.ts +12 -0
- package/dist/components/MAlert.vue.d.ts +4 -0
- package/dist/components/MAppBar.vue.d.ts +12 -0
- package/dist/components/MAppLayout.vue.d.ts +2 -0
- package/dist/components/MAspectRatio.vue.d.ts +1 -0
- package/dist/components/MAutocomplete.vue.d.ts +18 -0
- package/dist/components/MAvatar.vue.d.ts +3 -0
- package/dist/components/MBadge.vue.d.ts +6 -0
- package/dist/components/MBar.vue.d.ts +5 -0
- package/dist/components/MBarcode.vue.d.ts +9 -0
- package/dist/components/MBottomSheet.vue.d.ts +3 -0
- package/dist/components/MBox.vue.d.ts +6 -0
- package/dist/components/MBreadcrumbs.vue.d.ts +2 -0
- package/dist/components/MButton.vue.d.ts +14 -4
- package/dist/components/MButtonGroup.vue.d.ts +7 -0
- package/dist/components/MCalendar.vue.d.ts +8 -0
- package/dist/components/MCard.vue.d.ts +17 -0
- package/dist/components/MCarousel.vue.d.ts +61 -36
- package/dist/components/MCenter.vue.d.ts +1 -0
- package/dist/components/MChart.vue.d.ts +7 -0
- package/dist/components/MChatBubble.vue.d.ts +10 -0
- package/dist/components/MCheckbox.vue.d.ts +5 -0
- package/dist/components/MChip.vue.d.ts +9 -0
- package/dist/components/MCircleProgressBar.vue.d.ts +7 -0
- package/dist/components/MCodeEditor.vue.d.ts +9 -0
- package/dist/components/MColorPicker.vue.d.ts +8 -0
- package/dist/components/MColorPickerModal.vue.d.ts +4 -0
- package/dist/components/MCommandPalette.vue.d.ts +8 -0
- package/dist/components/MConfirmDialog.vue.d.ts +7 -0
- package/dist/components/MContainer.vue.d.ts +4 -0
- package/dist/components/MContextMenu.vue.d.ts +3 -6
- package/dist/components/MCopyButton.vue.d.ts +10 -0
- package/dist/components/MDataTable.vue.d.ts +33 -12
- package/dist/components/MDatePicker.vue.d.ts +16 -0
- package/dist/components/MDatePickerModal.vue.d.ts +9 -0
- package/dist/components/MDateRangePicker.vue.d.ts +18 -0
- package/dist/components/MDateRangePickerModal.vue.d.ts +9 -0
- package/dist/components/MDialog.vue.d.ts +10 -6
- package/dist/components/MDivider.vue.d.ts +6 -0
- package/dist/components/MDragDropList.vue.d.ts +6 -0
- package/dist/components/MEmoji.vue.d.ts +6 -0
- package/dist/components/MEmojiButton.vue.d.ts +5 -0
- package/dist/components/MEmojiSelector.vue.d.ts +21 -5
- package/dist/components/MEmptyState.vue.d.ts +4 -0
- package/dist/components/MExpansionPanel.vue.d.ts +9 -0
- package/dist/components/MExportButton.vue.d.ts +8 -0
- package/dist/components/MFab.vue.d.ts +9 -0
- package/dist/components/MFabMenu.vue.d.ts +15 -1
- package/dist/components/MFileUpload.vue.d.ts +8 -0
- package/dist/components/MFixed.vue.d.ts +10 -0
- package/dist/components/MFlex.vue.d.ts +7 -1
- package/dist/components/MFooter.vue.d.ts +11 -0
- package/dist/components/MFullscreen.vue.d.ts +2 -0
- package/dist/components/MGrid.vue.d.ts +7 -0
- package/dist/components/MHotkeys.vue.d.ts +4 -0
- package/dist/components/MIcon.vue.d.ts +2 -0
- package/dist/components/MIconButton.vue.d.ts +10 -0
- package/dist/components/MInfiniteScroll.vue.d.ts +6 -0
- package/dist/components/MJsonEditor.vue.d.ts +8 -0
- package/dist/components/MJsonViewer.vue.d.ts +4 -0
- package/dist/components/MKanban.vue.d.ts +2 -0
- package/dist/components/MKbd.vue.d.ts +2 -0
- package/dist/components/MLightbox.vue.d.ts +19 -5
- package/dist/components/MList.vue.d.ts +7 -0
- package/dist/components/MListItem.vue.d.ts +24 -0
- package/dist/components/MListSubheader.vue.d.ts +6 -0
- package/dist/components/MLoadingIndicator.vue.d.ts +10 -0
- package/dist/components/MLoadingOverlay.vue.d.ts +5 -0
- package/dist/components/MMarkdown.vue.d.ts +3 -0
- package/dist/components/MMaskField.vue.d.ts +15 -0
- package/dist/components/MMasonry.vue.d.ts +5 -0
- package/dist/components/MMenu.vue.d.ts +3 -6
- package/dist/components/MMenuDivider.vue.d.ts +4 -0
- package/dist/components/MMenuItem.vue.d.ts +5 -0
- package/dist/components/MMultiAutocomplete.vue.d.ts +20 -0
- package/dist/components/MMultiSelect.vue.d.ts +21 -0
- package/dist/components/MNavigationBar.vue.d.ts +2 -0
- package/dist/components/MNavigationDrawer.vue.d.ts +11 -0
- package/dist/components/MNavigationRail.vue.d.ts +9 -6
- package/dist/components/MNavigationSuite.vue.d.ts +5 -3
- package/dist/components/MNumberField.vue.d.ts +17 -0
- package/dist/components/MOverlay.vue.d.ts +3 -0
- package/dist/components/MPageProgress.vue.d.ts +3 -0
- package/dist/components/MPagination.vue.d.ts +3 -0
- package/dist/components/MPasswordMeter.vue.d.ts +1 -0
- package/dist/components/MPinInput.vue.d.ts +11 -0
- package/dist/components/MProgressBar.vue.d.ts +6 -0
- package/dist/components/MPullToRefresh.vue.d.ts +8 -0
- package/dist/components/MQRCode.vue.d.ts +6 -0
- package/dist/components/MRadio.vue.d.ts +5 -0
- package/dist/components/MRadioGroup.vue.d.ts +6 -0
- package/dist/components/MRating.vue.d.ts +11 -0
- package/dist/components/MRelativeTime.vue.d.ts +1 -0
- package/dist/components/MResponsive.vue.d.ts +3 -0
- package/dist/components/MResult.vue.d.ts +6 -0
- package/dist/components/MRichTextEditor.vue.d.ts +8 -0
- package/dist/components/MScheduler.vue.d.ts +48 -1
- package/dist/components/MScrollable.vue.d.ts +3 -0
- package/dist/components/MSearchBar.vue.d.ts +6 -0
- package/dist/components/MSection.vue.d.ts +5 -0
- package/dist/components/MSegmentedButton.vue.d.ts +5 -0
- package/dist/components/MSelect.vue.d.ts +17 -0
- package/dist/components/MShader.vue.d.ts +1 -0
- package/dist/components/MShape.vue.d.ts +1 -1
- package/dist/components/MShortNavigationBar.vue.d.ts +8 -9
- package/dist/components/MSideSheet.vue.d.ts +3 -0
- package/dist/components/MSignaturePad.vue.d.ts +7 -0
- package/dist/components/MSimpleCarousel.vue.d.ts +12 -2
- package/dist/components/MSkeleton.vue.d.ts +8 -0
- package/dist/components/MSlider.vue.d.ts +15 -1
- package/dist/components/MSnackbar.vue.d.ts +1 -0
- package/dist/components/MSpinner.vue.d.ts +6 -0
- package/dist/components/MSplitButton.vue.d.ts +7 -0
- package/dist/components/MSplitter.vue.d.ts +4 -0
- package/dist/components/MSpotlightSearch.vue.d.ts +18 -0
- package/dist/components/MStack.vue.d.ts +8 -1
- package/dist/components/MStatCard.vue.d.ts +7 -0
- package/dist/components/MStepper.vue.d.ts +7 -0
- package/dist/components/MSticky.vue.d.ts +2 -0
- package/dist/components/MSubtitle.vue.d.ts +4 -0
- package/dist/components/MSwitch.vue.d.ts +5 -6
- package/dist/components/MTable.vue.d.ts +17 -4
- package/dist/components/MTabs.vue.d.ts +6 -0
- package/dist/components/MTagInput.vue.d.ts +17 -0
- package/dist/components/MTerminal.vue.d.ts +4 -0
- package/dist/components/MText.vue.d.ts +10 -0
- package/dist/components/MTextField.vue.d.ts +18 -0
- package/dist/components/MTimePicker.vue.d.ts +10 -0
- package/dist/components/MTimePickerModal.vue.d.ts +5 -0
- package/dist/components/MTimeline.vue.d.ts +3 -0
- package/dist/components/MTitle.vue.d.ts +4 -0
- package/dist/components/MToggleButton.vue.d.ts +4 -0
- package/dist/components/MToolbar.vue.d.ts +6 -1
- package/dist/components/MTooltip.vue.d.ts +7 -0
- package/dist/components/MTopAppBar.vue.d.ts +8 -0
- package/dist/components/MTour.vue.d.ts +5 -0
- package/dist/components/MTransferList.vue.d.ts +11 -0
- package/dist/components/MTree.vue.d.ts +11 -0
- package/dist/components/MTreeTable.vue.d.ts +7 -0
- package/dist/components/MVirtualTable.vue.d.ts +6 -0
- package/dist/components/MWindow.vue.d.ts +33 -1
- package/dist/composables/_carouselStrategy.d.ts +101 -0
- package/dist/composables/useLocale.d.ts +21 -0
- package/dist/data/emoji-names/emoji-names-de.d.ts +2 -0
- package/dist/data/emoji-names/emoji-names-en.d.ts +2 -0
- package/dist/data/emoji-names/emoji-names-es.d.ts +2 -0
- package/dist/data/emoji-names/emoji-names-fr.d.ts +2 -0
- package/dist/data/emoji-names/emoji-names-ja.d.ts +2 -0
- package/dist/data/emoji-names/emoji-names-ko.d.ts +2 -0
- package/dist/data/emoji-names/emoji-names-pt.d.ts +2 -0
- package/dist/data/emoji-names/emoji-names-zh.d.ts +2 -0
- package/dist/data/emojis.d.ts +7 -1
- package/dist/emoji-names-de-BphO5XpV.js +1877 -0
- package/dist/emoji-names-de-BphO5XpV.js.map +1 -0
- package/dist/emoji-names-en-9ZvMRvzi.js +1877 -0
- package/dist/emoji-names-en-9ZvMRvzi.js.map +1 -0
- package/dist/emoji-names-es-DvfWU3Pj.js +1877 -0
- package/dist/emoji-names-es-DvfWU3Pj.js.map +1 -0
- package/dist/emoji-names-fr-B-jhUlsP.js +1877 -0
- package/dist/emoji-names-fr-B-jhUlsP.js.map +1 -0
- package/dist/emoji-names-ja-l8cMFJo1.js +1877 -0
- package/dist/emoji-names-ja-l8cMFJo1.js.map +1 -0
- package/dist/emoji-names-ko-YP-o9G0c.js +1877 -0
- package/dist/emoji-names-ko-YP-o9G0c.js.map +1 -0
- package/dist/emoji-names-pt-DGj_Js4M.js +1877 -0
- package/dist/emoji-names-pt-DGj_Js4M.js.map +1 -0
- package/dist/emoji-names-zh-Dzecwtw_.js +1877 -0
- package/dist/emoji-names-zh-Dzecwtw_.js.map +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/locales/index.js +140 -7
- package/dist/locales/index.js.map +1 -1
- package/dist/m3ui-vue.css +1 -1
- package/dist/m3ui.js +6642 -5160
- package/dist/m3ui.js.map +1 -1
- package/dist/markdown.js +1 -1
- package/dist/markdown.js.map +1 -1
- package/dist/plugin.d.ts +6 -0
- package/dist/qrcode.js.map +1 -1
- package/dist/rich-text-editor.js +10 -10
- package/dist/rich-text-editor.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/terminal.js +34 -27
- package/dist/terminal.js.map +1 -1
- package/dist/{useLocale-D3ZWZ8jY.js → useLocale-Drihe5G2.js} +33 -11
- package/dist/useLocale-Drihe5G2.js.map +1 -0
- package/package.json +4 -2
- package/src/__tests__/MCarousel.test.ts +183 -21
- package/src/__tests__/MDialog.test.ts +18 -0
- package/src/__tests__/MEmojiSelector.test.ts +138 -0
- package/src/__tests__/MHotkeys.test.ts +57 -0
- package/src/__tests__/MLightbox.test.ts +313 -5
- package/src/__tests__/MScheduler.test.ts +122 -0
- package/src/__tests__/MTerminal.test.ts +63 -0
- package/src/__tests__/attrsFallthrough.test.ts +65 -0
- package/src/__tests__/hostLocale.test.ts +57 -0
- package/src/__tests__/plugin.test.ts +28 -1
- package/src/components/MAbsolute.vue +18 -0
- package/src/components/MAlert.vue +12 -0
- package/src/components/MAppBar.vue +12 -0
- package/src/components/MAppLayout.vue +11 -0
- package/src/components/MAspectRatio.vue +6 -0
- package/src/components/MAutocomplete.vue +24 -0
- package/src/components/MAvatar.vue +12 -1
- package/src/components/MBadge.vue +11 -0
- package/src/components/MBar.vue +19 -0
- package/src/components/MBarcode.vue +18 -2
- package/src/components/MBottomSheet.vue +13 -1
- package/src/components/MBox.vue +12 -0
- package/src/components/MBreadcrumbs.vue +7 -0
- package/src/components/MButton.vue +22 -4
- package/src/components/MButtonGroup.vue +13 -0
- package/src/components/MCalendar.vue +14 -0
- package/src/components/MCard.vue +26 -0
- package/src/components/MCarousel.vue +542 -200
- package/src/components/MCenter.vue +6 -0
- package/src/components/MChart.vue +12 -0
- package/src/components/MChatBubble.vue +17 -0
- package/src/components/MCheckbox.vue +11 -0
- package/src/components/MChip.vue +17 -0
- package/src/components/MCircleProgressBar.vue +13 -0
- package/src/components/MCodeEditor.vue +18 -2
- package/src/components/MColorPicker.vue +13 -0
- package/src/components/MColorPickerModal.vue +12 -0
- package/src/components/MCommandPalette.vue +17 -1
- package/src/components/MConfirmDialog.vue +15 -0
- package/src/components/MContainer.vue +9 -0
- package/src/components/MContextMenu.vue +20 -7
- package/src/components/MCopyButton.vue +16 -0
- package/src/components/MDataTable.vue +58 -12
- package/src/components/MDatePicker.vue +21 -0
- package/src/components/MDatePickerModal.vue +17 -1
- package/src/components/MDateRangePicker.vue +23 -0
- package/src/components/MDateRangePickerModal.vue +17 -1
- package/src/components/MDialog.vue +43 -10
- package/src/components/MDivider.vue +6 -0
- package/src/components/MDragDropList.vue +18 -0
- package/src/components/MEmoji.vue +6 -0
- package/src/components/MEmojiButton.vue +11 -0
- package/src/components/MEmojiSelector.vue +486 -78
- package/src/components/MEmptyState.vue +9 -0
- package/src/components/MExpansionPanel.vue +17 -0
- package/src/components/MExportButton.vue +15 -0
- package/src/components/MFab.vue +20 -1
- package/src/components/MFabMenu.vue +20 -0
- package/src/components/MFileUpload.vue +19 -0
- package/src/components/MFixed.vue +16 -0
- package/src/components/MFlex.vue +11 -0
- package/src/components/MFooter.vue +11 -0
- package/src/components/MFullscreen.vue +8 -0
- package/src/components/MGrid.vue +12 -0
- package/src/components/MHotkeys.vue +20 -13
- package/src/components/MIcon.vue +10 -1
- package/src/components/MIconButton.vue +13 -0
- package/src/components/MInfiniteScroll.vue +16 -0
- package/src/components/MJsonEditor.vue +13 -0
- package/src/components/MJsonViewer.vue +7 -0
- package/src/components/MKanban.vue +18 -0
- package/src/components/MKbd.vue +6 -0
- package/src/components/MLightbox.vue +766 -268
- package/src/components/MList.vue +15 -0
- package/src/components/MListDetail.vue +11 -0
- package/src/components/MListItem.vue +37 -0
- package/src/components/MListSubheader.vue +6 -0
- package/src/components/MLoadingIndicator.vue +15 -0
- package/src/components/MLoadingOverlay.vue +18 -1
- package/src/components/MMarkdown.vue +7 -0
- package/src/components/MMaskField.vue +21 -0
- package/src/components/MMasonry.vue +11 -0
- package/src/components/MMenu.vue +19 -7
- package/src/components/MMenuDivider.vue +4 -0
- package/src/components/MMenuItem.vue +16 -0
- package/src/components/MMultiAutocomplete.vue +26 -0
- package/src/components/MMultiSelect.vue +27 -0
- package/src/components/MNavigationBar.vue +7 -0
- package/src/components/MNavigationDrawer.vue +30 -1
- package/src/components/MNavigationRail.vue +27 -6
- package/src/components/MNavigationSuite.vue +20 -3
- package/src/components/MNotificationHost.vue +3 -0
- package/src/components/MNumberField.vue +24 -0
- package/src/components/MOverlay.vue +11 -0
- package/src/components/MPageProgress.vue +7 -0
- package/src/components/MPagination.vue +15 -1
- package/src/components/MPasswordMeter.vue +7 -0
- package/src/components/MPinInput.vue +19 -0
- package/src/components/MProgressBar.vue +9 -0
- package/src/components/MPullToRefresh.vue +17 -0
- package/src/components/MQRCode.vue +12 -0
- package/src/components/MRadio.vue +11 -0
- package/src/components/MRadioGroup.vue +11 -0
- package/src/components/MRating.vue +19 -0
- package/src/components/MRelative.vue +8 -0
- package/src/components/MRelativeTime.vue +6 -0
- package/src/components/MResponsive.vue +9 -0
- package/src/components/MResult.vue +14 -0
- package/src/components/MRichTextEditor.vue +14 -0
- package/src/components/MScheduler.vue +303 -115
- package/src/components/MScrollable.vue +8 -0
- package/src/components/MSearchBar.vue +17 -0
- package/src/components/MSection.vue +13 -0
- package/src/components/MSegmentedButton.vue +10 -0
- package/src/components/MSelect.vue +22 -0
- package/src/components/MShader.vue +13 -0
- package/src/components/MShape.vue +6 -0
- package/src/components/MShortNavigationBar.vue +23 -9
- package/src/components/MSideSheet.vue +14 -1
- package/src/components/MSignaturePad.vue +15 -0
- package/src/components/MSimpleCarousel.vue +18 -0
- package/src/components/MSkeleton.vue +8 -0
- package/src/components/MSlider.vue +21 -0
- package/src/components/MSnackbar.vue +5 -0
- package/src/components/MSpacer.vue +6 -0
- package/src/components/MSpinner.vue +10 -0
- package/src/components/MSplitButton.vue +17 -1
- package/src/components/MSplitter.vue +10 -0
- package/src/components/MSpotlightSearch.vue +28 -1
- package/src/components/MStack.vue +12 -0
- package/src/components/MStatCard.vue +13 -0
- package/src/components/MStepper.vue +12 -0
- package/src/components/MSticky.vue +7 -0
- package/src/components/MSubtitle.vue +9 -0
- package/src/components/MSupportingPane.vue +10 -0
- package/src/components/MSwitch.vue +14 -6
- package/src/components/MTable.vue +33 -4
- package/src/components/MTabs.vue +12 -0
- package/src/components/MTagInput.vue +23 -0
- package/src/components/MTerminal.vue +33 -10
- package/src/components/MText.vue +15 -0
- package/src/components/MTextField.vue +26 -0
- package/src/components/MTimePicker.vue +15 -0
- package/src/components/MTimePickerModal.vue +13 -1
- package/src/components/MTimeline.vue +7 -0
- package/src/components/MTitle.vue +9 -0
- package/src/components/MToggleButton.vue +12 -0
- package/src/components/MToolbar.vue +12 -0
- package/src/components/MTooltip.vue +18 -0
- package/src/components/MTopAppBar.vue +18 -0
- package/src/components/MTour.vue +15 -2
- package/src/components/MTransferList.vue +24 -0
- package/src/components/MTree.vue +11 -0
- package/src/components/MTreeTable.vue +15 -0
- package/src/components/MVirtualTable.vue +12 -0
- package/src/components/MWindow.vue +34 -0
- package/src/composables/_carouselStrategy.ts +712 -0
- package/src/composables/useLocale.ts +54 -3
- package/src/data/emoji-names/emoji-names-de.ts +1875 -0
- package/src/data/emoji-names/emoji-names-en.ts +1875 -0
- package/src/data/emoji-names/emoji-names-es.ts +1875 -0
- package/src/data/emoji-names/emoji-names-fr.ts +1875 -0
- package/src/data/emoji-names/emoji-names-ja.ts +1875 -0
- package/src/data/emoji-names/emoji-names-ko.ts +1875 -0
- package/src/data/emoji-names/emoji-names-pt.ts +1875 -0
- package/src/data/emoji-names/emoji-names-zh.ts +1875 -0
- package/src/data/emojis.ts +29 -198
- package/src/index.ts +2 -2
- package/src/locales/de.ts +19 -0
- package/src/locales/es.ts +19 -0
- package/src/locales/fr.ts +19 -0
- package/src/locales/ja.ts +19 -0
- package/src/locales/ko.ts +19 -0
- package/src/locales/pt.ts +19 -0
- package/src/locales/zh.ts +19 -0
- package/src/plugin.ts +14 -2
- package/dist/MMenuItem-5xojJYAL.js.map +0 -1
- package/dist/useLocale-D3ZWZ8jY.js.map +0 -1
package/dist/markdown.js
CHANGED
package/dist/markdown.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"markdown.js","names":[],"sources":["../src/components/MMarkdown.vue","../src/components/MMarkdown.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed, ref, onMounted } from 'vue'\n\nconst props = withDefaults(\n defineProps<{\n source: string\n breaks?: boolean\n linkify?: boolean\n }>(),\n { breaks: true, linkify: true },\n)\n\nconst md = ref<any>(null)\n\nfunction parseCodeInfo(info: string) {\n const parts = info.trim().split(/\\s+/)\n let lang = ''\n let copy = false\n const lines: number[] = []\n\n for (const part of parts) {\n if (part === 'copy') {\n copy = true\n } else if (/^\\{[\\d,\\s-]+\\}$/.test(part)) {\n for (const seg of part.slice(1, -1).split(',')) {\n const range = seg.trim().split('-')\n if (range.length === 2) {\n const a = parseInt(range[0]!), b = parseInt(range[1]!)\n for (let i = a; i <= b; i++) lines.push(i)\n } else {\n lines.push(parseInt(range[0]!))\n }\n }\n } else if (!lang) {\n lang = part\n }\n }\n\n return { lang, copy, lines }\n}\n\nonMounted(async () => {\n const { default: MarkdownIt } = await import('markdown-it')\n\n let hljs: any = null\n try {\n const mod = await import('highlight.js/lib/common')\n hljs = mod.default\n } catch {}\n\n const instance = new MarkdownIt({\n html: false,\n breaks: props.breaks,\n linkify: props.linkify,\n typographer: true,\n })\n\n const esc = instance.utils.escapeHtml\n\n instance.renderer.rules.fence = (tokens: any, idx: number) => {\n const token = tokens[idx]\n const { lang, copy, lines } = parseCodeInfo(token.info)\n const raw = token.content\n\n let highlighted: string\n if (hljs && lang && hljs.getLanguage(lang)) {\n highlighted = hljs.highlight(raw, { language: lang, ignoreIllegals: true }).value\n } else {\n highlighted = esc(raw)\n }\n\n if (lines.length > 0) {\n const codeLines = highlighted.split('\\n')\n if (codeLines.length && codeLines[codeLines.length - 1] === '') codeLines.pop()\n highlighted = codeLines.map((line, i) => {\n const cls = lines.includes(i + 1) ? ' m3-line-hl' : ''\n return `<span class=\"m3-code-line${cls}\">${line}\\n</span>`\n }).join('')\n }\n\n const copyBtn = copy\n ? '<button class=\"m3-code-copy\" type=\"button\" title=\"Copy\"><span class=\"material-symbols-outlined\" style=\"font-size:18px\">content_copy</span></button>'\n : ''\n\n return `<div class=\"m3-code-block\">${copyBtn}<pre><code${lang ? ` class=\"language-${esc(lang)}\"` : ''}>${highlighted}</code></pre></div>\\n`\n }\n\n instance.renderer.rules.link_open = (tokens: any, idx: number, options: any, _env: any, self: any) => {\n const token = tokens[idx]\n if (token) {\n token.attrSet('target', '_blank')\n token.attrSet('rel', 'noopener noreferrer')\n }\n return self.renderToken(tokens, idx, options)\n }\n\n md.value = instance\n})\n\nconst rendered = computed(() => md.value ? md.value.render(props.source) : '')\n\nfunction onContainerClick(e: MouseEvent) {\n const btn = (e.target as HTMLElement).closest('.m3-code-copy') as HTMLElement | null\n if (!btn) return\n const code = btn.closest('.m3-code-block')?.querySelector('code')\n if (!code) return\n navigator.clipboard.writeText(code.textContent || '')\n const icon = btn.querySelector('span')\n if (icon) {\n icon.textContent = 'check'\n setTimeout(() => { icon.textContent = 'content_copy' }, 1500)\n }\n}\n</script>\n\n<template>\n <div class=\"m3-markdown text-body-large text-on-surface\" v-html=\"rendered\" @click=\"onContainerClick\" />\n</template>\n\n<style scoped>\n.m3-markdown :deep(h1) { font-size: var(--text-headline-large); line-height: var(--text-headline-large--line-height); font-weight: 600; margin: 1em 0 0.5em; color: var(--color-on-surface); }\n.m3-markdown :deep(h2) { font-size: var(--text-headline-medium); line-height: var(--text-headline-medium--line-height); font-weight: 600; margin: 1em 0 0.5em; color: var(--color-on-surface); }\n.m3-markdown :deep(h3) { font-size: var(--text-headline-small); line-height: var(--text-headline-small--line-height); font-weight: 600; margin: 0.75em 0 0.25em; color: var(--color-on-surface); }\n.m3-markdown :deep(h4) { font-size: var(--text-title-large); line-height: var(--text-title-large--line-height); font-weight: 600; margin: 0.75em 0 0.25em; color: var(--color-on-surface); }\n\n.m3-markdown :deep(p) { margin: 0.5em 0; }\n\n.m3-markdown :deep(a) {\n color: var(--color-primary);\n text-decoration: underline;\n text-underline-offset: 2px;\n}\n.m3-markdown :deep(a:hover) { opacity: 0.8; }\n\n.m3-markdown :deep(strong) { font-weight: 600; color: var(--color-on-surface); }\n.m3-markdown :deep(em) { font-style: italic; }\n\n.m3-markdown :deep(ul) { list-style-type: disc; padding-left: 1.5em; margin: 0.5em 0; }\n.m3-markdown :deep(ol) { list-style-type: decimal; padding-left: 1.5em; margin: 0.5em 0; }\n.m3-markdown :deep(li) { margin: 0.25em 0; }\n.m3-markdown :deep(li::marker) { color: var(--color-on-surface-variant); }\n\n.m3-markdown :deep(blockquote) {\n border-left: 3px solid var(--color-primary);\n padding: 0.5em 1em;\n margin: 0.75em 0;\n background: var(--color-surface-container);\n border-radius: 0 8px 8px 0;\n color: var(--color-on-surface-variant);\n}\n\n.m3-markdown :deep(code) {\n background: var(--color-surface-container-highest);\n padding: 0.15em 0.4em;\n border-radius: 4px;\n font-family: var(--font-mono, 'Roboto Mono', monospace);\n font-size: 0.875em;\n color: var(--color-primary);\n}\n\n.m3-markdown :deep(pre) {\n background: var(--color-surface-container-highest);\n padding: 1em;\n border-radius: 12px;\n overflow-x: auto;\n margin: 0.75em 0;\n border: 1px solid var(--color-outline-variant);\n}\n.m3-markdown :deep(pre code) {\n background: none;\n padding: 0;\n color: var(--color-on-surface);\n font-size: 0.8125rem;\n line-height: 1.6;\n}\n\n/* Syntax highlighting — matches MCodeEditor M3 palette */\n.m3-markdown :deep(.hljs-keyword),\n.m3-markdown :deep(.hljs-selector-tag),\n.m3-markdown :deep(.hljs-built_in),\n.m3-markdown :deep(.hljs-tag .hljs-keyword) { color: var(--color-primary); }\n\n.m3-markdown :deep(.hljs-string),\n.m3-markdown :deep(.hljs-regexp),\n.m3-markdown :deep(.hljs-template-variable) { color: var(--color-tertiary); }\n\n.m3-markdown :deep(.hljs-number),\n.m3-markdown :deep(.hljs-literal) { color: var(--color-error); }\n\n.m3-markdown :deep(.hljs-title.function_),\n.m3-markdown :deep(.hljs-title.function_>.hljs-keyword) { color: var(--color-secondary); font-weight: 500; }\n\n.m3-markdown :deep(.hljs-type),\n.m3-markdown :deep(.hljs-title.class_) { color: var(--color-primary); font-style: italic; }\n\n.m3-markdown :deep(.hljs-comment),\n.m3-markdown :deep(.hljs-quote) { color: var(--color-outline); font-style: italic; }\n\n.m3-markdown :deep(.hljs-attr),\n.m3-markdown :deep(.hljs-attribute) { color: var(--color-tertiary); }\n\n.m3-markdown :deep(.hljs-tag) { color: var(--color-on-surface-variant); }\n.m3-markdown :deep(.hljs-name) { color: var(--color-primary); }\n\n.m3-markdown :deep(.hljs-punctuation),\n.m3-markdown :deep(.hljs-operator) { color: var(--color-on-surface-variant); }\n\n.m3-markdown :deep(.hljs-meta),\n.m3-markdown :deep(.hljs-meta .hljs-keyword) { color: var(--color-on-surface-variant); }\n\n.m3-markdown :deep(.hljs-variable),\n.m3-markdown :deep(.hljs-property) { color: var(--color-on-surface); }\n\n.m3-markdown :deep(.hljs-symbol),\n.m3-markdown :deep(.hljs-params) { color: var(--color-on-surface); }\n\n/* Code block wrapper */\n.m3-markdown :deep(.m3-code-block) { position: relative; }\n\n/* Copy button */\n.m3-markdown :deep(.m3-code-copy) {\n position: absolute;\n top: 8px;\n right: 8px;\n display: flex;\n align-items: center;\n justify-content: center;\n width: 28px;\n height: 28px;\n border-radius: 6px;\n border: none;\n background: var(--color-surface-container);\n color: var(--color-on-surface-variant);\n cursor: pointer;\n opacity: 0;\n transition: opacity 0.15s;\n z-index: 1;\n}\n.m3-markdown :deep(.m3-code-block:hover .m3-code-copy) { opacity: 1; }\n.m3-markdown :deep(.m3-code-copy:hover) { background: var(--color-surface-container-high); color: var(--color-on-surface); }\n\n/* Line highlighting */\n.m3-markdown :deep(.m3-code-line) { display: block; }\n.m3-markdown :deep(.m3-line-hl) {\n background: color-mix(in srgb, var(--color-primary) 8%, transparent);\n margin: 0 -1em;\n padding: 0 1em;\n border-left: 2px solid color-mix(in srgb, var(--color-primary) 40%, transparent);\n padding-left: calc(1em - 2px);\n}\n\n.m3-markdown :deep(hr) {\n border: none;\n border-top: 1px solid var(--color-outline-variant);\n margin: 1.5em 0;\n}\n\n.m3-markdown :deep(table) {\n width: 100%;\n border-collapse: collapse;\n margin: 0.75em 0;\n}\n.m3-markdown :deep(th) {\n background: var(--color-surface-container);\n font-weight: 600;\n text-align: left;\n padding: 0.5em 0.75em;\n border-bottom: 2px solid var(--color-outline-variant);\n font-size: var(--text-label-large);\n color: var(--color-on-surface);\n}\n.m3-markdown :deep(td) {\n padding: 0.5em 0.75em;\n border-bottom: 1px solid var(--color-outline-variant);\n}\n\n.m3-markdown :deep(img) {\n max-width: 100%;\n height: auto;\n border-radius: 12px;\n margin: 0.5em 0;\n}\n</style>\n","<script setup lang=\"ts\">\nimport { computed, ref, onMounted } from 'vue'\n\nconst props = withDefaults(\n defineProps<{\n source: string\n breaks?: boolean\n linkify?: boolean\n }>(),\n { breaks: true, linkify: true },\n)\n\nconst md = ref<any>(null)\n\nfunction parseCodeInfo(info: string) {\n const parts = info.trim().split(/\\s+/)\n let lang = ''\n let copy = false\n const lines: number[] = []\n\n for (const part of parts) {\n if (part === 'copy') {\n copy = true\n } else if (/^\\{[\\d,\\s-]+\\}$/.test(part)) {\n for (const seg of part.slice(1, -1).split(',')) {\n const range = seg.trim().split('-')\n if (range.length === 2) {\n const a = parseInt(range[0]!), b = parseInt(range[1]!)\n for (let i = a; i <= b; i++) lines.push(i)\n } else {\n lines.push(parseInt(range[0]!))\n }\n }\n } else if (!lang) {\n lang = part\n }\n }\n\n return { lang, copy, lines }\n}\n\nonMounted(async () => {\n const { default: MarkdownIt } = await import('markdown-it')\n\n let hljs: any = null\n try {\n const mod = await import('highlight.js/lib/common')\n hljs = mod.default\n } catch {}\n\n const instance = new MarkdownIt({\n html: false,\n breaks: props.breaks,\n linkify: props.linkify,\n typographer: true,\n })\n\n const esc = instance.utils.escapeHtml\n\n instance.renderer.rules.fence = (tokens: any, idx: number) => {\n const token = tokens[idx]\n const { lang, copy, lines } = parseCodeInfo(token.info)\n const raw = token.content\n\n let highlighted: string\n if (hljs && lang && hljs.getLanguage(lang)) {\n highlighted = hljs.highlight(raw, { language: lang, ignoreIllegals: true }).value\n } else {\n highlighted = esc(raw)\n }\n\n if (lines.length > 0) {\n const codeLines = highlighted.split('\\n')\n if (codeLines.length && codeLines[codeLines.length - 1] === '') codeLines.pop()\n highlighted = codeLines.map((line, i) => {\n const cls = lines.includes(i + 1) ? ' m3-line-hl' : ''\n return `<span class=\"m3-code-line${cls}\">${line}\\n</span>`\n }).join('')\n }\n\n const copyBtn = copy\n ? '<button class=\"m3-code-copy\" type=\"button\" title=\"Copy\"><span class=\"material-symbols-outlined\" style=\"font-size:18px\">content_copy</span></button>'\n : ''\n\n return `<div class=\"m3-code-block\">${copyBtn}<pre><code${lang ? ` class=\"language-${esc(lang)}\"` : ''}>${highlighted}</code></pre></div>\\n`\n }\n\n instance.renderer.rules.link_open = (tokens: any, idx: number, options: any, _env: any, self: any) => {\n const token = tokens[idx]\n if (token) {\n token.attrSet('target', '_blank')\n token.attrSet('rel', 'noopener noreferrer')\n }\n return self.renderToken(tokens, idx, options)\n }\n\n md.value = instance\n})\n\nconst rendered = computed(() => md.value ? md.value.render(props.source) : '')\n\nfunction onContainerClick(e: MouseEvent) {\n const btn = (e.target as HTMLElement).closest('.m3-code-copy') as HTMLElement | null\n if (!btn) return\n const code = btn.closest('.m3-code-block')?.querySelector('code')\n if (!code) return\n navigator.clipboard.writeText(code.textContent || '')\n const icon = btn.querySelector('span')\n if (icon) {\n icon.textContent = 'check'\n setTimeout(() => { icon.textContent = 'content_copy' }, 1500)\n }\n}\n</script>\n\n<template>\n <div class=\"m3-markdown text-body-large text-on-surface\" v-html=\"rendered\" @click=\"onContainerClick\" />\n</template>\n\n<style scoped>\n.m3-markdown :deep(h1) { font-size: var(--text-headline-large); line-height: var(--text-headline-large--line-height); font-weight: 600; margin: 1em 0 0.5em; color: var(--color-on-surface); }\n.m3-markdown :deep(h2) { font-size: var(--text-headline-medium); line-height: var(--text-headline-medium--line-height); font-weight: 600; margin: 1em 0 0.5em; color: var(--color-on-surface); }\n.m3-markdown :deep(h3) { font-size: var(--text-headline-small); line-height: var(--text-headline-small--line-height); font-weight: 600; margin: 0.75em 0 0.25em; color: var(--color-on-surface); }\n.m3-markdown :deep(h4) { font-size: var(--text-title-large); line-height: var(--text-title-large--line-height); font-weight: 600; margin: 0.75em 0 0.25em; color: var(--color-on-surface); }\n\n.m3-markdown :deep(p) { margin: 0.5em 0; }\n\n.m3-markdown :deep(a) {\n color: var(--color-primary);\n text-decoration: underline;\n text-underline-offset: 2px;\n}\n.m3-markdown :deep(a:hover) { opacity: 0.8; }\n\n.m3-markdown :deep(strong) { font-weight: 600; color: var(--color-on-surface); }\n.m3-markdown :deep(em) { font-style: italic; }\n\n.m3-markdown :deep(ul) { list-style-type: disc; padding-left: 1.5em; margin: 0.5em 0; }\n.m3-markdown :deep(ol) { list-style-type: decimal; padding-left: 1.5em; margin: 0.5em 0; }\n.m3-markdown :deep(li) { margin: 0.25em 0; }\n.m3-markdown :deep(li::marker) { color: var(--color-on-surface-variant); }\n\n.m3-markdown :deep(blockquote) {\n border-left: 3px solid var(--color-primary);\n padding: 0.5em 1em;\n margin: 0.75em 0;\n background: var(--color-surface-container);\n border-radius: 0 8px 8px 0;\n color: var(--color-on-surface-variant);\n}\n\n.m3-markdown :deep(code) {\n background: var(--color-surface-container-highest);\n padding: 0.15em 0.4em;\n border-radius: 4px;\n font-family: var(--font-mono, 'Roboto Mono', monospace);\n font-size: 0.875em;\n color: var(--color-primary);\n}\n\n.m3-markdown :deep(pre) {\n background: var(--color-surface-container-highest);\n padding: 1em;\n border-radius: 12px;\n overflow-x: auto;\n margin: 0.75em 0;\n border: 1px solid var(--color-outline-variant);\n}\n.m3-markdown :deep(pre code) {\n background: none;\n padding: 0;\n color: var(--color-on-surface);\n font-size: 0.8125rem;\n line-height: 1.6;\n}\n\n/* Syntax highlighting — matches MCodeEditor M3 palette */\n.m3-markdown :deep(.hljs-keyword),\n.m3-markdown :deep(.hljs-selector-tag),\n.m3-markdown :deep(.hljs-built_in),\n.m3-markdown :deep(.hljs-tag .hljs-keyword) { color: var(--color-primary); }\n\n.m3-markdown :deep(.hljs-string),\n.m3-markdown :deep(.hljs-regexp),\n.m3-markdown :deep(.hljs-template-variable) { color: var(--color-tertiary); }\n\n.m3-markdown :deep(.hljs-number),\n.m3-markdown :deep(.hljs-literal) { color: var(--color-error); }\n\n.m3-markdown :deep(.hljs-title.function_),\n.m3-markdown :deep(.hljs-title.function_>.hljs-keyword) { color: var(--color-secondary); font-weight: 500; }\n\n.m3-markdown :deep(.hljs-type),\n.m3-markdown :deep(.hljs-title.class_) { color: var(--color-primary); font-style: italic; }\n\n.m3-markdown :deep(.hljs-comment),\n.m3-markdown :deep(.hljs-quote) { color: var(--color-outline); font-style: italic; }\n\n.m3-markdown :deep(.hljs-attr),\n.m3-markdown :deep(.hljs-attribute) { color: var(--color-tertiary); }\n\n.m3-markdown :deep(.hljs-tag) { color: var(--color-on-surface-variant); }\n.m3-markdown :deep(.hljs-name) { color: var(--color-primary); }\n\n.m3-markdown :deep(.hljs-punctuation),\n.m3-markdown :deep(.hljs-operator) { color: var(--color-on-surface-variant); }\n\n.m3-markdown :deep(.hljs-meta),\n.m3-markdown :deep(.hljs-meta .hljs-keyword) { color: var(--color-on-surface-variant); }\n\n.m3-markdown :deep(.hljs-variable),\n.m3-markdown :deep(.hljs-property) { color: var(--color-on-surface); }\n\n.m3-markdown :deep(.hljs-symbol),\n.m3-markdown :deep(.hljs-params) { color: var(--color-on-surface); }\n\n/* Code block wrapper */\n.m3-markdown :deep(.m3-code-block) { position: relative; }\n\n/* Copy button */\n.m3-markdown :deep(.m3-code-copy) {\n position: absolute;\n top: 8px;\n right: 8px;\n display: flex;\n align-items: center;\n justify-content: center;\n width: 28px;\n height: 28px;\n border-radius: 6px;\n border: none;\n background: var(--color-surface-container);\n color: var(--color-on-surface-variant);\n cursor: pointer;\n opacity: 0;\n transition: opacity 0.15s;\n z-index: 1;\n}\n.m3-markdown :deep(.m3-code-block:hover .m3-code-copy) { opacity: 1; }\n.m3-markdown :deep(.m3-code-copy:hover) { background: var(--color-surface-container-high); color: var(--color-on-surface); }\n\n/* Line highlighting */\n.m3-markdown :deep(.m3-code-line) { display: block; }\n.m3-markdown :deep(.m3-line-hl) {\n background: color-mix(in srgb, var(--color-primary) 8%, transparent);\n margin: 0 -1em;\n padding: 0 1em;\n border-left: 2px solid color-mix(in srgb, var(--color-primary) 40%, transparent);\n padding-left: calc(1em - 2px);\n}\n\n.m3-markdown :deep(hr) {\n border: none;\n border-top: 1px solid var(--color-outline-variant);\n margin: 1.5em 0;\n}\n\n.m3-markdown :deep(table) {\n width: 100%;\n border-collapse: collapse;\n margin: 0.75em 0;\n}\n.m3-markdown :deep(th) {\n background: var(--color-surface-container);\n font-weight: 600;\n text-align: left;\n padding: 0.5em 0.75em;\n border-bottom: 2px solid var(--color-outline-variant);\n font-size: var(--text-label-large);\n color: var(--color-on-surface);\n}\n.m3-markdown :deep(td) {\n padding: 0.5em 0.75em;\n border-bottom: 1px solid var(--color-outline-variant);\n}\n\n.m3-markdown :deep(img) {\n max-width: 100%;\n height: auto;\n border-radius: 12px;\n margin: 0.5em 0;\n}\n</style>\n"],"mappings":";;;;;;;;;;;;;;;;;EAGA,IAAM,IAAQ,GASR,IAAK,EAAS,IAAI;EAExB,SAAS,EAAc,GAAc;GACnC,IAAM,IAAQ,EAAK,KAAK,CAAC,CAAC,MAAM,KAA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9E,IAAc,EAAU,KAAK,GAAM,MAE1B,4BADK,EAAM,SAAS,IAAI,CAAC,IAAI,gBAAgB,GACb,IAAI,EAAK,UACjD,CAAC,CAAC,KAAK,EAAE;IACZ;IAMA,OAAO,8BAJS,IACZ,kKACA,GAEyC,YAAY,IAAO,oBAAoB,EAAI,CAAI,EAAE,KAAK,GAAG,GAAG,EAAY;GACvH,GAEA,EAAS,SAAS,MAAM,aAAa,GAAa,GAAa,GAAc,GAAW,MAAc;IACpG,IAAM,IAAQ,EAAO;IAKrB,OAJI,MACF,EAAM,QAAQ,UAAU,QAAQ,GAChC,EAAM,QAAQ,OAAO,qBAAqB,IAErC,EAAK,YAAY,GAAQ,GAAK,CAAO;GAC9C,GAEA,EAAG,QAAQ;EACb,CAAC;EAED,IAAM,IAAW,QAAe,EAAG,QAAQ,EAAG,MAAM,OAAO,EAAM,MAAM,IAAI,EAAE;EAE7E,SAAS,EAAiB,GAAe;GACvC,IAAM,IAAO,EAAE,OAAuB,QAAQ,eAAe;GAC7D,IAAI,CAAC,GAAK;GACV,IAAM,IAAO,EAAI,QAAQ,gBAAgB,CAAC,EAAE,cAAc,MAAM;GAChE,IAAI,CAAC,GAAM;GACX,UAAU,UAAU,UAAU,EAAK,eAAe,EAAE;GACpD,IAAM,IAAO,EAAI,cAAc,MAAM;GACrC,AAAI,MACF,EAAK,cAAc,SACnB,iBAAiB;IAAE,EAAK,cAAc;GAAe,GAAG,IAAI;EAEhE;oBAIE,EAAA,GAAA,EAAuG,OAAA;GAAlG,OAAM;GAA8C,WAAQ,EAAA;GAAW,SAAO"}
|
|
1
|
+
{"version":3,"file":"markdown.js","names":[],"sources":["../src/components/MMarkdown.vue","../src/components/MMarkdown.vue"],"sourcesContent":["<script setup lang=\"ts\">\n/**\n * Renders markdown source as styled HTML — headings, lists, tables, blockquotes, links, and fenced code blocks\n * with optional syntax highlighting, line highlighting, and a copy button.\n */\nimport { computed, ref, onMounted } from 'vue'\n\nconst props = withDefaults(\n defineProps<{\n /** Markdown source text */\n source: string\n /** Convert single newlines to `<br>` */\n breaks?: boolean\n /** Auto-detect bare URLs and turn them into links */\n linkify?: boolean\n }>(),\n { breaks: true, linkify: true },\n)\n\nconst md = ref<any>(null)\n\nfunction parseCodeInfo(info: string) {\n const parts = info.trim().split(/\\s+/)\n let lang = ''\n let copy = false\n const lines: number[] = []\n\n for (const part of parts) {\n if (part === 'copy') {\n copy = true\n } else if (/^\\{[\\d,\\s-]+\\}$/.test(part)) {\n for (const seg of part.slice(1, -1).split(',')) {\n const range = seg.trim().split('-')\n if (range.length === 2) {\n const a = parseInt(range[0]!), b = parseInt(range[1]!)\n for (let i = a; i <= b; i++) lines.push(i)\n } else {\n lines.push(parseInt(range[0]!))\n }\n }\n } else if (!lang) {\n lang = part\n }\n }\n\n return { lang, copy, lines }\n}\n\nonMounted(async () => {\n const { default: MarkdownIt } = await import('markdown-it')\n\n let hljs: any = null\n try {\n const mod = await import('highlight.js/lib/common')\n hljs = mod.default\n } catch {}\n\n const instance = new MarkdownIt({\n html: false,\n breaks: props.breaks,\n linkify: props.linkify,\n typographer: true,\n })\n\n const esc = instance.utils.escapeHtml\n\n instance.renderer.rules.fence = (tokens: any, idx: number) => {\n const token = tokens[idx]\n const { lang, copy, lines } = parseCodeInfo(token.info)\n const raw = token.content\n\n let highlighted: string\n if (hljs && lang && hljs.getLanguage(lang)) {\n highlighted = hljs.highlight(raw, { language: lang, ignoreIllegals: true }).value\n } else {\n highlighted = esc(raw)\n }\n\n if (lines.length > 0) {\n const codeLines = highlighted.split('\\n')\n if (codeLines.length && codeLines[codeLines.length - 1] === '') codeLines.pop()\n highlighted = codeLines.map((line, i) => {\n const cls = lines.includes(i + 1) ? ' m3-line-hl' : ''\n return `<span class=\"m3-code-line${cls}\">${line}\\n</span>`\n }).join('')\n }\n\n const copyBtn = copy\n ? '<button class=\"m3-code-copy\" type=\"button\" title=\"Copy\"><span class=\"material-symbols-outlined\" style=\"font-size:18px\">content_copy</span></button>'\n : ''\n\n return `<div class=\"m3-code-block\">${copyBtn}<pre><code${lang ? ` class=\"language-${esc(lang)}\"` : ''}>${highlighted}</code></pre></div>\\n`\n }\n\n instance.renderer.rules.link_open = (tokens: any, idx: number, options: any, _env: any, self: any) => {\n const token = tokens[idx]\n if (token) {\n token.attrSet('target', '_blank')\n token.attrSet('rel', 'noopener noreferrer')\n }\n return self.renderToken(tokens, idx, options)\n }\n\n md.value = instance\n})\n\nconst rendered = computed(() => md.value ? md.value.render(props.source) : '')\n\nfunction onContainerClick(e: MouseEvent) {\n const btn = (e.target as HTMLElement).closest('.m3-code-copy') as HTMLElement | null\n if (!btn) return\n const code = btn.closest('.m3-code-block')?.querySelector('code')\n if (!code) return\n navigator.clipboard.writeText(code.textContent || '')\n const icon = btn.querySelector('span')\n if (icon) {\n icon.textContent = 'check'\n setTimeout(() => { icon.textContent = 'content_copy' }, 1500)\n }\n}\n</script>\n\n<template>\n <div class=\"m3-markdown text-body-large text-on-surface\" v-html=\"rendered\" @click=\"onContainerClick\" />\n</template>\n\n<style scoped>\n.m3-markdown :deep(h1) { font-size: var(--text-headline-large); line-height: var(--text-headline-large--line-height); font-weight: 600; margin: 1em 0 0.5em; color: var(--color-on-surface); }\n.m3-markdown :deep(h2) { font-size: var(--text-headline-medium); line-height: var(--text-headline-medium--line-height); font-weight: 600; margin: 1em 0 0.5em; color: var(--color-on-surface); }\n.m3-markdown :deep(h3) { font-size: var(--text-headline-small); line-height: var(--text-headline-small--line-height); font-weight: 600; margin: 0.75em 0 0.25em; color: var(--color-on-surface); }\n.m3-markdown :deep(h4) { font-size: var(--text-title-large); line-height: var(--text-title-large--line-height); font-weight: 600; margin: 0.75em 0 0.25em; color: var(--color-on-surface); }\n\n.m3-markdown :deep(p) { margin: 0.5em 0; }\n\n.m3-markdown :deep(a) {\n color: var(--color-primary);\n text-decoration: underline;\n text-underline-offset: 2px;\n}\n.m3-markdown :deep(a:hover) { opacity: 0.8; }\n\n.m3-markdown :deep(strong) { font-weight: 600; color: var(--color-on-surface); }\n.m3-markdown :deep(em) { font-style: italic; }\n\n.m3-markdown :deep(ul) { list-style-type: disc; padding-left: 1.5em; margin: 0.5em 0; }\n.m3-markdown :deep(ol) { list-style-type: decimal; padding-left: 1.5em; margin: 0.5em 0; }\n.m3-markdown :deep(li) { margin: 0.25em 0; }\n.m3-markdown :deep(li::marker) { color: var(--color-on-surface-variant); }\n\n.m3-markdown :deep(blockquote) {\n border-left: 3px solid var(--color-primary);\n padding: 0.5em 1em;\n margin: 0.75em 0;\n background: var(--color-surface-container);\n border-radius: 0 8px 8px 0;\n color: var(--color-on-surface-variant);\n}\n\n.m3-markdown :deep(code) {\n background: var(--color-surface-container-highest);\n padding: 0.15em 0.4em;\n border-radius: 4px;\n font-family: var(--font-mono, 'Roboto Mono', monospace);\n font-size: 0.875em;\n color: var(--color-primary);\n}\n\n.m3-markdown :deep(pre) {\n background: var(--color-surface-container-highest);\n padding: 1em;\n border-radius: 12px;\n overflow-x: auto;\n margin: 0.75em 0;\n border: 1px solid var(--color-outline-variant);\n}\n.m3-markdown :deep(pre code) {\n background: none;\n padding: 0;\n color: var(--color-on-surface);\n font-size: 0.8125rem;\n line-height: 1.6;\n}\n\n/* Syntax highlighting — matches MCodeEditor M3 palette */\n.m3-markdown :deep(.hljs-keyword),\n.m3-markdown :deep(.hljs-selector-tag),\n.m3-markdown :deep(.hljs-built_in),\n.m3-markdown :deep(.hljs-tag .hljs-keyword) { color: var(--color-primary); }\n\n.m3-markdown :deep(.hljs-string),\n.m3-markdown :deep(.hljs-regexp),\n.m3-markdown :deep(.hljs-template-variable) { color: var(--color-tertiary); }\n\n.m3-markdown :deep(.hljs-number),\n.m3-markdown :deep(.hljs-literal) { color: var(--color-error); }\n\n.m3-markdown :deep(.hljs-title.function_),\n.m3-markdown :deep(.hljs-title.function_>.hljs-keyword) { color: var(--color-secondary); font-weight: 500; }\n\n.m3-markdown :deep(.hljs-type),\n.m3-markdown :deep(.hljs-title.class_) { color: var(--color-primary); font-style: italic; }\n\n.m3-markdown :deep(.hljs-comment),\n.m3-markdown :deep(.hljs-quote) { color: var(--color-outline); font-style: italic; }\n\n.m3-markdown :deep(.hljs-attr),\n.m3-markdown :deep(.hljs-attribute) { color: var(--color-tertiary); }\n\n.m3-markdown :deep(.hljs-tag) { color: var(--color-on-surface-variant); }\n.m3-markdown :deep(.hljs-name) { color: var(--color-primary); }\n\n.m3-markdown :deep(.hljs-punctuation),\n.m3-markdown :deep(.hljs-operator) { color: var(--color-on-surface-variant); }\n\n.m3-markdown :deep(.hljs-meta),\n.m3-markdown :deep(.hljs-meta .hljs-keyword) { color: var(--color-on-surface-variant); }\n\n.m3-markdown :deep(.hljs-variable),\n.m3-markdown :deep(.hljs-property) { color: var(--color-on-surface); }\n\n.m3-markdown :deep(.hljs-symbol),\n.m3-markdown :deep(.hljs-params) { color: var(--color-on-surface); }\n\n/* Code block wrapper */\n.m3-markdown :deep(.m3-code-block) { position: relative; }\n\n/* Copy button */\n.m3-markdown :deep(.m3-code-copy) {\n position: absolute;\n top: 8px;\n right: 8px;\n display: flex;\n align-items: center;\n justify-content: center;\n width: 28px;\n height: 28px;\n border-radius: 6px;\n border: none;\n background: var(--color-surface-container);\n color: var(--color-on-surface-variant);\n cursor: pointer;\n opacity: 0;\n transition: opacity 0.15s;\n z-index: 1;\n}\n.m3-markdown :deep(.m3-code-block:hover .m3-code-copy) { opacity: 1; }\n.m3-markdown :deep(.m3-code-copy:hover) { background: var(--color-surface-container-high); color: var(--color-on-surface); }\n\n/* Line highlighting */\n.m3-markdown :deep(.m3-code-line) { display: block; }\n.m3-markdown :deep(.m3-line-hl) {\n background: color-mix(in srgb, var(--color-primary) 8%, transparent);\n margin: 0 -1em;\n padding: 0 1em;\n border-left: 2px solid color-mix(in srgb, var(--color-primary) 40%, transparent);\n padding-left: calc(1em - 2px);\n}\n\n.m3-markdown :deep(hr) {\n border: none;\n border-top: 1px solid var(--color-outline-variant);\n margin: 1.5em 0;\n}\n\n.m3-markdown :deep(table) {\n width: 100%;\n border-collapse: collapse;\n margin: 0.75em 0;\n}\n.m3-markdown :deep(th) {\n background: var(--color-surface-container);\n font-weight: 600;\n text-align: left;\n padding: 0.5em 0.75em;\n border-bottom: 2px solid var(--color-outline-variant);\n font-size: var(--text-label-large);\n color: var(--color-on-surface);\n}\n.m3-markdown :deep(td) {\n padding: 0.5em 0.75em;\n border-bottom: 1px solid var(--color-outline-variant);\n}\n\n.m3-markdown :deep(img) {\n max-width: 100%;\n height: auto;\n border-radius: 12px;\n margin: 0.5em 0;\n}\n</style>\n","<script setup lang=\"ts\">\n/**\n * Renders markdown source as styled HTML — headings, lists, tables, blockquotes, links, and fenced code blocks\n * with optional syntax highlighting, line highlighting, and a copy button.\n */\nimport { computed, ref, onMounted } from 'vue'\n\nconst props = withDefaults(\n defineProps<{\n /** Markdown source text */\n source: string\n /** Convert single newlines to `<br>` */\n breaks?: boolean\n /** Auto-detect bare URLs and turn them into links */\n linkify?: boolean\n }>(),\n { breaks: true, linkify: true },\n)\n\nconst md = ref<any>(null)\n\nfunction parseCodeInfo(info: string) {\n const parts = info.trim().split(/\\s+/)\n let lang = ''\n let copy = false\n const lines: number[] = []\n\n for (const part of parts) {\n if (part === 'copy') {\n copy = true\n } else if (/^\\{[\\d,\\s-]+\\}$/.test(part)) {\n for (const seg of part.slice(1, -1).split(',')) {\n const range = seg.trim().split('-')\n if (range.length === 2) {\n const a = parseInt(range[0]!), b = parseInt(range[1]!)\n for (let i = a; i <= b; i++) lines.push(i)\n } else {\n lines.push(parseInt(range[0]!))\n }\n }\n } else if (!lang) {\n lang = part\n }\n }\n\n return { lang, copy, lines }\n}\n\nonMounted(async () => {\n const { default: MarkdownIt } = await import('markdown-it')\n\n let hljs: any = null\n try {\n const mod = await import('highlight.js/lib/common')\n hljs = mod.default\n } catch {}\n\n const instance = new MarkdownIt({\n html: false,\n breaks: props.breaks,\n linkify: props.linkify,\n typographer: true,\n })\n\n const esc = instance.utils.escapeHtml\n\n instance.renderer.rules.fence = (tokens: any, idx: number) => {\n const token = tokens[idx]\n const { lang, copy, lines } = parseCodeInfo(token.info)\n const raw = token.content\n\n let highlighted: string\n if (hljs && lang && hljs.getLanguage(lang)) {\n highlighted = hljs.highlight(raw, { language: lang, ignoreIllegals: true }).value\n } else {\n highlighted = esc(raw)\n }\n\n if (lines.length > 0) {\n const codeLines = highlighted.split('\\n')\n if (codeLines.length && codeLines[codeLines.length - 1] === '') codeLines.pop()\n highlighted = codeLines.map((line, i) => {\n const cls = lines.includes(i + 1) ? ' m3-line-hl' : ''\n return `<span class=\"m3-code-line${cls}\">${line}\\n</span>`\n }).join('')\n }\n\n const copyBtn = copy\n ? '<button class=\"m3-code-copy\" type=\"button\" title=\"Copy\"><span class=\"material-symbols-outlined\" style=\"font-size:18px\">content_copy</span></button>'\n : ''\n\n return `<div class=\"m3-code-block\">${copyBtn}<pre><code${lang ? ` class=\"language-${esc(lang)}\"` : ''}>${highlighted}</code></pre></div>\\n`\n }\n\n instance.renderer.rules.link_open = (tokens: any, idx: number, options: any, _env: any, self: any) => {\n const token = tokens[idx]\n if (token) {\n token.attrSet('target', '_blank')\n token.attrSet('rel', 'noopener noreferrer')\n }\n return self.renderToken(tokens, idx, options)\n }\n\n md.value = instance\n})\n\nconst rendered = computed(() => md.value ? md.value.render(props.source) : '')\n\nfunction onContainerClick(e: MouseEvent) {\n const btn = (e.target as HTMLElement).closest('.m3-code-copy') as HTMLElement | null\n if (!btn) return\n const code = btn.closest('.m3-code-block')?.querySelector('code')\n if (!code) return\n navigator.clipboard.writeText(code.textContent || '')\n const icon = btn.querySelector('span')\n if (icon) {\n icon.textContent = 'check'\n setTimeout(() => { icon.textContent = 'content_copy' }, 1500)\n }\n}\n</script>\n\n<template>\n <div class=\"m3-markdown text-body-large text-on-surface\" v-html=\"rendered\" @click=\"onContainerClick\" />\n</template>\n\n<style scoped>\n.m3-markdown :deep(h1) { font-size: var(--text-headline-large); line-height: var(--text-headline-large--line-height); font-weight: 600; margin: 1em 0 0.5em; color: var(--color-on-surface); }\n.m3-markdown :deep(h2) { font-size: var(--text-headline-medium); line-height: var(--text-headline-medium--line-height); font-weight: 600; margin: 1em 0 0.5em; color: var(--color-on-surface); }\n.m3-markdown :deep(h3) { font-size: var(--text-headline-small); line-height: var(--text-headline-small--line-height); font-weight: 600; margin: 0.75em 0 0.25em; color: var(--color-on-surface); }\n.m3-markdown :deep(h4) { font-size: var(--text-title-large); line-height: var(--text-title-large--line-height); font-weight: 600; margin: 0.75em 0 0.25em; color: var(--color-on-surface); }\n\n.m3-markdown :deep(p) { margin: 0.5em 0; }\n\n.m3-markdown :deep(a) {\n color: var(--color-primary);\n text-decoration: underline;\n text-underline-offset: 2px;\n}\n.m3-markdown :deep(a:hover) { opacity: 0.8; }\n\n.m3-markdown :deep(strong) { font-weight: 600; color: var(--color-on-surface); }\n.m3-markdown :deep(em) { font-style: italic; }\n\n.m3-markdown :deep(ul) { list-style-type: disc; padding-left: 1.5em; margin: 0.5em 0; }\n.m3-markdown :deep(ol) { list-style-type: decimal; padding-left: 1.5em; margin: 0.5em 0; }\n.m3-markdown :deep(li) { margin: 0.25em 0; }\n.m3-markdown :deep(li::marker) { color: var(--color-on-surface-variant); }\n\n.m3-markdown :deep(blockquote) {\n border-left: 3px solid var(--color-primary);\n padding: 0.5em 1em;\n margin: 0.75em 0;\n background: var(--color-surface-container);\n border-radius: 0 8px 8px 0;\n color: var(--color-on-surface-variant);\n}\n\n.m3-markdown :deep(code) {\n background: var(--color-surface-container-highest);\n padding: 0.15em 0.4em;\n border-radius: 4px;\n font-family: var(--font-mono, 'Roboto Mono', monospace);\n font-size: 0.875em;\n color: var(--color-primary);\n}\n\n.m3-markdown :deep(pre) {\n background: var(--color-surface-container-highest);\n padding: 1em;\n border-radius: 12px;\n overflow-x: auto;\n margin: 0.75em 0;\n border: 1px solid var(--color-outline-variant);\n}\n.m3-markdown :deep(pre code) {\n background: none;\n padding: 0;\n color: var(--color-on-surface);\n font-size: 0.8125rem;\n line-height: 1.6;\n}\n\n/* Syntax highlighting — matches MCodeEditor M3 palette */\n.m3-markdown :deep(.hljs-keyword),\n.m3-markdown :deep(.hljs-selector-tag),\n.m3-markdown :deep(.hljs-built_in),\n.m3-markdown :deep(.hljs-tag .hljs-keyword) { color: var(--color-primary); }\n\n.m3-markdown :deep(.hljs-string),\n.m3-markdown :deep(.hljs-regexp),\n.m3-markdown :deep(.hljs-template-variable) { color: var(--color-tertiary); }\n\n.m3-markdown :deep(.hljs-number),\n.m3-markdown :deep(.hljs-literal) { color: var(--color-error); }\n\n.m3-markdown :deep(.hljs-title.function_),\n.m3-markdown :deep(.hljs-title.function_>.hljs-keyword) { color: var(--color-secondary); font-weight: 500; }\n\n.m3-markdown :deep(.hljs-type),\n.m3-markdown :deep(.hljs-title.class_) { color: var(--color-primary); font-style: italic; }\n\n.m3-markdown :deep(.hljs-comment),\n.m3-markdown :deep(.hljs-quote) { color: var(--color-outline); font-style: italic; }\n\n.m3-markdown :deep(.hljs-attr),\n.m3-markdown :deep(.hljs-attribute) { color: var(--color-tertiary); }\n\n.m3-markdown :deep(.hljs-tag) { color: var(--color-on-surface-variant); }\n.m3-markdown :deep(.hljs-name) { color: var(--color-primary); }\n\n.m3-markdown :deep(.hljs-punctuation),\n.m3-markdown :deep(.hljs-operator) { color: var(--color-on-surface-variant); }\n\n.m3-markdown :deep(.hljs-meta),\n.m3-markdown :deep(.hljs-meta .hljs-keyword) { color: var(--color-on-surface-variant); }\n\n.m3-markdown :deep(.hljs-variable),\n.m3-markdown :deep(.hljs-property) { color: var(--color-on-surface); }\n\n.m3-markdown :deep(.hljs-symbol),\n.m3-markdown :deep(.hljs-params) { color: var(--color-on-surface); }\n\n/* Code block wrapper */\n.m3-markdown :deep(.m3-code-block) { position: relative; }\n\n/* Copy button */\n.m3-markdown :deep(.m3-code-copy) {\n position: absolute;\n top: 8px;\n right: 8px;\n display: flex;\n align-items: center;\n justify-content: center;\n width: 28px;\n height: 28px;\n border-radius: 6px;\n border: none;\n background: var(--color-surface-container);\n color: var(--color-on-surface-variant);\n cursor: pointer;\n opacity: 0;\n transition: opacity 0.15s;\n z-index: 1;\n}\n.m3-markdown :deep(.m3-code-block:hover .m3-code-copy) { opacity: 1; }\n.m3-markdown :deep(.m3-code-copy:hover) { background: var(--color-surface-container-high); color: var(--color-on-surface); }\n\n/* Line highlighting */\n.m3-markdown :deep(.m3-code-line) { display: block; }\n.m3-markdown :deep(.m3-line-hl) {\n background: color-mix(in srgb, var(--color-primary) 8%, transparent);\n margin: 0 -1em;\n padding: 0 1em;\n border-left: 2px solid color-mix(in srgb, var(--color-primary) 40%, transparent);\n padding-left: calc(1em - 2px);\n}\n\n.m3-markdown :deep(hr) {\n border: none;\n border-top: 1px solid var(--color-outline-variant);\n margin: 1.5em 0;\n}\n\n.m3-markdown :deep(table) {\n width: 100%;\n border-collapse: collapse;\n margin: 0.75em 0;\n}\n.m3-markdown :deep(th) {\n background: var(--color-surface-container);\n font-weight: 600;\n text-align: left;\n padding: 0.5em 0.75em;\n border-bottom: 2px solid var(--color-outline-variant);\n font-size: var(--text-label-large);\n color: var(--color-on-surface);\n}\n.m3-markdown :deep(td) {\n padding: 0.5em 0.75em;\n border-bottom: 1px solid var(--color-outline-variant);\n}\n\n.m3-markdown :deep(img) {\n max-width: 100%;\n height: auto;\n border-radius: 12px;\n margin: 0.5em 0;\n}\n</style>\n"],"mappings":";;;;;;;;;;;;;;;;;EAOA,IAAM,IAAQ,GAYR,IAAK,EAAS,IAAI;EAExB,SAAS,EAAc,GAAc;GACnC,IAAM,IAAQ,EAAK,KAAK,CAAC,CAAC,MAAM,KAAK,GACjC,IAAO,IACP,IAAO,IACL,IAAkB,CAAC;GAEzB,KAAK,IAAM,KAAQ,GACjB,IAAI,MAAS,QACX,IAAO;QACF,IAAI,kBAAkB,KAAK,CAAI,GACpC,KAAK,IAAM,KAAO,EAAK,MAAM,GAAG,EAAE,CAAC,CAAC,MAAM,GAAG,GAAG;IAC9C,IAAM,IAAQ,EAAI,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ACvH,GAEA,EAAS,SAAS,MAAM,aAAa,GAAa,GAAa,GAAc,GAAW,MAAc;IACpG,IAAM,IAAQ,EAAO;IAKrB,OAJI,MACF,EAAM,QAAQ,UAAU,QAAQ,GAChC,EAAM,QAAQ,OAAO,qBAAqB,IAErC,EAAK,YAAY,GAAQ,GAAK,CAAO;GAC9C,GAEA,EAAG,QAAQ;EACb,CAAC;EAED,IAAM,IAAW,QAAe,EAAG,QAAQ,EAAG,MAAM,OAAO,EAAM,MAAM,IAAI,EAAE;EAE7E,SAAS,EAAiB,GAAe;GACvC,IAAM,IAAO,EAAE,OAAuB,QAAQ,eAAe;GAC7D,IAAI,CAAC,GAAK;GACV,IAAM,IAAO,EAAI,QAAQ,gBAAgB,CAAC,EAAE,cAAc,MAAM;GAChE,IAAI,CAAC,GAAM;GACX,UAAU,UAAU,UAAU,EAAK,eAAe,EAAE;GACpD,IAAM,IAAO,EAAI,cAAc,MAAM;GACrC,AAAI,MACF,EAAK,cAAc,SACnB,iBAAiB;IAAE,EAAK,cAAc;GAAe,GAAG,IAAI;EAEhE;oBAIE,EAAA,GAAA,EAAuG,OAAA;GAAlG,OAAM;GAA8C,WAAQ,EAAA;GAAW,SAAO"}
|
package/dist/plugin.d.ts
CHANGED
|
@@ -12,6 +12,12 @@ export interface M3UIOptions {
|
|
|
12
12
|
* and any later choice persists and wins over it).
|
|
13
13
|
*/
|
|
14
14
|
persistPalette?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Palettes of your own, added to `useColorPalette().palettes` so palette pickers built from
|
|
17
|
+
* that list show them. An entry whose `id` matches a built-in palette replaces it. Each one
|
|
18
|
+
* still needs its CSS: `[data-palette='<id>'] { --color-primary: ...; }` plus a
|
|
19
|
+
* `[data-palette='<id>'].dark { ... }` block, overriding the same tokens as `palettes.css`.
|
|
20
|
+
*/
|
|
15
21
|
customPalettes?: Palette[];
|
|
16
22
|
locale?: MaybeRef<Partial<M3Locale>>;
|
|
17
23
|
}
|
package/dist/qrcode.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"qrcode.js","names":[],"sources":["../src/components/MQRCode.vue","../src/components/MQRCode.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed } from 'vue'\nimport QRCode from 'qrcode-generator'\n\nconst props = withDefaults(\n defineProps<{\n value: string\n size?: number\n /** Quiet zone around the code, in modules. */\n margin?: number\n errorCorrectionLevel?: 'L' | 'M' | 'Q' | 'H'\n color?: string\n background?: string\n label?: string\n /** Rounds the outer container corners. */\n rounded?: boolean\n /** 'square' is the classic scannable pixel grid. 'dots' rounds each module — still fully scannable, just a softer look. */\n moduleStyle?: 'square' | 'dots'\n }>(),\n {\n size: 200,\n margin: 4,\n errorCorrectionLevel: 'M',\n color: '#000000',\n background: '#ffffff',\n rounded: true,\n moduleStyle: 'square',\n },\n)\n\n// qr and error are derived together in one computed so they can never be\n// read out of sync with each other (e.g. a template `v-if=\"error\"` seeing a\n// stale value from before `qr` — which sets it — was actually evaluated).\nconst result = computed(() => {\n try {\n const instance = QRCode(0, props.errorCorrectionLevel)\n instance.addData(props.value)\n instance.make()\n return { qr: instance, error: null as string | null }\n } catch (err) {\n // qrcode-generator throws plain strings (e.g. \"code length overflow...\")\n const message = typeof err === 'string' ? err : err instanceof Error ? err.message : 'Failed to generate QR code'\n return { qr: null, error: message }\n }\n})\n\nconst qr = computed(() => result.value.qr)\nconst error = computed(() => result.value.error)\n\nconst moduleCount = computed(() => qr.value?.getModuleCount() ?? 0)\nconst totalModules = computed(() => moduleCount.value + props.margin * 2)\nconst moduleSize = computed(() => (totalModules.value > 0 ? props.size / totalModules.value : 0))\nconst containerRadius = computed(() => (props.rounded ? props.size * 0.06 : 0))\n\n// A corner rounds only when neither of its two perpendicular neighbors is\n// also dark — otherwise adjacent modules (e.g. the finder-pattern squares,\n// or any run of touching pixels) would each round independently and leave\n// visible notches instead of merging into one smooth shape.\nfunction roundedRectPath(x: number, y: number, s: number, rTL: number, rTR: number, rBR: number, rBL: number): string {\n return `M${x + rTL},${y} H${x + s - rTR} A${rTR},${rTR} 0 0 1 ${x + s},${y + rTR} V${y + s - rBR} A${rBR},${rBR} 0 0 1 ${x + s - rBR},${y + s} H${x + rBL} A${rBL},${rBL} 0 0 1 ${x},${y + s - rBL} V${y + rTL} A${rTL},${rTL} 0 0 1 ${x + rTL},${y} Z`\n}\n\nconst cells = computed(() => {\n const result: { x: number; y: number; d?: string }[] = []\n const inst = qr.value\n if (!inst) return result\n const count = moduleCount.value\n const s = moduleSize.value\n const isDark = (row: number, col: number) => row >= 0 && row < count && col >= 0 && col < count && inst.isDark(row, col)\n\n for (let row = 0; row < count; row++) {\n for (let col = 0; col < count; col++) {\n if (!isDark(row, col)) continue\n const x = (col + props.margin) * s\n const y = (row + props.margin) * s\n\n if (props.moduleStyle !== 'dots') {\n result.push({ x, y })\n continue\n }\n\n const radius = s / 2\n const up = isDark(row - 1, col)\n const down = isDark(row + 1, col)\n const left = isDark(row, col - 1)\n const right = isDark(row, col + 1)\n result.push({\n x, y,\n d: roundedRectPath(\n x, y, s,\n up || left ? 0 : radius,\n up || right ? 0 : radius,\n down || right ? 0 : radius,\n down || left ? 0 : radius,\n ),\n })\n }\n }\n return result\n})\n</script>\n\n<template>\n <div v-if=\"error\" class=\"flex items-center justify-center text-body-small text-error\" :style=\"{ width: `${size}px`, height: `${size}px` }\">\n <slot name=\"error\">{{ error }}</slot>\n </div>\n <svg\n v-else\n :width=\"size\"\n :height=\"size\"\n :viewBox=\"`0 0 ${size} ${size}`\"\n role=\"img\"\n :aria-label=\"label ?? value\"\n >\n <rect x=\"0\" y=\"0\" :width=\"size\" :height=\"size\" :rx=\"containerRadius\" :ry=\"containerRadius\" :fill=\"background\" />\n <template v-if=\"moduleStyle === 'dots'\">\n <path v-for=\"(cell, i) in cells\" :key=\"i\" :d=\"cell.d\" :fill=\"color\" />\n </template>\n <template v-else>\n <rect\n v-for=\"(cell, i) in cells\"\n :key=\"i\"\n :x=\"cell.x\"\n :y=\"cell.y\"\n :width=\"moduleSize\"\n :height=\"moduleSize\"\n :fill=\"color\"\n />\n </template>\n </svg>\n</template>\n","<script setup lang=\"ts\">\nimport { computed } from 'vue'\nimport QRCode from 'qrcode-generator'\n\nconst props = withDefaults(\n defineProps<{\n value: string\n size?: number\n /** Quiet zone around the code, in modules. */\n margin?: number\n errorCorrectionLevel?: 'L' | 'M' | 'Q' | 'H'\n color?: string\n background?: string\n label?: string\n /** Rounds the outer container corners. */\n rounded?: boolean\n /** 'square' is the classic scannable pixel grid. 'dots' rounds each module — still fully scannable, just a softer look. */\n moduleStyle?: 'square' | 'dots'\n }>(),\n {\n size: 200,\n margin: 4,\n errorCorrectionLevel: 'M',\n color: '#000000',\n background: '#ffffff',\n rounded: true,\n moduleStyle: 'square',\n },\n)\n\n// qr and error are derived together in one computed so they can never be\n// read out of sync with each other (e.g. a template `v-if=\"error\"` seeing a\n// stale value from before `qr` — which sets it — was actually evaluated).\nconst result = computed(() => {\n try {\n const instance = QRCode(0, props.errorCorrectionLevel)\n instance.addData(props.value)\n instance.make()\n return { qr: instance, error: null as string | null }\n } catch (err) {\n // qrcode-generator throws plain strings (e.g. \"code length overflow...\")\n const message = typeof err === 'string' ? err : err instanceof Error ? err.message : 'Failed to generate QR code'\n return { qr: null, error: message }\n }\n})\n\nconst qr = computed(() => result.value.qr)\nconst error = computed(() => result.value.error)\n\nconst moduleCount = computed(() => qr.value?.getModuleCount() ?? 0)\nconst totalModules = computed(() => moduleCount.value + props.margin * 2)\nconst moduleSize = computed(() => (totalModules.value > 0 ? props.size / totalModules.value : 0))\nconst containerRadius = computed(() => (props.rounded ? props.size * 0.06 : 0))\n\n// A corner rounds only when neither of its two perpendicular neighbors is\n// also dark — otherwise adjacent modules (e.g. the finder-pattern squares,\n// or any run of touching pixels) would each round independently and leave\n// visible notches instead of merging into one smooth shape.\nfunction roundedRectPath(x: number, y: number, s: number, rTL: number, rTR: number, rBR: number, rBL: number): string {\n return `M${x + rTL},${y} H${x + s - rTR} A${rTR},${rTR} 0 0 1 ${x + s},${y + rTR} V${y + s - rBR} A${rBR},${rBR} 0 0 1 ${x + s - rBR},${y + s} H${x + rBL} A${rBL},${rBL} 0 0 1 ${x},${y + s - rBL} V${y + rTL} A${rTL},${rTL} 0 0 1 ${x + rTL},${y} Z`\n}\n\nconst cells = computed(() => {\n const result: { x: number; y: number; d?: string }[] = []\n const inst = qr.value\n if (!inst) return result\n const count = moduleCount.value\n const s = moduleSize.value\n const isDark = (row: number, col: number) => row >= 0 && row < count && col >= 0 && col < count && inst.isDark(row, col)\n\n for (let row = 0; row < count; row++) {\n for (let col = 0; col < count; col++) {\n if (!isDark(row, col)) continue\n const x = (col + props.margin) * s\n const y = (row + props.margin) * s\n\n if (props.moduleStyle !== 'dots') {\n result.push({ x, y })\n continue\n }\n\n const radius = s / 2\n const up = isDark(row - 1, col)\n const down = isDark(row + 1, col)\n const left = isDark(row, col - 1)\n const right = isDark(row, col + 1)\n result.push({\n x, y,\n d: roundedRectPath(\n x, y, s,\n up || left ? 0 : radius,\n up || right ? 0 : radius,\n down || right ? 0 : radius,\n down || left ? 0 : radius,\n ),\n })\n }\n }\n return result\n})\n</script>\n\n<template>\n <div v-if=\"error\" class=\"flex items-center justify-center text-body-small text-error\" :style=\"{ width: `${size}px`, height: `${size}px` }\">\n <slot name=\"error\">{{ error }}</slot>\n </div>\n <svg\n v-else\n :width=\"size\"\n :height=\"size\"\n :viewBox=\"`0 0 ${size} ${size}`\"\n role=\"img\"\n :aria-label=\"label ?? value\"\n >\n <rect x=\"0\" y=\"0\" :width=\"size\" :height=\"size\" :rx=\"containerRadius\" :ry=\"containerRadius\" :fill=\"background\" />\n <template v-if=\"moduleStyle === 'dots'\">\n <path v-for=\"(cell, i) in cells\" :key=\"i\" :d=\"cell.d\" :fill=\"color\" />\n </template>\n <template v-else>\n <rect\n v-for=\"(cell, i) in cells\"\n :key=\"i\"\n :x=\"cell.x\"\n :y=\"cell.y\"\n :width=\"moduleSize\"\n :height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cAAY,EAAA,SAAS,EAAA;EAEtB,GAAA,CAAA,EAAgH,QAAA;GAA1G,GAAE;GAAI,GAAE;GAAK,OAAO,EAAA;GAAO,QAAQ,EAAA;GAAO,IAAI,EAAA;GAAkB,IAAI,EAAA;GAAkB,MAAM,EAAA;EAClF,GAAA,MAAA,GAAA,CAAA,GAAA,EAAA,gBAAW,UACzB,EAAA,EAAA,GAAA,EAAsE,GAAA,EAAA,KAAA,EAAA,GAAA,EAA5C,EAAA,QAAZ,GAAM,OAApB,EAAA,GAAA,EAAsE,QAAA;GAApC,KAAK;GAAI,GAAG,EAAK;GAAI,MAAM,EAAA;iBAG7D,GAAA,GAAA,MAAA,EAAA,EAAA,GAAA,EAQE,GAAA,EAAA,KAAA,EAAA,GAAA,EAPoB,EAAA,QAAZ,GAAM,OADhB,EAAA,GAAA,EAQE,QAAA;GANC,KAAK;GACL,GAAG,EAAK;GACR,GAAG,EAAK;GACR,OAAO,EAAA;GACP,QAAQ,EAAA;GACR,MAAM,EAAA"}
|
|
1
|
+
{"version":3,"file":"qrcode.js","names":[],"sources":["../src/components/MQRCode.vue","../src/components/MQRCode.vue"],"sourcesContent":["<script setup lang=\"ts\">\n/**\n * Renders a QR code as inline SVG — crisp at any size, no canvas or image assets. Available from the `/qrcode`\n * entry point, so it never adds weight to the main bundle.\n *\n * @slot error Shown instead of the SVG when value is too large to encode at the given errorCorrectionLevel\n */\nimport { computed } from 'vue'\nimport QRCode from 'qrcode-generator'\n\nconst props = withDefaults(\n defineProps<{\n /** Data to encode. Required — there is no default. */\n value: string\n /** Width/height in pixels (square) */\n size?: number\n /** Quiet zone around the code, in modules. */\n margin?: number\n /** Higher levels tolerate more damage/obstruction at the cost of a denser code */\n errorCorrectionLevel?: 'L' | 'M' | 'Q' | 'H'\n /** Dark module color */\n color?: string\n /** Light module / background color */\n background?: string\n /** aria-label for the svg. Defaults to value */\n label?: string\n /** Rounds the outer container corners. */\n rounded?: boolean\n /** 'square' is the classic scannable pixel grid. 'dots' rounds each module — still fully scannable, just a softer look. */\n moduleStyle?: 'square' | 'dots'\n }>(),\n {\n size: 200,\n margin: 4,\n errorCorrectionLevel: 'M',\n color: '#000000',\n background: '#ffffff',\n rounded: true,\n moduleStyle: 'square',\n },\n)\n\n// qr and error are derived together in one computed so they can never be\n// read out of sync with each other (e.g. a template `v-if=\"error\"` seeing a\n// stale value from before `qr` — which sets it — was actually evaluated).\nconst result = computed(() => {\n try {\n const instance = QRCode(0, props.errorCorrectionLevel)\n instance.addData(props.value)\n instance.make()\n return { qr: instance, error: null as string | null }\n } catch (err) {\n // qrcode-generator throws plain strings (e.g. \"code length overflow...\")\n const message = typeof err === 'string' ? err : err instanceof Error ? err.message : 'Failed to generate QR code'\n return { qr: null, error: message }\n }\n})\n\nconst qr = computed(() => result.value.qr)\nconst error = computed(() => result.value.error)\n\nconst moduleCount = computed(() => qr.value?.getModuleCount() ?? 0)\nconst totalModules = computed(() => moduleCount.value + props.margin * 2)\nconst moduleSize = computed(() => (totalModules.value > 0 ? props.size / totalModules.value : 0))\nconst containerRadius = computed(() => (props.rounded ? props.size * 0.06 : 0))\n\n// A corner rounds only when neither of its two perpendicular neighbors is\n// also dark — otherwise adjacent modules (e.g. the finder-pattern squares,\n// or any run of touching pixels) would each round independently and leave\n// visible notches instead of merging into one smooth shape.\nfunction roundedRectPath(x: number, y: number, s: number, rTL: number, rTR: number, rBR: number, rBL: number): string {\n return `M${x + rTL},${y} H${x + s - rTR} A${rTR},${rTR} 0 0 1 ${x + s},${y + rTR} V${y + s - rBR} A${rBR},${rBR} 0 0 1 ${x + s - rBR},${y + s} H${x + rBL} A${rBL},${rBL} 0 0 1 ${x},${y + s - rBL} V${y + rTL} A${rTL},${rTL} 0 0 1 ${x + rTL},${y} Z`\n}\n\nconst cells = computed(() => {\n const result: { x: number; y: number; d?: string }[] = []\n const inst = qr.value\n if (!inst) return result\n const count = moduleCount.value\n const s = moduleSize.value\n const isDark = (row: number, col: number) => row >= 0 && row < count && col >= 0 && col < count && inst.isDark(row, col)\n\n for (let row = 0; row < count; row++) {\n for (let col = 0; col < count; col++) {\n if (!isDark(row, col)) continue\n const x = (col + props.margin) * s\n const y = (row + props.margin) * s\n\n if (props.moduleStyle !== 'dots') {\n result.push({ x, y })\n continue\n }\n\n const radius = s / 2\n const up = isDark(row - 1, col)\n const down = isDark(row + 1, col)\n const left = isDark(row, col - 1)\n const right = isDark(row, col + 1)\n result.push({\n x, y,\n d: roundedRectPath(\n x, y, s,\n up || left ? 0 : radius,\n up || right ? 0 : radius,\n down || right ? 0 : radius,\n down || left ? 0 : radius,\n ),\n })\n }\n }\n return result\n})\n</script>\n\n<template>\n <div v-if=\"error\" class=\"flex items-center justify-center text-body-small text-error\" :style=\"{ width: `${size}px`, height: `${size}px` }\">\n <slot name=\"error\">{{ error }}</slot>\n </div>\n <svg\n v-else\n :width=\"size\"\n :height=\"size\"\n :viewBox=\"`0 0 ${size} ${size}`\"\n role=\"img\"\n :aria-label=\"label ?? value\"\n >\n <rect x=\"0\" y=\"0\" :width=\"size\" :height=\"size\" :rx=\"containerRadius\" :ry=\"containerRadius\" :fill=\"background\" />\n <template v-if=\"moduleStyle === 'dots'\">\n <path v-for=\"(cell, i) in cells\" :key=\"i\" :d=\"cell.d\" :fill=\"color\" />\n </template>\n <template v-else>\n <rect\n v-for=\"(cell, i) in cells\"\n :key=\"i\"\n :x=\"cell.x\"\n :y=\"cell.y\"\n :width=\"moduleSize\"\n :height=\"moduleSize\"\n :fill=\"color\"\n />\n </template>\n </svg>\n</template>\n","<script setup lang=\"ts\">\n/**\n * Renders a QR code as inline SVG — crisp at any size, no canvas or image assets. Available from the `/qrcode`\n * entry point, so it never adds weight to the main bundle.\n *\n * @slot error Shown instead of the SVG when value is too large to encode at the given errorCorrectionLevel\n */\nimport { computed } from 'vue'\nimport QRCode from 'qrcode-generator'\n\nconst props = withDefaults(\n defineProps<{\n /** Data to encode. Required — there is no default. */\n value: string\n /** Width/height in pixels (square) */\n size?: number\n /** Quiet zone around the code, in modules. */\n margin?: number\n /** Higher levels tolerate more damage/obstruction at the cost of a denser code */\n errorCorrectionLevel?: 'L' | 'M' | 'Q' | 'H'\n /** Dark module color */\n color?: string\n /** Light module / background color */\n background?: string\n /** aria-label for the svg. Defaults to value */\n label?: string\n /** Rounds the outer container corners. */\n rounded?: boolean\n /** 'square' is the classic scannable pixel grid. 'dots' rounds each module — still fully scannable, just a softer look. */\n moduleStyle?: 'square' | 'dots'\n }>(),\n {\n size: 200,\n margin: 4,\n errorCorrectionLevel: 'M',\n color: '#000000',\n background: '#ffffff',\n rounded: true,\n moduleStyle: 'square',\n },\n)\n\n// qr and error are derived together in one computed so they can never be\n// read out of sync with each other (e.g. a template `v-if=\"error\"` seeing a\n// stale value from before `qr` — which sets it — was actually evaluated).\nconst result = computed(() => {\n try {\n const instance = QRCode(0, props.errorCorrectionLevel)\n instance.addData(props.value)\n instance.make()\n return { qr: instance, error: null as string | null }\n } catch (err) {\n // qrcode-generator throws plain strings (e.g. \"code length overflow...\")\n const message = typeof err === 'string' ? err : err instanceof Error ? err.message : 'Failed to generate QR code'\n return { qr: null, error: message }\n }\n})\n\nconst qr = computed(() => result.value.qr)\nconst error = computed(() => result.value.error)\n\nconst moduleCount = computed(() => qr.value?.getModuleCount() ?? 0)\nconst totalModules = computed(() => moduleCount.value + props.margin * 2)\nconst moduleSize = computed(() => (totalModules.value > 0 ? props.size / totalModules.value : 0))\nconst containerRadius = computed(() => (props.rounded ? props.size * 0.06 : 0))\n\n// A corner rounds only when neither of its two perpendicular neighbors is\n// also dark — otherwise adjacent modules (e.g. the finder-pattern squares,\n// or any run of touching pixels) would each round independently and leave\n// visible notches instead of merging into one smooth shape.\nfunction roundedRectPath(x: number, y: number, s: number, rTL: number, rTR: number, rBR: number, rBL: number): string {\n return `M${x + rTL},${y} H${x + s - rTR} A${rTR},${rTR} 0 0 1 ${x + s},${y + rTR} V${y + s - rBR} A${rBR},${rBR} 0 0 1 ${x + s - rBR},${y + s} H${x + rBL} A${rBL},${rBL} 0 0 1 ${x},${y + s - rBL} V${y + rTL} A${rTL},${rTL} 0 0 1 ${x + rTL},${y} Z`\n}\n\nconst cells = computed(() => {\n const result: { x: number; y: number; d?: string }[] = []\n const inst = qr.value\n if (!inst) return result\n const count = moduleCount.value\n const s = moduleSize.value\n const isDark = (row: number, col: number) => row >= 0 && row < count && col >= 0 && col < count && inst.isDark(row, col)\n\n for (let row = 0; row < count; row++) {\n for (let col = 0; col < count; col++) {\n if (!isDark(row, col)) continue\n const x = (col + props.margin) * s\n const y = (row + props.margin) * s\n\n if (props.moduleStyle !== 'dots') {\n result.push({ x, y })\n continue\n }\n\n const radius = s / 2\n const up = isDark(row - 1, col)\n const down = isDark(row + 1, col)\n const left = isDark(row, col - 1)\n const right = isDark(row, col + 1)\n result.push({\n x, y,\n d: roundedRectPath(\n x, y, s,\n up || left ? 0 : radius,\n up || right ? 0 : radius,\n down || right ? 0 : radius,\n down || left ? 0 : radius,\n ),\n })\n }\n }\n return result\n})\n</script>\n\n<template>\n <div v-if=\"error\" class=\"flex items-center justify-center text-body-small text-error\" :style=\"{ width: `${size}px`, height: `${size}px` }\">\n <slot name=\"error\">{{ error }}</slot>\n </div>\n <svg\n v-else\n :width=\"size\"\n :height=\"size\"\n :viewBox=\"`0 0 ${size} ${size}`\"\n role=\"img\"\n :aria-label=\"label ?? value\"\n >\n <rect x=\"0\" y=\"0\" :width=\"size\" :height=\"size\" :rx=\"containerRadius\" :ry=\"containerRadius\" :fill=\"background\" />\n <template v-if=\"moduleStyle === 'dots'\">\n <path v-for=\"(cell, i) in cells\" :key=\"i\" :d=\"cell.d\" :fill=\"color\" />\n </template>\n <template v-else>\n <rect\n v-for=\"(cell, i) in cells\"\n :key=\"i\"\n :x=\"cell.x\"\n :y=\"cell.y\"\n :width=\"moduleSize\"\n :height=\"moduleSize\"\n :fill=\"color\"\n />\n </template>\n </svg>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;E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,QAAQ,EAAA;GAAO,IAAI,EAAA;GAAkB,IAAI,EAAA;GAAkB,MAAM,EAAA;EAClF,GAAA,MAAA,GAAA,CAAA,GAAA,EAAA,gBAAW,UACzB,EAAA,EAAA,GAAA,EAAsE,GAAA,EAAA,KAAA,EAAA,GAAA,EAA5C,EAAA,QAAZ,GAAM,OAApB,EAAA,GAAA,EAAsE,QAAA;GAApC,KAAK;GAAI,GAAG,EAAK;GAAI,MAAM,EAAA;iBAG7D,GAAA,GAAA,MAAA,EAAA,EAAA,GAAA,EAQE,GAAA,EAAA,KAAA,EAAA,GAAA,EAPoB,EAAA,QAAZ,GAAM,OADhB,EAAA,GAAA,EAQE,QAAA;GANC,KAAK;GACL,GAAG,EAAK;GACR,GAAG,EAAK;GACR,OAAO,EAAA;GACP,QAAQ,EAAA;GACR,MAAM,EAAA"}
|
package/dist/rich-text-editor.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { i as e } from "./useLocale-Drihe5G2.js";
|
|
2
2
|
import { t } from "./MIcon-CaEooCmZ.js";
|
|
3
|
-
import { a as n, n as r, o as i, r as a, t as o } from "./
|
|
3
|
+
import { a as n, n as r, o as i, r as a, t as o } from "./MTextField-pJU1vFaR.js";
|
|
4
4
|
import { t as s } from "./_plugin-vue_export-helper-B3ysoDQm.js";
|
|
5
5
|
import { Fragment as c, computed as l, createCommentVNode as u, createElementBlock as d, createElementVNode as f, createTextVNode as p, createVNode as m, defineComponent as h, normalizeClass as g, normalizeStyle as _, onBeforeUnmount as v, onMounted as y, openBlock as b, ref as x, renderList as S, shallowRef as C, toDisplayString as w, watch as T, withCtx as E, withKeys as D } from "vue";
|
|
6
6
|
//#region src/components/MRichTextEditor.vue?vue&type=script&setup=true&lang.ts
|
|
@@ -197,25 +197,25 @@ var O = {
|
|
|
197
197
|
}
|
|
198
198
|
return (e, l) => (b(), d("div", { class: g(["overflow-hidden rounded-lg border transition-colors duration-150", s.disabled ? "border-outline-variant/50 opacity-60" : "border-outline-variant focus-within:border-primary"]) }, [
|
|
199
199
|
R.value ? (b(), d("div", O, [
|
|
200
|
-
m(
|
|
200
|
+
m(a, { align: "left" }, {
|
|
201
201
|
trigger: E(() => [f("button", k, [p(w(K.value) + " ", 1), m(t, {
|
|
202
202
|
name: "arrow_drop_down",
|
|
203
203
|
size: 20
|
|
204
204
|
})])]),
|
|
205
205
|
default: E(() => [
|
|
206
|
-
m(
|
|
206
|
+
m(r, { onClick: l[0] ||= (e) => q(0) }, {
|
|
207
207
|
default: E(() => [p(w(I.value.paragraph), 1)]),
|
|
208
208
|
_: 1
|
|
209
209
|
}),
|
|
210
|
-
m(
|
|
210
|
+
m(r, { onClick: l[1] ||= (e) => q(1) }, {
|
|
211
211
|
default: E(() => [p(w(I.value.heading1), 1)]),
|
|
212
212
|
_: 1
|
|
213
213
|
}),
|
|
214
|
-
m(
|
|
214
|
+
m(r, { onClick: l[2] ||= (e) => q(2) }, {
|
|
215
215
|
default: E(() => [p(w(I.value.heading2), 1)]),
|
|
216
216
|
_: 1
|
|
217
217
|
}),
|
|
218
|
-
m(
|
|
218
|
+
m(r, { onClick: l[3] ||= (e) => q(3) }, {
|
|
219
219
|
default: E(() => [p(w(I.value.heading3), 1)]),
|
|
220
220
|
_: 1
|
|
221
221
|
})
|
|
@@ -274,7 +274,7 @@ var O = {
|
|
|
274
274
|
default: E(() => [p(w(I.value.insert), 1)]),
|
|
275
275
|
_: 1
|
|
276
276
|
})]),
|
|
277
|
-
default: E(() => [m(
|
|
277
|
+
default: E(() => [m(o, {
|
|
278
278
|
modelValue: U.value,
|
|
279
279
|
"onUpdate:modelValue": l[4] ||= (e) => U.value = e,
|
|
280
280
|
label: "URL",
|
|
@@ -298,7 +298,7 @@ var O = {
|
|
|
298
298
|
default: E(() => [p(w(I.value.insert), 1)]),
|
|
299
299
|
_: 1
|
|
300
300
|
})]),
|
|
301
|
-
default: E(() => [m(
|
|
301
|
+
default: E(() => [m(o, {
|
|
302
302
|
modelValue: G.value,
|
|
303
303
|
"onUpdate:modelValue": l[7] ||= (e) => G.value = e,
|
|
304
304
|
label: I.value.imageUrlLabel,
|
|
@@ -309,7 +309,7 @@ var O = {
|
|
|
309
309
|
}, 8, ["modelValue", "title"])
|
|
310
310
|
], 2));
|
|
311
311
|
}
|
|
312
|
-
}), [["__scopeId", "data-v-
|
|
312
|
+
}), [["__scopeId", "data-v-201025d1"]]);
|
|
313
313
|
//#endregion
|
|
314
314
|
export { P as MRichTextEditor };
|
|
315
315
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rich-text-editor.js","names":[],"sources":["../src/components/MRichTextEditor.vue","../src/components/MRichTextEditor.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ref, watch, onMounted, onBeforeUnmount, shallowRef, computed } from 'vue'\nimport MIcon from './MIcon.vue'\nimport MMenu from './MMenu.vue'\nimport MMenuItem from './MMenuItem.vue'\nimport MDialog from './MDialog.vue'\nimport MTextField from './MTextField.vue'\nimport MButton from './MButton.vue'\nimport { useLocale } from '../composables/useLocale'\n\nexport interface RichTextEditorLabels {\n bold?: string\n italic?: string\n underline?: string\n strikethrough?: string\n highlight?: string\n bulletList?: string\n orderedList?: string\n blockquote?: string\n code?: string\n alignLeft?: string\n alignCenter?: string\n alignRight?: string\n undo?: string\n redo?: string\n link?: string\n image?: string\n paragraph?: string\n heading1?: string\n heading2?: string\n heading3?: string\n insertLink?: string\n insertImage?: string\n imageUrlLabel?: string\n cancel?: string\n insert?: string\n}\n\nconst locale = useLocale()\n\nconst props = withDefaults(\n defineProps<{\n modelValue: string\n placeholder?: string\n disabled?: boolean\n minHeight?: string\n labels?: RichTextEditorLabels\n }>(),\n { disabled: false, minHeight: '200px' },\n)\n\nconst l = computed<Required<RichTextEditorLabels>>(() => ({\n bold: locale.bold,\n italic: locale.italic,\n underline: locale.underline,\n strikethrough: locale.strikethrough,\n highlight: locale.highlight,\n bulletList: locale.bulletList,\n orderedList: locale.orderedList,\n blockquote: locale.blockquote,\n code: locale.code,\n alignLeft: locale.alignLeft,\n alignCenter: locale.alignCenter,\n alignRight: locale.alignRight,\n undo: locale.undo,\n redo: locale.redo,\n link: locale.link,\n image: locale.image,\n paragraph: locale.paragraph,\n heading1: locale.heading1,\n heading2: locale.heading2,\n heading3: locale.heading3,\n insertLink: locale.insertLink,\n insertImage: locale.insertImage,\n imageUrlLabel: locale.imageUrlLabel,\n cancel: locale.cancel,\n insert: locale.insert,\n ...props.labels,\n}))\n\nconst emit = defineEmits<{ 'update:modelValue': [string] }>()\n\nconst ready = ref(false)\nconst editorRef = shallowRef<any>(null)\nconst editorContainer = ref<HTMLElement | null>(null)\n\ninterface ToolBtn {\n icon: string\n label: string\n action: () => void\n active?: () => boolean\n}\n\nconst toolGroups = ref<ToolBtn[][]>([])\n\nonMounted(async () => {\n const [\n { Editor },\n { default: StarterKit },\n { default: Underline },\n { default: TextAlign },\n { default: Link },\n { default: Image },\n { default: Highlight },\n { default: Placeholder },\n { TextStyle },\n { default: Color },\n ] = await Promise.all([\n import('@tiptap/vue-3'),\n import('@tiptap/starter-kit'),\n import('@tiptap/extension-underline'),\n import('@tiptap/extension-text-align'),\n import('@tiptap/extension-link'),\n import('@tiptap/extension-image'),\n import('@tiptap/extension-highlight'),\n import('@tiptap/extension-placeholder'),\n import('@tiptap/extension-text-style'),\n import('@tiptap/extension-color'),\n ])\n\n const editor = new Editor({\n element: editorContainer.value!,\n content: props.modelValue,\n editable: !props.disabled,\n extensions: [\n StarterKit,\n Underline,\n TextAlign.configure({ types: ['heading', 'paragraph'] }),\n Link.configure({ openOnClick: false }),\n Image,\n Highlight.configure({ multicolor: true }),\n Placeholder.configure({ placeholder: props.placeholder ?? 'Start writing...' }),\n TextStyle,\n Color,\n ],\n onUpdate: ({ editor: e }) => emit('update:modelValue', e.getHTML()),\n })\n\n editorRef.value = editor\n\n toolGroups.value = [\n [\n { icon: 'format_bold', label: l.value.bold, action: () => editor.chain().focus().toggleBold().run(), active: () => !!editor.isActive('bold') },\n { icon: 'format_italic', label: l.value.italic, action: () => editor.chain().focus().toggleItalic().run(), active: () => !!editor.isActive('italic') },\n { icon: 'format_underlined', label: l.value.underline, action: () => editor.chain().focus().toggleUnderline().run(), active: () => !!editor.isActive('underline') },\n { icon: 'format_strikethrough', label: l.value.strikethrough, action: () => editor.chain().focus().toggleStrike().run(), active: () => !!editor.isActive('strike') },\n { icon: 'ink_highlighter', label: l.value.highlight, action: () => editor.chain().focus().toggleHighlight().run(), active: () => !!editor.isActive('highlight') },\n ],\n [\n { icon: 'format_list_bulleted', label: l.value.bulletList, action: () => editor.chain().focus().toggleBulletList().run(), active: () => !!editor.isActive('bulletList') },\n { icon: 'format_list_numbered', label: l.value.orderedList, action: () => editor.chain().focus().toggleOrderedList().run(), active: () => !!editor.isActive('orderedList') },\n { icon: 'format_quote', label: l.value.blockquote, action: () => editor.chain().focus().toggleBlockquote().run(), active: () => !!editor.isActive('blockquote') },\n { icon: 'code', label: l.value.code, action: () => editor.chain().focus().toggleCode().run(), active: () => !!editor.isActive('code') },\n ],\n [\n { icon: 'format_align_left', label: l.value.alignLeft, action: () => editor.chain().focus().setTextAlign('left').run(), active: () => !!editor.isActive({ textAlign: 'left' }) },\n { icon: 'format_align_center', label: l.value.alignCenter, action: () => editor.chain().focus().setTextAlign('center').run(), active: () => !!editor.isActive({ textAlign: 'center' }) },\n { icon: 'format_align_right', label: l.value.alignRight, action: () => editor.chain().focus().setTextAlign('right').run(), active: () => !!editor.isActive({ textAlign: 'right' }) },\n ],\n [\n { icon: 'undo', label: l.value.undo, action: () => editor.chain().focus().undo().run() },\n { icon: 'redo', label: l.value.redo, action: () => editor.chain().focus().redo().run() },\n ],\n ]\n\n onBeforeUnmount(() => editor.destroy())\n\n watch(() => props.modelValue, (val) => {\n if (editor.getHTML() !== val) editor.commands.setContent(val)\n })\n\n watch(() => props.disabled, (v) => editor.setEditable(!v))\n\n ready.value = true\n})\n\nconst linkDialogOpen = ref(false)\nconst linkUrl = ref('')\nconst imageDialogOpen = ref(false)\nconst imageUrl = ref('')\n\nconst headingLabel = computed(() => {\n const e = editorRef.value\n if (!e) return l.value.paragraph\n if (e.isActive('heading', { level: 1 })) return l.value.heading1\n if (e.isActive('heading', { level: 2 })) return l.value.heading2\n if (e.isActive('heading', { level: 3 })) return l.value.heading3\n return l.value.paragraph\n})\n\nfunction setHeading(level: 0 | 1 | 2 | 3) {\n if (level === 0) editorRef.value?.chain().focus().setParagraph().run()\n else editorRef.value?.chain().focus().toggleHeading({ level }).run()\n}\n\nfunction openLinkDialog() {\n linkUrl.value = ''\n linkDialogOpen.value = true\n}\n\nfunction confirmLink() {\n if (linkUrl.value) editorRef.value?.chain().focus().setLink({ href: linkUrl.value }).run()\n linkDialogOpen.value = false\n}\n\nfunction openImageDialog() {\n imageUrl.value = ''\n imageDialogOpen.value = true\n}\n\nfunction confirmImage() {\n if (imageUrl.value) editorRef.value?.chain().focus().setImage({ src: imageUrl.value }).run()\n imageDialogOpen.value = false\n}\n</script>\n\n<template>\n <div\n class=\"overflow-hidden rounded-lg border transition-colors duration-150\"\n :class=\"disabled ? 'border-outline-variant/50 opacity-60' : 'border-outline-variant focus-within:border-primary'\"\n >\n <!-- Toolbar -->\n <div v-if=\"ready\" class=\"flex flex-wrap items-center gap-0.5 border-b border-outline-variant bg-surface-container px-2 py-1.5\">\n <!-- Heading menu -->\n <MMenu align=\"left\">\n <template #trigger>\n <button\n type=\"button\"\n class=\"flex h-8 cursor-pointer items-center gap-1 rounded px-2 text-label-large text-on-surface-variant hover:bg-on-surface/8\"\n >\n {{ headingLabel }}\n <MIcon name=\"arrow_drop_down\" :size=\"20\" />\n </button>\n </template>\n <MMenuItem @click=\"setHeading(0)\">{{ l.paragraph }}</MMenuItem>\n <MMenuItem @click=\"setHeading(1)\">{{ l.heading1 }}</MMenuItem>\n <MMenuItem @click=\"setHeading(2)\">{{ l.heading2 }}</MMenuItem>\n <MMenuItem @click=\"setHeading(3)\">{{ l.heading3 }}</MMenuItem>\n </MMenu>\n\n <div class=\"mx-1 h-6 w-px bg-outline-variant\" />\n\n <template v-for=\"(group, gi) in toolGroups\" :key=\"gi\">\n <button\n v-for=\"btn in group\"\n :key=\"btn.icon\"\n type=\"button\"\n :title=\"btn.label\"\n class=\"flex h-8 w-8 cursor-pointer items-center justify-center rounded transition-colors duration-100\"\n :class=\"btn.active?.() ? 'bg-secondary-container text-on-secondary-container' : 'text-on-surface-variant hover:bg-on-surface/8'\"\n @click=\"btn.action\"\n >\n <MIcon :name=\"btn.icon\" :size=\"20\" />\n </button>\n <div v-if=\"gi < toolGroups.length - 1\" class=\"mx-1 h-6 w-px bg-outline-variant\" />\n </template>\n\n <div class=\"mx-1 h-6 w-px bg-outline-variant\" />\n\n <button\n type=\"button\"\n :title=\"l.link\"\n class=\"flex h-8 w-8 cursor-pointer items-center justify-center rounded text-on-surface-variant transition-colors hover:bg-on-surface/8\"\n @click=\"openLinkDialog\"\n >\n <MIcon name=\"link\" :size=\"20\" />\n </button>\n <button\n type=\"button\"\n :title=\"l.image\"\n class=\"flex h-8 w-8 cursor-pointer items-center justify-center rounded text-on-surface-variant transition-colors hover:bg-on-surface/8\"\n @click=\"openImageDialog\"\n >\n <MIcon name=\"image\" :size=\"20\" />\n </button>\n </div>\n\n <!-- Editor content -->\n <div\n ref=\"editorContainer\"\n class=\"rte-content bg-surface px-4 py-3 text-body-large text-on-surface\"\n :style=\"{ minHeight: minHeight }\"\n />\n\n <!-- Link dialog -->\n <MDialog v-model=\"linkDialogOpen\" :title=\"l.insertLink\">\n <MTextField v-model=\"linkUrl\" label=\"URL\" placeholder=\" \" @keydown.enter=\"confirmLink\" />\n <template #actions>\n <MButton variant=\"text\" @click=\"linkDialogOpen = false\">{{ l.cancel }}</MButton>\n <MButton @click=\"confirmLink\">{{ l.insert }}</MButton>\n </template>\n </MDialog>\n\n <!-- Image dialog -->\n <MDialog v-model=\"imageDialogOpen\" :title=\"l.insertImage\">\n <MTextField v-model=\"imageUrl\" :label=\"l.imageUrlLabel\" placeholder=\" \" @keydown.enter=\"confirmImage\" />\n <template #actions>\n <MButton variant=\"text\" @click=\"imageDialogOpen = false\">{{ l.cancel }}</MButton>\n <MButton @click=\"confirmImage\">{{ l.insert }}</MButton>\n </template>\n </MDialog>\n </div>\n</template>\n\n<style scoped>\n.rte-content :deep(.tiptap) {\n outline: none;\n min-height: inherit;\n}\n\n.rte-content :deep(.tiptap p.is-editor-empty:first-child::before) {\n content: attr(data-placeholder);\n float: left;\n color: var(--color-on-surface-variant);\n opacity: 0.5;\n pointer-events: none;\n height: 0;\n}\n\n.rte-content :deep(h1) { font-size: var(--text-headline-large); line-height: var(--text-headline-large--line-height); font-weight: 600; margin: 0.75em 0 0.25em; }\n.rte-content :deep(h2) { font-size: var(--text-headline-medium); line-height: var(--text-headline-medium--line-height); font-weight: 600; margin: 0.75em 0 0.25em; }\n.rte-content :deep(h3) { font-size: var(--text-headline-small); line-height: var(--text-headline-small--line-height); font-weight: 600; margin: 0.75em 0 0.25em; }\n.rte-content :deep(p) { margin: 0.5em 0; }\n.rte-content :deep(ul) { list-style-type: disc; padding-left: 1.5em; margin: 0.5em 0; }\n.rte-content :deep(ol) { list-style-type: decimal; padding-left: 1.5em; margin: 0.5em 0; }\n.rte-content :deep(blockquote) { border-left: 3px solid var(--color-primary); padding-left: 1em; margin: 0.5em 0; color: var(--color-on-surface-variant); }\n.rte-content :deep(code) { background: var(--color-surface-container-highest); padding: 0.15em 0.4em; border-radius: 4px; font-size: 0.875em; }\n.rte-content :deep(pre) { background: var(--color-surface-container-highest); padding: 1em; border-radius: 8px; overflow-x: auto; margin: 0.5em 0; }\n.rte-content :deep(pre code) { background: none; padding: 0; }\n.rte-content :deep(a) { color: var(--color-primary); text-decoration: underline; }\n.rte-content :deep(mark) { background: var(--color-tertiary-container); color: var(--color-on-tertiary-container); padding: 0.1em 0.2em; border-radius: 2px; }\n.rte-content :deep(img) { max-width: 100%; height: auto; border-radius: 8px; margin: 0.5em 0; }\n</style>\n","<script setup lang=\"ts\">\nimport { ref, watch, onMounted, onBeforeUnmount, shallowRef, computed } from 'vue'\nimport MIcon from './MIcon.vue'\nimport MMenu from './MMenu.vue'\nimport MMenuItem from './MMenuItem.vue'\nimport MDialog from './MDialog.vue'\nimport MTextField from './MTextField.vue'\nimport MButton from './MButton.vue'\nimport { useLocale } from '../composables/useLocale'\n\nexport interface RichTextEditorLabels {\n bold?: string\n italic?: string\n underline?: string\n strikethrough?: string\n highlight?: string\n bulletList?: string\n orderedList?: string\n blockquote?: string\n code?: string\n alignLeft?: string\n alignCenter?: string\n alignRight?: string\n undo?: string\n redo?: string\n link?: string\n image?: string\n paragraph?: string\n heading1?: string\n heading2?: string\n heading3?: string\n insertLink?: string\n insertImage?: string\n imageUrlLabel?: string\n cancel?: string\n insert?: string\n}\n\nconst locale = useLocale()\n\nconst props = withDefaults(\n defineProps<{\n modelValue: string\n placeholder?: string\n disabled?: boolean\n minHeight?: string\n labels?: RichTextEditorLabels\n }>(),\n { disabled: false, minHeight: '200px' },\n)\n\nconst l = computed<Required<RichTextEditorLabels>>(() => ({\n bold: locale.bold,\n italic: locale.italic,\n underline: locale.underline,\n strikethrough: locale.strikethrough,\n highlight: locale.highlight,\n bulletList: locale.bulletList,\n orderedList: locale.orderedList,\n blockquote: locale.blockquote,\n code: locale.code,\n alignLeft: locale.alignLeft,\n alignCenter: locale.alignCenter,\n alignRight: locale.alignRight,\n undo: locale.undo,\n redo: locale.redo,\n link: locale.link,\n image: locale.image,\n paragraph: locale.paragraph,\n heading1: locale.heading1,\n heading2: locale.heading2,\n heading3: locale.heading3,\n insertLink: locale.insertLink,\n insertImage: locale.insertImage,\n imageUrlLabel: locale.imageUrlLabel,\n cancel: locale.cancel,\n insert: locale.insert,\n ...props.labels,\n}))\n\nconst emit = defineEmits<{ 'update:modelValue': [string] }>()\n\nconst ready = ref(false)\nconst editorRef = shallowRef<any>(null)\nconst editorContainer = ref<HTMLElement | null>(null)\n\ninterface ToolBtn {\n icon: string\n label: string\n action: () => void\n active?: () => boolean\n}\n\nconst toolGroups = ref<ToolBtn[][]>([])\n\nonMounted(async () => {\n const [\n { Editor },\n { default: StarterKit },\n { default: Underline },\n { default: TextAlign },\n { default: Link },\n { default: Image },\n { default: Highlight },\n { default: Placeholder },\n { TextStyle },\n { default: Color },\n ] = await Promise.all([\n import('@tiptap/vue-3'),\n import('@tiptap/starter-kit'),\n import('@tiptap/extension-underline'),\n import('@tiptap/extension-text-align'),\n import('@tiptap/extension-link'),\n import('@tiptap/extension-image'),\n import('@tiptap/extension-highlight'),\n import('@tiptap/extension-placeholder'),\n import('@tiptap/extension-text-style'),\n import('@tiptap/extension-color'),\n ])\n\n const editor = new Editor({\n element: editorContainer.value!,\n content: props.modelValue,\n editable: !props.disabled,\n extensions: [\n StarterKit,\n Underline,\n TextAlign.configure({ types: ['heading', 'paragraph'] }),\n Link.configure({ openOnClick: false }),\n Image,\n Highlight.configure({ multicolor: true }),\n Placeholder.configure({ placeholder: props.placeholder ?? 'Start writing...' }),\n TextStyle,\n Color,\n ],\n onUpdate: ({ editor: e }) => emit('update:modelValue', e.getHTML()),\n })\n\n editorRef.value = editor\n\n toolGroups.value = [\n [\n { icon: 'format_bold', label: l.value.bold, action: () => editor.chain().focus().toggleBold().run(), active: () => !!editor.isActive('bold') },\n { icon: 'format_italic', label: l.value.italic, action: () => editor.chain().focus().toggleItalic().run(), active: () => !!editor.isActive('italic') },\n { icon: 'format_underlined', label: l.value.underline, action: () => editor.chain().focus().toggleUnderline().run(), active: () => !!editor.isActive('underline') },\n { icon: 'format_strikethrough', label: l.value.strikethrough, action: () => editor.chain().focus().toggleStrike().run(), active: () => !!editor.isActive('strike') },\n { icon: 'ink_highlighter', label: l.value.highlight, action: () => editor.chain().focus().toggleHighlight().run(), active: () => !!editor.isActive('highlight') },\n ],\n [\n { icon: 'format_list_bulleted', label: l.value.bulletList, action: () => editor.chain().focus().toggleBulletList().run(), active: () => !!editor.isActive('bulletList') },\n { icon: 'format_list_numbered', label: l.value.orderedList, action: () => editor.chain().focus().toggleOrderedList().run(), active: () => !!editor.isActive('orderedList') },\n { icon: 'format_quote', label: l.value.blockquote, action: () => editor.chain().focus().toggleBlockquote().run(), active: () => !!editor.isActive('blockquote') },\n { icon: 'code', label: l.value.code, action: () => editor.chain().focus().toggleCode().run(), active: () => !!editor.isActive('code') },\n ],\n [\n { icon: 'format_align_left', label: l.value.alignLeft, action: () => editor.chain().focus().setTextAlign('left').run(), active: () => !!editor.isActive({ textAlign: 'left' }) },\n { icon: 'format_align_center', label: l.value.alignCenter, action: () => editor.chain().focus().setTextAlign('center').run(), active: () => !!editor.isActive({ textAlign: 'center' }) },\n { icon: 'format_align_right', label: l.value.alignRight, action: () => editor.chain().focus().setTextAlign('right').run(), active: () => !!editor.isActive({ textAlign: 'right' }) },\n ],\n [\n { icon: 'undo', label: l.value.undo, action: () => editor.chain().focus().undo().run() },\n { icon: 'redo', label: l.value.redo, action: () => editor.chain().focus().redo().run() },\n ],\n ]\n\n onBeforeUnmount(() => editor.destroy())\n\n watch(() => props.modelValue, (val) => {\n if (editor.getHTML() !== val) editor.commands.setContent(val)\n })\n\n watch(() => props.disabled, (v) => editor.setEditable(!v))\n\n ready.value = true\n})\n\nconst linkDialogOpen = ref(false)\nconst linkUrl = ref('')\nconst imageDialogOpen = ref(false)\nconst imageUrl = ref('')\n\nconst headingLabel = computed(() => {\n const e = editorRef.value\n if (!e) return l.value.paragraph\n if (e.isActive('heading', { level: 1 })) return l.value.heading1\n if (e.isActive('heading', { level: 2 })) return l.value.heading2\n if (e.isActive('heading', { level: 3 })) return l.value.heading3\n return l.value.paragraph\n})\n\nfunction setHeading(level: 0 | 1 | 2 | 3) {\n if (level === 0) editorRef.value?.chain().focus().setParagraph().run()\n else editorRef.value?.chain().focus().toggleHeading({ level }).run()\n}\n\nfunction openLinkDialog() {\n linkUrl.value = ''\n linkDialogOpen.value = true\n}\n\nfunction confirmLink() {\n if (linkUrl.value) editorRef.value?.chain().focus().setLink({ href: linkUrl.value }).run()\n linkDialogOpen.value = false\n}\n\nfunction openImageDialog() {\n imageUrl.value = ''\n imageDialogOpen.value = true\n}\n\nfunction confirmImage() {\n if (imageUrl.value) editorRef.value?.chain().focus().setImage({ src: imageUrl.value }).run()\n imageDialogOpen.value = false\n}\n</script>\n\n<template>\n <div\n class=\"overflow-hidden rounded-lg border transition-colors duration-150\"\n :class=\"disabled ? 'border-outline-variant/50 opacity-60' : 'border-outline-variant focus-within:border-primary'\"\n >\n <!-- Toolbar -->\n <div v-if=\"ready\" class=\"flex flex-wrap items-center gap-0.5 border-b border-outline-variant bg-surface-container px-2 py-1.5\">\n <!-- Heading menu -->\n <MMenu align=\"left\">\n <template #trigger>\n <button\n type=\"button\"\n class=\"flex h-8 cursor-pointer items-center gap-1 rounded px-2 text-label-large text-on-surface-variant hover:bg-on-surface/8\"\n >\n {{ headingLabel }}\n <MIcon name=\"arrow_drop_down\" :size=\"20\" />\n </button>\n </template>\n <MMenuItem @click=\"setHeading(0)\">{{ l.paragraph }}</MMenuItem>\n <MMenuItem @click=\"setHeading(1)\">{{ l.heading1 }}</MMenuItem>\n <MMenuItem @click=\"setHeading(2)\">{{ l.heading2 }}</MMenuItem>\n <MMenuItem @click=\"setHeading(3)\">{{ l.heading3 }}</MMenuItem>\n </MMenu>\n\n <div class=\"mx-1 h-6 w-px bg-outline-variant\" />\n\n <template v-for=\"(group, gi) in toolGroups\" :key=\"gi\">\n <button\n v-for=\"btn in group\"\n :key=\"btn.icon\"\n type=\"button\"\n :title=\"btn.label\"\n class=\"flex h-8 w-8 cursor-pointer items-center justify-center rounded transition-colors duration-100\"\n :class=\"btn.active?.() ? 'bg-secondary-container text-on-secondary-container' : 'text-on-surface-variant hover:bg-on-surface/8'\"\n @click=\"btn.action\"\n >\n <MIcon :name=\"btn.icon\" :size=\"20\" />\n </button>\n <div v-if=\"gi < toolGroups.length - 1\" class=\"mx-1 h-6 w-px bg-outline-variant\" />\n </template>\n\n <div class=\"mx-1 h-6 w-px bg-outline-variant\" />\n\n <button\n type=\"button\"\n :title=\"l.link\"\n class=\"flex h-8 w-8 cursor-pointer items-center justify-center rounded text-on-surface-variant transition-colors hover:bg-on-surface/8\"\n @click=\"openLinkDialog\"\n >\n <MIcon name=\"link\" :size=\"20\" />\n </button>\n <button\n type=\"button\"\n :title=\"l.image\"\n class=\"flex h-8 w-8 cursor-pointer items-center justify-center rounded text-on-surface-variant transition-colors hover:bg-on-surface/8\"\n @click=\"openImageDialog\"\n >\n <MIcon name=\"image\" :size=\"20\" />\n </button>\n </div>\n\n <!-- Editor content -->\n <div\n ref=\"editorContainer\"\n class=\"rte-content bg-surface px-4 py-3 text-body-large text-on-surface\"\n :style=\"{ minHeight: minHeight }\"\n />\n\n <!-- Link dialog -->\n <MDialog v-model=\"linkDialogOpen\" :title=\"l.insertLink\">\n <MTextField v-model=\"linkUrl\" label=\"URL\" placeholder=\" \" @keydown.enter=\"confirmLink\" />\n <template #actions>\n <MButton variant=\"text\" @click=\"linkDialogOpen = false\">{{ l.cancel }}</MButton>\n <MButton @click=\"confirmLink\">{{ l.insert }}</MButton>\n </template>\n </MDialog>\n\n <!-- Image dialog -->\n <MDialog v-model=\"imageDialogOpen\" :title=\"l.insertImage\">\n <MTextField v-model=\"imageUrl\" :label=\"l.imageUrlLabel\" placeholder=\" \" @keydown.enter=\"confirmImage\" />\n <template #actions>\n <MButton variant=\"text\" @click=\"imageDialogOpen = false\">{{ l.cancel }}</MButton>\n <MButton @click=\"confirmImage\">{{ l.insert }}</MButton>\n </template>\n </MDialog>\n </div>\n</template>\n\n<style scoped>\n.rte-content :deep(.tiptap) {\n outline: none;\n min-height: inherit;\n}\n\n.rte-content :deep(.tiptap p.is-editor-empty:first-child::before) {\n content: attr(data-placeholder);\n float: left;\n color: var(--color-on-surface-variant);\n opacity: 0.5;\n pointer-events: none;\n height: 0;\n}\n\n.rte-content :deep(h1) { font-size: var(--text-headline-large); line-height: var(--text-headline-large--line-height); font-weight: 600; margin: 0.75em 0 0.25em; }\n.rte-content :deep(h2) { font-size: var(--text-headline-medium); line-height: var(--text-headline-medium--line-height); font-weight: 600; margin: 0.75em 0 0.25em; }\n.rte-content :deep(h3) { font-size: var(--text-headline-small); line-height: var(--text-headline-small--line-height); font-weight: 600; margin: 0.75em 0 0.25em; }\n.rte-content :deep(p) { margin: 0.5em 0; }\n.rte-content :deep(ul) { list-style-type: disc; padding-left: 1.5em; margin: 0.5em 0; }\n.rte-content :deep(ol) { list-style-type: decimal; padding-left: 1.5em; margin: 0.5em 0; }\n.rte-content :deep(blockquote) { border-left: 3px solid var(--color-primary); padding-left: 1em; margin: 0.5em 0; color: var(--color-on-surface-variant); }\n.rte-content :deep(code) { background: var(--color-surface-container-highest); padding: 0.15em 0.4em; border-radius: 4px; font-size: 0.875em; }\n.rte-content :deep(pre) { background: var(--color-surface-container-highest); padding: 1em; border-radius: 8px; overflow-x: auto; margin: 0.5em 0; }\n.rte-content :deep(pre code) { background: none; padding: 0; }\n.rte-content :deep(a) { color: var(--color-primary); text-decoration: underline; }\n.rte-content :deep(mark) { background: var(--color-tertiary-container); color: var(--color-on-tertiary-container); padding: 0.1em 0.2em; border-radius: 2px; }\n.rte-content :deep(img) { max-width: 100%; height: auto; border-radius: 8px; margin: 0.5em 0; }\n</style>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAsCA,IAAM,IAAS,EAAU,GAEnB,IAAQ,GAWR,IAAI,SAAgD;GACxD,MAAM,EAAO;GACb,QAAQ,EAAO;GACf,WAAW,EAAO;GAClB,eAAe,EAAO;GACtB,WAAW,EAAO;GAClB,YAAY,EAAO;GACnB,aAAa,EAAO;GACpB,YAAY,EAAO;GACnB,MAAM,EAAO;GACb,WAAW,EAAO;GAClB,aAAa,EAAO;GACpB,YAAY,EAAO;GACnB,MAAM,EAAO;GACb,MAAM,EAAO;GACb,MAAM,EAAO;GACb,OAAO,EAAO;GACd,WAAW,EAAO;GAClB,UAAU,EAAO;GACjB,UAAU,EAA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AAA,EAAA;KAAA,uBAAA,AAAA,EAAA,QAAA,MAAA,EAAO,QAAA;KAAE,OAAM;KAAM,aAAY;KAAK,WAAO,EAAQ,GAAW,CAAA,OAAA,CAAA;;;;GAQvF,EAMU,GAAA;IANQ,YAAA,EAAA;IAAA,uBAAA,AAAA,EAAA,QAAA,MAAA,EAAe,QAAA;IAAG,OAAO,EAAA,MAAE;;IAEhC,SAAO,QACiE,CAAjF,EAAiF,GAAA;KAAxE,SAAQ;KAAQ,SAAK,AAAA,EAAA,QAAA,MAAE,EAAA,QAAe;;KAAU,SAAA,QAAc,CAAX,EAAA,EAAA,EAAA,MAAE,MAAM,GAAA,CAAA,CAAA,CAAA;;IACpE,CAAA,GAAA,EAAuD,GAAA,EAA7C,SAAO,EAAY,GAAA;KAAE,SAAA,QAAc,CAAX,EAAA,EAAA,EAAA,MAAE,MAAM,GAAA,CAAA,CAAA,CAAA;;;IAH5C,SAAA,QAAwG,CAAxG,EAAwG,GAAA;KAAnF,YAAA,EAAA;KAAA,uBAAA,AAAA,EAAA,QAAA,MAAA,EAAQ,QAAA;KAAG,OAAO,EAAA,MAAE;KAAe,aAAY;KAAK,WAAO,EAAQ,GAAY,CAAA,OAAA,CAAA"}
|
|
1
|
+
{"version":3,"file":"rich-text-editor.js","names":[],"sources":["../src/components/MRichTextEditor.vue","../src/components/MRichTextEditor.vue"],"sourcesContent":["<script setup lang=\"ts\">\n/**\n * A WYSIWYG editor built on tiptap, with a formatting toolbar covering text styles, lists, alignment, links,\n * and images.\n *\n * @event update:modelValue Emitted with the editor HTML on every content change — powers v-model\n */\nimport { ref, watch, onMounted, onBeforeUnmount, shallowRef, computed } from 'vue'\nimport MIcon from './MIcon.vue'\nimport MMenu from './MMenu.vue'\nimport MMenuItem from './MMenuItem.vue'\nimport MDialog from './MDialog.vue'\nimport MTextField from './MTextField.vue'\nimport MButton from './MButton.vue'\nimport { useLocale } from '../composables/useLocale'\n\nexport interface RichTextEditorLabels {\n bold?: string\n italic?: string\n underline?: string\n strikethrough?: string\n highlight?: string\n bulletList?: string\n orderedList?: string\n blockquote?: string\n code?: string\n alignLeft?: string\n alignCenter?: string\n alignRight?: string\n undo?: string\n redo?: string\n link?: string\n image?: string\n paragraph?: string\n heading1?: string\n heading2?: string\n heading3?: string\n insertLink?: string\n insertImage?: string\n imageUrlLabel?: string\n cancel?: string\n insert?: string\n}\n\nconst locale = useLocale()\n\nconst props = withDefaults(\n defineProps<{\n /** HTML content (v-model) */\n modelValue: string\n /** Placeholder text shown on an empty document */\n placeholder?: string\n /** Disables editing */\n disabled?: boolean\n /** Minimum editor height */\n minHeight?: string\n /**\n * Object with all toolbar/dialog label overrides for i18n (see `RichTextEditorLabels`) — defaults come from\n * useLocale()\n */\n labels?: RichTextEditorLabels\n }>(),\n { disabled: false, minHeight: '200px' },\n)\n\nconst l = computed<Required<RichTextEditorLabels>>(() => ({\n bold: locale.bold,\n italic: locale.italic,\n underline: locale.underline,\n strikethrough: locale.strikethrough,\n highlight: locale.highlight,\n bulletList: locale.bulletList,\n orderedList: locale.orderedList,\n blockquote: locale.blockquote,\n code: locale.code,\n alignLeft: locale.alignLeft,\n alignCenter: locale.alignCenter,\n alignRight: locale.alignRight,\n undo: locale.undo,\n redo: locale.redo,\n link: locale.link,\n image: locale.image,\n paragraph: locale.paragraph,\n heading1: locale.heading1,\n heading2: locale.heading2,\n heading3: locale.heading3,\n insertLink: locale.insertLink,\n insertImage: locale.insertImage,\n imageUrlLabel: locale.imageUrlLabel,\n cancel: locale.cancel,\n insert: locale.insert,\n ...props.labels,\n}))\n\nconst emit = defineEmits<{ 'update:modelValue': [string] }>()\n\nconst ready = ref(false)\nconst editorRef = shallowRef<any>(null)\nconst editorContainer = ref<HTMLElement | null>(null)\n\ninterface ToolBtn {\n icon: string\n label: string\n action: () => void\n active?: () => boolean\n}\n\nconst toolGroups = ref<ToolBtn[][]>([])\n\nonMounted(async () => {\n const [\n { Editor },\n { default: StarterKit },\n { default: Underline },\n { default: TextAlign },\n { default: Link },\n { default: Image },\n { default: Highlight },\n { default: Placeholder },\n { TextStyle },\n { default: Color },\n ] = await Promise.all([\n import('@tiptap/vue-3'),\n import('@tiptap/starter-kit'),\n import('@tiptap/extension-underline'),\n import('@tiptap/extension-text-align'),\n import('@tiptap/extension-link'),\n import('@tiptap/extension-image'),\n import('@tiptap/extension-highlight'),\n import('@tiptap/extension-placeholder'),\n import('@tiptap/extension-text-style'),\n import('@tiptap/extension-color'),\n ])\n\n const editor = new Editor({\n element: editorContainer.value!,\n content: props.modelValue,\n editable: !props.disabled,\n extensions: [\n StarterKit,\n Underline,\n TextAlign.configure({ types: ['heading', 'paragraph'] }),\n Link.configure({ openOnClick: false }),\n Image,\n Highlight.configure({ multicolor: true }),\n Placeholder.configure({ placeholder: props.placeholder ?? 'Start writing...' }),\n TextStyle,\n Color,\n ],\n onUpdate: ({ editor: e }) => emit('update:modelValue', e.getHTML()),\n })\n\n editorRef.value = editor\n\n toolGroups.value = [\n [\n { icon: 'format_bold', label: l.value.bold, action: () => editor.chain().focus().toggleBold().run(), active: () => !!editor.isActive('bold') },\n { icon: 'format_italic', label: l.value.italic, action: () => editor.chain().focus().toggleItalic().run(), active: () => !!editor.isActive('italic') },\n { icon: 'format_underlined', label: l.value.underline, action: () => editor.chain().focus().toggleUnderline().run(), active: () => !!editor.isActive('underline') },\n { icon: 'format_strikethrough', label: l.value.strikethrough, action: () => editor.chain().focus().toggleStrike().run(), active: () => !!editor.isActive('strike') },\n { icon: 'ink_highlighter', label: l.value.highlight, action: () => editor.chain().focus().toggleHighlight().run(), active: () => !!editor.isActive('highlight') },\n ],\n [\n { icon: 'format_list_bulleted', label: l.value.bulletList, action: () => editor.chain().focus().toggleBulletList().run(), active: () => !!editor.isActive('bulletList') },\n { icon: 'format_list_numbered', label: l.value.orderedList, action: () => editor.chain().focus().toggleOrderedList().run(), active: () => !!editor.isActive('orderedList') },\n { icon: 'format_quote', label: l.value.blockquote, action: () => editor.chain().focus().toggleBlockquote().run(), active: () => !!editor.isActive('blockquote') },\n { icon: 'code', label: l.value.code, action: () => editor.chain().focus().toggleCode().run(), active: () => !!editor.isActive('code') },\n ],\n [\n { icon: 'format_align_left', label: l.value.alignLeft, action: () => editor.chain().focus().setTextAlign('left').run(), active: () => !!editor.isActive({ textAlign: 'left' }) },\n { icon: 'format_align_center', label: l.value.alignCenter, action: () => editor.chain().focus().setTextAlign('center').run(), active: () => !!editor.isActive({ textAlign: 'center' }) },\n { icon: 'format_align_right', label: l.value.alignRight, action: () => editor.chain().focus().setTextAlign('right').run(), active: () => !!editor.isActive({ textAlign: 'right' }) },\n ],\n [\n { icon: 'undo', label: l.value.undo, action: () => editor.chain().focus().undo().run() },\n { icon: 'redo', label: l.value.redo, action: () => editor.chain().focus().redo().run() },\n ],\n ]\n\n onBeforeUnmount(() => editor.destroy())\n\n watch(() => props.modelValue, (val) => {\n if (editor.getHTML() !== val) editor.commands.setContent(val)\n })\n\n watch(() => props.disabled, (v) => editor.setEditable(!v))\n\n ready.value = true\n})\n\nconst linkDialogOpen = ref(false)\nconst linkUrl = ref('')\nconst imageDialogOpen = ref(false)\nconst imageUrl = ref('')\n\nconst headingLabel = computed(() => {\n const e = editorRef.value\n if (!e) return l.value.paragraph\n if (e.isActive('heading', { level: 1 })) return l.value.heading1\n if (e.isActive('heading', { level: 2 })) return l.value.heading2\n if (e.isActive('heading', { level: 3 })) return l.value.heading3\n return l.value.paragraph\n})\n\nfunction setHeading(level: 0 | 1 | 2 | 3) {\n if (level === 0) editorRef.value?.chain().focus().setParagraph().run()\n else editorRef.value?.chain().focus().toggleHeading({ level }).run()\n}\n\nfunction openLinkDialog() {\n linkUrl.value = ''\n linkDialogOpen.value = true\n}\n\nfunction confirmLink() {\n if (linkUrl.value) editorRef.value?.chain().focus().setLink({ href: linkUrl.value }).run()\n linkDialogOpen.value = false\n}\n\nfunction openImageDialog() {\n imageUrl.value = ''\n imageDialogOpen.value = true\n}\n\nfunction confirmImage() {\n if (imageUrl.value) editorRef.value?.chain().focus().setImage({ src: imageUrl.value }).run()\n imageDialogOpen.value = false\n}\n</script>\n\n<template>\n <div\n class=\"overflow-hidden rounded-lg border transition-colors duration-150\"\n :class=\"disabled ? 'border-outline-variant/50 opacity-60' : 'border-outline-variant focus-within:border-primary'\"\n >\n <!-- Toolbar -->\n <div v-if=\"ready\" class=\"flex flex-wrap items-center gap-0.5 border-b border-outline-variant bg-surface-container px-2 py-1.5\">\n <!-- Heading menu -->\n <MMenu align=\"left\">\n <template #trigger>\n <button\n type=\"button\"\n class=\"flex h-8 cursor-pointer items-center gap-1 rounded px-2 text-label-large text-on-surface-variant hover:bg-on-surface/8\"\n >\n {{ headingLabel }}\n <MIcon name=\"arrow_drop_down\" :size=\"20\" />\n </button>\n </template>\n <MMenuItem @click=\"setHeading(0)\">{{ l.paragraph }}</MMenuItem>\n <MMenuItem @click=\"setHeading(1)\">{{ l.heading1 }}</MMenuItem>\n <MMenuItem @click=\"setHeading(2)\">{{ l.heading2 }}</MMenuItem>\n <MMenuItem @click=\"setHeading(3)\">{{ l.heading3 }}</MMenuItem>\n </MMenu>\n\n <div class=\"mx-1 h-6 w-px bg-outline-variant\" />\n\n <template v-for=\"(group, gi) in toolGroups\" :key=\"gi\">\n <button\n v-for=\"btn in group\"\n :key=\"btn.icon\"\n type=\"button\"\n :title=\"btn.label\"\n class=\"flex h-8 w-8 cursor-pointer items-center justify-center rounded transition-colors duration-100\"\n :class=\"btn.active?.() ? 'bg-secondary-container text-on-secondary-container' : 'text-on-surface-variant hover:bg-on-surface/8'\"\n @click=\"btn.action\"\n >\n <MIcon :name=\"btn.icon\" :size=\"20\" />\n </button>\n <div v-if=\"gi < toolGroups.length - 1\" class=\"mx-1 h-6 w-px bg-outline-variant\" />\n </template>\n\n <div class=\"mx-1 h-6 w-px bg-outline-variant\" />\n\n <button\n type=\"button\"\n :title=\"l.link\"\n class=\"flex h-8 w-8 cursor-pointer items-center justify-center rounded text-on-surface-variant transition-colors hover:bg-on-surface/8\"\n @click=\"openLinkDialog\"\n >\n <MIcon name=\"link\" :size=\"20\" />\n </button>\n <button\n type=\"button\"\n :title=\"l.image\"\n class=\"flex h-8 w-8 cursor-pointer items-center justify-center rounded text-on-surface-variant transition-colors hover:bg-on-surface/8\"\n @click=\"openImageDialog\"\n >\n <MIcon name=\"image\" :size=\"20\" />\n </button>\n </div>\n\n <!-- Editor content -->\n <div\n ref=\"editorContainer\"\n class=\"rte-content bg-surface px-4 py-3 text-body-large text-on-surface\"\n :style=\"{ minHeight: minHeight }\"\n />\n\n <!-- Link dialog -->\n <MDialog v-model=\"linkDialogOpen\" :title=\"l.insertLink\">\n <MTextField v-model=\"linkUrl\" label=\"URL\" placeholder=\" \" @keydown.enter=\"confirmLink\" />\n <template #actions>\n <MButton variant=\"text\" @click=\"linkDialogOpen = false\">{{ l.cancel }}</MButton>\n <MButton @click=\"confirmLink\">{{ l.insert }}</MButton>\n </template>\n </MDialog>\n\n <!-- Image dialog -->\n <MDialog v-model=\"imageDialogOpen\" :title=\"l.insertImage\">\n <MTextField v-model=\"imageUrl\" :label=\"l.imageUrlLabel\" placeholder=\" \" @keydown.enter=\"confirmImage\" />\n <template #actions>\n <MButton variant=\"text\" @click=\"imageDialogOpen = false\">{{ l.cancel }}</MButton>\n <MButton @click=\"confirmImage\">{{ l.insert }}</MButton>\n </template>\n </MDialog>\n </div>\n</template>\n\n<style scoped>\n.rte-content :deep(.tiptap) {\n outline: none;\n min-height: inherit;\n}\n\n.rte-content :deep(.tiptap p.is-editor-empty:first-child::before) {\n content: attr(data-placeholder);\n float: left;\n color: var(--color-on-surface-variant);\n opacity: 0.5;\n pointer-events: none;\n height: 0;\n}\n\n.rte-content :deep(h1) { font-size: var(--text-headline-large); line-height: var(--text-headline-large--line-height); font-weight: 600; margin: 0.75em 0 0.25em; }\n.rte-content :deep(h2) { font-size: var(--text-headline-medium); line-height: var(--text-headline-medium--line-height); font-weight: 600; margin: 0.75em 0 0.25em; }\n.rte-content :deep(h3) { font-size: var(--text-headline-small); line-height: var(--text-headline-small--line-height); font-weight: 600; margin: 0.75em 0 0.25em; }\n.rte-content :deep(p) { margin: 0.5em 0; }\n.rte-content :deep(ul) { list-style-type: disc; padding-left: 1.5em; margin: 0.5em 0; }\n.rte-content :deep(ol) { list-style-type: decimal; padding-left: 1.5em; margin: 0.5em 0; }\n.rte-content :deep(blockquote) { border-left: 3px solid var(--color-primary); padding-left: 1em; margin: 0.5em 0; color: var(--color-on-surface-variant); }\n.rte-content :deep(code) { background: var(--color-surface-container-highest); padding: 0.15em 0.4em; border-radius: 4px; font-size: 0.875em; }\n.rte-content :deep(pre) { background: var(--color-surface-container-highest); padding: 1em; border-radius: 8px; overflow-x: auto; margin: 0.5em 0; }\n.rte-content :deep(pre code) { background: none; padding: 0; }\n.rte-content :deep(a) { color: var(--color-primary); text-decoration: underline; }\n.rte-content :deep(mark) { background: var(--color-tertiary-container); color: var(--color-on-tertiary-container); padding: 0.1em 0.2em; border-radius: 2px; }\n.rte-content :deep(img) { max-width: 100%; height: auto; border-radius: 8px; margin: 0.5em 0; }\n</style>\n","<script setup lang=\"ts\">\n/**\n * A WYSIWYG editor built on tiptap, with a formatting toolbar covering text styles, lists, alignment, links,\n * and images.\n *\n * @event update:modelValue Emitted with the editor HTML on every content change — powers v-model\n */\nimport { ref, watch, onMounted, onBeforeUnmount, shallowRef, computed } from 'vue'\nimport MIcon from './MIcon.vue'\nimport MMenu from './MMenu.vue'\nimport MMenuItem from './MMenuItem.vue'\nimport MDialog from './MDialog.vue'\nimport MTextField from './MTextField.vue'\nimport MButton from './MButton.vue'\nimport { useLocale } from '../composables/useLocale'\n\nexport interface RichTextEditorLabels {\n bold?: string\n italic?: string\n underline?: string\n strikethrough?: string\n highlight?: string\n bulletList?: string\n orderedList?: string\n blockquote?: string\n code?: string\n alignLeft?: string\n alignCenter?: string\n alignRight?: string\n undo?: string\n redo?: string\n link?: string\n image?: string\n paragraph?: string\n heading1?: string\n heading2?: string\n heading3?: string\n insertLink?: string\n insertImage?: string\n imageUrlLabel?: string\n cancel?: string\n insert?: string\n}\n\nconst locale = useLocale()\n\nconst props = withDefaults(\n defineProps<{\n /** HTML content (v-model) */\n modelValue: string\n /** Placeholder text shown on an empty document */\n placeholder?: string\n /** Disables editing */\n disabled?: boolean\n /** Minimum editor height */\n minHeight?: string\n /**\n * Object with all toolbar/dialog label overrides for i18n (see `RichTextEditorLabels`) — defaults come from\n * useLocale()\n */\n labels?: RichTextEditorLabels\n }>(),\n { disabled: false, minHeight: '200px' },\n)\n\nconst l = computed<Required<RichTextEditorLabels>>(() => ({\n bold: locale.bold,\n italic: locale.italic,\n underline: locale.underline,\n strikethrough: locale.strikethrough,\n highlight: locale.highlight,\n bulletList: locale.bulletList,\n orderedList: locale.orderedList,\n blockquote: locale.blockquote,\n code: locale.code,\n alignLeft: locale.alignLeft,\n alignCenter: locale.alignCenter,\n alignRight: locale.alignRight,\n undo: locale.undo,\n redo: locale.redo,\n link: locale.link,\n image: locale.image,\n paragraph: locale.paragraph,\n heading1: locale.heading1,\n heading2: locale.heading2,\n heading3: locale.heading3,\n insertLink: locale.insertLink,\n insertImage: locale.insertImage,\n imageUrlLabel: locale.imageUrlLabel,\n cancel: locale.cancel,\n insert: locale.insert,\n ...props.labels,\n}))\n\nconst emit = defineEmits<{ 'update:modelValue': [string] }>()\n\nconst ready = ref(false)\nconst editorRef = shallowRef<any>(null)\nconst editorContainer = ref<HTMLElement | null>(null)\n\ninterface ToolBtn {\n icon: string\n label: string\n action: () => void\n active?: () => boolean\n}\n\nconst toolGroups = ref<ToolBtn[][]>([])\n\nonMounted(async () => {\n const [\n { Editor },\n { default: StarterKit },\n { default: Underline },\n { default: TextAlign },\n { default: Link },\n { default: Image },\n { default: Highlight },\n { default: Placeholder },\n { TextStyle },\n { default: Color },\n ] = await Promise.all([\n import('@tiptap/vue-3'),\n import('@tiptap/starter-kit'),\n import('@tiptap/extension-underline'),\n import('@tiptap/extension-text-align'),\n import('@tiptap/extension-link'),\n import('@tiptap/extension-image'),\n import('@tiptap/extension-highlight'),\n import('@tiptap/extension-placeholder'),\n import('@tiptap/extension-text-style'),\n import('@tiptap/extension-color'),\n ])\n\n const editor = new Editor({\n element: editorContainer.value!,\n content: props.modelValue,\n editable: !props.disabled,\n extensions: [\n StarterKit,\n Underline,\n TextAlign.configure({ types: ['heading', 'paragraph'] }),\n Link.configure({ openOnClick: false }),\n Image,\n Highlight.configure({ multicolor: true }),\n Placeholder.configure({ placeholder: props.placeholder ?? 'Start writing...' }),\n TextStyle,\n Color,\n ],\n onUpdate: ({ editor: e }) => emit('update:modelValue', e.getHTML()),\n })\n\n editorRef.value = editor\n\n toolGroups.value = [\n [\n { icon: 'format_bold', label: l.value.bold, action: () => editor.chain().focus().toggleBold().run(), active: () => !!editor.isActive('bold') },\n { icon: 'format_italic', label: l.value.italic, action: () => editor.chain().focus().toggleItalic().run(), active: () => !!editor.isActive('italic') },\n { icon: 'format_underlined', label: l.value.underline, action: () => editor.chain().focus().toggleUnderline().run(), active: () => !!editor.isActive('underline') },\n { icon: 'format_strikethrough', label: l.value.strikethrough, action: () => editor.chain().focus().toggleStrike().run(), active: () => !!editor.isActive('strike') },\n { icon: 'ink_highlighter', label: l.value.highlight, action: () => editor.chain().focus().toggleHighlight().run(), active: () => !!editor.isActive('highlight') },\n ],\n [\n { icon: 'format_list_bulleted', label: l.value.bulletList, action: () => editor.chain().focus().toggleBulletList().run(), active: () => !!editor.isActive('bulletList') },\n { icon: 'format_list_numbered', label: l.value.orderedList, action: () => editor.chain().focus().toggleOrderedList().run(), active: () => !!editor.isActive('orderedList') },\n { icon: 'format_quote', label: l.value.blockquote, action: () => editor.chain().focus().toggleBlockquote().run(), active: () => !!editor.isActive('blockquote') },\n { icon: 'code', label: l.value.code, action: () => editor.chain().focus().toggleCode().run(), active: () => !!editor.isActive('code') },\n ],\n [\n { icon: 'format_align_left', label: l.value.alignLeft, action: () => editor.chain().focus().setTextAlign('left').run(), active: () => !!editor.isActive({ textAlign: 'left' }) },\n { icon: 'format_align_center', label: l.value.alignCenter, action: () => editor.chain().focus().setTextAlign('center').run(), active: () => !!editor.isActive({ textAlign: 'center' }) },\n { icon: 'format_align_right', label: l.value.alignRight, action: () => editor.chain().focus().setTextAlign('right').run(), active: () => !!editor.isActive({ textAlign: 'right' }) },\n ],\n [\n { icon: 'undo', label: l.value.undo, action: () => editor.chain().focus().undo().run() },\n { icon: 'redo', label: l.value.redo, action: () => editor.chain().focus().redo().run() },\n ],\n ]\n\n onBeforeUnmount(() => editor.destroy())\n\n watch(() => props.modelValue, (val) => {\n if (editor.getHTML() !== val) editor.commands.setContent(val)\n })\n\n watch(() => props.disabled, (v) => editor.setEditable(!v))\n\n ready.value = true\n})\n\nconst linkDialogOpen = ref(false)\nconst linkUrl = ref('')\nconst imageDialogOpen = ref(false)\nconst imageUrl = ref('')\n\nconst headingLabel = computed(() => {\n const e = editorRef.value\n if (!e) return l.value.paragraph\n if (e.isActive('heading', { level: 1 })) return l.value.heading1\n if (e.isActive('heading', { level: 2 })) return l.value.heading2\n if (e.isActive('heading', { level: 3 })) return l.value.heading3\n return l.value.paragraph\n})\n\nfunction setHeading(level: 0 | 1 | 2 | 3) {\n if (level === 0) editorRef.value?.chain().focus().setParagraph().run()\n else editorRef.value?.chain().focus().toggleHeading({ level }).run()\n}\n\nfunction openLinkDialog() {\n linkUrl.value = ''\n linkDialogOpen.value = true\n}\n\nfunction confirmLink() {\n if (linkUrl.value) editorRef.value?.chain().focus().setLink({ href: linkUrl.value }).run()\n linkDialogOpen.value = false\n}\n\nfunction openImageDialog() {\n imageUrl.value = ''\n imageDialogOpen.value = true\n}\n\nfunction confirmImage() {\n if (imageUrl.value) editorRef.value?.chain().focus().setImage({ src: imageUrl.value }).run()\n imageDialogOpen.value = false\n}\n</script>\n\n<template>\n <div\n class=\"overflow-hidden rounded-lg border transition-colors duration-150\"\n :class=\"disabled ? 'border-outline-variant/50 opacity-60' : 'border-outline-variant focus-within:border-primary'\"\n >\n <!-- Toolbar -->\n <div v-if=\"ready\" class=\"flex flex-wrap items-center gap-0.5 border-b border-outline-variant bg-surface-container px-2 py-1.5\">\n <!-- Heading menu -->\n <MMenu align=\"left\">\n <template #trigger>\n <button\n type=\"button\"\n class=\"flex h-8 cursor-pointer items-center gap-1 rounded px-2 text-label-large text-on-surface-variant hover:bg-on-surface/8\"\n >\n {{ headingLabel }}\n <MIcon name=\"arrow_drop_down\" :size=\"20\" />\n </button>\n </template>\n <MMenuItem @click=\"setHeading(0)\">{{ l.paragraph }}</MMenuItem>\n <MMenuItem @click=\"setHeading(1)\">{{ l.heading1 }}</MMenuItem>\n <MMenuItem @click=\"setHeading(2)\">{{ l.heading2 }}</MMenuItem>\n <MMenuItem @click=\"setHeading(3)\">{{ l.heading3 }}</MMenuItem>\n </MMenu>\n\n <div class=\"mx-1 h-6 w-px bg-outline-variant\" />\n\n <template v-for=\"(group, gi) in toolGroups\" :key=\"gi\">\n <button\n v-for=\"btn in group\"\n :key=\"btn.icon\"\n type=\"button\"\n :title=\"btn.label\"\n class=\"flex h-8 w-8 cursor-pointer items-center justify-center rounded transition-colors duration-100\"\n :class=\"btn.active?.() ? 'bg-secondary-container text-on-secondary-container' : 'text-on-surface-variant hover:bg-on-surface/8'\"\n @click=\"btn.action\"\n >\n <MIcon :name=\"btn.icon\" :size=\"20\" />\n </button>\n <div v-if=\"gi < toolGroups.length - 1\" class=\"mx-1 h-6 w-px bg-outline-variant\" />\n </template>\n\n <div class=\"mx-1 h-6 w-px bg-outline-variant\" />\n\n <button\n type=\"button\"\n :title=\"l.link\"\n class=\"flex h-8 w-8 cursor-pointer items-center justify-center rounded text-on-surface-variant transition-colors hover:bg-on-surface/8\"\n @click=\"openLinkDialog\"\n >\n <MIcon name=\"link\" :size=\"20\" />\n </button>\n <button\n type=\"button\"\n :title=\"l.image\"\n class=\"flex h-8 w-8 cursor-pointer items-center justify-center rounded text-on-surface-variant transition-colors hover:bg-on-surface/8\"\n @click=\"openImageDialog\"\n >\n <MIcon name=\"image\" :size=\"20\" />\n </button>\n </div>\n\n <!-- Editor content -->\n <div\n ref=\"editorContainer\"\n class=\"rte-content bg-surface px-4 py-3 text-body-large text-on-surface\"\n :style=\"{ minHeight: minHeight }\"\n />\n\n <!-- Link dialog -->\n <MDialog v-model=\"linkDialogOpen\" :title=\"l.insertLink\">\n <MTextField v-model=\"linkUrl\" label=\"URL\" placeholder=\" \" @keydown.enter=\"confirmLink\" />\n <template #actions>\n <MButton variant=\"text\" @click=\"linkDialogOpen = false\">{{ l.cancel }}</MButton>\n <MButton @click=\"confirmLink\">{{ l.insert }}</MButton>\n </template>\n </MDialog>\n\n <!-- Image dialog -->\n <MDialog v-model=\"imageDialogOpen\" :title=\"l.insertImage\">\n <MTextField v-model=\"imageUrl\" :label=\"l.imageUrlLabel\" placeholder=\" \" @keydown.enter=\"confirmImage\" />\n <template #actions>\n <MButton variant=\"text\" @click=\"imageDialogOpen = false\">{{ l.cancel }}</MButton>\n <MButton @click=\"confirmImage\">{{ l.insert }}</MButton>\n </template>\n </MDialog>\n </div>\n</template>\n\n<style scoped>\n.rte-content :deep(.tiptap) {\n outline: none;\n min-height: inherit;\n}\n\n.rte-content :deep(.tiptap p.is-editor-empty:first-child::before) {\n content: attr(data-placeholder);\n float: left;\n color: var(--color-on-surface-variant);\n opacity: 0.5;\n pointer-events: none;\n height: 0;\n}\n\n.rte-content :deep(h1) { font-size: var(--text-headline-large); line-height: var(--text-headline-large--line-height); font-weight: 600; margin: 0.75em 0 0.25em; }\n.rte-content :deep(h2) { font-size: var(--text-headline-medium); line-height: var(--text-headline-medium--line-height); font-weight: 600; margin: 0.75em 0 0.25em; }\n.rte-content :deep(h3) { font-size: var(--text-headline-small); line-height: var(--text-headline-small--line-height); font-weight: 600; margin: 0.75em 0 0.25em; }\n.rte-content :deep(p) { margin: 0.5em 0; }\n.rte-content :deep(ul) { list-style-type: disc; padding-left: 1.5em; margin: 0.5em 0; }\n.rte-content :deep(ol) { list-style-type: decimal; padding-left: 1.5em; margin: 0.5em 0; }\n.rte-content :deep(blockquote) { border-left: 3px solid var(--color-primary); padding-left: 1em; margin: 0.5em 0; color: var(--color-on-surface-variant); }\n.rte-content :deep(code) { background: var(--color-surface-container-highest); padding: 0.15em 0.4em; border-radius: 4px; font-size: 0.875em; }\n.rte-content :deep(pre) { background: var(--color-surface-container-highest); padding: 1em; border-radius: 8px; overflow-x: auto; margin: 0.5em 0; }\n.rte-content :deep(pre code) { background: none; padding: 0; }\n.rte-content :deep(a) { color: var(--color-primary); text-decoration: underline; }\n.rte-content :deep(mark) { background: var(--color-tertiary-container); color: var(--color-on-tertiary-container); padding: 0.1em 0.2em; border-radius: 2px; }\n.rte-content :deep(img) { max-width: 100%; height: auto; border-radius: 8px; margin: 0.5em 0; }\n</style>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA4CA,IAAM,IAAS,EAAU,GAEnB,IAAQ,GAmBR,IAAI,SAAgD;GACxD,MAAM,EAAO;GACb,QAAQ,EAAO;GACf,WAAW,EAAO;GAClB,eAAe,EAAO;GACtB,WAAW,EAAO;GAClB,YAAY,EAAO;GACnB,aAAa,EAAO;GACpB,YAAY,EAAO;GACnB,MAAM,EAAO;GACb,WAAW,EAAO;GAClB,aAAa,EAAO;GACpB,YAAY,EAAO;GACnB,MAAM,EAAO;GACb,MAAM,EAAO;GACb,MAAM,EAAO;GACb,OAAO,EAAO;GACd,WAAW,EAAO;GAClB,UAAU,EAAO;GACjB,UAAU,EAAO;GACjB,UAAU,EAAO;GACjB,YAAY,EAAO;GACnB,aAAa,EAAO;GACpB,eAAe,EAAO;GACtB,QAAQ,EAAO;GACf,QAAQ,EAAO;GACf,GAAG,EAAM;EACX,EAAE,GAEI,IAAO,GAEP,IAAQ,EAAI,EAAK,GACjB,IAAY,EAAgB,IAAI,GAChC,IAAkB,EAAwB,IAAI,GAS9C,IAAa,EAAiB,CAAC,CAAC;EAEtC,EAAU,YAAY;GACpB,IAAM,CACJ,EAAE,aACF,EAAE,SAAS,K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