@m3ui-vue/m3ui-vue 0.5.10 → 0.6.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.
Files changed (76) hide show
  1. package/README.md +26 -1
  2. package/dist/{MMenuItem-DyY4zhRA.js → MMenuItem-DbbrJhFE.js} +2 -2
  3. package/dist/{MMenuItem-DyY4zhRA.js.map → MMenuItem-DbbrJhFE.js.map} +1 -1
  4. package/dist/barcode.d.ts +1 -0
  5. package/dist/barcode.js +51 -0
  6. package/dist/barcode.js.map +1 -0
  7. package/dist/code-editor.js +1 -1
  8. package/dist/components/MAutocomplete.vue.d.ts +1 -1
  9. package/dist/components/MBarcode.vue.d.ts +35 -0
  10. package/dist/components/MButton.vue.d.ts +1 -1
  11. package/dist/components/MButtonGroup.vue.d.ts +1 -1
  12. package/dist/components/MChatBubble.vue.d.ts +1 -1
  13. package/dist/components/MCircleProgressBar.vue.d.ts +1 -1
  14. package/dist/components/MCopyButton.vue.d.ts +31 -0
  15. package/dist/components/MExportButton.vue.d.ts +43 -0
  16. package/dist/components/MFab.vue.d.ts +1 -1
  17. package/dist/components/MKbd.vue.d.ts +12 -0
  18. package/dist/components/MMultiAutocomplete.vue.d.ts +1 -1
  19. package/dist/components/MMultiSelect.vue.d.ts +1 -1
  20. package/dist/components/MPasswordMeter.vue.d.ts +17 -0
  21. package/dist/components/MPinInput.vue.d.ts +35 -0
  22. package/dist/components/MQRCode.vue.d.ts +35 -0
  23. package/dist/components/MRating.vue.d.ts +1 -1
  24. package/dist/components/MRelativeTime.vue.d.ts +8 -0
  25. package/dist/components/MSelect.vue.d.ts +1 -1
  26. package/dist/components/MShader.vue.d.ts +2 -2
  27. package/dist/components/MSignaturePad.vue.d.ts +37 -0
  28. package/dist/components/MSlider.vue.d.ts +1 -1
  29. package/dist/components/MSplitButton.vue.d.ts +1 -1
  30. package/dist/components/MSubtitle.vue.d.ts +1 -1
  31. package/dist/components/MTerminal.vue.d.ts +2 -2
  32. package/dist/components/MTitle.vue.d.ts +1 -1
  33. package/dist/components/MWindow.vue.d.ts +1 -1
  34. package/dist/composables/useLocale.d.ts +2 -0
  35. package/dist/index.d.ts +7 -0
  36. package/dist/locales/index.js +7 -0
  37. package/dist/locales/index.js.map +1 -1
  38. package/dist/m3ui.js +1192 -721
  39. package/dist/m3ui.js.map +1 -1
  40. package/dist/qrcode.d.ts +1 -0
  41. package/dist/qrcode.js +117 -0
  42. package/dist/qrcode.js.map +1 -0
  43. package/dist/rich-text-editor.js +2 -2
  44. package/dist/{useLocale-QCIVDYWx.js → useLocale-BKsIWNix.js} +2 -1
  45. package/dist/useLocale-BKsIWNix.js.map +1 -0
  46. package/package.json +21 -1
  47. package/src/__tests__/MBarcode.test.ts +40 -0
  48. package/src/__tests__/MCopyButton.test.ts +49 -0
  49. package/src/__tests__/MExportButton.test.ts +64 -0
  50. package/src/__tests__/MKbd.test.ts +33 -0
  51. package/src/__tests__/MPasswordMeter.test.ts +43 -0
  52. package/src/__tests__/MPinInput.test.ts +138 -0
  53. package/src/__tests__/MQRCode.test.ts +58 -0
  54. package/src/__tests__/MRelativeTime.test.ts +43 -0
  55. package/src/__tests__/MSignaturePad.test.ts +62 -0
  56. package/src/barcode.ts +1 -0
  57. package/src/components/MBarcode.vue +61 -0
  58. package/src/components/MCopyButton.vue +62 -0
  59. package/src/components/MExportButton.vue +73 -0
  60. package/src/components/MKbd.vue +36 -0
  61. package/src/components/MPasswordMeter.vue +56 -0
  62. package/src/components/MPinInput.vue +202 -0
  63. package/src/components/MQRCode.vue +131 -0
  64. package/src/components/MRelativeTime.vue +68 -0
  65. package/src/components/MSignaturePad.vue +138 -0
  66. package/src/composables/useLocale.ts +5 -0
  67. package/src/index.ts +7 -0
  68. package/src/locales/de.ts +2 -0
  69. package/src/locales/es.ts +2 -0
  70. package/src/locales/fr.ts +2 -0
  71. package/src/locales/ja.ts +2 -0
  72. package/src/locales/ko.ts +2 -0
  73. package/src/locales/pt.ts +2 -0
  74. package/src/locales/zh.ts +2 -0
  75. package/src/qrcode.ts +1 -0
  76. package/dist/useLocale-QCIVDYWx.js.map +0 -1
