mapomodule 2.0.0-beta.2 → 2.0.0-beta.21

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
@@ -1,59 +1,64 @@
1
1
  # mapomodule
2
2
 
3
- The Mapo meta-module: a single Nuxt module that registers the entire Mapo stack with one entry in `nuxt.config.ts`.
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 MUST come before mapomodule
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
- css: "~/assets/css/theme.css", // optional CSS token override
24
- ui: { button: { defaultVariants: { color: "primary" } } }, // optional Nuxt UI defaults
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
30
29
  },
31
30
  });
32
31
  ```
33
32
 
34
- All options are optional and fall back to `MAPO_DEFAULTS`.
33
+ 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
34
 
36
35
  ## What it installs
37
36
 
38
- | Package | Status |
39
- | ------------------- | ------------------------------------------------------------------------ |
40
- | `@mapomodule/store` | ✅ Pinia stores |
41
- | `@mapomodule/core` | ✅ Service layer (forwards `mapo` config) |
42
- | `@mapomodule/uikit` | ✅ UI shell + theming + MapoOverride system + List engine + Detail shell |
43
- | `@mapomodule/form` | ✅ Form engine (`MapoForm`, `MapoDetail`, `useMapoForm`, field types) |
44
- | `@mapomodule/i18n` | 🔲 Planned |
37
+ | Module | Configured under | Provides |
38
+ | ------------------- | ----------------------- | ---------------------------------------------------------------------------------------- |
39
+ | `@mapomodule/store` | — | Pinia stores (auth, snack, confirm, sidebar) and `usePermissions` |
40
+ | `@mapomodule/i18n` | `mapo.i18n` | `@nuxtjs/i18n` with Mapo's English and Italian catalogs |
41
+ | `@mapomodule/core` | `mapo` (top-level keys) | `$mapoFetch`, `useCrud`, `useMapoAuth`, the `auth`, `permissions` and `roles` middleware |
42
+ | `@mapomodule/uikit` | `mapo.uikit` | Layouts, sidebar, login, `MapoList`, `MapoDetail`, media and menu managers, theming |
43
+ | `@mapomodule/form` | `mapo.form` | The form engine and its field registry |
44
+ | `@mapomodule/mcp` | `mapo.mcp` | An MCP server for AI assistants, in development only |
45
45
 
46
- ## Dev workflow
46
+ `@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
47
 
