@macrulez/visual-linker-nuxt 0.4.3 → 0.4.5

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
@@ -17,7 +17,7 @@ monorepo.
17
17
 
18
18
  - **Auto-imports `<VisualLinker>` and `useVisualLinker`** — registered/imported from `@macrulez/visual-linker-vue`, no explicit `import` anywhere in your app
19
19
  - **Registers `v-vl-block` / `v-vl-port` globally** — on the server too, so the `data-vl-*` discovery attributes are already in the server-rendered HTML
20
- - **The whole configuration, set once** — `visualLinker` in `nuxt.config.ts` takes the same structure as the engine (`theme`, `lines`, `markers`, `ports`, `labels`, `blocks`, `interaction`), applied to every diagram
20
+ - **The whole configuration, set once** — `visualLinker` in `nuxt.config.ts` takes the same structure as the engine (`theme`, `lines`, `markers`, `ports`, `labels`, `blocks`, `interaction`, `performance`), applied to every diagram
21
21
  - **The configuration is shared through Vue's `provide`** — one reactive object per app, which `useVisualLinkerConfig()` exposes for runtime changes (a theme switch re-styles every diagram)
22
22
  - **Nothing needs `<ClientOnly>`** — the component/composable are SSR-safe on their own
23
23
 
@@ -98,12 +98,15 @@ separate list of module-only names to learn:
98
98
  | `ports` | the built-in dot (`show`, `radius`, `fill`, `stroke`, states), default `side`/`offset`, `spread` |
99
99
  | `labels` | the look of library-drawn connection labels, with states |
100
100
  | `blocks` | `draggable`, `drag: { grid, bounds }` (values must be plain data — `'container'` or an inset object) |
101
- | `interaction` | `hover`, `highlight`, `selectable`, `clipToScrollParents` |
101
+ | `interaction` | `hover`, `highlight`, `selectable`, `clipToScrollParents`, `connect` (without `validate`) |
102
+ | `performance` | `cull` and the limits for jumps and routing |
102
103
 
103
104
  Everything is optional and nothing is hardcoded in the module: a field left
104
105
  out falls through to `@macrulez/visual-linker-core`'s own built-in default.
105
106
  The options travel through `runtimeConfig.public.visualLinker`, so they must
106
- be JSON-serializable (no `HTMLElement` for `drag.bounds`).
107
+ be JSON-serializable (no `HTMLElement` for `drag.bounds`). `interaction.connect.validate` is a function, so the
108
+ module's options type leaves it out and a function passed anyway is dropped with a warning: set `validate` in the
109
+ `config` of the `<VisualLinker>` that needs it.
107
110
 
108
111
  #### An app-wide look
109
112
 
package/dist/module.d.ts CHANGED
@@ -1,7 +1,13 @@
1
1
  import { NuxtModule } from '@nuxt/schema';
2
- import { VisualLinkerConfig } from '@macrulez/visual-linker-vue';
2
+ import { VisualLinkerConfig, InteractionConfig, ConnectConfig } from '@macrulez/visual-linker-vue';
3
3
 
4
- type ModuleOptions = VisualLinkerConfig;
4
+ type SerializableConnectConfig = Omit<ConnectConfig, 'validate'>;
5
+ type SerializableInteractionConfig = Omit<InteractionConfig, 'connect'> & {
6
+ connect?: SerializableConnectConfig;
7
+ };
8
+ type ModuleOptions = Omit<VisualLinkerConfig, 'interaction'> & {
9
+ interaction?: SerializableInteractionConfig;
10
+ };
5
11
  declare const visualLinkerModule: NuxtModule<ModuleOptions>;
6
12
 
