@leavepulse/ui 0.22.6 → 0.22.8

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.
@@ -1,4 +1,4 @@
1
- import { defineComponent, markRaw, computed, watch, openBlock, createBlock, unref, withCtx, createVNode, normalizeClass, createElementVNode, createElementBlock, Fragment, renderList, createTextVNode, toDisplayString, createCommentVNode } from "vue";
1
+ import { defineComponent, markRaw, computed, watch, openBlock, createBlock, unref, withCtx, createVNode, createCommentVNode, normalizeClass, createElementVNode, createElementBlock, Fragment, renderList, createTextVNode, toDisplayString } from "vue";
2
2
  import { Background } from "@vue-flow/background";
3
3
  import { Controls } from "@vue-flow/controls";
4
4
  import { MarkerType, useVueFlow, VueFlow, SelectionMode, Panel } from "@vue-flow/core";
@@ -23,7 +23,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
23
23
  selectable: { type: Boolean, default: false },
24
24
  legend: { type: Boolean, default: true },
25
25
  legendPosition: { default: "bottom-left" },
26
- lanes: { default: () => [] }
26
+ legendLabels: {},
27
+ lanes: { default: () => [] },
28
+ minimap: { type: Boolean, default: true },
29
+ controls: { type: Boolean, default: true }
27
30
  },
28
31
  emits: ["connect", "node-select", "node-contextmenu", "edge-contextmenu", "pane-click", "selection-change", "update:nodes", "node-drag-stop", "viewport-change"],
29
32
  setup(__props, { expose: __expose, emit: __emit }) {
@@ -156,12 +159,17 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
156
159
  if (props.legendPosition === "bottom-right") return "!bottom-40";
157
160
  return "";
158
161
  });
159
- const legendItems = [
160
- { label: "Network", color: CATEGORY_COLOR.network, width: 2, dash: "0" },
161
- { label: "Depends-on", color: CATEGORY_COLOR.structural, width: 1.5, dash: "1 5" },
162
- { label: "Pending", color: "var(--color-brand)", width: 2, dash: "6 5" },
163
- { label: "Drift", color: "var(--color-danger)", width: 2, dash: "6 5" }
164
- ];
162
+ const legendItems = computed(() => [
163
+ { label: props.legendLabels?.network ?? "Network", color: CATEGORY_COLOR.network, width: 2, dash: "0" },
164
+ {
165
+ label: props.legendLabels?.structural ?? "Depends-on",
166
+ color: CATEGORY_COLOR.structural,
167
+ width: 1.5,
168
+ dash: "1 5"
169
+ },
170
+ { label: props.legendLabels?.pending ?? "Pending", color: "var(--color-brand)", width: 2, dash: "6 5" },
171
+ { label: props.legendLabels?.drift ?? "Drift", color: "var(--color-danger)", width: 2, dash: "6 5" }
172
+ ]);
165
173
  onEdgeContextMenu(({ edge, event }) => {
166
174
  const e = event;
167
175
  e.preventDefault?.();
@@ -196,22 +204,23 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
196
204
  size: 1.4,
197
205
  "pattern-color": "var(--color-line-strong)"
198
206
  }),
