@macrulez/visual-linker-nuxt 0.1.0 → 0.3.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/README.md CHANGED
@@ -17,6 +17,7 @@ monorepo.
17
17
  ## Features
18
18
 
19
19
  - **Auto-imports `<VisualLinker>` and `useVisualLinker`** — registered/imported from `@macrulez/visual-linker-vue`, no explicit `import` anywhere in your app
20
+ - **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
21
  - **Module options forwarded through `runtimeConfig`** — `defaultCurve`, `showPorts`, curve-geometry and port/marker-size knobs, `dragGridSize` — set once in `nuxt.config.ts`, applied everywhere
21
22
  - **A client-only plugin seeds those defaults** — reads the runtime config and calls `setVisualLinkerDefaults(...)` once, on the client
22
23
  - **Nothing needs `<ClientOnly>`** — the component/composable are SSR-safe on their own; this module's client-only-ness is only about _when_ the defaults get applied
@@ -61,10 +62,8 @@ Once the module is registered, just use the component — no imports:
61
62
 
62
63
  ```vue
63
64
  <template>
64
- <VisualLinker :blocks="blocks" :connections="connections">
65
- <template v-for="b in blocks" #[`block-${b.id}`]="{}" :key="b.id">
66
- <div class="card">{{ b.id }}</div>
67
- </template>
65
+ <VisualLinker :connections="connections">
66
+ <div v-for="b in blocks" :key="b.id" v-vl-block="b.id" class="card">{{ b.id }}</div>
68
67
  </VisualLinker>
69
68
  </template>
70
69
  ```
@@ -79,7 +78,8 @@ for the full component/composable API.
79
78
 
80
79
  1. **Auto-imports** `<VisualLinker>` as a global component and `useVisualLinker` as an auto-import, both sourced from `@macrulez/visual-linker-vue` — no explicit `import` needed in your components.
81
80
  2. **Forwards module options** into `runtimeConfig.public.visualLinker`.
82
- 3. **Registers a client-only plugin** (`runtime/plugin.client.ts`) that reads that runtime config and calls `setVisualLinkerDefaults(...)` — so every `<VisualLinker>`/`useVisualLinker()` use that doesn't pass its own `options` picks up your configured defaults.
81
+ 3. **Registers the `v-vl-block` / `v-vl-port` directives** in a universal plugin (`runtime/plugin.ts`) — on the server too, so the `data-vl-*` attributes are already in the SSR markup.
82
+ 4. **Registers a client-only plugin** (`runtime/plugin.client.ts`) that reads that runtime config and calls `setVisualLinkerDefaults(...)` — so every `<VisualLinker>`/`useVisualLinker()` use that doesn't pass its own `options` picks up your configured defaults.
83
83
 
84
84
  No `defaults` are hardcoded in the module itself — a field left unset in
85
85
  `nuxt.config.ts` falls all the way through to
@@ -88,14 +88,19 @@ to core's default is never silently shadowed by this module.
88
88
 
89
89
  #### Module options
90
90
 
