schematex 0.6.1 → 0.6.2
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/ai/ai-sdk.cjs +11 -11
- package/dist/ai/ai-sdk.d.cts +3 -3
- package/dist/ai/ai-sdk.d.ts +3 -3
- package/dist/ai/ai-sdk.js +6 -6
- package/dist/ai/index.cjs +17 -17
- package/dist/ai/index.d.cts +3 -3
- package/dist/ai/index.d.ts +3 -3
- package/dist/ai/index.js +6 -6
- package/dist/{api-DFrSR3lw.d.ts → api-XWHHAhQI.d.ts} +1 -1
- package/dist/{api-BEJTXyBA.d.cts → api-qVDutqXH.d.cts} +1 -1
- package/dist/browser.cjs +12 -12
- package/dist/browser.d.cts +3 -3
- package/dist/browser.d.ts +3 -3
- package/dist/browser.js +6 -6
- package/dist/{chunk-ST5YRTTV.cjs → chunk-2F45Y2ON.cjs} +44 -5
- package/dist/chunk-2F45Y2ON.cjs.map +1 -0
- package/dist/{chunk-V4RO5KYY.cjs → chunk-3JAI3OVG.cjs} +81 -47
- package/dist/chunk-3JAI3OVG.cjs.map +1 -0
- package/dist/{chunk-R6VX5YTJ.cjs → chunk-ECD5XHBM.cjs} +2 -2
- package/dist/{chunk-R6VX5YTJ.cjs.map → chunk-ECD5XHBM.cjs.map} +1 -1
- package/dist/{chunk-MFAMNFPA.js → chunk-EPKIJEH7.js} +6 -63
- package/dist/chunk-EPKIJEH7.js.map +1 -0
- package/dist/{chunk-OTSVMKII.js → chunk-ITUPR7G5.js} +150 -48
- package/dist/chunk-ITUPR7G5.js.map +1 -0
- package/dist/{chunk-I2GQYOZ5.js → chunk-IZWKJVIC.js} +147 -107
- package/dist/chunk-IZWKJVIC.js.map +1 -0
- package/dist/{chunk-UWA5MWCI.js → chunk-JVAJ6ZLO.js} +81 -47
- package/dist/chunk-JVAJ6ZLO.js.map +1 -0
- package/dist/{chunk-4XR7X7XW.cjs → chunk-KSNUMQGS.cjs} +151 -111
- package/dist/chunk-KSNUMQGS.cjs.map +1 -0
- package/dist/{chunk-522WB2EH.js → chunk-LGABFD3L.js} +2 -2
- package/dist/{chunk-522WB2EH.js.map → chunk-LGABFD3L.js.map} +1 -1
- package/dist/{chunk-6URNSB6G.js → chunk-P26FCZP3.js} +44 -5
- package/dist/chunk-P26FCZP3.js.map +1 -0
- package/dist/{chunk-SSLNPHCL.cjs → chunk-SD6VDTQR.cjs} +152 -50
- package/dist/chunk-SD6VDTQR.cjs.map +1 -0
- package/dist/{chunk-XNCOSVNG.cjs → chunk-SUIDD2C5.cjs} +6 -63
- package/dist/chunk-SUIDD2C5.cjs.map +1 -0
- package/dist/{diagnostics-B-ffSEhl.d.ts → diagnostics-DRxhodP6.d.cts} +0 -8
- package/dist/{diagnostics-B-ffSEhl.d.cts → diagnostics-DRxhodP6.d.ts} +0 -8
- package/dist/diagrams/blockdiagram/index.cjs +5 -5
- package/dist/diagrams/blockdiagram/index.d.cts +1 -1
- package/dist/diagrams/blockdiagram/index.d.ts +1 -1
- package/dist/diagrams/blockdiagram/index.js +1 -1
- package/dist/diagrams/circuit/index.cjs +7 -7
- package/dist/diagrams/circuit/index.d.cts +1 -1
- package/dist/diagrams/circuit/index.d.ts +1 -1
- package/dist/diagrams/circuit/index.js +1 -1
- package/dist/diagrams/ecomap/index.d.cts +1 -1
- package/dist/diagrams/ecomap/index.d.ts +1 -1
- package/dist/diagrams/entity/index.d.cts +1 -1
- package/dist/diagrams/entity/index.d.ts +1 -1
- package/dist/diagrams/fishbone/index.d.cts +1 -1
- package/dist/diagrams/fishbone/index.d.ts +1 -1
- package/dist/diagrams/flowchart/index.d.cts +2 -2
- package/dist/diagrams/flowchart/index.d.ts +2 -2
- package/dist/diagrams/genogram/index.d.cts +1 -1
- package/dist/diagrams/genogram/index.d.ts +1 -1
- package/dist/diagrams/ladder/index.d.cts +1 -1
- package/dist/diagrams/ladder/index.d.ts +1 -1
- package/dist/diagrams/logic/index.d.cts +1 -1
- package/dist/diagrams/logic/index.d.ts +1 -1
- package/dist/diagrams/orgchart/index.d.cts +1 -1
- package/dist/diagrams/orgchart/index.d.ts +1 -1
- package/dist/diagrams/pedigree/index.d.cts +1 -1
- package/dist/diagrams/pedigree/index.d.ts +1 -1
- package/dist/diagrams/phylo/index.d.cts +1 -1
- package/dist/diagrams/phylo/index.d.ts +1 -1
- package/dist/diagrams/sld/index.cjs +7 -7
- package/dist/diagrams/sld/index.d.cts +1 -1
- package/dist/diagrams/sld/index.d.ts +1 -1
- package/dist/diagrams/sld/index.js +1 -1
- package/dist/diagrams/sociogram/index.d.cts +1 -1
- package/dist/diagrams/sociogram/index.d.ts +1 -1
- package/dist/diagrams/timing/index.cjs +4 -4
- package/dist/diagrams/timing/index.d.cts +1 -1
- package/dist/diagrams/timing/index.d.ts +1 -1
- package/dist/diagrams/timing/index.js +1 -1
- package/dist/diagrams/venn/index.d.cts +1 -1
- package/dist/diagrams/venn/index.d.ts +1 -1
- package/dist/{index-S0njakQ2.d.cts → index-BRIkOPnd.d.cts} +1 -1
- package/dist/{index-DPWdYfNx.d.ts → index-C7SN-FB3.d.ts} +1 -1
- package/dist/index.cjs +32 -32
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +8 -8
- package/dist/react.cjs +6 -6
- package/dist/react.d.cts +2 -2
- package/dist/react.d.ts +2 -2
- package/dist/react.js +5 -5
- package/dist/{tools-kK_enDwb.d.ts → tools-BVeUNdsU.d.ts} +2 -2
- package/dist/{tools-CeGGMCs7.d.cts → tools-DdhP1kWY.d.cts} +2 -2
- package/package.json +1 -1
- package/dist/chunk-4XR7X7XW.cjs.map +0 -1
- package/dist/chunk-6URNSB6G.js.map +0 -1
- package/dist/chunk-I2GQYOZ5.js.map +0 -1
- package/dist/chunk-MFAMNFPA.js.map +0 -1
- package/dist/chunk-OTSVMKII.js.map +0 -1
- package/dist/chunk-SSLNPHCL.cjs.map +0 -1
- package/dist/chunk-ST5YRTTV.cjs.map +0 -1
- package/dist/chunk-UWA5MWCI.js.map +0 -1
- package/dist/chunk-V4RO5KYY.cjs.map +0 -1
- package/dist/chunk-XNCOSVNG.cjs.map +0 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var chunkFKJBXGWP_cjs = require('./chunk-FKJBXGWP.cjs');
|
|
4
|
-
var
|
|
5
|
-
var
|
|
4
|
+
var chunk3JAI3OVG_cjs = require('./chunk-3JAI3OVG.cjs');
|
|
5
|
+
var chunkSUIDD2C5_cjs = require('./chunk-SUIDD2C5.cjs');
|
|
6
6
|
var chunk2L4YXZAZ_cjs = require('./chunk-2L4YXZAZ.cjs');
|
|
7
|
-
var
|
|
7
|
+
var chunkECD5XHBM_cjs = require('./chunk-ECD5XHBM.cjs');
|
|
8
8
|
var chunkV4GILQR6_cjs = require('./chunk-V4GILQR6.cjs');
|
|
9
9
|
var chunkHWVBHU3O_cjs = require('./chunk-HWVBHU3O.cjs');
|
|
10
10
|
var chunkC5C5EF3W_cjs = require('./chunk-C5C5EF3W.cjs');
|
|
@@ -15,7 +15,7 @@ var chunkYB4XJY5L_cjs = require('./chunk-YB4XJY5L.cjs');
|
|
|
15
15
|
var chunk3KRL2EGN_cjs = require('./chunk-3KRL2EGN.cjs');
|
|
16
16
|
var chunk4UFR2LB6_cjs = require('./chunk-4UFR2LB6.cjs');
|
|
17
17
|
var chunkWQDIZH2Z_cjs = require('./chunk-WQDIZH2Z.cjs');
|
|
18
|
-
var
|
|
18
|
+
var chunk2F45Y2ON_cjs = require('./chunk-2F45Y2ON.cjs');
|
|
19
19
|
var chunkR66QG3XT_cjs = require('./chunk-R66QG3XT.cjs');
|
|
20
20
|
var chunkL7POWM5B_cjs = require('./chunk-L7POWM5B.cjs');
|
|
21
21
|
var chunkNAGUZFXX_cjs = require('./chunk-NAGUZFXX.cjs');
|
|
@@ -4357,8 +4357,7 @@ var GEOMETRY = {
|
|
|
4357
4357
|
top: { x: 0, y: -55 },
|
|
4358
4358
|
bottom: { x: 0, y: 55 },
|
|
4359
4359
|
in: { x: -45, y: -10 },
|
|
4360
|
-
out: { x:
|
|
4361
|
-
right: { x: 45, y: 10 }
|
|
4360
|
+
out: { x: 0, y: 55 }
|
|
4362
4361
|
}
|
|
4363
4362
|
},
|
|
4364
4363
|
reactor_pfr: {
|
|
@@ -5053,10 +5052,9 @@ function renderInstrument(category, letterCode, loopNumber) {
|
|
|
5053
5052
|
// src/diagrams/pid/layout.ts
|
|
5054
5053
|
var PADDING = 30;
|
|
5055
5054
|
var TITLE_AREA = 26;
|
|
5056
|
-
var EQUIP_GAP_X =
|
|
5055
|
+
var EQUIP_GAP_X = 70;
|
|
5057
5056
|
var INST_RADIUS = 14;
|
|
5058
|
-
var INST_OFFSET =
|
|
5059
|
-
var PORT_CLEARANCE = 18;
|
|
5057
|
+
var INST_OFFSET = 38;
|
|
5060
5058
|
function defaultPort(direction, equip) {
|
|
5061
5059
|
if (equip.equipType === "tank_atm" || equip.equipType === "tank_cone_roof") {
|
|
5062
5060
|
return direction === "out" ? "bottom" : "top";
|
|
@@ -5068,9 +5066,8 @@ function defaultPort(direction, equip) {
|
|
|
5068
5066
|
}
|
|
5069
5067
|
function resolveSide(port) {
|
|
5070
5068
|
if (port === "top" || port === "vapor_out" || port === "reflux") return "top";
|
|
5071
|
-
if (port === "bottom" || port === "liquid_out" || port === "bottom_return"
|
|
5072
|
-
if (port === "left" || port === "in" || port === "feed" || port === "tube_in") return "left";
|
|
5073
|
-
if (port === "shell_in") return "top";
|
|
5069
|
+
if (port === "bottom" || port === "liquid_out" || port === "bottom_return") return "bottom";
|
|
5070
|
+
if (port === "left" || port === "in" || port === "feed" || port === "tube_in" || port === "shell_in") return "left";
|
|
5074
5071
|
return "right";
|
|
5075
5072
|
}
|
|
5076
5073
|
function getAnchor(layoutEq, port, fallback) {
|
|
@@ -5115,53 +5112,12 @@ function manhattanPath(fromX, fromY, fromSide, toX, toY, toSide) {
|
|
|
5115
5112
|
midY: toY
|
|
5116
5113
|
};
|
|
5117
5114
|
}
|
|
5118
|
-
function sideVector(side) {
|
|
5119
|
-
switch (side) {
|
|
5120
|
-
case "left":
|
|
5121
|
-
return { x: -1, y: 0 };
|
|
5122
|
-
case "right":
|
|
5123
|
-
return { x: 1, y: 0 };
|
|
5124
|
-
case "top":
|
|
5125
|
-
return { x: 0, y: -1 };
|
|
5126
|
-
case "bottom":
|
|
5127
|
-
return { x: 0, y: 1 };
|
|
5128
|
-
}
|
|
5129
|
-
}
|
|
5130
|
-
function portStubPath(from, to, clearance = PORT_CLEARANCE) {
|
|
5131
|
-
const fv = sideVector(from.side);
|
|
5132
|
-
const tv = sideVector(to.side);
|
|
5133
|
-
const fromStub = {
|
|
5134
|
-
x: from.x + fv.x * clearance,
|
|
5135
|
-
y: from.y + fv.y * clearance,
|
|
5136
|
-
side: from.side
|
|
5137
|
-
};
|
|
5138
|
-
const toStub = {
|
|
5139
|
-
x: to.x + tv.x * clearance,
|
|
5140
|
-
y: to.y + tv.y * clearance,
|
|
5141
|
-
side: to.side
|
|
5142
|
-
};
|
|
5143
|
-
const routed = manhattanPath(fromStub.x, fromStub.y, fromStub.side, toStub.x, toStub.y, toStub.side);
|
|
5144
|
-
return {
|
|
5145
|
-
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}`,
|
|
5146
|
-
midX: routed.midX,
|
|
5147
|
-
midY: routed.midY
|
|
5148
|
-
};
|
|
5149
|
-
}
|
|
5150
|
-
function lineMidpoint(ln, equipById) {
|
|
5151
|
-
const fromEq = equipById.get(ln.from.id);
|
|
5152
|
-
const toEq = equipById.get(ln.to.id);
|
|
5153
|
-
if (!fromEq || !toEq) return void 0;
|
|
5154
|
-
const from = getAnchor(fromEq, ln.from.port, "out");
|
|
5155
|
-
const to = getAnchor(toEq, ln.to.port, "in");
|
|
5156
|
-
const routed = portStubPath(from, to);
|
|
5157
|
-
return { x: routed.midX, y: routed.midY };
|
|
5158
|
-
}
|
|
5159
5115
|
function layoutPid(ast) {
|
|
5160
5116
|
const equipment = [];
|
|
5161
5117
|
const equipById = /* @__PURE__ */ new Map();
|
|
5162
5118
|
const heights = ast.equipment.map((e) => GEOMETRY[e.equipType]?.height ?? 60);
|
|
5163
5119
|
const maxH = Math.max(...heights, 0);
|
|
5164
|
-
const rowY = PADDING + TITLE_AREA + maxH / 2 +
|
|
5120
|
+
const rowY = PADDING + TITLE_AREA + maxH / 2 + 30;
|
|
5165
5121
|
let cursorX = PADDING + 40;
|
|
5166
5122
|
for (const equip of ast.equipment) {
|
|
5167
5123
|
const geo = GEOMETRY[equip.equipType] ?? { width: 60, height: 40, ports: {} };
|
|
@@ -5189,7 +5145,7 @@ function layoutPid(ast) {
|
|
|
5189
5145
|
}
|
|
5190
5146
|
const instruments = [];
|
|
5191
5147
|
const instById = /* @__PURE__ */ new Map();
|
|
5192
|
-
const crBandY = PADDING + TITLE_AREA +
|
|
5148
|
+
const crBandY = PADDING + TITLE_AREA + 40;
|
|
5193
5149
|
let crSlot = 0;
|
|
5194
5150
|
for (const inst of ast.instruments) {
|
|
5195
5151
|
let cx = 0;
|
|
@@ -5204,16 +5160,12 @@ function layoutPid(ast) {
|
|
|
5204
5160
|
cy = rowY + maxH / 2 + INST_OFFSET + INST_RADIUS;
|
|
5205
5161
|
const tgt = inst.measures ?? inst.controls ?? "";
|
|
5206
5162
|
const tgtEq = equipById.get(tgt);
|
|
5207
|
-
|
|
5208
|
-
const lineMid = tgtLine ? lineMidpoint(tgtLine, equipById) : void 0;
|
|
5209
|
-
cx = tgtEq ? tgtEq.cx : lineMid ? lineMid.x : PADDING + 80;
|
|
5163
|
+
cx = tgtEq ? tgtEq.cx : PADDING + 80;
|
|
5210
5164
|
} else {
|
|
5211
5165
|
cy = rowY + maxH / 2 + INST_OFFSET;
|
|
5212
5166
|
const tgt = inst.measures ?? inst.controls ?? "";
|
|
5213
5167
|
const tgtEq = equipById.get(tgt);
|
|
5214
|
-
|
|
5215
|
-
const lineMid = tgtLine ? lineMidpoint(tgtLine, equipById) : void 0;
|
|
5216
|
-
cx = tgtEq ? tgtEq.cx : lineMid ? lineMid.x : PADDING + 80;
|
|
5168
|
+
cx = tgtEq ? tgtEq.cx : PADDING + 80;
|
|
5217
5169
|
}
|
|
5218
5170
|
const lay = {
|
|
5219
5171
|
inst,
|
|
@@ -5224,22 +5176,6 @@ function layoutPid(ast) {
|
|
|
5224
5176
|
instruments.push(lay);
|
|
5225
5177
|
instById.set(inst.tag, lay);
|
|
5226
5178
|
}
|
|
5227
|
-
const targetOf = (inst) => inst.inst.measures ?? inst.inst.controls ?? "";
|
|
5228
|
-
const fieldGroups = /* @__PURE__ */ new Map();
|
|
5229
|
-
for (const inst of instruments) {
|
|
5230
|
-
if (inst.inst.category.startsWith("cr_")) continue;
|
|
5231
|
-
const target = targetOf(inst);
|
|
5232
|
-
if (!target) continue;
|
|
5233
|
-
const group2 = fieldGroups.get(target) ?? [];
|
|
5234
|
-
group2.push(inst);
|
|
5235
|
-
fieldGroups.set(target, group2);
|
|
5236
|
-
}
|
|
5237
|
-
for (const group2 of fieldGroups.values()) {
|
|
5238
|
-
if (group2.length < 2) continue;
|
|
5239
|
-
group2.forEach((inst, idx) => {
|
|
5240
|
-
inst.cx += (idx - (group2.length - 1) / 2) * (INST_RADIUS * 2 + 12);
|
|
5241
|
-
});
|
|
5242
|
-
}
|
|
5243
5179
|
const sameRow = (a, b) => Math.abs(a.cy - b.cy) < INST_RADIUS && Math.abs(a.cx - b.cx) < INST_RADIUS * 2 + 8;
|
|
5244
5180
|
const sortedByX = [...instruments].sort((a, b) => a.cx - b.cx);
|
|
5245
5181
|
for (let i = 1; i < sortedByX.length; i++) {
|
|
@@ -5284,7 +5220,14 @@ function routeLine(ln, equipById, instById) {
|
|
|
5284
5220
|
const fromAnchor = resolveAnchor(ln.from.id, ln.from.port, "out", equipById, instById);
|
|
5285
5221
|
const toAnchor = resolveAnchor(ln.to.id, ln.to.port, "in", equipById, instById);
|
|
5286
5222
|
if (!fromAnchor || !toAnchor) return void 0;
|
|
5287
|
-
const { d, midX, midY } =
|
|
5223
|
+
const { d, midX, midY } = manhattanPath(
|
|
5224
|
+
fromAnchor.x,
|
|
5225
|
+
fromAnchor.y,
|
|
5226
|
+
fromAnchor.side,
|
|
5227
|
+
toAnchor.x,
|
|
5228
|
+
toAnchor.y,
|
|
5229
|
+
toAnchor.side
|
|
5230
|
+
);
|
|
5288
5231
|
return {
|
|
5289
5232
|
line: ln,
|
|
5290
5233
|
path: d,
|
|
@@ -5320,7 +5263,6 @@ var STYLE2 = `
|
|
|
5320
5263
|
.lt-pid-capillary { stroke: #1d1d1d; stroke-width: 1.4; fill: none; stroke-dasharray: 1 5; stroke-linecap: round; }
|
|
5321
5264
|
.lt-pid-software { stroke: #6a6a6a; stroke-width: 1.3; fill: none; stroke-dasharray: 2 4; }
|
|
5322
5265
|
.lt-pid-mechanical { stroke: #1d1d1d; stroke-width: 1.4; fill: none; stroke-dasharray: 3 2 1 2; }
|
|
5323
|
-
.lt-pid-line-path { fill: none; }
|
|
5324
5266
|
|
|
5325
5267
|
.lt-pid-pneumatic-tick { stroke: #1d1d1d; stroke-width: 1.2; }
|
|
5326
5268
|
|
|
@@ -5337,19 +5279,14 @@ var STYLE2 = `
|
|
|
5337
5279
|
`;
|
|
5338
5280
|
var ARROW_ID = "lt-pid-arrow";
|
|
5339
5281
|
function lineClass(t) {
|
|
5340
|
-
|
|
5341
|
-
case "process_minor":
|
|
5342
|
-
return "lt-pid-process-min";
|
|
5343
|
-
default:
|
|
5344
|
-
return `lt-pid-${t.replaceAll("_", "-")}`;
|
|
5345
|
-
}
|
|
5282
|
+
return `lt-pid-${t.replace("_", "-")}`;
|
|
5346
5283
|
}
|
|
5347
5284
|
function renderLine(l) {
|
|
5348
5285
|
const cls = lineClass(l.line.lineType);
|
|
5349
5286
|
const parts = [
|
|
5350
5287
|
chunk3WNW5Y7P_cjs.path({
|
|
5351
5288
|
d: l.path,
|
|
5352
|
-
class:
|
|
5289
|
+
class: cls,
|
|
5353
5290
|
"data-line-id": l.line.id,
|
|
5354
5291
|
"data-service": l.line.service ?? ""
|
|
5355
5292
|
})
|
|
@@ -5425,12 +5362,6 @@ function renderPidAST(ast, _config) {
|
|
|
5425
5362
|
return renderLayout2(layout);
|
|
5426
5363
|
}
|
|
5427
5364
|
function renderLayout2(layout) {
|
|
5428
|
-
const processLines = layout.lines.filter(
|
|
5429
|
-
(line2) => line2.line.lineType === "process" || line2.line.lineType === "process_minor"
|
|
5430
|
-
);
|
|
5431
|
-
const signalLines = layout.lines.filter(
|
|
5432
|
-
(line2) => line2.line.lineType !== "process" && line2.line.lineType !== "process_minor"
|
|
5433
|
-
);
|
|
5434
5365
|
const equipNodes = layout.equipment.map((eq) => {
|
|
5435
5366
|
const symbol = renderEquip(eq.equip.equipType, eq.equip.tag ?? eq.equip.id);
|
|
5436
5367
|
return chunk3WNW5Y7P_cjs.group(
|
|
@@ -5517,9 +5448,8 @@ function renderLayout2(layout) {
|
|
|
5517
5448
|
chunk3WNW5Y7P_cjs.el("style", {}, STYLE2)
|
|
5518
5449
|
]),
|
|
5519
5450
|
titleNode,
|
|
5520
|
-
chunk3WNW5Y7P_cjs.group({ class: "lt-pid-lines lt-pid-process-lines" }, processLines.map(renderLine)),
|
|
5521
5451
|
chunk3WNW5Y7P_cjs.group({ class: "lt-pid-equipment" }, equipNodes),
|
|
5522
|
-
chunk3WNW5Y7P_cjs.group({ class: "lt-pid-lines
|
|
5452
|
+
chunk3WNW5Y7P_cjs.group({ class: "lt-pid-lines" }, layout.lines.map(renderLine)),
|
|
5523
5453
|
chunk3WNW5Y7P_cjs.group({ class: "lt-pid-signals" }, autoSignals),
|
|
5524
5454
|
chunk3WNW5Y7P_cjs.group({ class: "lt-pid-instruments" }, instNodes)
|
|
5525
5455
|
]
|
|
@@ -10481,17 +10411,26 @@ var ALL_FRAG = /* @__PURE__ */ new Set([
|
|
|
10481
10411
|
...SIMPLE_FRAG,
|
|
10482
10412
|
...MULTI_FRAG
|
|
10483
10413
|
]);
|
|
10484
|
-
var ARROW_RE = /(
|
|
10485
|
-
function arrowKind(token) {
|
|
10414
|
+
var ARROW_RE = /(-->>|--\)|--x|-->|->>|o->|-\)|-x|->)/;
|
|
10415
|
+
function arrowKind(token, mermaid) {
|
|
10486
10416
|
switch (token) {
|
|
10417
|
+
case "-->>":
|
|
10418
|
+
return "reply";
|
|
10487
10419
|
case "-->":
|
|
10488
10420
|
return "reply";
|
|
10489
|
-
case "
|
|
10421
|
+
case "--)":
|
|
10422
|
+
return "async";
|
|
10423
|
+
case "-)":
|
|
10490
10424
|
return "async";
|
|
10491
10425
|
case "o->":
|
|
10492
10426
|
return "found";
|
|
10427
|
+
case "->>":
|
|
10428
|
+
return mermaid ? "sync" : "async";
|
|
10429
|
+
case "--x":
|
|
10430
|
+
return mermaid ? "reply" : "lost";
|
|
10431
|
+
// mermaid keeps the target (styled below)
|
|
10493
10432
|
case "-x":
|
|
10494
|
-
return "lost";
|
|
10433
|
+
return mermaid ? "sync" : "lost";
|
|
10495
10434
|
default:
|
|
10496
10435
|
return "sync";
|
|
10497
10436
|
}
|
|
@@ -10513,6 +10452,7 @@ var SequenceParser = class {
|
|
|
10513
10452
|
order = [];
|
|
10514
10453
|
byId = /* @__PURE__ */ new Map();
|
|
10515
10454
|
warnings = [];
|
|
10455
|
+
mermaid = false;
|
|
10516
10456
|
constructor(source) {
|
|
10517
10457
|
this.lines = source.split(/\r?\n/).map((raw, idx) => ({
|
|
10518
10458
|
text: raw.trim(),
|
|
@@ -10563,12 +10503,13 @@ var SequenceParser = class {
|
|
|
10563
10503
|
// ── header ───────────────────────────────────────────────────
|
|
10564
10504
|
consumeHeader() {
|
|
10565
10505
|
const ln = this.next();
|
|
10566
|
-
if (!ln || !/^sequence
|
|
10506
|
+
if (!ln || !/^sequence(?:diagram)?\b/i.test(ln.text)) {
|
|
10567
10507
|
throw new SequenceParseError(
|
|
10568
|
-
"A sequence diagram must start with the keyword 'sequence'",
|
|
10508
|
+
"A sequence diagram must start with the keyword 'sequence' (or Mermaid 'sequenceDiagram')",
|
|
10569
10509
|
ln?.n
|
|
10570
10510
|
);
|
|
10571
10511
|
}
|
|
10512
|
+
this.mermaid = /^sequencediagram\b/i.test(ln.text);
|
|
10572
10513
|
const title2 = chunkNAGUZFXX_cjs.matchQuotedTitle(ln.text);
|
|
10573
10514
|
return title2 ? { title: title2 } : {};
|
|
10574
10515
|
}
|
|
@@ -10795,7 +10736,7 @@ var SequenceParser = class {
|
|
|
10795
10736
|
deactivateSource = true;
|
|
10796
10737
|
right = right.slice(1).trim();
|
|
10797
10738
|
}
|
|
10798
|
-
const arrow2 = arrowKind(token);
|
|
10739
|
+
const arrow2 = arrowKind(token, this.mermaid);
|
|
10799
10740
|
let create = false;
|
|
10800
10741
|
if (right.startsWith("*")) {
|
|
10801
10742
|
create = true;
|
|
@@ -11607,7 +11548,7 @@ var sequence = {
|
|
|
11607
11548
|
const t = raw.trim();
|
|
11608
11549
|
if (!t) continue;
|
|
11609
11550
|
if (t.startsWith("#") || t.startsWith("//")) continue;
|
|
11610
|
-
return /^sequence
|
|
11551
|
+
return /^sequence(?:diagram)?\b/i.test(t);
|
|
11611
11552
|
}
|
|
11612
11553
|
return false;
|
|
11613
11554
|
},
|
|
@@ -16518,8 +16459,12 @@ function parseErd(text2) {
|
|
|
16518
16459
|
if (lines.length === 0) throw new ErdParseError("Empty input");
|
|
16519
16460
|
const header = lines[0];
|
|
16520
16461
|
const headerWords = header.text.split(/\s+/);
|
|
16521
|
-
|
|
16522
|
-
|
|
16462
|
+
const h0 = headerWords[0]?.toLowerCase();
|
|
16463
|
+
if (h0 === "erdiagram") {
|
|
16464
|
+
return parseMermaidErd(lines);
|
|
16465
|
+
}
|
|
16466
|
+
if (h0 !== "erd") {
|
|
16467
|
+
throw new ErdParseError(`Expected 'erd' (or Mermaid 'erDiagram') header, got: ${header.text}`, header.lineNumber);
|
|
16523
16468
|
}
|
|
16524
16469
|
let i = 1;
|
|
16525
16470
|
let notation = "crowsfoot";
|
|
@@ -16600,6 +16545,101 @@ function parseErd(text2) {
|
|
|
16600
16545
|
refs
|
|
16601
16546
|
};
|
|
16602
16547
|
}
|
|
16548
|
+
var MERMAID_NAME = /[A-Za-z_][\w-]*/;
|
|
16549
|
+
var REL_RE = new RegExp(
|
|
16550
|
+
`^(${MERMAID_NAME.source})\\s+([}|o][o|]|\\|\\||\\|o)(\\.\\.|--|~~)([}|o][{|]|\\|\\||o\\|)\\s+(${MERMAID_NAME.source})\\s*(?::\\s*(.*))?$`
|
|
16551
|
+
);
|
|
16552
|
+
function parseMermaidAttr(raw) {
|
|
16553
|
+
const tokens = raw.trim().split(/\s+/).filter(Boolean);
|
|
16554
|
+
const flags = { pk: false, fk: false, uk: false };
|
|
16555
|
+
const words = [];
|
|
16556
|
+
for (const tok of tokens) {
|
|
16557
|
+
const u = tok.toUpperCase();
|
|
16558
|
+
if (u === "PK") flags.pk = true;
|
|
16559
|
+
else if (u === "FK") flags.fk = true;
|
|
16560
|
+
else if (u === "UK") flags.uk = true;
|
|
16561
|
+
else words.push(tok);
|
|
16562
|
+
}
|
|
16563
|
+
const type = words.length >= 2 ? words[0] : void 0;
|
|
16564
|
+
const name = words.length >= 2 ? words[1] : words[0] ?? "";
|
|
16565
|
+
return {
|
|
16566
|
+
name,
|
|
16567
|
+
type,
|
|
16568
|
+
pk: flags.pk || void 0,
|
|
16569
|
+
fk: flags.fk || void 0,
|
|
16570
|
+
uk: flags.uk || void 0,
|
|
16571
|
+
notNull: flags.pk || void 0
|
|
16572
|
+
};
|
|
16573
|
+
}
|
|
16574
|
+
function parseMermaidErd(lines) {
|
|
16575
|
+
const entityMap = /* @__PURE__ */ new Map();
|
|
16576
|
+
const order = [];
|
|
16577
|
+
const refs = [];
|
|
16578
|
+
const ensure = (id) => {
|
|
16579
|
+
let e = entityMap.get(id);
|
|
16580
|
+
if (!e) {
|
|
16581
|
+
e = { id, name: id, attributes: [] };
|
|
16582
|
+
entityMap.set(id, e);
|
|
16583
|
+
order.push(id);
|
|
16584
|
+
}
|
|
16585
|
+
return e;
|
|
16586
|
+
};
|
|
16587
|
+
let i = 1;
|
|
16588
|
+
while (i < lines.length) {
|
|
16589
|
+
const t = lines[i].text;
|
|
16590
|
+
const ln = lines[i].lineNumber;
|
|
16591
|
+
const inlineBlock = new RegExp(`^(${MERMAID_NAME.source})\\s*\\{\\s*(.*?)\\s*\\}$`).exec(t);
|
|
16592
|
+
const openBlock = new RegExp(`^(${MERMAID_NAME.source})\\s*\\{$`).exec(t);
|
|
16593
|
+
if (inlineBlock) {
|
|
16594
|
+
const e = ensure(inlineBlock[1]);
|
|
16595
|
+
for (const a of inlineBlock[2].split(";").map((s) => s.trim()).filter(Boolean)) {
|
|
16596
|
+
e.attributes.push(parseMermaidAttr(a));
|
|
16597
|
+
}
|
|
16598
|
+
i++;
|
|
16599
|
+
continue;
|
|
16600
|
+
}
|
|
16601
|
+
if (openBlock) {
|
|
16602
|
+
const e = ensure(openBlock[1]);
|
|
16603
|
+
i++;
|
|
16604
|
+
while (i < lines.length && lines[i].text !== "}") {
|
|
16605
|
+
e.attributes.push(parseMermaidAttr(lines[i].text));
|
|
16606
|
+
i++;
|
|
16607
|
+
}
|
|
16608
|
+
if (i >= lines.length) throw new ErdParseError(`Unterminated entity block '${openBlock[1]}'.`, ln);
|
|
16609
|
+
i++;
|
|
16610
|
+
continue;
|
|
16611
|
+
}
|
|
16612
|
+
const rel = REL_RE.exec(t);
|
|
16613
|
+
if (rel) {
|
|
16614
|
+
const [, src, lg, line2, rg, tgt, label] = rel;
|
|
16615
|
+
const fromCard = parseMermaidGlyph(lg, "left");
|
|
16616
|
+
const toCard = parseMermaidGlyph(rg, "right");
|
|
16617
|
+
if (!fromCard || !toCard) {
|
|
16618
|
+
throw new ErdParseError(`Invalid Mermaid cardinality glyph in: ${t}`, ln);
|
|
16619
|
+
}
|
|
16620
|
+
ensure(src);
|
|
16621
|
+
ensure(tgt);
|
|
16622
|
+
refs.push({
|
|
16623
|
+
from: src,
|
|
16624
|
+
to: tgt,
|
|
16625
|
+
fromCard,
|
|
16626
|
+
toCard,
|
|
16627
|
+
identifying: line2 === "--",
|
|
16628
|
+
label: label ? label.trim() : void 0
|
|
16629
|
+
});
|
|
16630
|
+
i++;
|
|
16631
|
+
continue;
|
|
16632
|
+
}
|
|
16633
|
+
throw new ErdParseError(`Unrecognized erDiagram line: ${t}`, ln);
|
|
16634
|
+
}
|
|
16635
|
+
return {
|
|
16636
|
+
type: "erd",
|
|
16637
|
+
notation: "crowsfoot",
|
|
16638
|
+
direction: "LR",
|
|
16639
|
+
entities: order.map((id) => entityMap.get(id)),
|
|
16640
|
+
refs
|
|
16641
|
+
};
|
|
16642
|
+
}
|
|
16603
16643
|
function parseTableBlock(lines, startIdx, outEntities) {
|
|
16604
16644
|
const head = lines[startIdx];
|
|
16605
16645
|
const inlineMatch = /^table\s+(.+?)\s*\{\s*(.*?)\s*\}\s*$/i.exec(head.text);
|
|
@@ -17518,7 +17558,7 @@ var erd = {
|
|
|
17518
17558
|
if (t.length === 0) continue;
|
|
17519
17559
|
if (t.startsWith("//") || t.startsWith("#")) continue;
|
|
17520
17560
|
const first = t.split(/\s+/)[0]?.toLowerCase() ?? "";
|
|
17521
|
-
return first === "erd";
|
|
17561
|
+
return first === "erd" || first === "erdiagram";
|
|
17522
17562
|
}
|
|
17523
17563
|
return false;
|
|
17524
17564
|
},
|
|
@@ -22446,12 +22486,12 @@ var plugins = [
|
|
|
22446
22486
|
chunkYB4XJY5L_cjs.pedigree,
|
|
22447
22487
|
chunk4UFR2LB6_cjs.phylo,
|
|
22448
22488
|
chunkWQDIZH2Z_cjs.sociogram,
|
|
22449
|
-
|
|
22489
|
+
chunk2F45Y2ON_cjs.timing,
|
|
22450
22490
|
chunkR66QG3XT_cjs.logic,
|
|
22451
|
-
|
|
22452
|
-
|
|
22491
|
+
chunk3JAI3OVG_cjs.circuit,
|
|
22492
|
+
chunkSUIDD2C5_cjs.blockdiagram,
|
|
22453
22493
|
chunk2L4YXZAZ_cjs.ladder,
|
|
22454
|
-
|
|
22494
|
+
chunkECD5XHBM_cjs.sld,
|
|
22455
22495
|
chunkV4GILQR6_cjs.entity,
|
|
22456
22496
|
chunkHWVBHU3O_cjs.fishbone,
|
|
22457
22497
|
chunkC5C5EF3W_cjs.venn,
|
|
@@ -22611,5 +22651,5 @@ exports.sequence = sequence;
|
|
|
22611
22651
|
exports.state = state;
|
|
22612
22652
|
exports.timeline = timeline;
|
|
22613
22653
|
exports.usecase = usecase;
|
|
22614
|
-
//# sourceMappingURL=chunk-
|
|
22615
|
-
//# sourceMappingURL=chunk-
|
|
22654
|
+
//# sourceMappingURL=chunk-KSNUMQGS.cjs.map
|
|
22655
|
+
//# sourceMappingURL=chunk-KSNUMQGS.cjs.map
|