-
Notifications
You must be signed in to change notification settings - Fork 85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor: move item and list-box extensions to separate files #5352
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/** | ||
* @license | ||
* Copyright (c) 2016 - 2023 Vaadin Ltd. | ||
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/ | ||
*/ | ||
import { Item } from '@vaadin/item/src/vaadin-item.js'; | ||
|
||
/** | ||
* An element used internally by `<vaadin-context-menu>`. Not intended to be used separately. | ||
* | ||
* @protected | ||
*/ | ||
declare class ContextMenuItem extends Item {} | ||
|
||
declare global { | ||
interface HTMLElementTagNameMap { | ||
'vaadin-context-menu-item': ContextMenuItem; | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/** | ||
* @license | ||
* Copyright (c) 2016 - 2023 Vaadin Ltd. | ||
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/ | ||
*/ | ||
import { Item } from '@vaadin/item/src/vaadin-item.js'; | ||
|
||
/** | ||
* An element used internally by `<vaadin-context-menu>`. Not intended to be used separately. | ||
* | ||
* @extends Item | ||
* @protected | ||
*/ | ||
class ContextMenuItem extends Item { | ||
static get is() { | ||
return 'vaadin-context-menu-item'; | ||
} | ||
} | ||
|
||
customElements.define(ContextMenuItem.is, ContextMenuItem); |
19 changes: 19 additions & 0 deletions
19
packages/context-menu/src/vaadin-context-menu-list-box.d.ts
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/** | ||
* @license | ||
* Copyright (c) 2016 - 2023 Vaadin Ltd. | ||
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/ | ||
*/ | ||
import { ListBox } from '@vaadin/list-box/src/vaadin-list-box.js'; | ||
|
||
/** | ||
* An element used internally by `<vaadin-context-menu>`. Not intended to be used separately. | ||
* | ||
* @protected | ||
*/ | ||
declare class ContextMenuListBox extends ListBox {} | ||
|
||
declare global { | ||
interface HTMLElementTagNameMap { | ||
'vaadin-context-menu-list-box': ContextMenuListBox; | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/** | ||
* @license | ||
* Copyright (c) 2016 - 2023 Vaadin Ltd. | ||
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/ | ||
*/ | ||
import { ListBox } from '@vaadin/list-box/src/vaadin-list-box.js'; | ||
|
||
/** | ||
* An element used internally by `<vaadin-context-menu>`. Not intended to be used separately. | ||
* | ||
* @extends ListBox | ||
* @protected | ||
*/ | ||
class ContextMenuListBox extends ListBox { | ||
static get is() { | ||
return 'vaadin-context-menu-list-box'; | ||
} | ||
} | ||
|
||
customElements.define(ContextMenuListBox.is, ContextMenuListBox); |
This file contains 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
This file contains 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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This class isn't exported because it's considered internal. Also, its name collides with
ContextMenuItem
type.Because of it, previously when located in the mixin file, it was named
ContextMenuItemElement
.I think we can keep these two classes as "private" for now, because they don't enhance parent classes with any logic. Generally, such components as
vaadin-select-item
do not provide type definitions at all.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, at least
vaadin-context-menu-item
is used by the Flow counterpart (it creates a virtual DOM tree ofvaadin-context-menu-item
s which then are assigned via theitems
array), so it isn't entirely private, but types don't make much sense for Flow, I agree.