7
- export { type ModuleOptions, visualLinkerModule as default };
13
+ export { type ModuleOptions, type SerializableConnectConfig, type SerializableInteractionConfig, visualLinkerModule as default };
package/dist/module.js CHANGED
@@ -9,6 +9,12 @@ var visualLinkerModule = defineNuxtModule({
9
9
  const resolver = createResolver(import.meta.url);
10
10
  addComponent({ name: "VisualLinker", export: "VisualLinker", filePath: "@macrulez/visual-linker-vue" });
11
11
  addImports({ name: "useVisualLinker", from: "@macrulez/visual-linker-vue" });
12
+ const connect = options?.interaction?.connect;
13
+ if (typeof connect?.validate === "function") {
14
+ console.warn(
15
+ "[visual-linker] interaction.connect.validate cannot be set in the Nuxt module options (runtimeConfig is JSON only) and was dropped \u2014 pass it in the config of <VisualLinker> instead."
16
+ );
17
+ }
12
18
  nuxt.options.runtimeConfig.public.visualLinker = JSON.parse(JSON.stringify(options ?? {}));
13
19
  addPlugin(resolver.resolve("./runtime/plugin"));
14
20
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/module.ts"],"sourcesContent":["import { addComponent, addImports, addPlugin, createResolver, defineNuxtModule } from '@nuxt/kit'\nimport type { NuxtModule } from '@nuxt/schema'\nimport type { VisualLinkerConfig } from '@macrulez/visual-linker-vue'\n\nexport type ModuleOptions = VisualLinkerConfig\n\nconst visualLinkerModule: NuxtModule<ModuleOptions> = defineNuxtModule<ModuleOptions>({\n meta: {\n name: '@macrulez/visual-linker-nuxt',\n configKey: 'visualLinker',\n },\n setup(options, nuxt) {\n const resolver = createResolver(import.meta.url)\n\n addComponent({ name: 'VisualLinker', export: 'VisualLinker', filePath: '@macrulez/visual-linker-vue' })\n addImports({ name: 'useVisualLinker', from: '@macrulez/visual-linker-vue' })\n\n nuxt.options.runtimeConfig.public.visualLinker = JSON.parse(JSON.stringify(options ?? {}))\n\n addPlugin(resolver.resolve('./runtime/plugin'))\n },\n})\n\nexport default visualLinkerModule\n"],"mappings":";AAAA,SAAS,cAAc,YAAY,WAAW,gBAAgB,wBAAwB;AAMtF,IAAM,qBAAgD,iBAAgC;AAAA,EACpF,MAAM;AAAA,IACJ,MAAM;AAAA,IACN,WAAW;AAAA,EACb;AAAA,EACA,MAAM,SAAS,MAAM;AACnB,UAAM,WAAW,eAAe,YAAY,GAAG;AAE/C,iBAAa,EAAE,MAAM,gBAAgB,QAAQ,gBAAgB,UAAU,8BAA8B,CAAC;AACtG,eAAW,EAAE,MAAM,mBAAmB,MAAM,8BAA8B,CAAC;AAE3E,SAAK,QAAQ,cAAc,OAAO,eAAe,KAAK,MAAM,KAAK,UAAU,WAAW,CAAC,CAAC,CAAC;AAEzF,cAAU,SAAS,QAAQ,kBAAkB,CAAC;AAAA,EAChD;AACF,CAAC;AAED,IAAO,iBAAQ;","names":[]}
1
+ {"version":3,"sources":["../src/module.ts"],"sourcesContent":["import { addComponent, addImports, addPlugin, createResolver, defineNuxtModule } from '@nuxt/kit'\nimport type { NuxtModule } from '@nuxt/schema'\nimport type { ConnectConfig, InteractionConfig, VisualLinkerConfig } from '@macrulez/visual-linker-vue'\n\nexport type SerializableConnectConfig = Omit<ConnectConfig, 'validate'>\n\nexport type SerializableInteractionConfig = Omit<InteractionConfig, 'connect'> & {\n connect?: SerializableConnectConfig\n}\n\nexport type ModuleOptions = Omit<VisualLinkerConfig, 'interaction'> & {\n interaction?: SerializableInteractionConfig\n}\n\nconst visualLinkerModule: NuxtModule<ModuleOptions> = defineNuxtModule<ModuleOptions>({\n meta: {\n name: '@macrulez/visual-linker-nuxt',\n configKey: 'visualLinker',\n },\n setup(options, nuxt) {\n const resolver = createResolver(import.meta.url)\n\n addComponent({ name: 'VisualLinker', export: 'VisualLinker', filePath: '@macrulez/visual-linker-vue' })\n addImports({ name: 'useVisualLinker', from: '@macrulez/visual-linker-vue' })\n\n const connect = (options as { interaction?: { connect?: { validate?: unknown } } } | undefined)?.interaction\n ?.connect\n if (typeof connect?.validate === 'function') {\n console.warn(\n '[visual-linker] interaction.connect.validate cannot be set in the Nuxt module options (runtimeConfig is JSON only) and was dropped — pass it in the config of <VisualLinker> instead.',\n )\n }\n\n nuxt.options.runtimeConfig.public.visualLinker = JSON.parse(JSON.stringify(options ?? {}))\n\n addPlugin(resolver.resolve('./runtime/plugin'))\n },\n})\n\nexport default visualLinkerModule\n"],"mappings":";AAAA,SAAS,cAAc,YAAY,WAAW,gBAAgB,wBAAwB;AActF,IAAM,qBAAgD,iBAAgC;AAAA,EACpF,MAAM;AAAA,IACJ,MAAM;AAAA,IACN,WAAW;AAAA,EACb;AAAA,EACA,MAAM,SAAS,MAAM;AACnB,UAAM,WAAW,eAAe,YAAY,GAAG;AAE/C,iBAAa,EAAE,MAAM,gBAAgB,QAAQ,gBAAgB,UAAU,8BAA8B,CAAC;AACtG,eAAW,EAAE,MAAM,mBAAmB,MAAM,8BAA8B,CAAC;AAE3E,UAAM,UAAW,SAAgF,aAC7F;AACJ,QAAI,OAAO,SAAS,aAAa,YAAY;AAC3C,cAAQ;AAAA,QACN;AAAA,MACF;AAAA,IACF;AAEA,SAAK,QAAQ,cAAc,OAAO,eAAe,KAAK,MAAM,KAAK,UAAU,WAAW,CAAC,CAAC,CAAC;AAEzF,cAAU,SAAS,QAAQ,kBAAkB,CAAC;AAAA,EAChD;AACF,CAAC;AAED,IAAO,iBAAQ;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@macrulez/visual-linker-nuxt",
3
- "version": "0.4.3",
3
+ "version": "0.4.5",
4
4
  "description": "Nuxt module wrapping @macrulez/visual-linker-vue: auto-imported <VisualLinker> and useVisualLinker, module options for default curve/port rendering",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -25,7 +25,7 @@
25
25
  },
26
26
  "dependencies": {
27
27
  "@nuxt/kit": "^4.5.2",
28
- "@macrulez/visual-linker-vue": "0.4.3"
28
+ "@macrulez/visual-linker-vue": "0.4.5"
29
29
  },
30
30
  "devDependencies": {
31
31
  "@nuxt/schema": "^4.5.2",