@flighthq/image 0.5.1-next.903.f434bc2 → 0.5.1-next.905.5fbf787
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/README.md
CHANGED
|
@@ -13,5 +13,5 @@ Import the supported application-facing API from `@flighthq/image`. The `@flight
|
|
|
13
13
|
This package is part of the locked-version Flight SDK graph. Applications may instead install and import `@flighthq/sdk` when package-level tree shaking is sufficient.
|
|
14
14
|
|
|
15
15
|
- [Flight project](https://github.com/flighthq/flight)
|
|
16
|
-
- [Source for @flighthq/image@0.5.1-next.
|
|
17
|
-
- [License](https://github.com/flighthq/flight/blob/
|
|
16
|
+
- [Source for @flighthq/image@0.5.1-next.905.5fbf787](https://github.com/flighthq/flight/tree/5fbf7874064c384307542d68b4dcb6a895ff0dcf/packages/image)
|
|
17
|
+
- [License](https://github.com/flighthq/flight/blob/5fbf7874064c384307542d68b4dcb6a895ff0dcf/LICENSE.md)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flighthq/image",
|
|
3
|
-
"version": "0.5.1-next.
|
|
3
|
+
"version": "0.5.1-next.905.5fbf787",
|
|
4
4
|
"author": "Joshua Granick and other contributors",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -38,9 +38,9 @@
|
|
|
38
38
|
"clean:dist": "tsx ../../scripts/clean-package-dist.ts"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@flighthq/entity": "0.5.1-next.
|
|
42
|
-
"@flighthq/image-codec": "0.5.1-next.
|
|
43
|
-
"@flighthq/types": "0.5.1-next.
|
|
41
|
+
"@flighthq/entity": "0.5.1-next.905.5fbf787",
|
|
42
|
+
"@flighthq/image-codec": "0.5.1-next.905.5fbf787",
|
|
43
|
+
"@flighthq/types": "0.5.1-next.905.5fbf787"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"typescript": "^5.3.0"
|
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
cloneImageResource,
|
|
6
6
|
createCompressedImageResource,
|
|
7
7
|
createImageResource,
|
|
8
|
+
initializeCompressedImageResource,
|
|
8
9
|
invalidateImageResource,
|
|
9
10
|
isImageResourceEmpty,
|
|
10
11
|
} from './imageResource';
|
|
@@ -66,6 +67,12 @@ describe('createImageResource', () => {
|
|
|
66
67
|
});
|
|
67
68
|
});
|
|
68
69
|
|
|
70
|
+
describe('initializeCompressedImageResource', () => {
|
|
71
|
+
it('is the construction initializer of createCompressedImageResource', () => {
|
|
72
|
+
expect(typeof initializeCompressedImageResource).toBe('function');
|
|
73
|
+
});
|
|
74
|
+
});
|
|
75
|
+
|
|
69
76
|
describe('invalidateImageResource', () => {
|
|
70
77
|
it('refreshes host dimensions and advances the version', () => {
|
|
71
78
|
const source = document.createElement('canvas');
|
|
@@ -78,7 +85,6 @@ describe('invalidateImageResource', () => {
|
|
|
78
85
|
expect(resource.version).toBe(1);
|
|
79
86
|
});
|
|
80
87
|
});
|
|
81
|
-
|
|
82
88
|
describe('isImageResourceEmpty', () => {
|
|
83
89
|
it('reports a zero-sized host image', () => {
|
|
84
90
|
expect(isImageResourceEmpty(createImageResource(globalThis.document.createElement('img')))).toBe(true);
|
|
@@ -8,6 +8,9 @@ import {
|
|
|
8
8
|
createImageResourceFromCanvas,
|
|
9
9
|
createImageResourceFromImageBitmap,
|
|
10
10
|
createImageResourceFromImageElement,
|
|
11
|
+
initializeImageResourceFromCanvas,
|
|
12
|
+
initializeImageResourceFromImageBitmap,
|
|
13
|
+
initializeImageResourceFromImageElement,
|
|
11
14
|
isImageUrlSameOrigin,
|
|
12
15
|
loadImageResourceFromBase64,
|
|
13
16
|
loadImageResourceFromBlob,
|
|
@@ -203,6 +206,24 @@ describe('createImageResourceFromImageElement', () => {
|
|
|
203
206
|
});
|
|
204
207
|
});
|
|
205
208
|
|
|
209
|
+
describe('initializeImageResourceFromCanvas', () => {
|
|
210
|
+
it('is the construction initializer of createImageResourceFromCanvas', () => {
|
|
211
|
+
expect(typeof initializeImageResourceFromCanvas).toBe('function');
|
|
212
|
+
});
|
|
213
|
+
});
|
|
214
|
+
|
|
215
|
+
describe('initializeImageResourceFromImageBitmap', () => {
|
|
216
|
+
it('is the construction initializer of createImageResourceFromImageBitmap', () => {
|
|
217
|
+
expect(typeof initializeImageResourceFromImageBitmap).toBe('function');
|
|
218
|
+
});
|
|
219
|
+
});
|
|
220
|
+
|
|
221
|
+
describe('initializeImageResourceFromImageElement', () => {
|
|
222
|
+
it('is the construction initializer of createImageResourceFromImageElement', () => {
|
|
223
|
+
expect(typeof initializeImageResourceFromImageElement).toBe('function');
|
|
224
|
+
});
|
|
225
|
+
});
|
|
226
|
+
|
|
206
227
|
describe('isImageUrlSameOrigin', () => {
|
|
207
228
|
it('returns true for data: URLs', () => {
|
|
208
229
|
expect(isImageUrlSameOrigin('data:image/png;base64,abc')).toBe(true);
|
|
@@ -233,7 +254,6 @@ describe('loadImageResourceFromBase64', () => {
|
|
|
233
254
|
expect(resource.source).toBeInstanceOf(HTMLImageElement);
|
|
234
255
|
});
|
|
235
256
|
});
|
|
236
|
-
|
|
237
257
|
describe('loadImageResourceFromBlob', () => {
|
|
238
258
|
it('resolves to an ImageResource', async () => {
|
|
239
259
|
const blob = new Blob([], { type: 'image/png' });
|
|
@@ -20,6 +20,8 @@ import {
|
|
|
20
20
|
disableImageBitmapComposition,
|
|
21
21
|
enableImageBitmapComposition,
|
|
22
22
|
explainImageResourceReferenceResolution,
|
|
23
|
+
initializeEmbeddedImageResourceReference,
|
|
24
|
+
initializeExternalImageResourceReference,
|
|
23
25
|
resetFailedImageResourceReference,
|
|
24
26
|
resolveImageResourceReference,
|
|
25
27
|
} from './imageResourceReference';
|
|
@@ -138,6 +140,30 @@ describe('explainImageResourceReferenceResolution', () => {
|
|
|
138
140
|
});
|
|
139
141
|
});
|
|
140
142
|
|
|
143
|
+
describe('initializeEmbeddedImageResourceReference', () => {
|
|
144
|
+
it('is the construction initializer of createEmbeddedImageResourceReference', () => {
|
|
145
|
+
expect(typeof initializeEmbeddedImageResourceReference).toBe('function');
|
|
146
|
+
});
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
describe('initializeExternalImageResourceReference', () => {
|
|
150
|
+
it('is the construction initializer of createExternalImageResourceReference', () => {
|
|
151
|
+
expect(typeof initializeExternalImageResourceReference).toBe('function');
|
|
152
|
+
});
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
function createTestBitmap(alphaType: Bitmap['alphaType']): Bitmap {
|
|
156
|
+
const out = allocateEntity<Bitmap>();
|
|
157
|
+
out.alphaType = alphaType;
|
|
158
|
+
out.data = new Uint8ClampedArray([0x11, 0x22, 0x33, 0x44]);
|
|
159
|
+
out.format = 'rgba8unorm';
|
|
160
|
+
out.gamut = 'srgb';
|
|
161
|
+
out.height = 1;
|
|
162
|
+
out.kind = BitmapTextureSourceKind;
|
|
163
|
+
out.version = 0;
|
|
164
|
+
out.width = 1;
|
|
165
|
+
return finishEntity(out);
|
|
166
|
+
}
|
|
141
167
|
describe('resetFailedImageResourceReference', () => {
|
|
142
168
|
it('clears a failed reference back to unresolved', () => {
|
|
143
169
|
const ref = createExternalImageResourceReference('a.png');
|
|
@@ -289,16 +315,3 @@ describe('resolveImageResourceReference', () => {
|
|
|
289
315
|
expect(ref.state).toBe(ResourceResolutionState.Resolved);
|
|
290
316
|
});
|
|
291
317
|
});
|
|
292
|
-
|
|
293
|
-
function createTestBitmap(alphaType: Bitmap['alphaType']): Bitmap {
|
|
294
|
-
const out = allocateEntity<Bitmap>();
|
|
295
|
-
out.alphaType = alphaType;
|
|
296
|
-
out.data = new Uint8ClampedArray([0x11, 0x22, 0x33, 0x44]);
|
|
297
|
-
out.format = 'rgba8unorm';
|
|
298
|
-
out.gamut = 'srgb';
|
|
299
|
-
out.height = 1;
|
|
300
|
-
out.kind = BitmapTextureSourceKind;
|
|
301
|
-
out.version = 0;
|
|
302
|
-
out.width = 1;
|
|
303
|
-
return finishEntity(out);
|
|
304
|
-
}
|