mapomodule 2.0.0-beta.8 → 2.0.0-experimental.1
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 +36 -29
- package/dist/index.d.mts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.mjs +1 -0
- package/dist/module.d.mts +16 -0
- package/dist/module.d.ts +16 -0
- package/dist/module.json +1 -1
- package/dist/module.mjs +28 -3
- package/package.json +11 -9
package/README.md
CHANGED
|
@@ -1,59 +1,66 @@
|
|
|
1
1
|
# mapomodule
|
|
2
2
|
|
|
3
|
-
The Mapo meta-module:
|
|
3
|
+
The Mapo meta-module: one Nuxt module that installs the whole Mapo v2 stack and reads its configuration from the `mapo` key. Mapo is a Nuxt 4 admin framework that turns a REST backend following Django REST Framework conventions into a backoffice, declaratively.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
pnpm add mapomodule @nuxt/ui
|
|
8
|
+
pnpm add mapomodule@next @nuxt/ui
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
+
Mapo v2 is in beta and published on the `next` dist-tag; `latest` still points to Mapo v1 (Nuxt 2).
|
|
12
|
+
|
|
11
13
|
```ts
|
|
12
|
-
// nuxt.config.ts — @nuxt/ui
|
|
14
|
+
// nuxt.config.ts — register @nuxt/ui before mapomodule
|
|
13
15
|
export default defineNuxtConfig({
|
|
14
16
|
modules: ["@nuxt/ui", "mapomodule"],
|
|
15
17
|
|
|
16
18
|
mapo: {
|
|
19
|
+
// @mapomodule/core options (these are the defaults)
|
|
17
20
|
authLoginUrl: "/api/auth/login",
|
|
18
21
|
userInfoApi: "/api/profiles/me/",
|
|
19
22
|
logoutUrl: "/api/auth/logout",
|
|
20
23
|
loginUrl: "/login",
|
|
21
24
|
|
|
22
|
-
uikit: {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
form: {
|
|
28
|
-
// optional — global field registry defaults and debounce config
|
|
29
|
-
},
|
|
25
|
+
uikit: { css: "~/assets/css/theme.css" }, // theme tokens, Nuxt UI defaults, media endpoints
|
|
26
|
+
form: { debounce: 300 }, // field registry defaults
|
|
27
|
+
i18n: { defaultLocale: "en" }, // locales
|
|
28
|
+
// mcp: false, // skip the development-only MCP server
|
|
29
|
+
// ai: {}, // opt in to AI-assisted data entry (experimental)
|
|
30
30
|
},
|
|
31
31
|
});
|
|
32
32
|
```
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
Every key is optional. The app also needs an `app.vue` that wraps the page in `<UApp>` and `<NuxtLayout>`: see [Getting Started](https://lotrekagency.github.io/mapo-new/guide/getting-started).
|
|
35
35
|
|
|
36
36
|
## What it installs
|
|
37
37
|
|
|
38
|
-
|
|
|
39
|
-
| ------------------- |
|
|
40
|
-
| `@mapomodule/store` |
|
|
41
|
-
| `@mapomodule/
|
|
42
|
-
| `@mapomodule/
|
|
43
|
-
| `@mapomodule/
|
|
44
|
-
| `@mapomodule/
|
|
38
|
+
| Module | Configured under | Provides |
|
|
39
|
+
| ------------------- | ----------------------- | ---------------------------------------------------------------------------------------- |
|
|
40
|
+
| `@mapomodule/store` | — | Pinia stores (auth, snack, confirm, sidebar) and `usePermissions` |
|
|
41
|
+
| `@mapomodule/i18n` | `mapo.i18n` | `@nuxtjs/i18n` with Mapo's English and Italian catalogs |
|
|
42
|
+
| `@mapomodule/core` | `mapo` (top-level keys) | `$mapoFetch`, `useCrud`, `useMapoAuth`, the `auth`, `permissions` and `roles` middleware |
|
|
43
|
+
| `@mapomodule/uikit` | `mapo.uikit` | Layouts, sidebar, login, `MapoList`, `MapoDetail`, media and menu managers, theming |
|
|
44
|
+
| `@mapomodule/form` | `mapo.form` | The form engine and its field registry |
|
|
45
|
+
| `@mapomodule/mcp` | `mapo.mcp` | An MCP server for AI assistants, in development only |
|
|
46
|
+
| `@mapomodule/ai` | `mapo.ai` | AI-assisted data entry (experimental), installed only when `mapo.ai` is set |
|
|
45
47
|
|
|
46
|
-
|
|
48
|
+
`@mapomodule/utils`, `@nuxt/ui` and `@iconify-json/lucide` come along as dependencies. A module you register yourself in `modules` is not installed a second time, and it then reads its own config key (`mapoForm`, `mapoUikit`, …) instead of the `mapo` block.
|
|
47
49
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
50
|
+
## Types
|
|
51
|
+
|
|
52
|
+
Composables, stores and components are auto-imported. Types come from one aggregator:
|
|
53
|
+
|
|
54
|
+
```ts
|
|
55
|
+
import type { FieldDescriptor, ListColumn } from "mapomodule/types";
|
|
51
56
|
```
|
|
52
57
|
|
|
53
|
-
|
|
58
|
+
`mapomodule/types` re-exports the public types of `core`, `store`, `form`, `uikit`, `ai` and `utils`.
|
|
59
|
+
|
|
60
|
+
## Documentation
|
|
54
61
|
|
|
55
|
-
- [
|
|
56
|
-
- [
|
|
57
|
-
- [
|
|
58
|
-
- [
|
|
59
|
-
- [
|
|
62
|
+
- [Getting Started](https://lotrekagency.github.io/mapo-new/guide/getting-started)
|
|
63
|
+
- [Concepts](https://lotrekagency.github.io/mapo-new/guide/concepts): the packages, the backend contract, the form engine, the customization layers
|
|
64
|
+
- [How-to recipes](https://lotrekagency.github.io/mapo-new/howto/)
|
|
65
|
+
- [Core options](https://lotrekagency.github.io/mapo-new/modules/core#options)
|
|
66
|
+
- [Migration v1 → v2](https://lotrekagency.github.io/mapo-new/migration/v1-to-v2)
|
package/dist/index.d.mts
CHANGED
|
@@ -2,4 +2,6 @@ export * from '@mapomodule/core/types';
|
|
|
2
2
|
export * from '@mapomodule/store/types';
|
|
3
3
|
export * from '@mapomodule/form/types';
|
|
4
4
|
export * from '@mapomodule/uikit/types';
|
|
5
|
+
export * from '@mapomodule/ai/types';
|
|
5
6
|
export * from '@mapomodule/utils';
|
|
7
|
+
export { ModelPermissions } from '@mapomodule/utils';
|
package/dist/index.d.ts
CHANGED
|
@@ -2,4 +2,6 @@ export * from '@mapomodule/core/types';
|
|
|
2
2
|
export * from '@mapomodule/store/types';
|
|
3
3
|
export * from '@mapomodule/form/types';
|
|
4
4
|
export * from '@mapomodule/uikit/types';
|
|
5
|
+
export * from '@mapomodule/ai/types';
|
|
5
6
|
export * from '@mapomodule/utils';
|
|
7
|
+
export { ModelPermissions } from '@mapomodule/utils';
|
package/dist/index.mjs
CHANGED
package/dist/module.d.mts
CHANGED
|
@@ -2,12 +2,28 @@ import { NuxtModule } from '@nuxt/schema';
|
|
|
2
2
|
import { MapoOptions } from '@mapomodule/core';
|
|
3
3
|
import { MapoUikitOptions } from '@mapomodule/uikit';
|
|
4
4
|
import { MapoFormOptions } from '@mapomodule/form';
|
|
5
|
+
import { MapoI18nOptions } from '@mapomodule/i18n';
|
|
6
|
+
import { MapoMcpOptions } from '@mapomodule/mcp/types';
|
|
7
|
+
import { MapoAiOptions } from '@mapomodule/ai/types';
|
|
5
8
|
|
|
6
9
|
interface MapoModuleOptions extends MapoOptions {
|
|
7
10
|
/** Options forwarded to @mapomodule/uikit (CSS override, Nuxt UI defaults). */
|
|
8
11
|
uikit?: MapoUikitOptions;
|
|
9
12
|
/** Options forwarded to @mapomodule/form (field registry, groups, debounce). */
|
|
10
13
|
form?: MapoFormOptions;
|
|
14
|
+
/** Options forwarded to @mapomodule/i18n (default locale, extra locales). */
|
|
15
|
+
i18n?: MapoI18nOptions;
|
|
16
|
+
/**
|
|
17
|
+
* Options forwarded to @mapomodule/mcp (MCP server for AI assistants).
|
|
18
|
+
* Installed in development only; pass `false` to skip it entirely.
|
|
19
|
+
*/
|
|
20
|
+
mcp?: MapoMcpOptions | false;
|
|
21
|
+
/**
|
|
22
|
+
* Options forwarded to @mapomodule/ai (AI-assisted data entry, experimental).
|
|
23
|
+
* Opt-in: the module is installed only when this key is set, `{}` included;
|
|
24
|
+
* without it, or with `false`, nothing of the module is loaded.
|
|
25
|
+
*/
|
|
26
|
+
ai?: MapoAiOptions | false;
|
|
11
27
|
}
|
|
12
28
|
declare const _default: NuxtModule<MapoModuleOptions, MapoModuleOptions, false>;
|
|
13
29
|
|
package/dist/module.d.ts
CHANGED
|
@@ -2,12 +2,28 @@ import { NuxtModule } from '@nuxt/schema';
|
|
|
2
2
|
import { MapoOptions } from '@mapomodule/core';
|
|
3
3
|
import { MapoUikitOptions } from '@mapomodule/uikit';
|
|
4
4
|
import { MapoFormOptions } from '@mapomodule/form';
|
|
5
|
+
import { MapoI18nOptions } from '@mapomodule/i18n';
|
|
6
|
+
import { MapoMcpOptions } from '@mapomodule/mcp/types';
|
|
7
|
+
import { MapoAiOptions } from '@mapomodule/ai/types';
|
|
5
8
|
|
|
6
9
|
interface MapoModuleOptions extends MapoOptions {
|
|
7
10
|
/** Options forwarded to @mapomodule/uikit (CSS override, Nuxt UI defaults). */
|
|
8
11
|
uikit?: MapoUikitOptions;
|
|
9
12
|
/** Options forwarded to @mapomodule/form (field registry, groups, debounce). */
|
|
10
13
|
form?: MapoFormOptions;
|
|
14
|
+
/** Options forwarded to @mapomodule/i18n (default locale, extra locales). */
|
|
15
|
+
i18n?: MapoI18nOptions;
|
|
16
|
+
/**
|
|
17
|
+
* Options forwarded to @mapomodule/mcp (MCP server for AI assistants).
|
|
18
|
+
* Installed in development only; pass `false` to skip it entirely.
|
|
19
|
+
*/
|
|
20
|
+
mcp?: MapoMcpOptions | false;
|
|
21
|
+
/**
|
|
22
|
+
* Options forwarded to @mapomodule/ai (AI-assisted data entry, experimental).
|
|
23
|
+
* Opt-in: the module is installed only when this key is set, `{}` included;
|
|
24
|
+
* without it, or with `false`, nothing of the module is loaded.
|
|
25
|
+
*/
|
|
26
|
+
ai?: MapoAiOptions | false;
|
|
11
27
|
}
|
|
12
28
|
declare const _default: NuxtModule<MapoModuleOptions, MapoModuleOptions, false>;
|
|
13
29
|
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -1,16 +1,22 @@
|
|
|
1
|
-
import { defineNuxtModule, createResolver, hasNuxtModule, installModule } from '@nuxt/kit';
|
|
1
|
+
import { defineNuxtModule, createResolver, hasNuxtModule, installModule, useLogger } from '@nuxt/kit';
|
|
2
2
|
|
|
3
3
|
const module$1 = defineNuxtModule({
|
|
4
4
|
meta: {
|
|
5
5
|
name: "mapomodule",
|
|
6
6
|
configKey: "mapo"
|
|
7
7
|
},
|
|
8
|
-
async setup(options,
|
|
8
|
+
async setup(options, nuxt) {
|
|
9
9
|
const resolver = createResolver(import.meta.url);
|
|
10
10
|
if (!hasNuxtModule("@mapomodule/store")) {
|
|
11
11
|
await installModule(await resolver.resolvePath("@mapomodule/store"));
|
|
12
12
|
}
|
|
13
|
-
const { uikit, form, ...coreOptions } = options;
|
|
13
|
+
const { uikit, form, i18n, mcp, ai, ...coreOptions } = options;
|
|
14
|
+
if (!hasNuxtModule("@mapomodule/i18n")) {
|
|
15
|
+
await installModule(
|
|
16
|
+
await resolver.resolvePath("@mapomodule/i18n"),
|
|
17
|
+
i18n ?? {}
|
|
18
|
+
);
|
|
19
|
+
}
|
|
14
20
|
if (!hasNuxtModule("@mapomodule/core")) {
|
|
15
21
|
await installModule(
|
|
16
22
|
await resolver.resolvePath("@mapomodule/core"),
|
|
@@ -29,6 +35,25 @@ const module$1 = defineNuxtModule({
|
|
|
29
35
|
form ?? {}
|
|
30
36
|
);
|
|
31
37
|
}
|
|
38
|
+
const mcpEnabled = mcp !== false && (mcp?.enabled ?? nuxt.options.dev);
|
|
39
|
+
if (mcpEnabled && !hasNuxtModule("@mapomodule/mcp")) {
|
|
40
|
+
await installModule(
|
|
41
|
+
await resolver.resolvePath("@mapomodule/mcp"),
|
|
42
|
+
mcp || {}
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
const aiOptedOut = ai === false;
|
|
46
|
+
const aiConfigured = ai !== void 0;
|
|
47
|
+
const isAiListed = hasNuxtModule("@mapomodule/ai");
|
|
48
|
+
if (aiConfigured && !aiOptedOut && !isAiListed) {
|
|
49
|
+
await installModule(await resolver.resolvePath("@mapomodule/ai"), ai);
|
|
50
|
+
}
|
|
51
|
+
const hasAiOptions = typeof ai === "object" && ai !== null && Object.keys(ai).length > 0;
|
|
52
|
+
if (isAiListed && hasAiOptions) {
|
|
53
|
+
useLogger("mapomodule").warn(
|
|
54
|
+
"mapo.ai has options, but @mapomodule/ai is also listed in `modules`, so it reads `mapoAi` and the options in `mapo.ai` are not applied. Move them to `mapoAi`, or take @mapomodule/ai out of `modules`."
|
|
55
|
+
);
|
|
56
|
+
}
|
|
32
57
|
}
|
|
33
58
|
});
|
|
34
59
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mapomodule",
|
|
3
|
-
"version": "2.0.0-
|
|
3
|
+
"version": "2.0.0-experimental.1",
|
|
4
4
|
"description": "Mapo meta-package: registers and re-exports all @mapomodule/* modules",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -34,7 +34,6 @@
|
|
|
34
34
|
"scripts": {
|
|
35
35
|
"dev": "nuxt-module-build build --stub --watch",
|
|
36
36
|
"build": "nuxt-module-build build",
|
|
37
|
-
"prepack": "pnpm build",
|
|
38
37
|
"dev:prepare": "nuxt-module-build build --stub",
|
|
39
38
|
"typecheck": "tsc --noEmit",
|
|
40
39
|
"lint": "eslint src"
|
|
@@ -44,18 +43,21 @@
|
|
|
44
43
|
},
|
|
45
44
|
"dependencies": {
|
|
46
45
|
"@iconify-json/lucide": "^1.2.0",
|
|
47
|
-
"@mapomodule/
|
|
48
|
-
"@mapomodule/
|
|
49
|
-
"@mapomodule/
|
|
50
|
-
"@mapomodule/
|
|
51
|
-
"@mapomodule/
|
|
46
|
+
"@mapomodule/ai": "1.0.0-experimental.1",
|
|
47
|
+
"@mapomodule/core": "2.0.0-experimental.1",
|
|
48
|
+
"@mapomodule/form": "2.0.0-experimental.1",
|
|
49
|
+
"@mapomodule/i18n": "2.0.0-experimental.1",
|
|
50
|
+
"@mapomodule/mcp": "1.0.0-experimental.1",
|
|
51
|
+
"@mapomodule/store": "2.0.0-experimental.1",
|
|
52
|
+
"@mapomodule/uikit": "2.0.0-experimental.1",
|
|
53
|
+
"@mapomodule/utils": "2.0.0-experimental.1",
|
|
52
54
|
"@nuxt/ui": "^4.7.0"
|
|
53
55
|
},
|
|
54
56
|
"devDependencies": {
|
|
55
57
|
"@nuxt/kit": "4.4.2",
|
|
56
58
|
"@nuxt/module-builder": "^1.0.2",
|
|
57
59
|
"@nuxt/schema": "4.4.2",
|
|
58
|
-
"nuxt": "^4.
|
|
59
|
-
"vue": "^3.5.
|
|
60
|
+
"nuxt": "^4.5.1",
|
|
61
|
+
"vue": "^3.5.40"
|
|
60
62
|
}
|
|
61
63
|
}
|