Skip to content

1.0.0

Latest

Choose a tag to compare

@itspolly itspolly released this 24 May 21:15

Mostly source-compatible release: one major, breaking architectural change (PortType extraction to top-level) and three user-facing features:

Public API

  • PortType is now a top-level type, no longer nested under NodeTemplate.Port.PortType. ColorComponents moves with it. NodeTemplate.Port references its type by typeIdentifier: String so multiple templates can share one registered PortType. Source-compatible via a convenience init on NodeTemplate.Port, so existing .init(id:, kind:, type: .double, ...) calls keep working.
  • PortTypeRegistry is now @Observable @MainActor (was an actor). The editor resolves typeIdentifiers through it for display hints (colour, name); connection compatibility compares identifier strings directly on the drag/hover hot path so unresolved ports still wire up correctly.
  • GraphEditor.init gains portTypeRegistry: PortTypeRegistry = .init() between templateRegistry and portEditorRegistry. Defaulted, so existing call sites still compile.
  • NodeTemplate.reusable: Bool = true — set to false to refuse a second instance of the same template in a graph (singleton templates like a "Document Properties" node).

Behaviour

  • Missing-template placeholder rendering. Nodes that reference a templateIdentifier the TemplateRegistry can't resolve now render as a dimmed "Missing template" card (selectable, movable, deletable) instead of being silently omitted from the canvas. Data is preserved across saves; re-registering the template restores normal rendering and any edges incident to its ports.
  • Unresolved port-type rendering. Ports whose typeIdentifier isn't registered in PortTypeRegistry render dimmer in a neutral colour. Connections still wire up via identifier matching.

Docs

  • Concurrency-and-ordering notes added to TemplateRegistry, PortEditorRegistry, and PortTypeRegistry: synchronous register / unregister are FIFO from MainActor code; from outside MainActor they should be treated as asynchronous (the call hops isolation), and multiple async registrations aren't ordered by call site — await between calls if you need a specific sequence.
  • Node.templateIdentifier documents what happens when the template isn't registered.
  • CustomPortTypes and GettingStarted guides + README quick-start + the in-package preview seed all show PortTypeRegistry construction and the new third arg on GraphEditor.
  • Demo app (NodeKit Demo) updated to demonstrate registering a custom PortType and passing both registries through.

Update

.package(url: "https://github.com/itspolly/NodeKit.git", from: "1.0.0"),

No source changes required for callers that only use built-in port types and don't reference NodeTemplate.Port.PortType / NodeTemplate.Port.ColorComponents by their nested paths.