@editframe/react 0.16.8-beta.0 → 0.18.3-beta.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/components/TimeDisplay.js +6 -8
- package/dist/create-component.js +113 -121
- package/dist/elements/Audio.js +4 -6
- package/dist/elements/Captions.js +18 -24
- package/dist/elements/Image.js +4 -6
- package/dist/elements/Timegroup.js +6 -8
- package/dist/elements/Video.js +4 -6
- package/dist/elements/Waveform.js +4 -6
- package/dist/gui/Configuration.js +6 -8
- package/dist/gui/Filmstrip.js +4 -6
- package/dist/gui/FitScale.js +6 -8
- package/dist/gui/FocusOverlay.js +6 -8
- package/dist/gui/Preview.js +6 -8
- package/dist/gui/Scrubber.js +6 -8
- package/dist/gui/ToggleLoop.js +4 -6
- package/dist/gui/TogglePlay.js +4 -6
- package/dist/gui/Workbench.js +4 -6
- package/dist/hooks/useTimingInfo.js +32 -33
- package/dist/index.js +1 -23
- package/package.json +3 -3
- package/types.json +1 -1
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import { EFTimeDisplay } from "@editframe/elements";
|
|
2
|
-
import { createComponent } from "@lit/react";
|
|
3
1
|
import React from "react";
|
|
2
|
+
import { createComponent } from "@lit/react";
|
|
3
|
+
import { EFTimeDisplay } from "@editframe/elements";
|
|
4
4
|
const TimeDisplay = createComponent({
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
tagName: "ef-time-display",
|
|
6
|
+
elementClass: EFTimeDisplay,
|
|
7
|
+
react: React
|
|
8
8
|
});
|
|
9
|
-
export {
|
|
10
|
-
TimeDisplay
|
|
11
|
-
};
|
|
9
|
+
export { TimeDisplay };
|
package/dist/create-component.js
CHANGED
|
@@ -1,128 +1,120 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
"ref",
|
|
11
|
-
"style",
|
|
12
|
-
"className"
|
|
1
|
+
const NODE_MODE = false;
|
|
2
|
+
const DEV_MODE = true;
|
|
3
|
+
const reservedReactProperties = new Set([
|
|
4
|
+
"id",
|
|
5
|
+
"children",
|
|
6
|
+
"localName",
|
|
7
|
+
"ref",
|
|
8
|
+
"style",
|
|
9
|
+
"className"
|
|
13
10
|
]);
|
|
14
11
|
const listenedEvents = /* @__PURE__ */ new WeakMap();
|
|
12
|
+
/**
|
|
13
|
+
* Adds an event listener for the specified event to the given node. In the
|
|
14
|
+
* React setup, there should only ever be one event listener. Thus, for
|
|
15
|
+
* efficiency only one listener is added and the handler for that listener is
|
|
16
|
+
* updated to point to the given listener function.
|
|
17
|
+
*/
|
|
15
18
|
const addOrUpdateEventListener = (node, event, listener) => {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}
|
|
28
|
-
} else if (handler !== void 0) {
|
|
29
|
-
events.delete(event);
|
|
30
|
-
node.removeEventListener(event, handler);
|
|
31
|
-
}
|
|
19
|
+
let events = listenedEvents.get(node);
|
|
20
|
+
if (events === void 0) listenedEvents.set(node, events = /* @__PURE__ */ new Map());
|
|
21
|
+
let handler = events.get(event);
|
|
22
|
+
if (listener !== void 0) if (handler === void 0) {
|
|
23
|
+
events.set(event, handler = { handleEvent: listener });
|
|
24
|
+
node.addEventListener(event, handler);
|
|
25
|
+
} else handler.handleEvent = listener;
|
|
26
|
+
else if (handler !== void 0) {
|
|
27
|
+
events.delete(event);
|
|
28
|
+
node.removeEventListener(event, handler);
|
|
29
|
+
}
|
|
32
30
|
};
|
|
31
|
+
/**
|
|
32
|
+
* Sets properties and events on custom elements. These properties and events
|
|
33
|
+
* have been pre-filtered so we know they should apply to the custom element.
|
|
34
|
+
*/
|
|
33
35
|
const setProperty = (node, name, value, old, events) => {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
node[name] = value;
|
|
42
|
-
if ((value === void 0 || value === null) && name in HTMLElement.prototype) {
|
|
43
|
-
node.removeAttribute(name);
|
|
44
|
-
}
|
|
36
|
+
const event = events?.[name];
|
|
37
|
+
if (event !== void 0) {
|
|
38
|
+
if (value !== old) addOrUpdateEventListener(node, event, value);
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
node[name] = value;
|
|
42
|
+
if ((value === void 0 || value === null) && name in HTMLElement.prototype) node.removeAttribute(name);
|
|
45
43
|
};
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
});
|
|
122
|
-
});
|
|
123
|
-
ReactComponent.displayName = displayName ?? elementClass.name;
|
|
124
|
-
return ReactComponent;
|
|
125
|
-
};
|
|
126
|
-
export {
|
|
127
|
-
createComponent
|
|
44
|
+
/**
|
|
45
|
+
* Creates a React component for a custom element. Properties are distinguished
|
|
46
|
+
* from attributes automatically, and events can be configured so they are added
|
|
47
|
+
* to the custom element as event listeners.
|
|
48
|
+
*
|
|
49
|
+
* @param options An options bag containing the parameters needed to generate a
|
|
50
|
+
* wrapped web component.
|
|
51
|
+
*
|
|
52
|
+
* @param options.react The React module, typically imported from the `react`
|
|
53
|
+
* npm package.
|
|
54
|
+
* @param options.tagName The custom element tag name registered via
|
|
55
|
+
* `customElements.define`.
|
|
56
|
+
* @param options.elementClass The custom element class registered via
|
|
57
|
+
* `customElements.define`.
|
|
58
|
+
* @param options.events An object listing events to which the component can
|
|
59
|
+
* listen. The object keys are the event property names passed in via React
|
|
60
|
+
* props and the object values are the names of the corresponding events
|
|
61
|
+
* generated by the custom element. For example, given `{onactivate:
|
|
62
|
+
* 'activate'}` an event function may be passed via the component's `onactivate`
|
|
63
|
+
* prop and will be called when the custom element fires its `activate` event.
|
|
64
|
+
* @param options.displayName A React component display name, used in debugging
|
|
65
|
+
* messages. Default value is inferred from the name of custom element class
|
|
66
|
+
* registered via `customElements.define`.
|
|
67
|
+
*/
|
|
68
|
+
const createComponent = ({ react: React, tagName, elementClass, events, displayName }) => {
|
|
69
|
+
const eventProps = new Set(Object.keys(events ?? {}));
|
|
70
|
+
if (DEV_MODE) {
|
|
71
|
+
for (const p of reservedReactProperties) if (p in elementClass.prototype && !(p in HTMLElement.prototype)) console.warn(`${tagName} contains property ${p} which is a React reserved property. It will be used by React and not set on the element.`);
|
|
72
|
+
}
|
|
73
|
+
const ReactComponent = React.forwardRef((props, ref) => {
|
|
74
|
+
const prevElemPropsRef = React.useRef(/* @__PURE__ */ new Map());
|
|
75
|
+
const elementRef = React.useRef(null);
|
|
76
|
+
const reactProps = {};
|
|
77
|
+
const elementProps = {};
|
|
78
|
+
for (const [k, v] of Object.entries(props)) {
|
|
79
|
+
if (reservedReactProperties.has(k)) {
|
|
80
|
+
reactProps[k === "className" ? "class" : k] = v;
|
|
81
|
+
continue;
|
|
82
|
+
}
|
|
83
|
+
if (eventProps.has(k) || k in elementClass.prototype) {
|
|
84
|
+
elementProps[k] = v;
|
|
85
|
+
continue;
|
|
86
|
+
}
|
|
87
|
+
reactProps[k] = v;
|
|
88
|
+
}
|
|
89
|
+
if (!NODE_MODE) {
|
|
90
|
+
React.useLayoutEffect(() => {
|
|
91
|
+
if (elementRef.current === null) return;
|
|
92
|
+
const newElemProps = /* @__PURE__ */ new Map();
|
|
93
|
+
for (const key in elementProps) {
|
|
94
|
+
setProperty(elementRef.current, key, props[key], prevElemPropsRef.current.get(key), events);
|
|
95
|
+
prevElemPropsRef.current.delete(key);
|
|
96
|
+
newElemProps.set(key, props[key]);
|
|
97
|
+
}
|
|
98
|
+
for (const [key, value] of prevElemPropsRef.current) setProperty(elementRef.current, key, void 0, value, events);
|
|
99
|
+
prevElemPropsRef.current = newElemProps;
|
|
100
|
+
});
|
|
101
|
+
React.useLayoutEffect(() => {
|
|
102
|
+
elementRef.current?.removeAttribute("defer-hydration");
|
|
103
|
+
}, []);
|
|
104
|
+
}
|
|
105
|
+
if (NODE_MODE) {
|
|
106
|
+
if ((React.createElement.name === "litPatchedCreateElement" || globalThis.litSsrReactEnabled) && Object.keys(elementProps).length) reactProps._$litProps$ = elementProps;
|
|
107
|
+
} else reactProps.suppressHydrationWarning = true;
|
|
108
|
+
return React.createElement(tagName, {
|
|
109
|
+
...reactProps,
|
|
110
|
+
ref: React.useCallback((node) => {
|
|
111
|
+
elementRef.current = node;
|
|
112
|
+
if (typeof ref === "function") ref(node);
|
|
113
|
+
else if (ref !== null) ref.current = node;
|
|
114
|
+
}, [ref])
|
|
115
|
+
});
|
|
116
|
+
});
|
|
117
|
+
ReactComponent.displayName = displayName ?? elementClass.name;
|
|
118
|
+
return ReactComponent;
|
|
128
119
|
};
|
|
120
|
+
export { createComponent };
|
package/dist/elements/Audio.js
CHANGED
|
@@ -2,10 +2,8 @@ import React from "react";
|
|
|
2
2
|
import { createComponent } from "@lit/react";
|
|
3
3
|
import { EFAudio } from "@editframe/elements";
|
|
4
4
|
const Audio = createComponent({
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
tagName: "ef-audio",
|
|
6
|
+
elementClass: EFAudio,
|
|
7
|
+
react: React
|
|
8
8
|
});
|
|
9
|
-
export {
|
|
10
|
-
Audio
|
|
11
|
-
};
|
|
9
|
+
export { Audio };
|
|
@@ -1,35 +1,29 @@
|
|
|
1
|
-
import { EFCaptions, EFCaptionsActiveWord, EFCaptionsSegment, EFCaptionsBeforeActiveWord, EFCaptionsAfterActiveWord } from "@editframe/elements";
|
|
2
|
-
import { createComponent } from "@lit/react";
|
|
3
1
|
import React from "react";
|
|
2
|
+
import { createComponent } from "@lit/react";
|
|
3
|
+
import { EFCaptions, EFCaptionsActiveWord, EFCaptionsAfterActiveWord, EFCaptionsBeforeActiveWord, EFCaptionsSegment } from "@editframe/elements";
|
|
4
4
|
const Captions = createComponent({
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
tagName: "ef-captions",
|
|
6
|
+
elementClass: EFCaptions,
|
|
7
|
+
react: React
|
|
8
8
|
});
|
|
9
9
|
const CaptionsActiveWord = createComponent({
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
tagName: "ef-captions-active-word",
|
|
11
|
+
elementClass: EFCaptionsActiveWord,
|
|
12
|
+
react: React
|
|
13
13
|
});
|
|
14
14
|
const CaptionsSegment = createComponent({
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
tagName: "ef-captions-segment",
|
|
16
|
+
elementClass: EFCaptionsSegment,
|
|
17
|
+
react: React
|
|
18
18
|
});
|
|
19
19
|
const CaptionsBeforeActiveWord = createComponent({
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
tagName: "ef-captions-before-active-word",
|
|
21
|
+
elementClass: EFCaptionsBeforeActiveWord,
|
|
22
|
+
react: React
|
|
23
23
|
});
|
|
24
24
|
const CaptionsAfterActiveWord = createComponent({
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
tagName: "ef-captions-after-active-word",
|
|
26
|
+
elementClass: EFCaptionsAfterActiveWord,
|
|
27
|
+
react: React
|
|
28
28
|
});
|
|
29
|
-
export {
|
|
30
|
-
Captions,
|
|
31
|
-
CaptionsActiveWord,
|
|
32
|
-
CaptionsAfterActiveWord,
|
|
33
|
-
CaptionsBeforeActiveWord,
|
|
34
|
-
CaptionsSegment
|
|
35
|
-
};
|
|
29
|
+
export { Captions, CaptionsActiveWord, CaptionsAfterActiveWord, CaptionsBeforeActiveWord, CaptionsSegment };
|
package/dist/elements/Image.js
CHANGED
|
@@ -2,10 +2,8 @@ import React from "react";
|
|
|
2
2
|
import { createComponent } from "@lit/react";
|
|
3
3
|
import { EFImage } from "@editframe/elements";
|
|
4
4
|
const Image = createComponent({
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
tagName: "ef-image",
|
|
6
|
+
elementClass: EFImage,
|
|
7
|
+
react: React
|
|
8
8
|
});
|
|
9
|
-
export {
|
|
10
|
-
Image
|
|
11
|
-
};
|
|
9
|
+
export { Image };
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import { EFTimegroup } from "@editframe/elements";
|
|
2
|
-
import React from "react";
|
|
3
1
|
import { createComponent } from "../create-component.js";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { EFTimegroup } from "@editframe/elements";
|
|
4
4
|
const Timegroup = createComponent({
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
tagName: "ef-timegroup",
|
|
6
|
+
elementClass: EFTimegroup,
|
|
7
|
+
react: React
|
|
8
8
|
});
|
|
9
|
-
export {
|
|
10
|
-
Timegroup
|
|
11
|
-
};
|
|
9
|
+
export { Timegroup };
|
package/dist/elements/Video.js
CHANGED
|
@@ -2,10 +2,8 @@ import React from "react";
|
|
|
2
2
|
import { createComponent } from "@lit/react";
|
|
3
3
|
import { EFVideo } from "@editframe/elements";
|
|
4
4
|
const Video = createComponent({
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
tagName: "ef-video",
|
|
6
|
+
elementClass: EFVideo,
|
|
7
|
+
react: React
|
|
8
8
|
});
|
|
9
|
-
export {
|
|
10
|
-
Video
|
|
11
|
-
};
|
|
9
|
+
export { Video };
|
|
@@ -2,10 +2,8 @@ import React from "react";
|
|
|
2
2
|
import { createComponent } from "@lit/react";
|
|
3
3
|
import { EFWaveform } from "@editframe/elements";
|
|
4
4
|
const Waveform = createComponent({
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
tagName: "ef-waveform",
|
|
6
|
+
elementClass: EFWaveform,
|
|
7
|
+
react: React
|
|
8
8
|
});
|
|
9
|
-
export {
|
|
10
|
-
Waveform
|
|
11
|
-
};
|
|
9
|
+
export { Waveform };
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import { EFConfiguration } from "@editframe/elements";
|
|
2
|
-
import React from "react";
|
|
3
1
|
import { createComponent } from "../create-component.js";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { EFConfiguration } from "@editframe/elements";
|
|
4
4
|
const Configuration = createComponent({
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
tagName: "ef-configuration",
|
|
6
|
+
elementClass: EFConfiguration,
|
|
7
|
+
react: React
|
|
8
8
|
});
|
|
9
|
-
export {
|
|
10
|
-
Configuration
|
|
11
|
-
};
|
|
9
|
+
export { Configuration };
|
package/dist/gui/Filmstrip.js
CHANGED
|
@@ -2,10 +2,8 @@ import React from "react";
|
|
|
2
2
|
import { createComponent } from "@lit/react";
|
|
3
3
|
import { EFFilmstrip } from "@editframe/elements";
|
|
4
4
|
const Filmstrip = createComponent({
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
tagName: "ef-filmstrip",
|
|
6
|
+
elementClass: EFFilmstrip,
|
|
7
|
+
react: React
|
|
8
8
|
});
|
|
9
|
-
export {
|
|
10
|
-
Filmstrip
|
|
11
|
-
};
|
|
9
|
+
export { Filmstrip };
|
package/dist/gui/FitScale.js
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import { EFFitScale } from "@editframe/elements";
|
|
2
|
-
import { createComponent } from "@lit/react";
|
|
3
1
|
import React from "react";
|
|
2
|
+
import { createComponent } from "@lit/react";
|
|
3
|
+
import { EFFitScale } from "@editframe/elements";
|
|
4
4
|
const FitScale = createComponent({
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
tagName: "ef-fit-scale",
|
|
6
|
+
elementClass: EFFitScale,
|
|
7
|
+
react: React
|
|
8
8
|
});
|
|
9
|
-
export {
|
|
10
|
-
FitScale
|
|
11
|
-
};
|
|
9
|
+
export { FitScale };
|
package/dist/gui/FocusOverlay.js
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import { EFFocusOverlay } from "@editframe/elements";
|
|
2
|
-
import { createComponent } from "@lit/react";
|
|
3
1
|
import React from "react";
|
|
2
|
+
import { createComponent } from "@lit/react";
|
|
3
|
+
import { EFFocusOverlay } from "@editframe/elements";
|
|
4
4
|
const FocusOverlay = createComponent({
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
tagName: "ef-focus-overlay",
|
|
6
|
+
elementClass: EFFocusOverlay,
|
|
7
|
+
react: React
|
|
8
8
|
});
|
|
9
|
-
export {
|
|
10
|
-
FocusOverlay
|
|
11
|
-
};
|
|
9
|
+
export { FocusOverlay };
|
package/dist/gui/Preview.js
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import { EFPreview } from "@editframe/elements";
|
|
2
|
-
import { createComponent } from "@lit/react";
|
|
3
1
|
import React from "react";
|
|
2
|
+
import { createComponent } from "@lit/react";
|
|
3
|
+
import { EFPreview } from "@editframe/elements";
|
|
4
4
|
const Preview = createComponent({
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
tagName: "ef-preview",
|
|
6
|
+
elementClass: EFPreview,
|
|
7
|
+
react: React
|
|
8
8
|
});
|
|
9
|
-
export {
|
|
10
|
-
Preview
|
|
11
|
-
};
|
|
9
|
+
export { Preview };
|
package/dist/gui/Scrubber.js
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import { EFScrubber } from "@editframe/elements";
|
|
2
|
-
import { createComponent } from "@lit/react";
|
|
3
1
|
import React from "react";
|
|
2
|
+
import { createComponent } from "@lit/react";
|
|
3
|
+
import { EFScrubber } from "@editframe/elements";
|
|
4
4
|
const Scrubber = createComponent({
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
tagName: "ef-scrubber",
|
|
6
|
+
elementClass: EFScrubber,
|
|
7
|
+
react: React
|
|
8
8
|
});
|
|
9
|
-
export {
|
|
10
|
-
Scrubber
|
|
11
|
-
};
|
|
9
|
+
export { Scrubber };
|
package/dist/gui/ToggleLoop.js
CHANGED
|
@@ -2,10 +2,8 @@ import React from "react";
|
|
|
2
2
|
import { createComponent } from "@lit/react";
|
|
3
3
|
import { EFToggleLoop } from "@editframe/elements";
|
|
4
4
|
const ToggleLoop = createComponent({
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
tagName: "ef-toggle-loop",
|
|
6
|
+
elementClass: EFToggleLoop,
|
|
7
|
+
react: React
|
|
8
8
|
});
|
|
9
|
-
export {
|
|
10
|
-
ToggleLoop
|
|
11
|
-
};
|
|
9
|
+
export { ToggleLoop };
|
package/dist/gui/TogglePlay.js
CHANGED
|
@@ -2,10 +2,8 @@ import React from "react";
|
|
|
2
2
|
import { createComponent } from "@lit/react";
|
|
3
3
|
import { EFTogglePlay } from "@editframe/elements";
|
|
4
4
|
const TogglePlay = createComponent({
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
tagName: "ef-toggle-play",
|
|
6
|
+
elementClass: EFTogglePlay,
|
|
7
|
+
react: React
|
|
8
8
|
});
|
|
9
|
-
export {
|
|
10
|
-
TogglePlay
|
|
11
|
-
};
|
|
9
|
+
export { TogglePlay };
|
package/dist/gui/Workbench.js
CHANGED
|
@@ -2,10 +2,8 @@ import React from "react";
|
|
|
2
2
|
import { createComponent } from "@lit/react";
|
|
3
3
|
import { EFWorkbench } from "@editframe/elements";
|
|
4
4
|
const Workbench = createComponent({
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
tagName: "ef-workbench",
|
|
6
|
+
elementClass: EFWorkbench,
|
|
7
|
+
react: React
|
|
8
8
|
});
|
|
9
|
-
export {
|
|
10
|
-
Workbench
|
|
11
|
-
};
|
|
9
|
+
export { Workbench };
|
|
@@ -1,35 +1,34 @@
|
|
|
1
|
-
import { useRef, useState
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
const useTimingInfo = (timegroupRef = useRef(null)) => {
|
|
20
|
-
const [timeInfo, setTimeInfo] = useState({
|
|
21
|
-
ownCurrentTimeMs: 0,
|
|
22
|
-
durationMs: 0,
|
|
23
|
-
percentComplete: 0
|
|
24
|
-
});
|
|
25
|
-
useEffect(() => {
|
|
26
|
-
if (!timegroupRef.current) {
|
|
27
|
-
throw new Error("Timegroup ref not set");
|
|
28
|
-
}
|
|
29
|
-
new CurrentTimeController(timegroupRef.current, setTimeInfo);
|
|
30
|
-
}, [timegroupRef.current]);
|
|
31
|
-
return { ...timeInfo, ref: timegroupRef };
|
|
1
|
+
import { useEffect, useRef, useState } from "react";
|
|
2
|
+
var CurrentTimeController = class {
|
|
3
|
+
constructor(host, setCurrentTime) {
|
|
4
|
+
this.host = host;
|
|
5
|
+
this.setCurrentTime = setCurrentTime;
|
|
6
|
+
this.host.addController(this);
|
|
7
|
+
}
|
|
8
|
+
hostDisconnected() {
|
|
9
|
+
this.host.removeController(this);
|
|
10
|
+
}
|
|
11
|
+
hostUpdated() {
|
|
12
|
+
this.setCurrentTime({
|
|
13
|
+
ownCurrentTimeMs: this.host.ownCurrentTimeMs,
|
|
14
|
+
durationMs: this.host.durationMs,
|
|
15
|
+
percentComplete: this.host.ownCurrentTimeMs / this.host.durationMs
|
|
16
|
+
});
|
|
17
|
+
}
|
|
32
18
|
};
|
|
33
|
-
|
|
34
|
-
|
|
19
|
+
const useTimingInfo = (timegroupRef = useRef(null)) => {
|
|
20
|
+
const [timeInfo, setTimeInfo] = useState({
|
|
21
|
+
ownCurrentTimeMs: 0,
|
|
22
|
+
durationMs: 0,
|
|
23
|
+
percentComplete: 0
|
|
24
|
+
});
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
if (!timegroupRef.current) throw new Error("Timegroup ref not set");
|
|
27
|
+
new CurrentTimeController(timegroupRef.current, setTimeInfo);
|
|
28
|
+
}, [timegroupRef.current]);
|
|
29
|
+
return {
|
|
30
|
+
...timeInfo,
|
|
31
|
+
ref: timegroupRef
|
|
32
|
+
};
|
|
35
33
|
};
|
|
34
|
+
export { useTimingInfo };
|
package/dist/index.js
CHANGED
|
@@ -15,26 +15,4 @@ import { ToggleLoop } from "./gui/ToggleLoop.js";
|
|
|
15
15
|
import { Scrubber } from "./gui/Scrubber.js";
|
|
16
16
|
import { useTimingInfo } from "./hooks/useTimingInfo.js";
|
|
17
17
|
import { TimeDisplay } from "./components/TimeDisplay.js";
|
|
18
|
-
export {
|
|
19
|
-
Audio,
|
|
20
|
-
Captions,
|
|
21
|
-
CaptionsActiveWord,
|
|
22
|
-
CaptionsAfterActiveWord,
|
|
23
|
-
CaptionsBeforeActiveWord,
|
|
24
|
-
CaptionsSegment,
|
|
25
|
-
Configuration,
|
|
26
|
-
Filmstrip,
|
|
27
|
-
FitScale,
|
|
28
|
-
FocusOverlay,
|
|
29
|
-
Image,
|
|
30
|
-
Preview,
|
|
31
|
-
Scrubber,
|
|
32
|
-
TimeDisplay,
|
|
33
|
-
Timegroup,
|
|
34
|
-
ToggleLoop,
|
|
35
|
-
TogglePlay,
|
|
36
|
-
Video,
|
|
37
|
-
Waveform,
|
|
38
|
-
Workbench,
|
|
39
|
-
useTimingInfo
|
|
40
|
-
};
|
|
18
|
+
export { Audio, Captions, CaptionsActiveWord, CaptionsAfterActiveWord, CaptionsBeforeActiveWord, CaptionsSegment, Configuration, Filmstrip, FitScale, FocusOverlay, Image, Preview, Scrubber, TimeDisplay, Timegroup, ToggleLoop, TogglePlay, Video, Waveform, Workbench, useTimingInfo };
|