Releases: reactodia/reactodia-workspace
Releases · reactodia/reactodia-workspace
v0.31.2
🐛 Fixed
- Fix
AnnotationSupportnot unsubscribing fromAnnotationTopicat unmount which causes two annotations to be created fromSelectionActionAnnotatein React development mode. - Fix undo/redo history not working after panning or pinch-zoom gesture on touch devices.
- Fix keyboard hotkeys for selection actions not working after focusing on search input then clicking back on the selection box.
v0.31.1
🐛 Fixed
- Fix incorrect canvas viewport position when
zoomToFit()or similar operation is called immediately after element position changes; - Omit properties without values in
StandardEntity,StandardRelationandClassicEntity.
v0.31.0
🚀 New Features
- Simplify canvas widgets placement at one or multiple layers:
- Canvas children are always assumed to be viewport widgets;
- Add
CanvasPlaceAtcomponent to render its children at specified non-viewport canvas layer instead; - Support new placement layers:
underlaylayer to place components under all canvas content,overLinkGeometrylayer to place components above link geometry (connections) but under link labels; - [💥Breaking] Remove
defineCanvasWidget()andSharedCanvasState.setCanvasWidget()(useCanvasPlaceAtto display components at canvas layers instead).
- Support to import and export diagram layout with custom element and link cell types (derived from
ElementorLink):- Introduce an optional contract for
ElementorLink-derived cell types to be serializable:SerializableElementCellandSerializableLinkCell; - When implemented, the corresponding cell types can be exported and later imported with the diagram;
DataDiagramModel.importLayout()will accept known cell types viaelementCellTypesandlinkCellTypesto import.
- Introduce an optional contract for
- Support diagram-only annotations:
- Add
AnnotationElementandAnnotationLinkelements and links which exports and imports with the diagram but does not exists in the data graph; - Rendered by default with new built-in templates
NoteTemplateandNoteLinkTemplatewhich useNoteAnnotation,NoteEntityandNoteLinktemplate components; - Add
AnnotationSupportcanvas widget which enables annotations in the UI (can be configured or disabled viaannotationsprop onDefaultWorkspaceandClassicWorkspace); - Support annotation elements in
SelectionActionEstablishLinkand newSelectionActionAnnotatecomponents; - Support annotation links in
LinkActionDelete,LinkActionMoveEndpointcomponents. - Add
DefaultRenameLinkProviderand use it by default to allow to change annotation link labels.
- Add
- Support user-resizable element templates with
ElementSizetemplate state property:- Resizable elements display "box with handles" in the
Haloto change the size; - Changed element sizes are captured and restored by
RestoreGeometrycommand.
- Resizable elements display "box with handles" in the
- Allow to customize link template separately for each link instead of only based on its link type IRI in
linkTemplateResolverforCanvas. - Allow to configure
DropOnCanvasto allow only some drop events and provide items to place on the canvas. - Support keyboard hotkeys for
LinkActioncomponents to act on a currently selected link.
🐛 Fixed
- Fix link rendering lagging behind when moving elements.
- Fix
RdfDataProvider.links()returning empty results when called withlinkTypeIdsparameter. - Fix
HaloLinkand visual authoring link path highlight being rendered on top on elements by placing it ontooverLinkGeometrywidget layer instead. - Fix
HaloLinklink path highlighting not updating on link re-route. - Fix element template state not being restored when ungrouping entities.
- Fix missing element decorations after re-importing the same diagram.
- Fix
DraggableHandleto avoid using staleonDragHandleandonEndDragHandleprop values. - Fix being able to execute disabled
SelectionActionvia keyboard hotkey. - Fix throwing an error while trying to access
CanvasApi.metricsmembers before theCanvasis fully mounted.
⏱ Performance
- [💥Breaking] Canvas widgets are not automatically updated when parent canvas is rendered to reduce unnecessary re-renders, and now require explicit subscriptions:
- Subscribe to canvas
changeTransformevent when usingCanvasApi.metricsto convert between coordinates; - Subscribe to canvas
resizeevent to track viewport size; - Subscribe to
changeCellsevent fromDiagramModelto track graph content changes.
- Subscribe to canvas
- Add
TemplateProps.onlySelectedflag to use in the element templates to track if the element is the only one selected without performance penalty. - Avoid per-layer frame delay when processing canvas layer updates without calling
RenderingState.syncUpdate():- Add
useLayerDebouncedStore()hook as more flexible way to debounce and update with the canvas layer.
- Add
- Avoid eager link type creation for relation links, only create and fetch them on first render.
💅 Polish
- [💥Breaking] Use typed
TemplateStateforElement.elementStateandLink.linkStateto avoid accidental type mismatch. - Make dialogs fill the available viewport when the viewport width is small:
- This is controlled by new CSS property
--reactodia-dialog-viewport-breakpoint-swith default value600pxwhich makes dialog fill the viewport if the available width is less or equal to that value.
- This is controlled by new CSS property
- Allow to override base z-index level for workspace components with a set z-index value via
--reactodia-z-index-baseCSS property; - Make
Halomargin configurable via CSS property--reactodia-selection-single-box-margin. - Highlight link path in
HaloLinkwith--reactodia-selection-link-colorcolor by default. - Add
changeTransformevent toCanvasApi.eventswhich triggers onCanvasApi.metrics.getTransform()changes, i.e. when coordinate mapping changes due to scale or canvas size is re-adjusted. - Add
DiagramModel.cellsVersionproperty which updates on every element or link addition/removal/reordering to be able to subscribe tochangeCellsevent withuseSyncStore()hook. - Deprecate
canvasWidgetsprop onDefaultWorkspaceandClassicWorkspacein favor of passing widgets directly as children. - Mark placeholder entity data with
PlaceholderDataPropertyproperty key to distinguish not-loaded-yet elements withEntityElement.isPlaceholderData():- Add
DataDiagramModel.requestData()as a convenient method to load all placeholder entities at once.
- Add
- Move expanded element state from distinct property on
Elementto be stored inElement.elementStatewithTemplateProperties.Expandedproperty:- All existing properties, methods and commands works as before but use element template state as storage for expanded state;
changeExpandedevent is removed from element events, usechangeElementStateevent instead;- When exporting the diagram the expanded state is serialized only with
elementStatewhile usingisExpandedproperty when importing the diagram for backward compatibility.
- Introduce
ElementTemplate.supportsproperty for templates to tell its capabilities such as ability to expand/collapse or resized by user. - Use consistent naming for standard element and link templates:
- Deprecate
DefaultLinkTemplateandDefaultLinkand alias them toStandardLinkTemplateandStandardRelation; - Change CSS class for standard element template from
reactodia-standard-templatetoreactodia-standard-element; - Change CSS class for default link template from
reactodia-default-linktoreactodia-standard-link; - Change translation groups from
standard_template/default_link_templatetostandard_element/standard_link.
- Deprecate
- Move "expand/collapse on double click" global element behavior to
StandardEntityandClassicEntityimplementation only. - Change
MetadataProvider.{createEntity, createRelation}to return result object with initial template state in addition to the data to customize the created cells (i.e. new elements can be expanded or collapsed). - Add
EditorController.applyAuthoringChanges()method to apply current authoring changes to the diagram (i.e. change entity data, delete relations, etc) and reset the change state to be empty. - Deprecate and hide by default "Edit" and "Delete" action buttons in
StandardEntityexpanded state (can be re-enabled by settingshowActionsprop totrue). - Deprecate
WorkpaceContext.{group, ungroupAll, ungroupSome}methods in favor of free functionsgroupEntities(),ungroupAllEntities(),ungroupSomeEntities().
🔧 Maintenance
- Use Vite to build the library instead of Webpack to reduce build time by 70% and produced bundle size by 38%.
- Update Vitest to v4.
- Use small subset of carbon design icons for various buttons.
v0.30.1
🐛 Fixed
- Fix
BaseMetadataProvidernot delegatingcanModifyRelationmethod from object passed in its constructor. - Make
CanvasApi.{exportSvg, exportRaster}export images referenced in CSS stylesheets or inline styles frommask(mask-image) orbackground(background-image) CSS properties. - Fix incomplete styles for exported canvas due to non-captured custom CSS property values in Chromium-based browsers.
- Fix issues when setting a mutable selection array, e.g.
model.setSelection(model.elements). - Fix moving elements with
Selectiondoes not adding an undo command to the history.
⏱ Performance
- Avoid unnecessary component updates in
HaloandHaloLinkwhen multiple elements are selected.
💅 Polish
- Expose
contentPaddingoption forCanvasApi.{exportSvg, exportRaster}methods to configure padding for the exported diagram.
v0.30.0
🚀 New Features
- Support authoring relation properties:
- Add
MetadataProvider.getRelationShape()interface method to get editor metadata for relation properties, and allow to returncanEdit: truefromMetadataProvider.canModifyRelation()to display relation properties editor;
- Add
- Display "edit" and "delete" inline entity actions:
- Add option
inlineEntityActions(defaults totrue) forVisualAuthoringto display entity actions inline at the top of each entity; - Improve the style for "cancel" (discard) action on entities and relations to make it consistent with other inline actions.
- Add option
- Add
ElementDecorationcomponent to display additional decorations over canvas elements either from the template itself or from outside the element:- Element decorations are not included in the computed element bounds but are exported with the canvas unless explicitly marked with
data-reactodia-no-exportattribute (as with other canvas elements).
- Element decorations are not included in the computed element bounds but are exported with the canvas unless explicitly marked with
- Support keyboard hotkeys for the focused canvas:
- Allow to specify arbitrary hotkeys to
ToolbarActionandSelectionActioncomponents, exportuseCanvasHotkey()hook to bind hotkey from any canvas widget; - Add default hotkeys for components:
Selection(Ctrl+A: select all),ToolbarActionUndo(Ctrl+Z),ToolbarActionRedo(Ctrl+Shift+Z),SelectionActionRemove(Delete, same as before),SelectionActionGroup(G).
- Allow to specify arbitrary hotkeys to
- [💥Breaking] Use separate HTML paper layer to display
LinkLabelcomponents instead of an SVG canvas, which allows to use CSS for layout, backgrounds and improves rendering performance:textClass,textStyle,rectClassandrectStyleare replaced byclassNameandstyleprops;- CSS should use HTML styling properties instead of SVG variants, e.g.
colorandbackground-colorinstead ofstrokeandfill; - Label content should be placed directly as children to the component instead of using
contentprop.
- Select entity label and image using
DataLocaleProviderbased on its properties:- [💥Breaking] Remove
ElementModel.{label, image}properties and instead useDataDiagramModel.localemethods to select them based onElementModel.propertiesinstead; - Allow to override data locale provider (default is
DefaultDataLocaleProvider) by passinglocaleoption tomodel.importLayout()ormodel.createNewDiagram();
- [💥Breaking] Remove
🐛 Fixed
- Always display validation state for an entities and relations in case when the target does not have any authoring changes.
- Display elliptical authoring state overlays for elliptically-shaped entity elements.
- Use provided
durationinCanvasApi.animateGraph()for element transitions without the need to override the styles. - Trigger
keydown,keyup,scrollandcontextMenucanvas events only from a non-widget layer. - Fix marking existing relation as new or changed after moving its source or target to its original source or target.
⏱ Performance
- Optimize diagram loading time by avoiding unnecessary updates and separating a measuring element sizes step from applying the sizes to the rendering state.
💅 Polish
- Export
BaseMetadataProvideras a stable base to instantiate or extend when implementing custom metadata providers. - Re-use and un-deprecate
model.localeformatting object withDataLocaleProviderinterface type:- Deprecate
Translation.formatIri()in favor oflocale.formatIri(); - Replace other deprecated methods of
localewith:selectEntityLabel(),selectEntityImageUrl(),formatEntityLabel(),formatEntityTypeList();
- Deprecate
- Provide gradual customization options for the built-in entity and relation property editor:
- Expose ability to customize property input in authoring forms with
inputResolveroption forVisualAuthoringcomponent; - Export built-in inputs
FormInputListandFormInputText, as well asFormInputSinglePropsandFormInputMultiPropsprops interfaces to implement custom property inputs.
- Expose ability to customize property input in authoring forms with
- [💥Breaking] Rename the following constants for consistency in naming style:
DIAGRAM_CONTEXT_URL_V1->DiagramContextV1,PLACEHOLDER_ELEMENT_TYPE->PlaceholderEntityType,PLACEHOLDER_LINK_TYPE->PlaceholderRelationType;
- Support the ability to expand up the
Dropdown,DropdownMenuandToolbarby settingdirectionto"up"e.g. for docking the toolbar to the bottom of the viewport. - Allow to return
iconMonochrome: truefor a type style to automatically apply dark theme filter for the icon. - Support optional dependency list in
useEventStore()to re-subscribe to store if needed.
🔧 Maintenance
- Make library compatible with React v19, while continuing support for v17 and v18.
- Increase
IndexedDbCachedProvider.DB_VERSIONto 4 due toElementModelchanges. - Remove deprecated
LocaleFormatter,DataGraphLocaleFormatterandFormattedPropertytypes. - Simplify the exported canvas SVG by using a single
<foreignObject>to hold the whole element layer instead of a separate one for each canvas element.
v0.29.1
🐛 Fixed
- Fix "max update exceeded in
componentDidUpdate()" error that can be triggered inInstancesSearchin some cases.
v0.29.0
🚀 New Features
- Support round (elliptical-shaped) elements:
- Allow element templates to set
shape: 'ellipse'to correctly compute link geometry; - Change
ElementTemplateto be an object with additional element template options, allow to return bothElementTemplateandElementTemplateComponentfromelementTemplateResolver; - Add built-in basic circle-shaped
RoundTemplatewith itsRoundEntitytemplate component; - Add
RenderingState.getElementShape()method to compute shape information (including bounds) for the element.
- Allow element templates to set
- Support smooth-curved links:
- Allow link templates to set
spline: 'smooth'to have rounded joints and overall shape via cubic Bézier curves; - Render links as smooth-curved by default unless a
spline: 'straight'is set in the link template.
- Allow link templates to set
- Allow to dock a dialog to any side of a target with
dockproperty with a configurabledockMargin.
🐛 Fixed
- Fix search section activation race in
UnifiedSearchwhich causes to sometimes open the first section instead of the specified one infocuscommand. - Auto-focus on search input field in
UnifiedSearchonfocuscommand. - Use
--reactodia-viewport-dock-margininstead of a hard-coded value to compute max size for a dialog without target.
💅 Polish
- Use "rounded" look by default by setting default
--reactodia-border-radius-baseto a non-zero value (it can be unset as before if desired to have a more "rectangular" UI styling). - Make
Canvasa focusable element to allow to handle keyboard events scoped to the graph:- Removing selected elements on
Deletekey press now happens only whenSelectionActionRemoveif displayed by theHaloorSelectioncanvas widgets and only if the canvas has the focus to avoid accidental element removal by the action from unrelated document parts. - Expose
keydownandkeyupevents onCanvasApi.eventsto handle keyboard events scoped to the canvas. - Canvas is now auto-focused (without scroll) on certain actions such as removing selected elements, grouping or ungrouping entities or dismissing a dialog.
- Removing selected elements on
- Export built-in templates and its components separately for easier customization:
- Change
StandardTemplateto a template object, expose its components asStandardEntityandStandardEntityGroup; - Change
ClassicTemplateto a template object, expose its component asClassicEntity; - Rename
DefaultLinkPathTemplatetoDefaultLink.
- Change
- Improve default routing for self (feedback) links with a single user-defined variable to have a basic loop instead of a straight line.
- Reduce the size of the main package bundle by moving fallback synchronous (blocking) layout into the separate entry point
/layout-sync:- [💥Breaking] Make
defaultLayouta required prop for aWorkspace: if a bundled synchronous fallback (blockingDefaultLayout()) was used by default, now it is necessary to import it manually from/layout-sync; - The recommended layout algorithm usage is as before via Web Workers with
defineLayoutWorker()anduseWorker().
- [💥Breaking] Make
- [💥Breaking] Replace explicit "commands" passing by common
WorkspaceContext.getCommandBus():- Remove all commands-like props from components, e.g.
commands,connectionMenuCommands,instancesSearchCommands,searchCommands. - Triggering a command or listening for one from outside the component should be done by acquiring a commands object using
getCommandBus()with the following built-in command bus topics:ConnectionsMenuTopic,InstancesSearchTopic,UnifiedSearchTopic,VisualAuthoringTopic. - [🧪Experimental] Custom command bus topics can be defined with
CommandBusTopic.define().
- Remove all commands-like props from components, e.g.
- Support
linkTypeoption forSelectionActionEstablishLinkto create a relation of a specific type from that action by default.
🔧 Maintenance
- Move deprecated type styles and link templates into separate entry point
@reactodia/workspace/legacy-styles, includingSemanticTypeStyles,makeOntologyLinkTemplates(Reactodia)(factory) andmakeLinkStyleShowIri(Reactodia)factory. - Remove deprecated
WorkspaceProps.onIriClick()and corresponding events and trigger method onSharedCanvasState. - Extract
HashMap,HashSetand hash-code generation utilities into separate package@reactodia/hashmap. - Extract Web Worker-related utilities into separate package
@reactodia/worker-proxy:@reactodia/worker-proxy/protocolshould be used instead of@reactodia/workspace/worker-protocolto define custom workers.useWorker()hook now accepts any worker adhering to theRefCountedWorkerinterface from@reactodia/worker-proxy, e.g. created withrefCountedWorker()function.
- Replace
classnamesruntime dependency byclsx. - Update runtime dependencies:
n3,@vscode/codicons. - Update dev-dependencies: Webpack + loaders, SASS, TypeScript, Vitest, ESLint.
v0.28.1
🐛 Fixed
- Fix missing elements on load when rendering in React strict mode (regression in v0.28.0).
⏱ Performance
- Improve performance of canvas scrolling and panning with mouse on large diagrams.
v0.28.0
🚀 New Features
- Support i18n for the UI components:
- Allow to provide custom bundles with translation strings and (optionally) disable the default one with
translationsanduseDefaultTranslationproperties for theWorkspace; - Provide
i18n/i18n.schema.jsonJSON schema to validate partial translation bundles.
- Allow to provide custom bundles with translation strings and (optionally) disable the default one with
- Basic design system and a built-in dark theme:
- Define a basic design system with CSS custom properties for colors, fonts, borders, spacing and transitions;
- Support base
border-radiuson inputs, buttons, panels, etc if provided via--reactodia-border-radius-base; - Change
StandardTemplateto use a common CSS property for entity color:--reactodia-element-style-color(previously was--reactodia-standard-entity-color); - Force specific color scheme (theme) via
colorSchemaproperty onWorkspaceRootandDefaultWorkspacewith defaultautomode; - Expose
useColorScheme()hook to observe current color scheme for the workspace. - Exporting the diagram (to SVG/PNG or printing it) always exports if the workspace is using the light theme.
- Ability to add, remove or modify property values in the "Edit entity" dialog:
- [🧪Experimental] Change
MetadataApi.getElementTypeShape()intogetElementShape()with a more specific contract, addgetLiteralLanguages().
- [🧪Experimental] Change
🐛 Fixed
- Disallow selection of already present but grouped entities in
ConnectionsMenuand place them again onto the canvas. - Fix incorrect handling of a relation in the "Edit relation" dialog when reversing the its direction (e.g. a change from "Person isAuthorOf Book" to "Book isNamedAfter Person"), including validation against duplicate relations and the displayed direction.
- Fix error when trying to render a
ToolbarActionOpenorToolbarActionSavein the toolbar instead of a dropdown menu. - Fix links having unresolved labels and no markers when importing the same diagram layout twice.
💅 Polish
- Relax assignment compatibility for branded IRI types (
ElementIri,ElementTypeIri,LinkTypeIri,PropertyTypeIri) to allow assignment from a rawstringtype but not between them.
🔧 Maintenance
- Deprecate
DiagramModel.localeusage: useTranslationobject to perform locale-specific formatting instead. - Remove unused
raceAbortSignal()function.