@cjlapao/ui-kit-vue 0.2.6 → 0.2.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.
@@ -0,0 +1,4 @@
1
+ import type { ConnectionFlowLayoutOptions, LaidOutConnector, LaidOutEdge, LaidOutNode } from "./types";
2
+ /** Allocate one terminal per edge endpoint. Overflow uses the nearest free side;
3
+ * each route reserves its own lane, including fan-in and fan-out connections. */
4
+ export declare function separateAnchors(nodes: LaidOutNode[], edges: LaidOutEdge[], connectors: Map<string, LaidOutConnector>, options: ConnectionFlowLayoutOptions): void;
@@ -0,0 +1,21 @@
1
+ import { type ConnectionFlowLayoutOptions, type LaidOutConnector, type LaidOutEdge, type LaidOutNode } from "./types";
2
+ /** Conservative glyph advances at the renderer's fixed 10px font size. */
3
+ export declare const captionTextWidth: (text: string) => number;
4
+ export declare function wrapCaption(text: string, width: number): string[];
5
+ /** Captions own real corridor area, not a rectangle painted over the board.
6
+ * Place labelled routes in order, reserve their bounds, then route unlabelled
7
+ * paths around them. Previously placed captions never move under a later edge.
8
+ */
9
+ export declare function layoutCaptions(nodes: LaidOutNode[], edges: LaidOutEdge[], connectors: Map<string, LaidOutConnector>, options: ConnectionFlowLayoutOptions): void;
10
+ /** Per-node seam budgets. A retry reserves the seam on the side of its
11
+ * target; a normal connector reserves the seam before its destination. */
12
+ export declare function captionSpacing(nodes: readonly import("./types").ConnectionFlowNode[], options: ConnectionFlowLayoutOptions): {
13
+ before: Map<string, {
14
+ horizontal: number;
15
+ vertical: number;
16
+ }>;
17
+ after: Map<string, {
18
+ horizontal: number;
19
+ vertical: number;
20
+ }>;
21
+ };
@@ -1,4 +1,4 @@
1
- import { type ConnectionFlowLayout, type ConnectionFlowLayoutOptions, type ConnectionFlowNode, type ConnectionState, type LaidOutNode } from "./types";
1
+ import { type ConnectionFlowConnection, type ConnectionFlowLayout, type ConnectionFlowLayoutOptions, type ConnectionFlowNode, type ConnectionState, type LaidOutNode } from "./types";
2
2
  /**
3
3
  * A column on the main track: one `step`/`branch` node, or a stack of
4
4
  * consecutive `parallel` ones.
@@ -26,6 +26,8 @@ export declare const buildColumns: (nodes: ConnectionFlowNode[]) => Column[];
26
26
  export declare const resolveSkipped: (columns: Column[], autoSkip: boolean) => Set<number>;
27
27
  export interface LayoutInput {
28
28
  nodes: ConnectionFlowNode[];
29
+ /** When supplied, draw only these connections, including an empty array. */
30
+ connections?: readonly ConnectionFlowConnection[];
29
31
  options?: Partial<ConnectionFlowLayoutOptions>;
30
32
  /** Fallback state for edges that do not declare one. */
31
33
  flowState?: ConnectionState;
@@ -88,6 +88,11 @@ export interface Route {
88
88
  d: string;
89
89
  }
90
90
  export declare const routePorts: (fromPort: Port, toPort: Port, options: RouteOptions) => Route;
91
+ /** Rebuild an existing corridor after moving a terminal along its side. */
92
+ export declare const routePolyline: (points: {
93
+ x: number;
94
+ y: number;
95
+ }[], style: ConnectionFlowEdgeStyle, radius: number) => Route;
91
96
  /** Total length of a waypoint list. */
