mapomodule 1.0.0-alpha.9 → 2.0.0-beta.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 CHANGED
@@ -1,53 +1,59 @@
1
- # mapomodule [![npm](https://img.shields.io/npm/v/mapomodule?style=flat-square)](https://www.npmjs.com/package/mapomodule) [![GitHub](https://img.shields.io/badge/license-MIT-green?style=flat-square)](https://github.com/lotrekagency/mapo/blob/master/LICENSE.md)
1
+ # mapomodule
2
2
 
3
- ## Setup
4
- Add `mapomodule` dependency to your project
5
- ```sh
6
- yarn add --dev mapomodule # or npm install --save-dev mapomodule
7
- ```
8
- Add mapomodule to the buildModules section of nuxt.config.js
9
- ```js
10
- {
11
- buildModules: [
12
- // Simple usage
13
- 'mapomodule',
14
-
15
- // With options
16
- ['mapomodule', { /* module options */ }]
17
- ]
18
- }
3
+ The Mapo meta-module: a single Nuxt module that registers the entire Mapo stack with one entry in `nuxt.config.ts`.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ pnpm add mapomodule @nuxt/ui
19
9
  ```
20
-
21
- You can add options also from top level nuxt.config.js
22
-
23
- ```js
24
- {
25
- buildModules: [
26
- 'mapomodule'
27
- ],
10
+
11
+ ```ts
12
+ // nuxt.config.ts — @nuxt/ui MUST come before mapomodule
13
+ export default defineNuxtConfig({
14
+ modules: ["@nuxt/ui", "mapomodule"],
15
+
28
16
  mapo: {
29
- /* module options */
30
- }
31
- }
17
+ authLoginUrl: "/api/auth/login",
18
+ userInfoApi: "/api/profiles/me/",
19
+ logoutUrl: "/api/auth/logout",
20
+ loginUrl: "/login",
21
+
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
+ },
30
+ },
31
+ });
32
32
  ```
33
- ## Features
34
33
 
35
- - Exposes [`$mapo`](https://lotrekagency.github.io/mapo/core/) core sevices to provide set of utilities.
36
- - Injects mapo [`components`](https://lotrekagency.github.io/mapo/components/) in the default nuxt component discovery.
37
- - Adds meta information to router module from nuxt pages.
34
+ All options are optional and fall back to `MAPO_DEFAULTS`.
38
35
 
39
- 📑  Read more from the [documentation](https://lotrekagency.github.io/mapo/).
36
+ ## What it installs
40
37
 
41
- ## How to contribute
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 |
42
45
 
43
- 1. Clone this repository
44
- 2. Install dependencies using `yarn bootstrap`
45
- 3. Start development server using `yarn dev`
46
+ ## Dev workflow
46
47
 
47
- ### Documenting components
48
- Always write some documentation regarding the components you're developing.
49
- Our documentation is generated directly from code thanks to [@Vuepress](https://vuepress.vuejs.org/), [@Vuese](https://vuese.org/) and [@jsdoc-to-markdown](https://github.com/jsdoc2md/jsdoc-to-markdown#readme).
48
+ ```bash
49
+ # watch mode rebuilds dist/ on src/ changes
50
+ pnpm dev:mapomodule # from monorepo root
51
+ ```
50
52
 
51
- 1. Generate doc `yarn doc:gen`
52
- 2. Preview vuepress doc `yarn doc:dev`
53
+ ## Reference
53
54
 
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
@@ -0,0 +1,2 @@
1
+ export * from "/home/runner/work/mapo-new/mapo-new/packages/mapomodule/src/index.js";
2
+ export { default } from "/home/runner/work/mapo-new/mapo-new/packages/mapomodule/src/index.js";
@@ -0,0 +1,2 @@
1
+ export * from "/home/runner/work/mapo-new/mapo-new/packages/mapomodule/src/index.js";
2
+ export { default } from "/home/runner/work/mapo-new/mapo-new/packages/mapomodule/src/index.js";
@@ -0,0 +1,2 @@
1
+ export * from "/home/runner/work/mapo-new/mapo-new/packages/mapomodule/src/index.js";
2
+ export { default } from "/home/runner/work/mapo-new/mapo-new/packages/mapomodule/src/index.js";
package/dist/index.mjs ADDED
@@ -0,0 +1,71 @@
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 default _module?.default ?? _module;
19
+ export const MultipartPolicyEnum = _module.MultipartPolicyEnum;
20
+ export const CoreCookieEnum = _module.CoreCookieEnum;
21
+ export const useCanAccessRoute = _module.useCanAccessRoute;
22
+ export const useMapoFetch = _module.useMapoFetch;
23
+ export const SnackTypeEnum = _module.SnackTypeEnum;
24
+ export const SidebarCookieEnum = _module.SidebarCookieEnum;
25
+ export const useAuthStore = _module.useAuthStore;
26
+ export const useSnackStore = _module.useSnackStore;
27
+ export const useConfirmStore = _module.useConfirmStore;
28
+ export const useSidebarStore = _module.useSidebarStore;
29
+ export const usePermissions = _module.usePermissions;
30
+ export const useFormFromSchema = _module.useFormFromSchema;
31
+ export const useFormDraft = _module.useFormDraft;
32
+ export const useFocusMode = _module.useFocusMode;
33
+ export const useUnsavedChangesGuard = _module.useUnsavedChangesGuard;
34
+ export const when = _module.when;
35
+ export const whenAny = _module.whenAny;
36
+ export const whenNot = _module.whenNot;
37
+ export const matchesField = _module.matchesField;
38
+ export const isOneOf = _module.isOneOf;
39
+ export const isNoneOf = _module.isNoneOf;
40
+ export const isNotEmpty = _module.isNotEmpty;
41
+ export const isEmpty = _module.isEmpty;
42
+ export const greaterThan = _module.greaterThan;
43
+ export const lessThan = _module.lessThan;
44
+ export const matches = _module.matches;
45
+ export const flattenFieldGroups = _module.flattenFieldGroups;
46
+ export const KnownFieldType = _module.KnownFieldType;
47
+ export const deepMerge = _module.deepMerge;
48
+ export const deepClone = _module.deepClone;
49
+ export const isFile = _module.isFile;
50
+ export const isBlob = _module.isBlob;
51
+ export const isFileOrBlob = _module.isFileOrBlob;
52
+ export const findPropPaths = _module.findPropPaths;
53
+ export const filesInObject = _module.filesInObject;
54
+ export const filterObj = _module.filterObj;
55
+ export const getNestedValue = _module.getNestedValue;
56
+ export const setNestedValue = _module.setNestedValue;
57
+ export const setNestedValueMutating = _module.setNestedValueMutating;
58
+ export const objectDiff = _module.objectDiff;
59
+ export const formatDate = _module.formatDate;
60
+ export const debounce = _module.debounce;
61
+ export const slotNamespace = _module.slotNamespace;
62
+ export const buildRouteTree = _module.buildRouteTree;
63
+ export const calcMaxMenuNestDepth = _module.calcMaxMenuNestDepth;
64
+ export const normalizeEndpoint = _module.normalizeEndpoint;
65
+ export const splitEndpointParams = _module.splitEndpointParams;
66
+ export const matchesSchema = _module.matchesSchema;
67
+ export const applyConditionals = _module.applyConditionals;
68
+ export const hasConditionals = _module.hasConditionals;
69
+ export const resolveSchema = _module.resolveSchema;
70
+ export const extractDefs = _module.extractDefs;
71
+ export const getDefaultForSchema = _module.getDefaultForSchema;
@@ -0,0 +1,2 @@
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";
@@ -0,0 +1,2 @@
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";
@@ -0,0 +1,2 @@
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";
@@ -0,0 +1,9 @@
1
+ {
2
+ "name": "mapomodule",
3
+ "configKey": "mapo",
4
+ "version": "2.0.0-beta.1",
5
+ "builder": {
6
+ "@nuxt/module-builder": "1.0.2",
7
+ "unbuild": "unknown"
8
+ }
9
+ }
@@ -0,0 +1,18 @@
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/module.js")} */
16
+ const _module = await jiti.import("/home/runner/work/mapo-new/mapo-new/packages/mapomodule/src/module.ts");
17
+
18
+ export default _module?.default ?? _module;
@@ -0,0 +1,13 @@
1
+ import type { ModuleHooks, ModuleRuntimeHooks, ModuleRuntimeConfig, ModulePublicRuntimeConfig } from './module.mjs'
2
+
3
+ declare module '#app' {
4
+ interface RuntimeNuxtHooks extends ModuleRuntimeHooks {}
5
+ }
6
+
7
+ declare module '@nuxt/schema' {
8
+ interface NuxtHooks extends ModuleHooks {}
9
+ interface RuntimeConfig extends ModuleRuntimeConfig {}
10
+ interface PublicRuntimeConfig extends ModulePublicRuntimeConfig {}
11
+ }
12
+
13
+ export * from "./module.mjs"
package/package.json CHANGED
@@ -1,27 +1,62 @@
1
1
  {
2
2
  "name": "mapomodule",
3
- "version": "1.0.0-alpha.9",
4
- "description": "Mapo is a nuxt module that helps in the creation of Administration Panels.",
5
- "author": "bnznamco <gabriele.baldi.01@gmail.com>",
6
- "keywords": [
7
- "mapo",
8
- "nuxt",
9
- "Admin",
10
- "Panel"
11
- ],
3
+ "version": "2.0.0-beta.1",
4
+ "description": "Mapo meta-package: registers and re-exports all @mapomodule/* modules",
5
+ "type": "module",
12
6
  "license": "MIT",
13
- "repository": "https://github.com/lotrekagency/mapo",
14
- "main": "./module.js",
15
- "dependencies": {
16
- "@mapomodule/core": "^1.0.0-alpha.9",
17
- "@mapomodule/routemeta": "^1.0.0-alpha.8",
18
- "@mapomodule/store": "^1.0.0-alpha.9",
19
- "@mapomodule/uikit": "^1.0.0-alpha.9",
20
- "@nuxtjs/axios": "^5.13.6",
21
- "lodash.mergewith": "^4.6.2"
7
+ "author": "Lotrek Agency (https://lotrek.it)",
8
+ "homepage": "https://lotrekagency.github.io/mapo-new/",
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://github.com/lotrekagency/mapo-new.git",
12
+ "directory": "packages/mapomodule"
13
+ },
14
+ "bugs": {
15
+ "url": "https://github.com/lotrekagency/mapo-new/issues"
22
16
  },
23
17
  "publishConfig": {
24
- "access": "public"
18
+ "access": "public",
19
+ "tag": "next"
20
+ },
21
+ "exports": {
22
+ ".": {
23
+ "types": "./dist/module.d.mts",
24
+ "import": "./dist/module.mjs"
25
+ },
26
+ "./types": {
27
+ "types": "./dist/index.d.mts",
28
+ "import": "./dist/index.mjs"
29
+ }
30
+ },
31
+ "files": [
32
+ "dist"
33
+ ],
34
+ "scripts": {
35
+ "dev": "nuxt-module-build build --stub --watch",
36
+ "build": "nuxt-module-build build",
37
+ "prepare": "nuxt-module-build build --stub",
38
+ "dev:prepare": "nuxt-module-build build --stub",
39
+ "typecheck": "tsc --noEmit",
40
+ "lint": "eslint src"
41
+ },
42
+ "peerDependencies": {
43
+ "nuxt": ">=4.0.0"
44
+ },
45
+ "dependencies": {
46
+ "@iconify-json/lucide": "^1.2.0",
47
+ "@mapomodule/core": "2.0.0-beta.1",
48
+ "@mapomodule/form": "2.0.0-beta.1",
49
+ "@mapomodule/i18n": "workspace:*",
50
+ "@mapomodule/store": "2.0.0-beta.1",
51
+ "@mapomodule/uikit": "2.0.0-beta.1",
52
+ "@mapomodule/utils": "2.0.0-beta.1",
53
+ "@nuxt/ui": "^4.7.0"
25
54
  },
26
- "gitHead": "a75142247a9371981aea57b76828bd354b375aea"
55
+ "devDependencies": {
56
+ "@nuxt/kit": "4.4.2",
57
+ "@nuxt/module-builder": "^1.0.2",
58
+ "@nuxt/schema": "4.4.2",
59
+ "nuxt": "^4.4.2",
60
+ "vue": "^3.5.32"
61
+ }
27
62
  }
package/CHANGELOG.md DELETED
@@ -1,59 +0,0 @@
1
- # Change Log
2
-
3
- All notable changes to this project will be documented in this file.
4
- See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
-
6
- # [1.0.0-alpha.9](https://github.com/lotrekagency/mapo/compare/v1.0.0-alpha.8...v1.0.0-alpha.9) (2022-02-08)
7
-
8
- **Note:** Version bump only for package mapomodule
9
-
10
-
11
-
12
-
13
-
14
- # [1.0.0-alpha.8](https://github.com/lotrekagency/mapo/compare/v1.0.0-alpha.7...v1.0.0-alpha.8) (2022-01-23)
15
-
16
- **Note:** Version bump only for package mapomodule
17
-
18
-
19
-
20
-
21
-
22
- # [1.0.0-alpha.7](https://github.com/lotrekagency/mapo/compare/v1.0.0-alpha.6...v1.0.0-alpha.7) (2022-01-13)
23
-
24
- **Note:** Version bump only for package mapomodule
25
-
26
-
27
-
28
-
29
-
30
- # [1.0.0-alpha.6](https://github.com/lotrekagency/mapo/compare/v1.0.0-alpha.5...v1.0.0-alpha.6) (2021-12-26)
31
-
32
- **Note:** Version bump only for package mapomodule
33
-
34
-
35
-
36
-
37
-
38
- # [1.0.0-alpha.5](https://github.com/lotrekagency/mapo/compare/v1.0.0-alpha.4...v1.0.0-alpha.5) (2021-12-20)
39
-
40
- **Note:** Version bump only for package mapomodule
41
-
42
-
43
-
44
-
45
-
46
- # [1.0.0-alpha.4](https://github.com/lotrekagency/mapo/compare/v1.0.0-alpha.3...v1.0.0-alpha.4) (2021-10-25)
47
-
48
- **Note:** Version bump only for package mapomodule
49
-
50
-
51
-
52
-
53
-
54
- # [1.0.0-alpha.3](https://github.com/lotrekagency/mapo/compare/v1.0.0-alpha.2...v1.0.0-alpha.3) (2021-10-25)
55
-
56
-
57
- ### Bug Fixes
58
-
59
- * Corrected load order of modules to prevent missing mapo components in some circumstances ([4fa16fb](https://github.com/lotrekagency/mapo/commit/4fa16fb549ee0e6368fe724c8305ffc789d5c2fc))
package/LICENSE.md DELETED
@@ -1,20 +0,0 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) Lotrek 2021
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in
13
- all copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
package/defaults.js DELETED
@@ -1,38 +0,0 @@
1
- import vuetify from '@mapomodule/uikit/defaults'
2
-
3
- export default {
4
- store: true,
5
- components: true,
6
- router: {
7
- base: process.env.PANEL_URL || '/',
8
- },
9
- head: {
10
- titleTemplate: '%s - mapo',
11
- title: '🥭 mapo',
12
- meta: [
13
- { charset: 'utf-8' },
14
- { name: 'viewport', content: 'width=device-width, initial-scale=1' },
15
- { hid: 'description', name: 'description', content: '' }
16
- ],
17
- link: [
18
- { rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }
19
- ]
20
- },
21
- vuetify,
22
- axios: {
23
- baseURL: 'http://localhost:8000',
24
- browserBaseURL: 'http://localhost:8000',
25
- },
26
-
27
- extendPlugins(plugins) {
28
- const index = plugins.findIndex(
29
- ({ src }) => src.endsWith('mapo/mapo.js')
30
- )
31
- const mapoPlugin = plugins[index]
32
- if (mapoPlugin) {
33
- plugins.splice(index, 1)
34
- plugins.push(mapoPlugin)
35
- }
36
- return plugins
37
- }
38
- }
package/module.js DELETED
@@ -1,32 +0,0 @@
1
- import mapoDefaults from './defaults'
2
- const _mergeWith = require('lodash.mergewith')
3
-
4
-
5
- function customMerger(objValue, srcValue, key) {
6
- const isFunction = function (obj) {
7
- return !!(obj && obj.constructor && obj.call && obj.apply);
8
- }
9
- if (key == 'extendPlugins' && isFunction(objValue) && isFunction(srcValue)) {
10
- return plugins => objValue(srcValue(plugins))
11
- }
12
- if (typeof objValue !== 'object') {
13
- return objValue
14
- }
15
- }
16
-
17
- export default async function MapoModule(moduleOptions) {
18
-
19
- const userModuleOptions = Object.keys(moduleOptions).length === 0 ? (this.options['mapo'] || {}) : moduleOptions
20
-
21
- this.options = _mergeWith(this.options, mapoDefaults, customMerger)
22
-
23
- this.requireModule(['@nuxtjs/axios', (this.options && this.options.axios) || userModuleOptions.axios || mapoDefaults.axios || {}])
24
- this.requireModule(['@mapomodule/store'], userModuleOptions.store)
25
- this.requireModule(['@mapomodule/core'], userModuleOptions)
26
- /* Await prevents to load routemeta before mapo pages. Also needed to correclty load mapo components */
27
- await this.requireModule(['@mapomodule/uikit'], userModuleOptions.ui)
28
- this.requireModule(['@mapomodule/routemeta'], userModuleOptions.routemeta)
29
-
30
- }
31
-
32
- module.exports.meta = require('./package.json')