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