@m3ui-vue/m3ui-vue 0.8.7 → 0.9.0
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 +13 -3
- package/dist/{MMenuItem-DmrsQrK7.js → MTextField-B0wGv1Mx.js} +374 -364
- package/dist/MTextField-B0wGv1Mx.js.map +1 -0
- package/dist/barcode.js +9 -11
- package/dist/barcode.js.map +1 -1
- package/dist/code-editor.js +2 -2
- package/dist/code-editor.js.map +1 -1
- package/dist/components/MCarousel.vue.d.ts +55 -36
- package/dist/components/MDialog.vue.d.ts +4 -2
- package/dist/components/MEmojiSelector.vue.d.ts +21 -5
- package/dist/components/MFabMenu.vue.d.ts +1 -1
- package/dist/components/MFlex.vue.d.ts +1 -1
- package/dist/components/MLightbox.vue.d.ts +15 -5
- package/dist/components/MScheduler.vue.d.ts +38 -1
- package/dist/components/MShape.vue.d.ts +1 -1
- package/dist/components/MSimpleCarousel.vue.d.ts +2 -2
- package/dist/components/MSlider.vue.d.ts +1 -1
- package/dist/components/MStack.vue.d.ts +1 -1
- package/dist/components/MToolbar.vue.d.ts +1 -1
- package/dist/components/MWindow.vue.d.ts +1 -1
- package/dist/composables/_carouselStrategy.d.ts +101 -0
- package/dist/composables/useLocale.d.ts +23 -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 +168 -7
- package/dist/locales/index.js.map +1 -1
- package/dist/m3ui-vue.css +1 -1
- package/dist/m3ui.js +3926 -2430
- package/dist/m3ui.js.map +1 -1
- package/dist/plugin.d.ts +6 -0
- package/dist/rich-text-editor.js +9 -9
- package/dist/styles.css +1 -1
- package/dist/terminal.js +34 -27
- package/dist/terminal.js.map +1 -1
- package/dist/{useLocale-Bircp823.js → useLocale-CmI675Ab.js} +25 -2
- package/dist/useLocale-CmI675Ab.js.map +1 -0
- package/package.json +1 -1
- 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__/MLightbox.test.ts +313 -5
- package/src/__tests__/MPagination.test.ts +37 -0
- package/src/__tests__/MPullToRefresh.test.ts +39 -0
- 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__/plugin.test.ts +28 -1
- package/src/components/MBarcode.vue +4 -2
- package/src/components/MBottomSheet.vue +1 -1
- package/src/components/MCarousel.vue +526 -200
- package/src/components/MCodeEditor.vue +3 -2
- package/src/components/MCommandPalette.vue +1 -1
- package/src/components/MContextMenu.vue +3 -1
- package/src/components/MDatePickerModal.vue +1 -1
- package/src/components/MDateRangePickerModal.vue +1 -1
- package/src/components/MDialog.vue +19 -6
- package/src/components/MEmojiSelector.vue +479 -78
- package/src/components/MFab.vue +3 -1
- package/src/components/MLightbox.vue +750 -268
- package/src/components/MLoadingOverlay.vue +6 -1
- package/src/components/MMenu.vue +3 -1
- package/src/components/MNavigationDrawer.vue +5 -1
- package/src/components/MNavigationRail.vue +8 -2
- package/src/components/MOverlay.vue +1 -0
- package/src/components/MPagination.vue +8 -5
- package/src/components/MPullToRefresh.vue +13 -1
- package/src/components/MScheduler.vue +282 -115
- package/src/components/MSideSheet.vue +1 -1
- package/src/components/MSplitButton.vue +3 -1
- package/src/components/MSpotlightSearch.vue +1 -1
- package/src/components/MTerminal.vue +22 -10
- package/src/components/MTimePickerModal.vue +1 -1
- package/src/components/MTooltip.vue +3 -0
- package/src/components/MTour.vue +2 -2
- package/src/composables/_carouselStrategy.ts +712 -0
- package/src/composables/useLocale.ts +48 -0
- 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 +24 -0
- package/src/locales/es.ts +24 -0
- package/src/locales/fr.ts +24 -0
- package/src/locales/ja.ts +24 -0
- package/src/locales/ko.ts +24 -0
- package/src/locales/pt.ts +24 -0
- package/src/locales/zh.ts +24 -0
- package/src/plugin.ts +12 -1
- package/dist/MMenuItem-DmrsQrK7.js.map +0 -1
- package/dist/useLocale-Bircp823.js.map +0 -1
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import MSpinner from './MSpinner.vue'
|
|
3
3
|
|
|
4
|
+
defineOptions({ inheritAttrs: false })
|
|
5
|
+
|
|
4
6
|
withDefaults(defineProps<{
|
|
5
7
|
visible: boolean
|
|
6
8
|
text?: string
|
|
@@ -13,6 +15,7 @@ withDefaults(defineProps<{
|
|
|
13
15
|
<template>
|
|
14
16
|
<Teleport v-if="fullscreen" to="body">
|
|
15
17
|
<Transition
|
|
18
|
+
appear
|
|
16
19
|
enter-active-class="transition-opacity duration-200"
|
|
17
20
|
enter-from-class="opacity-0"
|
|
18
21
|
leave-active-class="transition-opacity duration-150"
|
|
@@ -20,6 +23,7 @@ withDefaults(defineProps<{
|
|
|
20
23
|
>
|
|
21
24
|
<div
|
|
22
25
|
v-if="visible"
|
|
26
|
+
v-bind="$attrs"
|
|
23
27
|
class="fixed inset-0 z-300 flex flex-col items-center justify-center gap-4"
|
|
24
28
|
:class="opaque ? 'bg-surface' : 'bg-surface/80 backdrop-blur-sm'"
|
|
25
29
|
>
|
|
@@ -30,9 +34,10 @@ withDefaults(defineProps<{
|
|
|
30
34
|
</Transition>
|
|
31
35
|
</Teleport>
|
|
32
36
|
|
|
33
|
-
<div v-else class="relative">
|
|
37
|
+
<div v-else v-bind="$attrs" class="relative">
|
|
34
38
|
<slot name="content" />
|
|
35
39
|
<Transition
|
|
40
|
+
appear
|
|
36
41
|
enter-active-class="transition-opacity duration-200"
|
|
37
42
|
enter-from-class="opacity-0"
|
|
38
43
|
leave-active-class="transition-opacity duration-150"
|
package/src/components/MMenu.vue
CHANGED
|
@@ -3,6 +3,8 @@ import { computed, Fragment, inject, nextTick, onMounted, onUnmounted, provide,
|
|
|
3
3
|
import MIcon from './MIcon.vue'
|
|
4
4
|
import MMenuDivider from './MMenuDivider.vue'
|
|
5
5
|
|
|
6
|
+
defineOptions({ inheritAttrs: false })
|
|
7
|
+
|
|
6
8
|
const props = withDefaults(
|
|
7
9
|
defineProps<{
|
|
8
10
|
/** Which edge of the trigger the dropdown aligns to. */
|
|
@@ -385,7 +387,7 @@ const origin = computed(() =>
|
|
|
385
387
|
</script>
|
|
386
388
|
|
|
387
389
|
<template>
|
|
388
|
-
<div ref="triggerEl" class="inline-block" @click="toggle">
|
|
390
|
+
<div ref="triggerEl" v-bind="$attrs" class="inline-block" @click="toggle">
|
|
389
391
|
<slot name="trigger" :open="open" />
|
|
390
392
|
</div>
|
|
391
393
|
|
|
@@ -24,6 +24,8 @@ export interface DrawerSection {
|
|
|
24
24
|
collapsible?: boolean;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
+
defineOptions({ inheritAttrs: false })
|
|
28
|
+
|
|
27
29
|
const props = withDefaults(
|
|
28
30
|
defineProps<{
|
|
29
31
|
modelValue: boolean;
|
|
@@ -131,7 +133,7 @@ watch(
|
|
|
131
133
|
<template>
|
|
132
134
|
<!-- ── Modal variant ──────────────────────────────────────── -->
|
|
133
135
|
<Teleport v-if="modal" to="body">
|
|
134
|
-
<Transition name="nd" :duration="{ enter: 300, leave: 280 }">
|
|
136
|
+
<Transition name="nd" :duration="{ enter: 300, leave: 280 }" appear>
|
|
135
137
|
<div
|
|
136
138
|
v-if="modelValue"
|
|
137
139
|
class="fixed inset-0 z-100 flex"
|
|
@@ -144,6 +146,7 @@ watch(
|
|
|
144
146
|
<div class="nd-scrim absolute inset-0 bg-scrim/32" @click="close" />
|
|
145
147
|
|
|
146
148
|
<nav
|
|
149
|
+
v-bind="$attrs"
|
|
147
150
|
:class="[
|
|
148
151
|
'nd-panel relative flex flex-col bg-surface-container-low shadow-elevation-1',
|
|
149
152
|
`nd-panel-${side}`,
|
|
@@ -270,6 +273,7 @@ watch(
|
|
|
270
273
|
<!-- ── Standard (inline) variant ──────────────────────────── -->
|
|
271
274
|
<template v-else>
|
|
272
275
|
<nav
|
|
276
|
+
v-bind="$attrs"
|
|
273
277
|
class="nd-inline flex h-full shrink-0 flex-col bg-surface"
|
|
274
278
|
:class="[
|
|
275
279
|
inlineSide === 'right' ? 'border-l border-outline-variant rounded-l-lg' : 'border-r border-outline-variant rounded-r-lg',
|
|
@@ -15,6 +15,8 @@ export interface NavRailItem {
|
|
|
15
15
|
to?: ItemLink
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
+
defineOptions({ inheritAttrs: false })
|
|
19
|
+
|
|
18
20
|
const props = withDefaults(defineProps<{
|
|
19
21
|
modelValue: string | number
|
|
20
22
|
items: NavRailItem[]
|
|
@@ -173,6 +175,7 @@ onUnmounted(() => {
|
|
|
173
175
|
that actually reacts to `expanded` when `modal` is set.
|
|
174
176
|
-->
|
|
175
177
|
<nav
|
|
178
|
+
v-bind="$attrs"
|
|
176
179
|
class="flex h-full flex-col border-r border-outline-variant bg-surface transition-[width] duration-200"
|
|
177
180
|
:class="railExpanded ? 'w-[220px]' : 'w-20'"
|
|
178
181
|
>
|
|
@@ -182,9 +185,12 @@ onUnmounted(() => {
|
|
|
182
185
|
would re-center against the *header's own* width, which changes a lot between collapsed
|
|
183
186
|
(80px rail) and expanded (220px rail), making the button visibly jump sideways when toggling.
|
|
184
187
|
A fixed-width box pinned to the same left inset as the items below stays put regardless.
|
|
188
|
+
The box is a *minimum* (40×56, an icon button or small FAB): a regular FAB (56dp) or an
|
|
189
|
+
extended one in the expanded rail grows it instead of overflowing it, which used to push
|
|
190
|
+
the FAB past the rail's top and left edges.
|
|
185
191
|
-->
|
|
186
192
|
<div v-if="$slots.fab" class="flex shrink-0 flex-col items-start gap-2 px-3 pt-3 pb-2">
|
|
187
|
-
<div class="flex h-10 w-14 shrink-0 items-center justify-center">
|
|
193
|
+
<div class="flex min-h-10 min-w-14 shrink-0 items-center justify-center">
|
|
188
194
|
<slot name="fab" />
|
|
189
195
|
</div>
|
|
190
196
|
</div>
|
|
@@ -319,7 +325,7 @@ onUnmounted(() => {
|
|
|
319
325
|
class="wnr-panel fixed inset-y-0 left-0 z-10 flex flex-col overflow-hidden rounded-r-lg bg-surface-container shadow-elevation-2"
|
|
320
326
|
>
|
|
321
327
|
<div v-if="$slots.fab" class="flex shrink-0 flex-col items-start gap-2 px-3 pt-3 pb-2">
|
|
322
|
-
<div class="flex h-10 w-14 shrink-0 items-center justify-center">
|
|
328
|
+
<div class="flex min-h-10 min-w-14 shrink-0 items-center justify-center">
|
|
323
329
|
<slot name="fab" />
|
|
324
330
|
</div>
|
|
325
331
|
</div>
|
|
@@ -1,34 +1,37 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { computed } from 'vue'
|
|
3
3
|
import MIconButton from './MIconButton.vue'
|
|
4
|
+
import { useLocale } from '../composables/useLocale'
|
|
4
5
|
|
|
5
6
|
const props = defineProps<{ page: number; perPage: number; total: number }>()
|
|
6
7
|
const emit = defineEmits<{ 'update:page': [number] }>()
|
|
8
|
+
const t = useLocale()
|
|
7
9
|
|
|
8
10
|
const totalPages = computed(() => Math.max(1, Math.ceil(props.total / props.perPage)))
|
|
9
11
|
|
|
10
12
|
const rangeLabel = computed(() => {
|
|
11
|
-
if (props.total === 0) return
|
|
13
|
+
if (props.total === 0) return t.noResults
|
|
12
14
|
const from = (props.page - 1) * props.perPage + 1
|
|
13
15
|
const to = Math.min(props.page * props.perPage, props.total)
|
|
14
|
-
return
|
|
16
|
+
return t.paginationRange.replace('{from}', String(from)).replace('{to}', String(to)).replace('{total}', String(props.total))
|
|
15
17
|
})
|
|
18
|
+
const pageLabel = computed(() => t.paginationPage.replace('{page}', String(props.page)).replace('{pages}', String(totalPages.value)))
|
|
16
19
|
</script>
|
|
17
20
|
|
|
18
21
|
<template>
|
|
19
22
|
<div class="flex flex-wrap items-center justify-between gap-4 text-body-medium text-on-surface-variant">
|
|
20
23
|
<span>{{ rangeLabel }}</span>
|
|
21
24
|
<div class="flex items-center gap-2">
|
|
22
|
-
<span>
|
|
25
|
+
<span>{{ pageLabel }}</span>
|
|
23
26
|
<MIconButton
|
|
24
27
|
icon="chevron_left"
|
|
25
|
-
label="
|
|
28
|
+
:label="t.previousPage"
|
|
26
29
|
:disabled="page <= 1"
|
|
27
30
|
@click="emit('update:page', page - 1)"
|
|
28
31
|
/>
|
|
29
32
|
<MIconButton
|
|
30
33
|
icon="chevron_right"
|
|
31
|
-
label="
|
|
34
|
+
:label="t.nextPage"
|
|
32
35
|
:disabled="page >= totalPages"
|
|
33
36
|
@click="emit('update:page', page + 1)"
|
|
34
37
|
/>
|
|
@@ -116,15 +116,27 @@ function finishPull() {
|
|
|
116
116
|
// browser starts a native pan and fires pointercancel, snapping the indicator
|
|
117
117
|
// back. The only reliable way to own a touch drag is a non-passive touchmove
|
|
118
118
|
// that calls preventDefault().
|
|
119
|
+
//
|
|
120
|
+
// The pointer is only captured once the mouse has dragged down a few pixels. Capturing on
|
|
121
|
+
// pointerdown retargets pointerup to the scroller, so the browser fires the click there and
|
|
122
|
+
// a plain click on an item at the top of the list never reached the item.
|
|
123
|
+
const POINTER_SLOP = 4;
|
|
124
|
+
let pointerClaimed = false;
|
|
125
|
+
|
|
119
126
|
function onPointerDown(e: PointerEvent) {
|
|
120
127
|
if (e.pointerType === "touch" || e.button !== 0 || !canStart()) return;
|
|
121
128
|
pointerId = e.pointerId;
|
|
129
|
+
pointerClaimed = false;
|
|
122
130
|
beginPull(e.clientY);
|
|
123
|
-
scrollEl.value!.setPointerCapture(e.pointerId);
|
|
124
131
|
}
|
|
125
132
|
|
|
126
133
|
function onPointerMove(e: PointerEvent) {
|
|
127
134
|
if (!pulling || e.pointerId !== pointerId) return;
|
|
135
|
+
if (!pointerClaimed) {
|
|
136
|
+
if (e.clientY - startY < POINTER_SLOP) return;
|
|
137
|
+
pointerClaimed = true;
|
|
138
|
+
scrollEl.value!.setPointerCapture(e.pointerId);
|
|
139
|
+
}
|
|
128
140
|
movePull(e.clientY);
|
|
129
141
|
}
|
|
130
142
|
|