pawa-ssr 1.3.10 → 1.3.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/index.js CHANGED
@@ -783,8 +783,9 @@ const textContentHandler = async(el) => {
783
783
  const nodesMap = new Map();
784
784
  const currentHtmlString = el.outerHTML;
785
785
  el.setAttribute('c-t',true)
786
+ const newString=el.innerHTML.replace('-','(//)')
786
787
  const document = el.ownerDocument
787
- const comment=document.createComment(`textEvaluator-${el.innerHTML}`)
788
+ const comment=document.createComment(`textEvaluator-${newString}`)
788
789
  el.appendChild(comment)
789
790
  // Get all text nodes and store their original content
790
791
  const textNodes = Array.from(el.childNodes).filter(node => node.nodeType === 3);
@@ -889,7 +890,7 @@ const attributeHandler =async (el, attr) => {
889
890
  partlyPawajsDirective.add(v)
890
891
  })
891
892
  }
892
- addToPartlyDirective('else','else-if','case','default')
893
+ addToPartlyDirective('else','else-if','case','s-default')
893
894
  const checkIfRemove=(el)=>{
894
895
  for (const v of partlyPawajsDirective) {
895
896
  if(el.hasAttribute(v)) return true
@@ -1017,11 +1018,14 @@ export const render =async (el, contexts = {},stream) => {
1017
1018
  }
1018
1019
  if (el._componentName) {
1019
1020
  if(el._lazy && lazyComponents.has(el.tagName)){
1020
- const lazyComponent=lazyComponents.has(el.tagName)
1021
+ const lazyComponent=lazyComponents.get(el.tagName)
1021
1022
  const {name,component} =lazyComponent()
1022
- components.set(name,component)
1023
- el._component.component=component
1024
- lazyComponents.delete(el.tagName)
1023
+ const compo=await component()
1024
+ if(compo[name]){
1025
+ components.set(name,compo[name])
1026
+ el._component.component=compo[name]
1027
+ lazyComponents.delete(el.tagName)
1028
+ }
1025
1029
  }
1026
1030
  if(isStream){
1027
1031
  await streamingComponent(el,stream)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pawa-ssr",
3
- "version": "1.3.10",
3
+ "version": "1.3.11",
4
4
  "type":"module",
5
5
  "description": "pawajs ssr libary",
6
6
  "main": "index.js",
@@ -25,6 +25,6 @@
25
25
  "homepage": "https://github.com/Allisboy/pawajs-ssr#readme",
26
26
  "dependencies": {
27
27
  "linkedom": "^0.18.11",
28
- "pawajs": "^1.4.35"
28
+ "pawajs": "^1.4.36"
29
29
  }
30
30
  }
package/pawaElement.js CHANGED
@@ -79,7 +79,7 @@ class PawaElement {
79
79
  })
80
80
  }
81
81
  checkLazy(){
82
- if (lazyComponents.has(this._el.tagName)) {
82
+ if (lazyComponents.has(splitAndAdd(this._el.tagName))) {
83
83
  this._lazy=true
84
84
  }
85
85
  }
package/power.js CHANGED
@@ -126,8 +126,8 @@ export const Switch = async(el, attr,stream) => {
126
126
  const getChained = (sibling) => {
127
127
  while (sibling) {
128
128
  const next = sibling.nextElementSibling;
129
- const isCase = sibling.hasAttribute('case');
130
- const isDefault = sibling.hasAttribute('default');
129
+ const isCase = sibling.hasAttribute('case') && !sibling.hasAttribute('switch');
130
+ const isDefault = sibling.hasAttribute('s-default');
131
131
 
132
132
  if (isCase) {
133
133
  const exp = sibling.getAttribute('case');
package/utils.js CHANGED
@@ -187,7 +187,12 @@ export const convertToNumber=(str)=>{
187
187
  return hash
188
188
  };
189
189
  export const ComponentProps=(somes,message,name)=>{
190
- let some=somes?.() || somes
190
+ let some
191
+ if (typeof somes === 'function') {
192
+ some=somes()
193
+ }else{
194
+ some=somes
195
+ }
191
196
  return({
192
197
  Array:()=>{
193
198