@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.
@@ -507,7 +507,7 @@ function renderRect(box, attributes) {
507
507
  function renderLabel(label, box, item) {
508
508
  const labelLayout = item.labelLayout;
509
509
  if (labelLayout?.lines !== void 0 && labelLayout.lines.length > 0) {
510
- const offset = isAbsoluteLabelLayout(labelLayout.box, box) ? { x: 0, y: 0 } : { x: box.x, y: box.y };
510
+ const offset = { x: box.x, y: box.y };
511
511
  return [
512
512
  ` <text class="label" data-for="${escapeAttribute(item.id)}" font-family="${FONT_FAMILY}" font-size="${formatNumber(labelLayout.font.fontSize)}" fill="#111827">`,
513
513
  ...labelLayout.lines.map(
@@ -606,9 +606,6 @@ function pathPointsBeforeArrowhead(points) {
606
606
  };
607
607
  return [...points.slice(0, -1), base];
608
608
  }
609
- function isAbsoluteLabelLayout(labelBox, itemBox) {
610
- 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;
611
- }
612
609
  function shapePoints(shape, box) {
613
610
  const left = box.x;
614
611
  const right = box.x + box.width;
@@ -2732,11 +2729,6 @@ function validateReferences(dsl) {
2732
2729
  const diagnostics = [];
2733
2730
  const nodeIds = new Set(Object.keys(dsl.nodes));
2734
2731
  const groupIds = new Set(Object.keys(dsl.groups ?? {}));
2735
- const swimlaneLaneIds = new Set(
2736
- Object.entries(dsl.swimlanes ?? {}).flatMap(
2737
- ([swimlaneId, swimlane]) => Object.keys(swimlane.lanes).map((laneId) => `${swimlaneId}.${laneId}`)
2738
- )
2739
- );
2740
2732
  (dsl.edges ?? []).forEach((edge, index) => {
2741
2733
  if (typeof edge === "string") {
2742
2734
  return;
@@ -2844,10 +2836,12 @@ function validateReferences(dsl) {
2844
2836
  break;
2845
2837
  case "containment": {
2846
2838
  const container = constraint.containerId ?? constraint.container;
2847
- if (container !== void 0 && !hasNodeOrGroup(container, nodeIds, groupIds, swimlaneLaneIds)) {
2848
- diagnostics.push(
2849
- referenceMissing(["constraints", index, "container"], container)
2850
- );
2839
+ if (container !== void 0) {
2840
+ if (!nodeIds.has(container)) {
2841
+ diagnostics.push(
2842
+ referenceMissing(["constraints", index, "container"], container)
2843
+ );
2844
+ }
2851
2845
  }
2852
2846
  (constraint.childIds ?? constraint.children ?? []).forEach(
2853
2847
  (child, childIndex) => {