48
- ```bash
49
- # watch mode — rebuilds dist/ on src/ changes
50
- pnpm dev:mapomodule # from monorepo root
48
+ ## Types
49
+
50
+ Composables, stores and components are auto-imported. Types come from one aggregator:
51
+
52
+ ```ts
53
+ import type { FieldDescriptor, ListColumn } from "mapomodule/types";
51
54
  ```
52
55
 
53
- ## Reference
56
+ `mapomodule/types` re-exports the public types of `core`, `store`, `form`, `uikit` and `utils`.
57
+
58
+ ## Documentation
54
59
 
55
- - [`@mapomodule/core`](../@mapomodule/core/) — CRUD, auth, middleware
56
- - [`@mapomodule/store`](../@mapomodule/store/) — Pinia stores
57
- - [`@mapomodule/uikit`](../@mapomodule/uikit/) — UI shell, theming, MapoOverride, List engine, MapoDetail
58
- - [`@mapomodule/form`](../@mapomodule/form/) — form engine, field types, `useMapoForm`
59
- - [docs/modules/core](../../docs/modules/core.md) — full config reference
60
+ - [Getting Started](https://lotrekagency.github.io/mapo-new/guide/getting-started)
61
+ - [Concepts](https://lotrekagency.github.io/mapo-new/guide/concepts): the packages, the backend contract, the form engine, the customization layers
62
+ - [How-to recipes](https://lotrekagency.github.io/mapo-new/howto/)
63
+ - [Core options](https://lotrekagency.github.io/mapo-new/modules/core#options)
64
+ - [Migration v1 → v2](https://lotrekagency.github.io/mapo-new/migration/v1-to-v2)
package/dist/index.d.mts CHANGED
@@ -1 +1,5 @@
1
- export * from "/home/runner/work/mapo-new/mapo-new/packages/mapomodule/src/index.js";
1
+ export * from '@mapomodule/core/types';
2
+ export * from '@mapomodule/store/types';
3
+ export * from '@mapomodule/form/types';
4
+ export * from '@mapomodule/uikit/types';
5
+ export * from '@mapomodule/utils';
package/dist/index.d.ts CHANGED
@@ -1 +1,5 @@
1
- export * from "/home/runner/work/mapo-new/mapo-new/packages/mapomodule/src/index.js";
1
+ export * from '@mapomodule/core/types';
2
+ export * from '@mapomodule/store/types';
3
+ export * from '@mapomodule/form/types';
4
+ export * from '@mapomodule/uikit/types';
5
+ export * from '@mapomodule/utils';
package/dist/index.mjs CHANGED
@@ -1,70 +1,5 @@
1
- import { createJiti } from "file:///home/runner/work/mapo-new/mapo-new/node_modules/.pnpm/jiti@2.6.1/node_modules/jiti/lib/jiti.mjs";
2
-
3
- const jiti = createJiti(import.meta.url, {
4
- "interopDefault": true,
5
- "alias": {
6
- "mapomodule": "/home/runner/work/mapo-new/mapo-new/packages/mapomodule"
7
- },
8
- "transformOptions": {
9
- "babel": {
10
- "plugins": []
11
- }
12
- }
13
- })
14
-
15
- /** @type {import("/home/runner/work/mapo-new/mapo-new/packages/mapomodule/src/index.js")} */
16
- const _module = await jiti.import("/home/runner/work/mapo-new/mapo-new/packages/mapomodule/src/index.ts");
17
-
18
- export const CoreCookieEnum = _module.CoreCookieEnum;
19
- export const MultipartPolicyEnum = _module.MultipartPolicyEnum;
20
- export const useCanAccessRoute = _module.useCanAccessRoute;
21
- export const useMapoFetch = _module.useMapoFetch;
22
- export const SidebarCookieEnum = _module.SidebarCookieEnum;
23
- export const SnackTypeEnum = _module.SnackTypeEnum;
24
- export const useAuthStore = _module.useAuthStore;
25
- export const useSnackStore = _module.useSnackStore;
26
- export const useConfirmStore = _module.useConfirmStore;
27
- export const useSidebarStore = _module.useSidebarStore;
28
- export const usePermissions = _module.usePermissions;
29
- export const useFormFromSchema = _module.useFormFromSchema;
30
- export const useFormDraft = _module.useFormDraft;
31
- export const useFocusMode = _module.useFocusMode;
32
- export const useUnsavedChangesGuard = _module.useUnsavedChangesGuard;
33
- export const greaterThan = _module.greaterThan;
34
- export const isEmpty = _module.isEmpty;
35
- export const isNoneOf = _module.isNoneOf;
36
- export const isNotEmpty = _module.isNotEmpty;
37
- export const isOneOf = _module.isOneOf;
38
- export const lessThan = _module.lessThan;
39
- export const matches = _module.matches;
40
- export const matchesField = _module.matchesField;
41
- export const when = _module.when;
42
- export const whenAny = _module.whenAny;
43
- export const whenNot = _module.whenNot;
44
- export const flattenFieldGroups = _module.flattenFieldGroups;
45
- export const KnownFieldType = _module.KnownFieldType;
46
- export const deepMerge = _module.deepMerge;
47
- export const deepClone = _module.deepClone;
48
- export const isFile = _module.isFile;
49
- export const isBlob = _module.isBlob;
50
- export const isFileOrBlob = _module.isFileOrBlob;
51
- export const findPropPaths = _module.findPropPaths;
52
- export const filesInObject = _module.filesInObject;
53
- export const filterObj = _module.filterObj;
54
- export const getNestedValue = _module.getNestedValue;
55
- export const setNestedValue = _module.setNestedValue;
56
- export const setNestedValueMutating = _module.setNestedValueMutating;
57
- export const objectDiff = _module.objectDiff;
58
- export const formatDate = _module.formatDate;
59
- export const debounce = _module.debounce;
60
- export const slotNamespace = _module.slotNamespace;
61
- export const buildRouteTree = _module.buildRouteTree;
62
- export const calcMaxMenuNestDepth = _module.calcMaxMenuNestDepth;
63
- export const normalizeEndpoint = _module.normalizeEndpoint;
64
- export const splitEndpointParams = _module.splitEndpointParams;
65
- export const matchesSchema = _module.matchesSchema;
66
- export const applyConditionals = _module.applyConditionals;
67
- export const hasConditionals = _module.hasConditionals;
68
- export const resolveSchema = _module.resolveSchema;
69
- export const extractDefs = _module.extractDefs;
70
- export const getDefaultForSchema = _module.getDefaultForSchema;
1
+ export * from '@mapomodule/core/types';
2
+ export * from '@mapomodule/store/types';
3
+ export * from '@mapomodule/form/types';
4
+ export * from '@mapomodule/uikit/types';
5
+ export * from '@mapomodule/utils';
package/dist/module.d.mts CHANGED
@@ -1,2 +1,23 @@
1
- export * from "/home/runner/work/mapo-new/mapo-new/packages/mapomodule/src/module.js";
2
- export { default } from "/home/runner/work/mapo-new/mapo-new/packages/mapomodule/src/module.js";
1
+ import { NuxtModule } from '@nuxt/schema';
2
+ import { MapoOptions } from '@mapomodule/core';
3
+ import { MapoUikitOptions } from '@mapomodule/uikit';
4
+ import { MapoFormOptions } from '@mapomodule/form';
5
+ import { MapoI18nOptions } from '@mapomodule/i18n';
6
+ import { MapoMcpOptions } from '@mapomodule/mcp/types';
7
+
8
+ interface MapoModuleOptions extends MapoOptions {
9
+ /** Options forwarded to @mapomodule/uikit (CSS override, Nuxt UI defaults). */
10
+ uikit?: MapoUikitOptions;
11
+ /** Options forwarded to @mapomodule/form (field registry, groups, debounce). */
12
+ form?: MapoFormOptions;
13
+ /** Options forwarded to @mapomodule/i18n (default locale, extra locales). */
14
+ i18n?: MapoI18nOptions;
15
+ /**
16
+ * Options forwarded to @mapomodule/mcp (MCP server for AI assistants).
17
+ * Installed in development only; pass `false` to skip it entirely.
18
+ */
19
+ mcp?: MapoMcpOptions | false;
20
+ }
21
+ declare const _default: NuxtModule<MapoModuleOptions, MapoModuleOptions, false>;
22
+
23
+ export { _default as default };
package/dist/module.d.ts CHANGED
@@ -1,2 +1,23 @@
1
- export * from "/home/runner/work/mapo-new/mapo-new/packages/mapomodule/src/module.js";
2
- export { default } from "/home/runner/work/mapo-new/mapo-new/packages/mapomodule/src/module.js";
1
+ import { NuxtModule } from '@nuxt/schema';
2
+ import { MapoOptions } from '@mapomodule/core';
3
+ import { MapoUikitOptions } from '@mapomodule/uikit';
4
+ import { MapoFormOptions } from '@mapomodule/form';
5
+ import { MapoI18nOptions } from '@mapomodule/i18n';
6
+ import { MapoMcpOptions } from '@mapomodule/mcp/types';
7
+
8
+ interface MapoModuleOptions extends MapoOptions {
9
+ /** Options forwarded to @mapomodule/uikit (CSS override, Nuxt UI defaults). */
10
+ uikit?: MapoUikitOptions;
11
+ /** Options forwarded to @mapomodule/form (field registry, groups, debounce). */
12
+ form?: MapoFormOptions;
13
+ /** Options forwarded to @mapomodule/i18n (default locale, extra locales). */
14
+ i18n?: MapoI18nOptions;
15
+ /**
16
+ * Options forwarded to @mapomodule/mcp (MCP server for AI assistants).
17
+ * Installed in development only; pass `false` to skip it entirely.
18
+ */
19
+ mcp?: MapoMcpOptions | false;
20
+ }
21
+ declare const _default: NuxtModule<MapoModuleOptions, MapoModuleOptions, false>;
22
+
23
+ export { _default as default };
package/dist/module.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mapomodule",
3
3
  "configKey": "mapo",
4
- "version": "2.0.0-beta.2",
4
+ "version": "2.0.0-beta.21",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "unknown"
package/dist/module.mjs CHANGED
@@ -1,18 +1,48 @@
1
- import { createJiti } from "file:///home/runner/work/mapo-new/mapo-new/node_modules/.pnpm/jiti@2.6.1/node_modules/jiti/lib/jiti.mjs";
1
+ import { defineNuxtModule, createResolver, hasNuxtModule, installModule } from '@nuxt/kit';
2
2
 
3
- const jiti = createJiti(import.meta.url, {
4
- "interopDefault": true,
5
- "alias": {
6
- "mapomodule": "/home/runner/work/mapo-new/mapo-new/packages/mapomodule"
3
+ const module$1 = defineNuxtModule({
4
+ meta: {
5
+ name: "mapomodule",
6
+ configKey: "mapo"
7
7
  },
8
- "transformOptions": {
9
- "babel": {
10
- "plugins": []
8
+ async setup(options, nuxt) {
9
+ const resolver = createResolver(import.meta.url);
10
+ if (!hasNuxtModule("@mapomodule/store")) {
11
+ await installModule(await resolver.resolvePath("@mapomodule/store"));
12
+ }
13
+ const { uikit, form, i18n, mcp, ...coreOptions } = options;
14
+ if (!hasNuxtModule("@mapomodule/i18n")) {
15
+ await installModule(
16
+ await resolver.resolvePath("@mapomodule/i18n"),
17
+ i18n ?? {}
18
+ );
19
+ }
20
+ if (!hasNuxtModule("@mapomodule/core")) {
21
+ await installModule(
22
+ await resolver.resolvePath("@mapomodule/core"),
23
+ coreOptions
24
+ );
25
+ }
26
+ if (!hasNuxtModule("@mapomodule/uikit")) {
27
+ await installModule(
28
+ await resolver.resolvePath("@mapomodule/uikit"),
29
+ uikit ?? {}
30
+ );
31
+ }
32
+ if (!hasNuxtModule("@mapomodule/form")) {
33
+ await installModule(
34
+ await resolver.resolvePath("@mapomodule/form"),
35
+ form ?? {}
36
+ );
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
+ );
11
44
  }
12
45
  }
13
- })
14
-
15
- /** @type {import("/home/runner/work/mapo-new/mapo-new/packages/mapomodule/src/module.js")} */
16
- const _module = await jiti.import("/home/runner/work/mapo-new/mapo-new/packages/mapomodule/src/module.ts");
46
+ });
17
47
 
18
- export default _module?.default ?? _module;
48
+ export { module$1 as default };
package/dist/types.d.mts CHANGED
@@ -1,13 +1,7 @@
1
- import type { ModuleHooks, ModuleRuntimeHooks, ModuleRuntimeConfig, ModulePublicRuntimeConfig } from './module.mjs'
1
+ import type { NuxtModule } from '@nuxt/schema'
2
2
 
3
- declare module '#app' {
4
- interface RuntimeNuxtHooks extends ModuleRuntimeHooks {}
5
- }
3
+ import type { default as Module } from './module.mjs'
6
4
 
7
- declare module '@nuxt/schema' {
8
- interface NuxtHooks extends ModuleHooks {}
9
- interface RuntimeConfig extends ModuleRuntimeConfig {}
10
- interface PublicRuntimeConfig extends ModulePublicRuntimeConfig {}
11
- }
5
+ export type ModuleOptions = typeof Module extends NuxtModule<infer O> ? Partial<O> : Record<string, any>
12
6
 
13
- export * from "./module.mjs"
7
+ export { default } from './module.mjs'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mapomodule",
3
- "version": "2.0.0-beta.2",
3
+ "version": "2.0.0-beta.21",
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
- "prepare": "nuxt-module-build build --stub",
38
37
  "dev:prepare": "nuxt-module-build build --stub",
39
38
  "typecheck": "tsc --noEmit",
40
39
  "lint": "eslint src"
@@ -44,18 +43,20 @@
44
43
  },
45
44
  "dependencies": {
46
45
  "@iconify-json/lucide": "^1.2.0",
47
- "@mapomodule/core": "2.0.0-beta.1",
48
- "@mapomodule/form": "2.0.0-beta.1",
49
- "@mapomodule/store": "2.0.0-beta.1",
50
- "@mapomodule/uikit": "2.0.0-beta.1",
51
- "@mapomodule/utils": "2.0.0-beta.1",
46
+ "@mapomodule/core": "2.0.0-beta.12",
47
+ "@mapomodule/form": "2.0.0-beta.14",
48
+ "@mapomodule/i18n": "2.0.0-beta.5",
49
+ "@mapomodule/mcp": "1.0.0-beta.3",
50
+ "@mapomodule/store": "2.0.0-beta.6",
51
+ "@mapomodule/uikit": "2.0.0-beta.17",
52
+ "@mapomodule/utils": "2.0.0-beta.7",
52
53
  "@nuxt/ui": "^4.7.0"
53
54
  },
54
55
  "devDependencies": {
55
56
  "@nuxt/kit": "4.4.2",
56
57
  "@nuxt/module-builder": "^1.0.2",
57
58
  "@nuxt/schema": "4.4.2",
58
- "nuxt": "^4.4.2",
59
- "vue": "^3.5.32"
59
+ "nuxt": "^4.5.1",
60
+ "vue": "^3.5.40"
60
61
  }
61
62
  }
package/dist/index.d.cts DELETED
@@ -1 +0,0 @@
1
- export * from "/home/runner/work/mapo-new/mapo-new/packages/mapomodule/src/index.js";
package/dist/module.d.cts DELETED
@@ -1,2 +0,0 @@
1
- export * from "/home/runner/work/mapo-new/mapo-new/packages/mapomodule/src/module.js";
2
- export { default } from "/home/runner/work/mapo-new/mapo-new/packages/mapomodule/src/module.js";