@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.
Files changed (120) hide show
  1. package/README.md +13 -3
  2. package/dist/{MMenuItem-DmrsQrK7.js → MTextField-B0wGv1Mx.js} +374 -364
  3. package/dist/MTextField-B0wGv1Mx.js.map +1 -0
  4. package/dist/barcode.js +9 -11
  5. package/dist/barcode.js.map +1 -1
  6. package/dist/code-editor.js +2 -2
  7. package/dist/code-editor.js.map +1 -1
  8. package/dist/components/MCarousel.vue.d.ts +55 -36
  9. package/dist/components/MDialog.vue.d.ts +4 -2
  10. package/dist/components/MEmojiSelector.vue.d.ts +21 -5
  11. package/dist/components/MFabMenu.vue.d.ts +1 -1
  12. package/dist/components/MFlex.vue.d.ts +1 -1
  13. package/dist/components/MLightbox.vue.d.ts +15 -5
  14. package/dist/components/MScheduler.vue.d.ts +38 -1
  15. package/dist/components/MShape.vue.d.ts +1 -1
  16. package/dist/components/MSimpleCarousel.vue.d.ts +2 -2
  17. package/dist/components/MSlider.vue.d.ts +1 -1
  18. package/dist/components/MStack.vue.d.ts +1 -1
  19. package/dist/components/MToolbar.vue.d.ts +1 -1
  20. package/dist/components/MWindow.vue.d.ts +1 -1
  21. package/dist/composables/_carouselStrategy.d.ts +101 -0
  22. package/dist/composables/useLocale.d.ts +23 -0
  23. package/dist/data/emoji-names/emoji-names-de.d.ts +2 -0
  24. package/dist/data/emoji-names/emoji-names-en.d.ts +2 -0
  25. package/dist/data/emoji-names/emoji-names-es.d.ts +2 -0
  26. package/dist/data/emoji-names/emoji-names-fr.d.ts +2 -0
  27. package/dist/data/emoji-names/emoji-names-ja.d.ts +2 -0
  28. package/dist/data/emoji-names/emoji-names-ko.d.ts +2 -0
  29. package/dist/data/emoji-names/emoji-names-pt.d.ts +2 -0
  30. package/dist/data/emoji-names/emoji-names-zh.d.ts +2 -0
  31. package/dist/data/emojis.d.ts +7 -1
  32. package/dist/emoji-names-de-BphO5XpV.js +1877 -0
  33. package/dist/emoji-names-de-BphO5XpV.js.map +1 -0
  34. package/dist/emoji-names-en-9ZvMRvzi.js +1877 -0
  35. package/dist/emoji-names-en-9ZvMRvzi.js.map +1 -0
  36. package/dist/emoji-names-es-DvfWU3Pj.js +1877 -0
  37. package/dist/emoji-names-es-DvfWU3Pj.js.map +1 -0
  38. package/dist/emoji-names-fr-B-jhUlsP.js +1877 -0
  39. package/dist/emoji-names-fr-B-jhUlsP.js.map +1 -0
  40. package/dist/emoji-names-ja-l8cMFJo1.js +1877 -0
  41. package/dist/emoji-names-ja-l8cMFJo1.js.map +1 -0
  42. package/dist/emoji-names-ko-YP-o9G0c.js +1877 -0
  43. package/dist/emoji-names-ko-YP-o9G0c.js.map +1 -0
  44. package/dist/emoji-names-pt-DGj_Js4M.js +1877 -0
  45. package/dist/emoji-names-pt-DGj_Js4M.js.map +1 -0
  46. package/dist/emoji-names-zh-Dzecwtw_.js +1877 -0
  47. package/dist/emoji-names-zh-Dzecwtw_.js.map +1 -0
  48. package/dist/index.d.ts +2 -2
  49. package/dist/locales/index.js +168 -7
  50. package/dist/locales/index.js.map +1 -1
  51. package/dist/m3ui-vue.css +1 -1
  52. package/dist/m3ui.js +3926 -2430
  53. package/dist/m3ui.js.map +1 -1
  54. package/dist/plugin.d.ts +6 -0
  55. package/dist/rich-text-editor.js +9 -9
  56. package/dist/styles.css +1 -1
  57. package/dist/terminal.js +34 -27
  58. package/dist/terminal.js.map +1 -1
  59. package/dist/{useLocale-Bircp823.js → useLocale-CmI675Ab.js} +25 -2
  60. package/dist/useLocale-CmI675Ab.js.map +1 -0
  61. package/package.json +1 -1
  62. package/src/__tests__/MCarousel.test.ts +183 -21
  63. package/src/__tests__/MDialog.test.ts +18 -0
  64. package/src/__tests__/MEmojiSelector.test.ts +138 -0
  65. package/src/__tests__/MLightbox.test.ts +313 -5
  66. package/src/__tests__/MPagination.test.ts +37 -0
  67. package/src/__tests__/MPullToRefresh.test.ts +39 -0
  68. package/src/__tests__/MScheduler.test.ts +122 -0
  69. package/src/__tests__/MTerminal.test.ts +63 -0
  70. package/src/__tests__/attrsFallthrough.test.ts +65 -0
  71. package/src/__tests__/plugin.test.ts +28 -1
  72. package/src/components/MBarcode.vue +4 -2
  73. package/src/components/MBottomSheet.vue +1 -1
  74. package/src/components/MCarousel.vue +526 -200
  75. package/src/components/MCodeEditor.vue +3 -2
  76. package/src/components/MCommandPalette.vue +1 -1
  77. package/src/components/MContextMenu.vue +3 -1
  78. package/src/components/MDatePickerModal.vue +1 -1
  79. package/src/components/MDateRangePickerModal.vue +1 -1
  80. package/src/components/MDialog.vue +19 -6
  81. package/src/components/MEmojiSelector.vue +479 -78
  82. package/src/components/MFab.vue +3 -1
  83. package/src/components/MLightbox.vue +750 -268
  84. package/src/components/MLoadingOverlay.vue +6 -1
  85. package/src/components/MMenu.vue +3 -1
  86. package/src/components/MNavigationDrawer.vue +5 -1
  87. package/src/components/MNavigationRail.vue +8 -2
  88. package/src/components/MOverlay.vue +1 -0
  89. package/src/components/MPagination.vue +8 -5
  90. package/src/components/MPullToRefresh.vue +13 -1
  91. package/src/components/MScheduler.vue +282 -115
  92. package/src/components/MSideSheet.vue +1 -1
  93. package/src/components/MSplitButton.vue +3 -1
  94. package/src/components/MSpotlightSearch.vue +1 -1
  95. package/src/components/MTerminal.vue +22 -10
  96. package/src/components/MTimePickerModal.vue +1 -1
  97. package/src/components/MTooltip.vue +3 -0
  98. package/src/components/MTour.vue +2 -2
  99. package/src/composables/_carouselStrategy.ts +712 -0
  100. package/src/composables/useLocale.ts +48 -0
  101. package/src/data/emoji-names/emoji-names-de.ts +1875 -0
  102. package/src/data/emoji-names/emoji-names-en.ts +1875 -0
  103. package/src/data/emoji-names/emoji-names-es.ts +1875 -0
  104. package/src/data/emoji-names/emoji-names-fr.ts +1875 -0
  105. package/src/data/emoji-names/emoji-names-ja.ts +1875 -0
  106. package/src/data/emoji-names/emoji-names-ko.ts +1875 -0
  107. package/src/data/emoji-names/emoji-names-pt.ts +1875 -0
  108. package/src/data/emoji-names/emoji-names-zh.ts +1875 -0
  109. package/src/data/emojis.ts +29 -198
  110. package/src/index.ts +2 -2
  111. package/src/locales/de.ts +24 -0
  112. package/src/locales/es.ts +24 -0
  113. package/src/locales/fr.ts +24 -0
  114. package/src/locales/ja.ts +24 -0
  115. package/src/locales/ko.ts +24 -0
  116. package/src/locales/pt.ts +24 -0
  117. package/src/locales/zh.ts +24 -0
  118. package/src/plugin.ts +12 -1
  119. package/dist/MMenuItem-DmrsQrK7.js.map +0 -1
  120. package/dist/useLocale-Bircp823.js.map +0 -1
