schematex 0.6.9 → 0.6.10

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.
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var chunk25TO5A4F_cjs = require('../chunk-25TO5A4F.cjs');
4
- require('../chunk-5IZL57YJ.cjs');
3
+ var chunkDZGA25O5_cjs = require('../chunk-DZGA25O5.cjs');
4
+ require('../chunk-3YRYBTLG.cjs');
5
5
  require('../chunk-UHPGWO77.cjs');
6
6
  require('../chunk-J3EPFZPX.cjs');
7
7
  require('../chunk-SHMG7BVF.cjs');
@@ -31,7 +31,7 @@ var schematexTools = {
31
31
  listDiagrams: ai.tool({
32
32
  description: "List every Schematex diagram type with a tagline, 'use when' hint, domain cluster, and authoritative standard. Call this first to discover what's available.",
33
33
  inputSchema: zod.z.object({}),
34
- execute: async () => chunk25TO5A4F_cjs.listDiagrams()
34
+ execute: async () => chunkDZGA25O5_cjs.listDiagrams()
35
35
  }),
36
36
  getSyntax: ai.tool({
37
37
  description: "Return syntax for one diagram type. Default `detail: canonical` is the compact first-shot generation path: canonical header, preferred forms, rules, and repair checks. Request `detail: reference` only for advanced forms or imported adapters after choosing a type.",
@@ -46,7 +46,7 @@ var schematexTools = {
46
46
  execute: async ({
47
47
  type,
48
48
  detail
49
- }) => chunk25TO5A4F_cjs.getSyntax(type, { detail })
49
+ }) => chunkDZGA25O5_cjs.getSyntax(type, { detail })
50
50
  }),
51
51
  getExamples: ai.tool({
52
52
  description: "Return curated real-world DSL examples for a diagram type, each with scenario notes and tags. Use as few-shot context before generating DSL.",
@@ -56,7 +56,7 @@ var schematexTools = {
56
56
  preferFeatured: zod.z.boolean().optional().describe("Rank featured examples first."),
57
57
  maxComplexity: zod.z.number().int().min(1).max(5).optional().describe("Only return examples with complexity <= this value (1=simplest).")
58
58
  }),
59
- execute: async (args) => chunk25TO5A4F_cjs.getExamples(args.type, {
59
+ execute: async (args) => chunkDZGA25O5_cjs.getExamples(args.type, {
60
60
  limit: args.limit,
61
61
  preferFeatured: args.preferFeatured,
62
62
  maxComplexity: args.maxComplexity
@@ -70,7 +70,7 @@ var schematexTools = {
70
70
  ),
71
71
  dsl: zod.z.string().describe("The DSL source text to validate.")
72
72
  }),
73
- execute: async ({ type, dsl }) => chunk25TO5A4F_cjs.validateDsl(type, dsl)
73
+ execute: async ({ type, dsl }) => chunkDZGA25O5_cjs.validateDsl(type, dsl)
74
74
  }),
75
75
  renderDsl: ai.tool({
76
76
  description: "Render Schematex DSL to an SVG string. Returns { ok: true, svg } or { ok: false, errors }. Use when the caller needs the actual diagram output, not just validation.",
@@ -85,7 +85,7 @@ var schematexTools = {
85
85
  dsl,
86
86
  theme,
87
87
  padding
88
- }) => chunk25TO5A4F_cjs.renderDsl(type, dsl, { theme, padding })
88
+ }) => chunkDZGA25O5_cjs.renderDsl(type, dsl, { theme, padding })
89
89
  })
90
90
  };
91
91
 
