@oim-media/core 1.32.1 → 1.32.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 +1 -1
- package/dist/compatibility.d.ts +1 -1
- package/dist/compatibility.js +2 -1
- package/dist/v2/index.d.ts +1 -0
- package/dist/v2/index.js +1 -0
- package/dist/v2/svg-gradient.d.ts +44 -0
- package/dist/v2/svg-gradient.js +21 -0
- package/dist/v2/upgrade/paints.js +7 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -26,7 +26,7 @@ URLs only) and `@oim-media/core/generative` and `@oim-media/core/generative/cata
|
|
|
26
26
|
|
|
27
27
|
- `OimMetadataSchema`, `OvmMetadataSchema`, `OIMOrOVMMetadata`: Zod schemas of the
|
|
28
28
|
metadata. Types `OIMMetadata`, `OVMMetadata`, `Slot`, `TextMark`, `Reveal`, ...
|
|
29
|
-
- `CONTRACT_VERSION`: the contract version this build implements (`"1.32.
|
|
29
|
+
- `CONTRACT_VERSION`: the contract version this build implements (`"1.32.2"`).
|
|
30
30
|
- `BASE_CONTRACT_VERSION`, `PLAYER_CAPABILITIES`, `VERSION_BY_CAPABILITY`, `minVersionFor`.
|
|
31
31
|
- `MAX_SLOTS`, `MAX_MARKS`, `MARK_NAME`, `PALETTE_NAME_PATTERN`, `CSS_GRADIENT_PATTERN`.
|
|
32
32
|
|
package/dist/compatibility.d.ts
CHANGED
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
* the format can change without the player being touched. Tying both numbers
|
|
42
42
|
* together would make an internal fix look like a format break.
|
|
43
43
|
*/
|
|
44
|
-
export declare const CONTRACT_VERSION = "1.32.
|
|
44
|
+
export declare const CONTRACT_VERSION = "1.32.2";
|
|
45
45
|
/**
|
|
46
46
|
* The first version of the format. Whatever requires nothing more requires this.
|
|
47
47
|
*
|
package/dist/compatibility.js
CHANGED
|
@@ -41,7 +41,8 @@
|
|
|
41
41
|
* the format can change without the player being touched. Tying both numbers
|
|
42
42
|
* together would make an internal fix look like a format break.
|
|
43
43
|
*/
|
|
44
|
-
export const CONTRACT_VERSION = "1.32.
|
|
44
|
+
export const CONTRACT_VERSION = "1.32.2";
|
|
45
|
+
// 1.32.2: an SVG layer's gradient stroke (strokePaint: gradient) upgrades to strokes[0].paint and the player paints it; a looping shape scrolls its silhouette; no format change.
|
|
45
46
|
// 1.32.1: an SVG icon with a gradient, pattern or generative fill keeps its paths (upgrade falls back to svgRawXml) and the player cuts that fill to them; no format change.
|
|
46
47
|
// 1.32.0: additive, no existing file changes: a mask takes any frame shape and a window frame takes the fill* paints; a filter takes a shape (geoShape) and a rounded clip; the player draws duotone in sRGB and no longer offsets window frames and filters vertically; mask silhouettes come from the shared catalogue (one changed-pixel exception, see CHANGELOG).
|
|
47
48
|
// 1.31.0: no format change; the 2.0 scene painter paints blur, shadow, glow and backdrop effects.
|
package/dist/v2/index.d.ts
CHANGED
package/dist/v2/index.js
CHANGED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) 2026 Xue Studios LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import type { Gradient } from "./upgrade/gradient.js";
|
|
7
|
+
/**
|
|
8
|
+
* A gradient as an SVG <linearGradient>/<radialGradient> in viewBox units
|
|
9
|
+
* (`userSpaceOnUse`), so a multi-path drawing reads as one piece. The editor and
|
|
10
|
+
* the player both draw with this, so they cannot disagree on the direction.
|
|
11
|
+
* CSS angles: 0deg points up and turns clockwise; the line crosses the box centre.
|
|
12
|
+
* A radial is centred and reaches the farthest corner (the CSS default).
|
|
13
|
+
*/
|
|
14
|
+
export declare function svgGradientAttrs(gradient: Gradient, viewBox: number[]): {
|
|
15
|
+
tag: string;
|
|
16
|
+
attrs: {
|
|
17
|
+
cx: number;
|
|
18
|
+
cy: number;
|
|
19
|
+
r: number;
|
|
20
|
+
x1?: undefined;
|
|
21
|
+
y1?: undefined;
|
|
22
|
+
x2?: undefined;
|
|
23
|
+
y2?: undefined;
|
|
24
|
+
};
|
|
25
|
+
stops: {
|
|
26
|
+
offset: string;
|
|
27
|
+
color: string;
|
|
28
|
+
}[];
|
|
29
|
+
} | {
|
|
30
|
+
tag: string;
|
|
31
|
+
attrs: {
|
|
32
|
+
x1: number;
|
|
33
|
+
y1: number;
|
|
34
|
+
x2: number;
|
|
35
|
+
y2: number;
|
|
36
|
+
cx?: undefined;
|
|
37
|
+
cy?: undefined;
|
|
38
|
+
r?: undefined;
|
|
39
|
+
};
|
|
40
|
+
stops: {
|
|
41
|
+
offset: string;
|
|
42
|
+
color: string;
|
|
43
|
+
}[];
|
|
44
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A gradient as an SVG <linearGradient>/<radialGradient> in viewBox units
|
|
3
|
+
* (`userSpaceOnUse`), so a multi-path drawing reads as one piece. The editor and
|
|
4
|
+
* the player both draw with this, so they cannot disagree on the direction.
|
|
5
|
+
* CSS angles: 0deg points up and turns clockwise; the line crosses the box centre.
|
|
6
|
+
* A radial is centred and reaches the farthest corner (the CSS default).
|
|
7
|
+
*/
|
|
8
|
+
export function svgGradientAttrs(gradient, viewBox) {
|
|
9
|
+
const [vx, vy, vw, vh] = viewBox;
|
|
10
|
+
const cx = vx + vw / 2;
|
|
11
|
+
const cy = vy + vh / 2;
|
|
12
|
+
const n = gradient.stops.length;
|
|
13
|
+
const stops = gradient.stops.map((s, i) => ({ offset: `${Math.round((s.at ?? i / (n - 1)) * 1e4) / 100}%`, color: s.color }));
|
|
14
|
+
if (gradient.type === "radial")
|
|
15
|
+
return { tag: "radialGradient", attrs: { cx, cy, r: Math.hypot(vw / 2, vh / 2) }, stops };
|
|
16
|
+
const rad = (((gradient.angle ?? 180) - 90) * Math.PI) / 180;
|
|
17
|
+
const half = (Math.abs(vw * Math.cos(rad)) + Math.abs(vh * Math.sin(rad))) / 2;
|
|
18
|
+
const dx = Math.cos(rad) * half;
|
|
19
|
+
const dy = Math.sin(rad) * half;
|
|
20
|
+
return { tag: "linearGradient", attrs: { x1: cx - dx, y1: cy - dy, x2: cx + dx, y2: cy + dy }, stops };
|
|
21
|
+
}
|
|
@@ -196,8 +196,13 @@ export function convertPaints(ctx, slot, layer) {
|
|
|
196
196
|
const tint = markup ? colorOf(ctx, style, "strokeColor", "strokeColorRole") : undefined;
|
|
197
197
|
if (markup)
|
|
198
198
|
ctx.take(style, "strokeWidth");
|
|
199
|
-
|
|
200
|
-
|
|
199
|
+
// The editor's `strokePaint: "gradient"` paints every stroke of the drawing with a gradient.
|
|
200
|
+
const gradientStroke = markup && ctx.take(style, "strokePaint") === "gradient" ? gradientOf(ctx, style, "strokeGradient", "style") : undefined;
|
|
201
|
+
if (markup)
|
|
202
|
+
ctx.take(style, "strokeGradient");
|
|
203
|
+
let outline = gradientStroke ? { paint: gradientStroke, width: 0 }
|
|
204
|
+
: tint !== undefined ? { paint: { kind: "color", value: tint }, width: 0 }
|
|
205
|
+
: strokeOf(ctx, style, "strokeColor", "strokeWidth", dashed, "strokeColorRole");
|
|
201
206
|
// The scribble is an open stroke with no fill: 1.x gave it a stroke of its own when it had
|
|
202
207
|
// none, 2 px wide and in its stroke colour, else its fill colour, else blue.
|
|
203
208
|
if (!outline && style.geoShape === "scribble") {
|
package/package.json
CHANGED