@editframe/elements 0.34.7-beta → 0.34.9-beta

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 (35) hide show
  1. package/dist/canvas/EFCanvas.d.ts +4 -4
  2. package/dist/elements/EFAudio.d.ts +4 -4
  3. package/dist/elements/EFMedia/JitMediaEngine.js +6 -0
  4. package/dist/elements/EFMedia/JitMediaEngine.js.map +1 -1
  5. package/dist/elements/EFPanZoom.d.ts +4 -4
  6. package/dist/elements/EFSurface.d.ts +4 -4
  7. package/dist/elements/EFText.d.ts +4 -4
  8. package/dist/elements/EFTextSegment.d.ts +4 -4
  9. package/dist/elements/EFThumbnailStrip.d.ts +4 -4
  10. package/dist/elements/EFVideo.d.ts +6 -6
  11. package/dist/elements/EFWaveform.d.ts +4 -4
  12. package/dist/gui/EFActiveRootTemporal.d.ts +4 -4
  13. package/dist/gui/EFConfiguration.d.ts +4 -4
  14. package/dist/gui/EFControls.d.ts +2 -2
  15. package/dist/gui/EFDial.d.ts +4 -4
  16. package/dist/gui/EFFilmstrip.d.ts +2 -2
  17. package/dist/gui/EFFitScale.d.ts +3 -3
  18. package/dist/gui/EFFocusOverlay.d.ts +4 -4
  19. package/dist/gui/EFPause.d.ts +4 -4
  20. package/dist/gui/EFPlay.d.ts +4 -4
  21. package/dist/gui/EFPreview.d.ts +4 -4
  22. package/dist/gui/EFResizableBox.d.ts +4 -4
  23. package/dist/gui/EFScrubber.d.ts +4 -4
  24. package/dist/gui/EFTimeDisplay.d.ts +4 -4
  25. package/dist/gui/EFToggleLoop.d.ts +4 -4
  26. package/dist/gui/EFTogglePlay.d.ts +4 -4
  27. package/dist/gui/EFTransformHandles.d.ts +4 -4
  28. package/dist/gui/EFWorkbench.d.ts +6 -6
  29. package/dist/gui/hierarchy/EFHierarchy.d.ts +4 -4
  30. package/dist/gui/hierarchy/EFHierarchyItem.d.ts +2 -2
  31. package/dist/gui/tree/EFTree.d.ts +4 -4
  32. package/dist/gui/tree/EFTreeItem.d.ts +4 -4
  33. package/dist/preview/renderTimegroupPreview.js +133 -155
  34. package/dist/preview/renderTimegroupPreview.js.map +1 -1
  35. package/package.json +2 -2
@@ -1,7 +1,7 @@
1
1
  import { ControllableInterface } from "./Controllable.js";
2
- import * as lit19 from "lit";
2
+ import * as lit17 from "lit";
3
3
  import { LitElement } from "lit";
4
- import * as lit_html19 from "lit-html";
4
+ import * as lit_html17 from "lit-html";
5
5
 
6
6
  //#region src/gui/EFToggleLoop.d.ts
