From 10b1f233d918eea55320e2a21f936f0ecdbad935 Mon Sep 17 00:00:00 2001 From: JimmFly Date: Fri, 1 Nov 2024 03:58:02 +0000 Subject: [PATCH] feat(core): add edgelessTheme property and edgelessDefault theme setting (#8614) close AF-1430 AF-1471 https://github.com/user-attachments/assets/d997ac6c-ce94-4fa4-ab34-29b36c7796ea --- packages/common/env/package.json | 2 +- packages/common/infra/package.json | 2 +- packages/common/infra/src/index.ts | 3 + .../common/infra/src/modules/doc/constants.ts | 6 + .../infra/src/modules/theme/entities/theme.ts | 6 + .../common/infra/src/modules/theme/index.ts | 9 + .../infra/src/modules/theme/services/theme.ts | 6 + packages/frontend/apps/android/package.json | 2 +- packages/frontend/apps/electron/package.json | 2 +- packages/frontend/apps/ios/package.json | 2 +- packages/frontend/apps/mobile/package.json | 2 +- packages/frontend/component/package.json | 2 +- .../src/components/theme-provider/index.tsx | 16 +- packages/frontend/core/package.json | 2 +- .../editor/edgeless/edgeless.tsx | 2 + .../editor/edgeless/general.tsx | 106 ++++++ .../specs/custom/root-block.ts | 100 +++++- .../block-suite-page-list/utils.tsx | 14 + .../doc-properties/types/constant.tsx | 8 + .../types/edgeless-theme.css.ts | 6 + .../doc-properties/types/edgeless-theme.tsx | 48 +++ .../core/src/components/hooks/use-journal.ts | 36 +- .../core/src/modules/editor-setting/schema.ts | 4 + packages/frontend/i18n/src/resources/en.json | 7 +- .../frontend/i18n/src/resources/zh-Hans.json | 7 +- .../affine-local/e2e/page-properties.spec.ts | 2 + tools/cli/package.json | 2 +- yarn.lock | 330 +++++++++--------- 28 files changed, 553 insertions(+), 181 deletions(-) create mode 100644 packages/common/infra/src/modules/theme/entities/theme.ts create mode 100644 packages/common/infra/src/modules/theme/index.ts create mode 100644 packages/common/infra/src/modules/theme/services/theme.ts create mode 100644 packages/frontend/core/src/components/affine/setting-modal/general-setting/editor/edgeless/general.tsx create mode 100644 packages/frontend/core/src/components/doc-properties/types/edgeless-theme.css.ts create mode 100644 packages/frontend/core/src/components/doc-properties/types/edgeless-theme.tsx diff --git a/packages/common/env/package.json b/packages/common/env/package.json index 5b0d1e5c92..84de2e227d 100644 --- a/packages/common/env/package.json +++ b/packages/common/env/package.json @@ -3,7 +3,7 @@ "private": true, "type": "module", "devDependencies": { - "@blocksuite/affine": "0.17.23", + "@blocksuite/affine": "0.17.25", "vitest": "2.1.1" }, "exports": { diff --git a/packages/common/infra/package.json b/packages/common/infra/package.json index aa0484206d..a1e1b1d0a5 100644 --- a/packages/common/infra/package.json +++ b/packages/common/infra/package.json @@ -14,7 +14,7 @@ "@affine/debug": "workspace:*", "@affine/env": "workspace:*", "@affine/templates": "workspace:*", - "@blocksuite/affine": "0.17.23", + "@blocksuite/affine": "0.17.25", "@datastructures-js/binary-search-tree": "^5.3.2", "foxact": "^0.2.33", "fractional-indexing": "^3.2.0", diff --git a/packages/common/infra/src/index.ts b/packages/common/infra/src/index.ts index 07b6c95cb7..5026ea5bce 100644 --- a/packages/common/infra/src/index.ts +++ b/packages/common/infra/src/index.ts @@ -10,6 +10,7 @@ export * from './modules/feature-flag'; export * from './modules/global-context'; export * from './modules/lifecycle'; export * from './modules/storage'; +export * from './modules/theme'; export * from './modules/workspace'; export * from './orm'; export * from './storage'; @@ -26,6 +27,7 @@ import { configureGlobalStorageModule, configureTestingGlobalStorage, } from './modules/storage'; +import { configureAppThemeModule } from './modules/theme'; import { configureTestingWorkspaceProvider, configureWorkspaceModule, @@ -39,6 +41,7 @@ export function configureInfraModules(framework: Framework) { configureGlobalContextModule(framework); configureLifecycleModule(framework); configureFeatureFlagModule(framework); + configureAppThemeModule(framework); } export function configureTestingInfraModules(framework: Framework) { diff --git a/packages/common/infra/src/modules/doc/constants.ts b/packages/common/infra/src/modules/doc/constants.ts index 2fea3f35d5..af982db0f5 100644 --- a/packages/common/infra/src/modules/doc/constants.ts +++ b/packages/common/infra/src/modules/doc/constants.ts @@ -39,4 +39,10 @@ export const BUILT_IN_CUSTOM_PROPERTY_TYPE = [ show: 'always-hide', index: 'a0000006', }, + { + id: 'edgelessTheme', + type: 'edgelessTheme', + show: 'always-hide', + index: 'a0000007', + }, ] as DocCustomPropertyInfo[]; diff --git a/packages/common/infra/src/modules/theme/entities/theme.ts b/packages/common/infra/src/modules/theme/entities/theme.ts new file mode 100644 index 0000000000..055b7e486d --- /dev/null +++ b/packages/common/infra/src/modules/theme/entities/theme.ts @@ -0,0 +1,6 @@ +import { Entity } from '../../../framework'; +import { LiveData } from '../../../livedata'; + +export class AppTheme extends Entity { + theme$ = new LiveData(undefined); +} diff --git a/packages/common/infra/src/modules/theme/index.ts b/packages/common/infra/src/modules/theme/index.ts new file mode 100644 index 0000000000..37e2276c01 --- /dev/null +++ b/packages/common/infra/src/modules/theme/index.ts @@ -0,0 +1,9 @@ +export { AppThemeService } from './services/theme'; + +import type { Framework } from '../../framework'; +import { AppTheme } from './entities/theme'; +import { AppThemeService } from './services/theme'; + +export function configureAppThemeModule(framework: Framework) { + framework.service(AppThemeService).entity(AppTheme); +} diff --git a/packages/common/infra/src/modules/theme/services/theme.ts b/packages/common/infra/src/modules/theme/services/theme.ts new file mode 100644 index 0000000000..74d086ce5b --- /dev/null +++ b/packages/common/infra/src/modules/theme/services/theme.ts @@ -0,0 +1,6 @@ +import { Service } from '../../../framework'; +import { AppTheme } from '../entities/theme'; + +export class AppThemeService extends Service { + appTheme = this.framework.createEntity(AppTheme); +} diff --git a/packages/frontend/apps/android/package.json b/packages/frontend/apps/android/package.json index c8d98b22dc..d36ebdf792 100644 --- a/packages/frontend/apps/android/package.json +++ b/packages/frontend/apps/android/package.json @@ -13,7 +13,7 @@ "@affine/component": "workspace:*", "@affine/core": "workspace:*", "@affine/i18n": "workspace:*", - "@blocksuite/affine": "0.17.23", + "@blocksuite/affine": "0.17.25", "@blocksuite/icons": "^2.1.67", "@capacitor/android": "^6.1.2", "@capacitor/core": "^6.1.2", diff --git a/packages/frontend/apps/electron/package.json b/packages/frontend/apps/electron/package.json index d68a63d672..35e282bbbb 100644 --- a/packages/frontend/apps/electron/package.json +++ b/packages/frontend/apps/electron/package.json @@ -28,7 +28,7 @@ "@affine/core": "workspace:*", "@affine/i18n": "workspace:*", "@affine/native": "workspace:*", - "@blocksuite/affine": "0.17.23", + "@blocksuite/affine": "0.17.25", "@electron-forge/cli": "^7.3.0", "@electron-forge/core": "^7.3.0", "@electron-forge/core-utils": "^7.3.0", diff --git a/packages/frontend/apps/ios/package.json b/packages/frontend/apps/ios/package.json index b49732c76f..a751762d9f 100644 --- a/packages/frontend/apps/ios/package.json +++ b/packages/frontend/apps/ios/package.json @@ -13,7 +13,7 @@ "@affine/component": "workspace:*", "@affine/core": "workspace:*", "@affine/i18n": "workspace:*", - "@blocksuite/affine": "0.17.23", + "@blocksuite/affine": "0.17.25", "@blocksuite/icons": "^2.1.67", "@capacitor/app": "^6.0.1", "@capacitor/browser": "^6.0.3", diff --git a/packages/frontend/apps/mobile/package.json b/packages/frontend/apps/mobile/package.json index 2fdc9ea8b8..aaa98d2052 100644 --- a/packages/frontend/apps/mobile/package.json +++ b/packages/frontend/apps/mobile/package.json @@ -13,7 +13,7 @@ "@affine/component": "workspace:*", "@affine/core": "workspace:*", "@affine/i18n": "workspace:*", - "@blocksuite/affine": "0.17.23", + "@blocksuite/affine": "0.17.25", "@blocksuite/icons": "^2.1.67", "@sentry/react": "^8.0.0", "react": "^18.2.0", diff --git a/packages/frontend/component/package.json b/packages/frontend/component/package.json index 44ba053902..bf7d45797d 100644 --- a/packages/frontend/component/package.json +++ b/packages/frontend/component/package.json @@ -62,7 +62,7 @@ "zod": "^3.22.4" }, "devDependencies": { - "@blocksuite/affine": "0.17.23", + "@blocksuite/affine": "0.17.25", "@blocksuite/icons": "2.1.69", "@chromatic-com/storybook": "^3.0.0", "@storybook/addon-essentials": "^8.2.9", diff --git a/packages/frontend/component/src/components/theme-provider/index.tsx b/packages/frontend/component/src/components/theme-provider/index.tsx index ad69e27aae..72590b669a 100644 --- a/packages/frontend/component/src/components/theme-provider/index.tsx +++ b/packages/frontend/component/src/components/theme-provider/index.tsx @@ -1,12 +1,26 @@ -import { ThemeProvider as NextThemeProvider } from 'next-themes'; +import { AppThemeService, useService } from '@toeverything/infra'; +import { ThemeProvider as NextThemeProvider, useTheme } from 'next-themes'; import type { PropsWithChildren } from 'react'; +import { useEffect } from 'react'; const themes = ['dark', 'light']; +export function ThemeObserver() { + const { resolvedTheme } = useTheme(); + const service = useService(AppThemeService); + + useEffect(() => { + service.appTheme.theme$.next(resolvedTheme); + }, [resolvedTheme, service.appTheme.theme$]); + + return null; +} + export const ThemeProvider = ({ children }: PropsWithChildren) => { return ( {children} + ); }; diff --git a/packages/frontend/core/package.json b/packages/frontend/core/package.json index ee10f1d9e2..7a977d0001 100644 --- a/packages/frontend/core/package.json +++ b/packages/frontend/core/package.json @@ -16,7 +16,7 @@ "@affine/i18n": "workspace:*", "@affine/templates": "workspace:*", "@affine/track": "workspace:*", - "@blocksuite/affine": "0.17.23", + "@blocksuite/affine": "0.17.25", "@blocksuite/icons": "2.1.69", "@capacitor/app": "^6.0.1", "@capacitor/browser": "^6.0.3", diff --git a/packages/frontend/core/src/components/affine/setting-modal/general-setting/editor/edgeless/edgeless.tsx b/packages/frontend/core/src/components/affine/setting-modal/general-setting/editor/edgeless/edgeless.tsx index db5530d189..df9914b2b2 100644 --- a/packages/frontend/core/src/components/affine/setting-modal/general-setting/editor/edgeless/edgeless.tsx +++ b/packages/frontend/core/src/components/affine/setting-modal/general-setting/editor/edgeless/edgeless.tsx @@ -2,6 +2,7 @@ import { SettingWrapper } from '@affine/component/setting-components'; import { useI18n } from '@affine/i18n'; import { ConnectorSettings } from './connector'; +import { GeneralEdgelessSetting } from './general'; import { MindMapSettings } from './mind-map'; import { NoteSettings } from './note'; import { PenSettings } from './pen'; @@ -12,6 +13,7 @@ export const Edgeless = () => { const t = useI18n(); return ( + diff --git a/packages/frontend/core/src/components/affine/setting-modal/general-setting/editor/edgeless/general.tsx b/packages/frontend/core/src/components/affine/setting-modal/general-setting/editor/edgeless/general.tsx new file mode 100644 index 0000000000..36b392e7b6 --- /dev/null +++ b/packages/frontend/core/src/components/affine/setting-modal/general-setting/editor/edgeless/general.tsx @@ -0,0 +1,106 @@ +import { Menu, MenuItem, MenuTrigger } from '@affine/component'; +import { SettingRow } from '@affine/component/setting-components'; +import { EditorSettingService } from '@affine/core/modules/editor-setting'; +import type { EdgelessDefaultTheme } from '@affine/core/modules/editor-setting/schema'; +import { useI18n } from '@affine/i18n'; +import { useLiveData, useService } from '@toeverything/infra'; +import { useMemo } from 'react'; + +import { menuTrigger } from '../style.css'; + +const getThemeOptions = ( + t: ReturnType +): { value: EdgelessDefaultTheme; label: string }[] => [ + { + value: 'specified' as EdgelessDefaultTheme, + label: + t[ + 'com.affine.settings.editorSettings.page.edgeless-default-theme.specified' + ](), + }, + { + value: 'dark' as EdgelessDefaultTheme, + label: t['com.affine.themeSettings.dark'](), + }, + { + value: 'light' as EdgelessDefaultTheme, + label: t['com.affine.themeSettings.light'](), + }, + { + value: 'auto' as EdgelessDefaultTheme, + label: t['com.affine.themeSettings.auto'](), + }, +]; + +const getThemeValue = ( + theme: EdgelessDefaultTheme, + t: ReturnType +) => { + switch (theme) { + case 'dark': + return t['com.affine.themeSettings.dark'](); + case 'light': + return t['com.affine.themeSettings.light'](); + case 'auto': + return t['com.affine.themeSettings.auto'](); + case 'specified': + return t[ + 'com.affine.settings.editorSettings.page.edgeless-default-theme.specified' + ](); + default: + return ''; + } +}; + +export const GeneralEdgelessSetting = () => { + const t = useI18n(); + const editorSetting = useService(EditorSettingService).editorSetting; + const edgelessDefaultTheme = useLiveData( + editorSetting.settings$ + ).edgelessDefaultTheme; + + const items = getThemeOptions(t); + const currentTheme = useMemo(() => { + return getThemeValue(edgelessDefaultTheme, t); + }, [edgelessDefaultTheme, t]); + + const menuItems = useMemo(() => { + return items.map(item => { + const selected = edgelessDefaultTheme === item.value; + const onSelect = () => { + editorSetting.set('edgelessDefaultTheme', item.value); + }; + return ( + + {item.label} + + ); + }); + }, [editorSetting, items, edgelessDefaultTheme]); + + return ( + + + + {currentTheme} + + + + ); +}; diff --git a/packages/frontend/core/src/components/blocksuite/block-suite-editor/specs/custom/root-block.ts b/packages/frontend/core/src/components/blocksuite/block-suite-editor/specs/custom/root-block.ts index ee47d9dd95..fe993dd988 100644 --- a/packages/frontend/core/src/components/blocksuite/block-suite-editor/specs/custom/root-block.ts +++ b/packages/frontend/core/src/components/blocksuite/block-suite-editor/specs/custom/root-block.ts @@ -7,20 +7,35 @@ import { mixpanel } from '@affine/track'; import { ConfigExtension, type ExtensionType, + LifeCycleWatcher, + StdIdentifier, } from '@blocksuite/affine/block-std'; import { + ColorScheme, EdgelessBuiltInManager, EdgelessRootBlockSpec, EdgelessToolExtension, EditorSettingExtension, FontLoaderService, PageRootBlockSpec, -} from '@blocksuite/affine/blocks'; -import { type TelemetryEventMap, TelemetryProvider, + type ThemeExtension, + ThemeExtensionIdentifier, } from '@blocksuite/affine/blocks'; -import { type FrameworkProvider } from '@toeverything/infra'; +import { + createSignalFromObservable, + type Signal, +} from '@blocksuite/affine-shared/utils'; +import type { Container } from '@blocksuite/global/di'; +import { + AppThemeService, + DocService, + DocsService, + type FrameworkProvider, +} from '@toeverything/infra'; +import type { Observable } from 'rxjs'; +import { combineLatest, map } from 'rxjs'; import { getFontConfigExtension } from '../font-extension'; import { createDatabaseOptionsConfig } from './database-block'; @@ -42,6 +57,83 @@ function getTelemetryExtension(): ExtensionType { }; } +function createThemeExtension(framework: FrameworkProvider) { + class AffineThemeExtension + extends LifeCycleWatcher + implements ThemeExtension + { + static override readonly key = 'affine-theme'; + + private readonly themes: Map> = new Map(); + + protected readonly disposables: (() => void)[] = []; + + static override setup(di: Container) { + super.setup(di); + di.override(ThemeExtensionIdentifier, AffineThemeExtension, [ + StdIdentifier, + ]); + } + + getAppTheme() { + const keyName = 'app-theme'; + const cache = this.themes.get(keyName); + if (cache) return cache; + + const theme$: Observable = framework + .get(AppThemeService) + .appTheme.theme$.map(theme => { + return theme === ColorScheme.Dark + ? ColorScheme.Dark + : ColorScheme.Light; + }); + const { signal: themeSignal, cleanup } = + createSignalFromObservable(theme$, ColorScheme.Light); + this.disposables.push(cleanup); + this.themes.set(keyName, themeSignal); + return themeSignal; + } + + getEdgelessTheme(docId?: string) { + const doc = + (docId && framework.get(DocsService).list.doc$(docId).getValue()) || + framework.get(DocService).doc; + + const cache = this.themes.get(doc.id); + if (cache) return cache; + + const appTheme$ = framework.get(AppThemeService).appTheme.theme$; + const docTheme$ = doc.properties$.map(props => props.edgelessColorTheme); + const theme$: Observable = combineLatest([ + appTheme$, + docTheme$, + ]).pipe( + map(([appTheme, docTheme]) => { + const theme = docTheme === 'system' ? appTheme : docTheme; + return theme === ColorScheme.Dark + ? ColorScheme.Dark + : ColorScheme.Light; + }) + ); + const { signal: themeSignal, cleanup } = + createSignalFromObservable(theme$, ColorScheme.Light); + this.disposables.push(cleanup); + this.themes.set(doc.id, themeSignal); + return themeSignal; + } + + override unmounted() { + this.dispose(); + } + + dispose() { + this.disposables.forEach(dispose => dispose()); + } + } + + return AffineThemeExtension; +} + function getEditorConfigExtension( framework: FrameworkProvider ): ExtensionType[] { @@ -63,6 +155,7 @@ export function createPageRootBlockSpec( return [ enableAI ? AIPageRootBlockSpec : PageRootBlockSpec, FontLoaderService, + createThemeExtension(framework), getFontConfigExtension(), getTelemetryExtension(), getEditorConfigExtension(framework), @@ -76,6 +169,7 @@ export function createEdgelessRootBlockSpec( return [ enableAI ? AIEdgelessRootBlockSpec : EdgelessRootBlockSpec, FontLoaderService, + createThemeExtension(framework), EdgelessToolExtension, EdgelessBuiltInManager, getFontConfigExtension(), diff --git a/packages/frontend/core/src/components/blocksuite/block-suite-page-list/utils.tsx b/packages/frontend/core/src/components/blocksuite/block-suite-page-list/utils.tsx index f66ba837d0..aea697c7de 100644 --- a/packages/frontend/core/src/components/blocksuite/block-suite-page-list/utils.tsx +++ b/packages/frontend/core/src/components/blocksuite/block-suite-page-list/utils.tsx @@ -5,8 +5,11 @@ import { WorkbenchService } from '@affine/core/modules/workbench'; import { type DocMode } from '@blocksuite/affine/blocks'; import type { DocCollection } from '@blocksuite/affine/store'; import { type DocProps, DocsService, useServices } from '@toeverything/infra'; +import { useTheme } from 'next-themes'; import { useCallback, useMemo } from 'react'; +import { getValueByDefaultTheme } from '../../hooks/use-journal'; + export const usePageHelper = (docCollection: DocCollection) => { const { docsService, @@ -22,6 +25,7 @@ export const usePageHelper = (docCollection: DocCollection) => { const workbench = workbenchService.workbench; const docRecordList = docsService.list; const appSidebar = appSidebarService.sidebar; + const { resolvedTheme } = useTheme(); const createPageAndOpen = useCallback( (mode?: DocMode, open?: boolean | 'new-tab') => { @@ -30,6 +34,15 @@ export const usePageHelper = (docCollection: DocCollection) => { note: editorSettingService.editorSetting.get('affine:note'), }; const page = docsService.createDoc({ docProps }); + + const value = getValueByDefaultTheme( + editorSettingService.editorSetting.settings$.value.edgelessDefaultTheme, + resolvedTheme || 'light' + ); + docRecordList + .doc$(page.id) + .value?.setProperty('edgelessColorTheme', value); + if (mode) { docRecordList.doc$(page.id).value?.setPrimaryMode(mode); } @@ -45,6 +58,7 @@ export const usePageHelper = (docCollection: DocCollection) => { docRecordList, docsService, editorSettingService.editorSetting, + resolvedTheme, workbench, ] ); diff --git a/packages/frontend/core/src/components/doc-properties/types/constant.tsx b/packages/frontend/core/src/components/doc-properties/types/constant.tsx index 6b1df8da53..43e4a0b1b9 100644 --- a/packages/frontend/core/src/components/doc-properties/types/constant.tsx +++ b/packages/frontend/core/src/components/doc-properties/types/constant.tsx @@ -3,6 +3,7 @@ import { CheckBoxCheckLinearIcon, CreatedEditedIcon, DateTimeIcon, + EdgelessIcon, FileIcon, HistoryIcon, NumberIcon, @@ -15,6 +16,7 @@ import { CheckboxValue } from './checkbox'; import { CreatedByValue, UpdatedByValue } from './created-updated-by'; import { CreateDateValue, DateValue, UpdatedDateValue } from './date'; import { DocPrimaryModeValue } from './doc-primary-mode'; +import { EdgelessThemeValue } from './edgeless-theme'; import { JournalValue } from './journal'; import { NumberValue } from './number'; import { TagsValue } from './tags'; @@ -90,6 +92,12 @@ export const DocPropertyTypes = { name: 'com.affine.page-properties.property.journal', description: 'com.affine.page-properties.property.journal.tooltips', }, + edgelessTheme: { + icon: EdgelessIcon, + value: EdgelessThemeValue, + name: 'com.affine.page-properties.property.edgelessTheme', + description: 'com.affine.page-properties.property.edgelessTheme.tooltips', + }, } as Record< string, { diff --git a/packages/frontend/core/src/components/doc-properties/types/edgeless-theme.css.ts b/packages/frontend/core/src/components/doc-properties/types/edgeless-theme.css.ts new file mode 100644 index 0000000000..7664162872 --- /dev/null +++ b/packages/frontend/core/src/components/doc-properties/types/edgeless-theme.css.ts @@ -0,0 +1,6 @@ +import { style } from '@vanilla-extract/css'; + +export const container = style({ + paddingTop: '3px', + paddingBottom: '3px', +}); diff --git a/packages/frontend/core/src/components/doc-properties/types/edgeless-theme.tsx b/packages/frontend/core/src/components/doc-properties/types/edgeless-theme.tsx new file mode 100644 index 0000000000..c418c5308c --- /dev/null +++ b/packages/frontend/core/src/components/doc-properties/types/edgeless-theme.tsx @@ -0,0 +1,48 @@ +import { PropertyValue, RadioGroup, type RadioItem } from '@affine/component'; +import { useI18n } from '@affine/i18n'; +import { DocService, useLiveData, useService } from '@toeverything/infra'; +import { useCallback, useMemo } from 'react'; + +import * as styles from './edgeless-theme.css'; + +const getThemeOptions = (t: ReturnType) => + [ + { + value: 'system', + label: t['com.affine.themeSettings.auto'](), + }, + { + value: 'light', + label: t['com.affine.themeSettings.light'](), + }, + { + value: 'dark', + label: t['com.affine.themeSettings.dark'](), + }, + ] satisfies RadioItem[]; + +export const EdgelessThemeValue = () => { + const t = useI18n(); + const doc = useService(DocService).doc; + const edgelessTheme = useLiveData(doc.properties$).edgelessColorTheme; + + const handleChange = useCallback( + (theme: string) => { + doc.record.setProperty('edgelessColorTheme', theme); + }, + [doc] + ); + const themeItems = useMemo(() => getThemeOptions(t), [t]); + + return ( + + + + ); +}; diff --git a/packages/frontend/core/src/components/hooks/use-journal.ts b/packages/frontend/core/src/components/hooks/use-journal.ts index dc27533de4..3562e4d321 100644 --- a/packages/frontend/core/src/components/hooks/use-journal.ts +++ b/packages/frontend/core/src/components/hooks/use-journal.ts @@ -1,4 +1,5 @@ import { EditorSettingService } from '@affine/core/modules/editor-setting'; +import type { EdgelessDefaultTheme } from '@affine/core/modules/editor-setting/schema'; import { JournalService } from '@affine/core/modules/journal'; import { i18nTime } from '@affine/i18n'; import { track } from '@affine/track'; @@ -11,11 +12,30 @@ import { useServices, } from '@toeverything/infra'; import dayjs from 'dayjs'; +import { useTheme } from 'next-themes'; import { useCallback, useMemo } from 'react'; import { WorkbenchService } from '../../modules/workbench'; import { useDocCollectionHelper } from './use-block-suite-workspace-helper'; +export const getValueByDefaultTheme = ( + defaultTheme: EdgelessDefaultTheme, + currentAppTheme: string +) => { + switch (defaultTheme) { + case 'dark': + return 'dark'; + case 'light': + return 'light'; + case 'specified': + return currentAppTheme === 'dark' ? 'dark' : 'light'; + case 'auto': + return 'system'; + default: + return 'system'; + } +}; + type MaybeDate = Date | string | number; export const JOURNAL_DATE_FORMAT = 'YYYY-MM-DD'; @@ -35,6 +55,7 @@ function toDayjs(j?: string | false) { */ export const useJournalHelper = (docCollection: DocCollection) => { const bsWorkspaceHelper = useDocCollectionHelper(docCollection); + const { resolvedTheme } = useTheme(); const { docsService, editorSettingService, journalService } = useServices({ DocsService, EditorSettingService, @@ -49,6 +70,13 @@ export const useJournalHelper = (docCollection: DocCollection) => { const day = dayjs(maybeDate); const title = day.format(JOURNAL_DATE_FORMAT); const page = bsWorkspaceHelper.createDoc(); + const value = getValueByDefaultTheme( + editorSettingService.editorSetting.settings$.value.edgelessDefaultTheme, + resolvedTheme || 'light' + ); + docsService.list + .doc$(page.id) + .value?.setProperty('edgelessColorTheme', value); docsService.list.setPrimaryMode(page.id, 'page'); // set created date to match the journal date page.collection.setDocMeta(page.id, { @@ -67,7 +95,13 @@ export const useJournalHelper = (docCollection: DocCollection) => { journalService.setJournalDate(page.id, title); return page; }, - [journalService, bsWorkspaceHelper, docsService.list, editorSettingService] + [ + bsWorkspaceHelper, + editorSettingService.editorSetting, + resolvedTheme, + docsService.list, + journalService, + ] ); /** diff --git a/packages/frontend/core/src/modules/editor-setting/schema.ts b/packages/frontend/core/src/modules/editor-setting/schema.ts index cfb256a2aa..1bbfd80798 100644 --- a/packages/frontend/core/src/modules/editor-setting/schema.ts +++ b/packages/frontend/core/src/modules/editor-setting/schema.ts @@ -4,6 +4,7 @@ import { z } from 'zod'; export const BSEditorSettingSchema = NodePropsSchema; export type FontFamily = 'Sans' | 'Serif' | 'Mono' | 'Custom'; +export type EdgelessDefaultTheme = 'auto' | 'dark' | 'light' | 'specified'; export const fontStyleOptions = [ { key: 'Sans', value: 'var(--affine-font-sans-family)' }, @@ -23,6 +24,9 @@ const AffineEditorSettingSchema = z.object({ fullWidthLayout: z.boolean().default(false), displayDocInfo: z.boolean().default(true), displayBiDirectionalLink: z.boolean().default(true), + edgelessDefaultTheme: z + .enum(['specified', 'dark', 'light', 'auto']) + .default('specified'), }); export const EditorSettingSchema = BSEditorSettingSchema.merge( diff --git a/packages/frontend/i18n/src/resources/en.json b/packages/frontend/i18n/src/resources/en.json index d5fbc0a0ef..7ff09941c2 100644 --- a/packages/frontend/i18n/src/resources/en.json +++ b/packages/frontend/i18n/src/resources/en.json @@ -680,6 +680,7 @@ "com.affine.page-properties.property.updatedBy": "Last edited by", "com.affine.page-properties.property.createdAt": "Created at", "com.affine.page-properties.property.updatedAt": "Updated at", + "com.affine.page-properties.property.edgelessTheme": "Edgeless theme", "com.affine.page-properties.property.tags.tooltips": "Add relevant identifiers or categories to the doc. Useful for organizing content, improving searchability, and grouping related docs together.", "com.affine.page-properties.property.journal.tooltips": "Indicates that this doc is a journal entry or daily note. Facilitates easy capture of ideas, quick logging of thoughts, and ongoing personal reflection.", "com.affine.page-properties.property.checkbox.tooltips": "Use a checkbox to indicate whether a condition is true or false. Useful for confirming options, toggling features, or tracking task states.", @@ -694,7 +695,7 @@ "com.affine.page-properties.property.createdBy.tooltips": "Displays the author of the current doc. Useful for tracking doc ownership, accountability, and collaboration.", "com.affine.page-properties.property.updatedBy.tooltips": "Displays the last editor of the current doc. Useful for tracking recent changes.", "com.affine.page-properties.property.docPrimaryMode.tooltips": "Select the doc mode from Page Mode, Edgeless Mode, or Auto. Useful for choosing the best display for your content.", - "com.affine.page-properties.property.docTheme.tooltips": "Select the doc theme from Light, Dark, or System. Useful for precise control over content viewing style.", + "com.affine.page-properties.property.edgelessTheme.tooltips": "Select the doc theme from Light, Dark, or System. Useful for precise control over content viewing style.", "com.affine.propertySidebar.property-list.section": "Properties", "com.affine.propertySidebar.add-more.section": "Add more properties", "com.affine.page-properties.settings.title": "customize properties", @@ -1124,6 +1125,9 @@ "com.affine.settings.editorSettings.page.display-doc-info.title": "Display doc info", "com.affine.settings.editorSettings.page.full-width.description": "Maximise display of content within a page.", "com.affine.settings.editorSettings.page.full-width.title": "Full width layout", + "com.affine.settings.editorSettings.page.edgeless-default-theme.description": "Set edgeless default color scheme.", + "com.affine.settings.editorSettings.page.edgeless-default-theme.title": "Edgeless default theme", + "com.affine.settings.editorSettings.page.edgeless-default-theme.specified": "Specified by current color mode", "com.affine.settings.editorSettings.preferences": "Preferences", "com.affine.settings.editorSettings.preferences.export.description": "You can export the entire preferences data for backup, and the exported data can be re-imported.", "com.affine.settings.editorSettings.preferences.export.title": "Export Settings", @@ -1267,6 +1271,7 @@ "com.affine.themeSettings.dark": "Dark", "com.affine.themeSettings.light": "Light", "com.affine.themeSettings.system": "System", + "com.affine.themeSettings.auto": "Auto", "com.affine.time.now": "now", "com.affine.time.this-mouth": "this month", "com.affine.time.this-week": "this week", diff --git a/packages/frontend/i18n/src/resources/zh-Hans.json b/packages/frontend/i18n/src/resources/zh-Hans.json index fe1993518f..c6fa6ed2ad 100644 --- a/packages/frontend/i18n/src/resources/zh-Hans.json +++ b/packages/frontend/i18n/src/resources/zh-Hans.json @@ -666,6 +666,7 @@ "com.affine.page-properties.property.docPrimaryMode": "文档模式", "com.affine.page-properties.property.text": "文本", "com.affine.page-properties.property.updatedBy": "最后编辑者", + "com.affine.page-properties.property.edgelessTheme": "无界配色方案", "com.affine.page-properties.property.tags.tooltips": "为文档添加相关标识或类别,有助于组织内容、提高搜索效率并将相关文档归类。", "com.affine.page-properties.property.journal.tooltips": "标识此文档为日志条目或日记,方便捕捉灵感、快速记录或自我反省。", "com.affine.page-properties.property.checkbox.tooltips": "用于标记该条目完成与否,适合确认选项、切换功能或跟踪任务状态。", @@ -680,7 +681,7 @@ "com.affine.page-properties.property.createdBy.tooltips": "显示当前文档的作者,用于跟踪所有权和协作情况。", "com.affine.page-properties.property.updatedBy.tooltips": "显示文档的最后编辑者,方便跟踪最新更改。", "com.affine.page-properties.property.docPrimaryMode.tooltips": "选择页面模式、无边界模式或自动模式,适合根据内容选择最佳显示方式。", - "com.affine.page-properties.property.docTheme.tooltips": "选择浅色、深色或系统主题,精确控制内容的查看样式。", + "com.affine.page-properties.property.edgelessTheme.tooltips": "选择浅色、深色或系统主题,精确控制内容的查看样式。", "com.affine.page-properties.settings.title": "自定义属性", "com.affine.page-properties.tags.open-tags-page": "打开标签页面", "com.affine.page-properties.tags.selector-header-title": "选择或者创建一个标签", @@ -1088,6 +1089,9 @@ "com.affine.settings.editorSettings.page.display-doc-info.title": "显示文档信息", "com.affine.settings.editorSettings.page.full-width.description": "文档内容的最大显示量。", "com.affine.settings.editorSettings.page.full-width.title": "全宽布局", + "com.affine.settings.editorSettings.page.edgeless-default-theme.description": "设置默认的无界配色方案。", + "com.affine.settings.editorSettings.page.edgeless-default-theme.title": "无界默认配色方案", + "com.affine.settings.editorSettings.page.edgeless-default-theme.specified": "由当前应用的配色方案指定", "com.affine.settings.editorSettings.preferences": "首选项", "com.affine.settings.editorSettings.preferences.export.description": "您可以导出整个首选项数据进行备份,然后可以重新导入导出的数据。", "com.affine.settings.editorSettings.preferences.export.title": "导出设置", @@ -1230,6 +1234,7 @@ "com.affine.themeSettings.dark": "深色", "com.affine.themeSettings.light": "浅色", "com.affine.themeSettings.system": "跟随系统", + "com.affine.themeSettings.auto": "自动", "com.affine.time.now": "刚刚", "com.affine.time.this-mouth": "本月", "com.affine.time.this-week": "本周", diff --git a/tests/affine-local/e2e/page-properties.spec.ts b/tests/affine-local/e2e/page-properties.spec.ts index 474735d1a8..c714bb7339 100644 --- a/tests/affine-local/e2e/page-properties.spec.ts +++ b/tests/affine-local/e2e/page-properties.spec.ts @@ -129,6 +129,7 @@ test('property table reordering', async ({ page }) => { 'Created at', 'Updated at', 'Created by', + 'Edgeless theme', 'Number', 'Date', 'Checkbox', @@ -172,6 +173,7 @@ test('page info show more will show all properties', async ({ page }) => { 'Created at', 'Updated at', 'Created by', + 'Edgeless theme', 'Text', 'Number', 'Date', diff --git a/tools/cli/package.json b/tools/cli/package.json index 5076f35797..f6505f14c2 100644 --- a/tools/cli/package.json +++ b/tools/cli/package.json @@ -6,7 +6,7 @@ "@affine/env": "workspace:*", "@affine/templates": "workspace:*", "@aws-sdk/client-s3": "^3.620.0", - "@blocksuite/affine": "0.17.23", + "@blocksuite/affine": "0.17.25", "@clack/core": "^0.3.4", "@clack/prompts": "^0.7.0", "@magic-works/i18n-codegen": "^0.6.0", diff --git a/yarn.lock b/yarn.lock index fc7028eaba..90532964bf 100644 --- a/yarn.lock +++ b/yarn.lock @@ -213,7 +213,7 @@ __metadata: "@affine/component": "workspace:*" "@affine/core": "workspace:*" "@affine/i18n": "workspace:*" - "@blocksuite/affine": "npm:0.17.23" + "@blocksuite/affine": "npm:0.17.25" "@blocksuite/icons": "npm:^2.1.67" "@capacitor/android": "npm:^6.1.2" "@capacitor/cli": "npm:^6.1.2" @@ -260,7 +260,7 @@ __metadata: "@affine/env": "workspace:*" "@affine/templates": "workspace:*" "@aws-sdk/client-s3": "npm:^3.620.0" - "@blocksuite/affine": "npm:0.17.23" + "@blocksuite/affine": "npm:0.17.25" "@clack/core": "npm:^0.3.4" "@clack/prompts": "npm:^0.7.0" "@magic-works/i18n-codegen": "npm:^0.6.0" @@ -317,7 +317,7 @@ __metadata: "@affine/i18n": "workspace:*" "@atlaskit/pragmatic-drag-and-drop": "npm:^1.2.1" "@atlaskit/pragmatic-drag-and-drop-hitbox": "npm:^1.0.3" - "@blocksuite/affine": "npm:0.17.23" + "@blocksuite/affine": "npm:0.17.25" "@blocksuite/icons": "npm:2.1.69" "@chromatic-com/storybook": "npm:^3.0.0" "@emotion/react": "npm:^11.11.4" @@ -389,7 +389,7 @@ __metadata: "@affine/i18n": "workspace:*" "@affine/templates": "workspace:*" "@affine/track": "workspace:*" - "@blocksuite/affine": "npm:0.17.23" + "@blocksuite/affine": "npm:0.17.25" "@blocksuite/icons": "npm:2.1.69" "@capacitor/app": "npm:^6.0.1" "@capacitor/browser": "npm:^6.0.3" @@ -496,7 +496,7 @@ __metadata: "@affine/core": "workspace:*" "@affine/i18n": "workspace:*" "@affine/native": "workspace:*" - "@blocksuite/affine": "npm:0.17.23" + "@blocksuite/affine": "npm:0.17.25" "@electron-forge/cli": "npm:^7.3.0" "@electron-forge/core": "npm:^7.3.0" "@electron-forge/core-utils": "npm:^7.3.0" @@ -550,7 +550,7 @@ __metadata: version: 0.0.0-use.local resolution: "@affine/env@workspace:packages/common/env" dependencies: - "@blocksuite/affine": "npm:0.17.23" + "@blocksuite/affine": "npm:0.17.25" vitest: "npm:2.1.1" zod: "npm:^3.22.4" peerDependencies: @@ -599,7 +599,7 @@ __metadata: "@affine/component": "workspace:*" "@affine/core": "workspace:*" "@affine/i18n": "workspace:*" - "@blocksuite/affine": "npm:0.17.23" + "@blocksuite/affine": "npm:0.17.25" "@blocksuite/icons": "npm:^2.1.67" "@capacitor/app": "npm:^6.0.1" "@capacitor/browser": "npm:^6.0.3" @@ -624,7 +624,7 @@ __metadata: "@affine/component": "workspace:*" "@affine/core": "workspace:*" "@affine/i18n": "workspace:*" - "@blocksuite/affine": "npm:0.17.23" + "@blocksuite/affine": "npm:0.17.25" "@blocksuite/icons": "npm:^2.1.67" "@sentry/react": "npm:^8.0.0" "@types/react": "npm:^18.2.75" @@ -2500,19 +2500,19 @@ __metadata: languageName: node linkType: hard -"@blocksuite/affine-block-embed@npm:0.17.23": - version: 0.17.23 - resolution: "@blocksuite/affine-block-embed@npm:0.17.23" +"@blocksuite/affine-block-embed@npm:0.17.25": + version: 0.17.25 + resolution: "@blocksuite/affine-block-embed@npm:0.17.25" dependencies: - "@blocksuite/affine-block-surface": "npm:0.17.23" - "@blocksuite/affine-components": "npm:0.17.23" - "@blocksuite/affine-model": "npm:0.17.23" - "@blocksuite/affine-shared": "npm:0.17.23" - "@blocksuite/block-std": "npm:0.17.23" - "@blocksuite/global": "npm:0.17.23" + "@blocksuite/affine-block-surface": "npm:0.17.25" + "@blocksuite/affine-components": "npm:0.17.25" + "@blocksuite/affine-model": "npm:0.17.25" + "@blocksuite/affine-shared": "npm:0.17.25" + "@blocksuite/block-std": "npm:0.17.25" + "@blocksuite/global": "npm:0.17.25" "@blocksuite/icons": "npm:^2.1.68" - "@blocksuite/inline": "npm:0.17.23" - "@blocksuite/store": "npm:0.17.23" + "@blocksuite/inline": "npm:0.17.25" + "@blocksuite/store": "npm:0.17.25" "@floating-ui/dom": "npm:^1.6.10" "@lit/context": "npm:^1.1.2" "@preact/signals-core": "npm:^1.8.0" @@ -2520,21 +2520,21 @@ __metadata: lit: "npm:^3.2.0" minimatch: "npm:^10.0.1" zod: "npm:^3.23.8" - checksum: 10/4045c0cd7b3f925c3c62bdce0684735cd64f29d9f1370cb19cc3d4bed16ab77e870f59a9532ebf50ea167b5d230e68c5afd731cb4e2559f9f3194b1817495777 + checksum: 10/b48160b5b5d137f32849e66693ec594507a038d380a5bf0acfa776b280266c8c22e906a9699973872f79f337ec5ad0287726339a2294c8c5b99098cb20bed6bc languageName: node linkType: hard -"@blocksuite/affine-block-list@npm:0.17.23": - version: 0.17.23 - resolution: "@blocksuite/affine-block-list@npm:0.17.23" +"@blocksuite/affine-block-list@npm:0.17.25": + version: 0.17.25 + resolution: "@blocksuite/affine-block-list@npm:0.17.25" dependencies: - "@blocksuite/affine-components": "npm:0.17.23" - "@blocksuite/affine-model": "npm:0.17.23" - "@blocksuite/affine-shared": "npm:0.17.23" - "@blocksuite/block-std": "npm:0.17.23" - "@blocksuite/global": "npm:0.17.23" - "@blocksuite/inline": "npm:0.17.23" - "@blocksuite/store": "npm:0.17.23" + "@blocksuite/affine-components": "npm:0.17.25" + "@blocksuite/affine-model": "npm:0.17.25" + "@blocksuite/affine-shared": "npm:0.17.25" + "@blocksuite/block-std": "npm:0.17.25" + "@blocksuite/global": "npm:0.17.25" + "@blocksuite/inline": "npm:0.17.25" + "@blocksuite/store": "npm:0.17.25" "@floating-ui/dom": "npm:^1.6.10" "@lit/context": "npm:^1.1.2" "@preact/signals-core": "npm:^1.8.0" @@ -2542,21 +2542,21 @@ __metadata: lit: "npm:^3.2.0" minimatch: "npm:^10.0.1" zod: "npm:^3.23.8" - checksum: 10/bdd6839a39231deebc6b0ce1fc3b8076b91940fa482e29549ca27cbc5aac198483c801a1ce08ddcd2a27e4b3410fb1589ce1e8571d858776701c637c1d739ffe + checksum: 10/994475e2bcbfb726b47e5fba70e545b3d50658c91cff310a0f9952d18a108f451a5fbf4b81796f8d19cdf6fa3bd8e8f6597a5c76595dd3938d4265984335f9ba languageName: node linkType: hard -"@blocksuite/affine-block-paragraph@npm:0.17.23": - version: 0.17.23 - resolution: "@blocksuite/affine-block-paragraph@npm:0.17.23" +"@blocksuite/affine-block-paragraph@npm:0.17.25": + version: 0.17.25 + resolution: "@blocksuite/affine-block-paragraph@npm:0.17.25" dependencies: - "@blocksuite/affine-components": "npm:0.17.23" - "@blocksuite/affine-model": "npm:0.17.23" - "@blocksuite/affine-shared": "npm:0.17.23" - "@blocksuite/block-std": "npm:0.17.23" - "@blocksuite/global": "npm:0.17.23" - "@blocksuite/inline": "npm:0.17.23" - "@blocksuite/store": "npm:0.17.23" + "@blocksuite/affine-components": "npm:0.17.25" + "@blocksuite/affine-model": "npm:0.17.25" + "@blocksuite/affine-shared": "npm:0.17.25" + "@blocksuite/block-std": "npm:0.17.25" + "@blocksuite/global": "npm:0.17.25" + "@blocksuite/inline": "npm:0.17.25" + "@blocksuite/store": "npm:0.17.25" "@floating-ui/dom": "npm:^1.6.10" "@lit/context": "npm:^1.1.2" "@preact/signals-core": "npm:^1.8.0" @@ -2564,21 +2564,21 @@ __metadata: lit: "npm:^3.2.0" minimatch: "npm:^10.0.1" zod: "npm:^3.23.8" - checksum: 10/c93ae6afeaf8ec764e5e1ade6dac8cbf7224edb9bcfaf2a94c082f783cbd9fea5c0e9cf38db0d7e2070e2097cbc43b22ff6cacfa28c041eecf91c44c4a1d1a43 + checksum: 10/433caea64ddd161ede92d27d0f4a685141c14378118393061c2521d03c5d7a62c321c14a2262bf68f2f0c0a558a060fe9d43fe75b0239c1a3f950c6ccf5813df languageName: node linkType: hard -"@blocksuite/affine-block-surface@npm:0.17.23": - version: 0.17.23 - resolution: "@blocksuite/affine-block-surface@npm:0.17.23" +"@blocksuite/affine-block-surface@npm:0.17.25": + version: 0.17.25 + resolution: "@blocksuite/affine-block-surface@npm:0.17.25" dependencies: - "@blocksuite/affine-components": "npm:0.17.23" - "@blocksuite/affine-model": "npm:0.17.23" - "@blocksuite/affine-shared": "npm:0.17.23" - "@blocksuite/block-std": "npm:0.17.23" - "@blocksuite/global": "npm:0.17.23" - "@blocksuite/inline": "npm:0.17.23" - "@blocksuite/store": "npm:0.17.23" + "@blocksuite/affine-components": "npm:0.17.25" + "@blocksuite/affine-model": "npm:0.17.25" + "@blocksuite/affine-shared": "npm:0.17.25" + "@blocksuite/block-std": "npm:0.17.25" + "@blocksuite/global": "npm:0.17.25" + "@blocksuite/inline": "npm:0.17.25" + "@blocksuite/store": "npm:0.17.25" "@lit/context": "npm:^1.1.2" "@preact/signals-core": "npm:^1.8.0" "@toeverything/theme": "npm:^1.0.15" @@ -2587,21 +2587,21 @@ __metadata: lodash.chunk: "npm:^4.2.0" nanoid: "npm:^5.0.7" zod: "npm:^3.23.8" - checksum: 10/a206839442d618ed8a7a77f4b4ea497b1268d0e8592205ee01cc7cc308f38b4f0af09daeaf0c2325eab02aebdf3d674dfec745fcf373c53def92fda3eeffca68 + checksum: 10/3f170a8f8e103924c5b28b4002e74c7e2e985cde69ff223e475964cb0f54d202a6928228f16d1b8c704b73c8db6ab71c63586cf202695eb8ee9bdbeeb14f73cb languageName: node linkType: hard -"@blocksuite/affine-components@npm:0.17.23": - version: 0.17.23 - resolution: "@blocksuite/affine-components@npm:0.17.23" +"@blocksuite/affine-components@npm:0.17.25": + version: 0.17.25 + resolution: "@blocksuite/affine-components@npm:0.17.25" dependencies: - "@blocksuite/affine-model": "npm:0.17.23" - "@blocksuite/affine-shared": "npm:0.17.23" - "@blocksuite/block-std": "npm:0.17.23" - "@blocksuite/global": "npm:0.17.23" + "@blocksuite/affine-model": "npm:0.17.25" + "@blocksuite/affine-shared": "npm:0.17.25" + "@blocksuite/block-std": "npm:0.17.25" + "@blocksuite/global": "npm:0.17.25" "@blocksuite/icons": "npm:^2.1.68" - "@blocksuite/inline": "npm:0.17.23" - "@blocksuite/store": "npm:0.17.23" + "@blocksuite/inline": "npm:0.17.25" + "@blocksuite/store": "npm:0.17.25" "@floating-ui/dom": "npm:^1.6.10" "@lit/context": "npm:^1.1.2" "@lottiefiles/dotlottie-wc": "npm:^0.2.16" @@ -2612,33 +2612,33 @@ __metadata: lit: "npm:^3.2.0" shiki: "npm:^1.12.0" zod: "npm:^3.23.8" - checksum: 10/7a2c47a073afdb80db3e8f2f6fe4dcd5cc062459d5729e25f817d4f923d52fc41442d125f31d4584219cd8144661ac1929226e20b48e50174a4c9e97395b7e2a + checksum: 10/664fe9313bd63c7a99330434b70c34aeb2af01110122a2ee08f1017b1c7a449ae2be87fb79b6a960b4c00919e9ea1eeb414bf958d0a5804491bff8bc45064304 languageName: node linkType: hard -"@blocksuite/affine-model@npm:0.17.23": - version: 0.17.23 - resolution: "@blocksuite/affine-model@npm:0.17.23" +"@blocksuite/affine-model@npm:0.17.25": + version: 0.17.25 + resolution: "@blocksuite/affine-model@npm:0.17.25" dependencies: - "@blocksuite/block-std": "npm:0.17.23" - "@blocksuite/global": "npm:0.17.23" - "@blocksuite/inline": "npm:0.17.23" - "@blocksuite/store": "npm:0.17.23" + "@blocksuite/block-std": "npm:0.17.25" + "@blocksuite/global": "npm:0.17.25" + "@blocksuite/inline": "npm:0.17.25" + "@blocksuite/store": "npm:0.17.25" fractional-indexing: "npm:^3.2.0" zod: "npm:^3.23.8" - checksum: 10/32d6e8bac9da392ab4731801802579abbe54b7faa5e74e6c0c15041d8663e85dba9d8860300d8d57cd21f71ee1b81f1bee6d6669771a22dc5158574fd694dca2 + checksum: 10/464ccb4d50d4513f00a9dd8f54ba4f313cd95cb841ad23a7be2c2289370c7fb29e7c943f2bc7ef7e3c97c834ac0849a902920efa13dc1a8277bfd2472216b9e1 languageName: node linkType: hard -"@blocksuite/affine-shared@npm:0.17.23": - version: 0.17.23 - resolution: "@blocksuite/affine-shared@npm:0.17.23" +"@blocksuite/affine-shared@npm:0.17.25": + version: 0.17.25 + resolution: "@blocksuite/affine-shared@npm:0.17.25" dependencies: - "@blocksuite/affine-model": "npm:0.17.23" - "@blocksuite/block-std": "npm:0.17.23" - "@blocksuite/global": "npm:0.17.23" - "@blocksuite/inline": "npm:0.17.23" - "@blocksuite/store": "npm:0.17.23" + "@blocksuite/affine-model": "npm:0.17.25" + "@blocksuite/block-std": "npm:0.17.25" + "@blocksuite/global": "npm:0.17.25" + "@blocksuite/inline": "npm:0.17.25" + "@blocksuite/store": "npm:0.17.25" "@floating-ui/dom": "npm:^1.6.10" "@lit/context": "npm:^1.1.2" "@preact/signals-core": "npm:^1.8.0" @@ -2648,46 +2648,46 @@ __metadata: lodash.mergewith: "npm:^4.6.2" minimatch: "npm:^10.0.1" zod: "npm:^3.23.8" - checksum: 10/da8f0f303c49787bbfeefdafdc08036a91b7362fa954cdf81ade3ee44be99cbbaa16b34610190c56f695aa79de3449630621d90272916fff4ae6180f06ad4931 + checksum: 10/6f59ef026c0a33d64b56171082771c8cedfa24b2f6426a1a74d7f164dc9529a9aea1cfa3749d86c681bdcd819f107ba2142ab915860e1d5bd9163bb5c54f937b languageName: node linkType: hard -"@blocksuite/affine-widget-scroll-anchoring@npm:0.17.23": - version: 0.17.23 - resolution: "@blocksuite/affine-widget-scroll-anchoring@npm:0.17.23" +"@blocksuite/affine-widget-scroll-anchoring@npm:0.17.25": + version: 0.17.25 + resolution: "@blocksuite/affine-widget-scroll-anchoring@npm:0.17.25" dependencies: - "@blocksuite/affine-model": "npm:0.17.23" - "@blocksuite/affine-shared": "npm:0.17.23" - "@blocksuite/block-std": "npm:0.17.23" - "@blocksuite/global": "npm:0.17.23" + "@blocksuite/affine-model": "npm:0.17.25" + "@blocksuite/affine-shared": "npm:0.17.25" + "@blocksuite/block-std": "npm:0.17.25" + "@blocksuite/global": "npm:0.17.25" "@preact/signals-core": "npm:^1.8.0" "@toeverything/theme": "npm:^1.0.15" lit: "npm:^3.2.0" - checksum: 10/796302a37e0d0d3e076f7b2b6b09dcbb77480ec44b62e4b02d01e3823f8d1afb380c19248caa62efe9b7e7650da45979b19208150df76caf732d48a0d5803a62 + checksum: 10/c9ddadf94266eec3889f96040b28aa2ed79fa3256c124880d972d7500e30c09a31ab8c0197f9f11de16dd53f980431d9f712ac7991bc4a36e853ce38b4a4914e languageName: node linkType: hard -"@blocksuite/affine@npm:0.17.23": - version: 0.17.23 - resolution: "@blocksuite/affine@npm:0.17.23" +"@blocksuite/affine@npm:0.17.25": + version: 0.17.25 + resolution: "@blocksuite/affine@npm:0.17.25" dependencies: - "@blocksuite/block-std": "npm:0.17.23" - "@blocksuite/blocks": "npm:0.17.23" - "@blocksuite/global": "npm:0.17.23" - "@blocksuite/inline": "npm:0.17.23" - "@blocksuite/presets": "npm:0.17.23" - "@blocksuite/store": "npm:0.17.23" - checksum: 10/ca25492a9aba8b6c192d1b94f906817f537a53496985c4157c0b3db74e4d7f985e2eb8f591ddaccb1f1bd8ee010d7ef3e2a8b86cdfd735d9beaa21af1bf592aa + "@blocksuite/block-std": "npm:0.17.25" + "@blocksuite/blocks": "npm:0.17.25" + "@blocksuite/global": "npm:0.17.25" + "@blocksuite/inline": "npm:0.17.25" + "@blocksuite/presets": "npm:0.17.25" + "@blocksuite/store": "npm:0.17.25" + checksum: 10/3c40fdcc7cd7e7ca457515dc819cb6e18aa5030cad28e2af55fe88747a0d9097c7136687b823ba8f28eed0b36b52d770caeb0a924a6fa90358883855e195f26e languageName: node linkType: hard -"@blocksuite/block-std@npm:0.17.23": - version: 0.17.23 - resolution: "@blocksuite/block-std@npm:0.17.23" +"@blocksuite/block-std@npm:0.17.25": + version: 0.17.25 + resolution: "@blocksuite/block-std@npm:0.17.25" dependencies: - "@blocksuite/global": "npm:0.17.23" - "@blocksuite/inline": "npm:0.17.23" - "@blocksuite/store": "npm:0.17.23" + "@blocksuite/global": "npm:0.17.25" + "@blocksuite/inline": "npm:0.17.25" + "@blocksuite/store": "npm:0.17.25" "@lit/context": "npm:^1.1.2" "@preact/signals-core": "npm:^1.8.0" "@types/hast": "npm:^3.0.4" @@ -2699,28 +2699,28 @@ __metadata: unified: "npm:^11.0.5" w3c-keyname: "npm:^2.2.8" zod: "npm:^3.23.8" - checksum: 10/9d7c714e035c3592994a4d48cd3046d672126652a7a0815b9cba4ea69511e98766d3bacfbf50471ae1ca90a3114a58c7d4ec4219aa1ac835d8f0ee266c45f591 + checksum: 10/30136bab77547cabd58df84dcc8aa4eddbab99a586e12678971100d3f37075ec0d4bafe5c1b816be29ad0a5d3848daa5f79a59c3a2fdc7db0d61c02855cc1416 languageName: node linkType: hard -"@blocksuite/blocks@npm:0.17.23": - version: 0.17.23 - resolution: "@blocksuite/blocks@npm:0.17.23" +"@blocksuite/blocks@npm:0.17.25": + version: 0.17.25 + resolution: "@blocksuite/blocks@npm:0.17.25" dependencies: - "@blocksuite/affine-block-embed": "npm:0.17.23" - "@blocksuite/affine-block-list": "npm:0.17.23" - "@blocksuite/affine-block-paragraph": "npm:0.17.23" - "@blocksuite/affine-block-surface": "npm:0.17.23" - "@blocksuite/affine-components": "npm:0.17.23" - "@blocksuite/affine-model": "npm:0.17.23" - "@blocksuite/affine-shared": "npm:0.17.23" - "@blocksuite/affine-widget-scroll-anchoring": "npm:0.17.23" - "@blocksuite/block-std": "npm:0.17.23" - "@blocksuite/data-view": "npm:0.17.23" - "@blocksuite/global": "npm:0.17.23" + "@blocksuite/affine-block-embed": "npm:0.17.25" + "@blocksuite/affine-block-list": "npm:0.17.25" + "@blocksuite/affine-block-paragraph": "npm:0.17.25" + "@blocksuite/affine-block-surface": "npm:0.17.25" + "@blocksuite/affine-components": "npm:0.17.25" + "@blocksuite/affine-model": "npm:0.17.25" + "@blocksuite/affine-shared": "npm:0.17.25" + "@blocksuite/affine-widget-scroll-anchoring": "npm:0.17.25" + "@blocksuite/block-std": "npm:0.17.25" + "@blocksuite/data-view": "npm:0.17.25" + "@blocksuite/global": "npm:0.17.25" "@blocksuite/icons": "npm:^2.1.68" - "@blocksuite/inline": "npm:0.17.23" - "@blocksuite/store": "npm:0.17.23" + "@blocksuite/inline": "npm:0.17.25" + "@blocksuite/store": "npm:0.17.25" "@floating-ui/dom": "npm:^1.6.10" "@lit/context": "npm:^1.1.2" "@preact/signals-core": "npm:^1.8.0" @@ -2759,20 +2759,20 @@ __metadata: sortablejs: "npm:^1.15.2" unified: "npm:^11.0.5" zod: "npm:^3.23.8" - checksum: 10/c4b64df6bf3c7bff3f33aa7c3e5b0d3e4cf1f7af453d9f92ac9d3da5497bce6d61dd00846ef3a57b1fb58a5d3b3242279eac2a5ff3d56fe0e9fe6e67d8e4c24f + checksum: 10/234dfd791e7ffd467e3734548e100a7285ff1aab613a5f3023d25fe730b91dff37d6a547e267929f766a7b3bb6ac90ae6ce781c70d27ecfc69646e6ffb5abf33 languageName: node linkType: hard -"@blocksuite/data-view@npm:0.17.23": - version: 0.17.23 - resolution: "@blocksuite/data-view@npm:0.17.23" +"@blocksuite/data-view@npm:0.17.25": + version: 0.17.25 + resolution: "@blocksuite/data-view@npm:0.17.25" dependencies: - "@blocksuite/affine-components": "npm:0.17.23" - "@blocksuite/affine-shared": "npm:0.17.23" - "@blocksuite/block-std": "npm:0.17.23" - "@blocksuite/global": "npm:0.17.23" + "@blocksuite/affine-components": "npm:0.17.25" + "@blocksuite/affine-shared": "npm:0.17.25" + "@blocksuite/block-std": "npm:0.17.25" + "@blocksuite/global": "npm:0.17.25" "@blocksuite/icons": "npm:^2.1.68" - "@blocksuite/store": "npm:0.17.23" + "@blocksuite/store": "npm:0.17.25" "@floating-ui/dom": "npm:^1.6.10" "@lit/context": "npm:^1.1.2" "@preact/signals-core": "npm:^1.8.0" @@ -2781,19 +2781,19 @@ __metadata: lit: "npm:^3.2.0" sortablejs: "npm:^1.15.2" zod: "npm:^3.23.8" - checksum: 10/d189564c2e2ab6223dda746336a57290df37a14135d1376569e6b6d93dd86906ebdb9b97169bcf909390b443c030dc1e94de31eca5363b5d717f7215d2ab4400 + checksum: 10/c7269835e5fca6c06c4982287790aa8c643352f36163e861d56e2f003c4a98ec0be8abd8eb5d4629ba82c09637d3beae12af52e4894873064a8c95d5a73c2fd9 languageName: node linkType: hard -"@blocksuite/global@npm:0.17.23": - version: 0.17.23 - resolution: "@blocksuite/global@npm:0.17.23" +"@blocksuite/global@npm:0.17.25": + version: 0.17.25 + resolution: "@blocksuite/global@npm:0.17.25" dependencies: "@preact/signals-core": "npm:^1.8.0" lib0: "npm:^0.2.97" lit: "npm:^3.2.0" zod: "npm:^3.23.8" - checksum: 10/df92824eb3a81d43825338923e3302535f4da96a3a1f593a0b29211664619433db372a8843135205ed0615f079cb519070c886f5d38aed6d9328ec2a438396fb + checksum: 10/6c6309e10facbe3472d182c58a1a5a72e22847d340890c1df65331c72abcee04e633c2d88a962f3215604415c95b688a6efd89ccae12fc39d544366abdbbd607 languageName: node linkType: hard @@ -2813,49 +2813,49 @@ __metadata: languageName: node linkType: hard -"@blocksuite/inline@npm:0.17.23": - version: 0.17.23 - resolution: "@blocksuite/inline@npm:0.17.23" +"@blocksuite/inline@npm:0.17.25": + version: 0.17.25 + resolution: "@blocksuite/inline@npm:0.17.25" dependencies: - "@blocksuite/global": "npm:0.17.23" + "@blocksuite/global": "npm:0.17.25" "@preact/signals-core": "npm:^1.8.0" zod: "npm:^3.23.8" peerDependencies: lit: ^3.2.0 yjs: ^13.6.18 - checksum: 10/96cb7e3bf4005e758f29c1542e611cbf4b5fd9644f14c9cda7e2fc88f4507b0ba46b752c2167ea5248a02a66a04268dcc2f7af43e16072fa235c643c4eaa8ed5 + checksum: 10/1e1d9ddf784a9ba46eb07dd03115a43c3c16820489ba63219168098f8db9d5099fe2d59d10a85c87973c64186f33ff5ce5efb93f4141fc8960fd46b01e969809 languageName: node linkType: hard -"@blocksuite/presets@npm:0.17.23": - version: 0.17.23 - resolution: "@blocksuite/presets@npm:0.17.23" +"@blocksuite/presets@npm:0.17.25": + version: 0.17.25 + resolution: "@blocksuite/presets@npm:0.17.25" dependencies: - "@blocksuite/affine-block-surface": "npm:0.17.23" - "@blocksuite/affine-model": "npm:0.17.23" - "@blocksuite/affine-shared": "npm:0.17.23" - "@blocksuite/block-std": "npm:0.17.23" - "@blocksuite/blocks": "npm:0.17.23" - "@blocksuite/global": "npm:0.17.23" - "@blocksuite/inline": "npm:0.17.23" - "@blocksuite/store": "npm:0.17.23" + "@blocksuite/affine-block-surface": "npm:0.17.25" + "@blocksuite/affine-model": "npm:0.17.25" + "@blocksuite/affine-shared": "npm:0.17.25" + "@blocksuite/block-std": "npm:0.17.25" + "@blocksuite/blocks": "npm:0.17.25" + "@blocksuite/global": "npm:0.17.25" + "@blocksuite/inline": "npm:0.17.25" + "@blocksuite/store": "npm:0.17.25" "@floating-ui/dom": "npm:^1.6.10" "@lottiefiles/dotlottie-wc": "npm:^0.2.16" "@preact/signals-core": "npm:^1.8.0" "@toeverything/theme": "npm:^1.0.15" lit: "npm:^3.2.0" zod: "npm:^3.23.8" - checksum: 10/5cac3751dccd1221b86a871abbb3fac0da69eae5fe24361dbb8d72e15b5a4d5055117fd201d7a60cfc5233a6be86979cfd67ee1d7dfe440b3bd1e8ea297e0f53 + checksum: 10/25e39c4efea947695ade92445147f6bd4404d49a6db506e6e020c397b71d8a3572eaea200ad2b6420f32662f12df1be1c1bd0f1daa191de0cb1a2aa8594b297d languageName: node linkType: hard -"@blocksuite/store@npm:0.17.23": - version: 0.17.23 - resolution: "@blocksuite/store@npm:0.17.23" +"@blocksuite/store@npm:0.17.25": + version: 0.17.25 + resolution: "@blocksuite/store@npm:0.17.25" dependencies: - "@blocksuite/global": "npm:0.17.23" - "@blocksuite/inline": "npm:0.17.23" - "@blocksuite/sync": "npm:0.17.23" + "@blocksuite/global": "npm:0.17.25" + "@blocksuite/inline": "npm:0.17.25" + "@blocksuite/sync": "npm:0.17.25" "@preact/signals-core": "npm:^1.8.0" "@types/flexsearch": "npm:^0.7.6" "@types/lodash.ismatch": "npm:^4.4.9" @@ -2871,21 +2871,21 @@ __metadata: zod: "npm:^3.23.8" peerDependencies: yjs: ^13.6.18 - checksum: 10/f3cf433a4b1b2b4245a8fa6792064b790d673956270023903121d5bccb28c3ddd95cafd28ee19dc4dd799a78006a37f7441665a819fcd548ea8172d82e2f2310 + checksum: 10/24db18746d79d72cc95e60d1b368a2de3152cc2794de784722b4902ac0c0a5e4f0765e9f1ab8ab4b21f2d222383bc9550ebfd937f94922fd43df3c72c750652f languageName: node linkType: hard -"@blocksuite/sync@npm:0.17.23": - version: 0.17.23 - resolution: "@blocksuite/sync@npm:0.17.23" +"@blocksuite/sync@npm:0.17.25": + version: 0.17.25 + resolution: "@blocksuite/sync@npm:0.17.25" dependencies: - "@blocksuite/global": "npm:0.17.23" + "@blocksuite/global": "npm:0.17.25" idb: "npm:^8.0.0" idb-keyval: "npm:^6.2.1" y-protocols: "npm:^1.0.6" peerDependencies: yjs: ^13.6.15 - checksum: 10/3a790b3eaae6089dcb2ae978c0f6686a06bc654a51e8a87a93c82e6cc424d52b10d31b5c3ec8e45411eec0056d23040f4be708f83dcec4c9f2d19fd124665a07 + checksum: 10/219acaf09b364ac21a72db36bb11b1abe8b82940bce0052a3bfa1dbf9eac3753ed67f64285a3a8219a570f15980f6818ee5d33a7b8d085c40408e9f5e3965707 languageName: node linkType: hard @@ -13355,7 +13355,7 @@ __metadata: "@affine/debug": "workspace:*" "@affine/env": "workspace:*" "@affine/templates": "workspace:*" - "@blocksuite/affine": "npm:0.17.23" + "@blocksuite/affine": "npm:0.17.25" "@datastructures-js/binary-search-tree": "npm:^5.3.2" "@testing-library/react": "npm:^16.0.0" fake-indexeddb: "npm:^6.0.0"