@m3ui-vue/m3ui-vue 0.8.8 → 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 (116) hide show
  1. package/README.md +13 -3
  2. package/dist/{MMenuItem-5xojJYAL.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 +19 -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 +140 -7
  50. package/dist/locales/index.js.map +1 -1
  51. package/dist/m3ui-vue.css +1 -1
  52. package/dist/m3ui.js +3885 -2400
  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-D3ZWZ8jY.js → useLocale-CmI675Ab.js} +21 -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__/MScheduler.test.ts +122 -0
  67. package/src/__tests__/MTerminal.test.ts +63 -0
  68. package/src/__tests__/attrsFallthrough.test.ts +65 -0
  69. package/src/__tests__/plugin.test.ts +28 -1
  70. package/src/components/MBarcode.vue +4 -2
  71. package/src/components/MBottomSheet.vue +1 -1
  72. package/src/components/MCarousel.vue +526 -200
  73. package/src/components/MCodeEditor.vue +3 -2
  74. package/src/components/MCommandPalette.vue +1 -1
  75. package/src/components/MContextMenu.vue +3 -1
  76. package/src/components/MDatePickerModal.vue +1 -1
  77. package/src/components/MDateRangePickerModal.vue +1 -1
  78. package/src/components/MDialog.vue +19 -6
  79. package/src/components/MEmojiSelector.vue +479 -78
  80. package/src/components/MFab.vue +3 -1
  81. package/src/components/MLightbox.vue +750 -268
  82. package/src/components/MLoadingOverlay.vue +6 -1
  83. package/src/components/MMenu.vue +3 -1
  84. package/src/components/MNavigationDrawer.vue +5 -1
  85. package/src/components/MNavigationRail.vue +3 -0
  86. package/src/components/MOverlay.vue +1 -0
  87. package/src/components/MScheduler.vue +282 -115
  88. package/src/components/MSideSheet.vue +1 -1
  89. package/src/components/MSplitButton.vue +3 -1
  90. package/src/components/MSpotlightSearch.vue +1 -1
  91. package/src/components/MTerminal.vue +22 -10
  92. package/src/components/MTimePickerModal.vue +1 -1
  93. package/src/components/MTooltip.vue +3 -0
  94. package/src/components/MTour.vue +2 -2
  95. package/src/composables/_carouselStrategy.ts +712 -0
  96. package/src/composables/useLocale.ts +38 -0
  97. package/src/data/emoji-names/emoji-names-de.ts +1875 -0
  98. package/src/data/emoji-names/emoji-names-en.ts +1875 -0
  99. package/src/data/emoji-names/emoji-names-es.ts +1875 -0
  100. package/src/data/emoji-names/emoji-names-fr.ts +1875 -0
  101. package/src/data/emoji-names/emoji-names-ja.ts +1875 -0
  102. package/src/data/emoji-names/emoji-names-ko.ts +1875 -0
  103. package/src/data/emoji-names/emoji-names-pt.ts +1875 -0
  104. package/src/data/emoji-names/emoji-names-zh.ts +1875 -0
  105. package/src/data/emojis.ts +29 -198
  106. package/src/index.ts +2 -2
  107. package/src/locales/de.ts +19 -0
  108. package/src/locales/es.ts +19 -0
  109. package/src/locales/fr.ts +19 -0
  110. package/src/locales/ja.ts +19 -0
  111. package/src/locales/ko.ts +19 -0
  112. package/src/locales/pt.ts +19 -0
  113. package/src/locales/zh.ts +19 -0
  114. package/src/plugin.ts +12 -1
  115. package/dist/MMenuItem-5xojJYAL.js.map +0 -1
  116. package/dist/useLocale-D3ZWZ8jY.js.map +0 -1
@@ -144,7 +144,7 @@ onBeforeUnmount(() => {
144
144
 
145
145
  <template>
146
146
  <Teleport to="body">
147
- <Transition name="m3-spot">
147
+ <Transition name="m3-spot" appear>
148
148
  <div
149
149
  v-if="modelValue"
150
150
  class="fixed inset-0 z-50 flex items-start justify-center bg-scrim/32 pt-[12vh]"
@@ -38,8 +38,10 @@ function writeLines(lines: string[]) {
38
38
  })
39
39
  }
40
40
 
