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
@@ -758,6 +758,126 @@ var terminal_block = {
758
758
  return parts.join("");
759
759
  }
760
760
  };
761
+ function numAttr(attrs, key, fallback) {
762
+ const v = Number(attrs?.[key]);
763
+ return Number.isFinite(v) && v > 0 ? v : fallback;
764
+ }
765
+ function effectiveSymbolDef(type, attrs) {
766
+ const sym = getSymbol(type);
767
+ if (!sym) return void 0;
768
+ if (type !== "enclosure" && type !== "din_rail" && type !== "wire_duct") return sym;
769
+ if (type === "enclosure") {
770
+ const w = numAttr(attrs, "width", numAttr(attrs, "w", 240));
771
+ const h2 = numAttr(attrs, "height", numAttr(attrs, "h", 160));
772
+ return {
773
+ ...sym,
774
+ length: w,
775
+ anchors: {
776
+ start: { x: 0, y: 0 },
777
+ end: { x: w, y: 0 },
778
+ center: { x: w / 2, y: h2 / 2 },
779
+ bottom_left: { x: 0, y: h2 },
780
+ bottom_right: { x: w, y: h2 }
781
+ }
782
+ };
783
+ }
784
+ const length = numAttr(attrs, "length", 180);
785
+ const h = type === "wire_duct" ? 22 : 14;
786
+ return {
787
+ ...sym,
788
+ length,
789
+ anchors: {
790
+ start: { x: 0, y: 0 },
791
+ end: { x: length, y: 0 },
792
+ center: { x: length / 2, y: 0 },
793
+ bottom_right: { x: length, y: h }
794
+ }
795
+ };
796
+ }
797
+ var enclosure = {
798
+ length: 240,
799
+ anchors: { start: { x: 0, y: 0 }, end: { x: 240, y: 0 }, bottom_right: { x: 240, y: 160 } },
800
+ svg: (label, _value, attrs) => {
801
+ const w = numAttr(attrs, "width", numAttr(attrs, "w", 240));
802
+ const h = numAttr(attrs, "height", numAttr(attrs, "h", 160));
803
+ const title2 = label ?? attrs?.title ?? "Panel";
804
+ return [
805
+ `<rect x="0" y="0" width="${w}" height="${h}" rx="8" fill="none" class="schematex-circuit-enclosure"/>`,
806
+ `<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"/>`,
807
+ `<text x="${w / 2}" y="15" text-anchor="middle" class="schematex-circuit-panel-label">${title2}</text>`
808
+ ].join("");
809
+ }
810
+ };
811
+ var din_rail = {
812
+ length: 180,
813
+ anchors: { start: { x: 0, y: 0 }, end: { x: 180, y: 0 } },
814
+ svg: (_label, _value, attrs) => {
815
+ const l = numAttr(attrs, "length", 180);
816
+ const slots = [];
817
+ for (let x = 8; x < l - 4; x += 16) {
818
+ slots.push(`<rect x="${x}" y="-3" width="8" height="6" rx="2" class="schematex-circuit-din-slot"/>`);
819
+ }
820
+ return [
821
+ `<rect x="0" y="-7" width="${l}" height="14" rx="2" class="schematex-circuit-din"/>`,
822
+ ...slots
823
+ ].join("");
824
+ }
825
+ };
826
+ var wire_duct = {
827
+ length: 180,
828
+ anchors: { start: { x: 0, y: 0 }, end: { x: 180, y: 0 }, bottom_right: { x: 180, y: 22 } },
829
+ svg: (_label, _value, attrs) => {
830
+ const l = numAttr(attrs, "length", 180);
831
+ const teeth = [];
832
+ for (let x = 8; x < l - 4; x += 12) {
833
+ teeth.push(`<line x1="${x}" y1="0" x2="${x}" y2="22" class="schematex-circuit-duct-tooth"/>`);
834
+ }
835
+ return [
836
+ `<rect x="0" y="0" width="${l}" height="22" rx="2" class="schematex-circuit-duct"/>`,
837
+ ...teeth
838
+ ].join("");
839
+ }
840
+ };
841
+ var plc = {
842
+ length: 70,
843
+ anchors: { start: { x: 0, y: 0 }, end: { x: 70, y: 0 }, pwr: { x: 0, y: 24 }, out: { x: 70, y: 24 } },
844
+ svg: (label, _value, attrs) => {
845
+ const title2 = label ?? attrs?.model ?? "PLC";
846
+ const leds = [12, 24, 36, 48, 60].map((x) => `<circle cx="${x}" cy="28" r="2.2" class="schematex-circuit-panel-led"/>`).join("");
847
+ return [
848
+ `<rect x="0" y="-20" width="70" height="56" rx="4" fill="white" ${BODY}/>`,
849
+ `<text x="35" y="-2" text-anchor="middle" class="schematex-circuit-meter">${title2}</text>`,
850
+ leds
851
+ ].join("");
852
+ }
853
+ };
854
+ var pilot_light = {
855
+ length: 22,
856
+ anchors: { start: { x: 0, y: 0 }, end: { x: 22, y: 0 } },
857
+ svg: (label, _value) => [
858
+ `<circle cx="11" cy="0" r="10" class="schematex-circuit-panel-light"/>`,
859
+ `<circle cx="11" cy="0" r="4" class="schematex-circuit-panel-led"/>`,
860
+ label ? `<text x="11" y="20" text-anchor="middle" class="schematex-circuit-pol">${label}</text>` : ""
861
+ ].join("")
862
+ };
863
+ var selector_switch = {
864
+ length: 26,
865
+ anchors: { start: { x: 0, y: 0 }, end: { x: 26, y: 0 } },
866
+ svg: (label) => [
867
+ `<circle cx="13" cy="0" r="12" fill="white" ${BODY}/>`,
868
+ `<line x1="7" y1="5" x2="19" y2="-5" ${BODY}/>`,
869
+ label ? `<text x="13" y="22" text-anchor="middle" class="schematex-circuit-pol">${label}</text>` : ""
870
+ ].join("")
871
+ };
872
+ var emergency_stop = {
873
+ length: 30,
874
+ anchors: { start: { x: 0, y: 0 }, end: { x: 30, y: 0 } },
875
+ svg: (label) => [
876
+ `<circle cx="15" cy="0" r="14" class="schematex-circuit-estop"/>`,
877
+ `<text x="15" y="4" text-anchor="middle" class="schematex-circuit-meter">E</text>`,
878
+ label ? `<text x="15" y="25" text-anchor="middle" class="schematex-circuit-pol">${label}</text>` : ""
879
+ ].join("")
880
+ };
761
881
  var relay_coil = {
762
882
  length: 40,
763
883
  anchors: { start: { x: 0, y: 0 }, end: { x: 40, y: 0 } },
@@ -1359,6 +1479,13 @@ var SYMBOLS = {
1359
1479
  antenna,
1360
1480
  generic_ic,
1361
1481
  terminal_block,
1482
+ enclosure,
1483
+ din_rail,
1484
+ wire_duct,
1485
+ plc,
1486
+ pilot_light,
1487
+ selector_switch,
1488
+ emergency_stop,
1362
1489
  "555_timer": timer_555,
1363
1490
  voltage_regulator,
1364
1491
  // Industrial control / power electrical (IEC 60617)
@@ -1457,7 +1584,15 @@ var TYPE_ALIASES = {
1457
1584
  tb: "terminal_block",
1458
1585
  junction_box: "terminal_block",
1459
1586
  jbox: "terminal_block",
1460
- enclosure: "terminal_block"
1587
+ enclosure: "enclosure",
1588
+ cabinet: "enclosure",
1589
+ panel: "enclosure",
1590
+ dinrail: "din_rail",
1591
+ din_rail: "din_rail",
1592
+ wireduct: "wire_duct",
1593
+ wire_duct: "wire_duct",
1594
+ trunking: "wire_duct",
1595
+ plc: "plc"
1461
1596
  };
1462
1597
  var GROUND_REF = /^(0|gnd|ground|earth|pe|agnd|dgnd|gnda|gndd|vss|com)(_\w+|\d+)?$/i;
1463
1598
  function isGroundRef(s) {
@@ -1721,6 +1856,14 @@ var COMPONENT_TYPES = /* @__PURE__ */ new Set([
1721
1856
  "voltage_regulator",
1722
1857
  "dc_dc_converter",
1723
1858
  "555_timer",
1859
+ "terminal_block",
1860
+ "enclosure",
1861
+ "din_rail",
1862
+ "wire_duct",
1863
+ "plc",
1864
+ "pilot_light",
1865
+ "selector_switch",
1866
+ "emergency_stop",
1724
1867
  "voltage_source",
1725
1868
  "current_source",
1726
1869
  "ac_source",
@@ -1775,6 +1918,25 @@ var ALIASES = {
1775
1918
  ic: "generic_ic",
1776
1919
  reg: "voltage_regulator",
1777
1920
  timer555: "555_timer",
1921
+ terminal: "terminal_block",
1922
+ tb: "terminal_block",
1923
+ junction_box: "terminal_block",
1924
+ jbox: "terminal_block",
1925
+ cabinet: "enclosure",
1926
+ panel: "enclosure",
1927
+ backplate: "enclosure",
1928
+ dinrail: "din_rail",
1929
+ "din-rail": "din_rail",
1930
+ duct: "wire_duct",
1931
+ wireduct: "wire_duct",
1932
+ trunking: "wire_duct",
1933
+ controller: "plc",
1934
+ indicator: "pilot_light",
1935
+ pilot: "pilot_light",
1936
+ selector: "selector_switch",
1937
+ estop: "emergency_stop",
1938
+ e_stop: "emergency_stop",
1939
+ "e-stop": "emergency_stop",
1778
1940
  therm: "thermistor_ntc",
1779
1941
  ntc: "thermistor_ntc",
1780
1942
  ptc: "thermistor_ptc",
@@ -2166,6 +2328,8 @@ function rotatePoint(p, angleDeg) {
2166
2328
  }
2167
2329
  function resolveAnchorRef(ref, byId, nets) {
2168
2330
  if (ref === "origin") return { x: 0, y: 0 };
2331
+ const coord = /^@?(-?\d+(?:\.\d+)?),(-?\d+(?:\.\d+)?)$/.exec(ref.trim());
2332
+ if (coord) return { x: Number(coord[1]), y: Number(coord[2]) };
2169
2333
  if (nets.has(ref)) return nets.get(ref);
2170
2334
  const dot = ref.indexOf(".");
2171
2335
  if (dot < 0) {
@@ -2190,7 +2354,7 @@ function layoutCircuit(ast) {
2190
2354
  const resolved = resolveAnchorRef(comp.at, byId, nets);
2191
2355
  if (resolved) startPt = resolved;
2192
2356
  }
2193
- const sym = getSymbol(comp.componentType);
2357
+ const sym = effectiveSymbolDef(comp.componentType, comp.attrs) ?? getSymbol(comp.componentType);
2194
2358
  const rot = rotationDeg(comp.direction);
2195
2359
  if (comp.componentType === "wire") {
2196
2360
  const len = parseInt(comp.attrs?.length ?? "20", 10);
@@ -2660,6 +2824,16 @@ function renderCircuit(ast, config) {
2660
2824
  .schematex-circuit-meter { font: bold 12px sans-serif; fill: ${t.stroke}; }
2661
2825
  .schematex-circuit-title { font: 700 16px sans-serif; fill: ${t.text}; }
2662
2826
  .schematex-circuit-err { stroke: ${t.error}; fill: ${t.error}; }
2827
+ .schematex-circuit-enclosure { stroke: ${t.stroke}; stroke-width: 2; stroke-dasharray: 8 5; fill: ${t.bg}; }
2828
+ .schematex-circuit-enclosure-inner { stroke: ${t.textMuted}; stroke-width: 1; stroke-dasharray: 4 3; fill: none; }
2829
+ .schematex-circuit-panel-label { font: 700 11px system-ui, sans-serif; fill: ${t.text}; }
2830
+ .schematex-circuit-din { fill: ${t.bg}; stroke: ${t.stroke}; stroke-width: 1.4; }
2831
+ .schematex-circuit-din-slot { fill: ${t.textMuted}; opacity: 0.5; }
2832
+ .schematex-circuit-duct { fill: none; stroke: ${t.textMuted}; stroke-width: 1.2; stroke-dasharray: 3 2; }
2833
+ .schematex-circuit-duct-tooth { stroke: ${t.textMuted}; stroke-width: 0.8; opacity: 0.65; }
2834
+ .schematex-circuit-panel-led { fill: ${t.accent}; stroke: ${t.stroke}; stroke-width: 0.8; }
2835
+ .schematex-circuit-panel-light { fill: ${t.bg}; stroke: ${t.stroke}; stroke-width: 1.5; }
2836
+ .schematex-circuit-estop { fill: ${t.error}; stroke: ${t.stroke}; stroke-width: 1.4; }
2663
2837
  `.trim();
2664
2838
  const titleBar = ast.title ? chunk3WNW5Y7P_cjs.text(
2665
2839
  {
@@ -2716,5 +2890,5 @@ exports.lintCircuit = lintCircuit;
2716
2890
  exports.parseCircuit = parseCircuit;
2717
2891
  exports.parseNetlist = parseNetlist;
2718
2892
  exports.renderCircuit = renderCircuit;
2719
- //# sourceMappingURL=chunk-TXWVJAMR.cjs.map
2720
- //# sourceMappingURL=chunk-TXWVJAMR.cjs.map
2893
+ //# sourceMappingURL=chunk-HEGDKO2E.cjs.map
2894
+ //# sourceMappingURL=chunk-HEGDKO2E.cjs.map