Skip to content

Commit

Permalink
fix(blocks): remove lit dependency from theme service
Browse files Browse the repository at this point in the history
  • Loading branch information
L-Sun committed Dec 19, 2024
1 parent e6706fb commit 7a7e1ad
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 8 deletions.
1 change: 1 addition & 0 deletions packages/affine/components/src/toolbar/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export {
EditorMenuContent,
} from './menu-button.js';
export { EditorToolbarSeparator } from './separator.js';
export { darkToolbarStyles, lightToolbarStyles } from './styles.js';
export { EditorToolbar } from './toolbar.js';
export { Tooltip } from './tooltip.js';
export type {
Expand Down
29 changes: 29 additions & 0 deletions packages/affine/components/src/toolbar/styles.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import {
type AffineCssVariables,
combinedDarkCssVariables,
combinedLightCssVariables,
} from '@toeverything/theme';
import { unsafeCSS } from 'lit';

const toolbarColorKeys: Array<keyof AffineCssVariables> = [
'--affine-background-overlay-panel-color',
'--affine-v2-layer-background-overlayPanel' as never,
'--affine-background-error-color',
'--affine-background-primary-color',
'--affine-background-tertiary-color',
'--affine-icon-color',
'--affine-icon-secondary',
'--affine-border-color',
'--affine-divider-color',
'--affine-text-primary-color',
'--affine-hover-color',
'--affine-hover-color-filled',
];

export const lightToolbarStyles = toolbarColorKeys.map(
key => `${key}: ${unsafeCSS(combinedLightCssVariables[key])};`
);

export const darkToolbarStyles = toolbarColorKeys.map(
key => `${key}: ${unsafeCSS(combinedDarkCssVariables[key])};`
);
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@ import {
ArrowRightSmallIcon,
MoreHorizontalIcon,
} from '@blocksuite/affine-components/icons';
import { ColorScheme, type RootBlockModel } from '@blocksuite/affine-model';
import {
darkToolbarStyles,
EditPropsStore,
lightToolbarStyles,
} from '@blocksuite/affine-components/toolbar';
import { ColorScheme, type RootBlockModel } from '@blocksuite/affine-model';
import {
EditPropsStore,
ThemeProvider,
} from '@blocksuite/affine-shared/services';
import { stopPropagation } from '@blocksuite/affine-shared/utils';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import {
darkToolbarStyles,
EditPropsStore,
lightToolbarStyles,
} from '@blocksuite/affine-components/toolbar';
import {
EditPropsStore,
ThemeProvider,
} from '@blocksuite/affine-shared/services';
import {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ import { CommonUtils } from '@blocksuite/affine-block-surface';
import { ConnectorCWithArrowIcon } from '@blocksuite/affine-components/icons';
import {
cloneGroups,
darkToolbarStyles,
lightToolbarStyles,
type MenuItemGroup,
renderToolbarSeparator,
} from '@blocksuite/affine-components/toolbar';
Expand All @@ -23,11 +25,7 @@ import {
GroupElementModel,
ShapeElementModel,
} from '@blocksuite/affine-model';
import {
darkToolbarStyles,
lightToolbarStyles,
ThemeProvider,
} from '@blocksuite/affine-shared/services';
import { ThemeProvider } from '@blocksuite/affine-shared/services';
import { requestConnectedFrame } from '@blocksuite/affine-shared/utils';
import { WidgetComponent } from '@blocksuite/block-std';
import {
Expand Down

0 comments on commit 7a7e1ad

Please sign in to comment.