schematex 0.9.0 → 0.9.1

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.
Files changed (43) hide show
  1. package/dist/ai/ai-sdk.cjs +9 -9
  2. package/dist/ai/ai-sdk.d.cts +2 -2
  3. package/dist/ai/ai-sdk.d.ts +2 -2
  4. package/dist/ai/ai-sdk.js +4 -4
  5. package/dist/ai/index.cjs +18 -18
  6. package/dist/ai/index.js +5 -5
  7. package/dist/browser.cjs +10 -10
  8. package/dist/browser.js +4 -4
  9. package/dist/{chunk-HKOPXQYU.cjs → chunk-2R4UXKCT.cjs} +5 -5
  10. package/dist/{chunk-HKOPXQYU.cjs.map → chunk-2R4UXKCT.cjs.map} +1 -1
  11. package/dist/{chunk-DR3DDDQY.cjs → chunk-47SGK5R6.cjs} +56 -6
  12. package/dist/chunk-47SGK5R6.cjs.map +1 -0
  13. package/dist/{chunk-T3GV7OVF.js → chunk-EBX4KCYW.js} +19 -2
  14. package/dist/chunk-EBX4KCYW.js.map +1 -0
  15. package/dist/{chunk-JIJWGHRN.cjs → chunk-FJVQGBPU.cjs} +19 -2
  16. package/dist/chunk-FJVQGBPU.cjs.map +1 -0
  17. package/dist/{chunk-HPEAE3JM.js → chunk-J34HDRFY.js} +56 -6
  18. package/dist/chunk-J34HDRFY.js.map +1 -0
  19. package/dist/{chunk-UGB42BGK.cjs → chunk-QYC6WZEM.cjs} +7 -7
  20. package/dist/{chunk-UGB42BGK.cjs.map → chunk-QYC6WZEM.cjs.map} +1 -1
  21. package/dist/{chunk-LM5X7ZNR.js → chunk-VOJGLBE5.js} +4 -4
  22. package/dist/{chunk-LM5X7ZNR.js.map → chunk-VOJGLBE5.js.map} +1 -1
  23. package/dist/{chunk-PR6IAGVP.js → chunk-Z5ML4QYG.js} +3 -3
  24. package/dist/{chunk-PR6IAGVP.js.map → chunk-Z5ML4QYG.js.map} +1 -1
  25. package/dist/diagrams/circuit/index.cjs +8 -8
  26. package/dist/diagrams/circuit/index.js +1 -1
  27. package/dist/diagrams/flowchart/index.cjs +7 -7
  28. package/dist/diagrams/flowchart/index.d.cts +1 -1
  29. package/dist/diagrams/flowchart/index.d.ts +1 -1
  30. package/dist/diagrams/flowchart/index.js +1 -1
  31. package/dist/{index-B0YO7rx8.d.cts → index-BiXWjQht.d.cts} +10 -4
  32. package/dist/{index-u3KZBdas.d.ts → index-Cq8y1aaa.d.ts} +10 -4
  33. package/dist/index.cjs +40 -40
  34. package/dist/index.d.cts +1 -1
  35. package/dist/index.d.ts +1 -1
  36. package/dist/index.js +6 -6
  37. package/dist/react.cjs +4 -4
  38. package/dist/react.js +3 -3
  39. package/package.json +1 -1
  40. package/dist/chunk-DR3DDDQY.cjs.map +0 -1
  41. package/dist/chunk-HPEAE3JM.js.map +0 -1
  42. package/dist/chunk-JIJWGHRN.cjs.map +0 -1
  43. package/dist/chunk-T3GV7OVF.js.map +0 -1
