Line data Source code
1 : import { defineStore } from 'pinia'
2 : import { reactive, ref } from 'vue'
3 :
4 : import { isUuidShapedSubgraphId } from '@/schemas/subgraphIdSchema'
5 : import type { UUID } from '@/utils/uuid'
6 : import { parseNodeId } from '@comfyorg/graph-model/nodeId'
7 : import type { NodeId, SerializedNodeId } from '@comfyorg/graph-model/nodeId'
8 : import {
9 : isWidgetId,
10 : parseWidgetId,
11 : widgetId as createWidgetId
12 : } from '@comfyorg/graph-model/widgetId'
13 : import type { WidgetId } from '@comfyorg/graph-model/widgetId'
14 : import type { WidgetValue } from '@comfyorg/graph-model/widgetValue'
15 : import type {
16 : WidgetState,
17 : WidgetStateInit
18 : } from '@comfyorg/graph-model/widgetState'
19 : import {
20 : applyLegacyHiddenWrite,
21 : deriveWidgetVisibility,
22 : setWidgetAdvanced,
23 : setWidgetHiddenInPanel
24 : } from '@/types/widgetVisibility'
25 : import type { WidgetVisibilityComponent } from '@/types/widgetVisibility'
26 : import { emitGraphIntent } from '@/lib/litegraph/src/graphIntents'
27 : import type { IBaseWidget, IWidgetOptions } from '@comfyorg/graph-model/widgets'
28 : import { coerceRestoredWidgetValue } from '@/lib/litegraph/src/utils/restoredWidgetValue'
29 :
30 : interface ConvertedRestoredValue {
31 : nodeId: NodeId
32 : input: string
33 : stored: WidgetValue
34 : }
35 :
36 : export interface WidgetRenderState {
37 : hasLayoutSize?: boolean
38 : isDOMWidget?: boolean
39 : tooltip?: string
40 : }
41 :
42 : interface WidgetRestorationState {
43 : positional: readonly WidgetValue[]
44 : named?: Readonly<Record<string, WidgetValue>>
45 : restoreNamed: boolean
46 : }
47 :
48 : interface WidgetEntity {
49 : state: WidgetState
50 : render: WidgetRenderState
51 : visibility: WidgetVisibilityComponent
52 : }
53 :
54 23588 : function setNodeScoped<T>(
55 : graphMap: Map<UUID, Map<NodeId, T>>,
56 : graphId: UUID,
57 : nodeId: NodeId,
58 : value: T
59 : ): void {
60 23588 : let nodeMap = graphMap.get(graphId)
61 23588 : if (!nodeMap) {
62 23487 : nodeMap = new Map()
63 23487 : graphMap.set(graphId, nodeMap)
64 : }
65 23588 : nodeMap.set(nodeId, value)
66 : }
67 :
68 23605 : function clearNodeScoped<T>(
69 : graphMap: Map<UUID, Map<NodeId, T>>,
70 : graphId: UUID,
71 : nodeId: NodeId
72 : ): void {
73 23605 : const nodeMap = graphMap.get(graphId)
74 23605 : if (!nodeMap) return
75 23584 : nodeMap.delete(nodeId)
76 23594 : if (nodeMap.size === 0) graphMap.delete(graphId)
77 : }
78 :
79 : /**
80 : * Strips one or more leading `<subgraphUuid>:` scope prefixes (nested
81 : * subgraphs chain them), leaving the innermost local id.
82 : *
83 : * Only a genuine UUID segment counts as a scope prefix. A bare `NodeId` can
84 : * itself legally contain colons for reasons that have nothing to do with
85 : * subgraph scoping — e.g. `insert_workflow`'s remapped ids
86 : * (`insert:<opId>:root:node:<originalId>`, comfy-multi-player's `remap.ts`).
87 : * The old unconditional "strip to the last colon" collapsed such an id down
88 : * to its trailing segment, which is not how it was registered, so every
89 : * widget lookup keyed on it came back empty (PM-1580: agent-inserted nodes
90 : * materialize with correct positions/types/links but render with no
91 : * widgets). Stopping as soon as the next segment fails the UUID check keeps
92 : * the rest of a non-scoped id intact.
93 : */
94 55281 : export function stripGraphPrefix(scopedId: SerializedNodeId): NodeId | null {
95 55281 : let rest = String(scopedId)
96 55281 : let separatorIndex = rest.indexOf(':')
97 55281 : while (
98 : separatorIndex !== -1 &&
99 : isUuidShapedSubgraphId(rest.slice(0, separatorIndex))
100 : ) {
101 0 : rest = rest.slice(separatorIndex + 1)
102 0 : separatorIndex = rest.indexOf(':')
103 : }
104 55281 : return parseNodeId(rest)
105 : }
106 :
107 2356 : export const useWidgetValueStore = defineStore('widgetValue', () => {
108 2355 : const graphWidgets = ref(new Map<UUID, Map<WidgetId, WidgetEntity>>())
109 2355 : const graphNodeWidgetOrders = ref(new Map<UUID, Map<NodeId, WidgetId[]>>())
110 2355 : const convertedRestoredValues = new Map<string, ConvertedRestoredValue>()
111 2355 : const graphWidgetRestorations = new Map<
112 : UUID,
113 : Map<NodeId, WidgetRestorationState>
114 : >()
115 :
116 49308 : function observeValue<TValue extends WidgetValue>(
117 : state: WidgetState<TValue>,
118 : graphId: UUID
119 : ): void {
120 49308 : let value = state.value
121 49308 : Object.defineProperty(state, 'value', {
122 : configurable: true,
123 : enumerable: true,
124 : get: () => value,
125 : set: (nextValue: TValue) => {
126 60206 : if (Object.is(value, nextValue)) return
127 27642 : const oldValue = value
128 27642 : value = nextValue
129 : const widgetId = createWidgetId(graphId, state.nodeId, state.name)
130 60206 : if (getWidget(widgetId) !== state) return
131 27642 : emitGraphIntent({
132 : type: 'set_widget',
133 : graphId,
134 : nodeId: state.nodeId,
135 : name: state.name,
136 : value,
137 : previous: oldValue
138 : })
139 : }
140 : })
141 : }
142 :
143 23588 : function setNodeWidgetRestoration(
144 : graphId: UUID,
145 : nodeId: NodeId,
146 : restoration: WidgetRestorationState
147 : ): void {
148 23588 : setNodeScoped(graphWidgetRestorations, graphId, nodeId, restoration)
149 : }
150 :
151 1 : function flushConvertedRestoredValues(): void {
152 1 : console.warn(
153 : 'Converted saved widget values to their widget type. The workflow file still stores them with the wrong type.',
154 : [...convertedRestoredValues.values()]
155 : )
156 1 : convertedRestoredValues.clear()
157 : }
158 :
159 45630 : function convertRestoredValue(
160 : graphId: UUID,
161 : nodeId: NodeId,
162 : widget: Pick<IBaseWidget, 'name' | 'type' | 'options'>,
163 : saved: WidgetValue
164 : ): WidgetValue {
165 45630 : const value = coerceRestoredWidgetValue(widget, saved)
166 45630 : if (value === saved) return value
167 27 : if (convertedRestoredValues.size === 0)
168 1 : queueMicrotask(flushConvertedRestoredValues)
169 5 : convertedRestoredValues.set(`${graphId}:${nodeId}:${widget.name}`, {
170 : nodeId,
171 : input: widget.name,
172 : stored: saved
173 : })
174 5 : return value
175 : }
176 :
177 : /** Returns the saved value for `widget`, converted to its value type. */
178 96500 : function getRestoredWidgetValue(
179 : graphId: UUID,
180 : nodeId: NodeId,
181 : widget: Pick<IBaseWidget, 'name' | 'type' | 'options'>,
182 : positionalIndex: number
183 : ): { value: WidgetValue } | undefined {
184 96500 : const restoration = graphWidgetRestorations.get(graphId)?.get(nodeId)
185 96500 : if (!restoration) return
186 96500 : if (restoration.restoreNamed && restoration.named) {
187 6318 : if (!Object.hasOwn(restoration.named, widget.name)) return
188 6266 : return {
189 : value: convertRestoredValue(
190 : graphId,
191 : nodeId,
192 : widget,
193 : restoration.named[widget.name]
194 : )
195 : }
196 : }
197 94690 : if (positionalIndex >= restoration.positional.length) return
198 39143 : return {
199 : value: convertRestoredValue(
200 : graphId,
201 : nodeId,
202 : widget,
203 : restoration.positional[positionalIndex]
204 : )
205 : }
206 : }
207 :
208 23605 : function clearNodeWidgetRestoration(graphId: UUID, nodeId: NodeId): void {
209 23605 : clearNodeScoped(graphWidgetRestorations, graphId, nodeId)
210 : }
211 :
212 59674 : function getGraphWidgets(graphId: UUID): Map<WidgetId, WidgetEntity> {
213 59674 : const widgets = graphWidgets.value.get(graphId)
214 59674 : if (widgets) return widgets
215 :
216 3984 : const nextWidgets = reactive(new Map<WidgetId, WidgetEntity>())
217 3984 : graphWidgets.value.set(graphId, nextWidgets)
218 3984 : return nextWidgets
219 : }
220 :
221 1489 : function findGraphWidgets(
222 : graphId: UUID
223 : ): Map<WidgetId, WidgetEntity> | undefined {
224 1489 : return graphWidgets.value.get(graphId)
225 : }
226 :
227 81122 : function getGraphNodeWidgetOrders(graphId: UUID): Map<NodeId, WidgetId[]> {
228 81122 : const widgetOrders = graphNodeWidgetOrders.value.get(graphId)
229 81122 : if (widgetOrders) return widgetOrders
230 :
231 3989 : const nextWidgetOrders = reactive(new Map<NodeId, WidgetId[]>())
232 3989 : graphNodeWidgetOrders.value.set(graphId, nextWidgetOrders)
233 3989 : return nextWidgetOrders
234 : }
235 :
236 79657 : function getNodeWidgetOrder(graphId: UUID, nodeId: NodeId): WidgetId[] {
237 79657 : const graphOrders = getGraphNodeWidgetOrders(graphId)
238 79657 : const order = graphOrders.get(nodeId)
239 79657 : if (order) return order
240 :
241 20012 : const nextOrder = reactive<WidgetId[]>([])
242 20012 : graphOrders.set(nodeId, nextOrder)
243 20012 : return nextOrder
244 : }
245 :
246 59674 : function appendNodeWidgetOrder(widgetId: WidgetId): void {
247 59674 : const { graphId, nodeId } = parseWidgetId(widgetId)
248 59674 : const order = getNodeWidgetOrder(graphId, nodeId)
249 59674 : if (!order.includes(widgetId)) order.push(widgetId)
250 : }
251 :
252 140 : function removeNodeWidgetOrder(widgetId: WidgetId): void {
253 140 : const { graphId, nodeId } = parseWidgetId(widgetId)
254 140 : const graphOrders = graphNodeWidgetOrders.value.get(graphId)
255 140 : if (!graphOrders) return
256 140 : const order = graphOrders.get(nodeId)
257 140 : if (!order) return
258 :
259 140 : const index = order.indexOf(widgetId)
260 140 : if (index !== -1) order.splice(index, 1)
261 140 : if (order.length === 0) graphOrders.delete(nodeId)
262 : }
263 :
264 : /**
265 : * @returns The existing state for the same widget type, replacement state
266 : * for a different type, or `undefined` for an invalid widget ID.
267 : */
268 : function registerWidget<
269 : TValue extends WidgetValue = WidgetValue,
270 : TType extends string = string,
271 : TOptions extends IWidgetOptions = IWidgetOptions
272 : >(
273 : widgetId: WidgetId,
274 : init: WidgetStateInit<TValue, TType, TOptions>,
275 : renderState?: WidgetRenderState,
276 : visibility?: WidgetVisibilityComponent
277 : ): WidgetState<TValue, TType, TOptions> | undefined
278 : // fallow-ignore-next-line complexity -- existing overload implementation moved upward after this PR removes obsolete mutation-context bookkeeping.
279 59676 : function registerWidget(
280 : widgetId: WidgetId,
281 : init: WidgetStateInit,
282 : renderState: WidgetRenderState = {},
283 : visibility: WidgetVisibilityComponent = deriveWidgetVisibility({
284 : type: init.type,
285 : options: init.options
286 : })
287 : ): WidgetState | undefined {
288 59676 : if (!isWidgetId(widgetId)) {
289 2 : console.warn(
290 : 'widgetValueStore.registerWidget: ignoring un-keyable widget id',
291 : widgetId
292 : )
293 2 : return undefined
294 : }
295 :
296 59674 : const { graphId, nodeId, name: storageName } = parseWidgetId(widgetId)
297 59674 : const widgets = getGraphWidgets(graphId)
298 59674 : const existing = widgets.get(widgetId)
299 : // WidgetId is `graphId:nodeId:name`. A node replacement can reuse the same
300 : // numeric nodeId, so a stale entry from the previous occupant may survive in
301 : // the store under the same key. The type check distinguishes a live
302 : // re-registration (same widget, keep its value) from a recycled key (new
303 : // widget type at an old address, overwrite). Without it a text widget
304 : // rendered as the prior int type until the next full reload (#13073, #13773).
305 59676 : if (existing && existing.state.type === init.type) {
306 10366 : Object.assign(existing.state, {
307 : ...init,
308 : name: init.name ?? storageName,
309 : nodeId,
310 : value: existing.state.value,
311 : y: init.y ?? existing.state.y
312 : })
313 10366 : Object.assign(existing.render, renderState)
314 10366 : Object.assign(existing.visibility.surfaces, visibility.surfaces)
315 10366 : existing.visibility.suppression.byExtension =
316 : visibility.suppression.byExtension
317 10366 : appendNodeWidgetOrder(widgetId)
318 10366 : return existing.state
319 : }
320 :
321 59676 : const state: WidgetState = {
322 : ...init,
323 : nodeId,
324 : name: init.name ?? storageName,
325 : y: init.y ?? 0
326 : }
327 59676 : widgets.set(widgetId, {
328 : state,
329 : render: { ...renderState },
330 : visibility: {
331 : surfaces: { ...visibility.surfaces },
332 : suppression: { ...visibility.suppression }
333 : }
334 : })
335 59676 : appendNodeWidgetOrder(widgetId)
336 59676 : const registered = widgets.get(widgetId)?.state
337 59676 : if (registered) observeValue(registered, graphId)
338 49308 : return registered
339 : }
340 :
341 225650 : function getWidget(widgetId: WidgetId): WidgetState | undefined {
342 225650 : if (!isWidgetId(widgetId)) return undefined
343 :
344 225650 : const { graphId } = parseWidgetId(widgetId)
345 225650 : return graphWidgets.value.get(graphId)?.get(widgetId)?.state
346 : }
347 :
348 46558 : function getWidgetRenderState(
349 : widgetId: WidgetId
350 : ): WidgetRenderState | undefined {
351 46558 : if (!isWidgetId(widgetId)) return undefined
352 :
353 46558 : const { graphId } = parseWidgetId(widgetId)
354 46558 : return graphWidgets.value.get(graphId)?.get(widgetId)?.render
355 : }
356 :
357 123904 : function getWidgetVisibility(
358 : widgetId: WidgetId
359 : ): WidgetVisibilityComponent | undefined {
360 123904 : if (!isWidgetId(widgetId)) return undefined
361 :
362 123904 : const { graphId } = parseWidgetId(widgetId)
363 123904 : return graphWidgets.value.get(graphId)?.get(widgetId)?.visibility
364 : }
365 :
366 743 : function setValue(widgetId: WidgetId, value: WidgetState['value']): boolean {
367 743 : const state = getWidget(widgetId)
368 743 : if (!state) return false
369 743 : state.value = value
370 743 : return true
371 : }
372 :
373 : /** Sets a widget to a saved value, converted to the widget's value type. */
374 221 : function restoreValue(widgetId: WidgetId, saved: WidgetValue): boolean {
375 221 : const state = getWidget(widgetId)
376 221 : if (!state) return false
377 221 : const { graphId, nodeId } = parseWidgetId(widgetId)
378 221 : state.value = convertRestoredValue(graphId, nodeId, state, saved)
379 221 : return true
380 : }
381 :
382 : /**
383 : * Announces a newly created widget's current value as a `set_widget`
384 : * intent. Registration alone announces nothing, so a widget a local edit
385 : * creates (a new DynamicGroup row) would otherwise reach the document only
386 : * if its value later changes.
387 : */
388 294 : function announceValue(widgetId: WidgetId): void {
389 294 : const state = getWidget(widgetId)
390 294 : if (!state) return
391 294 : emitGraphIntent({
392 : type: 'set_widget',
393 : graphId: parseWidgetId(widgetId).graphId,
394 : nodeId: state.nodeId,
395 : name: state.name,
396 : value: state.value ?? null,
397 : previous: undefined
398 : })
399 : }
400 :
401 14 : function setLabel(widgetId: WidgetId, label: string): boolean {
402 14 : const state = getWidget(widgetId)
403 14 : if (!state) return false
404 14 : state.label = label
405 14 : return true
406 : }
407 :
408 10 : function setOptions(
409 : widgetId: WidgetId,
410 : options: WidgetState['options']
411 : ): boolean {
412 10 : const state = getWidget(widgetId)
413 10 : if (!state) return false
414 10 : const visibility = getWidgetVisibility(widgetId)
415 10 : const hidden = state.options.hidden
416 10 : state.options = options
417 10 : if (hidden !== undefined) state.options.hidden = hidden
418 10 : if (visibility) {
419 10 : const nextVisibility = deriveWidgetVisibility({
420 : type: state.type,
421 : advanced: visibility.surfaces.canvas === 'advanced',
422 : options: state.options
423 : })
424 10 : Object.assign(visibility.surfaces, nextVisibility.surfaces)
425 10 : visibility.suppression.byExtension =
426 : nextVisibility.suppression.byExtension
427 : }
428 10 : return true
429 : }
430 :
431 0 : function updateOptions(
432 : widgetId: WidgetId,
433 : options: Partial<WidgetState['options']>
434 : ): boolean {
435 0 : const state = getWidget(widgetId)
436 0 : if (!state) return false
437 0 : const visibility = getWidgetVisibility(widgetId)
438 0 : if (visibility) {
439 0 : if (options.hidden !== undefined) {
440 0 : applyLegacyHiddenWrite(visibility, options.hidden)
441 : }
442 0 : if (options.hideInPanel !== undefined) {
443 0 : setWidgetHiddenInPanel(visibility, options.hideInPanel)
444 : }
445 0 : if (options.advanced !== undefined) {
446 0 : setWidgetAdvanced(visibility, options.advanced, ['vueNode', 'panel'])
447 : }
448 : }
449 0 : state.options = { ...state.options, ...options }
450 0 : return true
451 : }
452 :
453 140 : function deleteWidget(widgetId: WidgetId): boolean {
454 140 : if (!isWidgetId(widgetId)) return false
455 :
456 140 : const { graphId } = parseWidgetId(widgetId)
457 140 : removeNodeWidgetOrder(widgetId)
458 140 : return graphWidgets.value.get(graphId)?.delete(widgetId) ?? false
459 : }
460 :
461 24 : function renameWidget(
462 : oldId: WidgetId,
463 : newId: WidgetId
464 : ): WidgetState | undefined {
465 24 : if (!isWidgetId(oldId) || !isWidgetId(newId)) return undefined
466 24 : if (oldId === newId) return getWidget(oldId)
467 :
468 24 : const previous = parseWidgetId(oldId)
469 24 : const next = parseWidgetId(newId)
470 24 : if (previous.graphId !== next.graphId || previous.nodeId !== next.nodeId) {
471 0 : return undefined
472 : }
473 :
474 24 : const { graphId, nodeId, name } = next
475 24 : const widgets = findGraphWidgets(graphId)
476 24 : if (!widgets) return undefined
477 24 : const entity = widgets.get(oldId)
478 24 : if (!entity || widgets.has(newId)) return undefined
479 :
480 24 : const order = graphNodeWidgetOrders.value.get(graphId)?.get(nodeId)
481 24 : if (!order) return undefined
482 24 : const index = order.indexOf(oldId)
483 :
484 24 : widgets.delete(oldId)
485 24 : entity.state.name = name
486 24 : widgets.set(newId, entity)
487 24 : if (index === -1) order.push(newId)
488 24 : else order.splice(index, 1, newId)
489 :
490 24 : return entity.state
491 : }
492 :
493 9 : function getNodeWidgets(graphId: UUID, localNodeId: NodeId): WidgetState[] {
494 9 : return getNodeWidgetIds(graphId, localNodeId).flatMap((id) => {
495 12 : const state = getWidget(id)
496 12 : return state ? [state] : []
497 : })
498 : }
499 :
500 : /**
501 : * Merges a requested widget order against the ids already tracked for the
502 : * node: the request is filtered to tracked ids, then any tracked id the
503 : * request omitted is appended. Tracked ids are never dropped here — only
504 : * {@link removeNodeWidgetOrder} removes an id from the order.
505 : */
506 19983 : function reconcileNodeWidgetOrder(
507 : graphId: UUID,
508 : localNodeId: NodeId,
509 : orderedWidgetIds: readonly WidgetId[]
510 : ): WidgetId[] {
511 19983 : const currentOrder = getNodeWidgetIds(graphId, localNodeId)
512 19983 : const currentIds = new Set(currentOrder)
513 19983 : const nextOrder = orderedWidgetIds.filter((id) => currentIds.has(id))
514 19983 : const nextIds = new Set(nextOrder)
515 19983 : return [...nextOrder, ...currentOrder.filter((id) => !nextIds.has(id))]
516 : }
517 :
518 28251 : function getNodeWidgetIds(graphId: UUID, localNodeId: NodeId): WidgetId[] {
519 28251 : return [
520 : ...(graphNodeWidgetOrders.value.get(graphId)?.get(localNodeId) ?? [])
521 : ]
522 : }
523 :
524 19983 : function setNodeWidgetOrder(
525 : graphId: UUID,
526 : localNodeId: NodeId,
527 : orderedWidgetIds: readonly WidgetId[]
528 : ): void {
529 19983 : const nextOrder = reconcileNodeWidgetOrder(
530 : graphId,
531 : localNodeId,
532 : orderedWidgetIds
533 : )
534 19983 : const order = getNodeWidgetOrder(graphId, localNodeId)
535 19983 : order.splice(0, order.length, ...nextOrder)
536 : }
537 :
538 1465 : function replaceNodeWidgetOrder(
539 : graphId: UUID,
540 : localNodeId: NodeId,
541 : orderedWidgetIds: readonly WidgetId[]
542 : ): void {
543 1465 : const widgets = findGraphWidgets(graphId)
544 1465 : const nextOrder = orderedWidgetIds.filter(
545 : (id) => widgets?.get(id)?.state.nodeId === localNodeId
546 : )
547 1465 : const graphOrders = getGraphNodeWidgetOrders(graphId)
548 1465 : const order = graphOrders.get(localNodeId)
549 :
550 1465 : if (nextOrder.length === 0) {
551 16 : graphOrders.delete(localNodeId)
552 1449 : } else if (order) {
553 1449 : order.splice(0, order.length, ...nextOrder)
554 : } else {
555 0 : graphOrders.set(localNodeId, reactive([...nextOrder]))
556 : }
557 : }
558 :
559 : /**
560 : * Releases the widget ids tracked for a node, from the store's own record
561 : * rather than the node's live widget list — the two diverge once a node drops
562 : * widgets without unregistering them. `discardValues` also drops the widget
563 : * states; retaining them lets a node that comes back keep what the user set.
564 : */
565 10979 : function releaseNodeWidgets(
566 : graphId: UUID,
567 : localNodeId: NodeId,
568 : { discardValues }: { discardValues: boolean }
569 : ): void {
570 10979 : const graphOrders = graphNodeWidgetOrders.value.get(graphId)
571 10979 : if (!graphOrders) return
572 :
573 216 : const order = graphOrders.get(localNodeId)
574 216 : if (!order) return
575 :
576 0 : if (discardValues) {
577 0 : for (const widgetId of order) {
578 0 : graphWidgets.value.get(graphId)?.delete(widgetId)
579 : }
580 : }
581 0 : graphOrders.delete(localNodeId)
582 : }
583 :
584 10998 : function clearNode(graphId: UUID, nodeId: NodeId): void {
585 10998 : graphWidgetRestorations.get(graphId)?.delete(nodeId)
586 10998 : const widgets = graphWidgets.value.get(graphId)
587 10998 : if (widgets) {
588 10885 : for (const [id, entity] of widgets) {
589 84826 : if (entity.state.nodeId !== nodeId) continue
590 22984 : widgets.delete(id)
591 : }
592 10885 : if (widgets.size === 0) graphWidgets.value.delete(graphId)
593 : }
594 :
595 10998 : const widgetOrders = graphNodeWidgetOrders.value.get(graphId)
596 10998 : widgetOrders?.delete(nodeId)
597 10998 : if (widgetOrders?.size === 0) graphNodeWidgetOrders.value.delete(graphId)
598 : }
599 :
600 11709 : function clearGraph(graphId: UUID): void {
601 11709 : graphWidgets.value.delete(graphId)
602 11709 : graphNodeWidgetOrders.value.delete(graphId)
603 11709 : graphWidgetRestorations.delete(graphId)
604 : }
605 :
606 2355 : return {
607 : registerWidget,
608 : setNodeWidgetRestoration,
609 : clearNodeWidgetRestoration,
610 : getRestoredWidgetValue,
611 : getWidget,
612 : getWidgetRenderState,
613 : getWidgetVisibility,
614 : setValue,
615 : restoreValue,
616 : announceValue,
617 : setLabel,
618 : setOptions,
619 : updateOptions,
620 : deleteWidget,
621 : renameWidget,
622 : getNodeWidgets,
623 : getNodeWidgetIds,
624 : setNodeWidgetOrder,
625 : replaceNodeWidgetOrder,
626 : removeNodeWidgetOrder,
627 : releaseNodeWidgets,
628 : clearNode,
629 : clearGraph
630 : }
631 : })
|