@editframe/elements 0.26.3-beta.0 → 0.30.0-beta.13

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.
Files changed (191) hide show
  1. package/dist/elements/EFSourceMixin.js +1 -1
  2. package/dist/elements/EFSourceMixin.js.map +1 -1
  3. package/dist/elements/EFSurface.d.ts +4 -4
  4. package/dist/elements/EFText.d.ts +52 -0
  5. package/dist/elements/EFText.js +319 -0
  6. package/dist/elements/EFText.js.map +1 -0
  7. package/dist/elements/EFTextSegment.d.ts +30 -0
  8. package/dist/elements/EFTextSegment.js +94 -0
  9. package/dist/elements/EFTextSegment.js.map +1 -0
  10. package/dist/elements/EFThumbnailStrip.d.ts +4 -4
  11. package/dist/elements/EFWaveform.d.ts +4 -4
  12. package/dist/elements/FetchMixin.js +22 -7
  13. package/dist/elements/FetchMixin.js.map +1 -1
  14. package/dist/elements/easingUtils.js +62 -0
  15. package/dist/elements/easingUtils.js.map +1 -0
  16. package/dist/elements/updateAnimations.js +57 -10
  17. package/dist/elements/updateAnimations.js.map +1 -1
  18. package/dist/gui/ContextMixin.js +11 -2
  19. package/dist/gui/ContextMixin.js.map +1 -1
  20. package/dist/gui/EFConfiguration.d.ts +4 -4
  21. package/dist/gui/EFControls.d.ts +2 -2
  22. package/dist/gui/EFDial.d.ts +4 -4
  23. package/dist/gui/EFDial.js +4 -2
  24. package/dist/gui/EFDial.js.map +1 -1
  25. package/dist/gui/EFFilmstrip.d.ts +32 -6
  26. package/dist/gui/EFFilmstrip.js +314 -50
  27. package/dist/gui/EFFilmstrip.js.map +1 -1
  28. package/dist/gui/EFFitScale.js +39 -15
  29. package/dist/gui/EFFitScale.js.map +1 -1
  30. package/dist/gui/EFFocusOverlay.d.ts +4 -4
  31. package/dist/gui/EFPause.d.ts +4 -4
  32. package/dist/gui/EFPlay.d.ts +4 -4
  33. package/dist/gui/EFPreview.d.ts +4 -4
  34. package/dist/gui/EFPreview.js +2 -2
  35. package/dist/gui/EFPreview.js.map +1 -1
  36. package/dist/gui/EFResizableBox.d.ts +4 -4
  37. package/dist/gui/EFResizableBox.js +6 -3
  38. package/dist/gui/EFResizableBox.js.map +1 -1
  39. package/dist/gui/EFScrubber.d.ts +8 -5
  40. package/dist/gui/EFScrubber.js +64 -12
  41. package/dist/gui/EFScrubber.js.map +1 -1
  42. package/dist/gui/EFTimeDisplay.d.ts +4 -4
  43. package/dist/gui/EFToggleLoop.d.ts +4 -4
  44. package/dist/gui/EFTogglePlay.d.ts +4 -4
  45. package/dist/gui/EFWorkbench.d.ts +4 -4
  46. package/dist/gui/EFWorkbench.js +16 -3
  47. package/dist/gui/EFWorkbench.js.map +1 -1
  48. package/dist/gui/TWMixin.js +1 -1
  49. package/dist/gui/TWMixin.js.map +1 -1
  50. package/dist/index.d.ts +3 -1
  51. package/dist/index.js +3 -1
  52. package/dist/index.js.map +1 -1
  53. package/dist/style.css +7 -120
  54. package/package.json +3 -3
  55. package/scripts/build-css.js +5 -9
  56. package/test/constants.ts +8 -0
  57. package/test/recordReplayProxyPlugin.js +76 -10
  58. package/test/setup.ts +32 -0
  59. package/test/useMSW.ts +3 -0
  60. package/test/useTranscodeMSW.ts +191 -0
  61. package/tsdown.config.ts +7 -5
  62. package/types.json +1 -1
  63. package/src/elements/ContextProxiesController.ts +0 -124
  64. package/src/elements/CrossUpdateController.ts +0 -22
  65. package/src/elements/EFAudio.browsertest.ts +0 -706
  66. package/src/elements/EFAudio.ts +0 -56
  67. package/src/elements/EFCaptions.browsertest.ts +0 -1960
  68. package/src/elements/EFCaptions.ts +0 -823
  69. package/src/elements/EFImage.browsertest.ts +0 -120
  70. package/src/elements/EFImage.ts +0 -113
  71. package/src/elements/EFMedia/AssetIdMediaEngine.test.ts +0 -224
  72. package/src/elements/EFMedia/AssetIdMediaEngine.ts +0 -110
  73. package/src/elements/EFMedia/AssetMediaEngine.browsertest.ts +0 -140
  74. package/src/elements/EFMedia/AssetMediaEngine.ts +0 -385
  75. package/src/elements/EFMedia/BaseMediaEngine.browsertest.ts +0 -400
  76. package/src/elements/EFMedia/BaseMediaEngine.ts +0 -505
  77. package/src/elements/EFMedia/BufferedSeekingInput.browsertest.ts +0 -386
  78. package/src/elements/EFMedia/BufferedSeekingInput.ts +0 -430
  79. package/src/elements/EFMedia/JitMediaEngine.browsertest.ts +0 -226
  80. package/src/elements/EFMedia/JitMediaEngine.ts +0 -256
  81. package/src/elements/EFMedia/audioTasks/makeAudioBufferTask.browsertest.ts +0 -679
  82. package/src/elements/EFMedia/audioTasks/makeAudioBufferTask.ts +0 -117
  83. package/src/elements/EFMedia/audioTasks/makeAudioFrequencyAnalysisTask.ts +0 -246
  84. package/src/elements/EFMedia/audioTasks/makeAudioInitSegmentFetchTask.browsertest.ts +0 -59
  85. package/src/elements/EFMedia/audioTasks/makeAudioInitSegmentFetchTask.ts +0 -27
  86. package/src/elements/EFMedia/audioTasks/makeAudioInputTask.browsertest.ts +0 -55
  87. package/src/elements/EFMedia/audioTasks/makeAudioInputTask.ts +0 -53
  88. package/src/elements/EFMedia/audioTasks/makeAudioSeekTask.chunkboundary.regression.browsertest.ts +0 -207
  89. package/src/elements/EFMedia/audioTasks/makeAudioSeekTask.ts +0 -72
  90. package/src/elements/EFMedia/audioTasks/makeAudioSegmentFetchTask.ts +0 -32
  91. package/src/elements/EFMedia/audioTasks/makeAudioSegmentIdTask.ts +0 -29
  92. package/src/elements/EFMedia/audioTasks/makeAudioTasksVideoOnly.browsertest.ts +0 -95
  93. package/src/elements/EFMedia/audioTasks/makeAudioTimeDomainAnalysisTask.ts +0 -184
  94. package/src/elements/EFMedia/shared/AudioSpanUtils.ts +0 -129
  95. package/src/elements/EFMedia/shared/BufferUtils.ts +0 -342
  96. package/src/elements/EFMedia/shared/GlobalInputCache.ts +0 -77
  97. package/src/elements/EFMedia/shared/MediaTaskUtils.ts +0 -44
  98. package/src/elements/EFMedia/shared/PrecisionUtils.ts +0 -46
  99. package/src/elements/EFMedia/shared/RenditionHelpers.browsertest.ts +0 -246
  100. package/src/elements/EFMedia/shared/RenditionHelpers.ts +0 -56
  101. package/src/elements/EFMedia/shared/ThumbnailExtractor.ts +0 -227
  102. package/src/elements/EFMedia/tasks/makeMediaEngineTask.browsertest.ts +0 -167
  103. package/src/elements/EFMedia/tasks/makeMediaEngineTask.ts +0 -88
  104. package/src/elements/EFMedia/videoTasks/MainVideoInputCache.ts +0 -76
  105. package/src/elements/EFMedia/videoTasks/ScrubInputCache.ts +0 -61
  106. package/src/elements/EFMedia/videoTasks/makeScrubVideoBufferTask.ts +0 -114
  107. package/src/elements/EFMedia/videoTasks/makeScrubVideoInitSegmentFetchTask.ts +0 -35
  108. package/src/elements/EFMedia/videoTasks/makeScrubVideoInputTask.ts +0 -52
  109. package/src/elements/EFMedia/videoTasks/makeScrubVideoSeekTask.ts +0 -124
  110. package/src/elements/EFMedia/videoTasks/makeScrubVideoSegmentFetchTask.ts +0 -44
  111. package/src/elements/EFMedia/videoTasks/makeScrubVideoSegmentIdTask.ts +0 -32
  112. package/src/elements/EFMedia/videoTasks/makeUnifiedVideoSeekTask.ts +0 -370
  113. package/src/elements/EFMedia/videoTasks/makeVideoBufferTask.ts +0 -109
  114. package/src/elements/EFMedia.browsertest.ts +0 -872
  115. package/src/elements/EFMedia.ts +0 -341
  116. package/src/elements/EFSourceMixin.ts +0 -60
  117. package/src/elements/EFSurface.browsertest.ts +0 -151
  118. package/src/elements/EFSurface.ts +0 -142
  119. package/src/elements/EFTemporal.browsertest.ts +0 -215
  120. package/src/elements/EFTemporal.ts +0 -800
  121. package/src/elements/EFThumbnailStrip.browsertest.ts +0 -585
  122. package/src/elements/EFThumbnailStrip.media-engine.browsertest.ts +0 -714
  123. package/src/elements/EFThumbnailStrip.ts +0 -906
  124. package/src/elements/EFTimegroup.browsertest.ts +0 -934
  125. package/src/elements/EFTimegroup.ts +0 -882
  126. package/src/elements/EFVideo.browsertest.ts +0 -1482
  127. package/src/elements/EFVideo.ts +0 -564
  128. package/src/elements/EFWaveform.ts +0 -547
  129. package/src/elements/FetchContext.browsertest.ts +0 -401
  130. package/src/elements/FetchMixin.ts +0 -38
  131. package/src/elements/SampleBuffer.ts +0 -94
  132. package/src/elements/TargetController.browsertest.ts +0 -230
  133. package/src/elements/TargetController.ts +0 -224
  134. package/src/elements/TimegroupController.ts +0 -26
  135. package/src/elements/durationConverter.ts +0 -35
  136. package/src/elements/parseTimeToMs.ts +0 -9
  137. package/src/elements/printTaskStatus.ts +0 -16
  138. package/src/elements/renderTemporalAudio.ts +0 -108
  139. package/src/elements/updateAnimations.browsertest.ts +0 -1884
  140. package/src/elements/updateAnimations.ts +0 -217
  141. package/src/elements/util.ts +0 -24
  142. package/src/gui/ContextMixin.browsertest.ts +0 -860
  143. package/src/gui/ContextMixin.ts +0 -562
  144. package/src/gui/Controllable.browsertest.ts +0 -258
  145. package/src/gui/Controllable.ts +0 -41
  146. package/src/gui/EFConfiguration.ts +0 -40
  147. package/src/gui/EFControls.browsertest.ts +0 -389
  148. package/src/gui/EFControls.ts +0 -195
  149. package/src/gui/EFDial.browsertest.ts +0 -84
  150. package/src/gui/EFDial.ts +0 -172
  151. package/src/gui/EFFilmstrip.browsertest.ts +0 -712
  152. package/src/gui/EFFilmstrip.ts +0 -1349
  153. package/src/gui/EFFitScale.ts +0 -152
  154. package/src/gui/EFFocusOverlay.ts +0 -79
  155. package/src/gui/EFPause.browsertest.ts +0 -202
  156. package/src/gui/EFPause.ts +0 -73
  157. package/src/gui/EFPlay.browsertest.ts +0 -202
  158. package/src/gui/EFPlay.ts +0 -73
  159. package/src/gui/EFPreview.ts +0 -74
  160. package/src/gui/EFResizableBox.browsertest.ts +0 -79
  161. package/src/gui/EFResizableBox.ts +0 -898
  162. package/src/gui/EFScrubber.ts +0 -151
  163. package/src/gui/EFTimeDisplay.browsertest.ts +0 -237
  164. package/src/gui/EFTimeDisplay.ts +0 -55
  165. package/src/gui/EFToggleLoop.ts +0 -35
  166. package/src/gui/EFTogglePlay.ts +0 -70
  167. package/src/gui/EFWorkbench.ts +0 -115
  168. package/src/gui/PlaybackController.ts +0 -527
  169. package/src/gui/TWMixin.css +0 -6
  170. package/src/gui/TWMixin.ts +0 -61
  171. package/src/gui/TargetOrContextMixin.ts +0 -185
  172. package/src/gui/currentTimeContext.ts +0 -5
  173. package/src/gui/durationContext.ts +0 -3
  174. package/src/gui/efContext.ts +0 -6
  175. package/src/gui/fetchContext.ts +0 -5
  176. package/src/gui/focusContext.ts +0 -7
  177. package/src/gui/focusedElementContext.ts +0 -5
  178. package/src/gui/playingContext.ts +0 -5
  179. package/src/otel/BridgeSpanExporter.ts +0 -150
  180. package/src/otel/setupBrowserTracing.ts +0 -73
  181. package/src/otel/tracingHelpers.ts +0 -251
  182. package/src/transcoding/cache/RequestDeduplicator.test.ts +0 -170
  183. package/src/transcoding/cache/RequestDeduplicator.ts +0 -65
  184. package/src/transcoding/cache/URLTokenDeduplicator.test.ts +0 -182
  185. package/src/transcoding/cache/URLTokenDeduplicator.ts +0 -101
  186. package/src/transcoding/types/index.ts +0 -312
  187. package/src/transcoding/utils/MediaUtils.ts +0 -63
  188. package/src/transcoding/utils/UrlGenerator.ts +0 -68
  189. package/src/transcoding/utils/constants.ts +0 -36
  190. package/src/utils/LRUCache.test.ts +0 -274
  191. package/src/utils/LRUCache.ts +0 -696
