Skip to content

feat(joint-core): split Cell.JSON / JSONInit, deprecate GenericAttributes#3304

Merged
Geliogabalus merged 3 commits into
clientIO:masterfrom
kumilingus:json-type-master
May 4, 2026
Merged

feat(joint-core): split Cell.JSON / JSONInit, deprecate GenericAttributes#3304
Geliogabalus merged 3 commits into
clientIO:masterfrom
kumilingus:json-type-master

Conversation

@kumilingus

Copy link
Copy Markdown
Contributor

Summary

Cherry-pick of the dev PR (#3303) onto master.

  • Split Cell.JSON (output of toJSON, requires id + type) from new Cell.JSONInit (constructor input, requires only type); same split for Element / Link.
  • Deprecate GenericAttributes<T> in favour of Attributes<T> (kept as empty interface … extends Attributes<T> to preserve declaration-merging).
  • Tighten Graph.toJSON() return type from any to Graph.JSON; symmetrically tighten Graph.fromJSON(json: Graph.JSON, …).
  • Switch Graph.JSON index signature from any to unknown.
  • Update shapes-standard.d.ts to use Element.Attributes / Link.Attributes instead of deprecated GenericAttributes.

Note: master's pre-existing Cell.GenericAttributes (without parent / layer) was removed by the cherry-pick; the new Cell.Attributes includes both fields, so this is a forward-compatible change.

Test plan

  • yarn test-ts passes
  • yarn workspace @joint/core run lint passes
  • Verify dia.Element.GenericAttributes<T> declaration-merging still compiles for downstream users

🤖 Generated with Claude Code

@kumilingus kumilingus marked this pull request as draft April 30, 2026 22:31
kumilingus added 2 commits May 2, 2026 20:24
Cell.Attributes now represents visual canvas attributes only (no id, no type).
Cell.JSONInit adds id? + type. Cell.JSON keeps id + type required.
Renames index sig key from `key` to `customAttribute` for clarity.
@kumilingus kumilingus requested a review from Geliogabalus May 4, 2026 11:28
@Geliogabalus Geliogabalus marked this pull request as ready for review May 4, 2026 12:35
@Geliogabalus Geliogabalus merged commit 5cbc52f into clientIO:master May 4, 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