@xanui/core 1.2.53 → 1.2.55
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/AppRootProvider.cjs +1 -0
- package/AppRoot/AppRootProvider.cjs.map +1 -1
- package/AppRoot/AppRootProvider.js +1 -0
- package/AppRoot/AppRootProvider.js.map +1 -1
- package/AppRoot/Renderar.cjs +10 -22
- package/AppRoot/Renderar.cjs.map +1 -1
- package/AppRoot/Renderar.d.ts +3 -3
- package/AppRoot/Renderar.js +13 -25
- package/AppRoot/Renderar.js.map +1 -1
- package/AppRoot/index.cjs +3 -3
- package/AppRoot/index.cjs.map +1 -1
- package/AppRoot/index.js +3 -3
- package/AppRoot/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppRootProvider.cjs","sources":["../../src/AppRoot/AppRootProvider.tsx"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"AppRootProvider.cjs","sources":["../../src/AppRoot/AppRootProvider.tsx"],"sourcesContent":["\"use client\"\r\nimport React from \"react\";\r\n\r\nconst AppRootContext = React.createContext<(() => HTMLElement | null) | 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\r\n return context!() as HTMLElement\r\n}\r\n"],"names":[],"mappings":";;;;;;AAGA;AAEO;AACJ;AAKH;AAEO;;AAEJ;AACG;;;AAIN;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppRootProvider.js","sources":["../../src/AppRoot/AppRootProvider.tsx"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"AppRootProvider.js","sources":["../../src/AppRoot/AppRootProvider.tsx"],"sourcesContent":["\"use client\"\r\nimport React from \"react\";\r\n\r\nconst AppRootContext = React.createContext<(() => HTMLElement | null) | 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\r\n return context!() as HTMLElement\r\n}\r\n"],"names":[],"mappings":";;;;AAGA;AAEO;AACJ;AAKH;AAEO;;AAEJ;AACG;;;AAIN;;"}
|
package/AppRoot/Renderar.cjs
CHANGED
|
@@ -8,16 +8,11 @@ let dispatch = null;
|
|
|
8
8
|
class Renderar {
|
|
9
9
|
static render(component, props) {
|
|
10
10
|
Components.push({ component, props });
|
|
11
|
-
if (dispatch)
|
|
11
|
+
if (dispatch)
|
|
12
12
|
dispatch();
|
|
13
|
-
}
|
|
14
13
|
return {
|
|
15
|
-
unrender: () =>
|
|
16
|
-
|
|
17
|
-
},
|
|
18
|
-
updateProps: (newProps) => {
|
|
19
|
-
this.updateProps(component, newProps);
|
|
20
|
-
}
|
|
14
|
+
unrender: () => this.unrender(component),
|
|
15
|
+
updateProps: (newProps) => this.updateProps(component, newProps),
|
|
21
16
|
};
|
|
22
17
|
}
|
|
23
18
|
static unrender(component) {
|
|
@@ -29,25 +24,18 @@ class Renderar {
|
|
|
29
24
|
}
|
|
30
25
|
}
|
|
31
26
|
static updateProps(component, props) {
|
|
32
|
-
const
|
|
33
|
-
if (
|
|
34
|
-
|
|
35
|
-
}
|
|
27
|
+
const stored = Components.find((c) => c.component === component);
|
|
28
|
+
if (stored)
|
|
29
|
+
stored.props = Object.assign(Object.assign({}, stored.props), props);
|
|
36
30
|
if (dispatch)
|
|
37
31
|
dispatch();
|
|
38
32
|
}
|
|
39
33
|
}
|
|
40
|
-
const RenderRenderar =
|
|
34
|
+
const RenderRenderar = () => {
|
|
41
35
|
const [, setState] = React.useState(0);
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
return Components.map(({ component: Component, props }, index) => {
|
|
48
|
-
return jsxRuntime.jsx(Component, Object.assign({}, props), index);
|
|
49
|
-
});
|
|
50
|
-
});
|
|
36
|
+
dispatch = () => setState((prev) => prev + 1);
|
|
37
|
+
return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: Components.map(({ component: Component, props }, i) => (jsxRuntime.jsx(Component, Object.assign({}, props), i))) }));
|
|
38
|
+
};
|
|
51
39
|
|
|
52
40
|
exports.RenderRenderar = RenderRenderar;
|
|
53
41
|
exports.Renderar = Renderar;
|
package/AppRoot/Renderar.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Renderar.cjs","sources":["../../src/AppRoot/Renderar.tsx"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"Renderar.cjs","sources":["../../src/AppRoot/Renderar.tsx"],"sourcesContent":["// Renderar.tsx\r\nimport React, { useState } from \"react\";\r\n\r\ntype StoredComponent = {\r\n component: React.FC<any>;\r\n props: any;\r\n};\r\n\r\nconst Components: StoredComponent[] = [];\r\nlet dispatch: (() => void) | null = null;\r\n\r\nexport class Renderar {\r\n static render(component: React.FC, props?: any) {\r\n Components.push({ component, props });\r\n if (dispatch) dispatch();\r\n return {\r\n unrender: () => this.unrender(component),\r\n updateProps: (newProps: any) => this.updateProps(component, newProps),\r\n };\r\n }\r\n\r\n static unrender(component: React.FC) {\r\n const index = Components.findIndex((c) => c.component === component);\r\n if (index > -1) {\r\n Components.splice(index, 1);\r\n if (dispatch) dispatch();\r\n }\r\n }\r\n\r\n static updateProps(component: React.FC, props: any) {\r\n const stored = Components.find((c) => c.component === component);\r\n if (stored) stored.props = { ...stored.props, ...props };\r\n if (dispatch) dispatch();\r\n }\r\n}\r\n\r\nexport const RenderRenderar = () => {\r\n const [, setState] = useState(0);\r\n dispatch = () => setState((prev) => prev + 1);\r\n\r\n return (\r\n <>\r\n {Components.map(({ component: Component, props }, i) => (\r\n <Component key={i} {...props} />\r\n ))}\r\n </>\r\n );\r\n};"],"names":["useState","_jsx","_Fragment"],"mappings":";;;;;AAQA,MAAM,UAAU,GAAsB,EAAE;AACxC,IAAI,QAAQ,GAAwB,IAAI;MAE3B,QAAQ,CAAA;AAClB,IAAA,OAAO,MAAM,CAAC,SAAmB,EAAE,KAAW,EAAA;QAC3C,UAAU,CAAC,IAAI,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;AACrC,QAAA,IAAI,QAAQ;AAAE,YAAA,QAAQ,EAAE;QACxB,OAAO;YACJ,QAAQ,EAAE,MAAM,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC;AACxC,YAAA,WAAW,EAAE,CAAC,QAAa,KAAK,IAAI,CAAC,WAAW,CAAC,SAAS,EAAE,QAAQ,CAAC;SACvE;IACJ;IAEA,OAAO,QAAQ,CAAC,SAAmB,EAAA;AAChC,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,SAAmB,EAAE,KAAU,EAAA;AAC/C,QAAA,MAAM,MAAM,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,SAAS,KAAK,SAAS,CAAC;AAChE,QAAA,IAAI,MAAM;YAAE,MAAM,CAAC,KAAK,GAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,EAAA,EAAQ,MAAM,CAAC,KAAK,CAAA,EAAK,KAAK,CAAE;AACxD,QAAA,IAAI,QAAQ;AAAE,YAAA,QAAQ,EAAE;IAC3B;AACF;AAEM,MAAM,cAAc,GAAG,MAAK;IAChC,MAAM,GAAG,QAAQ,CAAC,GAAGA,cAAQ,CAAC,CAAC,CAAC;AAChC,IAAA,QAAQ,GAAG,MAAM,QAAQ,CAAC,CAAC,IAAI,KAAK,IAAI,GAAG,CAAC,CAAC;AAE7C,IAAA,QACGC,cAAA,CAAAC,mBAAA,EAAA,EAAA,QAAA,EACI,UAAU,CAAC,GAAG,CAAC,CAAC,EAAE,SAAS,EAAE,SAAS,EAAE,KAAK,EAAE,EAAE,CAAC,MAChDD,cAAA,CAAC,SAAS,EAAA,MAAA,CAAA,MAAA,CAAA,EAAA,EAAa,KAAK,CAAA,EAAZ,CAAC,CAAe,CAClC,CAAC,EAAA,CACF;AAET;;;;;"}
|
package/AppRoot/Renderar.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import React__default from 'react';
|
|
2
2
|
|
|
3
3
|
declare class Renderar {
|
|
4
|
-
static render(component: React__default.
|
|
4
|
+
static render(component: React__default.FC, props?: any): {
|
|
5
5
|
unrender: () => void;
|
|
6
6
|
updateProps: (newProps: any) => void;
|
|
7
7
|
};
|
|
8
|
-
static unrender(component: React__default.
|
|
9
|
-
static updateProps(component: React__default.
|
|
8
|
+
static unrender(component: React__default.FC): void;
|
|
9
|
+
static updateProps(component: React__default.FC, props: any): void;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
export { Renderar };
|
package/AppRoot/Renderar.js
CHANGED
|
@@ -1,21 +1,16 @@
|
|
|
1
|
-
import { jsx } from 'react/jsx-runtime';
|
|
2
|
-
import
|
|
1
|
+
import { jsx, Fragment } from 'react/jsx-runtime';
|
|
2
|
+
import { useState } from 'react';
|
|
3
3
|
|
|
4
4
|
const Components = [];
|
|
5
5
|
let dispatch = null;
|
|
6
6
|
class Renderar {
|
|
7
7
|
static render(component, props) {
|
|
8
8
|
Components.push({ component, props });
|
|
9
|
-
if (dispatch)
|
|
9
|
+
if (dispatch)
|
|
10
10
|
dispatch();
|
|
11
|
-
}
|
|
12
11
|
return {
|
|
13
|
-
unrender: () =>
|
|
14
|
-
|
|
15
|
-
},
|
|
16
|
-
updateProps: (newProps) => {
|
|
17
|
-
this.updateProps(component, newProps);
|
|
18
|
-
}
|
|
12
|
+
unrender: () => this.unrender(component),
|
|
13
|
+
updateProps: (newProps) => this.updateProps(component, newProps),
|
|
19
14
|
};
|
|
20
15
|
}
|
|
21
16
|
static unrender(component) {
|
|
@@ -27,25 +22,18 @@ class Renderar {
|
|
|
27
22
|
}
|
|
28
23
|
}
|
|
29
24
|
static updateProps(component, props) {
|
|
30
|
-
const
|
|
31
|
-
if (
|
|
32
|
-
|
|
33
|
-
}
|
|
25
|
+
const stored = Components.find((c) => c.component === component);
|
|
26
|
+
if (stored)
|
|
27
|
+
stored.props = Object.assign(Object.assign({}, stored.props), props);
|
|
34
28
|
if (dispatch)
|
|
35
29
|
dispatch();
|
|
36
30
|
}
|
|
37
31
|
}
|
|
38
|
-
const RenderRenderar =
|
|
39
|
-
const [, setState] =
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
return Components.map(({ component: Component, props }, index) => {
|
|
46
|
-
return jsx(Component, Object.assign({}, props), index);
|
|
47
|
-
});
|
|
48
|
-
});
|
|
32
|
+
const RenderRenderar = () => {
|
|
33
|
+
const [, setState] = useState(0);
|
|
34
|
+
dispatch = () => setState((prev) => prev + 1);
|
|
35
|
+
return (jsx(Fragment, { children: Components.map(({ component: Component, props }, i) => (jsx(Component, Object.assign({}, props), i))) }));
|
|
36
|
+
};
|
|
49
37
|
|
|
50
38
|
export { RenderRenderar, Renderar };
|
|
51
39
|
//# sourceMappingURL=Renderar.js.map
|
package/AppRoot/Renderar.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Renderar.js","sources":["../../src/AppRoot/Renderar.tsx"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"Renderar.js","sources":["../../src/AppRoot/Renderar.tsx"],"sourcesContent":["// Renderar.tsx\r\nimport React, { useState } from \"react\";\r\n\r\ntype StoredComponent = {\r\n component: React.FC<any>;\r\n props: any;\r\n};\r\n\r\nconst Components: StoredComponent[] = [];\r\nlet dispatch: (() => void) | null = null;\r\n\r\nexport class Renderar {\r\n static render(component: React.FC, props?: any) {\r\n Components.push({ component, props });\r\n if (dispatch) dispatch();\r\n return {\r\n unrender: () => this.unrender(component),\r\n updateProps: (newProps: any) => this.updateProps(component, newProps),\r\n };\r\n }\r\n\r\n static unrender(component: React.FC) {\r\n const index = Components.findIndex((c) => c.component === component);\r\n if (index > -1) {\r\n Components.splice(index, 1);\r\n if (dispatch) dispatch();\r\n }\r\n }\r\n\r\n static updateProps(component: React.FC, props: any) {\r\n const stored = Components.find((c) => c.component === component);\r\n if (stored) stored.props = { ...stored.props, ...props };\r\n if (dispatch) dispatch();\r\n }\r\n}\r\n\r\nexport const RenderRenderar = () => {\r\n const [, setState] = useState(0);\r\n dispatch = () => setState((prev) => prev + 1);\r\n\r\n return (\r\n <>\r\n {Components.map(({ component: Component, props }, i) => (\r\n <Component key={i} {...props} />\r\n ))}\r\n </>\r\n );\r\n};"],"names":["_jsx","_Fragment"],"mappings":";;;AAQA,MAAM,UAAU,GAAsB,EAAE;AACxC,IAAI,QAAQ,GAAwB,IAAI;MAE3B,QAAQ,CAAA;AAClB,IAAA,OAAO,MAAM,CAAC,SAAmB,EAAE,KAAW,EAAA;QAC3C,UAAU,CAAC,IAAI,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;AACrC,QAAA,IAAI,QAAQ;AAAE,YAAA,QAAQ,EAAE;QACxB,OAAO;YACJ,QAAQ,EAAE,MAAM,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC;AACxC,YAAA,WAAW,EAAE,CAAC,QAAa,KAAK,IAAI,CAAC,WAAW,CAAC,SAAS,EAAE,QAAQ,CAAC;SACvE;IACJ;IAEA,OAAO,QAAQ,CAAC,SAAmB,EAAA;AAChC,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,SAAmB,EAAE,KAAU,EAAA;AAC/C,QAAA,MAAM,MAAM,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,SAAS,KAAK,SAAS,CAAC;AAChE,QAAA,IAAI,MAAM;YAAE,MAAM,CAAC,KAAK,GAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,EAAA,EAAQ,MAAM,CAAC,KAAK,CAAA,EAAK,KAAK,CAAE;AACxD,QAAA,IAAI,QAAQ;AAAE,YAAA,QAAQ,EAAE;IAC3B;AACF;AAEM,MAAM,cAAc,GAAG,MAAK;IAChC,MAAM,GAAG,QAAQ,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC;AAChC,IAAA,QAAQ,GAAG,MAAM,QAAQ,CAAC,CAAC,IAAI,KAAK,IAAI,GAAG,CAAC,CAAC;AAE7C,IAAA,QACGA,GAAA,CAAAC,QAAA,EAAA,EAAA,QAAA,EACI,UAAU,CAAC,GAAG,CAAC,CAAC,EAAE,SAAS,EAAE,SAAS,EAAE,KAAK,EAAE,EAAE,CAAC,MAChDD,GAAA,CAAC,SAAS,EAAA,MAAA,CAAA,MAAA,CAAA,EAAA,EAAa,KAAK,CAAA,EAAZ,CAAC,CAAe,CAClC,CAAC,EAAA,CACF;AAET;;;;"}
|
package/AppRoot/index.cjs
CHANGED
|
@@ -27,11 +27,11 @@ const AppRoot = React.forwardRef((_a, ref) => {
|
|
|
27
27
|
const docid = React.useId();
|
|
28
28
|
const csscacheId = React.useId();
|
|
29
29
|
CSSCacheId !== null && CSSCacheId !== void 0 ? CSSCacheId : (CSSCacheId = csscacheId);
|
|
30
|
-
const [visibility, setVisibility] = React.useState("hidden");
|
|
30
|
+
// const [visibility, setVisibility] = React.useState<string>("hidden");
|
|
31
31
|
const rootRef = React.useRef(null);
|
|
32
32
|
const mergeRef = useMergeRefs(rootRef, ref);
|
|
33
33
|
React.useEffect(() => {
|
|
34
|
-
setVisibility("visible");
|
|
34
|
+
// setVisibility("visible");
|
|
35
35
|
// move oncss style tags to head
|
|
36
36
|
if (typeof _document === 'undefined')
|
|
37
37
|
return;
|
|
@@ -49,7 +49,7 @@ const AppRoot = React.forwardRef((_a, ref) => {
|
|
|
49
49
|
}
|
|
50
50
|
};
|
|
51
51
|
}
|
|
52
|
-
return (jsxRuntime.jsx(index.DocumentProvider, { value: _document ? { document: _document, id: docid } : undefined, children: jsxRuntime.jsx(CSSCacheProvider.CSSCacheProvider, { cacheId: CSSCacheId, children: jsxRuntime.jsx(AppRootProvider.AppRootProvider, { element: () => rootRef.current, children: jsxRuntime.jsx(ThemeProvider, Object.assign({ theme: theme }, props, { ref: mergeRef, isRoot: true, sx: Object.assign(Object.assign(
|
|
52
|
+
return (jsxRuntime.jsx(index.DocumentProvider, { value: _document ? { document: _document, id: docid } : undefined, children: jsxRuntime.jsx(CSSCacheProvider.CSSCacheProvider, { cacheId: CSSCacheId, children: jsxRuntime.jsx(AppRootProvider.AppRootProvider, { element: () => rootRef.current, children: jsxRuntime.jsx(ThemeProvider, Object.assign({ theme: theme }, props, { ref: mergeRef, isRoot: true, sx: Object.assign(Object.assign({}, props.sx), selection), children: jsxRuntime.jsxs(BreakpointProvider.BreakpointProvider, { children: [children, !disableRenderar && jsxRuntime.jsx(Renderar.RenderRenderar, {})] }) })) }) }) }));
|
|
53
53
|
});
|
|
54
54
|
|
|
55
55
|
module.exports = AppRoot;
|
package/AppRoot/index.cjs.map
CHANGED
|
@@ -1 +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 disableRenderar?: boolean;\r\n selectionColor?: \"default\" | \"brand\" | \"accent\" | \"success\" | \"info\" | \"warning\" | \"danger\";\r\n}\r\n\r\nconst AppRoot = React.forwardRef(<T extends TagComponentType = \"div\">({ children, noScrollbarCss, CSSCacheId, theme, disableRenderar, selectionColor, document: _document, ...props }: AppRootProps<T>, ref: React.Ref<any>) => {\r\n noScrollbarCss ??= false\r\n selectionColor ??= \"brand\"\r\n if (typeof window !== \"undefined\") {\r\n _document ??= document\r\n }\r\n disableRenderar ??= false\r\n const docid = useId()\r\n const csscacheId = useId()\r\n CSSCacheId ??= csscacheId\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 let selection: any = {}\r\n if (selectionColor && selectionColor !== 'default') {\r\n selection = {\r\n \"&::selection\": {\r\n bgcolor: `${selectionColor}.primary`,\r\n color: `${selectionColor}.text`\r\n }\r\n }\r\n }\r\n\r\n return (\r\n <DocumentProvider value={_document ? { document: _document, id: docid } : undefined}>\r\n <CSSCacheProvider cacheId={CSSCacheId}>\r\n <AppRootProvider element={() => rootRef.current}>\r\n <ThemeProvider\r\n theme={theme}\r\n {...props}\r\n ref={mergeRef}\r\n isRoot\r\n sx={{\r\n ...props.sx,\r\n ...(visibility === \"hidden\" ? { visibility: \"hidden\" } : {}),\r\n ...selection\r\n }}\r\n >\r\n <BreakpointProvider>\r\n {children}\r\n {!disableRenderar && <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":";;;;;;;;;;;;;;;;;;AAmBA;;;;AAGG;;;;AAIA;AACA
|
|
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 disableRenderar?: boolean;\r\n selectionColor?: \"default\" | \"brand\" | \"accent\" | \"success\" | \"info\" | \"warning\" | \"danger\";\r\n}\r\n\r\nconst AppRoot = React.forwardRef(<T extends TagComponentType = \"div\">({ children, noScrollbarCss, CSSCacheId, theme, disableRenderar, selectionColor, document: _document, ...props }: AppRootProps<T>, ref: React.Ref<any>) => {\r\n noScrollbarCss ??= false\r\n selectionColor ??= \"brand\"\r\n if (typeof window !== \"undefined\") {\r\n _document ??= document\r\n }\r\n disableRenderar ??= false\r\n const docid = useId()\r\n const csscacheId = useId()\r\n CSSCacheId ??= csscacheId\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 let selection: any = {}\r\n if (selectionColor && selectionColor !== 'default') {\r\n selection = {\r\n \"&::selection\": {\r\n bgcolor: `${selectionColor}.primary`,\r\n color: `${selectionColor}.text`\r\n }\r\n }\r\n }\r\n\r\n return (\r\n <DocumentProvider value={_document ? { document: _document, id: docid } : undefined}>\r\n <CSSCacheProvider cacheId={CSSCacheId}>\r\n <AppRootProvider element={() => rootRef.current}>\r\n <ThemeProvider\r\n theme={theme}\r\n {...props}\r\n ref={mergeRef}\r\n isRoot\r\n sx={{\r\n ...props.sx,\r\n // ...(visibility === \"hidden\" ? { visibility: \"hidden\" } : {}),\r\n ...selection\r\n }}\r\n >\r\n <BreakpointProvider>\r\n {children}\r\n {!disableRenderar && <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":";;;;;;;;;;;;;;;;;;AAmBA;;;;AAGG;;;;AAIA;AACA;;;AAIA;;;;;;;AAQG;AACA;AACG;AACH;;;AAGH;AACG;AACG;;;AAGC;;;AAIP;AAwBH;;"}
|
package/AppRoot/index.js
CHANGED
|
@@ -25,11 +25,11 @@ const AppRoot = React__default.forwardRef((_a, ref) => {
|
|
|
25
25
|
const docid = useId();
|
|
26
26
|
const csscacheId = useId();
|
|
27
27
|
CSSCacheId !== null && CSSCacheId !== void 0 ? CSSCacheId : (CSSCacheId = csscacheId);
|
|
28
|
-
const [visibility, setVisibility] =
|
|
28
|
+
// const [visibility, setVisibility] = React.useState<string>("hidden");
|
|
29
29
|
const rootRef = useRef(null);
|
|
30
30
|
const mergeRef = useMergeRefs(rootRef, ref);
|
|
31
31
|
useEffect(() => {
|
|
32
|
-
setVisibility("visible");
|
|
32
|
+
// setVisibility("visible");
|
|
33
33
|
// move oncss style tags to head
|
|
34
34
|
if (typeof _document === 'undefined')
|
|
35
35
|
return;
|
|
@@ -47,7 +47,7 @@ const AppRoot = React__default.forwardRef((_a, ref) => {
|
|
|
47
47
|
}
|
|
48
48
|
};
|
|
49
49
|
}
|
|
50
|
-
return (jsx(DocumentProvider, { value: _document ? { document: _document, id: docid } : undefined, children: jsx(CSSCacheProvider, { cacheId: CSSCacheId, children: jsx(AppRootProvider, { element: () => rootRef.current, children: jsx(ThemeProvider, Object.assign({ theme: theme }, props, { ref: mergeRef, isRoot: true, sx: Object.assign(Object.assign(
|
|
50
|
+
return (jsx(DocumentProvider, { value: _document ? { document: _document, id: docid } : undefined, children: jsx(CSSCacheProvider, { cacheId: CSSCacheId, children: jsx(AppRootProvider, { element: () => rootRef.current, children: jsx(ThemeProvider, Object.assign({ theme: theme }, props, { ref: mergeRef, isRoot: true, sx: Object.assign(Object.assign({}, props.sx), selection), children: jsxs(BreakpointProvider, { children: [children, !disableRenderar && jsx(RenderRenderar, {})] }) })) }) }) }));
|
|
51
51
|
});
|
|
52
52
|
|
|
53
53
|
export { AppRoot as default };
|
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, 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 disableRenderar?: boolean;\r\n selectionColor?: \"default\" | \"brand\" | \"accent\" | \"success\" | \"info\" | \"warning\" | \"danger\";\r\n}\r\n\r\nconst AppRoot = React.forwardRef(<T extends TagComponentType = \"div\">({ children, noScrollbarCss, CSSCacheId, theme, disableRenderar, selectionColor, document: _document, ...props }: AppRootProps<T>, ref: React.Ref<any>) => {\r\n noScrollbarCss ??= false\r\n selectionColor ??= \"brand\"\r\n if (typeof window !== \"undefined\") {\r\n _document ??= document\r\n }\r\n disableRenderar ??= false\r\n const docid = useId()\r\n const csscacheId = useId()\r\n CSSCacheId ??= csscacheId\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 let selection: any = {}\r\n if (selectionColor && selectionColor !== 'default') {\r\n selection = {\r\n \"&::selection\": {\r\n bgcolor: `${selectionColor}.primary`,\r\n color: `${selectionColor}.text`\r\n }\r\n }\r\n }\r\n\r\n return (\r\n <DocumentProvider value={_document ? { document: _document, id: docid } : undefined}>\r\n <CSSCacheProvider cacheId={CSSCacheId}>\r\n <AppRootProvider element={() => rootRef.current}>\r\n <ThemeProvider\r\n theme={theme}\r\n {...props}\r\n ref={mergeRef}\r\n isRoot\r\n sx={{\r\n ...props.sx,\r\n ...(visibility === \"hidden\" ? { visibility: \"hidden\" } : {}),\r\n ...selection\r\n }}\r\n >\r\n <BreakpointProvider>\r\n {children}\r\n {!disableRenderar && <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":";;;;;;;;;;;;;;;;AAmBA;;;;AAGG;;;;AAIA;AACA
|
|
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 disableRenderar?: boolean;\r\n selectionColor?: \"default\" | \"brand\" | \"accent\" | \"success\" | \"info\" | \"warning\" | \"danger\";\r\n}\r\n\r\nconst AppRoot = React.forwardRef(<T extends TagComponentType = \"div\">({ children, noScrollbarCss, CSSCacheId, theme, disableRenderar, selectionColor, document: _document, ...props }: AppRootProps<T>, ref: React.Ref<any>) => {\r\n noScrollbarCss ??= false\r\n selectionColor ??= \"brand\"\r\n if (typeof window !== \"undefined\") {\r\n _document ??= document\r\n }\r\n disableRenderar ??= false\r\n const docid = useId()\r\n const csscacheId = useId()\r\n CSSCacheId ??= csscacheId\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 let selection: any = {}\r\n if (selectionColor && selectionColor !== 'default') {\r\n selection = {\r\n \"&::selection\": {\r\n bgcolor: `${selectionColor}.primary`,\r\n color: `${selectionColor}.text`\r\n }\r\n }\r\n }\r\n\r\n return (\r\n <DocumentProvider value={_document ? { document: _document, id: docid } : undefined}>\r\n <CSSCacheProvider cacheId={CSSCacheId}>\r\n <AppRootProvider element={() => rootRef.current}>\r\n <ThemeProvider\r\n theme={theme}\r\n {...props}\r\n ref={mergeRef}\r\n isRoot\r\n sx={{\r\n ...props.sx,\r\n // ...(visibility === \"hidden\" ? { visibility: \"hidden\" } : {}),\r\n ...selection\r\n }}\r\n >\r\n <BreakpointProvider>\r\n {children}\r\n {!disableRenderar && <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":";;;;;;;;;;;;;;;;AAmBA;;;;AAGG;;;;AAIA;AACA;;;AAIA;;;;;;;AAQG;AACA;AACG;AACH;;;AAGH;AACG;AACG;;;AAGC;;;AAIP;AAwBH;;"}
|