package/test/setup.ts CHANGED
@@ -9,6 +9,38 @@ import {
9
9
  mediaCache,
10
10
  } from "../src/elements/EFMedia/BaseMediaEngine.js";
11
11
  import { globalURLTokenDeduplicator } from "../src/transcoding/cache/URLTokenDeduplicator.js";
12
+ import { TEST_SERVER_PORT } from "./constants.js";
13
+
14
+ /**
15
+ * Get the correct API host for the current environment.
16
+ * In local dev with Traefik, returns the Traefik URL (e.g., http://main.localhost:4322).
17
+ * In CI or direct access, returns the current location (e.g., http://localhost:63315).
18
+ */
19
+ export function getApiHost(): string {
20
+ const host = window.location.host;
21
+ const protocol = window.location.protocol;
22
+
23
+ // Check if CI mode was injected by server
24
+ const isCI = (window as any).__CI_MODE__ === true;
25
+
26
+ if (isCI) {
27
+ // CI mode: always use localhost directly
28
+ return `${protocol}//${host}`;
29
+ }
30
+
31
+ if (host === `localhost:${TEST_SERVER_PORT}`) {
32
+ // Check if we have a Traefik referrer (local dev)
33
+ const traefikReferrer = document.referrer.match(/\/\/([^:]+):4322/)?.[1];
34
+ if (traefikReferrer) {
35
+ // Local dev: use Traefik URL
36
+ return `${protocol}//${traefikReferrer}:4322`;
37
+ }
38
+ // No Traefik referrer but not explicitly CI: use localhost directly
39
+ return `${protocol}//${host}`;
40
+ }
41
+ // Already on Traefik URL or other configuration
42
+ return `${protocol}//${host}`;
43
+ }
12
44
 
