Skip to content

feat(joint-core): Graph cell namespace and type constructor API#3275

Merged
Geliogabalus merged 9 commits intoclientIO:masterfrom
kumilingus:feat/graph-get-type-defaults
Apr 14, 2026
Merged

feat(joint-core): Graph cell namespace and type constructor API#3275
Geliogabalus merged 9 commits intoclientIO:masterfrom
kumilingus:feat/graph-get-type-defaults

Conversation

@kumilingus
Copy link
Copy Markdown
Contributor

@kumilingus kumilingus commented Apr 13, 2026

Summary

  • Add graph.getCellNamespace() / graph.setCellNamespace(namespace) — get/set the cell namespace, setter invalidates type defaults cache
  • Add graph.getTypeConstructor(type) — resolve a cell type string (e.g. 'standard.Rectangle') to its constructor, generic typed <T extends Cell>
  • Add graph.getTypeDefaults(type) — return frozen, cached default attributes for a cell type
  • Add graphLayerCollection.getTypeConstructor(type) — single source of truth for constructor lookups, includes cellNamespace null guard
  • Refactor CellCollection.model() to delegate to layerCollection.getTypeConstructor() instead of duplicating the lookup
  • Refactor Paper.defaultLink to use graph.getTypeConstructor('standard.Link') instead of reaching into layerCollection.cellNamespace
  • Deprecate CellCollection.cellNamespace property — now a getter that reads from layerCollection.cellNamespace
  • Remove cellNamespace propagation from GraphLayerCollection._addReference/_removeReference
  • Add QUnit tests for all new Graph methods

🤖 Generated with Claude Code

kumilingus and others added 9 commits April 13, 2026 20:34
Retrieve frozen default attributes for a cell type by looking up its
constructor in the cellNamespace. Results are cached per graph instance.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…Graph

Add public accessors for the cell namespace and type constructor
resolution. Refactor getTypeDefaults() to use getTypeConstructor().

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The constructor lookup logic lives next to the cellNamespace it queries.
Graph.getTypeConstructor() delegates to layerCollection.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@kumilingus kumilingus changed the title feat(joint-core): add graph.getTypeDefaults() method feat(joint-core): Graph cell namespace and type constructor API Apr 14, 2026
@kumilingus kumilingus requested a review from Geliogabalus April 14, 2026 10:27
@kumilingus kumilingus marked this pull request as ready for review April 14, 2026 10:27
@Geliogabalus Geliogabalus merged commit fea4bf3 into clientIO:master Apr 14, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants