schematex 0.9.10 → 0.9.12

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 (109) hide show
  1. package/dist/ai/ai-sdk.cjs +10 -9
  2. package/dist/ai/ai-sdk.cjs.map +1 -1
  3. package/dist/ai/ai-sdk.d.cts +5 -5
  4. package/dist/ai/ai-sdk.d.ts +5 -5
  5. package/dist/ai/ai-sdk.js +5 -4
  6. package/dist/ai/ai-sdk.js.map +1 -1
  7. package/dist/ai/index.cjs +19 -18
  8. package/dist/ai/index.cjs.map +1 -1
  9. package/dist/ai/index.d.cts +4 -4
  10. package/dist/ai/index.d.ts +4 -4
  11. package/dist/ai/index.js +6 -5
  12. package/dist/ai/index.js.map +1 -1
  13. package/dist/{api-D_d-JklT.d.ts → api-C9ufsgIb.d.ts} +2 -2
  14. package/dist/{api-DnTyW-6F.d.cts → api-DAUFeETp.d.cts} +2 -2
  15. package/dist/browser.cjs +11 -10
  16. package/dist/browser.cjs.map +1 -1
  17. package/dist/browser.d.cts +3 -3
  18. package/dist/browser.d.ts +3 -3
  19. package/dist/browser.js +5 -4
  20. package/dist/browser.js.map +1 -1
  21. package/dist/{chunk-IHX6J4HF.js → chunk-32LOZTNP.js} +178 -4
  22. package/dist/chunk-32LOZTNP.js.map +1 -0
  23. package/dist/{chunk-CXA45HIT.js → chunk-6KW7XSUR.js} +203 -12
  24. package/dist/chunk-6KW7XSUR.js.map +1 -0
  25. package/dist/{chunk-TXWVJAMR.cjs → chunk-HEGDKO2E.cjs} +178 -4
  26. package/dist/chunk-HEGDKO2E.cjs.map +1 -0
  27. package/dist/chunk-IBZKIMT5.cjs +826 -0
  28. package/dist/chunk-IBZKIMT5.cjs.map +1 -0
  29. package/dist/{chunk-T5QOVX2I.js → chunk-JLLDJCLW.js} +13194 -13037
  30. package/dist/chunk-JLLDJCLW.js.map +1 -0
  31. package/dist/{chunk-OY2CXLVY.cjs → chunk-MGMR6V6N.cjs} +13196 -13037
  32. package/dist/chunk-MGMR6V6N.cjs.map +1 -0
  33. package/dist/{chunk-MXV3XJFH.cjs → chunk-OGF7QM74.cjs} +80 -17
  34. package/dist/chunk-OGF7QM74.cjs.map +1 -0
  35. package/dist/chunk-PGMKMIGM.js +818 -0
  36. package/dist/chunk-PGMKMIGM.js.map +1 -0
  37. package/dist/{chunk-MVTYPWHO.js → chunk-Q5MQLUOH.js} +80 -17
  38. package/dist/chunk-Q5MQLUOH.js.map +1 -0
  39. package/dist/{chunk-CA54ESRT.cjs → chunk-YLG7S4SM.cjs} +205 -14
  40. package/dist/chunk-YLG7S4SM.cjs.map +1 -0
  41. package/dist/{diagnostics-D2qkBfFx.d.cts → diagnostics-DSxLohjY.d.cts} +9 -3
  42. package/dist/{diagnostics-D2qkBfFx.d.ts → diagnostics-DSxLohjY.d.ts} +9 -3
  43. package/dist/diagrams/blockdiagram/index.d.cts +1 -1
  44. package/dist/diagrams/blockdiagram/index.d.ts +1 -1
  45. package/dist/diagrams/circuit/index.cjs +8 -8
  46. package/dist/diagrams/circuit/index.d.cts +1 -1
  47. package/dist/diagrams/circuit/index.d.ts +1 -1
  48. package/dist/diagrams/circuit/index.js +1 -1
  49. package/dist/diagrams/ecomap/index.d.cts +1 -1
  50. package/dist/diagrams/ecomap/index.d.ts +1 -1
  51. package/dist/diagrams/entity/index.d.cts +1 -1
  52. package/dist/diagrams/entity/index.d.ts +1 -1
  53. package/dist/diagrams/fishbone/index.d.cts +1 -1
  54. package/dist/diagrams/fishbone/index.d.ts +1 -1
  55. package/dist/diagrams/flowchart/index.d.cts +2 -2
  56. package/dist/diagrams/flowchart/index.d.ts +2 -2
  57. package/dist/diagrams/genogram/index.d.cts +1 -1
  58. package/dist/diagrams/genogram/index.d.ts +1 -1
  59. package/dist/diagrams/ladder/index.d.cts +1 -1
  60. package/dist/diagrams/ladder/index.d.ts +1 -1
  61. package/dist/diagrams/logic/index.d.cts +1 -1
  62. package/dist/diagrams/logic/index.d.ts +1 -1
  63. package/dist/diagrams/orgchart/index.d.cts +1 -1
  64. package/dist/diagrams/orgchart/index.d.ts +1 -1
  65. package/dist/diagrams/pedigree/index.d.cts +1 -1
  66. package/dist/diagrams/pedigree/index.d.ts +1 -1
  67. package/dist/diagrams/phylo/index.d.cts +1 -1
  68. package/dist/diagrams/phylo/index.d.ts +1 -1
  69. package/dist/diagrams/siteplan/index.cjs +38 -0
  70. package/dist/diagrams/siteplan/index.cjs.map +1 -0
  71. package/dist/diagrams/siteplan/index.d.cts +122 -0
  72. package/dist/diagrams/siteplan/index.d.ts +122 -0
  73. package/dist/diagrams/siteplan/index.js +5 -0
  74. package/dist/diagrams/siteplan/index.js.map +1 -0
  75. package/dist/diagrams/sld/index.cjs +7 -7
  76. package/dist/diagrams/sld/index.d.cts +4 -1
  77. package/dist/diagrams/sld/index.d.ts +4 -1
  78. package/dist/diagrams/sld/index.js +1 -1
  79. package/dist/diagrams/sociogram/index.d.cts +1 -1
  80. package/dist/diagrams/sociogram/index.d.ts +1 -1
  81. package/dist/diagrams/timing/index.d.cts +1 -1
  82. package/dist/diagrams/timing/index.d.ts +1 -1
  83. package/dist/diagrams/venn/index.d.cts +1 -1
  84. package/dist/diagrams/venn/index.d.ts +1 -1
  85. package/dist/{index-JZlLiE6K.d.cts → index-CDDfbChc.d.cts} +1 -1
  86. package/dist/{index-D9u0YRxL.d.ts → index-CZa2pU0T.d.ts} +1 -1
  87. package/dist/index.cjs +56 -43
  88. package/dist/index.cjs.map +1 -1
  89. package/dist/index.d.cts +10 -5
  90. package/dist/index.d.ts +10 -5
  91. package/dist/index.js +7 -6
  92. package/dist/index.js.map +1 -1
  93. package/dist/react.cjs +5 -4
  94. package/dist/react.cjs.map +1 -1
  95. package/dist/react.d.cts +2 -2
  96. package/dist/react.d.ts +2 -2
  97. package/dist/react.js +4 -3
  98. package/dist/react.js.map +1 -1
  99. package/dist/{tools-DAKYNcPv.d.cts → tools-Bvw6dwIR.d.cts} +2 -2
  100. package/dist/{tools-DM0aLCbc.d.ts → tools-DtuvE-K4.d.ts} +2 -2
  101. package/package.json +6 -1
  102. package/dist/chunk-CA54ESRT.cjs.map +0 -1
  103. package/dist/chunk-CXA45HIT.js.map +0 -1
  104. package/dist/chunk-IHX6J4HF.js.map +0 -1
  105. package/dist/chunk-MVTYPWHO.js.map +0 -1
  106. package/dist/chunk-MXV3XJFH.cjs.map +0 -1
  107. package/dist/chunk-OY2CXLVY.cjs.map +0 -1
  108. package/dist/chunk-T5QOVX2I.js.map +0 -1
  109. package/dist/chunk-TXWVJAMR.cjs.map +0 -1
