@erickxavier/no-js 1.1.0 → 1.2.0
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 +2 -2
- package/dist/cjs/no.js +44 -5
- package/dist/cjs/no.js.map +4 -4
- package/dist/esm/no.js +44 -5
- package/dist/esm/no.js.map +4 -4
- package/dist/iife/no.js +44 -5
- package/dist/iife/no.js.map +4 -4
- package/package.json +1 -1
- package/src/animations.js +12 -9
- package/src/context.js +14 -1
- package/src/directives/binding.js +1 -1
- package/src/directives/conditionals.js +4 -4
- package/src/directives/dnd.js +1150 -0
- package/src/directives/events.js +2 -1
- package/src/directives/http.js +14 -11
- package/src/directives/i18n.js +5 -1
- package/src/directives/loops.js +21 -3
- package/src/directives/refs.js +4 -0
- package/src/directives/state.js +3 -3
- package/src/directives/styling.js +10 -7
- package/src/evaluate.js +9 -3
- package/src/i18n.js +3 -2
- package/src/index.js +2 -1
- package/src/router.js +3 -0
package/package.json
CHANGED
package/src/animations.js
CHANGED
|
@@ -77,15 +77,15 @@ export function _animateOut(el, animName, transitionName, callback, durationMs)
|
|
|
77
77
|
const target = el.firstElementChild || el;
|
|
78
78
|
target.classList.add(animName);
|
|
79
79
|
if (durationMs) target.style.animationDuration = durationMs + "ms";
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
()
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
);
|
|
88
|
-
setTimeout(
|
|
80
|
+
let called = false;
|
|
81
|
+
const done = () => {
|
|
82
|
+
if (called) return;
|
|
83
|
+
called = true;
|
|
84
|
+
target.classList.remove(animName);
|
|
85
|
+
callback();
|
|
86
|
+
};
|
|
87
|
+
target.addEventListener("animationend", done, { once: true });
|
|
88
|
+
setTimeout(done, fallback); // Fallback
|
|
89
89
|
return;
|
|
90
90
|
}
|
|
91
91
|
if (transitionName) {
|
|
@@ -97,7 +97,10 @@ export function _animateOut(el, animName, transitionName, callback, durationMs)
|
|
|
97
97
|
requestAnimationFrame(() => {
|
|
98
98
|
target.classList.remove(transitionName + "-leave");
|
|
99
99
|
target.classList.add(transitionName + "-leave-to");
|
|
100
|
+
let called = false;
|
|
100
101
|
const done = () => {
|
|
102
|
+
if (called) return;
|
|
103
|
+
called = true;
|
|
101
104
|
target.classList.remove(
|
|
102
105
|
transitionName + "-leave-active",
|
|
103
106
|
transitionName + "-leave-to",
|
package/src/context.js
CHANGED
|
@@ -64,7 +64,20 @@ export function createContext(data = {}, parent = null) {
|
|
|
64
64
|
if (key === "$notify") return notify;
|
|
65
65
|
if (key === "$set")
|
|
66
66
|
return (k, v) => {
|
|
67
|
-
|
|
67
|
+
const parts = k.split(".");
|
|
68
|
+
if (parts.length === 1) {
|
|
69
|
+
proxy[k] = v;
|
|
70
|
+
} else {
|
|
71
|
+
let obj = proxy;
|
|
72
|
+
for (let i = 0; i < parts.length - 1; i++) {
|
|
73
|
+
obj = obj[parts[i]];
|
|
74
|
+
if (obj == null) return;
|
|
75
|
+
}
|
|
76
|
+
const lastKey = parts[parts.length - 1];
|
|
77
|
+
const old = obj[lastKey];
|
|
78
|
+
obj[lastKey] = v;
|
|
79
|
+
if (old !== v) notify();
|
|
80
|
+
}
|
|
68
81
|
};
|
|
69
82
|
if (key === "$parent") return parent;
|
|
70
83
|
if (key === "$refs") return _refs;
|
|
@@ -71,7 +71,7 @@ registerDirective("if", {
|
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
-
ctx
|
|
74
|
+
_watchExpr(expr, ctx, update);
|
|
75
75
|
update();
|
|
76
76
|
},
|
|
77
77
|
});
|
|
@@ -120,7 +120,7 @@ registerDirective("else-if", {
|
|
|
120
120
|
el.innerHTML = "";
|
|
121
121
|
}
|
|
122
122
|
}
|
|
123
|
-
ctx
|
|
123
|
+
_watchExpr(expr, ctx, update);
|
|
124
124
|
update();
|
|
125
125
|
},
|
|
126
126
|
});
|
|
@@ -166,7 +166,7 @@ registerDirective("else", {
|
|
|
166
166
|
_clearDeclared(el);
|
|
167
167
|
processTree(el);
|
|
168
168
|
}
|
|
169
|
-
ctx
|
|
169
|
+
_watchExpr("", ctx, update);
|
|
170
170
|
update();
|
|
171
171
|
},
|
|
172
172
|
});
|
|
@@ -282,7 +282,7 @@ registerDirective("switch", {
|
|
|
282
282
|
}
|
|
283
283
|
}
|
|
284
284
|
|
|
285
|
-
ctx
|
|
285
|
+
_watchExpr(expr, ctx, update);
|
|
286
286
|
update();
|
|
287
287
|
},
|
|
288
288
|
});
|