199
- createVNode(unref(MiniMap), {
207
+ __props.minimap ? (openBlock(), createBlock(unref(MiniMap), {
208
+ key: 0,
200
209
  pannable: "",
201
210
  zoomable: "",
202
211
  "node-color": "var(--color-surface-soft)",
203
212
  "mask-color": "rgba(0,0,0,0.55)"
204
- }),
205
- createVNode(unref(Controls)),
213
+ })) : createCommentVNode("", true),
214
+ __props.controls ? (openBlock(), createBlock(unref(Controls), { key: 1 })) : createCommentVNode("", true),
206
215
  __props.legend ? (openBlock(), createBlock(unref(Panel), {
207
- key: 0,
216
+ key: 2,
208
217
  position: __props.legendPosition,
209
218
  class: normalizeClass(legendOffset.value)
210
219
  }, {
211
220
  default: withCtx(() => [
212
221
  createElementVNode("div", _hoisted_1, [
213
- (openBlock(), createElementBlock(Fragment, null, renderList(legendItems, (l) => {
214
- return createElementVNode("div", {
222
+ (openBlock(true), createElementBlock(Fragment, null, renderList(legendItems.value, (l) => {
223
+ return openBlock(), createElementBlock("div", {
215
224
  key: l.label,
216
225
  class: "flex items-center gap-2 text-muted"
217
226
  }, [
@@ -229,7 +238,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
229
238
  ])),
230
239
  createTextVNode(" " + toDisplayString(l.label), 1)
231
240
  ]);
232
- }), 64))
241
+ }), 128))
233
242
  ])
234
243
  ]),
235
244
  _: 1
@@ -90,11 +90,20 @@ type __VLS_Props = {
90
90
  * minimap owns the bottom-right.
91
91
  */
92
92
  legendPosition?: "top-left" | "top-right" | "bottom-left" | "bottom-right";
93
+ /** Rename legend rows to match what this graph's edges actually mean. */
94
+ legendLabels?: Partial<Record<"network" | "structural" | "pending" | "drift", string>>;
93
95
  /**
94
96
  * Background swimlanes drawn beneath the nodes (one per project / overlay).
95
97
  * Non-interactive; pan/zoom with the graph. Empty = no lanes.
96
98
  */
97
99
  lanes?: TopologyLane[];
100
+ /**
101
+ * Minimap and zoom controls. On by default — a full-page map needs both —
102
+ * but a graph embedded at a few hundred pixels has nothing to navigate, and
103
+ * the overlays then cover a real share of the picture.
104
+ */
105
+ minimap?: boolean;
106
+ controls?: boolean;
98
107
  };
99
108
  declare function applyViewport(v: CanvasViewport): Promise<void>;
100
109
  declare const __VLS_export: import('vue').DefineComponent<__VLS_Props, {
@@ -158,10 +167,12 @@ declare const __VLS_export: import('vue').DefineComponent<__VLS_Props, {
158
167
  }) => any) | undefined;
159
168
  }>, {
160
169
  legend: boolean;
170
+ controls: boolean;
161
171
  connectable: boolean;
162
172
  selectable: boolean;
163
173
  legendPosition: "top-left" | "top-right" | "bottom-left" | "bottom-right";
164
174
  lanes: TopologyLane[];
175
+ minimap: boolean;
165
176
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
166
177
  declare const _default: typeof __VLS_export;
167
178
  export default _default;
@@ -1,4 +1,4 @@
1
- import { _ as _sfc_main } from "../chunks/LpTopologyCanvas-BsJWyacK.js";
1
+ import { _ as _sfc_main } from "../chunks/LpTopologyCanvas-B4tPWXFW.js";
2
2
  export {
3
3
  _sfc_main as default
4
4
  };
package/dist/index.js CHANGED
@@ -64,7 +64,7 @@ import { D, _ as _56, N, T, b, c, d, e, f, g, i, l, h, j, n, r, t, k, m, u, v }
64
64
  import { _ as _57 } from "./chunks/LpTilt-DuyKbpkA.js";
65
65
  import { _ as _58 } from "./chunks/LpToaster-gDB1EaU3.js";
66
66
  import { _ as _59 } from "./chunks/LpTooltip-D1hbjQWG.js";
67
- import { _ as _60 } from "./chunks/LpTopologyCanvas-BsJWyacK.js";
67
+ import { _ as _60 } from "./chunks/LpTopologyCanvas-B4tPWXFW.js";
68
68
  import { _ as _61 } from "./chunks/LpUptimeBar-CB366k0O.js";
69
69
  import { deserializeLayout, serializeLayout } from "./layout/tree.js";
70
70
  import { addLeaf, addTab, countBlocks, countLeaves, makeLayout, moveLeaf, removeBlock, removeLeaf, reorderTab, resizeAt, setActiveTab } from "./layout/tree.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leavepulse/ui",
3
- "version": "0.22.6",
3
+ "version": "0.22.8",
4
4
  "type": "module",
5
5
  "description": "LeavePulse token-driven Vue component kit.",
6
6
  "repository": {
@@ -125,11 +125,22 @@ const props = withDefaults(
125
125
  * minimap owns the bottom-right.
126
126
  */
127
127
  legendPosition?: "top-left" | "top-right" | "bottom-left" | "bottom-right"
128
+ /** Rename legend rows to match what this graph's edges actually mean. */
129
+ legendLabels?: Partial<
130
+ Record<"network" | "structural" | "pending" | "drift", string>
131
+ >
128
132
  /**
129
133
  * Background swimlanes drawn beneath the nodes (one per project / overlay).
130
134
  * Non-interactive; pan/zoom with the graph. Empty = no lanes.
131
135
  */
132
136
  lanes?: TopologyLane[]
137
+ /**
138
+ * Minimap and zoom controls. On by default — a full-page map needs both —
139
+ * but a graph embedded at a few hundred pixels has nothing to navigate, and
140
+ * the overlays then cover a real share of the picture.
141
+ */
142
+ minimap?: boolean
143
+ controls?: boolean
133
144
  }>(),
134
145
  {
135
146
  connectable: false,
@@ -137,6 +148,8 @@ const props = withDefaults(
137
148
  legend: true,
138
149
  legendPosition: "bottom-left",
139
150
  lanes: () => [],
151
+ minimap: true,
152
+ controls: true,
140
153
  },
141
154
  )
142
155
 
@@ -318,12 +331,20 @@ const legendOffset = computed(() => {
318
331
  })
319
332
 
320
333
  // Legend rows mirror the edge encoding exactly (same colours/dashes).
321
- const legendItems = [
322
- { label: "Network", color: CATEGORY_COLOR.network, width: 2, dash: "0" },
323
- { label: "Depends-on", color: CATEGORY_COLOR.structural, width: 1.5, dash: "1 5" },
324
- { label: "Pending", color: "var(--color-brand)", width: 2, dash: "6 5" },
325
- { label: "Drift", color: "var(--color-danger)", width: 2, dash: "6 5" },
326
- ] as const
334
+ // What each encoding MEANS depends on what the host is drawing: the same solid
335
+ // line is a transport on a machine graph and a call on a service graph, so
336
+ // "Network" would be wrong half the time. `legendLabels` renames any row.
337
+ const legendItems = computed(() => [
338
+ { label: props.legendLabels?.network ?? "Network", color: CATEGORY_COLOR.network, width: 2, dash: "0" },
339
+ {
340
+ label: props.legendLabels?.structural ?? "Depends-on",
341
+ color: CATEGORY_COLOR.structural,
342
+ width: 1.5,
343
+ dash: "1 5",
344
+ },
345
+ { label: props.legendLabels?.pending ?? "Pending", color: "var(--color-brand)", width: 2, dash: "6 5" },
346
+ { label: props.legendLabels?.drift ?? "Drift", color: "var(--color-danger)", width: 2, dash: "6 5" },
347
+ ])
327
348
 
328
349
  onEdgeContextMenu(({ edge, event }) => {
329
350
  // Right-click an edge → host renders edge actions (change transport, remove…).
@@ -361,8 +382,14 @@ defineExpose({ fitView, setViewport: applyViewport })
361
382
  class="lp-topology"
362
383
  >
363
384
  <Background :gap="22" :size="1.4" pattern-color="var(--color-line-strong)" />
364
- <MiniMap pannable zoomable node-color="var(--color-surface-soft)" mask-color="rgba(0,0,0,0.55)" />
365
- <Controls />
385
+ <MiniMap
386
+ v-if="minimap"
387
+ pannable
388
+ zoomable
389
+ node-color="var(--color-surface-soft)"
390
+ mask-color="rgba(0,0,0,0.55)"
391
+ />
392
+ <Controls v-if="controls" />
366
393
 
367
394
  <!-- Edge-type legend: makes the colour/dash encoding self-explanatory. -->
368
395
  <Panel v-if="legend" :position="legendPosition" :class="legendOffset">