mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-03-05 13:10:24 +00:00
Add graph ID creation / serialisation (#790)
- Updates UUIDv4 generator - Adds a unique id & revision support to graphs - `revision` to be incremented downstream (e.g. on save) - `id` automatically assigned if not provided
This commit is contained in:
@@ -19,6 +19,7 @@ import {
|
||||
RenderShape,
|
||||
TitleMode,
|
||||
} from "./types/globalEnums"
|
||||
import { createUuidv4 } from "./utils/uuid"
|
||||
|
||||
/**
|
||||
* The Global Scope. It contains all the registered node classes.
|
||||
@@ -549,14 +550,8 @@ export class LiteGraphGlobal {
|
||||
return target
|
||||
}
|
||||
|
||||
/*
|
||||
* https://gist.github.com/jed/982883?permalink_comment_id=852670#gistcomment-852670
|
||||
*/
|
||||
uuidv4(): string {
|
||||
// @ts-expect-error
|
||||
return ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replaceAll(/[018]/g, a =>
|
||||
(a ^ ((Math.random() * 16) >> (a / 4))).toString(16))
|
||||
}
|
||||
/** @see {@link createUuidv4} @inheritdoc */
|
||||
uuidv4 = createUuidv4
|
||||
|
||||
/**
|
||||
* Returns if the types of two slots are compatible (taking into account wildcards, etc)
|
||||
|
||||
Reference in New Issue
Block a user