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,8 +1,8 @@
|
|
|
1
1
|
import { orgchart } from './chunk-RJMCWT7Z.js';
|
|
2
|
-
import { circuit } from './chunk-
|
|
3
|
-
import { blockdiagram } from './chunk-
|
|
2
|
+
import { circuit } from './chunk-JVAJ6ZLO.js';
|
|
3
|
+
import { blockdiagram } from './chunk-EPKIJEH7.js';
|
|
4
4
|
import { ladder } from './chunk-TWLKXV2O.js';
|
|
5
|
-
import { sld } from './chunk-
|
|
5
|
+
import { sld } from './chunk-LGABFD3L.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';
|
|
@@ -13,7 +13,7 @@ import { pedigree } from './chunk-N5B242WY.js';
|
|
|
13
13
|
import { parseFrontmatter } from './chunk-2KTQ75LN.js';
|
|
14
14
|
import { phylo } from './chunk-MVIEIKOI.js';
|
|
15
15
|
import { sociogram } from './chunk-3VB5AT4R.js';
|
|
16
|
-
import { timing } from './chunk-
|
|
16
|
+
import { timing } from './chunk-P26FCZP3.js';
|
|
17
17
|
import { logic } from './chunk-3IE7KZY4.js';
|
|
18
18
|
import { resolveBaseTheme, resolveTimelineTheme, cssCustomProperties, resolvePetriTheme, resolveNetworkTheme, resolveMindmapTheme } from './chunk-LRI4RH2N.js';
|
|
19
19
|
import { matchQuotedTitle, stripQuotes } from './chunk-5IKOLUWK.js';
|
|
@@ -4355,8 +4355,7 @@ 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:
|
|
4359
|
-
right: { x: 45, y: 10 }
|
|
4358
|
+
out: { x: 0, y: 55 }
|
|
4360
4359
|
}
|
|
4361
4360
|
},
|
|
4362
4361
|
reactor_pfr: {
|
|
@@ -5051,10 +5050,9 @@ function renderInstrument(category, letterCode, loopNumber) {
|
|
|
5051
5050
|
// src/diagrams/pid/layout.ts
|
|
5052
5051
|
var PADDING = 30;
|
|
5053
5052
|
var TITLE_AREA = 26;
|
|
5054
|
-
var EQUIP_GAP_X =
|
|
5053
|
+
var EQUIP_GAP_X = 70;
|
|
5055
5054
|
var INST_RADIUS = 14;
|
|
5056
|
-
var INST_OFFSET =
|
|
5057
|
-
var PORT_CLEARANCE = 18;
|
|
5055
|
+
var INST_OFFSET = 38;
|
|
5058
5056
|
function defaultPort(direction, equip) {
|
|
5059
5057
|
if (equip.equipType === "tank_atm" || equip.equipType === "tank_cone_roof") {
|
|
5060
5058
|
return direction === "out" ? "bottom" : "top";
|
|
@@ -5066,9 +5064,8 @@ function defaultPort(direction, equip) {
|
|
|
5066
5064
|
}
|
|
5067
5065
|
function resolveSide(port) {
|
|
5068
5066
|
if (port === "top" || port === "vapor_out" || port === "reflux") return "top";
|
|
5069
|
-
if (port === "bottom" || port === "liquid_out" || port === "bottom_return"
|
|
5070
|
-
if (port === "left" || port === "in" || port === "feed" || port === "tube_in") return "left";
|
|
5071
|
-
if (port === "shell_in") 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";
|
|
5072
5069
|
return "right";
|
|
5073
5070
|
}
|
|
5074
5071
|
function getAnchor(layoutEq, port, fallback) {
|
|
@@ -5113,53 +5110,12 @@ function manhattanPath(fromX, fromY, fromSide, toX, toY, toSide) {
|
|
|
5113
5110
|
midY: toY
|
|
5114
5111
|
};
|
|
5115
5112
|
}
|
|
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
|
-
}
|
|
5157
5113
|
function layoutPid(ast) {
|
|
5158
5114
|
const equipment = [];
|
|
5159
5115
|
const equipById = /* @__PURE__ */ new Map();
|
|
5160
5116
|
const heights = ast.equipment.map((e) => GEOMETRY[e.equipType]?.height ?? 60);
|
|
5161
5117
|
const maxH = Math.max(...heights, 0);
|
|
5162
|
-
const rowY = PADDING + TITLE_AREA + maxH / 2 +
|
|
5118
|
+
const rowY = PADDING + TITLE_AREA + maxH / 2 + 30;
|
|
5163
5119
|
let cursorX = PADDING + 40;
|
|
5164
5120
|
for (const equip of ast.equipment) {
|
|
5165
5121
|
const geo = GEOMETRY[equip.equipType] ?? { width: 60, height: 40, ports: {} };
|
|
@@ -5187,7 +5143,7 @@ function layoutPid(ast) {
|
|
|
5187
5143
|
}
|
|
5188
5144
|
const instruments = [];
|
|
5189
5145
|
const instById = /* @__PURE__ */ new Map();
|
|
5190
|
-
const crBandY = PADDING + TITLE_AREA +
|
|
5146
|
+
const crBandY = PADDING + TITLE_AREA + 40;
|
|
5191
5147
|
let crSlot = 0;
|
|
5192
5148
|
for (const inst of ast.instruments) {
|
|
5193
5149
|
let cx = 0;
|
|
@@ -5202,16 +5158,12 @@ function layoutPid(ast) {
|
|
|
5202
5158
|
cy = rowY + maxH / 2 + INST_OFFSET + INST_RADIUS;
|
|
5203
5159
|
const tgt = inst.measures ?? inst.controls ?? "";
|
|
5204
5160
|
const tgtEq = equipById.get(tgt);
|
|
5205
|
-
|
|
5206
|
-
const lineMid = tgtLine ? lineMidpoint(tgtLine, equipById) : void 0;
|
|
5207
|
-
cx = tgtEq ? tgtEq.cx : lineMid ? lineMid.x : PADDING + 80;
|
|
5161
|
+
cx = tgtEq ? tgtEq.cx : PADDING + 80;
|
|
5208
5162
|
} else {
|
|
5209
5163
|
cy = rowY + maxH / 2 + INST_OFFSET;
|
|
5210
5164
|
const tgt = inst.measures ?? inst.controls ?? "";
|
|
5211
5165
|
const tgtEq = equipById.get(tgt);
|
|
5212
|
-
|
|
5213
|
-
const lineMid = tgtLine ? lineMidpoint(tgtLine, equipById) : void 0;
|
|
5214
|
-
cx = tgtEq ? tgtEq.cx : lineMid ? lineMid.x : PADDING + 80;
|
|
5166
|
+
cx = tgtEq ? tgtEq.cx : PADDING + 80;
|
|
5215
5167
|
}
|
|
5216
5168
|
const lay = {
|
|
5217
5169
|
inst,
|
|
@@ -5222,22 +5174,6 @@ function layoutPid(ast) {
|
|
|
5222
5174
|
instruments.push(lay);
|
|
5223
5175
|
instById.set(inst.tag, lay);
|
|
5224
5176
|
}
|
|
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
|
-
}
|
|
5241
5177
|
const sameRow = (a, b) => Math.abs(a.cy - b.cy) < INST_RADIUS && Math.abs(a.cx - b.cx) < INST_RADIUS * 2 + 8;
|
|
5242
5178
|
const sortedByX = [...instruments].sort((a, b) => a.cx - b.cx);
|
|
5243
5179
|
for (let i = 1; i < sortedByX.length; i++) {
|
|
@@ -5282,7 +5218,14 @@ function routeLine(ln, equipById, instById) {
|
|
|
5282
5218
|
const fromAnchor = resolveAnchor(ln.from.id, ln.from.port, "out", equipById, instById);
|
|
5283
5219
|
const toAnchor = resolveAnchor(ln.to.id, ln.to.port, "in", equipById, instById);
|
|
5284
5220
|
if (!fromAnchor || !toAnchor) return void 0;
|
|
5285
|
-
const { d, midX, midY } =
|
|
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
|
+
);
|
|
5286
5229
|
return {
|
|
5287
5230
|
line: ln,
|
|
5288
5231
|
path: d,
|
|
@@ -5318,7 +5261,6 @@ var STYLE2 = `
|
|
|
5318
5261
|
.lt-pid-capillary { stroke: #1d1d1d; stroke-width: 1.4; fill: none; stroke-dasharray: 1 5; stroke-linecap: round; }
|
|
5319
5262
|
.lt-pid-software { stroke: #6a6a6a; stroke-width: 1.3; fill: none; stroke-dasharray: 2 4; }
|
|
5320
5263
|
.lt-pid-mechanical { stroke: #1d1d1d; stroke-width: 1.4; fill: none; stroke-dasharray: 3 2 1 2; }
|
|
5321
|
-
.lt-pid-line-path { fill: none; }
|
|
5322
5264
|
|
|
5323
5265
|
.lt-pid-pneumatic-tick { stroke: #1d1d1d; stroke-width: 1.2; }
|
|
5324
5266
|
|
|
@@ -5335,19 +5277,14 @@ var STYLE2 = `
|
|
|
5335
5277
|
`;
|
|
5336
5278
|
var ARROW_ID = "lt-pid-arrow";
|
|
5337
5279
|
function lineClass(t) {
|
|
5338
|
-
|
|
5339
|
-
case "process_minor":
|
|
5340
|
-
return "lt-pid-process-min";
|
|
5341
|
-
default:
|
|
5342
|
-
return `lt-pid-${t.replaceAll("_", "-")}`;
|
|
5343
|
-
}
|
|
5280
|
+
return `lt-pid-${t.replace("_", "-")}`;
|
|
5344
5281
|
}
|
|
5345
5282
|
function renderLine(l) {
|
|
5346
5283
|
const cls = lineClass(l.line.lineType);
|
|
5347
5284
|
const parts = [
|
|
5348
5285
|
path({
|
|
5349
5286
|
d: l.path,
|
|
5350
|
-
class:
|
|
5287
|
+
class: cls,
|
|
5351
5288
|
"data-line-id": l.line.id,
|
|
5352
5289
|
"data-service": l.line.service ?? ""
|
|
5353
5290
|
})
|
|
@@ -5423,12 +5360,6 @@ function renderPidAST(ast, _config) {
|
|
|
5423
5360
|
return renderLayout2(layout);
|
|
5424
5361
|
}
|
|
5425
5362
|
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
|
-
);
|
|
5432
5363
|
const equipNodes = layout.equipment.map((eq) => {
|
|
5433
5364
|
const symbol = renderEquip(eq.equip.equipType, eq.equip.tag ?? eq.equip.id);
|
|
5434
5365
|
return group(
|
|
@@ -5515,9 +5446,8 @@ function renderLayout2(layout) {
|
|
|
5515
5446
|
el("style", {}, STYLE2)
|
|
5516
5447
|
]),
|
|
5517
5448
|
titleNode,
|
|
5518
|
-
group({ class: "lt-pid-lines lt-pid-process-lines" }, processLines.map(renderLine)),
|
|
5519
5449
|
group({ class: "lt-pid-equipment" }, equipNodes),
|
|
5520
|
-
group({ class: "lt-pid-lines
|
|
5450
|
+
group({ class: "lt-pid-lines" }, layout.lines.map(renderLine)),
|
|
5521
5451
|
group({ class: "lt-pid-signals" }, autoSignals),
|
|
5522
5452
|
group({ class: "lt-pid-instruments" }, instNodes)
|
|
5523
5453
|
]
|
|
@@ -10479,17 +10409,26 @@ var ALL_FRAG = /* @__PURE__ */ new Set([
|
|
|
10479
10409
|
...SIMPLE_FRAG,
|
|
10480
10410
|
...MULTI_FRAG
|
|
10481
10411
|
]);
|
|
10482
|
-
var ARROW_RE = /(
|
|
10483
|
-
function arrowKind(token) {
|
|
10412
|
+
var ARROW_RE = /(-->>|--\)|--x|-->|->>|o->|-\)|-x|->)/;
|
|
10413
|
+
function arrowKind(token, mermaid) {
|
|
10484
10414
|
switch (token) {
|
|
10415
|
+
case "-->>":
|
|
10416
|
+
return "reply";
|
|
10485
10417
|
case "-->":
|
|
10486
10418
|
return "reply";
|
|
10487
|
-
case "
|
|
10419
|
+
case "--)":
|
|
10420
|
+
return "async";
|
|
10421
|
+
case "-)":
|
|
10488
10422
|
return "async";
|
|
10489
10423
|
case "o->":
|
|
10490
10424
|
return "found";
|
|
10425
|
+
case "->>":
|
|
10426
|
+
return mermaid ? "sync" : "async";
|
|
10427
|
+
case "--x":
|
|
10428
|
+
return mermaid ? "reply" : "lost";
|
|
10429
|
+
// mermaid keeps the target (styled below)
|
|
10491
10430
|
case "-x":
|
|
10492
|
-
return "lost";
|
|
10431
|
+
return mermaid ? "sync" : "lost";
|
|
10493
10432
|
default:
|
|
10494
10433
|
return "sync";
|
|
10495
10434
|
}
|
|
@@ -10511,6 +10450,7 @@ var SequenceParser = class {
|
|
|
10511
10450
|
order = [];
|
|
10512
10451
|
byId = /* @__PURE__ */ new Map();
|
|
10513
10452
|
warnings = [];
|
|
10453
|
+
mermaid = false;
|
|
10514
10454
|
constructor(source) {
|
|
10515
10455
|
this.lines = source.split(/\r?\n/).map((raw, idx) => ({
|
|
10516
10456
|
text: raw.trim(),
|
|
@@ -10561,12 +10501,13 @@ var SequenceParser = class {
|
|
|
10561
10501
|
// ── header ───────────────────────────────────────────────────
|
|
10562
10502
|
consumeHeader() {
|
|
10563
10503
|
const ln = this.next();
|
|
10564
|
-
if (!ln || !/^sequence
|
|
10504
|
+
if (!ln || !/^sequence(?:diagram)?\b/i.test(ln.text)) {
|
|
10565
10505
|
throw new SequenceParseError(
|
|
10566
|
-
"A sequence diagram must start with the keyword 'sequence'",
|
|
10506
|
+
"A sequence diagram must start with the keyword 'sequence' (or Mermaid 'sequenceDiagram')",
|
|
10567
10507
|
ln?.n
|
|
10568
10508
|
);
|
|
10569
10509
|
}
|
|
10510
|
+
this.mermaid = /^sequencediagram\b/i.test(ln.text);
|
|
10570
10511
|
const title2 = matchQuotedTitle(ln.text);
|
|
10571
10512
|
return title2 ? { title: title2 } : {};
|
|
10572
10513
|
}
|
|
@@ -10793,7 +10734,7 @@ var SequenceParser = class {
|
|
|
10793
10734
|
deactivateSource = true;
|
|
10794
10735
|
right = right.slice(1).trim();
|
|
10795
10736
|
}
|
|
10796
|
-
const arrow2 = arrowKind(token);
|
|
10737
|
+
const arrow2 = arrowKind(token, this.mermaid);
|
|
10797
10738
|
let create = false;
|
|
10798
10739
|
if (right.startsWith("*")) {
|
|
10799
10740
|
create = true;
|
|
@@ -11605,7 +11546,7 @@ var sequence = {
|
|
|
11605
11546
|
const t = raw.trim();
|
|
11606
11547
|
if (!t) continue;
|
|
11607
11548
|
if (t.startsWith("#") || t.startsWith("//")) continue;
|
|
11608
|
-
return /^sequence
|
|
11549
|
+
return /^sequence(?:diagram)?\b/i.test(t);
|
|
11609
11550
|
}
|
|
11610
11551
|
return false;
|
|
11611
11552
|
},
|
|
@@ -16516,8 +16457,12 @@ function parseErd(text2) {
|
|
|
16516
16457
|
if (lines.length === 0) throw new ErdParseError("Empty input");
|
|
16517
16458
|
const header = lines[0];
|
|
16518
16459
|
const headerWords = header.text.split(/\s+/);
|
|
16519
|
-
|
|
16520
|
-
|
|
16460
|
+
const h0 = headerWords[0]?.toLowerCase();
|
|
16461
|
+
if (h0 === "erdiagram") {
|
|
16462
|
+
return parseMermaidErd(lines);
|
|
16463
|
+
}
|
|
16464
|
+
if (h0 !== "erd") {
|
|
16465
|
+
throw new ErdParseError(`Expected 'erd' (or Mermaid 'erDiagram') header, got: ${header.text}`, header.lineNumber);
|
|
16521
16466
|
}
|
|
16522
16467
|
let i = 1;
|
|
16523
16468
|
let notation = "crowsfoot";
|
|
@@ -16598,6 +16543,101 @@ function parseErd(text2) {
|
|
|
16598
16543
|
refs
|
|
16599
16544
|
};
|
|
16600
16545
|
}
|
|
16546
|
+
var MERMAID_NAME = /[A-Za-z_][\w-]*/;
|
|
16547
|
+
var REL_RE = new RegExp(
|
|
16548
|
+
`^(${MERMAID_NAME.source})\\s+([}|o][o|]|\\|\\||\\|o)(\\.\\.|--|~~)([}|o][{|]|\\|\\||o\\|)\\s+(${MERMAID_NAME.source})\\s*(?::\\s*(.*))?$`
|
|
16549
|
+
);
|
|
16550
|
+
function parseMermaidAttr(raw) {
|
|
16551
|
+
const tokens = raw.trim().split(/\s+/).filter(Boolean);
|
|
16552
|
+
const flags = { pk: false, fk: false, uk: false };
|
|
16553
|
+
const words = [];
|
|
16554
|
+
for (const tok of tokens) {
|
|
16555
|
+
const u = tok.toUpperCase();
|
|
16556
|
+
if (u === "PK") flags.pk = true;
|
|
16557
|
+
else if (u === "FK") flags.fk = true;
|
|
16558
|
+
else if (u === "UK") flags.uk = true;
|
|
16559
|
+
else words.push(tok);
|
|
16560
|
+
}
|
|
16561
|
+
const type = words.length >= 2 ? words[0] : void 0;
|
|
16562
|
+
const name = words.length >= 2 ? words[1] : words[0] ?? "";
|
|
16563
|
+
return {
|
|
16564
|
+
name,
|
|
16565
|
+
type,
|
|
16566
|
+
pk: flags.pk || void 0,
|
|
16567
|
+
fk: flags.fk || void 0,
|
|
16568
|
+
uk: flags.uk || void 0,
|
|
16569
|
+
notNull: flags.pk || void 0
|
|
16570
|
+
};
|
|
16571
|
+
}
|
|
16572
|
+
function parseMermaidErd(lines) {
|
|
16573
|
+
const entityMap = /* @__PURE__ */ new Map();
|
|
16574
|
+
const order = [];
|
|
16575
|
+
const refs = [];
|
|
16576
|
+
const ensure = (id) => {
|
|
16577
|
+
let e = entityMap.get(id);
|
|
16578
|
+
if (!e) {
|
|
16579
|
+
e = { id, name: id, attributes: [] };
|
|
16580
|
+
entityMap.set(id, e);
|
|
16581
|
+
order.push(id);
|
|
16582
|
+
}
|
|
16583
|
+
return e;
|
|
16584
|
+
};
|
|
16585
|
+
let i = 1;
|
|
16586
|
+
while (i < lines.length) {
|
|
16587
|
+
const t = lines[i].text;
|
|
16588
|
+
const ln = lines[i].lineNumber;
|
|
16589
|
+
const inlineBlock = new RegExp(`^(${MERMAID_NAME.source})\\s*\\{\\s*(.*?)\\s*\\}$`).exec(t);
|
|
16590
|
+
const openBlock = new RegExp(`^(${MERMAID_NAME.source})\\s*\\{$`).exec(t);
|
|
16591
|
+
if (inlineBlock) {
|
|
16592
|
+
const e = ensure(inlineBlock[1]);
|
|
16593
|
+
for (const a of inlineBlock[2].split(";").map((s) => s.trim()).filter(Boolean)) {
|
|
16594
|
+
e.attributes.push(parseMermaidAttr(a));
|
|
16595
|
+
}
|
|
16596
|
+
i++;
|
|
16597
|
+
continue;
|
|
16598
|
+
}
|
|
16599
|
+
if (openBlock) {
|
|
16600
|
+
const e = ensure(openBlock[1]);
|
|
16601
|
+
i++;
|
|
16602
|
+
while (i < lines.length && lines[i].text !== "}") {
|
|
16603
|
+
e.attributes.push(parseMermaidAttr(lines[i].text));
|
|
16604
|
+
i++;
|
|
16605
|
+
}
|
|
16606
|
+
if (i >= lines.length) throw new ErdParseError(`Unterminated entity block '${openBlock[1]}'.`, ln);
|
|
16607
|
+
i++;
|
|
16608
|
+
continue;
|
|
16609
|
+
}
|
|
16610
|
+
const rel = REL_RE.exec(t);
|
|
16611
|
+
if (rel) {
|
|
16612
|
+
const [, src, lg, line2, rg, tgt, label] = rel;
|
|
16613
|
+
const fromCard = parseMermaidGlyph(lg, "left");
|
|
16614
|
+
const toCard = parseMermaidGlyph(rg, "right");
|
|
16615
|
+
if (!fromCard || !toCard) {
|
|
16616
|
+
throw new ErdParseError(`Invalid Mermaid cardinality glyph in: ${t}`, ln);
|
|
16617
|
+
}
|
|
16618
|
+
ensure(src);
|
|
16619
|
+
ensure(tgt);
|
|
16620
|
+
refs.push({
|
|
16621
|
+
from: src,
|
|
16622
|
+
to: tgt,
|
|
16623
|
+
fromCard,
|
|
16624
|
+
toCard,
|
|
16625
|
+
identifying: line2 === "--",
|
|
16626
|
+
label: label ? label.trim() : void 0
|
|
16627
|
+
});
|
|
16628
|
+
i++;
|
|
16629
|
+
continue;
|
|
16630
|
+
}
|
|
16631
|
+
throw new ErdParseError(`Unrecognized erDiagram line: ${t}`, ln);
|
|
16632
|
+
}
|
|
16633
|
+
return {
|
|
16634
|
+
type: "erd",
|
|
16635
|
+
notation: "crowsfoot",
|
|
16636
|
+
direction: "LR",
|
|
16637
|
+
entities: order.map((id) => entityMap.get(id)),
|
|
16638
|
+
refs
|
|
16639
|
+
};
|
|
16640
|
+
}
|
|
16601
16641
|
function parseTableBlock(lines, startIdx, outEntities) {
|
|
16602
16642
|
const head = lines[startIdx];
|
|
16603
16643
|
const inlineMatch = /^table\s+(.+?)\s*\{\s*(.*?)\s*\}\s*$/i.exec(head.text);
|
|
@@ -17516,7 +17556,7 @@ var erd = {
|
|
|
17516
17556
|
if (t.length === 0) continue;
|
|
17517
17557
|
if (t.startsWith("//") || t.startsWith("#")) continue;
|
|
17518
17558
|
const first = t.split(/\s+/)[0]?.toLowerCase() ?? "";
|
|
17519
|
-
return first === "erd";
|
|
17559
|
+
return first === "erd" || first === "erdiagram";
|
|
17520
17560
|
}
|
|
17521
17561
|
return false;
|
|
17522
17562
|
},
|
|
@@ -22591,5 +22631,5 @@ function renderWithPlugin(prepared, plugin, config) {
|
|
|
22591
22631
|
}
|
|
22592
22632
|
|
|
22593
22633
|
export { GEOMETRY, decisiontree, drawDeviceIcon, iconSize, network, parse, parseResult, pert, petri, pid, prisma, render, renderEquip, renderPreview, renderResult, sequence, state, timeline, usecase };
|
|
22594
|
-
//# sourceMappingURL=chunk-
|
|
22595
|
-
//# sourceMappingURL=chunk-
|
|
22634
|
+
//# sourceMappingURL=chunk-IZWKJVIC.js.map
|
|
22635
|
+
//# sourceMappingURL=chunk-IZWKJVIC.js.map
|