@tanstack/react-query-devtools 4.39.0 → 4.39.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.
- package/build/lib/Explorer.esm.js +264 -0
- package/build/lib/Explorer.esm.js.map +1 -0
- package/build/lib/Explorer.js +302 -0
- package/build/lib/Explorer.js.map +1 -0
- package/build/lib/Explorer.mjs +264 -0
- package/build/lib/Explorer.mjs.map +1 -0
- package/build/lib/Logo.esm.js +32 -0
- package/build/lib/Logo.esm.js.map +1 -0
- package/build/lib/Logo.js +56 -0
- package/build/lib/Logo.js.map +1 -0
- package/build/lib/Logo.mjs +32 -0
- package/build/lib/Logo.mjs.map +1 -0
- package/build/lib/_virtual/_rollupPluginBabelHelpers.esm.js +19 -0
- package/build/lib/_virtual/_rollupPluginBabelHelpers.esm.js.map +1 -0
- package/build/lib/_virtual/_rollupPluginBabelHelpers.js +23 -0
- package/build/lib/_virtual/_rollupPluginBabelHelpers.js.map +1 -0
- package/build/lib/_virtual/_rollupPluginBabelHelpers.mjs +19 -0
- package/build/lib/_virtual/_rollupPluginBabelHelpers.mjs.map +1 -0
- package/build/lib/devtools.esm.js +925 -0
- package/build/lib/devtools.esm.js.map +1 -0
- package/build/lib/devtools.js +949 -0
- package/build/lib/devtools.js.map +1 -0
- package/build/lib/devtools.mjs +925 -0
- package/build/lib/devtools.mjs.map +1 -0
- package/build/lib/index.esm.js +12 -0
- package/build/lib/index.esm.js.map +1 -0
- package/build/lib/index.js +17 -0
- package/build/lib/index.js.map +1 -0
- package/build/lib/index.mjs +12 -0
- package/build/lib/index.mjs.map +1 -0
- package/build/lib/index.prod.d.ts +4 -0
- package/build/lib/index.prod.esm.js +1604 -0
- package/build/lib/index.prod.esm.js.map +1 -0
- package/build/lib/index.prod.js +1631 -0
- package/build/lib/index.prod.js.map +1 -0
- package/build/lib/index.prod.mjs +1604 -0
- package/build/lib/index.prod.mjs.map +1 -0
- package/build/lib/screenreader.esm.js +17 -0
- package/build/lib/screenreader.esm.js.map +1 -0
- package/build/lib/screenreader.js +41 -0
- package/build/lib/screenreader.js.map +1 -0
- package/build/lib/screenreader.mjs +17 -0
- package/build/lib/screenreader.mjs.map +1 -0
- package/build/lib/styledComponents.esm.js +94 -0
- package/build/lib/styledComponents.esm.js.map +1 -0
- package/build/lib/styledComponents.js +105 -0
- package/build/lib/styledComponents.js.map +1 -0
- package/build/lib/styledComponents.mjs +94 -0
- package/build/lib/styledComponents.mjs.map +1 -0
- package/build/lib/theme.esm.js +33 -0
- package/build/lib/theme.esm.js.map +1 -0
- package/build/lib/theme.js +59 -0
- package/build/lib/theme.js.map +1 -0
- package/build/lib/theme.mjs +33 -0
- package/build/lib/theme.mjs.map +1 -0
- package/build/lib/useLocalStorage.esm.js +47 -0
- package/build/lib/useLocalStorage.esm.js.map +1 -0
- package/build/lib/useLocalStorage.js +71 -0
- package/build/lib/useLocalStorage.js.map +1 -0
- package/build/lib/useLocalStorage.mjs +47 -0
- package/build/lib/useLocalStorage.mjs.map +1 -0
- package/build/lib/useMediaQuery.esm.js +36 -0
- package/build/lib/useMediaQuery.esm.js.map +1 -0
- package/build/lib/useMediaQuery.js +60 -0
- package/build/lib/useMediaQuery.js.map +1 -0
- package/build/lib/useMediaQuery.mjs +36 -0
- package/build/lib/useMediaQuery.mjs.map +1 -0
- package/build/lib/utils.esm.js +186 -0
- package/build/lib/utils.esm.js.map +1 -0
- package/build/lib/utils.js +226 -0
- package/build/lib/utils.js.map +1 -0
- package/build/lib/utils.mjs +186 -0
- package/build/lib/utils.mjs.map +1 -0
- package/build/umd/index.development.js +3531 -0
- package/build/umd/index.development.js.map +1 -0
- package/build/umd/index.production.js +2 -0
- package/build/umd/index.production.js.map +1 -0
- package/package.json +3 -3
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var utils = require('./utils.js');
|
|
6
|
+
|
|
7
|
+
const Panel = utils.styled('div', (_props, theme) => ({
|
|
8
|
+
fontSize: 'clamp(12px, 1.5vw, 14px)',
|
|
9
|
+
fontFamily: "sans-serif",
|
|
10
|
+
display: 'flex',
|
|
11
|
+
backgroundColor: theme.background,
|
|
12
|
+
color: theme.foreground
|
|
13
|
+
}), {
|
|
14
|
+
'(max-width: 700px)': {
|
|
15
|
+
flexDirection: 'column'
|
|
16
|
+
},
|
|
17
|
+
'(max-width: 600px)': {
|
|
18
|
+
fontSize: '.9em' // flexDirection: 'column',
|
|
19
|
+
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
const ActiveQueryPanel = utils.styled('div', () => ({
|
|
23
|
+
flex: '1 1 500px',
|
|
24
|
+
display: 'flex',
|
|
25
|
+
flexDirection: 'column',
|
|
26
|
+
overflow: 'auto',
|
|
27
|
+
height: '100%'
|
|
28
|
+
}), {
|
|
29
|
+
'(max-width: 700px)': (_props, theme) => ({
|
|
30
|
+
borderTop: "2px solid " + theme.gray
|
|
31
|
+
})
|
|
32
|
+
});
|
|
33
|
+
const Button = utils.styled('button', (props, theme) => ({
|
|
34
|
+
appearance: 'none',
|
|
35
|
+
fontSize: '.9em',
|
|
36
|
+
fontWeight: 'bold',
|
|
37
|
+
background: theme.gray,
|
|
38
|
+
border: '0',
|
|
39
|
+
borderRadius: '.3em',
|
|
40
|
+
color: 'white',
|
|
41
|
+
padding: '.5em',
|
|
42
|
+
opacity: props.disabled ? '.5' : undefined,
|
|
43
|
+
cursor: 'pointer'
|
|
44
|
+
}));
|
|
45
|
+
const QueryKeys = utils.styled('span', {
|
|
46
|
+
display: 'flex',
|
|
47
|
+
flexWrap: 'wrap',
|
|
48
|
+
gap: '0.5em',
|
|
49
|
+
fontSize: '0.9em'
|
|
50
|
+
});
|
|
51
|
+
const QueryKey = utils.styled('span', {
|
|
52
|
+
display: 'inline-flex',
|
|
53
|
+
alignItems: 'center',
|
|
54
|
+
padding: '.2em .4em',
|
|
55
|
+
fontWeight: 'bold',
|
|
56
|
+
textShadow: '0 0 10px black',
|
|
57
|
+
borderRadius: '.2em'
|
|
58
|
+
});
|
|
59
|
+
const Code = utils.styled('code', {
|
|
60
|
+
fontSize: '.9em',
|
|
61
|
+
color: 'inherit',
|
|
62
|
+
background: 'inherit'
|
|
63
|
+
});
|
|
64
|
+
const Input = utils.styled('input', (_props, theme) => ({
|
|
65
|
+
backgroundColor: theme.inputBackgroundColor,
|
|
66
|
+
border: 0,
|
|
67
|
+
borderRadius: '.2em',
|
|
68
|
+
color: theme.inputTextColor,
|
|
69
|
+
fontSize: '.9em',
|
|
70
|
+
lineHeight: "1.3",
|
|
71
|
+
padding: '.3em .4em'
|
|
72
|
+
}));
|
|
73
|
+
const Select = utils.styled('select', (_props, theme) => ({
|
|
74
|
+
display: "inline-block",
|
|
75
|
+
fontSize: ".9em",
|
|
76
|
+
fontFamily: "sans-serif",
|
|
77
|
+
fontWeight: 'normal',
|
|
78
|
+
lineHeight: "1.3",
|
|
79
|
+
padding: ".3em 1.5em .3em .5em",
|
|
80
|
+
height: 'auto',
|
|
81
|
+
border: 0,
|
|
82
|
+
borderRadius: ".2em",
|
|
83
|
+
appearance: "none",
|
|
84
|
+
WebkitAppearance: 'none',
|
|
85
|
+
backgroundColor: theme.inputBackgroundColor,
|
|
86
|
+
backgroundImage: "url(\"data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='100' height='100' fill='%23444444'><polygon points='0,25 100,25 50,75'/></svg>\")",
|
|
87
|
+
backgroundRepeat: "no-repeat",
|
|
88
|
+
backgroundPosition: "right .55em center",
|
|
89
|
+
backgroundSize: ".65em auto, 100%",
|
|
90
|
+
color: theme.inputTextColor
|
|
91
|
+
}), {
|
|
92
|
+
'(max-width: 500px)': {
|
|
93
|
+
display: 'none'
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
exports.ActiveQueryPanel = ActiveQueryPanel;
|
|
98
|
+
exports.Button = Button;
|
|
99
|
+
exports.Code = Code;
|
|
100
|
+
exports.Input = Input;
|
|
101
|
+
exports.Panel = Panel;
|
|
102
|
+
exports.QueryKey = QueryKey;
|
|
103
|
+
exports.QueryKeys = QueryKeys;
|
|
104
|
+
exports.Select = Select;
|
|
105
|
+
//# sourceMappingURL=styledComponents.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styledComponents.js","sources":["../../src/styledComponents.ts"],"sourcesContent":["import { styled } from './utils'\n\nexport const Panel = styled(\n 'div',\n (_props, theme) => ({\n fontSize: 'clamp(12px, 1.5vw, 14px)',\n fontFamily: `sans-serif`,\n display: 'flex',\n backgroundColor: theme.background,\n color: theme.foreground,\n }),\n {\n '(max-width: 700px)': {\n flexDirection: 'column',\n },\n '(max-width: 600px)': {\n fontSize: '.9em',\n // flexDirection: 'column',\n },\n },\n)\n\nexport const ActiveQueryPanel = styled(\n 'div',\n () => ({\n flex: '1 1 500px',\n display: 'flex',\n flexDirection: 'column',\n overflow: 'auto',\n height: '100%',\n }),\n {\n '(max-width: 700px)': (_props, theme) => ({\n borderTop: `2px solid ${theme.gray}`,\n }),\n },\n)\n\nexport const Button = styled('button', (props, theme) => ({\n appearance: 'none',\n fontSize: '.9em',\n fontWeight: 'bold',\n background: theme.gray,\n border: '0',\n borderRadius: '.3em',\n color: 'white',\n padding: '.5em',\n opacity: props.disabled ? '.5' : undefined,\n cursor: 'pointer',\n}))\n\nexport const QueryKeys = styled('span', {\n display: 'flex',\n flexWrap: 'wrap',\n gap: '0.5em',\n fontSize: '0.9em',\n})\n\nexport const QueryKey = styled('span', {\n display: 'inline-flex',\n alignItems: 'center',\n padding: '.2em .4em',\n fontWeight: 'bold',\n textShadow: '0 0 10px black',\n borderRadius: '.2em',\n})\n\nexport const Code = styled('code', {\n fontSize: '.9em',\n color: 'inherit',\n background: 'inherit',\n})\n\nexport const Input = styled('input', (_props, theme) => ({\n backgroundColor: theme.inputBackgroundColor,\n border: 0,\n borderRadius: '.2em',\n color: theme.inputTextColor,\n fontSize: '.9em',\n lineHeight: `1.3`,\n padding: '.3em .4em',\n}))\n\nexport const Select = styled(\n 'select',\n (_props, theme) => ({\n display: `inline-block`,\n fontSize: `.9em`,\n fontFamily: `sans-serif`,\n fontWeight: 'normal',\n lineHeight: `1.3`,\n padding: `.3em 1.5em .3em .5em`,\n height: 'auto',\n border: 0,\n borderRadius: `.2em`,\n appearance: `none`,\n WebkitAppearance: 'none',\n backgroundColor: theme.inputBackgroundColor,\n backgroundImage: `url(\"data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='100' height='100' fill='%23444444'><polygon points='0,25 100,25 50,75'/></svg>\")`,\n backgroundRepeat: `no-repeat`,\n backgroundPosition: `right .55em center`,\n backgroundSize: `.65em auto, 100%`,\n color: theme.inputTextColor,\n }),\n {\n '(max-width: 500px)': {\n display: 'none',\n },\n },\n)\n"],"names":["Panel","styled","_props","theme","fontSize","fontFamily","display","backgroundColor","background","color","foreground","flexDirection","ActiveQueryPanel","flex","overflow","height","borderTop","gray","Button","props","appearance","fontWeight","border","borderRadius","padding","opacity","disabled","undefined","cursor","QueryKeys","flexWrap","gap","QueryKey","alignItems","textShadow","Code","Input","inputBackgroundColor","inputTextColor","lineHeight","Select","WebkitAppearance","backgroundImage","backgroundRepeat","backgroundPosition","backgroundSize"],"mappings":";;;;;;AAEO,MAAMA,KAAK,GAAGC,YAAM,CACzB,KADyB,EAEzB,CAACC,MAAD,EAASC,KAAT,MAAoB;AAClBC,EAAAA,QAAQ,EAAE,0BADQ;AAElBC,EAAAA,UAAU,EAFQ,YAAA;AAGlBC,EAAAA,OAAO,EAAE,MAHS;EAIlBC,eAAe,EAAEJ,KAAK,CAACK,UAJL;EAKlBC,KAAK,EAAEN,KAAK,CAACO,UAAAA;AALK,CAApB,CAFyB,EASzB;EACE,oBAAsB,EAAA;AACpBC,IAAAA,aAAa,EAAE,QAAA;GAFnB;EAIE,oBAAsB,EAAA;IACpBP,QAAQ,EAAE,MADU;;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e,EAbG,gKAAA;AAclBC,EAAAA,gBAAgB,EAdE,WAAA;AAelBC,EAAAA,kBAAkB,EAfA,oBAAA;AAgBlBC,EAAAA,cAAc,EAhBI,kBAAA;EAiBlBpC,KAAK,EAAEN,KAAK,CAACmC,cAAAA;AAjBK,CAApB,CAF0B,EAqB1B;EACE,oBAAsB,EAAA;AACpBhC,IAAAA,OAAO,EAAE,MAAA;AADW,GAAA;AADxB,CArB0B;;;;;;;;;;;"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { styled } from './utils.mjs';
|
|
2
|
+
|
|
3
|
+
const Panel = styled('div', (_props, theme) => ({
|
|
4
|
+
fontSize: 'clamp(12px, 1.5vw, 14px)',
|
|
5
|
+
fontFamily: "sans-serif",
|
|
6
|
+
display: 'flex',
|
|
7
|
+
backgroundColor: theme.background,
|
|
8
|
+
color: theme.foreground
|
|
9
|
+
}), {
|
|
10
|
+
'(max-width: 700px)': {
|
|
11
|
+
flexDirection: 'column'
|
|
12
|
+
},
|
|
13
|
+
'(max-width: 600px)': {
|
|
14
|
+
fontSize: '.9em' // flexDirection: 'column',
|
|
15
|
+
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
const ActiveQueryPanel = styled('div', () => ({
|
|
19
|
+
flex: '1 1 500px',
|
|
20
|
+
display: 'flex',
|
|
21
|
+
flexDirection: 'column',
|
|
22
|
+
overflow: 'auto',
|
|
23
|
+
height: '100%'
|
|
24
|
+
}), {
|
|
25
|
+
'(max-width: 700px)': (_props, theme) => ({
|
|
26
|
+
borderTop: "2px solid " + theme.gray
|
|
27
|
+
})
|
|
28
|
+
});
|
|
29
|
+
const Button = styled('button', (props, theme) => ({
|
|
30
|
+
appearance: 'none',
|
|
31
|
+
fontSize: '.9em',
|
|
32
|
+
fontWeight: 'bold',
|
|
33
|
+
background: theme.gray,
|
|
34
|
+
border: '0',
|
|
35
|
+
borderRadius: '.3em',
|
|
36
|
+
color: 'white',
|
|
37
|
+
padding: '.5em',
|
|
38
|
+
opacity: props.disabled ? '.5' : undefined,
|
|
39
|
+
cursor: 'pointer'
|
|
40
|
+
}));
|
|
41
|
+
const QueryKeys = styled('span', {
|
|
42
|
+
display: 'flex',
|
|
43
|
+
flexWrap: 'wrap',
|
|
44
|
+
gap: '0.5em',
|
|
45
|
+
fontSize: '0.9em'
|
|
46
|
+
});
|
|
47
|
+
const QueryKey = styled('span', {
|
|
48
|
+
display: 'inline-flex',
|
|
49
|
+
alignItems: 'center',
|
|
50
|
+
padding: '.2em .4em',
|
|
51
|
+
fontWeight: 'bold',
|
|
52
|
+
textShadow: '0 0 10px black',
|
|
53
|
+
borderRadius: '.2em'
|
|
54
|
+
});
|
|
55
|
+
const Code = styled('code', {
|
|
56
|
+
fontSize: '.9em',
|
|
57
|
+
color: 'inherit',
|
|
58
|
+
background: 'inherit'
|
|
59
|
+
});
|
|
60
|
+
const Input = styled('input', (_props, theme) => ({
|
|
61
|
+
backgroundColor: theme.inputBackgroundColor,
|
|
62
|
+
border: 0,
|
|
63
|
+
borderRadius: '.2em',
|
|
64
|
+
color: theme.inputTextColor,
|
|
65
|
+
fontSize: '.9em',
|
|
66
|
+
lineHeight: "1.3",
|
|
67
|
+
padding: '.3em .4em'
|
|
68
|
+
}));
|
|
69
|
+
const Select = styled('select', (_props, theme) => ({
|
|
70
|
+
display: "inline-block",
|
|
71
|
+
fontSize: ".9em",
|
|
72
|
+
fontFamily: "sans-serif",
|
|
73
|
+
fontWeight: 'normal',
|
|
74
|
+
lineHeight: "1.3",
|
|
75
|
+
padding: ".3em 1.5em .3em .5em",
|
|
76
|
+
height: 'auto',
|
|
77
|
+
border: 0,
|
|
78
|
+
borderRadius: ".2em",
|
|
79
|
+
appearance: "none",
|
|
80
|
+
WebkitAppearance: 'none',
|
|
81
|
+
backgroundColor: theme.inputBackgroundColor,
|
|
82
|
+
backgroundImage: "url(\"data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='100' height='100' fill='%23444444'><polygon points='0,25 100,25 50,75'/></svg>\")",
|
|
83
|
+
backgroundRepeat: "no-repeat",
|
|
84
|
+
backgroundPosition: "right .55em center",
|
|
85
|
+
backgroundSize: ".65em auto, 100%",
|
|
86
|
+
color: theme.inputTextColor
|
|
87
|
+
}), {
|
|
88
|
+
'(max-width: 500px)': {
|
|
89
|
+
display: 'none'
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
export { ActiveQueryPanel, Button, Code, Input, Panel, QueryKey, QueryKeys, Select };
|
|
94
|
+
//# sourceMappingURL=styledComponents.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styledComponents.mjs","sources":["../../src/styledComponents.ts"],"sourcesContent":["import { styled } from './utils'\n\nexport const Panel = styled(\n 'div',\n (_props, theme) => ({\n fontSize: 'clamp(12px, 1.5vw, 14px)',\n fontFamily: `sans-serif`,\n display: 'flex',\n backgroundColor: theme.background,\n color: theme.foreground,\n }),\n {\n '(max-width: 700px)': {\n flexDirection: 'column',\n },\n '(max-width: 600px)': {\n fontSize: '.9em',\n // flexDirection: 'column',\n },\n },\n)\n\nexport const ActiveQueryPanel = styled(\n 'div',\n () => ({\n flex: '1 1 500px',\n display: 'flex',\n flexDirection: 'column',\n overflow: 'auto',\n height: '100%',\n }),\n {\n '(max-width: 700px)': (_props, theme) => ({\n borderTop: `2px solid ${theme.gray}`,\n }),\n },\n)\n\nexport const Button = styled('button', (props, theme) => ({\n appearance: 'none',\n fontSize: '.9em',\n fontWeight: 'bold',\n background: theme.gray,\n border: '0',\n borderRadius: '.3em',\n color: 'white',\n padding: '.5em',\n opacity: props.disabled ? '.5' : undefined,\n cursor: 'pointer',\n}))\n\nexport const QueryKeys = styled('span', {\n display: 'flex',\n flexWrap: 'wrap',\n gap: '0.5em',\n fontSize: '0.9em',\n})\n\nexport const QueryKey = styled('span', {\n display: 'inline-flex',\n alignItems: 'center',\n padding: '.2em .4em',\n fontWeight: 'bold',\n textShadow: '0 0 10px black',\n borderRadius: '.2em',\n})\n\nexport const Code = styled('code', {\n fontSize: '.9em',\n color: 'inherit',\n background: 'inherit',\n})\n\nexport const Input = styled('input', (_props, theme) => ({\n backgroundColor: theme.inputBackgroundColor,\n border: 0,\n borderRadius: '.2em',\n color: theme.inputTextColor,\n fontSize: '.9em',\n lineHeight: `1.3`,\n padding: '.3em .4em',\n}))\n\nexport const Select = styled(\n 'select',\n (_props, theme) => ({\n display: `inline-block`,\n fontSize: `.9em`,\n fontFamily: `sans-serif`,\n fontWeight: 'normal',\n lineHeight: `1.3`,\n padding: `.3em 1.5em .3em .5em`,\n height: 'auto',\n border: 0,\n borderRadius: `.2em`,\n appearance: `none`,\n WebkitAppearance: 'none',\n backgroundColor: theme.inputBackgroundColor,\n backgroundImage: `url(\"data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='100' height='100' fill='%23444444'><polygon points='0,25 100,25 50,75'/></svg>\")`,\n backgroundRepeat: `no-repeat`,\n backgroundPosition: `right .55em center`,\n backgroundSize: `.65em auto, 100%`,\n color: theme.inputTextColor,\n }),\n {\n '(max-width: 500px)': {\n display: 'none',\n },\n },\n)\n"],"names":["Panel","styled","_props","theme","fontSize","fontFamily","display","backgroundColor","background","color","foreground","flexDirection","ActiveQueryPanel","flex","overflow","height","borderTop","gray","Button","props","appearance","fontWeight","border","borderRadius","padding","opacity","disabled","undefined","cursor","QueryKeys","flexWrap","gap","QueryKey","alignItems","textShadow","Code","Input","inputBackgroundColor","inputTextColor","lineHeight","Select","WebkitAppearance","backgroundImage","backgroundRepeat","backgroundPosition","backgroundSize"],"mappings":";;AAEO,MAAMA,KAAK,GAAGC,MAAM,CACzB,KADyB,EAEzB,CAACC,MAAD,EAASC,KAAT,MAAoB;AAClBC,EAAAA,QAAQ,EAAE,0BADQ;AAElBC,EAAAA,UAAU,EAFQ,YAAA;AAGlBC,EAAAA,OAAO,EAAE,MAHS;EAIlBC,eAAe,EAAEJ,KAAK,CAACK,UAJL;EAKlBC,K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C,EAAAA,YAAY,EATM,MAAA;AAUlBH,EAAAA,UAAU,EAVQ,MAAA;AAWlBqB,EAAAA,gBAAgB,EAAE,MAXA;EAYlBlC,eAAe,EAAEJ,KAAK,CAACkC,oBAZL;AAalBK,EAAAA,eAAe,EAbG,gKAAA;AAclBC,EAAAA,gBAAgB,EAdE,WAAA;AAelBC,EAAAA,kBAAkB,EAfA,oBAAA;AAgBlBC,EAAAA,cAAc,EAhBI,kBAAA;EAiBlBpC,KAAK,EAAEN,KAAK,CAACmC,cAAAA;AAjBK,CAApB,CAF0B,EAqB1B;EACE,oBAAsB,EAAA;AACpBhC,IAAAA,OAAO,EAAE,MAAA;AADW,GAAA;AADxB,CArB0B;;;;"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { extends as _extends } from './_virtual/_rollupPluginBabelHelpers.esm.js';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
|
|
5
|
+
const defaultTheme = {
|
|
6
|
+
background: '#0b1521',
|
|
7
|
+
backgroundAlt: '#132337',
|
|
8
|
+
foreground: 'white',
|
|
9
|
+
gray: '#3f4e60',
|
|
10
|
+
grayAlt: '#222e3e',
|
|
11
|
+
inputBackgroundColor: '#fff',
|
|
12
|
+
inputTextColor: '#000',
|
|
13
|
+
success: '#00ab52',
|
|
14
|
+
danger: '#ff0085',
|
|
15
|
+
active: '#006bff',
|
|
16
|
+
paused: '#8c49eb',
|
|
17
|
+
warning: '#ffb200'
|
|
18
|
+
};
|
|
19
|
+
const ThemeContext = /*#__PURE__*/React.createContext(defaultTheme);
|
|
20
|
+
function ThemeProvider({
|
|
21
|
+
theme,
|
|
22
|
+
...rest
|
|
23
|
+
}) {
|
|
24
|
+
return /*#__PURE__*/React.createElement(ThemeContext.Provider, _extends({
|
|
25
|
+
value: theme
|
|
26
|
+
}, rest));
|
|
27
|
+
}
|
|
28
|
+
function useTheme() {
|
|
29
|
+
return React.useContext(ThemeContext);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export { ThemeProvider, defaultTheme, useTheme };
|
|
33
|
+
//# sourceMappingURL=theme.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme.esm.js","sources":["../../src/theme.tsx"],"sourcesContent":["'use client'\nimport * as React from 'react'\n\nexport const defaultTheme = {\n background: '#0b1521',\n backgroundAlt: '#132337',\n foreground: 'white',\n gray: '#3f4e60',\n grayAlt: '#222e3e',\n inputBackgroundColor: '#fff',\n inputTextColor: '#000',\n success: '#00ab52',\n danger: '#ff0085',\n active: '#006bff',\n paused: '#8c49eb',\n warning: '#ffb200',\n} as const\n\nexport type Theme = typeof defaultTheme\ninterface ProviderProps {\n theme: Theme\n children?: React.ReactNode\n}\n\nconst ThemeContext = React.createContext(defaultTheme)\n\nexport function ThemeProvider({ theme, ...rest }: ProviderProps) {\n return <ThemeContext.Provider value={theme} {...rest} />\n}\n\nexport function useTheme() {\n return React.useContext(ThemeContext)\n}\n"],"names":["background","backgroundAlt","foreground","gray","grayAlt","inputBackgroundColor","inputTextColor","success","danger","active","paused","warning"],"mappings":";;;;AAGO;AACLA;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AAZ0B;AAqB5B;AAEO;;;AAAuB;;AACE;AAAvB;AACR;AAEM;AACL;AACD;;"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
var _rollupPluginBabelHelpers = require('./_virtual/_rollupPluginBabelHelpers.js');
|
|
7
|
+
var React = require('react');
|
|
8
|
+
|
|
9
|
+
function _interopNamespace(e) {
|
|
10
|
+
if (e && e.__esModule) return e;
|
|
11
|
+
var n = Object.create(null);
|
|
12
|
+
if (e) {
|
|
13
|
+
Object.keys(e).forEach(function (k) {
|
|
14
|
+
if (k !== 'default') {
|
|
15
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
16
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
17
|
+
enumerable: true,
|
|
18
|
+
get: function () { return e[k]; }
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
n["default"] = e;
|
|
24
|
+
return Object.freeze(n);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
28
|
+
|
|
29
|
+
const defaultTheme = {
|
|
30
|
+
background: '#0b1521',
|
|
31
|
+
backgroundAlt: '#132337',
|
|
32
|
+
foreground: 'white',
|
|
33
|
+
gray: '#3f4e60',
|
|
34
|
+
grayAlt: '#222e3e',
|
|
35
|
+
inputBackgroundColor: '#fff',
|
|
36
|
+
inputTextColor: '#000',
|
|
37
|
+
success: '#00ab52',
|
|
38
|
+
danger: '#ff0085',
|
|
39
|
+
active: '#006bff',
|
|
40
|
+
paused: '#8c49eb',
|
|
41
|
+
warning: '#ffb200'
|
|
42
|
+
};
|
|
43
|
+
const ThemeContext = /*#__PURE__*/React__namespace.createContext(defaultTheme);
|
|
44
|
+
function ThemeProvider({
|
|
45
|
+
theme,
|
|
46
|
+
...rest
|
|
47
|
+
}) {
|
|
48
|
+
return /*#__PURE__*/React__namespace.createElement(ThemeContext.Provider, _rollupPluginBabelHelpers["extends"]({
|
|
49
|
+
value: theme
|
|
50
|
+
}, rest));
|
|
51
|
+
}
|
|
52
|
+
function useTheme() {
|
|
53
|
+
return React__namespace.useContext(ThemeContext);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
exports.ThemeProvider = ThemeProvider;
|
|
57
|
+
exports.defaultTheme = defaultTheme;
|
|
58
|
+
exports.useTheme = useTheme;
|
|
59
|
+
//# sourceMappingURL=theme.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme.js","sources":["../../src/theme.tsx"],"sourcesContent":["'use client'\nimport * as React from 'react'\n\nexport const defaultTheme = {\n background: '#0b1521',\n backgroundAlt: '#132337',\n foreground: 'white',\n gray: '#3f4e60',\n grayAlt: '#222e3e',\n inputBackgroundColor: '#fff',\n inputTextColor: '#000',\n success: '#00ab52',\n danger: '#ff0085',\n active: '#006bff',\n paused: '#8c49eb',\n warning: '#ffb200',\n} as const\n\nexport type Theme = typeof defaultTheme\ninterface ProviderProps {\n theme: Theme\n children?: React.ReactNode\n}\n\nconst ThemeContext = React.createContext(defaultTheme)\n\nexport function ThemeProvider({ theme, ...rest }: ProviderProps) {\n return <ThemeContext.Provider value={theme} {...rest} />\n}\n\nexport function useTheme() {\n return React.useContext(ThemeContext)\n}\n"],"names":["background","backgroundAlt","foreground","gray","grayAlt","inputBackgroundColor","inputTextColor","success","danger","active","paused","warning"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGO;AACLA;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AAZ0B;AAqB5B;AAEO;;;AAAuB;;AACE;AAAvB;AACR;AAEM;AACL;AACD;;;;"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { extends as _extends } from './_virtual/_rollupPluginBabelHelpers.mjs';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
|
|
5
|
+
const defaultTheme = {
|
|
6
|
+
background: '#0b1521',
|
|
7
|
+
backgroundAlt: '#132337',
|
|
8
|
+
foreground: 'white',
|
|
9
|
+
gray: '#3f4e60',
|
|
10
|
+
grayAlt: '#222e3e',
|
|
11
|
+
inputBackgroundColor: '#fff',
|
|
12
|
+
inputTextColor: '#000',
|
|
13
|
+
success: '#00ab52',
|
|
14
|
+
danger: '#ff0085',
|
|
15
|
+
active: '#006bff',
|
|
16
|
+
paused: '#8c49eb',
|
|
17
|
+
warning: '#ffb200'
|
|
18
|
+
};
|
|
19
|
+
const ThemeContext = /*#__PURE__*/React.createContext(defaultTheme);
|
|
20
|
+
function ThemeProvider({
|
|
21
|
+
theme,
|
|
22
|
+
...rest
|
|
23
|
+
}) {
|
|
24
|
+
return /*#__PURE__*/React.createElement(ThemeContext.Provider, _extends({
|
|
25
|
+
value: theme
|
|
26
|
+
}, rest));
|
|
27
|
+
}
|
|
28
|
+
function useTheme() {
|
|
29
|
+
return React.useContext(ThemeContext);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export { ThemeProvider, defaultTheme, useTheme };
|
|
33
|
+
//# sourceMappingURL=theme.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme.mjs","sources":["../../src/theme.tsx"],"sourcesContent":["'use client'\nimport * as React from 'react'\n\nexport const defaultTheme = {\n background: '#0b1521',\n backgroundAlt: '#132337',\n foreground: 'white',\n gray: '#3f4e60',\n grayAlt: '#222e3e',\n inputBackgroundColor: '#fff',\n inputTextColor: '#000',\n success: '#00ab52',\n danger: '#ff0085',\n active: '#006bff',\n paused: '#8c49eb',\n warning: '#ffb200',\n} as const\n\nexport type Theme = typeof defaultTheme\ninterface ProviderProps {\n theme: Theme\n children?: React.ReactNode\n}\n\nconst ThemeContext = React.createContext(defaultTheme)\n\nexport function ThemeProvider({ theme, ...rest }: ProviderProps) {\n return <ThemeContext.Provider value={theme} {...rest} />\n}\n\nexport function useTheme() {\n return React.useContext(ThemeContext)\n}\n"],"names":["background","backgroundAlt","foreground","gray","grayAlt","inputBackgroundColor","inputTextColor","success","danger","active","paused","warning"],"mappings":";;;;AAGO;AACLA;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AAZ0B;AAqB5B;AAEO;;;AAAuB;;AACE;AAAvB;AACR;AAEM;AACL;AACD;;"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
const getItem = key => {
|
|
4
|
+
try {
|
|
5
|
+
const itemValue = localStorage.getItem(key);
|
|
6
|
+
|
|
7
|
+
if (typeof itemValue === 'string') {
|
|
8
|
+
return JSON.parse(itemValue);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
return undefined;
|
|
12
|
+
} catch {
|
|
13
|
+
return undefined;
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
function useLocalStorage(key, defaultValue) {
|
|
18
|
+
const [value, setValue] = React.useState();
|
|
19
|
+
React.useEffect(() => {
|
|
20
|
+
const initialValue = getItem(key);
|
|
21
|
+
|
|
22
|
+
if (typeof initialValue === 'undefined' || initialValue === null) {
|
|
23
|
+
setValue(typeof defaultValue === 'function' ? defaultValue() : defaultValue);
|
|
24
|
+
} else {
|
|
25
|
+
setValue(initialValue);
|
|
26
|
+
}
|
|
27
|
+
}, [defaultValue, key]);
|
|
28
|
+
const setter = React.useCallback(updater => {
|
|
29
|
+
setValue(old => {
|
|
30
|
+
let newVal = updater;
|
|
31
|
+
|
|
32
|
+
if (typeof updater == 'function') {
|
|
33
|
+
newVal = updater(old);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
try {
|
|
37
|
+
localStorage.setItem(key, JSON.stringify(newVal));
|
|
38
|
+
} catch {}
|
|
39
|
+
|
|
40
|
+
return newVal;
|
|
41
|
+
});
|
|
42
|
+
}, [key]);
|
|
43
|
+
return [value, setter];
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export { useLocalStorage as default };
|
|
47
|
+
//# sourceMappingURL=useLocalStorage.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useLocalStorage.esm.js","sources":["../../src/useLocalStorage.ts"],"sourcesContent":["import * as React from 'react'\n\nconst getItem = (key: string): unknown => {\n try {\n const itemValue = localStorage.getItem(key)\n if (typeof itemValue === 'string') {\n return JSON.parse(itemValue)\n }\n return undefined\n } catch {\n return undefined\n }\n}\n\nexport default function useLocalStorage<T>(\n key: string,\n defaultValue: T | undefined,\n): [T | undefined, (newVal: T | ((prevVal: T) => T)) => void] {\n const [value, setValue] = React.useState<T>()\n\n React.useEffect(() => {\n const initialValue = getItem(key) as T | undefined\n\n if (typeof initialValue === 'undefined' || initialValue === null) {\n setValue(\n typeof defaultValue === 'function' ? defaultValue() : defaultValue,\n )\n } else {\n setValue(initialValue)\n }\n }, [defaultValue, key])\n\n const setter = React.useCallback(\n (updater: any) => {\n setValue((old) => {\n let newVal = updater\n\n if (typeof updater == 'function') {\n newVal = updater(old)\n }\n try {\n localStorage.setItem(key, JSON.stringify(newVal))\n } catch {}\n\n return newVal\n })\n },\n [key],\n )\n\n return [value, setter]\n}\n"],"names":["getItem","key","itemValue","localStorage","JSON","parse","undefined","useLocalStorage","defaultValue","value","setValue","React","useState","useEffect","initialValue","setter","useCallback","updater","old","newVal","setItem","stringify"],"mappings":";;AAEA,MAAMA,OAAO,GAAIC,GAAD,IAA0B;EACxC,IAAI;AACF,IAAA,MAAMC,SAAS,GAAGC,YAAY,CAACH,OAAb,CAAqBC,GAArB,CAAlB,CAAA;;AACA,IAAA,IAAI,OAAOC,SAAP,KAAqB,QAAzB,EAAmC;AACjC,MAAA,OAAOE,IAAI,CAACC,KAAL,CAAWH,SAAX,CAAP,CAAA;AACD,KAAA;;AACD,IAAA,OAAOI,SAAP,CAAA;AACD,GAND,CAME,MAAM;AACN,IAAA,OAAOA,SAAP,CAAA;AACD,GAAA;AACF,CAVD,CAAA;;AAYe,SAASC,eAAT,CACbN,GADa,EAEbO,YAFa,EAG+C;EAC5D,MAAM,CAACC,KAAD,EAAQC,QAAR,IAAoBC,KAAK,CAACC,QAAN,EAA1B,CAAA;EAEAD,KAAK,CAACE,SAAN,CAAgB,MAAM;AACpB,IAAA,MAAMC,YAAY,GAAGd,OAAO,CAACC,GAAD,CAA5B,CAAA;;IAEA,IAAI,OAAOa,YAAP,KAAwB,WAAxB,IAAuCA,YAAY,KAAK,IAA5D,EAAkE;MAChEJ,QAAQ,CACN,OAAOF,YAAP,KAAwB,UAAxB,GAAqCA,YAAY,EAAjD,GAAsDA,YADhD,CAAR,CAAA;AAGD,KAJD,MAIO;MACLE,QAAQ,CAACI,YAAD,CAAR,CAAA;AACD,KAAA;AACF,GAVD,EAUG,CAACN,YAAD,EAAeP,GAAf,CAVH,CAAA,CAAA;AAYA,EAAA,MAAMc,MAAM,GAAGJ,KAAK,CAACK,WAAN,CACZC,OAAD,IAAkB;IAChBP,QAAQ,CAAEQ,GAAD,IAAS;MAChB,IAAIC,MAAM,GAAGF,OAAb,CAAA;;AAEA,MAAA,IAAI,OAAOA,OAAP,IAAkB,UAAtB,EAAkC;AAChCE,QAAAA,MAAM,GAAGF,OAAO,CAACC,GAAD,CAAhB,CAAA;AACD,OAAA;;MACD,IAAI;QACFf,YAAY,CAACiB,OAAb,CAAqBnB,GAArB,EAA0BG,IAAI,CAACiB,SAAL,CAAeF,MAAf,CAA1B,CAAA,CAAA;OADF,CAEE,MAAM,EAAE;;AAEV,MAAA,OAAOA,MAAP,CAAA;AACD,KAXO,CAAR,CAAA;AAYD,GAdY,EAeb,CAAClB,GAAD,CAfa,CAAf,CAAA;AAkBA,EAAA,OAAO,CAACQ,KAAD,EAAQM,MAAR,CAAP,CAAA;AACD;;;;"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var React = require('react');
|
|
6
|
+
|
|
7
|
+
function _interopNamespace(e) {
|
|
8
|
+
if (e && e.__esModule) return e;
|
|
9
|
+
var n = Object.create(null);
|
|
10
|
+
if (e) {
|
|
11
|
+
Object.keys(e).forEach(function (k) {
|
|
12
|
+
if (k !== 'default') {
|
|
13
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
14
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
get: function () { return e[k]; }
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
n["default"] = e;
|
|
22
|
+
return Object.freeze(n);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
26
|
+
|
|
27
|
+
const getItem = key => {
|
|
28
|
+
try {
|
|
29
|
+
const itemValue = localStorage.getItem(key);
|
|
30
|
+
|
|
31
|
+
if (typeof itemValue === 'string') {
|
|
32
|
+
return JSON.parse(itemValue);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return undefined;
|
|
36
|
+
} catch {
|
|
37
|
+
return undefined;
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
function useLocalStorage(key, defaultValue) {
|
|
42
|
+
const [value, setValue] = React__namespace.useState();
|
|
43
|
+
React__namespace.useEffect(() => {
|
|
44
|
+
const initialValue = getItem(key);
|
|
45
|
+
|
|
46
|
+
if (typeof initialValue === 'undefined' || initialValue === null) {
|
|
47
|
+
setValue(typeof defaultValue === 'function' ? defaultValue() : defaultValue);
|
|
48
|
+
} else {
|
|
49
|
+
setValue(initialValue);
|
|
50
|
+
}
|
|
51
|
+
}, [defaultValue, key]);
|
|
52
|
+
const setter = React__namespace.useCallback(updater => {
|
|
53
|
+
setValue(old => {
|
|
54
|
+
let newVal = updater;
|
|
55
|
+
|
|
56
|
+
if (typeof updater == 'function') {
|
|
57
|
+
newVal = updater(old);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
try {
|
|
61
|
+
localStorage.setItem(key, JSON.stringify(newVal));
|
|
62
|
+
} catch {}
|
|
63
|
+
|
|
64
|
+
return newVal;
|
|
65
|
+
});
|
|
66
|
+
}, [key]);
|
|
67
|
+
return [value, setter];
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
exports["default"] = useLocalStorage;
|
|
71
|
+
//# sourceMappingURL=useLocalStorage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useLocalStorage.js","sources":["../../src/useLocalStorage.ts"],"sourcesContent":["import * as React from 'react'\n\nconst getItem = (key: string): unknown => {\n try {\n const itemValue = localStorage.getItem(key)\n if (typeof itemValue === 'string') {\n return JSON.parse(itemValue)\n }\n return undefined\n } catch {\n return undefined\n }\n}\n\nexport default function useLocalStorage<T>(\n key: string,\n defaultValue: T | undefined,\n): [T | undefined, (newVal: T | ((prevVal: T) => T)) => void] {\n const [value, setValue] = React.useState<T>()\n\n React.useEffect(() => {\n const initialValue = getItem(key) as T | undefined\n\n if (typeof initialValue === 'undefined' || initialValue === null) {\n setValue(\n typeof defaultValue === 'function' ? defaultValue() : defaultValue,\n )\n } else {\n setValue(initialValue)\n }\n }, [defaultValue, key])\n\n const setter = React.useCallback(\n (updater: any) => {\n setValue((old) => {\n let newVal = updater\n\n if (typeof updater == 'function') {\n newVal = updater(old)\n }\n try {\n localStorage.setItem(key, JSON.stringify(newVal))\n } catch {}\n\n return newVal\n })\n },\n [key],\n )\n\n return [value, setter]\n}\n"],"names":["getItem","key","itemValue","localStorage","JSON","parse","undefined","useLocalStorage","defaultValue","value","setValue","React","useState","useEffect","initialValue","setter","useCallback","updater","old","newVal","setItem","stringify"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,MAAMA,OAAO,GAAIC,GAAD,IAA0B;EACxC,IAAI;AACF,IAAA,MAAMC,SAAS,GAAGC,YAAY,CAACH,OAAb,CAAqBC,GAArB,CAAlB,CAAA;;AACA,IAAA,IAAI,OAAOC,SAAP,KAAqB,QAAzB,EAAmC;AACjC,MAAA,OAAOE,IAAI,CAACC,KAAL,CAAWH,SAAX,CAAP,CAAA;AACD,KAAA;;AACD,IAAA,OAAOI,SAAP,CAAA;AACD,GAND,CAME,MAAM;AACN,IAAA,OAAOA,SAAP,CAAA;AACD,GAAA;AACF,CAVD,CAAA;;AAYe,SAASC,eAAT,CACbN,GADa,EAEbO,YAFa,EAG+C;EAC5D,MAAM,CAACC,KAAD,EAAQC,QAAR,IAAoBC,gBAAK,CAACC,QAAN,EAA1B,CAAA;EAEAD,gBAAK,CAACE,SAAN,CAAgB,MAAM;AACpB,IAAA,MAAMC,YAAY,GAAGd,OAAO,CAACC,GAAD,CAA5B,CAAA;;IAEA,IAAI,OAAOa,YAAP,KAAwB,WAAxB,IAAuCA,YAAY,KAAK,IAA5D,EAAkE;MAChEJ,QAAQ,CACN,OAAOF,YAAP,KAAwB,UAAxB,GAAqCA,YAAY,EAAjD,GAAsDA,YADhD,CAAR,CAAA;AAGD,KAJD,MAIO;MACLE,QAAQ,CAACI,YAAD,CAAR,CAAA;AACD,KAAA;AACF,GAVD,EAUG,CAACN,YAAD,EAAeP,GAAf,CAVH,CAAA,CAAA;AAYA,EAAA,MAAMc,MAAM,GAAGJ,gBAAK,CAACK,WAAN,CACZC,OAAD,IAAkB;IAChBP,QAAQ,CAAEQ,GAAD,IAAS;MAChB,IAAIC,MAAM,GAAGF,OAAb,CAAA;;AAEA,MAAA,IAAI,OAAOA,OAAP,IAAkB,UAAtB,EAAkC;AAChCE,QAAAA,MAAM,GAAGF,OAAO,CAACC,GAAD,CAAhB,CAAA;AACD,OAAA;;MACD,IAAI;QACFf,YAAY,CAACiB,OAAb,CAAqBnB,GAArB,EAA0BG,IAAI,CAACiB,SAAL,CAAeF,MAAf,CAA1B,CAAA,CAAA;OADF,CAEE,MAAM,EAAE;;AAEV,MAAA,OAAOA,MAAP,CAAA;AACD,KAXO,CAAR,CAAA;AAYD,GAdY,EAeb,CAAClB,GAAD,CAfa,CAAf,CAAA;AAkBA,EAAA,OAAO,CAACQ,KAAD,EAAQM,MAAR,CAAP,CAAA;AACD;;;;"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
const getItem = key => {
|
|
4
|
+
try {
|
|
5
|
+
const itemValue = localStorage.getItem(key);
|
|
6
|
+
|
|
7
|
+
if (typeof itemValue === 'string') {
|
|
8
|
+
return JSON.parse(itemValue);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
return undefined;
|
|
12
|
+
} catch {
|
|
13
|
+
return undefined;
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
function useLocalStorage(key, defaultValue) {
|
|
18
|
+
const [value, setValue] = React.useState();
|
|
19
|
+
React.useEffect(() => {
|
|
20
|
+
const initialValue = getItem(key);
|
|
21
|
+
|
|
22
|
+
if (typeof initialValue === 'undefined' || initialValue === null) {
|
|
23
|
+
setValue(typeof defaultValue === 'function' ? defaultValue() : defaultValue);
|
|
24
|
+
} else {
|
|
25
|
+
setValue(initialValue);
|
|
26
|
+
}
|
|
27
|
+
}, [defaultValue, key]);
|
|
28
|
+
const setter = React.useCallback(updater => {
|
|
29
|
+
setValue(old => {
|
|
30
|
+
let newVal = updater;
|
|
31
|
+
|
|
32
|
+
if (typeof updater == 'function') {
|
|
33
|
+
newVal = updater(old);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
try {
|
|
37
|
+
localStorage.setItem(key, JSON.stringify(newVal));
|
|
38
|
+
} catch {}
|
|
39
|
+
|
|
40
|
+
return newVal;
|
|
41
|
+
});
|
|
42
|
+
}, [key]);
|
|
43
|
+
return [value, setter];
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export { useLocalStorage as default };
|
|
47
|
+
//# sourceMappingURL=useLocalStorage.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useLocalStorage.mjs","sources":["../../src/useLocalStorage.ts"],"sourcesContent":["import * as React from 'react'\n\nconst getItem = (key: string): unknown => {\n try {\n const itemValue = localStorage.getItem(key)\n if (typeof itemValue === 'string') {\n return JSON.parse(itemValue)\n }\n return undefined\n } catch {\n return undefined\n }\n}\n\nexport default function useLocalStorage<T>(\n key: string,\n defaultValue: T | undefined,\n): [T | undefined, (newVal: T | ((prevVal: T) => T)) => void] {\n const [value, setValue] = React.useState<T>()\n\n React.useEffect(() => {\n const initialValue = getItem(key) as T | undefined\n\n if (typeof initialValue === 'undefined' || initialValue === null) {\n setValue(\n typeof defaultValue === 'function' ? defaultValue() : defaultValue,\n )\n } else {\n setValue(initialValue)\n }\n }, [defaultValue, key])\n\n const setter = React.useCallback(\n (updater: any) => {\n setValue((old) => {\n let newVal = updater\n\n if (typeof updater == 'function') {\n newVal = updater(old)\n }\n try {\n localStorage.setItem(key, JSON.stringify(newVal))\n } catch {}\n\n return newVal\n })\n },\n [key],\n )\n\n return [value, setter]\n}\n"],"names":["getItem","key","itemValue","localStorage","JSON","parse","undefined","useLocalStorage","defaultValue","value","setValue","React","useState","useEffect","initialValue","setter","useCallback","updater","old","newVal","setItem","stringify"],"mappings":";;AAEA,MAAMA,OAAO,GAAIC,GAAD,IAA0B;EACxC,IAAI;AACF,IAAA,MAAMC,SAAS,GAAGC,YAAY,CAACH,OAAb,CAAqBC,GAArB,CAAlB,CAAA;;AACA,IAAA,IAAI,OAAOC,SAAP,KAAqB,QAAzB,EAAmC;AACjC,MAAA,OAAOE,IAAI,CAACC,KAAL,CAAWH,SAAX,CAAP,CAAA;AACD,KAAA;;AACD,IAAA,OAAOI,SAAP,CAAA;AACD,GAND,CAME,MAAM;AACN,IAAA,OAAOA,SAAP,CAAA;AACD,GAAA;AACF,CAVD,CAAA;;AAYe,SAASC,eAAT,CACbN,GADa,EAEbO,YAFa,EAG+C;EAC5D,MAAM,CAACC,KAAD,EAAQC,QAAR,IAAoBC,KAAK,CAACC,QAAN,EAA1B,CAAA;EAEAD,KAAK,CAACE,SAAN,CAAgB,MAAM;AACpB,IAAA,MAAMC,YAAY,GAAGd,OAAO,CAACC,GAAD,CAA5B,CAAA;;IAEA,IAAI,OAAOa,YAAP,KAAwB,WAAxB,IAAuCA,YAAY,KAAK,IAA5D,EAAkE;MAChEJ,QAAQ,CACN,OAAOF,YAAP,KAAwB,UAAxB,GAAqCA,YAAY,EAAjD,GAAsDA,YADhD,CAAR,CAAA;AAGD,KAJD,MAIO;MACLE,QAAQ,CAACI,YAAD,CAAR,CAAA;AACD,KAAA;AACF,GAVD,EAUG,CAACN,YAAD,EAAeP,GAAf,CAVH,CAAA,CAAA;AAYA,EAAA,MAAMc,MAAM,GAAGJ,KAAK,CAACK,WAAN,CACZC,OAAD,IAAkB;IAChBP,QAAQ,CAAEQ,GAAD,IAAS;MAChB,IAAIC,MAAM,GAAGF,OAAb,CAAA;;AAEA,MAAA,IAAI,OAAOA,OAAP,IAAkB,UAAtB,EAAkC;AAChCE,QAAAA,MAAM,GAAGF,OAAO,CAACC,GAAD,CAAhB,CAAA;AACD,OAAA;;MACD,IAAI;QACFf,YAAY,CAACiB,OAAb,CAAqBnB,GAArB,EAA0BG,IAAI,CAACiB,SAAL,CAAeF,MAAf,CAA1B,CAAA,CAAA;OADF,CAEE,MAAM,EAAE;;AAEV,MAAA,OAAOA,MAAP,CAAA;AACD,KAXO,CAAR,CAAA;AAYD,GAdY,EAeb,CAAClB,GAAD,CAfa,CAAf,CAAA;AAkBA,EAAA,OAAO,CAACQ,KAAD,EAAQM,MAAR,CAAP,CAAA;AACD;;;;"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
function useMediaQuery(query) {
|
|
4
|
+
// Keep track of the preference in state, start with the current match
|
|
5
|
+
const [isMatch, setIsMatch] = React.useState(() => {
|
|
6
|
+
if (typeof window !== 'undefined') {
|
|
7
|
+
return window.matchMedia(query).matches;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
return;
|
|
11
|
+
}); // Watch for changes
|
|
12
|
+
|
|
13
|
+
React.useEffect(() => {
|
|
14
|
+
if (typeof window !== 'undefined') {
|
|
15
|
+
// Create a matcher
|
|
16
|
+
const matcher = window.matchMedia(query); // Create our handler
|
|
17
|
+
|
|
18
|
+
const onChange = ({
|
|
19
|
+
matches
|
|
20
|
+
}) => setIsMatch(matches); // Listen for changes
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
matcher.addListener(onChange);
|
|
24
|
+
return () => {
|
|
25
|
+
// Stop listening for changes
|
|
26
|
+
matcher.removeListener(onChange);
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return;
|
|
31
|
+
}, [isMatch, query, setIsMatch]);
|
|
32
|
+
return isMatch;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export { useMediaQuery as default };
|
|
36
|
+
//# sourceMappingURL=useMediaQuery.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useMediaQuery.esm.js","sources":["../../src/useMediaQuery.ts"],"sourcesContent":["import * as React from 'react'\n\nexport default function useMediaQuery(query: string): boolean | undefined {\n // Keep track of the preference in state, start with the current match\n const [isMatch, setIsMatch] = React.useState(() => {\n if (typeof window !== 'undefined') {\n return window.matchMedia(query).matches\n }\n return\n })\n\n // Watch for changes\n React.useEffect(() => {\n if (typeof window !== 'undefined') {\n // Create a matcher\n const matcher = window.matchMedia(query)\n\n // Create our handler\n const onChange = ({ matches }: { matches: boolean }) =>\n setIsMatch(matches)\n\n // Listen for changes\n matcher.addListener(onChange)\n\n return () => {\n // Stop listening for changes\n matcher.removeListener(onChange)\n }\n }\n return\n }, [isMatch, query, setIsMatch])\n\n return isMatch\n}\n"],"names":["useMediaQuery","query","isMatch","setIsMatch","React","useState","window","matchMedia","matches","useEffect","matcher","onChange","addListener","removeListener"],"mappings":";;AAEe,SAASA,aAAT,CAAuBC,KAAvB,EAA2D;AACxE;EACA,MAAM,CAACC,OAAD,EAAUC,UAAV,IAAwBC,KAAK,CAACC,QAAN,CAAe,MAAM;AACjD,IAAA,IAAI,OAAOC,MAAP,KAAkB,WAAtB,EAAmC;AACjC,MAAA,OAAOA,MAAM,CAACC,UAAP,CAAkBN,KAAlB,EAAyBO,OAAhC,CAAA;AACD,KAAA;;AACD,IAAA,OAAA;GAJ4B,CAA9B,CAFwE;;EAUxEJ,KAAK,CAACK,SAAN,CAAgB,MAAM;AACpB,IAAA,IAAI,OAAOH,MAAP,KAAkB,WAAtB,EAAmC;AACjC;MACA,MAAMI,OAAO,GAAGJ,MAAM,CAACC,UAAP,CAAkBN,KAAlB,CAAhB,CAFiC;;MAKjC,MAAMU,QAAQ,GAAG,CAAC;AAAEH,QAAAA,OAAAA;AAAF,OAAD,KACfL,UAAU,CAACK,OAAD,CADZ,CALiC;;;MASjCE,OAAO,CAACE,WAAR,CAAoBD,QAApB,CAAA,CAAA;AAEA,MAAA,OAAO,MAAM;AACX;QACAD,OAAO,CAACG,cAAR,CAAuBF,QAAvB,CAAA,CAAA;OAFF,CAAA;AAID,KAAA;;AACD,IAAA,OAAA;AACD,GAlBD,EAkBG,CAACT,OAAD,EAAUD,KAAV,EAAiBE,UAAjB,CAlBH,CAAA,CAAA;AAoBA,EAAA,OAAOD,OAAP,CAAA;AACD;;;;"}
|