schematex 0.9.9 → 0.9.11
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 +9 -9
- package/dist/ai/ai-sdk.d.cts +3 -3
- package/dist/ai/ai-sdk.d.ts +3 -3
- package/dist/ai/ai-sdk.js +4 -4
- package/dist/ai/index.cjs +18 -18
- package/dist/ai/index.d.cts +4 -4
- package/dist/ai/index.d.ts +4 -4
- package/dist/ai/index.js +5 -5
- package/dist/{api-D_d-JklT.d.ts → api-DAiP83-P.d.ts} +1 -1
- package/dist/{api-DnTyW-6F.d.cts → api-DecITB-t.d.cts} +1 -1
- package/dist/browser.cjs +10 -10
- package/dist/browser.d.cts +3 -3
- package/dist/browser.d.ts +3 -3
- package/dist/browser.js +4 -4
- package/dist/{chunk-IHX6J4HF.js → chunk-32LOZTNP.js} +178 -4
- package/dist/chunk-32LOZTNP.js.map +1 -0
- package/dist/{chunk-RCR4UGKV.js → chunk-4QBC4475.js} +35 -20
- package/dist/chunk-4QBC4475.js.map +1 -0
- package/dist/{chunk-OY2CXLVY.cjs → chunk-5YTFNOKY.cjs} +170 -15
- package/dist/{chunk-OY2CXLVY.cjs.map → chunk-5YTFNOKY.cjs.map} +1 -1
- package/dist/{chunk-EUN6FEGE.cjs → chunk-6ZTPWE22.cjs} +37 -22
- package/dist/chunk-6ZTPWE22.cjs.map +1 -0
- package/dist/{chunk-TXWVJAMR.cjs → chunk-HEGDKO2E.cjs} +178 -4
- package/dist/chunk-HEGDKO2E.cjs.map +1 -0
- package/dist/{chunk-T5QOVX2I.js → chunk-RU3N57OB.js} +168 -13
- package/dist/{chunk-T5QOVX2I.js.map → chunk-RU3N57OB.js.map} +1 -1
- package/dist/{chunk-MVTYPWHO.js → chunk-WTGABYFK.js} +80 -17
- package/dist/chunk-WTGABYFK.js.map +1 -0
- package/dist/{chunk-MXV3XJFH.cjs → chunk-YN7EBTWB.cjs} +80 -17
- package/dist/chunk-YN7EBTWB.cjs.map +1 -0
- package/dist/{diagnostics-D2qkBfFx.d.cts → diagnostics-Bps9pzlF.d.cts} +8 -2
- package/dist/{diagnostics-D2qkBfFx.d.ts → diagnostics-Bps9pzlF.d.ts} +8 -2
- package/dist/diagrams/blockdiagram/index.d.cts +1 -1
- package/dist/diagrams/blockdiagram/index.d.ts +1 -1
- package/dist/diagrams/circuit/index.cjs +8 -8
- 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 +4 -1
- package/dist/diagrams/sld/index.d.ts +4 -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.d.cts +1 -1
- package/dist/diagrams/timing/index.d.ts +1 -1
- package/dist/diagrams/venn/index.d.cts +1 -1
- package/dist/diagrams/venn/index.d.ts +1 -1
- package/dist/{index-D9u0YRxL.d.ts → index-F6MCisQe.d.ts} +1 -1
- package/dist/{index-JZlLiE6K.d.cts → index-fvBAmlv7.d.cts} +1 -1
- package/dist/index.cjs +43 -43
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +6 -6
- package/dist/react.cjs +4 -4
- package/dist/react.d.cts +2 -2
- package/dist/react.d.ts +2 -2
- package/dist/react.js +3 -3
- package/dist/{tools-DM0aLCbc.d.ts → tools-CdzIw2Az.d.ts} +2 -2
- package/dist/{tools-DAKYNcPv.d.cts → tools-vyVK2DHa.d.cts} +2 -2
- package/package.json +1 -1
- package/dist/chunk-EUN6FEGE.cjs.map +0 -1
- package/dist/chunk-IHX6J4HF.js.map +0 -1
- package/dist/chunk-MVTYPWHO.js.map +0 -1
- package/dist/chunk-MXV3XJFH.cjs.map +0 -1
- package/dist/chunk-RCR4UGKV.js.map +0 -1
- 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: "
|
|
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-
|
|
2720
|
-
//# sourceMappingURL=chunk-
|
|
2893
|
+
//# sourceMappingURL=chunk-HEGDKO2E.cjs.map
|
|
2894
|
+
//# sourceMappingURL=chunk-HEGDKO2E.cjs.map
|