schematex 0.6.0 → 0.6.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 (87) hide show
  1. package/dist/ai/ai-sdk.cjs +9 -9
  2. package/dist/ai/ai-sdk.d.cts +4 -4
  3. package/dist/ai/ai-sdk.d.ts +4 -4
  4. package/dist/ai/ai-sdk.js +4 -4
  5. package/dist/ai/index.cjs +15 -15
  6. package/dist/ai/index.d.cts +3 -3
  7. package/dist/ai/index.d.ts +3 -3
  8. package/dist/ai/index.js +4 -4
  9. package/dist/{api-qVDutqXH.d.cts → api-BEJTXyBA.d.cts} +1 -1
  10. package/dist/{api-XWHHAhQI.d.ts → api-DFrSR3lw.d.ts} +1 -1
  11. package/dist/browser.cjs +10 -10
  12. package/dist/browser.d.cts +3 -3
  13. package/dist/browser.d.ts +3 -3
  14. package/dist/browser.js +4 -4
  15. package/dist/{chunk-25ZON47K.cjs → chunk-4XR7X7XW.cjs} +96 -26
  16. package/dist/chunk-4XR7X7XW.cjs.map +1 -0
  17. package/dist/{chunk-LGABFD3L.js → chunk-522WB2EH.js} +2 -2
  18. package/dist/{chunk-LGABFD3L.js.map → chunk-522WB2EH.js.map} +1 -1
  19. package/dist/{chunk-7AFW2J6J.js → chunk-I2GQYOZ5.js} +94 -24
  20. package/dist/chunk-I2GQYOZ5.js.map +1 -0
  21. package/dist/{chunk-EPKIJEH7.js → chunk-MFAMNFPA.js} +63 -6
  22. package/dist/chunk-MFAMNFPA.js.map +1 -0
  23. package/dist/{chunk-P63S7P6N.js → chunk-OTSVMKII.js} +116 -3
  24. package/dist/chunk-OTSVMKII.js.map +1 -0
  25. package/dist/{chunk-ECD5XHBM.cjs → chunk-R6VX5YTJ.cjs} +2 -2
  26. package/dist/{chunk-ECD5XHBM.cjs.map → chunk-R6VX5YTJ.cjs.map} +1 -1
  27. package/dist/{chunk-YVDUEUFV.cjs → chunk-SSLNPHCL.cjs} +118 -5
  28. package/dist/chunk-SSLNPHCL.cjs.map +1 -0
  29. package/dist/{chunk-SUIDD2C5.cjs → chunk-XNCOSVNG.cjs} +63 -6
  30. package/dist/chunk-XNCOSVNG.cjs.map +1 -0
  31. package/dist/{diagnostics-DRxhodP6.d.ts → diagnostics-B-ffSEhl.d.cts} +8 -0
  32. package/dist/{diagnostics-DRxhodP6.d.cts → diagnostics-B-ffSEhl.d.ts} +8 -0
  33. package/dist/diagrams/blockdiagram/index.cjs +5 -5
  34. package/dist/diagrams/blockdiagram/index.d.cts +1 -1
  35. package/dist/diagrams/blockdiagram/index.d.ts +1 -1
  36. package/dist/diagrams/blockdiagram/index.js +1 -1
  37. package/dist/diagrams/circuit/index.d.cts +1 -1
  38. package/dist/diagrams/circuit/index.d.ts +1 -1
  39. package/dist/diagrams/ecomap/index.d.cts +1 -1
  40. package/dist/diagrams/ecomap/index.d.ts +1 -1
  41. package/dist/diagrams/entity/index.d.cts +1 -1
  42. package/dist/diagrams/entity/index.d.ts +1 -1
  43. package/dist/diagrams/fishbone/index.d.cts +1 -1
  44. package/dist/diagrams/fishbone/index.d.ts +1 -1
  45. package/dist/diagrams/flowchart/index.d.cts +2 -2
  46. package/dist/diagrams/flowchart/index.d.ts +2 -2
  47. package/dist/diagrams/genogram/index.d.cts +1 -1
  48. package/dist/diagrams/genogram/index.d.ts +1 -1
  49. package/dist/diagrams/ladder/index.d.cts +1 -1
  50. package/dist/diagrams/ladder/index.d.ts +1 -1
  51. package/dist/diagrams/logic/index.d.cts +1 -1
  52. package/dist/diagrams/logic/index.d.ts +1 -1
  53. package/dist/diagrams/orgchart/index.d.cts +1 -1
  54. package/dist/diagrams/orgchart/index.d.ts +1 -1
  55. package/dist/diagrams/pedigree/index.d.cts +1 -1
  56. package/dist/diagrams/pedigree/index.d.ts +1 -1
  57. package/dist/diagrams/phylo/index.d.cts +1 -1
  58. package/dist/diagrams/phylo/index.d.ts +1 -1
  59. package/dist/diagrams/sld/index.cjs +7 -7
  60. package/dist/diagrams/sld/index.d.cts +1 -1
  61. package/dist/diagrams/sld/index.d.ts +1 -1
  62. package/dist/diagrams/sld/index.js +1 -1
  63. package/dist/diagrams/sociogram/index.d.cts +1 -1
  64. package/dist/diagrams/sociogram/index.d.ts +1 -1
  65. package/dist/diagrams/timing/index.d.cts +1 -1
  66. package/dist/diagrams/timing/index.d.ts +1 -1
  67. package/dist/diagrams/venn/index.d.cts +1 -1
  68. package/dist/diagrams/venn/index.d.ts +1 -1
  69. package/dist/{index-C7SN-FB3.d.ts → index-DPWdYfNx.d.ts} +1 -1
  70. package/dist/{index-BRIkOPnd.d.cts → index-S0njakQ2.d.cts} +1 -1
  71. package/dist/index.cjs +26 -26
  72. package/dist/index.d.cts +4 -4
  73. package/dist/index.d.ts +4 -4
  74. package/dist/index.js +5 -5
  75. package/dist/react.cjs +4 -4
  76. package/dist/react.d.cts +2 -2
  77. package/dist/react.d.ts +2 -2
  78. package/dist/react.js +3 -3
  79. package/dist/{tools-DdhP1kWY.d.cts → tools-CeGGMCs7.d.cts} +2 -2
  80. package/dist/{tools-BVeUNdsU.d.ts → tools-kK_enDwb.d.ts} +2 -2
  81. package/package.json +1 -1
  82. package/dist/chunk-25ZON47K.cjs.map +0 -1
  83. package/dist/chunk-7AFW2J6J.js.map +0 -1
  84. package/dist/chunk-EPKIJEH7.js.map +0 -1
  85. package/dist/chunk-P63S7P6N.js.map +0 -1
  86. package/dist/chunk-SUIDD2C5.cjs.map +0 -1
  87. package/dist/chunk-YVDUEUFV.cjs.map +0 -1