@@ -256,7 +256,6 @@ onBeforeUnmount(() => view?.destroy())
256
256
  flex: 1;
257
257
  min-height: 0;
258
258
  font-size: 0.8125rem;
259
- line-height: 1.6;
260
259
  }
261
260
 
262
261
  .code-editor-container :deep(.cm-editor.cm-focused) {
@@ -277,8 +276,10 @@ onBeforeUnmount(() => view?.destroy())
277
276
  the first place. */
278
277
  align-items: stretch !important;
279
278
  /* Set here, not on .cm-editor: CodeMirror's base theme declares
280
- font-family: monospace on .cm-scroller itself, which beats inheritance */
279
+ font-family: monospace and line-height: 1.4 on .cm-scroller itself,
280
+ which beats inheritance */
281
281
  font-family: var(--font-mono, 'Roboto Mono', monospace);
282
+ line-height: 1.6;
282
283
  }
283
284
 
284
285
  .code-editor-container :deep(.cm-content) {
@@ -130,7 +130,7 @@ onBeforeUnmount(() => document.removeEventListener('keydown', onGlobalKeydown))
130
130
 
131
131
  <template>
132
132
  <Teleport to="body">
133
- <Transition name="m3-cmd">
133
+ <Transition name="m3-cmd" appear>
134
134
  <div
135
135
  v-if="modelValue"
136
136
  class="fixed inset-0 z-50 flex items-start justify-center bg-scrim/32 pt-[15vh]"
@@ -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
  /**
@@ -337,7 +339,7 @@ onUnmounted(() => {
337
339
  </script>
338
340
 
339
341
  <template>
340
- <div @contextmenu="show">
342
+ <div v-bind="$attrs" @contextmenu="show">
341
343
  <slot name="trigger" />
342
344
  </div>
343
345
 
@@ -157,7 +157,7 @@ function onKeydown(e: KeyboardEvent) { if (e.key === 'Escape') cancel() }
157
157
 
158
158
  <template>
159
159
  <Teleport to="body">
160
- <Transition name="m3-dp-modal">
160
+ <Transition name="m3-dp-modal" appear>
161
161
  <div
162
162
  v-if="show"
163
163
  class="fixed inset-0 z-50 flex items-center justify-center bg-scrim/32 p-4"
@@ -161,7 +161,7 @@ function onKeydown(e: KeyboardEvent) { if (e.key === 'Escape') cancel() }
161
161
 
162
162
  <template>
163
163
  <Teleport to="body">
164
- <Transition name="m3-drp-modal">
164
+ <Transition name="m3-drp-modal" appear>
165
165
  <div
166
166
  v-if="show"
167
167
  class="fixed inset-0 z-50 flex items-center justify-center bg-scrim/32 p-4"
@@ -1,5 +1,5 @@
1
1
  <script setup lang="ts">
2
- import { nextTick, onUnmounted, ref, watch } from 'vue'
2
+ import { computed, nextTick, onUnmounted, ref, watch } from 'vue'
3
3
  import MIconButton from './MIconButton.vue'
4
4
  import { useLocale } from '../composables/useLocale'
5
5
 
@@ -7,10 +7,12 @@ const props = withDefaults(
7
7
  defineProps<{
8
8
  modelValue: boolean
9
9
  title?: string
10
+ /** A Tailwind class (`max-w-sm`) or a CSS value (`420px`, `min(90vw, 40rem)`). */
10
11
  maxWidth?: string
11
12
  /**
12
- * M3's `AlertDialogDefaults` has no max-height token at all (only `DialogMaxWidth`) — the
13
- * default here is a library-chosen viewport-relative cap, not a spec value.
13
+ * A Tailwind class (`max-h-[80vh]`) or a CSS value (`600px`). M3's `AlertDialogDefaults` has
14
+ * no max-height token at all (only `DialogMaxWidth`) — the default here is a library-chosen
15
+ * viewport-relative cap, not a spec value.
14
16
  */
15
17
  maxHeight?: string
16
18
  persistent?: boolean
@@ -36,6 +38,15 @@ const props = withDefaults(
36
38
 
37
39
  const locale = useLocale()
38
40
 
41
+ // maxWidth/maxHeight take either a Tailwind class or a CSS value: a bare length or a CSS function
42
+ // can't be a class, so those go to inline style instead.
43
+ const isCssValue = (v: string) => /^-?[\d.]+[a-z%]*$|^(calc|min|max|clamp|var)\(/i.test(v.trim())
44
+ const sizeClasses = computed(() => [props.maxWidth, props.maxHeight].filter((v) => !isCssValue(v)))
45
+ const sizeStyle = computed(() => ({
46
+ ...(isCssValue(props.maxWidth) ? { maxWidth: props.maxWidth } : {}),
47
+ ...(isCssValue(props.maxHeight) ? { maxHeight: props.maxHeight } : {}),
48
+ }))
49
+
39
50
  const emit = defineEmits<{ 'update:modelValue': [boolean] }>()
40
51
 
41
52
  function close() {
@@ -95,7 +106,8 @@ onUnmounted(() => {
95
106
  <template>
96
107
  <Teleport to="body">
97
108
  <!-- Basic dialog -->
98
- <Transition v-if="!fullscreen" name="m3-dialog">
109
+ <!-- appear: a dialog mounted already open (v-if + modelValue in the same tick) animates in too -->
110
+ <Transition v-if="!fullscreen" name="m3-dialog" appear>
99
111
  <div
100
112
  v-if="modelValue"
101
113
  class="fixed inset-0 z-50 flex items-center justify-center bg-scrim/32 p-4"
@@ -103,7 +115,8 @@ onUnmounted(() => {
103
115
  >
104
116
  <div
105
117
  class="dialog-box flex min-w-[280px] w-full flex-col rounded-xl bg-surface-container-high shadow-elevation-3"
106
- :class="[maxWidth, maxHeight]"
118
+ :class="sizeClasses"
119
+ :style="sizeStyle"
107
120
  >
108
121
  <!--
109
122
  AlertDialogDefaults.dialogPadding is 24dp on all four sides of the whole content
@@ -167,7 +180,7 @@ onUnmounted(() => {
167
180
  </Transition>
168
181
 
169
182
  <!-- Fullscreen dialog -->
170
- <Transition v-else name="m3-dialog-fs">
183
+ <Transition v-else name="m3-dialog-fs" appear>
171
184
  <div
172
185
  v-if="modelValue"
173
186
  class="dialog-fs fixed inset-0 z-50 flex flex-col bg-surface"