funuicss 2.7.14 → 2.7.16
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/index.d.ts +1 -0
- package/index.js +3 -1
- package/index.tsx +1 -0
- package/package.json +1 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/ui/carousel/Carousel.d.ts +1 -0
- package/ui/carousel/Carousel.js +5 -5
- package/ui/carousel/Carousel.tsx +36 -30
- package/ui/flex/Flex.d.ts +1 -6
- package/ui/flex/Flex.js +15 -9
- package/ui/flex/Flex.tsx +15 -33
- package/ui/flex/FlexItem.d.ts +17 -0
- package/ui/flex/FlexItem.js +39 -0
- package/ui/flex/FlexItem.tsx +64 -0
- package/ui/video/Video.d.ts +2 -1
- package/ui/video/Video.js +10 -10
- package/ui/video/Video.tsx +3 -2
- package/ui/video/videoShortcuts.d.ts +1 -1
- package/ui/video/videoShortcuts.js +2 -2
- package/ui/video/videoShortcuts.ts +3 -2
package/ui/carousel/Carousel.js
CHANGED
|
@@ -43,10 +43,10 @@ var Circle_1 = __importDefault(require("../specials/Circle"));
|
|
|
43
43
|
var RowFlex_1 = __importDefault(require("../specials/RowFlex"));
|
|
44
44
|
var Functions_1 = require("../../utils/Functions");
|
|
45
45
|
var Carousel = function (_a) {
|
|
46
|
-
var _b = _a.scrollNumber, scrollNumber = _b === void 0 ? 320 : _b, _c = _a.gap, gap = _c === void 0 ? 0.5 : _c, _d = _a.funcss, funcss = _d === void 0 ? '' : _d, children = _a.children;
|
|
46
|
+
var _b = _a.scrollNumber, scrollNumber = _b === void 0 ? 320 : _b, _c = _a.gap, gap = _c === void 0 ? 0.5 : _c, _d = _a.funcss, funcss = _d === void 0 ? '' : _d, _e = _a.showDashes, showDashes = _e === void 0 ? true : _e, children = _a.children;
|
|
47
47
|
var scrollRef = (0, react_1.useRef)(null);
|
|
48
|
-
var
|
|
49
|
-
var
|
|
48
|
+
var _f = (0, react_1.useState)('start'), scrollPosition = _f[0], setScrollPosition = _f[1];
|
|
49
|
+
var _g = (0, react_1.useState)(false), isPhone = _g[0], setIsPhone = _g[1];
|
|
50
50
|
(0, react_1.useEffect)(function () {
|
|
51
51
|
if ((0, Functions_1.isTouchDevice)()) {
|
|
52
52
|
setIsPhone(true);
|
|
@@ -105,7 +105,7 @@ var Carousel = function (_a) {
|
|
|
105
105
|
!isPhone && (react_1.default.createElement("div", null,
|
|
106
106
|
react_1.default.createElement(Circle_1.default, { onClick: function () { return scroll('right'); } },
|
|
107
107
|
react_1.default.createElement(pi_1.PiCaretRight, { size: 24 }))))),
|
|
108
|
-
react_1.default.createElement("div", { className: "center padding-top-10" },
|
|
108
|
+
showDashes && (react_1.default.createElement("div", { className: "center padding-top-10" },
|
|
109
109
|
react_1.default.createElement(RowFlex_1.default, { gap: 0.5, justify: "center" }, ['start', 'middle', 'end'].map(function (pos) { return (react_1.default.createElement("div", { className: 'pointer ', key: pos, onClick: function () {
|
|
110
110
|
var _a, _b;
|
|
111
111
|
if (pos === 'start') {
|
|
@@ -127,6 +127,6 @@ var Carousel = function (_a) {
|
|
|
127
127
|
borderRadius: '50%',
|
|
128
128
|
transform: scrollPosition === pos ? 'scale(1.3)' : 'scale(0.9)',
|
|
129
129
|
transition: 'transform 0.3s ease, background 0.3s ease',
|
|
130
|
-
} })); })))));
|
|
130
|
+
} })); }))))));
|
|
131
131
|
};
|
|
132
132
|
exports.default = Carousel;
|
package/ui/carousel/Carousel.tsx
CHANGED
|
@@ -10,12 +10,14 @@ interface CarouselProps {
|
|
|
10
10
|
gap?: number;
|
|
11
11
|
funcss?: string;
|
|
12
12
|
children: ReactNode;
|
|
13
|
+
showDashes?: boolean;
|
|
13
14
|
}
|
|
14
15
|
|
|
15
16
|
const Carousel: React.FC<CarouselProps> = ({
|
|
16
17
|
scrollNumber = 320,
|
|
17
18
|
gap = 0.5,
|
|
18
19
|
funcss = '',
|
|
20
|
+
showDashes = true,
|
|
19
21
|
children,
|
|
20
22
|
}) => {
|
|
21
23
|
const scrollRef = useRef<HTMLDivElement | null>(null);
|
|
@@ -105,36 +107,40 @@ const Carousel: React.FC<CarouselProps> = ({
|
|
|
105
107
|
</RowFlex>
|
|
106
108
|
|
|
107
109
|
{/* Dashes below the carousel */}
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
110
|
+
{
|
|
111
|
+
showDashes && (
|
|
112
|
+
<div className="center padding-top-10">
|
|
113
|
+
<RowFlex gap={0.5} justify="center">
|
|
114
|
+
{['start', 'middle', 'end'].map((pos) => (
|
|
115
|
+
<div
|
|
116
|
+
className={'pointer '}
|
|
117
|
+
key={pos}
|
|
118
|
+
onClick={() => {
|
|
119
|
+
if(pos === 'start') {
|
|
120
|
+
scroll('left')
|
|
121
|
+
} else if(pos === 'middle') {
|
|
122
|
+
scrollRef.current?.scrollTo({
|
|
123
|
+
left: scrollRef.current?.scrollWidth / 2,
|
|
124
|
+
behavior: 'smooth',
|
|
125
|
+
});
|
|
126
|
+
} else if(pos === 'end') {
|
|
127
|
+
scroll('right')
|
|
128
|
+
}
|
|
129
|
+
}}
|
|
130
|
+
style={{
|
|
131
|
+
width: '10px',
|
|
132
|
+
height: '10px',
|
|
133
|
+
background: scrollPosition === pos ? 'var(--primary)' : 'var(--borderColor)',
|
|
134
|
+
borderRadius: '50%',
|
|
135
|
+
transform: scrollPosition === pos ? 'scale(1.3)' : 'scale(0.9)',
|
|
136
|
+
transition: 'transform 0.3s ease, background 0.3s ease',
|
|
137
|
+
}}
|
|
138
|
+
/>
|
|
139
|
+
))}
|
|
140
|
+
</RowFlex>
|
|
141
|
+
</div>
|
|
142
|
+
)
|
|
143
|
+
}
|
|
138
144
|
</div>
|
|
139
145
|
);
|
|
140
146
|
};
|
package/ui/flex/Flex.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
interface FlexProps {
|
|
3
|
-
as?: keyof JSX.IntrinsicElements;
|
|
4
3
|
className?: string;
|
|
5
4
|
funcss?: string;
|
|
6
5
|
id?: string;
|
|
@@ -15,15 +14,11 @@ interface FlexProps {
|
|
|
15
14
|
gapX?: number;
|
|
16
15
|
gapY?: number;
|
|
17
16
|
gapUnit?: 'rem' | 'px' | 'em';
|
|
18
|
-
grow?: number;
|
|
19
|
-
shrink?: number;
|
|
20
|
-
basis?: string;
|
|
21
|
-
flex?: string;
|
|
22
17
|
responsiveSmall?: boolean;
|
|
23
18
|
responsiveMedium?: boolean;
|
|
24
19
|
responsiveLarge?: boolean;
|
|
25
20
|
fullWidth?: boolean;
|
|
26
21
|
fullHeight?: boolean;
|
|
27
22
|
}
|
|
28
|
-
export default function Flex({
|
|
23
|
+
export default function Flex({ className, funcss, id, children, style, direction, wrap, justify, alignItems, alignContent, gap, gapX, gapY, gapUnit, responsiveSmall, responsiveMedium, responsiveLarge, fullWidth, fullHeight, ...rest }: FlexProps): React.JSX.Element;
|
|
29
24
|
export {};
|
package/ui/flex/Flex.js
CHANGED
|
@@ -29,19 +29,25 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
29
29
|
exports.default = Flex;
|
|
30
30
|
var react_1 = __importDefault(require("react"));
|
|
31
31
|
function Flex(_a) {
|
|
32
|
-
var
|
|
32
|
+
var className = _a.className, funcss = _a.funcss, id = _a.id, children = _a.children, _b = _a.style, style = _b === void 0 ? {} : _b,
|
|
33
33
|
// Flex container
|
|
34
|
-
|
|
34
|
+
_c = _a.direction,
|
|
35
35
|
// Flex container
|
|
36
|
-
direction =
|
|
36
|
+
direction = _c === void 0 ? 'row' : _c, _d = _a.wrap, wrap = _d === void 0 ? 'wrap' : _d, justify = _a.justify, alignItems = _a.alignItems, alignContent = _a.alignContent,
|
|
37
37
|
// Gap
|
|
38
|
-
gap = _a.gap, gapX = _a.gapX, gapY = _a.gapY,
|
|
39
|
-
// Flex item
|
|
40
|
-
grow = _a.grow, shrink = _a.shrink, basis = _a.basis, flex = _a.flex,
|
|
38
|
+
gap = _a.gap, gapX = _a.gapX, gapY = _a.gapY, _e = _a.gapUnit, gapUnit = _e === void 0 ? 'rem' : _e,
|
|
41
39
|
// Responsive
|
|
42
40
|
responsiveSmall = _a.responsiveSmall, responsiveMedium = _a.responsiveMedium, responsiveLarge = _a.responsiveLarge,
|
|
43
41
|
// Size
|
|
44
|
-
fullWidth = _a.fullWidth, fullHeight = _a.fullHeight, rest = __rest(_a, ["
|
|
45
|
-
var
|
|
46
|
-
|
|
42
|
+
fullWidth = _a.fullWidth, fullHeight = _a.fullHeight, rest = __rest(_a, ["className", "funcss", "id", "children", "style", "direction", "wrap", "justify", "alignItems", "alignContent", "gap", "gapX", "gapY", "gapUnit", "responsiveSmall", "responsiveMedium", "responsiveLarge", "fullWidth", "fullHeight"]);
|
|
43
|
+
var combinedClassName = [
|
|
44
|
+
className,
|
|
45
|
+
funcss,
|
|
46
|
+
responsiveSmall && 'responsiveSmall',
|
|
47
|
+
responsiveMedium && 'responsiveMedium',
|
|
48
|
+
responsiveLarge && 'responsiveLarge',
|
|
49
|
+
]
|
|
50
|
+
.filter(Boolean)
|
|
51
|
+
.join(' ');
|
|
52
|
+
return (react_1.default.createElement("div", __assign({ id: id, className: combinedClassName, style: __assign({ display: 'flex', flexDirection: direction, flexWrap: wrap, justifyContent: justify, alignItems: alignItems, alignContent: alignContent, gap: gap !== undefined ? "".concat(gap).concat(gapUnit) : undefined, columnGap: gapX !== undefined ? "".concat(gapX).concat(gapUnit) : undefined, rowGap: gapY !== undefined ? "".concat(gapY).concat(gapUnit) : undefined, width: fullWidth ? '100%' : undefined, height: fullHeight ? '100%' : undefined }, style) }, rest), children));
|
|
47
53
|
}
|
package/ui/flex/Flex.tsx
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
|
|
4
4
|
interface FlexProps {
|
|
5
|
-
as?: keyof JSX.IntrinsicElements; // Render as any tag (e.g. section, ul)
|
|
6
5
|
className?: string;
|
|
7
6
|
funcss?: string;
|
|
8
7
|
id?: string;
|
|
@@ -22,12 +21,6 @@ interface FlexProps {
|
|
|
22
21
|
gapY?: number;
|
|
23
22
|
gapUnit?: 'rem' | 'px' | 'em';
|
|
24
23
|
|
|
25
|
-
// Flex item behavior
|
|
26
|
-
grow?: number;
|
|
27
|
-
shrink?: number;
|
|
28
|
-
basis?: string;
|
|
29
|
-
flex?: string;
|
|
30
|
-
|
|
31
24
|
// Responsive helpers
|
|
32
25
|
responsiveSmall?: boolean;
|
|
33
26
|
responsiveMedium?: boolean;
|
|
@@ -39,7 +32,6 @@ interface FlexProps {
|
|
|
39
32
|
}
|
|
40
33
|
|
|
41
34
|
export default function Flex({
|
|
42
|
-
as: Component = 'div',
|
|
43
35
|
className,
|
|
44
36
|
funcss,
|
|
45
37
|
id,
|
|
@@ -59,12 +51,6 @@ export default function Flex({
|
|
|
59
51
|
gapY,
|
|
60
52
|
gapUnit = 'rem',
|
|
61
53
|
|
|
62
|
-
// Flex item
|
|
63
|
-
grow,
|
|
64
|
-
shrink,
|
|
65
|
-
basis,
|
|
66
|
-
flex,
|
|
67
|
-
|
|
68
54
|
// Responsive
|
|
69
55
|
responsiveSmall,
|
|
70
56
|
responsiveMedium,
|
|
@@ -75,20 +61,20 @@ export default function Flex({
|
|
|
75
61
|
fullHeight,
|
|
76
62
|
...rest
|
|
77
63
|
}: FlexProps) {
|
|
78
|
-
const
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
64
|
+
const combinedClassName = [
|
|
65
|
+
className,
|
|
66
|
+
funcss,
|
|
67
|
+
responsiveSmall && 'responsiveSmall',
|
|
68
|
+
responsiveMedium && 'responsiveMedium',
|
|
69
|
+
responsiveLarge && 'responsiveLarge',
|
|
70
|
+
]
|
|
71
|
+
.filter(Boolean)
|
|
72
|
+
.join(' ');
|
|
83
73
|
|
|
84
74
|
return (
|
|
85
|
-
<
|
|
75
|
+
<div
|
|
86
76
|
id={id}
|
|
87
|
-
className={
|
|
88
|
-
${className || ''}
|
|
89
|
-
${funcss || ''}
|
|
90
|
-
${responsiveClasses}
|
|
91
|
-
`.trim()}
|
|
77
|
+
className={combinedClassName}
|
|
92
78
|
style={{
|
|
93
79
|
display: 'flex',
|
|
94
80
|
flexDirection: direction,
|
|
@@ -96,13 +82,9 @@ export default function Flex({
|
|
|
96
82
|
justifyContent: justify,
|
|
97
83
|
alignItems: alignItems,
|
|
98
84
|
alignContent: alignContent,
|
|
99
|
-
gap: gap ? `${gap}${gapUnit}` : undefined,
|
|
100
|
-
columnGap: gapX ? `${gapX}${gapUnit}` : undefined,
|
|
101
|
-
rowGap: gapY ? `${gapY}${gapUnit}` : undefined,
|
|
102
|
-
flexGrow: grow,
|
|
103
|
-
flexShrink: shrink,
|
|
104
|
-
flexBasis: basis,
|
|
105
|
-
flex: flex,
|
|
85
|
+
gap: gap !== undefined ? `${gap}${gapUnit}` : undefined,
|
|
86
|
+
columnGap: gapX !== undefined ? `${gapX}${gapUnit}` : undefined,
|
|
87
|
+
rowGap: gapY !== undefined ? `${gapY}${gapUnit}` : undefined,
|
|
106
88
|
width: fullWidth ? '100%' : undefined,
|
|
107
89
|
height: fullHeight ? '100%' : undefined,
|
|
108
90
|
...style,
|
|
@@ -110,6 +92,6 @@ export default function Flex({
|
|
|
110
92
|
{...rest}
|
|
111
93
|
>
|
|
112
94
|
{children}
|
|
113
|
-
</
|
|
95
|
+
</div>
|
|
114
96
|
);
|
|
115
97
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface FlexItemProps {
|
|
3
|
+
className?: string;
|
|
4
|
+
funcss?: string;
|
|
5
|
+
id?: string;
|
|
6
|
+
children?: React.ReactNode;
|
|
7
|
+
style?: React.CSSProperties;
|
|
8
|
+
flex?: string;
|
|
9
|
+
grow?: number;
|
|
10
|
+
shrink?: number;
|
|
11
|
+
basis?: string;
|
|
12
|
+
alignSelf?: 'auto' | 'flex-start' | 'flex-end' | 'center' | 'baseline' | 'stretch';
|
|
13
|
+
fullWidth?: boolean;
|
|
14
|
+
fullHeight?: boolean;
|
|
15
|
+
}
|
|
16
|
+
export default function FlexItem({ className, funcss, id, children, style, flex, grow, shrink, basis, alignSelf, fullWidth, fullHeight, ...rest }: FlexItemProps): React.JSX.Element;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
'use client';
|
|
3
|
+
var __assign = (this && this.__assign) || function () {
|
|
4
|
+
__assign = Object.assign || function(t) {
|
|
5
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
6
|
+
s = arguments[i];
|
|
7
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
8
|
+
t[p] = s[p];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
return __assign.apply(this, arguments);
|
|
13
|
+
};
|
|
14
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
15
|
+
var t = {};
|
|
16
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
17
|
+
t[p] = s[p];
|
|
18
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
19
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
20
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
21
|
+
t[p[i]] = s[p[i]];
|
|
22
|
+
}
|
|
23
|
+
return t;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.default = FlexItem;
|
|
30
|
+
var react_1 = __importDefault(require("react"));
|
|
31
|
+
function FlexItem(_a) {
|
|
32
|
+
var className = _a.className, funcss = _a.funcss, id = _a.id, children = _a.children, _b = _a.style, style = _b === void 0 ? {} : _b,
|
|
33
|
+
// Flex item
|
|
34
|
+
flex = _a.flex, grow = _a.grow, shrink = _a.shrink, basis = _a.basis, alignSelf = _a.alignSelf,
|
|
35
|
+
// Size
|
|
36
|
+
fullWidth = _a.fullWidth, fullHeight = _a.fullHeight, rest = __rest(_a, ["className", "funcss", "id", "children", "style", "flex", "grow", "shrink", "basis", "alignSelf", "fullWidth", "fullHeight"]);
|
|
37
|
+
var combinedClassName = [className, funcss].filter(Boolean).join(' ');
|
|
38
|
+
return (react_1.default.createElement("div", __assign({ id: id, className: combinedClassName, style: __assign({ flex: flex, flexGrow: flex ? undefined : grow, flexShrink: flex ? undefined : shrink, flexBasis: flex ? undefined : basis, alignSelf: alignSelf, width: fullWidth ? '100%' : undefined, height: fullHeight ? '100%' : undefined }, style) }, rest), children));
|
|
39
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
|
|
4
|
+
interface FlexItemProps {
|
|
5
|
+
className?: string;
|
|
6
|
+
funcss?: string;
|
|
7
|
+
id?: string;
|
|
8
|
+
children?: React.ReactNode;
|
|
9
|
+
style?: React.CSSProperties;
|
|
10
|
+
|
|
11
|
+
// Flex item behaviors
|
|
12
|
+
flex?: string;
|
|
13
|
+
grow?: number;
|
|
14
|
+
shrink?: number;
|
|
15
|
+
basis?: string;
|
|
16
|
+
alignSelf?: 'auto' | 'flex-start' | 'flex-end' | 'center' | 'baseline' | 'stretch';
|
|
17
|
+
|
|
18
|
+
// Size helpers
|
|
19
|
+
fullWidth?: boolean;
|
|
20
|
+
fullHeight?: boolean;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export default function FlexItem({
|
|
24
|
+
className,
|
|
25
|
+
funcss,
|
|
26
|
+
id,
|
|
27
|
+
children,
|
|
28
|
+
style = {},
|
|
29
|
+
|
|
30
|
+
// Flex item
|
|
31
|
+
flex,
|
|
32
|
+
grow,
|
|
33
|
+
shrink,
|
|
34
|
+
basis,
|
|
35
|
+
alignSelf,
|
|
36
|
+
|
|
37
|
+
// Size
|
|
38
|
+
fullWidth,
|
|
39
|
+
fullHeight,
|
|
40
|
+
|
|
41
|
+
...rest
|
|
42
|
+
}: FlexItemProps) {
|
|
43
|
+
const combinedClassName = [className, funcss].filter(Boolean).join(' ');
|
|
44
|
+
|
|
45
|
+
return (
|
|
46
|
+
<div
|
|
47
|
+
id={id}
|
|
48
|
+
className={combinedClassName}
|
|
49
|
+
style={{
|
|
50
|
+
flex,
|
|
51
|
+
flexGrow: flex ? undefined : grow,
|
|
52
|
+
flexShrink: flex ? undefined : shrink,
|
|
53
|
+
flexBasis: flex ? undefined : basis,
|
|
54
|
+
alignSelf,
|
|
55
|
+
width: fullWidth ? '100%' : undefined,
|
|
56
|
+
height: fullHeight ? '100%' : undefined,
|
|
57
|
+
...style,
|
|
58
|
+
}}
|
|
59
|
+
{...rest}
|
|
60
|
+
>
|
|
61
|
+
{children}
|
|
62
|
+
</div>
|
|
63
|
+
);
|
|
64
|
+
}
|
package/ui/video/Video.d.ts
CHANGED
|
@@ -4,8 +4,9 @@ interface VideoProps {
|
|
|
4
4
|
poster?: string;
|
|
5
5
|
onDuration?: (duration: number) => void;
|
|
6
6
|
isPause?: boolean;
|
|
7
|
+
spacebarPlay?: boolean;
|
|
7
8
|
className?: string;
|
|
8
9
|
autoPlay?: boolean;
|
|
9
10
|
}
|
|
10
|
-
export default function Video({ src, poster, onDuration, isPause, className, autoPlay, ...rest }: VideoProps): React.JSX.Element;
|
|
11
|
+
export default function Video({ src, poster, onDuration, isPause, className, autoPlay, spacebarPlay, ...rest }: VideoProps): React.JSX.Element;
|
|
11
12
|
export {};
|
package/ui/video/Video.js
CHANGED
|
@@ -71,18 +71,18 @@ var Tip_1 = __importDefault(require("../tooltip/Tip"));
|
|
|
71
71
|
var videoFunctions_1 = require("./videoFunctions");
|
|
72
72
|
var videoShortcuts_1 = require("./videoShortcuts");
|
|
73
73
|
function Video(_a) {
|
|
74
|
-
var src = _a.src, poster = _a.poster, onDuration = _a.onDuration, isPause = _a.isPause, className = _a.className, autoPlay = _a.autoPlay, rest = __rest(_a, ["src", "poster", "onDuration", "isPause", "className", "autoPlay"]);
|
|
74
|
+
var src = _a.src, poster = _a.poster, onDuration = _a.onDuration, isPause = _a.isPause, className = _a.className, autoPlay = _a.autoPlay, _b = _a.spacebarPlay, spacebarPlay = _b === void 0 ? true : _b, rest = __rest(_a, ["src", "poster", "onDuration", "isPause", "className", "autoPlay", "spacebarPlay"]);
|
|
75
75
|
var videoRef = (0, react_1.useRef)(null);
|
|
76
76
|
var containerRef = (0, react_1.useRef)(null);
|
|
77
77
|
var animationFrameRef = (0, react_1.useRef)(null);
|
|
78
|
-
var
|
|
79
|
-
var
|
|
80
|
-
var
|
|
81
|
-
var
|
|
82
|
-
var
|
|
83
|
-
var
|
|
84
|
-
var
|
|
85
|
-
var
|
|
78
|
+
var _c = (0, react_1.useState)(false), isPlaying = _c[0], setIsPlaying = _c[1];
|
|
79
|
+
var _d = (0, react_1.useState)(0), currentTime = _d[0], setCurrentTime = _d[1];
|
|
80
|
+
var _e = (0, react_1.useState)(0), duration = _e[0], setDuration = _e[1];
|
|
81
|
+
var _f = (0, react_1.useState)(1), volume = _f[0], setVolume = _f[1];
|
|
82
|
+
var _g = (0, react_1.useState)(false), isFullScreen = _g[0], setIsFullScreen = _g[1];
|
|
83
|
+
var _h = (0, react_1.useState)(false), showVolume = _h[0], setShowVolume = _h[1];
|
|
84
|
+
var _j = (0, react_1.useState)(true), isMouseMoving = _j[0], setIsMouseMoving = _j[1];
|
|
85
|
+
var _k = (0, react_1.useState)(false), hasStarted = _k[0], setHasStarted = _k[1];
|
|
86
86
|
var handleVideoEnd = function () {
|
|
87
87
|
setIsPlaying(false);
|
|
88
88
|
setCurrentTime(duration); // optional
|
|
@@ -117,7 +117,7 @@ function Video(_a) {
|
|
|
117
117
|
}
|
|
118
118
|
};
|
|
119
119
|
(0, react_1.useEffect)(function () {
|
|
120
|
-
var handleKey = function (e) { return (0, videoShortcuts_1.handleKeyDown)(e, isPlaying, playVideo, pauseVideo); };
|
|
120
|
+
var handleKey = function (e) { return (0, videoShortcuts_1.handleKeyDown)(e, isPlaying, playVideo, pauseVideo, spacebarPlay); };
|
|
121
121
|
document.addEventListener('keydown', handleKey);
|
|
122
122
|
return function () { return document.removeEventListener('keydown', handleKey); };
|
|
123
123
|
}, [isPlaying]);
|
package/ui/video/Video.tsx
CHANGED
|
@@ -25,11 +25,12 @@ interface VideoProps {
|
|
|
25
25
|
poster?: string;
|
|
26
26
|
onDuration?: (duration: number) => void;
|
|
27
27
|
isPause?: boolean;
|
|
28
|
+
spacebarPlay?: boolean;
|
|
28
29
|
className?: string;
|
|
29
30
|
autoPlay?: boolean;
|
|
30
31
|
}
|
|
31
32
|
|
|
32
|
-
export default function Video({ src, poster, onDuration, isPause, className, autoPlay , ...rest }: VideoProps) {
|
|
33
|
+
export default function Video({ src, poster, onDuration, isPause, className, autoPlay , spacebarPlay = true, ...rest }: VideoProps) {
|
|
33
34
|
const videoRef = useRef<HTMLVideoElement | null>(null);
|
|
34
35
|
const containerRef = useRef<HTMLDivElement | null>(null);
|
|
35
36
|
const animationFrameRef = useRef<number | null>(null);
|
|
@@ -87,7 +88,7 @@ const pauseVideo = () => {
|
|
|
87
88
|
|
|
88
89
|
|
|
89
90
|
useEffect(() => {
|
|
90
|
-
const handleKey = (e: KeyboardEvent) => handleKeyDown(e, isPlaying, playVideo, pauseVideo);
|
|
91
|
+
const handleKey = (e: KeyboardEvent) => handleKeyDown(e, isPlaying, playVideo, pauseVideo, spacebarPlay);
|
|
91
92
|
document.addEventListener('keydown', handleKey);
|
|
92
93
|
return () => document.removeEventListener('keydown', handleKey);
|
|
93
94
|
}, [isPlaying]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const handleKeyDown: (e: KeyboardEvent, isPlaying: boolean, playVideo: () => void, pauseVideo: () => void) => void;
|
|
1
|
+
export declare const handleKeyDown: (e: KeyboardEvent, isPlaying: boolean, playVideo: () => void, pauseVideo: () => void, spacebarPlay?: boolean) => void;
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.handleKeyDown = void 0;
|
|
4
4
|
// videoShortcuts.ts
|
|
5
|
-
var handleKeyDown = function (e, isPlaying, playVideo, pauseVideo) {
|
|
6
|
-
if (e.key === ' ') {
|
|
5
|
+
var handleKeyDown = function (e, isPlaying, playVideo, pauseVideo, spacebarPlay) {
|
|
6
|
+
if (e.key === ' ' && spacebarPlay) {
|
|
7
7
|
e.preventDefault();
|
|
8
8
|
isPlaying ? pauseVideo() : playVideo();
|
|
9
9
|
}
|
|
@@ -3,9 +3,10 @@ export const handleKeyDown = (
|
|
|
3
3
|
e: KeyboardEvent,
|
|
4
4
|
isPlaying: boolean,
|
|
5
5
|
playVideo: () => void,
|
|
6
|
-
pauseVideo: () => void
|
|
6
|
+
pauseVideo: () => void ,
|
|
7
|
+
spacebarPlay?: boolean
|
|
7
8
|
) => {
|
|
8
|
-
if (e.key === ' ') {
|
|
9
|
+
if (e.key === ' ' && spacebarPlay) {
|
|
9
10
|
e.preventDefault();
|
|
10
11
|
isPlaying ? pauseVideo() : playVideo();
|
|
11
12
|
}
|