@xanui/core 1.1.24 → 1.1.26
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/AppRoot/Renderar.d.ts +3 -1
- package/AppRoot/Renderar.js +20 -10
- package/AppRoot/Renderar.js.map +1 -1
- package/AppRoot/Renderar.mjs +20 -10
- package/AppRoot/Renderar.mjs.map +1 -1
- package/package.json +1 -1
package/AppRoot/Renderar.d.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import React__default from 'react';
|
|
2
2
|
|
|
3
3
|
declare class Renderar {
|
|
4
|
-
static render(component: React__default.FunctionComponent): {
|
|
4
|
+
static render(component: React__default.FunctionComponent, props?: any): {
|
|
5
5
|
unrender: () => void;
|
|
6
|
+
updateProps: (newProps: any) => void;
|
|
6
7
|
};
|
|
7
8
|
static unrender(component: React__default.FunctionComponent): void;
|
|
9
|
+
static updateProps(component: React__default.FunctionComponent, props: any): void;
|
|
8
10
|
}
|
|
9
11
|
|
|
10
12
|
export { Renderar };
|
package/AppRoot/Renderar.js
CHANGED
|
@@ -1,35 +1,45 @@
|
|
|
1
1
|
'use strict';Object.defineProperty(exports,'__esModule',{value:true});var jsxRuntime=require('react/jsx-runtime'),React=require('react');const Components = [];
|
|
2
|
-
let dispatch;
|
|
2
|
+
let dispatch = null;
|
|
3
3
|
class Renderar {
|
|
4
|
-
static render(component) {
|
|
5
|
-
Components.push(component);
|
|
4
|
+
static render(component, props) {
|
|
5
|
+
Components.push({ component, props });
|
|
6
6
|
if (dispatch) {
|
|
7
7
|
dispatch();
|
|
8
8
|
}
|
|
9
9
|
return {
|
|
10
10
|
unrender: () => {
|
|
11
11
|
this.unrender(component);
|
|
12
|
+
},
|
|
13
|
+
updateProps: (newProps) => {
|
|
14
|
+
this.updateProps(component, newProps);
|
|
12
15
|
}
|
|
13
16
|
};
|
|
14
17
|
}
|
|
15
18
|
static unrender(component) {
|
|
16
|
-
const index = Components.
|
|
19
|
+
const index = Components.findIndex((c) => c.component === component);
|
|
17
20
|
if (index > -1) {
|
|
18
21
|
Components.splice(index, 1);
|
|
19
|
-
if (dispatch)
|
|
22
|
+
if (dispatch)
|
|
20
23
|
dispatch();
|
|
21
|
-
}
|
|
22
24
|
}
|
|
23
25
|
}
|
|
26
|
+
static updateProps(component, props) {
|
|
27
|
+
const storedComponent = Components.find((c) => c.component === component);
|
|
28
|
+
if (storedComponent) {
|
|
29
|
+
storedComponent.props = Object.assign(Object.assign({}, storedComponent.props), props);
|
|
30
|
+
}
|
|
31
|
+
if (dispatch)
|
|
32
|
+
dispatch();
|
|
33
|
+
}
|
|
24
34
|
}
|
|
25
35
|
const RenderRenderar = () => {
|
|
26
|
-
const [
|
|
36
|
+
const [, setState] = React.useState(0);
|
|
27
37
|
if (!dispatch) {
|
|
28
38
|
dispatch = () => {
|
|
29
|
-
setState(prev => prev + 1);
|
|
39
|
+
setState((prev) => prev + 1);
|
|
30
40
|
};
|
|
31
41
|
}
|
|
32
|
-
return Components.map((Component, index) => {
|
|
33
|
-
return jsxRuntime.jsx(Component, {}, index);
|
|
42
|
+
return Components.map(({ component: Component, props }, index) => {
|
|
43
|
+
return jsxRuntime.jsx(Component, Object.assign({}, props), index);
|
|
34
44
|
});
|
|
35
45
|
};exports.RenderRenderar=RenderRenderar;exports.Renderar=Renderar;//# sourceMappingURL=Renderar.js.map
|
package/AppRoot/Renderar.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Renderar.js","sources":["../../src/AppRoot/Renderar.tsx"],"sourcesContent":["import React, { ReactElement } from \"react\";\n\
|
|
1
|
+
{"version":3,"file":"Renderar.js","sources":["../../src/AppRoot/Renderar.tsx"],"sourcesContent":["import React, { ReactElement } from \"react\";\n\ntype StoredComponent = {\n component: React.FunctionComponent<any>;\n props: any;\n};\n\nconst Components: StoredComponent[] = [];\nlet dispatch: (() => void) | null = null;\n\nexport class Renderar {\n static render(component: React.FunctionComponent, props?: any) {\n Components.push({ component, props });\n\n if (dispatch) {\n dispatch();\n }\n\n return {\n unrender: () => {\n this.unrender(component);\n },\n updateProps: (newProps: any) => {\n this.updateProps(component, newProps);\n }\n };\n }\n\n static unrender(component: React.FunctionComponent) {\n const index = Components.findIndex((c) => c.component === component);\n if (index > -1) {\n Components.splice(index, 1);\n if (dispatch) dispatch();\n }\n }\n\n static updateProps(component: React.FunctionComponent, props: any) {\n const storedComponent = Components.find((c) => c.component === component);\n if (storedComponent) {\n storedComponent.props = { ...storedComponent.props, ...props };\n }\n if (dispatch) dispatch();\n }\n}\n\nexport const RenderRenderar = () => {\n const [, setState] = React.useState(0);\n\n if (!dispatch) {\n dispatch = () => {\n setState((prev) => prev + 1);\n };\n }\n\n return Components.map(({ component: Component, props }, index): ReactElement => {\n return <Component key={index} {...props} />;\n });\n};\n"],"names":["_jsx"],"mappings":"yIAOA,MAAM,UAAU,GAAsB,EAAE;AACxC,IAAI,QAAQ,GAAwB,IAAI;MAE3B,QAAQ,CAAA;AAClB,IAAA,OAAO,MAAM,CAAC,SAAkC,EAAE,KAAW,EAAA;QAC1D,UAAU,CAAC,IAAI,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;QAErC,IAAI,QAAQ,EAAE;AACX,YAAA,QAAQ,EAAE;QACb;QAEA,OAAO;YACJ,QAAQ,EAAE,MAAK;AACZ,gBAAA,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC;YAC3B,CAAC;AACD,YAAA,WAAW,EAAE,CAAC,QAAa,KAAI;AAC5B,gBAAA,IAAI,CAAC,WAAW,CAAC,SAAS,EAAE,QAAQ,CAAC;YACxC;SACF;IACJ;IAEA,OAAO,QAAQ,CAAC,SAAkC,EAAA;AAC/C,QAAA,MAAM,KAAK,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,SAAS,KAAK,SAAS,CAAC;AACpE,QAAA,IAAI,KAAK,GAAG,EAAE,EAAE;AACb,YAAA,UAAU,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC;AAC3B,YAAA,IAAI,QAAQ;AAAE,gBAAA,QAAQ,EAAE;QAC3B;IACH;AAEA,IAAA,OAAO,WAAW,CAAC,SAAkC,EAAE,KAAU,EAAA;AAC9D,QAAA,MAAM,eAAe,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,SAAS,KAAK,SAAS,CAAC;QACzE,IAAI,eAAe,EAAE;YAClB,eAAe,CAAC,KAAK,GAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,EAAA,EAAQ,eAAe,CAAC,KAAK,CAAA,EAAK,KAAK,CAAE;QACjE;AACA,QAAA,IAAI,QAAQ;AAAE,YAAA,QAAQ,EAAE;IAC3B;AACF;AAEM,MAAM,cAAc,GAAG,MAAK;IAChC,MAAM,GAAG,QAAQ,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC;IAEtC,IAAI,CAAC,QAAQ,EAAE;QACZ,QAAQ,GAAG,MAAK;YACb,QAAQ,CAAC,CAAC,IAAI,KAAK,IAAI,GAAG,CAAC,CAAC;AAC/B,QAAA,CAAC;IACJ;AAEA,IAAA,OAAO,UAAU,CAAC,GAAG,CAAC,CAAC,EAAE,SAAS,EAAE,SAAS,EAAE,KAAK,EAAE,EAAE,KAAK,KAAkB;AAC5E,QAAA,OAAOA,eAAC,SAAS,EAAA,MAAA,CAAA,MAAA,CAAA,EAAA,EAAiB,KAAK,CAAA,EAAhB,KAAK,CAAe;AAC9C,IAAA,CAAC,CAAC;AACL"}
|
package/AppRoot/Renderar.mjs
CHANGED
|
@@ -1,35 +1,45 @@
|
|
|
1
1
|
import {jsx}from'react/jsx-runtime';import React__default from'react';const Components = [];
|
|
2
|
-
let dispatch;
|
|
2
|
+
let dispatch = null;
|
|
3
3
|
class Renderar {
|
|
4
|
-
static render(component) {
|
|
5
|
-
Components.push(component);
|
|
4
|
+
static render(component, props) {
|
|
5
|
+
Components.push({ component, props });
|
|
6
6
|
if (dispatch) {
|
|
7
7
|
dispatch();
|
|
8
8
|
}
|
|
9
9
|
return {
|
|
10
10
|
unrender: () => {
|
|
11
11
|
this.unrender(component);
|
|
12
|
+
},
|
|
13
|
+
updateProps: (newProps) => {
|
|
14
|
+
this.updateProps(component, newProps);
|
|
12
15
|
}
|
|
13
16
|
};
|
|
14
17
|
}
|
|
15
18
|
static unrender(component) {
|
|
16
|
-
const index = Components.
|
|
19
|
+
const index = Components.findIndex((c) => c.component === component);
|
|
17
20
|
if (index > -1) {
|
|
18
21
|
Components.splice(index, 1);
|
|
19
|
-
if (dispatch)
|
|
22
|
+
if (dispatch)
|
|
20
23
|
dispatch();
|
|
21
|
-
}
|
|
22
24
|
}
|
|
23
25
|
}
|
|
26
|
+
static updateProps(component, props) {
|
|
27
|
+
const storedComponent = Components.find((c) => c.component === component);
|
|
28
|
+
if (storedComponent) {
|
|
29
|
+
storedComponent.props = Object.assign(Object.assign({}, storedComponent.props), props);
|
|
30
|
+
}
|
|
31
|
+
if (dispatch)
|
|
32
|
+
dispatch();
|
|
33
|
+
}
|
|
24
34
|
}
|
|
25
35
|
const RenderRenderar = () => {
|
|
26
|
-
const [
|
|
36
|
+
const [, setState] = React__default.useState(0);
|
|
27
37
|
if (!dispatch) {
|
|
28
38
|
dispatch = () => {
|
|
29
|
-
setState(prev => prev + 1);
|
|
39
|
+
setState((prev) => prev + 1);
|
|
30
40
|
};
|
|
31
41
|
}
|
|
32
|
-
return Components.map((Component, index) => {
|
|
33
|
-
return jsx(Component, {}, index);
|
|
42
|
+
return Components.map(({ component: Component, props }, index) => {
|
|
43
|
+
return jsx(Component, Object.assign({}, props), index);
|
|
34
44
|
});
|
|
35
45
|
};export{RenderRenderar,Renderar};//# sourceMappingURL=Renderar.mjs.map
|
package/AppRoot/Renderar.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Renderar.mjs","sources":["../../src/AppRoot/Renderar.tsx"],"sourcesContent":["import React, { ReactElement } from \"react\";\n\
|
|
1
|
+
{"version":3,"file":"Renderar.mjs","sources":["../../src/AppRoot/Renderar.tsx"],"sourcesContent":["import React, { ReactElement } from \"react\";\n\ntype StoredComponent = {\n component: React.FunctionComponent<any>;\n props: any;\n};\n\nconst Components: StoredComponent[] = [];\nlet dispatch: (() => void) | null = null;\n\nexport class Renderar {\n static render(component: React.FunctionComponent, props?: any) {\n Components.push({ component, props });\n\n if (dispatch) {\n dispatch();\n }\n\n return {\n unrender: () => {\n this.unrender(component);\n },\n updateProps: (newProps: any) => {\n this.updateProps(component, newProps);\n }\n };\n }\n\n static unrender(component: React.FunctionComponent) {\n const index = Components.findIndex((c) => c.component === component);\n if (index > -1) {\n Components.splice(index, 1);\n if (dispatch) dispatch();\n }\n }\n\n static updateProps(component: React.FunctionComponent, props: any) {\n const storedComponent = Components.find((c) => c.component === component);\n if (storedComponent) {\n storedComponent.props = { ...storedComponent.props, ...props };\n }\n if (dispatch) dispatch();\n }\n}\n\nexport const RenderRenderar = () => {\n const [, setState] = React.useState(0);\n\n if (!dispatch) {\n dispatch = () => {\n setState((prev) => prev + 1);\n };\n }\n\n return Components.map(({ component: Component, props }, index): ReactElement => {\n return <Component key={index} {...props} />;\n });\n};\n"],"names":["React","_jsx"],"mappings":"sEAOA,MAAM,UAAU,GAAsB,EAAE;AACxC,IAAI,QAAQ,GAAwB,IAAI;MAE3B,QAAQ,CAAA;AAClB,IAAA,OAAO,MAAM,CAAC,SAAkC,EAAE,KAAW,EAAA;QAC1D,UAAU,CAAC,IAAI,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;QAErC,IAAI,QAAQ,EAAE;AACX,YAAA,QAAQ,EAAE;QACb;QAEA,OAAO;YACJ,QAAQ,EAAE,MAAK;AACZ,gBAAA,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC;YAC3B,CAAC;AACD,YAAA,WAAW,EAAE,CAAC,QAAa,KAAI;AAC5B,gBAAA,IAAI,C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