schematex 0.9.13 → 0.9.15

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.
@@ -8055,8 +8055,8 @@ function parseNote(ln, state2) {
8055
8055
  throw new UsecaseParseError(`unterminated note block`, ln.line);
8056
8056
  }
8057
8057
  function defaultIdFor(name) {
8058
- const safe = name.replace(/[^A-Za-z0-9_]/g, "_");
8059
- return /^[A-Za-z_]/.test(safe) ? safe : "_" + safe;
8058
+ const safe = name.replace(/[^\p{L}\p{N}_]/gu, "_");
8059
+ return /^[\p{L}_]/u.test(safe) ? safe : "_" + safe;
8060
8060
  }
8061
8061
  function parseRelation(ln, state2) {
8062
8062
  const op = findRelOp(ln.text);
@@ -13446,7 +13446,33 @@ var KIND_ALIASES = {
13446
13446
  ips: "ids",
13447
13447
  decoder: "encoder",
13448
13448
  videowall: "monitor",
13449
- segment: "lan"
13449
+ segment: "lan",
13450
+ // Common everyday synonyms a model reaches for. A specific server role still
13451
+ // renders as a generic `server` (with its label) instead of hard-failing.
13452
+ webserver: "server",
13453
+ mailserver: "server",
13454
+ dns: "server",
13455
+ dhcp: "server",
13456
+ ntp: "server",
13457
+ database: "server",
13458
+ dbserver: "server",
13459
+ db: "server",
13460
+ vm: "server",
13461
+ host: "server",
13462
+ hypervisor: "server",
13463
+ activedirectory: "server",
13464
+ domaincontroller: "server",
13465
+ desktop: "pc",
13466
+ smartphone: "mobile",
13467
+ tablet: "mobile",
13468
+ accesspoint: "ap",
13469
+ wap: "ap",
13470
+ hub: "switch",
13471
+ bridge: "switch",
13472
+ l2switch: "switch",
13473
+ ngfw: "firewall",
13474
+ utm: "firewall",
13475
+ mfp: "printer"
13450
13476
  };
13451
13477
  var GROUP_KINDS = /* @__PURE__ */ new Set(["site", "building", "campus", "rack", "subnet", "vlan", "zone", "dmz"]);
13452
13478
  var GROUP_KIND_ALIAS = { building: "site", campus: "site" };
@@ -29967,7 +29993,23 @@ var FURNITURE_ALIASES = {
29967
29993
  panel: "electrical-panel",
29968
29994
  "breaker-panel": "electrical-panel",
29969
29995
  db: "distribution-board",
29970
- "consumer-unit": "distribution-board"
29996
+ "consumer-unit": "distribution-board",
29997
+ // Common everyday synonyms an LLM reaches for that map cleanly onto an
29998
+ // existing type. Keeps a valid layout from failing on a vocabulary gap.
29999
+ "console-table": "side-table",
30000
+ console: "side-table",
30001
+ "end-table": "side-table",
30002
+ couch: "sofa",
30003
+ settee: "loveseat",
30004
+ "tv-console": "tv-stand",
30005
+ "media-console": "tv-stand",
30006
+ "entertainment-center": "tv-stand",
30007
+ refrigerator: "fridge",
30008
+ cooktop: "stove",
30009
+ stovetop: "stove",
30010
+ armoire: "wardrobe",
30011
+ wc: "toilet",
30012
+ "water-closet": "toilet"
29971
30013
  };
29972
30014
  function parseFurnitureType(t, ln) {
29973
30015
  const word = isWord(t) ? t.word : "";
@@ -36689,6 +36731,9 @@ function parseMermaidErd(lines) {
36689
36731
  const entityMap = /* @__PURE__ */ new Map();
36690
36732
  const order = [];
36691
36733
  const refs = [];
36734
+ let title2;
36735
+ let direction = "LR";
36736
+ let notation = "crowsfoot";
36692
36737
  const ensure = (id) => {
36693
36738
  let e = entityMap.get(id);
36694
36739
  if (!e) {
@@ -36702,6 +36747,33 @@ function parseMermaidErd(lines) {
36702
36747
  while (i < lines.length) {
36703
36748
  const t = lines[i].text;
36704
36749
  const ln = lines[i].lineNumber;
36750
+ const lower = t.toLowerCase();
36751
+ if (lower.startsWith("title:")) {
36752
+ title2 = unquote7(t.slice("title:".length).trim());
36753
+ i++;
36754
+ continue;
36755
+ }
36756
+ if (lower.startsWith("direction:")) {
36757
+ const v = t.slice("direction:".length).trim().toUpperCase();
36758
+ if (v !== "LR" && v !== "TB") {
36759
+ throw new ErdParseError(`Unknown direction '${v}'. Use LR or TB.`, ln);
36760
+ }
36761
+ direction = v;
36762
+ i++;
36763
+ continue;
36764
+ }
36765
+ if (lower.startsWith("notation:")) {
36766
+ const v = t.slice("notation:".length).trim().toLowerCase();
36767
+ if (v !== "crowsfoot") {
36768
+ throw new ErdParseError(
36769
+ `notation '${v}' is documented but not yet implemented in v0.1; use 'crowsfoot'.`,
36770
+ ln
36771
+ );
36772
+ }
36773
+ notation = v;
36774
+ i++;
36775
+ continue;
36776
+ }
36705
36777
  const inlineBlock = new RegExp(`^(${MERMAID_NAME.source})\\s*\\{\\s*(.*?)\\s*\\}$`).exec(t);
36706
36778
  const openBlock = new RegExp(`^(${MERMAID_NAME.source})\\s*\\{$`).exec(t);
36707
36779
  if (inlineBlock) {
@@ -36748,8 +36820,9 @@ function parseMermaidErd(lines) {
36748
36820
  }
36749
36821
  return {
36750
36822
  type: "erd",
36751
- notation: "crowsfoot",
36752
- direction: "LR",
36823
+ notation,
36824
+ direction,
36825
+ title: title2,
36753
36826
  entities: order.map((id) => entityMap.get(id)),
36754
36827
  refs
36755
36828
  };
@@ -42751,6 +42824,24 @@ function normalizeHeader(text2, type) {
42751
42824
  }
42752
42825
  return text2;
42753
42826
  }
42827
+ function headerCandidates(type) {
42828
+ if (type === "erd") return ["erDiagram", "erd"];
42829
+ return [type];
42830
+ }
42831
+ function recoverHeader(plugin, prepared, forced) {
42832
+ if (!forced || !plugin.parse || plugin.detect(prepared)) return prepared;
42833
+ for (const hdr of headerCandidates(plugin.type)) {
42834
+ const candidate = `${hdr}
42835
+ ${prepared}`;
42836
+ if (!plugin.detect(candidate)) continue;
42837
+ try {
42838
+ plugin.parse(candidate);
42839
+ return candidate;
42840
+ } catch {
42841
+ }
42842
+ }
42843
+ return prepared;
42844
+ }
42754
42845
  function preprocess9(text2) {
42755
42846
  const { data, body: rawBody } = chunk3TGOOZ36_cjs.parseFrontmatter(stripCodeFences(text2));
42756
42847
  const body = chunk3TGOOZ36_cjs.stripComments(rawBody, chunk3TGOOZ36_cjs.UNIVERSAL_COMMENT_MARKERS);
@@ -42769,11 +42860,14 @@ function preprocess9(text2) {
42769
42860
  function parse(text2, config) {
42770
42861
  const prepared0 = preprocess9(text2);
42771
42862
  const plugin = detectPlugin(prepared0, config);
42772
- const prepared = normalizeHeader(prepared0, plugin.type);
42773
- if (plugin.parse) return plugin.parse(prepared);
42774
- throw new Error(
42775
- `Diagram type '${plugin.type}' does not yet expose a parse() method.`
42776
- );
42863
+ if (!plugin.parse) {
42864
+ throw new Error(
42865
+ `Diagram type '${plugin.type}' does not yet expose a parse() method.`
42866
+ );
42867
+ }
42868
+ const forced = config?.type != null && plugin.type === config.type;
42869
+ const prepared = recoverHeader(plugin, normalizeHeader(prepared0, plugin.type), forced);
42870
+ return plugin.parse(prepared);
42777
42871
  }
42778
42872
  function parseResult(text2, config) {
42779
42873
  let plugin;
@@ -42785,7 +42879,8 @@ function parseResult(text2, config) {
42785
42879
  `Diagram type '${plugin.type}' does not yet expose a parse() method.`
42786
42880
  );
42787
42881
  }
42788
- const prepared = normalizeHeader(prepared0, plugin.type);
42882
+ const forced = config?.type != null && plugin.type === config.type;
42883
+ const prepared = recoverHeader(plugin, normalizeHeader(prepared0, plugin.type), forced);
42789
42884
  const ast = plugin.parse(prepared);
42790
42885
  const diagnostics = runLint(plugin, prepared);
42791
42886
  return {
@@ -42816,7 +42911,8 @@ function render(text2, config) {
42816
42911
  if (config?.mode === "preview") return renderResult(text2, config).svg;
42817
42912
  const prepared0 = preprocess9(text2);
42818
42913
  const plugin = detectPlugin(prepared0, config);
42819
- const prepared = normalizeHeader(prepared0, plugin.type);
42914
+ const forced = config?.type != null && plugin.type === config.type;
42915
+ const prepared = recoverHeader(plugin, normalizeHeader(prepared0, plugin.type), forced);
42820
42916
  return renderWithPlugin(prepared, plugin, config);
42821
42917
  }
42822
42918
  function renderResult(text2, config) {
@@ -42824,7 +42920,8 @@ function renderResult(text2, config) {
42824
42920
  try {
42825
42921
  const prepared0 = preprocess9(text2);
42826
42922
  plugin = detectPlugin(prepared0, config);
42827
- const prepared = normalizeHeader(prepared0, plugin.type);
42923
+ const forced = config?.type != null && plugin.type === config.type;
42924
+ const prepared = recoverHeader(plugin, normalizeHeader(prepared0, plugin.type), forced);
42828
42925
  const svg = renderWithPlugin(prepared, plugin, config);
42829
42926
  const diagnostics = runLint(plugin, prepared);
42830
42927
  return {
@@ -42897,5 +42994,5 @@ exports.timeline = timeline;
42897
42994
  exports.umlclass = umlclass;
42898
42995
  exports.usecase = usecase;
42899
42996
  exports.welding = welding;
42900
- //# sourceMappingURL=chunk-KTAEPUAE.cjs.map
42901
- //# sourceMappingURL=chunk-KTAEPUAE.cjs.map
42997
+ //# sourceMappingURL=chunk-O4XRVW3R.cjs.map
42998
+ //# sourceMappingURL=chunk-O4XRVW3R.cjs.map