@@ -7,7 +7,7 @@ declare const schematexTools: {
7
7
  readonly listDiagrams: ai.Tool<{}, DiagramListItem[]>;
8
8
  readonly getSyntax: ai.Tool<{
9
9
  type: string;
10
- detail?: "reference" | "canonical" | undefined;
10
+ detail?: "canonical" | "reference" | undefined;
11
11
  }, GetSyntaxResult>;
12
12
  readonly getExamples: ai.Tool<{
13
13
  type: string;
@@ -7,7 +7,7 @@ declare const schematexTools: {
7
7
  readonly listDiagrams: ai.Tool<{}, DiagramListItem[]>;
8
8
  readonly getSyntax: ai.Tool<{
9
9
  type: string;
10
- detail?: "reference" | "canonical" | undefined;
10
+ detail?: "canonical" | "reference" | undefined;
11
11
  }, GetSyntaxResult>;
12
12
  readonly getExamples: ai.Tool<{
13
13
  type: string;
package/dist/ai/ai-sdk.js CHANGED
@@ -1,5 +1,5 @@
1
- import { renderDsl, validateDsl, getExamples, getSyntax, listDiagrams } from '../chunk-Q5V4LUQR.js';
2
- import '../chunk-3DPWFWQU.js';
1
+ import { renderDsl, validateDsl, getExamples, getSyntax, listDiagrams } from '../chunk-X4P4HKHP.js';
2
+ import '../chunk-6AWASOFO.js';
3
3
  import '../chunk-MPCSWRZC.js';
4
4
  import '../chunk-2TUZ3QJA.js';
5
5
  import '../chunk-C7V57V6O.js';
package/dist/ai/index.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var chunk25TO5A4F_cjs = require('../chunk-25TO5A4F.cjs');
4
- require('../chunk-5IZL57YJ.cjs');
3
+ var chunkDZGA25O5_cjs = require('../chunk-DZGA25O5.cjs');
4
+ require('../chunk-3YRYBTLG.cjs');
5
5
  require('../chunk-UHPGWO77.cjs');
6
6
  require('../chunk-J3EPFZPX.cjs');
7
7
  require('../chunk-SHMG7BVF.cjs');
@@ -29,47 +29,47 @@ require('../chunk-3WNW5Y7P.cjs');
29
29
 
30
30
  Object.defineProperty(exports, "DIAGRAM_REGISTRY", {
31
31
  enumerable: true,
32
- get: function () { return chunk25TO5A4F_cjs.DIAGRAM_REGISTRY; }
32
+ get: function () { return chunkDZGA25O5_cjs.DIAGRAM_REGISTRY; }
33
33
  });
34
34
  Object.defineProperty(exports, "DIAGRAM_SINCE", {
35
35
  enumerable: true,
36
- get: function () { return chunk25TO5A4F_cjs.DIAGRAM_SINCE; }
36
+ get: function () { return chunkDZGA25O5_cjs.DIAGRAM_SINCE; }
37
37
  });
38
38
  Object.defineProperty(exports, "getAllDiagramTypes", {
39
39
  enumerable: true,
40
- get: function () { return chunk25TO5A4F_cjs.getAllDiagramTypes; }
40
+ get: function () { return chunkDZGA25O5_cjs.getAllDiagramTypes; }
41
41
  });
42
42
  Object.defineProperty(exports, "getDiagramMeta", {
43
43
  enumerable: true,
44
- get: function () { return chunk25TO5A4F_cjs.getDiagramMeta; }
44
+ get: function () { return chunkDZGA25O5_cjs.getDiagramMeta; }
45
45
  });
46
46
  Object.defineProperty(exports, "getDiagramSince", {
47
47
  enumerable: true,
48
- get: function () { return chunk25TO5A4F_cjs.getDiagramSince; }
48
+ get: function () { return chunkDZGA25O5_cjs.getDiagramSince; }
49
49
  });
50
50
  Object.defineProperty(exports, "getExamples", {
51
51
  enumerable: true,
52
- get: function () { return chunk25TO5A4F_cjs.getExamples; }
52
+ get: function () { return chunkDZGA25O5_cjs.getExamples; }
53
53
  });
54
54
  Object.defineProperty(exports, "getSyntax", {
55
55
  enumerable: true,
56
- get: function () { return chunk25TO5A4F_cjs.getSyntax; }
56
+ get: function () { return chunkDZGA25O5_cjs.getSyntax; }
57
57
  });
58
58
  Object.defineProperty(exports, "listDiagrams", {
59
59
  enumerable: true,
60
- get: function () { return chunk25TO5A4F_cjs.listDiagrams; }
60
+ get: function () { return chunkDZGA25O5_cjs.listDiagrams; }
61
61
  });
62
62
  Object.defineProperty(exports, "renderDsl", {
63
63
  enumerable: true,
64
- get: function () { return chunk25TO5A4F_cjs.renderDsl; }
64
+ get: function () { return chunkDZGA25O5_cjs.renderDsl; }
65
65
  });
66
66
  Object.defineProperty(exports, "resolveDiagramType", {
67
67
  enumerable: true,
68
- get: function () { return chunk25TO5A4F_cjs.resolveDiagramType; }
68
+ get: function () { return chunkDZGA25O5_cjs.resolveDiagramType; }
69
69
  });
70
70
  Object.defineProperty(exports, "validateDsl", {
71
71
  enumerable: true,
72
- get: function () { return chunk25TO5A4F_cjs.validateDsl; }
72
+ get: function () { return chunkDZGA25O5_cjs.validateDsl; }
73
73
  });
74
74
  //# sourceMappingURL=index.cjs.map
75
75
  //# sourceMappingURL=index.cjs.map
package/dist/ai/index.js CHANGED
@@ -1,5 +1,5 @@
1
- export { DIAGRAM_REGISTRY, DIAGRAM_SINCE, getAllDiagramTypes, getDiagramMeta, getDiagramSince, getExamples, getSyntax, listDiagrams, renderDsl, resolveDiagramType, validateDsl } from '../chunk-Q5V4LUQR.js';
2
- import '../chunk-3DPWFWQU.js';
1
+ export { DIAGRAM_REGISTRY, DIAGRAM_SINCE, getAllDiagramTypes, getDiagramMeta, getDiagramSince, getExamples, getSyntax, listDiagrams, renderDsl, resolveDiagramType, validateDsl } from '../chunk-X4P4HKHP.js';
2
+ import '../chunk-6AWASOFO.js';
3
3
  import '../chunk-MPCSWRZC.js';
4
4
  import '../chunk-2TUZ3QJA.js';
5
5
  import '../chunk-C7V57V6O.js';
package/dist/browser.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunk5IZL57YJ_cjs = require('./chunk-5IZL57YJ.cjs');
3
+ var chunk3YRYBTLG_cjs = require('./chunk-3YRYBTLG.cjs');
4
4
  require('./chunk-UHPGWO77.cjs');
5
5
  require('./chunk-J3EPFZPX.cjs');
6
6
  require('./chunk-SHMG7BVF.cjs');
@@ -26,10 +26,10 @@ require('./chunk-3WNW5Y7P.cjs');
26
26
 
27
27
  // src/browser.ts
28
28
  function renderToElement(text, config) {
29
- return svgStringToElement(chunk5IZL57YJ_cjs.render(text, config));
29
+ return svgStringToElement(chunk3YRYBTLG_cjs.render(text, config));
30
30
  }
31
31
  function renderPreviewToElement(text, config) {
32
- return svgStringToElement(chunk5IZL57YJ_cjs.renderPreview(text, config));
32
+ return svgStringToElement(chunk3YRYBTLG_cjs.renderPreview(text, config));
33
33
  }
34
34
  function svgStringToElement(svgString) {
35
35
  const parser = new DOMParser();
@@ -42,23 +42,23 @@ function svgStringToElement(svgString) {
42
42
  return el;
43
43
  }
44
44
  function renderToContainer(text, container, config) {
45
- container.innerHTML = chunk5IZL57YJ_cjs.render(text, config);
45
+ container.innerHTML = chunk3YRYBTLG_cjs.render(text, config);
46
46
  }
47
47
  function renderPreviewToContainer(text, container, config) {
48
- container.innerHTML = chunk5IZL57YJ_cjs.renderPreview(text, config);
48
+ container.innerHTML = chunk3YRYBTLG_cjs.renderPreview(text, config);
49
49
  }
50
50
 
51
51
  Object.defineProperty(exports, "render", {
52
52
  enumerable: true,
53
- get: function () { return chunk5IZL57YJ_cjs.render; }
53
+ get: function () { return chunk3YRYBTLG_cjs.render; }
54
54
  });
55
55
  Object.defineProperty(exports, "renderPreview", {
56
56
  enumerable: true,
57
- get: function () { return chunk5IZL57YJ_cjs.renderPreview; }
57
+ get: function () { return chunk3YRYBTLG_cjs.renderPreview; }
58
58
  });
59
59
  Object.defineProperty(exports, "renderResult", {
60
60
  enumerable: true,
61
- get: function () { return chunk5IZL57YJ_cjs.renderResult; }
61
+ get: function () { return chunk3YRYBTLG_cjs.renderResult; }
62
62
  });
63
63
  exports.renderPreviewToContainer = renderPreviewToContainer;
64
64
  exports.renderPreviewToElement = renderPreviewToElement;
package/dist/browser.js CHANGED
@@ -1,5 +1,5 @@
1
- import { render, renderPreview } from './chunk-3DPWFWQU.js';
2
- export { render, renderPreview, renderResult } from './chunk-3DPWFWQU.js';
1
+ import { render, renderPreview } from './chunk-6AWASOFO.js';
2
+ export { render, renderPreview, renderResult } from './chunk-6AWASOFO.js';
3
3
  import './chunk-MPCSWRZC.js';
4
4
  import './chunk-2TUZ3QJA.js';
5
5
  import './chunk-C7V57V6O.js';
@@ -5171,6 +5171,22 @@ function layoutPid(ast) {
5171
5171
  equipById.set(equip.id, layoutEq);
5172
5172
  cursorX += geo.width + EQUIP_GAP_X;
5173
5173
  }
5174
+ const lineMidById = /* @__PURE__ */ new Map();
5175
+ for (const ln of ast.lines) {
5176
+ const from = equipById.get(ln.from.id);
5177
+ const to = equipById.get(ln.to.id);
5178
+ if (!from || !to) continue;
5179
+ const fa = getAnchor(from, ln.from.port, "out");
5180
+ const ta = getAnchor(to, ln.to.port, "in");
5181
+ lineMidById.set(ln.id, { x: (fa.x + ta.x) / 2, y: (fa.y + ta.y) / 2 });
5182
+ }
5183
+ const targetX = (tgt, fallback) => {
5184
+ const eq = equipById.get(tgt);
5185
+ if (eq) return eq.cx;
5186
+ const lm = lineMidById.get(tgt);
5187
+ if (lm) return lm.x;
5188
+ return fallback;
5189
+ };
5174
5190
  const instruments = [];
5175
5191
  const instById = /* @__PURE__ */ new Map();
5176
5192
  const crBandY = PADDING + TITLE_AREA + 40;
@@ -5180,20 +5196,17 @@ function layoutPid(ast) {
5180
5196
  let cy = 0;
5181
5197
  if (inst.category.startsWith("cr_")) {
5182
5198
  const tgt = inst.controls ?? inst.measures ?? "";
5183
- const tgtEq = equipById.get(tgt);
5184
- cx = tgtEq ? tgtEq.cx : PADDING + 80 + crSlot * (INST_RADIUS * 2 + 28);
5199
+ cx = targetX(tgt, PADDING + 80 + crSlot * (INST_RADIUS * 2 + 28));
5185
5200
  cy = crBandY;
5186
5201
  crSlot += 1;
5187
5202
  } else if (inst.category.startsWith("local_")) {
5188
5203
  cy = rowY + maxH / 2 + INST_OFFSET + INST_RADIUS;
5189
5204
  const tgt = inst.measures ?? inst.controls ?? "";
5190
- const tgtEq = equipById.get(tgt);
5191
- cx = tgtEq ? tgtEq.cx : PADDING + 80;
5205
+ cx = targetX(tgt, PADDING + 80);
5192
5206
  } else {
5193
5207
  cy = rowY + maxH / 2 + INST_OFFSET;
5194
5208
  const tgt = inst.measures ?? inst.controls ?? "";
5195
- const tgtEq = equipById.get(tgt);
5196
- cx = tgtEq ? tgtEq.cx : PADDING + 80;
5209
+ cx = targetX(tgt, PADDING + 80);
5197
5210
  }
5198
5211
  const lay = {
5199
5212
  inst,
@@ -5204,13 +5217,14 @@ function layoutPid(ast) {
5204
5217
  instruments.push(lay);
5205
5218
  instById.set(inst.tag, lay);
5206
5219
  }
5207
- const sameRow = (a, b) => Math.abs(a.cy - b.cy) < INST_RADIUS && Math.abs(a.cx - b.cx) < INST_RADIUS * 2 + 8;
5220
+ const INST_FANOUT = INST_RADIUS * 2 + 12;
5221
+ const sameYRow = (a, b) => Math.abs(a.cy - b.cy) < INST_RADIUS;
5208
5222
  const sortedByX = [...instruments].sort((a, b) => a.cx - b.cx);
5209
5223
  for (let i = 1; i < sortedByX.length; i++) {
5210
5224
  const prev = sortedByX[i - 1];
5211
5225
  const cur = sortedByX[i];
5212
- if (sameRow(prev, cur)) {
5213
- cur.cx = prev.cx + INST_RADIUS * 2 + 14;
5226
+ if (sameYRow(prev, cur) && cur.cx < prev.cx + INST_FANOUT) {
5227
+ cur.cx = prev.cx + INST_FANOUT;
5214
5228
  }
5215
5229
  }
5216
5230
  const lines = [];
@@ -5300,6 +5314,7 @@ var STYLE2 = `
5300
5314
  .lt-inst-local-line { stroke: #1d1d1d; stroke-width: 1; stroke-dasharray: 2 2; }
5301
5315
  .lt-pid-valve-body { fill: #ffffff; stroke: #1d1d1d; stroke-width: 1.4; }
5302
5316
 
5317
+ .lt-pid-line-path { fill: none; }
5303
5318
  .lt-pid-line-tag-bg { fill: #ffffff; stroke: #1d1d1d; stroke-width: 0.6; }
5304
5319
  .lt-pid-line-tag-text { font: 9px ui-monospace, monospace; fill: #1d1d1d; }
5305
5320
 
@@ -5310,15 +5325,37 @@ var STYLE2 = `
5310
5325
  .lt-pid-unknown-type { font: 9px ui-monospace, monospace; fill: #6a6a6a; }
5311
5326
  `;
5312
5327
  var ARROW_ID = "lt-pid-arrow";
5328
+ var LINE_CLASS = {
5329
+ process: "lt-pid-process",
5330
+ process_minor: "lt-pid-process-min",
5331
+ pneumatic: "lt-pid-pneumatic",
5332
+ electric: "lt-pid-electric",
5333
+ hydraulic: "lt-pid-hydraulic",
5334
+ capillary: "lt-pid-capillary",
5335
+ software: "lt-pid-software",
5336
+ mechanical: "lt-pid-mechanical"
5337
+ };
5338
+ var SIGNAL_LINE_TYPES = /* @__PURE__ */ new Set([
5339
+ "pneumatic",
5340
+ "electric",
5341
+ "hydraulic",
5342
+ "capillary",
5343
+ "software",
5344
+ "mechanical"
5345
+ ]);
5313
5346
  function lineClass(t) {
5314
- return `lt-pid-${t.replace("_", "-")}`;
5347
+ return LINE_CLASS[t] ?? `lt-pid-${String(t).replace(/_/g, "-")}`;
5348
+ }
5349
+ function isSignalLine(l) {
5350
+ return SIGNAL_LINE_TYPES.has(l.line.lineType);
5315
5351
  }
5316
5352
  function renderLine(l) {
5317
5353
  const cls = lineClass(l.line.lineType);
5318
5354
  const parts = [
5319
5355
  chunk3WNW5Y7P_cjs.path({
5320
5356
  d: l.path,
5321
- class: cls,
5357
+ // Type class + a shared no-fill guard class on every line path.
5358
+ class: `${cls} lt-pid-line-path`,
5322
5359
  "data-line-id": l.line.id,
5323
5360
  "data-service": l.line.service ?? ""
5324
5361
  })
@@ -5485,9 +5522,16 @@ function renderLayout2(layout) {
5485
5522
  chunk3WNW5Y7P_cjs.el("style", {}, STYLE2)
5486
5523
  ]),
5487
5524
  titleNode,
5525
+ // Z-order: process pipes behind equipment; signal lines + instruments above.
5526
+ chunk3WNW5Y7P_cjs.group(
5527
+ { class: "lt-pid-lines lt-pid-process-lines" },
5528
+ layout.lines.filter((l) => !isSignalLine(l)).map(renderLine)
5529
+ ),
5488
5530
  chunk3WNW5Y7P_cjs.group({ class: "lt-pid-equipment" }, equipNodes),
5489
- chunk3WNW5Y7P_cjs.group({ class: "lt-pid-lines" }, layout.lines.map(renderLine)),
5490
- chunk3WNW5Y7P_cjs.group({ class: "lt-pid-signals" }, autoSignals),
5531
+ chunk3WNW5Y7P_cjs.group(
5532
+ { class: "lt-pid-lines lt-pid-signal-lines" },
5533
+ [...layout.lines.filter(isSignalLine).map(renderLine), ...autoSignals]
5534
+ ),
5491
5535
  chunk3WNW5Y7P_cjs.group({ class: "lt-pid-instruments" }, instNodes)
5492
5536
  ]
5493
5537
  );
@@ -26735,5 +26779,5 @@ exports.state = state;
26735
26779
  exports.timeline = timeline;
26736
26780
  exports.umlclass = umlclass;
26737
26781
  exports.usecase = usecase;
26738
- //# sourceMappingURL=chunk-5IZL57YJ.cjs.map
26739
- //# sourceMappingURL=chunk-5IZL57YJ.cjs.map
26782
+ //# sourceMappingURL=chunk-3YRYBTLG.cjs.map
26783
+ //# sourceMappingURL=chunk-3YRYBTLG.cjs.map