91
- | Option | Mirrors | |
92
- | ------------------------------------------------------------------------------------------- | -------------------------------------- | ---------------------------------------- |
93
- | `defaultCurve` | `VisualLinkerOptions.defaultCurve` | `'bezier' \| 'straight' \| 'smoothstep'` |
94
- | `showPorts` | `VisualLinkerOptions.showPorts` | |
95
- | `curvature` / `curveMinReach` / `curveMaxReach` / `curveAngleBlend` / `curveAngleMaxOffset` | matching `defaultCurveXxx` fields | bezier geometry |
96
- | `dragGridSize` | `VisualLinkerOptions.dragGridSize` | |
97
- | `portRadius` / `portColor` / `portStrokeColor` / `portStrokeWidth` | matching `defaultPortXxx` fields | built-in port dot look |
98
- | `circleMarkerSize` / `squareMarkerSize` / `diamondMarkerSize` / `arrowMarkerSize` | matching `defaultXxxMarkerSize` fields | |
91
+ | Option | Mirrors | |
92
+ | ------------------------------------------------------------------------------------------- | -------------------------------------------------------- | ------------------------------------------------ |
93
+ | `defaultCurve` | `VisualLinkerOptions.defaultCurve` | `'bezier' \| 'straight' \| 'smoothstep'` |
94
+ | `showPorts` | `VisualLinkerOptions.showPorts` | |
95
+ | `curvature` / `curveMinReach` / `curveMaxReach` / `curveAngleBlend` / `curveAngleMaxOffset` | matching `defaultCurveXxx` fields | bezier geometry |
96
+ | `dragGridSize` | `VisualLinkerOptions.dragGridSize` | |
97
+ | `portRadius` / `portColor` / `portStrokeColor` / `portStrokeWidth` | matching `defaultPortXxx` fields | built-in port dot look |
98
+ | `circleMarkerSize` / `squareMarkerSize` / `diamondMarkerSize` / `arrowMarkerSize` | matching `defaultXxxMarkerSize` fields | |
99
+ | `portSpread` | `VisualLinkerOptions.defaultPortSpread` | `true` or `{ gap, padding }` |
100
+ | `jumps` | `VisualLinkerOptions.jumps` | `true` or `{ radius }` — hop over crossing lines |
101
+ | `avoidObstacles` / `obstaclePadding` | `VisualLinkerOptions.avoidObstacles` / `obstaclePadding` | route `smoothstep` around other blocks |
102
+ | `animated` | `VisualLinkerOptions.defaultAnimated` | `true` or a `ConnectionFlow` object |
103
+ | `clipToScrollParents` | `VisualLinkerOptions.clipToScrollParents` | `true` / `'pin'` / `'hide'` / `false` |
99
104
 
100
105
  **Not covered by module options** (set these directly on
101
106
  `<VisualLinker :options="...">`/`useVisualLinker()` instead):
package/dist/module.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { NuxtModule } from '@nuxt/schema';
2
- import { ConnectionCurve } from '@macrulez/visual-linker-vue';
2
+ import { ConnectionCurve, ConnectionFlow } from '@macrulez/visual-linker-vue';
3
3
 
4
4
  interface ModuleOptions {
5
5
  /** Falls through to @macrulez/visual-linker-core's own default (VLConnectionCurveEnum.BEZIER) when unset. */
@@ -23,6 +23,23 @@ interface ModuleOptions {
23
23
  squareMarkerSize?: number;
24
24
  diamondMarkerSize?: number;
25
25
  arrowMarkerSize?: number;
26
+ /** Spreads connections sharing a port side into separate virtual ports — `true`, `{ gap, padding }`, or unset (off). */
27
+ portSpread?: boolean | {
28
+ gap?: number;
29
+ padding?: number;
30
+ };
31
+ /** What to do with a connection end scrolled out of a clipping ancestor: `'pin'` (`true`, default) to the visible edge, `'hide'` the connection, `false` ignore. */
32
+ clipToScrollParents?: boolean | 'pin' | 'hide';
33
+ /** Animated flow along every connection by default — `true` or a `ConnectionFlow` object; a connection can opt out with `animated: false`. */
34
+ animated?: boolean | ConnectionFlow;
35
+ /** Route `smoothstep` connections around the other blocks instead of through them. */
36
+ avoidObstacles?: boolean;
37
+ /** Clearance kept between a routed line and every other block, px. */
38
+ obstaclePadding?: number;
39
+ /** Hop over crossing lines (`smoothstep`): `true` or `{ radius }`. */
40
+ jumps?: boolean | {
41
+ radius?: number;
42
+ };
26
43
  }
27
44
  declare const visualLinkerModule: NuxtModule<ModuleOptions>;
28
45
 
package/dist/module.js CHANGED
@@ -30,8 +30,15 @@ var visualLinkerModule = defineNuxtModule({
30
30
  defaultCircleMarkerSize: options.circleMarkerSize,
31
31
  defaultSquareMarkerSize: options.squareMarkerSize,
32
32
  defaultDiamondMarkerSize: options.diamondMarkerSize,
33
- defaultArrowMarkerSize: options.arrowMarkerSize
33
+ defaultArrowMarkerSize: options.arrowMarkerSize,
34
+ defaultPortSpread: options.portSpread,
35
+ clipToScrollParents: options.clipToScrollParents,
36
+ defaultAnimated: options.animated,
37
+ avoidObstacles: options.avoidObstacles,
38
+ obstaclePadding: options.obstaclePadding,
39
+ jumps: options.jumps
34
40
  };
41
+ addPlugin(resolver.resolve("./runtime/plugin"));
35
42
  addPlugin(resolver.resolve("./runtime/plugin.client"));
36
43
  }
37
44
  });
