@crazyhappyone/auto-graph 0.0.2 → 0.0.21

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