@cosmicdrift/kumiko-types 0.285.2 → 0.287.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 +40 -0
- package/src/fields.ts +4 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cosmicdrift/kumiko-types",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.287.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
|
@@ -16,6 +16,40 @@ export type BlurRegion = {
|
|
|
16
16
|
readonly height: number;
|
|
17
17
|
};
|
|
18
18
|
|
|
19
|
+
export type OverlayGravity = "north-west" | "north-east" | "south-west" | "south-east" | "center";
|
|
20
|
+
|
|
21
|
+
// Placement is relative to the OUTPUT box (after resize), so one declaration
|
|
22
|
+
// covers every aspect ratio the same source is rendered into.
|
|
23
|
+
type OverlayPlacement = {
|
|
24
|
+
// Layer width as a fraction (0…1) of the output width; height follows the
|
|
25
|
+
// layer's own aspect ratio.
|
|
26
|
+
readonly widthPct: number;
|
|
27
|
+
readonly gravity: OverlayGravity;
|
|
28
|
+
// Inset from the edges, fraction of output width. Ignored for "center".
|
|
29
|
+
readonly marginPct?: number;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export type OverlayLayer =
|
|
33
|
+
// `dataToken` is NOT the QR payload — it names a value an
|
|
34
|
+
// EXT_DERIVATIVE_OVERLAY_RESOLVER registration resolves per FileRef. A
|
|
35
|
+
// literal payload is deliberately not expressible: the public variant route
|
|
36
|
+
// is anonymous, so a caller-supplied target would make it an open image
|
|
37
|
+
// generator for arbitrary URLs.
|
|
38
|
+
| ({ readonly kind: "qr"; readonly dataToken: string } & OverlayPlacement)
|
|
39
|
+
// Caller-supplied raster (watermark/badge), base64 in the declaration.
|
|
40
|
+
// Swapping the image changes the spec hash and invalidates every derivative
|
|
41
|
+
// that used it — no extra bookkeeping.
|
|
42
|
+
| ({ readonly kind: "image"; readonly imageBase64: string } & OverlayPlacement);
|
|
43
|
+
|
|
44
|
+
// Renderer-facing counterpart of OverlayLayer once derivatives-context has
|
|
45
|
+
// resolved every `dataToken` — a `qr` layer carries the actual value to
|
|
46
|
+
// encode instead of a name a resolver still has to look up. Keeping this a
|
|
47
|
+
// distinct type (not a value-replacement on OverlayLayer itself) means a
|
|
48
|
+
// renderer's input type structurally cannot hold an unresolved token.
|
|
49
|
+
export type ResolvedOverlayLayer =
|
|
50
|
+
| ({ readonly kind: "qr"; readonly data: string } & OverlayPlacement)
|
|
51
|
+
| Extract<OverlayLayer, { kind: "image" }>;
|
|
52
|
+
|
|
19
53
|
export type VariantSpec = {
|
|
20
54
|
// Default "inside" when omitted (renderer-side default, Schnitt 2).
|
|
21
55
|
readonly fit?: VariantFit;
|
|
@@ -27,6 +61,12 @@ export type VariantSpec = {
|
|
|
27
61
|
// Whole-image blur radius.
|
|
28
62
|
readonly blur?: number;
|
|
29
63
|
readonly blurRegions?: readonly BlurRegion[];
|
|
64
|
+
// Composited AFTER resize, in array order (last layer on top).
|
|
65
|
+
readonly overlays?: readonly OverlayLayer[];
|
|
66
|
+
// Framework-internal: derivatives-context.ts fills this in from `overlays`
|
|
67
|
+
// once every dataToken is resolved. A renderer reads only this field, so a
|
|
68
|
+
// token can never reach it, even by accident.
|
|
69
|
+
readonly resolvedOverlays?: readonly ResolvedOverlayLayer[];
|
|
30
70
|
};
|
|
31
71
|
|
|
32
72
|
// A renderer turns the original bytes + a spec into the derived bytes for one
|
package/src/fields.ts
CHANGED
|
@@ -752,7 +752,7 @@ export type FileFieldDef = {
|
|
|
752
752
|
readonly maxSize?: string;
|
|
753
753
|
readonly accept?: readonly string[];
|
|
754
754
|
readonly access?: FieldAccess;
|
|
755
|
-
};
|
|
755
|
+
} & ResolvedPiiFlags;
|
|
756
756
|
|
|
757
757
|
export type ImageFieldDef = {
|
|
758
758
|
readonly type: "image";
|
|
@@ -768,7 +768,7 @@ export type ImageFieldDef = {
|
|
|
768
768
|
* camera instead of the file picker. */
|
|
769
769
|
readonly capture?: "environment" | "user";
|
|
770
770
|
readonly access?: FieldAccess;
|
|
771
|
-
};
|
|
771
|
+
} & ResolvedPiiFlags;
|
|
772
772
|
|
|
773
773
|
export type FilesFieldDef = {
|
|
774
774
|
readonly type: "files";
|
|
@@ -777,7 +777,7 @@ export type FilesFieldDef = {
|
|
|
777
777
|
readonly accept?: readonly string[];
|
|
778
778
|
readonly maxCount?: number;
|
|
779
779
|
readonly access?: FieldAccess;
|
|
780
|
-
};
|
|
780
|
+
} & ResolvedPiiFlags;
|
|
781
781
|
|
|
782
782
|
export type ImagesFieldDef = {
|
|
783
783
|
readonly type: "images";
|
|
@@ -787,7 +787,7 @@ export type ImagesFieldDef = {
|
|
|
787
787
|
readonly maxCount?: number;
|
|
788
788
|
readonly variants?: Readonly<Record<string, VariantSpec>>;
|
|
789
789
|
readonly access?: FieldAccess;
|
|
790
|
-
};
|
|
790
|
+
} & ResolvedPiiFlags;
|
|
791
791
|
|
|
792
792
|
export type FieldDefinition =
|
|
793
793
|
| TextFieldDef
|