@xanui/core 1.2.46 → 1.2.47

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.
@@ -59,8 +59,9 @@ const RenderRenderar = () => {
59
59
  const updateProps = Renderar.updateProps;
60
60
  Renderar.render = ((component, props) => {
61
61
  Renderar.doc = doc;
62
- render(component, props);
62
+ const r = render(component, props);
63
63
  Renderar.doc = null;
64
+ return r;
64
65
  });
65
66
  Renderar.unrender = ((component) => {
66
67
  Renderar.doc = doc;
@@ -1 +1 @@
1
- {"version":3,"file":"Renderar.cjs","sources":["../../src/AppRoot/Renderar.tsx"],"sourcesContent":["import React, { ReactElement, useMemo } from \"react\";\r\nimport { DocumentID, useDocument } from \"../Document\";\r\n\r\ntype StoredComponent = {\r\n component: React.FunctionComponent<any>;\r\n props: any;\r\n};\r\n\r\nconst State = new Map<DocumentID, StoredComponent[]>()\r\nconst Dispatch = new Map<DocumentID, Function>()\r\n\r\nexport class Renderar {\r\n static doc: any\r\n static render(component: React.FunctionComponent, props?: any) {\r\n const docid = Renderar.doc.id\r\n let components = State.get(docid) || []\r\n components.push({ component, props })\r\n State.set(Renderar.doc.id, components)\r\n const dispatch = Dispatch.get(docid)\r\n if (dispatch) {\r\n dispatch()\r\n }\r\n\r\n return {\r\n unrender: () => {\r\n this.unrender(component);\r\n },\r\n updateProps: (newProps: any) => {\r\n this.updateProps(component, newProps);\r\n }\r\n };\r\n }\r\n\r\n static unrender(component: React.FunctionComponent) {\r\n const docid = Renderar.doc.id\r\n let components = State.get(docid) || []\r\n\r\n const index = components.findIndex((c) => c.component === component);\r\n if (index > -1) {\r\n components.splice(index, 1);\r\n const dispatch = Dispatch.get(docid)\r\n if (dispatch) {\r\n dispatch()\r\n }\r\n }\r\n }\r\n\r\n static updateProps(component: React.FunctionComponent, props: any) {\r\n const docid = Renderar.doc.id\r\n let components = State.get(docid) || []\r\n\r\n const storedComponent = components.find((c) => c.component === component);\r\n if (storedComponent) {\r\n storedComponent.props = { ...storedComponent.props, ...props };\r\n }\r\n const dispatch = Dispatch.get(docid)\r\n if (dispatch) {\r\n dispatch()\r\n }\r\n }\r\n}\r\n\r\nexport const RenderRenderar = () => {\r\n const [, setState] = React.useState(0);\r\n const doc = useDocument()\r\n\r\n useMemo(() => {\r\n const render = Renderar.render\r\n const unrender = Renderar.unrender\r\n const updateProps = Renderar.updateProps\r\n Renderar.render = ((component: React.FunctionComponent, props?: any) => {\r\n Renderar.doc = doc\r\n render(component, props)\r\n Renderar.doc = null\r\n }) as any\r\n\r\n Renderar.unrender = ((component: React.FunctionComponent) => {\r\n Renderar.doc = doc\r\n unrender(component)\r\n Renderar.doc = null\r\n }) as any\r\n\r\n Renderar.updateProps = ((component: React.FunctionComponent, props: any) => {\r\n Renderar.doc = doc\r\n updateProps(component, props)\r\n Renderar.doc = null\r\n }) as any\r\n\r\n }, [doc.id])\r\n\r\n if (!Dispatch.has(doc.id)) {\r\n Dispatch.set(doc.id, () => {\r\n setState((prev) => prev + 1);\r\n })\r\n }\r\n const components = State.get(doc.id) || []\r\n\r\n return components.map(({ component: Component, props }, index): ReactElement => {\r\n return <Component key={index} {...props} />;\r\n });\r\n}\r\n"],"names":["useDocument","useMemo","_jsx"],"mappings":";;;;;;AAQA,MAAM,KAAK,GAAG,IAAI,GAAG,EAAiC;AACtD,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAwB;MAEnC,QAAQ,CAAA;AAElB,IAAA,OAAO,MAAM,CAAC,SAAkC,EAAE,KAAW,EAAA;AAC1D,QAAA,MAAM,KAAK,GAAG,QAAQ,CAAC,GAAG,CAAC,EAAE;QAC7B,IAAI,UAAU,GAAG,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,EAAE;QACvC,UAAU,CAAC,IAAI,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;QACrC,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,EAAE,UAAU,CAAC;QACtC,MA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C;IAEZ,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE;QACxB,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,EAAE,MAAK;YACvB,QAAQ,CAAC,CAAC,IAAI,KAAK,IAAI,GAAG,CAAC,CAAC;AAC/B,QAAA,CAAC,CAAC;IACL;AACA,IAAA,MAAM,UAAU,GAAG,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,EAAE;AAE1C,IAAA,OAAO,UAAU,CAAC,GAAG,CAAC,CAAC,EAAE,SAAS,EAAE,SAAS,EAAE,KAAK,EAAE,EAAE,KAAK,KAAkB;AAC5E,QAAA,OAAOC,eAAC,SAAS,EAAA,MAAA,CAAA,MAAA,CAAA,EAAA,EAAiB,KAAK,CAAA,EAAhB,KAAK,CAAe;AAC9C,IAAA,CAAC,CAAC;AACL;;;;;"}
1
+ {"version":3,"file":"Renderar.cjs","sources":["../../src/AppRoot/Renderar.tsx"],"sourcesContent":["import React, { ReactElement, useMemo } from \"react\";\r\nimport { DocumentID, useDocument } from \"../Document\";\r\n\r\ntype StoredComponent = {\r\n component: React.FunctionComponent<any>;\r\n props: any;\r\n};\r\n\r\nconst State = new Map<DocumentID, StoredComponent[]>()\r\nconst Dispatch = new Map<DocumentID, Function>()\r\n\r\nexport class Renderar {\r\n static doc: any\r\n static render(component: React.FunctionComponent, props?: any) {\r\n const docid = Renderar.doc.id\r\n let components = State.get(docid) || []\r\n components.push({ component, props })\r\n State.set(Renderar.doc.id, components)\r\n const dispatch = Dispatch.get(docid)\r\n if (dispatch) {\r\n dispatch()\r\n }\r\n\r\n return {\r\n unrender: () => {\r\n this.unrender(component);\r\n },\r\n updateProps: (newProps: any) => {\r\n this.updateProps(component, newProps);\r\n }\r\n };\r\n }\r\n\r\n static unrender(component: React.FunctionComponent) {\r\n const docid = Renderar.doc.id\r\n let components = State.get(docid) || []\r\n\r\n const index = components.findIndex((c) => c.component === component);\r\n if (index > -1) {\r\n components.splice(index, 1);\r\n const dispatch = Dispatch.get(docid)\r\n if (dispatch) {\r\n dispatch()\r\n }\r\n }\r\n }\r\n\r\n static updateProps(component: React.FunctionComponent, props: any) {\r\n const docid = Renderar.doc.id\r\n let components = State.get(docid) || []\r\n\r\n const storedComponent = components.find((c) => c.component === component);\r\n if (storedComponent) {\r\n storedComponent.props = { ...storedComponent.props, ...props };\r\n }\r\n const dispatch = Dispatch.get(docid)\r\n if (dispatch) {\r\n dispatch()\r\n }\r\n }\r\n}\r\n\r\nexport const RenderRenderar = () => {\r\n const [, setState] = React.useState(0);\r\n const doc = useDocument()\r\n\r\n useMemo(() => {\r\n const render = Renderar.render\r\n const unrender = Renderar.unrender\r\n const updateProps = Renderar.updateProps\r\n Renderar.render = ((component: React.FunctionComponent, props?: any) => {\r\n Renderar.doc = doc\r\n const r = render(component, props)\r\n Renderar.doc = null\r\n return r\r\n }) as any\r\n\r\n Renderar.unrender = ((component: React.FunctionComponent) => {\r\n Renderar.doc = doc\r\n unrender(component)\r\n Renderar.doc = null\r\n }) as any\r\n\r\n Renderar.updateProps = ((component: React.FunctionComponent, props: any) => {\r\n Renderar.doc = doc\r\n updateProps(component, props)\r\n Renderar.doc = null\r\n }) as any\r\n\r\n }, [doc.id])\r\n\r\n if (!Dispatch.has(doc.id)) {\r\n Dispatch.set(doc.id, () => {\r\n setState((prev) => prev + 1);\r\n })\r\n }\r\n const components = State.get(doc.id) || []\r\n\r\n return components.map(({ component: Component, props }, index): ReactElement => {\r\n return <Component key={index} {...props} />;\r\n });\r\n}\r\n"],"names":["useDocument","useMemo","_jsx"],"mappings":";;;;;;AAQA,MAAM,KAAK,GAAG,IAAI,GAAG,EAAiC;AACtD,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAwB;MAEnC,QAAQ,CAAA;AAElB,IAAA,OAAO,MAAM,CAAC,SAAkC,EAAE,KAAW,EAAA;AAC1D,QAAA,MAAM,KAAK,GAAG,QAAQ,CAAC,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AET,QAAQ,CAAC,WAAW,IAAI,CAAC,SAAkC,EAAE,KAAU,KAAI;AACxE,YAAA,QAAQ,CAAC,GAAG,GAAG,GAAG;AAClB,YAAA,WAAW,CAAC,SAAS,EAAE,KAAK,CAAC;AAC7B,YAAA,QAAQ,CAAC,GAAG,GAAG,IAAI;AACtB,QAAA,CAAC,CAAQ;AAEZ,IAAA,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAEZ,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE;QACxB,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,EAAE,MAAK;YACvB,QAAQ,CAAC,CAAC,IAAI,KAAK,IAAI,GAAG,CAAC,CAAC;AAC/B,QAAA,CAAC,CAAC;IACL;AACA,IAAA,MAAM,UAAU,GAAG,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,EAAE;AAE1C,IAAA,OAAO,UAAU,CAAC,GAAG,CAAC,CAAC,EAAE,SAAS,EAAE,SAAS,EAAE,KAAK,EAAE,EAAE,KAAK,KAAkB;AAC5E,QAAA,OAAOC,eAAC,SAAS,EAAA,MAAA,CAAA,MAAA,CAAA,EAAA,EAAiB,KAAK,CAAA,EAAhB,KAAK,CAAe;AAC9C,IAAA,CAAC,CAAC;AACL;;;;;"}
@@ -57,8 +57,9 @@ const RenderRenderar = () => {
57
57
  const updateProps = Renderar.updateProps;
58
58
  Renderar.render = ((component, props) => {
59
59
  Renderar.doc = doc;
60
- render(component, props);
60
+ const r = render(component, props);
61
61
  Renderar.doc = null;
62
+ return r;
62
63
  });
63
64
  Renderar.unrender = ((component) => {
64
65
  Renderar.doc = doc;
@@ -1 +1 @@
1
- {"version":3,"file":"Renderar.js","sources":["../../src/AppRoot/Renderar.tsx"],"sourcesContent":["import React, { ReactElement, useMemo } from \"react\";\r\nimport { DocumentID, useDocument } from \"../Document\";\r\n\r\ntype StoredComponent = {\r\n component: React.FunctionComponent<any>;\r\n props: any;\r\n};\r\n\r\nconst State = new Map<DocumentID, StoredComponent[]>()\r\nconst Dispatch = new Map<DocumentID, Function>()\r\n\r\nexport class Renderar {\r\n static doc: any\r\n static render(component: React.FunctionComponent, props?: any) {\r\n const docid = Renderar.doc.id\r\n let components = State.get(docid) || []\r\n components.push({ component, props })\r\n State.set(Renderar.doc.id, components)\r\n const dispatch = Dispatch.get(docid)\r\n if (dispatch) {\r\n dispatch()\r\n }\r\n\r\n return {\r\n unrender: () => {\r\n this.unrender(component);\r\n },\r\n updateProps: (newProps: any) => {\r\n this.updateProps(component, newProps);\r\n }\r\n };\r\n }\r\n\r\n static unrender(component: React.FunctionComponent) {\r\n const docid = Renderar.doc.id\r\n let components = State.get(docid) || []\r\n\r\n const index = components.findIndex((c) => c.component === component);\r\n if (index > -1) {\r\n components.splice(index, 1);\r\n const dispatch = Dispatch.get(docid)\r\n if (dispatch) {\r\n dispatch()\r\n }\r\n }\r\n }\r\n\r\n static updateProps(component: React.FunctionComponent, props: any) {\r\n const docid = Renderar.doc.id\r\n let components = State.get(docid) || []\r\n\r\n const storedComponent = components.find((c) => c.component === component);\r\n if (storedComponent) {\r\n storedComponent.props = { ...storedComponent.props, ...props };\r\n }\r\n const dispatch = Dispatch.get(docid)\r\n if (dispatch) {\r\n dispatch()\r\n }\r\n }\r\n}\r\n\r\nexport const RenderRenderar = () => {\r\n const [, setState] = React.useState(0);\r\n const doc = useDocument()\r\n\r\n useMemo(() => {\r\n const render = Renderar.render\r\n const unrender = Renderar.unrender\r\n const updateProps = Renderar.updateProps\r\n Renderar.render = ((component: React.FunctionComponent, props?: any) => {\r\n Renderar.doc = doc\r\n render(component, props)\r\n Renderar.doc = null\r\n }) as any\r\n\r\n Renderar.unrender = ((component: React.FunctionComponent) => {\r\n Renderar.doc = doc\r\n unrender(component)\r\n Renderar.doc = null\r\n }) as any\r\n\r\n Renderar.updateProps = ((component: React.FunctionComponent, props: any) => {\r\n Renderar.doc = doc\r\n updateProps(component, props)\r\n Renderar.doc = null\r\n }) as any\r\n\r\n }, [doc.id])\r\n\r\n if (!Dispatch.has(doc.id)) {\r\n Dispatch.set(doc.id, () => {\r\n setState((prev) => prev + 1);\r\n })\r\n }\r\n const components = State.get(doc.id) || []\r\n\r\n return components.map(({ component: Component, props }, index): ReactElement => {\r\n return <Component key={index} {...props} />;\r\n });\r\n}\r\n"],"names":["React","_jsx"],"mappings":";;;;AAQA,MAAM,KAAK,GAAG,IAAI,GAAG,EAAiC;AACtD,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAwB;MAEnC,QAAQ,CAAA;AAElB,IAAA,OAAO,MAAM,CAAC,SAAkC,EAAE,KAAW,EAAA;AAC1D,QAAA,MAAM,KAAK,GAAG,QAAQ,CAAC,GAAG,CAAC,EAAE;QAC7B,IAAI,UAAU,GAAG,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,EAAE;QACvC,UAAU,CAAC,IAAI,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;QACrC,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,EAAE,UAAU,CAAC;QACtC,MAAM,QAAQ,GAAG,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC;QACpC,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,QAAQ,CAAC,GAAG,CAAC,EAAE;QAC7B,IAAI,UAAU,GAAG,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,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iB,KAAK,CAAA,EAAhB,KAAK,CAAe;AAC9C,IAAA,CAAC,CAAC;AACL;;;;"}
1
+ {"version":3,"file":"Renderar.js","sources":["../../src/AppRoot/Renderar.tsx"],"sourcesContent":["import React, { ReactElement, useMemo } from \"react\";\r\nimport { DocumentID, useDocument } from \"../Document\";\r\n\r\ntype StoredComponent = {\r\n component: React.FunctionComponent<any>;\r\n props: any;\r\n};\r\n\r\nconst State = new Map<DocumentID, StoredComponent[]>()\r\nconst Dispatch = new Map<DocumentID, Function>()\r\n\r\nexport class Renderar {\r\n static doc: any\r\n static render(component: React.FunctionComponent, props?: any) {\r\n const docid = Renderar.doc.id\r\n let components = State.get(docid) || []\r\n components.push({ component, props })\r\n State.set(Renderar.doc.id, components)\r\n const dispatch = Dispatch.get(docid)\r\n if (dispatch) {\r\n dispatch()\r\n }\r\n\r\n return {\r\n unrender: () => {\r\n this.unrender(component);\r\n },\r\n updateProps: (newProps: any) => {\r\n this.updateProps(component, newProps);\r\n }\r\n };\r\n }\r\n\r\n static unrender(component: React.FunctionComponent) {\r\n const docid = Renderar.doc.id\r\n let components = State.get(docid) || []\r\n\r\n const index = components.findIndex((c) => c.component === component);\r\n if (index > -1) {\r\n components.splice(index, 1);\r\n const dispatch = Dispatch.get(docid)\r\n if (dispatch) {\r\n dispatch()\r\n }\r\n }\r\n }\r\n\r\n static updateProps(component: React.FunctionComponent, props: any) {\r\n const docid = Renderar.doc.id\r\n let components = State.get(docid) || []\r\n\r\n const storedComponent = components.find((c) => c.component === component);\r\n if (storedComponent) {\r\n storedComponent.props = { ...storedComponent.props, ...props };\r\n }\r\n const dispatch = Dispatch.get(docid)\r\n if (dispatch) {\r\n dispatch()\r\n }\r\n }\r\n}\r\n\r\nexport const RenderRenderar = () => {\r\n const [, setState] = React.useState(0);\r\n const doc = useDocument()\r\n\r\n useMemo(() => {\r\n const render = Renderar.render\r\n const unrender = Renderar.unrender\r\n const updateProps = Renderar.updateProps\r\n Renderar.render = ((component: React.FunctionComponent, props?: any) => {\r\n Renderar.doc = doc\r\n const r = render(component, props)\r\n Renderar.doc = null\r\n return r\r\n }) as any\r\n\r\n Renderar.unrender = ((component: React.FunctionComponent) => {\r\n Renderar.doc = doc\r\n unrender(component)\r\n Renderar.doc = null\r\n }) as any\r\n\r\n Renderar.updateProps = ((component: React.FunctionComponent, props: any) => {\r\n Renderar.doc = doc\r\n updateProps(component, props)\r\n Renderar.doc = null\r\n }) as any\r\n\r\n }, [doc.id])\r\n\r\n if (!Dispatch.has(doc.id)) {\r\n Dispatch.set(doc.id, () => {\r\n setState((prev) => prev + 1);\r\n })\r\n }\r\n const components = State.get(doc.id) || []\r\n\r\n return components.map(({ component: Component, props }, index): ReactElement => {\r\n return <Component key={index} {...props} />;\r\n });\r\n}\r\n"],"names":["React","_jsx"],"mappings":";;;;AAQA,MAAM,KAAK,GAAG,IAAI,GAAG,EAAiC;AACtD,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAwB;MAEnC,QAAQ,CAAA;AAElB,IAAA,OAAO,MAAM,CAAC,SAAkC,EAAE,KAAW,EAAA;AAC1D,QAAA,MAAM,KAAK,GAAG,QAAQ,CAAC,GAAG,CAAC,EAAE;QAC7B,IAAI,UAAU,GAAG,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,EAAE;QACvC,UAAU,CAAC,IAAI,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;QACrC,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,EAAE,UAAU,CAAC;QACtC,MAAM,QAAQ,GAAG,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC;QACpC,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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