@oim-media/player-oim 1.32.1 → 1.32.3
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 +102 -15
- package/dist/oim-player.js +12 -12
- package/dist/vendor/oim-upgrade-46b8ceeec5ee.js +1 -0
- package/package.json +2 -2
- package/dist/vendor/oim-upgrade-f077d5a5cfc2.js +0 -1
- /package/dist/vendor/{oim-generative-f077d5a5cfc2.js → oim-generative-46b8ceeec5ee.js} +0 -0
- /package/dist/vendor/{oim-patterns-f077d5a5cfc2.js → oim-patterns-46b8ceeec5ee.js} +0 -0
package/dist/esm/index.js
CHANGED
|
@@ -1871,7 +1871,12 @@ function convertPaints(ctx, slot, layer) {
|
|
|
1871
1871
|
const markup = drawsMarkup(slot);
|
|
1872
1872
|
const tint = markup ? colorOf(ctx, style, "strokeColor", "strokeColorRole") : void 0;
|
|
1873
1873
|
if (markup) ctx.take(style, "strokeWidth");
|
|
1874
|
-
|
|
1874
|
+
const gradientStroke = markup && ctx.take(style, "strokePaint") === "gradient" ? gradientOf(ctx, style, "strokeGradient", "style") : void 0;
|
|
1875
|
+
if (markup) ctx.take(style, "strokeGradient");
|
|
1876
|
+
let outline = gradientStroke ? {
|
|
1877
|
+
paint: gradientStroke,
|
|
1878
|
+
width: 0
|
|
1879
|
+
} : tint !== void 0 ? {
|
|
1875
1880
|
paint: {
|
|
1876
1881
|
kind: "color",
|
|
1877
1882
|
value: tint
|
|
@@ -5705,6 +5710,52 @@ function typographyCss(layer, lang) {
|
|
|
5705
5710
|
if (text.decoration) css.textDecoration = text.decoration;
|
|
5706
5711
|
return css;
|
|
5707
5712
|
}
|
|
5713
|
+
// ../core/src/v2/svg-gradient.ts
|
|
5714
|
+
/**
|
|
5715
|
+
* @license
|
|
5716
|
+
* Copyright (c) 2026 Xue Studios LLC
|
|
5717
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5718
|
+
*/
|
|
5719
|
+
/**
|
|
5720
|
+
* A gradient as an SVG <linearGradient>/<radialGradient> in viewBox units
|
|
5721
|
+
* (`userSpaceOnUse`), so a multi-path drawing reads as one piece. The editor and
|
|
5722
|
+
* the player both draw with this, so they cannot disagree on the direction.
|
|
5723
|
+
* CSS angles: 0deg points up and turns clockwise; the line crosses the box centre.
|
|
5724
|
+
* A radial is centred and reaches the farthest corner (the CSS default).
|
|
5725
|
+
*/
|
|
5726
|
+
function svgGradientAttrs(gradient, viewBox) {
|
|
5727
|
+
const [vx, vy, vw, vh] = viewBox;
|
|
5728
|
+
const cx = vx + vw / 2;
|
|
5729
|
+
const cy = vy + vh / 2;
|
|
5730
|
+
const n = gradient.stops.length;
|
|
5731
|
+
const stops = gradient.stops.map((s, i) => ({
|
|
5732
|
+
offset: `${Math.round((s.at ?? i / (n - 1)) * 1e4) / 100}%`,
|
|
5733
|
+
color: s.color
|
|
5734
|
+
}));
|
|
5735
|
+
if (gradient.type === "radial") return {
|
|
5736
|
+
tag: "radialGradient",
|
|
5737
|
+
attrs: {
|
|
5738
|
+
cx,
|
|
5739
|
+
cy,
|
|
5740
|
+
r: Math.hypot(vw / 2, vh / 2)
|
|
5741
|
+
},
|
|
5742
|
+
stops
|
|
5743
|
+
};
|
|
5744
|
+
const rad = ((gradient.angle ?? 180) - 90) * Math.PI / 180;
|
|
5745
|
+
const half = (Math.abs(vw * Math.cos(rad)) + Math.abs(vh * Math.sin(rad))) / 2;
|
|
5746
|
+
const dx = Math.cos(rad) * half;
|
|
5747
|
+
const dy = Math.sin(rad) * half;
|
|
5748
|
+
return {
|
|
5749
|
+
tag: "linearGradient",
|
|
5750
|
+
attrs: {
|
|
5751
|
+
x1: cx - dx,
|
|
5752
|
+
y1: cy - dy,
|
|
5753
|
+
x2: cx + dx,
|
|
5754
|
+
y2: cy + dy
|
|
5755
|
+
},
|
|
5756
|
+
stops
|
|
5757
|
+
};
|
|
5758
|
+
}
|
|
5708
5759
|
// ../scene/src/legacy/localizedEntries.ts
|
|
5709
5760
|
/**
|
|
5710
5761
|
* @license
|
|
@@ -5980,6 +6031,7 @@ var safeColor = (c) => c && !/[;{}<>"]|url\(|expression\(/i.test(c) ? c : void 0
|
|
|
5980
6031
|
* Colours go through CSSOM: a role is a var(), and an invalid value is dropped,
|
|
5981
6032
|
* not injected into the markup.
|
|
5982
6033
|
*/
|
|
6034
|
+
var gradientIds = 0;
|
|
5983
6035
|
function drawingSvg(geometry, link, tile = false) {
|
|
5984
6036
|
const NS = "http://www.w3.org/2000/svg";
|
|
5985
6037
|
const svg = document.createElementNS(NS, "svg");
|
|
@@ -5991,11 +6043,25 @@ function drawingSvg(geometry, link, tile = false) {
|
|
|
5991
6043
|
svg.setAttribute("preserveAspectRatio", "xMidYMid meet");
|
|
5992
6044
|
svg.style.setProperty("display", "block");
|
|
5993
6045
|
}
|
|
6046
|
+
let strokeUrl;
|
|
6047
|
+
if (link.strokeGradient) {
|
|
6048
|
+
const { tag, attrs, stops } = svgGradientAttrs(link.strokeGradient, geometry.viewBox);
|
|
6049
|
+
const grad = svg.appendChild(document.createElementNS(NS, "defs")).appendChild(document.createElementNS(NS, tag));
|
|
6050
|
+
grad.id = `oim-sg-${++gradientIds}`;
|
|
6051
|
+
grad.setAttribute("gradientUnits", "userSpaceOnUse");
|
|
6052
|
+
for (const [k, v] of Object.entries(attrs)) grad.setAttribute(k, String(v));
|
|
6053
|
+
for (const st of stops) {
|
|
6054
|
+
const stop = grad.appendChild(document.createElementNS(NS, "stop"));
|
|
6055
|
+
stop.setAttribute("offset", st.offset);
|
|
6056
|
+
stop.setAttribute("stop-color", safeColor(st.color) ?? "#000");
|
|
6057
|
+
}
|
|
6058
|
+
strokeUrl = `url(#${grad.id})`;
|
|
6059
|
+
}
|
|
5994
6060
|
for (const p of geometry.paths) {
|
|
5995
6061
|
const el = document.createElementNS(NS, "path");
|
|
5996
6062
|
el.setAttribute("d", p.d);
|
|
5997
6063
|
const fill = safeColor(p.fill === "currentColor" ? link.fill ?? "currentColor" : p.fill);
|
|
5998
|
-
const stroke = safeColor(p.stroke === "currentColor" ? link.stroke ?? "currentColor" : p.stroke);
|
|
6064
|
+
const stroke = strokeUrl ?? safeColor(p.stroke === "currentColor" ? link.stroke ?? "currentColor" : p.stroke);
|
|
5999
6065
|
if (tile) {
|
|
6000
6066
|
el.setAttribute("fill", fill ?? "none");
|
|
6001
6067
|
if (stroke) el.setAttribute("stroke", stroke);
|
|
@@ -6019,14 +6085,23 @@ function paintedByFillLayer(layer) {
|
|
|
6019
6085
|
const kind = (layer.fills?.[0])?.kind;
|
|
6020
6086
|
return kind === "gradient" || kind === "pattern" || kind === "generative";
|
|
6021
6087
|
}
|
|
6022
|
-
/** The colour a drawing's `currentColor` takes, as CSS or as a literal for a baked tile. */
|
|
6023
6088
|
function drawingLink(layer, color) {
|
|
6024
6089
|
const flat = (paint) => paint && typeof paint === "object" && paint.kind === "color" ? color(paint.value) : void 0;
|
|
6025
6090
|
const fill = flat(layer.fills?.[0]);
|
|
6026
|
-
const
|
|
6091
|
+
const paint = layer.strokes?.[0]?.paint;
|
|
6092
|
+
const stroke = flat(paint);
|
|
6093
|
+
const g = paint?.kind === "gradient" && paint.gradient?.type !== "conic" ? paint.gradient : void 0;
|
|
6094
|
+
const strokeGradient = g && {
|
|
6095
|
+
...g,
|
|
6096
|
+
stops: g.stops.map((s) => ({
|
|
6097
|
+
...s,
|
|
6098
|
+
color: color(s.color) ?? s.color
|
|
6099
|
+
}))
|
|
6100
|
+
};
|
|
6027
6101
|
return {
|
|
6028
6102
|
fill: fill ?? stroke,
|
|
6029
|
-
stroke: stroke ?? fill
|
|
6103
|
+
stroke: stroke ?? fill,
|
|
6104
|
+
...strokeGradient && { strokeGradient }
|
|
6030
6105
|
};
|
|
6031
6106
|
}
|
|
6032
6107
|
// ../scene/src/legacy/legacy-view.ts
|
|
@@ -7226,7 +7301,7 @@ function nextWheelZoom(zoom, deltaY, deltaMode, pinch) {
|
|
|
7226
7301
|
* the format can change without the player being touched. Tying both numbers
|
|
7227
7302
|
* together would make an internal fix look like a format break.
|
|
7228
7303
|
*/
|
|
7229
|
-
var CONTRACT_VERSION = "1.32.
|
|
7304
|
+
var CONTRACT_VERSION = "1.32.3";
|
|
7230
7305
|
/**
|
|
7231
7306
|
* What the player implements TODAY, measured and not assumed.
|
|
7232
7307
|
*
|
|
@@ -10622,6 +10697,7 @@ var LegacyRenderer = class {
|
|
|
10622
10697
|
pauseOnHover: !!v2Scroll.pauseOnHover
|
|
10623
10698
|
} : void 0;
|
|
10624
10699
|
let duplicatedForInfinite = false;
|
|
10700
|
+
let loopTrack;
|
|
10625
10701
|
if (parallaxCfg && parallaxCfg.enabled) {
|
|
10626
10702
|
const inf = parallaxCfg.infinite || {};
|
|
10627
10703
|
const speedPxSec = inf.enabled === false || self._isStill() ? 0 : parallaxCfg.speedPxSec !== void 0 ? parallaxCfg.speedPxSec : inf.speedPxSec !== void 0 ? inf.speedPxSec : inf.speed_px_sec !== void 0 ? inf.speed_px_sec : parallaxCfg.mode === "infinite_horizontal" ? parallaxCfg.speed !== void 0 ? parallaxCfg.speed : 20 : 0;
|
|
@@ -10637,7 +10713,7 @@ var LegacyRenderer = class {
|
|
|
10637
10713
|
if (plan.duplicate) {
|
|
10638
10714
|
duplicatedForInfinite = true;
|
|
10639
10715
|
ensureParallaxKeyframes(self.host.shadowRoot);
|
|
10640
|
-
const track = document.createElement("div");
|
|
10716
|
+
const track = loopTrack = document.createElement("div");
|
|
10641
10717
|
track.className = `${TRACK_CLASS} ${LEGACY_TRACK_CLASS}`;
|
|
10642
10718
|
for (const [k, v] of Object.entries(plan.container)) track.style.setProperty(k, v);
|
|
10643
10719
|
for (let i = 0; i < plan.copies; i++) {
|
|
@@ -10812,7 +10888,13 @@ var LegacyRenderer = class {
|
|
|
10812
10888
|
else if (outline.style === "dotted") figure.setAttribute("stroke-dasharray", "2,3");
|
|
10813
10889
|
}
|
|
10814
10890
|
svg.appendChild(figure);
|
|
10815
|
-
|
|
10891
|
+
if (loopTrack) {
|
|
10892
|
+
loopTrack.style.height = "100%";
|
|
10893
|
+
for (const piece of loopTrack.children) {
|
|
10894
|
+
piece.style.cssText += "position:relative;height:100%";
|
|
10895
|
+
piece.append(svg.cloneNode(true));
|
|
10896
|
+
}
|
|
10897
|
+
} else slotEl.append(svg);
|
|
10816
10898
|
if (imageFill) mountImageFill(slotEl, v2Fill, {
|
|
10817
10899
|
d: silhouette.d ?? "M " + silhouette.points.split(" ").join(" L ") + " Z",
|
|
10818
10900
|
viewBox: silhouette.viewBox
|
|
@@ -11101,6 +11183,7 @@ var LegacyRenderer = class {
|
|
|
11101
11183
|
} : void 0;
|
|
11102
11184
|
if (animSource && !self.disableAnimations) {
|
|
11103
11185
|
const anim = animSource;
|
|
11186
|
+
const paintedLayers = () => [...slotEl.children].filter((el) => el.classList.contains("oim-fill-layer") || el.tagName.toLowerCase() === "svg");
|
|
11104
11187
|
if (anim.frames && typeof loopWrap.animate === "function") {
|
|
11105
11188
|
const animDuration = anim.duration;
|
|
11106
11189
|
{
|
|
@@ -11115,17 +11198,21 @@ var LegacyRenderer = class {
|
|
|
11115
11198
|
if (onAction) {
|
|
11116
11199
|
instance.pause();
|
|
11117
11200
|
instance.currentTime = 0;
|
|
11118
|
-
} else {
|
|
11119
|
-
|
|
11120
|
-
|
|
11201
|
+
} else for (const painted of [instance, ...paintedLayers().map((el) => el.animate(frames, {
|
|
11202
|
+
duration: animDuration * 1e3,
|
|
11203
|
+
iterations: Infinity,
|
|
11204
|
+
easing: "linear"
|
|
11205
|
+
}))]) {
|
|
11206
|
+
if (self._paused) painted.pause();
|
|
11207
|
+
self._animations.push(painted);
|
|
11121
11208
|
}
|
|
11122
11209
|
self._timelines.set(String(slot.id), instance);
|
|
11123
11210
|
}
|
|
11124
11211
|
}
|
|
11125
|
-
if (anim.loop && anim.loop !== "none" && anim.loop !== "custom") {
|
|
11126
|
-
|
|
11127
|
-
if (anim.loopDuration)
|
|
11128
|
-
if (anim.loopDelay)
|
|
11212
|
+
if (anim.loop && anim.loop !== "none" && anim.loop !== "custom") for (const el of [loopWrap, ...paintedLayers()]) {
|
|
11213
|
+
el.classList.add("oim-loop-" + anim.loop);
|
|
11214
|
+
if (anim.loopDuration) el.style.setProperty("--oim-loop-duration", anim.loopDuration + "s");
|
|
11215
|
+
if (anim.loopDelay) el.style.setProperty("--oim-loop-delay", anim.loopDelay + "s");
|
|
11129
11216
|
}
|
|
11130
11217
|
if (anim.hover && anim.hover !== "none" && anim.hover !== "custom") hoverWrap.classList.add("oim-hover-" + anim.hover);
|
|
11131
11218
|
}
|