@dryui/ui 1.0.0 → 1.1.1

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.
@@ -17,6 +17,8 @@
17
17
  <Button
18
18
  variant="trigger"
19
19
  type="button"
20
+ --dry-btn-justify="space-between"
21
+ --dry-btn-radius="0"
20
22
  aria-expanded={itemCtx.open}
21
23
  aria-controls={itemCtx.contentId}
22
24
  data-state={itemCtx.open ? 'open' : 'closed'}
@@ -207,6 +207,14 @@
207
207
  z-index: 1;
208
208
  display: inline-grid;
209
209
  color: var(--dry-code-copy-color);
210
+ --dry-btn-color: var(--dry-code-copy-color);
211
+ }
212
+
213
+ [data-code-block]:hover .copy-btn-slot,
214
+ [data-code-block]:focus-within .copy-btn-slot,
215
+ [data-code-block][data-copied] .copy-btn-slot {
216
+ color: var(--dry-code-copy-hover-color);
217
+ --dry-btn-color: var(--dry-code-copy-hover-color);
210
218
  }
211
219
 
212
220
  [data-code-block]:has([data-code-block-header]) .copy-btn-slot {
@@ -425,10 +425,10 @@
425
425
 
426
426
  @container dry-diagram (max-width: 480px) {
427
427
  [data-part='node-content'] {
428
- padding: 12px 14px;
428
+ padding: var(--dry-diagram-node-padding-mobile, 12px 14px);
429
429
  }
430
430
  [data-part='node-content'][data-has-description] {
431
- padding: 14px 16px;
431
+ padding: var(--dry-diagram-node-padding-with-description-mobile, 14px 16px);
432
432
  }
433
433
  [data-part='node-description'] {
434
434
  display: none;
@@ -447,6 +447,14 @@
447
447
  );
448
448
  --_cluster-border: var(--dry-diagram-cluster-border, var(--dry-color-stroke-weak));
449
449
  --_text-muted: var(--dry-diagram-text-muted, var(--dry-color-text-weak));
450
+ --_node-padding: var(--dry-diagram-node-padding, 16px 22px);
451
+ --_node-padding-with-description: var(--dry-diagram-node-padding-with-description, 18px 22px);
452
+ --_node-gap: var(--dry-diagram-node-gap, 8px);
453
+ --_node-gap-with-description: var(--dry-diagram-node-gap-with-description, 6px);
454
+ --_node-label-size: var(--dry-diagram-node-label-size, 15px);
455
+ --_node-label-size-with-description: var(--dry-diagram-node-label-size-with-description, 16px);
456
+ --_node-description-size: var(--dry-diagram-node-description-size, 12px);
457
+ --_cluster-label-size: var(--dry-diagram-cluster-label-size, 12px);
450
458
 
451
459
  display: block;
452
460
  overflow: visible;
@@ -499,15 +507,15 @@
499
507
  [data-part='node-content'] {
500
508
  display: grid;
501
509
  place-items: center;
502
- gap: 8px;
503
- padding: 16px 22px;
510
+ gap: var(--_node-gap);
511
+ padding: var(--_node-padding);
504
512
  height: 100%;
505
513
  box-sizing: border-box;
506
514
  font-family: var(--dry-font-sans);
507
515
  }
508
516
 
509
517
  [data-part='node-label'] {
510
- font-size: 15px;
518
+ font-size: var(--_node-label-size);
511
519
  font-weight: 600;
512
520
  color: var(--_node-color);
513
521
  text-align: center;
@@ -530,7 +538,7 @@
530
538
  }
531
539
 
532
540
  [data-part='node-description'] {
533
- font-size: 12px;
541
+ font-size: var(--_node-description-size);
534
542
  font-weight: 400;
535
543
  color: var(--_text-muted);
536
544
  text-align: center;
@@ -538,8 +546,8 @@
538
546
  }
539
547
 
540
548
  [data-part='node-content'][data-has-description] {
541
- padding: 18px 22px;
542
- gap: 6px;
549
+ padding: var(--_node-padding-with-description);
550
+ gap: var(--_node-gap-with-description);
543
551
  text-align: left;
544
552
  place-items: start;
545
553
  grid-template-rows: auto auto 1fr;
@@ -550,7 +558,7 @@
550
558
  }
551
559
 
552
560
  [data-part='node-content'][data-has-description] [data-part='node-label'] {
553
- font-size: 16px;
561
+ font-size: var(--_node-label-size-with-description);
554
562
  }
555
563
 
556
564
  [data-part='node-content'][data-has-description] [data-part='node-description'] {
@@ -695,7 +703,7 @@
695
703
  justify-content: start;
696
704
  gap: 8px;
697
705
  font-family: var(--dry-font-sans);
698
- font-size: 12px;
706
+ font-size: var(--_cluster-label-size);
699
707
  font-weight: 600;
700
708
  color: var(--_text-muted);
701
709
  letter-spacing: 0.04em;
@@ -357,6 +357,7 @@ function computeNodeAndClusterBounds(nodes, clusters) {
357
357
  const WAYPOINT_DEFAULT_WIDTH = 240;
358
358
  const WAYPOINT_DEFAULT_HEIGHT_DESC = 132;
359
359
  const WAYPOINT_DEFAULT_HEIGHT = 84;
360
+ const WAYPOINT_VERTICAL_EDGE_INSET_RATIO = 0.5;
360
361
  function estimateWaypointDims(waypoint) {
361
362
  const w = waypoint.width ??
362
363
  Math.max(MIN_NODE_WIDTH, waypoint.label.length * CHAR_WIDTH + NODE_PADDING_X, (waypoint.description?.length ?? 0) * 7 + NODE_PADDING_X);
@@ -364,6 +365,22 @@ function estimateWaypointDims(waypoint) {
364
365
  (waypoint.description ? WAYPOINT_DEFAULT_HEIGHT_DESC : WAYPOINT_DEFAULT_HEIGHT);
365
366
  return { w: Math.min(w, WAYPOINT_DEFAULT_WIDTH * 1.4), h };
366
367
  }
368
+ function resolveVerticalWaypointLaneRatio(collapsed, segmentIndex) {
369
+ const laneX = collapsed[segmentIndex]?.x ?? collapsed[segmentIndex - 1]?.x;
370
+ if (laneX === undefined)
371
+ return 0.5;
372
+ const beforeSide = Math.sign((collapsed[segmentIndex - 2]?.x ?? laneX) - laneX);
373
+ if (beforeSide < 0)
374
+ return WAYPOINT_VERTICAL_EDGE_INSET_RATIO;
375
+ if (beforeSide > 0)
376
+ return 1 - WAYPOINT_VERTICAL_EDGE_INSET_RATIO;
377
+ const afterSide = Math.sign((collapsed[segmentIndex + 1]?.x ?? laneX) - laneX);
378
+ if (afterSide < 0)
379
+ return WAYPOINT_VERTICAL_EDGE_INSET_RATIO;
380
+ if (afterSide > 0)
381
+ return 1 - WAYPOINT_VERTICAL_EDGE_INSET_RATIO;
382
+ return 0.5;
383
+ }
367
384
  function placeWaypoints(configEdges, positionedEdges, collapsedByIndex, cornerRadius) {
368
385
  const newEdges = [];
369
386
  const waypoints = [];
@@ -379,13 +396,10 @@ function placeWaypoints(configEdges, positionedEdges, collapsedByIndex, cornerRa
379
396
  const t = wp.position ?? 0.5;
380
397
  const at = getPointAtFraction(collapsed, t);
381
398
  const dims = estimateWaypointDims(wp);
382
- // Snap box center to the segment axis so the polyline enters/exits cleanly
383
- const boxCenter = at.axis === 'h'
384
- ? { x: at.point.x, y: at.point.y } // horizontal segment — box vertical center on the line
385
- : { x: at.point.x, y: at.point.y };
399
+ const laneRatio = at.axis === 'v' ? resolveVerticalWaypointLaneRatio(collapsed, at.segmentIndex) : 0.5;
386
400
  const box = {
387
- x: boxCenter.x - dims.w / 2,
388
- y: boxCenter.y - dims.h / 2,
401
+ x: at.point.x - dims.w * laneRatio,
402
+ y: at.point.y - dims.h / 2,
389
403
  width: dims.w,
390
404
  height: dims.h
391
405
  };
@@ -1,10 +1,7 @@
1
- import type { Component } from 'svelte';
1
+ import type { Component, ComponentType } from 'svelte';
2
2
  export type DiagramColor = 'neutral' | 'brand' | 'success' | 'warning' | 'error' | 'info';
3
3
  export type DiagramDirection = 'TB' | 'BT' | 'LR' | 'RL';
4
- export type DiagramIconComponent = Component<{
5
- size?: number | string;
6
- 'aria-hidden'?: boolean | string;
7
- }>;
4
+ export type DiagramIconComponent = Component<Record<string, unknown>> | ComponentType;
8
5
  export interface DiagramNode {
9
6
  id: string;
10
7
  label: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dryui/ui",
3
- "version": "1.0.0",
3
+ "version": "1.1.1",
4
4
  "author": "Rob Balfre",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -770,7 +770,7 @@
770
770
  "postpack": "bun ../../scripts/postpack-exports.ts"
771
771
  },
772
772
  "dependencies": {
773
- "@dryui/primitives": "^1.0.0"
773
+ "@dryui/primitives": "^1.1.1"
774
774
  },
775
775
  "peerDependencies": {
776
776
  "svelte": "^5.55.1"