@wordpress/media-editor 0.17.2-next.v.202608281122.0 → 0.17.2-next.v.202609031004.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.
Files changed (30) hide show
  1. package/CHANGELOG.md +1 -1
  2. package/build-style/style-rtl.css +5 -12
  3. package/build-style/style.css +5 -12
  4. package/package.json +21 -20
  5. package/src/components/media-editor-modal/test/build-modifiers.test.ts +24 -14
  6. package/src/components/rotation-ruler/style.scss +1 -1
  7. package/src/image-editor/core/math/test/sanitize.ts +1 -0
  8. package/src/image-editor/core/test/camera.ts +2 -3
  9. package/src/image-editor/core/test/interaction-controller.ts +50 -40
  10. package/src/image-editor/core/test/preview-export-parity.ts +31 -23
  11. package/src/image-editor/core/test/render-camera-bridge.ts +1 -0
  12. package/src/image-editor/core/test/state.ts +1 -0
  13. package/src/image-editor/core/test/stencil-math.ts +1 -0
  14. package/src/image-editor/core/transforms/test/pipeline.ts +1 -0
  15. package/src/store/test/reducer.ts +9 -8
  16. package/tsconfig.build.tsbuildinfo +1 -1
  17. package/tsconfig.json +2 -2
  18. /package/src/components/media-editor/test/{use-crop-options.tsx → use-crop-options.jsdom.test.tsx} +0 -0
  19. /package/src/components/media-editor-crop-panel/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  20. /package/src/components/media-editor-image-controls/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  21. /package/src/components/media-editor-modal/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  22. /package/src/components/rotation-ruler/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  23. /package/src/image-editor/core/export/test/{canvas-renderer.ts → canvas-renderer.jsdom.test.ts} +0 -0
  24. /package/src/image-editor/react/components/stencils/test/{rectangle-stencil.tsx → rectangle-stencil.jsdom.test.tsx} +0 -0
  25. /package/src/image-editor/react/components/test/{cropper.tsx → cropper.jsdom.test.tsx} +0 -0
  26. /package/src/image-editor/react/hooks/test/{use-aria-announcer.ts → use-aria-announcer.jsdom.test.ts} +0 -0
  27. /package/src/image-editor/react/hooks/test/{use-cropper-reducer.ts → use-cropper-reducer.jsdom.test.ts} +0 -0
  28. /package/src/image-editor/react/hooks/test/{use-interaction.ts → use-interaction.jsdom.test.ts} +0 -0
  29. /package/src/image-editor/react/hooks/test/{use-transform-style.ts → use-transform-style.jsdom.test.ts} +0 -0
  30. /package/src/state/test/{use-media-editor-state.ts → use-media-editor-state.jsdom.test.ts} +0 -0
package/CHANGELOG.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
- ## 0.17.1-next.0 (2026-08-28)
5
+ ## 0.17.1-next.0 (2026-09-03)
6
6
 
7
7
  ### Internal
8
8
 
@@ -65,8 +65,7 @@
65
65
  .media-editor-preview--image img {
66
66
  max-width: 100%;
67
67
  max-height: 100%;
68
- -o-object-fit: contain;
69
- object-fit: contain;
68
+ object-fit: contain;
70
69
  width: auto;
71
70
  height: auto;
72
71
  opacity: 0;
@@ -88,8 +87,7 @@
88
87
  .media-editor-preview--video video {
89
88
  max-width: 100%;
90
89
  max-height: 100%;
91
- -o-object-fit: contain;
92
- object-fit: contain;
90
+ object-fit: contain;
93
91
  width: auto;
94
92
  height: auto;
95
93
  }
@@ -135,7 +133,6 @@
135
133
  height: 100%;
136
134
  touch-action: none;
137
135
  -webkit-user-select: none;
138
- -moz-user-select: none;
139
136
  user-select: none;
140
137
  cursor: grab;
141
138
  }
