@xaendar/compiler 0.7.6 → 0.7.8
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/xaendar-compiler.es.js +14 -4
- package/package.json +3 -3
|
@@ -512,8 +512,9 @@ function generateElement(node, parentNode, index, compilerContext, anchor) {
|
|
|
512
512
|
const attributes = mapAttributes(node.attributes, compilerContext);
|
|
513
513
|
const events = mapEvents(node.events, compilerContext);
|
|
514
514
|
const nodeName = getElementIdentifier(node, parentNode, index);
|
|
515
|
+
const tagName = node.tagName;
|
|
515
516
|
const retval = {
|
|
516
|
-
code: [`const ${nodeName} = _renderElement(${parentNode}, context, ${anchor}, '${
|
|
517
|
+
code: [`const ${nodeName} = _renderElement(${parentNode}, context, ${anchor}, '${tagName}',`],
|
|
517
518
|
functionsToProcess: /* @__PURE__ */ new Map()
|
|
518
519
|
};
|
|
519
520
|
attributes.length ? retval.code.push(...indent([
|
|
@@ -533,9 +534,13 @@ function generateElement(node, parentNode, index, compilerContext, anchor) {
|
|
|
533
534
|
parentNode: nodeName,
|
|
534
535
|
context: compilerContext
|
|
535
536
|
},
|
|
536
|
-
args: [
|
|
537
|
+
args: [
|
|
538
|
+
nodeName,
|
|
539
|
+
"parentContext",
|
|
540
|
+
"namespace"
|
|
541
|
+
]
|
|
537
542
|
});
|
|
538
|
-
retval.code.push(`this.${nodeName}Children(${nodeName}, context);`);
|
|
543
|
+
retval.code.push(`this.${nodeName}Children(${nodeName}, context, ${tagName === "svg" ? "'svg'" : "namespace"});`);
|
|
539
544
|
}
|
|
540
545
|
return retval;
|
|
541
546
|
}
|
|
@@ -665,6 +670,7 @@ function generateFor(node, parentNode, index, compilerContext, anchor) {
|
|
|
665
670
|
"parentContext",
|
|
666
671
|
itemsName,
|
|
667
672
|
counterName,
|
|
673
|
+
"namespace",
|
|
668
674
|
"anchor"
|
|
669
675
|
]
|
|
670
676
|
});
|
|
@@ -711,6 +717,7 @@ function generateIf(node, parentNode, index, compilerContext) {
|
|
|
711
717
|
args: [
|
|
712
718
|
ifKey,
|
|
713
719
|
"parentContext",
|
|
720
|
+
"namespace",
|
|
714
721
|
"anchor"
|
|
715
722
|
]
|
|
716
723
|
});
|
|
@@ -735,6 +742,7 @@ function generateIf(node, parentNode, index, compilerContext) {
|
|
|
735
742
|
args: [
|
|
736
743
|
parentNode,
|
|
737
744
|
"parentContext",
|
|
745
|
+
"namespace",
|
|
738
746
|
"anchor"
|
|
739
747
|
]
|
|
740
748
|
});
|
|
@@ -759,6 +767,7 @@ function generateIf(node, parentNode, index, compilerContext) {
|
|
|
759
767
|
args: [
|
|
760
768
|
parentNode,
|
|
761
769
|
"parentContext",
|
|
770
|
+
"namespace",
|
|
762
771
|
"anchor"
|
|
763
772
|
]
|
|
764
773
|
});
|
|
@@ -796,6 +805,7 @@ function generateSwitch(node, parentNode, index, compilerContext) {
|
|
|
796
805
|
args: [
|
|
797
806
|
caseKey,
|
|
798
807
|
"parentContext",
|
|
808
|
+
"namespace",
|
|
799
809
|
"anchor"
|
|
800
810
|
]
|
|
801
811
|
});
|
|
@@ -853,7 +863,7 @@ var Generator = class {
|
|
|
853
863
|
for (const [key, fnData] of this._nodeToProcess.entries()) {
|
|
854
864
|
const { node, parentNode, context, precode, anchor } = fnData.fn;
|
|
855
865
|
renderFunctions.push(`\n${key}(${fnData.args?.join(", ")}) {`, ...indent([
|
|
856
|
-
"const context = new Context(this, parentContext);",
|
|
866
|
+
"const context = new Context(this, parentContext, namespace);",
|
|
857
867
|
...node.children.map((child, i) => {
|
|
858
868
|
const { code, functionsToProcess } = this._processNode(child, parentNode, i.toString(), context, anchor ?? null);
|
|
859
869
|
functionsToProcess?.forEach((value, key) => this._nodeToProcess.set(key, value));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xaendar/compiler",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.8",
|
|
4
4
|
"description": "A library for transpiling Xaendar Templates into JavaScript code",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"type": "module",
|
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
}
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@xaendar/common": "0.7.
|
|
20
|
-
"@xaendar/types": "0.7.
|
|
19
|
+
"@xaendar/common": "0.7.8",
|
|
20
|
+
"@xaendar/types": "0.7.8",
|
|
21
21
|
"typescript": "^6.0.3"
|
|
22
22
|
}
|
|
23
23
|
}
|