@m3ui-vue/m3ui-vue 1.10.2 → 1.11.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 +19 -4
- package/dist/API.md +204 -59
- package/dist/MButton-BHKF1Tfd.js +284 -0
- package/dist/MButton-BHKF1Tfd.js.map +1 -0
- package/dist/MColorPickerModal-CNesUJUq.js +466 -0
- package/dist/MColorPickerModal-CNesUJUq.js.map +1 -0
- package/dist/MDialog-jAYkZ4M8.js +226 -0
- package/dist/MDialog-jAYkZ4M8.js.map +1 -0
- package/dist/{MIcon-BSsJZhK7.js → MIcon-CkUc9kuQ.js} +10 -4
- package/dist/MIcon-CkUc9kuQ.js.map +1 -0
- package/dist/MIconButton-DTFOfsTy.js +317 -0
- package/dist/MIconButton-DTFOfsTy.js.map +1 -0
- package/dist/MListItem-CgdM5sco.js +1306 -0
- package/dist/MListItem-CgdM5sco.js.map +1 -0
- package/dist/MLoadingIndicator-00XbLQSf.js +115 -0
- package/dist/MLoadingIndicator-00XbLQSf.js.map +1 -0
- package/dist/{MMenuItem-US0Zbglq.js → MMenuItem-CEIKYvaX.js} +216 -214
- package/dist/MMenuItem-CEIKYvaX.js.map +1 -0
- package/dist/{MPdfViewer-DL9mRsd2.js → MPdfViewer-KjUIJOIs.js} +674 -671
- package/dist/MPdfViewer-KjUIJOIs.js.map +1 -0
- package/dist/MProgressBar-BzZMxq7M.js.map +1 -1
- package/dist/MSeekBar-B4EEWw3B.js +435 -0
- package/dist/MSeekBar-B4EEWw3B.js.map +1 -0
- package/dist/{MSegmentedButton-DMou-8sG.js → MSegmentedButton-UOAJAd2i.js} +4 -4
- package/dist/{MSegmentedButton-DMou-8sG.js.map → MSegmentedButton-UOAJAd2i.js.map} +1 -1
- package/dist/{MSignaturePad-WuvE_Cyl.js → MSignaturePad-HZavgiGB.js} +2 -2
- package/dist/{MSignaturePad-WuvE_Cyl.js.map → MSignaturePad-HZavgiGB.js.map} +1 -1
- package/dist/{MSlider-7TzhFHKS.js → MSlider-BaQeaozI.js} +4 -4
- package/dist/{MSlider-7TzhFHKS.js.map → MSlider-BaQeaozI.js.map} +1 -1
- package/dist/{MSpinner-CkIVBuGE.js → MSpinner-CbEMPY4X.js} +2 -2
- package/dist/{MSpinner-CkIVBuGE.js.map → MSpinner-CbEMPY4X.js.map} +1 -1
- package/dist/{MTextField-B6_iOczK.js → MTextField-B9PwKHlP.js} +136 -134
- package/dist/MTextField-B9PwKHlP.js.map +1 -0
- package/dist/{_useFieldValidation-COBJ1tWr.js → _useFieldValidation-B7AAfa69.js} +2 -2
- package/dist/{_useFieldValidation-COBJ1tWr.js.map → _useFieldValidation-B7AAfa69.js.map} +1 -1
- package/dist/api.json +1 -1
- package/dist/chart.js +1 -1
- package/dist/code-editor.js +3 -3
- package/dist/code-editor.js.map +1 -1
- package/dist/components/MAlert.vue.d.ts +1 -1
- package/dist/components/MAudioPlayer.vue.d.ts +3 -3
- package/dist/components/MAudioRecorder.vue.d.ts +2 -2
- package/dist/components/MAvatar.vue.d.ts +19 -1
- package/dist/components/MButton.vue.d.ts +2 -1
- package/dist/components/MChatBubble.vue.d.ts +2 -0
- package/dist/components/MCheckbox.vue.d.ts +2 -0
- package/dist/components/MDataTable.vue.d.ts +33 -5
- package/dist/components/MFlow.vue.d.ts +1 -1
- package/dist/components/MHotkeys.vue.d.ts +1 -0
- package/dist/components/MIcon.vue.d.ts +6 -0
- package/dist/components/MIconButton.vue.d.ts +5 -0
- package/dist/components/MJsonViewer.vue.d.ts +2 -0
- package/dist/components/MKanban.vue.d.ts +1 -1
- package/dist/components/MLink.vue.d.ts +59 -0
- package/dist/components/MListItem.vue.d.ts +3 -1
- package/dist/components/MMapControl.vue.d.ts +1 -1
- package/dist/components/MNotificationCenter.vue.d.ts +1 -1
- package/dist/components/MNumberField.vue.d.ts +1 -1
- package/dist/components/MPagination.vue.d.ts +14 -1
- package/dist/components/MPdfSigner.vue.d.ts +3 -3
- package/dist/components/MRadio.vue.d.ts +2 -0
- package/dist/components/MRadioGroup.vue.d.ts +2 -0
- package/dist/components/MStatCard.vue.d.ts +2 -2
- package/dist/components/MSwitch.vue.d.ts +2 -0
- package/dist/components/MTable.vue.d.ts +1 -1
- package/dist/components/MText.vue.d.ts +4 -2
- package/dist/components/MTextField.vue.d.ts +2 -0
- package/dist/components/MTicket.vue.d.ts +1 -1
- package/dist/components/_MDrawerItemList.vue.d.ts +6 -0
- package/dist/composables/_countLabel.d.ts +6 -0
- package/dist/composables/_menuGroups.d.ts +10 -1
- package/dist/composables/_splitAttrs.d.ts +6 -0
- package/dist/composables/_springAnimation.d.ts +2 -2
- package/dist/composables/_useFocusTrap.d.ts +15 -0
- package/dist/composables/_usePaneResize.d.ts +1 -1
- package/dist/composables/_useSpring.d.ts +4 -4
- package/dist/composables/dynamicColor.d.ts +9 -1
- package/dist/composables/motion.d.ts +63 -0
- package/dist/composables/useConfirm.d.ts +28 -0
- package/dist/composables/useDevice.d.ts +8 -1
- package/dist/composables/useLocale.d.ts +18 -0
- package/dist/composables/useScrollReveal.d.ts +1 -1
- package/dist/composables/useTheme.d.ts +1 -0
- package/dist/composables/useToast.d.ts +7 -0
- package/dist/draw.js +556 -556
- package/dist/draw.js.map +1 -1
- package/dist/flow.js +854 -851
- package/dist/flow.js.map +1 -1
- package/dist/gantt.js +1118 -1096
- package/dist/gantt.js.map +1 -1
- package/dist/index.d.ts +8 -5
- package/dist/locales/index.d.ts +1 -0
- package/dist/locales/index.js +865 -33
- package/dist/locales/index.js.map +1 -1
- package/dist/locales/pl.d.ts +2 -0
- package/dist/m3ui-vue.css +1 -1
- package/dist/m3ui.js +10335 -9798
- package/dist/m3ui.js.map +1 -1
- package/dist/map.js +860 -860
- package/dist/map.js.map +1 -1
- package/dist/{material-color-utilities-CEFytLsr.js → material-color-utilities-BZsBNIhi.js} +276 -217
- package/dist/material-color-utilities-BZsBNIhi.js.map +1 -0
- package/dist/media.js +7 -7
- package/dist/{motion-BcejVTeX.js → motion-BqYcqcim.js} +15 -5
- package/dist/motion-BqYcqcim.js.map +1 -0
- package/dist/pdf-sign.js +140 -137
- package/dist/pdf-sign.js.map +1 -1
- package/dist/pdf.js +1 -1
- package/dist/plugin.d.ts +11 -0
- package/dist/rich-text-editor.js +7 -7
- package/dist/styles/theme.css +40 -0
- package/dist/styles.css +1 -1
- package/dist/terminal.js +1 -1
- package/dist/{useLocale-YRaOT12S.js → useLocale-BAPJ34Pq.js} +64 -8
- package/dist/useLocale-BAPJ34Pq.js.map +1 -0
- package/dist/{useThemeTokens-DyAdPQB0.js → useThemeTokens-D5nr5KHf.js} +28 -27
- package/dist/useThemeTokens-D5nr5KHf.js.map +1 -0
- package/package.json +17 -2
- package/src/__tests__/MAvatarImage.test.ts +37 -0
- package/src/__tests__/MDataTableControlled.test.ts +68 -0
- package/src/__tests__/MHotkeysSequence.test.ts +53 -0
- package/src/__tests__/MIconAxes.test.ts +16 -0
- package/src/__tests__/MIconButtonWidth.test.ts +22 -0
- package/src/__tests__/MLink.test.ts +46 -0
- package/src/__tests__/MPaginationPages.test.ts +43 -0
- package/src/__tests__/MTextEmphasized.test.ts +14 -0
- package/src/__tests__/controlDescription.test.ts +34 -0
- package/src/__tests__/countLabels.test.ts +66 -0
- package/src/__tests__/customColor.test.ts +27 -0
- package/src/__tests__/dynamicColor.test.ts +3 -2
- package/src/__tests__/focusTrap.test.ts +124 -0
- package/src/__tests__/formatMessage.test.ts +20 -0
- package/src/__tests__/inputAttrs.test.ts +103 -0
- package/src/__tests__/localePresets.test.ts +2 -0
- package/src/__tests__/menuGroupsRemount.test.ts +40 -0
- package/src/__tests__/menuHydration.test.ts +41 -0
- package/src/__tests__/motionPrefs.test.ts +28 -0
- package/src/__tests__/ssr.test.ts +11 -0
- package/src/__tests__/ssrToast.test.ts +20 -0
- package/src/__tests__/toastDetails.test.ts +39 -0
- package/src/__tests__/useConfirm.test.ts +47 -0
- package/src/__tests__/useTheme.test.ts +14 -0
- package/src/__tests__/warningRole.test.ts +22 -0
- package/src/components/MAlert.vue +2 -2
- package/src/components/MAnimatedNumber.vue +9 -3
- package/src/components/MAutocomplete.vue +16 -4
- package/src/components/MAvailabilityCalendar.vue +3 -3
- package/src/components/MAvatar.vue +32 -5
- package/src/components/MAvatarGroup.vue +7 -2
- package/src/components/MBottomSheet.vue +18 -2
- package/src/components/MButton.vue +18 -5
- package/src/components/MCarousel.vue +3 -3
- package/src/components/MChatBubble.vue +14 -1
- package/src/components/MCheckbox.vue +21 -4
- package/src/components/MChip.vue +4 -2
- package/src/components/MCollapse.vue +7 -1
- package/src/components/MCommandPalette.vue +6 -2
- package/src/components/MContextMenu.vue +4 -4
- package/src/components/MCreditCardInput.vue +5 -0
- package/src/components/MDashboardGrid.vue +2 -1
- package/src/components/MDataTable.vue +68 -20
- package/src/components/MDialog.vue +21 -3
- package/src/components/MDiffViewer.vue +3 -3
- package/src/components/MDrawLayers.vue +3 -3
- package/src/components/MFabMenu.vue +7 -0
- package/src/components/MFloorPlan.vue +3 -3
- package/src/components/MFloorPlanInspector.vue +3 -3
- package/src/components/MFlow.vue +9 -5
- package/src/components/MFlowControls.vue +6 -0
- package/src/components/MFormBuilder.vue +1 -1
- package/src/components/MGantt.vue +10 -10
- package/src/components/MHotkeys.vue +61 -16
- package/src/components/MIcon.vue +17 -1
- package/src/components/MIconButton.vue +29 -6
- package/src/components/MImageCropper.vue +1 -1
- package/src/components/MJsonViewer.vue +4 -1
- package/src/components/MKanban.vue +2 -1
- package/src/components/MLightbox.vue +5 -4
- package/src/components/MLink.vue +136 -0
- package/src/components/MListDetail.vue +7 -0
- package/src/components/MListItem.vue +7 -4
- package/src/components/MLoadingIndicator.vue +2 -1
- package/src/components/MMap.vue +3 -0
- package/src/components/MMapCluster.vue +2 -2
- package/src/components/MMapControl.vue +2 -2
- package/src/components/MMapMeasure.vue +1 -1
- package/src/components/MMaskField.vue +16 -3
- package/src/components/MMenu.vue +4 -4
- package/src/components/MMenuItem.vue +2 -2
- package/src/components/MMeterGroup.vue +3 -2
- package/src/components/MMortgageCalculator.vue +3 -3
- package/src/components/MMultiAutocomplete.vue +19 -7
- package/src/components/MMultiSelect.vue +19 -7
- package/src/components/MNavigationDrawer.vue +10 -3
- package/src/components/MNavigationRail.vue +5 -1
- package/src/components/MNotificationCenter.vue +2 -1
- package/src/components/MNotificationHost.vue +3 -3
- package/src/components/MNumberField.vue +23 -6
- package/src/components/MOdontogram.vue +4 -4
- package/src/components/MOrderBook.vue +4 -0
- package/src/components/MPagination.vue +91 -12
- package/src/components/MPdfSigner.vue +3 -3
- package/src/components/MPdfViewer.vue +7 -7
- package/src/components/MPhoneInput.vue +17 -4
- package/src/components/MProductConfigurator.vue +4 -4
- package/src/components/MProgressBar.vue +5 -0
- package/src/components/MQuiz.vue +8 -5
- package/src/components/MRadio.vue +24 -5
- package/src/components/MRadioGroup.vue +3 -0
- package/src/components/MReactions.vue +2 -2
- package/src/components/MResourceTimeline.vue +3 -3
- package/src/components/MResult.vue +1 -1
- package/src/components/MScrollField.vue +1 -1
- package/src/components/MSearchField.vue +6 -5
- package/src/components/MSeatMap.vue +5 -0
- package/src/components/MSeekBar.vue +3 -2
- package/src/components/MSelect.vue +16 -4
- package/src/components/MSideSheet.vue +25 -3
- package/src/components/MSimpleCarousel.vue +2 -2
- package/src/components/MSnackbar.vue +16 -13
- package/src/components/MSparkline.vue +2 -1
- package/src/components/MSpinner.vue +8 -0
- package/src/components/MSplitter.vue +1 -1
- package/src/components/MSpotlightSearch.vue +6 -2
- package/src/components/MSpreadsheet.vue +1 -1
- package/src/components/MStatCard.vue +2 -1
- package/src/components/MSwitch.vue +21 -4
- package/src/components/MTable.vue +3 -2
- package/src/components/MTabs.vue +2 -1
- package/src/components/MTagInput.vue +19 -6
- package/src/components/MText.vue +23 -4
- package/src/components/MTextField.vue +25 -6
- package/src/components/MTimeline.vue +5 -5
- package/src/components/MToolbar.vue +2 -2
- package/src/components/MTour.vue +3 -0
- package/src/components/MTrackingTimeline.vue +6 -0
- package/src/components/MTypewriter.vue +7 -1
- package/src/components/MWindow.vue +10 -1
- package/src/components/_MColorPanel.vue +4 -4
- package/src/components/_MComment.vue +3 -2
- package/src/components/_MFlowNodeShell.vue +1 -1
- package/src/components/_MPdfPage.vue +1 -1
- package/src/components/_MTransferPane.vue +10 -0
- package/src/composables/_countLabel.ts +10 -0
- package/src/composables/_effectCanvas.ts +2 -1
- package/src/composables/_menuGroups.ts +10 -1
- package/src/composables/_splitAttrs.ts +29 -0
- package/src/composables/_springAnimation.ts +3 -3
- package/src/composables/_themeTransition.ts +3 -2
- package/src/composables/_useFocusTrap.ts +142 -0
- package/src/composables/_useMenuNav.ts +3 -3
- package/src/composables/_usePaneResize.ts +2 -1
- package/src/composables/_useSheetMotion.ts +3 -4
- package/src/composables/_useSpring.ts +16 -10
- package/src/composables/cron.ts +7 -6
- package/src/composables/dynamicColor.ts +21 -2
- package/src/composables/motion.ts +27 -0
- package/src/composables/useConfirm.ts +116 -0
- package/src/composables/useDevice.ts +23 -3
- package/src/composables/useFieldBg.ts +4 -0
- package/src/composables/useLocale.ts +82 -4
- package/src/composables/useNotification.ts +3 -0
- package/src/composables/useScrollReveal.ts +3 -3
- package/src/composables/useTheme.ts +8 -2
- package/src/composables/useToast.ts +27 -4
- package/src/directives/vSparkle.ts +2 -1
- package/src/index.ts +8 -5
- package/src/locales/ar.ts +11 -4
- package/src/locales/de.ts +11 -4
- package/src/locales/es.ts +11 -4
- package/src/locales/fr.ts +11 -4
- package/src/locales/index.ts +1 -0
- package/src/locales/ja.ts +11 -4
- package/src/locales/ko.ts +11 -4
- package/src/locales/pl.ts +807 -0
- package/src/locales/pt.ts +11 -4
- package/src/locales/zh.ts +11 -4
- package/src/plugin.ts +16 -0
- package/src/styles/theme.css +40 -0
- package/dist/MButton-B9RCM06i.js +0 -171
- package/dist/MButton-B9RCM06i.js.map +0 -1
- package/dist/MColorPickerModal-ChRtcZOo.js +0 -577
- package/dist/MColorPickerModal-ChRtcZOo.js.map +0 -1
- package/dist/MDialog-dk07tify.js +0 -167
- package/dist/MDialog-dk07tify.js.map +0 -1
- package/dist/MIcon-BSsJZhK7.js.map +0 -1
- package/dist/MIconButton-CrBPZidd.js +0 -288
- package/dist/MIconButton-CrBPZidd.js.map +0 -1
- package/dist/MListItem-h9H223vx.js +0 -1239
- package/dist/MListItem-h9H223vx.js.map +0 -1
- package/dist/MLoadingIndicator-YTV1Ov5w.js +0 -114
- package/dist/MLoadingIndicator-YTV1Ov5w.js.map +0 -1
- package/dist/MMenuItem-US0Zbglq.js.map +0 -1
- package/dist/MPdfViewer-DL9mRsd2.js.map +0 -1
- package/dist/MSeekBar-JFZcoJ8y.js +0 -434
- package/dist/MSeekBar-JFZcoJ8y.js.map +0 -1
- package/dist/MTextField-B6_iOczK.js.map +0 -1
- package/dist/material-color-utilities-CEFytLsr.js.map +0 -1
- package/dist/motion-BcejVTeX.js.map +0 -1
- package/dist/useLocale-YRaOT12S.js.map +0 -1
- package/dist/useThemeTokens-DyAdPQB0.js.map +0 -1
|
@@ -55,7 +55,7 @@ import {
|
|
|
55
55
|
import { DAY, addDays, daysBetween, defaultSnap, formatDate, parseDate, snapTime } from '../composables/_ganttTime'
|
|
56
56
|
import { arrowPath } from '../composables/flowPaths'
|
|
57
57
|
import { playSamples, prefersReducedMotion, sampleSpring } from '../composables/_springAnimation'
|
|
58
|
-
import { useLocale } from '../composables/useLocale'
|
|
58
|
+
import { useLocale, formatMessage } from '../composables/useLocale'
|
|
59
59
|
import { useTimeAxis } from '../composables/_useTimeAxis'
|
|
60
60
|
import { holdDragCursor, releaseDragCursor } from '../composables/_dragCursor'
|
|
61
61
|
import MTimeHeader from './_MTimeHeader.vue'
|
|
@@ -568,7 +568,7 @@ function link(from: string, to: string, type: NonNullable<GanttDependency['type'
|
|
|
568
568
|
if (props.schedule === 'auto') next = scheduleTasks(next, scheduleOptions())
|
|
569
569
|
commit(next)
|
|
570
570
|
emit('link', { from, to, type })
|
|
571
|
-
announce(locale.ganttLinked
|
|
571
|
+
announce(formatMessage(locale.ganttLinked, { from: byId.value.get(from)?.name ?? from, to: byId.value.get(to)?.name ?? to }, locale.lang))
|
|
572
572
|
}
|
|
573
573
|
const scheduleOptions = (): GanttScheduleOptions => ({ calendar: props.calendar ? props.calendar : undefined })
|
|
574
574
|
|
|
@@ -606,7 +606,7 @@ async function removeTasks(ids: string[]) {
|
|
|
606
606
|
.map((t) => (t.dependencies?.some((d) => gone.has(normalizeDependency(d).id)) ? { ...t, dependencies: t.dependencies.filter((d) => !gone.has(normalizeDependency(d).id)) } : t)))
|
|
607
607
|
setSelection(selected.value.filter((id) => !gone.has(id)))
|
|
608
608
|
emit('delete', { tasks: removed })
|
|
609
|
-
announce(locale.ganttDeleted
|
|
609
|
+
announce(formatMessage(locale.ganttDeleted, { count: String(removed.length) }, locale.lang))
|
|
610
610
|
}
|
|
611
611
|
function runSchedule(options?: GanttScheduleOptions) {
|
|
612
612
|
commit(scheduleTasks(current.value, { ...scheduleOptions(), ...options }))
|
|
@@ -884,7 +884,7 @@ function moveRow(id: string, target: string, where: 'before' | 'after' | 'inside
|
|
|
884
884
|
commit(next)
|
|
885
885
|
const pos = rows.value.findIndex((r) => r.task.id === id) + 1
|
|
886
886
|
emit('change', { tasks: [moved], kind: 'reorder' })
|
|
887
|
-
nextTick(() => announce(locale.ganttReordered
|
|
887
|
+
nextTick(() => announce(formatMessage(locale.ganttReordered, { name: moved.name, pos: String(rows.value.findIndex((r) => r.task.id === id) + 1 || pos) }, locale.lang)))
|
|
888
888
|
}
|
|
889
889
|
|
|
890
890
|
function onUp(e: PointerEvent) {
|
|
@@ -929,8 +929,8 @@ function onUp(e: PointerEvent) {
|
|
|
929
929
|
const kind = g.part === 'progress' ? 'progress' : g.part === 'body' ? 'move' : 'resize'
|
|
930
930
|
emit('change', { tasks: changed, kind })
|
|
931
931
|
const lead = byNext.get(g.taskId)!
|
|
932
|
-
if (kind === 'progress') announce(locale.ganttProgressSet
|
|
933
|
-
else announce(locale.ganttMoved
|
|
932
|
+
if (kind === 'progress') announce(formatMessage(locale.ganttProgressSet, { name: lead.name, progress: String(lead.progress ?? 0) }, locale.lang))
|
|
933
|
+
else announce(formatMessage(locale.ganttMoved, { name: lead.name, start: formatShort(lead.start), end: formatShort(lead.end ?? lead.start) }, locale.lang))
|
|
934
934
|
}
|
|
935
935
|
function onCancel(e: PointerEvent) {
|
|
936
936
|
if (!gesture || gesture.id !== e.pointerId) return
|
|
@@ -1055,8 +1055,8 @@ function formatShort(s: string) {
|
|
|
1055
1055
|
function durationText(t: GanttTask) {
|
|
1056
1056
|
if (isMilestone(t)) return locale.ganttMilestone
|
|
1057
1057
|
const days = taskDays(t)
|
|
1058
|
-
if (taskSpan(t).dateOnly || days >= 1) return locale.ganttDays
|
|
1059
|
-
return locale.ganttHours
|
|
1058
|
+
if (taskSpan(t).dateOnly || days >= 1) return formatMessage(locale.ganttDays, { n: String(Math.round(days * 10) / 10) }, locale.lang)
|
|
1059
|
+
return formatMessage(locale.ganttHours, { n: String(Math.round(days * 24 * 10) / 10) }, locale.lang)
|
|
1060
1060
|
}
|
|
1061
1061
|
const columnWidths = computed(() => {
|
|
1062
1062
|
const fixed = columnList.value.reduce((s, c) => s + (c.key === 'name' && !c.width ? 0 : (c.width ?? 100)), 0)
|
|
@@ -1153,7 +1153,7 @@ function shiftTask(t: GanttTask, steps: number, endOnly: boolean) {
|
|
|
1153
1153
|
commit(next)
|
|
1154
1154
|
const moved = rollupSummaries(next).find((x) => x.id === t.id)!
|
|
1155
1155
|
emit('change', { tasks: [moved], kind: endOnly ? 'resize' : 'move' })
|
|
1156
|
-
announce(locale.ganttMoved
|
|
1156
|
+
announce(formatMessage(locale.ganttMoved, { name: moved.name, start: formatShort(moved.start), end: formatShort(moved.end ?? moved.start) }, locale.lang))
|
|
1157
1157
|
}
|
|
1158
1158
|
function onRowKey(e: KeyboardEvent, t: GanttTask) {
|
|
1159
1159
|
if (editing.value) return
|
|
@@ -1668,7 +1668,7 @@ defineExpose(context)
|
|
|
1668
1668
|
<template v-if="!isMilestone(tooltipTask) && tooltipTask.progress !== undefined"> · {{ Math.round(tooltipTask.progress) }}%</template>
|
|
1669
1669
|
</div>
|
|
1670
1670
|
<div v-if="criticalPath && criticalPathInfo.slack[tooltipTask.id] !== undefined" class="text-body-small" :class="criticalSet.has(tooltipTask.id) ? 'text-error' : 'text-on-surface-variant'">
|
|
1671
|
-
{{ criticalSet.has(tooltipTask.id) ? locale.ganttCritical : locale.ganttSlack
|
|
1671
|
+
{{ criticalSet.has(tooltipTask.id) ? locale.ganttCritical : formatMessage(locale.ganttSlack, { n: String(Math.round(criticalPathInfo.slack[tooltipTask.id]! * 10) / 10) }, locale.lang) }}
|
|
1672
1672
|
</div>
|
|
1673
1673
|
</slot>
|
|
1674
1674
|
</div>
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
/**
|
|
3
3
|
* Registers global keyboard shortcuts for as long as it's mounted, with an optional on-screen overlay listing
|
|
4
|
-
* them grouped by category.
|
|
4
|
+
* them grouped by category. A binding is a combination (`mod+k`, `shift+/`) or a sequence of them separated by spaces
|
|
5
|
+
* (`g n`: g, then n within a second, as on GitHub or Gmail).
|
|
5
6
|
*/
|
|
6
7
|
import { onMounted, onBeforeUnmount } from 'vue'
|
|
7
8
|
|
|
8
9
|
export interface HotkeyBinding {
|
|
10
|
+
/** A combination (`mod+k`) or a sequence separated by spaces (`g n`, `mod+k mod+s`) */
|
|
9
11
|
keys: string
|
|
10
12
|
label: string
|
|
11
13
|
handler: () => void
|
|
@@ -44,6 +46,15 @@ function formatKey(raw: string): string {
|
|
|
44
46
|
.replace(/arrowright/gi, '→')
|
|
45
47
|
}
|
|
46
48
|
|
|
49
|
+
// Steps of a sequence: spaces separate steps, `+` joins a combination (spaces around a `+` are allowed)
|
|
50
|
+
function parseSteps(keys: string): string[] {
|
|
51
|
+
return keys.trim().replace(/\s*\+\s*/g, '+').split(/\s+/)
|
|
52
|
+
}
|
|
53
|
+
const MODIFIERS = ['ctrl', 'alt', 'shift', 'meta', 'mod']
|
|
54
|
+
const MODIFIER_KEYS = ['Shift', 'Control', 'Alt', 'Meta', 'AltGraph', 'CapsLock']
|
|
55
|
+
// The next step of a sequence has to come within this long
|
|
56
|
+
const SEQUENCE_TIMEOUT = 1000
|
|
57
|
+
|
|
47
58
|
function parseCombo(keys: string) {
|
|
48
59
|
return keys.split('+').map(k => k.trim().toLowerCase())
|
|
49
60
|
}
|
|
@@ -66,20 +77,52 @@ function matchesEvent(combo: string[], e: KeyboardEvent): boolean {
|
|
|
66
77
|
&& e.key.toLowerCase() === key
|
|
67
78
|
}
|
|
68
79
|
|
|
80
|
+
// How many steps of each sequence binding have been typed, and when the last key came
|
|
81
|
+
let progress = new Map<HotkeyBinding, number>()
|
|
82
|
+
let lastKeyAt = 0
|
|
83
|
+
|
|
69
84
|
function onKeydown(e: KeyboardEvent) {
|
|
85
|
+
// Pressing Shift on its way to `shift+/` isn't a step, nor does it break a sequence
|
|
86
|
+
if (MODIFIER_KEYS.includes(e.key)) return
|
|
70
87
|
const tag = (e.target as HTMLElement).tagName
|
|
71
88
|
const editable = tag === 'INPUT' || tag === 'TEXTAREA' || (e.target as HTMLElement).isContentEditable
|
|
89
|
+
const now = Date.now()
|
|
90
|
+
if (now - lastKeyAt > SEQUENCE_TIMEOUT) progress = new Map()
|
|
91
|
+
lastKeyAt = now
|
|
72
92
|
|
|
93
|
+
const next = new Map<HotkeyBinding, number>()
|
|
94
|
+
let completed: HotkeyBinding | null = null
|
|
95
|
+
let continued = false
|
|
96
|
+
const singles: HotkeyBinding[] = []
|
|
73
97
|
for (const binding of props.bindings) {
|
|
74
98
|
if (binding.disabled) continue
|
|
75
|
-
const
|
|
76
|
-
|
|
77
|
-
if (
|
|
78
|
-
if (
|
|
79
|
-
e.
|
|
80
|
-
|
|
81
|
-
return
|
|
99
|
+
const steps = parseSteps(binding.keys).map(parseCombo)
|
|
100
|
+
// A key without a modifier is text in a field: the shortcut doesn't fire there
|
|
101
|
+
if (editable && steps.some(c => !c.some(k => MODIFIERS.includes(k)))) continue
|
|
102
|
+
if (steps.length === 1) {
|
|
103
|
+
if (matchesEvent(steps[0]!, e)) singles.push(binding)
|
|
104
|
+
continue
|
|
82
105
|
}
|
|
106
|
+
const done = progress.get(binding) ?? 0
|
|
107
|
+
let reached = 0
|
|
108
|
+
if (done > 0 && matchesEvent(steps[done]!, e)) { reached = done + 1; continued = true }
|
|
109
|
+
else if (matchesEvent(steps[0]!, e)) reached = 1
|
|
110
|
+
if (reached === steps.length) completed ??= binding
|
|
111
|
+
else if (reached > 0) next.set(binding, reached)
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
if (completed) {
|
|
115
|
+
progress = new Map()
|
|
116
|
+
e.preventDefault()
|
|
117
|
+
completed.handler()
|
|
118
|
+
return
|
|
119
|
+
}
|
|
120
|
+
progress = next
|
|
121
|
+
// A key that carries a sequence on (the n of `g n`) belongs to it, not to a single-key binding
|
|
122
|
+
if (continued) { e.preventDefault(); return }
|
|
123
|
+
if (singles[0]) {
|
|
124
|
+
e.preventDefault()
|
|
125
|
+
singles[0].handler()
|
|
83
126
|
}
|
|
84
127
|
}
|
|
85
128
|
|
|
@@ -112,14 +155,16 @@ const grouped = () => {
|
|
|
112
155
|
:class="b.disabled && 'opacity-38'"
|
|
113
156
|
>
|
|
114
157
|
<span class="text-body-medium text-on-surface">{{ b.label }}</span>
|
|
115
|
-
<div class="flex items-center gap-
|
|
116
|
-
<
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
158
|
+
<div class="flex items-center gap-2">
|
|
159
|
+
<span v-for="(step, si) in parseSteps(b.keys)" :key="si" class="flex items-center gap-0.5">
|
|
160
|
+
<kbd
|
|
161
|
+
v-for="(k, ki) in step.split('+')"
|
|
162
|
+
:key="ki"
|
|
163
|
+
class="inline-flex min-w-[24px] items-center justify-center rounded bg-surface-container px-1.5 py-0.5 text-center text-label-small font-medium text-on-surface-variant"
|
|
164
|
+
>
|
|
165
|
+
{{ formatKey(k.trim()) }}
|
|
166
|
+
</kbd>
|
|
167
|
+
</span>
|
|
123
168
|
</div>
|
|
124
169
|
</div>
|
|
125
170
|
</div>
|
package/src/components/MIcon.vue
CHANGED
|
@@ -22,9 +22,25 @@ const props = withDefaults(defineProps<{
|
|
|
22
22
|
label?: string
|
|
23
23
|
/** Mirror the glyph in a right-to-left layout. By default, only the directional icons in `MIRRORED_ICONS` are */
|
|
24
24
|
mirror?: boolean
|
|
25
|
+
/** Stroke weight, the font's `wght` axis: 100 (thin) to 700 (bold); 400 is the default */
|
|
26
|
+
weight?: number
|
|
27
|
+
/** Grade, the `GRAD` axis: -50 (lighter, for light icons on dark) to 200 (heavier, for emphasis); 0 is the default */
|
|
28
|
+
grade?: number
|
|
29
|
+
/** Optical size, the `opsz` axis (20–48): the stroke tuned for that size. Defaults to follow `size` */
|
|
30
|
+
opticalSize?: number
|
|
25
31
|
}>(), { size: 24, filled: false, mirror: undefined })
|
|
26
32
|
|
|
27
33
|
const mirrored = computed(() => props.mirror ?? MIRRORED_ICONS.has(props.name))
|
|
34
|
+
|
|
35
|
+
// Only the axes that were set: an axis left out keeps the font's own default (and opsz follows the font size)
|
|
36
|
+
const variation = computed(() => {
|
|
37
|
+
const axes: string[] = []
|
|
38
|
+
if (props.filled) axes.push(`'FILL' 1`)
|
|
39
|
+
if (props.weight != null) axes.push(`'wght' ${props.weight}`)
|
|
40
|
+
if (props.grade != null) axes.push(`'GRAD' ${props.grade}`)
|
|
41
|
+
if (props.opticalSize != null) axes.push(`'opsz' ${props.opticalSize}`)
|
|
42
|
+
return axes.length ? axes.join(', ') : undefined
|
|
43
|
+
})
|
|
28
44
|
</script>
|
|
29
45
|
|
|
30
46
|
<template>
|
|
@@ -34,6 +50,6 @@ const mirrored = computed(() => props.mirror ?? MIRRORED_ICONS.has(props.name))
|
|
|
34
50
|
:role="label ? 'img' : undefined"
|
|
35
51
|
:aria-label="label"
|
|
36
52
|
:aria-hidden="label ? undefined : 'true'"
|
|
37
|
-
:style="{ fontSize: `${size}px`, fontVariationSettings:
|
|
53
|
+
:style="{ fontSize: `${size}px`, fontVariationSettings: variation }"
|
|
38
54
|
>{{ name }}</span>
|
|
39
55
|
</template>
|
|
@@ -37,6 +37,11 @@ const props = withDefaults(
|
|
|
37
37
|
shape?: 'rounded' | 'squared'
|
|
38
38
|
/** M3's 5-tier icon button sizing (xs:32, sm:40, md:56, lg:96, xl:136), or a custom pixel value */
|
|
39
39
|
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl' | number
|
|
40
|
+
/**
|
|
41
|
+
* M3 Expressive width option (IconButtonDefaults' IconButtonWidthOption): `narrow` and `wide` keep the height and
|
|
42
|
+
* change only the width (sm: 32 / 40 / 52px). Ignored with a numeric size
|
|
43
|
+
*/
|
|
44
|
+
width?: 'narrow' | 'default' | 'wide'
|
|
40
45
|
/** Icon size in px. Default the size tier's (or 55% of a custom pixel `size`) */
|
|
41
46
|
iconSize?: number
|
|
42
47
|
/** Disables interaction */
|
|
@@ -96,15 +101,28 @@ function paintStyle() {
|
|
|
96
101
|
}
|
|
97
102
|
const tag = computed(() => props.to && !isToggle.value ? 'RouterLink' : 'button')
|
|
98
103
|
|
|
99
|
-
// Container height/width (
|
|
100
|
-
// `IconButtonDefaults.<tier>ContainerSize()`
|
|
101
|
-
// implemented here, matching the existing scope of MButton's size tiers) and icon size
|
|
104
|
+
// Container height/width (square by default; the `width` prop's narrow/wide options are
|
|
105
|
+
// `widthMap` above, from `IconButtonDefaults.<tier>ContainerSize(widthOption)`) and icon size
|
|
102
106
|
// per M3's 5-tier `{XSmall,Small,Medium,Large,XLarge}IconButtonTokens.kt`. `squareRadius`
|
|
103
107
|
// matches each tier's own `ContainerShapeSquare` (12px xs/sm, 16px md, 28px lg/xl) — same
|
|
104
108
|
// pattern as MButton's size tiers.
|
|
105
109
|
// Toggle radii (px) from the same token files: `square` is ContainerShapeSquare, `pressed`
|
|
106
110
|
// PressedContainerShape, `checkedRound` SelectedContainerShapeRound (a round button squares off when
|
|
107
111
|
// checked); SelectedContainerShapeSquare is CornerFull (a square one turns round), i.e. px / 2.
|
|
112
|
+
// Widths of the narrow and wide options: icon size + twice each tier's Narrow/WideLeadingSpace
|
|
113
|
+
// (IconButton{XSmall…XLarge}Tokens: xs 4/10dp, sm 4/14, md 12/24, lg 16/48, xl 32/72)
|
|
114
|
+
const widthMap = {
|
|
115
|
+
xs: { narrow: 28, wide: 40 },
|
|
116
|
+
sm: { narrow: 32, wide: 52 },
|
|
117
|
+
md: { narrow: 48, wide: 72 },
|
|
118
|
+
lg: { narrow: 64, wide: 128 },
|
|
119
|
+
xl: { narrow: 104, wide: 184 },
|
|
120
|
+
}
|
|
121
|
+
const containerWidth = computed(() => {
|
|
122
|
+
if (typeof props.size === 'number' || !props.width || props.width === 'default') return resolved.value.px
|
|
123
|
+
return (widthMap[props.size] ?? widthMap.sm)[props.width]
|
|
124
|
+
})
|
|
125
|
+
|
|
108
126
|
const sizeMap = {
|
|
109
127
|
xs: { px: 32, icon: 20, squareRadius: 'rounded-md', square: 12, pressed: 8, checkedRound: 12 },
|
|
110
128
|
sm: { px: 40, icon: 24, squareRadius: 'rounded-md', square: 12, pressed: 8, checkedRound: 12 },
|
|
@@ -163,10 +181,15 @@ function onClick() {
|
|
|
163
181
|
* per-variant Hovered/PressedColor tokens, which are all just the content color at a fixed
|
|
164
182
|
* opacity (8% hover, 10% focus and press), the same universal state-layer pattern across every variant.
|
|
165
183
|
*/
|
|
184
|
+
// M3's minimum touch target (minimumInteractiveComponentSize, 48dp): on a touch screen (pointer: coarse) an invisible
|
|
185
|
+
// box centered on the button, so the 32px and 40px sizes still take a 48px tap. Not with a mouse: there it would only
|
|
186
|
+
// widen the hover and overlap neighbors in dense toolbars. Needs the button not to clip (no overflow-hidden): the state layer
|
|
187
|
+
// rounds itself instead, and the ripple clips in its own layer.
|
|
166
188
|
const base =
|
|
167
|
-
'relative inline-flex shrink-0 items-center justify-center
|
|
189
|
+
'relative inline-flex shrink-0 items-center justify-center transition-colors duration-150 cursor-pointer ' +
|
|
190
|
+
"pointer-coarse:after:content-[''] pointer-coarse:after:absolute pointer-coarse:after:left-1/2 pointer-coarse:after:top-1/2 pointer-coarse:after:-translate-x-1/2 pointer-coarse:after:-translate-y-1/2 pointer-coarse:after:size-full pointer-coarse:after:min-h-12 pointer-coarse:after:min-w-12 " +
|
|
168
191
|
'disabled:cursor-not-allowed disabled:text-on-surface/38 ' +
|
|
169
|
-
"before:content-[''] before:pointer-events-none before:absolute before:inset-0 " +
|
|
192
|
+
"before:content-[''] before:pointer-events-none before:absolute before:inset-0 before:rounded-[inherit] " +
|
|
170
193
|
'before:bg-current before:opacity-0 before:transition-opacity before:duration-150 ' +
|
|
171
194
|
'enabled:hover:before:opacity-[0.08] enabled:focus-visible:before:opacity-[0.1] enabled:active:before:opacity-[0.1]'
|
|
172
195
|
|
|
@@ -234,7 +257,7 @@ const variantClasses = computed(() => {
|
|
|
234
257
|
:aria-pressed="isToggle ? checked : undefined"
|
|
235
258
|
:disabled="disabled"
|
|
236
259
|
:class="[base, shapeClass, variantClasses, disabledContainerClasses]"
|
|
237
|
-
:style="[{ width: `${
|
|
260
|
+
:style="[{ width: `${containerWidth}px`, height: `${resolved.px}px` }, colorStyle]"
|
|
238
261
|
v-ripple="{ disabled, color: rippleColor }"
|
|
239
262
|
@pointerdown="onPointerDown"
|
|
240
263
|
@pointerup="onPointerUp"
|
|
@@ -458,7 +458,7 @@ defineExpose({ toCanvas, toBlob, rotate: turn, flip: flipX, reset, setAspect })
|
|
|
458
458
|
tabindex="0"
|
|
459
459
|
:aria-label="locale.cropArea"
|
|
460
460
|
:aria-valuetext="`${Math.round(rect.width)} × ${Math.round(rect.height)}`"
|
|
461
|
-
class="absolute cursor-move outline-none focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-secondary"
|
|
461
|
+
class="absolute cursor-move outline-none focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-secondary"
|
|
462
462
|
:class="shape === 'circle' ? 'rounded-full' : ''"
|
|
463
463
|
:style="{ left: `${frame.left}px`, top: `${frame.top}px`, width: `${frame.width}px`, height: `${frame.height}px`, boxShadow: '0 0 0 9999px rgb(0 0 0 / 0.55)' }"
|
|
464
464
|
@pointerdown="onDown($event, 'move')"
|
|
@@ -5,9 +5,12 @@
|
|
|
5
5
|
import { ref, computed } from 'vue'
|
|
6
6
|
import MIcon from './MIcon.vue'
|
|
7
7
|
import { useLocale } from '../composables/useLocale'
|
|
8
|
+
import { countLabel } from '../composables/_countLabel'
|
|
8
9
|
|
|
9
10
|
export interface JsonViewerLabels {
|
|
11
|
+
/** An array's size: a template with `{count}` (plural blocks allowed, see `formatMessage`), or a bare word shown after the number */
|
|
10
12
|
elements?: string
|
|
13
|
+
/** An object's size, same format as `elements` */
|
|
11
14
|
fields?: string
|
|
12
15
|
}
|
|
13
16
|
|
|
@@ -95,7 +98,7 @@ function formatValue(val: unknown) {
|
|
|
95
98
|
<span v-if="_depth === 0 || rootName" class="text-tertiary">{{ _depth === 0 ? rootName : '' }}</span>
|
|
96
99
|
<span class="text-on-surface-variant">{{ bracketOpen }}</span>
|
|
97
100
|
<span v-if="!expanded" class="text-on-surface-variant/60">
|
|
98
|
-
{{
|
|
101
|
+
{{ countLabel(dataType === 'array' ? l.elements : l.fields, childCount, locale.lang) }}
|
|
99
102
|
</span>
|
|
100
103
|
<span v-if="!expanded" class="text-on-surface-variant">{{ bracketClose }}</span>
|
|
101
104
|
</button>
|
|
@@ -29,7 +29,7 @@ export interface KanbanColumn {
|
|
|
29
29
|
id: string | number
|
|
30
30
|
title: string
|
|
31
31
|
cards: KanbanCard[]
|
|
32
|
-
color?: 'primary' | 'secondary' | 'tertiary' | 'error' | 'success'
|
|
32
|
+
color?: 'primary' | 'secondary' | 'tertiary' | 'error' | 'success' | 'warning'
|
|
33
33
|
/** Optional WIP limit: the header shows count/limit and turns error-colored when exceeded. */
|
|
34
34
|
limit?: number
|
|
35
35
|
}
|
|
@@ -687,6 +687,7 @@ const dotColor: Record<string, string> = {
|
|
|
687
687
|
tertiary: 'bg-tertiary',
|
|
688
688
|
error: 'bg-error',
|
|
689
689
|
success: 'bg-success',
|
|
690
|
+
warning: 'bg-warning',
|
|
690
691
|
}
|
|
691
692
|
|
|
692
693
|
const isLifted = (id: Id) => draggingId.value === id || settlingId.value === id || grabbedId.value === id
|
|
@@ -27,10 +27,11 @@
|
|
|
27
27
|
* dampingRatio 0.9 / stiffness 700) stepped in one rAF loop that writes transforms directly.
|
|
28
28
|
*/
|
|
29
29
|
import { computed, nextTick, onBeforeUnmount, onMounted, ref, watch } from 'vue'
|
|
30
|
+
import { shouldReduceMotion } from '../composables/motion'
|
|
30
31
|
import { isHydrating } from '../composables/_hydration'
|
|
31
32
|
import MIconButton from './MIconButton.vue'
|
|
32
33
|
import MSpinner from './MSpinner.vue'
|
|
33
|
-
import { useLocale } from '../composables/useLocale'
|
|
34
|
+
import { useLocale, formatMessage } from '../composables/useLocale'
|
|
34
35
|
import { useScrollLock } from '../composables/_useScrollLock'
|
|
35
36
|
import { useEscapeStack } from '../composables/_useEscapeStack'
|
|
36
37
|
|
|
@@ -130,7 +131,7 @@ const slides = computed(() =>
|
|
|
130
131
|
)
|
|
131
132
|
|
|
132
133
|
const positionLabel = computed(() =>
|
|
133
|
-
locale.carouselItem
|
|
134
|
+
formatMessage(locale.carouselItem, { index: String(currentIndex.value + 1), count: String(count.value) }, locale.lang),
|
|
134
135
|
)
|
|
135
136
|
|
|
136
137
|
// ── Springs ───────────────────────────────────────────────────────────────────────────────────
|
|
@@ -156,7 +157,7 @@ let onSettled: (() => void) | null = null
|
|
|
156
157
|
/** The origin as a transform of the open image: offset, scale, and the crop that gives it the origin's shape. */
|
|
157
158
|
interface Origin { dx: number; dy: number; s: number; insetX: number; insetY: number; radius: number }
|
|
158
159
|
let introFrom: Origin | null = null
|
|
159
|
-
const reducedMotion = () =>
|
|
160
|
+
const reducedMotion = () => shouldReduceMotion()
|
|
160
161
|
|
|
161
162
|
function setNow(s: Spring, v: number) {
|
|
162
163
|
s.pos = v
|
|
@@ -905,7 +906,7 @@ defineExpose({ open, close, next, prev })
|
|
|
905
906
|
data-lb-thumb
|
|
906
907
|
class="h-14 w-14 shrink-0 cursor-pointer overflow-hidden rounded-md ring-2 transition-opacity"
|
|
907
908
|
:class="i === currentIndex ? 'opacity-100 ring-white' : 'opacity-50 ring-transparent hover:opacity-80'"
|
|
908
|
-
:aria-label="item.alt || locale.carouselItem
|
|
909
|
+
:aria-label="item.alt || formatMessage(locale.carouselItem, { index: String(i + 1), count: String(count) }, locale.lang)"
|
|
909
910
|
:aria-current="i === currentIndex ? 'true' : undefined"
|
|
910
911
|
@click="go(i)"
|
|
911
912
|
>
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* A text link. With `to` it's a vue-router `RouterLink` (or a plain `<a href>` in an app without vue-router); with
|
|
4
|
+
* `href`, always an `<a>`. Links to another site are detected: they get `rel="noopener noreferrer"`, open in a new
|
|
5
|
+
* tab (`newTab` decides), show the `open_in_new` icon and tell screen readers they open a new tab. `download`
|
|
6
|
+
* makes it a download link with its icon; `disabled` keeps the text but turns the link off.
|
|
7
|
+
*
|
|
8
|
+
* @slot default The link text
|
|
9
|
+
* @event click The native click (not emitted while disabled)
|
|
10
|
+
*/
|
|
11
|
+
import { computed, getCurrentInstance } from 'vue'
|
|
12
|
+
import MIcon from './MIcon.vue'
|
|
13
|
+
import { useLocale } from '../composables/useLocale'
|
|
14
|
+
import type { ItemLink } from '../composables/_useItemLink'
|
|
15
|
+
|
|
16
|
+
const props = withDefaults(defineProps<{
|
|
17
|
+
/** A vue-router location: a RouterLink with vue-router, an `<a href>` (string only) without it */
|
|
18
|
+
to?: ItemLink
|
|
19
|
+
/** A plain URL, always rendered as `<a href>` */
|
|
20
|
+
href?: string
|
|
21
|
+
/**
|
|
22
|
+
* Whether it leads to another site. Detected from the URL (an absolute `http(s)` URL on another host); set it to
|
|
23
|
+
* override. External links get `rel="noopener noreferrer"` and, by default, a new tab and the `open_in_new` icon
|
|
24
|
+
*/
|
|
25
|
+
external?: boolean
|
|
26
|
+
/** Open in a new tab (`target="_blank"`, with `noopener`). Defaults to `true` for external links */
|
|
27
|
+
newTab?: boolean
|
|
28
|
+
/** A file to download: `true`, or the file name to save it as. Shows the `download` icon */
|
|
29
|
+
download?: boolean | string
|
|
30
|
+
/** Leading Material Symbol */
|
|
31
|
+
icon?: string
|
|
32
|
+
/** Trailing Material Symbol; `false` hides the automatic `open_in_new` / `download` one */
|
|
33
|
+
trailingIcon?: string | false
|
|
34
|
+
/** Text color: a color role, or `inherit` to take the surrounding text's color */
|
|
35
|
+
color?: 'primary' | 'secondary' | 'tertiary' | 'error' | 'inherit'
|
|
36
|
+
/**
|
|
37
|
+
* `always` (default; links inside running text should be told apart by more than color), `hover`, or `none` for
|
|
38
|
+
* links that are already clearly links (a nav list, a footer)
|
|
39
|
+
*/
|
|
40
|
+
underline?: 'always' | 'hover' | 'none'
|
|
41
|
+
/** Shows the text dimmed and turns the link off (no navigation, out of the tab order) */
|
|
42
|
+
disabled?: boolean
|
|
43
|
+
/** With `to` and vue-router: replace the current history entry instead of adding one */
|
|
44
|
+
replace?: boolean
|
|
45
|
+
}>(), {
|
|
46
|
+
external: undefined,
|
|
47
|
+
newTab: undefined,
|
|
48
|
+
download: false,
|
|
49
|
+
trailingIcon: undefined,
|
|
50
|
+
color: 'primary',
|
|
51
|
+
underline: 'always',
|
|
52
|
+
disabled: false,
|
|
53
|
+
replace: false,
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
const emit = defineEmits<{ click: [MouseEvent] }>()
|
|
57
|
+
const t = useLocale()
|
|
58
|
+
const hasRouter = !!getCurrentInstance()?.appContext.components.RouterLink
|
|
59
|
+
|
|
60
|
+
const url = computed(() => props.href ?? (typeof props.to === 'string' ? props.to : undefined))
|
|
61
|
+
|
|
62
|
+
const isExternal = computed(() => {
|
|
63
|
+
if (props.external !== undefined) return props.external
|
|
64
|
+
const u = url.value
|
|
65
|
+
if (!u || !/^(https?:)?\/\//i.test(u)) return false
|
|
66
|
+
if (typeof window === 'undefined') return true
|
|
67
|
+
try { return new URL(u, window.location.href).host !== window.location.host } catch { return false }
|
|
68
|
+
})
|
|
69
|
+
const opensNewTab = computed(() => !props.disabled && (props.newTab ?? isExternal.value))
|
|
70
|
+
const isDownload = computed(() => props.download !== false)
|
|
71
|
+
|
|
72
|
+
const tag = computed(() => {
|
|
73
|
+
if (props.disabled) return 'a'
|
|
74
|
+
if (props.to !== undefined && props.href === undefined && hasRouter && !isExternal.value) return 'RouterLink'
|
|
75
|
+
return 'a'
|
|
76
|
+
})
|
|
77
|
+
|
|
78
|
+
const linkAttrs = computed(() => {
|
|
79
|
+
if (props.disabled) return { role: 'link', 'aria-disabled': 'true', tabindex: -1 }
|
|
80
|
+
if (tag.value === 'RouterLink') {
|
|
81
|
+
return { to: props.to, replace: props.replace || undefined, target: opensNewTab.value ? '_blank' : undefined }
|
|
82
|
+
}
|
|
83
|
+
const rel = [isExternal.value && 'noopener noreferrer', !isExternal.value && opensNewTab.value && 'noopener']
|
|
84
|
+
.filter(Boolean).join(' ')
|
|
85
|
+
return {
|
|
86
|
+
href: url.value,
|
|
87
|
+
target: opensNewTab.value ? '_blank' : undefined,
|
|
88
|
+
rel: rel || undefined,
|
|
89
|
+
download: isDownload.value ? (typeof props.download === 'string' ? props.download : '') : undefined,
|
|
90
|
+
}
|
|
91
|
+
})
|
|
92
|
+
|
|
93
|
+
const trailing = computed(() => {
|
|
94
|
+
if (props.trailingIcon === false) return undefined
|
|
95
|
+
if (props.trailingIcon) return props.trailingIcon
|
|
96
|
+
if (isDownload.value) return 'download'
|
|
97
|
+
if (isExternal.value && opensNewTab.value) return 'open_in_new'
|
|
98
|
+
return undefined
|
|
99
|
+
})
|
|
100
|
+
|
|
101
|
+
const colorClass: Record<string, string> = {
|
|
102
|
+
primary: 'text-primary decoration-primary/60',
|
|
103
|
+
secondary: 'text-secondary decoration-secondary/60',
|
|
104
|
+
tertiary: 'text-tertiary decoration-tertiary/60',
|
|
105
|
+
error: 'text-error decoration-error/60',
|
|
106
|
+
inherit: 'text-inherit decoration-current/60',
|
|
107
|
+
}
|
|
108
|
+
const underlineClass: Record<string, string> = {
|
|
109
|
+
always: 'underline hover:decoration-current',
|
|
110
|
+
hover: 'no-underline hover:underline',
|
|
111
|
+
none: 'no-underline',
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
function onClick(e: MouseEvent) {
|
|
115
|
+
if (props.disabled) {
|
|
116
|
+
e.preventDefault()
|
|
117
|
+
return
|
|
118
|
+
}
|
|
119
|
+
emit('click', e)
|
|
120
|
+
}
|
|
121
|
+
</script>
|
|
122
|
+
|
|
123
|
+
<template>
|
|
124
|
+
<component
|
|
125
|
+
:is="tag"
|
|
126
|
+
v-bind="linkAttrs"
|
|
127
|
+
class="m3-link rounded-[2px] underline-offset-[0.2em] decoration-[0.08em] transition-colors duration-150 outline-none focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-secondary"
|
|
128
|
+
:class="disabled ? 'cursor-not-allowed text-on-surface/38 no-underline' : [colorClass[color], underlineClass[underline], 'cursor-pointer']"
|
|
129
|
+
@click="onClick"
|
|
130
|
+
>
|
|
131
|
+
<MIcon v-if="icon" :name="icon" aria-hidden="true" class="me-[0.2em] align-[-0.2em] !text-[1.15em]" />
|
|
132
|
+
<slot />
|
|
133
|
+
<MIcon v-if="trailing" :name="trailing" aria-hidden="true" class="ms-[0.15em] align-[-0.12em] !text-[1em]" />
|
|
134
|
+
<span v-if="opensNewTab" class="sr-only">({{ t.opensInNewTab }})</span>
|
|
135
|
+
</component>
|
|
136
|
+
</template>
|
|
@@ -191,4 +191,11 @@ const detailHidden = computed(() => (!twoPane.value && (!props.showDetail || ext
|
|
|
191
191
|
transition: visibility 0s;
|
|
192
192
|
}
|
|
193
193
|
}
|
|
194
|
+
/* createM3UI({ reducedMotion: 'always' }) */
|
|
195
|
+
:root[data-m3-motion='reduce'] .m3-ld-pane,
|
|
196
|
+
:root[data-m3-motion='reduce'] .m3-ld-list-hidden,
|
|
197
|
+
:root[data-m3-motion='reduce'] .m3-ld-detail-hidden {
|
|
198
|
+
transition: visibility 0s;
|
|
199
|
+
}
|
|
200
|
+
|
|
194
201
|
</style>
|
|
@@ -46,10 +46,12 @@ const props = withDefaults(
|
|
|
46
46
|
leading?: ListItemLeading
|
|
47
47
|
/** Name for the avatar (when leading='avatar') */
|
|
48
48
|
avatarName?: string
|
|
49
|
+
/** Photo for the avatar (when leading='avatar'); the initials of `avatarName` show while it's missing or broken */
|
|
50
|
+
avatarSrc?: string
|
|
49
51
|
/** Image URL (when leading='image') */
|
|
50
52
|
image?: string
|
|
51
53
|
/** Icon container background color (when leading='icon-container') */
|
|
52
|
-
iconContainerColor?: 'primary' | 'secondary' | 'tertiary' | 'error' | 'success'
|
|
54
|
+
iconContainerColor?: 'primary' | 'secondary' | 'tertiary' | 'error' | 'success' | 'warning'
|
|
53
55
|
/** Trailing icon name */
|
|
54
56
|
trailingIcon?: string
|
|
55
57
|
/** Trailing text label */
|
|
@@ -170,7 +172,7 @@ const isActive = computed(() => {
|
|
|
170
172
|
const resolvedLeading = computed(() => {
|
|
171
173
|
if (props.leading) return props.leading
|
|
172
174
|
if (props.icon) return 'icon'
|
|
173
|
-
if (props.avatarName) return 'avatar'
|
|
175
|
+
if (props.avatarName || props.avatarSrc) return 'avatar'
|
|
174
176
|
if (props.image) return 'image'
|
|
175
177
|
return null
|
|
176
178
|
})
|
|
@@ -189,6 +191,7 @@ const iconContainerClasses: Record<string, string> = {
|
|
|
189
191
|
tertiary: 'bg-tertiary-container text-on-tertiary-container',
|
|
190
192
|
error: 'bg-error-container text-on-error-container',
|
|
191
193
|
success: 'bg-success-container text-on-success-container',
|
|
194
|
+
warning: 'bg-warning-container text-on-warning-container',
|
|
192
195
|
}
|
|
193
196
|
|
|
194
197
|
const isDense = computed(() => list?.dense.value ?? false)
|
|
@@ -485,7 +488,7 @@ function handleTrailingToggle() {
|
|
|
485
488
|
>
|
|
486
489
|
<MIcon :name="icon!" :size="24" />
|
|
487
490
|
</div>
|
|
488
|
-
<MAvatar v-else-if="resolvedLeading === 'avatar'" :name="avatarName
|
|
491
|
+
<MAvatar v-else-if="resolvedLeading === 'avatar'" :name="avatarName" :src="avatarSrc" :size="40" class="shrink-0" />
|
|
489
492
|
<img v-else-if="resolvedLeading === 'image'" :src="image" alt="" class="h-14 w-14 shrink-0 rounded-md object-cover">
|
|
490
493
|
<MCheckbox v-else-if="resolvedLeading === 'checkbox'" :model-value="isChecked" class="shrink-0" data-mli-part />
|
|
491
494
|
</slot>
|
|
@@ -503,7 +506,7 @@ function handleTrailingToggle() {
|
|
|
503
506
|
</div>
|
|
504
507
|
</template>
|
|
505
508
|
<template v-else-if="resolvedLeading === 'avatar'">
|
|
506
|
-
<MAvatar :name="avatarName
|
|
509
|
+
<MAvatar :name="avatarName" :src="avatarSrc" :size="40" class="shrink-0" />
|
|
507
510
|
</template>
|
|
508
511
|
<template v-else-if="resolvedLeading === 'image'">
|
|
509
512
|
<img :src="image" alt="" class="h-14 w-14 shrink-0 rounded-md object-cover">
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* contained (circle-backed) variant.
|
|
6
6
|
*/
|
|
7
7
|
import { computed, onMounted, onUnmounted, ref } from "vue";
|
|
8
|
+
import { shouldReduceMotion } from '../composables/motion';
|
|
8
9
|
import { useLocale } from '../composables/useLocale';
|
|
9
10
|
|
|
10
11
|
const props = withDefaults(
|
|
@@ -177,7 +178,7 @@ function tick(now: number) {
|
|
|
177
178
|
}
|
|
178
179
|
|
|
179
180
|
onMounted(() => {
|
|
180
|
-
prefersReducedMotion.value =
|
|
181
|
+
prefersReducedMotion.value = shouldReduceMotion();
|
|
181
182
|
pathEl.value?.setAttribute("d", buildPath(shapes[0]!, shapes[0]!, 0));
|
|
182
183
|
rafId = requestAnimationFrame(tick);
|
|
183
184
|
});
|
package/src/components/MMap.vue
CHANGED
|
@@ -449,6 +449,9 @@ defineExpose({
|
|
|
449
449
|
@media (prefers-reduced-motion: reduce) {
|
|
450
450
|
.m3-map .m3-map-control-panel-in { animation: none; }
|
|
451
451
|
}
|
|
452
|
+
/* createM3UI({ reducedMotion: 'always' }) */
|
|
453
|
+
:root[data-m3-motion='reduce'] .m3-map .m3-map-control-panel-in { animation: none; }
|
|
454
|
+
|
|
452
455
|
.m3-map .maplibregl-ctrl-group button {
|
|
453
456
|
width: 40px;
|
|
454
457
|
height: 40px;
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
import { computed, onBeforeUnmount, shallowRef, useId, watch } from 'vue'
|
|
14
14
|
import type * as Maplibre from 'maplibre-gl'
|
|
15
15
|
import { useMap } from '../composables/useMap'
|
|
16
|
-
import { useLocale } from '../composables/useLocale'
|
|
16
|
+
import { useLocale, formatMessage } from '../composables/useLocale'
|
|
17
17
|
import { useThemeTokens } from '../composables/useThemeTokens'
|
|
18
18
|
import type { MapGeoJsonLayer } from './MMapGeoJson.vue'
|
|
19
19
|
|
|
@@ -242,7 +242,7 @@ function onBubbleClick(b: Bubble) {
|
|
|
242
242
|
if (props.zoomOnClick) void b.zoomIn()
|
|
243
243
|
}
|
|
244
244
|
|
|
245
|
-
const labelOf = (count: number) => locale.mapClusterZoom
|
|
245
|
+
const labelOf = (count: number) => formatMessage(locale.mapClusterZoom, { count: String(count) }, locale.lang)
|
|
246
246
|
|
|
247
247
|
onBeforeUnmount(() => {
|
|
248
248
|
if (frame) cancelAnimationFrame(frame)
|