@crazyhappyone/auto-graph 0.0.2 → 0.0.3

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/dist/index.cjs CHANGED
@@ -1468,11 +1468,6 @@ function validateReferences(dsl) {
1468
1468
  const diagnostics = [];
1469
1469
  const nodeIds = new Set(Object.keys(dsl.nodes));
1470
1470
  const groupIds = new Set(Object.keys(dsl.groups ?? {}));
1471
- const swimlaneLaneIds = new Set(
1472
- Object.entries(dsl.swimlanes ?? {}).flatMap(
1473
- ([swimlaneId, swimlane]) => Object.keys(swimlane.lanes).map((laneId) => `${swimlaneId}.${laneId}`)
1474
- )
1475
- );
1476
1471
  (dsl.edges ?? []).forEach((edge, index) => {
1477
1472
  if (typeof edge === "string") {
1478
1473
  return;
@@ -1580,10 +1575,12 @@ function validateReferences(dsl) {
1580
1575
  break;
1581
1576
  case "containment": {
1582
1577
  const container = constraint.containerId ?? constraint.container;
1583
- if (container !== void 0 && !hasNodeOrGroup(container, nodeIds, groupIds, swimlaneLaneIds)) {
1584
- diagnostics.push(
1585
- referenceMissing(["constraints", index, "container"], container)
1586
- );
1578
+ if (container !== void 0) {
1579
+ if (!nodeIds.has(container)) {
1580
+ diagnostics.push(
1581
+ referenceMissing(["constraints", index, "container"], container)
1582
+ );
1583
+ }
1587
1584
  }
1588
1585
  (constraint.childIds ?? constraint.children ?? []).forEach(
1589
1586
  (child, childIndex) => {
@@ -2425,7 +2422,7 @@ function renderRect(box, attributes) {
2425
2422
  function renderLabel(label, box, item) {
2426
2423
  const labelLayout = item.labelLayout;
2427
2424
  if (labelLayout?.lines !== void 0 && labelLayout.lines.length > 0) {
2428
- const offset = isAbsoluteLabelLayout(labelLayout.box, box) ? { x: 0, y: 0 } : { x: box.x, y: box.y };
2425
+ const offset = { x: box.x, y: box.y };
2429
2426
  return [
2430
2427
  ` <text class="label" data-for="${escapeAttribute(item.id)}" font-family="${FONT_FAMILY}" font-size="${formatNumber(labelLayout.font.fontSize)}" fill="#111827">`,
2431
2428
  ...labelLayout.lines.map(
@@ -2524,9 +2521,6 @@ function pathPointsBeforeArrowhead(points) {
2524
2521
  };
2525
2522
  return [...points.slice(0, -1), base];
2526
2523
  }
2527
- function isAbsoluteLabelLayout(labelBox, itemBox) {
2528
- return labelBox.x >= itemBox.x && labelBox.y >= itemBox.y && labelBox.x + labelBox.width <= itemBox.x + itemBox.width && labelBox.y + labelBox.height <= itemBox.y + itemBox.height;
2529
- }
2530
2524
  function shapePoints(shape, box) {
2531
2525
  const left = box.x;
2532
2526
  const right = box.x + box.width;