Repository navigation
Version 2.0.0: Vue 3, TypeScript types and new features - #31
Merged
Merged
Conversation
- Vue 3: emits option, beforeUnmount, no .native modifier, plugin install(app). The component declares the native events it emits again, so a parent listener does not run twice. - The plugin registers the component as InstagramCropper. Templates can still use <instagram-cropper>. - Build with Vite 8 in library mode (ES module and UMD). The CSS stays in the JavaScript file as in 1.x. Plain CSS instead of SCSS. - Remove the rAF and toBlob polyfills. Every browser that Vue 3 supports has both. The polyfill also replaced Array.isArray globally. - Remove the pointerstart and pointerend listeners. These DOM events do not exist. - Lint with ESLint 9 and eslint-config-avidofood 4. - Add a Vitest test base with canvas and image stubs for jsdom. - Remove the vue-cli, laravel-mix and babel files and the committed dist/ build. npm pack builds dist/ (prepack). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YMPFxuWE93UgAB5X6B2yJT
Browsers apply the EXIF orientation of an image themselves since 2020 (Chrome 81, Firefox 77, Safari 13.1), also in naturalWidth and in canvas drawImage(). The 1.x code read the orientation of a chosen file and turned the image again with canvas-exif-orientation. A photo that was turned in the iOS photo editor showed up in the wrong orientation. Checked on 2026-10-07 with a JPEG with orientation 6 in Chrome 154 and Firefox 145: both report the turned size and draw the image correctly. The 1.x code path turned that image a second time. PR #17 by Alghost found the problem and added a prop to override the orientation. Without the second turn, the prop is not needed. The package now has no runtime dependencies. Co-authored-by: Alghost <alghost.lee@gmail.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YMPFxuWE93UgAB5X6B2yJT
- Every cropper gets its own data object. 1.x returned the same object for all croppers, so two croppers on one page shared their image. - Every cropper gets its own debounce timers. With one shared timer, only the last of several croppers that mounted at the same time loaded its image. - The document listeners for the end of a drag are removed when the drag ends and on unmount. Before, they stayed forever and emitted mouseup and similar events for clicks anywhere on the page. - On unmount, the component cancels a pending image load. Before, it threw a TypeError after the unmount. - promisedBlob() resolves with null without an image, as the README says. Before, it rejected in the browser. - forceCacheBreak works with a relative URL. Before, new URL() threw. A data or blob URL stays as it is. Before, the parameter broke it. - The container gets the class cropper--dropzone while a file is over it. The styles existed, but the class was never set. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YMPFxuWE93UgAB5X6B2yJT
Every browser that Vue 3 supports fires wheel. DOMMouseScroll is the event of Firefox before version 17. Chrome and Safari only call mousewheel listeners when the element has no wheel listener. Vue before 3.2.38 also cannot bind a native listener with capital letters such as DOMMouseScroll, so the package now works the same from Vue 3.2.0 on. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YMPFxuWE93UgAB5X6B2yJT
Hand-written types for the props, the metadata, the events, the methods and the plugin. They also register InstagramCropper as a global component for template type checks. The build copies them to dist/index.d.ts and dist/index.d.mts, and package.json points to them with "types" conditions in "exports". tests/types/usage.ts checks the types with tsc. Checked with Vue 3.2.0, 3.2.47, 3.3.4 and 3.5.43. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YMPFxuWE93UgAB5X6B2yJT
zoom() now limits the new scale ratio to the size that fills the canvas. Before, the scale ratio went below that size for a moment and the scaleRatio watcher set it back. Vue 3 runs the watchers in another order than Vue 2, so the component emitted zoom twice for every wheel step at the limit, although the image kept its size. vue-cropgram marks an image as changed on zoom. 1.x also moved the image sideways at the limit: 20 wheel steps moved it by 10.6 canvas pixels. Now it stays where it is. Found with a parity test in Chrome 154 that runs the same steps with 1.1.5 on Vue 2.6 and with this branch on Vue 3.5. All other steps give the same position, zoom, output and events. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YMPFxuWE93UgAB5X6B2yJT
The demo moves from an in-DOM template with Vue 2 to App.vue with Vue 3. GitHub Pages serves index.html from master, so the built bundle in demo/public/build is part of the repository. The image of "Load other Object" now loads with crossOrigin, so the download buttons work for it. An image error shows a message instead of alert(). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YMPFxuWE93UgAB5X6B2yJT
The README shows the installation for Vue 3, the TypeScript types and an upgrade section from 1.x to 2.0. The CHANGELOG lists every change of 2.0.0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YMPFxuWE93UgAB5X6B2yJT
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YMPFxuWE93UgAB5X6B2yJT
Lint, tests, type checks and npm pack on Node.js 22 and 24, as in vue-responsive-video-background-player. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YMPFxuWE93UgAB5X6B2yJT
Found by the first read-only review with Codex (gpt-6-astra). - Every image load gets a number. A newer load, remove() by the user, refresh() and the unmount make an older load stale, and its image, file and error callbacks do nothing. Before, a slow image that the user replaced showed up after the new one, and a load that finished after the unmount threw a TypeError. Both came from 1.x. - After applying metadata, the component draws. Before, the watchers drew only when a number changed, so another image with the same size and crop left the old image on the canvas. vue-cropgram switches between saved crops like this. From 1.x. - With preventWhiteSpace, the maximum zoom is at least the size that fills the canvas. For a narrow image, the maximum was smaller, and Vue 3 ran the watchers so that the image ended smaller than the canvas. Vue 2 hid this by its watcher order. - With preventWhiteSpace, metadata whose crop does not fill the canvas, for example from a larger canvas, shows the image filled and centered, as 1.x did. Found with the parity test against 1.1.5. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YMPFxuWE93UgAB5X6B2yJT
Found by the first read-only review with Codex (gpt-6-astra). - Without an image, scaleRatio is null before the first image and 0 after remove(). - After remove(), a pending update carries metadata without an image, as in 1.x. The update payload type includes that case. - init carries the component instance with props, outputWidth, outputHeight and clipPlugins, not only the methods. Checked with Vue 3.2.0, 3.2.47, 3.3.4, 3.4.38 and 3.5.43. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YMPFxuWE93UgAB5X6B2yJT
The CHANGELOG said that the unmount cancels a pending image load. Only the new load numbers do that, so the entry now says what happens. The UMD build sets the global variable VueInstagramCropper instead of index. The README says that update can carry metadata without an image right after remove(). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YMPFxuWE93UgAB5X6B2yJT
release.yml is the reviewed workflow of vue-responsive-video-background-player, unchanged. A version tag such as 2.0.0 on master runs lint, tests and npm pack, and then publishes with OIDC. No npm token and no 2FA prompt. The README describes the steps. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YMPFxuWE93UgAB5X6B2yJT
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YMPFxuWE93UgAB5X6B2yJT
Found by the second read-only review with Codex (gpt-6-astra). - After metadata, the component draws only when the image itself changed. Before, every metadata drew and emitted update, so a parent with :src="crop" @update="crop = $event" looped. A regression of ce0f1d9. 1.x settled, and 2.0 settles again. - A new src gets its load number right away, and the number goes through the 30ms debounce. Before, the old image could still show up in those 30ms, and a src that waited for the debounce replaced a later remove() or a later chosen file. - remove() by the user stops every load, also the first image and a src that waits for the debounce, and ends the loading state. src set to null also ends the loading state. Before, the spinner stayed. - refresh() does nothing when the component unmounts before the next tick. Before, it threw a TypeError. From 1.x. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YMPFxuWE93UgAB5X6B2yJT
The update payload can be metadata without an image, so the example now uses InstagramCropperEmits['update'] and checks img. The type test compiles the same example. The CHANGELOG lists the fixes of the second review. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YMPFxuWE93UgAB5X6B2yJT
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YMPFxuWE93UgAB5X6B2yJT
Found by the third read-only review with Codex (gpt-6-astra). - Metadata of the current image draws when another load cleared the canvas. Before, the canvas stayed empty and the spinner stayed. A regression of dc01a1c. - remove() in a handler of initial-image-loaded clears the image that waits for the next frame. Before, the frame drew it anyway. - After file-loaded, the component checks the load number again, so remove() in that handler stops the file. Before, the file showed up. - Remove the leftover this.orientation from the EXIF code. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YMPFxuWE93UgAB5X6B2yJT
The third review found that the README upgrade section did not name changes such as the end of the document events after a drag and the loading-end event after a cancelled load. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YMPFxuWE93UgAB5X6B2yJT
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YMPFxuWE93UgAB5X6B2yJT
Found by the fourth read-only review with Codex (gpt-6-astra). A handler can call remove() while the component is in the middle of a load or a draw. - drawFrame() stops after draw and new-image-drawn when the image changed. Before, remove() in the first draw handler left hasImage() true without an image, and a click no longer opened the file chooser. A regression of ffc75ee. - A chosen file stops when a handler of file-choose called remove(). - $_c_onload() and the file path check the load number after image-remove-onload, so remove() in that handler stops the new src or file. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YMPFxuWE93UgAB5X6B2yJT
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YMPFxuWE93UgAB5X6B2yJT
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YMPFxuWE93UgAB5X6B2yJT
Found by the fifth read-only review with Codex (gpt-6-astra). From 1.x: remove() in a mouseup or touchend handler during a drag left dragging true, so the next image followed the mouse without a pressed button. Every pointer end now resets the gesture state, also without an image. The test for metadata during initial-image-loaded documents that scaleRatio can still be null there, as in 1.x. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YMPFxuWE93UgAB5X6B2yJT
Found by the fifth read-only review with Codex (gpt-6-astra). getMetadata() in a handler of initial-image-loaded returns the image with scaleRatio null, because the watchers set it later. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YMPFxuWE93UgAB5X6B2yJT
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YMPFxuWE93UgAB5X6B2yJT
The cropper measured its container only at the mount and on a window resize. A container that changed its size for another reason, for example a sidebar or a modal, kept the old canvas. A container that was hidden at first with v-show reported a width such as 100%, which the old code read as 10 pixels, so the canvas stayed at 20 x 20. - A ResizeObserver measures the container. It replaces the window resize listener. Without ResizeObserver, for example in jsdom, the size stays as it was at the mount. - A size that is not in pixels counts as 0. Nothing is drawn while the container has no size. When it gets a size, the image gets its first placement, as if it had loaded then. - A size change without an image redraws the placeholder instead of starting the component again (no second init event). Checked in Chrome 154 with v-show and with a container that grows from 300 to 450 pixels. The parity test against 1.1.5 is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YMPFxuWE93UgAB5X6B2yJT
An optional last argument of generateDataUrl(), generateBlob(), promisedBlob() and of the object from saving() sets the output size: width, height, maxWidth and maxHeight, named as in cropperjs. width or height sets that side and keeps the aspect ratio. Both together make the output fit into the box. maxWidth and maxHeight only scale down. Users asked for a fixed output size, for example 1080 pixels for the server: vue-cropgram #27, vue-croppa #122, react-easy-crop #176, vue-advanced-cropper #130. Without options, the output stays as in 1.x (scale factor 1, same drawImage call). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YMPFxuWE93UgAB5X6B2yJT
Found by the vue-cropgram session. The browser resolves a relative image src against document.baseURI, which a <base> element can set. forceCacheBreak resolved it against window.location.href, so on a page with <base href> the cropper loaded another file with forceCacheBreak than without it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YMPFxuWE93UgAB5X6B2yJT
The rule-of-thirds grid now also shows while the user zooms with the wheel, and for 500ms after the last zoom step, as in Instagram. Before, the wheel handler set scrolling back to false in the same tick, before the frame was drawn, so the grid never showed while zooming. This was on the TODO list of the README and is vue-croppa #115. The new prop showGrid (default true, named as in react-easy-crop) can hide the grid. The internal flag scrolling is replaced by zooming. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YMPFxuWE93UgAB5X6B2yJT
With zoomOnWheel false, the wheel does not zoom and the cropper no longer calls preventDefault(), so the page scrolls over it. The component still emits the wheel event. Default true, named as in cropperjs. Users of comparable croppers asked for this, for example vue-advanced-cropper #175 and vue-croppa's disableScrollToZoom. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YMPFxuWE93UgAB5X6B2yJT
crossOrigin sets the CORS mode for an image from another origin: 'anonymous' (default, as before) or 'use-credentials' for an image server that needs the cookies of the user. Cross-origin images are the most discussed problem of comparable croppers, for example vue-advanced-cropper #44, #283 and PR #289 (withCredentials) and vue-croppa #102. The README explains the server headers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YMPFxuWE93UgAB5X6B2yJT
- The canvas can get the focus (tabindex 0, role application, so that screen readers pass the arrow keys on) and shows a focus outline. - While it has the focus, the arrow keys move the image by 10 pixels of the container (50 with Shift), plus and minus zoom it, and Enter or Space open the file chooser without an image. Shortcuts with Ctrl, Alt or Meta stay with the browser. The grid shows briefly. - The canvas, the remove button and the fullscreen button have English texts for screen readers. The new prop labels replaces single texts, for example in another language. - The hidden file input is no longer a tab stop without a visible focus (tabindex -1, aria-hidden). WCAG 2.1.1, 2.5.7 and 4.1.2. Requested for comparable croppers in cropperjs #1169 and react-easy-crop #569. Checked in Chrome 154 with real key presses and the accessibility tree. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YMPFxuWE93UgAB5X6B2yJT
The watchers compute the image size in floating point, so a height of
800 can be 799.99999. The output canvas cut that off to 799 pixels: a
4:5 crop of 640 x 800 gave 640 x 799, and { width: 1080 } gave
1080 x 1348 instead of 1080 x 1350. From 1.x.
A size within 1e-6 of a whole number now counts as that number. A real
fraction such as 547.6 is still cut off as in 1.x, because a partly
covered last row would be transparent in a PNG and dark in a JPEG. The
parity test against 1.1.5 is unchanged. Found while checking the
README recipe for a 4:5 crop in Chrome 154.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YMPFxuWE93UgAB5X6B2yJT
The cropper already renders on the server, because it uses window and
document only after the mount. A test renders it in the Node.js
environment without a DOM, and another test hydrates the server HTML
in jsdom without a mismatch. The README shows a Nuxt plugin.
The README also shows how to crop every image to the same aspect ratio
and size: a container with CSS aspect-ratio, prevent-white-space and
{ width: 1080 }. Checked in Chrome 154: a 4:5 container gives 1080 x
1350 pixels, also after the container grows. This covers the common
case of the forceAspect TODO without a new prop.
The test setup installs the browser stubs only when a DOM exists.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YMPFxuWE93UgAB5X6B2yJT
A new button downloads the crop 1080 pixels wide, and a line explains the keyboard. The demo bundle is rebuilt with the new features. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YMPFxuWE93UgAB5X6B2yJT
Found by the review of the feature round with Codex (gpt-6-astra). - A new load stops the grid timer, and the timer does not redraw while an image loads. Before, the timer redrew the old image during a load, ended the load state and emitted the old crop. A parent that wrote update back to src then replaced the new image with the old one. - A change of showGrid redraws the canvas, so a grid that is on the canvas goes away. - Pinch zoom shows the grid for 500ms after the last step, as the wheel and the keys do. - The unmount test now checks that clearTimeout runs for the grid timer. The old test also passed without the cleanup. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YMPFxuWE93UgAB5X6B2yJT
Found by the review of the feature round with Codex (gpt-6-astra). Hiding the container, for example with v-show, made its size 0. The size change then placed the image again in a canvas of 0 pixels: with preventWhiteSpace it filled the canvas from scratch, without it the bounce check moved the image. Showing it again lost the crop and, with preventWhiteSpace, emitted new-image-drawn a second time. - A size of 0 no longer changes the image or its crop. - The component remembers the size of the last draw. When the container shows up with that size, it only draws again. - Metadata that arrives while the container is hidden is laid out when the container shows up (bounce check, or fill with preventWhiteSpace). Checked in Chrome 154 with v-show, with and without preventWhiteSpace. The parity test against 1.1.5 is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YMPFxuWE93UgAB5X6B2yJT
Found by the review of the feature round with Codex (gpt-6-astra).
- A container size such as 401.25px keeps its fraction. Before, the
size was cut to 401, so a responsive 4:5 container 321px wide gave
1080 x 1349 instead of 1080 x 1350 with { width: 1080 }. Containers
with whole pixel sizes behave as before (parity test unchanged).
- Output options must be finite. Infinity is left out like any other
invalid value.
- An output side over 32767 pixels throws a RangeError with a clear
message instead of an empty canvas. promisedBlob() rejects.
- The comments, the tests and the CHANGELOG name the real floating
point value 799.9999999999999, not 799.99999, and describe where the
options of saving() go.
Checked in Chrome 154 with containers 321 and 483 pixels wide.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YMPFxuWE93UgAB5X6B2yJT
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YMPFxuWE93UgAB5X6B2yJT
Found by the short review of the feature fixes with Codex (gpt-6-astra, medium). - $_c_draw(true) marks a cosmetic draw: the grid timer, a change of showGrid and the redraw when a hidden container shows again with the same size. drawFrame() skips it while an image loads, also when the frame was already queued. Before, a showGrid change during a load ended the load state and emitted the old crop, and a parent that wrote update back to src then replaced the new image. - Metadata in a visible container keeps the size of the last draw. Before, unchanged metadata from a parent that writes update back to src cleared it without a new draw, and the next hide and show with preventWhiteSpace filled the canvas from scratch. - A new test for metadata that arrives while the container is hidden with preventWhiteSpace fails before a533140. The older test for this case also passed without the fix. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YMPFxuWE93UgAB5X6B2yJT
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YMPFxuWE93UgAB5X6B2yJT
jsdom 30 needs Node.js ^22.22.2, ^24.15.0 or >=26. .nvmrc pins 24.21.0, and the CI matrix uses the ranges ^22.22.2 and ^24.15.0. The README and the CHANGELOG name the new requirement of the development tools. The published files are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YMPFxuWE93UgAB5X6B2yJT
The type tests in tests/types run with TypeScript 7.0.2. They pass with Vue 3.2.0, 3.2.47, 3.3.4, 3.4.38 and 3.5.43, and a deliberate type error still fails. The package uses no vue-tsc, and the Vite build does not use TypeScript. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YMPFxuWE93UgAB5X6B2yJT
eslint-config-avidofood 5 needs ESLint 10 and brings eslint-plugin-import-x instead of eslint-plugin-import. The rule names stay import/..., and eslint.config.mjs is unchanged. The lint result is the same as before: 0 errors and the known no-console warning from 1.x. ESLint 10 needs Node.js ^20.19, ^22.13 or >=24, which the CI versions ^22.22.2 and ^24.15.0 meet. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YMPFxuWE93UgAB5X6B2yJT
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Version 2.0.0 ports the cropper to Vue 3 and replaces the build tools. The props, the events and the methods keep their names from 1.x. The README has an upgrade section, and
CHANGELOG.mdlists every change.Version 1.x (Vue 2) stays on the new branch
1x.Breaking changes
vueis a peer dependency).app.component()orapp.use(Plugin). The tag<instagram-cropper>still works.dist/. Deep imports fromsrc/ordist/index.common.jsno longer work. The UMD global isVueInstagramCropperinstead ofindex.promisedBlob()resolves withnullinstead of a rejection.DOMMouseScrollandmousewheelare gone. Usewheel.Added
ResizeObserver. A container that is hidden at first, for example withv-show, now works and keeps the crop.promisedBlob('image/jpeg', 0.9, { width: 1080 }). The same works withgenerateDataUrl(),generateBlob()andsaving().showGrid,zoomOnWheel,crossOriginandlabels.Fixed
These bugs came from 1.x:
forceCacheBreakbroke relative URLs, data URLs and blob URLs.The CHANGELOG lists all fixes.
Tooling
npm packbuildsdist/first (prepack).^22.22.2and^24.15.0.release.ymlpublishes a version tag with npm trusted publishing. It is the reviewed workflow of vue-responsive-video-background-player.Checks
publintreports no errors.@arethetypeswrong/clifinds no problems.tscand a Vite build.npm ci --ignore-scriptspacks a byte-identical tarball.After the merge
npm dist-tag add vue-instagram-cropper@1.1.5 1x.2.0.0onmaster. TheReleaseworkflow then publishes the package.🤖 Generated with Claude Code
https://claude.ai/code/session_01YMPFxuWE93UgAB5X6B2yJT