vaderjs 1.9.4 → 1.9.6
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/document/index.ts +6 -3
- package/index.ts +13 -8
- package/package.json +1 -1
package/document/index.ts
CHANGED
|
@@ -3,7 +3,7 @@ export const document = (element: any) => {
|
|
|
3
3
|
let el = type === null ? `` : `<${type}`
|
|
4
4
|
let attributes = element.props;
|
|
5
5
|
let children = element.children;
|
|
6
|
-
if(type != null){
|
|
6
|
+
if(type != null && type !== false && type !== true && type !== undefined){
|
|
7
7
|
for (let key in attributes) {
|
|
8
8
|
if(key === "key"){
|
|
9
9
|
el += ` key="${attributes[key]}"`;
|
|
@@ -33,7 +33,7 @@ export const document = (element: any) => {
|
|
|
33
33
|
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
|
-
el += type === null ? `` : `>`
|
|
36
|
+
el += type === null || type == false ? `` : `>`
|
|
37
37
|
if(children === null || children === undefined){
|
|
38
38
|
return el;
|
|
39
39
|
}
|
|
@@ -45,11 +45,14 @@ export const document = (element: any) => {
|
|
|
45
45
|
});
|
|
46
46
|
}
|
|
47
47
|
if(typeof child === "function"){
|
|
48
|
-
el += document(child())
|
|
48
|
+
el += document(child())
|
|
49
49
|
}else
|
|
50
50
|
if (typeof child === "object") {
|
|
51
51
|
el += document(child);
|
|
52
52
|
}else{
|
|
53
|
+
if(child === null || child === false || child === undefined){
|
|
54
|
+
continue;
|
|
55
|
+
}
|
|
53
56
|
el += child;
|
|
54
57
|
}
|
|
55
58
|
}
|
package/index.ts
CHANGED
|
@@ -37,13 +37,15 @@ declare global {
|
|
|
37
37
|
//@ts-ignore
|
|
38
38
|
globalThis.isServer = typeof window === "undefined";
|
|
39
39
|
//@ts-ignore
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}
|
|
40
|
+
if(isServer){
|
|
41
|
+
globalThis.params = {
|
|
42
|
+
[Symbol.iterator]: function* () {
|
|
43
|
+
for (const key in this) {
|
|
44
|
+
yield [key, this[key]];
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
}
|
|
47
49
|
|
|
48
50
|
|
|
49
51
|
|
|
@@ -153,9 +155,12 @@ export const e = (element, props, ...children) => {
|
|
|
153
155
|
firstEl = { type: "div", props: { key: instance.key, ...props }, children };
|
|
154
156
|
firstEl.props = { key: instance.key, ...firstEl.props, ...props };
|
|
155
157
|
firstEl.props["idKey"] = instance.key;
|
|
156
|
-
instance.props = firstEl.props;
|
|
158
|
+
instance.props = firstEl.props;
|
|
157
159
|
return firstEl;
|
|
158
160
|
default:
|
|
161
|
+
if(!element) {
|
|
162
|
+
return "";
|
|
163
|
+
}
|
|
159
164
|
let el = { type: element, props: props || {}, children: children || [] };
|
|
160
165
|
if (el.type !== "head") {
|
|
161
166
|
el.props = { idKey: crypto.randomUUID(), ...el.props };
|