Skip to content

feat(DockView): bump version 9.1.11#415

Merged
ArgoZhang merged 5 commits intomasterfrom
dev-dockview
Apr 25, 2025
Merged

feat(DockView): bump version 9.1.11#415
ArgoZhang merged 5 commits intomasterfrom
dev-dockview

Conversation

@ArgoZhang
Copy link
Copy Markdown
Member

@ArgoZhang ArgoZhang commented Apr 25, 2025

Link issues

fixes #414

Summary By Copilot

Regression?

  • Yes
  • No

Risk

  • High
  • Medium
  • Low

Verification

  • Manual (required)
  • Automated

Packaging changes reviewed?

  • Yes
  • No
  • N/A

☑️ Self Check before Merge

⚠️ Please check all items below before review. ⚠️

  • Doc is updated/provided or not needed
  • Demo is updated/provided or not needed
  • Merge the latest code from the main branch

Summary by Sourcery

Bump DockView library version and make minor improvements to floating group and drawer handling

New Features:

  • Update dockview-core library from version 4.2.1 to 4.2.3

Enhancements:

  • Improve floating group and drawer rendering behavior
  • Enhance z-index and active state management for floating groups

@bb-auto bb-auto Bot added the enhancement New feature or request label Apr 25, 2025
@sourcery-ai
Copy link
Copy Markdown

sourcery-ai Bot commented Apr 25, 2025

Reviewer's Guide by Sourcery

This pull request includes several enhancements and fixes for the DockView component. It bumps the dockview-core version, implements drag and drop functionality, adds CSS styles for drop targets, enhances floating group drawer functionality, fixes theme initialization logic, and improves handling of drawer active state.

Sequence diagram for Drag and Drop event handling in OverlayRenderContainer

sequenceDiagram
  participant FocusContainer
  participant ReferenceContainer
  participant DragAndDropObserver

  FocusContainer->>DragAndDropObserver: DragStart
  DragAndDropObserver->>ReferenceContainer: onDragEnter(event)
  DragAndDropObserver->>ReferenceContainer: onDragOver(event)
  DragAndDropObserver->>ReferenceContainer: onDrop(event)
  DragAndDropObserver->>ReferenceContainer: onDragLeave(event)
  DragAndDropObserver->>ReferenceContainer: onDragEnd(event)
  note over FocusContainer, ReferenceContainer: Events are forwarded to the reference container for handling
Loading

File-Level Changes

Change Details Files
Bumped the dockview-core version from 4.2.1 to 4.2.3.
  • Updated the version number in dockview-core.esm.js.
src/components/BootstrapBlazor.DockView/wwwroot/js/dockview-core.esm.js
Implemented drag and drop functionality for the focus container.
  • Added DragAndDropObserver to forward drag and drop events for expected behaviors.
  • Handled dragEnd, dragEnter, dragLeave, drop, and dragOver events.
  • Made the dnd observer not conditional on whether the panel is visible.
src/components/BootstrapBlazor.DockView/wwwroot/js/dockview-core.esm.js
Added CSS styles for drop target functionality.
  • Added styles for .dv-drop-target, .dv-drop-target-dropzone, .dv-drop-target-selection, and variations for top, bottom, left, and right drop targets.
  • Added styles for .dv-drop-target-container and .dv-drop-target-anchor.
src/components/BootstrapBlazor.DockView/wwwroot/css/dockview.css
Enhanced floating group drawer functionality.
  • Added 'dv-render-overlay-float-drawer' class to floating group's active panel content element.
  • Modified createDrawerHandle function to add class to parent element.
  • Modified createDrawerBtn function to remove class from parent element.
  • Modified observeOverlayChange function to remove class from parent element.
  • Modified dock function to remove class from parent element.
src/components/BootstrapBlazor.DockView/wwwroot/js/dockview-group.js
src/components/BootstrapBlazor.DockView/wwwroot/css/dockview-bb.css
Fixed theme initialization logic in DockViewV2 component.
  • Corrected the conditional statement to properly set the theme based on the system theme.
src/components/BootstrapBlazor.DockView/Components/DockViewV2.razor.js
Improved handling of drawer active state.
  • Modified event listener to target both 'dv-resize-container-drawer' and 'dv-render-overlay-float-drawer' elements when removing the active class.
src/components/BootstrapBlazor.DockView/wwwroot/js/dockview-utils.js