41
+ // xterm draws on a canvas, so it can't use the CSS variables directly: read them (from the
42
+ // container, so a palette set on an ancestor applies too) and hand xterm plain colors.
41
43
  function getThemeColors() {
42
- const style = getComputedStyle(document.documentElement)
44
+ const style = getComputedStyle(containerRef.value ?? document.documentElement)
43
45
  return {
44
46
  background: style.getPropertyValue('--color-surface-container-lowest').trim() || '#0f0d13',
45
47
  foreground: style.getPropertyValue('--color-on-surface').trim() || '#e6e1e5',
@@ -49,6 +51,14 @@ function getThemeColors() {
49
51
  }
50
52
  }
51
53
 
54
+ // Theme (.dark) and palette (data-palette) changes don't reach the canvas on their own: re-read
55
+ // the colors whenever <html> changes, like useFieldBg does.
56
+ let themeObserver: MutationObserver | null = null
57
+ let unmounted = false
58
+ function applyTheme() {
59
+ if (terminal) terminal.options.theme = getThemeColors()
60
+ }
61
+
52
62
  onMounted(async () => {
53
63
  if (!containerRef.value) return
54
64
 
@@ -58,8 +68,8 @@ onMounted(async () => {
58
68
  ])
59
69
 
60
70
  try { await import('@xterm/xterm/css/xterm.css') } catch { /* consumer will provide styles */ }
61
-
62
- const colors = getThemeColors()
71
+ // Unmounted while xterm was loading: don't create a terminal (and observers) nobody will dispose.
72
+ if (unmounted || !containerRef.value) return
63
73
 
64
74
  terminal = new xtermMod.Terminal({
65
75
  fontFamily: "'JetBrains Mono', 'Fira Code', 'Consolas', monospace",
@@ -67,13 +77,7 @@ onMounted(async () => {
67
77
  lineHeight: 1.4,
68
78
  cursorBlink: !props.readonly,
69
79
  disableStdin: props.readonly,
70
- theme: {
71
- background: colors.background,
72
- foreground: colors.foreground,
73
- cursor: colors.cursor,
74
- cursorAccent: colors.cursorAccent,
75
- selectionBackground: colors.selectionBackground,
76
- },
80
+ theme: getThemeColors(),
77
81
  scrollback: 1000,
78
82
  convertEol: true,
79
83
  })
@@ -110,6 +114,12 @@ onMounted(async () => {
110
114
  try { fitAddon?.fit() } catch { /* ignore */ }
111
115
  })
112
116
  resizeObserver.observe(containerRef.value)
117
+
118
+ themeObserver = new MutationObserver(applyTheme)
119
+ themeObserver.observe(document.documentElement, {
120
+ attributes: true,
121
+ attributeFilter: ['class', 'style', 'data-theme', 'data-palette'],
122
+ })
113
123
  })
114
124
 
115
125
  watch(() => props.lines, (newLines) => {
@@ -119,7 +129,9 @@ watch(() => props.lines, (newLines) => {
119
129
  })
120
130
 
121
131
  onBeforeUnmount(() => {
132
+ unmounted = true
122
133
  resizeObserver?.disconnect()
134
+ themeObserver?.disconnect()
123
135
  terminal?.dispose()
124
136
  })
125
137
 
@@ -234,7 +234,7 @@ function onKeydown(e: KeyboardEvent) { if (e.key === 'Escape') cancel() }
234
234
 
235
235
  <template>
236
236
  <Teleport to="body">
237
- <Transition name="m3-tp-modal">
237
+ <Transition name="m3-tp-modal" appear>
238
238
  <div
239
239
  v-if="show"
240
240
  class="fixed inset-0 z-50 flex items-center justify-center bg-scrim/32 p-4"
@@ -1,6 +1,8 @@
1
1
  <script setup lang="ts">
2
2
  import { nextTick, onMounted, onUnmounted, ref } from 'vue'
3
3
 
4
+ defineOptions({ inheritAttrs: false })
5
+
4
6
  const props = withDefaults(defineProps<{
5
7
  text?: string
6
8
  placement?: 'top' | 'bottom' | 'left' | 'right'
@@ -85,6 +87,7 @@ onUnmounted(() => {
85
87
  <template>
86
88
  <span
87
89
  ref="triggerEl"
90
+ v-bind="$attrs"
88
91
  class="inline-flex"
89
92
  @mouseenter="show"
90
93
  @mouseleave="hide"
@@ -192,12 +192,12 @@ onBeforeUnmount(() => { stopListeners(); clearHighlight() })
192
192
  <template>
193
193
  <Teleport to="body">
194
194
  <!-- Overlay -->
195
- <Transition name="m3-tour">
195
+ <Transition name="m3-tour" appear>
196
196
  <div v-if="modelValue && step" class="fixed inset-0 z-200 bg-scrim/32" @click="close" />
197
197
  </Transition>
198
198
 
199
199
  <!-- Tooltip -->
200
- <Transition name="m3-tour">
200
+ <Transition name="m3-tour" appear>
201
201
  <div
202
202
  v-if="modelValue && step"
203
203
  class="fixed z-202 w-80 max-w-[calc(100vw-1rem)] rounded-xl bg-surface-container-high p-5 shadow-elevation-3"