@editframe/elements 0.20.4-beta.0 → 0.23.6-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (183) hide show
  1. package/dist/DelayedLoadingState.js +0 -27
  2. package/dist/EF_FRAMEGEN.d.ts +5 -3
  3. package/dist/EF_FRAMEGEN.js +49 -11
  4. package/dist/_virtual/_@oxc-project_runtime@0.94.0/helpers/decorate.js +7 -0
  5. package/dist/attachContextRoot.d.ts +1 -0
  6. package/dist/attachContextRoot.js +9 -0
  7. package/dist/elements/ContextProxiesController.d.ts +1 -2
  8. package/dist/elements/EFAudio.js +5 -9
  9. package/dist/elements/EFCaptions.d.ts +1 -3
  10. package/dist/elements/EFCaptions.js +112 -129
  11. package/dist/elements/EFImage.js +6 -7
  12. package/dist/elements/EFMedia/AssetIdMediaEngine.js +2 -5
  13. package/dist/elements/EFMedia/AssetMediaEngine.js +36 -33
  14. package/dist/elements/EFMedia/BaseMediaEngine.js +57 -73
  15. package/dist/elements/EFMedia/BufferedSeekingInput.d.ts +1 -1
  16. package/dist/elements/EFMedia/BufferedSeekingInput.js +134 -78
  17. package/dist/elements/EFMedia/JitMediaEngine.js +9 -19
  18. package/dist/elements/EFMedia/audioTasks/makeAudioBufferTask.js +7 -13
  19. package/dist/elements/EFMedia/audioTasks/makeAudioFrequencyAnalysisTask.js +2 -3
  20. package/dist/elements/EFMedia/audioTasks/makeAudioInitSegmentFetchTask.js +1 -1
  21. package/dist/elements/EFMedia/audioTasks/makeAudioInputTask.js +6 -5
  22. package/dist/elements/EFMedia/audioTasks/makeAudioSeekTask.js +1 -3
  23. package/dist/elements/EFMedia/audioTasks/makeAudioSegmentFetchTask.js +1 -1
  24. package/dist/elements/EFMedia/audioTasks/makeAudioSegmentIdTask.js +1 -1
  25. package/dist/elements/EFMedia/audioTasks/makeAudioTimeDomainAnalysisTask.js +1 -1
  26. package/dist/elements/EFMedia/shared/AudioSpanUtils.js +9 -25
  27. package/dist/elements/EFMedia/shared/BufferUtils.js +2 -17
  28. package/dist/elements/EFMedia/shared/GlobalInputCache.js +0 -24
  29. package/dist/elements/EFMedia/shared/PrecisionUtils.js +0 -21
  30. package/dist/elements/EFMedia/shared/ThumbnailExtractor.js +0 -17
  31. package/dist/elements/EFMedia/tasks/makeMediaEngineTask.js +1 -10
  32. package/dist/elements/EFMedia/videoTasks/MainVideoInputCache.d.ts +29 -0
  33. package/dist/elements/EFMedia/videoTasks/MainVideoInputCache.js +32 -0
  34. package/dist/elements/EFMedia/videoTasks/ScrubInputCache.js +1 -15
  35. package/dist/elements/EFMedia/videoTasks/makeScrubVideoBufferTask.js +1 -7
  36. package/dist/elements/EFMedia/videoTasks/makeScrubVideoInputTask.js +8 -5
  37. package/dist/elements/EFMedia/videoTasks/makeScrubVideoSeekTask.js +12 -13
  38. package/dist/elements/EFMedia/videoTasks/makeScrubVideoSegmentIdTask.js +1 -1
  39. package/dist/elements/EFMedia/videoTasks/makeUnifiedVideoSeekTask.js +134 -70
  40. package/dist/elements/EFMedia/videoTasks/makeVideoBufferTask.js +11 -18
  41. package/dist/elements/EFMedia.d.ts +19 -0
  42. package/dist/elements/EFMedia.js +44 -25
  43. package/dist/elements/EFSourceMixin.js +5 -7
  44. package/dist/elements/EFSurface.js +6 -9
  45. package/dist/elements/EFTemporal.browsertest.d.ts +11 -0
  46. package/dist/elements/EFTemporal.d.ts +10 -0
  47. package/dist/elements/EFTemporal.js +100 -41
  48. package/dist/elements/EFThumbnailStrip.js +23 -73
  49. package/dist/elements/EFTimegroup.browsertest.d.ts +3 -3
  50. package/dist/elements/EFTimegroup.d.ts +35 -14
  51. package/dist/elements/EFTimegroup.js +138 -181
  52. package/dist/elements/EFVideo.d.ts +16 -2
  53. package/dist/elements/EFVideo.js +156 -108
  54. package/dist/elements/EFWaveform.js +23 -40
  55. package/dist/elements/SampleBuffer.js +3 -7
  56. package/dist/elements/TargetController.js +5 -5
  57. package/dist/elements/durationConverter.js +4 -4
  58. package/dist/elements/renderTemporalAudio.d.ts +10 -0
  59. package/dist/elements/renderTemporalAudio.js +35 -0
  60. package/dist/elements/updateAnimations.js +19 -43
  61. package/dist/gui/ContextMixin.d.ts +5 -5
  62. package/dist/gui/ContextMixin.js +167 -162
  63. package/dist/gui/Controllable.browsertest.d.ts +0 -0
  64. package/dist/gui/Controllable.d.ts +15 -0
  65. package/dist/gui/Controllable.js +9 -0
  66. package/dist/gui/EFConfiguration.js +7 -7
  67. package/dist/gui/EFControls.browsertest.d.ts +11 -0
  68. package/dist/gui/EFControls.d.ts +18 -4
  69. package/dist/gui/EFControls.js +70 -28
  70. package/dist/gui/EFDial.browsertest.d.ts +0 -0
  71. package/dist/gui/EFDial.d.ts +18 -0
  72. package/dist/gui/EFDial.js +141 -0
  73. package/dist/gui/EFFilmstrip.browsertest.d.ts +11 -0
  74. package/dist/gui/EFFilmstrip.d.ts +12 -2
  75. package/dist/gui/EFFilmstrip.js +214 -129
  76. package/dist/gui/EFFitScale.js +5 -8
  77. package/dist/gui/EFFocusOverlay.js +4 -4
  78. package/dist/gui/EFPause.browsertest.d.ts +0 -0
  79. package/dist/gui/EFPause.d.ts +23 -0
  80. package/dist/gui/EFPause.js +59 -0
  81. package/dist/gui/EFPlay.browsertest.d.ts +0 -0
  82. package/dist/gui/EFPlay.d.ts +23 -0
  83. package/dist/gui/EFPlay.js +59 -0
  84. package/dist/gui/EFPreview.d.ts +4 -0
  85. package/dist/gui/EFPreview.js +18 -9
  86. package/dist/gui/EFResizableBox.browsertest.d.ts +0 -0
  87. package/dist/gui/EFResizableBox.d.ts +34 -0
  88. package/dist/gui/EFResizableBox.js +547 -0
  89. package/dist/gui/EFScrubber.d.ts +9 -3
  90. package/dist/gui/EFScrubber.js +13 -13
  91. package/dist/gui/EFTimeDisplay.d.ts +7 -1
  92. package/dist/gui/EFTimeDisplay.js +8 -8
  93. package/dist/gui/EFToggleLoop.d.ts +9 -3
  94. package/dist/gui/EFToggleLoop.js +7 -5
  95. package/dist/gui/EFTogglePlay.d.ts +12 -4
  96. package/dist/gui/EFTogglePlay.js +26 -21
  97. package/dist/gui/EFWorkbench.js +5 -5
  98. package/dist/gui/PlaybackController.d.ts +67 -0
  99. package/dist/gui/PlaybackController.js +310 -0
  100. package/dist/gui/TWMixin.js +1 -1
  101. package/dist/gui/TWMixin2.js +1 -1
  102. package/dist/gui/TargetOrContextMixin.d.ts +10 -0
  103. package/dist/gui/TargetOrContextMixin.js +98 -0
  104. package/dist/gui/efContext.d.ts +2 -2
  105. package/dist/index.d.ts +5 -0
  106. package/dist/index.js +5 -1
  107. package/dist/otel/BridgeSpanExporter.d.ts +13 -0
  108. package/dist/otel/BridgeSpanExporter.js +87 -0
  109. package/dist/otel/setupBrowserTracing.d.ts +12 -0
  110. package/dist/otel/setupBrowserTracing.js +32 -0
  111. package/dist/otel/tracingHelpers.d.ts +34 -0
  112. package/dist/otel/tracingHelpers.js +112 -0
  113. package/dist/style.css +1 -1
  114. package/dist/transcoding/cache/RequestDeduplicator.js +0 -21
  115. package/dist/transcoding/cache/URLTokenDeduplicator.js +1 -21
  116. package/dist/transcoding/utils/UrlGenerator.js +2 -19
  117. package/dist/utils/LRUCache.js +6 -53
  118. package/package.json +13 -5
  119. package/src/elements/ContextProxiesController.ts +10 -10
  120. package/src/elements/EFAudio.ts +1 -0
  121. package/src/elements/EFCaptions.browsertest.ts +128 -56
  122. package/src/elements/EFCaptions.ts +60 -34
  123. package/src/elements/EFImage.browsertest.ts +1 -2
  124. package/src/elements/EFMedia/AssetMediaEngine.ts +65 -37
  125. package/src/elements/EFMedia/BaseMediaEngine.ts +110 -52
  126. package/src/elements/EFMedia/BufferedSeekingInput.ts +218 -101
  127. package/src/elements/EFMedia/JitMediaEngine.browsertest.ts +3 -0
  128. package/src/elements/EFMedia/audioTasks/makeAudioInputTask.ts +7 -3
  129. package/src/elements/EFMedia/audioTasks/makeAudioSeekTask.chunkboundary.regression.browsertest.ts +1 -1
  130. package/src/elements/EFMedia/videoTasks/MainVideoInputCache.ts +76 -0
  131. package/src/elements/EFMedia/videoTasks/makeScrubVideoInputTask.ts +16 -10
  132. package/src/elements/EFMedia/videoTasks/makeScrubVideoSeekTask.ts +7 -1
  133. package/src/elements/EFMedia/videoTasks/makeUnifiedVideoSeekTask.ts +222 -116
  134. package/src/elements/EFMedia.browsertest.ts +8 -15
  135. package/src/elements/EFMedia.ts +54 -8
  136. package/src/elements/EFSurface.browsertest.ts +2 -6
  137. package/src/elements/EFSurface.ts +1 -0
  138. package/src/elements/EFTemporal.browsertest.ts +58 -1
  139. package/src/elements/EFTemporal.ts +140 -4
  140. package/src/elements/EFThumbnailStrip.browsertest.ts +2 -8
  141. package/src/elements/EFThumbnailStrip.ts +1 -0
  142. package/src/elements/EFTimegroup.browsertest.ts +16 -15
  143. package/src/elements/EFTimegroup.ts +281 -275
  144. package/src/elements/EFVideo.browsertest.ts +162 -74
  145. package/src/elements/EFVideo.ts +229 -101
  146. package/src/elements/FetchContext.browsertest.ts +7 -2
  147. package/src/elements/TargetController.browsertest.ts +1 -0
  148. package/src/elements/TargetController.ts +1 -0
  149. package/src/elements/renderTemporalAudio.ts +108 -0
  150. package/src/elements/updateAnimations.browsertest.ts +181 -6
  151. package/src/elements/updateAnimations.ts +6 -6
  152. package/src/gui/ContextMixin.browsertest.ts +274 -27
  153. package/src/gui/ContextMixin.ts +230 -175
  154. package/src/gui/Controllable.browsertest.ts +258 -0
  155. package/src/gui/Controllable.ts +41 -0
  156. package/src/gui/EFControls.browsertest.ts +294 -80
  157. package/src/gui/EFControls.ts +139 -28
  158. package/src/gui/EFDial.browsertest.ts +84 -0
  159. package/src/gui/EFDial.ts +172 -0
  160. package/src/gui/EFFilmstrip.browsertest.ts +712 -0
  161. package/src/gui/EFFilmstrip.ts +213 -23
  162. package/src/gui/EFPause.browsertest.ts +202 -0
  163. package/src/gui/EFPause.ts +73 -0
  164. package/src/gui/EFPlay.browsertest.ts +202 -0
  165. package/src/gui/EFPlay.ts +73 -0
  166. package/src/gui/EFPreview.ts +20 -5
  167. package/src/gui/EFResizableBox.browsertest.ts +79 -0
  168. package/src/gui/EFResizableBox.ts +898 -0
  169. package/src/gui/EFScrubber.ts +7 -5
  170. package/src/gui/EFTimeDisplay.browsertest.ts +19 -19
  171. package/src/gui/EFTimeDisplay.ts +3 -1
  172. package/src/gui/EFToggleLoop.ts +6 -5
  173. package/src/gui/EFTogglePlay.ts +30 -23
  174. package/src/gui/PlaybackController.ts +522 -0
  175. package/src/gui/TWMixin.css +3 -0
  176. package/src/gui/TargetOrContextMixin.ts +185 -0
  177. package/src/gui/efContext.ts +2 -2
  178. package/src/otel/BridgeSpanExporter.ts +150 -0
  179. package/src/otel/setupBrowserTracing.ts +73 -0
  180. package/src/otel/tracingHelpers.ts +251 -0
  181. package/test/cache-integration-verification.browsertest.ts +1 -1
  182. package/types.json +1 -1
  183. package/dist/elements/ContextProxiesController.js +0 -69
