@m3ui-vue/m3ui-vue 0.9.1 → 0.9.3

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 (139) hide show
  1. package/README.md +43 -0
  2. package/dist/API.md +266 -60
  3. package/dist/{MIcon-CaEooCmZ.js → MIcon-DLOkQduI.js} +10 -3
  4. package/dist/MIcon-DLOkQduI.js.map +1 -0
  5. package/dist/{MTextField-pJU1vFaR.js → MTextField-DKtgPymd.js} +422 -206
  6. package/dist/MTextField-DKtgPymd.js.map +1 -0
  7. package/dist/THIRD_PARTY_LICENSES.md +547 -0
  8. package/dist/api.json +1 -1
  9. package/dist/code-editor.js +2 -2
  10. package/dist/components/MBox.vue.d.ts +3 -3
  11. package/dist/components/MButton.vue.d.ts +4 -2
  12. package/dist/components/MButtonGroup.vue.d.ts +2 -0
  13. package/dist/components/MColorPicker.vue.d.ts +13 -1
  14. package/dist/components/MColorPickerModal.vue.d.ts +14 -2
  15. package/dist/components/MDragHandle.vue.d.ts +12 -0
  16. package/dist/components/MEmojiSelector.vue.d.ts +1 -1
  17. package/dist/components/MFab.vue.d.ts +5 -3
  18. package/dist/components/MFabMenu.vue.d.ts +1 -1
  19. package/dist/components/MIcon.vue.d.ts +3 -0
  20. package/dist/components/MIconButton.vue.d.ts +15 -1
  21. package/dist/components/MListItem.vue.d.ts +5 -5
  22. package/dist/components/MMenuItem.vue.d.ts +17 -4
  23. package/dist/components/MOverlay.vue.d.ts +1 -1
  24. package/dist/components/MScrollField.vue.d.ts +40 -0
  25. package/dist/components/MScrollable.vue.d.ts +9 -0
  26. package/dist/components/MSplitButton.vue.d.ts +2 -0
  27. package/dist/components/MSplitter.vue.d.ts +2 -2
  28. package/dist/components/MSwipeToDismiss.vue.d.ts +49 -0
  29. package/dist/components/MTabs.vue.d.ts +6 -0
  30. package/dist/components/MTimePickerModal.vue.d.ts +3 -0
  31. package/dist/components/MTimeScroll.vue.d.ts +22 -0
  32. package/dist/components/MToggleButton.vue.d.ts +2 -0
  33. package/dist/components/MTransition.vue.d.ts +34 -0
  34. package/dist/components/MTree.vue.d.ts +2 -2
  35. package/dist/components/MWindow.vue.d.ts +1 -1
  36. package/dist/components/_MColorPanel.vue.d.ts +18 -0
  37. package/dist/components/_MDrawerItemList.vue.d.ts +3 -0
  38. package/dist/composables/_colorUtils.d.ts +34 -0
  39. package/dist/composables/_themeColor.d.ts +1 -0
  40. package/dist/composables/_useSpring.d.ts +17 -0
  41. package/dist/composables/dynamicColor.d.ts +18 -0
  42. package/dist/composables/useColorPalette.d.ts +27 -0
  43. package/dist/composables/useLocale.d.ts +16 -0
  44. package/dist/directives/vRipple.d.ts +16 -0
  45. package/dist/emoji-names-de-BphO5XpV.js.map +1 -1
  46. package/dist/emoji-names-en-9ZvMRvzi.js.map +1 -1
  47. package/dist/emoji-names-es-DvfWU3Pj.js.map +1 -1
  48. package/dist/emoji-names-fr-B-jhUlsP.js.map +1 -1
  49. package/dist/emoji-names-ja-l8cMFJo1.js.map +1 -1
  50. package/dist/emoji-names-ko-YP-o9G0c.js.map +1 -1
  51. package/dist/emoji-names-pt-DGj_Js4M.js.map +1 -1
  52. package/dist/emoji-names-zh-Dzecwtw_.js.map +1 -1
  53. package/dist/index.d.ts +12 -1
  54. package/dist/locales/index.js +112 -0
  55. package/dist/locales/index.js.map +1 -1
  56. package/dist/m3ui-vue.css +1 -1
  57. package/dist/m3ui.js +7443 -6150
  58. package/dist/m3ui.js.map +1 -1
  59. package/dist/material-color-utilities-Cktu8DBU.js +3160 -0
  60. package/dist/material-color-utilities-Cktu8DBU.js.map +1 -0
  61. package/dist/plugin.d.ts +18 -0
  62. package/dist/rich-text-editor.js +22 -22
  63. package/dist/styles/palettes.css +546 -0
  64. package/dist/styles/theme.css +90 -0
  65. package/dist/styles.css +1 -1
  66. package/dist/terminal.js +1 -1
  67. package/dist/{useLocale-Drihe5G2.js → useLocale-Cn9MVIdw.js} +17 -1
  68. package/dist/useLocale-Cn9MVIdw.js.map +1 -0
  69. package/package.json +3 -2
  70. package/src/__tests__/MButtonGroup.test.ts +51 -0
  71. package/src/__tests__/MColorPicker.test.ts +141 -0
  72. package/src/__tests__/MDragHandle.test.ts +57 -0
  73. package/src/__tests__/MIconButton.test.ts +60 -0
  74. package/src/__tests__/MListItemShape.test.ts +76 -0
  75. package/src/__tests__/MMenuItem.test.ts +84 -0
  76. package/src/__tests__/MScrollField.test.ts +69 -0
  77. package/src/__tests__/MScrollable.test.ts +42 -0
  78. package/src/__tests__/MSwipeToDismiss.test.ts +104 -0
  79. package/src/__tests__/MTabs.test.ts +39 -0
  80. package/src/__tests__/MTimePickerModal.test.ts +52 -0
  81. package/src/__tests__/MTimeScroll.test.ts +44 -0
  82. package/src/__tests__/MTransition.test.ts +27 -0
  83. package/src/__tests__/dynamicColor.test.ts +191 -0
  84. package/src/__tests__/vRipple.test.ts +92 -0
  85. package/src/components/MBox.vue +4 -2
  86. package/src/components/MButton.vue +4 -13
  87. package/src/components/MButtonGroup.vue +118 -44
  88. package/src/components/MColorPicker.vue +114 -210
  89. package/src/components/MColorPickerModal.vue +50 -251
  90. package/src/components/MDragHandle.vue +54 -0
  91. package/src/components/MFab.vue +8 -15
  92. package/src/components/MIcon.vue +4 -2
  93. package/src/components/MIconButton.vue +96 -24
  94. package/src/components/MList.vue +33 -3
  95. package/src/components/MListItem.vue +75 -5
  96. package/src/components/MMenuItem.vue +115 -13
  97. package/src/components/MScrollField.vue +310 -0
  98. package/src/components/MScrollable.vue +160 -5
  99. package/src/components/MSplitButton.vue +5 -12
  100. package/src/components/MSplitter.vue +33 -10
  101. package/src/components/MSwipeToDismiss.vue +247 -0
  102. package/src/components/MTabs.vue +16 -5
  103. package/src/components/MTimePickerModal.vue +48 -8
  104. package/src/components/MTimeScroll.vue +161 -0
  105. package/src/components/MToggleButton.vue +5 -12
  106. package/src/components/MTransition.vue +149 -0
  107. package/src/components/_MColorPanel.vue +478 -0
  108. package/src/composables/_carouselStrategy.ts +3 -0
  109. package/src/composables/_colorUtils.ts +107 -0
  110. package/src/composables/_themeColor.ts +33 -0
  111. package/src/composables/_useSpring.ts +91 -0
  112. package/src/composables/dynamicColor.ts +85 -0
  113. package/src/composables/useColorPalette.ts +171 -25
  114. package/src/composables/useFieldBg.ts +6 -0
  115. package/src/composables/useLocale.ts +34 -0
  116. package/src/data/emoji-names/emoji-names-de.ts +1 -0
  117. package/src/data/emoji-names/emoji-names-en.ts +1 -0
  118. package/src/data/emoji-names/emoji-names-es.ts +1 -0
  119. package/src/data/emoji-names/emoji-names-fr.ts +1 -0
  120. package/src/data/emoji-names/emoji-names-ja.ts +1 -0
  121. package/src/data/emoji-names/emoji-names-ko.ts +1 -0
  122. package/src/data/emoji-names/emoji-names-pt.ts +1 -0
  123. package/src/data/emoji-names/emoji-names-zh.ts +1 -0
  124. package/src/data/emojis.ts +1 -0
  125. package/src/directives/vRipple.ts +73 -0
  126. package/src/index.ts +14 -1
  127. package/src/locales/de.ts +16 -0
  128. package/src/locales/es.ts +16 -0
  129. package/src/locales/fr.ts +16 -0
  130. package/src/locales/ja.ts +16 -0
  131. package/src/locales/ko.ts +16 -0
  132. package/src/locales/pt.ts +16 -0
  133. package/src/locales/zh.ts +16 -0
  134. package/src/plugin.ts +30 -7
  135. package/src/styles/palettes.css +546 -0
  136. package/src/styles/theme.css +90 -0
  137. package/dist/MIcon-CaEooCmZ.js.map +0 -1
  138. package/dist/MTextField-pJU1vFaR.js.map +0 -1
  139. package/dist/useLocale-Drihe5G2.js.map +0 -1