Assessment against linked issues

Issue Objective Addressed Explanation
#414 Bump the dockview-core version from 4.2.1 to 4.2.3.

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@bb-auto bb-auto Bot added this to the v9.2.0 milestone Apr 25, 2025
@ArgoZhang ArgoZhang merged commit d1a0506 into master Apr 25, 2025
1 check passed
@ArgoZhang ArgoZhang deleted the dev-dockview branch April 25, 2025 02:39
Copy link
Copy Markdown

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @ArgoZhang - I've reviewed your changes - here's some feedback:

Overall Comments:

  • Consider using a more descriptive commit message than just bumping the version number.
Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟡 Complexity: 1 issue found
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

* @version 4.2.3
* @link https://github.com/mathuo/dockview
* @license MIT
*/
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (complexity): Consider extracting inline callbacks and nested logic into smaller helper functions to improve code organization and readability.

Extract inline callbacks and nested logic into smaller helper functions. For example, instead of writing the callbacks directly in the constructor of the drag-and-drop observer, extract the event handlers:

// Define helper to create drag-and-drop handlers
function createDragAndDropHandlers(referenceContainer) {
  return {
    onDragEnd: (e) => referenceContainer.dropTarget.dnd.onDragEnd(e),
    onDragEnter: (e) => referenceContainer.dropTarget.dnd.onDragEnter(e),
    onDragLeave: (e) => referenceContainer.dropTarget.dnd.onDragLeave(e),
    onDrop: (e) => referenceContainer.dropTarget.dnd.onDrop(e),
    onDragOver: (e) => referenceContainer.dropTarget.dnd.onDragOver(e)
  };
}

Then use it in your code:

const disposable = new CompositeDisposable(
  observerDisposable,
  new DragAndDropObserver(focusContainer, createDragAndDropHandlers(referenceContainer)),
  panel.api.onDidVisibilityChange(() => visibilityChanged()),
  panel.api.onDidDimensionsChange(() => {
    if (panel.api.isVisible) { resize(); }
  }),
  panel.api.onDidLocationChange(() => correctLayerPosition())
);

Similarly, for complex promise chains (for the popout window code), refactor nested logic into self-contained functions that handle specific responsibilities. For instance, you might extract the popout creation logic:

function handlePopoutWindow(_window, overlayRenderContainer, referenceGroup, options) {
  const popoutContainer = _window.window.document.body; // or however you get it
  // ... extracted and simplified initialization
  popoutContainer.classList.add('dv-dockview');
  popoutContainer.style.overflow = 'hidden';
  // Append and configure DOM elements
  return popoutContainer;
}

// Then call:
_window.open().then((popoutContainer) => { 
  if (_window.isDisposed || popoutContainer === null) {
    // error handling
    return false;
  }
  const container = handlePopoutWindow(_window, overlayRenderContainer, referenceGroup, options);
  // rest of the logic...
});

These steps help separate concerns and flatten deeply nested inline logic, making the code easier to read and maintain while preserving all functionality.

var _a;
if (_window.isDisposed) {
return false;
var _a;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (code-quality): Use const or let instead of var. (avoid-using-var)

Explanation`const` is preferred as it ensures you cannot reassign references (which can lead to buggy and confusing code). `let` may be used if you need to reassign references - it's preferred to `var` because it is block- rather than function-scoped.

From the Airbnb JavaScript Style Guide

}
this.doSetGroupAndPanelActive(group);
popoutWindowDisposable.addDisposables(group.api.onDidActiveChange((event) => {
var _a;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (code-quality): Use const or let instead of var. (avoid-using-var)

Explanation`const` is preferred as it ensures you cannot reassign references (which can lead to buggy and confusing code). `let` may be used if you need to reassign references - it's preferred to `var` because it is block- rather than function-scoped.

From the Airbnb JavaScript Style Guide

else if (options === null || options === void 0 ? void 0 : options.overridePopoutGroup) {
group = options.overridePopoutGroup;
}), group.api.onWillFocus(() => {
var _a;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (code-quality): Use const or let instead of var. (avoid-using-var)

Explanation`const` is preferred as it ensures you cannot reassign references (which can lead to buggy and confusing code). `let` may be used if you need to reassign references - it's preferred to `var` because it is block- rather than function-scoped.

From the Airbnb JavaScript Style Guide

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

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(DockView): bump version 9.1.11

2 participants