@editframe/react 0.0.1 → 0.1.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/.turbo/turbo-build.log +17 -0
- package/CHANGELOG.md +7 -0
- package/package.json +2 -5
- package/prettier.config.js +4 -0
- package/src/Player.tsx +34 -34
- package/.giteep +0 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
|
|
2
|
+
> @editframe/react@0.1.0 build /home/runner/work/js/js/packages/react
|
|
3
|
+
> tsup src/index.ts --format esm,cjs --dts --minify
|
|
4
|
+
|
|
5
|
+
[34mCLI[39m Building entry: src/index.ts
|
|
6
|
+
[34mCLI[39m Using tsconfig: tsconfig.json
|
|
7
|
+
[34mCLI[39m tsup v6.6.3
|
|
8
|
+
[34mCLI[39m Target: es6
|
|
9
|
+
[34mESM[39m Build start
|
|
10
|
+
[34mCJS[39m Build start
|
|
11
|
+
[32mCJS[39m [1mdist/index.js [22m[32m1.31 KB[39m
|
|
12
|
+
[32mCJS[39m ⚡️ Build success in 74ms
|
|
13
|
+
[32mESM[39m [1mdist/index.mjs [22m[32m830.00 B[39m
|
|
14
|
+
[32mESM[39m ⚡️ Build success in 81ms
|
|
15
|
+
[34mDTS[39m Build start
|
|
16
|
+
[32mDTS[39m ⚡️ Build success in 3997ms
|
|
17
|
+
[32mDTS[39m [1mdist/index.d.ts [22m[32m564.00 B[39m
|
package/CHANGELOG.md
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@editframe/react",
|
|
3
|
-
"
|
|
3
|
+
"author": "Editframe",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./dist/index.d.ts",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -19,10 +19,7 @@
|
|
|
19
19
|
"peerDependencies": {
|
|
20
20
|
"react": "^18.2.0"
|
|
21
21
|
},
|
|
22
|
-
"
|
|
23
|
-
"publishConfig": {
|
|
24
|
-
"access": "restricted"
|
|
25
|
-
},
|
|
22
|
+
"version": "0.1.0",
|
|
26
23
|
"scripts": {
|
|
27
24
|
"build": "tsup src/index.ts --format esm,cjs --dts --minify",
|
|
28
25
|
"dev": "npm run build -- --watch",
|
package/src/Player.tsx
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import { Player as PlayerClass } from
|
|
2
|
-
import { CompositionConfigEditor } from
|
|
3
|
-
import React, { useEffect, useRef } from
|
|
4
|
-
import { v4 as uuid } from
|
|
1
|
+
import { Player as PlayerClass } from '@editframe/embed'
|
|
2
|
+
import { CompositionConfigEditor } from '@editframe/shared-types'
|
|
3
|
+
import React, { useEffect, useRef } from 'react'
|
|
4
|
+
import { v4 as uuid } from 'uuid'
|
|
5
5
|
|
|
6
6
|
export interface IPlayerProps
|
|
7
7
|
extends React.DetailedHTMLProps<
|
|
8
8
|
React.HTMLAttributes<HTMLDivElement>,
|
|
9
9
|
HTMLDivElement
|
|
10
10
|
> {
|
|
11
|
-
applicationId?: string
|
|
12
|
-
config: CompositionConfigEditor
|
|
11
|
+
applicationId?: string
|
|
12
|
+
config: CompositionConfigEditor
|
|
13
13
|
dimensions?: {
|
|
14
|
-
height: string
|
|
15
|
-
width: string
|
|
16
|
-
}
|
|
17
|
-
hideControls?: boolean
|
|
18
|
-
host?: string
|
|
19
|
-
loop: boolean
|
|
20
|
-
playerState?:
|
|
21
|
-
seek?: number
|
|
14
|
+
height: string
|
|
15
|
+
width: string
|
|
16
|
+
}
|
|
17
|
+
hideControls?: boolean
|
|
18
|
+
host?: string
|
|
19
|
+
loop: boolean
|
|
20
|
+
playerState?: 'playing' | 'paused' | 'stopped'
|
|
21
|
+
seek?: number
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
const Player: React.FunctionComponent<IPlayerProps> = ({
|
|
@@ -32,9 +32,9 @@ const Player: React.FunctionComponent<IPlayerProps> = ({
|
|
|
32
32
|
playerState,
|
|
33
33
|
seek,
|
|
34
34
|
}) => {
|
|
35
|
-
const player = useRef(true)
|
|
36
|
-
const embed = useRef({} as any)
|
|
37
|
-
const containerId = `ef-player-${uuid().slice(0, 6)}
|
|
35
|
+
const player = useRef(true)
|
|
36
|
+
const embed = useRef({} as any)
|
|
37
|
+
const containerId = `ef-player-${uuid().slice(0, 6)}`
|
|
38
38
|
useEffect(() => {
|
|
39
39
|
if (!player.current && !embed.current.setState) {
|
|
40
40
|
embed.current = new PlayerClass({
|
|
@@ -42,36 +42,36 @@ const Player: React.FunctionComponent<IPlayerProps> = ({
|
|
|
42
42
|
config,
|
|
43
43
|
containerId,
|
|
44
44
|
dimensions,
|
|
45
|
-
host: host ||
|
|
45
|
+
host: host || 'https://embed.editframe.com',
|
|
46
46
|
hideControls,
|
|
47
|
-
})
|
|
48
|
-
player.current = true
|
|
47
|
+
})
|
|
48
|
+
player.current = true
|
|
49
49
|
}
|
|
50
50
|
return () => {
|
|
51
|
-
player.current = false
|
|
52
|
-
}
|
|
53
|
-
}, [])
|
|
51
|
+
player.current = false
|
|
52
|
+
}
|
|
53
|
+
}, [])
|
|
54
54
|
useEffect(() => {
|
|
55
55
|
if (embed.current && embed.current.setState) {
|
|
56
|
-
embed.current.setState(playerState)
|
|
56
|
+
embed.current.setState(playerState)
|
|
57
57
|
}
|
|
58
58
|
return () => {
|
|
59
59
|
if (embed.current && embed.current.setState) {
|
|
60
|
-
embed.current.setState(
|
|
60
|
+
embed.current.setState('stopped')
|
|
61
61
|
}
|
|
62
|
-
}
|
|
63
|
-
}, [playerState])
|
|
62
|
+
}
|
|
63
|
+
}, [playerState])
|
|
64
64
|
useEffect(() => {
|
|
65
65
|
if (embed.current && embed.current.setState) {
|
|
66
|
-
embed.current.seek(seek)
|
|
66
|
+
embed.current.seek(seek)
|
|
67
67
|
}
|
|
68
68
|
return () => {
|
|
69
69
|
if (embed.current && embed.current.setState) {
|
|
70
|
-
embed.current.seek(0)
|
|
70
|
+
embed.current.seek(0)
|
|
71
71
|
}
|
|
72
|
-
}
|
|
73
|
-
}, [seek])
|
|
72
|
+
}
|
|
73
|
+
}, [seek])
|
|
74
74
|
|
|
75
|
-
return <div id={containerId}>{children}</div
|
|
76
|
-
}
|
|
77
|
-
export default Player
|
|
75
|
+
return <div id={containerId}>{children}</div>
|
|
76
|
+
}
|
|
77
|
+
export default Player
|
package/.giteep
DELETED
|
File without changes
|