@editframe/react 0.1.0 → 0.1.1
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/index.d.ts +19 -0
- package/dist/index.js +1 -0
- package/dist/index.mjs +1 -0
- package/package.json +4 -1
- package/.prettierignore +0 -4
- package/.turbo/turbo-build.log +0 -17
- package/CHANGELOG.md +0 -7
- package/prettier.config.js +0 -4
- package/src/Player.tsx +0 -77
- package/src/index.ts +0 -1
- package/tsconfig.json +0 -4
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { CompositionConfigEditor } from '@editframe/shared-types';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
|
|
4
|
+
interface IPlayerProps extends React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement> {
|
|
5
|
+
applicationId?: string;
|
|
6
|
+
config: CompositionConfigEditor;
|
|
7
|
+
dimensions?: {
|
|
8
|
+
height: string;
|
|
9
|
+
width: string;
|
|
10
|
+
};
|
|
11
|
+
hideControls?: boolean;
|
|
12
|
+
host?: string;
|
|
13
|
+
loop: boolean;
|
|
14
|
+
playerState?: 'playing' | 'paused' | 'stopped';
|
|
15
|
+
seek?: number;
|
|
16
|
+
}
|
|
17
|
+
declare const Player: React.FunctionComponent<IPlayerProps>;
|
|
18
|
+
|
|
19
|
+
export { Player };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var c=Object.defineProperty;var P=Object.getOwnPropertyDescriptor;var h=Object.getOwnPropertyNames;var C=Object.prototype.hasOwnProperty;var S=(r,t)=>{for(var i in t)c(r,i,{get:t[i],enumerable:!0})},b=(r,t,i,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of h(t))!C.call(r,n)&&n!==i&&c(r,n,{get:()=>t[n],enumerable:!(s=P(t,n))||s.enumerable});return r};var v=r=>b(c({},"__esModule",{value:!0}),r);var R={};S(R,{Player:()=>m});module.exports=v(R);var f=require("@editframe/embed"),o=require("react"),d=require("uuid"),y=require("react/jsx-runtime"),E=({applicationId:r,children:t,config:i,dimensions:s,hideControls:n,host:g,loop:H,playerState:u,seek:p})=>{let a=(0,o.useRef)(!0),e=(0,o.useRef)({}),l=`ef-player-${(0,d.v4)().slice(0,6)}`;return(0,o.useEffect)(()=>(!a.current&&!e.current.setState&&(e.current=new f.Player({applicationId:r,config:i,containerId:l,dimensions:s,host:g||"https://embed.editframe.com",hideControls:n}),a.current=!0),()=>{a.current=!1}),[]),(0,o.useEffect)(()=>(e.current&&e.current.setState&&e.current.setState(u),()=>{e.current&&e.current.setState&&e.current.setState("stopped")}),[u]),(0,o.useEffect)(()=>(e.current&&e.current.setState&&e.current.seek(p),()=>{e.current&&e.current.setState&&e.current.seek(0)}),[p]),(0,y.jsx)("div",{id:l,children:t})},m=E;0&&(module.exports={Player});
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Player as d}from"@editframe/embed";import{useEffect as r,useRef as s}from"react";import{v4 as m}from"uuid";import{jsx as P}from"react/jsx-runtime";var y=({applicationId:a,children:c,config:u,dimensions:p,hideControls:l,host:f,loop:h,playerState:n,seek:o})=>{let t=s(!0),e=s({}),i=`ef-player-${m().slice(0,6)}`;return r(()=>(!t.current&&!e.current.setState&&(e.current=new d({applicationId:a,config:u,containerId:i,dimensions:p,host:f||"https://embed.editframe.com",hideControls:l}),t.current=!0),()=>{t.current=!1}),[]),r(()=>(e.current&&e.current.setState&&e.current.setState(n),()=>{e.current&&e.current.setState&&e.current.setState("stopped")}),[n]),r(()=>(e.current&&e.current.setState&&e.current.seek(o),()=>{e.current&&e.current.setState&&e.current.seek(0)}),[o]),P("div",{id:i,children:c})},g=y;export{g as Player};
|
package/package.json
CHANGED
package/.prettierignore
DELETED
package/.turbo/turbo-build.log
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
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
DELETED
package/prettier.config.js
DELETED
package/src/Player.tsx
DELETED
|
@@ -1,77 +0,0 @@
|
|
|
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
|
-
|
|
6
|
-
export interface IPlayerProps
|
|
7
|
-
extends React.DetailedHTMLProps<
|
|
8
|
-
React.HTMLAttributes<HTMLDivElement>,
|
|
9
|
-
HTMLDivElement
|
|
10
|
-
> {
|
|
11
|
-
applicationId?: string
|
|
12
|
-
config: CompositionConfigEditor
|
|
13
|
-
dimensions?: {
|
|
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
|
-
}
|
|
23
|
-
|
|
24
|
-
const Player: React.FunctionComponent<IPlayerProps> = ({
|
|
25
|
-
applicationId,
|
|
26
|
-
children,
|
|
27
|
-
config,
|
|
28
|
-
dimensions,
|
|
29
|
-
hideControls,
|
|
30
|
-
host,
|
|
31
|
-
loop,
|
|
32
|
-
playerState,
|
|
33
|
-
seek,
|
|
34
|
-
}) => {
|
|
35
|
-
const player = useRef(true)
|
|
36
|
-
const embed = useRef({} as any)
|
|
37
|
-
const containerId = `ef-player-${uuid().slice(0, 6)}`
|
|
38
|
-
useEffect(() => {
|
|
39
|
-
if (!player.current && !embed.current.setState) {
|
|
40
|
-
embed.current = new PlayerClass({
|
|
41
|
-
applicationId,
|
|
42
|
-
config,
|
|
43
|
-
containerId,
|
|
44
|
-
dimensions,
|
|
45
|
-
host: host || 'https://embed.editframe.com',
|
|
46
|
-
hideControls,
|
|
47
|
-
})
|
|
48
|
-
player.current = true
|
|
49
|
-
}
|
|
50
|
-
return () => {
|
|
51
|
-
player.current = false
|
|
52
|
-
}
|
|
53
|
-
}, [])
|
|
54
|
-
useEffect(() => {
|
|
55
|
-
if (embed.current && embed.current.setState) {
|
|
56
|
-
embed.current.setState(playerState)
|
|
57
|
-
}
|
|
58
|
-
return () => {
|
|
59
|
-
if (embed.current && embed.current.setState) {
|
|
60
|
-
embed.current.setState('stopped')
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
}, [playerState])
|
|
64
|
-
useEffect(() => {
|
|
65
|
-
if (embed.current && embed.current.setState) {
|
|
66
|
-
embed.current.seek(seek)
|
|
67
|
-
}
|
|
68
|
-
return () => {
|
|
69
|
-
if (embed.current && embed.current.setState) {
|
|
70
|
-
embed.current.seek(0)
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
}, [seek])
|
|
74
|
-
|
|
75
|
-
return <div id={containerId}>{children}</div>
|
|
76
|
-
}
|
|
77
|
-
export default Player
|
package/src/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as Player } from "./Player";
|
package/tsconfig.json
DELETED