@egret/contracts 0.0.0-stage → 7.0.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.
Files changed (43) hide show
  1. package/LICENSE +201 -0
  2. package/NOTICE +21 -0
  3. package/README.md +22 -2
  4. package/README.zh-CN.md +23 -0
  5. package/dist/CancellationSignal.d.ts +12 -0
  6. package/dist/CancellationSignal.js +2 -0
  7. package/dist/Diagnostic.d.ts +11 -0
  8. package/dist/Diagnostic.js +2 -0
  9. package/dist/Disposable.d.ts +11 -0
  10. package/dist/Disposable.js +2 -0
  11. package/dist/HostAdapter.d.ts +17 -0
  12. package/dist/HostAdapter.js +2 -0
  13. package/dist/ImageData2D.d.ts +49 -0
  14. package/dist/ImageData2D.js +133 -0
  15. package/dist/Point2D.d.ts +6 -0
  16. package/dist/Point2D.js +2 -0
  17. package/dist/ProjectFormat.generated.d.ts +129 -0
  18. package/dist/ProjectFormat.generated.js +4 -0
  19. package/dist/RenderFrame2D.d.ts +22 -0
  20. package/dist/RenderFrame2D.js +2 -0
  21. package/dist/ResourceManifest.d.ts +75 -0
  22. package/dist/ResourceManifest.js +2 -0
  23. package/dist/SharedGeometry2D.d.ts +31 -0
  24. package/dist/SharedGeometry2D.js +177 -0
  25. package/dist/SharedMaterial2D.d.ts +46 -0
  26. package/dist/SharedMaterial2D.js +188 -0
  27. package/dist/SharedRenderFrame2D.d.ts +132 -0
  28. package/dist/SharedRenderFrame2D.js +5 -0
  29. package/dist/TextureViewRegion2D.d.ts +20 -0
  30. package/dist/TextureViewRegion2D.js +2 -0
  31. package/dist/TexturedGeometry2D.d.ts +30 -0
  32. package/dist/TexturedGeometry2D.js +167 -0
  33. package/dist/index.d.ts +20 -0
  34. package/dist/index.js +6 -0
  35. package/dist/resources/fontArtifact.d.ts +7 -0
  36. package/dist/resources/fontArtifact.js +37 -0
  37. package/dist/resources/index.d.ts +4 -0
  38. package/dist/resources/index.js +4 -0
  39. package/dist/resources/manifestAdmission.d.ts +10 -0
  40. package/dist/resources/manifestAdmission.js +457 -0
  41. package/dist/resources/sha256.d.ts +3 -0
  42. package/dist/resources/sha256.js +111 -0
  43. package/package.json +25 -4