@@ -0,0 +1,131 @@
1
+ <script setup lang="ts">
2
+ import { computed } from 'vue'
3
+ import QRCode from 'qrcode-generator'
4
+
5
+ const props = withDefaults(
6
+ defineProps<{
7
+ value: string
8
+ size?: number
9
+ /** Quiet zone around the code, in modules. */
10
+ margin?: number
11
+ errorCorrectionLevel?: 'L' | 'M' | 'Q' | 'H'
12
+ color?: string
13
+ background?: string
14
+ label?: string
15
+ /** Rounds the outer container corners. */
16
+ rounded?: boolean
17
+ /** 'square' is the classic scannable pixel grid. 'dots' rounds each module — still fully scannable, just a softer look. */
18
+ moduleStyle?: 'square' | 'dots'
19
+ }>(),
20
+ {
21
+ size: 200,
22
+ margin: 4,
23
+ errorCorrectionLevel: 'M',
24
+ color: '#000000',
25
+ background: '#ffffff',
26
+ rounded: true,
27
+ moduleStyle: 'square',
28
+ },
29
+ )
30
+
31
+ // qr and error are derived together in one computed so they can never be
32
+ // read out of sync with each other (e.g. a template `v-if="error"` seeing a
33
+ // stale value from before `qr` — which sets it — was actually evaluated).
34
+ const result = computed(() => {
35
+ try {
36
+ const instance = QRCode(0, props.errorCorrectionLevel)
37
+ instance.addData(props.value)
38
+ instance.make()
39
+ return { qr: instance, error: null as string | null }
40
+ } catch (err) {
41
+ // qrcode-generator throws plain strings (e.g. "code length overflow...")
42
+ const message = typeof err === 'string' ? err : err instanceof Error ? err.message : 'Failed to generate QR code'
43
+ return { qr: null, error: message }
44
+ }
45
+ })
46
+
47
+ const qr = computed(() => result.value.qr)
48
+ const error = computed(() => result.value.error)
49
+
50
+ const moduleCount = computed(() => qr.value?.getModuleCount() ?? 0)
51
+ const totalModules = computed(() => moduleCount.value + props.margin * 2)
52
+ const moduleSize = computed(() => (totalModules.value > 0 ? props.size / totalModules.value : 0))
53
+ const containerRadius = computed(() => (props.rounded ? props.size * 0.06 : 0))
54
+
55
+ // A corner rounds only when neither of its two perpendicular neighbors is
56
+ // also dark — otherwise adjacent modules (e.g. the finder-pattern squares,
57
+ // or any run of touching pixels) would each round independently and leave
58
+ // visible notches instead of merging into one smooth shape.
59
+ function roundedRectPath(x: number, y: number, s: number, rTL: number, rTR: number, rBR: number, rBL: number): string {
60
+ return `M${x + rTL},${y} H${x + s - rTR} A${rTR},${rTR} 0 0 1 ${x + s},${y + rTR} V${y + s - rBR} A${rBR},${rBR} 0 0 1 ${x + s - rBR},${y + s} H${x + rBL} A${rBL},${rBL} 0 0 1 ${x},${y + s - rBL} V${y + rTL} A${rTL},${rTL} 0 0 1 ${x + rTL},${y} Z`
61
+ }
62
+
63
+ const cells = computed(() => {
64
+ const result: { x: number; y: number; d?: string }[] = []
65
+ const inst = qr.value
66
+ if (!inst) return result
67
+ const count = moduleCount.value
68
+ const s = moduleSize.value
69
+ const isDark = (row: number, col: number) => row >= 0 && row < count && col >= 0 && col < count && inst.isDark(row, col)
70
+
71
+ for (let row = 0; row < count; row++) {
72
+ for (let col = 0; col < count; col++) {
73
+ if (!isDark(row, col)) continue
74
+ const x = (col + props.margin) * s
75
+ const y = (row + props.margin) * s
76
+
77
+ if (props.moduleStyle !== 'dots') {
78
+ result.push({ x, y })
79
+ continue
80
+ }
81
+
82
+ const radius = s / 2
83
+ const up = isDark(row - 1, col)
84
+ const down = isDark(row + 1, col)
85
+ const left = isDark(row, col - 1)
86
+ const right = isDark(row, col + 1)
87
+ result.push({
88
+ x, y,
89
+ d: roundedRectPath(
90
+ x, y, s,
91
+ up || left ? 0 : radius,
92
+ up || right ? 0 : radius,
93
+ down || right ? 0 : radius,
94
+ down || left ? 0 : radius,
95
+ ),
96
+ })
97
+ }
98
+ }
99
+ return result
100
+ })
101
+ </script>
102
+
103
+ <template>
104
+ <div v-if="error" class="flex items-center justify-center text-body-small text-error" :style="{ width: `${size}px`, height: `${size}px` }">
105
+ <slot name="error">{{ error }}</slot>
106
+ </div>
107
+ <svg
108
+ v-else
109
+ :width="size"
110
+ :height="size"
111
+ :viewBox="`0 0 ${size} ${size}`"
112
+ role="img"
113
+ :aria-label="label ?? value"
114
+ >
115
+ <rect x="0" y="0" :width="size" :height="size" :rx="containerRadius" :ry="containerRadius" :fill="background" />
116
+ <template v-if="moduleStyle === 'dots'">
117
+ <path v-for="(cell, i) in cells" :key="i" :d="cell.d" :fill="color" />
118
+ </template>
119
+ <template v-else>
120
+ <rect
121
+ v-for="(cell, i) in cells"
122
+ :key="i"
123
+ :x="cell.x"
124
+ :y="cell.y"
125
+ :width="moduleSize"
126
+ :height="moduleSize"
127
+ :fill="color"
128
+ />
129
+ </template>
130
+ </svg>
131
+ </template>
@@ -0,0 +1,68 @@
1
+ <script setup lang="ts">
2
+ import { computed, onUnmounted, ref, watch } from 'vue'
3
+ import { useLocale } from '../composables/useLocale'
4
+
5
+ const props = withDefaults(
6
+ defineProps<{
7
+ value: string | number | Date
8
+ /** BCP-47 locale tag (e.g. 'es-ES'). Defaults to the app's locale (via createM3UI/useLocale), then the browser's locale. */
9
+ locale?: string
10
+ }>(),
11
+ {},
12
+ )
13
+
14
+ const appLocale = useLocale()
15
+ const resolvedLocale = computed(() => props.locale ?? appLocale.lang)
16
+
17
+ const date = computed(() => new Date(props.value))
18
+ const now = ref(Date.now())
19
+
20
+ // Re-render at a cadence that matches the current magnitude — no point
21
+ // re-checking every second once we're already saying "3 hours ago".
22
+ const DIVISIONS: { amount: number; unit: Intl.RelativeTimeFormatUnit; tick: number }[] = [
23
+ { amount: 60, unit: 'seconds', tick: 1_000 },
24
+ { amount: 60, unit: 'minutes', tick: 30_000 },
25
+ { amount: 24, unit: 'hours', tick: 60_000 },
26
+ { amount: 7, unit: 'days', tick: 3_600_000 },
27
+ { amount: 4.34524, unit: 'weeks', tick: 3_600_000 },
28
+ { amount: 12, unit: 'months', tick: 3_600_000 },
29
+ { amount: Infinity, unit: 'years', tick: 0 },
30
+ ]
31
+
32
+ let timer: ReturnType<typeof setTimeout> | undefined
33
+
34
+ function scheduleNext() {
35
+ clearTimeout(timer)
36
+ let duration = (date.value.getTime() - now.value) / 1000
37
+ for (const division of DIVISIONS) {
38
+ if (Math.abs(duration) < division.amount) {
39
+ if (division.tick > 0) {
40
+ timer = setTimeout(() => { now.value = Date.now(); scheduleNext() }, division.tick)
41
+ }
42
+ return
43
+ }
44
+ duration /= division.amount
45
+ }
46
+ }
47
+
48
+ watch(date, () => { now.value = Date.now(); scheduleNext() }, { immediate: true })
49
+ onUnmounted(() => clearTimeout(timer))
50
+
51
+ const formatted = computed(() => {
52
+ const formatter = new Intl.RelativeTimeFormat(resolvedLocale.value, { numeric: 'auto' })
53
+ let duration = (date.value.getTime() - now.value) / 1000
54
+ for (const division of DIVISIONS) {
55
+ if (Math.abs(duration) < division.amount) {
56
+ return formatter.format(Math.round(duration), division.unit)
57
+ }
58
+ duration /= division.amount
59
+ }
60
+ return formatter.format(0, 'seconds')
61
+ })
62
+
63
+ const absolute = computed(() => date.value.toLocaleString(resolvedLocale.value))
64
+ </script>
65
+
66
+ <template>
67
+ <time :datetime="date.toISOString()" :title="absolute">{{ formatted }}</time>
68
+ </template>
@@ -0,0 +1,138 @@
1
+ <script setup lang="ts">
2
+ import { computed, onMounted, ref, watch } from 'vue'
3
+
4
+ const props = withDefaults(
5
+ defineProps<{
6
+ width?: number
7
+ height?: number
8
+ lineWidth?: number
9
+ color?: string
10
+ background?: string
11
+ variant?: 'filled' | 'outlined'
12
+ disabled?: boolean
13
+ }>(),
14
+ {
15
+ width: 400,
16
+ height: 200,
17
+ lineWidth: 2.5,
18
+ color: '#000000',
19
+ background: '#ffffff',
20
+ variant: 'outlined',
21
+ disabled: false,
22
+ },
23
+ )
24
+
25
+ const emit = defineEmits<{ begin: []; end: [string]; change: [string] }>()
26
+
27
+ type Point = { x: number; y: number }
28
+
29
+ const canvasEl = ref<HTMLCanvasElement | null>(null)
30
+ const strokes = ref<Point[][]>([])
31
+ const drawing = ref(false)
32
+ const empty = computed(() => strokes.value.length === 0)
33
+
34
+ function getContext() {
35
+ return canvasEl.value?.getContext('2d') ?? null
36
+ }
37
+
38
+ function redraw() {
39
+ const ctx = getContext()
40
+ const canvas = canvasEl.value
41
+ if (!ctx || !canvas) return
42
+
43
+ ctx.clearRect(0, 0, canvas.width, canvas.height)
44
+ ctx.fillStyle = props.background
45
+ ctx.fillRect(0, 0, canvas.width, canvas.height)
46
+
47
+ ctx.strokeStyle = props.color
48
+ ctx.lineWidth = props.lineWidth
49
+ ctx.lineCap = 'round'
50
+ ctx.lineJoin = 'round'
51
+
52
+ for (const stroke of strokes.value) {
53
+ if (stroke.length < 2) continue
54
+ ctx.beginPath()
55
+ ctx.moveTo(stroke[0]!.x, stroke[0]!.y)
56
+ for (const point of stroke.slice(1)) ctx.lineTo(point.x, point.y)
57
+ ctx.stroke()
58
+ }
59
+ }
60
+
61
+ function pointFromEvent(e: PointerEvent): Point {
62
+ const rect = canvasEl.value!.getBoundingClientRect()
63
+ return { x: e.clientX - rect.left, y: e.clientY - rect.top }
64
+ }
65
+
66
+ function onPointerDown(e: PointerEvent) {
67
+ if (props.disabled) return
68
+ drawing.value = true
69
+ strokes.value.push([pointFromEvent(e)])
70
+ emit('begin')
71
+ canvasEl.value?.setPointerCapture(e.pointerId)
72
+ }
73
+
74
+ function onPointerMove(e: PointerEvent) {
75
+ if (!drawing.value) return
76
+ strokes.value[strokes.value.length - 1]!.push(pointFromEvent(e))
77
+ redraw()
78
+ }
79
+
80
+ function onPointerUp() {
81
+ if (!drawing.value) return
82
+ drawing.value = false
83
+ const dataUrl = toDataURL()
84
+ emit('end', dataUrl)
85
+ emit('change', dataUrl)
86
+ }
87
+
88
+ function clear() {
89
+ strokes.value = []
90
+ redraw()
91
+ }
92
+
93
+ function undo() {
94
+ strokes.value = strokes.value.slice(0, -1)
95
+ redraw()
96
+ emit('change', toDataURL())
97
+ }
98
+
99
+ function isEmpty(): boolean {
100
+ return empty.value
101
+ }
102
+
103
+ function toDataURL(type?: string, quality?: number): string {
104
+ return canvasEl.value?.toDataURL(type, quality) ?? ''
105
+ }
106
+
107
+ watch([() => props.color, () => props.background, () => props.lineWidth], redraw)
108
+
109
+ onMounted(redraw)
110
+
111
+ defineExpose({ clear, undo, isEmpty, toDataURL })
112
+
113
+ const containerClasses = computed(() => {
114
+ if (props.variant === 'outlined') {
115
+ return 'rounded-sm border border-outline'
116
+ }
117
+ return 'rounded-t-sm bg-surface-container-highest border-b border-on-surface-variant'
118
+ })
119
+ </script>
120
+
121
+ <template>
122
+ <div
123
+ class="inline-block touch-none"
124
+ :class="[containerClasses, disabled ? 'cursor-not-allowed opacity-[0.38]' : 'cursor-crosshair']"
125
+ >
126
+ <canvas
127
+ ref="canvasEl"
128
+ :width="width"
129
+ :height="height"
130
+ role="img"
131
+ aria-label="Signature pad"
132
+ @pointerdown="onPointerDown"
133
+ @pointermove="onPointerMove"
134
+ @pointerup="onPointerUp"
135
+ @pointerleave="onPointerUp"
136
+ />
137
+ </div>
138
+ </template>
@@ -1,6 +1,9 @@
1
1
  import { inject, reactive, watchEffect, toValue, type InjectionKey, type MaybeRef } from 'vue'
