@editframe/elements 0.13.0-beta.2 → 0.14.0-beta.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/elements/EFImage.js +4 -1
- package/dist/elements/EFMedia.d.ts +0 -1
- package/dist/elements/EFMedia.js +0 -6
- package/dist/elements/EFSourceMixin.js +1 -8
- package/dist/elements/EFTemporal.js +4 -0
- package/dist/elements/EFTimegroup.d.ts +0 -1
- package/dist/elements/EFTimegroup.js +1 -2
- package/dist/elements/EFWaveform.d.ts +1 -2
- package/dist/elements/EFWaveform.js +12 -7
- package/dist/gui/ContextMixin.browsertest.d.ts +0 -8
- package/dist/gui/ContextMixin.d.ts +0 -3
- package/dist/gui/ContextMixin.js +37 -22
- package/dist/gui/EFConfiguration.d.ts +16 -0
- package/dist/gui/EFConfiguration.js +48 -0
- package/dist/gui/EFFilmstrip.js +2 -0
- package/dist/gui/EFWorkbench.d.ts +6 -1
- package/dist/gui/EFWorkbench.js +58 -5
- package/dist/gui/TWMixin.css.js +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2 -0
- package/dist/style.css +4 -0
- package/package.json +2 -2
- package/src/elements/EFImage.ts +4 -1
- package/src/elements/EFMedia.ts +0 -6
- package/src/elements/EFSourceMixin.ts +6 -8
- package/src/elements/EFTemporal.ts +5 -0
- package/src/elements/EFTimegroup.ts +1 -2
- package/src/elements/EFWaveform.ts +12 -8
- package/src/gui/ContextMixin.browsertest.ts +0 -31
- package/src/gui/ContextMixin.ts +25 -13
- package/src/gui/EFConfiguration.ts +37 -0
- package/src/gui/EFFilmstrip.ts +2 -0
- package/src/gui/EFWorkbench.ts +67 -5
- package/dist/gui/apiHostContext.d.ts +0 -3
- package/dist/gui/apiHostContext.js +0 -7
- package/src/gui/apiHostContext.ts +0 -5
package/dist/elements/EFImage.js
CHANGED
|
@@ -10,7 +10,6 @@ export declare class EFMedia extends EFMedia_base {
|
|
|
10
10
|
#private;
|
|
11
11
|
static styles: import('lit').CSSResult[];
|
|
12
12
|
currentTimeMs: number;
|
|
13
|
-
efHost?: string;
|
|
14
13
|
/**
|
|
15
14
|
* The unique identifier for the media asset.
|
|
16
15
|
* This property can be set programmatically or via the "asset-id" attribute.
|
package/dist/elements/EFMedia.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { consume } from "@lit/context";
|
|
2
1
|
import { Task } from "@lit/task";
|
|
3
2
|
import { deepArrayEquals } from "@lit/task/deep-equals.js";
|
|
4
3
|
import debug from "debug";
|
|
@@ -8,7 +7,6 @@ import { VideoAsset } from "@editframe/assets/EncodedAsset.js";
|
|
|
8
7
|
import { MP4File } from "@editframe/assets/MP4File.js";
|
|
9
8
|
import { EF_INTERACTIVE } from "../EF_INTERACTIVE.js";
|
|
10
9
|
import { EF_RENDERING } from "../EF_RENDERING.js";
|
|
11
|
-
import { apiHostContext } from "../gui/apiHostContext.js";
|
|
12
10
|
import { EFSourceMixin } from "./EFSourceMixin.js";
|
|
13
11
|
import { EFTemporal, isEFTemporal } from "./EFTemporal.js";
|
|
14
12
|
import { FetchMixin } from "./FetchMixin.js";
|
|
@@ -431,10 +429,6 @@ class EFMedia extends EFSourceMixin(EFTemporal(FetchMixin(LitElement)), {
|
|
|
431
429
|
__decorateClass([
|
|
432
430
|
property({ type: Number })
|
|
433
431
|
], EFMedia.prototype, "currentTimeMs", 2);
|
|
434
|
-
__decorateClass([
|
|
435
|
-
consume({ context: apiHostContext, subscribe: true }),
|
|
436
|
-
state()
|
|
437
|
-
], EFMedia.prototype, "efHost", 2);
|
|
438
432
|
__decorateClass([
|
|
439
433
|
property({ type: String, attribute: "asset-id", reflect: true })
|
|
440
434
|
], EFMedia.prototype, "assetId", 1);
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
import { consume } from "@lit/context";
|
|
2
1
|
import { Task } from "@lit/task";
|
|
3
2
|
import { property } from "lit/decorators/property.js";
|
|
4
|
-
import { state } from "lit/decorators/state.js";
|
|
5
|
-
import { apiHostContext } from "../gui/apiHostContext.js";
|
|
6
3
|
var __defProp = Object.defineProperty;
|
|
7
4
|
var __decorateClass = (decorators, target, key, kind) => {
|
|
8
5
|
var result = void 0;
|
|
@@ -28,7 +25,7 @@ function EFSourceMixin(superClass, options) {
|
|
|
28
25
|
});
|
|
29
26
|
}
|
|
30
27
|
get apiHost() {
|
|
31
|
-
return this.
|
|
28
|
+
return this.closest("ef-configuration")?.apiHost ?? this.closest("ef-workbench")?.apiHost ?? this.closest("ef-preview")?.apiHost ?? "https://editframe.dev";
|
|
32
29
|
}
|
|
33
30
|
productionSrc() {
|
|
34
31
|
if (!this.md5SumLoader.value) {
|
|
@@ -44,10 +41,6 @@ function EFSourceMixin(superClass, options) {
|
|
|
44
41
|
return `${this.apiHost}/api/v1/${options.assetType}/${this.md5SumLoader.value}`;
|
|
45
42
|
}
|
|
46
43
|
}
|
|
47
|
-
__decorateClass([
|
|
48
|
-
consume({ context: apiHostContext, subscribe: true }),
|
|
49
|
-
state()
|
|
50
|
-
], EFSourceElement.prototype, "_apiHost");
|
|
51
44
|
__decorateClass([
|
|
52
45
|
property({ type: String })
|
|
53
46
|
], EFSourceElement.prototype, "src");
|
|
@@ -44,7 +44,6 @@ export declare class EFTimegroup extends EFTimegroup_base {
|
|
|
44
44
|
*
|
|
45
45
|
* If the timegroup is already wrappedin a context provider like ef-preview,
|
|
46
46
|
* it should NOT be wrapped in a workbench.
|
|
47
|
-
*
|
|
48
47
|
*/
|
|
49
48
|
shouldWrapWithWorkbench(): boolean;
|
|
50
49
|
wrapWithWorkbench(): void;
|
|
@@ -284,14 +284,13 @@ let EFTimegroup = class extends EFTemporal(LitElement) {
|
|
|
284
284
|
*
|
|
285
285
|
* If the timegroup is already wrappedin a context provider like ef-preview,
|
|
286
286
|
* it should NOT be wrapped in a workbench.
|
|
287
|
-
*
|
|
288
287
|
*/
|
|
289
288
|
shouldWrapWithWorkbench() {
|
|
290
289
|
return EF_INTERACTIVE && this.closest("ef-timegroup") === this && this.closest("ef-preview") === null && this.closest("ef-workbench") === null && this.closest("test-context") === null;
|
|
291
290
|
}
|
|
292
291
|
wrapWithWorkbench() {
|
|
293
292
|
const workbench = document.createElement("ef-workbench");
|
|
294
|
-
|
|
293
|
+
this.parentElement?.append(workbench);
|
|
295
294
|
if (!this.hasAttribute("id")) {
|
|
296
295
|
this.setAttribute("id", "root-this");
|
|
297
296
|
}
|
|
@@ -5,12 +5,11 @@ import { Ref } from 'lit/directives/ref.js';
|
|
|
5
5
|
import { EFVideo } from './EFVideo.js';
|
|
6
6
|
declare const EFWaveform_base: (new (...args: any[]) => import('./EFTemporal.js').TemporalMixinInterface) & typeof LitElement;
|
|
7
7
|
export declare class EFWaveform extends EFWaveform_base {
|
|
8
|
-
static styles: import('lit').CSSResult
|
|
8
|
+
static styles: import('lit').CSSResult;
|
|
9
9
|
canvasRef: Ref<HTMLCanvasElement>;
|
|
10
10
|
private ctx;
|
|
11
11
|
private resizeObserver?;
|
|
12
12
|
private mutationObserver?;
|
|
13
|
-
createRenderRoot(): this;
|
|
14
13
|
render(): import('lit-html').TemplateResult<1>;
|
|
15
14
|
mode: "roundBars" | "bars" | "bricks" | "equalizer" | "curve" | "line" | "pixel" | "wave";
|
|
16
15
|
color: string;
|
|
@@ -90,9 +90,6 @@ let EFWaveform = class extends EFTemporal(TWMixin(LitElement)) {
|
|
|
90
90
|
}
|
|
91
91
|
});
|
|
92
92
|
}
|
|
93
|
-
createRenderRoot() {
|
|
94
|
-
return this;
|
|
95
|
-
}
|
|
96
93
|
render() {
|
|
97
94
|
return html`<canvas ${ref(this.canvasRef)}></canvas>`;
|
|
98
95
|
}
|
|
@@ -139,6 +136,7 @@ let EFWaveform = class extends EFTemporal(TWMixin(LitElement)) {
|
|
|
139
136
|
canvas.height = rect.height * dpr;
|
|
140
137
|
const ctx = canvas.getContext("2d");
|
|
141
138
|
if (!ctx) return null;
|
|
139
|
+
ctx.reset();
|
|
142
140
|
ctx.scale(dpr, dpr);
|
|
143
141
|
return ctx;
|
|
144
142
|
}
|
|
@@ -303,14 +301,21 @@ let EFWaveform = class extends EFTemporal(TWMixin(LitElement)) {
|
|
|
303
301
|
}
|
|
304
302
|
}
|
|
305
303
|
};
|
|
306
|
-
EFWaveform.styles =
|
|
307
|
-
css`
|
|
304
|
+
EFWaveform.styles = css`
|
|
308
305
|
:host {
|
|
309
306
|
display: block;
|
|
310
307
|
all: inherit;
|
|
308
|
+
position: relative;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
canvas {
|
|
312
|
+
position: absolute;
|
|
313
|
+
top: 0;
|
|
314
|
+
left: 0;
|
|
315
|
+
width: 100%;
|
|
316
|
+
height: 100%;
|
|
311
317
|
}
|
|
312
|
-
|
|
313
|
-
];
|
|
318
|
+
`;
|
|
314
319
|
__decorateClass([
|
|
315
320
|
property({
|
|
316
321
|
type: String,
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { LitElement } from 'lit';
|
|
2
|
-
import { createRef } from 'lit/directives/ref.js';
|
|
3
2
|
import { EFTimegroup } from '../elements/EFTimegroup.js';
|
|
4
3
|
export declare const targetTimegroupContext: {
|
|
5
4
|
__context__: EFTimegroup | null;
|
|
@@ -12,8 +11,6 @@ export declare class ContextMixinInterface extends LitElement {
|
|
|
12
11
|
loop: boolean;
|
|
13
12
|
currentTimeMs: number;
|
|
14
13
|
focusedElement?: HTMLElement;
|
|
15
|
-
stageRef: ReturnType<typeof createRef<HTMLDivElement>>;
|
|
16
|
-
canvasRef: ReturnType<typeof createRef<HTMLElement>>;
|
|
17
14
|
targetTimegroup: EFTimegroup | null;
|
|
18
15
|
play(): void;
|
|
19
16
|
pause(): void;
|
package/dist/gui/ContextMixin.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { createContext, provide } from "@lit/context";
|
|
1
|
+
import { createContext, consume, provide } from "@lit/context";
|
|
2
2
|
import { state, property } from "lit/decorators.js";
|
|
3
|
-
import {
|
|
4
|
-
import { apiHostContext } from "./apiHostContext.js";
|
|
3
|
+
import { efConfigurationContext } from "./EFConfiguration.js";
|
|
5
4
|
import { efContext } from "./efContext.js";
|
|
6
5
|
import { fetchContext } from "./fetchContext.js";
|
|
7
6
|
import { focusContext } from "./focusContext.js";
|
|
8
7
|
import { focusedElementContext } from "./focusedElementContext.js";
|
|
9
8
|
import { playingContext, loopContext } from "./playingContext.js";
|
|
10
9
|
var __defProp = Object.defineProperty;
|
|
10
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
11
11
|
var __decorateClass = (decorators, target, key, kind) => {
|
|
12
|
-
var result = void 0;
|
|
12
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
13
13
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
14
14
|
if (decorator = decorators[i])
|
|
15
|
-
result = decorator(target, key, result) || result;
|
|
16
|
-
if (result) __defProp(target, key, result);
|
|
15
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
16
|
+
if (kind && result) __defProp(target, key, result);
|
|
17
17
|
return result;
|
|
18
18
|
};
|
|
19
19
|
const targetTimegroupContext = createContext(
|
|
@@ -28,6 +28,7 @@ function ContextMixin(superClass) {
|
|
|
28
28
|
class ContextElement extends (_b = superClass, _a = contextMixinSymbol, _b) {
|
|
29
29
|
constructor() {
|
|
30
30
|
super(...arguments);
|
|
31
|
+
this.efConfiguration = null;
|
|
31
32
|
this.focusContext = this;
|
|
32
33
|
this.efContext = this;
|
|
33
34
|
this.targetTimegroup = null;
|
|
@@ -64,8 +65,6 @@ function ContextMixin(superClass) {
|
|
|
64
65
|
this.loop = false;
|
|
65
66
|
this.rendering = false;
|
|
66
67
|
this.currentTimeMs = 0;
|
|
67
|
-
this.stageRef = createRef();
|
|
68
|
-
this.canvasRef = createRef();
|
|
69
68
|
this.#FPS = 30;
|
|
70
69
|
this.#MS_PER_FRAME = 1e3 / this.#FPS;
|
|
71
70
|
this.#timegroupObserver = new MutationObserver((mutations) => {
|
|
@@ -85,7 +84,21 @@ function ContextMixin(superClass) {
|
|
|
85
84
|
static {
|
|
86
85
|
this[_a] = true;
|
|
87
86
|
}
|
|
87
|
+
#apiHost;
|
|
88
|
+
get apiHost() {
|
|
89
|
+
return this.#apiHost ?? this.efConfiguration?.apiHost ?? "";
|
|
90
|
+
}
|
|
91
|
+
set apiHost(value) {
|
|
92
|
+
this.#apiHost = value;
|
|
93
|
+
}
|
|
88
94
|
#URLTokens;
|
|
95
|
+
#signingURL;
|
|
96
|
+
get signingURL() {
|
|
97
|
+
return this.#signingURL ?? this.efConfiguration?.signingURL ?? "";
|
|
98
|
+
}
|
|
99
|
+
set signingURL(value) {
|
|
100
|
+
this.#signingURL = value;
|
|
101
|
+
}
|
|
89
102
|
#FPS;
|
|
90
103
|
#MS_PER_FRAME;
|
|
91
104
|
#timegroupObserver;
|
|
@@ -236,44 +249,46 @@ function ContextMixin(superClass) {
|
|
|
236
249
|
await playbackContext.resume();
|
|
237
250
|
}
|
|
238
251
|
}
|
|
252
|
+
__decorateClass([
|
|
253
|
+
consume({ context: efConfigurationContext, subscribe: true })
|
|
254
|
+
], ContextElement.prototype, "efConfiguration", 2);
|
|
239
255
|
__decorateClass([
|
|
240
256
|
provide({ context: focusContext })
|
|
241
|
-
], ContextElement.prototype, "focusContext");
|
|
257
|
+
], ContextElement.prototype, "focusContext", 2);
|
|
242
258
|
__decorateClass([
|
|
243
259
|
provide({ context: focusedElementContext }),
|
|
244
260
|
state()
|
|
245
|
-
], ContextElement.prototype, "focusedElement");
|
|
261
|
+
], ContextElement.prototype, "focusedElement", 2);
|
|
246
262
|
__decorateClass([
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
], ContextElement.prototype, "apiHost");
|
|
263
|
+
property({ type: String, attribute: "api-host" })
|
|
264
|
+
], ContextElement.prototype, "apiHost", 1);
|
|
250
265
|
__decorateClass([
|
|
251
266
|
provide({ context: efContext })
|
|
252
|
-
], ContextElement.prototype, "efContext");
|
|
267
|
+
], ContextElement.prototype, "efContext", 2);
|
|
253
268
|
__decorateClass([
|
|
254
269
|
provide({ context: targetTimegroupContext }),
|
|
255
270
|
state()
|
|
256
|
-
], ContextElement.prototype, "targetTimegroup");
|
|
271
|
+
], ContextElement.prototype, "targetTimegroup", 2);
|
|
257
272
|
__decorateClass([
|
|
258
273
|
provide({ context: fetchContext })
|
|
259
|
-
], ContextElement.prototype, "fetch");
|
|
274
|
+
], ContextElement.prototype, "fetch", 2);
|
|
260
275
|
__decorateClass([
|
|
261
|
-
property({ type: String })
|
|
262
|
-
], ContextElement.prototype, "signingURL");
|
|
276
|
+
property({ type: String, attribute: "signing-url" })
|
|
277
|
+
], ContextElement.prototype, "signingURL", 1);
|
|
263
278
|
__decorateClass([
|
|
264
279
|
provide({ context: playingContext }),
|
|
265
280
|
property({ type: Boolean, reflect: true })
|
|
266
|
-
], ContextElement.prototype, "playing");
|
|
281
|
+
], ContextElement.prototype, "playing", 2);
|
|
267
282
|
__decorateClass([
|
|
268
283
|
provide({ context: loopContext }),
|
|
269
284
|
property({ type: Boolean, reflect: true })
|
|
270
|
-
], ContextElement.prototype, "loop");
|
|
285
|
+
], ContextElement.prototype, "loop", 2);
|
|
271
286
|
__decorateClass([
|
|
272
287
|
property({ type: Boolean })
|
|
273
|
-
], ContextElement.prototype, "rendering");
|
|
288
|
+
], ContextElement.prototype, "rendering", 2);
|
|
274
289
|
__decorateClass([
|
|
275
290
|
state()
|
|
276
|
-
], ContextElement.prototype, "currentTimeMs");
|
|
291
|
+
], ContextElement.prototype, "currentTimeMs", 2);
|
|
277
292
|
return ContextElement;
|
|
278
293
|
}
|
|
279
294
|
export {
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
export declare const efConfigurationContext: {
|
|
3
|
+
__context__: EFConfiguration | null;
|
|
4
|
+
};
|
|
5
|
+
export declare class EFConfiguration extends LitElement {
|
|
6
|
+
static styles: import('lit').CSSResult[];
|
|
7
|
+
efConfiguration: this;
|
|
8
|
+
apiHost?: string;
|
|
9
|
+
signingURL?: string;
|
|
10
|
+
render(): import('lit-html').TemplateResult<1>;
|
|
11
|
+
}
|
|
12
|
+
declare global {
|
|
13
|
+
interface HTMLElementTagNameMap {
|
|
14
|
+
"ef-configuration": EFConfiguration;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { createContext, provide } from "@lit/context";
|
|
2
|
+
import { css, LitElement, html } from "lit";
|
|
3
|
+
import { property, customElement } from "lit/decorators.js";
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
7
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
8
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
9
|
+
if (decorator = decorators[i])
|
|
10
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
11
|
+
if (kind && result) __defProp(target, key, result);
|
|
12
|
+
return result;
|
|
13
|
+
};
|
|
14
|
+
const efConfigurationContext = createContext(
|
|
15
|
+
Symbol("efConfigurationContext")
|
|
16
|
+
);
|
|
17
|
+
let EFConfiguration = class extends LitElement {
|
|
18
|
+
constructor() {
|
|
19
|
+
super(...arguments);
|
|
20
|
+
this.efConfiguration = this;
|
|
21
|
+
}
|
|
22
|
+
render() {
|
|
23
|
+
return html`<slot></slot>`;
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
EFConfiguration.styles = [
|
|
27
|
+
css`
|
|
28
|
+
:host {
|
|
29
|
+
display: contents;
|
|
30
|
+
}
|
|
31
|
+
`
|
|
32
|
+
];
|
|
33
|
+
__decorateClass([
|
|
34
|
+
provide({ context: efConfigurationContext })
|
|
35
|
+
], EFConfiguration.prototype, "efConfiguration", 2);
|
|
36
|
+
__decorateClass([
|
|
37
|
+
property({ type: String, attribute: "api-host" })
|
|
38
|
+
], EFConfiguration.prototype, "apiHost", 2);
|
|
39
|
+
__decorateClass([
|
|
40
|
+
property({ type: String, attribute: "signing-url" })
|
|
41
|
+
], EFConfiguration.prototype, "signingURL", 2);
|
|
42
|
+
EFConfiguration = __decorateClass([
|
|
43
|
+
customElement("ef-configuration")
|
|
44
|
+
], EFConfiguration);
|
|
45
|
+
export {
|
|
46
|
+
EFConfiguration,
|
|
47
|
+
efConfigurationContext
|
|
48
|
+
};
|
package/dist/gui/EFFilmstrip.js
CHANGED
|
@@ -2,9 +2,14 @@ import { LitElement, PropertyValueMap } from 'lit';
|
|
|
2
2
|
declare const EFWorkbench_base: (new (...args: any[]) => import('./ContextMixin.js').ContextMixinInterface) & typeof LitElement;
|
|
3
3
|
export declare class EFWorkbench extends EFWorkbench_base {
|
|
4
4
|
static styles: import('lit').CSSResult[];
|
|
5
|
-
|
|
5
|
+
stageRef: import('lit-html/directives/ref.js').Ref<HTMLDivElement>;
|
|
6
|
+
canvasRef: import('lit-html/directives/ref.js').Ref<HTMLSlotElement>;
|
|
6
7
|
handleStageWheel(event: WheelEvent): void;
|
|
7
8
|
focusOverlay: import('lit-html/directives/ref.js').Ref<HTMLDivElement>;
|
|
9
|
+
private stageScale;
|
|
10
|
+
setStageScale: () => void;
|
|
11
|
+
connectedCallback(): void;
|
|
12
|
+
disconnectedCallback(): void;
|
|
8
13
|
update(changedProperties: PropertyValueMap<any> | Map<PropertyKey, unknown>): void;
|
|
9
14
|
drawOverlays: () => void;
|
|
10
15
|
render(): import('lit-html').TemplateResult<1>;
|
package/dist/gui/EFWorkbench.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { html, css, LitElement } from "lit";
|
|
2
|
-
import { eventOptions, customElement } from "lit/decorators.js";
|
|
2
|
+
import { eventOptions, state, customElement } from "lit/decorators.js";
|
|
3
3
|
import { createRef, ref } from "lit/directives/ref.js";
|
|
4
4
|
import { ContextMixin } from "./ContextMixin.js";
|
|
5
5
|
import { TWMixin } from "./TWMixin.js";
|
|
@@ -16,7 +16,45 @@ var __decorateClass = (decorators, target, key, kind) => {
|
|
|
16
16
|
let EFWorkbench = class extends ContextMixin(TWMixin(LitElement)) {
|
|
17
17
|
constructor() {
|
|
18
18
|
super(...arguments);
|
|
19
|
+
this.stageRef = createRef();
|
|
20
|
+
this.canvasRef = createRef();
|
|
19
21
|
this.focusOverlay = createRef();
|
|
22
|
+
this.stageScale = 1;
|
|
23
|
+
this.setStageScale = () => {
|
|
24
|
+
if (this.isConnected && !this.rendering) {
|
|
25
|
+
const canvasElement = this.canvasRef.value;
|
|
26
|
+
const stageElement = this.stageRef.value;
|
|
27
|
+
const canvasChild = canvasElement?.assignedElements()[0];
|
|
28
|
+
if (stageElement && canvasElement && canvasChild) {
|
|
29
|
+
canvasElement.style.width = `${canvasChild.clientWidth}px`;
|
|
30
|
+
canvasElement.style.height = `${canvasChild.clientHeight}px`;
|
|
31
|
+
const stageWidth = stageElement.clientWidth;
|
|
32
|
+
const stageHeight = stageElement.clientHeight;
|
|
33
|
+
const canvasWidth = canvasElement.clientWidth;
|
|
34
|
+
const canvasHeight = canvasElement.clientHeight;
|
|
35
|
+
const stageRatio = stageWidth / stageHeight;
|
|
36
|
+
const canvasRatio = canvasWidth / canvasHeight;
|
|
37
|
+
if (stageRatio > canvasRatio) {
|
|
38
|
+
const scale = stageHeight / canvasHeight;
|
|
39
|
+
if (this.stageScale !== scale) {
|
|
40
|
+
canvasElement.style.transform = `scale(${scale})`;
|
|
41
|
+
canvasElement.style.transformOrigin = "top center";
|
|
42
|
+
}
|
|
43
|
+
this.stageScale = scale;
|
|
44
|
+
} else {
|
|
45
|
+
const scale = stageWidth / canvasWidth;
|
|
46
|
+
if (this.stageScale !== scale) {
|
|
47
|
+
canvasElement.style.transform = `scale(${scale})`;
|
|
48
|
+
canvasElement.style.transformOrigin = "center";
|
|
49
|
+
}
|
|
50
|
+
this.stageScale = scale;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
if (this.isConnected) {
|
|
55
|
+
requestAnimationFrame(this.setStageScale);
|
|
56
|
+
}
|
|
57
|
+
};
|
|
20
58
|
this.drawOverlays = () => {
|
|
21
59
|
const focusOverlay = this.focusOverlay.value;
|
|
22
60
|
if (focusOverlay) {
|
|
@@ -37,12 +75,24 @@ let EFWorkbench = class extends ContextMixin(TWMixin(LitElement)) {
|
|
|
37
75
|
}
|
|
38
76
|
};
|
|
39
77
|
}
|
|
40
|
-
disconnectedCallback() {
|
|
41
|
-
super.disconnectedCallback();
|
|
42
|
-
}
|
|
43
78
|
handleStageWheel(event) {
|
|
44
79
|
event.preventDefault();
|
|
45
80
|
}
|
|
81
|
+
connectedCallback() {
|
|
82
|
+
document.body.style.width = "100%";
|
|
83
|
+
document.body.style.height = "100%";
|
|
84
|
+
document.documentElement.style.width = "100%";
|
|
85
|
+
document.documentElement.style.height = "100%";
|
|
86
|
+
super.connectedCallback();
|
|
87
|
+
requestAnimationFrame(this.setStageScale);
|
|
88
|
+
}
|
|
89
|
+
disconnectedCallback() {
|
|
90
|
+
super.disconnectedCallback();
|
|
91
|
+
document.body.style.width = "";
|
|
92
|
+
document.body.style.height = "";
|
|
93
|
+
document.documentElement.style.width = "";
|
|
94
|
+
document.documentElement.style.height = "";
|
|
95
|
+
}
|
|
46
96
|
update(changedProperties) {
|
|
47
97
|
super.update(changedProperties);
|
|
48
98
|
if (changedProperties.has("focusedElement")) {
|
|
@@ -61,7 +111,7 @@ let EFWorkbench = class extends ContextMixin(TWMixin(LitElement)) {
|
|
|
61
111
|
}
|
|
62
112
|
return html`
|
|
63
113
|
<div
|
|
64
|
-
class="grid h-full w-full"
|
|
114
|
+
class="grid h-full w-full bg-slate-800"
|
|
65
115
|
style="grid-template-rows: 1fr 300px; grid-template-columns: 100%;"
|
|
66
116
|
>
|
|
67
117
|
<div
|
|
@@ -97,6 +147,9 @@ EFWorkbench.styles = [
|
|
|
97
147
|
__decorateClass([
|
|
98
148
|
eventOptions({ passive: false, capture: true })
|
|
99
149
|
], EFWorkbench.prototype, "handleStageWheel", 1);
|
|
150
|
+
__decorateClass([
|
|
151
|
+
state()
|
|
152
|
+
], EFWorkbench.prototype, "stageScale", 2);
|
|
100
153
|
EFWorkbench = __decorateClass([
|
|
101
154
|
customElement("ef-workbench")
|
|
102
155
|
], EFWorkbench);
|
package/dist/gui/TWMixin.css.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const twStyle = "/*\n! tailwindcss v3.4.4 | MIT License | https://tailwindcss.com\n*//*\n1. Prevent padding and border from affecting element width. (https://github.com/mozdevs/cssremedy/issues/4)\n2. Allow adding a border to an element by just adding a border-width. (https://github.com/tailwindcss/tailwindcss/pull/116)\n*/\n\n*,\n::before,\n::after {\n box-sizing: border-box; /* 1 */\n border-width: 0; /* 2 */\n border-style: solid; /* 2 */\n border-color: #e5e7eb; /* 2 */\n}\n\n::before,\n::after {\n --tw-content: '';\n}\n\n/*\n1. Use a consistent sensible line-height in all browsers.\n2. Prevent adjustments of font size after orientation changes in iOS.\n3. Use a more readable tab size.\n4. Use the user's configured `sans` font-family by default.\n5. Use the user's configured `sans` font-feature-settings by default.\n6. Use the user's configured `sans` font-variation-settings by default.\n7. Disable tap highlights on iOS\n*/\n\nhtml,\n:host {\n line-height: 1.5; /* 1 */\n -webkit-text-size-adjust: 100%; /* 2 */\n -moz-tab-size: 4; /* 3 */\n -o-tab-size: 4;\n tab-size: 4; /* 3 */\n font-family: ui-sans-serif, system-ui, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\"; /* 4 */\n font-feature-settings: normal; /* 5 */\n font-variation-settings: normal; /* 6 */\n -webkit-tap-highlight-color: transparent; /* 7 */\n}\n\n/*\n1. Remove the margin in all browsers.\n2. Inherit line-height from `html` so users can set them as a class directly on the `html` element.\n*/\n\nbody {\n margin: 0; /* 1 */\n line-height: inherit; /* 2 */\n}\n\n/*\n1. Add the correct height in Firefox.\n2. Correct the inheritance of border color in Firefox. (https://bugzilla.mozilla.org/show_bug.cgi?id=190655)\n3. Ensure horizontal rules are visible by default.\n*/\n\nhr {\n height: 0; /* 1 */\n color: inherit; /* 2 */\n border-top-width: 1px; /* 3 */\n}\n\n/*\nAdd the correct text decoration in Chrome, Edge, and Safari.\n*/\n\nabbr:where([title]) {\n -webkit-text-decoration: underline dotted;\n text-decoration: underline dotted;\n}\n\n/*\nRemove the default font size and weight for headings.\n*/\n\nh1,\nh2,\nh3,\nh4,\nh5,\nh6 {\n font-size: inherit;\n font-weight: inherit;\n}\n\n/*\nReset links to optimize for opt-in styling instead of opt-out.\n*/\n\na {\n color: inherit;\n text-decoration: inherit;\n}\n\n/*\nAdd the correct font weight in Edge and Safari.\n*/\n\nb,\nstrong {\n font-weight: bolder;\n}\n\n/*\n1. Use the user's configured `mono` font-family by default.\n2. Use the user's configured `mono` font-feature-settings by default.\n3. Use the user's configured `mono` font-variation-settings by default.\n4. Correct the odd `em` font sizing in all browsers.\n*/\n\ncode,\nkbd,\nsamp,\npre {\n font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, \"Liberation Mono\", \"Courier New\", monospace; /* 1 */\n font-feature-settings: normal; /* 2 */\n font-variation-settings: normal; /* 3 */\n font-size: 1em; /* 4 */\n}\n\n/*\nAdd the correct font size in all browsers.\n*/\n\nsmall {\n font-size: 80%;\n}\n\n/*\nPrevent `sub` and `sup` elements from affecting the line height in all browsers.\n*/\n\nsub,\nsup {\n font-size: 75%;\n line-height: 0;\n position: relative;\n vertical-align: baseline;\n}\n\nsub {\n bottom: -0.25em;\n}\n\nsup {\n top: -0.5em;\n}\n\n/*\n1. Remove text indentation from table contents in Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=999088, https://bugs.webkit.org/show_bug.cgi?id=201297)\n2. Correct table border color inheritance in all Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=935729, https://bugs.webkit.org/show_bug.cgi?id=195016)\n3. Remove gaps between table borders by default.\n*/\n\ntable {\n text-indent: 0; /* 1 */\n border-color: inherit; /* 2 */\n border-collapse: collapse; /* 3 */\n}\n\n/*\n1. Change the font styles in all browsers.\n2. Remove the margin in Firefox and Safari.\n3. Remove default padding in all browsers.\n*/\n\nbutton,\ninput,\noptgroup,\nselect,\ntextarea {\n font-family: inherit; /* 1 */\n font-feature-settings: inherit; /* 1 */\n font-variation-settings: inherit; /* 1 */\n font-size: 100%; /* 1 */\n font-weight: inherit; /* 1 */\n line-height: inherit; /* 1 */\n letter-spacing: inherit; /* 1 */\n color: inherit; /* 1 */\n margin: 0; /* 2 */\n padding: 0; /* 3 */\n}\n\n/*\nRemove the inheritance of text transform in Edge and Firefox.\n*/\n\nbutton,\nselect {\n text-transform: none;\n}\n\n/*\n1. Correct the inability to style clickable types in iOS and Safari.\n2. Remove default button styles.\n*/\n\nbutton,\ninput:where([type='button']),\ninput:where([type='reset']),\ninput:where([type='submit']) {\n -webkit-appearance: button; /* 1 */\n background-color: transparent; /* 2 */\n background-image: none; /* 2 */\n}\n\n/*\nUse the modern Firefox focus style for all focusable elements.\n*/\n\n:-moz-focusring {\n outline: auto;\n}\n\n/*\nRemove the additional `:invalid` styles in Firefox. (https://github.com/mozilla/gecko-dev/blob/2f9eacd9d3d995c937b4251a5557d95d494c9be1/layout/style/res/forms.css#L728-L737)\n*/\n\n:-moz-ui-invalid {\n box-shadow: none;\n}\n\n/*\nAdd the correct vertical alignment in Chrome and Firefox.\n*/\n\nprogress {\n vertical-align: baseline;\n}\n\n/*\nCorrect the cursor style of increment and decrement buttons in Safari.\n*/\n\n::-webkit-inner-spin-button,\n::-webkit-outer-spin-button {\n height: auto;\n}\n\n/*\n1. Correct the odd appearance in Chrome and Safari.\n2. Correct the outline style in Safari.\n*/\n\n[type='search'] {\n -webkit-appearance: textfield; /* 1 */\n outline-offset: -2px; /* 2 */\n}\n\n/*\nRemove the inner padding in Chrome and Safari on macOS.\n*/\n\n::-webkit-search-decoration {\n -webkit-appearance: none;\n}\n\n/*\n1. Correct the inability to style clickable types in iOS and Safari.\n2. Change font properties to `inherit` in Safari.\n*/\n\n::-webkit-file-upload-button {\n -webkit-appearance: button; /* 1 */\n font: inherit; /* 2 */\n}\n\n/*\nAdd the correct display in Chrome and Safari.\n*/\n\nsummary {\n display: list-item;\n}\n\n/*\nRemoves the default spacing and border for appropriate elements.\n*/\n\nblockquote,\ndl,\ndd,\nh1,\nh2,\nh3,\nh4,\nh5,\nh6,\nhr,\nfigure,\np,\npre {\n margin: 0;\n}\n\nfieldset {\n margin: 0;\n padding: 0;\n}\n\nlegend {\n padding: 0;\n}\n\nol,\nul,\nmenu {\n list-style: none;\n margin: 0;\n padding: 0;\n}\n\n/*\nReset default styling for dialogs.\n*/\ndialog {\n padding: 0;\n}\n\n/*\nPrevent resizing textareas horizontally by default.\n*/\n\ntextarea {\n resize: vertical;\n}\n\n/*\n1. Reset the default placeholder opacity in Firefox. (https://github.com/tailwindlabs/tailwindcss/issues/3300)\n2. Set the default placeholder color to the user's configured gray 400 color.\n*/\n\ninput::-moz-placeholder, textarea::-moz-placeholder {\n opacity: 1; /* 1 */\n color: #9ca3af; /* 2 */\n}\n\ninput::placeholder,\ntextarea::placeholder {\n opacity: 1; /* 1 */\n color: #9ca3af; /* 2 */\n}\n\n/*\nSet the default cursor for buttons.\n*/\n\nbutton,\n[role=\"button\"] {\n cursor: pointer;\n}\n\n/*\nMake sure disabled buttons don't get the pointer cursor.\n*/\n:disabled {\n cursor: default;\n}\n\n/*\n1. Make replaced elements `display: block` by default. (https://github.com/mozdevs/cssremedy/issues/14)\n2. Add `vertical-align: middle` to align replaced elements more sensibly by default. (https://github.com/jensimmons/cssremedy/issues/14#issuecomment-634934210)\n This can trigger a poorly considered lint error in some tools but is included by design.\n*/\n\nimg,\nsvg,\nvideo,\ncanvas,\naudio,\niframe,\nembed,\nobject {\n display: block; /* 1 */\n vertical-align: middle; /* 2 */\n}\n\n/*\nConstrain images and videos to the parent width and preserve their intrinsic aspect ratio. (https://github.com/mozdevs/cssremedy/issues/14)\n*/\n\nimg,\nvideo {\n max-width: 100%;\n height: auto;\n}\n\n/* Make elements with the HTML hidden attribute stay hidden by default */\n[hidden] {\n display: none;\n}\n\n*, ::before, ::after {\n --tw-border-spacing-x: 0;\n --tw-border-spacing-y: 0;\n --tw-translate-x: 0;\n --tw-translate-y: 0;\n --tw-rotate: 0;\n --tw-skew-x: 0;\n --tw-skew-y: 0;\n --tw-scale-x: 1;\n --tw-scale-y: 1;\n --tw-pan-x: ;\n --tw-pan-y: ;\n --tw-pinch-zoom: ;\n --tw-scroll-snap-strictness: proximity;\n --tw-gradient-from-position: ;\n --tw-gradient-via-position: ;\n --tw-gradient-to-position: ;\n --tw-ordinal: ;\n --tw-slashed-zero: ;\n --tw-numeric-figure: ;\n --tw-numeric-spacing: ;\n --tw-numeric-fraction: ;\n --tw-ring-inset: ;\n --tw-ring-offset-width: 0px;\n --tw-ring-offset-color: #fff;\n --tw-ring-color: rgb(59 130 246 / 0.5);\n --tw-ring-offset-shadow: 0 0 #0000;\n --tw-ring-shadow: 0 0 #0000;\n --tw-shadow: 0 0 #0000;\n --tw-shadow-colored: 0 0 #0000;\n --tw-blur: ;\n --tw-brightness: ;\n --tw-contrast: ;\n --tw-grayscale: ;\n --tw-hue-rotate: ;\n --tw-invert: ;\n --tw-saturate: ;\n --tw-sepia: ;\n --tw-drop-shadow: ;\n --tw-backdrop-blur: ;\n --tw-backdrop-brightness: ;\n --tw-backdrop-contrast: ;\n --tw-backdrop-grayscale: ;\n --tw-backdrop-hue-rotate: ;\n --tw-backdrop-invert: ;\n --tw-backdrop-opacity: ;\n --tw-backdrop-saturate: ;\n --tw-backdrop-sepia: ;\n --tw-contain-size: ;\n --tw-contain-layout: ;\n --tw-contain-paint: ;\n --tw-contain-style: ;\n}\n\n::backdrop {\n --tw-border-spacing-x: 0;\n --tw-border-spacing-y: 0;\n --tw-translate-x: 0;\n --tw-translate-y: 0;\n --tw-rotate: 0;\n --tw-skew-x: 0;\n --tw-skew-y: 0;\n --tw-scale-x: 1;\n --tw-scale-y: 1;\n --tw-pan-x: ;\n --tw-pan-y: ;\n --tw-pinch-zoom: ;\n --tw-scroll-snap-strictness: proximity;\n --tw-gradient-from-position: ;\n --tw-gradient-via-position: ;\n --tw-gradient-to-position: ;\n --tw-ordinal: ;\n --tw-slashed-zero: ;\n --tw-numeric-figure: ;\n --tw-numeric-spacing: ;\n --tw-numeric-fraction: ;\n --tw-ring-inset: ;\n --tw-ring-offset-width: 0px;\n --tw-ring-offset-color: #fff;\n --tw-ring-color: rgb(59 130 246 / 0.5);\n --tw-ring-offset-shadow: 0 0 #0000;\n --tw-ring-shadow: 0 0 #0000;\n --tw-shadow: 0 0 #0000;\n --tw-shadow-colored: 0 0 #0000;\n --tw-blur: ;\n --tw-brightness: ;\n --tw-contrast: ;\n --tw-grayscale: ;\n --tw-hue-rotate: ;\n --tw-invert: ;\n --tw-saturate: ;\n --tw-sepia: ;\n --tw-drop-shadow: ;\n --tw-backdrop-blur: ;\n --tw-backdrop-brightness: ;\n --tw-backdrop-contrast: ;\n --tw-backdrop-grayscale: ;\n --tw-backdrop-hue-rotate: ;\n --tw-backdrop-invert: ;\n --tw-backdrop-opacity: ;\n --tw-backdrop-saturate: ;\n --tw-backdrop-sepia: ;\n --tw-contain-size: ;\n --tw-contain-layout: ;\n --tw-contain-paint: ;\n --tw-contain-style: ;\n}\n.container {\n width: 100%;\n}\n@media (min-width: 640px) {\n\n .container {\n max-width: 640px;\n }\n}\n@media (min-width: 768px) {\n\n .container {\n max-width: 768px;\n }\n}\n@media (min-width: 1024px) {\n\n .container {\n max-width: 1024px;\n }\n}\n@media (min-width: 1280px) {\n\n .container {\n max-width: 1280px;\n }\n}\n@media (min-width: 1536px) {\n\n .container {\n max-width: 1536px;\n }\n}\n.pointer-events-none {\n pointer-events: none;\n}\n.static {\n position: static;\n}\n.fixed {\n position: fixed;\n}\n.absolute {\n position: absolute;\n}\n.relative {\n position: relative;\n}\n.inset-0 {\n inset: 0px;\n}\n.top-0 {\n top: 0px;\n}\n.z-10 {\n z-index: 10;\n}\n.z-20 {\n z-index: 20;\n}\n.col-span-2 {\n grid-column: span 2 / span 2;\n}\n.mx-2 {\n margin-left: 0.5rem;\n margin-right: 0.5rem;\n}\n.mb-\\[1px\\] {\n margin-bottom: 1px;\n}\n.block {\n display: block;\n}\n.inline-block {\n display: inline-block;\n}\n.inline {\n display: inline;\n}\n.flex {\n display: flex;\n}\n.grid {\n display: grid;\n}\n.contents {\n display: contents;\n}\n.hidden {\n display: none;\n}\n.h-\\[1\\.1rem\\] {\n height: 1.1rem;\n}\n.h-\\[5px\\] {\n height: 5px;\n}\n.h-full {\n height: 100%;\n}\n.w-1 {\n width: 0.25rem;\n}\n.w-\\[2px\\] {\n width: 2px;\n}\n.w-full {\n width: 100%;\n}\n.transform {\n transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));\n}\n.cursor-crosshair {\n cursor: crosshair;\n}\n.resize {\n resize: both;\n}\n.flex-wrap {\n flex-wrap: wrap;\n}\n.items-center {\n align-items: center;\n}\n.justify-center {\n justify-content: center;\n}\n.overflow-auto {\n overflow: auto;\n}\n.overflow-hidden {\n overflow: hidden;\n}\n.text-nowrap {\n text-wrap: nowrap;\n}\n.rounded {\n border-radius: 0.25rem;\n}\n.border {\n border-width: 1px;\n}\n.border-r-2 {\n border-right-width: 2px;\n}\n.border-blue-500 {\n --tw-border-opacity: 1;\n border-color: rgb(59 130 246 / var(--tw-border-opacity));\n}\n.border-red-700 {\n --tw-border-opacity: 1;\n border-color: rgb(185 28 28 / var(--tw-border-opacity));\n}\n.border-slate-500 {\n --tw-border-opacity: 1;\n border-color: rgb(100 116 139 / var(--tw-border-opacity));\n}\n.border-b-slate-600 {\n --tw-border-opacity: 1;\n border-bottom-color: rgb(71 85 105 / var(--tw-border-opacity));\n}\n.bg-blue-200 {\n --tw-bg-opacity: 1;\n background-color: rgb(191 219 254 / var(--tw-bg-opacity));\n}\n.bg-blue-500 {\n --tw-bg-opacity: 1;\n background-color: rgb(59 130 246 / var(--tw-bg-opacity));\n}\n.bg-red-500 {\n --tw-bg-opacity: 1;\n background-color: rgb(239 68 68 / var(--tw-bg-opacity));\n}\n.bg-slate-100 {\n --tw-bg-opacity: 1;\n background-color: rgb(241 245 249 / var(--tw-bg-opacity));\n}\n.bg-slate-200 {\n --tw-bg-opacity: 1;\n background-color: rgb(226 232 240 / var(--tw-bg-opacity));\n}\n.bg-slate-300 {\n --tw-bg-opacity: 1;\n background-color: rgb(203 213 225 / var(--tw-bg-opacity));\n}\n.bg-opacity-20 {\n --tw-bg-opacity: 0.2;\n}\n.p-\\[1px\\] {\n padding: 1px;\n}\n.pb-0 {\n padding-bottom: 0px;\n}\n.pl-1 {\n padding-left: 0.25rem;\n}\n.pl-2 {\n padding-left: 0.5rem;\n}\n.pr-0 {\n padding-right: 0px;\n}\n.pr-1 {\n padding-right: 0.25rem;\n}\n.pt-\\[8px\\] {\n padding-top: 8px;\n}\n.font-mono {\n font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, \"Liberation Mono\", \"Courier New\", monospace;\n}\n.text-sm {\n font-size: 0.875rem;\n line-height: 1.25rem;\n}\n.text-xs {\n font-size: 0.75rem;\n line-height: 1rem;\n}\n.line-through {\n text-decoration-line: line-through;\n}\n.opacity-50 {\n opacity: 0.5;\n}\n.shadow {\n --tw-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);\n --tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);\n box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);\n}\n.shadow-slate-300 {\n --tw-shadow-color: #cbd5e1;\n --tw-shadow: var(--tw-shadow-colored);\n}\n.shadow-slate-600 {\n --tw-shadow-color: #475569;\n --tw-shadow: var(--tw-shadow-colored);\n}\n.outline {\n outline-style: solid;\n}\n.filter {\n filter: var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow);\n}\n.hover\\:bg-slate-400:hover {\n --tw-bg-opacity: 1;\n background-color: rgb(148 163 184 / var(--tw-bg-opacity));\n}\n.peer:hover ~ .peer-hover\\:border-slate-400 {\n --tw-border-opacity: 1;\n border-color: rgb(148 163 184 / var(--tw-border-opacity));\n}\n.peer:hover ~ .peer-hover\\:bg-slate-300 {\n --tw-bg-opacity: 1;\n background-color: rgb(203 213 225 / var(--tw-bg-opacity));\n}\n.data-\\[focused\\]\\:bg-slate-400[data-focused] {\n --tw-bg-opacity: 1;\n background-color: rgb(148 163 184 / var(--tw-bg-opacity));\n}\n.peer[data-focused] ~ .peer-data-\\[focused\\]\\:border-slate-400 {\n --tw-border-opacity: 1;\n border-color: rgb(148 163 184 / var(--tw-border-opacity));\n}\n.peer[data-focused] ~ .peer-data-\\[focused\\]\\:bg-slate-300 {\n --tw-bg-opacity: 1;\n background-color: rgb(203 213 225 / var(--tw-bg-opacity));\n}\n";
|
|
1
|
+
const twStyle = "/*\n! tailwindcss v3.4.4 | MIT License | https://tailwindcss.com\n*//*\n1. Prevent padding and border from affecting element width. (https://github.com/mozdevs/cssremedy/issues/4)\n2. Allow adding a border to an element by just adding a border-width. (https://github.com/tailwindcss/tailwindcss/pull/116)\n*/\n\n*,\n::before,\n::after {\n box-sizing: border-box; /* 1 */\n border-width: 0; /* 2 */\n border-style: solid; /* 2 */\n border-color: #e5e7eb; /* 2 */\n}\n\n::before,\n::after {\n --tw-content: '';\n}\n\n/*\n1. Use a consistent sensible line-height in all browsers.\n2. Prevent adjustments of font size after orientation changes in iOS.\n3. Use a more readable tab size.\n4. Use the user's configured `sans` font-family by default.\n5. Use the user's configured `sans` font-feature-settings by default.\n6. Use the user's configured `sans` font-variation-settings by default.\n7. Disable tap highlights on iOS\n*/\n\nhtml,\n:host {\n line-height: 1.5; /* 1 */\n -webkit-text-size-adjust: 100%; /* 2 */\n -moz-tab-size: 4; /* 3 */\n -o-tab-size: 4;\n tab-size: 4; /* 3 */\n font-family: ui-sans-serif, system-ui, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\"; /* 4 */\n font-feature-settings: normal; /* 5 */\n font-variation-settings: normal; /* 6 */\n -webkit-tap-highlight-color: transparent; /* 7 */\n}\n\n/*\n1. Remove the margin in all browsers.\n2. Inherit line-height from `html` so users can set them as a class directly on the `html` element.\n*/\n\nbody {\n margin: 0; /* 1 */\n line-height: inherit; /* 2 */\n}\n\n/*\n1. Add the correct height in Firefox.\n2. Correct the inheritance of border color in Firefox. (https://bugzilla.mozilla.org/show_bug.cgi?id=190655)\n3. Ensure horizontal rules are visible by default.\n*/\n\nhr {\n height: 0; /* 1 */\n color: inherit; /* 2 */\n border-top-width: 1px; /* 3 */\n}\n\n/*\nAdd the correct text decoration in Chrome, Edge, and Safari.\n*/\n\nabbr:where([title]) {\n -webkit-text-decoration: underline dotted;\n text-decoration: underline dotted;\n}\n\n/*\nRemove the default font size and weight for headings.\n*/\n\nh1,\nh2,\nh3,\nh4,\nh5,\nh6 {\n font-size: inherit;\n font-weight: inherit;\n}\n\n/*\nReset links to optimize for opt-in styling instead of opt-out.\n*/\n\na {\n color: inherit;\n text-decoration: inherit;\n}\n\n/*\nAdd the correct font weight in Edge and Safari.\n*/\n\nb,\nstrong {\n font-weight: bolder;\n}\n\n/*\n1. Use the user's configured `mono` font-family by default.\n2. Use the user's configured `mono` font-feature-settings by default.\n3. Use the user's configured `mono` font-variation-settings by default.\n4. Correct the odd `em` font sizing in all browsers.\n*/\n\ncode,\nkbd,\nsamp,\npre {\n font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, \"Liberation Mono\", \"Courier New\", monospace; /* 1 */\n font-feature-settings: normal; /* 2 */\n font-variation-settings: normal; /* 3 */\n font-size: 1em; /* 4 */\n}\n\n/*\nAdd the correct font size in all browsers.\n*/\n\nsmall {\n font-size: 80%;\n}\n\n/*\nPrevent `sub` and `sup` elements from affecting the line height in all browsers.\n*/\n\nsub,\nsup {\n font-size: 75%;\n line-height: 0;\n position: relative;\n vertical-align: baseline;\n}\n\nsub {\n bottom: -0.25em;\n}\n\nsup {\n top: -0.5em;\n}\n\n/*\n1. Remove text indentation from table contents in Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=999088, https://bugs.webkit.org/show_bug.cgi?id=201297)\n2. Correct table border color inheritance in all Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=935729, https://bugs.webkit.org/show_bug.cgi?id=195016)\n3. Remove gaps between table borders by default.\n*/\n\ntable {\n text-indent: 0; /* 1 */\n border-color: inherit; /* 2 */\n border-collapse: collapse; /* 3 */\n}\n\n/*\n1. Change the font styles in all browsers.\n2. Remove the margin in Firefox and Safari.\n3. Remove default padding in all browsers.\n*/\n\nbutton,\ninput,\noptgroup,\nselect,\ntextarea {\n font-family: inherit; /* 1 */\n font-feature-settings: inherit; /* 1 */\n font-variation-settings: inherit; /* 1 */\n font-size: 100%; /* 1 */\n font-weight: inherit; /* 1 */\n line-height: inherit; /* 1 */\n letter-spacing: inherit; /* 1 */\n color: inherit; /* 1 */\n margin: 0; /* 2 */\n padding: 0; /* 3 */\n}\n\n/*\nRemove the inheritance of text transform in Edge and Firefox.\n*/\n\nbutton,\nselect {\n text-transform: none;\n}\n\n/*\n1. Correct the inability to style clickable types in iOS and Safari.\n2. Remove default button styles.\n*/\n\nbutton,\ninput:where([type='button']),\ninput:where([type='reset']),\ninput:where([type='submit']) {\n -webkit-appearance: button; /* 1 */\n background-color: transparent; /* 2 */\n background-image: none; /* 2 */\n}\n\n/*\nUse the modern Firefox focus style for all focusable elements.\n*/\n\n:-moz-focusring {\n outline: auto;\n}\n\n/*\nRemove the additional `:invalid` styles in Firefox. (https://github.com/mozilla/gecko-dev/blob/2f9eacd9d3d995c937b4251a5557d95d494c9be1/layout/style/res/forms.css#L728-L737)\n*/\n\n:-moz-ui-invalid {\n box-shadow: none;\n}\n\n/*\nAdd the correct vertical alignment in Chrome and Firefox.\n*/\n\nprogress {\n vertical-align: baseline;\n}\n\n/*\nCorrect the cursor style of increment and decrement buttons in Safari.\n*/\n\n::-webkit-inner-spin-button,\n::-webkit-outer-spin-button {\n height: auto;\n}\n\n/*\n1. Correct the odd appearance in Chrome and Safari.\n2. Correct the outline style in Safari.\n*/\n\n[type='search'] {\n -webkit-appearance: textfield; /* 1 */\n outline-offset: -2px; /* 2 */\n}\n\n/*\nRemove the inner padding in Chrome and Safari on macOS.\n*/\n\n::-webkit-search-decoration {\n -webkit-appearance: none;\n}\n\n/*\n1. Correct the inability to style clickable types in iOS and Safari.\n2. Change font properties to `inherit` in Safari.\n*/\n\n::-webkit-file-upload-button {\n -webkit-appearance: button; /* 1 */\n font: inherit; /* 2 */\n}\n\n/*\nAdd the correct display in Chrome and Safari.\n*/\n\nsummary {\n display: list-item;\n}\n\n/*\nRemoves the default spacing and border for appropriate elements.\n*/\n\nblockquote,\ndl,\ndd,\nh1,\nh2,\nh3,\nh4,\nh5,\nh6,\nhr,\nfigure,\np,\npre {\n margin: 0;\n}\n\nfieldset {\n margin: 0;\n padding: 0;\n}\n\nlegend {\n padding: 0;\n}\n\nol,\nul,\nmenu {\n list-style: none;\n margin: 0;\n padding: 0;\n}\n\n/*\nReset default styling for dialogs.\n*/\ndialog {\n padding: 0;\n}\n\n/*\nPrevent resizing textareas horizontally by default.\n*/\n\ntextarea {\n resize: vertical;\n}\n\n/*\n1. Reset the default placeholder opacity in Firefox. (https://github.com/tailwindlabs/tailwindcss/issues/3300)\n2. Set the default placeholder color to the user's configured gray 400 color.\n*/\n\ninput::-moz-placeholder, textarea::-moz-placeholder {\n opacity: 1; /* 1 */\n color: #9ca3af; /* 2 */\n}\n\ninput::placeholder,\ntextarea::placeholder {\n opacity: 1; /* 1 */\n color: #9ca3af; /* 2 */\n}\n\n/*\nSet the default cursor for buttons.\n*/\n\nbutton,\n[role=\"button\"] {\n cursor: pointer;\n}\n\n/*\nMake sure disabled buttons don't get the pointer cursor.\n*/\n:disabled {\n cursor: default;\n}\n\n/*\n1. Make replaced elements `display: block` by default. (https://github.com/mozdevs/cssremedy/issues/14)\n2. Add `vertical-align: middle` to align replaced elements more sensibly by default. (https://github.com/jensimmons/cssremedy/issues/14#issuecomment-634934210)\n This can trigger a poorly considered lint error in some tools but is included by design.\n*/\n\nimg,\nsvg,\nvideo,\ncanvas,\naudio,\niframe,\nembed,\nobject {\n display: block; /* 1 */\n vertical-align: middle; /* 2 */\n}\n\n/*\nConstrain images and videos to the parent width and preserve their intrinsic aspect ratio. (https://github.com/mozdevs/cssremedy/issues/14)\n*/\n\nimg,\nvideo {\n max-width: 100%;\n height: auto;\n}\n\n/* Make elements with the HTML hidden attribute stay hidden by default */\n[hidden] {\n display: none;\n}\n\n*, ::before, ::after {\n --tw-border-spacing-x: 0;\n --tw-border-spacing-y: 0;\n --tw-translate-x: 0;\n --tw-translate-y: 0;\n --tw-rotate: 0;\n --tw-skew-x: 0;\n --tw-skew-y: 0;\n --tw-scale-x: 1;\n --tw-scale-y: 1;\n --tw-pan-x: ;\n --tw-pan-y: ;\n --tw-pinch-zoom: ;\n --tw-scroll-snap-strictness: proximity;\n --tw-gradient-from-position: ;\n --tw-gradient-via-position: ;\n --tw-gradient-to-position: ;\n --tw-ordinal: ;\n --tw-slashed-zero: ;\n --tw-numeric-figure: ;\n --tw-numeric-spacing: ;\n --tw-numeric-fraction: ;\n --tw-ring-inset: ;\n --tw-ring-offset-width: 0px;\n --tw-ring-offset-color: #fff;\n --tw-ring-color: rgb(59 130 246 / 0.5);\n --tw-ring-offset-shadow: 0 0 #0000;\n --tw-ring-shadow: 0 0 #0000;\n --tw-shadow: 0 0 #0000;\n --tw-shadow-colored: 0 0 #0000;\n --tw-blur: ;\n --tw-brightness: ;\n --tw-contrast: ;\n --tw-grayscale: ;\n --tw-hue-rotate: ;\n --tw-invert: ;\n --tw-saturate: ;\n --tw-sepia: ;\n --tw-drop-shadow: ;\n --tw-backdrop-blur: ;\n --tw-backdrop-brightness: ;\n --tw-backdrop-contrast: ;\n --tw-backdrop-grayscale: ;\n --tw-backdrop-hue-rotate: ;\n --tw-backdrop-invert: ;\n --tw-backdrop-opacity: ;\n --tw-backdrop-saturate: ;\n --tw-backdrop-sepia: ;\n --tw-contain-size: ;\n --tw-contain-layout: ;\n --tw-contain-paint: ;\n --tw-contain-style: ;\n}\n\n::backdrop {\n --tw-border-spacing-x: 0;\n --tw-border-spacing-y: 0;\n --tw-translate-x: 0;\n --tw-translate-y: 0;\n --tw-rotate: 0;\n --tw-skew-x: 0;\n --tw-skew-y: 0;\n --tw-scale-x: 1;\n --tw-scale-y: 1;\n --tw-pan-x: ;\n --tw-pan-y: ;\n --tw-pinch-zoom: ;\n --tw-scroll-snap-strictness: proximity;\n --tw-gradient-from-position: ;\n --tw-gradient-via-position: ;\n --tw-gradient-to-position: ;\n --tw-ordinal: ;\n --tw-slashed-zero: ;\n --tw-numeric-figure: ;\n --tw-numeric-spacing: ;\n --tw-numeric-fraction: ;\n --tw-ring-inset: ;\n --tw-ring-offset-width: 0px;\n --tw-ring-offset-color: #fff;\n --tw-ring-color: rgb(59 130 246 / 0.5);\n --tw-ring-offset-shadow: 0 0 #0000;\n --tw-ring-shadow: 0 0 #0000;\n --tw-shadow: 0 0 #0000;\n --tw-shadow-colored: 0 0 #0000;\n --tw-blur: ;\n --tw-brightness: ;\n --tw-contrast: ;\n --tw-grayscale: ;\n --tw-hue-rotate: ;\n --tw-invert: ;\n --tw-saturate: ;\n --tw-sepia: ;\n --tw-drop-shadow: ;\n --tw-backdrop-blur: ;\n --tw-backdrop-brightness: ;\n --tw-backdrop-contrast: ;\n --tw-backdrop-grayscale: ;\n --tw-backdrop-hue-rotate: ;\n --tw-backdrop-invert: ;\n --tw-backdrop-opacity: ;\n --tw-backdrop-saturate: ;\n --tw-backdrop-sepia: ;\n --tw-contain-size: ;\n --tw-contain-layout: ;\n --tw-contain-paint: ;\n --tw-contain-style: ;\n}\n.container {\n width: 100%;\n}\n@media (min-width: 640px) {\n\n .container {\n max-width: 640px;\n }\n}\n@media (min-width: 768px) {\n\n .container {\n max-width: 768px;\n }\n}\n@media (min-width: 1024px) {\n\n .container {\n max-width: 1024px;\n }\n}\n@media (min-width: 1280px) {\n\n .container {\n max-width: 1280px;\n }\n}\n@media (min-width: 1536px) {\n\n .container {\n max-width: 1536px;\n }\n}\n.pointer-events-none {\n pointer-events: none;\n}\n.static {\n position: static;\n}\n.fixed {\n position: fixed;\n}\n.absolute {\n position: absolute;\n}\n.relative {\n position: relative;\n}\n.inset-0 {\n inset: 0px;\n}\n.top-0 {\n top: 0px;\n}\n.z-10 {\n z-index: 10;\n}\n.z-20 {\n z-index: 20;\n}\n.col-span-2 {\n grid-column: span 2 / span 2;\n}\n.mx-2 {\n margin-left: 0.5rem;\n margin-right: 0.5rem;\n}\n.mb-\\[1px\\] {\n margin-bottom: 1px;\n}\n.block {\n display: block;\n}\n.inline-block {\n display: inline-block;\n}\n.inline {\n display: inline;\n}\n.flex {\n display: flex;\n}\n.grid {\n display: grid;\n}\n.contents {\n display: contents;\n}\n.hidden {\n display: none;\n}\n.h-\\[1\\.1rem\\] {\n height: 1.1rem;\n}\n.h-\\[5px\\] {\n height: 5px;\n}\n.h-full {\n height: 100%;\n}\n.w-1 {\n width: 0.25rem;\n}\n.w-\\[2px\\] {\n width: 2px;\n}\n.w-full {\n width: 100%;\n}\n.transform {\n transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));\n}\n.cursor-crosshair {\n cursor: crosshair;\n}\n.resize {\n resize: both;\n}\n.flex-wrap {\n flex-wrap: wrap;\n}\n.items-center {\n align-items: center;\n}\n.justify-center {\n justify-content: center;\n}\n.overflow-auto {\n overflow: auto;\n}\n.overflow-hidden {\n overflow: hidden;\n}\n.text-nowrap {\n text-wrap: nowrap;\n}\n.rounded {\n border-radius: 0.25rem;\n}\n.border {\n border-width: 1px;\n}\n.border-r-2 {\n border-right-width: 2px;\n}\n.border-blue-500 {\n --tw-border-opacity: 1;\n border-color: rgb(59 130 246 / var(--tw-border-opacity));\n}\n.border-red-700 {\n --tw-border-opacity: 1;\n border-color: rgb(185 28 28 / var(--tw-border-opacity));\n}\n.border-slate-500 {\n --tw-border-opacity: 1;\n border-color: rgb(100 116 139 / var(--tw-border-opacity));\n}\n.border-b-slate-600 {\n --tw-border-opacity: 1;\n border-bottom-color: rgb(71 85 105 / var(--tw-border-opacity));\n}\n.bg-blue-200 {\n --tw-bg-opacity: 1;\n background-color: rgb(191 219 254 / var(--tw-bg-opacity));\n}\n.bg-blue-500 {\n --tw-bg-opacity: 1;\n background-color: rgb(59 130 246 / var(--tw-bg-opacity));\n}\n.bg-red-500 {\n --tw-bg-opacity: 1;\n background-color: rgb(239 68 68 / var(--tw-bg-opacity));\n}\n.bg-slate-100 {\n --tw-bg-opacity: 1;\n background-color: rgb(241 245 249 / var(--tw-bg-opacity));\n}\n.bg-slate-200 {\n --tw-bg-opacity: 1;\n background-color: rgb(226 232 240 / var(--tw-bg-opacity));\n}\n.bg-slate-300 {\n --tw-bg-opacity: 1;\n background-color: rgb(203 213 225 / var(--tw-bg-opacity));\n}\n.bg-slate-800 {\n --tw-bg-opacity: 1;\n background-color: rgb(30 41 59 / var(--tw-bg-opacity));\n}\n.bg-opacity-20 {\n --tw-bg-opacity: 0.2;\n}\n.p-\\[1px\\] {\n padding: 1px;\n}\n.pb-0 {\n padding-bottom: 0px;\n}\n.pl-1 {\n padding-left: 0.25rem;\n}\n.pl-2 {\n padding-left: 0.5rem;\n}\n.pr-0 {\n padding-right: 0px;\n}\n.pr-1 {\n padding-right: 0.25rem;\n}\n.pt-\\[8px\\] {\n padding-top: 8px;\n}\n.font-mono {\n font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, \"Liberation Mono\", \"Courier New\", monospace;\n}\n.text-sm {\n font-size: 0.875rem;\n line-height: 1.25rem;\n}\n.text-xs {\n font-size: 0.75rem;\n line-height: 1rem;\n}\n.line-through {\n text-decoration-line: line-through;\n}\n.opacity-50 {\n opacity: 0.5;\n}\n.shadow {\n --tw-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);\n --tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);\n box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);\n}\n.shadow-slate-300 {\n --tw-shadow-color: #cbd5e1;\n --tw-shadow: var(--tw-shadow-colored);\n}\n.shadow-slate-600 {\n --tw-shadow-color: #475569;\n --tw-shadow: var(--tw-shadow-colored);\n}\n.outline {\n outline-style: solid;\n}\n.filter {\n filter: var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow);\n}\n.hover\\:bg-slate-400:hover {\n --tw-bg-opacity: 1;\n background-color: rgb(148 163 184 / var(--tw-bg-opacity));\n}\n.peer:hover ~ .peer-hover\\:border-slate-400 {\n --tw-border-opacity: 1;\n border-color: rgb(148 163 184 / var(--tw-border-opacity));\n}\n.peer:hover ~ .peer-hover\\:bg-slate-300 {\n --tw-bg-opacity: 1;\n background-color: rgb(203 213 225 / var(--tw-bg-opacity));\n}\n.data-\\[focused\\]\\:bg-slate-400[data-focused] {\n --tw-bg-opacity: 1;\n background-color: rgb(148 163 184 / var(--tw-bg-opacity));\n}\n.peer[data-focused] ~ .peer-data-\\[focused\\]\\:border-slate-400 {\n --tw-border-opacity: 1;\n border-color: rgb(148 163 184 / var(--tw-border-opacity));\n}\n.peer[data-focused] ~ .peer-data-\\[focused\\]\\:bg-slate-300 {\n --tw-bg-opacity: 1;\n background-color: rgb(203 213 225 / var(--tw-bg-opacity));\n}\n";
|
|
2
2
|
export {
|
|
3
3
|
twStyle as default
|
|
4
4
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export { EFAudio } from './elements/EFAudio.js';
|
|
|
5
5
|
export { EFVideo } from './elements/EFVideo.js';
|
|
6
6
|
export { EFCaptions, EFCaptionsActiveWord, EFCaptionsSegment, EFCaptionsBeforeActiveWord, EFCaptionsAfterActiveWord, } from './elements/EFCaptions.js';
|
|
7
7
|
export { EFWaveform } from './elements/EFWaveform.js';
|
|
8
|
+
export { EFConfiguration } from './gui/EFConfiguration.ts';
|
|
8
9
|
export { EFWorkbench } from './gui/EFWorkbench.js';
|
|
9
10
|
export { EFPreview } from './gui/EFPreview.js';
|
|
10
11
|
export { EFFilmstrip } from './gui/EFFilmstrip.js';
|
package/dist/index.js
CHANGED
|
@@ -6,6 +6,7 @@ import { EFAudio } from "./elements/EFAudio.js";
|
|
|
6
6
|
import { EFVideo } from "./elements/EFVideo.js";
|
|
7
7
|
import { EFCaptions, EFCaptionsActiveWord, EFCaptionsAfterActiveWord, EFCaptionsBeforeActiveWord, EFCaptionsSegment } from "./elements/EFCaptions.js";
|
|
8
8
|
import { EFWaveform } from "./elements/EFWaveform.js";
|
|
9
|
+
import { EFConfiguration } from "./gui/EFConfiguration.js";
|
|
9
10
|
import { EFWorkbench } from "./gui/EFWorkbench.js";
|
|
10
11
|
import { EFPreview } from "./gui/EFPreview.js";
|
|
11
12
|
import { EFFilmstrip } from "./gui/EFFilmstrip.js";
|
|
@@ -25,6 +26,7 @@ export {
|
|
|
25
26
|
EFCaptionsAfterActiveWord,
|
|
26
27
|
EFCaptionsBeforeActiveWord,
|
|
27
28
|
EFCaptionsSegment,
|
|
29
|
+
EFConfiguration,
|
|
28
30
|
EFFilmstrip,
|
|
29
31
|
EFFocusOverlay,
|
|
30
32
|
EFImage,
|
package/dist/style.css
CHANGED
|
@@ -686,6 +686,10 @@ video {
|
|
|
686
686
|
--tw-bg-opacity: 1;
|
|
687
687
|
background-color: rgb(203 213 225 / var(--tw-bg-opacity));
|
|
688
688
|
}
|
|
689
|
+
.bg-slate-800 {
|
|
690
|
+
--tw-bg-opacity: 1;
|
|
691
|
+
background-color: rgb(30 41 59 / var(--tw-bg-opacity));
|
|
692
|
+
}
|
|
689
693
|
.bg-opacity-20 {
|
|
690
694
|
--tw-bg-opacity: 0.2;
|
|
691
695
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@editframe/elements",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.0-beta.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"author": "",
|
|
22
22
|
"license": "UNLICENSED",
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@editframe/assets": "0.
|
|
24
|
+
"@editframe/assets": "0.14.0-beta.1",
|
|
25
25
|
"@lit/context": "^1.1.2",
|
|
26
26
|
"@lit/task": "^1.0.1",
|
|
27
27
|
"d3": "^7.9.0",
|
package/src/elements/EFImage.ts
CHANGED
package/src/elements/EFMedia.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { consume } from "@lit/context";
|
|
2
1
|
import { Task } from "@lit/task";
|
|
3
2
|
import { deepArrayEquals } from "@lit/task/deep-equals.js";
|
|
4
3
|
import debug from "debug";
|
|
@@ -12,7 +11,6 @@ import { VideoAsset } from "@editframe/assets/EncodedAsset.js";
|
|
|
12
11
|
import { MP4File } from "@editframe/assets/MP4File.js";
|
|
13
12
|
import { EF_INTERACTIVE } from "../EF_INTERACTIVE.js";
|
|
14
13
|
import { EF_RENDERING } from "../EF_RENDERING.js";
|
|
15
|
-
import { apiHostContext } from "../gui/apiHostContext.js";
|
|
16
14
|
import { EFSourceMixin } from "./EFSourceMixin.js";
|
|
17
15
|
import { EFTemporal, isEFTemporal } from "./EFTemporal.js";
|
|
18
16
|
import { FetchMixin } from "./FetchMixin.js";
|
|
@@ -49,10 +47,6 @@ export class EFMedia extends EFSourceMixin(EFTemporal(FetchMixin(LitElement)), {
|
|
|
49
47
|
@property({ type: Number })
|
|
50
48
|
currentTimeMs = 0;
|
|
51
49
|
|
|
52
|
-
@consume({ context: apiHostContext, subscribe: true })
|
|
53
|
-
@state()
|
|
54
|
-
efHost?: string;
|
|
55
|
-
|
|
56
50
|
#assetId: string | null = null;
|
|
57
51
|
|
|
58
52
|
/**
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
import { consume } from "@lit/context";
|
|
2
1
|
import { Task } from "@lit/task";
|
|
3
2
|
import type { LitElement } from "lit";
|
|
4
3
|
import { property } from "lit/decorators/property.js";
|
|
5
|
-
import { state } from "lit/decorators/state.js";
|
|
6
|
-
import { apiHostContext } from "../gui/apiHostContext.js";
|
|
7
4
|
|
|
8
5
|
export declare class EFSourceMixinInterface {
|
|
9
6
|
apiHost?: string;
|
|
@@ -20,12 +17,13 @@ export function EFSourceMixin<T extends Constructor<LitElement>>(
|
|
|
20
17
|
options: EFSourceMixinOptions,
|
|
21
18
|
) {
|
|
22
19
|
class EFSourceElement extends superClass {
|
|
23
|
-
@consume({ context: apiHostContext, subscribe: true })
|
|
24
|
-
@state()
|
|
25
|
-
private _apiHost?: string;
|
|
26
|
-
|
|
27
20
|
get apiHost() {
|
|
28
|
-
return
|
|
21
|
+
return (
|
|
22
|
+
this.closest("ef-configuration")?.apiHost ??
|
|
23
|
+
this.closest("ef-workbench")?.apiHost ??
|
|
24
|
+
this.closest("ef-preview")?.apiHost ??
|
|
25
|
+
"https://editframe.dev"
|
|
26
|
+
);
|
|
29
27
|
}
|
|
30
28
|
|
|
31
29
|
@property({ type: String })
|
|
@@ -303,6 +303,11 @@ export const EFTemporal = <T extends Constructor<LitElement>>(
|
|
|
303
303
|
}
|
|
304
304
|
}
|
|
305
305
|
|
|
306
|
+
disconnectedCallback() {
|
|
307
|
+
super.disconnectedCallback();
|
|
308
|
+
this.ownCurrentTimeController?.remove();
|
|
309
|
+
}
|
|
310
|
+
|
|
306
311
|
get parentTimegroup() {
|
|
307
312
|
return this.#parentTimegroup;
|
|
308
313
|
}
|
|
@@ -342,7 +342,6 @@ export class EFTimegroup extends EFTemporal(LitElement) {
|
|
|
342
342
|
*
|
|
343
343
|
* If the timegroup is already wrappedin a context provider like ef-preview,
|
|
344
344
|
* it should NOT be wrapped in a workbench.
|
|
345
|
-
*
|
|
346
345
|
*/
|
|
347
346
|
shouldWrapWithWorkbench() {
|
|
348
347
|
return (
|
|
@@ -356,7 +355,7 @@ export class EFTimegroup extends EFTemporal(LitElement) {
|
|
|
356
355
|
|
|
357
356
|
wrapWithWorkbench() {
|
|
358
357
|
const workbench = document.createElement("ef-workbench");
|
|
359
|
-
|
|
358
|
+
this.parentElement?.append(workbench);
|
|
360
359
|
if (!this.hasAttribute("id")) {
|
|
361
360
|
this.setAttribute("id", "root-this");
|
|
362
361
|
}
|
|
@@ -12,14 +12,21 @@ import { EFVideo } from "./EFVideo.js";
|
|
|
12
12
|
|
|
13
13
|
@customElement("ef-waveform")
|
|
14
14
|
export class EFWaveform extends EFTemporal(TWMixin(LitElement)) {
|
|
15
|
-
static styles =
|
|
16
|
-
css`
|
|
15
|
+
static styles = css`
|
|
17
16
|
:host {
|
|
18
17
|
display: block;
|
|
19
18
|
all: inherit;
|
|
19
|
+
position: relative;
|
|
20
20
|
}
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
|
|
22
|
+
canvas {
|
|
23
|
+
position: absolute;
|
|
24
|
+
top: 0;
|
|
25
|
+
left: 0;
|
|
26
|
+
width: 100%;
|
|
27
|
+
height: 100%;
|
|
28
|
+
}
|
|
29
|
+
`;
|
|
23
30
|
|
|
24
31
|
canvasRef: Ref<HTMLCanvasElement> = createRef();
|
|
25
32
|
private ctx: CanvasRenderingContext2D | null = null;
|
|
@@ -27,10 +34,6 @@ export class EFWaveform extends EFTemporal(TWMixin(LitElement)) {
|
|
|
27
34
|
private resizeObserver?: ResizeObserver;
|
|
28
35
|
private mutationObserver?: MutationObserver;
|
|
29
36
|
|
|
30
|
-
createRenderRoot() {
|
|
31
|
-
return this;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
37
|
render() {
|
|
35
38
|
return html`<canvas ${ref(this.canvasRef)}></canvas>`;
|
|
36
39
|
}
|
|
@@ -115,6 +118,7 @@ export class EFWaveform extends EFTemporal(TWMixin(LitElement)) {
|
|
|
115
118
|
|
|
116
119
|
const ctx = canvas.getContext("2d");
|
|
117
120
|
if (!ctx) return null;
|
|
121
|
+
ctx.reset();
|
|
118
122
|
|
|
119
123
|
// Scale all drawing operations by dpr
|
|
120
124
|
ctx.scale(dpr, dpr);
|
|
@@ -2,9 +2,7 @@ import { LitElement } from "lit";
|
|
|
2
2
|
import { customElement } from "lit/decorators/custom-element.js";
|
|
3
3
|
import { describe, expect, test, vi } from "vitest";
|
|
4
4
|
|
|
5
|
-
import { consume } from "@lit/context";
|
|
6
5
|
import { ContextMixin } from "./ContextMixin.js";
|
|
7
|
-
import { apiHostContext } from "./apiHostContext.js";
|
|
8
6
|
|
|
9
7
|
// Required to test timeupdate event, we need a duration, and timegroups are a quick way to do that
|
|
10
8
|
import "../elements/EFTimegroup.js";
|
|
@@ -18,40 +16,11 @@ declare global {
|
|
|
18
16
|
}
|
|
19
17
|
}
|
|
20
18
|
|
|
21
|
-
@customElement("ef-host-consumer")
|
|
22
|
-
class EFHostConsumer extends LitElement {
|
|
23
|
-
@consume({ context: apiHostContext, subscribe: true })
|
|
24
|
-
apiHost?: string;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
declare global {
|
|
28
|
-
interface HTMLElementTagNameMap {
|
|
29
|
-
"ef-host-consumer": EFHostConsumer;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
19
|
describe("ContextMixin", () => {
|
|
34
20
|
test("should be defined", () => {
|
|
35
21
|
expect(ContextMixin).toBeDefined();
|
|
36
22
|
});
|
|
37
23
|
|
|
38
|
-
describe("efHost", () => {
|
|
39
|
-
test("Provides apiHost", () => {
|
|
40
|
-
const element = document.createElement("test-context");
|
|
41
|
-
const consumer = document.createElement("ef-host-consumer");
|
|
42
|
-
document.body.appendChild(element);
|
|
43
|
-
element.appendChild(consumer);
|
|
44
|
-
expect(consumer.apiHost).toBe(element.apiHost);
|
|
45
|
-
|
|
46
|
-
element.apiHost = "test";
|
|
47
|
-
expect(consumer.apiHost).toBe("test");
|
|
48
|
-
|
|
49
|
-
element.setAttribute("api-host", "test2");
|
|
50
|
-
expect(consumer.apiHost).toBe("test2");
|
|
51
|
-
|
|
52
|
-
expect(element.apiHost).toBe("test2");
|
|
53
|
-
});
|
|
54
|
-
});
|
|
55
24
|
describe("Playback", () => {
|
|
56
25
|
test("should start playback", () => {
|
|
57
26
|
const element = document.createElement("test-context");
|
package/src/gui/ContextMixin.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import { createContext, provide } from "@lit/context";
|
|
1
|
+
import { consume, createContext, provide } from "@lit/context";
|
|
2
2
|
import type { LitElement } from "lit";
|
|
3
3
|
import { property, state } from "lit/decorators.js";
|
|
4
4
|
|
|
5
|
-
import { createRef } from "lit/directives/ref.js";
|
|
6
5
|
import type { EFTimegroup } from "../elements/EFTimegroup.js";
|
|
7
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
type EFConfiguration,
|
|
8
|
+
efConfigurationContext,
|
|
9
|
+
} from "./EFConfiguration.ts";
|
|
8
10
|
import { efContext } from "./efContext.js";
|
|
9
11
|
import { fetchContext } from "./fetchContext.js";
|
|
10
12
|
import { type FocusContext, focusContext } from "./focusContext.js";
|
|
@@ -23,8 +25,6 @@ export declare class ContextMixinInterface extends LitElement {
|
|
|
23
25
|
loop: boolean;
|
|
24
26
|
currentTimeMs: number;
|
|
25
27
|
focusedElement?: HTMLElement;
|
|
26
|
-
stageRef: ReturnType<typeof createRef<HTMLDivElement>>;
|
|
27
|
-
canvasRef: ReturnType<typeof createRef<HTMLElement>>;
|
|
28
28
|
targetTimegroup: EFTimegroup | null;
|
|
29
29
|
play(): void;
|
|
30
30
|
pause(): void;
|
|
@@ -45,6 +45,9 @@ export function ContextMixin<T extends Constructor<LitElement>>(superClass: T) {
|
|
|
45
45
|
class ContextElement extends superClass {
|
|
46
46
|
static [contextMixinSymbol] = true;
|
|
47
47
|
|
|
48
|
+
@consume({ context: efConfigurationContext, subscribe: true })
|
|
49
|
+
efConfiguration: EFConfiguration | null = null;
|
|
50
|
+
|
|
48
51
|
@provide({ context: focusContext })
|
|
49
52
|
focusContext = this as FocusContext;
|
|
50
53
|
|
|
@@ -52,9 +55,15 @@ export function ContextMixin<T extends Constructor<LitElement>>(superClass: T) {
|
|
|
52
55
|
@state()
|
|
53
56
|
focusedElement?: HTMLElement;
|
|
54
57
|
|
|
55
|
-
|
|
56
|
-
@property({ type: String,
|
|
57
|
-
apiHost
|
|
58
|
+
#apiHost?: string;
|
|
59
|
+
@property({ type: String, attribute: "api-host" })
|
|
60
|
+
get apiHost() {
|
|
61
|
+
return this.#apiHost ?? this.efConfiguration?.apiHost ?? "";
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
set apiHost(value: string) {
|
|
65
|
+
this.#apiHost = value;
|
|
66
|
+
}
|
|
58
67
|
|
|
59
68
|
@provide({ context: efContext })
|
|
60
69
|
efContext = this;
|
|
@@ -99,12 +108,18 @@ export function ContextMixin<T extends Constructor<LitElement>>(superClass: T) {
|
|
|
99
108
|
|
|
100
109
|
#URLTokens: Record<string, Promise<string>> = {};
|
|
101
110
|
|
|
111
|
+
#signingURL?: string;
|
|
102
112
|
/**
|
|
103
113
|
* A URL that will be used to generated signed tokens for accessing media files from the
|
|
104
114
|
* editframe API. This is used to authenticate media requests per-user.
|
|
105
115
|
*/
|
|
106
|
-
@property({ type: String })
|
|
107
|
-
signingURL
|
|
116
|
+
@property({ type: String, attribute: "signing-url" })
|
|
117
|
+
get signingURL() {
|
|
118
|
+
return this.#signingURL ?? this.efConfiguration?.signingURL ?? "";
|
|
119
|
+
}
|
|
120
|
+
set signingURL(value: string) {
|
|
121
|
+
this.#signingURL = value;
|
|
122
|
+
}
|
|
108
123
|
|
|
109
124
|
@provide({ context: playingContext })
|
|
110
125
|
@property({ type: Boolean, reflect: true })
|
|
@@ -123,9 +138,6 @@ export function ContextMixin<T extends Constructor<LitElement>>(superClass: T) {
|
|
|
123
138
|
@state()
|
|
124
139
|
currentTimeMs = 0;
|
|
125
140
|
|
|
126
|
-
stageRef = createRef<HTMLDivElement>();
|
|
127
|
-
canvasRef = createRef<HTMLSlotElement>();
|
|
128
|
-
|
|
129
141
|
#FPS = 30;
|
|
130
142
|
#MS_PER_FRAME = 1000 / this.#FPS;
|
|
131
143
|
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { createContext, provide } from "@lit/context";
|
|
2
|
+
import { LitElement, css, html } from "lit";
|
|
3
|
+
import { customElement, property } from "lit/decorators.js";
|
|
4
|
+
|
|
5
|
+
export const efConfigurationContext = createContext<EFConfiguration | null>(
|
|
6
|
+
Symbol("efConfigurationContext"),
|
|
7
|
+
);
|
|
8
|
+
|
|
9
|
+
@customElement("ef-configuration")
|
|
10
|
+
export class EFConfiguration extends LitElement {
|
|
11
|
+
static styles = [
|
|
12
|
+
css`
|
|
13
|
+
:host {
|
|
14
|
+
display: contents;
|
|
15
|
+
}
|
|
16
|
+
`,
|
|
17
|
+
];
|
|
18
|
+
|
|
19
|
+
@provide({ context: efConfigurationContext })
|
|
20
|
+
efConfiguration = this;
|
|
21
|
+
|
|
22
|
+
@property({ type: String, attribute: "api-host" })
|
|
23
|
+
apiHost?: string;
|
|
24
|
+
|
|
25
|
+
@property({ type: String, attribute: "signing-url" })
|
|
26
|
+
signingURL?: string;
|
|
27
|
+
|
|
28
|
+
render() {
|
|
29
|
+
return html`<slot></slot>`;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
declare global {
|
|
34
|
+
interface HTMLElementTagNameMap {
|
|
35
|
+
"ef-configuration": EFConfiguration;
|
|
36
|
+
}
|
|
37
|
+
}
|
package/src/gui/EFFilmstrip.ts
CHANGED
package/src/gui/EFWorkbench.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { LitElement, type PropertyValueMap, css, html } from "lit";
|
|
2
|
-
import { customElement, eventOptions } from "lit/decorators.js";
|
|
2
|
+
import { customElement, eventOptions, state } from "lit/decorators.js";
|
|
3
3
|
import { createRef, ref } from "lit/directives/ref.js";
|
|
4
4
|
|
|
5
5
|
import { ContextMixin } from "./ContextMixin.js";
|
|
@@ -17,9 +17,8 @@ export class EFWorkbench extends ContextMixin(TWMixin(LitElement)) {
|
|
|
17
17
|
`,
|
|
18
18
|
];
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
20
|
+
stageRef = createRef<HTMLDivElement>();
|
|
21
|
+
canvasRef = createRef<HTMLSlotElement>();
|
|
23
22
|
|
|
24
23
|
@eventOptions({ passive: false, capture: true })
|
|
25
24
|
handleStageWheel(event: WheelEvent) {
|
|
@@ -28,6 +27,69 @@ export class EFWorkbench extends ContextMixin(TWMixin(LitElement)) {
|
|
|
28
27
|
|
|
29
28
|
focusOverlay = createRef<HTMLDivElement>();
|
|
30
29
|
|
|
30
|
+
@state()
|
|
31
|
+
private stageScale = 1;
|
|
32
|
+
|
|
33
|
+
setStageScale = () => {
|
|
34
|
+
if (this.isConnected && !this.rendering) {
|
|
35
|
+
const canvasElement = this.canvasRef.value;
|
|
36
|
+
const stageElement = this.stageRef.value;
|
|
37
|
+
const canvasChild = canvasElement?.assignedElements()[0];
|
|
38
|
+
if (stageElement && canvasElement && canvasChild) {
|
|
39
|
+
// Determine the appropriate scale factor to make the canvas fit into
|
|
40
|
+
canvasElement.style.width = `${canvasChild.clientWidth}px`;
|
|
41
|
+
canvasElement.style.height = `${canvasChild.clientHeight}px`;
|
|
42
|
+
const stageWidth = stageElement.clientWidth;
|
|
43
|
+
const stageHeight = stageElement.clientHeight;
|
|
44
|
+
const canvasWidth = canvasElement.clientWidth;
|
|
45
|
+
const canvasHeight = canvasElement.clientHeight;
|
|
46
|
+
const stageRatio = stageWidth / stageHeight;
|
|
47
|
+
const canvasRatio = canvasWidth / canvasHeight;
|
|
48
|
+
|
|
49
|
+
if (stageRatio > canvasRatio) {
|
|
50
|
+
const scale = stageHeight / canvasHeight;
|
|
51
|
+
if (this.stageScale !== scale) {
|
|
52
|
+
canvasElement.style.transform = `scale(${scale})`;
|
|
53
|
+
canvasElement.style.transformOrigin = "top center";
|
|
54
|
+
}
|
|
55
|
+
this.stageScale = scale;
|
|
56
|
+
} else {
|
|
57
|
+
const scale = stageWidth / canvasWidth;
|
|
58
|
+
if (this.stageScale !== scale) {
|
|
59
|
+
canvasElement.style.transform = `scale(${scale})`;
|
|
60
|
+
canvasElement.style.transformOrigin = "center";
|
|
61
|
+
}
|
|
62
|
+
this.stageScale = scale;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
if (this.isConnected) {
|
|
67
|
+
requestAnimationFrame(this.setStageScale);
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
connectedCallback(): void {
|
|
72
|
+
// Set the body and html to 100% width and height to avoid scaling issues
|
|
73
|
+
// this is a hack to avoid scaling issues when the stage is scaled and during output rendering
|
|
74
|
+
// What I've discovered recently is that having the workbench be so smart as to determine
|
|
75
|
+
// how it should be displayed at render time causes problems. Much of that has been extracted
|
|
76
|
+
// but this is a quick fix to avoid scaling issues.
|
|
77
|
+
document.body.style.width = "100%";
|
|
78
|
+
document.body.style.height = "100%";
|
|
79
|
+
document.documentElement.style.width = "100%";
|
|
80
|
+
document.documentElement.style.height = "100%";
|
|
81
|
+
super.connectedCallback();
|
|
82
|
+
requestAnimationFrame(this.setStageScale);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
disconnectedCallback(): void {
|
|
86
|
+
super.disconnectedCallback();
|
|
87
|
+
document.body.style.width = "";
|
|
88
|
+
document.body.style.height = "";
|
|
89
|
+
document.documentElement.style.width = "";
|
|
90
|
+
document.documentElement.style.height = "";
|
|
91
|
+
}
|
|
92
|
+
|
|
31
93
|
update(
|
|
32
94
|
changedProperties: PropertyValueMap<any> | Map<PropertyKey, unknown>,
|
|
33
95
|
): void {
|
|
@@ -70,7 +132,7 @@ export class EFWorkbench extends ContextMixin(TWMixin(LitElement)) {
|
|
|
70
132
|
}
|
|
71
133
|
return html`
|
|
72
134
|
<div
|
|
73
|
-
class="grid h-full w-full"
|
|
135
|
+
class="grid h-full w-full bg-slate-800"
|
|
74
136
|
style="grid-template-rows: 1fr 300px; grid-template-columns: 100%;"
|
|
75
137
|
>
|
|
76
138
|
<div
|