@cosmicdrift/kumiko-types 0.190.0 → 0.192.0
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/package.json +1 -1
- package/src/derivatives-types.ts +13 -0
- package/src/fields.ts +7 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cosmicdrift/kumiko-types",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.192.0",
|
|
4
4
|
"description": "Framework-Type-Definitions für Kumiko — FeatureDefinition, BootCheck-Types und die reinen Engine-Types. Erlaubt Downstream-Konsumenten, gegen die Type-Contracts zu bauen, ohne das ganze Framework-Package zu importieren. Enthaelt keine identitaets-sensitiven Runtime-Werte mehr (Error-Klassen leben seit #1629 in kumiko-framework, Brand-Symbole nutzen Symbol.for) und ist deshalb eine plain dependency, keine peerDependency.",
|
|
5
5
|
"license": "BUSL-1.1",
|
|
6
6
|
"author": "Marc Frost <marc@cosmicdriftgamestudio.com>",
|
package/src/derivatives-types.ts
CHANGED
|
@@ -4,6 +4,18 @@
|
|
|
4
4
|
export type VariantFit = "cover" | "inside" | "contain";
|
|
5
5
|
export type VariantFormat = "webp" | "avif" | "jpeg";
|
|
6
6
|
|
|
7
|
+
// Rectangle in relative coordinates (0…1 of width/height) so it survives a
|
|
8
|
+
// resize. Burning blur into plates/faces needs coordinates that only exist at
|
|
9
|
+
// runtime (detection + user correction), so they ride in the spec instead of a
|
|
10
|
+
// field declaration — the spec hash keys the cache, so corrected regions
|
|
11
|
+
// automatically yield a fresh URL.
|
|
12
|
+
export type BlurRegion = {
|
|
13
|
+
readonly x: number;
|
|
14
|
+
readonly y: number;
|
|
15
|
+
readonly width: number;
|
|
16
|
+
readonly height: number;
|
|
17
|
+
};
|
|
18
|
+
|
|
7
19
|
export type VariantSpec = {
|
|
8
20
|
// Default "inside" when omitted (renderer-side default, Schnitt 2).
|
|
9
21
|
readonly fit?: VariantFit;
|
|
@@ -14,6 +26,7 @@ export type VariantSpec = {
|
|
|
14
26
|
readonly quality?: number;
|
|
15
27
|
// Whole-image blur radius.
|
|
16
28
|
readonly blur?: number;
|
|
29
|
+
readonly blurRegions?: readonly BlurRegion[];
|
|
17
30
|
};
|
|
18
31
|
|
|
19
32
|
// A renderer turns the original bytes + a spec into the derived bytes for one
|
package/src/fields.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
// --- Field Types ---
|
|
2
2
|
|
|
3
|
+
import type { VariantSpec } from "./derivatives-types";
|
|
4
|
+
|
|
3
5
|
// OwnershipMap is declared in ./ownership.ts — field-access maps to
|
|
4
6
|
// per-role ownership rules. A legacy `readonly string[]` form is still
|
|
5
7
|
// accepted at the type layer during migration: features that pass an
|
|
@@ -598,7 +600,10 @@ export type ImageFieldDef = {
|
|
|
598
600
|
readonly required?: boolean;
|
|
599
601
|
readonly maxSize?: string;
|
|
600
602
|
readonly accept?: readonly string[];
|
|
601
|
-
|
|
603
|
+
/** Named derived versions of the uploaded image. The name is the only
|
|
604
|
+
* thing a caller may ask for — the spec lives here, never in a request,
|
|
605
|
+
* so nobody can drive arbitrary renders. Boot-validated. */
|
|
606
|
+
readonly variants?: Readonly<Record<string, VariantSpec>>;
|
|
602
607
|
readonly access?: FieldAccess;
|
|
603
608
|
};
|
|
604
609
|
|
|
@@ -615,7 +620,7 @@ export type ImagesFieldDef = {
|
|
|
615
620
|
readonly maxSize?: string;
|
|
616
621
|
readonly accept?: readonly string[];
|
|
617
622
|
readonly maxCount?: number;
|
|
618
|
-
readonly
|
|
623
|
+
readonly variants?: Readonly<Record<string, VariantSpec>>;
|
|
619
624
|
readonly access?: FieldAccess;
|
|
620
625
|
};
|
|
621
626
|
|