MCPcopy
hub / github.com/clientIO/joint / createGraph

Function createGraph

packages/joint-react/src/data/create-store.ts:101–118  ·  view source on GitHub ↗

* Create a new graph instance. * @param options - Options for creating the graph. * @returns The created graph instance. * @group Graph * @internal * @example * ```ts * const graph = createGraph(); * console.log(graph); * ```

(options: StoreOptions = {})

Source from the content-addressed store, hash-verified

99 * ```
100 */
101function createGraph(options: StoreOptions = {}): dia.Graph {
102 const { cellModel, cellNamespace = DEFAULT_CELL_NAMESPACE, graph } = options;
103 const newGraph =
104 graph ??
105 new dia.Graph(
106 {},
107
108 {
109 cellNamespace: {
110 ...DEFAULT_CELL_NAMESPACE,
111 // @ts-expect-error Shapes is not a valid type for cellNamespace
112 ...cellNamespace,
113 },
114 cellModel,
115 }
116 );
117 return newGraph;
118}
119/**
120 * Building block of `@joint/react`.
121 * It listen to cell changes and updates UI based on the `dia.graph` changes.

Callers 1

createStoreFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected