@xaendar/compiler 0.6.11 → 0.6.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.
@@ -390,23 +390,33 @@ function consumeEvent(cursor, _context) {
390
390
  let read = true;
391
391
  let event = "";
392
392
  let retVal;
393
+ let deep = 0;
393
394
  cursor.advance();
394
395
  while (read) switch (cursor.peek()) {
395
396
  case 32:
396
397
  case 47:
397
398
  case 62:
398
- retVal = {
399
- state: LexerState.TAG_BODY,
400
- tokens: [{
401
- type: TokenType.EVENT,
402
- parts: [event]
403
- }]
404
- };
405
- read = false;
399
+ if (deep === 0) {
400
+ retVal = {
401
+ state: LexerState.TAG_BODY,
402
+ tokens: [{
403
+ type: TokenType.EVENT,
404
+ parts: [event]
405
+ }]
406
+ };
407
+ read = false;
408
+ }
406
409
  break;
407
- default:
410
+ case 40:
411
+ deep++;
412
+ break;
413
+ case 41:
414
+ deep--;
415
+ break;
416
+ default: if (deep === 0) {
408
417
  cursor.advance();
409
418
  event = `${event}${cursor.currentChar.value}`;
419
+ }
410
420
  }
411
421
  return retVal;
412
422
  }
@@ -1952,7 +1962,7 @@ function processConstDeclaration(node, _nodeName, _parentNode) {
1952
1962
  function processElement(node, nodeName, parentNode) {
1953
1963
  const attributes = mapAttributes(node.attributes);
1954
1964
  const events = mapEvents(node.events);
1955
- const code = [`_renderElement(${parentNode}, context, '${node.tagName}',`];
1965
+ const code = [`const ${nodeName} = _renderElement(${parentNode}, context, '${node.tagName}',`];
1956
1966
  attributes.length ? code.push(...indent([
1957
1967
  "[",
1958
1968
  ...indent(attributes),
@@ -1963,6 +1973,7 @@ function processElement(node, nodeName, parentNode) {
1963
1973
  ...indent(events),
1964
1974
  "]"
1965
1975
  ]), ")") : code[code.length - 1] = `${code[code.length - 1]} [])`;
1976
+ code.push(...node.children.map((child, i) => processNode(child, i.toString(), nodeName)).flat());
1966
1977
  return code;
1967
1978
  }
1968
1979
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xaendar/compiler",
3
- "version": "0.6.11",
3
+ "version": "0.6.12",
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.6.11",
20
- "@xaendar/types": "0.6.11",
19
+ "@xaendar/common": "0.6.12",
20
+ "@xaendar/types": "0.6.12",
21
21
  "typescript": "^6.0.3"
22
22
  }
23
23
  }