spytial-core 1.4.10 → 1.4.11

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.
@@ -94528,7 +94528,7 @@ VVbdfjptxz|~\x80\x82\x84\xA6\xA8W\b
94528
94528
  init_layoutinstance();
94529
94529
  init_layoutspec();
94530
94530
  exports.StructuredInputGraph = class extends WebColaCnDGraph {
94531
- // Default to 2 positions
94531
+ // Track current constraint validation error
94532
94532
  constructor(dataInstance) {
94533
94533
  super();
94534
94534
  this.evaluator = null;
@@ -94537,6 +94537,8 @@ VVbdfjptxz|~\x80\x82\x84\xA6\xA8W\b
94537
94537
  this.controlsContainer = null;
94538
94538
  this.customTypes = /* @__PURE__ */ new Set();
94539
94539
  this.relationAtomPositions = ["", ""];
94540
+ // Default to 2 positions
94541
+ this.currentConstraintError = null;
94540
94542
  const instance = dataInstance || new exports.JSONDataInstance({
94541
94543
  atoms: [],
94542
94544
  relations: []
@@ -95217,6 +95219,7 @@ VVbdfjptxz|~\x80\x82\x84\xA6\xA8W\b
95217
95219
  }
95218
95220
  /**
95219
95221
  * Enforce constraints and regenerate layout
95222
+ * This method validates constraints on every data update and reports UNSAT cores
95220
95223
  */
95221
95224
  async enforceConstraintsAndRegenerate() {
95222
95225
  console.log("\u{1F504} enforceConstraintsAndRegenerate() called");
@@ -95240,15 +95243,37 @@ VVbdfjptxz|~\x80\x82\x84\xA6\xA8W\b
95240
95243
  const projections = {};
95241
95244
  const layoutResult = this.layoutInstance.generateLayout(this.dataInstance, projections);
95242
95245
  if (layoutResult.error) {
95243
- console.warn("\u26A0\uFE0F Constraint validation error:", layoutResult.error);
95246
+ console.warn("\u26A0\uFE0F Constraint validation error detected:", layoutResult.error);
95247
+ this.currentConstraintError = layoutResult.error;
95248
+ this.dispatchEvent(new CustomEvent("constraint-error", {
95249
+ detail: {
95250
+ error: layoutResult.error,
95251
+ layout: layoutResult.layout
95252
+ },
95253
+ bubbles: true
95254
+ }));
95255
+ console.log("\u{1F4E4} Dispatched constraint-error event with UNSAT core information");
95244
95256
  } else {
95245
- console.log("\u2705 Layout generated successfully");
95257
+ console.log("\u2705 Layout generated successfully - all constraints satisfied");
95258
+ if (this.currentConstraintError !== null) {
95259
+ console.log("\u{1F9F9} Clearing previous constraint error - constraints now satisfied");
95260
+ this.currentConstraintError = null;
95261
+ this.dispatchEvent(new CustomEvent("constraints-satisfied", {
95262
+ detail: { layout: layoutResult.layout },
95263
+ bubbles: true
95264
+ }));
95265
+ console.log("\u{1F4E4} Dispatched constraints-satisfied event");
95266
+ }
95246
95267
  }
95247
95268
  console.log("\u{1F3A8} Rendering layout...");
95248
95269
  await this.renderLayout(layoutResult.layout);
95249
95270
  console.log("\u2705 Constraints enforced and layout regenerated successfully");
95250
95271
  } catch (error) {
95251
95272
  console.error("\u274C Failed to enforce constraints and regenerate layout:", error);
95273
+ this.dispatchEvent(new CustomEvent("layout-generation-error", {
95274
+ detail: { error },
95275
+ bubbles: true
95276
+ }));
95252
95277
  }
95253
95278
  }
95254
95279
  /**
@@ -95672,6 +95697,19 @@ VVbdfjptxz|~\x80\x82\x84\xA6\xA8W\b
95672
95697
  getDataInstance() {
95673
95698
  return this.dataInstance;
95674
95699
  }
95700
+ /**
95701
+ * Get the current constraint error (if any)
95702
+ * Returns null if all constraints are currently satisfied
95703
+ */
95704
+ getCurrentConstraintError() {
95705
+ return this.currentConstraintError;
95706
+ }
95707
+ /**
95708
+ * Check if there are currently unsatisfied constraints
95709
+ */
95710
+ hasConstraintErrors() {
95711
+ return this.currentConstraintError !== null;
95712
+ }
95675
95713
  /**
95676
95714
  * Set the CnD specification
95677
95715
  */