// Type definitions for scratch-gui redux state and events
// Project: https://github.com/LLK/scratch-gui
///
///
///
///
declare namespace ScratchGUI {
interface ReduxState extends ScratchPaint.ReduxState {
scratchGui: ScratchGUIState;
locales: LocaleState;
session: SessionState;
}
type ReduxEvent = ScratchGUIEvent | LocaleEvent | ScratchPaint.ReduxEvent;
const enum AlertType {
Standard = 'STANDARD',
Extension = 'EXTENSION',
Inline = 'INLINE'
}
const enum AlertLevel {
Success = 'success',
Info = 'info',
Warning = 'warn'
}
const enum Alert {
CreateSuccess = 'createSuccess',
CreateCopySuccess = 'createCopySuccess',
CreateRemixSuccess = 'createRemixSuccess',
Creating = 'creating',
CreatingCopy = 'creatingCopy',
CreatingRemix = 'creatingRemix',
CreatingError = 'creatingError',
SavingError = 'savingError',
SaveSuccess = 'saveSuccess',
Saving = 'saving',
CloudInfo = 'cloudInfo',
ImportingAsset = 'importingAsset'
}
// Not going to bother listing all of the IDs here.
type Deck = string;
const enum DragType {
Costume = 'COSTUME',
Sound = 'SOUND',
Sprite = 'SPRITE'
}
type DragPayload = VM.Costume | VM.Sound;
const enum StageDisplaySize {
Large = 'large',
Small = 'small',
LargeConstrained = 'largeConstrained'
}
const enum Menu {
About = 'aboutMenu',
Account = 'accountMenu',
File = 'fileMenu',
Edit = 'editMenu',
Language = 'languageMenu',
Login = 'loginMenu'
}
const enum Modal {
BackdropLibrary = 'backdropLibrary',
CostumeLibrary = 'costumeLibrary',
ExtensionLibrary = 'extensionLibrary',
LoadingProject = 'loadingProject',
Telemetry = 'telemetryModal',
SoundLibrary = 'soundLibrary',
SpriteLibrary = 'spriteLibrary',
SoundRecorder = 'soundRecorder',
Connection = 'connectionModal',
TipsLibrary = 'tipsLibrary'
}
type ProjectData = string | Uint8Array;
const enum LoadingState {
NotLoaded = 'NOT_LOADED',
Error = 'ERROR',
AutoUpdating = 'AUTO_UPDATING',
CreatingCopy = 'CREATING_COPY',
CreatingNew = 'CREATING_NEW',
FetchingNewDefault = 'FETCHING_NEW_DEFAULT',
FetchingWithID= 'FETCHING_WITH_ID',
LoadingVMFIleUpload = 'LOADING_VM_FILE_UPLOAD',
LoadingVMNewDefault = 'LOADING_VM_NEW_DEFAULT',
LoadingVMWithID = 'LOADING_VM_WITH_ID',
ManualUpdating = 'MANUAL_UPDATING',
Remixing = 'REMIXING',
ShowingWithID = 'SHOWING_WITH_ID',
ShowingWithoutID = 'SHOWING_WITHOUT_ID',
UpdatingBeforeCopy = 'UPDATING_BEFORE_COPY',
UpdatingBeforeNew = 'UPDATING_BEFORE_NEW'
}
const enum DeletedItemType {
Costume = 'Costume',
Sound = 'Sound',
Sprite = 'Sprite'
}
const enum ActiveTabIndex {
Blocks = 0,
Costumes = 1,
Sounds = 2
}
interface ScratchGUIState {
alerts: {
visible: boolean;
alertsList: Array<{
alertType: AlertType;
level: AlertLevel;
alertId?: Alert;
extensionId?: string;
content?: React.Element;
message?: string;
iconURL?: string;
iconSpinner?: boolean;
closeButton?: boolean;
showReconnect?: boolean;
showDownload?: boolean;
showSaveNow?: boolean;
}>;
};
assetDrag: {
dragging: boolean;
currentOffset: {
x: number;
y: number;
} | null;
img: string | null;
index?: number;
dragType?: DragType;
payload?: DragPayload;
};
blockDrag: boolean;
cards: {
visible: boolean;
content: Record;
activeDeckId: Deck | null;
step: number;
x: number;
y: number;
expanded: boolean;
dragging: boolean;
};
colorPicker: {
active: boolean;
callback(color: string): void;
};
connectionModal: {
extensionId: string | null;
};
customProcedures: {
active: boolean;
mutator: Element | null;
callback: ((mutation: Element) => void) | null;
};
editorTab: {
activeTabIndex: ActiveTabIndex;
};
mode: {
showBranding: boolean;
isFullScreen: boolean;
isPlayerOnly: boolean;
hasEverEnteredEditor: boolean;
};
hoveredTarget: {
sprite: string | null;
receivedBlocks: boolean;
};
stageSize: {
/**
* Will only be large or small. Large constrained is determined elsewhere.
*/
stageSize: StageDisplaySize;
};
menus: Record