@m3ui-vue/m3ui-vue 0.8.6 → 0.8.8
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 +4 -0
- package/dist/{MMenuItem-BmPLAyv5.js → MMenuItem-5xojJYAL.js} +2 -2
- package/dist/{MMenuItem-BmPLAyv5.js.map → MMenuItem-5xojJYAL.js.map} +1 -1
- package/dist/chart.js +5 -1
- package/dist/chart.js.map +1 -1
- package/dist/code-editor.js +1 -1
- package/dist/components/MBottomSheet.vue.d.ts +3 -3
- package/dist/components/MListDetail.vue.d.ts +31 -0
- package/dist/components/MNavigationRail.vue.d.ts +6 -3
- package/dist/components/MNavigationSuite.vue.d.ts +46 -0
- package/dist/components/MShortNavigationBar.vue.d.ts +6 -1
- package/dist/components/MSideSheet.vue.d.ts +4 -4
- package/dist/components/MSupportingPane.vue.d.ts +34 -0
- package/dist/components/MTransferList.vue.d.ts +55 -34
- package/dist/components/MWindow.vue.d.ts +39 -1
- package/dist/components/_MTransferPane.vue.d.ts +10 -3
- package/dist/composables/_useItemLink.d.ts +30 -0
- package/dist/composables/_useSheetMotion.d.ts +7 -0
- package/dist/composables/useLocale.d.ts +7 -0
- package/dist/composables/useWindowSizeClass.d.ts +19 -0
- package/dist/index.d.ts +6 -0
- package/dist/locales/index.js +56 -7
- package/dist/locales/index.js.map +1 -1
- package/dist/m3ui-vue.css +1 -1
- package/dist/m3ui.js +2399 -1899
- package/dist/m3ui.js.map +1 -1
- package/dist/rich-text-editor.js +2 -2
- package/dist/styles.css +1 -1
- package/dist/{useLocale-4afAzuuP.js → useLocale-D3ZWZ8jY.js} +9 -2
- package/dist/useLocale-D3ZWZ8jY.js.map +1 -0
- package/package.json +1 -1
- package/src/__tests__/MChart.test.ts +28 -0
- package/src/__tests__/MPagination.test.ts +37 -0
- package/src/__tests__/MPullToRefresh.test.ts +39 -0
- package/src/__tests__/MShortNavigationBar.test.ts +25 -0
- package/src/__tests__/MTransferList.test.ts +73 -0
- package/src/__tests__/MWindow.test.ts +258 -0
- package/src/__tests__/adaptiveLayouts.test.ts +191 -0
- package/src/__tests__/sheets.test.ts +76 -0
- package/src/components/MBottomSheet.vue +11 -57
- package/src/components/MChart.vue +2 -1
- package/src/components/MListDetail.vue +103 -0
- package/src/components/MNavigationRail.vue +18 -10
- package/src/components/MNavigationSuite.vue +89 -0
- package/src/components/MPagination.vue +8 -5
- package/src/components/MPullToRefresh.vue +13 -1
- package/src/components/MShortNavigationBar.vue +37 -17
- package/src/components/MSideSheet.vue +11 -56
- package/src/components/MSupportingPane.vue +70 -0
- package/src/components/MTransferList.vue +43 -9
- package/src/components/MWindow.vue +507 -108
- package/src/components/_MTransferPane.vue +113 -35
- package/src/composables/_useItemLink.ts +19 -0
- package/src/composables/_useSheetMotion.ts +181 -0
- package/src/composables/useLocale.ts +17 -0
- package/src/composables/useWindowSizeClass.ts +93 -0
- package/src/index.ts +6 -0
- package/src/locales/de.ts +8 -0
- package/src/locales/es.ts +8 -0
- package/src/locales/fr.ts +8 -0
- package/src/locales/ja.ts +8 -0
- package/src/locales/ko.ts +8 -0
- package/src/locales/pt.ts +8 -0
- package/src/locales/zh.ts +8 -0
- package/dist/useLocale-4afAzuuP.js.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
// Private helper for MTransferList: one pane (header with select-all, search, list).
|
|
3
3
|
// Both panes render through this so the source and target never drift apart.
|
|
4
|
-
import { computed } from 'vue'
|
|
4
|
+
import { computed, onBeforeUpdate, ref } from 'vue'
|
|
5
5
|
import MIcon from './MIcon.vue'
|
|
6
6
|
import MCheckbox from './MCheckbox.vue'
|
|
7
7
|
import type { TransferItem } from './MTransferList.vue'
|
|
@@ -21,6 +21,13 @@ const props = defineProps<{
|
|
|
21
21
|
enterFrom: 'start' | 'end'
|
|
22
22
|
selectAllLabel: string
|
|
23
23
|
clearSearchLabel: string
|
|
24
|
+
/** The `#item` slot draws the whole row: no checkbox, padding, min height or background. */
|
|
25
|
+
bare: boolean
|
|
26
|
+
}>()
|
|
27
|
+
|
|
28
|
+
defineSlots<{
|
|
29
|
+
item?: (props: { item: TransferItem; checked: boolean; toggle: () => void; move: () => void }) => unknown
|
|
30
|
+
empty?: () => unknown
|
|
24
31
|
}>()
|
|
25
32
|
|
|
26
33
|
const emit = defineEmits<{
|
|
@@ -34,10 +41,45 @@ const checkedVisible = computed(() => props.items.filter((i) => props.checked.ha
|
|
|
34
41
|
const allChecked = computed(() => props.items.length > 0 && checkedVisible.value === props.items.length)
|
|
35
42
|
const someChecked = computed(() => checkedVisible.value > 0 && !allChecked.value)
|
|
36
43
|
|
|
44
|
+
// Leaving rows go `position: absolute` so the rest can slide up, but with no `top` each one
|
|
45
|
+
// falls back to its static position, which shifts as its siblings leave the flow too: on a
|
|
46
|
+
// "move all" every row collapsed onto the first slot while fading out. Snapshot every row's
|
|
47
|
+
// offset before the update (once the first leave starts, later measurements are already
|
|
48
|
+
// wrong) and pin each leaving row there.
|
|
49
|
+
const listEl = ref<HTMLElement>()
|
|
50
|
+
const rowBoxes = new WeakMap<Element, { top: number; left: number; width: number }>()
|
|
51
|
+
onBeforeUpdate(() => {
|
|
52
|
+
listEl.value?.querySelectorAll<HTMLElement>(':scope > ul > li').forEach((li) =>
|
|
53
|
+
rowBoxes.set(li, { top: li.offsetTop, left: li.offsetLeft, width: li.offsetWidth }),
|
|
54
|
+
)
|
|
55
|
+
})
|
|
56
|
+
function pinLeaving(el: Element) {
|
|
57
|
+
const box = rowBoxes.get(el)
|
|
58
|
+
if (!box) return
|
|
59
|
+
// Left and width too: a `bare` list is padded, so `left: 0; right: 0` would widen the row.
|
|
60
|
+
Object.assign((el as HTMLElement).style, { top: `${box.top}px`, left: `${box.left}px`, width: `${box.width}px`, right: 'auto' })
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// Controls inside custom `#item` content (buttons, links, fields, or anything marked with
|
|
64
|
+
// `data-transfer-action`) keep their own clicks and keys instead of toggling or moving the row.
|
|
65
|
+
const CONTROL = 'button, a, select, textarea, [contenteditable], [data-transfer-action], input:not([type="checkbox"])'
|
|
66
|
+
const fromControl = (e: Event) => !!(e.target as Element).closest(CONTROL)
|
|
67
|
+
|
|
37
68
|
function onRowClick(e: MouseEvent, value: Value) {
|
|
38
69
|
// The checkbox handles its own clicks (its label + input); toggling here too is exactly
|
|
39
70
|
// the old double-toggle bug, where the box showed checked but the state wasn't.
|
|
40
|
-
if ((e.target as Element).closest('label')) return
|
|
71
|
+
if ((e.target as Element).closest('label') || fromControl(e)) return
|
|
72
|
+
emit('toggle', value)
|
|
73
|
+
}
|
|
74
|
+
function onRowActivate(e: Event, value: Value) {
|
|
75
|
+
if (fromControl(e)) return
|
|
76
|
+
e.preventDefault()
|
|
77
|
+
emit('activate', value)
|
|
78
|
+
}
|
|
79
|
+
// `bare` rows have no checkbox, so the row itself is the focusable checkbox: Space toggles.
|
|
80
|
+
function onRowSpace(e: KeyboardEvent, value: Value) {
|
|
81
|
+
if (!props.bare || e.target !== e.currentTarget) return
|
|
82
|
+
e.preventDefault()
|
|
41
83
|
emit('toggle', value)
|
|
42
84
|
}
|
|
43
85
|
</script>
|
|
@@ -85,46 +127,82 @@ function onRowClick(e: MouseEvent, value: Value) {
|
|
|
85
127
|
</div>
|
|
86
128
|
|
|
87
129
|
<!-- List -->
|
|
88
|
-
<div class="relative overflow-y-auto overscroll-contain" :style="{ height: listHeight }">
|
|
89
|
-
<TransitionGroup
|
|
130
|
+
<div ref="listEl" class="relative overflow-y-auto overscroll-contain" :style="{ height: listHeight }">
|
|
131
|
+
<TransitionGroup
|
|
132
|
+
tag="ul"
|
|
133
|
+
:name="`m3-tl-${enterFrom}`"
|
|
134
|
+
class="relative"
|
|
135
|
+
:class="bare ? 'flex flex-col gap-2 p-2' : 'py-1'"
|
|
136
|
+
@before-leave="pinLeaving"
|
|
137
|
+
>
|
|
90
138
|
<li
|
|
91
139
|
v-for="item in items"
|
|
92
140
|
:key="item.value"
|
|
93
|
-
class="group relative
|
|
94
|
-
:class="
|
|
141
|
+
class="group relative cursor-pointer select-none"
|
|
142
|
+
:class="bare
|
|
143
|
+
? 'rounded-md outline-none focus-visible:ring-2 focus-visible:ring-secondary'
|
|
144
|
+
: ['flex min-h-14 items-center gap-4 px-4 py-2 transition-colors duration-150', checked.has(item.value) ? 'bg-secondary-container' : '']"
|
|
145
|
+
:tabindex="bare ? 0 : undefined"
|
|
146
|
+
:role="bare ? 'checkbox' : undefined"
|
|
147
|
+
:aria-checked="bare ? checked.has(item.value) : undefined"
|
|
148
|
+
:aria-label="bare ? item.label : undefined"
|
|
95
149
|
@click="onRowClick($event, item.value)"
|
|
96
|
-
@dblclick="
|
|
97
|
-
@keydown.enter
|
|
150
|
+
@dblclick="onRowActivate($event, item.value)"
|
|
151
|
+
@keydown.enter="onRowActivate($event, item.value)"
|
|
152
|
+
@keydown.space="onRowSpace($event, item.value)"
|
|
98
153
|
>
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
154
|
+
<!-- bare: the slot draws the whole row -->
|
|
155
|
+
<slot
|
|
156
|
+
v-if="bare"
|
|
157
|
+
name="item"
|
|
158
|
+
:item="item"
|
|
159
|
+
:checked="checked.has(item.value)"
|
|
160
|
+
:toggle="() => emit('toggle', item.value)"
|
|
161
|
+
:move="() => emit('activate', item.value)"
|
|
103
162
|
/>
|
|
104
|
-
<
|
|
105
|
-
class="relative"
|
|
106
|
-
:model-value="checked.has(item.value)"
|
|
107
|
-
:aria-label="item.label"
|
|
108
|
-
@update:model-value="emit('toggle', item.value)"
|
|
109
|
-
/>
|
|
110
|
-
<span
|
|
111
|
-
v-if="item.icon"
|
|
112
|
-
class="relative flex h-10 w-10 shrink-0 items-center justify-center rounded-full transition-colors duration-150"
|
|
113
|
-
:class="checked.has(item.value) ? 'bg-secondary text-on-secondary' : 'bg-surface-container-highest text-on-surface-variant'"
|
|
114
|
-
>
|
|
115
|
-
<MIcon :name="item.icon" :size="20" />
|
|
116
|
-
</span>
|
|
117
|
-
<span class="relative min-w-0 flex-1">
|
|
118
|
-
<span
|
|
119
|
-
class="block truncate text-body-large"
|
|
120
|
-
:class="checked.has(item.value) ? 'text-on-secondary-container' : 'text-on-surface'"
|
|
121
|
-
>{{ item.label }}</span>
|
|
163
|
+
<template v-else>
|
|
122
164
|
<span
|
|
123
|
-
|
|
124
|
-
class="
|
|
125
|
-
:class="checked.has(item.value) ? '
|
|
126
|
-
|
|
127
|
-
|
|
165
|
+
aria-hidden="true"
|
|
166
|
+
class="pointer-events-none absolute inset-0 opacity-0 transition-opacity duration-150 group-hover:opacity-[0.08]"
|
|
167
|
+
:class="checked.has(item.value) ? 'bg-on-secondary-container' : 'bg-on-surface'"
|
|
168
|
+
/>
|
|
169
|
+
<MCheckbox
|
|
170
|
+
class="relative"
|
|
171
|
+
:model-value="checked.has(item.value)"
|
|
172
|
+
:aria-label="item.label"
|
|
173
|
+
@update:model-value="emit('toggle', item.value)"
|
|
174
|
+
/>
|
|
175
|
+
<!-- #item replaces the icon and text; the row (checkbox, highlight, hover) stays -->
|
|
176
|
+
<div v-if="$slots.item" class="relative min-w-0 flex-1">
|
|
177
|
+
<slot
|
|
178
|
+
name="item"
|
|
179
|
+
:item="item"
|
|
180
|
+
:checked="checked.has(item.value)"
|
|
181
|
+
:toggle="() => emit('toggle', item.value)"
|
|
182
|
+
:move="() => emit('activate', item.value)"
|
|
183
|
+
/>
|
|
184
|
+
</div>
|
|
185
|
+
<template v-else>
|
|
186
|
+
<span
|
|
187
|
+
v-if="item.icon"
|
|
188
|
+
class="relative flex h-10 w-10 shrink-0 items-center justify-center rounded-full transition-colors duration-150"
|
|
189
|
+
:class="checked.has(item.value) ? 'bg-secondary text-on-secondary' : 'bg-surface-container-highest text-on-surface-variant'"
|
|
190
|
+
>
|
|
191
|
+
<MIcon :name="item.icon" :size="20" />
|
|
192
|
+
</span>
|
|
193
|
+
<span class="relative min-w-0 flex-1">
|
|
194
|
+
<span
|
|
195
|
+
class="block truncate text-body-large"
|
|
196
|
+
:class="checked.has(item.value) ? 'text-on-secondary-container' : 'text-on-surface'"
|
|
197
|
+
>{{ item.label }}</span>
|
|
198
|
+
<span
|
|
199
|
+
v-if="item.description"
|
|
200
|
+
class="block truncate text-body-medium"
|
|
201
|
+
:class="checked.has(item.value) ? 'text-on-secondary-container/80' : 'text-on-surface-variant'"
|
|
202
|
+
>{{ item.description }}</span>
|
|
203
|
+
</span>
|
|
204
|
+
</template>
|
|
205
|
+
</template>
|
|
128
206
|
</li>
|
|
129
207
|
</TransitionGroup>
|
|
130
208
|
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { getCurrentInstance } from 'vue'
|
|
2
|
+
|
|
3
|
+
/** A navigation destination: a vue-router location, or a plain URL without vue-router. */
|
|
4
|
+
export type ItemLink = string | Record<string, unknown>
|
|
5
|
+
|
|
6
|
+
/*
|
|
7
|
+
* Internal (not exported from index.ts): lets navigation items with a `to` render as real links
|
|
8
|
+
* (middle-click, open in new tab, `aria-current` from vue-router) instead of buttons. With
|
|
9
|
+
* vue-router installed it's a RouterLink; without it a string `to` becomes a plain `<a href>`
|
|
10
|
+
* rather than an unresolved `<RouterLink>` tag. Items without `to` (or disabled ones) stay buttons.
|
|
11
|
+
*/
|
|
12
|
+
export function useItemLink() {
|
|
13
|
+
const hasRouter = !!getCurrentInstance()?.appContext.components.RouterLink
|
|
14
|
+
return (item: { to?: ItemLink; disabled?: boolean }) => {
|
|
15
|
+
if (!item.to || item.disabled) return { tag: 'button', attrs: { type: 'button', disabled: item.disabled || undefined } }
|
|
16
|
+
if (hasRouter) return { tag: 'RouterLink', attrs: { to: item.to } }
|
|
17
|
+
return { tag: 'a', attrs: { href: typeof item.to === 'string' ? item.to : undefined } }
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import { onBeforeUnmount } from 'vue'
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
* Internal (not exported from index.ts): enter/exit/drag motion for modal sheets
|
|
5
|
+
* (MBottomSheet on y, MSideSheet on x), after androidx BottomSheet.kt + SheetDefaults.kt:
|
|
6
|
+
* show = Standard DefaultSpatial spring (0.9 / 700) from fully off-screen (offset = the
|
|
7
|
+
* panel's own size), hide = FastEffects (1.0 / 3800), scrim alpha = DefaultEffects
|
|
8
|
+
* (1.0 / 1600). The panel slides only, no opacity fade. A drag release springs from where
|
|
9
|
+
* the finger left it, carrying its velocity, either back open or out.
|
|
10
|
+
*
|
|
11
|
+
* Library convention (see CLAUDE.md): springs stepped in one rAF loop, state in plain
|
|
12
|
+
* variables, the DOM written once per frame. The panel's transform must never also be bound
|
|
13
|
+
* reactively in the template, which is what silently killed the old CSS enter animation.
|
|
14
|
+
*
|
|
15
|
+
* Wire it to a `<Transition :css="false" @enter @leave>` around a root holding
|
|
16
|
+
* `[data-sheet-panel]` and `[data-sheet-scrim]`.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
interface Spring { damping: number; stiffness: number }
|
|
20
|
+
const DEFAULT_SPATIAL: Spring = { damping: 0.9, stiffness: 700 }
|
|
21
|
+
const FAST_EFFECTS: Spring = { damping: 1, stiffness: 3800 }
|
|
22
|
+
const DEFAULT_EFFECTS: Spring = { damping: 1, stiffness: 1600 }
|
|
23
|
+
|
|
24
|
+
/** Past this many px, or this fast (px/s) toward closing, a released drag dismisses. */
|
|
25
|
+
const DISMISS_DISTANCE = 100
|
|
26
|
+
const DISMISS_VELOCITY = 1000
|
|
27
|
+
|
|
28
|
+
// Semi-implicit Euler in fixed 4ms substeps: FastEffects' stiffness (3800) is unstable at
|
|
29
|
+
// a dropped frame's 33ms step (it diverges instead of settling).
|
|
30
|
+
const SUBSTEP = 0.004
|
|
31
|
+
function step(s: { pos: number; vel: number }, target: number, spring: Spring, dt: number) {
|
|
32
|
+
for (let left = dt; left > 0; left -= SUBSTEP) {
|
|
33
|
+
const h = Math.min(SUBSTEP, left)
|
|
34
|
+
const accel = -spring.stiffness * (s.pos - target) - 2 * spring.damping * Math.sqrt(spring.stiffness) * s.vel
|
|
35
|
+
s.vel += accel * h
|
|
36
|
+
s.pos += s.vel * h
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export function useSheetMotion(axis: 'x' | 'y', onDismiss: () => void) {
|
|
41
|
+
let panel: HTMLElement | null = null
|
|
42
|
+
let scrim: HTMLElement | null = null
|
|
43
|
+
const offset = { pos: 0, vel: 0 }
|
|
44
|
+
const alpha = { pos: 0, vel: 0 }
|
|
45
|
+
let offsetTarget = 0
|
|
46
|
+
let alphaTarget = 0
|
|
47
|
+
let offsetSpring = DEFAULT_SPATIAL
|
|
48
|
+
let settled: (() => void) | null = null
|
|
49
|
+
let raf = 0
|
|
50
|
+
let last = 0
|
|
51
|
+
|
|
52
|
+
let dragging = false
|
|
53
|
+
let dragStart = 0
|
|
54
|
+
let dragOrigin = 0
|
|
55
|
+
let lastMove = { at: 0, pos: 0 }
|
|
56
|
+
|
|
57
|
+
const size = () => (panel ? (axis === 'y' ? panel.offsetHeight : panel.offsetWidth) : 0)
|
|
58
|
+
const reducedMotion = () =>
|
|
59
|
+
typeof window !== 'undefined' && !!window.matchMedia?.('(prefers-reduced-motion: reduce)').matches
|
|
60
|
+
|
|
61
|
+
function write() {
|
|
62
|
+
if (panel) panel.style.transform = axis === 'y' ? `translateY(${offset.pos}px)` : `translateX(${offset.pos}px)`
|
|
63
|
+
if (scrim) scrim.style.opacity = String(Math.min(1, Math.max(0, alpha.pos)))
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function finish() {
|
|
67
|
+
raf = 0
|
|
68
|
+
const cb = settled
|
|
69
|
+
settled = null
|
|
70
|
+
cb?.()
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function frame(now: number) {
|
|
74
|
+
const dt = Math.min((now - last) / 1000, 1 / 30)
|
|
75
|
+
last = now
|
|
76
|
+
if (!dragging) step(offset, offsetTarget, offsetSpring, dt)
|
|
77
|
+
step(alpha, alphaTarget, DEFAULT_EFFECTS, dt)
|
|
78
|
+
const offsetDone = dragging || (Math.abs(offset.pos - offsetTarget) < 0.5 && Math.abs(offset.vel) < 5)
|
|
79
|
+
const alphaDone = Math.abs(alpha.pos - alphaTarget) < 0.002 && Math.abs(alpha.vel) < 0.05
|
|
80
|
+
if (offsetDone && alphaDone) {
|
|
81
|
+
if (!dragging) offset.pos = offsetTarget
|
|
82
|
+
alpha.pos = alphaTarget
|
|
83
|
+
offset.vel = alpha.vel = 0
|
|
84
|
+
write()
|
|
85
|
+
if (!dragging) return finish()
|
|
86
|
+
raf = 0
|
|
87
|
+
return
|
|
88
|
+
}
|
|
89
|
+
write()
|
|
90
|
+
raf = requestAnimationFrame(frame)
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
function run() {
|
|
94
|
+
if (reducedMotion()) {
|
|
95
|
+
offset.pos = offsetTarget
|
|
96
|
+
alpha.pos = alphaTarget
|
|
97
|
+
offset.vel = alpha.vel = 0
|
|
98
|
+
write()
|
|
99
|
+
return finish()
|
|
100
|
+
}
|
|
101
|
+
if (raf) return
|
|
102
|
+
last = performance.now()
|
|
103
|
+
raf = requestAnimationFrame(frame)
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
function bind(el: Element) {
|
|
107
|
+
panel = el.querySelector<HTMLElement>('[data-sheet-panel]')
|
|
108
|
+
scrim = el.querySelector<HTMLElement>('[data-sheet-scrim]')
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
function onEnter(el: Element, done: () => void) {
|
|
112
|
+
// Reopened mid-exit: let the old element go now instead of leaving it in the DOM.
|
|
113
|
+
settled?.()
|
|
114
|
+
settled = null
|
|
115
|
+
if (raf) cancelAnimationFrame(raf)
|
|
116
|
+
raf = 0
|
|
117
|
+
bind(el)
|
|
118
|
+
offset.pos = size()
|
|
119
|
+
offset.vel = 0
|
|
120
|
+
alpha.pos = 0
|
|
121
|
+
alpha.vel = 0
|
|
122
|
+
offsetTarget = 0
|
|
123
|
+
alphaTarget = 1
|
|
124
|
+
offsetSpring = DEFAULT_SPATIAL
|
|
125
|
+
settled = done
|
|
126
|
+
write()
|
|
127
|
+
run()
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
function onLeave(el: Element, done: () => void) {
|
|
131
|
+
bind(el)
|
|
132
|
+
dragging = false
|
|
133
|
+
offsetTarget = size()
|
|
134
|
+
alphaTarget = 0
|
|
135
|
+
offsetSpring = FAST_EFFECTS
|
|
136
|
+
settled = done
|
|
137
|
+
run()
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
function onDragStart(e: PointerEvent) {
|
|
141
|
+
// A sheet mounted already open never ran onEnter: find its elements from the handle.
|
|
142
|
+
const root = (e.currentTarget as HTMLElement).closest('[data-sheet-panel]')?.parentElement
|
|
143
|
+
if (root) bind(root)
|
|
144
|
+
dragging = true
|
|
145
|
+
dragStart = axis === 'y' ? e.clientY : e.clientX
|
|
146
|
+
dragOrigin = offset.pos
|
|
147
|
+
offset.vel = 0
|
|
148
|
+
lastMove = { at: performance.now(), pos: offset.pos }
|
|
149
|
+
;(e.currentTarget as HTMLElement).setPointerCapture(e.pointerId)
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
function onDragMove(e: PointerEvent) {
|
|
153
|
+
if (!dragging) return
|
|
154
|
+
const now = performance.now()
|
|
155
|
+
offset.pos = Math.max(0, dragOrigin + (axis === 'y' ? e.clientY : e.clientX) - dragStart)
|
|
156
|
+
const dt = (now - lastMove.at) / 1000
|
|
157
|
+
if (dt > 0) offset.vel = (offset.pos - lastMove.pos) / dt
|
|
158
|
+
lastMove = { at: now, pos: offset.pos }
|
|
159
|
+
write()
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
function onDragEnd() {
|
|
163
|
+
if (!dragging) return
|
|
164
|
+
dragging = false
|
|
165
|
+
// A pause before lifting the finger means no fling.
|
|
166
|
+
if (performance.now() - lastMove.at > 100) offset.vel = 0
|
|
167
|
+
if (offset.pos > DISMISS_DISTANCE || offset.vel > DISMISS_VELOCITY) {
|
|
168
|
+
onDismiss()
|
|
169
|
+
} else {
|
|
170
|
+
offsetTarget = 0
|
|
171
|
+
offsetSpring = DEFAULT_SPATIAL
|
|
172
|
+
run()
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
onBeforeUnmount(() => {
|
|
177
|
+
if (raf) cancelAnimationFrame(raf)
|
|
178
|
+
})
|
|
179
|
+
|
|
180
|
+
return { onEnter, onLeave, onDragStart, onDragMove, onDragEnd }
|
|
181
|
+
}
|
|
@@ -138,6 +138,15 @@ export interface M3Locale {
|
|
|
138
138
|
|
|
139
139
|
// Kanban ({column}/{pos}/{total} are replaced at runtime)
|
|
140
140
|
kanbanMoved: string
|
|
141
|
+
// MWindow title bar buttons
|
|
142
|
+
windowMinimize: string
|
|
143
|
+
windowMaximize: string
|
|
144
|
+
windowRestore: string
|
|
145
|
+
// MPagination ({from}/{to}/{total} and {page}/{pages} are replaced at runtime)
|
|
146
|
+
paginationRange: string
|
|
147
|
+
paginationPage: string
|
|
148
|
+
previousPage: string
|
|
149
|
+
nextPage: string
|
|
141
150
|
}
|
|
142
151
|
|
|
143
152
|
export const defaultLocale: M3Locale = {
|
|
@@ -264,6 +273,14 @@ export const defaultLocale: M3Locale = {
|
|
|
264
273
|
|
|
265
274
|
// Kanban ({column}/{pos}/{total} are replaced at runtime)
|
|
266
275
|
kanbanMoved: 'Moved to {column}, position {pos} of {total}.',
|
|
276
|
+
windowMinimize: 'Minimize',
|
|
277
|
+
windowMaximize: 'Maximize',
|
|
278
|
+
windowRestore: 'Restore',
|
|
279
|
+
// MPagination ({from}/{to}/{total} and {page}/{pages} are replaced at runtime)
|
|
280
|
+
paginationRange: '{from}–{to} of {total}',
|
|
281
|
+
paginationPage: 'Page {page} of {pages}',
|
|
282
|
+
previousPage: 'Previous page',
|
|
283
|
+
nextPage: 'Next page',
|
|
267
284
|
}
|
|
268
285
|
|
|
269
286
|
export const M3_LOCALE_KEY: InjectionKey<MaybeRef<Partial<M3Locale>>> = Symbol('m3-locale')
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { computed, onMounted, onUnmounted, ref, toValue, watch, type MaybeRefOrGetter, type Ref } from 'vue'
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
* M3 window size classes, with the breakpoints from androidx `WindowSizeClass`
|
|
5
|
+
* (window-core: WIDTH_DP_MEDIUM_LOWER_BOUND 600, EXPANDED 840, LARGE 1200, EXTRA_LARGE 1600;
|
|
6
|
+
* HEIGHT_DP_MEDIUM_LOWER_BOUND 480, EXPANDED 900). CSS px stand in for dp.
|
|
7
|
+
*/
|
|
8
|
+
export type WidthSizeClass = 'compact' | 'medium' | 'expanded' | 'large' | 'extra-large'
|
|
9
|
+
export type HeightSizeClass = 'compact' | 'medium' | 'expanded'
|
|
10
|
+
|
|
11
|
+
export function widthSizeClass(width: number): WidthSizeClass {
|
|
12
|
+
if (width < 600) return 'compact'
|
|
13
|
+
if (width < 840) return 'medium'
|
|
14
|
+
if (width < 1200) return 'expanded'
|
|
15
|
+
if (width < 1600) return 'large'
|
|
16
|
+
return 'extra-large'
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export function heightSizeClass(height: number): HeightSizeClass {
|
|
20
|
+
if (height < 480) return 'compact'
|
|
21
|
+
if (height < 900) return 'medium'
|
|
22
|
+
return 'expanded'
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface WindowSizeClassInfo {
|
|
26
|
+
width: Ref<number>
|
|
27
|
+
height: Ref<number>
|
|
28
|
+
widthClass: Ref<WidthSizeClass>
|
|
29
|
+
heightClass: Ref<HeightSizeClass>
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// Window mode shares one `resize` listener across every caller (same ref-counting as useDevice).
|
|
33
|
+
const winWidth = ref(typeof window === 'undefined' ? 0 : window.innerWidth)
|
|
34
|
+
const winHeight = ref(typeof window === 'undefined' ? 0 : window.innerHeight)
|
|
35
|
+
let winListeners = 0
|
|
36
|
+
function updateWindow() {
|
|
37
|
+
winWidth.value = window.innerWidth
|
|
38
|
+
winHeight.value = window.innerHeight
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* The M3 width/height size classes, reactive.
|
|
43
|
+
*
|
|
44
|
+
* With no argument it tracks the browser window. Pass an element (ref or getter) to classify
|
|
45
|
+
* that element's own size instead, which is what the adaptive layout components do, so they
|
|
46
|
+
* adapt to the space they actually get (a column, a dialog, a resizable panel).
|
|
47
|
+
*/
|
|
48
|
+
export function useWindowSizeClass(target?: MaybeRefOrGetter<HTMLElement | null | undefined>): WindowSizeClassInfo {
|
|
49
|
+
let width: Ref<number>
|
|
50
|
+
let height: Ref<number>
|
|
51
|
+
|
|
52
|
+
if (target === undefined) {
|
|
53
|
+
width = winWidth
|
|
54
|
+
height = winHeight
|
|
55
|
+
onMounted(() => {
|
|
56
|
+
if (winListeners++ === 0) {
|
|
57
|
+
updateWindow()
|
|
58
|
+
window.addEventListener('resize', updateWindow)
|
|
59
|
+
}
|
|
60
|
+
})
|
|
61
|
+
onUnmounted(() => {
|
|
62
|
+
if (--winListeners === 0) window.removeEventListener('resize', updateWindow)
|
|
63
|
+
})
|
|
64
|
+
} else {
|
|
65
|
+
// Until the element is measured, guess from the window so the first paint is usually right.
|
|
66
|
+
width = ref(winWidth.value)
|
|
67
|
+
height = ref(winHeight.value)
|
|
68
|
+
let observer: ResizeObserver | undefined
|
|
69
|
+
const observe = (el: HTMLElement | null | undefined) => {
|
|
70
|
+
observer?.disconnect()
|
|
71
|
+
if (!el || typeof ResizeObserver === 'undefined') return
|
|
72
|
+
width.value = el.offsetWidth
|
|
73
|
+
height.value = el.offsetHeight
|
|
74
|
+
// offsetWidth/Height (border box), so padding on the element counts like it does for the window.
|
|
75
|
+
observer = new ResizeObserver(() => {
|
|
76
|
+
width.value = el.offsetWidth
|
|
77
|
+
height.value = el.offsetHeight
|
|
78
|
+
})
|
|
79
|
+
observer.observe(el)
|
|
80
|
+
}
|
|
81
|
+
onMounted(() => {
|
|
82
|
+
watch(() => toValue(target), observe, { immediate: true })
|
|
83
|
+
})
|
|
84
|
+
onUnmounted(() => observer?.disconnect())
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
return {
|
|
88
|
+
width,
|
|
89
|
+
height,
|
|
90
|
+
widthClass: computed(() => widthSizeClass(width.value)),
|
|
91
|
+
heightClass: computed(() => heightSizeClass(height.value)),
|
|
92
|
+
}
|
|
93
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -13,6 +13,8 @@ export { useFieldBg } from './composables/useFieldBg'
|
|
|
13
13
|
export { useLocale, defaultLocale } from './composables/useLocale'
|
|
14
14
|
export type { M3Locale } from './composables/useLocale'
|
|
15
15
|
export { useDevice } from './composables/useDevice'
|
|
16
|
+
export { useWindowSizeClass, widthSizeClass, heightSizeClass } from './composables/useWindowSizeClass'
|
|
17
|
+
export type { WidthSizeClass, HeightSizeClass, WindowSizeClassInfo } from './composables/useWindowSizeClass'
|
|
16
18
|
export { useNotification } from './composables/useNotification'
|
|
17
19
|
export type { Notification, NotificationVariant, NotificationPosition, NotificationOptions } from './composables/useNotification'
|
|
18
20
|
export { useDebounce } from './composables/useDebounce'
|
|
@@ -103,6 +105,10 @@ export { default as MNavigationBar } from './components/MNavigationBar.vue'
|
|
|
103
105
|
export { default as MNumberField } from './components/MNumberField.vue'
|
|
104
106
|
export { default as MNavigationDrawer } from './components/MNavigationDrawer.vue'
|
|
105
107
|
export { default as MNavigationRail } from './components/MNavigationRail.vue'
|
|
108
|
+
export { default as MNavigationSuite } from './components/MNavigationSuite.vue'
|
|
109
|
+
export type { NavigationSuiteItem, NavigationSuiteLayout } from './components/MNavigationSuite.vue'
|
|
110
|
+
export { default as MListDetail } from './components/MListDetail.vue'
|
|
111
|
+
export { default as MSupportingPane } from './components/MSupportingPane.vue'
|
|
106
112
|
export { default as MOverlay } from './components/MOverlay.vue'
|
|
107
113
|
export { default as MPageProgress } from './components/MPageProgress.vue'
|
|
108
114
|
export { default as MPagination } from './components/MPagination.vue'
|
package/src/locales/de.ts
CHANGED
|
@@ -137,4 +137,12 @@ export const deLocale: M3Locale = {
|
|
|
137
137
|
|
|
138
138
|
// Kanban ({column}/{pos}/{total} are replaced at runtime)
|
|
139
139
|
kanbanMoved: 'Nach {column} verschoben, Position {pos} von {total}.',
|
|
140
|
+
windowMinimize: 'Minimieren',
|
|
141
|
+
windowMaximize: 'Maximieren',
|
|
142
|
+
windowRestore: 'Wiederherstellen',
|
|
143
|
+
// MPagination ({from}/{to}/{total} and {page}/{pages} are replaced at runtime)
|
|
144
|
+
paginationRange: '{from}–{to} von {total}',
|
|
145
|
+
paginationPage: 'Seite {page} von {pages}',
|
|
146
|
+
previousPage: 'Vorherige Seite',
|
|
147
|
+
nextPage: 'Nächste Seite',
|
|
140
148
|
}
|
package/src/locales/es.ts
CHANGED
|
@@ -137,4 +137,12 @@ export const esLocale: M3Locale = {
|
|
|
137
137
|
|
|
138
138
|
// Kanban ({column}/{pos}/{total} are replaced at runtime)
|
|
139
139
|
kanbanMoved: 'Movido a {column}, posición {pos} de {total}.',
|
|
140
|
+
windowMinimize: 'Minimizar',
|
|
141
|
+
windowMaximize: 'Maximizar',
|
|
142
|
+
windowRestore: 'Restaurar',
|
|
143
|
+
// MPagination ({from}/{to}/{total} and {page}/{pages} are replaced at runtime)
|
|
144
|
+
paginationRange: '{from}–{to} de {total}',
|
|
145
|
+
paginationPage: 'Página {page} de {pages}',
|
|
146
|
+
previousPage: 'Página anterior',
|
|
147
|
+
nextPage: 'Página siguiente',
|
|
140
148
|
}
|
package/src/locales/fr.ts
CHANGED
|
@@ -137,4 +137,12 @@ export const frLocale: M3Locale = {
|
|
|
137
137
|
|
|
138
138
|
// Kanban ({column}/{pos}/{total} are replaced at runtime)
|
|
139
139
|
kanbanMoved: 'Déplacé vers {column}, position {pos} sur {total}.',
|
|
140
|
+
windowMinimize: 'Réduire',
|
|
141
|
+
windowMaximize: 'Agrandir',
|
|
142
|
+
windowRestore: 'Restaurer',
|
|
143
|
+
// MPagination ({from}/{to}/{total} and {page}/{pages} are replaced at runtime)
|
|
144
|
+
paginationRange: '{from}–{to} sur {total}',
|
|
145
|
+
paginationPage: 'Page {page} sur {pages}',
|
|
146
|
+
previousPage: 'Page précédente',
|
|
147
|
+
nextPage: 'Page suivante',
|
|
140
148
|
}
|
package/src/locales/ja.ts
CHANGED
|
@@ -137,4 +137,12 @@ export const jaLocale: M3Locale = {
|
|
|
137
137
|
|
|
138
138
|
// Kanban ({column}/{pos}/{total} are replaced at runtime)
|
|
139
139
|
kanbanMoved: '{column} の {total} 件中 {pos} 番目に移動しました。',
|
|
140
|
+
windowMinimize: '最小化',
|
|
141
|
+
windowMaximize: '最大化',
|
|
142
|
+
windowRestore: '元に戻す',
|
|
143
|
+
// MPagination ({from}/{to}/{total} and {page}/{pages} are replaced at runtime)
|
|
144
|
+
paginationRange: '{total} 件中 {from}–{to} 件',
|
|
145
|
+
paginationPage: '{pages} ページ中 {page} ページ',
|
|
146
|
+
previousPage: '前のページ',
|
|
147
|
+
nextPage: '次のページ',
|
|
140
148
|
}
|
package/src/locales/ko.ts
CHANGED
|
@@ -137,4 +137,12 @@ export const koLocale: M3Locale = {
|
|
|
137
137
|
|
|
138
138
|
// Kanban ({column}/{pos}/{total} are replaced at runtime)
|
|
139
139
|
kanbanMoved: '{column}의 {total}개 중 {pos}번째로 이동했습니다.',
|
|
140
|
+
windowMinimize: '최소화',
|
|
141
|
+
windowMaximize: '최대화',
|
|
142
|
+
windowRestore: '복원',
|
|
143
|
+
// MPagination ({from}/{to}/{total} and {page}/{pages} are replaced at runtime)
|
|
144
|
+
paginationRange: '{total}개 중 {from}–{to}',
|
|
145
|
+
paginationPage: '{pages}페이지 중 {page}페이지',
|
|
146
|
+
previousPage: '이전 페이지',
|
|
147
|
+
nextPage: '다음 페이지',
|
|
140
148
|
}
|
package/src/locales/pt.ts
CHANGED
|
@@ -137,4 +137,12 @@ export const ptLocale: M3Locale = {
|
|
|
137
137
|
|
|
138
138
|
// Kanban ({column}/{pos}/{total} are replaced at runtime)
|
|
139
139
|
kanbanMoved: 'Movido para {column}, posição {pos} de {total}.',
|
|
140
|
+
windowMinimize: 'Minimizar',
|
|
141
|
+
windowMaximize: 'Maximizar',
|
|
142
|
+
windowRestore: 'Restaurar',
|
|
143
|
+
// MPagination ({from}/{to}/{total} and {page}/{pages} are replaced at runtime)
|
|
144
|
+
paginationRange: '{from}–{to} de {total}',
|
|
145
|
+
paginationPage: 'Página {page} de {pages}',
|
|
146
|
+
previousPage: 'Página anterior',
|
|
147
|
+
nextPage: 'Próxima página',
|
|
140
148
|
}
|
package/src/locales/zh.ts
CHANGED
|
@@ -137,4 +137,12 @@ export const zhLocale: M3Locale = {
|
|
|
137
137
|
|
|
138
138
|
// Kanban ({column}/{pos}/{total} are replaced at runtime)
|
|
139
139
|
kanbanMoved: '已移至 {column},位置 {pos}/{total}。',
|
|
140
|
+
windowMinimize: '最小化',
|
|
141
|
+
windowMaximize: '最大化',
|
|
142
|
+
windowRestore: '还原',
|
|
143
|
+
// MPagination ({from}/{to}/{total} and {page}/{pages} are replaced at runtime)
|
|
144
|
+
paginationRange: '第 {from}–{to} 项,共 {total} 项',
|
|
145
|
+
paginationPage: '第 {page} 页,共 {pages} 页',
|
|
146
|
+
previousPage: '上一页',
|
|
147
|
+
nextPage: '下一页',
|
|
140
148
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useLocale-4afAzuuP.js","names":[],"sources":["../src/composables/useLocale.ts"],"sourcesContent":["import { inject, reactive, watchEffect, toValue, type InjectionKey, type MaybeRef } from 'vue'\n\nexport interface M3Locale {\n /** BCP-47 language tag (e.g. 'en', 'es', 'pt') — read by locale-aware components (MRelativeTime) that use Intl formatting. */\n lang: string\n\n // Common\n search: string\n noResults: string\n close: string\n cancel: string\n confirm: string\n loading: string\n menu: string\n\n // Navigation\n previous: string\n next: string\n today: string\n more: string\n\n // Tables\n selectedCount: string\n recordCount: string\n expand: string\n columns: string\n exportCsv: string\n noGroup: string\n\n // Tour\n finish: string\n\n // File upload\n dropText: string\n selectText: string\n maxSizePrefix: string\n remove: string\n\n // Pickers\n selectDate: string\n selectTime: string\n selectRange: string\n pickStart: string\n pickEnd: string\n previousMonth: string\n nextMonth: string\n\n // Scheduler\n dayView: string\n weekView: string\n\n // Transfer list\n available: string\n selected: string\n noItems: string\n moveAllRight: string\n moveRight: string\n moveLeft: string\n moveAllLeft: string\n\n // Command palette / Spotlight\n searchCommand: string\n navigateHint: string\n selectHint: string\n openHint: string\n closeHint: string\n\n // Infinite scroll\n loadingMore: string\n noMoreItems: string\n\n // Rich text editor\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 insert: string\n\n // JSON editor\n jsonValid: string\n jsonInvalid: string\n jsonFormat: string\n jsonMinify: string\n\n // JSON viewer\n jsonElements: string\n jsonFields: string\n\n // Result\n resultSuccessTitle: string\n resultSuccessDesc: string\n resultErrorTitle: string\n resultErrorDesc: string\n resultWarningTitle: string\n resultWarningDesc: string\n resultInfoTitle: string\n resultInfoDesc: string\n result404Title: string\n result404Desc: string\n result403Title: string\n result403Desc: string\n result500Title: string\n result500Desc: string\n\n // Chat bubble\n chatTyping: string\n chatRecordingAudio: string\n\n // Drag & drop list ({pos}/{total} are replaced at runtime)\n reorderHandle: string\n reorderGrabbed: string\n reorderMoved: string\n reorderDropped: string\n reorderCancelled: string\n\n // Transfer list (panes)\n selectAll: string\n clearSearch: string\n\n // Kanban ({column}/{pos}/{total} are replaced at runtime)\n kanbanMoved: string\n}\n\nexport const defaultLocale: M3Locale = {\n lang: 'en',\n\n search: 'Search...',\n noResults: 'No results',\n close: 'Close',\n menu: 'Menu',\n cancel: 'Cancel',\n confirm: 'Confirm',\n loading: 'Loading',\n\n previous: 'Previous',\n next: 'Next',\n today: 'Today',\n more: 'more',\n\n selectedCount: 'selected',\n recordCount: 'record',\n expand: 'Expand',\n columns: 'Columns',\n exportCsv: 'Export CSV',\n noGroup: 'No group',\n\n finish: 'Finish',\n\n dropText: 'Drop files here or',\n selectText: 'browse',\n maxSizePrefix: 'Max.',\n remove: 'Remove',\n\n selectDate: 'Select date',\n selectTime: 'Select time',\n selectRange: 'Select range',\n pickStart: 'Select start',\n pickEnd: 'Select end',\n previousMonth: 'Previous month',\n nextMonth: 'Next month',\n\n dayView: 'Day',\n weekView: 'Week',\n\n available: 'Available',\n selected: 'Selected',\n noItems: 'No items',\n moveAllRight: 'Move all right',\n moveRight: 'Move selected right',\n moveLeft: 'Move selected left',\n moveAllLeft: 'Move all left',\n\n searchCommand: 'Search command...',\n navigateHint: 'navigate',\n selectHint: 'select',\n openHint: 'open',\n closeHint: 'close',\n\n loadingMore: 'Loading...',\n noMoreItems: 'No more items',\n\n bold: 'Bold',\n italic: 'Italic',\n underline: 'Underline',\n strikethrough: 'Strikethrough',\n highlight: 'Highlight',\n bulletList: 'Bullet list',\n orderedList: 'Ordered list',\n blockquote: 'Blockquote',\n code: 'Code',\n alignLeft: 'Align left',\n alignCenter: 'Align center',\n alignRight: 'Align right',\n undo: 'Undo',\n redo: 'Redo',\n link: 'Link',\n image: 'Image',\n paragraph: 'Paragraph',\n heading1: 'Heading 1',\n heading2: 'Heading 2',\n heading3: 'Heading 3',\n insertLink: 'Insert link',\n insertImage: 'Insert image',\n imageUrlLabel: 'Image URL',\n insert: 'Insert',\n\n jsonValid: 'Valid',\n jsonInvalid: 'Invalid',\n jsonFormat: 'Format',\n jsonMinify: 'Minify',\n\n jsonElements: 'elements',\n jsonFields: 'fields',\n\n // Result\n resultSuccessTitle: 'Success',\n resultSuccessDesc: 'The action was completed successfully.',\n resultErrorTitle: 'Something went wrong',\n resultErrorDesc: 'An unexpected error occurred. Please try again.',\n resultWarningTitle: 'Warning',\n resultWarningDesc: 'Something needs your attention.',\n resultInfoTitle: 'Information',\n resultInfoDesc: 'Here is something you should know.',\n result404Title: 'Page not found',\n result404Desc: 'The page you are looking for does not exist or has been moved.',\n result403Title: 'Access denied',\n result403Desc: 'You don\\'t have permission to view this resource.',\n result500Title: 'Server error',\n result500Desc: 'The server could not process the request.',\n\n // Chat bubble\n chatTyping: 'Typing…',\n chatRecordingAudio: 'Recording audio…',\n\n // Drag & drop list ({pos}/{total} are replaced at runtime)\n reorderHandle: 'Reorder',\n reorderGrabbed: 'Item grabbed, position {pos} of {total}. Use the arrow keys to move it, Space to drop it, Escape to cancel.',\n reorderMoved: 'Moved to position {pos} of {total}.',\n reorderDropped: 'Item dropped at position {pos} of {total}.',\n reorderCancelled: 'Reorder cancelled.',\n\n // Transfer list (panes)\n selectAll: 'Select all',\n clearSearch: 'Clear search',\n\n // Kanban ({column}/{pos}/{total} are replaced at runtime)\n kanbanMoved: 'Moved to {column}, position {pos} of {total}.',\n}\n\nexport const M3_LOCALE_KEY: InjectionKey<MaybeRef<Partial<M3Locale>>> = Symbol('m3-locale')\n\nexport function useLocale(): M3Locale {\n const provided = inject(M3_LOCALE_KEY, {})\n const locale = reactive({ ...defaultLocale }) as M3Locale\n\n watchEffect(() => {\n Object.assign(locale, defaultLocale, toValue(provided))\n })\n\n return locale\n}\n"],"mappings":";;AA8IA,IAAa,IAA0B;CACrC,MAAM;CAEN,QAAQ;CACR,WAAW;CACX,OAAO;CACP,MAAM;CACN,QAAQ;CACR,SAAS;CACT,SAAS;CAET,UAAU;CACV,MAAM;CACN,OAAO;CACP,MAAM;CAEN,eAAe;CACf,aAAa;CACb,QAAQ;CACR,SAAS;CACT,WAAW;CACX,SAAS;CAET,QAAQ;CAER,UAAU;CACV,YAAY;CACZ,eAAe;CACf,QAAQ;CAER,YAAY;CACZ,YAAY;CACZ,aAAa;CACb,WAAW;CACX,SAAS;CACT,eAAe;CACf,WAAW;CAEX,SAAS;CACT,UAAU;CAEV,WAAW;CACX,UAAU;CACV,SAAS;CACT,cAAc;CACd,WAAW;CACX,UAAU;CACV,aAAa;CAEb,eAAe;CACf,cAAc;CACd,YAAY;CACZ,UAAU;CACV,WAAW;CAEX,aAAa;CACb,aAAa;CAEb,MAAM;CACN,QAAQ;CACR,WAAW;CACX,eAAe;CACf,WAAW;CACX,YAAY;CACZ,aAAa;CACb,YAAY;CACZ,MAAM;CACN,WAAW;CACX,aAAa;CACb,YAAY;CACZ,MAAM;CACN,MAAM;CACN,MAAM;CACN,OAAO;CACP,WAAW;CACX,UAAU;CACV,UAAU;CACV,UAAU;CACV,YAAY;CACZ,aAAa;CACb,eAAe;CACf,QAAQ;CAER,WAAW;CACX,aAAa;CACb,YAAY;CACZ,YAAY;CAEZ,cAAc;CACd,YAAY;CAGZ,oBAAoB;CACpB,mBAAmB;CACnB,kBAAkB;CAClB,iBAAiB;CACjB,oBAAoB;CACpB,mBAAmB;CACnB,iBAAiB;CACjB,gBAAgB;CAChB,gBAAgB;CAChB,eAAe;CACf,gBAAgB;CAChB,eAAe;CACf,gBAAgB;CAChB,eAAe;CAGf,YAAY;CACZ,oBAAoB;CAGpB,eAAe;CACf,gBAAgB;CAChB,cAAc;CACd,gBAAgB;CAChB,kBAAkB;CAGlB,WAAW;CACX,aAAa;CAGb,aAAa;AACf,GAEa,IAA2D,OAAO,WAAW;AAE1F,SAAgB,IAAsB;CACpC,IAAM,IAAW,EAAO,GAAe,CAAC,CAAC,GACnC,IAAS,EAAS,EAAE,GAAG,EAAc,CAAC;CAM5C,OAJA,QAAkB;EAChB,OAAO,OAAO,GAAQ,GAAe,EAAQ,CAAQ,CAAC;CACxD,CAAC,GAEM;AACT"}
|