@oim-media/player-oim 1.30.1 → 1.30.2
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/README.md +5 -5
- package/dist/esm/index.js +30 -5
- package/dist/oim-player.js +6 -6
- package/dist/vendor/oim-upgrade-788e5348ee7b.js +1 -0
- package/package.json +2 -2
- package/dist/vendor/oim-upgrade-6293d5f72228.js +0 -1
- /package/dist/vendor/{oim-generative-6293d5f72228.js → oim-generative-788e5348ee7b.js} +0 -0
- /package/dist/vendor/{oim-patterns-6293d5f72228.js → oim-patterns-788e5348ee7b.js} +0 -0
package/README.md
CHANGED
|
@@ -26,9 +26,9 @@ import "@oim-media/player-oim";
|
|
|
26
26
|
```
|
|
27
27
|
|
|
28
28
|
The second form is also reachable as the subpath `@oim-media/player-oim/cdn`.
|
|
29
|
-
The single file is about **
|
|
30
|
-
in it:
|
|
31
|
-
file under a
|
|
29
|
+
The single file is about **53 KB gzip** and includes the verifier. Lottie, generative fills and pattern tiles are not
|
|
30
|
+
in it: each is loaded from `dist/vendor/`, next to the player, only when a file uses it. A test keeps the
|
|
31
|
+
file under a 55 KB budget.
|
|
32
32
|
|
|
33
33
|
## Usage
|
|
34
34
|
|
|
@@ -211,8 +211,8 @@ from `https://api.oim.media/v1/media/keys`. A page can point that at its own
|
|
|
211
211
|
backend with `window.OIM_PLAYER_CONFIG = { keysUrl: "..." }`, set before the
|
|
212
212
|
player loads. The player never holds a private key.
|
|
213
213
|
|
|
214
|
-
Network use: the `.oim` file itself, the key endpoint when needed, and the Lottie
|
|
215
|
-
|
|
214
|
+
Network use: the `.oim` file itself, the key endpoint when needed, and the optional parts (Lottie, generative fills, pattern tiles)
|
|
215
|
+
from the package's `dist/vendor/` when a file uses them. The player makes
|
|
216
216
|
no analytics requests.
|
|
217
217
|
|
|
218
218
|
A valid signature proves the file has not changed since it was signed. It does not
|
package/dist/esm/index.js
CHANGED
|
@@ -2244,12 +2244,16 @@ function imageSource(slot, value) {
|
|
|
2244
2244
|
modes
|
|
2245
2245
|
} : value;
|
|
2246
2246
|
}
|
|
2247
|
-
function pathsFromLayers(ctx, layers, viewBox) {
|
|
2247
|
+
function pathsFromLayers(ctx, layers, viewBox, original = []) {
|
|
2248
2248
|
const paths = [];
|
|
2249
2249
|
for (const item of layers) {
|
|
2250
2250
|
const part = asObject(item);
|
|
2251
2251
|
if (!part || typeof part.d !== "string" || !part.d) continue;
|
|
2252
2252
|
const entry = { d: part.d };
|
|
2253
|
+
if (part.fill === void 0 && part.stroke === void 0) {
|
|
2254
|
+
const { d: _, ...inherited } = original.find((path) => path.d === part.d) ?? { d: "" };
|
|
2255
|
+
Object.assign(entry, inherited);
|
|
2256
|
+
}
|
|
2253
2257
|
if (typeof part.fill === "string" && part.fill !== "none") entry.fill = part.fill;
|
|
2254
2258
|
if (typeof part.stroke === "string" && part.stroke !== "none") {
|
|
2255
2259
|
entry.stroke = part.stroke;
|
|
@@ -2273,11 +2277,20 @@ function shapeGeometry(ctx, slot, media) {
|
|
|
2273
2277
|
const viewBox = viewBoxOf(ctx.take(style, "svgViewBox"));
|
|
2274
2278
|
const rawXml = ctx.take(style, "svgRawXml");
|
|
2275
2279
|
const layers = ctx.take(style, "svgLayers");
|
|
2280
|
+
const content = drawsMarkup(slot) && typeof media === "string" && /<svg/i.test(media) ? media : void 0;
|
|
2281
|
+
if (content) {
|
|
2282
|
+
const parsed = svgToPaths(content);
|
|
2283
|
+
if (parsed.ok) return {
|
|
2284
|
+
kind: "paths",
|
|
2285
|
+
...parsed.value
|
|
2286
|
+
};
|
|
2287
|
+
}
|
|
2276
2288
|
if (Array.isArray(layers) && layers.length > 0) {
|
|
2277
|
-
const
|
|
2289
|
+
const original = typeof rawXml === "string" && rawXml ? svgToPaths(rawXml) : void 0;
|
|
2290
|
+
const fromLayers = pathsFromLayers(ctx, layers, viewBox, original?.ok ? original.value.paths : []);
|
|
2278
2291
|
if (fromLayers) return fromLayers;
|
|
2279
2292
|
}
|
|
2280
|
-
const xml =
|
|
2293
|
+
const xml = content ?? (typeof rawXml === "string" && rawXml ? rawXml : drawsMarkup(slot) ? media : void 0);
|
|
2281
2294
|
if (xml) {
|
|
2282
2295
|
const parsed = svgToPaths(xml);
|
|
2283
2296
|
if (parsed.ok) return {
|
|
@@ -3580,6 +3593,7 @@ function legacyView(document) {
|
|
|
3580
3593
|
languages: document.languages,
|
|
3581
3594
|
slots
|
|
3582
3595
|
};
|
|
3596
|
+
if (document.canvas.fills?.length) view.canvasFills = document.canvas.fills;
|
|
3583
3597
|
if (document.fonts) view.fonts = document.fonts;
|
|
3584
3598
|
const palettes = palettesOf(document.variables);
|
|
3585
3599
|
if (palettes) view.palettes = palettes;
|
|
@@ -4723,7 +4737,7 @@ function nextWheelZoom(zoom, deltaY, deltaMode, pinch) {
|
|
|
4723
4737
|
* the format can change without the player being touched. Tying both numbers
|
|
4724
4738
|
* together would make an internal fix look like a format break.
|
|
4725
4739
|
*/
|
|
4726
|
-
var CONTRACT_VERSION = "1.30.
|
|
4740
|
+
var CONTRACT_VERSION = "1.30.2";
|
|
4727
4741
|
/**
|
|
4728
4742
|
* What the player implements TODAY, measured and not assumed.
|
|
4729
4743
|
*
|
|
@@ -9883,6 +9897,15 @@ var LegacyRenderer = class {
|
|
|
9883
9897
|
const groupChildren = childrenByGroup(slots);
|
|
9884
9898
|
const v2Layers = v2LayersOf(self.metadata);
|
|
9885
9899
|
const v2Colors = paintColors(self.metadata);
|
|
9900
|
+
const canvasFill = self.metadata.canvasFills?.[0];
|
|
9901
|
+
if (canvasFill && self._overlay && !onlyIds) {
|
|
9902
|
+
const css = paintCss(canvasFill, {
|
|
9903
|
+
colors: v2Colors,
|
|
9904
|
+
width: self.metadata.canvas_width,
|
|
9905
|
+
height: self.metadata.canvas_height
|
|
9906
|
+
});
|
|
9907
|
+
for (const [prop, value] of Object.entries(css)) self._overlay.style[prop] = value;
|
|
9908
|
+
}
|
|
9886
9909
|
const v2Literal = (v) => v && typeof v === "object" && typeof v.fallback === "string" ? v2Colors.literal(v.fallback) : v2Colors.literal(v);
|
|
9887
9910
|
const slotPromises = slots.map(async (slot) => {
|
|
9888
9911
|
const slotType = slot.type;
|
|
@@ -10285,7 +10308,8 @@ var LegacyRenderer = class {
|
|
|
10285
10308
|
const underFill = v2Own.fills?.[1];
|
|
10286
10309
|
const underColor = fillKind === "image" && underFill?.kind === "color" ? v2Colors.css(underFill.value) : void 0;
|
|
10287
10310
|
const resolvedBgColor = fillKind === "color" ? v2Colors.css(v2Fill.value) : imageSrcSafe ? void 0 : underColor;
|
|
10288
|
-
|
|
10311
|
+
const isDrawing = v2Own?.type === "shape" && v2Own.geometry?.kind === "paths";
|
|
10312
|
+
if (resolvedBgColor && isGeoLike && !isWindowMask && slotType !== "text" && !isArtisticText && !hasComplexFill && !isDrawing) slotEl.style.setProperty("background-color", resolvedBgColor);
|
|
10289
10313
|
const hasVector = slotType === "svg" || isSvg || v2Own.geometry?.kind === "paths" || isGeoLike && !!shapeOutline.silhouette;
|
|
10290
10314
|
const v2Layer = v2Layers.get(String(slot.id));
|
|
10291
10315
|
const v2Stroke = v2Layer?.strokes?.find((s) => !s.align && "kind" in s.paint && s.paint.kind === "color" && typeof s.width === "number");
|
|
@@ -10407,6 +10431,7 @@ var LegacyRenderer = class {
|
|
|
10407
10431
|
transformX = duplicatedForInfinite || textAlign === "left" ? "0%" : textAlign === "right" ? "-100%" : "-50%";
|
|
10408
10432
|
const share = transformX === "0%" ? 0 : transformX === "-100%" ? 1 : .5;
|
|
10409
10433
|
slotEl.style.left = (box.x + box.width * share).toFixed(2) + "px";
|
|
10434
|
+
if (share > 0 && paintsText && !isArtisticText) slotEl.style.left = `calc(${slotEl.style.left} + ${.25 * share}em)`;
|
|
10410
10435
|
slotEl.style.top = (box.y + box.height / 2).toFixed(2) + "px";
|
|
10411
10436
|
} else {
|
|
10412
10437
|
[transformX, transformY] = anchorShift(box);
|