@oim-media/spec 1.36.9 → 1.37.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/CANONICAL_SPEC.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  > This document describes **1.x** (legacy, no longer painted by readers). The current format is OIM 2.0: see [CANONICAL_SPEC_2.md](CANONICAL_SPEC_2.md).
4
4
 
5
- **Contract version:** 1.36.9
5
+ **Contract version:** 1.37.1
6
6
  **Date:** 2026-11-02 (reviewed against `packages/core/src/schema.ts`; the source of truth is the schema, this document summarises it)
7
7
  **Status:** Normative / In force
8
8
  **License:** Apache-2.0
@@ -6,7 +6,7 @@ SPDX-License-Identifier: Apache-2.0
6
6
  # OIM 2.0 Canonical Specification
7
7
 
8
8
  **Document version emitted by the reference writer:** `2.0.0` (`DOCUMENT_VERSION` in `@oim-media/core/v2`)
9
- **Contract release this text was checked against:** 1.36.9
9
+ **Contract release this text was checked against:** 1.37.1
10
10
  **Status:** Normative
11
11
  **License:** Apache-2.0
12
12
  **Authority:** Xue Studios LLC
@@ -235,7 +235,7 @@ A **paint** is one of the following objects. `opacity` is a number 0..1 on every
235
235
  | `kind` | Fields |
236
236
  |---|---|
237
237
  | `color` | `value`: a colour (3.5). |
238
- | `gradient` | `gradient` or `preset` (exactly one). `gradient`: `type` (`linear` \| `radial` \| `conic`), `angle` (number), `stops` (2..32 of `{ color, at }`, `at` 0..1). `preset`: a name ≤64. |
238
+ | `gradient` | `gradient` or `preset` (exactly one). `gradient`: `type` (`linear` \| `radial` \| `conic`), `angle` (number), `stops` (2..32 of `{ color, at }`, `at` 0..1). `preset`: a name ≤64, one of `sunset-gold`, `metallic-chrome` or `neon-glow` (their stops are in `gradient-presets.json`); a reader paints an unknown preset as nothing. |
239
239
  | `image` | `src` (string; a `data:image/` URI), `fit` (`contain` \| `cover` \| `fill` \| `none` \| `scale-down`), `crop` (`{ x: 0..100, y: 0..100, zoom: 1..10 }`), `flipX`, `flipY`, `filters` (3.8). |
240
240
  | `pattern` | `pattern`: `preset` (name ≤64), `colors` (≤16 colours), `bg` (colour), `scale`, `sizes`/`counts`/`dispersions` (numbers, ≤16), `svgs` (strings, ≤16), `fit` (≤32), `motion` (`direction`: `right` \| `left` \| `up` \| `down` \| `zoom-in` \| `zoom-out` \| `pulse`; `period` >0; `speed`), `tile`: `{ viewBox: number[4], paths: pathEntry[1..64] }` (a stored drawing; with it `preset` and `svgs` are ignored). |
241
241
  | `generative` | `generative`: `generatorId` (`^[a-z0-9-]+$`, ≤64), `seed` (number), `params` (map of ≤64-char keys to number, string ≤256 or boolean), `colors` (`mode`: `monochrome` \| `palette`; `stops`: ≤16 colours; `direction`: `forward` \| `reverse` \| `radial`; `background`: colour; `backgroundVisible`: boolean). |
@@ -283,8 +283,9 @@ Effects apply in array order to the whole layer.
283
283
  ### 3.7. Geometry and corners
284
284
 
285
285
  `geometry` (required on `shape`) is discriminated by `kind`. Every kind may carry `trim`