@@ -236,9 +233,7 @@
236
233
  box-shadow: 0 0 0 1px var(--wp-image-editor-focus-color, var(--wp-admin-theme-color, #007cba));
237
234
  }
238
235
  .wp-media-editor-image-editor__handle {
239
- -webkit-appearance: none;
240
- -moz-appearance: none;
241
- appearance: none;
236
+ appearance: none;
242
237
  margin: 0;
243
238
  padding: 0;
244
239
  font: inherit;
@@ -442,8 +437,7 @@
442
437
  .media-editor .media-editor__canvas-area video {
443
438
  max-width: 100%;
444
439
  max-height: 100%;
445
- -o-object-fit: contain;
446
- object-fit: contain;
440
+ object-fit: contain;
447
441
  }
448
442
  .media-editor .media-editor__sidebar {
449
443
  display: flex;
@@ -695,7 +689,6 @@
695
689
  color: #1e1e1e;
696
690
  font-family: -apple-system, system-ui, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
697
691
  -webkit-user-select: none;
698
- -moz-user-select: none;
699
692
  user-select: none;
700
693
  touch-action: none;
701
694
  cursor: ew-resize;
@@ -719,7 +712,7 @@
719
712
  margin: -1px;
720
713
  padding: 0;
721
714
  border: 0;
722
- clip: rect(0 0 0 0);
715
+ clip-path: inset(50%);
723
716
  overflow: hidden;
724
717
  white-space: nowrap;
725
718
  }
@@ -65,8 +65,7 @@
65
65
  .media-editor-preview--image img {
66
66
  max-width: 100%;
67
67
  max-height: 100%;
68
- -o-object-fit: contain;
69
- object-fit: contain;
68
+ object-fit: contain;
70
69
  width: auto;
71
70
  height: auto;
72
71
  opacity: 0;
@@ -88,8 +87,7 @@
88
87
  .media-editor-preview--video video {
89
88
  max-width: 100%;
90
89
  max-height: 100%;
91
- -o-object-fit: contain;
92
- object-fit: contain;
90
+ object-fit: contain;
93
91
  width: auto;
94
92
  height: auto;
95
93
  }
@@ -135,7 +133,6 @@
135
133
  height: 100%;
136
134
  touch-action: none;
137
135
  -webkit-user-select: none;
138
- -moz-user-select: none;
139
136
  user-select: none;
140
137
  cursor: grab;
141
138
  }
@@ -236,9 +233,7 @@
236
233
  box-shadow: 0 0 0 1px var(--wp-image-editor-focus-color, var(--wp-admin-theme-color, #007cba));
237
234
  }
238
235
  .wp-media-editor-image-editor__handle {
239
- -webkit-appearance: none;
240
- -moz-appearance: none;
241
- appearance: none;
236
+ appearance: none;
242
237
  margin: 0;
243
238
  padding: 0;
244
239
  font: inherit;
@@ -442,8 +437,7 @@
442
437
  .media-editor .media-editor__canvas-area video {
443
438
  max-width: 100%;
444
439
  max-height: 100%;
445
- -o-object-fit: contain;
446
- object-fit: contain;
440
+ object-fit: contain;
447
441
  }
448
442
  .media-editor .media-editor__sidebar {
449
443
  display: flex;
@@ -695,7 +689,6 @@
695
689
  color: #1e1e1e;
696
690
  font-family: -apple-system, system-ui, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
697
691
  -webkit-user-select: none;
698
- -moz-user-select: none;
699
692
  user-select: none;
700
693
  touch-action: none;
701
694
  cursor: ew-resize;
@@ -719,7 +712,7 @@
719
712
  margin: -1px;
720
713
  padding: 0;
721
714
  border: 0;
722
- clip: rect(0 0 0 0);
715
+ clip-path: inset(50%);
723
716
  overflow: hidden;
724
717
  white-space: nowrap;
725
718
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/media-editor",
3
- "version": "0.17.2-next.v.202608281122.0",
3
+ "version": "0.17.2-next.v.202609031004.0",
4
4
  "description": "Media editor components for WordPress.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -43,23 +43,23 @@
43
43
  "build-module/store/index.mjs"
44
44
  ],
45
45
  "dependencies": {
46
- "@wordpress/a11y": "^4.54.1-next.v.202608281122.0",
47
- "@wordpress/admin-ui": "^2.9.1-next.v.202608281122.0",
48
- "@wordpress/api-fetch": "^7.54.1-next.v.202608281122.0",
49
- "@wordpress/base-styles": "^13.0.1-next.v.202608281122.0",
50
- "@wordpress/components": "^40.1.1-next.v.202608281122.0",
51
- "@wordpress/compose": "^8.7.2-next.v.202608281122.0",
52
- "@wordpress/core-data": "^7.54.2-next.v.202608281122.0",
53
- "@wordpress/data": "^10.54.2-next.v.202608281122.0",
54
- "@wordpress/dataviews": "^18.1.2-next.v.202608281122.0",
55
- "@wordpress/element": "^8.6.2-next.v.202608281122.0",
56
- "@wordpress/i18n": "^6.27.1-next.v.202608281122.0",
57
- "@wordpress/icons": "^15.5.1-next.v.202608281122.0",
58
- "@wordpress/keyboard-shortcuts": "^5.54.1-next.v.202608281122.0",
59
- "@wordpress/keycodes": "^4.54.1-next.v.202608281122.0",
60
- "@wordpress/notices": "^5.54.1-next.v.202608281122.0",
61
- "@wordpress/private-apis": "^1.54.1-next.v.202608281122.0",
62
- "@wordpress/ui": "^0.22.1-next.v.202608281122.0",
46
+ "@wordpress/a11y": "^4.54.1-next.v.202609031004.0",
47
+ "@wordpress/admin-ui": "^2.9.1-next.v.202609031004.0",
48
+ "@wordpress/api-fetch": "^7.54.1-next.v.202609031004.0",
49
+ "@wordpress/base-styles": "^13.1.1-next.v.202609031004.0",
50
+ "@wordpress/components": "^40.1.1-next.v.202609031004.0",
51
+ "@wordpress/compose": "^8.7.2-next.v.202609031004.0",
52
+ "@wordpress/core-data": "^8.0.1-next.v.202609031004.0",
53
+ "@wordpress/data": "^10.54.2-next.v.202609031004.0",
54
+ "@wordpress/dataviews": "^19.0.1-next.v.202609031004.0",
55
+ "@wordpress/element": "^8.6.2-next.v.202609031004.0",
56
+ "@wordpress/i18n": "^6.27.1-next.v.202609031004.0",
57
+ "@wordpress/icons": "^16.0.1-next.v.202609031004.0",
58
+ "@wordpress/keyboard-shortcuts": "^5.54.1-next.v.202609031004.0",
59
+ "@wordpress/keycodes": "^4.54.1-next.v.202609031004.0",
60
+ "@wordpress/notices": "^5.54.1-next.v.202609031004.0",
61
+ "@wordpress/private-apis": "^1.54.2-next.v.202609031004.0",
62
+ "@wordpress/ui": "^0.22.1-next.v.202609031004.0",
63
63
  "clsx": "^2.1.1",
64
64
  "gl-matrix": "^3.4.3"
65
65
  },
@@ -69,7 +69,8 @@
69
69
  "@testing-library/jest-dom": "^6.9.1",
70
70
  "@testing-library/react": "^16.3.2",
71
71
  "@testing-library/user-event": "^14.6.1",
72
- "@types/jest": "^30.0.0"
72
+ "@types/jest": "^30.0.0",
73
+ "vitest": "^4.1.10"
73
74
  },
74
75
  "peerDependencies": {
75
76
  "@types/react": "^18 || ^19",
@@ -83,5 +84,5 @@
83
84
  "publishConfig": {
84
85
  "access": "public"
85
86
  },
86
- "gitHead": "de479d415171765f7b573c81aeec5334ff506a12"
87
+ "gitHead": "7275d6c6d93b542fca3cd98cdb9c7344ddd11e19"
87
88
  }
@@ -52,6 +52,8 @@
52
52
  * `serverSourcePixel` to undo it, and add values to the grid in
53
53
  * `buildRows`. The probes don't need to change.
54
54
  */
55
+
56
+ import { describe, expect, it } from 'vitest';
55
57
  import { mat2d, vec2 } from 'gl-matrix';
56
58
  import { buildModifiers } from '../build-modifiers';
57
59
  import type { Modifier } from '../build-modifiers';
@@ -329,21 +331,29 @@ function outputSizeFor( modifiers: Modifier[], imageSize: Size ): Size {
329
331
  describe( 'buildModifiers ↔ Export-camera parity', () => {
330
332
  const rows = buildRows();
331
333
 
332
- it.each( rows )( '$label', ( { state, u, v } ) => {
333
- const modifiers = buildModifiers( state, IMAGE );
334
+ for ( const { label, state, u, v } of rows ) {
335
+ it( label, () => {
336
+ const modifiers = buildModifiers( state, IMAGE );
334
337
 
335
- // Output canvas is whatever the server would emit: the crop rect
336
- // if present, otherwise the full rotated AABB. This makes (u, v)
337
- // map to the same *output* pixel on both paths.
338
- const outputSize = outputSizeFor( modifiers, IMAGE );
338
+ // Output canvas is whatever the server would emit: the crop rect
339
+ // if present, otherwise the full rotated AABB. This makes (u, v)
340
+ // map to the same *output* pixel on both paths.
341
+ const outputSize = outputSizeFor( modifiers, IMAGE );
339
342
 
340
- const exported = exportSourcePixel( state, IMAGE, outputSize, u, v );
341
- const server = serverSourcePixel( modifiers, IMAGE, u, v );
343
+ const exported = exportSourcePixel(
344
+ state,
345
+ IMAGE,
346
+ outputSize,
347
+ u,
348
+ v
349
+ );
350
+ const server = serverSourcePixel( modifiers, IMAGE, u, v );
342
351
 
343
- // Tolerance of 1 source pixel. The two paths compose rotations
344
- // and scales in different orders, so sub-pixel disagreement is
345
- // expected from floating-point. Anything larger is a real bug.
346
- expect( server.x ).toBeCloseTo( exported.x, 0 );
347
- expect( server.y ).toBeCloseTo( exported.y, 0 );
348
- } );
352
+ // Tolerance of 1 source pixel. The two paths compose rotations
353
+ // and scales in different orders, so sub-pixel disagreement is
354
+ // expected from floating-point. Anything larger is a real bug.
355
+ expect( server.x ).toBeCloseTo( exported.x, 0 );
356
+ expect( server.y ).toBeCloseTo( exported.y, 0 );
357
+ } );
358
+ }
349
359
  } );
@@ -47,7 +47,7 @@ $rotation-ruler-accent: var(--wp-admin-theme-color, #3858e9);
47
47
  margin: -1px;
48
48
  padding: 0;
49
49
  border: 0;
50
- clip: rect(0 0 0 0);
50
+ clip-path: inset(50%);
51
51
  overflow: hidden;
52
52
  white-space: nowrap;
53
53
  }
@@ -1,3 +1,4 @@
1
+ import { describe, expect, it } from 'vitest';
1
2
  import {
2
3
  isValidSize,
3
4
  safeBoundedNumber,
@@ -1,3 +1,5 @@
1
+ import { mat2d as m2d, vec2 } from 'gl-matrix';
2
+ import { describe, expect, it } from 'vitest';
1
3
  import {
2
4
  createCamera,
3
5
  worldToScreen,
@@ -302,7 +304,6 @@ describe( 'createExportCamera', () => {
302
304
  const state = makeState();
303
305
  const outputSize = { width: 400, height: 225 };
304
306
  const camera = createExportCamera( state, IMAGE, outputSize );
305
- const { vec2 } = require( 'gl-matrix' );
306
307
  const out = vec2.create();
307
308
  vec2.transformMat2d(
308
309
  out,
@@ -317,7 +318,6 @@ describe( 'createExportCamera', () => {
317
318
  const state = makeState();
318
319
  const outputSize = { width: IMAGE.width, height: IMAGE.height };
319
320
  const camera = createExportCamera( state, IMAGE, outputSize );
320
- const { vec2 } = require( 'gl-matrix' );
321
321
  const topLeft = vec2.create();
322
322
  vec2.transformMat2d( topLeft, [ 0, 0 ], camera );
323
323
  expect( topLeft[ 0 ] ).toBeCloseTo( 0, 0 );
@@ -381,7 +381,6 @@ describe( 'createExportCamera', () => {
381
381
  // output canvas.
382
382
  const outputSize = { width: 400, height: 300 };
383
383
  const exportCamera = createExportCamera( state, IMAGE, outputSize );
384
- const { mat2d: m2d, vec2 } = require( 'gl-matrix' );
385
384
  const inv = m2d.create();
386
385
  m2d.invert( inv, exportCamera );
387
386
  const exportPxVec = vec2.create();
@@ -1,3 +1,13 @@
1
+ import {
2
+ afterAll,
3
+ beforeAll,
4
+ beforeEach,
5
+ describe,
6
+ expect,
7
+ it,
8
+ vi,
9
+ type Mocked,
10
+ } from 'vitest';
1
11
  import {
2
12
  InteractionController,
3
13
  type CropperInteractionActions,
@@ -52,7 +62,7 @@ function createPointerEvent(
52
62
  clientX: 0,
53
63
  clientY: 0,
54
64
  pointerId: 1,
55
- preventDefault: jest.fn(),
65
+ preventDefault: vi.fn(),
56
66
  ...overrides,
57
67
  } as unknown as PointerEvent;
58
68
  }
@@ -67,16 +77,16 @@ function createMockElement(): HTMLElement & {
67
77
  } {
68
78
  const listeners: Record< string, EventListener[] > = {};
69
79
  return {
70
- focus: jest.fn(),
71
- setPointerCapture: jest.fn(),
72
- releasePointerCapture: jest.fn(),
73
- addEventListener: jest.fn( ( type: string, fn: EventListener ) => {
80
+ focus: vi.fn(),
81
+ setPointerCapture: vi.fn(),
82
+ releasePointerCapture: vi.fn(),
83
+ addEventListener: vi.fn( ( type: string, fn: EventListener ) => {
74
84
  if ( ! listeners[ type ] ) {
75
85
  listeners[ type ] = [];
76
86
  }
77
87
  listeners[ type ].push( fn );
78
88
  } ),
79
- removeEventListener: jest.fn( ( type: string, fn: EventListener ) => {
89
+ removeEventListener: vi.fn( ( type: string, fn: EventListener ) => {
80
90
  if ( listeners[ type ] ) {
81
91
  listeners[ type ] = listeners[ type ].filter(
82
92
  ( l ) => l !== fn
@@ -106,7 +116,7 @@ function createWheelEvent(
106
116
  overrides: Partial< WheelEvent > & { currentTarget?: unknown } = {}
107
117
  ): WheelEvent {
108
118
  return {
109
- preventDefault: jest.fn(),
119
+ preventDefault: vi.fn(),
110
120
  deltaY: 0,
111
121
  clientX: 0,
112
122
  clientY: 0,
@@ -127,7 +137,7 @@ function createKeyboardEvent(
127
137
  ): KeyboardEvent {
128
138
  return {
129
139
  key,
130
- preventDefault: jest.fn(),
140
+ preventDefault: vi.fn(),
131
141
  ...overrides,
132
142
  } as unknown as KeyboardEvent;
133
143
  }
@@ -144,7 +154,7 @@ function createTouchEvent(
144
154
  overrides: Partial< TouchEvent > = {}
145
155
  ): TouchEvent {
146
156
  return {
147
- preventDefault: jest.fn(),
157
+ preventDefault: vi.fn(),
148
158
  touches,
149
159
  ...overrides,
150
160
  } as unknown as TouchEvent;
@@ -166,7 +176,7 @@ function createContainerRect( overrides: Partial< DOMRect > = {} ): DOMRect {
166
176
  bottom: 300,
167
177
  x: 0,
168
178
  y: 0,
169
- toJSON: jest.fn(),
179
+ toJSON: vi.fn(),
170
180
  ...overrides,
171
181
  } as DOMRect;
172
182
  }
@@ -182,13 +192,13 @@ function createMockDocument(): Document & {
182
192
  } {
183
193
  const listeners: Record< string, EventListener[] > = {};
184
194
  return {
185
- addEventListener: jest.fn( ( type: string, fn: EventListener ) => {
195
+ addEventListener: vi.fn( ( type: string, fn: EventListener ) => {
186
196
  if ( ! listeners[ type ] ) {
187
197
  listeners[ type ] = [];
188
198
  }
189
199
  listeners[ type ].push( fn );
190
200
  } ),
191
- removeEventListener: jest.fn( ( type: string, fn: EventListener ) => {
201
+ removeEventListener: vi.fn( ( type: string, fn: EventListener ) => {
192
202
  if ( listeners[ type ] ) {
193
203
  listeners[ type ] = listeners[ type ].filter(
194
204
  ( l ) => l !== fn
@@ -208,7 +218,7 @@ function createMockDocument(): Document & {
208
218
  describe( 'InteractionController', () => {
209
219
  const containerSize: Size = { width: 500, height: 300 };
210
220
  const imageSize: Size = { width: 500, height: 300 };
211
- let actionMocks: jest.Mocked< CropperInteractionActions >;
221
+ let actionMocks: Mocked< CropperInteractionActions >;
212
222
 
213
223
  // Store original requestAnimationFrame so we can restore it.
214
224
  const originalRAF = globalThis.requestAnimationFrame;
@@ -220,7 +230,7 @@ describe( 'InteractionController', () => {
220
230
  cb( 0 );
221
231
  return 0;
222
232
  };
223
- globalThis.cancelAnimationFrame = jest.fn();
233
+ globalThis.cancelAnimationFrame = vi.fn();
224
234
  } );
225
235
 
226
236
  afterAll( () => {
@@ -230,11 +240,11 @@ describe( 'InteractionController', () => {
230
240
 
231
241
  beforeEach( () => {
232
242
  actionMocks = {
233
- setPan: jest.fn(),
234
- setZoom: jest.fn(),
235
- setZoomAtPoint: jest.fn(),
236
- snapRotate90: jest.fn(),
237
- toggleFlip: jest.fn(),
243
+ setPan: vi.fn(),
244
+ setZoom: vi.fn(),
245
+ setZoomAtPoint: vi.fn(),
246
+ snapRotate90: vi.fn(),
247
+ toggleFlip: vi.fn(),
238
248
  };
239
249
  } );
240
250
 
@@ -290,8 +300,8 @@ describe( 'InteractionController', () => {
290
300
 
291
301
  it( 'ignores touch pointerdown so touch gestures own touch input', () => {
292
302
  const state = makeState( { zoom: 2 } );
293
- const onGestureStart = jest.fn();
294
- const onStatusChange = jest.fn();
303
+ const onGestureStart = vi.fn();
304
+ const onStatusChange = vi.fn();
295
305
  const { controller } = createController( state, {
296
306
  onGestureStart,
297
307
  onStatusChange,
@@ -333,7 +343,7 @@ describe( 'InteractionController', () => {
333
343
  // Simulate pointerup.
334
344
  el._fire( 'pointerup', createPointerEvent() );
335
345
 
336
- jest.clearAllMocks();
346
+ vi.clearAllMocks();
337
347
 
338
348
  // Another pointermove should not dispatch because the listener
339
349
  // was removed after pointerup.
@@ -350,8 +360,8 @@ describe( 'InteractionController', () => {
350
360
 
351
361
  it( 'calls onGestureStart on pointerdown and onGestureEnd on pointerup', () => {
352
362
  const state = makeState( { zoom: 2 } );
353
- const onGestureStart = jest.fn();
354
- const onGestureEnd = jest.fn();
363
+ const onGestureStart = vi.fn();
364
+ const onGestureEnd = vi.fn();
355
365
  const { controller } = createController( state, {
356
366
  onGestureStart,
357
367
  onGestureEnd,
@@ -380,7 +390,7 @@ describe( 'InteractionController', () => {
380
390
 
381
391
  it( 'reports isDragging via onStatusChange', () => {
382
392
  const state = makeState( { zoom: 2 } );
383
- const onStatusChange = jest.fn();
393
+ const onStatusChange = vi.fn();
384
394
  const { controller } = createController( state, {
385
395
  onStatusChange,
386
396
  } );
@@ -505,7 +515,7 @@ describe( 'InteractionController', () => {
505
515
  el
506
516
  );
507
517
 
508
- jest.clearAllMocks();
518
+ vi.clearAllMocks();
509
519
 
510
520
  const wheelEvent = createWheelEvent( {
511
521
  deltaY: -100,
@@ -521,12 +531,12 @@ describe( 'InteractionController', () => {
521
531
  } );
522
532
 
523
533
  it( 'calls onGestureStart on first wheel, onGestureEnd after debounce', () => {
524
- jest.useFakeTimers( {
525
- doNotFake: [ 'requestAnimationFrame', 'cancelAnimationFrame' ],
534
+ vi.useFakeTimers( {
535
+ toFake: [ 'setTimeout', 'clearTimeout' ],
526
536
  } );
527
537
  const state = makeState( { zoom: 2 } );
528
- const onGestureStart = jest.fn();
529
- const onGestureEnd = jest.fn();
538
+ const onGestureStart = vi.fn();
539
+ const onGestureEnd = vi.fn();
530
540
  const { controller } = createController( state, {
531
541
  onGestureStart,
532
542
  onGestureEnd,
@@ -546,11 +556,11 @@ describe( 'InteractionController', () => {
546
556
  expect( onGestureStart ).toHaveBeenCalledTimes( 1 );
547
557
 
548
558
  // Advance past the 300ms debounce.
549
- jest.advanceTimersByTime( 350 );
559
+ vi.advanceTimersByTime( 350 );
550
560
 
551
561
  expect( onGestureEnd ).toHaveBeenCalledTimes( 1 );
552
562
 
553
- jest.useRealTimers();
563
+ vi.useRealTimers();
554
564
  } );
555
565
  } );
556
566
 
@@ -848,8 +858,8 @@ describe( 'InteractionController', () => {
848
858
 
849
859
  it( 'calls onGestureStart/onGestureEnd for single-finger pan', () => {
850
860
  const state = makeState( { zoom: 2 } );
851
- const onGestureStart = jest.fn();
852
- const onGestureEnd = jest.fn();
861
+ const onGestureStart = vi.fn();
862
+ const onGestureEnd = vi.fn();
853
863
  const { controller } = createController( state, {
854
864
  onGestureStart,
855
865
  onGestureEnd,
@@ -873,7 +883,7 @@ describe( 'InteractionController', () => {
873
883
 
874
884
  it( 'reports isDragging on first single-finger move', () => {
875
885
  const state = makeState( { zoom: 2 } );
876
- const onStatusChange = jest.fn();
886
+ const onStatusChange = vi.fn();
877
887
  const { controller } = createController( state, {
878
888
  onStatusChange,
879
889
  } );
@@ -987,8 +997,8 @@ describe( 'InteractionController', () => {
987
997
 
988
998
  it( 'calls onGestureStart for pinch, onGestureEnd on touchend', () => {
989
999
  const state = makeState( { zoom: 1 } );
990
- const onGestureStart = jest.fn();
991
- const onGestureEnd = jest.fn();
1000
+ const onGestureStart = vi.fn();
1001
+ const onGestureEnd = vi.fn();
992
1002
  const { controller } = createController( state, {
993
1003
  onGestureStart,
994
1004
  onGestureEnd,
@@ -1031,7 +1041,7 @@ describe( 'InteractionController', () => {
1031
1041
  createTouchEvent( [ { clientX: 210, clientY: 155 } ] )
1032
1042
  );
1033
1043
  expect( actionMocks.setPan ).toHaveBeenCalled();
1034
- jest.clearAllMocks();
1044
+ vi.clearAllMocks();
1035
1045
 
1036
1046
  // Second finger arrives via touchstart.
1037
1047
  controller.handleTouchStart(
@@ -1122,7 +1132,7 @@ describe( 'InteractionController', () => {
1122
1132
  ] )
1123
1133
  );
1124
1134
 
1125
- jest.clearAllMocks();
1135
+ vi.clearAllMocks();
1126
1136
 
1127
1137
  // One finger lifts — move with 1 touch should NOT pan
1128
1138
  // because didPinch is true.
@@ -1225,7 +1235,7 @@ describe( 'InteractionController', () => {
1225
1235
  createPointerEvent( { clientX: 100, clientY: 100 } ),
1226
1236
  el
1227
1237
  );
1228
- jest.clearAllMocks();
1238
+ vi.clearAllMocks();
1229
1239
 
1230
1240
  controller.destroy();
1231
1241
 
@@ -28,6 +28,7 @@
28
28
  * sideways during fine rotation would have been caught by this test —
29
29
  * the center would agree (symmetric bug) but the corners would drift.
30
30
  */
31
+ import { describe, expect, it } from 'vitest';
31
32
  import { mat2d, vec2 } from 'gl-matrix';
32
33
  import {
33
34
  createCamera,
@@ -124,8 +125,8 @@ const PROBES: { label: string; u: number; v: number }[] = [
124
125
  { label: 'interior-2', u: 0.8, v: 0.25 },
125
126
  ];
126
127
 
127
- // All (state × output-size × probe) combinations flattened into rows
128
- // for `it.each`. Each row is self-describing; on failure, the label
128
+ // All (state × output-size × probe) combinations flattened into rows.
129
+ // Each row is self-describing; on failure, the label
129
130
  // pinpoints the exact state and probe point where preview / export
130
131
  // disagreed.
131
132
  interface ParityRow {
@@ -216,26 +217,33 @@ describe( 'Preview ↔ Export parity', () => {
216
217
  // miss.
217
218
  const rows = buildRows();
218
219
 
219
- it.each( rows )( '$label', ( { state, outputSize, u, v } ) => {
220
- const screen = stencilScreenPoint( state, CONTAINER, IMAGE, u, v );
221
- const outputPoint = {
222
- x: u * outputSize.width,
223
- y: v * outputSize.height,
224
- };
225
- const preview = previewSourcePixel( state, CONTAINER, IMAGE, screen );
226
- const exported = exportSourcePixel(
227
- state,
228
- IMAGE,
229
- outputSize,
230
- outputPoint
231
- );
220
+ for ( const { label, state, outputSize, u, v } of rows ) {
221
+ it( label, () => {
222
+ const screen = stencilScreenPoint( state, CONTAINER, IMAGE, u, v );
223
+ const outputPoint = {
224
+ x: u * outputSize.width,
225
+ y: v * outputSize.height,
226
+ };
227
+ const preview = previewSourcePixel(
228
+ state,
229
+ CONTAINER,
230
+ IMAGE,
231
+ screen
232
+ );
233
+ const exported = exportSourcePixel(
234
+ state,
235
+ IMAGE,
236
+ outputSize,
237
+ outputPoint
238
+ );
232
239
 
233
- // Tolerance of 1 source pixel. Intermediate scale factors differ
234
- // between the preview (container pixels) and export (output
235
- // pixels) paths, so sub-pixel agreement is unrealistic. A drift
236
- // of ~1px is still visibly correct; anything larger is a real
237
- // coordinate-system mismatch.
238
- expect( preview.x ).toBeCloseTo( exported.x, 0 );
239
- expect( preview.y ).toBeCloseTo( exported.y, 0 );
240
- } );
240
+ // Tolerance of 1 source pixel. Intermediate scale factors differ
241
+ // between the preview (container pixels) and export (output
242
+ // pixels) paths, so sub-pixel agreement is unrealistic. A drift
243
+ // of ~1px is still visibly correct; anything larger is a real
244
+ // coordinate-system mismatch.
245
+ expect( preview.x ).toBeCloseTo( exported.x, 0 );
246
+ expect( preview.y ).toBeCloseTo( exported.y, 0 );
247
+ } );
248
+ }
241
249
  } );
@@ -24,6 +24,7 @@
24
24
  *
25
25
  * ...run these tests to verify the two paths still agree.
26
26
  */
27
+ import { describe, expect, it } from 'vitest';
27
28
  import {
28
29
  createCamera,
29
30
  worldToScreen,
@@ -1,3 +1,4 @@
1
+ import { describe, expect, it } from 'vitest';
1
2
  import type { CropperState, Size } from '../types';
2
3
  import { ABSOLUTE_MIN_ZOOM, DEFAULT_STATE, MAX_ZOOM } from '../constants';
3
4
  import { cropperReducer, enforceContainment, isStateDirty } from '../state';
@@ -1,3 +1,4 @@
1
+ import { describe, expect, it } from 'vitest';
1
2
  import {
2
3
  computeFreeResizeRect,
3
4
  computeLockedResizeRect,
@@ -1,3 +1,4 @@
1
+ import { beforeEach, describe, expect, it } from 'vitest';
1
2
  import type { CropperState, TransformOperation } from '../../types';
2
3
  import { DEFAULT_STATE } from '../../constants';
3
4
  import { applyOperationToState, stateFromPipeline } from '../pipeline';