Skip to content

Invoke is a leading creative engine that uses image and video generation models to empower professionals, artists, and enthusiasts to generate and create visual media using the latest AI-driven technologies. The solution offers an industry-leading application interface, and serves as the foundation for multiple commercial products.

531 B
Raw Blame
import type { Editor } from 'features/cropper/lib/editor';
import { atom } from 'nanostores';

export type CropImageModalState = {
  editor: Editor;
  onApplyCrop: () => Promise<void> | void;
  onReady: () => Promise<void> | void;
};

const $state = atom<CropImageModalState | null>(null);

const open = (state: CropImageModalState) => {
  $state.set(state);
};

const close = () => {
  const state = $state.get();
  state?.editor.destroy();
  $state.set(null);
};

export const cropImageModalApi = {
  $state,
  open,
  close,
};