@@ -756,6 +756,126 @@ var terminal_block = {
756
756
  return parts.join("");
757
757
  }
758
758
  };
759
+ function numAttr(attrs, key, fallback) {
760
+ const v = Number(attrs?.[key]);
761
+ return Number.isFinite(v) && v > 0 ? v : fallback;
762
+ }
763
+ function effectiveSymbolDef(type, attrs) {
764
+ const sym = getSymbol(type);
765
+ if (!sym) return void 0;
766
+ if (type !== "enclosure" && type !== "din_rail" && type !== "wire_duct") return sym;
767
+ if (type === "enclosure") {
768
+ const w = numAttr(attrs, "width", numAttr(attrs, "w", 240));
769
+ const h2 = numAttr(attrs, "height", numAttr(attrs, "h", 160));
770
+ return {
771
+ ...sym,
772
+ length: w,
773
+ anchors: {
774
+ start: { x: 0, y: 0 },
775
+ end: { x: w, y: 0 },
776
+ center: { x: w / 2, y: h2 / 2 },
777
+ bottom_left: { x: 0, y: h2 },
778
+ bottom_right: { x: w, y: h2 }
779
+ }
780
+ };
781
+ }
782
+ const length = numAttr(attrs, "length", 180);
783
+ const h = type === "wire_duct" ? 22 : 14;
784
+ return {
785
+ ...sym,
786
+ length,
787
+ anchors: {
788
+ start: { x: 0, y: 0 },
789
+ end: { x: length, y: 0 },
790
+ center: { x: length / 2, y: 0 },
791
+ bottom_right: { x: length, y: h }
792
+ }
793
+ };
794
+ }
795
+ var enclosure = {
796
+ length: 240,
797
+ anchors: { start: { x: 0, y: 0 }, end: { x: 240, y: 0 }, bottom_right: { x: 240, y: 160 } },
798
+ svg: (label, _value, attrs) => {
799
+ const w = numAttr(attrs, "width", numAttr(attrs, "w", 240));
800
+ const h = numAttr(attrs, "height", numAttr(attrs, "h", 160));
801
+ const title2 = label ?? attrs?.title ?? "Panel";
802
+ return [
803
+ `<rect x="0" y="0" width="${w}" height="${h}" rx="8" fill="none" class="schematex-circuit-enclosure"/>`,
804
+ `<rect x="10" y="20" width="${Math.max(10, w - 20)}" height="${Math.max(10, h - 30)}" rx="3" fill="none" class="schematex-circuit-enclosure-inner"/>`,
805
+ `<text x="${w / 2}" y="15" text-anchor="middle" class="schematex-circuit-panel-label">${title2}</text>`
806
+ ].join("");
807
+ }
808
+ };
809
+ var din_rail = {
810
+ length: 180,
811
+ anchors: { start: { x: 0, y: 0 }, end: { x: 180, y: 0 } },
812
+ svg: (_label, _value, attrs) => {
813
+ const l = numAttr(attrs, "length", 180);
814
+ const slots = [];
815
+ for (let x = 8; x < l - 4; x += 16) {
816
+ slots.push(`<rect x="${x}" y="-3" width="8" height="6" rx="2" class="schematex-circuit-din-slot"/>`);
817
+ }
818
+ return [
819
+ `<rect x="0" y="-7" width="${l}" height="14" rx="2" class="schematex-circuit-din"/>`,
820
+ ...slots
821
+ ].join("");
822
+ }
823
+ };
824
+ var wire_duct = {
825
+ length: 180,
826
+ anchors: { start: { x: 0, y: 0 }, end: { x: 180, y: 0 }, bottom_right: { x: 180, y: 22 } },
827
+ svg: (_label, _value, attrs) => {
828
+ const l = numAttr(attrs, "length", 180);
829
+ const teeth = [];
830
+ for (let x = 8; x < l - 4; x += 12) {
831
+ teeth.push(`<line x1="${x}" y1="0" x2="${x}" y2="22" class="schematex-circuit-duct-tooth"/>`);
832
+ }
833
+ return [
834
+ `<rect x="0" y="0" width="${l}" height="22" rx="2" class="schematex-circuit-duct"/>`,
835
+ ...teeth
836
+ ].join("");
837
+ }
838
+ };
839
+ var plc = {
840
+ length: 70,
841
+ anchors: { start: { x: 0, y: 0 }, end: { x: 70, y: 0 }, pwr: { x: 0, y: 24 }, out: { x: 70, y: 24 } },
842
+ svg: (label, _value, attrs) => {
843
+ const title2 = label ?? attrs?.model ?? "PLC";
844
+ const leds = [12, 24, 36, 48, 60].map((x) => `<circle cx="${x}" cy="28" r="2.2" class="schematex-circuit-panel-led"/>`).join("");
845
+ return [
846
+ `<rect x="0" y="-20" width="70" height="56" rx="4" fill="white" ${BODY}/>`,
847
+ `<text x="35" y="-2" text-anchor="middle" class="schematex-circuit-meter">${title2}</text>`,
848
+ leds
849
+ ].join("");
850
+ }
851
+ };
852
+ var pilot_light = {
853
+ length: 22,
854
+ anchors: { start: { x: 0, y: 0 }, end: { x: 22, y: 0 } },
855
+ svg: (label, _value) => [
856
+ `<circle cx="11" cy="0" r="10" class="schematex-circuit-panel-light"/>`,
857
+ `<circle cx="11" cy="0" r="4" class="schematex-circuit-panel-led"/>`,
858
+ label ? `<text x="11" y="20" text-anchor="middle" class="schematex-circuit-pol">${label}</text>` : ""
859
+ ].join("")
860
+ };
861
+ var selector_switch = {
862
+ length: 26,
863
+ anchors: { start: { x: 0, y: 0 }, end: { x: 26, y: 0 } },
864
+ svg: (label) => [
865
+ `<circle cx="13" cy="0" r="12" fill="white" ${BODY}/>`,
866
+ `<line x1="7" y1="5" x2="19" y2="-5" ${BODY}/>`,
867
+ label ? `<text x="13" y="22" text-anchor="middle" class="schematex-circuit-pol">${label}</text>` : ""
868
+ ].join("")
869
+ };
870
+ var emergency_stop = {
871
+ length: 30,
872
+ anchors: { start: { x: 0, y: 0 }, end: { x: 30, y: 0 } },
873
+ svg: (label) => [
874
+ `<circle cx="15" cy="0" r="14" class="schematex-circuit-estop"/>`,
875
+ `<text x="15" y="4" text-anchor="middle" class="schematex-circuit-meter">E</text>`,
876
+ label ? `<text x="15" y="25" text-anchor="middle" class="schematex-circuit-pol">${label}</text>` : ""
877
+ ].join("")
878
+ };
759
879
  var relay_coil = {
760
880
  length: 40,
761
881
  anchors: { start: { x: 0, y: 0 }, end: { x: 40, y: 0 } },
@@ -1357,6 +1477,13 @@ var SYMBOLS = {
1357
1477
  antenna,
1358
1478
  generic_ic,
1359
1479
  terminal_block,
1480
+ enclosure,
1481
+ din_rail,
1482
+ wire_duct,
1483
+ plc,
1484
+ pilot_light,
1485
+ selector_switch,
1486
+ emergency_stop,
1360
1487
  "555_timer": timer_555,
1361
1488
  voltage_regulator,
1362
1489
  // Industrial control / power electrical (IEC 60617)
@@ -1455,7 +1582,15 @@ var TYPE_ALIASES = {
1455
1582
  tb: "terminal_block",
1456
1583
  junction_box: "terminal_block",
1457
1584
  jbox: "terminal_block",
1458
- enclosure: "terminal_block"
1585
+ enclosure: "enclosure",
1586
+ cabinet: "enclosure",
1587
+ panel: "enclosure",
1588
+ dinrail: "din_rail",
1589
+ din_rail: "din_rail",
1590
+ wireduct: "wire_duct",
1591
+ wire_duct: "wire_duct",
1592
+ trunking: "wire_duct",
1593
+ plc: "plc"
1459
1594
  };
1460
1595
  var GROUND_REF = /^(0|gnd|ground|earth|pe|agnd|dgnd|gnda|gndd|vss|com)(_\w+|\d+)?$/i;
1461
1596
  function isGroundRef(s) {
@@ -1719,6 +1854,14 @@ var COMPONENT_TYPES = /* @__PURE__ */ new Set([
1719
1854
  "voltage_regulator",
1720
1855
  "dc_dc_converter",
1721
1856
  "555_timer",
1857
+ "terminal_block",
1858
+ "enclosure",
1859
+ "din_rail",
1860
+ "wire_duct",
1861
+ "plc",
1862
+ "pilot_light",
1863
+ "selector_switch",
1864
+ "emergency_stop",
1722
1865
  "voltage_source",
1723
1866
  "current_source",
1724
1867
  "ac_source",
@@ -1773,6 +1916,25 @@ var ALIASES = {
1773
1916
  ic: "generic_ic",
1774
1917
  reg: "voltage_regulator",
1775
1918
  timer555: "555_timer",
1919
+ terminal: "terminal_block",
1920
+ tb: "terminal_block",
1921
+ junction_box: "terminal_block",
1922
+ jbox: "terminal_block",
1923
+ cabinet: "enclosure",
1924
+ panel: "enclosure",
1925
+ backplate: "enclosure",
1926
+ dinrail: "din_rail",
1927
+ "din-rail": "din_rail",
1928
+ duct: "wire_duct",
1929
+ wireduct: "wire_duct",
1930
+ trunking: "wire_duct",
1931
+ controller: "plc",
1932
+ indicator: "pilot_light",
1933
+ pilot: "pilot_light",
1934
+ selector: "selector_switch",
1935
+ estop: "emergency_stop",
1936
+ e_stop: "emergency_stop",
1937
+ "e-stop": "emergency_stop",
1776
1938
  therm: "thermistor_ntc",
1777
1939
  ntc: "thermistor_ntc",
1778
1940
  ptc: "thermistor_ptc",
@@ -2164,6 +2326,8 @@ function rotatePoint(p, angleDeg) {
2164
2326
  }
2165
2327
  function resolveAnchorRef(ref, byId, nets) {
2166
2328
  if (ref === "origin") return { x: 0, y: 0 };
2329
+ const coord = /^@?(-?\d+(?:\.\d+)?),(-?\d+(?:\.\d+)?)$/.exec(ref.trim());
2330
+ if (coord) return { x: Number(coord[1]), y: Number(coord[2]) };
2167
2331
  if (nets.has(ref)) return nets.get(ref);
2168
2332
  const dot = ref.indexOf(".");
2169
2333
  if (dot < 0) {
@@ -2188,7 +2352,7 @@ function layoutCircuit(ast) {
2188
2352
  const resolved = resolveAnchorRef(comp.at, byId, nets);
2189
2353
  if (resolved) startPt = resolved;
2190
2354
  }
2191
- const sym = getSymbol(comp.componentType);
2355
+ const sym = effectiveSymbolDef(comp.componentType, comp.attrs) ?? getSymbol(comp.componentType);
2192
2356
  const rot = rotationDeg(comp.direction);
2193
2357
  if (comp.componentType === "wire") {
2194
2358
  const len = parseInt(comp.attrs?.length ?? "20", 10);
@@ -2658,6 +2822,16 @@ function renderCircuit(ast, config) {
2658
2822
  .schematex-circuit-meter { font: bold 12px sans-serif; fill: ${t.stroke}; }
2659
2823
  .schematex-circuit-title { font: 700 16px sans-serif; fill: ${t.text}; }
2660
2824
  .schematex-circuit-err { stroke: ${t.error}; fill: ${t.error}; }
2825
+ .schematex-circuit-enclosure { stroke: ${t.stroke}; stroke-width: 2; stroke-dasharray: 8 5; fill: ${t.bg}; }
2826
+ .schematex-circuit-enclosure-inner { stroke: ${t.textMuted}; stroke-width: 1; stroke-dasharray: 4 3; fill: none; }
2827
+ .schematex-circuit-panel-label { font: 700 11px system-ui, sans-serif; fill: ${t.text}; }
2828
+ .schematex-circuit-din { fill: ${t.bg}; stroke: ${t.stroke}; stroke-width: 1.4; }
2829
+ .schematex-circuit-din-slot { fill: ${t.textMuted}; opacity: 0.5; }
2830
+ .schematex-circuit-duct { fill: none; stroke: ${t.textMuted}; stroke-width: 1.2; stroke-dasharray: 3 2; }
2831
+ .schematex-circuit-duct-tooth { stroke: ${t.textMuted}; stroke-width: 0.8; opacity: 0.65; }
2832
+ .schematex-circuit-panel-led { fill: ${t.accent}; stroke: ${t.stroke}; stroke-width: 0.8; }
2833
+ .schematex-circuit-panel-light { fill: ${t.bg}; stroke: ${t.stroke}; stroke-width: 1.5; }
2834
+ .schematex-circuit-estop { fill: ${t.error}; stroke: ${t.stroke}; stroke-width: 1.4; }
2661
2835
  `.trim();
2662
2836
  const titleBar = ast.title ? text(
2663
2837
  {
@@ -2706,5 +2880,5 @@ var circuit = {
2706
2880
  };
2707
2881
 
2708
2882
  export { EXTRA_SYMBOLS, SYMBOLS, circuit, layoutCircuit, layoutCircuitNetlist, lintCircuit, parseCircuit, parseNetlist, renderCircuit };
2709
- //# sourceMappingURL=chunk-IHX6J4HF.js.map
2710
- //# sourceMappingURL=chunk-IHX6J4HF.js.map
2883
+ //# sourceMappingURL=chunk-32LOZTNP.js.map
2884
+ //# sourceMappingURL=chunk-32LOZTNP.js.map