@xanui/core 1.2.42 → 1.2.44
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/{context.js → AppRootProvider.cjs} +1 -1
- package/AppRoot/AppRootProvider.cjs.map +1 -0
- package/AppRoot/{context.mjs → AppRootProvider.js} +1 -1
- package/AppRoot/AppRootProvider.js.map +1 -0
- package/AppRoot/Renderar.cjs +89 -0
- package/AppRoot/Renderar.cjs.map +1 -0
- package/AppRoot/Renderar.d.ts +1 -0
- package/AppRoot/Renderar.js +52 -20
- package/AppRoot/Renderar.js.map +1 -1
- package/AppRoot/index.cjs +43 -0
- package/AppRoot/index.cjs.map +1 -0
- package/AppRoot/index.d.ts +2 -2
- package/AppRoot/index.js +24 -106
- package/AppRoot/index.js.map +1 -1
- package/Document/index.cjs +21 -0
- package/Document/index.cjs.map +1 -0
- package/Document/index.d.ts +7 -1
- package/Document/index.js +8 -11
- package/Document/index.js.map +1 -1
- package/Iframe/index.cjs +45 -0
- package/Iframe/index.cjs.map +1 -0
- package/Iframe/index.d.ts +1 -0
- package/Iframe/index.js +23 -25
- package/Iframe/index.js.map +1 -1
- package/Tag/ServerStyleTag.cjs +13 -0
- package/Tag/{ServerStyleTag.mjs.map → ServerStyleTag.cjs.map} +1 -1
- package/Tag/ServerStyleTag.js +3 -5
- package/Tag/ServerStyleTag.js.map +1 -1
- package/Tag/{cssPropList.mjs → cssPropList.cjs} +4 -2
- package/Tag/cssPropList.cjs.map +1 -0
- package/Tag/cssPropList.js +1 -3
- package/Tag/cssPropList.js.map +1 -1
- package/Tag/index.cjs +40 -0
- package/Tag/{index.mjs.map → index.cjs.map} +1 -1
- package/Tag/index.js +10 -31
- package/Tag/index.js.map +1 -1
- package/Tag/{useTagProps.mjs → useTagProps.cjs} +18 -13
- package/Tag/useTagProps.cjs.map +1 -0
- package/Tag/useTagProps.js +15 -14
- package/Tag/useTagProps.js.map +1 -1
- package/Transition/index.cjs +29 -0
- package/Transition/{index.mjs.map → index.cjs.map} +1 -1
- package/Transition/index.js +13 -15
- package/Transition/index.js.map +1 -1
- package/breakpoint/BreakpointProvider.cjs +43 -0
- package/breakpoint/{BreakpointProvider.mjs.map → BreakpointProvider.cjs.map} +1 -1
- package/breakpoint/BreakpointProvider.js +13 -16
- package/breakpoint/BreakpointProvider.js.map +1 -1
- package/breakpoint/useBreakpoint.cjs +24 -0
- package/breakpoint/{useBreakpoint.mjs.map → useBreakpoint.cjs.map} +1 -1
- package/breakpoint/useBreakpoint.js +7 -9
- package/breakpoint/useBreakpoint.js.map +1 -1
- package/breakpoint/{useBreakpointProps.mjs → useBreakpointProps.cjs} +8 -6
- package/breakpoint/useBreakpointProps.cjs.map +1 -0
- package/breakpoint/useBreakpointProps.js +5 -7
- package/breakpoint/useBreakpointProps.js.map +1 -1
- package/css/CSSCacheProvider.cjs +34 -0
- package/css/CSSCacheProvider.cjs.map +1 -0
- package/css/CSSCacheProvider.d.ts +7 -0
- package/css/CSSCacheProvider.js +29 -0
- package/css/CSSCacheProvider.js.map +1 -0
- package/css/{aliases.mjs → aliases.cjs} +4 -2
- package/css/aliases.cjs.map +1 -0
- package/css/aliases.js +1 -3
- package/css/aliases.js.map +1 -1
- package/css/{getProps.mjs → getProps.cjs} +4 -2
- package/css/{getProps.mjs.map → getProps.cjs.map} +1 -1
- package/css/getProps.js +1 -3
- package/css/getProps.js.map +1 -1
- package/css/{getValue.mjs → getValue.cjs} +4 -2
- package/css/{getValue.mjs.map → getValue.cjs.map} +1 -1
- package/css/getValue.js +1 -3
- package/css/getValue.js.map +1 -1
- package/css/{index.mjs → index.cjs} +15 -7
- package/css/index.cjs.map +1 -0
- package/css/index.js +6 -14
- package/css/index.js.map +1 -1
- package/hooks/{useAnimation.mjs → useAnimation.cjs} +18 -6
- package/hooks/useAnimation.cjs.map +1 -0
- package/hooks/useAnimation.js +12 -10
- package/hooks/useAnimation.js.map +1 -1
- package/hooks/{useColorTemplate.mjs → useColorTemplate.cjs} +4 -2
- package/hooks/{useColorTemplate.mjs.map → useColorTemplate.cjs.map} +1 -1
- package/hooks/useColorTemplate.js +1 -3
- package/hooks/useColorTemplate.js.map +1 -1
- package/hooks/useInterface.cjs +19 -0
- package/hooks/useInterface.cjs.map +1 -0
- package/hooks/useInterface.js +7 -9
- package/hooks/useInterface.js.map +1 -1
- package/hooks/{useMergeRefs.mjs → useMergeRefs.cjs} +6 -4
- package/hooks/{useMergeRefs.mjs.map → useMergeRefs.cjs.map} +1 -1
- package/hooks/useMergeRefs.js +3 -5
- package/hooks/useMergeRefs.js.map +1 -1
- package/hooks/usePortal.cjs +66 -0
- package/hooks/usePortal.cjs.map +1 -0
- package/hooks/usePortal.js +24 -30
- package/hooks/usePortal.js.map +1 -1
- package/hooks/useTransition/{index.mjs → index.cjs} +29 -25
- package/hooks/useTransition/index.cjs.map +1 -0
- package/hooks/useTransition/index.js +26 -26
- package/hooks/useTransition/index.js.map +1 -1
- package/hooks/useTransition/{variants.mjs → variants.cjs} +17 -2
- package/hooks/useTransition/{variants.mjs.map → variants.cjs.map} +1 -1
- package/hooks/useTransition/variants.js +1 -16
- package/hooks/useTransition/variants.js.map +1 -1
- package/index.cjs +64 -0
- package/index.cjs.map +1 -0
- package/index.d.ts +3 -2
- package/index.js +25 -60
- package/index.js.map +1 -1
- package/package.json +5 -12
- package/theme/{ThemeCssVars.mjs → ThemeCssVars.cjs} +4 -2
- package/theme/{ThemeCssVars.mjs.map → ThemeCssVars.cjs.map} +1 -1
- package/theme/ThemeCssVars.js +1 -3
- package/theme/ThemeCssVars.js.map +1 -1
- package/theme/{ThemeDefaultOptions.mjs → ThemeDefaultOptions.cjs} +11 -5
- package/theme/{ThemeDefaultOptions.mjs.map → ThemeDefaultOptions.cjs.map} +1 -1
- package/theme/ThemeDefaultOptions.js +4 -10
- package/theme/ThemeDefaultOptions.js.map +1 -1
- package/theme/ThemeProvider.cjs +154 -0
- package/theme/ThemeProvider.cjs.map +1 -0
- package/theme/ThemeProvider.d.ts +3 -1
- package/theme/ThemeProvider.js +109 -41
- package/theme/ThemeProvider.js.map +1 -1
- package/theme/{core.mjs → core.cjs} +12 -6
- package/theme/core.cjs.map +1 -0
- package/theme/core.js +5 -11
- package/theme/core.js.map +1 -1
- package/theme/createTheme.cjs +27 -0
- package/theme/{createTheme.mjs.map → createTheme.cjs.map} +1 -1
- package/theme/createTheme.js +10 -12
- package/theme/createTheme.js.map +1 -1
- package/theme/{createThemeSwitcher.mjs → createThemeSwitcher.cjs} +8 -6
- package/theme/{createThemeSwitcher.mjs.map → createThemeSwitcher.cjs.map} +1 -1
- package/theme/createThemeSwitcher.js +5 -7
- package/theme/createThemeSwitcher.js.map +1 -1
- package/theme/index.cjs +15 -0
- package/theme/{index.mjs.map → index.cjs.map} +1 -1
- package/theme/index.js +6 -11
- package/theme/index.js.map +1 -1
- package/AppRoot/Renderar.mjs +0 -51
- package/AppRoot/Renderar.mjs.map +0 -1
- package/AppRoot/context.js.map +0 -1
- package/AppRoot/context.mjs.map +0 -1
- package/AppRoot/index.mjs +0 -118
- package/AppRoot/index.mjs.map +0 -1
- package/Document/index.mjs +0 -18
- package/Document/index.mjs.map +0 -1
- package/Iframe/index.mjs +0 -43
- package/Iframe/index.mjs.map +0 -1
- package/Tag/ServerStyleTag.mjs +0 -11
- package/Tag/cssPropList.mjs.map +0 -1
- package/Tag/index.mjs +0 -19
- package/Tag/useTagProps.mjs.map +0 -1
- package/Transition/index.mjs +0 -27
- package/breakpoint/BreakpointProvider.mjs +0 -40
- package/breakpoint/useBreakpoint.mjs +0 -22
- package/breakpoint/useBreakpointProps.mjs.map +0 -1
- package/css/aliases.mjs.map +0 -1
- package/css/index.mjs.map +0 -1
- package/hooks/useAnimation.mjs.map +0 -1
- package/hooks/useInterface.mjs +0 -17
- package/hooks/useInterface.mjs.map +0 -1
- package/hooks/usePortal.mjs +0 -68
- package/hooks/usePortal.mjs.map +0 -1
- package/hooks/useTransition/index.mjs.map +0 -1
- package/index.mjs +0 -25
- package/index.mjs.map +0 -1
- package/theme/ThemeProvider.mjs +0 -44
- package/theme/ThemeProvider.mjs.map +0 -1
- package/theme/core.mjs.map +0 -1
- package/theme/createTheme.mjs +0 -25
- package/theme/index.mjs +0 -10
- /package/AppRoot/{context.d.ts → AppRootProvider.d.ts} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AppRootProvider.cjs","sources":["../../src/AppRoot/AppRootProvider.tsx"],"sourcesContent":["import React from \"react\";\r\n\r\nconst AppRootContext = React.createContext<HTMLElement | null>(null);\r\n\r\nexport const AppRootProvider: React.FC<{ element: HTMLElement | null; children: React.ReactNode }> = ({ element, children }) => {\r\n return (\r\n <AppRootContext.Provider value={element}>\r\n {children}\r\n </AppRootContext.Provider>\r\n );\r\n}\r\n\r\nexport const useAppRootElement = (): HTMLElement => {\r\n const context = React.useContext(AppRootContext);\r\n if (typeof window === 'undefined') {\r\n return null as any;\r\n }\r\n return context as HTMLElement\r\n}\r\n"],"names":["_jsx"],"mappings":";;;;;AAEA,MAAM,cAAc,GAAG,KAAK,CAAC,aAAa,CAAqB,IAAI,CAAC;AAE7D,MAAM,eAAe,GAAyE,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAI;AAC5H,IAAA,QACGA,cAAA,CAAC,cAAc,CAAC,QAAQ,EAAA,EAAC,KAAK,EAAE,OAAO,EAAA,QAAA,EACnC,QAAQ,EAAA,CACc;AAEhC;AAEO,MAAM,iBAAiB,GAAG,MAAkB;IAChD,MAAM,OAAO,GAAG,KAAK,CAAC,UAAU,CAAC,cAAc,CAAC;AAChD,IAAA,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;AAChC,QAAA,OAAO,IAAW;IACrB;AACA,IAAA,OAAO,OAAsB;AAChC;;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AppRootProvider.js","sources":["../../src/AppRoot/AppRootProvider.tsx"],"sourcesContent":["import React from \"react\";\r\n\r\nconst AppRootContext = React.createContext<HTMLElement | null>(null);\r\n\r\nexport const AppRootProvider: React.FC<{ element: HTMLElement | null; children: React.ReactNode }> = ({ element, children }) => {\r\n return (\r\n <AppRootContext.Provider value={element}>\r\n {children}\r\n </AppRootContext.Provider>\r\n );\r\n}\r\n\r\nexport const useAppRootElement = (): HTMLElement => {\r\n const context = React.useContext(AppRootContext);\r\n if (typeof window === 'undefined') {\r\n return null as any;\r\n }\r\n return context as HTMLElement\r\n}\r\n"],"names":["React","_jsx"],"mappings":";;;AAEA,MAAM,cAAc,GAAGA,cAAK,CAAC,aAAa,CAAqB,IAAI,CAAC;AAE7D,MAAM,eAAe,GAAyE,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAI;AAC5H,IAAA,QACGC,GAAA,CAAC,cAAc,CAAC,QAAQ,EAAA,EAAC,KAAK,EAAE,OAAO,EAAA,QAAA,EACnC,QAAQ,EAAA,CACc;AAEhC;AAEO,MAAM,iBAAiB,GAAG,MAAkB;IAChD,MAAM,OAAO,GAAGD,cAAK,CAAC,UAAU,CAAC,cAAc,CAAC;AAChD,IAAA,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;AAChC,QAAA,OAAO,IAAW;IACrB;AACA,IAAA,OAAO,OAAsB;AAChC;;;;"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
var React = require('react');
|
|
5
|
+
var index = require('../Document/index.cjs');
|
|
6
|
+
|
|
7
|
+
const State = new Map();
|
|
8
|
+
const Dispatch = new Map();
|
|
9
|
+
class Renderar {
|
|
10
|
+
static render(component, props) {
|
|
11
|
+
const docid = Renderar.doc.id;
|
|
12
|
+
let components = State.get(docid) || [];
|
|
13
|
+
components.push({ component, props });
|
|
14
|
+
State.set(Renderar.doc.id, components);
|
|
15
|
+
const dispatch = Dispatch.get(docid);
|
|
16
|
+
if (dispatch) {
|
|
17
|
+
dispatch();
|
|
18
|
+
}
|
|
19
|
+
return {
|
|
20
|
+
unrender: () => {
|
|
21
|
+
this.unrender(component);
|
|
22
|
+
},
|
|
23
|
+
updateProps: (newProps) => {
|
|
24
|
+
this.updateProps(component, newProps);
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
static unrender(component) {
|
|
29
|
+
const docid = Renderar.doc.id;
|
|
30
|
+
let components = State.get(docid) || [];
|
|
31
|
+
const index = components.findIndex((c) => c.component === component);
|
|
32
|
+
if (index > -1) {
|
|
33
|
+
components.splice(index, 1);
|
|
34
|
+
const dispatch = Dispatch.get(docid);
|
|
35
|
+
if (dispatch) {
|
|
36
|
+
dispatch();
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
static updateProps(component, props) {
|
|
41
|
+
const docid = Renderar.doc.id;
|
|
42
|
+
let components = State.get(docid) || [];
|
|
43
|
+
const storedComponent = components.find((c) => c.component === component);
|
|
44
|
+
if (storedComponent) {
|
|
45
|
+
storedComponent.props = Object.assign(Object.assign({}, storedComponent.props), props);
|
|
46
|
+
}
|
|
47
|
+
const dispatch = Dispatch.get(docid);
|
|
48
|
+
if (dispatch) {
|
|
49
|
+
dispatch();
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
const RenderRenderar = () => {
|
|
54
|
+
const [, setState] = React.useState(0);
|
|
55
|
+
const doc = index.useDocument();
|
|
56
|
+
React.useMemo(() => {
|
|
57
|
+
const render = Renderar.render;
|
|
58
|
+
const unrender = Renderar.unrender;
|
|
59
|
+
const updateProps = Renderar.updateProps;
|
|
60
|
+
Renderar.render = ((component, props) => {
|
|
61
|
+
Renderar.doc = doc;
|
|
62
|
+
render(component, Object.assign(Object.assign({}, props), { $doc: doc }));
|
|
63
|
+
Renderar.doc = null;
|
|
64
|
+
});
|
|
65
|
+
Renderar.unrender = ((component) => {
|
|
66
|
+
Renderar.doc = doc;
|
|
67
|
+
unrender(component);
|
|
68
|
+
Renderar.doc = null;
|
|
69
|
+
});
|
|
70
|
+
Renderar.updateProps = ((component, props) => {
|
|
71
|
+
Renderar.doc = doc;
|
|
72
|
+
updateProps(component, props);
|
|
73
|
+
Renderar.doc = null;
|
|
74
|
+
});
|
|
75
|
+
}, [doc.id]);
|
|
76
|
+
if (!Dispatch.has(doc.id)) {
|
|
77
|
+
Dispatch.set(doc.id, () => {
|
|
78
|
+
setState((prev) => prev + 1);
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
const components = State.get(doc.id) || [];
|
|
82
|
+
return components.map(({ component: Component, props }, index) => {
|
|
83
|
+
return jsxRuntime.jsx(Component, Object.assign({}, props), index);
|
|
84
|
+
});
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
exports.RenderRenderar = RenderRenderar;
|
|
88
|
+
exports.Renderar = Renderar;
|
|
89
|
+
//# sourceMappingURL=Renderar.cjs.map
|
|
@@ -0,0 +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, $doc: doc })\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,KA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AS,CAAC;AACnB,YAAA,QAAQ,CAAC,GAAG,GAAG,IAAI;AACtB,QAAA,CAAC,CAAQ;QAET,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;;;;;"}
|
package/AppRoot/Renderar.d.ts
CHANGED
package/AppRoot/Renderar.js
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
|
-
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import React__default, { useMemo } from 'react';
|
|
3
|
+
import { useDocument } from '../Document/index.js';
|
|
2
4
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const Components = [];
|
|
7
|
-
let dispatch = null;
|
|
5
|
+
const State = new Map();
|
|
6
|
+
const Dispatch = new Map();
|
|
8
7
|
class Renderar {
|
|
9
8
|
static render(component, props) {
|
|
10
|
-
|
|
9
|
+
const docid = Renderar.doc.id;
|
|
10
|
+
let components = State.get(docid) || [];
|
|
11
|
+
components.push({ component, props });
|
|
12
|
+
State.set(Renderar.doc.id, components);
|
|
13
|
+
const dispatch = Dispatch.get(docid);
|
|
11
14
|
if (dispatch) {
|
|
12
15
|
dispatch();
|
|
13
16
|
}
|
|
@@ -21,34 +24,63 @@ class Renderar {
|
|
|
21
24
|
};
|
|
22
25
|
}
|
|
23
26
|
static unrender(component) {
|
|
24
|
-
const
|
|
27
|
+
const docid = Renderar.doc.id;
|
|
28
|
+
let components = State.get(docid) || [];
|
|
29
|
+
const index = components.findIndex((c) => c.component === component);
|
|
25
30
|
if (index > -1) {
|
|
26
|
-
|
|
27
|
-
|
|
31
|
+
components.splice(index, 1);
|
|
32
|
+
const dispatch = Dispatch.get(docid);
|
|
33
|
+
if (dispatch) {
|
|
28
34
|
dispatch();
|
|
35
|
+
}
|
|
29
36
|
}
|
|
30
37
|
}
|
|
31
38
|
static updateProps(component, props) {
|
|
32
|
-
const
|
|
39
|
+
const docid = Renderar.doc.id;
|
|
40
|
+
let components = State.get(docid) || [];
|
|
41
|
+
const storedComponent = components.find((c) => c.component === component);
|
|
33
42
|
if (storedComponent) {
|
|
34
43
|
storedComponent.props = Object.assign(Object.assign({}, storedComponent.props), props);
|
|
35
44
|
}
|
|
36
|
-
|
|
45
|
+
const dispatch = Dispatch.get(docid);
|
|
46
|
+
if (dispatch) {
|
|
37
47
|
dispatch();
|
|
48
|
+
}
|
|
38
49
|
}
|
|
39
50
|
}
|
|
40
51
|
const RenderRenderar = () => {
|
|
41
|
-
const [, setState] =
|
|
42
|
-
|
|
43
|
-
|
|
52
|
+
const [, setState] = React__default.useState(0);
|
|
53
|
+
const doc = useDocument();
|
|
54
|
+
useMemo(() => {
|
|
55
|
+
const render = Renderar.render;
|
|
56
|
+
const unrender = Renderar.unrender;
|
|
57
|
+
const updateProps = Renderar.updateProps;
|
|
58
|
+
Renderar.render = ((component, props) => {
|
|
59
|
+
Renderar.doc = doc;
|
|
60
|
+
render(component, Object.assign(Object.assign({}, props), { $doc: doc }));
|
|
61
|
+
Renderar.doc = null;
|
|
62
|
+
});
|
|
63
|
+
Renderar.unrender = ((component) => {
|
|
64
|
+
Renderar.doc = doc;
|
|
65
|
+
unrender(component);
|
|
66
|
+
Renderar.doc = null;
|
|
67
|
+
});
|
|
68
|
+
Renderar.updateProps = ((component, props) => {
|
|
69
|
+
Renderar.doc = doc;
|
|
70
|
+
updateProps(component, props);
|
|
71
|
+
Renderar.doc = null;
|
|
72
|
+
});
|
|
73
|
+
}, [doc.id]);
|
|
74
|
+
if (!Dispatch.has(doc.id)) {
|
|
75
|
+
Dispatch.set(doc.id, () => {
|
|
44
76
|
setState((prev) => prev + 1);
|
|
45
|
-
};
|
|
77
|
+
});
|
|
46
78
|
}
|
|
47
|
-
|
|
48
|
-
|
|
79
|
+
const components = State.get(doc.id) || [];
|
|
80
|
+
return components.map(({ component: Component, props }, index) => {
|
|
81
|
+
return jsx(Component, Object.assign({}, props), index);
|
|
49
82
|
});
|
|
50
83
|
};
|
|
51
84
|
|
|
52
|
-
|
|
53
|
-
exports.Renderar = Renderar;
|
|
85
|
+
export { RenderRenderar, Renderar };
|
|
54
86
|
//# 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\";\r\n\r\ntype StoredComponent = {\r\n component: React.FunctionComponent<any>;\r\n props: any;\r\n};\r\n\r\nconst
|
|
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, $doc: doc })\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,G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AAE,SAAS,EAAE,KAAK,EAAE,EAAE,KAAK,KAAkB;AAC5E,QAAA,OAAOC,IAAC,SAAS,EAAA,MAAA,CAAA,MAAA,CAAA,EAAA,EAAiB,KAAK,CAAA,EAAhB,KAAK,CAAe;AAC9C,IAAA,CAAC,CAAC;AACL;;;;"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
var tslib = require('tslib');
|
|
5
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
6
|
+
var React = require('react');
|
|
7
|
+
require('../theme/core.cjs');
|
|
8
|
+
require('../css/getValue.cjs');
|
|
9
|
+
require('oncss');
|
|
10
|
+
var ThemeProvider = require('../theme/ThemeProvider.cjs');
|
|
11
|
+
require('react-state-bucket');
|
|
12
|
+
var BreakpointProvider = require('../breakpoint/BreakpointProvider.cjs');
|
|
13
|
+
var Renderar = require('./Renderar.cjs');
|
|
14
|
+
var index = require('../Document/index.cjs');
|
|
15
|
+
var AppRootProvider = require('./AppRootProvider.cjs');
|
|
16
|
+
var useMergeRefs = require('../hooks/useMergeRefs.cjs');
|
|
17
|
+
var CSSCacheProvider = require('../css/CSSCacheProvider.cjs');
|
|
18
|
+
|
|
19
|
+
const AppRoot = React.forwardRef((_a, ref) => {
|
|
20
|
+
var { children, noScrollbarCss, CSSCacheId, theme, document: _document } = _a, props = tslib.__rest(_a, ["children", "noScrollbarCss", "CSSCacheId", "theme", "document"]);
|
|
21
|
+
noScrollbarCss !== null && noScrollbarCss !== void 0 ? noScrollbarCss : (noScrollbarCss = false);
|
|
22
|
+
_document !== null && _document !== void 0 ? _document : (_document = document);
|
|
23
|
+
const docid = React.useId();
|
|
24
|
+
const csscacheId = React.useId();
|
|
25
|
+
CSSCacheId !== null && CSSCacheId !== void 0 ? CSSCacheId : (CSSCacheId = csscacheId);
|
|
26
|
+
const [visibility, setVisibility] = React.useState("hidden");
|
|
27
|
+
const rootRef = React.useRef(null);
|
|
28
|
+
const mergeRef = useMergeRefs(rootRef, ref);
|
|
29
|
+
React.useEffect(() => {
|
|
30
|
+
setVisibility("visible");
|
|
31
|
+
// move oncss style tags to head
|
|
32
|
+
if (typeof _document === 'undefined')
|
|
33
|
+
return;
|
|
34
|
+
const styles = Array.from(_document.querySelectorAll('body style[data-oncss]'));
|
|
35
|
+
styles.forEach((style) => {
|
|
36
|
+
_document.head.appendChild(style);
|
|
37
|
+
});
|
|
38
|
+
}, []);
|
|
39
|
+
return (jsxRuntime.jsx(index.DocumentProvider, { document: _document, id: docid, children: jsxRuntime.jsx(CSSCacheProvider.CSSCacheProvider, { cacheId: CSSCacheId, children: jsxRuntime.jsx(AppRootProvider.AppRootProvider, { element: rootRef.current, children: jsxRuntime.jsx(ThemeProvider, Object.assign({ ref: mergeRef, theme: theme }, props, { isRoot: true, sx: Object.assign(Object.assign({}, props.sx), (visibility === "hidden" ? { visibility: "hidden" } : {})), children: jsxRuntime.jsxs(BreakpointProvider.BreakpointProvider, { children: [children, jsxRuntime.jsx(Renderar.RenderRenderar, {})] }) })) }) }) }));
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
module.exports = AppRoot;
|
|
43
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../src/AppRoot/index.tsx"],"sourcesContent":["\"use client\";\r\nimport React, { useEffect, useId, useRef } from 'react';\r\nimport { TagComponentType } from '../Tag/types';\r\nimport { ThemeProvider, ThemeProviderProps } from '../theme';\r\nimport { BreakpointProvider } from '../breakpoint';\r\nimport { RenderRenderar } from './Renderar';\r\nimport { DocumentProvider } from '../Document';\r\nimport { AppRootProvider } from './AppRootProvider';\r\nimport useMergeRefs from '../hooks/useMergeRefs';\r\nimport { CSSCacheProvider } from '../css/CSSCacheProvider';\r\n\r\nexport type AppRootProps<T extends TagComponentType = \"div\"> = ThemeProviderProps<T> & {\r\n noScrollbarCss?: boolean;\r\n document?: Document;\r\n CSSCacheId?: string;\r\n}\r\n\r\nconst AppRoot = React.forwardRef(<T extends TagComponentType = \"div\">({ children, noScrollbarCss, CSSCacheId, theme, document: _document, ...props }: AppRootProps<T>, ref: React.Ref<any>) => {\r\n noScrollbarCss ??= false\r\n _document ??= document\r\n const docid = useId()\r\n\r\n const csscacheId = useId()\r\n CSSCacheId ??= csscacheId\r\n\r\n\r\n const [visibility, setVisibility] = React.useState<string>(\"hidden\");\r\n const rootRef = useRef(null)\r\n const mergeRef = useMergeRefs(rootRef, ref)\r\n\r\n useEffect(() => {\r\n setVisibility(\"visible\");\r\n\r\n // move oncss style tags to head\r\n if (typeof _document === 'undefined') return;\r\n const styles = Array.from(_document.querySelectorAll('body style[data-oncss]'));\r\n styles.forEach((style) => {\r\n _document.head.appendChild(style);\r\n });\r\n }, [])\r\n\r\n return (\r\n <DocumentProvider document={_document} id={docid}>\r\n <CSSCacheProvider cacheId={CSSCacheId}>\r\n <AppRootProvider element={rootRef.current}>\r\n <ThemeProvider\r\n ref={mergeRef}\r\n theme={theme}\r\n {...props}\r\n isRoot\r\n sx={{\r\n ...props.sx,\r\n ...(visibility === \"hidden\" ? { visibility: \"hidden\" } : {})\r\n }}\r\n >\r\n <BreakpointProvider>\r\n {children}\r\n <RenderRenderar />\r\n </BreakpointProvider>\r\n </ThemeProvider>\r\n </AppRootProvider>\r\n </CSSCacheProvider>\r\n </DocumentProvider>\r\n )\r\n})\r\n\r\nexport default AppRoot\r\n\r\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAiBA;AAAsE;;;AAGnE;AAEA;;AAIA;AACA;;;;;;;AAQG;AACA;AACG;AACH;;AAGH;AAuBH;;"}
|
package/AppRoot/index.d.ts
CHANGED
|
@@ -5,9 +5,9 @@ import { ThemeProviderProps } from '../theme/ThemeProvider.js';
|
|
|
5
5
|
type AppRootProps<T extends TagComponentType = "div"> = ThemeProviderProps<T> & {
|
|
6
6
|
noScrollbarCss?: boolean;
|
|
7
7
|
document?: Document;
|
|
8
|
+
CSSCacheId?: string;
|
|
8
9
|
};
|
|
9
|
-
declare const APP_ROOT_CLASSNAME = "xui-app-root";
|
|
10
10
|
declare const AppRoot: React__default.ForwardRefExoticComponent<Omit<AppRootProps<TagComponentType>, "ref"> & React__default.RefAttributes<any>>;
|
|
11
11
|
|
|
12
|
-
export {
|
|
12
|
+
export { AppRoot as default };
|
|
13
13
|
export type { AppRootProps };
|
package/AppRoot/index.js
CHANGED
|
@@ -1,111 +1,30 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
|
|
2
|
+
import { __rest } from 'tslib';
|
|
3
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
4
|
+
import React__default, { useId, useRef, useEffect } from 'react';
|
|
5
|
+
import '../theme/core.js';
|
|
6
|
+
import '../css/getValue.js';
|
|
7
|
+
import 'oncss';
|
|
8
|
+
import ThemeProvider from '../theme/ThemeProvider.js';
|
|
9
|
+
import 'react-state-bucket';
|
|
10
|
+
import { BreakpointProvider } from '../breakpoint/BreakpointProvider.js';
|
|
11
|
+
import { RenderRenderar } from './Renderar.js';
|
|
12
|
+
import { DocumentProvider } from '../Document/index.js';
|
|
13
|
+
import { AppRootProvider } from './AppRootProvider.js';
|
|
14
|
+
import useMergeRefs from '../hooks/useMergeRefs.js';
|
|
15
|
+
import { CSSCacheProvider } from '../css/CSSCacheProvider.js';
|
|
3
16
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
var tslib = require('tslib');
|
|
7
|
-
var jsxRuntime = require('react/jsx-runtime');
|
|
8
|
-
var React = require('react');
|
|
9
|
-
var index$1 = require('../theme/index.js');
|
|
10
|
-
var BreakpointProvider = require('../breakpoint/BreakpointProvider.js');
|
|
11
|
-
var index = require('../css/index.js');
|
|
12
|
-
var Renderar = require('./Renderar.js');
|
|
13
|
-
var ServerStyleTag = require('../Tag/ServerStyleTag.js');
|
|
14
|
-
var index$2 = require('../Document/index.js');
|
|
15
|
-
var context = require('./context.js');
|
|
16
|
-
var useMergeRefs = require('../hooks/useMergeRefs.js');
|
|
17
|
-
var ThemeProvider = require('../theme/ThemeProvider.js');
|
|
18
|
-
|
|
19
|
-
const APP_ROOT_CLASSNAME = "xui-app-root";
|
|
20
|
-
const AppRoot = React.forwardRef((_a, ref) => {
|
|
21
|
-
var { children, noScrollbarCss, theme, document: _document } = _a, props = tslib.__rest(_a, ["children", "noScrollbarCss", "theme", "document"]);
|
|
17
|
+
const AppRoot = React__default.forwardRef((_a, ref) => {
|
|
18
|
+
var { children, noScrollbarCss, CSSCacheId, theme, document: _document } = _a, props = __rest(_a, ["children", "noScrollbarCss", "CSSCacheId", "theme", "document"]);
|
|
22
19
|
noScrollbarCss !== null && noScrollbarCss !== void 0 ? noScrollbarCss : (noScrollbarCss = false);
|
|
23
20
|
_document !== null && _document !== void 0 ? _document : (_document = document);
|
|
24
|
-
const
|
|
25
|
-
const
|
|
21
|
+
const docid = useId();
|
|
22
|
+
const csscacheId = useId();
|
|
23
|
+
CSSCacheId !== null && CSSCacheId !== void 0 ? CSSCacheId : (CSSCacheId = csscacheId);
|
|
24
|
+
const [visibility, setVisibility] = React__default.useState("hidden");
|
|
25
|
+
const rootRef = useRef(null);
|
|
26
26
|
const mergeRef = useMergeRefs(rootRef, ref);
|
|
27
|
-
|
|
28
|
-
if (noScrollbarCss)
|
|
29
|
-
return;
|
|
30
|
-
const cls = (cls) => `${index$1.themeRootClass(theme)} ${cls}`;
|
|
31
|
-
let thumbSize = 6;
|
|
32
|
-
let thumbColor = "var(--color-text-secondary)";
|
|
33
|
-
let trackColor = "transparent";
|
|
34
|
-
return index.css({
|
|
35
|
-
"@global": {
|
|
36
|
-
[cls('*::-webkit-scrollbar')]: {
|
|
37
|
-
width: thumbSize,
|
|
38
|
-
height: thumbSize,
|
|
39
|
-
},
|
|
40
|
-
[cls("*::-webkit-scrollbar-thumb")]: {
|
|
41
|
-
backgroundColor: thumbColor,
|
|
42
|
-
borderRadius: "6px",
|
|
43
|
-
opacity: 0.6,
|
|
44
|
-
},
|
|
45
|
-
[cls("*::-webkit-scrollbar-thumb:hover")]: {
|
|
46
|
-
backgroundColor: thumbColor,
|
|
47
|
-
opacity: 0.0,
|
|
48
|
-
},
|
|
49
|
-
[cls("*::-webkit-scrollbar-track")]: {
|
|
50
|
-
backgroundColor: trackColor,
|
|
51
|
-
borderRadius: "6px",
|
|
52
|
-
},
|
|
53
|
-
}
|
|
54
|
-
}, {
|
|
55
|
-
injectStyle: typeof window !== 'undefined',
|
|
56
|
-
container: _document,
|
|
57
|
-
});
|
|
58
|
-
}, [noScrollbarCss, theme]);
|
|
59
|
-
const globalStyle = React.useMemo(() => {
|
|
60
|
-
return index.css({
|
|
61
|
-
"@global": {
|
|
62
|
-
"*": {
|
|
63
|
-
m: 0,
|
|
64
|
-
p: 0,
|
|
65
|
-
outline: "none",
|
|
66
|
-
boxSizing: "border-box",
|
|
67
|
-
verticalAlign: "baseline",
|
|
68
|
-
},
|
|
69
|
-
"html, body": {
|
|
70
|
-
minHeight: "100%",
|
|
71
|
-
"-webkit-font-smoothing": "antialiased",
|
|
72
|
-
"-moz-osx-font-smoothing": "grayscale",
|
|
73
|
-
},
|
|
74
|
-
"img, picture, video, canvas, svg": {
|
|
75
|
-
maxWidth: "100%",
|
|
76
|
-
display: "block"
|
|
77
|
-
},
|
|
78
|
-
"input, button, textarea, select": {
|
|
79
|
-
font: "inherit"
|
|
80
|
-
},
|
|
81
|
-
"table": {
|
|
82
|
-
borderCollapse: "collapse",
|
|
83
|
-
borderSpacing: 0,
|
|
84
|
-
},
|
|
85
|
-
"ol, ul": {
|
|
86
|
-
listStyle: "none",
|
|
87
|
-
padding: 0,
|
|
88
|
-
margin: 0,
|
|
89
|
-
},
|
|
90
|
-
"a": {
|
|
91
|
-
display: "inline-block",
|
|
92
|
-
color: "inherit",
|
|
93
|
-
textDecoration: "none",
|
|
94
|
-
cursor: "pointer",
|
|
95
|
-
"&:hover": {
|
|
96
|
-
textDecoration: "underline"
|
|
97
|
-
}
|
|
98
|
-
},
|
|
99
|
-
"p, h1, h2, h3, h4, h5, h6": {
|
|
100
|
-
overflowWrap: "break-word",
|
|
101
|
-
},
|
|
102
|
-
}
|
|
103
|
-
}, {
|
|
104
|
-
injectStyle: typeof window !== 'undefined',
|
|
105
|
-
container: _document,
|
|
106
|
-
});
|
|
107
|
-
}, []);
|
|
108
|
-
React.useEffect(() => {
|
|
27
|
+
useEffect(() => {
|
|
109
28
|
setVisibility("visible");
|
|
110
29
|
// move oncss style tags to head
|
|
111
30
|
if (typeof _document === 'undefined')
|
|
@@ -115,9 +34,8 @@ const AppRoot = React.forwardRef((_a, ref) => {
|
|
|
115
34
|
_document.head.appendChild(style);
|
|
116
35
|
});
|
|
117
36
|
}, []);
|
|
118
|
-
return (
|
|
37
|
+
return (jsx(DocumentProvider, { document: _document, id: docid, children: jsx(CSSCacheProvider, { cacheId: CSSCacheId, children: jsx(AppRootProvider, { element: rootRef.current, children: jsx(ThemeProvider, Object.assign({ ref: mergeRef, theme: theme }, props, { isRoot: true, sx: Object.assign(Object.assign({}, props.sx), (visibility === "hidden" ? { visibility: "hidden" } : {})), children: jsxs(BreakpointProvider, { children: [children, jsx(RenderRenderar, {})] }) })) }) }) }));
|
|
119
38
|
});
|
|
120
39
|
|
|
121
|
-
|
|
122
|
-
exports.default = AppRoot;
|
|
40
|
+
export { AppRoot as default };
|
|
123
41
|
//# sourceMappingURL=index.js.map
|
package/AppRoot/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/AppRoot/index.tsx"],"sourcesContent":["\"use client\";\r\nimport React, { useEffect,
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/AppRoot/index.tsx"],"sourcesContent":["\"use client\";\r\nimport React, { useEffect, useId, useRef } from 'react';\r\nimport { TagComponentType } from '../Tag/types';\r\nimport { ThemeProvider, ThemeProviderProps } from '../theme';\r\nimport { BreakpointProvider } from '../breakpoint';\r\nimport { RenderRenderar } from './Renderar';\r\nimport { DocumentProvider } from '../Document';\r\nimport { AppRootProvider } from './AppRootProvider';\r\nimport useMergeRefs from '../hooks/useMergeRefs';\r\nimport { CSSCacheProvider } from '../css/CSSCacheProvider';\r\n\r\nexport type AppRootProps<T extends TagComponentType = \"div\"> = ThemeProviderProps<T> & {\r\n noScrollbarCss?: boolean;\r\n document?: Document;\r\n CSSCacheId?: string;\r\n}\r\n\r\nconst AppRoot = React.forwardRef(<T extends TagComponentType = \"div\">({ children, noScrollbarCss, CSSCacheId, theme, document: _document, ...props }: AppRootProps<T>, ref: React.Ref<any>) => {\r\n noScrollbarCss ??= false\r\n _document ??= document\r\n const docid = useId()\r\n\r\n const csscacheId = useId()\r\n CSSCacheId ??= csscacheId\r\n\r\n\r\n const [visibility, setVisibility] = React.useState<string>(\"hidden\");\r\n const rootRef = useRef(null)\r\n const mergeRef = useMergeRefs(rootRef, ref)\r\n\r\n useEffect(() => {\r\n setVisibility(\"visible\");\r\n\r\n // move oncss style tags to head\r\n if (typeof _document === 'undefined') return;\r\n const styles = Array.from(_document.querySelectorAll('body style[data-oncss]'));\r\n styles.forEach((style) => {\r\n _document.head.appendChild(style);\r\n });\r\n }, [])\r\n\r\n return (\r\n <DocumentProvider document={_document} id={docid}>\r\n <CSSCacheProvider cacheId={CSSCacheId}>\r\n <AppRootProvider element={rootRef.current}>\r\n <ThemeProvider\r\n ref={mergeRef}\r\n theme={theme}\r\n {...props}\r\n isRoot\r\n sx={{\r\n ...props.sx,\r\n ...(visibility === \"hidden\" ? { visibility: \"hidden\" } : {})\r\n }}\r\n >\r\n <BreakpointProvider>\r\n {children}\r\n <RenderRenderar />\r\n </BreakpointProvider>\r\n </ThemeProvider>\r\n </AppRootProvider>\r\n </CSSCacheProvider>\r\n </DocumentProvider>\r\n )\r\n})\r\n\r\nexport default AppRoot\r\n\r\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAiBA;AAAsE;;;AAGnE;AAEA;;AAIA;AACA;;;;;;;AAQG;AACA;AACG;AACH;;AAGH;AAuBH;;"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
5
|
+
var React = require('react');
|
|
6
|
+
|
|
7
|
+
const DocumentContext = React.createContext(null);
|
|
8
|
+
const DocumentProvider = ({ document, id, children }) => {
|
|
9
|
+
return (jsxRuntime.jsx(DocumentContext.Provider, { value: { document, id }, children: children }));
|
|
10
|
+
};
|
|
11
|
+
const useDocument = () => {
|
|
12
|
+
const context = React.useContext(DocumentContext);
|
|
13
|
+
if (typeof window === 'undefined') {
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
return context;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
exports.DocumentProvider = DocumentProvider;
|
|
20
|
+
exports.useDocument = useDocument;
|
|
21
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../src/Document/index.tsx"],"sourcesContent":["'use client'\r\nimport React, { useContext, createContext } from \"react\";\r\n\r\n\r\nexport type DocumentID = string\r\nexport type DocumentContextValue = { document: Document; id: DocumentID }\r\nconst DocumentContext = createContext<DocumentContextValue | null>(null);\r\n\r\nexport const DocumentProvider: React.FC<{ children: React.ReactNode } & DocumentContextValue> = ({ document, id, children }) => {\r\n return (\r\n <DocumentContext.Provider value={{ document, id }}>\r\n {children}\r\n </DocumentContext.Provider>\r\n );\r\n}\r\n\r\nexport const useDocument = (): DocumentContextValue => {\r\n const context = useContext(DocumentContext);\r\n if (typeof window === 'undefined') {\r\n return null as any;\r\n }\r\n return context as DocumentContextValue\r\n}"],"names":[],"mappings":";;;;;;AAMA;AAEO;AACJ;AAKH;AAEO;AACJ;AACA;AACG;;AAEH;AACH;;;"}
|
package/Document/index.d.ts
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
type DocumentID = string;
|
|
2
|
+
type DocumentContextValue = {
|
|
3
|
+
document: Document;
|
|
4
|
+
id: DocumentID;
|
|
5
|
+
};
|
|
6
|
+
declare const useDocument: () => DocumentContextValue;
|
|
2
7
|
|
|
3
8
|
export { useDocument };
|
|
9
|
+
export type { DocumentContextValue, DocumentID };
|
package/Document/index.js
CHANGED
|
@@ -1,21 +1,18 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { createContext, useContext } from 'react';
|
|
3
4
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const DocumentContext = React.createContext(null);
|
|
8
|
-
const DocumentProvider = ({ document, children }) => {
|
|
9
|
-
return (jsxRuntime.jsx(DocumentContext.Provider, { value: document, children: children }));
|
|
5
|
+
const DocumentContext = createContext(null);
|
|
6
|
+
const DocumentProvider = ({ document, id, children }) => {
|
|
7
|
+
return (jsx(DocumentContext.Provider, { value: { document, id }, children: children }));
|
|
10
8
|
};
|
|
11
9
|
const useDocument = () => {
|
|
12
|
-
const context =
|
|
10
|
+
const context = useContext(DocumentContext);
|
|
13
11
|
if (typeof window === 'undefined') {
|
|
14
12
|
return null;
|
|
15
13
|
}
|
|
16
|
-
return context
|
|
14
|
+
return context;
|
|
17
15
|
};
|
|
18
16
|
|
|
19
|
-
|
|
20
|
-
exports.useDocument = useDocument;
|
|
17
|
+
export { DocumentProvider, useDocument };
|
|
21
18
|
//# sourceMappingURL=index.js.map
|
package/Document/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/Document/index.tsx"],"sourcesContent":["'use client'\r\nimport React from \"react\";\r\n\r\nconst DocumentContext =
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/Document/index.tsx"],"sourcesContent":["'use client'\r\nimport React, { useContext, createContext } from \"react\";\r\n\r\n\r\nexport type DocumentID = string\r\nexport type DocumentContextValue = { document: Document; id: DocumentID }\r\nconst DocumentContext = createContext<DocumentContextValue | null>(null);\r\n\r\nexport const DocumentProvider: React.FC<{ children: React.ReactNode } & DocumentContextValue> = ({ document, id, children }) => {\r\n return (\r\n <DocumentContext.Provider value={{ document, id }}>\r\n {children}\r\n </DocumentContext.Provider>\r\n );\r\n}\r\n\r\nexport const useDocument = (): DocumentContextValue => {\r\n const context = useContext(DocumentContext);\r\n if (typeof window === 'undefined') {\r\n return null as any;\r\n }\r\n return context as DocumentContextValue\r\n}"],"names":[],"mappings":";;;;AAMA;AAEO;AACJ;AAKH;AAEO;AACJ;AACA;AACG;;AAEH;AACH;;"}
|
package/Iframe/index.cjs
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
var tslib = require('tslib');
|
|
5
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
6
|
+
var React = require('react');
|
|
7
|
+
var core = require('../theme/core.cjs');
|
|
8
|
+
require('../css/getValue.cjs');
|
|
9
|
+
require('oncss');
|
|
10
|
+
require('../theme/ThemeProvider.cjs');
|
|
11
|
+
require('react-state-bucket');
|
|
12
|
+
var index$1 = require('../Tag/index.cjs');
|
|
13
|
+
var reactDom = require('react-dom');
|
|
14
|
+
var index$2 = require('../AppRoot/index.cjs');
|
|
15
|
+
var useMergeRefs = require('../hooks/useMergeRefs.cjs');
|
|
16
|
+
|
|
17
|
+
const IframeContext = React.createContext({
|
|
18
|
+
document: null,
|
|
19
|
+
window: null,
|
|
20
|
+
});
|
|
21
|
+
const Iframe = (_a, ref) => {
|
|
22
|
+
var { children, sxr, theme, CSSCacheId } = _a, props = tslib.__rest(_a, ["children", "sxr", "theme", "CSSCacheId"]);
|
|
23
|
+
const [doc, setDoc] = React.useState(null);
|
|
24
|
+
const iframeRef = React.useRef(null);
|
|
25
|
+
const _ref = useMergeRefs(iframeRef, ref);
|
|
26
|
+
const parentTheme = core.useTheme();
|
|
27
|
+
theme !== null && theme !== void 0 ? theme : (theme = parentTheme.name);
|
|
28
|
+
React.useEffect(() => {
|
|
29
|
+
if (!iframeRef.current)
|
|
30
|
+
return;
|
|
31
|
+
const iframe = iframeRef.current;
|
|
32
|
+
const onLoad = () => setDoc(iframe.contentDocument);
|
|
33
|
+
iframe.addEventListener("load", onLoad);
|
|
34
|
+
return () => iframe.removeEventListener("load", onLoad);
|
|
35
|
+
}, []);
|
|
36
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(index$1, Object.assign({}, props, { component: "iframe", sxr: Object.assign({ border: 'none', width: "100%", height: "100%", p: 0, m: 0 }, sxr), ref: _ref, srcDoc: "<!DOCTYPE html><html><head></head><body></body></html>" })), doc &&
|
|
37
|
+
reactDom.createPortal(jsxRuntime.jsx(IframeContext.Provider, { value: {
|
|
38
|
+
document: doc,
|
|
39
|
+
window: doc.defaultView,
|
|
40
|
+
}, children: jsxRuntime.jsx(index$2, { theme: theme, document: doc, CSSCacheId: CSSCacheId, children: children }) }), doc.body)] }));
|
|
41
|
+
};
|
|
42
|
+
var index = React.forwardRef(Iframe);
|
|
43
|
+
|
|
44
|
+
module.exports = index;
|
|
45
|
+
//# sourceMappingURL=index.cjs.map
|