286
- (`{ start?: 0..1, end?: 0..1 }`, how much of the outline is drawn). The reference painter draws it on a figure
287
- it draws as an SVG outline (a preset, a line, an ellipse, a single path); a plain rectangle is not trimmed.
286
+ (`{ start?: 0..1, end?: 0..1 }`, how much of the outline's stroke is drawn, as a share of its total length).
287
+ A rectangle's outline is inset by half the stroke, rounded by its first corner, and starts after its top-left
288
+ corner; a drawing trims each of its paths. A dashed or dotted stroke keeps its dashes inside the trim.
288
289
 
289
290
  | `kind` | Fields |
290
291
  |---|---|
@@ -427,6 +428,12 @@ for that role, else its `fallback`, else it paints nothing. The active palette i
427
428
  matches the viewer's colour scheme; else `defaults.palette`. A host page may override a role with the CSS
428
429
  custom property `--oim-color-<role>`.
429
430
 
431
+ A length bound by `{ "var": name }` (a font size, a `maxWidth`, a stroke `width`) takes `values[name]` when it
432
+ is a number, or a string that reads as one. When `values[name]` is a map option → number, the length has a
433
+ value per mode: the option named in `defaults` is its value (else its `fallback`, else the first option), and
434
+ the reader selects the other options by language, as for an exception. A stroke width takes the value alone.
435
+ With no number for it and no `fallback`, the length is absent. The cases are in `length-binding-cases.json`.
436
+
430
437
  ### 3.15. Resources
431
438
 
432
439
  `resources` maps a name to a paint. A `{ "ref": name }` in `canvas.fills`, a layer's `fills`, a stroke's `paint`
@@ -704,9 +711,9 @@ Embedding the document changes no `IDAT` byte.
704
711
  The 2.0 conformance corpus is `vectors-2/`: 48 signed `.oim.png` files that exercise text and multilingual
705
712
  content, strokes, effects, masks, patterns, generative and image fills, animation presets, interactions, groups,
706
713
  loops, palettes, fonts and re-edit. Each has a golden image `vectors-2/golden/<name>.web.png` rendered by the web
707
- reference (one vector, `background-pattern-order`, has none yet). A vector has no `.expected.json`: the
714
+ reference. A vector has no `.expected.json`: the
708
715
  expectation is the golden. Known differences of a renderer go in an `exceptions.json` beside the goldens, with a
709
- reason; an excepted vector that passes fails the run (`vectors-2/golden` has none today).
716
+ reason; an excepted vector that passes fails the run.
710
717
 
711
718
  Procedure (800 px wide, device pixel ratio 1, animations disabled, white background, `sans-serif` host font),
712
719
  metric (pixel channel difference above 40, 3 × 3 erosion, fail above 0.4 % area or a 576 px blob) and
@@ -776,25 +783,16 @@ A writer is checked by validating its documents against `schema/oim2.schema.json
776
783
 
777
784
  ## 11. Appendix D: what the schema allows and the reference painter does not draw
778
785
 
779
- Checked against the working tree that follows release 1.36.9. A reader that does not draw one of these is still
786
+ Checked against the working tree that follows release 1.37.1. A reader that does not draw one of these is still
780
787
  conforming to the schema; a writer SHOULD NOT rely on them being painted.
781
788
 
782
- - A gradient paint with `preset` and no `gradient`: the reference painter reads the preset only for an artistic
783
- text (`text.artistic`), where it names the gradient type. On any other fill it draws nothing; writers SHOULD
784
- give an explicit `gradient`. (Kept in the schema because a signed vector, `artistic-text`, uses it.)
785
- - Length bindings `{ var }` for `font.size`, `maxWidth` and a stroke's `width` are not resolved; literals and
786
- `{ value, modes }` are. Nothing in this repository writes them. Readers MAY ignore them; colour bindings are
787
- resolved.
788
789
  - A `{ ref }` chain through several resources beyond four steps: not drawn.
789
790
  - Text marks in 2.0 are not limited by the schema to the 1.x pattern `^[a-z][a-z0-9-]{0,23}$` and 8 per
790
791
  layer; writers SHOULD respect them because the shared parser of `{name}…{/name}` does.
791
- - A trim is not drawn on a rectangle (a box, no outline) or on a drawing of several paths.
792
- - A trimmed stroke drops a dashed or dotted style; the trim replaces it.
793
792
  - A figure's stroke width is in layer pixels and scales with the figure, like the rest of the layer (no
794
793
  `vector-effect: non-scaling-stroke`); at any display size it keeps the same share of the figure.
795
- - A feathered cutout edge is drawn hard.
796
- - The reference player does not check the per-layer schema limits (fills, strokes, effects, animations, interactions, actions, tracks, keyframes, gradient stops, paths and the like); only 150 per list, 1000 total, depth 32 and 10 MiB.
794
+ - The reference player checks the lists inside each layer (fills, strokes, effects, animations, interactions, tracks, keyframes, actions, gradient stops, paths, pattern tile paths) but not the canvas's own fills or a pattern's colour and size lists.
797
795
 
798
- Painted since the draft of this appendix: `geometry.trim` and the `trimStart` / `trimEnd` tracks, an animation
796
+ Painted since the draft of this appendix: a cutout's `feather` (its edge blurred by that standard deviation), length bindings `{ var }`, a gradient `preset` on any fill, `geometry.trim` and the `trimStart` / `trimEnd` tracks, an animation
799
797
  `on: "press"`, `animation.stagger`, a layer's own `languages`, `extensionsRequired` (refusal), and a cutout mask
800
798
  inside a group. The root `timestamp` is part of the schema (section 1.2).
@@ -0,0 +1,64 @@
1
+ {
2
+ "sunset-gold": {
3
+ "type": "linear",
4
+ "angle": 180,
5
+ "stops": [
6
+ {
7
+ "color": "#FDE047",
8
+ "at": 0
9
+ },
10
+ {
11
+ "color": "#F97316",
12
+ "at": 0.5
13
+ },
14
+ {
15
+ "color": "#BE185D",
16
+ "at": 1
17
+ }
18
+ ]
19
+ },
20
+ "metallic-chrome": {
21
+ "type": "linear",
22
+ "angle": 180,
23
+ "stops": [
24
+ {
25
+ "color": "#FFFFFF",
26
+ "at": 0
27
+ },
28
+ {
29
+ "color": "#E2E8F0",
30
+ "at": 0.35
31
+ },
32
+ {
33
+ "color": "#64748B",
34
+ "at": 0.5
35
+ },
36
+ {
37
+ "color": "#0F172A",
38
+ "at": 0.51
39
+ },
40
+ {
41
+ "color": "#94A3B8",
42
+ "at": 0.75
43
+ },
44
+ {
45
+ "color": "#FFFFFF",
46
+ "at": 1
47
+ }
48
+ ]
49
+ },
50
+ "neon-glow": {
51
+ "type": "linear",
52
+ "angle": 90,
53
+ "stops": [
54
+ {
55
+ "color": "#67E8F9",
56
+ "at": 0
57
+ },
58
+ {
59
+ "color": "#A5F3FC",
60
+ "at": 1
61
+ }
62
+ ]
63
+ }
64
+ }
@@ -0,0 +1,26 @@
1
+ [
2
+ { "name": "a number value", "variables": { "values": { "h": 24 } }, "binding": { "var": "h" }, "expected": 24 },
3
+ { "name": "a numeric string value", "variables": { "values": { "h": "24.5" } }, "binding": { "var": "h" }, "expected": 24.5 },
4
+ { "name": "no value: the fallback", "variables": {}, "binding": { "var": "h", "fallback": 12 }, "expected": 12 },
5
+ { "name": "no value and no fallback: removed", "variables": {}, "binding": { "var": "h" }, "expected": null },
6
+ { "name": "a non-numeric value: the fallback", "variables": { "values": { "h": "big" } }, "binding": { "var": "h", "fallback": 9 }, "expected": 9 },
7
+ {
8
+ "name": "per mode, the default mode is the value",
9
+ "variables": { "modes": { "language": ["es", "en"] }, "defaults": { "language": "en" }, "values": { "h": { "es": 30, "en": 24 } } },
10
+ "binding": { "var": "h", "fallback": 10 },
11
+ "expected": { "value": 24, "modes": { "es": 30, "en": 24 } }
12
+ },
13
+ {
14
+ "name": "per mode, no default: the fallback is the value",
15
+ "variables": { "values": { "h": { "es": 30, "en": 24 } } },
16
+ "binding": { "var": "h", "fallback": 10 },
17
+ "expected": { "value": 10, "modes": { "es": 30, "en": 24 } }
18
+ },
19
+ {
20
+ "name": "per mode, no default and no fallback: the first mode",
21
+ "variables": { "values": { "h": { "es": 30, "en": 24 } } },
22
+ "binding": { "var": "h" },
23
+ "expected": { "value": 30, "modes": { "es": 30, "en": 24 } }
24
+ },
25
+ { "name": "an inherited name is not a variable", "variables": { "values": {} }, "binding": { "var": "constructor", "fallback": 7 }, "expected": 7 }
26
+ ]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oim-media/spec",
3
- "version": "1.36.9",
3
+ "version": "1.37.1",
4
4
  "description": "OIM format contract: JSON Schema, normative specification and conformance vectors that every OIM player must pass.",
5
5
  "keywords": [
6
6
  "oim",
@@ -21,6 +21,8 @@
21
21
  "SPEC_2.md",
22
22
  "README.md",
23
23
  "marks-cases.json",
24
+ "length-binding-cases.json",
25
+ "gradient-presets.json",
24
26
  "canonical-cases.json",
25
27
  "keyframe-cases.json",
26
28
  "action-cases.json",
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
- "$id": "https://oim.media/spec/1.36.9/oim.schema.json",
3
+ "$id": "https://oim.media/spec/1.37.1/oim.schema.json",
4
4
  "title": "OIM document metadata",
5
- "specVersion": "1.36.9",
5
+ "specVersion": "1.37.1",
6
6
  "type": "object",
7
7
  "properties": {
8
8
  "description": {
Binary file
Binary file