@@ -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 { ConnectionCurve } from '@macrulez/visual-linker-vue'\n\nexport interface ModuleOptions {\n /** Falls through to @macrulez/visual-linker-core's own default (VLConnectionCurveEnum.BEZIER) when unset. */\n defaultCurve?: ConnectionCurve\n /** Falls through to @macrulez/visual-linker-core's own default (true) when unset. */\n showPorts?: boolean\n curvature?: number\n curveMinReach?: number\n curveMaxReach?: number\n curveAngleBlend?: number\n curveAngleMaxOffset?: number\n /** Snaps every draggable block to this px grid while dragging. Falls through to no snapping when unset. */\n dragGridSize?: number\n /** Instance-wide look for the built-in port dot — falls through to @macrulez/visual-linker-core's own defaults (params.ts) when unset. */\n portRadius?: number\n portColor?: string\n portStrokeColor?: string\n portStrokeWidth?: number\n /** Instance-wide default marker size per built-in shape — falls through to @macrulez/visual-linker-core's own defaults (params.ts) when unset. */\n circleMarkerSize?: number\n squareMarkerSize?: number\n diamondMarkerSize?: number\n arrowMarkerSize?: number\n}\n\nconst visualLinkerModule: NuxtModule<ModuleOptions> = defineNuxtModule<ModuleOptions>({\n meta: {\n name: '@macrulez/visual-linker-nuxt',\n configKey: 'visualLinker',\n },\n // No `defaults` here on purpose: an option the user didn't set in\n // nuxt.config.ts must stay `undefined` all the way through to\n // @macrulez/visual-linker-core's own defaults (params.ts) — hardcoding one\n // here would silently shadow it, making a change to core's default look\n // like it does nothing for a Nuxt consumer.\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 = {\n defaultCurve: options.defaultCurve,\n showPorts: options.showPorts,\n defaultCurvature: options.curvature,\n defaultCurveMinReach: options.curveMinReach,\n defaultCurveMaxReach: options.curveMaxReach,\n defaultCurveAngleBlend: options.curveAngleBlend,\n defaultCurveAngleMaxOffset: options.curveAngleMaxOffset,\n dragGridSize: options.dragGridSize,\n defaultPortRadius: options.portRadius,\n defaultPortColor: options.portColor,\n defaultPortStrokeColor: options.portStrokeColor,\n defaultPortStrokeWidth: options.portStrokeWidth,\n defaultCircleMarkerSize: options.circleMarkerSize,\n defaultSquareMarkerSize: options.squareMarkerSize,\n defaultDiamondMarkerSize: options.diamondMarkerSize,\n defaultArrowMarkerSize: options.arrowMarkerSize,\n }\n\n // Applies module options on the client only — <VisualLinker>/useVisualLinker\n // are already SSR-safe no-ops, this just seeds their shared client-side defaults.\n addPlugin(resolver.resolve('./runtime/plugin.client'))\n },\n})\n\nexport default visualLinkerModule\n"],"mappings":";AAAA,SAAS,cAAc,YAAY,WAAW,gBAAgB,wBAAwB;AA4BtF,IAAM,qBAAgD,iBAAgC;AAAA,EACpF,MAAM;AAAA,IACJ,MAAM;AAAA,IACN,WAAW;AAAA,EACb;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,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;AAAA,MAC/C,cAAc,QAAQ;AAAA,MACtB,WAAW,QAAQ;AAAA,MACnB,kBAAkB,QAAQ;AAAA,MAC1B,sBAAsB,QAAQ;AAAA,MAC9B,sBAAsB,QAAQ;AAAA,MAC9B,wBAAwB,QAAQ;AAAA,MAChC,4BAA4B,QAAQ;AAAA,MACpC,cAAc,QAAQ;AAAA,MACtB,mBAAmB,QAAQ;AAAA,MAC3B,kBAAkB,QAAQ;AAAA,MAC1B,wBAAwB,QAAQ;AAAA,MAChC,wBAAwB,QAAQ;AAAA,MAChC,yBAAyB,QAAQ;AAAA,MACjC,yBAAyB,QAAQ;AAAA,MACjC,0BAA0B,QAAQ;AAAA,MAClC,wBAAwB,QAAQ;AAAA,IAClC;AAIA,cAAU,SAAS,QAAQ,yBAAyB,CAAC;AAAA,EACvD;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 { ConnectionCurve, ConnectionFlow } from '@macrulez/visual-linker-vue'\n\nexport interface ModuleOptions {\n /** Falls through to @macrulez/visual-linker-core's own default (VLConnectionCurveEnum.BEZIER) when unset. */\n defaultCurve?: ConnectionCurve\n /** Falls through to @macrulez/visual-linker-core's own default (true) when unset. */\n showPorts?: boolean\n curvature?: number\n curveMinReach?: number\n curveMaxReach?: number\n curveAngleBlend?: number\n curveAngleMaxOffset?: number\n /** Snaps every draggable block to this px grid while dragging. Falls through to no snapping when unset. */\n dragGridSize?: number\n /** Instance-wide look for the built-in port dot — falls through to @macrulez/visual-linker-core's own defaults (params.ts) when unset. */\n portRadius?: number\n portColor?: string\n portStrokeColor?: string\n portStrokeWidth?: number\n /** Instance-wide default marker size per built-in shape — falls through to @macrulez/visual-linker-core's own defaults (params.ts) when unset. */\n circleMarkerSize?: number\n squareMarkerSize?: number\n diamondMarkerSize?: number\n arrowMarkerSize?: number\n /** Spreads connections sharing a port side into separate virtual ports — `true`, `{ gap, padding }`, or unset (off). */\n portSpread?: boolean | { gap?: number; padding?: number }\n /** What to do with a connection end scrolled out of a clipping ancestor: `'pin'` (`true`, default) to the visible edge, `'hide'` the connection, `false` ignore. */\n clipToScrollParents?: boolean | 'pin' | 'hide'\n /** Animated flow along every connection by default — `true` or a `ConnectionFlow` object; a connection can opt out with `animated: false`. */\n animated?: boolean | ConnectionFlow\n /** Route `smoothstep` connections around the other blocks instead of through them. */\n avoidObstacles?: boolean\n /** Clearance kept between a routed line and every other block, px. */\n obstaclePadding?: number\n /** Hop over crossing lines (`smoothstep`): `true` or `{ radius }`. */\n jumps?: boolean | { radius?: number }\n}\n\nconst visualLinkerModule: NuxtModule<ModuleOptions> = defineNuxtModule<ModuleOptions>({\n meta: {\n name: '@macrulez/visual-linker-nuxt',\n configKey: 'visualLinker',\n },\n // No `defaults` here on purpose: an option the user didn't set in\n // nuxt.config.ts must stay `undefined` all the way through to\n // @macrulez/visual-linker-core's own defaults (params.ts) — hardcoding one\n // here would silently shadow it, making a change to core's default look\n // like it does nothing for a Nuxt consumer.\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 = {\n defaultCurve: options.defaultCurve,\n showPorts: options.showPorts,\n defaultCurvature: options.curvature,\n defaultCurveMinReach: options.curveMinReach,\n defaultCurveMaxReach: options.curveMaxReach,\n defaultCurveAngleBlend: options.curveAngleBlend,\n defaultCurveAngleMaxOffset: options.curveAngleMaxOffset,\n dragGridSize: options.dragGridSize,\n defaultPortRadius: options.portRadius,\n defaultPortColor: options.portColor,\n defaultPortStrokeColor: options.portStrokeColor,\n defaultPortStrokeWidth: options.portStrokeWidth,\n defaultCircleMarkerSize: options.circleMarkerSize,\n defaultSquareMarkerSize: options.squareMarkerSize,\n defaultDiamondMarkerSize: options.diamondMarkerSize,\n defaultArrowMarkerSize: options.arrowMarkerSize,\n defaultPortSpread: options.portSpread,\n clipToScrollParents: options.clipToScrollParents,\n defaultAnimated: options.animated,\n avoidObstacles: options.avoidObstacles,\n obstaclePadding: options.obstaclePadding,\n jumps: options.jumps,\n }\n\n // Registers v-vl-block / v-vl-port on both server and client.\n addPlugin(resolver.resolve('./runtime/plugin'))\n // Applies module options on the client only — <VisualLinker>/useVisualLinker\n // are already SSR-safe no-ops, this just seeds their shared client-side defaults.\n addPlugin(resolver.resolve('./runtime/plugin.client'))\n },\n})\n\nexport default visualLinkerModule\n"],"mappings":";AAAA,SAAS,cAAc,YAAY,WAAW,gBAAgB,wBAAwB;AAwCtF,IAAM,qBAAgD,iBAAgC;AAAA,EACpF,MAAM;AAAA,IACJ,MAAM;AAAA,IACN,WAAW;AAAA,EACb;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,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;AAAA,MAC/C,cAAc,QAAQ;AAAA,MACtB,WAAW,QAAQ;AAAA,MACnB,kBAAkB,QAAQ;AAAA,MAC1B,sBAAsB,QAAQ;AAAA,MAC9B,sBAAsB,QAAQ;AAAA,MAC9B,wBAAwB,QAAQ;AAAA,MAChC,4BAA4B,QAAQ;AAAA,MACpC,cAAc,QAAQ;AAAA,MACtB,mBAAmB,QAAQ;AAAA,MAC3B,kBAAkB,QAAQ;AAAA,MAC1B,wBAAwB,QAAQ;AAAA,MAChC,wBAAwB,QAAQ;AAAA,MAChC,yBAAyB,QAAQ;AAAA,MACjC,yBAAyB,QAAQ;AAAA,MACjC,0BAA0B,QAAQ;AAAA,MAClC,wBAAwB,QAAQ;AAAA,MAChC,mBAAmB,QAAQ;AAAA,MAC3B,qBAAqB,QAAQ;AAAA,MAC7B,iBAAiB,QAAQ;AAAA,MACzB,gBAAgB,QAAQ;AAAA,MACxB,iBAAiB,QAAQ;AAAA,MACzB,OAAO,QAAQ;AAAA,IACjB;AAGA,cAAU,SAAS,QAAQ,kBAAkB,CAAC;AAG9C,cAAU,SAAS,QAAQ,yBAAyB,CAAC;AAAA,EACvD;AACF,CAAC;AAED,IAAO,iBAAQ;","names":[]}
@@ -0,0 +1,5 @@
1
+ import * as nuxt_app from 'nuxt/app';
2
+
3
+ declare const _default: nuxt_app.Plugin<Record<string, unknown>> & nuxt_app.ObjectPlugin<Record<string, unknown>>;
4
+
5
+ export { _default as default };
@@ -0,0 +1,11 @@
1
+ // src/runtime/plugin.ts
2
+ import { vVlBlock, vVlPort } from "@macrulez/visual-linker-vue";
3
+ import { defineNuxtPlugin } from "nuxt/app";
4
+ var plugin_default = defineNuxtPlugin((nuxtApp) => {
5
+ nuxtApp.vueApp.directive("vl-block", vVlBlock);
6
+ nuxtApp.vueApp.directive("vl-port", vVlPort);
7
+ });
8
+ export {
9
+ plugin_default as default
10
+ };
11
+ //# sourceMappingURL=plugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/runtime/plugin.ts"],"sourcesContent":["import { vVlBlock, vVlPort } from '@macrulez/visual-linker-vue'\nimport { defineNuxtPlugin } from 'nuxt/app'\n\n// Universal (not client-only): the directives' getSSRProps put the\n// data-vl-* discovery attributes straight into server-rendered markup.\nexport default defineNuxtPlugin((nuxtApp) => {\n nuxtApp.vueApp.directive('vl-block', vVlBlock)\n nuxtApp.vueApp.directive('vl-port', vVlPort)\n})\n"],"mappings":";AAAA,SAAS,UAAU,eAAe;AAClC,SAAS,wBAAwB;AAIjC,IAAO,iBAAQ,iBAAiB,CAAC,YAAY;AAC3C,UAAQ,OAAO,UAAU,YAAY,QAAQ;AAC7C,UAAQ,OAAO,UAAU,WAAW,OAAO;AAC7C,CAAC;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@macrulez/visual-linker-nuxt",
3
- "version": "0.1.0",
3
+ "version": "0.3.0",
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.1.0"
28
+ "@macrulez/visual-linker-vue": "0.3.0"
29
29
  },
30
30
  "devDependencies": {
31
31
  "@nuxt/schema": "^4.5.2",