13
45
  // Clear global caches before each test to ensure isolation
14
46
  beforeEach(() => {
package/test/useMSW.ts CHANGED
@@ -5,6 +5,7 @@
5
5
 
6
6
  import { setupWorker } from "msw/browser";
7
7
  import { test as testBase } from "vitest";
8
+ import { transcodeMSWHandlers } from "./useTranscodeMSW.js";
8
9
 
9
10
  // Create the worker instance that will be shared across tests
10
11
  const worker = setupWorker();
@@ -26,6 +27,8 @@ export const test = testBase.extend<{
26
27
  await worker.start({
27
28
  onUnhandledRequest: "bypass", // Allow unhandled requests to pass through
28
29
  });
30
+ // Set up default handlers for transcode API endpoints
31
+ worker.use(...transcodeMSWHandlers);
29
32
  workerStarted = true;
30
33
  }
31
34
 
@@ -0,0 +1,191 @@
1
+ /**
2
+ * Transcode API MSW handlers for testing
3
+ * Provides handlers for transcode API endpoints including URL signing
4
+ */
5
+
6
+ import { HttpResponse, http } from "msw";
7
+
8
+ /**
9
+ * MSW handlers for transcode API endpoints
10
+ * These handlers mock the API responses needed for tests
11
+ */
12
+ export const transcodeMSWHandlers = [
13
+ // URL signing endpoint handler
14
+ // This mocks the /@ef-sign-url endpoint used by the Vite plugin
15
+ http.post("/@ef-sign-url", async () => {
16
+ // Return a mock JWT token
17
+ // The token format is: header.payload.signature
18
+ // We create a simple mock token that will pass basic validation
19
+ const mockToken =
20
+ "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1cmwiOiJodHRwOi8vd2ViOjMwMDAvaGVhZC1tb292LTQ4MHAubXA0IiwiZXhwIjo5OTk5OTk5OTk5fQ.mock-signature";
21
+
22
+ return HttpResponse.json(
23
+ { token: mockToken },
24
+ {
25
+ status: 200,
26
+ headers: {
27
+ "Content-Type": "application/json",
28
+ },
29
+ },
30
+ );
31
+ }),
32
+
33
+ // URL token endpoint handler (for proxied requests from vite plugin)
34
+ // The vite plugin proxies /@ef-sign-url to /api/v1/url-token
35
+ http.post("/api/v1/url-token", async () => {
36
+ // Return the same mock JWT token as /@ef-sign-url
37
+ const mockToken =
38
+ "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1cmwiOiJodHRwOi8vd2ViOjMwMDAvaGVhZC1tb292LTQ4MHAubXA0IiwiZXhwIjo5OTk5OTk5OTk5fQ.mock-signature";
39
+
40
+ return HttpResponse.json(
41
+ { token: mockToken },
42
+ {
43
+ status: 200,
44
+ headers: {
45
+ "Content-Type": "application/json",
46
+ },
47
+ },
48
+ );
49
+ }),
50
+
51
+ // Transcode manifest endpoint handler
52
+ // This mocks the manifest.json endpoint used by JitMediaEngine
53
+ http.get("/api/v1/transcode/manifest.json", async ({ request }) => {
54
+ const url = new URL(request.url);
55
+ const sourceUrl = url.searchParams.get("url");
56
+
57
+ if (!sourceUrl) {
58
+ return HttpResponse.json(
59
+ { error: "url parameter is required" },
60
+ { status: 400 },
61
+ );
62
+ }
63
+
64
+ // Return a mock manifest response
65
+ const manifest = {
66
+ version: "1.0",
67
+ type: "cmaf",
68
+ duration: 10,
69
+ durationMs: 10000,
70
+ segmentDuration: 2000,
71
+ baseUrl: `${url.origin}/api/v1/transcode`,
72
+ sourceUrl: sourceUrl,
73
+ audioRenditions: [
74
+ {
75
+ id: "audio",
76
+ src: sourceUrl,
77
+ segmentDurationMs: 2000,
78
+ },
79
+ ],
80
+ videoRenditions: [
81
+ {
82
+ id: "high",
83
+ src: sourceUrl,
84
+ segmentDurationMs: 2000,
85
+ },
86
+ ],
87
+ endpoints: {
88
+ initSegment: `${url.origin}/api/v1/transcode/{rendition}/init.m4s?url=${encodeURIComponent(sourceUrl)}`,
89
+ mediaSegment: `${url.origin}/api/v1/transcode/{rendition}/{segmentId}.m4s?url=${encodeURIComponent(sourceUrl)}`,
90
+ },
91
+ jitInfo: {
92
+ parallelTranscodingSupported: true,
93
+ expectedTranscodeLatency: 1000,
94
+ segmentCount: 5,
95
+ },
96
+ };
97
+
98
+ return HttpResponse.json(manifest, {
99
+ status: 200,
100
+ headers: {
101
+ "Content-Type": "application/json",
102
+ },
103
+ });
104
+ }),
105
+
106
+ // Transcode init segment endpoint handler
107
+ http.get("/api/v1/transcode/:rendition/init.m4s", async () => {
108
+ // Return a minimal valid MP4 init segment
109
+ // This is a very basic ftyp + moov box structure
110
+ const initSegment = new Uint8Array([
111
+ // ftyp box
112
+ 0x00,
113
+ 0x00,
114
+ 0x00,
115
+ 0x20, // box size
116
+ 0x66,
117
+ 0x74,
118
+ 0x79,
119
+ 0x70, // 'ftyp'
120
+ 0x69,
121
+ 0x73,
122
+ 0x6f,
123
+ 0x6d, // major brand 'isom'
124
+ 0x00,
125
+ 0x00,
126
+ 0x02,
127
+ 0x00, // minor version
128
+ 0x69,
129
+ 0x73,
130
+ 0x6f,
131
+ 0x6d, // compatible brand 'isom'
132
+ 0x69,
133
+ 0x73,
134
+ 0x6f,
135
+ 0x32, // compatible brand 'iso2'
136
+ 0x6d,
137
+ 0x70,
138
+ 0x34,
139
+ 0x31, // compatible brand 'mp41'
140
+ // moov box (minimal)
141
+ 0x00,
142
+ 0x00,
143
+ 0x00,
144
+ 0x08, // box size
145
+ 0x6d,
146
+ 0x6f,
147
+ 0x6f,
148
+ 0x76, // 'moov'
149
+ ]);
150
+
151
+ return HttpResponse.arrayBuffer(initSegment.buffer, {
152
+ status: 200,
153
+ headers: {
154
+ "Content-Type": "video/mp4",
155
+ },
156
+ });
157
+ }),
158
+
159
+ // Transcode media segment endpoint handler
160
+ http.get("/api/v1/transcode/:rendition/:segmentId.m4s", async () => {
161
+ // Return a minimal valid MP4 media segment
162
+ // This is a very basic moof + mdat box structure
163
+ const mediaSegment = new Uint8Array([
164
+ // moof box (minimal)
165
+ 0x00,
166
+ 0x00,
167
+ 0x00,
168
+ 0x08, // box size
169
+ 0x6d,
170
+ 0x6f,
171
+ 0x6f,
172
+ 0x66, // 'moof'
173
+ // mdat box (minimal)
174
+ 0x00,
175
+ 0x00,
176
+ 0x00,
177
+ 0x08, // box size
178
+ 0x6d,
179
+ 0x64,
180
+ 0x61,
181
+ 0x74, // 'mdat'
182
+ ]);
183
+
184
+ return HttpResponse.arrayBuffer(mediaSegment.buffer, {
185
+ status: 200,
186
+ headers: {
187
+ "Content-Type": "video/mp4",
188
+ },
189
+ });
190
+ }),
191
+ ];
package/tsdown.config.ts CHANGED
@@ -16,7 +16,7 @@ const inlineCssPlugin = (): Plugin => ({
16
16
  path.dirname(importer),
17
17
  source.replace("?inline", ""),
18
18
  );
19
- return { id: resolved + "?inline", external: false };
19
+ return { id: `${resolved}?inline`, external: false };
20
20
  }
21
21
  return null;
22
22
  },
@@ -27,11 +27,13 @@ const inlineCssPlugin = (): Plugin => ({
27
27
 
28
28
  // Process through Tailwind if it contains @tailwind directives
29
29
  if (css.includes("@tailwind")) {
30
- const srcDir = path.resolve(path.dirname(filePath));
30
+ const _srcDir = path.resolve(path.dirname(filePath));
31
+ const configPath = path.resolve(
32
+ path.dirname(filePath),
33
+ "../../tailwind.config.ts",
34
+ );
31
35
  const result = await postcss([
32
- tailwindcss({
33
- content: [path.join(srcDir, "**/*.ts")],
34
- }),
36
+ tailwindcss({ config: configPath }),
35
37
  autoprefixer(),
36
38
  ]).process(css, { from: filePath });
37
39