The open creative studio on ComfyUI: images, video, 3D and audio on open weights, on your own GPU or the cloud. Camera motions, effects, apps, Cinema, Layers, Image to 3D and an AI agent.
TypeScript ai-videocomfyuicreative-toolsgenerative-aiideogramimage-generationimage-to-3dimage-to-videoltx-videominimax-h3nextjsopen-sourceopen-weightsqwen-imagetext-to-imagevideo-generationwan
import { useSyncExternalStore } from "react";
/** Apple keyboards say ⌘ where everyone else says Ctrl. */
export function isApplePlatform(platform: string): boolean {
return /Mac|iPhone|iPad|iPod/.test(platform);
}
/** The modifier key's name for this browser: "⌘" on Apple devices, "Ctrl" elsewhere (and on the server). */
export function modKey(): "⌘" | "Ctrl" {
return typeof navigator !== "undefined" && isApplePlatform(navigator.platform) ? "⌘" : "Ctrl";
}
/**
* A shortcut as this keyboard writes it: "⌘D" / "⇧⌘Z" on Apple devices, "Ctrl+D" / "Ctrl+Shift+Z"
* elsewhere. `mod` defaults to this browser's (modKey).
*/
export function keyCombo(key: string, opts: { shift?: boolean; mod?: "⌘" | "Ctrl" } = {}): string {
const mod = opts.mod ?? modKey();
if (mod === "⌘") return `${opts.shift ? "⇧" : ""}⌘${key}`;
return `Ctrl+${opts.shift ? "Shift+" : ""}${key}`;
}
const noop = () => () => {};
/**
* The modifier key's name, after hydration: the server and the first client render say "Ctrl", so a
* keycap never makes the HTML and the first render disagree.
*/
export function useModKey(): "⌘" | "Ctrl" {
return useSyncExternalStore(noop, modKey, () => "Ctrl");
}