@oim-media/core 1.27.8 → 1.27.9
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/LICENSE +55 -55
- package/NOTICE +6 -6
- package/README.md +133 -134
- package/dist/canonical.d.ts +25 -0
- package/dist/canonical.js +18 -1
- package/dist/compatibility.d.ts +1 -1
- package/dist/compatibility.js +2 -1
- package/dist/generative/primitives/blob.js +4 -4
- package/dist/generative/primitives/iso-grid.js +7 -7
- package/dist/generative/primitives/mesh.js +3 -3
- package/dist/parallaxCss.js +8 -8
- package/dist/patterns.js +9 -9
- package/package.json +2 -2
package/LICENSE
CHANGED
|
@@ -1,55 +1,55 @@
|
|
|
1
|
-
Apache License
|
|
2
|
-
|
|
3
|
-
Version 2.0, January 2004
|
|
4
|
-
|
|
5
|
-
http://www.apache.org/licenses/
|
|
6
|
-
|
|
7
|
-
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
8
|
-
|
|
9
|
-
1. Definitions.
|
|
10
|
-
|
|
11
|
-
"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
-
|
|
13
|
-
"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
|
|
14
|
-
|
|
15
|
-
"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
|
|
16
|
-
|
|
17
|
-
"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
|
|
18
|
-
|
|
19
|
-
"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
|
|
20
|
-
|
|
21
|
-
"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
|
|
22
|
-
|
|
23
|
-
"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
|
|
24
|
-
|
|
25
|
-
"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
|
|
26
|
-
|
|
27
|
-
"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
|
|
28
|
-
|
|
29
|
-
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
|
|
30
|
-
|
|
31
|
-
2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
|
|
32
|
-
|
|
33
|
-
3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
|
|
34
|
-
|
|
35
|
-
4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
|
|
36
|
-
|
|
37
|
-
You must give any other recipients of the Work or Derivative Works a copy of this License; and
|
|
38
|
-
|
|
39
|
-
You must cause any modified files to carry prominent notices stating that You changed the files; and
|
|
40
|
-
|
|
41
|
-
You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
|
|
42
|
-
|
|
43
|
-
If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
|
|
44
|
-
|
|
45
|
-
5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
|
|
46
|
-
|
|
47
|
-
6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
|
|
48
|
-
|
|
49
|
-
7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
|
|
50
|
-
|
|
51
|
-
8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
|
|
52
|
-
|
|
53
|
-
9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
|
|
54
|
-
|
|
55
|
-
END OF TERMS AND CONDITIONS
|
|
1
|
+
Apache License
|
|
2
|
+
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
|
|
5
|
+
http://www.apache.org/licenses/
|
|
6
|
+
|
|
7
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
8
|
+
|
|
9
|
+
1. Definitions.
|
|
10
|
+
|
|
11
|
+
"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
|
|
16
|
+
|
|
17
|
+
"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
|
|
18
|
+
|
|
19
|
+
"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
|
|
20
|
+
|
|
21
|
+
"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
|
|
22
|
+
|
|
23
|
+
"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
|
|
24
|
+
|
|
25
|
+
"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
|
|
26
|
+
|
|
27
|
+
"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
|
|
28
|
+
|
|
29
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
|
|
30
|
+
|
|
31
|
+
2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
|
|
32
|
+
|
|
33
|
+
3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
|
|
34
|
+
|
|
35
|
+
4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
|
|
36
|
+
|
|
37
|
+
You must give any other recipients of the Work or Derivative Works a copy of this License; and
|
|
38
|
+
|
|
39
|
+
You must cause any modified files to carry prominent notices stating that You changed the files; and
|
|
40
|
+
|
|
41
|
+
You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
|
|
42
|
+
|
|
43
|
+
If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
|
|
44
|
+
|
|
45
|
+
5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
|
|
46
|
+
|
|
47
|
+
6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
|
|
48
|
+
|
|
49
|
+
7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
|
|
50
|
+
|
|
51
|
+
8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
|
|
52
|
+
|
|
53
|
+
9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
|
|
54
|
+
|
|
55
|
+
END OF TERMS AND CONDITIONS
|
package/NOTICE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
OIM Ecosystem
|
|
2
|
-
Copyright 2026 Xue Studios LLC
|
|
3
|
-
|
|
4
|
-
This product includes software developed at Xue Studios LLC.
|
|
5
|
-
|
|
6
|
-
"OIM" and the "OIM compatible" mark are not licensed under Apache-2.0.
|
|
1
|
+
OIM Ecosystem
|
|
2
|
+
Copyright 2026 Xue Studios LLC
|
|
3
|
+
|
|
4
|
+
This product includes software developed at Xue Studios LLC.
|
|
5
|
+
|
|
6
|
+
"OIM" and the "OIM compatible" mark are not licensed under Apache-2.0.
|
package/README.md
CHANGED
|
@@ -1,134 +1,133 @@
|
|
|
1
|
-
# @oim-media/core
|
|
2
|
-
|
|
3
|
-
The shared core of the [OIM format](../../README.md): the contract schema, the
|
|
4
|
-
reader for the `.oim` container, the canonical form that signatures cover, and
|
|
5
|
-
the rendering rules that every player must apply the same way.
|
|
6
|
-
|
|
7
|
-
It is what the web players and the signing backend build on. You need it if you
|
|
8
|
-
read or write `.oim` metadata from TypeScript or JavaScript. You do not need it to
|
|
9
|
-
embed a file in a page; for that use [`@oim-media/player-oim`](../player-oim/README.md).
|
|
10
|
-
|
|
11
|
-
```bash
|
|
12
|
-
pnpm add @oim-media/core
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
- `
|
|
30
|
-
|
|
31
|
-
- `
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
- `
|
|
38
|
-
- `
|
|
39
|
-
- `
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
- `
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
-
|
|
68
|
-
|
|
69
|
-
`
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
- `
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
const
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
const
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
package
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
Apache-2.0. See [LICENSE](LICENSE) and [NOTICE](NOTICE).
|
|
1
|
+
# @oim-media/core
|
|
2
|
+
|
|
3
|
+
The shared core of the [OIM format](../../README.md): the contract schema, the
|
|
4
|
+
reader for the `.oim` container, the canonical form that signatures cover, and
|
|
5
|
+
the rendering rules that every player must apply the same way.
|
|
6
|
+
|
|
7
|
+
It is what the web players and the signing backend build on. You need it if you
|
|
8
|
+
read or write `.oim` metadata from TypeScript or JavaScript. You do not need it to
|
|
9
|
+
embed a file in a page; for that use [`@oim-media/player-oim`](../player-oim/README.md).
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
pnpm add @oim-media/core
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
It needs `crypto.subtle`, `Blob`, `DecompressionStream` and `TextDecoder`, which current
|
|
16
|
+
browsers and recent Node.js provide. It is ESM only and declares `sideEffects: false`, so
|
|
17
|
+
bundlers can drop what you do not import.
|
|
18
|
+
|
|
19
|
+
## What it exports
|
|
20
|
+
|
|
21
|
+
The root entry (`@oim-media/core`) re-exports everything below. Two subpaths
|
|
22
|
+
exist for code that must stay light: `@oim-media/core/api` (backend routes and
|
|
23
|
+
URLs only) and `@oim-media/core/generative` and `@oim-media/core/generative/catalog`.
|
|
24
|
+
|
|
25
|
+
**Contract and validation**
|
|
26
|
+
|
|
27
|
+
- `OimMetadataSchema`, `OvmMetadataSchema`, `OIMOrOVMMetadata`: Zod schemas of the
|
|
28
|
+
metadata. Types `OIMMetadata`, `OVMMetadata`, `Slot`, `TextMark`, `Reveal`, ...
|
|
29
|
+
- `CONTRACT_VERSION`: the contract version this build implements (`"1.27.9"`).
|
|
30
|
+
- `BASE_CONTRACT_VERSION`, `PLAYER_CAPABILITIES`, `VERSION_BY_CAPABILITY`, `minVersionFor`.
|
|
31
|
+
- `MAX_SLOTS`, `MAX_MARKS`, `MARK_NAME`, `PALETTE_NAME_PATTERN`, `CSS_GRADIENT_PATTERN`.
|
|
32
|
+
|
|
33
|
+
**Binary: reading and writing the container**
|
|
34
|
+
|
|
35
|
+
- `extractOIM(blob)`: returns `{ image, metadata, imageHash }`, where `image` is the PNG without the metadata chunk.
|
|
36
|
+
- `extractOIMMetadataFromStream(stream)`: metadata from a stream, reading only as far as needed.
|
|
37
|
+
- `fetchMetadataTail(url, tailBytes?)`: metadata from the end of a remote file with a range request.
|
|
38
|
+
- `compressAndEncodeJSON(obj)` and `decodeAndDecompressJSON(base64)`, `decompressBytes(bytes, format)`.
|
|
39
|
+
- `imageDataHash(arrayBuffer)`: SHA-256 (hex) of the PNG `IDAT` payloads. This is the image seal.
|
|
40
|
+
|
|
41
|
+
**Canonical form (the bytes a signature covers)**
|
|
42
|
+
|
|
43
|
+
- `serializeCanonical(metadata)`: returns the `Uint8Array` the signer hashes.
|
|
44
|
+
- `normalizeCanonicalNumbers(value)` and `sortKeysByCodePoint(value)`: the two rules used by `serializeCanonical`.
|
|
45
|
+
- `hasNumberOutOfRange(value)` and `MAX_CANONICAL_NUMBER`: whether metadata holds a number beyond ±(2^53 − 1), which has no canonical form; a signer refuses it and a verifier reports the signature as invalid.
|
|
46
|
+
|
|
47
|
+
Signature *verification* is not in this package. The player verifies with its
|
|
48
|
+
embedded keys (see [`@oim-media/spec`](../spec/README.md#embedded-player-keys)).
|
|
49
|
+
|
|
50
|
+
**Compatibility**
|
|
51
|
+
|
|
52
|
+
- `whatTheReaderCannotDo(metadata, { version, capabilities })`: returns a
|
|
53
|
+
`MissingSupport` report (required version, missing capabilities, `cannotRender`).
|
|
54
|
+
- `describeMissing(report)`: a human-readable sentence for that report.
|
|
55
|
+
|
|
56
|
+
**Re-edit permission**
|
|
57
|
+
|
|
58
|
+
- `permissionOf(metadata)`, `canReedit(permission, isAuthor)`, `mustRejectWithoutAsking(permission, isAuthor)`,
|
|
59
|
+
`registryQuery(permission)`, `permissionFields(permission)`, `signatureStamp(permission)`.
|
|
60
|
+
- `normalizeLegacyKeys(metadata)`: maps the Spanish keys of files signed before 1.23.0
|
|
61
|
+
(`reedicion` and its values) to the English ones. Call it **after** verifying the
|
|
62
|
+
signature, never before: the signature covers the keys as they were written.
|
|
63
|
+
|
|
64
|
+
**Rendering rules shared by the players**
|
|
65
|
+
|
|
66
|
+
- Layers and groups: `isGroup`, `slotParent`, `childrenByGroup`, `slotClipping`.
|
|
67
|
+
- Text: `resolveLineHeight`, `inkMargin`, `parseMarks`, `validateMarks`, `markStyle`,
|
|
68
|
+
`dropCapStyle`, `splitDropCap`, the entrance-effect functions (`entranceFrameAt`,
|
|
69
|
+
`entranceKeyframes`, ...).
|
|
70
|
+
- Fills, colours and palettes: `resolvePalette`, `resolveCssColor`, `isSafeCssColor`,
|
|
71
|
+
`DYNAMIC_COLOR_ROLES`, the fill and pattern engine in `fill.ts` and `patterns.ts`.
|
|
72
|
+
- Media: `mediaFilterCss`, `FILTER_PRESET_CSS`, `frame-silhouette`, `embeddedFonts`,
|
|
73
|
+
`artisticTextCurve`, `artisticTextExtrusion`, `geoShapes`, `cropping` helpers.
|
|
74
|
+
- Motion: `parallaxCss`, `oversizeScale`, `REVEAL_DEFAULT`, `flip`.
|
|
75
|
+
|
|
76
|
+
**Effects and generative content**
|
|
77
|
+
|
|
78
|
+
- `normalizeSlotEffects(style)`, `layerTextureMask(layer)`, `TEXTURE_CATALOG`.
|
|
79
|
+
- `renderGenerativeSVG(config, { width, height, bleed? })` and `GENERATOR_CATALOG`,
|
|
80
|
+
`getGeneratorSpec(id)` (from `@oim-media/core/generative`).
|
|
81
|
+
|
|
82
|
+
**Backend**
|
|
83
|
+
|
|
84
|
+
- `OIM_BACKEND_URL_DEFAULT`, `OIM_ENDPOINTS`, `OIM_PACKAGE_FIELDS`,
|
|
85
|
+
`resolveBackendUrl(override?)`, `oimEndpoint(name, backendUrl?)`.
|
|
86
|
+
|
|
87
|
+
## Examples
|
|
88
|
+
|
|
89
|
+
Read a file and check what it needs:
|
|
90
|
+
|
|
91
|
+
```ts
|
|
92
|
+
import { extractOIM, whatTheReaderCannotDo, describeMissing, CONTRACT_VERSION } from "@oim-media/core";
|
|
93
|
+
|
|
94
|
+
const file = await fetch("/art/poster.oim.png").then((r) => r.blob());
|
|
95
|
+
const { metadata, imageHash } = await extractOIM(file);
|
|
96
|
+
|
|
97
|
+
const report = whatTheReaderCannotDo(metadata, {
|
|
98
|
+
version: CONTRACT_VERSION,
|
|
99
|
+
capabilities: ["vector_parallax", "text_marks"],
|
|
100
|
+
});
|
|
101
|
+
if (report.cannotRender) console.warn(describeMissing(report));
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Check a re-edit permission after the signature has been verified:
|
|
105
|
+
|
|
106
|
+
```ts
|
|
107
|
+
import { normalizeLegacyKeys, canReedit, permissionOf } from "@oim-media/core";
|
|
108
|
+
|
|
109
|
+
const meta = normalizeLegacyKeys(verifiedMetadata); // verifiedMetadata: already checked by your verifier
|
|
110
|
+
const verdict = canReedit(permissionOf(meta), /* isAuthor */ null);
|
|
111
|
+
verdict.allowed; // false for "author_only" and "sealed" when the author is unknown
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
Only the `public` permission is granted without knowing who the user is.
|
|
115
|
+
|
|
116
|
+
Build the backend URL for a route:
|
|
117
|
+
|
|
118
|
+
```ts
|
|
119
|
+
import { oimEndpoint } from "@oim-media/core/api";
|
|
120
|
+
|
|
121
|
+
const url = oimEndpoint("compile"); // https://api.oim.media/v1/oim/compile
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
## Versioning
|
|
125
|
+
|
|
126
|
+
`CONTRACT_VERSION` is the version of the **format**, not of this package. The
|
|
127
|
+
package version and the contract version move together on each release tag, but a
|
|
128
|
+
package can change without the format changing. See the
|
|
129
|
+
[root README](../../README.md#versioning).
|
|
130
|
+
|
|
131
|
+
## Licence
|
|
132
|
+
|
|
133
|
+
Apache-2.0. See [LICENSE](LICENSE) and [NOTICE](NOTICE).
|
package/dist/canonical.d.ts
CHANGED
|
@@ -3,6 +3,31 @@
|
|
|
3
3
|
* Copyright (c) 2026 Xue Studios LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
+
/**
|
|
7
|
+
* Canonical serialization conforming to the 7 normative rules of the OIM specification
|
|
8
|
+
* (the BINARY_SPEC and README of the spec package) and the principles of RFC 8785 (JCS).
|
|
9
|
+
*
|
|
10
|
+
* SINGLE source of truth shared by @oim-media/core, @oim-media/cli and @oim-media/player-oim.
|
|
11
|
+
*
|
|
12
|
+
* The 7 canonical rules:
|
|
13
|
+
* 1. Deserialized base metadata object.
|
|
14
|
+
* 2. Strict exclusion at the root of: 'signature', 'key_version', 'timestamp', 'creator_user_id'.
|
|
15
|
+
* 3. Numeric normalization: decimals with a null fractional part become integers (2.0 -> 2);
|
|
16
|
+
* the rest is rounded to at most 6 decimals. A number that is not finite or lies
|
|
17
|
+
* beyond +/-(2^53 - 1) has no canonical form: see hasNumberOutOfRange.
|
|
18
|
+
* 4. Recursive lexical key ordering by Unicode code point (codePointAt).
|
|
19
|
+
* 5. Compact serialization without spaces between separators (',', ':').
|
|
20
|
+
* 6. Non-ASCII characters emitted directly in UTF-8 without escaping (no \uXXXX).
|
|
21
|
+
* 7. Native UTF-8 encoding.
|
|
22
|
+
*/
|
|
23
|
+
/** Largest magnitude a signed number may have: every JSON parser reads it exactly. */
|
|
24
|
+
export declare const MAX_CANONICAL_NUMBER: number;
|
|
25
|
+
/**
|
|
26
|
+
* Whether the metadata carries, at any depth, a number with no canonical form.
|
|
27
|
+
* Beyond 2^53 - 1 parsers disagree on the value they read, so signers refuse
|
|
28
|
+
* such metadata and verifiers report its signature as invalid.
|
|
29
|
+
*/
|
|
30
|
+
export declare function hasNumberOutOfRange(value: unknown): boolean;
|
|
6
31
|
/**
|
|
7
32
|
* Rule 3: integer floats are converted to int; the rest is rounded to 6 decimals.
|
|
8
33
|
*/
|
package/dist/canonical.js
CHANGED
|
@@ -13,12 +13,29 @@
|
|
|
13
13
|
* 1. Deserialized base metadata object.
|
|
14
14
|
* 2. Strict exclusion at the root of: 'signature', 'key_version', 'timestamp', 'creator_user_id'.
|
|
15
15
|
* 3. Numeric normalization: decimals with a null fractional part become integers (2.0 -> 2);
|
|
16
|
-
* the rest is rounded to at most 6 decimals.
|
|
16
|
+
* the rest is rounded to at most 6 decimals. A number that is not finite or lies
|
|
17
|
+
* beyond +/-(2^53 - 1) has no canonical form: see hasNumberOutOfRange.
|
|
17
18
|
* 4. Recursive lexical key ordering by Unicode code point (codePointAt).
|
|
18
19
|
* 5. Compact serialization without spaces between separators (',', ':').
|
|
19
20
|
* 6. Non-ASCII characters emitted directly in UTF-8 without escaping (no \uXXXX).
|
|
20
21
|
* 7. Native UTF-8 encoding.
|
|
21
22
|
*/
|
|
23
|
+
/** Largest magnitude a signed number may have: every JSON parser reads it exactly. */
|
|
24
|
+
export const MAX_CANONICAL_NUMBER = Number.MAX_SAFE_INTEGER;
|
|
25
|
+
/**
|
|
26
|
+
* Whether the metadata carries, at any depth, a number with no canonical form.
|
|
27
|
+
* Beyond 2^53 - 1 parsers disagree on the value they read, so signers refuse
|
|
28
|
+
* such metadata and verifiers report its signature as invalid.
|
|
29
|
+
*/
|
|
30
|
+
export function hasNumberOutOfRange(value) {
|
|
31
|
+
if (typeof value === 'number') {
|
|
32
|
+
return !Number.isFinite(value) || Math.abs(value) > MAX_CANONICAL_NUMBER;
|
|
33
|
+
}
|
|
34
|
+
if (value !== null && typeof value === 'object') {
|
|
35
|
+
return Object.values(value).some(hasNumberOutOfRange);
|
|
36
|
+
}
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
22
39
|
const EXCLUDED_ROOT_KEYS = new Set([
|
|
23
40
|
'signature',
|
|
24
41
|
'key_version',
|
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.27.
|
|
44
|
+
export declare const CONTRACT_VERSION = "1.27.9";
|
|
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.27.
|
|
44
|
+
export const CONTRACT_VERSION = "1.27.9";
|
|
45
|
+
// 1.27.9: numbers beyond +/-(2^53 - 1) have no canonical form; the Rust crate parses decimals exactly.
|
|
45
46
|
// 1.27.8: Flutter stroke and effects scale with the canvas; packages on npm, pub.dev and crates.io.
|
|
46
47
|
// 1.27.7: Flutter ignores textRuns and lays text out like the web; the Flutter viewer follows the system language; no format change.
|
|
47
48
|
// 1.27.6: a custom svgPath frame masks its fill-colour layer (web player); Flutter fixes (opacity 0..100, retired blendMode, media-filter scope, svgViewBox, container fills, default text colour); no format change.
|
|
@@ -54,10 +54,10 @@ export const renderBlob = (rawParams, ctx) => {
|
|
|
54
54
|
pathD += ` Q ${p1.x} ${p1.y}, ${midX} ${midY}`;
|
|
55
55
|
}
|
|
56
56
|
pathD += " Z";
|
|
57
|
-
markup += `
|
|
58
|
-
<g transform="translate(${tx}, ${ty})">
|
|
59
|
-
<path d="${pathD}" fill="${color}" opacity="${0.9 - b * 0.1}" />
|
|
60
|
-
</g>
|
|
57
|
+
markup += `
|
|
58
|
+
<g transform="translate(${tx}, ${ty})">
|
|
59
|
+
<path d="${pathD}" fill="${color}" opacity="${0.9 - b * 0.1}" />
|
|
60
|
+
</g>
|
|
61
61
|
`;
|
|
62
62
|
}
|
|
63
63
|
return markup;
|
|
@@ -34,17 +34,17 @@ export const renderIsoGrid = (rawParams, ctx) => {
|
|
|
34
34
|
if (hollow) {
|
|
35
35
|
// Hollow box frame
|
|
36
36
|
const inset = stepX * 0.2;
|
|
37
|
-
markup += `
|
|
38
|
-
<rect x="${x}" y="${y}" width="${stepX}" height="${stepY}" fill="none"${strokeAttr} />
|
|
39
|
-
<rect x="${x + inset}" y="${y + inset}" width="${stepX - inset * 2}" height="${stepY - inset * 2}" fill="${faceColor}" opacity="0.65" />
|
|
37
|
+
markup += `
|
|
38
|
+
<rect x="${x}" y="${y}" width="${stepX}" height="${stepY}" fill="none"${strokeAttr} />
|
|
39
|
+
<rect x="${x + inset}" y="${y + inset}" width="${stepX - inset * 2}" height="${stepY - inset * 2}" fill="${faceColor}" opacity="0.65" />
|
|
40
40
|
`;
|
|
41
41
|
}
|
|
42
42
|
else {
|
|
43
43
|
// 3D extruded cube with faces in perspective
|
|
44
|
-
markup += `
|
|
45
|
-
<rect x="${x}" y="${y}" width="${stepX}" height="${stepY}" fill="url(#${sharedGradId})"${strokeAttr} />
|
|
46
|
-
<polygon points="${x},${y} ${x + extrudeOffset},${y - extrudeOffset} ${x + stepX + extrudeOffset},${y - extrudeOffset} ${x + stepX},${y}" fill="${faceColor}" opacity="0.75" />
|
|
47
|
-
<polygon points="${x + stepX},${y} ${x + stepX + extrudeOffset},${y - extrudeOffset} ${x + stepX + extrudeOffset},${y + stepY - extrudeOffset} ${x + stepX},${y + stepY}" fill="#000000" opacity="0.35" />
|
|
44
|
+
markup += `
|
|
45
|
+
<rect x="${x}" y="${y}" width="${stepX}" height="${stepY}" fill="url(#${sharedGradId})"${strokeAttr} />
|
|
46
|
+
<polygon points="${x},${y} ${x + extrudeOffset},${y - extrudeOffset} ${x + stepX + extrudeOffset},${y - extrudeOffset} ${x + stepX},${y}" fill="${faceColor}" opacity="0.75" />
|
|
47
|
+
<polygon points="${x + stepX},${y} ${x + stepX + extrudeOffset},${y - extrudeOffset} ${x + stepX + extrudeOffset},${y + stepY - extrudeOffset} ${x + stepX},${y + stepY}" fill="#000000" opacity="0.35" />
|
|
48
48
|
`;
|
|
49
49
|
}
|
|
50
50
|
}
|
|
@@ -39,9 +39,9 @@ export const renderMesh = (rawParams, ctx) => {
|
|
|
39
39
|
const color1 = ctx.ramp(triangleIndex++, totalTriangles);
|
|
40
40
|
const color2 = ctx.ramp(triangleIndex++, totalTriangles);
|
|
41
41
|
const strokeAttr = borderWidth > 0 ? ` stroke="${params.borderColor || color1}" stroke-width="${borderWidth}" stroke-linejoin="bevel"` : "";
|
|
42
|
-
markup += `
|
|
43
|
-
<polygon points="${p1.x},${p1.y} ${p2.x},${p2.y} ${p3.x},${p3.y}" fill="${color1}"${strokeAttr} />
|
|
44
|
-
<polygon points="${p2.x},${p2.y} ${p4.x},${p4.y} ${p3.x},${p3.y}" fill="${color2}"${strokeAttr} />
|
|
42
|
+
markup += `
|
|
43
|
+
<polygon points="${p1.x},${p1.y} ${p2.x},${p2.y} ${p3.x},${p3.y}" fill="${color1}"${strokeAttr} />
|
|
44
|
+
<polygon points="${p2.x},${p2.y} ${p4.x},${p4.y} ${p3.x},${p3.y}" fill="${color2}"${strokeAttr} />
|
|
45
45
|
`;
|
|
46
46
|
}
|
|
47
47
|
}
|
package/dist/parallaxCss.js
CHANGED
|
@@ -27,14 +27,14 @@ const SEAM_OVERLAP_PX = 1;
|
|
|
27
27
|
* means "pause while the cursor is over it"; without the variable, the default
|
|
28
28
|
* `running` leaves the animation as it was.
|
|
29
29
|
*/
|
|
30
|
-
export const CSS_PARALLAX = `@keyframes oim-parallax-infinite {
|
|
31
|
-
0% { transform: translateX(0px); }
|
|
32
|
-
100% { transform: translateX(calc(-1 * var(--oim-parallax-unit, 0px))); }
|
|
33
|
-
}
|
|
34
|
-
.${TRACK_CLASS}, .${LEGACY_TRACK_CLASS} { display: flex; width: max-content; will-change: transform; }
|
|
35
|
-
.${TRACK_CLASS}:hover, .${LEGACY_TRACK_CLASS}:hover { animation-play-state: var(--oim-parallax-hover, running); }
|
|
36
|
-
@media (prefers-reduced-motion: reduce) {
|
|
37
|
-
.${TRACK_CLASS}, .${LEGACY_TRACK_CLASS} { animation: none !important; }
|
|
30
|
+
export const CSS_PARALLAX = `@keyframes oim-parallax-infinite {
|
|
31
|
+
0% { transform: translateX(0px); }
|
|
32
|
+
100% { transform: translateX(calc(-1 * var(--oim-parallax-unit, 0px))); }
|
|
33
|
+
}
|
|
34
|
+
.${TRACK_CLASS}, .${LEGACY_TRACK_CLASS} { display: flex; width: max-content; will-change: transform; }
|
|
35
|
+
.${TRACK_CLASS}:hover, .${LEGACY_TRACK_CLASS}:hover { animation-play-state: var(--oim-parallax-hover, running); }
|
|
36
|
+
@media (prefers-reduced-motion: reduce) {
|
|
37
|
+
.${TRACK_CLASS}, .${LEGACY_TRACK_CLASS} { animation: none !important; }
|
|
38
38
|
}`;
|
|
39
39
|
/**
|
|
40
40
|
* Translates an infinite layer's configuration into pure CSS styles.
|
package/dist/patterns.js
CHANGED
|
@@ -134,20 +134,20 @@ export function generatePatternSVG(options) {
|
|
|
134
134
|
const fillAttr = isStrokeOnly ? 'none' : color;
|
|
135
135
|
const strokeAttr = isStrokeOnly ? color : 'none';
|
|
136
136
|
const strokeWidthAttr = isStrokeOnly ? '1.5' : '0';
|
|
137
|
-
patternContent += `
|
|
138
|
-
<g transform="translate(${x}, ${y}) scale(${scaleVar}) rotate(${rotVar}) translate(-12, -12)" fill="${fillAttr}" stroke="${strokeAttr}" stroke-width="${strokeWidthAttr}" stroke-linecap="round" stroke-linejoin="round">
|
|
139
|
-
${contentSvg}
|
|
140
|
-
</g>
|
|
137
|
+
patternContent += `
|
|
138
|
+
<g transform="translate(${x}, ${y}) scale(${scaleVar}) rotate(${rotVar}) translate(-12, -12)" fill="${fillAttr}" stroke="${strokeAttr}" stroke-width="${strokeWidthAttr}" stroke-linecap="round" stroke-linejoin="round">
|
|
139
|
+
${contentSvg}
|
|
140
|
+
</g>
|
|
141
141
|
`;
|
|
142
142
|
}
|
|
143
143
|
}
|
|
144
144
|
}
|
|
145
145
|
}
|
|
146
|
-
const svgString = `
|
|
147
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="${baseSize}" height="${baseSize}" viewBox="0 0 ${baseSize} ${baseSize}">
|
|
148
|
-
<rect width="100%" height="100%" fill="${bgColor}" />
|
|
149
|
-
${patternContent}
|
|
150
|
-
</svg>
|
|
146
|
+
const svgString = `
|
|
147
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="${baseSize}" height="${baseSize}" viewBox="0 0 ${baseSize} ${baseSize}">
|
|
148
|
+
<rect width="100%" height="100%" fill="${bgColor}" />
|
|
149
|
+
${patternContent}
|
|
150
|
+
</svg>
|
|
151
151
|
`;
|
|
152
152
|
return `data:image/svg+xml;utf8,${encodeURIComponent(svgString.replace(/\s+/g, ' ').trim())}`;
|
|
153
153
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oim-media/core",
|
|
3
|
-
"version": "1.27.
|
|
3
|
+
"version": "1.27.9",
|
|
4
4
|
"description": "Core of the OIM format: the contract schema, binary extraction from PNG and the shared rendering logic used by every OIM player.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"oim",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"@types/node": "^25.9.9",
|
|
47
47
|
"ajv": "^8.20.0",
|
|
48
48
|
"typescript": "~6.0.3",
|
|
49
|
-
"vitest": "^5.0
|
|
49
|
+
"vitest": "^5.1.0"
|
|
50
50
|
},
|
|
51
51
|
"publishConfig": {
|
|
52
52
|
"access": "public",
|