2
2
 
3
3
  export interface M3Locale {
4
+ /** BCP-47 language tag (e.g. 'en', 'es', 'pt') — read by locale-aware components (MRelativeTime) that use Intl formatting. */
5
+ lang: string
6
+
4
7
  // Common
5
8
  search: string
6
9
  noResults: string
@@ -103,6 +106,8 @@ export interface M3Locale {
103
106
  }
104
107
 
105
108
  export const defaultLocale: M3Locale = {
109
+ lang: 'en',
110
+
106
111
  search: 'Search...',
107
112
  noResults: 'No results',
108
113
  close: 'Close',
package/src/index.ts CHANGED
@@ -47,6 +47,7 @@ export { default as MCommandPalette } from './components/MCommandPalette.vue'
47
47
  export { default as MConfirmDialog } from './components/MConfirmDialog.vue'
48
48
  export { default as MContainer } from './components/MContainer.vue'
49
49
  export { default as MContextMenu } from './components/MContextMenu.vue'
50
+ export { default as MCopyButton } from './components/MCopyButton.vue'
50
51
  export { default as MDataTable } from './components/MDataTable.vue'
51
52
  export { default as MDatePicker } from './components/MDatePicker.vue'
52
53
  export { default as MDatePickerModal } from './components/MDatePickerModal.vue'
@@ -60,6 +61,7 @@ export { default as MEmojiButton } from './components/MEmojiButton.vue'
60
61
  export { default as MEmojiSelector } from './components/MEmojiSelector.vue'
61
62
  export { default as MEmptyState } from './components/MEmptyState.vue'
62
63
  export { default as MExpansionPanel } from './components/MExpansionPanel.vue'
64
+ export { default as MExportButton } from './components/MExportButton.vue'
63
65
  export { default as MFab } from './components/MFab.vue'
64
66
  export { default as MFileUpload } from './components/MFileUpload.vue'
65
67
  export { default as MFixed } from './components/MFixed.vue'
@@ -74,6 +76,7 @@ export { default as MInfiniteScroll } from './components/MInfiniteScroll.vue'
74
76
  // MJsonEditor — import from '@m3ui-vue/m3ui-vue/code-editor'
75
77
  export { default as MJsonViewer } from './components/MJsonViewer.vue'
76
78
  export { default as MKanban } from './components/MKanban.vue'
79
+ export { default as MKbd } from './components/MKbd.vue'
77
80
  export { default as MList } from './components/MList.vue'
78
81
  export { default as MListItem } from './components/MListItem.vue'
79
82
  export { default as MListSubheader } from './components/MListSubheader.vue'
@@ -94,12 +97,15 @@ export { default as MNavigationDrawer } from './components/MNavigationDrawer.vue
94
97
  export { default as MNavigationRail } from './components/MNavigationRail.vue'
95
98
  export { default as MOverlay } from './components/MOverlay.vue'
96
99
  export { default as MPagination } from './components/MPagination.vue'
100
+ export { default as MPasswordMeter } from './components/MPasswordMeter.vue'
101
+ export { default as MPinInput } from './components/MPinInput.vue'
97
102
  export { default as MProgressBar } from './components/MProgressBar.vue'
98
103
  export { default as MCircleProgressBar } from './components/MCircleProgressBar.vue'
99
104
  export { default as MRadio } from './components/MRadio.vue'
100
105
  export { default as MRadioGroup } from './components/MRadioGroup.vue'
101
106
  export { default as MRating } from './components/MRating.vue'
102
107
  export { default as MRelative } from './components/MRelative.vue'
108
+ export { default as MRelativeTime } from './components/MRelativeTime.vue'
103
109
  export { default as MResponsive } from './components/MResponsive.vue'
104
110
  export { default as MResult } from './components/MResult.vue'
105
111
  // MRichTextEditor — import from '@m3ui-vue/m3ui-vue/rich-text-editor'
@@ -112,6 +118,7 @@ export type { SelectOption } from './components/MSelect.vue'
112
118
  export { default as MShader } from './components/MShader.vue'
113
119
  export type { ShaderRenderer, ShaderStatus } from './components/MShader.vue'
114
120
  export { default as MSideSheet } from './components/MSideSheet.vue'
121
+ export { default as MSignaturePad } from './components/MSignaturePad.vue'
115
122
  export { default as MSkeleton } from './components/MSkeleton.vue'
116
123
  export { default as MSlider } from './components/MSlider.vue'
117
124
  export { default as MSnackbar } from './components/MSnackbar.vue'
package/src/locales/de.ts CHANGED
@@ -1,6 +1,8 @@
1
1
  import type { M3Locale } from '../composables/useLocale'
2
2
 
3
3
  export const deLocale: M3Locale = {
4
+ lang: 'de',
5
+
4
6
  // Common
5
7
  search: 'Suchen...',
6
8
  noResults: 'Keine Ergebnisse',
package/src/locales/es.ts CHANGED
@@ -1,6 +1,8 @@
1
1
  import type { M3Locale } from '../composables/useLocale'
2
2
 
3
3
  export const esLocale: M3Locale = {
4
+ lang: 'es',
5
+
4
6
  // Common
5
7
  search: 'Buscar...',
6
8
  noResults: 'Sin resultados',
package/src/locales/fr.ts CHANGED
@@ -1,6 +1,8 @@
1
1
  import type { M3Locale } from '../composables/useLocale'
2
2
 
3
3
  export const frLocale: M3Locale = {
4
+ lang: 'fr',
5
+
4
6
  // Common
5
7
  search: 'Rechercher...',
6
8
  noResults: 'Aucun résultat',
package/src/locales/ja.ts CHANGED
@@ -1,6 +1,8 @@
1
1
  import type { M3Locale } from '../composables/useLocale'
2
2
 
3
3
  export const jaLocale: M3Locale = {
4
+ lang: 'ja',
5
+
4
6
  // Common
5
7
  search: '検索...',
6
8
  noResults: '結果なし',
package/src/locales/ko.ts CHANGED
@@ -1,6 +1,8 @@
1
1
  import type { M3Locale } from '../composables/useLocale'
2
2
 
3
3
  export const koLocale: M3Locale = {
4
+ lang: 'ko',
5
+
4
6
  // Common
5
7
  search: '검색...',
6
8
  noResults: '결과 없음',
package/src/locales/pt.ts CHANGED
@@ -1,6 +1,8 @@
1
1
  import type { M3Locale } from '../composables/useLocale'
2
2
 
3
3
  export const ptLocale: M3Locale = {
4
+ lang: 'pt',
5
+
4
6
  // Common
5
7
  search: 'Pesquisar...',
6
8
  noResults: 'Sem resultados',
package/src/locales/zh.ts CHANGED
@@ -1,6 +1,8 @@
1
1
  import type { M3Locale } from '../composables/useLocale'
2
2
 
3
3
  export const zhLocale: M3Locale = {
4
+ lang: 'zh',
5
+
4
6
  // Common
5
7
  search: '搜索...',
6
8
  noResults: '无结果',
package/src/qrcode.ts ADDED
@@ -0,0 +1 @@
1
+ export { default as MQRCode } from './components/MQRCode.vue'
@@ -1 +0,0 @@
1
- {"version":3,"file":"useLocale-QCIVDYWx.js","names":[],"sources":["../src/composables/useLocale.ts"],"sourcesContent":["import { inject, reactive, watchEffect, toValue, type InjectionKey, type MaybeRef } from 'vue'\n\nexport interface M3Locale {\n // Common\n search: string\n noResults: string\n close: string\n cancel: string\n confirm: string\n loading: 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\nexport const defaultLocale: M3Locale = {\n search: 'Search...',\n noResults: 'No results',\n close: 'Close',\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\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":";;AAwGA,IAAa,IAA0B;CACrC,QAAQ;CACR,WAAW;CACX,OAAO;CACP,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;AACd,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"}