cradova 3.7.8 → 3.7.10
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/dist/index.js +17 -5
- package/dist/primitives/functions.d.ts +2 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -207,6 +207,15 @@ var toFunc = (func) => {
|
|
|
207
207
|
func.pipes = new Map;
|
|
208
208
|
return funcManager.render(func);
|
|
209
209
|
};
|
|
210
|
+
var toFuncNoRender = (func) => {
|
|
211
|
+
if (typeof func._state_index === "number")
|
|
212
|
+
return func;
|
|
213
|
+
Object.assign(func, DEFAULT_STATE);
|
|
214
|
+
func._state = [];
|
|
215
|
+
func.signals = new Map;
|
|
216
|
+
func.pipes = new Map;
|
|
217
|
+
return func;
|
|
218
|
+
};
|
|
210
219
|
var funcManager = {
|
|
211
220
|
render(func) {
|
|
212
221
|
Object.assign(func, DEFAULT_STATE);
|
|
@@ -402,6 +411,12 @@ class Signal {
|
|
|
402
411
|
});
|
|
403
412
|
return;
|
|
404
413
|
}
|
|
414
|
+
if (!isArrowFunc(comp) && comp.signals) {
|
|
415
|
+
comp = toFuncNoRender(comp);
|
|
416
|
+
} else {
|
|
417
|
+
console.error(` ✘ Cradova err: ${String(comp)} is not a valid component or function`);
|
|
418
|
+
return;
|
|
419
|
+
}
|
|
405
420
|
if (comp.signals.get(eventName))
|
|
406
421
|
return;
|
|
407
422
|
if (eventName in this.pipe) {
|
|
@@ -503,11 +518,6 @@ class Page {
|
|
|
503
518
|
this._snapshot_html = this._template.outerHTML;
|
|
504
519
|
RouterBox.doc.appendChild(this._template);
|
|
505
520
|
window.CradovaEvent.dispatchEvent("after_comp_is_mounted");
|
|
506
|
-
window.scrollTo({
|
|
507
|
-
top: 0,
|
|
508
|
-
left: 0,
|
|
509
|
-
behavior: "instant"
|
|
510
|
-
});
|
|
511
521
|
if (this._snapshot)
|
|
512
522
|
this._takeSnapShot();
|
|
513
523
|
}
|
|
@@ -728,6 +738,7 @@ export {
|
|
|
728
738
|
useEffect,
|
|
729
739
|
ul,
|
|
730
740
|
tr,
|
|
741
|
+
toFuncNoRender,
|
|
731
742
|
textarea,
|
|
732
743
|
td,
|
|
733
744
|
tbody,
|
|
@@ -746,6 +757,7 @@ export {
|
|
|
746
757
|
loop,
|
|
747
758
|
li,
|
|
748
759
|
label,
|
|
760
|
+
isArrowFunc,
|
|
749
761
|
input,
|
|
750
762
|
img,
|
|
751
763
|
iframe,
|
|
@@ -60,6 +60,8 @@ Returns a mutable reference object of dom elements.
|
|
|
60
60
|
*/
|
|
61
61
|
export declare function useRef(): __raw_ref;
|
|
62
62
|
export declare const getSignal: (name: string, func: Func) => any;
|
|
63
|
+
export declare const isArrowFunc: (fn: Function) => boolean;
|
|
64
|
+
export declare const toFuncNoRender: (func: any) => any;
|
|
63
65
|
export declare const funcManager: {
|
|
64
66
|
render(func: Func): HTMLElement;
|
|
65
67
|
recall(func: Func): void;
|