92
97
  export declare const routeLength: (points: {
93
98
  x: number;
@@ -129,3 +134,113 @@ export declare const labelAnchor: (points: {
129
134
  x: number;
130
135
  y: number;
131
136
  };
137
+ /** One end of a route, with the card it must connect to. */
138
+ export interface PathEndpoint {
139
+ box: Box;
140
+ /**
141
+ * The connection line, as a fraction along the side. Callers pass the
142
+ * card's own `anchorY / height`; a side change simply slides the same
143
+ * fraction along the new side.
144
+ */
145
+ t: number;
146
+ /**
147
+ * The visual idiom, as a preference: these sides get a bonus, never a
148
+ * straitjacket — a card in the way always outranks the idiom.
149
+ */
150
+ preferSides?: PortSide[];
151
+ /** Optional hard constraint for already allocated terminal sides. */
152
+ sides?: PortSide[];
153
+ }
154
+ /**
155
+ * Shared lane accounting. Every route the engine returns charges its grid
156
+ * segments here, and later routes pay for reusing them — so two retry loops
157
+ * into the same card stack stack themselves side by side on adjacent
158
+ * clearance lines instead of drawing one line twice.
159
+ */
160
+ export type LaneUse = Map<string, number>;
161
+ export declare const createLaneUse: () => LaneUse;
162
+ export interface PathOptions {
163
+ /** Require all obstacle interiors to remain clear (caption corridor routing). */
164
+ strictObstacles?: boolean;
165
+ style: ConnectionFlowEdgeStyle;
166
+ /** How far a line must run out of a port before it may turn. */
167
+ stub?: number;
168
+ radius?: number;
169
+ trim?: number;
170
+ /**
171
+ * Obstacle inflation. A clean route passes at least this far outside every
172
+ * card — sized for the terminal rings, so a route that clears the inflated
173
+ * box also clears the bulges sticking out of the real one.
174
+ */
175
+ clearance?: number;
176
+ /** Extra cost per change of direction. */
177
+ bendPenalty?: number;
178
+ /** Cost per px travelled inside an inflated card. Finite on purpose. */
179
+ obstaclePenalty?: number;
180
+ /** Cost per prior use of the same grid segment. */
181
+ lanePenalty?: number;
182
+ /** Score taken off for connecting on a preferred side. */
183
+ preferBonus?: number;
184
+ /** Shared across one layout run — see `createLaneUse`. */
185
+ laneUse?: LaneUse;
186
+ /** Minimum distance between parallel independent lanes. */
187
+ laneSpacing?: number;
188
+ /** Existing routes: charge crowding and expose adjacent lanes. */
189
+ occupied?: readonly (readonly {
190
+ x: number;
191
+ y: number;
192
+ }[])[];
193
+ }
194
+ /** Minimum centre-to-centre lane distance, including room for a 6px hop. */
195
+ export declare const routingLaneSpacing: (clearance: number, cornerRadius: number) => number;
196
+ /** Length of parallel overlap within a lane; perpendicular crossings use bridges. */
197
+ export declare const parallelOverlap: (a: readonly {
198
+ x: number;
199
+ y: number;
200
+ }[], b: readonly {
201
+ x: number;
202
+ y: number;
203
+ }[], spacing?: number) => number;
204
+ /** Does any segment of this waypoint list pass through the interior of a box? */
205
+ export declare const segmentsCrossBoxes: (points: {
206
+ x: number;
207
+ y: number;
208
+ }[], boxes: Box[]) => boolean;
209
+ export interface RoutedPath extends Route {
210
+ /** The ports the engine actually connected — the layout draws its
211
+ * connectors here, wherever that turns out to be. */
212
+ fromPort: Port;
213
+ toPort: Port;
214
+ }
215
+ /**
216
+ * A* over the grid the cards define.
217
+ *
218
+ * Candidate lines come from the cards themselves — each inflated edge is a
219
+ * lane that provably clears the cards (a Hanan grid), plus ring roads beyond
220
+ * them all. Cost is length, plus a penalty per bend, plus a *large but
221
+ * finite* penalty per px inside an inflated card, plus a small one per reuse
222
+ * of an already-used lane. Finite obstacles are the important part: an edge
223
+ * boxed in by cards still draws its fewest-crossings route rather than
224
+ * vanishing, and a clean route always outranks any number of crossings.
225
+ *
226
+ * Returns `null` only when the grid would be too large to search — the
227
+ * caller then keeps its naive route. The engine never hangs and never blanks.
228
+ */
229
+ export declare const routeBetween: (from: PathEndpoint, to: PathEndpoint, obstacles: Box[], options: PathOptions) => RoutedPath | null;
230
+ export interface RoutableEdge {
231
+ id: string;
232
+ points: {
233
+ x: number;
234
+ y: number;
235
+ }[];
236
+ style: ConnectionFlowEdgeStyle;
237
+ }
238
+ /**
239
+ * The crossing pass: compare every pair of routed edges and give the
240
+ * horizontal one of each crossing a hop. Returns the new `d` for the edges
241
+ * that gained hops or needed a tighter corner to preserve a crossing.
242
+ */
243
+ export declare const routeCrossings: (edges: RoutableEdge[], options?: {
244
+ cornerRadius?: number;
245
+ jumpRadius?: number;
246
+ }) => Map<string, string>;
@@ -73,6 +73,14 @@ export interface ConnectionFlowConnectorConfig {
73
73
  /** Caption rendered along the edge. */
74
74
  label?: string;
75
75
  }
76
+ /** Explicit topology. Supplying a connections array disables inferred edges. */
77
+ export interface ConnectionFlowConnection extends ConnectionFlowConnectorConfig {
78
+ id: string;
79
+ fromId: string;
80
+ toId: string;
81
+ fromSide?: PortSide;
82
+ toSide?: PortSide;
83
+ }
76
84
  /**
77
85
  * One of a card's two outcomes, as an edge. `success` without a `to` is the
78
86
  * implicit next step and draws nothing extra — it only restyles the walk
@@ -134,6 +142,13 @@ export interface ConnectionFlowNodeItem {
134
142
  }
135
143
  export interface ConnectionFlowNode {
136
144
  id: string;
145
+ /** Optional logical cell for top-level editor nodes. Supply on every top-level
146
+ * node to align rows across columns. Signed integer indices allow adding to
147
+ * any side. Placement does not create connections; use explicit connections. */
148
+ gridPosition?: {
149
+ column: number;
150
+ row: number;
151
+ };
137
152
  title?: string;
138
153
  subtitle?: string;
139
154
  description?: string;
@@ -278,6 +293,7 @@ export interface LaidOutNode {
278
293
  }
279
294
  export interface LaidOutEdge {
280
295
  id: string;
296
+ ringSize?: ConnectionFlowRingSize;
281
297
  fromId: string | null;
282
298
  toId: string;
283
299
  state: ConnectionState;
@@ -291,10 +307,26 @@ export interface LaidOutEdge {
291
307
  * and the line they sit on can never disagree about the route.
292
308
  */
293
309
  d: string;
310
+ /** Measured, collision-free caption bounds in layout coordinates. */
311
+ caption?: {
312
+ x: number;
313
+ y: number;
314
+ width: number;
315
+ height: number;
316
+ lines: string[];
317
+ lineHeight: number;
318
+ };
294
319
  sourceTone: TrueColor;
295
320
  targetTone: TrueColor;
296
321
  /** A bypass arc travels *over* skipped nodes rather than between neighbours. */
297
322
  bypass: boolean;
323
+ /**
324
+ * The style this edge's corners are drawn in. The crossing-hop pass
325
+ * rebuilds a crossing edge's path exactly as the router would have drawn
326
+ * it, which needs the style the edge was routed with — `edgeStyle`
327
+ * governs corners only, so hops are round on every style.
328
+ */
329
+ style?: ConnectionFlowEdgeStyle;
298
330
  /**
299
331
  * Position in its source's emission round-robin, and how many edges share
300
332
  * that round-robin.
@@ -327,14 +359,8 @@ export interface LaidOutEdge {
327
359
  /** Set when `kind` is `"branch"`. */
328
360
  branchKind?: "success" | "failure";
329
361
  }
330
- /**
331
- * A terminal where one or more edges meet a node.
332
- *
333
- * These are layout output rather than something each edge draws for itself.
334
- * When three edges fan out of one card they share a single port, and an edge
335
- * that painted its own endpoints stamped three identical rings on that one
336
- * spot — which the highlight then dimmed three times over, so a "dimmed"
337
- * connector came out darker than a lit one.
362
+ /** A distinct terminal for one edge endpoint, allocated on a node border.
363
+ * Fan-in and fan-out edges retain independent anchors and highlight states.
338
364
  */
339
365
  export interface LaidOutConnector {
340
366
  id: string;
@@ -345,11 +371,11 @@ export interface LaidOutConnector {
345
371
  /** Which border of the node it sits on. */
346
372
  side: PortSide;
347
373
  tone: TrueColor;
348
- /** The liveliest state among the edges meeting here. */
374
+ /** State of the edge attached to this terminal. */
349
375
  state: ConnectionState;
350
376
  /** Something is flowing through this terminal. */
351
377
  active: boolean;
352
- /** Edges meeting here, so the path highlight dims a connector with them. */
378
+ /** The single edge attached here; retained as an array for API compatibility. */
353
379
  edgeIds: string[];
354
380
  /** Radius of the border's bulge, in px. */
355
381
  radius: number;
@@ -423,7 +449,12 @@ export interface ConnectionFlowLayoutOptions {
423
449
  childGap: number;
424
450
  /** Horizontal indent for child nodes. */
425
451
  childIndent: number;
426
- /** Vertical gap between the rows of a chained child grid. @default childGap */
452
+ /**
453
+ * Vertical gap between the rows of a chained child grid. Wider than the
454
+ * child gap on purpose: the ladder has to read as a ladder, and the
455
+ * engine's crossing hops need air in the corridors the rows define.
456
+ * @default 20
457
+ */
427
458
  rowGap: number;
428
459
  /** Left inset of a chained child grid under its parent. @default childIndent */
429
460
  gridIndent: number;
@@ -432,6 +463,12 @@ export interface ConnectionFlowLayoutOptions {
432
463
  cornerRadius: number;
433
464
  /** How far above everything in the way a bypass arc travels. */
434
465
  bypassLift: number;
466
+ /**
467
+ * How far outside a card the path engine will route. An edge whose naive
468
+ * route crosses a card is re-routed through lanes at least this far from
469
+ * every card face, so it clears the terminal bulges too. @default 12
470
+ */
471
+ pathClearance: number;
435
472
  /** Default size of the border bulge where an edge meets a node. */
436
473
  ringSize: ConnectionFlowRingSize;
437
474
  /** Rows a card shows before the rest collapse behind "show more". */
@@ -117,6 +117,23 @@ export type InputVariantTokens = {
117
117
  /** True when the surface is see-through and sits over unknown content. */
118
118
  translucent: boolean;
119
119
  };
120
+ /**
121
+ * Extras for `getInputVariantTokens`.
122
+ */
123
+ export type InputVariantOptions = {
124
+ /**
125
+ * The tone the caller *chose*, as opposed to the one the component resolved.
126
+ *
127
+ * `glass` tints its fill from this alone. Every field resolves a missing
128
+ * tone to `blue` (`tone ?? color ?? "blue"`), so tinting from the resolved
129
+ * value would repaint every bare `<Input variant="glass">` in the product
130
+ * pale blue — which is what `ghost` does, and why the distinction has to be
131
+ * carried from the call site rather than inferred here. A field nobody ever
132
+ * tinted keeps the white wash it has always had; a field whose caller asked
133
+ * for violet gets violet glass.
134
+ */
135
+ explicitTone?: TrueColor;
136
+ };
120
137
  /**
121
138
  * The variant's surface with its border colour removed, keeping the width and
122
139
  * sides.
@@ -129,6 +146,16 @@ export type InputVariantTokens = {
129
146
  * successful one stayed grey. Strip the colour so only one class can apply.
130
147
  */
131
148
  export declare const stripBorderColor: (surface: string) => string;
149
+ /**
150
+ * A surface with its background colour removed, keeping the rest.
151
+ *
152
+ * Used where a component paints a *second* fill over the variant's own. The
153
+ * alternative — replacing the expected literal, `surface.replace("bg-white/45",
154
+ * …)` — goes silently stale the moment anyone edits the token table: the
155
+ * replace finds nothing, the old fill survives underneath, and the field is
156
+ * untinted again with nothing said about it. Stripping cannot fail that way.
157
+ */
158
+ export declare const stripFillClass: (surface: string) => string;
132
159
  /** True when a caller-supplied class string sets a text colour of its own. */
133
160
  export declare const hasTextColor: (className?: string) => boolean;
134
161
  /**
@@ -148,7 +175,7 @@ export declare const stripTextColor: (className: string) => string;
148
175
  * replaces it. (`underline` paints no box, so a corner there has nowhere
149
176
  * to land — honestly no-op.)
150
177
  */
151
- export declare const getInputVariantTokens: (variant: InputVariant, tone?: TrueColor, corner?: SurfaceCorner) => InputVariantTokens;
178
+ export declare const getInputVariantTokens: (variant: InputVariant, tone?: TrueColor, corner?: SurfaceCorner, options?: InputVariantOptions) => InputVariantTokens;
152
179
  export type FieldToneTokens = {
153
180
  /** Border colour while anything inside the field has focus. */
154
181
  focusBorder: string;
@@ -140,11 +140,11 @@ declare const _default: __VLS_WithSlots<import("vue").DefineComponent<GanttProps
140
140
  color: TrueColor;
141
141
  variant: GanttVariant;
142
142
  corner: GanttCorner;
143
+ links: GanttLink[];
143
144
  padding: GanttPadding;
144
145
  resizableColumns: boolean;
145
146
  minZoom: number;
146
147
  maxZoom: number;
147
- links: GanttLink[];
148
148
  initialZoom: number;
149
149
  snap: GanttSnap;
150
150
  showToday: boolean;
@@ -25,6 +25,13 @@ interface ScrollAreaProps {
25
25
  variant?: ScrollAreaVariant;
26
26
  /** Fade the content at the edges it can scroll toward. @default false */
27
27
  mask?: boolean;
28
+ /**
29
+ * Whether the region can scroll sideways. A one-axis region — a nav list,
30
+ * a text column — should say so: `scrollWidth` reports content clipped by
31
+ * `overflow-x: hidden` as loudly as content that actually scrolls, so the
32
+ * bar would be drawn for an axis with nothing to scroll. @default true
33
+ */
34
+ horizontal?: boolean;
28
35
  /**
29
36
  * Tab order entry for the viewport while overflowing; the viewport leaves
30
37
  * the tab order when the content fits. @default 0
@@ -38,6 +45,7 @@ type __VLS_Slots = {} & {
38
45
  default?: (props: typeof __VLS_1) => any;
39
46
  };
40
47
  declare const __VLS_component: import("vue").DefineComponent<ScrollAreaProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<ScrollAreaProps> & Readonly<{}>, {
48
+ horizontal: boolean;
41
49
  mask: boolean;
42
50
  variant: ScrollAreaVariant;
43
51
  tabIndex: number;
@@ -0,0 +1 @@
1
+ export {};
@@ -43,7 +43,6 @@ declare const _default: import("vue").DefineComponent<SmartInputProps, {}, {}, {
43
43
  "onUpdate:value"?: ((value: string) => any) | undefined;
44
44
  }>, {
45
45
  size: SmartInputSize;
46
- tone: TrueColor;
47
46
  disabled: boolean;
48
47
  value: string;
49
48
  variant: InputVariant;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cjlapao/ui-kit-vue",
3
- "version": "0.2.6",
3
+ "version": "0.2.8",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/cjlapao/ui-kit.git",