refactor(joint-react): coherent event-related public type names#3347
Open
kumilingus wants to merge 10 commits into
Open
refactor(joint-react): coherent event-related public type names#3347kumilingus wants to merge 10 commits into
kumilingus wants to merge 10 commits into
Conversation
…entParams Companion to the validator callback rename (PR clientIO#3346). Renames all 21 exported event payload types and the three internal composition helpers (CellEventContext, ElementEventContext, LinkEventContext) so the suffix is uniform across joint-react's public callback-arg surface. Renames (public, breaking): - Pointer{Cell,Element,Link,Blank}EventContext -> *EventParams - Hover{Cell,Element,Link,Blank}EventContext -> *EventParams - Wheel{Cell,Element,Link,Blank}EventContext -> *EventParams - MagnetEventContext, LinkConnectEventContext -> *EventParams - Paper{Hover,Pan,Pinch}EventContext -> *EventParams - Translate/Scale/Resize/TransformEventContext -> *EventParams Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…tLayout Companion in-flight cleanup bundled with the *EventContext rename: - TransformMeasurement -> TransformElementLayout (callback type) - MeasurementContext -> TransformElementLayoutParams (callback arg) - HTMLBoxProps now sourced from ./components/html-box (was aliased HTMLHostProps); HTMLBox component carries its own props type - Story consumers (card, list-node, markup-selectors, svg-node, flowchart) updated to import the new type names Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…..Params Renames callback argument types whose names collide with React's Context concept. These objects are plain parameter bags, not contexts. Public API breaking change: - ValidateConnectionContext -> ValidateConnectionParams - ValidateEmbeddingContext -> ValidateEmbeddingParams - ValidateUnembeddingContext -> ValidateUnembeddingParams - CellVisibilityContext -> CellVisibilityParams - ConnectionStrategyContext -> ConnectionStrategyParams - InteractiveContext -> InteractiveParams - DefaultLinkContext -> DefaultLinkParams - PortalSelectorContext -> PortalSelectorParams EventContext types (PointerCellEventContext, etc.) are unchanged. Also fixes a broken import in presets/index.ts that referenced ValidateConnectionParams before it existed. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…events
Rename `NORMALIZED_KEYS` → `PAPER_EVENT_KEYS` (internal constant; not
exported). Reword section headings and JSDoc that called the camelCase
`on*` handler shape "normalized" — it isn't normalization in any meaningful
sense, just a typed convenience layer over native event names. Replace with
concrete language ("camelCase `on*`", "params-object", "`on*` handler keys").
Also fixes one stale JSDoc reference to the pre-rename `PaperEventCallback`.
No runtime change.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…Map → GraphEvents Drops the "Map" suffix on the two public event-handler-map types. The shape is already a map by construction (event name → handler); the suffix was noise and shadowed `dia.Paper.EventMap` / `dia.Graph.EventMap` from core. Coherent triple now: PaperEvents — full handlers map you subscribe with (raw + on*) PaperEventHandlers — typed `on*` subset interface PaperEventHandler<K> — one handler fn for key K `GraphEvents` follows the same pattern (raw only — no `on*` layer today). Also tightens JSDoc that called the camelCase `on*` form "normalized", matching the previous commit's terminology cleanup. Internal `isPaperEventMap` type guard becomes `isPaperEvents`. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…onsolidate story imports `linkRoutingStraight` / `linkRoutingOrthogonal` / `linkRoutingSmooth` are the recommended public API for Paper `linkRouting` — they now ship from `@joint/react` directly instead of requiring a deep `@joint/react/presets` import. All stories, demos, tutorials, and JSDoc examples switched to the main-barrel import and consolidated into existing `@joint/react` import blocks where they were already imported from there. Presets re-export still works; this is purely additive on the public API side and a cleanup on the consumer side. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
… drop @joint/react/presets alias for stories Adds link markers, link/element attributes, link routing option types, and `LinkMode` to the `@joint/react` main-barrel export. Migrates the last 5 stories that still imported from `@joint/react/presets` to use the main barrel and removes the `@joint/react/presets` alias from the storybook vite resolver and the workspace tsconfig path mappings so stories can no longer reach into the presets subpath. The published `@joint/react/presets` subpath export in `package.json` stays — only the internal alias is dropped. External consumers can still use the deep import; this is purely a story-side enforcement. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Tightens the joint-react public type surface around paper / graph events and other callback argument types, expands the main
@joint/reactbarrel so stories no longer need deep@joint/react/presetsimports, and drops the misleading "normalized" terminology from internal naming.Breaking changes (public API)
Paper events — typed
on*interface + helperNormalizedPaperHandlersPaperEventHandlersPaperEventHandler<K extends keyof PaperEventHandlers>Coherent triple:
PaperEventMap— full handlers map you subscribe with (raw native +on*). Mirrorsdia.Paper.EventMaplineage from joint-core.PaperEventHandlers— typedon*subset interface (mixed intoPaperProps).PaperEventHandler<K>— single handler fn for keyK. Matchesmvc.EventHandlerprecedent.Event payload args (callback first parameter)
Pointer{Cell,Element,Link,Blank}EventContextPointer*EventParamsHover{Cell,Element,Link,Blank}EventContextHover*EventParamsWheel{Cell,Element,Link,Blank}EventContextWheel*EventParamsMagnetEventContextMagnetEventParamsLinkConnectEventContextLinkConnectEventParamsPaper{Hover,Pan,Pinch}EventContextPaper*EventParamsTranslate/Scale/Resize/TransformEventContext*EventParamsThree internal composition helpers (
CellEventContext,ElementEventContext,LinkEventContext) renamed for in-file consistency. Not exported.Validator / utility callback args
ValidateConnectionContextValidateConnectionParamsValidateEmbeddingContextValidateEmbeddingParamsValidateUnembeddingContextValidateUnembeddingParamsCellVisibilityContextCellVisibilityParamsConnectionStrategyContextConnectionStrategyParamsInteractiveContextInteractiveParamsDefaultLinkContextDefaultLinkParamsPortalSelectorContextPortalSelectorParamsMisc renames
TransformMeasurementTransformElementLayoutPortShapeElementPortShapeMain barrel expansion
@joint/reactnow re-exports the full set of preset utilities that stories were reaching for via@joint/react/presets:linkRoutingStraight,linkRoutingOrthogonal,linkRoutingSmooth+ their option types andLinkModelinkMarker*symbolselementAttributes,linkAttributeselementPort,elementPorts,ElementPortShapeAll in-repo stories migrated to the main-barrel import. The
@joint/react/presetsalias is removed from.storybook/main.ts,tsconfig.json, andtsconfig.types.jsonso stories can no longer reach into the deep path. The published@joint/react/presetssubpath export inpackage.jsonis unchanged — external consumers can still use the deep import.Non-API changes
paper-events.tsandpaper.types.tsJSDoc / section headings — the camelCaseon*shape is just a typed convenience layer over native event names, not a normalization step.NORMALIZED_KEYSconstant →PAPER_EVENT_KEYS.Test plan
yarn typecheck— exit 0yarn lint— 0 errorsyarn jest— passyarn build—dist/typescontains the new namesNotes
🤖 Generated with Claude Code