lupine.web 1.0.19 → 1.0.20
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/package.json
CHANGED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { RefProps } from '../jsx';
|
|
2
|
+
import { mountComponents } from './mount-components';
|
|
3
|
+
|
|
4
|
+
export class ComponentFactory {
|
|
5
|
+
private static _session: Map<Function, { [key: string]: any }> = new Map<Function, { [key: string]: any }>();
|
|
6
|
+
|
|
7
|
+
static getSession(fn: Function) {
|
|
8
|
+
let ret = this._session.get(fn);
|
|
9
|
+
if (!ret) {
|
|
10
|
+
ret = {};
|
|
11
|
+
this._session.set(fn, ret);
|
|
12
|
+
}
|
|
13
|
+
return ret;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
static async refresh(fn: Function, props: any, ref: RefProps) {
|
|
17
|
+
mountComponents(ref.current!, await fn(props));
|
|
18
|
+
}
|
|
19
|
+
}
|
package/src/core/index.ts
CHANGED
|
@@ -5,6 +5,7 @@ export * from './bind-meta';
|
|
|
5
5
|
export * from './bind-ref';
|
|
6
6
|
export * from './bind-styles';
|
|
7
7
|
export * from './bind-theme';
|
|
8
|
+
export * from './component-factory';
|
|
8
9
|
export * from './export-lupine';
|
|
9
10
|
export * from './camel-to-hyphens';
|
|
10
11
|
export * from './mount-components';
|
|
@@ -10,7 +10,7 @@ export const callPageLoadedEvent = () => {
|
|
|
10
10
|
});
|
|
11
11
|
};
|
|
12
12
|
|
|
13
|
-
// The fn is called when the page is
|
|
13
|
+
// The fn is called when the page is first time loaded
|
|
14
14
|
export const bindPageLoadedEvent = (fn: Function) => {
|
|
15
15
|
_pageLoadedEvents.push(fn);
|
|
16
16
|
};
|
package/src/jsx.ts
CHANGED
|
@@ -25,8 +25,6 @@ export type RefProps = {
|
|
|
25
25
|
onUnload?: (el: Element) => Promise<void>;
|
|
26
26
|
$?: any; // (selector: string) => undefined | Element,
|
|
27
27
|
$all?: any; // (selector: string) => undefined | Element,
|
|
28
|
-
// refresh?: () => void;
|
|
29
|
-
// props?: any;
|
|
30
28
|
};
|
|
31
29
|
|
|
32
30
|
export interface ClassAttributes<T> extends Attributes {
|
package/src/models/json-props.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export type JsonKeyValue = {
|
|
2
|
-
[key: string]: string | number | boolean | null | undefined | JsonKeyValue | JsonKeyValue[];
|
|
2
|
+
[key: string]: string | number | boolean | null | undefined | string[] | number[] | JsonKeyValue | JsonKeyValue[];
|
|
3
3
|
};
|
|
4
4
|
export type JsonObject =
|
|
5
5
|
| JsonKeyValue[]
|
|
6
6
|
| {
|
|
7
|
-
[key: string]: string | number | boolean | null | undefined | JsonKeyValue | JsonKeyValue[];
|
|
7
|
+
[key: string]: string | number | boolean | null | undefined | string[] | number[] | JsonKeyValue | JsonKeyValue[];
|
|
8
8
|
};
|