@mathwiz/ui-components 0.1.22 → 0.1.23

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.mjs CHANGED
@@ -8370,7 +8370,11 @@ const Qo = ({
8370
8370
  children: "下一题"
8371
8371
  }
8372
8372
  )
8373
- ] }), xc = {
8373
+ ] }), Lr = {
8374
+ MISSING_REQUIRED_FIELD: "MISSING_REQUIRED_FIELD",
8375
+ TRANSFORMATION_FAILED: "TRANSFORMATION_FAILED",
8376
+ OUTPUT_VALIDATION_FAILED: "OUTPUT_VALIDATION_FAILED"
8377
+ }, xc = {
8374
8378
  strictMode: !1,
8375
8379
  enableLogging: !1,
8376
8380
  validationLevel: "basic",
@@ -8379,12 +8383,6 @@ const Qo = ({
8379
8383
  enableComponentContractValidation: !1,
8380
8384
  maxReferenceDepth: 10,
8381
8385
  enablePerformanceMonitoring: !1
8382
- }, Lr = {
8383
- MISSING_REQUIRED_FIELD: "MISSING_REQUIRED_FIELD",
8384
- // 转换错误
8385
- TRANSFORMATION_FAILED: "TRANSFORMATION_FAILED",
8386
- // 验证错误
8387
- OUTPUT_VALIDATION_FAILED: "OUTPUT_VALIDATION_FAILED"
8388
8386
  }, vc = {
8389
8387
  strictMode: !1,
8390
8388
  enableLogging: !1,
@@ -13248,12 +13246,12 @@ class Yt {
13248
13246
  const o = this.convertGeometryShapeCoordinates(n);
13249
13247
  this.referenceContext.geometryPresets[t] = o;
13250
13248
  }
13251
- }), this.config.enableLogging && console.log("✅ geometryPresets after extraction:", Object.keys(this.referenceContext.geometryPresets))) : this.config.enableLogging && console.log("⚠️ No geometry_shapes found in input data"), e.transform_definitions && typeof e.transform_definitions == "object" && Object.entries(e.transform_definitions).forEach(([t, n]) => {
13249
+ }), this.config.enableLogging && console.log("✅ geometryPresets after extraction:", Object.keys(this.referenceContext.geometryPresets))) : this.config.enableLogging && console.log("⚠️ No geometry_shapes found in input data"), e.transform_definitions && typeof e.transform_definitions == "object" && (this.referenceContext.transformDefinitions || (this.referenceContext.transformDefinitions = {}), Object.entries(e.transform_definitions).forEach(([t, n]) => {
13252
13250
  if (n && typeof n == "object") {
13253
13251
  const o = this.convertTransformDefinitionCoordinates(n);
13254
13252
  this.referenceContext.transformDefinitions[t] = o;
13255
13253
  }
13256
- });
13254
+ }));
13257
13255
  }
13258
13256
  /**
13259
13257
  * 转换答案
@@ -13286,8 +13284,8 @@ class Yt {
13286
13284
  if (this.config.enableLogging && console.log("🔄 transformExplanation called:", {
13287
13285
  hasExplanation: !!e,
13288
13286
  isArray: Array.isArray(e),
13289
- hasSteps: e && e.steps && Array.isArray(e.steps),
13290
- stepsCount: e && e.steps ? e.steps.length : 0
13287
+ hasSteps: e && !Array.isArray(e) && e.steps && Array.isArray(e.steps),
13288
+ stepsCount: e ? Array.isArray(e) ? e.length : e.steps ? e.steps.length : 0 : 0
13291
13289
  }), !e)
13292
13290
  return { steps: [] };
13293
13291
  if (Array.isArray(e))
@@ -13313,8 +13311,9 @@ class Yt {
13313
13311
  return this.config.enableLogging && console.warn(`⚠️ 不支持的 chartConfig 类型: ${n},跳过转换`), e;
13314
13312
  try {
13315
13313
  const o = {
13316
- type: n,
13317
- ...t
13314
+ ...t,
13315
+ type: n
13316
+ // 确保 type 使用 chartConfigType,覆盖 chartConfig 中的 type(如果有)
13318
13317
  };
13319
13318
  this.config.enableLogging && (console.log(" contentBlock keys:", Object.keys(o)), n === "graph" && o.shapes && (console.log(" shapes count:", o.shapes.length), o.shapes.length > 0 && console.log(" first shape:", o.shapes[0]))), this.config.enableLogging && (console.log("🔍 transformExplanationStep: referenceContext.transformDefinitions =", this.referenceContext.transformDefinitions), console.log("🔍 transformExplanationStep: transformDefinitions keys =", this.referenceContext.transformDefinitions ? Object.keys(this.referenceContext.transformDefinitions) : []));
13320
13319
  const s = this.transformerRegistry.transform(
@@ -13377,7 +13376,7 @@ class Yt {
13377
13376
  }), t.endpoints = t.endpoints.map((n, o) => Array.isArray(n) && n.length >= 2 ? {
13378
13377
  x: n[0],
13379
13378
  y: n[1]
13380
- } : (this.config.enableLogging && console.log(` Endpoint ${o} is not array:`, n), n)), t.type === "segment" && Array.isArray(t.endpoints) && t.endpoints.length === 2 && (this.config.enableLogging && console.log(`🔄 Converting segment to line for shape ${t.id || "unknown"}`), t.type = "line", t.start = t.endpoints[0], t.end = t.endpoints[1], delete t.endpoints)) : "endpoints" in t && this.config.enableLogging && console.log(`⚠️ Shape ${t.id || "unknown"} has endpoints but not array:`, {
13379
+ } : (this.config.enableLogging && console.log(` Endpoint ${o} is not array:`, n), n)), t.type === "line" && Array.isArray(t.endpoints) && t.endpoints.length === 2 && (this.config.enableLogging && console.log(`🔄 Converting segment to line for shape ${t.id || "unknown"}`), t.type = "line", t.start = t.endpoints[0], t.end = t.endpoints[1], delete t.endpoints)) : "endpoints" in t && this.config.enableLogging && console.log(`⚠️ Shape ${t.id || "unknown"} has endpoints but not array:`, {
13381
13380
  endpoints: t.endpoints,
13382
13381
  endpointsType: typeof t.endpoints
13383
13382
  });
@@ -13404,9 +13403,7 @@ class Yt {
13404
13403
  n && typeof n == "object" && "x" in n && "y" in n && (t.config.center = [n.x, n.y]);
13405
13404
  }
13406
13405
  for (const [n, o] of Object.entries(t))
13407
- Array.isArray(o) ? t[n] = o.map(
13408
- (s) => typeof s == "object" ? this.convertTransformDefinitionCoordinates(s) : s
13409
- ) : o && typeof o == "object" && (t[n] = this.convertTransformDefinitionCoordinates(o));
13406
+ Array.isArray(o) ? t[n] = o.map((s) => typeof s == "object" && s !== null ? "id" in s && "type" in s && "config" in s ? this.convertTransformDefinitionCoordinates(s) : this.deepClone(s) : s) : o && typeof o == "object" && ("id" in o && "type" in o && "config" in o ? t[n] = this.convertTransformDefinitionCoordinates(o) : t[n] = this.deepClone(o));
13410
13407
  return t;
13411
13408
  }
13412
13409
  /**