@@ -0,0 +1,547 @@
1
+ import { __decorate } from "../_virtual/_@oxc-project_runtime@0.94.0/helpers/decorate.js";
2
+ import { LitElement, css, html } from "lit";
3
+ import { customElement, property, state } from "lit/decorators.js";
4
+ import { styleMap } from "lit/directives/style-map.js";
5
+ var DEFAULT_MIN_SIZE = 10;
6
+ var CENTER_RESIZE_MULTIPLIER = 2;
7
+ function constrainMovementDeltas(initialBounds, deltaX, deltaY, container) {
8
+ const maxLeftMovement = -initialBounds.x;
9
+ const maxRightMovement = container.width - (initialBounds.x + initialBounds.width);
10
+ const maxUpMovement = -initialBounds.y;
11
+ const maxDownMovement = container.height - (initialBounds.y + initialBounds.height);
12
+ return {
13
+ deltaX: Math.max(maxLeftMovement, Math.min(maxRightMovement, deltaX)),
14
+ deltaY: Math.max(maxUpMovement, Math.min(maxDownMovement, deltaY))
15
+ };
16
+ }
17
+ function calculateNormalResize(context, handle) {
18
+ const { initialBounds, movement } = context;
19
+ const { deltaX, deltaY } = movement;
20
+ switch (handle) {
21
+ case "bottom-right": return {
22
+ ...initialBounds,
23
+ width: initialBounds.width + deltaX,
24
+ height: initialBounds.height + deltaY
25
+ };
26
+ case "top-left": {
27
+ const rightEdge = initialBounds.x + initialBounds.width;
28
+ const bottomEdge = initialBounds.y + initialBounds.height;
29
+ const newX = initialBounds.x + deltaX;
30
+ const newY = initialBounds.y + deltaY;
31
+ return {
32
+ x: newX,
33
+ y: newY,
34
+ width: rightEdge - newX,
35
+ height: bottomEdge - newY
36
+ };
37
+ }
38
+ case "top-right": {
39
+ const bottomEdge = initialBounds.y + initialBounds.height;
40
+ const newY = initialBounds.y + deltaY;
41
+ return {
42
+ ...initialBounds,
43
+ y: newY,
44
+ width: initialBounds.width + deltaX,
45
+ height: bottomEdge - newY
46
+ };
47
+ }
48
+ case "bottom-left": {
49
+ const rightEdge = initialBounds.x + initialBounds.width;
50
+ const newX = initialBounds.x + deltaX;
51
+ return {
52
+ ...initialBounds,
53
+ x: newX,
54
+ width: rightEdge - newX,
55
+ height: initialBounds.height + deltaY
56
+ };
57
+ }
58
+ case "top": {
59
+ const bottomEdge = initialBounds.y + initialBounds.height;
60
+ const newY = initialBounds.y + deltaY;
61
+ return {
62
+ ...initialBounds,
63
+ y: newY,
64
+ height: bottomEdge - newY
65
+ };
66
+ }
67
+ case "right": return {
68
+ ...initialBounds,
69
+ width: initialBounds.width + deltaX
70
+ };
71
+ case "bottom": return {
72
+ ...initialBounds,
73
+ height: initialBounds.height + deltaY
74
+ };
75
+ case "left": {
76
+ const rightEdge = initialBounds.x + initialBounds.width;
77
+ const newX = initialBounds.x + deltaX;
78
+ return {
79
+ ...initialBounds,
80
+ x: newX,
81
+ width: rightEdge - newX
82
+ };
83
+ }
84
+ default: return initialBounds;
85
+ }
86
+ }
87
+ function calculateAspectRatioResize(context, handle) {
88
+ const { initialBounds, movement, constraints } = context;
89
+ const { deltaX, deltaY } = movement;
90
+ if (!constraints.aspectRatio) return initialBounds;
91
+ const aspectRatio = constraints.aspectRatio;
92
+ const widthMovement = deltaX;
93
+ const heightMovement = deltaY * aspectRatio;
94
+ let movementValue;
95
+ switch (handle) {
96
+ case "bottom-right":
97
+ case "top-left":
98
+ movementValue = (widthMovement + heightMovement) / 2;
99
+ break;
100
+ case "top-right":
101
+ case "bottom-left":
102
+ movementValue = (widthMovement - heightMovement) / 2;
103
+ break;
104
+ default: movementValue = widthMovement;
105
+ }
106
+ const baseWidth = handle === "top-left" || handle === "bottom-left" ? initialBounds.width - movementValue : initialBounds.width + movementValue;
107
+ const width = Math.max(constraints.minSize, baseWidth);
108
+ const height = width / aspectRatio;
109
+ const newBounds = {
110
+ ...initialBounds,
111
+ width,
112
+ height
113
+ };
114
+ switch (handle) {
115
+ case "top-left":
116
+ newBounds.x = initialBounds.x + initialBounds.width - width;
117
+ newBounds.y = initialBounds.y + initialBounds.height - height;
118
+ break;
119
+ case "top-right":
120
+ newBounds.y = initialBounds.y + initialBounds.height - height;
121
+ break;
122
+ case "bottom-left":
123
+ newBounds.x = initialBounds.x + initialBounds.width - width;
124
+ break;
125
+ }
126
+ return newBounds;
127
+ }
128
+ function calculateCenterResize(context, handle) {
129
+ const { initialBounds, movement } = context;
130
+ const { deltaX, deltaY } = movement;
131
+ const centerX = initialBounds.x + initialBounds.width / 2;
132
+ const centerY = initialBounds.y + initialBounds.height / 2;
133
+ let widthChange = 0;
134
+ let heightChange = 0;
135
+ switch (handle) {
136
+ case "bottom-right":
137
+ widthChange = deltaX * CENTER_RESIZE_MULTIPLIER;
138
+ heightChange = deltaY * CENTER_RESIZE_MULTIPLIER;
139
+ break;
140
+ case "top-left":
141
+ widthChange = -deltaX * CENTER_RESIZE_MULTIPLIER;
142
+ heightChange = -deltaY * CENTER_RESIZE_MULTIPLIER;
143
+ break;
144
+ case "top-right":
145
+ widthChange = deltaX * CENTER_RESIZE_MULTIPLIER;
146
+ heightChange = -deltaY * CENTER_RESIZE_MULTIPLIER;
147
+ break;
148
+ case "bottom-left":
149
+ widthChange = -deltaX * CENTER_RESIZE_MULTIPLIER;
150
+ heightChange = deltaY * CENTER_RESIZE_MULTIPLIER;
151
+ break;
152
+ case "top":
153
+ case "bottom":
154
+ heightChange = (handle === "bottom" ? deltaY : -deltaY) * CENTER_RESIZE_MULTIPLIER;
155
+ break;
156
+ case "left":
157
+ case "right":
158
+ widthChange = (handle === "right" ? deltaX : -deltaX) * CENTER_RESIZE_MULTIPLIER;
159
+ break;
160
+ }
161
+ const newWidth = initialBounds.width + widthChange;
162
+ const newHeight = initialBounds.height + heightChange;
163
+ return {
164
+ x: centerX - newWidth / 2,
165
+ y: centerY - newHeight / 2,
166
+ width: newWidth,
167
+ height: newHeight
168
+ };
169
+ }
170
+ function calculateCenterResizeWithAspectRatio(context, handle) {
171
+ const { initialBounds, movement, constraints } = context;
172
+ const { deltaX, deltaY } = movement;
173
+ if (!constraints.aspectRatio) return initialBounds;
174
+ const aspectRatio = constraints.aspectRatio;
175
+ const centerX = initialBounds.x + initialBounds.width / 2;
176
+ const centerY = initialBounds.y + initialBounds.height / 2;
177
+ let movementValue;
178
+ switch (handle) {
179
+ case "bottom-right":
180
+ movementValue = Math.max(deltaX, deltaY);
181
+ break;
182
+ case "top-left":
183
+ movementValue = -Math.max(-deltaX, -deltaY);
184
+ break;
185
+ case "top-right":
186
+ movementValue = Math.max(deltaX, -deltaY);
187
+ break;
188
+ case "bottom-left":
189
+ movementValue = Math.max(-deltaX, deltaY);
190
+ break;
191
+ case "top":
192
+ case "bottom":
193
+ movementValue = handle === "bottom" ? deltaY : -deltaY;
194
+ break;
195
+ case "left":
196
+ case "right":
197
+ movementValue = handle === "right" ? deltaX : -deltaX;
198
+ break;
199
+ default: movementValue = Math.max(deltaX, deltaY);
200
+ }
201
+ const newWidth = Math.max(constraints.minSize, initialBounds.width + movementValue * CENTER_RESIZE_MULTIPLIER);
202
+ const newHeight = newWidth / aspectRatio;
203
+ return {
204
+ x: centerX - newWidth / 2,
205
+ y: centerY - newHeight / 2,
206
+ width: newWidth,
207
+ height: newHeight
208
+ };
209
+ }
210
+ var EFResizableBox = class EFResizableBox$1 extends LitElement {
211
+ constructor(..._args) {
212
+ super(..._args);
213
+ this.bounds = {
214
+ x: 0,
215
+ y: 0,
216
+ width: 100,
217
+ height: 100
218
+ };
219
+ this.containerWidth = 0;
220
+ this.containerHeight = 0;
221
+ this.minSize = DEFAULT_MIN_SIZE;
222
+ this.isDragging = false;
223
+ this.dragMode = null;
224
+ this.interaction = null;
225
+ this.modifiers = {
226
+ shift: false,
227
+ alt: false
228
+ };
229
+ this.handlePointerMove = (e) => {
230
+ if (!this.isDragging || !this.interaction || e.pointerId !== this.interaction.pointerId) return;
231
+ const deltaX = e.clientX - this.interaction.startPoint.x;
232
+ const deltaY = e.clientY - this.interaction.startPoint.y;
233
+ this.modifiers = {
234
+ shift: e.shiftKey,
235
+ alt: e.altKey
236
+ };
237
+ if (this.dragMode === "move") {
238
+ const constrainedMovement = constrainMovementDeltas(this.interaction.initialBounds, deltaX, deltaY, {
239
+ width: this.containerWidth,
240
+ height: this.containerHeight
241
+ });
242
+ this.bounds = {
243
+ ...this.interaction.initialBounds,
244
+ x: this.interaction.initialBounds.x + constrainedMovement.deltaX,
245
+ y: this.interaction.initialBounds.y + constrainedMovement.deltaY
246
+ };
247
+ } else if (this.dragMode === "resize" && this.interaction.target.handle) {
248
+ const context = {
249
+ initialBounds: this.interaction.initialBounds,
250
+ container: {
251
+ width: this.containerWidth,
252
+ height: this.containerHeight
253
+ },
254
+ constraints: {
255
+ minSize: this.minSize,
256
+ aspectRatio: this.modifiers.shift ? this.interaction.initialBounds.width / this.interaction.initialBounds.height : void 0
257
+ },
258
+ movement: {
259
+ deltaX,
260
+ deltaY
261
+ },
262
+ modifiers: {
263
+ centerResize: this.modifiers.alt,
264
+ preserveAspectRatio: this.modifiers.shift
265
+ }
266
+ };
267
+ this.bounds = this.calculateBoundsWithModeAwareConstraints(context, this.interaction.target.handle);
268
+ }
269
+ this.dispatchBoundsChange();
270
+ };
271
+ this.handlePointerUp = () => {
272
+ this.isDragging = false;
273
+ this.dragMode = null;
274
+ this.interaction = null;
275
+ document.removeEventListener("pointermove", this.handlePointerMove);
276
+ document.removeEventListener("pointerup", this.handlePointerUp);
277
+ };
278
+ }
279
+ static {
280
+ this.styles = css`
281
+ .box {
282
+ position: absolute;
283
+ border: 2px solid var(--ef-resizable-box-border-color, #3b82f6);
284
+ background-color: var(--ef-resizable-box-bg-color, rgba(59, 130, 246, 0.2));
285
+ cursor: grab;
286
+ }
287
+ .box.dragging {
288
+ border-color: var(--ef-resizable-box-dragging-border-color, #2563eb);
289
+ background-color: var(--ef-resizable-box-dragging-bg-color, rgba(37, 99, 235, 0.3));
290
+ }
291
+ .handle {
292
+ position: absolute;
293
+ background-color: var(--ef-resizable-box-handle-color, #3b82f6);
294
+ touch-action: none;
295
+ }
296
+ .top-left { top: -4px; left: -4px; width: 8px; height: 8px; cursor: nwse-resize; }
297
+ .top-right { top: -4px; right: -4px; width: 8px; height: 8px; cursor: nesw-resize; }
298
+ .bottom-left { bottom: -4px; left: -4px; width: 8px; height: 8px; cursor: nesw-resize; }
299
+ .bottom-right { bottom: -4px; right: -4px; width: 8px; height: 8px; cursor: nwse-resize; }
300
+ .top { top: -4px; left: 4px; right: 4px; height: 8px; cursor: ns-resize; }
301
+ .right { top: 4px; bottom: 4px; right: -4px; width: 8px; cursor: ew-resize; }
302
+ .bottom { bottom: -4px; left: 4px; right: 4px; height: 8px; cursor: ns-resize; }
303
+ .left { top: 4px; bottom: 4px; left: -4px; width: 8px; cursor: ew-resize; }
304
+ `;
305
+ }
306
+ connectedCallback() {
307
+ super.connectedCallback();
308
+ if (this.offsetParent) {
309
+ this.containerWidth = this.offsetParent.clientWidth;
310
+ this.containerHeight = this.offsetParent.clientHeight;
311
+ }
312
+ this.resizeObserver = new ResizeObserver(() => {
313
+ if (this.offsetParent) {
314
+ this.containerWidth = this.offsetParent.clientWidth;
315
+ this.containerHeight = this.offsetParent.clientHeight;
316
+ }
317
+ });
318
+ if (this.offsetParent) this.resizeObserver.observe(this.offsetParent);
319
+ }
320
+ handlePointerDown(e, mode, handle) {
321
+ e.preventDefault();
322
+ e.stopPropagation();
323
+ this.isDragging = true;
324
+ this.dragMode = mode;
325
+ this.interaction = {
326
+ startPoint: {
327
+ x: e.clientX,
328
+ y: e.clientY
329
+ },
330
+ target: {
331
+ mode,
332
+ handle
333
+ },
334
+ initialBounds: { ...this.bounds },
335
+ pointerId: e.pointerId
336
+ };
337
+ this.modifiers = {
338
+ shift: e.shiftKey,
339
+ alt: e.altKey
340
+ };
341
+ document.addEventListener("pointermove", this.handlePointerMove);
342
+ document.addEventListener("pointerup", this.handlePointerUp);
343
+ }
344
+ calculateBoundsWithModeAwareConstraints(context, handle) {
345
+ const { modifiers, constraints, container, initialBounds } = context;
346
+ if (!modifiers.centerResize && !modifiers.preserveAspectRatio) {
347
+ const constrainedMovement = this.constrainResizeDeltas(initialBounds, context.movement.deltaX, context.movement.deltaY, handle, container, constraints.minSize);
348
+ return calculateNormalResize({
349
+ ...context,
350
+ movement: constrainedMovement
351
+ }, handle);
352
+ }
353
+ let idealBounds;
354
+ if (modifiers.centerResize && modifiers.preserveAspectRatio) idealBounds = calculateCenterResizeWithAspectRatio(context, handle);
355
+ else if (modifiers.centerResize) idealBounds = calculateCenterResize(context, handle);
356
+ else idealBounds = calculateAspectRatioResize(context, handle);
357
+ return this.constrainBoundsForMode(idealBounds, context, handle);
358
+ }
359
+ constrainBoundsForMode(idealBounds, context, handle) {
360
+ const { container, constraints, modifiers } = context;
361
+ if (this.isValidBounds(idealBounds, container, constraints.minSize)) return idealBounds;
362
+ if (modifiers.centerResize && modifiers.preserveAspectRatio && constraints.aspectRatio) return this.constrainCenterResizeWithAspectRatio(idealBounds, context);
363
+ if (modifiers.preserveAspectRatio && constraints.aspectRatio) return this.constrainWithAspectRatio(idealBounds, context, handle);
364
+ if (modifiers.centerResize) return this.constrainCenterResize(idealBounds, context);
365
+ return this.simpleConstrainBounds(idealBounds, container, constraints.minSize);
366
+ }
367
+ isValidBounds(bounds, container, minSize) {
368
+ return bounds.x >= 0 && bounds.y >= 0 && bounds.width >= minSize && bounds.height >= minSize && bounds.x + bounds.width <= container.width && bounds.y + bounds.height <= container.height;
369
+ }
370
+ constrainWithAspectRatio(idealBounds, context, handle) {
371
+ const { container, constraints, initialBounds } = context;
372
+ if (!constraints.aspectRatio) return initialBounds;
373
+ const aspectRatio = constraints.aspectRatio;
374
+ const maxWidth = container.width - Math.max(0, idealBounds.x);
375
+ const maxHeight = container.height - Math.max(0, idealBounds.y);
376
+ let constrainedWidth = Math.max(constraints.minSize, Math.min(maxWidth, idealBounds.width));
377
+ let constrainedHeight = constrainedWidth / aspectRatio;
378
+ if (constrainedHeight > maxHeight) {
379
+ constrainedHeight = Math.max(constraints.minSize, maxHeight);
380
+ constrainedWidth = constrainedHeight * aspectRatio;
381
+ }
382
+ if (constrainedWidth < constraints.minSize) {
383
+ constrainedWidth = constraints.minSize;
384
+ constrainedHeight = constrainedWidth / aspectRatio;
385
+ }
386
+ const result = {
387
+ ...idealBounds,
388
+ width: constrainedWidth,
389
+ height: constrainedHeight
390
+ };
391
+ switch (handle) {
392
+ case "top-left":
393
+ result.x = initialBounds.x + initialBounds.width - constrainedWidth;
394
+ result.y = initialBounds.y + initialBounds.height - constrainedHeight;
395
+ break;
396
+ case "top-right":
397
+ result.y = initialBounds.y + initialBounds.height - constrainedHeight;
398
+ break;
399
+ case "bottom-left":
400
+ result.x = initialBounds.x + initialBounds.width - constrainedWidth;
401
+ break;
402
+ }
403
+ result.x = Math.max(0, Math.min(container.width - result.width, result.x));
404
+ result.y = Math.max(0, Math.min(container.height - result.height, result.y));
405
+ return result;
406
+ }
407
+ constrainCenterResize(idealBounds, context) {
408
+ const { container, constraints, initialBounds } = context;
409
+ const centerX = initialBounds.x + initialBounds.width / 2;
410
+ const centerY = initialBounds.y + initialBounds.height / 2;
411
+ const maxWidthFromCenter = Math.min(centerX * 2, (container.width - centerX) * 2);
412
+ const maxHeightFromCenter = Math.min(centerY * 2, (container.height - centerY) * 2);
413
+ const constrainedWidth = Math.max(constraints.minSize, Math.min(maxWidthFromCenter, idealBounds.width));
414
+ const constrainedHeight = Math.max(constraints.minSize, Math.min(maxHeightFromCenter, idealBounds.height));
415
+ return {
416
+ x: centerX - constrainedWidth / 2,
417
+ y: centerY - constrainedHeight / 2,
418
+ width: constrainedWidth,
419
+ height: constrainedHeight
420
+ };
421
+ }
422
+ constrainCenterResizeWithAspectRatio(idealBounds, context) {
423
+ const { container, constraints, initialBounds } = context;
424
+ if (!constraints.aspectRatio) return initialBounds;
425
+ const aspectRatio = constraints.aspectRatio;
426
+ const centerX = initialBounds.x + initialBounds.width / 2;
427
+ const centerY = initialBounds.y + initialBounds.height / 2;
428
+ const maxWidthFromCenter = Math.min(centerX * 2, (container.width - centerX) * 2);
429
+ const maxHeightFromCenter = Math.min(centerY * 2, (container.height - centerY) * 2);
430
+ let constrainedWidth = Math.max(constraints.minSize, Math.min(maxWidthFromCenter, idealBounds.width));
431
+ let constrainedHeight = constrainedWidth / aspectRatio;
432
+ if (constrainedHeight > maxHeightFromCenter) {
433
+ constrainedHeight = Math.max(constraints.minSize, maxHeightFromCenter);
434
+ constrainedWidth = constrainedHeight * aspectRatio;
435
+ }
436
+ if (constrainedWidth < constraints.minSize) {
437
+ constrainedWidth = constraints.minSize;
438
+ constrainedHeight = constrainedWidth / aspectRatio;
439
+ }
440
+ if (constrainedHeight < constraints.minSize) {
441
+ constrainedHeight = constraints.minSize;
442
+ constrainedWidth = constrainedHeight * aspectRatio;
443
+ }
444
+ return {
445
+ x: centerX - constrainedWidth / 2,
446
+ y: centerY - constrainedHeight / 2,
447
+ width: constrainedWidth,
448
+ height: constrainedHeight
449
+ };
450
+ }
451
+ simpleConstrainBounds(bounds, container, minSize) {
452
+ return {
453
+ x: Math.max(0, Math.min(container.width - bounds.width, bounds.x)),
454
+ y: Math.max(0, Math.min(container.height - bounds.height, bounds.y)),
455
+ width: Math.max(minSize, Math.min(container.width - bounds.x, bounds.width)),
456
+ height: Math.max(minSize, Math.min(container.height - bounds.y, bounds.height))
457
+ };
458
+ }
459
+ constrainResizeDeltas(initialBounds, deltaX, deltaY, handle, container, minSize) {
460
+ let constrainedDeltaX = deltaX;
461
+ let constrainedDeltaY = deltaY;
462
+ switch (handle) {
463
+ case "bottom-right":
464
+ constrainedDeltaX = Math.max(minSize - initialBounds.width, Math.min(container.width - initialBounds.x - initialBounds.width, deltaX));
465
+ constrainedDeltaY = Math.max(minSize - initialBounds.height, Math.min(container.height - initialBounds.y - initialBounds.height, deltaY));
466
+ break;
467
+ case "top-left":
468
+ constrainedDeltaX = Math.max(-initialBounds.x, Math.min(initialBounds.width - minSize, deltaX));
469
+ constrainedDeltaY = Math.max(-initialBounds.y, Math.min(initialBounds.height - minSize, deltaY));
470
+ break;
471
+ case "top-right":
472
+ constrainedDeltaX = Math.max(minSize - initialBounds.width, Math.min(container.width - initialBounds.x - initialBounds.width, deltaX));
473
+ constrainedDeltaY = Math.max(-initialBounds.y, Math.min(initialBounds.height - minSize, deltaY));
474
+ break;
475
+ case "bottom-left":
476
+ constrainedDeltaX = Math.max(-initialBounds.x, Math.min(initialBounds.width - minSize, deltaX));
477
+ constrainedDeltaY = Math.max(minSize - initialBounds.height, Math.min(container.height - initialBounds.y - initialBounds.height, deltaY));
478
+ break;
479
+ case "right":
480
+ constrainedDeltaX = Math.max(minSize - initialBounds.width, Math.min(container.width - initialBounds.x - initialBounds.width, deltaX));
481
+ break;
482
+ case "left":
483
+ constrainedDeltaX = Math.max(-initialBounds.x, Math.min(initialBounds.width - minSize, deltaX));
484
+ break;
485
+ case "bottom":
486
+ constrainedDeltaY = Math.max(minSize - initialBounds.height, Math.min(container.height - initialBounds.y - initialBounds.height, deltaY));
487
+ break;
488
+ case "top":
489
+ constrainedDeltaY = Math.max(-initialBounds.y, Math.min(initialBounds.height - minSize, deltaY));
490
+ break;
491
+ }
492
+ return {
493
+ deltaX: constrainedDeltaX,
494
+ deltaY: constrainedDeltaY
495
+ };
496
+ }
497
+ dispatchBoundsChange() {
498
+ this.dispatchEvent(new CustomEvent("bounds-change", {
499
+ detail: { bounds: this.bounds },
500
+ bubbles: true,
501
+ composed: true
502
+ }));
503
+ }
504
+ render() {
505
+ const boxStyles = {
506
+ left: `${this.bounds.x}px`,
507
+ top: `${this.bounds.y}px`,
508
+ width: `${this.bounds.width}px`,
509
+ height: `${this.bounds.height}px`
510
+ };
511
+ return html`
512
+ <div
513
+ class="box ${this.isDragging ? "dragging" : ""}"
514
+ style=${styleMap(boxStyles)}
515
+ @pointerdown=${(e) => this.handlePointerDown(e, "move")}
516
+ >
517
+ ${this.renderHandles()}
518
+ <slot></slot>
519
+ </div>
520
+ `;
521
+ }
522
+ renderHandles() {
523
+ return [
524
+ "top-left",
525
+ "top-right",
526
+ "bottom-left",
527
+ "bottom-right",
528
+ "top",
529
+ "right",
530
+ "bottom",
531
+ "left"
532
+ ].map((handle) => html`
533
+ <div
534
+ class="handle ${handle}"
535
+ @pointerdown=${(e) => this.handlePointerDown(e, "resize", handle)}
536
+ ></div>
537
+ `);
538
+ }
539
+ };
540
+ __decorate([property({ type: Object })], EFResizableBox.prototype, "bounds", void 0);
541
+ __decorate([state()], EFResizableBox.prototype, "containerWidth", void 0);
542
+ __decorate([state()], EFResizableBox.prototype, "containerHeight", void 0);
543
+ __decorate([property({ type: Number })], EFResizableBox.prototype, "minSize", void 0);
544
+ __decorate([state()], EFResizableBox.prototype, "isDragging", void 0);
545
+ __decorate([state()], EFResizableBox.prototype, "dragMode", void 0);
546
+ EFResizableBox = __decorate([customElement("ef-resizable-box")], EFResizableBox);
547
+ export { EFResizableBox };
@@ -1,11 +1,16 @@
1
1
  import { LitElement } from 'lit';
