refactor(editor): extract filterable list component (#9278)

This commit is contained in:
Saul-Mirone
2024-12-24 05:14:22 +00:00
parent ea0a345533
commit 4ce5cf20c3
17 changed files with 64 additions and 69 deletions

View File

@@ -5,7 +5,7 @@ import type {
MenuItemGroup,
} from '@blocksuite/affine-components/toolbar';
import { renderGroups } from '@blocksuite/affine-components/toolbar';
import { assertExists, noop, WithDisposable } from '@blocksuite/global/utils';
import { noop, WithDisposable } from '@blocksuite/global/utils';
import { flip, offset } from '@floating-ui/dom';
import { css, html, LitElement } from 'lit';
import { property, query, state } from 'lit/decorators.js';
@@ -68,7 +68,12 @@ export class AffineCodeToolbar extends WithDisposable(LitElement) {
this._currentOpenMenu = this._popMenuAbortController;
assertExists(this._moreButton);
if (!this._moreButton) {
console.error(
'Failed to open more menu in code toolbar! Unexpected missing more button'
);
return;
}
createLitPortal({
template: html`

View File

@@ -1,3 +1,8 @@
import {
type FilterableListItem,
type FilterableListOptions,
showPopFilterableList,
} from '@blocksuite/affine-components/filterable-list';
import { ArrowDownIcon } from '@blocksuite/affine-components/icons';
import { unsafeCSSVarV2 } from '@blocksuite/affine-shared/theme';
import { noop, SignalWatcher, WithDisposable } from '@blocksuite/global/utils';
@@ -6,11 +11,6 @@ import { property, query } from 'lit/decorators.js';
import { styleMap } from 'lit/directives/style-map.js';
import { html } from 'lit/static-html.js';
import {
type FilterableListItem,
type FilterableListOptions,
showPopFilterableList,
} from '../../../../_common/components/filterable-list/index.js';
import type { CodeBlockComponent } from '../../../../code-block/code-block.js';
export class LanguageListButton extends WithDisposable(

View File

@@ -1,3 +1,4 @@
import { scrollbarStyle } from '@blocksuite/affine-shared/styles';
import { on, stopPropagation } from '@blocksuite/affine-shared/utils';
import type { EditorHost } from '@blocksuite/block-std';
import { WithDisposable } from '@blocksuite/global/utils';
@@ -5,7 +6,6 @@ import { css, html, LitElement, nothing } from 'lit';
import { property } from 'lit/decorators.js';
import type { AIItemGroupConfig } from '../../../_common/components/ai-item/types.js';
import { scrollbarStyle } from '../../../_common/components/utils.js';
import type { EdgelessRootBlockComponent } from '../../edgeless/edgeless-root-block.js';
export class EdgelessCopilotPanel extends WithDisposable(LitElement) {

View File

@@ -1,7 +1,6 @@
import { scrollbarStyle } from '@blocksuite/affine-shared/styles';
import { css } from 'lit';
import { scrollbarStyle } from '../../../_common/components/utils.js';
const paragraphButtonStyle = css`
.paragraph-button-icon > svg:nth-child(2) {
transition-duration: 0.3s;

View File

@@ -1,8 +1,7 @@
import { scrollbarStyle } from '@blocksuite/affine-shared/styles';
import { unsafeCSSVarV2 } from '@blocksuite/affine-shared/theme';
import { css } from 'lit';
import { scrollbarStyle } from '../../../_common/components/utils.js';
export const TOOLBAR_HEIGHT = 46;
export const keyboardToolbarStyles = css`

View File

@@ -1,9 +1,8 @@
import { scrollbarStyle } from '@blocksuite/affine-shared/styles';
import { unsafeCSSVar, unsafeCSSVarV2 } from '@blocksuite/affine-shared/theme';
import { baseTheme } from '@toeverything/theme';
import { css, unsafeCSS } from 'lit';
import { scrollbarStyle } from '../../../_common/components/utils.js';
export const linkedDocWidgetStyles = css`
.input-mask {
position: absolute;

View File

@@ -1,8 +1,7 @@
import { scrollbarStyle } from '@blocksuite/affine-shared/styles';
import { baseTheme } from '@toeverything/theme';
import { css, unsafeCSS } from 'lit';
import { scrollbarStyle } from '../../../_common/components/utils.js';
export const styles = css`
.overlay-mask {
pointer-events: auto;