react-ai-renderer 0.1.18 → 0.1.20

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.cjs CHANGED
@@ -58398,6 +58398,12 @@ function formatProps(props) {
58398
58398
  key = _b[0],
58399
58399
  value = _b[1];
58400
58400
  if (typeof value === 'string') {
58401
+ var trimmedValue = value.trim();
58402
+ var isArrowFunction = trimmedValue.includes('=>');
58403
+ var isRegularFunction = trimmedValue.startsWith('function');
58404
+ if (isArrowFunction || isRegularFunction) {
58405
+ return "".concat(key, "={").concat(value, "}");
58406
+ }
58401
58407
  return "".concat(key, "=\"").concat(value, "\"");
58402
58408
  }
58403
58409
  try {
@@ -58481,6 +58487,9 @@ function parseComponentRecursively(allComponentHandlers, item, scope) {
58481
58487
  componentHandler = allComponentHandlers.find(function (c) {
58482
58488
  return c.name === item.value;
58483
58489
  });
58490
+ if (componentHandler === null || componentHandler === void 0 ? void 0 : componentHandler.onRenderStart) {
58491
+ componentHandler.onRenderStart(item, scope);
58492
+ }
58484
58493
  props = __assign({}, item.props);
58485
58494
  propsString = formatProps(props);
58486
58495
  propsString += " scope={props.scope}";
@@ -58503,16 +58512,13 @@ function parseComponentRecursively(allComponentHandlers, item, scope) {
58503
58512
  componentString = (componentHandler === null || componentHandler === void 0 ? void 0 : componentHandler.selfClosing) ? "<".concat(item.value, " ").concat(propsString, " />") : ["<".concat(item.value, " ").concat(propsString, ">"), childrenContent_1, "</".concat(item.value, ">")].join('\n');
58504
58513
  // 调用组件的渲染钩子
58505
58514
  if (isComplete) {
58506
- // 渲染完成后的钩子
58507
58515
  if (componentHandler === null || componentHandler === void 0 ? void 0 : componentHandler.onRenderFinished) {
58508
58516
  componentHandler.onRenderFinished(item, scope);
58509
58517
  }
58510
58518
  } else {
58511
- // 渲染过程中的钩子
58512
58519
  if (componentHandler === null || componentHandler === void 0 ? void 0 : componentHandler.onRenderProcess) {
58513
58520
  componentHandler.onRenderProcess(item, scope);
58514
58521
  } else if (componentHandler === null || componentHandler === void 0 ? void 0 : componentHandler.onRender) {
58515
- // 向后兼容:如果存在旧的 onRender,也调用它
58516
58522
  componentHandler.onRender(item, scope);
58517
58523
  }
58518
58524
  }
@@ -59203,7 +59209,6 @@ var ComponentPlaceholder = function (_a) {
59203
59209
  }
59204
59210
  } catch (e) {
59205
59211
  // 如果骨架图生成失败,继续使用默认占位内容
59206
- console.warn('Failed to generate skeleton:', e);
59207
59212
  }
59208
59213
  }
59209
59214
  // 默认占位内容
@@ -59319,14 +59324,14 @@ function convertComponentsToHandlers(components, componentHandlers) {
59319
59324
  name = _b[0],
59320
59325
  componentValue = _b[1];
59321
59326
  if (isEnhancedComponentConfig(componentValue)) {
59322
- // 增强模式:从配置对象中提取信息
59323
59327
  var config = componentValue;
59324
59328
  return {
59325
59329
  component: config.value,
59326
59330
  name: name,
59327
59331
  selfClosing: config.selfClosing !== undefined ? config.selfClosing : isSelfClosingComponent(config.value),
59328
- onRenderFinished: config.onRenderFinished,
59332
+ onRenderStart: config.onRenderStart,
59329
59333
  onRenderProcess: config.onRenderProcess,
59334
+ onRenderFinished: config.onRenderFinished,
59330
59335
  loader: config.loader,
59331
59336
  label: config.label
59332
59337
  };
@@ -59763,7 +59768,6 @@ var getMermaid = function () {
59763
59768
  mermaidPromise = import('mermaid').then(function (module) {
59764
59769
  return module.default || module;
59765
59770
  }).catch(function (error) {
59766
- console.warn('Mermaid is not available. Install it to enable chart rendering.');
59767
59771
  return null;
59768
59772
  });
59769
59773
  return mermaidPromise;
@@ -59814,7 +59818,6 @@ function MermaidRenderer(_a) {
59814
59818
  if (!!mermaid.initialized) return [3 /*break*/, 4];
59815
59819
  // 设置全局错误处理函数
59816
59820
  mermaid.parseError = function (err) {
59817
- console.warn('Mermaid parse error:', err.message);
59818
59821
  };
59819
59822
  return [4 /*yield*/, mermaid.initialize({
59820
59823
  startOnLoad: false,