@m3ui-vue/nuxt 0.2.3 → 0.2.4

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 CHANGED
@@ -67,8 +67,8 @@ const toast = useM3Toast()
67
67
  ```
68
68
 
69
69
  Each component is bundled only where it's used. `MChart`, `MCodeEditor`, `MJsonEditor`, `MMarkdown`,
70
- `MRichTextEditor`, `MTerminal`, `MQRCode` and `MBarcode` are registered when their optional dependency is installed
71
- (see the library's README).
70
+ `MRichTextEditor`, `MTerminal`, `MQRCode`, `MBarcode` and the `MMap` family are registered when their optional
71
+ dependency is installed (see the library's README); so are `useMap`, `useMapLayers` and `useMapFilter`.
72
72
 
73
73
  The composables are prefixed so they can't clash with other modules (`useDevice`, `useTheme`… are common names):
74
74
 
@@ -81,7 +81,10 @@ The composables are prefixed so they can't clash with other modules (`useDevice`
81
81
  | `useLocale` | `useM3Locale` |
82
82
  | `useDevice` | `useM3Device` |
83
83
  | `useWindowSizeClass` | `useM3WindowSizeClass` |
84
+ | `useConfetti` | `useM3Confetti` |
85
+ | `useContainerTransform` | `useM3ContainerTransform` |
84
86
  | `useFieldBg`, `useDebounce`, `usePageProgress`, `useSpring` | `useM3FieldBg`, `useM3Debounce`, `useM3PageProgress`, `useM3Spring` |
87
+ | `useMap`, `useMapLayers`, `useMapFilter` (with `maplibre-gl`) | `useM3Map`, `useM3MapLayers`, `useM3MapFilter` |
85
88
 
86
89
  Anything else (types, `palettes`, `motionSprings`…) is imported from `@m3ui-vue/m3ui-vue` as usual.
87
90
 
package/dist/module.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "compatibility": {
5
5
  "nuxt": ">=3.0.0"
6
6
  },
7
- "version": "0.2.3",
7
+ "version": "0.2.4",
8
8
  "builder": {
9
9
  "@nuxt/module-builder": "1.0.3",
10
10
  "unbuild": "unknown"
package/dist/module.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { readFileSync } from 'node:fs';
2
2
  import { join, dirname } from 'node:path';
3
- import { defineNuxtModule, useLogger, createResolver, resolvePath, tryResolveModule, addComponent, addImports, hasNuxtModule, addTemplate, addTypeTemplate, addPlugin } from '@nuxt/kit';
3
+ import { defineNuxtModule, useLogger, createResolver, resolvePath, addComponent, addImports, hasNuxtModule, addTemplate, addTypeTemplate, addPlugin, tryResolveModule } from '@nuxt/kit';
4
4
 
5
5
  const LIB = "@m3ui-vue/m3ui-vue";
6
6
  const LOCALE_PRESETS = { es: "esLocale", fr: "frLocale", pt: "ptLocale", de: "deLocale", ja: "jaLocale", zh: "zhLocale", ko: "koLocale" };
@@ -11,7 +11,8 @@ const OPTIONAL_ENTRIES = {
11
11
  [`${LIB}/rich-text-editor`]: "@tiptap/vue-3",
12
12
  [`${LIB}/terminal`]: "@xterm/xterm",
13
13
  [`${LIB}/qrcode`]: "qrcode-generator",
14
- [`${LIB}/barcode`]: "jsbarcode"
14
+ [`${LIB}/barcode`]: "jsbarcode",
15
+ [`${LIB}/map`]: "maplibre-gl"
15
16
  };
16
17
  const module$1 = defineNuxtModule({
17
18
  meta: {
@@ -38,16 +39,26 @@ const module$1 = defineNuxtModule({
38
39
  logger.error(`Couldn't read ${LIB}'s dist/api.json: is ${LIB} installed?`);
39
40
  return;
40
41
  }
42
+ const available = /* @__PURE__ */ new Map();
43
+ const isAvailable = async (from) => {
44
+ const peer = OPTIONAL_ENTRIES[from];
45
+ if (!peer) return true;
46
+ if (!available.has(from)) available.set(from, !!await tryResolveModule(peer, nuxt.options.modulesDir));
47
+ return available.get(from);
48
+ };
41
49
  if (components) {
42
50
  for (const component of api.components) {
43
- const peer = OPTIONAL_ENTRIES[component.import];
44
- if (peer && !await tryResolveModule(peer, nuxt.options.modulesDir)) continue;
51
+ if (!await isAvailable(component.import)) continue;
45
52
  addComponent({ name: component.name, export: component.name, filePath: component.import });
46
53
  }
47
54
  }
48
55
  if (composables) {
49
56
  const prefix = typeof composables === "object" ? composables.prefix ?? "" : "M3";
50
- addImports(api.values.filter((value) => /^use[A-Z]/.test(value.name)).map((value) => ({ name: value.name, as: `use${prefix}${value.name.slice(3)}`, from: value.import })));
57
+ const values = [];
58
+ for (const value of api.values) {
59
+ if (/^use[A-Z]/.test(value.name) && await isAvailable(value.import)) values.push(value);
60
+ }
61
+ addImports(values.map((value) => ({ name: value.name, as: `use${prefix}${value.name.slice(3)}`, from: value.import })));
51
62
  }
52
63
  if (css) nuxt.options.css.push(`${LIB}/styles`);
53
64
  const auto = locale === "auto";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@m3ui-vue/nuxt",
3
- "version": "0.2.3",
3
+ "version": "0.2.4",
4
4
  "description": "Nuxt module for m3ui-vue, the Material Design 3 component library for Vue 3 + Tailwind CSS v4",
5
5
  "keywords": [
6
6
  "nuxt",
@@ -16,6 +16,7 @@
16
16
  "type": "git",
17
17
  "url": "git+https://github.com/SrWither/m3ui-vue-nuxt.git"
18
18
  },
19
+ "funding": "https://github.com/sponsors/SrWither",
19
20
  "license": "MIT",
20
21
  "type": "module",
21
22
  "exports": {