package/dist/plugin.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import type { App, MaybeRef } from 'vue';
2
2
  import type { Palette } from './composables/useColorPalette';
3
+ import type { SeedOptions } from './composables/dynamicColor';
3
4
  import type { M3Locale } from './composables/useLocale';
4
5
  export interface M3UIOptions {
5
6
  palette?: string;
@@ -19,7 +20,24 @@ export interface M3UIOptions {
19
20
  * `[data-palette='<id>'].dark { ... }` block, overriding the same tokens as `palettes.css`.
20
21
  */
21
22
  customPalettes?: Palette[];
23
+ /**
24
+ * Generate the whole color scheme (light and dark) from one color instead of using a named palette: Google's
25
+ * dynamic color, the way Android builds a theme from a wallpaper. `palette` wins when both are given, and like
26
+ * `palette` it's only the first-visit default unless `persistPalette` is `false`.
27
+ */
28
+ seed?: string;
29
+ /** How `seed` becomes a scheme: `variant` (`'tonal-spot'` by default) and `contrast` (0 standard, 0.5 medium, 1 high). */
30
+ seedOptions?: SeedOptions;
22
31
  locale?: MaybeRef<Partial<M3Locale>>;
32
+ /**
33
+ * Keep `<meta name="theme-color">` (the color phones give the browser bar and status bar) in sync with a color
34
+ * role of the active palette, following palette, seed and dark mode changes. `'surface'` matches a top app
35
+ * bar, as Material apps on Android do; any role name works (`'primary'`, `'surface-container'`…). Off by default:
36
+ * when set, the library owns that meta (it's created if missing, and a light/dark `media` pair becomes one).
37
+ * Note that Chrome and Samsung Internet on Android ignore it in a regular tab while the system is in dark
38
+ * mode (they keep their own dark bar); installed apps (PWA) still get it.
39
+ */
40
+ themeColor?: 'surface' | 'surface-container' | 'primary' | (string & {});
23
41
  }
24
42
  export declare function createM3UI(options?: M3UIOptions): {
25
43
  install(app: App): void;
@@ -1,6 +1,6 @@
1
- import { i as e } from "./useLocale-Drihe5G2.js";
2
- import { t } from "./MIcon-CaEooCmZ.js";
3
- import { a as n, n as r, o as i, r as a, t as o } from "./MTextField-pJU1vFaR.js";
1
+ import { i as e } from "./useLocale-Cn9MVIdw.js";
2
+ import { a as t, n, o as r, r as i, t as a } from "./MTextField-DKtgPymd.js";
3
+ import { t as o } from "./MIcon-DLOkQduI.js";
4
4
  import { t as s } from "./_plugin-vue_export-helper-B3ysoDQm.js";
5
5
  import { Fragment as c, computed as l, createCommentVNode as u, createElementBlock as d, createElementVNode as f, createTextVNode as p, createVNode as m, defineComponent as h, normalizeClass as g, normalizeStyle as _, onBeforeUnmount as v, onMounted as y, openBlock as b, ref as x, renderList as S, shallowRef as C, toDisplayString as w, watch as T, withCtx as E, withKeys as D } from "vue";
6
6
  //#region src/components/MRichTextEditor.vue?vue&type=script&setup=true&lang.ts
@@ -197,25 +197,25 @@ var O = {
197
197
  }
198
198
  return (e, l) => (b(), d("div", { class: g(["overflow-hidden rounded-lg border transition-colors duration-150", s.disabled ? "border-outline-variant/50 opacity-60" : "border-outline-variant focus-within:border-primary"]) }, [
199
199
  R.value ? (b(), d("div", O, [
200
- m(a, { align: "left" }, {
201
- trigger: E(() => [f("button", k, [p(w(K.value) + " ", 1), m(t, {
200
+ m(i, { align: "left" }, {
201
+ trigger: E(() => [f("button", k, [p(w(K.value) + " ", 1), m(o, {
202
202
  name: "arrow_drop_down",
203
203
  size: 20
204
204
  })])]),
205
205
  default: E(() => [
206
- m(r, { onClick: l[0] ||= (e) => q(0) }, {
206
+ m(n, { onClick: l[0] ||= (e) => q(0) }, {
207
207
  default: E(() => [p(w(I.value.paragraph), 1)]),
208
208
  _: 1
209
209
  }),
210
- m(r, { onClick: l[1] ||= (e) => q(1) }, {
210
+ m(n, { onClick: l[1] ||= (e) => q(1) }, {
211
211
  default: E(() => [p(w(I.value.heading1), 1)]),
212
212
  _: 1
213
213
  }),
214
- m(r, { onClick: l[2] ||= (e) => q(2) }, {
214
+ m(n, { onClick: l[2] ||= (e) => q(2) }, {
215
215
  default: E(() => [p(w(I.value.heading2), 1)]),
216
216
  _: 1
217
217
  }),
218
- m(r, { onClick: l[3] ||= (e) => q(3) }, {
218
+ m(n, { onClick: l[3] ||= (e) => q(3) }, {
219
219
  default: E(() => [p(w(I.value.heading3), 1)]),
220
220
  _: 1
221
221
  })
@@ -223,23 +223,23 @@ var O = {
223
223
  _: 1
224
224
  }),
225
225
  l[10] ||= f("div", { class: "mx-1 h-6 w-px bg-outline-variant" }, null, -1),
226
- (b(!0), d(c, null, S(V.value, (e, n) => (b(), d(c, { key: n }, [(b(!0), d(c, null, S(e, (e) => (b(), d("button", {
226
+ (b(!0), d(c, null, S(V.value, (e, t) => (b(), d(c, { key: t }, [(b(!0), d(c, null, S(e, (e) => (b(), d("button", {
227
227
  key: e.icon,
228
228
  type: "button",
229
229
  title: e.label,
230
230
  class: g(["flex h-8 w-8 cursor-pointer items-center justify-center rounded transition-colors duration-100", e.active?.() ? "bg-secondary-container text-on-secondary-container" : "text-on-surface-variant hover:bg-on-surface/8"]),
231
231
  onClick: e.action
232
- }, [m(t, {
232
+ }, [m(o, {
233
233
  name: e.icon,
234
234
  size: 20
235
- }, null, 8, ["name"])], 10, A))), 128)), n < V.value.length - 1 ? (b(), d("div", j)) : u("", !0)], 64))), 128)),
235
+ }, null, 8, ["name"])], 10, A))), 128)), t < V.value.length - 1 ? (b(), d("div", j)) : u("", !0)], 64))), 128)),
236
236
  l[11] ||= f("div", { class: "mx-1 h-6 w-px bg-outline-variant" }, null, -1),
237
237
  f("button", {
238
238
  type: "button",
239
239
  title: I.value.link,
240
240
  class: "flex h-8 w-8 cursor-pointer items-center justify-center rounded text-on-surface-variant transition-colors hover:bg-on-surface/8",
241
241
  onClick: J
242
- }, [m(t, {
242
+ }, [m(o, {
243
243
  name: "link",
244
244
  size: 20
245
245
  })], 8, M),
@@ -248,7 +248,7 @@ var O = {
248
248
  title: I.value.image,
249
249
  class: "flex h-8 w-8 cursor-pointer items-center justify-center rounded text-on-surface-variant transition-colors hover:bg-on-surface/8",
250
250
  onClick: X
251
- }, [m(t, {
251
+ }, [m(o, {
252
252
  name: "image",
253
253
  size: 20
254
254
  })], 8, N)
@@ -259,22 +259,22 @@ var O = {
259
259
  class: "rte-content bg-surface px-4 py-3 text-body-large text-on-surface",
260
260
  style: _({ minHeight: s.minHeight })
261
261
  }, null, 4),
262
- m(n, {
262
+ m(t, {
263
263
  modelValue: H.value,
264
264
  "onUpdate:modelValue": l[6] ||= (e) => H.value = e,
265
265
  title: I.value.insertLink
266
266
  }, {
267
- actions: E(() => [m(i, {
267
+ actions: E(() => [m(r, {
268
268
  variant: "text",
269
269
  onClick: l[5] ||= (e) => H.value = !1
270
270
  }, {
271
271
  default: E(() => [p(w(I.value.cancel), 1)]),
272
272
  _: 1
273
- }), m(i, { onClick: Y }, {
273
+ }), m(r, { onClick: Y }, {
274
274
  default: E(() => [p(w(I.value.insert), 1)]),
275
275
  _: 1
276
276
  })]),
277
- default: E(() => [m(o, {
277
+ default: E(() => [m(a, {
278
278
  modelValue: U.value,
279
279
  "onUpdate:modelValue": l[4] ||= (e) => U.value = e,
280
280
  label: "URL",
@@ -283,22 +283,22 @@ var O = {
283
283
  }, null, 8, ["modelValue"])]),
284
284
  _: 1
285
285
  }, 8, ["modelValue", "title"]),
286
- m(n, {
286
+ m(t, {
287
287
  modelValue: W.value,
288
288
  "onUpdate:modelValue": l[9] ||= (e) => W.value = e,
289
289
  title: I.value.insertImage
290
290
  }, {
291
- actions: E(() => [m(i, {
291
+ actions: E(() => [m(r, {
292
292
  variant: "text",
293
293
  onClick: l[8] ||= (e) => W.value = !1
294
294
  }, {
295
295
  default: E(() => [p(w(I.value.cancel), 1)]),
296
296
  _: 1
297
- }), m(i, { onClick: Z }, {
297
+ }), m(r, { onClick: Z }, {
298
298
  default: E(() => [p(w(I.value.insert), 1)]),
299
299
  _: 1
300
300
  })]),
301
- default: E(() => [m(o, {
301
+ default: E(() => [m(a, {
302
302
  modelValue: G.value,
303
303
  "onUpdate:modelValue": l[7] ||= (e) => G.value = e,
304
304
  label: I.value.imageUrlLabel,