@chem-po/react-web 0.0.51 → 0.0.53
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/package.json +4 -5
- package/src/components/auth/SignIn.tsx +0 -43
- package/src/components/auth/index.ts +0 -1
- package/src/components/box/CollapseHorizontal.tsx +0 -19
- package/src/components/box/ContentBox.tsx +0 -17
- package/src/components/box/ExpandOnMount.tsx +0 -48
- package/src/components/box/Expandable.tsx +0 -96
- package/src/components/box/FullSizeContainer.tsx +0 -50
- package/src/components/box/MobileFrame/index.tsx +0 -146
- package/src/components/box/MobileFrame/styles.css +0 -35
- package/src/components/box/index.ts +0 -6
- package/src/components/button/DeleteButton.tsx +0 -178
- package/src/components/button/Toggle.tsx +0 -88
- package/src/components/button/ViewButton.tsx +0 -30
- package/src/components/button/index.ts +0 -3
- package/src/components/feed/FeedContentPane.tsx +0 -111
- package/src/components/feed/MediaFeed.tsx +0 -200
- package/src/components/feed/MediaFeedBackground.tsx +0 -127
- package/src/components/feed/MediaFeedRefresh.tsx +0 -78
- package/src/components/feed/MediaFeedSwipeUp.tsx +0 -35
- package/src/components/feed/constants.ts +0 -11
- package/src/components/feed/context.tsx +0 -19
- package/src/components/feed/hooks.ts +0 -290
- package/src/components/feed/index.ts +0 -2
- package/src/components/feed/types.ts +0 -50
- package/src/components/form/Condition.tsx +0 -26
- package/src/components/form/Field.tsx +0 -39
- package/src/components/form/Form.tsx +0 -428
- package/src/components/form/FormFooter.tsx +0 -90
- package/src/components/form/UploadProgress/index.tsx +0 -38
- package/src/components/form/UploadProgress/styles.css +0 -23
- package/src/components/form/index.ts +0 -4
- package/src/components/form/input/Editable.tsx +0 -155
- package/src/components/form/input/InputSlider.tsx +0 -76
- package/src/components/form/input/OptionalTag.tsx +0 -33
- package/src/components/form/input/StandaloneInput.tsx +0 -41
- package/src/components/form/input/boolean/index.tsx +0 -53
- package/src/components/form/input/color/index.tsx +0 -126
- package/src/components/form/input/date/index.tsx +0 -122
- package/src/components/form/input/datetime/index.tsx +0 -93
- package/src/components/form/input/file.tsx +0 -379
- package/src/components/form/input/hooks/index.ts +0 -2
- package/src/components/form/input/hooks/useInputImperativeHandle.ts +0 -16
- package/src/components/form/input/hooks/useInputStyles.ts +0 -125
- package/src/components/form/input/index.ts +0 -2
- package/src/components/form/input/input.css +0 -44
- package/src/components/form/input/input.tsx +0 -134
- package/src/components/form/input/multipleSelect/index.tsx +0 -89
- package/src/components/form/input/number/index.tsx +0 -87
- package/src/components/form/input/number/styles.css +0 -8
- package/src/components/form/input/select/index.tsx +0 -109
- package/src/components/form/input/shared/InputContainer.tsx +0 -13
- package/src/components/form/input/socialMedia/index.tsx +0 -165
- package/src/components/form/input/text/index.tsx +0 -78
- package/src/components/form/input/text/textarea.tsx +0 -43
- package/src/components/form/input/time/index.tsx +0 -33
- package/src/components/form/input/type.ts +0 -0
- package/src/components/form/input/types.ts +0 -4
- package/src/components/form/view/file.tsx +0 -36
- package/src/components/form/view/index.tsx +0 -52
- package/src/components/form/view/multipleSelect.tsx +0 -51
- package/src/components/form/view/select.tsx +0 -50
- package/src/components/form/view/types.ts +0 -11
- package/src/components/index.ts +0 -14
- package/src/components/list/Body/InfiniteScrollGridBody.tsx +0 -177
- package/src/components/list/Body/InfiniteScrollListBody.tsx +0 -114
- package/src/components/list/Body/ListBody.tsx +0 -24
- package/src/components/list/Body/PagedGridBody.tsx +0 -104
- package/src/components/list/Body/PagedListBody.tsx +0 -92
- package/src/components/list/Body/hooks.ts +0 -84
- package/src/components/list/DataList.tsx +0 -33
- package/src/components/list/ListContainer.tsx +0 -21
- package/src/components/list/ListContent.tsx +0 -54
- package/src/components/list/ListCreate.tsx +0 -57
- package/src/components/list/ListFilters.tsx +0 -182
- package/src/components/list/ListFooter.tsx +0 -458
- package/src/components/list/ListHeader.tsx +0 -180
- package/src/components/list/ListItem/ListCell.tsx +0 -49
- package/src/components/list/ListItem/ListRow.tsx +0 -44
- package/src/components/list/ListItemView.tsx +0 -53
- package/src/components/list/ListSort.tsx +0 -84
- package/src/components/list/NoItems.tsx +0 -33
- package/src/components/list/constants.ts +0 -1
- package/src/components/list/index.ts +0 -4
- package/src/components/list/types.ts +0 -26
- package/src/components/list/utils.ts +0 -63
- package/src/components/loading/CircularProgress.tsx +0 -12
- package/src/components/loading/Loading.tsx +0 -160
- package/src/components/loading/LoadingImage.tsx +0 -128
- package/src/components/loading/LoadingSwitch.tsx +0 -78
- package/src/components/loading/index.ts +0 -4
- package/src/components/media/PlayButton.tsx +0 -95
- package/src/components/media/index.ts +0 -1
- package/src/components/modal/DefaultModal.tsx +0 -18
- package/src/components/modal/DesktopModal.tsx +0 -16
- package/src/components/modal/ForceMobile.tsx +0 -7
- package/src/components/modal/MobileModal.tsx +0 -89
- package/src/components/modal/index.ts +0 -3
- package/src/components/modal/type.ts +0 -7
- package/src/components/nav/NavBar.tsx +0 -102
- package/src/components/nav/index.ts +0 -1
- package/src/components/overlay/ImageViewOverlay.tsx +0 -88
- package/src/components/overlay/MobileOverlay.tsx +0 -23
- package/src/components/overlay/index.ts +0 -2
- package/src/components/text/GradientText/index.tsx +0 -17
- package/src/components/text/GradientText/styles.css +0 -5
- package/src/components/text/NumberTicker.tsx +0 -28
- package/src/components/text/index.ts +0 -1
- package/src/components/theme/colorMode/DarkModeToggle.tsx +0 -40
- package/src/components/theme/colorMode/index.ts +0 -1
- package/src/components/theme/index.ts +0 -1
- package/src/components/view/ErrorView.tsx +0 -14
- package/src/components/view/RedirectView.tsx +0 -43
- package/src/components/view/index.ts +0 -2
- package/src/contexts/index.ts +0 -2
- package/src/contexts/theme.ts +0 -316
- package/src/contexts/view.tsx +0 -26
- package/src/custom.d.ts +0 -4
- package/src/hooks/index.ts +0 -1
- package/src/hooks/ui/index.ts +0 -1
- package/src/hooks/ui/useBorderColor.ts +0 -4
- package/src/index.ts +0 -5
- package/src/store/index.ts +0 -1
- package/src/store/usePlayer.ts +0 -75
- package/src/store/useScreen.ts +0 -22
- package/src/types/forms.ts +0 -5
- package/src/types/index.ts +0 -1
package/src/contexts/theme.ts
DELETED
|
@@ -1,316 +0,0 @@
|
|
|
1
|
-
import { switchAnatomy } from '@chakra-ui/anatomy'
|
|
2
|
-
import { createMultiStyleConfigHelpers, extendTheme } from '@chakra-ui/react'
|
|
3
|
-
import { cssVar } from '@chakra-ui/theme-tools'
|
|
4
|
-
import { palette } from '@chem-po/core'
|
|
5
|
-
|
|
6
|
-
const { definePartsStyle, defineMultiStyleConfig } = createMultiStyleConfigHelpers(
|
|
7
|
-
switchAnatomy.keys,
|
|
8
|
-
)
|
|
9
|
-
|
|
10
|
-
const switchBaseTheme = definePartsStyle({
|
|
11
|
-
// define the part you're going to style
|
|
12
|
-
track: {
|
|
13
|
-
_focusVisible: {
|
|
14
|
-
boxShadow: 'none',
|
|
15
|
-
},
|
|
16
|
-
},
|
|
17
|
-
})
|
|
18
|
-
|
|
19
|
-
export const switchTheme = defineMultiStyleConfig({ baseStyle: switchBaseTheme })
|
|
20
|
-
const $arrowBg = cssVar('popper-arrow-bg')
|
|
21
|
-
|
|
22
|
-
export const headingFont = 'Encode Sans'
|
|
23
|
-
export const bodyFont = 'Noto Sans'
|
|
24
|
-
|
|
25
|
-
export const baseTheme = extendTheme({
|
|
26
|
-
semanticTokens: {
|
|
27
|
-
colors: {
|
|
28
|
-
background: {
|
|
29
|
-
// 100: mode('gray.50', palette.gray.dark)(props),
|
|
30
|
-
// 200: mode('gray.100', palette.gray.medium)(props),
|
|
31
|
-
// 300: mode('gray.200', palette.gray.light)(props),
|
|
32
|
-
// 400: mode('gray.300', palette.gray.lighter)(props),
|
|
33
|
-
50: {
|
|
34
|
-
default: 'white',
|
|
35
|
-
_dark: palette.gray.darker,
|
|
36
|
-
},
|
|
37
|
-
100: {
|
|
38
|
-
default: 'gray.100',
|
|
39
|
-
_dark: palette.gray.dark,
|
|
40
|
-
},
|
|
41
|
-
200: {
|
|
42
|
-
default: '#efefef',
|
|
43
|
-
_dark: palette.gray.medium,
|
|
44
|
-
},
|
|
45
|
-
},
|
|
46
|
-
accent: {
|
|
47
|
-
50: {
|
|
48
|
-
default: 'blue.50',
|
|
49
|
-
_dark: 'blue.900',
|
|
50
|
-
},
|
|
51
|
-
100: {
|
|
52
|
-
default: 'blue.100',
|
|
53
|
-
_dark: 'blue.800',
|
|
54
|
-
},
|
|
55
|
-
200: {
|
|
56
|
-
default: 'blue.200',
|
|
57
|
-
_dark: 'blue.700',
|
|
58
|
-
},
|
|
59
|
-
300: {
|
|
60
|
-
default: 'blue.300',
|
|
61
|
-
_dark: 'blue.600',
|
|
62
|
-
},
|
|
63
|
-
400: {
|
|
64
|
-
default: 'blue.400',
|
|
65
|
-
_dark: 'blue.500',
|
|
66
|
-
},
|
|
67
|
-
500: {
|
|
68
|
-
default: 'blue.500',
|
|
69
|
-
_dark: 'blue.400',
|
|
70
|
-
},
|
|
71
|
-
600: {
|
|
72
|
-
default: 'blue.600',
|
|
73
|
-
_dark: 'blue.300',
|
|
74
|
-
},
|
|
75
|
-
700: {
|
|
76
|
-
default: 'blue.700',
|
|
77
|
-
_dark: 'blue.200',
|
|
78
|
-
},
|
|
79
|
-
800: {
|
|
80
|
-
default: 'blue.800',
|
|
81
|
-
_dark: 'blue.100',
|
|
82
|
-
},
|
|
83
|
-
900: {
|
|
84
|
-
default: 'blue.900',
|
|
85
|
-
_dark: 'blue.50',
|
|
86
|
-
},
|
|
87
|
-
},
|
|
88
|
-
error: {
|
|
89
|
-
default: 'red.500',
|
|
90
|
-
_dark: 'red.300',
|
|
91
|
-
},
|
|
92
|
-
},
|
|
93
|
-
fonts: {
|
|
94
|
-
body: bodyFont,
|
|
95
|
-
heading: headingFont,
|
|
96
|
-
},
|
|
97
|
-
},
|
|
98
|
-
components: {
|
|
99
|
-
Badge: {
|
|
100
|
-
baseStyle: {
|
|
101
|
-
bg: '#9a9a9a',
|
|
102
|
-
textShadow: 'none',
|
|
103
|
-
color: 'white',
|
|
104
|
-
boxShadow: '1px 1px 3px #00000077',
|
|
105
|
-
_dark: {
|
|
106
|
-
bg: '#555555',
|
|
107
|
-
textShadow: '1px 1px 2px #00000077',
|
|
108
|
-
color: '#efefef',
|
|
109
|
-
},
|
|
110
|
-
},
|
|
111
|
-
},
|
|
112
|
-
Tooltip: {
|
|
113
|
-
baseStyle: {
|
|
114
|
-
bg: '#ababab',
|
|
115
|
-
textShadow: '0 0 3px rgba(0,0,0,0.5)',
|
|
116
|
-
color: 'white',
|
|
117
|
-
[$arrowBg.variable]: '#ababab',
|
|
118
|
-
_dark: {
|
|
119
|
-
bg: '#777777',
|
|
120
|
-
textShadow: 'none',
|
|
121
|
-
color: '#efefef',
|
|
122
|
-
[$arrowBg.variable]: '#777777',
|
|
123
|
-
},
|
|
124
|
-
},
|
|
125
|
-
},
|
|
126
|
-
Button: {
|
|
127
|
-
baseStyle: {
|
|
128
|
-
fontFamily: headingFont,
|
|
129
|
-
fontWeight: 500,
|
|
130
|
-
_focus: { boxShadow: 'none' },
|
|
131
|
-
},
|
|
132
|
-
variants: {
|
|
133
|
-
link: {
|
|
134
|
-
color: '#444',
|
|
135
|
-
_dark: { color: 'rgba(230,230,255,0.9)' },
|
|
136
|
-
},
|
|
137
|
-
ghost: {
|
|
138
|
-
_hover: { bg: 'blackAlpha.500' },
|
|
139
|
-
},
|
|
140
|
-
solid: {
|
|
141
|
-
textShadow: '1px 1px 3px #00000077',
|
|
142
|
-
bg: 'blackAlpha.400',
|
|
143
|
-
color: 'whiteAlpha.800',
|
|
144
|
-
_hover: {
|
|
145
|
-
bg: 'blackAlpha.500',
|
|
146
|
-
},
|
|
147
|
-
_dark: {
|
|
148
|
-
bg: 'whiteAlpha.300',
|
|
149
|
-
color: 'whiteAlpha.800',
|
|
150
|
-
_hover: {
|
|
151
|
-
bg: 'whiteAlpha.400',
|
|
152
|
-
},
|
|
153
|
-
},
|
|
154
|
-
},
|
|
155
|
-
outline: {
|
|
156
|
-
border: '1px solid',
|
|
157
|
-
borderColor: '#ababab',
|
|
158
|
-
color: '#656565',
|
|
159
|
-
_hover: {
|
|
160
|
-
bg: 'blackAlpha.100',
|
|
161
|
-
},
|
|
162
|
-
_dark: {
|
|
163
|
-
border: '1px solid #999',
|
|
164
|
-
color: '#999',
|
|
165
|
-
_hover: {
|
|
166
|
-
bg: 'whiteAlpha.300',
|
|
167
|
-
},
|
|
168
|
-
},
|
|
169
|
-
},
|
|
170
|
-
},
|
|
171
|
-
},
|
|
172
|
-
Tabs: {
|
|
173
|
-
baseStyle: {
|
|
174
|
-
tab: { _focus: { boxShadow: 'none' } },
|
|
175
|
-
},
|
|
176
|
-
},
|
|
177
|
-
Text: {
|
|
178
|
-
baseStyle: {
|
|
179
|
-
fontFamily: bodyFont,
|
|
180
|
-
},
|
|
181
|
-
},
|
|
182
|
-
Popover: {
|
|
183
|
-
baseStyle: {
|
|
184
|
-
root: { _focus: { boxShadow: 'none' } },
|
|
185
|
-
content: {
|
|
186
|
-
bg: 'background.100',
|
|
187
|
-
border: 'none',
|
|
188
|
-
boxShadow: '0 0 4px rgba(0,0,0,0.5)',
|
|
189
|
-
[$arrowBg.variable]: 'background.100',
|
|
190
|
-
_dark: {
|
|
191
|
-
bg: 'background.100',
|
|
192
|
-
[$arrowBg.variable]: 'background.100',
|
|
193
|
-
},
|
|
194
|
-
},
|
|
195
|
-
},
|
|
196
|
-
},
|
|
197
|
-
Checkbox: {
|
|
198
|
-
baseStyle: {
|
|
199
|
-
control: {
|
|
200
|
-
_focus: { boxShadow: 'none' },
|
|
201
|
-
border: '2px solid #ababab',
|
|
202
|
-
borderColor: '#ababab',
|
|
203
|
-
_checked: {
|
|
204
|
-
bg: '#666666',
|
|
205
|
-
color: '#efefef',
|
|
206
|
-
border: 'none',
|
|
207
|
-
},
|
|
208
|
-
_hover: { bg: '#555', border: 'none' },
|
|
209
|
-
_dark: {
|
|
210
|
-
_checked: {
|
|
211
|
-
bg: '#efefef',
|
|
212
|
-
color: '#444444',
|
|
213
|
-
border: 'none',
|
|
214
|
-
},
|
|
215
|
-
_hover: { bg: '#555', border: 'none' },
|
|
216
|
-
},
|
|
217
|
-
},
|
|
218
|
-
label: {
|
|
219
|
-
color: '#888',
|
|
220
|
-
_dark: { color: '#999999' },
|
|
221
|
-
_checked: {
|
|
222
|
-
color: '#444444',
|
|
223
|
-
_dark: { color: '#cdcdcd' },
|
|
224
|
-
},
|
|
225
|
-
},
|
|
226
|
-
},
|
|
227
|
-
variants: {
|
|
228
|
-
noBox: {
|
|
229
|
-
control: {
|
|
230
|
-
bg: 'transparent',
|
|
231
|
-
_hover: { bg: 'none' },
|
|
232
|
-
},
|
|
233
|
-
},
|
|
234
|
-
},
|
|
235
|
-
},
|
|
236
|
-
Modal: {
|
|
237
|
-
baseStyle: {
|
|
238
|
-
dialog: {
|
|
239
|
-
bg: 'background.100',
|
|
240
|
-
boxShadow: '0 0 6px rgba(0,0,0,0.5)',
|
|
241
|
-
_dark: {
|
|
242
|
-
bg: 'background.100',
|
|
243
|
-
},
|
|
244
|
-
},
|
|
245
|
-
},
|
|
246
|
-
},
|
|
247
|
-
Input: {
|
|
248
|
-
baseStyle: {
|
|
249
|
-
field: {
|
|
250
|
-
_focus: {
|
|
251
|
-
boxShadow: 'none',
|
|
252
|
-
outline: 'none',
|
|
253
|
-
border: '1px solid #bcbcbc',
|
|
254
|
-
},
|
|
255
|
-
},
|
|
256
|
-
},
|
|
257
|
-
variants: {
|
|
258
|
-
text: {
|
|
259
|
-
field: {
|
|
260
|
-
borderRadius: 6,
|
|
261
|
-
border: '1px solid #dedede',
|
|
262
|
-
_focus: { boxShadow: 'none', borderColor: '#bcbcbc' },
|
|
263
|
-
_active: { boxShadow: 'none' },
|
|
264
|
-
_placeholder: { color: '#777' },
|
|
265
|
-
_dark: {
|
|
266
|
-
border: '1px solid #777',
|
|
267
|
-
_focus: { borderColor: '#999', boxShadow: 'none' },
|
|
268
|
-
_placeholder: { color: '#777' },
|
|
269
|
-
},
|
|
270
|
-
},
|
|
271
|
-
},
|
|
272
|
-
},
|
|
273
|
-
defaultProps: {
|
|
274
|
-
variant: 'text',
|
|
275
|
-
},
|
|
276
|
-
},
|
|
277
|
-
Switch: switchTheme,
|
|
278
|
-
Menu: {
|
|
279
|
-
baseStyle: {
|
|
280
|
-
list: {
|
|
281
|
-
bg: 'background.100',
|
|
282
|
-
border: 'none',
|
|
283
|
-
boxShadow: '0 0 6px rgba(0,0,0,0.5)',
|
|
284
|
-
_dark: {
|
|
285
|
-
bg: 'background.100',
|
|
286
|
-
},
|
|
287
|
-
},
|
|
288
|
-
item: {
|
|
289
|
-
_hover: {
|
|
290
|
-
bg: 'rgba(0,0,0,0.3)',
|
|
291
|
-
},
|
|
292
|
-
_focus: {
|
|
293
|
-
bg: 'rgba(0,0,0,0.2)',
|
|
294
|
-
},
|
|
295
|
-
},
|
|
296
|
-
},
|
|
297
|
-
},
|
|
298
|
-
Progress: {
|
|
299
|
-
baseStyle: {
|
|
300
|
-
track: {
|
|
301
|
-
bg: 'blackAlpha.300',
|
|
302
|
-
borderRadius: 'full',
|
|
303
|
-
_dark: {
|
|
304
|
-
bg: 'whiteAlpha.300',
|
|
305
|
-
},
|
|
306
|
-
},
|
|
307
|
-
filledTrack: {
|
|
308
|
-
bg: 'blackAlpha.400',
|
|
309
|
-
_dark: {
|
|
310
|
-
bg: 'whiteAlpha.500',
|
|
311
|
-
},
|
|
312
|
-
},
|
|
313
|
-
},
|
|
314
|
-
},
|
|
315
|
-
},
|
|
316
|
-
})
|
package/src/contexts/view.tsx
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { BaseUserData, getUserViews, getViewRoutes, View } from '@chem-po/core'
|
|
2
|
-
import { useAuth } from '@chem-po/react'
|
|
3
|
-
import React, { createContext, FC, PropsWithChildren, useContext, useMemo } from 'react'
|
|
4
|
-
import { RouteObject } from 'react-router'
|
|
5
|
-
|
|
6
|
-
export const ViewsContext = createContext<
|
|
7
|
-
Array<{ view: View<FC, BaseUserData>; routes: RouteObject[] }>
|
|
8
|
-
>([])
|
|
9
|
-
|
|
10
|
-
export const useViews = () => useContext(ViewsContext)
|
|
11
|
-
|
|
12
|
-
export const ViewsProvider = ({
|
|
13
|
-
children,
|
|
14
|
-
views,
|
|
15
|
-
}: PropsWithChildren & { views: Array<View<FC, BaseUserData>> }) => {
|
|
16
|
-
const user = useAuth(s => s.user)
|
|
17
|
-
const value = useMemo(
|
|
18
|
-
() =>
|
|
19
|
-
getUserViews(views, user).map(view => ({
|
|
20
|
-
view,
|
|
21
|
-
routes: getViewRoutes(view),
|
|
22
|
-
})),
|
|
23
|
-
[user, views],
|
|
24
|
-
)
|
|
25
|
-
return <ViewsContext.Provider value={value}>{children}</ViewsContext.Provider>
|
|
26
|
-
}
|
package/src/custom.d.ts
DELETED
package/src/hooks/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './ui'
|
package/src/hooks/ui/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './useBorderColor'
|
package/src/index.ts
DELETED
package/src/store/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './useScreen'
|
package/src/store/usePlayer.ts
DELETED
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import { Playlist, SpotifyTrack, WithId } from '@chem-po/core'
|
|
2
|
-
import { MotionValue } from 'framer-motion'
|
|
3
|
-
import { Howl } from 'howler'
|
|
4
|
-
import { useMemo } from 'react'
|
|
5
|
-
import { create } from 'zustand'
|
|
6
|
-
|
|
7
|
-
export type SetMediaArgs =
|
|
8
|
-
| { playlist: PlaylistInterface; media?: never }
|
|
9
|
-
| { media: WithId<SpotifyTrack>; playlist?: never }
|
|
10
|
-
export interface AudioPlayerApi {
|
|
11
|
-
play: () => void
|
|
12
|
-
pause: () => void
|
|
13
|
-
goNext: () => void
|
|
14
|
-
goPrev: () => void
|
|
15
|
-
canGoNext: boolean
|
|
16
|
-
canGoPrev: boolean
|
|
17
|
-
sound: Howl | null
|
|
18
|
-
trackProgress: MotionValue<number>
|
|
19
|
-
seek: (to: number) => void
|
|
20
|
-
setMedia: (args: SetMediaArgs) => void
|
|
21
|
-
stop: () => void
|
|
22
|
-
loop: (loop: boolean) => void
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export interface PlaylistInterface extends Playlist {
|
|
26
|
-
currentId: string | null
|
|
27
|
-
}
|
|
28
|
-
interface UsePlayerData {
|
|
29
|
-
isPlaying: boolean
|
|
30
|
-
isLoading: boolean
|
|
31
|
-
fetchingMedia: WithId<SpotifyTrack> | null
|
|
32
|
-
playlist: PlaylistInterface | null
|
|
33
|
-
media: WithId<SpotifyTrack> | null
|
|
34
|
-
repeat: boolean
|
|
35
|
-
shuffle: boolean
|
|
36
|
-
api: AudioPlayerApi
|
|
37
|
-
volume: number
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export const usePlayer = create<UsePlayerData>(() => ({
|
|
41
|
-
isPlaying: false,
|
|
42
|
-
media: null,
|
|
43
|
-
isLoading: false,
|
|
44
|
-
fetchingMedia: null,
|
|
45
|
-
shuffle: false,
|
|
46
|
-
playlist: null,
|
|
47
|
-
volume: 0.5,
|
|
48
|
-
repeat: false,
|
|
49
|
-
api: {
|
|
50
|
-
pause: () => {},
|
|
51
|
-
play: () => {},
|
|
52
|
-
canGoNext: false,
|
|
53
|
-
canGoPrev: false,
|
|
54
|
-
goNext: () => {},
|
|
55
|
-
goPrev: () => {},
|
|
56
|
-
seek: () => {},
|
|
57
|
-
sound: null,
|
|
58
|
-
trackProgress: new MotionValue(0),
|
|
59
|
-
setMedia: () => {},
|
|
60
|
-
stop: () => {},
|
|
61
|
-
loop: () => {},
|
|
62
|
-
},
|
|
63
|
-
}))
|
|
64
|
-
|
|
65
|
-
export const useActiveMedia = () => {
|
|
66
|
-
const { media, playlist } = usePlayer()
|
|
67
|
-
return useMemo(() => {
|
|
68
|
-
if (playlist) {
|
|
69
|
-
return playlist.currentId !== null
|
|
70
|
-
? (playlist.items.find(i => i.id === playlist.currentId) ?? null)
|
|
71
|
-
: null
|
|
72
|
-
}
|
|
73
|
-
return media
|
|
74
|
-
}, [playlist, media])
|
|
75
|
-
}
|
package/src/store/useScreen.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { useScreen } from '@chem-po/react'
|
|
2
|
-
|
|
3
|
-
export const initializeScreen = () => {
|
|
4
|
-
if (typeof window !== 'undefined') {
|
|
5
|
-
const onResize = () => {
|
|
6
|
-
const width = window.innerWidth
|
|
7
|
-
const height = window.innerHeight
|
|
8
|
-
useScreen.setState({
|
|
9
|
-
width,
|
|
10
|
-
height,
|
|
11
|
-
isMobile: width < 769,
|
|
12
|
-
isPortrait: width < height,
|
|
13
|
-
})
|
|
14
|
-
window.addEventListener('resize', onResize)
|
|
15
|
-
}
|
|
16
|
-
onResize()
|
|
17
|
-
return () => {
|
|
18
|
-
window.removeEventListener('resize', onResize)
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
return () => {}
|
|
22
|
-
}
|
package/src/types/forms.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { BaseCustomInput, BaseCustomInputProps } from '@chem-po/react'
|
|
2
|
-
import { CSSProperties } from 'react'
|
|
3
|
-
|
|
4
|
-
export type CustomInput<Value> = BaseCustomInput<Value, CSSProperties, CSSProperties>
|
|
5
|
-
export type CustomInputProps<Value> = BaseCustomInputProps<Value, CSSProperties, CSSProperties>
|
package/src/types/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './forms'
|