@oim-media/player-oim 1.32.0 → 1.32.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/esm/index.js CHANGED
@@ -2298,6 +2298,11 @@ function shapeGeometry(ctx, slot, media) {
2298
2298
  kind: "paths",
2299
2299
  ...parsed.value
2300
2300
  };
2301
+ const original = xml !== rawXml && typeof rawXml === "string" && rawXml ? svgToPaths(rawXml) : void 0;
2302
+ if (original?.ok) return {
2303
+ kind: "paths",
2304
+ ...original.value
2305
+ };
2301
2306
  ctx.note(`style.svgRawXml: ${parsed.reason}`);
2302
2307
  return { kind: "rect" };
2303
2308
  }
@@ -6009,6 +6014,11 @@ function drawingSvg(geometry, link, tile = false) {
6009
6014
  }
6010
6015
  return svg.outerHTML;
6011
6016
  }
6017
+ /** A drawing whose first fill is not a flat colour: the fill layer paints it, cut to the paths. */
6018
+ function paintedByFillLayer(layer) {
6019
+ const kind = (layer.fills?.[0])?.kind;
6020
+ return kind === "gradient" || kind === "pattern" || kind === "generative";
6021
+ }
6012
6022
  /** The colour a drawing's `currentColor` takes, as CSS or as a literal for a baked tile. */
6013
6023
  function drawingLink(layer, color) {
6014
6024
  const flat = (paint) => paint && typeof paint === "object" && paint.kind === "color" ? color(paint.value) : void 0;
@@ -7216,7 +7226,7 @@ function nextWheelZoom(zoom, deltaY, deltaMode, pinch) {
7216
7226
  * the format can change without the player being touched. Tying both numbers
7217
7227
  * together would make an internal fix look like a format break.
7218
7228
  */
7219
- var CONTRACT_VERSION = "1.32.0";
7229
+ var CONTRACT_VERSION = "1.32.1";
7220
7230
  /**
7221
7231
  * What the player implements TODAY, measured and not assumed.
7222
7232
  *
@@ -10367,7 +10377,10 @@ var LegacyRenderer = class {
10367
10377
  const v2Words = v2Own.type === "text" ? v2Own.text?.content : void 0;
10368
10378
  const v2Image = slotType === "image" ? v2Own.image : void 0;
10369
10379
  const v2Drawing = v2Own.type === "shape" && v2Own.geometry?.kind === "paths" && !geometryOutline(v2Own.geometry).path ? v2Own.geometry : void 0;
10370
- let rawText = v2Words ? resolveContent(v2Words, self.lang) : v2Image ? imageSrc(v2Image.src, self.lang) : v2Drawing && !isBackground(slot) ? drawingSvg(v2Drawing, drawingLink(v2Own, v2Colors.css)) : v2Own.type === "lottie" ? v2Own.lottie?.src ?? "" : localized.content;
10380
+ let rawText = v2Words ? resolveContent(v2Words, self.lang) : v2Image ? imageSrc(v2Image.src, self.lang) : v2Drawing && !isBackground(slot) ? drawingSvg(v2Drawing, paintedByFillLayer(v2Own) ? {
10381
+ ...drawingLink(v2Own, v2Colors.css),
10382
+ fill: "none"
10383
+ } : drawingLink(v2Own, v2Colors.css)) : v2Own.type === "lottie" ? v2Own.lottie?.src ?? "" : localized.content;
10371
10384
  const isInteractiveSlot = !self.disableActions && (!!v2Own.interactions?.length || !!v2Own.animations?.some((a) => a.on === "hover" || a.on === "press"));
10372
10385
  const isWindowMask = slotType === "mask" && style.maskMode !== "cutout";
10373
10386
  const isArtisticText = slotType === "artistic-text";
@@ -10741,7 +10754,7 @@ var LegacyRenderer = class {
10741
10754
  const v2Fill = v2Own.fills?.[0];
10742
10755
  const fillKind = v2Fill && "kind" in v2Fill ? v2Fill.kind : void 0;
10743
10756
  const shapeOutline = geometryOutline(v2Own.type === "shape" ? v2Own.geometry : void 0);
10744
- const isVectorFill = (slotType === "svg" || isSvg) && !isWindowMask && (fillKind === "pattern" || fillKind === "generative");
10757
+ const isVectorFill = (slotType === "svg" || isSvg) && !isWindowMask && (fillKind === "pattern" || fillKind === "generative" || fillKind === "gradient" && !!v2Drawing);
10745
10758
  const fillImageSrc = isGeoLike && !isWindowMask && fillKind === "image" ? String(v2Fill.src || "").trim() : "";
10746
10759
  const imageSrcSafe = !!fillImageSrc && isSandboxImageSrc(fillImageSrc);
10747
10760
  const hasComplexFill = isVectorFill || (slotType === "geo" || slotType === "shape") && !isWindowMask && (imageSrcSafe || fillKind === "gradient" || fillKind === "generative" || fillKind === "pattern" && !isBackgroundSlot);
@@ -10826,13 +10839,7 @@ var LegacyRenderer = class {
10826
10839
  if (hasComplexFill) {
10827
10840
  const fillLayer = document.createElement("div");
10828
10841
  fillLayer.className = "oim-fill-layer";
10829
- fillLayer.style.position = "absolute";
10830
- fillLayer.style.left = "0";
10831
- fillLayer.style.top = "0";
10832
- fillLayer.style.width = "100%";
10833
- fillLayer.style.height = "100%";
10834
- fillLayer.style.pointerEvents = "none";
10835
- fillLayer.style.borderRadius = "inherit";
10842
+ fillLayer.style.cssText = "position:absolute;inset:0;pointer-events:none;border-radius:inherit";
10836
10843
  const fillCss = {
10837
10844
  ...v2Fill ? paintCss(v2Fill, {
10838
10845
  colors: v2Colors,
@@ -10846,8 +10853,14 @@ var LegacyRenderer = class {
10846
10853
  } : void 0)
10847
10854
  };
10848
10855
  if (isVectorFill && !loopWrap.style.position) loopWrap.style.position = "relative";
10849
- for (const [prop, value] of Object.entries(fillCss)) if (prop.startsWith("--")) fillLayer.style.setProperty(prop, value);
10850
- else fillLayer.style[prop] = value;
10856
+ const moves = fillCss.animation && fillCss.maskImage;
10857
+ const painted = moves ? fillLayer.appendChild(document.createElement("div")) : fillLayer;
10858
+ if (moves) painted.style.cssText = fillLayer.style.cssText;
10859
+ for (const [prop, value] of Object.entries(fillCss)) {
10860
+ const target = moves && /mask/i.test(prop) ? fillLayer : painted;
10861
+ if (prop.startsWith("--")) target.style.setProperty(prop, value);
10862
+ else target.style[prop] = value;
10863
+ }
10851
10864
  slotEl.insertBefore(fillLayer, slotEl.firstChild);
10852
10865
  }
10853
10866
  if (isWindowMask) {