@prose-reader/react-reader 1.173.0 → 1.175.0
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/dist/common/useFullscreen.d.ts +4 -0
- package/dist/components/ui/avatar.d.ts +16 -0
- package/dist/components/ui/checkbox.d.ts +8 -0
- package/dist/components/ui/close-button.d.ts +4 -0
- package/dist/components/ui/color-mode.d.ts +19 -0
- package/dist/components/ui/dialog.d.ts +19 -0
- package/dist/components/ui/drawer.d.ts +19 -0
- package/dist/components/ui/field.d.ts +9 -0
- package/dist/components/ui/input-group.d.ts +12 -0
- package/dist/components/ui/popover.d.ts +17 -0
- package/dist/components/ui/progress.d.ts +9 -0
- package/dist/components/ui/provider.d.ts +2 -0
- package/dist/components/ui/radio.d.ts +8 -0
- package/dist/components/ui/slider.d.ts +11 -0
- package/dist/components/ui/toggle-tip.d.ts +10 -0
- package/dist/components/ui/tooltip.d.ts +11 -0
- package/dist/context/ReactReaderProvider.d.ts +5 -0
- package/dist/context/context.d.ts +3 -0
- package/dist/context/useReader.d.ts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +379 -0
- package/dist/index.js.map +1 -0
- package/dist/index.umd.cjs +2 -0
- package/dist/index.umd.cjs.map +1 -0
- package/dist/navigation/QuickMenu/BottomBar.d.ts +3 -0
- package/dist/navigation/QuickMenu/PaginationInfoSection.d.ts +1 -0
- package/dist/navigation/QuickMenu/QuickBar.d.ts +4 -0
- package/dist/navigation/QuickMenu/QuickMenu.d.ts +5 -0
- package/dist/navigation/QuickMenu/Scrubber.d.ts +1 -0
- package/dist/navigation/QuickMenu/TimeIndicator.d.ts +3 -0
- package/dist/navigation/QuickMenu/TopBar.d.ts +5 -0
- package/dist/navigation/useNavigationContext.d.ts +11 -0
- package/dist/pagination/usePagination.d.ts +4 -0
- package/dist/settings/useSettings.d.ts +2 -0
- package/package.json +7 -4
- package/src/common/useFullscreen.ts +0 -44
- package/src/components/ui/avatar.tsx +0 -74
- package/src/components/ui/checkbox.tsx +0 -25
- package/src/components/ui/close-button.tsx +0 -17
- package/src/components/ui/color-mode.tsx +0 -75
- package/src/components/ui/dialog.tsx +0 -62
- package/src/components/ui/drawer.tsx +0 -52
- package/src/components/ui/field.tsx +0 -33
- package/src/components/ui/input-group.tsx +0 -53
- package/src/components/ui/popover.tsx +0 -59
- package/src/components/ui/progress.tsx +0 -34
- package/src/components/ui/provider.tsx +0 -12
- package/src/components/ui/radio.tsx +0 -24
- package/src/components/ui/slider.tsx +0 -82
- package/src/components/ui/toggle-tip.tsx +0 -70
- package/src/components/ui/tooltip.tsx +0 -46
- package/src/context/ReactReaderProvider.tsx +0 -14
- package/src/context/context.ts +0 -6
- package/src/context/useReader.ts +0 -9
- package/src/index.ts +0 -2
- package/src/navigation/QuickMenu/BottomBar.tsx +0 -65
- package/src/navigation/QuickMenu/PaginationInfoSection.tsx +0 -62
- package/src/navigation/QuickMenu/QuickBar.tsx +0 -40
- package/src/navigation/QuickMenu/QuickMenu.tsx +0 -22
- package/src/navigation/QuickMenu/Scrubber.tsx +0 -138
- package/src/navigation/QuickMenu/TimeIndicator.tsx +0 -29
- package/src/navigation/QuickMenu/TopBar.tsx +0 -72
- package/src/navigation/useNavigationContext.ts +0 -46
- package/src/pagination/usePagination.ts +0 -29
- package/src/settings/useSettings.ts +0 -9
- package/src/vite-env.d.ts +0 -1
- package/tsconfig.app.json +0 -26
- package/tsconfig.json +0 -7
- package/tsconfig.node.json +0 -22
- package/vite.config.ts +0 -32
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { Field as ChakraField } from "@chakra-ui/react"
|
|
2
|
-
import * as React from "react"
|
|
3
|
-
|
|
4
|
-
export interface FieldProps extends Omit<ChakraField.RootProps, "label"> {
|
|
5
|
-
label?: React.ReactNode
|
|
6
|
-
helperText?: React.ReactNode
|
|
7
|
-
errorText?: React.ReactNode
|
|
8
|
-
optionalText?: React.ReactNode
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export const Field = React.forwardRef<HTMLDivElement, FieldProps>(
|
|
12
|
-
function Field(props, ref) {
|
|
13
|
-
const { label, children, helperText, errorText, optionalText, ...rest } =
|
|
14
|
-
props
|
|
15
|
-
return (
|
|
16
|
-
<ChakraField.Root ref={ref} {...rest}>
|
|
17
|
-
{label && (
|
|
18
|
-
<ChakraField.Label>
|
|
19
|
-
{label}
|
|
20
|
-
<ChakraField.RequiredIndicator fallback={optionalText} />
|
|
21
|
-
</ChakraField.Label>
|
|
22
|
-
)}
|
|
23
|
-
{children}
|
|
24
|
-
{helperText && (
|
|
25
|
-
<ChakraField.HelperText>{helperText}</ChakraField.HelperText>
|
|
26
|
-
)}
|
|
27
|
-
{errorText && (
|
|
28
|
-
<ChakraField.ErrorText>{errorText}</ChakraField.ErrorText>
|
|
29
|
-
)}
|
|
30
|
-
</ChakraField.Root>
|
|
31
|
-
)
|
|
32
|
-
},
|
|
33
|
-
)
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import type { BoxProps, InputElementProps } from "@chakra-ui/react"
|
|
2
|
-
import { Group, InputElement } from "@chakra-ui/react"
|
|
3
|
-
import * as React from "react"
|
|
4
|
-
|
|
5
|
-
export interface InputGroupProps extends BoxProps {
|
|
6
|
-
startElementProps?: InputElementProps
|
|
7
|
-
endElementProps?: InputElementProps
|
|
8
|
-
startElement?: React.ReactNode
|
|
9
|
-
endElement?: React.ReactNode
|
|
10
|
-
children: React.ReactElement<InputElementProps>
|
|
11
|
-
startOffset?: InputElementProps["paddingStart"]
|
|
12
|
-
endOffset?: InputElementProps["paddingEnd"]
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export const InputGroup = React.forwardRef<HTMLDivElement, InputGroupProps>(
|
|
16
|
-
function InputGroup(props, ref) {
|
|
17
|
-
const {
|
|
18
|
-
startElement,
|
|
19
|
-
startElementProps,
|
|
20
|
-
endElement,
|
|
21
|
-
endElementProps,
|
|
22
|
-
children,
|
|
23
|
-
startOffset = "6px",
|
|
24
|
-
endOffset = "6px",
|
|
25
|
-
...rest
|
|
26
|
-
} = props
|
|
27
|
-
|
|
28
|
-
const child =
|
|
29
|
-
React.Children.only<React.ReactElement<InputElementProps>>(children)
|
|
30
|
-
|
|
31
|
-
return (
|
|
32
|
-
<Group ref={ref} {...rest}>
|
|
33
|
-
{startElement && (
|
|
34
|
-
<InputElement pointerEvents="none" {...startElementProps}>
|
|
35
|
-
{startElement}
|
|
36
|
-
</InputElement>
|
|
37
|
-
)}
|
|
38
|
-
{React.cloneElement(child, {
|
|
39
|
-
...(startElement && {
|
|
40
|
-
ps: `calc(var(--input-height) - ${startOffset})`,
|
|
41
|
-
}),
|
|
42
|
-
...(endElement && { pe: `calc(var(--input-height) - ${endOffset})` }),
|
|
43
|
-
...children.props,
|
|
44
|
-
})}
|
|
45
|
-
{endElement && (
|
|
46
|
-
<InputElement placement="end" {...endElementProps}>
|
|
47
|
-
{endElement}
|
|
48
|
-
</InputElement>
|
|
49
|
-
)}
|
|
50
|
-
</Group>
|
|
51
|
-
)
|
|
52
|
-
},
|
|
53
|
-
)
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { Popover as ChakraPopover, Portal } from "@chakra-ui/react"
|
|
2
|
-
import { CloseButton } from "./close-button"
|
|
3
|
-
import * as React from "react"
|
|
4
|
-
|
|
5
|
-
interface PopoverContentProps extends ChakraPopover.ContentProps {
|
|
6
|
-
portalled?: boolean
|
|
7
|
-
portalRef?: React.RefObject<HTMLElement>
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export const PopoverContent = React.forwardRef<
|
|
11
|
-
HTMLDivElement,
|
|
12
|
-
PopoverContentProps
|
|
13
|
-
>(function PopoverContent(props, ref) {
|
|
14
|
-
const { portalled = true, portalRef, ...rest } = props
|
|
15
|
-
return (
|
|
16
|
-
<Portal disabled={!portalled} container={portalRef}>
|
|
17
|
-
<ChakraPopover.Positioner>
|
|
18
|
-
<ChakraPopover.Content ref={ref} {...rest} />
|
|
19
|
-
</ChakraPopover.Positioner>
|
|
20
|
-
</Portal>
|
|
21
|
-
)
|
|
22
|
-
})
|
|
23
|
-
|
|
24
|
-
export const PopoverArrow = React.forwardRef<
|
|
25
|
-
HTMLDivElement,
|
|
26
|
-
ChakraPopover.ArrowProps
|
|
27
|
-
>(function PopoverArrow(props, ref) {
|
|
28
|
-
return (
|
|
29
|
-
<ChakraPopover.Arrow {...props} ref={ref}>
|
|
30
|
-
<ChakraPopover.ArrowTip />
|
|
31
|
-
</ChakraPopover.Arrow>
|
|
32
|
-
)
|
|
33
|
-
})
|
|
34
|
-
|
|
35
|
-
export const PopoverCloseTrigger = React.forwardRef<
|
|
36
|
-
HTMLButtonElement,
|
|
37
|
-
ChakraPopover.CloseTriggerProps
|
|
38
|
-
>(function PopoverCloseTrigger(props, ref) {
|
|
39
|
-
return (
|
|
40
|
-
<ChakraPopover.CloseTrigger
|
|
41
|
-
position="absolute"
|
|
42
|
-
top="1"
|
|
43
|
-
insetEnd="1"
|
|
44
|
-
{...props}
|
|
45
|
-
asChild
|
|
46
|
-
ref={ref}
|
|
47
|
-
>
|
|
48
|
-
<CloseButton size="sm" />
|
|
49
|
-
</ChakraPopover.CloseTrigger>
|
|
50
|
-
)
|
|
51
|
-
})
|
|
52
|
-
|
|
53
|
-
export const PopoverTitle = ChakraPopover.Title
|
|
54
|
-
export const PopoverDescription = ChakraPopover.Description
|
|
55
|
-
export const PopoverFooter = ChakraPopover.Footer
|
|
56
|
-
export const PopoverHeader = ChakraPopover.Header
|
|
57
|
-
export const PopoverRoot = ChakraPopover.Root
|
|
58
|
-
export const PopoverBody = ChakraPopover.Body
|
|
59
|
-
export const PopoverTrigger = ChakraPopover.Trigger
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { Progress as ChakraProgress } from "@chakra-ui/react"
|
|
2
|
-
import { InfoTip } from "./toggle-tip"
|
|
3
|
-
import * as React from "react"
|
|
4
|
-
|
|
5
|
-
export const ProgressBar = React.forwardRef<
|
|
6
|
-
HTMLDivElement,
|
|
7
|
-
ChakraProgress.TrackProps
|
|
8
|
-
>(function ProgressBar(props, ref) {
|
|
9
|
-
return (
|
|
10
|
-
<ChakraProgress.Track {...props} ref={ref}>
|
|
11
|
-
<ChakraProgress.Range />
|
|
12
|
-
</ChakraProgress.Track>
|
|
13
|
-
)
|
|
14
|
-
})
|
|
15
|
-
|
|
16
|
-
export interface ProgressLabelProps extends ChakraProgress.LabelProps {
|
|
17
|
-
info?: React.ReactNode
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export const ProgressLabel = React.forwardRef<
|
|
21
|
-
HTMLDivElement,
|
|
22
|
-
ProgressLabelProps
|
|
23
|
-
>(function ProgressLabel(props, ref) {
|
|
24
|
-
const { children, info, ...rest } = props
|
|
25
|
-
return (
|
|
26
|
-
<ChakraProgress.Label {...rest} ref={ref}>
|
|
27
|
-
{children}
|
|
28
|
-
{info && <InfoTip>{info}</InfoTip>}
|
|
29
|
-
</ChakraProgress.Label>
|
|
30
|
-
)
|
|
31
|
-
})
|
|
32
|
-
|
|
33
|
-
export const ProgressRoot = ChakraProgress.Root
|
|
34
|
-
export const ProgressValueText = ChakraProgress.ValueText
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use client"
|
|
2
|
-
|
|
3
|
-
import { ChakraProvider, defaultSystem } from "@chakra-ui/react"
|
|
4
|
-
import { ColorModeProvider, type ColorModeProviderProps } from "./color-mode"
|
|
5
|
-
|
|
6
|
-
export function Provider(props: ColorModeProviderProps) {
|
|
7
|
-
return (
|
|
8
|
-
<ChakraProvider value={defaultSystem}>
|
|
9
|
-
<ColorModeProvider {...props} />
|
|
10
|
-
</ChakraProvider>
|
|
11
|
-
)
|
|
12
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { RadioGroup as ChakraRadioGroup } from "@chakra-ui/react"
|
|
2
|
-
import * as React from "react"
|
|
3
|
-
|
|
4
|
-
export interface RadioProps extends ChakraRadioGroup.ItemProps {
|
|
5
|
-
rootRef?: React.Ref<HTMLDivElement>
|
|
6
|
-
inputProps?: React.InputHTMLAttributes<HTMLInputElement>
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export const Radio = React.forwardRef<HTMLInputElement, RadioProps>(
|
|
10
|
-
function Radio(props, ref) {
|
|
11
|
-
const { children, inputProps, rootRef, ...rest } = props
|
|
12
|
-
return (
|
|
13
|
-
<ChakraRadioGroup.Item ref={rootRef} {...rest}>
|
|
14
|
-
<ChakraRadioGroup.ItemHiddenInput ref={ref} {...inputProps} />
|
|
15
|
-
<ChakraRadioGroup.ItemIndicator />
|
|
16
|
-
{children && (
|
|
17
|
-
<ChakraRadioGroup.ItemText>{children}</ChakraRadioGroup.ItemText>
|
|
18
|
-
)}
|
|
19
|
-
</ChakraRadioGroup.Item>
|
|
20
|
-
)
|
|
21
|
-
},
|
|
22
|
-
)
|
|
23
|
-
|
|
24
|
-
export const RadioGroup = ChakraRadioGroup.Root
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import { Slider as ChakraSlider, For, HStack } from "@chakra-ui/react"
|
|
2
|
-
import * as React from "react"
|
|
3
|
-
|
|
4
|
-
export interface SliderProps extends ChakraSlider.RootProps {
|
|
5
|
-
marks?: Array<number | { value: number; label: React.ReactNode }>
|
|
6
|
-
label?: React.ReactNode
|
|
7
|
-
showValue?: boolean
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export const Slider = React.forwardRef<HTMLDivElement, SliderProps>(
|
|
11
|
-
function Slider(props, ref) {
|
|
12
|
-
const { marks: marksProp, label, showValue, ...rest } = props
|
|
13
|
-
const value = props.defaultValue ?? props.value
|
|
14
|
-
|
|
15
|
-
const marks = marksProp?.map((mark) => {
|
|
16
|
-
if (typeof mark === "number") return { value: mark, label: undefined }
|
|
17
|
-
return mark
|
|
18
|
-
})
|
|
19
|
-
|
|
20
|
-
const hasMarkLabel = !!marks?.some((mark) => mark.label)
|
|
21
|
-
|
|
22
|
-
return (
|
|
23
|
-
<ChakraSlider.Root ref={ref} thumbAlignment="center" {...rest}>
|
|
24
|
-
{label && !showValue && (
|
|
25
|
-
<ChakraSlider.Label>{label}</ChakraSlider.Label>
|
|
26
|
-
)}
|
|
27
|
-
{label && showValue && (
|
|
28
|
-
<HStack justify="space-between">
|
|
29
|
-
<ChakraSlider.Label>{label}</ChakraSlider.Label>
|
|
30
|
-
<ChakraSlider.ValueText />
|
|
31
|
-
</HStack>
|
|
32
|
-
)}
|
|
33
|
-
<ChakraSlider.Control data-has-mark-label={hasMarkLabel || undefined}>
|
|
34
|
-
<ChakraSlider.Track>
|
|
35
|
-
<ChakraSlider.Range />
|
|
36
|
-
</ChakraSlider.Track>
|
|
37
|
-
<SliderThumbs value={value} />
|
|
38
|
-
<SliderMarks marks={marks} />
|
|
39
|
-
</ChakraSlider.Control>
|
|
40
|
-
</ChakraSlider.Root>
|
|
41
|
-
)
|
|
42
|
-
},
|
|
43
|
-
)
|
|
44
|
-
|
|
45
|
-
function SliderThumbs(props: { value?: number[] }) {
|
|
46
|
-
const { value } = props
|
|
47
|
-
return (
|
|
48
|
-
<For each={value}>
|
|
49
|
-
{(_, index) => (
|
|
50
|
-
<ChakraSlider.Thumb key={index} index={index}>
|
|
51
|
-
<ChakraSlider.HiddenInput />
|
|
52
|
-
</ChakraSlider.Thumb>
|
|
53
|
-
)}
|
|
54
|
-
</For>
|
|
55
|
-
)
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
interface SliderMarksProps {
|
|
59
|
-
marks?: Array<number | { value: number; label: React.ReactNode }>
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
const SliderMarks = React.forwardRef<HTMLDivElement, SliderMarksProps>(
|
|
63
|
-
function SliderMarks(props, ref) {
|
|
64
|
-
const { marks } = props
|
|
65
|
-
if (!marks?.length) return null
|
|
66
|
-
|
|
67
|
-
return (
|
|
68
|
-
<ChakraSlider.MarkerGroup ref={ref}>
|
|
69
|
-
{marks.map((mark, index) => {
|
|
70
|
-
const value = typeof mark === "number" ? mark : mark.value
|
|
71
|
-
const label = typeof mark === "number" ? undefined : mark.label
|
|
72
|
-
return (
|
|
73
|
-
<ChakraSlider.Marker key={index} value={value}>
|
|
74
|
-
<ChakraSlider.MarkerIndicator />
|
|
75
|
-
{label}
|
|
76
|
-
</ChakraSlider.Marker>
|
|
77
|
-
)
|
|
78
|
-
})}
|
|
79
|
-
</ChakraSlider.MarkerGroup>
|
|
80
|
-
)
|
|
81
|
-
},
|
|
82
|
-
)
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { Popover as ChakraPopover, IconButton, Portal } from "@chakra-ui/react"
|
|
2
|
-
import * as React from "react"
|
|
3
|
-
import { HiOutlineInformationCircle } from "react-icons/hi"
|
|
4
|
-
|
|
5
|
-
export interface ToggleTipProps extends ChakraPopover.RootProps {
|
|
6
|
-
showArrow?: boolean
|
|
7
|
-
portalled?: boolean
|
|
8
|
-
portalRef?: React.RefObject<HTMLElement>
|
|
9
|
-
content?: React.ReactNode
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export const ToggleTip = React.forwardRef<HTMLDivElement, ToggleTipProps>(
|
|
13
|
-
function ToggleTip(props, ref) {
|
|
14
|
-
const {
|
|
15
|
-
showArrow,
|
|
16
|
-
children,
|
|
17
|
-
portalled = true,
|
|
18
|
-
content,
|
|
19
|
-
portalRef,
|
|
20
|
-
...rest
|
|
21
|
-
} = props
|
|
22
|
-
|
|
23
|
-
return (
|
|
24
|
-
<ChakraPopover.Root
|
|
25
|
-
{...rest}
|
|
26
|
-
positioning={{ ...rest.positioning, gutter: 4 }}
|
|
27
|
-
>
|
|
28
|
-
<ChakraPopover.Trigger asChild>{children}</ChakraPopover.Trigger>
|
|
29
|
-
<Portal disabled={!portalled} container={portalRef}>
|
|
30
|
-
<ChakraPopover.Positioner>
|
|
31
|
-
<ChakraPopover.Content
|
|
32
|
-
width="auto"
|
|
33
|
-
px="2"
|
|
34
|
-
py="1"
|
|
35
|
-
textStyle="xs"
|
|
36
|
-
rounded="sm"
|
|
37
|
-
ref={ref}
|
|
38
|
-
>
|
|
39
|
-
{showArrow && (
|
|
40
|
-
<ChakraPopover.Arrow>
|
|
41
|
-
<ChakraPopover.ArrowTip />
|
|
42
|
-
</ChakraPopover.Arrow>
|
|
43
|
-
)}
|
|
44
|
-
{content}
|
|
45
|
-
</ChakraPopover.Content>
|
|
46
|
-
</ChakraPopover.Positioner>
|
|
47
|
-
</Portal>
|
|
48
|
-
</ChakraPopover.Root>
|
|
49
|
-
)
|
|
50
|
-
},
|
|
51
|
-
)
|
|
52
|
-
|
|
53
|
-
export const InfoTip = React.forwardRef<
|
|
54
|
-
HTMLDivElement,
|
|
55
|
-
Partial<ToggleTipProps>
|
|
56
|
-
>(function InfoTip(props, ref) {
|
|
57
|
-
const { children, ...rest } = props
|
|
58
|
-
return (
|
|
59
|
-
<ToggleTip content={children} {...rest} ref={ref}>
|
|
60
|
-
<IconButton
|
|
61
|
-
variant="ghost"
|
|
62
|
-
aria-label="info"
|
|
63
|
-
size="2xs"
|
|
64
|
-
colorPalette="gray"
|
|
65
|
-
>
|
|
66
|
-
<HiOutlineInformationCircle />
|
|
67
|
-
</IconButton>
|
|
68
|
-
</ToggleTip>
|
|
69
|
-
)
|
|
70
|
-
})
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { Tooltip as ChakraTooltip, Portal } from "@chakra-ui/react"
|
|
2
|
-
import * as React from "react"
|
|
3
|
-
|
|
4
|
-
export interface TooltipProps extends ChakraTooltip.RootProps {
|
|
5
|
-
showArrow?: boolean
|
|
6
|
-
portalled?: boolean
|
|
7
|
-
portalRef?: React.RefObject<HTMLElement>
|
|
8
|
-
content: React.ReactNode
|
|
9
|
-
contentProps?: ChakraTooltip.ContentProps
|
|
10
|
-
disabled?: boolean
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export const Tooltip = React.forwardRef<HTMLDivElement, TooltipProps>(
|
|
14
|
-
function Tooltip(props, ref) {
|
|
15
|
-
const {
|
|
16
|
-
showArrow,
|
|
17
|
-
children,
|
|
18
|
-
disabled,
|
|
19
|
-
portalled = true,
|
|
20
|
-
content,
|
|
21
|
-
contentProps,
|
|
22
|
-
portalRef,
|
|
23
|
-
...rest
|
|
24
|
-
} = props
|
|
25
|
-
|
|
26
|
-
if (disabled) return children
|
|
27
|
-
|
|
28
|
-
return (
|
|
29
|
-
<ChakraTooltip.Root {...rest}>
|
|
30
|
-
<ChakraTooltip.Trigger asChild>{children}</ChakraTooltip.Trigger>
|
|
31
|
-
<Portal disabled={!portalled} container={portalRef}>
|
|
32
|
-
<ChakraTooltip.Positioner>
|
|
33
|
-
<ChakraTooltip.Content ref={ref} {...contentProps}>
|
|
34
|
-
{showArrow && (
|
|
35
|
-
<ChakraTooltip.Arrow>
|
|
36
|
-
<ChakraTooltip.ArrowTip />
|
|
37
|
-
</ChakraTooltip.Arrow>
|
|
38
|
-
)}
|
|
39
|
-
{content}
|
|
40
|
-
</ChakraTooltip.Content>
|
|
41
|
-
</ChakraTooltip.Positioner>
|
|
42
|
-
</Portal>
|
|
43
|
-
</ChakraTooltip.Root>
|
|
44
|
-
)
|
|
45
|
-
},
|
|
46
|
-
)
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { Reader } from "@prose-reader/core"
|
|
2
|
-
import { memo } from "react"
|
|
3
|
-
import { ReaderContext } from "./context"
|
|
4
|
-
|
|
5
|
-
export const ReactReaderProvider = memo(
|
|
6
|
-
({
|
|
7
|
-
children,
|
|
8
|
-
reader,
|
|
9
|
-
}: { children?: React.ReactNode; reader: Reader | undefined }) => {
|
|
10
|
-
return (
|
|
11
|
-
<ReaderContext.Provider value={reader}>{children}</ReaderContext.Provider>
|
|
12
|
-
)
|
|
13
|
-
},
|
|
14
|
-
)
|
package/src/context/context.ts
DELETED
package/src/context/useReader.ts
DELETED
package/src/index.ts
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { Box, IconButton, Stack } from "@chakra-ui/react"
|
|
2
|
-
import {
|
|
3
|
-
RxDoubleArrowDown,
|
|
4
|
-
RxDoubleArrowLeft,
|
|
5
|
-
RxDoubleArrowRight,
|
|
6
|
-
RxDoubleArrowUp,
|
|
7
|
-
} from "react-icons/rx"
|
|
8
|
-
import { useObserve } from "reactjrx"
|
|
9
|
-
import { useReader } from "../../context/useReader"
|
|
10
|
-
import { PaginationInfoSection } from "./PaginationInfoSection"
|
|
11
|
-
import { QuickBar } from "./QuickBar"
|
|
12
|
-
import { Scrubber } from "./Scrubber"
|
|
13
|
-
import { TimeIndicator } from "./TimeIndicator"
|
|
14
|
-
|
|
15
|
-
export const BottomBar = ({ open }: { open: boolean }) => {
|
|
16
|
-
const reader = useReader()
|
|
17
|
-
const navigation = useObserve(() => reader?.navigation.state$, [reader])
|
|
18
|
-
const settings = useObserve(() => reader?.settings.values$, [reader])
|
|
19
|
-
const isVerticalDirection = settings?.computedPageTurnDirection === "vertical"
|
|
20
|
-
|
|
21
|
-
return (
|
|
22
|
-
<QuickBar present={open} position="bottom" height={130}>
|
|
23
|
-
<IconButton
|
|
24
|
-
aria-label="left"
|
|
25
|
-
size="lg"
|
|
26
|
-
variant="ghost"
|
|
27
|
-
flexShrink={0}
|
|
28
|
-
onClick={() => reader?.navigation.goToLeftOrTopSpineItem()}
|
|
29
|
-
disabled={
|
|
30
|
-
!navigation?.canGoLeftSpineItem && !navigation?.canGoTopSpineItem
|
|
31
|
-
}
|
|
32
|
-
>
|
|
33
|
-
{isVerticalDirection ? <RxDoubleArrowUp /> : <RxDoubleArrowLeft />}
|
|
34
|
-
</IconButton>
|
|
35
|
-
<Stack
|
|
36
|
-
flex={1}
|
|
37
|
-
maxW={400}
|
|
38
|
-
gap={2}
|
|
39
|
-
alignItems="center"
|
|
40
|
-
overflow="auto"
|
|
41
|
-
px={4}
|
|
42
|
-
>
|
|
43
|
-
<PaginationInfoSection />
|
|
44
|
-
<Box height={5} maxW={300} width="100%" overflow="visible">
|
|
45
|
-
<Scrubber />
|
|
46
|
-
</Box>
|
|
47
|
-
</Stack>
|
|
48
|
-
<IconButton
|
|
49
|
-
aria-label="right"
|
|
50
|
-
size="lg"
|
|
51
|
-
flexShrink={0}
|
|
52
|
-
variant="ghost"
|
|
53
|
-
disabled={
|
|
54
|
-
!navigation?.canGoRightSpineItem && !navigation?.canGoBottomSpineItem
|
|
55
|
-
}
|
|
56
|
-
onClick={() => {
|
|
57
|
-
reader?.navigation.goToRightOrBottomSpineItem()
|
|
58
|
-
}}
|
|
59
|
-
>
|
|
60
|
-
{isVerticalDirection ? <RxDoubleArrowDown /> : <RxDoubleArrowRight />}
|
|
61
|
-
</IconButton>
|
|
62
|
-
<TimeIndicator position="absolute" bottom={0} left={0} p={2} />
|
|
63
|
-
</QuickBar>
|
|
64
|
-
)
|
|
65
|
-
}
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import { HStack, Stack, Text } from "@chakra-ui/react"
|
|
2
|
-
import {
|
|
3
|
-
ProgressBar,
|
|
4
|
-
ProgressRoot,
|
|
5
|
-
ProgressValueText,
|
|
6
|
-
} from "../../components/ui/progress"
|
|
7
|
-
import { usePagination } from "../../pagination/usePagination"
|
|
8
|
-
import { useNavigationContext } from "../useNavigationContext"
|
|
9
|
-
|
|
10
|
-
export const PaginationInfoSection = () => {
|
|
11
|
-
const pagination = usePagination()
|
|
12
|
-
const {
|
|
13
|
-
hasOnlyOnePage,
|
|
14
|
-
leftPageIndex,
|
|
15
|
-
rightPageIndex,
|
|
16
|
-
totalApproximatePages,
|
|
17
|
-
beginAndEndAreDifferent,
|
|
18
|
-
} = useNavigationContext()
|
|
19
|
-
const progress = Math.round((pagination?.percentageEstimateOfBook ?? 0) * 100)
|
|
20
|
-
|
|
21
|
-
const buildTitleChain = (
|
|
22
|
-
chapterInfo: NonNullable<typeof pagination>["beginChapterInfo"],
|
|
23
|
-
): string => {
|
|
24
|
-
if (chapterInfo?.subChapter) {
|
|
25
|
-
return `${chapterInfo.title} / ${buildTitleChain(chapterInfo.subChapter)}`
|
|
26
|
-
}
|
|
27
|
-
return chapterInfo?.title || ""
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
const chapterTitle = buildTitleChain(pagination?.beginChapterInfo)
|
|
31
|
-
|
|
32
|
-
return (
|
|
33
|
-
<Stack alignItems="center" gap={1} maxW="100%" overflow="auto">
|
|
34
|
-
<ProgressRoot value={progress} size="xs" width={150}>
|
|
35
|
-
<HStack justifyContent="space-between">
|
|
36
|
-
<ProgressBar width={110} />
|
|
37
|
-
<ProgressValueText>{`${progress}%`}</ProgressValueText>
|
|
38
|
-
</HStack>
|
|
39
|
-
</ProgressRoot>
|
|
40
|
-
<Text truncate maxWidth="100%" fontSize="sm" mt={1}>
|
|
41
|
-
{chapterTitle ? `Chapter: ${chapterTitle}` : `\u00A0`}
|
|
42
|
-
</Text>
|
|
43
|
-
{!hasOnlyOnePage && (
|
|
44
|
-
<HStack>
|
|
45
|
-
<Text fontSize="xs">
|
|
46
|
-
{beginAndEndAreDifferent
|
|
47
|
-
? `${leftPageIndex + 1} - ${rightPageIndex + 1} of ${totalApproximatePages}`
|
|
48
|
-
: `${leftPageIndex + 1} of ${totalApproximatePages}`}
|
|
49
|
-
</Text>
|
|
50
|
-
{!!pagination?.hasChapters && (
|
|
51
|
-
<>
|
|
52
|
-
<Text>-</Text>
|
|
53
|
-
<Text fontSize="xs">
|
|
54
|
-
({(pagination?.beginAbsolutePageIndex ?? 0) + 1})
|
|
55
|
-
</Text>
|
|
56
|
-
</>
|
|
57
|
-
)}
|
|
58
|
-
</HStack>
|
|
59
|
-
)}
|
|
60
|
-
</Stack>
|
|
61
|
-
)
|
|
62
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { Presence, type PresenceProps } from "@chakra-ui/react"
|
|
2
|
-
import { memo } from "react"
|
|
3
|
-
|
|
4
|
-
export const QuickBar = memo(
|
|
5
|
-
({
|
|
6
|
-
children,
|
|
7
|
-
position,
|
|
8
|
-
...rest
|
|
9
|
-
}: { position: "top" | "bottom" } & PresenceProps) => {
|
|
10
|
-
return (
|
|
11
|
-
<Presence
|
|
12
|
-
display="flex"
|
|
13
|
-
flexDirection="row"
|
|
14
|
-
width="100%"
|
|
15
|
-
position="absolute"
|
|
16
|
-
{...(position === "bottom" ? { bottom: 0 } : { top: 0 })}
|
|
17
|
-
animationName={
|
|
18
|
-
position === "bottom"
|
|
19
|
-
? {
|
|
20
|
-
_open: "slide-from-bottom, fade-in",
|
|
21
|
-
_closed: "slide-to-bottom, fade-out",
|
|
22
|
-
}
|
|
23
|
-
: {
|
|
24
|
-
_open: "slide-from-top, fade-in",
|
|
25
|
-
_closed: "slide-to-top, fade-out",
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
animationDuration="moderate"
|
|
29
|
-
bgColor="bg.panel"
|
|
30
|
-
alignItems="center"
|
|
31
|
-
justifyContent="center"
|
|
32
|
-
shadow="md"
|
|
33
|
-
px={4}
|
|
34
|
-
{...rest}
|
|
35
|
-
>
|
|
36
|
-
{children}
|
|
37
|
-
</Presence>
|
|
38
|
-
)
|
|
39
|
-
},
|
|
40
|
-
)
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { memo } from "react"
|
|
2
|
-
import { BottomBar } from "./BottomBar"
|
|
3
|
-
import { TopBar } from "./TopBar"
|
|
4
|
-
|
|
5
|
-
export const QuickMenu = memo(
|
|
6
|
-
({
|
|
7
|
-
open,
|
|
8
|
-
onBackClick,
|
|
9
|
-
onMoreClick,
|
|
10
|
-
}: { open: boolean; onBackClick: () => void; onMoreClick: () => void }) => {
|
|
11
|
-
return (
|
|
12
|
-
<>
|
|
13
|
-
<TopBar
|
|
14
|
-
open={open}
|
|
15
|
-
onBackClick={onBackClick}
|
|
16
|
-
onMoreClick={onMoreClick}
|
|
17
|
-
/>
|
|
18
|
-
<BottomBar open={open} />
|
|
19
|
-
</>
|
|
20
|
-
)
|
|
21
|
-
},
|
|
22
|
-
)
|