7
7
  declare const EFToggleLoop_base: (new (...args: any[]) => {
@@ -10,9 +10,9 @@ declare const EFToggleLoop_base: (new (...args: any[]) => {
10
10
  effectiveContext: ControllableInterface | null;
11
11
  }) & typeof LitElement;
12
12
  declare class EFToggleLoop extends EFToggleLoop_base {
13
- static styles: lit19.CSSResult[];
13
+ static styles: lit17.CSSResult[];
14
14
  get context(): ControllableInterface | null;
15
- render(): lit_html19.TemplateResult<1>;
15
+ render(): lit_html17.TemplateResult<1>;
16
16
  }
17
17
  declare global {
18
18
  interface HTMLElementTagNameMap {
@@ -1,7 +1,7 @@
1
1
  import { ControllableInterface } from "./Controllable.js";
2
- import * as lit16 from "lit";
2
+ import * as lit14 from "lit";
3
3
  import { LitElement } from "lit";
4
- import * as lit_html16 from "lit-html";
4
+ import * as lit_html14 from "lit-html";
5
5
 
6
6
  //#region src/gui/EFTogglePlay.d.ts
7
7
  declare const EFTogglePlay_base: (new (...args: any[]) => {
@@ -10,12 +10,12 @@ declare const EFTogglePlay_base: (new (...args: any[]) => {
10
10
  effectiveContext: ControllableInterface | null;
11
11
  }) & typeof LitElement;
12
12
  declare class EFTogglePlay extends EFTogglePlay_base {
13
- static styles: lit16.CSSResult[];
13
+ static styles: lit14.CSSResult[];
14
14
  playing: boolean;
15
15
  get efContext(): ControllableInterface | null;
16
16
  connectedCallback(): void;
17
17
  disconnectedCallback(): void;
18
- render(): lit_html16.TemplateResult<1>;
18
+ render(): lit_html14.TemplateResult<1>;
19
19
  togglePlay: () => void;
20
20
  private getPlaybackController;
21
21
  }
@@ -1,7 +1,7 @@
1
1
  import { PanZoomTransform } from "../elements/EFPanZoom.js";
2
- import * as lit26 from "lit";
2
+ import * as lit24 from "lit";
3
3
  import { LitElement } from "lit";
4
- import * as lit_html25 from "lit-html";
4
+ import * as lit_html23 from "lit-html";
5
5
 
6
6
  //#region src/gui/EFTransformHandles.d.ts
7
7
  interface TransformBounds {
@@ -49,7 +49,7 @@ declare class EFTransformHandles extends LitElement {
49
49
  * Note: Not a @state() property to avoid re-renders during interaction.
50
50
  */
51
51
  private initialBounds;
52
- static styles: lit26.CSSResult;
52
+ static styles: lit24.CSSResult;
53
53
  private resizeObserver?;
54
54
  /**
55
55
  * Single source of truth for zoom scale.
@@ -79,7 +79,7 @@ declare class EFTransformHandles extends LitElement {
79
79
  private handleMouseMove;
80
80
  private handleMouseUp;
81
81
  private cleanup;
82
- render(): lit_html25.TemplateResult<1>;
82
+ render(): lit_html23.TemplateResult<1>;
83
83
  }
84
84
  declare global {
85
85
  interface HTMLElementTagNameMap {
@@ -1,15 +1,15 @@
1
1
  import { ContextMixinInterface } from "./ContextMixin.js";
2
2
  import { RenderToVideoOptions } from "../preview/renderTimegroupToVideo.js";
3
3
  import "./EFFitScale.js";
4
- import * as lit6 from "lit";
4
+ import * as lit8 from "lit";
5
5
  import { LitElement, PropertyValueMap } from "lit";
6
- import * as lit_html6 from "lit-html";
7
- import * as lit_html_directives_ref_js1 from "lit-html/directives/ref.js";
6
+ import * as lit_html8 from "lit-html";
7
+ import * as lit_html_directives_ref_js2 from "lit-html/directives/ref.js";
8
8
 
9
9
  //#region src/gui/EFWorkbench.d.ts
10
10
  declare const EFWorkbench_base: (new (...args: any[]) => ContextMixinInterface) & typeof LitElement;
11
11
  declare class EFWorkbench extends EFWorkbench_base {
12
- static styles: lit6.CSSResult[];
12
+ static styles: lit8.CSSResult[];
13
13
  rendering: boolean;
14
14
  private panZoomTransform;
15
15
  private isExporting;
@@ -61,7 +61,7 @@ declare class EFWorkbench extends EFWorkbench_base {
61
61
  private canvasPreviewResult;
62
62
  private canvasAnimationFrame;
63
63
  private boundHandleTransformChanged;
64
- focusOverlay: lit_html_directives_ref_js1.Ref<HTMLDivElement>;
64
+ focusOverlay: lit_html_directives_ref_js2.Ref<HTMLDivElement>;
65
65
  handleStageWheel(event: WheelEvent): void;
66
66
  connectedCallback(): void;
67
67
  disconnectedCallback(): void;
@@ -194,7 +194,7 @@ declare class EFWorkbench extends EFWorkbench_base {
194
194
  updated(changedProperties: PropertyValueMap<any> | Map<PropertyKey, unknown>): void;
195
195
  drawOverlays: () => void;
196
196
  private renderPlaybackStats;
197
- render(): lit_html6.TemplateResult<1>;
197
+ render(): lit_html8.TemplateResult<1>;
198
198
  }
199
199
  declare global {
200
200
  interface HTMLElementTagNameMap {
@@ -1,12 +1,12 @@
1
1
  import { SelectionContext } from "../../canvas/selection/selectionContext.js";
2
- import * as lit5 from "lit";
2
+ import * as lit10 from "lit";
3
3
  import { LitElement, PropertyValues } from "lit";
4
- import * as lit_html4 from "lit-html";
4
+ import * as lit_html11 from "lit-html";
5
5
 
6
6
  //#region src/gui/hierarchy/EFHierarchy.d.ts
7
7
  declare const EFHierarchy_base: typeof LitElement;
8
8
  declare class EFHierarchy extends EFHierarchy_base {
9
- static styles: lit5.CSSResult[];
9
+ static styles: lit10.CSSResult[];
10
10
  target: string;
11
11
  header: string;
12
12
  showHeader: boolean;
@@ -53,7 +53,7 @@ declare class EFHierarchy extends EFHierarchy_base {
53
53
  private autoSelectFirstRootTimegroup;
54
54
  private setupSelectionListener;
55
55
  private removeSelectionListener;
56
- render(): lit_html4.TemplateResult<1>;
56
+ render(): lit_html11.TemplateResult<1>;
57
57
  }
58
58
  declare global {
59
59
  interface HTMLElementTagNameMap {
@@ -4,13 +4,13 @@ import { EFAudio } from "../../elements/EFAudio.js";
4
4
  import { EFTimegroup } from "../../elements/EFTimegroup.js";
5
5
  import { EFImage } from "../../elements/EFImage.js";
6
6
  import { HierarchyContext } from "./hierarchyContext.js";
7
- import * as lit13 from "lit";
7
+ import * as lit11 from "lit";
8
8
  import { LitElement, PropertyValues, TemplateResult, nothing } from "lit";
9
9
 
10
10
  //#region src/gui/hierarchy/EFHierarchyItem.d.ts
11
11
  declare const EFHierarchyItem_base: typeof LitElement;
12
12
  declare class EFHierarchyItem<ElementType extends HTMLElement = HTMLElement> extends EFHierarchyItem_base {
13
- static styles: lit13.CSSResult[];
13
+ static styles: lit11.CSSResult[];
14
14
  hierarchyContext?: HierarchyContext;
15
15
  canvasSelectionContext?: SelectionContext;
16
16
  element: ElementType;
@@ -1,8 +1,8 @@
1
1
  import { TreeItem } from "./treeContext.js";
2
2
  import "./EFTreeItem.js";
3
- import * as lit14 from "lit";
3
+ import * as lit12 from "lit";
4
4
  import { LitElement, PropertyValues } from "lit";
5
- import * as lit_html14 from "lit-html";
5
+ import * as lit_html12 from "lit-html";
6
6
 
7
7
  //#region src/gui/tree/EFTree.d.ts
8
8
 
@@ -29,7 +29,7 @@ import * as lit_html14 from "lit-html";
29
29
  * ```
30
30
  */
31
31
  declare class EFTree extends LitElement {
32
- static styles: lit14.CSSResult;
32
+ static styles: lit12.CSSResult;
33
33
  /** Tree items to display */
34
34
  items: TreeItem[];
35
35
  /** Optional header text */
@@ -48,7 +48,7 @@ declare class EFTree extends LitElement {
48
48
  protected willUpdate(changedProperties: PropertyValues): void;
49
49
  protected updated(changedProperties: PropertyValues): void;
50
50
  connectedCallback(): void;
51
- render(): lit_html14.TemplateResult<1>;
51
+ render(): lit_html12.TemplateResult<1>;
52
52
  }
53
53
  declare global {
54
54
  interface HTMLElementTagNameMap {
@@ -1,7 +1,7 @@
1
1
  import { TreeContext, TreeItem } from "./treeContext.js";
2
- import * as lit15 from "lit";
2
+ import * as lit13 from "lit";
3
3
  import { LitElement, nothing } from "lit";
4
- import * as lit_html15 from "lit-html";
4
+ import * as lit_html13 from "lit-html";
5
5
 
6
6
  //#region src/gui/tree/EFTreeItem.d.ts
7
7
 
@@ -17,7 +17,7 @@ import * as lit_html15 from "lit-html";
17
17
  * @fires tree-item-click - When item is clicked (for selection)
18
18
  */
19
19
  declare class EFTreeItem extends LitElement {
20
- static styles: lit15.CSSResult;
20
+ static styles: lit13.CSSResult;
21
21
  treeContext?: TreeContext;
22
22
  item: TreeItem;
23
23
  private localExpanded;
@@ -26,7 +26,7 @@ declare class EFTreeItem extends LitElement {
26
26
  get hasChildren(): boolean;
27
27
  private handleClick;
28
28
  private handleExpandClick;
29
- render(): lit_html15.TemplateResult<1> | typeof nothing;
29
+ render(): lit_html13.TemplateResult<1> | typeof nothing;
30
30
  }
31
31
  declare global {
32
32
  interface HTMLElementTagNameMap {
@@ -193,27 +193,130 @@ function restoreHiddenNodes(removed) {
193
193
  }
194
194
  }
195
195
  /**
196
- * Helper to copy styles from host and content elements to a canvas clone.
197
- * Reduces code duplication for shadow canvas and shadow img cases.
196
+ * Unified CSS property sync for all elements (canvas clones and regular elements).
197
+ * Single source of truth using the SYNC_PROPERTIES array.
198
+ *
199
+ * @param source - Source element to read styles from
200
+ * @param clone - Clone element to write styles to
201
+ * @param contentSource - Optional content element for width/height (canvas clones only)
202
+ */
203
+ function syncElementStyles(source, clone, contentSource) {
204
+ const cloneStyle = clone.style;
205
+ const propLen = SYNC_PROPERTIES.length;
206
+ const tagName = source.tagName;
207
+ if (HAS_COMPUTED_STYLE_MAP) {
208
+ let srcMap;
209
+ let contentMap;
210
+ try {
211
+ srcMap = source.computedStyleMap();
212
+ if (contentSource) contentMap = contentSource.computedStyleMap();
213
+ } catch {
214
+ return;
215
+ }
216
+ for (let j = 0; j < propLen; j++) {
217
+ const kebab = SYNC_PROPERTIES_KEBAB[j];
218
+ const camel = SYNC_PROPERTIES[j];
219
+ const styleMap = contentSource && (camel === "width" || camel === "height") ? contentMap : srcMap;
220
+ if (!styleMap) continue;
221
+ const srcVal = styleMap.get(kebab);
222
+ if (!srcVal) continue;
223
+ const strVal = srcVal.toString();
224
+ if (camel === "display") {
225
+ cloneStyle.display = strVal === "none" && !(tagName && (tagName === "EF-CAPTIONS-ACTIVE-WORD" || tagName === "EF-CAPTIONS-BEFORE-ACTIVE-WORD" || tagName === "EF-CAPTIONS-AFTER-ACTIVE-WORD" || tagName === "EF-CAPTIONS-SEGMENT")) ? "block" : strVal;
226
+ continue;
227
+ }
228
+ if (camel === "clipPath") continue;
229
+ if (isDefaultValue(camel, strVal)) {
230
+ if (cloneStyle[camel]) cloneStyle[camel] = "";
231
+ continue;
232
+ }
233
+ cloneStyle[camel] = strVal;
234
+ }
235
+ } else {
236
+ let cs;
237
+ let contentCs;
238
+ try {
239
+ cs = getComputedStyle(source);
240
+ if (contentSource) contentCs = getComputedStyle(contentSource);
241
+ } catch {
242
+ return;
243
+ }
244
+ const srcStyle = cs;
245
+ const contentStyle = contentCs;
246
+ for (const prop of SYNC_PROPERTIES) {
247
+ const srcVal = contentSource && (prop === "width" || prop === "height") ? contentStyle?.[prop] : srcStyle[prop];
248
+ if (!srcVal) continue;
249
+ if (prop === "display") {
250
+ cloneStyle.display = srcVal === "none" && !(tagName && (tagName === "EF-CAPTIONS-ACTIVE-WORD" || tagName === "EF-CAPTIONS-BEFORE-ACTIVE-WORD" || tagName === "EF-CAPTIONS-AFTER-ACTIVE-WORD" || tagName === "EF-CAPTIONS-SEGMENT")) ? "block" : srcVal;
251
+ continue;
252
+ }
253
+ if (prop === "clipPath") continue;
254
+ if (isDefaultValue(prop, srcVal)) {
255
+ if (cloneStyle[prop]) cloneStyle[prop] = "";
256
+ continue;
257
+ }
258
+ cloneStyle[prop] = srcVal;
259
+ }
260
+ }
261
+ cloneStyle.animation = "none";
262
+ cloneStyle.transition = "none";
263
+ }
264
+ /**
265
+ * Refresh canvas pixel content from shadow DOM source.
266
+ * Handles both shadow canvas and shadow img sources.
267
+ */
268
+ function refreshCanvasPixels(node) {
269
+ const { source, clone } = node;
270
+ const canvas = clone;
271
+ const shadowCanvas = source.shadowRoot?.querySelector("canvas");
272
+ const shadowImg = source.shadowRoot?.querySelector("img");
273
+ if (shadowCanvas) {
274
+ if (canvas.width !== shadowCanvas.width) canvas.width = shadowCanvas.width;
275
+ if (canvas.height !== shadowCanvas.height) canvas.height = shadowCanvas.height;
276
+ const ctx = canvas.getContext("2d");
277
+ if (ctx && shadowCanvas.width > 0 && shadowCanvas.height > 0) try {
278
+ ctx.clearRect(0, 0, canvas.width, canvas.height);
279
+ ctx.drawImage(shadowCanvas, 0, 0);
280
+ } catch (e) {
281
+ logger.warn("[refreshCanvasPixels] Canvas draw failed:", e);
282
+ }
283
+ } else if (shadowImg?.complete && shadowImg.naturalWidth > 0) {
284
+ if (canvas.width !== shadowImg.naturalWidth) canvas.width = shadowImg.naturalWidth;
285
+ if (canvas.height !== shadowImg.naturalHeight) canvas.height = shadowImg.naturalHeight;
286
+ const ctx = canvas.getContext("2d");
287
+ if (ctx) {
288
+ ctx.clearRect(0, 0, canvas.width, canvas.height);
289
+ try {
290
+ ctx.drawImage(shadowImg, 0, 0);
291
+ } catch {}
292
+ }
293
+ }
294
+ }
295
+ /**
296
+ * Sync text content from light DOM to clone.
198
297
  */
199
- function copyCanvasCloneStyles(clone, hostCs, contentCs) {
200
- const s = clone.style;
201
- s.position = hostCs.position;
202
- s.top = hostCs.top;
203
- s.right = hostCs.right;
204
- s.bottom = hostCs.bottom;
205
- s.left = hostCs.left;
206
- s.margin = hostCs.margin;
207
- s.zIndex = hostCs.zIndex;
208
- s.transform = hostCs.transform;
209
- s.transformOrigin = hostCs.transformOrigin;
210
- s.opacity = hostCs.opacity;
211
- s.visibility = hostCs.visibility;
212
- s.width = contentCs.width;
213
- s.height = contentCs.height;
214
- s.display = "block";
215
- s.animation = "none";
216
- s.transition = "none";
298
+ function syncTextContent(source, clone) {
299
+ const srcTextNode = source.childNodes[0];
300
+ if (srcTextNode?.nodeType === Node.TEXT_NODE) {
301
+ const srcText = srcTextNode.textContent || "";
302
+ const cloneTextNode = clone.childNodes[0];
303
+ if (cloneTextNode?.nodeType === Node.TEXT_NODE) {
304
+ if (cloneTextNode.textContent !== srcText) cloneTextNode.textContent = srcText;
305
+ } else if (!clone.childNodes.length) clone.appendChild(document.createTextNode(srcText));
306
+ }
307
+ }
308
+ /**
309
+ * Sync input element value.
310
+ */
311
+ function syncInputValue(source, clone) {
312
+ if (source instanceof HTMLInputElement) {
313
+ const srcVal = source.value;
314
+ const cloneInput = clone;
315
+ if (cloneInput.value !== srcVal) {
316
+ cloneInput.value = srcVal;
317
+ cloneInput.setAttribute("value", srcVal);
318
+ }
319
+ }
217
320
  }
218
321
  /**
219
322
  * Build clone tree structure with minimal overhead.
@@ -262,7 +365,7 @@ function buildCloneStructure(source, timeMs) {
262
365
  ctx.drawImage(shadowCanvas, 0, 0);
263
366
  } catch {}
264
367
  try {
265
- copyCanvasCloneStyles(clone$1, getComputedStyle(srcEl), getComputedStyle(shadowCanvas));
368
+ syncElementStyles(srcEl, clone$1, shadowCanvas);
266
369
  } catch {}
267
370
  canvasSourceMap.set(clone$1, srcEl);
268
371
  const node$1 = {
@@ -287,7 +390,7 @@ function buildCloneStructure(source, timeMs) {
287
390
  ctx.drawImage(shadowImg, 0, 0);
288
391
  } catch {}
289
392
  try {
290
- copyCanvasCloneStyles(clone$1, getComputedStyle(srcEl), getComputedStyle(shadowImg));
393
+ syncElementStyles(srcEl, clone$1, shadowImg);
291
394
  } catch {}
292
395
  canvasSourceMap.set(clone$1, srcEl);
293
396
  const node$1 = {
@@ -385,142 +488,17 @@ function buildCloneStructure(source, timeMs) {
385
488
  }
386
489
  /**
387
490
  * Sync a single node's styles (extracted for reuse).
491
+ * Now uses unified style syncing with clear separation of concerns:
492
+ * 1. Canvas pixel refresh (if canvas clone)
493
+ * 2. Unified CSS property sync (all elements)
494
+ * 3. Content sync (text, input values)
388
495
  */
389
496
  function syncNodeStyles(node) {
390
497
  const { source, clone, isCanvasClone } = node;
391
- if (isCanvasClone) {
392
- const canvas = clone;
393
- const shadowCanvas = source.shadowRoot?.querySelector("canvas");
394
- const shadowImg = source.shadowRoot?.querySelector("img");
395
- if (shadowCanvas) {
396
- if (canvas.width !== shadowCanvas.width) canvas.width = shadowCanvas.width;
397
- if (canvas.height !== shadowCanvas.height) canvas.height = shadowCanvas.height;
398
- const ctx = canvas.getContext("2d");
399
- if (ctx && shadowCanvas.width > 0 && shadowCanvas.height > 0) try {
400
- ctx.clearRect(0, 0, canvas.width, canvas.height);
401
- ctx.drawImage(shadowCanvas, 0, 0);
402
- } catch (e) {
403
- logger.warn("[syncNodeStyles] Canvas draw failed:", e);
404
- }
405
- try {
406
- const canvasCs = getComputedStyle(shadowCanvas);
407
- const hostCs = getComputedStyle(source);
408
- const s = canvas.style;
409
- s.position = hostCs.position;
410
- s.top = hostCs.top;
411
- s.left = hostCs.left;
412
- s.right = hostCs.right;
413
- s.bottom = hostCs.bottom;
414
- s.margin = hostCs.margin;
415
- s.transform = hostCs.transform;
416
- s.transformOrigin = hostCs.transformOrigin;
417
- s.opacity = hostCs.opacity;
418
- s.visibility = hostCs.visibility;
419
- s.zIndex = hostCs.zIndex;
420
- s.width = canvasCs.width;
421
- s.height = canvasCs.height;
422
- s.backfaceVisibility = hostCs.backfaceVisibility;
423
- s.transformStyle = hostCs.transformStyle;
424
- } catch {}
425
- } else if (shadowImg?.complete && shadowImg.naturalWidth > 0) {
426
- if (canvas.width !== shadowImg.naturalWidth) canvas.width = shadowImg.naturalWidth;
427
- if (canvas.height !== shadowImg.naturalHeight) canvas.height = shadowImg.naturalHeight;
428
- const ctx = canvas.getContext("2d");
429
- if (ctx) {
430
- ctx.clearRect(0, 0, canvas.width, canvas.height);
431
- try {
432
- ctx.drawImage(shadowImg, 0, 0);
433
- } catch {}
434
- }
435
- try {
436
- const imgCs = getComputedStyle(shadowImg);
437
- const hostCs = getComputedStyle(source);
438
- const s = canvas.style;
439
- s.position = hostCs.position;
440
- s.top = hostCs.top;
441
- s.left = hostCs.left;
442
- s.right = hostCs.right;
443
- s.bottom = hostCs.bottom;
444
- s.margin = hostCs.margin;
445
- s.transform = hostCs.transform;
446
- s.transformOrigin = hostCs.transformOrigin;
447
- s.opacity = hostCs.opacity;
448
- s.visibility = hostCs.visibility;
449
- s.zIndex = hostCs.zIndex;
450
- s.width = imgCs.width;
451
- s.height = imgCs.height;
452
- s.backfaceVisibility = hostCs.backfaceVisibility;
453
- s.transformStyle = hostCs.transformStyle;
454
- } catch {}
455
- }
456
- }
457
- const cloneStyle = clone.style;
458
- const propLen = SYNC_PROPERTIES.length;
459
- const tagName = source.tagName;
460
- if (HAS_COMPUTED_STYLE_MAP) {
461
- let srcMap;
462
- try {
463
- srcMap = source.computedStyleMap();
464
- } catch {
465
- return;
466
- }
467
- for (let j = 0; j < propLen; j++) {
468
- const kebab = SYNC_PROPERTIES_KEBAB[j];
469
- const camel = SYNC_PROPERTIES[j];
470
- const srcVal = srcMap.get(kebab);
471
- if (!srcVal) continue;
472
- const strVal = srcVal.toString();
473
- if (camel === "display") {
474
- cloneStyle.display = strVal === "none" && !(tagName && (tagName === "EF-CAPTIONS-ACTIVE-WORD" || tagName === "EF-CAPTIONS-BEFORE-ACTIVE-WORD" || tagName === "EF-CAPTIONS-AFTER-ACTIVE-WORD" || tagName === "EF-CAPTIONS-SEGMENT")) ? "block" : strVal;
475
- continue;
476
- }
477
- if (camel === "clipPath") continue;
478
- if (isDefaultValue(camel, strVal)) {
479
- if (cloneStyle[camel]) cloneStyle[camel] = "";
480
- continue;
481
- }
482
- cloneStyle[camel] = strVal;
483
- }
484
- } else {
485
- let cs;
486
- try {
487
- cs = getComputedStyle(source);
488
- } catch {
489
- return;
490
- }
491
- const srcStyle = cs;
492
- for (const prop of SYNC_PROPERTIES) {
493
- const srcVal = srcStyle[prop];
494
- if (prop === "display") {
495
- cloneStyle.display = srcVal === "none" && !(tagName && (tagName === "EF-CAPTIONS-ACTIVE-WORD" || tagName === "EF-CAPTIONS-BEFORE-ACTIVE-WORD" || tagName === "EF-CAPTIONS-AFTER-ACTIVE-WORD" || tagName === "EF-CAPTIONS-SEGMENT")) ? "block" : srcVal;
496
- continue;
497
- }
498
- if (prop === "clipPath") continue;
499
- if (isDefaultValue(prop, srcVal)) {
500
- if (cloneStyle[prop]) cloneStyle[prop] = "";
501
- continue;
502
- }
503
- cloneStyle[prop] = srcVal;
504
- }
505
- }
506
- cloneStyle.animation = "none";
507
- cloneStyle.transition = "none";
508
- const srcTextNode = source.childNodes[0];
509
- if (srcTextNode?.nodeType === Node.TEXT_NODE) {
510
- const srcText = srcTextNode.textContent || "";
511
- const cloneTextNode = clone.childNodes[0];
512
- if (cloneTextNode?.nodeType === Node.TEXT_NODE) {
513
- if (cloneTextNode.textContent !== srcText) cloneTextNode.textContent = srcText;
514
- } else if (!clone.childNodes.length) clone.appendChild(document.createTextNode(srcText));
515
- }
516
- if (source instanceof HTMLInputElement) {
517
- const srcVal = source.value;
518
- const cloneInput = clone;
519
- if (cloneInput.value !== srcVal) {
520
- cloneInput.value = srcVal;
521
- cloneInput.setAttribute("value", srcVal);
522
- }
523
- }
498
+ if (isCanvasClone) refreshCanvasPixels(node);
499
+ syncElementStyles(source, clone, isCanvasClone ? source.shadowRoot?.querySelector("canvas") || source.shadowRoot?.querySelector("img") || void 0 : void 0);
500
+ syncTextContent(source, clone);
501
+ syncInputValue(source, clone);
524
502
  }
525
503
  let syncStats = {
526
504
  nodesVisited: 0,