@dialecte/plc 0.0.3 → 0.0.5
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/{extensions-DTKTXPJf.js → config-CIpITnIQ.js} +311 -26
- package/dist/index.d.ts +1 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/tc6-v201/definition/constants.generated.d.ts +845 -0
- package/dist/tc6-v201/definition/constants.generated.d.ts.map +1 -0
- package/dist/tc6-v201/definition/definition.generated.d.ts +6166 -0
- package/dist/tc6-v201/definition/definition.generated.d.ts.map +1 -0
- package/dist/tc6-v201/definition/types.generated.d.ts +635 -0
- package/dist/tc6-v201/definition/types.generated.d.ts.map +1 -0
- package/dist/{config → v1/config}/dialecte.config.d.ts +8 -6
- package/dist/{config → v1/config}/dialecte.config.d.ts.map +1 -1
- package/dist/{config → v1/config}/hydrated.types.d.ts +1 -1
- package/dist/v1/config/hydrated.types.d.ts.map +1 -0
- package/dist/v1/config/index.d.ts.map +1 -0
- package/dist/v1/config/namespaces.d.ts +11 -0
- package/dist/v1/config/namespaces.d.ts.map +1 -0
- package/dist/v1/definition/constants.generated.d.ts.map +1 -0
- package/dist/{definition → v1/definition}/definition.generated.d.ts.map +1 -1
- package/dist/v1/definition/index.d.ts.map +1 -0
- package/dist/v1/definition/types.generated.d.ts.map +1 -0
- package/dist/v1/dialecte.d.ts.map +1 -0
- package/dist/v1/extensions/index.d.ts.map +1 -0
- package/dist/v1/hooks/index.d.ts +2 -0
- package/dist/v1/hooks/index.d.ts.map +1 -0
- package/dist/v1/hooks/io/index.d.ts +2 -0
- package/dist/v1/hooks/io/index.d.ts.map +1 -0
- package/dist/v1/hooks/io/io-hooks.d.ts +42 -0
- package/dist/v1/hooks/io/io-hooks.d.ts.map +1 -0
- package/dist/v1/index.d.ts +3 -0
- package/dist/v1/index.d.ts.map +1 -0
- package/dist/{index.js → v1/index.js} +2 -2
- package/dist/{test → v1/test}/hydrated-test.d.ts +11 -2
- package/dist/{test → v1/test}/hydrated-test.d.ts.map +1 -1
- package/dist/v1/test/hydrated-test.types.d.ts.map +1 -0
- package/dist/v1/test/index.d.ts.map +1 -0
- package/dist/v1/test.js +20 -0
- package/package.json +8 -8
- package/dist/config/hydrated.types.d.ts.map +0 -1
- package/dist/config/index.d.ts.map +0 -1
- package/dist/definition/constants.generated.d.ts.map +0 -1
- package/dist/definition/index.d.ts.map +0 -1
- package/dist/definition/types.generated.d.ts.map +0 -1
- package/dist/dialecte.d.ts.map +0 -1
- package/dist/extensions/index.d.ts.map +0 -1
- package/dist/test/hydrated-test.types.d.ts.map +0 -1
- package/dist/test/index.d.ts.map +0 -1
- package/dist/test.js +0 -20
- /package/dist/{config → v1/config}/index.d.ts +0 -0
- /package/dist/{definition → v1/definition}/constants.generated.d.ts +0 -0
- /package/dist/{definition → v1/definition}/definition.generated.d.ts +0 -0
- /package/dist/{definition → v1/definition}/index.d.ts +0 -0
- /package/dist/{definition → v1/definition}/types.generated.d.ts +0 -0
- /package/dist/{dialecte.d.ts → v1/dialecte.d.ts} +0 -0
- /package/dist/{extensions → v1/extensions}/index.d.ts +0 -0
- /package/dist/{test → v1/test}/hydrated-test.types.d.ts +0 -0
- /package/dist/{test → v1/test}/index.d.ts +0 -0
- /package/dist/{test.d.ts → v1/test.d.ts} +0 -0
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { inspectXml as e } from "@dialecte/core";
|
|
2
|
+
import { XSI_NAMESPACE as t } from "@dialecte/core/helpers";
|
|
3
|
+
//#region src/v1/definition/constants.generated.ts
|
|
4
|
+
var n = /* @__PURE__ */ "AccessVariable.AccessVars.Action.ActionBlock.ActionQualifier.AddData.AddDataInfo.Address.ArrayValue.BaseType.Body.BodyContent.Class.CommonObject.ComplexOperand.Condition.ConfigVariable.ConfigVars.Configuration.Connection.ConnectionPointIn.ConnectionPointOut.ConnectionPointOutAction.Content.ContentHeader.CoordinateInfo.Data.DataTypeDecl.Description.DimensionSpec.Documentation.Enumerator.Extends.ExternalVars.FbInstTaskAssociation.FbdObject.FbdScaling.FeedbackConnection.FileHeader.Function.FunctionBlock.GlobalNamespace.GlobalVars.GraphicalExpression.GraphicalPredicate.IL.Implements.InOutAssignment.InOutVariable.InOutVariables.IndexRange.Info.InitialValue.Inline.InoutVars.InputAssignment.InputVariable.InputVariables.InputVars.Instances.InstantlyDefinedType.Interface.LdObject.LdScaling.MainBody.Member.Method.NamespaceDecl.Network.OutputAssignment.OutputVariable.OutputVariables.OutputVars.Parameters.PredicateContent.Program.ProgramInstance.Project.Range.Reference.ReferenceName.ReferenceTo.RelPosition.Resource.ResultType.Rung.ST.SfcObject.SfcScaling.SimpleValue.Size.StructValue.Task.TempVars.TextualPredicate.Transition.Type.TypeName.Types.UserDefinedTypeSpec.UsingDirective.Value.Variable.VariableLength.Vars".split("."), r = {
|
|
3
5
|
AccessVariable: [
|
|
4
6
|
"Documentation",
|
|
5
7
|
"AddData",
|
|
@@ -470,7 +472,7 @@ var e = /* @__PURE__ */ "AccessVariable.AccessVars.Action.ActionBlock.ActionQual
|
|
|
470
472
|
"UsingDirective",
|
|
471
473
|
"Variable"
|
|
472
474
|
]
|
|
473
|
-
},
|
|
475
|
+
}, i = {
|
|
474
476
|
AccessVariable: ["AccessVars"],
|
|
475
477
|
AccessVars: ["Configuration", "Program"],
|
|
476
478
|
Action: ["FunctionBlock", "Program"],
|
|
@@ -705,7 +707,7 @@ var e = /* @__PURE__ */ "AccessVariable.AccessVars.Action.ActionBlock.ActionQual
|
|
|
705
707
|
"FunctionBlock",
|
|
706
708
|
"Program"
|
|
707
709
|
]
|
|
708
|
-
},
|
|
710
|
+
}, a = {
|
|
709
711
|
AccessVariable: [
|
|
710
712
|
"AddData",
|
|
711
713
|
"BaseType",
|
|
@@ -1362,7 +1364,7 @@ var e = /* @__PURE__ */ "AccessVariable.AccessVars.Action.ActionBlock.ActionQual
|
|
|
1362
1364
|
"Variable",
|
|
1363
1365
|
"VariableLength"
|
|
1364
1366
|
]
|
|
1365
|
-
},
|
|
1367
|
+
}, o = {
|
|
1366
1368
|
AccessVariable: [
|
|
1367
1369
|
"AccessVars",
|
|
1368
1370
|
"Configuration",
|
|
@@ -1788,7 +1790,7 @@ var e = /* @__PURE__ */ "AccessVariable.AccessVars.Action.ActionBlock.ActionQual
|
|
|
1788
1790
|
"Project",
|
|
1789
1791
|
"Types"
|
|
1790
1792
|
]
|
|
1791
|
-
},
|
|
1793
|
+
}, s = "Project", c = [
|
|
1792
1794
|
"AddDataInfo",
|
|
1793
1795
|
"ContentHeader",
|
|
1794
1796
|
"CoordinateInfo",
|
|
@@ -1800,7 +1802,7 @@ var e = /* @__PURE__ */ "AccessVariable.AccessVars.Action.ActionBlock.ActionQual
|
|
|
1800
1802
|
"Project",
|
|
1801
1803
|
"SfcScaling",
|
|
1802
1804
|
"Types"
|
|
1803
|
-
],
|
|
1805
|
+
], l = {
|
|
1804
1806
|
AccessVariable: {
|
|
1805
1807
|
alias: "",
|
|
1806
1808
|
direction: "",
|
|
@@ -2205,7 +2207,7 @@ var e = /* @__PURE__ */ "AccessVariable.AccessVars.Action.ActionBlock.ActionQual
|
|
|
2205
2207
|
pragma: "",
|
|
2206
2208
|
retain: ""
|
|
2207
2209
|
}
|
|
2208
|
-
},
|
|
2210
|
+
}, u = {
|
|
2209
2211
|
AccessVariable: {
|
|
2210
2212
|
tag: "AccessVariable",
|
|
2211
2213
|
namespace: {
|
|
@@ -6537,7 +6539,293 @@ var e = /* @__PURE__ */ "AccessVariable.AccessVars.Action.ActionBlock.ActionQual
|
|
|
6537
6539
|
}
|
|
6538
6540
|
}
|
|
6539
6541
|
}
|
|
6540
|
-
},
|
|
6542
|
+
}, d = {
|
|
6543
|
+
default: {
|
|
6544
|
+
uri: "www.iec.ch/public/TC65SC65BWG7TF10",
|
|
6545
|
+
prefix: ""
|
|
6546
|
+
},
|
|
6547
|
+
xsi: t
|
|
6548
|
+
}, f = "http://www.plcopen.org/xml/tc6_0201", p = d.default.uri, m = d.xsi.uri;
|
|
6549
|
+
function h(t) {
|
|
6550
|
+
return e(t, { elements: ["project"] }).project?.namespace === f;
|
|
6551
|
+
}
|
|
6552
|
+
function g(e) {
|
|
6553
|
+
if (!h(e)) return e;
|
|
6554
|
+
let t = new DOMParser().parseFromString(e, "application/xml"), n = t.querySelector("parsererror");
|
|
6555
|
+
if (n) throw Error(`TC6 v201 parse error: ${n.textContent}`);
|
|
6556
|
+
let r = document.implementation.createDocument(p, "", null), i = t.documentElement, a = r.createElementNS(p, "Project"), o = i.getAttribute("schemaVersion");
|
|
6557
|
+
o && a.setAttribute("schemaVersion", o), r.appendChild(a);
|
|
6558
|
+
let s = i.querySelector("fileHeader");
|
|
6559
|
+
if (s) {
|
|
6560
|
+
let e = r.createElementNS(p, "FileHeader");
|
|
6561
|
+
for (let t of s.attributes) e.setAttribute(t.name, t.value);
|
|
6562
|
+
a.appendChild(e);
|
|
6563
|
+
}
|
|
6564
|
+
let c = i.querySelector("contentHeader");
|
|
6565
|
+
if (c) {
|
|
6566
|
+
let e = r.createElementNS(p, "ContentHeader");
|
|
6567
|
+
for (let t of c.attributes) e.setAttribute(t.name, t.value);
|
|
6568
|
+
a.appendChild(e);
|
|
6569
|
+
}
|
|
6570
|
+
let l = i.querySelector("types");
|
|
6571
|
+
if (l) {
|
|
6572
|
+
let e = r.createElementNS(p, "Types"), t = r.createElementNS(p, "GlobalNamespace");
|
|
6573
|
+
e.appendChild(t);
|
|
6574
|
+
for (let e of l.querySelectorAll("pou")) t.appendChild(_(r, e));
|
|
6575
|
+
a.appendChild(e);
|
|
6576
|
+
}
|
|
6577
|
+
let u = r.createElementNS(p, "Instances");
|
|
6578
|
+
return a.appendChild(u), new XMLSerializer().serializeToString(r);
|
|
6579
|
+
}
|
|
6580
|
+
function _(e, t) {
|
|
6581
|
+
let n = t.getAttribute("name") ?? "", r = (t.getAttribute("pouType") ?? "functionBlock") === "program" ? "Program" : "FunctionBlock", i = e.createElementNS(p, r);
|
|
6582
|
+
i.setAttribute("name", n);
|
|
6583
|
+
let a = t.querySelector("interface");
|
|
6584
|
+
a && v(e, i, a);
|
|
6585
|
+
let o = t.querySelector("body");
|
|
6586
|
+
return o && C(e, i, o), i;
|
|
6587
|
+
}
|
|
6588
|
+
function v(e, t, n) {
|
|
6589
|
+
let r = b(e, n, "inputVars"), i = b(e, n, "outputVars"), a = b(e, n, "inOutVars");
|
|
6590
|
+
if (r.length || i.length || a.length) {
|
|
6591
|
+
let n = e.createElementNS(p, "Parameters");
|
|
6592
|
+
y(e, n, "InoutVars", a), y(e, n, "InputVars", r), y(e, n, "OutputVars", i), t.appendChild(n);
|
|
6593
|
+
}
|
|
6594
|
+
y(e, t, "ExternalVars", b(e, n, "externalVars")), y(e, t, "Vars", b(e, n, "localVars")), y(e, t, "TempVars", b(e, n, "tempVars"));
|
|
6595
|
+
}
|
|
6596
|
+
function y(e, t, n, r) {
|
|
6597
|
+
if (!r.length) return;
|
|
6598
|
+
let i = e.createElementNS(p, n);
|
|
6599
|
+
for (let e of r) i.appendChild(e);
|
|
6600
|
+
t.appendChild(i);
|
|
6601
|
+
}
|
|
6602
|
+
function b(e, t, n) {
|
|
6603
|
+
let r = [];
|
|
6604
|
+
for (let i of t.querySelectorAll(`:scope > ${n}`)) for (let t of i.querySelectorAll(":scope > variable")) r.push(x(e, t));
|
|
6605
|
+
return r;
|
|
6606
|
+
}
|
|
6607
|
+
function x(e, t) {
|
|
6608
|
+
let n = e.createElementNS(p, "Variable");
|
|
6609
|
+
n.setAttribute("name", t.getAttribute("name") ?? "");
|
|
6610
|
+
let r = e.createElementNS(p, "Type"), i = e.createElementNS(p, "TypeName");
|
|
6611
|
+
i.textContent = S(t.querySelector("type")), r.appendChild(i), n.appendChild(r);
|
|
6612
|
+
let a = t.querySelector("initialValue > simpleValue");
|
|
6613
|
+
if (a) {
|
|
6614
|
+
let t = e.createElementNS(p, "InitialValue"), r = e.createElementNS(p, "SimpleValue");
|
|
6615
|
+
r.setAttribute("value", a.getAttribute("value") ?? ""), t.appendChild(r), n.appendChild(t);
|
|
6616
|
+
}
|
|
6617
|
+
return n;
|
|
6618
|
+
}
|
|
6619
|
+
function S(e) {
|
|
6620
|
+
if (!e) return "";
|
|
6621
|
+
let t = e.querySelector("derived");
|
|
6622
|
+
if (t) return t.getAttribute("name") ?? "";
|
|
6623
|
+
let n = e.firstElementChild;
|
|
6624
|
+
return n ? n.localName : "";
|
|
6625
|
+
}
|
|
6626
|
+
function C(e, t, n) {
|
|
6627
|
+
let r = n.querySelector("FBD");
|
|
6628
|
+
if (r) {
|
|
6629
|
+
t.appendChild(T(e, r));
|
|
6630
|
+
return;
|
|
6631
|
+
}
|
|
6632
|
+
let i = n.querySelector("LD");
|
|
6633
|
+
if (i) {
|
|
6634
|
+
t.appendChild(R(e, i));
|
|
6635
|
+
return;
|
|
6636
|
+
}
|
|
6637
|
+
let a = n.querySelector("ST");
|
|
6638
|
+
if (a) {
|
|
6639
|
+
t.appendChild(w(e, "ST", a));
|
|
6640
|
+
return;
|
|
6641
|
+
}
|
|
6642
|
+
let o = n.querySelector("IL");
|
|
6643
|
+
o && t.appendChild(w(e, "IL", o));
|
|
6644
|
+
}
|
|
6645
|
+
function w(e, t, n) {
|
|
6646
|
+
let r = e.createElementNS(p, "MainBody"), i = e.createElementNS(p, "BodyContent");
|
|
6647
|
+
i.setAttributeNS(m, "xsi:type", t);
|
|
6648
|
+
let a = e.createElementNS(p, t);
|
|
6649
|
+
return a.textContent = W(n), i.appendChild(a), r.appendChild(i), r;
|
|
6650
|
+
}
|
|
6651
|
+
function T(e, t) {
|
|
6652
|
+
let n = E(t), r = e.createElementNS(p, "MainBody"), i = e.createElementNS(p, "BodyContent");
|
|
6653
|
+
i.setAttributeNS(m, "xsi:type", "FBD");
|
|
6654
|
+
let a = e.createElementNS(p, "Network");
|
|
6655
|
+
a.setAttribute("evaluationOrder", "0");
|
|
6656
|
+
for (let r of t.children) {
|
|
6657
|
+
let t = O(e, r, n);
|
|
6658
|
+
t && a.appendChild(t);
|
|
6659
|
+
}
|
|
6660
|
+
return i.appendChild(a), r.appendChild(i), r;
|
|
6661
|
+
}
|
|
6662
|
+
function E(e) {
|
|
6663
|
+
let t = /* @__PURE__ */ new Map(), n = 0, r = (e, r) => {
|
|
6664
|
+
let i = String(++n);
|
|
6665
|
+
t.set(`${e}|${r}`, i), t.has(`${e}|`) || t.set(`${e}|`, i);
|
|
6666
|
+
};
|
|
6667
|
+
for (let t of e.children) {
|
|
6668
|
+
let e = t.getAttribute("localId") ?? "";
|
|
6669
|
+
switch (t.localName) {
|
|
6670
|
+
case "block":
|
|
6671
|
+
for (let n of t.querySelectorAll("outputVariables > variable")) r(e, n.getAttribute("formalParameter") ?? "");
|
|
6672
|
+
break;
|
|
6673
|
+
case "inVariable":
|
|
6674
|
+
case "continuation":
|
|
6675
|
+
r(e, "");
|
|
6676
|
+
break;
|
|
6677
|
+
}
|
|
6678
|
+
}
|
|
6679
|
+
return t;
|
|
6680
|
+
}
|
|
6681
|
+
function D(e, t) {
|
|
6682
|
+
let n = e.getAttribute("refLocalId") ?? "", r = e.getAttribute("formalParameter") ?? "";
|
|
6683
|
+
return t.get(`${n}|${r}`) ?? t.get(`${n}|`);
|
|
6684
|
+
}
|
|
6685
|
+
function O(e, t, n) {
|
|
6686
|
+
switch (t.localName) {
|
|
6687
|
+
case "block": return k(e, t, n);
|
|
6688
|
+
case "inVariable": return M(e, t, n);
|
|
6689
|
+
case "outVariable": return N(e, t, n);
|
|
6690
|
+
case "comment": return P(e, t);
|
|
6691
|
+
case "connector": return F(e, t, n);
|
|
6692
|
+
case "continuation": return I(e, t, n);
|
|
6693
|
+
default: return null;
|
|
6694
|
+
}
|
|
6695
|
+
}
|
|
6696
|
+
function k(e, t, n) {
|
|
6697
|
+
let r = e.createElementNS(p, "FbdObject");
|
|
6698
|
+
r.setAttributeNS(m, "xsi:type", "Block"), r.setAttribute("typeName", t.getAttribute("typeName") ?? "");
|
|
6699
|
+
let i = t.getAttribute("instanceName");
|
|
6700
|
+
i && r.setAttribute("instanceName", i), H(e, r, t);
|
|
6701
|
+
let a = t.querySelectorAll("inputVariables > variable");
|
|
6702
|
+
if (a.length) {
|
|
6703
|
+
let t = e.createElementNS(p, "InputVariables");
|
|
6704
|
+
for (let r of a) t.appendChild(A(e, r, n));
|
|
6705
|
+
r.appendChild(t);
|
|
6706
|
+
}
|
|
6707
|
+
let o = t.getAttribute("localId") ?? "", s = t.querySelectorAll("outputVariables > variable");
|
|
6708
|
+
if (s.length) {
|
|
6709
|
+
let t = e.createElementNS(p, "OutputVariables");
|
|
6710
|
+
for (let r of s) {
|
|
6711
|
+
let i = r.getAttribute("formalParameter") ?? "";
|
|
6712
|
+
t.appendChild(j(e, i, n.get(`${o}|${i}`)));
|
|
6713
|
+
}
|
|
6714
|
+
r.appendChild(t);
|
|
6715
|
+
}
|
|
6716
|
+
return r;
|
|
6717
|
+
}
|
|
6718
|
+
function A(e, t, n) {
|
|
6719
|
+
let r = e.createElementNS(p, "InputVariable");
|
|
6720
|
+
r.setAttribute("parameterName", t.getAttribute("formalParameter") ?? ""), t.getAttribute("negated") === "true" && r.setAttribute("negated", "true");
|
|
6721
|
+
let i = t.getAttribute("edge");
|
|
6722
|
+
return i && i !== "none" && r.setAttribute("edge", i), r.appendChild(V(e, t.querySelector("connectionPointIn"), n)), r;
|
|
6723
|
+
}
|
|
6724
|
+
function j(e, t, n) {
|
|
6725
|
+
let r = e.createElementNS(p, "OutputVariable");
|
|
6726
|
+
r.setAttribute("parameterName", t);
|
|
6727
|
+
let i = e.createElementNS(p, "ConnectionPointOut");
|
|
6728
|
+
return n && i.setAttribute("connectionPointOutId", n), r.appendChild(i), r;
|
|
6729
|
+
}
|
|
6730
|
+
function M(e, t, n) {
|
|
6731
|
+
let r = e.createElementNS(p, "FbdObject");
|
|
6732
|
+
r.setAttributeNS(m, "xsi:type", "DataSource"), r.setAttribute("identifier", U(t)), H(e, r, t);
|
|
6733
|
+
let i = t.getAttribute("localId") ?? "", a = e.createElementNS(p, "OutputVariables");
|
|
6734
|
+
return a.appendChild(j(e, "value", n.get(`${i}|`))), r.appendChild(a), r;
|
|
6735
|
+
}
|
|
6736
|
+
function N(e, t, n) {
|
|
6737
|
+
let r = e.createElementNS(p, "FbdObject");
|
|
6738
|
+
r.setAttributeNS(m, "xsi:type", "DataSink"), r.setAttribute("identifier", U(t)), H(e, r, t);
|
|
6739
|
+
let i = e.createElementNS(p, "InputVariable");
|
|
6740
|
+
i.setAttribute("parameterName", "value"), i.appendChild(V(e, t.querySelector("connectionPointIn"), n));
|
|
6741
|
+
let a = e.createElementNS(p, "InputVariables");
|
|
6742
|
+
return a.appendChild(i), r.appendChild(a), r;
|
|
6743
|
+
}
|
|
6744
|
+
function P(e, t) {
|
|
6745
|
+
let n = e.createElementNS(p, "CommonObject");
|
|
6746
|
+
n.setAttributeNS(m, "xsi:type", "Comment"), H(e, n, t);
|
|
6747
|
+
let r = t.querySelector("content"), i = e.createElementNS(p, "Content");
|
|
6748
|
+
return i.setAttributeNS(m, "xsi:type", "SimpleText"), i.setAttribute("value", r ? W(r) : ""), n.appendChild(i), n;
|
|
6749
|
+
}
|
|
6750
|
+
function F(e, t, n) {
|
|
6751
|
+
let r = e.createElementNS(p, "CommonObject");
|
|
6752
|
+
return r.setAttributeNS(m, "xsi:type", "Connector"), r.setAttribute("label", t.getAttribute("name") ?? ""), H(e, r, t), r.appendChild(V(e, t.querySelector("connectionPointIn"), n)), r;
|
|
6753
|
+
}
|
|
6754
|
+
function I(e, t, n) {
|
|
6755
|
+
let r = e.createElementNS(p, "CommonObject");
|
|
6756
|
+
r.setAttributeNS(m, "xsi:type", "Continuation"), r.setAttribute("label", t.getAttribute("name") ?? ""), H(e, r, t);
|
|
6757
|
+
let i = t.getAttribute("localId") ?? "", a = e.createElementNS(p, "ConnectionPointOut"), o = n.get(`${i}|`);
|
|
6758
|
+
return o && a.setAttribute("connectionPointOutId", o), r.appendChild(a), r;
|
|
6759
|
+
}
|
|
6760
|
+
var L = {
|
|
6761
|
+
leftPowerRail: "LeftPowerRail",
|
|
6762
|
+
rightPowerRail: "RightPowerRail",
|
|
6763
|
+
coil: "Coil",
|
|
6764
|
+
contact: "Contact"
|
|
6765
|
+
};
|
|
6766
|
+
function R(e, t) {
|
|
6767
|
+
let n = z(t), r = e.createElementNS(p, "MainBody"), i = e.createElementNS(p, "BodyContent");
|
|
6768
|
+
i.setAttributeNS(m, "xsi:type", "LD");
|
|
6769
|
+
let a = e.createElementNS(p, "Rung");
|
|
6770
|
+
a.setAttribute("evaluationOrder", "0");
|
|
6771
|
+
for (let r of t.children) {
|
|
6772
|
+
let t = B(e, r, n);
|
|
6773
|
+
t && a.appendChild(t);
|
|
6774
|
+
}
|
|
6775
|
+
return i.appendChild(a), r.appendChild(i), r;
|
|
6776
|
+
}
|
|
6777
|
+
function z(e) {
|
|
6778
|
+
let t = /* @__PURE__ */ new Map(), n = 0;
|
|
6779
|
+
for (let r of e.children) if (r.querySelector(":scope > connectionPointOut")) {
|
|
6780
|
+
let e = r.getAttribute("localId") ?? "";
|
|
6781
|
+
t.set(`${e}|`, String(++n));
|
|
6782
|
+
}
|
|
6783
|
+
return t;
|
|
6784
|
+
}
|
|
6785
|
+
function B(e, t, n) {
|
|
6786
|
+
let r = L[t.localName];
|
|
6787
|
+
if (!r) return null;
|
|
6788
|
+
let i = e.createElementNS(p, "LdObject");
|
|
6789
|
+
i.setAttributeNS(m, "xsi:type", r), t.getAttribute("negated") === "true" && i.setAttribute("negated", "true");
|
|
6790
|
+
let a = t.querySelector("variable");
|
|
6791
|
+
a && i.setAttribute("operand", W(a)), H(e, i, t);
|
|
6792
|
+
let o = t.querySelector(":scope > connectionPointIn");
|
|
6793
|
+
if (o && i.appendChild(V(e, o, n)), t.querySelector(":scope > connectionPointOut")) {
|
|
6794
|
+
let r = t.getAttribute("localId") ?? "", a = e.createElementNS(p, "ConnectionPointOut"), o = n.get(`${r}|`);
|
|
6795
|
+
o && a.setAttribute("connectionPointOutId", o), i.appendChild(a);
|
|
6796
|
+
}
|
|
6797
|
+
return i;
|
|
6798
|
+
}
|
|
6799
|
+
function V(e, t, n) {
|
|
6800
|
+
let r = e.createElementNS(p, "ConnectionPointIn");
|
|
6801
|
+
if (!t) return r;
|
|
6802
|
+
for (let i of t.querySelectorAll("connection")) {
|
|
6803
|
+
let t = D(i, n);
|
|
6804
|
+
if (!t) continue;
|
|
6805
|
+
let a = e.createElementNS(p, "Connection");
|
|
6806
|
+
a.setAttribute("refConnectionPointOutId", t), r.appendChild(a);
|
|
6807
|
+
}
|
|
6808
|
+
return r;
|
|
6809
|
+
}
|
|
6810
|
+
function H(e, t, n) {
|
|
6811
|
+
let r = n.querySelector(":scope > position");
|
|
6812
|
+
if (!r) return;
|
|
6813
|
+
let i = e.createElementNS(p, "RelPosition");
|
|
6814
|
+
i.setAttribute("x", r.getAttribute("x") ?? "0"), i.setAttribute("y", r.getAttribute("y") ?? "0"), t.appendChild(i);
|
|
6815
|
+
}
|
|
6816
|
+
function U(e) {
|
|
6817
|
+
let t = e.querySelector("expression");
|
|
6818
|
+
return t ? W(t) : "";
|
|
6819
|
+
}
|
|
6820
|
+
function W(e) {
|
|
6821
|
+
return e.textContent?.trim() ?? "";
|
|
6822
|
+
}
|
|
6823
|
+
//#endregion
|
|
6824
|
+
//#region src/v1/config/dialecte.config.ts
|
|
6825
|
+
var G = {
|
|
6826
|
+
supportedFileExtensions: [".xml"],
|
|
6827
|
+
hooks: { beforeImport: g }
|
|
6828
|
+
}, K = { recordSchema: {
|
|
6541
6829
|
primaryKey: "id",
|
|
6542
6830
|
indexes: [
|
|
6543
6831
|
"tagName",
|
|
@@ -6546,22 +6834,19 @@ var e = /* @__PURE__ */ "AccessVariable.AccessVars.Action.ActionBlock.ActionQual
|
|
|
6546
6834
|
],
|
|
6547
6835
|
compoundIndexes: [["id", "tagName"]],
|
|
6548
6836
|
arrayIndexes: ["children.id", "children.tagName"]
|
|
6549
|
-
} },
|
|
6550
|
-
|
|
6551
|
-
|
|
6552
|
-
} }, f = {
|
|
6553
|
-
singletonElements: o,
|
|
6554
|
-
elements: e,
|
|
6837
|
+
} }, q = {
|
|
6838
|
+
singletonElements: c,
|
|
6839
|
+
elements: n,
|
|
6555
6840
|
namespaces: d,
|
|
6556
|
-
attributes:
|
|
6557
|
-
children:
|
|
6558
|
-
parents:
|
|
6559
|
-
descendants:
|
|
6560
|
-
ancestors:
|
|
6561
|
-
database:
|
|
6562
|
-
io:
|
|
6563
|
-
definition:
|
|
6564
|
-
rootElementName:
|
|
6565
|
-
},
|
|
6841
|
+
attributes: l,
|
|
6842
|
+
children: r,
|
|
6843
|
+
parents: i,
|
|
6844
|
+
descendants: a,
|
|
6845
|
+
ancestors: o,
|
|
6846
|
+
database: K,
|
|
6847
|
+
io: G,
|
|
6848
|
+
definition: u,
|
|
6849
|
+
rootElementName: s
|
|
6850
|
+
}, J = {};
|
|
6566
6851
|
//#endregion
|
|
6567
|
-
export { d as a,
|
|
6852
|
+
export { d as a, G as i, K as n, q as r, J as t };
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAA"}
|