react-admin-base-bootstrap 0.9.1 → 0.9.2

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.
@@ -6,15 +6,15 @@ export default function ThemeProvider({ themes, defaultTheme, children }: {
6
6
  defaultTheme: any;
7
7
  children: any;
8
8
  }): React.JSX.Element;
9
- export declare function rawCssLoader(cb: any): Promise<{
9
+ export declare function rawCssLoader(cb: any): () => {
10
10
  default: {
11
11
  use: () => Promise<void>;
12
12
  unuse: () => void;
13
13
  };
14
- }>;
15
- export declare function urlCssLoader(link: any): Promise<{
14
+ };
15
+ export declare function urlCssLoader(link: any): () => {
16
16
  default: {
17
17
  use: () => void;
18
18
  unuse: () => void;
19
19
  };
20
- }>;
20
+ };
@@ -22,7 +22,7 @@ export default function ThemeProvider({ themes, defaultTheme, children }) {
22
22
  const [theme, setTheme] = state;
23
23
  const rTheme = theme || defaultTheme || 'light';
24
24
  useEffect(function () {
25
- const promise = (themes[rTheme] || themes[defaultTheme]).css()
25
+ const promise = Promise.resolve((themes[rTheme] || themes[defaultTheme]).css())
26
26
  .then(css => {
27
27
  css.default.use();
28
28
  return css;
@@ -36,42 +36,38 @@ export default function ThemeProvider({ themes, defaultTheme, children }) {
36
36
  React.createElement(ThemeContext.Provider, { value: val }, children));
37
37
  }
38
38
  export function rawCssLoader(cb) {
39
- return __awaiter(this, void 0, void 0, function* () {
40
- const styleTag = document.createElement('style');
41
- let loaded = false;
42
- return {
43
- default: {
44
- use: function () {
45
- return __awaiter(this, void 0, void 0, function* () {
46
- document.head.appendChild(styleTag);
47
- if (!loaded) {
48
- loaded = true;
49
- styleTag.innerHTML = yield cb();
50
- }
51
- });
52
- },
53
- unuse: function () {
54
- document.head.removeChild(styleTag);
55
- }
39
+ const styleTag = document.createElement('style');
40
+ let loaded = false;
41
+ return () => ({
42
+ default: {
43
+ use: function () {
44
+ return __awaiter(this, void 0, void 0, function* () {
45
+ document.head.appendChild(styleTag);
46
+ if (!loaded) {
47
+ loaded = true;
48
+ styleTag.innerHTML = yield cb();
49
+ }
50
+ });
51
+ },
52
+ unuse: function () {
53
+ document.head.removeChild(styleTag);
56
54
  }
57
- };
55
+ }
58
56
  });
59
57
  }
60
58
  export function urlCssLoader(link) {
61
- return __awaiter(this, void 0, void 0, function* () {
62
- const linkTag = document.createElement('link');
63
- linkTag.rel = 'stylesheet';
64
- linkTag.type = 'text/css';
65
- linkTag.href = link;
66
- return {
67
- default: {
68
- use: function () {
69
- document.head.appendChild(linkTag);
70
- },
71
- unuse: function () {
72
- document.head.removeChild(linkTag);
73
- }
59
+ const linkTag = document.createElement('link');
60
+ linkTag.rel = 'stylesheet';
61
+ linkTag.type = 'text/css';
62
+ linkTag.href = link;
63
+ return () => ({
64
+ default: {
65
+ use: function () {
66
+ document.head.appendChild(linkTag);
67
+ },
68
+ unuse: function () {
69
+ document.head.removeChild(linkTag);
74
70
  }
75
- };
71
+ }
76
72
  });
77
73
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-admin-base-bootstrap",
3
- "version": "0.9.1",
3
+ "version": "0.9.2",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1",
@@ -19,7 +19,7 @@ export default function ThemeProvider({ themes, defaultTheme, children }) {
19
19
  const rTheme = theme || defaultTheme || 'light';
20
20
 
21
21
  useEffect(function() {
22
- const promise = (themes[rTheme] || themes[defaultTheme]).css()
22
+ const promise = Promise.resolve((themes[rTheme] || themes[defaultTheme]).css())
23
23
  .then(css => {
24
24
  css.default.use();
25
25
  return css;
@@ -39,12 +39,12 @@ export default function ThemeProvider({ themes, defaultTheme, children }) {
39
39
  </AllThemesContext.Provider>;
40
40
  }
41
41
 
42
- export async function rawCssLoader(cb) {
42
+ export function rawCssLoader(cb) {
43
43
  const styleTag = document.createElement('style');
44
44
 
45
45
  let loaded = false;
46
46
 
47
- return {
47
+ return () => ({
48
48
  default: {
49
49
  use: async function() {
50
50
  document.head.appendChild(styleTag);
@@ -58,23 +58,23 @@ export async function rawCssLoader(cb) {
58
58
  document.head.removeChild(styleTag);
59
59
  }
60
60
  }
61
- };
61
+ });
62
62
  }
63
63
 
64
- export async function urlCssLoader(link) {
64
+ export function urlCssLoader(link) {
65
65
  const linkTag = document.createElement('link');
66
66
  linkTag.rel = 'stylesheet';
67
67
  linkTag.type = 'text/css';
68
68
  linkTag.href = link;
69
69
 
70
- return {
70
+ return () => ({
71
71
  default: {
72
72
  use: function() {
73
73
  document.head.appendChild(linkTag);
74
- },
74
+ },
75
75
  unuse: function() {
76
76
  document.head.removeChild(linkTag);
77
77
  }
78
78
  }
79
- };
79
+ });
80
80
  }