Skip to content

feat: Create a Core Package for Shared Hooks and Utilities #441

Description

@kumaradityaraj

Description

Description

The packages/text-editor package currently needs functionality that is already implemented in packages/open-workflow-diagram-editor/src.

Since this hook is useful across multiple editor packages, we should consider moving shared functionality into a dedicated core package rather than duplicating the implementation.

Proposed Change

Create a shared core package that can contain common hooks, utilities, and types used by packages such as:

  • @openworkflowspec/diagram-editor
  • @openworkflowspec/text-editor
  • Other editor packages in the future

For example:

packages/
├── core/
│   ├── hooks/
│   │   └── useResolvedColorMode.ts
│   └── ...
├── open-workflow-diagram-editor/
└── text-editor/

Both editors would then consume the shared implementation from the core package.

Scope

  • Move useResolvedColorMode into the shared package.
  • Update existing consumers to import it from the core package.
  • Keep the shared package focused on reusable, package-agnostic functionality.
  • Add tests/documentation where appropriate.

Expected Outcome

There should be a single source of truth for shared editor functionality, avoiding duplicated implementations and making it easier to reuse common code across the editor packages.

Motivation

The useResolvedColorMode hook is currently implemented in the diagram editor package, but the same functionality is also required by the text editor. Keeping shared logic within a specific package can lead to duplication and make future maintenance harder.

Introducing a shared core package would provide a single source of truth for common hooks, utilities, and types, allowing multiple editor packages to reuse them consistently. This also establishes a scalable structure for sharing functionality as more editor packages are added.

Proposed Implementation

No response

Definition of Done

  • Implementation: Fully implemented according to the Open Workflow spec.
  • Unit Tests: Comprehensive unit tests are included and passing.
  • Integration Tests: Verified within the monorepo and target environments (Web/VS Code).
  • Documentation: Updated README.md, ADRs, or official docs.
  • Performance: No significant regression in editor responsiveness.
  • Accessibility: UI changes comply with accessibility standards.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

enhancementNew feature or request

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions