pawajs 1.4.35 → 1.4.36
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 +16 -1
- package/package.json +1 -1
- package/pawaElement.js +2 -2
- package/power.js +1 -1
- package/utils.js +6 -1
package/index.js
CHANGED
|
@@ -320,6 +320,7 @@ RegisterComponent.lazy=async(...args)=>{
|
|
|
320
320
|
if (components.has(name.toUpperCase())) return
|
|
321
321
|
if (typeof name === 'string' && typeof component === 'function') {
|
|
322
322
|
if (isServer()) {
|
|
323
|
+
lazyComponents.set(name.toUpperCase(), {name,component});
|
|
323
324
|
const compo=await component()
|
|
324
325
|
if (compo[name]) {
|
|
325
326
|
components.set(name.toUpperCase(),compo[name])
|
|
@@ -602,6 +603,20 @@ export const useInsert = (obj = {}) => {
|
|
|
602
603
|
}
|
|
603
604
|
}
|
|
604
605
|
const createDeepProxy = (target, callback) => {
|
|
606
|
+
// Skip proxies for DOM objects and native objects that don't work well with proxies
|
|
607
|
+
if (target instanceof FileList) return target
|
|
608
|
+
if (target instanceof File) return target
|
|
609
|
+
if (target instanceof Blob) return target
|
|
610
|
+
if (target instanceof FormData) return target
|
|
611
|
+
if (target instanceof Date) return target
|
|
612
|
+
if (target instanceof RegExp) return target
|
|
613
|
+
|
|
614
|
+
// Also skip if it's already a proxy
|
|
615
|
+
if (target && target._isPawaProxy) return target
|
|
616
|
+
|
|
617
|
+
// Also skip if it's a DOM element
|
|
618
|
+
if (target && target.nodeType && typeof target === 'object') return target
|
|
619
|
+
|
|
605
620
|
return new Proxy(target, {
|
|
606
621
|
get(target, property) {
|
|
607
622
|
const value = target[property];
|
|
@@ -1067,7 +1082,7 @@ const directives = {
|
|
|
1067
1082
|
'for-each': For,
|
|
1068
1083
|
else:(el)=>{el._running =true},
|
|
1069
1084
|
case:(el)=>{el._running =true},
|
|
1070
|
-
default:(el)=>{el._running =true},
|
|
1085
|
+
"s-default":(el)=>{el._running =true},
|
|
1071
1086
|
'else-if':(el)=>{el._running =true},
|
|
1072
1087
|
mount: mountElement,
|
|
1073
1088
|
unmount: unMountElement,
|
package/package.json
CHANGED
package/pawaElement.js
CHANGED
|
@@ -51,9 +51,9 @@ export class PawaElement {
|
|
|
51
51
|
return Array.from(this._el.children)
|
|
52
52
|
}
|
|
53
53
|
checkLazy(){
|
|
54
|
-
if (lazyComponents.has(this._el.tagName)) {
|
|
54
|
+
if (lazyComponents.has(splitAndAdd(this._el.tagName))) {
|
|
55
55
|
this._lazy=true
|
|
56
|
-
if (!lazyComponentElement.has(this._el.tagName)) {
|
|
56
|
+
if (!lazyComponentElement.has(splitAndAdd(this._el.tagName))) {
|
|
57
57
|
createIntersectionObserver(this._el)
|
|
58
58
|
}
|
|
59
59
|
}
|
package/power.js
CHANGED
|
@@ -222,7 +222,7 @@ export const Switch = (el, attr, stateContext,resume=false,notRender,stopResume)
|
|
|
222
222
|
chainMap.set(nextSibling.getAttribute('case'),{condition:'case',element:nextSibling})
|
|
223
223
|
getChained(nextSibling.nextElementSibling)
|
|
224
224
|
nextSibling.remove()
|
|
225
|
-
}else if (nextSibling.getAttribute('default') === '') {
|
|
225
|
+
}else if (nextSibling.getAttribute('s-default') === '') {
|
|
226
226
|
chained.push({
|
|
227
227
|
exp:'false',
|
|
228
228
|
condition:'default',
|
package/utils.js
CHANGED
|
@@ -176,7 +176,12 @@ export const sanitizeTemplate = (temp) => {
|
|
|
176
176
|
};
|
|
177
177
|
|
|
178
178
|
export const ComponentProps=(somes,message,name,key)=>{
|
|
179
|
-
let some
|
|
179
|
+
let some
|
|
180
|
+
if (typeof somes === 'function') {
|
|
181
|
+
some=somes()
|
|
182
|
+
}else{
|
|
183
|
+
some=somes
|
|
184
|
+
}
|
|
180
185
|
return({
|
|
181
186
|
Array:()=>{
|
|
182
187
|
|