@editframe/elements 0.8.0-beta.3 → 0.8.0-beta.4

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.
@@ -16,11 +16,12 @@ export declare class EFCaptionsActiveWord extends EFCaptionsActiveWord_base {
16
16
  declare const EFCaptions_base: (new (...args: any[]) => import('./EFSourceMixin.ts').EFSourceMixinInterface) & (new (...args: any[]) => import('./EFTemporal.ts').TemporalMixinInterface) & (new (...args: any[]) => import('./FetchMixin.ts').FetchMixinInterface) & typeof LitElement;
17
17
  export declare class EFCaptions extends EFCaptions_base {
18
18
  static styles: import('lit').CSSResult[];
19
- target: null;
19
+ targetSelector: string;
20
+ set target(value: string);
20
21
  wordStyle: string;
21
22
  activeWordContainers: HTMLCollectionOf<EFCaptionsActiveWord>;
22
23
  captionsPath(): string;
23
- protected md5SumLoader: Task<readonly [null, typeof fetch], string | undefined>;
24
+ protected md5SumLoader: Task<readonly [string, typeof fetch], string | undefined>;
24
25
  private captionsDataTask;
25
26
  frameTask: Task<import('@lit/task').TaskStatus[], void>;
26
27
  connectedCallback(): void;
@@ -60,7 +60,7 @@ let EFCaptions = class extends EFSourceMixin(
60
60
  ) {
61
61
  constructor() {
62
62
  super(...arguments);
63
- this.target = null;
63
+ this.targetSelector = "";
64
64
  this.wordStyle = "";
65
65
  this.activeWordContainers = this.getElementsByTagName("ef-captions-active-word");
66
66
  this.md5SumLoader = new Task(this, {
@@ -88,6 +88,9 @@ let EFCaptions = class extends EFSourceMixin(
88
88
  }
89
89
  });
90
90
  }
91
+ set target(value) {
92
+ this.targetSelector = value;
93
+ }
91
94
  captionsPath() {
92
95
  const targetSrc = this.targetElement.src;
93
96
  if (targetSrc.startsWith("editframe://") || targetSrc.startsWith("http")) {
@@ -137,11 +140,11 @@ let EFCaptions = class extends EFSourceMixin(
137
140
  }
138
141
  }
139
142
  get targetElement() {
140
- const target = document.getElementById(this.getAttribute("target") ?? "");
143
+ const target = document.getElementById(this.targetSelector ?? "");
141
144
  if (target instanceof EFAudio || target instanceof EFVideo) {
142
145
  return target;
143
146
  }
144
- throw new Error("Invalid target, must be an EFAudio or EFVideo element");
147
+ throw new Error("Invalid target, must be an EFAudio or EFVideo element");
145
148
  }
146
149
  };
147
150
  EFCaptions.styles = [
@@ -152,8 +155,8 @@ EFCaptions.styles = [
152
155
  `
153
156
  ];
154
157
  __decorateClass([
155
- property({ type: String, attribute: "target" })
156
- ], EFCaptions.prototype, "target", 2);
158
+ property({ type: String, attribute: "target", reflect: true })
159
+ ], EFCaptions.prototype, "targetSelector", 2);
157
160
  __decorateClass([
158
161
  property({ attribute: "word-style" })
159
162
  ], EFCaptions.prototype, "wordStyle", 2);
@@ -301,7 +301,6 @@ class EFMedia extends EFSourceMixin(EFTemporal(FetchMixin(LitElement)), {
301
301
  headers: { Range: `bytes=${start}-${end}` }
302
302
  }
303
303
  );
304
- console.log({ fromMs, toMs });
305
304
  const fragments = Object.values(audioTrackIndex.segments).filter(
306
305
  (segment) => {
307
306
  const segmentStartsBeforeEnd = segment.dts <= toMs * audioTrackIndex.timescale / 1e3;
@@ -202,7 +202,7 @@ let EFWaveform = class extends EFTemporal(TWMixin(LitElement)) {
202
202
  if (target instanceof EFAudio || target instanceof EFVideo) {
203
203
  return target;
204
204
  }
205
- throw new Error("Invalid target, must be an EFAudio element");
205
+ throw new Error("Invalid target, must be an EFAudio or EFVideo element");
206
206
  }
207
207
  };
208
208
  EFWaveform.styles = [];
@@ -3,9 +3,9 @@ import { state, property } from "lit/decorators.js";
3
3
  import { focusContext } from "./focusContext.js";
4
4
  import { focusedElementContext } from "./focusedElementContext.js";
5
5
  import { fetchContext } from "./fetchContext.js";
6
- import { apiHostContext } from "./apiHostContext.js";
7
6
  import { createRef } from "lit/directives/ref.js";
8
- import { playingContext } from "./playingContext.js";
7
+ import { playingContext, loopContext } from "./playingContext.js";
8
+ import { efContext } from "./efContext.js";
9
9
  var __defProp = Object.defineProperty;
10
10
  var __decorateClass = (decorators, target, key, kind) => {
11
11
  var result = void 0;
@@ -20,17 +20,12 @@ function ContextMixin(superClass) {
20
20
  constructor() {
21
21
  super(...arguments);
22
22
  this.focusContext = this;
23
+ this.efContext = this;
23
24
  this.fetch = async (url, init = {}) => {
24
25
  init.headers ||= {};
25
26
  Object.assign(init.headers, {
26
27
  "Content-Type": "application/json"
27
28
  });
28
- const bearerToken = this.apiToken;
29
- if (bearerToken) {
30
- Object.assign(init.headers, {
31
- Authorization: `Bearer ${bearerToken}`
32
- });
33
- }
34
29
  if (this.signingURL) {
35
30
  if (!this.#URLTokens[url]) {
36
31
  this.#URLTokens[url] = fetch(this.signingURL, {
@@ -53,7 +48,6 @@ function ContextMixin(superClass) {
53
48
  return fetch(url, init);
54
49
  };
55
50
  this.#URLTokens = {};
56
- this.apiHost = "";
57
51
  this.playing = false;
58
52
  this.loop = false;
59
53
  this.stageScale = 1;
@@ -65,7 +59,10 @@ function ContextMixin(superClass) {
65
59
  if (this.isConnected && !this.rendering) {
66
60
  const canvasElement = this.canvasRef.value;
67
61
  const stageElement = this.stageRef.value;
68
- if (stageElement && canvasElement) {
62
+ const canvasChild = canvasElement?.assignedElements()[0];
63
+ if (stageElement && canvasElement && canvasChild) {
64
+ canvasElement.style.width = `${canvasChild.clientWidth}px`;
65
+ canvasElement.style.height = `${canvasChild.clientHeight}px`;
69
66
  const stageWidth = stageElement.clientWidth;
70
67
  const stageHeight = stageElement.clientHeight;
71
68
  const canvasWidth = canvasElement.clientWidth;
@@ -76,12 +73,14 @@ function ContextMixin(superClass) {
76
73
  const scale = stageHeight / canvasHeight;
77
74
  if (this.stageScale !== scale) {
78
75
  canvasElement.style.transform = `scale(${scale})`;
76
+ canvasElement.style.transformOrigin = "top";
79
77
  }
80
78
  this.stageScale = scale;
81
79
  } else {
82
80
  const scale = stageWidth / canvasWidth;
83
81
  if (this.stageScale !== scale) {
84
82
  canvasElement.style.transform = `scale(${scale})`;
83
+ canvasElement.style.transformOrigin = "top";
85
84
  }
86
85
  this.stageScale = scale;
87
86
  }
@@ -118,6 +117,12 @@ function ContextMixin(superClass) {
118
117
  get targetTimegroup() {
119
118
  return this.querySelector("ef-timegroup");
120
119
  }
120
+ play() {
121
+ this.playing = true;
122
+ }
123
+ pause() {
124
+ this.playing = false;
125
+ }
121
126
  #playbackAudioContext;
122
127
  #playbackAnimationFrameRequest;
123
128
  #AUDIO_PLAYBACK_SLICE_MS;
@@ -182,7 +187,15 @@ function ContextMixin(superClass) {
182
187
  source.onended = () => {
183
188
  bufferCount--;
184
189
  if (endMs >= toMs) {
185
- this.playing = false;
190
+ this.pause();
191
+ if (this.loop) {
192
+ this.updateComplete.then(() => {
193
+ this.currentTimeMs = 0;
194
+ this.updateComplete.then(() => {
195
+ this.play();
196
+ });
197
+ });
198
+ }
186
199
  } else {
187
200
  fillBuffer();
188
201
  }
@@ -200,24 +213,21 @@ function ContextMixin(superClass) {
200
213
  provide({ context: focusedElementContext }),
201
214
  state()
202
215
  ], ContextElement.prototype, "focusedElement");
216
+ __decorateClass([
217
+ provide({ context: efContext })
218
+ ], ContextElement.prototype, "efContext");
203
219
  __decorateClass([
204
220
  provide({ context: fetchContext })
205
221
  ], ContextElement.prototype, "fetch");
206
222
  __decorateClass([
207
223
  property({ type: String })
208
224
  ], ContextElement.prototype, "signingURL");
209
- __decorateClass([
210
- property({ type: String })
211
- ], ContextElement.prototype, "apiToken");
212
- __decorateClass([
213
- provide({ context: apiHostContext }),
214
- property({ type: String })
215
- ], ContextElement.prototype, "apiHost");
216
225
  __decorateClass([
217
226
  provide({ context: playingContext }),
218
227
  property({ type: Boolean, reflect: true })
219
228
  ], ContextElement.prototype, "playing");
220
229
  __decorateClass([
230
+ provide({ context: loopContext }),
221
231
  property({ type: Boolean, reflect: true })
222
232
  ], ContextElement.prototype, "loop");
223
233
  __decorateClass([
@@ -14,7 +14,7 @@ import { TWMixin } from "./TWMixin.js";
14
14
  import { msToTimeCode } from "../msToTimeCode.js";
15
15
  import { focusedElementContext } from "./focusedElementContext.js";
16
16
  import { focusContext } from "./focusContext.js";
17
- import { playingContext } from "./playingContext.js";
17
+ import { playingContext, loopContext } from "./playingContext.js";
18
18
  var __defProp = Object.defineProperty;
19
19
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
20
20
  var __typeError = (msg) => {
@@ -492,8 +492,9 @@ let EFFilmstrip = class extends TWMixin(LitElement) {
492
492
  this.currentTimeMs = 0;
493
493
  __privateAdd(this, _handleKeyPress, (event) => {
494
494
  if (event.key === " ") {
495
+ const [target] = event.composedPath();
495
496
  const interactiveSelector = "input, textarea, button, select, a, [contenteditable]";
496
- const closestInteractive = event.target?.closest(
497
+ const closestInteractive = target?.closest(
497
498
  interactiveSelector
498
499
  );
499
500
  if (closestInteractive) {
@@ -614,23 +615,8 @@ let EFFilmstrip = class extends TWMixin(LitElement) {
614
615
  />
615
616
  <code>${msToTimeCode(this.currentTimeMs, true)} </code> /
616
617
  <code>${msToTimeCode(target?.durationMs ?? 0, true)}</code>
617
- ${this.playing ? html`<button
618
- @click=${() => {
619
- if (__privateGet(this, _EFFilmstrip_instances, contextElement_get)) {
620
- __privateGet(this, _EFFilmstrip_instances, contextElement_get).playing = false;
621
- }
622
- }}
623
- >
624
- ⏸️
625
- </button>` : html`<button
626
- @click=${() => {
627
- if (__privateGet(this, _EFFilmstrip_instances, contextElement_get)) {
628
- __privateGet(this, _EFFilmstrip_instances, contextElement_get).playing = true;
629
- }
630
- }}
631
- >
632
- ▶️
633
- </button>`}
618
+ <ef-toggle-play><button>${this.playing ? "⏸️" : "▶️"}</button></ef-toggle-play>
619
+ <ef-toggle-loop><button>${this.loop ? "🔁" : html`<span class="opacity-50">🔁</span>`}</button></ef-toggle-loop>
634
620
  </div>
635
621
  <div
636
622
  class="z-10 pl-1 pr-1 pt-2 shadow shadow-slate-600 overflow-auto"
@@ -708,6 +694,10 @@ __decorateClass([
708
694
  consume({ context: playingContext, subscribe: true }),
709
695
  state()
710
696
  ], EFFilmstrip.prototype, "playing", 2);
697
+ __decorateClass([
698
+ consume({ context: loopContext, subscribe: true }),
699
+ state()
700
+ ], EFFilmstrip.prototype, "loop", 2);
711
701
  __decorateClass([
712
702
  state()
713
703
  ], EFFilmstrip.prototype, "currentTimeMs", 2);
@@ -0,0 +1,39 @@
1
+ import { css, LitElement, html } from "lit";
2
+ import { customElement } from "lit/decorators.js";
3
+ import { consume } from "@lit/context";
4
+ import { efContext } from "./efContext.js";
5
+ var __defProp = Object.defineProperty;
6
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
7
+ var __decorateClass = (decorators, target, key, kind) => {
8
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
9
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
10
+ if (decorator = decorators[i])
11
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
12
+ if (kind && result) __defProp(target, key, result);
13
+ return result;
14
+ };
15
+ let EFToggleLoop = class extends LitElement {
16
+ render() {
17
+ return html`
18
+ <slot @click=${() => {
19
+ if (this.context) {
20
+ this.context.loop = !this.context.loop;
21
+ }
22
+ }}></slot>
23
+ `;
24
+ }
25
+ };
26
+ EFToggleLoop.styles = [
27
+ css`
28
+ :host {}
29
+ `
30
+ ];
31
+ __decorateClass([
32
+ consume({ context: efContext })
33
+ ], EFToggleLoop.prototype, "context", 2);
34
+ EFToggleLoop = __decorateClass([
35
+ customElement("ef-toggle-loop")
36
+ ], EFToggleLoop);
37
+ export {
38
+ EFToggleLoop
39
+ };
@@ -0,0 +1,43 @@
1
+ import { css, LitElement, html } from "lit";
2
+ import { customElement } from "lit/decorators.js";
3
+ import { consume } from "@lit/context";
4
+ import { efContext } from "./efContext.js";
5
+ var __defProp = Object.defineProperty;
6
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
7
+ var __decorateClass = (decorators, target, key, kind) => {
8
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
9
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
10
+ if (decorator = decorators[i])
11
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
12
+ if (kind && result) __defProp(target, key, result);
13
+ return result;
14
+ };
15
+ let EFTogglePlay = class extends LitElement {
16
+ render() {
17
+ return html`
18
+ <slot @click=${() => {
19
+ if (this.context) {
20
+ if (this.context.playing) {
21
+ this.context.pause();
22
+ } else {
23
+ this.context.play();
24
+ }
25
+ }
26
+ }}></slot>
27
+ `;
28
+ }
29
+ };
30
+ EFTogglePlay.styles = [
31
+ css`
32
+ :host {}
33
+ `
34
+ ];
35
+ __decorateClass([
36
+ consume({ context: efContext })
37
+ ], EFTogglePlay.prototype, "context", 2);
38
+ EFTogglePlay = __decorateClass([
39
+ customElement("ef-toggle-play")
40
+ ], EFTogglePlay);
41
+ export {
42
+ EFTogglePlay
43
+ };
@@ -69,20 +69,21 @@ let EFWorkbench = class extends ContextMixin(TWMixin(LitElement)) {
69
69
  >
70
70
  <div
71
71
  ${ref(this.stageRef)}
72
- class="relative grid h-full w-full place-content-center place-items-center overflow-hidden"
72
+ class="relative grid h-full w-full justify-center overflow-hidden"
73
73
  @wheel=${this.handleStageWheel}
74
74
  >
75
75
  <slot
76
76
  ${ref(this.canvasRef)}
77
77
  name="canvas"
78
+ class="inline-block"
78
79
  ></slot>
79
80
  <div
80
- class="border border-blue-500 bg-blue-200 bg-opacity-20"
81
+ class="border border-blue-500 bg-blue-200 bg-opacity-20 absolute"
81
82
  ${ref(this.focusOverlay)}
82
83
  ></div>
83
84
  </div>
84
85
 
85
- <slot class="overflow" name="timeline"></slot>
86
+ <slot class="overflow inline-block" name="timeline"></slot>
86
87
  </div>
87
88
  `;
88
89
  }
@@ -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.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.place-content-center {\n place-content: center;\n}\n.place-items-center {\n place-items: center;\n}\n.items-center {\n align-items: 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.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.object-fill {\n -o-object-fit: fill;\n object-fit: fill;\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-2 {\n padding-top: 0.5rem;\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.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.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.transition {\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, -webkit-backdrop-filter;\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter, -webkit-backdrop-filter;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n transition-duration: 150ms;\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.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.place-content-center {\n place-content: center;\n}\n.place-items-center {\n place-items: center;\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.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.object-fill {\n -o-object-fit: fill;\n object-fit: fill;\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-2 {\n padding-top: 0.5rem;\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.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.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.transition {\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, -webkit-backdrop-filter;\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter, -webkit-backdrop-filter;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n transition-duration: 150ms;\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
  };
@@ -0,0 +1,7 @@
1
+ import { createContext } from "@lit/context";
2
+ const efContext = createContext(
3
+ Symbol("efContext")
4
+ );
5
+ export {
6
+ efContext
7
+ };
@@ -1,5 +1,7 @@
1
1
  import { createContext } from "@lit/context";
2
2
  const playingContext = createContext(Symbol("playingContext"));
3
+ const loopContext = createContext(Symbol("loopContext"));
3
4
  export {
5
+ loopContext,
4
6
  playingContext
5
7
  };
@@ -9,6 +9,8 @@ import { EFWaveform } from "./elements/EFWaveform.js";
9
9
  import { EFWorkbench } from "./gui/EFWorkbench.js";
10
10
  import { EFPreview } from "./gui/EFPreview.js";
11
11
  import { EFFilmstrip } from "./gui/EFFilmstrip.js";
12
+ import { EFTogglePlay } from "./gui/EFTogglePlay.js";
13
+ import { EFToggleLoop } from "./gui/EFToggleLoop.js";
12
14
  import "./EF_FRAMEGEN.js";
13
15
  if (typeof window !== "undefined") {
14
16
  window.EF_REGISTERED = true;
@@ -21,6 +23,8 @@ export {
21
23
  EFImage,
22
24
  EFPreview,
23
25
  EFTimegroup,
26
+ EFToggleLoop,
27
+ EFTogglePlay,
24
28
  EFVideo,
25
29
  EFWaveform,
26
30
  EFWorkbench
@@ -1,22 +1,19 @@
1
1
  import { LitElement } from 'lit';
2
- import { FocusContext } from './focusContext.ts';
3
2
  import { createRef } from 'lit/directives/ref.js';
4
3
  import { EFTimegroup } from '../elements/EFTimegroup.ts';
5
4
 
6
- declare class ContextMixinInterface {
7
- focusContext: FocusContext;
8
- focusedElement?: HTMLElement;
9
- fetch: typeof fetch;
5
+ export declare class ContextMixinInterface {
10
6
  signingURL?: string;
11
- apiToken?: string;
12
- apiHost: string;
13
- stageScale: number;
14
7
  rendering: boolean;
15
- stageRef: ReturnType<typeof createRef<HTMLDivElement>>;
16
- canvasRef: ReturnType<typeof createRef<HTMLElement>>;
17
8
  playing: boolean;
18
- targetTimegroup?: EFTimegroup;
9
+ loop: boolean;
19
10
  currentTimeMs: number;
11
+ focusedElement?: HTMLElement;
12
+ stageRef: ReturnType<typeof createRef<HTMLDivElement>>;
13
+ canvasRef: ReturnType<typeof createRef<HTMLElement>>;
14
+ targetTimegroup: EFTimegroup | null;
15
+ play(): void;
16
+ pause(): void;
20
17
  }
21
18
  type Constructor<T = {}> = new (...args: any[]) => T;
22
19
  export declare function ContextMixin<T extends Constructor<LitElement>>(superClass: T): Constructor<ContextMixinInterface> & T;
@@ -108,6 +108,7 @@ export declare class EFFilmstrip extends EFFilmstrip_base {
108
108
  scrubbing: boolean;
109
109
  timelineScrolltop: number;
110
110
  playing?: boolean;
111
+ loop?: boolean;
111
112
  timegroupController?: TimegroupController;
112
113
  currentTimeMs: number;
113
114
  connectedCallback(): void;
@@ -123,7 +124,7 @@ export declare class EFFilmstrip extends EFFilmstrip_base {
123
124
  get gutter(): HTMLDivElement | undefined;
124
125
  render(): TemplateResult<1>;
125
126
  updated(changes: PropertyValueMap<any> | Map<PropertyKey, unknown>): void;
126
- get targetTimegroup(): EFTimegroup | undefined;
127
+ get targetTimegroup(): EFTimegroup | null | undefined;
127
128
  }
128
129
  declare global {
129
130
  interface HTMLElementTagNameMap {
@@ -1,20 +1,6 @@
1
1
  import { LitElement } from 'lit';
2
2
 
3
- declare const EFPreview_base: (new (...args: any[]) => {
4
- focusContext: import('./focusContext.ts').FocusContext;
5
- focusedElement?: HTMLElement;
6
- fetch: typeof fetch;
7
- signingURL?: string;
8
- apiToken?: string;
9
- apiHost: string;
10
- stageScale: number;
11
- rendering: boolean;
12
- stageRef: ReturnType<typeof import('lit-html/directives/ref.js').createRef>;
13
- canvasRef: ReturnType<typeof import('lit-html/directives/ref.js').createRef>;
14
- playing: boolean;
15
- targetTimegroup?: import('../index.ts').EFTimegroup;
16
- currentTimeMs: number;
17
- }) & typeof LitElement;
3
+ declare const EFPreview_base: (new (...args: any[]) => import('./ContextMixin.ts').ContextMixinInterface) & typeof LitElement;
18
4
  export declare class EFPreview extends EFPreview_base {
19
5
  static styles: import('lit').CSSResult[];
20
6
  render(): import('lit-html').TemplateResult<1>;
@@ -0,0 +1,13 @@
1
+ import { LitElement } from 'lit';
2
+ import { ContextMixinInterface } from './ContextMixin.ts';
3
+
4
+ export declare class EFToggleLoop extends LitElement {
5
+ static styles: import('lit').CSSResult[];
6
+ context?: ContextMixinInterface | null;
7
+ render(): import('lit-html').TemplateResult<1>;
8
+ }
9
+ declare global {
10
+ interface HTMLElementTagNameMap {
11
+ "ef-toggle-loop": EFToggleLoop;
12
+ }
13
+ }
@@ -0,0 +1,13 @@
1
+ import { LitElement } from 'lit';
2
+ import { ContextMixinInterface } from './ContextMixin.ts';
3
+
4
+ export declare class EFTogglePlay extends LitElement {
5
+ static styles: import('lit').CSSResult[];
6
+ context?: ContextMixinInterface | null;
7
+ render(): import('lit-html').TemplateResult<1>;
8
+ }
9
+ declare global {
10
+ interface HTMLElementTagNameMap {
11
+ "ef-toggle-play": EFTogglePlay;
12
+ }
13
+ }
@@ -1,21 +1,6 @@
1
1
  import { LitElement, PropertyValueMap } from 'lit';
2
- import { createRef } from 'lit/directives/ref.js';
3
2
 
4
- declare const EFWorkbench_base: (new (...args: any[]) => {
5
- focusContext: import('./focusContext.ts').FocusContext;
6
- focusedElement?: HTMLElement;
7
- fetch: typeof fetch;
8
- signingURL?: string;
9
- apiToken?: string;
10
- apiHost: string;
11
- stageScale: number;
12
- rendering: boolean;
13
- stageRef: ReturnType<typeof createRef>;
14
- canvasRef: ReturnType<typeof createRef>;
15
- playing: boolean;
16
- targetTimegroup?: import('../elements/EFTimegroup.ts').EFTimegroup;
17
- currentTimeMs: number;
18
- }) & typeof LitElement;
3
+ declare const EFWorkbench_base: (new (...args: any[]) => import('./ContextMixin.ts').ContextMixinInterface) & typeof LitElement;
19
4
  export declare class EFWorkbench extends EFWorkbench_base {
20
5
  static styles: import('lit').CSSResult[];
21
6
  disconnectedCallback(): void;
@@ -0,0 +1,5 @@
1
+ import { ContextMixinInterface } from './ContextMixin.ts';
2
+
3
+ export declare const efContext: {
4
+ __context__: ContextMixinInterface | null;
5
+ };
@@ -1,3 +1,6 @@
1
1
  export declare const playingContext: {
2
2
  __context__: boolean;
3
3
  };
4
+ export declare const loopContext: {
5
+ __context__: boolean;
6
+ };
package/dist/index.d.ts CHANGED
@@ -9,3 +9,5 @@ export { EFWaveform } from './elements/EFWaveform.ts';
9
9
  export { EFWorkbench } from './gui/EFWorkbench.ts';
10
10
  export { EFPreview } from './gui/EFPreview.ts';
11
11
  export { EFFilmstrip } from './gui/EFFilmstrip.ts';
12
+ export { EFTogglePlay } from './gui/EFTogglePlay.ts';
13
+ export { EFToggleLoop } from './gui/EFToggleLoop.ts';
package/dist/style.css CHANGED
@@ -624,6 +624,9 @@ video {
624
624
  .items-center {
625
625
  align-items: center;
626
626
  }
627
+ .justify-center {
628
+ justify-content: center;
629
+ }
627
630
  .overflow-auto {
628
631
  overflow: auto;
629
632
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@editframe/elements",
3
- "version": "0.8.0-beta.3",
3
+ "version": "0.8.0-beta.4",
4
4
  "description": "",
5
5
  "exports": {
6
6
  ".": {
@@ -20,7 +20,7 @@
20
20
  "author": "",
21
21
  "license": "UNLICENSED",
22
22
  "dependencies": {
23
- "@editframe/assets": "0.8.0-beta.3",
23
+ "@editframe/assets": "0.8.0-beta.4",
24
24
  "@lit/context": "^1.1.2",
25
25
  "@lit/task": "^1.0.1",
26
26
  "d3": "^7.9.0",
@@ -75,8 +75,12 @@ export class EFCaptions extends EFSourceMixin(
75
75
  `,
76
76
  ];
77
77
 
78
- @property({ type: String, attribute: "target" })
79
- target = null;
78
+ @property({ type: String, attribute: "target", reflect: true })
79
+ targetSelector = "";
80
+
81
+ set target(value: string) {
82
+ this.targetSelector = value;
83
+ }
80
84
 
81
85
  @property({ attribute: "word-style" })
82
86
  wordStyle = "";
@@ -174,11 +178,11 @@ export class EFCaptions extends EFSourceMixin(
174
178
  }
175
179
 
176
180
  get targetElement() {
177
- const target = document.getElementById(this.getAttribute("target") ?? "");
181
+ const target = document.getElementById(this.targetSelector ?? "");
178
182
  if (target instanceof EFAudio || target instanceof EFVideo) {
179
183
  return target;
180
184
  }
181
- throw new Error("Invalid target, must be an EFAudio or EFVideo element");
185
+ throw new Error("Invalid target, must be an EFAudio or EFVideo element");
182
186
  }
183
187
  }
184
188
 
@@ -365,7 +365,6 @@ export class EFMedia extends EFSourceMixin(EFTemporal(FetchMixin(LitElement)), {
365
365
  },
366
366
  );
367
367
 
368
- console.log({ fromMs, toMs });
369
368
  const fragments = Object.values(audioTrackIndex.segments).filter(
370
369
  (segment) => {
371
370
  const segmentStartsBeforeEnd =
@@ -412,6 +412,6 @@ export class EFWaveform extends EFTemporal(TWMixin(LitElement)) {
412
412
  if (target instanceof EFAudio || target instanceof EFVideo) {
413
413
  return target;
414
414
  }
415
- throw new Error("Invalid target, must be an EFAudio element");
415
+ throw new Error("Invalid target, must be an EFAudio or EFVideo element");
416
416
  }
417
417
  }
@@ -5,25 +5,23 @@ import { property, state } from "lit/decorators.js";
5
5
  import { focusContext, type FocusContext } from "./focusContext.ts";
6
6
  import { focusedElementContext } from "./focusedElementContext.ts";
7
7
  import { fetchContext } from "./fetchContext.ts";
8
- import { apiHostContext } from "./apiHostContext.ts";
9
8
  import { createRef } from "lit/directives/ref.js";
10
- import { playingContext } from "./playingContext.ts";
9
+ import { loopContext, playingContext } from "./playingContext.ts";
11
10
  import type { EFTimegroup } from "../elements/EFTimegroup.ts";
11
+ import { efContext } from "./efContext.ts";
12
12
 
13
- declare class ContextMixinInterface {
14
- focusContext: FocusContext;
15
- focusedElement?: HTMLElement;
16
- fetch: typeof fetch;
13
+ export declare class ContextMixinInterface {
17
14
  signingURL?: string;
18
- apiToken?: string;
19
- apiHost: string;
20
- stageScale: number;
21
15
  rendering: boolean;
22
- stageRef: ReturnType<typeof createRef<HTMLDivElement>>;
23
- canvasRef: ReturnType<typeof createRef<HTMLElement>>;
24
16
  playing: boolean;
25
- targetTimegroup?: EFTimegroup;
17
+ loop: boolean;
26
18
  currentTimeMs: number;
19
+ focusedElement?: HTMLElement;
20
+ stageRef: ReturnType<typeof createRef<HTMLDivElement>>;
21
+ canvasRef: ReturnType<typeof createRef<HTMLElement>>;
22
+ targetTimegroup: EFTimegroup | null;
23
+ play(): void;
24
+ pause(): void;
27
25
  }
28
26
 
29
27
  type Constructor<T = {}> = new (...args: any[]) => T;
@@ -36,6 +34,9 @@ export function ContextMixin<T extends Constructor<LitElement>>(superClass: T) {
36
34
  @state()
37
35
  focusedElement?: HTMLElement;
38
36
 
37
+ @provide({ context: efContext })
38
+ efContext = this;
39
+
39
40
  @provide({ context: fetchContext })
40
41
  fetch = async (url: string, init: RequestInit = {}) => {
41
42
  init.headers ||= {};
@@ -43,13 +44,6 @@ export function ContextMixin<T extends Constructor<LitElement>>(superClass: T) {
43
44
  "Content-Type": "application/json",
44
45
  });
45
46
 
46
- const bearerToken = this.apiToken;
47
- if (bearerToken) {
48
- Object.assign(init.headers, {
49
- Authorization: `Bearer ${bearerToken}`,
50
- });
51
- }
52
-
53
47
  if (this.signingURL) {
54
48
  if (!this.#URLTokens[url]) {
55
49
  this.#URLTokens[url] = fetch(this.signingURL, {
@@ -77,25 +71,23 @@ export function ContextMixin<T extends Constructor<LitElement>>(superClass: T) {
77
71
 
78
72
  #URLTokens: Record<string, Promise<string>> = {};
79
73
 
74
+ /**
75
+ * A URL that will be used to generated signed tokens for accessing media files from the
76
+ * editframe API. This is used to authenticate media requests per-user.
77
+ */
80
78
  @property({ type: String })
81
79
  signingURL?: string;
82
80
 
83
- @property({ type: String })
84
- apiToken?: string;
85
-
86
- @provide({ context: apiHostContext })
87
- @property({ type: String })
88
- apiHost = "";
89
-
90
81
  @provide({ context: playingContext })
91
82
  @property({ type: Boolean, reflect: true })
92
83
  playing = false;
93
84
 
85
+ @provide({ context: loopContext })
94
86
  @property({ type: Boolean, reflect: true })
95
87
  loop = false;
96
88
 
97
89
  @state()
98
- stageScale = 1;
90
+ private stageScale = 1;
99
91
 
100
92
  @property({ type: Boolean })
101
93
  rendering = false;
@@ -110,9 +102,11 @@ export function ContextMixin<T extends Constructor<LitElement>>(superClass: T) {
110
102
  if (this.isConnected && !this.rendering) {
111
103
  const canvasElement = this.canvasRef.value;
112
104
  const stageElement = this.stageRef.value;
113
- if (stageElement && canvasElement) {
105
+ const canvasChild = canvasElement?.assignedElements()[0];
106
+ if (stageElement && canvasElement && canvasChild) {
114
107
  // Determine the appropriate scale factor to make the canvas fit into
115
- // it's parent element.
108
+ canvasElement.style.width = `${canvasChild.clientWidth}px`;
109
+ canvasElement.style.height = `${canvasChild.clientHeight}px`;
116
110
  const stageWidth = stageElement.clientWidth;
117
111
  const stageHeight = stageElement.clientHeight;
118
112
  const canvasWidth = canvasElement.clientWidth;
@@ -123,12 +117,14 @@ export function ContextMixin<T extends Constructor<LitElement>>(superClass: T) {
123
117
  const scale = stageHeight / canvasHeight;
124
118
  if (this.stageScale !== scale) {
125
119
  canvasElement.style.transform = `scale(${scale})`;
120
+ canvasElement.style.transformOrigin = "top";
126
121
  }
127
122
  this.stageScale = scale;
128
123
  } else {
129
124
  const scale = stageWidth / canvasWidth;
130
125
  if (this.stageScale !== scale) {
131
126
  canvasElement.style.transform = `scale(${scale})`;
127
+ canvasElement.style.transformOrigin = "top";
132
128
  }
133
129
  this.stageScale = scale;
134
130
  }
@@ -167,6 +163,14 @@ export function ContextMixin<T extends Constructor<LitElement>>(superClass: T) {
167
163
  return this.querySelector("ef-timegroup");
168
164
  }
169
165
 
166
+ play() {
167
+ this.playing = true;
168
+ }
169
+
170
+ pause() {
171
+ this.playing = false;
172
+ }
173
+
170
174
  #playbackAudioContext: AudioContext | null = null;
171
175
  #playbackAnimationFrameRequest: number | null = null;
172
176
  #AUDIO_PLAYBACK_SLICE_MS = 1000;
@@ -239,7 +243,15 @@ export function ContextMixin<T extends Constructor<LitElement>>(superClass: T) {
239
243
  source.onended = () => {
240
244
  bufferCount--;
241
245
  if (endMs >= toMs) {
242
- this.playing = false;
246
+ this.pause();
247
+ if (this.loop) {
248
+ this.updateComplete.then(() => {
249
+ this.currentTimeMs = 0;
250
+ this.updateComplete.then(() => {
251
+ this.play();
252
+ });
253
+ });
254
+ }
243
255
  } else {
244
256
  fillBuffer();
245
257
  }
@@ -29,7 +29,7 @@ import { TWMixin } from "./TWMixin.ts";
29
29
  import { msToTimeCode } from "../msToTimeCode.ts";
30
30
  import { focusedElementContext } from "./focusedElementContext.ts";
31
31
  import { type FocusContext, focusContext } from "./focusContext.ts";
32
- import { playingContext } from "./playingContext.ts";
32
+ import { playingContext, loopContext } from "./playingContext.ts";
33
33
  import type { EFWorkbench } from "./EFWorkbench.ts";
34
34
  import type { EFPreview } from "./EFPreview.ts";
35
35
 
@@ -513,6 +513,10 @@ export class EFFilmstrip extends TWMixin(LitElement) {
513
513
  @state()
514
514
  playing?: boolean;
515
515
 
516
+ @consume({ context: loopContext, subscribe: true })
517
+ @state()
518
+ loop?: boolean;
519
+
516
520
  timegroupController?: TimegroupController;
517
521
 
518
522
  @state()
@@ -545,12 +549,13 @@ export class EFFilmstrip extends TWMixin(LitElement) {
545
549
  #handleKeyPress = (event: KeyboardEvent) => {
546
550
  // On spacebar, toggle playback
547
551
  if (event.key === " ") {
552
+ const [target] = event.composedPath();
548
553
  // CSS selector to match all interactive elements
549
554
  const interactiveSelector =
550
555
  "input, textarea, button, select, a, [contenteditable]";
551
556
 
552
557
  // Check if the event target or its ancestor matches an interactive element
553
- const closestInteractive = (event.target as HTMLElement | null)?.closest(
558
+ const closestInteractive = (target as HTMLElement | null)?.closest(
554
559
  interactiveSelector,
555
560
  );
556
561
  if (closestInteractive) {
@@ -689,27 +694,8 @@ export class EFFilmstrip extends TWMixin(LitElement) {
689
694
  />
690
695
  <code>${msToTimeCode(this.currentTimeMs, true)} </code> /
691
696
  <code>${msToTimeCode(target?.durationMs ?? 0, true)}</code>
692
- ${
693
- this.playing
694
- ? html`<button
695
- @click=${() => {
696
- if (this.#contextElement) {
697
- this.#contextElement.playing = false;
698
- }
699
- }}
700
- >
701
- ⏸️
702
- </button>`
703
- : html`<button
704
- @click=${() => {
705
- if (this.#contextElement) {
706
- this.#contextElement.playing = true;
707
- }
708
- }}
709
- >
710
- ▶️
711
- </button>`
712
- }
697
+ <ef-toggle-play><button>${this.playing ? "⏸️" : "▶️"}</button></ef-toggle-play>
698
+ <ef-toggle-loop><button>${this.loop ? "🔁" : html`<span class="opacity-50">🔁</span>`}</button></ef-toggle-loop>
713
699
  </div>
714
700
  <div
715
701
  class="z-10 pl-1 pr-1 pt-2 shadow shadow-slate-600 overflow-auto"
@@ -0,0 +1,34 @@
1
+ import { css, html, LitElement } from "lit";
2
+ import { customElement } from "lit/decorators.js";
3
+ import { consume } from "@lit/context";
4
+
5
+ import { efContext } from "./efContext.ts";
6
+ import type { ContextMixinInterface } from "./ContextMixin.ts";
7
+
8
+ @customElement("ef-toggle-loop")
9
+ export class EFToggleLoop extends LitElement {
10
+ static styles = [
11
+ css`
12
+ :host {}
13
+ `,
14
+ ];
15
+
16
+ @consume({ context: efContext })
17
+ context?: ContextMixinInterface | null;
18
+
19
+ render() {
20
+ return html`
21
+ <slot @click=${() => {
22
+ if (this.context) {
23
+ this.context.loop = !this.context.loop;
24
+ }
25
+ }}></slot>
26
+ `;
27
+ }
28
+ }
29
+
30
+ declare global {
31
+ interface HTMLElementTagNameMap {
32
+ "ef-toggle-loop": EFToggleLoop;
33
+ }
34
+ }
@@ -0,0 +1,38 @@
1
+ import { css, html, LitElement } from "lit";
2
+ import { customElement } from "lit/decorators.js";
3
+ import { consume } from "@lit/context";
4
+
5
+ import { efContext } from "./efContext.ts";
6
+ import type { ContextMixinInterface } from "./ContextMixin.ts";
7
+
8
+ @customElement("ef-toggle-play")
9
+ export class EFTogglePlay extends LitElement {
10
+ static styles = [
11
+ css`
12
+ :host {}
13
+ `,
14
+ ];
15
+
16
+ @consume({ context: efContext })
17
+ context?: ContextMixinInterface | null;
18
+
19
+ render() {
20
+ return html`
21
+ <slot @click=${() => {
22
+ if (this.context) {
23
+ if (this.context.playing) {
24
+ this.context.pause();
25
+ } else {
26
+ this.context.play();
27
+ }
28
+ }
29
+ }}></slot>
30
+ `;
31
+ }
32
+ }
33
+
34
+ declare global {
35
+ interface HTMLElementTagNameMap {
36
+ "ef-toggle-play": EFTogglePlay;
37
+ }
38
+ }
@@ -78,20 +78,21 @@ export class EFWorkbench extends ContextMixin(TWMixin(LitElement)) {
78
78
  >
79
79
  <div
80
80
  ${ref(this.stageRef)}
81
- class="relative grid h-full w-full place-content-center place-items-center overflow-hidden"
81
+ class="relative grid h-full w-full justify-center overflow-hidden"
82
82
  @wheel=${this.handleStageWheel}
83
83
  >
84
84
  <slot
85
85
  ${ref(this.canvasRef)}
86
86
  name="canvas"
87
+ class="inline-block"
87
88
  ></slot>
88
89
  <div
89
- class="border border-blue-500 bg-blue-200 bg-opacity-20"
90
+ class="border border-blue-500 bg-blue-200 bg-opacity-20 absolute"
90
91
  ${ref(this.focusOverlay)}
91
92
  ></div>
92
93
  </div>
93
94
 
94
- <slot class="overflow" name="timeline"></slot>
95
+ <slot class="overflow inline-block" name="timeline"></slot>
95
96
  </div>
96
97
  `;
97
98
  }
@@ -0,0 +1,6 @@
1
+ import { createContext } from "@lit/context";
2
+ import type { ContextMixinInterface } from "./ContextMixin.ts";
3
+
4
+ export const efContext = createContext<ContextMixinInterface | null>(
5
+ Symbol("efContext"),
6
+ );
@@ -1,3 +1,5 @@
1
1
  import { createContext } from "@lit/context";
2
2
 
3
3
  export const playingContext = createContext<boolean>(Symbol("playingContext"));
4
+
5
+ export const loopContext = createContext<boolean>(Symbol("loopContext"));