@lupinum/nuxt-board 0.1.0

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026-present Lupinum OG and contributors
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 all
13
+ 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 THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,63 @@
1
+ <p align="center"><img src="https://raw.githubusercontent.com/lupinum-dev/nuxt-board/main/docs/public/app-icon.svg" width="128" alt="Nuxt Board icon"></p>
2
+
3
+ <h1 align="center">@lupinum/nuxt-board</h1>
4
+
5
+ <p align="center">Add the Nuxt Board components, composables, helpers, and styles to Nuxt.</p>
6
+
7
+ <p align="center">
8
+ <a href="https://www.npmjs.com/package/@lupinum/nuxt-board"><img src="https://img.shields.io/npm/v/@lupinum/nuxt-board?label=npm" alt="npm version"></a>
9
+ <a href="https://github.com/lupinum-dev/nuxt-board/actions/workflows/ci.yml"><img src="https://github.com/lupinum-dev/nuxt-board/actions/workflows/ci.yml/badge.svg" alt="CI status"></a>
10
+ <a href="https://github.com/lupinum-dev/nuxt-board/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="MIT license"></a>
11
+ </p>
12
+
13
+ > [!WARNING]
14
+ > This package has not reached a stable release. Review the changelog before each upgrade.
15
+
16
+ ## Purpose
17
+
18
+ Use this module when a Nuxt application needs board auto-imports and deterministic server rendering.
19
+
20
+ ## Requirements
21
+
22
+ The module requires Nuxt 3.19 or newer. Install matching versions of the three packages so their public contracts stay aligned.
23
+
24
+ ## Installation
25
+
26
+ ```bash
27
+ pnpm add @lupinum/nuxt-board @lupinum/board-core @lupinum/vue-board
28
+ ```
29
+
30
+ ```ts
31
+ export default defineNuxtConfig({
32
+ modules: ['@lupinum/nuxt-board'],
33
+ })
34
+ ```
35
+
36
+ ## Quick start
37
+
38
+ ```vue
39
+ <script setup lang="ts">
40
+ const engine = createBoardEngine({ grid: { size: 24, snap: true } })
41
+ engine.createNode({ type: 'text', x: 64, y: 64, text: 'Nuxt Board' })
42
+ </script>
43
+
44
+ <template>
45
+ <BoardRoot :engine="engine" style="height: 480px" />
46
+ </template>
47
+ ```
48
+
49
+ ## Exports
50
+
51
+ The module auto-imports the board components, composables, `createBoardEngine`, and the default styles. Use stable node IDs for setup-time content so server HTML matches client hydration.
52
+
53
+ ## Documentation
54
+
55
+ Read the [Nuxt module reference](https://nuxt-board.lupinum.com/docs/reference/nuxt-board).
56
+
57
+ ## Support and security
58
+
59
+ Open a [GitHub issue](https://github.com/lupinum-dev/nuxt-board/issues) for support. Report vulnerabilities through the [private security process](https://github.com/lupinum-dev/nuxt-board/security/policy).
60
+
61
+ ## License
62
+
63
+ This package uses the [MIT License](https://github.com/lupinum-dev/nuxt-board/blob/main/LICENSE).
@@ -0,0 +1,25 @@
1
+ import * as _nuxt_schema from '@nuxt/schema';
2
+
3
+ /** Configuration for the `@lupinum/nuxt-board` module. */
4
+ interface ModuleOptions {
5
+ /**
6
+ * Optional prefix for all auto-imported board exports.
7
+ * Default: '' (no prefix). Example: 'My' → <MyBoardRoot>, useMyBoardCamera(), createMyBoardEngine()
8
+ */
9
+ prefix?: string;
10
+ /**
11
+ * Whether to auto-import board components (BoardRoot, BoardNode, etc.).
12
+ * Default: true
13
+ */
14
+ autoImportComponents?: boolean;
15
+ /**
16
+ * Whether to auto-import board composables (useBoardEngine, useBoardCamera, etc.).
17
+ * Default: true
18
+ */
19
+ autoImportComposables?: boolean;
20
+ }
21
+ /** Nuxt module that auto-registers the board components and composables. */
22
+ declare const _default: _nuxt_schema.NuxtModule<ModuleOptions, ModuleOptions, false>;
23
+
24
+ export { _default as default };
25
+ export type { ModuleOptions };
@@ -0,0 +1,12 @@
1
+ {
2
+ "name": "@lupinum/nuxt-board",
3
+ "configKey": "board",
4
+ "compatibility": {
5
+ "nuxt": "^3.19.0 || ^4.0.0"
6
+ },
7
+ "version": "0.1.0",
8
+ "builder": {
9
+ "@nuxt/module-builder": "1.0.2",
10
+ "unbuild": "unknown"
11
+ }
12
+ }
@@ -0,0 +1,107 @@
1
+ import { defineNuxtModule, addComponent, addImports } from '@nuxt/kit';
2
+
3
+ const BOARD_COMPONENTS = [
4
+ "BoardRoot",
5
+ "BoardViewport",
6
+ "BoardNode",
7
+ "BoardNodeHandle",
8
+ "BoardSelectionToolbar",
9
+ "BoardGrid",
10
+ "BoardBoxSelect",
11
+ "BoardSnapGuides"
12
+ ];
13
+ const BOARD_COMPOSABLES = [
14
+ "useBoardEngine",
15
+ "useBoardCamera",
16
+ "useBoardNodes",
17
+ "useBoardSelection",
18
+ "useBoardInteraction",
19
+ "useBoardVisibleBounds",
20
+ "useBoardVisibleNodes",
21
+ "useBoardGridStyle",
22
+ "useBoardNode",
23
+ "useBoardBoxSelectBounds"
24
+ ];
25
+ const BOARD_HELPERS = ["createBoardEngine"];
26
+ const MINIMAP_COMPONENTS = ["BoardMinimap"];
27
+ const MINIMAP_COMPOSABLES = ["useBoardMinimap"];
28
+ function normalizePrefix(prefix) {
29
+ const value = prefix?.trim() ?? "";
30
+ const normalized = value ? `${value[0].toUpperCase()}${value.slice(1)}` : "";
31
+ if (normalized && !/^[A-Z][A-Za-z0-9]*$/.test(normalized)) {
32
+ throw new Error(
33
+ "@lupinum/nuxt-board: `board.prefix` must start with a letter and contain only letters or numbers."
34
+ );
35
+ }
36
+ return normalized;
37
+ }
38
+ function getComponentAlias(name, prefix) {
39
+ return prefix ? `${prefix}${name}` : name;
40
+ }
41
+ function getComposableAlias(name, prefix) {
42
+ return prefix ? `use${prefix}${name.slice(3)}` : name;
43
+ }
44
+ function getHelperAlias(name, prefix) {
45
+ return prefix ? `create${prefix}${name.slice(6)}` : name;
46
+ }
47
+ const module$1 = defineNuxtModule({
48
+ meta: {
49
+ name: "@lupinum/nuxt-board",
50
+ configKey: "board",
51
+ compatibility: {
52
+ nuxt: "^3.19.0 || ^4.0.0"
53
+ }
54
+ },
55
+ defaults: {
56
+ prefix: "",
57
+ autoImportComponents: true,
58
+ autoImportComposables: true
59
+ },
60
+ setup(options, nuxt) {
61
+ const prefix = normalizePrefix(options.prefix);
62
+ if (!nuxt.options.css.includes("@lupinum/vue-board/style.css")) {
63
+ nuxt.options.css.push("@lupinum/vue-board/style.css");
64
+ }
65
+ if (options.autoImportComponents !== false) {
66
+ for (const name of BOARD_COMPONENTS) {
67
+ addComponent({
68
+ name: getComponentAlias(name, prefix),
69
+ export: name,
70
+ filePath: "@lupinum/vue-board"
71
+ });
72
+ }
73
+ for (const name of MINIMAP_COMPONENTS) {
74
+ addComponent({
75
+ name: getComponentAlias(name, prefix),
76
+ export: name,
77
+ filePath: "@lupinum/vue-board/minimap"
78
+ });
79
+ }
80
+ }
81
+ if (options.autoImportComposables !== false) {
82
+ addImports(
83
+ BOARD_COMPOSABLES.map((name) => ({
84
+ name,
85
+ as: getComposableAlias(name, prefix),
86
+ from: "@lupinum/vue-board"
87
+ }))
88
+ );
89
+ addImports(
90
+ MINIMAP_COMPOSABLES.map((name) => ({
91
+ name,
92
+ as: getComposableAlias(name, prefix),
93
+ from: "@lupinum/vue-board/minimap"
94
+ }))
95
+ );
96
+ addImports(
97
+ BOARD_HELPERS.map((name) => ({
98
+ name,
99
+ as: getHelperAlias(name, prefix),
100
+ from: "@lupinum/board-core"
101
+ }))
102
+ );
103
+ }
104
+ }
105
+ });
106
+
107
+ export { module$1 as default };
@@ -0,0 +1,3 @@
1
+ export { default } from './module.mjs'
2
+
3
+ export { type ModuleOptions } from './module.mjs'
package/package.json ADDED
@@ -0,0 +1,81 @@
1
+ {
2
+ "name": "@lupinum/nuxt-board",
3
+ "version": "0.1.0",
4
+ "description": "Nuxt module for @lupinum/vue-board with board component and composable auto-imports.",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "git+https://github.com/lupinum-dev/nuxt-board.git",
8
+ "directory": "packages/nuxt-board"
9
+ },
10
+ "homepage": "https://nuxt-board.lupinum.com",
11
+ "bugs": {
12
+ "url": "https://github.com/lupinum-dev/nuxt-board/issues"
13
+ },
14
+ "license": "MIT",
15
+ "author": "Lupinum OG <info@lupinum.com> (https://lupinum.com)",
16
+ "type": "module",
17
+ "engines": {
18
+ "node": ">=20.19.0"
19
+ },
20
+ "exports": {
21
+ ".": {
22
+ "types": "./dist/types.d.mts",
23
+ "import": "./dist/module.mjs"
24
+ }
25
+ },
26
+ "main": "./dist/module.mjs",
27
+ "typesVersions": {
28
+ "*": {
29
+ ".": [
30
+ "./dist/types.d.mts"
31
+ ]
32
+ }
33
+ },
34
+ "files": [
35
+ "dist"
36
+ ],
37
+ "keywords": [
38
+ "board",
39
+ "nuxt",
40
+ "vue",
41
+ "diagram"
42
+ ],
43
+ "publishConfig": {
44
+ "access": "public"
45
+ },
46
+ "dependencies": {
47
+ "@nuxt/kit": "4.5.1"
48
+ },
49
+ "peerDependencies": {
50
+ "nuxt": "^3.19.0 || ^4.0.0",
51
+ "@lupinum/board-core": "0.1.0",
52
+ "@lupinum/vue-board": "0.1.0"
53
+ },
54
+ "devDependencies": {
55
+ "@nuxt/devtools": "3.3.1",
56
+ "@nuxt/eslint-config": "^1.16.0",
57
+ "@nuxt/module-builder": "^1.0.2",
58
+ "@nuxt/schema": "4.5.1",
59
+ "@nuxt/test-utils": "^4.0.3",
60
+ "@types/node": "20.19.0",
61
+ "@vitejs/plugin-vue": "6.0.6",
62
+ "eslint": "^10.7.0",
63
+ "nuxt": "4.5.1",
64
+ "typescript": "~5.9.3",
65
+ "vite": "7.3.5",
66
+ "vitest": "^4.1.10",
67
+ "vue-tsc": "^3.3.7",
68
+ "@lupinum/board-core": "0.1.0",
69
+ "@lupinum/vue-board": "0.1.0"
70
+ },
71
+ "scripts": {
72
+ "build": "nuxt-module-build prepare && nuxt-module-build build",
73
+ "dev": "pnpm run dev:prepare && nuxt dev playground",
74
+ "dev:build": "nuxt build playground",
75
+ "dev:prepare": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxt prepare playground",
76
+ "lint": "eslint .",
77
+ "test": "pnpm --filter @lupinum/board-core build && pnpm --filter @lupinum/vue-board build && pnpm run dev:prepare && vitest run --root ../.. packages/nuxt-board/test",
78
+ "test:watch": "vitest watch --root ../.. packages/nuxt-board/test",
79
+ "test:types": "pnpm run dev:prepare && vue-tsc --noEmit && pnpm exec nuxi typecheck playground && pnpm exec nuxi typecheck test/fixtures/basic && pnpm exec nuxi typecheck test/fixtures/prefixed"
80
+ }
81
+ }