@@ -1,8 +1,8 @@
1
1
  import { orgchart } from './chunk-RJMCWT7Z.js';
2
2
  import { circuit } from './chunk-UWA5MWCI.js';
3
- import { blockdiagram } from './chunk-EPKIJEH7.js';
3
+ import { blockdiagram } from './chunk-MFAMNFPA.js';
4
4
  import { ladder } from './chunk-TWLKXV2O.js';
5
- import { sld } from './chunk-LGABFD3L.js';
5
+ import { sld } from './chunk-522WB2EH.js';
6
6
  import { entity } from './chunk-H4MT5TJP.js';
7
7
  import { fishbone } from './chunk-HAZALB7U.js';
8
8
  import { venn } from './chunk-FBS3PACU.js';
@@ -4355,7 +4355,8 @@ var GEOMETRY = {
4355
4355
  top: { x: 0, y: -55 },
4356
4356
  bottom: { x: 0, y: 55 },
4357
4357
  in: { x: -45, y: -10 },
4358
- out: { x: 0, y: 55 }
4358
+ out: { x: 45, y: 10 },
4359
+ right: { x: 45, y: 10 }
4359
4360
  }
4360
4361
  },
4361
4362
  reactor_pfr: {
@@ -5050,9 +5051,10 @@ function renderInstrument(category, letterCode, loopNumber) {
5050
5051
  // src/diagrams/pid/layout.ts
5051
5052
  var PADDING = 30;
5052
5053
  var TITLE_AREA = 26;
5053
- var EQUIP_GAP_X = 70;
5054
+ var EQUIP_GAP_X = 92;
5054
5055
  var INST_RADIUS = 14;
5055
- var INST_OFFSET = 38;
5056
+ var INST_OFFSET = 52;
5057
+ var PORT_CLEARANCE = 18;
5056
5058
  function defaultPort(direction, equip) {
5057
5059
  if (equip.equipType === "tank_atm" || equip.equipType === "tank_cone_roof") {
5058
5060
  return direction === "out" ? "bottom" : "top";
@@ -5064,8 +5066,9 @@ function defaultPort(direction, equip) {
5064
5066
  }
5065
5067
  function resolveSide(port) {
5066
5068
  if (port === "top" || port === "vapor_out" || port === "reflux") return "top";
5067
- if (port === "bottom" || port === "liquid_out" || port === "bottom_return") return "bottom";
5068
- if (port === "left" || port === "in" || port === "feed" || port === "tube_in" || port === "shell_in") return "left";
5069
+ if (port === "bottom" || port === "liquid_out" || port === "bottom_return" || port === "shell_out") return "bottom";
5070
+ if (port === "left" || port === "in" || port === "feed" || port === "tube_in") return "left";
5071
+ if (port === "shell_in") return "top";
5069
5072
  return "right";
5070
5073
  }
5071
5074
  function getAnchor(layoutEq, port, fallback) {
@@ -5110,12 +5113,53 @@ function manhattanPath(fromX, fromY, fromSide, toX, toY, toSide) {
5110
5113
  midY: toY
5111
5114
  };
5112
5115
  }
5116
+ function sideVector(side) {
5117
+ switch (side) {
5118
+ case "left":
5119
+ return { x: -1, y: 0 };
5120
+ case "right":
5121
+ return { x: 1, y: 0 };
5122
+ case "top":
5123
+ return { x: 0, y: -1 };
5124
+ case "bottom":
5125
+ return { x: 0, y: 1 };
5126
+ }
5127
+ }
5128
+ function portStubPath(from, to, clearance = PORT_CLEARANCE) {
5129
+ const fv = sideVector(from.side);
5130
+ const tv = sideVector(to.side);
5131
+ const fromStub = {
5132
+ x: from.x + fv.x * clearance,
5133
+ y: from.y + fv.y * clearance,
5134
+ side: from.side
5135
+ };
5136
+ const toStub = {
5137
+ x: to.x + tv.x * clearance,
5138
+ y: to.y + tv.y * clearance,
5139
+ side: to.side
5140
+ };
5141
+ const routed = manhattanPath(fromStub.x, fromStub.y, fromStub.side, toStub.x, toStub.y, toStub.side);
5142
+ return {
5143
+ d: `M ${from.x} ${from.y} L ${fromStub.x} ${fromStub.y} ${routed.d.replace(/^M\s+[-\d.]+\s+[-\d.]+\s*/, "")} L ${to.x} ${to.y}`,
5144
+ midX: routed.midX,
5145
+ midY: routed.midY
5146
+ };
5147
+ }
5148
+ function lineMidpoint(ln, equipById) {
5149
+ const fromEq = equipById.get(ln.from.id);
5150
+ const toEq = equipById.get(ln.to.id);
5151
+ if (!fromEq || !toEq) return void 0;
5152
+ const from = getAnchor(fromEq, ln.from.port, "out");
5153
+ const to = getAnchor(toEq, ln.to.port, "in");
5154
+ const routed = portStubPath(from, to);
5155
+ return { x: routed.midX, y: routed.midY };
5156
+ }
5113
5157
  function layoutPid(ast) {
5114
5158
  const equipment = [];
5115
5159
  const equipById = /* @__PURE__ */ new Map();
5116
5160
  const heights = ast.equipment.map((e) => GEOMETRY[e.equipType]?.height ?? 60);
5117
5161
  const maxH = Math.max(...heights, 0);
5118
- const rowY = PADDING + TITLE_AREA + maxH / 2 + 30;
5162
+ const rowY = PADDING + TITLE_AREA + maxH / 2 + 50;
5119
5163
  let cursorX = PADDING + 40;
5120
5164
  for (const equip of ast.equipment) {
5121
5165
  const geo = GEOMETRY[equip.equipType] ?? { width: 60, height: 40, ports: {} };
@@ -5143,7 +5187,7 @@ function layoutPid(ast) {
5143
5187
  }
5144
5188
  const instruments = [];
5145
5189
  const instById = /* @__PURE__ */ new Map();
5146
- const crBandY = PADDING + TITLE_AREA + 40;
5190
+ const crBandY = PADDING + TITLE_AREA + 28;
5147
5191
  let crSlot = 0;
5148
5192
  for (const inst of ast.instruments) {
5149
5193
  let cx = 0;
@@ -5158,12 +5202,16 @@ function layoutPid(ast) {
5158
5202
  cy = rowY + maxH / 2 + INST_OFFSET + INST_RADIUS;
5159
5203
  const tgt = inst.measures ?? inst.controls ?? "";
5160
5204
  const tgtEq = equipById.get(tgt);
5161
- cx = tgtEq ? tgtEq.cx : PADDING + 80;
5205
+ const tgtLine = ast.lines.find((line2) => line2.id === tgt);
5206
+ const lineMid = tgtLine ? lineMidpoint(tgtLine, equipById) : void 0;
5207
+ cx = tgtEq ? tgtEq.cx : lineMid ? lineMid.x : PADDING + 80;
5162
5208
  } else {
5163
5209
  cy = rowY + maxH / 2 + INST_OFFSET;
5164
5210
  const tgt = inst.measures ?? inst.controls ?? "";
5165
5211
  const tgtEq = equipById.get(tgt);
5166
- cx = tgtEq ? tgtEq.cx : PADDING + 80;
5212
+ const tgtLine = ast.lines.find((line2) => line2.id === tgt);
5213
+ const lineMid = tgtLine ? lineMidpoint(tgtLine, equipById) : void 0;
5214
+ cx = tgtEq ? tgtEq.cx : lineMid ? lineMid.x : PADDING + 80;
5167
5215
  }
5168
5216
  const lay = {
5169
5217
  inst,
@@ -5174,6 +5222,22 @@ function layoutPid(ast) {
5174
5222
  instruments.push(lay);
5175
5223
  instById.set(inst.tag, lay);
5176
5224
  }
5225
+ const targetOf = (inst) => inst.inst.measures ?? inst.inst.controls ?? "";
5226
+ const fieldGroups = /* @__PURE__ */ new Map();
5227
+ for (const inst of instruments) {
5228
+ if (inst.inst.category.startsWith("cr_")) continue;
5229
+ const target = targetOf(inst);
5230
+ if (!target) continue;
5231
+ const group2 = fieldGroups.get(target) ?? [];
5232
+ group2.push(inst);
5233
+ fieldGroups.set(target, group2);
5234
+ }
5235
+ for (const group2 of fieldGroups.values()) {
5236
+ if (group2.length < 2) continue;
5237
+ group2.forEach((inst, idx) => {
5238
+ inst.cx += (idx - (group2.length - 1) / 2) * (INST_RADIUS * 2 + 12);
5239
+ });
5240
+ }
5177
5241
  const sameRow = (a, b) => Math.abs(a.cy - b.cy) < INST_RADIUS && Math.abs(a.cx - b.cx) < INST_RADIUS * 2 + 8;
5178
5242
  const sortedByX = [...instruments].sort((a, b) => a.cx - b.cx);
5179
5243
  for (let i = 1; i < sortedByX.length; i++) {
@@ -5218,14 +5282,7 @@ function routeLine(ln, equipById, instById) {
5218
5282
  const fromAnchor = resolveAnchor(ln.from.id, ln.from.port, "out", equipById, instById);
5219
5283
  const toAnchor = resolveAnchor(ln.to.id, ln.to.port, "in", equipById, instById);
5220
5284
  if (!fromAnchor || !toAnchor) return void 0;
5221
- const { d, midX, midY } = manhattanPath(
5222
- fromAnchor.x,
5223
- fromAnchor.y,
5224
- fromAnchor.side,
5225
- toAnchor.x,
5226
- toAnchor.y,
5227
- toAnchor.side
5228
- );
5285
+ const { d, midX, midY } = portStubPath(fromAnchor, toAnchor);
5229
5286
  return {
5230
5287
  line: ln,
5231
5288
  path: d,
@@ -5261,6 +5318,7 @@ var STYLE2 = `
5261
5318
  .lt-pid-capillary { stroke: #1d1d1d; stroke-width: 1.4; fill: none; stroke-dasharray: 1 5; stroke-linecap: round; }
5262
5319
  .lt-pid-software { stroke: #6a6a6a; stroke-width: 1.3; fill: none; stroke-dasharray: 2 4; }
5263
5320
  .lt-pid-mechanical { stroke: #1d1d1d; stroke-width: 1.4; fill: none; stroke-dasharray: 3 2 1 2; }
5321
+ .lt-pid-line-path { fill: none; }
5264
5322
 
5265
5323
  .lt-pid-pneumatic-tick { stroke: #1d1d1d; stroke-width: 1.2; }
5266
5324
 
@@ -5277,14 +5335,19 @@ var STYLE2 = `
5277
5335
  `;
5278
5336
  var ARROW_ID = "lt-pid-arrow";
5279
5337
  function lineClass(t) {
5280
- return `lt-pid-${t.replace("_", "-")}`;
5338
+ switch (t) {
5339
+ case "process_minor":
5340
+ return "lt-pid-process-min";
5341
+ default:
5342
+ return `lt-pid-${t.replaceAll("_", "-")}`;
5343
+ }
5281
5344
  }
5282
5345
  function renderLine(l) {
5283
5346
  const cls = lineClass(l.line.lineType);
5284
5347
  const parts = [
5285
5348
  path({
5286
5349
  d: l.path,
5287
- class: cls,
5350
+ class: `${cls} lt-pid-line-path`,
5288
5351
  "data-line-id": l.line.id,
5289
5352
  "data-service": l.line.service ?? ""
5290
5353
  })
@@ -5360,6 +5423,12 @@ function renderPidAST(ast, _config) {
5360
5423
  return renderLayout2(layout);
5361
5424
  }
5362
5425
  function renderLayout2(layout) {
5426
+ const processLines = layout.lines.filter(
5427
+ (line2) => line2.line.lineType === "process" || line2.line.lineType === "process_minor"
5428
+ );
5429
+ const signalLines = layout.lines.filter(
5430
+ (line2) => line2.line.lineType !== "process" && line2.line.lineType !== "process_minor"
5431
+ );
5363
5432
  const equipNodes = layout.equipment.map((eq) => {
5364
5433
  const symbol = renderEquip(eq.equip.equipType, eq.equip.tag ?? eq.equip.id);
5365
5434
  return group(
@@ -5446,8 +5515,9 @@ function renderLayout2(layout) {
5446
5515
  el("style", {}, STYLE2)
5447
5516
  ]),
5448
5517
  titleNode,
5518
+ group({ class: "lt-pid-lines lt-pid-process-lines" }, processLines.map(renderLine)),
5449
5519
  group({ class: "lt-pid-equipment" }, equipNodes),
5450
- group({ class: "lt-pid-lines" }, layout.lines.map(renderLine)),
5520
+ group({ class: "lt-pid-lines lt-pid-signal-lines" }, signalLines.map(renderLine)),
5451
5521
  group({ class: "lt-pid-signals" }, autoSignals),
5452
5522
  group({ class: "lt-pid-instruments" }, instNodes)
5453
5523
  ]
@@ -22521,5 +22591,5 @@ function renderWithPlugin(prepared, plugin, config) {
22521
22591
  }
22522
22592
 
22523
22593
  export { GEOMETRY, decisiontree, drawDeviceIcon, iconSize, network, parse, parseResult, pert, petri, pid, prisma, render, renderEquip, renderPreview, renderResult, sequence, state, timeline, usecase };
22524
- //# sourceMappingURL=chunk-7AFW2J6J.js.map
22525
- //# sourceMappingURL=chunk-7AFW2J6J.js.map
22594
+ //# sourceMappingURL=chunk-I2GQYOZ5.js.map
22595
+ //# sourceMappingURL=chunk-I2GQYOZ5.js.map