cradova 3.7.5 → 3.7.7
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.d.ts +1 -1
- package/dist/index.js +16 -25
- package/dist/primitives/classes.d.ts +0 -26
- package/dist/primitives/functions.d.ts +18 -2
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -171,33 +171,38 @@ function useEffect(effect, self) {
|
|
|
171
171
|
return;
|
|
172
172
|
CradovaEvent.after_comp_is_mounted.push(effect);
|
|
173
173
|
}
|
|
174
|
+
|
|
175
|
+
class __raw_ref {
|
|
176
|
+
tree = {};
|
|
177
|
+
bindAs(name) {
|
|
178
|
+
return [this, name];
|
|
179
|
+
}
|
|
180
|
+
elem(name) {
|
|
181
|
+
return this.tree[name];
|
|
182
|
+
}
|
|
183
|
+
_append(name, Element) {
|
|
184
|
+
this.tree[name] = Element;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
174
187
|
function useRef() {
|
|
175
188
|
return new __raw_ref;
|
|
176
189
|
}
|
|
177
190
|
var getSignal = (name, func) => {
|
|
178
191
|
return func.pipes.get(name);
|
|
179
192
|
};
|
|
180
|
-
var sendSignal = (name, data, func) => {
|
|
181
|
-
const signal = func.signals.get(name);
|
|
182
|
-
if (signal) {
|
|
183
|
-
signal.publish(name, data);
|
|
184
|
-
} else {
|
|
185
|
-
console.error(" ✘ Cradova err : Invalid signal name " + name);
|
|
186
|
-
}
|
|
187
|
-
};
|
|
188
193
|
var isArrowFunc = (fn) => !fn.hasOwnProperty("prototype");
|
|
189
194
|
var DEFAULT_STATE = {
|
|
190
195
|
rendered: false,
|
|
191
196
|
published: false,
|
|
192
197
|
preRendered: null,
|
|
193
198
|
reference: null,
|
|
194
|
-
_state_index: 0
|
|
195
|
-
_state: []
|
|
199
|
+
_state_index: 0
|
|
196
200
|
};
|
|
197
201
|
var toFunc = (func) => {
|
|
198
202
|
if (typeof func._state_index === "number")
|
|
199
203
|
return funcManager.render(func);
|
|
200
204
|
Object.assign(func, DEFAULT_STATE);
|
|
205
|
+
func._state = [];
|
|
201
206
|
func.signals = new Map;
|
|
202
207
|
func.pipes = new Map;
|
|
203
208
|
return funcManager.render(func);
|
|
@@ -205,6 +210,7 @@ var toFunc = (func) => {
|
|
|
205
210
|
var funcManager = {
|
|
206
211
|
render(func) {
|
|
207
212
|
Object.assign(func, DEFAULT_STATE);
|
|
213
|
+
func._state = [];
|
|
208
214
|
const html = func.apply(func);
|
|
209
215
|
if (html instanceof HTMLElement) {
|
|
210
216
|
func.reference = html;
|
|
@@ -708,19 +714,6 @@ class Router {
|
|
|
708
714
|
}
|
|
709
715
|
}
|
|
710
716
|
|
|
711
|
-
class __raw_ref {
|
|
712
|
-
tree = {};
|
|
713
|
-
bindAs(name) {
|
|
714
|
-
return [this, name];
|
|
715
|
-
}
|
|
716
|
-
elem(name) {
|
|
717
|
-
return this.tree[name];
|
|
718
|
-
}
|
|
719
|
-
_append(name, Element) {
|
|
720
|
-
this.tree[name] = Element;
|
|
721
|
-
}
|
|
722
|
-
}
|
|
723
|
-
|
|
724
717
|
// src/index.ts
|
|
725
718
|
Function.prototype.cloneFunc = function() {
|
|
726
719
|
const pre = this;
|
|
@@ -741,7 +734,6 @@ export {
|
|
|
741
734
|
table,
|
|
742
735
|
svg,
|
|
743
736
|
span,
|
|
744
|
-
sendSignal,
|
|
745
737
|
select,
|
|
746
738
|
section,
|
|
747
739
|
raw,
|
|
@@ -777,7 +769,6 @@ export {
|
|
|
777
769
|
button,
|
|
778
770
|
audio,
|
|
779
771
|
a,
|
|
780
|
-
__raw_ref,
|
|
781
772
|
Signal,
|
|
782
773
|
Router,
|
|
783
774
|
Page,
|
|
@@ -87,14 +87,6 @@ export declare class Signal<Type extends Record<string, any>> {
|
|
|
87
87
|
* @param template
|
|
88
88
|
*/
|
|
89
89
|
export declare class Page {
|
|
90
|
-
/**
|
|
91
|
-
* used internally
|
|
92
|
-
*/
|
|
93
|
-
private _name;
|
|
94
|
-
_html: (this: Page) => HTMLElement;
|
|
95
|
-
_template?: HTMLElement;
|
|
96
|
-
private _snapshot;
|
|
97
|
-
private _snapshot_html?;
|
|
98
90
|
constructor(pageParams: CradovaPageType);
|
|
99
91
|
private _takeSnapShot;
|
|
100
92
|
set onDeactivate(cb: () => Promise<void> | void);
|
|
@@ -167,21 +159,3 @@ export declare class Router {
|
|
|
167
159
|
static addErrorHandler(callback: (err?: unknown, pagePath?: string) => void): void;
|
|
168
160
|
static _mount(): void;
|
|
169
161
|
}
|
|
170
|
-
/**
|
|
171
|
-
* Cradova
|
|
172
|
-
* ---
|
|
173
|
-
* make reference to dom elements
|
|
174
|
-
*/
|
|
175
|
-
export declare class __raw_ref {
|
|
176
|
-
tree: Record<string, any>;
|
|
177
|
-
/**
|
|
178
|
-
* Bind a DOM element to a reference name.
|
|
179
|
-
* @param name - The name to reference the DOM element by.
|
|
180
|
-
*/
|
|
181
|
-
bindAs(name: string): __raw_ref;
|
|
182
|
-
/**
|
|
183
|
-
* Retrieve a referenced DOM element.
|
|
184
|
-
* @param name - The name of the referenced DOM element.
|
|
185
|
-
*/
|
|
186
|
-
elem<ElementType extends HTMLElement = HTMLElement>(name: string): ElementType | undefined;
|
|
187
|
-
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { Func, VJS_params_TYPE } from "./types.js";
|
|
2
|
-
import { __raw_ref } from "./classes.js";
|
|
3
2
|
export declare const makeElement: <E extends HTMLElement>(element: E & HTMLElement, ElementChildrenAndPropertyList: VJS_params_TYPE<E>) => E;
|
|
4
3
|
export declare const cra: <E extends HTMLElement>(tag: string) => (...Children_and_Properties: VJS_params_TYPE<E>) => E;
|
|
5
4
|
/**
|
|
@@ -35,6 +34,24 @@ Allows side effects to be performed in functional components, such as fetching d
|
|
|
35
34
|
* @returns
|
|
36
35
|
*/
|
|
37
36
|
export declare function useEffect(effect: () => void, self: Func): void;
|
|
37
|
+
/**
|
|
38
|
+
* Cradova
|
|
39
|
+
* ---
|
|
40
|
+
* make reference to dom elements
|
|
41
|
+
*/
|
|
42
|
+
declare class __raw_ref {
|
|
43
|
+
tree: Record<string, any>;
|
|
44
|
+
/**
|
|
45
|
+
* Bind a DOM element to a reference name.
|
|
46
|
+
* @param name - The name to reference the DOM element by.
|
|
47
|
+
*/
|
|
48
|
+
bindAs(name: string): __raw_ref;
|
|
49
|
+
/**
|
|
50
|
+
* Retrieve a referenced DOM element.
|
|
51
|
+
* @param name - The name of the referenced DOM element.
|
|
52
|
+
*/
|
|
53
|
+
elem<ElementType extends HTMLElement = HTMLElement>(name: string): ElementType | undefined;
|
|
54
|
+
}
|
|
38
55
|
/**
|
|
39
56
|
* Cradova
|
|
40
57
|
* ---
|
|
@@ -43,7 +60,6 @@ Returns a mutable reference object of dom elements.
|
|
|
43
60
|
*/
|
|
44
61
|
export declare function useRef(): __raw_ref;
|
|
45
62
|
export declare const getSignal: (name: string, func: Func) => any;
|
|
46
|
-
export declare const sendSignal: (name: string, data: any, func: Func) => void;
|
|
47
63
|
export declare const funcManager: {
|
|
48
64
|
render(func: Func): HTMLElement;
|
|
49
65
|
recall(func: Func): void;
|