@@ -1082,12 +1082,18 @@ var FC_CONST = {
1082
1082
  labelHPad: 16,
1083
1083
  minNodeWidth: 72,
1084
1084
  /**
1085
- * Cap on per-line label width. Until line-wrapping lands, this clamp is
1086
- * a soft contract: nodes never grow past this, and any overflow becomes
1087
- * the caller's problem. Set generously so common CJK sentences (≤30
1088
- * full-width chars) still fit without truncation or text overflow.
1085
+ * Cap on per-line label width. Labels wider than `wrapLabelWidth` are
1086
+ * auto-wrapped first (see `wrapLabel`), so this clamp only bites on
1087
+ * unbreakable single tokens that survive wrapping (URLs, ids).
1089
1088
  */
1090
1089
  maxLabelWidth: 420,
1090
+ /**
1091
+ * Auto-wrap target: a single-line label measuring wider than this is
1092
+ * broken into multiple lines (preferring spaces, falling back to CJK
1093
+ * char boundaries). ≈38 Latin chars / ≈20 full-width chars per line —
1094
+ * keeps prose nodes near a readable 3:1 aspect instead of a 400px strip.
1095
+ */
1096
+ wrapLabelWidth: 260,
1091
1097
  crossingSweepIters: 24
1092
1098
  };
1093
1099
  var SHAPE_SLANT = {
@@ -1134,6 +1140,49 @@ function measureLabelWidth(label) {
1134
1140
  }
1135
1141
  return max;
1136
1142
  }
1143
+ function wrapLabel(label) {
1144
+ const text2 = String(label);
1145
+ if (/<br\s*\/?>|\n/i.test(text2)) return label;
1146
+ if (/<\/?[bi]>/i.test(text2)) return label;
1147
+ if (measureLineWidth(text2) <= FC_CONST.wrapLabelWidth) return label;
1148
+ const maxW = FC_CONST.wrapLabelWidth;
1149
+ const lines = [];
1150
+ let line2 = "";
1151
+ let lineW = 0;
1152
+ let breakAt = -1;
1153
+ let breakIsSpace = false;
1154
+ for (const ch of text2) {
1155
+ const code = ch.codePointAt(0) ?? 0;
1156
+ const chW = isFullWidth(code) ? FC_CONST.cjkCharWidth : FC_CONST.charWidth;
1157
+ if (ch === " " && line2.length > 0) {
1158
+ breakAt = line2.length;
1159
+ breakIsSpace = true;
1160
+ }
1161
+ if (lineW + chW > maxW && line2.length > 0) {
1162
+ if (breakAt > 0) {
1163
+ const head = line2.slice(0, breakAt);
1164
+ const tail = line2.slice(breakIsSpace ? breakAt + 1 : breakAt);
1165
+ lines.push(head);
1166
+ line2 = tail;
1167
+ } else {
1168
+ lines.push(line2);
1169
+ line2 = "";
1170
+ }
1171
+ lineW = measureLineWidth(line2);
1172
+ breakAt = -1;
1173
+ breakIsSpace = false;
1174
+ if (ch === " " && line2.length === 0) continue;
1175
+ }
1176
+ line2 += ch;
1177
+ lineW += chW;
1178
+ if (isFullWidth(code)) {
1179
+ breakAt = line2.length;
1180
+ breakIsSpace = false;
1181
+ }
1182
+ }
1183
+ if (line2.length > 0) lines.push(line2);
1184
+ return lines.join("\n");
1185
+ }
1137
1186
  function greedyFAS(nodeIds, edges) {
1138
1187
  const outAdj = /* @__PURE__ */ new Map();
1139
1188
  const inAdj = /* @__PURE__ */ new Map();
@@ -1674,6 +1723,7 @@ function hasOverlappingTopLevelClusters(ast, layerMap, sgParent) {
1674
1723
  function layoutFlowchart(ast) {
1675
1724
  const dir = ast.direction;
1676
1725
  const isHorizontalDir = dir === "LR" || dir === "RL";
1726
+ for (const n of ast.nodes) n.label = wrapLabel(n.label);
1677
1727
  const sizeOf = (n) => {
1678
1728
  const rawTextW = measureLabelWidth(n.label);
1679
1729
  const labelW = Math.min(
@@ -2550,5 +2600,5 @@ exports.parseFlowchart = parseFlowchart;
2550
2600
  exports.renderFlowchart = renderFlowchart;
2551
2601
  exports.renderFlowchartAST = renderFlowchartAST;
2552
2602
  exports.renderIcon = renderIcon;
2553
- //# sourceMappingURL=chunk-DR3DDDQY.cjs.map
2554
- //# sourceMappingURL=chunk-DR3DDDQY.cjs.map
2603
+ //# sourceMappingURL=chunk-47SGK5R6.cjs.map
2604
+ //# sourceMappingURL=chunk-47SGK5R6.cjs.map