2
- import { ContextMixinInterface } from './ContextMixin.js';
3
- export declare class EFScrubber extends LitElement {
2
+ import { ControllableInterface } from './Controllable.js';
3
+ declare const EFScrubber_base: (new (...args: any[]) => {
4
+ target: string;
5
+ targetElement: ControllableInterface | null;
6
+ effectiveContext: ControllableInterface | null;
7
+ }) & typeof LitElement;
8
+ export declare class EFScrubber extends EFScrubber_base {
4
9
  static styles: import('lit').CSSResult[];
5
- context?: ContextMixinInterface | null;
6
10
  playing: boolean;
7
11
  currentTimeMs: number;
8
12
  durationMs: number;
13
+ get context(): ControllableInterface | null;
9
14
  private scrubProgress;
10
15
  private isMoving;
11
16
  private scrubberRef?;
@@ -22,3 +27,4 @@ declare global {
22
27
  "ef-scrubber": EFScrubber;
23
28
  }
24
29
  }
30
+ export {};
@@ -1,13 +1,14 @@
1
1
  import { currentTimeContext } from "./currentTimeContext.js";
2
2
  import { durationContext } from "./durationContext.js";
3
- import { efContext } from "./efContext.js";
4
3
  import { playingContext } from "./playingContext.js";
4
+ import { __decorate } from "../_virtual/_@oxc-project_runtime@0.94.0/helpers/decorate.js";
5
+ import { efContext } from "./efContext.js";
6
+ import { TargetOrContextMixin } from "./TargetOrContextMixin.js";
5
7
  import { consume } from "@lit/context";
6
8
  import { LitElement, css, html } from "lit";
7
9
  import { customElement, state } from "lit/decorators.js";
8
- import _decorate from "@oxc-project/runtime/helpers/decorate";
9
10
  import { ref } from "lit/directives/ref.js";
10
- let EFScrubber = class EFScrubber$1 extends LitElement {
11
+ var EFScrubber = class EFScrubber$1 extends TargetOrContextMixin(LitElement, efContext) {
11
12
  constructor(..._args) {
12
13
  super(..._args);
13
14
  this.playing = false;
@@ -73,6 +74,9 @@ let EFScrubber = class EFScrubber$1 extends LitElement {
73
74
  ::part(handle) { }
74
75
  `];
75
76
  }
77
+ get context() {
78
+ return this.effectiveContext;
79
+ }
76
80
  updateProgress(e) {
77
81
  if (!this.context || !this.scrubberRef) return;
78
82
  const rect = this.scrubberRef.getBoundingClientRect();
@@ -109,23 +113,19 @@ let EFScrubber = class EFScrubber$1 extends LitElement {
109
113
  window.removeEventListener("pointermove", this.boundHandlePointerMove);
110
114
  }
111
115
  };
112
- _decorate([consume({
113
- context: efContext,
114
- subscribe: true
115
- })], EFScrubber.prototype, "context", void 0);
116
- _decorate([consume({
116
+ __decorate([consume({
117
117
  context: playingContext,
118
118
  subscribe: true
119
119
  })], EFScrubber.prototype, "playing", void 0);
120
- _decorate([consume({
120
+ __decorate([consume({
121
121
  context: currentTimeContext,
122
122
  subscribe: true
123
123
  })], EFScrubber.prototype, "currentTimeMs", void 0);
124
- _decorate([consume({
124
+ __decorate([consume({
125
125
  context: durationContext,
126
126
  subscribe: true
127
127
  })], EFScrubber.prototype, "durationMs", void 0);
128
- _decorate([state()], EFScrubber.prototype, "scrubProgress", void 0);
129
- _decorate([state()], EFScrubber.prototype, "isMoving", void 0);
130
- EFScrubber = _decorate([customElement("ef-scrubber")], EFScrubber);
128
+ __decorate([state()], EFScrubber.prototype, "scrubProgress", void 0);
129
+ __decorate([state()], EFScrubber.prototype, "isMoving", void 0);
130
+ EFScrubber = __decorate([customElement("ef-scrubber")], EFScrubber);
131
131
  export { EFScrubber };
@@ -1,5 +1,10 @@
1
1
  import { LitElement } from 'lit';
2
- export declare class EFTimeDisplay extends LitElement {
2
+ declare const EFTimeDisplay_base: (new (...args: any[]) => {
3
+ target: string;
4
+ targetElement: import('./Controllable.js').ControllableInterface | null;
5
+ effectiveContext: import('./Controllable.js').ControllableInterface | null;
6
+ }) & typeof LitElement;
7
+ export declare class EFTimeDisplay extends EFTimeDisplay_base {
3
8
  static styles: import('lit').CSSResult;
4
9
  currentTimeMs: number;
5
10
  durationMs: number;
@@ -11,3 +16,4 @@ declare global {
11
16
  "ef-time-display": EFTimeDisplay;
12
17
  }
13
18
  }
19
+ export {};
@@ -1,10 +1,12 @@
1
1
  import { currentTimeContext } from "./currentTimeContext.js";
2
2
  import { durationContext } from "./durationContext.js";
3
+ import { __decorate } from "../_virtual/_@oxc-project_runtime@0.94.0/helpers/decorate.js";
4
+ import { efContext } from "./efContext.js";
5
+ import { TargetOrContextMixin } from "./TargetOrContextMixin.js";
3
6
  import { consume } from "@lit/context";
4
7
  import { LitElement, css, html } from "lit";
5
8
  import { customElement } from "lit/decorators.js";
6
- import _decorate from "@oxc-project/runtime/helpers/decorate";
7
- let EFTimeDisplay = class EFTimeDisplay$1 extends LitElement {
9
+ var EFTimeDisplay = class EFTimeDisplay$1 extends TargetOrContextMixin(LitElement, efContext) {
8
10
  constructor(..._args) {
9
11
  super(..._args);
10
12
  this.currentTimeMs = NaN;
@@ -24,9 +26,7 @@ let EFTimeDisplay = class EFTimeDisplay$1 extends LitElement {
24
26
  formatTime(ms) {
25
27
  if (!Number.isFinite(ms) || ms < 0) return "0:00";
26
28
  const totalSeconds = Math.floor(ms / 1e3);
27
- const minutes = Math.floor(totalSeconds / 60);
28
- const seconds = totalSeconds % 60;
29
- return `${minutes}:${seconds.toString().padStart(2, "0")}`;
29
+ return `${Math.floor(totalSeconds / 60)}:${(totalSeconds % 60).toString().padStart(2, "0")}`;
30
30
  }
31
31
  render() {
32
32
  const currentTime = this.currentTimeMs;
@@ -38,13 +38,13 @@ let EFTimeDisplay = class EFTimeDisplay$1 extends LitElement {
38
38
  `;
39
39
  }
40
40
  };
41
- _decorate([consume({
41
+ __decorate([consume({
42
42
  context: currentTimeContext,
43
43
  subscribe: true
44
44
  })], EFTimeDisplay.prototype, "currentTimeMs", void 0);
45
- _decorate([consume({
45
+ __decorate([consume({
46
46
  context: durationContext,
47
47
  subscribe: true
48
48
  })], EFTimeDisplay.prototype, "durationMs", void 0);
49
- EFTimeDisplay = _decorate([customElement("ef-time-display")], EFTimeDisplay);
49
+ EFTimeDisplay = __decorate([customElement("ef-time-display")], EFTimeDisplay);
50
50
  export { EFTimeDisplay };