@zessjs/compiler 1.1.1 → 1.1.3

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/README.md CHANGED
@@ -120,7 +120,7 @@ const element = <div class="container">Hello World</div>
120
120
  const element = (() => {
121
121
  const _el$ = _$createElement('div')
122
122
  _$setAttribute(_el$, 'class', 'container')
123
- _el$.append('Hello World')
123
+ _el$.textContent = 'Hello World'
124
124
  return _el$
125
125
  })()
126
126
  ```
@@ -180,12 +180,12 @@ const fragment = (
180
180
  const fragment = [
181
181
  (() => {
182
182
  const _el$ = _$createElement('span')
183
- _el$.append('First item')
183
+ _el$.textContent = 'First item'
184
184
  return _el$
185
185
  })(),
186
186
  (() => {
187
187
  const _el$2 = _$createElement('span')
188
- _el$2.append('Second item')
188
+ _el$2.textContent = 'Second item'
189
189
  return _el$2
190
190
  })(),
191
191
  ]
@@ -269,12 +269,12 @@ const conditional = (() => {
269
269
  isVisible
270
270
  ? (() => {
271
271
  const _el$2 = _$createElement('span')
272
- _el$2.append('Visible')
272
+ _el$2.textContent = 'Visible'
273
273
  return _el$2
274
274
  })()
275
275
  : (() => {
276
276
  const _el$3 = _$createElement('span')
277
- _el$3.append('Hidden')
277
+ _el$3.textContent = 'Hidden'
278
278
  return _el$3
279
279
  })(),
280
280
  )
@@ -296,7 +296,7 @@ const withClass = <div class={isActive ? 'active' : 'inactive'}>Status</div>
296
296
  const withClass = (() => {
297
297
  const _el$ = _$createElement('div')
298
298
  _$setAttribute(_el$, 'class', isActive ? 'active' : 'inactive')
299
- _el$.append('Status')
299
+ _el$.textContent = 'Status'
300
300
  return _el$
301
301
  })()
302
302
  ```
@@ -320,7 +320,7 @@ const withStyle = (() => {
320
320
  color: 'red',
321
321
  fontSize: '16px',
322
322
  })
323
- _el$.append('Styled Text')
323
+ _el$.textContent = 'Styled Text'
324
324
  return _el$
325
325
  })()
326
326
  ```
@@ -359,7 +359,7 @@ const dynamicAttrs = (() => {
359
359
  ['data-id']: undefined,
360
360
  },
361
361
  )
362
- _el$.append('Dynamic')
362
+ _el$.textContent = 'Dynamic'
363
363
  return _el$
364
364
  })()
365
365
  ```
@@ -383,7 +383,7 @@ const withEvents = (() => {
383
383
  const _el$ = _$createElement('button')
384
384
  _el$.onclick = handleClick
385
385
  _el$.$$mouseenter = handleMouseEnter
386
- _el$.append('Click Me')
386
+ _el$.textContent = 'Click Me'
387
387
  return _el$
388
388
  })()
389
389
  ```
@@ -415,7 +415,7 @@ const withRefs = [
415
415
  const _el$2 = _$createElement('div')
416
416
  const _ref$ = myDiv
417
417
  typeof _ref$ === 'function' ? _$use(_ref$, _el$2) : (myDiv = _el$2)
418
- _el$2.append('Ref Element')
418
+ _el$2.textContent = 'Ref Element'
419
419
  return _el$2
420
420
  })(),
421
421
  ]
package/dist/compiler.cjs CHANGED
@@ -1015,7 +1015,7 @@ function transformChildren(children, id) {
1015
1015
  }
1016
1016
  }
1017
1017
  if (textContent) elements.push(createLiteral(decodeText(textContent), textPosition));
1018
- if (elements.length) stmts.push(createExpressionStatement(createCallExpression(createMemberExpression(id, createIdentifier("append", elementsPosition), false, elementsPosition), elements, elementsPosition), elementsPosition));
1018
+ if (elements.length) stmts.push(createExpressionStatement(!stmts.length && elements.length === 1 && textContent ? createAssignmentExpression(createMemberExpression(id, createIdentifier("textContent", elementsPosition), false, elementsPosition), elements[0], elementsPosition) : createCallExpression(createMemberExpression(id, createIdentifier("append", elementsPosition), false, elementsPosition), elements, elementsPosition), elementsPosition));
1019
1019
  return stmts;
1020
1020
  }
1021
1021
  function transformProperties(attrs, children, position) {
package/dist/compiler.js CHANGED
@@ -987,7 +987,7 @@ function transformChildren(children, id) {
987
987
  }
988
988
  }
989
989
  if (textContent) elements.push(createLiteral(decodeText(textContent), textPosition));
990
- if (elements.length) stmts.push(createExpressionStatement(createCallExpression(createMemberExpression(id, createIdentifier("append", elementsPosition), false, elementsPosition), elements, elementsPosition), elementsPosition));
990
+ if (elements.length) stmts.push(createExpressionStatement(!stmts.length && elements.length === 1 && textContent ? createAssignmentExpression(createMemberExpression(id, createIdentifier("textContent", elementsPosition), false, elementsPosition), elements[0], elementsPosition) : createCallExpression(createMemberExpression(id, createIdentifier("append", elementsPosition), false, elementsPosition), elements, elementsPosition), elementsPosition));
991
991
  return stmts;
992
992
  }
993
993
  function transformProperties(attrs, children, position) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zessjs/compiler",
3
- "version": "1.1.1",
3
+ "version": "1.1.3",
4
4
  "description": "Zess JSX compiler 💥 Delivers efficient code conversion for super - responsive web experiences.",
5
5
  "type": "module",
6
6
  "keywords": [