@@ -0,0 +1,129 @@
1
+ declare const projectIdBrand: unique symbol;
2
+ declare const entityIdBrand: unique symbol;
3
+ declare const fileIdBrand: unique symbol;
4
+ declare const transactionIdBrand: unique symbol;
5
+ export type ProjectId = string & {
6
+ readonly [projectIdBrand]: true;
7
+ };
8
+ export type EntityId = string & {
9
+ readonly [entityIdBrand]: true;
10
+ };
11
+ export type FileId = string & {
12
+ readonly [fileIdBrand]: true;
13
+ };
14
+ export type TransactionId = string & {
15
+ readonly [transactionIdBrand]: true;
16
+ };
17
+ export type ProjectRevision = number;
18
+ export type Sha256 = string;
19
+ export type JsonValue = null | boolean | number | string | readonly JsonValue[] | {
20
+ readonly [key: string]: JsonValue;
21
+ };
22
+ export type JsonObject = {
23
+ readonly [key: string]: JsonValue;
24
+ };
25
+ export interface ProjectVersionPins {
26
+ readonly engineVersion: string;
27
+ readonly resourceFormatVersion: string;
28
+ readonly toolProtocolVersion: "1.0";
29
+ }
30
+ export type ProjectReference = {
31
+ readonly slot: string;
32
+ readonly target: "entity";
33
+ readonly id: EntityId;
34
+ readonly expectedKind: string;
35
+ } | {
36
+ readonly slot: string;
37
+ readonly target: "file";
38
+ readonly id: FileId;
39
+ readonly expectedRole: ProjectFileRole;
40
+ };
41
+ export interface ProjectEntity {
42
+ readonly id: EntityId;
43
+ readonly kind: string;
44
+ readonly dataSchemaVersion: string;
45
+ readonly name: string;
46
+ readonly data: JsonObject;
47
+ readonly references: readonly ProjectReference[];
48
+ }
49
+ export type ProjectFileRole = "source" | "asset" | "configuration" | "legacy-original" | "other";
50
+ export interface ProjectFile {
51
+ readonly id: FileId;
52
+ readonly path: string;
53
+ readonly role: ProjectFileRole;
54
+ readonly mediaType: string;
55
+ readonly sha256: Sha256;
56
+ readonly byteLength: number;
57
+ }
58
+ export interface ProjectSnapshot {
59
+ readonly projectSchemaVersion: "1.0";
60
+ readonly projectId: ProjectId;
61
+ readonly revision: ProjectRevision;
62
+ readonly name: string;
63
+ readonly versions: ProjectVersionPins;
64
+ readonly roots: readonly EntityId[];
65
+ readonly entities: readonly ProjectEntity[];
66
+ readonly files: readonly ProjectFile[];
67
+ readonly retiredEntityIds: readonly EntityId[];
68
+ readonly retiredFileIds: readonly FileId[];
69
+ }
70
+ export interface ProjectTransactionSource {
71
+ readonly actorId: string;
72
+ readonly actorKind: "creator" | "agent" | "legacy-converter" | "tool";
73
+ readonly toolId: string;
74
+ readonly toolVersion: string;
75
+ readonly intent: string;
76
+ }
77
+ export interface ProjectTransactionScope {
78
+ readonly entityIds: readonly EntityId[];
79
+ readonly fileIds: readonly FileId[];
80
+ readonly metadata: boolean;
81
+ readonly roots: boolean;
82
+ }
83
+ export type ProjectOperation = {
84
+ readonly op: "putEntity";
85
+ readonly entity: ProjectEntity;
86
+ } | {
87
+ readonly op: "removeEntity";
88
+ readonly id: EntityId;
89
+ } | {
90
+ readonly op: "putFile";
91
+ readonly file: ProjectFile;
92
+ } | {
93
+ readonly op: "removeFile";
94
+ readonly id: FileId;
95
+ } | {
96
+ readonly op: "setMetadata";
97
+ readonly name: string;
98
+ readonly versions: ProjectVersionPins;
99
+ } | {
100
+ readonly op: "setRoots";
101
+ readonly roots: readonly EntityId[];
102
+ };
103
+ export interface ProjectEditTransaction {
104
+ readonly command: "edit";
105
+ readonly toolProtocolVersion: "1.0";
106
+ readonly projectId: ProjectId;
107
+ readonly transactionId: TransactionId;
108
+ readonly baseRevision: ProjectRevision;
109
+ readonly source: ProjectTransactionSource;
110
+ readonly scope: ProjectTransactionScope;
111
+ readonly operations: readonly ProjectOperation[];
112
+ }
113
+ export interface ProjectRestoreTransaction {
114
+ readonly command: "restore";
115
+ readonly toolProtocolVersion: "1.0";
116
+ readonly projectId: ProjectId;
117
+ readonly transactionId: TransactionId;
118
+ readonly baseRevision: ProjectRevision;
119
+ readonly source: ProjectTransactionSource;
120
+ readonly targetRevision: ProjectRevision;
121
+ }
122
+ export type ProjectTransaction = ProjectEditTransaction | ProjectRestoreTransaction;
123
+ export interface ProjectHistory {
124
+ readonly historySchemaVersion: "1.0";
125
+ readonly baseline: ProjectSnapshot;
126
+ readonly transactions: readonly ProjectTransaction[];
127
+ }
128
+ export {};
129
+ //# sourceMappingURL=ProjectFormat.generated.d.ts.map
@@ -0,0 +1,4 @@
1
+ // Generated from project-format.schema.json; source-sha256: 85617c17f23323bf4a0fd8ef31abba6040b244f6c199c62cd40f3a389bbef789
2
+ // DO NOT EDIT. Run node tools/generate-project-format.mjs.
3
+ export {};
4
+ //# sourceMappingURL=ProjectFormat.generated.js.map
@@ -0,0 +1,22 @@
1
+ /** Immutable logical-coordinate values shared by CPU capture and render hosts. */
2
+ export interface Matrix2D {
3
+ readonly a: number;
4
+ readonly b: number;
5
+ readonly c: number;
6
+ readonly d: number;
7
+ readonly tx: number;
8
+ readonly ty: number;
9
+ }
10
+ /** An axis-aligned rectangle in its own coordinate space. */
11
+ export interface Rectangle2D {
12
+ readonly x: number;
13
+ readonly y: number;
14
+ readonly width: number;
15
+ readonly height: number;
16
+ }
17
+ /** A clip rectangle together with the matrix that places it on the frame. */
18
+ export interface ClipRectangle2D {
19
+ readonly matrix: Matrix2D;
20
+ readonly rect: Rectangle2D;
21
+ }
22
+ //# sourceMappingURL=RenderFrame2D.d.ts.map
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=RenderFrame2D.js.map
@@ -0,0 +1,75 @@
1
+ import type { EntityId, JsonObject, ProjectFile, ProjectId, ProjectVersionPins } from './ProjectFormat.generated.js';
2
+ declare const admittedManifestBrand: unique symbol;
3
+ export interface ResourceBuildSourceEntry {
4
+ readonly id: EntityId;
5
+ readonly resourceKind: string;
6
+ readonly source: ProjectFile;
7
+ readonly importer: {
8
+ readonly id: string;
9
+ readonly version: string;
10
+ };
11
+ readonly settings: JsonObject;
12
+ readonly artifactFormatVersion: string;
13
+ readonly targetProfile: string;
14
+ readonly dependencies: readonly EntityId[];
15
+ readonly provenance: JsonObject;
16
+ }
17
+ export interface ResourceBuildEntry extends ResourceBuildSourceEntry {
18
+ readonly artifact: ProjectFile;
19
+ }
20
+ export interface ResourceBuildPlanDescription {
21
+ readonly format: 'egret.resource-build-plan/1';
22
+ readonly projectId: ProjectId;
23
+ readonly targetProfile: string;
24
+ readonly versions: ProjectVersionPins;
25
+ readonly entries: readonly ResourceBuildSourceEntry[];
26
+ }
27
+ export interface ResourceBuildKeyEntry extends ResourceBuildSourceEntry {
28
+ readonly buildKey: string;
29
+ }
30
+ export interface ResourceBuildKeyPlan {
31
+ readonly format: 'egret.resource-build-keys/1';
32
+ readonly projectId: ProjectId;
33
+ readonly targetProfile: string;
34
+ readonly versions: ProjectVersionPins;
35
+ readonly entries: readonly ResourceBuildKeyEntry[];
36
+ }
37
+ export interface ResourceBuildDescription {
38
+ readonly format: 'egret.resource-build/1';
39
+ readonly projectId: ProjectId;
40
+ readonly targetProfile: string;
41
+ readonly versions: ProjectVersionPins;
42
+ readonly entries: readonly ResourceBuildEntry[];
43
+ }
44
+ export interface ResourceManifestEntry extends ResourceBuildEntry {
45
+ readonly buildKey: string;
46
+ readonly runtimeIdentity: string;
47
+ }
48
+ export interface AdmittedResourceManifest {
49
+ readonly [admittedManifestBrand]: true;
50
+ readonly format: 'egret.resource-manifest/1';
51
+ readonly projectId: ProjectId;
52
+ readonly targetProfile: string;
53
+ readonly versions: ProjectVersionPins;
54
+ readonly entries: readonly ResourceManifestEntry[];
55
+ }
56
+ export type ResourceManifestDiagnosticCode = 'RESOURCE_INPUT_INVALID' | 'RESOURCE_LIMIT_EXCEEDED' | 'RESOURCE_FORMAT_UNSUPPORTED' | 'RESOURCE_DEPENDENCY_INVALID' | 'RESOURCE_ID_DUPLICATE' | 'RESOURCE_KEY_MISMATCH' | 'RESOURCE_FILE_MISMATCH' | 'RESOURCE_PATH_INVALID';
57
+ export interface ResourceManifestDiagnostic {
58
+ readonly code: ResourceManifestDiagnosticCode;
59
+ readonly pointer: string;
60
+ readonly message: string;
61
+ }
62
+ export type ResourceManifestResult<T> = {
63
+ readonly ok: true;
64
+ readonly value: T;
65
+ readonly diagnostics: readonly [];
66
+ } | {
67
+ readonly ok: false;
68
+ readonly diagnostics: readonly [ResourceManifestDiagnostic];
69
+ };
70
+ export interface ResourceManifestIdentityInputs {
71
+ readonly build: string;
72
+ readonly runtime: string;
73
+ }
74
+ export {};
75
+ //# sourceMappingURL=ResourceManifest.d.ts.map
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=ResourceManifest.js.map
@@ -0,0 +1,31 @@
1
+ declare const sharedGeometry2DBrand: unique symbol;
2
+ /** A float array of a shared geometry, in single or double precision. */
3
+ export type SharedFloatArray2D = Float32Array<ArrayBuffer> | Float64Array<ArrayBuffer>;
4
+ /** An index array of a shared geometry, in 16 or 32 bits. */
5
+ export type SharedIndexArray2D = Uint16Array<ArrayBuffer> | Uint32Array<ArrayBuffer>;
6
+ /** The positions, texture coordinates, light and dark colors and triangle indices of a mesh to share with a renderer. */
7
+ export interface SharedGeometryInput2D {
8
+ readonly positions: SharedFloatArray2D;
9
+ readonly uvs: SharedFloatArray2D;
10
+ readonly lightColors: SharedFloatArray2D;
11
+ readonly darkColors: SharedFloatArray2D;
12
+ readonly indices: SharedIndexArray2D;
13
+ }
14
+ /** Immutable CPU geometry identity; the brand grants no asset or GPU authority. */
15
+ export interface SharedGeometry2D {
16
+ readonly [sharedGeometry2DBrand]: true;
17
+ readonly vertexCount: number;
18
+ readonly indexCount: number;
19
+ readonly triangleCount: number;
20
+ readonly logicalByteLength: number;
21
+ readonly positions: readonly number[];
22
+ readonly uvs: readonly number[];
23
+ readonly lightColors: readonly number[];
24
+ readonly darkColors: readonly number[];
25
+ readonly indices: readonly number[];
26
+ }
27
+ /** Copies and checks a mesh into a shared geometry that renderers can draw; malformed arrays are refused. */
28
+ export declare function createSharedGeometry2D(input: SharedGeometryInput2D): SharedGeometry2D;
29
+ export declare function isSharedGeometry2D(value: unknown): value is SharedGeometry2D;
30
+ export {};
31
+ //# sourceMappingURL=SharedGeometry2D.d.ts.map
@@ -0,0 +1,177 @@
1
+ // Capture normal-realm intrinsics before descriptor callbacks can replace them.
2
+ // Admission and copying do not read instance properties, iterators or species.
3
+ const Floats32 = Float32Array;
4
+ const Floats64 = Float64Array;
5
+ const Indices16 = Uint16Array;
6
+ const Indices32 = Uint32Array;
7
+ const Bytes = Uint8Array;
8
+ const Numbers = Array;
9
+ const apply = Reflect.apply;
10
+ const freeze = Object.freeze;
11
+ const setPrototypeOf = Object.setPrototypeOf;
12
+ const arrayPrototype = Numbers.prototype;
13
+ const TypeFault = TypeError;
14
+ const RangeFault = RangeError;
15
+ const finite = Number.isFinite;
16
+ const integer = Number.isInteger;
17
+ const safeInteger = Number.isSafeInteger;
18
+ const fround = Math.fround;
19
+ const abs = Math.abs;
20
+ const typedArrayPrototype = Object.getPrototypeOf(Bytes.prototype);
21
+ const tagGetter = Object.getOwnPropertyDescriptor(typedArrayPrototype, Symbol.toStringTag).get;
22
+ const bufferGetter = Object.getOwnPropertyDescriptor(typedArrayPrototype, 'buffer').get;
23
+ const offsetGetter = Object.getOwnPropertyDescriptor(typedArrayPrototype, 'byteOffset').get;
24
+ const lengthGetter = Object.getOwnPropertyDescriptor(typedArrayPrototype, 'byteLength').get;
25
+ const bufferLengthGetter = Object.getOwnPropertyDescriptor(ArrayBuffer.prototype, 'byteLength').get;
26
+ const resizableGetter = Object.getOwnPropertyDescriptor(ArrayBuffer.prototype, 'resizable')?.get;
27
+ const detachedGetter = Object.getOwnPropertyDescriptor(ArrayBuffer.prototype, 'detached')?.get;
28
+ const setElements = typedArrayPrototype.set;
29
+ const weakHas = WeakMap.prototype.has;
30
+ const weakSet = WeakMap.prototype.set;
31
+ const owned = new WeakMap();
32
+ function read(source, key) {
33
+ try {
34
+ return source[key];
35
+ }
36
+ catch (cause) {
37
+ throw new TypeFault('Shared geometry descriptor read failed', { cause });
38
+ }
39
+ }
40
+ function floatBrand(value) {
41
+ const tag = apply(tagGetter, value, []);
42
+ if (tag !== 'Float32Array' && tag !== 'Float64Array')
43
+ throw new TypeFault('Shared geometry array brand is unsupported');
44
+ return tag;
45
+ }
46
+ function indexBrand(value) {
47
+ const tag = apply(tagGetter, value, []);
48
+ if (tag !== 'Uint16Array' && tag !== 'Uint32Array')
49
+ throw new TypeFault('Shared geometry array brand is unsupported');
50
+ return tag;
51
+ }
52
+ function elementLength(value, tag) {
53
+ const backing = apply(bufferGetter, value, []);
54
+ // This captured getter rejects SharedArrayBuffer, including cross realm.
55
+ // Native intrinsic faults escape intact rather than becoming policy errors.
56
+ apply(bufferLengthGetter, backing, []);
57
+ if (resizableGetter && apply(resizableGetter, backing, []))
58
+ throw new TypeFault('Shared geometry backing is unsupported');
59
+ if (detachedGetter) {
60
+ if (apply(detachedGetter, backing, []))
61
+ throw new TypeFault('Shared geometry backing is unsupported');
62
+ }
63
+ else {
64
+ // Reuse the established zero-length attachment check for older realms.
65
+ new Bytes(backing, 0, 0);
66
+ }
67
+ apply(offsetGetter, value, []);
68
+ const byteLength = apply(lengthGetter, value, []);
69
+ const elementBytes = tag === 'Float64Array' ? 8 : tag === 'Uint16Array' ? 2 : 4;
70
+ return byteLength / elementBytes;
71
+ }
72
+ function copyPayload(source, tag, length) {
73
+ const copy = tag === 'Float32Array'
74
+ ? new Floats32(length)
75
+ : tag === 'Float64Array'
76
+ ? new Floats64(length)
77
+ : tag === 'Uint16Array'
78
+ ? new Indices16(length)
79
+ : new Indices32(length);
80
+ // Native allocation/copy failures escape. TypedArray set reads only the
81
+ // intrinsic used range and cannot invoke the caller's iterator or species.
82
+ apply(setElements, copy, [source]);
83
+ return copy;
84
+ }
85
+ function canonical(source, length, kind, vertexCount) {
86
+ // Fill private own indices without inherited setters, then expose a normal frozen array.
87
+ const output = [];
88
+ setPrototypeOf(output, null);
89
+ for (let index = 0; index < length; index++) {
90
+ const value = source[index];
91
+ if (!finite(value) ||
92
+ (kind === 'unit' && (value < 0 || value > 1)) ||
93
+ (kind === 'index' && (!integer(value) || value < 0 || value >= vertexCount))) {
94
+ throw new RangeFault('Shared geometry numeric range is invalid');
95
+ }
96
+ // New floating payloads are f32-roundtrip Numbers. This is a declared
97
+ // canonical input representation, not a GPU interpolation error bound.
98
+ const rounded = kind === 'index' ? value : fround(value);
99
+ if (!finite(rounded) || (kind === 'uv' && abs(rounded) > 1048576)) {
100
+ throw new RangeFault('Shared geometry numeric range is invalid');
101
+ }
102
+ // Equality with zero converts both signed zeros to positive zero.
103
+ output[index] = rounded === 0 ? 0 : rounded;
104
+ }
105
+ setPrototypeOf(output, arrayPrototype);
106
+ return freeze(output);
107
+ }
108
+ /** Copies and checks a mesh into a shared geometry that renderers can draw; malformed arrays are refused. */
109
+ export function createSharedGeometry2D(input) {
110
+ if (typeof input !== 'object' || input === null)
111
+ throw new TypeFault('Shared geometry descriptor must be an object');
112
+ // G1: finish all successful ordered reads before examining any field.
113
+ // Local staging makes descriptor reentry independent of this invocation.
114
+ const positionsInput = read(input, 'positions');
115
+ const uvsInput = read(input, 'uvs');
116
+ const lightColorsInput = read(input, 'lightColors');
117
+ const darkColorsInput = read(input, 'darkColors');
118
+ const indicesInput = read(input, 'indices');
119
+ // G2 must finish for every field before G3 touches the first backing.
120
+ const positionsTag = floatBrand(positionsInput);
121
+ const uvsTag = floatBrand(uvsInput);
122
+ const lightColorsTag = floatBrand(lightColorsInput);
123
+ const darkColorsTag = floatBrand(darkColorsInput);
124
+ const indicesTag = indexBrand(indicesInput);
125
+ const positionsLength = elementLength(positionsInput, positionsTag);
126
+ const uvsLength = elementLength(uvsInput, uvsTag);
127
+ const lightColorsLength = elementLength(lightColorsInput, lightColorsTag);
128
+ const darkColorsLength = elementLength(darkColorsInput, darkColorsTag);
129
+ const indicesLength = elementLength(indicesInput, indicesTag);
130
+ const vertexCount = positionsLength / 2;
131
+ const indexCount = indicesLength;
132
+ // G4: shape outranks capacity; both precede copies and canonical arrays.
133
+ if (!safeInteger(vertexCount) ||
134
+ !safeInteger(indexCount) ||
135
+ uvsLength !== positionsLength ||
136
+ lightColorsLength !== 4 * vertexCount ||
137
+ darkColorsLength !== 3 * vertexCount ||
138
+ !((vertexCount === 0 && indexCount === 0) || (vertexCount >= 3 && indexCount >= 3 && indexCount % 3 === 0))) {
139
+ throw new RangeFault('Shared geometry array shape is invalid');
140
+ }
141
+ const logicalByteLength = 88 * vertexCount + 4 * indexCount;
142
+ if (vertexCount > 65536 || indexCount > 196608 || !safeInteger(logicalByteLength) || logicalByteLength > 4980736) {
143
+ throw new RangeFault('Shared geometry capacity exceeded');
144
+ }
145
+ // G5 capacity above precedes all allocations below. G6 completes all five
146
+ // native copies before G7 examines any copied component.
147
+ const positionsCopy = copyPayload(positionsInput, positionsTag, positionsLength);
148
+ const uvsCopy = copyPayload(uvsInput, uvsTag, uvsLength);
149
+ const lightColorsCopy = copyPayload(lightColorsInput, lightColorsTag, lightColorsLength);
150
+ const darkColorsCopy = copyPayload(darkColorsInput, darkColorsTag, darkColorsLength);
151
+ const indicesCopy = copyPayload(indicesInput, indicesTag, indicesLength);
152
+ const positions = canonical(positionsCopy, positionsLength, 'position', vertexCount);
153
+ const uvs = canonical(uvsCopy, uvsLength, 'uv', vertexCount);
154
+ const lightColors = canonical(lightColorsCopy, lightColorsLength, 'unit', vertexCount);
155
+ const darkColors = canonical(darkColorsCopy, darkColorsLength, 'unit', vertexCount);
156
+ const indices = canonical(indicesCopy, indicesLength, 'index', vertexCount);
157
+ // Logical accounting describes canonical payload units, not physical heap
158
+ // usage or an allocation guarantee. Only the completed frozen value is owned.
159
+ const geometry = freeze({
160
+ vertexCount,
161
+ indexCount,
162
+ triangleCount: indexCount / 3,
163
+ logicalByteLength,
164
+ positions,
165
+ uvs,
166
+ lightColors,
167
+ darkColors,
168
+ indices
169
+ });
170
+ apply(weakSet, owned, [geometry, true]);
171
+ return geometry;
172
+ }
173
+ export function isSharedGeometry2D(value) {
174
+ // WeakMap identity performs no property read, even on revoked Proxies.
175
+ return typeof value === 'object' && value !== null && apply(weakHas, owned, [value]);
176
+ }
177
+ //# sourceMappingURL=SharedGeometry2D.js.map
@@ -0,0 +1,46 @@
1
+ declare const sharedMaterial2DBrand: unique symbol;
2
+ type Blend = 'normal' | 'add-accumulate' | 'add-preserve' | 'multiply-factor' | 'screen' | 'erase';
3
+ type Domain = 'page' | 'region';
4
+ type Filter = 'nearest' | 'linear';
5
+ type Address = 'clamp-to-edge' | 'repeat' | 'mirror-repeat';
6
+ type Isolation = 'bounded' | 'strict';
7
+ /** `linear` samples a texture drawn smaller than it is from its smaller copies, blended between the two nearest. */
8
+ type MipmapFilter = 'none' | 'linear';
9
+ /** The colors, blend, sampling and addressing of a material for shared meshes, as plain values to check. */
10
+ export interface SharedMaterialInput2D {
11
+ readonly light?: readonly number[] | undefined;
12
+ readonly dark?: readonly number[] | undefined;
13
+ readonly blend?: Blend | undefined;
14
+ readonly samplingDomain?: Domain | undefined;
15
+ readonly filter?: Filter | undefined;
16
+ readonly addressU?: Address | undefined;
17
+ readonly addressV?: Address | undefined;
18
+ readonly regionIsolation?: Isolation | undefined;
19
+ readonly mipLevel?: number | undefined;
20
+ readonly minFilter?: Filter | undefined;
21
+ readonly magFilter?: Filter | undefined;
22
+ readonly maxAnisotropy?: number | undefined;
23
+ readonly mipmapFilter?: MipmapFilter | undefined;
24
+ }
25
+ /** A checked material for shared meshes; only `createSharedMaterial2D` makes one. */
26
+ export interface SharedMaterial2D {
27
+ readonly [sharedMaterial2DBrand]: true;
28
+ readonly light: readonly [number, number, number, number];
29
+ readonly dark: readonly [number, number, number];
30
+ readonly blend: Blend;
31
+ readonly samplingDomain: Domain;
32
+ readonly filter: Filter;
33
+ readonly addressU: Address;
34
+ readonly addressV: Address;
35
+ readonly regionIsolation: Isolation;
36
+ readonly mipLevel: 0;
37
+ readonly minFilter: Filter;
38
+ readonly magFilter: Filter;
39
+ readonly maxAnisotropy: 1;
40
+ readonly mipmapFilter: MipmapFilter;
41
+ }
42
+ /** Checks and freezes a material for shared meshes; values out of range are refused. */
43
+ export declare function createSharedMaterial2D(input: SharedMaterialInput2D): SharedMaterial2D;
44
+ export declare function isSharedMaterial2D(value: unknown): value is SharedMaterial2D;
45
+ export {};
46
+ //# sourceMappingURL=SharedMaterial2D.d.ts.map